From: Cris Di Sclafani Date: Thu, 27 Aug 2020 14:45:19 +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?a=commitdiff_plain;h=fe838457b97b59b8fd9a743c27329436d9a4f709;p=motion2.git Built motion from commit (unavailable).|2.5.0 --- diff --git a/apidoc/api_project.js b/apidoc/api_project.js index 61efa2b..ef1a63a 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-27T14:21:03.166Z", "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-27T14:38:24.707Z", "url": "http://apidocjs.com", "version": "0.19.0" } }); diff --git a/apidoc/api_project.json b/apidoc/api_project.json index db32b9c..8e99dfd 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-27T14:21:03.166Z", "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-27T14:38:24.707Z", "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 b3d188c..032ed70 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 _0x7426=['urlForward','browser','bot','script','Allowed\x20values:\x20contactManager,\x20integration,\x20motionbar,\x20jscripty,\x20urlForward,\x20browser,\x20bot,\x20script','contactManager[ListId],\x20integration[intName(zendesk)],\x20motionbar[Popup(0),URL(1),WinApp(2)],\x20urlForward[GET,POST],\x20browser[TemplateId(0),URL(1)]','integration[AccountId],\x20motionbar[TemplateId,URL,WinAppPath],\x20urlForward[URL]','motionbar[NULL,NULL,WinAppArguments]','TEXT','sequelize','exports','VIRTUAL','getDataValue','action','STRING','contactManager','integration','motionbar','jscripty'];(function(_0x1f72aa,_0x1b123a){var _0x3f09e9=function(_0xdeab19){while(--_0xdeab19){_0x1f72aa['push'](_0x1f72aa['shift']());}};_0x3f09e9(++_0x1b123a);}(_0x7426,0x1be));var _0x6742=function(_0x1ad489,_0x331cc0){_0x1ad489=_0x1ad489-0x0;var _0x12ba56=_0x7426[_0x1ad489];return _0x12ba56;};'use strict';var Sequelize=require(_0x6742('0x0'));module[_0x6742('0x1')]={'name':{'type':Sequelize[_0x6742('0x2')],'get':function(_0x471435){return this[_0x6742('0x3')](_0x6742('0x4'));}},'action':{'type':Sequelize[_0x6742('0x5')],'allowNull':![],'validate':{'isIn':{'args':[[_0x6742('0x6'),_0x6742('0x7'),_0x6742('0x8'),_0x6742('0x9'),_0x6742('0xa'),_0x6742('0xb'),_0x6742('0xc'),_0x6742('0xd')]],'msg':_0x6742('0xe')}},'comment':_0x6742('0xe')},'data1':{'type':Sequelize[_0x6742('0x5')](0x1000),'comment':_0x6742('0xf')},'data2':{'type':Sequelize['STRING'](0x1000),'comment':_0x6742('0x10')},'data3':{'type':Sequelize[_0x6742('0x5')](0x1000),'comment':_0x6742('0x11')},'data4':{'type':Sequelize[_0x6742('0x5')](0x1000)},'data5':{'type':Sequelize[_0x6742('0x5')](0x1000)},'data6':{'type':Sequelize[_0x6742('0x5')]},'data7':{'type':Sequelize[_0x6742('0x12')]}}; \ No newline at end of file +var _0x3ec9=['integration[AccountId],\x20motionbar[TemplateId,URL,WinAppPath],\x20urlForward[URL]','motionbar[NULL,NULL,WinAppArguments]','sequelize','getDataValue','action','STRING','contactManager','integration','motionbar','urlForward','browser','bot','Allowed\x20values:\x20contactManager,\x20integration,\x20motionbar,\x20jscripty,\x20urlForward,\x20browser,\x20bot,\x20script','contactManager[ListId],\x20integration[intName(zendesk)],\x20motionbar[Popup(0),URL(1),WinApp(2)],\x20urlForward[GET,POST],\x20browser[TemplateId(0),URL(1)]'];(function(_0x460150,_0x232949){var _0x340677=function(_0x5b7e32){while(--_0x5b7e32){_0x460150['push'](_0x460150['shift']());}};_0x340677(++_0x232949);}(_0x3ec9,0xe2));var _0x93ec=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x3ec9[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require(_0x93ec('0x0'));module['exports']={'name':{'type':Sequelize['VIRTUAL'],'get':function(_0x56ffdb){return this[_0x93ec('0x1')](_0x93ec('0x2'));}},'action':{'type':Sequelize[_0x93ec('0x3')],'allowNull':![],'validate':{'isIn':{'args':[[_0x93ec('0x4'),_0x93ec('0x5'),_0x93ec('0x6'),'jscripty',_0x93ec('0x7'),_0x93ec('0x8'),_0x93ec('0x9'),'script']],'msg':_0x93ec('0xa')}},'comment':_0x93ec('0xa')},'data1':{'type':Sequelize[_0x93ec('0x3')](0x1000),'comment':_0x93ec('0xb')},'data2':{'type':Sequelize[_0x93ec('0x3')](0x1000),'comment':_0x93ec('0xc')},'data3':{'type':Sequelize[_0x93ec('0x3')](0x1000),'comment':_0x93ec('0xd')},'data4':{'type':Sequelize[_0x93ec('0x3')](0x1000)},'data5':{'type':Sequelize[_0x93ec('0x3')](0x1000)},'data6':{'type':Sequelize[_0x93ec('0x3')]},'data7':{'type':Sequelize['TEXT']}}; \ No newline at end of file diff --git a/server/api/action/action.controller.js b/server/api/action/action.controller.js index 415787c..2e0134f 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 _0x3109=['bluebird','mustache','util','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','status','end','json','count','offset','limit','set','apply','save','update','then','destroy','sendStatus','error','name','send','body','Action','find','params','catch','rimraf','zip-dir','fast-json-patch','request-promise','moment'];(function(_0x23aa26,_0x2018b0){var _0x3b7501=function(_0x641b48){while(--_0x641b48){_0x23aa26['push'](_0x23aa26['shift']());}};_0x3b7501(++_0x2018b0);}(_0x3109,0xaf));var _0x9310=function(_0x2a878c,_0x15914e){_0x2a878c=_0x2a878c-0x0;var _0x193b73=_0x3109[_0x2a878c];return _0x193b73;};'use strict';var pdf=require('html-pdf');var emlformat=require('eml-format');var rimraf=require(_0x9310('0x0'));var zipdir=require(_0x9310('0x1'));var jsonpatch=require(_0x9310('0x2'));var rp=require(_0x9310('0x3'));var moment=require(_0x9310('0x4'));var BPromise=require(_0x9310('0x5'));var Mustache=require(_0x9310('0x6'));var util=require(_0x9310('0x7'));var path=require('path');var sox=require(_0x9310('0x8'));var csv=require(_0x9310('0x9'));var ejs=require(_0x9310('0xa'));var fs=require('fs');var _=require(_0x9310('0xb'));var squel=require(_0x9310('0xc'));var crypto=require(_0x9310('0xd'));var jsforce=require(_0x9310('0xe'));var deskjs=require(_0x9310('0xf'));var toCsv=require(_0x9310('0x9'));var querystring=require(_0x9310('0x10'));var Papa=require(_0x9310('0x11'));var Redis=require(_0x9310('0x12'));var authService=require(_0x9310('0x13'));var qs=require('../../components/parsers/qs');var as=require(_0x9310('0x14'));var hardwareService=require(_0x9310('0x15'));var logger=require(_0x9310('0x16'))(_0x9310('0x17'));var utils=require('../../config/utils');var config=require('../../config/environment');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x20acc7,_0x29abe3){_0x29abe3=_0x29abe3||0xcc;return function(_0x12443e){if(_0x12443e){return _0x20acc7['sendStatus'](_0x29abe3);}return _0x20acc7[_0x9310('0x18')](_0x29abe3)[_0x9310('0x19')]();};}function respondWithResult(_0x2a65f2,_0x4e5389){_0x4e5389=_0x4e5389||0xc8;return function(_0x357135){if(_0x357135){return _0x2a65f2['status'](_0x4e5389)[_0x9310('0x1a')](_0x357135);}};}function respondWithFilteredResult(_0x2441f0,_0x50e5a2){return function(_0x1214b1){if(_0x1214b1){var _0x44c798=_0x1214b1[_0x9310('0x1b')],_0x5f3ab2=_0x50e5a2['offset'],_0x1780cd=_0x50e5a2[_0x9310('0x1c')]+_0x50e5a2[_0x9310('0x1d')],_0x326db9;if(_0x1780cd>=_0x44c798){_0x1780cd=_0x44c798;_0x326db9=0xc8;}else{_0x326db9=0xce;}_0x2441f0[_0x9310('0x18')](_0x326db9);return _0x2441f0[_0x9310('0x1e')]('Content-Range',_0x5f3ab2+'-'+_0x1780cd+'/'+_0x44c798)['json'](_0x1214b1);}return null;};}function patchUpdates(_0x28321b){return function(_0x40e957){try{jsonpatch[_0x9310('0x1f')](_0x40e957,_0x28321b,!![]);}catch(_0x36c15c){return BPromise['reject'](_0x36c15c);}return _0x40e957[_0x9310('0x20')]();};}function saveUpdates(_0x291aa3,_0x46db19){return function(_0x54c002){if(_0x54c002){return _0x54c002[_0x9310('0x21')](_0x291aa3)[_0x9310('0x22')](function(_0xb57e80){return _0xb57e80;});}return null;};}function removeEntity(_0x58ff17,_0x3987f8){return function(_0xfa5c92){if(_0xfa5c92){return _0xfa5c92[_0x9310('0x23')]()[_0x9310('0x22')](function(){_0x58ff17['status'](0xcc)[_0x9310('0x19')]();});}};}function handleEntityNotFound(_0x1a30db,_0x5843fa){return function(_0x3a7a5d){if(!_0x3a7a5d){_0x1a30db[_0x9310('0x24')](0x194);}return _0x3a7a5d;};}function handleError(_0x15ece1,_0x41e76b){_0x41e76b=_0x41e76b||0x1f4;return function(_0x356bbc){logger[_0x9310('0x25')](_0x356bbc['stack']);if(_0x356bbc[_0x9310('0x26')]){delete _0x356bbc['name'];}_0x15ece1[_0x9310('0x18')](_0x41e76b)[_0x9310('0x27')](_0x356bbc);};}exports[_0x9310('0x21')]=function(_0x2e326c,_0x42d941){if(_0x2e326c['body']['id']){delete _0x2e326c[_0x9310('0x28')]['id'];}return db[_0x9310('0x29')][_0x9310('0x2a')]({'where':{'id':_0x2e326c[_0x9310('0x2b')]['id']}})['then'](handleEntityNotFound(_0x42d941,null))['then'](saveUpdates(_0x2e326c['body'],null))['then'](respondWithResult(_0x42d941,null))[_0x9310('0x2c')](handleError(_0x42d941,null));};exports[_0x9310('0x23')]=function(_0x5c1cdd,_0x2fe22b){return db[_0x9310('0x29')][_0x9310('0x2a')]({'where':{'id':_0x5c1cdd['params']['id']}})[_0x9310('0x22')](handleEntityNotFound(_0x2fe22b,null))['then'](removeEntity(_0x2fe22b,null))[_0x9310('0x2c')](handleError(_0x2fe22b,null));}; \ No newline at end of file +var _0x8fcd=['html-pdf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','ejs','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../mysqldb','sendStatus','status','json','offset','limit','Content-Range','apply','reject','save','update','then','destroy','end','name','send','body','Action','find','params'];(function(_0x549d3d,_0x1a8d2e){var _0x446c93=function(_0x17e1b8){while(--_0x17e1b8){_0x549d3d['push'](_0x549d3d['shift']());}};_0x446c93(++_0x1a8d2e);}(_0x8fcd,0x18c));var _0xd8fc=function(_0x306ed7,_0x1a41d5){_0x306ed7=_0x306ed7-0x0;var _0x422d4f=_0x8fcd[_0x306ed7];return _0x422d4f;};'use strict';var pdf=require(_0xd8fc('0x0'));var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0xd8fc('0x1'));var jsonpatch=require(_0xd8fc('0x2'));var rp=require(_0xd8fc('0x3'));var moment=require(_0xd8fc('0x4'));var BPromise=require(_0xd8fc('0x5'));var Mustache=require(_0xd8fc('0x6'));var util=require(_0xd8fc('0x7'));var path=require(_0xd8fc('0x8'));var sox=require(_0xd8fc('0x9'));var csv=require('to-csv');var ejs=require(_0xd8fc('0xa'));var fs=require('fs');var _=require('lodash');var squel=require('squel');var crypto=require(_0xd8fc('0xb'));var jsforce=require(_0xd8fc('0xc'));var deskjs=require(_0xd8fc('0xd'));var toCsv=require(_0xd8fc('0xe'));var querystring=require(_0xd8fc('0xf'));var Papa=require(_0xd8fc('0x10'));var Redis=require(_0xd8fc('0x11'));var authService=require(_0xd8fc('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0xd8fc('0x13'));var hardwareService=require(_0xd8fc('0x14'));var logger=require(_0xd8fc('0x15'))(_0xd8fc('0x16'));var utils=require(_0xd8fc('0x17'));var config=require('../../config/environment');var db=require(_0xd8fc('0x18'))['db'];function respondWithStatusCode(_0x593cfc,_0x2f4428){_0x2f4428=_0x2f4428||0xcc;return function(_0x478ca2){if(_0x478ca2){return _0x593cfc[_0xd8fc('0x19')](_0x2f4428);}return _0x593cfc[_0xd8fc('0x1a')](_0x2f4428)['end']();};}function respondWithResult(_0x424b49,_0x1266e6){_0x1266e6=_0x1266e6||0xc8;return function(_0x3dc470){if(_0x3dc470){return _0x424b49[_0xd8fc('0x1a')](_0x1266e6)[_0xd8fc('0x1b')](_0x3dc470);}};}function respondWithFilteredResult(_0x34565f,_0x190b32){return function(_0x48a1fd){if(_0x48a1fd){var _0x119819=_0x48a1fd['count'],_0x375981=_0x190b32[_0xd8fc('0x1c')],_0x54be33=_0x190b32[_0xd8fc('0x1c')]+_0x190b32[_0xd8fc('0x1d')],_0x5921ef;if(_0x54be33>=_0x119819){_0x54be33=_0x119819;_0x5921ef=0xc8;}else{_0x5921ef=0xce;}_0x34565f[_0xd8fc('0x1a')](_0x5921ef);return _0x34565f['set'](_0xd8fc('0x1e'),_0x375981+'-'+_0x54be33+'/'+_0x119819)[_0xd8fc('0x1b')](_0x48a1fd);}return null;};}function patchUpdates(_0x57fb67){return function(_0x38f3e8){try{jsonpatch[_0xd8fc('0x1f')](_0x38f3e8,_0x57fb67,!![]);}catch(_0x232167){return BPromise[_0xd8fc('0x20')](_0x232167);}return _0x38f3e8[_0xd8fc('0x21')]();};}function saveUpdates(_0x1713bb,_0x19b4b7){return function(_0x24aa8f){if(_0x24aa8f){return _0x24aa8f[_0xd8fc('0x22')](_0x1713bb)[_0xd8fc('0x23')](function(_0x3482f0){return _0x3482f0;});}return null;};}function removeEntity(_0x2b3ead,_0x2469c4){return function(_0x51d523){if(_0x51d523){return _0x51d523[_0xd8fc('0x24')]()[_0xd8fc('0x23')](function(){_0x2b3ead[_0xd8fc('0x1a')](0xcc)[_0xd8fc('0x25')]();});}};}function handleEntityNotFound(_0x3585d2,_0x1a6b1d){return function(_0x1f4941){if(!_0x1f4941){_0x3585d2[_0xd8fc('0x19')](0x194);}return _0x1f4941;};}function handleError(_0x39c8e5,_0x3a1e35){_0x3a1e35=_0x3a1e35||0x1f4;return function(_0x10b2e5){logger['error'](_0x10b2e5['stack']);if(_0x10b2e5[_0xd8fc('0x26')]){delete _0x10b2e5['name'];}_0x39c8e5[_0xd8fc('0x1a')](_0x3a1e35)[_0xd8fc('0x27')](_0x10b2e5);};}exports['update']=function(_0xcd43ad,_0xf36f73){if(_0xcd43ad[_0xd8fc('0x28')]['id']){delete _0xcd43ad[_0xd8fc('0x28')]['id'];}return db[_0xd8fc('0x29')][_0xd8fc('0x2a')]({'where':{'id':_0xcd43ad[_0xd8fc('0x2b')]['id']}})['then'](handleEntityNotFound(_0xf36f73,null))[_0xd8fc('0x23')](saveUpdates(_0xcd43ad['body'],null))[_0xd8fc('0x23')](respondWithResult(_0xf36f73,null))['catch'](handleError(_0xf36f73,null));};exports[_0xd8fc('0x24')]=function(_0xe5f6c5,_0x2906a4){return db[_0xd8fc('0x29')]['find']({'where':{'id':_0xe5f6c5[_0xd8fc('0x2b')]['id']}})[_0xd8fc('0x23')](handleEntityNotFound(_0x2906a4,null))[_0xd8fc('0x23')](removeEntity(_0x2906a4,null))['catch'](handleError(_0x2906a4,null));}; \ No newline at end of file diff --git a/server/api/action/action.model.js b/server/api/action/action.model.js index a316382..55f62b6 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 _0x381a=['path','rimraf','../../config/environment','./action.attributes','define','tools_actions','lodash','util','../../config/logger','moment','bluebird','request-promise'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x381a,0x10e));var _0xa381=function(_0x1b6407,_0x44ae4f){_0x1b6407=_0x1b6407-0x0;var _0x2f98cf=_0x381a[_0x1b6407];return _0x2f98cf;};'use strict';var _=require(_0xa381('0x0'));var util=require(_0xa381('0x1'));var logger=require(_0xa381('0x2'))('api');var moment=require(_0xa381('0x3'));var BPromise=require(_0xa381('0x4'));var rp=require(_0xa381('0x5'));var fs=require('fs');var path=require(_0xa381('0x6'));var rimraf=require(_0xa381('0x7'));var config=require(_0xa381('0x8'));var attributes=require(_0xa381('0x9'));module['exports']=function(_0x4d085b,_0x19cfdf){return _0x4d085b[_0xa381('0xa')]('Action',attributes,{'tableName':_0xa381('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x3526=['tools_actions','lodash','util','../../config/logger','api','bluebird','request-promise','path','./action.attributes','exports','define','Action'];(function(_0x4d28c9,_0x37d9d8){var _0x41795b=function(_0x194037){while(--_0x194037){_0x4d28c9['push'](_0x4d28c9['shift']());}};_0x41795b(++_0x37d9d8);}(_0x3526,0x139));var _0x6352=function(_0x362c3e,_0x4b972b){_0x362c3e=_0x362c3e-0x0;var _0x1f6060=_0x3526[_0x362c3e];return _0x1f6060;};'use strict';var _=require(_0x6352('0x0'));var util=require(_0x6352('0x1'));var logger=require(_0x6352('0x2'))(_0x6352('0x3'));var moment=require('moment');var BPromise=require(_0x6352('0x4'));var rp=require(_0x6352('0x5'));var fs=require('fs');var path=require(_0x6352('0x6'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x6352('0x7'));module[_0x6352('0x8')]=function(_0x95a1fd,_0xec8301){return _0x95a1fd[_0x6352('0x9')](_0x6352('0xa'),attributes,{'tableName':_0x6352('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/action/action.rpc.js b/server/api/action/action.rpc.js index 1c25571..69e722c 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(_0x344dcc,_0x4b8745){var _0x510868=function(_0x122a36){while(--_0x122a36){_0x344dcc['push'](_0x344dcc['shift']());}};_0x510868(++_0x4b8745);}(_0xcb91,0x1a9));var _0x1cb9=function(_0x3a3c17,_0x5b7b7e){_0x3a3c17=_0x3a3c17-0x0;var _0xd07f21=_0xcb91[_0x3a3c17];return _0xd07f21;};'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 _0x0713=['Action,\x20%s,\x20%s','request\x20sent','debug','Action,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info'];(function(_0x3b46ef,_0x4fcd53){var _0xca14cc=function(_0x13c0c7){while(--_0x13c0c7){_0x3b46ef['push'](_0x3b46ef['shift']());}};_0xca14cc(++_0x4fcd53);}(_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')]('Action,\x20%s,\x20%s',_0x2f1e87,_0x4a36ec['error'][_0x3071('0x15')]);return _0x3e9a5e(_0x4a36ec['error'][_0x3071('0x15')]);}logger[_0x3071('0x13')]('Action,\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')]('Action,\x20%s,\x20%s',_0x2f1e87,_0x21aad3);_0x3e9a5e(_0x21aad3);});});} \ No newline at end of file diff --git a/server/api/action/index.js b/server/api/action/index.js index 4614cd4..8485933 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 _0xed35=['Router','../../components/auth/service','../../components/interaction/service','put','isAuthenticated','update','delete','/:id','exports','multer','path','connect-timeout','express'];(function(_0x1c8a40,_0x3eb14b){var _0x425ac1=function(_0x397aad){while(--_0x397aad){_0x1c8a40['push'](_0x1c8a40['shift']());}};_0x425ac1(++_0x3eb14b);}(_0xed35,0x127));var _0x5ed3=function(_0x1d1306,_0x4f2003){_0x1d1306=_0x1d1306-0x0;var _0x8e6b4e=_0xed35[_0x1d1306];return _0x8e6b4e;};'use strict';var multer=require(_0x5ed3('0x0'));var util=require('util');var path=require(_0x5ed3('0x1'));var timeout=require(_0x5ed3('0x2'));var express=require(_0x5ed3('0x3'));var router=express[_0x5ed3('0x4')]();var auth=require(_0x5ed3('0x5'));var interaction=require(_0x5ed3('0x6'));var config=require('../../config/environment');var controller=require('./action.controller');router[_0x5ed3('0x7')]('/:id',auth[_0x5ed3('0x8')](),controller[_0x5ed3('0x9')]);router[_0x5ed3('0xa')](_0x5ed3('0xb'),auth[_0x5ed3('0x8')](),controller['destroy']);module[_0x5ed3('0xc')]=router; \ No newline at end of file +var _0x3af8=['../../components/auth/service','../../components/interaction/service','./action.controller','put','/:id','isAuthenticated','delete','destroy','exports','multer','util','path','connect-timeout','Router'];(function(_0x31d007,_0x3fdaf5){var _0x5d60fa=function(_0x64784d){while(--_0x64784d){_0x31d007['push'](_0x31d007['shift']());}};_0x5d60fa(++_0x3fdaf5);}(_0x3af8,0x13d));var _0x83af=function(_0x2aa3ad,_0x481125){_0x2aa3ad=_0x2aa3ad-0x0;var _0x4ae507=_0x3af8[_0x2aa3ad];return _0x4ae507;};'use strict';var multer=require(_0x83af('0x0'));var util=require(_0x83af('0x1'));var path=require(_0x83af('0x2'));var timeout=require(_0x83af('0x3'));var express=require('express');var router=express[_0x83af('0x4')]();var auth=require(_0x83af('0x5'));var interaction=require(_0x83af('0x6'));var config=require('../../config/environment');var controller=require(_0x83af('0x7'));router[_0x83af('0x8')](_0x83af('0x9'),auth[_0x83af('0xa')](),controller['update']);router[_0x83af('0xb')](_0x83af('0x9'),auth['isAuthenticated'](),controller[_0x83af('0xc')]);module[_0x83af('0xd')]=router; \ No newline at end of file diff --git a/server/api/analyticCustomReport/analyticCustomReport.attributes.js b/server/api/analyticCustomReport/analyticCustomReport.attributes.js index 0a98d8d..49ecfc9 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 _0x8243=['sequelize','STRING','TEXT'];(function(_0x123dbd,_0x24eb1d){var _0x54fb8f=function(_0x31ce62){while(--_0x31ce62){_0x123dbd['push'](_0x123dbd['shift']());}};_0x54fb8f(++_0x24eb1d);}(_0x8243,0xba));var _0x3824=function(_0x5b4676,_0x551541){_0x5b4676=_0x5b4676-0x0;var _0x1e8e62=_0x8243[_0x5b4676];return _0x1e8e62;};'use strict';var Sequelize=require(_0x3824('0x0'));module['exports']={'name':{'type':Sequelize[_0x3824('0x1')],'allowNull':![]},'description':{'type':Sequelize[_0x3824('0x1')]},'parent':{'type':Sequelize[_0x3824('0x1')]},'table':{'type':Sequelize[_0x3824('0x1')]},'conditions':{'type':Sequelize[_0x3824('0x2')]},'joins':{'type':Sequelize['TEXT']}}; \ No newline at end of file +var _0xac60=['exports','STRING','TEXT','sequelize'];(function(_0xf5d257,_0x349ad7){var _0x181a62=function(_0x1c309b){while(--_0x1c309b){_0xf5d257['push'](_0xf5d257['shift']());}};_0x181a62(++_0x349ad7);}(_0xac60,0xb7));var _0x0ac6=function(_0x55e08b,_0x421620){_0x55e08b=_0x55e08b-0x0;var _0xd1a7ff=_0xac60[_0x55e08b];return _0xd1a7ff;};'use strict';var Sequelize=require(_0x0ac6('0x0'));module[_0x0ac6('0x1')]={'name':{'type':Sequelize[_0x0ac6('0x2')],'allowNull':![]},'description':{'type':Sequelize[_0x0ac6('0x2')]},'parent':{'type':Sequelize[_0x0ac6('0x2')]},'table':{'type':Sequelize[_0x0ac6('0x2')]},'conditions':{'type':Sequelize[_0x0ac6('0x3')]},'joins':{'type':Sequelize[_0x0ac6('0x3')]}}; \ No newline at end of file diff --git a/server/api/analyticCustomReport/analyticCustomReport.controller.js b/server/api/analyticCustomReport/analyticCustomReport.controller.js index 16cbbfa..120d037 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 _0x36a9=['catch','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','Reports','UserProfileSection','find','userProfileId','autoAssociation','CustomReports','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','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)','HOUR(%s)','ROUND(%s)','UNIX_TIMESTAMP(%s)','includes','IS\x20NULL','IS\x20NOT\x20NULL','IS\x20NOT\x20EMPTY','rules','operator','field','value','getFields','Sequelize','Please\x20insert\x20at\x20least\x20one\x20field','AnalyticMetric','select','from','table','MetricId','metric','function','replace','format','groupBy','group','orderBy','order','alias','joins','type','parentKey','foreignTable','%s.%s\x20=\x20%s.%s','foreignKey','conditions','clone','debug','toString','sequelize','QueryTypes','SELECT','left_join','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20DESC)','IS\x20EMPTY','condition','ValidationErrorItem','keyBy','DESC','parse','Limited\x20Query:','No\x20available\x20data','output','web','generate','csv','custom','AnalyticExtractedReport','cdr','.calldate\x20BETWEEN\x20?\x20AND\x20?','endDate','.createdAt\x20BETWEEN\x20?\x20AND\x20?','info','Run\x20Query:','child_process','fork','../../components/export/','../../files/reports','savename','countTable','COUNT(*)','run','html-pdf','eml-format','rimraf','zip-dir','request-promise','moment','mustache','util','sox','ejs','squel','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/utils','../../config/environment','status','end','count','offset','set','Content-Range','json','reject','then','get','UserProfileResource','destroy','error','stack','name','map','rawAttributes','fieldName','key','model','query','keys','filters','intersection','attributes','fields','length','nolimit','limit','pick','where','merge','VIRTUAL','filter','options','AnalyticCustomReport','includeAll','findAll','rows','show','params'];(function(_0x48cc94,_0x160059){var _0x3625e7=function(_0x38c6dd){while(--_0x38c6dd){_0x48cc94['push'](_0x48cc94['shift']());}};_0x3625e7(++_0x160059);}(_0x36a9,0x1a3));var _0x936a=function(_0x4ab15a,_0x1b26e7){_0x4ab15a=_0x4ab15a-0x0;var _0xaca7b2=_0x36a9[_0x4ab15a];return _0xaca7b2;};'use strict';var pdf=require(_0x936a('0x0'));var emlformat=require(_0x936a('0x1'));var rimraf=require(_0x936a('0x2'));var zipdir=require(_0x936a('0x3'));var jsonpatch=require('fast-json-patch');var rp=require(_0x936a('0x4'));var moment=require(_0x936a('0x5'));var BPromise=require('bluebird');var Mustache=require(_0x936a('0x6'));var util=require(_0x936a('0x7'));var path=require('path');var sox=require(_0x936a('0x8'));var csv=require('to-csv');var ejs=require(_0x936a('0x9'));var fs=require('fs');var _=require('lodash');var squel=require(_0x936a('0xa'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x936a('0xb'));var toCsv=require('to-csv');var querystring=require(_0x936a('0xc'));var Papa=require(_0x936a('0xd'));var Redis=require(_0x936a('0xe'));var authService=require(_0x936a('0xf'));var qs=require('../../components/parsers/qs');var as=require(_0x936a('0x10'));var hardwareService=require(_0x936a('0x11'));var logger=require('../../config/logger')('api');var utils=require(_0x936a('0x12'));var config=require(_0x936a('0x13'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x26418b,_0x4f21a7){_0x4f21a7=_0x4f21a7||0xcc;return function(_0x103eed){if(_0x103eed){return _0x26418b['sendStatus'](_0x4f21a7);}return _0x26418b[_0x936a('0x14')](_0x4f21a7)[_0x936a('0x15')]();};}function respondWithResult(_0x4ca33f,_0x259459){_0x259459=_0x259459||0xc8;return function(_0xc67d1a){if(_0xc67d1a){return _0x4ca33f['status'](_0x259459)['json'](_0xc67d1a);}};}function respondWithFilteredResult(_0x49aa63,_0x18fcd2){return function(_0x3fbbdf){if(_0x3fbbdf){var _0xe8d879=_0x3fbbdf[_0x936a('0x16')],_0x278923=_0x18fcd2[_0x936a('0x17')],_0x4bbc58=_0x18fcd2[_0x936a('0x17')]+_0x18fcd2['limit'],_0x460cb0;if(_0x4bbc58>=_0xe8d879){_0x4bbc58=_0xe8d879;_0x460cb0=0xc8;}else{_0x460cb0=0xce;}_0x49aa63['status'](_0x460cb0);return _0x49aa63[_0x936a('0x18')](_0x936a('0x19'),_0x278923+'-'+_0x4bbc58+'/'+_0xe8d879)[_0x936a('0x1a')](_0x3fbbdf);}return null;};}function patchUpdates(_0x446700){return function(_0x413b6e){try{jsonpatch['apply'](_0x413b6e,_0x446700,!![]);}catch(_0x118049){return BPromise[_0x936a('0x1b')](_0x118049);}return _0x413b6e['save']();};}function saveUpdates(_0x1d2b61,_0x5c5dc9){return function(_0x2f61f2){if(_0x2f61f2){return _0x2f61f2['update'](_0x1d2b61)[_0x936a('0x1c')](function(_0xe025b){return _0xe025b;});}return null;};}function removeEntity(_0x5db337,_0x345563){return function(_0x2008f6){if(_0x2008f6){return _0x2008f6['destroy']()[_0x936a('0x1c')](function(){var _0x453d61=_0x2008f6[_0x936a('0x1d')]({'plain':!![]});var _0xd022b2='CustomReports';return db[_0x936a('0x1e')][_0x936a('0x1f')]({'where':{'type':_0xd022b2,'resourceId':_0x453d61['id']}})[_0x936a('0x1c')](function(){return _0x2008f6;});})[_0x936a('0x1c')](function(){_0x5db337['status'](0xcc)[_0x936a('0x15')]();});}};}function handleEntityNotFound(_0xcdebcb,_0x2d11ed){return function(_0x12509a){if(!_0x12509a){_0xcdebcb['sendStatus'](0x194);}return _0x12509a;};}function handleError(_0x2bfb15,_0x523743){_0x523743=_0x523743||0x1f4;return function(_0x44d451){logger[_0x936a('0x20')](_0x44d451[_0x936a('0x21')]);if(_0x44d451[_0x936a('0x22')]){delete _0x44d451[_0x936a('0x22')];}_0x2bfb15[_0x936a('0x14')](_0x523743)['send'](_0x44d451);};}exports['index']=function(_0x87410,_0x42c7db){var _0x3fbcd1={},_0x14216f={},_0x2bb833={'count':0x0,'rows':[]};var _0x2182bc=_[_0x936a('0x23')](db['AnalyticCustomReport'][_0x936a('0x24')],function(_0xdbbcde){return{'name':_0xdbbcde[_0x936a('0x25')],'type':_0xdbbcde['type'][_0x936a('0x26')]};});_0x14216f[_0x936a('0x27')]=_[_0x936a('0x23')](_0x2182bc,_0x936a('0x22'));_0x14216f[_0x936a('0x28')]=_[_0x936a('0x29')](_0x87410[_0x936a('0x28')]);_0x14216f[_0x936a('0x2a')]=_[_0x936a('0x2b')](_0x14216f[_0x936a('0x27')],_0x14216f[_0x936a('0x28')]);_0x3fbcd1[_0x936a('0x2c')]=_[_0x936a('0x2b')](_0x14216f[_0x936a('0x27')],qs['fields'](_0x87410[_0x936a('0x28')][_0x936a('0x2d')]));_0x3fbcd1[_0x936a('0x2c')]=_0x3fbcd1[_0x936a('0x2c')][_0x936a('0x2e')]?_0x3fbcd1[_0x936a('0x2c')]:_0x14216f[_0x936a('0x27')];if(!_0x87410['query']['hasOwnProperty'](_0x936a('0x2f'))){_0x3fbcd1['limit']=qs[_0x936a('0x30')](_0x87410[_0x936a('0x28')]['limit']);_0x3fbcd1[_0x936a('0x17')]=qs[_0x936a('0x17')](_0x87410[_0x936a('0x28')]['offset']);}_0x3fbcd1['order']=qs['sort'](_0x87410[_0x936a('0x28')]['sort']);_0x3fbcd1['where']=qs[_0x936a('0x2a')](_[_0x936a('0x31')](_0x87410[_0x936a('0x28')],_0x14216f[_0x936a('0x2a')]));if(_0x87410['query']['filter']){_0x3fbcd1[_0x936a('0x32')]=_[_0x936a('0x33')](_0x3fbcd1['where'],{'$or':_['map'](_0x2182bc,function(_0x30db6a){if(_0x30db6a['type']!==_0x936a('0x34')){var _0x36d020={};_0x36d020[_0x30db6a[_0x936a('0x22')]]={'$like':'%'+_0x87410['query'][_0x936a('0x35')]+'%'};return _0x36d020;}})});}_0x3fbcd1=_[_0x936a('0x33')]({},_0x3fbcd1,_0x87410[_0x936a('0x36')]);var _0x38c2de={'where':_0x3fbcd1[_0x936a('0x32')]};return db[_0x936a('0x37')][_0x936a('0x16')](_0x38c2de)[_0x936a('0x1c')](function(_0x424161){_0x2bb833[_0x936a('0x16')]=_0x424161;if(_0x87410[_0x936a('0x28')][_0x936a('0x38')]){_0x3fbcd1['include']=[{'all':!![]}];}return db[_0x936a('0x37')][_0x936a('0x39')](_0x3fbcd1);})[_0x936a('0x1c')](function(_0x54a17c){_0x2bb833[_0x936a('0x3a')]=_0x54a17c;return _0x2bb833;})[_0x936a('0x1c')](respondWithFilteredResult(_0x42c7db,_0x3fbcd1))['catch'](handleError(_0x42c7db,null));};exports[_0x936a('0x3b')]=function(_0x57c51a,_0x35bb2a){var _0x11aadb={'raw':![],'where':{'id':_0x57c51a[_0x936a('0x3c')]['id']}},_0x44cbda={};_0x44cbda[_0x936a('0x27')]=_[_0x936a('0x29')](db[_0x936a('0x37')][_0x936a('0x24')]);_0x44cbda['query']=_['keys'](_0x57c51a[_0x936a('0x28')]);_0x44cbda[_0x936a('0x2a')]=_[_0x936a('0x2b')](_0x44cbda[_0x936a('0x27')],_0x44cbda[_0x936a('0x28')]);_0x11aadb['attributes']=_['intersection'](_0x44cbda['model'],qs['fields'](_0x57c51a['query'][_0x936a('0x2d')]));_0x11aadb[_0x936a('0x2c')]=_0x11aadb[_0x936a('0x2c')]['length']?_0x11aadb[_0x936a('0x2c')]:_0x44cbda[_0x936a('0x27')];if(_0x57c51a['query'][_0x936a('0x38')]){_0x11aadb['include']=[{'all':!![]}];}_0x11aadb=_['merge']({},_0x11aadb,_0x57c51a[_0x936a('0x36')]);return db['AnalyticCustomReport']['find'](_0x11aadb)[_0x936a('0x1c')](handleEntityNotFound(_0x35bb2a,null))[_0x936a('0x1c')](respondWithResult(_0x35bb2a,null))[_0x936a('0x3d')](handleError(_0x35bb2a,null));};exports[_0x936a('0x3e')]=function(_0x377eec,_0x1644a4){return db[_0x936a('0x37')][_0x936a('0x3e')](_0x377eec[_0x936a('0x3f')],{})[_0x936a('0x1c')](function(_0x160542){var _0x12437e=_0x377eec[_0x936a('0x40')][_0x936a('0x1d')]({'plain':!![]});if(!_0x12437e)throw new Error(_0x936a('0x41'));if(_0x12437e[_0x936a('0x42')]===_0x936a('0x40')){var _0x5e2389=_0x160542['get']({'plain':!![]});var _0x300923=_0x936a('0x43');return db[_0x936a('0x44')][_0x936a('0x45')]({'where':{'name':_0x300923,'userProfileId':_0x12437e[_0x936a('0x46')]},'raw':!![]})[_0x936a('0x1c')](function(_0x3cae4f){if(_0x3cae4f&&_0x3cae4f[_0x936a('0x47')]===0x0){return db[_0x936a('0x1e')][_0x936a('0x3e')]({'name':_0x5e2389['name'],'resourceId':_0x5e2389['id'],'type':_0x936a('0x48'),'sectionId':_0x3cae4f['id']},{})[_0x936a('0x1c')](function(){return _0x160542;});}else{return _0x160542;}})[_0x936a('0x3d')](function(_0x33c09a){logger['error'](_0x936a('0x49'),_0x33c09a);throw _0x33c09a;});}return _0x160542;})[_0x936a('0x1c')](respondWithResult(_0x1644a4,0xc9))['catch'](handleError(_0x1644a4,null));};exports[_0x936a('0x4a')]=function(_0x529d42,_0x53a27d){if(_0x529d42[_0x936a('0x3f')]['id']){delete _0x529d42[_0x936a('0x3f')]['id'];}return db[_0x936a('0x37')]['find']({'where':{'id':_0x529d42[_0x936a('0x3c')]['id']}})[_0x936a('0x1c')](handleEntityNotFound(_0x53a27d,null))[_0x936a('0x1c')](saveUpdates(_0x529d42[_0x936a('0x3f')],null))[_0x936a('0x1c')](respondWithResult(_0x53a27d,null))[_0x936a('0x3d')](handleError(_0x53a27d,null));};exports['destroy']=function(_0x1ce530,_0x506a10){return db[_0x936a('0x37')]['find']({'where':{'id':_0x1ce530[_0x936a('0x3c')]['id']}})[_0x936a('0x1c')](handleEntityNotFound(_0x506a10,null))[_0x936a('0x1c')](removeEntity(_0x506a10,null))[_0x936a('0x3d')](handleError(_0x506a10,null));};exports[_0x936a('0x4b')]=function(_0x236232,_0x10cf02){var _0x313dfd=0xa;var _0x19c850=[_0x936a('0x4c'),'left_join',_0x936a('0x4d'),_0x936a('0x4e')];var _0x253f34={'SUM':_0x936a('0x4f'),'COUNT':_0x936a('0x50'),'COUNT DISTINCT':_0x936a('0x51'),'MAX':_0x936a('0x52'),'MIN':_0x936a('0x53'),'AVG':_0x936a('0x54'),'GROUP_CONCAT':_0x936a('0x55'),'GROUP_CONCAT ASC':_0x936a('0x56'),'GROUP_CONCAT DESC':'GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20DESC)'};var _0xeb2548={'SEC_TO_TIME':_0x936a('0x57'),'DATE':_0x936a('0x58'),'HOUR':_0x936a('0x59'),'ROUND':_0x936a('0x5a'),'UNIX_TIMESTAMP':_0x936a('0x5b')};var _0x53abc4=function(_0x19f669){return!_[_0x936a('0x5c')]([_0x936a('0x5d'),_0x936a('0x5e'),'IS\x20EMPTY',_0x936a('0x5f')],_0x19f669);};var _0x5174dd=function(_0x1e6f51){if(!_0x1e6f51||!_0x1e6f51[_0x936a('0x60')][_0x936a('0x2e')]){return'';}for(var _0x592f09='(',_0x5a553b=0x0;_0x5a553b<_0x1e6f51[_0x936a('0x60')]['length'];_0x5a553b+=0x1){_0x5a553b>0x0&&(_0x592f09+='\x20'+_0x1e6f51[_0x936a('0x61')]+'\x20');_0x592f09+=_0x1e6f51[_0x936a('0x60')][_0x5a553b]['group']?_0x5174dd(_0x1e6f51[_0x936a('0x60')][_0x5a553b]['group']):_0x1e6f51[_0x936a('0x60')][_0x5a553b][_0x936a('0x62')]+'\x20'+_0x1e6f51[_0x936a('0x60')][_0x5a553b]['condition']+(_0x53abc4(_0x1e6f51[_0x936a('0x60')][_0x5a553b]['condition'])?'\x20'+_0x1e6f51['rules'][_0x5a553b][_0x936a('0x63')]:'');}return _0x592f09+')';};var _0x10bb9c={'where':{'id':_0x236232[_0x936a('0x3c')]['id']}},_0x44706b,_0x278b92,_0x3b77f4,_0xc7485a,_0x5b8efc;_0x10bb9c=_[_0x936a('0x33')]({},_0x10bb9c,_0x236232[_0x936a('0x36')]);return db[_0x936a('0x37')]['find'](_0x10bb9c)[_0x936a('0x1c')](function(_0x4d05c5){if(_0x4d05c5){_0x44706b=_0x4d05c5;return _0x4d05c5[_0x936a('0x64')]();}return null;})[_0x936a('0x1c')](function(_0x4b9b52){if(_0x4b9b52){if(!_0x4b9b52[_0x936a('0x2e')]){throw new db[(_0x936a('0x65'))]['ValidationErrorItem'](_0x936a('0x66'),0x193);}_0x278b92=_0x4b9b52;return db[_0x936a('0x67')][_0x936a('0x39')]({'raw':!![]});}return null;})[_0x936a('0x1c')](function(_0x2ef76a){if(_0x2ef76a){_0x3b77f4=_['keyBy'](_0x2ef76a,'id');var _0x2cb2ab;var _0x45f35c=squel[_0x936a('0x68')]();_0x45f35c[_0x936a('0x69')](_0x44706b[_0x936a('0x6a')]);for(var _0x44d397=0x0;_0x44d397<_0x278b92['length'];_0x44d397+=0x1){_0x2cb2ab=_0x278b92[_0x44d397][_0x936a('0x6b')]?_0x3b77f4[_0x278b92[_0x44d397]['MetricId']][_0x936a('0x6c')]:_0x278b92[_0x44d397][_0x936a('0x62')];_0x2cb2ab=_0x278b92[_0x44d397][_0x936a('0x6d')]?_[_0x936a('0x6e')](_0x253f34[_0x278b92[_0x44d397][_0x936a('0x6d')]],'%s',_0x2cb2ab):_0x2cb2ab;_0x2cb2ab=_0x278b92[_0x44d397][_0x936a('0x6f')]?_[_0x936a('0x6e')](_0xeb2548[_0x278b92[_0x44d397]['format']],'%s',_0x2cb2ab):_0x2cb2ab;if(_0x278b92[_0x44d397][_0x936a('0x70')]){_0x45f35c[_0x936a('0x71')](_0x2cb2ab);}_0x278b92[_0x44d397][_0x936a('0x72')]&&_0x45f35c[_0x936a('0x73')](_0x2cb2ab,_0x278b92[_0x44d397][_0x936a('0x72')]==='DESC'?![]:!![]);_0x45f35c[_0x936a('0x62')](_0x2cb2ab,_0x278b92[_0x44d397][_0x936a('0x74')]||_0x2cb2ab);}if(_0x44706b[_0x936a('0x75')]){_0x44706b[_0x936a('0x75')]=JSON['parse'](_0x44706b[_0x936a('0x75')]);for(var _0x21d669=0x0;_0x21d669<_0x44706b[_0x936a('0x75')]['length'];_0x21d669+=0x1){if(_0x44706b[_0x936a('0x75')][_0x21d669][_0x936a('0x76')]&&_[_0x936a('0x5c')](_0x19c850,_0x44706b['joins'][_0x21d669][_0x936a('0x76')])&&_0x44706b[_0x936a('0x75')][_0x21d669][_0x936a('0x77')]&&_0x44706b[_0x936a('0x75')][_0x21d669][_0x936a('0x78')]&&_0x44706b[_0x936a('0x75')][_0x21d669]['foreignKey']){_0x45f35c[_0x44706b[_0x936a('0x75')][_0x21d669][_0x936a('0x76')]](_0x44706b[_0x936a('0x75')][_0x21d669][_0x936a('0x78')],null,util['format'](_0x936a('0x79'),_0x44706b[_0x936a('0x6a')],_0x44706b[_0x936a('0x75')][_0x21d669][_0x936a('0x77')],_0x44706b[_0x936a('0x75')][_0x21d669][_0x936a('0x78')],_0x44706b['joins'][_0x21d669][_0x936a('0x7a')]));}}}if(_0x44706b[_0x936a('0x7b')]){_0x44706b[_0x936a('0x7b')]=JSON['parse'](_0x44706b[_0x936a('0x7b')]);_0x45f35c[_0x936a('0x32')](_0x5174dd(_0x44706b[_0x936a('0x7b')]['group']));}_0x5b8efc=_0x45f35c[_0x936a('0x7c')]();_0x45f35c['limit'](_0x313dfd);_0x45f35c[_0x936a('0x17')](0x0);logger[_0x936a('0x7d')]('Limited\x20Query:',_0x45f35c[_0x936a('0x7e')]());return db[_0x936a('0x7f')][_0x936a('0x28')](_0x45f35c[_0x936a('0x7e')](),{'type':db[_0x936a('0x7f')][_0x936a('0x80')][_0x936a('0x81')]});}})[_0x936a('0x1c')](respondWithResult(_0x10cf02,null))[_0x936a('0x3d')](handleError(_0x10cf02,null));};function runReport(_0x145f33,_0x214179,_0x5c0347){var _0x379690=_0x214179[_0x936a('0x22')];var _0x5c279c=0xa;var _0x2cac48=['join',_0x936a('0x82'),_0x936a('0x4d'),_0x936a('0x4e')];var _0x2656c6={'SUM':'SUM(%s)','COUNT':_0x936a('0x50'),'COUNT DISTINCT':_0x936a('0x51'),'MAX':_0x936a('0x52'),'MIN':_0x936a('0x53'),'AVG':_0x936a('0x54'),'GROUP_CONCAT':_0x936a('0x55'),'GROUP_CONCAT ASC':_0x936a('0x56'),'GROUP_CONCAT DESC':_0x936a('0x83')};var _0x584144={'SEC_TO_TIME':_0x936a('0x57'),'DATE':_0x936a('0x58'),'HOUR':_0x936a('0x59'),'ROUND':'ROUND(%s)','UNIX_TIMESTAMP':_0x936a('0x5b')};var _0xb0b3c0=function(_0x54d71d){return!_[_0x936a('0x5c')]([_0x936a('0x5d'),_0x936a('0x5e'),_0x936a('0x84'),_0x936a('0x5f')],_0x54d71d);};var _0x44b4e5=function(_0x97f6bc){if(!_0x97f6bc||!_0x97f6bc['rules'][_0x936a('0x2e')]){return'';}for(var _0x356236='(',_0x42e0a3=0x0;_0x42e0a3<_0x97f6bc[_0x936a('0x60')][_0x936a('0x2e')];_0x42e0a3+=0x1){_0x42e0a3>0x0&&(_0x356236+='\x20'+_0x97f6bc[_0x936a('0x61')]+'\x20');_0x356236+=_0x97f6bc[_0x936a('0x60')][_0x42e0a3]['group']?_0x44b4e5(_0x97f6bc[_0x936a('0x60')][_0x42e0a3]['group']):_0x97f6bc[_0x936a('0x60')][_0x42e0a3][_0x936a('0x62')]+'\x20'+_0x97f6bc[_0x936a('0x60')][_0x42e0a3][_0x936a('0x85')]+(_0xb0b3c0(_0x97f6bc[_0x936a('0x60')][_0x42e0a3][_0x936a('0x85')])?'\x20'+_0x97f6bc['rules'][_0x42e0a3][_0x936a('0x63')]:'');}return _0x356236+')';};var _0x219ed8={'where':{'id':_0x145f33['id']}},_0x1590c3,_0x455a79,_0x368931,_0x3c88e3,_0xc5a3e0;_0x219ed8=_[_0x936a('0x33')]({},_0x219ed8,_0x5c0347);return db['AnalyticCustomReport'][_0x936a('0x45')](_0x219ed8)[_0x936a('0x1c')](function(_0x36dd28){if(_0x36dd28){_0x1590c3=_0x36dd28;return _0x36dd28['getFields']();}return null;})[_0x936a('0x1c')](function(_0x49764c){if(_0x49764c){if(!_0x49764c['length']){throw new db[(_0x936a('0x65'))][(_0x936a('0x86'))](_0x936a('0x66'),0x193);}_0x455a79=_0x49764c;return db[_0x936a('0x67')][_0x936a('0x39')]({'raw':!![]});}return null;})['then'](function(_0x448536){if(_0x448536){_0x368931=_[_0x936a('0x87')](_0x448536,'id');var _0x23905a;var _0x5b625e=squel[_0x936a('0x68')]();_0x5b625e[_0x936a('0x69')](_0x1590c3[_0x936a('0x6a')]);for(var _0x552ba6=0x0;_0x552ba6<_0x455a79[_0x936a('0x2e')];_0x552ba6+=0x1){_0x23905a=_0x455a79[_0x552ba6][_0x936a('0x6b')]?_0x368931[_0x455a79[_0x552ba6][_0x936a('0x6b')]][_0x936a('0x6c')]:_0x455a79[_0x552ba6][_0x936a('0x62')];_0x23905a=_0x455a79[_0x552ba6][_0x936a('0x6d')]?_[_0x936a('0x6e')](_0x2656c6[_0x455a79[_0x552ba6]['function']],'%s',_0x23905a):_0x23905a;_0x23905a=_0x455a79[_0x552ba6][_0x936a('0x6f')]?_['replace'](_0x584144[_0x455a79[_0x552ba6][_0x936a('0x6f')]],'%s',_0x23905a):_0x23905a;if(_0x455a79[_0x552ba6][_0x936a('0x70')]){_0x5b625e[_0x936a('0x71')](_0x23905a);}_0x455a79[_0x552ba6][_0x936a('0x72')]&&_0x5b625e[_0x936a('0x73')](_0x23905a,_0x455a79[_0x552ba6][_0x936a('0x72')]===_0x936a('0x88')?![]:!![]);_0x5b625e['field'](_0x23905a,_0x455a79[_0x552ba6][_0x936a('0x74')]||_0x23905a);}if(_0x1590c3[_0x936a('0x75')]){_0x1590c3['joins']=JSON[_0x936a('0x89')](_0x1590c3[_0x936a('0x75')]);for(var _0x10ad13=0x0;_0x10ad13<_0x1590c3['joins'][_0x936a('0x2e')];_0x10ad13+=0x1){if(_0x1590c3['joins'][_0x10ad13][_0x936a('0x76')]&&_[_0x936a('0x5c')](_0x2cac48,_0x1590c3[_0x936a('0x75')][_0x10ad13][_0x936a('0x76')])&&_0x1590c3['joins'][_0x10ad13][_0x936a('0x77')]&&_0x1590c3[_0x936a('0x75')][_0x10ad13][_0x936a('0x78')]&&_0x1590c3[_0x936a('0x75')][_0x10ad13][_0x936a('0x7a')]){_0x5b625e[_0x1590c3['joins'][_0x10ad13][_0x936a('0x76')]](_0x1590c3['joins'][_0x10ad13][_0x936a('0x78')],null,util[_0x936a('0x6f')]('%s.%s\x20=\x20%s.%s',_0x1590c3[_0x936a('0x6a')],_0x1590c3[_0x936a('0x75')][_0x10ad13][_0x936a('0x77')],_0x1590c3['joins'][_0x10ad13]['foreignTable'],_0x1590c3[_0x936a('0x75')][_0x10ad13][_0x936a('0x7a')]));}}}if(_0x1590c3[_0x936a('0x7b')]){_0x1590c3[_0x936a('0x7b')]=JSON['parse'](_0x1590c3[_0x936a('0x7b')]);_0x5b625e[_0x936a('0x32')](_0x44b4e5(_0x1590c3[_0x936a('0x7b')][_0x936a('0x71')]));}_0xc5a3e0=_0x5b625e['clone']();_0x5b625e[_0x936a('0x30')](_0x5c279c);_0x5b625e['offset'](0x0);logger[_0x936a('0x7d')](_0x936a('0x8a'),_0x5b625e[_0x936a('0x7e')]());return db['sequelize'][_0x936a('0x28')](_0x5b625e['toString'](),{'type':db[_0x936a('0x7f')][_0x936a('0x80')][_0x936a('0x81')]});}})[_0x936a('0x1c')](function(_0x1a4291){if(!_0x1a4291['length']){throw new db[(_0x936a('0x65'))][(_0x936a('0x86'))](_0x936a('0x8b'),0xcc);}if(_0x214179[_0x936a('0x8c')]===_0x936a('0x8d')){return null;}var _0x50cf8e=_[_0x936a('0x33')](_0x214179,{'name':_0x214179['fullPath']||_0x214179[_0x936a('0x22')]||_0x1590c3[_0x936a('0x22')],'basename':_0x379690,'savename':util[_0x936a('0x6f')]('%s-%s.%s',_0x214179[_0x936a('0x22')]||_0x1590c3[_0x936a('0x22')],require('randomstring')[_0x936a('0x8e')](0x4),_0x214179[_0x936a('0x8c')]||_0x936a('0x8f')),'reportId':_0x1590c3['id'],'reportType':_0x936a('0x90')});return db[_0x936a('0x91')]['create'](_0x50cf8e,{'raw':!![]});})[_0x936a('0x1c')](function(_0x3c23ad){if(_0x1590c3[_0x936a('0x6a')]===_0x936a('0x92')){_0xc5a3e0[_0x936a('0x32')](_0x1590c3[_0x936a('0x6a')]+_0x936a('0x93'),_0x214179['startDate'],_0x214179[_0x936a('0x94')]);}else{_0xc5a3e0[_0x936a('0x32')](_0x1590c3[_0x936a('0x6a')]+_0x936a('0x95'),_0x214179['startDate'],_0x214179['endDate']);}if(_0x3c23ad){logger[_0x936a('0x96')](_0x936a('0x97'),_0xc5a3e0[_0x936a('0x7e')]());require(_0x936a('0x98'))[_0x936a('0x99')](path[_0x936a('0x4c')](__dirname,_0x936a('0x9a'),_0x3c23ad[_0x936a('0x8c')]),[_0x3c23ad['id'],_0xc5a3e0[_0x936a('0x7e')](),path[_0x936a('0x4c')](__dirname,_0x936a('0x9b'),_0x3c23ad[_0x936a('0x9c')]),_0x379690]);return _0x3c23ad;}else{var _0x4734eb=squel[_0x936a('0x68')]();_0x4734eb['from']('('+_0xc5a3e0[_0x936a('0x7e')]()+')',_0x936a('0x9d'));_0x4734eb[_0x936a('0x62')](_0x936a('0x9e'),'count');_0xc5a3e0['limit'](_0x214179['limit']||_0x5c279c);_0xc5a3e0[_0x936a('0x17')](_0x214179['offset']||0x0);return db[_0x936a('0x7f')][_0x936a('0x28')](_0x4734eb[_0x936a('0x7e')](),{'type':db[_0x936a('0x7f')]['QueryTypes'][_0x936a('0x81')]})[_0x936a('0x1c')](function(_0x449c6c){if(!_0x449c6c[_0x936a('0x2e')]){_0x3c88e3=0x0;}else{_0x3c88e3=_0x449c6c[0x0][_0x936a('0x16')]||0x0;}return db['sequelize'][_0x936a('0x28')](_0xc5a3e0[_0x936a('0x7e')](),{'type':db[_0x936a('0x7f')][_0x936a('0x80')][_0x936a('0x81')]});})[_0x936a('0x1c')](function(_0x5e61ca){return{'rows':_0x5e61ca||[],'count':_0x3c88e3};});}});}exports[_0x936a('0x9f')]=function(_0x3b8264,_0x4907a5){return runReport(_0x3b8264[_0x936a('0x3c')],_0x3b8264[_0x936a('0x28')],_0x3b8264[_0x936a('0x36')])[_0x936a('0x1c')](respondWithResult(_0x4907a5,null))['catch'](handleError(_0x4907a5,null));};exports['runReport']=runReport;exports[_0x936a('0x28')]=function(_0x4cd146,_0xa93147){var _0x33df31=0xa;var _0x2788ae=['join',_0x936a('0x82'),_0x936a('0x4d'),'cross_join'];var _0x5a8fb6={'SUM':_0x936a('0x4f'),'COUNT':'COUNT(%s)','COUNT DISTINCT':_0x936a('0x51'),'MAX':_0x936a('0x52'),'MIN':_0x936a('0x53'),'AVG':_0x936a('0x54'),'GROUP_CONCAT':'GROUP_CONCAT(%s)','GROUP_CONCAT ASC':_0x936a('0x56'),'GROUP_CONCAT DESC':_0x936a('0x83')};var _0x5d012f={'SEC_TO_TIME':_0x936a('0x57'),'DATE':'DATE(%s)','HOUR':_0x936a('0x59'),'ROUND':_0x936a('0x5a'),'UNIX_TIMESTAMP':'UNIX_TIMESTAMP(%s)'};var _0x479c3f=function(_0x52ccdd){return!_['includes']([_0x936a('0x5d'),'IS\x20NOT\x20NULL','IS\x20EMPTY',_0x936a('0x5f')],_0x52ccdd);};var _0x2eac1e=function(_0x416569){if(!_0x416569||!_0x416569['rules'][_0x936a('0x2e')]){return'';}for(var _0x589e76='(',_0x2bb262=0x0;_0x2bb262<_0x416569[_0x936a('0x60')][_0x936a('0x2e')];_0x2bb262+=0x1){_0x2bb262>0x0&&(_0x589e76+='\x20'+_0x416569[_0x936a('0x61')]+'\x20');_0x589e76+=_0x416569[_0x936a('0x60')][_0x2bb262][_0x936a('0x71')]?_0x2eac1e(_0x416569[_0x936a('0x60')][_0x2bb262]['group']):_0x416569[_0x936a('0x60')][_0x2bb262][_0x936a('0x62')]+'\x20'+_0x416569['rules'][_0x2bb262][_0x936a('0x85')]+(_0x479c3f(_0x416569[_0x936a('0x60')][_0x2bb262][_0x936a('0x85')])?'\x20'+_0x416569[_0x936a('0x60')][_0x2bb262][_0x936a('0x63')]:'');}return _0x589e76+')';};var _0x2c4225={'where':{'id':_0x4cd146[_0x936a('0x3c')]['id']}},_0x5ce14e,_0x662d06,_0x1391df,_0x27bbab,_0x28d85c;_0x2c4225=_[_0x936a('0x33')]({},_0x2c4225,_0x4cd146['options']);return db[_0x936a('0x37')][_0x936a('0x45')](_0x2c4225)[_0x936a('0x1c')](function(_0x4caf5f){if(_0x4caf5f){_0x5ce14e=_0x4caf5f;return _0x4caf5f['getFields']();}return null;})[_0x936a('0x1c')](function(_0x440400){if(_0x440400){if(!_0x440400[_0x936a('0x2e')]){throw new db[(_0x936a('0x65'))][(_0x936a('0x86'))](_0x936a('0x66'),0x193);}_0x662d06=_0x440400;return db[_0x936a('0x67')][_0x936a('0x39')]({'raw':!![]});}return null;})['then'](function(_0x374061){if(_0x374061){_0x1391df=_[_0x936a('0x87')](_0x374061,'id');var _0x275d2a;var _0x4080d7=squel['select']();_0x4080d7['from'](_0x5ce14e[_0x936a('0x6a')]);for(var _0x448755=0x0;_0x448755<_0x662d06[_0x936a('0x2e')];_0x448755+=0x1){_0x275d2a=_0x662d06[_0x448755][_0x936a('0x6b')]?_0x1391df[_0x662d06[_0x448755][_0x936a('0x6b')]]['metric']:_0x662d06[_0x448755][_0x936a('0x62')];_0x275d2a=_0x662d06[_0x448755][_0x936a('0x6d')]?_[_0x936a('0x6e')](_0x5a8fb6[_0x662d06[_0x448755][_0x936a('0x6d')]],'%s',_0x275d2a):_0x275d2a;_0x275d2a=_0x662d06[_0x448755][_0x936a('0x6f')]?_[_0x936a('0x6e')](_0x5d012f[_0x662d06[_0x448755][_0x936a('0x6f')]],'%s',_0x275d2a):_0x275d2a;if(_0x662d06[_0x448755][_0x936a('0x70')]){_0x4080d7[_0x936a('0x71')](_0x275d2a);}_0x662d06[_0x448755][_0x936a('0x72')]&&_0x4080d7['order'](_0x275d2a,_0x662d06[_0x448755][_0x936a('0x72')]===_0x936a('0x88')?![]:!![]);_0x4080d7[_0x936a('0x62')](_0x275d2a,_0x662d06[_0x448755]['alias']||_0x275d2a);}if(_0x5ce14e[_0x936a('0x75')]){_0x5ce14e[_0x936a('0x75')]=JSON['parse'](_0x5ce14e[_0x936a('0x75')]);for(var _0x194284=0x0;_0x194284<_0x5ce14e[_0x936a('0x75')][_0x936a('0x2e')];_0x194284+=0x1){if(_0x5ce14e['joins'][_0x194284]['type']&&_[_0x936a('0x5c')](_0x2788ae,_0x5ce14e[_0x936a('0x75')][_0x194284][_0x936a('0x76')])&&_0x5ce14e[_0x936a('0x75')][_0x194284]['parentKey']&&_0x5ce14e[_0x936a('0x75')][_0x194284]['foreignTable']&&_0x5ce14e['joins'][_0x194284][_0x936a('0x7a')]){_0x4080d7[_0x5ce14e[_0x936a('0x75')][_0x194284][_0x936a('0x76')]](_0x5ce14e['joins'][_0x194284][_0x936a('0x78')],null,util['format']('%s.%s\x20=\x20%s.%s',_0x5ce14e[_0x936a('0x6a')],_0x5ce14e[_0x936a('0x75')][_0x194284][_0x936a('0x77')],_0x5ce14e[_0x936a('0x75')][_0x194284]['foreignTable'],_0x5ce14e['joins'][_0x194284][_0x936a('0x7a')]));}}}if(_0x5ce14e[_0x936a('0x7b')]){_0x5ce14e[_0x936a('0x7b')]=JSON[_0x936a('0x89')](_0x5ce14e[_0x936a('0x7b')]);_0x4080d7[_0x936a('0x32')](_0x2eac1e(_0x5ce14e[_0x936a('0x7b')][_0x936a('0x71')]));}_0x28d85c=_0x4080d7[_0x936a('0x7c')]();_0x4080d7[_0x936a('0x30')](_0x33df31);_0x4080d7[_0x936a('0x17')](0x0);logger['debug'](_0x936a('0x8a'),_0x4080d7[_0x936a('0x7e')]());return db[_0x936a('0x7f')]['query'](_0x4080d7[_0x936a('0x7e')](),{'type':db[_0x936a('0x7f')][_0x936a('0x80')][_0x936a('0x81')]});}})[_0x936a('0x1c')](function(){return{'sql':_0x28d85c[_0x936a('0x7e')]()};})[_0x936a('0x1c')](respondWithResult(_0xa93147,null))[_0x936a('0x3d')](handleError(_0xa93147,null));}; \ No newline at end of file +var _0xa3a6=['intersection','fields','length','hasOwnProperty','nolimit','order','where','filter','merge','type','VIRTUAL','options','count','include','findAll','rows','catch','show','params','includeAll','create','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','Reports','find','userProfileId','autoAssociation','body','preview','join','left_join','right_join','cross_join','SUM(%s)','COUNT(%s)','COUNT(DISTINCT\x20%s)','MAX(%s)','GROUP_CONCAT(%s)','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20DESC)','DATE(%s)','UNIX_TIMESTAMP(%s)','includes','IS\x20NULL','rules','operator','group','condition','value','getFields','ValidationErrorItem','Please\x20insert\x20at\x20least\x20one\x20field','AnalyticMetric','from','table','MetricId','field','function','replace','format','orderBy','joins','parse','foreignKey','foreignTable','%s.%s\x20=\x20%s.%s','parentKey','conditions','clone','debug','Limited\x20Query:','toString','sequelize','QueryTypes','SELECT','MIN(%s)','AVG(%s)','HOUR(%s)','ROUND(%s)','IS\x20EMPTY','IS\x20NOT\x20EMPTY','Sequelize','select','DESC','No\x20available\x20data','output','web','fullPath','%s-%s.%s','randomstring','generate','csv','custom','AnalyticExtractedReport','cdr','.calldate\x20BETWEEN\x20?\x20AND\x20?','endDate','startDate','fork','../../components/export/','savename','COUNT(*)','run','runReport','IS\x20NOT\x20NULL','keyBy','metric','groupBy','alias','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','ejs','lodash','squel','jsforce','to-csv','querystring','../../components/auth/service','../../components/parsers/advancedSearch','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','end','status','json','offset','limit','set','Content-Range','apply','reject','update','then','get','CustomReports','UserProfileResource','destroy','stack','name','send','index','AnalyticCustomReport','rawAttributes','fieldName','key','model','map','keys','filters','query','attributes'];(function(_0x2aea9e,_0x1f587f){var _0x430b92=function(_0x416c37){while(--_0x416c37){_0x2aea9e['push'](_0x2aea9e['shift']());}};_0x430b92(++_0x1f587f);}(_0xa3a6,0x10f));var _0x6a3a=function(_0x58575e,_0x5479b2){_0x58575e=_0x58575e-0x0;var _0xfd7dcf=_0xa3a6[_0x58575e];return _0xfd7dcf;};'use strict';var pdf=require('html-pdf');var emlformat=require('eml-format');var rimraf=require(_0x6a3a('0x0'));var zipdir=require(_0x6a3a('0x1'));var jsonpatch=require(_0x6a3a('0x2'));var rp=require(_0x6a3a('0x3'));var moment=require(_0x6a3a('0x4'));var BPromise=require(_0x6a3a('0x5'));var Mustache=require(_0x6a3a('0x6'));var util=require(_0x6a3a('0x7'));var path=require('path');var sox=require(_0x6a3a('0x8'));var csv=require('to-csv');var ejs=require(_0x6a3a('0x9'));var fs=require('fs');var _=require(_0x6a3a('0xa'));var squel=require(_0x6a3a('0xb'));var crypto=require('crypto');var jsforce=require(_0x6a3a('0xc'));var deskjs=require('desk.js');var toCsv=require(_0x6a3a('0xd'));var querystring=require(_0x6a3a('0xe'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x6a3a('0xf'));var qs=require('../../components/parsers/qs');var as=require(_0x6a3a('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x6a3a('0x11'));var utils=require(_0x6a3a('0x12'));var config=require(_0x6a3a('0x13'));var db=require(_0x6a3a('0x14'))['db'];function respondWithStatusCode(_0x18bbab,_0x34d060){_0x34d060=_0x34d060||0xcc;return function(_0x2267e3){if(_0x2267e3){return _0x18bbab[_0x6a3a('0x15')](_0x34d060);}return _0x18bbab['status'](_0x34d060)[_0x6a3a('0x16')]();};}function respondWithResult(_0x56d624,_0x51dd88){_0x51dd88=_0x51dd88||0xc8;return function(_0x5a18d5){if(_0x5a18d5){return _0x56d624[_0x6a3a('0x17')](_0x51dd88)[_0x6a3a('0x18')](_0x5a18d5);}};}function respondWithFilteredResult(_0x19d42e,_0x11c7eb){return function(_0x291dde){if(_0x291dde){var _0x44ae85=_0x291dde['count'],_0x33ce5e=_0x11c7eb['offset'],_0x424850=_0x11c7eb[_0x6a3a('0x19')]+_0x11c7eb[_0x6a3a('0x1a')],_0x57c143;if(_0x424850>=_0x44ae85){_0x424850=_0x44ae85;_0x57c143=0xc8;}else{_0x57c143=0xce;}_0x19d42e[_0x6a3a('0x17')](_0x57c143);return _0x19d42e[_0x6a3a('0x1b')](_0x6a3a('0x1c'),_0x33ce5e+'-'+_0x424850+'/'+_0x44ae85)[_0x6a3a('0x18')](_0x291dde);}return null;};}function patchUpdates(_0x3eeeef){return function(_0x4f2fcd){try{jsonpatch[_0x6a3a('0x1d')](_0x4f2fcd,_0x3eeeef,!![]);}catch(_0x2f2da4){return BPromise[_0x6a3a('0x1e')](_0x2f2da4);}return _0x4f2fcd['save']();};}function saveUpdates(_0x457abb,_0x42dcf5){return function(_0x11b8af){if(_0x11b8af){return _0x11b8af[_0x6a3a('0x1f')](_0x457abb)['then'](function(_0x2f19f4){return _0x2f19f4;});}return null;};}function removeEntity(_0x164f4c,_0x37057c){return function(_0x2f222c){if(_0x2f222c){return _0x2f222c['destroy']()[_0x6a3a('0x20')](function(){var _0xf58ff2=_0x2f222c[_0x6a3a('0x21')]({'plain':!![]});var _0xe3bca9=_0x6a3a('0x22');return db[_0x6a3a('0x23')][_0x6a3a('0x24')]({'where':{'type':_0xe3bca9,'resourceId':_0xf58ff2['id']}})['then'](function(){return _0x2f222c;});})[_0x6a3a('0x20')](function(){_0x164f4c[_0x6a3a('0x17')](0xcc)[_0x6a3a('0x16')]();});}};}function handleEntityNotFound(_0x29d31c,_0x4bf599){return function(_0x437401){if(!_0x437401){_0x29d31c['sendStatus'](0x194);}return _0x437401;};}function handleError(_0x21b0d3,_0xca0c06){_0xca0c06=_0xca0c06||0x1f4;return function(_0x2d1dc4){logger['error'](_0x2d1dc4[_0x6a3a('0x25')]);if(_0x2d1dc4['name']){delete _0x2d1dc4[_0x6a3a('0x26')];}_0x21b0d3['status'](_0xca0c06)[_0x6a3a('0x27')](_0x2d1dc4);};}exports[_0x6a3a('0x28')]=function(_0x2182c1,_0x8a29fc){var _0x602d57={},_0x1f4e58={},_0x38092e={'count':0x0,'rows':[]};var _0x4f697f=_['map'](db[_0x6a3a('0x29')][_0x6a3a('0x2a')],function(_0x14180e){return{'name':_0x14180e[_0x6a3a('0x2b')],'type':_0x14180e['type'][_0x6a3a('0x2c')]};});_0x1f4e58[_0x6a3a('0x2d')]=_[_0x6a3a('0x2e')](_0x4f697f,_0x6a3a('0x26'));_0x1f4e58['query']=_[_0x6a3a('0x2f')](_0x2182c1['query']);_0x1f4e58[_0x6a3a('0x30')]=_['intersection'](_0x1f4e58[_0x6a3a('0x2d')],_0x1f4e58[_0x6a3a('0x31')]);_0x602d57[_0x6a3a('0x32')]=_[_0x6a3a('0x33')](_0x1f4e58[_0x6a3a('0x2d')],qs[_0x6a3a('0x34')](_0x2182c1['query']['fields']));_0x602d57[_0x6a3a('0x32')]=_0x602d57[_0x6a3a('0x32')][_0x6a3a('0x35')]?_0x602d57[_0x6a3a('0x32')]:_0x1f4e58['model'];if(!_0x2182c1['query'][_0x6a3a('0x36')](_0x6a3a('0x37'))){_0x602d57[_0x6a3a('0x1a')]=qs[_0x6a3a('0x1a')](_0x2182c1[_0x6a3a('0x31')]['limit']);_0x602d57[_0x6a3a('0x19')]=qs[_0x6a3a('0x19')](_0x2182c1[_0x6a3a('0x31')][_0x6a3a('0x19')]);}_0x602d57[_0x6a3a('0x38')]=qs['sort'](_0x2182c1[_0x6a3a('0x31')]['sort']);_0x602d57[_0x6a3a('0x39')]=qs[_0x6a3a('0x30')](_['pick'](_0x2182c1[_0x6a3a('0x31')],_0x1f4e58[_0x6a3a('0x30')]));if(_0x2182c1['query'][_0x6a3a('0x3a')]){_0x602d57['where']=_[_0x6a3a('0x3b')](_0x602d57[_0x6a3a('0x39')],{'$or':_['map'](_0x4f697f,function(_0x2b8e67){if(_0x2b8e67[_0x6a3a('0x3c')]!==_0x6a3a('0x3d')){var _0x2754e9={};_0x2754e9[_0x2b8e67[_0x6a3a('0x26')]]={'$like':'%'+_0x2182c1[_0x6a3a('0x31')]['filter']+'%'};return _0x2754e9;}})});}_0x602d57=_[_0x6a3a('0x3b')]({},_0x602d57,_0x2182c1[_0x6a3a('0x3e')]);var _0x15cbe6={'where':_0x602d57[_0x6a3a('0x39')]};return db[_0x6a3a('0x29')][_0x6a3a('0x3f')](_0x15cbe6)[_0x6a3a('0x20')](function(_0x40b807){_0x38092e[_0x6a3a('0x3f')]=_0x40b807;if(_0x2182c1[_0x6a3a('0x31')]['includeAll']){_0x602d57[_0x6a3a('0x40')]=[{'all':!![]}];}return db[_0x6a3a('0x29')][_0x6a3a('0x41')](_0x602d57);})[_0x6a3a('0x20')](function(_0x45a7dc){_0x38092e[_0x6a3a('0x42')]=_0x45a7dc;return _0x38092e;})[_0x6a3a('0x20')](respondWithFilteredResult(_0x8a29fc,_0x602d57))[_0x6a3a('0x43')](handleError(_0x8a29fc,null));};exports[_0x6a3a('0x44')]=function(_0x3ce825,_0x4523d6){var _0x2c37be={'raw':![],'where':{'id':_0x3ce825[_0x6a3a('0x45')]['id']}},_0x14926e={};_0x14926e['model']=_[_0x6a3a('0x2f')](db[_0x6a3a('0x29')][_0x6a3a('0x2a')]);_0x14926e['query']=_[_0x6a3a('0x2f')](_0x3ce825[_0x6a3a('0x31')]);_0x14926e[_0x6a3a('0x30')]=_[_0x6a3a('0x33')](_0x14926e[_0x6a3a('0x2d')],_0x14926e['query']);_0x2c37be['attributes']=_[_0x6a3a('0x33')](_0x14926e[_0x6a3a('0x2d')],qs[_0x6a3a('0x34')](_0x3ce825['query'][_0x6a3a('0x34')]));_0x2c37be[_0x6a3a('0x32')]=_0x2c37be[_0x6a3a('0x32')][_0x6a3a('0x35')]?_0x2c37be[_0x6a3a('0x32')]:_0x14926e[_0x6a3a('0x2d')];if(_0x3ce825[_0x6a3a('0x31')][_0x6a3a('0x46')]){_0x2c37be[_0x6a3a('0x40')]=[{'all':!![]}];}_0x2c37be=_[_0x6a3a('0x3b')]({},_0x2c37be,_0x3ce825[_0x6a3a('0x3e')]);return db['AnalyticCustomReport']['find'](_0x2c37be)['then'](handleEntityNotFound(_0x4523d6,null))[_0x6a3a('0x20')](respondWithResult(_0x4523d6,null))[_0x6a3a('0x43')](handleError(_0x4523d6,null));};exports[_0x6a3a('0x47')]=function(_0x29f037,_0x1a3128){return db['AnalyticCustomReport'][_0x6a3a('0x47')](_0x29f037['body'],{})[_0x6a3a('0x20')](function(_0x4ba980){var _0x403bbc=_0x29f037['user'][_0x6a3a('0x21')]({'plain':!![]});if(!_0x403bbc)throw new Error(_0x6a3a('0x48'));if(_0x403bbc[_0x6a3a('0x49')]===_0x6a3a('0x4a')){var _0x19384a=_0x4ba980[_0x6a3a('0x21')]({'plain':!![]});var _0x5c9adf=_0x6a3a('0x4b');return db['UserProfileSection'][_0x6a3a('0x4c')]({'where':{'name':_0x5c9adf,'userProfileId':_0x403bbc[_0x6a3a('0x4d')]},'raw':!![]})[_0x6a3a('0x20')](function(_0x204aa7){if(_0x204aa7&&_0x204aa7[_0x6a3a('0x4e')]===0x0){return db[_0x6a3a('0x23')][_0x6a3a('0x47')]({'name':_0x19384a[_0x6a3a('0x26')],'resourceId':_0x19384a['id'],'type':'CustomReports','sectionId':_0x204aa7['id']},{})[_0x6a3a('0x20')](function(){return _0x4ba980;});}else{return _0x4ba980;}})['catch'](function(_0x1764a4){logger['error']('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x1764a4);throw _0x1764a4;});}return _0x4ba980;})['then'](respondWithResult(_0x1a3128,0xc9))['catch'](handleError(_0x1a3128,null));};exports[_0x6a3a('0x1f')]=function(_0x56d1f2,_0xdf3ca6){if(_0x56d1f2[_0x6a3a('0x4f')]['id']){delete _0x56d1f2['body']['id'];}return db['AnalyticCustomReport'][_0x6a3a('0x4c')]({'where':{'id':_0x56d1f2[_0x6a3a('0x45')]['id']}})[_0x6a3a('0x20')](handleEntityNotFound(_0xdf3ca6,null))[_0x6a3a('0x20')](saveUpdates(_0x56d1f2[_0x6a3a('0x4f')],null))['then'](respondWithResult(_0xdf3ca6,null))[_0x6a3a('0x43')](handleError(_0xdf3ca6,null));};exports[_0x6a3a('0x24')]=function(_0x1c5086,_0x12f006){return db[_0x6a3a('0x29')][_0x6a3a('0x4c')]({'where':{'id':_0x1c5086[_0x6a3a('0x45')]['id']}})[_0x6a3a('0x20')](handleEntityNotFound(_0x12f006,null))['then'](removeEntity(_0x12f006,null))[_0x6a3a('0x43')](handleError(_0x12f006,null));};exports[_0x6a3a('0x50')]=function(_0xcba707,_0x5187d9){var _0x2616ed=0xa;var _0x1c8e03=[_0x6a3a('0x51'),_0x6a3a('0x52'),_0x6a3a('0x53'),_0x6a3a('0x54')];var _0x154573={'SUM':_0x6a3a('0x55'),'COUNT':_0x6a3a('0x56'),'COUNT DISTINCT':_0x6a3a('0x57'),'MAX':_0x6a3a('0x58'),'MIN':'MIN(%s)','AVG':'AVG(%s)','GROUP_CONCAT':_0x6a3a('0x59'),'GROUP_CONCAT ASC':_0x6a3a('0x5a'),'GROUP_CONCAT DESC':_0x6a3a('0x5b')};var _0x1095bd={'SEC_TO_TIME':'SEC_TO_TIME(%s)','DATE':_0x6a3a('0x5c'),'HOUR':'HOUR(%s)','ROUND':'ROUND(%s)','UNIX_TIMESTAMP':_0x6a3a('0x5d')};var _0x37e2e1=function(_0x8f0abc){return!_[_0x6a3a('0x5e')]([_0x6a3a('0x5f'),'IS\x20NOT\x20NULL','IS\x20EMPTY','IS\x20NOT\x20EMPTY'],_0x8f0abc);};var _0x38f723=function(_0x5c5b81){if(!_0x5c5b81||!_0x5c5b81[_0x6a3a('0x60')]['length']){return'';}for(var _0x519438='(',_0x2fd0d8=0x0;_0x2fd0d8<_0x5c5b81[_0x6a3a('0x60')][_0x6a3a('0x35')];_0x2fd0d8+=0x1){_0x2fd0d8>0x0&&(_0x519438+='\x20'+_0x5c5b81[_0x6a3a('0x61')]+'\x20');_0x519438+=_0x5c5b81[_0x6a3a('0x60')][_0x2fd0d8][_0x6a3a('0x62')]?_0x38f723(_0x5c5b81[_0x6a3a('0x60')][_0x2fd0d8][_0x6a3a('0x62')]):_0x5c5b81[_0x6a3a('0x60')][_0x2fd0d8]['field']+'\x20'+_0x5c5b81[_0x6a3a('0x60')][_0x2fd0d8][_0x6a3a('0x63')]+(_0x37e2e1(_0x5c5b81[_0x6a3a('0x60')][_0x2fd0d8]['condition'])?'\x20'+_0x5c5b81[_0x6a3a('0x60')][_0x2fd0d8][_0x6a3a('0x64')]:'');}return _0x519438+')';};var _0x2852af={'where':{'id':_0xcba707[_0x6a3a('0x45')]['id']}},_0x135bae,_0xcaa9f5,_0x5e96a0,_0x3b9239,_0x291046;_0x2852af=_['merge']({},_0x2852af,_0xcba707['options']);return db[_0x6a3a('0x29')][_0x6a3a('0x4c')](_0x2852af)['then'](function(_0x4538f3){if(_0x4538f3){_0x135bae=_0x4538f3;return _0x4538f3[_0x6a3a('0x65')]();}return null;})['then'](function(_0x197a17){if(_0x197a17){if(!_0x197a17[_0x6a3a('0x35')]){throw new db['Sequelize'][(_0x6a3a('0x66'))](_0x6a3a('0x67'),0x193);}_0xcaa9f5=_0x197a17;return db[_0x6a3a('0x68')][_0x6a3a('0x41')]({'raw':!![]});}return null;})[_0x6a3a('0x20')](function(_0x2d913d){if(_0x2d913d){_0x5e96a0=_['keyBy'](_0x2d913d,'id');var _0x4a095f;var _0x5bbb61=squel['select']();_0x5bbb61[_0x6a3a('0x69')](_0x135bae[_0x6a3a('0x6a')]);for(var _0x33687f=0x0;_0x33687f<_0xcaa9f5[_0x6a3a('0x35')];_0x33687f+=0x1){_0x4a095f=_0xcaa9f5[_0x33687f][_0x6a3a('0x6b')]?_0x5e96a0[_0xcaa9f5[_0x33687f][_0x6a3a('0x6b')]]['metric']:_0xcaa9f5[_0x33687f][_0x6a3a('0x6c')];_0x4a095f=_0xcaa9f5[_0x33687f][_0x6a3a('0x6d')]?_[_0x6a3a('0x6e')](_0x154573[_0xcaa9f5[_0x33687f]['function']],'%s',_0x4a095f):_0x4a095f;_0x4a095f=_0xcaa9f5[_0x33687f][_0x6a3a('0x6f')]?_[_0x6a3a('0x6e')](_0x1095bd[_0xcaa9f5[_0x33687f][_0x6a3a('0x6f')]],'%s',_0x4a095f):_0x4a095f;if(_0xcaa9f5[_0x33687f]['groupBy']){_0x5bbb61[_0x6a3a('0x62')](_0x4a095f);}_0xcaa9f5[_0x33687f]['orderBy']&&_0x5bbb61['order'](_0x4a095f,_0xcaa9f5[_0x33687f][_0x6a3a('0x70')]==='DESC'?![]:!![]);_0x5bbb61[_0x6a3a('0x6c')](_0x4a095f,_0xcaa9f5[_0x33687f]['alias']||_0x4a095f);}if(_0x135bae[_0x6a3a('0x71')]){_0x135bae['joins']=JSON[_0x6a3a('0x72')](_0x135bae['joins']);for(var _0xc18348=0x0;_0xc18348<_0x135bae['joins'][_0x6a3a('0x35')];_0xc18348+=0x1){if(_0x135bae['joins'][_0xc18348]['type']&&_[_0x6a3a('0x5e')](_0x1c8e03,_0x135bae['joins'][_0xc18348][_0x6a3a('0x3c')])&&_0x135bae[_0x6a3a('0x71')][_0xc18348]['parentKey']&&_0x135bae[_0x6a3a('0x71')][_0xc18348]['foreignTable']&&_0x135bae[_0x6a3a('0x71')][_0xc18348][_0x6a3a('0x73')]){_0x5bbb61[_0x135bae['joins'][_0xc18348][_0x6a3a('0x3c')]](_0x135bae[_0x6a3a('0x71')][_0xc18348][_0x6a3a('0x74')],null,util[_0x6a3a('0x6f')](_0x6a3a('0x75'),_0x135bae[_0x6a3a('0x6a')],_0x135bae[_0x6a3a('0x71')][_0xc18348][_0x6a3a('0x76')],_0x135bae['joins'][_0xc18348][_0x6a3a('0x74')],_0x135bae[_0x6a3a('0x71')][_0xc18348][_0x6a3a('0x73')]));}}}if(_0x135bae['conditions']){_0x135bae[_0x6a3a('0x77')]=JSON[_0x6a3a('0x72')](_0x135bae[_0x6a3a('0x77')]);_0x5bbb61[_0x6a3a('0x39')](_0x38f723(_0x135bae[_0x6a3a('0x77')]['group']));}_0x291046=_0x5bbb61[_0x6a3a('0x78')]();_0x5bbb61[_0x6a3a('0x1a')](_0x2616ed);_0x5bbb61[_0x6a3a('0x19')](0x0);logger[_0x6a3a('0x79')](_0x6a3a('0x7a'),_0x5bbb61[_0x6a3a('0x7b')]());return db[_0x6a3a('0x7c')]['query'](_0x5bbb61[_0x6a3a('0x7b')](),{'type':db[_0x6a3a('0x7c')][_0x6a3a('0x7d')][_0x6a3a('0x7e')]});}})[_0x6a3a('0x20')](respondWithResult(_0x5187d9,null))[_0x6a3a('0x43')](handleError(_0x5187d9,null));};function runReport(_0x4647e5,_0x32c1b5,_0x32a881){var _0x23a8ce=_0x32c1b5['name'];var _0x3371ed=0xa;var _0x57663a=['join','left_join',_0x6a3a('0x53'),_0x6a3a('0x54')];var _0x318250={'SUM':_0x6a3a('0x55'),'COUNT':'COUNT(%s)','COUNT DISTINCT':_0x6a3a('0x57'),'MAX':'MAX(%s)','MIN':_0x6a3a('0x7f'),'AVG':_0x6a3a('0x80'),'GROUP_CONCAT':'GROUP_CONCAT(%s)','GROUP_CONCAT ASC':_0x6a3a('0x5a'),'GROUP_CONCAT DESC':_0x6a3a('0x5b')};var _0x8a39ac={'SEC_TO_TIME':'SEC_TO_TIME(%s)','DATE':'DATE(%s)','HOUR':_0x6a3a('0x81'),'ROUND':_0x6a3a('0x82'),'UNIX_TIMESTAMP':_0x6a3a('0x5d')};var _0x27b2ee=function(_0x3b2f39){return!_['includes']([_0x6a3a('0x5f'),'IS\x20NOT\x20NULL',_0x6a3a('0x83'),_0x6a3a('0x84')],_0x3b2f39);};var _0x239f7d=function(_0x583976){if(!_0x583976||!_0x583976['rules']['length']){return'';}for(var _0x2ea5dd='(',_0x38f230=0x0;_0x38f230<_0x583976[_0x6a3a('0x60')][_0x6a3a('0x35')];_0x38f230+=0x1){_0x38f230>0x0&&(_0x2ea5dd+='\x20'+_0x583976[_0x6a3a('0x61')]+'\x20');_0x2ea5dd+=_0x583976[_0x6a3a('0x60')][_0x38f230][_0x6a3a('0x62')]?_0x239f7d(_0x583976[_0x6a3a('0x60')][_0x38f230]['group']):_0x583976['rules'][_0x38f230][_0x6a3a('0x6c')]+'\x20'+_0x583976['rules'][_0x38f230][_0x6a3a('0x63')]+(_0x27b2ee(_0x583976[_0x6a3a('0x60')][_0x38f230][_0x6a3a('0x63')])?'\x20'+_0x583976['rules'][_0x38f230][_0x6a3a('0x64')]:'');}return _0x2ea5dd+')';};var _0xeb9382={'where':{'id':_0x4647e5['id']}},_0x3db9d8,_0x3b6c2c,_0x3917bb,_0x1f177c,_0xf2008c;_0xeb9382=_[_0x6a3a('0x3b')]({},_0xeb9382,_0x32a881);return db[_0x6a3a('0x29')][_0x6a3a('0x4c')](_0xeb9382)[_0x6a3a('0x20')](function(_0xb88b46){if(_0xb88b46){_0x3db9d8=_0xb88b46;return _0xb88b46[_0x6a3a('0x65')]();}return null;})[_0x6a3a('0x20')](function(_0x2853a2){if(_0x2853a2){if(!_0x2853a2[_0x6a3a('0x35')]){throw new db[(_0x6a3a('0x85'))][(_0x6a3a('0x66'))]('Please\x20insert\x20at\x20least\x20one\x20field',0x193);}_0x3b6c2c=_0x2853a2;return db['AnalyticMetric'][_0x6a3a('0x41')]({'raw':!![]});}return null;})['then'](function(_0x46aea9){if(_0x46aea9){_0x3917bb=_['keyBy'](_0x46aea9,'id');var _0x2193b2;var _0x1585ea=squel[_0x6a3a('0x86')]();_0x1585ea[_0x6a3a('0x69')](_0x3db9d8['table']);for(var _0x48a9d5=0x0;_0x48a9d5<_0x3b6c2c[_0x6a3a('0x35')];_0x48a9d5+=0x1){_0x2193b2=_0x3b6c2c[_0x48a9d5]['MetricId']?_0x3917bb[_0x3b6c2c[_0x48a9d5]['MetricId']]['metric']:_0x3b6c2c[_0x48a9d5][_0x6a3a('0x6c')];_0x2193b2=_0x3b6c2c[_0x48a9d5][_0x6a3a('0x6d')]?_[_0x6a3a('0x6e')](_0x318250[_0x3b6c2c[_0x48a9d5]['function']],'%s',_0x2193b2):_0x2193b2;_0x2193b2=_0x3b6c2c[_0x48a9d5][_0x6a3a('0x6f')]?_['replace'](_0x8a39ac[_0x3b6c2c[_0x48a9d5][_0x6a3a('0x6f')]],'%s',_0x2193b2):_0x2193b2;if(_0x3b6c2c[_0x48a9d5]['groupBy']){_0x1585ea[_0x6a3a('0x62')](_0x2193b2);}_0x3b6c2c[_0x48a9d5][_0x6a3a('0x70')]&&_0x1585ea[_0x6a3a('0x38')](_0x2193b2,_0x3b6c2c[_0x48a9d5][_0x6a3a('0x70')]===_0x6a3a('0x87')?![]:!![]);_0x1585ea['field'](_0x2193b2,_0x3b6c2c[_0x48a9d5]['alias']||_0x2193b2);}if(_0x3db9d8[_0x6a3a('0x71')]){_0x3db9d8[_0x6a3a('0x71')]=JSON[_0x6a3a('0x72')](_0x3db9d8[_0x6a3a('0x71')]);for(var _0x20bb3f=0x0;_0x20bb3f<_0x3db9d8[_0x6a3a('0x71')][_0x6a3a('0x35')];_0x20bb3f+=0x1){if(_0x3db9d8[_0x6a3a('0x71')][_0x20bb3f][_0x6a3a('0x3c')]&&_['includes'](_0x57663a,_0x3db9d8[_0x6a3a('0x71')][_0x20bb3f][_0x6a3a('0x3c')])&&_0x3db9d8[_0x6a3a('0x71')][_0x20bb3f][_0x6a3a('0x76')]&&_0x3db9d8[_0x6a3a('0x71')][_0x20bb3f][_0x6a3a('0x74')]&&_0x3db9d8['joins'][_0x20bb3f][_0x6a3a('0x73')]){_0x1585ea[_0x3db9d8[_0x6a3a('0x71')][_0x20bb3f]['type']](_0x3db9d8[_0x6a3a('0x71')][_0x20bb3f][_0x6a3a('0x74')],null,util[_0x6a3a('0x6f')](_0x6a3a('0x75'),_0x3db9d8['table'],_0x3db9d8[_0x6a3a('0x71')][_0x20bb3f]['parentKey'],_0x3db9d8[_0x6a3a('0x71')][_0x20bb3f][_0x6a3a('0x74')],_0x3db9d8['joins'][_0x20bb3f]['foreignKey']));}}}if(_0x3db9d8[_0x6a3a('0x77')]){_0x3db9d8[_0x6a3a('0x77')]=JSON[_0x6a3a('0x72')](_0x3db9d8[_0x6a3a('0x77')]);_0x1585ea['where'](_0x239f7d(_0x3db9d8[_0x6a3a('0x77')]['group']));}_0xf2008c=_0x1585ea['clone']();_0x1585ea['limit'](_0x3371ed);_0x1585ea[_0x6a3a('0x19')](0x0);logger[_0x6a3a('0x79')](_0x6a3a('0x7a'),_0x1585ea[_0x6a3a('0x7b')]());return db['sequelize'][_0x6a3a('0x31')](_0x1585ea[_0x6a3a('0x7b')](),{'type':db[_0x6a3a('0x7c')][_0x6a3a('0x7d')][_0x6a3a('0x7e')]});}})[_0x6a3a('0x20')](function(_0x26a450){if(!_0x26a450[_0x6a3a('0x35')]){throw new db[(_0x6a3a('0x85'))]['ValidationErrorItem'](_0x6a3a('0x88'),0xcc);}if(_0x32c1b5[_0x6a3a('0x89')]===_0x6a3a('0x8a')){return null;}var _0xbef808=_['merge'](_0x32c1b5,{'name':_0x32c1b5[_0x6a3a('0x8b')]||_0x32c1b5[_0x6a3a('0x26')]||_0x3db9d8[_0x6a3a('0x26')],'basename':_0x23a8ce,'savename':util[_0x6a3a('0x6f')](_0x6a3a('0x8c'),_0x32c1b5[_0x6a3a('0x26')]||_0x3db9d8[_0x6a3a('0x26')],require(_0x6a3a('0x8d'))[_0x6a3a('0x8e')](0x4),_0x32c1b5[_0x6a3a('0x89')]||_0x6a3a('0x8f')),'reportId':_0x3db9d8['id'],'reportType':_0x6a3a('0x90')});return db[_0x6a3a('0x91')][_0x6a3a('0x47')](_0xbef808,{'raw':!![]});})[_0x6a3a('0x20')](function(_0x3a3fec){if(_0x3db9d8[_0x6a3a('0x6a')]===_0x6a3a('0x92')){_0xf2008c['where'](_0x3db9d8[_0x6a3a('0x6a')]+_0x6a3a('0x93'),_0x32c1b5['startDate'],_0x32c1b5[_0x6a3a('0x94')]);}else{_0xf2008c[_0x6a3a('0x39')](_0x3db9d8['table']+'.createdAt\x20BETWEEN\x20?\x20AND\x20?',_0x32c1b5[_0x6a3a('0x95')],_0x32c1b5['endDate']);}if(_0x3a3fec){logger['info']('Run\x20Query:',_0xf2008c['toString']());require('child_process')[_0x6a3a('0x96')](path[_0x6a3a('0x51')](__dirname,_0x6a3a('0x97'),_0x3a3fec['output']),[_0x3a3fec['id'],_0xf2008c['toString'](),path[_0x6a3a('0x51')](__dirname,'../../files/reports',_0x3a3fec[_0x6a3a('0x98')]),_0x23a8ce]);return _0x3a3fec;}else{var _0x4f9ba7=squel[_0x6a3a('0x86')]();_0x4f9ba7['from']('('+_0xf2008c['toString']()+')','countTable');_0x4f9ba7[_0x6a3a('0x6c')](_0x6a3a('0x99'),_0x6a3a('0x3f'));_0xf2008c['limit'](_0x32c1b5['limit']||_0x3371ed);_0xf2008c[_0x6a3a('0x19')](_0x32c1b5[_0x6a3a('0x19')]||0x0);return db['sequelize'][_0x6a3a('0x31')](_0x4f9ba7[_0x6a3a('0x7b')](),{'type':db[_0x6a3a('0x7c')][_0x6a3a('0x7d')][_0x6a3a('0x7e')]})[_0x6a3a('0x20')](function(_0x4f6858){if(!_0x4f6858['length']){_0x1f177c=0x0;}else{_0x1f177c=_0x4f6858[0x0]['count']||0x0;}return db[_0x6a3a('0x7c')][_0x6a3a('0x31')](_0xf2008c[_0x6a3a('0x7b')](),{'type':db[_0x6a3a('0x7c')][_0x6a3a('0x7d')][_0x6a3a('0x7e')]});})['then'](function(_0xf76291){return{'rows':_0xf76291||[],'count':_0x1f177c};});}});}exports[_0x6a3a('0x9a')]=function(_0xa0e84c,_0x4dc74e){return runReport(_0xa0e84c[_0x6a3a('0x45')],_0xa0e84c['query'],_0xa0e84c[_0x6a3a('0x3e')])[_0x6a3a('0x20')](respondWithResult(_0x4dc74e,null))[_0x6a3a('0x43')](handleError(_0x4dc74e,null));};exports[_0x6a3a('0x9b')]=runReport;exports[_0x6a3a('0x31')]=function(_0x3b391d,_0x21981b){var _0xd0e5d=0xa;var _0x5a0589=['join',_0x6a3a('0x52'),_0x6a3a('0x53'),_0x6a3a('0x54')];var _0x224e8e={'SUM':_0x6a3a('0x55'),'COUNT':'COUNT(%s)','COUNT DISTINCT':'COUNT(DISTINCT\x20%s)','MAX':_0x6a3a('0x58'),'MIN':_0x6a3a('0x7f'),'AVG':_0x6a3a('0x80'),'GROUP_CONCAT':'GROUP_CONCAT(%s)','GROUP_CONCAT ASC':_0x6a3a('0x5a'),'GROUP_CONCAT DESC':_0x6a3a('0x5b')};var _0x28b13e={'SEC_TO_TIME':'SEC_TO_TIME(%s)','DATE':_0x6a3a('0x5c'),'HOUR':'HOUR(%s)','ROUND':_0x6a3a('0x82'),'UNIX_TIMESTAMP':_0x6a3a('0x5d')};var _0x1b656e=function(_0x191032){return!_[_0x6a3a('0x5e')]([_0x6a3a('0x5f'),_0x6a3a('0x9c'),_0x6a3a('0x83'),_0x6a3a('0x84')],_0x191032);};var _0x5690ba=function(_0xaa648b){if(!_0xaa648b||!_0xaa648b['rules']['length']){return'';}for(var _0xdf49ab='(',_0x492195=0x0;_0x492195<_0xaa648b[_0x6a3a('0x60')][_0x6a3a('0x35')];_0x492195+=0x1){_0x492195>0x0&&(_0xdf49ab+='\x20'+_0xaa648b[_0x6a3a('0x61')]+'\x20');_0xdf49ab+=_0xaa648b['rules'][_0x492195][_0x6a3a('0x62')]?_0x5690ba(_0xaa648b['rules'][_0x492195]['group']):_0xaa648b[_0x6a3a('0x60')][_0x492195]['field']+'\x20'+_0xaa648b[_0x6a3a('0x60')][_0x492195][_0x6a3a('0x63')]+(_0x1b656e(_0xaa648b[_0x6a3a('0x60')][_0x492195][_0x6a3a('0x63')])?'\x20'+_0xaa648b['rules'][_0x492195][_0x6a3a('0x64')]:'');}return _0xdf49ab+')';};var _0x23f985={'where':{'id':_0x3b391d[_0x6a3a('0x45')]['id']}},_0x5ed3c7,_0x17e794,_0x1db1a8,_0x286198,_0x5b2c6c;_0x23f985=_[_0x6a3a('0x3b')]({},_0x23f985,_0x3b391d[_0x6a3a('0x3e')]);return db['AnalyticCustomReport']['find'](_0x23f985)[_0x6a3a('0x20')](function(_0x9f91e){if(_0x9f91e){_0x5ed3c7=_0x9f91e;return _0x9f91e[_0x6a3a('0x65')]();}return null;})['then'](function(_0xa4e48f){if(_0xa4e48f){if(!_0xa4e48f[_0x6a3a('0x35')]){throw new db[(_0x6a3a('0x85'))][(_0x6a3a('0x66'))]('Please\x20insert\x20at\x20least\x20one\x20field',0x193);}_0x17e794=_0xa4e48f;return db[_0x6a3a('0x68')][_0x6a3a('0x41')]({'raw':!![]});}return null;})['then'](function(_0x47ce2e){if(_0x47ce2e){_0x1db1a8=_[_0x6a3a('0x9d')](_0x47ce2e,'id');var _0x52e7e4;var _0x4cdaa7=squel[_0x6a3a('0x86')]();_0x4cdaa7[_0x6a3a('0x69')](_0x5ed3c7[_0x6a3a('0x6a')]);for(var _0x310523=0x0;_0x310523<_0x17e794[_0x6a3a('0x35')];_0x310523+=0x1){_0x52e7e4=_0x17e794[_0x310523][_0x6a3a('0x6b')]?_0x1db1a8[_0x17e794[_0x310523][_0x6a3a('0x6b')]][_0x6a3a('0x9e')]:_0x17e794[_0x310523][_0x6a3a('0x6c')];_0x52e7e4=_0x17e794[_0x310523]['function']?_[_0x6a3a('0x6e')](_0x224e8e[_0x17e794[_0x310523][_0x6a3a('0x6d')]],'%s',_0x52e7e4):_0x52e7e4;_0x52e7e4=_0x17e794[_0x310523][_0x6a3a('0x6f')]?_[_0x6a3a('0x6e')](_0x28b13e[_0x17e794[_0x310523]['format']],'%s',_0x52e7e4):_0x52e7e4;if(_0x17e794[_0x310523][_0x6a3a('0x9f')]){_0x4cdaa7['group'](_0x52e7e4);}_0x17e794[_0x310523][_0x6a3a('0x70')]&&_0x4cdaa7[_0x6a3a('0x38')](_0x52e7e4,_0x17e794[_0x310523]['orderBy']==='DESC'?![]:!![]);_0x4cdaa7[_0x6a3a('0x6c')](_0x52e7e4,_0x17e794[_0x310523][_0x6a3a('0xa0')]||_0x52e7e4);}if(_0x5ed3c7['joins']){_0x5ed3c7[_0x6a3a('0x71')]=JSON[_0x6a3a('0x72')](_0x5ed3c7[_0x6a3a('0x71')]);for(var _0x6e21ff=0x0;_0x6e21ff<_0x5ed3c7['joins']['length'];_0x6e21ff+=0x1){if(_0x5ed3c7[_0x6a3a('0x71')][_0x6e21ff][_0x6a3a('0x3c')]&&_[_0x6a3a('0x5e')](_0x5a0589,_0x5ed3c7[_0x6a3a('0x71')][_0x6e21ff][_0x6a3a('0x3c')])&&_0x5ed3c7['joins'][_0x6e21ff][_0x6a3a('0x76')]&&_0x5ed3c7[_0x6a3a('0x71')][_0x6e21ff][_0x6a3a('0x74')]&&_0x5ed3c7[_0x6a3a('0x71')][_0x6e21ff][_0x6a3a('0x73')]){_0x4cdaa7[_0x5ed3c7[_0x6a3a('0x71')][_0x6e21ff][_0x6a3a('0x3c')]](_0x5ed3c7['joins'][_0x6e21ff][_0x6a3a('0x74')],null,util[_0x6a3a('0x6f')]('%s.%s\x20=\x20%s.%s',_0x5ed3c7[_0x6a3a('0x6a')],_0x5ed3c7[_0x6a3a('0x71')][_0x6e21ff]['parentKey'],_0x5ed3c7[_0x6a3a('0x71')][_0x6e21ff][_0x6a3a('0x74')],_0x5ed3c7[_0x6a3a('0x71')][_0x6e21ff]['foreignKey']));}}}if(_0x5ed3c7[_0x6a3a('0x77')]){_0x5ed3c7['conditions']=JSON[_0x6a3a('0x72')](_0x5ed3c7['conditions']);_0x4cdaa7[_0x6a3a('0x39')](_0x5690ba(_0x5ed3c7[_0x6a3a('0x77')][_0x6a3a('0x62')]));}_0x5b2c6c=_0x4cdaa7[_0x6a3a('0x78')]();_0x4cdaa7[_0x6a3a('0x1a')](_0xd0e5d);_0x4cdaa7[_0x6a3a('0x19')](0x0);logger[_0x6a3a('0x79')](_0x6a3a('0x7a'),_0x4cdaa7[_0x6a3a('0x7b')]());return db['sequelize'][_0x6a3a('0x31')](_0x4cdaa7[_0x6a3a('0x7b')](),{'type':db['sequelize'][_0x6a3a('0x7d')]['SELECT']});}})[_0x6a3a('0x20')](function(){return{'sql':_0x5b2c6c['toString']()};})[_0x6a3a('0x20')](respondWithResult(_0x21981b,null))[_0x6a3a('0x43')](handleError(_0x21981b,null));}; \ No newline at end of file diff --git a/server/api/analyticCustomReport/analyticCustomReport.model.js b/server/api/analyticCustomReport/analyticCustomReport.model.js index bba6a31..526f1ea 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 _0xe5e8=['bluebird','request-promise','rimraf','../../config/environment','exports','AnalyticCustomReport','lodash','../../config/logger','api','moment'];(function(_0x4d9403,_0x33c5f0){var _0x5eef11=function(_0x50bb5c){while(--_0x50bb5c){_0x4d9403['push'](_0x4d9403['shift']());}};_0x5eef11(++_0x33c5f0);}(_0xe5e8,0xce));var _0x8e5e=function(_0x32d218,_0x485ddc){_0x32d218=_0x32d218-0x0;var _0x2b26ec=_0xe5e8[_0x32d218];return _0x2b26ec;};'use strict';var _=require(_0x8e5e('0x0'));var util=require('util');var logger=require(_0x8e5e('0x1'))(_0x8e5e('0x2'));var moment=require(_0x8e5e('0x3'));var BPromise=require(_0x8e5e('0x4'));var rp=require(_0x8e5e('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x8e5e('0x6'));var config=require(_0x8e5e('0x7'));var attributes=require('./analyticCustomReport.attributes');module[_0x8e5e('0x8')]=function(_0x27d616,_0x3c15ee){return _0x27d616['define'](_0x8e5e('0x9'),attributes,{'tableName':'analytics_custom_reports','paranoid':!![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x12c3=['../../config/logger','moment','request-promise','path','rimraf','../../config/environment','AnalyticCustomReport','analytics_custom_reports','util'];(function(_0x4243a3,_0x447337){var _0x1b2a33=function(_0x6a8200){while(--_0x6a8200){_0x4243a3['push'](_0x4243a3['shift']());}};_0x1b2a33(++_0x447337);}(_0x12c3,0x104));var _0x312c=function(_0x5ac252,_0x552100){_0x5ac252=_0x5ac252-0x0;var _0x162bb7=_0x12c3[_0x5ac252];return _0x162bb7;};'use strict';var _=require('lodash');var util=require(_0x312c('0x0'));var logger=require(_0x312c('0x1'))('api');var moment=require(_0x312c('0x2'));var BPromise=require('bluebird');var rp=require(_0x312c('0x3'));var fs=require('fs');var path=require(_0x312c('0x4'));var rimraf=require(_0x312c('0x5'));var config=require(_0x312c('0x6'));var attributes=require('./analyticCustomReport.attributes');module['exports']=function(_0x563ca8,_0x22e768){return _0x563ca8['define'](_0x312c('0x7'),attributes,{'tableName':_0x312c('0x8'),'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 a277387..182f0e0 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 _0x8ff6=['util','moment','bluebird','ioredis','../../mysqldb','../../config/logger','rpc','jayson/promise','then','info','AnalyticCustomReport,\x20%s,\x20%s','request\x20sent','debug','AnalyticCustomReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash'];(function(_0x1ece8c,_0x129d9e){var _0x5337de=function(_0x3a9760){while(--_0x3a9760){_0x1ece8c['push'](_0x1ece8c['shift']());}};_0x5337de(++_0x129d9e);}(_0x8ff6,0xa7));var _0x68ff=function(_0x311c35,_0x534915){_0x311c35=_0x311c35-0x0;var _0x5cc50c=_0x8ff6[_0x311c35];return _0x5cc50c;};'use strict';var _=require(_0x68ff('0x0'));var util=require(_0x68ff('0x1'));var moment=require(_0x68ff('0x2'));var BPromise=require(_0x68ff('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x68ff('0x4'));var db=require(_0x68ff('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x68ff('0x6'))(_0x68ff('0x7'));var config=require('../../config/environment');var jayson=require(_0x68ff('0x8'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x157314,_0x28d419,_0x256f73){return new BPromise(function(_0x8a679d,_0x4b7d6){return client['request'](_0x157314,_0x256f73)[_0x68ff('0x9')](function(_0x189990){logger[_0x68ff('0xa')](_0x68ff('0xb'),_0x28d419,_0x68ff('0xc'));logger[_0x68ff('0xd')](_0x68ff('0xe'),_0x28d419,'request\x20sent',JSON[_0x68ff('0xf')](_0x189990));if(_0x189990[_0x68ff('0x10')]){if(_0x189990[_0x68ff('0x10')][_0x68ff('0x11')]===0x1f4){logger[_0x68ff('0x10')]('AnalyticCustomReport,\x20%s,\x20%s',_0x28d419,_0x189990[_0x68ff('0x10')][_0x68ff('0x12')]);return _0x4b7d6(_0x189990[_0x68ff('0x10')][_0x68ff('0x12')]);}logger[_0x68ff('0x10')](_0x68ff('0xb'),_0x28d419,_0x189990['error'][_0x68ff('0x12')]);return _0x8a679d(_0x189990[_0x68ff('0x10')][_0x68ff('0x12')]);}else{logger['info'](_0x68ff('0xb'),_0x28d419,_0x68ff('0xc'));_0x8a679d(_0x189990[_0x68ff('0x13')]['message']);}})[_0x68ff('0x14')](function(_0x204823){logger['error']('AnalyticCustomReport,\x20%s,\x20%s',_0x28d419,_0x204823);_0x4b7d6(_0x204823);});});} \ No newline at end of file +var _0xc535=['../../config/utils','../../config/logger','rpc','../../config/environment','client','http','request','then','info','AnalyticCustomReport,\x20%s,\x20%s','debug','AnalyticCustomReport,\x20%s,\x20%s,\x20%s','error','code','message','result','lodash','util','moment','../../mysqldb'];(function(_0x285702,_0x2560e2){var _0x461b3a=function(_0x2fff5a){while(--_0x2fff5a){_0x285702['push'](_0x285702['shift']());}};_0x461b3a(++_0x2560e2);}(_0xc535,0x150));var _0x5c53=function(_0x2511dc,_0x37845f){_0x2511dc=_0x2511dc-0x0;var _0x19d64f=_0xc535[_0x2511dc];return _0x19d64f;};'use strict';var _=require(_0x5c53('0x0'));var util=require(_0x5c53('0x1'));var moment=require(_0x5c53('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x5c53('0x3'))['db'];var utils=require(_0x5c53('0x4'));var logger=require(_0x5c53('0x5'))(_0x5c53('0x6'));var config=require(_0x5c53('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x5c53('0x8')][_0x5c53('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x3333d2,_0x408bca,_0x4ac661){return new BPromise(function(_0x462d88,_0xb53139){return client[_0x5c53('0xa')](_0x3333d2,_0x4ac661)[_0x5c53('0xb')](function(_0x5d7377){logger[_0x5c53('0xc')](_0x5c53('0xd'),_0x408bca,'request\x20sent');logger[_0x5c53('0xe')](_0x5c53('0xf'),_0x408bca,'request\x20sent',JSON['stringify'](_0x5d7377));if(_0x5d7377[_0x5c53('0x10')]){if(_0x5d7377[_0x5c53('0x10')][_0x5c53('0x11')]===0x1f4){logger[_0x5c53('0x10')](_0x5c53('0xd'),_0x408bca,_0x5d7377[_0x5c53('0x10')]['message']);return _0xb53139(_0x5d7377[_0x5c53('0x10')][_0x5c53('0x12')]);}logger[_0x5c53('0x10')](_0x5c53('0xd'),_0x408bca,_0x5d7377['error'][_0x5c53('0x12')]);return _0x462d88(_0x5d7377['error'][_0x5c53('0x12')]);}else{logger[_0x5c53('0xc')]('AnalyticCustomReport,\x20%s,\x20%s',_0x408bca,'request\x20sent');_0x462d88(_0x5d7377[_0x5c53('0x13')][_0x5c53('0x12')]);}})['catch'](function(_0x555d66){logger[_0x5c53('0x10')](_0x5c53('0xd'),_0x408bca,_0x555d66);_0xb53139(_0x555d66);});});} \ No newline at end of file diff --git a/server/api/analyticCustomReport/index.js b/server/api/analyticCustomReport/index.js index 8244b4d..99f7e5a 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 _0x4047=['multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./analyticCustomReport.controller','get','isAuthenticated','index','/:id','show','/:id/preview','preview','run','post','delete','destroy','exports'];(function(_0xb0fe92,_0x147e42){var _0x41787f=function(_0x42ae35){while(--_0x42ae35){_0xb0fe92['push'](_0xb0fe92['shift']());}};_0x41787f(++_0x147e42);}(_0x4047,0x1a2));var _0x7404=function(_0x4e6525,_0x5ae350){_0x4e6525=_0x4e6525-0x0;var _0x2ffb76=_0x4047[_0x4e6525];return _0x2ffb76;};'use strict';var multer=require(_0x7404('0x0'));var util=require(_0x7404('0x1'));var path=require(_0x7404('0x2'));var timeout=require(_0x7404('0x3'));var express=require(_0x7404('0x4'));var router=express[_0x7404('0x5')]();var auth=require(_0x7404('0x6'));var interaction=require(_0x7404('0x7'));var config=require(_0x7404('0x8'));var controller=require(_0x7404('0x9'));router[_0x7404('0xa')]('/',auth[_0x7404('0xb')](),controller[_0x7404('0xc')]);router[_0x7404('0xa')](_0x7404('0xd'),auth[_0x7404('0xb')](),controller[_0x7404('0xe')]);router[_0x7404('0xa')](_0x7404('0xf'),auth[_0x7404('0xb')](),controller[_0x7404('0x10')]);router[_0x7404('0xa')]('/:id/run',auth[_0x7404('0xb')](),controller[_0x7404('0x11')]);router['get']('/:id/query',auth[_0x7404('0xb')](),controller['query']);router[_0x7404('0x12')]('/',auth[_0x7404('0xb')](),controller['create']);router['put'](_0x7404('0xd'),auth[_0x7404('0xb')](),controller['update']);router[_0x7404('0x13')](_0x7404('0xd'),auth['isAuthenticated'](),controller[_0x7404('0x14')]);module[_0x7404('0x15')]=router; \ No newline at end of file +var _0x65ec=['/:id/run','run','post','put','/:id','update','destroy','exports','multer','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./analyticCustomReport.controller','get','isAuthenticated','show','/:id/preview','preview'];(function(_0x4b055c,_0x4b870b){var _0x4b62bb=function(_0x4884c2){while(--_0x4884c2){_0x4b055c['push'](_0x4b055c['shift']());}};_0x4b62bb(++_0x4b870b);}(_0x65ec,0xc5));var _0xc65e=function(_0x3fb0ab,_0x3ecfec){_0x3fb0ab=_0x3fb0ab-0x0;var _0x9634b7=_0x65ec[_0x3fb0ab];return _0x9634b7;};'use strict';var multer=require(_0xc65e('0x0'));var util=require('util');var path=require('path');var timeout=require(_0xc65e('0x1'));var express=require(_0xc65e('0x2'));var router=express[_0xc65e('0x3')]();var auth=require(_0xc65e('0x4'));var interaction=require(_0xc65e('0x5'));var config=require(_0xc65e('0x6'));var controller=require(_0xc65e('0x7'));router[_0xc65e('0x8')]('/',auth[_0xc65e('0x9')](),controller['index']);router[_0xc65e('0x8')]('/:id',auth[_0xc65e('0x9')](),controller[_0xc65e('0xa')]);router['get'](_0xc65e('0xb'),auth[_0xc65e('0x9')](),controller[_0xc65e('0xc')]);router[_0xc65e('0x8')](_0xc65e('0xd'),auth['isAuthenticated'](),controller[_0xc65e('0xe')]);router[_0xc65e('0x8')]('/:id/query',auth[_0xc65e('0x9')](),controller['query']);router[_0xc65e('0xf')]('/',auth[_0xc65e('0x9')](),controller['create']);router[_0xc65e('0x10')](_0xc65e('0x11'),auth['isAuthenticated'](),controller[_0xc65e('0x12')]);router['delete'](_0xc65e('0x11'),auth['isAuthenticated'](),controller[_0xc65e('0x13')]);module[_0xc65e('0x14')]=router; \ No newline at end of file diff --git a/server/api/analyticDefaultReport/analyticDefaultReport.attributes.js b/server/api/analyticDefaultReport/analyticDefaultReport.attributes.js index 0132417..7648e3c 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 _0x7291=['TEXT','sequelize','exports','STRING'];(function(_0x1beef3,_0x57c4b8){var _0x5af964=function(_0x36f463){while(--_0x36f463){_0x1beef3['push'](_0x1beef3['shift']());}};_0x5af964(++_0x57c4b8);}(_0x7291,0xe5));var _0x1729=function(_0x1595d9,_0x5b6cfb){_0x1595d9=_0x1595d9-0x0;var _0x12d5d9=_0x7291[_0x1595d9];return _0x12d5d9;};'use strict';var Sequelize=require(_0x1729('0x0'));module[_0x1729('0x1')]={'name':{'type':Sequelize[_0x1729('0x2')],'allowNull':![]},'description':{'type':Sequelize[_0x1729('0x2')]},'parent':{'type':Sequelize['STRING']},'table':{'type':Sequelize[_0x1729('0x2')]},'conditions':{'type':Sequelize[_0x1729('0x3')]},'joins':{'type':Sequelize[_0x1729('0x3')]}}; \ No newline at end of file +var _0x98f5=['TEXT','STRING'];(function(_0x4edb29,_0x45aa0d){var _0x14d194=function(_0x3511f7){while(--_0x3511f7){_0x4edb29['push'](_0x4edb29['shift']());}};_0x14d194(++_0x45aa0d);}(_0x98f5,0x1e3));var _0x598f=function(_0x217569,_0x35623e){_0x217569=_0x217569-0x0;var _0x21c0a0=_0x98f5[_0x217569];return _0x21c0a0;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize['STRING'],'allowNull':![]},'description':{'type':Sequelize[_0x598f('0x0')]},'parent':{'type':Sequelize[_0x598f('0x0')]},'table':{'type':Sequelize['STRING']},'conditions':{'type':Sequelize[_0x598f('0x1')]},'joins':{'type':Sequelize[_0x598f('0x1')]}}; \ No newline at end of file diff --git a/server/api/analyticDefaultReport/analyticDefaultReport.controller.js b/server/api/analyticDefaultReport/analyticDefaultReport.controller.js index 20e4400..2ac5f90 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 _0x64f5=['length','hasOwnProperty','nolimit','limit','order','sort','pick','filter','where','type','merge','options','includeAll','include','findAll','rows','find','catch','create','body','user','get','Reports','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','preview','left_join','cross_join','SUM(%s)','MAX(%s)','MIN(%s)','AVG(%s)','GROUP_CONCAT(%s)','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20DESC)','SEC_TO_TIME(%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','Sequelize','Please\x20insert\x20at\x20least\x20one\x20field','AnalyticMetric','keyBy','MetricId','metric','function','replace','format','groupBy','orderBy','alias','joins','parse','foreignKey','foreignTable','%s.%s\x20=\x20%s.%s','table','parentKey','conditions','clone','debug','Limited\x20Query:','toString','sequelize','QueryTypes','join','right_join','getFields','ValidationErrorItem','select','from','DESC','No\x20available\x20data','output','web','fullPath','%s-%s.%s','randomstring','generate','csv','default','AnalyticExtractedReport','.calldate\x20BETWEEN\x20?\x20AND\x20?','endDate','.createdAt\x20BETWEEN\x20?\x20AND\x20?','info','Run\x20Query:','child_process','fork','../../files/reports','savename','countTable','COUNT(*)','SELECT','run','runReport','COUNT(%s)','COUNT(DISTINCT\x20%s)','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','html-pdf','rimraf','zip-dir','fast-json-patch','moment','bluebird','util','path','sox','to-csv','ejs','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../mysqldb','status','end','json','count','offset','reject','save','update','then','destroy','DefaultReports','UserProfileResource','sendStatus','error','name','index','map','AnalyticDefaultReport','rawAttributes','fieldName','key','query','keys','filters','attributes','intersection','model','fields'];(function(_0x8d486a,_0x4b372a){var _0x96926e=function(_0x550794){while(--_0x550794){_0x8d486a['push'](_0x8d486a['shift']());}};_0x96926e(++_0x4b372a);}(_0x64f5,0x6e));var _0x564f=function(_0x110733,_0x37b318){_0x110733=_0x110733-0x0;var _0x97b4b=_0x64f5[_0x110733];return _0x97b4b;};'use strict';var pdf=require(_0x564f('0x0'));var emlformat=require('eml-format');var rimraf=require(_0x564f('0x1'));var zipdir=require(_0x564f('0x2'));var jsonpatch=require(_0x564f('0x3'));var rp=require('request-promise');var moment=require(_0x564f('0x4'));var BPromise=require(_0x564f('0x5'));var Mustache=require('mustache');var util=require(_0x564f('0x6'));var path=require(_0x564f('0x7'));var sox=require(_0x564f('0x8'));var csv=require(_0x564f('0x9'));var ejs=require(_0x564f('0xa'));var fs=require('fs');var _=require('lodash');var squel=require(_0x564f('0xb'));var crypto=require('crypto');var jsforce=require(_0x564f('0xc'));var deskjs=require(_0x564f('0xd'));var toCsv=require('to-csv');var querystring=require(_0x564f('0xe'));var Papa=require(_0x564f('0xf'));var Redis=require(_0x564f('0x10'));var authService=require(_0x564f('0x11'));var qs=require(_0x564f('0x12'));var as=require(_0x564f('0x13'));var hardwareService=require(_0x564f('0x14'));var logger=require('../../config/logger')(_0x564f('0x15'));var utils=require(_0x564f('0x16'));var config=require(_0x564f('0x17'));var db=require(_0x564f('0x18'))['db'];function respondWithStatusCode(_0x2954d1,_0x4b0ff7){_0x4b0ff7=_0x4b0ff7||0xcc;return function(_0x40296e){if(_0x40296e){return _0x2954d1['sendStatus'](_0x4b0ff7);}return _0x2954d1[_0x564f('0x19')](_0x4b0ff7)[_0x564f('0x1a')]();};}function respondWithResult(_0x337afa,_0x5e052b){_0x5e052b=_0x5e052b||0xc8;return function(_0xdb60e2){if(_0xdb60e2){return _0x337afa['status'](_0x5e052b)[_0x564f('0x1b')](_0xdb60e2);}};}function respondWithFilteredResult(_0x24b470,_0x299a6f){return function(_0x42103e){if(_0x42103e){var _0x5f5dbf=_0x42103e[_0x564f('0x1c')],_0x16618e=_0x299a6f[_0x564f('0x1d')],_0x26bcca=_0x299a6f[_0x564f('0x1d')]+_0x299a6f['limit'],_0xe16d0e;if(_0x26bcca>=_0x5f5dbf){_0x26bcca=_0x5f5dbf;_0xe16d0e=0xc8;}else{_0xe16d0e=0xce;}_0x24b470['status'](_0xe16d0e);return _0x24b470['set']('Content-Range',_0x16618e+'-'+_0x26bcca+'/'+_0x5f5dbf)['json'](_0x42103e);}return null;};}function patchUpdates(_0xa9f562){return function(_0xade937){try{jsonpatch['apply'](_0xade937,_0xa9f562,!![]);}catch(_0x1adb66){return BPromise[_0x564f('0x1e')](_0x1adb66);}return _0xade937[_0x564f('0x1f')]();};}function saveUpdates(_0x4e1acf,_0x44a0c0){return function(_0x3d9abb){if(_0x3d9abb){return _0x3d9abb[_0x564f('0x20')](_0x4e1acf)[_0x564f('0x21')](function(_0x5182dc){return _0x5182dc;});}return null;};}function removeEntity(_0x1ed5d4,_0x55d6ab){return function(_0x5ce8d8){if(_0x5ce8d8){return _0x5ce8d8[_0x564f('0x22')]()['then'](function(){var _0x2d973c=_0x5ce8d8['get']({'plain':!![]});var _0x32ec4d=_0x564f('0x23');return db[_0x564f('0x24')]['destroy']({'where':{'type':_0x32ec4d,'resourceId':_0x2d973c['id']}})['then'](function(){return _0x5ce8d8;});})['then'](function(){_0x1ed5d4['status'](0xcc)[_0x564f('0x1a')]();});}};}function handleEntityNotFound(_0x545c6a,_0x3bb717){return function(_0x529e9c){if(!_0x529e9c){_0x545c6a[_0x564f('0x25')](0x194);}return _0x529e9c;};}function handleError(_0x3a2aa9,_0x59ce95){_0x59ce95=_0x59ce95||0x1f4;return function(_0x43bef1){logger[_0x564f('0x26')](_0x43bef1['stack']);if(_0x43bef1[_0x564f('0x27')]){delete _0x43bef1['name'];}_0x3a2aa9['status'](_0x59ce95)['send'](_0x43bef1);};}exports[_0x564f('0x28')]=function(_0x488994,_0x124ac0){var _0x2d3bf6={},_0x5267f8={},_0x511a38={'count':0x0,'rows':[]};var _0x253d96=_[_0x564f('0x29')](db[_0x564f('0x2a')][_0x564f('0x2b')],function(_0x590fcc){return{'name':_0x590fcc[_0x564f('0x2c')],'type':_0x590fcc['type'][_0x564f('0x2d')]};});_0x5267f8['model']=_[_0x564f('0x29')](_0x253d96,_0x564f('0x27'));_0x5267f8[_0x564f('0x2e')]=_[_0x564f('0x2f')](_0x488994['query']);_0x5267f8[_0x564f('0x30')]=_['intersection'](_0x5267f8['model'],_0x5267f8[_0x564f('0x2e')]);_0x2d3bf6[_0x564f('0x31')]=_[_0x564f('0x32')](_0x5267f8[_0x564f('0x33')],qs[_0x564f('0x34')](_0x488994[_0x564f('0x2e')][_0x564f('0x34')]));_0x2d3bf6[_0x564f('0x31')]=_0x2d3bf6[_0x564f('0x31')][_0x564f('0x35')]?_0x2d3bf6['attributes']:_0x5267f8['model'];if(!_0x488994[_0x564f('0x2e')][_0x564f('0x36')](_0x564f('0x37'))){_0x2d3bf6[_0x564f('0x38')]=qs[_0x564f('0x38')](_0x488994['query'][_0x564f('0x38')]);_0x2d3bf6[_0x564f('0x1d')]=qs['offset'](_0x488994[_0x564f('0x2e')]['offset']);}_0x2d3bf6[_0x564f('0x39')]=qs[_0x564f('0x3a')](_0x488994['query']['sort']);_0x2d3bf6['where']=qs[_0x564f('0x30')](_[_0x564f('0x3b')](_0x488994[_0x564f('0x2e')],_0x5267f8[_0x564f('0x30')]));if(_0x488994['query'][_0x564f('0x3c')]){_0x2d3bf6['where']=_['merge'](_0x2d3bf6[_0x564f('0x3d')],{'$or':_[_0x564f('0x29')](_0x253d96,function(_0x2c31c1){if(_0x2c31c1[_0x564f('0x3e')]!=='VIRTUAL'){var _0x13295e={};_0x13295e[_0x2c31c1[_0x564f('0x27')]]={'$like':'%'+_0x488994[_0x564f('0x2e')][_0x564f('0x3c')]+'%'};return _0x13295e;}})});}_0x2d3bf6=_[_0x564f('0x3f')]({},_0x2d3bf6,_0x488994[_0x564f('0x40')]);var _0xf9bc16={'where':_0x2d3bf6[_0x564f('0x3d')]};return db['AnalyticDefaultReport'][_0x564f('0x1c')](_0xf9bc16)[_0x564f('0x21')](function(_0x1c06c1){_0x511a38['count']=_0x1c06c1;if(_0x488994[_0x564f('0x2e')][_0x564f('0x41')]){_0x2d3bf6[_0x564f('0x42')]=[{'all':!![]}];}return db['AnalyticDefaultReport'][_0x564f('0x43')](_0x2d3bf6);})[_0x564f('0x21')](function(_0x43f327){_0x511a38[_0x564f('0x44')]=_0x43f327;return _0x511a38;})[_0x564f('0x21')](respondWithFilteredResult(_0x124ac0,_0x2d3bf6))['catch'](handleError(_0x124ac0,null));};exports['show']=function(_0x2f1b3f,_0x4ce80d){var _0x1a0d50={'raw':!![],'where':{'id':_0x2f1b3f['params']['id']}},_0x181492={};_0x181492[_0x564f('0x33')]=_[_0x564f('0x2f')](db['AnalyticDefaultReport']['rawAttributes']);_0x181492[_0x564f('0x2e')]=_[_0x564f('0x2f')](_0x2f1b3f[_0x564f('0x2e')]);_0x181492['filters']=_[_0x564f('0x32')](_0x181492[_0x564f('0x33')],_0x181492[_0x564f('0x2e')]);_0x1a0d50['attributes']=_[_0x564f('0x32')](_0x181492[_0x564f('0x33')],qs[_0x564f('0x34')](_0x2f1b3f[_0x564f('0x2e')][_0x564f('0x34')]));_0x1a0d50['attributes']=_0x1a0d50[_0x564f('0x31')][_0x564f('0x35')]?_0x1a0d50[_0x564f('0x31')]:_0x181492['model'];if(_0x2f1b3f[_0x564f('0x2e')][_0x564f('0x41')]){_0x1a0d50[_0x564f('0x42')]=[{'all':!![]}];}_0x1a0d50=_[_0x564f('0x3f')]({},_0x1a0d50,_0x2f1b3f['options']);return db[_0x564f('0x2a')][_0x564f('0x45')](_0x1a0d50)[_0x564f('0x21')](handleEntityNotFound(_0x4ce80d,null))[_0x564f('0x21')](respondWithResult(_0x4ce80d,null))[_0x564f('0x46')](handleError(_0x4ce80d,null));};exports['create']=function(_0x430263,_0x1082a1){return db[_0x564f('0x2a')][_0x564f('0x47')](_0x430263[_0x564f('0x48')],{})['then'](function(_0x4f3509){var _0x433492=_0x430263[_0x564f('0x49')][_0x564f('0x4a')]({'plain':!![]});if(!_0x433492)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x433492['role']==='user'){var _0x52078e=_0x4f3509['get']({'plain':!![]});var _0xdc23e8=_0x564f('0x4b');return db['UserProfileSection'][_0x564f('0x45')]({'where':{'name':_0xdc23e8,'userProfileId':_0x433492['userProfileId']},'raw':!![]})[_0x564f('0x21')](function(_0x3fcd49){if(_0x3fcd49&&_0x3fcd49[_0x564f('0x4c')]===0x0){return db['UserProfileResource'][_0x564f('0x47')]({'name':_0x52078e[_0x564f('0x27')],'resourceId':_0x52078e['id'],'type':'DefaultReports','sectionId':_0x3fcd49['id']},{})['then'](function(){return _0x4f3509;});}else{return _0x4f3509;}})['catch'](function(_0x572393){logger['error'](_0x564f('0x4d'),_0x572393);throw _0x572393;});}return _0x4f3509;})[_0x564f('0x21')](respondWithResult(_0x1082a1,0xc9))['catch'](handleError(_0x1082a1,null));};exports['update']=function(_0xf54dc7,_0x5ef4cc){if(_0xf54dc7[_0x564f('0x48')]['id']){delete _0xf54dc7[_0x564f('0x48')]['id'];}return db['AnalyticDefaultReport'][_0x564f('0x45')]({'where':{'id':_0xf54dc7['params']['id']}})[_0x564f('0x21')](handleEntityNotFound(_0x5ef4cc,null))[_0x564f('0x21')](saveUpdates(_0xf54dc7[_0x564f('0x48')],null))[_0x564f('0x21')](respondWithResult(_0x5ef4cc,null))[_0x564f('0x46')](handleError(_0x5ef4cc,null));};exports[_0x564f('0x22')]=function(_0xc3f480,_0x1fa16e){return db[_0x564f('0x2a')][_0x564f('0x45')]({'where':{'id':_0xc3f480[_0x564f('0x4e')]['id']}})['then'](handleEntityNotFound(_0x1fa16e,null))['then'](removeEntity(_0x1fa16e,null))[_0x564f('0x46')](handleError(_0x1fa16e,null));};exports[_0x564f('0x4f')]=function(_0x2a60eb,_0x28ad9d){var _0x2b6039=0xa;var _0x42eaa9=['join',_0x564f('0x50'),'right_join',_0x564f('0x51')];var _0x3ab358={'SUM':_0x564f('0x52'),'COUNT':'COUNT(%s)','COUNT DISTINCT':'COUNT(DISTINCT\x20%s)','MAX':_0x564f('0x53'),'MIN':_0x564f('0x54'),'AVG':_0x564f('0x55'),'GROUP_CONCAT':_0x564f('0x56'),'GROUP_CONCAT ASC':'GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','GROUP_CONCAT DESC':_0x564f('0x57')};var _0x1b9f0f={'SEC_TO_TIME':_0x564f('0x58'),'DATE':'DATE(%s)','HOUR':_0x564f('0x59'),'ROUND':_0x564f('0x5a'),'UNIX_TIMESTAMP':_0x564f('0x5b')};var _0x5e8822=function(_0x28e781){return!_[_0x564f('0x5c')]([_0x564f('0x5d'),_0x564f('0x5e'),_0x564f('0x5f'),_0x564f('0x60')],_0x28e781);};var _0x9a54ed=function(_0x2f5019){if(!_0x2f5019||!_0x2f5019[_0x564f('0x61')][_0x564f('0x35')]){return'';}for(var _0x34b6a8='(',_0x4a339e=0x0;_0x4a339e<_0x2f5019[_0x564f('0x61')][_0x564f('0x35')];_0x4a339e+=0x1){_0x4a339e>0x0&&(_0x34b6a8+='\x20'+_0x2f5019[_0x564f('0x62')]+'\x20');_0x34b6a8+=_0x2f5019['rules'][_0x4a339e]['group']?_0x9a54ed(_0x2f5019[_0x564f('0x61')][_0x4a339e][_0x564f('0x63')]):_0x2f5019['rules'][_0x4a339e][_0x564f('0x64')]+'\x20'+_0x2f5019[_0x564f('0x61')][_0x4a339e][_0x564f('0x65')]+(_0x5e8822(_0x2f5019['rules'][_0x4a339e][_0x564f('0x65')])?'\x20'+_0x2f5019['rules'][_0x4a339e][_0x564f('0x66')]:'');}return _0x34b6a8+')';};var _0x199191={'where':{'id':_0x2a60eb[_0x564f('0x4e')]['id']}},_0x300e37,_0x56b681,_0x3e1d33,_0x2fc0ad,_0x436160;_0x199191=_['merge']({},_0x199191,_0x2a60eb['options']);return db[_0x564f('0x2a')][_0x564f('0x45')](_0x199191)[_0x564f('0x21')](function(_0x3ca0a5){if(_0x3ca0a5){_0x300e37=_0x3ca0a5;return _0x3ca0a5['getFields']();}return null;})['then'](function(_0x2dd657){if(_0x2dd657){if(!_0x2dd657[_0x564f('0x35')]){throw new db[(_0x564f('0x67'))]['ValidationErrorItem'](_0x564f('0x68'),0x193);}_0x56b681=_0x2dd657;return db[_0x564f('0x69')][_0x564f('0x43')]({'raw':!![]});}return null;})[_0x564f('0x21')](function(_0xa1df05){if(_0xa1df05){_0x3e1d33=_[_0x564f('0x6a')](_0xa1df05,'id');var _0xba8163;var _0x49adc9=squel['select']();_0x49adc9['from'](_0x300e37['table']);for(var _0x58deca=0x0;_0x58deca<_0x56b681[_0x564f('0x35')];_0x58deca+=0x1){_0xba8163=_0x56b681[_0x58deca][_0x564f('0x6b')]?_0x3e1d33[_0x56b681[_0x58deca]['MetricId']][_0x564f('0x6c')]:_0x56b681[_0x58deca][_0x564f('0x64')];_0xba8163=_0x56b681[_0x58deca][_0x564f('0x6d')]?_[_0x564f('0x6e')](_0x3ab358[_0x56b681[_0x58deca][_0x564f('0x6d')]],'%s',_0xba8163):_0xba8163;_0xba8163=_0x56b681[_0x58deca]['format']?_[_0x564f('0x6e')](_0x1b9f0f[_0x56b681[_0x58deca][_0x564f('0x6f')]],'%s',_0xba8163):_0xba8163;if(_0x56b681[_0x58deca][_0x564f('0x70')]){_0x49adc9[_0x564f('0x63')](_0xba8163);}_0x56b681[_0x58deca]['orderBy']&&_0x49adc9[_0x564f('0x39')](_0xba8163,_0x56b681[_0x58deca][_0x564f('0x71')]==='DESC'?![]:!![]);_0x49adc9[_0x564f('0x64')](_0xba8163,_0x56b681[_0x58deca][_0x564f('0x72')]||_0xba8163);}if(_0x300e37[_0x564f('0x73')]){_0x300e37[_0x564f('0x73')]=JSON[_0x564f('0x74')](_0x300e37['joins']);for(var _0x49e9a8=0x0;_0x49e9a8<_0x300e37[_0x564f('0x73')][_0x564f('0x35')];_0x49e9a8+=0x1){if(_0x300e37['joins'][_0x49e9a8]['type']&&_[_0x564f('0x5c')](_0x42eaa9,_0x300e37[_0x564f('0x73')][_0x49e9a8][_0x564f('0x3e')])&&_0x300e37[_0x564f('0x73')][_0x49e9a8]['parentKey']&&_0x300e37['joins'][_0x49e9a8]['foreignTable']&&_0x300e37['joins'][_0x49e9a8][_0x564f('0x75')]){_0x49adc9[_0x300e37['joins'][_0x49e9a8]['type']](_0x300e37[_0x564f('0x73')][_0x49e9a8][_0x564f('0x76')],null,util[_0x564f('0x6f')](_0x564f('0x77'),_0x300e37[_0x564f('0x78')],_0x300e37[_0x564f('0x73')][_0x49e9a8][_0x564f('0x79')],_0x300e37[_0x564f('0x73')][_0x49e9a8][_0x564f('0x76')],_0x300e37[_0x564f('0x73')][_0x49e9a8][_0x564f('0x75')]));}}}if(_0x300e37[_0x564f('0x7a')]){_0x300e37['conditions']=JSON[_0x564f('0x74')](_0x300e37[_0x564f('0x7a')]);_0x49adc9[_0x564f('0x3d')](_0x9a54ed(_0x300e37[_0x564f('0x7a')][_0x564f('0x63')]));}_0x436160=_0x49adc9[_0x564f('0x7b')]();_0x49adc9[_0x564f('0x38')](_0x2b6039);_0x49adc9[_0x564f('0x1d')](0x0);logger[_0x564f('0x7c')](_0x564f('0x7d'),_0x49adc9[_0x564f('0x7e')]());return db[_0x564f('0x7f')][_0x564f('0x2e')](_0x49adc9[_0x564f('0x7e')](),{'type':db['sequelize'][_0x564f('0x80')]['SELECT']});}})[_0x564f('0x21')](respondWithResult(_0x28ad9d,null))['catch'](handleError(_0x28ad9d,null));};function runReport(_0x8e5daf,_0x25fa8f,_0x50990a){var _0x78ad5=_0x25fa8f['name'];var _0x4c1fb4=0xa;var _0xa05787=[_0x564f('0x81'),_0x564f('0x50'),_0x564f('0x82'),'cross_join'];var _0x23cda8={'SUM':_0x564f('0x52'),'COUNT':'COUNT(%s)','COUNT DISTINCT':'COUNT(DISTINCT\x20%s)','MAX':_0x564f('0x53'),'MIN':'MIN(%s)','AVG':_0x564f('0x55'),'GROUP_CONCAT':_0x564f('0x56'),'GROUP_CONCAT ASC':'GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','GROUP_CONCAT DESC':_0x564f('0x57')};var _0x49a29b={'SEC_TO_TIME':_0x564f('0x58'),'DATE':'DATE(%s)','HOUR':_0x564f('0x59'),'ROUND':_0x564f('0x5a'),'UNIX_TIMESTAMP':_0x564f('0x5b')};var _0x53db24=function(_0x498bb7){return!_['includes']([_0x564f('0x5d'),_0x564f('0x5e'),_0x564f('0x5f'),'IS\x20NOT\x20EMPTY'],_0x498bb7);};var _0x22bcac=function(_0x3b6a3b){if(!_0x3b6a3b||!_0x3b6a3b['rules'][_0x564f('0x35')]){return'';}for(var _0x5a1e40='(',_0x46dd60=0x0;_0x46dd60<_0x3b6a3b[_0x564f('0x61')]['length'];_0x46dd60+=0x1){_0x46dd60>0x0&&(_0x5a1e40+='\x20'+_0x3b6a3b[_0x564f('0x62')]+'\x20');_0x5a1e40+=_0x3b6a3b[_0x564f('0x61')][_0x46dd60][_0x564f('0x63')]?_0x22bcac(_0x3b6a3b[_0x564f('0x61')][_0x46dd60][_0x564f('0x63')]):_0x3b6a3b[_0x564f('0x61')][_0x46dd60][_0x564f('0x64')]+'\x20'+_0x3b6a3b['rules'][_0x46dd60][_0x564f('0x65')]+(_0x53db24(_0x3b6a3b[_0x564f('0x61')][_0x46dd60][_0x564f('0x65')])?'\x20'+_0x3b6a3b[_0x564f('0x61')][_0x46dd60][_0x564f('0x66')]:'');}return _0x5a1e40+')';};var _0x418f02={'where':{'id':_0x8e5daf['id']}},_0x238a85,_0x34bf5a,_0x1b25f,_0x44fdfd,_0x1f0263;_0x418f02=_[_0x564f('0x3f')]({},_0x418f02,_0x50990a);return db[_0x564f('0x2a')][_0x564f('0x45')](_0x418f02)[_0x564f('0x21')](function(_0xfc3846){if(_0xfc3846){_0x238a85=_0xfc3846;return _0xfc3846[_0x564f('0x83')]();}return null;})[_0x564f('0x21')](function(_0xbc7166){if(_0xbc7166){if(!_0xbc7166[_0x564f('0x35')]){throw new db[(_0x564f('0x67'))][(_0x564f('0x84'))](_0x564f('0x68'),0x193);}_0x34bf5a=_0xbc7166;return db[_0x564f('0x69')]['findAll']({'raw':!![]});}return null;})[_0x564f('0x21')](function(_0x181347){if(_0x181347){_0x1b25f=_[_0x564f('0x6a')](_0x181347,'id');var _0x475c19;var _0x3f7fa5=squel[_0x564f('0x85')]();_0x3f7fa5[_0x564f('0x86')](_0x238a85[_0x564f('0x78')]);for(var _0x67266f=0x0;_0x67266f<_0x34bf5a[_0x564f('0x35')];_0x67266f+=0x1){_0x475c19=_0x34bf5a[_0x67266f]['MetricId']?_0x1b25f[_0x34bf5a[_0x67266f][_0x564f('0x6b')]]['metric']:_0x34bf5a[_0x67266f][_0x564f('0x64')];_0x475c19=_0x34bf5a[_0x67266f][_0x564f('0x6d')]?_['replace'](_0x23cda8[_0x34bf5a[_0x67266f][_0x564f('0x6d')]],'%s',_0x475c19):_0x475c19;_0x475c19=_0x34bf5a[_0x67266f]['format']?_[_0x564f('0x6e')](_0x49a29b[_0x34bf5a[_0x67266f][_0x564f('0x6f')]],'%s',_0x475c19):_0x475c19;if(_0x34bf5a[_0x67266f][_0x564f('0x70')]){_0x3f7fa5[_0x564f('0x63')](_0x475c19);}_0x34bf5a[_0x67266f][_0x564f('0x71')]&&_0x3f7fa5['order'](_0x475c19,_0x34bf5a[_0x67266f][_0x564f('0x71')]===_0x564f('0x87')?![]:!![]);_0x3f7fa5[_0x564f('0x64')](_0x475c19,_0x34bf5a[_0x67266f]['alias']||_0x475c19);}if(_0x238a85['joins']){_0x238a85[_0x564f('0x73')]=JSON[_0x564f('0x74')](_0x238a85['joins']);for(var _0x51b2b1=0x0;_0x51b2b1<_0x238a85[_0x564f('0x73')][_0x564f('0x35')];_0x51b2b1+=0x1){if(_0x238a85[_0x564f('0x73')][_0x51b2b1][_0x564f('0x3e')]&&_[_0x564f('0x5c')](_0xa05787,_0x238a85[_0x564f('0x73')][_0x51b2b1][_0x564f('0x3e')])&&_0x238a85[_0x564f('0x73')][_0x51b2b1][_0x564f('0x79')]&&_0x238a85['joins'][_0x51b2b1]['foreignTable']&&_0x238a85['joins'][_0x51b2b1][_0x564f('0x75')]){_0x3f7fa5[_0x238a85[_0x564f('0x73')][_0x51b2b1][_0x564f('0x3e')]](_0x238a85[_0x564f('0x73')][_0x51b2b1]['foreignTable'],null,util['format'](_0x564f('0x77'),_0x238a85[_0x564f('0x78')],_0x238a85['joins'][_0x51b2b1][_0x564f('0x79')],_0x238a85[_0x564f('0x73')][_0x51b2b1][_0x564f('0x76')],_0x238a85[_0x564f('0x73')][_0x51b2b1][_0x564f('0x75')]));}}}if(_0x238a85[_0x564f('0x7a')]){_0x238a85[_0x564f('0x7a')]=JSON[_0x564f('0x74')](_0x238a85[_0x564f('0x7a')]);_0x3f7fa5[_0x564f('0x3d')](_0x22bcac(_0x238a85[_0x564f('0x7a')][_0x564f('0x63')]));}_0x1f0263=_0x3f7fa5['clone']();_0x3f7fa5['limit'](_0x4c1fb4);_0x3f7fa5[_0x564f('0x1d')](0x0);logger[_0x564f('0x7c')](_0x564f('0x7d'),_0x3f7fa5['toString']());return db[_0x564f('0x7f')]['query'](_0x3f7fa5[_0x564f('0x7e')](),{'type':db[_0x564f('0x7f')][_0x564f('0x80')]['SELECT']});}})[_0x564f('0x21')](function(_0x483ca5){if(!_0x483ca5[_0x564f('0x35')]){throw new db['Sequelize'][(_0x564f('0x84'))](_0x564f('0x88'),0xcc);}if(_0x25fa8f[_0x564f('0x89')]===_0x564f('0x8a')){return null;}var _0x437a2c=_[_0x564f('0x3f')](_0x25fa8f,{'name':_0x25fa8f[_0x564f('0x8b')]||_0x25fa8f[_0x564f('0x27')]||_0x238a85[_0x564f('0x27')],'basename':_0x78ad5,'savename':util[_0x564f('0x6f')](_0x564f('0x8c'),_0x25fa8f['name']||_0x238a85[_0x564f('0x27')],require(_0x564f('0x8d'))[_0x564f('0x8e')](0x4),_0x25fa8f['output']||_0x564f('0x8f')),'reportId':_0x238a85['id'],'reportType':_0x564f('0x90')});return db[_0x564f('0x91')][_0x564f('0x47')](_0x437a2c,{'raw':!![]});})[_0x564f('0x21')](function(_0x26b90b){if(_0x238a85[_0x564f('0x78')]==='cdr'){_0x1f0263[_0x564f('0x3d')](_0x238a85[_0x564f('0x78')]+_0x564f('0x92'),_0x25fa8f['startDate'],_0x25fa8f[_0x564f('0x93')]);}else{_0x1f0263[_0x564f('0x3d')](_0x238a85[_0x564f('0x78')]+_0x564f('0x94'),_0x25fa8f['startDate'],_0x25fa8f['endDate']);}if(_0x26b90b){logger[_0x564f('0x95')](_0x564f('0x96'),_0x1f0263[_0x564f('0x7e')]());require(_0x564f('0x97'))[_0x564f('0x98')](path[_0x564f('0x81')](__dirname,'../../components/export/',_0x26b90b[_0x564f('0x89')]),[_0x26b90b['id'],_0x1f0263[_0x564f('0x7e')](),path[_0x564f('0x81')](__dirname,_0x564f('0x99'),_0x26b90b[_0x564f('0x9a')]),_0x78ad5]);return _0x26b90b;}else{var _0x2d7225=squel[_0x564f('0x85')]();_0x2d7225['from']('('+_0x1f0263[_0x564f('0x7e')]()+')',_0x564f('0x9b'));_0x2d7225[_0x564f('0x64')](_0x564f('0x9c'),'count');_0x1f0263['limit'](_0x25fa8f['limit']||_0x4c1fb4);_0x1f0263['offset'](_0x25fa8f[_0x564f('0x1d')]||0x0);return db[_0x564f('0x7f')][_0x564f('0x2e')](_0x2d7225[_0x564f('0x7e')](),{'type':db['sequelize'][_0x564f('0x80')]['SELECT']})[_0x564f('0x21')](function(_0x81ff00){if(!_0x81ff00['length']){_0x44fdfd=0x0;}else{_0x44fdfd=_0x81ff00[0x0][_0x564f('0x1c')]||0x0;}return db[_0x564f('0x7f')]['query'](_0x1f0263['toString'](),{'type':db[_0x564f('0x7f')][_0x564f('0x80')][_0x564f('0x9d')]});})['then'](function(_0x5dabab){return{'rows':_0x5dabab||[],'count':_0x44fdfd};});}});}exports[_0x564f('0x9e')]=function(_0x5e6fc5,_0x4d23ee){return runReport(_0x5e6fc5[_0x564f('0x4e')],_0x5e6fc5[_0x564f('0x2e')],_0x5e6fc5[_0x564f('0x40')])[_0x564f('0x21')](respondWithResult(_0x4d23ee,null))[_0x564f('0x46')](handleError(_0x4d23ee,null));};exports[_0x564f('0x9f')]=runReport;exports[_0x564f('0x2e')]=function(_0x4e71ae,_0x56b9ce){var _0x1d6299=0xa;var _0x1d1d31=[_0x564f('0x81'),'left_join',_0x564f('0x82'),'cross_join'];var _0x4639c7={'SUM':_0x564f('0x52'),'COUNT':_0x564f('0xa0'),'COUNT DISTINCT':_0x564f('0xa1'),'MAX':_0x564f('0x53'),'MIN':_0x564f('0x54'),'AVG':_0x564f('0x55'),'GROUP_CONCAT':_0x564f('0x56'),'GROUP_CONCAT ASC':_0x564f('0xa2'),'GROUP_CONCAT DESC':_0x564f('0x57')};var _0x3cdfd5={'SEC_TO_TIME':'SEC_TO_TIME(%s)','DATE':'DATE(%s)','HOUR':'HOUR(%s)','ROUND':_0x564f('0x5a'),'UNIX_TIMESTAMP':_0x564f('0x5b')};var _0x533fd9=function(_0x387a03){return!_[_0x564f('0x5c')]([_0x564f('0x5d'),'IS\x20NOT\x20NULL',_0x564f('0x5f'),'IS\x20NOT\x20EMPTY'],_0x387a03);};var _0x56e116=function(_0x14f6f2){if(!_0x14f6f2||!_0x14f6f2[_0x564f('0x61')][_0x564f('0x35')]){return'';}for(var _0x56e00d='(',_0x36e218=0x0;_0x36e218<_0x14f6f2['rules'][_0x564f('0x35')];_0x36e218+=0x1){_0x36e218>0x0&&(_0x56e00d+='\x20'+_0x14f6f2[_0x564f('0x62')]+'\x20');_0x56e00d+=_0x14f6f2['rules'][_0x36e218]['group']?_0x56e116(_0x14f6f2[_0x564f('0x61')][_0x36e218][_0x564f('0x63')]):_0x14f6f2[_0x564f('0x61')][_0x36e218][_0x564f('0x64')]+'\x20'+_0x14f6f2[_0x564f('0x61')][_0x36e218][_0x564f('0x65')]+(_0x533fd9(_0x14f6f2[_0x564f('0x61')][_0x36e218]['condition'])?'\x20'+_0x14f6f2[_0x564f('0x61')][_0x36e218]['value']:'');}return _0x56e00d+')';};var _0x3284d2={'where':{'id':_0x4e71ae[_0x564f('0x4e')]['id']}},_0x6ed718,_0x28c561,_0x453c0a,_0x40ddd6,_0x260c73;_0x3284d2=_['merge']({},_0x3284d2,_0x4e71ae['options']);return db[_0x564f('0x2a')][_0x564f('0x45')](_0x3284d2)[_0x564f('0x21')](function(_0x549187){if(_0x549187){_0x6ed718=_0x549187;return _0x549187['getFields']();}return null;})[_0x564f('0x21')](function(_0x5677a5){if(_0x5677a5){if(!_0x5677a5[_0x564f('0x35')]){throw new db[(_0x564f('0x67'))][(_0x564f('0x84'))](_0x564f('0x68'),0x193);}_0x28c561=_0x5677a5;return db[_0x564f('0x69')][_0x564f('0x43')]({'raw':!![]});}return null;})[_0x564f('0x21')](function(_0x264d9b){if(_0x264d9b){_0x453c0a=_[_0x564f('0x6a')](_0x264d9b,'id');var _0x5c3bad;var _0x438ee2=squel[_0x564f('0x85')]();_0x438ee2[_0x564f('0x86')](_0x6ed718[_0x564f('0x78')]);for(var _0x4862dd=0x0;_0x4862dd<_0x28c561[_0x564f('0x35')];_0x4862dd+=0x1){_0x5c3bad=_0x28c561[_0x4862dd][_0x564f('0x6b')]?_0x453c0a[_0x28c561[_0x4862dd][_0x564f('0x6b')]][_0x564f('0x6c')]:_0x28c561[_0x4862dd][_0x564f('0x64')];_0x5c3bad=_0x28c561[_0x4862dd]['function']?_[_0x564f('0x6e')](_0x4639c7[_0x28c561[_0x4862dd][_0x564f('0x6d')]],'%s',_0x5c3bad):_0x5c3bad;_0x5c3bad=_0x28c561[_0x4862dd][_0x564f('0x6f')]?_[_0x564f('0x6e')](_0x3cdfd5[_0x28c561[_0x4862dd]['format']],'%s',_0x5c3bad):_0x5c3bad;if(_0x28c561[_0x4862dd]['groupBy']){_0x438ee2['group'](_0x5c3bad);}_0x28c561[_0x4862dd][_0x564f('0x71')]&&_0x438ee2[_0x564f('0x39')](_0x5c3bad,_0x28c561[_0x4862dd][_0x564f('0x71')]===_0x564f('0x87')?![]:!![]);_0x438ee2[_0x564f('0x64')](_0x5c3bad,_0x28c561[_0x4862dd][_0x564f('0x72')]||_0x5c3bad);}if(_0x6ed718[_0x564f('0x73')]){_0x6ed718[_0x564f('0x73')]=JSON[_0x564f('0x74')](_0x6ed718['joins']);for(var _0x51a42d=0x0;_0x51a42d<_0x6ed718[_0x564f('0x73')]['length'];_0x51a42d+=0x1){if(_0x6ed718['joins'][_0x51a42d][_0x564f('0x3e')]&&_['includes'](_0x1d1d31,_0x6ed718[_0x564f('0x73')][_0x51a42d][_0x564f('0x3e')])&&_0x6ed718[_0x564f('0x73')][_0x51a42d][_0x564f('0x79')]&&_0x6ed718['joins'][_0x51a42d][_0x564f('0x76')]&&_0x6ed718[_0x564f('0x73')][_0x51a42d]['foreignKey']){_0x438ee2[_0x6ed718['joins'][_0x51a42d][_0x564f('0x3e')]](_0x6ed718[_0x564f('0x73')][_0x51a42d][_0x564f('0x76')],null,util[_0x564f('0x6f')](_0x564f('0x77'),_0x6ed718[_0x564f('0x78')],_0x6ed718[_0x564f('0x73')][_0x51a42d][_0x564f('0x79')],_0x6ed718[_0x564f('0x73')][_0x51a42d][_0x564f('0x76')],_0x6ed718[_0x564f('0x73')][_0x51a42d][_0x564f('0x75')]));}}}if(_0x6ed718[_0x564f('0x7a')]){_0x6ed718[_0x564f('0x7a')]=JSON[_0x564f('0x74')](_0x6ed718[_0x564f('0x7a')]);_0x438ee2[_0x564f('0x3d')](_0x56e116(_0x6ed718[_0x564f('0x7a')]['group']));}_0x260c73=_0x438ee2[_0x564f('0x7b')]();_0x438ee2[_0x564f('0x38')](_0x1d6299);_0x438ee2[_0x564f('0x1d')](0x0);logger['debug'](_0x564f('0x7d'),_0x438ee2[_0x564f('0x7e')]());return db[_0x564f('0x7f')][_0x564f('0x2e')](_0x438ee2[_0x564f('0x7e')](),{'type':db[_0x564f('0x7f')][_0x564f('0x80')][_0x564f('0x9d')]});}})[_0x564f('0x21')](function(){return{'sql':_0x260c73[_0x564f('0x7e')]()};})[_0x564f('0x21')](respondWithResult(_0x56b9ce,null))[_0x564f('0x46')](handleError(_0x56b9ce,null));}; \ No newline at end of file +var _0xafa4=['../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','offset','limit','set','Content-Range','json','apply','reject','save','update','then','destroy','get','DefaultReports','UserProfileResource','error','stack','name','send','index','map','AnalyticDefaultReport','rawAttributes','fieldName','type','query','keys','filters','intersection','model','attributes','fields','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','count','includeAll','include','findAll','rows','catch','length','options','create','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','Reports','UserProfileSection','find','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','preview','join','left_join','right_join','cross_join','COUNT(%s)','MAX(%s)','MIN(%s)','AVG(%s)','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20DESC)','DATE(%s)','UNIX_TIMESTAMP(%s)','IS\x20NOT\x20NULL','IS\x20EMPTY','IS\x20NOT\x20EMPTY','rules','group','field','condition','value','params','getFields','Sequelize','Please\x20insert\x20at\x20least\x20one\x20field','keyBy','select','from','MetricId','function','replace','format','orderBy','DESC','alias','joins','parse','parentKey','foreignKey','foreignTable','%s.%s\x20=\x20%s.%s','table','conditions','clone','debug','Limited\x20Query:','toString','sequelize','QueryTypes','SELECT','SUM(%s)','COUNT(DISTINCT\x20%s)','GROUP_CONCAT(%s)','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','SEC_TO_TIME(%s)','HOUR(%s)','ROUND(%s)','includes','operator','ValidationErrorItem','AnalyticMetric','metric','No\x20available\x20data','fullPath','generate','csv','default','AnalyticExtractedReport','cdr','.calldate\x20BETWEEN\x20?\x20AND\x20?','startDate','endDate','.createdAt\x20BETWEEN\x20?\x20AND\x20?','Run\x20Query:','fork','../../components/export/','output','savename','countTable','COUNT(*)','run','IS\x20NULL','groupBy','html-pdf','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','to-csv','lodash','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xafa4,0x13a));var _0x4afa=function(_0x5bd220,_0x33a521){_0x5bd220=_0x5bd220-0x0;var _0x3d799c=_0xafa4[_0x5bd220];return _0x3d799c;};'use strict';var pdf=require(_0x4afa('0x0'));var emlformat=require('eml-format');var rimraf=require(_0x4afa('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x4afa('0x2'));var rp=require(_0x4afa('0x3'));var moment=require(_0x4afa('0x4'));var BPromise=require(_0x4afa('0x5'));var Mustache=require(_0x4afa('0x6'));var util=require(_0x4afa('0x7'));var path=require('path');var sox=require(_0x4afa('0x8'));var csv=require(_0x4afa('0x9'));var ejs=require('ejs');var fs=require('fs');var _=require(_0x4afa('0xa'));var squel=require('squel');var crypto=require(_0x4afa('0xb'));var jsforce=require(_0x4afa('0xc'));var deskjs=require(_0x4afa('0xd'));var toCsv=require(_0x4afa('0x9'));var querystring=require(_0x4afa('0xe'));var Papa=require(_0x4afa('0xf'));var Redis=require('ioredis');var authService=require(_0x4afa('0x10'));var qs=require(_0x4afa('0x11'));var as=require(_0x4afa('0x12'));var hardwareService=require(_0x4afa('0x13'));var logger=require(_0x4afa('0x14'))('api');var utils=require(_0x4afa('0x15'));var config=require(_0x4afa('0x16'));var db=require(_0x4afa('0x17'))['db'];function respondWithStatusCode(_0x583012,_0x6ec24){_0x6ec24=_0x6ec24||0xcc;return function(_0x71b33f){if(_0x71b33f){return _0x583012[_0x4afa('0x18')](_0x6ec24);}return _0x583012[_0x4afa('0x19')](_0x6ec24)[_0x4afa('0x1a')]();};}function respondWithResult(_0x118d55,_0x25e46d){_0x25e46d=_0x25e46d||0xc8;return function(_0x3dd49b){if(_0x3dd49b){return _0x118d55['status'](_0x25e46d)['json'](_0x3dd49b);}};}function respondWithFilteredResult(_0x50b6c3,_0x49a529){return function(_0x16c2e1){if(_0x16c2e1){var _0xeef695=_0x16c2e1['count'],_0x12b245=_0x49a529[_0x4afa('0x1b')],_0x19d85a=_0x49a529['offset']+_0x49a529[_0x4afa('0x1c')],_0x5f515f;if(_0x19d85a>=_0xeef695){_0x19d85a=_0xeef695;_0x5f515f=0xc8;}else{_0x5f515f=0xce;}_0x50b6c3['status'](_0x5f515f);return _0x50b6c3[_0x4afa('0x1d')](_0x4afa('0x1e'),_0x12b245+'-'+_0x19d85a+'/'+_0xeef695)[_0x4afa('0x1f')](_0x16c2e1);}return null;};}function patchUpdates(_0x2223b0){return function(_0x1036ca){try{jsonpatch[_0x4afa('0x20')](_0x1036ca,_0x2223b0,!![]);}catch(_0x1342c8){return BPromise[_0x4afa('0x21')](_0x1342c8);}return _0x1036ca[_0x4afa('0x22')]();};}function saveUpdates(_0x672ff9,_0x1b32a4){return function(_0xde86e0){if(_0xde86e0){return _0xde86e0[_0x4afa('0x23')](_0x672ff9)[_0x4afa('0x24')](function(_0x1469f1){return _0x1469f1;});}return null;};}function removeEntity(_0x57684a,_0x1303e1){return function(_0x4c3c04){if(_0x4c3c04){return _0x4c3c04[_0x4afa('0x25')]()[_0x4afa('0x24')](function(){var _0x28e9cf=_0x4c3c04[_0x4afa('0x26')]({'plain':!![]});var _0x3d74cb=_0x4afa('0x27');return db[_0x4afa('0x28')][_0x4afa('0x25')]({'where':{'type':_0x3d74cb,'resourceId':_0x28e9cf['id']}})['then'](function(){return _0x4c3c04;});})['then'](function(){_0x57684a[_0x4afa('0x19')](0xcc)[_0x4afa('0x1a')]();});}};}function handleEntityNotFound(_0x14a3af,_0x25acf1){return function(_0xc4977b){if(!_0xc4977b){_0x14a3af[_0x4afa('0x18')](0x194);}return _0xc4977b;};}function handleError(_0x1073da,_0x107a1b){_0x107a1b=_0x107a1b||0x1f4;return function(_0xd34eb4){logger[_0x4afa('0x29')](_0xd34eb4[_0x4afa('0x2a')]);if(_0xd34eb4[_0x4afa('0x2b')]){delete _0xd34eb4[_0x4afa('0x2b')];}_0x1073da['status'](_0x107a1b)[_0x4afa('0x2c')](_0xd34eb4);};}exports[_0x4afa('0x2d')]=function(_0x772325,_0x2f7231){var _0x23b155={},_0x335215={},_0x4a5c44={'count':0x0,'rows':[]};var _0x32c740=_[_0x4afa('0x2e')](db[_0x4afa('0x2f')][_0x4afa('0x30')],function(_0x214fc2){return{'name':_0x214fc2[_0x4afa('0x31')],'type':_0x214fc2[_0x4afa('0x32')]['key']};});_0x335215['model']=_[_0x4afa('0x2e')](_0x32c740,_0x4afa('0x2b'));_0x335215[_0x4afa('0x33')]=_[_0x4afa('0x34')](_0x772325['query']);_0x335215[_0x4afa('0x35')]=_[_0x4afa('0x36')](_0x335215[_0x4afa('0x37')],_0x335215[_0x4afa('0x33')]);_0x23b155[_0x4afa('0x38')]=_[_0x4afa('0x36')](_0x335215[_0x4afa('0x37')],qs[_0x4afa('0x39')](_0x772325[_0x4afa('0x33')][_0x4afa('0x39')]));_0x23b155[_0x4afa('0x38')]=_0x23b155[_0x4afa('0x38')]['length']?_0x23b155[_0x4afa('0x38')]:_0x335215[_0x4afa('0x37')];if(!_0x772325['query']['hasOwnProperty'](_0x4afa('0x3a'))){_0x23b155[_0x4afa('0x1c')]=qs[_0x4afa('0x1c')](_0x772325['query']['limit']);_0x23b155['offset']=qs[_0x4afa('0x1b')](_0x772325[_0x4afa('0x33')]['offset']);}_0x23b155[_0x4afa('0x3b')]=qs[_0x4afa('0x3c')](_0x772325['query']['sort']);_0x23b155[_0x4afa('0x3d')]=qs[_0x4afa('0x35')](_[_0x4afa('0x3e')](_0x772325[_0x4afa('0x33')],_0x335215[_0x4afa('0x35')]));if(_0x772325[_0x4afa('0x33')][_0x4afa('0x3f')]){_0x23b155['where']=_[_0x4afa('0x40')](_0x23b155[_0x4afa('0x3d')],{'$or':_[_0x4afa('0x2e')](_0x32c740,function(_0x5c25ff){if(_0x5c25ff['type']!==_0x4afa('0x41')){var _0x183d5e={};_0x183d5e[_0x5c25ff[_0x4afa('0x2b')]]={'$like':'%'+_0x772325[_0x4afa('0x33')][_0x4afa('0x3f')]+'%'};return _0x183d5e;}})});}_0x23b155=_[_0x4afa('0x40')]({},_0x23b155,_0x772325['options']);var _0x151d85={'where':_0x23b155['where']};return db['AnalyticDefaultReport'][_0x4afa('0x42')](_0x151d85)[_0x4afa('0x24')](function(_0x44736d){_0x4a5c44[_0x4afa('0x42')]=_0x44736d;if(_0x772325[_0x4afa('0x33')][_0x4afa('0x43')]){_0x23b155[_0x4afa('0x44')]=[{'all':!![]}];}return db['AnalyticDefaultReport'][_0x4afa('0x45')](_0x23b155);})[_0x4afa('0x24')](function(_0x494372){_0x4a5c44[_0x4afa('0x46')]=_0x494372;return _0x4a5c44;})[_0x4afa('0x24')](respondWithFilteredResult(_0x2f7231,_0x23b155))[_0x4afa('0x47')](handleError(_0x2f7231,null));};exports['show']=function(_0x24d340,_0x3f853d){var _0x322d86={'raw':!![],'where':{'id':_0x24d340['params']['id']}},_0x442cff={};_0x442cff[_0x4afa('0x37')]=_['keys'](db[_0x4afa('0x2f')][_0x4afa('0x30')]);_0x442cff[_0x4afa('0x33')]=_['keys'](_0x24d340[_0x4afa('0x33')]);_0x442cff['filters']=_[_0x4afa('0x36')](_0x442cff[_0x4afa('0x37')],_0x442cff[_0x4afa('0x33')]);_0x322d86[_0x4afa('0x38')]=_['intersection'](_0x442cff[_0x4afa('0x37')],qs[_0x4afa('0x39')](_0x24d340[_0x4afa('0x33')][_0x4afa('0x39')]));_0x322d86[_0x4afa('0x38')]=_0x322d86['attributes'][_0x4afa('0x48')]?_0x322d86[_0x4afa('0x38')]:_0x442cff[_0x4afa('0x37')];if(_0x24d340[_0x4afa('0x33')]['includeAll']){_0x322d86['include']=[{'all':!![]}];}_0x322d86=_[_0x4afa('0x40')]({},_0x322d86,_0x24d340[_0x4afa('0x49')]);return db[_0x4afa('0x2f')]['find'](_0x322d86)[_0x4afa('0x24')](handleEntityNotFound(_0x3f853d,null))[_0x4afa('0x24')](respondWithResult(_0x3f853d,null))['catch'](handleError(_0x3f853d,null));};exports[_0x4afa('0x4a')]=function(_0x884f64,_0x5cf7d8){return db[_0x4afa('0x2f')][_0x4afa('0x4a')](_0x884f64['body'],{})[_0x4afa('0x24')](function(_0x450715){var _0x4261e3=_0x884f64['user'][_0x4afa('0x26')]({'plain':!![]});if(!_0x4261e3)throw new Error(_0x4afa('0x4b'));if(_0x4261e3[_0x4afa('0x4c')]===_0x4afa('0x4d')){var _0x3c3282=_0x450715[_0x4afa('0x26')]({'plain':!![]});var _0x8c6616=_0x4afa('0x4e');return db[_0x4afa('0x4f')][_0x4afa('0x50')]({'where':{'name':_0x8c6616,'userProfileId':_0x4261e3[_0x4afa('0x51')]},'raw':!![]})[_0x4afa('0x24')](function(_0x516aaa){if(_0x516aaa&&_0x516aaa['autoAssociation']===0x0){return db[_0x4afa('0x28')][_0x4afa('0x4a')]({'name':_0x3c3282[_0x4afa('0x2b')],'resourceId':_0x3c3282['id'],'type':'DefaultReports','sectionId':_0x516aaa['id']},{})[_0x4afa('0x24')](function(){return _0x450715;});}else{return _0x450715;}})[_0x4afa('0x47')](function(_0x40bf7c){logger[_0x4afa('0x29')](_0x4afa('0x52'),_0x40bf7c);throw _0x40bf7c;});}return _0x450715;})['then'](respondWithResult(_0x5cf7d8,0xc9))[_0x4afa('0x47')](handleError(_0x5cf7d8,null));};exports['update']=function(_0x2235d4,_0x12d0da){if(_0x2235d4[_0x4afa('0x53')]['id']){delete _0x2235d4['body']['id'];}return db['AnalyticDefaultReport'][_0x4afa('0x50')]({'where':{'id':_0x2235d4['params']['id']}})[_0x4afa('0x24')](handleEntityNotFound(_0x12d0da,null))['then'](saveUpdates(_0x2235d4[_0x4afa('0x53')],null))['then'](respondWithResult(_0x12d0da,null))[_0x4afa('0x47')](handleError(_0x12d0da,null));};exports[_0x4afa('0x25')]=function(_0x39b9f8,_0x56cdcf){return db[_0x4afa('0x2f')][_0x4afa('0x50')]({'where':{'id':_0x39b9f8['params']['id']}})[_0x4afa('0x24')](handleEntityNotFound(_0x56cdcf,null))[_0x4afa('0x24')](removeEntity(_0x56cdcf,null))[_0x4afa('0x47')](handleError(_0x56cdcf,null));};exports[_0x4afa('0x54')]=function(_0x5563b8,_0x48e8d1){var _0x29a8c8=0xa;var _0x3d37ad=[_0x4afa('0x55'),_0x4afa('0x56'),_0x4afa('0x57'),_0x4afa('0x58')];var _0x467dda={'SUM':'SUM(%s)','COUNT':_0x4afa('0x59'),'COUNT DISTINCT':'COUNT(DISTINCT\x20%s)','MAX':_0x4afa('0x5a'),'MIN':_0x4afa('0x5b'),'AVG':_0x4afa('0x5c'),'GROUP_CONCAT':'GROUP_CONCAT(%s)','GROUP_CONCAT ASC':'GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','GROUP_CONCAT DESC':_0x4afa('0x5d')};var _0x467192={'SEC_TO_TIME':'SEC_TO_TIME(%s)','DATE':_0x4afa('0x5e'),'HOUR':'HOUR(%s)','ROUND':'ROUND(%s)','UNIX_TIMESTAMP':_0x4afa('0x5f')};var _0x10c53e=function(_0x262e44){return!_['includes'](['IS\x20NULL',_0x4afa('0x60'),_0x4afa('0x61'),_0x4afa('0x62')],_0x262e44);};var _0x147b51=function(_0x6590f4){if(!_0x6590f4||!_0x6590f4['rules'][_0x4afa('0x48')]){return'';}for(var _0x4a757d='(',_0x456d74=0x0;_0x456d74<_0x6590f4[_0x4afa('0x63')][_0x4afa('0x48')];_0x456d74+=0x1){_0x456d74>0x0&&(_0x4a757d+='\x20'+_0x6590f4['operator']+'\x20');_0x4a757d+=_0x6590f4[_0x4afa('0x63')][_0x456d74][_0x4afa('0x64')]?_0x147b51(_0x6590f4[_0x4afa('0x63')][_0x456d74][_0x4afa('0x64')]):_0x6590f4['rules'][_0x456d74][_0x4afa('0x65')]+'\x20'+_0x6590f4[_0x4afa('0x63')][_0x456d74][_0x4afa('0x66')]+(_0x10c53e(_0x6590f4[_0x4afa('0x63')][_0x456d74][_0x4afa('0x66')])?'\x20'+_0x6590f4[_0x4afa('0x63')][_0x456d74][_0x4afa('0x67')]:'');}return _0x4a757d+')';};var _0x520adb={'where':{'id':_0x5563b8[_0x4afa('0x68')]['id']}},_0x48d4b4,_0x52ea78,_0x429d20,_0x55de0d,_0x25f9e4;_0x520adb=_['merge']({},_0x520adb,_0x5563b8[_0x4afa('0x49')]);return db['AnalyticDefaultReport'][_0x4afa('0x50')](_0x520adb)[_0x4afa('0x24')](function(_0x3666f4){if(_0x3666f4){_0x48d4b4=_0x3666f4;return _0x3666f4[_0x4afa('0x69')]();}return null;})[_0x4afa('0x24')](function(_0x2f978b){if(_0x2f978b){if(!_0x2f978b['length']){throw new db[(_0x4afa('0x6a'))]['ValidationErrorItem'](_0x4afa('0x6b'),0x193);}_0x52ea78=_0x2f978b;return db['AnalyticMetric']['findAll']({'raw':!![]});}return null;})[_0x4afa('0x24')](function(_0x36577d){if(_0x36577d){_0x429d20=_[_0x4afa('0x6c')](_0x36577d,'id');var _0x17b0cd;var _0x2c9190=squel[_0x4afa('0x6d')]();_0x2c9190[_0x4afa('0x6e')](_0x48d4b4['table']);for(var _0x1df71c=0x0;_0x1df71c<_0x52ea78[_0x4afa('0x48')];_0x1df71c+=0x1){_0x17b0cd=_0x52ea78[_0x1df71c][_0x4afa('0x6f')]?_0x429d20[_0x52ea78[_0x1df71c][_0x4afa('0x6f')]]['metric']:_0x52ea78[_0x1df71c][_0x4afa('0x65')];_0x17b0cd=_0x52ea78[_0x1df71c][_0x4afa('0x70')]?_[_0x4afa('0x71')](_0x467dda[_0x52ea78[_0x1df71c]['function']],'%s',_0x17b0cd):_0x17b0cd;_0x17b0cd=_0x52ea78[_0x1df71c][_0x4afa('0x72')]?_[_0x4afa('0x71')](_0x467192[_0x52ea78[_0x1df71c][_0x4afa('0x72')]],'%s',_0x17b0cd):_0x17b0cd;if(_0x52ea78[_0x1df71c]['groupBy']){_0x2c9190['group'](_0x17b0cd);}_0x52ea78[_0x1df71c]['orderBy']&&_0x2c9190[_0x4afa('0x3b')](_0x17b0cd,_0x52ea78[_0x1df71c][_0x4afa('0x73')]===_0x4afa('0x74')?![]:!![]);_0x2c9190[_0x4afa('0x65')](_0x17b0cd,_0x52ea78[_0x1df71c][_0x4afa('0x75')]||_0x17b0cd);}if(_0x48d4b4['joins']){_0x48d4b4[_0x4afa('0x76')]=JSON[_0x4afa('0x77')](_0x48d4b4[_0x4afa('0x76')]);for(var _0x1d3452=0x0;_0x1d3452<_0x48d4b4[_0x4afa('0x76')][_0x4afa('0x48')];_0x1d3452+=0x1){if(_0x48d4b4['joins'][_0x1d3452][_0x4afa('0x32')]&&_['includes'](_0x3d37ad,_0x48d4b4['joins'][_0x1d3452][_0x4afa('0x32')])&&_0x48d4b4[_0x4afa('0x76')][_0x1d3452][_0x4afa('0x78')]&&_0x48d4b4[_0x4afa('0x76')][_0x1d3452]['foreignTable']&&_0x48d4b4[_0x4afa('0x76')][_0x1d3452][_0x4afa('0x79')]){_0x2c9190[_0x48d4b4[_0x4afa('0x76')][_0x1d3452]['type']](_0x48d4b4['joins'][_0x1d3452][_0x4afa('0x7a')],null,util['format'](_0x4afa('0x7b'),_0x48d4b4[_0x4afa('0x7c')],_0x48d4b4['joins'][_0x1d3452]['parentKey'],_0x48d4b4[_0x4afa('0x76')][_0x1d3452]['foreignTable'],_0x48d4b4[_0x4afa('0x76')][_0x1d3452]['foreignKey']));}}}if(_0x48d4b4[_0x4afa('0x7d')]){_0x48d4b4['conditions']=JSON[_0x4afa('0x77')](_0x48d4b4['conditions']);_0x2c9190[_0x4afa('0x3d')](_0x147b51(_0x48d4b4[_0x4afa('0x7d')][_0x4afa('0x64')]));}_0x25f9e4=_0x2c9190[_0x4afa('0x7e')]();_0x2c9190[_0x4afa('0x1c')](_0x29a8c8);_0x2c9190[_0x4afa('0x1b')](0x0);logger[_0x4afa('0x7f')](_0x4afa('0x80'),_0x2c9190[_0x4afa('0x81')]());return db[_0x4afa('0x82')]['query'](_0x2c9190[_0x4afa('0x81')](),{'type':db[_0x4afa('0x82')][_0x4afa('0x83')][_0x4afa('0x84')]});}})[_0x4afa('0x24')](respondWithResult(_0x48e8d1,null))[_0x4afa('0x47')](handleError(_0x48e8d1,null));};function runReport(_0x5cd73b,_0x3857ee,_0x308477){var _0x53719c=_0x3857ee[_0x4afa('0x2b')];var _0x3a520a=0xa;var _0x5cdcdf=[_0x4afa('0x55'),_0x4afa('0x56'),'right_join',_0x4afa('0x58')];var _0x3793af={'SUM':_0x4afa('0x85'),'COUNT':_0x4afa('0x59'),'COUNT DISTINCT':_0x4afa('0x86'),'MAX':_0x4afa('0x5a'),'MIN':_0x4afa('0x5b'),'AVG':'AVG(%s)','GROUP_CONCAT':_0x4afa('0x87'),'GROUP_CONCAT ASC':_0x4afa('0x88'),'GROUP_CONCAT DESC':'GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20DESC)'};var _0x34d4d9={'SEC_TO_TIME':_0x4afa('0x89'),'DATE':_0x4afa('0x5e'),'HOUR':_0x4afa('0x8a'),'ROUND':_0x4afa('0x8b'),'UNIX_TIMESTAMP':'UNIX_TIMESTAMP(%s)'};var _0x22c52f=function(_0x3b61b0){return!_[_0x4afa('0x8c')](['IS\x20NULL','IS\x20NOT\x20NULL',_0x4afa('0x61'),'IS\x20NOT\x20EMPTY'],_0x3b61b0);};var _0x3830=function(_0x14dabc){if(!_0x14dabc||!_0x14dabc[_0x4afa('0x63')][_0x4afa('0x48')]){return'';}for(var _0x3cded7='(',_0x3d4cf6=0x0;_0x3d4cf6<_0x14dabc['rules']['length'];_0x3d4cf6+=0x1){_0x3d4cf6>0x0&&(_0x3cded7+='\x20'+_0x14dabc[_0x4afa('0x8d')]+'\x20');_0x3cded7+=_0x14dabc[_0x4afa('0x63')][_0x3d4cf6][_0x4afa('0x64')]?_0x3830(_0x14dabc[_0x4afa('0x63')][_0x3d4cf6]['group']):_0x14dabc[_0x4afa('0x63')][_0x3d4cf6][_0x4afa('0x65')]+'\x20'+_0x14dabc[_0x4afa('0x63')][_0x3d4cf6][_0x4afa('0x66')]+(_0x22c52f(_0x14dabc[_0x4afa('0x63')][_0x3d4cf6][_0x4afa('0x66')])?'\x20'+_0x14dabc['rules'][_0x3d4cf6][_0x4afa('0x67')]:'');}return _0x3cded7+')';};var _0x169fec={'where':{'id':_0x5cd73b['id']}},_0x1b0aa6,_0x57eb2a,_0x11d1f2,_0x4b8c64,_0xf8e033;_0x169fec=_['merge']({},_0x169fec,_0x308477);return db['AnalyticDefaultReport'][_0x4afa('0x50')](_0x169fec)[_0x4afa('0x24')](function(_0xe1105f){if(_0xe1105f){_0x1b0aa6=_0xe1105f;return _0xe1105f[_0x4afa('0x69')]();}return null;})['then'](function(_0x444828){if(_0x444828){if(!_0x444828[_0x4afa('0x48')]){throw new db['Sequelize'][(_0x4afa('0x8e'))](_0x4afa('0x6b'),0x193);}_0x57eb2a=_0x444828;return db[_0x4afa('0x8f')][_0x4afa('0x45')]({'raw':!![]});}return null;})['then'](function(_0x440506){if(_0x440506){_0x11d1f2=_[_0x4afa('0x6c')](_0x440506,'id');var _0x14a6e1;var _0x11bf9d=squel['select']();_0x11bf9d[_0x4afa('0x6e')](_0x1b0aa6[_0x4afa('0x7c')]);for(var _0x30ed53=0x0;_0x30ed53<_0x57eb2a[_0x4afa('0x48')];_0x30ed53+=0x1){_0x14a6e1=_0x57eb2a[_0x30ed53][_0x4afa('0x6f')]?_0x11d1f2[_0x57eb2a[_0x30ed53][_0x4afa('0x6f')]][_0x4afa('0x90')]:_0x57eb2a[_0x30ed53][_0x4afa('0x65')];_0x14a6e1=_0x57eb2a[_0x30ed53]['function']?_['replace'](_0x3793af[_0x57eb2a[_0x30ed53][_0x4afa('0x70')]],'%s',_0x14a6e1):_0x14a6e1;_0x14a6e1=_0x57eb2a[_0x30ed53][_0x4afa('0x72')]?_[_0x4afa('0x71')](_0x34d4d9[_0x57eb2a[_0x30ed53]['format']],'%s',_0x14a6e1):_0x14a6e1;if(_0x57eb2a[_0x30ed53]['groupBy']){_0x11bf9d[_0x4afa('0x64')](_0x14a6e1);}_0x57eb2a[_0x30ed53][_0x4afa('0x73')]&&_0x11bf9d[_0x4afa('0x3b')](_0x14a6e1,_0x57eb2a[_0x30ed53][_0x4afa('0x73')]==='DESC'?![]:!![]);_0x11bf9d[_0x4afa('0x65')](_0x14a6e1,_0x57eb2a[_0x30ed53]['alias']||_0x14a6e1);}if(_0x1b0aa6[_0x4afa('0x76')]){_0x1b0aa6[_0x4afa('0x76')]=JSON[_0x4afa('0x77')](_0x1b0aa6[_0x4afa('0x76')]);for(var _0x1dcd79=0x0;_0x1dcd79<_0x1b0aa6[_0x4afa('0x76')][_0x4afa('0x48')];_0x1dcd79+=0x1){if(_0x1b0aa6[_0x4afa('0x76')][_0x1dcd79][_0x4afa('0x32')]&&_[_0x4afa('0x8c')](_0x5cdcdf,_0x1b0aa6['joins'][_0x1dcd79][_0x4afa('0x32')])&&_0x1b0aa6[_0x4afa('0x76')][_0x1dcd79][_0x4afa('0x78')]&&_0x1b0aa6[_0x4afa('0x76')][_0x1dcd79]['foreignTable']&&_0x1b0aa6[_0x4afa('0x76')][_0x1dcd79][_0x4afa('0x79')]){_0x11bf9d[_0x1b0aa6[_0x4afa('0x76')][_0x1dcd79]['type']](_0x1b0aa6['joins'][_0x1dcd79][_0x4afa('0x7a')],null,util[_0x4afa('0x72')](_0x4afa('0x7b'),_0x1b0aa6[_0x4afa('0x7c')],_0x1b0aa6['joins'][_0x1dcd79]['parentKey'],_0x1b0aa6[_0x4afa('0x76')][_0x1dcd79][_0x4afa('0x7a')],_0x1b0aa6[_0x4afa('0x76')][_0x1dcd79][_0x4afa('0x79')]));}}}if(_0x1b0aa6[_0x4afa('0x7d')]){_0x1b0aa6['conditions']=JSON['parse'](_0x1b0aa6['conditions']);_0x11bf9d[_0x4afa('0x3d')](_0x3830(_0x1b0aa6[_0x4afa('0x7d')][_0x4afa('0x64')]));}_0xf8e033=_0x11bf9d[_0x4afa('0x7e')]();_0x11bf9d[_0x4afa('0x1c')](_0x3a520a);_0x11bf9d['offset'](0x0);logger['debug'](_0x4afa('0x80'),_0x11bf9d[_0x4afa('0x81')]());return db[_0x4afa('0x82')]['query'](_0x11bf9d['toString'](),{'type':db[_0x4afa('0x82')][_0x4afa('0x83')]['SELECT']});}})[_0x4afa('0x24')](function(_0x3a5df0){if(!_0x3a5df0[_0x4afa('0x48')]){throw new db[(_0x4afa('0x6a'))][(_0x4afa('0x8e'))](_0x4afa('0x91'),0xcc);}if(_0x3857ee['output']==='web'){return null;}var _0x12a495=_[_0x4afa('0x40')](_0x3857ee,{'name':_0x3857ee[_0x4afa('0x92')]||_0x3857ee[_0x4afa('0x2b')]||_0x1b0aa6[_0x4afa('0x2b')],'basename':_0x53719c,'savename':util['format']('%s-%s.%s',_0x3857ee['name']||_0x1b0aa6[_0x4afa('0x2b')],require('randomstring')[_0x4afa('0x93')](0x4),_0x3857ee['output']||_0x4afa('0x94')),'reportId':_0x1b0aa6['id'],'reportType':_0x4afa('0x95')});return db[_0x4afa('0x96')]['create'](_0x12a495,{'raw':!![]});})[_0x4afa('0x24')](function(_0x30f56f){if(_0x1b0aa6[_0x4afa('0x7c')]===_0x4afa('0x97')){_0xf8e033[_0x4afa('0x3d')](_0x1b0aa6[_0x4afa('0x7c')]+_0x4afa('0x98'),_0x3857ee[_0x4afa('0x99')],_0x3857ee[_0x4afa('0x9a')]);}else{_0xf8e033[_0x4afa('0x3d')](_0x1b0aa6[_0x4afa('0x7c')]+_0x4afa('0x9b'),_0x3857ee[_0x4afa('0x99')],_0x3857ee['endDate']);}if(_0x30f56f){logger['info'](_0x4afa('0x9c'),_0xf8e033[_0x4afa('0x81')]());require('child_process')[_0x4afa('0x9d')](path['join'](__dirname,_0x4afa('0x9e'),_0x30f56f[_0x4afa('0x9f')]),[_0x30f56f['id'],_0xf8e033[_0x4afa('0x81')](),path['join'](__dirname,'../../files/reports',_0x30f56f[_0x4afa('0xa0')]),_0x53719c]);return _0x30f56f;}else{var _0x3c0502=squel['select']();_0x3c0502['from']('('+_0xf8e033[_0x4afa('0x81')]()+')',_0x4afa('0xa1'));_0x3c0502['field'](_0x4afa('0xa2'),_0x4afa('0x42'));_0xf8e033[_0x4afa('0x1c')](_0x3857ee['limit']||_0x3a520a);_0xf8e033[_0x4afa('0x1b')](_0x3857ee[_0x4afa('0x1b')]||0x0);return db['sequelize'][_0x4afa('0x33')](_0x3c0502['toString'](),{'type':db[_0x4afa('0x82')]['QueryTypes']['SELECT']})[_0x4afa('0x24')](function(_0xf39c20){if(!_0xf39c20['length']){_0x4b8c64=0x0;}else{_0x4b8c64=_0xf39c20[0x0][_0x4afa('0x42')]||0x0;}return db[_0x4afa('0x82')]['query'](_0xf8e033[_0x4afa('0x81')](),{'type':db['sequelize'][_0x4afa('0x83')]['SELECT']});})['then'](function(_0x32f19b){return{'rows':_0x32f19b||[],'count':_0x4b8c64};});}});}exports[_0x4afa('0xa3')]=function(_0x2cace0,_0x3b6992){return runReport(_0x2cace0[_0x4afa('0x68')],_0x2cace0[_0x4afa('0x33')],_0x2cace0[_0x4afa('0x49')])['then'](respondWithResult(_0x3b6992,null))[_0x4afa('0x47')](handleError(_0x3b6992,null));};exports['runReport']=runReport;exports['query']=function(_0x241129,_0x2f641e){var _0x437207=0xa;var _0xd2c1ea=[_0x4afa('0x55'),'left_join',_0x4afa('0x57'),_0x4afa('0x58')];var _0x27b819={'SUM':_0x4afa('0x85'),'COUNT':'COUNT(%s)','COUNT DISTINCT':_0x4afa('0x86'),'MAX':'MAX(%s)','MIN':_0x4afa('0x5b'),'AVG':_0x4afa('0x5c'),'GROUP_CONCAT':_0x4afa('0x87'),'GROUP_CONCAT ASC':_0x4afa('0x88'),'GROUP_CONCAT DESC':'GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20DESC)'};var _0x46d6ff={'SEC_TO_TIME':'SEC_TO_TIME(%s)','DATE':_0x4afa('0x5e'),'HOUR':_0x4afa('0x8a'),'ROUND':'ROUND(%s)','UNIX_TIMESTAMP':'UNIX_TIMESTAMP(%s)'};var _0x568bd0=function(_0x5f42ca){return!_[_0x4afa('0x8c')]([_0x4afa('0xa4'),_0x4afa('0x60'),_0x4afa('0x61'),'IS\x20NOT\x20EMPTY'],_0x5f42ca);};var _0x147bea=function(_0x3746d2){if(!_0x3746d2||!_0x3746d2[_0x4afa('0x63')][_0x4afa('0x48')]){return'';}for(var _0x391ae0='(',_0x1761be=0x0;_0x1761be<_0x3746d2['rules']['length'];_0x1761be+=0x1){_0x1761be>0x0&&(_0x391ae0+='\x20'+_0x3746d2[_0x4afa('0x8d')]+'\x20');_0x391ae0+=_0x3746d2[_0x4afa('0x63')][_0x1761be][_0x4afa('0x64')]?_0x147bea(_0x3746d2[_0x4afa('0x63')][_0x1761be][_0x4afa('0x64')]):_0x3746d2[_0x4afa('0x63')][_0x1761be][_0x4afa('0x65')]+'\x20'+_0x3746d2[_0x4afa('0x63')][_0x1761be][_0x4afa('0x66')]+(_0x568bd0(_0x3746d2[_0x4afa('0x63')][_0x1761be][_0x4afa('0x66')])?'\x20'+_0x3746d2[_0x4afa('0x63')][_0x1761be][_0x4afa('0x67')]:'');}return _0x391ae0+')';};var _0x59a572={'where':{'id':_0x241129[_0x4afa('0x68')]['id']}},_0x3565fc,_0x342360,_0x1a670f,_0x269e2d,_0x475b11;_0x59a572=_['merge']({},_0x59a572,_0x241129[_0x4afa('0x49')]);return db[_0x4afa('0x2f')][_0x4afa('0x50')](_0x59a572)['then'](function(_0x343018){if(_0x343018){_0x3565fc=_0x343018;return _0x343018[_0x4afa('0x69')]();}return null;})[_0x4afa('0x24')](function(_0x35d7b3){if(_0x35d7b3){if(!_0x35d7b3[_0x4afa('0x48')]){throw new db[(_0x4afa('0x6a'))]['ValidationErrorItem']('Please\x20insert\x20at\x20least\x20one\x20field',0x193);}_0x342360=_0x35d7b3;return db[_0x4afa('0x8f')][_0x4afa('0x45')]({'raw':!![]});}return null;})[_0x4afa('0x24')](function(_0x5961ac){if(_0x5961ac){_0x1a670f=_[_0x4afa('0x6c')](_0x5961ac,'id');var _0x20d1e8;var _0x49752a=squel[_0x4afa('0x6d')]();_0x49752a[_0x4afa('0x6e')](_0x3565fc[_0x4afa('0x7c')]);for(var _0x387382=0x0;_0x387382<_0x342360[_0x4afa('0x48')];_0x387382+=0x1){_0x20d1e8=_0x342360[_0x387382][_0x4afa('0x6f')]?_0x1a670f[_0x342360[_0x387382][_0x4afa('0x6f')]][_0x4afa('0x90')]:_0x342360[_0x387382][_0x4afa('0x65')];_0x20d1e8=_0x342360[_0x387382]['function']?_[_0x4afa('0x71')](_0x27b819[_0x342360[_0x387382]['function']],'%s',_0x20d1e8):_0x20d1e8;_0x20d1e8=_0x342360[_0x387382][_0x4afa('0x72')]?_[_0x4afa('0x71')](_0x46d6ff[_0x342360[_0x387382]['format']],'%s',_0x20d1e8):_0x20d1e8;if(_0x342360[_0x387382][_0x4afa('0xa5')]){_0x49752a[_0x4afa('0x64')](_0x20d1e8);}_0x342360[_0x387382][_0x4afa('0x73')]&&_0x49752a[_0x4afa('0x3b')](_0x20d1e8,_0x342360[_0x387382]['orderBy']===_0x4afa('0x74')?![]:!![]);_0x49752a[_0x4afa('0x65')](_0x20d1e8,_0x342360[_0x387382][_0x4afa('0x75')]||_0x20d1e8);}if(_0x3565fc[_0x4afa('0x76')]){_0x3565fc[_0x4afa('0x76')]=JSON[_0x4afa('0x77')](_0x3565fc[_0x4afa('0x76')]);for(var _0x26ffd3=0x0;_0x26ffd3<_0x3565fc[_0x4afa('0x76')][_0x4afa('0x48')];_0x26ffd3+=0x1){if(_0x3565fc[_0x4afa('0x76')][_0x26ffd3][_0x4afa('0x32')]&&_[_0x4afa('0x8c')](_0xd2c1ea,_0x3565fc[_0x4afa('0x76')][_0x26ffd3][_0x4afa('0x32')])&&_0x3565fc[_0x4afa('0x76')][_0x26ffd3][_0x4afa('0x78')]&&_0x3565fc[_0x4afa('0x76')][_0x26ffd3][_0x4afa('0x7a')]&&_0x3565fc[_0x4afa('0x76')][_0x26ffd3][_0x4afa('0x79')]){_0x49752a[_0x3565fc[_0x4afa('0x76')][_0x26ffd3][_0x4afa('0x32')]](_0x3565fc[_0x4afa('0x76')][_0x26ffd3][_0x4afa('0x7a')],null,util[_0x4afa('0x72')](_0x4afa('0x7b'),_0x3565fc[_0x4afa('0x7c')],_0x3565fc[_0x4afa('0x76')][_0x26ffd3][_0x4afa('0x78')],_0x3565fc['joins'][_0x26ffd3][_0x4afa('0x7a')],_0x3565fc[_0x4afa('0x76')][_0x26ffd3][_0x4afa('0x79')]));}}}if(_0x3565fc['conditions']){_0x3565fc[_0x4afa('0x7d')]=JSON[_0x4afa('0x77')](_0x3565fc[_0x4afa('0x7d')]);_0x49752a[_0x4afa('0x3d')](_0x147bea(_0x3565fc['conditions'][_0x4afa('0x64')]));}_0x475b11=_0x49752a[_0x4afa('0x7e')]();_0x49752a['limit'](_0x437207);_0x49752a[_0x4afa('0x1b')](0x0);logger[_0x4afa('0x7f')](_0x4afa('0x80'),_0x49752a['toString']());return db[_0x4afa('0x82')]['query'](_0x49752a[_0x4afa('0x81')](),{'type':db[_0x4afa('0x82')]['QueryTypes'][_0x4afa('0x84')]});}})[_0x4afa('0x24')](function(){return{'sql':_0x475b11[_0x4afa('0x81')]()};})[_0x4afa('0x24')](respondWithResult(_0x2f641e,null))[_0x4afa('0x47')](handleError(_0x2f641e,null));}; \ No newline at end of file diff --git a/server/api/analyticDefaultReport/analyticDefaultReport.model.js b/server/api/analyticDefaultReport/analyticDefaultReport.model.js index 1c2521d..677746e 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 _0x8bd2=['./analyticDefaultReport.attributes','exports','define','lodash','util','bluebird','request-promise','path','rimraf','../../config/environment'];(function(_0x4a747d,_0x3b747f){var _0x3a5b5c=function(_0x4b3e81){while(--_0x4b3e81){_0x4a747d['push'](_0x4a747d['shift']());}};_0x3a5b5c(++_0x3b747f);}(_0x8bd2,0x17f));var _0x28bd=function(_0x3ea913,_0x255df2){_0x3ea913=_0x3ea913-0x0;var _0x2b4f28=_0x8bd2[_0x3ea913];return _0x2b4f28;};'use strict';var _=require(_0x28bd('0x0'));var util=require(_0x28bd('0x1'));var logger=require('../../config/logger')('api');var moment=require('moment');var BPromise=require(_0x28bd('0x2'));var rp=require(_0x28bd('0x3'));var fs=require('fs');var path=require(_0x28bd('0x4'));var rimraf=require(_0x28bd('0x5'));var config=require(_0x28bd('0x6'));var attributes=require(_0x28bd('0x7'));module[_0x28bd('0x8')]=function(_0x5564e0,_0x2f5dad){return _0x5564e0[_0x28bd('0x9')]('AnalyticDefaultReport',attributes,{'tableName':'analytics_default_reports','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xb6a5=['path','./analyticDefaultReport.attributes','exports','define','AnalyticDefaultReport','analytics_default_reports','util','../../config/logger','request-promise'];(function(_0x19115e,_0x507bab){var _0x45bbd4=function(_0x1308bf){while(--_0x1308bf){_0x19115e['push'](_0x19115e['shift']());}};_0x45bbd4(++_0x507bab);}(_0xb6a5,0x7b));var _0x5b6a=function(_0x1a55d4,_0x1c11ca){_0x1a55d4=_0x1a55d4-0x0;var _0x4854a4=_0xb6a5[_0x1a55d4];return _0x4854a4;};'use strict';var _=require('lodash');var util=require(_0x5b6a('0x0'));var logger=require(_0x5b6a('0x1'))('api');var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x5b6a('0x2'));var fs=require('fs');var path=require(_0x5b6a('0x3'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x5b6a('0x4'));module[_0x5b6a('0x5')]=function(_0x1c8ad1,_0x35633d){return _0x1c8ad1[_0x5b6a('0x6')](_0x5b6a('0x7'),attributes,{'tableName':_0x5b6a('0x8'),'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 130fbc6..ef417d6 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 _0xb75c=['request\x20sent','error','code','message','info','result','lodash','util','moment','randomstring','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','http','request','then','AnalyticDefaultReport,\x20%s,\x20%s','debug'];(function(_0x46c65b,_0x15acb0){var _0x1bac2b=function(_0xbd329c){while(--_0xbd329c){_0x46c65b['push'](_0x46c65b['shift']());}};_0x1bac2b(++_0x15acb0);}(_0xb75c,0x1ce));var _0xcb75=function(_0x2c82ff,_0x21b57f){_0x2c82ff=_0x2c82ff-0x0;var _0x585297=_0xb75c[_0x2c82ff];return _0x585297;};'use strict';var _=require(_0xcb75('0x0'));var util=require(_0xcb75('0x1'));var moment=require(_0xcb75('0x2'));var BPromise=require('bluebird');var rs=require(_0xcb75('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xcb75('0x4'))['db'];var utils=require(_0xcb75('0x5'));var logger=require(_0xcb75('0x6'))('rpc');var config=require(_0xcb75('0x7'));var jayson=require('jayson/promise');var client=jayson['client'][_0xcb75('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x284ea6,_0x33dfe8,_0x498656){return new BPromise(function(_0x57ef56,_0x5b89ba){return client[_0xcb75('0x9')](_0x284ea6,_0x498656)[_0xcb75('0xa')](function(_0x20b642){logger['info'](_0xcb75('0xb'),_0x33dfe8,'request\x20sent');logger[_0xcb75('0xc')]('AnalyticDefaultReport,\x20%s,\x20%s,\x20%s',_0x33dfe8,_0xcb75('0xd'),JSON['stringify'](_0x20b642));if(_0x20b642[_0xcb75('0xe')]){if(_0x20b642[_0xcb75('0xe')][_0xcb75('0xf')]===0x1f4){logger[_0xcb75('0xe')]('AnalyticDefaultReport,\x20%s,\x20%s',_0x33dfe8,_0x20b642[_0xcb75('0xe')][_0xcb75('0x10')]);return _0x5b89ba(_0x20b642[_0xcb75('0xe')][_0xcb75('0x10')]);}logger[_0xcb75('0xe')](_0xcb75('0xb'),_0x33dfe8,_0x20b642[_0xcb75('0xe')][_0xcb75('0x10')]);return _0x57ef56(_0x20b642['error']['message']);}else{logger[_0xcb75('0x11')](_0xcb75('0xb'),_0x33dfe8,'request\x20sent');_0x57ef56(_0x20b642[_0xcb75('0x12')][_0xcb75('0x10')]);}})['catch'](function(_0x347545){logger[_0xcb75('0xe')](_0xcb75('0xb'),_0x33dfe8,_0x347545);_0x5b89ba(_0x347545);});});} \ No newline at end of file +var _0x3c2c=['request\x20sent','error','code','message','AnalyticDefaultReport,\x20%s,\x20%s','result','catch','lodash','util','moment','bluebird','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request','then','info','debug','AnalyticDefaultReport,\x20%s,\x20%s,\x20%s'];(function(_0x3d03e6,_0x4b2b8d){var _0x2bce9a=function(_0x57461c){while(--_0x57461c){_0x3d03e6['push'](_0x3d03e6['shift']());}};_0x2bce9a(++_0x4b2b8d);}(_0x3c2c,0x160));var _0xc3c2=function(_0x567077,_0x375bc2){_0x567077=_0x567077-0x0;var _0x4d15b8=_0x3c2c[_0x567077];return _0x4d15b8;};'use strict';var _=require(_0xc3c2('0x0'));var util=require(_0xc3c2('0x1'));var moment=require(_0xc3c2('0x2'));var BPromise=require(_0xc3c2('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0xc3c2('0x4'))['db'];var utils=require(_0xc3c2('0x5'));var logger=require(_0xc3c2('0x6'))(_0xc3c2('0x7'));var config=require('../../config/environment');var jayson=require(_0xc3c2('0x8'));var client=jayson[_0xc3c2('0x9')][_0xc3c2('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x21fa50,_0xc36639,_0x48cab1){return new BPromise(function(_0x5daa76,_0x55840b){return client[_0xc3c2('0xb')](_0x21fa50,_0x48cab1)[_0xc3c2('0xc')](function(_0x5bf3d4){logger[_0xc3c2('0xd')]('AnalyticDefaultReport,\x20%s,\x20%s',_0xc36639,'request\x20sent');logger[_0xc3c2('0xe')](_0xc3c2('0xf'),_0xc36639,_0xc3c2('0x10'),JSON['stringify'](_0x5bf3d4));if(_0x5bf3d4[_0xc3c2('0x11')]){if(_0x5bf3d4[_0xc3c2('0x11')][_0xc3c2('0x12')]===0x1f4){logger[_0xc3c2('0x11')]('AnalyticDefaultReport,\x20%s,\x20%s',_0xc36639,_0x5bf3d4[_0xc3c2('0x11')][_0xc3c2('0x13')]);return _0x55840b(_0x5bf3d4['error'][_0xc3c2('0x13')]);}logger['error'](_0xc3c2('0x14'),_0xc36639,_0x5bf3d4['error'][_0xc3c2('0x13')]);return _0x5daa76(_0x5bf3d4['error'][_0xc3c2('0x13')]);}else{logger[_0xc3c2('0xd')]('AnalyticDefaultReport,\x20%s,\x20%s',_0xc36639,_0xc3c2('0x10'));_0x5daa76(_0x5bf3d4[_0xc3c2('0x15')][_0xc3c2('0x13')]);}})[_0xc3c2('0x16')](function(_0x342d4a){logger[_0xc3c2('0x11')]('AnalyticDefaultReport,\x20%s,\x20%s',_0xc36639,_0x342d4a);_0x55840b(_0x342d4a);});});} \ No newline at end of file diff --git a/server/api/analyticDefaultReport/index.js b/server/api/analyticDefaultReport/index.js index 57d7de0..25f0ccc 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 _0x10f1=['post','create','put','delete','destroy','multer','path','connect-timeout','../../components/auth/service','../../components/interaction/service','get','/:id','show','/:id/preview','isAuthenticated','preview','run','/:id/query','query'];(function(_0x554dbf,_0x178b54){var _0x16e227=function(_0x462d8b){while(--_0x462d8b){_0x554dbf['push'](_0x554dbf['shift']());}};_0x16e227(++_0x178b54);}(_0x10f1,0x1a7));var _0x110f=function(_0x40a096,_0x1f4014){_0x40a096=_0x40a096-0x0;var _0x1f16f2=_0x10f1[_0x40a096];return _0x1f16f2;};'use strict';var multer=require(_0x110f('0x0'));var util=require('util');var path=require(_0x110f('0x1'));var timeout=require(_0x110f('0x2'));var express=require('express');var router=express['Router']();var auth=require(_0x110f('0x3'));var interaction=require(_0x110f('0x4'));var config=require('../../config/environment');var controller=require('./analyticDefaultReport.controller');router[_0x110f('0x5')]('/',auth['isAuthenticated'](),controller['index']);router['get'](_0x110f('0x6'),auth['isAuthenticated'](),controller[_0x110f('0x7')]);router['get'](_0x110f('0x8'),auth[_0x110f('0x9')](),controller[_0x110f('0xa')]);router['get']('/:id/run',auth[_0x110f('0x9')](),controller[_0x110f('0xb')]);router[_0x110f('0x5')](_0x110f('0xc'),auth[_0x110f('0x9')](),controller[_0x110f('0xd')]);router[_0x110f('0xe')]('/',auth['isAuthenticated'](),controller[_0x110f('0xf')]);router[_0x110f('0x10')](_0x110f('0x6'),auth[_0x110f('0x9')](),controller['update']);router[_0x110f('0x11')]('/:id',auth[_0x110f('0x9')](),controller[_0x110f('0x12')]);module['exports']=router; \ No newline at end of file +var _0x5326=['get','/:id','isAuthenticated','show','/:id/preview','preview','/:id/run','run','/:id/query','post','put','update','delete','destroy','exports','multer','util','path','Router','../../components/auth/service','../../components/interaction/service','./analyticDefaultReport.controller','index'];(function(_0x304923,_0x2e3405){var _0x178161=function(_0x7c76ca){while(--_0x7c76ca){_0x304923['push'](_0x304923['shift']());}};_0x178161(++_0x2e3405);}(_0x5326,0xb0));var _0x6532=function(_0x15eb63,_0xd3f629){_0x15eb63=_0x15eb63-0x0;var _0x19fc81=_0x5326[_0x15eb63];return _0x19fc81;};'use strict';var multer=require(_0x6532('0x0'));var util=require(_0x6532('0x1'));var path=require(_0x6532('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x6532('0x3')]();var auth=require(_0x6532('0x4'));var interaction=require(_0x6532('0x5'));var config=require('../../config/environment');var controller=require(_0x6532('0x6'));router['get']('/',auth['isAuthenticated'](),controller[_0x6532('0x7')]);router[_0x6532('0x8')](_0x6532('0x9'),auth[_0x6532('0xa')](),controller[_0x6532('0xb')]);router[_0x6532('0x8')](_0x6532('0xc'),auth[_0x6532('0xa')](),controller[_0x6532('0xd')]);router[_0x6532('0x8')](_0x6532('0xe'),auth[_0x6532('0xa')](),controller[_0x6532('0xf')]);router[_0x6532('0x8')](_0x6532('0x10'),auth[_0x6532('0xa')](),controller['query']);router[_0x6532('0x11')]('/',auth[_0x6532('0xa')](),controller['create']);router[_0x6532('0x12')](_0x6532('0x9'),auth[_0x6532('0xa')](),controller[_0x6532('0x13')]);router[_0x6532('0x14')](_0x6532('0x9'),auth[_0x6532('0xa')](),controller[_0x6532('0x15')]);module[_0x6532('0x16')]=router; \ No newline at end of file diff --git a/server/api/analyticExtractedReport/analyticExtractedReport.attributes.js b/server/api/analyticExtractedReport/analyticExtractedReport.attributes.js index 2c95bcf..dd0a61e 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 _0x441d=['csv','DATE','Loading','manual','scheduled','INTEGER','UNSIGNED','exports','STRING','ENUM','pdf'];(function(_0x501510,_0x61caa9){var _0x1e6ee5=function(_0x32845b){while(--_0x32845b){_0x501510['push'](_0x501510['shift']());}};_0x1e6ee5(++_0x61caa9);}(_0x441d,0x1d5));var _0xd441=function(_0x4d40fe,_0x5938b5){_0x4d40fe=_0x4d40fe-0x0;var _0x294707=_0x441d[_0x4d40fe];return _0x294707;};'use strict';var Sequelize=require('sequelize');var moment=require('moment');module[_0xd441('0x0')]={'name':{'type':Sequelize[_0xd441('0x1')],'allowNull':![]},'basename':{'type':Sequelize[_0xd441('0x1')],'allowNull':![]},'output':{'type':Sequelize[_0xd441('0x2')]('csv',_0xd441('0x3'),'xlsx'),'allowNull':![],'defaultValue':_0xd441('0x4')},'savename':{'type':Sequelize['STRING'],'allowNull':![]},'startDate':{'type':Sequelize[_0xd441('0x5')]},'endDate':{'type':Sequelize[_0xd441('0x5')]},'status':{'type':Sequelize[_0xd441('0x1')],'defaultValue':_0xd441('0x6')},'type':{'type':Sequelize[_0xd441('0x2')](_0xd441('0x7'),_0xd441('0x8')),'allowNull':![],'defaultValue':'manual'},'reportId':{'type':Sequelize[_0xd441('0x9')](0xb)[_0xd441('0xa')]},'reportType':{'type':Sequelize[_0xd441('0x1')]}}; \ No newline at end of file +var _0x3d6c=['moment','exports','STRING','ENUM','pdf','xlsx','csv','DATE','Loading','manual','scheduled','INTEGER','sequelize'];(function(_0x468b0f,_0x408566){var _0x3e74d9=function(_0x27a545){while(--_0x27a545){_0x468b0f['push'](_0x468b0f['shift']());}};_0x3e74d9(++_0x408566);}(_0x3d6c,0xdc));var _0xc3d6=function(_0x54bd20,_0x2b30d8){_0x54bd20=_0x54bd20-0x0;var _0x3b7839=_0x3d6c[_0x54bd20];return _0x3b7839;};'use strict';var Sequelize=require(_0xc3d6('0x0'));var moment=require(_0xc3d6('0x1'));module[_0xc3d6('0x2')]={'name':{'type':Sequelize['STRING'],'allowNull':![]},'basename':{'type':Sequelize[_0xc3d6('0x3')],'allowNull':![]},'output':{'type':Sequelize[_0xc3d6('0x4')]('csv',_0xc3d6('0x5'),_0xc3d6('0x6')),'allowNull':![],'defaultValue':_0xc3d6('0x7')},'savename':{'type':Sequelize[_0xc3d6('0x3')],'allowNull':![]},'startDate':{'type':Sequelize[_0xc3d6('0x8')]},'endDate':{'type':Sequelize['DATE']},'status':{'type':Sequelize[_0xc3d6('0x3')],'defaultValue':_0xc3d6('0x9')},'type':{'type':Sequelize[_0xc3d6('0x4')](_0xc3d6('0xa'),_0xc3d6('0xb')),'allowNull':![],'defaultValue':_0xc3d6('0xa')},'reportId':{'type':Sequelize[_0xc3d6('0xc')](0xb)['UNSIGNED']},'reportType':{'type':Sequelize[_0xc3d6('0x3')]}}; \ No newline at end of file diff --git a/server/api/analyticExtractedReport/analyticExtractedReport.controller.js b/server/api/analyticExtractedReport/analyticExtractedReport.controller.js index e01d524..684d132 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 _0x9f4b=['../../mysqldb','sendStatus','status','end','json','count','offset','set','Content-Range','apply','reject','save','update','then','destroy','get','ExtractedReports','error','name','send','index','AnalyticExtractedReport','type','key','model','map','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','limit','order','sort','where','pick','filter','merge','options','include','findAll','rows','catch','show','rawAttributes','includeAll','create','body','user','UserProfileSection','find','UserProfileResource','params','savename','output','existsSync','join','server/files/reports','Sequelize','ValidationError','Report\x20not\x20found\x20or\x20empty','exists','%s.%s','basename','toLowerCase','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','path','sox','ejs','lodash','jsforce','desk.js','to-csv','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/utils'];(function(_0x4b8fd4,_0x4570d3){var _0x3c44f8=function(_0x352c96){while(--_0x352c96){_0x4b8fd4['push'](_0x4b8fd4['shift']());}};_0x3c44f8(++_0x4570d3);}(_0x9f4b,0x9e));var _0xb9f4=function(_0x24b7ec,_0x4726a8){_0x24b7ec=_0x24b7ec-0x0;var _0x5f0f36=_0x9f4b[_0x24b7ec];return _0x5f0f36;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0xb9f4('0x0'));var rimraf=require(_0xb9f4('0x1'));var zipdir=require(_0xb9f4('0x2'));var jsonpatch=require(_0xb9f4('0x3'));var rp=require(_0xb9f4('0x4'));var moment=require('moment');var BPromise=require(_0xb9f4('0x5'));var Mustache=require(_0xb9f4('0x6'));var util=require('util');var path=require(_0xb9f4('0x7'));var sox=require(_0xb9f4('0x8'));var csv=require('to-csv');var ejs=require(_0xb9f4('0x9'));var fs=require('fs');var _=require(_0xb9f4('0xa'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0xb9f4('0xb'));var deskjs=require(_0xb9f4('0xc'));var toCsv=require(_0xb9f4('0xd'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0xb9f4('0xe'));var authService=require(_0xb9f4('0xf'));var qs=require(_0xb9f4('0x10'));var as=require(_0xb9f4('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0xb9f4('0x12'));var utils=require(_0xb9f4('0x13'));var config=require('../../config/environment');var db=require(_0xb9f4('0x14'))['db'];function respondWithStatusCode(_0x21b836,_0x975494){_0x975494=_0x975494||0xcc;return function(_0x589412){if(_0x589412){return _0x21b836[_0xb9f4('0x15')](_0x975494);}return _0x21b836[_0xb9f4('0x16')](_0x975494)[_0xb9f4('0x17')]();};}function respondWithResult(_0x273b9f,_0x446589){_0x446589=_0x446589||0xc8;return function(_0x16e5ca){if(_0x16e5ca){return _0x273b9f[_0xb9f4('0x16')](_0x446589)[_0xb9f4('0x18')](_0x16e5ca);}};}function respondWithFilteredResult(_0x2ed6d9,_0x33c181){return function(_0x382b23){if(_0x382b23){var _0x1a3979=_0x382b23[_0xb9f4('0x19')],_0x5bef92=_0x33c181[_0xb9f4('0x1a')],_0x1facb8=_0x33c181['offset']+_0x33c181['limit'],_0x33548;if(_0x1facb8>=_0x1a3979){_0x1facb8=_0x1a3979;_0x33548=0xc8;}else{_0x33548=0xce;}_0x2ed6d9[_0xb9f4('0x16')](_0x33548);return _0x2ed6d9[_0xb9f4('0x1b')](_0xb9f4('0x1c'),_0x5bef92+'-'+_0x1facb8+'/'+_0x1a3979)[_0xb9f4('0x18')](_0x382b23);}return null;};}function patchUpdates(_0x2e8afe){return function(_0xf32bd9){try{jsonpatch[_0xb9f4('0x1d')](_0xf32bd9,_0x2e8afe,!![]);}catch(_0x4f8395){return BPromise[_0xb9f4('0x1e')](_0x4f8395);}return _0xf32bd9[_0xb9f4('0x1f')]();};}function saveUpdates(_0x4e1148,_0x191a4f){return function(_0x39c7a8){if(_0x39c7a8){return _0x39c7a8[_0xb9f4('0x20')](_0x4e1148)[_0xb9f4('0x21')](function(_0x5a2910){return _0x5a2910;});}return null;};}function removeEntity(_0x53a584,_0xd903db){return function(_0x7e5c54){if(_0x7e5c54){return _0x7e5c54[_0xb9f4('0x22')]()[_0xb9f4('0x21')](function(){var _0x8869fa=_0x7e5c54[_0xb9f4('0x23')]({'plain':!![]});var _0x480e0f=_0xb9f4('0x24');return db['UserProfileResource'][_0xb9f4('0x22')]({'where':{'type':_0x480e0f,'resourceId':_0x8869fa['id']}})[_0xb9f4('0x21')](function(){return _0x7e5c54;});})[_0xb9f4('0x21')](function(){_0x53a584[_0xb9f4('0x16')](0xcc)['end']();});}};}function handleEntityNotFound(_0x18b05b,_0x1ff49a){return function(_0x304571){if(!_0x304571){_0x18b05b[_0xb9f4('0x15')](0x194);}return _0x304571;};}function handleError(_0x5bd3de,_0x574ddf){_0x574ddf=_0x574ddf||0x1f4;return function(_0x35edd3){logger[_0xb9f4('0x25')](_0x35edd3['stack']);if(_0x35edd3['name']){delete _0x35edd3[_0xb9f4('0x26')];}_0x5bd3de[_0xb9f4('0x16')](_0x574ddf)[_0xb9f4('0x27')](_0x35edd3);};}exports[_0xb9f4('0x28')]=function(_0x24a23a,_0x24612e){var _0x554fb2={},_0x5d5003={},_0x417aab={'count':0x0,'rows':[]};var _0x117374=_['map'](db[_0xb9f4('0x29')]['rawAttributes'],function(_0x52f270){return{'name':_0x52f270['fieldName'],'type':_0x52f270[_0xb9f4('0x2a')][_0xb9f4('0x2b')]};});_0x5d5003[_0xb9f4('0x2c')]=_[_0xb9f4('0x2d')](_0x117374,'name');_0x5d5003[_0xb9f4('0x2e')]=_[_0xb9f4('0x2f')](_0x24a23a[_0xb9f4('0x2e')]);_0x5d5003[_0xb9f4('0x30')]=_[_0xb9f4('0x31')](_0x5d5003[_0xb9f4('0x2c')],_0x5d5003[_0xb9f4('0x2e')]);_0x554fb2['attributes']=_[_0xb9f4('0x31')](_0x5d5003['model'],qs[_0xb9f4('0x32')](_0x24a23a['query']['fields']));_0x554fb2[_0xb9f4('0x33')]=_0x554fb2[_0xb9f4('0x33')][_0xb9f4('0x34')]?_0x554fb2[_0xb9f4('0x33')]:_0x5d5003[_0xb9f4('0x2c')];if(!_0x24a23a[_0xb9f4('0x2e')][_0xb9f4('0x35')](_0xb9f4('0x36'))){_0x554fb2[_0xb9f4('0x37')]=qs[_0xb9f4('0x37')](_0x24a23a[_0xb9f4('0x2e')][_0xb9f4('0x37')]);_0x554fb2['offset']=qs[_0xb9f4('0x1a')](_0x24a23a[_0xb9f4('0x2e')][_0xb9f4('0x1a')]);}_0x554fb2[_0xb9f4('0x38')]=qs['sort'](_0x24a23a['query'][_0xb9f4('0x39')]);_0x554fb2[_0xb9f4('0x3a')]=qs[_0xb9f4('0x30')](_[_0xb9f4('0x3b')](_0x24a23a[_0xb9f4('0x2e')],_0x5d5003[_0xb9f4('0x30')]));if(_0x24a23a[_0xb9f4('0x2e')][_0xb9f4('0x3c')]){_0x554fb2[_0xb9f4('0x3a')]=_['merge'](_0x554fb2[_0xb9f4('0x3a')],{'$or':_['map'](_0x117374,function(_0x59fe19){if(_0x59fe19[_0xb9f4('0x2a')]!=='VIRTUAL'){var _0x30e0bf={};_0x30e0bf[_0x59fe19[_0xb9f4('0x26')]]={'$like':'%'+_0x24a23a[_0xb9f4('0x2e')]['filter']+'%'};return _0x30e0bf;}})});}_0x554fb2=_[_0xb9f4('0x3d')]({},_0x554fb2,_0x24a23a[_0xb9f4('0x3e')]);var _0x1da80c={'where':_0x554fb2[_0xb9f4('0x3a')]};return db[_0xb9f4('0x29')][_0xb9f4('0x19')](_0x1da80c)[_0xb9f4('0x21')](function(_0x1ae473){_0x417aab['count']=_0x1ae473;if(_0x24a23a['query']['includeAll']){_0x554fb2[_0xb9f4('0x3f')]=[{'all':!![]}];}return db['AnalyticExtractedReport'][_0xb9f4('0x40')](_0x554fb2);})[_0xb9f4('0x21')](function(_0x4b1b25){_0x417aab[_0xb9f4('0x41')]=_0x4b1b25;return _0x417aab;})[_0xb9f4('0x21')](respondWithFilteredResult(_0x24612e,_0x554fb2))[_0xb9f4('0x42')](handleError(_0x24612e,null));};exports[_0xb9f4('0x43')]=function(_0x4d165e,_0x3e1e77){var _0x208722={'raw':!![],'where':{'id':_0x4d165e['params']['id']}},_0x193b10={};_0x193b10['model']=_['keys'](db[_0xb9f4('0x29')][_0xb9f4('0x44')]);_0x193b10[_0xb9f4('0x2e')]=_[_0xb9f4('0x2f')](_0x4d165e[_0xb9f4('0x2e')]);_0x193b10[_0xb9f4('0x30')]=_['intersection'](_0x193b10[_0xb9f4('0x2c')],_0x193b10['query']);_0x208722['attributes']=_[_0xb9f4('0x31')](_0x193b10[_0xb9f4('0x2c')],qs[_0xb9f4('0x32')](_0x4d165e['query']['fields']));_0x208722['attributes']=_0x208722[_0xb9f4('0x33')][_0xb9f4('0x34')]?_0x208722[_0xb9f4('0x33')]:_0x193b10[_0xb9f4('0x2c')];if(_0x4d165e[_0xb9f4('0x2e')][_0xb9f4('0x45')]){_0x208722[_0xb9f4('0x3f')]=[{'all':!![]}];}_0x208722=_[_0xb9f4('0x3d')]({},_0x208722,_0x4d165e[_0xb9f4('0x3e')]);return db['AnalyticExtractedReport']['find'](_0x208722)[_0xb9f4('0x21')](handleEntityNotFound(_0x3e1e77,null))['then'](respondWithResult(_0x3e1e77,null))[_0xb9f4('0x42')](handleError(_0x3e1e77,null));};exports[_0xb9f4('0x46')]=function(_0x267b84,_0x54e11a){return db[_0xb9f4('0x29')][_0xb9f4('0x46')](_0x267b84[_0xb9f4('0x47')],{})['then'](function(_0x3b94f3){var _0x3140e1=_0x267b84[_0xb9f4('0x48')]['get']({'plain':!![]});if(!_0x3140e1)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x3140e1['role']===_0xb9f4('0x48')){var _0x36fe42=_0x3b94f3['get']({'plain':!![]});var _0x167b66='ExtractedReports';return db[_0xb9f4('0x49')][_0xb9f4('0x4a')]({'where':{'name':_0x167b66,'userProfileId':_0x3140e1['userProfileId']},'raw':!![]})['then'](function(_0x543181){if(_0x543181&&_0x543181['autoAssociation']===0x0){return db[_0xb9f4('0x4b')]['create']({'name':_0x36fe42[_0xb9f4('0x26')],'resourceId':_0x36fe42['id'],'type':_0x543181[_0xb9f4('0x26')],'sectionId':_0x543181['id']},{})[_0xb9f4('0x21')](function(){return _0x3b94f3;});}else{return _0x3b94f3;}})['catch'](function(_0x1694fb){logger[_0xb9f4('0x25')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x1694fb);throw _0x1694fb;});}return _0x3b94f3;})[_0xb9f4('0x21')](respondWithResult(_0x54e11a,0xc9))[_0xb9f4('0x42')](handleError(_0x54e11a,null));};exports[_0xb9f4('0x20')]=function(_0xdf2b8a,_0x1b397b){if(_0xdf2b8a['body']['id']){delete _0xdf2b8a[_0xb9f4('0x47')]['id'];}return db[_0xb9f4('0x29')]['find']({'where':{'id':_0xdf2b8a[_0xb9f4('0x4c')]['id']}})[_0xb9f4('0x21')](handleEntityNotFound(_0x1b397b,null))[_0xb9f4('0x21')](saveUpdates(_0xdf2b8a[_0xb9f4('0x47')],null))[_0xb9f4('0x21')](respondWithResult(_0x1b397b,null))[_0xb9f4('0x42')](handleError(_0x1b397b,null));};exports[_0xb9f4('0x22')]=function(_0xa5d50e,_0x4c2572){return db['AnalyticExtractedReport']['find']({'where':{'id':_0xa5d50e[_0xb9f4('0x4c')]['id']}})['then'](handleEntityNotFound(_0x4c2572,null))['then'](removeEntity(_0x4c2572,null))[_0xb9f4('0x42')](handleError(_0x4c2572,null));};exports['download']=function(_0x80d931,_0xc7d7c7,_0x359f93){return db[_0xb9f4('0x29')][_0xb9f4('0x4a')]({'where':{'id':_0x80d931[_0xb9f4('0x4c')]['id']},'attributes':[_0xb9f4('0x26'),'basename',_0xb9f4('0x4d'),_0xb9f4('0x4e')],'raw':!![]})['then'](handleEntityNotFound(_0xc7d7c7,null))[_0xb9f4('0x21')](function(_0x233b18){if(_0x233b18){if(!fs[_0xb9f4('0x4f')](path[_0xb9f4('0x50')](config['root'],_0xb9f4('0x51'),_0x233b18[_0xb9f4('0x4d')]))){throw new db[(_0xb9f4('0x52'))][(_0xb9f4('0x53'))](_0xb9f4('0x54'));}if(_0x80d931[_0xb9f4('0x2e')][_0xb9f4('0x55')]){return _0xc7d7c7['sendStatus'](0xc8);}return _0xc7d7c7['download'](path[_0xb9f4('0x50')](config['root'],_0xb9f4('0x51'),_0x233b18[_0xb9f4('0x4d')]),util['format'](_0xb9f4('0x56'),_0x233b18[_0xb9f4('0x57')]||_0x233b18['name'],_0x233b18[_0xb9f4('0x4e')][_0xb9f4('0x58')]()));}})[_0xb9f4('0x42')](handleError(_0xc7d7c7,null));}; \ No newline at end of file +var _0xaf31=['key','filters','intersection','model','fields','query','attributes','length','nolimit','order','sort','where','filter','merge','VIRTUAL','options','includeAll','AnalyticExtractedReport','catch','show','params','keys','include','find','create','body','get','role','user','UserProfileSection','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','download','basename','savename','existsSync','root','Sequelize','ValidationError','Report\x20not\x20found\x20or\x20empty','join','server/files/reports','format','%s.%s','output','html-pdf','eml-format','moment','bluebird','util','sox','squel','crypto','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','sendStatus','end','status','json','count','offset','limit','set','Content-Range','apply','reject','save','update','then','destroy','ExtractedReports','UserProfileResource','error','stack','name','send','index','map','rawAttributes','type'];(function(_0x333e04,_0x3d9f00){var _0x596d26=function(_0x4e6a32){while(--_0x4e6a32){_0x333e04['push'](_0x333e04['shift']());}};_0x596d26(++_0x3d9f00);}(_0xaf31,0x195));var _0x1af3=function(_0x5abd76,_0x69d49){_0x5abd76=_0x5abd76-0x0;var _0x4fb813=_0xaf31[_0x5abd76];return _0x4fb813;};'use strict';var pdf=require(_0x1af3('0x0'));var emlformat=require(_0x1af3('0x1'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x1af3('0x2'));var BPromise=require(_0x1af3('0x3'));var Mustache=require('mustache');var util=require(_0x1af3('0x4'));var path=require('path');var sox=require(_0x1af3('0x5'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var _=require('lodash');var squel=require(_0x1af3('0x6'));var crypto=require(_0x1af3('0x7'));var jsforce=require('jsforce');var deskjs=require(_0x1af3('0x8'));var toCsv=require(_0x1af3('0x9'));var querystring=require(_0x1af3('0xa'));var Papa=require(_0x1af3('0xb'));var Redis=require(_0x1af3('0xc'));var authService=require(_0x1af3('0xd'));var qs=require(_0x1af3('0xe'));var as=require(_0x1af3('0xf'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x1af3('0x10'))(_0x1af3('0x11'));var utils=require(_0x1af3('0x12'));var config=require(_0x1af3('0x13'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x4f828e,_0x32984b){_0x32984b=_0x32984b||0xcc;return function(_0x3a0b1d){if(_0x3a0b1d){return _0x4f828e[_0x1af3('0x14')](_0x32984b);}return _0x4f828e['status'](_0x32984b)[_0x1af3('0x15')]();};}function respondWithResult(_0x177347,_0x2cde37){_0x2cde37=_0x2cde37||0xc8;return function(_0x4e14b5){if(_0x4e14b5){return _0x177347[_0x1af3('0x16')](_0x2cde37)[_0x1af3('0x17')](_0x4e14b5);}};}function respondWithFilteredResult(_0x1bb054,_0x5662f3){return function(_0x45f935){if(_0x45f935){var _0x24f29d=_0x45f935[_0x1af3('0x18')],_0x27009d=_0x5662f3[_0x1af3('0x19')],_0x3e30f3=_0x5662f3['offset']+_0x5662f3[_0x1af3('0x1a')],_0x346159;if(_0x3e30f3>=_0x24f29d){_0x3e30f3=_0x24f29d;_0x346159=0xc8;}else{_0x346159=0xce;}_0x1bb054[_0x1af3('0x16')](_0x346159);return _0x1bb054[_0x1af3('0x1b')](_0x1af3('0x1c'),_0x27009d+'-'+_0x3e30f3+'/'+_0x24f29d)['json'](_0x45f935);}return null;};}function patchUpdates(_0x1f82a7){return function(_0x5be09c){try{jsonpatch[_0x1af3('0x1d')](_0x5be09c,_0x1f82a7,!![]);}catch(_0x18f781){return BPromise[_0x1af3('0x1e')](_0x18f781);}return _0x5be09c[_0x1af3('0x1f')]();};}function saveUpdates(_0x2e4679,_0x4f9d69){return function(_0xe7965f){if(_0xe7965f){return _0xe7965f[_0x1af3('0x20')](_0x2e4679)[_0x1af3('0x21')](function(_0x5cf6f6){return _0x5cf6f6;});}return null;};}function removeEntity(_0x28ff14,_0x25bbc4){return function(_0x224888){if(_0x224888){return _0x224888[_0x1af3('0x22')]()[_0x1af3('0x21')](function(){var _0x551e55=_0x224888['get']({'plain':!![]});var _0x412631=_0x1af3('0x23');return db[_0x1af3('0x24')]['destroy']({'where':{'type':_0x412631,'resourceId':_0x551e55['id']}})[_0x1af3('0x21')](function(){return _0x224888;});})['then'](function(){_0x28ff14[_0x1af3('0x16')](0xcc)[_0x1af3('0x15')]();});}};}function handleEntityNotFound(_0x5a10cb,_0x1be15a){return function(_0x78f83d){if(!_0x78f83d){_0x5a10cb[_0x1af3('0x14')](0x194);}return _0x78f83d;};}function handleError(_0x9b0472,_0x5c6bf8){_0x5c6bf8=_0x5c6bf8||0x1f4;return function(_0x4a60e9){logger[_0x1af3('0x25')](_0x4a60e9[_0x1af3('0x26')]);if(_0x4a60e9['name']){delete _0x4a60e9[_0x1af3('0x27')];}_0x9b0472[_0x1af3('0x16')](_0x5c6bf8)[_0x1af3('0x28')](_0x4a60e9);};}exports[_0x1af3('0x29')]=function(_0x1b0565,_0x55d62f){var _0x4fc48d={},_0x13f476={},_0x57c182={'count':0x0,'rows':[]};var _0x4070c1=_[_0x1af3('0x2a')](db['AnalyticExtractedReport'][_0x1af3('0x2b')],function(_0x1eb557){return{'name':_0x1eb557['fieldName'],'type':_0x1eb557[_0x1af3('0x2c')][_0x1af3('0x2d')]};});_0x13f476['model']=_[_0x1af3('0x2a')](_0x4070c1,_0x1af3('0x27'));_0x13f476['query']=_['keys'](_0x1b0565['query']);_0x13f476[_0x1af3('0x2e')]=_[_0x1af3('0x2f')](_0x13f476['model'],_0x13f476['query']);_0x4fc48d['attributes']=_[_0x1af3('0x2f')](_0x13f476[_0x1af3('0x30')],qs[_0x1af3('0x31')](_0x1b0565[_0x1af3('0x32')][_0x1af3('0x31')]));_0x4fc48d[_0x1af3('0x33')]=_0x4fc48d[_0x1af3('0x33')][_0x1af3('0x34')]?_0x4fc48d[_0x1af3('0x33')]:_0x13f476[_0x1af3('0x30')];if(!_0x1b0565[_0x1af3('0x32')]['hasOwnProperty'](_0x1af3('0x35'))){_0x4fc48d['limit']=qs[_0x1af3('0x1a')](_0x1b0565[_0x1af3('0x32')][_0x1af3('0x1a')]);_0x4fc48d[_0x1af3('0x19')]=qs[_0x1af3('0x19')](_0x1b0565[_0x1af3('0x32')]['offset']);}_0x4fc48d[_0x1af3('0x36')]=qs[_0x1af3('0x37')](_0x1b0565['query']['sort']);_0x4fc48d[_0x1af3('0x38')]=qs[_0x1af3('0x2e')](_['pick'](_0x1b0565[_0x1af3('0x32')],_0x13f476[_0x1af3('0x2e')]));if(_0x1b0565[_0x1af3('0x32')][_0x1af3('0x39')]){_0x4fc48d[_0x1af3('0x38')]=_[_0x1af3('0x3a')](_0x4fc48d[_0x1af3('0x38')],{'$or':_[_0x1af3('0x2a')](_0x4070c1,function(_0x5a2ee0){if(_0x5a2ee0[_0x1af3('0x2c')]!==_0x1af3('0x3b')){var _0x17c7d5={};_0x17c7d5[_0x5a2ee0[_0x1af3('0x27')]]={'$like':'%'+_0x1b0565[_0x1af3('0x32')][_0x1af3('0x39')]+'%'};return _0x17c7d5;}})});}_0x4fc48d=_['merge']({},_0x4fc48d,_0x1b0565[_0x1af3('0x3c')]);var _0x15416d={'where':_0x4fc48d[_0x1af3('0x38')]};return db['AnalyticExtractedReport']['count'](_0x15416d)[_0x1af3('0x21')](function(_0x11d9ac){_0x57c182['count']=_0x11d9ac;if(_0x1b0565['query'][_0x1af3('0x3d')]){_0x4fc48d['include']=[{'all':!![]}];}return db[_0x1af3('0x3e')]['findAll'](_0x4fc48d);})[_0x1af3('0x21')](function(_0x3e571b){_0x57c182['rows']=_0x3e571b;return _0x57c182;})[_0x1af3('0x21')](respondWithFilteredResult(_0x55d62f,_0x4fc48d))[_0x1af3('0x3f')](handleError(_0x55d62f,null));};exports[_0x1af3('0x40')]=function(_0x134fa2,_0x5b1a39){var _0x15beb3={'raw':!![],'where':{'id':_0x134fa2[_0x1af3('0x41')]['id']}},_0x21cd90={};_0x21cd90[_0x1af3('0x30')]=_[_0x1af3('0x42')](db['AnalyticExtractedReport']['rawAttributes']);_0x21cd90['query']=_[_0x1af3('0x42')](_0x134fa2['query']);_0x21cd90[_0x1af3('0x2e')]=_['intersection'](_0x21cd90['model'],_0x21cd90['query']);_0x15beb3[_0x1af3('0x33')]=_[_0x1af3('0x2f')](_0x21cd90[_0x1af3('0x30')],qs['fields'](_0x134fa2[_0x1af3('0x32')][_0x1af3('0x31')]));_0x15beb3[_0x1af3('0x33')]=_0x15beb3['attributes'][_0x1af3('0x34')]?_0x15beb3[_0x1af3('0x33')]:_0x21cd90['model'];if(_0x134fa2[_0x1af3('0x32')][_0x1af3('0x3d')]){_0x15beb3[_0x1af3('0x43')]=[{'all':!![]}];}_0x15beb3=_[_0x1af3('0x3a')]({},_0x15beb3,_0x134fa2[_0x1af3('0x3c')]);return db[_0x1af3('0x3e')][_0x1af3('0x44')](_0x15beb3)[_0x1af3('0x21')](handleEntityNotFound(_0x5b1a39,null))['then'](respondWithResult(_0x5b1a39,null))[_0x1af3('0x3f')](handleError(_0x5b1a39,null));};exports[_0x1af3('0x45')]=function(_0x1dcc6d,_0x5b1f1b){return db[_0x1af3('0x3e')]['create'](_0x1dcc6d[_0x1af3('0x46')],{})[_0x1af3('0x21')](function(_0x183851){var _0xe4c722=_0x1dcc6d['user'][_0x1af3('0x47')]({'plain':!![]});if(!_0xe4c722)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0xe4c722[_0x1af3('0x48')]===_0x1af3('0x49')){var _0x121594=_0x183851['get']({'plain':!![]});var _0x44f255=_0x1af3('0x23');return db[_0x1af3('0x4a')][_0x1af3('0x44')]({'where':{'name':_0x44f255,'userProfileId':_0xe4c722[_0x1af3('0x4b')]},'raw':!![]})[_0x1af3('0x21')](function(_0x3d2d62){if(_0x3d2d62&&_0x3d2d62['autoAssociation']===0x0){return db[_0x1af3('0x24')]['create']({'name':_0x121594[_0x1af3('0x27')],'resourceId':_0x121594['id'],'type':_0x3d2d62[_0x1af3('0x27')],'sectionId':_0x3d2d62['id']},{})[_0x1af3('0x21')](function(){return _0x183851;});}else{return _0x183851;}})[_0x1af3('0x3f')](function(_0x569d29){logger[_0x1af3('0x25')](_0x1af3('0x4c'),_0x569d29);throw _0x569d29;});}return _0x183851;})[_0x1af3('0x21')](respondWithResult(_0x5b1f1b,0xc9))[_0x1af3('0x3f')](handleError(_0x5b1f1b,null));};exports['update']=function(_0x3cfeb0,_0x594cb5){if(_0x3cfeb0[_0x1af3('0x46')]['id']){delete _0x3cfeb0[_0x1af3('0x46')]['id'];}return db[_0x1af3('0x3e')][_0x1af3('0x44')]({'where':{'id':_0x3cfeb0['params']['id']}})[_0x1af3('0x21')](handleEntityNotFound(_0x594cb5,null))[_0x1af3('0x21')](saveUpdates(_0x3cfeb0[_0x1af3('0x46')],null))[_0x1af3('0x21')](respondWithResult(_0x594cb5,null))[_0x1af3('0x3f')](handleError(_0x594cb5,null));};exports[_0x1af3('0x22')]=function(_0x46908b,_0x21f1fd){return db['AnalyticExtractedReport']['find']({'where':{'id':_0x46908b[_0x1af3('0x41')]['id']}})['then'](handleEntityNotFound(_0x21f1fd,null))[_0x1af3('0x21')](removeEntity(_0x21f1fd,null))[_0x1af3('0x3f')](handleError(_0x21f1fd,null));};exports[_0x1af3('0x4d')]=function(_0x52add3,_0x1c2ebc,_0x371016){return db[_0x1af3('0x3e')][_0x1af3('0x44')]({'where':{'id':_0x52add3[_0x1af3('0x41')]['id']},'attributes':[_0x1af3('0x27'),_0x1af3('0x4e'),_0x1af3('0x4f'),'output'],'raw':!![]})[_0x1af3('0x21')](handleEntityNotFound(_0x1c2ebc,null))[_0x1af3('0x21')](function(_0x5e44e2){if(_0x5e44e2){if(!fs[_0x1af3('0x50')](path['join'](config[_0x1af3('0x51')],'server/files/reports',_0x5e44e2[_0x1af3('0x4f')]))){throw new db[(_0x1af3('0x52'))][(_0x1af3('0x53'))](_0x1af3('0x54'));}if(_0x52add3[_0x1af3('0x32')]['exists']){return _0x1c2ebc[_0x1af3('0x14')](0xc8);}return _0x1c2ebc[_0x1af3('0x4d')](path[_0x1af3('0x55')](config[_0x1af3('0x51')],_0x1af3('0x56'),_0x5e44e2[_0x1af3('0x4f')]),util[_0x1af3('0x57')](_0x1af3('0x58'),_0x5e44e2[_0x1af3('0x4e')]||_0x5e44e2[_0x1af3('0x27')],_0x5e44e2[_0x1af3('0x59')]['toLowerCase']()));}})[_0x1af3('0x3f')](handleError(_0x1c2ebc,null));}; \ No newline at end of file diff --git a/server/api/analyticExtractedReport/analyticExtractedReport.model.js b/server/api/analyticExtractedReport/analyticExtractedReport.model.js index 9b3378b..3188e28 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 _0xdffb=['rimraf','../../config/environment','./analyticExtractedReport.attributes','exports','define','analytics_extracted_reports','lodash','util','../../config/logger','api','moment','request-promise','path'];(function(_0x3e2362,_0x228ac8){var _0x22caa0=function(_0x4559a8){while(--_0x4559a8){_0x3e2362['push'](_0x3e2362['shift']());}};_0x22caa0(++_0x228ac8);}(_0xdffb,0x1c0));var _0xbdff=function(_0x2d299b,_0x561aad){_0x2d299b=_0x2d299b-0x0;var _0x565b66=_0xdffb[_0x2d299b];return _0x565b66;};'use strict';var _=require(_0xbdff('0x0'));var util=require(_0xbdff('0x1'));var logger=require(_0xbdff('0x2'))(_0xbdff('0x3'));var moment=require(_0xbdff('0x4'));var BPromise=require('bluebird');var rp=require(_0xbdff('0x5'));var fs=require('fs');var path=require(_0xbdff('0x6'));var rimraf=require(_0xbdff('0x7'));var config=require(_0xbdff('0x8'));var attributes=require(_0xbdff('0x9'));module[_0xbdff('0xa')]=function(_0x1d0c58,_0x3d7891){return _0x1d0c58[_0xbdff('0xb')]('AnalyticExtractedReport',attributes,{'tableName':_0xbdff('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x731d=['../../config/environment','./analyticExtractedReport.attributes','define','AnalyticExtractedReport','analytics_extracted_reports','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path'];(function(_0x3f4dd9,_0xe0b819){var _0x31c54a=function(_0x25e6c6){while(--_0x25e6c6){_0x3f4dd9['push'](_0x3f4dd9['shift']());}};_0x31c54a(++_0xe0b819);}(_0x731d,0xef));var _0xd731=function(_0x1775d5,_0x4e7e86){_0x1775d5=_0x1775d5-0x0;var _0x595939=_0x731d[_0x1775d5];return _0x595939;};'use strict';var _=require(_0xd731('0x0'));var util=require(_0xd731('0x1'));var logger=require(_0xd731('0x2'))(_0xd731('0x3'));var moment=require(_0xd731('0x4'));var BPromise=require(_0xd731('0x5'));var rp=require(_0xd731('0x6'));var fs=require('fs');var path=require(_0xd731('0x7'));var rimraf=require('rimraf');var config=require(_0xd731('0x8'));var attributes=require(_0xd731('0x9'));module['exports']=function(_0x142ab8,_0x780df4){return _0x142ab8[_0xd731('0xa')](_0xd731('0xb'),attributes,{'tableName':_0xd731('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/analyticExtractedReport/analyticExtractedReport.rpc.js b/server/api/analyticExtractedReport/analyticExtractedReport.rpc.js index c0c5a39..bbf836e 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 _0x0286=['catch','moment','bluebird','ioredis','../../mysqldb','../../config/utils','rpc','then','info','AnalyticExtractedReport,\x20%s,\x20%s','request\x20sent','AnalyticExtractedReport,\x20%s,\x20%s,\x20%s','stringify','error','message','result'];(function(_0x1de641,_0x44d464){var _0xccacbc=function(_0x1ed9fb){while(--_0x1ed9fb){_0x1de641['push'](_0x1de641['shift']());}};_0xccacbc(++_0x44d464);}(_0x0286,0x91));var _0x6028=function(_0x5838ce,_0x43ed50){_0x5838ce=_0x5838ce-0x0;var _0x349988=_0x0286[_0x5838ce];return _0x349988;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x6028('0x0'));var BPromise=require(_0x6028('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x6028('0x2'));var db=require(_0x6028('0x3'))['db'];var utils=require(_0x6028('0x4'));var logger=require('../../config/logger')(_0x6028('0x5'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0xa5c60c,_0x54c953,_0x254844){return new BPromise(function(_0x56553f,_0x1fd1e1){return client['request'](_0xa5c60c,_0x254844)[_0x6028('0x6')](function(_0x51d8f2){logger[_0x6028('0x7')](_0x6028('0x8'),_0x54c953,_0x6028('0x9'));logger['debug'](_0x6028('0xa'),_0x54c953,_0x6028('0x9'),JSON[_0x6028('0xb')](_0x51d8f2));if(_0x51d8f2[_0x6028('0xc')]){if(_0x51d8f2[_0x6028('0xc')]['code']===0x1f4){logger[_0x6028('0xc')]('AnalyticExtractedReport,\x20%s,\x20%s',_0x54c953,_0x51d8f2[_0x6028('0xc')][_0x6028('0xd')]);return _0x1fd1e1(_0x51d8f2[_0x6028('0xc')][_0x6028('0xd')]);}logger[_0x6028('0xc')](_0x6028('0x8'),_0x54c953,_0x51d8f2['error'][_0x6028('0xd')]);return _0x56553f(_0x51d8f2[_0x6028('0xc')][_0x6028('0xd')]);}else{logger[_0x6028('0x7')]('AnalyticExtractedReport,\x20%s,\x20%s',_0x54c953,'request\x20sent');_0x56553f(_0x51d8f2[_0x6028('0xe')][_0x6028('0xd')]);}})[_0x6028('0xf')](function(_0x171f1a){logger[_0x6028('0xc')](_0x6028('0x8'),_0x54c953,_0x171f1a);_0x1fd1e1(_0x171f1a);});});} \ No newline at end of file +var _0xe9d8=['../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','info','AnalyticExtractedReport,\x20%s,\x20%s','debug','AnalyticExtractedReport,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','moment','randomstring','ioredis'];(function(_0x1f1263,_0x42f60e){var _0x3769a6=function(_0x341a91){while(--_0x341a91){_0x1f1263['push'](_0x1f1263['shift']());}};_0x3769a6(++_0x42f60e);}(_0xe9d8,0x131));var _0x8e9d=function(_0x5d6456,_0x58ecc7){_0x5d6456=_0x5d6456-0x0;var _0x4d66c1=_0xe9d8[_0x5d6456];return _0x4d66c1;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x8e9d('0x0'));var BPromise=require('bluebird');var rs=require(_0x8e9d('0x1'));var fs=require('fs');var Redis=require(_0x8e9d('0x2'));var db=require('../../mysqldb')['db'];var utils=require(_0x8e9d('0x3'));var logger=require(_0x8e9d('0x4'))(_0x8e9d('0x5'));var config=require(_0x8e9d('0x6'));var jayson=require(_0x8e9d('0x7'));var client=jayson['client'][_0x8e9d('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x7ec610,_0x28d8df,_0x200cfb){return new BPromise(function(_0xba3feb,_0x1e38cd){return client[_0x8e9d('0x9')](_0x7ec610,_0x200cfb)[_0x8e9d('0xa')](function(_0x42990c){logger[_0x8e9d('0xb')](_0x8e9d('0xc'),_0x28d8df,'request\x20sent');logger[_0x8e9d('0xd')](_0x8e9d('0xe'),_0x28d8df,_0x8e9d('0xf'),JSON[_0x8e9d('0x10')](_0x42990c));if(_0x42990c[_0x8e9d('0x11')]){if(_0x42990c[_0x8e9d('0x11')][_0x8e9d('0x12')]===0x1f4){logger['error'](_0x8e9d('0xc'),_0x28d8df,_0x42990c[_0x8e9d('0x11')][_0x8e9d('0x13')]);return _0x1e38cd(_0x42990c[_0x8e9d('0x11')][_0x8e9d('0x13')]);}logger['error']('AnalyticExtractedReport,\x20%s,\x20%s',_0x28d8df,_0x42990c[_0x8e9d('0x11')][_0x8e9d('0x13')]);return _0xba3feb(_0x42990c['error']['message']);}else{logger[_0x8e9d('0xb')](_0x8e9d('0xc'),_0x28d8df,_0x8e9d('0xf'));_0xba3feb(_0x42990c[_0x8e9d('0x14')][_0x8e9d('0x13')]);}})[_0x8e9d('0x15')](function(_0x45939a){logger['error'](_0x8e9d('0xc'),_0x28d8df,_0x45939a);_0x1e38cd(_0x45939a);});});} \ No newline at end of file diff --git a/server/api/analyticExtractedReport/index.js b/server/api/analyticExtractedReport/index.js index e0f40c7..cdaa7c3 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 _0x2e5f=['util','path','express','../../components/auth/service','../../config/environment','get','isAuthenticated','index','/:id','download','post','create','delete','exports','multer'];(function(_0xaac2fd,_0x5357a7){var _0x57c27a=function(_0x28293f){while(--_0x28293f){_0xaac2fd['push'](_0xaac2fd['shift']());}};_0x57c27a(++_0x5357a7);}(_0x2e5f,0xd1));var _0xf2e5=function(_0x3d4ce2,_0x399832){_0x3d4ce2=_0x3d4ce2-0x0;var _0x11991c=_0x2e5f[_0x3d4ce2];return _0x11991c;};'use strict';var multer=require(_0xf2e5('0x0'));var util=require(_0xf2e5('0x1'));var path=require(_0xf2e5('0x2'));var timeout=require('connect-timeout');var express=require(_0xf2e5('0x3'));var router=express['Router']();var auth=require(_0xf2e5('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0xf2e5('0x5'));var controller=require('./analyticExtractedReport.controller');router[_0xf2e5('0x6')]('/',auth[_0xf2e5('0x7')](),controller[_0xf2e5('0x8')]);router[_0xf2e5('0x6')](_0xf2e5('0x9'),auth[_0xf2e5('0x7')](),controller['show']);router[_0xf2e5('0x6')]('/:id/download',auth[_0xf2e5('0x7')](),controller[_0xf2e5('0xa')]);router[_0xf2e5('0xb')]('/',auth['isAuthenticated'](),controller[_0xf2e5('0xc')]);router['put'](_0xf2e5('0x9'),auth[_0xf2e5('0x7')](),controller['update']);router[_0xf2e5('0xd')](_0xf2e5('0x9'),auth[_0xf2e5('0x7')](),controller['destroy']);module[_0xf2e5('0xe')]=router; \ No newline at end of file +var _0x348e=['../../components/auth/service','./analyticExtractedReport.controller','get','isAuthenticated','index','/:id','/:id/download','create','put','update','delete','destroy','exports','multer','util','path','connect-timeout','express','Router'];(function(_0x15e4cb,_0x13056a){var _0x67c1ae=function(_0x228565){while(--_0x228565){_0x15e4cb['push'](_0x15e4cb['shift']());}};_0x67c1ae(++_0x13056a);}(_0x348e,0x7f));var _0xe348=function(_0x208272,_0x10287){_0x208272=_0x208272-0x0;var _0x5d2503=_0x348e[_0x208272];return _0x5d2503;};'use strict';var multer=require(_0xe348('0x0'));var util=require(_0xe348('0x1'));var path=require(_0xe348('0x2'));var timeout=require(_0xe348('0x3'));var express=require(_0xe348('0x4'));var router=express[_0xe348('0x5')]();var auth=require(_0xe348('0x6'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0xe348('0x7'));router[_0xe348('0x8')]('/',auth[_0xe348('0x9')](),controller[_0xe348('0xa')]);router['get'](_0xe348('0xb'),auth[_0xe348('0x9')](),controller['show']);router[_0xe348('0x8')](_0xe348('0xc'),auth[_0xe348('0x9')](),controller['download']);router['post']('/',auth[_0xe348('0x9')](),controller[_0xe348('0xd')]);router[_0xe348('0xe')]('/:id',auth[_0xe348('0x9')](),controller[_0xe348('0xf')]);router[_0xe348('0x10')](_0xe348('0xb'),auth[_0xe348('0x9')](),controller[_0xe348('0x11')]);module[_0xe348('0x12')]=router; \ No newline at end of file diff --git a/server/api/analyticFieldReport/analyticFieldReport.attributes.js b/server/api/analyticFieldReport/analyticFieldReport.attributes.js index f82eb14..0485c35 100644 --- a/server/api/analyticFieldReport/analyticFieldReport.attributes.js +++ b/server/api/analyticFieldReport/analyticFieldReport.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x5fc3=['sequelize','exports','STRING','BOOLEAN'];(function(_0x5a1224,_0x5a34ea){var _0x19e104=function(_0x173e0e){while(--_0x173e0e){_0x5a1224['push'](_0x5a1224['shift']());}};_0x19e104(++_0x5a34ea);}(_0x5fc3,0xa8));var _0x35fc=function(_0x5a92ad,_0x2219a6){_0x5a92ad=_0x5a92ad-0x0;var _0x2466f8=_0x5fc3[_0x5a92ad];return _0x2466f8;};'use strict';var Sequelize=require(_0x35fc('0x0'));module[_0x35fc('0x1')]={'field':{'type':Sequelize['TEXT']},'alias':{'type':Sequelize[_0x35fc('0x2')]},'function':{'type':Sequelize[_0x35fc('0x2')]},'format':{'type':Sequelize[_0x35fc('0x2')]},'groupBy':{'type':Sequelize[_0x35fc('0x3')],'defaultValue':![]},'orderBy':{'type':Sequelize[_0x35fc('0x2')]},'custom':{'type':Sequelize['BOOLEAN'],'defaultValue':![]}}; \ No newline at end of file +var _0x814b=['TEXT','STRING','BOOLEAN','sequelize','exports'];(function(_0x313d6f,_0x122c8d){var _0x2059ac=function(_0x49c551){while(--_0x49c551){_0x313d6f['push'](_0x313d6f['shift']());}};_0x2059ac(++_0x122c8d);}(_0x814b,0x1a2));var _0xb814=function(_0x38ed42,_0x3d9a37){_0x38ed42=_0x38ed42-0x0;var _0x474931=_0x814b[_0x38ed42];return _0x474931;};'use strict';var Sequelize=require(_0xb814('0x0'));module[_0xb814('0x1')]={'field':{'type':Sequelize[_0xb814('0x2')]},'alias':{'type':Sequelize[_0xb814('0x3')]},'function':{'type':Sequelize[_0xb814('0x3')]},'format':{'type':Sequelize[_0xb814('0x3')]},'groupBy':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'orderBy':{'type':Sequelize[_0xb814('0x3')]},'custom':{'type':Sequelize[_0xb814('0x4')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/analyticFieldReport/analyticFieldReport.controller.js b/server/api/analyticFieldReport/analyticFieldReport.controller.js index d893bfa..4c76902 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 _0x8aad=['create','body','bulkCreate','ids','AnalyticCustomReport','findOne','sequelize','transaction','CustomReportId','findAll','html-pdf','eml-format','zip-dir','request-promise','moment','util','to-csv','ejs','lodash','crypto','jsforce','desk.js','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','count','offset','limit','set','Content-Range','apply','save','update','destroy','then','error','stack','name','send','index','AnalyticFieldReport','rawAttributes','type','model','map','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','includeAll','include','rows','catch','show','params','options','find'];(function(_0x8a5a59,_0x1a9f88){var _0xe6f700=function(_0x55b3d0){while(--_0x55b3d0){_0x8a5a59['push'](_0x8a5a59['shift']());}};_0xe6f700(++_0x1a9f88);}(_0x8aad,0x146));var _0xd8aa=function(_0x275223,_0x10403b){_0x275223=_0x275223-0x0;var _0x308fa5=_0x8aad[_0x275223];return _0x308fa5;};'use strict';var pdf=require(_0xd8aa('0x0'));var emlformat=require(_0xd8aa('0x1'));var rimraf=require('rimraf');var zipdir=require(_0xd8aa('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xd8aa('0x3'));var moment=require(_0xd8aa('0x4'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0xd8aa('0x5'));var path=require('path');var sox=require('sox');var csv=require(_0xd8aa('0x6'));var ejs=require(_0xd8aa('0x7'));var fs=require('fs');var _=require(_0xd8aa('0x8'));var squel=require('squel');var crypto=require(_0xd8aa('0x9'));var jsforce=require(_0xd8aa('0xa'));var deskjs=require(_0xd8aa('0xb'));var toCsv=require(_0xd8aa('0x6'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0xd8aa('0xc'));var authService=require(_0xd8aa('0xd'));var qs=require(_0xd8aa('0xe'));var as=require(_0xd8aa('0xf'));var hardwareService=require(_0xd8aa('0x10'));var logger=require('../../config/logger')(_0xd8aa('0x11'));var utils=require(_0xd8aa('0x12'));var config=require(_0xd8aa('0x13'));var db=require(_0xd8aa('0x14'))['db'];function respondWithStatusCode(_0x2383fd,_0x6ec0eb){_0x6ec0eb=_0x6ec0eb||0xcc;return function(_0x549fad){if(_0x549fad){return _0x2383fd[_0xd8aa('0x15')](_0x6ec0eb);}return _0x2383fd[_0xd8aa('0x16')](_0x6ec0eb)[_0xd8aa('0x17')]();};}function respondWithResult(_0x5ea934,_0x5a8c79){_0x5a8c79=_0x5a8c79||0xc8;return function(_0x275eff){if(_0x275eff){return _0x5ea934[_0xd8aa('0x16')](_0x5a8c79)[_0xd8aa('0x18')](_0x275eff);}};}function respondWithFilteredResult(_0x47c131,_0x2678ed){return function(_0x180c56){if(_0x180c56){var _0x39b5bc=_0x180c56[_0xd8aa('0x19')],_0x404ed6=_0x2678ed['offset'],_0x47a0e3=_0x2678ed[_0xd8aa('0x1a')]+_0x2678ed[_0xd8aa('0x1b')],_0x476930;if(_0x47a0e3>=_0x39b5bc){_0x47a0e3=_0x39b5bc;_0x476930=0xc8;}else{_0x476930=0xce;}_0x47c131[_0xd8aa('0x16')](_0x476930);return _0x47c131[_0xd8aa('0x1c')](_0xd8aa('0x1d'),_0x404ed6+'-'+_0x47a0e3+'/'+_0x39b5bc)['json'](_0x180c56);}return null;};}function patchUpdates(_0x43d3fa){return function(_0x266308){try{jsonpatch[_0xd8aa('0x1e')](_0x266308,_0x43d3fa,!![]);}catch(_0x2a2246){return BPromise['reject'](_0x2a2246);}return _0x266308[_0xd8aa('0x1f')]();};}function saveUpdates(_0x3df281,_0x46d69b){return function(_0x3588ee){if(_0x3588ee){return _0x3588ee[_0xd8aa('0x20')](_0x3df281)['then'](function(_0xe1219){return _0xe1219;});}return null;};}function removeEntity(_0x1366ce,_0xc4f55c){return function(_0x5910b3){if(_0x5910b3){return _0x5910b3[_0xd8aa('0x21')]()[_0xd8aa('0x22')](function(){_0x1366ce[_0xd8aa('0x16')](0xcc)[_0xd8aa('0x17')]();});}};}function handleEntityNotFound(_0x3ef3a9,_0x16758a){return function(_0x1f64f8){if(!_0x1f64f8){_0x3ef3a9[_0xd8aa('0x15')](0x194);}return _0x1f64f8;};}function handleError(_0x375f64,_0x210176){_0x210176=_0x210176||0x1f4;return function(_0x6614ab){logger[_0xd8aa('0x23')](_0x6614ab[_0xd8aa('0x24')]);if(_0x6614ab['name']){delete _0x6614ab[_0xd8aa('0x25')];}_0x375f64[_0xd8aa('0x16')](_0x210176)[_0xd8aa('0x26')](_0x6614ab);};}exports[_0xd8aa('0x27')]=function(_0x26cff3,_0x3696fd){var _0x26ab06={},_0x19edee={},_0x3bba1d={'count':0x0,'rows':[]};var _0xbe531=_['map'](db[_0xd8aa('0x28')][_0xd8aa('0x29')],function(_0x214393){return{'name':_0x214393['fieldName'],'type':_0x214393[_0xd8aa('0x2a')]['key']};});_0x19edee[_0xd8aa('0x2b')]=_[_0xd8aa('0x2c')](_0xbe531,_0xd8aa('0x25'));_0x19edee[_0xd8aa('0x2d')]=_[_0xd8aa('0x2e')](_0x26cff3[_0xd8aa('0x2d')]);_0x19edee[_0xd8aa('0x2f')]=_[_0xd8aa('0x30')](_0x19edee['model'],_0x19edee[_0xd8aa('0x2d')]);_0x26ab06[_0xd8aa('0x31')]=_[_0xd8aa('0x30')](_0x19edee[_0xd8aa('0x2b')],qs[_0xd8aa('0x32')](_0x26cff3[_0xd8aa('0x2d')][_0xd8aa('0x32')]));_0x26ab06[_0xd8aa('0x31')]=_0x26ab06['attributes'][_0xd8aa('0x33')]?_0x26ab06[_0xd8aa('0x31')]:_0x19edee[_0xd8aa('0x2b')];if(!_0x26cff3['query'][_0xd8aa('0x34')](_0xd8aa('0x35'))){_0x26ab06[_0xd8aa('0x1b')]=qs[_0xd8aa('0x1b')](_0x26cff3[_0xd8aa('0x2d')][_0xd8aa('0x1b')]);_0x26ab06[_0xd8aa('0x1a')]=qs[_0xd8aa('0x1a')](_0x26cff3[_0xd8aa('0x2d')]['offset']);}_0x26ab06[_0xd8aa('0x36')]=qs[_0xd8aa('0x37')](_0x26cff3[_0xd8aa('0x2d')][_0xd8aa('0x37')]);_0x26ab06[_0xd8aa('0x38')]=qs[_0xd8aa('0x2f')](_[_0xd8aa('0x39')](_0x26cff3[_0xd8aa('0x2d')],_0x19edee[_0xd8aa('0x2f')]));if(_0x26cff3['query'][_0xd8aa('0x3a')]){_0x26ab06['where']=_[_0xd8aa('0x3b')](_0x26ab06[_0xd8aa('0x38')],{'$or':_['map'](_0xbe531,function(_0x37d7d1){if(_0x37d7d1[_0xd8aa('0x2a')]!==_0xd8aa('0x3c')){var _0x18da91={};_0x18da91[_0x37d7d1[_0xd8aa('0x25')]]={'$like':'%'+_0x26cff3['query']['filter']+'%'};return _0x18da91;}})});}_0x26ab06=_[_0xd8aa('0x3b')]({},_0x26ab06,_0x26cff3['options']);var _0x25f091={'where':_0x26ab06[_0xd8aa('0x38')]};return db[_0xd8aa('0x28')][_0xd8aa('0x19')](_0x25f091)[_0xd8aa('0x22')](function(_0x3430ae){_0x3bba1d[_0xd8aa('0x19')]=_0x3430ae;if(_0x26cff3[_0xd8aa('0x2d')][_0xd8aa('0x3d')]){_0x26ab06[_0xd8aa('0x3e')]=[{'all':!![]}];}return db[_0xd8aa('0x28')]['findAll'](_0x26ab06);})[_0xd8aa('0x22')](function(_0x32cfb6){_0x3bba1d[_0xd8aa('0x3f')]=_0x32cfb6;return _0x3bba1d;})['then'](respondWithFilteredResult(_0x3696fd,_0x26ab06))[_0xd8aa('0x40')](handleError(_0x3696fd,null));};exports[_0xd8aa('0x41')]=function(_0x417ff9,_0x2fedbe){var _0x3a0284={'raw':![],'where':{'id':_0x417ff9[_0xd8aa('0x42')]['id']}},_0x3bbb17={};_0x3bbb17[_0xd8aa('0x2b')]=_[_0xd8aa('0x2e')](db[_0xd8aa('0x28')][_0xd8aa('0x29')]);_0x3bbb17[_0xd8aa('0x2d')]=_[_0xd8aa('0x2e')](_0x417ff9[_0xd8aa('0x2d')]);_0x3bbb17[_0xd8aa('0x2f')]=_[_0xd8aa('0x30')](_0x3bbb17[_0xd8aa('0x2b')],_0x3bbb17[_0xd8aa('0x2d')]);_0x3a0284['attributes']=_[_0xd8aa('0x30')](_0x3bbb17[_0xd8aa('0x2b')],qs[_0xd8aa('0x32')](_0x417ff9[_0xd8aa('0x2d')][_0xd8aa('0x32')]));_0x3a0284[_0xd8aa('0x31')]=_0x3a0284['attributes'][_0xd8aa('0x33')]?_0x3a0284['attributes']:_0x3bbb17[_0xd8aa('0x2b')];if(_0x417ff9['query'][_0xd8aa('0x3d')]){_0x3a0284['include']=[{'all':!![]}];}_0x3a0284=_['merge']({},_0x3a0284,_0x417ff9[_0xd8aa('0x43')]);return db[_0xd8aa('0x28')][_0xd8aa('0x44')](_0x3a0284)[_0xd8aa('0x22')](handleEntityNotFound(_0x2fedbe,null))[_0xd8aa('0x22')](respondWithResult(_0x2fedbe,null))[_0xd8aa('0x40')](handleError(_0x2fedbe,null));};exports['create']=function(_0x30cd7c,_0x473318){return db[_0xd8aa('0x28')][_0xd8aa('0x45')](_0x30cd7c[_0xd8aa('0x46')],{})['then'](respondWithResult(_0x473318,0xc9))['catch'](handleError(_0x473318,null));};exports['bulkCreate']=function(_0x1fd1dc,_0x2a24ae){return db[_0xd8aa('0x28')][_0xd8aa('0x47')](_0x1fd1dc[_0xd8aa('0x46')],{'raw':![],'individualHooks':!![]})[_0xd8aa('0x22')](respondWithResult(_0x2a24ae,0xc9))['catch'](handleError(_0x2a24ae,null));};exports[_0xd8aa('0x20')]=function(_0x241e23,_0x5a9055){if(_0x241e23[_0xd8aa('0x46')]['id']){delete _0x241e23[_0xd8aa('0x46')]['id'];}return db[_0xd8aa('0x28')]['find']({'where':{'id':_0x241e23[_0xd8aa('0x42')]['id']}})[_0xd8aa('0x22')](handleEntityNotFound(_0x5a9055,null))[_0xd8aa('0x22')](saveUpdates(_0x241e23[_0xd8aa('0x46')],null))[_0xd8aa('0x22')](respondWithResult(_0x5a9055,null))[_0xd8aa('0x40')](handleError(_0x5a9055,null));};exports['destroy']=function(_0x566d52,_0x15a101){return db[_0xd8aa('0x28')][_0xd8aa('0x44')]({'where':{'id':_0x566d52[_0xd8aa('0x42')]['id']}})[_0xd8aa('0x22')](handleEntityNotFound(_0x15a101,null))[_0xd8aa('0x22')](removeEntity(_0x15a101,null))[_0xd8aa('0x40')](handleError(_0x15a101,null));};exports['bulkDestroy']=function(_0x9db7e3,_0x4035c2){return db['AnalyticFieldReport'][_0xd8aa('0x21')]({'where':{'id':_0x9db7e3['query'][_0xd8aa('0x48')]||[]},'raw':![],'individualHooks':!![]})[_0xd8aa('0x22')](respondWithResult(_0x4035c2,0xcc))[_0xd8aa('0x40')](handleError(_0x4035c2,null));};exports['addFields']=function(_0x5de908,_0x5a5a20,_0x4b85bc){return db[_0xd8aa('0x49')][_0xd8aa('0x4a')]({'where':{'id':_0x5de908[_0xd8aa('0x42')]['id']}})['then'](handleEntityNotFound(_0x5a5a20,null))['then'](function(_0x495a33){if(_0x495a33){return db[_0xd8aa('0x4b')][_0xd8aa('0x4c')](function(_0x178775){return db[_0xd8aa('0x28')][_0xd8aa('0x21')]({'where':{'CustomReportId':_0x5de908[_0xd8aa('0x42')]['id']},'transaction':_0x178775})[_0xd8aa('0x22')](function(_0x101105){var _0x1503df=_[_0xd8aa('0x2c')](_0x5de908[_0xd8aa('0x46')],function(_0x24b935){delete _0x24b935['id'];_0x24b935[_0xd8aa('0x4d')]=_0x5de908['params']['id'];return _0x24b935;});return db['AnalyticFieldReport'][_0xd8aa('0x47')](_0x1503df,{'transaction':_0x178775});});})[_0xd8aa('0x22')](function(){return db[_0xd8aa('0x28')][_0xd8aa('0x4e')]({'where':{'CustomReportId':_0x5de908['params']['id']}});});}})[_0xd8aa('0x22')](respondWithResult(_0x5a5a20,null))[_0xd8aa('0x40')](handleError(_0x5a5a20,null));}; \ No newline at end of file +var _0x11f3=['sox','ejs','lodash','squel','crypto','desk.js','to-csv','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','count','offset','limit','Content-Range','apply','reject','save','update','destroy','then','error','stack','name','send','index','AnalyticFieldReport','fieldName','type','key','map','query','keys','intersection','attributes','model','length','hasOwnProperty','nolimit','order','sort','where','filters','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','rawAttributes','fields','find','create','body','params','ids','addFields','AnalyticCustomReport','sequelize','transaction','CustomReportId','bulkCreate','html-pdf','eml-format','rimraf','fast-json-patch','moment','bluebird','mustache'];(function(_0x5ddc34,_0xca070f){var _0x526ca2=function(_0x75070a){while(--_0x75070a){_0x5ddc34['push'](_0x5ddc34['shift']());}};_0x526ca2(++_0xca070f);}(_0x11f3,0x149));var _0x311f=function(_0x25948f,_0x4ac7e4){_0x25948f=_0x25948f-0x0;var _0x2b1976=_0x11f3[_0x25948f];return _0x2b1976;};'use strict';var pdf=require(_0x311f('0x0'));var emlformat=require(_0x311f('0x1'));var rimraf=require(_0x311f('0x2'));var zipdir=require('zip-dir');var jsonpatch=require(_0x311f('0x3'));var rp=require('request-promise');var moment=require(_0x311f('0x4'));var BPromise=require(_0x311f('0x5'));var Mustache=require(_0x311f('0x6'));var util=require('util');var path=require('path');var sox=require(_0x311f('0x7'));var csv=require('to-csv');var ejs=require(_0x311f('0x8'));var fs=require('fs');var _=require(_0x311f('0x9'));var squel=require(_0x311f('0xa'));var crypto=require(_0x311f('0xb'));var jsforce=require('jsforce');var deskjs=require(_0x311f('0xc'));var toCsv=require(_0x311f('0xd'));var querystring=require(_0x311f('0xe'));var Papa=require(_0x311f('0xf'));var Redis=require(_0x311f('0x10'));var authService=require('../../components/auth/service');var qs=require(_0x311f('0x11'));var as=require(_0x311f('0x12'));var hardwareService=require(_0x311f('0x13'));var logger=require(_0x311f('0x14'))(_0x311f('0x15'));var utils=require(_0x311f('0x16'));var config=require(_0x311f('0x17'));var db=require(_0x311f('0x18'))['db'];function respondWithStatusCode(_0x833528,_0xe68c1e){_0xe68c1e=_0xe68c1e||0xcc;return function(_0x3a73dd){if(_0x3a73dd){return _0x833528[_0x311f('0x19')](_0xe68c1e);}return _0x833528[_0x311f('0x1a')](_0xe68c1e)[_0x311f('0x1b')]();};}function respondWithResult(_0x3e809b,_0x25eb90){_0x25eb90=_0x25eb90||0xc8;return function(_0xeea2a8){if(_0xeea2a8){return _0x3e809b[_0x311f('0x1a')](_0x25eb90)[_0x311f('0x1c')](_0xeea2a8);}};}function respondWithFilteredResult(_0x5f09fb,_0x4e0362){return function(_0x5013f9){if(_0x5013f9){var _0x114ad7=_0x5013f9[_0x311f('0x1d')],_0x38f876=_0x4e0362[_0x311f('0x1e')],_0x248fca=_0x4e0362[_0x311f('0x1e')]+_0x4e0362[_0x311f('0x1f')],_0x7ff544;if(_0x248fca>=_0x114ad7){_0x248fca=_0x114ad7;_0x7ff544=0xc8;}else{_0x7ff544=0xce;}_0x5f09fb[_0x311f('0x1a')](_0x7ff544);return _0x5f09fb['set'](_0x311f('0x20'),_0x38f876+'-'+_0x248fca+'/'+_0x114ad7)[_0x311f('0x1c')](_0x5013f9);}return null;};}function patchUpdates(_0x3b9ca8){return function(_0x451467){try{jsonpatch[_0x311f('0x21')](_0x451467,_0x3b9ca8,!![]);}catch(_0x2e243f){return BPromise[_0x311f('0x22')](_0x2e243f);}return _0x451467[_0x311f('0x23')]();};}function saveUpdates(_0x3fc713,_0x67ea17){return function(_0x4c2b78){if(_0x4c2b78){return _0x4c2b78[_0x311f('0x24')](_0x3fc713)['then'](function(_0x82fdde){return _0x82fdde;});}return null;};}function removeEntity(_0x4ddf62,_0x29227e){return function(_0x32d9bf){if(_0x32d9bf){return _0x32d9bf[_0x311f('0x25')]()[_0x311f('0x26')](function(){_0x4ddf62[_0x311f('0x1a')](0xcc)[_0x311f('0x1b')]();});}};}function handleEntityNotFound(_0x59023e,_0x5a3319){return function(_0x5dd17d){if(!_0x5dd17d){_0x59023e[_0x311f('0x19')](0x194);}return _0x5dd17d;};}function handleError(_0x4429d3,_0x5ece19){_0x5ece19=_0x5ece19||0x1f4;return function(_0x10da88){logger[_0x311f('0x27')](_0x10da88[_0x311f('0x28')]);if(_0x10da88['name']){delete _0x10da88[_0x311f('0x29')];}_0x4429d3['status'](_0x5ece19)[_0x311f('0x2a')](_0x10da88);};}exports[_0x311f('0x2b')]=function(_0x12d14e,_0x583353){var _0x3a4ca5={},_0x1b1b88={},_0x22341e={'count':0x0,'rows':[]};var _0x536b4b=_['map'](db[_0x311f('0x2c')]['rawAttributes'],function(_0x9b611f){return{'name':_0x9b611f[_0x311f('0x2d')],'type':_0x9b611f[_0x311f('0x2e')][_0x311f('0x2f')]};});_0x1b1b88['model']=_[_0x311f('0x30')](_0x536b4b,'name');_0x1b1b88[_0x311f('0x31')]=_[_0x311f('0x32')](_0x12d14e[_0x311f('0x31')]);_0x1b1b88['filters']=_[_0x311f('0x33')](_0x1b1b88['model'],_0x1b1b88[_0x311f('0x31')]);_0x3a4ca5[_0x311f('0x34')]=_[_0x311f('0x33')](_0x1b1b88[_0x311f('0x35')],qs['fields'](_0x12d14e[_0x311f('0x31')]['fields']));_0x3a4ca5[_0x311f('0x34')]=_0x3a4ca5[_0x311f('0x34')][_0x311f('0x36')]?_0x3a4ca5['attributes']:_0x1b1b88[_0x311f('0x35')];if(!_0x12d14e[_0x311f('0x31')][_0x311f('0x37')](_0x311f('0x38'))){_0x3a4ca5[_0x311f('0x1f')]=qs['limit'](_0x12d14e[_0x311f('0x31')][_0x311f('0x1f')]);_0x3a4ca5[_0x311f('0x1e')]=qs[_0x311f('0x1e')](_0x12d14e[_0x311f('0x31')][_0x311f('0x1e')]);}_0x3a4ca5[_0x311f('0x39')]=qs[_0x311f('0x3a')](_0x12d14e['query'][_0x311f('0x3a')]);_0x3a4ca5[_0x311f('0x3b')]=qs['filters'](_['pick'](_0x12d14e[_0x311f('0x31')],_0x1b1b88[_0x311f('0x3c')]));if(_0x12d14e[_0x311f('0x31')][_0x311f('0x3d')]){_0x3a4ca5['where']=_[_0x311f('0x3e')](_0x3a4ca5[_0x311f('0x3b')],{'$or':_[_0x311f('0x30')](_0x536b4b,function(_0x1a58a8){if(_0x1a58a8[_0x311f('0x2e')]!==_0x311f('0x3f')){var _0x3c4f46={};_0x3c4f46[_0x1a58a8['name']]={'$like':'%'+_0x12d14e[_0x311f('0x31')][_0x311f('0x3d')]+'%'};return _0x3c4f46;}})});}_0x3a4ca5=_[_0x311f('0x3e')]({},_0x3a4ca5,_0x12d14e[_0x311f('0x40')]);var _0x2a4982={'where':_0x3a4ca5[_0x311f('0x3b')]};return db[_0x311f('0x2c')][_0x311f('0x1d')](_0x2a4982)[_0x311f('0x26')](function(_0x3a57ce){_0x22341e[_0x311f('0x1d')]=_0x3a57ce;if(_0x12d14e[_0x311f('0x31')][_0x311f('0x41')]){_0x3a4ca5[_0x311f('0x42')]=[{'all':!![]}];}return db[_0x311f('0x2c')][_0x311f('0x43')](_0x3a4ca5);})[_0x311f('0x26')](function(_0xb01961){_0x22341e[_0x311f('0x44')]=_0xb01961;return _0x22341e;})[_0x311f('0x26')](respondWithFilteredResult(_0x583353,_0x3a4ca5))[_0x311f('0x45')](handleError(_0x583353,null));};exports[_0x311f('0x46')]=function(_0x1c2e5f,_0x599ad8){var _0x206660={'raw':![],'where':{'id':_0x1c2e5f['params']['id']}},_0x3ee59b={};_0x3ee59b['model']=_[_0x311f('0x32')](db[_0x311f('0x2c')][_0x311f('0x47')]);_0x3ee59b[_0x311f('0x31')]=_[_0x311f('0x32')](_0x1c2e5f[_0x311f('0x31')]);_0x3ee59b['filters']=_['intersection'](_0x3ee59b[_0x311f('0x35')],_0x3ee59b[_0x311f('0x31')]);_0x206660[_0x311f('0x34')]=_[_0x311f('0x33')](_0x3ee59b[_0x311f('0x35')],qs[_0x311f('0x48')](_0x1c2e5f['query'][_0x311f('0x48')]));_0x206660[_0x311f('0x34')]=_0x206660['attributes'][_0x311f('0x36')]?_0x206660['attributes']:_0x3ee59b[_0x311f('0x35')];if(_0x1c2e5f['query'][_0x311f('0x41')]){_0x206660[_0x311f('0x42')]=[{'all':!![]}];}_0x206660=_[_0x311f('0x3e')]({},_0x206660,_0x1c2e5f['options']);return db['AnalyticFieldReport'][_0x311f('0x49')](_0x206660)[_0x311f('0x26')](handleEntityNotFound(_0x599ad8,null))[_0x311f('0x26')](respondWithResult(_0x599ad8,null))['catch'](handleError(_0x599ad8,null));};exports['create']=function(_0x349c79,_0x305b66){return db[_0x311f('0x2c')][_0x311f('0x4a')](_0x349c79[_0x311f('0x4b')],{})[_0x311f('0x26')](respondWithResult(_0x305b66,0xc9))[_0x311f('0x45')](handleError(_0x305b66,null));};exports['bulkCreate']=function(_0x52cea4,_0x5cdfeb){return db[_0x311f('0x2c')]['bulkCreate'](_0x52cea4[_0x311f('0x4b')],{'raw':![],'individualHooks':!![]})[_0x311f('0x26')](respondWithResult(_0x5cdfeb,0xc9))['catch'](handleError(_0x5cdfeb,null));};exports['update']=function(_0x4f2d49,_0x381144){if(_0x4f2d49['body']['id']){delete _0x4f2d49[_0x311f('0x4b')]['id'];}return db[_0x311f('0x2c')][_0x311f('0x49')]({'where':{'id':_0x4f2d49['params']['id']}})[_0x311f('0x26')](handleEntityNotFound(_0x381144,null))[_0x311f('0x26')](saveUpdates(_0x4f2d49[_0x311f('0x4b')],null))[_0x311f('0x26')](respondWithResult(_0x381144,null))[_0x311f('0x45')](handleError(_0x381144,null));};exports[_0x311f('0x25')]=function(_0x379c3e,_0x1d44a6){return db[_0x311f('0x2c')]['find']({'where':{'id':_0x379c3e[_0x311f('0x4c')]['id']}})[_0x311f('0x26')](handleEntityNotFound(_0x1d44a6,null))[_0x311f('0x26')](removeEntity(_0x1d44a6,null))['catch'](handleError(_0x1d44a6,null));};exports['bulkDestroy']=function(_0x1f829a,_0x45374b){return db[_0x311f('0x2c')][_0x311f('0x25')]({'where':{'id':_0x1f829a[_0x311f('0x31')][_0x311f('0x4d')]||[]},'raw':![],'individualHooks':!![]})[_0x311f('0x26')](respondWithResult(_0x45374b,0xcc))[_0x311f('0x45')](handleError(_0x45374b,null));};exports[_0x311f('0x4e')]=function(_0x5f1f63,_0x23ce45,_0xd5e2bc){return db[_0x311f('0x4f')]['findOne']({'where':{'id':_0x5f1f63[_0x311f('0x4c')]['id']}})[_0x311f('0x26')](handleEntityNotFound(_0x23ce45,null))[_0x311f('0x26')](function(_0x5401f1){if(_0x5401f1){return db[_0x311f('0x50')][_0x311f('0x51')](function(_0x5b2ad8){return db[_0x311f('0x2c')]['destroy']({'where':{'CustomReportId':_0x5f1f63[_0x311f('0x4c')]['id']},'transaction':_0x5b2ad8})[_0x311f('0x26')](function(_0x367f6e){var _0xf15a5e=_[_0x311f('0x30')](_0x5f1f63[_0x311f('0x4b')],function(_0x4ab7be){delete _0x4ab7be['id'];_0x4ab7be[_0x311f('0x52')]=_0x5f1f63[_0x311f('0x4c')]['id'];return _0x4ab7be;});return db[_0x311f('0x2c')][_0x311f('0x53')](_0xf15a5e,{'transaction':_0x5b2ad8});});})[_0x311f('0x26')](function(){return db[_0x311f('0x2c')][_0x311f('0x43')]({'where':{'CustomReportId':_0x5f1f63['params']['id']}});});}})[_0x311f('0x26')](respondWithResult(_0x23ce45,null))[_0x311f('0x45')](handleError(_0x23ce45,null));}; \ No newline at end of file diff --git a/server/api/analyticFieldReport/analyticFieldReport.model.js b/server/api/analyticFieldReport/analyticFieldReport.model.js index 3a7f318..589a20f 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 _0x48c9=['AnalyticFieldReport','analytics_report_fields','lodash','util','../../config/logger','api','moment','bluebird','path','rimraf','../../config/environment','./analyticFieldReport.attributes','exports'];(function(_0x3d0eba,_0x4d2aa3){var _0x130c97=function(_0x146147){while(--_0x146147){_0x3d0eba['push'](_0x3d0eba['shift']());}};_0x130c97(++_0x4d2aa3);}(_0x48c9,0x106));var _0x948c=function(_0x560fc6,_0x59bd68){_0x560fc6=_0x560fc6-0x0;var _0x14d08a=_0x48c9[_0x560fc6];return _0x14d08a;};'use strict';var _=require(_0x948c('0x0'));var util=require(_0x948c('0x1'));var logger=require(_0x948c('0x2'))(_0x948c('0x3'));var moment=require(_0x948c('0x4'));var BPromise=require(_0x948c('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x948c('0x6'));var rimraf=require(_0x948c('0x7'));var config=require(_0x948c('0x8'));var attributes=require(_0x948c('0x9'));module[_0x948c('0xa')]=function(_0x468afc,_0x3b2369){return _0x468afc['define'](_0x948c('0xb'),attributes,{'tableName':_0x948c('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x7661=['AnalyticFieldReport','analytics_report_fields','lodash','util','moment','bluebird','request-promise','path','rimraf','../../config/environment','./analyticFieldReport.attributes','exports','define'];(function(_0x95bf5d,_0x43839b){var _0x29a35f=function(_0x2e94d5){while(--_0x2e94d5){_0x95bf5d['push'](_0x95bf5d['shift']());}};_0x29a35f(++_0x43839b);}(_0x7661,0xb8));var _0x1766=function(_0x2b6712,_0x35179c){_0x2b6712=_0x2b6712-0x0;var _0x13ba34=_0x7661[_0x2b6712];return _0x13ba34;};'use strict';var _=require(_0x1766('0x0'));var util=require(_0x1766('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0x1766('0x2'));var BPromise=require(_0x1766('0x3'));var rp=require(_0x1766('0x4'));var fs=require('fs');var path=require(_0x1766('0x5'));var rimraf=require(_0x1766('0x6'));var config=require(_0x1766('0x7'));var attributes=require(_0x1766('0x8'));module[_0x1766('0x9')]=function(_0xa6f3ac,_0x3f038f){return _0xa6f3ac[_0x1766('0xa')](_0x1766('0xb'),attributes,{'tableName':_0x1766('0xc'),'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 9f3882c..04db486 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 _0x98cf=['ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','client','request','then','info','AnalyticFieldReport,\x20%s,\x20%s','debug','AnalyticFieldReport,\x20%s,\x20%s,\x20%s','request\x20sent','error','message','catch','util','moment','bluebird'];(function(_0xc4001c,_0x1bf8f0){var _0x49f7bc=function(_0x1059b8){while(--_0x1059b8){_0xc4001c['push'](_0xc4001c['shift']());}};_0x49f7bc(++_0x1bf8f0);}(_0x98cf,0x153));var _0xf98c=function(_0x5e7283,_0x1a8836){_0x5e7283=_0x5e7283-0x0;var _0x748d7a=_0x98cf[_0x5e7283];return _0x748d7a;};'use strict';var _=require('lodash');var util=require(_0xf98c('0x0'));var moment=require(_0xf98c('0x1'));var BPromise=require(_0xf98c('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xf98c('0x3'));var db=require(_0xf98c('0x4'))['db'];var utils=require(_0xf98c('0x5'));var logger=require(_0xf98c('0x6'))(_0xf98c('0x7'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0xf98c('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0xd242a7,_0x1bb3f9,_0x190f71){return new BPromise(function(_0x5ad89e,_0x5a29d7){return client[_0xf98c('0x9')](_0xd242a7,_0x190f71)[_0xf98c('0xa')](function(_0x58a9e7){logger[_0xf98c('0xb')](_0xf98c('0xc'),_0x1bb3f9,'request\x20sent');logger[_0xf98c('0xd')](_0xf98c('0xe'),_0x1bb3f9,_0xf98c('0xf'),JSON['stringify'](_0x58a9e7));if(_0x58a9e7[_0xf98c('0x10')]){if(_0x58a9e7[_0xf98c('0x10')]['code']===0x1f4){logger[_0xf98c('0x10')](_0xf98c('0xc'),_0x1bb3f9,_0x58a9e7['error'][_0xf98c('0x11')]);return _0x5a29d7(_0x58a9e7[_0xf98c('0x10')][_0xf98c('0x11')]);}logger[_0xf98c('0x10')](_0xf98c('0xc'),_0x1bb3f9,_0x58a9e7['error']['message']);return _0x5ad89e(_0x58a9e7['error'][_0xf98c('0x11')]);}else{logger[_0xf98c('0xb')](_0xf98c('0xc'),_0x1bb3f9,'request\x20sent');_0x5ad89e(_0x58a9e7['result']['message']);}})[_0xf98c('0x12')](function(_0xf0da6b){logger['error'](_0xf98c('0xc'),_0x1bb3f9,_0xf0da6b);_0x5a29d7(_0xf0da6b);});});} \ No newline at end of file +var _0x3834=['AnalyticFieldReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','info','AnalyticFieldReport,\x20%s,\x20%s','request\x20sent','debug'];(function(_0x39e277,_0x934199){var _0x30ebbd=function(_0x223c58){while(--_0x223c58){_0x39e277['push'](_0x39e277['shift']());}};_0x30ebbd(++_0x934199);}(_0x3834,0x13f));var _0x4383=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x3834[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x4383('0x0'));var util=require('util');var moment=require(_0x4383('0x1'));var BPromise=require(_0x4383('0x2'));var rs=require(_0x4383('0x3'));var fs=require('fs');var Redis=require(_0x4383('0x4'));var db=require(_0x4383('0x5'))['db'];var utils=require(_0x4383('0x6'));var logger=require(_0x4383('0x7'))(_0x4383('0x8'));var config=require(_0x4383('0x9'));var jayson=require(_0x4383('0xa'));var client=jayson[_0x4383('0xb')][_0x4383('0xc')]({'port':0x232a});function respondWithRpcPromise(_0xdde444,_0x5a11d4,_0x2d4475){return new BPromise(function(_0x53c2e0,_0x4586ce){return client['request'](_0xdde444,_0x2d4475)['then'](function(_0x573476){logger[_0x4383('0xd')](_0x4383('0xe'),_0x5a11d4,_0x4383('0xf'));logger[_0x4383('0x10')](_0x4383('0x11'),_0x5a11d4,_0x4383('0xf'),JSON[_0x4383('0x12')](_0x573476));if(_0x573476[_0x4383('0x13')]){if(_0x573476[_0x4383('0x13')][_0x4383('0x14')]===0x1f4){logger[_0x4383('0x13')](_0x4383('0xe'),_0x5a11d4,_0x573476[_0x4383('0x13')][_0x4383('0x15')]);return _0x4586ce(_0x573476[_0x4383('0x13')][_0x4383('0x15')]);}logger[_0x4383('0x13')](_0x4383('0xe'),_0x5a11d4,_0x573476[_0x4383('0x13')][_0x4383('0x15')]);return _0x53c2e0(_0x573476[_0x4383('0x13')][_0x4383('0x15')]);}else{logger[_0x4383('0xd')](_0x4383('0xe'),_0x5a11d4,_0x4383('0xf'));_0x53c2e0(_0x573476[_0x4383('0x16')]['message']);}})[_0x4383('0x17')](function(_0x2167ee){logger['error'](_0x4383('0xe'),_0x5a11d4,_0x2167ee);_0x4586ce(_0x2167ee);});});} \ No newline at end of file diff --git a/server/api/analyticFieldReport/index.js b/server/api/analyticFieldReport/index.js index 85ee9c9..a8e1bdb 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(_0x1a1b6e,_0x3a07a9){_0x1a1b6e=_0x1a1b6e-0x0;var _0x571e2c=_0x55ca[_0x1a1b6e];return _0x571e2c;};'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 _0x5fc3=['get','isAuthenticated','/:id','show','post','create','/create_many','/:id/create_many','addFields','put','update','delete','destroy','exports','multer','util','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','./analyticFieldReport.controller'];(function(_0x358230,_0x4769b8){var _0x55791b=function(_0x233fc3){while(--_0x233fc3){_0x358230['push'](_0x358230['shift']());}};_0x55791b(++_0x4769b8);}(_0x5fc3,0xa8));var _0x35fc=function(_0x25d2fb,_0x18a774){_0x25d2fb=_0x25d2fb-0x0;var _0x1ded53=_0x5fc3[_0x25d2fb];return _0x1ded53;};'use strict';var multer=require(_0x35fc('0x0'));var util=require(_0x35fc('0x1'));var path=require('path');var timeout=require(_0x35fc('0x2'));var express=require(_0x35fc('0x3'));var router=express[_0x35fc('0x4')]();var auth=require(_0x35fc('0x5'));var interaction=require(_0x35fc('0x6'));var config=require('../../config/environment');var controller=require(_0x35fc('0x7'));router[_0x35fc('0x8')]('/',auth[_0x35fc('0x9')](),controller['index']);router['get'](_0x35fc('0xa'),auth['isAuthenticated'](),controller[_0x35fc('0xb')]);router[_0x35fc('0xc')]('/',auth[_0x35fc('0x9')](),controller[_0x35fc('0xd')]);router[_0x35fc('0xc')](_0x35fc('0xe'),auth[_0x35fc('0x9')](),controller['bulkCreate']);router[_0x35fc('0xc')](_0x35fc('0xf'),auth['isAuthenticated'](),controller[_0x35fc('0x10')]);router[_0x35fc('0x11')]('/:id',auth[_0x35fc('0x9')](),controller[_0x35fc('0x12')]);router['delete']('/destroy_many',auth[_0x35fc('0x9')](),controller['bulkDestroy']);router[_0x35fc('0x13')](_0x35fc('0xa'),auth[_0x35fc('0x9')](),controller[_0x35fc('0x14')]);module[_0x35fc('0x15')]=router; \ No newline at end of file diff --git a/server/api/analyticMetric/analyticMetric.attributes.js b/server/api/analyticMetric/analyticMetric.attributes.js index 0ca534d..8b52728 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 _0xdabc=['STRING','name','TEXT','exports'];(function(_0x45408c,_0x450cde){var _0x1567c5=function(_0x18670b){while(--_0x18670b){_0x45408c['push'](_0x45408c['shift']());}};_0x1567c5(++_0x450cde);}(_0xdabc,0x16b));var _0xcdab=function(_0x12aa66,_0x2d35c1){_0x12aa66=_0x12aa66-0x0;var _0x53dfe9=_0xdabc[_0x12aa66];return _0x53dfe9;};'use strict';var Sequelize=require('sequelize');module[_0xcdab('0x0')]={'name':{'type':Sequelize[_0xcdab('0x1')],'allowNull':![],'unique':_0xcdab('0x2')},'table':{'type':Sequelize['STRING']},'metric':{'type':Sequelize[_0xcdab('0x3')]},'description':{'type':Sequelize[_0xcdab('0x1')]}}; \ No newline at end of file +var _0xee64=['STRING','name','TEXT','sequelize','exports'];(function(_0x19e35c,_0x29cd1e){var _0x3e1fe8=function(_0x17258b){while(--_0x17258b){_0x19e35c['push'](_0x19e35c['shift']());}};_0x3e1fe8(++_0x29cd1e);}(_0xee64,0x14d));var _0x4ee6=function(_0x3ab51d,_0x2fa01d){_0x3ab51d=_0x3ab51d-0x0;var _0x29a04e=_0xee64[_0x3ab51d];return _0x29a04e;};'use strict';var Sequelize=require(_0x4ee6('0x0'));module[_0x4ee6('0x1')]={'name':{'type':Sequelize[_0x4ee6('0x2')],'allowNull':![],'unique':_0x4ee6('0x3')},'table':{'type':Sequelize[_0x4ee6('0x2')]},'metric':{'type':Sequelize[_0x4ee6('0x4')]},'description':{'type':Sequelize[_0x4ee6('0x2')]}}; \ No newline at end of file diff --git a/server/api/analyticMetric/analyticMetric.controller.js b/server/api/analyticMetric/analyticMetric.controller.js index e83f55f..9bf4525 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 _0xd67c=['send','map','AnalyticMetric','rawAttributes','fieldName','model','keys','query','fields','attributes','length','nolimit','sort','filters','pick','merge','where','type','filter','count','includeAll','include','findAll','rows','params','intersection','options','find','catch','create','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','Metrics','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','body','html-pdf','eml-format','rimraf','zip-dir','bluebird','mustache','path','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../config/environment','sendStatus','end','status','json','offset','limit','Content-Range','apply','reject','save','destroy','then','get','UserProfileResource','name'];(function(_0x1874b8,_0x2f5ac7){var _0x3b76be=function(_0x5d9753){while(--_0x5d9753){_0x1874b8['push'](_0x1874b8['shift']());}};_0x3b76be(++_0x2f5ac7);}(_0xd67c,0x157));var _0xcd67=function(_0x17e0ff,_0x4dbd1e){_0x17e0ff=_0x17e0ff-0x0;var _0x357979=_0xd67c[_0x17e0ff];return _0x357979;};'use strict';var pdf=require(_0xcd67('0x0'));var emlformat=require(_0xcd67('0x1'));var rimraf=require(_0xcd67('0x2'));var zipdir=require(_0xcd67('0x3'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0xcd67('0x4'));var Mustache=require(_0xcd67('0x5'));var util=require('util');var path=require(_0xcd67('0x6'));var sox=require('sox');var csv=require(_0xcd67('0x7'));var ejs=require(_0xcd67('0x8'));var fs=require('fs');var _=require(_0xcd67('0x9'));var squel=require(_0xcd67('0xa'));var crypto=require(_0xcd67('0xb'));var jsforce=require(_0xcd67('0xc'));var deskjs=require(_0xcd67('0xd'));var toCsv=require(_0xcd67('0x7'));var querystring=require(_0xcd67('0xe'));var Papa=require(_0xcd67('0xf'));var Redis=require('ioredis');var authService=require(_0xcd67('0x10'));var qs=require(_0xcd67('0x11'));var as=require(_0xcd67('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xcd67('0x13'))('api');var utils=require(_0xcd67('0x14'));var config=require(_0xcd67('0x15'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x5d4d36,_0x59b347){_0x59b347=_0x59b347||0xcc;return function(_0x358734){if(_0x358734){return _0x5d4d36[_0xcd67('0x16')](_0x59b347);}return _0x5d4d36['status'](_0x59b347)[_0xcd67('0x17')]();};}function respondWithResult(_0x55b377,_0x1a6f35){_0x1a6f35=_0x1a6f35||0xc8;return function(_0x3a4baf){if(_0x3a4baf){return _0x55b377[_0xcd67('0x18')](_0x1a6f35)[_0xcd67('0x19')](_0x3a4baf);}};}function respondWithFilteredResult(_0x79bfe5,_0x142717){return function(_0x3ff292){if(_0x3ff292){var _0x51f166=_0x3ff292['count'],_0x3fe621=_0x142717[_0xcd67('0x1a')],_0x30583f=_0x142717[_0xcd67('0x1a')]+_0x142717[_0xcd67('0x1b')],_0x4f1265;if(_0x30583f>=_0x51f166){_0x30583f=_0x51f166;_0x4f1265=0xc8;}else{_0x4f1265=0xce;}_0x79bfe5['status'](_0x4f1265);return _0x79bfe5['set'](_0xcd67('0x1c'),_0x3fe621+'-'+_0x30583f+'/'+_0x51f166)[_0xcd67('0x19')](_0x3ff292);}return null;};}function patchUpdates(_0x10e24a){return function(_0x4b6dae){try{jsonpatch[_0xcd67('0x1d')](_0x4b6dae,_0x10e24a,!![]);}catch(_0x33d3c4){return BPromise[_0xcd67('0x1e')](_0x33d3c4);}return _0x4b6dae[_0xcd67('0x1f')]();};}function saveUpdates(_0x4955d1,_0x50994d){return function(_0x25ea88){if(_0x25ea88){return _0x25ea88['update'](_0x4955d1)['then'](function(_0x4751bb){return _0x4751bb;});}return null;};}function removeEntity(_0x472e1a,_0x47d16b){return function(_0x13fdfd){if(_0x13fdfd){return _0x13fdfd[_0xcd67('0x20')]()[_0xcd67('0x21')](function(){var _0x3de6e6=_0x13fdfd[_0xcd67('0x22')]({'plain':!![]});var _0xd22738='Metrics';return db[_0xcd67('0x23')][_0xcd67('0x20')]({'where':{'type':_0xd22738,'resourceId':_0x3de6e6['id']}})['then'](function(){return _0x13fdfd;});})[_0xcd67('0x21')](function(){_0x472e1a[_0xcd67('0x18')](0xcc)['end']();});}};}function handleEntityNotFound(_0x20faa3,_0x3e2dd5){return function(_0x291f0e){if(!_0x291f0e){_0x20faa3['sendStatus'](0x194);}return _0x291f0e;};}function handleError(_0x235538,_0x10964d){_0x10964d=_0x10964d||0x1f4;return function(_0x504fc9){logger['error'](_0x504fc9['stack']);if(_0x504fc9[_0xcd67('0x24')]){delete _0x504fc9[_0xcd67('0x24')];}_0x235538[_0xcd67('0x18')](_0x10964d)[_0xcd67('0x25')](_0x504fc9);};}exports['index']=function(_0x548bcf,_0x353e6c){var _0x3c737c={},_0x55f12d={},_0x452c8a={'count':0x0,'rows':[]};var _0x219612=_[_0xcd67('0x26')](db[_0xcd67('0x27')][_0xcd67('0x28')],function(_0x414725){return{'name':_0x414725[_0xcd67('0x29')],'type':_0x414725['type']['key']};});_0x55f12d[_0xcd67('0x2a')]=_[_0xcd67('0x26')](_0x219612,_0xcd67('0x24'));_0x55f12d['query']=_[_0xcd67('0x2b')](_0x548bcf[_0xcd67('0x2c')]);_0x55f12d['filters']=_['intersection'](_0x55f12d['model'],_0x55f12d[_0xcd67('0x2c')]);_0x3c737c['attributes']=_['intersection'](_0x55f12d['model'],qs[_0xcd67('0x2d')](_0x548bcf[_0xcd67('0x2c')][_0xcd67('0x2d')]));_0x3c737c['attributes']=_0x3c737c[_0xcd67('0x2e')][_0xcd67('0x2f')]?_0x3c737c[_0xcd67('0x2e')]:_0x55f12d[_0xcd67('0x2a')];if(!_0x548bcf[_0xcd67('0x2c')]['hasOwnProperty'](_0xcd67('0x30'))){_0x3c737c[_0xcd67('0x1b')]=qs[_0xcd67('0x1b')](_0x548bcf[_0xcd67('0x2c')][_0xcd67('0x1b')]);_0x3c737c[_0xcd67('0x1a')]=qs[_0xcd67('0x1a')](_0x548bcf['query'][_0xcd67('0x1a')]);}_0x3c737c['order']=qs['sort'](_0x548bcf[_0xcd67('0x2c')][_0xcd67('0x31')]);_0x3c737c['where']=qs[_0xcd67('0x32')](_[_0xcd67('0x33')](_0x548bcf[_0xcd67('0x2c')],_0x55f12d[_0xcd67('0x32')]));if(_0x548bcf[_0xcd67('0x2c')]['filter']){_0x3c737c['where']=_[_0xcd67('0x34')](_0x3c737c[_0xcd67('0x35')],{'$or':_[_0xcd67('0x26')](_0x219612,function(_0x58713a){if(_0x58713a[_0xcd67('0x36')]!=='VIRTUAL'){var _0x4ecc57={};_0x4ecc57[_0x58713a[_0xcd67('0x24')]]={'$like':'%'+_0x548bcf['query'][_0xcd67('0x37')]+'%'};return _0x4ecc57;}})});}_0x3c737c=_[_0xcd67('0x34')]({},_0x3c737c,_0x548bcf['options']);var _0x4b9078={'where':_0x3c737c[_0xcd67('0x35')]};return db[_0xcd67('0x27')]['count'](_0x4b9078)[_0xcd67('0x21')](function(_0x271eb2){_0x452c8a[_0xcd67('0x38')]=_0x271eb2;if(_0x548bcf['query'][_0xcd67('0x39')]){_0x3c737c[_0xcd67('0x3a')]=[{'all':!![]}];}return db['AnalyticMetric'][_0xcd67('0x3b')](_0x3c737c);})['then'](function(_0x32e6c7){_0x452c8a[_0xcd67('0x3c')]=_0x32e6c7;return _0x452c8a;})[_0xcd67('0x21')](respondWithFilteredResult(_0x353e6c,_0x3c737c))['catch'](handleError(_0x353e6c,null));};exports['show']=function(_0x3b030f,_0x35f07b){var _0x15d360={'raw':!![],'where':{'id':_0x3b030f[_0xcd67('0x3d')]['id']}},_0x2a85e6={};_0x2a85e6[_0xcd67('0x2a')]=_[_0xcd67('0x2b')](db['AnalyticMetric'][_0xcd67('0x28')]);_0x2a85e6[_0xcd67('0x2c')]=_[_0xcd67('0x2b')](_0x3b030f[_0xcd67('0x2c')]);_0x2a85e6['filters']=_[_0xcd67('0x3e')](_0x2a85e6[_0xcd67('0x2a')],_0x2a85e6[_0xcd67('0x2c')]);_0x15d360[_0xcd67('0x2e')]=_[_0xcd67('0x3e')](_0x2a85e6[_0xcd67('0x2a')],qs[_0xcd67('0x2d')](_0x3b030f[_0xcd67('0x2c')][_0xcd67('0x2d')]));_0x15d360['attributes']=_0x15d360[_0xcd67('0x2e')]['length']?_0x15d360['attributes']:_0x2a85e6[_0xcd67('0x2a')];if(_0x3b030f[_0xcd67('0x2c')][_0xcd67('0x39')]){_0x15d360['include']=[{'all':!![]}];}_0x15d360=_[_0xcd67('0x34')]({},_0x15d360,_0x3b030f[_0xcd67('0x3f')]);return db['AnalyticMetric'][_0xcd67('0x40')](_0x15d360)[_0xcd67('0x21')](handleEntityNotFound(_0x35f07b,null))['then'](respondWithResult(_0x35f07b,null))[_0xcd67('0x41')](handleError(_0x35f07b,null));};exports[_0xcd67('0x42')]=function(_0x54d6e9,_0xa628b6){return db[_0xcd67('0x27')][_0xcd67('0x42')](_0x54d6e9['body'],{})[_0xcd67('0x21')](function(_0x81dbea){var _0x379121=_0x54d6e9['user'][_0xcd67('0x22')]({'plain':!![]});if(!_0x379121)throw new Error(_0xcd67('0x43'));if(_0x379121[_0xcd67('0x44')]===_0xcd67('0x45')){var _0x38921b=_0x81dbea[_0xcd67('0x22')]({'plain':!![]});var _0x2ad715=_0xcd67('0x46');return db['UserProfileSection'][_0xcd67('0x40')]({'where':{'name':_0x2ad715,'userProfileId':_0x379121[_0xcd67('0x47')]},'raw':!![]})[_0xcd67('0x21')](function(_0x1f34f0){if(_0x1f34f0&&_0x1f34f0[_0xcd67('0x48')]===0x0){return db[_0xcd67('0x23')][_0xcd67('0x42')]({'name':_0x38921b[_0xcd67('0x24')],'resourceId':_0x38921b['id'],'type':_0x1f34f0[_0xcd67('0x24')],'sectionId':_0x1f34f0['id']},{})[_0xcd67('0x21')](function(){return _0x81dbea;});}else{return _0x81dbea;}})['catch'](function(_0x47df1c){logger['error'](_0xcd67('0x49'),_0x47df1c);throw _0x47df1c;});}return _0x81dbea;})[_0xcd67('0x21')](respondWithResult(_0xa628b6,0xc9))[_0xcd67('0x41')](handleError(_0xa628b6,null));};exports[_0xcd67('0x4a')]=function(_0x53fb38,_0xc22e56){if(_0x53fb38['body']['id']){delete _0x53fb38[_0xcd67('0x4b')]['id'];}return db[_0xcd67('0x27')][_0xcd67('0x40')]({'where':{'id':_0x53fb38[_0xcd67('0x3d')]['id']}})[_0xcd67('0x21')](handleEntityNotFound(_0xc22e56,null))['then'](saveUpdates(_0x53fb38['body'],null))['then'](respondWithResult(_0xc22e56,null))['catch'](handleError(_0xc22e56,null));};exports[_0xcd67('0x20')]=function(_0x1de33e,_0x59b50f){return db['AnalyticMetric'][_0xcd67('0x40')]({'where':{'id':_0x1de33e[_0xcd67('0x3d')]['id']}})[_0xcd67('0x21')](handleEntityNotFound(_0x59b50f,null))[_0xcd67('0x21')](removeEntity(_0x59b50f,null))[_0xcd67('0x41')](handleError(_0x59b50f,null));}; \ No newline at end of file +var _0xc66f=['sort','where','filter','merge','VIRTUAL','options','AnalyticMetric','include','rows','catch','show','params','includeAll','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','find','userProfileId','autoAssociation','UserProfileResource','update','html-pdf','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','sox','to-csv','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../mysqldb','sendStatus','status','json','count','offset','set','Content-Range','apply','reject','then','destroy','get','Metrics','end','error','stack','name','index','map','rawAttributes','type','key','model','query','keys','filters','intersection','fields','attributes','length','nolimit','limit'];(function(_0x122ef9,_0x451d2a){var _0x42fba0=function(_0x17c9d3){while(--_0x17c9d3){_0x122ef9['push'](_0x122ef9['shift']());}};_0x42fba0(++_0x451d2a);}(_0xc66f,0xb9));var _0xfc66=function(_0x4d8689,_0x35e241){_0x4d8689=_0x4d8689-0x0;var _0x351a5f=_0xc66f[_0x4d8689];return _0x351a5f;};'use strict';var pdf=require(_0xfc66('0x0'));var emlformat=require('eml-format');var rimraf=require(_0xfc66('0x1'));var zipdir=require(_0xfc66('0x2'));var jsonpatch=require(_0xfc66('0x3'));var rp=require('request-promise');var moment=require(_0xfc66('0x4'));var BPromise=require(_0xfc66('0x5'));var Mustache=require(_0xfc66('0x6'));var util=require(_0xfc66('0x7'));var path=require(_0xfc66('0x8'));var sox=require(_0xfc66('0x9'));var csv=require(_0xfc66('0xa'));var ejs=require('ejs');var fs=require('fs');var _=require(_0xfc66('0xb'));var squel=require(_0xfc66('0xc'));var crypto=require(_0xfc66('0xd'));var jsforce=require(_0xfc66('0xe'));var deskjs=require(_0xfc66('0xf'));var toCsv=require('to-csv');var querystring=require(_0xfc66('0x10'));var Papa=require(_0xfc66('0x11'));var Redis=require(_0xfc66('0x12'));var authService=require(_0xfc66('0x13'));var qs=require('../../components/parsers/qs');var as=require(_0xfc66('0x14'));var hardwareService=require(_0xfc66('0x15'));var logger=require(_0xfc66('0x16'))(_0xfc66('0x17'));var utils=require('../../config/utils');var config=require(_0xfc66('0x18'));var db=require(_0xfc66('0x19'))['db'];function respondWithStatusCode(_0x1512ef,_0x5b513e){_0x5b513e=_0x5b513e||0xcc;return function(_0x138fab){if(_0x138fab){return _0x1512ef[_0xfc66('0x1a')](_0x5b513e);}return _0x1512ef[_0xfc66('0x1b')](_0x5b513e)['end']();};}function respondWithResult(_0x55e3a6,_0x3ab3e4){_0x3ab3e4=_0x3ab3e4||0xc8;return function(_0x1fdeed){if(_0x1fdeed){return _0x55e3a6[_0xfc66('0x1b')](_0x3ab3e4)[_0xfc66('0x1c')](_0x1fdeed);}};}function respondWithFilteredResult(_0x27723e,_0x18ef6d){return function(_0x4c7934){if(_0x4c7934){var _0x46ebe5=_0x4c7934[_0xfc66('0x1d')],_0x20ee86=_0x18ef6d['offset'],_0x450fbc=_0x18ef6d[_0xfc66('0x1e')]+_0x18ef6d['limit'],_0x5a04f6;if(_0x450fbc>=_0x46ebe5){_0x450fbc=_0x46ebe5;_0x5a04f6=0xc8;}else{_0x5a04f6=0xce;}_0x27723e[_0xfc66('0x1b')](_0x5a04f6);return _0x27723e[_0xfc66('0x1f')](_0xfc66('0x20'),_0x20ee86+'-'+_0x450fbc+'/'+_0x46ebe5)['json'](_0x4c7934);}return null;};}function patchUpdates(_0x22cfe0){return function(_0x580252){try{jsonpatch[_0xfc66('0x21')](_0x580252,_0x22cfe0,!![]);}catch(_0x1d32be){return BPromise[_0xfc66('0x22')](_0x1d32be);}return _0x580252['save']();};}function saveUpdates(_0x50fbc5,_0x53550c){return function(_0x43e753){if(_0x43e753){return _0x43e753['update'](_0x50fbc5)[_0xfc66('0x23')](function(_0x3af70a){return _0x3af70a;});}return null;};}function removeEntity(_0x4d9605,_0x587cca){return function(_0x52f646){if(_0x52f646){return _0x52f646[_0xfc66('0x24')]()['then'](function(){var _0x32cec5=_0x52f646[_0xfc66('0x25')]({'plain':!![]});var _0x57448d=_0xfc66('0x26');return db['UserProfileResource'][_0xfc66('0x24')]({'where':{'type':_0x57448d,'resourceId':_0x32cec5['id']}})[_0xfc66('0x23')](function(){return _0x52f646;});})['then'](function(){_0x4d9605['status'](0xcc)[_0xfc66('0x27')]();});}};}function handleEntityNotFound(_0x3543a6,_0x228bad){return function(_0x185e72){if(!_0x185e72){_0x3543a6[_0xfc66('0x1a')](0x194);}return _0x185e72;};}function handleError(_0x25a670,_0x286e98){_0x286e98=_0x286e98||0x1f4;return function(_0x4d8133){logger[_0xfc66('0x28')](_0x4d8133[_0xfc66('0x29')]);if(_0x4d8133[_0xfc66('0x2a')]){delete _0x4d8133[_0xfc66('0x2a')];}_0x25a670[_0xfc66('0x1b')](_0x286e98)['send'](_0x4d8133);};}exports[_0xfc66('0x2b')]=function(_0x1c83bd,_0x3540cc){var _0x2567e0={},_0xf8c457={},_0x1a4ec4={'count':0x0,'rows':[]};var _0x4802b5=_[_0xfc66('0x2c')](db['AnalyticMetric'][_0xfc66('0x2d')],function(_0x3a4a09){return{'name':_0x3a4a09['fieldName'],'type':_0x3a4a09[_0xfc66('0x2e')][_0xfc66('0x2f')]};});_0xf8c457[_0xfc66('0x30')]=_[_0xfc66('0x2c')](_0x4802b5,_0xfc66('0x2a'));_0xf8c457[_0xfc66('0x31')]=_[_0xfc66('0x32')](_0x1c83bd[_0xfc66('0x31')]);_0xf8c457[_0xfc66('0x33')]=_['intersection'](_0xf8c457[_0xfc66('0x30')],_0xf8c457[_0xfc66('0x31')]);_0x2567e0['attributes']=_[_0xfc66('0x34')](_0xf8c457[_0xfc66('0x30')],qs[_0xfc66('0x35')](_0x1c83bd[_0xfc66('0x31')][_0xfc66('0x35')]));_0x2567e0[_0xfc66('0x36')]=_0x2567e0['attributes'][_0xfc66('0x37')]?_0x2567e0[_0xfc66('0x36')]:_0xf8c457['model'];if(!_0x1c83bd['query']['hasOwnProperty'](_0xfc66('0x38'))){_0x2567e0[_0xfc66('0x39')]=qs[_0xfc66('0x39')](_0x1c83bd['query']['limit']);_0x2567e0[_0xfc66('0x1e')]=qs[_0xfc66('0x1e')](_0x1c83bd[_0xfc66('0x31')]['offset']);}_0x2567e0['order']=qs[_0xfc66('0x3a')](_0x1c83bd[_0xfc66('0x31')][_0xfc66('0x3a')]);_0x2567e0[_0xfc66('0x3b')]=qs[_0xfc66('0x33')](_['pick'](_0x1c83bd[_0xfc66('0x31')],_0xf8c457[_0xfc66('0x33')]));if(_0x1c83bd[_0xfc66('0x31')][_0xfc66('0x3c')]){_0x2567e0[_0xfc66('0x3b')]=_[_0xfc66('0x3d')](_0x2567e0['where'],{'$or':_[_0xfc66('0x2c')](_0x4802b5,function(_0x320557){if(_0x320557[_0xfc66('0x2e')]!==_0xfc66('0x3e')){var _0x5343ef={};_0x5343ef[_0x320557['name']]={'$like':'%'+_0x1c83bd[_0xfc66('0x31')][_0xfc66('0x3c')]+'%'};return _0x5343ef;}})});}_0x2567e0=_[_0xfc66('0x3d')]({},_0x2567e0,_0x1c83bd[_0xfc66('0x3f')]);var _0x3f4af6={'where':_0x2567e0[_0xfc66('0x3b')]};return db[_0xfc66('0x40')][_0xfc66('0x1d')](_0x3f4af6)['then'](function(_0x3d9358){_0x1a4ec4[_0xfc66('0x1d')]=_0x3d9358;if(_0x1c83bd[_0xfc66('0x31')]['includeAll']){_0x2567e0[_0xfc66('0x41')]=[{'all':!![]}];}return db['AnalyticMetric']['findAll'](_0x2567e0);})[_0xfc66('0x23')](function(_0x21198a){_0x1a4ec4[_0xfc66('0x42')]=_0x21198a;return _0x1a4ec4;})[_0xfc66('0x23')](respondWithFilteredResult(_0x3540cc,_0x2567e0))[_0xfc66('0x43')](handleError(_0x3540cc,null));};exports[_0xfc66('0x44')]=function(_0x4e9890,_0xc9049c){var _0x5022e3={'raw':!![],'where':{'id':_0x4e9890[_0xfc66('0x45')]['id']}},_0x25f520={};_0x25f520[_0xfc66('0x30')]=_['keys'](db[_0xfc66('0x40')][_0xfc66('0x2d')]);_0x25f520[_0xfc66('0x31')]=_['keys'](_0x4e9890[_0xfc66('0x31')]);_0x25f520[_0xfc66('0x33')]=_[_0xfc66('0x34')](_0x25f520[_0xfc66('0x30')],_0x25f520[_0xfc66('0x31')]);_0x5022e3[_0xfc66('0x36')]=_[_0xfc66('0x34')](_0x25f520[_0xfc66('0x30')],qs['fields'](_0x4e9890[_0xfc66('0x31')][_0xfc66('0x35')]));_0x5022e3[_0xfc66('0x36')]=_0x5022e3[_0xfc66('0x36')][_0xfc66('0x37')]?_0x5022e3[_0xfc66('0x36')]:_0x25f520['model'];if(_0x4e9890['query'][_0xfc66('0x46')]){_0x5022e3[_0xfc66('0x41')]=[{'all':!![]}];}_0x5022e3=_[_0xfc66('0x3d')]({},_0x5022e3,_0x4e9890[_0xfc66('0x3f')]);return db['AnalyticMetric']['find'](_0x5022e3)[_0xfc66('0x23')](handleEntityNotFound(_0xc9049c,null))['then'](respondWithResult(_0xc9049c,null))['catch'](handleError(_0xc9049c,null));};exports['create']=function(_0x53c4be,_0x193eec){return db[_0xfc66('0x40')][_0xfc66('0x47')](_0x53c4be['body'],{})[_0xfc66('0x23')](function(_0x623642){var _0x474b19=_0x53c4be[_0xfc66('0x48')][_0xfc66('0x25')]({'plain':!![]});if(!_0x474b19)throw new Error(_0xfc66('0x49'));if(_0x474b19[_0xfc66('0x4a')]===_0xfc66('0x48')){var _0x54e433=_0x623642['get']({'plain':!![]});var _0x542217=_0xfc66('0x26');return db[_0xfc66('0x4b')][_0xfc66('0x4c')]({'where':{'name':_0x542217,'userProfileId':_0x474b19[_0xfc66('0x4d')]},'raw':!![]})[_0xfc66('0x23')](function(_0x219e5a){if(_0x219e5a&&_0x219e5a[_0xfc66('0x4e')]===0x0){return db[_0xfc66('0x4f')]['create']({'name':_0x54e433[_0xfc66('0x2a')],'resourceId':_0x54e433['id'],'type':_0x219e5a[_0xfc66('0x2a')],'sectionId':_0x219e5a['id']},{})[_0xfc66('0x23')](function(){return _0x623642;});}else{return _0x623642;}})[_0xfc66('0x43')](function(_0x4aaa55){logger['error']('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x4aaa55);throw _0x4aaa55;});}return _0x623642;})[_0xfc66('0x23')](respondWithResult(_0x193eec,0xc9))[_0xfc66('0x43')](handleError(_0x193eec,null));};exports[_0xfc66('0x50')]=function(_0x26ee2a,_0x1b31a3){if(_0x26ee2a['body']['id']){delete _0x26ee2a['body']['id'];}return db[_0xfc66('0x40')][_0xfc66('0x4c')]({'where':{'id':_0x26ee2a[_0xfc66('0x45')]['id']}})[_0xfc66('0x23')](handleEntityNotFound(_0x1b31a3,null))[_0xfc66('0x23')](saveUpdates(_0x26ee2a['body'],null))[_0xfc66('0x23')](respondWithResult(_0x1b31a3,null))[_0xfc66('0x43')](handleError(_0x1b31a3,null));};exports[_0xfc66('0x24')]=function(_0x13c5fa,_0x303d30){return db[_0xfc66('0x40')][_0xfc66('0x4c')]({'where':{'id':_0x13c5fa[_0xfc66('0x45')]['id']}})[_0xfc66('0x23')](handleEntityNotFound(_0x303d30,null))['then'](removeEntity(_0x303d30,null))['catch'](handleError(_0x303d30,null));}; \ No newline at end of file diff --git a/server/api/analyticMetric/analyticMetric.model.js b/server/api/analyticMetric/analyticMetric.model.js index 69fdc9d..5494edb 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 _0x1da6=['AnalyticMetric','lodash','api','moment','bluebird','request-promise','path','../../config/environment','./analyticMetric.attributes','exports'];(function(_0x560286,_0x17d496){var _0x1418aa=function(_0x6e1c2d){while(--_0x6e1c2d){_0x560286['push'](_0x560286['shift']());}};_0x1418aa(++_0x17d496);}(_0x1da6,0x14b));var _0x61da=function(_0x5dbb84,_0x1bbce9){_0x5dbb84=_0x5dbb84-0x0;var _0x1d6eae=_0x1da6[_0x5dbb84];return _0x1d6eae;};'use strict';var _=require(_0x61da('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x61da('0x1'));var moment=require(_0x61da('0x2'));var BPromise=require(_0x61da('0x3'));var rp=require(_0x61da('0x4'));var fs=require('fs');var path=require(_0x61da('0x5'));var rimraf=require('rimraf');var config=require(_0x61da('0x6'));var attributes=require(_0x61da('0x7'));module[_0x61da('0x8')]=function(_0x35adb6,_0x26112c){return _0x35adb6['define'](_0x61da('0x9'),attributes,{'tableName':'analytics_metrics','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x4f66=['analytics_metrics','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./analyticMetric.attributes','exports','define'];(function(_0x1bf662,_0x3f7906){var _0x55c6af=function(_0x2a2d9a){while(--_0x2a2d9a){_0x1bf662['push'](_0x1bf662['shift']());}};_0x55c6af(++_0x3f7906);}(_0x4f66,0x1c1));var _0x64f6=function(_0x2e62de,_0xf21abf){_0x2e62de=_0x2e62de-0x0;var _0xa0062e=_0x4f66[_0x2e62de];return _0xa0062e;};'use strict';var _=require(_0x64f6('0x0'));var util=require(_0x64f6('0x1'));var logger=require(_0x64f6('0x2'))(_0x64f6('0x3'));var moment=require(_0x64f6('0x4'));var BPromise=require(_0x64f6('0x5'));var rp=require(_0x64f6('0x6'));var fs=require('fs');var path=require(_0x64f6('0x7'));var rimraf=require(_0x64f6('0x8'));var config=require(_0x64f6('0x9'));var attributes=require(_0x64f6('0xa'));module[_0x64f6('0xb')]=function(_0x6af14b,_0x31c0f6){return _0x6af14b[_0x64f6('0xc')]('AnalyticMetric',attributes,{'tableName':_0x64f6('0xd'),'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 bee1dc9..8ee8144 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 _0x7f59=['util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','AnalyticMetric,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','catch'];(function(_0x59e821,_0x86c723){var _0x5333f6=function(_0x5dc2c9){while(--_0x5dc2c9){_0x59e821['push'](_0x59e821['shift']());}};_0x5333f6(++_0x86c723);}(_0x7f59,0x73));var _0x97f5=function(_0x501476,_0x26dbe5){_0x501476=_0x501476-0x0;var _0x474f57=_0x7f59[_0x501476];return _0x474f57;};'use strict';var _=require('lodash');var util=require(_0x97f5('0x0'));var moment=require(_0x97f5('0x1'));var BPromise=require(_0x97f5('0x2'));var rs=require(_0x97f5('0x3'));var fs=require('fs');var Redis=require(_0x97f5('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x97f5('0x5'));var logger=require(_0x97f5('0x6'))(_0x97f5('0x7'));var config=require(_0x97f5('0x8'));var jayson=require(_0x97f5('0x9'));var client=jayson[_0x97f5('0xa')][_0x97f5('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x31112a,_0x105915,_0x291c69){return new BPromise(function(_0x4de624,_0x529dcf){return client[_0x97f5('0xc')](_0x31112a,_0x291c69)[_0x97f5('0xd')](function(_0x5623e7){logger[_0x97f5('0xe')](_0x97f5('0xf'),_0x105915,_0x97f5('0x10'));logger[_0x97f5('0x11')]('AnalyticMetric,\x20%s,\x20%s,\x20%s',_0x105915,_0x97f5('0x10'),JSON[_0x97f5('0x12')](_0x5623e7));if(_0x5623e7[_0x97f5('0x13')]){if(_0x5623e7[_0x97f5('0x13')][_0x97f5('0x14')]===0x1f4){logger[_0x97f5('0x13')](_0x97f5('0xf'),_0x105915,_0x5623e7[_0x97f5('0x13')][_0x97f5('0x15')]);return _0x529dcf(_0x5623e7[_0x97f5('0x13')]['message']);}logger['error'](_0x97f5('0xf'),_0x105915,_0x5623e7['error']['message']);return _0x4de624(_0x5623e7[_0x97f5('0x13')][_0x97f5('0x15')]);}else{logger[_0x97f5('0xe')](_0x97f5('0xf'),_0x105915,'request\x20sent');_0x4de624(_0x5623e7['result'][_0x97f5('0x15')]);}})[_0x97f5('0x16')](function(_0x5d9791){logger[_0x97f5('0x13')](_0x97f5('0xf'),_0x105915,_0x5d9791);_0x529dcf(_0x5d9791);});});} \ No newline at end of file +var _0xd166=['result','lodash','util','moment','../../mysqldb','../../config/utils','../../config/logger','client','http','then','info','AnalyticMetric,\x20%s,\x20%s','request\x20sent','debug','AnalyticMetric,\x20%s,\x20%s,\x20%s','stringify','error','code','message'];(function(_0x2c9509,_0x159071){var _0x7125e7=function(_0x3d101f){while(--_0x3d101f){_0x2c9509['push'](_0x2c9509['shift']());}};_0x7125e7(++_0x159071);}(_0xd166,0xd2));var _0x6d16=function(_0x95531d,_0x4010db){_0x95531d=_0x95531d-0x0;var _0x547260=_0xd166[_0x95531d];return _0x547260;};'use strict';var _=require(_0x6d16('0x0'));var util=require(_0x6d16('0x1'));var moment=require(_0x6d16('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x6d16('0x3'))['db'];var utils=require(_0x6d16('0x4'));var logger=require(_0x6d16('0x5'))('rpc');var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x6d16('0x6')][_0x6d16('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x5024eb,_0x4312e2,_0x4d6898){return new BPromise(function(_0x424ebb,_0x30745b){return client['request'](_0x5024eb,_0x4d6898)[_0x6d16('0x8')](function(_0xa216a9){logger[_0x6d16('0x9')](_0x6d16('0xa'),_0x4312e2,_0x6d16('0xb'));logger[_0x6d16('0xc')](_0x6d16('0xd'),_0x4312e2,_0x6d16('0xb'),JSON[_0x6d16('0xe')](_0xa216a9));if(_0xa216a9[_0x6d16('0xf')]){if(_0xa216a9[_0x6d16('0xf')][_0x6d16('0x10')]===0x1f4){logger['error'](_0x6d16('0xa'),_0x4312e2,_0xa216a9[_0x6d16('0xf')]['message']);return _0x30745b(_0xa216a9['error'][_0x6d16('0x11')]);}logger[_0x6d16('0xf')](_0x6d16('0xa'),_0x4312e2,_0xa216a9['error'][_0x6d16('0x11')]);return _0x424ebb(_0xa216a9['error']['message']);}else{logger[_0x6d16('0x9')](_0x6d16('0xa'),_0x4312e2,_0x6d16('0xb'));_0x424ebb(_0xa216a9[_0x6d16('0x12')]['message']);}})['catch'](function(_0x2811ef){logger[_0x6d16('0xf')]('AnalyticMetric,\x20%s,\x20%s',_0x4312e2,_0x2811ef);_0x30745b(_0x2811ef);});});} \ No newline at end of file diff --git a/server/api/analyticMetric/index.js b/server/api/analyticMetric/index.js index 7118b5e..cb9c474 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 _0x1261=['util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./analyticMetric.controller','get','/:id','show','post','isAuthenticated','create','put','update','delete'];(function(_0x57add2,_0x4f2b7d){var _0x4e3670=function(_0x3311b){while(--_0x3311b){_0x57add2['push'](_0x57add2['shift']());}};_0x4e3670(++_0x4f2b7d);}(_0x1261,0x144));var _0x1126=function(_0x23e4b4,_0x132419){_0x23e4b4=_0x23e4b4-0x0;var _0x3bc471=_0x1261[_0x23e4b4];return _0x3bc471;};'use strict';var multer=require('multer');var util=require(_0x1126('0x0'));var path=require(_0x1126('0x1'));var timeout=require(_0x1126('0x2'));var express=require(_0x1126('0x3'));var router=express[_0x1126('0x4')]();var auth=require(_0x1126('0x5'));var interaction=require(_0x1126('0x6'));var config=require(_0x1126('0x7'));var controller=require(_0x1126('0x8'));router[_0x1126('0x9')]('/',auth['isAuthenticated'](),controller['index']);router[_0x1126('0x9')](_0x1126('0xa'),auth['isAuthenticated'](),controller[_0x1126('0xb')]);router[_0x1126('0xc')]('/',auth[_0x1126('0xd')](),controller[_0x1126('0xe')]);router[_0x1126('0xf')]('/:id',auth[_0x1126('0xd')](),controller[_0x1126('0x10')]);router[_0x1126('0x11')]('/:id',auth[_0x1126('0xd')](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0xc4aa=['connect-timeout','express','Router','./analyticMetric.controller','get','isAuthenticated','index','/:id','show','create','put','update','delete','destroy','multer','util','path'];(function(_0xcb8fde,_0x24399c){var _0x16dd77=function(_0x27cab4){while(--_0x27cab4){_0xcb8fde['push'](_0xcb8fde['shift']());}};_0x16dd77(++_0x24399c);}(_0xc4aa,0x1b7));var _0xac4a=function(_0x3b0731,_0xcf9925){_0x3b0731=_0x3b0731-0x0;var _0x4204d7=_0xc4aa[_0x3b0731];return _0x4204d7;};'use strict';var multer=require(_0xac4a('0x0'));var util=require(_0xac4a('0x1'));var path=require(_0xac4a('0x2'));var timeout=require(_0xac4a('0x3'));var express=require(_0xac4a('0x4'));var router=express[_0xac4a('0x5')]();var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0xac4a('0x6'));router[_0xac4a('0x7')]('/',auth[_0xac4a('0x8')](),controller[_0xac4a('0x9')]);router[_0xac4a('0x7')](_0xac4a('0xa'),auth[_0xac4a('0x8')](),controller[_0xac4a('0xb')]);router['post']('/',auth['isAuthenticated'](),controller[_0xac4a('0xc')]);router[_0xac4a('0xd')](_0xac4a('0xa'),auth['isAuthenticated'](),controller[_0xac4a('0xe')]);router[_0xac4a('0xf')](_0xac4a('0xa'),auth['isAuthenticated'](),controller[_0xac4a('0x10')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/analyticTreeReport/analyticTreeReport.attributes.js b/server/api/analyticTreeReport/analyticTreeReport.attributes.js index 9e64afb..298ebd0 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. * // * * // ************************************************************************* -'use strict';var Sequelize=require('sequelize');module['exports']={'tree':{'type':Sequelize['TEXT'],'allowNull':![]}}; \ No newline at end of file +var _0x4449=['TEXT','sequelize'];(function(_0x301b5a,_0xfb349a){var _0x18badb=function(_0x3c1731){while(--_0x3c1731){_0x301b5a['push'](_0x301b5a['shift']());}};_0x18badb(++_0xfb349a);}(_0x4449,0x85));var _0x9444=function(_0x375c79,_0x4d0d3d){_0x375c79=_0x375c79-0x0;var _0x2e1633=_0x4449[_0x375c79];return _0x2e1633;};'use strict';var Sequelize=require(_0x9444('0x0'));module['exports']={'tree':{'type':Sequelize[_0x9444('0x1')],'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/analyticTreeReport/analyticTreeReport.controller.js b/server/api/analyticTreeReport/analyticTreeReport.controller.js index a7e5206..ccee3fb 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 _0x0713=['jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','end','json','count','offset','limit','status','set','Content-Range','apply','reject','save','then','destroy','error','stack','name','send','index','map','AnalyticTreeReport','rawAttributes','fieldName','type','query','keys','filters','intersection','model','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','options','findAll','catch','show','params','includeAll','include','find','create','body','update','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto'];(function(_0x5ca45c,_0x304280){var _0x454915=function(_0x586813){while(--_0x586813){_0x5ca45c['push'](_0x5ca45c['shift']());}};_0x454915(++_0x304280);}(_0x0713,0x1ba));var _0x3071=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x0713[_0x3dd15e];return _0x231fd0;};'use strict';var pdf=require('html-pdf');var emlformat=require('eml-format');var rimraf=require(_0x3071('0x0'));var zipdir=require(_0x3071('0x1'));var jsonpatch=require(_0x3071('0x2'));var rp=require(_0x3071('0x3'));var moment=require(_0x3071('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x3071('0x5'));var util=require(_0x3071('0x6'));var path=require(_0x3071('0x7'));var sox=require(_0x3071('0x8'));var csv=require(_0x3071('0x9'));var ejs=require(_0x3071('0xa'));var fs=require('fs');var _=require(_0x3071('0xb'));var squel=require(_0x3071('0xc'));var crypto=require(_0x3071('0xd'));var jsforce=require(_0x3071('0xe'));var deskjs=require(_0x3071('0xf'));var toCsv=require(_0x3071('0x9'));var querystring=require(_0x3071('0x10'));var Papa=require('papaparse');var Redis=require(_0x3071('0x11'));var authService=require(_0x3071('0x12'));var qs=require(_0x3071('0x13'));var as=require(_0x3071('0x14'));var hardwareService=require(_0x3071('0x15'));var logger=require('../../config/logger')(_0x3071('0x16'));var utils=require(_0x3071('0x17'));var config=require(_0x3071('0x18'));var db=require(_0x3071('0x19'))['db'];function respondWithStatusCode(_0xa0c1,_0x4a8cc7){_0x4a8cc7=_0x4a8cc7||0xcc;return function(_0x5330a8){if(_0x5330a8){return _0xa0c1[_0x3071('0x1a')](_0x4a8cc7);}return _0xa0c1['status'](_0x4a8cc7)[_0x3071('0x1b')]();};}function respondWithResult(_0x44fbae,_0x5d4883){_0x5d4883=_0x5d4883||0xc8;return function(_0x104e73){if(_0x104e73){return _0x44fbae['status'](_0x5d4883)[_0x3071('0x1c')](_0x104e73);}};}function respondWithFilteredResult(_0x45c93b,_0x1271d0){return function(_0x1f14e1){if(_0x1f14e1){var _0x1caa5d=_0x1f14e1[_0x3071('0x1d')],_0x2a6a4b=_0x1271d0[_0x3071('0x1e')],_0x157a47=_0x1271d0['offset']+_0x1271d0[_0x3071('0x1f')],_0x11bdc9;if(_0x157a47>=_0x1caa5d){_0x157a47=_0x1caa5d;_0x11bdc9=0xc8;}else{_0x11bdc9=0xce;}_0x45c93b[_0x3071('0x20')](_0x11bdc9);return _0x45c93b[_0x3071('0x21')](_0x3071('0x22'),_0x2a6a4b+'-'+_0x157a47+'/'+_0x1caa5d)[_0x3071('0x1c')](_0x1f14e1);}return null;};}function patchUpdates(_0x17aee2){return function(_0x105bbb){try{jsonpatch[_0x3071('0x23')](_0x105bbb,_0x17aee2,!![]);}catch(_0x502a16){return BPromise[_0x3071('0x24')](_0x502a16);}return _0x105bbb[_0x3071('0x25')]();};}function saveUpdates(_0xd3e23d,_0x56c267){return function(_0xb8f4e3){if(_0xb8f4e3){return _0xb8f4e3['update'](_0xd3e23d)[_0x3071('0x26')](function(_0x43128c){return _0x43128c;});}return null;};}function removeEntity(_0x3762d8,_0x457b57){return function(_0x33090c){if(_0x33090c){return _0x33090c[_0x3071('0x27')]()[_0x3071('0x26')](function(){_0x3762d8[_0x3071('0x20')](0xcc)['end']();});}};}function handleEntityNotFound(_0x481a51,_0x2ce48a){return function(_0xb05b1d){if(!_0xb05b1d){_0x481a51[_0x3071('0x1a')](0x194);}return _0xb05b1d;};}function handleError(_0x13df9f,_0x2793ef){_0x2793ef=_0x2793ef||0x1f4;return function(_0x44b45f){logger[_0x3071('0x28')](_0x44b45f[_0x3071('0x29')]);if(_0x44b45f[_0x3071('0x2a')]){delete _0x44b45f['name'];}_0x13df9f[_0x3071('0x20')](_0x2793ef)[_0x3071('0x2b')](_0x44b45f);};}exports[_0x3071('0x2c')]=function(_0x4d5c4b,_0x4fb1ca){var _0x28792d={},_0x163604={},_0x950fde={'count':0x0,'rows':[]};var _0x3fa3b8=_[_0x3071('0x2d')](db[_0x3071('0x2e')][_0x3071('0x2f')],function(_0x32f1b4){return{'name':_0x32f1b4[_0x3071('0x30')],'type':_0x32f1b4[_0x3071('0x31')]['key']};});_0x163604['model']=_[_0x3071('0x2d')](_0x3fa3b8,_0x3071('0x2a'));_0x163604[_0x3071('0x32')]=_[_0x3071('0x33')](_0x4d5c4b[_0x3071('0x32')]);_0x163604[_0x3071('0x34')]=_[_0x3071('0x35')](_0x163604[_0x3071('0x36')],_0x163604['query']);_0x28792d['attributes']=_['intersection'](_0x163604[_0x3071('0x36')],qs[_0x3071('0x37')](_0x4d5c4b['query'][_0x3071('0x37')]));_0x28792d[_0x3071('0x38')]=_0x28792d[_0x3071('0x38')][_0x3071('0x39')]?_0x28792d['attributes']:_0x163604[_0x3071('0x36')];if(!_0x4d5c4b[_0x3071('0x32')][_0x3071('0x3a')](_0x3071('0x3b'))){_0x28792d[_0x3071('0x1f')]=qs[_0x3071('0x1f')](_0x4d5c4b[_0x3071('0x32')][_0x3071('0x1f')]);_0x28792d['offset']=qs[_0x3071('0x1e')](_0x4d5c4b['query']['offset']);}_0x28792d[_0x3071('0x3c')]=qs[_0x3071('0x3d')](_0x4d5c4b['query'][_0x3071('0x3d')]);_0x28792d[_0x3071('0x3e')]=qs[_0x3071('0x34')](_[_0x3071('0x3f')](_0x4d5c4b[_0x3071('0x32')],_0x163604[_0x3071('0x34')]));if(_0x4d5c4b['query'][_0x3071('0x40')]){_0x28792d[_0x3071('0x3e')]=_['merge'](_0x28792d[_0x3071('0x3e')],{'$or':_['map'](_0x3fa3b8,function(_0x28f855){if(_0x28f855[_0x3071('0x31')]!=='VIRTUAL'){var _0x593c99={};_0x593c99[_0x28f855[_0x3071('0x2a')]]={'$like':'%'+_0x4d5c4b[_0x3071('0x32')][_0x3071('0x40')]+'%'};return _0x593c99;}})});}_0x28792d=_['merge']({},_0x28792d,_0x4d5c4b[_0x3071('0x41')]);var _0x534a77={'where':_0x28792d[_0x3071('0x3e')]};return db['AnalyticTreeReport'][_0x3071('0x1d')](_0x534a77)[_0x3071('0x26')](function(_0x1fcc52){_0x950fde[_0x3071('0x1d')]=_0x1fcc52;if(_0x4d5c4b[_0x3071('0x32')]['includeAll']){_0x28792d['include']=[{'all':!![]}];}return db[_0x3071('0x2e')][_0x3071('0x42')](_0x28792d);})[_0x3071('0x26')](function(_0x1f69a6){_0x950fde['rows']=_0x1f69a6;return _0x950fde;})[_0x3071('0x26')](respondWithFilteredResult(_0x4fb1ca,_0x28792d))[_0x3071('0x43')](handleError(_0x4fb1ca,null));};exports[_0x3071('0x44')]=function(_0x25c29f,_0x277104){var _0xb9a4b8={'raw':!![],'where':{'id':_0x25c29f[_0x3071('0x45')]['id']}},_0x56a9d8={};_0x56a9d8['model']=_['keys'](db['AnalyticTreeReport']['rawAttributes']);_0x56a9d8[_0x3071('0x32')]=_[_0x3071('0x33')](_0x25c29f[_0x3071('0x32')]);_0x56a9d8[_0x3071('0x34')]=_[_0x3071('0x35')](_0x56a9d8[_0x3071('0x36')],_0x56a9d8[_0x3071('0x32')]);_0xb9a4b8[_0x3071('0x38')]=_['intersection'](_0x56a9d8[_0x3071('0x36')],qs[_0x3071('0x37')](_0x25c29f[_0x3071('0x32')][_0x3071('0x37')]));_0xb9a4b8[_0x3071('0x38')]=_0xb9a4b8['attributes']['length']?_0xb9a4b8[_0x3071('0x38')]:_0x56a9d8[_0x3071('0x36')];if(_0x25c29f[_0x3071('0x32')][_0x3071('0x46')]){_0xb9a4b8[_0x3071('0x47')]=[{'all':!![]}];}_0xb9a4b8=_['merge']({},_0xb9a4b8,_0x25c29f[_0x3071('0x41')]);return db['AnalyticTreeReport'][_0x3071('0x48')](_0xb9a4b8)['then'](handleEntityNotFound(_0x277104,null))['then'](respondWithResult(_0x277104,null))[_0x3071('0x43')](handleError(_0x277104,null));};exports['create']=function(_0x1862ea,_0x5a0a69){return db[_0x3071('0x2e')][_0x3071('0x49')](_0x1862ea[_0x3071('0x4a')],{})[_0x3071('0x26')](respondWithResult(_0x5a0a69,0xc9))['catch'](handleError(_0x5a0a69,null));};exports[_0x3071('0x4b')]=function(_0x575c12,_0xd273ec){if(_0x575c12['body']['id']){delete _0x575c12[_0x3071('0x4a')]['id'];}return db[_0x3071('0x2e')]['find']({'where':{'id':_0x575c12[_0x3071('0x45')]['id']}})[_0x3071('0x26')](handleEntityNotFound(_0xd273ec,null))[_0x3071('0x26')](saveUpdates(_0x575c12[_0x3071('0x4a')],null))[_0x3071('0x26')](respondWithResult(_0xd273ec,null))[_0x3071('0x43')](handleError(_0xd273ec,null));};exports[_0x3071('0x27')]=function(_0x577060,_0x2c6e4c){return db[_0x3071('0x2e')][_0x3071('0x48')]({'where':{'id':_0x577060[_0x3071('0x45')]['id']}})['then'](handleEntityNotFound(_0x2c6e4c,null))[_0x3071('0x26')](removeEntity(_0x2c6e4c,null))[_0x3071('0x43')](handleError(_0x2c6e4c,null));}; \ No newline at end of file +var _0xdd4f=['intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','count','includeAll','include','findAll','rows','catch','show','params','length','create','body','find','html-pdf','fast-json-patch','request-promise','bluebird','mustache','util','sox','to-csv','ejs','lodash','squel','jsforce','querystring','papaparse','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','end','status','offset','limit','set','Content-Range','json','reject','save','update','then','destroy','error','stack','name','send','index','AnalyticTreeReport','rawAttributes','fieldName','type','model','map','query','keys','filters'];(function(_0x2a2262,_0x51e3c9){var _0x430b4a=function(_0x2c11b1){while(--_0x2c11b1){_0x2a2262['push'](_0x2a2262['shift']());}};_0x430b4a(++_0x51e3c9);}(_0xdd4f,0x1ce));var _0xfdd4=function(_0x510706,_0x1bdb2b){_0x510706=_0x510706-0x0;var _0x107c0f=_0xdd4f[_0x510706];return _0x107c0f;};'use strict';var pdf=require(_0xfdd4('0x0'));var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0xfdd4('0x1'));var rp=require(_0xfdd4('0x2'));var moment=require('moment');var BPromise=require(_0xfdd4('0x3'));var Mustache=require(_0xfdd4('0x4'));var util=require(_0xfdd4('0x5'));var path=require('path');var sox=require(_0xfdd4('0x6'));var csv=require(_0xfdd4('0x7'));var ejs=require(_0xfdd4('0x8'));var fs=require('fs');var _=require(_0xfdd4('0x9'));var squel=require(_0xfdd4('0xa'));var crypto=require('crypto');var jsforce=require(_0xfdd4('0xb'));var deskjs=require('desk.js');var toCsv=require(_0xfdd4('0x7'));var querystring=require(_0xfdd4('0xc'));var Papa=require(_0xfdd4('0xd'));var Redis=require('ioredis');var authService=require(_0xfdd4('0xe'));var qs=require('../../components/parsers/qs');var as=require(_0xfdd4('0xf'));var hardwareService=require(_0xfdd4('0x10'));var logger=require(_0xfdd4('0x11'))(_0xfdd4('0x12'));var utils=require(_0xfdd4('0x13'));var config=require(_0xfdd4('0x14'));var db=require(_0xfdd4('0x15'))['db'];function respondWithStatusCode(_0x1c71c4,_0x3f07f1){_0x3f07f1=_0x3f07f1||0xcc;return function(_0x4565e6){if(_0x4565e6){return _0x1c71c4[_0xfdd4('0x16')](_0x3f07f1);}return _0x1c71c4['status'](_0x3f07f1)[_0xfdd4('0x17')]();};}function respondWithResult(_0xd7dbf,_0x227099){_0x227099=_0x227099||0xc8;return function(_0x57b21f){if(_0x57b21f){return _0xd7dbf[_0xfdd4('0x18')](_0x227099)['json'](_0x57b21f);}};}function respondWithFilteredResult(_0x467824,_0x42c3a8){return function(_0x2f34ec){if(_0x2f34ec){var _0x431255=_0x2f34ec['count'],_0x37b05f=_0x42c3a8[_0xfdd4('0x19')],_0x52cf2c=_0x42c3a8[_0xfdd4('0x19')]+_0x42c3a8[_0xfdd4('0x1a')],_0x47ed1d;if(_0x52cf2c>=_0x431255){_0x52cf2c=_0x431255;_0x47ed1d=0xc8;}else{_0x47ed1d=0xce;}_0x467824[_0xfdd4('0x18')](_0x47ed1d);return _0x467824[_0xfdd4('0x1b')](_0xfdd4('0x1c'),_0x37b05f+'-'+_0x52cf2c+'/'+_0x431255)[_0xfdd4('0x1d')](_0x2f34ec);}return null;};}function patchUpdates(_0x2ffd5f){return function(_0x32e00d){try{jsonpatch['apply'](_0x32e00d,_0x2ffd5f,!![]);}catch(_0x1e5d91){return BPromise[_0xfdd4('0x1e')](_0x1e5d91);}return _0x32e00d[_0xfdd4('0x1f')]();};}function saveUpdates(_0x36e611,_0x1454f1){return function(_0x29cc8d){if(_0x29cc8d){return _0x29cc8d[_0xfdd4('0x20')](_0x36e611)[_0xfdd4('0x21')](function(_0x523a7d){return _0x523a7d;});}return null;};}function removeEntity(_0x2147e6,_0x17302b){return function(_0x2a24e8){if(_0x2a24e8){return _0x2a24e8[_0xfdd4('0x22')]()[_0xfdd4('0x21')](function(){_0x2147e6[_0xfdd4('0x18')](0xcc)[_0xfdd4('0x17')]();});}};}function handleEntityNotFound(_0x277ec1,_0x538b00){return function(_0x1e14da){if(!_0x1e14da){_0x277ec1[_0xfdd4('0x16')](0x194);}return _0x1e14da;};}function handleError(_0x4397a3,_0x53d35a){_0x53d35a=_0x53d35a||0x1f4;return function(_0x58fe0d){logger[_0xfdd4('0x23')](_0x58fe0d[_0xfdd4('0x24')]);if(_0x58fe0d[_0xfdd4('0x25')]){delete _0x58fe0d[_0xfdd4('0x25')];}_0x4397a3['status'](_0x53d35a)[_0xfdd4('0x26')](_0x58fe0d);};}exports[_0xfdd4('0x27')]=function(_0x3cd2c9,_0x31e053){var _0x3c6728={},_0x192471={},_0x453a48={'count':0x0,'rows':[]};var _0x37b7a2=_['map'](db[_0xfdd4('0x28')][_0xfdd4('0x29')],function(_0x385a68){return{'name':_0x385a68[_0xfdd4('0x2a')],'type':_0x385a68[_0xfdd4('0x2b')]['key']};});_0x192471[_0xfdd4('0x2c')]=_[_0xfdd4('0x2d')](_0x37b7a2,_0xfdd4('0x25'));_0x192471[_0xfdd4('0x2e')]=_[_0xfdd4('0x2f')](_0x3cd2c9['query']);_0x192471[_0xfdd4('0x30')]=_[_0xfdd4('0x31')](_0x192471[_0xfdd4('0x2c')],_0x192471['query']);_0x3c6728[_0xfdd4('0x32')]=_['intersection'](_0x192471[_0xfdd4('0x2c')],qs[_0xfdd4('0x33')](_0x3cd2c9['query']['fields']));_0x3c6728[_0xfdd4('0x32')]=_0x3c6728[_0xfdd4('0x32')]['length']?_0x3c6728['attributes']:_0x192471[_0xfdd4('0x2c')];if(!_0x3cd2c9[_0xfdd4('0x2e')][_0xfdd4('0x34')](_0xfdd4('0x35'))){_0x3c6728[_0xfdd4('0x1a')]=qs[_0xfdd4('0x1a')](_0x3cd2c9[_0xfdd4('0x2e')][_0xfdd4('0x1a')]);_0x3c6728[_0xfdd4('0x19')]=qs[_0xfdd4('0x19')](_0x3cd2c9[_0xfdd4('0x2e')][_0xfdd4('0x19')]);}_0x3c6728[_0xfdd4('0x36')]=qs[_0xfdd4('0x37')](_0x3cd2c9[_0xfdd4('0x2e')][_0xfdd4('0x37')]);_0x3c6728[_0xfdd4('0x38')]=qs[_0xfdd4('0x30')](_[_0xfdd4('0x39')](_0x3cd2c9[_0xfdd4('0x2e')],_0x192471[_0xfdd4('0x30')]));if(_0x3cd2c9[_0xfdd4('0x2e')][_0xfdd4('0x3a')]){_0x3c6728[_0xfdd4('0x38')]=_[_0xfdd4('0x3b')](_0x3c6728[_0xfdd4('0x38')],{'$or':_['map'](_0x37b7a2,function(_0x2b6c87){if(_0x2b6c87[_0xfdd4('0x2b')]!==_0xfdd4('0x3c')){var _0x439389={};_0x439389[_0x2b6c87[_0xfdd4('0x25')]]={'$like':'%'+_0x3cd2c9[_0xfdd4('0x2e')]['filter']+'%'};return _0x439389;}})});}_0x3c6728=_[_0xfdd4('0x3b')]({},_0x3c6728,_0x3cd2c9['options']);var _0xeca9d={'where':_0x3c6728[_0xfdd4('0x38')]};return db[_0xfdd4('0x28')][_0xfdd4('0x3d')](_0xeca9d)['then'](function(_0x1c6f43){_0x453a48[_0xfdd4('0x3d')]=_0x1c6f43;if(_0x3cd2c9[_0xfdd4('0x2e')][_0xfdd4('0x3e')]){_0x3c6728[_0xfdd4('0x3f')]=[{'all':!![]}];}return db[_0xfdd4('0x28')][_0xfdd4('0x40')](_0x3c6728);})[_0xfdd4('0x21')](function(_0xe65944){_0x453a48[_0xfdd4('0x41')]=_0xe65944;return _0x453a48;})['then'](respondWithFilteredResult(_0x31e053,_0x3c6728))[_0xfdd4('0x42')](handleError(_0x31e053,null));};exports[_0xfdd4('0x43')]=function(_0x210a15,_0x67a1e3){var _0x5173db={'raw':!![],'where':{'id':_0x210a15[_0xfdd4('0x44')]['id']}},_0x3e2bda={};_0x3e2bda[_0xfdd4('0x2c')]=_[_0xfdd4('0x2f')](db[_0xfdd4('0x28')]['rawAttributes']);_0x3e2bda[_0xfdd4('0x2e')]=_[_0xfdd4('0x2f')](_0x210a15[_0xfdd4('0x2e')]);_0x3e2bda[_0xfdd4('0x30')]=_[_0xfdd4('0x31')](_0x3e2bda[_0xfdd4('0x2c')],_0x3e2bda[_0xfdd4('0x2e')]);_0x5173db['attributes']=_[_0xfdd4('0x31')](_0x3e2bda['model'],qs[_0xfdd4('0x33')](_0x210a15[_0xfdd4('0x2e')][_0xfdd4('0x33')]));_0x5173db[_0xfdd4('0x32')]=_0x5173db['attributes'][_0xfdd4('0x45')]?_0x5173db[_0xfdd4('0x32')]:_0x3e2bda['model'];if(_0x210a15[_0xfdd4('0x2e')][_0xfdd4('0x3e')]){_0x5173db['include']=[{'all':!![]}];}_0x5173db=_[_0xfdd4('0x3b')]({},_0x5173db,_0x210a15['options']);return db['AnalyticTreeReport']['find'](_0x5173db)[_0xfdd4('0x21')](handleEntityNotFound(_0x67a1e3,null))[_0xfdd4('0x21')](respondWithResult(_0x67a1e3,null))[_0xfdd4('0x42')](handleError(_0x67a1e3,null));};exports['create']=function(_0x393029,_0x169d72){return db['AnalyticTreeReport'][_0xfdd4('0x46')](_0x393029[_0xfdd4('0x47')],{})[_0xfdd4('0x21')](respondWithResult(_0x169d72,0xc9))[_0xfdd4('0x42')](handleError(_0x169d72,null));};exports[_0xfdd4('0x20')]=function(_0x3817fe,_0x2578eb){if(_0x3817fe[_0xfdd4('0x47')]['id']){delete _0x3817fe[_0xfdd4('0x47')]['id'];}return db[_0xfdd4('0x28')][_0xfdd4('0x48')]({'where':{'id':_0x3817fe[_0xfdd4('0x44')]['id']}})[_0xfdd4('0x21')](handleEntityNotFound(_0x2578eb,null))[_0xfdd4('0x21')](saveUpdates(_0x3817fe['body'],null))['then'](respondWithResult(_0x2578eb,null))[_0xfdd4('0x42')](handleError(_0x2578eb,null));};exports[_0xfdd4('0x22')]=function(_0x1296e6,_0x1932ef){return db['AnalyticTreeReport'][_0xfdd4('0x48')]({'where':{'id':_0x1296e6[_0xfdd4('0x44')]['id']}})['then'](handleEntityNotFound(_0x1932ef,null))['then'](removeEntity(_0x1932ef,null))['catch'](handleError(_0x1932ef,null));}; \ No newline at end of file diff --git a/server/api/analyticTreeReport/analyticTreeReport.model.js b/server/api/analyticTreeReport/analyticTreeReport.model.js index 0a1e786..fa447c6 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 _0xc5df=['request-promise','path','rimraf','../../config/environment','./analyticTreeReport.attributes','define','AnalyticTreeReport','analytics_report_trees','../../config/logger','api'];(function(_0x507e7d,_0x418abf){var _0x3a9e62=function(_0xaa1fc1){while(--_0xaa1fc1){_0x507e7d['push'](_0x507e7d['shift']());}};_0x3a9e62(++_0x418abf);}(_0xc5df,0x80));var _0xfc5d=function(_0x155bc3,_0x148ef5){_0x155bc3=_0x155bc3-0x0;var _0x50a446=_0xc5df[_0x155bc3];return _0x50a446;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0xfc5d('0x0'))(_0xfc5d('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0xfc5d('0x2'));var fs=require('fs');var path=require(_0xfc5d('0x3'));var rimraf=require(_0xfc5d('0x4'));var config=require(_0xfc5d('0x5'));var attributes=require(_0xfc5d('0x6'));module['exports']=function(_0x1c8057,_0x2df24e){return _0x1c8057[_0xfc5d('0x7')](_0xfc5d('0x8'),attributes,{'tableName':_0xfc5d('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xf2e3=['../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./analyticTreeReport.attributes','define','AnalyticTreeReport','analytics_report_trees','lodash'];(function(_0x34b54c,_0x358587){var _0x432d60=function(_0x3d1477){while(--_0x3d1477){_0x34b54c['push'](_0x34b54c['shift']());}};_0x432d60(++_0x358587);}(_0xf2e3,0x9b));var _0x3f2e=function(_0x411017,_0x4a8117){_0x411017=_0x411017-0x0;var _0x2adeea=_0xf2e3[_0x411017];return _0x2adeea;};'use strict';var _=require(_0x3f2e('0x0'));var util=require('util');var logger=require(_0x3f2e('0x1'))(_0x3f2e('0x2'));var moment=require(_0x3f2e('0x3'));var BPromise=require(_0x3f2e('0x4'));var rp=require(_0x3f2e('0x5'));var fs=require('fs');var path=require(_0x3f2e('0x6'));var rimraf=require(_0x3f2e('0x7'));var config=require(_0x3f2e('0x8'));var attributes=require(_0x3f2e('0x9'));module['exports']=function(_0x33a3b7,_0xdd6b3e){return _0x33a3b7[_0x3f2e('0xa')](_0x3f2e('0xb'),attributes,{'tableName':_0x3f2e('0xc'),'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 17c51e1..953d991 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 _0xabfd=['debug','AnalyticTreeReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','request','info','AnalyticTreeReport,\x20%s,\x20%s','request\x20sent'];(function(_0x25df80,_0xa2aec5){var _0x17b6d0=function(_0x446155){while(--_0x446155){_0x25df80['push'](_0x25df80['shift']());}};_0x17b6d0(++_0xa2aec5);}(_0xabfd,0xee));var _0xdabf=function(_0xa325ee,_0x44e9dc){_0xa325ee=_0xa325ee-0x0;var _0x28895a=_0xabfd[_0xa325ee];return _0x28895a;};'use strict';var _=require(_0xdabf('0x0'));var util=require('util');var moment=require(_0xdabf('0x1'));var BPromise=require(_0xdabf('0x2'));var rs=require(_0xdabf('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xdabf('0x4'))['db'];var utils=require(_0xdabf('0x5'));var logger=require(_0xdabf('0x6'))(_0xdabf('0x7'));var config=require(_0xdabf('0x8'));var jayson=require('jayson/promise');var client=jayson[_0xdabf('0x9')][_0xdabf('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x16d8df,_0x4918a9,_0x1dc413){return new BPromise(function(_0x5af9aa,_0x445c12){return client[_0xdabf('0xb')](_0x16d8df,_0x1dc413)['then'](function(_0x1707cc){logger[_0xdabf('0xc')](_0xdabf('0xd'),_0x4918a9,_0xdabf('0xe'));logger[_0xdabf('0xf')](_0xdabf('0x10'),_0x4918a9,'request\x20sent',JSON[_0xdabf('0x11')](_0x1707cc));if(_0x1707cc['error']){if(_0x1707cc[_0xdabf('0x12')][_0xdabf('0x13')]===0x1f4){logger['error']('AnalyticTreeReport,\x20%s,\x20%s',_0x4918a9,_0x1707cc[_0xdabf('0x12')][_0xdabf('0x14')]);return _0x445c12(_0x1707cc[_0xdabf('0x12')][_0xdabf('0x14')]);}logger[_0xdabf('0x12')](_0xdabf('0xd'),_0x4918a9,_0x1707cc[_0xdabf('0x12')][_0xdabf('0x14')]);return _0x5af9aa(_0x1707cc['error'][_0xdabf('0x14')]);}else{logger[_0xdabf('0xc')](_0xdabf('0xd'),_0x4918a9,'request\x20sent');_0x5af9aa(_0x1707cc[_0xdabf('0x15')][_0xdabf('0x14')]);}})[_0xdabf('0x16')](function(_0x5ca8c0){logger[_0xdabf('0x12')](_0xdabf('0xd'),_0x4918a9,_0x5ca8c0);_0x445c12(_0x5ca8c0);});});} \ No newline at end of file +var _0xdb02=['rpc','client','http','AnalyticTreeReport,\x20%s,\x20%s','AnalyticTreeReport,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','info','result','catch','moment','bluebird','../../mysqldb','../../config/utils'];(function(_0x3a7b6e,_0x48fda6){var _0xddc8ba=function(_0x5c5bc2){while(--_0x5c5bc2){_0x3a7b6e['push'](_0x3a7b6e['shift']());}};_0xddc8ba(++_0x48fda6);}(_0xdb02,0x13c));var _0x2db0=function(_0x2118ad,_0xe8e3fd){_0x2118ad=_0x2118ad-0x0;var _0x4b5715=_0xdb02[_0x2118ad];return _0x4b5715;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x2db0('0x0'));var BPromise=require(_0x2db0('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x2db0('0x2'))['db'];var utils=require(_0x2db0('0x3'));var logger=require('../../config/logger')(_0x2db0('0x4'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x2db0('0x5')][_0x2db0('0x6')]({'port':0x232a});function respondWithRpcPromise(_0x327a96,_0x5d1073,_0x3d4361){return new BPromise(function(_0x419dba,_0x962bd4){return client['request'](_0x327a96,_0x3d4361)['then'](function(_0x556014){logger['info'](_0x2db0('0x7'),_0x5d1073,'request\x20sent');logger['debug'](_0x2db0('0x8'),_0x5d1073,_0x2db0('0x9'),JSON[_0x2db0('0xa')](_0x556014));if(_0x556014[_0x2db0('0xb')]){if(_0x556014[_0x2db0('0xb')]['code']===0x1f4){logger['error'](_0x2db0('0x7'),_0x5d1073,_0x556014[_0x2db0('0xb')][_0x2db0('0xc')]);return _0x962bd4(_0x556014[_0x2db0('0xb')][_0x2db0('0xc')]);}logger[_0x2db0('0xb')](_0x2db0('0x7'),_0x5d1073,_0x556014[_0x2db0('0xb')][_0x2db0('0xc')]);return _0x419dba(_0x556014[_0x2db0('0xb')][_0x2db0('0xc')]);}else{logger[_0x2db0('0xd')](_0x2db0('0x7'),_0x5d1073,_0x2db0('0x9'));_0x419dba(_0x556014[_0x2db0('0xe')][_0x2db0('0xc')]);}})[_0x2db0('0xf')](function(_0x48ffcd){logger[_0x2db0('0xb')](_0x2db0('0x7'),_0x5d1073,_0x48ffcd);_0x962bd4(_0x48ffcd);});});} \ No newline at end of file diff --git a/server/api/analyticTreeReport/index.js b/server/api/analyticTreeReport/index.js index 0759ca0..7bf4453 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 _0xb90b=['destroy','multer','path','Router','../../components/auth/service','../../config/environment','./analyticTreeReport.controller','get','index','/:id','isAuthenticated','show','post','create','put','update'];(function(_0x2d1c72,_0xdcc7f7){var _0x49ce5b=function(_0x335949){while(--_0x335949){_0x2d1c72['push'](_0x2d1c72['shift']());}};_0x49ce5b(++_0xdcc7f7);}(_0xb90b,0x161));var _0xbb90=function(_0x6d5a77,_0x9838a4){_0x6d5a77=_0x6d5a77-0x0;var _0x4697ae=_0xb90b[_0x6d5a77];return _0x4697ae;};'use strict';var multer=require(_0xbb90('0x0'));var util=require('util');var path=require(_0xbb90('0x1'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0xbb90('0x2')]();var auth=require(_0xbb90('0x3'));var interaction=require('../../components/interaction/service');var config=require(_0xbb90('0x4'));var controller=require(_0xbb90('0x5'));router[_0xbb90('0x6')]('/',auth['isAuthenticated'](),controller[_0xbb90('0x7')]);router[_0xbb90('0x6')](_0xbb90('0x8'),auth[_0xbb90('0x9')](),controller[_0xbb90('0xa')]);router[_0xbb90('0xb')]('/',auth['isAuthenticated'](),controller[_0xbb90('0xc')]);router[_0xbb90('0xd')](_0xbb90('0x8'),auth[_0xbb90('0x9')](),controller[_0xbb90('0xe')]);router['delete'](_0xbb90('0x8'),auth[_0xbb90('0x9')](),controller[_0xbb90('0xf')]);module['exports']=router; \ No newline at end of file +var _0x3ab1=['/:id','show','post','create','put','update','delete','exports','util','path','express','Router','../../components/auth/service','../../components/interaction/service','./analyticTreeReport.controller','get','isAuthenticated','index'];(function(_0x52a857,_0xc99fa1){var _0x4e2aae=function(_0x5410d9){while(--_0x5410d9){_0x52a857['push'](_0x52a857['shift']());}};_0x4e2aae(++_0xc99fa1);}(_0x3ab1,0x104));var _0x13ab=function(_0x5cda34,_0xe834b1){_0x5cda34=_0x5cda34-0x0;var _0x330a92=_0x3ab1[_0x5cda34];return _0x330a92;};'use strict';var multer=require('multer');var util=require(_0x13ab('0x0'));var path=require(_0x13ab('0x1'));var timeout=require('connect-timeout');var express=require(_0x13ab('0x2'));var router=express[_0x13ab('0x3')]();var auth=require(_0x13ab('0x4'));var interaction=require(_0x13ab('0x5'));var config=require('../../config/environment');var controller=require(_0x13ab('0x6'));router[_0x13ab('0x7')]('/',auth[_0x13ab('0x8')](),controller[_0x13ab('0x9')]);router[_0x13ab('0x7')](_0x13ab('0xa'),auth['isAuthenticated'](),controller[_0x13ab('0xb')]);router[_0x13ab('0xc')]('/',auth[_0x13ab('0x8')](),controller[_0x13ab('0xd')]);router[_0x13ab('0xe')](_0x13ab('0xa'),auth['isAuthenticated'](),controller[_0x13ab('0xf')]);router[_0x13ab('0x10')](_0x13ab('0xa'),auth['isAuthenticated'](),controller['destroy']);module[_0x13ab('0x11')]=router; \ No newline at end of file diff --git a/server/api/attachment/attachment.attributes.js b/server/api/attachment/attachment.attributes.js index 37e2e4b..c709983 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 _0xb1d8=['STRING','sequelize','exports'];(function(_0xf384e2,_0x5c6098){var _0x49dbd8=function(_0x3e15d8){while(--_0x3e15d8){_0xf384e2['push'](_0xf384e2['shift']());}};_0x49dbd8(++_0x5c6098);}(_0xb1d8,0xd0));var _0x8b1d=function(_0x57421f,_0xcf1f14){_0x57421f=_0x57421f-0x0;var _0x3bf6f1=_0xb1d8[_0x57421f];return _0x3bf6f1;};'use strict';var Sequelize=require(_0x8b1d('0x0'));module[_0x8b1d('0x1')]={'name':{'type':Sequelize['STRING']},'basename':{'type':Sequelize[_0x8b1d('0x2')]},'type':{'type':Sequelize[_0x8b1d('0x2')]}}; \ No newline at end of file +var _0x5112=['STRING','sequelize','exports'];(function(_0x209fcd,_0x1ecccc){var _0x501d5e=function(_0x8d74fe){while(--_0x8d74fe){_0x209fcd['push'](_0x209fcd['shift']());}};_0x501d5e(++_0x1ecccc);}(_0x5112,0xf7));var _0x2511=function(_0x118139,_0x7ce965){_0x118139=_0x118139-0x0;var _0x2fece9=_0x5112[_0x118139];return _0x2fece9;};'use strict';var Sequelize=require(_0x2511('0x0'));module[_0x2511('0x1')]={'name':{'type':Sequelize['STRING']},'basename':{'type':Sequelize[_0x2511('0x2')]},'type':{'type':Sequelize[_0x2511('0x2')]}}; \ No newline at end of file diff --git a/server/api/attachment/attachment.controller.js b/server/api/attachment/attachment.controller.js index 01602de..97d04f4 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 _0x01e0=['find','get','updatedAt','body','create','basename','file','filename','findOne','download','join','server/files/attachments/','eml-format','zip-dir','request-promise','bluebird','mustache','util','sox','ejs','squel','crypto','papaparse','ioredis','../../components/auth/service','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','json','count','offset','limit','set','Content-Range','apply','reject','save','update','then','destroy','end','error','stack','name','send','index','rawAttributes','fieldName','type','key','map','query','keys','filters','model','attributes','intersection','fields','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','Attachment','include','findAll','catch','show','params','includeAll','clone','length'];(function(_0x2e0f70,_0x18264a){var _0x403ba3=function(_0x3f2f24){while(--_0x3f2f24){_0x2e0f70['push'](_0x2e0f70['shift']());}};_0x403ba3(++_0x18264a);}(_0x01e0,0x1a6));var _0x001e=function(_0x335840,_0xd1b8de){_0x335840=_0x335840-0x0;var _0x5e133f=_0x01e0[_0x335840];return _0x5e133f;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x001e('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x001e('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x001e('0x2'));var moment=require('moment');var BPromise=require(_0x001e('0x3'));var Mustache=require(_0x001e('0x4'));var util=require(_0x001e('0x5'));var path=require('path');var sox=require(_0x001e('0x6'));var csv=require('to-csv');var ejs=require(_0x001e('0x7'));var fs=require('fs');var _=require('lodash');var squel=require(_0x001e('0x8'));var crypto=require(_0x001e('0x9'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x001e('0xa'));var Redis=require(_0x001e('0xb'));var authService=require(_0x001e('0xc'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x001e('0xd'));var logger=require(_0x001e('0xe'))(_0x001e('0xf'));var utils=require(_0x001e('0x10'));var config=require(_0x001e('0x11'));var db=require(_0x001e('0x12'))['db'];function respondWithStatusCode(_0x183a8f,_0x5b8288){_0x5b8288=_0x5b8288||0xcc;return function(_0x52e6fb){if(_0x52e6fb){return _0x183a8f[_0x001e('0x13')](_0x5b8288);}return _0x183a8f[_0x001e('0x14')](_0x5b8288)['end']();};}function respondWithResult(_0x490ff0,_0x30a134){_0x30a134=_0x30a134||0xc8;return function(_0x3481d0){if(_0x3481d0){return _0x490ff0['status'](_0x30a134)[_0x001e('0x15')](_0x3481d0);}};}function respondWithFilteredResult(_0x40b51f,_0xa696f6){return function(_0x21be5b){if(_0x21be5b){var _0x2c284f=_0x21be5b[_0x001e('0x16')],_0x3cf099=_0xa696f6['offset'],_0x5aaff9=_0xa696f6[_0x001e('0x17')]+_0xa696f6[_0x001e('0x18')],_0x194ead;if(_0x5aaff9>=_0x2c284f){_0x5aaff9=_0x2c284f;_0x194ead=0xc8;}else{_0x194ead=0xce;}_0x40b51f[_0x001e('0x14')](_0x194ead);return _0x40b51f[_0x001e('0x19')](_0x001e('0x1a'),_0x3cf099+'-'+_0x5aaff9+'/'+_0x2c284f)[_0x001e('0x15')](_0x21be5b);}return null;};}function patchUpdates(_0x12bbce){return function(_0x1faf36){try{jsonpatch[_0x001e('0x1b')](_0x1faf36,_0x12bbce,!![]);}catch(_0x55f9ec){return BPromise[_0x001e('0x1c')](_0x55f9ec);}return _0x1faf36[_0x001e('0x1d')]();};}function saveUpdates(_0x56378c,_0x282b74){return function(_0xc32112){if(_0xc32112){return _0xc32112[_0x001e('0x1e')](_0x56378c)[_0x001e('0x1f')](function(_0x147516){return _0x147516;});}return null;};}function removeEntity(_0x231ed8,_0x3b5621){return function(_0xa80f10){if(_0xa80f10){return _0xa80f10[_0x001e('0x20')]()[_0x001e('0x1f')](function(){_0x231ed8[_0x001e('0x14')](0xcc)[_0x001e('0x21')]();});}};}function handleEntityNotFound(_0x2ce3dc,_0x1c1ade){return function(_0x5eb58a){if(!_0x5eb58a){_0x2ce3dc[_0x001e('0x13')](0x194);}return _0x5eb58a;};}function handleError(_0x33e8ab,_0x343dec){_0x343dec=_0x343dec||0x1f4;return function(_0x292997){logger[_0x001e('0x22')](_0x292997[_0x001e('0x23')]);if(_0x292997[_0x001e('0x24')]){delete _0x292997[_0x001e('0x24')];}_0x33e8ab['status'](_0x343dec)[_0x001e('0x25')](_0x292997);};}exports[_0x001e('0x26')]=function(_0x11d3e6,_0x12ebac){var _0x2e68dc={},_0x4e477a={},_0x56fc31={'count':0x0,'rows':[]};var _0x5121bd=_['map'](db['Attachment'][_0x001e('0x27')],function(_0xd9c80e){return{'name':_0xd9c80e[_0x001e('0x28')],'type':_0xd9c80e[_0x001e('0x29')][_0x001e('0x2a')]};});_0x4e477a['model']=_[_0x001e('0x2b')](_0x5121bd,_0x001e('0x24'));_0x4e477a[_0x001e('0x2c')]=_[_0x001e('0x2d')](_0x11d3e6[_0x001e('0x2c')]);_0x4e477a[_0x001e('0x2e')]=_['intersection'](_0x4e477a[_0x001e('0x2f')],_0x4e477a[_0x001e('0x2c')]);_0x2e68dc[_0x001e('0x30')]=_[_0x001e('0x31')](_0x4e477a['model'],qs[_0x001e('0x32')](_0x11d3e6[_0x001e('0x2c')][_0x001e('0x32')]));_0x2e68dc[_0x001e('0x30')]=_0x2e68dc[_0x001e('0x30')]['length']?_0x2e68dc[_0x001e('0x30')]:_0x4e477a[_0x001e('0x2f')];if(!_0x11d3e6[_0x001e('0x2c')][_0x001e('0x33')](_0x001e('0x34'))){_0x2e68dc['limit']=qs[_0x001e('0x18')](_0x11d3e6[_0x001e('0x2c')][_0x001e('0x18')]);_0x2e68dc[_0x001e('0x17')]=qs['offset'](_0x11d3e6[_0x001e('0x2c')]['offset']);}_0x2e68dc[_0x001e('0x35')]=qs[_0x001e('0x36')](_0x11d3e6[_0x001e('0x2c')][_0x001e('0x36')]);_0x2e68dc[_0x001e('0x37')]=qs[_0x001e('0x2e')](_[_0x001e('0x38')](_0x11d3e6['query'],_0x4e477a[_0x001e('0x2e')]));if(_0x11d3e6[_0x001e('0x2c')][_0x001e('0x39')]){_0x2e68dc[_0x001e('0x37')]=_[_0x001e('0x3a')](_0x2e68dc[_0x001e('0x37')],{'$or':_['map'](_0x5121bd,function(_0x2aeb51){if(_0x2aeb51['type']!==_0x001e('0x3b')){var _0x41166c={};_0x41166c[_0x2aeb51['name']]={'$like':'%'+_0x11d3e6['query'][_0x001e('0x39')]+'%'};return _0x41166c;}})});}_0x2e68dc=_[_0x001e('0x3a')]({},_0x2e68dc,_0x11d3e6[_0x001e('0x3c')]);var _0x599711={'where':_0x2e68dc[_0x001e('0x37')]};return db[_0x001e('0x3d')]['count'](_0x599711)[_0x001e('0x1f')](function(_0x54553c){_0x56fc31[_0x001e('0x16')]=_0x54553c;if(_0x11d3e6['query']['includeAll']){_0x2e68dc[_0x001e('0x3e')]=[{'all':!![]}];}return db[_0x001e('0x3d')][_0x001e('0x3f')](_0x2e68dc);})[_0x001e('0x1f')](function(_0x20978d){_0x56fc31['rows']=_0x20978d;return _0x56fc31;})['then'](respondWithFilteredResult(_0x12ebac,_0x2e68dc))[_0x001e('0x40')](handleError(_0x12ebac,null));};exports[_0x001e('0x41')]=function(_0x13d966,_0x3b4b08){var _0x297730={'raw':!![],'where':{'id':_0x13d966[_0x001e('0x42')]['id']}},_0x3f4655={};_0x3f4655['model']=_['keys'](db[_0x001e('0x3d')][_0x001e('0x27')]);_0x3f4655['query']=_[_0x001e('0x2d')](_0x13d966[_0x001e('0x2c')]);_0x3f4655[_0x001e('0x2e')]=_[_0x001e('0x31')](_0x3f4655['model'],_0x3f4655['query']);_0x297730['attributes']=_[_0x001e('0x31')](_0x3f4655[_0x001e('0x2f')],qs[_0x001e('0x32')](_0x13d966['query']['fields']));_0x297730[_0x001e('0x30')]=_0x297730[_0x001e('0x30')]['length']?_0x297730[_0x001e('0x30')]:_0x3f4655['model'];if(_0x13d966[_0x001e('0x2c')][_0x001e('0x43')]){_0x297730[_0x001e('0x3e')]=[{'all':!![]}];}_0x297730=_['merge']({},_0x297730,_0x13d966[_0x001e('0x3c')]);return db[_0x001e('0x3d')]['find'](_0x297730)[_0x001e('0x1f')](handleEntityNotFound(_0x3b4b08,null))[_0x001e('0x1f')](respondWithResult(_0x3b4b08,null))['catch'](handleError(_0x3b4b08,null));};exports[_0x001e('0x44')]=function(_0x125289,_0x4900b5){var _0xdb804e={'where':{'id':_0x125289['params']['id']}},_0x444150={};_0x444150[_0x001e('0x2f')]=_['keys'](db[_0x001e('0x3d')]['rawAttributes']);_0xdb804e['attributes']=_[_0x001e('0x31')](_0x444150[_0x001e('0x2f')],qs[_0x001e('0x32')](_0x125289['query'][_0x001e('0x32')]));_0xdb804e[_0x001e('0x30')]=_0xdb804e[_0x001e('0x30')][_0x001e('0x45')]?_0xdb804e['attributes']:_0x444150[_0x001e('0x2f')];if(_0x125289['query'][_0x001e('0x43')]){_0xdb804e['include']=[{'all':!![]}];}_0xdb804e=_[_0x001e('0x3a')]({},_0xdb804e,_0x125289['options']);return db[_0x001e('0x3d')][_0x001e('0x46')](_0xdb804e)['then'](handleEntityNotFound(_0x4900b5,null))[_0x001e('0x1f')](function(_0x680218){if(_0x680218){var _0x5c80e3=_0x680218[_0x001e('0x47')]({'plain':!![]});_0x5c80e3=qs['omit'](_0x5c80e3,['id','createdAt',_0x001e('0x48')]);_0x125289['body']=_['omit'](_0x125289['body'],['id','createdAt','updatedAt']);return db[_0x001e('0x3d')]['create'](_[_0x001e('0x3a')](_0x5c80e3,_0x125289[_0x001e('0x49')]),{'include':_0x125289[_0x001e('0x2c')][_0x001e('0x43')]?[{'all':!![]}]:undefined});}})[_0x001e('0x1f')](respondWithResult(_0x4900b5,0xc9))[_0x001e('0x40')](handleError(_0x4900b5,null));};exports['update']=function(_0xc5e5e1,_0x4d31c2){if(_0xc5e5e1['body']['id']){delete _0xc5e5e1['body']['id'];}return db[_0x001e('0x3d')]['find']({'where':{'id':_0xc5e5e1[_0x001e('0x42')]['id']}})[_0x001e('0x1f')](handleEntityNotFound(_0x4d31c2,null))['then'](saveUpdates(_0xc5e5e1[_0x001e('0x49')],null))[_0x001e('0x1f')](respondWithResult(_0x4d31c2,null))[_0x001e('0x40')](handleError(_0x4d31c2,null));};exports[_0x001e('0x20')]=function(_0x4676f0,_0x5a45a3){return db[_0x001e('0x3d')][_0x001e('0x46')]({'where':{'id':_0x4676f0[_0x001e('0x42')]['id']}})[_0x001e('0x1f')](handleEntityNotFound(_0x5a45a3,null))[_0x001e('0x1f')](removeEntity(_0x5a45a3,null))[_0x001e('0x40')](handleError(_0x5a45a3,null));};exports[_0x001e('0x4a')]=function(_0x9a7e4a,_0x37943d,_0x1a8647){_0x9a7e4a['body'][_0x001e('0x24')]=_0x9a7e4a['file']['originalname'];_0x9a7e4a[_0x001e('0x49')][_0x001e('0x4b')]=_0x9a7e4a[_0x001e('0x4c')][_0x001e('0x4d')];_0x9a7e4a[_0x001e('0x49')][_0x001e('0x29')]=_0x9a7e4a[_0x001e('0x4c')]['mimetype'];return db[_0x001e('0x3d')][_0x001e('0x4a')](_0x9a7e4a[_0x001e('0x49')])[_0x001e('0x1f')](respondWithResult(_0x37943d,0xc9))[_0x001e('0x40')](handleError(_0x37943d,null));};exports['download']=function(_0x237c8c,_0x5e85a0,_0x2a3d1d){return db[_0x001e('0x3d')][_0x001e('0x4e')]({'where':{'id':_0x237c8c[_0x001e('0x42')]['id']},'raw':!![]})[_0x001e('0x1f')](handleEntityNotFound(_0x5e85a0,null))[_0x001e('0x1f')](function(_0x51535c){if(_0x51535c){return _0x5e85a0[_0x001e('0x4f')](path[_0x001e('0x50')](config['root'],_0x001e('0x51'),_0x51535c['basename']));}})[_0x001e('0x40')](handleError(_0x5e85a0,null));}; \ No newline at end of file +var _0x618c=['reject','save','then','destroy','stack','name','send','map','Attachment','fieldName','type','key','model','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','merge','VIRTUAL','filter','options','includeAll','include','findAll','catch','show','params','find','clone','rawAttributes','get','createdAt','updatedAt','body','create','update','file','mimetype','download','findOne','join','root','server/files/attachments/','basename','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','papaparse','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/environment','../../mysqldb','sendStatus','status','end','json','count','offset','limit','set','Content-Range','apply'];(function(_0x5f79cb,_0x4b2c88){var _0x3580bc=function(_0x1f2839){while(--_0x1f2839){_0x5f79cb['push'](_0x5f79cb['shift']());}};_0x3580bc(++_0x4b2c88);}(_0x618c,0x1f2));var _0xc618=function(_0x13d74a,_0x56464e){_0x13d74a=_0x13d74a-0x0;var _0x26617e=_0x618c[_0x13d74a];return _0x26617e;};'use strict';var pdf=require(_0xc618('0x0'));var emlformat=require(_0xc618('0x1'));var rimraf=require(_0xc618('0x2'));var zipdir=require(_0xc618('0x3'));var jsonpatch=require(_0xc618('0x4'));var rp=require(_0xc618('0x5'));var moment=require(_0xc618('0x6'));var BPromise=require(_0xc618('0x7'));var Mustache=require(_0xc618('0x8'));var util=require(_0xc618('0x9'));var path=require('path');var sox=require(_0xc618('0xa'));var csv=require(_0xc618('0xb'));var ejs=require(_0xc618('0xc'));var fs=require('fs');var _=require(_0xc618('0xd'));var squel=require(_0xc618('0xe'));var crypto=require(_0xc618('0xf'));var jsforce=require(_0xc618('0x10'));var deskjs=require(_0xc618('0x11'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0xc618('0x12'));var Redis=require('ioredis');var authService=require(_0xc618('0x13'));var qs=require(_0xc618('0x14'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xc618('0x15'));var logger=require(_0xc618('0x16'))(_0xc618('0x17'));var utils=require('../../config/utils');var config=require(_0xc618('0x18'));var db=require(_0xc618('0x19'))['db'];function respondWithStatusCode(_0x992fab,_0xcfd5b7){_0xcfd5b7=_0xcfd5b7||0xcc;return function(_0x182f3b){if(_0x182f3b){return _0x992fab[_0xc618('0x1a')](_0xcfd5b7);}return _0x992fab[_0xc618('0x1b')](_0xcfd5b7)[_0xc618('0x1c')]();};}function respondWithResult(_0x65b1b9,_0x28520f){_0x28520f=_0x28520f||0xc8;return function(_0x38a62e){if(_0x38a62e){return _0x65b1b9[_0xc618('0x1b')](_0x28520f)[_0xc618('0x1d')](_0x38a62e);}};}function respondWithFilteredResult(_0x33009f,_0x35d93d){return function(_0x37468f){if(_0x37468f){var _0x401c91=_0x37468f[_0xc618('0x1e')],_0x586551=_0x35d93d[_0xc618('0x1f')],_0x116bd7=_0x35d93d[_0xc618('0x1f')]+_0x35d93d[_0xc618('0x20')],_0x3c9d03;if(_0x116bd7>=_0x401c91){_0x116bd7=_0x401c91;_0x3c9d03=0xc8;}else{_0x3c9d03=0xce;}_0x33009f[_0xc618('0x1b')](_0x3c9d03);return _0x33009f[_0xc618('0x21')](_0xc618('0x22'),_0x586551+'-'+_0x116bd7+'/'+_0x401c91)[_0xc618('0x1d')](_0x37468f);}return null;};}function patchUpdates(_0x2cf439){return function(_0x2cf72f){try{jsonpatch[_0xc618('0x23')](_0x2cf72f,_0x2cf439,!![]);}catch(_0x16eb74){return BPromise[_0xc618('0x24')](_0x16eb74);}return _0x2cf72f[_0xc618('0x25')]();};}function saveUpdates(_0x17efde,_0x25f75f){return function(_0x285e98){if(_0x285e98){return _0x285e98['update'](_0x17efde)[_0xc618('0x26')](function(_0x191299){return _0x191299;});}return null;};}function removeEntity(_0x422417,_0x55b4c1){return function(_0x2bcf24){if(_0x2bcf24){return _0x2bcf24[_0xc618('0x27')]()[_0xc618('0x26')](function(){_0x422417[_0xc618('0x1b')](0xcc)[_0xc618('0x1c')]();});}};}function handleEntityNotFound(_0x3d00ed,_0xa2a8ca){return function(_0x1d7423){if(!_0x1d7423){_0x3d00ed[_0xc618('0x1a')](0x194);}return _0x1d7423;};}function handleError(_0x42e240,_0x45f2c5){_0x45f2c5=_0x45f2c5||0x1f4;return function(_0x34083f){logger['error'](_0x34083f[_0xc618('0x28')]);if(_0x34083f[_0xc618('0x29')]){delete _0x34083f['name'];}_0x42e240[_0xc618('0x1b')](_0x45f2c5)[_0xc618('0x2a')](_0x34083f);};}exports['index']=function(_0x4a21c5,_0x1caa9d){var _0x3c0fd5={},_0x3d9f91={},_0x251aeb={'count':0x0,'rows':[]};var _0x3037fa=_[_0xc618('0x2b')](db[_0xc618('0x2c')]['rawAttributes'],function(_0x479a97){return{'name':_0x479a97[_0xc618('0x2d')],'type':_0x479a97[_0xc618('0x2e')][_0xc618('0x2f')]};});_0x3d9f91[_0xc618('0x30')]=_[_0xc618('0x2b')](_0x3037fa,_0xc618('0x29'));_0x3d9f91['query']=_[_0xc618('0x31')](_0x4a21c5[_0xc618('0x32')]);_0x3d9f91[_0xc618('0x33')]=_[_0xc618('0x34')](_0x3d9f91[_0xc618('0x30')],_0x3d9f91[_0xc618('0x32')]);_0x3c0fd5[_0xc618('0x35')]=_[_0xc618('0x34')](_0x3d9f91['model'],qs[_0xc618('0x36')](_0x4a21c5[_0xc618('0x32')][_0xc618('0x36')]));_0x3c0fd5[_0xc618('0x35')]=_0x3c0fd5['attributes'][_0xc618('0x37')]?_0x3c0fd5['attributes']:_0x3d9f91[_0xc618('0x30')];if(!_0x4a21c5[_0xc618('0x32')][_0xc618('0x38')](_0xc618('0x39'))){_0x3c0fd5['limit']=qs[_0xc618('0x20')](_0x4a21c5[_0xc618('0x32')][_0xc618('0x20')]);_0x3c0fd5['offset']=qs[_0xc618('0x1f')](_0x4a21c5['query'][_0xc618('0x1f')]);}_0x3c0fd5[_0xc618('0x3a')]=qs[_0xc618('0x3b')](_0x4a21c5[_0xc618('0x32')][_0xc618('0x3b')]);_0x3c0fd5[_0xc618('0x3c')]=qs[_0xc618('0x33')](_[_0xc618('0x3d')](_0x4a21c5[_0xc618('0x32')],_0x3d9f91['filters']));if(_0x4a21c5['query']['filter']){_0x3c0fd5[_0xc618('0x3c')]=_[_0xc618('0x3e')](_0x3c0fd5[_0xc618('0x3c')],{'$or':_[_0xc618('0x2b')](_0x3037fa,function(_0x5c6a85){if(_0x5c6a85[_0xc618('0x2e')]!==_0xc618('0x3f')){var _0xc9c833={};_0xc9c833[_0x5c6a85[_0xc618('0x29')]]={'$like':'%'+_0x4a21c5['query'][_0xc618('0x40')]+'%'};return _0xc9c833;}})});}_0x3c0fd5=_['merge']({},_0x3c0fd5,_0x4a21c5[_0xc618('0x41')]);var _0x4a109a={'where':_0x3c0fd5['where']};return db[_0xc618('0x2c')]['count'](_0x4a109a)[_0xc618('0x26')](function(_0x2e12d1){_0x251aeb[_0xc618('0x1e')]=_0x2e12d1;if(_0x4a21c5[_0xc618('0x32')][_0xc618('0x42')]){_0x3c0fd5[_0xc618('0x43')]=[{'all':!![]}];}return db[_0xc618('0x2c')][_0xc618('0x44')](_0x3c0fd5);})[_0xc618('0x26')](function(_0x322cd9){_0x251aeb['rows']=_0x322cd9;return _0x251aeb;})[_0xc618('0x26')](respondWithFilteredResult(_0x1caa9d,_0x3c0fd5))[_0xc618('0x45')](handleError(_0x1caa9d,null));};exports[_0xc618('0x46')]=function(_0x5e7866,_0xa02422){var _0x32e1a0={'raw':!![],'where':{'id':_0x5e7866[_0xc618('0x47')]['id']}},_0xf76918={};_0xf76918[_0xc618('0x30')]=_[_0xc618('0x31')](db[_0xc618('0x2c')]['rawAttributes']);_0xf76918[_0xc618('0x32')]=_['keys'](_0x5e7866[_0xc618('0x32')]);_0xf76918['filters']=_[_0xc618('0x34')](_0xf76918[_0xc618('0x30')],_0xf76918[_0xc618('0x32')]);_0x32e1a0[_0xc618('0x35')]=_['intersection'](_0xf76918['model'],qs[_0xc618('0x36')](_0x5e7866['query']['fields']));_0x32e1a0[_0xc618('0x35')]=_0x32e1a0[_0xc618('0x35')][_0xc618('0x37')]?_0x32e1a0['attributes']:_0xf76918[_0xc618('0x30')];if(_0x5e7866['query'][_0xc618('0x42')]){_0x32e1a0[_0xc618('0x43')]=[{'all':!![]}];}_0x32e1a0=_[_0xc618('0x3e')]({},_0x32e1a0,_0x5e7866[_0xc618('0x41')]);return db[_0xc618('0x2c')][_0xc618('0x48')](_0x32e1a0)[_0xc618('0x26')](handleEntityNotFound(_0xa02422,null))[_0xc618('0x26')](respondWithResult(_0xa02422,null))[_0xc618('0x45')](handleError(_0xa02422,null));};exports[_0xc618('0x49')]=function(_0x30a368,_0x407a82){var _0x5b3789={'where':{'id':_0x30a368['params']['id']}},_0x1527e9={};_0x1527e9['model']=_['keys'](db[_0xc618('0x2c')][_0xc618('0x4a')]);_0x5b3789[_0xc618('0x35')]=_[_0xc618('0x34')](_0x1527e9[_0xc618('0x30')],qs[_0xc618('0x36')](_0x30a368[_0xc618('0x32')][_0xc618('0x36')]));_0x5b3789[_0xc618('0x35')]=_0x5b3789[_0xc618('0x35')][_0xc618('0x37')]?_0x5b3789[_0xc618('0x35')]:_0x1527e9[_0xc618('0x30')];if(_0x30a368[_0xc618('0x32')]['includeAll']){_0x5b3789[_0xc618('0x43')]=[{'all':!![]}];}_0x5b3789=_[_0xc618('0x3e')]({},_0x5b3789,_0x30a368[_0xc618('0x41')]);return db['Attachment'][_0xc618('0x48')](_0x5b3789)[_0xc618('0x26')](handleEntityNotFound(_0x407a82,null))['then'](function(_0x2c4643){if(_0x2c4643){var _0x36978b=_0x2c4643[_0xc618('0x4b')]({'plain':!![]});_0x36978b=qs['omit'](_0x36978b,['id',_0xc618('0x4c'),_0xc618('0x4d')]);_0x30a368[_0xc618('0x4e')]=_['omit'](_0x30a368[_0xc618('0x4e')],['id',_0xc618('0x4c'),_0xc618('0x4d')]);return db['Attachment'][_0xc618('0x4f')](_[_0xc618('0x3e')](_0x36978b,_0x30a368[_0xc618('0x4e')]),{'include':_0x30a368[_0xc618('0x32')][_0xc618('0x42')]?[{'all':!![]}]:undefined});}})['then'](respondWithResult(_0x407a82,0xc9))[_0xc618('0x45')](handleError(_0x407a82,null));};exports[_0xc618('0x50')]=function(_0x39327e,_0xc8cbe3){if(_0x39327e['body']['id']){delete _0x39327e[_0xc618('0x4e')]['id'];}return db[_0xc618('0x2c')][_0xc618('0x48')]({'where':{'id':_0x39327e['params']['id']}})[_0xc618('0x26')](handleEntityNotFound(_0xc8cbe3,null))[_0xc618('0x26')](saveUpdates(_0x39327e['body'],null))[_0xc618('0x26')](respondWithResult(_0xc8cbe3,null))[_0xc618('0x45')](handleError(_0xc8cbe3,null));};exports[_0xc618('0x27')]=function(_0x2740f1,_0x2dd5b8){return db[_0xc618('0x2c')][_0xc618('0x48')]({'where':{'id':_0x2740f1[_0xc618('0x47')]['id']}})[_0xc618('0x26')](handleEntityNotFound(_0x2dd5b8,null))[_0xc618('0x26')](removeEntity(_0x2dd5b8,null))[_0xc618('0x45')](handleError(_0x2dd5b8,null));};exports[_0xc618('0x4f')]=function(_0x185aeb,_0x2802aa,_0x3b5dec){_0x185aeb[_0xc618('0x4e')][_0xc618('0x29')]=_0x185aeb[_0xc618('0x51')]['originalname'];_0x185aeb[_0xc618('0x4e')]['basename']=_0x185aeb[_0xc618('0x51')]['filename'];_0x185aeb[_0xc618('0x4e')]['type']=_0x185aeb['file'][_0xc618('0x52')];return db[_0xc618('0x2c')]['create'](_0x185aeb[_0xc618('0x4e')])[_0xc618('0x26')](respondWithResult(_0x2802aa,0xc9))['catch'](handleError(_0x2802aa,null));};exports[_0xc618('0x53')]=function(_0xd996a6,_0x4833bc,_0x5d0a96){return db[_0xc618('0x2c')][_0xc618('0x54')]({'where':{'id':_0xd996a6[_0xc618('0x47')]['id']},'raw':!![]})[_0xc618('0x26')](handleEntityNotFound(_0x4833bc,null))[_0xc618('0x26')](function(_0x21b683){if(_0x21b683){return _0x4833bc[_0xc618('0x53')](path[_0xc618('0x55')](config[_0xc618('0x56')],_0xc618('0x57'),_0x21b683[_0xc618('0x58')]));}})[_0xc618('0x45')](handleError(_0x4833bc,null));}; \ No newline at end of file diff --git a/server/api/attachment/attachment.model.js b/server/api/attachment/attachment.model.js index 56f3b9d..9f5caf4 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 _0x4f2f=['request-promise','path','rimraf','../../config/environment','./attachment.attributes','exports','define','Attachment','../../config/logger','api','bluebird'];(function(_0x41f2f5,_0x14f33c){var _0x3d49f1=function(_0x300207){while(--_0x300207){_0x41f2f5['push'](_0x41f2f5['shift']());}};_0x3d49f1(++_0x14f33c);}(_0x4f2f,0x1cb));var _0xf4f2=function(_0x186376,_0x5d988a){_0x186376=_0x186376-0x0;var _0x2dbdd9=_0x4f2f[_0x186376];return _0x2dbdd9;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0xf4f2('0x0'))(_0xf4f2('0x1'));var moment=require('moment');var BPromise=require(_0xf4f2('0x2'));var rp=require(_0xf4f2('0x3'));var fs=require('fs');var path=require(_0xf4f2('0x4'));var rimraf=require(_0xf4f2('0x5'));var config=require(_0xf4f2('0x6'));var attributes=require(_0xf4f2('0x7'));module[_0xf4f2('0x8')]=function(_0x2d7c29,_0x1e0ceb){return _0x2d7c29[_0xf4f2('0x9')](_0xf4f2('0xa'),attributes,{'tableName':'attachments','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x4213=['util','../../config/logger','api','moment','bluebird','request-promise','rimraf','./attachment.attributes','exports','Attachment','attachments','lodash'];(function(_0x37839f,_0x9b2544){var _0x47ddd4=function(_0x291361){while(--_0x291361){_0x37839f['push'](_0x37839f['shift']());}};_0x47ddd4(++_0x9b2544);}(_0x4213,0x77));var _0x3421=function(_0x5c57ca,_0x1e49a6){_0x5c57ca=_0x5c57ca-0x0;var _0x13d182=_0x4213[_0x5c57ca];return _0x13d182;};'use strict';var _=require(_0x3421('0x0'));var util=require(_0x3421('0x1'));var logger=require(_0x3421('0x2'))(_0x3421('0x3'));var moment=require(_0x3421('0x4'));var BPromise=require(_0x3421('0x5'));var rp=require(_0x3421('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0x3421('0x7'));var config=require('../../config/environment');var attributes=require(_0x3421('0x8'));module[_0x3421('0x9')]=function(_0x2155f8,_0x2a04e0){return _0x2155f8['define'](_0x3421('0xa'),attributes,{'tableName':_0x3421('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/attachment/attachment.rpc.js b/server/api/attachment/attachment.rpc.js index 2dd1235..85e18ae 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 _0x6250=['../../config/utils','rpc','../../config/environment','jayson/promise','client','then','request\x20sent','stringify','error','code','Attachment,\x20%s,\x20%s','message','info','result','catch','CreateAttachment','Attachment','options','raw','debug','lodash','util','bluebird','ioredis','../../mysqldb'];(function(_0x413feb,_0x10477f){var _0x40ee88=function(_0x32a3f6){while(--_0x32a3f6){_0x413feb['push'](_0x413feb['shift']());}};_0x40ee88(++_0x10477f);}(_0x6250,0x18b));var _0x0625=function(_0x66bbc2,_0x53264e){_0x66bbc2=_0x66bbc2-0x0;var _0x2a74f0=_0x6250[_0x66bbc2];return _0x2a74f0;};'use strict';var _=require(_0x0625('0x0'));var util=require(_0x0625('0x1'));var moment=require('moment');var BPromise=require(_0x0625('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x0625('0x3'));var db=require(_0x0625('0x4'))['db'];var utils=require(_0x0625('0x5'));var logger=require('../../config/logger')(_0x0625('0x6'));var config=require(_0x0625('0x7'));var jayson=require(_0x0625('0x8'));var client=jayson[_0x0625('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x10c8dc,_0x10c2e6,_0x456dd9){return new BPromise(function(_0x417f56,_0x3c3794){return client['request'](_0x10c8dc,_0x456dd9)[_0x0625('0xa')](function(_0x8be2de){logger['info']('Attachment,\x20%s,\x20%s',_0x10c2e6,_0x0625('0xb'));logger['debug']('Attachment,\x20%s,\x20%s,\x20%s',_0x10c2e6,'request\x20sent',JSON[_0x0625('0xc')](_0x8be2de));if(_0x8be2de[_0x0625('0xd')]){if(_0x8be2de['error'][_0x0625('0xe')]===0x1f4){logger[_0x0625('0xd')](_0x0625('0xf'),_0x10c2e6,_0x8be2de[_0x0625('0xd')][_0x0625('0x10')]);return _0x3c3794(_0x8be2de['error']['message']);}logger[_0x0625('0xd')](_0x0625('0xf'),_0x10c2e6,_0x8be2de[_0x0625('0xd')][_0x0625('0x10')]);return _0x417f56(_0x8be2de[_0x0625('0xd')]['message']);}else{logger[_0x0625('0x11')](_0x0625('0xf'),_0x10c2e6,_0x0625('0xb'));_0x417f56(_0x8be2de[_0x0625('0x12')][_0x0625('0x10')]);}})[_0x0625('0x13')](function(_0x31f351){logger[_0x0625('0xd')](_0x0625('0xf'),_0x10c2e6,_0x31f351);_0x3c3794(_0x31f351);});});}exports[_0x0625('0x14')]=function(_0x52f080){var _0x31caf3=this;return new Promise(function(_0x224964,_0x40d899){return db[_0x0625('0x15')]['create'](_0x52f080['body'],{'raw':_0x52f080[_0x0625('0x16')]?_0x52f080[_0x0625('0x16')][_0x0625('0x17')]===undefined?!![]:![]:!![]})[_0x0625('0xa')](function(_0x3a8f48){logger[_0x0625('0x11')](_0x0625('0x14'),_0x52f080);logger[_0x0625('0x18')](_0x0625('0x14'),_0x52f080,JSON[_0x0625('0xc')](_0x3a8f48));_0x224964(_0x3a8f48);})[_0x0625('0x13')](function(_0x42d434){logger[_0x0625('0xd')](_0x0625('0x14'),_0x42d434[_0x0625('0x10')],_0x52f080);_0x40d899(_0x31caf3['error'](0x1f4,_0x42d434[_0x0625('0x10')]));});});}; \ No newline at end of file +var _0x31cd=['info','Attachment,\x20%s,\x20%s','debug','stringify','error','code','message','request\x20sent','result','Attachment','create','body','options','raw','CreateAttachment','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/environment','jayson/promise','client','http','then'];(function(_0x1abbaa,_0x1b7a38){var _0x40ed52=function(_0x44858f){while(--_0x44858f){_0x1abbaa['push'](_0x1abbaa['shift']());}};_0x40ed52(++_0x1b7a38);}(_0x31cd,0xb8));var _0xd31c=function(_0x1b8c80,_0x39046e){_0x1b8c80=_0x1b8c80-0x0;var _0x169bad=_0x31cd[_0x1b8c80];return _0x169bad;};'use strict';var _=require(_0xd31c('0x0'));var util=require(_0xd31c('0x1'));var moment=require(_0xd31c('0x2'));var BPromise=require(_0xd31c('0x3'));var rs=require(_0xd31c('0x4'));var fs=require('fs');var Redis=require(_0xd31c('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0xd31c('0x6'));var logger=require('../../config/logger')('rpc');var config=require(_0xd31c('0x7'));var jayson=require(_0xd31c('0x8'));var client=jayson[_0xd31c('0x9')][_0xd31c('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x5f4418,_0xcd77e3,_0x163e20){return new BPromise(function(_0x43bd59,_0x1f21a8){return client['request'](_0x5f4418,_0x163e20)[_0xd31c('0xb')](function(_0x46cb8a){logger[_0xd31c('0xc')](_0xd31c('0xd'),_0xcd77e3,'request\x20sent');logger[_0xd31c('0xe')]('Attachment,\x20%s,\x20%s,\x20%s',_0xcd77e3,'request\x20sent',JSON[_0xd31c('0xf')](_0x46cb8a));if(_0x46cb8a[_0xd31c('0x10')]){if(_0x46cb8a[_0xd31c('0x10')][_0xd31c('0x11')]===0x1f4){logger[_0xd31c('0x10')]('Attachment,\x20%s,\x20%s',_0xcd77e3,_0x46cb8a['error']['message']);return _0x1f21a8(_0x46cb8a[_0xd31c('0x10')][_0xd31c('0x12')]);}logger['error'](_0xd31c('0xd'),_0xcd77e3,_0x46cb8a[_0xd31c('0x10')][_0xd31c('0x12')]);return _0x43bd59(_0x46cb8a['error'][_0xd31c('0x12')]);}else{logger['info']('Attachment,\x20%s,\x20%s',_0xcd77e3,_0xd31c('0x13'));_0x43bd59(_0x46cb8a[_0xd31c('0x14')][_0xd31c('0x12')]);}})['catch'](function(_0x300338){logger[_0xd31c('0x10')]('Attachment,\x20%s,\x20%s',_0xcd77e3,_0x300338);_0x1f21a8(_0x300338);});});}exports['CreateAttachment']=function(_0x3582b1){var _0x8c46c8=this;return new Promise(function(_0x4bd9ce,_0x1ffe17){return db[_0xd31c('0x15')][_0xd31c('0x16')](_0x3582b1[_0xd31c('0x17')],{'raw':_0x3582b1[_0xd31c('0x18')]?_0x3582b1[_0xd31c('0x18')][_0xd31c('0x19')]===undefined?!![]:![]:!![]})['then'](function(_0x1ba5ef){logger['info'](_0xd31c('0x1a'),_0x3582b1);logger['debug'](_0xd31c('0x1a'),_0x3582b1,JSON[_0xd31c('0xf')](_0x1ba5ef));_0x4bd9ce(_0x1ba5ef);})[_0xd31c('0x1b')](function(_0x586512){logger[_0xd31c('0x10')](_0xd31c('0x1a'),_0x586512[_0xd31c('0x12')],_0x3582b1);_0x1ffe17(_0x8c46c8['error'](0x1f4,_0x586512['message']));});});}; \ No newline at end of file diff --git a/server/api/attachment/index.js b/server/api/attachment/index.js index fc1265e..a1727d0 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 _0xc359=['replace','post','single','file','create','delete','exports','multer','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','./attachment.controller','get','/:id','show','/:id/download','isAuthenticated','/:id/clone','clone','diskStorage','join','root','format','%s-%s','now'];(function(_0x29ac6e,_0x2355ca){var _0x18cdd7=function(_0x410a24){while(--_0x410a24){_0x29ac6e['push'](_0x29ac6e['shift']());}};_0x18cdd7(++_0x2355ca);}(_0xc359,0x93));var _0x9c35=function(_0x22f9c0,_0x35410c){_0x22f9c0=_0x22f9c0-0x0;var _0x1883fe=_0xc359[_0x22f9c0];return _0x1883fe;};'use strict';var multer=require(_0x9c35('0x0'));var util=require('util');var path=require(_0x9c35('0x1'));var timeout=require(_0x9c35('0x2'));var express=require(_0x9c35('0x3'));var router=express[_0x9c35('0x4')]();var auth=require(_0x9c35('0x5'));var interaction=require(_0x9c35('0x6'));var config=require('../../config/environment');var controller=require(_0x9c35('0x7'));router[_0x9c35('0x8')]('/',auth['isAuthenticated'](),controller['index']);router[_0x9c35('0x8')](_0x9c35('0x9'),auth['isAuthenticated'](),controller[_0x9c35('0xa')]);router[_0x9c35('0x8')](_0x9c35('0xb'),auth[_0x9c35('0xc')](),controller['download']);router['post'](_0x9c35('0xd'),auth['isAuthenticated'](),controller[_0x9c35('0xe')]);var upload=multer({'storage':multer[_0x9c35('0xf')]({'destination':function(_0x5784f0,_0x496098,_0x128dc9){_0x128dc9(null,path[_0x9c35('0x10')](config[_0x9c35('0x11')],'server/files/attachments/'));},'filename':function(_0x507ab2,_0x10fb07,_0x35cad0){_0x35cad0(null,util[_0x9c35('0x12')](_0x9c35('0x13'),Date[_0x9c35('0x14')](),_0x10fb07['originalname'][_0x9c35('0x15')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-')));}})});router[_0x9c35('0x16')]('/',upload[_0x9c35('0x17')](_0x9c35('0x18')),controller[_0x9c35('0x19')]);router['put'](_0x9c35('0x9'),auth[_0x9c35('0xc')](),controller['update']);router[_0x9c35('0x1a')]('/:id',auth['isAuthenticated'](),controller['destroy']);module[_0x9c35('0x1b')]=router; \ No newline at end of file +var _0xd9f4=['%s-%s','now','single','put','update','delete','destroy','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./attachment.controller','get','isAuthenticated','index','/:id','show','/:id/download','post','/:id/clone','diskStorage','join','root','format'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0xd9f4,0x7b));var _0x4d9f=function(_0x725a4c,_0x102507){_0x725a4c=_0x725a4c-0x0;var _0x37b2cc=_0xd9f4[_0x725a4c];return _0x37b2cc;};'use strict';var multer=require(_0x4d9f('0x0'));var util=require(_0x4d9f('0x1'));var path=require(_0x4d9f('0x2'));var timeout=require(_0x4d9f('0x3'));var express=require(_0x4d9f('0x4'));var router=express[_0x4d9f('0x5')]();var auth=require(_0x4d9f('0x6'));var interaction=require(_0x4d9f('0x7'));var config=require(_0x4d9f('0x8'));var controller=require(_0x4d9f('0x9'));router[_0x4d9f('0xa')]('/',auth[_0x4d9f('0xb')](),controller[_0x4d9f('0xc')]);router[_0x4d9f('0xa')](_0x4d9f('0xd'),auth[_0x4d9f('0xb')](),controller[_0x4d9f('0xe')]);router[_0x4d9f('0xa')](_0x4d9f('0xf'),auth[_0x4d9f('0xb')](),controller['download']);router[_0x4d9f('0x10')](_0x4d9f('0x11'),auth[_0x4d9f('0xb')](),controller['clone']);var upload=multer({'storage':multer[_0x4d9f('0x12')]({'destination':function(_0x5687ff,_0x1193cb,_0x43f306){_0x43f306(null,path[_0x4d9f('0x13')](config[_0x4d9f('0x14')],'server/files/attachments/'));},'filename':function(_0x5d400d,_0x372cd5,_0x17ac30){_0x17ac30(null,util[_0x4d9f('0x15')](_0x4d9f('0x16'),Date[_0x4d9f('0x17')](),_0x372cd5['originalname']['replace'](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-')));}})});router[_0x4d9f('0x10')]('/',upload[_0x4d9f('0x18')]('file'),controller['create']);router[_0x4d9f('0x19')](_0x4d9f('0xd'),auth[_0x4d9f('0xb')](),controller[_0x4d9f('0x1a')]);router[_0x4d9f('0x1b')](_0x4d9f('0xd'),auth[_0x4d9f('0xb')](),controller[_0x4d9f('0x1c')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/authGoogle/authGoogle.controller.js b/server/api/authGoogle/authGoogle.controller.js index b277dfb..a237b21 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 _0x84ab=['catch','lodash','passport','passport-google-oauth20','moment','../../mysqldb','../../config/environment','signToken','../../config/utils','authenticate','google','profile','email','callback','/login','use','clientSecret','secret','callbackURL','Setting','findOne','allowedLoginAttempts','then','User','map','value','admin','user','agent','disabled','Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.','blockedAt','add','clearBlockUser','getLicense'];(function(_0x5b9c76,_0x4fc91b){var _0x33793b=function(_0x2b7589){while(--_0x2b7589){_0x5b9c76['push'](_0x5b9c76['shift']());}};_0x33793b(++_0x4fc91b);}(_0x84ab,0x1eb));var _0xb84a=function(_0x5c2c7c,_0xa7d3b1){_0x5c2c7c=_0x5c2c7c-0x0;var _0xea7ffe=_0x84ab[_0x5c2c7c];return _0xea7ffe;};'use strict';var _=require(_0xb84a('0x0'));var passport=require(_0xb84a('0x1'));var GoogleStrategy=require(_0xb84a('0x2'))['Strategy'];var moment=require(_0xb84a('0x3'));var db=require(_0xb84a('0x4'))['db'];var config=require(_0xb84a('0x5'));var signToken=require('../../components/auth/service')[_0xb84a('0x6')];var utils=require(_0xb84a('0x7'));exports['login']=passport[_0xb84a('0x8')](_0xb84a('0x9'),{'failureRedirect':'/login','scope':[_0xb84a('0xa'),_0xb84a('0xb')],'session':![]});exports[_0xb84a('0xc')]=passport[_0xb84a('0x8')](_0xb84a('0x9'),{'failureRedirect':_0xb84a('0xd'),'session':![]});passport[_0xb84a('0xe')](new GoogleStrategy({'clientID':config[_0xb84a('0x9')]?config[_0xb84a('0x9')]['clientID']:'id','clientSecret':config[_0xb84a('0x9')]?config[_0xb84a('0x9')][_0xb84a('0xf')]:_0xb84a('0x10'),'callbackURL':config[_0xb84a('0x9')]?config[_0xb84a('0x9')][_0xb84a('0x11')]:''},function(_0x2a2700,_0x42a78d,_0x4a819a,_0x8bca7){var _0x542d83,_0x30e380;return db[_0xb84a('0x12')][_0xb84a('0x13')]({'where':{'id':0x1},'attributes':[_0xb84a('0x14'),'blockDuration'],'raw':!![]})[_0xb84a('0x15')](function(_0x13901e){_0x542d83=_0x13901e;return db[_0xb84a('0x16')]['find']({'where':{'email':_[_0xb84a('0x17')](_0x4a819a['emails'],_0xb84a('0x18')),'role':{'$or':[_0xb84a('0x19'),_0xb84a('0x1a'),_0xb84a('0x1b')]}}});})[_0xb84a('0x15')](function(_0x162916){_0x30e380=_0x162916;if(_0x30e380){if(_0x30e380[_0xb84a('0x1c')]){return _0x8bca7(_0xb84a('0x1d'));}else if(_0x542d83['blockDuration']>0x0){if(_0x30e380['blocked']){if(moment(_0x30e380[_0xb84a('0x1e')])[_0xb84a('0x1f')](_0x542d83['blockDuration'],'minutes')>moment()){return _0x8bca7(_0xb84a('0x1d'));}else{return utils[_0xb84a('0x20')](_0x30e380,0x0,![],null)[_0xb84a('0x15')](function(){return utils[_0xb84a('0x21')](_0x30e380);})[_0xb84a('0x15')](function(){return _0x8bca7(null,_0x30e380);});}}else{return utils[_0xb84a('0x21')](_0x30e380)[_0xb84a('0x15')](function(){return _0x8bca7(null,_0x30e380);});}}else{return utils[_0xb84a('0x21')](_0x30e380)[_0xb84a('0x15')](function(){return _0x8bca7(null,_0x30e380);});}}return _0x8bca7(_0xb84a('0x1d'));})[_0xb84a('0x22')](function(_0x2e8c31){_0x8bca7(_0x2e8c31);});})); \ No newline at end of file +var _0x8596=['authenticate','google','profile','email','callback','/login','use','clientID','clientSecret','Setting','findOne','allowedLoginAttempts','blockDuration','User','find','map','emails','value','admin','user','agent','disabled','Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.','blocked','blockedAt','minutes','clearBlockUser','getLicense','then','catch','lodash','passport','passport-google-oauth20','moment','../../mysqldb','login'];(function(_0x503790,_0x525c78){var _0x388092=function(_0x2ab2b8){while(--_0x2ab2b8){_0x503790['push'](_0x503790['shift']());}};_0x388092(++_0x525c78);}(_0x8596,0xae));var _0x6859=function(_0x502c7d,_0x2f1285){_0x502c7d=_0x502c7d-0x0;var _0x30b7ed=_0x8596[_0x502c7d];return _0x30b7ed;};'use strict';var _=require(_0x6859('0x0'));var passport=require(_0x6859('0x1'));var GoogleStrategy=require(_0x6859('0x2'))['Strategy'];var moment=require(_0x6859('0x3'));var db=require(_0x6859('0x4'))['db'];var config=require('../../config/environment');var signToken=require('../../components/auth/service')['signToken'];var utils=require('../../config/utils');exports[_0x6859('0x5')]=passport[_0x6859('0x6')](_0x6859('0x7'),{'failureRedirect':'/login','scope':[_0x6859('0x8'),_0x6859('0x9')],'session':![]});exports[_0x6859('0xa')]=passport[_0x6859('0x6')](_0x6859('0x7'),{'failureRedirect':_0x6859('0xb'),'session':![]});passport[_0x6859('0xc')](new GoogleStrategy({'clientID':config['google']?config[_0x6859('0x7')][_0x6859('0xd')]:'id','clientSecret':config['google']?config[_0x6859('0x7')][_0x6859('0xe')]:'secret','callbackURL':config[_0x6859('0x7')]?config['google']['callbackURL']:''},function(_0x91db43,_0x85f6ba,_0x553813,_0x3f1bcc){var _0x2df46f,_0x1c2d7c;return db[_0x6859('0xf')][_0x6859('0x10')]({'where':{'id':0x1},'attributes':[_0x6859('0x11'),_0x6859('0x12')],'raw':!![]})['then'](function(_0x16b622){_0x2df46f=_0x16b622;return db[_0x6859('0x13')][_0x6859('0x14')]({'where':{'email':_[_0x6859('0x15')](_0x553813[_0x6859('0x16')],_0x6859('0x17')),'role':{'$or':[_0x6859('0x18'),_0x6859('0x19'),_0x6859('0x1a')]}}});})['then'](function(_0x39014a){_0x1c2d7c=_0x39014a;if(_0x1c2d7c){if(_0x1c2d7c[_0x6859('0x1b')]){return _0x3f1bcc(_0x6859('0x1c'));}else if(_0x2df46f['blockDuration']>0x0){if(_0x1c2d7c[_0x6859('0x1d')]){if(moment(_0x1c2d7c[_0x6859('0x1e')])['add'](_0x2df46f[_0x6859('0x12')],_0x6859('0x1f'))>moment()){return _0x3f1bcc(_0x6859('0x1c'));}else{return utils[_0x6859('0x20')](_0x1c2d7c,0x0,![],null)['then'](function(){return utils[_0x6859('0x21')](_0x1c2d7c);})[_0x6859('0x22')](function(){return _0x3f1bcc(null,_0x1c2d7c);});}}else{return utils[_0x6859('0x21')](_0x1c2d7c)[_0x6859('0x22')](function(){return _0x3f1bcc(null,_0x1c2d7c);});}}else{return utils['getLicense'](_0x1c2d7c)['then'](function(){return _0x3f1bcc(null,_0x1c2d7c);});}}return _0x3f1bcc(_0x6859('0x1c'));})[_0x6859('0x23')](function(_0x27db5d){_0x3f1bcc(_0x27db5d);});})); \ No newline at end of file diff --git a/server/api/authGoogle/index.js b/server/api/authGoogle/index.js index da1b74c..e27bf34 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 _0xcfac=['./authGoogle.controller','../user/user.controller.js','../../components/auth/service','get','login','callback','isMiddleware','setTokenCookie','exports','express','passport','Router'];(function(_0x40550f,_0x4fc7e5){var _0x27304d=function(_0x3a43cf){while(--_0x3a43cf){_0x40550f['push'](_0x40550f['shift']());}};_0x27304d(++_0x4fc7e5);}(_0xcfac,0x105));var _0xccfa=function(_0x3bfd8a,_0x3cba18){_0x3bfd8a=_0x3bfd8a-0x0;var _0x56e63b=_0xcfac[_0x3bfd8a];return _0x56e63b;};'use strict';var express=require(_0xccfa('0x0'));var passport=require(_0xccfa('0x1'));var router=express[_0xccfa('0x2')]();var controller=require(_0xccfa('0x3'));var userController=require(_0xccfa('0x4'));var authService=require(_0xccfa('0x5'));router[_0xccfa('0x6')]('/',controller[_0xccfa('0x7')]);router[_0xccfa('0x6')]('/callback',controller[_0xccfa('0x8')],authService[_0xccfa('0x9')],userController[_0xccfa('0x7')],authService[_0xccfa('0xa')]);module[_0xccfa('0xb')]=router; \ No newline at end of file +var _0xe189=['callback','isMiddleware','login','setTokenCookie','express','./authGoogle.controller','../user/user.controller.js','../../components/auth/service','get','/callback'];(function(_0x31b5a5,_0x44376a){var _0x364cc9=function(_0x4e5f95){while(--_0x4e5f95){_0x31b5a5['push'](_0x31b5a5['shift']());}};_0x364cc9(++_0x44376a);}(_0xe189,0x194));var _0x9e18=function(_0x40726e,_0x463c55){_0x40726e=_0x40726e-0x0;var _0x4926c0=_0xe189[_0x40726e];return _0x4926c0;};'use strict';var express=require(_0x9e18('0x0'));var passport=require('passport');var router=express['Router']();var controller=require(_0x9e18('0x1'));var userController=require(_0x9e18('0x2'));var authService=require(_0x9e18('0x3'));router[_0x9e18('0x4')]('/',controller['login']);router['get'](_0x9e18('0x5'),controller[_0x9e18('0x6')],authService[_0x9e18('0x7')],userController[_0x9e18('0x8')],authService[_0x9e18('0x9')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/authLocal/authLocal.controller.js b/server/api/authLocal/authLocal.controller.js index fbda7fd..87c12a0 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 _0x8246=['agent','Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.','authenticate','add','minutes','clearBlockUser','disabled','getLicense','catch','MailAccount','find','email','MailServerOut','Unable\x20to\x20find\x20a\x20configured\x20SMTP\x20service!','service','host','Smtp','port','secure','authentication','auth','pass','merge','SendMail','error','format','SendMail\x20error:\x20%s.\x20Please\x20contact\x20your\x20Administrator!','message','stringify','status','send','test','The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.','login','local','Something\x20went\x20wrong,\x20please\x20try\x20again.','role','signToken','online','forgot','body','Email\x20parameter\x20is\x20missing','generate','trim','toLowerCase','User','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','Reset\x20Email\x20sent!','reset','params','token','Password\x20reset\x20token\x20is\x20invalid\x20or\x20has\x20expired.','securePassword','use','util','Strategy','jayson/promise','lodash','randomstring','moment','../../mysqldb','../../config/utils','client','Setting','findOne','allowedLoginAttempts','blockDuration','then','name','password','salt','blocked','blockedAt','loginAttempts','user'];(function(_0x3f289e,_0x23e73c){var _0x3e8669=function(_0xaafad7){while(--_0xaafad7){_0x3f289e['push'](_0x3f289e['shift']());}};_0x3e8669(++_0x23e73c);}(_0x8246,0x14b));var _0x6824=function(_0x4f3eb2,_0x424d44){_0x4f3eb2=_0x4f3eb2-0x0;var _0xdbccad=_0x8246[_0x4f3eb2];return _0xdbccad;};'use strict';var util=require(_0x6824('0x0'));var passport=require('passport');var LocalStrategy=require('passport-local')[_0x6824('0x1')];var jayson=require(_0x6824('0x2'));var _=require(_0x6824('0x3'));var rs=require(_0x6824('0x4'));var moment=require(_0x6824('0x5'));var db=require(_0x6824('0x6'))['db'];var authService=require('../../components/auth/service');var utils=require(_0x6824('0x7'));var client=jayson[_0x6824('0x8')]['http']({'port':0x232b});function localAuthenticate(_0x264f82,_0x18b192,_0x132464,_0x3cb0e8){var _0x2117e5,_0x6004e5;return db[_0x6824('0x9')][_0x6824('0xa')]({'where':{'id':0x1},'attributes':[_0x6824('0xb'),_0x6824('0xc')],'raw':!![]})[_0x6824('0xd')](function(_0x4d4ca7){_0x2117e5=_0x4d4ca7;return _0x264f82[_0x6824('0xa')]({'attributes':['id',_0x6824('0xe'),_0x6824('0xf'),_0x6824('0x10'),'role','disabled',_0x6824('0x11'),_0x6824('0x12'),_0x6824('0x13')],'where':{'name':_0x18b192,'role':{'$or':['admin',_0x6824('0x14'),_0x6824('0x15')]}}});})['then'](function(_0x1eaf08){if(!_0x1eaf08||_0x1eaf08&&_0x1eaf08[_0x6824('0xe')]!==_0x18b192){throw new Error(_0x6824('0x16'));}else{_0x6004e5=_0x1eaf08;return _0x6004e5;}})[_0x6824('0xd')](function(){_0x6004e5[_0x6824('0x17')](_0x132464,function(_0x125266,_0x4c8026){var _0x5a7512=_0x6004e5[_0x6824('0x13')]+0x1;if(_0x125266){return _0x3cb0e8(_0x125266);}else if(!_0x4c8026){if(_0x6004e5['disabled']){return _0x3cb0e8(null,![],{'message':_0x6824('0x16')});}else if(_0x2117e5['allowedLoginAttempts']>0x0){if(_0x6004e5['blocked']){if(_0x2117e5[_0x6824('0xc')]>0x0){if(moment(_0x6004e5[_0x6824('0x12')])[_0x6824('0x18')](_0x2117e5[_0x6824('0xc')],_0x6824('0x19'))>moment()){return _0x3cb0e8(null,![],{'message':_0x6824('0x16')});}else{return utils[_0x6824('0x1a')](_0x6004e5,_0x5a7512,![],null)[_0x6824('0xd')](function(){return _0x3cb0e8(null,![],{'message':'Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.'});});}}else{return _0x3cb0e8(null,![],{'message':_0x6824('0x16')});}}else{if(_0x5a7512>=_0x2117e5[_0x6824('0xb')]){return utils['clearBlockUser'](_0x6004e5,0x0,!![],moment())[_0x6824('0xd')](function(){return _0x3cb0e8(null,![],{'message':'Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.'});});}else{return utils[_0x6824('0x1a')](_0x6004e5,_0x5a7512,![],null)['then'](function(){return _0x3cb0e8(null,![],{'message':_0x6824('0x16')});});}}}else{return _0x3cb0e8(null,![],{'message':_0x6824('0x16')});}}else{if(_0x6004e5[_0x6824('0x1b')]){return _0x3cb0e8(null,![],{'message':_0x6824('0x16')});}else if(_0x2117e5['allowedLoginAttempts']>0x0){if(_0x6004e5[_0x6824('0x11')]){if(_0x2117e5[_0x6824('0xc')]>0x0){if(moment(_0x6004e5['blockedAt'])[_0x6824('0x18')](_0x2117e5['blockDuration'],'minutes')>moment()){return _0x3cb0e8(null,![],{'message':'Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.'});}else{return utils[_0x6824('0x1a')](_0x6004e5,0x0,![],null)[_0x6824('0xd')](function(){return utils[_0x6824('0x1c')](_0x6004e5);})[_0x6824('0xd')](function(){return _0x3cb0e8(null,_0x6004e5);});}}else{return _0x3cb0e8(null,![],{'message':_0x6824('0x16')});}}else{return utils[_0x6824('0x1a')](_0x6004e5,0x0,![],null)[_0x6824('0xd')](function(){return utils[_0x6824('0x1c')](_0x6004e5);})[_0x6824('0xd')](function(){return _0x3cb0e8(null,_0x6004e5);})[_0x6824('0x1d')](function(_0x311c19){return _0x3cb0e8(null,![],_0x311c19);});}}else{if(_0x6004e5[_0x6824('0x11')]){return _0x3cb0e8(null,![],{'message':_0x6824('0x16')});}else{return utils['getLicense'](_0x6004e5)[_0x6824('0xd')](function(){return _0x3cb0e8(null,_0x6004e5);});}}}});})[_0x6824('0x1d')](function(_0x4fc02f){return _0x3cb0e8(null,![],_0x4fc02f);});}function sendServiceMail(_0x240e1b){return db[_0x6824('0x1e')][_0x6824('0x1f')]({'where':{'service':!![]},'attributes':['id','name',_0x6824('0x20')],'include':[{'model':db[_0x6824('0x21')],'as':'Smtp'}]})[_0x6824('0xd')](function(_0x5068bf){if(!_0x5068bf){throw new Error(_0x6824('0x22'));}var _0x45c930={'tls':{'rejectUnauthorized':![]}};if(_0x5068bf['Smtp'][_0x6824('0x23')]){_0x45c930['service']=_0x5068bf['Smtp'][_0x6824('0x23')];}else{_0x45c930[_0x6824('0x24')]=_0x5068bf[_0x6824('0x25')]['host'];_0x45c930[_0x6824('0x26')]=_0x5068bf[_0x6824('0x25')][_0x6824('0x26')];_0x45c930[_0x6824('0x27')]=_0x5068bf['Smtp'][_0x6824('0x27')];}if(_0x5068bf['Smtp'][_0x6824('0x28')]){_0x45c930[_0x6824('0x29')]={'user':_0x5068bf[_0x6824('0x25')][_0x6824('0x14')],'pass':_0x5068bf[_0x6824('0x25')][_0x6824('0x2a')]};}var _0x3f212f={'account':_0x45c930,'message':_[_0x6824('0x2b')]({'from':util['format']('\x22%s\x22\x20<%s>',_0x5068bf[_0x6824('0xe')],_0x5068bf[_0x6824('0x20')]||_0x5068bf[_0x6824('0x25')]['user'])},_0x240e1b)};return client['request'](_0x6824('0x2c'),_0x3f212f);})[_0x6824('0xd')](function(_0x5ca27c){if(_0x5ca27c[_0x6824('0x2d')]){throw new Error(util[_0x6824('0x2e')](_0x6824('0x2f'),_0x5ca27c[_0x6824('0x2d')][_0x6824('0x30')]||JSON[_0x6824('0x31')](_0x5ca27c[_0x6824('0x2d')])));}return!![];});}function handleError(_0x1eb45d,_0x24ab3a,_0x20a76f){return _0x1eb45d[_0x6824('0x32')](_0x24ab3a||0x1f4)[_0x6824('0x33')]({'message':_0x20a76f?_0x20a76f[_0x6824('0x30')]||_0x20a76f:''});}function checkPasswordPattern(_0x147623,_0x2c878e,_0x4a6ece){if(_0x4a6ece){var _0x4f8c63=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x4f8c63[_0x6824('0x34')](_0x2c878e)){return _0x147623;}else{throw new Error(_0x6824('0x35'));}}else{return _0x147623;}}exports[_0x6824('0x36')]=function(_0x40989f,_0x3bfcdb,_0xe97d7b){passport[_0x6824('0x17')](_0x6824('0x37'),function(_0x5c533c,_0x5d74e9,_0xeee19){var _0x3c6c5a=_0x5c533c||_0xeee19;if(_0x3c6c5a){return handleError(_0x3bfcdb,0x191,_0x3c6c5a);}if(!_0x5d74e9){return handleError(_0x3bfcdb,0x194,{'message':_0x6824('0x38')});}else{var _0x1b0bb7={'payload':{'id':_0x5d74e9['id'],'role':_0x5d74e9[_0x6824('0x39')]},'options':{'expiresIn':0x15180}};return authService[_0x6824('0x3a')](_0x1b0bb7)[_0x6824('0xd')](function(_0x50e5c6){_0x3bfcdb['json']({'id':_0x5d74e9['id'],'token':_0x50e5c6,'statusCall':'','isAlreadyLogged':_0x5d74e9[_0x6824('0x3b')]});});}})(_0x40989f,_0x3bfcdb,_0xe97d7b);};exports[_0x6824('0x3c')]=function(_0x1a83e0,_0x5ec957,_0x3ceeaf){if(!_0x1a83e0[_0x6824('0x3d')]['email']){return handleError(_0x5ec957,0x1f4,{'message':_0x6824('0x3e')});}var _0xce39a2=rs[_0x6824('0x3f')]();_0x1a83e0[_0x6824('0x3d')][_0x6824('0x20')]=_0x1a83e0[_0x6824('0x3d')][_0x6824('0x20')][_0x6824('0x40')]()[_0x6824('0x41')]();var _0x1f8831;return db[_0x6824('0x9')]['findOne']({'where':{'id':0x1},'attributes':[_0x6824('0xb'),'blockDuration'],'raw':!![]})[_0x6824('0xd')](function(_0x43ce22){_0x1f8831=_0x43ce22;return db[_0x6824('0x42')][_0x6824('0x1f')]({'where':{'email':_0x1a83e0[_0x6824('0x3d')]['email']}});})[_0x6824('0xd')](function(_0x5b4156){if(!_0x5b4156){throw new Error(_0x6824('0x43'));}if(_0x5b4156['disabled']){throw new Error(_0x6824('0x44'));}if(_0x5b4156[_0x6824('0x11')]){if(moment(_0x5b4156[_0x6824('0x12')])['add'](_0x1f8831[_0x6824('0xc')],_0x6824('0x19'))>moment()){throw new Error(_0x6824('0x45'));}else{_0x5b4156[_0x6824('0x11')]=![];_0x5b4156[_0x6824('0x12')]=null;}}_0x5b4156[_0x6824('0x46')]=_0xce39a2;_0x5b4156[_0x6824('0x47')]=Date[_0x6824('0x48')]()+0x36ee80;return _0x5b4156[_0x6824('0x49')]();})[_0x6824('0xd')](function(){return sendServiceMail({'to':_0x1a83e0[_0x6824('0x3d')][_0x6824('0x20')],'subject':_0x6824('0x4a'),'text':_0x6824('0x4b')+_0x6824('0x4c')+_0x6824('0x4d')+_0x1a83e0[_0x6824('0x4e')][_0x6824('0x24')]+_0x6824('0x4f')+_0xce39a2+'\x0a\x0a'+_0x6824('0x50')});})[_0x6824('0xd')](function(){_0x5ec957[_0x6824('0x32')](0xc8)[_0x6824('0x33')]({'message':_0x6824('0x51')});})['catch'](function(_0x404cf2){return handleError(_0x5ec957,0x1f4,_0x404cf2);});};exports[_0x6824('0x52')]=function(_0x27d248,_0x52b3e2,_0x453adf){var _0x149d47;return db['User'][_0x6824('0x1f')]({'where':{'resetPasswordToken':_0x27d248[_0x6824('0x53')][_0x6824('0x54')],'resetPasswordExpires':{'$gt':Date[_0x6824('0x48')]()}}})[_0x6824('0xd')](function(_0x17d1b0){_0x149d47=_0x17d1b0;if(!_0x149d47){throw new Error(_0x6824('0x55'));}return db[_0x6824('0x9')]['findOne']({'attributes':['id',_0x6824('0x56')]});})[_0x6824('0xd')](function(_0x226bb8){return checkPasswordPattern(_0x226bb8,_0x27d248['body'][_0x6824('0xf')],_0x226bb8[_0x6824('0x56')]);})[_0x6824('0xd')](function(){_0x149d47['password']=_0x27d248[_0x6824('0x3d')][_0x6824('0xf')];_0x149d47['resetPasswordToken']=null;_0x149d47[_0x6824('0x47')]=null;return _0x149d47[_0x6824('0x49')]();})[_0x6824('0xd')](function(){_0x52b3e2[_0x6824('0x32')](0xc8)[_0x6824('0x33')]({'message':'Password\x20reset!'});})[_0x6824('0x1d')](function(_0x1c339a){return handleError(_0x52b3e2,0x1f4,_0x1c339a);});};passport[_0x6824('0x57')](new LocalStrategy({'usernameField':_0x6824('0xe'),'passwordField':_0x6824('0xf')},function(_0x1f1259,_0x48c814,_0x563a7e){return localAuthenticate(db[_0x6824('0x42')],_0x1f1259,_0x48c814,_0x563a7e);})); \ No newline at end of file +var _0x2f45=['authenticate','blockDuration','clearBlockUser','add','getLicense','catch','MailAccount','find','name','email','MailServerOut','Smtp','Unable\x20to\x20find\x20a\x20configured\x20SMTP\x20service!','service','host','port','secure','authentication','auth','pass','merge','\x22%s\x22\x20<%s>','request','SendMail','error','format','message','stringify','status','send','test','local','Something\x20went\x20wrong,\x20please\x20try\x20again.','signToken','json','online','body','generate','trim','User','This\x20email\x20is\x20not\x20registered.','minutes','The\x20user\x20is\x20blocked.\x20Please\x20contact\x20the\x20administrator.','resetPasswordExpires','xCally\x20Motion\x20Password\x20Reset','You\x20are\x20receiving\x20this\x20because\x20you\x20(or\x20someone\x20else)\x20have\x20requested\x20the\x20reset\x20of\x20the\x20password\x20for\x20your\x20account.\x0a\x0a','http://','headers','/reset/','If\x20you\x20did\x20not\x20request\x20this,\x20please\x20ignore\x20this\x20email\x20and\x20your\x20password\x20will\x20remain\x20unchanged.\x0a','Reset\x20Email\x20sent!','params','token','securePassword','save','Password\x20reset!','use','util','passport','passport-local','Strategy','jayson/promise','randomstring','moment','../../mysqldb','../../components/auth/service','../../config/utils','client','http','Setting','findOne','allowedLoginAttempts','then','password','salt','role','disabled','blocked','blockedAt','loginAttempts','admin','user','agent','Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x2f45,0x189));var _0x52f4=function(_0x5db1c0,_0x21819a){_0x5db1c0=_0x5db1c0-0x0;var _0x549cf4=_0x2f45[_0x5db1c0];return _0x549cf4;};'use strict';var util=require(_0x52f4('0x0'));var passport=require(_0x52f4('0x1'));var LocalStrategy=require(_0x52f4('0x2'))[_0x52f4('0x3')];var jayson=require(_0x52f4('0x4'));var _=require('lodash');var rs=require(_0x52f4('0x5'));var moment=require(_0x52f4('0x6'));var db=require(_0x52f4('0x7'))['db'];var authService=require(_0x52f4('0x8'));var utils=require(_0x52f4('0x9'));var client=jayson[_0x52f4('0xa')][_0x52f4('0xb')]({'port':0x232b});function localAuthenticate(_0x741070,_0x2fb5fd,_0x1bd246,_0x1bf1a3){var _0x3c1104,_0x5c50d7;return db[_0x52f4('0xc')][_0x52f4('0xd')]({'where':{'id':0x1},'attributes':[_0x52f4('0xe'),'blockDuration'],'raw':!![]})[_0x52f4('0xf')](function(_0x568775){_0x3c1104=_0x568775;return _0x741070[_0x52f4('0xd')]({'attributes':['id','name',_0x52f4('0x10'),_0x52f4('0x11'),_0x52f4('0x12'),_0x52f4('0x13'),_0x52f4('0x14'),_0x52f4('0x15'),_0x52f4('0x16')],'where':{'name':_0x2fb5fd,'role':{'$or':[_0x52f4('0x17'),_0x52f4('0x18'),_0x52f4('0x19')]}}});})[_0x52f4('0xf')](function(_0x5d35de){if(!_0x5d35de||_0x5d35de&&_0x5d35de['name']!==_0x2fb5fd){throw new Error(_0x52f4('0x1a'));}else{_0x5c50d7=_0x5d35de;return _0x5c50d7;}})[_0x52f4('0xf')](function(){_0x5c50d7[_0x52f4('0x1b')](_0x1bd246,function(_0x58e0e1,_0xa32c19){var _0x483e01=_0x5c50d7[_0x52f4('0x16')]+0x1;if(_0x58e0e1){return _0x1bf1a3(_0x58e0e1);}else if(!_0xa32c19){if(_0x5c50d7[_0x52f4('0x13')]){return _0x1bf1a3(null,![],{'message':_0x52f4('0x1a')});}else if(_0x3c1104[_0x52f4('0xe')]>0x0){if(_0x5c50d7[_0x52f4('0x14')]){if(_0x3c1104[_0x52f4('0x1c')]>0x0){if(moment(_0x5c50d7[_0x52f4('0x15')])['add'](_0x3c1104[_0x52f4('0x1c')],'minutes')>moment()){return _0x1bf1a3(null,![],{'message':_0x52f4('0x1a')});}else{return utils[_0x52f4('0x1d')](_0x5c50d7,_0x483e01,![],null)[_0x52f4('0xf')](function(){return _0x1bf1a3(null,![],{'message':_0x52f4('0x1a')});});}}else{return _0x1bf1a3(null,![],{'message':_0x52f4('0x1a')});}}else{if(_0x483e01>=_0x3c1104[_0x52f4('0xe')]){return utils[_0x52f4('0x1d')](_0x5c50d7,0x0,!![],moment())[_0x52f4('0xf')](function(){return _0x1bf1a3(null,![],{'message':_0x52f4('0x1a')});});}else{return utils['clearBlockUser'](_0x5c50d7,_0x483e01,![],null)[_0x52f4('0xf')](function(){return _0x1bf1a3(null,![],{'message':_0x52f4('0x1a')});});}}}else{return _0x1bf1a3(null,![],{'message':_0x52f4('0x1a')});}}else{if(_0x5c50d7['disabled']){return _0x1bf1a3(null,![],{'message':'Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.'});}else if(_0x3c1104['allowedLoginAttempts']>0x0){if(_0x5c50d7[_0x52f4('0x14')]){if(_0x3c1104[_0x52f4('0x1c')]>0x0){if(moment(_0x5c50d7[_0x52f4('0x15')])[_0x52f4('0x1e')](_0x3c1104['blockDuration'],'minutes')>moment()){return _0x1bf1a3(null,![],{'message':_0x52f4('0x1a')});}else{return utils[_0x52f4('0x1d')](_0x5c50d7,0x0,![],null)[_0x52f4('0xf')](function(){return utils[_0x52f4('0x1f')](_0x5c50d7);})[_0x52f4('0xf')](function(){return _0x1bf1a3(null,_0x5c50d7);});}}else{return _0x1bf1a3(null,![],{'message':_0x52f4('0x1a')});}}else{return utils[_0x52f4('0x1d')](_0x5c50d7,0x0,![],null)[_0x52f4('0xf')](function(){return utils[_0x52f4('0x1f')](_0x5c50d7);})[_0x52f4('0xf')](function(){return _0x1bf1a3(null,_0x5c50d7);})[_0x52f4('0x20')](function(_0x58287c){return _0x1bf1a3(null,![],_0x58287c);});}}else{if(_0x5c50d7[_0x52f4('0x14')]){return _0x1bf1a3(null,![],{'message':'Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.'});}else{return utils[_0x52f4('0x1f')](_0x5c50d7)['then'](function(){return _0x1bf1a3(null,_0x5c50d7);});}}}});})[_0x52f4('0x20')](function(_0x40c2d4){return _0x1bf1a3(null,![],_0x40c2d4);});}function sendServiceMail(_0x5697f3){return db[_0x52f4('0x21')][_0x52f4('0x22')]({'where':{'service':!![]},'attributes':['id',_0x52f4('0x23'),_0x52f4('0x24')],'include':[{'model':db[_0x52f4('0x25')],'as':_0x52f4('0x26')}]})[_0x52f4('0xf')](function(_0x5c1530){if(!_0x5c1530){throw new Error(_0x52f4('0x27'));}var _0x36c428={'tls':{'rejectUnauthorized':![]}};if(_0x5c1530[_0x52f4('0x26')][_0x52f4('0x28')]){_0x36c428['service']=_0x5c1530[_0x52f4('0x26')][_0x52f4('0x28')];}else{_0x36c428[_0x52f4('0x29')]=_0x5c1530['Smtp'][_0x52f4('0x29')];_0x36c428[_0x52f4('0x2a')]=_0x5c1530[_0x52f4('0x26')][_0x52f4('0x2a')];_0x36c428['secure']=_0x5c1530['Smtp'][_0x52f4('0x2b')];}if(_0x5c1530[_0x52f4('0x26')][_0x52f4('0x2c')]){_0x36c428[_0x52f4('0x2d')]={'user':_0x5c1530['Smtp'][_0x52f4('0x18')],'pass':_0x5c1530[_0x52f4('0x26')][_0x52f4('0x2e')]};}var _0x4e9d4b={'account':_0x36c428,'message':_[_0x52f4('0x2f')]({'from':util['format'](_0x52f4('0x30'),_0x5c1530[_0x52f4('0x23')],_0x5c1530[_0x52f4('0x24')]||_0x5c1530[_0x52f4('0x26')][_0x52f4('0x18')])},_0x5697f3)};return client[_0x52f4('0x31')](_0x52f4('0x32'),_0x4e9d4b);})[_0x52f4('0xf')](function(_0x375d8e){if(_0x375d8e[_0x52f4('0x33')]){throw new Error(util[_0x52f4('0x34')]('SendMail\x20error:\x20%s.\x20Please\x20contact\x20your\x20Administrator!',_0x375d8e[_0x52f4('0x33')][_0x52f4('0x35')]||JSON[_0x52f4('0x36')](_0x375d8e['error'])));}return!![];});}function handleError(_0x417eaf,_0x555e12,_0x3843b6){return _0x417eaf[_0x52f4('0x37')](_0x555e12||0x1f4)[_0x52f4('0x38')]({'message':_0x3843b6?_0x3843b6[_0x52f4('0x35')]||_0x3843b6:''});}function checkPasswordPattern(_0x388bde,_0x7b0dc6,_0x1983c7){if(_0x1983c7){var _0x17cc79=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x17cc79[_0x52f4('0x39')](_0x7b0dc6)){return _0x388bde;}else{throw new Error('The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.');}}else{return _0x388bde;}}exports['login']=function(_0x5e1251,_0x584e51,_0x1618d6){passport[_0x52f4('0x1b')](_0x52f4('0x3a'),function(_0x47a11a,_0x2f3585,_0x111b7a){var _0x43f0b8=_0x47a11a||_0x111b7a;if(_0x43f0b8){return handleError(_0x584e51,0x191,_0x43f0b8);}if(!_0x2f3585){return handleError(_0x584e51,0x194,{'message':_0x52f4('0x3b')});}else{var _0x45aeda={'payload':{'id':_0x2f3585['id'],'role':_0x2f3585['role']},'options':{'expiresIn':0x15180}};return authService[_0x52f4('0x3c')](_0x45aeda)[_0x52f4('0xf')](function(_0x248f50){_0x584e51[_0x52f4('0x3d')]({'id':_0x2f3585['id'],'token':_0x248f50,'statusCall':'','isAlreadyLogged':_0x2f3585[_0x52f4('0x3e')]});});}})(_0x5e1251,_0x584e51,_0x1618d6);};exports['forgot']=function(_0x336f49,_0x3ee289,_0x37774e){if(!_0x336f49[_0x52f4('0x3f')][_0x52f4('0x24')]){return handleError(_0x3ee289,0x1f4,{'message':'Email\x20parameter\x20is\x20missing'});}var _0x3f10c4=rs[_0x52f4('0x40')]();_0x336f49[_0x52f4('0x3f')][_0x52f4('0x24')]=_0x336f49['body'][_0x52f4('0x24')][_0x52f4('0x41')]()['toLowerCase']();var _0x3529c4;return db[_0x52f4('0xc')][_0x52f4('0xd')]({'where':{'id':0x1},'attributes':['allowedLoginAttempts',_0x52f4('0x1c')],'raw':!![]})[_0x52f4('0xf')](function(_0x16474e){_0x3529c4=_0x16474e;return db[_0x52f4('0x42')][_0x52f4('0x22')]({'where':{'email':_0x336f49[_0x52f4('0x3f')][_0x52f4('0x24')]}});})[_0x52f4('0xf')](function(_0x263474){if(!_0x263474){throw new Error(_0x52f4('0x43'));}if(_0x263474[_0x52f4('0x13')]){throw new Error('The\x20user\x20is\x20disabled.\x20Please\x20contact\x20the\x20administrator.');}if(_0x263474[_0x52f4('0x14')]){if(moment(_0x263474[_0x52f4('0x15')])['add'](_0x3529c4[_0x52f4('0x1c')],_0x52f4('0x44'))>moment()){throw new Error(_0x52f4('0x45'));}else{_0x263474[_0x52f4('0x14')]=![];_0x263474[_0x52f4('0x15')]=null;}}_0x263474['resetPasswordToken']=_0x3f10c4;_0x263474[_0x52f4('0x46')]=Date['now']()+0x36ee80;return _0x263474['save']();})[_0x52f4('0xf')](function(){return sendServiceMail({'to':_0x336f49['body'][_0x52f4('0x24')],'subject':_0x52f4('0x47'),'text':_0x52f4('0x48')+'Please\x20click\x20on\x20the\x20following\x20link,\x20or\x20paste\x20this\x20into\x20your\x20browser\x20to\x20complete\x20the\x20process:\x0a\x0a'+_0x52f4('0x49')+_0x336f49[_0x52f4('0x4a')][_0x52f4('0x29')]+_0x52f4('0x4b')+_0x3f10c4+'\x0a\x0a'+_0x52f4('0x4c')});})[_0x52f4('0xf')](function(){_0x3ee289[_0x52f4('0x37')](0xc8)[_0x52f4('0x38')]({'message':_0x52f4('0x4d')});})['catch'](function(_0x5814e2){return handleError(_0x3ee289,0x1f4,_0x5814e2);});};exports['reset']=function(_0x380fa3,_0x5814d5,_0x2c4323){var _0x71a31c;return db[_0x52f4('0x42')][_0x52f4('0x22')]({'where':{'resetPasswordToken':_0x380fa3[_0x52f4('0x4e')][_0x52f4('0x4f')],'resetPasswordExpires':{'$gt':Date['now']()}}})[_0x52f4('0xf')](function(_0x367d37){_0x71a31c=_0x367d37;if(!_0x71a31c){throw new Error('Password\x20reset\x20token\x20is\x20invalid\x20or\x20has\x20expired.');}return db['Setting'][_0x52f4('0xd')]({'attributes':['id','securePassword']});})['then'](function(_0x2f7207){return checkPasswordPattern(_0x2f7207,_0x380fa3[_0x52f4('0x3f')][_0x52f4('0x10')],_0x2f7207[_0x52f4('0x50')]);})[_0x52f4('0xf')](function(){_0x71a31c[_0x52f4('0x10')]=_0x380fa3[_0x52f4('0x3f')][_0x52f4('0x10')];_0x71a31c['resetPasswordToken']=null;_0x71a31c[_0x52f4('0x46')]=null;return _0x71a31c[_0x52f4('0x51')]();})[_0x52f4('0xf')](function(){_0x5814d5[_0x52f4('0x37')](0xc8)['send']({'message':_0x52f4('0x52')});})['catch'](function(_0x59c9c3){return handleError(_0x5814d5,0x1f4,_0x59c9c3);});};passport[_0x52f4('0x53')](new LocalStrategy({'usernameField':_0x52f4('0x23'),'passwordField':'password'},function(_0x11fc16,_0x18120c,_0x86b9a8){return localAuthenticate(db['User'],_0x11fc16,_0x18120c,_0x86b9a8);})); \ No newline at end of file diff --git a/server/api/authLocal/index.js b/server/api/authLocal/index.js index 223ddc6..5f0e17e 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 _0x81e5=['post','/reset/:token','exports','express','Router','./authLocal.controller','/forgot','forgot'];(function(_0x3bb828,_0x31a892){var _0x106d14=function(_0x1b15c4){while(--_0x1b15c4){_0x3bb828['push'](_0x3bb828['shift']());}};_0x106d14(++_0x31a892);}(_0x81e5,0x1ab));var _0x581e=function(_0x20784e,_0x48d23c){_0x20784e=_0x20784e-0x0;var _0xcb6367=_0x81e5[_0x20784e];return _0xcb6367;};'use strict';var express=require(_0x581e('0x0'));var router=express[_0x581e('0x1')]();var controller=require(_0x581e('0x2'));router['post']('/',controller['login']);router['post'](_0x581e('0x3'),controller[_0x581e('0x4')]);router[_0x581e('0x5')](_0x581e('0x6'),controller['reset']);module[_0x581e('0x7')]=router; \ No newline at end of file +var _0xbd7c=['/forgot','forgot','/reset/:token','reset','Router','./authLocal.controller','login','post'];(function(_0x4d337e,_0x2f7eed){var _0x247963=function(_0x3d6564){while(--_0x3d6564){_0x4d337e['push'](_0x4d337e['shift']());}};_0x247963(++_0x2f7eed);}(_0xbd7c,0x1ec));var _0xcbd7=function(_0x45a718,_0x12b79f){_0x45a718=_0x45a718-0x0;var _0x22e161=_0xbd7c[_0x45a718];return _0x22e161;};'use strict';var express=require('express');var router=express[_0xcbd7('0x0')]();var controller=require(_0xcbd7('0x1'));router['post']('/',controller[_0xcbd7('0x2')]);router[_0xcbd7('0x3')](_0xcbd7('0x4'),controller[_0xcbd7('0x5')]);router['post'](_0xcbd7('0x6'),controller[_0xcbd7('0x7')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/automation/automation.attributes.js b/server/api/automation/automation.attributes.js index d299431..3b72268 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 _0xbdb4=['INTEGER','sequelize','exports','STRING'];(function(_0x3207aa,_0xe86a72){var _0x51758f=function(_0x9ff790){while(--_0x9ff790){_0x3207aa['push'](_0x3207aa['shift']());}};_0x51758f(++_0xe86a72);}(_0xbdb4,0x1e1));var _0x4bdb=function(_0x5bcdeb,_0x15a820){_0x5bcdeb=_0x5bcdeb-0x0;var _0x33e552=_0xbdb4[_0x5bcdeb];return _0x33e552;};'use strict';var Sequelize=require(_0x4bdb('0x0'));module[_0x4bdb('0x1')]={'name':{'type':Sequelize[_0x4bdb('0x2')],'allowNull':![]},'channel':{'type':Sequelize[_0x4bdb('0x2')]},'description':{'type':Sequelize[_0x4bdb('0x2')]},'status':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'timeout':{'type':Sequelize[_0x4bdb('0x3')],'defaultValue':0xa}}; \ No newline at end of file +var _0x9fd1=['INTEGER','sequelize','exports','STRING','BOOLEAN'];(function(_0xfaafca,_0x4f725e){var _0x5619c0=function(_0x175ac4){while(--_0x175ac4){_0xfaafca['push'](_0xfaafca['shift']());}};_0x5619c0(++_0x4f725e);}(_0x9fd1,0xbf));var _0x19fd=function(_0x187ff3,_0x2730a0){_0x187ff3=_0x187ff3-0x0;var _0x27bda6=_0x9fd1[_0x187ff3];return _0x27bda6;};'use strict';var Sequelize=require(_0x19fd('0x0'));module[_0x19fd('0x1')]={'name':{'type':Sequelize[_0x19fd('0x2')],'allowNull':![]},'channel':{'type':Sequelize[_0x19fd('0x2')]},'description':{'type':Sequelize['STRING']},'status':{'type':Sequelize[_0x19fd('0x3')],'defaultValue':![]},'timeout':{'type':Sequelize[_0x19fd('0x4')],'defaultValue':0xa}}; \ No newline at end of file diff --git a/server/api/automation/automation.controller.js b/server/api/automation/automation.controller.js index 22da44a..7d05a94 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 _0xaa94=['util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','sendStatus','end','status','count','offset','limit','Content-Range','json','apply','save','then','destroy','stack','name','send','Automation','rawAttributes','type','model','map','query','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','filter','merge','includeAll','findAll','show','params','keys','filters','options','find','catch','create','update','body','addConditions','Condition','ids','getConditions','where','pick','addActions','Action','getActions','findOne','html-pdf','eml-format','rimraf','request-promise','moment'];(function(_0x160d65,_0x3c1fdc){var _0x35d585=function(_0x34f334){while(--_0x34f334){_0x160d65['push'](_0x160d65['shift']());}};_0x35d585(++_0x3c1fdc);}(_0xaa94,0x181));var _0x4aa9=function(_0x4e6f11,_0xde8e2){_0x4e6f11=_0x4e6f11-0x0;var _0x439204=_0xaa94[_0x4e6f11];return _0x439204;};'use strict';var pdf=require(_0x4aa9('0x0'));var emlformat=require(_0x4aa9('0x1'));var rimraf=require(_0x4aa9('0x2'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x4aa9('0x3'));var moment=require(_0x4aa9('0x4'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x4aa9('0x5'));var path=require(_0x4aa9('0x6'));var sox=require(_0x4aa9('0x7'));var csv=require(_0x4aa9('0x8'));var ejs=require(_0x4aa9('0x9'));var fs=require('fs');var _=require(_0x4aa9('0xa'));var squel=require(_0x4aa9('0xb'));var crypto=require(_0x4aa9('0xc'));var jsforce=require(_0x4aa9('0xd'));var deskjs=require('desk.js');var toCsv=require(_0x4aa9('0x8'));var querystring=require(_0x4aa9('0xe'));var Papa=require(_0x4aa9('0xf'));var Redis=require(_0x4aa9('0x10'));var authService=require(_0x4aa9('0x11'));var qs=require(_0x4aa9('0x12'));var as=require(_0x4aa9('0x13'));var hardwareService=require(_0x4aa9('0x14'));var logger=require(_0x4aa9('0x15'))('api');var utils=require(_0x4aa9('0x16'));var config=require(_0x4aa9('0x17'));var db=require(_0x4aa9('0x18'))['db'];function respondWithStatusCode(_0xb6e05d,_0x7214c2){_0x7214c2=_0x7214c2||0xcc;return function(_0x103275){if(_0x103275){return _0xb6e05d[_0x4aa9('0x19')](_0x7214c2);}return _0xb6e05d['status'](_0x7214c2)[_0x4aa9('0x1a')]();};}function respondWithResult(_0x31a9f1,_0x10c9b2){_0x10c9b2=_0x10c9b2||0xc8;return function(_0x3f7bc3){if(_0x3f7bc3){return _0x31a9f1[_0x4aa9('0x1b')](_0x10c9b2)['json'](_0x3f7bc3);}};}function respondWithFilteredResult(_0x199f40,_0x340971){return function(_0x4bfc21){if(_0x4bfc21){var _0x2fc61e=_0x4bfc21[_0x4aa9('0x1c')],_0xfdcbdc=_0x340971[_0x4aa9('0x1d')],_0x466737=_0x340971[_0x4aa9('0x1d')]+_0x340971[_0x4aa9('0x1e')],_0x1313c9;if(_0x466737>=_0x2fc61e){_0x466737=_0x2fc61e;_0x1313c9=0xc8;}else{_0x1313c9=0xce;}_0x199f40['status'](_0x1313c9);return _0x199f40['set'](_0x4aa9('0x1f'),_0xfdcbdc+'-'+_0x466737+'/'+_0x2fc61e)[_0x4aa9('0x20')](_0x4bfc21);}return null;};}function patchUpdates(_0x2efcf8){return function(_0x4aa88c){try{jsonpatch[_0x4aa9('0x21')](_0x4aa88c,_0x2efcf8,!![]);}catch(_0x1e1545){return BPromise['reject'](_0x1e1545);}return _0x4aa88c[_0x4aa9('0x22')]();};}function saveUpdates(_0x10e076,_0x3b3ca5){return function(_0x449aaf){if(_0x449aaf){return _0x449aaf['update'](_0x10e076)[_0x4aa9('0x23')](function(_0x554282){return _0x554282;});}return null;};}function removeEntity(_0x2b8be4,_0x28acfd){return function(_0xa0360){if(_0xa0360){return _0xa0360[_0x4aa9('0x24')]()[_0x4aa9('0x23')](function(){_0x2b8be4[_0x4aa9('0x1b')](0xcc)[_0x4aa9('0x1a')]();});}};}function handleEntityNotFound(_0x45ae63,_0x3f7fe5){return function(_0xe9f248){if(!_0xe9f248){_0x45ae63[_0x4aa9('0x19')](0x194);}return _0xe9f248;};}function handleError(_0x5b5520,_0x490f83){_0x490f83=_0x490f83||0x1f4;return function(_0xd1646a){logger['error'](_0xd1646a[_0x4aa9('0x25')]);if(_0xd1646a[_0x4aa9('0x26')]){delete _0xd1646a[_0x4aa9('0x26')];}_0x5b5520['status'](_0x490f83)[_0x4aa9('0x27')](_0xd1646a);};}exports['index']=function(_0x5dd45c,_0x4062b0){var _0x4de96b={},_0x1c1798={},_0x1eb38d={'count':0x0,'rows':[]};var _0xabae7d=_['map'](db[_0x4aa9('0x28')][_0x4aa9('0x29')],function(_0x21ec6f){return{'name':_0x21ec6f['fieldName'],'type':_0x21ec6f[_0x4aa9('0x2a')]['key']};});_0x1c1798[_0x4aa9('0x2b')]=_[_0x4aa9('0x2c')](_0xabae7d,_0x4aa9('0x26'));_0x1c1798[_0x4aa9('0x2d')]=_['keys'](_0x5dd45c[_0x4aa9('0x2d')]);_0x1c1798['filters']=_[_0x4aa9('0x2e')](_0x1c1798[_0x4aa9('0x2b')],_0x1c1798[_0x4aa9('0x2d')]);_0x4de96b[_0x4aa9('0x2f')]=_[_0x4aa9('0x2e')](_0x1c1798[_0x4aa9('0x2b')],qs[_0x4aa9('0x30')](_0x5dd45c['query'][_0x4aa9('0x30')]));_0x4de96b[_0x4aa9('0x2f')]=_0x4de96b[_0x4aa9('0x2f')][_0x4aa9('0x31')]?_0x4de96b['attributes']:_0x1c1798[_0x4aa9('0x2b')];if(!_0x5dd45c[_0x4aa9('0x2d')][_0x4aa9('0x32')](_0x4aa9('0x33'))){_0x4de96b['limit']=qs[_0x4aa9('0x1e')](_0x5dd45c['query'][_0x4aa9('0x1e')]);_0x4de96b[_0x4aa9('0x1d')]=qs[_0x4aa9('0x1d')](_0x5dd45c[_0x4aa9('0x2d')]['offset']);}_0x4de96b[_0x4aa9('0x34')]=qs[_0x4aa9('0x35')](_0x5dd45c['query'][_0x4aa9('0x35')]);_0x4de96b['where']=qs['filters'](_['pick'](_0x5dd45c['query'],_0x1c1798['filters']));if(_0x5dd45c['query'][_0x4aa9('0x36')]){_0x4de96b['where']=_[_0x4aa9('0x37')](_0x4de96b['where'],{'$or':_['map'](_0xabae7d,function(_0x381bc8){if(_0x381bc8[_0x4aa9('0x2a')]!=='VIRTUAL'){var _0x5f29da={};_0x5f29da[_0x381bc8[_0x4aa9('0x26')]]={'$like':'%'+_0x5dd45c[_0x4aa9('0x2d')]['filter']+'%'};return _0x5f29da;}})});}_0x4de96b=_[_0x4aa9('0x37')]({},_0x4de96b,_0x5dd45c['options']);var _0x39c38d={'where':_0x4de96b['where']};return db[_0x4aa9('0x28')][_0x4aa9('0x1c')](_0x39c38d)[_0x4aa9('0x23')](function(_0x3d8b07){_0x1eb38d[_0x4aa9('0x1c')]=_0x3d8b07;if(_0x5dd45c['query'][_0x4aa9('0x38')]){_0x4de96b['include']=[{'all':!![]}];}return db['Automation'][_0x4aa9('0x39')](_0x4de96b);})[_0x4aa9('0x23')](function(_0x37b209){_0x1eb38d['rows']=_0x37b209;return _0x1eb38d;})[_0x4aa9('0x23')](respondWithFilteredResult(_0x4062b0,_0x4de96b))['catch'](handleError(_0x4062b0,null));};exports[_0x4aa9('0x3a')]=function(_0x2c09fa,_0xce498a){var _0x191075={'raw':![],'where':{'id':_0x2c09fa[_0x4aa9('0x3b')]['id']}},_0x371fe4={};_0x371fe4[_0x4aa9('0x2b')]=_[_0x4aa9('0x3c')](db[_0x4aa9('0x28')][_0x4aa9('0x29')]);_0x371fe4[_0x4aa9('0x2d')]=_['keys'](_0x2c09fa[_0x4aa9('0x2d')]);_0x371fe4[_0x4aa9('0x3d')]=_[_0x4aa9('0x2e')](_0x371fe4[_0x4aa9('0x2b')],_0x371fe4['query']);_0x191075['attributes']=_[_0x4aa9('0x2e')](_0x371fe4[_0x4aa9('0x2b')],qs[_0x4aa9('0x30')](_0x2c09fa[_0x4aa9('0x2d')][_0x4aa9('0x30')]));_0x191075[_0x4aa9('0x2f')]=_0x191075['attributes'][_0x4aa9('0x31')]?_0x191075['attributes']:_0x371fe4[_0x4aa9('0x2b')];if(_0x2c09fa[_0x4aa9('0x2d')][_0x4aa9('0x38')]){_0x191075['include']=[{'all':!![]}];}_0x191075=_[_0x4aa9('0x37')]({},_0x191075,_0x2c09fa[_0x4aa9('0x3e')]);return db[_0x4aa9('0x28')][_0x4aa9('0x3f')](_0x191075)[_0x4aa9('0x23')](handleEntityNotFound(_0xce498a,null))[_0x4aa9('0x23')](respondWithResult(_0xce498a,null))[_0x4aa9('0x40')](handleError(_0xce498a,null));};exports['create']=function(_0x4fee0b,_0x50f843){return db[_0x4aa9('0x28')][_0x4aa9('0x41')](_0x4fee0b['body'],{})[_0x4aa9('0x23')](respondWithResult(_0x50f843,0xc9))['catch'](handleError(_0x50f843,null));};exports[_0x4aa9('0x42')]=function(_0x44b158,_0x3e88fc){if(_0x44b158[_0x4aa9('0x43')]['id']){delete _0x44b158['body']['id'];}return db[_0x4aa9('0x28')][_0x4aa9('0x3f')]({'where':{'id':_0x44b158[_0x4aa9('0x3b')]['id']}})[_0x4aa9('0x23')](handleEntityNotFound(_0x3e88fc,null))[_0x4aa9('0x23')](saveUpdates(_0x44b158[_0x4aa9('0x43')],null))[_0x4aa9('0x23')](respondWithResult(_0x3e88fc,null))['catch'](handleError(_0x3e88fc,null));};exports['destroy']=function(_0x4dfd66,_0x508f95){return db[_0x4aa9('0x28')][_0x4aa9('0x3f')]({'where':{'id':_0x4dfd66[_0x4aa9('0x3b')]['id']}})[_0x4aa9('0x23')](handleEntityNotFound(_0x508f95,null))['then'](removeEntity(_0x508f95,null))[_0x4aa9('0x40')](handleError(_0x508f95,null));};exports[_0x4aa9('0x44')]=function(_0x48096c,_0x3ca7db,_0x4369b1){return db[_0x4aa9('0x45')][_0x4aa9('0x3f')]({'where':{'id':_0x48096c[_0x4aa9('0x3b')]['id']}})[_0x4aa9('0x23')](handleEntityNotFound(_0x3ca7db,null))[_0x4aa9('0x23')](function(_0x5b4925){if(_0x5b4925){return _0x5b4925['addConditions'](_0x48096c[_0x4aa9('0x43')][_0x4aa9('0x46')],_['omit'](_0x48096c[_0x4aa9('0x43')],[_0x4aa9('0x46'),'id'])||{});}})[_0x4aa9('0x23')](respondWithResult(_0x3ca7db,null))[_0x4aa9('0x40')](handleError(_0x3ca7db,null));};exports[_0x4aa9('0x47')]=function(_0x497881,_0x5c1a87,_0x95ca3d){var _0x34783e={};var _0x3063b7={};var _0x16cb3b;var _0x1ff148;return db[_0x4aa9('0x28')]['findOne']({'where':{'id':_0x497881['params']['id']}})[_0x4aa9('0x23')](handleEntityNotFound(_0x5c1a87,null))[_0x4aa9('0x23')](function(_0x4685e1){if(_0x4685e1){_0x16cb3b=_0x4685e1;_0x3063b7['model']=_[_0x4aa9('0x3c')](db['Condition'][_0x4aa9('0x29')]);_0x3063b7[_0x4aa9('0x2d')]=_[_0x4aa9('0x3c')](_0x497881[_0x4aa9('0x2d')]);_0x3063b7[_0x4aa9('0x3d')]=_[_0x4aa9('0x2e')](_0x3063b7[_0x4aa9('0x2b')],_0x3063b7['query']);_0x34783e[_0x4aa9('0x2f')]=_[_0x4aa9('0x2e')](_0x3063b7[_0x4aa9('0x2b')],qs[_0x4aa9('0x30')](_0x497881[_0x4aa9('0x2d')][_0x4aa9('0x30')]));_0x34783e[_0x4aa9('0x2f')]=_0x34783e[_0x4aa9('0x2f')]['length']?_0x34783e[_0x4aa9('0x2f')]:_0x3063b7[_0x4aa9('0x2b')];_0x34783e['order']=qs[_0x4aa9('0x35')](_0x497881[_0x4aa9('0x2d')][_0x4aa9('0x35')]);_0x34783e[_0x4aa9('0x48')]=qs[_0x4aa9('0x3d')](_[_0x4aa9('0x49')](_0x497881['query'],_0x3063b7[_0x4aa9('0x3d')]));if(_0x497881['query']['filter']){_0x34783e[_0x4aa9('0x48')]=_[_0x4aa9('0x37')](_0x34783e[_0x4aa9('0x48')],{'$or':_[_0x4aa9('0x2c')](_0x34783e['attributes'],function(_0x4f6b7e){var _0x5bb490={};_0x5bb490[_0x4f6b7e]={'$like':'%'+_0x497881[_0x4aa9('0x2d')][_0x4aa9('0x36')]+'%'};return _0x5bb490;})});}_0x34783e=_[_0x4aa9('0x37')]({},_0x34783e,_0x497881[_0x4aa9('0x3e')]);return _0x16cb3b[_0x4aa9('0x47')](_0x34783e);}})[_0x4aa9('0x23')](function(_0x5cc804){if(_0x5cc804){_0x1ff148=_0x5cc804[_0x4aa9('0x31')];if(!_0x497881[_0x4aa9('0x2d')]['hasOwnProperty']('nolimit')){_0x34783e[_0x4aa9('0x1e')]=qs[_0x4aa9('0x1e')](_0x497881[_0x4aa9('0x2d')][_0x4aa9('0x1e')]);_0x34783e[_0x4aa9('0x1d')]=qs[_0x4aa9('0x1d')](_0x497881['query'][_0x4aa9('0x1d')]);}return _0x16cb3b[_0x4aa9('0x47')](_0x34783e);}})[_0x4aa9('0x23')](function(_0x2656d3){if(_0x2656d3){return _0x2656d3?{'count':_0x1ff148,'rows':_0x2656d3}:null;}})[_0x4aa9('0x23')](respondWithResult(_0x5c1a87,null))[_0x4aa9('0x40')](handleError(_0x5c1a87,null));};exports[_0x4aa9('0x4a')]=function(_0x52d2bd,_0x9d19f9,_0x58bd47){return db[_0x4aa9('0x4b')]['find']({'where':{'id':_0x52d2bd[_0x4aa9('0x3b')]['id']}})['then'](handleEntityNotFound(_0x9d19f9,null))[_0x4aa9('0x23')](function(_0x1b1d02){if(_0x1b1d02){return _0x1b1d02[_0x4aa9('0x4a')](_0x52d2bd[_0x4aa9('0x43')][_0x4aa9('0x46')],_['omit'](_0x52d2bd['body'],[_0x4aa9('0x46'),'id'])||{});}})['then'](respondWithResult(_0x9d19f9,null))[_0x4aa9('0x40')](handleError(_0x9d19f9,null));};exports[_0x4aa9('0x4c')]=function(_0x4d0759,_0x48eb84,_0x2a385d){var _0x2d5168={};var _0x3b89d7={};var _0x41d5b4;var _0x49d455;return db[_0x4aa9('0x28')][_0x4aa9('0x4d')]({'where':{'id':_0x4d0759[_0x4aa9('0x3b')]['id']}})[_0x4aa9('0x23')](handleEntityNotFound(_0x48eb84,null))[_0x4aa9('0x23')](function(_0x1c44d1){if(_0x1c44d1){_0x41d5b4=_0x1c44d1;_0x3b89d7[_0x4aa9('0x2b')]=_[_0x4aa9('0x3c')](db[_0x4aa9('0x4b')][_0x4aa9('0x29')]);_0x3b89d7[_0x4aa9('0x2d')]=_[_0x4aa9('0x3c')](_0x4d0759['query']);_0x3b89d7[_0x4aa9('0x3d')]=_[_0x4aa9('0x2e')](_0x3b89d7[_0x4aa9('0x2b')],_0x3b89d7[_0x4aa9('0x2d')]);_0x2d5168['attributes']=_[_0x4aa9('0x2e')](_0x3b89d7[_0x4aa9('0x2b')],qs[_0x4aa9('0x30')](_0x4d0759['query'][_0x4aa9('0x30')]));_0x2d5168[_0x4aa9('0x2f')]=_0x2d5168[_0x4aa9('0x2f')][_0x4aa9('0x31')]?_0x2d5168[_0x4aa9('0x2f')]:_0x3b89d7[_0x4aa9('0x2b')];_0x2d5168[_0x4aa9('0x34')]=qs[_0x4aa9('0x35')](_0x4d0759['query']['sort']);_0x2d5168[_0x4aa9('0x48')]=qs[_0x4aa9('0x3d')](_[_0x4aa9('0x49')](_0x4d0759['query'],_0x3b89d7[_0x4aa9('0x3d')]));if(_0x4d0759[_0x4aa9('0x2d')][_0x4aa9('0x36')]){_0x2d5168[_0x4aa9('0x48')]=_[_0x4aa9('0x37')](_0x2d5168[_0x4aa9('0x48')],{'$or':_[_0x4aa9('0x2c')](_0x2d5168[_0x4aa9('0x2f')],function(_0x29bfb5){var _0x50ff4d={};_0x50ff4d[_0x29bfb5]={'$like':'%'+_0x4d0759['query'][_0x4aa9('0x36')]+'%'};return _0x50ff4d;})});}_0x2d5168=_[_0x4aa9('0x37')]({},_0x2d5168,_0x4d0759[_0x4aa9('0x3e')]);return _0x41d5b4[_0x4aa9('0x4c')](_0x2d5168);}})[_0x4aa9('0x23')](function(_0x3c32a0){if(_0x3c32a0){_0x49d455=_0x3c32a0[_0x4aa9('0x31')];if(!_0x4d0759[_0x4aa9('0x2d')][_0x4aa9('0x32')](_0x4aa9('0x33'))){_0x2d5168[_0x4aa9('0x1e')]=qs[_0x4aa9('0x1e')](_0x4d0759['query'][_0x4aa9('0x1e')]);_0x2d5168[_0x4aa9('0x1d')]=qs[_0x4aa9('0x1d')](_0x4d0759[_0x4aa9('0x2d')]['offset']);}return _0x41d5b4[_0x4aa9('0x4c')](_0x2d5168);}})['then'](function(_0x48696d){if(_0x48696d){return _0x48696d?{'count':_0x49d455,'rows':_0x48696d}:null;}})[_0x4aa9('0x23')](respondWithResult(_0x48eb84,null))[_0x4aa9('0x40')](handleError(_0x48eb84,null));}; \ No newline at end of file +var _0xc36d=['fieldName','model','map','name','query','keys','filters','intersection','fields','attributes','order','sort','pick','filter','where','merge','type','VIRTUAL','options','include','findAll','rows','catch','show','params','find','create','body','addConditions','ids','omit','findOne','Condition','length','nolimit','Action','addActions','getActions','html-pdf','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','sox','to-csv','ejs','lodash','squel','crypto','querystring','papaparse','ioredis','../../components/parsers/qs','../../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','error','stack','send','index','Automation','rawAttributes'];(function(_0x414942,_0x99b695){var _0x13996f=function(_0x364fe6){while(--_0x364fe6){_0x414942['push'](_0x414942['shift']());}};_0x13996f(++_0x99b695);}(_0xc36d,0x1c5));var _0xdc36=function(_0x16ea87,_0x378d8b){_0x16ea87=_0x16ea87-0x0;var _0x6e7b1c=_0xc36d[_0x16ea87];return _0x6e7b1c;};'use strict';var pdf=require(_0xdc36('0x0'));var emlformat=require(_0xdc36('0x1'));var rimraf=require(_0xdc36('0x2'));var zipdir=require(_0xdc36('0x3'));var jsonpatch=require('fast-json-patch');var rp=require(_0xdc36('0x4'));var moment=require(_0xdc36('0x5'));var BPromise=require(_0xdc36('0x6'));var Mustache=require(_0xdc36('0x7'));var util=require(_0xdc36('0x8'));var path=require('path');var sox=require(_0xdc36('0x9'));var csv=require(_0xdc36('0xa'));var ejs=require(_0xdc36('0xb'));var fs=require('fs');var _=require(_0xdc36('0xc'));var squel=require(_0xdc36('0xd'));var crypto=require(_0xdc36('0xe'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0xdc36('0xa'));var querystring=require(_0xdc36('0xf'));var Papa=require(_0xdc36('0x10'));var Redis=require(_0xdc36('0x11'));var authService=require('../../components/auth/service');var qs=require(_0xdc36('0x12'));var as=require(_0xdc36('0x13'));var hardwareService=require(_0xdc36('0x14'));var logger=require(_0xdc36('0x15'))(_0xdc36('0x16'));var utils=require(_0xdc36('0x17'));var config=require(_0xdc36('0x18'));var db=require(_0xdc36('0x19'))['db'];function respondWithStatusCode(_0x298df6,_0x50e6c5){_0x50e6c5=_0x50e6c5||0xcc;return function(_0x5303fe){if(_0x5303fe){return _0x298df6[_0xdc36('0x1a')](_0x50e6c5);}return _0x298df6['status'](_0x50e6c5)['end']();};}function respondWithResult(_0x1fd364,_0xfc1eb5){_0xfc1eb5=_0xfc1eb5||0xc8;return function(_0x20b2fb){if(_0x20b2fb){return _0x1fd364[_0xdc36('0x1b')](_0xfc1eb5)[_0xdc36('0x1c')](_0x20b2fb);}};}function respondWithFilteredResult(_0x2cfe5,_0x42a464){return function(_0x18249c){if(_0x18249c){var _0x4c1175=_0x18249c[_0xdc36('0x1d')],_0x50a939=_0x42a464[_0xdc36('0x1e')],_0x31f41b=_0x42a464['offset']+_0x42a464[_0xdc36('0x1f')],_0x26613e;if(_0x31f41b>=_0x4c1175){_0x31f41b=_0x4c1175;_0x26613e=0xc8;}else{_0x26613e=0xce;}_0x2cfe5[_0xdc36('0x1b')](_0x26613e);return _0x2cfe5[_0xdc36('0x20')](_0xdc36('0x21'),_0x50a939+'-'+_0x31f41b+'/'+_0x4c1175)[_0xdc36('0x1c')](_0x18249c);}return null;};}function patchUpdates(_0x5efb2e){return function(_0x3846a7){try{jsonpatch['apply'](_0x3846a7,_0x5efb2e,!![]);}catch(_0x25fe33){return BPromise[_0xdc36('0x22')](_0x25fe33);}return _0x3846a7[_0xdc36('0x23')]();};}function saveUpdates(_0x36fbca,_0x5a8b03){return function(_0x210834){if(_0x210834){return _0x210834[_0xdc36('0x24')](_0x36fbca)[_0xdc36('0x25')](function(_0x6553c1){return _0x6553c1;});}return null;};}function removeEntity(_0x3cfe5,_0x3c8892){return function(_0x4aee1c){if(_0x4aee1c){return _0x4aee1c[_0xdc36('0x26')]()['then'](function(){_0x3cfe5[_0xdc36('0x1b')](0xcc)['end']();});}};}function handleEntityNotFound(_0x5a43cc,_0x23dc4c){return function(_0xa0c1db){if(!_0xa0c1db){_0x5a43cc['sendStatus'](0x194);}return _0xa0c1db;};}function handleError(_0x54b65c,_0x497038){_0x497038=_0x497038||0x1f4;return function(_0x57538f){logger[_0xdc36('0x27')](_0x57538f[_0xdc36('0x28')]);if(_0x57538f['name']){delete _0x57538f['name'];}_0x54b65c['status'](_0x497038)[_0xdc36('0x29')](_0x57538f);};}exports[_0xdc36('0x2a')]=function(_0x2aedd1,_0x3003ad){var _0xa5bcd5={},_0x283348={},_0x5124d9={'count':0x0,'rows':[]};var _0x186a6c=_['map'](db[_0xdc36('0x2b')][_0xdc36('0x2c')],function(_0x359902){return{'name':_0x359902[_0xdc36('0x2d')],'type':_0x359902['type']['key']};});_0x283348[_0xdc36('0x2e')]=_[_0xdc36('0x2f')](_0x186a6c,_0xdc36('0x30'));_0x283348[_0xdc36('0x31')]=_[_0xdc36('0x32')](_0x2aedd1[_0xdc36('0x31')]);_0x283348[_0xdc36('0x33')]=_[_0xdc36('0x34')](_0x283348[_0xdc36('0x2e')],_0x283348['query']);_0xa5bcd5['attributes']=_[_0xdc36('0x34')](_0x283348[_0xdc36('0x2e')],qs[_0xdc36('0x35')](_0x2aedd1[_0xdc36('0x31')][_0xdc36('0x35')]));_0xa5bcd5[_0xdc36('0x36')]=_0xa5bcd5[_0xdc36('0x36')]['length']?_0xa5bcd5[_0xdc36('0x36')]:_0x283348[_0xdc36('0x2e')];if(!_0x2aedd1[_0xdc36('0x31')]['hasOwnProperty']('nolimit')){_0xa5bcd5['limit']=qs[_0xdc36('0x1f')](_0x2aedd1['query'][_0xdc36('0x1f')]);_0xa5bcd5[_0xdc36('0x1e')]=qs[_0xdc36('0x1e')](_0x2aedd1[_0xdc36('0x31')][_0xdc36('0x1e')]);}_0xa5bcd5[_0xdc36('0x37')]=qs[_0xdc36('0x38')](_0x2aedd1[_0xdc36('0x31')][_0xdc36('0x38')]);_0xa5bcd5['where']=qs[_0xdc36('0x33')](_[_0xdc36('0x39')](_0x2aedd1[_0xdc36('0x31')],_0x283348['filters']));if(_0x2aedd1[_0xdc36('0x31')][_0xdc36('0x3a')]){_0xa5bcd5[_0xdc36('0x3b')]=_[_0xdc36('0x3c')](_0xa5bcd5[_0xdc36('0x3b')],{'$or':_[_0xdc36('0x2f')](_0x186a6c,function(_0x11f6af){if(_0x11f6af[_0xdc36('0x3d')]!==_0xdc36('0x3e')){var _0x50244b={};_0x50244b[_0x11f6af[_0xdc36('0x30')]]={'$like':'%'+_0x2aedd1['query'][_0xdc36('0x3a')]+'%'};return _0x50244b;}})});}_0xa5bcd5=_[_0xdc36('0x3c')]({},_0xa5bcd5,_0x2aedd1[_0xdc36('0x3f')]);var _0x4f30c9={'where':_0xa5bcd5['where']};return db[_0xdc36('0x2b')][_0xdc36('0x1d')](_0x4f30c9)['then'](function(_0x5d6586){_0x5124d9[_0xdc36('0x1d')]=_0x5d6586;if(_0x2aedd1[_0xdc36('0x31')]['includeAll']){_0xa5bcd5[_0xdc36('0x40')]=[{'all':!![]}];}return db[_0xdc36('0x2b')][_0xdc36('0x41')](_0xa5bcd5);})[_0xdc36('0x25')](function(_0x27c948){_0x5124d9[_0xdc36('0x42')]=_0x27c948;return _0x5124d9;})[_0xdc36('0x25')](respondWithFilteredResult(_0x3003ad,_0xa5bcd5))[_0xdc36('0x43')](handleError(_0x3003ad,null));};exports[_0xdc36('0x44')]=function(_0x20bb86,_0xcb42a1){var _0x214743={'raw':![],'where':{'id':_0x20bb86[_0xdc36('0x45')]['id']}},_0x72ba6c={};_0x72ba6c['model']=_[_0xdc36('0x32')](db[_0xdc36('0x2b')]['rawAttributes']);_0x72ba6c['query']=_['keys'](_0x20bb86['query']);_0x72ba6c['filters']=_[_0xdc36('0x34')](_0x72ba6c[_0xdc36('0x2e')],_0x72ba6c[_0xdc36('0x31')]);_0x214743['attributes']=_[_0xdc36('0x34')](_0x72ba6c[_0xdc36('0x2e')],qs[_0xdc36('0x35')](_0x20bb86[_0xdc36('0x31')][_0xdc36('0x35')]));_0x214743['attributes']=_0x214743[_0xdc36('0x36')]['length']?_0x214743[_0xdc36('0x36')]:_0x72ba6c[_0xdc36('0x2e')];if(_0x20bb86[_0xdc36('0x31')]['includeAll']){_0x214743['include']=[{'all':!![]}];}_0x214743=_[_0xdc36('0x3c')]({},_0x214743,_0x20bb86[_0xdc36('0x3f')]);return db[_0xdc36('0x2b')][_0xdc36('0x46')](_0x214743)['then'](handleEntityNotFound(_0xcb42a1,null))[_0xdc36('0x25')](respondWithResult(_0xcb42a1,null))[_0xdc36('0x43')](handleError(_0xcb42a1,null));};exports[_0xdc36('0x47')]=function(_0x153043,_0x372f12){return db['Automation'][_0xdc36('0x47')](_0x153043[_0xdc36('0x48')],{})[_0xdc36('0x25')](respondWithResult(_0x372f12,0xc9))[_0xdc36('0x43')](handleError(_0x372f12,null));};exports[_0xdc36('0x24')]=function(_0x438231,_0x275706){if(_0x438231[_0xdc36('0x48')]['id']){delete _0x438231[_0xdc36('0x48')]['id'];}return db[_0xdc36('0x2b')][_0xdc36('0x46')]({'where':{'id':_0x438231[_0xdc36('0x45')]['id']}})['then'](handleEntityNotFound(_0x275706,null))[_0xdc36('0x25')](saveUpdates(_0x438231['body'],null))[_0xdc36('0x25')](respondWithResult(_0x275706,null))[_0xdc36('0x43')](handleError(_0x275706,null));};exports[_0xdc36('0x26')]=function(_0x2c4d23,_0x2f7cf4){return db['Automation']['find']({'where':{'id':_0x2c4d23[_0xdc36('0x45')]['id']}})[_0xdc36('0x25')](handleEntityNotFound(_0x2f7cf4,null))[_0xdc36('0x25')](removeEntity(_0x2f7cf4,null))['catch'](handleError(_0x2f7cf4,null));};exports[_0xdc36('0x49')]=function(_0x41887b,_0x13893b,_0x1a242e){return db['Condition']['find']({'where':{'id':_0x41887b[_0xdc36('0x45')]['id']}})[_0xdc36('0x25')](handleEntityNotFound(_0x13893b,null))[_0xdc36('0x25')](function(_0x50622a){if(_0x50622a){return _0x50622a[_0xdc36('0x49')](_0x41887b[_0xdc36('0x48')][_0xdc36('0x4a')],_[_0xdc36('0x4b')](_0x41887b[_0xdc36('0x48')],[_0xdc36('0x4a'),'id'])||{});}})[_0xdc36('0x25')](respondWithResult(_0x13893b,null))['catch'](handleError(_0x13893b,null));};exports['getConditions']=function(_0x3d8993,_0x17065f,_0x3b6f46){var _0x2af72f={};var _0x294a9b={};var _0x8cd05e;var _0x3e3713;return db[_0xdc36('0x2b')][_0xdc36('0x4c')]({'where':{'id':_0x3d8993[_0xdc36('0x45')]['id']}})[_0xdc36('0x25')](handleEntityNotFound(_0x17065f,null))[_0xdc36('0x25')](function(_0x5e5cac){if(_0x5e5cac){_0x8cd05e=_0x5e5cac;_0x294a9b[_0xdc36('0x2e')]=_[_0xdc36('0x32')](db[_0xdc36('0x4d')][_0xdc36('0x2c')]);_0x294a9b[_0xdc36('0x31')]=_[_0xdc36('0x32')](_0x3d8993['query']);_0x294a9b[_0xdc36('0x33')]=_['intersection'](_0x294a9b['model'],_0x294a9b[_0xdc36('0x31')]);_0x2af72f[_0xdc36('0x36')]=_[_0xdc36('0x34')](_0x294a9b[_0xdc36('0x2e')],qs[_0xdc36('0x35')](_0x3d8993[_0xdc36('0x31')][_0xdc36('0x35')]));_0x2af72f[_0xdc36('0x36')]=_0x2af72f[_0xdc36('0x36')][_0xdc36('0x4e')]?_0x2af72f['attributes']:_0x294a9b[_0xdc36('0x2e')];_0x2af72f[_0xdc36('0x37')]=qs[_0xdc36('0x38')](_0x3d8993[_0xdc36('0x31')][_0xdc36('0x38')]);_0x2af72f['where']=qs[_0xdc36('0x33')](_[_0xdc36('0x39')](_0x3d8993[_0xdc36('0x31')],_0x294a9b[_0xdc36('0x33')]));if(_0x3d8993[_0xdc36('0x31')][_0xdc36('0x3a')]){_0x2af72f[_0xdc36('0x3b')]=_[_0xdc36('0x3c')](_0x2af72f['where'],{'$or':_[_0xdc36('0x2f')](_0x2af72f[_0xdc36('0x36')],function(_0x265ae6){var _0x3d04f3={};_0x3d04f3[_0x265ae6]={'$like':'%'+_0x3d8993[_0xdc36('0x31')][_0xdc36('0x3a')]+'%'};return _0x3d04f3;})});}_0x2af72f=_[_0xdc36('0x3c')]({},_0x2af72f,_0x3d8993[_0xdc36('0x3f')]);return _0x8cd05e['getConditions'](_0x2af72f);}})[_0xdc36('0x25')](function(_0x46ab22){if(_0x46ab22){_0x3e3713=_0x46ab22[_0xdc36('0x4e')];if(!_0x3d8993['query']['hasOwnProperty'](_0xdc36('0x4f'))){_0x2af72f[_0xdc36('0x1f')]=qs[_0xdc36('0x1f')](_0x3d8993[_0xdc36('0x31')][_0xdc36('0x1f')]);_0x2af72f['offset']=qs[_0xdc36('0x1e')](_0x3d8993['query'][_0xdc36('0x1e')]);}return _0x8cd05e['getConditions'](_0x2af72f);}})[_0xdc36('0x25')](function(_0x280e66){if(_0x280e66){return _0x280e66?{'count':_0x3e3713,'rows':_0x280e66}:null;}})['then'](respondWithResult(_0x17065f,null))[_0xdc36('0x43')](handleError(_0x17065f,null));};exports['addActions']=function(_0x19e0f0,_0x560887,_0x5173d3){return db[_0xdc36('0x50')][_0xdc36('0x46')]({'where':{'id':_0x19e0f0[_0xdc36('0x45')]['id']}})[_0xdc36('0x25')](handleEntityNotFound(_0x560887,null))[_0xdc36('0x25')](function(_0x51d1d6){if(_0x51d1d6){return _0x51d1d6[_0xdc36('0x51')](_0x19e0f0['body'][_0xdc36('0x4a')],_[_0xdc36('0x4b')](_0x19e0f0[_0xdc36('0x48')],[_0xdc36('0x4a'),'id'])||{});}})[_0xdc36('0x25')](respondWithResult(_0x560887,null))[_0xdc36('0x43')](handleError(_0x560887,null));};exports[_0xdc36('0x52')]=function(_0x4fc3db,_0x45c080,_0x35f030){var _0x35419f={};var _0x1c92db={};var _0x3c5fc4;var _0x3d2061;return db[_0xdc36('0x2b')][_0xdc36('0x4c')]({'where':{'id':_0x4fc3db[_0xdc36('0x45')]['id']}})[_0xdc36('0x25')](handleEntityNotFound(_0x45c080,null))[_0xdc36('0x25')](function(_0x51588b){if(_0x51588b){_0x3c5fc4=_0x51588b;_0x1c92db[_0xdc36('0x2e')]=_[_0xdc36('0x32')](db[_0xdc36('0x50')]['rawAttributes']);_0x1c92db[_0xdc36('0x31')]=_[_0xdc36('0x32')](_0x4fc3db[_0xdc36('0x31')]);_0x1c92db[_0xdc36('0x33')]=_[_0xdc36('0x34')](_0x1c92db['model'],_0x1c92db[_0xdc36('0x31')]);_0x35419f[_0xdc36('0x36')]=_[_0xdc36('0x34')](_0x1c92db['model'],qs['fields'](_0x4fc3db[_0xdc36('0x31')]['fields']));_0x35419f[_0xdc36('0x36')]=_0x35419f[_0xdc36('0x36')][_0xdc36('0x4e')]?_0x35419f['attributes']:_0x1c92db[_0xdc36('0x2e')];_0x35419f['order']=qs[_0xdc36('0x38')](_0x4fc3db['query'][_0xdc36('0x38')]);_0x35419f[_0xdc36('0x3b')]=qs[_0xdc36('0x33')](_[_0xdc36('0x39')](_0x4fc3db['query'],_0x1c92db[_0xdc36('0x33')]));if(_0x4fc3db[_0xdc36('0x31')][_0xdc36('0x3a')]){_0x35419f['where']=_['merge'](_0x35419f[_0xdc36('0x3b')],{'$or':_['map'](_0x35419f[_0xdc36('0x36')],function(_0x196e2c){var _0x52d8e4={};_0x52d8e4[_0x196e2c]={'$like':'%'+_0x4fc3db[_0xdc36('0x31')]['filter']+'%'};return _0x52d8e4;})});}_0x35419f=_[_0xdc36('0x3c')]({},_0x35419f,_0x4fc3db[_0xdc36('0x3f')]);return _0x3c5fc4[_0xdc36('0x52')](_0x35419f);}})[_0xdc36('0x25')](function(_0x192b06){if(_0x192b06){_0x3d2061=_0x192b06[_0xdc36('0x4e')];if(!_0x4fc3db['query']['hasOwnProperty']('nolimit')){_0x35419f[_0xdc36('0x1f')]=qs[_0xdc36('0x1f')](_0x4fc3db['query'][_0xdc36('0x1f')]);_0x35419f[_0xdc36('0x1e')]=qs['offset'](_0x4fc3db['query']['offset']);}return _0x3c5fc4[_0xdc36('0x52')](_0x35419f);}})[_0xdc36('0x25')](function(_0x21601b){if(_0x21601b){return _0x21601b?{'count':_0x3d2061,'rows':_0x21601b}:null;}})[_0xdc36('0x25')](respondWithResult(_0x45c080,null))[_0xdc36('0x43')](handleError(_0x45c080,null));}; \ No newline at end of file diff --git a/server/api/automation/automation.model.js b/server/api/automation/automation.model.js index 8e11b21..6d0289c 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 _0x24a9=['moment','bluebird','request-promise','rimraf','../../config/environment','./automation.attributes','exports','define','Automation','lodash','util','api'];(function(_0x1b2ff7,_0x12a034){var _0x31656a=function(_0x1165a5){while(--_0x1165a5){_0x1b2ff7['push'](_0x1b2ff7['shift']());}};_0x31656a(++_0x12a034);}(_0x24a9,0xf9));var _0x924a=function(_0x50ecd9,_0x4d6160){_0x50ecd9=_0x50ecd9-0x0;var _0x10d2aa=_0x24a9[_0x50ecd9];return _0x10d2aa;};'use strict';var _=require(_0x924a('0x0'));var util=require(_0x924a('0x1'));var logger=require('../../config/logger')(_0x924a('0x2'));var moment=require(_0x924a('0x3'));var BPromise=require(_0x924a('0x4'));var rp=require(_0x924a('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x924a('0x6'));var config=require(_0x924a('0x7'));var attributes=require(_0x924a('0x8'));module[_0x924a('0x9')]=function(_0x63206c,_0x497773){return _0x63206c[_0x924a('0xa')](_0x924a('0xb'),attributes,{'tableName':'tools_automations','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x637b=['Automation','lodash','../../config/logger','bluebird','request-promise','path','./automation.attributes','exports','define'];(function(_0x32eccb,_0x1327a5){var _0x1a598b=function(_0x52f70b){while(--_0x52f70b){_0x32eccb['push'](_0x32eccb['shift']());}};_0x1a598b(++_0x1327a5);}(_0x637b,0x133));var _0xb637=function(_0x59e1cb,_0x27c61f){_0x59e1cb=_0x59e1cb-0x0;var _0x4f7fc2=_0x637b[_0x59e1cb];return _0x4f7fc2;};'use strict';var _=require(_0xb637('0x0'));var util=require('util');var logger=require(_0xb637('0x1'))('api');var moment=require('moment');var BPromise=require(_0xb637('0x2'));var rp=require(_0xb637('0x3'));var fs=require('fs');var path=require(_0xb637('0x4'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0xb637('0x5'));module[_0xb637('0x6')]=function(_0x1bfc81,_0x1c9289){return _0x1bfc81[_0xb637('0x7')](_0xb637('0x8'),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 c998dc2..38b5385 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 _0xd07f=['client','http','info','request\x20sent','debug','Automation,\x20%s,\x20%s,\x20%s','stringify','error','code','Automation,\x20%s,\x20%s','message','result','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise'];(function(_0x814fbd,_0xecd8ea){var _0x4dcae9=function(_0x21bd9f){while(--_0x21bd9f){_0x814fbd['push'](_0x814fbd['shift']());}};_0x4dcae9(++_0xecd8ea);}(_0xd07f,0x165));var _0xfd07=function(_0x46e321,_0x29e442){_0x46e321=_0x46e321-0x0;var _0x2fe9f0=_0xd07f[_0x46e321];return _0x2fe9f0;};'use strict';var _=require(_0xfd07('0x0'));var util=require(_0xfd07('0x1'));var moment=require(_0xfd07('0x2'));var BPromise=require(_0xfd07('0x3'));var rs=require(_0xfd07('0x4'));var fs=require('fs');var Redis=require(_0xfd07('0x5'));var db=require(_0xfd07('0x6'))['db'];var utils=require(_0xfd07('0x7'));var logger=require(_0xfd07('0x8'))('rpc');var config=require(_0xfd07('0x9'));var jayson=require(_0xfd07('0xa'));var client=jayson[_0xfd07('0xb')][_0xfd07('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x5bbea9,_0x24538e,_0x717818){return new BPromise(function(_0x1634eb,_0x4b5232){return client['request'](_0x5bbea9,_0x717818)['then'](function(_0x18bda8){logger[_0xfd07('0xd')]('Automation,\x20%s,\x20%s',_0x24538e,_0xfd07('0xe'));logger[_0xfd07('0xf')](_0xfd07('0x10'),_0x24538e,_0xfd07('0xe'),JSON[_0xfd07('0x11')](_0x18bda8));if(_0x18bda8[_0xfd07('0x12')]){if(_0x18bda8[_0xfd07('0x12')][_0xfd07('0x13')]===0x1f4){logger[_0xfd07('0x12')](_0xfd07('0x14'),_0x24538e,_0x18bda8[_0xfd07('0x12')][_0xfd07('0x15')]);return _0x4b5232(_0x18bda8[_0xfd07('0x12')][_0xfd07('0x15')]);}logger[_0xfd07('0x12')](_0xfd07('0x14'),_0x24538e,_0x18bda8[_0xfd07('0x12')][_0xfd07('0x15')]);return _0x1634eb(_0x18bda8[_0xfd07('0x12')][_0xfd07('0x15')]);}else{logger['info']('Automation,\x20%s,\x20%s',_0x24538e,_0xfd07('0xe'));_0x1634eb(_0x18bda8[_0xfd07('0x16')][_0xfd07('0x15')]);}})['catch'](function(_0x13f46d){logger[_0xfd07('0x12')](_0xfd07('0x14'),_0x24538e,_0x13f46d);_0x4b5232(_0x13f46d);});});} \ No newline at end of file +var _0xeadc=['error','code','Automation,\x20%s,\x20%s','message','result','catch','lodash','util','moment','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','request','then','info','request\x20sent','Automation,\x20%s,\x20%s,\x20%s'];(function(_0x169472,_0x117286){var _0x5ba9c8=function(_0x33e9ca){while(--_0x33e9ca){_0x169472['push'](_0x169472['shift']());}};_0x5ba9c8(++_0x117286);}(_0xeadc,0x1d4));var _0xcead=function(_0x1efc2f,_0x343d82){_0x1efc2f=_0x1efc2f-0x0;var _0x4daf46=_0xeadc[_0x1efc2f];return _0x4daf46;};'use strict';var _=require(_0xcead('0x0'));var util=require(_0xcead('0x1'));var moment=require(_0xcead('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xcead('0x3'));var db=require(_0xcead('0x4'))['db'];var utils=require(_0xcead('0x5'));var logger=require(_0xcead('0x6'))(_0xcead('0x7'));var config=require(_0xcead('0x8'));var jayson=require('jayson/promise');var client=jayson[_0xcead('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x239d28,_0x35bf8d,_0x3cade8){return new BPromise(function(_0x34d3c6,_0x57bf2d){return client[_0xcead('0xa')](_0x239d28,_0x3cade8)[_0xcead('0xb')](function(_0x2722bf){logger[_0xcead('0xc')]('Automation,\x20%s,\x20%s',_0x35bf8d,_0xcead('0xd'));logger['debug'](_0xcead('0xe'),_0x35bf8d,_0xcead('0xd'),JSON['stringify'](_0x2722bf));if(_0x2722bf[_0xcead('0xf')]){if(_0x2722bf[_0xcead('0xf')][_0xcead('0x10')]===0x1f4){logger[_0xcead('0xf')](_0xcead('0x11'),_0x35bf8d,_0x2722bf['error'][_0xcead('0x12')]);return _0x57bf2d(_0x2722bf[_0xcead('0xf')]['message']);}logger['error']('Automation,\x20%s,\x20%s',_0x35bf8d,_0x2722bf[_0xcead('0xf')][_0xcead('0x12')]);return _0x34d3c6(_0x2722bf[_0xcead('0xf')][_0xcead('0x12')]);}else{logger[_0xcead('0xc')]('Automation,\x20%s,\x20%s',_0x35bf8d,_0xcead('0xd'));_0x34d3c6(_0x2722bf[_0xcead('0x13')][_0xcead('0x12')]);}})[_0xcead('0x14')](function(_0x3f70d9){logger[_0xcead('0xf')]('Automation,\x20%s,\x20%s',_0x35bf8d,_0x3f70d9);_0x57bf2d(_0x3f70d9);});});} \ No newline at end of file diff --git a/server/api/automation/index.js b/server/api/automation/index.js index 3630d0e..68bc667 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 _0x0cae=['show','/:id/conditions','getConditions','/:id/actions','getActions','post','put','update','destroy','exports','multer','util','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./automation.controller','get','isAuthenticated','index','/:id'];(function(_0x224b66,_0x28bf8f){var _0x429651=function(_0x251448){while(--_0x251448){_0x224b66['push'](_0x224b66['shift']());}};_0x429651(++_0x28bf8f);}(_0x0cae,0xa4));var _0xe0ca=function(_0x5b17d8,_0x377f1a){_0x5b17d8=_0x5b17d8-0x0;var _0x2b08fc=_0x0cae[_0x5b17d8];return _0x2b08fc;};'use strict';var multer=require(_0xe0ca('0x0'));var util=require(_0xe0ca('0x1'));var path=require('path');var timeout=require(_0xe0ca('0x2'));var express=require('express');var router=express[_0xe0ca('0x3')]();var auth=require(_0xe0ca('0x4'));var interaction=require(_0xe0ca('0x5'));var config=require(_0xe0ca('0x6'));var controller=require(_0xe0ca('0x7'));router[_0xe0ca('0x8')]('/',auth[_0xe0ca('0x9')](),controller[_0xe0ca('0xa')]);router['get'](_0xe0ca('0xb'),auth['isAuthenticated'](),controller[_0xe0ca('0xc')]);router['get'](_0xe0ca('0xd'),auth[_0xe0ca('0x9')](),controller[_0xe0ca('0xe')]);router['get'](_0xe0ca('0xf'),auth[_0xe0ca('0x9')](),controller[_0xe0ca('0x10')]);router[_0xe0ca('0x11')]('/',auth[_0xe0ca('0x9')](),controller['create']);router[_0xe0ca('0x11')]('/:id/conditions',auth[_0xe0ca('0x9')](),controller['addConditions']);router['post'](_0xe0ca('0xf'),auth[_0xe0ca('0x9')](),controller['addActions']);router[_0xe0ca('0x12')](_0xe0ca('0xb'),auth['isAuthenticated'](),controller[_0xe0ca('0x13')]);router['delete'](_0xe0ca('0xb'),auth[_0xe0ca('0x9')](),controller[_0xe0ca('0x14')]);module[_0xe0ca('0x15')]=router; \ No newline at end of file +var _0xa9e2=['delete','destroy','multer','util','path','connect-timeout','Router','../../config/environment','get','isAuthenticated','index','/:id','/:id/conditions','/:id/actions','getActions','create','post','addConditions','update'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0xa9e2,0xc0));var _0x2a9e=function(_0x4fa7da,_0x372c4c){_0x4fa7da=_0x4fa7da-0x0;var _0x1aa65c=_0xa9e2[_0x4fa7da];return _0x1aa65c;};'use strict';var multer=require(_0x2a9e('0x0'));var util=require(_0x2a9e('0x1'));var path=require(_0x2a9e('0x2'));var timeout=require(_0x2a9e('0x3'));var express=require('express');var router=express[_0x2a9e('0x4')]();var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x2a9e('0x5'));var controller=require('./automation.controller');router[_0x2a9e('0x6')]('/',auth[_0x2a9e('0x7')](),controller[_0x2a9e('0x8')]);router[_0x2a9e('0x6')](_0x2a9e('0x9'),auth['isAuthenticated'](),controller['show']);router['get'](_0x2a9e('0xa'),auth['isAuthenticated'](),controller['getConditions']);router[_0x2a9e('0x6')](_0x2a9e('0xb'),auth[_0x2a9e('0x7')](),controller[_0x2a9e('0xc')]);router['post']('/',auth[_0x2a9e('0x7')](),controller[_0x2a9e('0xd')]);router[_0x2a9e('0xe')](_0x2a9e('0xa'),auth[_0x2a9e('0x7')](),controller[_0x2a9e('0xf')]);router['post'](_0x2a9e('0xb'),auth[_0x2a9e('0x7')](),controller['addActions']);router['put']('/:id',auth['isAuthenticated'](),controller[_0x2a9e('0x10')]);router[_0x2a9e('0x11')](_0x2a9e('0x9'),auth[_0x2a9e('0x7')](),controller[_0x2a9e('0x12')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/campaign/campaign.attributes.js b/server/api/campaign/campaign.attributes.js index 4c362c4..d4601f7 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 _0xf4fc=['#Machine\x20Retry\x20(min:1,\x20max:999)','Machine\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','AgentReject\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','exports','STRING','ENUM','ivr','BOOLEAN','Active/Disactive\x20Campaign','INTEGER','UNSIGNED','#Congestion\x20Retry\x20(min:1,\x20max:999)','#Busy\x20Retry\x20(min:1,\x20max:999)','#NoAnswer\x20Retry\x20(min:1,\x20max:999)','NoAnswer\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Global\x20Max\x20Retry\x20(min:1,\x20max:999)','07:00-22:00,*,*,*','always','Active/Disactive\x20AMD','#AMD\x20Greeting','#AMD\x20After\x20Greeting\x20Silence','#AMD\x20Total\x20Analysis\x20Time','#AMD\x20Maximum\x20Number\x20Of\x20Words','#AMD\x20Silence\x20Threshold\x20(min:0,\x20max:32767)','#AMD\x20Maximum\x20Word\x20Length','ASC','DESC','Random\x20Last\x20Digit\x20(min:1,\x20max:15)','Cut\x20Digit\x20(min:1,\x20max:15)','#NoSuchNumber\x20Retry\x20(min:1,\x20max:999)','NoSuchNumber\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Drop\x20Retry\x20(min:1,\x20max:999)','Drop\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Abandoned\x20Retry\x20(min:1,\x20max:999)','Abandoned\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'];(function(_0x4b2863,_0x494899){var _0x567d67=function(_0x751f03){while(--_0x751f03){_0x4b2863['push'](_0x4b2863['shift']());}};_0x567d67(++_0x494899);}(_0xf4fc,0x1ed));var _0xcf4f=function(_0x21d766,_0x1a8461){_0x21d766=_0x21d766-0x0;var _0x106c0b=_0xf4fc[_0x21d766];return _0x106c0b;};'use strict';var Sequelize=require('sequelize');module[_0xcf4f('0x0')]={'name':{'type':Sequelize[_0xcf4f('0x1')],'unique':'name','allowNull':![],'validate':{'is':/[A-Za-z0-9._\\+*!-]+/,'notEmpty':!![]}},'type':{'type':Sequelize[_0xcf4f('0x2')](_0xcf4f('0x3')),'allowNull':![],'defaultValue':_0xcf4f('0x3')},'description':{'type':Sequelize[_0xcf4f('0x1')]},'active':{'type':Sequelize[_0xcf4f('0x4')],'defaultValue':0x0,'comment':_0xcf4f('0x5')},'limitCalls':{'type':Sequelize[_0xcf4f('0x6')](0x4)[_0xcf4f('0x7')],'defaultValue':0x1e,'validate':{'min':0x1,'max':0xc8},'comment':'Max\x20200\x20calls.'},'dialOriginateCallerIdName':{'type':Sequelize[_0xcf4f('0x1')]},'dialOriginateCallerIdNumber':{'type':Sequelize['STRING']},'dialOriginateTimeout':{'type':Sequelize[_0xcf4f('0x6')](0x3)[_0xcf4f('0x7')],'defaultValue':0x1e,'validate':{'min':0x1,'max':0x3e7},'comment':'Originate\x20Timeout\x20Seconds\x20(min:1,\x20max:999)'},'dialCongestionMaxRetry':{'type':Sequelize[_0xcf4f('0x6')](0x3)[_0xcf4f('0x7')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xcf4f('0x8')},'dialCongestionRetryFrequency':{'type':Sequelize[_0xcf4f('0x6')](0x5)[_0xcf4f('0x7')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'Congestion\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'dialBusyMaxRetry':{'type':Sequelize['INTEGER'](0x3)[_0xcf4f('0x7')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xcf4f('0x9')},'dialBusyRetryFrequency':{'type':Sequelize[_0xcf4f('0x6')](0x5)[_0xcf4f('0x7')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'Busy\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'dialNoAnswerMaxRetry':{'type':Sequelize['INTEGER'](0x3)['UNSIGNED'],'defaultValue':0x3,'comment':_0xcf4f('0xa')},'dialNoAnswerRetryFrequency':{'type':Sequelize['INTEGER'](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xcf4f('0xb')},'dialGlobalMaxRetry':{'type':Sequelize[_0xcf4f('0x6')](0x3)[_0xcf4f('0x7')],'validate':{'min':0x1,'max':0x3e7},'defaultValue':0x4,'comment':_0xcf4f('0xc')},'dialTimezone':{'type':Sequelize[_0xcf4f('0x1')],'defaultValue':null},'dialGlobalInterval':{'type':Sequelize[_0xcf4f('0x1')],'defaultValue':_0xcf4f('0xd')},'dialCheckDuplicateType':{'type':Sequelize[_0xcf4f('0x2')](_0xcf4f('0xe'),'never','onlyIfOpen'),'defaultValue':'always'},'dialAMDActive':{'type':Sequelize[_0xcf4f('0x4')],'defaultValue':0x0,'comment':_0xcf4f('0xf')},'dialAMDInitialSilence':{'type':Sequelize[_0xcf4f('0x6')](0x9)[_0xcf4f('0x7')],'defaultValue':0x9c4,'validate':{'min':0x0},'comment':'#AMD\x20Initial\x20Silence'},'dialAMDGreeting':{'type':Sequelize['INTEGER'](0x9)[_0xcf4f('0x7')],'defaultValue':0x5dc,'validate':{'min':0x0},'comment':_0xcf4f('0x10')},'dialAMDAfterGreetingSilence':{'type':Sequelize['INTEGER'](0x9)['UNSIGNED'],'defaultValue':0x320,'validate':{'min':0x0},'comment':_0xcf4f('0x11')},'dialAMDTotalAnalysisTime':{'type':Sequelize[_0xcf4f('0x6')](0x9)['UNSIGNED'],'defaultValue':0x1388,'validate':{'min':0x0},'comment':_0xcf4f('0x12')},'dialAMDMinWordLength':{'type':Sequelize[_0xcf4f('0x6')](0x9)[_0xcf4f('0x7')],'defaultValue':0x64,'validate':{'min':0x0},'comment':'#AMD\x20Min\x20Word\x20Length'},'dialAMDBetweenWordsSilence':{'type':Sequelize[_0xcf4f('0x6')](0x9)[_0xcf4f('0x7')],'defaultValue':0x32,'validate':{'min':0x0},'comment':'#AMD\x20Between\x20Words\x20Silence'},'dialAMDMaximumNumberOfWords':{'type':Sequelize[_0xcf4f('0x6')](0x9)[_0xcf4f('0x7')],'defaultValue':0x3,'validate':{'min':0x0},'comment':_0xcf4f('0x13')},'dialAMDSilenceThreshold':{'type':Sequelize[_0xcf4f('0x6')](0x5)[_0xcf4f('0x7')],'validate':{'min':0x0,'max':0x7fff},'defaultValue':0x100,'comment':_0xcf4f('0x14')},'dialAMDMaximumWordLength':{'type':Sequelize[_0xcf4f('0x6')](0x9)[_0xcf4f('0x7')],'defaultValue':0x1388,'validate':{'min':0x0},'comment':_0xcf4f('0x15')},'dialOrderByScheduledAt':{'type':Sequelize['ENUM']('DESC',_0xcf4f('0x16')),'defaultValue':_0xcf4f('0x17')},'dialPrefix':{'type':Sequelize['STRING'],'defaultValue':null},'dialRandomLastDigitCallerIdNumber':{'type':Sequelize[_0xcf4f('0x6')](0x3)[_0xcf4f('0x7')],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':_0xcf4f('0x18')},'dialCutDigit':{'type':Sequelize[_0xcf4f('0x6')](0x3)[_0xcf4f('0x7')],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':_0xcf4f('0x19')},'dialNoSuchNumberMaxRetry':{'type':Sequelize['INTEGER'](0x3)[_0xcf4f('0x7')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xcf4f('0x1a')},'dialNoSuchNumberRetryFrequency':{'type':Sequelize[_0xcf4f('0x6')](0x5)[_0xcf4f('0x7')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xcf4f('0x1b')},'dialDropMaxRetry':{'type':Sequelize[_0xcf4f('0x6')](0x3)[_0xcf4f('0x7')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xcf4f('0x1c')},'dialDropRetryFrequency':{'type':Sequelize[_0xcf4f('0x6')](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xcf4f('0x1d')},'dialAbandonedMaxRetry':{'type':Sequelize[_0xcf4f('0x6')](0x3)[_0xcf4f('0x7')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xcf4f('0x1e')},'dialAbandonedRetryFrequency':{'type':Sequelize[_0xcf4f('0x6')](0x5)[_0xcf4f('0x7')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xcf4f('0x1f')},'dialMachineMaxRetry':{'type':Sequelize[_0xcf4f('0x6')](0x3)[_0xcf4f('0x7')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xcf4f('0x20')},'dialMachineRetryFrequency':{'type':Sequelize[_0xcf4f('0x6')](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xcf4f('0x21')},'dialAgentRejectMaxRetry':{'type':Sequelize[_0xcf4f('0x6')](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#AgentReject\x20Retry\x20(min:1,\x20max:999)'},'dialAgentRejectRetryFrequency':{'type':Sequelize['INTEGER'](0x5)[_0xcf4f('0x7')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xcf4f('0x22')}}; \ No newline at end of file +var _0xe5fe=['Cut\x20Digit\x20(min:1,\x20max:15)','NoSuchNumber\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Drop\x20Retry\x20(min:1,\x20max:999)','Drop\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Abandoned\x20Retry\x20(min:1,\x20max:999)','Abandoned\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Machine\x20Retry\x20(min:1,\x20max:999)','Machine\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#AgentReject\x20Retry\x20(min:1,\x20max:999)','AgentReject\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','sequelize','exports','STRING','name','ENUM','ivr','BOOLEAN','UNSIGNED','Max\x20200\x20calls.','Originate\x20Timeout\x20Seconds\x20(min:1,\x20max:999)','#Congestion\x20Retry\x20(min:1,\x20max:999)','Congestion\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','INTEGER','#Busy\x20Retry\x20(min:1,\x20max:999)','Busy\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','NoAnswer\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Global\x20Max\x20Retry\x20(min:1,\x20max:999)','07:00-22:00,*,*,*','always','onlyIfOpen','Active/Disactive\x20AMD','#AMD\x20Greeting','#AMD\x20After\x20Greeting\x20Silence','#AMD\x20Total\x20Analysis\x20Time','#AMD\x20Min\x20Word\x20Length','#AMD\x20Silence\x20Threshold\x20(min:0,\x20max:32767)','DESC','ASC','Random\x20Last\x20Digit\x20(min:1,\x20max:15)'];(function(_0x202c61,_0x3673e0){var _0x540691=function(_0x409610){while(--_0x409610){_0x202c61['push'](_0x202c61['shift']());}};_0x540691(++_0x3673e0);}(_0xe5fe,0xf4));var _0xee5f=function(_0x3db02f,_0x7a9ed3){_0x3db02f=_0x3db02f-0x0;var _0x7383d4=_0xe5fe[_0x3db02f];return _0x7383d4;};'use strict';var Sequelize=require(_0xee5f('0x0'));module[_0xee5f('0x1')]={'name':{'type':Sequelize[_0xee5f('0x2')],'unique':_0xee5f('0x3'),'allowNull':![],'validate':{'is':/[A-Za-z0-9._\\+*!-]+/,'notEmpty':!![]}},'type':{'type':Sequelize[_0xee5f('0x4')]('ivr'),'allowNull':![],'defaultValue':_0xee5f('0x5')},'description':{'type':Sequelize['STRING']},'active':{'type':Sequelize[_0xee5f('0x6')],'defaultValue':0x0,'comment':'Active/Disactive\x20Campaign'},'limitCalls':{'type':Sequelize['INTEGER'](0x4)[_0xee5f('0x7')],'defaultValue':0x1e,'validate':{'min':0x1,'max':0xc8},'comment':_0xee5f('0x8')},'dialOriginateCallerIdName':{'type':Sequelize[_0xee5f('0x2')]},'dialOriginateCallerIdNumber':{'type':Sequelize[_0xee5f('0x2')]},'dialOriginateTimeout':{'type':Sequelize['INTEGER'](0x3)[_0xee5f('0x7')],'defaultValue':0x1e,'validate':{'min':0x1,'max':0x3e7},'comment':_0xee5f('0x9')},'dialCongestionMaxRetry':{'type':Sequelize['INTEGER'](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xee5f('0xa')},'dialCongestionRetryFrequency':{'type':Sequelize['INTEGER'](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xee5f('0xb')},'dialBusyMaxRetry':{'type':Sequelize[_0xee5f('0xc')](0x3)[_0xee5f('0x7')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xee5f('0xd')},'dialBusyRetryFrequency':{'type':Sequelize[_0xee5f('0xc')](0x5)[_0xee5f('0x7')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xee5f('0xe')},'dialNoAnswerMaxRetry':{'type':Sequelize[_0xee5f('0xc')](0x3)[_0xee5f('0x7')],'defaultValue':0x3,'comment':'#NoAnswer\x20Retry\x20(min:1,\x20max:999)'},'dialNoAnswerRetryFrequency':{'type':Sequelize['INTEGER'](0x5)[_0xee5f('0x7')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xee5f('0xf')},'dialGlobalMaxRetry':{'type':Sequelize[_0xee5f('0xc')](0x3)[_0xee5f('0x7')],'validate':{'min':0x1,'max':0x3e7},'defaultValue':0x4,'comment':_0xee5f('0x10')},'dialTimezone':{'type':Sequelize[_0xee5f('0x2')],'defaultValue':null},'dialGlobalInterval':{'type':Sequelize[_0xee5f('0x2')],'defaultValue':_0xee5f('0x11')},'dialCheckDuplicateType':{'type':Sequelize[_0xee5f('0x4')](_0xee5f('0x12'),'never',_0xee5f('0x13')),'defaultValue':'always'},'dialAMDActive':{'type':Sequelize[_0xee5f('0x6')],'defaultValue':0x0,'comment':_0xee5f('0x14')},'dialAMDInitialSilence':{'type':Sequelize[_0xee5f('0xc')](0x9)[_0xee5f('0x7')],'defaultValue':0x9c4,'validate':{'min':0x0},'comment':'#AMD\x20Initial\x20Silence'},'dialAMDGreeting':{'type':Sequelize['INTEGER'](0x9)[_0xee5f('0x7')],'defaultValue':0x5dc,'validate':{'min':0x0},'comment':_0xee5f('0x15')},'dialAMDAfterGreetingSilence':{'type':Sequelize[_0xee5f('0xc')](0x9)[_0xee5f('0x7')],'defaultValue':0x320,'validate':{'min':0x0},'comment':_0xee5f('0x16')},'dialAMDTotalAnalysisTime':{'type':Sequelize[_0xee5f('0xc')](0x9)['UNSIGNED'],'defaultValue':0x1388,'validate':{'min':0x0},'comment':_0xee5f('0x17')},'dialAMDMinWordLength':{'type':Sequelize['INTEGER'](0x9)[_0xee5f('0x7')],'defaultValue':0x64,'validate':{'min':0x0},'comment':_0xee5f('0x18')},'dialAMDBetweenWordsSilence':{'type':Sequelize[_0xee5f('0xc')](0x9)[_0xee5f('0x7')],'defaultValue':0x32,'validate':{'min':0x0},'comment':'#AMD\x20Between\x20Words\x20Silence'},'dialAMDMaximumNumberOfWords':{'type':Sequelize[_0xee5f('0xc')](0x9)[_0xee5f('0x7')],'defaultValue':0x3,'validate':{'min':0x0},'comment':'#AMD\x20Maximum\x20Number\x20Of\x20Words'},'dialAMDSilenceThreshold':{'type':Sequelize[_0xee5f('0xc')](0x5)[_0xee5f('0x7')],'validate':{'min':0x0,'max':0x7fff},'defaultValue':0x100,'comment':_0xee5f('0x19')},'dialAMDMaximumWordLength':{'type':Sequelize[_0xee5f('0xc')](0x9)[_0xee5f('0x7')],'defaultValue':0x1388,'validate':{'min':0x0},'comment':'#AMD\x20Maximum\x20Word\x20Length'},'dialOrderByScheduledAt':{'type':Sequelize[_0xee5f('0x4')](_0xee5f('0x1a'),_0xee5f('0x1b')),'defaultValue':_0xee5f('0x1a')},'dialPrefix':{'type':Sequelize[_0xee5f('0x2')],'defaultValue':null},'dialRandomLastDigitCallerIdNumber':{'type':Sequelize[_0xee5f('0xc')](0x3)['UNSIGNED'],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':_0xee5f('0x1c')},'dialCutDigit':{'type':Sequelize[_0xee5f('0xc')](0x3)[_0xee5f('0x7')],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':_0xee5f('0x1d')},'dialNoSuchNumberMaxRetry':{'type':Sequelize[_0xee5f('0xc')](0x3)[_0xee5f('0x7')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#NoSuchNumber\x20Retry\x20(min:1,\x20max:999)'},'dialNoSuchNumberRetryFrequency':{'type':Sequelize['INTEGER'](0x5)[_0xee5f('0x7')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xee5f('0x1e')},'dialDropMaxRetry':{'type':Sequelize['INTEGER'](0x3)[_0xee5f('0x7')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xee5f('0x1f')},'dialDropRetryFrequency':{'type':Sequelize['INTEGER'](0x5)[_0xee5f('0x7')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xee5f('0x20')},'dialAbandonedMaxRetry':{'type':Sequelize['INTEGER'](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xee5f('0x21')},'dialAbandonedRetryFrequency':{'type':Sequelize[_0xee5f('0xc')](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xee5f('0x22')},'dialMachineMaxRetry':{'type':Sequelize['INTEGER'](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xee5f('0x23')},'dialMachineRetryFrequency':{'type':Sequelize[_0xee5f('0xc')](0x5)[_0xee5f('0x7')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xee5f('0x24')},'dialAgentRejectMaxRetry':{'type':Sequelize[_0xee5f('0xc')](0x3)[_0xee5f('0x7')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xee5f('0x25')},'dialAgentRejectRetryFrequency':{'type':Sequelize[_0xee5f('0xc')](0x5)[_0xee5f('0x7')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xee5f('0x26')}}; \ No newline at end of file diff --git a/server/api/campaign/campaign.controller.js b/server/api/campaign/campaign.controller.js index 59302a3..fd871f1 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 _0x9f62=['fieldName','type','query','keys','filters','attributes','intersection','model','fields','length','hasOwnProperty','limit','order','sort','where','pick','filter','options','include','findAll','show','params','includeAll','find','catch','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','clone','omit','updatedAt','merge','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','findOne','CmHopper','nolimit','CampaignId','rows','CmHopperHistory','getHopperFinals','CmHopperFinal','getHopperBlacks','CmHopperBlack','CmList','getLists','addLists','spread','dialCheckDuplicateType','always','into','cm_hopper','fromQuery','phone','scheduledAt','createdAt','select','NOW()','field','ContactId','CmListId','toString','ListId','from','cm_contacts','deletedAt\x20IS\x20NULL','ListId\x20=\x20?','phone\x20IS\x20NOT\x20NULL','phone\x20NOT\x20IN\x20(?)','COALESCE(calleridnum,\x27\x27)','CampaignId\x20=\x20?','onlyIfOpen','sequelize','all','removeLists','ids','addBlackLists','insert','cm_hopper_black','push','removeBlackLists','eml-format','zip-dir','fast-json-patch','request-promise','mustache','util','path','sox','ejs','lodash','squel','crypto','jsforce','ioredis','../../components/auth/service','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','sendStatus','status','end','json','count','offset','set','Content-Range','reject','save','then','destroy','get','IvrCampaigns','UserProfileResource','error','name','send','index','map','Campaign','rawAttributes'];(function(_0x4c98b9,_0x1ad11b){var _0x3a257a=function(_0x147857){while(--_0x147857){_0x4c98b9['push'](_0x4c98b9['shift']());}};_0x3a257a(++_0x1ad11b);}(_0x9f62,0x154));var _0x29f6=function(_0x381e3,_0x58ba57){_0x381e3=_0x381e3-0x0;var _0x373d4d=_0x9f62[_0x381e3];return _0x373d4d;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x29f6('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x29f6('0x1'));var jsonpatch=require(_0x29f6('0x2'));var rp=require(_0x29f6('0x3'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x29f6('0x4'));var util=require(_0x29f6('0x5'));var path=require(_0x29f6('0x6'));var sox=require(_0x29f6('0x7'));var csv=require('to-csv');var ejs=require(_0x29f6('0x8'));var fs=require('fs');var _=require(_0x29f6('0x9'));var squel=require(_0x29f6('0xa'));var crypto=require(_0x29f6('0xb'));var jsforce=require(_0x29f6('0xc'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x29f6('0xd'));var authService=require(_0x29f6('0xe'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x29f6('0xf'));var logger=require(_0x29f6('0x10'))('api');var utils=require(_0x29f6('0x11'));var config=require(_0x29f6('0x12'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x5b9b6a,_0x559585){_0x559585=_0x559585||0xcc;return function(_0x57b2d2){if(_0x57b2d2){return _0x5b9b6a[_0x29f6('0x13')](_0x559585);}return _0x5b9b6a[_0x29f6('0x14')](_0x559585)[_0x29f6('0x15')]();};}function respondWithResult(_0x11a1fd,_0x17de6e){_0x17de6e=_0x17de6e||0xc8;return function(_0x156c96){if(_0x156c96){return _0x11a1fd[_0x29f6('0x14')](_0x17de6e)[_0x29f6('0x16')](_0x156c96);}};}function respondWithFilteredResult(_0x1ae582,_0x19331f){return function(_0x28d314){if(_0x28d314){var _0x370484=_0x28d314[_0x29f6('0x17')],_0x1dde97=_0x19331f[_0x29f6('0x18')],_0x3a75d0=_0x19331f['offset']+_0x19331f['limit'],_0x25e5a2;if(_0x3a75d0>=_0x370484){_0x3a75d0=_0x370484;_0x25e5a2=0xc8;}else{_0x25e5a2=0xce;}_0x1ae582[_0x29f6('0x14')](_0x25e5a2);return _0x1ae582[_0x29f6('0x19')](_0x29f6('0x1a'),_0x1dde97+'-'+_0x3a75d0+'/'+_0x370484)['json'](_0x28d314);}return null;};}function patchUpdates(_0xcb90){return function(_0x46931d){try{jsonpatch['apply'](_0x46931d,_0xcb90,!![]);}catch(_0x159227){return BPromise[_0x29f6('0x1b')](_0x159227);}return _0x46931d[_0x29f6('0x1c')]();};}function saveUpdates(_0x41b9f0,_0xb6e7a9){return function(_0x2bfb3d){if(_0x2bfb3d){return _0x2bfb3d['update'](_0x41b9f0)[_0x29f6('0x1d')](function(_0x59def4){return _0x59def4;});}return null;};}function removeEntity(_0x4acb15,_0x470019){return function(_0x1fa159){if(_0x1fa159){return _0x1fa159[_0x29f6('0x1e')]()[_0x29f6('0x1d')](function(){var _0x54ddeb=_0x1fa159[_0x29f6('0x1f')]({'plain':!![]});var _0x49f67d=_0x29f6('0x20');return db[_0x29f6('0x21')][_0x29f6('0x1e')]({'where':{'type':_0x49f67d,'resourceId':_0x54ddeb['id']}})[_0x29f6('0x1d')](function(){return _0x1fa159;});})['then'](function(){_0x4acb15[_0x29f6('0x14')](0xcc)[_0x29f6('0x15')]();});}};}function handleEntityNotFound(_0x47c385,_0x1401fb){return function(_0x45f792){if(!_0x45f792){_0x47c385[_0x29f6('0x13')](0x194);}return _0x45f792;};}function handleError(_0x342038,_0x84ccb7){_0x84ccb7=_0x84ccb7||0x1f4;return function(_0x4333bc){logger[_0x29f6('0x22')](_0x4333bc['stack']);if(_0x4333bc[_0x29f6('0x23')]){delete _0x4333bc[_0x29f6('0x23')];}_0x342038[_0x29f6('0x14')](_0x84ccb7)[_0x29f6('0x24')](_0x4333bc);};}exports[_0x29f6('0x25')]=function(_0x16a6ad,_0x3790f5){var _0x17b2f2={},_0x3d88db={},_0x13a3a2={'count':0x0,'rows':[]};var _0x2915bc=_[_0x29f6('0x26')](db[_0x29f6('0x27')][_0x29f6('0x28')],function(_0x375564){return{'name':_0x375564[_0x29f6('0x29')],'type':_0x375564[_0x29f6('0x2a')]['key']};});_0x3d88db['model']=_[_0x29f6('0x26')](_0x2915bc,'name');_0x3d88db[_0x29f6('0x2b')]=_[_0x29f6('0x2c')](_0x16a6ad[_0x29f6('0x2b')]);_0x3d88db[_0x29f6('0x2d')]=_['intersection'](_0x3d88db['model'],_0x3d88db[_0x29f6('0x2b')]);_0x17b2f2[_0x29f6('0x2e')]=_[_0x29f6('0x2f')](_0x3d88db[_0x29f6('0x30')],qs[_0x29f6('0x31')](_0x16a6ad[_0x29f6('0x2b')][_0x29f6('0x31')]));_0x17b2f2[_0x29f6('0x2e')]=_0x17b2f2[_0x29f6('0x2e')][_0x29f6('0x32')]?_0x17b2f2[_0x29f6('0x2e')]:_0x3d88db[_0x29f6('0x30')];if(!_0x16a6ad[_0x29f6('0x2b')][_0x29f6('0x33')]('nolimit')){_0x17b2f2['limit']=qs[_0x29f6('0x34')](_0x16a6ad[_0x29f6('0x2b')][_0x29f6('0x34')]);_0x17b2f2['offset']=qs[_0x29f6('0x18')](_0x16a6ad[_0x29f6('0x2b')][_0x29f6('0x18')]);}_0x17b2f2[_0x29f6('0x35')]=qs[_0x29f6('0x36')](_0x16a6ad['query'][_0x29f6('0x36')]);_0x17b2f2[_0x29f6('0x37')]=qs[_0x29f6('0x2d')](_[_0x29f6('0x38')](_0x16a6ad['query'],_0x3d88db[_0x29f6('0x2d')]));if(_0x16a6ad[_0x29f6('0x2b')][_0x29f6('0x39')]){_0x17b2f2[_0x29f6('0x37')]=_['merge'](_0x17b2f2['where'],{'$or':_[_0x29f6('0x26')](_0x2915bc,function(_0x4bfc80){if(_0x4bfc80[_0x29f6('0x2a')]!=='VIRTUAL'){var _0x3a1a75={};_0x3a1a75[_0x4bfc80['name']]={'$like':'%'+_0x16a6ad[_0x29f6('0x2b')][_0x29f6('0x39')]+'%'};return _0x3a1a75;}})});}_0x17b2f2=_['merge']({},_0x17b2f2,_0x16a6ad[_0x29f6('0x3a')]);var _0x5d2553={'where':_0x17b2f2[_0x29f6('0x37')]};return db[_0x29f6('0x27')]['count'](_0x5d2553)[_0x29f6('0x1d')](function(_0xc6a6b1){_0x13a3a2[_0x29f6('0x17')]=_0xc6a6b1;if(_0x16a6ad[_0x29f6('0x2b')]['includeAll']){_0x17b2f2[_0x29f6('0x3b')]=[{'all':!![]}];}return db[_0x29f6('0x27')][_0x29f6('0x3c')](_0x17b2f2);})[_0x29f6('0x1d')](function(_0x1dbd17){_0x13a3a2['rows']=_0x1dbd17;return _0x13a3a2;})[_0x29f6('0x1d')](respondWithFilteredResult(_0x3790f5,_0x17b2f2))['catch'](handleError(_0x3790f5,null));};exports[_0x29f6('0x3d')]=function(_0x552257,_0xbfe671){var _0x3a8a12={'raw':![],'where':{'id':_0x552257[_0x29f6('0x3e')]['id']}},_0x4b1524={};_0x4b1524[_0x29f6('0x30')]=_[_0x29f6('0x2c')](db[_0x29f6('0x27')]['rawAttributes']);_0x4b1524[_0x29f6('0x2b')]=_[_0x29f6('0x2c')](_0x552257[_0x29f6('0x2b')]);_0x4b1524['filters']=_[_0x29f6('0x2f')](_0x4b1524['model'],_0x4b1524[_0x29f6('0x2b')]);_0x3a8a12['attributes']=_['intersection'](_0x4b1524['model'],qs[_0x29f6('0x31')](_0x552257[_0x29f6('0x2b')][_0x29f6('0x31')]));_0x3a8a12[_0x29f6('0x2e')]=_0x3a8a12[_0x29f6('0x2e')][_0x29f6('0x32')]?_0x3a8a12[_0x29f6('0x2e')]:_0x4b1524[_0x29f6('0x30')];if(_0x552257[_0x29f6('0x2b')][_0x29f6('0x3f')]){_0x3a8a12['include']=[{'all':!![]}];}_0x3a8a12=_['merge']({},_0x3a8a12,_0x552257[_0x29f6('0x3a')]);return db[_0x29f6('0x27')][_0x29f6('0x40')](_0x3a8a12)[_0x29f6('0x1d')](handleEntityNotFound(_0xbfe671,null))['then'](respondWithResult(_0xbfe671,null))[_0x29f6('0x41')](handleError(_0xbfe671,null));};exports[_0x29f6('0x42')]=function(_0x532df5,_0x21f023){return db[_0x29f6('0x27')][_0x29f6('0x42')](_0x532df5[_0x29f6('0x43')],{})[_0x29f6('0x1d')](function(_0x461208){var _0x320b5e=_0x532df5[_0x29f6('0x44')][_0x29f6('0x1f')]({'plain':!![]});if(!_0x320b5e)throw new Error(_0x29f6('0x45'));if(_0x320b5e[_0x29f6('0x46')]===_0x29f6('0x44')){var _0x58ea69=_0x461208[_0x29f6('0x1f')]({'plain':!![]});var _0x463551=_0x29f6('0x20');return db[_0x29f6('0x47')][_0x29f6('0x40')]({'where':{'name':_0x463551,'userProfileId':_0x320b5e['userProfileId']},'raw':!![]})[_0x29f6('0x1d')](function(_0x52be22){if(_0x52be22&&_0x52be22['autoAssociation']===0x0){return db[_0x29f6('0x21')][_0x29f6('0x42')]({'name':_0x58ea69[_0x29f6('0x23')],'resourceId':_0x58ea69['id'],'type':_0x52be22[_0x29f6('0x23')],'sectionId':_0x52be22['id']},{})[_0x29f6('0x1d')](function(){return _0x461208;});}else{return _0x461208;}})['catch'](function(_0x167976){logger[_0x29f6('0x22')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x167976);throw _0x167976;});}return _0x461208;})[_0x29f6('0x1d')](respondWithResult(_0x21f023,0xc9))['catch'](handleError(_0x21f023,null));};exports[_0x29f6('0x48')]=function(_0x241fb0,_0x27601d){var _0x292567={'where':{'id':_0x241fb0[_0x29f6('0x3e')]['id']}},_0x5c9113={};_0x5c9113[_0x29f6('0x30')]=_[_0x29f6('0x2c')](db[_0x29f6('0x27')][_0x29f6('0x28')]);_0x292567[_0x29f6('0x2e')]=_[_0x29f6('0x2f')](_0x5c9113['model'],qs[_0x29f6('0x31')](_0x241fb0[_0x29f6('0x2b')][_0x29f6('0x31')]));_0x292567[_0x29f6('0x2e')]=_0x292567[_0x29f6('0x2e')][_0x29f6('0x32')]?_0x292567[_0x29f6('0x2e')]:_0x5c9113[_0x29f6('0x30')];if(_0x241fb0[_0x29f6('0x2b')][_0x29f6('0x3f')]){_0x292567['include']=[{'all':!![]}];}_0x292567=_['merge']({},_0x292567,_0x241fb0[_0x29f6('0x3a')]);return db[_0x29f6('0x27')][_0x29f6('0x40')](_0x292567)['then'](handleEntityNotFound(_0x27601d,null))[_0x29f6('0x1d')](function(_0x48aa77){if(_0x48aa77){var _0x550190=_0x48aa77[_0x29f6('0x1f')]({'plain':!![]});_0x550190=qs[_0x29f6('0x49')](_0x550190,['id','createdAt','updatedAt']);_0x241fb0[_0x29f6('0x43')]=_[_0x29f6('0x49')](_0x241fb0[_0x29f6('0x43')],['id','createdAt',_0x29f6('0x4a')]);return db[_0x29f6('0x27')][_0x29f6('0x42')](_[_0x29f6('0x4b')](_0x550190,_0x241fb0[_0x29f6('0x43')]),{'include':_0x241fb0[_0x29f6('0x2b')][_0x29f6('0x3f')]?[{'all':!![]}]:undefined})[_0x29f6('0x1d')](function(_0x2fb6f8){var _0x192525=_0x241fb0[_0x29f6('0x44')][_0x29f6('0x1f')]({'plain':!![]});if(!_0x192525)throw new Error(_0x29f6('0x45'));if(_0x192525['role']==='user'){var _0x2bd7d9=_0x2fb6f8['get']({'plain':!![]});var _0x1a5220=_0x29f6('0x20');return db[_0x29f6('0x47')][_0x29f6('0x40')]({'where':{'name':_0x1a5220,'userProfileId':_0x192525[_0x29f6('0x4c')]},'raw':!![]})['then'](function(_0x56c442){if(_0x56c442&&_0x56c442[_0x29f6('0x4d')]===0x0){return db[_0x29f6('0x21')][_0x29f6('0x42')]({'name':_0x2bd7d9[_0x29f6('0x23')],'resourceId':_0x2bd7d9['id'],'type':_0x56c442['name'],'sectionId':_0x56c442['id']},{})[_0x29f6('0x1d')](function(){return _0x2fb6f8;});}else{return _0x2fb6f8;}})['catch'](function(_0x51b9dc){logger[_0x29f6('0x22')](_0x29f6('0x4e'),_0x51b9dc);throw _0x51b9dc;});}return _0x2fb6f8;});}})['then'](respondWithResult(_0x27601d,0xc9))[_0x29f6('0x41')](handleError(_0x27601d,null));};exports[_0x29f6('0x4f')]=function(_0x58bdf4,_0x44b3ee){if(_0x58bdf4[_0x29f6('0x43')]['id']){delete _0x58bdf4[_0x29f6('0x43')]['id'];}return db[_0x29f6('0x27')][_0x29f6('0x40')]({'where':{'id':_0x58bdf4[_0x29f6('0x3e')]['id']}})[_0x29f6('0x1d')](handleEntityNotFound(_0x44b3ee,null))['then'](saveUpdates(_0x58bdf4[_0x29f6('0x43')],null))['then'](respondWithResult(_0x44b3ee,null))[_0x29f6('0x41')](handleError(_0x44b3ee,null));};exports['destroy']=function(_0x4cbd5e,_0x1a3357){return db[_0x29f6('0x27')][_0x29f6('0x40')]({'where':{'id':_0x4cbd5e['params']['id']}})[_0x29f6('0x1d')](handleEntityNotFound(_0x1a3357,null))[_0x29f6('0x1d')](removeEntity(_0x1a3357,null))[_0x29f6('0x41')](handleError(_0x1a3357,null));};exports['getHoppers']=function(_0x728094,_0x35623a,_0x66a7bb){var _0xc50331={'raw':!![],'where':{}};var _0x1f9a9d={};var _0x15cf8e={'count':0x0,'rows':[]};return db[_0x29f6('0x27')][_0x29f6('0x50')]({'where':{'id':_0x728094['params']['id']}})[_0x29f6('0x1d')](handleEntityNotFound(_0x35623a,null))[_0x29f6('0x1d')](function(_0x2e1de8){if(_0x2e1de8){_0x1f9a9d[_0x29f6('0x30')]=_[_0x29f6('0x2c')](db[_0x29f6('0x51')][_0x29f6('0x28')]);_0x1f9a9d[_0x29f6('0x2b')]=_['keys'](_0x728094[_0x29f6('0x2b')]);_0x1f9a9d[_0x29f6('0x2d')]=_['intersection'](_0x1f9a9d[_0x29f6('0x30')],_0x1f9a9d['query']);_0xc50331[_0x29f6('0x2e')]=_[_0x29f6('0x2f')](_0x1f9a9d['model'],qs[_0x29f6('0x31')](_0x728094[_0x29f6('0x2b')]['fields']));_0xc50331['attributes']=_0xc50331['attributes'][_0x29f6('0x32')]?_0xc50331[_0x29f6('0x2e')]:_0x1f9a9d[_0x29f6('0x30')];if(!_0x728094[_0x29f6('0x2b')][_0x29f6('0x33')](_0x29f6('0x52'))){_0xc50331[_0x29f6('0x34')]=qs['limit'](_0x728094[_0x29f6('0x2b')][_0x29f6('0x34')]);_0xc50331[_0x29f6('0x18')]=qs[_0x29f6('0x18')](_0x728094['query'][_0x29f6('0x18')]);}_0xc50331[_0x29f6('0x35')]=qs[_0x29f6('0x36')](_0x728094[_0x29f6('0x2b')][_0x29f6('0x36')]);_0xc50331['where']=qs[_0x29f6('0x2d')](_[_0x29f6('0x38')](_0x728094[_0x29f6('0x2b')],_0x1f9a9d[_0x29f6('0x2d')]));_0xc50331[_0x29f6('0x37')][_0x29f6('0x53')]=_0x2e1de8['id'];if(_0x728094['query'][_0x29f6('0x39')]){_0xc50331['where']=_['merge'](_0xc50331['where'],{'$or':_[_0x29f6('0x26')](_0xc50331['attributes'],function(_0x425da2){var _0x3e901e={};_0x3e901e[_0x425da2]={'$like':'%'+_0x728094[_0x29f6('0x2b')][_0x29f6('0x39')]+'%'};return _0x3e901e;})});}_0xc50331=_[_0x29f6('0x4b')]({},_0xc50331,_0x728094[_0x29f6('0x3a')]);return db[_0x29f6('0x51')]['count']({'where':_0xc50331[_0x29f6('0x37')]})['then'](function(_0xf3a7d0){_0x15cf8e[_0x29f6('0x17')]=_0xf3a7d0;if(_0x728094[_0x29f6('0x2b')][_0x29f6('0x3f')]){_0xc50331[_0x29f6('0x3b')]=[{'all':!![]}];}return db[_0x29f6('0x51')][_0x29f6('0x3c')](_0xc50331);})[_0x29f6('0x1d')](function(_0x18a470){_0x15cf8e[_0x29f6('0x54')]=_0x18a470;return _0x15cf8e;});}})[_0x29f6('0x1d')](respondWithFilteredResult(_0x35623a,_0xc50331))[_0x29f6('0x41')](handleError(_0x35623a,null));};exports['getHopperHistories']=function(_0x4eb7c9,_0x4c152d,_0xa31c7d){var _0xf845f2={'raw':!![],'where':{}};var _0x4d0383={};var _0xf18d73={'count':0x0,'rows':[]};return db['Campaign'][_0x29f6('0x50')]({'where':{'id':_0x4eb7c9[_0x29f6('0x3e')]['id']}})[_0x29f6('0x1d')](handleEntityNotFound(_0x4c152d,null))[_0x29f6('0x1d')](function(_0x45b42c){if(_0x45b42c){_0x4d0383[_0x29f6('0x30')]=_[_0x29f6('0x2c')](db[_0x29f6('0x55')][_0x29f6('0x28')]);_0x4d0383[_0x29f6('0x2b')]=_['keys'](_0x4eb7c9[_0x29f6('0x2b')]);_0x4d0383['filters']=_[_0x29f6('0x2f')](_0x4d0383[_0x29f6('0x30')],_0x4d0383[_0x29f6('0x2b')]);_0xf845f2[_0x29f6('0x2e')]=_[_0x29f6('0x2f')](_0x4d0383[_0x29f6('0x30')],qs[_0x29f6('0x31')](_0x4eb7c9[_0x29f6('0x2b')]['fields']));_0xf845f2[_0x29f6('0x2e')]=_0xf845f2[_0x29f6('0x2e')]['length']?_0xf845f2['attributes']:_0x4d0383[_0x29f6('0x30')];if(!_0x4eb7c9[_0x29f6('0x2b')][_0x29f6('0x33')](_0x29f6('0x52'))){_0xf845f2[_0x29f6('0x34')]=qs[_0x29f6('0x34')](_0x4eb7c9[_0x29f6('0x2b')][_0x29f6('0x34')]);_0xf845f2[_0x29f6('0x18')]=qs[_0x29f6('0x18')](_0x4eb7c9[_0x29f6('0x2b')][_0x29f6('0x18')]);}_0xf845f2['order']=qs['sort'](_0x4eb7c9[_0x29f6('0x2b')][_0x29f6('0x36')]);_0xf845f2['where']=qs[_0x29f6('0x2d')](_[_0x29f6('0x38')](_0x4eb7c9[_0x29f6('0x2b')],_0x4d0383[_0x29f6('0x2d')]));_0xf845f2[_0x29f6('0x37')][_0x29f6('0x53')]=_0x45b42c['id'];if(_0x4eb7c9[_0x29f6('0x2b')]['filter']){_0xf845f2[_0x29f6('0x37')]=_[_0x29f6('0x4b')](_0xf845f2[_0x29f6('0x37')],{'$or':_['map'](_0xf845f2[_0x29f6('0x2e')],function(_0x39373c){var _0x5f3ed9={};_0x5f3ed9[_0x39373c]={'$like':'%'+_0x4eb7c9[_0x29f6('0x2b')][_0x29f6('0x39')]+'%'};return _0x5f3ed9;})});}_0xf845f2=_['merge']({},_0xf845f2,_0x4eb7c9[_0x29f6('0x3a')]);return db['CmHopperHistory'][_0x29f6('0x17')]({'where':_0xf845f2[_0x29f6('0x37')]})[_0x29f6('0x1d')](function(_0x3a7064){_0xf18d73[_0x29f6('0x17')]=_0x3a7064;if(_0x4eb7c9[_0x29f6('0x2b')]['includeAll']){_0xf845f2['include']=[{'all':!![]}];}return db[_0x29f6('0x55')][_0x29f6('0x3c')](_0xf845f2);})['then'](function(_0x3025df){_0xf18d73['rows']=_0x3025df;return _0xf18d73;});}})[_0x29f6('0x1d')](respondWithFilteredResult(_0x4c152d,_0xf845f2))[_0x29f6('0x41')](handleError(_0x4c152d,null));};exports[_0x29f6('0x56')]=function(_0x32981f,_0x13d7b7,_0x2a7b8a){var _0x3454f8={'raw':!![],'where':{}};var _0x5b7929={};var _0x3b94de={'count':0x0,'rows':[]};return db[_0x29f6('0x27')][_0x29f6('0x50')]({'where':{'id':_0x32981f['params']['id']}})['then'](handleEntityNotFound(_0x13d7b7,null))['then'](function(_0x526a1a){if(_0x526a1a){_0x5b7929[_0x29f6('0x30')]=_['keys'](db['CmHopperFinal']['rawAttributes']);_0x5b7929[_0x29f6('0x2b')]=_[_0x29f6('0x2c')](_0x32981f[_0x29f6('0x2b')]);_0x5b7929[_0x29f6('0x2d')]=_[_0x29f6('0x2f')](_0x5b7929['model'],_0x5b7929[_0x29f6('0x2b')]);_0x3454f8['attributes']=_[_0x29f6('0x2f')](_0x5b7929[_0x29f6('0x30')],qs[_0x29f6('0x31')](_0x32981f[_0x29f6('0x2b')]['fields']));_0x3454f8['attributes']=_0x3454f8[_0x29f6('0x2e')][_0x29f6('0x32')]?_0x3454f8[_0x29f6('0x2e')]:_0x5b7929['model'];if(!_0x32981f[_0x29f6('0x2b')][_0x29f6('0x33')]('nolimit')){_0x3454f8[_0x29f6('0x34')]=qs[_0x29f6('0x34')](_0x32981f[_0x29f6('0x2b')][_0x29f6('0x34')]);_0x3454f8[_0x29f6('0x18')]=qs[_0x29f6('0x18')](_0x32981f[_0x29f6('0x2b')][_0x29f6('0x18')]);}_0x3454f8[_0x29f6('0x35')]=qs[_0x29f6('0x36')](_0x32981f['query'][_0x29f6('0x36')]);_0x3454f8['where']=qs['filters'](_['pick'](_0x32981f[_0x29f6('0x2b')],_0x5b7929[_0x29f6('0x2d')]));_0x3454f8['where']['CampaignId']=_0x526a1a['id'];if(_0x32981f[_0x29f6('0x2b')][_0x29f6('0x39')]){_0x3454f8['where']=_['merge'](_0x3454f8['where'],{'$or':_['map'](_0x3454f8[_0x29f6('0x2e')],function(_0x5a8422){var _0x19e1bd={};_0x19e1bd[_0x5a8422]={'$like':'%'+_0x32981f[_0x29f6('0x2b')]['filter']+'%'};return _0x19e1bd;})});}_0x3454f8=_[_0x29f6('0x4b')]({},_0x3454f8,_0x32981f[_0x29f6('0x3a')]);return db['CmHopperFinal'][_0x29f6('0x17')]({'where':_0x3454f8[_0x29f6('0x37')]})[_0x29f6('0x1d')](function(_0x31dbe8){_0x3b94de[_0x29f6('0x17')]=_0x31dbe8;if(_0x32981f[_0x29f6('0x2b')][_0x29f6('0x3f')]){_0x3454f8[_0x29f6('0x3b')]=[{'all':!![]}];}return db[_0x29f6('0x57')][_0x29f6('0x3c')](_0x3454f8);})[_0x29f6('0x1d')](function(_0x111a15){_0x3b94de[_0x29f6('0x54')]=_0x111a15;return _0x3b94de;});}})[_0x29f6('0x1d')](respondWithFilteredResult(_0x13d7b7,_0x3454f8))['catch'](handleError(_0x13d7b7,null));};exports[_0x29f6('0x58')]=function(_0x252bab,_0xa3981d,_0x264617){var _0x43bf20={'raw':!![],'where':{}};var _0x3569f7={};var _0xa13f66={'count':0x0,'rows':[]};return db['Campaign'][_0x29f6('0x50')]({'where':{'id':_0x252bab['params']['id']}})[_0x29f6('0x1d')](handleEntityNotFound(_0xa3981d,null))[_0x29f6('0x1d')](function(_0x3f9f31){if(_0x3f9f31){_0x3569f7[_0x29f6('0x30')]=_[_0x29f6('0x2c')](db[_0x29f6('0x59')][_0x29f6('0x28')]);_0x3569f7[_0x29f6('0x2b')]=_[_0x29f6('0x2c')](_0x252bab['query']);_0x3569f7[_0x29f6('0x2d')]=_[_0x29f6('0x2f')](_0x3569f7['model'],_0x3569f7['query']);_0x43bf20[_0x29f6('0x2e')]=_[_0x29f6('0x2f')](_0x3569f7[_0x29f6('0x30')],qs[_0x29f6('0x31')](_0x252bab['query'][_0x29f6('0x31')]));_0x43bf20[_0x29f6('0x2e')]=_0x43bf20['attributes'][_0x29f6('0x32')]?_0x43bf20[_0x29f6('0x2e')]:_0x3569f7[_0x29f6('0x30')];if(!_0x252bab[_0x29f6('0x2b')][_0x29f6('0x33')](_0x29f6('0x52'))){_0x43bf20[_0x29f6('0x34')]=qs[_0x29f6('0x34')](_0x252bab[_0x29f6('0x2b')][_0x29f6('0x34')]);_0x43bf20[_0x29f6('0x18')]=qs[_0x29f6('0x18')](_0x252bab[_0x29f6('0x2b')]['offset']);}_0x43bf20[_0x29f6('0x35')]=qs[_0x29f6('0x36')](_0x252bab[_0x29f6('0x2b')][_0x29f6('0x36')]);_0x43bf20['where']=qs[_0x29f6('0x2d')](_[_0x29f6('0x38')](_0x252bab[_0x29f6('0x2b')],_0x3569f7['filters']));_0x43bf20[_0x29f6('0x37')][_0x29f6('0x53')]=_0x3f9f31['id'];if(_0x252bab['query'][_0x29f6('0x39')]){_0x43bf20[_0x29f6('0x37')]=_[_0x29f6('0x4b')](_0x43bf20[_0x29f6('0x37')],{'$or':_[_0x29f6('0x26')](_0x43bf20[_0x29f6('0x2e')],function(_0x6c90c3){var _0x1bf0e8={};_0x1bf0e8[_0x6c90c3]={'$like':'%'+_0x252bab[_0x29f6('0x2b')][_0x29f6('0x39')]+'%'};return _0x1bf0e8;})});}_0x43bf20=_[_0x29f6('0x4b')]({},_0x43bf20,_0x252bab['options']);return db['CmHopperBlack'][_0x29f6('0x17')]({'where':_0x43bf20[_0x29f6('0x37')]})[_0x29f6('0x1d')](function(_0x1f0e72){_0xa13f66[_0x29f6('0x17')]=_0x1f0e72;if(_0x252bab[_0x29f6('0x2b')][_0x29f6('0x3f')]){_0x43bf20[_0x29f6('0x3b')]=[{'all':!![]}];}return db['CmHopperBlack']['findAll'](_0x43bf20);})['then'](function(_0x1fd477){_0xa13f66[_0x29f6('0x54')]=_0x1fd477;return _0xa13f66;});}})[_0x29f6('0x1d')](respondWithFilteredResult(_0xa3981d,_0x43bf20))[_0x29f6('0x41')](handleError(_0xa3981d,null));};exports['getLists']=function(_0x414539,_0x4a0651,_0x4f2471){var _0x1ef540={};var _0x5a51c0={};var _0xe7b88c;var _0x2a2e0e;return db[_0x29f6('0x27')][_0x29f6('0x50')]({'where':{'id':_0x414539['params']['id']}})[_0x29f6('0x1d')](handleEntityNotFound(_0x4a0651,null))['then'](function(_0x47785a){if(_0x47785a){_0xe7b88c=_0x47785a;_0x5a51c0[_0x29f6('0x30')]=_[_0x29f6('0x2c')](db[_0x29f6('0x5a')][_0x29f6('0x28')]);_0x5a51c0[_0x29f6('0x2b')]=_['keys'](_0x414539['query']);_0x5a51c0[_0x29f6('0x2d')]=_['intersection'](_0x5a51c0['model'],_0x5a51c0[_0x29f6('0x2b')]);_0x1ef540['attributes']=_[_0x29f6('0x2f')](_0x5a51c0[_0x29f6('0x30')],qs[_0x29f6('0x31')](_0x414539[_0x29f6('0x2b')][_0x29f6('0x31')]));_0x1ef540[_0x29f6('0x2e')]=_0x1ef540['attributes'][_0x29f6('0x32')]?_0x1ef540[_0x29f6('0x2e')]:_0x5a51c0[_0x29f6('0x30')];_0x1ef540[_0x29f6('0x35')]=qs[_0x29f6('0x36')](_0x414539[_0x29f6('0x2b')][_0x29f6('0x36')]);_0x1ef540[_0x29f6('0x37')]=qs[_0x29f6('0x2d')](_[_0x29f6('0x38')](_0x414539[_0x29f6('0x2b')],_0x5a51c0['filters']));if(_0x414539[_0x29f6('0x2b')][_0x29f6('0x39')]){_0x1ef540['where']=_[_0x29f6('0x4b')](_0x1ef540[_0x29f6('0x37')],{'$or':_[_0x29f6('0x26')](_0x1ef540['attributes'],function(_0x5f1781){var _0x1413a5={};_0x1413a5[_0x5f1781]={'$like':'%'+_0x414539[_0x29f6('0x2b')][_0x29f6('0x39')]+'%'};return _0x1413a5;})});}_0x1ef540=_[_0x29f6('0x4b')]({},_0x1ef540,_0x414539[_0x29f6('0x3a')]);return _0xe7b88c[_0x29f6('0x5b')](_0x1ef540);}})['then'](function(_0x34da57){if(_0x34da57){_0x2a2e0e=_0x34da57[_0x29f6('0x32')];if(!_0x414539['query']['hasOwnProperty']('nolimit')){_0x1ef540[_0x29f6('0x34')]=qs['limit'](_0x414539[_0x29f6('0x2b')]['limit']);_0x1ef540[_0x29f6('0x18')]=qs[_0x29f6('0x18')](_0x414539[_0x29f6('0x2b')][_0x29f6('0x18')]);}return _0xe7b88c[_0x29f6('0x5b')](_0x1ef540);}})['then'](function(_0x371ea9){if(_0x371ea9){return _0x371ea9?{'count':_0x2a2e0e,'rows':_0x371ea9}:null;}})['then'](respondWithResult(_0x4a0651,null))[_0x29f6('0x41')](handleError(_0x4a0651,null));};exports[_0x29f6('0x5c')]=function(_0x46147d,_0x19d1cb,_0x478660){var _0x2e00ed,_0x3a9cc2;return db[_0x29f6('0x27')]['find']({'where':{'id':_0x46147d[_0x29f6('0x3e')]['id']}})['then'](handleEntityNotFound(_0x19d1cb,null))[_0x29f6('0x1d')](function(_0x2775d0){if(_0x2775d0){_0x3a9cc2=_0x2775d0;return _0x2775d0['addLists'](_0x46147d[_0x29f6('0x43')]['ids'],_[_0x29f6('0x49')](_0x46147d[_0x29f6('0x43')],['ids','id'])||{});}return null;})[_0x29f6('0x5d')](function(_0x205304){var _0x4ef377;_0x2e00ed=_0x205304||[];var _0x3d6aaf=[];if(_0x205304){for(var _0x22a012=0x0;_0x22a012<_0x205304[_0x29f6('0x32')];_0x22a012+=0x1){var _0x39b911=_0x205304[_0x22a012][_0x29f6('0x1f')]({'plain':!![]});_0x3a9cc2[_0x29f6('0x5e')]=_0x46147d[_0x29f6('0x43')][_0x29f6('0x5e')]?_0x46147d['body'][_0x29f6('0x5e')]:_0x3a9cc2[_0x29f6('0x5e')];switch(_0x3a9cc2[_0x29f6('0x5e')]){case _0x29f6('0x5f'):_0x4ef377=squel['insert']()[_0x29f6('0x60')](_0x29f6('0x61'))[_0x29f6('0x62')]([_0x29f6('0x63'),_0x29f6('0x64'),'ContactId','ListId',_0x29f6('0x53'),_0x29f6('0x65'),'updatedAt'],squel[_0x29f6('0x66')]()['field']('phone',_0x29f6('0x63'))['field'](_0x29f6('0x67'),_0x29f6('0x64'))[_0x29f6('0x68')]('id',_0x29f6('0x69'))['field'](_0x39b911[_0x29f6('0x6a')][_0x29f6('0x6b')](),_0x29f6('0x6c'))[_0x29f6('0x68')](_0x46147d[_0x29f6('0x3e')]['id'][_0x29f6('0x6b')](),'CampaignId')['field'](_0x29f6('0x67'),_0x29f6('0x65'))[_0x29f6('0x68')](_0x29f6('0x67'),_0x29f6('0x4a'))[_0x29f6('0x6d')](_0x29f6('0x6e'))[_0x29f6('0x37')](_0x29f6('0x6f'))[_0x29f6('0x37')](_0x29f6('0x70'),_0x39b911[_0x29f6('0x6a')][_0x29f6('0x6b')]())[_0x29f6('0x37')](_0x29f6('0x71'))['where'](_0x29f6('0x72'),squel[_0x29f6('0x66')]()[_0x29f6('0x68')](_0x29f6('0x73'))[_0x29f6('0x6d')]('cm_hopper_final')[_0x29f6('0x37')](_0x29f6('0x74'),_0x46147d[_0x29f6('0x3e')]['id']['toString']()))[_0x29f6('0x37')](_0x29f6('0x72'),squel[_0x29f6('0x66')]()[_0x29f6('0x68')]('COALESCE(phone,\x27\x27)')[_0x29f6('0x6d')]('cm_hopper')[_0x29f6('0x37')]('CampaignId\x20=\x20?',_0x46147d[_0x29f6('0x3e')]['id'][_0x29f6('0x6b')]())))[_0x29f6('0x6b')]();break;case _0x29f6('0x75'):_0x4ef377=squel['insert']()[_0x29f6('0x60')](_0x29f6('0x61'))[_0x29f6('0x62')]([_0x29f6('0x63'),_0x29f6('0x64'),_0x29f6('0x69'),_0x29f6('0x6c'),_0x29f6('0x53'),_0x29f6('0x65'),_0x29f6('0x4a')],squel[_0x29f6('0x66')]()[_0x29f6('0x68')]('phone',_0x29f6('0x63'))[_0x29f6('0x68')](_0x29f6('0x67'),_0x29f6('0x64'))[_0x29f6('0x68')]('id',_0x29f6('0x69'))[_0x29f6('0x68')](_0x39b911[_0x29f6('0x6a')]['toString'](),_0x29f6('0x6c'))['field'](_0x46147d['params']['id'][_0x29f6('0x6b')](),'CampaignId')[_0x29f6('0x68')](_0x29f6('0x67'),'createdAt')[_0x29f6('0x68')](_0x29f6('0x67'),_0x29f6('0x4a'))[_0x29f6('0x6d')](_0x29f6('0x6e'))[_0x29f6('0x37')](_0x29f6('0x6f'))['where'](_0x29f6('0x70'),_0x39b911[_0x29f6('0x6a')][_0x29f6('0x6b')]())[_0x29f6('0x37')](_0x29f6('0x71'))[_0x29f6('0x37')]('phone\x20NOT\x20IN\x20(?)',squel[_0x29f6('0x66')]()[_0x29f6('0x68')]('COALESCE(phone,\x27\x27)')[_0x29f6('0x6d')](_0x29f6('0x61'))['where'](_0x29f6('0x74'),_0x46147d[_0x29f6('0x3e')]['id']['toString']())))[_0x29f6('0x6b')]();break;default:_0x4ef377=squel['insert']()['into'](_0x29f6('0x61'))[_0x29f6('0x62')]([_0x29f6('0x63'),_0x29f6('0x64'),'ContactId','ListId',_0x29f6('0x53'),_0x29f6('0x65'),_0x29f6('0x4a')],squel[_0x29f6('0x66')]()[_0x29f6('0x68')](_0x29f6('0x63'),_0x29f6('0x63'))[_0x29f6('0x68')](_0x29f6('0x67'),_0x29f6('0x64'))[_0x29f6('0x68')]('id',_0x29f6('0x69'))[_0x29f6('0x68')](_0x39b911['CmListId']['toString'](),_0x29f6('0x6c'))[_0x29f6('0x68')](_0x46147d['params']['id'][_0x29f6('0x6b')](),_0x29f6('0x53'))['field']('NOW()','createdAt')[_0x29f6('0x68')](_0x29f6('0x67'),_0x29f6('0x4a'))[_0x29f6('0x6d')]('cm_contacts')[_0x29f6('0x37')](_0x29f6('0x6f'))[_0x29f6('0x37')](_0x29f6('0x70'),_0x39b911[_0x29f6('0x6a')][_0x29f6('0x6b')]())[_0x29f6('0x37')](_0x29f6('0x71')))[_0x29f6('0x6b')]();}_0x3d6aaf['push'](db[_0x29f6('0x76')][_0x29f6('0x2b')](_0x4ef377));}return BPromise[_0x29f6('0x77')](_0x3d6aaf);}})[_0x29f6('0x1d')](function(){return _0x2e00ed;})['then'](respondWithResult(_0x19d1cb,null))['catch'](handleError(_0x19d1cb,null));};exports[_0x29f6('0x78')]=function(_0x41446f,_0x21f16b,_0x43c37b){return db[_0x29f6('0x27')]['find']({'where':{'id':_0x41446f[_0x29f6('0x3e')]['id']}})[_0x29f6('0x1d')](handleEntityNotFound(_0x21f16b,null))[_0x29f6('0x1d')](function(_0x6bda6e){if(_0x6bda6e){return _0x6bda6e[_0x29f6('0x78')](_0x41446f[_0x29f6('0x2b')][_0x29f6('0x79')]);}})['then'](function(_0x8e9851){if(_0x8e9851){return db[_0x29f6('0x51')][_0x29f6('0x1e')]({'where':{'ListId':_0x41446f[_0x29f6('0x2b')]['ids'],'CampaignId':_0x41446f[_0x29f6('0x3e')]['id']}})[_0x29f6('0x1d')](function(){return _0x8e9851;});}})[_0x29f6('0x1d')](respondWithStatusCode(_0x21f16b,null))[_0x29f6('0x41')](handleError(_0x21f16b,null));};exports['getBlackLists']=function(_0x226c3b,_0x12d246,_0x441903){var _0x5506e8={'raw':!![],'where':{}};var _0x1d74d3={};var _0x318fd1={'count':0x0,'rows':[]};return db[_0x29f6('0x27')][_0x29f6('0x50')]({'where':{'id':_0x226c3b['params']['id']}})[_0x29f6('0x1d')](handleEntityNotFound(_0x12d246,null))[_0x29f6('0x1d')](function(_0x488d3c){if(_0x488d3c){_0x1d74d3['model']=_['keys'](db[_0x29f6('0x5a')][_0x29f6('0x28')]);_0x1d74d3['query']=_[_0x29f6('0x2c')](_0x226c3b[_0x29f6('0x2b')]);_0x1d74d3[_0x29f6('0x2d')]=_[_0x29f6('0x2f')](_0x1d74d3[_0x29f6('0x30')],_0x1d74d3['query']);_0x5506e8[_0x29f6('0x2e')]=_[_0x29f6('0x2f')](_0x1d74d3[_0x29f6('0x30')],qs[_0x29f6('0x31')](_0x226c3b[_0x29f6('0x2b')][_0x29f6('0x31')]));_0x5506e8[_0x29f6('0x2e')]=_0x5506e8[_0x29f6('0x2e')][_0x29f6('0x32')]?_0x5506e8[_0x29f6('0x2e')]:_0x1d74d3['model'];if(!_0x226c3b[_0x29f6('0x2b')][_0x29f6('0x33')]('nolimit')){_0x5506e8[_0x29f6('0x34')]=qs[_0x29f6('0x34')](_0x226c3b[_0x29f6('0x2b')][_0x29f6('0x34')]);_0x5506e8[_0x29f6('0x18')]=qs['offset'](_0x226c3b[_0x29f6('0x2b')][_0x29f6('0x18')]);}_0x5506e8[_0x29f6('0x35')]=qs['sort'](_0x226c3b['query'][_0x29f6('0x36')]);_0x5506e8[_0x29f6('0x37')]=qs[_0x29f6('0x2d')](_[_0x29f6('0x38')](_0x226c3b[_0x29f6('0x2b')],_0x1d74d3[_0x29f6('0x2d')]));_0x5506e8['where']['CampaignId']=_0x488d3c['id'];if(_0x226c3b[_0x29f6('0x2b')][_0x29f6('0x39')]){_0x5506e8[_0x29f6('0x37')]=_[_0x29f6('0x4b')](_0x5506e8[_0x29f6('0x37')],{'$or':_[_0x29f6('0x26')](_0x5506e8['attributes'],function(_0x49feb1){var _0x12e47a={};_0x12e47a[_0x49feb1]={'$like':'%'+_0x226c3b[_0x29f6('0x2b')][_0x29f6('0x39')]+'%'};return _0x12e47a;})});}_0x5506e8=_['merge']({},_0x5506e8,_0x226c3b['options']);return db['CmList'][_0x29f6('0x17')]({'where':_0x5506e8['where']})[_0x29f6('0x1d')](function(_0x5acbea){_0x318fd1[_0x29f6('0x17')]=_0x5acbea;if(_0x226c3b[_0x29f6('0x2b')][_0x29f6('0x3f')]){_0x5506e8[_0x29f6('0x3b')]=[{'all':!![]}];}return db[_0x29f6('0x5a')][_0x29f6('0x3c')](_0x5506e8);})[_0x29f6('0x1d')](function(_0x5731b3){_0x318fd1[_0x29f6('0x54')]=_0x5731b3;return _0x318fd1;});}})[_0x29f6('0x1d')](respondWithFilteredResult(_0x12d246,_0x5506e8))['catch'](handleError(_0x12d246,null));};exports[_0x29f6('0x7a')]=function(_0x15c86e,_0x43acdc,_0x28cc75){var _0x4e055b,_0x4ce645;return db[_0x29f6('0x27')][_0x29f6('0x40')]({'where':{'id':_0x15c86e[_0x29f6('0x3e')]['id']}})[_0x29f6('0x1d')](handleEntityNotFound(_0x43acdc,null))[_0x29f6('0x1d')](function(_0x5e7690){if(_0x5e7690){_0x4ce645=_0x5e7690;return _0x5e7690['addBlackLists'](_0x15c86e[_0x29f6('0x43')][_0x29f6('0x79')],_['omit'](_0x15c86e['body'],['ids','id'])||{});}return null;})[_0x29f6('0x5d')](function(_0x260dd1){var _0x117187;_0x4e055b=_0x260dd1||[];var _0xf37dfa=[];if(_0x260dd1){for(var _0x2b1808=0x0;_0x2b1808<_0x260dd1['length'];_0x2b1808+=0x1){var _0x394d24=_0x260dd1[_0x2b1808][_0x29f6('0x1f')]({'plain':!![]});_0x117187=squel[_0x29f6('0x7b')]()[_0x29f6('0x60')](_0x29f6('0x7c'))['fromQuery']([_0x29f6('0x63'),_0x29f6('0x69'),_0x29f6('0x6c'),_0x29f6('0x53'),_0x29f6('0x65'),_0x29f6('0x4a')],squel[_0x29f6('0x66')]()[_0x29f6('0x68')]('phone',_0x29f6('0x63'))[_0x29f6('0x68')]('id','ContactId')[_0x29f6('0x68')](_0x394d24[_0x29f6('0x6a')][_0x29f6('0x6b')](),'ListId')['field'](_0x15c86e['params']['id']['toString'](),_0x29f6('0x53'))[_0x29f6('0x68')](_0x29f6('0x67'),_0x29f6('0x65'))[_0x29f6('0x68')](_0x29f6('0x67'),_0x29f6('0x4a'))[_0x29f6('0x6d')](_0x29f6('0x6e'))[_0x29f6('0x37')]('deletedAt\x20IS\x20NULL')[_0x29f6('0x37')]('ListId\x20=\x20?',_0x394d24[_0x29f6('0x6a')][_0x29f6('0x6b')]())[_0x29f6('0x37')](_0x29f6('0x71')))[_0x29f6('0x6b')]();_0xf37dfa[_0x29f6('0x7d')](db[_0x29f6('0x76')][_0x29f6('0x2b')](_0x117187));}return BPromise[_0x29f6('0x77')](_0xf37dfa);}})['then'](function(){return _0x4e055b;})['then'](respondWithResult(_0x43acdc,null))[_0x29f6('0x41')](handleError(_0x43acdc,null));};exports['removeBlackLists']=function(_0xe8d96c,_0x43db84,_0x39a4f5){return db[_0x29f6('0x27')][_0x29f6('0x40')]({'where':{'id':_0xe8d96c['params']['id']}})[_0x29f6('0x1d')](handleEntityNotFound(_0x43db84,null))[_0x29f6('0x1d')](function(_0x110d71){if(_0x110d71){return _0x110d71[_0x29f6('0x7e')](_0xe8d96c[_0x29f6('0x2b')][_0x29f6('0x79')]);}})[_0x29f6('0x1d')](function(_0x44e960){if(_0x44e960){return db[_0x29f6('0x59')][_0x29f6('0x1e')]({'where':{'ListId':_0xe8d96c[_0x29f6('0x2b')]['ids'],'CampaignId':_0xe8d96c[_0x29f6('0x3e')]['id']}})['then'](function(){return _0x44e960;});}})[_0x29f6('0x1d')](respondWithStatusCode(_0x43db84,null))[_0x29f6('0x41')](handleError(_0x43db84,null));}; \ No newline at end of file +var _0x91a7=['save','update','then','destroy','get','IvrCampaigns','UserProfileResource','end','error','name','send','index','map','rawAttributes','fieldName','type','key','model','query','filters','intersection','fields','attributes','length','nolimit','order','sort','where','pick','merge','VIRTUAL','filter','options','Campaign','count','include','rows','params','keys','includeAll','find','catch','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','clone','omit','createdAt','updatedAt','role','userProfileId','autoAssociation','getHoppers','findOne','hasOwnProperty','CampaignId','CmHopper','getHopperFinals','CmHopperFinal','findAll','CmHopperBlack','getLists','CmList','addLists','ids','spread','dialCheckDuplicateType','always','insert','into','cm_hopper','fromQuery','scheduledAt','ContactId','ListId','field','phone','NOW()','CmListId','from','cm_contacts','deletedAt\x20IS\x20NULL','ListId\x20=\x20?','toString','phone\x20NOT\x20IN\x20(?)','select','COALESCE(calleridnum,\x27\x27)','cm_hopper_final','CampaignId\x20=\x20?','COALESCE(phone,\x27\x27)','phone\x20IS\x20NOT\x20NULL','sequelize','all','removeLists','getBlackLists','addBlackLists','cm_hopper_black','push','removeBlackLists','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'];(function(_0x30bd66,_0x36a93d){var _0x74c9dd=function(_0x2cd660){while(--_0x2cd660){_0x30bd66['push'](_0x30bd66['shift']());}};_0x74c9dd(++_0x36a93d);}(_0x91a7,0xe7));var _0x791a=function(_0x3b47fa,_0x5c082f){_0x3b47fa=_0x3b47fa-0x0;var _0x5dcabd=_0x91a7[_0x3b47fa];return _0x5dcabd;};'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(){var _0x1091af=_0x25bae5[_0x791a('0x21')]({'plain':!![]});var _0x45a67d=_0x791a('0x22');return db[_0x791a('0x23')][_0x791a('0x20')]({'where':{'type':_0x45a67d,'resourceId':_0x1091af['id']}})['then'](function(){return _0x25bae5;});})[_0x791a('0x1f')](function(){_0x448085[_0x791a('0x17')](0xcc)[_0x791a('0x24')]();});}};}function handleEntityNotFound(_0x2966b8,_0x4d748a){return function(_0x456480){if(!_0x456480){_0x2966b8[_0x791a('0x16')](0x194);}return _0x456480;};}function handleError(_0x51dcca,_0xdfa84f){_0xdfa84f=_0xdfa84f||0x1f4;return function(_0x1785f5){logger[_0x791a('0x25')](_0x1785f5['stack']);if(_0x1785f5[_0x791a('0x26')]){delete _0x1785f5[_0x791a('0x26')];}_0x51dcca[_0x791a('0x17')](_0xdfa84f)[_0x791a('0x27')](_0x1785f5);};}exports[_0x791a('0x28')]=function(_0x1a9c6b,_0x628816){var _0x889534={},_0x58bbc0={},_0xbc3436={'count':0x0,'rows':[]};var _0x9e9332=_[_0x791a('0x29')](db['Campaign'][_0x791a('0x2a')],function(_0x5df656){return{'name':_0x5df656[_0x791a('0x2b')],'type':_0x5df656[_0x791a('0x2c')][_0x791a('0x2d')]};});_0x58bbc0[_0x791a('0x2e')]=_[_0x791a('0x29')](_0x9e9332,_0x791a('0x26'));_0x58bbc0[_0x791a('0x2f')]=_['keys'](_0x1a9c6b[_0x791a('0x2f')]);_0x58bbc0[_0x791a('0x30')]=_[_0x791a('0x31')](_0x58bbc0[_0x791a('0x2e')],_0x58bbc0[_0x791a('0x2f')]);_0x889534['attributes']=_[_0x791a('0x31')](_0x58bbc0[_0x791a('0x2e')],qs[_0x791a('0x32')](_0x1a9c6b[_0x791a('0x2f')][_0x791a('0x32')]));_0x889534['attributes']=_0x889534[_0x791a('0x33')][_0x791a('0x34')]?_0x889534[_0x791a('0x33')]:_0x58bbc0[_0x791a('0x2e')];if(!_0x1a9c6b[_0x791a('0x2f')]['hasOwnProperty'](_0x791a('0x35'))){_0x889534['limit']=qs[_0x791a('0x1a')](_0x1a9c6b['query']['limit']);_0x889534[_0x791a('0x19')]=qs[_0x791a('0x19')](_0x1a9c6b[_0x791a('0x2f')][_0x791a('0x19')]);}_0x889534[_0x791a('0x36')]=qs[_0x791a('0x37')](_0x1a9c6b[_0x791a('0x2f')]['sort']);_0x889534[_0x791a('0x38')]=qs['filters'](_[_0x791a('0x39')](_0x1a9c6b['query'],_0x58bbc0[_0x791a('0x30')]));if(_0x1a9c6b[_0x791a('0x2f')]['filter']){_0x889534[_0x791a('0x38')]=_[_0x791a('0x3a')](_0x889534['where'],{'$or':_[_0x791a('0x29')](_0x9e9332,function(_0x165e2b){if(_0x165e2b[_0x791a('0x2c')]!==_0x791a('0x3b')){var _0x29d267={};_0x29d267[_0x165e2b[_0x791a('0x26')]]={'$like':'%'+_0x1a9c6b[_0x791a('0x2f')][_0x791a('0x3c')]+'%'};return _0x29d267;}})});}_0x889534=_[_0x791a('0x3a')]({},_0x889534,_0x1a9c6b[_0x791a('0x3d')]);var _0x587481={'where':_0x889534[_0x791a('0x38')]};return db[_0x791a('0x3e')][_0x791a('0x3f')](_0x587481)['then'](function(_0xf4e2fa){_0xbc3436['count']=_0xf4e2fa;if(_0x1a9c6b['query']['includeAll']){_0x889534[_0x791a('0x40')]=[{'all':!![]}];}return db[_0x791a('0x3e')]['findAll'](_0x889534);})[_0x791a('0x1f')](function(_0x2d1692){_0xbc3436[_0x791a('0x41')]=_0x2d1692;return _0xbc3436;})[_0x791a('0x1f')](respondWithFilteredResult(_0x628816,_0x889534))['catch'](handleError(_0x628816,null));};exports['show']=function(_0x57b9ba,_0x2f0395){var _0x216dd3={'raw':![],'where':{'id':_0x57b9ba[_0x791a('0x42')]['id']}},_0x4e0191={};_0x4e0191[_0x791a('0x2e')]=_[_0x791a('0x43')](db[_0x791a('0x3e')]['rawAttributes']);_0x4e0191[_0x791a('0x2f')]=_['keys'](_0x57b9ba[_0x791a('0x2f')]);_0x4e0191[_0x791a('0x30')]=_[_0x791a('0x31')](_0x4e0191[_0x791a('0x2e')],_0x4e0191[_0x791a('0x2f')]);_0x216dd3['attributes']=_[_0x791a('0x31')](_0x4e0191[_0x791a('0x2e')],qs[_0x791a('0x32')](_0x57b9ba[_0x791a('0x2f')][_0x791a('0x32')]));_0x216dd3['attributes']=_0x216dd3[_0x791a('0x33')][_0x791a('0x34')]?_0x216dd3['attributes']:_0x4e0191['model'];if(_0x57b9ba[_0x791a('0x2f')][_0x791a('0x44')]){_0x216dd3[_0x791a('0x40')]=[{'all':!![]}];}_0x216dd3=_['merge']({},_0x216dd3,_0x57b9ba['options']);return db[_0x791a('0x3e')][_0x791a('0x45')](_0x216dd3)['then'](handleEntityNotFound(_0x2f0395,null))[_0x791a('0x1f')](respondWithResult(_0x2f0395,null))[_0x791a('0x46')](handleError(_0x2f0395,null));};exports[_0x791a('0x47')]=function(_0x549980,_0x5a30a6){return db[_0x791a('0x3e')][_0x791a('0x47')](_0x549980[_0x791a('0x48')],{})[_0x791a('0x1f')](function(_0x50e52f){var _0x2d7c7d=_0x549980[_0x791a('0x49')][_0x791a('0x21')]({'plain':!![]});if(!_0x2d7c7d)throw new Error(_0x791a('0x4a'));if(_0x2d7c7d['role']===_0x791a('0x49')){var _0x19654d=_0x50e52f[_0x791a('0x21')]({'plain':!![]});var _0x227199=_0x791a('0x22');return db[_0x791a('0x4b')][_0x791a('0x45')]({'where':{'name':_0x227199,'userProfileId':_0x2d7c7d['userProfileId']},'raw':!![]})[_0x791a('0x1f')](function(_0x1fd826){if(_0x1fd826&&_0x1fd826['autoAssociation']===0x0){return db[_0x791a('0x23')][_0x791a('0x47')]({'name':_0x19654d['name'],'resourceId':_0x19654d['id'],'type':_0x1fd826[_0x791a('0x26')],'sectionId':_0x1fd826['id']},{})[_0x791a('0x1f')](function(){return _0x50e52f;});}else{return _0x50e52f;}})[_0x791a('0x46')](function(_0x2e357c){logger[_0x791a('0x25')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x2e357c);throw _0x2e357c;});}return _0x50e52f;})['then'](respondWithResult(_0x5a30a6,0xc9))['catch'](handleError(_0x5a30a6,null));};exports[_0x791a('0x4c')]=function(_0x51b556,_0x4c7555){var _0x2f764a={'where':{'id':_0x51b556[_0x791a('0x42')]['id']}},_0x548a4b={};_0x548a4b[_0x791a('0x2e')]=_['keys'](db['Campaign'][_0x791a('0x2a')]);_0x2f764a['attributes']=_[_0x791a('0x31')](_0x548a4b[_0x791a('0x2e')],qs[_0x791a('0x32')](_0x51b556['query'][_0x791a('0x32')]));_0x2f764a[_0x791a('0x33')]=_0x2f764a['attributes'][_0x791a('0x34')]?_0x2f764a[_0x791a('0x33')]:_0x548a4b[_0x791a('0x2e')];if(_0x51b556[_0x791a('0x2f')][_0x791a('0x44')]){_0x2f764a[_0x791a('0x40')]=[{'all':!![]}];}_0x2f764a=_['merge']({},_0x2f764a,_0x51b556['options']);return db[_0x791a('0x3e')]['find'](_0x2f764a)[_0x791a('0x1f')](handleEntityNotFound(_0x4c7555,null))[_0x791a('0x1f')](function(_0x18ad89){if(_0x18ad89){var _0xf11dea=_0x18ad89[_0x791a('0x21')]({'plain':!![]});_0xf11dea=qs[_0x791a('0x4d')](_0xf11dea,['id',_0x791a('0x4e'),'updatedAt']);_0x51b556[_0x791a('0x48')]=_[_0x791a('0x4d')](_0x51b556[_0x791a('0x48')],['id',_0x791a('0x4e'),_0x791a('0x4f')]);return db[_0x791a('0x3e')][_0x791a('0x47')](_['merge'](_0xf11dea,_0x51b556[_0x791a('0x48')]),{'include':_0x51b556['query']['includeAll']?[{'all':!![]}]:undefined})[_0x791a('0x1f')](function(_0x3c81e2){var _0x216b69=_0x51b556[_0x791a('0x49')][_0x791a('0x21')]({'plain':!![]});if(!_0x216b69)throw new Error(_0x791a('0x4a'));if(_0x216b69[_0x791a('0x50')]===_0x791a('0x49')){var _0x2bfb66=_0x3c81e2[_0x791a('0x21')]({'plain':!![]});var _0x35acf7=_0x791a('0x22');return db[_0x791a('0x4b')][_0x791a('0x45')]({'where':{'name':_0x35acf7,'userProfileId':_0x216b69[_0x791a('0x51')]},'raw':!![]})[_0x791a('0x1f')](function(_0xb05c3){if(_0xb05c3&&_0xb05c3[_0x791a('0x52')]===0x0){return db[_0x791a('0x23')][_0x791a('0x47')]({'name':_0x2bfb66['name'],'resourceId':_0x2bfb66['id'],'type':_0xb05c3[_0x791a('0x26')],'sectionId':_0xb05c3['id']},{})[_0x791a('0x1f')](function(){return _0x3c81e2;});}else{return _0x3c81e2;}})[_0x791a('0x46')](function(_0xbeccad){logger[_0x791a('0x25')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0xbeccad);throw _0xbeccad;});}return _0x3c81e2;});}})[_0x791a('0x1f')](respondWithResult(_0x4c7555,0xc9))[_0x791a('0x46')](handleError(_0x4c7555,null));};exports[_0x791a('0x1e')]=function(_0x120122,_0x5468c4){if(_0x120122[_0x791a('0x48')]['id']){delete _0x120122['body']['id'];}return db['Campaign']['find']({'where':{'id':_0x120122['params']['id']}})[_0x791a('0x1f')](handleEntityNotFound(_0x5468c4,null))[_0x791a('0x1f')](saveUpdates(_0x120122[_0x791a('0x48')],null))[_0x791a('0x1f')](respondWithResult(_0x5468c4,null))[_0x791a('0x46')](handleError(_0x5468c4,null));};exports[_0x791a('0x20')]=function(_0x2385b7,_0x5dca78){return db['Campaign'][_0x791a('0x45')]({'where':{'id':_0x2385b7[_0x791a('0x42')]['id']}})['then'](handleEntityNotFound(_0x5dca78,null))['then'](removeEntity(_0x5dca78,null))[_0x791a('0x46')](handleError(_0x5dca78,null));};exports[_0x791a('0x53')]=function(_0x4c1c35,_0xde2e9a,_0x6995e){var _0x317ffa={'raw':!![],'where':{}};var _0x110131={};var _0x4845c2={'count':0x0,'rows':[]};return db['Campaign'][_0x791a('0x54')]({'where':{'id':_0x4c1c35[_0x791a('0x42')]['id']}})['then'](handleEntityNotFound(_0xde2e9a,null))[_0x791a('0x1f')](function(_0x13da2e){if(_0x13da2e){_0x110131[_0x791a('0x2e')]=_[_0x791a('0x43')](db['CmHopper'][_0x791a('0x2a')]);_0x110131[_0x791a('0x2f')]=_[_0x791a('0x43')](_0x4c1c35[_0x791a('0x2f')]);_0x110131[_0x791a('0x30')]=_[_0x791a('0x31')](_0x110131[_0x791a('0x2e')],_0x110131[_0x791a('0x2f')]);_0x317ffa['attributes']=_['intersection'](_0x110131['model'],qs[_0x791a('0x32')](_0x4c1c35[_0x791a('0x2f')][_0x791a('0x32')]));_0x317ffa[_0x791a('0x33')]=_0x317ffa[_0x791a('0x33')][_0x791a('0x34')]?_0x317ffa[_0x791a('0x33')]:_0x110131[_0x791a('0x2e')];if(!_0x4c1c35[_0x791a('0x2f')][_0x791a('0x55')]('nolimit')){_0x317ffa[_0x791a('0x1a')]=qs[_0x791a('0x1a')](_0x4c1c35['query'][_0x791a('0x1a')]);_0x317ffa[_0x791a('0x19')]=qs['offset'](_0x4c1c35['query'][_0x791a('0x19')]);}_0x317ffa[_0x791a('0x36')]=qs['sort'](_0x4c1c35['query'][_0x791a('0x37')]);_0x317ffa[_0x791a('0x38')]=qs[_0x791a('0x30')](_['pick'](_0x4c1c35[_0x791a('0x2f')],_0x110131['filters']));_0x317ffa[_0x791a('0x38')][_0x791a('0x56')]=_0x13da2e['id'];if(_0x4c1c35[_0x791a('0x2f')][_0x791a('0x3c')]){_0x317ffa[_0x791a('0x38')]=_[_0x791a('0x3a')](_0x317ffa['where'],{'$or':_[_0x791a('0x29')](_0x317ffa[_0x791a('0x33')],function(_0x41d1a5){var _0x291e8a={};_0x291e8a[_0x41d1a5]={'$like':'%'+_0x4c1c35[_0x791a('0x2f')][_0x791a('0x3c')]+'%'};return _0x291e8a;})});}_0x317ffa=_[_0x791a('0x3a')]({},_0x317ffa,_0x4c1c35[_0x791a('0x3d')]);return db[_0x791a('0x57')][_0x791a('0x3f')]({'where':_0x317ffa[_0x791a('0x38')]})[_0x791a('0x1f')](function(_0x3dc34b){_0x4845c2[_0x791a('0x3f')]=_0x3dc34b;if(_0x4c1c35[_0x791a('0x2f')][_0x791a('0x44')]){_0x317ffa[_0x791a('0x40')]=[{'all':!![]}];}return db[_0x791a('0x57')]['findAll'](_0x317ffa);})[_0x791a('0x1f')](function(_0xbd35f8){_0x4845c2[_0x791a('0x41')]=_0xbd35f8;return _0x4845c2;});}})[_0x791a('0x1f')](respondWithFilteredResult(_0xde2e9a,_0x317ffa))[_0x791a('0x46')](handleError(_0xde2e9a,null));};exports['getHopperHistories']=function(_0x2c7197,_0x492a8f,_0x467d65){var _0x48b8dc={'raw':!![],'where':{}};var _0x3a7f90={};var _0x446a39={'count':0x0,'rows':[]};return db['Campaign'][_0x791a('0x54')]({'where':{'id':_0x2c7197[_0x791a('0x42')]['id']}})[_0x791a('0x1f')](handleEntityNotFound(_0x492a8f,null))['then'](function(_0x3d1ad2){if(_0x3d1ad2){_0x3a7f90['model']=_[_0x791a('0x43')](db['CmHopperHistory']['rawAttributes']);_0x3a7f90['query']=_[_0x791a('0x43')](_0x2c7197[_0x791a('0x2f')]);_0x3a7f90[_0x791a('0x30')]=_[_0x791a('0x31')](_0x3a7f90['model'],_0x3a7f90[_0x791a('0x2f')]);_0x48b8dc[_0x791a('0x33')]=_['intersection'](_0x3a7f90[_0x791a('0x2e')],qs[_0x791a('0x32')](_0x2c7197[_0x791a('0x2f')]['fields']));_0x48b8dc['attributes']=_0x48b8dc[_0x791a('0x33')][_0x791a('0x34')]?_0x48b8dc[_0x791a('0x33')]:_0x3a7f90[_0x791a('0x2e')];if(!_0x2c7197[_0x791a('0x2f')][_0x791a('0x55')](_0x791a('0x35'))){_0x48b8dc[_0x791a('0x1a')]=qs['limit'](_0x2c7197[_0x791a('0x2f')][_0x791a('0x1a')]);_0x48b8dc[_0x791a('0x19')]=qs[_0x791a('0x19')](_0x2c7197['query']['offset']);}_0x48b8dc[_0x791a('0x36')]=qs[_0x791a('0x37')](_0x2c7197[_0x791a('0x2f')][_0x791a('0x37')]);_0x48b8dc[_0x791a('0x38')]=qs[_0x791a('0x30')](_[_0x791a('0x39')](_0x2c7197[_0x791a('0x2f')],_0x3a7f90[_0x791a('0x30')]));_0x48b8dc[_0x791a('0x38')][_0x791a('0x56')]=_0x3d1ad2['id'];if(_0x2c7197[_0x791a('0x2f')][_0x791a('0x3c')]){_0x48b8dc['where']=_[_0x791a('0x3a')](_0x48b8dc[_0x791a('0x38')],{'$or':_[_0x791a('0x29')](_0x48b8dc[_0x791a('0x33')],function(_0x27ab7a){var _0x85ccdf={};_0x85ccdf[_0x27ab7a]={'$like':'%'+_0x2c7197[_0x791a('0x2f')][_0x791a('0x3c')]+'%'};return _0x85ccdf;})});}_0x48b8dc=_[_0x791a('0x3a')]({},_0x48b8dc,_0x2c7197[_0x791a('0x3d')]);return db['CmHopperHistory'][_0x791a('0x3f')]({'where':_0x48b8dc[_0x791a('0x38')]})['then'](function(_0x3c7d93){_0x446a39[_0x791a('0x3f')]=_0x3c7d93;if(_0x2c7197[_0x791a('0x2f')][_0x791a('0x44')]){_0x48b8dc[_0x791a('0x40')]=[{'all':!![]}];}return db['CmHopperHistory']['findAll'](_0x48b8dc);})[_0x791a('0x1f')](function(_0x3c2b01){_0x446a39['rows']=_0x3c2b01;return _0x446a39;});}})['then'](respondWithFilteredResult(_0x492a8f,_0x48b8dc))[_0x791a('0x46')](handleError(_0x492a8f,null));};exports[_0x791a('0x58')]=function(_0x140766,_0x391682,_0x227c77){var _0x1c4c68={'raw':!![],'where':{}};var _0x3c9754={};var _0x26b6d3={'count':0x0,'rows':[]};return db['Campaign']['findOne']({'where':{'id':_0x140766['params']['id']}})[_0x791a('0x1f')](handleEntityNotFound(_0x391682,null))[_0x791a('0x1f')](function(_0x15ffcb){if(_0x15ffcb){_0x3c9754['model']=_['keys'](db[_0x791a('0x59')][_0x791a('0x2a')]);_0x3c9754[_0x791a('0x2f')]=_[_0x791a('0x43')](_0x140766['query']);_0x3c9754[_0x791a('0x30')]=_[_0x791a('0x31')](_0x3c9754[_0x791a('0x2e')],_0x3c9754[_0x791a('0x2f')]);_0x1c4c68[_0x791a('0x33')]=_[_0x791a('0x31')](_0x3c9754[_0x791a('0x2e')],qs[_0x791a('0x32')](_0x140766[_0x791a('0x2f')][_0x791a('0x32')]));_0x1c4c68[_0x791a('0x33')]=_0x1c4c68['attributes'][_0x791a('0x34')]?_0x1c4c68[_0x791a('0x33')]:_0x3c9754[_0x791a('0x2e')];if(!_0x140766['query']['hasOwnProperty']('nolimit')){_0x1c4c68[_0x791a('0x1a')]=qs[_0x791a('0x1a')](_0x140766[_0x791a('0x2f')][_0x791a('0x1a')]);_0x1c4c68[_0x791a('0x19')]=qs[_0x791a('0x19')](_0x140766['query'][_0x791a('0x19')]);}_0x1c4c68[_0x791a('0x36')]=qs[_0x791a('0x37')](_0x140766['query'][_0x791a('0x37')]);_0x1c4c68[_0x791a('0x38')]=qs['filters'](_[_0x791a('0x39')](_0x140766['query'],_0x3c9754[_0x791a('0x30')]));_0x1c4c68['where'][_0x791a('0x56')]=_0x15ffcb['id'];if(_0x140766['query']['filter']){_0x1c4c68['where']=_['merge'](_0x1c4c68[_0x791a('0x38')],{'$or':_[_0x791a('0x29')](_0x1c4c68[_0x791a('0x33')],function(_0x5555eb){var _0x13cf5b={};_0x13cf5b[_0x5555eb]={'$like':'%'+_0x140766[_0x791a('0x2f')][_0x791a('0x3c')]+'%'};return _0x13cf5b;})});}_0x1c4c68=_[_0x791a('0x3a')]({},_0x1c4c68,_0x140766[_0x791a('0x3d')]);return db['CmHopperFinal']['count']({'where':_0x1c4c68[_0x791a('0x38')]})[_0x791a('0x1f')](function(_0x10f1cf){_0x26b6d3['count']=_0x10f1cf;if(_0x140766[_0x791a('0x2f')]['includeAll']){_0x1c4c68[_0x791a('0x40')]=[{'all':!![]}];}return db[_0x791a('0x59')][_0x791a('0x5a')](_0x1c4c68);})['then'](function(_0x27b875){_0x26b6d3[_0x791a('0x41')]=_0x27b875;return _0x26b6d3;});}})[_0x791a('0x1f')](respondWithFilteredResult(_0x391682,_0x1c4c68))['catch'](handleError(_0x391682,null));};exports['getHopperBlacks']=function(_0xf25d7e,_0x2a555d,_0x432795){var _0x14b22f={'raw':!![],'where':{}};var _0xb39ddf={};var _0x5a15c4={'count':0x0,'rows':[]};return db['Campaign']['findOne']({'where':{'id':_0xf25d7e['params']['id']}})[_0x791a('0x1f')](handleEntityNotFound(_0x2a555d,null))['then'](function(_0x10112e){if(_0x10112e){_0xb39ddf[_0x791a('0x2e')]=_[_0x791a('0x43')](db[_0x791a('0x5b')][_0x791a('0x2a')]);_0xb39ddf[_0x791a('0x2f')]=_[_0x791a('0x43')](_0xf25d7e[_0x791a('0x2f')]);_0xb39ddf[_0x791a('0x30')]=_[_0x791a('0x31')](_0xb39ddf[_0x791a('0x2e')],_0xb39ddf['query']);_0x14b22f[_0x791a('0x33')]=_[_0x791a('0x31')](_0xb39ddf['model'],qs[_0x791a('0x32')](_0xf25d7e[_0x791a('0x2f')][_0x791a('0x32')]));_0x14b22f['attributes']=_0x14b22f[_0x791a('0x33')][_0x791a('0x34')]?_0x14b22f[_0x791a('0x33')]:_0xb39ddf['model'];if(!_0xf25d7e[_0x791a('0x2f')][_0x791a('0x55')](_0x791a('0x35'))){_0x14b22f[_0x791a('0x1a')]=qs['limit'](_0xf25d7e['query']['limit']);_0x14b22f['offset']=qs[_0x791a('0x19')](_0xf25d7e[_0x791a('0x2f')]['offset']);}_0x14b22f[_0x791a('0x36')]=qs[_0x791a('0x37')](_0xf25d7e[_0x791a('0x2f')][_0x791a('0x37')]);_0x14b22f[_0x791a('0x38')]=qs[_0x791a('0x30')](_[_0x791a('0x39')](_0xf25d7e['query'],_0xb39ddf[_0x791a('0x30')]));_0x14b22f[_0x791a('0x38')]['CampaignId']=_0x10112e['id'];if(_0xf25d7e[_0x791a('0x2f')]['filter']){_0x14b22f[_0x791a('0x38')]=_[_0x791a('0x3a')](_0x14b22f[_0x791a('0x38')],{'$or':_['map'](_0x14b22f[_0x791a('0x33')],function(_0x7fead2){var _0x115f8a={};_0x115f8a[_0x7fead2]={'$like':'%'+_0xf25d7e[_0x791a('0x2f')][_0x791a('0x3c')]+'%'};return _0x115f8a;})});}_0x14b22f=_[_0x791a('0x3a')]({},_0x14b22f,_0xf25d7e[_0x791a('0x3d')]);return db[_0x791a('0x5b')][_0x791a('0x3f')]({'where':_0x14b22f[_0x791a('0x38')]})['then'](function(_0x4e840c){_0x5a15c4[_0x791a('0x3f')]=_0x4e840c;if(_0xf25d7e[_0x791a('0x2f')][_0x791a('0x44')]){_0x14b22f[_0x791a('0x40')]=[{'all':!![]}];}return db[_0x791a('0x5b')]['findAll'](_0x14b22f);})['then'](function(_0x439ec8){_0x5a15c4[_0x791a('0x41')]=_0x439ec8;return _0x5a15c4;});}})[_0x791a('0x1f')](respondWithFilteredResult(_0x2a555d,_0x14b22f))[_0x791a('0x46')](handleError(_0x2a555d,null));};exports[_0x791a('0x5c')]=function(_0x37c0ae,_0x47be48,_0x27c37d){var _0x541d45={};var _0x32437e={};var _0x526f7e;var _0x2994b6;return db['Campaign']['findOne']({'where':{'id':_0x37c0ae[_0x791a('0x42')]['id']}})[_0x791a('0x1f')](handleEntityNotFound(_0x47be48,null))[_0x791a('0x1f')](function(_0x371b29){if(_0x371b29){_0x526f7e=_0x371b29;_0x32437e[_0x791a('0x2e')]=_[_0x791a('0x43')](db[_0x791a('0x5d')]['rawAttributes']);_0x32437e[_0x791a('0x2f')]=_[_0x791a('0x43')](_0x37c0ae[_0x791a('0x2f')]);_0x32437e[_0x791a('0x30')]=_[_0x791a('0x31')](_0x32437e[_0x791a('0x2e')],_0x32437e['query']);_0x541d45[_0x791a('0x33')]=_['intersection'](_0x32437e['model'],qs[_0x791a('0x32')](_0x37c0ae['query'][_0x791a('0x32')]));_0x541d45['attributes']=_0x541d45[_0x791a('0x33')]['length']?_0x541d45['attributes']:_0x32437e[_0x791a('0x2e')];_0x541d45[_0x791a('0x36')]=qs['sort'](_0x37c0ae['query']['sort']);_0x541d45[_0x791a('0x38')]=qs[_0x791a('0x30')](_[_0x791a('0x39')](_0x37c0ae[_0x791a('0x2f')],_0x32437e[_0x791a('0x30')]));if(_0x37c0ae['query']['filter']){_0x541d45[_0x791a('0x38')]=_[_0x791a('0x3a')](_0x541d45['where'],{'$or':_[_0x791a('0x29')](_0x541d45['attributes'],function(_0x84e0b9){var _0x327920={};_0x327920[_0x84e0b9]={'$like':'%'+_0x37c0ae['query'][_0x791a('0x3c')]+'%'};return _0x327920;})});}_0x541d45=_[_0x791a('0x3a')]({},_0x541d45,_0x37c0ae[_0x791a('0x3d')]);return _0x526f7e[_0x791a('0x5c')](_0x541d45);}})[_0x791a('0x1f')](function(_0x1bc4cf){if(_0x1bc4cf){_0x2994b6=_0x1bc4cf[_0x791a('0x34')];if(!_0x37c0ae['query'][_0x791a('0x55')](_0x791a('0x35'))){_0x541d45[_0x791a('0x1a')]=qs['limit'](_0x37c0ae['query']['limit']);_0x541d45[_0x791a('0x19')]=qs[_0x791a('0x19')](_0x37c0ae[_0x791a('0x2f')][_0x791a('0x19')]);}return _0x526f7e['getLists'](_0x541d45);}})['then'](function(_0x4fa04a){if(_0x4fa04a){return _0x4fa04a?{'count':_0x2994b6,'rows':_0x4fa04a}:null;}})[_0x791a('0x1f')](respondWithResult(_0x47be48,null))[_0x791a('0x46')](handleError(_0x47be48,null));};exports[_0x791a('0x5e')]=function(_0x4ef609,_0x4bd342,_0x3b8bd7){var _0x220905,_0x566cd7;return db[_0x791a('0x3e')][_0x791a('0x45')]({'where':{'id':_0x4ef609[_0x791a('0x42')]['id']}})[_0x791a('0x1f')](handleEntityNotFound(_0x4bd342,null))[_0x791a('0x1f')](function(_0x1e2ddc){if(_0x1e2ddc){_0x566cd7=_0x1e2ddc;return _0x1e2ddc[_0x791a('0x5e')](_0x4ef609[_0x791a('0x48')][_0x791a('0x5f')],_['omit'](_0x4ef609[_0x791a('0x48')],[_0x791a('0x5f'),'id'])||{});}return null;})[_0x791a('0x60')](function(_0x2eee2d){var _0x10341d;_0x220905=_0x2eee2d||[];var _0x58d726=[];if(_0x2eee2d){for(var _0x17c8e3=0x0;_0x17c8e3<_0x2eee2d[_0x791a('0x34')];_0x17c8e3+=0x1){var _0x5d344e=_0x2eee2d[_0x17c8e3][_0x791a('0x21')]({'plain':!![]});_0x566cd7[_0x791a('0x61')]=_0x4ef609[_0x791a('0x48')][_0x791a('0x61')]?_0x4ef609[_0x791a('0x48')][_0x791a('0x61')]:_0x566cd7[_0x791a('0x61')];switch(_0x566cd7[_0x791a('0x61')]){case _0x791a('0x62'):_0x10341d=squel[_0x791a('0x63')]()[_0x791a('0x64')](_0x791a('0x65'))[_0x791a('0x66')](['phone',_0x791a('0x67'),_0x791a('0x68'),_0x791a('0x69'),_0x791a('0x56'),_0x791a('0x4e'),_0x791a('0x4f')],squel['select']()[_0x791a('0x6a')](_0x791a('0x6b'),_0x791a('0x6b'))[_0x791a('0x6a')](_0x791a('0x6c'),_0x791a('0x67'))[_0x791a('0x6a')]('id',_0x791a('0x68'))[_0x791a('0x6a')](_0x5d344e[_0x791a('0x6d')]['toString'](),_0x791a('0x69'))[_0x791a('0x6a')](_0x4ef609[_0x791a('0x42')]['id']['toString'](),_0x791a('0x56'))[_0x791a('0x6a')](_0x791a('0x6c'),'createdAt')['field'](_0x791a('0x6c'),_0x791a('0x4f'))[_0x791a('0x6e')](_0x791a('0x6f'))[_0x791a('0x38')](_0x791a('0x70'))[_0x791a('0x38')](_0x791a('0x71'),_0x5d344e[_0x791a('0x6d')][_0x791a('0x72')]())[_0x791a('0x38')]('phone\x20IS\x20NOT\x20NULL')[_0x791a('0x38')](_0x791a('0x73'),squel[_0x791a('0x74')]()[_0x791a('0x6a')](_0x791a('0x75'))[_0x791a('0x6e')](_0x791a('0x76'))[_0x791a('0x38')](_0x791a('0x77'),_0x4ef609[_0x791a('0x42')]['id'][_0x791a('0x72')]()))[_0x791a('0x38')](_0x791a('0x73'),squel[_0x791a('0x74')]()[_0x791a('0x6a')](_0x791a('0x78'))[_0x791a('0x6e')]('cm_hopper')[_0x791a('0x38')](_0x791a('0x77'),_0x4ef609[_0x791a('0x42')]['id'][_0x791a('0x72')]())))[_0x791a('0x72')]();break;case'onlyIfOpen':_0x10341d=squel[_0x791a('0x63')]()[_0x791a('0x64')](_0x791a('0x65'))['fromQuery'](['phone',_0x791a('0x67'),_0x791a('0x68'),'ListId',_0x791a('0x56'),_0x791a('0x4e'),_0x791a('0x4f')],squel[_0x791a('0x74')]()[_0x791a('0x6a')]('phone','phone')[_0x791a('0x6a')](_0x791a('0x6c'),_0x791a('0x67'))[_0x791a('0x6a')]('id',_0x791a('0x68'))[_0x791a('0x6a')](_0x5d344e[_0x791a('0x6d')][_0x791a('0x72')](),_0x791a('0x69'))[_0x791a('0x6a')](_0x4ef609[_0x791a('0x42')]['id']['toString'](),'CampaignId')[_0x791a('0x6a')](_0x791a('0x6c'),_0x791a('0x4e'))[_0x791a('0x6a')](_0x791a('0x6c'),'updatedAt')[_0x791a('0x6e')](_0x791a('0x6f'))[_0x791a('0x38')](_0x791a('0x70'))[_0x791a('0x38')](_0x791a('0x71'),_0x5d344e[_0x791a('0x6d')]['toString']())[_0x791a('0x38')](_0x791a('0x79'))[_0x791a('0x38')](_0x791a('0x73'),squel[_0x791a('0x74')]()['field']('COALESCE(phone,\x27\x27)')['from'](_0x791a('0x65'))[_0x791a('0x38')](_0x791a('0x77'),_0x4ef609[_0x791a('0x42')]['id'][_0x791a('0x72')]())))['toString']();break;default:_0x10341d=squel[_0x791a('0x63')]()[_0x791a('0x64')]('cm_hopper')[_0x791a('0x66')](['phone','scheduledAt','ContactId',_0x791a('0x69'),_0x791a('0x56'),_0x791a('0x4e'),_0x791a('0x4f')],squel[_0x791a('0x74')]()[_0x791a('0x6a')](_0x791a('0x6b'),_0x791a('0x6b'))[_0x791a('0x6a')](_0x791a('0x6c'),'scheduledAt')[_0x791a('0x6a')]('id',_0x791a('0x68'))[_0x791a('0x6a')](_0x5d344e['CmListId'][_0x791a('0x72')](),_0x791a('0x69'))[_0x791a('0x6a')](_0x4ef609[_0x791a('0x42')]['id']['toString'](),_0x791a('0x56'))[_0x791a('0x6a')]('NOW()',_0x791a('0x4e'))['field']('NOW()',_0x791a('0x4f'))[_0x791a('0x6e')](_0x791a('0x6f'))['where']('deletedAt\x20IS\x20NULL')[_0x791a('0x38')](_0x791a('0x71'),_0x5d344e[_0x791a('0x6d')]['toString']())[_0x791a('0x38')](_0x791a('0x79')))[_0x791a('0x72')]();}_0x58d726['push'](db[_0x791a('0x7a')][_0x791a('0x2f')](_0x10341d));}return BPromise[_0x791a('0x7b')](_0x58d726);}})['then'](function(){return _0x220905;})[_0x791a('0x1f')](respondWithResult(_0x4bd342,null))[_0x791a('0x46')](handleError(_0x4bd342,null));};exports[_0x791a('0x7c')]=function(_0x9fde9b,_0x30ee69,_0x415f2f){return db[_0x791a('0x3e')][_0x791a('0x45')]({'where':{'id':_0x9fde9b['params']['id']}})[_0x791a('0x1f')](handleEntityNotFound(_0x30ee69,null))[_0x791a('0x1f')](function(_0x29dca1){if(_0x29dca1){return _0x29dca1['removeLists'](_0x9fde9b[_0x791a('0x2f')]['ids']);}})[_0x791a('0x1f')](function(_0x16f58a){if(_0x16f58a){return db[_0x791a('0x57')][_0x791a('0x20')]({'where':{'ListId':_0x9fde9b['query'][_0x791a('0x5f')],'CampaignId':_0x9fde9b[_0x791a('0x42')]['id']}})[_0x791a('0x1f')](function(){return _0x16f58a;});}})[_0x791a('0x1f')](respondWithStatusCode(_0x30ee69,null))[_0x791a('0x46')](handleError(_0x30ee69,null));};exports[_0x791a('0x7d')]=function(_0x2e65ba,_0x5ca281,_0x1542bb){var _0x41a8a4={'raw':!![],'where':{}};var _0x1f9a88={};var _0x1f8d6d={'count':0x0,'rows':[]};return db[_0x791a('0x3e')][_0x791a('0x54')]({'where':{'id':_0x2e65ba[_0x791a('0x42')]['id']}})[_0x791a('0x1f')](handleEntityNotFound(_0x5ca281,null))[_0x791a('0x1f')](function(_0x5322fc){if(_0x5322fc){_0x1f9a88[_0x791a('0x2e')]=_[_0x791a('0x43')](db[_0x791a('0x5d')]['rawAttributes']);_0x1f9a88[_0x791a('0x2f')]=_[_0x791a('0x43')](_0x2e65ba[_0x791a('0x2f')]);_0x1f9a88[_0x791a('0x30')]=_['intersection'](_0x1f9a88['model'],_0x1f9a88[_0x791a('0x2f')]);_0x41a8a4[_0x791a('0x33')]=_[_0x791a('0x31')](_0x1f9a88[_0x791a('0x2e')],qs['fields'](_0x2e65ba[_0x791a('0x2f')][_0x791a('0x32')]));_0x41a8a4[_0x791a('0x33')]=_0x41a8a4[_0x791a('0x33')][_0x791a('0x34')]?_0x41a8a4[_0x791a('0x33')]:_0x1f9a88[_0x791a('0x2e')];if(!_0x2e65ba[_0x791a('0x2f')][_0x791a('0x55')](_0x791a('0x35'))){_0x41a8a4['limit']=qs[_0x791a('0x1a')](_0x2e65ba[_0x791a('0x2f')][_0x791a('0x1a')]);_0x41a8a4['offset']=qs[_0x791a('0x19')](_0x2e65ba[_0x791a('0x2f')][_0x791a('0x19')]);}_0x41a8a4[_0x791a('0x36')]=qs['sort'](_0x2e65ba['query'][_0x791a('0x37')]);_0x41a8a4[_0x791a('0x38')]=qs[_0x791a('0x30')](_['pick'](_0x2e65ba['query'],_0x1f9a88[_0x791a('0x30')]));_0x41a8a4[_0x791a('0x38')][_0x791a('0x56')]=_0x5322fc['id'];if(_0x2e65ba['query'][_0x791a('0x3c')]){_0x41a8a4[_0x791a('0x38')]=_[_0x791a('0x3a')](_0x41a8a4['where'],{'$or':_[_0x791a('0x29')](_0x41a8a4[_0x791a('0x33')],function(_0x503760){var _0x3f71b0={};_0x3f71b0[_0x503760]={'$like':'%'+_0x2e65ba[_0x791a('0x2f')][_0x791a('0x3c')]+'%'};return _0x3f71b0;})});}_0x41a8a4=_[_0x791a('0x3a')]({},_0x41a8a4,_0x2e65ba[_0x791a('0x3d')]);return db[_0x791a('0x5d')]['count']({'where':_0x41a8a4[_0x791a('0x38')]})[_0x791a('0x1f')](function(_0x32653c){_0x1f8d6d['count']=_0x32653c;if(_0x2e65ba[_0x791a('0x2f')][_0x791a('0x44')]){_0x41a8a4[_0x791a('0x40')]=[{'all':!![]}];}return db['CmList']['findAll'](_0x41a8a4);})['then'](function(_0x38d2d7){_0x1f8d6d[_0x791a('0x41')]=_0x38d2d7;return _0x1f8d6d;});}})[_0x791a('0x1f')](respondWithFilteredResult(_0x5ca281,_0x41a8a4))[_0x791a('0x46')](handleError(_0x5ca281,null));};exports[_0x791a('0x7e')]=function(_0x3e8085,_0x471d1f,_0x5e3bbe){var _0x12f833,_0xb44439;return db['Campaign']['find']({'where':{'id':_0x3e8085[_0x791a('0x42')]['id']}})[_0x791a('0x1f')](handleEntityNotFound(_0x471d1f,null))['then'](function(_0x5391c4){if(_0x5391c4){_0xb44439=_0x5391c4;return _0x5391c4[_0x791a('0x7e')](_0x3e8085[_0x791a('0x48')]['ids'],_[_0x791a('0x4d')](_0x3e8085[_0x791a('0x48')],['ids','id'])||{});}return null;})[_0x791a('0x60')](function(_0x1007c5){var _0xf51368;_0x12f833=_0x1007c5||[];var _0x112d50=[];if(_0x1007c5){for(var _0xba19bb=0x0;_0xba19bb<_0x1007c5[_0x791a('0x34')];_0xba19bb+=0x1){var _0x1aa047=_0x1007c5[_0xba19bb][_0x791a('0x21')]({'plain':!![]});_0xf51368=squel[_0x791a('0x63')]()[_0x791a('0x64')](_0x791a('0x7f'))[_0x791a('0x66')]([_0x791a('0x6b'),'ContactId',_0x791a('0x69'),_0x791a('0x56'),_0x791a('0x4e'),'updatedAt'],squel[_0x791a('0x74')]()['field'](_0x791a('0x6b'),_0x791a('0x6b'))[_0x791a('0x6a')]('id',_0x791a('0x68'))[_0x791a('0x6a')](_0x1aa047[_0x791a('0x6d')][_0x791a('0x72')](),_0x791a('0x69'))[_0x791a('0x6a')](_0x3e8085[_0x791a('0x42')]['id'][_0x791a('0x72')](),_0x791a('0x56'))[_0x791a('0x6a')](_0x791a('0x6c'),'createdAt')['field']('NOW()',_0x791a('0x4f'))[_0x791a('0x6e')]('cm_contacts')['where'](_0x791a('0x70'))[_0x791a('0x38')](_0x791a('0x71'),_0x1aa047[_0x791a('0x6d')][_0x791a('0x72')]())[_0x791a('0x38')]('phone\x20IS\x20NOT\x20NULL'))[_0x791a('0x72')]();_0x112d50[_0x791a('0x80')](db[_0x791a('0x7a')]['query'](_0xf51368));}return BPromise[_0x791a('0x7b')](_0x112d50);}})[_0x791a('0x1f')](function(){return _0x12f833;})[_0x791a('0x1f')](respondWithResult(_0x471d1f,null))[_0x791a('0x46')](handleError(_0x471d1f,null));};exports[_0x791a('0x81')]=function(_0x26d549,_0x7d50dc,_0x3082f3){return db['Campaign']['find']({'where':{'id':_0x26d549[_0x791a('0x42')]['id']}})[_0x791a('0x1f')](handleEntityNotFound(_0x7d50dc,null))[_0x791a('0x1f')](function(_0x35cf0c){if(_0x35cf0c){return _0x35cf0c[_0x791a('0x81')](_0x26d549['query'][_0x791a('0x5f')]);}})['then'](function(_0x269544){if(_0x269544){return db[_0x791a('0x5b')][_0x791a('0x20')]({'where':{'ListId':_0x26d549[_0x791a('0x2f')][_0x791a('0x5f')],'CampaignId':_0x26d549[_0x791a('0x42')]['id']}})['then'](function(){return _0x269544;});}})[_0x791a('0x1f')](respondWithStatusCode(_0x7d50dc,null))[_0x791a('0x46')](handleError(_0x7d50dc,null));}; \ No newline at end of file diff --git a/server/api/campaign/campaign.model.js b/server/api/campaign/campaign.model.js index ca61230..8b759ed 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 _0x9c7c=['../../config/logger','api','moment','bluebird','request-promise','path','../../config/environment','./campaign.attributes','Campaign','lodash'];(function(_0x13d07a,_0x41efc3){var _0x5ee0ee=function(_0x4ca94a){while(--_0x4ca94a){_0x13d07a['push'](_0x13d07a['shift']());}};_0x5ee0ee(++_0x41efc3);}(_0x9c7c,0x95));var _0xc9c7=function(_0x3c2cbf,_0x340ac3){_0x3c2cbf=_0x3c2cbf-0x0;var _0x2d9279=_0x9c7c[_0x3c2cbf];return _0x2d9279;};'use strict';var _=require(_0xc9c7('0x0'));var util=require('util');var logger=require(_0xc9c7('0x1'))(_0xc9c7('0x2'));var moment=require(_0xc9c7('0x3'));var BPromise=require(_0xc9c7('0x4'));var rp=require(_0xc9c7('0x5'));var fs=require('fs');var path=require(_0xc9c7('0x6'));var rimraf=require('rimraf');var config=require(_0xc9c7('0x7'));var attributes=require(_0xc9c7('0x8'));module['exports']=function(_0x101d75,_0x5bdee7){return _0x101d75['define'](_0xc9c7('0x9'),attributes,{'tableName':'campaigns','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xe51e=['path','rimraf','../../config/environment','./campaign.attributes','define','Campaign','campaigns','util','../../config/logger','api','moment','bluebird','request-promise'];(function(_0x499231,_0x562c89){var _0x42b674=function(_0x4968e7){while(--_0x4968e7){_0x499231['push'](_0x499231['shift']());}};_0x42b674(++_0x562c89);}(_0xe51e,0x96));var _0xee51=function(_0x989676,_0x3a88e2){_0x989676=_0x989676-0x0;var _0x369670=_0xe51e[_0x989676];return _0x369670;};'use strict';var _=require('lodash');var util=require(_0xee51('0x0'));var logger=require(_0xee51('0x1'))(_0xee51('0x2'));var moment=require(_0xee51('0x3'));var BPromise=require(_0xee51('0x4'));var rp=require(_0xee51('0x5'));var fs=require('fs');var path=require(_0xee51('0x6'));var rimraf=require(_0xee51('0x7'));var config=require(_0xee51('0x8'));var attributes=require(_0xee51('0x9'));module['exports']=function(_0x2e769b,_0x5121fb){return _0x2e769b[_0xee51('0xa')](_0xee51('0xb'),attributes,{'tableName':_0xee51('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/campaign/campaign.rpc.js b/server/api/campaign/campaign.rpc.js index 7d810d9..514ecd6 100644 --- a/server/api/campaign/campaign.rpc.js +++ b/server/api/campaign/campaign.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9957=['catch','GetCampaign','findAll','raw','options','where','attributes','limit','map','include','model','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','then','info','Campaign,\x20%s,\x20%s','request\x20sent','debug','Campaign,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result'];(function(_0x1a4979,_0x524bcf){var _0x2f6fec=function(_0x2ece47){while(--_0x2ece47){_0x1a4979['push'](_0x1a4979['shift']());}};_0x2f6fec(++_0x524bcf);}(_0x9957,0x93));var _0x7995=function(_0x1facfa,_0x1acf7d){_0x1facfa=_0x1facfa-0x0;var _0x9ec701=_0x9957[_0x1facfa];return _0x9ec701;};'use strict';var _=require(_0x7995('0x0'));var util=require(_0x7995('0x1'));var moment=require(_0x7995('0x2'));var BPromise=require(_0x7995('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x7995('0x4'));var db=require(_0x7995('0x5'))['db'];var utils=require(_0x7995('0x6'));var logger=require(_0x7995('0x7'))('rpc');var config=require(_0x7995('0x8'));var jayson=require(_0x7995('0x9'));var client=jayson[_0x7995('0xa')][_0x7995('0xb')]({'port':0x232a});function respondWithRpcPromise(_0xbda126,_0x326741,_0x4996ca){return new BPromise(function(_0x465276,_0x1cad37){return client['request'](_0xbda126,_0x4996ca)[_0x7995('0xc')](function(_0x3116fb){logger[_0x7995('0xd')](_0x7995('0xe'),_0x326741,_0x7995('0xf'));logger[_0x7995('0x10')](_0x7995('0x11'),_0x326741,'request\x20sent',JSON[_0x7995('0x12')](_0x3116fb));if(_0x3116fb[_0x7995('0x13')]){if(_0x3116fb['error'][_0x7995('0x14')]===0x1f4){logger[_0x7995('0x13')](_0x7995('0xe'),_0x326741,_0x3116fb[_0x7995('0x13')][_0x7995('0x15')]);return _0x1cad37(_0x3116fb[_0x7995('0x13')][_0x7995('0x15')]);}logger['error']('Campaign,\x20%s,\x20%s',_0x326741,_0x3116fb[_0x7995('0x13')][_0x7995('0x15')]);return _0x465276(_0x3116fb[_0x7995('0x13')][_0x7995('0x15')]);}else{logger[_0x7995('0xd')](_0x7995('0xe'),_0x326741,_0x7995('0xf'));_0x465276(_0x3116fb[_0x7995('0x16')]['message']);}})[_0x7995('0x17')](function(_0x565d97){logger[_0x7995('0x13')](_0x7995('0xe'),_0x326741,_0x565d97);_0x1cad37(_0x565d97);});});}exports[_0x7995('0x18')]=function(_0x291317){var _0x1e1415=this;return new Promise(function(_0x37a7d4,_0x4faa60){return db['Campaign'][_0x7995('0x19')]({'raw':_0x291317['options']?_0x291317['options'][_0x7995('0x1a')]===undefined?!![]:![]:!![],'where':_0x291317[_0x7995('0x1b')]?_0x291317['options'][_0x7995('0x1c')]||null:null,'attributes':_0x291317['options']?_0x291317['options'][_0x7995('0x1d')]||null:null,'limit':_0x291317[_0x7995('0x1b')]?_0x291317[_0x7995('0x1b')][_0x7995('0x1e')]||null:null,'include':_0x291317[_0x7995('0x1b')]?_0x291317[_0x7995('0x1b')]['include']?_[_0x7995('0x1f')](_0x291317[_0x7995('0x1b')][_0x7995('0x20')],function(_0x285437){return{'model':db[_0x285437[_0x7995('0x21')]],'as':_0x285437['as'],'attributes':_0x285437[_0x7995('0x1d')],'include':_0x285437[_0x7995('0x20')]?_[_0x7995('0x1f')](_0x285437['include'],function(_0x39df42){return{'model':db[_0x39df42[_0x7995('0x21')]],'as':_0x39df42['as'],'attributes':_0x39df42[_0x7995('0x1d')],'include':_0x39df42[_0x7995('0x20')]?_[_0x7995('0x1f')](_0x39df42[_0x7995('0x20')],function(_0x56691a){return{'model':db[_0x56691a[_0x7995('0x21')]],'as':_0x56691a['as'],'attributes':_0x56691a['attributes']};}):[]};}):[]};}):[]:[]})[_0x7995('0xc')](function(_0x49bc7e){logger[_0x7995('0xd')](_0x7995('0x18'),_0x291317);logger[_0x7995('0x10')]('GetCampaign',_0x291317,JSON[_0x7995('0x12')](_0x49bc7e));_0x37a7d4(_0x49bc7e);})['catch'](function(_0x456a28){logger[_0x7995('0x13')](_0x7995('0x18'),_0x456a28['message'],_0x291317);_0x4faa60(_0x1e1415['error'](0x1f4,_0x456a28['message']));});});}; \ No newline at end of file +var _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(_0xb97b43,_0x29aeb3){var _0x476e7a=function(_0x390c35){while(--_0x390c35){_0xb97b43['push'](_0xb97b43['shift']());}};_0x476e7a(++_0x29aeb3);}(_0x9957,0x93));var _0x7995=function(_0x3947c9,_0x4d6c97){_0x3947c9=_0x3947c9-0x0;var _0x2e7871=_0x9957[_0x3947c9];return _0x2e7871;};'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 cf8ea63..37f0e09 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 _0x8bb2=['/:id/lists','addLists','addBlackLists','put','update','delete','removeLists','removeBlackLists','exports','util','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./campaign.controller','get','index','/:id','show','/:id/hoppers','isAuthenticated','getHoppers','/:id/hopper_histories','getHopperHistories','getHopperFinals','/:id/hopper_black','getHopperBlacks','getLists','/:id/blacklists','getBlackLists','create','post','/:id/clone','clone'];(function(_0x1ee638,_0x597103){var _0x4f2635=function(_0x2267d3){while(--_0x2267d3){_0x1ee638['push'](_0x1ee638['shift']());}};_0x4f2635(++_0x597103);}(_0x8bb2,0xe1));var _0x28bb=function(_0x33593e,_0x22ddd3){_0x33593e=_0x33593e-0x0;var _0x53db1a=_0x8bb2[_0x33593e];return _0x53db1a;};'use strict';var multer=require('multer');var util=require(_0x28bb('0x0'));var path=require('path');var timeout=require(_0x28bb('0x1'));var express=require(_0x28bb('0x2'));var router=express[_0x28bb('0x3')]();var auth=require(_0x28bb('0x4'));var interaction=require(_0x28bb('0x5'));var config=require(_0x28bb('0x6'));var controller=require(_0x28bb('0x7'));router[_0x28bb('0x8')]('/',auth['isAuthenticated'](),controller[_0x28bb('0x9')]);router[_0x28bb('0x8')](_0x28bb('0xa'),auth['isAuthenticated'](),controller[_0x28bb('0xb')]);router[_0x28bb('0x8')](_0x28bb('0xc'),auth[_0x28bb('0xd')](),controller[_0x28bb('0xe')]);router[_0x28bb('0x8')](_0x28bb('0xf'),auth[_0x28bb('0xd')](),controller[_0x28bb('0x10')]);router['get']('/:id/hopper_finals',auth['isAuthenticated'](),controller[_0x28bb('0x11')]);router[_0x28bb('0x8')](_0x28bb('0x12'),auth[_0x28bb('0xd')](),controller[_0x28bb('0x13')]);router[_0x28bb('0x8')]('/:id/lists',auth[_0x28bb('0xd')](),controller[_0x28bb('0x14')]);router[_0x28bb('0x8')](_0x28bb('0x15'),auth[_0x28bb('0xd')](),controller[_0x28bb('0x16')]);router['post']('/',auth[_0x28bb('0xd')](),controller[_0x28bb('0x17')]);router[_0x28bb('0x18')](_0x28bb('0x19'),auth['isAuthenticated'](),controller[_0x28bb('0x1a')]);router[_0x28bb('0x18')](_0x28bb('0x1b'),auth[_0x28bb('0xd')](),controller[_0x28bb('0x1c')]);router['post'](_0x28bb('0x15'),auth[_0x28bb('0xd')](),controller[_0x28bb('0x1d')]);router[_0x28bb('0x1e')]('/:id',auth[_0x28bb('0xd')](),controller[_0x28bb('0x1f')]);router[_0x28bb('0x20')](_0x28bb('0xa'),auth[_0x28bb('0xd')](),controller['destroy']);router['delete'](_0x28bb('0x1b'),auth['isAuthenticated'](),controller[_0x28bb('0x21')]);router[_0x28bb('0x20')](_0x28bb('0x15'),auth[_0x28bb('0xd')](),controller[_0x28bb('0x22')]);module[_0x28bb('0x23')]=router; \ No newline at end of file +var _0xf8cc=['getHoppers','/:id/hopper_histories','/:id/hopper_black','getHopperBlacks','getLists','post','create','/:id/clone','/:id/blacklists','addBlackLists','put','update','delete','destroy','/:id/lists','removeBlackLists','multer','util','path','connect-timeout','express','../../components/interaction/service','../../config/environment','./campaign.controller','get','index','/:id','isAuthenticated','show'];(function(_0x3f57ed,_0x5f05c9){var _0x4401bc=function(_0x3f056b){while(--_0x3f056b){_0x3f57ed['push'](_0x3f57ed['shift']());}};_0x4401bc(++_0x5f05c9);}(_0xf8cc,0x189));var _0xcf8c=function(_0x585eb7,_0x327a00){_0x585eb7=_0x585eb7-0x0;var _0x884fc3=_0xf8cc[_0x585eb7];return _0x884fc3;};'use strict';var multer=require(_0xcf8c('0x0'));var util=require(_0xcf8c('0x1'));var path=require(_0xcf8c('0x2'));var timeout=require(_0xcf8c('0x3'));var express=require(_0xcf8c('0x4'));var router=express['Router']();var auth=require('../../components/auth/service');var interaction=require(_0xcf8c('0x5'));var config=require(_0xcf8c('0x6'));var controller=require(_0xcf8c('0x7'));router[_0xcf8c('0x8')]('/',auth['isAuthenticated'](),controller[_0xcf8c('0x9')]);router['get'](_0xcf8c('0xa'),auth[_0xcf8c('0xb')](),controller[_0xcf8c('0xc')]);router[_0xcf8c('0x8')]('/:id/hoppers',auth['isAuthenticated'](),controller[_0xcf8c('0xd')]);router[_0xcf8c('0x8')](_0xcf8c('0xe'),auth[_0xcf8c('0xb')](),controller['getHopperHistories']);router[_0xcf8c('0x8')]('/:id/hopper_finals',auth[_0xcf8c('0xb')](),controller['getHopperFinals']);router[_0xcf8c('0x8')](_0xcf8c('0xf'),auth['isAuthenticated'](),controller[_0xcf8c('0x10')]);router['get']('/:id/lists',auth[_0xcf8c('0xb')](),controller[_0xcf8c('0x11')]);router[_0xcf8c('0x8')]('/:id/blacklists',auth[_0xcf8c('0xb')](),controller['getBlackLists']);router[_0xcf8c('0x12')]('/',auth[_0xcf8c('0xb')](),controller[_0xcf8c('0x13')]);router[_0xcf8c('0x12')](_0xcf8c('0x14'),auth[_0xcf8c('0xb')](),controller['clone']);router[_0xcf8c('0x12')]('/:id/lists',auth[_0xcf8c('0xb')](),controller['addLists']);router[_0xcf8c('0x12')](_0xcf8c('0x15'),auth[_0xcf8c('0xb')](),controller[_0xcf8c('0x16')]);router[_0xcf8c('0x17')](_0xcf8c('0xa'),auth['isAuthenticated'](),controller[_0xcf8c('0x18')]);router[_0xcf8c('0x19')]('/:id',auth['isAuthenticated'](),controller[_0xcf8c('0x1a')]);router[_0xcf8c('0x19')](_0xcf8c('0x1b'),auth['isAuthenticated'](),controller['removeLists']);router[_0xcf8c('0x19')](_0xcf8c('0x15'),auth[_0xcf8c('0xb')](),controller[_0xcf8c('0x1c')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/cannedAnswer/cannedAnswer.attributes.js b/server/api/cannedAnswer/cannedAnswer.attributes.js index ba02379..cfa676f 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 _0x3b1d=['exports','STRING','TEXT','VIRTUAL','sequelize'];(function(_0xb5e5a6,_0x5a8a5f){var _0x56fdf5=function(_0x406969){while(--_0x406969){_0xb5e5a6['push'](_0xb5e5a6['shift']());}};_0x56fdf5(++_0x5a8a5f);}(_0x3b1d,0x1f3));var _0xd3b1=function(_0xa148b7,_0x2f3eb2){_0xa148b7=_0xa148b7-0x0;var _0x51efd3=_0x3b1d[_0xa148b7];return _0x51efd3;};'use strict';var Sequelize=require(_0xd3b1('0x0'));module[_0xd3b1('0x1')]={'key':{'type':Sequelize[_0xd3b1('0x2')],'allowNull':![]},'value':{'type':Sequelize[_0xd3b1('0x3')],'allowNull':![]},'description':{'type':Sequelize[_0xd3b1('0x2')]},'name':{'type':Sequelize[_0xd3b1('0x4')],'get':function(){return this['getDataValue']('key');}}}; \ No newline at end of file +var _0xb1e3=['VIRTUAL','getDataValue','key','sequelize','exports','STRING','TEXT'];(function(_0x7b484,_0x195ad4){var _0x2ae1cf=function(_0x2e6247){while(--_0x2e6247){_0x7b484['push'](_0x7b484['shift']());}};_0x2ae1cf(++_0x195ad4);}(_0xb1e3,0x184));var _0x3b1e=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xb1e3[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require(_0x3b1e('0x0'));module[_0x3b1e('0x1')]={'key':{'type':Sequelize[_0x3b1e('0x2')],'allowNull':![]},'value':{'type':Sequelize[_0x3b1e('0x3')],'allowNull':![]},'description':{'type':Sequelize[_0x3b1e('0x2')]},'name':{'type':Sequelize[_0x3b1e('0x4')],'get':function(){return this[_0x3b1e('0x5')](_0x3b1e('0x6'));}}}; \ No newline at end of file diff --git a/server/api/cannedAnswer/cannedAnswer.controller.js b/server/api/cannedAnswer/cannedAnswer.controller.js index d144c87..890ae05 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 _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(_0x1cacef,_0x2df25e){var _0x23c2d4=function(_0x4c278a){while(--_0x4c278a){_0x1cacef['push'](_0x1cacef['shift']());}};_0x23c2d4(++_0x2df25e);}(_0x34e8,0x12c));var _0x834e=function(_0x483499,_0x7d55ed){_0x483499=_0x483499-0x0;var _0x20030a=_0x34e8[_0x483499];return _0x20030a;};'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 +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(_0x402b12,_0x2aa900){var _0x16a58d=function(_0x543959){while(--_0x543959){_0x402b12['push'](_0x402b12['shift']());}};_0x16a58d(++_0x2aa900);}(_0x9957,0x93));var _0x7995=function(_0x2f5ac5,_0x1ee939){_0x2f5ac5=_0x2f5ac5-0x0;var _0x37c9a8=_0x9957[_0x2f5ac5];return _0x37c9a8;};'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 diff --git a/server/api/cannedAnswer/cannedAnswer.model.js b/server/api/cannedAnswer/cannedAnswer.model.js index 5787f0f..188832b 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 _0x7be1=['bluebird','path','../../config/environment','./cannedAnswer.attributes','exports','define','utf8mb4','utf8mb4_unicode_ci','util','../../config/logger','api','moment'];(function(_0x20b07b,_0x6603cd){var _0x41a653=function(_0x4a4828){while(--_0x4a4828){_0x20b07b['push'](_0x20b07b['shift']());}};_0x41a653(++_0x6603cd);}(_0x7be1,0x98));var _0x17be=function(_0x15449d,_0x537b1d){_0x15449d=_0x15449d-0x0;var _0x55cf8c=_0x7be1[_0x15449d];return _0x55cf8c;};'use strict';var _=require('lodash');var util=require(_0x17be('0x0'));var logger=require(_0x17be('0x1'))(_0x17be('0x2'));var moment=require(_0x17be('0x3'));var BPromise=require(_0x17be('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x17be('0x5'));var rimraf=require('rimraf');var config=require(_0x17be('0x6'));var attributes=require(_0x17be('0x7'));module[_0x17be('0x8')]=function(_0x108618,_0x4a9b31){return _0x108618[_0x17be('0x9')]('CannedAnswer',attributes,{'tableName':'tools_canned_answers','paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x17be('0xa'),'collate':_0x17be('0xb')});}; \ No newline at end of file +var _0x8ee8=['util','../../config/logger','api','moment','bluebird','rimraf','../../config/environment','./cannedAnswer.attributes','define','tools_canned_answers','utf8mb4','utf8mb4_unicode_ci','lodash'];(function(_0x42d1c8,_0xc13c44){var _0x22f990=function(_0x3ce85f){while(--_0x3ce85f){_0x42d1c8['push'](_0x42d1c8['shift']());}};_0x22f990(++_0xc13c44);}(_0x8ee8,0x9b));var _0x88ee=function(_0x21a9cf,_0x51f954){_0x21a9cf=_0x21a9cf-0x0;var _0x5d4ba7=_0x8ee8[_0x21a9cf];return _0x5d4ba7;};'use strict';var _=require(_0x88ee('0x0'));var util=require(_0x88ee('0x1'));var logger=require(_0x88ee('0x2'))(_0x88ee('0x3'));var moment=require(_0x88ee('0x4'));var BPromise=require(_0x88ee('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x88ee('0x6'));var config=require(_0x88ee('0x7'));var attributes=require(_0x88ee('0x8'));module['exports']=function(_0x1919c9,_0x4e325a){return _0x1919c9[_0x88ee('0x9')]('CannedAnswer',attributes,{'tableName':_0x88ee('0xa'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x88ee('0xb'),'collate':_0x88ee('0xc')});}; \ No newline at end of file diff --git a/server/api/cannedAnswer/cannedAnswer.rpc.js b/server/api/cannedAnswer/cannedAnswer.rpc.js index ff50694..6c53e35 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 _0x38d0=['request\x20sent','debug','CannedAnswer,\x20%s,\x20%s,\x20%s','stringify','error','message','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','client','then','info','CannedAnswer,\x20%s,\x20%s'];(function(_0x53b685,_0x19457c){var _0x312463=function(_0x963e2a){while(--_0x963e2a){_0x53b685['push'](_0x53b685['shift']());}};_0x312463(++_0x19457c);}(_0x38d0,0x1ab));var _0x038d=function(_0x36884e,_0x48008f){_0x36884e=_0x36884e-0x0;var _0x1cc367=_0x38d0[_0x36884e];return _0x1cc367;};'use strict';var _=require(_0x038d('0x0'));var util=require(_0x038d('0x1'));var moment=require(_0x038d('0x2'));var BPromise=require(_0x038d('0x3'));var rs=require(_0x038d('0x4'));var fs=require('fs');var Redis=require(_0x038d('0x5'));var db=require(_0x038d('0x6'))['db'];var utils=require(_0x038d('0x7'));var logger=require(_0x038d('0x8'))('rpc');var config=require(_0x038d('0x9'));var jayson=require('jayson/promise');var client=jayson[_0x038d('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x38e32c,_0x733a72,_0x35a9d2){return new BPromise(function(_0x24a7cd,_0x3fbc94){return client['request'](_0x38e32c,_0x35a9d2)[_0x038d('0xb')](function(_0x22fccd){logger[_0x038d('0xc')](_0x038d('0xd'),_0x733a72,_0x038d('0xe'));logger[_0x038d('0xf')](_0x038d('0x10'),_0x733a72,'request\x20sent',JSON[_0x038d('0x11')](_0x22fccd));if(_0x22fccd['error']){if(_0x22fccd[_0x038d('0x12')]['code']===0x1f4){logger['error'](_0x038d('0xd'),_0x733a72,_0x22fccd[_0x038d('0x12')][_0x038d('0x13')]);return _0x3fbc94(_0x22fccd[_0x038d('0x12')][_0x038d('0x13')]);}logger[_0x038d('0x12')]('CannedAnswer,\x20%s,\x20%s',_0x733a72,_0x22fccd[_0x038d('0x12')][_0x038d('0x13')]);return _0x24a7cd(_0x22fccd[_0x038d('0x12')][_0x038d('0x13')]);}else{logger[_0x038d('0xc')](_0x038d('0xd'),_0x733a72,_0x038d('0xe'));_0x24a7cd(_0x22fccd['result'][_0x038d('0x13')]);}})[_0x038d('0x14')](function(_0x4eec41){logger[_0x038d('0x12')]('CannedAnswer,\x20%s,\x20%s',_0x733a72,_0x4eec41);_0x3fbc94(_0x4eec41);});});} \ No newline at end of file +var _0xe1ae=['info','CannedAnswer,\x20%s,\x20%s','request\x20sent','debug','CannedAnswer,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','then'];(function(_0x46ab58,_0x4e9d30){var _0x15940d=function(_0x5e9f80){while(--_0x5e9f80){_0x46ab58['push'](_0x46ab58['shift']());}};_0x15940d(++_0x4e9d30);}(_0xe1ae,0xf1));var _0xee1a=function(_0x146eed,_0x547c97){_0x146eed=_0x146eed-0x0;var _0x17cdc4=_0xe1ae[_0x146eed];return _0x17cdc4;};'use strict';var _=require('lodash');var util=require(_0xee1a('0x0'));var moment=require(_0xee1a('0x1'));var BPromise=require(_0xee1a('0x2'));var rs=require(_0xee1a('0x3'));var fs=require('fs');var Redis=require(_0xee1a('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0xee1a('0x5'));var logger=require(_0xee1a('0x6'))(_0xee1a('0x7'));var config=require(_0xee1a('0x8'));var jayson=require(_0xee1a('0x9'));var client=jayson[_0xee1a('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x33c918,_0x1ebf7e,_0x360e61){return new BPromise(function(_0x4ce405,_0x53ed55){return client['request'](_0x33c918,_0x360e61)[_0xee1a('0xb')](function(_0x1f9e67){logger[_0xee1a('0xc')](_0xee1a('0xd'),_0x1ebf7e,_0xee1a('0xe'));logger[_0xee1a('0xf')](_0xee1a('0x10'),_0x1ebf7e,_0xee1a('0xe'),JSON[_0xee1a('0x11')](_0x1f9e67));if(_0x1f9e67[_0xee1a('0x12')]){if(_0x1f9e67[_0xee1a('0x12')][_0xee1a('0x13')]===0x1f4){logger[_0xee1a('0x12')]('CannedAnswer,\x20%s,\x20%s',_0x1ebf7e,_0x1f9e67[_0xee1a('0x12')][_0xee1a('0x14')]);return _0x53ed55(_0x1f9e67[_0xee1a('0x12')][_0xee1a('0x14')]);}logger[_0xee1a('0x12')](_0xee1a('0xd'),_0x1ebf7e,_0x1f9e67[_0xee1a('0x12')][_0xee1a('0x14')]);return _0x4ce405(_0x1f9e67[_0xee1a('0x12')][_0xee1a('0x14')]);}else{logger[_0xee1a('0xc')]('CannedAnswer,\x20%s,\x20%s',_0x1ebf7e,_0xee1a('0xe'));_0x4ce405(_0x1f9e67[_0xee1a('0x15')][_0xee1a('0x14')]);}})[_0xee1a('0x16')](function(_0x458792){logger[_0xee1a('0x12')]('CannedAnswer,\x20%s,\x20%s',_0x1ebf7e,_0x458792);_0x53ed55(_0x458792);});});} \ No newline at end of file diff --git a/server/api/cannedAnswer/index.js b/server/api/cannedAnswer/index.js index 19561d7..6026120 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 _0x15da=['multer','util','path','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./cannedAnswer.controller','get','isAuthenticated','/:id','post','update','exports'];(function(_0x5d1927,_0x123ef9){var _0x4c6235=function(_0x4da778){while(--_0x4da778){_0x5d1927['push'](_0x5d1927['shift']());}};_0x4c6235(++_0x123ef9);}(_0x15da,0x96));var _0xa15d=function(_0x21f3bf,_0xfb0f59){_0x21f3bf=_0x21f3bf-0x0;var _0x249d08=_0x15da[_0x21f3bf];return _0x249d08;};'use strict';var multer=require(_0xa15d('0x0'));var util=require(_0xa15d('0x1'));var path=require(_0xa15d('0x2'));var timeout=require(_0xa15d('0x3'));var express=require('express');var router=express[_0xa15d('0x4')]();var auth=require(_0xa15d('0x5'));var interaction=require(_0xa15d('0x6'));var config=require(_0xa15d('0x7'));var controller=require(_0xa15d('0x8'));router[_0xa15d('0x9')]('/',auth[_0xa15d('0xa')](),controller['index']);router['get'](_0xa15d('0xb'),auth[_0xa15d('0xa')](),controller['show']);router[_0xa15d('0xc')]('/',auth[_0xa15d('0xa')](),controller['create']);router['put']('/:id',auth['isAuthenticated'](),controller[_0xa15d('0xd')]);router['delete'](_0xa15d('0xb'),auth[_0xa15d('0xa')](),controller['destroy']);module[_0xa15d('0xe')]=router; \ No newline at end of file +var _0x1625=['show','post','create','put','update','destroy','exports','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./cannedAnswer.controller','get','isAuthenticated','index','/:id'];(function(_0x569f6b,_0x392f9a){var _0xc770b=function(_0x5a0bb0){while(--_0x5a0bb0){_0x569f6b['push'](_0x569f6b['shift']());}};_0xc770b(++_0x392f9a);}(_0x1625,0xe3));var _0x5162=function(_0x483756,_0x3964f9){_0x483756=_0x483756-0x0;var _0xe21f54=_0x1625[_0x483756];return _0xe21f54;};'use strict';var multer=require('multer');var util=require(_0x5162('0x0'));var path=require(_0x5162('0x1'));var timeout=require(_0x5162('0x2'));var express=require(_0x5162('0x3'));var router=express[_0x5162('0x4')]();var auth=require(_0x5162('0x5'));var interaction=require(_0x5162('0x6'));var config=require(_0x5162('0x7'));var controller=require(_0x5162('0x8'));router[_0x5162('0x9')]('/',auth[_0x5162('0xa')](),controller[_0x5162('0xb')]);router['get'](_0x5162('0xc'),auth['isAuthenticated'](),controller[_0x5162('0xd')]);router[_0x5162('0xe')]('/',auth[_0x5162('0xa')](),controller[_0x5162('0xf')]);router[_0x5162('0x10')](_0x5162('0xc'),auth[_0x5162('0xa')](),controller[_0x5162('0x11')]);router['delete'](_0x5162('0xc'),auth[_0x5162('0xa')](),controller[_0x5162('0x12')]);module[_0x5162('0x13')]=router; \ No newline at end of file diff --git a/server/api/cdr/cdr.attributes.js b/server/api/cdr/cdr.attributes.js index ab7da26..2dee573 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 _0x9c20=['DATE','1970-01-01\x2000:00:01','STRING','INTEGER','sequelize','exports'];(function(_0x4980ea,_0x5e9c03){var _0x3ac807=function(_0x4b9c97){while(--_0x4b9c97){_0x4980ea['push'](_0x4980ea['shift']());}};_0x3ac807(++_0x5e9c03);}(_0x9c20,0x154));var _0x09c2=function(_0x438d69,_0x258b79){_0x438d69=_0x438d69-0x0;var _0x2418c3=_0x9c20[_0x438d69];return _0x2418c3;};'use strict';var Sequelize=require(_0x09c2('0x0'));module[_0x09c2('0x1')]={'calldate':{'type':Sequelize[_0x09c2('0x2')],'allowNull':![],'defaultValue':_0x09c2('0x3')},'clid':{'type':Sequelize['STRING']},'src':{'type':Sequelize[_0x09c2('0x4')]},'dst':{'type':Sequelize[_0x09c2('0x4')]},'dcontext':{'type':Sequelize[_0x09c2('0x4')]},'channel':{'type':Sequelize['STRING']},'dstchannel':{'type':Sequelize[_0x09c2('0x4')]},'lastapp':{'type':Sequelize[_0x09c2('0x4')]},'lastdata':{'type':Sequelize[_0x09c2('0x4')]},'duration':{'type':Sequelize[_0x09c2('0x5')],'allowNull':![],'defaultValue':0x0},'billsec':{'type':Sequelize[_0x09c2('0x5')],'allowNull':![],'defaultValue':0x0},'disposition':{'type':Sequelize['STRING']},'amaflags':{'type':Sequelize[_0x09c2('0x5')],'allowNull':![],'defaultValue':0x0},'accountcode':{'type':Sequelize['STRING']},'userfield':{'type':Sequelize[_0x09c2('0x4')]},'uniqueid':{'type':Sequelize['STRING']},'linkedid':{'type':Sequelize[_0x09c2('0x4')]},'sequence':{'type':Sequelize[_0x09c2('0x4')]},'peeraccount':{'type':Sequelize['STRING']},'type':{'type':Sequelize[_0x09c2('0x4')]},'tag':{'type':Sequelize[_0x09c2('0x4')]}}; \ No newline at end of file +var _0x9b24=['DATE','1970-01-01\x2000:00:01','STRING','INTEGER','sequelize','exports'];(function(_0x24f31b,_0x44b8f3){var _0x488401=function(_0x204caf){while(--_0x204caf){_0x24f31b['push'](_0x24f31b['shift']());}};_0x488401(++_0x44b8f3);}(_0x9b24,0x88));var _0x49b2=function(_0x362c6a,_0x244f08){_0x362c6a=_0x362c6a-0x0;var _0x414c94=_0x9b24[_0x362c6a];return _0x414c94;};'use strict';var Sequelize=require(_0x49b2('0x0'));module[_0x49b2('0x1')]={'calldate':{'type':Sequelize[_0x49b2('0x2')],'allowNull':![],'defaultValue':_0x49b2('0x3')},'clid':{'type':Sequelize[_0x49b2('0x4')]},'src':{'type':Sequelize['STRING']},'dst':{'type':Sequelize['STRING']},'dcontext':{'type':Sequelize['STRING']},'channel':{'type':Sequelize['STRING']},'dstchannel':{'type':Sequelize[_0x49b2('0x4')]},'lastapp':{'type':Sequelize[_0x49b2('0x4')]},'lastdata':{'type':Sequelize[_0x49b2('0x4')]},'duration':{'type':Sequelize[_0x49b2('0x5')],'allowNull':![],'defaultValue':0x0},'billsec':{'type':Sequelize['INTEGER'],'allowNull':![],'defaultValue':0x0},'disposition':{'type':Sequelize[_0x49b2('0x4')]},'amaflags':{'type':Sequelize[_0x49b2('0x5')],'allowNull':![],'defaultValue':0x0},'accountcode':{'type':Sequelize[_0x49b2('0x4')]},'userfield':{'type':Sequelize[_0x49b2('0x4')]},'uniqueid':{'type':Sequelize[_0x49b2('0x4')]},'linkedid':{'type':Sequelize[_0x49b2('0x4')]},'sequence':{'type':Sequelize[_0x49b2('0x4')]},'peeraccount':{'type':Sequelize[_0x49b2('0x4')]},'type':{'type':Sequelize[_0x49b2('0x4')]},'tag':{'type':Sequelize[_0x49b2('0x4')]}}; \ No newline at end of file diff --git a/server/api/cdr/cdr.controller.js b/server/api/cdr/cdr.controller.js index 62407d5..a4882fa 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 _0xb34a=['name','map','rawAttributes','type','key','model','query','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','Cdr','includeAll','findAll','rows','catch','show','params','options','create','body','find','describe','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','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/environment','../../mysqldb','status','end','json','count','offset','limit','Content-Range','apply','reject','save','update','then','destroy','error','stack'];(function(_0x4551f6,_0x48151b){var _0x581dc2=function(_0x1842af){while(--_0x1842af){_0x4551f6['push'](_0x4551f6['shift']());}};_0x581dc2(++_0x48151b);}(_0xb34a,0x1ef));var _0xab34=function(_0x3ce41c,_0x252d49){_0x3ce41c=_0x3ce41c-0x0;var _0x28ff40=_0xb34a[_0x3ce41c];return _0x28ff40;};'use strict';var pdf=require(_0xab34('0x0'));var emlformat=require(_0xab34('0x1'));var rimraf=require(_0xab34('0x2'));var zipdir=require(_0xab34('0x3'));var jsonpatch=require(_0xab34('0x4'));var rp=require(_0xab34('0x5'));var moment=require(_0xab34('0x6'));var BPromise=require(_0xab34('0x7'));var Mustache=require(_0xab34('0x8'));var util=require(_0xab34('0x9'));var path=require(_0xab34('0xa'));var sox=require(_0xab34('0xb'));var csv=require('to-csv');var ejs=require(_0xab34('0xc'));var fs=require('fs');var _=require('lodash');var squel=require(_0xab34('0xd'));var crypto=require(_0xab34('0xe'));var jsforce=require(_0xab34('0xf'));var deskjs=require(_0xab34('0x10'));var toCsv=require(_0xab34('0x11'));var querystring=require(_0xab34('0x12'));var Papa=require(_0xab34('0x13'));var Redis=require(_0xab34('0x14'));var authService=require(_0xab34('0x15'));var qs=require(_0xab34('0x16'));var as=require(_0xab34('0x17'));var hardwareService=require(_0xab34('0x18'));var logger=require(_0xab34('0x19'))(_0xab34('0x1a'));var utils=require('../../config/utils');var config=require(_0xab34('0x1b'));var db=require(_0xab34('0x1c'))['db'];function respondWithStatusCode(_0x310461,_0x311356){_0x311356=_0x311356||0xcc;return function(_0x4751ae){if(_0x4751ae){return _0x310461['sendStatus'](_0x311356);}return _0x310461[_0xab34('0x1d')](_0x311356)[_0xab34('0x1e')]();};}function respondWithResult(_0x3ac439,_0x5d6280){_0x5d6280=_0x5d6280||0xc8;return function(_0x5e4fac){if(_0x5e4fac){return _0x3ac439[_0xab34('0x1d')](_0x5d6280)[_0xab34('0x1f')](_0x5e4fac);}};}function respondWithFilteredResult(_0x313e5f,_0x51bb52){return function(_0x3b870c){if(_0x3b870c){var _0x32cdf2=_0x3b870c[_0xab34('0x20')],_0x4d91fd=_0x51bb52[_0xab34('0x21')],_0xbef7d7=_0x51bb52[_0xab34('0x21')]+_0x51bb52[_0xab34('0x22')],_0x563b52;if(_0xbef7d7>=_0x32cdf2){_0xbef7d7=_0x32cdf2;_0x563b52=0xc8;}else{_0x563b52=0xce;}_0x313e5f[_0xab34('0x1d')](_0x563b52);return _0x313e5f['set'](_0xab34('0x23'),_0x4d91fd+'-'+_0xbef7d7+'/'+_0x32cdf2)[_0xab34('0x1f')](_0x3b870c);}return null;};}function patchUpdates(_0xcc4c33){return function(_0x566cb8){try{jsonpatch[_0xab34('0x24')](_0x566cb8,_0xcc4c33,!![]);}catch(_0x48579f){return BPromise[_0xab34('0x25')](_0x48579f);}return _0x566cb8[_0xab34('0x26')]();};}function saveUpdates(_0x26408e,_0x240ac){return function(_0x4f228c){if(_0x4f228c){return _0x4f228c[_0xab34('0x27')](_0x26408e)[_0xab34('0x28')](function(_0x486801){return _0x486801;});}return null;};}function removeEntity(_0x2dd938,_0x3072b5){return function(_0x2ef1bc){if(_0x2ef1bc){return _0x2ef1bc[_0xab34('0x29')]()[_0xab34('0x28')](function(){_0x2dd938[_0xab34('0x1d')](0xcc)[_0xab34('0x1e')]();});}};}function handleEntityNotFound(_0x5039bf,_0xe4fe2b){return function(_0x1a3e3e){if(!_0x1a3e3e){_0x5039bf['sendStatus'](0x194);}return _0x1a3e3e;};}function handleError(_0x4b3966,_0x4a1501){_0x4a1501=_0x4a1501||0x1f4;return function(_0x1ec04e){logger[_0xab34('0x2a')](_0x1ec04e[_0xab34('0x2b')]);if(_0x1ec04e['name']){delete _0x1ec04e[_0xab34('0x2c')];}_0x4b3966[_0xab34('0x1d')](_0x4a1501)['send'](_0x1ec04e);};}exports['index']=function(_0x3a07e3,_0x20c858){var _0x538203={},_0x239d28={},_0x4c56e2={'count':0x0,'rows':[]};var _0x1837c7=_[_0xab34('0x2d')](db['Cdr'][_0xab34('0x2e')],function(_0xe4751e){return{'name':_0xe4751e['fieldName'],'type':_0xe4751e[_0xab34('0x2f')][_0xab34('0x30')]};});_0x239d28[_0xab34('0x31')]=_['map'](_0x1837c7,_0xab34('0x2c'));_0x239d28[_0xab34('0x32')]=_[_0xab34('0x33')](_0x3a07e3['query']);_0x239d28[_0xab34('0x34')]=_[_0xab34('0x35')](_0x239d28['model'],_0x239d28[_0xab34('0x32')]);_0x538203[_0xab34('0x36')]=_['intersection'](_0x239d28['model'],qs[_0xab34('0x37')](_0x3a07e3[_0xab34('0x32')][_0xab34('0x37')]));_0x538203[_0xab34('0x36')]=_0x538203[_0xab34('0x36')]['length']?_0x538203['attributes']:_0x239d28[_0xab34('0x31')];if(!_0x3a07e3[_0xab34('0x32')][_0xab34('0x38')](_0xab34('0x39'))){_0x538203[_0xab34('0x22')]=qs[_0xab34('0x22')](_0x3a07e3[_0xab34('0x32')][_0xab34('0x22')]);_0x538203[_0xab34('0x21')]=qs[_0xab34('0x21')](_0x3a07e3[_0xab34('0x32')]['offset']);}_0x538203[_0xab34('0x3a')]=qs[_0xab34('0x3b')](_0x3a07e3[_0xab34('0x32')][_0xab34('0x3b')]);_0x538203[_0xab34('0x3c')]=qs[_0xab34('0x34')](_[_0xab34('0x3d')](_0x3a07e3[_0xab34('0x32')],_0x239d28[_0xab34('0x34')]));if(_0x3a07e3['query'][_0xab34('0x3e')]){_0x538203['where']=_[_0xab34('0x3f')](_0x538203[_0xab34('0x3c')],{'$or':_['map'](_0x1837c7,function(_0x4672e8){if(_0x4672e8['type']!==_0xab34('0x40')){var _0x5d492a={};_0x5d492a[_0x4672e8[_0xab34('0x2c')]]={'$like':'%'+_0x3a07e3['query'][_0xab34('0x3e')]+'%'};return _0x5d492a;}})});}_0x538203=_['merge']({},_0x538203,_0x3a07e3['options']);var _0x3e647e={'where':_0x538203[_0xab34('0x3c')]};return db[_0xab34('0x41')][_0xab34('0x20')](_0x3e647e)['then'](function(_0x1ee37f){_0x4c56e2[_0xab34('0x20')]=_0x1ee37f;if(_0x3a07e3[_0xab34('0x32')][_0xab34('0x42')]){_0x538203['include']=[{'all':!![]}];}return db[_0xab34('0x41')][_0xab34('0x43')](_0x538203);})[_0xab34('0x28')](function(_0x5f06d5){_0x4c56e2[_0xab34('0x44')]=_0x5f06d5;return _0x4c56e2;})[_0xab34('0x28')](respondWithFilteredResult(_0x20c858,_0x538203))[_0xab34('0x45')](handleError(_0x20c858,null));};exports[_0xab34('0x46')]=function(_0x186d66,_0x368ee8){var _0x148833={'raw':!![],'where':{'id':_0x186d66[_0xab34('0x47')]['id']}},_0x349de6={};_0x349de6[_0xab34('0x31')]=_['keys'](db[_0xab34('0x41')][_0xab34('0x2e')]);_0x349de6['query']=_[_0xab34('0x33')](_0x186d66[_0xab34('0x32')]);_0x349de6[_0xab34('0x34')]=_[_0xab34('0x35')](_0x349de6['model'],_0x349de6[_0xab34('0x32')]);_0x148833[_0xab34('0x36')]=_['intersection'](_0x349de6[_0xab34('0x31')],qs[_0xab34('0x37')](_0x186d66[_0xab34('0x32')]['fields']));_0x148833[_0xab34('0x36')]=_0x148833['attributes']['length']?_0x148833[_0xab34('0x36')]:_0x349de6[_0xab34('0x31')];if(_0x186d66['query'][_0xab34('0x42')]){_0x148833['include']=[{'all':!![]}];}_0x148833=_[_0xab34('0x3f')]({},_0x148833,_0x186d66[_0xab34('0x48')]);return db['Cdr']['find'](_0x148833)[_0xab34('0x28')](handleEntityNotFound(_0x368ee8,null))['then'](respondWithResult(_0x368ee8,null))[_0xab34('0x45')](handleError(_0x368ee8,null));};exports['create']=function(_0x4cc12b,_0x531285){return db[_0xab34('0x41')][_0xab34('0x49')](_0x4cc12b['body'],{})[_0xab34('0x28')](respondWithResult(_0x531285,0xc9))[_0xab34('0x45')](handleError(_0x531285,null));};exports[_0xab34('0x27')]=function(_0x6cf4e0,_0x17adec){if(_0x6cf4e0[_0xab34('0x4a')]['id']){delete _0x6cf4e0[_0xab34('0x4a')]['id'];}return db[_0xab34('0x41')][_0xab34('0x4b')]({'where':{'id':_0x6cf4e0[_0xab34('0x47')]['id']}})[_0xab34('0x28')](handleEntityNotFound(_0x17adec,null))[_0xab34('0x28')](saveUpdates(_0x6cf4e0[_0xab34('0x4a')],null))[_0xab34('0x28')](respondWithResult(_0x17adec,null))[_0xab34('0x45')](handleError(_0x17adec,null));};exports[_0xab34('0x29')]=function(_0x3472b0,_0xec0ab){return db[_0xab34('0x41')][_0xab34('0x4b')]({'where':{'id':_0x3472b0['params']['id']}})[_0xab34('0x28')](handleEntityNotFound(_0xec0ab,null))[_0xab34('0x28')](removeEntity(_0xec0ab,null))[_0xab34('0x45')](handleError(_0xec0ab,null));};exports['describe']=function(_0xeb858,_0x42fec7){return db['Cdr'][_0xab34('0x4c')]()[_0xab34('0x28')](respondWithResult(_0x42fec7,null))[_0xab34('0x45')](handleError(_0x42fec7,null));}; \ No newline at end of file +var _0x75fe=['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','limit','set','Content-Range','apply','reject','save','update','destroy','then','stack','name','send','map','Cdr','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','show','params','length','catch','create','body','find','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','sox','to-csv','lodash','squel','crypto','jsforce'];(function(_0x2053cb,_0x234c43){var _0x3f044d=function(_0x30ae75){while(--_0x30ae75){_0x2053cb['push'](_0x2053cb['shift']());}};_0x3f044d(++_0x234c43);}(_0x75fe,0xdc));var _0xe75f=function(_0x4ad826,_0x4e7fd9){_0x4ad826=_0x4ad826-0x0;var _0x508d16=_0x75fe[_0x4ad826];return _0x508d16;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0xe75f('0x0'));var rimraf=require(_0xe75f('0x1'));var zipdir=require(_0xe75f('0x2'));var jsonpatch=require(_0xe75f('0x3'));var rp=require(_0xe75f('0x4'));var moment=require(_0xe75f('0x5'));var BPromise=require(_0xe75f('0x6'));var Mustache=require('mustache');var util=require(_0xe75f('0x7'));var path=require('path');var sox=require(_0xe75f('0x8'));var csv=require(_0xe75f('0x9'));var ejs=require('ejs');var fs=require('fs');var _=require(_0xe75f('0xa'));var squel=require(_0xe75f('0xb'));var crypto=require(_0xe75f('0xc'));var jsforce=require(_0xe75f('0xd'));var deskjs=require(_0xe75f('0xe'));var toCsv=require(_0xe75f('0x9'));var querystring=require(_0xe75f('0xf'));var Papa=require(_0xe75f('0x10'));var Redis=require(_0xe75f('0x11'));var authService=require(_0xe75f('0x12'));var qs=require(_0xe75f('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xe75f('0x14'));var logger=require(_0xe75f('0x15'))(_0xe75f('0x16'));var utils=require(_0xe75f('0x17'));var config=require(_0xe75f('0x18'));var db=require(_0xe75f('0x19'))['db'];function respondWithStatusCode(_0x3f0035,_0x372586){_0x372586=_0x372586||0xcc;return function(_0x291de6){if(_0x291de6){return _0x3f0035[_0xe75f('0x1a')](_0x372586);}return _0x3f0035[_0xe75f('0x1b')](_0x372586)[_0xe75f('0x1c')]();};}function respondWithResult(_0x13b239,_0xe1927f){_0xe1927f=_0xe1927f||0xc8;return function(_0x12eeb1){if(_0x12eeb1){return _0x13b239[_0xe75f('0x1b')](_0xe1927f)[_0xe75f('0x1d')](_0x12eeb1);}};}function respondWithFilteredResult(_0x3c90db,_0x5df96f){return function(_0x2e691b){if(_0x2e691b){var _0x15e539=_0x2e691b[_0xe75f('0x1e')],_0x3a6b57=_0x5df96f[_0xe75f('0x1f')],_0x1b8f48=_0x5df96f['offset']+_0x5df96f[_0xe75f('0x20')],_0x40c1ad;if(_0x1b8f48>=_0x15e539){_0x1b8f48=_0x15e539;_0x40c1ad=0xc8;}else{_0x40c1ad=0xce;}_0x3c90db[_0xe75f('0x1b')](_0x40c1ad);return _0x3c90db[_0xe75f('0x21')](_0xe75f('0x22'),_0x3a6b57+'-'+_0x1b8f48+'/'+_0x15e539)[_0xe75f('0x1d')](_0x2e691b);}return null;};}function patchUpdates(_0x52f3a9){return function(_0x35c710){try{jsonpatch[_0xe75f('0x23')](_0x35c710,_0x52f3a9,!![]);}catch(_0x5125a9){return BPromise[_0xe75f('0x24')](_0x5125a9);}return _0x35c710[_0xe75f('0x25')]();};}function saveUpdates(_0x521898,_0x12c930){return function(_0xfbac25){if(_0xfbac25){return _0xfbac25[_0xe75f('0x26')](_0x521898)['then'](function(_0x18e5b8){return _0x18e5b8;});}return null;};}function removeEntity(_0x28a372,_0x4c9347){return function(_0x5a3cd7){if(_0x5a3cd7){return _0x5a3cd7[_0xe75f('0x27')]()[_0xe75f('0x28')](function(){_0x28a372[_0xe75f('0x1b')](0xcc)[_0xe75f('0x1c')]();});}};}function handleEntityNotFound(_0x23fa51,_0x26f69e){return function(_0x39bd0a){if(!_0x39bd0a){_0x23fa51['sendStatus'](0x194);}return _0x39bd0a;};}function handleError(_0x2559ab,_0x56d267){_0x56d267=_0x56d267||0x1f4;return function(_0x272336){logger['error'](_0x272336[_0xe75f('0x29')]);if(_0x272336[_0xe75f('0x2a')]){delete _0x272336[_0xe75f('0x2a')];}_0x2559ab[_0xe75f('0x1b')](_0x56d267)[_0xe75f('0x2b')](_0x272336);};}exports['index']=function(_0xe759ec,_0x475e64){var _0x452607={},_0x164905={},_0xc76040={'count':0x0,'rows':[]};var _0x158d3a=_[_0xe75f('0x2c')](db[_0xe75f('0x2d')][_0xe75f('0x2e')],function(_0x3a9764){return{'name':_0x3a9764[_0xe75f('0x2f')],'type':_0x3a9764[_0xe75f('0x30')][_0xe75f('0x31')]};});_0x164905[_0xe75f('0x32')]=_[_0xe75f('0x2c')](_0x158d3a,_0xe75f('0x2a'));_0x164905[_0xe75f('0x33')]=_[_0xe75f('0x34')](_0xe759ec[_0xe75f('0x33')]);_0x164905[_0xe75f('0x35')]=_[_0xe75f('0x36')](_0x164905[_0xe75f('0x32')],_0x164905[_0xe75f('0x33')]);_0x452607[_0xe75f('0x37')]=_[_0xe75f('0x36')](_0x164905[_0xe75f('0x32')],qs[_0xe75f('0x38')](_0xe759ec['query']['fields']));_0x452607[_0xe75f('0x37')]=_0x452607[_0xe75f('0x37')]['length']?_0x452607[_0xe75f('0x37')]:_0x164905['model'];if(!_0xe759ec[_0xe75f('0x33')][_0xe75f('0x39')](_0xe75f('0x3a'))){_0x452607['limit']=qs[_0xe75f('0x20')](_0xe759ec['query'][_0xe75f('0x20')]);_0x452607[_0xe75f('0x1f')]=qs[_0xe75f('0x1f')](_0xe759ec[_0xe75f('0x33')][_0xe75f('0x1f')]);}_0x452607['order']=qs[_0xe75f('0x3b')](_0xe759ec['query'][_0xe75f('0x3b')]);_0x452607[_0xe75f('0x3c')]=qs['filters'](_[_0xe75f('0x3d')](_0xe759ec[_0xe75f('0x33')],_0x164905[_0xe75f('0x35')]));if(_0xe759ec['query'][_0xe75f('0x3e')]){_0x452607[_0xe75f('0x3c')]=_[_0xe75f('0x3f')](_0x452607['where'],{'$or':_['map'](_0x158d3a,function(_0x1edbf5){if(_0x1edbf5[_0xe75f('0x30')]!==_0xe75f('0x40')){var _0x2bee69={};_0x2bee69[_0x1edbf5[_0xe75f('0x2a')]]={'$like':'%'+_0xe759ec['query'][_0xe75f('0x3e')]+'%'};return _0x2bee69;}})});}_0x452607=_[_0xe75f('0x3f')]({},_0x452607,_0xe759ec[_0xe75f('0x41')]);var _0x41b433={'where':_0x452607[_0xe75f('0x3c')]};return db['Cdr']['count'](_0x41b433)[_0xe75f('0x28')](function(_0x4319f2){_0xc76040[_0xe75f('0x1e')]=_0x4319f2;if(_0xe759ec[_0xe75f('0x33')][_0xe75f('0x42')]){_0x452607[_0xe75f('0x43')]=[{'all':!![]}];}return db['Cdr'][_0xe75f('0x44')](_0x452607);})['then'](function(_0x4bae6f){_0xc76040[_0xe75f('0x45')]=_0x4bae6f;return _0xc76040;})['then'](respondWithFilteredResult(_0x475e64,_0x452607))['catch'](handleError(_0x475e64,null));};exports[_0xe75f('0x46')]=function(_0x420f6d,_0x16352f){var _0x2baef9={'raw':!![],'where':{'id':_0x420f6d[_0xe75f('0x47')]['id']}},_0x4e9b23={};_0x4e9b23[_0xe75f('0x32')]=_['keys'](db[_0xe75f('0x2d')][_0xe75f('0x2e')]);_0x4e9b23[_0xe75f('0x33')]=_[_0xe75f('0x34')](_0x420f6d[_0xe75f('0x33')]);_0x4e9b23['filters']=_[_0xe75f('0x36')](_0x4e9b23[_0xe75f('0x32')],_0x4e9b23['query']);_0x2baef9['attributes']=_['intersection'](_0x4e9b23['model'],qs[_0xe75f('0x38')](_0x420f6d['query'][_0xe75f('0x38')]));_0x2baef9[_0xe75f('0x37')]=_0x2baef9['attributes'][_0xe75f('0x48')]?_0x2baef9['attributes']:_0x4e9b23[_0xe75f('0x32')];if(_0x420f6d['query'][_0xe75f('0x42')]){_0x2baef9[_0xe75f('0x43')]=[{'all':!![]}];}_0x2baef9=_[_0xe75f('0x3f')]({},_0x2baef9,_0x420f6d[_0xe75f('0x41')]);return db['Cdr']['find'](_0x2baef9)[_0xe75f('0x28')](handleEntityNotFound(_0x16352f,null))[_0xe75f('0x28')](respondWithResult(_0x16352f,null))[_0xe75f('0x49')](handleError(_0x16352f,null));};exports[_0xe75f('0x4a')]=function(_0x4d46fc,_0x11d2c0){return db[_0xe75f('0x2d')][_0xe75f('0x4a')](_0x4d46fc[_0xe75f('0x4b')],{})[_0xe75f('0x28')](respondWithResult(_0x11d2c0,0xc9))[_0xe75f('0x49')](handleError(_0x11d2c0,null));};exports['update']=function(_0x27683f,_0x13f726){if(_0x27683f[_0xe75f('0x4b')]['id']){delete _0x27683f[_0xe75f('0x4b')]['id'];}return db[_0xe75f('0x2d')][_0xe75f('0x4c')]({'where':{'id':_0x27683f[_0xe75f('0x47')]['id']}})[_0xe75f('0x28')](handleEntityNotFound(_0x13f726,null))[_0xe75f('0x28')](saveUpdates(_0x27683f[_0xe75f('0x4b')],null))[_0xe75f('0x28')](respondWithResult(_0x13f726,null))[_0xe75f('0x49')](handleError(_0x13f726,null));};exports[_0xe75f('0x27')]=function(_0x44b058,_0x26ccb5){return db[_0xe75f('0x2d')]['find']({'where':{'id':_0x44b058[_0xe75f('0x47')]['id']}})[_0xe75f('0x28')](handleEntityNotFound(_0x26ccb5,null))[_0xe75f('0x28')](removeEntity(_0x26ccb5,null))[_0xe75f('0x49')](handleError(_0x26ccb5,null));};exports[_0xe75f('0x4d')]=function(_0x1b5081,_0x30d9d0){return db['Cdr'][_0xe75f('0x4d')]()[_0xe75f('0x28')](respondWithResult(_0x30d9d0,null))[_0xe75f('0x49')](handleError(_0x30d9d0,null));}; \ No newline at end of file diff --git a/server/api/cdr/cdr.model.js b/server/api/cdr/cdr.model.js index d114d4e..8cf466a 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 _0xeda8=['exports','define','cdr','accountcode','calldate','dst','src','uniqueid','lodash','util','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./cdr.attributes'];(function(_0x1ad799,_0x2158fa){var _0x29159d=function(_0x242d64){while(--_0x242d64){_0x1ad799['push'](_0x1ad799['shift']());}};_0x29159d(++_0x2158fa);}(_0xeda8,0x104));var _0x8eda=function(_0x52611b,_0x2d5686){_0x52611b=_0x52611b-0x0;var _0xc3c0cc=_0xeda8[_0x52611b];return _0xc3c0cc;};'use strict';var _=require(_0x8eda('0x0'));var util=require(_0x8eda('0x1'));var logger=require('../../config/logger')(_0x8eda('0x2'));var moment=require(_0x8eda('0x3'));var BPromise=require(_0x8eda('0x4'));var rp=require(_0x8eda('0x5'));var fs=require('fs');var path=require(_0x8eda('0x6'));var rimraf=require(_0x8eda('0x7'));var config=require(_0x8eda('0x8'));var attributes=require(_0x8eda('0x9'));module[_0x8eda('0xa')]=function(_0x1f3556,_0x349361){return _0x1f3556[_0x8eda('0xb')]('Cdr',attributes,{'tableName':_0x8eda('0xc'),'paranoid':![],'indexes':[{'name':_0x8eda('0xd'),'fields':[_0x8eda('0xd')]},{'name':_0x8eda('0xe'),'fields':['calldate']},{'name':'disposition','fields':['disposition']},{'name':'dst','fields':[_0x8eda('0xf')]},{'name':_0x8eda('0x10'),'fields':[_0x8eda('0x10')]},{'name':'uniqueid','fields':[_0x8eda('0x11')]}],'timestamps':![]});}; \ No newline at end of file +var _0xe3da=['accountcode','disposition','dst','src','uniqueid','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./cdr.attributes','exports','define','Cdr'];(function(_0x296f19,_0x4e84dc){var _0x4309bf=function(_0x45b694){while(--_0x45b694){_0x296f19['push'](_0x296f19['shift']());}};_0x4309bf(++_0x4e84dc);}(_0xe3da,0x1cd));var _0xae3d=function(_0x57b54c,_0x54ce0d){_0x57b54c=_0x57b54c-0x0;var _0x59cc19=_0xe3da[_0x57b54c];return _0x59cc19;};'use strict';var _=require(_0xae3d('0x0'));var util=require(_0xae3d('0x1'));var logger=require(_0xae3d('0x2'))(_0xae3d('0x3'));var moment=require(_0xae3d('0x4'));var BPromise=require(_0xae3d('0x5'));var rp=require(_0xae3d('0x6'));var fs=require('fs');var path=require(_0xae3d('0x7'));var rimraf=require(_0xae3d('0x8'));var config=require(_0xae3d('0x9'));var attributes=require(_0xae3d('0xa'));module[_0xae3d('0xb')]=function(_0xa9a1a,_0xa54808){return _0xa9a1a[_0xae3d('0xc')](_0xae3d('0xd'),attributes,{'tableName':'cdr','paranoid':![],'indexes':[{'name':_0xae3d('0xe'),'fields':[_0xae3d('0xe')]},{'name':'calldate','fields':['calldate']},{'name':_0xae3d('0xf'),'fields':[_0xae3d('0xf')]},{'name':_0xae3d('0x10'),'fields':[_0xae3d('0x10')]},{'name':_0xae3d('0x11'),'fields':[_0xae3d('0x11')]},{'name':'uniqueid','fields':[_0xae3d('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 478aa2c..b889a1c 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 _0x0f14=['randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','client','http','request','then','info','Cdr,\x20%s,\x20%s','request\x20sent','debug','Cdr,\x20%s,\x20%s,\x20%s','stringify','error','message','result','lodash','util','moment','bluebird'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x0f14,0x9d));var _0x40f1=function(_0x2a79a5,_0x580594){_0x2a79a5=_0x2a79a5-0x0;var _0x1902eb=_0x0f14[_0x2a79a5];return _0x1902eb;};'use strict';var _=require(_0x40f1('0x0'));var util=require(_0x40f1('0x1'));var moment=require(_0x40f1('0x2'));var BPromise=require(_0x40f1('0x3'));var rs=require(_0x40f1('0x4'));var fs=require('fs');var Redis=require(_0x40f1('0x5'));var db=require(_0x40f1('0x6'))['db'];var utils=require(_0x40f1('0x7'));var logger=require('../../config/logger')(_0x40f1('0x8'));var config=require(_0x40f1('0x9'));var jayson=require('jayson/promise');var client=jayson[_0x40f1('0xa')][_0x40f1('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x4d22c6,_0x30c2e4,_0x4fca53){return new BPromise(function(_0x37e3b9,_0x2c55d6){return client[_0x40f1('0xc')](_0x4d22c6,_0x4fca53)[_0x40f1('0xd')](function(_0xbcecf2){logger[_0x40f1('0xe')](_0x40f1('0xf'),_0x30c2e4,_0x40f1('0x10'));logger[_0x40f1('0x11')](_0x40f1('0x12'),_0x30c2e4,'request\x20sent',JSON[_0x40f1('0x13')](_0xbcecf2));if(_0xbcecf2[_0x40f1('0x14')]){if(_0xbcecf2[_0x40f1('0x14')]['code']===0x1f4){logger['error'](_0x40f1('0xf'),_0x30c2e4,_0xbcecf2[_0x40f1('0x14')]['message']);return _0x2c55d6(_0xbcecf2[_0x40f1('0x14')][_0x40f1('0x15')]);}logger['error'](_0x40f1('0xf'),_0x30c2e4,_0xbcecf2[_0x40f1('0x14')][_0x40f1('0x15')]);return _0x37e3b9(_0xbcecf2[_0x40f1('0x14')][_0x40f1('0x15')]);}else{logger[_0x40f1('0xe')]('Cdr,\x20%s,\x20%s',_0x30c2e4,'request\x20sent');_0x37e3b9(_0xbcecf2[_0x40f1('0x16')]['message']);}})['catch'](function(_0x415680){logger[_0x40f1('0x14')](_0x40f1('0xf'),_0x30c2e4,_0x415680);_0x2c55d6(_0x415680);});});} \ No newline at end of file +var _0x6990=['../../config/logger','rpc','jayson/promise','http','request','then','info','request\x20sent','Cdr,\x20%s,\x20%s,\x20%s','stringify','error','code','Cdr,\x20%s,\x20%s','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils'];(function(_0x397e5f,_0x454c8f){var _0x5302b8=function(_0x1a29ef){while(--_0x1a29ef){_0x397e5f['push'](_0x397e5f['shift']());}};_0x5302b8(++_0x454c8f);}(_0x6990,0x180));var _0x0699=function(_0x40fe75,_0x3507eb){_0x40fe75=_0x40fe75-0x0;var _0x52c53a=_0x6990[_0x40fe75];return _0x52c53a;};'use strict';var _=require(_0x0699('0x0'));var util=require(_0x0699('0x1'));var moment=require(_0x0699('0x2'));var BPromise=require(_0x0699('0x3'));var rs=require(_0x0699('0x4'));var fs=require('fs');var Redis=require(_0x0699('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x0699('0x6'));var logger=require(_0x0699('0x7'))(_0x0699('0x8'));var config=require('../../config/environment');var jayson=require(_0x0699('0x9'));var client=jayson['client'][_0x0699('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x4bf342,_0x3e9252,_0x377f0c){return new BPromise(function(_0x2b2a2d,_0xc28be8){return client[_0x0699('0xb')](_0x4bf342,_0x377f0c)[_0x0699('0xc')](function(_0x49c383){logger[_0x0699('0xd')]('Cdr,\x20%s,\x20%s',_0x3e9252,_0x0699('0xe'));logger['debug'](_0x0699('0xf'),_0x3e9252,'request\x20sent',JSON[_0x0699('0x10')](_0x49c383));if(_0x49c383[_0x0699('0x11')]){if(_0x49c383[_0x0699('0x11')][_0x0699('0x12')]===0x1f4){logger[_0x0699('0x11')](_0x0699('0x13'),_0x3e9252,_0x49c383['error'][_0x0699('0x14')]);return _0xc28be8(_0x49c383['error'][_0x0699('0x14')]);}logger[_0x0699('0x11')]('Cdr,\x20%s,\x20%s',_0x3e9252,_0x49c383[_0x0699('0x11')][_0x0699('0x14')]);return _0x2b2a2d(_0x49c383[_0x0699('0x11')][_0x0699('0x14')]);}else{logger['info'](_0x0699('0x13'),_0x3e9252,_0x0699('0xe'));_0x2b2a2d(_0x49c383[_0x0699('0x15')]['message']);}})[_0x0699('0x16')](function(_0x5233cf){logger['error']('Cdr,\x20%s,\x20%s',_0x3e9252,_0x5233cf);_0xc28be8(_0x5233cf);});});} \ No newline at end of file diff --git a/server/api/cdr/index.js b/server/api/cdr/index.js index 4a9f716..52cc02c 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 _0xcd8c=['../../components/auth/service','../../config/environment','./cdr.controller','get','isAuthenticated','index','/describe','describe','show','post','put','/:id','destroy','exports','multer','util','path','connect-timeout','express','Router'];(function(_0x1beef3,_0x57c4b8){var _0x5af964=function(_0x36f463){while(--_0x36f463){_0x1beef3['push'](_0x1beef3['shift']());}};_0x5af964(++_0x57c4b8);}(_0xcd8c,0xd6));var _0xccd8=function(_0x4cbdb7,_0x1b82f6){_0x4cbdb7=_0x4cbdb7-0x0;var _0x4ecb18=_0xcd8c[_0x4cbdb7];return _0x4ecb18;};'use strict';var multer=require(_0xccd8('0x0'));var util=require(_0xccd8('0x1'));var path=require(_0xccd8('0x2'));var timeout=require(_0xccd8('0x3'));var express=require(_0xccd8('0x4'));var router=express[_0xccd8('0x5')]();var auth=require(_0xccd8('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0xccd8('0x7'));var controller=require(_0xccd8('0x8'));router[_0xccd8('0x9')]('/',auth[_0xccd8('0xa')](),controller[_0xccd8('0xb')]);router[_0xccd8('0x9')](_0xccd8('0xc'),auth[_0xccd8('0xa')](),controller[_0xccd8('0xd')]);router[_0xccd8('0x9')]('/:id',auth[_0xccd8('0xa')](),controller[_0xccd8('0xe')]);router[_0xccd8('0xf')]('/',auth[_0xccd8('0xa')](),controller['create']);router[_0xccd8('0x10')](_0xccd8('0x11'),auth[_0xccd8('0xa')](),controller['update']);router['delete'](_0xccd8('0x11'),auth[_0xccd8('0xa')](),controller[_0xccd8('0x12')]);module[_0xccd8('0x13')]=router; \ No newline at end of file +var _0x016d=['multer','express','../../components/auth/service','../../components/interaction/service','../../config/environment','./cdr.controller','get','index','/describe','isAuthenticated','describe','/:id','show','post','create','put','update','delete','destroy'];(function(_0x3b380d,_0x4bf247){var _0x54502b=function(_0x35d207){while(--_0x35d207){_0x3b380d['push'](_0x3b380d['shift']());}};_0x54502b(++_0x4bf247);}(_0x016d,0xbe));var _0xd016=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x016d[_0x20a584];return _0x4b41a8;};'use strict';var multer=require(_0xd016('0x0'));var util=require('util');var path=require('path');var timeout=require('connect-timeout');var express=require(_0xd016('0x1'));var router=express['Router']();var auth=require(_0xd016('0x2'));var interaction=require(_0xd016('0x3'));var config=require(_0xd016('0x4'));var controller=require(_0xd016('0x5'));router[_0xd016('0x6')]('/',auth['isAuthenticated'](),controller[_0xd016('0x7')]);router[_0xd016('0x6')](_0xd016('0x8'),auth[_0xd016('0x9')](),controller[_0xd016('0xa')]);router['get'](_0xd016('0xb'),auth[_0xd016('0x9')](),controller[_0xd016('0xc')]);router[_0xd016('0xd')]('/',auth['isAuthenticated'](),controller[_0xd016('0xe')]);router[_0xd016('0xf')](_0xd016('0xb'),auth['isAuthenticated'](),controller[_0xd016('0x10')]);router[_0xd016('0x11')](_0xd016('0xb'),auth[_0xd016('0x9')](),controller[_0xd016('0x12')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/chatApplication/chatApplication.attributes.js b/server/api/chatApplication/chatApplication.attributes.js index 0cb042b..c1e3062 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 _0x6c6f=['TEXT','*,*,*,*','exports','INTEGER','STRING'];(function(_0x4fd9b4,_0xca50cf){var _0x486cab=function(_0x14c51d){while(--_0x14c51d){_0x4fd9b4['push'](_0x4fd9b4['shift']());}};_0x486cab(++_0xca50cf);}(_0x6c6f,0x1ec));var _0xf6c6=function(_0x38e680,_0x2fa8aa){_0x38e680=_0x38e680-0x0;var _0x53c320=_0x6c6f[_0x38e680];return _0x53c320;};'use strict';var Sequelize=require('sequelize');module[_0xf6c6('0x0')]={'priority':{'type':Sequelize[_0xf6c6('0x1')],'allowNull':![]},'app':{'type':Sequelize[_0xf6c6('0x2')],'allowNull':![],'defaultValue':'noop'},'appdata':{'type':Sequelize[_0xf6c6('0x3')]()},'description':{'type':Sequelize['STRING']},'interval':{'type':Sequelize[_0xf6c6('0x2')],'defaultValue':_0xf6c6('0x4')}}; \ No newline at end of file +var _0x5f61=['noop','TEXT','*,*,*,*','sequelize','exports','STRING'];(function(_0x185ce4,_0x3268d7){var _0x421592=function(_0x290bca){while(--_0x290bca){_0x185ce4['push'](_0x185ce4['shift']());}};_0x421592(++_0x3268d7);}(_0x5f61,0x93));var _0x15f6=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x5f61[_0x20a584];return _0x4b41a8;};'use strict';var Sequelize=require(_0x15f6('0x0'));module[_0x15f6('0x1')]={'priority':{'type':Sequelize['INTEGER'],'allowNull':![]},'app':{'type':Sequelize[_0x15f6('0x2')],'allowNull':![],'defaultValue':_0x15f6('0x3')},'appdata':{'type':Sequelize[_0x15f6('0x4')]()},'description':{'type':Sequelize['STRING']},'interval':{'type':Sequelize[_0x15f6('0x2')],'defaultValue':_0x15f6('0x5')}}; \ No newline at end of file diff --git a/server/api/chatApplication/chatApplication.controller.js b/server/api/chatApplication/chatApplication.controller.js index 9df6658..f6afad0 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 _0xffa7=['body','ChatApplication','find','html-pdf','eml-format','fast-json-patch','moment','mustache','path','to-csv','ejs','lodash','squel','jsforce','desk.js','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','count','offset','limit','set','json','reject','save','update','then','destroy','end','stack','name','send','show','params','rawAttributes','query','keys','filters','intersection','attributes','model','fields','length','includeAll','merge','options','catch'];(function(_0x1694f5,_0x49b7c3){var _0x5b4321=function(_0x58c183){while(--_0x58c183){_0x1694f5['push'](_0x1694f5['shift']());}};_0x5b4321(++_0x49b7c3);}(_0xffa7,0xd3));var _0x7ffa=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0xffa7[_0x14add3];return _0x4a174f;};'use strict';var pdf=require(_0x7ffa('0x0'));var emlformat=require(_0x7ffa('0x1'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x7ffa('0x2'));var rp=require('request-promise');var moment=require(_0x7ffa('0x3'));var BPromise=require('bluebird');var Mustache=require(_0x7ffa('0x4'));var util=require('util');var path=require(_0x7ffa('0x5'));var sox=require('sox');var csv=require(_0x7ffa('0x6'));var ejs=require(_0x7ffa('0x7'));var fs=require('fs');var _=require(_0x7ffa('0x8'));var squel=require(_0x7ffa('0x9'));var crypto=require('crypto');var jsforce=require(_0x7ffa('0xa'));var deskjs=require(_0x7ffa('0xb'));var toCsv=require(_0x7ffa('0x6'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x7ffa('0xc'));var as=require(_0x7ffa('0xd'));var hardwareService=require(_0x7ffa('0xe'));var logger=require('../../config/logger')('api');var utils=require(_0x7ffa('0xf'));var config=require(_0x7ffa('0x10'));var db=require(_0x7ffa('0x11'))['db'];function respondWithStatusCode(_0xffe96c,_0x115258){_0x115258=_0x115258||0xcc;return function(_0x28cec1){if(_0x28cec1){return _0xffe96c[_0x7ffa('0x12')](_0x115258);}return _0xffe96c[_0x7ffa('0x13')](_0x115258)['end']();};}function respondWithResult(_0x54c695,_0x277f58){_0x277f58=_0x277f58||0xc8;return function(_0x48d98a){if(_0x48d98a){return _0x54c695[_0x7ffa('0x13')](_0x277f58)['json'](_0x48d98a);}};}function respondWithFilteredResult(_0x5d176f,_0x38e68c){return function(_0x4565e6){if(_0x4565e6){var _0x1b2737=_0x4565e6[_0x7ffa('0x14')],_0x19d343=_0x38e68c[_0x7ffa('0x15')],_0x158646=_0x38e68c[_0x7ffa('0x15')]+_0x38e68c[_0x7ffa('0x16')],_0x906c84;if(_0x158646>=_0x1b2737){_0x158646=_0x1b2737;_0x906c84=0xc8;}else{_0x906c84=0xce;}_0x5d176f['status'](_0x906c84);return _0x5d176f[_0x7ffa('0x17')]('Content-Range',_0x19d343+'-'+_0x158646+'/'+_0x1b2737)[_0x7ffa('0x18')](_0x4565e6);}return null;};}function patchUpdates(_0x8546a3){return function(_0x5a31d1){try{jsonpatch['apply'](_0x5a31d1,_0x8546a3,!![]);}catch(_0x59cb43){return BPromise[_0x7ffa('0x19')](_0x59cb43);}return _0x5a31d1[_0x7ffa('0x1a')]();};}function saveUpdates(_0x2c31f6,_0x115bb8){return function(_0xca3616){if(_0xca3616){return _0xca3616[_0x7ffa('0x1b')](_0x2c31f6)[_0x7ffa('0x1c')](function(_0x5591fb){return _0x5591fb;});}return null;};}function removeEntity(_0x57c48b,_0x5166e8){return function(_0x24af56){if(_0x24af56){return _0x24af56[_0x7ffa('0x1d')]()[_0x7ffa('0x1c')](function(){_0x57c48b[_0x7ffa('0x13')](0xcc)[_0x7ffa('0x1e')]();});}};}function handleEntityNotFound(_0x48c212,_0x456bac){return function(_0x43ddec){if(!_0x43ddec){_0x48c212['sendStatus'](0x194);}return _0x43ddec;};}function handleError(_0x497d82,_0x3ac806){_0x3ac806=_0x3ac806||0x1f4;return function(_0x327608){logger['error'](_0x327608[_0x7ffa('0x1f')]);if(_0x327608['name']){delete _0x327608[_0x7ffa('0x20')];}_0x497d82['status'](_0x3ac806)[_0x7ffa('0x21')](_0x327608);};}exports[_0x7ffa('0x22')]=function(_0x86ae31,_0x57da30){var _0x3f2874={'raw':!![],'where':{'id':_0x86ae31[_0x7ffa('0x23')]['id']}},_0x13cfc9={};_0x13cfc9['model']=_['keys'](db['ChatApplication'][_0x7ffa('0x24')]);_0x13cfc9[_0x7ffa('0x25')]=_[_0x7ffa('0x26')](_0x86ae31[_0x7ffa('0x25')]);_0x13cfc9[_0x7ffa('0x27')]=_[_0x7ffa('0x28')](_0x13cfc9['model'],_0x13cfc9[_0x7ffa('0x25')]);_0x3f2874[_0x7ffa('0x29')]=_[_0x7ffa('0x28')](_0x13cfc9[_0x7ffa('0x2a')],qs[_0x7ffa('0x2b')](_0x86ae31['query'][_0x7ffa('0x2b')]));_0x3f2874[_0x7ffa('0x29')]=_0x3f2874['attributes'][_0x7ffa('0x2c')]?_0x3f2874[_0x7ffa('0x29')]:_0x13cfc9[_0x7ffa('0x2a')];if(_0x86ae31[_0x7ffa('0x25')][_0x7ffa('0x2d')]){_0x3f2874['include']=[{'all':!![]}];}_0x3f2874=_[_0x7ffa('0x2e')]({},_0x3f2874,_0x86ae31[_0x7ffa('0x2f')]);return db['ChatApplication']['find'](_0x3f2874)['then'](handleEntityNotFound(_0x57da30,null))[_0x7ffa('0x1c')](respondWithResult(_0x57da30,null))[_0x7ffa('0x30')](handleError(_0x57da30,null));};exports['update']=function(_0x49dfdf,_0x4579ea){if(_0x49dfdf['body']['id']){delete _0x49dfdf[_0x7ffa('0x31')]['id'];}return db[_0x7ffa('0x32')]['find']({'where':{'id':_0x49dfdf[_0x7ffa('0x23')]['id']}})[_0x7ffa('0x1c')](handleEntityNotFound(_0x4579ea,null))['then'](saveUpdates(_0x49dfdf['body'],null))[_0x7ffa('0x1c')](respondWithResult(_0x4579ea,null))[_0x7ffa('0x30')](handleError(_0x4579ea,null));};exports[_0x7ffa('0x1d')]=function(_0x4724f1,_0x437095){return db[_0x7ffa('0x32')][_0x7ffa('0x33')]({'where':{'id':_0x4724f1[_0x7ffa('0x23')]['id']}})[_0x7ffa('0x1c')](handleEntityNotFound(_0x437095,null))['then'](removeEntity(_0x437095,null))[_0x7ffa('0x30')](handleError(_0x437095,null));}; \ No newline at end of file +var _0x63b0=['attributes','fields','length','includeAll','include','merge','find','catch','body','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','squel','crypto','desk.js','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','count','offset','limit','set','Content-Range','apply','reject','update','destroy','then','error','stack','name','send','show','params','model','ChatApplication','rawAttributes','query','keys','intersection'];(function(_0x48e64b,_0x4fc483){var _0x230c8e=function(_0x334dff){while(--_0x334dff){_0x48e64b['push'](_0x48e64b['shift']());}};_0x230c8e(++_0x4fc483);}(_0x63b0,0x7f));var _0x063b=function(_0x1c0a75,_0x702159){_0x1c0a75=_0x1c0a75-0x0;var _0x5f2549=_0x63b0[_0x1c0a75];return _0x5f2549;};'use strict';var pdf=require(_0x063b('0x0'));var emlformat=require(_0x063b('0x1'));var rimraf=require(_0x063b('0x2'));var zipdir=require(_0x063b('0x3'));var jsonpatch=require(_0x063b('0x4'));var rp=require(_0x063b('0x5'));var moment=require(_0x063b('0x6'));var BPromise=require(_0x063b('0x7'));var Mustache=require(_0x063b('0x8'));var util=require(_0x063b('0x9'));var path=require(_0x063b('0xa'));var sox=require(_0x063b('0xb'));var csv=require(_0x063b('0xc'));var ejs=require(_0x063b('0xd'));var fs=require('fs');var _=require('lodash');var squel=require(_0x063b('0xe'));var crypto=require(_0x063b('0xf'));var jsforce=require('jsforce');var deskjs=require(_0x063b('0x10'));var toCsv=require(_0x063b('0xc'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x063b('0x11'));var authService=require(_0x063b('0x12'));var qs=require(_0x063b('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x063b('0x14'));var logger=require(_0x063b('0x15'))('api');var utils=require(_0x063b('0x16'));var config=require(_0x063b('0x17'));var db=require(_0x063b('0x18'))['db'];function respondWithStatusCode(_0x1dc350,_0x421e89){_0x421e89=_0x421e89||0xcc;return function(_0xefa744){if(_0xefa744){return _0x1dc350[_0x063b('0x19')](_0x421e89);}return _0x1dc350[_0x063b('0x1a')](_0x421e89)[_0x063b('0x1b')]();};}function respondWithResult(_0x3ff1c4,_0x54b1bf){_0x54b1bf=_0x54b1bf||0xc8;return function(_0xf8a02f){if(_0xf8a02f){return _0x3ff1c4['status'](_0x54b1bf)['json'](_0xf8a02f);}};}function respondWithFilteredResult(_0x3bd3b3,_0x50eb0b){return function(_0x526c75){if(_0x526c75){var _0x1cbd7c=_0x526c75[_0x063b('0x1c')],_0x15e8ea=_0x50eb0b[_0x063b('0x1d')],_0x16dd60=_0x50eb0b[_0x063b('0x1d')]+_0x50eb0b[_0x063b('0x1e')],_0x320c0f;if(_0x16dd60>=_0x1cbd7c){_0x16dd60=_0x1cbd7c;_0x320c0f=0xc8;}else{_0x320c0f=0xce;}_0x3bd3b3[_0x063b('0x1a')](_0x320c0f);return _0x3bd3b3[_0x063b('0x1f')](_0x063b('0x20'),_0x15e8ea+'-'+_0x16dd60+'/'+_0x1cbd7c)['json'](_0x526c75);}return null;};}function patchUpdates(_0x4236bd){return function(_0x52711b){try{jsonpatch[_0x063b('0x21')](_0x52711b,_0x4236bd,!![]);}catch(_0x344c9c){return BPromise[_0x063b('0x22')](_0x344c9c);}return _0x52711b['save']();};}function saveUpdates(_0x381a06,_0x197a8c){return function(_0x5dd88a){if(_0x5dd88a){return _0x5dd88a[_0x063b('0x23')](_0x381a06)['then'](function(_0x445165){return _0x445165;});}return null;};}function removeEntity(_0x35239e,_0x50e755){return function(_0x399b44){if(_0x399b44){return _0x399b44[_0x063b('0x24')]()[_0x063b('0x25')](function(){_0x35239e[_0x063b('0x1a')](0xcc)[_0x063b('0x1b')]();});}};}function handleEntityNotFound(_0x458066,_0x3a8705){return function(_0x1c5259){if(!_0x1c5259){_0x458066[_0x063b('0x19')](0x194);}return _0x1c5259;};}function handleError(_0x37e5fd,_0x13e795){_0x13e795=_0x13e795||0x1f4;return function(_0x751770){logger[_0x063b('0x26')](_0x751770[_0x063b('0x27')]);if(_0x751770[_0x063b('0x28')]){delete _0x751770[_0x063b('0x28')];}_0x37e5fd[_0x063b('0x1a')](_0x13e795)[_0x063b('0x29')](_0x751770);};}exports[_0x063b('0x2a')]=function(_0xb28cc8,_0x47e325){var _0x20fe88={'raw':!![],'where':{'id':_0xb28cc8[_0x063b('0x2b')]['id']}},_0x555b4e={};_0x555b4e[_0x063b('0x2c')]=_['keys'](db[_0x063b('0x2d')][_0x063b('0x2e')]);_0x555b4e[_0x063b('0x2f')]=_[_0x063b('0x30')](_0xb28cc8[_0x063b('0x2f')]);_0x555b4e['filters']=_[_0x063b('0x31')](_0x555b4e[_0x063b('0x2c')],_0x555b4e[_0x063b('0x2f')]);_0x20fe88[_0x063b('0x32')]=_[_0x063b('0x31')](_0x555b4e[_0x063b('0x2c')],qs[_0x063b('0x33')](_0xb28cc8[_0x063b('0x2f')][_0x063b('0x33')]));_0x20fe88['attributes']=_0x20fe88[_0x063b('0x32')][_0x063b('0x34')]?_0x20fe88[_0x063b('0x32')]:_0x555b4e[_0x063b('0x2c')];if(_0xb28cc8[_0x063b('0x2f')][_0x063b('0x35')]){_0x20fe88[_0x063b('0x36')]=[{'all':!![]}];}_0x20fe88=_[_0x063b('0x37')]({},_0x20fe88,_0xb28cc8['options']);return db[_0x063b('0x2d')][_0x063b('0x38')](_0x20fe88)[_0x063b('0x25')](handleEntityNotFound(_0x47e325,null))['then'](respondWithResult(_0x47e325,null))[_0x063b('0x39')](handleError(_0x47e325,null));};exports[_0x063b('0x23')]=function(_0x49b675,_0x16664f){if(_0x49b675[_0x063b('0x3a')]['id']){delete _0x49b675['body']['id'];}return db[_0x063b('0x2d')][_0x063b('0x38')]({'where':{'id':_0x49b675['params']['id']}})[_0x063b('0x25')](handleEntityNotFound(_0x16664f,null))['then'](saveUpdates(_0x49b675[_0x063b('0x3a')],null))[_0x063b('0x25')](respondWithResult(_0x16664f,null))['catch'](handleError(_0x16664f,null));};exports[_0x063b('0x24')]=function(_0x22308f,_0x523b40){return db[_0x063b('0x2d')]['find']({'where':{'id':_0x22308f[_0x063b('0x2b')]['id']}})['then'](handleEntityNotFound(_0x523b40,null))[_0x063b('0x25')](removeEntity(_0x523b40,null))[_0x063b('0x39')](handleError(_0x523b40,null));}; \ No newline at end of file diff --git a/server/api/chatApplication/chatApplication.model.js b/server/api/chatApplication/chatApplication.model.js index 1725913..64d2389 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(_0x2b10c6,_0x185590){_0x2b10c6=_0x2b10c6-0x0;var _0x3789d2=_0xa9e0[_0x2b10c6];return _0x3789d2;};'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(_0x40a045,_0x516f0e){var _0x1a687c=function(_0x48c9fe){while(--_0x48c9fe){_0x40a045['push'](_0x40a045['shift']());}};_0x1a687c(++_0x516f0e);}(_0xa9e0,0x123));var _0x0a9e=function(_0x18a79d,_0x57bd2c){_0x18a79d=_0x18a79d-0x0;var _0x4f8848=_0xa9e0[_0x18a79d];return _0x4f8848;};'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 23ce238..41f3a4a 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 _0xb7d3=['randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','ChatApplication,\x20%s,\x20%s','request\x20sent','debug','ChatApplication,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','lodash','util','moment'];(function(_0x5676e9,_0x2821a0){var _0x243836=function(_0x218a3d){while(--_0x218a3d){_0x5676e9['push'](_0x5676e9['shift']());}};_0x243836(++_0x2821a0);}(_0xb7d3,0xd5));var _0x3b7d=function(_0x67d4ca,_0x455f15){_0x67d4ca=_0x67d4ca-0x0;var _0xc53c24=_0xb7d3[_0x67d4ca];return _0xc53c24;};'use strict';var _=require(_0x3b7d('0x0'));var util=require(_0x3b7d('0x1'));var moment=require(_0x3b7d('0x2'));var BPromise=require('bluebird');var rs=require(_0x3b7d('0x3'));var fs=require('fs');var Redis=require(_0x3b7d('0x4'));var db=require(_0x3b7d('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x3b7d('0x6'))(_0x3b7d('0x7'));var config=require(_0x3b7d('0x8'));var jayson=require(_0x3b7d('0x9'));var client=jayson[_0x3b7d('0xa')][_0x3b7d('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x551651,_0x5101a5,_0xd9effb){return new BPromise(function(_0x42b8b3,_0x1017c6){return client[_0x3b7d('0xc')](_0x551651,_0xd9effb)['then'](function(_0x1377af){logger['info'](_0x3b7d('0xd'),_0x5101a5,_0x3b7d('0xe'));logger[_0x3b7d('0xf')](_0x3b7d('0x10'),_0x5101a5,_0x3b7d('0xe'),JSON[_0x3b7d('0x11')](_0x1377af));if(_0x1377af['error']){if(_0x1377af[_0x3b7d('0x12')][_0x3b7d('0x13')]===0x1f4){logger[_0x3b7d('0x12')](_0x3b7d('0xd'),_0x5101a5,_0x1377af[_0x3b7d('0x12')][_0x3b7d('0x14')]);return _0x1017c6(_0x1377af[_0x3b7d('0x12')][_0x3b7d('0x14')]);}logger[_0x3b7d('0x12')](_0x3b7d('0xd'),_0x5101a5,_0x1377af[_0x3b7d('0x12')]['message']);return _0x42b8b3(_0x1377af[_0x3b7d('0x12')][_0x3b7d('0x14')]);}else{logger[_0x3b7d('0x15')](_0x3b7d('0xd'),_0x5101a5,'request\x20sent');_0x42b8b3(_0x1377af[_0x3b7d('0x16')][_0x3b7d('0x14')]);}})[_0x3b7d('0x17')](function(_0x2db09e){logger[_0x3b7d('0x12')](_0x3b7d('0xd'),_0x5101a5,_0x2db09e);_0x1017c6(_0x2db09e);});});} \ No newline at end of file +var _0x2318=['ChatApplication,\x20%s,\x20%s,\x20%s','stringify','error','code','message','ChatApplication,\x20%s,\x20%s','lodash','util','randomstring','ioredis','../../mysqldb','rpc','client','http','request','then','info','request\x20sent','debug'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x2318,0x149));var _0x8231=function(_0x558b08,_0x5e3638){_0x558b08=_0x558b08-0x0;var _0x5daac3=_0x2318[_0x558b08];return _0x5daac3;};'use strict';var _=require(_0x8231('0x0'));var util=require(_0x8231('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x8231('0x2'));var fs=require('fs');var Redis=require(_0x8231('0x3'));var db=require(_0x8231('0x4'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x8231('0x5'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x8231('0x6')][_0x8231('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x3b702,_0x343b63,_0x33fae3){return new BPromise(function(_0x5ea9f4,_0x124923){return client[_0x8231('0x8')](_0x3b702,_0x33fae3)[_0x8231('0x9')](function(_0x1085a7){logger[_0x8231('0xa')]('ChatApplication,\x20%s,\x20%s',_0x343b63,_0x8231('0xb'));logger[_0x8231('0xc')](_0x8231('0xd'),_0x343b63,_0x8231('0xb'),JSON[_0x8231('0xe')](_0x1085a7));if(_0x1085a7[_0x8231('0xf')]){if(_0x1085a7['error'][_0x8231('0x10')]===0x1f4){logger[_0x8231('0xf')]('ChatApplication,\x20%s,\x20%s',_0x343b63,_0x1085a7[_0x8231('0xf')][_0x8231('0x11')]);return _0x124923(_0x1085a7[_0x8231('0xf')][_0x8231('0x11')]);}logger['error'](_0x8231('0x12'),_0x343b63,_0x1085a7[_0x8231('0xf')][_0x8231('0x11')]);return _0x5ea9f4(_0x1085a7['error'][_0x8231('0x11')]);}else{logger[_0x8231('0xa')](_0x8231('0x12'),_0x343b63,_0x8231('0xb'));_0x5ea9f4(_0x1085a7['result'][_0x8231('0x11')]);}})['catch'](function(_0x175a39){logger[_0x8231('0xf')](_0x8231('0x12'),_0x343b63,_0x175a39);_0x124923(_0x175a39);});});} \ No newline at end of file diff --git a/server/api/chatApplication/index.js b/server/api/chatApplication/index.js index d3332d6..a7951f1 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 _0x09ab=['connect-timeout','Router','../../config/environment','get','/:id','isAuthenticated','show','put','update','destroy','util','path'];(function(_0x371962,_0x5a964b){var _0x3df268=function(_0x4a1e3b){while(--_0x4a1e3b){_0x371962['push'](_0x371962['shift']());}};_0x3df268(++_0x5a964b);}(_0x09ab,0x106));var _0xb09a=function(_0x58a3da,_0x4bb384){_0x58a3da=_0x58a3da-0x0;var _0x2612a2=_0x09ab[_0x58a3da];return _0x2612a2;};'use strict';var multer=require('multer');var util=require(_0xb09a('0x0'));var path=require(_0xb09a('0x1'));var timeout=require(_0xb09a('0x2'));var express=require('express');var router=express[_0xb09a('0x3')]();var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0xb09a('0x4'));var controller=require('./chatApplication.controller');router[_0xb09a('0x5')](_0xb09a('0x6'),auth[_0xb09a('0x7')](),controller[_0xb09a('0x8')]);router[_0xb09a('0x9')](_0xb09a('0x6'),auth[_0xb09a('0x7')](),controller[_0xb09a('0xa')]);router['delete'](_0xb09a('0x6'),auth[_0xb09a('0x7')](),controller[_0xb09a('0xb')]);module['exports']=router; \ No newline at end of file +var _0xca1c=['show','put','update','delete','multer','util','path','connect-timeout','express','Router','../../components/interaction/service','../../config/environment','./chatApplication.controller','/:id','isAuthenticated'];(function(_0x26efac,_0x21ab8a){var _0x8482e4=function(_0x14db32){while(--_0x14db32){_0x26efac['push'](_0x26efac['shift']());}};_0x8482e4(++_0x21ab8a);}(_0xca1c,0xc7));var _0xcca1=function(_0x1de66,_0x33e13e){_0x1de66=_0x1de66-0x0;var _0xd229f0=_0xca1c[_0x1de66];return _0xd229f0;};'use strict';var multer=require(_0xcca1('0x0'));var util=require(_0xcca1('0x1'));var path=require(_0xcca1('0x2'));var timeout=require(_0xcca1('0x3'));var express=require(_0xcca1('0x4'));var router=express[_0xcca1('0x5')]();var auth=require('../../components/auth/service');var interaction=require(_0xcca1('0x6'));var config=require(_0xcca1('0x7'));var controller=require(_0xcca1('0x8'));router['get'](_0xcca1('0x9'),auth[_0xcca1('0xa')](),controller[_0xcca1('0xb')]);router[_0xcca1('0xc')](_0xcca1('0x9'),auth['isAuthenticated'](),controller[_0xcca1('0xd')]);router[_0xcca1('0xe')](_0xcca1('0x9'),auth[_0xcca1('0xa')](),controller['destroy']);module['exports']=router; \ No newline at end of file diff --git a/server/api/chatGroup/chatGroup.attributes.js b/server/api/chatGroup/chatGroup.attributes.js index 57b6cef..18cbb39 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 _0xd47f=['exports','STRING','BOOLEAN','sequelize'];(function(_0x5d3903,_0x3d6c3e){var _0x4b8bc9=function(_0x92b297){while(--_0x92b297){_0x5d3903['push'](_0x5d3903['shift']());}};_0x4b8bc9(++_0x3d6c3e);}(_0xd47f,0x1a7));var _0xfd47=function(_0x4df5d3,_0x522c48){_0x4df5d3=_0x4df5d3-0x0;var _0x34a8d=_0xd47f[_0x4df5d3];return _0x34a8d;};'use strict';var Sequelize=require(_0xfd47('0x0'));module[_0xfd47('0x1')]={'name':{'type':Sequelize[_0xfd47('0x2')],'allowNull':![]},'description':{'type':Sequelize['STRING']},'write':{'type':Sequelize[_0xfd47('0x3')],'defaultValue':!![]}}; \ No newline at end of file +var _0x8480=['BOOLEAN','sequelize'];(function(_0x424f44,_0x4b7d87){var _0x5b89cf=function(_0x2e9acb){while(--_0x2e9acb){_0x424f44['push'](_0x424f44['shift']());}};_0x5b89cf(++_0x4b7d87);}(_0x8480,0xe9));var _0x0848=function(_0x57a97a,_0x3672e9){_0x57a97a=_0x57a97a-0x0;var _0x12a961=_0x8480[_0x57a97a];return _0x12a961;};'use strict';var Sequelize=require(_0x0848('0x0'));module['exports']={'name':{'type':Sequelize['STRING'],'allowNull':![]},'description':{'type':Sequelize['STRING']},'write':{'type':Sequelize[_0x0848('0x1')],'defaultValue':!![]}}; \ No newline at end of file diff --git a/server/api/chatGroup/chatGroup.controller.js b/server/api/chatGroup/chatGroup.controller.js index 40620cb..96bb315 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 _0x9fed=['then','info','ChatGroup,\x20%s,\x20%s','debug','ChatGroup,\x20%s,\x20%s,\x20%s','stringify','error','code','message','request\x20sent','result','status','end','json','offset','limit','Content-Range','apply','reject','save','update','name','send','index','map','ChatGroup','rawAttributes','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','where','pick','filter','type','VIRTUAL','count','includeAll','findAll','rows','catch','params','keys','include','merge','options','find','create','body','ChatInternalMessage','user','addMembers','ids','omit','User','order','getMembers','removeMembers','addMessage','ChatGroupId','getMessages','$gte','split','format','YYYY-MM-DD\x20HH:mm:ss','eml-format','fast-json-patch','request-promise','moment','bluebird','util','path','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./chatGroup.socket','register','jayson/promise','client','test','Sequelize','The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.','request'];(function(_0x2a7d57,_0x27a648){var _0x5daa90=function(_0x211cac){while(--_0x211cac){_0x2a7d57['push'](_0x2a7d57['shift']());}};_0x5daa90(++_0x27a648);}(_0x9fed,0x11b));var _0xd9fe=function(_0x21cc5f,_0x30d239){_0x21cc5f=_0x21cc5f-0x0;var _0xa3dfc3=_0x9fed[_0x21cc5f];return _0xa3dfc3;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0xd9fe('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0xd9fe('0x1'));var rp=require(_0xd9fe('0x2'));var moment=require(_0xd9fe('0x3'));var BPromise=require(_0xd9fe('0x4'));var Mustache=require('mustache');var util=require(_0xd9fe('0x5'));var path=require(_0xd9fe('0x6'));var sox=require('sox');var csv=require(_0xd9fe('0x7'));var ejs=require(_0xd9fe('0x8'));var fs=require('fs');var _=require(_0xd9fe('0x9'));var squel=require(_0xd9fe('0xa'));var crypto=require(_0xd9fe('0xb'));var jsforce=require(_0xd9fe('0xc'));var deskjs=require(_0xd9fe('0xd'));var toCsv=require(_0xd9fe('0x7'));var querystring=require(_0xd9fe('0xe'));var Papa=require(_0xd9fe('0xf'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0xd9fe('0x10'));var as=require(_0xd9fe('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xd9fe('0x12'))(_0xd9fe('0x13'));var utils=require(_0xd9fe('0x14'));var config=require(_0xd9fe('0x15'));var db=require(_0xd9fe('0x16'))['db'];config[_0xd9fe('0x17')]=_[_0xd9fe('0x18')](config[_0xd9fe('0x17')],{'host':_0xd9fe('0x19'),'port':0x18eb});var socket=require(_0xd9fe('0x1a'))(new Redis(config['redis']));require(_0xd9fe('0x1b'))[_0xd9fe('0x1c')](socket);var jayson=require(_0xd9fe('0x1d'));var client=jayson[_0xd9fe('0x1e')]['http']({'port':0x232a});function checkPasswordPattern(_0x45ee72,_0x6a154d,_0x10b5e6){if(_0x10b5e6){var _0x2264c9=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x2264c9[_0xd9fe('0x1f')](_0x6a154d)){return _0x45ee72;}else{throw new db[(_0xd9fe('0x20'))]['ValidationError'](_0xd9fe('0x21'));}}else{return _0x45ee72;}}function respondWithRpcPromise(_0x2e3efc,_0x23c803,_0xa6a9a3,_0x3f8f72){return new BPromise(function(_0x54174a,_0x192846){var _0x24dc74=_0x3f8f72||client;return _0x24dc74[_0xd9fe('0x22')](_0x2e3efc,_0xa6a9a3)[_0xd9fe('0x23')](function(_0x202adb){logger[_0xd9fe('0x24')](_0xd9fe('0x25'),_0x23c803,'request\x20sent');logger[_0xd9fe('0x26')](_0xd9fe('0x27'),_0x23c803,'request\x20sent',JSON[_0xd9fe('0x28')](_0x202adb));if(_0x202adb[_0xd9fe('0x29')]){if(_0x202adb[_0xd9fe('0x29')][_0xd9fe('0x2a')]===0x1f4){logger[_0xd9fe('0x29')](_0xd9fe('0x25'),_0x23c803,_0x202adb[_0xd9fe('0x29')][_0xd9fe('0x2b')]);return _0x192846(_0x202adb[_0xd9fe('0x29')][_0xd9fe('0x2b')]);}logger[_0xd9fe('0x29')](_0xd9fe('0x25'),_0x23c803,_0x202adb[_0xd9fe('0x29')]['message']);return _0x54174a(_0x202adb[_0xd9fe('0x29')][_0xd9fe('0x2b')]);}else{logger[_0xd9fe('0x24')]('ChatGroup,\x20%s,\x20%s',_0x23c803,_0xd9fe('0x2c'));_0x54174a(_0x202adb[_0xd9fe('0x2d')][_0xd9fe('0x2b')]);}})['catch'](function(_0x10f5d3){logger[_0xd9fe('0x29')](_0xd9fe('0x25'),_0x23c803,_0x10f5d3);_0x192846(_0x10f5d3);});});}function respondWithStatusCode(_0x2daf17,_0x5178aa){_0x5178aa=_0x5178aa||0xcc;return function(_0x42c02a){if(_0x42c02a){return _0x2daf17['sendStatus'](_0x5178aa);}return _0x2daf17[_0xd9fe('0x2e')](_0x5178aa)[_0xd9fe('0x2f')]();};}function respondWithResult(_0x3d4c90,_0x4945da){_0x4945da=_0x4945da||0xc8;return function(_0x5776d5){if(_0x5776d5){return _0x3d4c90[_0xd9fe('0x2e')](_0x4945da)[_0xd9fe('0x30')](_0x5776d5);}};}function respondWithFilteredResult(_0x44fecf,_0x3783f6){return function(_0x422ddf){if(_0x422ddf){var _0x126f6b=_0x422ddf['count'],_0x46c4a3=_0x3783f6['offset'],_0xcf95f7=_0x3783f6[_0xd9fe('0x31')]+_0x3783f6[_0xd9fe('0x32')],_0x5a993b;if(_0xcf95f7>=_0x126f6b){_0xcf95f7=_0x126f6b;_0x5a993b=0xc8;}else{_0x5a993b=0xce;}_0x44fecf[_0xd9fe('0x2e')](_0x5a993b);return _0x44fecf['set'](_0xd9fe('0x33'),_0x46c4a3+'-'+_0xcf95f7+'/'+_0x126f6b)[_0xd9fe('0x30')](_0x422ddf);}return null;};}function patchUpdates(_0x4976a4){return function(_0x1e292d){try{jsonpatch[_0xd9fe('0x34')](_0x1e292d,_0x4976a4,!![]);}catch(_0x3a9c24){return BPromise[_0xd9fe('0x35')](_0x3a9c24);}return _0x1e292d[_0xd9fe('0x36')]();};}function saveUpdates(_0x516f82,_0x13eab4){return function(_0x1f46d0){if(_0x1f46d0){return _0x1f46d0[_0xd9fe('0x37')](_0x516f82)[_0xd9fe('0x23')](function(_0x4c9214){return _0x4c9214;});}return null;};}function removeEntity(_0x293324,_0x37ea22){return function(_0x3d83cf){if(_0x3d83cf){return _0x3d83cf['destroy']()[_0xd9fe('0x23')](function(){_0x293324['status'](0xcc)[_0xd9fe('0x2f')]();});}};}function handleEntityNotFound(_0x9af18a,_0x4a50cb){return function(_0x3401e9){if(!_0x3401e9){_0x9af18a['sendStatus'](0x194);}return _0x3401e9;};}function handleError(_0x4d9c03,_0x20145f){_0x20145f=_0x20145f||0x1f4;return function(_0x5e6fa8){logger[_0xd9fe('0x29')](_0x5e6fa8['stack']);if(_0x5e6fa8['name']){delete _0x5e6fa8[_0xd9fe('0x38')];}_0x4d9c03[_0xd9fe('0x2e')](_0x20145f)[_0xd9fe('0x39')](_0x5e6fa8);};}exports[_0xd9fe('0x3a')]=function(_0xc10512,_0x330f5d){var _0xc575ca={},_0xc5f6fb={},_0x1c2208={'count':0x0,'rows':[]};var _0x350b34=_[_0xd9fe('0x3b')](db[_0xd9fe('0x3c')][_0xd9fe('0x3d')],function(_0xefc094){return{'name':_0xefc094['fieldName'],'type':_0xefc094['type']['key']};});_0xc5f6fb[_0xd9fe('0x3e')]=_[_0xd9fe('0x3b')](_0x350b34,_0xd9fe('0x38'));_0xc5f6fb[_0xd9fe('0x3f')]=_['keys'](_0xc10512[_0xd9fe('0x3f')]);_0xc5f6fb[_0xd9fe('0x40')]=_[_0xd9fe('0x41')](_0xc5f6fb['model'],_0xc5f6fb['query']);_0xc575ca[_0xd9fe('0x42')]=_['intersection'](_0xc5f6fb[_0xd9fe('0x3e')],qs['fields'](_0xc10512[_0xd9fe('0x3f')][_0xd9fe('0x43')]));_0xc575ca[_0xd9fe('0x42')]=_0xc575ca[_0xd9fe('0x42')][_0xd9fe('0x44')]?_0xc575ca[_0xd9fe('0x42')]:_0xc5f6fb[_0xd9fe('0x3e')];if(!_0xc10512[_0xd9fe('0x3f')][_0xd9fe('0x45')](_0xd9fe('0x46'))){_0xc575ca[_0xd9fe('0x32')]=qs[_0xd9fe('0x32')](_0xc10512[_0xd9fe('0x3f')][_0xd9fe('0x32')]);_0xc575ca[_0xd9fe('0x31')]=qs[_0xd9fe('0x31')](_0xc10512[_0xd9fe('0x3f')]['offset']);}_0xc575ca['order']=qs['sort'](_0xc10512[_0xd9fe('0x3f')][_0xd9fe('0x47')]);_0xc575ca[_0xd9fe('0x48')]=qs['filters'](_[_0xd9fe('0x49')](_0xc10512[_0xd9fe('0x3f')],_0xc5f6fb[_0xd9fe('0x40')]));if(_0xc10512[_0xd9fe('0x3f')][_0xd9fe('0x4a')]){_0xc575ca[_0xd9fe('0x48')]=_['merge'](_0xc575ca[_0xd9fe('0x48')],{'$or':_['map'](_0x350b34,function(_0x10ecce){if(_0x10ecce[_0xd9fe('0x4b')]!==_0xd9fe('0x4c')){var _0x2311a6={};_0x2311a6[_0x10ecce[_0xd9fe('0x38')]]={'$like':'%'+_0xc10512[_0xd9fe('0x3f')][_0xd9fe('0x4a')]+'%'};return _0x2311a6;}})});}_0xc575ca=_['merge']({},_0xc575ca,_0xc10512['options']);var _0x4226ca={'where':_0xc575ca['where']};return db['ChatGroup'][_0xd9fe('0x4d')](_0x4226ca)[_0xd9fe('0x23')](function(_0x3fe3ce){_0x1c2208[_0xd9fe('0x4d')]=_0x3fe3ce;if(_0xc10512[_0xd9fe('0x3f')][_0xd9fe('0x4e')]){_0xc575ca['include']=[{'all':!![]}];}return db[_0xd9fe('0x3c')][_0xd9fe('0x4f')](_0xc575ca);})[_0xd9fe('0x23')](function(_0x35ea0e){_0x1c2208[_0xd9fe('0x50')]=_0x35ea0e;return _0x1c2208;})['then'](respondWithFilteredResult(_0x330f5d,_0xc575ca))[_0xd9fe('0x51')](handleError(_0x330f5d,null));};exports['show']=function(_0x2c289e,_0x5949a6){var _0x438aa5={'raw':!![],'where':{'id':_0x2c289e[_0xd9fe('0x52')]['id']}},_0x176636={};_0x176636[_0xd9fe('0x3e')]=_[_0xd9fe('0x53')](db[_0xd9fe('0x3c')][_0xd9fe('0x3d')]);_0x176636['query']=_['keys'](_0x2c289e[_0xd9fe('0x3f')]);_0x176636[_0xd9fe('0x40')]=_[_0xd9fe('0x41')](_0x176636[_0xd9fe('0x3e')],_0x176636[_0xd9fe('0x3f')]);_0x438aa5[_0xd9fe('0x42')]=_[_0xd9fe('0x41')](_0x176636['model'],qs[_0xd9fe('0x43')](_0x2c289e['query'][_0xd9fe('0x43')]));_0x438aa5[_0xd9fe('0x42')]=_0x438aa5['attributes']['length']?_0x438aa5[_0xd9fe('0x42')]:_0x176636[_0xd9fe('0x3e')];if(_0x2c289e[_0xd9fe('0x3f')]['includeAll']){_0x438aa5[_0xd9fe('0x54')]=[{'all':!![]}];}_0x438aa5=_[_0xd9fe('0x55')]({},_0x438aa5,_0x2c289e[_0xd9fe('0x56')]);return db['ChatGroup'][_0xd9fe('0x57')](_0x438aa5)[_0xd9fe('0x23')](handleEntityNotFound(_0x5949a6,null))[_0xd9fe('0x23')](respondWithResult(_0x5949a6,null))[_0xd9fe('0x51')](handleError(_0x5949a6,null));};exports[_0xd9fe('0x58')]=function(_0x5b760e,_0x1655cf){return db['ChatGroup'][_0xd9fe('0x58')](_0x5b760e[_0xd9fe('0x59')],{})[_0xd9fe('0x23')](respondWithResult(_0x1655cf,0xc9))[_0xd9fe('0x51')](handleError(_0x1655cf,null));};exports[_0xd9fe('0x37')]=function(_0x1a7291,_0x2e5ba2){if(_0x1a7291[_0xd9fe('0x59')]['id']){delete _0x1a7291[_0xd9fe('0x59')]['id'];}return db[_0xd9fe('0x3c')]['find']({'where':{'id':_0x1a7291[_0xd9fe('0x52')]['id']}})['then'](handleEntityNotFound(_0x2e5ba2,null))[_0xd9fe('0x23')](saveUpdates(_0x1a7291[_0xd9fe('0x59')],null))[_0xd9fe('0x23')](respondWithResult(_0x2e5ba2,null))[_0xd9fe('0x51')](handleError(_0x2e5ba2,null));};exports['destroy']=function(_0x4a157c,_0x594bfc){return db[_0xd9fe('0x3c')][_0xd9fe('0x57')]({'where':{'id':_0x4a157c[_0xd9fe('0x52')]['id']}})[_0xd9fe('0x23')](handleEntityNotFound(_0x594bfc,null))[_0xd9fe('0x23')](removeEntity(_0x594bfc,null))[_0xd9fe('0x51')](handleError(_0x594bfc,null));};exports['describe']=function(_0x3da7ad,_0xea0280){return db[_0xd9fe('0x3c')]['describe']()['then'](respondWithResult(_0xea0280,null))['catch'](handleError(_0xea0280,null));};exports['getUnread']=function(_0x2fef91,_0x399326,_0x5977fe){return db[_0xd9fe('0x5a')][_0xd9fe('0x4d')]({'where':{'ChatGroupId':_0x2fef91['params']['id'],'ToId':_0x2fef91[_0xd9fe('0x5b')]['id'],'read':![]}})[_0xd9fe('0x23')](function(_0x30af97){return{'id':_['toInteger'](_0x2fef91['params']['id']),'count':_0x30af97};})[_0xd9fe('0x23')](respondWithResult(_0x399326,null))[_0xd9fe('0x51')](handleError(_0x399326,null));};exports[_0xd9fe('0x5c')]=function(_0x5e6570,_0x15e8c0,_0x4248e2){return db['ChatGroup']['find']({'where':{'id':_0x5e6570[_0xd9fe('0x52')]['id']}})['then'](handleEntityNotFound(_0x15e8c0,null))[_0xd9fe('0x23')](function(_0x5663db){if(_0x5663db){return _0x5663db[_0xd9fe('0x5c')](_0x5e6570['body'][_0xd9fe('0x5d')],_[_0xd9fe('0x5e')](_0x5e6570['body'],[_0xd9fe('0x5d'),'id'])||{});}})[_0xd9fe('0x23')](respondWithResult(_0x15e8c0,null))[_0xd9fe('0x51')](handleError(_0x15e8c0,null));};exports['getMembers']=function(_0x4ff43a,_0xa40b89,_0x1d5e89){var _0x5dd536={};var _0x1622bd={};var _0x1bd9b9;var _0x1affa8;return db['ChatGroup']['findOne']({'where':{'id':_0x4ff43a['params']['id']}})['then'](handleEntityNotFound(_0xa40b89,null))[_0xd9fe('0x23')](function(_0x1d3d54){if(_0x1d3d54){_0x1bd9b9=_0x1d3d54;_0x1622bd[_0xd9fe('0x3e')]=_[_0xd9fe('0x53')](db[_0xd9fe('0x5f')][_0xd9fe('0x3d')]);_0x1622bd[_0xd9fe('0x3f')]=_[_0xd9fe('0x53')](_0x4ff43a[_0xd9fe('0x3f')]);_0x1622bd[_0xd9fe('0x40')]=_[_0xd9fe('0x41')](_0x1622bd[_0xd9fe('0x3e')],_0x1622bd[_0xd9fe('0x3f')]);_0x5dd536[_0xd9fe('0x42')]=_['intersection'](_0x1622bd[_0xd9fe('0x3e')],qs[_0xd9fe('0x43')](_0x4ff43a[_0xd9fe('0x3f')][_0xd9fe('0x43')]));_0x5dd536[_0xd9fe('0x42')]=_0x5dd536['attributes'][_0xd9fe('0x44')]?_0x5dd536[_0xd9fe('0x42')]:_0x1622bd[_0xd9fe('0x3e')];_0x5dd536[_0xd9fe('0x60')]=qs[_0xd9fe('0x47')](_0x4ff43a['query'][_0xd9fe('0x47')]);_0x5dd536[_0xd9fe('0x48')]=qs['filters'](_[_0xd9fe('0x49')](_0x4ff43a[_0xd9fe('0x3f')],_0x1622bd[_0xd9fe('0x40')]));if(_0x4ff43a[_0xd9fe('0x3f')][_0xd9fe('0x4a')]){_0x5dd536['where']=_[_0xd9fe('0x55')](_0x5dd536[_0xd9fe('0x48')],{'$or':_['map'](_0x5dd536[_0xd9fe('0x42')],function(_0x1136ed){var _0x403819={};_0x403819[_0x1136ed]={'$like':'%'+_0x4ff43a[_0xd9fe('0x3f')][_0xd9fe('0x4a')]+'%'};return _0x403819;})});}_0x5dd536=_[_0xd9fe('0x55')]({},_0x5dd536,_0x4ff43a[_0xd9fe('0x56')]);return _0x1bd9b9[_0xd9fe('0x61')](_0x5dd536);}})[_0xd9fe('0x23')](function(_0x514843){if(_0x514843){_0x1affa8=_0x514843[_0xd9fe('0x44')];if(!_0x4ff43a['query'][_0xd9fe('0x45')]('nolimit')){_0x5dd536[_0xd9fe('0x32')]=qs['limit'](_0x4ff43a[_0xd9fe('0x3f')][_0xd9fe('0x32')]);_0x5dd536[_0xd9fe('0x31')]=qs[_0xd9fe('0x31')](_0x4ff43a['query']['offset']);}return _0x1bd9b9[_0xd9fe('0x61')](_0x5dd536);}})[_0xd9fe('0x23')](function(_0x14ece5){if(_0x14ece5){return _0x14ece5?{'count':_0x1affa8,'rows':_0x14ece5}:null;}})[_0xd9fe('0x23')](respondWithResult(_0xa40b89,null))[_0xd9fe('0x51')](handleError(_0xa40b89,null));};exports[_0xd9fe('0x62')]=function(_0x476d36,_0x558146,_0x1bb5b2){return db[_0xd9fe('0x3c')][_0xd9fe('0x57')]({'where':{'id':_0x476d36[_0xd9fe('0x52')]['id']}})[_0xd9fe('0x23')](handleEntityNotFound(_0x558146,null))['then'](function(_0x29f4ae){if(_0x29f4ae){return _0x29f4ae[_0xd9fe('0x62')](_0x476d36[_0xd9fe('0x3f')]['ids']);}})[_0xd9fe('0x23')](respondWithStatusCode(_0x558146,null))[_0xd9fe('0x51')](handleError(_0x558146,null));};exports[_0xd9fe('0x63')]=function(_0x2fa292,_0x32c390,_0x297ea8){if(_0x2fa292[_0xd9fe('0x59')]['id']){delete _0x2fa292['body']['id'];}return db[_0xd9fe('0x3c')][_0xd9fe('0x57')]({'where':{'id':_0x2fa292[_0xd9fe('0x52')]['id']}})['then'](handleEntityNotFound(_0x32c390,null))[_0xd9fe('0x23')](function(_0x1d0cb4){if(_0x1d0cb4){_0x2fa292[_0xd9fe('0x59')][_0xd9fe('0x64')]=_0x1d0cb4['id'];return db[_0xd9fe('0x5a')][_0xd9fe('0x58')](_0x2fa292[_0xd9fe('0x59')]);}})['then'](respondWithResult(_0x32c390,null))[_0xd9fe('0x51')](handleError(_0x32c390,null));};exports[_0xd9fe('0x65')]=function(_0x163b08,_0x2cf5bd,_0x295976){var _0x3b940={};var _0x1406c6={};var _0x33655a;var _0x2228f8;return db[_0xd9fe('0x3c')]['findOne']({'where':{'id':_0x163b08['params']['id']}})[_0xd9fe('0x23')](handleEntityNotFound(_0x2cf5bd,null))[_0xd9fe('0x23')](function(_0x5d8f86){if(_0x5d8f86){_0x33655a=_0x5d8f86;_0x1406c6[_0xd9fe('0x3e')]=_[_0xd9fe('0x53')](db[_0xd9fe('0x5a')][_0xd9fe('0x3d')]);_0x1406c6['query']=_[_0xd9fe('0x53')](_0x163b08[_0xd9fe('0x3f')]);_0x1406c6[_0xd9fe('0x40')]=_[_0xd9fe('0x41')](_0x1406c6[_0xd9fe('0x3e')],_0x1406c6[_0xd9fe('0x3f')]);_0x3b940[_0xd9fe('0x42')]=_[_0xd9fe('0x41')](_0x1406c6[_0xd9fe('0x3e')],qs['fields'](_0x163b08[_0xd9fe('0x3f')][_0xd9fe('0x43')]));_0x3b940[_0xd9fe('0x42')]=_0x3b940['attributes'][_0xd9fe('0x44')]?_0x3b940['attributes']:_0x1406c6[_0xd9fe('0x3e')];_0x3b940[_0xd9fe('0x60')]=qs['sort'](_0x163b08[_0xd9fe('0x3f')][_0xd9fe('0x47')]);_0x3b940[_0xd9fe('0x48')]=qs[_0xd9fe('0x40')](_[_0xd9fe('0x49')](_0x163b08[_0xd9fe('0x3f')],_0x1406c6['filters']));if(_0x163b08[_0xd9fe('0x3f')]['filter']){_0x3b940[_0xd9fe('0x48')]=_[_0xd9fe('0x55')](_0x3b940[_0xd9fe('0x48')],{'$or':_[_0xd9fe('0x3b')](_0x3b940[_0xd9fe('0x42')],function(_0x270e62){var _0x54518c={};_0x54518c[_0x270e62]={'$like':'%'+_0x163b08[_0xd9fe('0x3f')][_0xd9fe('0x4a')]+'%'};return _0x54518c;})});}if(_0x163b08[_0xd9fe('0x3f')][_0xd9fe('0x66')]){var _0xffddad=_0x163b08[_0xd9fe('0x3f')]['$gte'][_0xd9fe('0x67')](',');var _0x27009f={};_0x27009f[_0xffddad[0x0]]={'$gte':moment(_0xffddad[0x1])[_0xd9fe('0x68')](_0xd9fe('0x69'))};_0x3b940[_0xd9fe('0x48')]=_['merge'](_0x3b940[_0xd9fe('0x48')],_0x27009f);}_0x3b940=_['merge']({},_0x3b940,_0x163b08[_0xd9fe('0x56')]);return _0x33655a['getMessages'](_0x3b940);}})['then'](function(_0x1481c3){if(_0x1481c3){_0x2228f8=_0x1481c3['length'];if(!_0x163b08[_0xd9fe('0x3f')][_0xd9fe('0x45')](_0xd9fe('0x46'))){_0x3b940[_0xd9fe('0x32')]=qs[_0xd9fe('0x32')](_0x163b08[_0xd9fe('0x3f')][_0xd9fe('0x32')]);_0x3b940[_0xd9fe('0x31')]=qs[_0xd9fe('0x31')](_0x163b08[_0xd9fe('0x3f')][_0xd9fe('0x31')]);}return _0x33655a[_0xd9fe('0x65')](_0x3b940);}})['then'](function(_0x77b119){if(_0x77b119){return _0x77b119?{'count':_0x2228f8,'rows':_0x77b119}:null;}})[_0xd9fe('0x23')](respondWithResult(_0x2cf5bd,null))['catch'](handleError(_0x2cf5bd,null));}; \ No newline at end of file +var _0x1bbc=['model','attributes','fields','length','hasOwnProperty','limit','order','sort','pick','where','merge','type','VIRTUAL','filter','options','includeAll','findAll','rows','params','include','find','create','body','update','describe','getUnread','ChatInternalMessage','user','toInteger','addMembers','ids','omit','getMembers','findOne','User','removeMembers','ChatGroupId','getMessages','$gte','split','format','YYYY-MM-DD\x20HH:mm:ss','nolimit','html-pdf','eml-format','rimraf','request-promise','bluebird','mustache','sox','to-csv','ejs','squel','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/utils','../../config/environment','redis','defaults','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','request\x20sent','ChatGroup,\x20%s,\x20%s,\x20%s','stringify','error','message','ChatGroup,\x20%s,\x20%s','result','catch','status','end','json','count','offset','apply','destroy','sendStatus','stack','name','send','index','map','ChatGroup','rawAttributes','fieldName','key','query','keys','filters','intersection'];(function(_0x5519a9,_0x1c5147){var _0x32f2cc=function(_0x52ed58){while(--_0x52ed58){_0x5519a9['push'](_0x5519a9['shift']());}};_0x32f2cc(++_0x1c5147);}(_0x1bbc,0x15d));var _0xc1bb=function(_0x906ca6,_0x592235){_0x906ca6=_0x906ca6-0x0;var _0x12dd8b=_0x1bbc[_0x906ca6];return _0x12dd8b;};'use strict';var pdf=require(_0xc1bb('0x0'));var emlformat=require(_0xc1bb('0x1'));var rimraf=require(_0xc1bb('0x2'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0xc1bb('0x3'));var moment=require('moment');var BPromise=require(_0xc1bb('0x4'));var Mustache=require(_0xc1bb('0x5'));var util=require('util');var path=require('path');var sox=require(_0xc1bb('0x6'));var csv=require(_0xc1bb('0x7'));var ejs=require(_0xc1bb('0x8'));var fs=require('fs');var _=require('lodash');var squel=require(_0xc1bb('0x9'));var crypto=require('crypto');var jsforce=require(_0xc1bb('0xa'));var deskjs=require(_0xc1bb('0xb'));var toCsv=require(_0xc1bb('0x7'));var querystring=require('querystring');var Papa=require(_0xc1bb('0xc'));var Redis=require(_0xc1bb('0xd'));var authService=require(_0xc1bb('0xe'));var qs=require(_0xc1bb('0xf'));var as=require(_0xc1bb('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0xc1bb('0x11'));var utils=require(_0xc1bb('0x12'));var config=require(_0xc1bb('0x13'));var db=require('../../mysqldb')['db'];config[_0xc1bb('0x14')]=_[_0xc1bb('0x15')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xc1bb('0x14')]));require('./chatGroup.socket')['register'](socket);var jayson=require(_0xc1bb('0x16'));var client=jayson[_0xc1bb('0x17')][_0xc1bb('0x18')]({'port':0x232a});function checkPasswordPattern(_0x181c5d,_0x4888c7,_0x2887ea){if(_0x2887ea){var _0x1d9a17=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x1d9a17['test'](_0x4888c7)){return _0x181c5d;}else{throw new db[(_0xc1bb('0x19'))][(_0xc1bb('0x1a'))](_0xc1bb('0x1b'));}}else{return _0x181c5d;}}function respondWithRpcPromise(_0x47c533,_0x541e0d,_0xd5ae0,_0x1ae26d){return new BPromise(function(_0x2398b4,_0x5209b5){var _0x334af2=_0x1ae26d||client;return _0x334af2['request'](_0x47c533,_0xd5ae0)[_0xc1bb('0x1c')](function(_0x3c88ae){logger[_0xc1bb('0x1d')]('ChatGroup,\x20%s,\x20%s',_0x541e0d,_0xc1bb('0x1e'));logger['debug'](_0xc1bb('0x1f'),_0x541e0d,'request\x20sent',JSON[_0xc1bb('0x20')](_0x3c88ae));if(_0x3c88ae['error']){if(_0x3c88ae[_0xc1bb('0x21')]['code']===0x1f4){logger[_0xc1bb('0x21')]('ChatGroup,\x20%s,\x20%s',_0x541e0d,_0x3c88ae[_0xc1bb('0x21')][_0xc1bb('0x22')]);return _0x5209b5(_0x3c88ae[_0xc1bb('0x21')]['message']);}logger[_0xc1bb('0x21')](_0xc1bb('0x23'),_0x541e0d,_0x3c88ae['error'][_0xc1bb('0x22')]);return _0x2398b4(_0x3c88ae[_0xc1bb('0x21')][_0xc1bb('0x22')]);}else{logger[_0xc1bb('0x1d')](_0xc1bb('0x23'),_0x541e0d,_0xc1bb('0x1e'));_0x2398b4(_0x3c88ae[_0xc1bb('0x24')][_0xc1bb('0x22')]);}})[_0xc1bb('0x25')](function(_0x3544bb){logger[_0xc1bb('0x21')](_0xc1bb('0x23'),_0x541e0d,_0x3544bb);_0x5209b5(_0x3544bb);});});}function respondWithStatusCode(_0x1db325,_0x4cbdf9){_0x4cbdf9=_0x4cbdf9||0xcc;return function(_0x560d4c){if(_0x560d4c){return _0x1db325['sendStatus'](_0x4cbdf9);}return _0x1db325[_0xc1bb('0x26')](_0x4cbdf9)[_0xc1bb('0x27')]();};}function respondWithResult(_0x3ed4f3,_0x406545){_0x406545=_0x406545||0xc8;return function(_0x1a77c6){if(_0x1a77c6){return _0x3ed4f3[_0xc1bb('0x26')](_0x406545)[_0xc1bb('0x28')](_0x1a77c6);}};}function respondWithFilteredResult(_0xe13681,_0x2123de){return function(_0x2ccd8a){if(_0x2ccd8a){var _0x5d1565=_0x2ccd8a[_0xc1bb('0x29')],_0x2dec60=_0x2123de[_0xc1bb('0x2a')],_0x4f0ebb=_0x2123de[_0xc1bb('0x2a')]+_0x2123de['limit'],_0x106b3e;if(_0x4f0ebb>=_0x5d1565){_0x4f0ebb=_0x5d1565;_0x106b3e=0xc8;}else{_0x106b3e=0xce;}_0xe13681['status'](_0x106b3e);return _0xe13681['set']('Content-Range',_0x2dec60+'-'+_0x4f0ebb+'/'+_0x5d1565)[_0xc1bb('0x28')](_0x2ccd8a);}return null;};}function patchUpdates(_0x2da88c){return function(_0x5288bd){try{jsonpatch[_0xc1bb('0x2b')](_0x5288bd,_0x2da88c,!![]);}catch(_0x2167ce){return BPromise['reject'](_0x2167ce);}return _0x5288bd['save']();};}function saveUpdates(_0x266369,_0x136ceb){return function(_0x2d8888){if(_0x2d8888){return _0x2d8888['update'](_0x266369)['then'](function(_0x434faf){return _0x434faf;});}return null;};}function removeEntity(_0xb62d67,_0x1c2ff7){return function(_0x47b100){if(_0x47b100){return _0x47b100[_0xc1bb('0x2c')]()[_0xc1bb('0x1c')](function(){_0xb62d67[_0xc1bb('0x26')](0xcc)[_0xc1bb('0x27')]();});}};}function handleEntityNotFound(_0xe4d79,_0x145a0e){return function(_0x549912){if(!_0x549912){_0xe4d79[_0xc1bb('0x2d')](0x194);}return _0x549912;};}function handleError(_0x40a087,_0x5c55e7){_0x5c55e7=_0x5c55e7||0x1f4;return function(_0x2ff493){logger['error'](_0x2ff493[_0xc1bb('0x2e')]);if(_0x2ff493[_0xc1bb('0x2f')]){delete _0x2ff493[_0xc1bb('0x2f')];}_0x40a087[_0xc1bb('0x26')](_0x5c55e7)[_0xc1bb('0x30')](_0x2ff493);};}exports[_0xc1bb('0x31')]=function(_0x33ad82,_0x52652d){var _0x37bf25={},_0x423282={},_0x4b1dda={'count':0x0,'rows':[]};var _0x319ab7=_[_0xc1bb('0x32')](db[_0xc1bb('0x33')][_0xc1bb('0x34')],function(_0x2a9cb4){return{'name':_0x2a9cb4[_0xc1bb('0x35')],'type':_0x2a9cb4['type'][_0xc1bb('0x36')]};});_0x423282['model']=_[_0xc1bb('0x32')](_0x319ab7,_0xc1bb('0x2f'));_0x423282[_0xc1bb('0x37')]=_[_0xc1bb('0x38')](_0x33ad82[_0xc1bb('0x37')]);_0x423282[_0xc1bb('0x39')]=_[_0xc1bb('0x3a')](_0x423282[_0xc1bb('0x3b')],_0x423282[_0xc1bb('0x37')]);_0x37bf25[_0xc1bb('0x3c')]=_[_0xc1bb('0x3a')](_0x423282[_0xc1bb('0x3b')],qs[_0xc1bb('0x3d')](_0x33ad82[_0xc1bb('0x37')][_0xc1bb('0x3d')]));_0x37bf25['attributes']=_0x37bf25['attributes'][_0xc1bb('0x3e')]?_0x37bf25[_0xc1bb('0x3c')]:_0x423282['model'];if(!_0x33ad82['query'][_0xc1bb('0x3f')]('nolimit')){_0x37bf25['limit']=qs[_0xc1bb('0x40')](_0x33ad82[_0xc1bb('0x37')][_0xc1bb('0x40')]);_0x37bf25[_0xc1bb('0x2a')]=qs[_0xc1bb('0x2a')](_0x33ad82[_0xc1bb('0x37')][_0xc1bb('0x2a')]);}_0x37bf25[_0xc1bb('0x41')]=qs[_0xc1bb('0x42')](_0x33ad82['query'][_0xc1bb('0x42')]);_0x37bf25['where']=qs['filters'](_[_0xc1bb('0x43')](_0x33ad82['query'],_0x423282['filters']));if(_0x33ad82[_0xc1bb('0x37')]['filter']){_0x37bf25[_0xc1bb('0x44')]=_[_0xc1bb('0x45')](_0x37bf25[_0xc1bb('0x44')],{'$or':_[_0xc1bb('0x32')](_0x319ab7,function(_0x21f772){if(_0x21f772[_0xc1bb('0x46')]!==_0xc1bb('0x47')){var _0x3fc454={};_0x3fc454[_0x21f772[_0xc1bb('0x2f')]]={'$like':'%'+_0x33ad82[_0xc1bb('0x37')][_0xc1bb('0x48')]+'%'};return _0x3fc454;}})});}_0x37bf25=_[_0xc1bb('0x45')]({},_0x37bf25,_0x33ad82[_0xc1bb('0x49')]);var _0x21d41f={'where':_0x37bf25[_0xc1bb('0x44')]};return db[_0xc1bb('0x33')][_0xc1bb('0x29')](_0x21d41f)['then'](function(_0x2a66cf){_0x4b1dda['count']=_0x2a66cf;if(_0x33ad82[_0xc1bb('0x37')][_0xc1bb('0x4a')]){_0x37bf25['include']=[{'all':!![]}];}return db[_0xc1bb('0x33')][_0xc1bb('0x4b')](_0x37bf25);})[_0xc1bb('0x1c')](function(_0x181bfc){_0x4b1dda[_0xc1bb('0x4c')]=_0x181bfc;return _0x4b1dda;})[_0xc1bb('0x1c')](respondWithFilteredResult(_0x52652d,_0x37bf25))['catch'](handleError(_0x52652d,null));};exports['show']=function(_0x17ca95,_0x415e3a){var _0x17c477={'raw':!![],'where':{'id':_0x17ca95[_0xc1bb('0x4d')]['id']}},_0x18d323={};_0x18d323['model']=_['keys'](db['ChatGroup'][_0xc1bb('0x34')]);_0x18d323['query']=_[_0xc1bb('0x38')](_0x17ca95['query']);_0x18d323[_0xc1bb('0x39')]=_[_0xc1bb('0x3a')](_0x18d323['model'],_0x18d323[_0xc1bb('0x37')]);_0x17c477[_0xc1bb('0x3c')]=_[_0xc1bb('0x3a')](_0x18d323['model'],qs['fields'](_0x17ca95[_0xc1bb('0x37')][_0xc1bb('0x3d')]));_0x17c477[_0xc1bb('0x3c')]=_0x17c477[_0xc1bb('0x3c')]['length']?_0x17c477[_0xc1bb('0x3c')]:_0x18d323['model'];if(_0x17ca95['query'][_0xc1bb('0x4a')]){_0x17c477[_0xc1bb('0x4e')]=[{'all':!![]}];}_0x17c477=_[_0xc1bb('0x45')]({},_0x17c477,_0x17ca95[_0xc1bb('0x49')]);return db[_0xc1bb('0x33')][_0xc1bb('0x4f')](_0x17c477)[_0xc1bb('0x1c')](handleEntityNotFound(_0x415e3a,null))[_0xc1bb('0x1c')](respondWithResult(_0x415e3a,null))[_0xc1bb('0x25')](handleError(_0x415e3a,null));};exports[_0xc1bb('0x50')]=function(_0x54046f,_0x26c739){return db[_0xc1bb('0x33')][_0xc1bb('0x50')](_0x54046f[_0xc1bb('0x51')],{})[_0xc1bb('0x1c')](respondWithResult(_0x26c739,0xc9))[_0xc1bb('0x25')](handleError(_0x26c739,null));};exports[_0xc1bb('0x52')]=function(_0x1cab56,_0x5bc56b){if(_0x1cab56['body']['id']){delete _0x1cab56[_0xc1bb('0x51')]['id'];}return db[_0xc1bb('0x33')][_0xc1bb('0x4f')]({'where':{'id':_0x1cab56[_0xc1bb('0x4d')]['id']}})[_0xc1bb('0x1c')](handleEntityNotFound(_0x5bc56b,null))[_0xc1bb('0x1c')](saveUpdates(_0x1cab56['body'],null))['then'](respondWithResult(_0x5bc56b,null))[_0xc1bb('0x25')](handleError(_0x5bc56b,null));};exports[_0xc1bb('0x2c')]=function(_0x5c853f,_0x1b8ed6){return db[_0xc1bb('0x33')][_0xc1bb('0x4f')]({'where':{'id':_0x5c853f['params']['id']}})[_0xc1bb('0x1c')](handleEntityNotFound(_0x1b8ed6,null))[_0xc1bb('0x1c')](removeEntity(_0x1b8ed6,null))['catch'](handleError(_0x1b8ed6,null));};exports[_0xc1bb('0x53')]=function(_0x4cd57b,_0x323f7a){return db[_0xc1bb('0x33')]['describe']()[_0xc1bb('0x1c')](respondWithResult(_0x323f7a,null))[_0xc1bb('0x25')](handleError(_0x323f7a,null));};exports[_0xc1bb('0x54')]=function(_0x1299ab,_0x92b6e6,_0x10953){return db[_0xc1bb('0x55')]['count']({'where':{'ChatGroupId':_0x1299ab['params']['id'],'ToId':_0x1299ab[_0xc1bb('0x56')]['id'],'read':![]}})[_0xc1bb('0x1c')](function(_0x1ec4bd){return{'id':_[_0xc1bb('0x57')](_0x1299ab[_0xc1bb('0x4d')]['id']),'count':_0x1ec4bd};})[_0xc1bb('0x1c')](respondWithResult(_0x92b6e6,null))[_0xc1bb('0x25')](handleError(_0x92b6e6,null));};exports[_0xc1bb('0x58')]=function(_0x2e4426,_0x11de80,_0x9a5e41){return db[_0xc1bb('0x33')][_0xc1bb('0x4f')]({'where':{'id':_0x2e4426['params']['id']}})['then'](handleEntityNotFound(_0x11de80,null))[_0xc1bb('0x1c')](function(_0x3974cc){if(_0x3974cc){return _0x3974cc[_0xc1bb('0x58')](_0x2e4426[_0xc1bb('0x51')][_0xc1bb('0x59')],_[_0xc1bb('0x5a')](_0x2e4426[_0xc1bb('0x51')],[_0xc1bb('0x59'),'id'])||{});}})[_0xc1bb('0x1c')](respondWithResult(_0x11de80,null))[_0xc1bb('0x25')](handleError(_0x11de80,null));};exports[_0xc1bb('0x5b')]=function(_0x4fa63b,_0x47fa4d,_0x3d20ac){var _0x39e5a7={};var _0x7fff5b={};var _0x147a4d;var _0x4a3c9b;return db[_0xc1bb('0x33')][_0xc1bb('0x5c')]({'where':{'id':_0x4fa63b['params']['id']}})[_0xc1bb('0x1c')](handleEntityNotFound(_0x47fa4d,null))['then'](function(_0x3f2862){if(_0x3f2862){_0x147a4d=_0x3f2862;_0x7fff5b[_0xc1bb('0x3b')]=_['keys'](db[_0xc1bb('0x5d')]['rawAttributes']);_0x7fff5b[_0xc1bb('0x37')]=_[_0xc1bb('0x38')](_0x4fa63b['query']);_0x7fff5b[_0xc1bb('0x39')]=_[_0xc1bb('0x3a')](_0x7fff5b[_0xc1bb('0x3b')],_0x7fff5b['query']);_0x39e5a7[_0xc1bb('0x3c')]=_[_0xc1bb('0x3a')](_0x7fff5b['model'],qs['fields'](_0x4fa63b[_0xc1bb('0x37')][_0xc1bb('0x3d')]));_0x39e5a7['attributes']=_0x39e5a7[_0xc1bb('0x3c')][_0xc1bb('0x3e')]?_0x39e5a7[_0xc1bb('0x3c')]:_0x7fff5b[_0xc1bb('0x3b')];_0x39e5a7['order']=qs[_0xc1bb('0x42')](_0x4fa63b[_0xc1bb('0x37')]['sort']);_0x39e5a7[_0xc1bb('0x44')]=qs[_0xc1bb('0x39')](_['pick'](_0x4fa63b['query'],_0x7fff5b[_0xc1bb('0x39')]));if(_0x4fa63b[_0xc1bb('0x37')][_0xc1bb('0x48')]){_0x39e5a7['where']=_[_0xc1bb('0x45')](_0x39e5a7[_0xc1bb('0x44')],{'$or':_[_0xc1bb('0x32')](_0x39e5a7[_0xc1bb('0x3c')],function(_0x1da94f){var _0x5b4714={};_0x5b4714[_0x1da94f]={'$like':'%'+_0x4fa63b['query'][_0xc1bb('0x48')]+'%'};return _0x5b4714;})});}_0x39e5a7=_['merge']({},_0x39e5a7,_0x4fa63b['options']);return _0x147a4d[_0xc1bb('0x5b')](_0x39e5a7);}})['then'](function(_0x3e7f00){if(_0x3e7f00){_0x4a3c9b=_0x3e7f00['length'];if(!_0x4fa63b['query']['hasOwnProperty']('nolimit')){_0x39e5a7[_0xc1bb('0x40')]=qs[_0xc1bb('0x40')](_0x4fa63b['query'][_0xc1bb('0x40')]);_0x39e5a7[_0xc1bb('0x2a')]=qs[_0xc1bb('0x2a')](_0x4fa63b[_0xc1bb('0x37')][_0xc1bb('0x2a')]);}return _0x147a4d[_0xc1bb('0x5b')](_0x39e5a7);}})[_0xc1bb('0x1c')](function(_0x56b6ca){if(_0x56b6ca){return _0x56b6ca?{'count':_0x4a3c9b,'rows':_0x56b6ca}:null;}})[_0xc1bb('0x1c')](respondWithResult(_0x47fa4d,null))[_0xc1bb('0x25')](handleError(_0x47fa4d,null));};exports['removeMembers']=function(_0x4e27fb,_0x330729,_0x9036c1){return db[_0xc1bb('0x33')]['find']({'where':{'id':_0x4e27fb[_0xc1bb('0x4d')]['id']}})[_0xc1bb('0x1c')](handleEntityNotFound(_0x330729,null))[_0xc1bb('0x1c')](function(_0x5d1913){if(_0x5d1913){return _0x5d1913[_0xc1bb('0x5e')](_0x4e27fb[_0xc1bb('0x37')][_0xc1bb('0x59')]);}})[_0xc1bb('0x1c')](respondWithStatusCode(_0x330729,null))[_0xc1bb('0x25')](handleError(_0x330729,null));};exports['addMessage']=function(_0x4e0450,_0x72df95,_0x2eb19c){if(_0x4e0450[_0xc1bb('0x51')]['id']){delete _0x4e0450['body']['id'];}return db[_0xc1bb('0x33')][_0xc1bb('0x4f')]({'where':{'id':_0x4e0450[_0xc1bb('0x4d')]['id']}})['then'](handleEntityNotFound(_0x72df95,null))['then'](function(_0xe98810){if(_0xe98810){_0x4e0450[_0xc1bb('0x51')][_0xc1bb('0x5f')]=_0xe98810['id'];return db[_0xc1bb('0x55')][_0xc1bb('0x50')](_0x4e0450[_0xc1bb('0x51')]);}})[_0xc1bb('0x1c')](respondWithResult(_0x72df95,null))[_0xc1bb('0x25')](handleError(_0x72df95,null));};exports[_0xc1bb('0x60')]=function(_0x322f8c,_0x53c6c0,_0x55e41c){var _0x4eaf06={};var _0x7d46e5={};var _0x4ecb82;var _0x79d19f;return db['ChatGroup']['findOne']({'where':{'id':_0x322f8c[_0xc1bb('0x4d')]['id']}})[_0xc1bb('0x1c')](handleEntityNotFound(_0x53c6c0,null))['then'](function(_0x55f9ec){if(_0x55f9ec){_0x4ecb82=_0x55f9ec;_0x7d46e5[_0xc1bb('0x3b')]=_[_0xc1bb('0x38')](db[_0xc1bb('0x55')][_0xc1bb('0x34')]);_0x7d46e5['query']=_[_0xc1bb('0x38')](_0x322f8c[_0xc1bb('0x37')]);_0x7d46e5[_0xc1bb('0x39')]=_[_0xc1bb('0x3a')](_0x7d46e5[_0xc1bb('0x3b')],_0x7d46e5[_0xc1bb('0x37')]);_0x4eaf06['attributes']=_['intersection'](_0x7d46e5['model'],qs[_0xc1bb('0x3d')](_0x322f8c['query'][_0xc1bb('0x3d')]));_0x4eaf06[_0xc1bb('0x3c')]=_0x4eaf06[_0xc1bb('0x3c')]['length']?_0x4eaf06[_0xc1bb('0x3c')]:_0x7d46e5[_0xc1bb('0x3b')];_0x4eaf06['order']=qs[_0xc1bb('0x42')](_0x322f8c[_0xc1bb('0x37')][_0xc1bb('0x42')]);_0x4eaf06[_0xc1bb('0x44')]=qs['filters'](_[_0xc1bb('0x43')](_0x322f8c[_0xc1bb('0x37')],_0x7d46e5['filters']));if(_0x322f8c[_0xc1bb('0x37')]['filter']){_0x4eaf06[_0xc1bb('0x44')]=_[_0xc1bb('0x45')](_0x4eaf06[_0xc1bb('0x44')],{'$or':_['map'](_0x4eaf06[_0xc1bb('0x3c')],function(_0xb55587){var _0x59cc3e={};_0x59cc3e[_0xb55587]={'$like':'%'+_0x322f8c[_0xc1bb('0x37')][_0xc1bb('0x48')]+'%'};return _0x59cc3e;})});}if(_0x322f8c[_0xc1bb('0x37')][_0xc1bb('0x61')]){var _0x2ad32e=_0x322f8c[_0xc1bb('0x37')]['$gte'][_0xc1bb('0x62')](',');var _0x1ac4c={};_0x1ac4c[_0x2ad32e[0x0]]={'$gte':moment(_0x2ad32e[0x1])[_0xc1bb('0x63')](_0xc1bb('0x64'))};_0x4eaf06['where']=_[_0xc1bb('0x45')](_0x4eaf06[_0xc1bb('0x44')],_0x1ac4c);}_0x4eaf06=_['merge']({},_0x4eaf06,_0x322f8c[_0xc1bb('0x49')]);return _0x4ecb82[_0xc1bb('0x60')](_0x4eaf06);}})[_0xc1bb('0x1c')](function(_0xd9d186){if(_0xd9d186){_0x79d19f=_0xd9d186[_0xc1bb('0x3e')];if(!_0x322f8c[_0xc1bb('0x37')]['hasOwnProperty'](_0xc1bb('0x65'))){_0x4eaf06['limit']=qs[_0xc1bb('0x40')](_0x322f8c[_0xc1bb('0x37')]['limit']);_0x4eaf06[_0xc1bb('0x2a')]=qs['offset'](_0x322f8c[_0xc1bb('0x37')][_0xc1bb('0x2a')]);}return _0x4ecb82[_0xc1bb('0x60')](_0x4eaf06);}})[_0xc1bb('0x1c')](function(_0x419d75){if(_0x419d75){return _0x419d75?{'count':_0x79d19f,'rows':_0x419d75}:null;}})[_0xc1bb('0x1c')](respondWithResult(_0x53c6c0,null))[_0xc1bb('0x25')](handleError(_0x53c6c0,null));}; \ No newline at end of file diff --git a/server/api/chatGroup/chatGroup.events.js b/server/api/chatGroup/chatGroup.events.js index 74677a7..13010a1 100644 --- a/server/api/chatGroup/chatGroup.events.js +++ b/server/api/chatGroup/chatGroup.events.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x2032=['exports','../../mysqldb','ChatGroup','setMaxListeners','update','remove','emit','hasOwnProperty','hook'];(function(_0x334841,_0x2bbc4c){var _0x5beb4b=function(_0x4bea72){while(--_0x4bea72){_0x334841['push'](_0x334841['shift']());}};_0x5beb4b(++_0x2bbc4c);}(_0x2032,0xd9));var _0x2203=function(_0x1cf4b7,_0x3cf5fd){_0x1cf4b7=_0x1cf4b7-0x0;var _0x1bef7e=_0x2032[_0x1cf4b7];return _0x1bef7e;};'use strict';var EventEmitter=require('events');var ChatGroup=require(_0x2203('0x0'))['db'][_0x2203('0x1')];var ChatGroupEvents=new EventEmitter();ChatGroupEvents[_0x2203('0x2')](0x0);var events={'afterCreate':'save','afterUpdate':_0x2203('0x3'),'afterDestroy':_0x2203('0x4')};function emitEvent(_0x4b4c7f){return function(_0x46c49a,_0x880dcd,_0x44ccfd){ChatGroupEvents[_0x2203('0x5')](_0x4b4c7f+':'+_0x46c49a['id'],_0x46c49a);ChatGroupEvents[_0x2203('0x5')](_0x4b4c7f,_0x46c49a);_0x44ccfd(null);};}for(var e in events){if(events[_0x2203('0x6')](e)){var event=events[e];ChatGroup[_0x2203('0x7')](e,emitEvent(event));}}module[_0x2203('0x8')]=ChatGroupEvents; \ No newline at end of file +var _0x2ef3=['setMaxListeners','save','update','emit','hook','exports','events','../../mysqldb','ChatGroup'];(function(_0x405f28,_0x3ea99f){var _0x1a6075=function(_0x1d8d30){while(--_0x1d8d30){_0x405f28['push'](_0x405f28['shift']());}};_0x1a6075(++_0x3ea99f);}(_0x2ef3,0xba));var _0x32ef=function(_0x4d5332,_0x4875d3){_0x4d5332=_0x4d5332-0x0;var _0x27392e=_0x2ef3[_0x4d5332];return _0x27392e;};'use strict';var EventEmitter=require(_0x32ef('0x0'));var ChatGroup=require(_0x32ef('0x1'))['db'][_0x32ef('0x2')];var ChatGroupEvents=new EventEmitter();ChatGroupEvents[_0x32ef('0x3')](0x0);var events={'afterCreate':_0x32ef('0x4'),'afterUpdate':_0x32ef('0x5'),'afterDestroy':'remove'};function emitEvent(_0x38f865){return function(_0x38b7f3,_0x524ab6,_0x402857){ChatGroupEvents[_0x32ef('0x6')](_0x38f865+':'+_0x38b7f3['id'],_0x38b7f3);ChatGroupEvents['emit'](_0x38f865,_0x38b7f3);_0x402857(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];ChatGroup[_0x32ef('0x7')](e,emitEvent(event));}}module[_0x32ef('0x8')]=ChatGroupEvents; \ No newline at end of file diff --git a/server/api/chatGroup/chatGroup.model.js b/server/api/chatGroup/chatGroup.model.js index 0e27a73..a83191a 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 _0x2cd3=['chat_groups','lodash','../../config/logger','api','moment','bluebird','request-promise','path','./chatGroup.attributes','exports','define','ChatGroup'];(function(_0x5b78e8,_0x55096b){var _0xf2c321=function(_0x4e0cff){while(--_0x4e0cff){_0x5b78e8['push'](_0x5b78e8['shift']());}};_0xf2c321(++_0x55096b);}(_0x2cd3,0xf1));var _0x32cd=function(_0x33975c,_0x50d085){_0x33975c=_0x33975c-0x0;var _0x1c15ab=_0x2cd3[_0x33975c];return _0x1c15ab;};'use strict';var _=require(_0x32cd('0x0'));var util=require('util');var logger=require(_0x32cd('0x1'))(_0x32cd('0x2'));var moment=require(_0x32cd('0x3'));var BPromise=require(_0x32cd('0x4'));var rp=require(_0x32cd('0x5'));var fs=require('fs');var path=require(_0x32cd('0x6'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x32cd('0x7'));module[_0x32cd('0x8')]=function(_0x1af8c8,_0x1024e0){return _0x1af8c8[_0x32cd('0x9')](_0x32cd('0xa'),attributes,{'tableName':_0x32cd('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x02ef=['../../config/environment','./chatGroup.attributes','exports','define','ChatGroup','chat_groups','lodash','../../config/logger','moment','bluebird','path','rimraf'];(function(_0x530d6f,_0x400b43){var _0x40701e=function(_0xed3e5d){while(--_0xed3e5d){_0x530d6f['push'](_0x530d6f['shift']());}};_0x40701e(++_0x400b43);}(_0x02ef,0x11a));var _0xf02e=function(_0x346f5a,_0x33de62){_0x346f5a=_0x346f5a-0x0;var _0x2c1254=_0x02ef[_0x346f5a];return _0x2c1254;};'use strict';var _=require(_0xf02e('0x0'));var util=require('util');var logger=require(_0xf02e('0x1'))('api');var moment=require(_0xf02e('0x2'));var BPromise=require(_0xf02e('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xf02e('0x4'));var rimraf=require(_0xf02e('0x5'));var config=require(_0xf02e('0x6'));var attributes=require(_0xf02e('0x7'));module[_0xf02e('0x8')]=function(_0x511257,_0x332c29){return _0x511257[_0xf02e('0x9')](_0xf02e('0xa'),attributes,{'tableName':_0xf02e('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/chatGroup/chatGroup.rpc.js b/server/api/chatGroup/chatGroup.rpc.js index 035fe1c..f63ede1 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 _0xe9aa=['message','result','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','redis','defaults','localhost','socket.io-emitter','./chatGroup.socket','info','ChatGroup,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code'];(function(_0x5d8314,_0x1904f1){var _0x3047a9=function(_0x4ea036){while(--_0x4ea036){_0x5d8314['push'](_0x5d8314['shift']());}};_0x3047a9(++_0x1904f1);}(_0xe9aa,0xb8));var _0xae9a=function(_0x3ae136,_0x51eba4){_0x3ae136=_0x3ae136-0x0;var _0x2d6f24=_0xe9aa[_0x3ae136];return _0x2d6f24;};'use strict';var _=require(_0xae9a('0x0'));var util=require(_0xae9a('0x1'));var moment=require(_0xae9a('0x2'));var BPromise=require(_0xae9a('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xae9a('0x4'));var db=require(_0xae9a('0x5'))['db'];var utils=require(_0xae9a('0x6'));var logger=require(_0xae9a('0x7'))(_0xae9a('0x8'));var config=require(_0xae9a('0x9'));var jayson=require(_0xae9a('0xa'));var client=jayson[_0xae9a('0xb')]['http']({'port':0x232a});config[_0xae9a('0xc')]=_[_0xae9a('0xd')](config['redis'],{'host':_0xae9a('0xe'),'port':0x18eb});var socket=require(_0xae9a('0xf'))(new Redis(config[_0xae9a('0xc')]));require(_0xae9a('0x10'))['register'](socket);function respondWithRpcPromise(_0x47a9e6,_0x226111,_0x111acd){return new BPromise(function(_0x40ea67,_0x20d754){return client['request'](_0x47a9e6,_0x111acd)['then'](function(_0x1ec9fd){logger[_0xae9a('0x11')](_0xae9a('0x12'),_0x226111,_0xae9a('0x13'));logger[_0xae9a('0x14')]('ChatGroup,\x20%s,\x20%s,\x20%s',_0x226111,_0xae9a('0x13'),JSON[_0xae9a('0x15')](_0x1ec9fd));if(_0x1ec9fd[_0xae9a('0x16')]){if(_0x1ec9fd[_0xae9a('0x16')][_0xae9a('0x17')]===0x1f4){logger[_0xae9a('0x16')](_0xae9a('0x12'),_0x226111,_0x1ec9fd['error'][_0xae9a('0x18')]);return _0x20d754(_0x1ec9fd['error'][_0xae9a('0x18')]);}logger[_0xae9a('0x16')](_0xae9a('0x12'),_0x226111,_0x1ec9fd['error'][_0xae9a('0x18')]);return _0x40ea67(_0x1ec9fd['error'][_0xae9a('0x18')]);}else{logger['info'](_0xae9a('0x12'),_0x226111,_0xae9a('0x13'));_0x40ea67(_0x1ec9fd[_0xae9a('0x19')][_0xae9a('0x18')]);}})['catch'](function(_0x54a57f){logger[_0xae9a('0x16')]('ChatGroup,\x20%s,\x20%s',_0x226111,_0x54a57f);_0x20d754(_0x54a57f);});});} \ No newline at end of file +var _0x2357=['util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','redis','socket.io-emitter','request','then','info','ChatGroup,\x20%s,\x20%s','request\x20sent','debug','ChatGroup,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch'];(function(_0x4f9996,_0x3c5583){var _0x267d1e=function(_0x513f66){while(--_0x513f66){_0x4f9996['push'](_0x4f9996['shift']());}};_0x267d1e(++_0x3c5583);}(_0x2357,0x186));var _0x7235=function(_0xa11bda,_0x3ad31c){_0xa11bda=_0xa11bda-0x0;var _0x2f5c7c=_0x2357[_0xa11bda];return _0x2f5c7c;};'use strict';var _=require('lodash');var util=require(_0x7235('0x0'));var moment=require(_0x7235('0x1'));var BPromise=require(_0x7235('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x7235('0x3'));var db=require(_0x7235('0x4'))['db'];var utils=require(_0x7235('0x5'));var logger=require(_0x7235('0x6'))(_0x7235('0x7'));var config=require('../../config/environment');var jayson=require(_0x7235('0x8'));var client=jayson[_0x7235('0x9')][_0x7235('0xa')]({'port':0x232a});config['redis']=_['defaults'](config[_0x7235('0xb')],{'host':'localhost','port':0x18eb});var socket=require(_0x7235('0xc'))(new Redis(config[_0x7235('0xb')]));require('./chatGroup.socket')['register'](socket);function respondWithRpcPromise(_0x3f5fd1,_0x5bbf80,_0x349773){return new BPromise(function(_0x5e2781,_0x292c2a){return client[_0x7235('0xd')](_0x3f5fd1,_0x349773)[_0x7235('0xe')](function(_0x3b8cec){logger[_0x7235('0xf')](_0x7235('0x10'),_0x5bbf80,_0x7235('0x11'));logger[_0x7235('0x12')](_0x7235('0x13'),_0x5bbf80,'request\x20sent',JSON[_0x7235('0x14')](_0x3b8cec));if(_0x3b8cec[_0x7235('0x15')]){if(_0x3b8cec[_0x7235('0x15')][_0x7235('0x16')]===0x1f4){logger[_0x7235('0x15')](_0x7235('0x10'),_0x5bbf80,_0x3b8cec['error'][_0x7235('0x17')]);return _0x292c2a(_0x3b8cec['error'][_0x7235('0x17')]);}logger[_0x7235('0x15')](_0x7235('0x10'),_0x5bbf80,_0x3b8cec['error']['message']);return _0x5e2781(_0x3b8cec[_0x7235('0x15')][_0x7235('0x17')]);}else{logger['info'](_0x7235('0x10'),_0x5bbf80,_0x7235('0x11'));_0x5e2781(_0x3b8cec[_0x7235('0x18')][_0x7235('0x17')]);}})[_0x7235('0x19')](function(_0x1be72d){logger[_0x7235('0x15')](_0x7235('0x10'),_0x5bbf80,_0x1be72d);_0x292c2a(_0x1be72d);});});} \ No newline at end of file diff --git a/server/api/chatGroup/chatGroup.socket.js b/server/api/chatGroup/chatGroup.socket.js index 30e0c50..bd0ef59 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 _0xd42c=['emit','length','chatGroup:','./chatGroup.events','save','update'];(function(_0xa464c9,_0x7c86d8){var _0x3d73c4=function(_0x5c2056){while(--_0x5c2056){_0xa464c9['push'](_0xa464c9['shift']());}};_0x3d73c4(++_0x7c86d8);}(_0xd42c,0xff));var _0xcd42=function(_0x2af75c,_0x29d2bc){_0x2af75c=_0x2af75c-0x0;var _0x55fc00=_0xd42c[_0x2af75c];return _0x55fc00;};'use strict';var ChatGroupEvents=require(_0xcd42('0x0'));var events=[_0xcd42('0x1'),'remove',_0xcd42('0x2')];function createListener(_0x58adfe,_0x1f7b3a){return function(_0x216ec1){_0x1f7b3a[_0xcd42('0x3')](_0x58adfe,_0x216ec1);};}function removeListener(_0x2c4fb0,_0x5988ec){return function(){ChatGroupEvents['removeListener'](_0x2c4fb0,_0x5988ec);};}exports['register']=function(_0x27e95b){for(var _0x1b1641=0x0,_0x11a417=events[_0xcd42('0x4')];_0x1b1641<_0x11a417;_0x1b1641++){var _0x3f7075=events[_0x1b1641];var _0x52f3b0=createListener(_0xcd42('0x5')+_0x3f7075,_0x27e95b);ChatGroupEvents['on'](_0x3f7075,_0x52f3b0);}}; \ No newline at end of file +var _0x2a59=['register','length','chatGroup:','./chatGroup.events','save','remove','update','emit'];(function(_0x3e5627,_0x2bde5c){var _0x549f8d=function(_0x146db6){while(--_0x146db6){_0x3e5627['push'](_0x3e5627['shift']());}};_0x549f8d(++_0x2bde5c);}(_0x2a59,0xdb));var _0x92a5=function(_0xbd08b4,_0x4790ed){_0xbd08b4=_0xbd08b4-0x0;var _0x314f1e=_0x2a59[_0xbd08b4];return _0x314f1e;};'use strict';var ChatGroupEvents=require(_0x92a5('0x0'));var events=[_0x92a5('0x1'),_0x92a5('0x2'),_0x92a5('0x3')];function createListener(_0x3a842d,_0x3bef7e){return function(_0x1b7c63){_0x3bef7e[_0x92a5('0x4')](_0x3a842d,_0x1b7c63);};}function removeListener(_0x4226b8,_0x299103){return function(){ChatGroupEvents['removeListener'](_0x4226b8,_0x299103);};}exports[_0x92a5('0x5')]=function(_0x42993a){for(var _0xd1b66e=0x0,_0x52f4e6=events[_0x92a5('0x6')];_0xd1b66e<_0x52f4e6;_0xd1b66e++){var _0x45821e=events[_0xd1b66e];var _0x53bacc=createListener(_0x92a5('0x7')+_0x45821e,_0x42993a);ChatGroupEvents['on'](_0x45821e,_0x53bacc);}}; \ No newline at end of file diff --git a/server/api/chatGroup/index.js b/server/api/chatGroup/index.js index 2c14728..56965d8 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 _0xb08f=['connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./chatGroup.controller','get','index','/describe','/:id','/:id/unread','isAuthenticated','getUnread','/:id/members','getMembers','getMessages','post','create','/:id/messages','addMessage','put','update','delete','destroy','removeMembers','exports','multer','util'];(function(_0x3edc37,_0x2cac9f){var _0x544bff=function(_0x47505e){while(--_0x47505e){_0x3edc37['push'](_0x3edc37['shift']());}};_0x544bff(++_0x2cac9f);}(_0xb08f,0x1b1));var _0xfb08=function(_0x534468,_0x36f79e){_0x534468=_0x534468-0x0;var _0x220e1d=_0xb08f[_0x534468];return _0x220e1d;};'use strict';var multer=require(_0xfb08('0x0'));var util=require(_0xfb08('0x1'));var path=require('path');var timeout=require(_0xfb08('0x2'));var express=require(_0xfb08('0x3'));var router=express[_0xfb08('0x4')]();var auth=require(_0xfb08('0x5'));var interaction=require(_0xfb08('0x6'));var config=require(_0xfb08('0x7'));var controller=require(_0xfb08('0x8'));router[_0xfb08('0x9')]('/',auth['isAuthenticated'](),controller[_0xfb08('0xa')]);router[_0xfb08('0x9')](_0xfb08('0xb'),auth['isAuthenticated'](),controller['describe']);router[_0xfb08('0x9')](_0xfb08('0xc'),auth['isAuthenticated'](),controller['show']);router[_0xfb08('0x9')](_0xfb08('0xd'),auth[_0xfb08('0xe')](),controller[_0xfb08('0xf')]);router[_0xfb08('0x9')](_0xfb08('0x10'),auth[_0xfb08('0xe')](),controller[_0xfb08('0x11')]);router[_0xfb08('0x9')]('/:id/messages',auth[_0xfb08('0xe')](),controller[_0xfb08('0x12')]);router[_0xfb08('0x13')]('/',auth[_0xfb08('0xe')](),controller[_0xfb08('0x14')]);router[_0xfb08('0x13')]('/:id/members',auth['isAuthenticated'](),controller['addMembers']);router[_0xfb08('0x13')](_0xfb08('0x15'),auth['isAuthenticated'](),controller[_0xfb08('0x16')]);router[_0xfb08('0x17')](_0xfb08('0xc'),auth[_0xfb08('0xe')](),controller[_0xfb08('0x18')]);router[_0xfb08('0x19')](_0xfb08('0xc'),auth[_0xfb08('0xe')](),controller[_0xfb08('0x1a')]);router[_0xfb08('0x19')](_0xfb08('0x10'),auth[_0xfb08('0xe')](),controller[_0xfb08('0x1b')]);module[_0xfb08('0x1c')]=router; \ No newline at end of file +var _0xa552=['getMembers','post','create','addMembers','/:id/messages','put','update','delete','destroy','removeMembers','exports','multer','path','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./chatGroup.controller','get','isAuthenticated','describe','/:id','show','/:id/unread','getUnread','/:id/members'];(function(_0x4c5127,_0x22918b){var _0x491ac8=function(_0x4294ce){while(--_0x4294ce){_0x4c5127['push'](_0x4c5127['shift']());}};_0x491ac8(++_0x22918b);}(_0xa552,0x119));var _0x2a55=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xa552[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require(_0x2a55('0x0'));var util=require('util');var path=require(_0x2a55('0x1'));var timeout=require(_0x2a55('0x2'));var express=require('express');var router=express[_0x2a55('0x3')]();var auth=require(_0x2a55('0x4'));var interaction=require(_0x2a55('0x5'));var config=require(_0x2a55('0x6'));var controller=require(_0x2a55('0x7'));router[_0x2a55('0x8')]('/',auth[_0x2a55('0x9')](),controller['index']);router[_0x2a55('0x8')]('/describe',auth['isAuthenticated'](),controller[_0x2a55('0xa')]);router[_0x2a55('0x8')](_0x2a55('0xb'),auth[_0x2a55('0x9')](),controller[_0x2a55('0xc')]);router[_0x2a55('0x8')](_0x2a55('0xd'),auth[_0x2a55('0x9')](),controller[_0x2a55('0xe')]);router[_0x2a55('0x8')](_0x2a55('0xf'),auth[_0x2a55('0x9')](),controller[_0x2a55('0x10')]);router[_0x2a55('0x8')]('/:id/messages',auth['isAuthenticated'](),controller['getMessages']);router[_0x2a55('0x11')]('/',auth[_0x2a55('0x9')](),controller[_0x2a55('0x12')]);router[_0x2a55('0x11')](_0x2a55('0xf'),auth[_0x2a55('0x9')](),controller[_0x2a55('0x13')]);router[_0x2a55('0x11')](_0x2a55('0x14'),auth[_0x2a55('0x9')](),controller['addMessage']);router[_0x2a55('0x15')]('/:id',auth[_0x2a55('0x9')](),controller[_0x2a55('0x16')]);router[_0x2a55('0x17')](_0x2a55('0xb'),auth[_0x2a55('0x9')](),controller[_0x2a55('0x18')]);router['delete'](_0x2a55('0xf'),auth[_0x2a55('0x9')](),controller[_0x2a55('0x19')]);module[_0x2a55('0x1a')]=router; \ No newline at end of file diff --git a/server/api/chatInteraction/chatInteraction.attributes.js b/server/api/chatInteraction/chatInteraction.attributes.js index 0e45be1..29141e8 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 _0x0e1d=['TEXT','STRING','DATE','long','out','sequelize','exports','BOOLEAN','INTEGER','ENUM','star','thumb'];(function(_0x2dcfdf,_0x319d88){var _0x1c40a1=function(_0x50242a){while(--_0x50242a){_0x2dcfdf['push'](_0x2dcfdf['shift']());}};_0x1c40a1(++_0x319d88);}(_0x0e1d,0x1d9));var _0xd0e1=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x0e1d[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require(_0xd0e1('0x0'));module[_0xd0e1('0x1')]={'closed':{'type':Sequelize[_0xd0e1('0x2')],'defaultValue':![]},'ratingValue':{'type':Sequelize[_0xd0e1('0x3')]},'ratingType':{'type':Sequelize[_0xd0e1('0x4')](_0xd0e1('0x5'),_0xd0e1('0x6')),'defaultValue':'star'},'ratingMessage':{'type':Sequelize['TEXT']},'pathTranscript':{'type':Sequelize[_0xd0e1('0x7')]},'mailTranscript':{'type':Sequelize[_0xd0e1('0x8')],'validate':{'isEmail':!![]}},'closedAt':{'type':Sequelize[_0xd0e1('0x9')]},'disposition':{'type':Sequelize['STRING']},'note':{'type':Sequelize[_0xd0e1('0x8')]},'browserName':{'type':Sequelize[_0xd0e1('0x8')]},'browserVersion':{'type':Sequelize[_0xd0e1('0x8')]},'osName':{'type':Sequelize[_0xd0e1('0x8')]},'osVersion':{'type':Sequelize[_0xd0e1('0x8')]},'deviceModel':{'type':Sequelize['STRING']},'deviceVendor':{'type':Sequelize['STRING']},'deviceType':{'type':Sequelize[_0xd0e1('0x8')]},'referer':{'type':Sequelize[_0xd0e1('0x7')]},'customerIp':{'type':Sequelize[_0xd0e1('0x8')]},'formData':{'type':Sequelize[_0xd0e1('0x7')](_0xd0e1('0xa'))},'read1stAt':{'type':Sequelize[_0xd0e1('0x9')]},'lastMsgAt':{'type':Sequelize[_0xd0e1('0x9')]},'lastMsgDirection':{'type':Sequelize[_0xd0e1('0x4')]('in',_0xd0e1('0xb')),'defaultValue':'in','allowNull':![]},'closeReason':{'type':Sequelize[_0xd0e1('0x8')]},'customerPort':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x9120=['INTEGER','ENUM','star','DATE','STRING','TEXT','long','BOOLEAN'];(function(_0x3cb3ca,_0x44d697){var _0x214366=function(_0x6b38e1){while(--_0x6b38e1){_0x3cb3ca['push'](_0x3cb3ca['shift']());}};_0x214366(++_0x44d697);}(_0x9120,0x10f));var _0x0912=function(_0x240374,_0x20432e){_0x240374=_0x240374-0x0;var _0x59332c=_0x9120[_0x240374];return _0x59332c;};'use strict';var Sequelize=require('sequelize');module['exports']={'closed':{'type':Sequelize[_0x0912('0x0')],'defaultValue':![]},'ratingValue':{'type':Sequelize[_0x0912('0x1')]},'ratingType':{'type':Sequelize[_0x0912('0x2')](_0x0912('0x3'),'thumb'),'defaultValue':'star'},'ratingMessage':{'type':Sequelize['TEXT']},'pathTranscript':{'type':Sequelize['TEXT']},'mailTranscript':{'type':Sequelize['STRING'],'validate':{'isEmail':!![]}},'closedAt':{'type':Sequelize[_0x0912('0x4')]},'disposition':{'type':Sequelize[_0x0912('0x5')]},'note':{'type':Sequelize[_0x0912('0x5')]},'browserName':{'type':Sequelize[_0x0912('0x5')]},'browserVersion':{'type':Sequelize[_0x0912('0x5')]},'osName':{'type':Sequelize[_0x0912('0x5')]},'osVersion':{'type':Sequelize[_0x0912('0x5')]},'deviceModel':{'type':Sequelize[_0x0912('0x5')]},'deviceVendor':{'type':Sequelize[_0x0912('0x5')]},'deviceType':{'type':Sequelize[_0x0912('0x5')]},'referer':{'type':Sequelize[_0x0912('0x6')]},'customerIp':{'type':Sequelize[_0x0912('0x5')]},'formData':{'type':Sequelize['TEXT'](_0x0912('0x7'))},'read1stAt':{'type':Sequelize[_0x0912('0x4')]},'lastMsgAt':{'type':Sequelize[_0x0912('0x4')]},'lastMsgDirection':{'type':Sequelize[_0x0912('0x2')]('in','out'),'defaultValue':'in','allowNull':![]},'closeReason':{'type':Sequelize[_0x0912('0x5')]},'customerPort':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/chatInteraction/chatInteraction.controller.js b/server/api/chatInteraction/chatInteraction.controller.js index 55b7ead..da9efa1 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 _0x9fd4=['Visitor','agentIdentifier','website_alias','agent_fullname','System','[%s]\x20%s:\x20%s\x0a','createdAt','MM/DD/YYYY\x20HH:mm:ss','secret','MailAccount','findOne','Smtp','service','host','port','secure','authentication','auth','pass','SendMail','sendMail','email','Mail\x20Transcript','Hi\x20%s,\x20attached\x20you\x20can\x20find\x20your\x20transcript\x20file.\x20\x0a\x0aRegards.\x20\x0a\x0a','addMessage','ids','getMessages','ChatInteractionId','findAll','rows','includeAgent','alias','omit','spread','Tag','emit','removeTags','unix','server','tmp','attachments','transcript-%d-%s.zip','firstName','direction','ChatWebsite','Account','Owner','10px','30px','\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20%s\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20{{page}}/{{pages}}\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20%s\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','%s\x20#%d','Chat','YYYY-MM-DD','N.A.','YYYY-MM-DD\x20HH:mm:ss','closedAt','browserName','osName','customerPort','tail','existsSync','createReadStream','pipe','createWriteStream','out','lastName','views','downloadInteraction.html','toFile','transcript-','log','err','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','sox','to-csv','ejs','lodash','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./chatInteraction.socket','register','jayson/promise','client','http','test','Sequelize','ValidationError','The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.','then','info','ChatInteraction,\x20%s,\x20%s','debug','ChatInteraction,\x20%s,\x20%s,\x20%s','stringify','error','code','message','request\x20sent','result','catch','sendStatus','status','json','offset','limit','apply','save','update','destroy','end','stack','name','send','Users','map','fullname','TagIds','Tags','push','index','ChatInteraction','rawAttributes','key','query','keys','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','select','field','tools_tags','u.id','from','u.id\x20=\x20ui.UserId','chat_interactions','left_join','cm_contacts','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL','users','chat_websites','a.id\x20=\x20i.ChatWebsiteId','chat_messages','me.ChatInteractionId\x20=\x20i.id','chat_interaction_has_tags','it.ChatInteractionId\x20=\x20i.id','t.id\x20=\x20it.TagId','expr','parseSearch','search','sqlOperator','conditions','unreadMessages','value','having','`\x20=\x200','`\x20>\x200','Contact','$substring','getFullTextValue','c.firstName\x20LIKE\x20?\x20OR\x20c.lastName\x20LIKE\x20?\x20OR\x20c.email\x20LIKE\x20?','buildExpression','type','text','split','forEach','CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','union','User','CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?','find','UserId','start','body','some','isEmpty','ChatWebsiteId','concat','$gte','parse','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','i.id\x20LIKE\x20?','MATCH\x20(me.body)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','CONCAT(c.firstName,\x20\x27\x20\x27,\x20c.lastName)\x20LIKE\x20?','group','i.id','QueryTypes','SELECT','clone','journey','i.ChatWebsiteId\x20IS\x20NOT\x20NULL','user','i.ChatWebsiteId\x20IS\x20NULL','i.ChatWebsiteId\x20IN\x20?','count','sequelize','merge','Account.key','a.mandatoryDisposition','Contact.firstName','Contact.email','c.phone','c.mobile','Contact.mobile','c.fax','o.fullname','Owner.fullname','o.internal','Owner.internal','GROUP_CONCAT(DISTINCT\x20t.id)','toString','all','params','includeAll','include','options','create','describe','customUpdate','abandonInteraction,\x20%s,\x20%s,\x20%s','entity\x20not\x20found','closed','disposition','AbandonInteraction','abandon','file','basename','mimetype','Attachment','Unauthorized','attachId','download','join','root','server/files/attachments/','close','mailTranscript','server/files/chat/upload/','format','transcript-%s.txt','now','pathTranscript','ChatMessage','Messages','CmContact','ContactId','%s%d','agentAlias','customer'];(function(_0x4b73a2,_0x40b5fe){var _0x383c66=function(_0x3917ae){while(--_0x3917ae){_0x4b73a2['push'](_0x4b73a2['shift']());}};_0x383c66(++_0x40b5fe);}(_0x9fd4,0x16c));var _0x49fd=function(_0x5f1a39,_0x95f50b){_0x5f1a39=_0x5f1a39-0x0;var _0x1c1de8=_0x9fd4[_0x5f1a39];return _0x1c1de8;};'use strict';var pdf=require(_0x49fd('0x0'));var emlformat=require(_0x49fd('0x1'));var rimraf=require(_0x49fd('0x2'));var zipdir=require(_0x49fd('0x3'));var jsonpatch=require(_0x49fd('0x4'));var rp=require(_0x49fd('0x5'));var moment=require(_0x49fd('0x6'));var BPromise=require(_0x49fd('0x7'));var Mustache=require(_0x49fd('0x8'));var util=require('util');var path=require('path');var sox=require(_0x49fd('0x9'));var csv=require(_0x49fd('0xa'));var ejs=require(_0x49fd('0xb'));var fs=require('fs');var _=require(_0x49fd('0xc'));var squel=require('squel');var crypto=require(_0x49fd('0xd'));var jsforce=require(_0x49fd('0xe'));var deskjs=require(_0x49fd('0xf'));var toCsv=require(_0x49fd('0xa'));var querystring=require(_0x49fd('0x10'));var Papa=require('papaparse');var Redis=require(_0x49fd('0x11'));var authService=require(_0x49fd('0x12'));var qs=require(_0x49fd('0x13'));var as=require(_0x49fd('0x14'));var hardwareService=require(_0x49fd('0x15'));var logger=require(_0x49fd('0x16'))(_0x49fd('0x17'));var utils=require('../../config/utils');var config=require(_0x49fd('0x18'));var db=require(_0x49fd('0x19'))['db'];config[_0x49fd('0x1a')]=_[_0x49fd('0x1b')](config[_0x49fd('0x1a')],{'host':_0x49fd('0x1c'),'port':0x18eb});var socket=require(_0x49fd('0x1d'))(new Redis(config[_0x49fd('0x1a')]));require(_0x49fd('0x1e'))[_0x49fd('0x1f')](socket);var jayson=require(_0x49fd('0x20'));var client=jayson[_0x49fd('0x21')][_0x49fd('0x22')]({'port':0x232b});var client9004=jayson[_0x49fd('0x21')][_0x49fd('0x22')]({'port':0x232c});function checkPasswordPattern(_0x201109,_0x2859f2,_0x3ca675){if(_0x3ca675){var _0x2f8d68=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x2f8d68[_0x49fd('0x23')](_0x2859f2)){return _0x201109;}else{throw new db[(_0x49fd('0x24'))][(_0x49fd('0x25'))](_0x49fd('0x26'));}}else{return _0x201109;}}function respondWithRpcPromise(_0x475eee,_0xb55d24,_0x5d568d,_0x598793){return new BPromise(function(_0x2dc611,_0x3fd46b){var _0x59a407=_0x598793||client;return _0x59a407['request'](_0x475eee,_0x5d568d)[_0x49fd('0x27')](function(_0x53cbd1){logger[_0x49fd('0x28')](_0x49fd('0x29'),_0xb55d24,'request\x20sent');logger[_0x49fd('0x2a')](_0x49fd('0x2b'),_0xb55d24,'request\x20sent',JSON[_0x49fd('0x2c')](_0x53cbd1));if(_0x53cbd1[_0x49fd('0x2d')]){if(_0x53cbd1[_0x49fd('0x2d')][_0x49fd('0x2e')]===0x1f4){logger[_0x49fd('0x2d')](_0x49fd('0x29'),_0xb55d24,_0x53cbd1['error'][_0x49fd('0x2f')]);return _0x3fd46b(_0x53cbd1[_0x49fd('0x2d')][_0x49fd('0x2f')]);}logger['error'](_0x49fd('0x29'),_0xb55d24,_0x53cbd1[_0x49fd('0x2d')][_0x49fd('0x2f')]);return _0x2dc611(_0x53cbd1['error']['message']);}else{logger['info'](_0x49fd('0x29'),_0xb55d24,_0x49fd('0x30'));_0x2dc611(_0x53cbd1[_0x49fd('0x31')][_0x49fd('0x2f')]);}})[_0x49fd('0x32')](function(_0x293d2b){logger[_0x49fd('0x2d')](_0x49fd('0x29'),_0xb55d24,_0x293d2b);_0x3fd46b(_0x293d2b);});});}function respondWithStatusCode(_0x54c8bb,_0x2b2710){_0x2b2710=_0x2b2710||0xcc;return function(_0x52b35d){if(_0x52b35d){return _0x54c8bb[_0x49fd('0x33')](_0x2b2710);}return _0x54c8bb[_0x49fd('0x34')](_0x2b2710)['end']();};}function respondWithResult(_0x203038,_0x2c8568){_0x2c8568=_0x2c8568||0xc8;return function(_0x23374c){if(_0x23374c){return _0x203038[_0x49fd('0x34')](_0x2c8568)[_0x49fd('0x35')](_0x23374c);}};}function respondWithFilteredResult(_0x12dc3d,_0x23dcc0){return function(_0x242203){if(_0x242203){var _0x4ae11b=_0x242203['count'],_0x42181b=_0x23dcc0[_0x49fd('0x36')],_0x4869fc=_0x23dcc0[_0x49fd('0x36')]+_0x23dcc0[_0x49fd('0x37')],_0x1952d0;if(_0x4869fc>=_0x4ae11b){_0x4869fc=_0x4ae11b;_0x1952d0=0xc8;}else{_0x1952d0=0xce;}_0x12dc3d['status'](_0x1952d0);return _0x12dc3d['set']('Content-Range',_0x42181b+'-'+_0x4869fc+'/'+_0x4ae11b)[_0x49fd('0x35')](_0x242203);}return null;};}function patchUpdates(_0x831002){return function(_0x4fbb33){try{jsonpatch[_0x49fd('0x38')](_0x4fbb33,_0x831002,!![]);}catch(_0x503c19){return BPromise['reject'](_0x503c19);}return _0x4fbb33[_0x49fd('0x39')]();};}function saveUpdates(_0x175f70,_0x7a5ba4){return function(_0x373f1f){if(_0x373f1f){return _0x373f1f[_0x49fd('0x3a')](_0x175f70)['then'](function(_0x5ae3b8){return _0x5ae3b8;});}return null;};}function removeEntity(_0x105ec7,_0x13d03b){return function(_0xaf7bbf){if(_0xaf7bbf){return _0xaf7bbf[_0x49fd('0x3b')]()['then'](function(){_0x105ec7[_0x49fd('0x34')](0xcc)[_0x49fd('0x3c')]();});}};}function handleEntityNotFound(_0x143769,_0x3f2898){return function(_0x4363b5){if(!_0x4363b5){_0x143769[_0x49fd('0x33')](0x194);}return _0x4363b5;};}function handleError(_0x1894d9,_0x25b9c2){_0x25b9c2=_0x25b9c2||0x1f4;return function(_0x98571b){logger[_0x49fd('0x2d')](_0x98571b[_0x49fd('0x3d')]);if(_0x98571b['name']){delete _0x98571b[_0x49fd('0x3e')];}_0x1894d9[_0x49fd('0x34')](_0x25b9c2)[_0x49fd('0x3f')](_0x98571b);};}function getInteractionUsers(_0xfea54d,_0x3f3f44){return new BPromise(function(_0x44c7d5,_0x353899){try{if(_0x3f3f44[_0xfea54d['id']]){_0xfea54d[_0x49fd('0x40')]=_[_0x49fd('0x41')](_0x3f3f44[_0xfea54d['id']],function(_0x4a1856){return{'id':_0x4a1856['id'],'fullname':_0x4a1856[_0x49fd('0x42')]};});}}catch(_0x5878a8){_0x353899(_0x5878a8);}_0x44c7d5(_0xfea54d);});}function getInteractionTags(_0x46e84c,_0x13d0db){return new BPromise(function(_0x523ddf,_0x1bdf6e){try{if(_0x46e84c[_0x49fd('0x43')]){_0x46e84c['Tags']=[];_0x46e84c[_0x49fd('0x43')]['split'](',')['forEach'](function(_0x5f56f8){_0x46e84c[_0x49fd('0x44')][_0x49fd('0x45')](_0x13d0db[_0x5f56f8]);});}delete _0x46e84c[_0x49fd('0x43')];}catch(_0x3f73d3){_0x1bdf6e(_0x3f73d3);}_0x523ddf(_0x46e84c);});}function updateChatInteraction(_0x5424ab,_0x2a9b4c,_0x2c3b7d){return new BPromise(function(_0x42c130,_0x42c537){return getInteractionUsers(_0x5424ab,_0x2c3b7d)[_0x49fd('0x27')](function(_0x28d7ea){return getInteractionTags(_0x28d7ea,_0x2a9b4c);})[_0x49fd('0x27')](function(_0x1f5c18){_0x42c130(_0x1f5c18);})['catch'](function(_0x255a73){_0x42c537(_0x255a73);});});}exports[_0x49fd('0x46')]=function(_0x4dce94,_0x3be41b){var _0x237050={},_0x4b2db7={},_0x3c205c={'count':0x0,'rows':[]};var _0x4a851d=_[_0x49fd('0x41')](db[_0x49fd('0x47')][_0x49fd('0x48')],function(_0xed169){return{'name':_0xed169['fieldName'],'type':_0xed169['type'][_0x49fd('0x49')]};});_0x4b2db7['model']=_[_0x49fd('0x41')](_0x4a851d,_0x49fd('0x3e'));_0x4b2db7[_0x49fd('0x4a')]=_[_0x49fd('0x4b')](_0x4dce94['query']);_0x4b2db7[_0x49fd('0x4c')]=_[_0x49fd('0x4d')](_0x4b2db7[_0x49fd('0x4e')],_0x4b2db7[_0x49fd('0x4a')]);_0x237050[_0x49fd('0x4f')]=_[_0x49fd('0x4d')](_0x4b2db7[_0x49fd('0x4e')],qs[_0x49fd('0x50')](_0x4dce94[_0x49fd('0x4a')][_0x49fd('0x50')]));_0x237050[_0x49fd('0x4f')]=_0x237050[_0x49fd('0x4f')][_0x49fd('0x51')]?_0x237050[_0x49fd('0x4f')]:_0x4b2db7['model'];if(!_0x4dce94['query'][_0x49fd('0x52')](_0x49fd('0x53'))){_0x237050[_0x49fd('0x37')]=qs[_0x49fd('0x37')](_0x4dce94['query'][_0x49fd('0x37')]);_0x237050[_0x49fd('0x36')]=qs['offset'](_0x4dce94[_0x49fd('0x4a')][_0x49fd('0x36')]);}_0x237050[_0x49fd('0x54')]=qs[_0x49fd('0x55')](_0x4dce94[_0x49fd('0x4a')][_0x49fd('0x55')]);_0x237050[_0x49fd('0x56')]=qs[_0x49fd('0x4c')](_[_0x49fd('0x57')](_0x4dce94[_0x49fd('0x4a')],_0x4b2db7[_0x49fd('0x4c')]));var _0x5e2532=[];var _0x39f1df=squel[_0x49fd('0x58')]()[_0x49fd('0x59')]('id')[_0x49fd('0x59')](_0x49fd('0x3e'))[_0x49fd('0x59')]('color')['from'](_0x49fd('0x5a'));var _0x765bca=squel[_0x49fd('0x58')]()['field'](_0x49fd('0x5b'))[_0x49fd('0x59')]('u.fullname')['field']('ui.ChatInteractionId')[_0x49fd('0x5c')]('user_has_chat_interactions','ui')['left_join']('users','u',_0x49fd('0x5d'));var _0x46d467=squel[_0x49fd('0x58')]()[_0x49fd('0x5c')](_0x49fd('0x5e'),'i')[_0x49fd('0x5f')](_0x49fd('0x60'),'c',_0x49fd('0x61'))[_0x49fd('0x5f')](_0x49fd('0x62'),'o','o.id\x20=\x20i.UserId')[_0x49fd('0x5f')](_0x49fd('0x63'),'a',_0x49fd('0x64'))[_0x49fd('0x5f')](_0x49fd('0x65'),'me',_0x49fd('0x66'))['left_join'](_0x49fd('0x67'),'it',_0x49fd('0x68'))['left_join']('tools_tags','t',_0x49fd('0x69'));var _0x52c0b9=squel[_0x49fd('0x6a')]();var _0x575bc5=[];var _0x24b5a3=squel['expr']();var _0x199294;if(_0x4dce94[_0x49fd('0x4a')]['search']){_0x199294=as[_0x49fd('0x6b')](_0x4dce94[_0x49fd('0x4a')][_0x49fd('0x6c')]);var _0x40f3bc=_0x199294[_0x49fd('0x6d')];for(var _0x41da82=0x0;_0x41da82<_0x199294[_0x49fd('0x6e')][_0x49fd('0x51')];_0x41da82++){var _0x50151a=_0x199294[_0x49fd('0x6e')][_0x41da82];var _0x46f351='i';var _0x3732bb=_['find'](_0x4a851d,[_0x49fd('0x3e'),_0x50151a[_0x49fd('0x59')]]);if(!_0x3732bb){switch(_0x50151a[_0x49fd('0x59')]){case _0x49fd('0x6f'):if(_0x50151a[_0x49fd('0x70')]==0x1){_0x46d467[_0x49fd('0x71')]('`'+_0x50151a[_0x49fd('0x59')]+_0x49fd('0x72'));}else{_0x46d467[_0x49fd('0x71')]('`'+_0x50151a['field']+_0x49fd('0x73'));}break;case _0x49fd('0x74'):if(_0x50151a['operator']===_0x49fd('0x75')){if(_0x50151a[_0x49fd('0x70')]['split']('\x20')['length']>0x1){_0x52c0b9[_0x40f3bc]('MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)',qs[_0x49fd('0x76')](_0x50151a[_0x49fd('0x70')]),null);}else{var _0x410bbe='%'+_0x50151a[_0x49fd('0x70')]+'%';_0x52c0b9[_0x40f3bc](_0x49fd('0x77'),_0x410bbe,_0x410bbe,_0x410bbe);}}else{_0x3732bb=_['find'](_0x4a851d,[_0x49fd('0x3e'),'ContactId']);_0x50151a[_0x49fd('0x59')]='ContactId';_0x2534d3=as[_0x49fd('0x78')](_0x46f351,_0x3732bb[_0x49fd('0x79')],_0x50151a);_0x52c0b9[_0x40f3bc](_0x2534d3[_0x49fd('0x7a')],_0x2534d3[_0x49fd('0x70')]['start'],_0x2534d3[_0x49fd('0x70')][_0x49fd('0x3c')]);}break;case'Tag':var _0x2c47e3=_0x50151a[_0x49fd('0x70')][_0x49fd('0x7b')](',')['map'](function(_0x264fe9){return Number(_0x264fe9);});_0x2c47e3[_0x49fd('0x7c')](function(_0x40b56e){_0x24b5a3['or'](_0x49fd('0x7d'),'%,'+_0x40b56e+',%');});_0x575bc5=_[_0x49fd('0x7e')](_0x575bc5,_0x2c47e3);break;case _0x49fd('0x7f'):if(_0x50151a['operator']==='$substring'){_0x52c0b9[_0x40f3bc](_0x49fd('0x80'),'%'+_0x50151a[_0x49fd('0x70')]+'%',null);}else{_0x3732bb=_[_0x49fd('0x81')](_0x4a851d,[_0x49fd('0x3e'),_0x49fd('0x82')]);_0x50151a[_0x49fd('0x59')]=_0x49fd('0x82');_0x2534d3=as[_0x49fd('0x78')](_0x46f351,_0x3732bb[_0x49fd('0x79')],_0x50151a);_0x52c0b9[_0x40f3bc](_0x2534d3[_0x49fd('0x7a')],_0x2534d3[_0x49fd('0x70')][_0x49fd('0x83')],_0x2534d3[_0x49fd('0x70')]['end']);}break;case _0x49fd('0x84'):_0x2534d3=as[_0x49fd('0x78')]('me',null,_0x50151a);_0x52c0b9[_0x40f3bc](_0x2534d3[_0x49fd('0x7a')],_0x2534d3['value']['start'],_0x2534d3[_0x49fd('0x70')][_0x49fd('0x3c')]);break;}}else{var _0x2534d3=as['buildExpression'](_0x46f351,_0x3732bb[_0x49fd('0x79')],_0x50151a);_0x52c0b9[_0x40f3bc](_0x2534d3[_0x49fd('0x7a')],_0x2534d3[_0x49fd('0x70')][_0x49fd('0x83')],_0x2534d3[_0x49fd('0x70')][_0x49fd('0x3c')]);}}}else{var _0x4169e9=_(_0x4dce94['query'])['keys']()[_0x49fd('0x41')](function(_0x53185f){return _[_0x49fd('0x85')](_0x4a851d,['name',_0x53185f])?_0x53185f:undefined;})['compact']()['value']();if(!_[_0x49fd('0x86')](_0x4169e9)){_0x4169e9[_0x49fd('0x7c')](function(_0x535b80){if(_0x535b80===_0x49fd('0x87')){_0x46d467[_0x49fd('0x56')]('i.ChatWebsiteId\x20IN\x20?',[][_0x49fd('0x88')](_0x4dce94[_0x49fd('0x4a')][_0x535b80]));}else if(_0x535b80==='createdAt'){var _0x3562f7=JSON['parse'](_0x4dce94[_0x49fd('0x4a')][_0x535b80])[_0x49fd('0x89')];var _0x52ad1c=JSON[_0x49fd('0x8a')](_0x4dce94[_0x49fd('0x4a')][_0x535b80])['$lte'];_0x46d467[_0x49fd('0x56')](_0x49fd('0x8b'),_0x3562f7,_0x52ad1c);}else{if(_0x4dce94[_0x49fd('0x4a')][_0x535b80]===_0x49fd('0x8c')){_0x46d467[_0x49fd('0x56')]('i.'+_0x535b80+_0x49fd('0x8d'));}else{_0x46d467[_0x49fd('0x56')]('i.'+_0x535b80+_0x49fd('0x8e'),_0x4dce94['query'][_0x535b80]);}}});}if(_0x4dce94['query'][_0x49fd('0x8f')]){if(_0x4dce94[_0x49fd('0x4a')]['read']==0x1){_0x46d467[_0x49fd('0x71')](_0x49fd('0x90'));}else{_0x46d467[_0x49fd('0x71')](_0x49fd('0x91'));}}if(_0x4dce94[_0x49fd('0x4a')][_0x49fd('0x92')]){_0x575bc5=_[_0x49fd('0x93')](_0x4dce94['query'][_0x49fd('0x92')])?_0x4dce94[_0x49fd('0x4a')][_0x49fd('0x92')]:new Array(_0x4dce94[_0x49fd('0x4a')][_0x49fd('0x92')]);_0x575bc5[_0x49fd('0x7c')](function(_0x344143){_0x24b5a3['or']('CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','%,'+_0x344143+',%');});}if(_0x4dce94[_0x49fd('0x4a')][_0x49fd('0x94')]){var _0x3c86dc=_0x4dce94[_0x49fd('0x4a')][_0x49fd('0x94')][_0x49fd('0x95')]('\x5c','\x5c\x5c')[_0x49fd('0x95')]('\x27\x27',_0x49fd('0x96'));if(qs[_0x49fd('0x97')](_0x3c86dc)){_0x52c0b9['or'](_0x49fd('0x98'),_0x3c86dc+'%');}else{_0x52c0b9['or'](_0x49fd('0x99'),qs[_0x49fd('0x76')](_0x3c86dc))['or'](_0x49fd('0x9a'),_0x3c86dc+'%');}}}_0x46d467[_0x49fd('0x56')](_0x52c0b9);_0x46d467[_0x49fd('0x9b')](_0x49fd('0x9c'));var _0x34fb62={'type':db[_0x49fd('0x24')][_0x49fd('0x9d')][_0x49fd('0x9e')],'raw':!![]};var _0x57aeb8=_0x46d467[_0x49fd('0x9f')]();_0x57aeb8['field'](_0x49fd('0x9c'));_0x57aeb8[_0x49fd('0x59')]('SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','unreadMessages');if(_0x237050[_0x49fd('0x54')]){_0x237050[_0x49fd('0x54')][_0x49fd('0x7c')](function(_0x57747b){_0x46d467[_0x49fd('0x54')]('i.'+_0x57747b[0x0],_0x57747b[0x1]==='DESC'?![]:!![]);});}if(!_[_0x49fd('0x86')](_0x575bc5)){_0x46d467[_0x49fd('0x71')](_0x24b5a3);_0x57aeb8['where']('t.id\x20IN\x20?',_0x575bc5);}BPromise['resolve']()[_0x49fd('0x27')](function(){if(!_0x199294){if(_0x4dce94['query'][_0x49fd('0x87')]||_0x4dce94[_0x49fd('0x4a')][_0x49fd('0xa0')])return;_0x57aeb8['where'](_0x49fd('0xa1'));_0x46d467[_0x49fd('0x56')](_0x49fd('0xa1'));return;}return _0x4dce94[_0x49fd('0xa2')]['getChatWebsites']({'attributes':['id'],'raw':!![]})[_0x49fd('0x27')](function(_0x11aee4){if(_[_0x49fd('0x86')](_0x11aee4)){_0x57aeb8['where'](_0x49fd('0xa3'));_0x46d467[_0x49fd('0x56')](_0x49fd('0xa3'));}else{_0x57aeb8[_0x49fd('0x56')]('i.ChatWebsiteId\x20IN\x20?',_[_0x49fd('0x41')](_0x11aee4,'id'));_0x46d467[_0x49fd('0x56')](_0x49fd('0xa4'),_[_0x49fd('0x41')](_0x11aee4,'id'));}});})['then'](function(){db['sequelize'][_0x49fd('0x4a')](_0x57aeb8['toString'](),_0x34fb62)[_0x49fd('0x27')](function(_0x3b2ac0){_0x3c205c[_0x49fd('0xa5')]=_0x3b2ac0[_0x49fd('0x51')];if(_0x3c205c['count']===0x0)return[];return db[_0x49fd('0xa6')][_0x49fd('0x4a')](_0x39f1df['toString'](),_0x34fb62)['then'](function(_0x20f97d){_0x5e2532=_['keyBy'](_0x20f97d,'id');_0x34fb62=_[_0x49fd('0xa7')](_0x34fb62,{'model':db[_0x49fd('0x47')],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x4dce94[_0x49fd('0x4a')]['fields']){_0x237050[_0x49fd('0x4f')]['forEach'](function(_0x56c1d2){_0x46d467['field']('i.'+_0x56c1d2);});}else{_0x46d467[_0x49fd('0x59')]('SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','unreadMessages');_0x46d467[_0x49fd('0x59')]('a.key',_0x49fd('0xa8'));_0x46d467[_0x49fd('0x59')](_0x49fd('0xa9'),'Account.mandatoryDisposition');_0x46d467[_0x49fd('0x59')]('i.*');_0x46d467[_0x49fd('0x59')]('c.firstName',_0x49fd('0xaa'));_0x46d467['field']('c.lastName','Contact.lastName');_0x46d467['field']('c.email',_0x49fd('0xab'));_0x46d467[_0x49fd('0x59')](_0x49fd('0xac'),'Contact.phone');_0x46d467[_0x49fd('0x59')](_0x49fd('0xad'),_0x49fd('0xae'));_0x46d467['field'](_0x49fd('0xaf'),'Contact.fax');_0x46d467[_0x49fd('0x59')](_0x49fd('0xb0'),_0x49fd('0xb1'));_0x46d467[_0x49fd('0x59')](_0x49fd('0xb2'),_0x49fd('0xb3'));_0x46d467[_0x49fd('0x59')](_0x49fd('0xb4'),_0x49fd('0x43'));}_0x46d467[_0x49fd('0x37')](_0x237050['limit']);_0x46d467[_0x49fd('0x36')](_0x237050[_0x49fd('0x36')]);return db['sequelize'][_0x49fd('0x4a')](_0x46d467['toString'](),_0x34fb62);})['then'](function(_0x21cef9){_0x765bca[_0x49fd('0x56')]('ui.ChatInteractionId\x20IN\x20?',_[_0x49fd('0x41')](_0x21cef9,'id'));return db[_0x49fd('0xa6')][_0x49fd('0x4a')](_0x765bca[_0x49fd('0xb5')](),_0x34fb62)[_0x49fd('0x27')](function(_0x44e05a){var _0x4d292b=_['groupBy'](_0x44e05a,'ChatInteractionId');var _0x4781cd=[];_0x21cef9['forEach'](function(_0xbde896){_0x4781cd[_0x49fd('0x45')](updateChatInteraction(_0xbde896,_0x5e2532,_0x4d292b));});return BPromise[_0x49fd('0xb6')](_0x4781cd);});});})[_0x49fd('0x27')](function(_0x5a89e0){_0x3c205c['rows']=_0x5a89e0;return _0x3c205c;})[_0x49fd('0x27')](respondWithFilteredResult(_0x3be41b,_0x237050));})[_0x49fd('0x32')](handleError(_0x3be41b,null));};exports['show']=function(_0x3b1a06,_0xcc6efb){var _0x5476e7={'raw':![],'where':{'id':_0x3b1a06[_0x49fd('0xb7')]['id']}},_0x482b68={};_0x482b68[_0x49fd('0x4e')]=_[_0x49fd('0x4b')](db[_0x49fd('0x47')][_0x49fd('0x48')]);_0x482b68[_0x49fd('0x4a')]=_[_0x49fd('0x4b')](_0x3b1a06['query']);_0x482b68[_0x49fd('0x4c')]=_['intersection'](_0x482b68[_0x49fd('0x4e')],_0x482b68[_0x49fd('0x4a')]);_0x5476e7['attributes']=_['intersection'](_0x482b68['model'],qs[_0x49fd('0x50')](_0x3b1a06['query'][_0x49fd('0x50')]));_0x5476e7[_0x49fd('0x4f')]=_0x5476e7[_0x49fd('0x4f')][_0x49fd('0x51')]?_0x5476e7[_0x49fd('0x4f')]:_0x482b68[_0x49fd('0x4e')];if(_0x3b1a06[_0x49fd('0x4a')][_0x49fd('0xb8')]){_0x5476e7[_0x49fd('0xb9')]=[{'all':!![]}];}_0x5476e7=_[_0x49fd('0xa7')]({},_0x5476e7,_0x3b1a06[_0x49fd('0xba')]);return db[_0x49fd('0x47')][_0x49fd('0x81')](_0x5476e7)[_0x49fd('0x27')](handleEntityNotFound(_0xcc6efb,null))[_0x49fd('0x27')](respondWithResult(_0xcc6efb,null))[_0x49fd('0x32')](handleError(_0xcc6efb,null));};exports['create']=function(_0x75a8e6,_0x5cb7c3){return db[_0x49fd('0x47')][_0x49fd('0xbb')](_0x75a8e6['body'],{})[_0x49fd('0x27')](respondWithResult(_0x5cb7c3,0xc9))['catch'](handleError(_0x5cb7c3,null));};exports[_0x49fd('0x3a')]=function(_0x274768,_0x584e64){if(_0x274768[_0x49fd('0x84')]['id']){delete _0x274768['body']['id'];}return db[_0x49fd('0x47')][_0x49fd('0x81')]({'where':{'id':_0x274768[_0x49fd('0xb7')]['id']}})['then'](handleEntityNotFound(_0x584e64,null))[_0x49fd('0x27')](saveUpdates(_0x274768['body'],null))[_0x49fd('0x27')](respondWithResult(_0x584e64,null))[_0x49fd('0x32')](handleError(_0x584e64,null));};exports[_0x49fd('0x3b')]=function(_0x47711c,_0x56e882){return db[_0x49fd('0x47')][_0x49fd('0x81')]({'where':{'id':_0x47711c['params']['id']}})[_0x49fd('0x27')](handleEntityNotFound(_0x56e882,null))['then'](removeEntity(_0x56e882,null))['catch'](handleError(_0x56e882,null));};exports[_0x49fd('0xbc')]=function(_0x4f61bb,_0x38c105){return db['ChatInteraction']['describe']()[_0x49fd('0x27')](respondWithResult(_0x38c105,null))[_0x49fd('0x32')](handleError(_0x38c105,null));};exports[_0x49fd('0xbd')]=function(_0x50388e,_0x12e15c){if(_0x50388e[_0x49fd('0x84')]['id']){delete _0x50388e[_0x49fd('0x84')]['id'];}return db[_0x49fd('0x47')][_0x49fd('0x81')]({'where':{'id':_0x50388e['params']['id']}})['then'](handleEntityNotFound(_0x12e15c,null))[_0x49fd('0x27')](saveUpdates(_0x50388e[_0x49fd('0x84')],null))[_0x49fd('0x27')](respondWithResult(_0x12e15c,null))[_0x49fd('0x32')](handleError(_0x12e15c,null));};exports['abandon']=function(_0x5d828c,_0x40e205,_0x2dad21){if(_0x5d828c[_0x49fd('0x84')]['id']){delete _0x5d828c[_0x49fd('0x84')]['id'];}return db[_0x49fd('0x47')][_0x49fd('0x81')]({'where':{'id':_0x5d828c[_0x49fd('0xb7')]['id']}})[_0x49fd('0x27')](function(_0x182107){if(!_0x182107){logger[_0x49fd('0x2d')](_0x49fd('0xbe'),'abandon',0x194,_0x49fd('0xbf'));_0x40e205[_0x49fd('0x33')](0x194);}else{if(_0x182107[_0x49fd('0x82')]){throw new db[(_0x49fd('0x24'))][(_0x49fd('0x25'))]('Interaction\x20already\x20assigned');}}return _0x182107;})[_0x49fd('0x27')](function(_0x23c2a9){if(_0x23c2a9){return _0x23c2a9[_0x49fd('0x3a')]({'closed':_0x5d828c[_0x49fd('0x84')][_0x49fd('0xc0')],'disposition':_0x5d828c['body'][_0x49fd('0xc1')]})[_0x49fd('0x27')](function(_0x5b52c4){return _0x5b52c4;});}})['then'](function(_0x4bea1e){return respondWithRpcPromise(_0x49fd('0xc2'),_0x49fd('0xc3'),_0x5d828c[_0x49fd('0x84')],client9004);})[_0x49fd('0x27')](respondWithResult(_0x40e205,null))[_0x49fd('0x32')](handleError(_0x40e205,null));};exports['attachmentUpload']=function(_0x15223e,_0x31a886,_0x281167){_0x15223e[_0x49fd('0x84')][_0x49fd('0x3e')]=_0x15223e[_0x49fd('0xc4')]['originalname'];_0x15223e[_0x49fd('0x84')][_0x49fd('0xc5')]=_0x15223e[_0x49fd('0xc4')]['filename'];_0x15223e['body'][_0x49fd('0x79')]=_0x15223e[_0x49fd('0xc4')][_0x49fd('0xc6')];return db[_0x49fd('0xc7')][_0x49fd('0xbb')](_0x15223e[_0x49fd('0x84')])[_0x49fd('0x27')](respondWithResult(_0x31a886,0xc9))[_0x49fd('0x32')](handleError(_0x31a886,null));};exports['attachmentDownload']=function(_0x563a9e,_0x336b0b,_0x4de8ff){return db['ChatInteraction']['findOne']({'where':{'id':_0x563a9e['params']['id']},'raw':!![]})[_0x49fd('0x27')](handleEntityNotFound(_0x336b0b,null))[_0x49fd('0x27')](function(_0x450703){if(_0x450703){if(_0x450703['closed']){return _0x336b0b[_0x49fd('0x34')](0x193)['json']({'status':0x193,'message':_0x49fd('0xc8')});}return db[_0x49fd('0xc7')]['findOne']({'where':{'id':_0x563a9e[_0x49fd('0x4a')][_0x49fd('0xc9')]},'raw':!![]})[_0x49fd('0x27')](handleEntityNotFound(_0x336b0b,null));}})[_0x49fd('0x27')](function(_0x35031b){if(_0x35031b){return _0x336b0b[_0x49fd('0xca')](path[_0x49fd('0xcb')](config[_0x49fd('0xcc')],_0x49fd('0xcd'),_0x35031b[_0x49fd('0xc5')]));}})[_0x49fd('0x32')](handleError(_0x336b0b,null));};exports[_0x49fd('0xce')]=function(_0x19e4e7,_0xbbdd63){var _0x47a169=null;var _0x96af6b=null;var _0x5dfaed=null;var _0x75b718=null;if(_0x19e4e7['body']['id']){delete _0x19e4e7[_0x49fd('0x84')]['id'];}if(_0x19e4e7[_0x49fd('0x84')][_0x49fd('0xcf')]){_0x75b718=path[_0x49fd('0xcb')](config[_0x49fd('0xcc')],_0x49fd('0xd0'),util[_0x49fd('0xd1')](_0x49fd('0xd2'),Date[_0x49fd('0xd3')]()));_0x19e4e7[_0x49fd('0x84')][_0x49fd('0xd4')]=_0x75b718;}return db['ChatInteraction']['find']({'where':{'id':_0x19e4e7['params']['id']},'include':[{'model':db[_0x49fd('0xd5')],'as':_0x49fd('0xd6'),'include':[{'model':db[_0x49fd('0x7f')],'as':_0x49fd('0x7f')}]}]})[_0x49fd('0x27')](handleEntityNotFound(_0xbbdd63,null))[_0x49fd('0x27')](saveUpdates(_0x19e4e7[_0x49fd('0x84')],null))[_0x49fd('0x27')](function(_0x27f58b){if(_0x27f58b){_0x47a169=_0x27f58b;return db['ChatWebsite'][_0x49fd('0x81')]({'where':{'id':_0x47a169[_0x49fd('0x87')]}});}})[_0x49fd('0x27')](function(_0x2464c3){if(_0x2464c3){_0x5dfaed=_0x2464c3;return db[_0x49fd('0xd7')][_0x49fd('0x81')]({'where':{'id':_0x47a169[_0x49fd('0xd8')]}});}})[_0x49fd('0x27')](function(_0x60a63){if(_0x60a63){_0x96af6b=_0x60a63;if(_0x75b718){var _0x2431b9=null;for(var _0x5e2bf2=0x1;_0x5e2bf2<_0x47a169['Messages'][_0x49fd('0x51')];++_0x5e2bf2){_0x2431b9=_0x47a169[_0x49fd('0xd6')][_0x5e2bf2];var _0x41c7aa=_0x2431b9[_0x49fd('0x82')]?util['format'](_0x49fd('0xd9'),_0x5dfaed[_0x49fd('0xda')],_0x2431b9[_0x49fd('0x82')]):'System';var _0x114fe2=_0x19e4e7[_0x49fd('0x84')][_0x49fd('0xdb')]||util[_0x49fd('0xd1')](_0x49fd('0xd9'),_0x49fd('0xdc'),_0x2431b9[_0x49fd('0xd8')]);switch(_0x5dfaed[_0x49fd('0xdd')]){case _0x49fd('0xde'):_0x41c7aa=_0x2431b9[_0x49fd('0x82')]?util['format']('%s%d',_0x5dfaed[_0x49fd('0xda')],_0x2431b9[_0x49fd('0x82')]):'System';break;case'agent_alias':_0x41c7aa=_0x2431b9[_0x49fd('0x82')]?_0x2431b9[_0x49fd('0x7f')]['alias']||_0x2431b9[_0x49fd('0x7f')]['fullname']:'System';break;case _0x49fd('0xdf'):_0x41c7aa=_0x2431b9['UserId']?_0x2431b9[_0x49fd('0x7f')][_0x49fd('0x42')]:'System';break;default:_0x41c7aa=_0x2431b9[_0x49fd('0x82')]?util[_0x49fd('0xd1')](_0x49fd('0xd9'),_0x5dfaed['agentAlias'],_0x2431b9[_0x49fd('0x82')]):_0x49fd('0xe0');}var _0x10a70e=util[_0x49fd('0xd1')](_0x49fd('0xe1'),moment(_0x2431b9[_0x49fd('0xe2')])['format'](_0x49fd('0xe3')),_0x2431b9['direction']==='in'?_0x114fe2:_0x41c7aa,_0x2431b9[_0x49fd('0x84')]);if(!_0x2431b9[_0x49fd('0xe4')]){fs['appendFileSync'](_0x75b718,_0x10a70e);}}return db[_0x49fd('0xe5')][_0x49fd('0xe6')]({'where':{'service':!![]},'include':[{'model':db['MailServerOut'],'as':_0x49fd('0xe7'),'raw':!![]}]});}}})[_0x49fd('0x27')](function(_0x5b8234){if(_0x5b8234&&_0x5b8234[_0x49fd('0xe7')]&&_0x19e4e7['body']){var _0x5acfb5={'tls':{'rejectUnauthorized':![]}};if(_0x5b8234[_0x49fd('0xe7')][_0x49fd('0xe8')]){_0x5acfb5[_0x49fd('0xe8')]=_0x5b8234['Smtp']['service'];}else{_0x5acfb5[_0x49fd('0xe9')]=_0x5b8234['Smtp'][_0x49fd('0xe9')];_0x5acfb5[_0x49fd('0xea')]=_0x5b8234[_0x49fd('0xe7')]['port'];_0x5acfb5[_0x49fd('0xeb')]=_0x5b8234['Smtp'][_0x49fd('0xeb')];}if(_0x5b8234[_0x49fd('0xe7')][_0x49fd('0xec')]){_0x5acfb5[_0x49fd('0xed')]={'user':_0x5b8234[_0x49fd('0xe7')][_0x49fd('0xa2')],'pass':_0x5b8234[_0x49fd('0xe7')][_0x49fd('0xee')]};}return respondWithRpcPromise(_0x49fd('0xef'),_0x49fd('0xf0'),{'account':_0x5acfb5,'message':{'from':util['format']('\x22%s\x22\x20<%s>',_0x5b8234[_0x49fd('0x3e')],_0x5b8234[_0x49fd('0xf1')]||_0x5b8234[_0x49fd('0xe7')][_0x49fd('0xa2')]),'to':_0x19e4e7[_0x49fd('0x84')][_0x49fd('0xcf')],'subject':_0x49fd('0xf2'),'text':util[_0x49fd('0xd1')](_0x49fd('0xf3'),_0x19e4e7[_0x49fd('0x84')][_0x49fd('0xcf')]),'attachments':[{'path':_0x75b718}]}})[_0x49fd('0x27')](function(){return _0x47a169;})[_0x49fd('0x32')](function(_0x2a1832){console[_0x49fd('0x2d')](_0x2a1832);});}else{return _0x47a169;}})['then'](respondWithStatusCode(_0xbbdd63,0xc8))['catch'](handleError(_0xbbdd63,null));};exports[_0x49fd('0xf4')]=function(_0x3a0350,_0x2a9d8d,_0x4c6ed7){return db['ChatMessage'][_0x49fd('0x81')]({'where':{'id':_0x3a0350[_0x49fd('0xb7')]['id']}})[_0x49fd('0x27')](handleEntityNotFound(_0x2a9d8d,null))[_0x49fd('0x27')](function(_0x586c1f){if(_0x586c1f){return _0x586c1f[_0x49fd('0xf4')](_0x3a0350[_0x49fd('0x84')][_0x49fd('0xf5')],_['omit'](_0x3a0350[_0x49fd('0x84')],[_0x49fd('0xf5'),'id'])||{});}})['then'](respondWithResult(_0x2a9d8d,null))[_0x49fd('0x32')](handleError(_0x2a9d8d,null));};exports[_0x49fd('0xf6')]=function(_0x53efc2,_0x169986,_0x56be0c){var _0x10c455={'raw':![],'where':{}};var _0x5f086f={};var _0x7d247f={'count':0x0,'rows':[]};return db[_0x49fd('0x47')]['findOne']({'where':{'id':_0x53efc2[_0x49fd('0xb7')]['id']}})[_0x49fd('0x27')](handleEntityNotFound(_0x169986,null))[_0x49fd('0x27')](function(_0x29aa04){if(_0x29aa04){_0x5f086f[_0x49fd('0x4e')]=_[_0x49fd('0x4b')](db[_0x49fd('0xd5')][_0x49fd('0x48')]);_0x5f086f[_0x49fd('0x4a')]=_[_0x49fd('0x4b')](_0x53efc2[_0x49fd('0x4a')]);_0x5f086f['filters']=_[_0x49fd('0x4d')](_0x5f086f[_0x49fd('0x4e')],_0x5f086f['query']);_0x10c455['attributes']=_[_0x49fd('0x4d')](_0x5f086f[_0x49fd('0x4e')],qs['fields'](_0x53efc2['query'][_0x49fd('0x50')]));_0x10c455[_0x49fd('0x4f')]=_0x10c455['attributes'][_0x49fd('0x51')]?_0x10c455[_0x49fd('0x4f')]:_0x5f086f[_0x49fd('0x4e')];if(!_0x53efc2[_0x49fd('0x4a')][_0x49fd('0x52')](_0x49fd('0x53'))){_0x10c455[_0x49fd('0x37')]=qs[_0x49fd('0x37')](_0x53efc2[_0x49fd('0x4a')][_0x49fd('0x37')]);_0x10c455[_0x49fd('0x36')]=qs[_0x49fd('0x36')](_0x53efc2['query'][_0x49fd('0x36')]);}_0x10c455[_0x49fd('0x54')]=qs[_0x49fd('0x55')](_0x53efc2[_0x49fd('0x4a')][_0x49fd('0x55')]);_0x10c455['where']=qs['filters'](_['pick'](_0x53efc2[_0x49fd('0x4a')],_0x5f086f['filters']));_0x10c455[_0x49fd('0x56')][_0x49fd('0xf7')]=_0x29aa04['id'];if(_0x53efc2[_0x49fd('0x4a')]['filter']){_0x10c455['where']=_[_0x49fd('0xa7')](_0x10c455[_0x49fd('0x56')],{'$or':_[_0x49fd('0x41')](_0x10c455[_0x49fd('0x4f')],function(_0x1d7ffd){var _0x324b26={};_0x324b26[_0x1d7ffd]={'$like':'%'+_0x53efc2[_0x49fd('0x4a')]['filter']+'%'};return _0x324b26;})});}if(_0x53efc2[_0x49fd('0x4a')][_0x49fd('0x89')]){var _0x183128=_0x53efc2[_0x49fd('0x4a')][_0x49fd('0x89')][_0x49fd('0x7b')](',');var _0x3ffc94={};_0x3ffc94[_0x183128[0x0]]={'$gte':moment(_0x183128[0x1])[_0x49fd('0xd1')]('YYYY-MM-DD\x20HH:mm:ss')};_0x10c455[_0x49fd('0x56')]=_[_0x49fd('0xa7')](_0x10c455['where'],_0x3ffc94);}_0x10c455=_[_0x49fd('0xa7')]({},_0x10c455,_0x53efc2['options']);return db[_0x49fd('0xd5')][_0x49fd('0xa5')]({'where':_0x10c455[_0x49fd('0x56')]})['then'](function(_0x13247a){_0x7d247f[_0x49fd('0xa5')]=_0x13247a;if(_0x53efc2[_0x49fd('0x4a')]['includeAll']){_0x10c455[_0x49fd('0xb9')]=[{'all':!![]}];}return db[_0x49fd('0xd5')][_0x49fd('0xf8')](_0x10c455);})['then'](function(_0x12d500){_0x7d247f[_0x49fd('0xf9')]=_0x12d500;return _0x7d247f;});}})[_0x49fd('0x27')](respondWithFilteredResult(_0x169986,_0x10c455))[_0x49fd('0x32')](handleError(_0x169986,null));};exports['getMyMessages']=function(_0x257c89,_0x33f7f0,_0x5c0170){var _0x125c67={'where':{}},_0x1eed4={},_0x5a203d={'count':0x0,'rows':[]};return db[_0x49fd('0x47')][_0x49fd('0xe6')]({'where':{'id':_0x257c89[_0x49fd('0xb7')]['id']}})['then'](handleEntityNotFound(_0x33f7f0,null))[_0x49fd('0x27')](function(_0x1f6dce){if(_0x1f6dce){_0x1eed4[_0x49fd('0x4e')]=_[_0x49fd('0x4b')](db[_0x49fd('0xd5')]['rawAttributes']);_0x1eed4['query']=_[_0x49fd('0x4b')](_0x257c89[_0x49fd('0x4a')]);_0x1eed4[_0x49fd('0x4c')]=_[_0x49fd('0x4d')](_0x1eed4[_0x49fd('0x4e')],_0x1eed4[_0x49fd('0x4a')]);_0x125c67[_0x49fd('0x4f')]=_[_0x49fd('0x4d')](_0x1eed4[_0x49fd('0x4e')],qs[_0x49fd('0x50')](_0x257c89['query'][_0x49fd('0x50')]));_0x125c67[_0x49fd('0x4f')]=_0x125c67[_0x49fd('0x4f')]['length']?_0x125c67[_0x49fd('0x4f')]:_0x1eed4[_0x49fd('0x4e')];if(!_0x257c89[_0x49fd('0x4a')]['hasOwnProperty'](_0x49fd('0x53'))){_0x125c67[_0x49fd('0x37')]=qs[_0x49fd('0x37')](_0x257c89[_0x49fd('0x4a')][_0x49fd('0x37')]);_0x125c67[_0x49fd('0x36')]=qs[_0x49fd('0x36')](_0x257c89[_0x49fd('0x4a')][_0x49fd('0x36')]);}_0x125c67[_0x49fd('0x54')]=qs[_0x49fd('0x55')](_0x257c89[_0x49fd('0x4a')][_0x49fd('0x55')]);_0x125c67['where']=qs['filters'](_[_0x49fd('0x57')](_0x257c89[_0x49fd('0x4a')],_0x1eed4[_0x49fd('0x4c')]));_0x125c67['where'][_0x49fd('0xf7')]=_0x1f6dce['id'];if(_0x257c89[_0x49fd('0x4a')][_0x49fd('0x94')]){_0x125c67[_0x49fd('0x56')]=_['merge'](_0x125c67[_0x49fd('0x56')],{'$or':_['map'](_0x125c67[_0x49fd('0x4f')],function(_0xeb773e){var _0x2bafc2={};_0x2bafc2[_0xeb773e]={'$like':'%'+_0x257c89[_0x49fd('0x4a')]['filter']+'%'};return _0x2bafc2;})});}_0x125c67[_0x49fd('0x56')][_0x49fd('0xe4')]=![];if(_0x257c89[_0x49fd('0x4a')]['id']){_0x125c67['where']['id']={'$gt':_0x257c89['query']['id']};}_0x125c67=_[_0x49fd('0xa7')]({},_0x125c67,_0x257c89[_0x49fd('0xba')]);return db[_0x49fd('0xd5')]['count']({'where':_0x125c67[_0x49fd('0x56')]})[_0x49fd('0x27')](function(_0xae300f){_0x5a203d['count']=_0xae300f;_0x125c67[_0x49fd('0xb9')]=[];if(_0x257c89[_0x49fd('0x4a')][_0x49fd('0xfa')]){_0x125c67[_0x49fd('0xb9')][_0x49fd('0x45')]({'model':db['User'],'as':_0x49fd('0x7f'),'attributes':['id',_0x49fd('0x42'),_0x49fd('0xfb')]});}if(_0x257c89[_0x49fd('0x4a')][_0x49fd('0xb8')]){_0x125c67['include']=[{'all':!![]}];}return db[_0x49fd('0xd5')][_0x49fd('0xf8')](_0x125c67);})[_0x49fd('0x27')](function(_0x307ea7){_0x5a203d['rows']=_0x307ea7;return _0x5a203d;});}})[_0x49fd('0x27')](respondWithFilteredResult(_0x33f7f0,_0x125c67))['catch'](handleError(_0x33f7f0,null));};exports['addTags']=function(_0x1ea7e3,_0xaf2bd6,_0x11cc22){return db[_0x49fd('0x47')][_0x49fd('0x81')]({'where':{'id':_0x1ea7e3[_0x49fd('0xb7')]['id']}})[_0x49fd('0x27')](handleEntityNotFound(_0xaf2bd6,null))[_0x49fd('0x27')](function(_0x5cff43){if(_0x5cff43){return _0x5cff43['setTags'](_0x1ea7e3['body'][_0x49fd('0xf5')],_[_0x49fd('0xfc')](_0x1ea7e3[_0x49fd('0x84')],[_0x49fd('0xf5'),'id'])||{})[_0x49fd('0xfd')](function(){return db[_0x49fd('0xfe')][_0x49fd('0xf8')]({'attributes':['id',_0x49fd('0x3e'),'color'],'where':{'id':_0x1ea7e3[_0x49fd('0x84')][_0x49fd('0xf5')]}});})[_0x49fd('0x27')](function(_0x492cce){socket[_0x49fd('0xff')]('chatInteractionTags:save',{'id':Number(_0x1ea7e3['params']['id']),'tags':_0x492cce||[]});return{'id':Number(_0x1ea7e3[_0x49fd('0xb7')]['id']),'tags':_0x492cce||[]};});}})[_0x49fd('0x27')](respondWithResult(_0xaf2bd6,null))[_0x49fd('0x32')](handleError(_0xaf2bd6,null));};exports[_0x49fd('0x100')]=function(_0x5e13ac,_0x275868,_0x6a83a6){return db['ChatInteraction'][_0x49fd('0x81')]({'where':{'id':_0x5e13ac[_0x49fd('0xb7')]['id']}})[_0x49fd('0x27')](handleEntityNotFound(_0x275868,null))[_0x49fd('0x27')](function(_0x385f2e){if(_0x385f2e){return _0x385f2e['removeTags'](_0x5e13ac[_0x49fd('0x4a')][_0x49fd('0xf5')]);}})['then'](respondWithStatusCode(_0x275868,null))[_0x49fd('0x32')](handleError(_0x275868,null));};exports['download']=function(_0x58bfb4,_0x5e2bbe){var _0x25c286=moment()[_0x49fd('0x101')]()['toString']();var _0x32f5bc=path['join'](config['root'],_0x49fd('0x102'),'files',_0x49fd('0x103'));var _0x285513=path['join'](config[_0x49fd('0xcc')],_0x49fd('0x102'),'files',_0x49fd('0x104'));var _0x27582c=path['join'](_0x32f5bc,_0x25c286);var _0x5f09d0=util[_0x49fd('0xd1')](_0x49fd('0x105'),_0x58bfb4[_0x49fd('0xb7')]['id'],_0x25c286);var _0x32a2fa=path['join'](_0x32f5bc,_0x5f09d0);var _0xee0ece=[];_0xee0ece[_0x49fd('0x45')]({'model':db[_0x49fd('0x7f')],'as':_0x49fd('0x7f'),'attributes':['id',_0x49fd('0x42')],'raw':!![]});_0xee0ece[_0x49fd('0x45')]({'model':db['CmContact'],'as':_0x49fd('0x74'),'attributes':['id',_0x49fd('0x106'),'lastName'],'raw':!![]});if(_0x58bfb4[_0x49fd('0x4a')][_0x49fd('0x104')]){_0xee0ece[_0x49fd('0x45')]({'model':db[_0x49fd('0xc7')],'as':_0x49fd('0xc7'),'raw':!![]});}var _0x28a760=[{'model':db[_0x49fd('0xd5')],'as':_0x49fd('0xd6'),'attributes':['id','body',_0x49fd('0xe2'),_0x49fd('0x107'),'secret',_0x49fd('0x8f')],'include':_0xee0ece}];_0x28a760[_0x49fd('0x45')]({'model':db[_0x49fd('0x108')],'as':_0x49fd('0x109'),'attributes':['id',_0x49fd('0x3e')]});_0x28a760[_0x49fd('0x45')]({'model':db['User'],'as':_0x49fd('0x10a'),'attributes':['id',_0x49fd('0x42')]});return db[_0x49fd('0x47')][_0x49fd('0x81')]({'where':{'id':_0x58bfb4[_0x49fd('0xb7')]['id']},'include':_0x28a760})[_0x49fd('0x27')](handleEntityNotFound(_0x5e2bbe,null))[_0x49fd('0x27')](function(_0x38113b){if(_0x38113b){var _0x453ded=_0x38113b['get']({'plain':!![]});fs['mkdirSync'](_0x27582c);var _0x2c495b={'format':'A4','border':_0x49fd('0x10b'),'header':{'height':'40px','contents':{'first':'\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20
Interaction\x20Transcript
\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20'}},'footer':{'height':_0x49fd('0x10c'),'contents':{'default':util[_0x49fd('0xd1')](_0x49fd('0x10d'),util[_0x49fd('0xd1')](_0x49fd('0x10e'),_0x49fd('0x10f'),_0x453ded['id']),moment()[_0x49fd('0xd1')](_0x49fd('0x110'))[_0x49fd('0xb5')]())}}};var _0x4054ca={'channel':_0x49fd('0x10f'),'account':_0x453ded[_0x49fd('0x109')]['name'],'agent':_0x453ded[_0x49fd('0x10a')]?_0x453ded[_0x49fd('0x10a')][_0x49fd('0x42')]:_0x49fd('0x111'),'createdAt':moment(_0x453ded['createdAt'])[_0x49fd('0xd1')](_0x49fd('0x112'))[_0x49fd('0xb5')](),'closedAt':_0x453ded[_0x49fd('0xc0')]?moment(_0x453ded[_0x49fd('0x113')])['format'](_0x49fd('0x112'))[_0x49fd('0xb5')]():'','disposition':_0x453ded['disposition'],'chatInfo':{'browser':_0x453ded[_0x49fd('0x114')],'os':_0x453ded[_0x49fd('0x115')],'referer':_0x453ded['referer'],'customerIp':_0x453ded['customerIp'],'customerPort':_0x453ded['customerPort']?_0x453ded[_0x49fd('0x116')]:_0x49fd('0x111')},'messages':_(_0x453ded[_0x49fd('0xd6')])[_0x49fd('0x117')]()[_0x49fd('0x94')]({'secret':![]})[_0x49fd('0x41')](function(_0x1068df){if(_0x1068df[_0x49fd('0xc7')]){var _0x518f8a=path[_0x49fd('0xcb')](_0x285513,_0x1068df[_0x49fd('0xc7')][_0x49fd('0xc5')]);if(fs[_0x49fd('0x118')](_0x518f8a)){fs[_0x49fd('0x119')](_0x518f8a)[_0x49fd('0x11a')](fs[_0x49fd('0x11b')](path['join'](_0x27582c,_0x1068df[_0x49fd('0xc7')][_0x49fd('0xc5')])));}}return{'date':moment(_0x1068df[_0x49fd('0xe2')])[_0x49fd('0xd1')](_0x49fd('0x112'))[_0x49fd('0xb5')](),'sender':_0x1068df[_0x49fd('0x107')]===_0x49fd('0x11c')?_0x1068df['User']?_0x1068df[_0x49fd('0x7f')][_0x49fd('0x42')]:_0x49fd('0xe0'):_0x1068df[_0x49fd('0x74')]['firstName']+(_0x1068df[_0x49fd('0x74')][_0x49fd('0x11d')]?'\x20'+_0x1068df['Contact'][_0x49fd('0x11d')]:''),'body':_0x1068df[_0x49fd('0xc7')]?_0x1068df[_0x49fd('0xc7')][_0x49fd('0xc5')]:_0x1068df[_0x49fd('0x84')],'direction':_0x1068df['direction']===_0x49fd('0x11c')?'A':'C','secret':_0x1068df[_0x49fd('0xe4')],'read':_0x1068df[_0x49fd('0x8f')],'attachment':_0x1068df['Attachment']};})[_0x49fd('0x70')]()};return ejs['renderFile'](path[_0x49fd('0xcb')](config[_0x49fd('0xcc')],'server',_0x49fd('0x11e'),_0x49fd('0x11f')),{'interaction':_0x4054ca})[_0x49fd('0x27')](function(_0x8eef43){return new BPromise(function(_0x18f888,_0x5e3d29){pdf[_0x49fd('0xbb')](_0x8eef43,_0x2c495b)[_0x49fd('0x120')](path['join'](_0x27582c,_0x49fd('0x121')+_0x453ded['id']+'-'+_0x25c286+'.pdf'),function(_0xdc6c8f,_0x1db7e7){if(_0xdc6c8f)return _0x5e3d29(_0xdc6c8f);_0x18f888(_0x1db7e7);});});})[_0x49fd('0x27')](function(){return new BPromise(function(_0x209504,_0x1d637b){zipdir(_0x27582c,{'saveTo':_0x32a2fa},function(_0xd108c5,_0x5d5c7d){if(_0xd108c5)return _0x1d637b(_0xd108c5);return _0x209504(_0x5d5c7d);});})[_0x49fd('0x27')](function(){return new BPromise(function(_0x1c397e,_0x1c4893){rimraf(_0x27582c,function(_0x34b1b3){if(_0x34b1b3)_0x1c4893(_0x34b1b3);return _0x1c397e();});});})[_0x49fd('0x27')](function(){return _0x5e2bbe[_0x49fd('0xca')](_0x32a2fa,_0x5f09d0,function(_0x20406e){if(_0x20406e){console[_0x49fd('0x122')](_0x49fd('0x123'),_0x20406e);}else{fs['unlinkSync'](_0x32a2fa);}});});});}else{return _0x5e2bbe['sendStatus'](0xc8);}})[_0x49fd('0x32')](handleError(_0x5e2bbe,null));}; \ No newline at end of file +var _0x2123=['basename','filename','mimetype','Attachment','attachmentDownload','findOne','Unauthorized','download','join','root','close','server/files/chat/upload/','format','transcript-%s.txt','now','pathTranscript','Messages','ChatWebsite','%s%d','agentAlias','System','customer','Visitor','agentIdentifier','agent_alias','alias','agent_fullname','[%s]\x20%s:\x20%s\x0a','direction','secret','appendFileSync','MailAccount','MailServerOut','Smtp','service','host','port','secure','authentication','auth','pass','SendMail','sendMail','\x22%s\x22\x20<%s>','email','Mail\x20Transcript','Hi\x20%s,\x20attached\x20you\x20can\x20find\x20your\x20transcript\x20file.\x20\x0a\x0aRegards.\x20\x0a\x0a','mailTranscript','addMessage','ids','omit','getMessages','nolimit','ChatInteractionId','YYYY-MM-DD\x20HH:mm:ss','merge','options','ChatMessage','includeAgent','findAll','addTags','setTags','spread','color','chatInteractionTags:save','removeTags','server','files','tmp','transcript-%d-%s.zip','firstName','lastName','attachments','Account','get','mkdirSync','10px','40px','\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20
Interaction\x20Transcript
\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','30px','\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20%s\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20{{page}}/{{pages}}\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20%s\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','Chat','YYYY-MM-DD','Owner','N.A.','closedAt','disposition','osName','referer','customerIp','customerPort','tail','existsSync','pipe','createWriteStream','out','renderFile','views','downloadInteraction.html','toFile','transcript-','err','unlinkSync','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','ejs','lodash','squel','jsforce','to-csv','querystring','papaparse','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./chatInteraction.socket','register','jayson/promise','client','http','test','Sequelize','ValidationError','The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.','request','then','info','request\x20sent','debug','stringify','error','ChatInteraction,\x20%s,\x20%s','message','result','sendStatus','status','end','json','count','offset','apply','save','update','destroy','stack','map','fullname','TagIds','Tags','split','forEach','push','catch','index','ChatInteraction','rawAttributes','fieldName','type','model','name','query','attributes','intersection','fields','hasOwnProperty','limit','order','sort','where','filters','field','from','tools_tags','u.fullname','ui.ChatInteractionId','user_has_chat_interactions','left_join','u.id\x20=\x20ui.UserId','select','chat_interactions','cm_contacts','users','o.id\x20=\x20i.UserId','me.ChatInteractionId\x20=\x20i.id','chat_interaction_has_tags','it.ChatInteractionId\x20=\x20i.id','t.id\x20=\x20it.TagId','expr','search','sqlOperator','conditions','unreadMessages','value','having','`\x20=\x200','`\x20>\x200','Contact','operator','length','getFullTextValue','find','ContactId','buildExpression','text','Tag','union','User','$substring','CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?','UserId','start','keys','ChatWebsiteId','i.ChatWebsiteId\x20IN\x20?','createdAt','parse','$gte','$lte','i.createdAt\x20BETWEEN\x20?\x20AND\x20?','null','\x20IS\x20NULL','read','tag','CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','filter','replace','\x27\x27\x27\x27','i.id\x20LIKE\x20?','MATCH\x20(me.body)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','group','QueryTypes','SELECT','clone','DESC','t.id\x20IN\x20?','resolve','i.ChatWebsiteId\x20IS\x20NOT\x20NULL','user','i.ChatWebsiteId\x20IS\x20NULL','sequelize','toString','keyBy','SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','a.key','Account.key','a.mandatoryDisposition','c.firstName','c.lastName','Contact.lastName','c.email','Contact.email','c.phone','c.mobile','c.fax','Contact.fax','o.fullname','o.internal','Owner.internal','GROUP_CONCAT(DISTINCT\x20t.id)','ui.ChatInteractionId\x20IN\x20?','groupBy','all','rows','show','params','includeAll','include','create','body','describe','entity\x20not\x20found','Interaction\x20already\x20assigned','closed','AbandonInteraction','abandon','attachmentUpload','file','originalname'];(function(_0x2be8f9,_0xf2ce04){var _0x3c2d24=function(_0x1db59a){while(--_0x1db59a){_0x2be8f9['push'](_0x2be8f9['shift']());}};_0x3c2d24(++_0xf2ce04);}(_0x2123,0x190));var _0x3212=function(_0x429059,_0x1e6c2b){_0x429059=_0x429059-0x0;var _0x3257eb=_0x2123[_0x429059];return _0x3257eb;};'use strict';var pdf=require(_0x3212('0x0'));var emlformat=require(_0x3212('0x1'));var rimraf=require(_0x3212('0x2'));var zipdir=require(_0x3212('0x3'));var jsonpatch=require(_0x3212('0x4'));var rp=require(_0x3212('0x5'));var moment=require(_0x3212('0x6'));var BPromise=require(_0x3212('0x7'));var Mustache=require(_0x3212('0x8'));var util=require(_0x3212('0x9'));var path=require(_0x3212('0xa'));var sox=require(_0x3212('0xb'));var csv=require('to-csv');var ejs=require(_0x3212('0xc'));var fs=require('fs');var _=require(_0x3212('0xd'));var squel=require(_0x3212('0xe'));var crypto=require('crypto');var jsforce=require(_0x3212('0xf'));var deskjs=require('desk.js');var toCsv=require(_0x3212('0x10'));var querystring=require(_0x3212('0x11'));var Papa=require(_0x3212('0x12'));var Redis=require(_0x3212('0x13'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x3212('0x14'));var hardwareService=require(_0x3212('0x15'));var logger=require(_0x3212('0x16'))(_0x3212('0x17'));var utils=require(_0x3212('0x18'));var config=require(_0x3212('0x19'));var db=require(_0x3212('0x1a'))['db'];config[_0x3212('0x1b')]=_[_0x3212('0x1c')](config[_0x3212('0x1b')],{'host':_0x3212('0x1d'),'port':0x18eb});var socket=require(_0x3212('0x1e'))(new Redis(config[_0x3212('0x1b')]));require(_0x3212('0x1f'))[_0x3212('0x20')](socket);var jayson=require(_0x3212('0x21'));var client=jayson[_0x3212('0x22')][_0x3212('0x23')]({'port':0x232b});var client9004=jayson[_0x3212('0x22')][_0x3212('0x23')]({'port':0x232c});function checkPasswordPattern(_0x42069c,_0x1ef2f7,_0x5b2ab8){if(_0x5b2ab8){var _0x43a642=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x43a642[_0x3212('0x24')](_0x1ef2f7)){return _0x42069c;}else{throw new db[(_0x3212('0x25'))][(_0x3212('0x26'))](_0x3212('0x27'));}}else{return _0x42069c;}}function respondWithRpcPromise(_0x34ce95,_0x21954a,_0x5b952f,_0x4c1158){return new BPromise(function(_0x1cad7b,_0x49f5c2){var _0x2380e8=_0x4c1158||client;return _0x2380e8[_0x3212('0x28')](_0x34ce95,_0x5b952f)[_0x3212('0x29')](function(_0x28a4cd){logger[_0x3212('0x2a')]('ChatInteraction,\x20%s,\x20%s',_0x21954a,_0x3212('0x2b'));logger[_0x3212('0x2c')]('ChatInteraction,\x20%s,\x20%s,\x20%s',_0x21954a,_0x3212('0x2b'),JSON[_0x3212('0x2d')](_0x28a4cd));if(_0x28a4cd[_0x3212('0x2e')]){if(_0x28a4cd['error']['code']===0x1f4){logger[_0x3212('0x2e')](_0x3212('0x2f'),_0x21954a,_0x28a4cd[_0x3212('0x2e')][_0x3212('0x30')]);return _0x49f5c2(_0x28a4cd[_0x3212('0x2e')][_0x3212('0x30')]);}logger['error']('ChatInteraction,\x20%s,\x20%s',_0x21954a,_0x28a4cd[_0x3212('0x2e')]['message']);return _0x1cad7b(_0x28a4cd[_0x3212('0x2e')][_0x3212('0x30')]);}else{logger[_0x3212('0x2a')]('ChatInteraction,\x20%s,\x20%s',_0x21954a,_0x3212('0x2b'));_0x1cad7b(_0x28a4cd[_0x3212('0x31')][_0x3212('0x30')]);}})['catch'](function(_0x206980){logger[_0x3212('0x2e')](_0x3212('0x2f'),_0x21954a,_0x206980);_0x49f5c2(_0x206980);});});}function respondWithStatusCode(_0x443a5,_0x21f003){_0x21f003=_0x21f003||0xcc;return function(_0x1638c5){if(_0x1638c5){return _0x443a5[_0x3212('0x32')](_0x21f003);}return _0x443a5[_0x3212('0x33')](_0x21f003)[_0x3212('0x34')]();};}function respondWithResult(_0x225bf0,_0x31c672){_0x31c672=_0x31c672||0xc8;return function(_0x3c0b9b){if(_0x3c0b9b){return _0x225bf0['status'](_0x31c672)[_0x3212('0x35')](_0x3c0b9b);}};}function respondWithFilteredResult(_0x265368,_0x4726fb){return function(_0x1cbab5){if(_0x1cbab5){var _0x402a01=_0x1cbab5[_0x3212('0x36')],_0x309420=_0x4726fb['offset'],_0x3a7883=_0x4726fb[_0x3212('0x37')]+_0x4726fb['limit'],_0x5059bd;if(_0x3a7883>=_0x402a01){_0x3a7883=_0x402a01;_0x5059bd=0xc8;}else{_0x5059bd=0xce;}_0x265368[_0x3212('0x33')](_0x5059bd);return _0x265368['set']('Content-Range',_0x309420+'-'+_0x3a7883+'/'+_0x402a01)[_0x3212('0x35')](_0x1cbab5);}return null;};}function patchUpdates(_0x571ae0){return function(_0x294422){try{jsonpatch[_0x3212('0x38')](_0x294422,_0x571ae0,!![]);}catch(_0x2c664b){return BPromise['reject'](_0x2c664b);}return _0x294422[_0x3212('0x39')]();};}function saveUpdates(_0x412740,_0x1f3b2c){return function(_0x487ce4){if(_0x487ce4){return _0x487ce4[_0x3212('0x3a')](_0x412740)[_0x3212('0x29')](function(_0x14681c){return _0x14681c;});}return null;};}function removeEntity(_0x2b5d04,_0xc690c4){return function(_0x5d5a47){if(_0x5d5a47){return _0x5d5a47[_0x3212('0x3b')]()[_0x3212('0x29')](function(){_0x2b5d04[_0x3212('0x33')](0xcc)['end']();});}};}function handleEntityNotFound(_0x42f481,_0x410961){return function(_0x40a602){if(!_0x40a602){_0x42f481[_0x3212('0x32')](0x194);}return _0x40a602;};}function handleError(_0x4e0d38,_0x421948){_0x421948=_0x421948||0x1f4;return function(_0x3f157c){logger[_0x3212('0x2e')](_0x3f157c[_0x3212('0x3c')]);if(_0x3f157c['name']){delete _0x3f157c['name'];}_0x4e0d38['status'](_0x421948)['send'](_0x3f157c);};}function getInteractionUsers(_0xb2908a,_0x436a80){return new BPromise(function(_0x3f8018,_0x87587d){try{if(_0x436a80[_0xb2908a['id']]){_0xb2908a['Users']=_[_0x3212('0x3d')](_0x436a80[_0xb2908a['id']],function(_0x3f2505){return{'id':_0x3f2505['id'],'fullname':_0x3f2505[_0x3212('0x3e')]};});}}catch(_0x2e8605){_0x87587d(_0x2e8605);}_0x3f8018(_0xb2908a);});}function getInteractionTags(_0x5914bf,_0x4fad05){return new BPromise(function(_0x101f4f,_0x17f515){try{if(_0x5914bf[_0x3212('0x3f')]){_0x5914bf[_0x3212('0x40')]=[];_0x5914bf[_0x3212('0x3f')][_0x3212('0x41')](',')[_0x3212('0x42')](function(_0x52860f){_0x5914bf[_0x3212('0x40')][_0x3212('0x43')](_0x4fad05[_0x52860f]);});}delete _0x5914bf[_0x3212('0x3f')];}catch(_0x25eaaa){_0x17f515(_0x25eaaa);}_0x101f4f(_0x5914bf);});}function updateChatInteraction(_0x483cf9,_0x28bc3c,_0xe9851f){return new BPromise(function(_0x1c71f7,_0x262564){return getInteractionUsers(_0x483cf9,_0xe9851f)['then'](function(_0xb365f7){return getInteractionTags(_0xb365f7,_0x28bc3c);})['then'](function(_0x46ff57){_0x1c71f7(_0x46ff57);})[_0x3212('0x44')](function(_0xc35af6){_0x262564(_0xc35af6);});});}exports[_0x3212('0x45')]=function(_0x9a24e3,_0x216469){var _0x14626d={},_0xa2df06={},_0x5ce6cb={'count':0x0,'rows':[]};var _0xc482e2=_[_0x3212('0x3d')](db[_0x3212('0x46')][_0x3212('0x47')],function(_0x3d4714){return{'name':_0x3d4714[_0x3212('0x48')],'type':_0x3d4714[_0x3212('0x49')]['key']};});_0xa2df06[_0x3212('0x4a')]=_[_0x3212('0x3d')](_0xc482e2,_0x3212('0x4b'));_0xa2df06[_0x3212('0x4c')]=_['keys'](_0x9a24e3['query']);_0xa2df06['filters']=_['intersection'](_0xa2df06[_0x3212('0x4a')],_0xa2df06['query']);_0x14626d[_0x3212('0x4d')]=_[_0x3212('0x4e')](_0xa2df06[_0x3212('0x4a')],qs[_0x3212('0x4f')](_0x9a24e3['query'][_0x3212('0x4f')]));_0x14626d[_0x3212('0x4d')]=_0x14626d[_0x3212('0x4d')]['length']?_0x14626d[_0x3212('0x4d')]:_0xa2df06[_0x3212('0x4a')];if(!_0x9a24e3[_0x3212('0x4c')][_0x3212('0x50')]('nolimit')){_0x14626d[_0x3212('0x51')]=qs[_0x3212('0x51')](_0x9a24e3['query'][_0x3212('0x51')]);_0x14626d[_0x3212('0x37')]=qs[_0x3212('0x37')](_0x9a24e3['query']['offset']);}_0x14626d[_0x3212('0x52')]=qs[_0x3212('0x53')](_0x9a24e3[_0x3212('0x4c')]['sort']);_0x14626d[_0x3212('0x54')]=qs[_0x3212('0x55')](_['pick'](_0x9a24e3[_0x3212('0x4c')],_0xa2df06[_0x3212('0x55')]));var _0x182722=[];var _0x5941ea=squel['select']()[_0x3212('0x56')]('id')[_0x3212('0x56')](_0x3212('0x4b'))[_0x3212('0x56')]('color')[_0x3212('0x57')](_0x3212('0x58'));var _0x3ab8c0=squel['select']()[_0x3212('0x56')]('u.id')[_0x3212('0x56')](_0x3212('0x59'))[_0x3212('0x56')](_0x3212('0x5a'))['from'](_0x3212('0x5b'),'ui')[_0x3212('0x5c')]('users','u',_0x3212('0x5d'));var _0x3dc91b=squel[_0x3212('0x5e')]()[_0x3212('0x57')](_0x3212('0x5f'),'i')[_0x3212('0x5c')](_0x3212('0x60'),'c','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL')[_0x3212('0x5c')](_0x3212('0x61'),'o',_0x3212('0x62'))[_0x3212('0x5c')]('chat_websites','a','a.id\x20=\x20i.ChatWebsiteId')['left_join']('chat_messages','me',_0x3212('0x63'))['left_join'](_0x3212('0x64'),'it',_0x3212('0x65'))[_0x3212('0x5c')](_0x3212('0x58'),'t',_0x3212('0x66'));var _0x33120d=squel[_0x3212('0x67')]();var _0x125527=[];var _0xc1893=squel[_0x3212('0x67')]();var _0x527177;if(_0x9a24e3['query']['search']){_0x527177=as['parseSearch'](_0x9a24e3[_0x3212('0x4c')][_0x3212('0x68')]);var _0x6afe4f=_0x527177[_0x3212('0x69')];for(var _0x3f1e7c=0x0;_0x3f1e7c<_0x527177[_0x3212('0x6a')]['length'];_0x3f1e7c++){var _0x487033=_0x527177[_0x3212('0x6a')][_0x3f1e7c];var _0x276544='i';var _0x598b96=_['find'](_0xc482e2,[_0x3212('0x4b'),_0x487033[_0x3212('0x56')]]);if(!_0x598b96){switch(_0x487033['field']){case _0x3212('0x6b'):if(_0x487033[_0x3212('0x6c')]==0x1){_0x3dc91b[_0x3212('0x6d')]('`'+_0x487033[_0x3212('0x56')]+_0x3212('0x6e'));}else{_0x3dc91b['having']('`'+_0x487033[_0x3212('0x56')]+_0x3212('0x6f'));}break;case _0x3212('0x70'):if(_0x487033[_0x3212('0x71')]==='$substring'){if(_0x487033[_0x3212('0x6c')][_0x3212('0x41')]('\x20')[_0x3212('0x72')]>0x1){_0x33120d[_0x6afe4f]('MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)',qs[_0x3212('0x73')](_0x487033[_0x3212('0x6c')]),null);}else{var _0x81298d='%'+_0x487033[_0x3212('0x6c')]+'%';_0x33120d[_0x6afe4f]('c.firstName\x20LIKE\x20?\x20OR\x20c.lastName\x20LIKE\x20?\x20OR\x20c.email\x20LIKE\x20?',_0x81298d,_0x81298d,_0x81298d);}}else{_0x598b96=_[_0x3212('0x74')](_0xc482e2,[_0x3212('0x4b'),_0x3212('0x75')]);_0x487033[_0x3212('0x56')]='ContactId';_0x1e548e=as[_0x3212('0x76')](_0x276544,_0x598b96[_0x3212('0x49')],_0x487033);_0x33120d[_0x6afe4f](_0x1e548e[_0x3212('0x77')],_0x1e548e[_0x3212('0x6c')]['start'],_0x1e548e[_0x3212('0x6c')][_0x3212('0x34')]);}break;case _0x3212('0x78'):var _0x3fa0ff=_0x487033[_0x3212('0x6c')][_0x3212('0x41')](',')[_0x3212('0x3d')](function(_0xf49c54){return Number(_0xf49c54);});_0x3fa0ff[_0x3212('0x42')](function(_0x4af52d){_0xc1893['or']('CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','%,'+_0x4af52d+',%');});_0x125527=_[_0x3212('0x79')](_0x125527,_0x3fa0ff);break;case _0x3212('0x7a'):if(_0x487033['operator']===_0x3212('0x7b')){_0x33120d[_0x6afe4f](_0x3212('0x7c'),'%'+_0x487033[_0x3212('0x6c')]+'%',null);}else{_0x598b96=_[_0x3212('0x74')](_0xc482e2,['name',_0x3212('0x7d')]);_0x487033[_0x3212('0x56')]=_0x3212('0x7d');_0x1e548e=as[_0x3212('0x76')](_0x276544,_0x598b96[_0x3212('0x49')],_0x487033);_0x33120d[_0x6afe4f](_0x1e548e[_0x3212('0x77')],_0x1e548e['value'][_0x3212('0x7e')],_0x1e548e[_0x3212('0x6c')]['end']);}break;case'body':_0x1e548e=as[_0x3212('0x76')]('me',null,_0x487033);_0x33120d[_0x6afe4f](_0x1e548e[_0x3212('0x77')],_0x1e548e[_0x3212('0x6c')][_0x3212('0x7e')],_0x1e548e[_0x3212('0x6c')]['end']);break;}}else{var _0x1e548e=as[_0x3212('0x76')](_0x276544,_0x598b96['type'],_0x487033);_0x33120d[_0x6afe4f](_0x1e548e[_0x3212('0x77')],_0x1e548e[_0x3212('0x6c')]['start'],_0x1e548e[_0x3212('0x6c')][_0x3212('0x34')]);}}}else{var _0x1653b0=_(_0x9a24e3['query'])[_0x3212('0x7f')]()['map'](function(_0x593d31){return _['some'](_0xc482e2,[_0x3212('0x4b'),_0x593d31])?_0x593d31:undefined;})['compact']()[_0x3212('0x6c')]();if(!_['isEmpty'](_0x1653b0)){_0x1653b0[_0x3212('0x42')](function(_0x203f75){if(_0x203f75===_0x3212('0x80')){_0x3dc91b[_0x3212('0x54')](_0x3212('0x81'),[]['concat'](_0x9a24e3[_0x3212('0x4c')][_0x203f75]));}else if(_0x203f75===_0x3212('0x82')){var _0x1e87d9=JSON[_0x3212('0x83')](_0x9a24e3[_0x3212('0x4c')][_0x203f75])[_0x3212('0x84')];var _0x5c6a97=JSON[_0x3212('0x83')](_0x9a24e3[_0x3212('0x4c')][_0x203f75])[_0x3212('0x85')];_0x3dc91b[_0x3212('0x54')](_0x3212('0x86'),_0x1e87d9,_0x5c6a97);}else{if(_0x9a24e3[_0x3212('0x4c')][_0x203f75]===_0x3212('0x87')){_0x3dc91b[_0x3212('0x54')]('i.'+_0x203f75+_0x3212('0x88'));}else{_0x3dc91b[_0x3212('0x54')]('i.'+_0x203f75+'\x20=\x20?',_0x9a24e3['query'][_0x203f75]);}}});}if(_0x9a24e3[_0x3212('0x4c')][_0x3212('0x89')]){if(_0x9a24e3['query'][_0x3212('0x89')]==0x1){_0x3dc91b['having']('`unreadMessages`\x20=\x200');}else{_0x3dc91b['having']('`unreadMessages`\x20>\x200');}}if(_0x9a24e3['query']['tag']){_0x125527=_['isArray'](_0x9a24e3[_0x3212('0x4c')]['tag'])?_0x9a24e3[_0x3212('0x4c')][_0x3212('0x8a')]:new Array(_0x9a24e3[_0x3212('0x4c')][_0x3212('0x8a')]);_0x125527[_0x3212('0x42')](function(_0x24da2e){_0xc1893['or'](_0x3212('0x8b'),'%,'+_0x24da2e+',%');});}if(_0x9a24e3[_0x3212('0x4c')][_0x3212('0x8c')]){var _0x5a95ff=_0x9a24e3[_0x3212('0x4c')][_0x3212('0x8c')][_0x3212('0x8d')]('\x5c','\x5c\x5c')['replace']('\x27\x27',_0x3212('0x8e'));if(qs['isNumeric'](_0x5a95ff)){_0x33120d['or'](_0x3212('0x8f'),_0x5a95ff+'%');}else{_0x33120d['or'](_0x3212('0x90'),qs['getFullTextValue'](_0x5a95ff))['or']('CONCAT(c.firstName,\x20\x27\x20\x27,\x20c.lastName)\x20LIKE\x20?',_0x5a95ff+'%');}}}_0x3dc91b['where'](_0x33120d);_0x3dc91b[_0x3212('0x91')]('i.id');var _0x48bdf9={'type':db[_0x3212('0x25')][_0x3212('0x92')][_0x3212('0x93')],'raw':!![]};var _0xef13c0=_0x3dc91b[_0x3212('0x94')]();_0xef13c0[_0x3212('0x56')]('i.id');_0xef13c0['field']('SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','unreadMessages');if(_0x14626d[_0x3212('0x52')]){_0x14626d[_0x3212('0x52')]['forEach'](function(_0x511231){_0x3dc91b['order']('i.'+_0x511231[0x0],_0x511231[0x1]===_0x3212('0x95')?![]:!![]);});}if(!_['isEmpty'](_0x125527)){_0x3dc91b[_0x3212('0x6d')](_0xc1893);_0xef13c0[_0x3212('0x54')](_0x3212('0x96'),_0x125527);}BPromise[_0x3212('0x97')]()[_0x3212('0x29')](function(){if(!_0x527177){if(_0x9a24e3[_0x3212('0x4c')][_0x3212('0x80')]||_0x9a24e3[_0x3212('0x4c')]['journey'])return;_0xef13c0[_0x3212('0x54')](_0x3212('0x98'));_0x3dc91b[_0x3212('0x54')](_0x3212('0x98'));return;}return _0x9a24e3[_0x3212('0x99')]['getChatWebsites']({'attributes':['id'],'raw':!![]})[_0x3212('0x29')](function(_0x2c7e62){if(_['isEmpty'](_0x2c7e62)){_0xef13c0[_0x3212('0x54')](_0x3212('0x9a'));_0x3dc91b[_0x3212('0x54')](_0x3212('0x9a'));}else{_0xef13c0[_0x3212('0x54')](_0x3212('0x81'),_[_0x3212('0x3d')](_0x2c7e62,'id'));_0x3dc91b['where'](_0x3212('0x81'),_[_0x3212('0x3d')](_0x2c7e62,'id'));}});})[_0x3212('0x29')](function(){db[_0x3212('0x9b')][_0x3212('0x4c')](_0xef13c0[_0x3212('0x9c')](),_0x48bdf9)[_0x3212('0x29')](function(_0x22c08b){_0x5ce6cb[_0x3212('0x36')]=_0x22c08b[_0x3212('0x72')];if(_0x5ce6cb['count']===0x0)return[];return db[_0x3212('0x9b')][_0x3212('0x4c')](_0x5941ea['toString'](),_0x48bdf9)['then'](function(_0x5279c2){_0x182722=_[_0x3212('0x9d')](_0x5279c2,'id');_0x48bdf9=_['merge'](_0x48bdf9,{'model':db[_0x3212('0x46')],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x9a24e3['query']['fields']){_0x14626d[_0x3212('0x4d')]['forEach'](function(_0x2bc942){_0x3dc91b[_0x3212('0x56')]('i.'+_0x2bc942);});}else{_0x3dc91b[_0x3212('0x56')](_0x3212('0x9e'),'unreadMessages');_0x3dc91b[_0x3212('0x56')](_0x3212('0x9f'),_0x3212('0xa0'));_0x3dc91b['field'](_0x3212('0xa1'),'Account.mandatoryDisposition');_0x3dc91b[_0x3212('0x56')]('i.*');_0x3dc91b[_0x3212('0x56')](_0x3212('0xa2'),'Contact.firstName');_0x3dc91b[_0x3212('0x56')](_0x3212('0xa3'),_0x3212('0xa4'));_0x3dc91b[_0x3212('0x56')](_0x3212('0xa5'),_0x3212('0xa6'));_0x3dc91b[_0x3212('0x56')](_0x3212('0xa7'),'Contact.phone');_0x3dc91b[_0x3212('0x56')](_0x3212('0xa8'),'Contact.mobile');_0x3dc91b[_0x3212('0x56')](_0x3212('0xa9'),_0x3212('0xaa'));_0x3dc91b[_0x3212('0x56')](_0x3212('0xab'),'Owner.fullname');_0x3dc91b[_0x3212('0x56')](_0x3212('0xac'),_0x3212('0xad'));_0x3dc91b[_0x3212('0x56')](_0x3212('0xae'),'TagIds');}_0x3dc91b['limit'](_0x14626d[_0x3212('0x51')]);_0x3dc91b['offset'](_0x14626d[_0x3212('0x37')]);return db['sequelize']['query'](_0x3dc91b[_0x3212('0x9c')](),_0x48bdf9);})['then'](function(_0x177b85){_0x3ab8c0['where'](_0x3212('0xaf'),_[_0x3212('0x3d')](_0x177b85,'id'));return db[_0x3212('0x9b')][_0x3212('0x4c')](_0x3ab8c0[_0x3212('0x9c')](),_0x48bdf9)[_0x3212('0x29')](function(_0x27a1b0){var _0x39ca3e=_[_0x3212('0xb0')](_0x27a1b0,'ChatInteractionId');var _0x75b83d=[];_0x177b85[_0x3212('0x42')](function(_0xddbcc1){_0x75b83d['push'](updateChatInteraction(_0xddbcc1,_0x182722,_0x39ca3e));});return BPromise[_0x3212('0xb1')](_0x75b83d);});});})[_0x3212('0x29')](function(_0x34932e){_0x5ce6cb[_0x3212('0xb2')]=_0x34932e;return _0x5ce6cb;})[_0x3212('0x29')](respondWithFilteredResult(_0x216469,_0x14626d));})[_0x3212('0x44')](handleError(_0x216469,null));};exports[_0x3212('0xb3')]=function(_0x27b8e7,_0x566af2){var _0x43e887={'raw':![],'where':{'id':_0x27b8e7[_0x3212('0xb4')]['id']}},_0x2423d6={};_0x2423d6[_0x3212('0x4a')]=_[_0x3212('0x7f')](db[_0x3212('0x46')][_0x3212('0x47')]);_0x2423d6[_0x3212('0x4c')]=_[_0x3212('0x7f')](_0x27b8e7[_0x3212('0x4c')]);_0x2423d6[_0x3212('0x55')]=_[_0x3212('0x4e')](_0x2423d6[_0x3212('0x4a')],_0x2423d6['query']);_0x43e887[_0x3212('0x4d')]=_[_0x3212('0x4e')](_0x2423d6[_0x3212('0x4a')],qs[_0x3212('0x4f')](_0x27b8e7[_0x3212('0x4c')][_0x3212('0x4f')]));_0x43e887[_0x3212('0x4d')]=_0x43e887[_0x3212('0x4d')]['length']?_0x43e887[_0x3212('0x4d')]:_0x2423d6['model'];if(_0x27b8e7[_0x3212('0x4c')][_0x3212('0xb5')]){_0x43e887[_0x3212('0xb6')]=[{'all':!![]}];}_0x43e887=_['merge']({},_0x43e887,_0x27b8e7['options']);return db['ChatInteraction'][_0x3212('0x74')](_0x43e887)[_0x3212('0x29')](handleEntityNotFound(_0x566af2,null))['then'](respondWithResult(_0x566af2,null))[_0x3212('0x44')](handleError(_0x566af2,null));};exports[_0x3212('0xb7')]=function(_0x29f3eb,_0x2f7135){return db[_0x3212('0x46')][_0x3212('0xb7')](_0x29f3eb[_0x3212('0xb8')],{})[_0x3212('0x29')](respondWithResult(_0x2f7135,0xc9))['catch'](handleError(_0x2f7135,null));};exports[_0x3212('0x3a')]=function(_0x2ec167,_0x255fbc){if(_0x2ec167[_0x3212('0xb8')]['id']){delete _0x2ec167[_0x3212('0xb8')]['id'];}return db['ChatInteraction'][_0x3212('0x74')]({'where':{'id':_0x2ec167[_0x3212('0xb4')]['id']}})[_0x3212('0x29')](handleEntityNotFound(_0x255fbc,null))[_0x3212('0x29')](saveUpdates(_0x2ec167[_0x3212('0xb8')],null))['then'](respondWithResult(_0x255fbc,null))[_0x3212('0x44')](handleError(_0x255fbc,null));};exports['destroy']=function(_0x4be8f0,_0x5671c3){return db['ChatInteraction'][_0x3212('0x74')]({'where':{'id':_0x4be8f0[_0x3212('0xb4')]['id']}})[_0x3212('0x29')](handleEntityNotFound(_0x5671c3,null))[_0x3212('0x29')](removeEntity(_0x5671c3,null))[_0x3212('0x44')](handleError(_0x5671c3,null));};exports[_0x3212('0xb9')]=function(_0x161ca1,_0x1f486a){return db['ChatInteraction']['describe']()[_0x3212('0x29')](respondWithResult(_0x1f486a,null))[_0x3212('0x44')](handleError(_0x1f486a,null));};exports['customUpdate']=function(_0x1abc9d,_0x45787f){if(_0x1abc9d['body']['id']){delete _0x1abc9d[_0x3212('0xb8')]['id'];}return db['ChatInteraction']['find']({'where':{'id':_0x1abc9d[_0x3212('0xb4')]['id']}})[_0x3212('0x29')](handleEntityNotFound(_0x45787f,null))[_0x3212('0x29')](saveUpdates(_0x1abc9d[_0x3212('0xb8')],null))[_0x3212('0x29')](respondWithResult(_0x45787f,null))[_0x3212('0x44')](handleError(_0x45787f,null));};exports['abandon']=function(_0x38f7bb,_0x398957,_0x5cf987){if(_0x38f7bb[_0x3212('0xb8')]['id']){delete _0x38f7bb[_0x3212('0xb8')]['id'];}return db[_0x3212('0x46')]['find']({'where':{'id':_0x38f7bb[_0x3212('0xb4')]['id']}})['then'](function(_0x14ff48){if(!_0x14ff48){logger['error']('abandonInteraction,\x20%s,\x20%s,\x20%s','abandon',0x194,_0x3212('0xba'));_0x398957[_0x3212('0x32')](0x194);}else{if(_0x14ff48['UserId']){throw new db[(_0x3212('0x25'))][(_0x3212('0x26'))](_0x3212('0xbb'));}}return _0x14ff48;})[_0x3212('0x29')](function(_0x10c74f){if(_0x10c74f){return _0x10c74f[_0x3212('0x3a')]({'closed':_0x38f7bb[_0x3212('0xb8')][_0x3212('0xbc')],'disposition':_0x38f7bb[_0x3212('0xb8')]['disposition']})[_0x3212('0x29')](function(_0x2c9540){return _0x2c9540;});}})[_0x3212('0x29')](function(_0x41991f){return respondWithRpcPromise(_0x3212('0xbd'),_0x3212('0xbe'),_0x38f7bb[_0x3212('0xb8')],client9004);})[_0x3212('0x29')](respondWithResult(_0x398957,null))[_0x3212('0x44')](handleError(_0x398957,null));};exports[_0x3212('0xbf')]=function(_0x1f3352,_0x107bce,_0x2e43b8){_0x1f3352['body']['name']=_0x1f3352[_0x3212('0xc0')][_0x3212('0xc1')];_0x1f3352['body'][_0x3212('0xc2')]=_0x1f3352['file'][_0x3212('0xc3')];_0x1f3352[_0x3212('0xb8')]['type']=_0x1f3352[_0x3212('0xc0')][_0x3212('0xc4')];return db[_0x3212('0xc5')][_0x3212('0xb7')](_0x1f3352[_0x3212('0xb8')])['then'](respondWithResult(_0x107bce,0xc9))[_0x3212('0x44')](handleError(_0x107bce,null));};exports[_0x3212('0xc6')]=function(_0x3f690c,_0x32b7d8,_0x5f5ceb){return db[_0x3212('0x46')][_0x3212('0xc7')]({'where':{'id':_0x3f690c[_0x3212('0xb4')]['id']},'raw':!![]})[_0x3212('0x29')](handleEntityNotFound(_0x32b7d8,null))['then'](function(_0x1bea6d){if(_0x1bea6d){if(_0x1bea6d['closed']){return _0x32b7d8[_0x3212('0x33')](0x193)[_0x3212('0x35')]({'status':0x193,'message':_0x3212('0xc8')});}return db['Attachment'][_0x3212('0xc7')]({'where':{'id':_0x3f690c['query']['attachId']},'raw':!![]})['then'](handleEntityNotFound(_0x32b7d8,null));}})[_0x3212('0x29')](function(_0x211434){if(_0x211434){return _0x32b7d8[_0x3212('0xc9')](path[_0x3212('0xca')](config[_0x3212('0xcb')],'server/files/attachments/',_0x211434[_0x3212('0xc2')]));}})[_0x3212('0x44')](handleError(_0x32b7d8,null));};exports[_0x3212('0xcc')]=function(_0x533a0b,_0x34187a){var _0x350830=null;var _0xfabca5=null;var _0x4a9ae2=null;var _0x379ff0=null;if(_0x533a0b[_0x3212('0xb8')]['id']){delete _0x533a0b[_0x3212('0xb8')]['id'];}if(_0x533a0b[_0x3212('0xb8')]['mailTranscript']){_0x379ff0=path[_0x3212('0xca')](config[_0x3212('0xcb')],_0x3212('0xcd'),util[_0x3212('0xce')](_0x3212('0xcf'),Date[_0x3212('0xd0')]()));_0x533a0b[_0x3212('0xb8')][_0x3212('0xd1')]=_0x379ff0;}return db[_0x3212('0x46')][_0x3212('0x74')]({'where':{'id':_0x533a0b[_0x3212('0xb4')]['id']},'include':[{'model':db['ChatMessage'],'as':_0x3212('0xd2'),'include':[{'model':db[_0x3212('0x7a')],'as':_0x3212('0x7a')}]}]})['then'](handleEntityNotFound(_0x34187a,null))[_0x3212('0x29')](saveUpdates(_0x533a0b['body'],null))[_0x3212('0x29')](function(_0x2b6a93){if(_0x2b6a93){_0x350830=_0x2b6a93;return db[_0x3212('0xd3')][_0x3212('0x74')]({'where':{'id':_0x350830['ChatWebsiteId']}});}})['then'](function(_0x310aad){if(_0x310aad){_0x4a9ae2=_0x310aad;return db['CmContact']['find']({'where':{'id':_0x350830[_0x3212('0x75')]}});}})[_0x3212('0x29')](function(_0x33bfc9){if(_0x33bfc9){_0xfabca5=_0x33bfc9;if(_0x379ff0){var _0x56b818=null;for(var _0x39edf9=0x1;_0x39edf9<_0x350830[_0x3212('0xd2')][_0x3212('0x72')];++_0x39edf9){_0x56b818=_0x350830['Messages'][_0x39edf9];var _0x3c9d94=_0x56b818[_0x3212('0x7d')]?util['format'](_0x3212('0xd4'),_0x4a9ae2[_0x3212('0xd5')],_0x56b818[_0x3212('0x7d')]):_0x3212('0xd6');var _0x3d3b5c=_0x533a0b[_0x3212('0xb8')][_0x3212('0xd7')]||util[_0x3212('0xce')]('%s%d',_0x3212('0xd8'),_0x56b818[_0x3212('0x75')]);switch(_0x4a9ae2[_0x3212('0xd9')]){case'website_alias':_0x3c9d94=_0x56b818['UserId']?util['format'](_0x3212('0xd4'),_0x4a9ae2[_0x3212('0xd5')],_0x56b818[_0x3212('0x7d')]):'System';break;case _0x3212('0xda'):_0x3c9d94=_0x56b818[_0x3212('0x7d')]?_0x56b818[_0x3212('0x7a')][_0x3212('0xdb')]||_0x56b818[_0x3212('0x7a')][_0x3212('0x3e')]:_0x3212('0xd6');break;case _0x3212('0xdc'):_0x3c9d94=_0x56b818[_0x3212('0x7d')]?_0x56b818[_0x3212('0x7a')][_0x3212('0x3e')]:_0x3212('0xd6');break;default:_0x3c9d94=_0x56b818[_0x3212('0x7d')]?util[_0x3212('0xce')](_0x3212('0xd4'),_0x4a9ae2['agentAlias'],_0x56b818[_0x3212('0x7d')]):_0x3212('0xd6');}var _0x276440=util['format'](_0x3212('0xdd'),moment(_0x56b818['createdAt'])[_0x3212('0xce')]('MM/DD/YYYY\x20HH:mm:ss'),_0x56b818[_0x3212('0xde')]==='in'?_0x3d3b5c:_0x3c9d94,_0x56b818[_0x3212('0xb8')]);if(!_0x56b818[_0x3212('0xdf')]){fs[_0x3212('0xe0')](_0x379ff0,_0x276440);}}return db[_0x3212('0xe1')][_0x3212('0xc7')]({'where':{'service':!![]},'include':[{'model':db[_0x3212('0xe2')],'as':_0x3212('0xe3'),'raw':!![]}]});}}})['then'](function(_0x12321b){if(_0x12321b&&_0x12321b[_0x3212('0xe3')]&&_0x533a0b['body']){var _0x43ef03={'tls':{'rejectUnauthorized':![]}};if(_0x12321b['Smtp'][_0x3212('0xe4')]){_0x43ef03['service']=_0x12321b[_0x3212('0xe3')][_0x3212('0xe4')];}else{_0x43ef03[_0x3212('0xe5')]=_0x12321b[_0x3212('0xe3')][_0x3212('0xe5')];_0x43ef03[_0x3212('0xe6')]=_0x12321b['Smtp'][_0x3212('0xe6')];_0x43ef03[_0x3212('0xe7')]=_0x12321b[_0x3212('0xe3')]['secure'];}if(_0x12321b[_0x3212('0xe3')][_0x3212('0xe8')]){_0x43ef03[_0x3212('0xe9')]={'user':_0x12321b[_0x3212('0xe3')][_0x3212('0x99')],'pass':_0x12321b[_0x3212('0xe3')][_0x3212('0xea')]};}return respondWithRpcPromise(_0x3212('0xeb'),_0x3212('0xec'),{'account':_0x43ef03,'message':{'from':util[_0x3212('0xce')](_0x3212('0xed'),_0x12321b[_0x3212('0x4b')],_0x12321b[_0x3212('0xee')]||_0x12321b['Smtp']['user']),'to':_0x533a0b[_0x3212('0xb8')]['mailTranscript'],'subject':_0x3212('0xef'),'text':util['format'](_0x3212('0xf0'),_0x533a0b[_0x3212('0xb8')][_0x3212('0xf1')]),'attachments':[{'path':_0x379ff0}]}})[_0x3212('0x29')](function(){return _0x350830;})[_0x3212('0x44')](function(_0x52e156){console[_0x3212('0x2e')](_0x52e156);});}else{return _0x350830;}})['then'](respondWithStatusCode(_0x34187a,0xc8))[_0x3212('0x44')](handleError(_0x34187a,null));};exports[_0x3212('0xf2')]=function(_0xfa25b5,_0x5aef06,_0x5c2b91){return db['ChatMessage'][_0x3212('0x74')]({'where':{'id':_0xfa25b5['params']['id']}})['then'](handleEntityNotFound(_0x5aef06,null))[_0x3212('0x29')](function(_0x169178){if(_0x169178){return _0x169178[_0x3212('0xf2')](_0xfa25b5[_0x3212('0xb8')][_0x3212('0xf3')],_[_0x3212('0xf4')](_0xfa25b5[_0x3212('0xb8')],[_0x3212('0xf3'),'id'])||{});}})[_0x3212('0x29')](respondWithResult(_0x5aef06,null))['catch'](handleError(_0x5aef06,null));};exports[_0x3212('0xf5')]=function(_0x4fbc6b,_0xaa37b5,_0x3564cc){var _0x12856e={'raw':![],'where':{}};var _0x3160a6={};var _0xb59a96={'count':0x0,'rows':[]};return db[_0x3212('0x46')][_0x3212('0xc7')]({'where':{'id':_0x4fbc6b['params']['id']}})[_0x3212('0x29')](handleEntityNotFound(_0xaa37b5,null))[_0x3212('0x29')](function(_0x150aa9){if(_0x150aa9){_0x3160a6[_0x3212('0x4a')]=_[_0x3212('0x7f')](db['ChatMessage'][_0x3212('0x47')]);_0x3160a6['query']=_['keys'](_0x4fbc6b['query']);_0x3160a6[_0x3212('0x55')]=_['intersection'](_0x3160a6['model'],_0x3160a6[_0x3212('0x4c')]);_0x12856e['attributes']=_[_0x3212('0x4e')](_0x3160a6[_0x3212('0x4a')],qs['fields'](_0x4fbc6b[_0x3212('0x4c')][_0x3212('0x4f')]));_0x12856e[_0x3212('0x4d')]=_0x12856e[_0x3212('0x4d')][_0x3212('0x72')]?_0x12856e[_0x3212('0x4d')]:_0x3160a6['model'];if(!_0x4fbc6b['query']['hasOwnProperty'](_0x3212('0xf6'))){_0x12856e[_0x3212('0x51')]=qs[_0x3212('0x51')](_0x4fbc6b[_0x3212('0x4c')][_0x3212('0x51')]);_0x12856e['offset']=qs[_0x3212('0x37')](_0x4fbc6b[_0x3212('0x4c')][_0x3212('0x37')]);}_0x12856e[_0x3212('0x52')]=qs[_0x3212('0x53')](_0x4fbc6b[_0x3212('0x4c')]['sort']);_0x12856e[_0x3212('0x54')]=qs[_0x3212('0x55')](_['pick'](_0x4fbc6b[_0x3212('0x4c')],_0x3160a6[_0x3212('0x55')]));_0x12856e[_0x3212('0x54')][_0x3212('0xf7')]=_0x150aa9['id'];if(_0x4fbc6b[_0x3212('0x4c')][_0x3212('0x8c')]){_0x12856e['where']=_['merge'](_0x12856e[_0x3212('0x54')],{'$or':_[_0x3212('0x3d')](_0x12856e[_0x3212('0x4d')],function(_0x704ab6){var _0x40fa2a={};_0x40fa2a[_0x704ab6]={'$like':'%'+_0x4fbc6b[_0x3212('0x4c')][_0x3212('0x8c')]+'%'};return _0x40fa2a;})});}if(_0x4fbc6b[_0x3212('0x4c')][_0x3212('0x84')]){var _0x164772=_0x4fbc6b[_0x3212('0x4c')][_0x3212('0x84')]['split'](',');var _0x476e1a={};_0x476e1a[_0x164772[0x0]]={'$gte':moment(_0x164772[0x1])[_0x3212('0xce')](_0x3212('0xf8'))};_0x12856e['where']=_[_0x3212('0xf9')](_0x12856e[_0x3212('0x54')],_0x476e1a);}_0x12856e=_[_0x3212('0xf9')]({},_0x12856e,_0x4fbc6b[_0x3212('0xfa')]);return db[_0x3212('0xfb')][_0x3212('0x36')]({'where':_0x12856e[_0x3212('0x54')]})[_0x3212('0x29')](function(_0x4157e7){_0xb59a96[_0x3212('0x36')]=_0x4157e7;if(_0x4fbc6b[_0x3212('0x4c')][_0x3212('0xb5')]){_0x12856e[_0x3212('0xb6')]=[{'all':!![]}];}return db[_0x3212('0xfb')]['findAll'](_0x12856e);})[_0x3212('0x29')](function(_0x128e75){_0xb59a96[_0x3212('0xb2')]=_0x128e75;return _0xb59a96;});}})[_0x3212('0x29')](respondWithFilteredResult(_0xaa37b5,_0x12856e))['catch'](handleError(_0xaa37b5,null));};exports['getMyMessages']=function(_0x27d138,_0x1fe6b9,_0x20fc52){var _0x28fb6b={'where':{}},_0x29cd7b={},_0x45ea33={'count':0x0,'rows':[]};return db[_0x3212('0x46')]['findOne']({'where':{'id':_0x27d138[_0x3212('0xb4')]['id']}})[_0x3212('0x29')](handleEntityNotFound(_0x1fe6b9,null))[_0x3212('0x29')](function(_0x448010){if(_0x448010){_0x29cd7b[_0x3212('0x4a')]=_[_0x3212('0x7f')](db['ChatMessage'][_0x3212('0x47')]);_0x29cd7b[_0x3212('0x4c')]=_[_0x3212('0x7f')](_0x27d138[_0x3212('0x4c')]);_0x29cd7b[_0x3212('0x55')]=_[_0x3212('0x4e')](_0x29cd7b[_0x3212('0x4a')],_0x29cd7b[_0x3212('0x4c')]);_0x28fb6b[_0x3212('0x4d')]=_[_0x3212('0x4e')](_0x29cd7b[_0x3212('0x4a')],qs[_0x3212('0x4f')](_0x27d138[_0x3212('0x4c')][_0x3212('0x4f')]));_0x28fb6b['attributes']=_0x28fb6b[_0x3212('0x4d')][_0x3212('0x72')]?_0x28fb6b[_0x3212('0x4d')]:_0x29cd7b[_0x3212('0x4a')];if(!_0x27d138[_0x3212('0x4c')][_0x3212('0x50')]('nolimit')){_0x28fb6b[_0x3212('0x51')]=qs[_0x3212('0x51')](_0x27d138[_0x3212('0x4c')][_0x3212('0x51')]);_0x28fb6b[_0x3212('0x37')]=qs['offset'](_0x27d138[_0x3212('0x4c')][_0x3212('0x37')]);}_0x28fb6b[_0x3212('0x52')]=qs['sort'](_0x27d138[_0x3212('0x4c')][_0x3212('0x53')]);_0x28fb6b[_0x3212('0x54')]=qs[_0x3212('0x55')](_['pick'](_0x27d138[_0x3212('0x4c')],_0x29cd7b['filters']));_0x28fb6b[_0x3212('0x54')][_0x3212('0xf7')]=_0x448010['id'];if(_0x27d138[_0x3212('0x4c')][_0x3212('0x8c')]){_0x28fb6b[_0x3212('0x54')]=_[_0x3212('0xf9')](_0x28fb6b['where'],{'$or':_[_0x3212('0x3d')](_0x28fb6b[_0x3212('0x4d')],function(_0x306266){var _0x48bb01={};_0x48bb01[_0x306266]={'$like':'%'+_0x27d138[_0x3212('0x4c')][_0x3212('0x8c')]+'%'};return _0x48bb01;})});}_0x28fb6b[_0x3212('0x54')][_0x3212('0xdf')]=![];if(_0x27d138[_0x3212('0x4c')]['id']){_0x28fb6b['where']['id']={'$gt':_0x27d138[_0x3212('0x4c')]['id']};}_0x28fb6b=_[_0x3212('0xf9')]({},_0x28fb6b,_0x27d138[_0x3212('0xfa')]);return db[_0x3212('0xfb')]['count']({'where':_0x28fb6b[_0x3212('0x54')]})['then'](function(_0x2f6709){_0x45ea33['count']=_0x2f6709;_0x28fb6b[_0x3212('0xb6')]=[];if(_0x27d138[_0x3212('0x4c')][_0x3212('0xfc')]){_0x28fb6b['include']['push']({'model':db[_0x3212('0x7a')],'as':_0x3212('0x7a'),'attributes':['id',_0x3212('0x3e'),_0x3212('0xdb')]});}if(_0x27d138['query'][_0x3212('0xb5')]){_0x28fb6b[_0x3212('0xb6')]=[{'all':!![]}];}return db[_0x3212('0xfb')][_0x3212('0xfd')](_0x28fb6b);})[_0x3212('0x29')](function(_0x35155e){_0x45ea33[_0x3212('0xb2')]=_0x35155e;return _0x45ea33;});}})[_0x3212('0x29')](respondWithFilteredResult(_0x1fe6b9,_0x28fb6b))['catch'](handleError(_0x1fe6b9,null));};exports[_0x3212('0xfe')]=function(_0x23e6d4,_0x5b806f,_0x331329){return db[_0x3212('0x46')][_0x3212('0x74')]({'where':{'id':_0x23e6d4[_0x3212('0xb4')]['id']}})[_0x3212('0x29')](handleEntityNotFound(_0x5b806f,null))[_0x3212('0x29')](function(_0x59f94f){if(_0x59f94f){return _0x59f94f[_0x3212('0xff')](_0x23e6d4['body'][_0x3212('0xf3')],_[_0x3212('0xf4')](_0x23e6d4[_0x3212('0xb8')],['ids','id'])||{})[_0x3212('0x100')](function(){return db[_0x3212('0x78')][_0x3212('0xfd')]({'attributes':['id',_0x3212('0x4b'),_0x3212('0x101')],'where':{'id':_0x23e6d4[_0x3212('0xb8')][_0x3212('0xf3')]}});})[_0x3212('0x29')](function(_0x45dc03){socket['emit'](_0x3212('0x102'),{'id':Number(_0x23e6d4[_0x3212('0xb4')]['id']),'tags':_0x45dc03||[]});return{'id':Number(_0x23e6d4[_0x3212('0xb4')]['id']),'tags':_0x45dc03||[]};});}})[_0x3212('0x29')](respondWithResult(_0x5b806f,null))[_0x3212('0x44')](handleError(_0x5b806f,null));};exports['removeTags']=function(_0x4849a6,_0x21a7b7,_0x5f3f57){return db[_0x3212('0x46')]['find']({'where':{'id':_0x4849a6[_0x3212('0xb4')]['id']}})[_0x3212('0x29')](handleEntityNotFound(_0x21a7b7,null))[_0x3212('0x29')](function(_0x55d022){if(_0x55d022){return _0x55d022[_0x3212('0x103')](_0x4849a6[_0x3212('0x4c')]['ids']);}})['then'](respondWithStatusCode(_0x21a7b7,null))[_0x3212('0x44')](handleError(_0x21a7b7,null));};exports[_0x3212('0xc9')]=function(_0x23775c,_0x4be6fd){var _0x27dd57=moment()['unix']()[_0x3212('0x9c')]();var _0x47b4ec=path['join'](config[_0x3212('0xcb')],_0x3212('0x104'),_0x3212('0x105'),_0x3212('0x106'));var _0x3cff96=path[_0x3212('0xca')](config['root'],_0x3212('0x104'),_0x3212('0x105'),'attachments');var _0xb51e51=path[_0x3212('0xca')](_0x47b4ec,_0x27dd57);var _0x3ac618=util[_0x3212('0xce')](_0x3212('0x107'),_0x23775c[_0x3212('0xb4')]['id'],_0x27dd57);var _0x387cf1=path[_0x3212('0xca')](_0x47b4ec,_0x3ac618);var _0x57b8b6=[];_0x57b8b6[_0x3212('0x43')]({'model':db['User'],'as':'User','attributes':['id',_0x3212('0x3e')],'raw':!![]});_0x57b8b6[_0x3212('0x43')]({'model':db['CmContact'],'as':'Contact','attributes':['id',_0x3212('0x108'),_0x3212('0x109')],'raw':!![]});if(_0x23775c['query'][_0x3212('0x10a')]){_0x57b8b6[_0x3212('0x43')]({'model':db[_0x3212('0xc5')],'as':_0x3212('0xc5'),'raw':!![]});}var _0x5aed81=[{'model':db[_0x3212('0xfb')],'as':_0x3212('0xd2'),'attributes':['id','body','createdAt',_0x3212('0xde'),_0x3212('0xdf'),_0x3212('0x89')],'include':_0x57b8b6}];_0x5aed81[_0x3212('0x43')]({'model':db[_0x3212('0xd3')],'as':_0x3212('0x10b'),'attributes':['id','name']});_0x5aed81['push']({'model':db[_0x3212('0x7a')],'as':'Owner','attributes':['id','fullname']});return db['ChatInteraction']['find']({'where':{'id':_0x23775c[_0x3212('0xb4')]['id']},'include':_0x5aed81})[_0x3212('0x29')](handleEntityNotFound(_0x4be6fd,null))[_0x3212('0x29')](function(_0x171014){if(_0x171014){var _0x5f537c=_0x171014[_0x3212('0x10c')]({'plain':!![]});fs[_0x3212('0x10d')](_0xb51e51);var _0x1d566c={'format':'A4','border':_0x3212('0x10e'),'header':{'height':_0x3212('0x10f'),'contents':{'first':_0x3212('0x110')}},'footer':{'height':_0x3212('0x111'),'contents':{'default':util[_0x3212('0xce')](_0x3212('0x112'),util['format']('%s\x20#%d',_0x3212('0x113'),_0x5f537c['id']),moment()[_0x3212('0xce')](_0x3212('0x114'))[_0x3212('0x9c')]())}}};var _0x282bcf={'channel':_0x3212('0x113'),'account':_0x5f537c[_0x3212('0x10b')]['name'],'agent':_0x5f537c[_0x3212('0x115')]?_0x5f537c[_0x3212('0x115')]['fullname']:_0x3212('0x116'),'createdAt':moment(_0x5f537c[_0x3212('0x82')])[_0x3212('0xce')](_0x3212('0xf8'))['toString'](),'closedAt':_0x5f537c[_0x3212('0xbc')]?moment(_0x5f537c[_0x3212('0x117')])[_0x3212('0xce')]('YYYY-MM-DD\x20HH:mm:ss')[_0x3212('0x9c')]():'','disposition':_0x5f537c[_0x3212('0x118')],'chatInfo':{'browser':_0x5f537c['browserName'],'os':_0x5f537c[_0x3212('0x119')],'referer':_0x5f537c[_0x3212('0x11a')],'customerIp':_0x5f537c[_0x3212('0x11b')],'customerPort':_0x5f537c['customerPort']?_0x5f537c[_0x3212('0x11c')]:_0x3212('0x116')},'messages':_(_0x5f537c[_0x3212('0xd2')])[_0x3212('0x11d')]()['filter']({'secret':![]})[_0x3212('0x3d')](function(_0x38468b){if(_0x38468b['Attachment']){var _0x506d6a=path[_0x3212('0xca')](_0x3cff96,_0x38468b[_0x3212('0xc5')][_0x3212('0xc2')]);if(fs[_0x3212('0x11e')](_0x506d6a)){fs['createReadStream'](_0x506d6a)[_0x3212('0x11f')](fs[_0x3212('0x120')](path[_0x3212('0xca')](_0xb51e51,_0x38468b['Attachment'][_0x3212('0xc2')])));}}return{'date':moment(_0x38468b[_0x3212('0x82')])[_0x3212('0xce')](_0x3212('0xf8'))[_0x3212('0x9c')](),'sender':_0x38468b[_0x3212('0xde')]===_0x3212('0x121')?_0x38468b['User']?_0x38468b[_0x3212('0x7a')][_0x3212('0x3e')]:_0x3212('0xd6'):_0x38468b[_0x3212('0x70')]['firstName']+(_0x38468b['Contact'][_0x3212('0x109')]?'\x20'+_0x38468b[_0x3212('0x70')]['lastName']:''),'body':_0x38468b['Attachment']?_0x38468b[_0x3212('0xc5')][_0x3212('0xc2')]:_0x38468b[_0x3212('0xb8')],'direction':_0x38468b['direction']===_0x3212('0x121')?'A':'C','secret':_0x38468b[_0x3212('0xdf')],'read':_0x38468b['read'],'attachment':_0x38468b[_0x3212('0xc5')]};})[_0x3212('0x6c')]()};return ejs[_0x3212('0x122')](path[_0x3212('0xca')](config[_0x3212('0xcb')],_0x3212('0x104'),_0x3212('0x123'),_0x3212('0x124')),{'interaction':_0x282bcf})['then'](function(_0x4cb8e3){return new BPromise(function(_0x41e394,_0x58fe32){pdf['create'](_0x4cb8e3,_0x1d566c)[_0x3212('0x125')](path[_0x3212('0xca')](_0xb51e51,_0x3212('0x126')+_0x5f537c['id']+'-'+_0x27dd57+'.pdf'),function(_0x234330,_0x184923){if(_0x234330)return _0x58fe32(_0x234330);_0x41e394(_0x184923);});});})['then'](function(){return new BPromise(function(_0x111344,_0x2069b1){zipdir(_0xb51e51,{'saveTo':_0x387cf1},function(_0xbbfa,_0x5cba55){if(_0xbbfa)return _0x2069b1(_0xbbfa);return _0x111344(_0x5cba55);});})[_0x3212('0x29')](function(){return new BPromise(function(_0x585f9a,_0x3b7308){rimraf(_0xb51e51,function(_0x241a71){if(_0x241a71)_0x3b7308(_0x241a71);return _0x585f9a();});});})[_0x3212('0x29')](function(){return _0x4be6fd[_0x3212('0xc9')](_0x387cf1,_0x3ac618,function(_0xea5eca){if(_0xea5eca){console['log'](_0x3212('0x127'),_0xea5eca);}else{fs[_0x3212('0x128')](_0x387cf1);}});});});}else{return _0x4be6fd[_0x3212('0x32')](0xc8);}})[_0x3212('0x44')](handleError(_0x4be6fd,null));}; \ No newline at end of file diff --git a/server/api/chatInteraction/chatInteraction.events.js b/server/api/chatInteraction/chatInteraction.events.js index afe4a19..e50be85 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 _0xf69f=['ChatMessage','setMaxListeners','save','update','getUsers','setDataValue','map','findAll','then','length','emit','hasOwnProperty','hook','../../mysqldb','ChatInteraction'];(function(_0x12e4fc,_0xf01a75){var _0x197c91=function(_0x3922bb){while(--_0x3922bb){_0x12e4fc['push'](_0x12e4fc['shift']());}};_0x197c91(++_0xf01a75);}(_0xf69f,0x85));var _0xff69=function(_0x129dca,_0x5b7cd7){_0x129dca=_0x129dca-0x0;var _0x5837fe=_0xf69f[_0x129dca];return _0x5837fe;};'use strict';var EventEmitter=require('events');var ChatInteraction=require(_0xff69('0x0'))['db'][_0xff69('0x1')];var ChatMessage=require(_0xff69('0x0'))['db'][_0xff69('0x2')];var ChatInteractionEvents=new EventEmitter();ChatInteractionEvents[_0xff69('0x3')](0x0);var events={'afterCreate':_0xff69('0x4'),'afterUpdate':_0xff69('0x5'),'afterDestroy':'remove'};function emitEvent(_0x465a77){return function(_0x444ab3,_0x1d05a8,_0x5b1174){_0x444ab3[_0xff69('0x6')]({'attributes':['id'],'raw':!![]})['then'](function(_0x300ae1){_0x444ab3[_0xff69('0x7')]('Users',_0x300ae1[_0xff69('0x8')](function(_0x4e6176){return{'id':_0x4e6176['id']};}));return ChatMessage[_0xff69('0x9')]({'where':{'ChatInteractionId':_0x444ab3['id'],'direction':'in','read':![]},'raw':!![]});})[_0xff69('0xa')](function(_0x1c3e76){_0x444ab3['setDataValue']('unreadMessages',_0x1c3e76[_0xff69('0xb')]);ChatInteractionEvents[_0xff69('0xc')](_0x465a77+':'+_0x444ab3['id'],_0x444ab3);ChatInteractionEvents[_0xff69('0xc')](_0x465a77,_0x444ab3);_0x5b1174(null);})['catch'](_0x5b1174(null));};}for(var e in events){if(events[_0xff69('0xd')](e)){var event=events[e];ChatInteraction[_0xff69('0xe')](e,emitEvent(event));}}module['exports']=ChatInteractionEvents; \ No newline at end of file +var _0xffad=['ChatMessage','getUsers','setDataValue','Users','map','findAll','then','unreadMessages','emit','catch','hasOwnProperty','hook','exports','events','../../mysqldb'];(function(_0x3cd0db,_0x2d960f){var _0x474d01=function(_0x3661b1){while(--_0x3661b1){_0x3cd0db['push'](_0x3cd0db['shift']());}};_0x474d01(++_0x2d960f);}(_0xffad,0x175));var _0xdffa=function(_0x2344c3,_0x4cebad){_0x2344c3=_0x2344c3-0x0;var _0x355393=_0xffad[_0x2344c3];return _0x355393;};'use strict';var EventEmitter=require(_0xdffa('0x0'));var ChatInteraction=require(_0xdffa('0x1'))['db']['ChatInteraction'];var ChatMessage=require(_0xdffa('0x1'))['db'][_0xdffa('0x2')];var ChatInteractionEvents=new EventEmitter();ChatInteractionEvents['setMaxListeners'](0x0);var events={'afterCreate':'save','afterUpdate':'update','afterDestroy':'remove'};function emitEvent(_0x1989ae){return function(_0x444ed2,_0x4e9183,_0x45c61e){_0x444ed2[_0xdffa('0x3')]({'attributes':['id'],'raw':!![]})['then'](function(_0x2bb7cc){_0x444ed2[_0xdffa('0x4')](_0xdffa('0x5'),_0x2bb7cc[_0xdffa('0x6')](function(_0x38fae8){return{'id':_0x38fae8['id']};}));return ChatMessage[_0xdffa('0x7')]({'where':{'ChatInteractionId':_0x444ed2['id'],'direction':'in','read':![]},'raw':!![]});})[_0xdffa('0x8')](function(_0x385a60){_0x444ed2[_0xdffa('0x4')](_0xdffa('0x9'),_0x385a60['length']);ChatInteractionEvents['emit'](_0x1989ae+':'+_0x444ed2['id'],_0x444ed2);ChatInteractionEvents[_0xdffa('0xa')](_0x1989ae,_0x444ed2);_0x45c61e(null);})[_0xdffa('0xb')](_0x45c61e(null));};}for(var e in events){if(events[_0xdffa('0xc')](e)){var event=events[e];ChatInteraction[_0xdffa('0xd')](e,emitEvent(event));}}module[_0xdffa('0xe')]=ChatInteractionEvents; \ No newline at end of file diff --git a/server/api/chatInteraction/chatInteraction.model.js b/server/api/chatInteraction/chatInteraction.model.js index e3cc137..ae060cc 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 _0x4b17=['closed','closedAt','format','YYYY-MM-DD\x20HH:mm:ss','utf8mb4_unicode_ci','../../config/logger','api','moment','request-promise','path','rimraf','../../config/environment','./chatInteraction.attributes','exports','define','chat_interactions'];(function(_0x525b5b,_0x2b86a6){var _0xc285ad=function(_0x3682fa){while(--_0x3682fa){_0x525b5b['push'](_0x525b5b['shift']());}};_0xc285ad(++_0x2b86a6);}(_0x4b17,0x155));var _0x74b1=function(_0x2353fe,_0x4b0bca){_0x2353fe=_0x2353fe-0x0;var _0x4d43f6=_0x4b17[_0x2353fe];return _0x4d43f6;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x74b1('0x0'))(_0x74b1('0x1'));var moment=require(_0x74b1('0x2'));var BPromise=require('bluebird');var rp=require(_0x74b1('0x3'));var fs=require('fs');var path=require(_0x74b1('0x4'));var rimraf=require(_0x74b1('0x5'));var config=require(_0x74b1('0x6'));var attributes=require(_0x74b1('0x7'));module[_0x74b1('0x8')]=function(_0x828872,_0x5e38c9){return _0x828872[_0x74b1('0x9')]('ChatInteraction',attributes,{'tableName':_0x74b1('0xa'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x377aff,_0x2bed1d,_0x56dd7e){if(_0x377aff['changed'](_0x74b1('0xb'))){_0x377aff[_0x74b1('0xc')]=moment()[_0x74b1('0xd')](_0x74b1('0xe'));}_0x56dd7e(null,_0x377aff);}},'charset':'utf8mb4','collate':_0x74b1('0xf')});}; \ No newline at end of file +var _0x8b61=['chat_interactions','closed','format','YYYY-MM-DD\x20HH:mm:ss','utf8mb4','util','api','moment','request-promise','path','../../config/environment','./chatInteraction.attributes','exports','ChatInteraction'];(function(_0x5b41bb,_0x358504){var _0x491bf8=function(_0x2216ed){while(--_0x2216ed){_0x5b41bb['push'](_0x5b41bb['shift']());}};_0x491bf8(++_0x358504);}(_0x8b61,0x139));var _0x18b6=function(_0x37f2f4,_0x31230d){_0x37f2f4=_0x37f2f4-0x0;var _0x57cd0c=_0x8b61[_0x37f2f4];return _0x57cd0c;};'use strict';var _=require('lodash');var util=require(_0x18b6('0x0'));var logger=require('../../config/logger')(_0x18b6('0x1'));var moment=require(_0x18b6('0x2'));var BPromise=require('bluebird');var rp=require(_0x18b6('0x3'));var fs=require('fs');var path=require(_0x18b6('0x4'));var rimraf=require('rimraf');var config=require(_0x18b6('0x5'));var attributes=require(_0x18b6('0x6'));module[_0x18b6('0x7')]=function(_0x2fda4c,_0x22f61e){return _0x2fda4c['define'](_0x18b6('0x8'),attributes,{'tableName':_0x18b6('0x9'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x1a48a0,_0x399c2c,_0x326b0f){if(_0x1a48a0['changed'](_0x18b6('0xa'))){_0x1a48a0['closedAt']=moment()[_0x18b6('0xb')](_0x18b6('0xc'));}_0x326b0f(null,_0x1a48a0);}},'charset':_0x18b6('0xd'),'collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file diff --git a/server/api/chatInteraction/chatInteraction.rpc.js b/server/api/chatInteraction/chatInteraction.rpc.js index 7f7284a..39c9a79 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 _0x34ed=['redis','defaults','localhost','register','then','info','ChatInteraction,\x20%s,\x20%s','debug','ChatInteraction,\x20%s,\x20%s,\x20%s','stringify','error','message','request\x20sent','result','update','body','options','raw','where','attributes','limit','UpdateChatInteraction','catch','AddTagsToChatInteraction','ChatInteraction','addTags','ids','omit','spread','AddTags','lodash','util','moment','bluebird','randomstring','../../mysqldb','jayson/promise','client'];(function(_0x1b186c,_0x2ccd3b){var _0x7aeb88=function(_0x4b6986){while(--_0x4b6986){_0x1b186c['push'](_0x1b186c['shift']());}};_0x7aeb88(++_0x2ccd3b);}(_0x34ed,0x6a));var _0xd34e=function(_0x38a6c6,_0x4062ca){_0x38a6c6=_0x38a6c6-0x0;var _0x142f0a=_0x34ed[_0x38a6c6];return _0x142f0a;};'use strict';var _=require(_0xd34e('0x0'));var util=require(_0xd34e('0x1'));var moment=require(_0xd34e('0x2'));var BPromise=require(_0xd34e('0x3'));var rs=require(_0xd34e('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xd34e('0x5'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')('rpc');var config=require('../../config/environment');var jayson=require(_0xd34e('0x6'));var client=jayson[_0xd34e('0x7')]['http']({'port':0x232a});config[_0xd34e('0x8')]=_[_0xd34e('0x9')](config[_0xd34e('0x8')],{'host':_0xd34e('0xa'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xd34e('0x8')]));require('./chatInteraction.socket')[_0xd34e('0xb')](socket);function respondWithRpcPromise(_0x1e1075,_0x309559,_0x533179){return new BPromise(function(_0x57b757,_0x165a08){return client['request'](_0x1e1075,_0x533179)[_0xd34e('0xc')](function(_0x146d52){logger[_0xd34e('0xd')](_0xd34e('0xe'),_0x309559,'request\x20sent');logger[_0xd34e('0xf')](_0xd34e('0x10'),_0x309559,'request\x20sent',JSON[_0xd34e('0x11')](_0x146d52));if(_0x146d52[_0xd34e('0x12')]){if(_0x146d52[_0xd34e('0x12')]['code']===0x1f4){logger[_0xd34e('0x12')](_0xd34e('0xe'),_0x309559,_0x146d52[_0xd34e('0x12')][_0xd34e('0x13')]);return _0x165a08(_0x146d52[_0xd34e('0x12')][_0xd34e('0x13')]);}logger[_0xd34e('0x12')](_0xd34e('0xe'),_0x309559,_0x146d52[_0xd34e('0x12')][_0xd34e('0x13')]);return _0x57b757(_0x146d52['error'][_0xd34e('0x13')]);}else{logger[_0xd34e('0xd')](_0xd34e('0xe'),_0x309559,_0xd34e('0x14'));_0x57b757(_0x146d52[_0xd34e('0x15')][_0xd34e('0x13')]);}})['catch'](function(_0xba3b65){logger[_0xd34e('0x12')]('ChatInteraction,\x20%s,\x20%s',_0x309559,_0xba3b65);_0x165a08(_0xba3b65);});});}exports['UpdateChatInteraction']=function(_0x1c1ad1){var _0x45812d=this;return new Promise(function(_0x2da81c,_0xad1f36){return db['ChatInteraction'][_0xd34e('0x16')](_0x1c1ad1[_0xd34e('0x17')],{'raw':_0x1c1ad1['options']?_0x1c1ad1[_0xd34e('0x18')][_0xd34e('0x19')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x1c1ad1[_0xd34e('0x18')]?_0x1c1ad1[_0xd34e('0x18')][_0xd34e('0x1a')]||null:null,'attributes':_0x1c1ad1[_0xd34e('0x18')]?_0x1c1ad1[_0xd34e('0x18')][_0xd34e('0x1b')]||null:null,'limit':_0x1c1ad1[_0xd34e('0x18')]?_0x1c1ad1[_0xd34e('0x18')][_0xd34e('0x1c')]||null:null})[_0xd34e('0xc')](function(_0x33fab7){logger[_0xd34e('0xd')](_0xd34e('0x1d'),_0x1c1ad1);logger[_0xd34e('0xf')](_0xd34e('0x1d'),_0x1c1ad1,JSON[_0xd34e('0x11')](_0x33fab7));_0x2da81c(_0x33fab7);})[_0xd34e('0x1e')](function(_0x4a98c4){logger[_0xd34e('0x12')](_0xd34e('0x1d'),_0x4a98c4[_0xd34e('0x13')],_0x1c1ad1);_0xad1f36(_0x45812d[_0xd34e('0x12')](0x1f4,_0x4a98c4[_0xd34e('0x13')]));});});};exports[_0xd34e('0x1f')]=function(_0x31590c){return new Promise(function(_0x11491c,_0x5b8459){return db[_0xd34e('0x20')]['find']({'where':_0x31590c[_0xd34e('0x18')]?_0x31590c[_0xd34e('0x18')][_0xd34e('0x1a')]||null:null})['then'](function(_0x160712){if(_0x160712){return _0x160712[_0xd34e('0x21')](_0x31590c['body'][_0xd34e('0x22')],_[_0xd34e('0x23')](_0x31590c['body'],['ids','id'])||{});}})[_0xd34e('0x24')](function(_0x5dad7e){logger['info']('AddTags',_0x31590c);logger[_0xd34e('0xf')](_0xd34e('0x25'),_0x31590c,JSON['stringify'](_0x5dad7e));_0x11491c(_0x5dad7e);})[_0xd34e('0x1e')](function(_0x12c944){logger[_0xd34e('0x12')](_0xd34e('0x25'),_0x12c944[_0xd34e('0x13')],_0x31590c);_0x5b8459(_this[_0xd34e('0x12')](0x1f4,_0x12c944[_0xd34e('0x13')]));});});}; \ No newline at end of file +var _0xc9c0=['body','options','raw','where','limit','then','stringify','catch','AddTagsToChatInteraction','ids','spread','AddTags','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','redis','defaults','localhost','./chatInteraction.socket','register','request','info','request\x20sent','debug','ChatInteraction,\x20%s,\x20%s,\x20%s','error','ChatInteraction,\x20%s,\x20%s','message','UpdateChatInteraction','ChatInteraction','update'];(function(_0x4dec9d,_0x5ee89a){var _0x63e847=function(_0x4c2489){while(--_0x4c2489){_0x4dec9d['push'](_0x4dec9d['shift']());}};_0x63e847(++_0x5ee89a);}(_0xc9c0,0x116));var _0x0c9c=function(_0xd23399,_0x5381b1){_0xd23399=_0xd23399-0x0;var _0x1759ea=_0xc9c0[_0xd23399];return _0x1759ea;};'use strict';var _=require('lodash');var util=require(_0x0c9c('0x0'));var moment=require(_0x0c9c('0x1'));var BPromise=require(_0x0c9c('0x2'));var rs=require(_0x0c9c('0x3'));var fs=require('fs');var Redis=require(_0x0c9c('0x4'));var db=require(_0x0c9c('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x0c9c('0x6'))(_0x0c9c('0x7'));var config=require(_0x0c9c('0x8'));var jayson=require(_0x0c9c('0x9'));var client=jayson['client']['http']({'port':0x232a});config[_0x0c9c('0xa')]=_[_0x0c9c('0xb')](config[_0x0c9c('0xa')],{'host':_0x0c9c('0xc'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0x0c9c('0xd'))[_0x0c9c('0xe')](socket);function respondWithRpcPromise(_0x18bd63,_0x56f5cb,_0x8dac11){return new BPromise(function(_0x5f5f8f,_0xfa015a){return client[_0x0c9c('0xf')](_0x18bd63,_0x8dac11)['then'](function(_0x9051d3){logger[_0x0c9c('0x10')]('ChatInteraction,\x20%s,\x20%s',_0x56f5cb,_0x0c9c('0x11'));logger[_0x0c9c('0x12')](_0x0c9c('0x13'),_0x56f5cb,_0x0c9c('0x11'),JSON['stringify'](_0x9051d3));if(_0x9051d3[_0x0c9c('0x14')]){if(_0x9051d3[_0x0c9c('0x14')]['code']===0x1f4){logger[_0x0c9c('0x14')](_0x0c9c('0x15'),_0x56f5cb,_0x9051d3[_0x0c9c('0x14')]['message']);return _0xfa015a(_0x9051d3['error'][_0x0c9c('0x16')]);}logger[_0x0c9c('0x14')](_0x0c9c('0x15'),_0x56f5cb,_0x9051d3[_0x0c9c('0x14')][_0x0c9c('0x16')]);return _0x5f5f8f(_0x9051d3['error'][_0x0c9c('0x16')]);}else{logger[_0x0c9c('0x10')](_0x0c9c('0x15'),_0x56f5cb,'request\x20sent');_0x5f5f8f(_0x9051d3['result'][_0x0c9c('0x16')]);}})['catch'](function(_0x4560f9){logger[_0x0c9c('0x14')]('ChatInteraction,\x20%s,\x20%s',_0x56f5cb,_0x4560f9);_0xfa015a(_0x4560f9);});});}exports[_0x0c9c('0x17')]=function(_0x1c0f3e){var _0x40fdf8=this;return new Promise(function(_0x16033a,_0x41cb8b){return db[_0x0c9c('0x18')][_0x0c9c('0x19')](_0x1c0f3e[_0x0c9c('0x1a')],{'raw':_0x1c0f3e[_0x0c9c('0x1b')]?_0x1c0f3e[_0x0c9c('0x1b')][_0x0c9c('0x1c')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x1c0f3e[_0x0c9c('0x1b')]?_0x1c0f3e[_0x0c9c('0x1b')][_0x0c9c('0x1d')]||null:null,'attributes':_0x1c0f3e[_0x0c9c('0x1b')]?_0x1c0f3e[_0x0c9c('0x1b')]['attributes']||null:null,'limit':_0x1c0f3e['options']?_0x1c0f3e['options'][_0x0c9c('0x1e')]||null:null})[_0x0c9c('0x1f')](function(_0x42232f){logger['info'](_0x0c9c('0x17'),_0x1c0f3e);logger['debug'](_0x0c9c('0x17'),_0x1c0f3e,JSON[_0x0c9c('0x20')](_0x42232f));_0x16033a(_0x42232f);})[_0x0c9c('0x21')](function(_0x211024){logger['error']('UpdateChatInteraction',_0x211024['message'],_0x1c0f3e);_0x41cb8b(_0x40fdf8[_0x0c9c('0x14')](0x1f4,_0x211024[_0x0c9c('0x16')]));});});};exports[_0x0c9c('0x22')]=function(_0xcfd3e2){return new Promise(function(_0x4e467a,_0x555955){return db['ChatInteraction']['find']({'where':_0xcfd3e2[_0x0c9c('0x1b')]?_0xcfd3e2[_0x0c9c('0x1b')]['where']||null:null})[_0x0c9c('0x1f')](function(_0x311285){if(_0x311285){return _0x311285['addTags'](_0xcfd3e2[_0x0c9c('0x1a')][_0x0c9c('0x23')],_['omit'](_0xcfd3e2[_0x0c9c('0x1a')],[_0x0c9c('0x23'),'id'])||{});}})[_0x0c9c('0x24')](function(_0x297a02){logger[_0x0c9c('0x10')](_0x0c9c('0x25'),_0xcfd3e2);logger[_0x0c9c('0x12')](_0x0c9c('0x25'),_0xcfd3e2,JSON[_0x0c9c('0x20')](_0x297a02));_0x4e467a(_0x297a02);})[_0x0c9c('0x21')](function(_0x2d9f4e){logger[_0x0c9c('0x14')](_0x0c9c('0x25'),_0x2d9f4e['message'],_0xcfd3e2);_0x555955(_this['error'](0x1f4,_0x2d9f4e[_0x0c9c('0x16')]));});});}; \ No newline at end of file diff --git a/server/api/chatInteraction/chatInteraction.socket.js b/server/api/chatInteraction/chatInteraction.socket.js index 4136579..34577e8 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 _0xf343=['removeListener','register','./chatInteraction.events','save','remove'];(function(_0x41b3ca,_0x53b299){var _0x50831f=function(_0x45d97e){while(--_0x45d97e){_0x41b3ca['push'](_0x41b3ca['shift']());}};_0x50831f(++_0x53b299);}(_0xf343,0xf2));var _0x3f34=function(_0x484f7f,_0x2ff515){_0x484f7f=_0x484f7f-0x0;var _0x3b64f1=_0xf343[_0x484f7f];return _0x3b64f1;};'use strict';var ChatInteractionEvents=require(_0x3f34('0x0'));var events=[_0x3f34('0x1'),_0x3f34('0x2'),'update'];function createListener(_0x2add05,_0x562b28){return function(_0x4def89){_0x562b28['emit'](_0x2add05,_0x4def89);};}function removeListener(_0x38a329,_0x2f6eca){return function(){ChatInteractionEvents[_0x3f34('0x3')](_0x38a329,_0x2f6eca);};}exports[_0x3f34('0x4')]=function(_0x247c3c){for(var _0xcf727f=0x0,_0x2a7a8b=events['length'];_0xcf727f<_0x2a7a8b;_0xcf727f++){var _0x1f7124=events[_0xcf727f];var _0x97eb5=createListener('chatInteraction:'+_0x1f7124,_0x247c3c);ChatInteractionEvents['on'](_0x1f7124,_0x97eb5);}}; \ No newline at end of file +var _0x4063=['length','chatInteraction:','./chatInteraction.events','update','emit','register'];(function(_0x4b4f2a,_0x5558b9){var _0x20ae6d=function(_0x585e3e){while(--_0x585e3e){_0x4b4f2a['push'](_0x4b4f2a['shift']());}};_0x20ae6d(++_0x5558b9);}(_0x4063,0x68));var _0x3406=function(_0x552097,_0x225983){_0x552097=_0x552097-0x0;var _0x2a98a0=_0x4063[_0x552097];return _0x2a98a0;};'use strict';var ChatInteractionEvents=require(_0x3406('0x0'));var events=['save','remove',_0x3406('0x1')];function createListener(_0x73245b,_0x3cb5fd){return function(_0x12e2ff){_0x3cb5fd[_0x3406('0x2')](_0x73245b,_0x12e2ff);};}function removeListener(_0x590036,_0x2c1c9c){return function(){ChatInteractionEvents['removeListener'](_0x590036,_0x2c1c9c);};}exports[_0x3406('0x3')]=function(_0x735265){for(var _0x4d3967=0x0,_0x4c42b2=events[_0x3406('0x4')];_0x4d3967<_0x4c42b2;_0x4d3967++){var _0x4bc0a4=events[_0x4d3967];var _0x624e3d=createListener(_0x3406('0x5')+_0x4bc0a4,_0x735265);ChatInteractionEvents['on'](_0x4bc0a4,_0x624e3d);}}; \ No newline at end of file diff --git a/server/api/chatInteraction/index.js b/server/api/chatInteraction/index.js index f111154..cc21dbe 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 _0x09c6=['chatinteraction:destroy','removeTags','exports','util','connect-timeout','Router','../../components/interaction/service','./chatInteraction.controller','get','isAuthenticated','describe','isChatInteractionAuthorized','show','/:id/attachment_download','attachmentDownload','getMessages','/:id/my_messages','getMyMessages','/:id/download','create','diskStorage','join','root','format','%s-%s','now','originalname','replace','post','/:id/attachment_upload','single','file','attachmentUpload','/:id/messages','addMessage','/:id/tags','tracked','chat','chatinteraction:addtags','put','/:id','/:id/custom_update','customUpdate','abandon','/:id/close','close','delete'];(function(_0x24254a,_0x216bfd){var _0x36f3bd=function(_0x214098){while(--_0x214098){_0x24254a['push'](_0x24254a['shift']());}};_0x36f3bd(++_0x216bfd);}(_0x09c6,0x90));var _0x609c=function(_0x11d10f,_0x11f53a){_0x11d10f=_0x11d10f-0x0;var _0x4d0a6b=_0x09c6[_0x11d10f];return _0x4d0a6b;};'use strict';var multer=require('multer');var util=require(_0x609c('0x0'));var path=require('path');var timeout=require(_0x609c('0x1'));var express=require('express');var router=express[_0x609c('0x2')]();var auth=require('../../components/auth/service');var interaction=require(_0x609c('0x3'));var config=require('../../config/environment');var controller=require(_0x609c('0x4'));router[_0x609c('0x5')]('/',auth[_0x609c('0x6')](),controller['index']);router[_0x609c('0x5')]('/describe',auth[_0x609c('0x6')](),controller[_0x609c('0x7')]);router[_0x609c('0x5')]('/:id',auth[_0x609c('0x8')](),controller[_0x609c('0x9')]);router['get'](_0x609c('0xa'),auth[_0x609c('0x8')](),controller[_0x609c('0xb')]);router[_0x609c('0x5')]('/:id/messages',auth[_0x609c('0x6')](),controller[_0x609c('0xc')]);router[_0x609c('0x5')](_0x609c('0xd'),auth['isChatInteractionAuthorized'](),controller[_0x609c('0xe')]);router[_0x609c('0x5')](_0x609c('0xf'),auth[_0x609c('0x6')](),controller['download']);router['post']('/',auth['isAuthenticated'](),controller[_0x609c('0x10')]);var upload=multer({'storage':multer[_0x609c('0x11')]({'destination':function(_0x43df31,_0x363031,_0x4e74a4){_0x4e74a4(null,path[_0x609c('0x12')](config[_0x609c('0x13')],'server/files/attachments/'));},'filename':function(_0x20a738,_0x3c1417,_0x1cc39c){_0x1cc39c(null,util[_0x609c('0x14')](_0x609c('0x15'),Date[_0x609c('0x16')](),_0x3c1417[_0x609c('0x17')][_0x609c('0x18')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-')));}})});router[_0x609c('0x19')](_0x609c('0x1a'),upload[_0x609c('0x1b')](_0x609c('0x1c')),controller[_0x609c('0x1d')]);router[_0x609c('0x19')](_0x609c('0x1e'),auth[_0x609c('0x8')](),controller[_0x609c('0x1f')]);router['post'](_0x609c('0x20'),auth[_0x609c('0x6')](),interaction[_0x609c('0x21')](_0x609c('0x22'),_0x609c('0x23')),controller['addTags']);router[_0x609c('0x24')](_0x609c('0x25'),auth[_0x609c('0x6')](),interaction['tracked'](_0x609c('0x22'),'chatinteraction:update'),controller['update']);router[_0x609c('0x24')](_0x609c('0x26'),controller[_0x609c('0x27')]);router[_0x609c('0x24')]('/:id/abandon',auth[_0x609c('0x8')](),controller[_0x609c('0x28')]);router['put'](_0x609c('0x29'),controller[_0x609c('0x2a')]);router[_0x609c('0x2b')](_0x609c('0x25'),auth['isAuthenticated'](),interaction[_0x609c('0x21')](_0x609c('0x22'),_0x609c('0x2c')),controller['destroy']);router[_0x609c('0x2b')]('/:id/tags',auth['isAuthenticated'](),controller[_0x609c('0x2d')]);module[_0x609c('0x2e')]=router; \ No newline at end of file +var _0x8f86=['addMessage','tracked','chat','update','put','customUpdate','/:id/abandon','abandon','close','delete','chatinteraction:destroy','destroy','exports','multer','util','path','connect-timeout','Router','../../components/auth/service','./chatInteraction.controller','get','isAuthenticated','index','/describe','describe','/:id','attachmentDownload','/:id/messages','getMessages','/:id/my_messages','isChatInteractionAuthorized','download','create','join','server/files/attachments/','format','%s-%s','originalname','replace','/:id/attachment_upload','single','file','attachmentUpload','post'];(function(_0x3a7e01,_0x51204c){var _0x5b8398=function(_0x4dcfab){while(--_0x4dcfab){_0x3a7e01['push'](_0x3a7e01['shift']());}};_0x5b8398(++_0x51204c);}(_0x8f86,0x65));var _0x68f8=function(_0x214b9f,_0x166185){_0x214b9f=_0x214b9f-0x0;var _0x23ec2b=_0x8f86[_0x214b9f];return _0x23ec2b;};'use strict';var multer=require(_0x68f8('0x0'));var util=require(_0x68f8('0x1'));var path=require(_0x68f8('0x2'));var timeout=require(_0x68f8('0x3'));var express=require('express');var router=express[_0x68f8('0x4')]();var auth=require(_0x68f8('0x5'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x68f8('0x6'));router[_0x68f8('0x7')]('/',auth[_0x68f8('0x8')](),controller[_0x68f8('0x9')]);router[_0x68f8('0x7')](_0x68f8('0xa'),auth[_0x68f8('0x8')](),controller[_0x68f8('0xb')]);router['get'](_0x68f8('0xc'),auth['isChatInteractionAuthorized'](),controller['show']);router[_0x68f8('0x7')]('/:id/attachment_download',auth['isChatInteractionAuthorized'](),controller[_0x68f8('0xd')]);router[_0x68f8('0x7')](_0x68f8('0xe'),auth[_0x68f8('0x8')](),controller[_0x68f8('0xf')]);router['get'](_0x68f8('0x10'),auth[_0x68f8('0x11')](),controller['getMyMessages']);router[_0x68f8('0x7')]('/:id/download',auth['isAuthenticated'](),controller[_0x68f8('0x12')]);router['post']('/',auth[_0x68f8('0x8')](),controller[_0x68f8('0x13')]);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x3508fd,_0x145c63,_0x2a4487){_0x2a4487(null,path[_0x68f8('0x14')](config['root'],_0x68f8('0x15')));},'filename':function(_0x59d62a,_0x3334ca,_0x3697fb){_0x3697fb(null,util[_0x68f8('0x16')](_0x68f8('0x17'),Date['now'](),_0x3334ca[_0x68f8('0x18')][_0x68f8('0x19')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-')));}})});router['post'](_0x68f8('0x1a'),upload[_0x68f8('0x1b')](_0x68f8('0x1c')),controller[_0x68f8('0x1d')]);router[_0x68f8('0x1e')](_0x68f8('0xe'),auth[_0x68f8('0x11')](),controller[_0x68f8('0x1f')]);router[_0x68f8('0x1e')]('/:id/tags',auth[_0x68f8('0x8')](),interaction[_0x68f8('0x20')]('chat','chatinteraction:addtags'),controller['addTags']);router['put'](_0x68f8('0xc'),auth['isAuthenticated'](),interaction[_0x68f8('0x20')](_0x68f8('0x21'),'chatinteraction:update'),controller[_0x68f8('0x22')]);router[_0x68f8('0x23')]('/:id/custom_update',controller[_0x68f8('0x24')]);router[_0x68f8('0x23')](_0x68f8('0x25'),auth[_0x68f8('0x11')](),controller[_0x68f8('0x26')]);router[_0x68f8('0x23')]('/:id/close',controller[_0x68f8('0x27')]);router[_0x68f8('0x28')]('/:id',auth['isAuthenticated'](),interaction[_0x68f8('0x20')](_0x68f8('0x21'),_0x68f8('0x29')),controller[_0x68f8('0x2a')]);router['delete']('/:id/tags',auth[_0x68f8('0x8')](),controller['removeTags']);module[_0x68f8('0x2b')]=router; \ No newline at end of file diff --git a/server/api/chatInternalMessage/chatInternalMessage.attributes.js b/server/api/chatInternalMessage/chatInternalMessage.attributes.js index ddfbe61..6da8fe6 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 _0x7a54=['BOOLEAN','INTEGER','sequelize','exports','TEXT'];(function(_0x1a9204,_0x1c9e00){var _0x17ca68=function(_0x1f4399){while(--_0x1f4399){_0x1a9204['push'](_0x1a9204['shift']());}};_0x17ca68(++_0x1c9e00);}(_0x7a54,0x106));var _0x47a5=function(_0x4d3cbb,_0x441e9b){_0x4d3cbb=_0x4d3cbb-0x0;var _0x2c4f57=_0x7a54[_0x4d3cbb];return _0x2c4f57;};'use strict';var Sequelize=require(_0x47a5('0x0'));module[_0x47a5('0x1')]={'body':{'type':Sequelize[_0x47a5('0x2')]('medium'),'allowNull':![]},'read':{'type':Sequelize[_0x47a5('0x3')],'defaultValue':![]},'ChatInternalMessageId':{'type':Sequelize[_0x47a5('0x4')]}}; \ No newline at end of file +var _0x66fa=['exports','medium','BOOLEAN','INTEGER','sequelize'];(function(_0x34537f,_0x213a48){var _0x4bc478=function(_0x22690e){while(--_0x22690e){_0x34537f['push'](_0x34537f['shift']());}};_0x4bc478(++_0x213a48);}(_0x66fa,0x117));var _0xa66f=function(_0x42115d,_0x5cc615){_0x42115d=_0x42115d-0x0;var _0x5cf727=_0x66fa[_0x42115d];return _0x5cf727;};'use strict';var Sequelize=require(_0xa66f('0x0'));module[_0xa66f('0x1')]={'body':{'type':Sequelize['TEXT'](_0xa66f('0x2')),'allowNull':![]},'read':{'type':Sequelize[_0xa66f('0x3')],'defaultValue':![]},'ChatInternalMessageId':{'type':Sequelize[_0xa66f('0x4')]}}; \ No newline at end of file diff --git a/server/api/chatInternalMessage/chatInternalMessage.controller.js b/server/api/chatInternalMessage/chatInternalMessage.controller.js index d45fbad..23c2f75 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 _0x789f=['online','lastLoginAt','VoiceQueue','VoiceQueues','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','Agents','userProfileId','UserProfileResource','isEmpty','resourceId','push','FromId','read','-createdAt','all','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','sox','to-csv','squel','jsforce','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/utils','../../config/environment','../../mysqldb','defaults','localhost','socket.io-emitter','redis','register','sendStatus','status','json','count','offset','set','Content-Range','apply','reject','save','destroy','then','end','error','name','send','index','ChatInternalMessage','rawAttributes','fieldName','type','key','map','query','filters','model','attributes','fields','length','hasOwnProperty','limit','order','sort','pick','filter','merge','VIRTUAL','options','where','includeAll','include','catch','show','params','keys','intersection','body','find','describe','messages','lastMessageAt','lastMessage','format','YYYY-MM-DD\x20HH:mm:ss','User','findAll','agent','admin','user','fullname','role','userpic','internal'];(function(_0x172747,_0x1732bd){var _0x509692=function(_0x448c56){while(--_0x448c56){_0x172747['push'](_0x172747['shift']());}};_0x509692(++_0x1732bd);}(_0x789f,0xe7));var _0xf789=function(_0x13992d,_0x3029ea){_0x13992d=_0x13992d-0x0;var _0x3d15bf=_0x789f[_0x13992d];return _0x3d15bf;};'use strict';var pdf=require(_0xf789('0x0'));var emlformat=require(_0xf789('0x1'));var rimraf=require(_0xf789('0x2'));var zipdir=require(_0xf789('0x3'));var jsonpatch=require(_0xf789('0x4'));var rp=require(_0xf789('0x5'));var moment=require(_0xf789('0x6'));var BPromise=require(_0xf789('0x7'));var Mustache=require('mustache');var util=require(_0xf789('0x8'));var path=require(_0xf789('0x9'));var sox=require(_0xf789('0xa'));var csv=require(_0xf789('0xb'));var ejs=require('ejs');var fs=require('fs');var _=require('lodash');var squel=require(_0xf789('0xc'));var crypto=require('crypto');var jsforce=require(_0xf789('0xd'));var deskjs=require('desk.js');var toCsv=require(_0xf789('0xb'));var querystring=require('querystring');var Papa=require(_0xf789('0xe'));var Redis=require('ioredis');var authService=require(_0xf789('0xf'));var qs=require(_0xf789('0x10'));var as=require(_0xf789('0x11'));var hardwareService=require(_0xf789('0x12'));var logger=require('../../config/logger')('api');var utils=require(_0xf789('0x13'));var config=require(_0xf789('0x14'));var db=require(_0xf789('0x15'))['db'];config['redis']=_[_0xf789('0x16')](config['redis'],{'host':_0xf789('0x17'),'port':0x18eb});var socket=require(_0xf789('0x18'))(new Redis(config[_0xf789('0x19')]));require('./chatInternalMessage.socket')[_0xf789('0x1a')](socket);function respondWithStatusCode(_0x72563a,_0x22bf89){_0x22bf89=_0x22bf89||0xcc;return function(_0x3064b3){if(_0x3064b3){return _0x72563a[_0xf789('0x1b')](_0x22bf89);}return _0x72563a[_0xf789('0x1c')](_0x22bf89)['end']();};}function respondWithResult(_0x123655,_0x5bdddf){_0x5bdddf=_0x5bdddf||0xc8;return function(_0x4412bf){if(_0x4412bf){return _0x123655['status'](_0x5bdddf)[_0xf789('0x1d')](_0x4412bf);}};}function respondWithFilteredResult(_0x3bb11c,_0x91eb70){return function(_0x11b868){if(_0x11b868){var _0x54e633=_0x11b868[_0xf789('0x1e')],_0x3ad884=_0x91eb70[_0xf789('0x1f')],_0x445166=_0x91eb70[_0xf789('0x1f')]+_0x91eb70['limit'],_0x2c5202;if(_0x445166>=_0x54e633){_0x445166=_0x54e633;_0x2c5202=0xc8;}else{_0x2c5202=0xce;}_0x3bb11c[_0xf789('0x1c')](_0x2c5202);return _0x3bb11c[_0xf789('0x20')](_0xf789('0x21'),_0x3ad884+'-'+_0x445166+'/'+_0x54e633)[_0xf789('0x1d')](_0x11b868);}return null;};}function patchUpdates(_0x51f44f){return function(_0x4507bc){try{jsonpatch[_0xf789('0x22')](_0x4507bc,_0x51f44f,!![]);}catch(_0x45f422){return BPromise[_0xf789('0x23')](_0x45f422);}return _0x4507bc[_0xf789('0x24')]();};}function saveUpdates(_0x3a8eab,_0x351480){return function(_0x534cd1){if(_0x534cd1){return _0x534cd1['update'](_0x3a8eab)['then'](function(_0x53b64f){return _0x53b64f;});}return null;};}function removeEntity(_0x56490f,_0x10205a){return function(_0x9da469){if(_0x9da469){return _0x9da469[_0xf789('0x25')]()[_0xf789('0x26')](function(){_0x56490f[_0xf789('0x1c')](0xcc)[_0xf789('0x27')]();});}};}function handleEntityNotFound(_0x4882a2,_0x50ab47){return function(_0x4abc1e){if(!_0x4abc1e){_0x4882a2['sendStatus'](0x194);}return _0x4abc1e;};}function handleError(_0x3a8072,_0xfabcae){_0xfabcae=_0xfabcae||0x1f4;return function(_0x1cf65c){logger[_0xf789('0x28')](_0x1cf65c['stack']);if(_0x1cf65c[_0xf789('0x29')]){delete _0x1cf65c[_0xf789('0x29')];}_0x3a8072[_0xf789('0x1c')](_0xfabcae)[_0xf789('0x2a')](_0x1cf65c);};}exports[_0xf789('0x2b')]=function(_0x345a0b,_0x17571d){var _0x1e4205={},_0x5d9158={},_0x2ba3b5={'count':0x0,'rows':[]};var _0x5f2d55=_['map'](db[_0xf789('0x2c')][_0xf789('0x2d')],function(_0x3ecfa8){return{'name':_0x3ecfa8[_0xf789('0x2e')],'type':_0x3ecfa8[_0xf789('0x2f')][_0xf789('0x30')]};});_0x5d9158['model']=_[_0xf789('0x31')](_0x5f2d55,_0xf789('0x29'));_0x5d9158[_0xf789('0x32')]=_['keys'](_0x345a0b[_0xf789('0x32')]);_0x5d9158[_0xf789('0x33')]=_['intersection'](_0x5d9158[_0xf789('0x34')],_0x5d9158[_0xf789('0x32')]);_0x1e4205[_0xf789('0x35')]=_['intersection'](_0x5d9158[_0xf789('0x34')],qs['fields'](_0x345a0b[_0xf789('0x32')][_0xf789('0x36')]));_0x1e4205['attributes']=_0x1e4205[_0xf789('0x35')][_0xf789('0x37')]?_0x1e4205[_0xf789('0x35')]:_0x5d9158[_0xf789('0x34')];if(!_0x345a0b[_0xf789('0x32')][_0xf789('0x38')]('nolimit')){_0x1e4205['limit']=qs['limit'](_0x345a0b['query'][_0xf789('0x39')]);_0x1e4205[_0xf789('0x1f')]=qs[_0xf789('0x1f')](_0x345a0b[_0xf789('0x32')]['offset']);}_0x1e4205[_0xf789('0x3a')]=qs[_0xf789('0x3b')](_0x345a0b['query'][_0xf789('0x3b')]);_0x1e4205['where']=qs[_0xf789('0x33')](_[_0xf789('0x3c')](_0x345a0b[_0xf789('0x32')],_0x5d9158[_0xf789('0x33')]));if(_0x345a0b[_0xf789('0x32')][_0xf789('0x3d')]){_0x1e4205['where']=_[_0xf789('0x3e')](_0x1e4205['where'],{'$or':_['map'](_0x5f2d55,function(_0x55f305){if(_0x55f305[_0xf789('0x2f')]!==_0xf789('0x3f')){var _0x3db6d2={};_0x3db6d2[_0x55f305[_0xf789('0x29')]]={'$like':'%'+_0x345a0b[_0xf789('0x32')][_0xf789('0x3d')]+'%'};return _0x3db6d2;}})});}_0x1e4205=_['merge']({},_0x1e4205,_0x345a0b[_0xf789('0x40')]);var _0x5944ad={'where':_0x1e4205[_0xf789('0x41')]};return db[_0xf789('0x2c')][_0xf789('0x1e')](_0x5944ad)[_0xf789('0x26')](function(_0x566e53){_0x2ba3b5[_0xf789('0x1e')]=_0x566e53;if(_0x345a0b[_0xf789('0x32')][_0xf789('0x42')]){_0x1e4205[_0xf789('0x43')]=[{'all':!![]}];}return db[_0xf789('0x2c')]['findAll'](_0x1e4205);})['then'](function(_0x3b83e0){_0x2ba3b5['rows']=_0x3b83e0;return _0x2ba3b5;})[_0xf789('0x26')](respondWithFilteredResult(_0x17571d,_0x1e4205))[_0xf789('0x44')](handleError(_0x17571d,null));};exports[_0xf789('0x45')]=function(_0xea80ea,_0x48ee0f){var _0x2f080a={'raw':!![],'where':{'id':_0xea80ea[_0xf789('0x46')]['id']}},_0x192348={};_0x192348[_0xf789('0x34')]=_[_0xf789('0x47')](db[_0xf789('0x2c')][_0xf789('0x2d')]);_0x192348['query']=_[_0xf789('0x47')](_0xea80ea[_0xf789('0x32')]);_0x192348[_0xf789('0x33')]=_[_0xf789('0x48')](_0x192348['model'],_0x192348['query']);_0x2f080a[_0xf789('0x35')]=_[_0xf789('0x48')](_0x192348[_0xf789('0x34')],qs['fields'](_0xea80ea[_0xf789('0x32')][_0xf789('0x36')]));_0x2f080a['attributes']=_0x2f080a[_0xf789('0x35')][_0xf789('0x37')]?_0x2f080a['attributes']:_0x192348[_0xf789('0x34')];if(_0xea80ea['query'][_0xf789('0x42')]){_0x2f080a[_0xf789('0x43')]=[{'all':!![]}];}_0x2f080a=_[_0xf789('0x3e')]({},_0x2f080a,_0xea80ea[_0xf789('0x40')]);return db['ChatInternalMessage']['find'](_0x2f080a)[_0xf789('0x26')](handleEntityNotFound(_0x48ee0f,null))[_0xf789('0x26')](respondWithResult(_0x48ee0f,null))[_0xf789('0x44')](handleError(_0x48ee0f,null));};exports['create']=function(_0x3d842a,_0x5c5134){return db[_0xf789('0x2c')]['create'](_0x3d842a[_0xf789('0x49')],{})['then'](respondWithResult(_0x5c5134,0xc9))[_0xf789('0x44')](handleError(_0x5c5134,null));};exports['update']=function(_0x4b74ee,_0x58967b){if(_0x4b74ee[_0xf789('0x49')]['id']){delete _0x4b74ee[_0xf789('0x49')]['id'];}return db['ChatInternalMessage'][_0xf789('0x4a')]({'where':{'id':_0x4b74ee[_0xf789('0x46')]['id']}})[_0xf789('0x26')](handleEntityNotFound(_0x58967b,null))['then'](saveUpdates(_0x4b74ee[_0xf789('0x49')],null))[_0xf789('0x26')](respondWithResult(_0x58967b,null))[_0xf789('0x44')](handleError(_0x58967b,null));};exports[_0xf789('0x25')]=function(_0x28558e,_0x2719f3){return db[_0xf789('0x2c')][_0xf789('0x4a')]({'where':{'id':_0x28558e['params']['id']}})[_0xf789('0x26')](handleEntityNotFound(_0x2719f3,null))['then'](removeEntity(_0x2719f3,null))[_0xf789('0x44')](handleError(_0x2719f3,null));};exports[_0xf789('0x4b')]=function(_0x18da98,_0x28c1b2){return db[_0xf789('0x2c')]['describe']()[_0xf789('0x26')](respondWithResult(_0x28c1b2,null))[_0xf789('0x44')](handleError(_0x28c1b2,null));};function wrapUser(_0x155381){return function(_0x180c45){var _0x397a8b=_0x155381['get']({'plain':!![]});_0x397a8b[_0xf789('0x4c')]=[];if(_0x180c45){_0x397a8b[_0xf789('0x4d')]=_0x180c45['createdAt'];_0x397a8b[_0xf789('0x4e')]=_0x180c45;}else{_0x397a8b[_0xf789('0x4d')]=moment(0x0)[_0xf789('0x4f')](_0xf789('0x50'));_0x397a8b[_0xf789('0x4e')]={};}return _0x397a8b;};}exports['getUsers']=function(_0x351497,_0xd1ce5,_0x5e243e){var _0x4210a8=[];return db[_0xf789('0x51')][_0xf789('0x52')]({'where':{'role':[_0xf789('0x53'),_0xf789('0x54'),_0xf789('0x55')]},'attributes':['id',_0xf789('0x56'),_0xf789('0x29'),_0xf789('0x57'),_0xf789('0x58'),_0xf789('0x59'),_0xf789('0x5a'),_0xf789('0x5b'),'allowmessenger','showWebBar'],'order':qs['sort']('-online'),'include':[{'model':db[_0xf789('0x5c')],'as':_0xf789('0x5d'),'attributes':['id',_0xf789('0x29'),_0xf789('0x2f')],'through':{'attributes':[]}}]})[_0xf789('0x26')](function(_0x4bf23f){if(_0x4bf23f){var _0x2428b=_0x351497[_0xf789('0x55')][_0xf789('0x5e')]({'plain':!![]});if(!_0x2428b)throw new Error(_0xf789('0x5f'));if(_0x2428b['role']===_0xf789('0x55')){return db[_0xf789('0x60')][_0xf789('0x4a')]({'where':{'name':_0xf789('0x61'),'userProfileId':_0x2428b[_0xf789('0x62')]},'raw':!![]})[_0xf789('0x26')](function(_0x591e56){if(_0x591e56){if(_0x591e56['autoAssociation']===0x0){return db[_0xf789('0x63')][_0xf789('0x52')]({'where':{'sectionId':_0x591e56['id']},'raw':!![]})[_0xf789('0x26')](function(_0x227d56){var _0x5b5555=[];if(_[_0xf789('0x64')](_0x227d56)){_0x5b5555=_[_0xf789('0x3d')](_0x4bf23f,function(_0x1aa01b){if(_0x1aa01b['role']!=='agent'){return _0x1aa01b;}});return _0x5b5555;}else{for(var _0x27d6bc=0x0;_0x27d6bc<_0x4bf23f[_0xf789('0x37')];_0x27d6bc++){var _0x36fb35=_0x4bf23f[_0x27d6bc];if(_0x36fb35[_0xf789('0x57')]===_0xf789('0x53')){var _0xe597b5=_[_0xf789('0x4a')](_0x227d56,function(_0x3f7ca0){return _0x3f7ca0[_0xf789('0x65')]===_0x36fb35['id'];});if(_0xe597b5)_0x5b5555[_0xf789('0x66')](_0x36fb35);}else{_0x5b5555[_0xf789('0x66')](_0x36fb35);}}return _0x5b5555;}});}else{return _0x4bf23f;}}else{var _0x4b959d=_['filter'](_0x4bf23f,function(_0x3ee848){if(_0x3ee848[_0xf789('0x57')]!==_0xf789('0x53')){return _0x3ee848;}});return _0x4b959d;}});}else{return _0x4bf23f;}}})[_0xf789('0x26')](function(_0x4d186e){var _0x560387=[];if(_0x4d186e){_0x4210a8=_0x4d186e;for(var _0x2aa810=0x0;_0x2aa810<_0x4d186e['length'];_0x2aa810+=0x1){_0x4210a8[_0x2aa810][_0xf789('0x4c')]=[];_0x560387['push'](db[_0xf789('0x2c')][_0xf789('0x4a')]({'where':{'FromId':[_0x351497['user']['id'],_0x4d186e[_0x2aa810]['id']],'ToId':[_0x351497['user']['id'],_0x4d186e[_0x2aa810]['id']],'ChatGroupId':null},'attributes':['id','createdAt',_0xf789('0x67'),'ToId',_0xf789('0x68'),_0xf789('0x49')],'order':qs['sort'](_0xf789('0x69')),'limit':0x1,'offset':0x0,'raw':!![]})[_0xf789('0x26')](wrapUser(_0x4d186e[_0x2aa810])));}return BPromise[_0xf789('0x6a')](_0x560387);}return[];})[_0xf789('0x26')](function(_0x3616f1){return{'rows':_0x3616f1,'count':_0x3616f1[_0xf789('0x37')]};})[_0xf789('0x26')](respondWithResult(_0xd1ce5,null))[_0xf789('0x44')](handleError(_0xd1ce5,null));}; \ No newline at end of file +var _0xa3bb=['options','includeAll','include','findAll','show','params','keys','catch','body','describe','get','lastMessageAt','lastMessage','YYYY-MM-DD\x20HH:mm:ss','getUsers','User','agent','admin','user','role','internal','online','lastLoginAt','allowmessenger','showWebBar','-online','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','find','Agents','userProfileId','UserProfileResource','isEmpty','resourceId','push','messages','FromId','ToId','read','-createdAt','html-pdf','eml-format','zip-dir','moment','bluebird','util','path','sox','to-csv','lodash','squel','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','redis','socket.io-emitter','./chatInternalMessage.socket','register','sendStatus','status','end','json','count','offset','set','Content-Range','apply','reject','update','destroy','then','error','stack','name','index','map','ChatInternalMessage','rawAttributes','fieldName','type','model','query','intersection','fields','attributes','length','nolimit','limit','sort','where','filters','filter','merge'];(function(_0x21d3d5,_0x38163c){var _0xf0057b=function(_0x2d1646){while(--_0x2d1646){_0x21d3d5['push'](_0x21d3d5['shift']());}};_0xf0057b(++_0x38163c);}(_0xa3bb,0x8e));var _0xba3b=function(_0x37853b,_0x35e920){_0x37853b=_0x37853b-0x0;var _0x32c9f1=_0xa3bb[_0x37853b];return _0x32c9f1;};'use strict';var pdf=require(_0xba3b('0x0'));var emlformat=require(_0xba3b('0x1'));var rimraf=require('rimraf');var zipdir=require(_0xba3b('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0xba3b('0x3'));var BPromise=require(_0xba3b('0x4'));var Mustache=require('mustache');var util=require(_0xba3b('0x5'));var path=require(_0xba3b('0x6'));var sox=require(_0xba3b('0x7'));var csv=require(_0xba3b('0x8'));var ejs=require('ejs');var fs=require('fs');var _=require(_0xba3b('0x9'));var squel=require(_0xba3b('0xa'));var crypto=require('crypto');var jsforce=require(_0xba3b('0xb'));var deskjs=require(_0xba3b('0xc'));var toCsv=require(_0xba3b('0x8'));var querystring=require(_0xba3b('0xd'));var Papa=require(_0xba3b('0xe'));var Redis=require('ioredis');var authService=require(_0xba3b('0xf'));var qs=require(_0xba3b('0x10'));var as=require(_0xba3b('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xba3b('0x12'))(_0xba3b('0x13'));var utils=require(_0xba3b('0x14'));var config=require(_0xba3b('0x15'));var db=require(_0xba3b('0x16'))['db'];config[_0xba3b('0x17')]=_['defaults'](config[_0xba3b('0x17')],{'host':'localhost','port':0x18eb});var socket=require(_0xba3b('0x18'))(new Redis(config[_0xba3b('0x17')]));require(_0xba3b('0x19'))[_0xba3b('0x1a')](socket);function respondWithStatusCode(_0x5ef485,_0x2a9555){_0x2a9555=_0x2a9555||0xcc;return function(_0x1cff82){if(_0x1cff82){return _0x5ef485[_0xba3b('0x1b')](_0x2a9555);}return _0x5ef485[_0xba3b('0x1c')](_0x2a9555)[_0xba3b('0x1d')]();};}function respondWithResult(_0x51f1f1,_0x5157b5){_0x5157b5=_0x5157b5||0xc8;return function(_0x4858f3){if(_0x4858f3){return _0x51f1f1[_0xba3b('0x1c')](_0x5157b5)[_0xba3b('0x1e')](_0x4858f3);}};}function respondWithFilteredResult(_0x24d63,_0xe7c293){return function(_0x194de7){if(_0x194de7){var _0x4a3a12=_0x194de7[_0xba3b('0x1f')],_0x49e4d2=_0xe7c293['offset'],_0x1c6822=_0xe7c293[_0xba3b('0x20')]+_0xe7c293['limit'],_0x228fad;if(_0x1c6822>=_0x4a3a12){_0x1c6822=_0x4a3a12;_0x228fad=0xc8;}else{_0x228fad=0xce;}_0x24d63[_0xba3b('0x1c')](_0x228fad);return _0x24d63[_0xba3b('0x21')](_0xba3b('0x22'),_0x49e4d2+'-'+_0x1c6822+'/'+_0x4a3a12)['json'](_0x194de7);}return null;};}function patchUpdates(_0x2cd5bd){return function(_0x5d5078){try{jsonpatch[_0xba3b('0x23')](_0x5d5078,_0x2cd5bd,!![]);}catch(_0x972e5b){return BPromise[_0xba3b('0x24')](_0x972e5b);}return _0x5d5078['save']();};}function saveUpdates(_0x274cc7,_0x23029e){return function(_0x37dd09){if(_0x37dd09){return _0x37dd09[_0xba3b('0x25')](_0x274cc7)['then'](function(_0x4f89c9){return _0x4f89c9;});}return null;};}function removeEntity(_0x2eac03,_0x454312){return function(_0x13ea32){if(_0x13ea32){return _0x13ea32[_0xba3b('0x26')]()[_0xba3b('0x27')](function(){_0x2eac03[_0xba3b('0x1c')](0xcc)['end']();});}};}function handleEntityNotFound(_0x24514b,_0x98a0d0){return function(_0x16c5f0){if(!_0x16c5f0){_0x24514b[_0xba3b('0x1b')](0x194);}return _0x16c5f0;};}function handleError(_0x4a7c61,_0x581e1d){_0x581e1d=_0x581e1d||0x1f4;return function(_0x481086){logger[_0xba3b('0x28')](_0x481086[_0xba3b('0x29')]);if(_0x481086[_0xba3b('0x2a')]){delete _0x481086[_0xba3b('0x2a')];}_0x4a7c61[_0xba3b('0x1c')](_0x581e1d)['send'](_0x481086);};}exports[_0xba3b('0x2b')]=function(_0xd112fa,_0x205282){var _0x353eef={},_0x1e17ef={},_0x42bca3={'count':0x0,'rows':[]};var _0x12a99b=_[_0xba3b('0x2c')](db[_0xba3b('0x2d')][_0xba3b('0x2e')],function(_0x9936ed){return{'name':_0x9936ed[_0xba3b('0x2f')],'type':_0x9936ed[_0xba3b('0x30')]['key']};});_0x1e17ef[_0xba3b('0x31')]=_['map'](_0x12a99b,_0xba3b('0x2a'));_0x1e17ef[_0xba3b('0x32')]=_['keys'](_0xd112fa[_0xba3b('0x32')]);_0x1e17ef['filters']=_[_0xba3b('0x33')](_0x1e17ef[_0xba3b('0x31')],_0x1e17ef['query']);_0x353eef['attributes']=_[_0xba3b('0x33')](_0x1e17ef[_0xba3b('0x31')],qs[_0xba3b('0x34')](_0xd112fa['query'][_0xba3b('0x34')]));_0x353eef['attributes']=_0x353eef[_0xba3b('0x35')][_0xba3b('0x36')]?_0x353eef['attributes']:_0x1e17ef['model'];if(!_0xd112fa['query']['hasOwnProperty'](_0xba3b('0x37'))){_0x353eef[_0xba3b('0x38')]=qs[_0xba3b('0x38')](_0xd112fa[_0xba3b('0x32')][_0xba3b('0x38')]);_0x353eef[_0xba3b('0x20')]=qs['offset'](_0xd112fa[_0xba3b('0x32')][_0xba3b('0x20')]);}_0x353eef['order']=qs[_0xba3b('0x39')](_0xd112fa[_0xba3b('0x32')][_0xba3b('0x39')]);_0x353eef[_0xba3b('0x3a')]=qs[_0xba3b('0x3b')](_['pick'](_0xd112fa[_0xba3b('0x32')],_0x1e17ef[_0xba3b('0x3b')]));if(_0xd112fa[_0xba3b('0x32')][_0xba3b('0x3c')]){_0x353eef['where']=_[_0xba3b('0x3d')](_0x353eef[_0xba3b('0x3a')],{'$or':_['map'](_0x12a99b,function(_0x4dbd34){if(_0x4dbd34[_0xba3b('0x30')]!=='VIRTUAL'){var _0x98135f={};_0x98135f[_0x4dbd34[_0xba3b('0x2a')]]={'$like':'%'+_0xd112fa[_0xba3b('0x32')][_0xba3b('0x3c')]+'%'};return _0x98135f;}})});}_0x353eef=_[_0xba3b('0x3d')]({},_0x353eef,_0xd112fa[_0xba3b('0x3e')]);var _0x2f0898={'where':_0x353eef[_0xba3b('0x3a')]};return db[_0xba3b('0x2d')][_0xba3b('0x1f')](_0x2f0898)[_0xba3b('0x27')](function(_0x5e6075){_0x42bca3[_0xba3b('0x1f')]=_0x5e6075;if(_0xd112fa[_0xba3b('0x32')][_0xba3b('0x3f')]){_0x353eef[_0xba3b('0x40')]=[{'all':!![]}];}return db[_0xba3b('0x2d')][_0xba3b('0x41')](_0x353eef);})[_0xba3b('0x27')](function(_0x52caa6){_0x42bca3['rows']=_0x52caa6;return _0x42bca3;})[_0xba3b('0x27')](respondWithFilteredResult(_0x205282,_0x353eef))['catch'](handleError(_0x205282,null));};exports[_0xba3b('0x42')]=function(_0x49953f,_0x56619a){var _0x21e3eb={'raw':!![],'where':{'id':_0x49953f[_0xba3b('0x43')]['id']}},_0x3c6278={};_0x3c6278['model']=_[_0xba3b('0x44')](db[_0xba3b('0x2d')][_0xba3b('0x2e')]);_0x3c6278[_0xba3b('0x32')]=_[_0xba3b('0x44')](_0x49953f[_0xba3b('0x32')]);_0x3c6278[_0xba3b('0x3b')]=_[_0xba3b('0x33')](_0x3c6278['model'],_0x3c6278[_0xba3b('0x32')]);_0x21e3eb[_0xba3b('0x35')]=_[_0xba3b('0x33')](_0x3c6278['model'],qs[_0xba3b('0x34')](_0x49953f['query'][_0xba3b('0x34')]));_0x21e3eb[_0xba3b('0x35')]=_0x21e3eb[_0xba3b('0x35')][_0xba3b('0x36')]?_0x21e3eb[_0xba3b('0x35')]:_0x3c6278[_0xba3b('0x31')];if(_0x49953f[_0xba3b('0x32')][_0xba3b('0x3f')]){_0x21e3eb[_0xba3b('0x40')]=[{'all':!![]}];}_0x21e3eb=_[_0xba3b('0x3d')]({},_0x21e3eb,_0x49953f[_0xba3b('0x3e')]);return db[_0xba3b('0x2d')]['find'](_0x21e3eb)[_0xba3b('0x27')](handleEntityNotFound(_0x56619a,null))[_0xba3b('0x27')](respondWithResult(_0x56619a,null))['catch'](handleError(_0x56619a,null));};exports['create']=function(_0x4e20d9,_0x8ad81e){return db[_0xba3b('0x2d')]['create'](_0x4e20d9['body'],{})[_0xba3b('0x27')](respondWithResult(_0x8ad81e,0xc9))[_0xba3b('0x45')](handleError(_0x8ad81e,null));};exports['update']=function(_0x7aec7,_0x11570a){if(_0x7aec7[_0xba3b('0x46')]['id']){delete _0x7aec7[_0xba3b('0x46')]['id'];}return db[_0xba3b('0x2d')]['find']({'where':{'id':_0x7aec7[_0xba3b('0x43')]['id']}})[_0xba3b('0x27')](handleEntityNotFound(_0x11570a,null))[_0xba3b('0x27')](saveUpdates(_0x7aec7[_0xba3b('0x46')],null))[_0xba3b('0x27')](respondWithResult(_0x11570a,null))[_0xba3b('0x45')](handleError(_0x11570a,null));};exports[_0xba3b('0x26')]=function(_0x363fcd,_0x5d4bef){return db[_0xba3b('0x2d')]['find']({'where':{'id':_0x363fcd['params']['id']}})[_0xba3b('0x27')](handleEntityNotFound(_0x5d4bef,null))[_0xba3b('0x27')](removeEntity(_0x5d4bef,null))[_0xba3b('0x45')](handleError(_0x5d4bef,null));};exports[_0xba3b('0x47')]=function(_0x29c609,_0x329829){return db[_0xba3b('0x2d')][_0xba3b('0x47')]()[_0xba3b('0x27')](respondWithResult(_0x329829,null))[_0xba3b('0x45')](handleError(_0x329829,null));};function wrapUser(_0x517803){return function(_0x58d1d6){var _0x6ef601=_0x517803[_0xba3b('0x48')]({'plain':!![]});_0x6ef601['messages']=[];if(_0x58d1d6){_0x6ef601[_0xba3b('0x49')]=_0x58d1d6['createdAt'];_0x6ef601[_0xba3b('0x4a')]=_0x58d1d6;}else{_0x6ef601[_0xba3b('0x49')]=moment(0x0)['format'](_0xba3b('0x4b'));_0x6ef601[_0xba3b('0x4a')]={};}return _0x6ef601;};}exports[_0xba3b('0x4c')]=function(_0x5d1219,_0x31e37c,_0x78221f){var _0x45e213=[];return db[_0xba3b('0x4d')][_0xba3b('0x41')]({'where':{'role':[_0xba3b('0x4e'),_0xba3b('0x4f'),_0xba3b('0x50')]},'attributes':['id','fullname',_0xba3b('0x2a'),_0xba3b('0x51'),'userpic',_0xba3b('0x52'),_0xba3b('0x53'),_0xba3b('0x54'),_0xba3b('0x55'),_0xba3b('0x56')],'order':qs[_0xba3b('0x39')](_0xba3b('0x57')),'include':[{'model':db['VoiceQueue'],'as':'VoiceQueues','attributes':['id',_0xba3b('0x2a'),_0xba3b('0x30')],'through':{'attributes':[]}}]})[_0xba3b('0x27')](function(_0x43bb16){if(_0x43bb16){var _0x392be5=_0x5d1219[_0xba3b('0x50')][_0xba3b('0x48')]({'plain':!![]});if(!_0x392be5)throw new Error(_0xba3b('0x58'));if(_0x392be5['role']===_0xba3b('0x50')){return db[_0xba3b('0x59')][_0xba3b('0x5a')]({'where':{'name':_0xba3b('0x5b'),'userProfileId':_0x392be5[_0xba3b('0x5c')]},'raw':!![]})[_0xba3b('0x27')](function(_0x3b5bf6){if(_0x3b5bf6){if(_0x3b5bf6['autoAssociation']===0x0){return db[_0xba3b('0x5d')][_0xba3b('0x41')]({'where':{'sectionId':_0x3b5bf6['id']},'raw':!![]})[_0xba3b('0x27')](function(_0x476a0e){var _0x379221=[];if(_[_0xba3b('0x5e')](_0x476a0e)){_0x379221=_[_0xba3b('0x3c')](_0x43bb16,function(_0x155563){if(_0x155563[_0xba3b('0x51')]!==_0xba3b('0x4e')){return _0x155563;}});return _0x379221;}else{for(var _0x4fdf0e=0x0;_0x4fdf0e<_0x43bb16[_0xba3b('0x36')];_0x4fdf0e++){var _0x1828a1=_0x43bb16[_0x4fdf0e];if(_0x1828a1[_0xba3b('0x51')]==='agent'){var _0x5a310f=_[_0xba3b('0x5a')](_0x476a0e,function(_0x58696a){return _0x58696a[_0xba3b('0x5f')]===_0x1828a1['id'];});if(_0x5a310f)_0x379221[_0xba3b('0x60')](_0x1828a1);}else{_0x379221[_0xba3b('0x60')](_0x1828a1);}}return _0x379221;}});}else{return _0x43bb16;}}else{var _0x5f3ac5=_[_0xba3b('0x3c')](_0x43bb16,function(_0x48ced3){if(_0x48ced3[_0xba3b('0x51')]!=='agent'){return _0x48ced3;}});return _0x5f3ac5;}});}else{return _0x43bb16;}}})[_0xba3b('0x27')](function(_0x2574a3){var _0x26c77d=[];if(_0x2574a3){_0x45e213=_0x2574a3;for(var _0x2e1aa7=0x0;_0x2e1aa7<_0x2574a3[_0xba3b('0x36')];_0x2e1aa7+=0x1){_0x45e213[_0x2e1aa7][_0xba3b('0x61')]=[];_0x26c77d[_0xba3b('0x60')](db[_0xba3b('0x2d')][_0xba3b('0x5a')]({'where':{'FromId':[_0x5d1219[_0xba3b('0x50')]['id'],_0x2574a3[_0x2e1aa7]['id']],'ToId':[_0x5d1219[_0xba3b('0x50')]['id'],_0x2574a3[_0x2e1aa7]['id']],'ChatGroupId':null},'attributes':['id','createdAt',_0xba3b('0x62'),_0xba3b('0x63'),_0xba3b('0x64'),_0xba3b('0x46')],'order':qs[_0xba3b('0x39')](_0xba3b('0x65')),'limit':0x1,'offset':0x0,'raw':!![]})[_0xba3b('0x27')](wrapUser(_0x2574a3[_0x2e1aa7])));}return BPromise['all'](_0x26c77d);}return[];})[_0xba3b('0x27')](function(_0x249466){return{'rows':_0x249466,'count':_0x249466['length']};})[_0xba3b('0x27')](respondWithResult(_0x31e37c,null))[_0xba3b('0x45')](handleError(_0x31e37c,null));}; \ No newline at end of file diff --git a/server/api/chatInternalMessage/chatInternalMessage.events.js b/server/api/chatInternalMessage/chatInternalMessage.events.js index 31c07f7..c48059c 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 _0xb8b7=['exports','update','remove','hasOwnProperty','hook'];(function(_0x116279,_0x17fc0d){var _0x521ac8=function(_0x4690e7){while(--_0x4690e7){_0x116279['push'](_0x116279['shift']());}};_0x521ac8(++_0x17fc0d);}(_0xb8b7,0x114));var _0x7b8b=function(_0x5d4607,_0x6b5e7b){_0x5d4607=_0x5d4607-0x0;var _0x5e4a86=_0xb8b7[_0x5d4607];return _0x5e4a86;};'use strict';var EventEmitter=require('events');var ChatInternalMessage=require('../../mysqldb')['db']['ChatInternalMessage'];var ChatInternalMessageEvents=new EventEmitter();ChatInternalMessageEvents['setMaxListeners'](0x0);var events={'afterCreate':'save','afterUpdate':_0x7b8b('0x0'),'afterDestroy':_0x7b8b('0x1')};function emitEvent(_0x423ff4){return function(_0x5739f6,_0x189130,_0x228859){ChatInternalMessageEvents['emit'](_0x423ff4+':'+_0x5739f6['id'],_0x5739f6);ChatInternalMessageEvents['emit'](_0x423ff4,_0x5739f6);_0x228859(null);};}for(var e in events){if(events[_0x7b8b('0x2')](e)){var event=events[e];ChatInternalMessage[_0x7b8b('0x3')](e,emitEvent(event));}}module[_0x7b8b('0x4')]=ChatInternalMessageEvents; \ No newline at end of file +var _0x70e9=['hasOwnProperty','hook','exports','../../mysqldb','ChatInternalMessage','save','update','emit'];(function(_0x1ec221,_0x4c83dd){var _0x5a75a0=function(_0x6320ae){while(--_0x6320ae){_0x1ec221['push'](_0x1ec221['shift']());}};_0x5a75a0(++_0x4c83dd);}(_0x70e9,0x193));var _0x970e=function(_0x19b51d,_0x34c337){_0x19b51d=_0x19b51d-0x0;var _0x200ff8=_0x70e9[_0x19b51d];return _0x200ff8;};'use strict';var EventEmitter=require('events');var ChatInternalMessage=require(_0x970e('0x0'))['db'][_0x970e('0x1')];var ChatInternalMessageEvents=new EventEmitter();ChatInternalMessageEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x970e('0x2'),'afterUpdate':_0x970e('0x3'),'afterDestroy':'remove'};function emitEvent(_0x7d5b70){return function(_0x50df5a,_0x94a135,_0x169feb){ChatInternalMessageEvents[_0x970e('0x4')](_0x7d5b70+':'+_0x50df5a['id'],_0x50df5a);ChatInternalMessageEvents[_0x970e('0x4')](_0x7d5b70,_0x50df5a);_0x169feb(null);};}for(var e in events){if(events[_0x970e('0x5')](e)){var event=events[e];ChatInternalMessage[_0x970e('0x6')](e,emitEvent(event));}}module[_0x970e('0x7')]=ChatInternalMessageEvents; \ No newline at end of file diff --git a/server/api/chatInternalMessage/chatInternalMessage.model.js b/server/api/chatInternalMessage/chatInternalMessage.model.js index 4ad96a1..1d43dc6 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(_0x283577,_0x28ed15){var _0x1ff0c5=function(_0x4b8a34){while(--_0x4b8a34){_0x283577['push'](_0x283577['shift']());}};_0x1ff0c5(++_0x28ed15);}(_0xbaf0,0x12a));var _0x0baf=function(_0x2b4411,_0x2625ed){_0x2b4411=_0x2b4411-0x0;var _0x8e41ef=_0xbaf0[_0x2b4411];return _0x8e41ef;};'use strict';var _=require('lodash');var util=require(_0x0baf('0x0'));var 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 _0x9ffd=['utf8mb4','utf8mb4_unicode_ci','lodash','util','../../config/logger','moment','bluebird','request-promise','path','../../config/environment','./chatInternalMessage.attributes','define','ChatInternalMessage','chat_internal_messages'];(function(_0x31fced,_0x3bcf1e){var _0x557481=function(_0x22788d){while(--_0x22788d){_0x31fced['push'](_0x31fced['shift']());}};_0x557481(++_0x3bcf1e);}(_0x9ffd,0xaa));var _0xd9ff=function(_0x2834f6,_0x2b9158){_0x2834f6=_0x2834f6-0x0;var _0x4d04f9=_0x9ffd[_0x2834f6];return _0x4d04f9;};'use strict';var _=require(_0xd9ff('0x0'));var util=require(_0xd9ff('0x1'));var logger=require(_0xd9ff('0x2'))('api');var moment=require(_0xd9ff('0x3'));var BPromise=require(_0xd9ff('0x4'));var rp=require(_0xd9ff('0x5'));var fs=require('fs');var path=require(_0xd9ff('0x6'));var rimraf=require('rimraf');var config=require(_0xd9ff('0x7'));var attributes=require(_0xd9ff('0x8'));module['exports']=function(_0x3aa26b,_0x2982c3){return _0x3aa26b[_0xd9ff('0x9')](_0xd9ff('0xa'),attributes,{'tableName':_0xd9ff('0xb'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0xd9ff('0xc'),'collate':_0xd9ff('0xd')});}; \ No newline at end of file diff --git a/server/api/chatInternalMessage/chatInternalMessage.rpc.js b/server/api/chatInternalMessage/chatInternalMessage.rpc.js index b015392..3d0e460 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 _0xccdc=['moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','socket.io-emitter','./chatInternalMessage.socket','register','request','info','ChatInternalMessage,\x20%s,\x20%s','request\x20sent','debug','ChatInternalMessage,\x20%s,\x20%s,\x20%s','error','message','lodash'];(function(_0x4e18d9,_0x36e07c){var _0x1dc37f=function(_0x4892e5){while(--_0x4892e5){_0x4e18d9['push'](_0x4e18d9['shift']());}};_0x1dc37f(++_0x36e07c);}(_0xccdc,0x9b));var _0xcccd=function(_0x4fde08,_0x463a36){_0x4fde08=_0x4fde08-0x0;var _0x12e725=_0xccdc[_0x4fde08];return _0x12e725;};'use strict';var _=require(_0xcccd('0x0'));var util=require('util');var moment=require(_0xcccd('0x1'));var BPromise=require(_0xcccd('0x2'));var rs=require(_0xcccd('0x3'));var fs=require('fs');var Redis=require(_0xcccd('0x4'));var db=require(_0xcccd('0x5'))['db'];var utils=require(_0xcccd('0x6'));var logger=require(_0xcccd('0x7'))(_0xcccd('0x8'));var config=require(_0xcccd('0x9'));var jayson=require(_0xcccd('0xa'));var client=jayson[_0xcccd('0xb')][_0xcccd('0xc')]({'port':0x232a});config[_0xcccd('0xd')]=_[_0xcccd('0xe')](config[_0xcccd('0xd')],{'host':'localhost','port':0x18eb});var socket=require(_0xcccd('0xf'))(new Redis(config[_0xcccd('0xd')]));require(_0xcccd('0x10'))[_0xcccd('0x11')](socket);function respondWithRpcPromise(_0x562106,_0x36a827,_0x4b9d3b){return new BPromise(function(_0x149bd2,_0x1d6167){return client[_0xcccd('0x12')](_0x562106,_0x4b9d3b)['then'](function(_0x57d35b){logger[_0xcccd('0x13')](_0xcccd('0x14'),_0x36a827,_0xcccd('0x15'));logger[_0xcccd('0x16')](_0xcccd('0x17'),_0x36a827,_0xcccd('0x15'),JSON['stringify'](_0x57d35b));if(_0x57d35b[_0xcccd('0x18')]){if(_0x57d35b['error']['code']===0x1f4){logger['error'](_0xcccd('0x14'),_0x36a827,_0x57d35b[_0xcccd('0x18')][_0xcccd('0x19')]);return _0x1d6167(_0x57d35b[_0xcccd('0x18')][_0xcccd('0x19')]);}logger['error']('ChatInternalMessage,\x20%s,\x20%s',_0x36a827,_0x57d35b[_0xcccd('0x18')]['message']);return _0x149bd2(_0x57d35b[_0xcccd('0x18')][_0xcccd('0x19')]);}else{logger[_0xcccd('0x13')](_0xcccd('0x14'),_0x36a827,_0xcccd('0x15'));_0x149bd2(_0x57d35b['result'][_0xcccd('0x19')]);}})['catch'](function(_0x1261ef){logger[_0xcccd('0x18')](_0xcccd('0x14'),_0x36a827,_0x1261ef);_0x1d6167(_0x1261ef);});});} \ No newline at end of file +var _0x340e=['ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','redis','localhost','./chatInternalMessage.socket','then','info','ChatInternalMessage,\x20%s,\x20%s','request\x20sent','debug','error','code','message','result','lodash','util','moment','bluebird','randomstring'];(function(_0x37ff64,_0x593317){var _0x572fb6=function(_0x5aebac){while(--_0x5aebac){_0x37ff64['push'](_0x37ff64['shift']());}};_0x572fb6(++_0x593317);}(_0x340e,0xc3));var _0xe340=function(_0x34f4de,_0x43ac56){_0x34f4de=_0x34f4de-0x0;var _0x28c93b=_0x340e[_0x34f4de];return _0x28c93b;};'use strict';var _=require(_0xe340('0x0'));var util=require(_0xe340('0x1'));var moment=require(_0xe340('0x2'));var BPromise=require(_0xe340('0x3'));var rs=require(_0xe340('0x4'));var fs=require('fs');var Redis=require(_0xe340('0x5'));var db=require(_0xe340('0x6'))['db'];var utils=require(_0xe340('0x7'));var logger=require(_0xe340('0x8'))(_0xe340('0x9'));var config=require(_0xe340('0xa'));var jayson=require(_0xe340('0xb'));var client=jayson['client'][_0xe340('0xc')]({'port':0x232a});config[_0xe340('0xd')]=_['defaults'](config[_0xe340('0xd')],{'host':_0xe340('0xe'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xe340('0xd')]));require(_0xe340('0xf'))['register'](socket);function respondWithRpcPromise(_0x4755d7,_0x5c56d8,_0x17430c){return new BPromise(function(_0x2ebb11,_0x39ddfe){return client['request'](_0x4755d7,_0x17430c)[_0xe340('0x10')](function(_0xbd1928){logger[_0xe340('0x11')](_0xe340('0x12'),_0x5c56d8,_0xe340('0x13'));logger[_0xe340('0x14')]('ChatInternalMessage,\x20%s,\x20%s,\x20%s',_0x5c56d8,_0xe340('0x13'),JSON['stringify'](_0xbd1928));if(_0xbd1928[_0xe340('0x15')]){if(_0xbd1928[_0xe340('0x15')][_0xe340('0x16')]===0x1f4){logger[_0xe340('0x15')](_0xe340('0x12'),_0x5c56d8,_0xbd1928['error']['message']);return _0x39ddfe(_0xbd1928['error'][_0xe340('0x17')]);}logger[_0xe340('0x15')](_0xe340('0x12'),_0x5c56d8,_0xbd1928[_0xe340('0x15')][_0xe340('0x17')]);return _0x2ebb11(_0xbd1928[_0xe340('0x15')]['message']);}else{logger[_0xe340('0x11')](_0xe340('0x12'),_0x5c56d8,_0xe340('0x13'));_0x2ebb11(_0xbd1928[_0xe340('0x18')]['message']);}})['catch'](function(_0x3539ab){logger[_0xe340('0x15')](_0xe340('0x12'),_0x5c56d8,_0x3539ab);_0x39ddfe(_0x3539ab);});});} \ No newline at end of file diff --git a/server/api/chatInternalMessage/chatInternalMessage.socket.js b/server/api/chatInternalMessage/chatInternalMessage.socket.js index 2b78b16..77fe899 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 _0xbf83=['remove','update','removeListener','register','length','chatInternalMessage:','./chatInternalMessage.events'];(function(_0x2ef8c1,_0x2f72f4){var _0x288305=function(_0x56244b){while(--_0x56244b){_0x2ef8c1['push'](_0x2ef8c1['shift']());}};_0x288305(++_0x2f72f4);}(_0xbf83,0x11e));var _0x3bf8=function(_0x1a096a,_0x349f97){_0x1a096a=_0x1a096a-0x0;var _0x435d2a=_0xbf83[_0x1a096a];return _0x435d2a;};'use strict';var ChatInternalMessageEvents=require(_0x3bf8('0x0'));var events=['save',_0x3bf8('0x1'),_0x3bf8('0x2')];function createListener(_0x3cbf10,_0x21c4ac){return function(_0x2b1141){_0x21c4ac['emit'](_0x3cbf10,_0x2b1141);};}function removeListener(_0x565784,_0x459aef){return function(){ChatInternalMessageEvents[_0x3bf8('0x3')](_0x565784,_0x459aef);};}exports[_0x3bf8('0x4')]=function(_0x251445){for(var _0x5be89b=0x0,_0x5b0c12=events[_0x3bf8('0x5')];_0x5be89b<_0x5b0c12;_0x5be89b++){var _0x2df7c9=events[_0x5be89b];var _0x4adc52=createListener(_0x3bf8('0x6')+_0x2df7c9,_0x251445);ChatInternalMessageEvents['on'](_0x2df7c9,_0x4adc52);}}; \ No newline at end of file +var _0x1061=['register','chatInternalMessage:','./chatInternalMessage.events','emit','removeListener'];(function(_0x40c402,_0x42ee7d){var _0x4e7680=function(_0x52b150){while(--_0x52b150){_0x40c402['push'](_0x40c402['shift']());}};_0x4e7680(++_0x42ee7d);}(_0x1061,0x1b5));var _0x1106=function(_0x217d18,_0x53411b){_0x217d18=_0x217d18-0x0;var _0x92bc13=_0x1061[_0x217d18];return _0x92bc13;};'use strict';var ChatInternalMessageEvents=require(_0x1106('0x0'));var events=['save','remove','update'];function createListener(_0x986553,_0x3a9fe3){return function(_0x3362fc){_0x3a9fe3[_0x1106('0x1')](_0x986553,_0x3362fc);};}function removeListener(_0x1c1bae,_0x13fcfc){return function(){ChatInternalMessageEvents[_0x1106('0x2')](_0x1c1bae,_0x13fcfc);};}exports[_0x1106('0x3')]=function(_0x5120c6){for(var _0x1f098a=0x0,_0x36bfb3=events['length'];_0x1f098a<_0x36bfb3;_0x1f098a++){var _0x523f0f=events[_0x1f098a];var _0x287336=createListener(_0x1106('0x4')+_0x523f0f,_0x5120c6);ChatInternalMessageEvents['on'](_0x523f0f,_0x287336);}}; \ No newline at end of file diff --git a/server/api/chatInternalMessage/index.js b/server/api/chatInternalMessage/index.js index 666feb2..49543d3 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 _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(_0x529dcd,_0x2b4d25){var _0x11bbb3=function(_0x4610c8){while(--_0x4610c8){_0x529dcd['push'](_0x529dcd['shift']());}};_0x11bbb3(++_0x2b4d25);}(_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 +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(_0x34e71f,_0x21eb42){var _0x35add5=function(_0x2d5cb7){while(--_0x2d5cb7){_0x34e71f['push'](_0x34e71f['shift']());}};_0x35add5(++_0x21eb42);}(_0xb7e7,0x121));var _0x7b7e=function(_0x502c7d,_0x2f1285){_0x502c7d=_0x502c7d-0x0;var _0x30b7ed=_0xb7e7[_0x502c7d];return _0x30b7ed;};'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 diff --git a/server/api/chatMessage/chatMessage.attributes.js b/server/api/chatMessage/chatMessage.attributes.js index 667bb2a..85ba14d 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 _0x7c7c=['BOOLEAN','out','DATE','sequelize','TEXT','medium'];(function(_0x15ce3a,_0x1cf22c){var _0x202f3b=function(_0xd3605e){while(--_0xd3605e){_0x15ce3a['push'](_0x15ce3a['shift']());}};_0x202f3b(++_0x1cf22c);}(_0x7c7c,0x147));var _0xc7c7=function(_0x2c2174,_0x1f123c){_0x2c2174=_0x2c2174-0x0;var _0x530d3c=_0x7c7c[_0x2c2174];return _0x530d3c;};'use strict';var Sequelize=require(_0xc7c7('0x0'));module['exports']={'body':{'type':Sequelize[_0xc7c7('0x1')](_0xc7c7('0x2')),'allowNull':![]},'read':{'type':Sequelize[_0xc7c7('0x3')],'defaultValue':![]},'secret':{'type':Sequelize[_0xc7c7('0x3')],'defaultValue':![]},'direction':{'type':Sequelize['ENUM']('in',_0xc7c7('0x4')),'defaultValue':_0xc7c7('0x4'),'allowNull':![]},'readAt':{'type':Sequelize[_0xc7c7('0x5')]}}; \ No newline at end of file +var _0x55cf=['sequelize','exports','medium','BOOLEAN','ENUM','out','DATE'];(function(_0x9e6264,_0x12e18d){var _0xd80ee6=function(_0x4476c9){while(--_0x4476c9){_0x9e6264['push'](_0x9e6264['shift']());}};_0xd80ee6(++_0x12e18d);}(_0x55cf,0xd2));var _0xf55c=function(_0x3c4f1f,_0x20d3ec){_0x3c4f1f=_0x3c4f1f-0x0;var _0x19cb69=_0x55cf[_0x3c4f1f];return _0x19cb69;};'use strict';var Sequelize=require(_0xf55c('0x0'));module[_0xf55c('0x1')]={'body':{'type':Sequelize['TEXT'](_0xf55c('0x2')),'allowNull':![]},'read':{'type':Sequelize[_0xf55c('0x3')],'defaultValue':![]},'secret':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'direction':{'type':Sequelize[_0xf55c('0x4')]('in',_0xf55c('0x5')),'defaultValue':_0xf55c('0x5'),'allowNull':![]},'readAt':{'type':Sequelize[_0xf55c('0x6')]}}; \ No newline at end of file diff --git a/server/api/chatMessage/chatMessage.controller.js b/server/api/chatMessage/chatMessage.controller.js index 725fdaf..6f2f355 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 _0x2c66=['rejectmessage','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','papaparse','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','defaults','socket.io-emitter','redis','./chatMessage.socket','register','jayson/promise','http','client','Sequelize','ValidationError','The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.','request','info','ChatMessage,\x20%s,\x20%s','request\x20sent','debug','ChatMessage,\x20%s,\x20%s,\x20%s','error','message','result','catch','status','end','json','count','offset','set','apply','save','update','then','sendStatus','stack','send','index','ChatMessage','rawAttributes','fieldName','key','query','filters','intersection','model','fields','attributes','length','hasOwnProperty','limit','order','sort','where','filter','map','type','name','includeAll','include','rows','params','keys','merge','options','find','create','body','destroy','chat-interactions','accept','chat','read','readAt','YYYY-MM-DD\x20HH:mm:ss','UserId','user','Contact','get','ChatInteraction','ChatInteractionId','read1stAt','format','interaction','role','stringify','null','AcceptMessage','acceptMessage','manual','interface','SIP/%s','channel','event','EventManager','acceptmessage','parse','reject','agent','[CHATMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','RejectMessage','rejectMessage'];(function(_0x2f0f6d,_0x34678d){var _0x27e89c=function(_0x2f34bb){while(--_0x2f34bb){_0x2f0f6d['push'](_0x2f0f6d['shift']());}};_0x27e89c(++_0x34678d);}(_0x2c66,0x7e));var _0x62c6=function(_0x32b4aa,_0x12eba6){_0x32b4aa=_0x32b4aa-0x0;var _0x473160=_0x2c66[_0x32b4aa];return _0x473160;};'use strict';var pdf=require(_0x62c6('0x0'));var emlformat=require(_0x62c6('0x1'));var rimraf=require(_0x62c6('0x2'));var zipdir=require(_0x62c6('0x3'));var jsonpatch=require(_0x62c6('0x4'));var rp=require('request-promise');var moment=require(_0x62c6('0x5'));var BPromise=require(_0x62c6('0x6'));var Mustache=require(_0x62c6('0x7'));var util=require('util');var path=require('path');var sox=require(_0x62c6('0x8'));var csv=require(_0x62c6('0x9'));var ejs=require(_0x62c6('0xa'));var fs=require('fs');var _=require(_0x62c6('0xb'));var squel=require(_0x62c6('0xc'));var crypto=require(_0x62c6('0xd'));var jsforce=require(_0x62c6('0xe'));var deskjs=require(_0x62c6('0xf'));var toCsv=require(_0x62c6('0x9'));var querystring=require('querystring');var Papa=require(_0x62c6('0x10'));var Redis=require('ioredis');var authService=require(_0x62c6('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0x62c6('0x12'));var hardwareService=require(_0x62c6('0x13'));var logger=require(_0x62c6('0x14'))(_0x62c6('0x15'));var utils=require(_0x62c6('0x16'));var config=require(_0x62c6('0x17'));var db=require(_0x62c6('0x18'))['db'];config['redis']=_[_0x62c6('0x19')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0x62c6('0x1a'))(new Redis(config[_0x62c6('0x1b')]));require(_0x62c6('0x1c'))[_0x62c6('0x1d')](socket);var jayson=require(_0x62c6('0x1e'));var client=jayson['client'][_0x62c6('0x1f')]({'port':0x232c});var client9002=jayson[_0x62c6('0x20')][_0x62c6('0x1f')]({'port':0x232a});function checkPasswordPattern(_0x1d2fd7,_0x3aefba,_0x58171a){if(_0x58171a){var _0x118ea8=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x118ea8['test'](_0x3aefba)){return _0x1d2fd7;}else{throw new db[(_0x62c6('0x21'))][(_0x62c6('0x22'))](_0x62c6('0x23'));}}else{return _0x1d2fd7;}}function respondWithRpcPromise(_0x34fc50,_0x465e3d,_0x1416d5,_0x19c6ef){return new BPromise(function(_0x80cae0,_0x10f24c){var _0x39ceed=_0x19c6ef||client;return _0x39ceed[_0x62c6('0x24')](_0x34fc50,_0x1416d5)['then'](function(_0x520e95){logger[_0x62c6('0x25')](_0x62c6('0x26'),_0x465e3d,_0x62c6('0x27'));logger[_0x62c6('0x28')](_0x62c6('0x29'),_0x465e3d,_0x62c6('0x27'),JSON['stringify'](_0x520e95));if(_0x520e95[_0x62c6('0x2a')]){if(_0x520e95[_0x62c6('0x2a')]['code']===0x1f4){logger[_0x62c6('0x2a')]('ChatMessage,\x20%s,\x20%s',_0x465e3d,_0x520e95[_0x62c6('0x2a')][_0x62c6('0x2b')]);return _0x10f24c(_0x520e95[_0x62c6('0x2a')][_0x62c6('0x2b')]);}logger[_0x62c6('0x2a')](_0x62c6('0x26'),_0x465e3d,_0x520e95['error'][_0x62c6('0x2b')]);return _0x80cae0(_0x520e95[_0x62c6('0x2a')][_0x62c6('0x2b')]);}else{logger[_0x62c6('0x25')](_0x62c6('0x26'),_0x465e3d,'request\x20sent');_0x80cae0(_0x520e95[_0x62c6('0x2c')][_0x62c6('0x2b')]);}})[_0x62c6('0x2d')](function(_0x1f6664){logger[_0x62c6('0x2a')](_0x62c6('0x26'),_0x465e3d,_0x1f6664);_0x10f24c(_0x1f6664);});});}function respondWithStatusCode(_0x29da9d,_0x2d8cc4){_0x2d8cc4=_0x2d8cc4||0xcc;return function(_0x45a855){if(_0x45a855){return _0x29da9d['sendStatus'](_0x2d8cc4);}return _0x29da9d[_0x62c6('0x2e')](_0x2d8cc4)[_0x62c6('0x2f')]();};}function respondWithResult(_0x32776e,_0x38082f){_0x38082f=_0x38082f||0xc8;return function(_0x478748){if(_0x478748){return _0x32776e[_0x62c6('0x2e')](_0x38082f)[_0x62c6('0x30')](_0x478748);}};}function respondWithFilteredResult(_0x261d87,_0x2c91f8){return function(_0x49ff0f){if(_0x49ff0f){var _0x2bffaa=_0x49ff0f[_0x62c6('0x31')],_0xdbce2f=_0x2c91f8[_0x62c6('0x32')],_0x5a5d98=_0x2c91f8[_0x62c6('0x32')]+_0x2c91f8['limit'],_0x364662;if(_0x5a5d98>=_0x2bffaa){_0x5a5d98=_0x2bffaa;_0x364662=0xc8;}else{_0x364662=0xce;}_0x261d87['status'](_0x364662);return _0x261d87[_0x62c6('0x33')]('Content-Range',_0xdbce2f+'-'+_0x5a5d98+'/'+_0x2bffaa)[_0x62c6('0x30')](_0x49ff0f);}return null;};}function patchUpdates(_0x1bd969){return function(_0x3700b5){try{jsonpatch[_0x62c6('0x34')](_0x3700b5,_0x1bd969,!![]);}catch(_0x20a260){return BPromise['reject'](_0x20a260);}return _0x3700b5[_0x62c6('0x35')]();};}function saveUpdates(_0x98b423,_0xbd351e){return function(_0x424490){if(_0x424490){return _0x424490[_0x62c6('0x36')](_0x98b423)['then'](function(_0xaa1d36){return _0xaa1d36;});}return null;};}function removeEntity(_0xa03039,_0x37f1e2){return function(_0x51364a){if(_0x51364a){return _0x51364a['destroy']()[_0x62c6('0x37')](function(){_0xa03039[_0x62c6('0x2e')](0xcc)[_0x62c6('0x2f')]();});}};}function handleEntityNotFound(_0x13215c,_0x1f2b34){return function(_0x47bb71){if(!_0x47bb71){_0x13215c[_0x62c6('0x38')](0x194);}return _0x47bb71;};}function handleError(_0x29bbaf,_0x2704ab){_0x2704ab=_0x2704ab||0x1f4;return function(_0x5ace3f){logger['error'](_0x5ace3f[_0x62c6('0x39')]);if(_0x5ace3f['name']){delete _0x5ace3f['name'];}_0x29bbaf[_0x62c6('0x2e')](_0x2704ab)[_0x62c6('0x3a')](_0x5ace3f);};}exports[_0x62c6('0x3b')]=function(_0x24831c,_0x421cd4){var _0x390da3={},_0x10e705={},_0x209450={'count':0x0,'rows':[]};var _0x3ee27a=_['map'](db[_0x62c6('0x3c')][_0x62c6('0x3d')],function(_0x6a810c){return{'name':_0x6a810c[_0x62c6('0x3e')],'type':_0x6a810c['type'][_0x62c6('0x3f')]};});_0x10e705['model']=_['map'](_0x3ee27a,'name');_0x10e705[_0x62c6('0x40')]=_['keys'](_0x24831c[_0x62c6('0x40')]);_0x10e705[_0x62c6('0x41')]=_[_0x62c6('0x42')](_0x10e705[_0x62c6('0x43')],_0x10e705[_0x62c6('0x40')]);_0x390da3['attributes']=_[_0x62c6('0x42')](_0x10e705[_0x62c6('0x43')],qs[_0x62c6('0x44')](_0x24831c[_0x62c6('0x40')]['fields']));_0x390da3[_0x62c6('0x45')]=_0x390da3[_0x62c6('0x45')][_0x62c6('0x46')]?_0x390da3['attributes']:_0x10e705[_0x62c6('0x43')];if(!_0x24831c[_0x62c6('0x40')][_0x62c6('0x47')]('nolimit')){_0x390da3[_0x62c6('0x48')]=qs['limit'](_0x24831c['query'][_0x62c6('0x48')]);_0x390da3['offset']=qs['offset'](_0x24831c[_0x62c6('0x40')]['offset']);}_0x390da3[_0x62c6('0x49')]=qs[_0x62c6('0x4a')](_0x24831c[_0x62c6('0x40')][_0x62c6('0x4a')]);_0x390da3[_0x62c6('0x4b')]=qs['filters'](_['pick'](_0x24831c['query'],_0x10e705['filters']));if(_0x24831c[_0x62c6('0x40')][_0x62c6('0x4c')]){_0x390da3[_0x62c6('0x4b')]=_['merge'](_0x390da3[_0x62c6('0x4b')],{'$or':_[_0x62c6('0x4d')](_0x3ee27a,function(_0x420dde){if(_0x420dde[_0x62c6('0x4e')]!=='VIRTUAL'){var _0x324d73={};_0x324d73[_0x420dde[_0x62c6('0x4f')]]={'$like':'%'+_0x24831c[_0x62c6('0x40')][_0x62c6('0x4c')]+'%'};return _0x324d73;}})});}_0x390da3=_['merge']({},_0x390da3,_0x24831c['options']);var _0x5acfec={'where':_0x390da3[_0x62c6('0x4b')]};return db[_0x62c6('0x3c')]['count'](_0x5acfec)[_0x62c6('0x37')](function(_0x5ebc07){_0x209450[_0x62c6('0x31')]=_0x5ebc07;if(_0x24831c[_0x62c6('0x40')][_0x62c6('0x50')]){_0x390da3[_0x62c6('0x51')]=[{'all':!![]}];}return db[_0x62c6('0x3c')]['findAll'](_0x390da3);})[_0x62c6('0x37')](function(_0x434ff1){_0x209450[_0x62c6('0x52')]=_0x434ff1;return _0x209450;})[_0x62c6('0x37')](respondWithFilteredResult(_0x421cd4,_0x390da3))[_0x62c6('0x2d')](handleError(_0x421cd4,null));};exports['show']=function(_0x470afb,_0x2e5e1a){var _0xb22b27={'raw':!![],'where':{'id':_0x470afb[_0x62c6('0x53')]['id']}},_0x509d6e={};_0x509d6e[_0x62c6('0x43')]=_[_0x62c6('0x54')](db[_0x62c6('0x3c')][_0x62c6('0x3d')]);_0x509d6e[_0x62c6('0x40')]=_[_0x62c6('0x54')](_0x470afb['query']);_0x509d6e[_0x62c6('0x41')]=_[_0x62c6('0x42')](_0x509d6e[_0x62c6('0x43')],_0x509d6e['query']);_0xb22b27[_0x62c6('0x45')]=_[_0x62c6('0x42')](_0x509d6e[_0x62c6('0x43')],qs[_0x62c6('0x44')](_0x470afb['query']['fields']));_0xb22b27[_0x62c6('0x45')]=_0xb22b27[_0x62c6('0x45')][_0x62c6('0x46')]?_0xb22b27[_0x62c6('0x45')]:_0x509d6e['model'];if(_0x470afb['query'][_0x62c6('0x50')]){_0xb22b27[_0x62c6('0x51')]=[{'all':!![]}];}_0xb22b27=_[_0x62c6('0x55')]({},_0xb22b27,_0x470afb[_0x62c6('0x56')]);return db[_0x62c6('0x3c')][_0x62c6('0x57')](_0xb22b27)[_0x62c6('0x37')](handleEntityNotFound(_0x2e5e1a,null))['then'](respondWithResult(_0x2e5e1a,null))['catch'](handleError(_0x2e5e1a,null));};exports[_0x62c6('0x58')]=function(_0x69a98f,_0x529d90){return db[_0x62c6('0x3c')][_0x62c6('0x58')](_0x69a98f[_0x62c6('0x59')],{})[_0x62c6('0x37')](respondWithResult(_0x529d90,0xc9))['catch'](handleError(_0x529d90,null));};exports[_0x62c6('0x36')]=function(_0x2a578d,_0x305929){if(_0x2a578d[_0x62c6('0x59')]['id']){delete _0x2a578d[_0x62c6('0x59')]['id'];}return db['ChatMessage']['find']({'where':{'id':_0x2a578d[_0x62c6('0x53')]['id']}})[_0x62c6('0x37')](handleEntityNotFound(_0x305929,null))[_0x62c6('0x37')](saveUpdates(_0x2a578d[_0x62c6('0x59')],null))[_0x62c6('0x37')](respondWithResult(_0x305929,null))[_0x62c6('0x2d')](handleError(_0x305929,null));};exports[_0x62c6('0x5a')]=function(_0x22f8b3,_0x41c441){return db[_0x62c6('0x3c')][_0x62c6('0x57')]({'where':{'id':_0x22f8b3[_0x62c6('0x53')]['id']}})[_0x62c6('0x37')](handleEntityNotFound(_0x41c441,null))['then'](removeEntity(_0x41c441,null))[_0x62c6('0x2d')](handleError(_0x41c441,null));};exports['describe']=function(_0x224b7c,_0x47e37f){return db[_0x62c6('0x3c')]['describe']()[_0x62c6('0x37')](respondWithResult(_0x47e37f,null))[_0x62c6('0x2d')](handleError(_0x47e37f,null));};var interaction_log=require(_0x62c6('0x14'))(_0x62c6('0x5b'));exports[_0x62c6('0x5c')]=function(_0x194a67,_0x29ad98,_0x4585ba){var _0x660831={'channel':_0x62c6('0x5d')};if(_0x194a67[_0x62c6('0x59')]['id']){delete _0x194a67[_0x62c6('0x59')]['id'];}_0x194a67['body'][_0x62c6('0x5e')]=!![];_0x194a67[_0x62c6('0x59')][_0x62c6('0x5f')]=moment()['format'](_0x62c6('0x60'));_0x194a67['body']['UserId']=_0x194a67[_0x62c6('0x59')][_0x62c6('0x61')]||_0x194a67[_0x62c6('0x62')]['id'];return db['ChatMessage'][_0x62c6('0x57')]({'where':{'id':_0x194a67[_0x62c6('0x53')]['id'],'UserId':null},'include':[{'model':db['CmContact'],'as':_0x62c6('0x63')}]})[_0x62c6('0x37')](handleEntityNotFound(_0x29ad98,null))['then'](saveUpdates(_0x194a67[_0x62c6('0x59')],null))['then'](function(_0x1e6918){if(_0x1e6918){_0x660831[_0x62c6('0x2b')]=_0x1e6918[_0x62c6('0x64')]({'plain':!![]});return db[_0x62c6('0x65')][_0x62c6('0x57')]({'where':{'id':_0x1e6918[_0x62c6('0x66')]}});}return null;})[_0x62c6('0x37')](handleEntityNotFound(_0x29ad98,null))[_0x62c6('0x37')](function(_0x220040){if(_0x220040){return _0x220040['update']({'UserId':_0x194a67[_0x62c6('0x59')][_0x62c6('0x61')],'read1stAt':_['isNil'](_0x220040[_0x62c6('0x67')])?moment()[_0x62c6('0x68')](_0x62c6('0x60')):undefined});}return null;})[_0x62c6('0x37')](function(_0x4e75d2){if(_0x4e75d2){_0x660831[_0x62c6('0x69')]=_0x4e75d2[_0x62c6('0x64')]({'plain':!![]});interaction_log['info']('[CHATMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s',_0x194a67[_0x62c6('0x62')]['id'],_0x194a67[_0x62c6('0x62')][_0x62c6('0x4f')],_0x194a67[_0x62c6('0x62')][_0x62c6('0x6a')],_0x660831[_0x62c6('0x69')]['id'],_0x194a67[_0x62c6('0x59')]?JSON[_0x62c6('0x6b')](_0x194a67[_0x62c6('0x59')]):_0x62c6('0x6c'));return respondWithRpcPromise(_0x62c6('0x6d'),_0x62c6('0x6e'),_0x660831);}return null;})['then'](function(_0x45bb67){if(_0x45bb67){if(_0x194a67['body'][_0x62c6('0x6f')]){_0x660831[_0x62c6('0x2b')][_0x62c6('0x70')]=util[_0x62c6('0x68')](_0x62c6('0x71'),_0x194a67[_0x62c6('0x62')][_0x62c6('0x4f')]);_0x660831['message']['channel']=_0x660831[_0x62c6('0x72')];_0x660831[_0x62c6('0x2b')][_0x62c6('0x73')]=_0x62c6('0x5c');return respondWithRpcPromise(_0x62c6('0x74'),_0x62c6('0x74'),{'event':_0x62c6('0x75'),'message':_[_0x62c6('0x55')](_0x660831[_0x62c6('0x2b')],JSON[_0x62c6('0x76')](_0x660831[_0x62c6('0x69')]['formData']))},client9002)[_0x62c6('0x37')](function(){return _0x660831;});}return _0x660831;}return null;})[_0x62c6('0x37')](respondWithResult(_0x29ad98,null))[_0x62c6('0x2d')](handleError(_0x29ad98,null));};var interaction_log=require(_0x62c6('0x14'))(_0x62c6('0x5b'));exports[_0x62c6('0x77')]=function(_0x475a9c,_0x7f9947,_0x184313){var _0xb012c4={'agent':{},'channel':_0x62c6('0x5d')};if(_0x475a9c[_0x62c6('0x59')]['id']){delete _0x475a9c[_0x62c6('0x59')]['id'];}_0x475a9c[_0x62c6('0x59')][_0x62c6('0x61')]=_0x475a9c[_0x62c6('0x59')][_0x62c6('0x61')]||_0x475a9c[_0x62c6('0x62')]['id'];_0xb012c4[_0x62c6('0x78')]['id']=_0x475a9c[_0x62c6('0x59')][_0x62c6('0x61')];return db[_0x62c6('0x3c')][_0x62c6('0x57')]({'where':{'id':_0x475a9c['params']['id'],'UserId':null}})[_0x62c6('0x37')](handleEntityNotFound(_0x7f9947,null))[_0x62c6('0x37')](function(_0x1bc100){if(_0x1bc100){_0xb012c4['message']=_0x1bc100[_0x62c6('0x64')]({'plain':!![]});return db[_0x62c6('0x65')]['find']({'where':{'id':_0x1bc100['ChatInteractionId']}});}return null;})['then'](handleEntityNotFound(_0x7f9947,null))[_0x62c6('0x37')](function(_0x143aeb){if(_0x143aeb){_0xb012c4[_0x62c6('0x69')]=_0x143aeb[_0x62c6('0x64')]({'plain':!![]});interaction_log[_0x62c6('0x25')](_0x62c6('0x79'),_0x475a9c[_0x62c6('0x62')]['id'],_0x475a9c[_0x62c6('0x62')][_0x62c6('0x4f')],_0x475a9c[_0x62c6('0x62')]['role'],_0xb012c4[_0x62c6('0x69')]['id'],_0x475a9c['body']?JSON[_0x62c6('0x6b')](_0x475a9c[_0x62c6('0x59')]):_0x62c6('0x6c'));return respondWithRpcPromise(_0x62c6('0x7a'),_0x62c6('0x7b'),_0xb012c4);}return null;})[_0x62c6('0x37')](function(_0x5cc814){if(_0x5cc814){_0x5cc814[_0x62c6('0x2b')][_0x62c6('0x70')]=util['format']('SIP/%s',_0x475a9c[_0x62c6('0x62')][_0x62c6('0x4f')]);_0x5cc814[_0x62c6('0x2b')][_0x62c6('0x72')]=_0xb012c4[_0x62c6('0x72')];_0x5cc814[_0x62c6('0x2b')][_0x62c6('0x73')]=_0x62c6('0x77');respondWithRpcPromise(_0x62c6('0x74'),_0x62c6('0x74'),{'event':_0x62c6('0x7c'),'message':_0x5cc814[_0x62c6('0x2b')]},client9002);return _0xb012c4;}return null;})[_0x62c6('0x37')](respondWithResult(_0x7f9947,null))[_0x62c6('0x2d')](handleError(_0x7f9947,null));}; \ No newline at end of file +var _0xfa70=['channel','event','accept','EventManager','acceptmessage','parse','interaction','formData','agent','get','ChatInteractionId','[CHATMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','role','rejectmessage','html-pdf','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','to-csv','ejs','crypto','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../mysqldb','redis','localhost','socket.io-emitter','./chatMessage.socket','register','jayson/promise','client','http','test','ValidationError','request','info','ChatMessage,\x20%s,\x20%s','request\x20sent','debug','ChatMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','sendStatus','end','json','count','offset','limit','status','set','Content-Range','apply','reject','update','destroy','stack','name','send','index','map','ChatMessage','fieldName','type','key','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','pick','where','merge','VIRTUAL','options','then','includeAll','include','findAll','rows','params','keys','create','body','find','describe','chat-interactions','chat','read','readAt','format','YYYY-MM-DD\x20HH:mm:ss','UserId','Contact','ChatInteraction','isNil','read1stAt','user','null','manual','interface','SIP/%s'];(function(_0x5e8cc8,_0x5322d8){var _0x584485=function(_0x52e1c9){while(--_0x52e1c9){_0x5e8cc8['push'](_0x5e8cc8['shift']());}};_0x584485(++_0x5322d8);}(_0xfa70,0x104));var _0x0fa7=function(_0x269147,_0x45dfc7){_0x269147=_0x269147-0x0;var _0x38ab4c=_0xfa70[_0x269147];return _0x38ab4c;};'use strict';var pdf=require(_0x0fa7('0x0'));var emlformat=require(_0x0fa7('0x1'));var rimraf=require('rimraf');var zipdir=require(_0x0fa7('0x2'));var jsonpatch=require(_0x0fa7('0x3'));var rp=require(_0x0fa7('0x4'));var moment=require(_0x0fa7('0x5'));var BPromise=require(_0x0fa7('0x6'));var Mustache=require(_0x0fa7('0x7'));var util=require('util');var path=require(_0x0fa7('0x8'));var sox=require(_0x0fa7('0x9'));var csv=require(_0x0fa7('0xa'));var ejs=require(_0x0fa7('0xb'));var fs=require('fs');var _=require('lodash');var squel=require('squel');var crypto=require(_0x0fa7('0xc'));var jsforce=require('jsforce');var deskjs=require(_0x0fa7('0xd'));var toCsv=require(_0x0fa7('0xa'));var querystring=require('querystring');var Papa=require(_0x0fa7('0xe'));var Redis=require(_0x0fa7('0xf'));var authService=require(_0x0fa7('0x10'));var qs=require(_0x0fa7('0x11'));var as=require(_0x0fa7('0x12'));var hardwareService=require(_0x0fa7('0x13'));var logger=require(_0x0fa7('0x14'))(_0x0fa7('0x15'));var utils=require('../../config/utils');var config=require(_0x0fa7('0x16'));var db=require(_0x0fa7('0x17'))['db'];config['redis']=_['defaults'](config[_0x0fa7('0x18')],{'host':_0x0fa7('0x19'),'port':0x18eb});var socket=require(_0x0fa7('0x1a'))(new Redis(config[_0x0fa7('0x18')]));require(_0x0fa7('0x1b'))[_0x0fa7('0x1c')](socket);var jayson=require(_0x0fa7('0x1d'));var client=jayson[_0x0fa7('0x1e')][_0x0fa7('0x1f')]({'port':0x232c});var client9002=jayson[_0x0fa7('0x1e')][_0x0fa7('0x1f')]({'port':0x232a});function checkPasswordPattern(_0x227973,_0xd7fd95,_0x2273f5){if(_0x2273f5){var _0x407c6b=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x407c6b[_0x0fa7('0x20')](_0xd7fd95)){return _0x227973;}else{throw new db['Sequelize'][(_0x0fa7('0x21'))]('The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.');}}else{return _0x227973;}}function respondWithRpcPromise(_0x10b115,_0x20f01a,_0x55c8c8,_0x235e5f){return new BPromise(function(_0x356580,_0x358813){var _0x164419=_0x235e5f||client;return _0x164419[_0x0fa7('0x22')](_0x10b115,_0x55c8c8)['then'](function(_0x3c0089){logger[_0x0fa7('0x23')](_0x0fa7('0x24'),_0x20f01a,_0x0fa7('0x25'));logger[_0x0fa7('0x26')](_0x0fa7('0x27'),_0x20f01a,'request\x20sent',JSON[_0x0fa7('0x28')](_0x3c0089));if(_0x3c0089[_0x0fa7('0x29')]){if(_0x3c0089['error'][_0x0fa7('0x2a')]===0x1f4){logger['error'](_0x0fa7('0x24'),_0x20f01a,_0x3c0089['error'][_0x0fa7('0x2b')]);return _0x358813(_0x3c0089[_0x0fa7('0x29')][_0x0fa7('0x2b')]);}logger[_0x0fa7('0x29')](_0x0fa7('0x24'),_0x20f01a,_0x3c0089[_0x0fa7('0x29')][_0x0fa7('0x2b')]);return _0x356580(_0x3c0089[_0x0fa7('0x29')]['message']);}else{logger['info']('ChatMessage,\x20%s,\x20%s',_0x20f01a,_0x0fa7('0x25'));_0x356580(_0x3c0089['result'][_0x0fa7('0x2b')]);}})[_0x0fa7('0x2c')](function(_0x68942c){logger[_0x0fa7('0x29')](_0x0fa7('0x24'),_0x20f01a,_0x68942c);_0x358813(_0x68942c);});});}function respondWithStatusCode(_0x1e398,_0x5ca80b){_0x5ca80b=_0x5ca80b||0xcc;return function(_0x37ba3a){if(_0x37ba3a){return _0x1e398[_0x0fa7('0x2d')](_0x5ca80b);}return _0x1e398['status'](_0x5ca80b)[_0x0fa7('0x2e')]();};}function respondWithResult(_0x402c08,_0x49d65e){_0x49d65e=_0x49d65e||0xc8;return function(_0x4bb657){if(_0x4bb657){return _0x402c08['status'](_0x49d65e)[_0x0fa7('0x2f')](_0x4bb657);}};}function respondWithFilteredResult(_0x62bde2,_0x36cf70){return function(_0x2fd262){if(_0x2fd262){var _0x1b89c1=_0x2fd262[_0x0fa7('0x30')],_0x4901fb=_0x36cf70[_0x0fa7('0x31')],_0x55f822=_0x36cf70[_0x0fa7('0x31')]+_0x36cf70[_0x0fa7('0x32')],_0x31084d;if(_0x55f822>=_0x1b89c1){_0x55f822=_0x1b89c1;_0x31084d=0xc8;}else{_0x31084d=0xce;}_0x62bde2[_0x0fa7('0x33')](_0x31084d);return _0x62bde2[_0x0fa7('0x34')](_0x0fa7('0x35'),_0x4901fb+'-'+_0x55f822+'/'+_0x1b89c1)[_0x0fa7('0x2f')](_0x2fd262);}return null;};}function patchUpdates(_0x1345c7){return function(_0x18bc2d){try{jsonpatch[_0x0fa7('0x36')](_0x18bc2d,_0x1345c7,!![]);}catch(_0x15fc8c){return BPromise[_0x0fa7('0x37')](_0x15fc8c);}return _0x18bc2d['save']();};}function saveUpdates(_0x4dd76b,_0x51f328){return function(_0x2722fa){if(_0x2722fa){return _0x2722fa[_0x0fa7('0x38')](_0x4dd76b)['then'](function(_0x3695c8){return _0x3695c8;});}return null;};}function removeEntity(_0x362c72,_0x3a0097){return function(_0x1a769d){if(_0x1a769d){return _0x1a769d[_0x0fa7('0x39')]()['then'](function(){_0x362c72['status'](0xcc)[_0x0fa7('0x2e')]();});}};}function handleEntityNotFound(_0x21c138,_0x38930f){return function(_0x3c3184){if(!_0x3c3184){_0x21c138['sendStatus'](0x194);}return _0x3c3184;};}function handleError(_0x15c8d8,_0x25c4e7){_0x25c4e7=_0x25c4e7||0x1f4;return function(_0x3d342a){logger[_0x0fa7('0x29')](_0x3d342a[_0x0fa7('0x3a')]);if(_0x3d342a[_0x0fa7('0x3b')]){delete _0x3d342a[_0x0fa7('0x3b')];}_0x15c8d8[_0x0fa7('0x33')](_0x25c4e7)[_0x0fa7('0x3c')](_0x3d342a);};}exports[_0x0fa7('0x3d')]=function(_0x1947ed,_0x11c006){var _0x4cf41d={},_0x4a745e={},_0x3fe1bd={'count':0x0,'rows':[]};var _0x5ea251=_[_0x0fa7('0x3e')](db[_0x0fa7('0x3f')]['rawAttributes'],function(_0x241b20){return{'name':_0x241b20[_0x0fa7('0x40')],'type':_0x241b20[_0x0fa7('0x41')][_0x0fa7('0x42')]};});_0x4a745e[_0x0fa7('0x43')]=_[_0x0fa7('0x3e')](_0x5ea251,_0x0fa7('0x3b'));_0x4a745e[_0x0fa7('0x44')]=_['keys'](_0x1947ed['query']);_0x4a745e[_0x0fa7('0x45')]=_[_0x0fa7('0x46')](_0x4a745e[_0x0fa7('0x43')],_0x4a745e['query']);_0x4cf41d[_0x0fa7('0x47')]=_[_0x0fa7('0x46')](_0x4a745e[_0x0fa7('0x43')],qs[_0x0fa7('0x48')](_0x1947ed[_0x0fa7('0x44')][_0x0fa7('0x48')]));_0x4cf41d[_0x0fa7('0x47')]=_0x4cf41d[_0x0fa7('0x47')][_0x0fa7('0x49')]?_0x4cf41d[_0x0fa7('0x47')]:_0x4a745e[_0x0fa7('0x43')];if(!_0x1947ed[_0x0fa7('0x44')][_0x0fa7('0x4a')](_0x0fa7('0x4b'))){_0x4cf41d[_0x0fa7('0x32')]=qs[_0x0fa7('0x32')](_0x1947ed[_0x0fa7('0x44')][_0x0fa7('0x32')]);_0x4cf41d[_0x0fa7('0x31')]=qs[_0x0fa7('0x31')](_0x1947ed[_0x0fa7('0x44')][_0x0fa7('0x31')]);}_0x4cf41d[_0x0fa7('0x4c')]=qs['sort'](_0x1947ed[_0x0fa7('0x44')]['sort']);_0x4cf41d['where']=qs[_0x0fa7('0x45')](_[_0x0fa7('0x4d')](_0x1947ed[_0x0fa7('0x44')],_0x4a745e[_0x0fa7('0x45')]));if(_0x1947ed['query']['filter']){_0x4cf41d[_0x0fa7('0x4e')]=_[_0x0fa7('0x4f')](_0x4cf41d[_0x0fa7('0x4e')],{'$or':_['map'](_0x5ea251,function(_0x3f6bd6){if(_0x3f6bd6['type']!==_0x0fa7('0x50')){var _0xa87247={};_0xa87247[_0x3f6bd6[_0x0fa7('0x3b')]]={'$like':'%'+_0x1947ed[_0x0fa7('0x44')]['filter']+'%'};return _0xa87247;}})});}_0x4cf41d=_[_0x0fa7('0x4f')]({},_0x4cf41d,_0x1947ed[_0x0fa7('0x51')]);var _0x44cb7a={'where':_0x4cf41d[_0x0fa7('0x4e')]};return db[_0x0fa7('0x3f')]['count'](_0x44cb7a)[_0x0fa7('0x52')](function(_0x2f21a0){_0x3fe1bd[_0x0fa7('0x30')]=_0x2f21a0;if(_0x1947ed[_0x0fa7('0x44')][_0x0fa7('0x53')]){_0x4cf41d[_0x0fa7('0x54')]=[{'all':!![]}];}return db[_0x0fa7('0x3f')][_0x0fa7('0x55')](_0x4cf41d);})['then'](function(_0x168a63){_0x3fe1bd[_0x0fa7('0x56')]=_0x168a63;return _0x3fe1bd;})['then'](respondWithFilteredResult(_0x11c006,_0x4cf41d))[_0x0fa7('0x2c')](handleError(_0x11c006,null));};exports['show']=function(_0x1fca73,_0x2bebb1){var _0x3021f6={'raw':!![],'where':{'id':_0x1fca73[_0x0fa7('0x57')]['id']}},_0x3fc3b6={};_0x3fc3b6[_0x0fa7('0x43')]=_[_0x0fa7('0x58')](db[_0x0fa7('0x3f')]['rawAttributes']);_0x3fc3b6['query']=_['keys'](_0x1fca73[_0x0fa7('0x44')]);_0x3fc3b6[_0x0fa7('0x45')]=_[_0x0fa7('0x46')](_0x3fc3b6[_0x0fa7('0x43')],_0x3fc3b6[_0x0fa7('0x44')]);_0x3021f6['attributes']=_['intersection'](_0x3fc3b6['model'],qs[_0x0fa7('0x48')](_0x1fca73[_0x0fa7('0x44')]['fields']));_0x3021f6[_0x0fa7('0x47')]=_0x3021f6[_0x0fa7('0x47')][_0x0fa7('0x49')]?_0x3021f6[_0x0fa7('0x47')]:_0x3fc3b6[_0x0fa7('0x43')];if(_0x1fca73[_0x0fa7('0x44')][_0x0fa7('0x53')]){_0x3021f6[_0x0fa7('0x54')]=[{'all':!![]}];}_0x3021f6=_[_0x0fa7('0x4f')]({},_0x3021f6,_0x1fca73[_0x0fa7('0x51')]);return db[_0x0fa7('0x3f')]['find'](_0x3021f6)['then'](handleEntityNotFound(_0x2bebb1,null))[_0x0fa7('0x52')](respondWithResult(_0x2bebb1,null))[_0x0fa7('0x2c')](handleError(_0x2bebb1,null));};exports[_0x0fa7('0x59')]=function(_0xfda2c8,_0x41fe49){return db[_0x0fa7('0x3f')][_0x0fa7('0x59')](_0xfda2c8[_0x0fa7('0x5a')],{})[_0x0fa7('0x52')](respondWithResult(_0x41fe49,0xc9))['catch'](handleError(_0x41fe49,null));};exports[_0x0fa7('0x38')]=function(_0x319880,_0x3112b3){if(_0x319880['body']['id']){delete _0x319880['body']['id'];}return db['ChatMessage'][_0x0fa7('0x5b')]({'where':{'id':_0x319880[_0x0fa7('0x57')]['id']}})[_0x0fa7('0x52')](handleEntityNotFound(_0x3112b3,null))['then'](saveUpdates(_0x319880[_0x0fa7('0x5a')],null))[_0x0fa7('0x52')](respondWithResult(_0x3112b3,null))['catch'](handleError(_0x3112b3,null));};exports[_0x0fa7('0x39')]=function(_0x52a78c,_0x283877){return db[_0x0fa7('0x3f')][_0x0fa7('0x5b')]({'where':{'id':_0x52a78c[_0x0fa7('0x57')]['id']}})[_0x0fa7('0x52')](handleEntityNotFound(_0x283877,null))[_0x0fa7('0x52')](removeEntity(_0x283877,null))[_0x0fa7('0x2c')](handleError(_0x283877,null));};exports[_0x0fa7('0x5c')]=function(_0x56df59,_0x4a5578){return db[_0x0fa7('0x3f')]['describe']()[_0x0fa7('0x52')](respondWithResult(_0x4a5578,null))[_0x0fa7('0x2c')](handleError(_0x4a5578,null));};var interaction_log=require('../../config/logger')(_0x0fa7('0x5d'));exports['accept']=function(_0x5917b8,_0x48264f,_0x28003f){var _0x4afdca={'channel':_0x0fa7('0x5e')};if(_0x5917b8[_0x0fa7('0x5a')]['id']){delete _0x5917b8[_0x0fa7('0x5a')]['id'];}_0x5917b8[_0x0fa7('0x5a')][_0x0fa7('0x5f')]=!![];_0x5917b8['body'][_0x0fa7('0x60')]=moment()[_0x0fa7('0x61')](_0x0fa7('0x62'));_0x5917b8[_0x0fa7('0x5a')]['UserId']=_0x5917b8[_0x0fa7('0x5a')][_0x0fa7('0x63')]||_0x5917b8['user']['id'];return db[_0x0fa7('0x3f')][_0x0fa7('0x5b')]({'where':{'id':_0x5917b8['params']['id'],'UserId':null},'include':[{'model':db['CmContact'],'as':_0x0fa7('0x64')}]})[_0x0fa7('0x52')](handleEntityNotFound(_0x48264f,null))[_0x0fa7('0x52')](saveUpdates(_0x5917b8[_0x0fa7('0x5a')],null))[_0x0fa7('0x52')](function(_0x53a56f){if(_0x53a56f){_0x4afdca[_0x0fa7('0x2b')]=_0x53a56f['get']({'plain':!![]});return db[_0x0fa7('0x65')][_0x0fa7('0x5b')]({'where':{'id':_0x53a56f['ChatInteractionId']}});}return null;})[_0x0fa7('0x52')](handleEntityNotFound(_0x48264f,null))[_0x0fa7('0x52')](function(_0xfdcb30){if(_0xfdcb30){return _0xfdcb30[_0x0fa7('0x38')]({'UserId':_0x5917b8[_0x0fa7('0x5a')][_0x0fa7('0x63')],'read1stAt':_[_0x0fa7('0x66')](_0xfdcb30[_0x0fa7('0x67')])?moment()[_0x0fa7('0x61')]('YYYY-MM-DD\x20HH:mm:ss'):undefined});}return null;})[_0x0fa7('0x52')](function(_0x9f0618){if(_0x9f0618){_0x4afdca['interaction']=_0x9f0618['get']({'plain':!![]});interaction_log[_0x0fa7('0x23')]('[CHATMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s',_0x5917b8[_0x0fa7('0x68')]['id'],_0x5917b8[_0x0fa7('0x68')]['name'],_0x5917b8[_0x0fa7('0x68')]['role'],_0x4afdca['interaction']['id'],_0x5917b8[_0x0fa7('0x5a')]?JSON[_0x0fa7('0x28')](_0x5917b8[_0x0fa7('0x5a')]):_0x0fa7('0x69'));return respondWithRpcPromise('AcceptMessage','acceptMessage',_0x4afdca);}return null;})[_0x0fa7('0x52')](function(_0x4051a5){if(_0x4051a5){if(_0x5917b8[_0x0fa7('0x5a')][_0x0fa7('0x6a')]){_0x4afdca[_0x0fa7('0x2b')][_0x0fa7('0x6b')]=util['format'](_0x0fa7('0x6c'),_0x5917b8[_0x0fa7('0x68')][_0x0fa7('0x3b')]);_0x4afdca['message']['channel']=_0x4afdca[_0x0fa7('0x6d')];_0x4afdca[_0x0fa7('0x2b')][_0x0fa7('0x6e')]=_0x0fa7('0x6f');return respondWithRpcPromise(_0x0fa7('0x70'),'EventManager',{'event':_0x0fa7('0x71'),'message':_['merge'](_0x4afdca[_0x0fa7('0x2b')],JSON[_0x0fa7('0x72')](_0x4afdca[_0x0fa7('0x73')][_0x0fa7('0x74')]))},client9002)['then'](function(){return _0x4afdca;});}return _0x4afdca;}return null;})[_0x0fa7('0x52')](respondWithResult(_0x48264f,null))[_0x0fa7('0x2c')](handleError(_0x48264f,null));};var interaction_log=require(_0x0fa7('0x14'))(_0x0fa7('0x5d'));exports['reject']=function(_0x2c3578,_0x4e0069,_0x2e789d){var _0x21380f={'agent':{},'channel':_0x0fa7('0x5e')};if(_0x2c3578['body']['id']){delete _0x2c3578['body']['id'];}_0x2c3578[_0x0fa7('0x5a')][_0x0fa7('0x63')]=_0x2c3578[_0x0fa7('0x5a')][_0x0fa7('0x63')]||_0x2c3578['user']['id'];_0x21380f[_0x0fa7('0x75')]['id']=_0x2c3578[_0x0fa7('0x5a')][_0x0fa7('0x63')];return db[_0x0fa7('0x3f')]['find']({'where':{'id':_0x2c3578['params']['id'],'UserId':null}})[_0x0fa7('0x52')](handleEntityNotFound(_0x4e0069,null))[_0x0fa7('0x52')](function(_0x3c15bf){if(_0x3c15bf){_0x21380f[_0x0fa7('0x2b')]=_0x3c15bf[_0x0fa7('0x76')]({'plain':!![]});return db[_0x0fa7('0x65')][_0x0fa7('0x5b')]({'where':{'id':_0x3c15bf[_0x0fa7('0x77')]}});}return null;})[_0x0fa7('0x52')](handleEntityNotFound(_0x4e0069,null))[_0x0fa7('0x52')](function(_0x4ac6c8){if(_0x4ac6c8){_0x21380f[_0x0fa7('0x73')]=_0x4ac6c8[_0x0fa7('0x76')]({'plain':!![]});interaction_log[_0x0fa7('0x23')](_0x0fa7('0x78'),_0x2c3578['user']['id'],_0x2c3578[_0x0fa7('0x68')][_0x0fa7('0x3b')],_0x2c3578[_0x0fa7('0x68')][_0x0fa7('0x79')],_0x21380f[_0x0fa7('0x73')]['id'],_0x2c3578['body']?JSON[_0x0fa7('0x28')](_0x2c3578[_0x0fa7('0x5a')]):'null');return respondWithRpcPromise('RejectMessage','rejectMessage',_0x21380f);}return null;})[_0x0fa7('0x52')](function(_0x352769){if(_0x352769){_0x352769[_0x0fa7('0x2b')][_0x0fa7('0x6b')]=util[_0x0fa7('0x61')](_0x0fa7('0x6c'),_0x2c3578[_0x0fa7('0x68')][_0x0fa7('0x3b')]);_0x352769[_0x0fa7('0x2b')][_0x0fa7('0x6d')]=_0x21380f['channel'];_0x352769[_0x0fa7('0x2b')][_0x0fa7('0x6e')]=_0x0fa7('0x37');respondWithRpcPromise(_0x0fa7('0x70'),_0x0fa7('0x70'),{'event':_0x0fa7('0x7a'),'message':_0x352769[_0x0fa7('0x2b')]},client9002);return _0x21380f;}return null;})[_0x0fa7('0x52')](respondWithResult(_0x4e0069,null))[_0x0fa7('0x2c')](handleError(_0x4e0069,null));}; \ No newline at end of file diff --git a/server/api/chatMessage/chatMessage.events.js b/server/api/chatMessage/chatMessage.events.js index 9fa8f96..68d1d80 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 _0xef42=['exports','../../mysqldb','ChatMessage','save','update','remove','emit','hasOwnProperty','hook'];(function(_0x2cd187,_0x2df9df){var _0x159090=function(_0x2880e6){while(--_0x2880e6){_0x2cd187['push'](_0x2cd187['shift']());}};_0x159090(++_0x2df9df);}(_0xef42,0x145));var _0x2ef4=function(_0x1b3ed9,_0x23c04){_0x1b3ed9=_0x1b3ed9-0x0;var _0x5a8e35=_0xef42[_0x1b3ed9];return _0x5a8e35;};'use strict';var EventEmitter=require('events');var ChatMessage=require(_0x2ef4('0x0'))['db'][_0x2ef4('0x1')];var ChatMessageEvents=new EventEmitter();ChatMessageEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x2ef4('0x2'),'afterUpdate':_0x2ef4('0x3'),'afterDestroy':_0x2ef4('0x4')};function emitEvent(_0x21ad0a){return function(_0x2be157,_0x36f938,_0x3a43b8){ChatMessageEvents['emit'](_0x21ad0a+':'+_0x2be157['id'],_0x2be157);ChatMessageEvents[_0x2ef4('0x5')](_0x21ad0a,_0x2be157);_0x3a43b8(null);};}for(var e in events){if(events[_0x2ef4('0x6')](e)){var event=events[e];ChatMessage[_0x2ef4('0x7')](e,emitEvent(event));}}module[_0x2ef4('0x8')]=ChatMessageEvents; \ No newline at end of file +var _0xb9c6=['emit','hasOwnProperty','exports','setMaxListeners','save','update'];(function(_0x5e4241,_0x298d4f){var _0x1b2f68=function(_0x1191f9){while(--_0x1191f9){_0x5e4241['push'](_0x5e4241['shift']());}};_0x1b2f68(++_0x298d4f);}(_0xb9c6,0x1b3));var _0x6b9c=function(_0x3a08e3,_0x6812cb){_0x3a08e3=_0x3a08e3-0x0;var _0xb2d69e=_0xb9c6[_0x3a08e3];return _0xb2d69e;};'use strict';var EventEmitter=require('events');var ChatMessage=require('../../mysqldb')['db']['ChatMessage'];var ChatMessageEvents=new EventEmitter();ChatMessageEvents[_0x6b9c('0x0')](0x0);var events={'afterCreate':_0x6b9c('0x1'),'afterUpdate':_0x6b9c('0x2'),'afterDestroy':'remove'};function emitEvent(_0x47c4f6){return function(_0xe54705,_0xcf0e49,_0x2c77e6){ChatMessageEvents[_0x6b9c('0x3')](_0x47c4f6+':'+_0xe54705['id'],_0xe54705);ChatMessageEvents[_0x6b9c('0x3')](_0x47c4f6,_0xe54705);_0x2c77e6(null);};}for(var e in events){if(events[_0x6b9c('0x4')](e)){var event=events[e];ChatMessage['hook'](e,emitEvent(event));}}module[_0x6b9c('0x5')]=ChatMessageEvents; \ No newline at end of file diff --git a/server/api/chatMessage/chatMessage.model.js b/server/api/chatMessage/chatMessage.model.js index 20df621..e9cc859 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 _0x78d1=['UserId','ChatInteraction','findOne','ChatInteractionId','then','update','catch','error','utf8mb4','utf8mb4_unicode_ci','lodash','api','moment','bluebird','request-promise','rimraf','../../config/environment','./chatMessage.attributes','exports','ChatMessage','fti_chat_messages','body','FULLTEXT','models','get','toLowerCase','out','secret'];(function(_0x5d32dd,_0x445e6e){var _0x12acf1=function(_0x5669e1){while(--_0x5669e1){_0x5d32dd['push'](_0x5d32dd['shift']());}};_0x12acf1(++_0x445e6e);}(_0x78d1,0xb2));var _0x178d=function(_0x49deab,_0x3f6da2){_0x49deab=_0x49deab-0x0;var _0x5e5bdb=_0x78d1[_0x49deab];return _0x5e5bdb;};'use strict';var _=require(_0x178d('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x178d('0x1'));var moment=require(_0x178d('0x2'));var BPromise=require(_0x178d('0x3'));var rp=require(_0x178d('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x178d('0x5'));var config=require(_0x178d('0x6'));var attributes=require(_0x178d('0x7'));module[_0x178d('0x8')]=function(_0x1e61a2,_0x120c22){return _0x1e61a2['define'](_0x178d('0x9'),attributes,{'tableName':'chat_messages','paranoid':![],'indexes':[{'name':_0x178d('0xa'),'fields':[_0x178d('0xb')],'type':_0x178d('0xc')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x35fe89,_0x441cb1,_0x409ce3){var _0x5f1ef2=_0x1e61a2[_0x178d('0xd')];var _0x5e079f=_0x35fe89[_0x178d('0xe')]({'plain':!![]});if(_0x5e079f['direction'][_0x178d('0xf')]()==='in'||_0x5e079f['direction'][_0x178d('0xf')]()===_0x178d('0x10')&&!_0x5e079f[_0x178d('0x11')]&&!_['isNil'](_0x5e079f[_0x178d('0x12')])){_0x5f1ef2[_0x178d('0x13')][_0x178d('0x14')]({'where':{'id':_0x5e079f[_0x178d('0x15')]}})[_0x178d('0x16')](function(_0x3bf326){if(_0x3bf326){_0x3bf326[_0x178d('0x17')]({'lastMsgAt':_0x5e079f['createdAt'],'lastMsgDirection':_0x5e079f['direction'][_0x178d('0xf')]()});}})[_0x178d('0x18')](function(_0x224bdc){console[_0x178d('0x19')](_0x224bdc);});}_0x409ce3();}},'charset':_0x178d('0x1a'),'collate':_0x178d('0x1b')});}; \ No newline at end of file +var _0xdc4c=['ChatInteraction','findOne','ChatInteractionId','update','createdAt','catch','utf8mb4_unicode_ci','lodash','util','moment','bluebird','request-promise','../../config/environment','./chatMessage.attributes','exports','define','ChatMessage','chat_messages','fti_chat_messages','body','FULLTEXT','models','get','direction','toLowerCase','out','secret','UserId'];(function(_0x1d39f6,_0x146f4a){var _0x3dbd7a=function(_0x4486f2){while(--_0x4486f2){_0x1d39f6['push'](_0x1d39f6['shift']());}};_0x3dbd7a(++_0x146f4a);}(_0xdc4c,0xe7));var _0xcdc4=function(_0x30f3a1,_0x560b74){_0x30f3a1=_0x30f3a1-0x0;var _0x4b2e3e=_0xdc4c[_0x30f3a1];return _0x4b2e3e;};'use strict';var _=require(_0xcdc4('0x0'));var util=require(_0xcdc4('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0xcdc4('0x2'));var BPromise=require(_0xcdc4('0x3'));var rp=require(_0xcdc4('0x4'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0xcdc4('0x5'));var attributes=require(_0xcdc4('0x6'));module[_0xcdc4('0x7')]=function(_0x590d7f,_0x2423c1){return _0x590d7f[_0xcdc4('0x8')](_0xcdc4('0x9'),attributes,{'tableName':_0xcdc4('0xa'),'paranoid':![],'indexes':[{'name':_0xcdc4('0xb'),'fields':[_0xcdc4('0xc')],'type':_0xcdc4('0xd')}],'timestamps':!![],'hooks':{'afterCreate':function(_0xd79e92,_0x42f35b,_0x91a854){var _0x1b0080=_0x590d7f[_0xcdc4('0xe')];var _0x185959=_0xd79e92[_0xcdc4('0xf')]({'plain':!![]});if(_0x185959[_0xcdc4('0x10')][_0xcdc4('0x11')]()==='in'||_0x185959['direction']['toLowerCase']()===_0xcdc4('0x12')&&!_0x185959[_0xcdc4('0x13')]&&!_['isNil'](_0x185959[_0xcdc4('0x14')])){_0x1b0080[_0xcdc4('0x15')][_0xcdc4('0x16')]({'where':{'id':_0x185959[_0xcdc4('0x17')]}})['then'](function(_0x1c2e16){if(_0x1c2e16){_0x1c2e16[_0xcdc4('0x18')]({'lastMsgAt':_0x185959[_0xcdc4('0x19')],'lastMsgDirection':_0x185959['direction']['toLowerCase']()});}})[_0xcdc4('0x1a')](function(_0x49d91a){console['error'](_0x49d91a);});}_0x91a854();}},'charset':'utf8mb4','collate':_0xcdc4('0x1b')});}; \ No newline at end of file diff --git a/server/api/chatMessage/chatMessage.rpc.js b/server/api/chatMessage/chatMessage.rpc.js index 5a163f9..080492b 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 _0x3287=['register','then','info','ChatMessage,\x20%s,\x20%s','request\x20sent','stringify','error','message','result','catch','ChatMessage','create','body','options','raw','CreateChatMessage','debug','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','./chatMessage.socket'];(function(_0x1f34cb,_0x2f3b0e){var _0x2338f2=function(_0x758ce0){while(--_0x758ce0){_0x1f34cb['push'](_0x1f34cb['shift']());}};_0x2338f2(++_0x2f3b0e);}(_0x3287,0x99));var _0x7328=function(_0xaba160,_0x3b3734){_0xaba160=_0xaba160-0x0;var _0xd93146=_0x3287[_0xaba160];return _0xd93146;};'use strict';var _=require(_0x7328('0x0'));var util=require(_0x7328('0x1'));var moment=require(_0x7328('0x2'));var BPromise=require(_0x7328('0x3'));var rs=require(_0x7328('0x4'));var fs=require('fs');var Redis=require(_0x7328('0x5'));var db=require(_0x7328('0x6'))['db'];var utils=require(_0x7328('0x7'));var logger=require('../../config/logger')(_0x7328('0x8'));var config=require(_0x7328('0x9'));var jayson=require(_0x7328('0xa'));var client=jayson[_0x7328('0xb')][_0x7328('0xc')]({'port':0x232a});config[_0x7328('0xd')]=_[_0x7328('0xe')](config[_0x7328('0xd')],{'host':_0x7328('0xf'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0x7328('0x10'))[_0x7328('0x11')](socket);function respondWithRpcPromise(_0x541f08,_0x36cf51,_0x4f4bcc){return new BPromise(function(_0x8fad2a,_0xc0f327){return client['request'](_0x541f08,_0x4f4bcc)[_0x7328('0x12')](function(_0x171558){logger[_0x7328('0x13')](_0x7328('0x14'),_0x36cf51,_0x7328('0x15'));logger['debug']('ChatMessage,\x20%s,\x20%s,\x20%s',_0x36cf51,_0x7328('0x15'),JSON[_0x7328('0x16')](_0x171558));if(_0x171558[_0x7328('0x17')]){if(_0x171558[_0x7328('0x17')]['code']===0x1f4){logger[_0x7328('0x17')](_0x7328('0x14'),_0x36cf51,_0x171558[_0x7328('0x17')][_0x7328('0x18')]);return _0xc0f327(_0x171558['error'][_0x7328('0x18')]);}logger[_0x7328('0x17')](_0x7328('0x14'),_0x36cf51,_0x171558[_0x7328('0x17')][_0x7328('0x18')]);return _0x8fad2a(_0x171558[_0x7328('0x17')][_0x7328('0x18')]);}else{logger['info']('ChatMessage,\x20%s,\x20%s',_0x36cf51,_0x7328('0x15'));_0x8fad2a(_0x171558[_0x7328('0x19')]['message']);}})[_0x7328('0x1a')](function(_0x313279){logger[_0x7328('0x17')](_0x7328('0x14'),_0x36cf51,_0x313279);_0xc0f327(_0x313279);});});}exports['CreateChatMessage']=function(_0xb50952){var _0x2f5a6d=this;return new Promise(function(_0x1eafde,_0x387cbc){return db[_0x7328('0x1b')][_0x7328('0x1c')](_0xb50952[_0x7328('0x1d')],{'raw':_0xb50952[_0x7328('0x1e')]?_0xb50952[_0x7328('0x1e')][_0x7328('0x1f')]===undefined?!![]:![]:!![]})[_0x7328('0x12')](function(_0x588de){logger[_0x7328('0x13')](_0x7328('0x20'),_0xb50952);logger[_0x7328('0x21')](_0x7328('0x20'),_0xb50952,JSON[_0x7328('0x16')](_0x588de));_0x1eafde(_0x588de);})[_0x7328('0x1a')](function(_0x117007){logger[_0x7328('0x17')](_0x7328('0x20'),_0x117007['message'],_0xb50952);_0x387cbc(_0x2f5a6d[_0x7328('0x17')](0x1f4,_0x117007[_0x7328('0x18')]));});});}; \ No newline at end of file +var _0xe7f7=['defaults','localhost','socket.io-emitter','register','request','then','info','request\x20sent','debug','ChatMessage,\x20%s,\x20%s,\x20%s','stringify','code','error','ChatMessage,\x20%s,\x20%s','message','result','catch','CreateChatMessage','ChatMessage','create','body','options','moment','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','redis'];(function(_0x5d85ec,_0x4f6f1c){var _0xa01f0d=function(_0x2686fd){while(--_0x2686fd){_0x5d85ec['push'](_0x5d85ec['shift']());}};_0xa01f0d(++_0x4f6f1c);}(_0xe7f7,0x156));var _0x7e7f=function(_0x4e4f0e,_0x1c3892){_0x4e4f0e=_0x4e4f0e-0x0;var _0x1a7219=_0xe7f7[_0x4e4f0e];return _0x1a7219;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x7e7f('0x0'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x7e7f('0x1'));var db=require(_0x7e7f('0x2'))['db'];var utils=require(_0x7e7f('0x3'));var logger=require(_0x7e7f('0x4'))(_0x7e7f('0x5'));var config=require(_0x7e7f('0x6'));var jayson=require(_0x7e7f('0x7'));var client=jayson[_0x7e7f('0x8')]['http']({'port':0x232a});config[_0x7e7f('0x9')]=_[_0x7e7f('0xa')](config[_0x7e7f('0x9')],{'host':_0x7e7f('0xb'),'port':0x18eb});var socket=require(_0x7e7f('0xc'))(new Redis(config[_0x7e7f('0x9')]));require('./chatMessage.socket')[_0x7e7f('0xd')](socket);function respondWithRpcPromise(_0x3f71f7,_0x146c8a,_0x4c4650){return new BPromise(function(_0x1023fb,_0x26f7f2){return client[_0x7e7f('0xe')](_0x3f71f7,_0x4c4650)[_0x7e7f('0xf')](function(_0x1890d7){logger[_0x7e7f('0x10')]('ChatMessage,\x20%s,\x20%s',_0x146c8a,_0x7e7f('0x11'));logger[_0x7e7f('0x12')](_0x7e7f('0x13'),_0x146c8a,_0x7e7f('0x11'),JSON[_0x7e7f('0x14')](_0x1890d7));if(_0x1890d7['error']){if(_0x1890d7['error'][_0x7e7f('0x15')]===0x1f4){logger[_0x7e7f('0x16')](_0x7e7f('0x17'),_0x146c8a,_0x1890d7[_0x7e7f('0x16')][_0x7e7f('0x18')]);return _0x26f7f2(_0x1890d7[_0x7e7f('0x16')][_0x7e7f('0x18')]);}logger['error'](_0x7e7f('0x17'),_0x146c8a,_0x1890d7[_0x7e7f('0x16')][_0x7e7f('0x18')]);return _0x1023fb(_0x1890d7['error']['message']);}else{logger[_0x7e7f('0x10')](_0x7e7f('0x17'),_0x146c8a,_0x7e7f('0x11'));_0x1023fb(_0x1890d7[_0x7e7f('0x19')][_0x7e7f('0x18')]);}})[_0x7e7f('0x1a')](function(_0x86cac2){logger[_0x7e7f('0x16')](_0x7e7f('0x17'),_0x146c8a,_0x86cac2);_0x26f7f2(_0x86cac2);});});}exports[_0x7e7f('0x1b')]=function(_0x14f679){var _0x7eccef=this;return new Promise(function(_0x536f7a,_0x429d04){return db[_0x7e7f('0x1c')][_0x7e7f('0x1d')](_0x14f679[_0x7e7f('0x1e')],{'raw':_0x14f679[_0x7e7f('0x1f')]?_0x14f679['options']['raw']===undefined?!![]:![]:!![]})['then'](function(_0x227190){logger['info']('CreateChatMessage',_0x14f679);logger[_0x7e7f('0x12')](_0x7e7f('0x1b'),_0x14f679,JSON[_0x7e7f('0x14')](_0x227190));_0x536f7a(_0x227190);})[_0x7e7f('0x1a')](function(_0x1256bb){logger['error'](_0x7e7f('0x1b'),_0x1256bb['message'],_0x14f679);_0x429d04(_0x7eccef[_0x7e7f('0x16')](0x1f4,_0x1256bb[_0x7e7f('0x18')]));});});}; \ No newline at end of file diff --git a/server/api/chatMessage/chatMessage.socket.js b/server/api/chatMessage/chatMessage.socket.js index e51d437..6ad5aed 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 _0xacf4=['removeListener','register','length','remove','update','emit'];(function(_0x58965a,_0x2e71db){var _0x254efc=function(_0xf14fb4){while(--_0xf14fb4){_0x58965a['push'](_0x58965a['shift']());}};_0x254efc(++_0x2e71db);}(_0xacf4,0xe7));var _0x4acf=function(_0x128a73,_0x26c676){_0x128a73=_0x128a73-0x0;var _0x210caa=_0xacf4[_0x128a73];return _0x210caa;};'use strict';var ChatMessageEvents=require('./chatMessage.events');var events=['save',_0x4acf('0x0'),_0x4acf('0x1')];function createListener(_0x1e2413,_0x21fb75){return function(_0x25709c){_0x21fb75[_0x4acf('0x2')](_0x1e2413,_0x25709c);};}function removeListener(_0x145264,_0x5cf22d){return function(){ChatMessageEvents[_0x4acf('0x3')](_0x145264,_0x5cf22d);};}exports[_0x4acf('0x4')]=function(_0x4e0c43){for(var _0x24bf24=0x0,_0x2ba08a=events[_0x4acf('0x5')];_0x24bf24<_0x2ba08a;_0x24bf24++){var _0x45a5a4=events[_0x24bf24];var _0x25d345=createListener('chatMessage:'+_0x45a5a4,_0x4e0c43);ChatMessageEvents['on'](_0x45a5a4,_0x25d345);}}; \ No newline at end of file +var _0xc6ac=['removeListener','register','length','./chatMessage.events','save','remove','update','emit'];(function(_0x51dbe2,_0x4176e8){var _0x3ff3f9=function(_0x204c7d){while(--_0x204c7d){_0x51dbe2['push'](_0x51dbe2['shift']());}};_0x3ff3f9(++_0x4176e8);}(_0xc6ac,0x15b));var _0xcc6a=function(_0x2fed8a,_0x49339d){_0x2fed8a=_0x2fed8a-0x0;var _0x2a9783=_0xc6ac[_0x2fed8a];return _0x2a9783;};'use strict';var ChatMessageEvents=require(_0xcc6a('0x0'));var events=[_0xcc6a('0x1'),_0xcc6a('0x2'),_0xcc6a('0x3')];function createListener(_0x276972,_0x279d85){return function(_0x17d786){_0x279d85[_0xcc6a('0x4')](_0x276972,_0x17d786);};}function removeListener(_0x297643,_0x22ee99){return function(){ChatMessageEvents[_0xcc6a('0x5')](_0x297643,_0x22ee99);};}exports[_0xcc6a('0x6')]=function(_0x12330e){for(var _0x197bd7=0x0,_0x5f3887=events[_0xcc6a('0x7')];_0x197bd7<_0x5f3887;_0x197bd7++){var _0x11b919=events[_0x197bd7];var _0xf02261=createListener('chatMessage:'+_0x11b919,_0x12330e);ChatMessageEvents['on'](_0x11b919,_0xf02261);}}; \ No newline at end of file diff --git a/server/api/chatMessage/index.js b/server/api/chatMessage/index.js index d599d32..a4e5e21 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 _0x2482=['get','isAuthenticated','index','/describe','describe','/:id','show','post','tracked','chat','chatmessage:create','create','put','/:id/accept','accept','/:id/reject','reject','delete','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./chatMessage.controller'];(function(_0x2b18e5,_0x1a141c){var _0x12e52c=function(_0x27ea16){while(--_0x27ea16){_0x2b18e5['push'](_0x2b18e5['shift']());}};_0x12e52c(++_0x1a141c);}(_0x2482,0x16f));var _0x2248=function(_0x16337a,_0x4789a1){_0x16337a=_0x16337a-0x0;var _0x422365=_0x2482[_0x16337a];return _0x422365;};'use strict';var multer=require(_0x2248('0x0'));var util=require(_0x2248('0x1'));var path=require(_0x2248('0x2'));var timeout=require(_0x2248('0x3'));var express=require(_0x2248('0x4'));var router=express[_0x2248('0x5')]();var auth=require(_0x2248('0x6'));var interaction=require(_0x2248('0x7'));var config=require(_0x2248('0x8'));var controller=require(_0x2248('0x9'));router[_0x2248('0xa')]('/',auth[_0x2248('0xb')](),controller[_0x2248('0xc')]);router[_0x2248('0xa')](_0x2248('0xd'),auth['isAuthenticated'](),controller[_0x2248('0xe')]);router[_0x2248('0xa')](_0x2248('0xf'),auth[_0x2248('0xb')](),controller[_0x2248('0x10')]);router[_0x2248('0x11')]('/',auth[_0x2248('0xb')](),interaction[_0x2248('0x12')](_0x2248('0x13'),_0x2248('0x14')),controller[_0x2248('0x15')]);router[_0x2248('0x16')](_0x2248('0xf'),controller['update']);router[_0x2248('0x16')](_0x2248('0x17'),auth[_0x2248('0xb')](),controller[_0x2248('0x18')]);router[_0x2248('0x16')](_0x2248('0x19'),auth[_0x2248('0xb')](),controller[_0x2248('0x1a')]);router[_0x2248('0x1b')](_0x2248('0xf'),auth['isAuthenticated'](),controller['destroy']);module[_0x2248('0x1c')]=router; \ No newline at end of file +var _0x5c4e=['tracked','chat','chatmessage:create','create','put','/:id/reject','reject','delete','exports','multer','util','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./chatMessage.controller','get','isAuthenticated','index','/describe','describe','/:id','show','post'];(function(_0x3c007e,_0x2e6adc){var _0x851f31=function(_0x12bf84){while(--_0x12bf84){_0x3c007e['push'](_0x3c007e['shift']());}};_0x851f31(++_0x2e6adc);}(_0x5c4e,0xea));var _0xe5c4=function(_0x8db3f2,_0x1703ae){_0x8db3f2=_0x8db3f2-0x0;var _0x520aa3=_0x5c4e[_0x8db3f2];return _0x520aa3;};'use strict';var multer=require(_0xe5c4('0x0'));var util=require(_0xe5c4('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0xe5c4('0x2'));var router=express[_0xe5c4('0x3')]();var auth=require(_0xe5c4('0x4'));var interaction=require(_0xe5c4('0x5'));var config=require(_0xe5c4('0x6'));var controller=require(_0xe5c4('0x7'));router[_0xe5c4('0x8')]('/',auth[_0xe5c4('0x9')](),controller[_0xe5c4('0xa')]);router[_0xe5c4('0x8')](_0xe5c4('0xb'),auth[_0xe5c4('0x9')](),controller[_0xe5c4('0xc')]);router[_0xe5c4('0x8')](_0xe5c4('0xd'),auth[_0xe5c4('0x9')](),controller[_0xe5c4('0xe')]);router[_0xe5c4('0xf')]('/',auth['isAuthenticated'](),interaction[_0xe5c4('0x10')](_0xe5c4('0x11'),_0xe5c4('0x12')),controller[_0xe5c4('0x13')]);router[_0xe5c4('0x14')](_0xe5c4('0xd'),controller['update']);router[_0xe5c4('0x14')]('/:id/accept',auth[_0xe5c4('0x9')](),controller['accept']);router[_0xe5c4('0x14')](_0xe5c4('0x15'),auth[_0xe5c4('0x9')](),controller[_0xe5c4('0x16')]);router[_0xe5c4('0x17')](_0xe5c4('0xd'),auth[_0xe5c4('0x9')](),controller['destroy']);module[_0xe5c4('0x18')]=router; \ No newline at end of file diff --git a/server/api/chatOfflineMessage/chatOfflineMessage.attributes.js b/server/api/chatOfflineMessage/chatOfflineMessage.attributes.js index 2a84f74..242b7d4 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 _0xdb01=['medium','sequelize'];(function(_0x1e0369,_0x5a88c0){var _0x1420ba=function(_0x1055a5){while(--_0x1055a5){_0x1e0369['push'](_0x1e0369['shift']());}};_0x1420ba(++_0x5a88c0);}(_0xdb01,0xa1));var _0x1db0=function(_0x2dce9f,_0x1d1880){_0x2dce9f=_0x2dce9f-0x0;var _0x1cd454=_0xdb01[_0x2dce9f];return _0x1cd454;};'use strict';var Sequelize=require(_0x1db0('0x0'));module['exports']={'body':{'type':Sequelize['TEXT'](_0x1db0('0x1')),'allowNull':![]}}; \ No newline at end of file +var _0x6d11=['TEXT','medium','exports'];(function(_0x3c4a7c,_0x2f4e3c){var _0xf13d1e=function(_0x24cb78){while(--_0x24cb78){_0x3c4a7c['push'](_0x3c4a7c['shift']());}};_0xf13d1e(++_0x2f4e3c);}(_0x6d11,0xf8));var _0x16d1=function(_0x35b440,_0x166ad1){_0x35b440=_0x35b440-0x0;var _0x585180=_0x6d11[_0x35b440];return _0x585180;};'use strict';var Sequelize=require('sequelize');module[_0x16d1('0x0')]={'body':{'type':Sequelize[_0x16d1('0x1')](_0x16d1('0x2')),'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/chatOfflineMessage/chatOfflineMessage.controller.js b/server/api/chatOfflineMessage/chatOfflineMessage.controller.js index f175193..e6b5a7f 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 _0xd1f8=['attributes','hasOwnProperty','nolimit','sort','where','pick','type','VIRTUAL','options','ChatOfflineMessage','includeAll','include','rows','catch','show','length','find','create','body','params','describe','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','path','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','status','end','json','count','offset','limit','set','reject','save','update','then','destroy','sendStatus','error','stack','name','send','index','map','rawAttributes','key','keys','query','filters','intersection','model','fields'];(function(_0x1f70aa,_0x48e565){var _0x10a938=function(_0x5af55f){while(--_0x5af55f){_0x1f70aa['push'](_0x1f70aa['shift']());}};_0x10a938(++_0x48e565);}(_0xd1f8,0x139));var _0x8d1f=function(_0x39fd11,_0x5d7883){_0x39fd11=_0x39fd11-0x0;var _0x302799=_0xd1f8[_0x39fd11];return _0x302799;};'use strict';var pdf=require(_0x8d1f('0x0'));var emlformat=require(_0x8d1f('0x1'));var rimraf=require(_0x8d1f('0x2'));var zipdir=require(_0x8d1f('0x3'));var jsonpatch=require(_0x8d1f('0x4'));var rp=require(_0x8d1f('0x5'));var moment=require(_0x8d1f('0x6'));var BPromise=require('bluebird');var Mustache=require(_0x8d1f('0x7'));var util=require('util');var path=require(_0x8d1f('0x8'));var sox=require('sox');var csv=require(_0x8d1f('0x9'));var ejs=require(_0x8d1f('0xa'));var fs=require('fs');var _=require(_0x8d1f('0xb'));var squel=require(_0x8d1f('0xc'));var crypto=require(_0x8d1f('0xd'));var jsforce=require(_0x8d1f('0xe'));var deskjs=require(_0x8d1f('0xf'));var toCsv=require(_0x8d1f('0x9'));var querystring=require(_0x8d1f('0x10'));var Papa=require(_0x8d1f('0x11'));var Redis=require('ioredis');var authService=require(_0x8d1f('0x12'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x8d1f('0x13'));var logger=require(_0x8d1f('0x14'))(_0x8d1f('0x15'));var utils=require(_0x8d1f('0x16'));var config=require(_0x8d1f('0x17'));var db=require(_0x8d1f('0x18'))['db'];function respondWithStatusCode(_0x495114,_0x5075f7){_0x5075f7=_0x5075f7||0xcc;return function(_0x538a37){if(_0x538a37){return _0x495114['sendStatus'](_0x5075f7);}return _0x495114[_0x8d1f('0x19')](_0x5075f7)[_0x8d1f('0x1a')]();};}function respondWithResult(_0x5d2567,_0xc5bf9b){_0xc5bf9b=_0xc5bf9b||0xc8;return function(_0x265f25){if(_0x265f25){return _0x5d2567[_0x8d1f('0x19')](_0xc5bf9b)[_0x8d1f('0x1b')](_0x265f25);}};}function respondWithFilteredResult(_0x4f4140,_0x1de57e){return function(_0x21689f){if(_0x21689f){var _0x38d40d=_0x21689f[_0x8d1f('0x1c')],_0x3ade86=_0x1de57e[_0x8d1f('0x1d')],_0x1f5fe3=_0x1de57e[_0x8d1f('0x1d')]+_0x1de57e[_0x8d1f('0x1e')],_0x2dd10c;if(_0x1f5fe3>=_0x38d40d){_0x1f5fe3=_0x38d40d;_0x2dd10c=0xc8;}else{_0x2dd10c=0xce;}_0x4f4140['status'](_0x2dd10c);return _0x4f4140[_0x8d1f('0x1f')]('Content-Range',_0x3ade86+'-'+_0x1f5fe3+'/'+_0x38d40d)[_0x8d1f('0x1b')](_0x21689f);}return null;};}function patchUpdates(_0x4c9323){return function(_0x10979d){try{jsonpatch['apply'](_0x10979d,_0x4c9323,!![]);}catch(_0x17be83){return BPromise[_0x8d1f('0x20')](_0x17be83);}return _0x10979d[_0x8d1f('0x21')]();};}function saveUpdates(_0x4d3717,_0xe5707e){return function(_0xef8e86){if(_0xef8e86){return _0xef8e86[_0x8d1f('0x22')](_0x4d3717)[_0x8d1f('0x23')](function(_0x4b1df4){return _0x4b1df4;});}return null;};}function removeEntity(_0x2c5118,_0xd4890d){return function(_0x55fd40){if(_0x55fd40){return _0x55fd40[_0x8d1f('0x24')]()[_0x8d1f('0x23')](function(){_0x2c5118[_0x8d1f('0x19')](0xcc)[_0x8d1f('0x1a')]();});}};}function handleEntityNotFound(_0x3a4fd0,_0x5efbec){return function(_0x3f4d9c){if(!_0x3f4d9c){_0x3a4fd0[_0x8d1f('0x25')](0x194);}return _0x3f4d9c;};}function handleError(_0x5bc1a1,_0x12377f){_0x12377f=_0x12377f||0x1f4;return function(_0x46a4f2){logger[_0x8d1f('0x26')](_0x46a4f2[_0x8d1f('0x27')]);if(_0x46a4f2[_0x8d1f('0x28')]){delete _0x46a4f2['name'];}_0x5bc1a1[_0x8d1f('0x19')](_0x12377f)[_0x8d1f('0x29')](_0x46a4f2);};}exports[_0x8d1f('0x2a')]=function(_0x3c2607,_0x1e6b57){var _0x1efa63={},_0x420d30={},_0x502e8d={'count':0x0,'rows':[]};var _0x4aba8e=_[_0x8d1f('0x2b')](db['ChatOfflineMessage'][_0x8d1f('0x2c')],function(_0x651c7b){return{'name':_0x651c7b['fieldName'],'type':_0x651c7b['type'][_0x8d1f('0x2d')]};});_0x420d30['model']=_[_0x8d1f('0x2b')](_0x4aba8e,_0x8d1f('0x28'));_0x420d30['query']=_[_0x8d1f('0x2e')](_0x3c2607[_0x8d1f('0x2f')]);_0x420d30[_0x8d1f('0x30')]=_[_0x8d1f('0x31')](_0x420d30[_0x8d1f('0x32')],_0x420d30[_0x8d1f('0x2f')]);_0x1efa63['attributes']=_[_0x8d1f('0x31')](_0x420d30[_0x8d1f('0x32')],qs['fields'](_0x3c2607[_0x8d1f('0x2f')][_0x8d1f('0x33')]));_0x1efa63[_0x8d1f('0x34')]=_0x1efa63[_0x8d1f('0x34')]['length']?_0x1efa63[_0x8d1f('0x34')]:_0x420d30[_0x8d1f('0x32')];if(!_0x3c2607[_0x8d1f('0x2f')][_0x8d1f('0x35')](_0x8d1f('0x36'))){_0x1efa63[_0x8d1f('0x1e')]=qs[_0x8d1f('0x1e')](_0x3c2607[_0x8d1f('0x2f')][_0x8d1f('0x1e')]);_0x1efa63[_0x8d1f('0x1d')]=qs['offset'](_0x3c2607[_0x8d1f('0x2f')][_0x8d1f('0x1d')]);}_0x1efa63['order']=qs[_0x8d1f('0x37')](_0x3c2607[_0x8d1f('0x2f')][_0x8d1f('0x37')]);_0x1efa63[_0x8d1f('0x38')]=qs[_0x8d1f('0x30')](_[_0x8d1f('0x39')](_0x3c2607[_0x8d1f('0x2f')],_0x420d30[_0x8d1f('0x30')]));if(_0x3c2607['query']['filter']){_0x1efa63[_0x8d1f('0x38')]=_['merge'](_0x1efa63['where'],{'$or':_['map'](_0x4aba8e,function(_0x50e207){if(_0x50e207[_0x8d1f('0x3a')]!==_0x8d1f('0x3b')){var _0x4e75d2={};_0x4e75d2[_0x50e207[_0x8d1f('0x28')]]={'$like':'%'+_0x3c2607[_0x8d1f('0x2f')]['filter']+'%'};return _0x4e75d2;}})});}_0x1efa63=_['merge']({},_0x1efa63,_0x3c2607[_0x8d1f('0x3c')]);var _0x11aa3d={'where':_0x1efa63[_0x8d1f('0x38')]};return db[_0x8d1f('0x3d')][_0x8d1f('0x1c')](_0x11aa3d)[_0x8d1f('0x23')](function(_0xe3b48e){_0x502e8d[_0x8d1f('0x1c')]=_0xe3b48e;if(_0x3c2607[_0x8d1f('0x2f')][_0x8d1f('0x3e')]){_0x1efa63[_0x8d1f('0x3f')]=[{'all':!![]}];}return db[_0x8d1f('0x3d')]['findAll'](_0x1efa63);})['then'](function(_0x2f1308){_0x502e8d[_0x8d1f('0x40')]=_0x2f1308;return _0x502e8d;})[_0x8d1f('0x23')](respondWithFilteredResult(_0x1e6b57,_0x1efa63))[_0x8d1f('0x41')](handleError(_0x1e6b57,null));};exports[_0x8d1f('0x42')]=function(_0x316036,_0x2b0b85){var _0x4a9d8a={'raw':!![],'where':{'id':_0x316036['params']['id']}},_0x42bfde={};_0x42bfde['model']=_['keys'](db[_0x8d1f('0x3d')][_0x8d1f('0x2c')]);_0x42bfde[_0x8d1f('0x2f')]=_[_0x8d1f('0x2e')](_0x316036['query']);_0x42bfde['filters']=_['intersection'](_0x42bfde['model'],_0x42bfde[_0x8d1f('0x2f')]);_0x4a9d8a[_0x8d1f('0x34')]=_[_0x8d1f('0x31')](_0x42bfde[_0x8d1f('0x32')],qs[_0x8d1f('0x33')](_0x316036[_0x8d1f('0x2f')][_0x8d1f('0x33')]));_0x4a9d8a[_0x8d1f('0x34')]=_0x4a9d8a[_0x8d1f('0x34')][_0x8d1f('0x43')]?_0x4a9d8a[_0x8d1f('0x34')]:_0x42bfde[_0x8d1f('0x32')];if(_0x316036[_0x8d1f('0x2f')][_0x8d1f('0x3e')]){_0x4a9d8a[_0x8d1f('0x3f')]=[{'all':!![]}];}_0x4a9d8a=_['merge']({},_0x4a9d8a,_0x316036['options']);return db[_0x8d1f('0x3d')][_0x8d1f('0x44')](_0x4a9d8a)[_0x8d1f('0x23')](handleEntityNotFound(_0x2b0b85,null))[_0x8d1f('0x23')](respondWithResult(_0x2b0b85,null))[_0x8d1f('0x41')](handleError(_0x2b0b85,null));};exports[_0x8d1f('0x45')]=function(_0x3ff932,_0xec31c9){return db['ChatOfflineMessage'][_0x8d1f('0x45')](_0x3ff932[_0x8d1f('0x46')],{})[_0x8d1f('0x23')](respondWithResult(_0xec31c9,0xc9))[_0x8d1f('0x41')](handleError(_0xec31c9,null));};exports['update']=function(_0x1df76d,_0x5942c1){if(_0x1df76d[_0x8d1f('0x46')]['id']){delete _0x1df76d[_0x8d1f('0x46')]['id'];}return db[_0x8d1f('0x3d')]['find']({'where':{'id':_0x1df76d[_0x8d1f('0x47')]['id']}})[_0x8d1f('0x23')](handleEntityNotFound(_0x5942c1,null))['then'](saveUpdates(_0x1df76d[_0x8d1f('0x46')],null))['then'](respondWithResult(_0x5942c1,null))['catch'](handleError(_0x5942c1,null));};exports[_0x8d1f('0x24')]=function(_0x5a48b3,_0x2cc1b7){return db[_0x8d1f('0x3d')][_0x8d1f('0x44')]({'where':{'id':_0x5a48b3['params']['id']}})[_0x8d1f('0x23')](handleEntityNotFound(_0x2cc1b7,null))[_0x8d1f('0x23')](removeEntity(_0x2cc1b7,null))[_0x8d1f('0x41')](handleError(_0x2cc1b7,null));};exports[_0x8d1f('0x48')]=function(_0x46a797,_0x4dd9b9){return db[_0x8d1f('0x3d')][_0x8d1f('0x48')]()[_0x8d1f('0x23')](respondWithResult(_0x4dd9b9,null))[_0x8d1f('0x41')](handleError(_0x4dd9b9,null));}; \ No newline at end of file +var _0x6131=['length','hasOwnProperty','nolimit','order','sort','where','pick','VIRTUAL','filter','options','includeAll','include','findAll','catch','show','params','merge','create','update','body','find','describe','html-pdf','rimraf','fast-json-patch','moment','mustache','util','sox','to-csv','ejs','lodash','squel','jsforce','desk.js','querystring','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','count','offset','limit','set','reject','save','destroy','then','error','stack','send','index','map','ChatOfflineMessage','rawAttributes','fieldName','type','key','model','name','query','keys','filters','intersection','attributes','fields'];(function(_0x659340,_0x53bbfc){var _0x56389f=function(_0x1e3868){while(--_0x1e3868){_0x659340['push'](_0x659340['shift']());}};_0x56389f(++_0x53bbfc);}(_0x6131,0x1d8));var _0x1613=function(_0x23f0d0,_0x40ef17){_0x23f0d0=_0x23f0d0-0x0;var _0x5544fc=_0x6131[_0x23f0d0];return _0x5544fc;};'use strict';var pdf=require(_0x1613('0x0'));var emlformat=require('eml-format');var rimraf=require(_0x1613('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x1613('0x2'));var rp=require('request-promise');var moment=require(_0x1613('0x3'));var BPromise=require('bluebird');var Mustache=require(_0x1613('0x4'));var util=require(_0x1613('0x5'));var path=require('path');var sox=require(_0x1613('0x6'));var csv=require(_0x1613('0x7'));var ejs=require(_0x1613('0x8'));var fs=require('fs');var _=require(_0x1613('0x9'));var squel=require(_0x1613('0xa'));var crypto=require('crypto');var jsforce=require(_0x1613('0xb'));var deskjs=require(_0x1613('0xc'));var toCsv=require(_0x1613('0x7'));var querystring=require(_0x1613('0xd'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x1613('0xe'));var qs=require(_0x1613('0xf'));var as=require(_0x1613('0x10'));var hardwareService=require(_0x1613('0x11'));var logger=require(_0x1613('0x12'))(_0x1613('0x13'));var utils=require(_0x1613('0x14'));var config=require(_0x1613('0x15'));var db=require(_0x1613('0x16'))['db'];function respondWithStatusCode(_0x2ee7b5,_0x575200){_0x575200=_0x575200||0xcc;return function(_0x5b2799){if(_0x5b2799){return _0x2ee7b5[_0x1613('0x17')](_0x575200);}return _0x2ee7b5[_0x1613('0x18')](_0x575200)[_0x1613('0x19')]();};}function respondWithResult(_0x174cd1,_0x2cc7db){_0x2cc7db=_0x2cc7db||0xc8;return function(_0x31a6a2){if(_0x31a6a2){return _0x174cd1[_0x1613('0x18')](_0x2cc7db)[_0x1613('0x1a')](_0x31a6a2);}};}function respondWithFilteredResult(_0x212d19,_0x142d3f){return function(_0x48c21a){if(_0x48c21a){var _0x1181f0=_0x48c21a[_0x1613('0x1b')],_0x167963=_0x142d3f[_0x1613('0x1c')],_0x1986cf=_0x142d3f[_0x1613('0x1c')]+_0x142d3f[_0x1613('0x1d')],_0x336c0c;if(_0x1986cf>=_0x1181f0){_0x1986cf=_0x1181f0;_0x336c0c=0xc8;}else{_0x336c0c=0xce;}_0x212d19[_0x1613('0x18')](_0x336c0c);return _0x212d19[_0x1613('0x1e')]('Content-Range',_0x167963+'-'+_0x1986cf+'/'+_0x1181f0)[_0x1613('0x1a')](_0x48c21a);}return null;};}function patchUpdates(_0x1422f1){return function(_0x3c6944){try{jsonpatch['apply'](_0x3c6944,_0x1422f1,!![]);}catch(_0x588feb){return BPromise[_0x1613('0x1f')](_0x588feb);}return _0x3c6944[_0x1613('0x20')]();};}function saveUpdates(_0xb51b72,_0x3190e8){return function(_0x37edd5){if(_0x37edd5){return _0x37edd5['update'](_0xb51b72)['then'](function(_0x164b76){return _0x164b76;});}return null;};}function removeEntity(_0x257c34,_0x32643a){return function(_0xf381d9){if(_0xf381d9){return _0xf381d9[_0x1613('0x21')]()[_0x1613('0x22')](function(){_0x257c34[_0x1613('0x18')](0xcc)['end']();});}};}function handleEntityNotFound(_0xeec564,_0x57d8a3){return function(_0x114ca2){if(!_0x114ca2){_0xeec564[_0x1613('0x17')](0x194);}return _0x114ca2;};}function handleError(_0x218c08,_0x167144){_0x167144=_0x167144||0x1f4;return function(_0x1e7eee){logger[_0x1613('0x23')](_0x1e7eee[_0x1613('0x24')]);if(_0x1e7eee['name']){delete _0x1e7eee['name'];}_0x218c08[_0x1613('0x18')](_0x167144)[_0x1613('0x25')](_0x1e7eee);};}exports[_0x1613('0x26')]=function(_0x5d0ca9,_0x50317d){var _0xf23983={},_0x4463db={},_0x3a809e={'count':0x0,'rows':[]};var _0x4a2b33=_[_0x1613('0x27')](db[_0x1613('0x28')][_0x1613('0x29')],function(_0x43c852){return{'name':_0x43c852[_0x1613('0x2a')],'type':_0x43c852[_0x1613('0x2b')][_0x1613('0x2c')]};});_0x4463db[_0x1613('0x2d')]=_[_0x1613('0x27')](_0x4a2b33,_0x1613('0x2e'));_0x4463db[_0x1613('0x2f')]=_[_0x1613('0x30')](_0x5d0ca9[_0x1613('0x2f')]);_0x4463db[_0x1613('0x31')]=_[_0x1613('0x32')](_0x4463db[_0x1613('0x2d')],_0x4463db['query']);_0xf23983[_0x1613('0x33')]=_['intersection'](_0x4463db[_0x1613('0x2d')],qs['fields'](_0x5d0ca9[_0x1613('0x2f')][_0x1613('0x34')]));_0xf23983[_0x1613('0x33')]=_0xf23983['attributes'][_0x1613('0x35')]?_0xf23983['attributes']:_0x4463db[_0x1613('0x2d')];if(!_0x5d0ca9[_0x1613('0x2f')][_0x1613('0x36')](_0x1613('0x37'))){_0xf23983[_0x1613('0x1d')]=qs[_0x1613('0x1d')](_0x5d0ca9['query'][_0x1613('0x1d')]);_0xf23983[_0x1613('0x1c')]=qs[_0x1613('0x1c')](_0x5d0ca9[_0x1613('0x2f')][_0x1613('0x1c')]);}_0xf23983[_0x1613('0x38')]=qs[_0x1613('0x39')](_0x5d0ca9[_0x1613('0x2f')]['sort']);_0xf23983[_0x1613('0x3a')]=qs[_0x1613('0x31')](_[_0x1613('0x3b')](_0x5d0ca9[_0x1613('0x2f')],_0x4463db[_0x1613('0x31')]));if(_0x5d0ca9['query']['filter']){_0xf23983['where']=_['merge'](_0xf23983[_0x1613('0x3a')],{'$or':_[_0x1613('0x27')](_0x4a2b33,function(_0x5c3546){if(_0x5c3546[_0x1613('0x2b')]!==_0x1613('0x3c')){var _0x3f9c40={};_0x3f9c40[_0x5c3546[_0x1613('0x2e')]]={'$like':'%'+_0x5d0ca9[_0x1613('0x2f')][_0x1613('0x3d')]+'%'};return _0x3f9c40;}})});}_0xf23983=_['merge']({},_0xf23983,_0x5d0ca9[_0x1613('0x3e')]);var _0xbb85a={'where':_0xf23983[_0x1613('0x3a')]};return db[_0x1613('0x28')][_0x1613('0x1b')](_0xbb85a)[_0x1613('0x22')](function(_0x5f3373){_0x3a809e['count']=_0x5f3373;if(_0x5d0ca9[_0x1613('0x2f')][_0x1613('0x3f')]){_0xf23983[_0x1613('0x40')]=[{'all':!![]}];}return db[_0x1613('0x28')][_0x1613('0x41')](_0xf23983);})[_0x1613('0x22')](function(_0x38cdb9){_0x3a809e['rows']=_0x38cdb9;return _0x3a809e;})[_0x1613('0x22')](respondWithFilteredResult(_0x50317d,_0xf23983))[_0x1613('0x42')](handleError(_0x50317d,null));};exports[_0x1613('0x43')]=function(_0xd13631,_0x36dbf5){var _0x3178a3={'raw':!![],'where':{'id':_0xd13631[_0x1613('0x44')]['id']}},_0x1ce64e={};_0x1ce64e[_0x1613('0x2d')]=_['keys'](db[_0x1613('0x28')][_0x1613('0x29')]);_0x1ce64e[_0x1613('0x2f')]=_[_0x1613('0x30')](_0xd13631[_0x1613('0x2f')]);_0x1ce64e[_0x1613('0x31')]=_[_0x1613('0x32')](_0x1ce64e[_0x1613('0x2d')],_0x1ce64e[_0x1613('0x2f')]);_0x3178a3[_0x1613('0x33')]=_[_0x1613('0x32')](_0x1ce64e['model'],qs['fields'](_0xd13631[_0x1613('0x2f')][_0x1613('0x34')]));_0x3178a3['attributes']=_0x3178a3['attributes']['length']?_0x3178a3[_0x1613('0x33')]:_0x1ce64e[_0x1613('0x2d')];if(_0xd13631[_0x1613('0x2f')]['includeAll']){_0x3178a3[_0x1613('0x40')]=[{'all':!![]}];}_0x3178a3=_[_0x1613('0x45')]({},_0x3178a3,_0xd13631[_0x1613('0x3e')]);return db['ChatOfflineMessage']['find'](_0x3178a3)[_0x1613('0x22')](handleEntityNotFound(_0x36dbf5,null))['then'](respondWithResult(_0x36dbf5,null))['catch'](handleError(_0x36dbf5,null));};exports[_0x1613('0x46')]=function(_0x9c3e24,_0x53abb2){return db[_0x1613('0x28')][_0x1613('0x46')](_0x9c3e24['body'],{})[_0x1613('0x22')](respondWithResult(_0x53abb2,0xc9))[_0x1613('0x42')](handleError(_0x53abb2,null));};exports[_0x1613('0x47')]=function(_0x15d109,_0x2f6ba3){if(_0x15d109[_0x1613('0x48')]['id']){delete _0x15d109[_0x1613('0x48')]['id'];}return db[_0x1613('0x28')][_0x1613('0x49')]({'where':{'id':_0x15d109['params']['id']}})[_0x1613('0x22')](handleEntityNotFound(_0x2f6ba3,null))[_0x1613('0x22')](saveUpdates(_0x15d109['body'],null))['then'](respondWithResult(_0x2f6ba3,null))[_0x1613('0x42')](handleError(_0x2f6ba3,null));};exports[_0x1613('0x21')]=function(_0x20a958,_0x27a379){return db[_0x1613('0x28')][_0x1613('0x49')]({'where':{'id':_0x20a958['params']['id']}})['then'](handleEntityNotFound(_0x27a379,null))['then'](removeEntity(_0x27a379,null))[_0x1613('0x42')](handleError(_0x27a379,null));};exports['describe']=function(_0x3cca43,_0x4eb83d){return db[_0x1613('0x28')][_0x1613('0x4a')]()[_0x1613('0x22')](respondWithResult(_0x4eb83d,null))[_0x1613('0x42')](handleError(_0x4eb83d,null));}; \ No newline at end of file diff --git a/server/api/chatOfflineMessage/chatOfflineMessage.model.js b/server/api/chatOfflineMessage/chatOfflineMessage.model.js index 357135f..3899421 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 _0x3937=['../../config/logger','api','bluebird','path','../../config/environment','./chatOfflineMessage.attributes','exports','define','ChatOfflineMessage','chat_offline_messages','utf8mb4','lodash'];(function(_0x19e35c,_0x29cd1e){var _0x3e1fe8=function(_0x17258b){while(--_0x17258b){_0x19e35c['push'](_0x19e35c['shift']());}};_0x3e1fe8(++_0x29cd1e);}(_0x3937,0xbf));var _0x7393=function(_0x3dffb7,_0x4522b2){_0x3dffb7=_0x3dffb7-0x0;var _0x4eac8f=_0x3937[_0x3dffb7];return _0x4eac8f;};'use strict';var _=require(_0x7393('0x0'));var util=require('util');var logger=require(_0x7393('0x1'))(_0x7393('0x2'));var moment=require('moment');var BPromise=require(_0x7393('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x7393('0x4'));var rimraf=require('rimraf');var config=require(_0x7393('0x5'));var attributes=require(_0x7393('0x6'));module[_0x7393('0x7')]=function(_0x1f538f,_0x15eabd){return _0x1f538f[_0x7393('0x8')](_0x7393('0x9'),attributes,{'tableName':_0x7393('0xa'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x7393('0xb'),'collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file +var _0x99e9=['util','../../config/logger','api','moment','request-promise','path','rimraf','./chatOfflineMessage.attributes','define','ChatOfflineMessage','utf8mb4','utf8mb4_unicode_ci'];(function(_0x43a6cd,_0x503d1a){var _0x5acb36=function(_0x2dd95e){while(--_0x2dd95e){_0x43a6cd['push'](_0x43a6cd['shift']());}};_0x5acb36(++_0x503d1a);}(_0x99e9,0xb4));var _0x999e=function(_0x2d364e,_0x301c5e){_0x2d364e=_0x2d364e-0x0;var _0x1b9312=_0x99e9[_0x2d364e];return _0x1b9312;};'use strict';var _=require('lodash');var util=require(_0x999e('0x0'));var logger=require(_0x999e('0x1'))(_0x999e('0x2'));var moment=require(_0x999e('0x3'));var BPromise=require('bluebird');var rp=require(_0x999e('0x4'));var fs=require('fs');var path=require(_0x999e('0x5'));var rimraf=require(_0x999e('0x6'));var config=require('../../config/environment');var attributes=require(_0x999e('0x7'));module['exports']=function(_0x25421f,_0x1bda0a){return _0x25421f[_0x999e('0x8')](_0x999e('0x9'),attributes,{'tableName':'chat_offline_messages','paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x999e('0xa'),'collate':_0x999e('0xb')});}; \ No newline at end of file diff --git a/server/api/chatOfflineMessage/chatOfflineMessage.rpc.js b/server/api/chatOfflineMessage/chatOfflineMessage.rpc.js index 6f4adb5..5cc4147 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 _0xdad7=['catch','lodash','moment','bluebird','randomstring','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','request','ChatOfflineMessage,\x20%s,\x20%s','request\x20sent','debug','ChatOfflineMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result'];(function(_0xfb7b64,_0x1461b0){var _0x4ee3ca=function(_0x15beca){while(--_0x15beca){_0xfb7b64['push'](_0xfb7b64['shift']());}};_0x4ee3ca(++_0x1461b0);}(_0xdad7,0x6a));var _0x7dad=function(_0x4154a6,_0x2c0b8e){_0x4154a6=_0x4154a6-0x0;var _0x3b2786=_0xdad7[_0x4154a6];return _0x3b2786;};'use strict';var _=require(_0x7dad('0x0'));var util=require('util');var moment=require(_0x7dad('0x1'));var BPromise=require(_0x7dad('0x2'));var rs=require(_0x7dad('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x7dad('0x4'));var logger=require('../../config/logger')(_0x7dad('0x5'));var config=require(_0x7dad('0x6'));var jayson=require(_0x7dad('0x7'));var client=jayson[_0x7dad('0x8')][_0x7dad('0x9')]({'port':0x232a});function respondWithRpcPromise(_0xd7b977,_0x17dffe,_0x2bc696){return new BPromise(function(_0x1b13e3,_0x503f89){return client[_0x7dad('0xa')](_0xd7b977,_0x2bc696)['then'](function(_0x304b00){logger['info'](_0x7dad('0xb'),_0x17dffe,_0x7dad('0xc'));logger[_0x7dad('0xd')](_0x7dad('0xe'),_0x17dffe,_0x7dad('0xc'),JSON[_0x7dad('0xf')](_0x304b00));if(_0x304b00[_0x7dad('0x10')]){if(_0x304b00[_0x7dad('0x10')][_0x7dad('0x11')]===0x1f4){logger[_0x7dad('0x10')](_0x7dad('0xb'),_0x17dffe,_0x304b00[_0x7dad('0x10')][_0x7dad('0x12')]);return _0x503f89(_0x304b00['error'][_0x7dad('0x12')]);}logger['error'](_0x7dad('0xb'),_0x17dffe,_0x304b00[_0x7dad('0x10')][_0x7dad('0x12')]);return _0x1b13e3(_0x304b00[_0x7dad('0x10')]['message']);}else{logger['info']('ChatOfflineMessage,\x20%s,\x20%s',_0x17dffe,'request\x20sent');_0x1b13e3(_0x304b00[_0x7dad('0x13')][_0x7dad('0x12')]);}})[_0x7dad('0x14')](function(_0x28dfc2){logger[_0x7dad('0x10')](_0x7dad('0xb'),_0x17dffe,_0x28dfc2);_0x503f89(_0x28dfc2);});});} \ No newline at end of file +var _0xb0be=['lodash','util','moment','../../mysqldb','jayson/promise','request','then','info','request\x20sent','ChatOfflineMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','ChatOfflineMessage,\x20%s,\x20%s','message','result','catch'];(function(_0x1f9bc0,_0x1edaaf){var _0x40de7a=function(_0xa6ad68){while(--_0xa6ad68){_0x1f9bc0['push'](_0x1f9bc0['shift']());}};_0x40de7a(++_0x1edaaf);}(_0xb0be,0x143));var _0xeb0b=function(_0x388e9c,_0x440a3e){_0x388e9c=_0x388e9c-0x0;var _0x53e64a=_0xb0be[_0x388e9c];return _0x53e64a;};'use strict';var _=require(_0xeb0b('0x0'));var util=require(_0xeb0b('0x1'));var moment=require(_0xeb0b('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0xeb0b('0x3'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')('rpc');var config=require('../../config/environment');var jayson=require(_0xeb0b('0x4'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x1bebc4,_0x4ef088,_0x5e5c73){return new BPromise(function(_0x589ee3,_0x291165){return client[_0xeb0b('0x5')](_0x1bebc4,_0x5e5c73)[_0xeb0b('0x6')](function(_0x634977){logger[_0xeb0b('0x7')]('ChatOfflineMessage,\x20%s,\x20%s',_0x4ef088,_0xeb0b('0x8'));logger['debug'](_0xeb0b('0x9'),_0x4ef088,'request\x20sent',JSON[_0xeb0b('0xa')](_0x634977));if(_0x634977[_0xeb0b('0xb')]){if(_0x634977[_0xeb0b('0xb')][_0xeb0b('0xc')]===0x1f4){logger[_0xeb0b('0xb')](_0xeb0b('0xd'),_0x4ef088,_0x634977['error'][_0xeb0b('0xe')]);return _0x291165(_0x634977[_0xeb0b('0xb')]['message']);}logger[_0xeb0b('0xb')](_0xeb0b('0xd'),_0x4ef088,_0x634977[_0xeb0b('0xb')][_0xeb0b('0xe')]);return _0x589ee3(_0x634977[_0xeb0b('0xb')][_0xeb0b('0xe')]);}else{logger[_0xeb0b('0x7')](_0xeb0b('0xd'),_0x4ef088,'request\x20sent');_0x589ee3(_0x634977[_0xeb0b('0xf')]['message']);}})[_0xeb0b('0x10')](function(_0x5665bd){logger[_0xeb0b('0xb')]('ChatOfflineMessage,\x20%s,\x20%s',_0x4ef088,_0x5665bd);_0x291165(_0x5665bd);});});} \ No newline at end of file diff --git a/server/api/chatOfflineMessage/index.js b/server/api/chatOfflineMessage/index.js index b52bb90..2119ddd 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 _0x2863=['update','delete','multer','util','path','connect-timeout','express','../../components/interaction/service','../../config/environment','./chatOfflineMessage.controller','get','isAuthenticated','/describe','describe','/:id','show','post','put'];(function(_0xd89ad5,_0x3491a3){var _0x24bf25=function(_0x34e807){while(--_0x34e807){_0xd89ad5['push'](_0xd89ad5['shift']());}};_0x24bf25(++_0x3491a3);}(_0x2863,0xb6));var _0x3286=function(_0x553146,_0x5e3f13){_0x553146=_0x553146-0x0;var _0x19a448=_0x2863[_0x553146];return _0x19a448;};'use strict';var multer=require(_0x3286('0x0'));var util=require(_0x3286('0x1'));var path=require(_0x3286('0x2'));var timeout=require(_0x3286('0x3'));var express=require(_0x3286('0x4'));var router=express['Router']();var auth=require('../../components/auth/service');var interaction=require(_0x3286('0x5'));var config=require(_0x3286('0x6'));var controller=require(_0x3286('0x7'));router[_0x3286('0x8')]('/',auth[_0x3286('0x9')](),controller['index']);router['get'](_0x3286('0xa'),auth[_0x3286('0x9')](),controller[_0x3286('0xb')]);router[_0x3286('0x8')](_0x3286('0xc'),auth[_0x3286('0x9')](),controller[_0x3286('0xd')]);router[_0x3286('0xe')]('/',auth[_0x3286('0x9')](),controller['create']);router[_0x3286('0xf')]('/:id',auth['isAuthenticated'](),controller[_0x3286('0x10')]);router[_0x3286('0x11')](_0x3286('0xc'),auth[_0x3286('0x9')](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0xc643=['exports','path','connect-timeout','express','Router','../../components/auth/service','../../config/environment','get','isAuthenticated','index','/describe','describe','/:id','show','create','put','delete'];(function(_0x33fe71,_0x31500f){var _0x31a0b7=function(_0x59d2e0){while(--_0x59d2e0){_0x33fe71['push'](_0x33fe71['shift']());}};_0x31a0b7(++_0x31500f);}(_0xc643,0x133));var _0x3c64=function(_0x5ce7a3,_0x3ddad8){_0x5ce7a3=_0x5ce7a3-0x0;var _0x350e9b=_0xc643[_0x5ce7a3];return _0x350e9b;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x3c64('0x0'));var timeout=require(_0x3c64('0x1'));var express=require(_0x3c64('0x2'));var router=express[_0x3c64('0x3')]();var auth=require(_0x3c64('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0x3c64('0x5'));var controller=require('./chatOfflineMessage.controller');router[_0x3c64('0x6')]('/',auth[_0x3c64('0x7')](),controller[_0x3c64('0x8')]);router[_0x3c64('0x6')](_0x3c64('0x9'),auth['isAuthenticated'](),controller[_0x3c64('0xa')]);router[_0x3c64('0x6')](_0x3c64('0xb'),auth[_0x3c64('0x7')](),controller[_0x3c64('0xc')]);router['post']('/',auth[_0x3c64('0x7')](),controller[_0x3c64('0xd')]);router[_0x3c64('0xe')]('/:id',auth[_0x3c64('0x7')](),controller['update']);router[_0x3c64('0xf')](_0x3c64('0xb'),auth['isAuthenticated'](),controller['destroy']);module[_0x3c64('0x10')]=router; \ No newline at end of file diff --git a/server/api/chatProactiveAction/chatProactiveAction.attributes.js b/server/api/chatProactiveAction/chatProactiveAction.attributes.js index f11fb5f..bce4904 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 _0x7342=['ENUM','timeout','mouseOver','sequelize','exports','STRING'];(function(_0x3fbe07,_0x46f54b){var _0x2f87f2=function(_0x1a3921){while(--_0x1a3921){_0x3fbe07['push'](_0x3fbe07['shift']());}};_0x2f87f2(++_0x46f54b);}(_0x7342,0x195));var _0x2734=function(_0x26daf6,_0x19df8e){_0x26daf6=_0x26daf6-0x0;var _0x1554b1=_0x7342[_0x26daf6];return _0x1554b1;};'use strict';var Sequelize=require(_0x2734('0x0'));module[_0x2734('0x1')]={'name':{'type':Sequelize[_0x2734('0x2')],'allowNull':![]},'type':{'type':Sequelize[_0x2734('0x3')]('mouseOver',_0x2734('0x4')),'defaultValue':_0x2734('0x5')},'selector':{'type':Sequelize[_0x2734('0x2')]},'timeout':{'type':Sequelize['INTEGER']}}; \ No newline at end of file +var _0x5d8b=['mouseOver','STRING','INTEGER','exports'];(function(_0xf91841,_0x182ae3){var _0x4b9c44=function(_0x2e216e){while(--_0x2e216e){_0xf91841['push'](_0xf91841['shift']());}};_0x4b9c44(++_0x182ae3);}(_0x5d8b,0x18f));var _0xb5d8=function(_0x2fae7c,_0x2fce16){_0x2fae7c=_0x2fae7c-0x0;var _0x321ace=_0x5d8b[_0x2fae7c];return _0x321ace;};'use strict';var Sequelize=require('sequelize');module[_0xb5d8('0x0')]={'name':{'type':Sequelize['STRING'],'allowNull':![]},'type':{'type':Sequelize['ENUM'](_0xb5d8('0x1'),'timeout'),'defaultValue':_0xb5d8('0x1')},'selector':{'type':Sequelize[_0xb5d8('0x2')]},'timeout':{'type':Sequelize[_0xb5d8('0x3')]}}; \ No newline at end of file diff --git a/server/api/chatProactiveAction/chatProactiveAction.controller.js b/server/api/chatProactiveAction/chatProactiveAction.controller.js index 58eeeb3..3b51b50 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 _0xe706=['../../config/environment','../../mysqldb','sendStatus','status','end','count','limit','set','Content-Range','apply','reject','save','update','then','stack','name','send','show','params','model','keys','rawAttributes','query','filters','intersection','attributes','fields','length','includeAll','merge','options','find','catch','create','ChatProactiveAction','body','destroy','html-pdf','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger'];(function(_0x8cf907,_0x4d29f4){var _0x6e89ad=function(_0x51ba11){while(--_0x51ba11){_0x8cf907['push'](_0x8cf907['shift']());}};_0x6e89ad(++_0x4d29f4);}(_0xe706,0xa3));var _0x6e70=function(_0x2dc53c,_0x4a29ce){_0x2dc53c=_0x2dc53c-0x0;var _0x32ea88=_0xe706[_0x2dc53c];return _0x32ea88;};'use strict';var pdf=require(_0x6e70('0x0'));var emlformat=require(_0x6e70('0x1'));var rimraf=require(_0x6e70('0x2'));var zipdir=require('zip-dir');var jsonpatch=require(_0x6e70('0x3'));var rp=require(_0x6e70('0x4'));var moment=require(_0x6e70('0x5'));var BPromise=require(_0x6e70('0x6'));var Mustache=require(_0x6e70('0x7'));var util=require(_0x6e70('0x8'));var path=require(_0x6e70('0x9'));var sox=require(_0x6e70('0xa'));var csv=require(_0x6e70('0xb'));var ejs=require(_0x6e70('0xc'));var fs=require('fs');var _=require(_0x6e70('0xd'));var squel=require(_0x6e70('0xe'));var crypto=require(_0x6e70('0xf'));var jsforce=require(_0x6e70('0x10'));var deskjs=require(_0x6e70('0x11'));var toCsv=require(_0x6e70('0xb'));var querystring=require(_0x6e70('0x12'));var Papa=require(_0x6e70('0x13'));var Redis=require(_0x6e70('0x14'));var authService=require(_0x6e70('0x15'));var qs=require(_0x6e70('0x16'));var as=require(_0x6e70('0x17'));var hardwareService=require(_0x6e70('0x18'));var logger=require(_0x6e70('0x19'))('api');var utils=require('../../config/utils');var config=require(_0x6e70('0x1a'));var db=require(_0x6e70('0x1b'))['db'];function respondWithStatusCode(_0x18cf27,_0x27dd9b){_0x27dd9b=_0x27dd9b||0xcc;return function(_0x3b38f3){if(_0x3b38f3){return _0x18cf27[_0x6e70('0x1c')](_0x27dd9b);}return _0x18cf27[_0x6e70('0x1d')](_0x27dd9b)[_0x6e70('0x1e')]();};}function respondWithResult(_0x5dfbaa,_0x52737e){_0x52737e=_0x52737e||0xc8;return function(_0x48bc72){if(_0x48bc72){return _0x5dfbaa[_0x6e70('0x1d')](_0x52737e)['json'](_0x48bc72);}};}function respondWithFilteredResult(_0x53aed0,_0x304716){return function(_0x22c50c){if(_0x22c50c){var _0x5d9263=_0x22c50c[_0x6e70('0x1f')],_0x24f3ac=_0x304716['offset'],_0x5c3fe7=_0x304716['offset']+_0x304716[_0x6e70('0x20')],_0x2efc0f;if(_0x5c3fe7>=_0x5d9263){_0x5c3fe7=_0x5d9263;_0x2efc0f=0xc8;}else{_0x2efc0f=0xce;}_0x53aed0['status'](_0x2efc0f);return _0x53aed0[_0x6e70('0x21')](_0x6e70('0x22'),_0x24f3ac+'-'+_0x5c3fe7+'/'+_0x5d9263)['json'](_0x22c50c);}return null;};}function patchUpdates(_0x497d61){return function(_0xc238ba){try{jsonpatch[_0x6e70('0x23')](_0xc238ba,_0x497d61,!![]);}catch(_0x2368eb){return BPromise[_0x6e70('0x24')](_0x2368eb);}return _0xc238ba[_0x6e70('0x25')]();};}function saveUpdates(_0xcdf9f2,_0x1b2453){return function(_0x44a49f){if(_0x44a49f){return _0x44a49f[_0x6e70('0x26')](_0xcdf9f2)[_0x6e70('0x27')](function(_0x4a0cfe){return _0x4a0cfe;});}return null;};}function removeEntity(_0x228350,_0x344b65){return function(_0x27b294){if(_0x27b294){return _0x27b294['destroy']()[_0x6e70('0x27')](function(){_0x228350[_0x6e70('0x1d')](0xcc)[_0x6e70('0x1e')]();});}};}function handleEntityNotFound(_0x50da2c,_0x10fc91){return function(_0x538b9c){if(!_0x538b9c){_0x50da2c['sendStatus'](0x194);}return _0x538b9c;};}function handleError(_0x4e97c7,_0x41e352){_0x41e352=_0x41e352||0x1f4;return function(_0x19c5ae){logger['error'](_0x19c5ae[_0x6e70('0x28')]);if(_0x19c5ae[_0x6e70('0x29')]){delete _0x19c5ae['name'];}_0x4e97c7[_0x6e70('0x1d')](_0x41e352)[_0x6e70('0x2a')](_0x19c5ae);};}exports[_0x6e70('0x2b')]=function(_0x4a67ac,_0x54a5fe){var _0x2c4d37={'raw':!![],'where':{'id':_0x4a67ac[_0x6e70('0x2c')]['id']}},_0x3af17f={};_0x3af17f[_0x6e70('0x2d')]=_[_0x6e70('0x2e')](db['ChatProactiveAction'][_0x6e70('0x2f')]);_0x3af17f[_0x6e70('0x30')]=_[_0x6e70('0x2e')](_0x4a67ac[_0x6e70('0x30')]);_0x3af17f[_0x6e70('0x31')]=_[_0x6e70('0x32')](_0x3af17f[_0x6e70('0x2d')],_0x3af17f[_0x6e70('0x30')]);_0x2c4d37[_0x6e70('0x33')]=_[_0x6e70('0x32')](_0x3af17f['model'],qs[_0x6e70('0x34')](_0x4a67ac['query'][_0x6e70('0x34')]));_0x2c4d37['attributes']=_0x2c4d37[_0x6e70('0x33')][_0x6e70('0x35')]?_0x2c4d37[_0x6e70('0x33')]:_0x3af17f['model'];if(_0x4a67ac[_0x6e70('0x30')][_0x6e70('0x36')]){_0x2c4d37['include']=[{'all':!![]}];}_0x2c4d37=_[_0x6e70('0x37')]({},_0x2c4d37,_0x4a67ac[_0x6e70('0x38')]);return db['ChatProactiveAction'][_0x6e70('0x39')](_0x2c4d37)[_0x6e70('0x27')](handleEntityNotFound(_0x54a5fe,null))[_0x6e70('0x27')](respondWithResult(_0x54a5fe,null))[_0x6e70('0x3a')](handleError(_0x54a5fe,null));};exports[_0x6e70('0x3b')]=function(_0x1e3e76,_0x44b19d){return db[_0x6e70('0x3c')][_0x6e70('0x3b')](_0x1e3e76[_0x6e70('0x3d')],{})['then'](respondWithResult(_0x44b19d,0xc9))[_0x6e70('0x3a')](handleError(_0x44b19d,null));};exports['update']=function(_0x23cd1a,_0x3222a2){if(_0x23cd1a[_0x6e70('0x3d')]['id']){delete _0x23cd1a[_0x6e70('0x3d')]['id'];}return db[_0x6e70('0x3c')][_0x6e70('0x39')]({'where':{'id':_0x23cd1a[_0x6e70('0x2c')]['id']}})[_0x6e70('0x27')](handleEntityNotFound(_0x3222a2,null))[_0x6e70('0x27')](saveUpdates(_0x23cd1a[_0x6e70('0x3d')],null))[_0x6e70('0x27')](respondWithResult(_0x3222a2,null))[_0x6e70('0x3a')](handleError(_0x3222a2,null));};exports[_0x6e70('0x3e')]=function(_0x501b53,_0x5446a2){return db['ChatProactiveAction'][_0x6e70('0x39')]({'where':{'id':_0x501b53[_0x6e70('0x2c')]['id']}})[_0x6e70('0x27')](handleEntityNotFound(_0x5446a2,null))[_0x6e70('0x27')](removeEntity(_0x5446a2,null))[_0x6e70('0x3a')](handleError(_0x5446a2,null));}; \ No newline at end of file +var _0xa9e0=['keys','ChatProactiveAction','rawAttributes','query','filters','attributes','intersection','fields','length','include','options','find','create','body','catch','params','html-pdf','eml-format','rimraf','request-promise','bluebird','mustache','util','path','sox','ejs','lodash','squel','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../mysqldb','sendStatus','status','json','count','offset','set','Content-Range','apply','reject','save','update','then','destroy','end','error','name','send','show','model'];(function(_0x247fa1,_0x4ec37c){var _0x244f35=function(_0xfb98be){while(--_0xfb98be){_0x247fa1['push'](_0x247fa1['shift']());}};_0x244f35(++_0x4ec37c);}(_0xa9e0,0x123));var _0x0a9e=function(_0x30ae5e,_0x391fc4){_0x30ae5e=_0x30ae5e-0x0;var _0x1f2e93=_0xa9e0[_0x30ae5e];return _0x1f2e93;};'use strict';var pdf=require(_0x0a9e('0x0'));var emlformat=require(_0x0a9e('0x1'));var rimraf=require(_0x0a9e('0x2'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x0a9e('0x3'));var moment=require('moment');var BPromise=require(_0x0a9e('0x4'));var Mustache=require(_0x0a9e('0x5'));var util=require(_0x0a9e('0x6'));var path=require(_0x0a9e('0x7'));var sox=require(_0x0a9e('0x8'));var csv=require('to-csv');var ejs=require(_0x0a9e('0x9'));var fs=require('fs');var _=require(_0x0a9e('0xa'));var squel=require(_0x0a9e('0xb'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x0a9e('0xc'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x0a9e('0xd'));var Redis=require(_0x0a9e('0xe'));var authService=require(_0x0a9e('0xf'));var qs=require(_0x0a9e('0x10'));var as=require(_0x0a9e('0x11'));var hardwareService=require(_0x0a9e('0x12'));var logger=require('../../config/logger')('api');var utils=require('../../config/utils');var config=require('../../config/environment');var db=require(_0x0a9e('0x13'))['db'];function respondWithStatusCode(_0x36471c,_0xd5b662){_0xd5b662=_0xd5b662||0xcc;return function(_0x26d672){if(_0x26d672){return _0x36471c[_0x0a9e('0x14')](_0xd5b662);}return _0x36471c[_0x0a9e('0x15')](_0xd5b662)['end']();};}function respondWithResult(_0x4283ce,_0x239b12){_0x239b12=_0x239b12||0xc8;return function(_0x2b4227){if(_0x2b4227){return _0x4283ce[_0x0a9e('0x15')](_0x239b12)[_0x0a9e('0x16')](_0x2b4227);}};}function respondWithFilteredResult(_0x4d5611,_0x52a03d){return function(_0x22dccb){if(_0x22dccb){var _0x5d0880=_0x22dccb[_0x0a9e('0x17')],_0x1985b6=_0x52a03d['offset'],_0x519dfd=_0x52a03d[_0x0a9e('0x18')]+_0x52a03d['limit'],_0x16033c;if(_0x519dfd>=_0x5d0880){_0x519dfd=_0x5d0880;_0x16033c=0xc8;}else{_0x16033c=0xce;}_0x4d5611[_0x0a9e('0x15')](_0x16033c);return _0x4d5611[_0x0a9e('0x19')](_0x0a9e('0x1a'),_0x1985b6+'-'+_0x519dfd+'/'+_0x5d0880)[_0x0a9e('0x16')](_0x22dccb);}return null;};}function patchUpdates(_0x31b1ca){return function(_0x2eb11f){try{jsonpatch[_0x0a9e('0x1b')](_0x2eb11f,_0x31b1ca,!![]);}catch(_0x20559e){return BPromise[_0x0a9e('0x1c')](_0x20559e);}return _0x2eb11f[_0x0a9e('0x1d')]();};}function saveUpdates(_0x1c696a,_0x105080){return function(_0x4bb1e3){if(_0x4bb1e3){return _0x4bb1e3[_0x0a9e('0x1e')](_0x1c696a)[_0x0a9e('0x1f')](function(_0x53682f){return _0x53682f;});}return null;};}function removeEntity(_0x20f109,_0x5a09ef){return function(_0x588269){if(_0x588269){return _0x588269[_0x0a9e('0x20')]()[_0x0a9e('0x1f')](function(){_0x20f109[_0x0a9e('0x15')](0xcc)[_0x0a9e('0x21')]();});}};}function handleEntityNotFound(_0x4abc77,_0xfb6e48){return function(_0x2fb0e4){if(!_0x2fb0e4){_0x4abc77[_0x0a9e('0x14')](0x194);}return _0x2fb0e4;};}function handleError(_0x4d00e6,_0x370d86){_0x370d86=_0x370d86||0x1f4;return function(_0x42ac8f){logger[_0x0a9e('0x22')](_0x42ac8f['stack']);if(_0x42ac8f['name']){delete _0x42ac8f[_0x0a9e('0x23')];}_0x4d00e6[_0x0a9e('0x15')](_0x370d86)[_0x0a9e('0x24')](_0x42ac8f);};}exports[_0x0a9e('0x25')]=function(_0x526cf3,_0x384319){var _0x479bc4={'raw':!![],'where':{'id':_0x526cf3['params']['id']}},_0x45a1e7={};_0x45a1e7[_0x0a9e('0x26')]=_[_0x0a9e('0x27')](db[_0x0a9e('0x28')][_0x0a9e('0x29')]);_0x45a1e7[_0x0a9e('0x2a')]=_[_0x0a9e('0x27')](_0x526cf3[_0x0a9e('0x2a')]);_0x45a1e7[_0x0a9e('0x2b')]=_['intersection'](_0x45a1e7[_0x0a9e('0x26')],_0x45a1e7[_0x0a9e('0x2a')]);_0x479bc4[_0x0a9e('0x2c')]=_[_0x0a9e('0x2d')](_0x45a1e7['model'],qs[_0x0a9e('0x2e')](_0x526cf3[_0x0a9e('0x2a')][_0x0a9e('0x2e')]));_0x479bc4[_0x0a9e('0x2c')]=_0x479bc4[_0x0a9e('0x2c')][_0x0a9e('0x2f')]?_0x479bc4[_0x0a9e('0x2c')]:_0x45a1e7[_0x0a9e('0x26')];if(_0x526cf3[_0x0a9e('0x2a')]['includeAll']){_0x479bc4[_0x0a9e('0x30')]=[{'all':!![]}];}_0x479bc4=_['merge']({},_0x479bc4,_0x526cf3[_0x0a9e('0x31')]);return db[_0x0a9e('0x28')][_0x0a9e('0x32')](_0x479bc4)[_0x0a9e('0x1f')](handleEntityNotFound(_0x384319,null))[_0x0a9e('0x1f')](respondWithResult(_0x384319,null))['catch'](handleError(_0x384319,null));};exports[_0x0a9e('0x33')]=function(_0x46f0a5,_0x40cb85){return db[_0x0a9e('0x28')][_0x0a9e('0x33')](_0x46f0a5[_0x0a9e('0x34')],{})[_0x0a9e('0x1f')](respondWithResult(_0x40cb85,0xc9))[_0x0a9e('0x35')](handleError(_0x40cb85,null));};exports['update']=function(_0x44295a,_0x5e7238){if(_0x44295a[_0x0a9e('0x34')]['id']){delete _0x44295a[_0x0a9e('0x34')]['id'];}return db[_0x0a9e('0x28')][_0x0a9e('0x32')]({'where':{'id':_0x44295a['params']['id']}})[_0x0a9e('0x1f')](handleEntityNotFound(_0x5e7238,null))[_0x0a9e('0x1f')](saveUpdates(_0x44295a[_0x0a9e('0x34')],null))[_0x0a9e('0x1f')](respondWithResult(_0x5e7238,null))['catch'](handleError(_0x5e7238,null));};exports['destroy']=function(_0x1e8694,_0x5640eb){return db[_0x0a9e('0x28')][_0x0a9e('0x32')]({'where':{'id':_0x1e8694[_0x0a9e('0x36')]['id']}})[_0x0a9e('0x1f')](handleEntityNotFound(_0x5640eb,null))['then'](removeEntity(_0x5640eb,null))[_0x0a9e('0x35')](handleError(_0x5640eb,null));}; \ No newline at end of file diff --git a/server/api/chatProactiveAction/chatProactiveAction.model.js b/server/api/chatProactiveAction/chatProactiveAction.model.js index b622100..09c3404 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 _0x82f5=['bluebird','rimraf','exports','define','chat_proactive_actions','lodash','util','api','moment'];(function(_0x4571f2,_0x35da8b){var _0x5776e8=function(_0x5322a7){while(--_0x5322a7){_0x4571f2['push'](_0x4571f2['shift']());}};_0x5776e8(++_0x35da8b);}(_0x82f5,0x10a));var _0x582f=function(_0x2ea662,_0x3cd06a){_0x2ea662=_0x2ea662-0x0;var _0x5c2471=_0x82f5[_0x2ea662];return _0x5c2471;};'use strict';var _=require(_0x582f('0x0'));var util=require(_0x582f('0x1'));var logger=require('../../config/logger')(_0x582f('0x2'));var moment=require(_0x582f('0x3'));var BPromise=require(_0x582f('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x582f('0x5'));var config=require('../../config/environment');var attributes=require('./chatProactiveAction.attributes');module[_0x582f('0x6')]=function(_0x15d3c1,_0x50ae18){return _0x15d3c1[_0x582f('0x7')]('ChatProactiveAction',attributes,{'tableName':_0x582f('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xd5de=['chat_proactive_actions','lodash','util','../../config/logger','api','moment','bluebird','path','rimraf','./chatProactiveAction.attributes','ChatProactiveAction'];(function(_0x4a8191,_0x4f56d9){var _0x312ed9=function(_0x390652){while(--_0x390652){_0x4a8191['push'](_0x4a8191['shift']());}};_0x312ed9(++_0x4f56d9);}(_0xd5de,0x1f0));var _0xed5d=function(_0x17d9e3,_0x1f969c){_0x17d9e3=_0x17d9e3-0x0;var _0x14192d=_0xd5de[_0x17d9e3];return _0x14192d;};'use strict';var _=require(_0xed5d('0x0'));var util=require(_0xed5d('0x1'));var logger=require(_0xed5d('0x2'))(_0xed5d('0x3'));var moment=require(_0xed5d('0x4'));var BPromise=require(_0xed5d('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xed5d('0x6'));var rimraf=require(_0xed5d('0x7'));var config=require('../../config/environment');var attributes=require(_0xed5d('0x8'));module['exports']=function(_0x299d6f,_0x36ea4d){return _0x299d6f['define'](_0xed5d('0x9'),attributes,{'tableName':_0xed5d('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 c5b98e0..ffced79 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 _0x87bc=['bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','jayson/promise','client','http','request','then','info','request\x20sent','ChatProactiveAction,\x20%s,\x20%s,\x20%s','stringify','error','code','ChatProactiveAction,\x20%s,\x20%s','message','result','catch','lodash','util','moment'];(function(_0x2641f9,_0x26715f){var _0x585741=function(_0x2d1462){while(--_0x2d1462){_0x2641f9['push'](_0x2641f9['shift']());}};_0x585741(++_0x26715f);}(_0x87bc,0x111));var _0xc87b=function(_0x535476,_0x4cc046){_0x535476=_0x535476-0x0;var _0x9effc=_0x87bc[_0x535476];return _0x9effc;};'use strict';var _=require(_0xc87b('0x0'));var util=require(_0xc87b('0x1'));var moment=require(_0xc87b('0x2'));var BPromise=require(_0xc87b('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xc87b('0x4'));var db=require(_0xc87b('0x5'))['db'];var utils=require(_0xc87b('0x6'));var logger=require(_0xc87b('0x7'))('rpc');var config=require('../../config/environment');var jayson=require(_0xc87b('0x8'));var client=jayson[_0xc87b('0x9')][_0xc87b('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x3f9a79,_0x481ed7,_0x41b409){return new BPromise(function(_0x5f2425,_0x4f609f){return client[_0xc87b('0xb')](_0x3f9a79,_0x41b409)[_0xc87b('0xc')](function(_0x2949f4){logger[_0xc87b('0xd')]('ChatProactiveAction,\x20%s,\x20%s',_0x481ed7,_0xc87b('0xe'));logger['debug'](_0xc87b('0xf'),_0x481ed7,'request\x20sent',JSON[_0xc87b('0x10')](_0x2949f4));if(_0x2949f4['error']){if(_0x2949f4[_0xc87b('0x11')][_0xc87b('0x12')]===0x1f4){logger[_0xc87b('0x11')](_0xc87b('0x13'),_0x481ed7,_0x2949f4[_0xc87b('0x11')]['message']);return _0x4f609f(_0x2949f4['error'][_0xc87b('0x14')]);}logger['error']('ChatProactiveAction,\x20%s,\x20%s',_0x481ed7,_0x2949f4[_0xc87b('0x11')][_0xc87b('0x14')]);return _0x5f2425(_0x2949f4[_0xc87b('0x11')]['message']);}else{logger[_0xc87b('0xd')](_0xc87b('0x13'),_0x481ed7,_0xc87b('0xe'));_0x5f2425(_0x2949f4[_0xc87b('0x15')]['message']);}})[_0xc87b('0x16')](function(_0x33d36d){logger[_0xc87b('0x11')](_0xc87b('0x13'),_0x481ed7,_0x33d36d);_0x4f609f(_0x33d36d);});});} \ No newline at end of file +var _0x04d6=['bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request','then','info','request\x20sent','debug','ChatProactiveAction,\x20%s,\x20%s,\x20%s','stringify','error','code','ChatProactiveAction,\x20%s,\x20%s','message','lodash','util','moment'];(function(_0x25de78,_0x3ebcde){var _0x37dd87=function(_0x4b66ff){while(--_0x4b66ff){_0x25de78['push'](_0x25de78['shift']());}};_0x37dd87(++_0x3ebcde);}(_0x04d6,0xed));var _0x604d=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x04d6[_0x20a584];return _0x4b41a8;};'use strict';var _=require(_0x604d('0x0'));var util=require(_0x604d('0x1'));var moment=require(_0x604d('0x2'));var BPromise=require(_0x604d('0x3'));var rs=require(_0x604d('0x4'));var fs=require('fs');var Redis=require(_0x604d('0x5'));var db=require(_0x604d('0x6'))['db'];var utils=require(_0x604d('0x7'));var logger=require(_0x604d('0x8'))('rpc');var config=require(_0x604d('0x9'));var jayson=require(_0x604d('0xa'));var client=jayson[_0x604d('0xb')][_0x604d('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x599ca6,_0x666899,_0x43c5b1){return new BPromise(function(_0x2b5d38,_0x273725){return client[_0x604d('0xd')](_0x599ca6,_0x43c5b1)[_0x604d('0xe')](function(_0x13a71d){logger[_0x604d('0xf')]('ChatProactiveAction,\x20%s,\x20%s',_0x666899,_0x604d('0x10'));logger[_0x604d('0x11')](_0x604d('0x12'),_0x666899,_0x604d('0x10'),JSON[_0x604d('0x13')](_0x13a71d));if(_0x13a71d[_0x604d('0x14')]){if(_0x13a71d[_0x604d('0x14')][_0x604d('0x15')]===0x1f4){logger[_0x604d('0x14')](_0x604d('0x16'),_0x666899,_0x13a71d[_0x604d('0x14')][_0x604d('0x17')]);return _0x273725(_0x13a71d[_0x604d('0x14')][_0x604d('0x17')]);}logger['error'](_0x604d('0x16'),_0x666899,_0x13a71d['error'][_0x604d('0x17')]);return _0x2b5d38(_0x13a71d[_0x604d('0x14')][_0x604d('0x17')]);}else{logger['info']('ChatProactiveAction,\x20%s,\x20%s',_0x666899,'request\x20sent');_0x2b5d38(_0x13a71d['result']['message']);}})['catch'](function(_0x15ffd9){logger[_0x604d('0x14')](_0x604d('0x16'),_0x666899,_0x15ffd9);_0x273725(_0x15ffd9);});});} \ No newline at end of file diff --git a/server/api/chatProactiveAction/index.js b/server/api/chatProactiveAction/index.js index ff8cb79..a3491dd 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 _0x6a5c=['delete','destroy','exports','util','express','../../components/auth/service','../../components/interaction/service','../../config/environment','./chatProactiveAction.controller','get','/:id','isAuthenticated','post','put'];(function(_0x29771f,_0x1189ae){var _0x279baf=function(_0xd66325){while(--_0xd66325){_0x29771f['push'](_0x29771f['shift']());}};_0x279baf(++_0x1189ae);}(_0x6a5c,0x9d));var _0xc6a5=function(_0x1da8f5,_0xc052c4){_0x1da8f5=_0x1da8f5-0x0;var _0x2973a4=_0x6a5c[_0x1da8f5];return _0x2973a4;};'use strict';var multer=require('multer');var util=require(_0xc6a5('0x0'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0xc6a5('0x1'));var router=express['Router']();var auth=require(_0xc6a5('0x2'));var interaction=require(_0xc6a5('0x3'));var config=require(_0xc6a5('0x4'));var controller=require(_0xc6a5('0x5'));router[_0xc6a5('0x6')](_0xc6a5('0x7'),auth[_0xc6a5('0x8')](),controller['show']);router[_0xc6a5('0x9')]('/',auth[_0xc6a5('0x8')](),controller['create']);router[_0xc6a5('0xa')]('/:id',auth['isAuthenticated'](),controller['update']);router[_0xc6a5('0xb')](_0xc6a5('0x7'),auth[_0xc6a5('0x8')](),controller[_0xc6a5('0xc')]);module[_0xc6a5('0xd')]=router; \ No newline at end of file +var _0x6580=['destroy','exports','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./chatProactiveAction.controller','get','/:id','isAuthenticated','show','post','put','update','delete'];(function(_0x30ad18,_0x32aa0e){var _0x1222a4=function(_0x1d22c0){while(--_0x1d22c0){_0x30ad18['push'](_0x30ad18['shift']());}};_0x1222a4(++_0x32aa0e);}(_0x6580,0x1b7));var _0x0658=function(_0x26b384,_0x4c688d){_0x26b384=_0x26b384-0x0;var _0x14639f=_0x6580[_0x26b384];return _0x14639f;};'use strict';var multer=require('multer');var util=require(_0x0658('0x0'));var path=require(_0x0658('0x1'));var timeout=require(_0x0658('0x2'));var express=require(_0x0658('0x3'));var router=express[_0x0658('0x4')]();var auth=require(_0x0658('0x5'));var interaction=require(_0x0658('0x6'));var config=require(_0x0658('0x7'));var controller=require(_0x0658('0x8'));router[_0x0658('0x9')](_0x0658('0xa'),auth[_0x0658('0xb')](),controller[_0x0658('0xc')]);router[_0x0658('0xd')]('/',auth[_0x0658('0xb')](),controller['create']);router[_0x0658('0xe')](_0x0658('0xa'),auth['isAuthenticated'](),controller[_0x0658('0xf')]);router[_0x0658('0x10')](_0x0658('0xa'),auth[_0x0658('0xb')](),controller[_0x0658('0x11')]);module[_0x0658('0x12')]=router; \ No newline at end of file diff --git a/server/api/chatQueue/chatQueue.attributes.js b/server/api/chatQueue/chatQueue.attributes.js index c3b7699..5c95a19 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 _0x354a=['ENUM','rrmemory','beepall','roundrobin','sequelize','exports','STRING','name','INTEGER'];(function(_0x3c7a72,_0xb3f316){var _0x578915=function(_0x3b8883){while(--_0x3b8883){_0x3c7a72['push'](_0x3c7a72['shift']());}};_0x578915(++_0xb3f316);}(_0x354a,0x1bd));var _0xa354=function(_0x50972d,_0x1376a9){_0x50972d=_0x50972d-0x0;var _0x334bb8=_0x354a[_0x50972d];return _0x334bb8;};'use strict';var Sequelize=require(_0xa354('0x0'));module[_0xa354('0x1')]={'name':{'type':Sequelize[_0xa354('0x2')],'unique':_0xa354('0x3'),'allowNull':![],'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0xa354('0x2')]},'timeout':{'type':Sequelize[_0xa354('0x4')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0xa354('0x5')](_0xa354('0x6'),_0xa354('0x7'),_0xa354('0x8'))}}; \ No newline at end of file +var _0x78e7=['rrmemory','beepall','roundrobin','sequelize','exports','STRING','INTEGER'];(function(_0x4991d6,_0x348deb){var _0x50faf7=function(_0x14c7f8){while(--_0x14c7f8){_0x4991d6['push'](_0x4991d6['shift']());}};_0x50faf7(++_0x348deb);}(_0x78e7,0x153));var _0x778e=function(_0x44ccbf,_0x5ee6df){_0x44ccbf=_0x44ccbf-0x0;var _0x128644=_0x78e7[_0x44ccbf];return _0x128644;};'use strict';var Sequelize=require(_0x778e('0x0'));module[_0x778e('0x1')]={'name':{'type':Sequelize[_0x778e('0x2')],'unique':'name','allowNull':![],'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize['STRING']},'timeout':{'type':Sequelize[_0x778e('0x3')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize['ENUM'](_0x778e('0x4'),_0x778e('0x5'),_0x778e('0x6'))}}; \ No newline at end of file diff --git a/server/api/chatQueue/chatQueue.controller.js b/server/api/chatQueue/chatQueue.controller.js index 69a96e6..379433d 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 _0x00f0=['order','sort','where','filters','pick','filter','merge','VIRTUAL','options','count','includeAll','include','rows','show','length','find','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','ChatQueues','UserProfileSection','userProfileId','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','params','getMembers','UserChatQueue','hasOwnProperty','ChatQueueId','findAll','User','findAndCountAll','agent','chatPause','updatedAt','format','%s/%s','SIP','createdAt','findOne','Team','getTeams','addTeams','ids','Agents','voicePause','interface','flatMap','transaction','each','findOrCreate','forEach','emit','removeTeams','field','from','team_has_chat_queues','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','clone','ut.UserId\x20=\x20?','push','sequelize','toString','QueryTypes','SELECT','every','TeamId','includes','all','union','compact','isEmpty','removeAgents','userChatQueue:remove','addAgents','omit','spread','userChatQueue:save','getAgents','html-pdf','eml-format','rimraf','zip-dir','moment','mustache','path','sox','ejs','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','defaults','redis','./chatQueue.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','ChatQueue,\x20%s,\x20%s','debug','stringify','error','message','result','catch','sendStatus','status','offset','set','Content-Range','json','apply','save','update','destroy','get','end','name','index','ChatQueue','rawAttributes','fieldName','type','map','keys','model','query','attributes','intersection','fields','nolimit','limit'];(function(_0x2ab801,_0x3d6546){var _0x47a0c8=function(_0x4e9420){while(--_0x4e9420){_0x2ab801['push'](_0x2ab801['shift']());}};_0x47a0c8(++_0x3d6546);}(_0x00f0,0xec));var _0x000f=function(_0x366f46,_0x3fccfa){_0x366f46=_0x366f46-0x0;var _0x44b334=_0x00f0[_0x366f46];return _0x44b334;};'use strict';var pdf=require(_0x000f('0x0'));var emlformat=require(_0x000f('0x1'));var rimraf=require(_0x000f('0x2'));var zipdir=require(_0x000f('0x3'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x000f('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x000f('0x5'));var util=require('util');var path=require(_0x000f('0x6'));var sox=require(_0x000f('0x7'));var csv=require('to-csv');var ejs=require(_0x000f('0x8'));var fs=require('fs');var _=require(_0x000f('0x9'));var squel=require(_0x000f('0xa'));var crypto=require(_0x000f('0xb'));var jsforce=require(_0x000f('0xc'));var deskjs=require(_0x000f('0xd'));var toCsv=require(_0x000f('0xe'));var querystring=require(_0x000f('0xf'));var Papa=require(_0x000f('0x10'));var Redis=require(_0x000f('0x11'));var authService=require(_0x000f('0x12'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x000f('0x13'));var logger=require(_0x000f('0x14'))('api');var utils=require(_0x000f('0x15'));var config=require(_0x000f('0x16'));var db=require('../../mysqldb')['db'];config['redis']=_[_0x000f('0x17')](config[_0x000f('0x18')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x000f('0x18')]));require(_0x000f('0x19'))[_0x000f('0x1a')](socket);var jayson=require(_0x000f('0x1b'));var client=jayson['client'][_0x000f('0x1c')]({'port':0x232a});function checkPasswordPattern(_0x53626f,_0x4a6f6d,_0x3a9e55){if(_0x3a9e55){var _0x4d2b59=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x4d2b59[_0x000f('0x1d')](_0x4a6f6d)){return _0x53626f;}else{throw new db[(_0x000f('0x1e'))][(_0x000f('0x1f'))](_0x000f('0x20'));}}else{return _0x53626f;}}function respondWithRpcPromise(_0x372090,_0x1fb6e9,_0x9cbc29,_0x86ac21){return new BPromise(function(_0x916e22,_0x1e396b){var _0x30161f=_0x86ac21||client;return _0x30161f[_0x000f('0x21')](_0x372090,_0x9cbc29)[_0x000f('0x22')](function(_0x4f0d93){logger[_0x000f('0x23')](_0x000f('0x24'),_0x1fb6e9,'request\x20sent');logger[_0x000f('0x25')]('ChatQueue,\x20%s,\x20%s,\x20%s',_0x1fb6e9,'request\x20sent',JSON[_0x000f('0x26')](_0x4f0d93));if(_0x4f0d93[_0x000f('0x27')]){if(_0x4f0d93[_0x000f('0x27')]['code']===0x1f4){logger['error'](_0x000f('0x24'),_0x1fb6e9,_0x4f0d93[_0x000f('0x27')]['message']);return _0x1e396b(_0x4f0d93[_0x000f('0x27')]['message']);}logger[_0x000f('0x27')]('ChatQueue,\x20%s,\x20%s',_0x1fb6e9,_0x4f0d93[_0x000f('0x27')][_0x000f('0x28')]);return _0x916e22(_0x4f0d93[_0x000f('0x27')][_0x000f('0x28')]);}else{logger[_0x000f('0x23')](_0x000f('0x24'),_0x1fb6e9,'request\x20sent');_0x916e22(_0x4f0d93[_0x000f('0x29')][_0x000f('0x28')]);}})[_0x000f('0x2a')](function(_0x55d962){logger[_0x000f('0x27')](_0x000f('0x24'),_0x1fb6e9,_0x55d962);_0x1e396b(_0x55d962);});});}function respondWithStatusCode(_0x1d541b,_0x513a56){_0x513a56=_0x513a56||0xcc;return function(_0xcc2797){if(_0xcc2797){return _0x1d541b[_0x000f('0x2b')](_0x513a56);}return _0x1d541b[_0x000f('0x2c')](_0x513a56)['end']();};}function respondWithResult(_0x11c2a2,_0x3dfe25){_0x3dfe25=_0x3dfe25||0xc8;return function(_0x42e13f){if(_0x42e13f){return _0x11c2a2[_0x000f('0x2c')](_0x3dfe25)['json'](_0x42e13f);}};}function respondWithFilteredResult(_0x8bc0ff,_0x58dcb2){return function(_0x229252){if(_0x229252){var _0x12c748=_0x229252['count'],_0x3cd2c2=_0x58dcb2[_0x000f('0x2d')],_0x3d8553=_0x58dcb2[_0x000f('0x2d')]+_0x58dcb2['limit'],_0x1532c8;if(_0x3d8553>=_0x12c748){_0x3d8553=_0x12c748;_0x1532c8=0xc8;}else{_0x1532c8=0xce;}_0x8bc0ff[_0x000f('0x2c')](_0x1532c8);return _0x8bc0ff[_0x000f('0x2e')](_0x000f('0x2f'),_0x3cd2c2+'-'+_0x3d8553+'/'+_0x12c748)[_0x000f('0x30')](_0x229252);}return null;};}function patchUpdates(_0x38dfe0){return function(_0x45ff70){try{jsonpatch[_0x000f('0x31')](_0x45ff70,_0x38dfe0,!![]);}catch(_0x2eb573){return BPromise['reject'](_0x2eb573);}return _0x45ff70[_0x000f('0x32')]();};}function saveUpdates(_0x5e827f,_0x509281){return function(_0x1b2436){if(_0x1b2436){return _0x1b2436[_0x000f('0x33')](_0x5e827f)[_0x000f('0x22')](function(_0xe9f8bc){return _0xe9f8bc;});}return null;};}function removeEntity(_0x28c557,_0x2c0d0d){return function(_0x4f22a9){if(_0x4f22a9){return _0x4f22a9[_0x000f('0x34')]()['then'](function(){var _0x49fb07=_0x4f22a9[_0x000f('0x35')]({'plain':!![]});var _0xb501f='ChatQueues';return db['UserProfileResource'][_0x000f('0x34')]({'where':{'type':_0xb501f,'resourceId':_0x49fb07['id']}})['then'](function(){return _0x4f22a9;});})['then'](function(){_0x28c557[_0x000f('0x2c')](0xcc)[_0x000f('0x36')]();});}};}function handleEntityNotFound(_0x1910d9,_0x544175){return function(_0x529f8d){if(!_0x529f8d){_0x1910d9[_0x000f('0x2b')](0x194);}return _0x529f8d;};}function handleError(_0x1718e8,_0xa54f22){_0xa54f22=_0xa54f22||0x1f4;return function(_0xd131bd){logger['error'](_0xd131bd['stack']);if(_0xd131bd[_0x000f('0x37')]){delete _0xd131bd[_0x000f('0x37')];}_0x1718e8['status'](_0xa54f22)['send'](_0xd131bd);};}exports[_0x000f('0x38')]=function(_0x181b01,_0x39aa66){var _0x54c56c={},_0x5ccb1f={},_0x4e4b4d={'count':0x0,'rows':[]};var _0x3d1844=_['map'](db[_0x000f('0x39')][_0x000f('0x3a')],function(_0x35a61c){return{'name':_0x35a61c[_0x000f('0x3b')],'type':_0x35a61c[_0x000f('0x3c')]['key']};});_0x5ccb1f['model']=_[_0x000f('0x3d')](_0x3d1844,_0x000f('0x37'));_0x5ccb1f['query']=_[_0x000f('0x3e')](_0x181b01['query']);_0x5ccb1f['filters']=_['intersection'](_0x5ccb1f[_0x000f('0x3f')],_0x5ccb1f[_0x000f('0x40')]);_0x54c56c[_0x000f('0x41')]=_[_0x000f('0x42')](_0x5ccb1f[_0x000f('0x3f')],qs[_0x000f('0x43')](_0x181b01[_0x000f('0x40')]['fields']));_0x54c56c['attributes']=_0x54c56c[_0x000f('0x41')]['length']?_0x54c56c[_0x000f('0x41')]:_0x5ccb1f[_0x000f('0x3f')];if(!_0x181b01[_0x000f('0x40')]['hasOwnProperty'](_0x000f('0x44'))){_0x54c56c['limit']=qs[_0x000f('0x45')](_0x181b01[_0x000f('0x40')][_0x000f('0x45')]);_0x54c56c['offset']=qs[_0x000f('0x2d')](_0x181b01[_0x000f('0x40')]['offset']);}_0x54c56c[_0x000f('0x46')]=qs[_0x000f('0x47')](_0x181b01[_0x000f('0x40')][_0x000f('0x47')]);_0x54c56c[_0x000f('0x48')]=qs[_0x000f('0x49')](_[_0x000f('0x4a')](_0x181b01['query'],_0x5ccb1f['filters']));if(_0x181b01[_0x000f('0x40')][_0x000f('0x4b')]){_0x54c56c[_0x000f('0x48')]=_[_0x000f('0x4c')](_0x54c56c[_0x000f('0x48')],{'$or':_[_0x000f('0x3d')](_0x3d1844,function(_0x33b4c5){if(_0x33b4c5[_0x000f('0x3c')]!==_0x000f('0x4d')){var _0x2006cb={};_0x2006cb[_0x33b4c5[_0x000f('0x37')]]={'$like':'%'+_0x181b01[_0x000f('0x40')][_0x000f('0x4b')]+'%'};return _0x2006cb;}})});}_0x54c56c=_[_0x000f('0x4c')]({},_0x54c56c,_0x181b01[_0x000f('0x4e')]);var _0x369f60={'where':_0x54c56c[_0x000f('0x48')]};return db[_0x000f('0x39')][_0x000f('0x4f')](_0x369f60)['then'](function(_0xee2a4d){_0x4e4b4d[_0x000f('0x4f')]=_0xee2a4d;if(_0x181b01[_0x000f('0x40')][_0x000f('0x50')]){_0x54c56c[_0x000f('0x51')]=[{'all':!![]}];}return db[_0x000f('0x39')]['findAll'](_0x54c56c);})['then'](function(_0x217cfb){_0x4e4b4d[_0x000f('0x52')]=_0x217cfb;return _0x4e4b4d;})[_0x000f('0x22')](respondWithFilteredResult(_0x39aa66,_0x54c56c))['catch'](handleError(_0x39aa66,null));};exports[_0x000f('0x53')]=function(_0x2123a9,_0x39f204){var _0x2b4a02={'raw':!![],'where':{'id':_0x2123a9['params']['id']}},_0x42e560={};_0x42e560[_0x000f('0x3f')]=_[_0x000f('0x3e')](db[_0x000f('0x39')]['rawAttributes']);_0x42e560[_0x000f('0x40')]=_['keys'](_0x2123a9['query']);_0x42e560[_0x000f('0x49')]=_['intersection'](_0x42e560['model'],_0x42e560[_0x000f('0x40')]);_0x2b4a02[_0x000f('0x41')]=_[_0x000f('0x42')](_0x42e560[_0x000f('0x3f')],qs[_0x000f('0x43')](_0x2123a9['query'][_0x000f('0x43')]));_0x2b4a02[_0x000f('0x41')]=_0x2b4a02[_0x000f('0x41')][_0x000f('0x54')]?_0x2b4a02['attributes']:_0x42e560['model'];if(_0x2123a9[_0x000f('0x40')]['includeAll']){_0x2b4a02[_0x000f('0x51')]=[{'all':!![]}];}_0x2b4a02=_[_0x000f('0x4c')]({},_0x2b4a02,_0x2123a9[_0x000f('0x4e')]);return db['ChatQueue'][_0x000f('0x55')](_0x2b4a02)['then'](handleEntityNotFound(_0x39f204,null))['then'](respondWithResult(_0x39f204,null))[_0x000f('0x2a')](handleError(_0x39f204,null));};exports[_0x000f('0x56')]=function(_0x5927a6,_0x113f9e){return db[_0x000f('0x39')][_0x000f('0x56')](_0x5927a6['body'],{})[_0x000f('0x22')](function(_0x3df5bc){var _0x6a3ed9=_0x5927a6[_0x000f('0x57')][_0x000f('0x35')]({'plain':!![]});if(!_0x6a3ed9)throw new Error(_0x000f('0x58'));if(_0x6a3ed9[_0x000f('0x59')]===_0x000f('0x57')){var _0x154060=_0x3df5bc['get']({'plain':!![]});var _0x57c1c5=_0x000f('0x5a');return db[_0x000f('0x5b')][_0x000f('0x55')]({'where':{'name':_0x57c1c5,'userProfileId':_0x6a3ed9[_0x000f('0x5c')]},'raw':!![]})[_0x000f('0x22')](function(_0x5c902f){if(_0x5c902f&&_0x5c902f[_0x000f('0x5d')]===0x0){return db[_0x000f('0x5e')][_0x000f('0x56')]({'name':_0x154060[_0x000f('0x37')],'resourceId':_0x154060['id'],'type':_0x5c902f[_0x000f('0x37')],'sectionId':_0x5c902f['id']},{})['then'](function(){return _0x3df5bc;});}else{return _0x3df5bc;}})[_0x000f('0x2a')](function(_0x2769d3){logger[_0x000f('0x27')](_0x000f('0x5f'),_0x2769d3);throw _0x2769d3;});}return _0x3df5bc;})[_0x000f('0x22')](respondWithResult(_0x113f9e,0xc9))[_0x000f('0x2a')](handleError(_0x113f9e,null));};exports[_0x000f('0x33')]=function(_0x3cf97e,_0x45dbf8){if(_0x3cf97e[_0x000f('0x60')]['id']){delete _0x3cf97e[_0x000f('0x60')]['id'];}return db[_0x000f('0x39')]['find']({'where':{'id':_0x3cf97e[_0x000f('0x61')]['id']}})['then'](handleEntityNotFound(_0x45dbf8,null))[_0x000f('0x22')](saveUpdates(_0x3cf97e[_0x000f('0x60')],null))[_0x000f('0x22')](respondWithResult(_0x45dbf8,null))[_0x000f('0x2a')](handleError(_0x45dbf8,null));};exports[_0x000f('0x34')]=function(_0x50fa67,_0x21fbd0){return db[_0x000f('0x39')]['find']({'where':{'id':_0x50fa67[_0x000f('0x61')]['id']}})[_0x000f('0x22')](handleEntityNotFound(_0x21fbd0,null))['then'](removeEntity(_0x21fbd0,null))['catch'](handleError(_0x21fbd0,null));};exports['describe']=function(_0x210839,_0x237e78){return db[_0x000f('0x39')]['describe']()[_0x000f('0x22')](respondWithResult(_0x237e78,null))[_0x000f('0x2a')](handleError(_0x237e78,null));};exports[_0x000f('0x62')]=function(_0x1f8745,_0xe65e63,_0x1eb522){var _0x5def39={'raw':!![],'where':{}},_0x10bae4={},_0x3e171d;return db[_0x000f('0x39')]['findOne']({'where':{'id':_0x1f8745[_0x000f('0x61')]['id']}})['then'](handleEntityNotFound(_0xe65e63,null))['then'](function(_0x1deede){if(_0x1deede){_0x3e171d=_0x1deede[_0x000f('0x35')]({'plain':!![]});_0x10bae4[_0x000f('0x3f')]=_['keys'](db[_0x000f('0x63')]['rawAttributes']);_0x10bae4['query']=_[_0x000f('0x3e')](_0x1f8745[_0x000f('0x40')]);_0x10bae4['filters']=_['intersection'](_0x10bae4['model'],_0x10bae4[_0x000f('0x40')]);_0x5def39[_0x000f('0x41')]=_['intersection'](_0x10bae4[_0x000f('0x3f')],qs[_0x000f('0x43')](_0x1f8745[_0x000f('0x40')][_0x000f('0x43')]));_0x5def39[_0x000f('0x41')]=_0x5def39[_0x000f('0x41')][_0x000f('0x54')]?_0x5def39[_0x000f('0x41')]:_0x10bae4[_0x000f('0x3f')];if(!_0x1f8745['query'][_0x000f('0x64')](_0x000f('0x44'))){_0x5def39[_0x000f('0x45')]=qs[_0x000f('0x45')](_0x1f8745[_0x000f('0x40')][_0x000f('0x45')]);_0x5def39[_0x000f('0x2d')]=qs['offset'](_0x1f8745[_0x000f('0x40')][_0x000f('0x2d')]);}_0x5def39['order']=qs[_0x000f('0x47')](_0x1f8745[_0x000f('0x40')][_0x000f('0x47')]);_0x5def39[_0x000f('0x48')]=qs[_0x000f('0x49')](_[_0x000f('0x4a')](_0x1f8745[_0x000f('0x40')],_0x10bae4[_0x000f('0x49')]));_0x5def39['where'][_0x000f('0x65')]=_0x1deede['id'];if(_0x1f8745['query'][_0x000f('0x4b')]){_0x5def39['where']=_['merge'](_0x5def39[_0x000f('0x48')],{'$or':_[_0x000f('0x3d')](_0x5def39['attributes'],function(_0x8b73a8){var _0x7fc37e={};_0x7fc37e[_0x8b73a8]={'$like':'%'+_0x1f8745[_0x000f('0x40')][_0x000f('0x4b')]+'%'};return _0x7fc37e;})});}_0x5def39=_[_0x000f('0x4c')]({},_0x5def39,_0x1f8745[_0x000f('0x4e')]);return db[_0x000f('0x63')][_0x000f('0x66')](_0x5def39);}})[_0x000f('0x22')](function(_0x56d188){if(_0x56d188){return db[_0x000f('0x67')][_0x000f('0x68')]({'where':{'id':_['map'](_0x56d188,'UserId'),'role':_0x000f('0x69')},'attributes':['id','name',_0x000f('0x6a'),_0x000f('0x6b'),'createdAt']});}})['then'](function(_0x3d9e62){if(_0x3d9e62){return{'count':_0x3d9e62[_0x000f('0x4f')],'rows':_[_0x000f('0x3d')](_0x3d9e62[_0x000f('0x52')],function(_0x480d12){return{'membername':_0x480d12['name'],'UserId':_0x480d12['id'],'queue_name':_0x3e171d['name'],'ChatQueueId':_0x3e171d['id'],'interface':util[_0x000f('0x6c')](_0x000f('0x6d'),_0x000f('0x6e'),_0x480d12['name']),'penalty':0x0,'paused':_0x480d12[_0x000f('0x6a')],'createdAt':_0x480d12[_0x000f('0x6f')],'updatedAt':_0x480d12['updatedAt']};})};}else{return{'count':0x0,'rows':[]};}})[_0x000f('0x22')](respondWithFilteredResult(_0xe65e63,_0x5def39))['catch'](handleError(_0xe65e63,null));};exports['getTeams']=function(_0x5c7cc3,_0x255548,_0x1fab4f){var _0x3540ce={};var _0x28d8d3={};var _0x3d2799;var _0x3be204;return db[_0x000f('0x39')][_0x000f('0x70')]({'where':{'id':_0x5c7cc3[_0x000f('0x61')]['id']}})[_0x000f('0x22')](handleEntityNotFound(_0x255548,null))[_0x000f('0x22')](function(_0x4e4b5b){if(_0x4e4b5b){_0x3d2799=_0x4e4b5b;_0x28d8d3[_0x000f('0x3f')]=_[_0x000f('0x3e')](db[_0x000f('0x71')][_0x000f('0x3a')]);_0x28d8d3[_0x000f('0x40')]=_[_0x000f('0x3e')](_0x5c7cc3[_0x000f('0x40')]);_0x28d8d3['filters']=_['intersection'](_0x28d8d3[_0x000f('0x3f')],_0x28d8d3[_0x000f('0x40')]);_0x3540ce['attributes']=_[_0x000f('0x42')](_0x28d8d3[_0x000f('0x3f')],qs[_0x000f('0x43')](_0x5c7cc3[_0x000f('0x40')][_0x000f('0x43')]));_0x3540ce['attributes']=_0x3540ce[_0x000f('0x41')]['length']?_0x3540ce[_0x000f('0x41')]:_0x28d8d3[_0x000f('0x3f')];_0x3540ce[_0x000f('0x46')]=qs[_0x000f('0x47')](_0x5c7cc3[_0x000f('0x40')][_0x000f('0x47')]);_0x3540ce[_0x000f('0x48')]=qs['filters'](_['pick'](_0x5c7cc3[_0x000f('0x40')],_0x28d8d3[_0x000f('0x49')]));if(_0x5c7cc3[_0x000f('0x40')][_0x000f('0x4b')]){_0x3540ce[_0x000f('0x48')]=_[_0x000f('0x4c')](_0x3540ce[_0x000f('0x48')],{'$or':_[_0x000f('0x3d')](_0x3540ce[_0x000f('0x41')],function(_0x278522){var _0x19e44d={};_0x19e44d[_0x278522]={'$like':'%'+_0x5c7cc3['query'][_0x000f('0x4b')]+'%'};return _0x19e44d;})});}_0x3540ce=_[_0x000f('0x4c')]({},_0x3540ce,_0x5c7cc3[_0x000f('0x4e')]);return _0x3d2799['getTeams'](_0x3540ce);}})['then'](function(_0x2e78db){if(_0x2e78db){_0x3be204=_0x2e78db[_0x000f('0x54')];if(!_0x5c7cc3['query']['hasOwnProperty']('nolimit')){_0x3540ce[_0x000f('0x45')]=qs[_0x000f('0x45')](_0x5c7cc3[_0x000f('0x40')]['limit']);_0x3540ce[_0x000f('0x2d')]=qs['offset'](_0x5c7cc3['query']['offset']);}return _0x3d2799[_0x000f('0x72')](_0x3540ce);}})['then'](function(_0xad0617){if(_0xad0617){return _0xad0617?{'count':_0x3be204,'rows':_0xad0617}:null;}})[_0x000f('0x22')](respondWithResult(_0x255548,null))['catch'](handleError(_0x255548,null));};exports[_0x000f('0x73')]=function(_0x9b145d,_0x5b5428,_0x530627){var _0x120feb=_0x9b145d[_0x000f('0x60')][_0x000f('0x74')];return db['Team'][_0x000f('0x66')]({'where':{'id':_0x120feb},'attributes':['id'],'include':[{'model':db['User'],'as':_0x000f('0x75'),'attributes':['id','name','online',_0x000f('0x76'),_0x000f('0x77')],'raw':!![]}]})[_0x000f('0x22')](function(_0x3f79d5){if(_0x3f79d5){var _0xbd4751=_[_0x000f('0x78')](_0x3f79d5,function(_0x422876){var _0x25e740=_0x422876[_0x000f('0x35')]({'plain':!![]});return _0x25e740[_0x000f('0x75')];});return db[_0x000f('0x39')][_0x000f('0x55')]({'where':{'id':_0x9b145d[_0x000f('0x61')]['id']}})[_0x000f('0x22')](function(_0x5f1ab2){return db['sequelize'][_0x000f('0x79')](function(_0x53d047){return _0x5f1ab2[_0x000f('0x73')](_0x120feb,{'transaction':_0x53d047})[_0x000f('0x22')](function(){return BPromise[_0x000f('0x7a')](_0xbd4751,function(_0x5af2d1){return db[_0x000f('0x63')][_0x000f('0x7b')]({'where':{'UserId':_0x5af2d1['id'],'ChatQueueId':_0x9b145d[_0x000f('0x61')]['id']},'transaction':_0x53d047});});})[_0x000f('0x22')](function(){_0xbd4751[_0x000f('0x7c')](function(_0x440231){socket[_0x000f('0x7d')]('userChatQueue:save',{'UserId':_0x440231['id'],'ChatQueueId':_0x5f1ab2['id']});});});});});}})[_0x000f('0x22')](respondWithStatusCode(_0x5b5428,null))[_0x000f('0x2a')](handleError(_0x5b5428,null));};exports[_0x000f('0x7e')]=function(_0x2fa1a8,_0x310853,_0x1151fb){return db[_0x000f('0x71')]['findAll']({'where':{'id':_0x2fa1a8[_0x000f('0x40')][_0x000f('0x74')]},'attributes':['id'],'include':[{'model':db[_0x000f('0x67')],'as':_0x000f('0x75'),'attributes':['id'],'raw':!![]}]})['then'](handleEntityNotFound(_0x310853,null))[_0x000f('0x22')](function(_0x5f51e1){var _0x419206=_[_0x000f('0x3d')](_0x5f51e1,'id');var _0x4c2ec1=[];var _0x174f44=[];var _0x794a13=squel['select']();_0x794a13[_0x000f('0x7f')]('tq.TeamId')[_0x000f('0x80')](_0x000f('0x81'),'tq')['join'](_0x000f('0x82'),'ut',_0x000f('0x83'))['where']('ChatQueueId\x20=\x20?',_0x2fa1a8[_0x000f('0x61')]['id']);for(var _0x1e964f=0x0;_0x1e964f<_0x5f51e1[_0x000f('0x54')];_0x1e964f+=0x1){let _0x2822be=_0x5f51e1[_0x1e964f];for(var _0x59e107=0x0;_0x59e107<_0x2822be[_0x000f('0x75')][_0x000f('0x54')];_0x59e107+=0x1){let _0x230f28=_0x2822be[_0x000f('0x75')][_0x59e107];var _0x4dbe74=_0x794a13[_0x000f('0x84')]();_0x4dbe74[_0x000f('0x48')](_0x000f('0x85'),_0x230f28['id']);_0x174f44[_0x000f('0x86')](db[_0x000f('0x87')][_0x000f('0x40')](_0x4dbe74[_0x000f('0x88')](),{'type':db[_0x000f('0x87')][_0x000f('0x89')][_0x000f('0x8a')]})[_0x000f('0x22')](function(_0x28b0d5){if(_0x28b0d5[_0x000f('0x54')]===0x1){return _0x230f28['id'];}else{var _0x53db27=_[_0x000f('0x8b')](_[_0x000f('0x3d')](_0x28b0d5,_0x000f('0x8c')),function(_0x50fced){return _[_0x000f('0x8d')](_0x419206,_0x50fced);});if(_0x53db27){return _0x230f28['id'];}}}));}}return BPromise[_0x000f('0x8e')](_0x174f44)['then'](function(_0x3385f0){_0x4c2ec1=_(_0x4c2ec1)[_0x000f('0x8f')](_0x3385f0)[_0x000f('0x90')]()['value']();return db[_0x000f('0x39')][_0x000f('0x55')]({'where':{'id':_0x2fa1a8['params']['id']}})[_0x000f('0x22')](function(_0x198ada){return db[_0x000f('0x87')][_0x000f('0x79')](function(_0x140c95){return _0x198ada[_0x000f('0x7e')](_0x2fa1a8[_0x000f('0x40')]['ids'],{'transaction':_0x140c95})['then'](function(){if(!_[_0x000f('0x91')](_0x4c2ec1)){return _0x198ada[_0x000f('0x92')](_0x4c2ec1,{'transaction':_0x140c95});}})['then'](function(){_0x4c2ec1['forEach'](function(_0x1f0b2b){socket[_0x000f('0x7d')](_0x000f('0x93'),{'UserId':_0x1f0b2b,'ChatQueueId':_0x198ada['id']});});});});});});})[_0x000f('0x22')](respondWithStatusCode(_0x310853,null))[_0x000f('0x2a')](handleError(_0x310853,null));};exports[_0x000f('0x94')]=function(_0x873cfb,_0x457f5b,_0xba8561){return db['ChatQueue'][_0x000f('0x55')]({'where':{'id':_0x873cfb['params']['id']}})[_0x000f('0x22')](handleEntityNotFound(_0x457f5b,null))[_0x000f('0x22')](function(_0x2ec63c){if(_0x2ec63c){return _0x2ec63c['addAgents'](_0x873cfb[_0x000f('0x60')][_0x000f('0x74')],_[_0x000f('0x95')](_0x873cfb[_0x000f('0x60')],[_0x000f('0x74'),'id'])||{})[_0x000f('0x96')](function(_0xf47964){for(var _0x5950fd=0x0;_0x5950fd<_0x873cfb['body'][_0x000f('0x74')][_0x000f('0x54')];_0x5950fd+=0x1){socket[_0x000f('0x7d')](_0x000f('0x97'),{'UserId':_0x873cfb[_0x000f('0x60')][_0x000f('0x74')][_0x5950fd],'ChatQueueId':_0x873cfb[_0x000f('0x61')]['id']});}return _0xf47964;});}})[_0x000f('0x22')](respondWithResult(_0x457f5b,null))['catch'](handleError(_0x457f5b,null));};exports[_0x000f('0x92')]=function(_0x1dec87,_0x1d6071,_0x44c065){return db[_0x000f('0x39')][_0x000f('0x55')]({'where':{'id':_0x1dec87['params']['id']}})[_0x000f('0x22')](handleEntityNotFound(_0x1d6071,null))[_0x000f('0x22')](function(_0x1edcdb){if(_0x1edcdb){return _0x1edcdb[_0x000f('0x92')](_0x1dec87['query'][_0x000f('0x74')])[_0x000f('0x22')](function(){if(_['isArray'](_0x1dec87[_0x000f('0x40')][_0x000f('0x74')])){for(var _0x1e9941=0x0;_0x1e9941<_0x1dec87['query'][_0x000f('0x74')][_0x000f('0x54')];_0x1e9941+=0x1){socket['emit']('userChatQueue:remove',{'UserId':Number(_0x1dec87[_0x000f('0x40')][_0x000f('0x74')][_0x1e9941]),'ChatQueueId':Number(_0x1dec87[_0x000f('0x61')]['id'])});}}else{socket[_0x000f('0x7d')]('userChatQueue:remove',{'UserId':Number(_0x1dec87[_0x000f('0x40')]['ids']),'ChatQueueId':Number(_0x1dec87['params']['id'])});}});}})[_0x000f('0x22')](respondWithStatusCode(_0x1d6071,null))['catch'](handleError(_0x1d6071,null));};exports[_0x000f('0x98')]=function(_0xfd555e,_0x157b0a,_0x35c18e){var _0x47fc77={};var _0x5b53b0={};var _0x699487;var _0x59e294;return db[_0x000f('0x39')][_0x000f('0x70')]({'where':{'id':_0xfd555e[_0x000f('0x61')]['id']}})[_0x000f('0x22')](handleEntityNotFound(_0x157b0a,null))[_0x000f('0x22')](function(_0x54a47b){if(_0x54a47b){_0x699487=_0x54a47b;_0x5b53b0[_0x000f('0x3f')]=_[_0x000f('0x3e')](db[_0x000f('0x67')][_0x000f('0x3a')]);_0x5b53b0[_0x000f('0x40')]=_[_0x000f('0x3e')](_0xfd555e[_0x000f('0x40')]);_0x5b53b0[_0x000f('0x49')]=_[_0x000f('0x42')](_0x5b53b0['model'],_0x5b53b0['query']);_0x47fc77[_0x000f('0x41')]=_[_0x000f('0x42')](_0x5b53b0[_0x000f('0x3f')],qs[_0x000f('0x43')](_0xfd555e['query']['fields']));_0x47fc77[_0x000f('0x41')]=_0x47fc77[_0x000f('0x41')][_0x000f('0x54')]?_0x47fc77[_0x000f('0x41')]:_0x5b53b0[_0x000f('0x3f')];_0x47fc77[_0x000f('0x46')]=qs[_0x000f('0x47')](_0xfd555e[_0x000f('0x40')][_0x000f('0x47')]);_0x47fc77[_0x000f('0x48')]=qs[_0x000f('0x49')](_['pick'](_0xfd555e['query'],_0x5b53b0[_0x000f('0x49')]));if(_0xfd555e[_0x000f('0x40')][_0x000f('0x4b')]){_0x47fc77[_0x000f('0x48')]=_[_0x000f('0x4c')](_0x47fc77['where'],{'$or':_['map'](_0x47fc77['attributes'],function(_0xf86a43){var _0x2a251d={};_0x2a251d[_0xf86a43]={'$like':'%'+_0xfd555e[_0x000f('0x40')][_0x000f('0x4b')]+'%'};return _0x2a251d;})});}_0x47fc77=_[_0x000f('0x4c')]({},_0x47fc77,_0xfd555e[_0x000f('0x4e')]);return _0x699487[_0x000f('0x98')](_0x47fc77);}})[_0x000f('0x22')](function(_0x5aad11){if(_0x5aad11){_0x59e294=_0x5aad11[_0x000f('0x54')];if(!_0xfd555e[_0x000f('0x40')][_0x000f('0x64')](_0x000f('0x44'))){_0x47fc77['limit']=qs[_0x000f('0x45')](_0xfd555e[_0x000f('0x40')]['limit']);_0x47fc77[_0x000f('0x2d')]=qs[_0x000f('0x2d')](_0xfd555e['query']['offset']);}return _0x699487[_0x000f('0x98')](_0x47fc77);}})['then'](function(_0x2346a5){if(_0x2346a5){return _0x2346a5?{'count':_0x59e294,'rows':_0x2346a5}:null;}})[_0x000f('0x22')](respondWithResult(_0x157b0a,null))['catch'](handleError(_0x157b0a,null));}; \ No newline at end of file +var _0x3f35=['getAgents','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','path','to-csv','ejs','lodash','squel','jsforce','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/logger','api','../../mysqldb','redis','./chatQueue.socket','client','test','Sequelize','ValidationError','request','then','info','ChatQueue,\x20%s,\x20%s','debug','ChatQueue,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','sendStatus','status','end','json','offset','set','apply','reject','update','destroy','get','ChatQueues','stack','name','send','map','ChatQueue','rawAttributes','key','keys','query','filters','intersection','model','attributes','fields','length','nolimit','limit','order','sort','where','pick','filter','merge','options','count','includeAll','include','findAll','rows','catch','show','params','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','getMembers','findOne','hasOwnProperty','UserChatQueue','findAndCountAll','UserId','agent','updatedAt','createdAt','format','%s/%s','SIP','chatPause','getTeams','Team','addTeams','ids','User','Agents','online','interface','sequelize','transaction','each','forEach','emit','userChatQueue:save','removeTeams','select','field','from','join','user_has_teams','ChatQueueId\x20=\x20?','clone','ut.UserId\x20=\x20?','push','toString','SELECT','every','TeamId','union','compact','value','isEmpty','removeAgents','userChatQueue:remove','addAgents','spread','isArray'];(function(_0x519c88,_0xb84103){var _0x4668d7=function(_0x596c2c){while(--_0x596c2c){_0x519c88['push'](_0x519c88['shift']());}};_0x4668d7(++_0xb84103);}(_0x3f35,0x1ae));var _0x53f3=function(_0x3e3bee,_0x4f91fe){_0x3e3bee=_0x3e3bee-0x0;var _0x3ae14c=_0x3f35[_0x3e3bee];return _0x3ae14c;};'use strict';var pdf=require(_0x53f3('0x0'));var emlformat=require(_0x53f3('0x1'));var rimraf=require(_0x53f3('0x2'));var zipdir=require(_0x53f3('0x3'));var jsonpatch=require(_0x53f3('0x4'));var rp=require(_0x53f3('0x5'));var moment=require(_0x53f3('0x6'));var BPromise=require('bluebird');var Mustache=require(_0x53f3('0x7'));var util=require('util');var path=require(_0x53f3('0x8'));var sox=require('sox');var csv=require(_0x53f3('0x9'));var ejs=require(_0x53f3('0xa'));var fs=require('fs');var _=require(_0x53f3('0xb'));var squel=require(_0x53f3('0xc'));var crypto=require('crypto');var jsforce=require(_0x53f3('0xd'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x53f3('0xe'));var Redis=require(_0x53f3('0xf'));var authService=require(_0x53f3('0x10'));var qs=require(_0x53f3('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x53f3('0x12'))(_0x53f3('0x13'));var utils=require('../../config/utils');var config=require('../../config/environment');var db=require(_0x53f3('0x14'))['db'];config['redis']=_['defaults'](config[_0x53f3('0x15')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x53f3('0x15')]));require(_0x53f3('0x16'))['register'](socket);var jayson=require('jayson/promise');var client=jayson[_0x53f3('0x17')]['http']({'port':0x232a});function checkPasswordPattern(_0x170927,_0x3d485c,_0x27db9a){if(_0x27db9a){var _0x2319cd=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x2319cd[_0x53f3('0x18')](_0x3d485c)){return _0x170927;}else{throw new db[(_0x53f3('0x19'))][(_0x53f3('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 _0x170927;}}function respondWithRpcPromise(_0x3da977,_0x1d2319,_0x1cb1bd,_0x5ae118){return new BPromise(function(_0x5ea5e7,_0x924dae){var _0x5db09c=_0x5ae118||client;return _0x5db09c[_0x53f3('0x1b')](_0x3da977,_0x1cb1bd)[_0x53f3('0x1c')](function(_0x58c850){logger[_0x53f3('0x1d')](_0x53f3('0x1e'),_0x1d2319,'request\x20sent');logger[_0x53f3('0x1f')](_0x53f3('0x20'),_0x1d2319,_0x53f3('0x21'),JSON[_0x53f3('0x22')](_0x58c850));if(_0x58c850[_0x53f3('0x23')]){if(_0x58c850[_0x53f3('0x23')]['code']===0x1f4){logger[_0x53f3('0x23')](_0x53f3('0x1e'),_0x1d2319,_0x58c850[_0x53f3('0x23')][_0x53f3('0x24')]);return _0x924dae(_0x58c850[_0x53f3('0x23')]['message']);}logger[_0x53f3('0x23')](_0x53f3('0x1e'),_0x1d2319,_0x58c850[_0x53f3('0x23')][_0x53f3('0x24')]);return _0x5ea5e7(_0x58c850[_0x53f3('0x23')][_0x53f3('0x24')]);}else{logger['info'](_0x53f3('0x1e'),_0x1d2319,'request\x20sent');_0x5ea5e7(_0x58c850['result'][_0x53f3('0x24')]);}})['catch'](function(_0x1772da){logger[_0x53f3('0x23')](_0x53f3('0x1e'),_0x1d2319,_0x1772da);_0x924dae(_0x1772da);});});}function respondWithStatusCode(_0x547474,_0x4e68ca){_0x4e68ca=_0x4e68ca||0xcc;return function(_0x1dcd1d){if(_0x1dcd1d){return _0x547474[_0x53f3('0x25')](_0x4e68ca);}return _0x547474[_0x53f3('0x26')](_0x4e68ca)[_0x53f3('0x27')]();};}function respondWithResult(_0x173bf8,_0x5a4b2f){_0x5a4b2f=_0x5a4b2f||0xc8;return function(_0x1b172b){if(_0x1b172b){return _0x173bf8[_0x53f3('0x26')](_0x5a4b2f)[_0x53f3('0x28')](_0x1b172b);}};}function respondWithFilteredResult(_0x17f510,_0x5cb283){return function(_0xdaa8f0){if(_0xdaa8f0){var _0x3d405e=_0xdaa8f0['count'],_0x5afd83=_0x5cb283[_0x53f3('0x29')],_0x2ebf51=_0x5cb283[_0x53f3('0x29')]+_0x5cb283['limit'],_0x50ac51;if(_0x2ebf51>=_0x3d405e){_0x2ebf51=_0x3d405e;_0x50ac51=0xc8;}else{_0x50ac51=0xce;}_0x17f510['status'](_0x50ac51);return _0x17f510[_0x53f3('0x2a')]('Content-Range',_0x5afd83+'-'+_0x2ebf51+'/'+_0x3d405e)[_0x53f3('0x28')](_0xdaa8f0);}return null;};}function patchUpdates(_0x351f59){return function(_0x326a61){try{jsonpatch[_0x53f3('0x2b')](_0x326a61,_0x351f59,!![]);}catch(_0x229a09){return BPromise[_0x53f3('0x2c')](_0x229a09);}return _0x326a61['save']();};}function saveUpdates(_0x5a7607,_0x54bad4){return function(_0x11c604){if(_0x11c604){return _0x11c604[_0x53f3('0x2d')](_0x5a7607)[_0x53f3('0x1c')](function(_0x14a572){return _0x14a572;});}return null;};}function removeEntity(_0x4a7e8c,_0x17d1e0){return function(_0x496853){if(_0x496853){return _0x496853[_0x53f3('0x2e')]()[_0x53f3('0x1c')](function(){var _0x150f19=_0x496853[_0x53f3('0x2f')]({'plain':!![]});var _0x5d2b47=_0x53f3('0x30');return db['UserProfileResource'][_0x53f3('0x2e')]({'where':{'type':_0x5d2b47,'resourceId':_0x150f19['id']}})['then'](function(){return _0x496853;});})['then'](function(){_0x4a7e8c['status'](0xcc)[_0x53f3('0x27')]();});}};}function handleEntityNotFound(_0xd3ea00,_0x490d4c){return function(_0x5327fa){if(!_0x5327fa){_0xd3ea00[_0x53f3('0x25')](0x194);}return _0x5327fa;};}function handleError(_0x5cd096,_0x18127c){_0x18127c=_0x18127c||0x1f4;return function(_0x508ffe){logger['error'](_0x508ffe[_0x53f3('0x31')]);if(_0x508ffe['name']){delete _0x508ffe[_0x53f3('0x32')];}_0x5cd096[_0x53f3('0x26')](_0x18127c)[_0x53f3('0x33')](_0x508ffe);};}exports['index']=function(_0x3ea689,_0x1ececa){var _0x502ff1={},_0x17d143={},_0x52ee4c={'count':0x0,'rows':[]};var _0x23b1a0=_[_0x53f3('0x34')](db[_0x53f3('0x35')][_0x53f3('0x36')],function(_0x257bb9){return{'name':_0x257bb9['fieldName'],'type':_0x257bb9['type'][_0x53f3('0x37')]};});_0x17d143['model']=_[_0x53f3('0x34')](_0x23b1a0,_0x53f3('0x32'));_0x17d143['query']=_[_0x53f3('0x38')](_0x3ea689[_0x53f3('0x39')]);_0x17d143[_0x53f3('0x3a')]=_[_0x53f3('0x3b')](_0x17d143[_0x53f3('0x3c')],_0x17d143[_0x53f3('0x39')]);_0x502ff1[_0x53f3('0x3d')]=_['intersection'](_0x17d143[_0x53f3('0x3c')],qs[_0x53f3('0x3e')](_0x3ea689[_0x53f3('0x39')][_0x53f3('0x3e')]));_0x502ff1[_0x53f3('0x3d')]=_0x502ff1['attributes'][_0x53f3('0x3f')]?_0x502ff1[_0x53f3('0x3d')]:_0x17d143[_0x53f3('0x3c')];if(!_0x3ea689['query']['hasOwnProperty'](_0x53f3('0x40'))){_0x502ff1[_0x53f3('0x41')]=qs['limit'](_0x3ea689['query'][_0x53f3('0x41')]);_0x502ff1['offset']=qs[_0x53f3('0x29')](_0x3ea689[_0x53f3('0x39')][_0x53f3('0x29')]);}_0x502ff1[_0x53f3('0x42')]=qs[_0x53f3('0x43')](_0x3ea689[_0x53f3('0x39')][_0x53f3('0x43')]);_0x502ff1[_0x53f3('0x44')]=qs[_0x53f3('0x3a')](_[_0x53f3('0x45')](_0x3ea689['query'],_0x17d143[_0x53f3('0x3a')]));if(_0x3ea689[_0x53f3('0x39')][_0x53f3('0x46')]){_0x502ff1[_0x53f3('0x44')]=_[_0x53f3('0x47')](_0x502ff1[_0x53f3('0x44')],{'$or':_['map'](_0x23b1a0,function(_0x5cb4ea){if(_0x5cb4ea['type']!=='VIRTUAL'){var _0xce0421={};_0xce0421[_0x5cb4ea[_0x53f3('0x32')]]={'$like':'%'+_0x3ea689[_0x53f3('0x39')][_0x53f3('0x46')]+'%'};return _0xce0421;}})});}_0x502ff1=_[_0x53f3('0x47')]({},_0x502ff1,_0x3ea689[_0x53f3('0x48')]);var _0x3ebc84={'where':_0x502ff1[_0x53f3('0x44')]};return db[_0x53f3('0x35')][_0x53f3('0x49')](_0x3ebc84)[_0x53f3('0x1c')](function(_0x532641){_0x52ee4c['count']=_0x532641;if(_0x3ea689[_0x53f3('0x39')][_0x53f3('0x4a')]){_0x502ff1[_0x53f3('0x4b')]=[{'all':!![]}];}return db[_0x53f3('0x35')][_0x53f3('0x4c')](_0x502ff1);})[_0x53f3('0x1c')](function(_0x347ea3){_0x52ee4c[_0x53f3('0x4d')]=_0x347ea3;return _0x52ee4c;})[_0x53f3('0x1c')](respondWithFilteredResult(_0x1ececa,_0x502ff1))[_0x53f3('0x4e')](handleError(_0x1ececa,null));};exports[_0x53f3('0x4f')]=function(_0x433fb3,_0x592e3f){var _0x46bb78={'raw':!![],'where':{'id':_0x433fb3[_0x53f3('0x50')]['id']}},_0x13c1b6={};_0x13c1b6['model']=_[_0x53f3('0x38')](db[_0x53f3('0x35')][_0x53f3('0x36')]);_0x13c1b6['query']=_[_0x53f3('0x38')](_0x433fb3[_0x53f3('0x39')]);_0x13c1b6[_0x53f3('0x3a')]=_[_0x53f3('0x3b')](_0x13c1b6[_0x53f3('0x3c')],_0x13c1b6['query']);_0x46bb78[_0x53f3('0x3d')]=_['intersection'](_0x13c1b6[_0x53f3('0x3c')],qs[_0x53f3('0x3e')](_0x433fb3[_0x53f3('0x39')][_0x53f3('0x3e')]));_0x46bb78[_0x53f3('0x3d')]=_0x46bb78['attributes'][_0x53f3('0x3f')]?_0x46bb78[_0x53f3('0x3d')]:_0x13c1b6['model'];if(_0x433fb3[_0x53f3('0x39')][_0x53f3('0x4a')]){_0x46bb78['include']=[{'all':!![]}];}_0x46bb78=_[_0x53f3('0x47')]({},_0x46bb78,_0x433fb3[_0x53f3('0x48')]);return db[_0x53f3('0x35')][_0x53f3('0x51')](_0x46bb78)[_0x53f3('0x1c')](handleEntityNotFound(_0x592e3f,null))[_0x53f3('0x1c')](respondWithResult(_0x592e3f,null))[_0x53f3('0x4e')](handleError(_0x592e3f,null));};exports[_0x53f3('0x52')]=function(_0x4ef251,_0x7f773e){return db[_0x53f3('0x35')][_0x53f3('0x52')](_0x4ef251[_0x53f3('0x53')],{})[_0x53f3('0x1c')](function(_0x187e56){var _0x38e855=_0x4ef251[_0x53f3('0x54')][_0x53f3('0x2f')]({'plain':!![]});if(!_0x38e855)throw new Error(_0x53f3('0x55'));if(_0x38e855[_0x53f3('0x56')]===_0x53f3('0x54')){var _0x303204=_0x187e56[_0x53f3('0x2f')]({'plain':!![]});var _0x17508a=_0x53f3('0x30');return db[_0x53f3('0x57')][_0x53f3('0x51')]({'where':{'name':_0x17508a,'userProfileId':_0x38e855['userProfileId']},'raw':!![]})[_0x53f3('0x1c')](function(_0x3513bf){if(_0x3513bf&&_0x3513bf[_0x53f3('0x58')]===0x0){return db[_0x53f3('0x59')][_0x53f3('0x52')]({'name':_0x303204[_0x53f3('0x32')],'resourceId':_0x303204['id'],'type':_0x3513bf[_0x53f3('0x32')],'sectionId':_0x3513bf['id']},{})['then'](function(){return _0x187e56;});}else{return _0x187e56;}})[_0x53f3('0x4e')](function(_0x25b8a3){logger['error'](_0x53f3('0x5a'),_0x25b8a3);throw _0x25b8a3;});}return _0x187e56;})[_0x53f3('0x1c')](respondWithResult(_0x7f773e,0xc9))[_0x53f3('0x4e')](handleError(_0x7f773e,null));};exports[_0x53f3('0x2d')]=function(_0x3feb9,_0x26a3f0){if(_0x3feb9[_0x53f3('0x53')]['id']){delete _0x3feb9['body']['id'];}return db[_0x53f3('0x35')]['find']({'where':{'id':_0x3feb9[_0x53f3('0x50')]['id']}})[_0x53f3('0x1c')](handleEntityNotFound(_0x26a3f0,null))[_0x53f3('0x1c')](saveUpdates(_0x3feb9['body'],null))[_0x53f3('0x1c')](respondWithResult(_0x26a3f0,null))[_0x53f3('0x4e')](handleError(_0x26a3f0,null));};exports['destroy']=function(_0x374362,_0x3d5f8e){return db[_0x53f3('0x35')]['find']({'where':{'id':_0x374362['params']['id']}})[_0x53f3('0x1c')](handleEntityNotFound(_0x3d5f8e,null))[_0x53f3('0x1c')](removeEntity(_0x3d5f8e,null))[_0x53f3('0x4e')](handleError(_0x3d5f8e,null));};exports[_0x53f3('0x5b')]=function(_0x443238,_0xf4c9a0){return db[_0x53f3('0x35')]['describe']()['then'](respondWithResult(_0xf4c9a0,null))[_0x53f3('0x4e')](handleError(_0xf4c9a0,null));};exports[_0x53f3('0x5c')]=function(_0x57c78c,_0x12729a,_0x86b89b){var _0x23195f={'raw':!![],'where':{}},_0x50d596={},_0x5b2e4e;return db[_0x53f3('0x35')][_0x53f3('0x5d')]({'where':{'id':_0x57c78c[_0x53f3('0x50')]['id']}})[_0x53f3('0x1c')](handleEntityNotFound(_0x12729a,null))[_0x53f3('0x1c')](function(_0x37b646){if(_0x37b646){_0x5b2e4e=_0x37b646[_0x53f3('0x2f')]({'plain':!![]});_0x50d596[_0x53f3('0x3c')]=_[_0x53f3('0x38')](db['UserChatQueue']['rawAttributes']);_0x50d596[_0x53f3('0x39')]=_[_0x53f3('0x38')](_0x57c78c['query']);_0x50d596[_0x53f3('0x3a')]=_[_0x53f3('0x3b')](_0x50d596[_0x53f3('0x3c')],_0x50d596[_0x53f3('0x39')]);_0x23195f[_0x53f3('0x3d')]=_[_0x53f3('0x3b')](_0x50d596[_0x53f3('0x3c')],qs[_0x53f3('0x3e')](_0x57c78c['query'][_0x53f3('0x3e')]));_0x23195f[_0x53f3('0x3d')]=_0x23195f[_0x53f3('0x3d')][_0x53f3('0x3f')]?_0x23195f[_0x53f3('0x3d')]:_0x50d596[_0x53f3('0x3c')];if(!_0x57c78c[_0x53f3('0x39')][_0x53f3('0x5e')](_0x53f3('0x40'))){_0x23195f[_0x53f3('0x41')]=qs[_0x53f3('0x41')](_0x57c78c[_0x53f3('0x39')][_0x53f3('0x41')]);_0x23195f[_0x53f3('0x29')]=qs[_0x53f3('0x29')](_0x57c78c[_0x53f3('0x39')][_0x53f3('0x29')]);}_0x23195f[_0x53f3('0x42')]=qs[_0x53f3('0x43')](_0x57c78c[_0x53f3('0x39')]['sort']);_0x23195f[_0x53f3('0x44')]=qs[_0x53f3('0x3a')](_[_0x53f3('0x45')](_0x57c78c[_0x53f3('0x39')],_0x50d596[_0x53f3('0x3a')]));_0x23195f[_0x53f3('0x44')]['ChatQueueId']=_0x37b646['id'];if(_0x57c78c[_0x53f3('0x39')][_0x53f3('0x46')]){_0x23195f['where']=_[_0x53f3('0x47')](_0x23195f[_0x53f3('0x44')],{'$or':_[_0x53f3('0x34')](_0x23195f[_0x53f3('0x3d')],function(_0x59df9c){var _0x4ea5b6={};_0x4ea5b6[_0x59df9c]={'$like':'%'+_0x57c78c[_0x53f3('0x39')]['filter']+'%'};return _0x4ea5b6;})});}_0x23195f=_[_0x53f3('0x47')]({},_0x23195f,_0x57c78c[_0x53f3('0x48')]);return db[_0x53f3('0x5f')][_0x53f3('0x4c')](_0x23195f);}})[_0x53f3('0x1c')](function(_0x2ad693){if(_0x2ad693){return db['User'][_0x53f3('0x60')]({'where':{'id':_[_0x53f3('0x34')](_0x2ad693,_0x53f3('0x61')),'role':_0x53f3('0x62')},'attributes':['id',_0x53f3('0x32'),'chatPause',_0x53f3('0x63'),_0x53f3('0x64')]});}})['then'](function(_0x4be28f){if(_0x4be28f){return{'count':_0x4be28f['count'],'rows':_[_0x53f3('0x34')](_0x4be28f[_0x53f3('0x4d')],function(_0x38b312){return{'membername':_0x38b312[_0x53f3('0x32')],'UserId':_0x38b312['id'],'queue_name':_0x5b2e4e['name'],'ChatQueueId':_0x5b2e4e['id'],'interface':util[_0x53f3('0x65')](_0x53f3('0x66'),_0x53f3('0x67'),_0x38b312['name']),'penalty':0x0,'paused':_0x38b312[_0x53f3('0x68')],'createdAt':_0x38b312[_0x53f3('0x64')],'updatedAt':_0x38b312[_0x53f3('0x63')]};})};}else{return{'count':0x0,'rows':[]};}})[_0x53f3('0x1c')](respondWithFilteredResult(_0x12729a,_0x23195f))[_0x53f3('0x4e')](handleError(_0x12729a,null));};exports[_0x53f3('0x69')]=function(_0xbc5b03,_0x410be9,_0x317967){var _0x334c85={};var _0x3a3f85={};var _0x17c8b5;var _0x2e147f;return db[_0x53f3('0x35')][_0x53f3('0x5d')]({'where':{'id':_0xbc5b03[_0x53f3('0x50')]['id']}})[_0x53f3('0x1c')](handleEntityNotFound(_0x410be9,null))[_0x53f3('0x1c')](function(_0xa52a7e){if(_0xa52a7e){_0x17c8b5=_0xa52a7e;_0x3a3f85[_0x53f3('0x3c')]=_[_0x53f3('0x38')](db[_0x53f3('0x6a')]['rawAttributes']);_0x3a3f85[_0x53f3('0x39')]=_[_0x53f3('0x38')](_0xbc5b03[_0x53f3('0x39')]);_0x3a3f85[_0x53f3('0x3a')]=_[_0x53f3('0x3b')](_0x3a3f85[_0x53f3('0x3c')],_0x3a3f85[_0x53f3('0x39')]);_0x334c85[_0x53f3('0x3d')]=_[_0x53f3('0x3b')](_0x3a3f85[_0x53f3('0x3c')],qs['fields'](_0xbc5b03[_0x53f3('0x39')][_0x53f3('0x3e')]));_0x334c85[_0x53f3('0x3d')]=_0x334c85['attributes'][_0x53f3('0x3f')]?_0x334c85[_0x53f3('0x3d')]:_0x3a3f85[_0x53f3('0x3c')];_0x334c85[_0x53f3('0x42')]=qs[_0x53f3('0x43')](_0xbc5b03[_0x53f3('0x39')][_0x53f3('0x43')]);_0x334c85[_0x53f3('0x44')]=qs[_0x53f3('0x3a')](_[_0x53f3('0x45')](_0xbc5b03['query'],_0x3a3f85[_0x53f3('0x3a')]));if(_0xbc5b03[_0x53f3('0x39')][_0x53f3('0x46')]){_0x334c85[_0x53f3('0x44')]=_['merge'](_0x334c85[_0x53f3('0x44')],{'$or':_[_0x53f3('0x34')](_0x334c85[_0x53f3('0x3d')],function(_0x1770fc){var _0x11ced7={};_0x11ced7[_0x1770fc]={'$like':'%'+_0xbc5b03['query'][_0x53f3('0x46')]+'%'};return _0x11ced7;})});}_0x334c85=_[_0x53f3('0x47')]({},_0x334c85,_0xbc5b03[_0x53f3('0x48')]);return _0x17c8b5[_0x53f3('0x69')](_0x334c85);}})[_0x53f3('0x1c')](function(_0x2d87d3){if(_0x2d87d3){_0x2e147f=_0x2d87d3['length'];if(!_0xbc5b03[_0x53f3('0x39')][_0x53f3('0x5e')](_0x53f3('0x40'))){_0x334c85[_0x53f3('0x41')]=qs[_0x53f3('0x41')](_0xbc5b03[_0x53f3('0x39')][_0x53f3('0x41')]);_0x334c85[_0x53f3('0x29')]=qs[_0x53f3('0x29')](_0xbc5b03[_0x53f3('0x39')][_0x53f3('0x29')]);}return _0x17c8b5['getTeams'](_0x334c85);}})[_0x53f3('0x1c')](function(_0x1db3c2){if(_0x1db3c2){return _0x1db3c2?{'count':_0x2e147f,'rows':_0x1db3c2}:null;}})[_0x53f3('0x1c')](respondWithResult(_0x410be9,null))[_0x53f3('0x4e')](handleError(_0x410be9,null));};exports[_0x53f3('0x6b')]=function(_0x5d90b3,_0x179504,_0x56cdae){var _0x51a6e4=_0x5d90b3['body'][_0x53f3('0x6c')];return db[_0x53f3('0x6a')]['findAll']({'where':{'id':_0x51a6e4},'attributes':['id'],'include':[{'model':db[_0x53f3('0x6d')],'as':_0x53f3('0x6e'),'attributes':['id',_0x53f3('0x32'),_0x53f3('0x6f'),'voicePause',_0x53f3('0x70')],'raw':!![]}]})[_0x53f3('0x1c')](function(_0x1c9102){if(_0x1c9102){var _0x1fdacd=_['flatMap'](_0x1c9102,function(_0x5ecc6e){var _0x37703d=_0x5ecc6e[_0x53f3('0x2f')]({'plain':!![]});return _0x37703d['Agents'];});return db[_0x53f3('0x35')][_0x53f3('0x51')]({'where':{'id':_0x5d90b3[_0x53f3('0x50')]['id']}})[_0x53f3('0x1c')](function(_0xff878d){return db[_0x53f3('0x71')][_0x53f3('0x72')](function(_0x3a1f21){return _0xff878d[_0x53f3('0x6b')](_0x51a6e4,{'transaction':_0x3a1f21})[_0x53f3('0x1c')](function(){return BPromise[_0x53f3('0x73')](_0x1fdacd,function(_0x17832){return db[_0x53f3('0x5f')]['findOrCreate']({'where':{'UserId':_0x17832['id'],'ChatQueueId':_0x5d90b3[_0x53f3('0x50')]['id']},'transaction':_0x3a1f21});});})['then'](function(){_0x1fdacd[_0x53f3('0x74')](function(_0x1bf73b){socket[_0x53f3('0x75')](_0x53f3('0x76'),{'UserId':_0x1bf73b['id'],'ChatQueueId':_0xff878d['id']});});});});});}})[_0x53f3('0x1c')](respondWithStatusCode(_0x179504,null))[_0x53f3('0x4e')](handleError(_0x179504,null));};exports[_0x53f3('0x77')]=function(_0x53f0e2,_0x3620a2,_0x1db878){return db[_0x53f3('0x6a')]['findAll']({'where':{'id':_0x53f0e2['query']['ids']},'attributes':['id'],'include':[{'model':db[_0x53f3('0x6d')],'as':_0x53f3('0x6e'),'attributes':['id'],'raw':!![]}]})[_0x53f3('0x1c')](handleEntityNotFound(_0x3620a2,null))[_0x53f3('0x1c')](function(_0x40a013){var _0x29457b=_[_0x53f3('0x34')](_0x40a013,'id');var _0x14599b=[];var _0x1d3311=[];var _0x492c89=squel[_0x53f3('0x78')]();_0x492c89[_0x53f3('0x79')]('tq.TeamId')[_0x53f3('0x7a')]('team_has_chat_queues','tq')[_0x53f3('0x7b')](_0x53f3('0x7c'),'ut','ut.TeamId\x20=\x20tq.TeamId')[_0x53f3('0x44')](_0x53f3('0x7d'),_0x53f0e2[_0x53f3('0x50')]['id']);for(var _0x4adc87=0x0;_0x4adc87<_0x40a013[_0x53f3('0x3f')];_0x4adc87+=0x1){let _0x540ae3=_0x40a013[_0x4adc87];for(var _0x241809=0x0;_0x241809<_0x540ae3[_0x53f3('0x6e')][_0x53f3('0x3f')];_0x241809+=0x1){let _0x4bf1c9=_0x540ae3[_0x53f3('0x6e')][_0x241809];var _0xeeba0d=_0x492c89[_0x53f3('0x7e')]();_0xeeba0d[_0x53f3('0x44')](_0x53f3('0x7f'),_0x4bf1c9['id']);_0x1d3311[_0x53f3('0x80')](db[_0x53f3('0x71')][_0x53f3('0x39')](_0xeeba0d[_0x53f3('0x81')](),{'type':db[_0x53f3('0x71')]['QueryTypes'][_0x53f3('0x82')]})[_0x53f3('0x1c')](function(_0x1807b8){if(_0x1807b8['length']===0x1){return _0x4bf1c9['id'];}else{var _0x6126cf=_[_0x53f3('0x83')](_[_0x53f3('0x34')](_0x1807b8,_0x53f3('0x84')),function(_0x3ad6ef){return _['includes'](_0x29457b,_0x3ad6ef);});if(_0x6126cf){return _0x4bf1c9['id'];}}}));}}return BPromise['all'](_0x1d3311)[_0x53f3('0x1c')](function(_0x279112){_0x14599b=_(_0x14599b)[_0x53f3('0x85')](_0x279112)[_0x53f3('0x86')]()[_0x53f3('0x87')]();return db[_0x53f3('0x35')][_0x53f3('0x51')]({'where':{'id':_0x53f0e2[_0x53f3('0x50')]['id']}})['then'](function(_0x1e7738){return db[_0x53f3('0x71')]['transaction'](function(_0x5f4a44){return _0x1e7738[_0x53f3('0x77')](_0x53f0e2['query']['ids'],{'transaction':_0x5f4a44})[_0x53f3('0x1c')](function(){if(!_[_0x53f3('0x88')](_0x14599b)){return _0x1e7738[_0x53f3('0x89')](_0x14599b,{'transaction':_0x5f4a44});}})[_0x53f3('0x1c')](function(){_0x14599b[_0x53f3('0x74')](function(_0xacf6dc){socket[_0x53f3('0x75')](_0x53f3('0x8a'),{'UserId':_0xacf6dc,'ChatQueueId':_0x1e7738['id']});});});});});});})['then'](respondWithStatusCode(_0x3620a2,null))[_0x53f3('0x4e')](handleError(_0x3620a2,null));};exports[_0x53f3('0x8b')]=function(_0x28ecdd,_0x1fd8a9,_0x4786c3){return db[_0x53f3('0x35')]['find']({'where':{'id':_0x28ecdd[_0x53f3('0x50')]['id']}})['then'](handleEntityNotFound(_0x1fd8a9,null))[_0x53f3('0x1c')](function(_0x20222f){if(_0x20222f){return _0x20222f[_0x53f3('0x8b')](_0x28ecdd[_0x53f3('0x53')][_0x53f3('0x6c')],_['omit'](_0x28ecdd[_0x53f3('0x53')],[_0x53f3('0x6c'),'id'])||{})[_0x53f3('0x8c')](function(_0x35332b){for(var _0x3b3e66=0x0;_0x3b3e66<_0x28ecdd[_0x53f3('0x53')][_0x53f3('0x6c')][_0x53f3('0x3f')];_0x3b3e66+=0x1){socket[_0x53f3('0x75')](_0x53f3('0x76'),{'UserId':_0x28ecdd[_0x53f3('0x53')][_0x53f3('0x6c')][_0x3b3e66],'ChatQueueId':_0x28ecdd['params']['id']});}return _0x35332b;});}})['then'](respondWithResult(_0x1fd8a9,null))['catch'](handleError(_0x1fd8a9,null));};exports[_0x53f3('0x89')]=function(_0x2e57d7,_0x236998,_0x566c28){return db['ChatQueue'][_0x53f3('0x51')]({'where':{'id':_0x2e57d7[_0x53f3('0x50')]['id']}})['then'](handleEntityNotFound(_0x236998,null))[_0x53f3('0x1c')](function(_0x58f63c){if(_0x58f63c){return _0x58f63c['removeAgents'](_0x2e57d7[_0x53f3('0x39')][_0x53f3('0x6c')])[_0x53f3('0x1c')](function(){if(_[_0x53f3('0x8d')](_0x2e57d7['query']['ids'])){for(var _0x59312e=0x0;_0x59312e<_0x2e57d7[_0x53f3('0x39')][_0x53f3('0x6c')][_0x53f3('0x3f')];_0x59312e+=0x1){socket['emit'](_0x53f3('0x8a'),{'UserId':Number(_0x2e57d7[_0x53f3('0x39')]['ids'][_0x59312e]),'ChatQueueId':Number(_0x2e57d7[_0x53f3('0x50')]['id'])});}}else{socket[_0x53f3('0x75')](_0x53f3('0x8a'),{'UserId':Number(_0x2e57d7[_0x53f3('0x39')]['ids']),'ChatQueueId':Number(_0x2e57d7[_0x53f3('0x50')]['id'])});}});}})[_0x53f3('0x1c')](respondWithStatusCode(_0x236998,null))[_0x53f3('0x4e')](handleError(_0x236998,null));};exports[_0x53f3('0x8e')]=function(_0x51b182,_0x6d2e18,_0x144a06){var _0x9003b3={};var _0x5196d5={};var _0x371c91;var _0x43dc3b;return db[_0x53f3('0x35')][_0x53f3('0x5d')]({'where':{'id':_0x51b182[_0x53f3('0x50')]['id']}})[_0x53f3('0x1c')](handleEntityNotFound(_0x6d2e18,null))['then'](function(_0x3cbf49){if(_0x3cbf49){_0x371c91=_0x3cbf49;_0x5196d5['model']=_['keys'](db[_0x53f3('0x6d')][_0x53f3('0x36')]);_0x5196d5[_0x53f3('0x39')]=_[_0x53f3('0x38')](_0x51b182['query']);_0x5196d5['filters']=_[_0x53f3('0x3b')](_0x5196d5[_0x53f3('0x3c')],_0x5196d5['query']);_0x9003b3[_0x53f3('0x3d')]=_['intersection'](_0x5196d5[_0x53f3('0x3c')],qs[_0x53f3('0x3e')](_0x51b182[_0x53f3('0x39')]['fields']));_0x9003b3[_0x53f3('0x3d')]=_0x9003b3[_0x53f3('0x3d')][_0x53f3('0x3f')]?_0x9003b3[_0x53f3('0x3d')]:_0x5196d5['model'];_0x9003b3[_0x53f3('0x42')]=qs[_0x53f3('0x43')](_0x51b182['query'][_0x53f3('0x43')]);_0x9003b3[_0x53f3('0x44')]=qs[_0x53f3('0x3a')](_[_0x53f3('0x45')](_0x51b182[_0x53f3('0x39')],_0x5196d5[_0x53f3('0x3a')]));if(_0x51b182['query'][_0x53f3('0x46')]){_0x9003b3[_0x53f3('0x44')]=_[_0x53f3('0x47')](_0x9003b3['where'],{'$or':_[_0x53f3('0x34')](_0x9003b3[_0x53f3('0x3d')],function(_0x47c9fb){var _0x143adf={};_0x143adf[_0x47c9fb]={'$like':'%'+_0x51b182[_0x53f3('0x39')][_0x53f3('0x46')]+'%'};return _0x143adf;})});}_0x9003b3=_[_0x53f3('0x47')]({},_0x9003b3,_0x51b182[_0x53f3('0x48')]);return _0x371c91[_0x53f3('0x8e')](_0x9003b3);}})[_0x53f3('0x1c')](function(_0x50e607){if(_0x50e607){_0x43dc3b=_0x50e607['length'];if(!_0x51b182[_0x53f3('0x39')]['hasOwnProperty']('nolimit')){_0x9003b3[_0x53f3('0x41')]=qs[_0x53f3('0x41')](_0x51b182[_0x53f3('0x39')][_0x53f3('0x41')]);_0x9003b3[_0x53f3('0x29')]=qs[_0x53f3('0x29')](_0x51b182[_0x53f3('0x39')]['offset']);}return _0x371c91[_0x53f3('0x8e')](_0x9003b3);}})[_0x53f3('0x1c')](function(_0x32d89e){if(_0x32d89e){return _0x32d89e?{'count':_0x43dc3b,'rows':_0x32d89e}:null;}})[_0x53f3('0x1c')](respondWithResult(_0x6d2e18,null))['catch'](handleError(_0x6d2e18,null));}; \ No newline at end of file diff --git a/server/api/chatQueue/chatQueue.events.js b/server/api/chatQueue/chatQueue.events.js index c862b5c..e44df33 100644 --- a/server/api/chatQueue/chatQueue.events.js +++ b/server/api/chatQueue/chatQueue.events.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xb10b=['hasOwnProperty','hook','events','ChatQueue','setMaxListeners','save','remove','emit'];(function(_0x335167,_0x3f4e01){var _0x20bc8a=function(_0x2a7729){while(--_0x2a7729){_0x335167['push'](_0x335167['shift']());}};_0x20bc8a(++_0x3f4e01);}(_0xb10b,0x12a));var _0xbb10=function(_0x8ed2fe,_0x19ca78){_0x8ed2fe=_0x8ed2fe-0x0;var _0x23a751=_0xb10b[_0x8ed2fe];return _0x23a751;};'use strict';var EventEmitter=require(_0xbb10('0x0'));var ChatQueue=require('../../mysqldb')['db'][_0xbb10('0x1')];var ChatQueueEvents=new EventEmitter();ChatQueueEvents[_0xbb10('0x2')](0x0);var events={'afterCreate':_0xbb10('0x3'),'afterUpdate':'update','afterDestroy':_0xbb10('0x4')};function emitEvent(_0x9bbed){return function(_0x460981,_0x22320e,_0x49baf4){ChatQueueEvents[_0xbb10('0x5')](_0x9bbed+':'+_0x460981['id'],_0x460981);ChatQueueEvents['emit'](_0x9bbed,_0x460981);_0x49baf4(null);};}for(var e in events){if(events[_0xbb10('0x6')](e)){var event=events[e];ChatQueue[_0xbb10('0x7')](e,emitEvent(event));}}module['exports']=ChatQueueEvents; \ No newline at end of file +var _0xadb5=['update','emit','hasOwnProperty','hook','exports','../../mysqldb','setMaxListeners','save'];(function(_0x810e4d,_0x909ef4){var _0x13f01c=function(_0x12fd89){while(--_0x12fd89){_0x810e4d['push'](_0x810e4d['shift']());}};_0x13f01c(++_0x909ef4);}(_0xadb5,0xad));var _0x5adb=function(_0x5e68af,_0x5f408e){_0x5e68af=_0x5e68af-0x0;var _0xe26ce=_0xadb5[_0x5e68af];return _0xe26ce;};'use strict';var EventEmitter=require('events');var ChatQueue=require(_0x5adb('0x0'))['db']['ChatQueue'];var ChatQueueEvents=new EventEmitter();ChatQueueEvents[_0x5adb('0x1')](0x0);var events={'afterCreate':_0x5adb('0x2'),'afterUpdate':_0x5adb('0x3'),'afterDestroy':'remove'};function emitEvent(_0x248dc6){return function(_0x31457,_0x2e3ef4,_0x4cb1d1){ChatQueueEvents[_0x5adb('0x4')](_0x248dc6+':'+_0x31457['id'],_0x31457);ChatQueueEvents[_0x5adb('0x4')](_0x248dc6,_0x31457);_0x4cb1d1(null);};}for(var e in events){if(events[_0x5adb('0x5')](e)){var event=events[e];ChatQueue[_0x5adb('0x6')](e,emitEvent(event));}}module[_0x5adb('0x7')]=ChatQueueEvents; \ No newline at end of file diff --git a/server/api/chatQueue/chatQueue.model.js b/server/api/chatQueue/chatQueue.model.js index 5847a8f..4f1d78a 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 _0x084e=['path','rimraf','../../config/environment','define','ChatQueue','chat_queues','lodash','../../config/logger','api','moment','bluebird','request-promise'];(function(_0x1c34e7,_0x33f9a8){var _0x378cb1=function(_0x10b5e3){while(--_0x10b5e3){_0x1c34e7['push'](_0x1c34e7['shift']());}};_0x378cb1(++_0x33f9a8);}(_0x084e,0x186));var _0xe084=function(_0x582269,_0x529ef3){_0x582269=_0x582269-0x0;var _0x506c1f=_0x084e[_0x582269];return _0x506c1f;};'use strict';var _=require(_0xe084('0x0'));var util=require('util');var logger=require(_0xe084('0x1'))(_0xe084('0x2'));var moment=require(_0xe084('0x3'));var BPromise=require(_0xe084('0x4'));var rp=require(_0xe084('0x5'));var fs=require('fs');var path=require(_0xe084('0x6'));var rimraf=require(_0xe084('0x7'));var config=require(_0xe084('0x8'));var attributes=require('./chatQueue.attributes');module['exports']=function(_0x35e6ce,_0x3e34b8){return _0x35e6ce[_0xe084('0x9')](_0xe084('0xa'),attributes,{'tableName':_0xe084('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x40bc=['ChatQueue','chat_queues','lodash','util','../../config/logger','api','moment','request-promise','path','rimraf','../../config/environment','./chatQueue.attributes','exports','define'];(function(_0x5665cc,_0x3a52d6){var _0xcd39c5=function(_0x3fbd1c){while(--_0x3fbd1c){_0x5665cc['push'](_0x5665cc['shift']());}};_0xcd39c5(++_0x3a52d6);}(_0x40bc,0x8e));var _0xc40b=function(_0x350281,_0x7ad014){_0x350281=_0x350281-0x0;var _0x450069=_0x40bc[_0x350281];return _0x450069;};'use strict';var _=require(_0xc40b('0x0'));var util=require(_0xc40b('0x1'));var logger=require(_0xc40b('0x2'))(_0xc40b('0x3'));var moment=require(_0xc40b('0x4'));var BPromise=require('bluebird');var rp=require(_0xc40b('0x5'));var fs=require('fs');var path=require(_0xc40b('0x6'));var rimraf=require(_0xc40b('0x7'));var config=require(_0xc40b('0x8'));var attributes=require(_0xc40b('0x9'));module[_0xc40b('0xa')]=function(_0x2d3eba,_0x45831e){return _0x2d3eba[_0xc40b('0xb')](_0xc40b('0xc'),attributes,{'tableName':_0xc40b('0xd'),'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 42a08d4..9b55f71 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 _0xda2d=['error','code','message','ChatQueue,\x20%s,\x20%s','result','catch','GetChatQueue','ChatQueue','options','raw','limit','map','include','model','attributes','debug','where','ShowChatQueue','util','moment','bluebird','randomstring','ioredis','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','./chatQueue.socket','register','request','then','info','ChatQueue,\x20%s,\x20%s,\x20%s','request\x20sent','stringify'];(function(_0x22e3ea,_0x57d13c){var _0x58a537=function(_0xedf300){while(--_0xedf300){_0x22e3ea['push'](_0x22e3ea['shift']());}};_0x58a537(++_0x57d13c);}(_0xda2d,0x102));var _0xdda2=function(_0x19be7c,_0x3723a3){_0x19be7c=_0x19be7c-0x0;var _0x5e21d9=_0xda2d[_0x19be7c];return _0x5e21d9;};'use strict';var _=require('lodash');var util=require(_0xdda2('0x0'));var moment=require(_0xdda2('0x1'));var BPromise=require(_0xdda2('0x2'));var rs=require(_0xdda2('0x3'));var fs=require('fs');var Redis=require(_0xdda2('0x4'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0xdda2('0x5'));var config=require(_0xdda2('0x6'));var jayson=require(_0xdda2('0x7'));var client=jayson[_0xdda2('0x8')][_0xdda2('0x9')]({'port':0x232a});config[_0xdda2('0xa')]=_[_0xdda2('0xb')](config[_0xdda2('0xa')],{'host':_0xdda2('0xc'),'port':0x18eb});var socket=require(_0xdda2('0xd'))(new Redis(config['redis']));require(_0xdda2('0xe'))[_0xdda2('0xf')](socket);function respondWithRpcPromise(_0x4df6b8,_0x1c11b2,_0x2f3454){return new BPromise(function(_0x42d990,_0x346119){return client[_0xdda2('0x10')](_0x4df6b8,_0x2f3454)[_0xdda2('0x11')](function(_0x26fe81){logger[_0xdda2('0x12')]('ChatQueue,\x20%s,\x20%s',_0x1c11b2,'request\x20sent');logger['debug'](_0xdda2('0x13'),_0x1c11b2,_0xdda2('0x14'),JSON[_0xdda2('0x15')](_0x26fe81));if(_0x26fe81[_0xdda2('0x16')]){if(_0x26fe81[_0xdda2('0x16')][_0xdda2('0x17')]===0x1f4){logger[_0xdda2('0x16')]('ChatQueue,\x20%s,\x20%s',_0x1c11b2,_0x26fe81[_0xdda2('0x16')]['message']);return _0x346119(_0x26fe81[_0xdda2('0x16')][_0xdda2('0x18')]);}logger[_0xdda2('0x16')](_0xdda2('0x19'),_0x1c11b2,_0x26fe81[_0xdda2('0x16')]['message']);return _0x42d990(_0x26fe81['error'][_0xdda2('0x18')]);}else{logger['info'](_0xdda2('0x19'),_0x1c11b2,_0xdda2('0x14'));_0x42d990(_0x26fe81[_0xdda2('0x1a')][_0xdda2('0x18')]);}})[_0xdda2('0x1b')](function(_0x17015f){logger[_0xdda2('0x16')](_0xdda2('0x19'),_0x1c11b2,_0x17015f);_0x346119(_0x17015f);});});}exports[_0xdda2('0x1c')]=function(_0x337b0b){var _0x312ef1=this;return new Promise(function(_0x6fdede,_0x4eed30){return db[_0xdda2('0x1d')]['findAll']({'raw':_0x337b0b[_0xdda2('0x1e')]?_0x337b0b[_0xdda2('0x1e')][_0xdda2('0x1f')]===undefined?!![]:![]:!![],'where':_0x337b0b['options']?_0x337b0b[_0xdda2('0x1e')]['where']||null:null,'attributes':_0x337b0b[_0xdda2('0x1e')]?_0x337b0b[_0xdda2('0x1e')]['attributes']||null:null,'limit':_0x337b0b[_0xdda2('0x1e')]?_0x337b0b[_0xdda2('0x1e')][_0xdda2('0x20')]||null:null,'include':_0x337b0b[_0xdda2('0x1e')]?_0x337b0b[_0xdda2('0x1e')]['include']?_[_0xdda2('0x21')](_0x337b0b[_0xdda2('0x1e')][_0xdda2('0x22')],function(_0x31d48b){return{'model':db[_0x31d48b['model']],'as':_0x31d48b['as'],'attributes':_0x31d48b['attributes'],'include':_0x31d48b[_0xdda2('0x22')]?_[_0xdda2('0x21')](_0x31d48b[_0xdda2('0x22')],function(_0x5e9e74){return{'model':db[_0x5e9e74[_0xdda2('0x23')]],'as':_0x5e9e74['as'],'attributes':_0x5e9e74[_0xdda2('0x24')],'include':_0x5e9e74[_0xdda2('0x22')]?_[_0xdda2('0x21')](_0x5e9e74[_0xdda2('0x22')],function(_0x91b41a){return{'model':db[_0x91b41a['model']],'as':_0x91b41a['as'],'attributes':_0x91b41a[_0xdda2('0x24')]};}):[]};}):[]};}):[]:[]})[_0xdda2('0x11')](function(_0x53acb5){logger[_0xdda2('0x12')](_0xdda2('0x1c'),_0x337b0b);logger[_0xdda2('0x25')](_0xdda2('0x1c'),_0x337b0b,JSON['stringify'](_0x53acb5));_0x6fdede(_0x53acb5);})[_0xdda2('0x1b')](function(_0x5e107f){logger['error'](_0xdda2('0x1c'),_0x5e107f['message'],_0x337b0b);_0x4eed30(_0x312ef1[_0xdda2('0x16')](0x1f4,_0x5e107f['message']));});});};exports['ShowChatQueue']=function(_0x510b7b){var _0x239c25=this;return new Promise(function(_0x5bfc17,_0x1b13f4){return db['ChatQueue']['find']({'raw':_0x510b7b['options']?_0x510b7b[_0xdda2('0x1e')][_0xdda2('0x1f')]===undefined?!![]:![]:!![],'where':_0x510b7b[_0xdda2('0x1e')]?_0x510b7b[_0xdda2('0x1e')][_0xdda2('0x26')]||null:null,'attributes':_0x510b7b[_0xdda2('0x1e')]?_0x510b7b[_0xdda2('0x1e')][_0xdda2('0x24')]||null:null,'include':_0x510b7b[_0xdda2('0x1e')]?_0x510b7b[_0xdda2('0x1e')]['include']?_[_0xdda2('0x21')](_0x510b7b[_0xdda2('0x1e')][_0xdda2('0x22')],function(_0x3d510c){return{'model':db[_0x3d510c[_0xdda2('0x23')]],'as':_0x3d510c['as'],'attributes':_0x3d510c[_0xdda2('0x24')],'include':_0x3d510c[_0xdda2('0x22')]?_['map'](_0x3d510c['include'],function(_0xa03f5){return{'model':db[_0xa03f5[_0xdda2('0x23')]],'as':_0xa03f5['as'],'attributes':_0xa03f5[_0xdda2('0x24')],'include':_0xa03f5['include']?_['map'](_0xa03f5[_0xdda2('0x22')],function(_0x35a0f6){return{'model':db[_0x35a0f6[_0xdda2('0x23')]],'as':_0x35a0f6['as'],'attributes':_0x35a0f6[_0xdda2('0x24')]};}):[]};}):[]};}):[]:[]})[_0xdda2('0x11')](function(_0x5ab419){logger[_0xdda2('0x12')](_0xdda2('0x27'),_0x510b7b);logger['debug']('ShowChatQueue',_0x510b7b,JSON[_0xdda2('0x15')](_0x5ab419));_0x5bfc17(_0x5ab419);})[_0xdda2('0x1b')](function(_0x33fe97){logger[_0xdda2('0x16')](_0xdda2('0x27'),_0x33fe97['message'],_0x510b7b);_0x1b13f4(_0x239c25[_0xdda2('0x16')](0x1f4,_0x33fe97[_0xdda2('0x18')]));});});}; \ No newline at end of file +var _0xe6f1=['../../config/environment','jayson/promise','client','localhost','socket.io-emitter','./chatQueue.socket','register','request','then','info','request\x20sent','ChatQueue,\x20%s,\x20%s,\x20%s','stringify','error','ChatQueue,\x20%s,\x20%s','message','result','catch','GetChatQueue','ChatQueue','findAll','options','raw','where','attributes','limit','include','map','model','ShowChatQueue','find','debug','lodash','moment','randomstring','../../mysqldb','../../config/logger','rpc'];(function(_0x5a2285,_0x3212d1){var _0x48f6ed=function(_0x322127){while(--_0x322127){_0x5a2285['push'](_0x5a2285['shift']());}};_0x48f6ed(++_0x3212d1);}(_0xe6f1,0x19c));var _0x1e6f=function(_0x6c75da,_0x1b96d6){_0x6c75da=_0x6c75da-0x0;var _0x5f5d21=_0xe6f1[_0x6c75da];return _0x5f5d21;};'use strict';var _=require(_0x1e6f('0x0'));var util=require('util');var moment=require(_0x1e6f('0x1'));var BPromise=require('bluebird');var rs=require(_0x1e6f('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x1e6f('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0x1e6f('0x4'))(_0x1e6f('0x5'));var config=require(_0x1e6f('0x6'));var jayson=require(_0x1e6f('0x7'));var client=jayson[_0x1e6f('0x8')]['http']({'port':0x232a});config['redis']=_['defaults'](config['redis'],{'host':_0x1e6f('0x9'),'port':0x18eb});var socket=require(_0x1e6f('0xa'))(new Redis(config['redis']));require(_0x1e6f('0xb'))[_0x1e6f('0xc')](socket);function respondWithRpcPromise(_0x2bdee7,_0x38e768,_0x530c84){return new BPromise(function(_0x36d2a8,_0x565a2a){return client[_0x1e6f('0xd')](_0x2bdee7,_0x530c84)[_0x1e6f('0xe')](function(_0xdf70d0){logger[_0x1e6f('0xf')]('ChatQueue,\x20%s,\x20%s',_0x38e768,_0x1e6f('0x10'));logger['debug'](_0x1e6f('0x11'),_0x38e768,_0x1e6f('0x10'),JSON[_0x1e6f('0x12')](_0xdf70d0));if(_0xdf70d0[_0x1e6f('0x13')]){if(_0xdf70d0[_0x1e6f('0x13')]['code']===0x1f4){logger[_0x1e6f('0x13')](_0x1e6f('0x14'),_0x38e768,_0xdf70d0[_0x1e6f('0x13')][_0x1e6f('0x15')]);return _0x565a2a(_0xdf70d0[_0x1e6f('0x13')][_0x1e6f('0x15')]);}logger[_0x1e6f('0x13')](_0x1e6f('0x14'),_0x38e768,_0xdf70d0[_0x1e6f('0x13')][_0x1e6f('0x15')]);return _0x36d2a8(_0xdf70d0['error'][_0x1e6f('0x15')]);}else{logger[_0x1e6f('0xf')](_0x1e6f('0x14'),_0x38e768,_0x1e6f('0x10'));_0x36d2a8(_0xdf70d0[_0x1e6f('0x16')]['message']);}})[_0x1e6f('0x17')](function(_0x334146){logger[_0x1e6f('0x13')](_0x1e6f('0x14'),_0x38e768,_0x334146);_0x565a2a(_0x334146);});});}exports[_0x1e6f('0x18')]=function(_0x465618){var _0x23a952=this;return new Promise(function(_0x32b6be,_0x323bc8){return db[_0x1e6f('0x19')][_0x1e6f('0x1a')]({'raw':_0x465618['options']?_0x465618[_0x1e6f('0x1b')][_0x1e6f('0x1c')]===undefined?!![]:![]:!![],'where':_0x465618[_0x1e6f('0x1b')]?_0x465618['options'][_0x1e6f('0x1d')]||null:null,'attributes':_0x465618[_0x1e6f('0x1b')]?_0x465618['options'][_0x1e6f('0x1e')]||null:null,'limit':_0x465618[_0x1e6f('0x1b')]?_0x465618[_0x1e6f('0x1b')][_0x1e6f('0x1f')]||null:null,'include':_0x465618['options']?_0x465618[_0x1e6f('0x1b')][_0x1e6f('0x20')]?_[_0x1e6f('0x21')](_0x465618['options']['include'],function(_0x1ba103){return{'model':db[_0x1ba103[_0x1e6f('0x22')]],'as':_0x1ba103['as'],'attributes':_0x1ba103[_0x1e6f('0x1e')],'include':_0x1ba103[_0x1e6f('0x20')]?_[_0x1e6f('0x21')](_0x1ba103[_0x1e6f('0x20')],function(_0x100684){return{'model':db[_0x100684[_0x1e6f('0x22')]],'as':_0x100684['as'],'attributes':_0x100684['attributes'],'include':_0x100684['include']?_[_0x1e6f('0x21')](_0x100684[_0x1e6f('0x20')],function(_0x3fef2f){return{'model':db[_0x3fef2f[_0x1e6f('0x22')]],'as':_0x3fef2f['as'],'attributes':_0x3fef2f[_0x1e6f('0x1e')]};}):[]};}):[]};}):[]:[]})[_0x1e6f('0xe')](function(_0x3aa2fa){logger['info'](_0x1e6f('0x18'),_0x465618);logger['debug'](_0x1e6f('0x18'),_0x465618,JSON[_0x1e6f('0x12')](_0x3aa2fa));_0x32b6be(_0x3aa2fa);})[_0x1e6f('0x17')](function(_0x5393b5){logger[_0x1e6f('0x13')](_0x1e6f('0x18'),_0x5393b5[_0x1e6f('0x15')],_0x465618);_0x323bc8(_0x23a952[_0x1e6f('0x13')](0x1f4,_0x5393b5['message']));});});};exports[_0x1e6f('0x23')]=function(_0x448623){var _0x378194=this;return new Promise(function(_0x582a51,_0x234497){return db[_0x1e6f('0x19')][_0x1e6f('0x24')]({'raw':_0x448623[_0x1e6f('0x1b')]?_0x448623[_0x1e6f('0x1b')][_0x1e6f('0x1c')]===undefined?!![]:![]:!![],'where':_0x448623[_0x1e6f('0x1b')]?_0x448623[_0x1e6f('0x1b')][_0x1e6f('0x1d')]||null:null,'attributes':_0x448623[_0x1e6f('0x1b')]?_0x448623[_0x1e6f('0x1b')][_0x1e6f('0x1e')]||null:null,'include':_0x448623[_0x1e6f('0x1b')]?_0x448623['options']['include']?_[_0x1e6f('0x21')](_0x448623[_0x1e6f('0x1b')][_0x1e6f('0x20')],function(_0x4b91e8){return{'model':db[_0x4b91e8[_0x1e6f('0x22')]],'as':_0x4b91e8['as'],'attributes':_0x4b91e8['attributes'],'include':_0x4b91e8[_0x1e6f('0x20')]?_['map'](_0x4b91e8[_0x1e6f('0x20')],function(_0x32b7ee){return{'model':db[_0x32b7ee[_0x1e6f('0x22')]],'as':_0x32b7ee['as'],'attributes':_0x32b7ee[_0x1e6f('0x1e')],'include':_0x32b7ee['include']?_['map'](_0x32b7ee[_0x1e6f('0x20')],function(_0x4ac7ac){return{'model':db[_0x4ac7ac[_0x1e6f('0x22')]],'as':_0x4ac7ac['as'],'attributes':_0x4ac7ac['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x9da3c3){logger[_0x1e6f('0xf')](_0x1e6f('0x23'),_0x448623);logger[_0x1e6f('0x25')](_0x1e6f('0x23'),_0x448623,JSON[_0x1e6f('0x12')](_0x9da3c3));_0x582a51(_0x9da3c3);})['catch'](function(_0x358930){logger[_0x1e6f('0x13')](_0x1e6f('0x23'),_0x358930[_0x1e6f('0x15')],_0x448623);_0x234497(_0x378194[_0x1e6f('0x13')](0x1f4,_0x358930[_0x1e6f('0x15')]));});});}; \ No newline at end of file diff --git a/server/api/chatQueue/chatQueue.socket.js b/server/api/chatQueue/chatQueue.socket.js index f2fcbd3..1af262d 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(_0x167655,_0x4db0ab){var _0x1210c0=function(_0x6e144f){while(--_0x6e144f){_0x167655['push'](_0x167655['shift']());}};_0x1210c0(++_0x4db0ab);}(_0x5f2f,0x73));var _0xf5f2=function(_0x53b128,_0x599400){_0x53b128=_0x53b128-0x0;var _0x450e69=_0x5f2f[_0x53b128];return _0x450e69;};'use strict';var ChatQueueEvents=require(_0xf5f2('0x0'));var events=[_0xf5f2('0x1'),_0xf5f2('0x2'),_0xf5f2('0x3')];function createListener(_0x1172dd,_0x174bc7){return function(_0x3c72ee){_0x174bc7[_0xf5f2('0x4')](_0x1172dd,_0x3c72ee);};}function removeListener(_0x501fbd,_0x4854b6){return function(){ChatQueueEvents[_0xf5f2('0x5')](_0x501fbd,_0x4854b6);};}exports[_0xf5f2('0x6')]=function(_0xad7f65){for(var _0x3eebf6=0x0,_0x3133bc=events[_0xf5f2('0x7')];_0x3eebf6<_0x3133bc;_0x3eebf6++){var _0x5907aa=events[_0x3eebf6];var _0x466882=createListener(_0xf5f2('0x8')+_0x5907aa,_0xad7f65);ChatQueueEvents['on'](_0x5907aa,_0x466882);}}; \ No newline at end of file +var _0x5f2f=['remove','update','emit','removeListener','register','length','chatQueue:','./chatQueue.events','save'];(function(_0x184800,_0x13f14e){var _0x58e20b=function(_0x481e55){while(--_0x481e55){_0x184800['push'](_0x184800['shift']());}};_0x58e20b(++_0x13f14e);}(_0x5f2f,0x73));var _0xf5f2=function(_0x4e66b8,_0x3b188a){_0x4e66b8=_0x4e66b8-0x0;var _0x33f321=_0x5f2f[_0x4e66b8];return _0x33f321;};'use strict';var ChatQueueEvents=require(_0xf5f2('0x0'));var events=[_0xf5f2('0x1'),_0xf5f2('0x2'),_0xf5f2('0x3')];function createListener(_0x1172dd,_0x174bc7){return function(_0x3c72ee){_0x174bc7[_0xf5f2('0x4')](_0x1172dd,_0x3c72ee);};}function removeListener(_0x501fbd,_0x4854b6){return function(){ChatQueueEvents[_0xf5f2('0x5')](_0x501fbd,_0x4854b6);};}exports[_0xf5f2('0x6')]=function(_0xad7f65){for(var _0x3eebf6=0x0,_0x3133bc=events[_0xf5f2('0x7')];_0x3eebf6<_0x3133bc;_0x3eebf6++){var _0x5907aa=events[_0x3eebf6];var _0x466882=createListener(_0xf5f2('0x8')+_0x5907aa,_0xad7f65);ChatQueueEvents['on'](_0x5907aa,_0x466882);}}; \ No newline at end of file diff --git a/server/api/chatQueue/index.js b/server/api/chatQueue/index.js index e8fa5b6..61217d8 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 _0xf00b=['delete','removeTeams','exports','multer','path','connect-timeout','express','Router','../../components/auth/service','../../config/environment','./chatQueue.controller','get','isAuthenticated','index','describe','/:id','show','/:id/members','getMembers','/:id/teams','/:id/users','getAgents','post','addTeams','addAgents','put'];(function(_0xdaf89d,_0x2db2e3){var _0x340117=function(_0x160a11){while(--_0x160a11){_0xdaf89d['push'](_0xdaf89d['shift']());}};_0x340117(++_0x2db2e3);}(_0xf00b,0x1d7));var _0xbf00=function(_0x290b7c,_0x41a314){_0x290b7c=_0x290b7c-0x0;var _0x44d139=_0xf00b[_0x290b7c];return _0x44d139;};'use strict';var multer=require(_0xbf00('0x0'));var util=require('util');var path=require(_0xbf00('0x1'));var timeout=require(_0xbf00('0x2'));var express=require(_0xbf00('0x3'));var router=express[_0xbf00('0x4')]();var auth=require(_0xbf00('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0xbf00('0x6'));var controller=require(_0xbf00('0x7'));router[_0xbf00('0x8')]('/',auth[_0xbf00('0x9')](),controller[_0xbf00('0xa')]);router[_0xbf00('0x8')]('/describe',auth[_0xbf00('0x9')](),controller[_0xbf00('0xb')]);router[_0xbf00('0x8')](_0xbf00('0xc'),auth[_0xbf00('0x9')](),controller[_0xbf00('0xd')]);router[_0xbf00('0x8')](_0xbf00('0xe'),auth[_0xbf00('0x9')](),controller[_0xbf00('0xf')]);router[_0xbf00('0x8')](_0xbf00('0x10'),auth['isAuthenticated'](),controller['getTeams']);router[_0xbf00('0x8')](_0xbf00('0x11'),auth[_0xbf00('0x9')](),controller[_0xbf00('0x12')]);router['post']('/',auth[_0xbf00('0x9')](),controller['create']);router[_0xbf00('0x13')](_0xbf00('0x10'),auth['isAuthenticated'](),controller[_0xbf00('0x14')]);router[_0xbf00('0x13')](_0xbf00('0x11'),auth[_0xbf00('0x9')](),controller[_0xbf00('0x15')]);router[_0xbf00('0x16')](_0xbf00('0xc'),auth[_0xbf00('0x9')](),controller['update']);router[_0xbf00('0x17')](_0xbf00('0xc'),auth[_0xbf00('0x9')](),controller['destroy']);router[_0xbf00('0x17')](_0xbf00('0x10'),auth[_0xbf00('0x9')](),controller[_0xbf00('0x18')]);router['delete'](_0xbf00('0x11'),auth[_0xbf00('0x9')](),controller['removeAgents']);module[_0xbf00('0x19')]=router; \ No newline at end of file +var _0x56d4=['create','post','addTeams','addAgents','put','update','delete','removeAgents','exports','multer','path','connect-timeout','Router','../../components/auth/service','../../config/environment','./chatQueue.controller','get','index','/describe','isAuthenticated','describe','/:id','getMembers','/:id/teams','/:id/users','getAgents'];(function(_0x3a73bc,_0x550aef){var _0x32891b=function(_0x20b4cb){while(--_0x20b4cb){_0x3a73bc['push'](_0x3a73bc['shift']());}};_0x32891b(++_0x550aef);}(_0x56d4,0x1dd));var _0x456d=function(_0x47b27e,_0x2e6e02){_0x47b27e=_0x47b27e-0x0;var _0x5e4122=_0x56d4[_0x47b27e];return _0x5e4122;};'use strict';var multer=require(_0x456d('0x0'));var util=require('util');var path=require(_0x456d('0x1'));var timeout=require(_0x456d('0x2'));var express=require('express');var router=express[_0x456d('0x3')]();var auth=require(_0x456d('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0x456d('0x5'));var controller=require(_0x456d('0x6'));router[_0x456d('0x7')]('/',auth['isAuthenticated'](),controller[_0x456d('0x8')]);router[_0x456d('0x7')](_0x456d('0x9'),auth[_0x456d('0xa')](),controller[_0x456d('0xb')]);router[_0x456d('0x7')](_0x456d('0xc'),auth[_0x456d('0xa')](),controller['show']);router[_0x456d('0x7')]('/:id/members',auth[_0x456d('0xa')](),controller[_0x456d('0xd')]);router[_0x456d('0x7')](_0x456d('0xe'),auth[_0x456d('0xa')](),controller['getTeams']);router[_0x456d('0x7')](_0x456d('0xf'),auth['isAuthenticated'](),controller[_0x456d('0x10')]);router['post']('/',auth['isAuthenticated'](),controller[_0x456d('0x11')]);router[_0x456d('0x12')]('/:id/teams',auth[_0x456d('0xa')](),controller[_0x456d('0x13')]);router['post'](_0x456d('0xf'),auth[_0x456d('0xa')](),controller[_0x456d('0x14')]);router[_0x456d('0x15')](_0x456d('0xc'),auth[_0x456d('0xa')](),controller[_0x456d('0x16')]);router[_0x456d('0x17')](_0x456d('0xc'),auth[_0x456d('0xa')](),controller['destroy']);router['delete'](_0x456d('0xe'),auth['isAuthenticated'](),controller['removeTeams']);router['delete'](_0x456d('0xf'),auth[_0x456d('0xa')](),controller[_0x456d('0x18')]);module[_0x456d('0x19')]=router; \ No newline at end of file diff --git a/server/api/chatQueueReport/chatQueueReport.attributes.js b/server/api/chatQueueReport/chatQueueReport.attributes.js index 27ca2d3..4223f12 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 _0x5244=['STRING','moment','sequelize','exports','DATE'];(function(_0x4b1a91,_0x80b4c4){var _0xc2fa56=function(_0x198f7d){while(--_0x198f7d){_0x4b1a91['push'](_0x4b1a91['shift']());}};_0xc2fa56(++_0x80b4c4);}(_0x5244,0xd8));var _0x4524=function(_0x447635,_0x297b35){_0x447635=_0x447635-0x0;var _0x27fdea=_0x5244[_0x447635];return _0x27fdea;};'use strict';var moment=require(_0x4524('0x0'));var Sequelize=require(_0x4524('0x1'));module[_0x4524('0x2')]={'uniqueid':{'type':Sequelize['STRING'],'allowNull':![]},'from':{'type':Sequelize['STRING']},'joinAt':{'type':Sequelize['DATE']},'leaveAt':{'type':Sequelize[_0x4524('0x3')]},'acceptAt':{'type':Sequelize[_0x4524('0x3')]},'exitAt':{'type':Sequelize['DATE']},'reason':{'type':Sequelize[_0x4524('0x4')]}}; \ No newline at end of file +var _0x54cd=['DATE','sequelize','exports','STRING'];(function(_0x5f309e,_0x66e31){var _0x487b5e=function(_0x44f203){while(--_0x44f203){_0x5f309e['push'](_0x5f309e['shift']());}};_0x487b5e(++_0x66e31);}(_0x54cd,0x11d));var _0xd54c=function(_0x8abdbf,_0x4a7af4){_0x8abdbf=_0x8abdbf-0x0;var _0x53edee=_0x54cd[_0x8abdbf];return _0x53edee;};'use strict';var moment=require('moment');var Sequelize=require(_0xd54c('0x0'));module[_0xd54c('0x1')]={'uniqueid':{'type':Sequelize[_0xd54c('0x2')],'allowNull':![]},'from':{'type':Sequelize[_0xd54c('0x2')]},'joinAt':{'type':Sequelize[_0xd54c('0x3')]},'leaveAt':{'type':Sequelize[_0xd54c('0x3')]},'acceptAt':{'type':Sequelize['DATE']},'exitAt':{'type':Sequelize[_0xd54c('0x3')]},'reason':{'type':Sequelize[_0xd54c('0x2')]}}; \ No newline at end of file diff --git a/server/api/chatQueueReport/chatQueueReport.controller.js b/server/api/chatQueueReport/chatQueueReport.controller.js index 68cd12d..6f9458b 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 _0x4872=['squel','crypto','jsforce','desk.js','to-csv','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','sendStatus','status','end','count','offset','set','Content-Range','json','reject','save','then','destroy','error','name','send','index','ChatQueueReport','rawAttributes','fieldName','type','key','model','map','query','keys','intersection','attributes','fields','hasOwnProperty','limit','sort','where','pick','filters','filter','VIRTUAL','merge','options','includeAll','include','findAll','catch','show','params','length','find','create','body','update','describe','html-pdf','eml-format','rimraf','fast-json-patch','moment','bluebird','mustache','path','sox','ejs','lodash'];(function(_0x334841,_0x2bbc4c){var _0x5beb4b=function(_0x4bea72){while(--_0x4bea72){_0x334841['push'](_0x334841['shift']());}};_0x5beb4b(++_0x2bbc4c);}(_0x4872,0xd6));var _0x2487=function(_0x322f4d,_0x2211c6){_0x322f4d=_0x322f4d-0x0;var _0x548443=_0x4872[_0x322f4d];return _0x548443;};'use strict';var pdf=require(_0x2487('0x0'));var emlformat=require(_0x2487('0x1'));var rimraf=require(_0x2487('0x2'));var zipdir=require('zip-dir');var jsonpatch=require(_0x2487('0x3'));var rp=require('request-promise');var moment=require(_0x2487('0x4'));var BPromise=require(_0x2487('0x5'));var Mustache=require(_0x2487('0x6'));var util=require('util');var path=require(_0x2487('0x7'));var sox=require(_0x2487('0x8'));var csv=require('to-csv');var ejs=require(_0x2487('0x9'));var fs=require('fs');var _=require(_0x2487('0xa'));var squel=require(_0x2487('0xb'));var crypto=require(_0x2487('0xc'));var jsforce=require(_0x2487('0xd'));var deskjs=require(_0x2487('0xe'));var toCsv=require(_0x2487('0xf'));var querystring=require('querystring');var Papa=require(_0x2487('0x10'));var Redis=require(_0x2487('0x11'));var authService=require(_0x2487('0x12'));var qs=require(_0x2487('0x13'));var as=require(_0x2487('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x2487('0x15'))(_0x2487('0x16'));var utils=require(_0x2487('0x17'));var config=require(_0x2487('0x18'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x464bf3,_0x1a2217){_0x1a2217=_0x1a2217||0xcc;return function(_0x115156){if(_0x115156){return _0x464bf3[_0x2487('0x19')](_0x1a2217);}return _0x464bf3[_0x2487('0x1a')](_0x1a2217)[_0x2487('0x1b')]();};}function respondWithResult(_0x4e8ff6,_0xaf47e5){_0xaf47e5=_0xaf47e5||0xc8;return function(_0x1e7a54){if(_0x1e7a54){return _0x4e8ff6['status'](_0xaf47e5)['json'](_0x1e7a54);}};}function respondWithFilteredResult(_0x1d32eb,_0x5c08d7){return function(_0x1bde18){if(_0x1bde18){var _0x226d65=_0x1bde18[_0x2487('0x1c')],_0x2d8d98=_0x5c08d7[_0x2487('0x1d')],_0x56a544=_0x5c08d7[_0x2487('0x1d')]+_0x5c08d7['limit'],_0x379c36;if(_0x56a544>=_0x226d65){_0x56a544=_0x226d65;_0x379c36=0xc8;}else{_0x379c36=0xce;}_0x1d32eb['status'](_0x379c36);return _0x1d32eb[_0x2487('0x1e')](_0x2487('0x1f'),_0x2d8d98+'-'+_0x56a544+'/'+_0x226d65)[_0x2487('0x20')](_0x1bde18);}return null;};}function patchUpdates(_0x2baf51){return function(_0x412023){try{jsonpatch['apply'](_0x412023,_0x2baf51,!![]);}catch(_0x4b40cb){return BPromise[_0x2487('0x21')](_0x4b40cb);}return _0x412023[_0x2487('0x22')]();};}function saveUpdates(_0x47633d,_0x31be31){return function(_0x44f576){if(_0x44f576){return _0x44f576['update'](_0x47633d)[_0x2487('0x23')](function(_0x1251f4){return _0x1251f4;});}return null;};}function removeEntity(_0x55d168,_0x47b65e){return function(_0x50ae9b){if(_0x50ae9b){return _0x50ae9b[_0x2487('0x24')]()[_0x2487('0x23')](function(){_0x55d168[_0x2487('0x1a')](0xcc)[_0x2487('0x1b')]();});}};}function handleEntityNotFound(_0x3a7f73,_0x46997c){return function(_0x313975){if(!_0x313975){_0x3a7f73[_0x2487('0x19')](0x194);}return _0x313975;};}function handleError(_0x14c5e4,_0x3841dc){_0x3841dc=_0x3841dc||0x1f4;return function(_0x44573b){logger[_0x2487('0x25')](_0x44573b['stack']);if(_0x44573b[_0x2487('0x26')]){delete _0x44573b[_0x2487('0x26')];}_0x14c5e4[_0x2487('0x1a')](_0x3841dc)[_0x2487('0x27')](_0x44573b);};}exports[_0x2487('0x28')]=function(_0x3ea0ed,_0x2c32b5){var _0xa7144e={},_0xa3faaf={},_0x31821c={'count':0x0,'rows':[]};var _0x2fcdee=_['map'](db[_0x2487('0x29')][_0x2487('0x2a')],function(_0x15bc6d){return{'name':_0x15bc6d[_0x2487('0x2b')],'type':_0x15bc6d[_0x2487('0x2c')][_0x2487('0x2d')]};});_0xa3faaf[_0x2487('0x2e')]=_[_0x2487('0x2f')](_0x2fcdee,'name');_0xa3faaf[_0x2487('0x30')]=_[_0x2487('0x31')](_0x3ea0ed['query']);_0xa3faaf['filters']=_[_0x2487('0x32')](_0xa3faaf[_0x2487('0x2e')],_0xa3faaf[_0x2487('0x30')]);_0xa7144e[_0x2487('0x33')]=_[_0x2487('0x32')](_0xa3faaf[_0x2487('0x2e')],qs['fields'](_0x3ea0ed['query'][_0x2487('0x34')]));_0xa7144e[_0x2487('0x33')]=_0xa7144e[_0x2487('0x33')]['length']?_0xa7144e[_0x2487('0x33')]:_0xa3faaf[_0x2487('0x2e')];if(!_0x3ea0ed[_0x2487('0x30')][_0x2487('0x35')]('nolimit')){_0xa7144e[_0x2487('0x36')]=qs[_0x2487('0x36')](_0x3ea0ed[_0x2487('0x30')][_0x2487('0x36')]);_0xa7144e[_0x2487('0x1d')]=qs[_0x2487('0x1d')](_0x3ea0ed['query'][_0x2487('0x1d')]);}_0xa7144e['order']=qs[_0x2487('0x37')](_0x3ea0ed['query'][_0x2487('0x37')]);_0xa7144e[_0x2487('0x38')]=qs['filters'](_[_0x2487('0x39')](_0x3ea0ed[_0x2487('0x30')],_0xa3faaf[_0x2487('0x3a')]));if(_0x3ea0ed[_0x2487('0x30')][_0x2487('0x3b')]){_0xa7144e[_0x2487('0x38')]=_['merge'](_0xa7144e[_0x2487('0x38')],{'$or':_[_0x2487('0x2f')](_0x2fcdee,function(_0x555e74){if(_0x555e74[_0x2487('0x2c')]!==_0x2487('0x3c')){var _0x3cc3d4={};_0x3cc3d4[_0x555e74['name']]={'$like':'%'+_0x3ea0ed[_0x2487('0x30')][_0x2487('0x3b')]+'%'};return _0x3cc3d4;}})});}_0xa7144e=_[_0x2487('0x3d')]({},_0xa7144e,_0x3ea0ed[_0x2487('0x3e')]);var _0x3cda98={'where':_0xa7144e[_0x2487('0x38')]};return db[_0x2487('0x29')][_0x2487('0x1c')](_0x3cda98)['then'](function(_0x557f75){_0x31821c['count']=_0x557f75;if(_0x3ea0ed[_0x2487('0x30')][_0x2487('0x3f')]){_0xa7144e[_0x2487('0x40')]=[{'all':!![]}];}return db[_0x2487('0x29')][_0x2487('0x41')](_0xa7144e);})[_0x2487('0x23')](function(_0x3c8926){_0x31821c['rows']=_0x3c8926;return _0x31821c;})[_0x2487('0x23')](respondWithFilteredResult(_0x2c32b5,_0xa7144e))[_0x2487('0x42')](handleError(_0x2c32b5,null));};exports[_0x2487('0x43')]=function(_0x3c9e7f,_0x220cff){var _0x164ac7={'raw':!![],'where':{'id':_0x3c9e7f[_0x2487('0x44')]['id']}},_0x71cf36={};_0x71cf36['model']=_[_0x2487('0x31')](db[_0x2487('0x29')][_0x2487('0x2a')]);_0x71cf36[_0x2487('0x30')]=_[_0x2487('0x31')](_0x3c9e7f[_0x2487('0x30')]);_0x71cf36[_0x2487('0x3a')]=_['intersection'](_0x71cf36[_0x2487('0x2e')],_0x71cf36[_0x2487('0x30')]);_0x164ac7[_0x2487('0x33')]=_[_0x2487('0x32')](_0x71cf36[_0x2487('0x2e')],qs[_0x2487('0x34')](_0x3c9e7f[_0x2487('0x30')]['fields']));_0x164ac7[_0x2487('0x33')]=_0x164ac7[_0x2487('0x33')][_0x2487('0x45')]?_0x164ac7[_0x2487('0x33')]:_0x71cf36[_0x2487('0x2e')];if(_0x3c9e7f[_0x2487('0x30')][_0x2487('0x3f')]){_0x164ac7[_0x2487('0x40')]=[{'all':!![]}];}_0x164ac7=_['merge']({},_0x164ac7,_0x3c9e7f['options']);return db[_0x2487('0x29')][_0x2487('0x46')](_0x164ac7)[_0x2487('0x23')](handleEntityNotFound(_0x220cff,null))[_0x2487('0x23')](respondWithResult(_0x220cff,null))[_0x2487('0x42')](handleError(_0x220cff,null));};exports[_0x2487('0x47')]=function(_0x47d4ee,_0x111caf){return db[_0x2487('0x29')][_0x2487('0x47')](_0x47d4ee[_0x2487('0x48')],{})[_0x2487('0x23')](respondWithResult(_0x111caf,0xc9))[_0x2487('0x42')](handleError(_0x111caf,null));};exports[_0x2487('0x49')]=function(_0x4e0711,_0x2d2015){if(_0x4e0711['body']['id']){delete _0x4e0711['body']['id'];}return db['ChatQueueReport'][_0x2487('0x46')]({'where':{'id':_0x4e0711[_0x2487('0x44')]['id']}})[_0x2487('0x23')](handleEntityNotFound(_0x2d2015,null))[_0x2487('0x23')](saveUpdates(_0x4e0711[_0x2487('0x48')],null))[_0x2487('0x23')](respondWithResult(_0x2d2015,null))[_0x2487('0x42')](handleError(_0x2d2015,null));};exports[_0x2487('0x24')]=function(_0x2b4a7c,_0x5db517){return db[_0x2487('0x29')]['find']({'where':{'id':_0x2b4a7c['params']['id']}})[_0x2487('0x23')](handleEntityNotFound(_0x5db517,null))[_0x2487('0x23')](removeEntity(_0x5db517,null))[_0x2487('0x42')](handleError(_0x5db517,null));};exports[_0x2487('0x4a')]=function(_0x88a80c,_0x21ac40){return db[_0x2487('0x29')]['describe']()[_0x2487('0x23')](respondWithResult(_0x21ac40,null))[_0x2487('0x42')](handleError(_0x21ac40,null));}; \ No newline at end of file +var _0x3a16=['to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','end','json','count','offset','limit','status','set','Content-Range','reject','save','then','destroy','error','stack','send','map','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','nolimit','order','sort','where','filter','name','merge','options','ChatQueueReport','includeAll','include','rows','catch','show','params','rawAttributes','find','create','body','describe','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path'];(function(_0x1a9e78,_0x180720){var _0x113e06=function(_0x229c64){while(--_0x229c64){_0x1a9e78['push'](_0x1a9e78['shift']());}};_0x113e06(++_0x180720);}(_0x3a16,0x172));var _0x63a1=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x3a16[_0x3dd15e];return _0x231fd0;};'use strict';var pdf=require(_0x63a1('0x0'));var emlformat=require(_0x63a1('0x1'));var rimraf=require(_0x63a1('0x2'));var zipdir=require(_0x63a1('0x3'));var jsonpatch=require(_0x63a1('0x4'));var rp=require(_0x63a1('0x5'));var moment=require(_0x63a1('0x6'));var BPromise=require(_0x63a1('0x7'));var Mustache=require('mustache');var util=require(_0x63a1('0x8'));var path=require(_0x63a1('0x9'));var sox=require('sox');var csv=require(_0x63a1('0xa'));var ejs=require(_0x63a1('0xb'));var fs=require('fs');var _=require(_0x63a1('0xc'));var squel=require(_0x63a1('0xd'));var crypto=require(_0x63a1('0xe'));var jsforce=require(_0x63a1('0xf'));var deskjs=require(_0x63a1('0x10'));var toCsv=require(_0x63a1('0xa'));var querystring=require(_0x63a1('0x11'));var Papa=require(_0x63a1('0x12'));var Redis=require(_0x63a1('0x13'));var authService=require('../../components/auth/service');var qs=require(_0x63a1('0x14'));var as=require(_0x63a1('0x15'));var hardwareService=require(_0x63a1('0x16'));var logger=require(_0x63a1('0x17'))(_0x63a1('0x18'));var utils=require(_0x63a1('0x19'));var config=require(_0x63a1('0x1a'));var db=require(_0x63a1('0x1b'))['db'];function respondWithStatusCode(_0x5ab40d,_0x28f2aa){_0x28f2aa=_0x28f2aa||0xcc;return function(_0x19bfe1){if(_0x19bfe1){return _0x5ab40d[_0x63a1('0x1c')](_0x28f2aa);}return _0x5ab40d['status'](_0x28f2aa)[_0x63a1('0x1d')]();};}function respondWithResult(_0x1922ac,_0x305ffb){_0x305ffb=_0x305ffb||0xc8;return function(_0x2cac1f){if(_0x2cac1f){return _0x1922ac['status'](_0x305ffb)[_0x63a1('0x1e')](_0x2cac1f);}};}function respondWithFilteredResult(_0x44fdca,_0x675b33){return function(_0x4f7a01){if(_0x4f7a01){var _0x389c48=_0x4f7a01[_0x63a1('0x1f')],_0x43d7e8=_0x675b33[_0x63a1('0x20')],_0x177c35=_0x675b33[_0x63a1('0x20')]+_0x675b33[_0x63a1('0x21')],_0x373135;if(_0x177c35>=_0x389c48){_0x177c35=_0x389c48;_0x373135=0xc8;}else{_0x373135=0xce;}_0x44fdca[_0x63a1('0x22')](_0x373135);return _0x44fdca[_0x63a1('0x23')](_0x63a1('0x24'),_0x43d7e8+'-'+_0x177c35+'/'+_0x389c48)[_0x63a1('0x1e')](_0x4f7a01);}return null;};}function patchUpdates(_0x44072c){return function(_0xb7a080){try{jsonpatch['apply'](_0xb7a080,_0x44072c,!![]);}catch(_0x38ef00){return BPromise[_0x63a1('0x25')](_0x38ef00);}return _0xb7a080[_0x63a1('0x26')]();};}function saveUpdates(_0x45c375,_0x40209e){return function(_0x562779){if(_0x562779){return _0x562779['update'](_0x45c375)[_0x63a1('0x27')](function(_0x2127f7){return _0x2127f7;});}return null;};}function removeEntity(_0x67cf3a,_0x3bafac){return function(_0x73b409){if(_0x73b409){return _0x73b409[_0x63a1('0x28')]()['then'](function(){_0x67cf3a[_0x63a1('0x22')](0xcc)[_0x63a1('0x1d')]();});}};}function handleEntityNotFound(_0x45c682,_0xbb4f57){return function(_0x1c882e){if(!_0x1c882e){_0x45c682[_0x63a1('0x1c')](0x194);}return _0x1c882e;};}function handleError(_0x370ff8,_0x1564df){_0x1564df=_0x1564df||0x1f4;return function(_0xfe1c5d){logger[_0x63a1('0x29')](_0xfe1c5d[_0x63a1('0x2a')]);if(_0xfe1c5d['name']){delete _0xfe1c5d['name'];}_0x370ff8[_0x63a1('0x22')](_0x1564df)[_0x63a1('0x2b')](_0xfe1c5d);};}exports['index']=function(_0x28609b,_0x3ae1e4){var _0x5ee72f={},_0x5e9611={},_0x47c556={'count':0x0,'rows':[]};var _0x466b99=_[_0x63a1('0x2c')](db['ChatQueueReport']['rawAttributes'],function(_0x10ecc9){return{'name':_0x10ecc9[_0x63a1('0x2d')],'type':_0x10ecc9[_0x63a1('0x2e')][_0x63a1('0x2f')]};});_0x5e9611[_0x63a1('0x30')]=_['map'](_0x466b99,'name');_0x5e9611[_0x63a1('0x31')]=_[_0x63a1('0x32')](_0x28609b[_0x63a1('0x31')]);_0x5e9611[_0x63a1('0x33')]=_[_0x63a1('0x34')](_0x5e9611[_0x63a1('0x30')],_0x5e9611[_0x63a1('0x31')]);_0x5ee72f[_0x63a1('0x35')]=_[_0x63a1('0x34')](_0x5e9611[_0x63a1('0x30')],qs['fields'](_0x28609b['query'][_0x63a1('0x36')]));_0x5ee72f[_0x63a1('0x35')]=_0x5ee72f['attributes'][_0x63a1('0x37')]?_0x5ee72f[_0x63a1('0x35')]:_0x5e9611[_0x63a1('0x30')];if(!_0x28609b['query']['hasOwnProperty'](_0x63a1('0x38'))){_0x5ee72f[_0x63a1('0x21')]=qs[_0x63a1('0x21')](_0x28609b['query'][_0x63a1('0x21')]);_0x5ee72f[_0x63a1('0x20')]=qs[_0x63a1('0x20')](_0x28609b[_0x63a1('0x31')]['offset']);}_0x5ee72f[_0x63a1('0x39')]=qs[_0x63a1('0x3a')](_0x28609b['query'][_0x63a1('0x3a')]);_0x5ee72f[_0x63a1('0x3b')]=qs[_0x63a1('0x33')](_['pick'](_0x28609b['query'],_0x5e9611[_0x63a1('0x33')]));if(_0x28609b[_0x63a1('0x31')][_0x63a1('0x3c')]){_0x5ee72f['where']=_['merge'](_0x5ee72f[_0x63a1('0x3b')],{'$or':_[_0x63a1('0x2c')](_0x466b99,function(_0x45e41c){if(_0x45e41c[_0x63a1('0x2e')]!=='VIRTUAL'){var _0x1eea2a={};_0x1eea2a[_0x45e41c[_0x63a1('0x3d')]]={'$like':'%'+_0x28609b[_0x63a1('0x31')][_0x63a1('0x3c')]+'%'};return _0x1eea2a;}})});}_0x5ee72f=_[_0x63a1('0x3e')]({},_0x5ee72f,_0x28609b[_0x63a1('0x3f')]);var _0x30190d={'where':_0x5ee72f[_0x63a1('0x3b')]};return db[_0x63a1('0x40')]['count'](_0x30190d)[_0x63a1('0x27')](function(_0x4693f7){_0x47c556['count']=_0x4693f7;if(_0x28609b[_0x63a1('0x31')][_0x63a1('0x41')]){_0x5ee72f[_0x63a1('0x42')]=[{'all':!![]}];}return db[_0x63a1('0x40')]['findAll'](_0x5ee72f);})[_0x63a1('0x27')](function(_0x1165c0){_0x47c556[_0x63a1('0x43')]=_0x1165c0;return _0x47c556;})['then'](respondWithFilteredResult(_0x3ae1e4,_0x5ee72f))[_0x63a1('0x44')](handleError(_0x3ae1e4,null));};exports[_0x63a1('0x45')]=function(_0x63f9e0,_0x5b5566){var _0xdadb08={'raw':!![],'where':{'id':_0x63f9e0[_0x63a1('0x46')]['id']}},_0x42275f={};_0x42275f['model']=_['keys'](db[_0x63a1('0x40')][_0x63a1('0x47')]);_0x42275f[_0x63a1('0x31')]=_[_0x63a1('0x32')](_0x63f9e0['query']);_0x42275f[_0x63a1('0x33')]=_[_0x63a1('0x34')](_0x42275f[_0x63a1('0x30')],_0x42275f[_0x63a1('0x31')]);_0xdadb08[_0x63a1('0x35')]=_[_0x63a1('0x34')](_0x42275f[_0x63a1('0x30')],qs['fields'](_0x63f9e0[_0x63a1('0x31')][_0x63a1('0x36')]));_0xdadb08[_0x63a1('0x35')]=_0xdadb08['attributes']['length']?_0xdadb08['attributes']:_0x42275f[_0x63a1('0x30')];if(_0x63f9e0[_0x63a1('0x31')]['includeAll']){_0xdadb08[_0x63a1('0x42')]=[{'all':!![]}];}_0xdadb08=_[_0x63a1('0x3e')]({},_0xdadb08,_0x63f9e0[_0x63a1('0x3f')]);return db[_0x63a1('0x40')][_0x63a1('0x48')](_0xdadb08)[_0x63a1('0x27')](handleEntityNotFound(_0x5b5566,null))['then'](respondWithResult(_0x5b5566,null))[_0x63a1('0x44')](handleError(_0x5b5566,null));};exports[_0x63a1('0x49')]=function(_0x165851,_0x4f456f){return db[_0x63a1('0x40')][_0x63a1('0x49')](_0x165851[_0x63a1('0x4a')],{})[_0x63a1('0x27')](respondWithResult(_0x4f456f,0xc9))['catch'](handleError(_0x4f456f,null));};exports['update']=function(_0x5b1c96,_0x43c392){if(_0x5b1c96[_0x63a1('0x4a')]['id']){delete _0x5b1c96[_0x63a1('0x4a')]['id'];}return db[_0x63a1('0x40')][_0x63a1('0x48')]({'where':{'id':_0x5b1c96[_0x63a1('0x46')]['id']}})[_0x63a1('0x27')](handleEntityNotFound(_0x43c392,null))['then'](saveUpdates(_0x5b1c96[_0x63a1('0x4a')],null))[_0x63a1('0x27')](respondWithResult(_0x43c392,null))['catch'](handleError(_0x43c392,null));};exports[_0x63a1('0x28')]=function(_0x44ff2f,_0x239855){return db['ChatQueueReport'][_0x63a1('0x48')]({'where':{'id':_0x44ff2f[_0x63a1('0x46')]['id']}})[_0x63a1('0x27')](handleEntityNotFound(_0x239855,null))[_0x63a1('0x27')](removeEntity(_0x239855,null))[_0x63a1('0x44')](handleError(_0x239855,null));};exports['describe']=function(_0x56c545,_0x5957e0){return db[_0x63a1('0x40')][_0x63a1('0x4b')]()[_0x63a1('0x27')](respondWithResult(_0x5957e0,null))[_0x63a1('0x44')](handleError(_0x5957e0,null));}; \ No newline at end of file diff --git a/server/api/chatQueueReport/chatQueueReport.model.js b/server/api/chatQueueReport/chatQueueReport.model.js index 5820425..e58ed76 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 _0xfcbc=['request-promise','path','rimraf','../../config/environment','./chatQueueReport.attributes','exports','define','report_chat_queue','uniqueid','lodash','util','../../config/logger','api','bluebird'];(function(_0x4fa368,_0x8f5383){var _0x34efca=function(_0x126bfb){while(--_0x126bfb){_0x4fa368['push'](_0x4fa368['shift']());}};_0x34efca(++_0x8f5383);}(_0xfcbc,0xa3));var _0xcfcb=function(_0xd98ca3,_0x38fbd9){_0xd98ca3=_0xd98ca3-0x0;var _0x35960d=_0xfcbc[_0xd98ca3];return _0x35960d;};'use strict';var _=require(_0xcfcb('0x0'));var util=require(_0xcfcb('0x1'));var logger=require(_0xcfcb('0x2'))(_0xcfcb('0x3'));var moment=require('moment');var BPromise=require(_0xcfcb('0x4'));var rp=require(_0xcfcb('0x5'));var fs=require('fs');var path=require(_0xcfcb('0x6'));var rimraf=require(_0xcfcb('0x7'));var config=require(_0xcfcb('0x8'));var attributes=require(_0xcfcb('0x9'));module[_0xcfcb('0xa')]=function(_0x4af512,_0x133684){return _0x4af512[_0xcfcb('0xb')]('ChatQueueReport',attributes,{'tableName':_0xcfcb('0xc'),'paranoid':![],'indexes':[{'name':_0xcfcb('0xd'),'fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file +var _0x35cc=['../../config/logger','api','moment','request-promise','path','./chatQueueReport.attributes','define','ChatQueueReport','report_chat_queue','uniqueid','lodash','util'];(function(_0x2d4923,_0x3bfec7){var _0x4e457c=function(_0x4faad9){while(--_0x4faad9){_0x2d4923['push'](_0x2d4923['shift']());}};_0x4e457c(++_0x3bfec7);}(_0x35cc,0x166));var _0xc35c=function(_0x48d1b9,_0x49d3b3){_0x48d1b9=_0x48d1b9-0x0;var _0x4f577e=_0x35cc[_0x48d1b9];return _0x4f577e;};'use strict';var _=require(_0xc35c('0x0'));var util=require(_0xc35c('0x1'));var logger=require(_0xc35c('0x2'))(_0xc35c('0x3'));var moment=require(_0xc35c('0x4'));var BPromise=require('bluebird');var rp=require(_0xc35c('0x5'));var fs=require('fs');var path=require(_0xc35c('0x6'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0xc35c('0x7'));module['exports']=function(_0x1b344f,_0x47f5be){return _0x1b344f[_0xc35c('0x8')](_0xc35c('0x9'),attributes,{'tableName':_0xc35c('0xa'),'paranoid':![],'indexes':[{'name':_0xc35c('0xb'),'fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/chatQueueReport/chatQueueReport.rpc.js b/server/api/chatQueueReport/chatQueueReport.rpc.js index b597f10..4928790 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 _0xe238=['then','info','ChatQueueReport,\x20%s,\x20%s','request\x20sent','ChatQueueReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','CreateChatQueueReport','ChatQueueReport','body','options','raw','debug','UpdateChatQueueReport','update','where','attributes','limit','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','request'];(function(_0x1ff880,_0x4752cc){var _0x4b513d=function(_0x14c1da){while(--_0x14c1da){_0x1ff880['push'](_0x1ff880['shift']());}};_0x4b513d(++_0x4752cc);}(_0xe238,0x9e));var _0x8e23=function(_0x29d94e,_0xf386d6){_0x29d94e=_0x29d94e-0x0;var _0x106237=_0xe238[_0x29d94e];return _0x106237;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x8e23('0x0'));var BPromise=require(_0x8e23('0x1'));var rs=require(_0x8e23('0x2'));var fs=require('fs');var Redis=require(_0x8e23('0x3'));var db=require(_0x8e23('0x4'))['db'];var utils=require(_0x8e23('0x5'));var logger=require(_0x8e23('0x6'))(_0x8e23('0x7'));var config=require(_0x8e23('0x8'));var jayson=require(_0x8e23('0x9'));var client=jayson[_0x8e23('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x91359f,_0x2f8e20,_0x1bff6e){return new BPromise(function(_0x2936e4,_0x3a6cca){return client[_0x8e23('0xb')](_0x91359f,_0x1bff6e)[_0x8e23('0xc')](function(_0x158164){logger[_0x8e23('0xd')](_0x8e23('0xe'),_0x2f8e20,_0x8e23('0xf'));logger['debug'](_0x8e23('0x10'),_0x2f8e20,_0x8e23('0xf'),JSON[_0x8e23('0x11')](_0x158164));if(_0x158164[_0x8e23('0x12')]){if(_0x158164[_0x8e23('0x12')][_0x8e23('0x13')]===0x1f4){logger[_0x8e23('0x12')](_0x8e23('0xe'),_0x2f8e20,_0x158164[_0x8e23('0x12')][_0x8e23('0x14')]);return _0x3a6cca(_0x158164[_0x8e23('0x12')][_0x8e23('0x14')]);}logger['error'](_0x8e23('0xe'),_0x2f8e20,_0x158164['error'][_0x8e23('0x14')]);return _0x2936e4(_0x158164[_0x8e23('0x12')][_0x8e23('0x14')]);}else{logger[_0x8e23('0xd')](_0x8e23('0xe'),_0x2f8e20,_0x8e23('0xf'));_0x2936e4(_0x158164[_0x8e23('0x15')]['message']);}})[_0x8e23('0x16')](function(_0x9aca6f){logger[_0x8e23('0x12')](_0x8e23('0xe'),_0x2f8e20,_0x9aca6f);_0x3a6cca(_0x9aca6f);});});}exports[_0x8e23('0x17')]=function(_0x17da9f){var _0x4c4fbf=this;return new Promise(function(_0x505954,_0x555542){return db[_0x8e23('0x18')]['create'](_0x17da9f[_0x8e23('0x19')],{'raw':_0x17da9f[_0x8e23('0x1a')]?_0x17da9f[_0x8e23('0x1a')][_0x8e23('0x1b')]===undefined?!![]:![]:!![]})['then'](function(_0x36aed9){logger[_0x8e23('0xd')](_0x8e23('0x17'),_0x17da9f);logger[_0x8e23('0x1c')]('CreateChatQueueReport',_0x17da9f,JSON[_0x8e23('0x11')](_0x36aed9));_0x505954(_0x36aed9);})['catch'](function(_0x28059f){logger[_0x8e23('0x12')](_0x8e23('0x17'),_0x28059f[_0x8e23('0x14')],_0x17da9f);_0x555542(_0x4c4fbf[_0x8e23('0x12')](0x1f4,_0x28059f[_0x8e23('0x14')]));});});};exports[_0x8e23('0x1d')]=function(_0x40f13a){var _0x487bcf=this;return new Promise(function(_0x51f432,_0x470402){return db[_0x8e23('0x18')][_0x8e23('0x1e')](_0x40f13a['body'],{'raw':_0x40f13a[_0x8e23('0x1a')]?_0x40f13a[_0x8e23('0x1a')][_0x8e23('0x1b')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x40f13a[_0x8e23('0x1a')]?_0x40f13a['options'][_0x8e23('0x1f')]||null:null,'attributes':_0x40f13a[_0x8e23('0x1a')]?_0x40f13a['options'][_0x8e23('0x20')]||null:null,'limit':_0x40f13a[_0x8e23('0x1a')]?_0x40f13a['options'][_0x8e23('0x21')]||null:null})[_0x8e23('0xc')](function(_0x1d3a0b){logger[_0x8e23('0xd')](_0x8e23('0x1d'),_0x40f13a);logger[_0x8e23('0x1c')]('UpdateChatQueueReport',_0x40f13a,JSON[_0x8e23('0x11')](_0x1d3a0b));_0x51f432(_0x1d3a0b);})[_0x8e23('0x16')](function(_0x56aa4c){logger['error']('UpdateChatQueueReport',_0x56aa4c[_0x8e23('0x14')],_0x40f13a);_0x470402(_0x487bcf[_0x8e23('0x12')](0x1f4,_0x56aa4c['message']));});});}; \ No newline at end of file +var _0xe83a=['ChatQueueReport,\x20%s,\x20%s','request\x20sent','debug','ChatQueueReport,\x20%s,\x20%s,\x20%s','stringify','error','message','result','CreateChatQueueReport','ChatQueueReport','create','options','info','catch','UpdateChatQueueReport','update','raw','where','attributes','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','then'];(function(_0x238ce7,_0x22d991){var _0x3045a1=function(_0x5cbb3d){while(--_0x5cbb3d){_0x238ce7['push'](_0x238ce7['shift']());}};_0x3045a1(++_0x22d991);}(_0xe83a,0x19f));var _0xae83=function(_0xe502ca,_0x1cc7cc){_0xe502ca=_0xe502ca-0x0;var _0x514270=_0xe83a[_0xe502ca];return _0x514270;};'use strict';var _=require(_0xae83('0x0'));var util=require(_0xae83('0x1'));var moment=require(_0xae83('0x2'));var BPromise=require(_0xae83('0x3'));var rs=require(_0xae83('0x4'));var fs=require('fs');var Redis=require(_0xae83('0x5'));var db=require(_0xae83('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0xae83('0x7'))(_0xae83('0x8'));var config=require(_0xae83('0x9'));var jayson=require(_0xae83('0xa'));var client=jayson[_0xae83('0xb')]['http']({'port':0x232a});function respondWithRpcPromise(_0x558b69,_0x47a9fc,_0x395df1){return new BPromise(function(_0x40d0c6,_0x256b9f){return client[_0xae83('0xc')](_0x558b69,_0x395df1)[_0xae83('0xd')](function(_0x4e2518){logger['info'](_0xae83('0xe'),_0x47a9fc,_0xae83('0xf'));logger[_0xae83('0x10')](_0xae83('0x11'),_0x47a9fc,_0xae83('0xf'),JSON[_0xae83('0x12')](_0x4e2518));if(_0x4e2518[_0xae83('0x13')]){if(_0x4e2518[_0xae83('0x13')]['code']===0x1f4){logger[_0xae83('0x13')]('ChatQueueReport,\x20%s,\x20%s',_0x47a9fc,_0x4e2518[_0xae83('0x13')]['message']);return _0x256b9f(_0x4e2518[_0xae83('0x13')][_0xae83('0x14')]);}logger[_0xae83('0x13')](_0xae83('0xe'),_0x47a9fc,_0x4e2518[_0xae83('0x13')][_0xae83('0x14')]);return _0x40d0c6(_0x4e2518[_0xae83('0x13')][_0xae83('0x14')]);}else{logger['info'](_0xae83('0xe'),_0x47a9fc,_0xae83('0xf'));_0x40d0c6(_0x4e2518[_0xae83('0x15')][_0xae83('0x14')]);}})['catch'](function(_0x438098){logger[_0xae83('0x13')](_0xae83('0xe'),_0x47a9fc,_0x438098);_0x256b9f(_0x438098);});});}exports[_0xae83('0x16')]=function(_0x81fd43){var _0x8f406f=this;return new Promise(function(_0x435853,_0x566f35){return db[_0xae83('0x17')][_0xae83('0x18')](_0x81fd43['body'],{'raw':_0x81fd43[_0xae83('0x19')]?_0x81fd43['options']['raw']===undefined?!![]:![]:!![]})[_0xae83('0xd')](function(_0x167277){logger[_0xae83('0x1a')](_0xae83('0x16'),_0x81fd43);logger[_0xae83('0x10')](_0xae83('0x16'),_0x81fd43,JSON['stringify'](_0x167277));_0x435853(_0x167277);})[_0xae83('0x1b')](function(_0x4b9d3a){logger[_0xae83('0x13')](_0xae83('0x16'),_0x4b9d3a[_0xae83('0x14')],_0x81fd43);_0x566f35(_0x8f406f[_0xae83('0x13')](0x1f4,_0x4b9d3a[_0xae83('0x14')]));});});};exports[_0xae83('0x1c')]=function(_0x3942e0){var _0x54b1c0=this;return new Promise(function(_0xe64f76,_0x8f2d9b){return db[_0xae83('0x17')][_0xae83('0x1d')](_0x3942e0['body'],{'raw':_0x3942e0[_0xae83('0x19')]?_0x3942e0[_0xae83('0x19')][_0xae83('0x1e')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x3942e0[_0xae83('0x19')]?_0x3942e0[_0xae83('0x19')][_0xae83('0x1f')]||null:null,'attributes':_0x3942e0[_0xae83('0x19')]?_0x3942e0[_0xae83('0x19')][_0xae83('0x20')]||null:null,'limit':_0x3942e0[_0xae83('0x19')]?_0x3942e0['options']['limit']||null:null})[_0xae83('0xd')](function(_0x47ae88){logger[_0xae83('0x1a')](_0xae83('0x1c'),_0x3942e0);logger['debug'](_0xae83('0x1c'),_0x3942e0,JSON[_0xae83('0x12')](_0x47ae88));_0xe64f76(_0x47ae88);})['catch'](function(_0x5b6236){logger[_0xae83('0x13')](_0xae83('0x1c'),_0x5b6236[_0xae83('0x14')],_0x3942e0);_0x8f2d9b(_0x54b1c0['error'](0x1f4,_0x5b6236['message']));});});}; \ No newline at end of file diff --git a/server/api/chatQueueReport/index.js b/server/api/chatQueueReport/index.js index 09eb690..7dc733d 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 _0xafb6=['/describe','describe','show','post','create','/:id','update','destroy','exports','multer','util','path','connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment','isAuthenticated'];(function(_0x4b2436,_0x452299){var _0x4f5ab2=function(_0x5c6679){while(--_0x5c6679){_0x4b2436['push'](_0x4b2436['shift']());}};_0x4f5ab2(++_0x452299);}(_0xafb6,0x129));var _0x6afb=function(_0x122096,_0x60c295){_0x122096=_0x122096-0x0;var _0x3d1966=_0xafb6[_0x122096];return _0x3d1966;};'use strict';var multer=require(_0x6afb('0x0'));var util=require(_0x6afb('0x1'));var path=require(_0x6afb('0x2'));var timeout=require(_0x6afb('0x3'));var express=require(_0x6afb('0x4'));var router=express['Router']();var auth=require(_0x6afb('0x5'));var interaction=require(_0x6afb('0x6'));var config=require(_0x6afb('0x7'));var controller=require('./chatQueueReport.controller');router['get']('/',auth[_0x6afb('0x8')](),controller['index']);router['get'](_0x6afb('0x9'),auth[_0x6afb('0x8')](),controller[_0x6afb('0xa')]);router['get']('/:id',auth[_0x6afb('0x8')](),controller[_0x6afb('0xb')]);router[_0x6afb('0xc')]('/',auth[_0x6afb('0x8')](),controller[_0x6afb('0xd')]);router['put'](_0x6afb('0xe'),auth[_0x6afb('0x8')](),controller[_0x6afb('0xf')]);router['delete']('/:id',auth[_0x6afb('0x8')](),controller[_0x6afb('0x10')]);module[_0x6afb('0x11')]=router; \ No newline at end of file +var _0x06b8=['express','../../components/auth/service','../../components/interaction/service','../../config/environment','./chatQueueReport.controller','get','isAuthenticated','/describe','describe','/:id','create','put','update','delete','destroy','exports','multer','util','path','connect-timeout'];(function(_0x21e0cc,_0x2094c4){var _0x3a29a9=function(_0x1a02ce){while(--_0x1a02ce){_0x21e0cc['push'](_0x21e0cc['shift']());}};_0x3a29a9(++_0x2094c4);}(_0x06b8,0xec));var _0x806b=function(_0x3b380d,_0x4bf247){_0x3b380d=_0x3b380d-0x0;var _0x54502b=_0x06b8[_0x3b380d];return _0x54502b;};'use strict';var multer=require(_0x806b('0x0'));var util=require(_0x806b('0x1'));var path=require(_0x806b('0x2'));var timeout=require(_0x806b('0x3'));var express=require(_0x806b('0x4'));var router=express['Router']();var auth=require(_0x806b('0x5'));var interaction=require(_0x806b('0x6'));var config=require(_0x806b('0x7'));var controller=require(_0x806b('0x8'));router[_0x806b('0x9')]('/',auth[_0x806b('0xa')](),controller['index']);router['get'](_0x806b('0xb'),auth[_0x806b('0xa')](),controller[_0x806b('0xc')]);router[_0x806b('0x9')](_0x806b('0xd'),auth[_0x806b('0xa')](),controller['show']);router['post']('/',auth[_0x806b('0xa')](),controller[_0x806b('0xe')]);router[_0x806b('0xf')]('/:id',auth[_0x806b('0xa')](),controller[_0x806b('0x10')]);router[_0x806b('0x11')]('/:id',auth[_0x806b('0xa')](),controller[_0x806b('0x12')]);module[_0x806b('0x13')]=router; \ No newline at end of file diff --git a/server/api/chatTransferReport/chatTransferReport.attributes.js b/server/api/chatTransferReport/chatTransferReport.attributes.js index 49f995b..fb8f082 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 _0x7f16=['NOW','sequelize','exports','ENUM','agent','queue','DATE'];(function(_0x2b31a8,_0x28b862){var _0x1175a5=function(_0x2cdb5d){while(--_0x2cdb5d){_0x2b31a8['push'](_0x2b31a8['shift']());}};_0x1175a5(++_0x28b862);}(_0x7f16,0xa2));var _0x67f1=function(_0x11cb1d,_0x4782da){_0x11cb1d=_0x11cb1d-0x0;var _0x353d97=_0x7f16[_0x11cb1d];return _0x353d97;};'use strict';var moment=require('moment');var Sequelize=require(_0x67f1('0x0'));module[_0x67f1('0x1')]={'uniqueid':{'type':Sequelize['STRING'],'allowNull':![]},'type':{'type':Sequelize[_0x67f1('0x2')]('account',_0x67f1('0x3'),_0x67f1('0x4')),'allowNull':![],'defaultValue':'queue'},'transferredAt':{'type':Sequelize[_0x67f1('0x5')],'allowNull':![],'defaultValue':Sequelize[_0x67f1('0x6')]}}; \ No newline at end of file +var _0xcb30=['agent','queue','DATE','moment','sequelize','ENUM','account'];(function(_0x1b7d95,_0x2cdce3){var _0x51ad62=function(_0x5a3980){while(--_0x5a3980){_0x1b7d95['push'](_0x1b7d95['shift']());}};_0x51ad62(++_0x2cdce3);}(_0xcb30,0x1df));var _0x0cb3=function(_0x32b2d3,_0x40c0f6){_0x32b2d3=_0x32b2d3-0x0;var _0x5339e2=_0xcb30[_0x32b2d3];return _0x5339e2;};'use strict';var moment=require(_0x0cb3('0x0'));var Sequelize=require(_0x0cb3('0x1'));module['exports']={'uniqueid':{'type':Sequelize['STRING'],'allowNull':![]},'type':{'type':Sequelize[_0x0cb3('0x2')](_0x0cb3('0x3'),_0x0cb3('0x4'),_0x0cb3('0x5')),'allowNull':![],'defaultValue':'queue'},'transferredAt':{'type':Sequelize[_0x0cb3('0x6')],'allowNull':![],'defaultValue':Sequelize['NOW']}}; \ No newline at end of file diff --git a/server/api/chatTransferReport/chatTransferReport.controller.js b/server/api/chatTransferReport/chatTransferReport.controller.js index 5b0804f..a0c4aae 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 _0x36e7=['desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','count','offset','limit','set','Content-Range','apply','reject','save','update','then','destroy','stack','name','send','index','map','rawAttributes','fieldName','key','model','keys','query','filters','intersection','attributes','fields','length','nolimit','order','sort','where','pick','filter','merge','type','VIRTUAL','options','ChatTransferReport','include','findAll','rows','catch','show','params','includeAll','create','body','find','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce'];(function(_0x1a7846,_0x59723e){var _0x48049=function(_0x203ff6){while(--_0x203ff6){_0x1a7846['push'](_0x1a7846['shift']());}};_0x48049(++_0x59723e);}(_0x36e7,0x133));var _0x736e=function(_0x432199,_0x59ba3f){_0x432199=_0x432199-0x0;var _0x2f5f92=_0x36e7[_0x432199];return _0x2f5f92;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x736e('0x0'));var rimraf=require(_0x736e('0x1'));var zipdir=require(_0x736e('0x2'));var jsonpatch=require(_0x736e('0x3'));var rp=require(_0x736e('0x4'));var moment=require(_0x736e('0x5'));var BPromise=require(_0x736e('0x6'));var Mustache=require(_0x736e('0x7'));var util=require(_0x736e('0x8'));var path=require(_0x736e('0x9'));var sox=require(_0x736e('0xa'));var csv=require(_0x736e('0xb'));var ejs=require(_0x736e('0xc'));var fs=require('fs');var _=require(_0x736e('0xd'));var squel=require(_0x736e('0xe'));var crypto=require(_0x736e('0xf'));var jsforce=require(_0x736e('0x10'));var deskjs=require(_0x736e('0x11'));var toCsv=require(_0x736e('0xb'));var querystring=require(_0x736e('0x12'));var Papa=require(_0x736e('0x13'));var Redis=require('ioredis');var authService=require(_0x736e('0x14'));var qs=require(_0x736e('0x15'));var as=require(_0x736e('0x16'));var hardwareService=require(_0x736e('0x17'));var logger=require('../../config/logger')(_0x736e('0x18'));var utils=require(_0x736e('0x19'));var config=require(_0x736e('0x1a'));var db=require(_0x736e('0x1b'))['db'];function respondWithStatusCode(_0x5a1b58,_0x3176b5){_0x3176b5=_0x3176b5||0xcc;return function(_0x58aa20){if(_0x58aa20){return _0x5a1b58[_0x736e('0x1c')](_0x3176b5);}return _0x5a1b58[_0x736e('0x1d')](_0x3176b5)[_0x736e('0x1e')]();};}function respondWithResult(_0x15f875,_0x1d9fda){_0x1d9fda=_0x1d9fda||0xc8;return function(_0x58bde8){if(_0x58bde8){return _0x15f875[_0x736e('0x1d')](_0x1d9fda)[_0x736e('0x1f')](_0x58bde8);}};}function respondWithFilteredResult(_0x52705e,_0x3c2703){return function(_0xdb4861){if(_0xdb4861){var _0x5988cd=_0xdb4861[_0x736e('0x20')],_0x4cb098=_0x3c2703[_0x736e('0x21')],_0x5cd422=_0x3c2703[_0x736e('0x21')]+_0x3c2703[_0x736e('0x22')],_0x2eb90a;if(_0x5cd422>=_0x5988cd){_0x5cd422=_0x5988cd;_0x2eb90a=0xc8;}else{_0x2eb90a=0xce;}_0x52705e['status'](_0x2eb90a);return _0x52705e[_0x736e('0x23')](_0x736e('0x24'),_0x4cb098+'-'+_0x5cd422+'/'+_0x5988cd)['json'](_0xdb4861);}return null;};}function patchUpdates(_0x36764b){return function(_0xf79109){try{jsonpatch[_0x736e('0x25')](_0xf79109,_0x36764b,!![]);}catch(_0x7970c){return BPromise[_0x736e('0x26')](_0x7970c);}return _0xf79109[_0x736e('0x27')]();};}function saveUpdates(_0x41d778,_0x49c8a8){return function(_0x62e9d3){if(_0x62e9d3){return _0x62e9d3[_0x736e('0x28')](_0x41d778)[_0x736e('0x29')](function(_0x3e5454){return _0x3e5454;});}return null;};}function removeEntity(_0x381d2f,_0x2af454){return function(_0x203b89){if(_0x203b89){return _0x203b89[_0x736e('0x2a')]()[_0x736e('0x29')](function(){_0x381d2f[_0x736e('0x1d')](0xcc)[_0x736e('0x1e')]();});}};}function handleEntityNotFound(_0x2d951a,_0x4ecf0b){return function(_0xad8495){if(!_0xad8495){_0x2d951a[_0x736e('0x1c')](0x194);}return _0xad8495;};}function handleError(_0x3eaf69,_0x224b38){_0x224b38=_0x224b38||0x1f4;return function(_0x593b41){logger['error'](_0x593b41[_0x736e('0x2b')]);if(_0x593b41[_0x736e('0x2c')]){delete _0x593b41[_0x736e('0x2c')];}_0x3eaf69[_0x736e('0x1d')](_0x224b38)[_0x736e('0x2d')](_0x593b41);};}exports[_0x736e('0x2e')]=function(_0x22a2b6,_0x361605){var _0xd2f17e={},_0x1b3eab={},_0x37b04c={'count':0x0,'rows':[]};var _0x1b2a09=_[_0x736e('0x2f')](db['ChatTransferReport'][_0x736e('0x30')],function(_0xad8dd5){return{'name':_0xad8dd5[_0x736e('0x31')],'type':_0xad8dd5['type'][_0x736e('0x32')]};});_0x1b3eab[_0x736e('0x33')]=_[_0x736e('0x2f')](_0x1b2a09,_0x736e('0x2c'));_0x1b3eab['query']=_[_0x736e('0x34')](_0x22a2b6[_0x736e('0x35')]);_0x1b3eab[_0x736e('0x36')]=_[_0x736e('0x37')](_0x1b3eab[_0x736e('0x33')],_0x1b3eab[_0x736e('0x35')]);_0xd2f17e[_0x736e('0x38')]=_[_0x736e('0x37')](_0x1b3eab[_0x736e('0x33')],qs['fields'](_0x22a2b6[_0x736e('0x35')][_0x736e('0x39')]));_0xd2f17e[_0x736e('0x38')]=_0xd2f17e[_0x736e('0x38')][_0x736e('0x3a')]?_0xd2f17e['attributes']:_0x1b3eab[_0x736e('0x33')];if(!_0x22a2b6[_0x736e('0x35')]['hasOwnProperty'](_0x736e('0x3b'))){_0xd2f17e['limit']=qs[_0x736e('0x22')](_0x22a2b6[_0x736e('0x35')][_0x736e('0x22')]);_0xd2f17e['offset']=qs['offset'](_0x22a2b6['query'][_0x736e('0x21')]);}_0xd2f17e[_0x736e('0x3c')]=qs['sort'](_0x22a2b6[_0x736e('0x35')][_0x736e('0x3d')]);_0xd2f17e[_0x736e('0x3e')]=qs[_0x736e('0x36')](_[_0x736e('0x3f')](_0x22a2b6[_0x736e('0x35')],_0x1b3eab[_0x736e('0x36')]));if(_0x22a2b6[_0x736e('0x35')][_0x736e('0x40')]){_0xd2f17e['where']=_[_0x736e('0x41')](_0xd2f17e[_0x736e('0x3e')],{'$or':_[_0x736e('0x2f')](_0x1b2a09,function(_0x4bbbcb){if(_0x4bbbcb[_0x736e('0x42')]!==_0x736e('0x43')){var _0x14c7e3={};_0x14c7e3[_0x4bbbcb[_0x736e('0x2c')]]={'$like':'%'+_0x22a2b6['query'][_0x736e('0x40')]+'%'};return _0x14c7e3;}})});}_0xd2f17e=_[_0x736e('0x41')]({},_0xd2f17e,_0x22a2b6[_0x736e('0x44')]);var _0x40c34a={'where':_0xd2f17e[_0x736e('0x3e')]};return db[_0x736e('0x45')][_0x736e('0x20')](_0x40c34a)[_0x736e('0x29')](function(_0x45258){_0x37b04c['count']=_0x45258;if(_0x22a2b6[_0x736e('0x35')]['includeAll']){_0xd2f17e[_0x736e('0x46')]=[{'all':!![]}];}return db[_0x736e('0x45')][_0x736e('0x47')](_0xd2f17e);})[_0x736e('0x29')](function(_0x427b55){_0x37b04c[_0x736e('0x48')]=_0x427b55;return _0x37b04c;})[_0x736e('0x29')](respondWithFilteredResult(_0x361605,_0xd2f17e))[_0x736e('0x49')](handleError(_0x361605,null));};exports[_0x736e('0x4a')]=function(_0xb0fe3,_0x5efc6d){var _0x5b8ac3={'raw':!![],'where':{'id':_0xb0fe3[_0x736e('0x4b')]['id']}},_0x68f053={};_0x68f053[_0x736e('0x33')]=_[_0x736e('0x34')](db[_0x736e('0x45')][_0x736e('0x30')]);_0x68f053[_0x736e('0x35')]=_[_0x736e('0x34')](_0xb0fe3[_0x736e('0x35')]);_0x68f053['filters']=_[_0x736e('0x37')](_0x68f053[_0x736e('0x33')],_0x68f053[_0x736e('0x35')]);_0x5b8ac3[_0x736e('0x38')]=_[_0x736e('0x37')](_0x68f053[_0x736e('0x33')],qs['fields'](_0xb0fe3[_0x736e('0x35')][_0x736e('0x39')]));_0x5b8ac3[_0x736e('0x38')]=_0x5b8ac3[_0x736e('0x38')]['length']?_0x5b8ac3[_0x736e('0x38')]:_0x68f053[_0x736e('0x33')];if(_0xb0fe3['query'][_0x736e('0x4c')]){_0x5b8ac3[_0x736e('0x46')]=[{'all':!![]}];}_0x5b8ac3=_[_0x736e('0x41')]({},_0x5b8ac3,_0xb0fe3[_0x736e('0x44')]);return db[_0x736e('0x45')]['find'](_0x5b8ac3)[_0x736e('0x29')](handleEntityNotFound(_0x5efc6d,null))['then'](respondWithResult(_0x5efc6d,null))['catch'](handleError(_0x5efc6d,null));};exports[_0x736e('0x4d')]=function(_0x2d96c5,_0x4afed1){return db[_0x736e('0x45')][_0x736e('0x4d')](_0x2d96c5[_0x736e('0x4e')],{})[_0x736e('0x29')](respondWithResult(_0x4afed1,0xc9))[_0x736e('0x49')](handleError(_0x4afed1,null));};exports[_0x736e('0x28')]=function(_0x259a3b,_0x148bfe){if(_0x259a3b[_0x736e('0x4e')]['id']){delete _0x259a3b['body']['id'];}return db['ChatTransferReport'][_0x736e('0x4f')]({'where':{'id':_0x259a3b[_0x736e('0x4b')]['id']}})[_0x736e('0x29')](handleEntityNotFound(_0x148bfe,null))['then'](saveUpdates(_0x259a3b[_0x736e('0x4e')],null))[_0x736e('0x29')](respondWithResult(_0x148bfe,null))[_0x736e('0x49')](handleError(_0x148bfe,null));};exports['destroy']=function(_0x58046e,_0x347be5){return db[_0x736e('0x45')][_0x736e('0x4f')]({'where':{'id':_0x58046e['params']['id']}})[_0x736e('0x29')](handleEntityNotFound(_0x347be5,null))[_0x736e('0x29')](removeEntity(_0x347be5,null))['catch'](handleError(_0x347be5,null));};exports[_0x736e('0x50')]=function(_0x2cd5d2,_0xf68cc9){return db[_0x736e('0x45')][_0x736e('0x50')]()['then'](respondWithResult(_0xf68cc9,null))[_0x736e('0x49')](handleError(_0xf68cc9,null));}; \ No newline at end of file +var _0xce49=['status','json','count','offset','set','Content-Range','apply','save','destroy','error','name','send','index','map','ChatTransferReport','fieldName','type','key','model','keys','query','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','limit','order','sort','pick','filter','where','merge','options','then','includeAll','findAll','show','params','rawAttributes','find','catch','create','body','update','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','end'];(function(_0x302971,_0x2c9676){var _0x572c55=function(_0x4b3a7c){while(--_0x4b3a7c){_0x302971['push'](_0x302971['shift']());}};_0x572c55(++_0x2c9676);}(_0xce49,0xc8));var _0x9ce4=function(_0x2052e3,_0x1fcda4){_0x2052e3=_0x2052e3-0x0;var _0x45ac26=_0xce49[_0x2052e3];return _0x45ac26;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x9ce4('0x0'));var rimraf=require(_0x9ce4('0x1'));var zipdir=require(_0x9ce4('0x2'));var jsonpatch=require(_0x9ce4('0x3'));var rp=require(_0x9ce4('0x4'));var moment=require('moment');var BPromise=require(_0x9ce4('0x5'));var Mustache=require(_0x9ce4('0x6'));var util=require(_0x9ce4('0x7'));var path=require(_0x9ce4('0x8'));var sox=require(_0x9ce4('0x9'));var csv=require(_0x9ce4('0xa'));var ejs=require(_0x9ce4('0xb'));var fs=require('fs');var _=require(_0x9ce4('0xc'));var squel=require(_0x9ce4('0xd'));var crypto=require('crypto');var jsforce=require(_0x9ce4('0xe'));var deskjs=require(_0x9ce4('0xf'));var toCsv=require(_0x9ce4('0xa'));var querystring=require('querystring');var Papa=require(_0x9ce4('0x10'));var Redis=require(_0x9ce4('0x11'));var authService=require(_0x9ce4('0x12'));var qs=require(_0x9ce4('0x13'));var as=require(_0x9ce4('0x14'));var hardwareService=require(_0x9ce4('0x15'));var logger=require(_0x9ce4('0x16'))(_0x9ce4('0x17'));var utils=require(_0x9ce4('0x18'));var config=require(_0x9ce4('0x19'));var db=require(_0x9ce4('0x1a'))['db'];function respondWithStatusCode(_0x2b213d,_0x5da8a1){_0x5da8a1=_0x5da8a1||0xcc;return function(_0x5a6472){if(_0x5a6472){return _0x2b213d['sendStatus'](_0x5da8a1);}return _0x2b213d['status'](_0x5da8a1)[_0x9ce4('0x1b')]();};}function respondWithResult(_0x2ecbea,_0x56d93e){_0x56d93e=_0x56d93e||0xc8;return function(_0x21f48a){if(_0x21f48a){return _0x2ecbea[_0x9ce4('0x1c')](_0x56d93e)[_0x9ce4('0x1d')](_0x21f48a);}};}function respondWithFilteredResult(_0x206778,_0xfd628a){return function(_0x4bc8d1){if(_0x4bc8d1){var _0x1368df=_0x4bc8d1[_0x9ce4('0x1e')],_0x53d107=_0xfd628a['offset'],_0x26f141=_0xfd628a[_0x9ce4('0x1f')]+_0xfd628a['limit'],_0x182d12;if(_0x26f141>=_0x1368df){_0x26f141=_0x1368df;_0x182d12=0xc8;}else{_0x182d12=0xce;}_0x206778[_0x9ce4('0x1c')](_0x182d12);return _0x206778[_0x9ce4('0x20')](_0x9ce4('0x21'),_0x53d107+'-'+_0x26f141+'/'+_0x1368df)[_0x9ce4('0x1d')](_0x4bc8d1);}return null;};}function patchUpdates(_0xb187d4){return function(_0x124295){try{jsonpatch[_0x9ce4('0x22')](_0x124295,_0xb187d4,!![]);}catch(_0x526858){return BPromise['reject'](_0x526858);}return _0x124295[_0x9ce4('0x23')]();};}function saveUpdates(_0x5035a1,_0x3dc69a){return function(_0x235b07){if(_0x235b07){return _0x235b07['update'](_0x5035a1)['then'](function(_0x58c9c7){return _0x58c9c7;});}return null;};}function removeEntity(_0x59d076,_0x30ca33){return function(_0x33d42b){if(_0x33d42b){return _0x33d42b[_0x9ce4('0x24')]()['then'](function(){_0x59d076[_0x9ce4('0x1c')](0xcc)['end']();});}};}function handleEntityNotFound(_0x1b5915,_0x4b6d2f){return function(_0x183a4b){if(!_0x183a4b){_0x1b5915['sendStatus'](0x194);}return _0x183a4b;};}function handleError(_0x10ed6d,_0x278ac4){_0x278ac4=_0x278ac4||0x1f4;return function(_0x4f644a){logger[_0x9ce4('0x25')](_0x4f644a['stack']);if(_0x4f644a[_0x9ce4('0x26')]){delete _0x4f644a[_0x9ce4('0x26')];}_0x10ed6d[_0x9ce4('0x1c')](_0x278ac4)[_0x9ce4('0x27')](_0x4f644a);};}exports[_0x9ce4('0x28')]=function(_0x4713af,_0x2626a3){var _0x21bb03={},_0x398db2={},_0x20e91a={'count':0x0,'rows':[]};var _0x4e7d06=_[_0x9ce4('0x29')](db[_0x9ce4('0x2a')]['rawAttributes'],function(_0x49cbae){return{'name':_0x49cbae[_0x9ce4('0x2b')],'type':_0x49cbae[_0x9ce4('0x2c')][_0x9ce4('0x2d')]};});_0x398db2[_0x9ce4('0x2e')]=_[_0x9ce4('0x29')](_0x4e7d06,_0x9ce4('0x26'));_0x398db2['query']=_[_0x9ce4('0x2f')](_0x4713af[_0x9ce4('0x30')]);_0x398db2[_0x9ce4('0x31')]=_[_0x9ce4('0x32')](_0x398db2['model'],_0x398db2[_0x9ce4('0x30')]);_0x21bb03['attributes']=_[_0x9ce4('0x32')](_0x398db2[_0x9ce4('0x2e')],qs[_0x9ce4('0x33')](_0x4713af[_0x9ce4('0x30')][_0x9ce4('0x33')]));_0x21bb03[_0x9ce4('0x34')]=_0x21bb03['attributes'][_0x9ce4('0x35')]?_0x21bb03['attributes']:_0x398db2[_0x9ce4('0x2e')];if(!_0x4713af[_0x9ce4('0x30')][_0x9ce4('0x36')](_0x9ce4('0x37'))){_0x21bb03[_0x9ce4('0x38')]=qs[_0x9ce4('0x38')](_0x4713af['query'][_0x9ce4('0x38')]);_0x21bb03[_0x9ce4('0x1f')]=qs[_0x9ce4('0x1f')](_0x4713af[_0x9ce4('0x30')][_0x9ce4('0x1f')]);}_0x21bb03[_0x9ce4('0x39')]=qs[_0x9ce4('0x3a')](_0x4713af[_0x9ce4('0x30')][_0x9ce4('0x3a')]);_0x21bb03['where']=qs[_0x9ce4('0x31')](_[_0x9ce4('0x3b')](_0x4713af[_0x9ce4('0x30')],_0x398db2[_0x9ce4('0x31')]));if(_0x4713af[_0x9ce4('0x30')][_0x9ce4('0x3c')]){_0x21bb03[_0x9ce4('0x3d')]=_['merge'](_0x21bb03[_0x9ce4('0x3d')],{'$or':_[_0x9ce4('0x29')](_0x4e7d06,function(_0x1bfb55){if(_0x1bfb55[_0x9ce4('0x2c')]!=='VIRTUAL'){var _0x4567a6={};_0x4567a6[_0x1bfb55['name']]={'$like':'%'+_0x4713af[_0x9ce4('0x30')][_0x9ce4('0x3c')]+'%'};return _0x4567a6;}})});}_0x21bb03=_[_0x9ce4('0x3e')]({},_0x21bb03,_0x4713af[_0x9ce4('0x3f')]);var _0x17f688={'where':_0x21bb03[_0x9ce4('0x3d')]};return db['ChatTransferReport'][_0x9ce4('0x1e')](_0x17f688)[_0x9ce4('0x40')](function(_0x2c635b){_0x20e91a[_0x9ce4('0x1e')]=_0x2c635b;if(_0x4713af[_0x9ce4('0x30')][_0x9ce4('0x41')]){_0x21bb03['include']=[{'all':!![]}];}return db[_0x9ce4('0x2a')][_0x9ce4('0x42')](_0x21bb03);})[_0x9ce4('0x40')](function(_0x265c8c){_0x20e91a['rows']=_0x265c8c;return _0x20e91a;})[_0x9ce4('0x40')](respondWithFilteredResult(_0x2626a3,_0x21bb03))['catch'](handleError(_0x2626a3,null));};exports[_0x9ce4('0x43')]=function(_0x3500bf,_0x31895d){var _0x338362={'raw':!![],'where':{'id':_0x3500bf[_0x9ce4('0x44')]['id']}},_0x1e380d={};_0x1e380d[_0x9ce4('0x2e')]=_[_0x9ce4('0x2f')](db['ChatTransferReport'][_0x9ce4('0x45')]);_0x1e380d[_0x9ce4('0x30')]=_[_0x9ce4('0x2f')](_0x3500bf['query']);_0x1e380d[_0x9ce4('0x31')]=_[_0x9ce4('0x32')](_0x1e380d[_0x9ce4('0x2e')],_0x1e380d[_0x9ce4('0x30')]);_0x338362[_0x9ce4('0x34')]=_[_0x9ce4('0x32')](_0x1e380d[_0x9ce4('0x2e')],qs['fields'](_0x3500bf[_0x9ce4('0x30')][_0x9ce4('0x33')]));_0x338362['attributes']=_0x338362['attributes'][_0x9ce4('0x35')]?_0x338362[_0x9ce4('0x34')]:_0x1e380d[_0x9ce4('0x2e')];if(_0x3500bf[_0x9ce4('0x30')][_0x9ce4('0x41')]){_0x338362['include']=[{'all':!![]}];}_0x338362=_[_0x9ce4('0x3e')]({},_0x338362,_0x3500bf[_0x9ce4('0x3f')]);return db[_0x9ce4('0x2a')][_0x9ce4('0x46')](_0x338362)['then'](handleEntityNotFound(_0x31895d,null))[_0x9ce4('0x40')](respondWithResult(_0x31895d,null))[_0x9ce4('0x47')](handleError(_0x31895d,null));};exports[_0x9ce4('0x48')]=function(_0x589068,_0x17cbb7){return db[_0x9ce4('0x2a')][_0x9ce4('0x48')](_0x589068[_0x9ce4('0x49')],{})[_0x9ce4('0x40')](respondWithResult(_0x17cbb7,0xc9))[_0x9ce4('0x47')](handleError(_0x17cbb7,null));};exports[_0x9ce4('0x4a')]=function(_0x5a1f09,_0x475cf2){if(_0x5a1f09[_0x9ce4('0x49')]['id']){delete _0x5a1f09[_0x9ce4('0x49')]['id'];}return db['ChatTransferReport'][_0x9ce4('0x46')]({'where':{'id':_0x5a1f09[_0x9ce4('0x44')]['id']}})[_0x9ce4('0x40')](handleEntityNotFound(_0x475cf2,null))[_0x9ce4('0x40')](saveUpdates(_0x5a1f09[_0x9ce4('0x49')],null))[_0x9ce4('0x40')](respondWithResult(_0x475cf2,null))[_0x9ce4('0x47')](handleError(_0x475cf2,null));};exports[_0x9ce4('0x24')]=function(_0x53ca9e,_0x2b8507){return db[_0x9ce4('0x2a')][_0x9ce4('0x46')]({'where':{'id':_0x53ca9e['params']['id']}})[_0x9ce4('0x40')](handleEntityNotFound(_0x2b8507,null))[_0x9ce4('0x40')](removeEntity(_0x2b8507,null))[_0x9ce4('0x47')](handleError(_0x2b8507,null));};exports[_0x9ce4('0x4b')]=function(_0x4aee54,_0x193445){return db['ChatTransferReport']['describe']()['then'](respondWithResult(_0x193445,null))[_0x9ce4('0x47')](handleError(_0x193445,null));}; \ No newline at end of file diff --git a/server/api/chatTransferReport/chatTransferReport.model.js b/server/api/chatTransferReport/chatTransferReport.model.js index df6ca6f..430cfb3 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 _0xba8e=['moment','bluebird','request-promise','path','rimraf','exports','report_chat_transfer','uniqueid','lodash','util'];(function(_0x4b2863,_0x494899){var _0x567d67=function(_0x751f03){while(--_0x751f03){_0x4b2863['push'](_0x4b2863['shift']());}};_0x567d67(++_0x494899);}(_0xba8e,0xe4));var _0xeba8=function(_0x308dcc,_0x2d1178){_0x308dcc=_0x308dcc-0x0;var _0x361717=_0xba8e[_0x308dcc];return _0x361717;};'use strict';var _=require(_0xeba8('0x0'));var util=require(_0xeba8('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0xeba8('0x2'));var BPromise=require(_0xeba8('0x3'));var rp=require(_0xeba8('0x4'));var fs=require('fs');var path=require(_0xeba8('0x5'));var rimraf=require(_0xeba8('0x6'));var config=require('../../config/environment');var attributes=require('./chatTransferReport.attributes');module[_0xeba8('0x7')]=function(_0x2441f8,_0x4d0b4c){return _0x2441f8['define']('ChatTransferReport',attributes,{'tableName':_0xeba8('0x8'),'paranoid':![],'indexes':[{'name':_0xeba8('0x9'),'fields':[_0xeba8('0x9')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xb67c=['define','ChatTransferReport','uniqueid','lodash','../../config/logger','moment','bluebird','request-promise','rimraf','../../config/environment','./chatTransferReport.attributes','exports'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xb67c,0x183));var _0xcb67=function(_0x9f295b,_0x5d274d){_0x9f295b=_0x9f295b-0x0;var _0x36d06d=_0xb67c[_0x9f295b];return _0x36d06d;};'use strict';var _=require(_0xcb67('0x0'));var util=require('util');var logger=require(_0xcb67('0x1'))('api');var moment=require(_0xcb67('0x2'));var BPromise=require(_0xcb67('0x3'));var rp=require(_0xcb67('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0xcb67('0x5'));var config=require(_0xcb67('0x6'));var attributes=require(_0xcb67('0x7'));module[_0xcb67('0x8')]=function(_0x571b69,_0xb2dff2){return _0x571b69[_0xcb67('0x9')](_0xcb67('0xa'),attributes,{'tableName':'report_chat_transfer','paranoid':![],'indexes':[{'name':_0xcb67('0xb'),'fields':[_0xcb67('0xb')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/chatTransferReport/chatTransferReport.rpc.js b/server/api/chatTransferReport/chatTransferReport.rpc.js index 7c94043..f012332 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 _0xf869=['jayson/promise','client','http','request','info','request\x20sent','debug','ChatTransferReport,\x20%s,\x20%s,\x20%s','stringify','error','code','ChatTransferReport,\x20%s,\x20%s','message','result','catch','lodash','util','moment','randomstring','ioredis','../../mysqldb','rpc','../../config/environment'];(function(_0x11c506,_0x38a112){var _0x504c05=function(_0x137a0a){while(--_0x137a0a){_0x11c506['push'](_0x11c506['shift']());}};_0x504c05(++_0x38a112);}(_0xf869,0x151));var _0x9f86=function(_0x45adaf,_0x21c3c1){_0x45adaf=_0x45adaf-0x0;var _0x15d189=_0xf869[_0x45adaf];return _0x15d189;};'use strict';var _=require(_0x9f86('0x0'));var util=require(_0x9f86('0x1'));var moment=require(_0x9f86('0x2'));var BPromise=require('bluebird');var rs=require(_0x9f86('0x3'));var fs=require('fs');var Redis=require(_0x9f86('0x4'));var db=require(_0x9f86('0x5'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x9f86('0x6'));var config=require(_0x9f86('0x7'));var jayson=require(_0x9f86('0x8'));var client=jayson[_0x9f86('0x9')][_0x9f86('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x29f95c,_0x43c72f,_0x8308d7){return new BPromise(function(_0x472513,_0x2ae423){return client[_0x9f86('0xb')](_0x29f95c,_0x8308d7)['then'](function(_0x1c2249){logger[_0x9f86('0xc')]('ChatTransferReport,\x20%s,\x20%s',_0x43c72f,_0x9f86('0xd'));logger[_0x9f86('0xe')](_0x9f86('0xf'),_0x43c72f,_0x9f86('0xd'),JSON[_0x9f86('0x10')](_0x1c2249));if(_0x1c2249[_0x9f86('0x11')]){if(_0x1c2249[_0x9f86('0x11')][_0x9f86('0x12')]===0x1f4){logger[_0x9f86('0x11')](_0x9f86('0x13'),_0x43c72f,_0x1c2249[_0x9f86('0x11')][_0x9f86('0x14')]);return _0x2ae423(_0x1c2249[_0x9f86('0x11')][_0x9f86('0x14')]);}logger[_0x9f86('0x11')]('ChatTransferReport,\x20%s,\x20%s',_0x43c72f,_0x1c2249[_0x9f86('0x11')][_0x9f86('0x14')]);return _0x472513(_0x1c2249['error']['message']);}else{logger[_0x9f86('0xc')](_0x9f86('0x13'),_0x43c72f,'request\x20sent');_0x472513(_0x1c2249[_0x9f86('0x15')][_0x9f86('0x14')]);}})[_0x9f86('0x16')](function(_0x1da791){logger[_0x9f86('0x11')]('ChatTransferReport,\x20%s,\x20%s',_0x43c72f,_0x1da791);_0x2ae423(_0x1da791);});});} \ No newline at end of file +var _0xdd0d=['bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','request','ChatTransferReport,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','info','result','catch','util','moment'];(function(_0x2aa0e7,_0x4e5145){var _0x1472c0=function(_0x4deaeb){while(--_0x4deaeb){_0x2aa0e7['push'](_0x2aa0e7['shift']());}};_0x1472c0(++_0x4e5145);}(_0xdd0d,0x14e));var _0xddd0=function(_0x4df359,_0x141e94){_0x4df359=_0x4df359-0x0;var _0x2f64f2=_0xdd0d[_0x4df359];return _0x2f64f2;};'use strict';var _=require('lodash');var util=require(_0xddd0('0x0'));var moment=require(_0xddd0('0x1'));var BPromise=require(_0xddd0('0x2'));var rs=require(_0xddd0('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xddd0('0x4'))['db'];var utils=require(_0xddd0('0x5'));var logger=require(_0xddd0('0x6'))('rpc');var config=require(_0xddd0('0x7'));var jayson=require(_0xddd0('0x8'));var client=jayson[_0xddd0('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x288d67,_0x4209d1,_0x453460){return new BPromise(function(_0x2026a4,_0x3aabda){return client[_0xddd0('0xa')](_0x288d67,_0x453460)['then'](function(_0x2d10dd){logger['info'](_0xddd0('0xb'),_0x4209d1,_0xddd0('0xc'));logger[_0xddd0('0xd')]('ChatTransferReport,\x20%s,\x20%s,\x20%s',_0x4209d1,_0xddd0('0xc'),JSON[_0xddd0('0xe')](_0x2d10dd));if(_0x2d10dd['error']){if(_0x2d10dd[_0xddd0('0xf')][_0xddd0('0x10')]===0x1f4){logger[_0xddd0('0xf')](_0xddd0('0xb'),_0x4209d1,_0x2d10dd[_0xddd0('0xf')][_0xddd0('0x11')]);return _0x3aabda(_0x2d10dd[_0xddd0('0xf')][_0xddd0('0x11')]);}logger['error'](_0xddd0('0xb'),_0x4209d1,_0x2d10dd[_0xddd0('0xf')]['message']);return _0x2026a4(_0x2d10dd[_0xddd0('0xf')][_0xddd0('0x11')]);}else{logger[_0xddd0('0x12')](_0xddd0('0xb'),_0x4209d1,_0xddd0('0xc'));_0x2026a4(_0x2d10dd[_0xddd0('0x13')][_0xddd0('0x11')]);}})[_0xddd0('0x14')](function(_0x33a8a0){logger[_0xddd0('0xf')](_0xddd0('0xb'),_0x4209d1,_0x33a8a0);_0x3aabda(_0x33a8a0);});});} \ No newline at end of file diff --git a/server/api/chatTransferReport/index.js b/server/api/chatTransferReport/index.js index 5e3b59c..0061a96 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 _0xb10b=['../../config/environment','./chatTransferReport.controller','get','isAuthenticated','/describe','describe','/:id','show','post','create','update','delete','exports','multer','path','connect-timeout','express','../../components/auth/service','../../components/interaction/service'];(function(_0x2af333,_0x54f43f){var _0x1f22a5=function(_0x15ff1b){while(--_0x15ff1b){_0x2af333['push'](_0x2af333['shift']());}};_0x1f22a5(++_0x54f43f);}(_0xb10b,0x12a));var _0xbb10=function(_0x259c99,_0x28fc7b){_0x259c99=_0x259c99-0x0;var _0x589fef=_0xb10b[_0x259c99];return _0x589fef;};'use strict';var multer=require(_0xbb10('0x0'));var util=require('util');var path=require(_0xbb10('0x1'));var timeout=require(_0xbb10('0x2'));var express=require(_0xbb10('0x3'));var router=express['Router']();var auth=require(_0xbb10('0x4'));var interaction=require(_0xbb10('0x5'));var config=require(_0xbb10('0x6'));var controller=require(_0xbb10('0x7'));router[_0xbb10('0x8')]('/',auth[_0xbb10('0x9')](),controller['index']);router[_0xbb10('0x8')](_0xbb10('0xa'),auth['isAuthenticated'](),controller[_0xbb10('0xb')]);router[_0xbb10('0x8')](_0xbb10('0xc'),auth[_0xbb10('0x9')](),controller[_0xbb10('0xd')]);router[_0xbb10('0xe')]('/',auth[_0xbb10('0x9')](),controller[_0xbb10('0xf')]);router['put']('/:id',auth[_0xbb10('0x9')](),controller[_0xbb10('0x10')]);router[_0xbb10('0x11')]('/:id',auth[_0xbb10('0x9')](),controller['destroy']);module[_0xbb10('0x12')]=router; \ No newline at end of file +var _0xb10b=['../../config/environment','./chatTransferReport.controller','get','isAuthenticated','/describe','describe','/:id','show','post','create','update','delete','exports','multer','path','connect-timeout','express','../../components/auth/service','../../components/interaction/service'];(function(_0x1d919b,_0x3188f8){var _0x233c28=function(_0x37927a){while(--_0x37927a){_0x1d919b['push'](_0x1d919b['shift']());}};_0x233c28(++_0x3188f8);}(_0xb10b,0x12a));var _0xbb10=function(_0x12ae97,_0x385f36){_0x12ae97=_0x12ae97-0x0;var _0xb50847=_0xb10b[_0x12ae97];return _0xb50847;};'use strict';var multer=require(_0xbb10('0x0'));var util=require('util');var path=require(_0xbb10('0x1'));var timeout=require(_0xbb10('0x2'));var express=require(_0xbb10('0x3'));var router=express['Router']();var auth=require(_0xbb10('0x4'));var interaction=require(_0xbb10('0x5'));var config=require(_0xbb10('0x6'));var controller=require(_0xbb10('0x7'));router[_0xbb10('0x8')]('/',auth[_0xbb10('0x9')](),controller['index']);router[_0xbb10('0x8')](_0xbb10('0xa'),auth['isAuthenticated'](),controller[_0xbb10('0xb')]);router[_0xbb10('0x8')](_0xbb10('0xc'),auth[_0xbb10('0x9')](),controller[_0xbb10('0xd')]);router[_0xbb10('0xe')]('/',auth[_0xbb10('0x9')](),controller[_0xbb10('0xf')]);router['put']('/:id',auth[_0xbb10('0x9')](),controller[_0xbb10('0x10')]);router[_0xbb10('0x11')]('/:id',auth[_0xbb10('0x9')](),controller['destroy']);module[_0xbb10('0x12')]=router; \ No newline at end of file diff --git a/server/api/chatWebsite/chatWebsite.attributes.js b/server/api/chatWebsite/chatWebsite.attributes.js index 513fcd8..5a4f347 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 _0x5c25=['Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','mandatoryDispositionPauseId','mandatoryDisposition','sequelize','exports','STRING','address','email','Agent','#9f946a','#ffffff','INTEGER','BOOLEAN','squared','rounded','We\x20are\x20here!','Chat','Send','Contact\x20us','TEXT','Do\x20you\x20want\x20to\x20close\x20the\x20interaction?','Form\x20properly\x20submitted','Form\x20submission\x20error','Type\x20a\x20message','Thanks\x20you\x20for\x20your\x20time!','Skip','ENUM','star','stringify','input','name','text','getDataValue','parse','onlineForm','setDataValue','textarea','Comments','Leave\x20your\x20comments','offlineForm','generate','All\x20of\x20our\x20agents\x20are\x20busy\x20at\x20this\x20time.\x20Your\x20chat\x20is\x20very\x20important\x20to\x20us.','Please\x20hold\x20and\x20we\x20will\x20answer\x20your\x20request\x20as\x20soon\x20as\x20possible.','New\x20offline\x20message\x20from\x20websiteName','You\x20received\x20a\x20new\x20offline\x20message\x20from\x20websiteName.\x20Here\x20you\x20can\x20find\x20the\x20details\x20of\x20the\x20request:','Your\x20request\x20has\x20not\x20been\x20processed.','website_alias','bottom_right','alternate','#fafafa','System'];(function(_0x2f3848,_0x48564d){var _0x102668=function(_0x5e32ab){while(--_0x5e32ab){_0x2f3848['push'](_0x2f3848['shift']());}};_0x102668(++_0x48564d);}(_0x5c25,0x168));var _0x55c2=function(_0x2627d2,_0x105c40){_0x2627d2=_0x2627d2-0x0;var _0x404dcf=_0x5c25[_0x2627d2];return _0x404dcf;};'use strict';var Sequelize=require(_0x55c2('0x0'));var rs=require('randomstring');module[_0x55c2('0x1')]={'name':{'type':Sequelize[_0x55c2('0x2')],'allowNull':![]},'address':{'type':Sequelize[_0x55c2('0x2')],'allowNull':![],'unique':_0x55c2('0x3')},'description':{'type':Sequelize[_0x55c2('0x2')]},'mapKey':{'type':Sequelize[_0x55c2('0x2')],'defaultValue':_0x55c2('0x4')},'mapKeyOffline':{'type':Sequelize[_0x55c2('0x2')],'defaultValue':'email'},'key':{'type':Sequelize[_0x55c2('0x2')],'allowNull':![]},'agentAlias':{'type':Sequelize[_0x55c2('0x2')],'defaultValue':_0x55c2('0x5')},'customerAlias':{'type':Sequelize[_0x55c2('0x2')],'defaultValue':'Me'},'color':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0x55c2('0x6'),'validate':{'notEmpty':!![]}},'color_button':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0x55c2('0x6'),'validate':{'notEmpty':!![]}},'textColor':{'type':Sequelize[_0x55c2('0x2')],'allowNull':![],'defaultValue':_0x55c2('0x7'),'validate':{'notEmpty':!![]}},'fontSize':{'type':Sequelize[_0x55c2('0x8')],'defaultValue':0xf},'remote':{'type':Sequelize[_0x55c2('0x2')]},'animation':{'type':Sequelize[_0x55c2('0x9')],'defaultValue':!![]},'header_shape':{'type':Sequelize['ENUM']('rounded',_0x55c2('0xa')),'defaultValue':_0x55c2('0xb')},'header_online':{'type':Sequelize['STRING'],'defaultValue':_0x55c2('0xc')},'start_chat_button':{'type':Sequelize[_0x55c2('0x2')],'defaultValue':_0x55c2('0xd')},'offline_chat_button':{'type':Sequelize[_0x55c2('0x2')],'defaultValue':_0x55c2('0xe')},'header_offline':{'type':Sequelize['STRING'],'defaultValue':_0x55c2('0xf')},'download_transcript':{'type':Sequelize[_0x55c2('0x9')],'defaultValue':!![]},'timeout':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'whiteLabel':{'type':Sequelize[_0x55c2('0x2')],'defaultValue':'Powered\x20by\x20xCALLY'},'defaultWhiteLabel':{'type':Sequelize[_0x55c2('0x9')],'defaultValue':!![]},'sitepic':{'type':Sequelize[_0x55c2('0x10')]},'closingQuestion':{'type':Sequelize[_0x55c2('0x2')],'defaultValue':_0x55c2('0x11')},'formSubmitSuccessMessage':{'type':Sequelize[_0x55c2('0x2')],'defaultValue':_0x55c2('0x12')},'formSubmitFailureMessage':{'type':Sequelize['STRING'],'defaultValue':_0x55c2('0x13')},'noteTitle':{'type':Sequelize[_0x55c2('0x2')],'defaultValue':'Note'},'placeholderMessage':{'type':Sequelize['STRING'],'defaultValue':_0x55c2('0x14')},'closingMessage':{'type':Sequelize[_0x55c2('0x2')],'defaultValue':_0x55c2('0x15')},'closingMessageButton':{'type':Sequelize['STRING'],'defaultValue':_0x55c2('0xe')},'skipMessageButton':{'type':Sequelize[_0x55c2('0x2')],'defaultValue':_0x55c2('0x16')},'conditionAgreement':{'type':Sequelize[_0x55c2('0x9')],'defaultValue':![]},'enableRating':{'type':Sequelize[_0x55c2('0x9')],'defaultValue':![]},'enableFeedback':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'enableSendButton':{'type':Sequelize[_0x55c2('0x9')],'defaultValue':![]},'feedbackTitle':{'type':Sequelize[_0x55c2('0x2')],'defaultValue':'Feedback'},'ratingType':{'type':Sequelize[_0x55c2('0x17')](_0x55c2('0x18'),'thumb'),'defaultValue':_0x55c2('0x18')},'ratingStarsNumber':{'type':Sequelize[_0x55c2('0x8')],'defaultValue':0x5},'onlineForm':{'type':Sequelize[_0x55c2('0x10')],'defaultValue':function(){return JSON[_0x55c2('0x19')]({'items':[{'type':_0x55c2('0x1a'),'variable':null,'config':{'placeholder':_0x55c2('0x1b'),'type':_0x55c2('0x1c'),'required':!![]},'props':{'title':_0x55c2('0x1b'),'helpText':''}},{'type':_0x55c2('0x1a'),'props':{'title':'email','helpText':''},'config':{'required':!![],'placeholder':_0x55c2('0x4'),'type':_0x55c2('0x4')},'variable':null}],'fromKey':0x1});},'get':function(){return this[_0x55c2('0x1d')]('onlineForm')?JSON[_0x55c2('0x1e')](this['getDataValue'](_0x55c2('0x1f'))):{};},'set':function(_0x2895f2){return this[_0x55c2('0x20')](_0x55c2('0x1f'),JSON[_0x55c2('0x19')](_0x2895f2));}},'offlineForm':{'type':Sequelize[_0x55c2('0x10')],'defaultValue':function(){return JSON['stringify']({'items':[{'type':_0x55c2('0x1a'),'props':{'title':_0x55c2('0x4'),'helpText':''},'config':{'required':!![],'placeholder':_0x55c2('0x4'),'type':_0x55c2('0x4')},'variable':null},{'type':_0x55c2('0x21'),'config':{'placeholder':_0x55c2('0x22')},'props':{'title':'Comments','helpText':_0x55c2('0x23')}}],'fromKey':0x0});},'get':function(){return this['getDataValue'](_0x55c2('0x24'))?JSON[_0x55c2('0x1e')](this[_0x55c2('0x1d')]('offlineForm')):{};},'set':function(_0x37cf77){return this[_0x55c2('0x20')](_0x55c2('0x24'),JSON[_0x55c2('0x19')](_0x37cf77));}},'token':{'type':Sequelize['STRING'],'defaultValue':function(){return rs[_0x55c2('0x25')]();}},'autoclose':{'type':Sequelize[_0x55c2('0x9')],'defaultValue':!![]},'enableCustomerWriting':{'type':Sequelize[_0x55c2('0x9')],'defaultValue':![]},'forwardTranscript':{'type':Sequelize[_0x55c2('0x9')],'defaultValue':![]},'forwardTranscriptMessage':{'type':Sequelize[_0x55c2('0x2')]},'forwardOffline':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'forwardOfflineAddress':{'type':Sequelize[_0x55c2('0x2')]},'waitingTitle':{'type':Sequelize[_0x55c2('0x2')],'defaultValue':_0x55c2('0x26')},'waitingMessage':{'type':Sequelize['STRING'],'defaultValue':_0x55c2('0x27')},'offlineMessageSubject':{'type':Sequelize[_0x55c2('0x2')],'defaultValue':_0x55c2('0x28')},'offlineMessageBody':{'type':Sequelize['STRING'],'defaultValue':_0x55c2('0x29')},'enableUnmanagedNote':{'type':Sequelize[_0x55c2('0x9')],'defaultValue':!![]},'unmanagedMessage':{'type':Sequelize['STRING'],'defaultValue':_0x55c2('0x2a')},'skipUnmanaged':{'type':Sequelize[_0x55c2('0x2')],'defaultValue':_0x55c2('0x16')},'sendUnmanaged':{'type':Sequelize[_0x55c2('0x2')],'defaultValue':'Send'},'enableCustomerAttachment':{'type':Sequelize[_0x55c2('0x9')],'defaultValue':![]},'enableCustomerCheckmarks':{'type':Sequelize[_0x55c2('0x9')],'defaultValue':![]},'agentAvatar':{'type':Sequelize[_0x55c2('0x10')]},'showAgentAvatar':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'timezone':{'type':Sequelize['STRING']},'notificationTemplate':{'type':Sequelize[_0x55c2('0x10')],'defaultValue':function(){return'Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}';}},'notificationSound':{'type':Sequelize[_0x55c2('0x9')],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0x55c2('0x9')],'defaultValue':![]},'hideWhenOffline':{'type':Sequelize[_0x55c2('0x9')],'defaultValue':![]},'agentIdentifier':{'type':Sequelize[_0x55c2('0x2')],'defaultValue':_0x55c2('0x2b')},'waitForTheAssignedAgent':{'type':Sequelize[_0x55c2('0x8')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'alignment':{'type':Sequelize[_0x55c2('0x2')],'defaultValue':_0x55c2('0x2c')},'verticalAlignment':{'type':Sequelize[_0x55c2('0x8')],'defaultValue':0x1e},'messagesAlignment':{'type':Sequelize[_0x55c2('0x2')],'defaultValue':_0x55c2('0x2d')},'defaultTitle':{'type':Sequelize[_0x55c2('0x2')]},'customerAvatar':{'type':Sequelize[_0x55c2('0x10')]},'showCustomerAvatar':{'type':Sequelize[_0x55c2('0x9')],'defaultValue':![]},'messageFontSize':{'type':Sequelize[_0x55c2('0x8')],'defaultValue':0xc},'backgroundColor':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0x55c2('0x2e'),'validate':{'notEmpty':!![]}},'queueTransfer':{'type':Sequelize[_0x55c2('0x9')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0x55c2('0x8')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0x55c2('0x8')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'systemAlias':{'type':Sequelize[_0x55c2('0x2')],'defaultValue':_0x55c2('0x2f')},'systemAvatar':{'type':Sequelize['TEXT']},'mandatoryDispositionPauseId':{'type':Sequelize[_0x55c2('0x8')],'comment':_0x55c2('0x30')},'mandatoryDisposition':{'type':Sequelize[_0x55c2('0x9')],'defaultValue':![],'comment':'Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','set':function(_0x20a15e){if(!_0x20a15e)this['setDataValue'](_0x55c2('0x31'),null);this['setDataValue'](_0x55c2('0x32'),_0x20a15e);}}}; \ No newline at end of file +var _0xcb84=['input','name','getDataValue','onlineForm','parse','setDataValue','textarea','Comments','Leave\x20your\x20comments','offlineForm','generate','All\x20of\x20our\x20agents\x20are\x20busy\x20at\x20this\x20time.\x20Your\x20chat\x20is\x20very\x20important\x20to\x20us.','Please\x20hold\x20and\x20we\x20will\x20answer\x20your\x20request\x20as\x20soon\x20as\x20possible.','New\x20offline\x20message\x20from\x20websiteName','You\x20received\x20a\x20new\x20offline\x20message\x20from\x20websiteName.\x20Here\x20you\x20can\x20find\x20the\x20details\x20of\x20the\x20request:','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}','website_alias','bottom_right','alternate','#fafafa','System','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','sequelize','randomstring','STRING','email','Agent','#9f946a','#ffffff','INTEGER','BOOLEAN','ENUM','rounded','squared','We\x20are\x20here!','Chat','Send','Contact\x20us','Powered\x20by\x20xCALLY','TEXT','Form\x20properly\x20submitted','Form\x20submission\x20error','Note','Skip','Feedback','star','thumb','stringify'];(function(_0x52adf4,_0x3ffb0f){var _0x47705f=function(_0x264f07){while(--_0x264f07){_0x52adf4['push'](_0x52adf4['shift']());}};_0x47705f(++_0x3ffb0f);}(_0xcb84,0xa6));var _0x4cb8=function(_0x1bb812,_0x23eacc){_0x1bb812=_0x1bb812-0x0;var _0x372adb=_0xcb84[_0x1bb812];return _0x372adb;};'use strict';var Sequelize=require(_0x4cb8('0x0'));var rs=require(_0x4cb8('0x1'));module['exports']={'name':{'type':Sequelize[_0x4cb8('0x2')],'allowNull':![]},'address':{'type':Sequelize[_0x4cb8('0x2')],'allowNull':![],'unique':'address'},'description':{'type':Sequelize['STRING']},'mapKey':{'type':Sequelize[_0x4cb8('0x2')],'defaultValue':_0x4cb8('0x3')},'mapKeyOffline':{'type':Sequelize[_0x4cb8('0x2')],'defaultValue':'email'},'key':{'type':Sequelize[_0x4cb8('0x2')],'allowNull':![]},'agentAlias':{'type':Sequelize['STRING'],'defaultValue':_0x4cb8('0x4')},'customerAlias':{'type':Sequelize['STRING'],'defaultValue':'Me'},'color':{'type':Sequelize[_0x4cb8('0x2')],'allowNull':![],'defaultValue':'#9f946a','validate':{'notEmpty':!![]}},'color_button':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0x4cb8('0x5'),'validate':{'notEmpty':!![]}},'textColor':{'type':Sequelize[_0x4cb8('0x2')],'allowNull':![],'defaultValue':_0x4cb8('0x6'),'validate':{'notEmpty':!![]}},'fontSize':{'type':Sequelize[_0x4cb8('0x7')],'defaultValue':0xf},'remote':{'type':Sequelize['STRING']},'animation':{'type':Sequelize[_0x4cb8('0x8')],'defaultValue':!![]},'header_shape':{'type':Sequelize[_0x4cb8('0x9')](_0x4cb8('0xa'),_0x4cb8('0xb')),'defaultValue':_0x4cb8('0xa')},'header_online':{'type':Sequelize[_0x4cb8('0x2')],'defaultValue':_0x4cb8('0xc')},'start_chat_button':{'type':Sequelize[_0x4cb8('0x2')],'defaultValue':_0x4cb8('0xd')},'offline_chat_button':{'type':Sequelize[_0x4cb8('0x2')],'defaultValue':_0x4cb8('0xe')},'header_offline':{'type':Sequelize[_0x4cb8('0x2')],'defaultValue':_0x4cb8('0xf')},'download_transcript':{'type':Sequelize[_0x4cb8('0x8')],'defaultValue':!![]},'timeout':{'type':Sequelize[_0x4cb8('0x7')],'defaultValue':0x0},'whiteLabel':{'type':Sequelize['STRING'],'defaultValue':_0x4cb8('0x10')},'defaultWhiteLabel':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'sitepic':{'type':Sequelize[_0x4cb8('0x11')]},'closingQuestion':{'type':Sequelize[_0x4cb8('0x2')],'defaultValue':'Do\x20you\x20want\x20to\x20close\x20the\x20interaction?'},'formSubmitSuccessMessage':{'type':Sequelize[_0x4cb8('0x2')],'defaultValue':_0x4cb8('0x12')},'formSubmitFailureMessage':{'type':Sequelize[_0x4cb8('0x2')],'defaultValue':_0x4cb8('0x13')},'noteTitle':{'type':Sequelize[_0x4cb8('0x2')],'defaultValue':_0x4cb8('0x14')},'placeholderMessage':{'type':Sequelize['STRING'],'defaultValue':'Type\x20a\x20message'},'closingMessage':{'type':Sequelize[_0x4cb8('0x2')],'defaultValue':'Thanks\x20you\x20for\x20your\x20time!'},'closingMessageButton':{'type':Sequelize['STRING'],'defaultValue':_0x4cb8('0xe')},'skipMessageButton':{'type':Sequelize[_0x4cb8('0x2')],'defaultValue':_0x4cb8('0x15')},'conditionAgreement':{'type':Sequelize[_0x4cb8('0x8')],'defaultValue':![]},'enableRating':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'enableFeedback':{'type':Sequelize[_0x4cb8('0x8')],'defaultValue':![]},'enableSendButton':{'type':Sequelize[_0x4cb8('0x8')],'defaultValue':![]},'feedbackTitle':{'type':Sequelize['STRING'],'defaultValue':_0x4cb8('0x16')},'ratingType':{'type':Sequelize['ENUM'](_0x4cb8('0x17'),_0x4cb8('0x18')),'defaultValue':_0x4cb8('0x17')},'ratingStarsNumber':{'type':Sequelize[_0x4cb8('0x7')],'defaultValue':0x5},'onlineForm':{'type':Sequelize[_0x4cb8('0x11')],'defaultValue':function(){return JSON[_0x4cb8('0x19')]({'items':[{'type':_0x4cb8('0x1a'),'variable':null,'config':{'placeholder':_0x4cb8('0x1b'),'type':'text','required':!![]},'props':{'title':_0x4cb8('0x1b'),'helpText':''}},{'type':'input','props':{'title':_0x4cb8('0x3'),'helpText':''},'config':{'required':!![],'placeholder':_0x4cb8('0x3'),'type':_0x4cb8('0x3')},'variable':null}],'fromKey':0x1});},'get':function(){return this[_0x4cb8('0x1c')](_0x4cb8('0x1d'))?JSON[_0x4cb8('0x1e')](this[_0x4cb8('0x1c')](_0x4cb8('0x1d'))):{};},'set':function(_0x4620d4){return this[_0x4cb8('0x1f')](_0x4cb8('0x1d'),JSON[_0x4cb8('0x19')](_0x4620d4));}},'offlineForm':{'type':Sequelize[_0x4cb8('0x11')],'defaultValue':function(){return JSON[_0x4cb8('0x19')]({'items':[{'type':_0x4cb8('0x1a'),'props':{'title':_0x4cb8('0x3'),'helpText':''},'config':{'required':!![],'placeholder':_0x4cb8('0x3'),'type':_0x4cb8('0x3')},'variable':null},{'type':_0x4cb8('0x20'),'config':{'placeholder':_0x4cb8('0x21')},'props':{'title':_0x4cb8('0x21'),'helpText':_0x4cb8('0x22')}}],'fromKey':0x0});},'get':function(){return this[_0x4cb8('0x1c')](_0x4cb8('0x23'))?JSON[_0x4cb8('0x1e')](this['getDataValue'](_0x4cb8('0x23'))):{};},'set':function(_0x41a393){return this['setDataValue'](_0x4cb8('0x23'),JSON[_0x4cb8('0x19')](_0x41a393));}},'token':{'type':Sequelize[_0x4cb8('0x2')],'defaultValue':function(){return rs[_0x4cb8('0x24')]();}},'autoclose':{'type':Sequelize[_0x4cb8('0x8')],'defaultValue':!![]},'enableCustomerWriting':{'type':Sequelize[_0x4cb8('0x8')],'defaultValue':![]},'forwardTranscript':{'type':Sequelize[_0x4cb8('0x8')],'defaultValue':![]},'forwardTranscriptMessage':{'type':Sequelize[_0x4cb8('0x2')]},'forwardOffline':{'type':Sequelize[_0x4cb8('0x8')],'defaultValue':![]},'forwardOfflineAddress':{'type':Sequelize['STRING']},'waitingTitle':{'type':Sequelize[_0x4cb8('0x2')],'defaultValue':_0x4cb8('0x25')},'waitingMessage':{'type':Sequelize[_0x4cb8('0x2')],'defaultValue':_0x4cb8('0x26')},'offlineMessageSubject':{'type':Sequelize['STRING'],'defaultValue':_0x4cb8('0x27')},'offlineMessageBody':{'type':Sequelize[_0x4cb8('0x2')],'defaultValue':_0x4cb8('0x28')},'enableUnmanagedNote':{'type':Sequelize[_0x4cb8('0x8')],'defaultValue':!![]},'unmanagedMessage':{'type':Sequelize[_0x4cb8('0x2')],'defaultValue':'Your\x20request\x20has\x20not\x20been\x20processed.'},'skipUnmanaged':{'type':Sequelize[_0x4cb8('0x2')],'defaultValue':_0x4cb8('0x15')},'sendUnmanaged':{'type':Sequelize[_0x4cb8('0x2')],'defaultValue':_0x4cb8('0xe')},'enableCustomerAttachment':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'enableCustomerCheckmarks':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentAvatar':{'type':Sequelize[_0x4cb8('0x11')]},'showAgentAvatar':{'type':Sequelize[_0x4cb8('0x8')],'defaultValue':![]},'timezone':{'type':Sequelize[_0x4cb8('0x2')]},'notificationTemplate':{'type':Sequelize[_0x4cb8('0x11')],'defaultValue':function(){return _0x4cb8('0x29');}},'notificationSound':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0x4cb8('0x8')],'defaultValue':![]},'hideWhenOffline':{'type':Sequelize[_0x4cb8('0x8')],'defaultValue':![]},'agentIdentifier':{'type':Sequelize[_0x4cb8('0x2')],'defaultValue':_0x4cb8('0x2a')},'waitForTheAssignedAgent':{'type':Sequelize[_0x4cb8('0x7')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'alignment':{'type':Sequelize[_0x4cb8('0x2')],'defaultValue':_0x4cb8('0x2b')},'verticalAlignment':{'type':Sequelize['INTEGER'],'defaultValue':0x1e},'messagesAlignment':{'type':Sequelize[_0x4cb8('0x2')],'defaultValue':_0x4cb8('0x2c')},'defaultTitle':{'type':Sequelize[_0x4cb8('0x2')]},'customerAvatar':{'type':Sequelize[_0x4cb8('0x11')]},'showCustomerAvatar':{'type':Sequelize[_0x4cb8('0x8')],'defaultValue':![]},'messageFontSize':{'type':Sequelize['INTEGER'],'defaultValue':0xc},'backgroundColor':{'type':Sequelize[_0x4cb8('0x2')],'allowNull':![],'defaultValue':_0x4cb8('0x2d'),'validate':{'notEmpty':!![]}},'queueTransfer':{'type':Sequelize[_0x4cb8('0x8')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0x4cb8('0x7')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0x4cb8('0x7')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'systemAlias':{'type':Sequelize[_0x4cb8('0x2')],'defaultValue':_0x4cb8('0x2e')},'systemAvatar':{'type':Sequelize[_0x4cb8('0x11')]},'mandatoryDispositionPauseId':{'type':Sequelize['INTEGER'],'comment':_0x4cb8('0x2f')},'mandatoryDisposition':{'type':Sequelize['BOOLEAN'],'defaultValue':![],'comment':'Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','set':function(_0xdefc2f){if(!_0xdefc2f)this[_0x4cb8('0x1f')]('mandatoryDispositionPauseId',null);this[_0x4cb8('0x1f')]('mandatoryDisposition',_0xdefc2f);}}}; \ No newline at end of file diff --git a/server/api/chatWebsite/chatWebsite.controller.js b/server/api/chatWebsite/chatWebsite.controller.js index a2cacdf..68bb3fa 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 _0xc8ea=['threadId','ChatInteraction','externalUrl','ContactId','interaction','spread','messageId','created','autoclose','close','*,*,*,*','ChatMessage','AttachmentId','User','UserId','unshift','waitForTheAssignedAgent','forcedOwnership','startRouting','Start','EventManager','offline','difference','CompanyId','from\x20is\x20mandatory','mapKeyOffline','findOrCreate','readFileSync','server/files/templates/chatOfflineMessage.ejs','utf8','toPairs','offlineMessageBody','ChatOfflineMessage','Smtp','service','host','port','secure','auth','pass','SendMail','\x22%s\x22\x20<%s>','forwardOfflineAddress','offlineMessageSubject','addInteraction','ids','getInteractions','Owner','fullname','internal','Tag','color','tag','findAll','Command','getSnippet','timezone','iftime\x20%s,%s','interval','iftime\x20%s','indexOf','true','[%s][INTERVAL][%s]\x20%s\x20%s\x20(%s)','OFFLINE','No\x20timezone','Interval','Intervals','getProactiveActions','virtual','License','increment','chatLicenseExceeded','push','all','some','server/files/chat/iframe.js','x-real-ip','connection','remoteAddress','render','alignment','verticalAlignment','textColor','addApplications','sequelize','findAndCountAll','getApplications','chatProactiveAction','addProactiveActions','omit','ChatProactiveAction','getFields','offlineForm','onlineForm','items','fromKey','Contact','addAgents','emit','removeAgents','isArray','userChatWebsite:remove','getAgents','html-pdf','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','path','sox','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','localhost','socket.io-emitter','redis','./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~!@#$%^&-_=+[{]}.','info','request\x20sent','debug','error','code','ChatWebsite,\x20%s,\x20%s','message','result','catch','sendStatus','end','offset','limit','status','set','reject','save','then','destroy','get','ChatWebsites','UserProfileResource','stack','name','send','index','Pause','ChatWebsite','fieldName','type','key','model','map','query','keys','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','merge','VIRTUAL','options','count','includeAll','include','show','params','mandatoryDispositionPause','intersection','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','update','describe','ChatWebsiteId','Disposition','getDispositions','rows','removeDispositions','addAnswer','CannedAnswer','getAnswers','findOne','rawAttributes','removeAnswers','addLogo','sitepic','file','filename','addCustomerAvatar','customerAvatar','addSystemAvatar','systemAvatar','join','root','server/files/images/logos/default_logo.png','../../config/license/util','getLicense','custom','isNil','existsSync','server/files/images/logos/','getAvatar','server/files/images/avatars/default_avatar.png','agentAvatar','server/files/images/avatars/','getCustomerAvatar','server/files/images/avatars/customer_avatar.png','showCustomerAvatar','download','getSystemAvatar','server/files/images/avatars/system_avatar.png','notify','user-agent-parser','setUA','headers','user-agent','getResult','chat','CmContact','no\x20available\x20attributes','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','ChatApplication','Applications','account','list','orderBy','applications','priority','asc','defaults','contact','customerIp','cf-connecting-ip','x-forwarded-for','first','firstName','lastName','x-real-port','referer','browser','version','%s\x20%s','unknown','format','device','vendor','%s\x20%s\x20%s','stringify'];(function(_0x21b144,_0x20c209){var _0x114681=function(_0x4f05c0){while(--_0x4f05c0){_0x21b144['push'](_0x21b144['shift']());}};_0x114681(++_0x20c209);}(_0xc8ea,0x67));var _0xac8e=function(_0x38a7ac,_0x45514b){_0x38a7ac=_0x38a7ac-0x0;var _0x53061a=_0xc8ea[_0x38a7ac];return _0x53061a;};'use strict';var pdf=require(_0xac8e('0x0'));var emlformat=require(_0xac8e('0x1'));var rimraf=require(_0xac8e('0x2'));var zipdir=require(_0xac8e('0x3'));var jsonpatch=require('fast-json-patch');var rp=require(_0xac8e('0x4'));var moment=require(_0xac8e('0x5'));var BPromise=require(_0xac8e('0x6'));var Mustache=require(_0xac8e('0x7'));var util=require(_0xac8e('0x8'));var path=require(_0xac8e('0x9'));var sox=require(_0xac8e('0xa'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var _=require(_0xac8e('0xb'));var squel=require(_0xac8e('0xc'));var crypto=require(_0xac8e('0xd'));var jsforce=require(_0xac8e('0xe'));var deskjs=require(_0xac8e('0xf'));var toCsv=require(_0xac8e('0x10'));var querystring=require(_0xac8e('0x11'));var Papa=require(_0xac8e('0x12'));var Redis=require(_0xac8e('0x13'));var authService=require(_0xac8e('0x14'));var qs=require(_0xac8e('0x15'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xac8e('0x16'));var logger=require(_0xac8e('0x17'))(_0xac8e('0x18'));var utils=require(_0xac8e('0x19'));var config=require(_0xac8e('0x1a'));var db=require(_0xac8e('0x1b'))['db'];config['redis']=_['defaults'](config['redis'],{'host':_0xac8e('0x1c'),'port':0x18eb});var socket=require(_0xac8e('0x1d'))(new Redis(config[_0xac8e('0x1e')]));require(_0xac8e('0x1f'))[_0xac8e('0x20')](socket);var jayson=require(_0xac8e('0x21'));var client=jayson['client'][_0xac8e('0x22')]({'port':0x232c});var client9002=jayson[_0xac8e('0x23')][_0xac8e('0x22')]({'port':0x232a});var client9003=jayson['client']['http']({'port':0x232b});function checkPasswordPattern(_0x1ed4d2,_0x91b64e,_0x892b3e){if(_0x892b3e){var _0xc2cb62=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0xc2cb62[_0xac8e('0x24')](_0x91b64e)){return _0x1ed4d2;}else{throw new db[(_0xac8e('0x25'))][(_0xac8e('0x26'))](_0xac8e('0x27'));}}else{return _0x1ed4d2;}}function respondWithRpcPromise(_0x4d5145,_0x51825f,_0x5d24ca,_0x2c7406){return new BPromise(function(_0x58e17e,_0x44b5b1){var _0x408ea6=_0x2c7406||client;return _0x408ea6['request'](_0x4d5145,_0x5d24ca)['then'](function(_0x4f2066){logger[_0xac8e('0x28')]('ChatWebsite,\x20%s,\x20%s',_0x51825f,_0xac8e('0x29'));logger[_0xac8e('0x2a')]('ChatWebsite,\x20%s,\x20%s,\x20%s',_0x51825f,_0xac8e('0x29'),JSON['stringify'](_0x4f2066));if(_0x4f2066[_0xac8e('0x2b')]){if(_0x4f2066[_0xac8e('0x2b')][_0xac8e('0x2c')]===0x1f4){logger['error'](_0xac8e('0x2d'),_0x51825f,_0x4f2066[_0xac8e('0x2b')]['message']);return _0x44b5b1(_0x4f2066[_0xac8e('0x2b')]['message']);}logger[_0xac8e('0x2b')]('ChatWebsite,\x20%s,\x20%s',_0x51825f,_0x4f2066[_0xac8e('0x2b')]['message']);return _0x58e17e(_0x4f2066[_0xac8e('0x2b')][_0xac8e('0x2e')]);}else{logger['info']('ChatWebsite,\x20%s,\x20%s',_0x51825f,_0xac8e('0x29'));_0x58e17e(_0x4f2066[_0xac8e('0x2f')]['message']);}})[_0xac8e('0x30')](function(_0x4e687c){logger[_0xac8e('0x2b')](_0xac8e('0x2d'),_0x51825f,_0x4e687c);_0x44b5b1(_0x4e687c);});});}function respondWithStatusCode(_0x569bb1,_0x36c3f3){_0x36c3f3=_0x36c3f3||0xcc;return function(_0x375f97){if(_0x375f97){return _0x569bb1[_0xac8e('0x31')](_0x36c3f3);}return _0x569bb1['status'](_0x36c3f3)[_0xac8e('0x32')]();};}function respondWithResult(_0x65678c,_0x385285){_0x385285=_0x385285||0xc8;return function(_0x5b6ced){if(_0x5b6ced){return _0x65678c['status'](_0x385285)['json'](_0x5b6ced);}};}function respondWithFilteredResult(_0x45a25c,_0x3614cc){return function(_0x2cdd3a){if(_0x2cdd3a){var _0x47658b=_0x2cdd3a['count'],_0x32e6d2=_0x3614cc[_0xac8e('0x33')],_0xe63006=_0x3614cc[_0xac8e('0x33')]+_0x3614cc[_0xac8e('0x34')],_0x1b0c45;if(_0xe63006>=_0x47658b){_0xe63006=_0x47658b;_0x1b0c45=0xc8;}else{_0x1b0c45=0xce;}_0x45a25c[_0xac8e('0x35')](_0x1b0c45);return _0x45a25c[_0xac8e('0x36')]('Content-Range',_0x32e6d2+'-'+_0xe63006+'/'+_0x47658b)['json'](_0x2cdd3a);}return null;};}function patchUpdates(_0x2be22a){return function(_0x653cf1){try{jsonpatch['apply'](_0x653cf1,_0x2be22a,!![]);}catch(_0x479062){return BPromise[_0xac8e('0x37')](_0x479062);}return _0x653cf1[_0xac8e('0x38')]();};}function saveUpdates(_0x518753,_0x587cc6){return function(_0x111015){if(_0x111015){return _0x111015['update'](_0x518753)[_0xac8e('0x39')](function(_0x5902c0){return _0x5902c0;});}return null;};}function removeEntity(_0x1938f6,_0x495c04){return function(_0x56fa69){if(_0x56fa69){return _0x56fa69[_0xac8e('0x3a')]()['then'](function(){var _0x110191=_0x56fa69[_0xac8e('0x3b')]({'plain':!![]});var _0x1c4980=_0xac8e('0x3c');return db[_0xac8e('0x3d')][_0xac8e('0x3a')]({'where':{'type':_0x1c4980,'resourceId':_0x110191['id']}})[_0xac8e('0x39')](function(){return _0x56fa69;});})[_0xac8e('0x39')](function(){_0x1938f6[_0xac8e('0x35')](0xcc)[_0xac8e('0x32')]();});}};}function handleEntityNotFound(_0x4960ab,_0x10a973){return function(_0x44a8c6){if(!_0x44a8c6){_0x4960ab[_0xac8e('0x31')](0x194);}return _0x44a8c6;};}function handleError(_0x4efabb,_0x487fe2){_0x487fe2=_0x487fe2||0x1f4;return function(_0x172b00){logger['error'](_0x172b00[_0xac8e('0x3e')]);if(_0x172b00['name']){delete _0x172b00[_0xac8e('0x3f')];}_0x4efabb[_0xac8e('0x35')](_0x487fe2)[_0xac8e('0x40')](_0x172b00);};}exports[_0xac8e('0x41')]=function(_0xc6076d,_0x568b73){var _0x347f12={'include':[{'model':db[_0xac8e('0x42')],'as':'mandatoryDispositionPause'}]},_0x4eaf46={},_0x27fa24={'count':0x0,'rows':[]};var _0x5a0aa5=_['map'](db[_0xac8e('0x43')]['rawAttributes'],function(_0x400cf5){return{'name':_0x400cf5[_0xac8e('0x44')],'type':_0x400cf5[_0xac8e('0x45')][_0xac8e('0x46')]};});_0x4eaf46[_0xac8e('0x47')]=_[_0xac8e('0x48')](_0x5a0aa5,_0xac8e('0x3f'));_0x4eaf46[_0xac8e('0x49')]=_[_0xac8e('0x4a')](_0xc6076d['query']);_0x4eaf46['filters']=_['intersection'](_0x4eaf46[_0xac8e('0x47')],_0x4eaf46[_0xac8e('0x49')]);_0x347f12['attributes']=_['intersection'](_0x4eaf46[_0xac8e('0x47')],qs[_0xac8e('0x4b')](_0xc6076d[_0xac8e('0x49')]['fields']));_0x347f12[_0xac8e('0x4c')]=_0x347f12[_0xac8e('0x4c')][_0xac8e('0x4d')]?_0x347f12['attributes']:_0x4eaf46[_0xac8e('0x47')];if(!_0xc6076d[_0xac8e('0x49')][_0xac8e('0x4e')](_0xac8e('0x4f'))){_0x347f12[_0xac8e('0x34')]=qs['limit'](_0xc6076d['query'][_0xac8e('0x34')]);_0x347f12['offset']=qs[_0xac8e('0x33')](_0xc6076d[_0xac8e('0x49')]['offset']);}_0x347f12[_0xac8e('0x50')]=qs[_0xac8e('0x51')](_0xc6076d[_0xac8e('0x49')][_0xac8e('0x51')]);_0x347f12[_0xac8e('0x52')]=qs[_0xac8e('0x53')](_[_0xac8e('0x54')](_0xc6076d[_0xac8e('0x49')],_0x4eaf46[_0xac8e('0x53')]));if(_0xc6076d[_0xac8e('0x49')][_0xac8e('0x55')]){_0x347f12[_0xac8e('0x52')]=_[_0xac8e('0x56')](_0x347f12['where'],{'$or':_[_0xac8e('0x48')](_0x5a0aa5,function(_0x579975){if(_0x579975[_0xac8e('0x45')]!==_0xac8e('0x57')){var _0x5801ec={};_0x5801ec[_0x579975[_0xac8e('0x3f')]]={'$like':'%'+_0xc6076d[_0xac8e('0x49')][_0xac8e('0x55')]+'%'};return _0x5801ec;}})});}_0x347f12=_[_0xac8e('0x56')]({},_0x347f12,_0xc6076d[_0xac8e('0x58')]);var _0x10f57e={'where':_0x347f12[_0xac8e('0x52')]};return db[_0xac8e('0x43')][_0xac8e('0x59')](_0x10f57e)[_0xac8e('0x39')](function(_0x2ae14d){_0x27fa24[_0xac8e('0x59')]=_0x2ae14d;if(_0xc6076d[_0xac8e('0x49')][_0xac8e('0x5a')]){_0x347f12[_0xac8e('0x5b')]=[{'all':!![]}];}return db[_0xac8e('0x43')]['findAll'](_0x347f12);})['then'](function(_0x54fcea){_0x27fa24['rows']=_0x54fcea;return _0x27fa24;})[_0xac8e('0x39')](respondWithFilteredResult(_0x568b73,_0x347f12))[_0xac8e('0x30')](handleError(_0x568b73,null));};exports[_0xac8e('0x5c')]=function(_0x58c68a,_0xe8903a){var _0x247669={'raw':![],'where':{'id':_0x58c68a[_0xac8e('0x5d')]['id']},'include':[{'model':db[_0xac8e('0x42')],'as':_0xac8e('0x5e')}]},_0x5dfdb1={};_0x5dfdb1[_0xac8e('0x47')]=_[_0xac8e('0x4a')](db[_0xac8e('0x43')]['rawAttributes']);_0x5dfdb1['query']=_[_0xac8e('0x4a')](_0x58c68a[_0xac8e('0x49')]);_0x5dfdb1['filters']=_[_0xac8e('0x5f')](_0x5dfdb1[_0xac8e('0x47')],_0x5dfdb1[_0xac8e('0x49')]);_0x247669[_0xac8e('0x4c')]=_[_0xac8e('0x5f')](_0x5dfdb1['model'],qs[_0xac8e('0x4b')](_0x58c68a['query'][_0xac8e('0x4b')]));_0x247669[_0xac8e('0x4c')]=_0x247669[_0xac8e('0x4c')][_0xac8e('0x4d')]?_0x247669[_0xac8e('0x4c')]:_0x5dfdb1[_0xac8e('0x47')];if(_0x58c68a['query']['includeAll']){_0x247669[_0xac8e('0x5b')]=[{'all':!![]}];}_0x247669=_[_0xac8e('0x56')]({},_0x247669,_0x58c68a['options']);return db[_0xac8e('0x43')][_0xac8e('0x60')](_0x247669)['then'](handleEntityNotFound(_0xe8903a,null))[_0xac8e('0x39')](respondWithResult(_0xe8903a,null))[_0xac8e('0x30')](handleError(_0xe8903a,null));};exports[_0xac8e('0x61')]=function(_0x49adb7,_0x590c29){return db[_0xac8e('0x43')][_0xac8e('0x61')](_0x49adb7[_0xac8e('0x62')],{})[_0xac8e('0x39')](function(_0x3620af){var _0x1b8a1e=_0x49adb7[_0xac8e('0x63')][_0xac8e('0x3b')]({'plain':!![]});if(!_0x1b8a1e)throw new Error(_0xac8e('0x64'));if(_0x1b8a1e[_0xac8e('0x65')]===_0xac8e('0x63')){var _0x8f819f=_0x3620af['get']({'plain':!![]});var _0x1284bc=_0xac8e('0x3c');return db[_0xac8e('0x66')][_0xac8e('0x60')]({'where':{'name':_0x1284bc,'userProfileId':_0x1b8a1e[_0xac8e('0x67')]},'raw':!![]})[_0xac8e('0x39')](function(_0x5a2bc5){if(_0x5a2bc5&&_0x5a2bc5[_0xac8e('0x68')]===0x0){return db[_0xac8e('0x3d')][_0xac8e('0x61')]({'name':_0x8f819f['name'],'resourceId':_0x8f819f['id'],'type':_0x5a2bc5[_0xac8e('0x3f')],'sectionId':_0x5a2bc5['id']},{})['then'](function(){return _0x3620af;});}else{return _0x3620af;}})[_0xac8e('0x30')](function(_0x2cdb3f){logger['error']('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x2cdb3f);throw _0x2cdb3f;});}return _0x3620af;})['then'](respondWithResult(_0x590c29,0xc9))[_0xac8e('0x30')](handleError(_0x590c29,null));};exports[_0xac8e('0x69')]=function(_0x1b389b,_0x238080){if(_0x1b389b['body']['id']){delete _0x1b389b[_0xac8e('0x62')]['id'];}return db['ChatWebsite'][_0xac8e('0x60')]({'where':{'id':_0x1b389b['params']['id']},'include':[{'model':db[_0xac8e('0x42')],'as':_0xac8e('0x5e')}]})[_0xac8e('0x39')](handleEntityNotFound(_0x238080,null))[_0xac8e('0x39')](saveUpdates(_0x1b389b[_0xac8e('0x62')],null))[_0xac8e('0x39')](respondWithResult(_0x238080,null))[_0xac8e('0x30')](handleError(_0x238080,null));};exports[_0xac8e('0x3a')]=function(_0x20351b,_0x12334c){return db[_0xac8e('0x43')][_0xac8e('0x60')]({'where':{'id':_0x20351b['params']['id']}})[_0xac8e('0x39')](handleEntityNotFound(_0x12334c,null))['then'](removeEntity(_0x12334c,null))[_0xac8e('0x30')](handleError(_0x12334c,null));};exports[_0xac8e('0x6a')]=function(_0x3f1087,_0x368c32){return db[_0xac8e('0x43')][_0xac8e('0x6a')]()[_0xac8e('0x39')](respondWithResult(_0x368c32,null))[_0xac8e('0x30')](handleError(_0x368c32,null));};exports['addDisposition']=function(_0xe4e0d,_0x50c1ef,_0x54c237){if(_0xe4e0d[_0xac8e('0x62')]['id']){delete _0xe4e0d['body']['id'];}return db[_0xac8e('0x43')][_0xac8e('0x60')]({'where':{'id':_0xe4e0d[_0xac8e('0x5d')]['id']}})[_0xac8e('0x39')](handleEntityNotFound(_0x50c1ef,null))[_0xac8e('0x39')](function(_0x1ed1b5){if(_0x1ed1b5){_0xe4e0d[_0xac8e('0x62')][_0xac8e('0x6b')]=_0x1ed1b5['id'];return db[_0xac8e('0x6c')][_0xac8e('0x61')](_0xe4e0d[_0xac8e('0x62')]);}})['then'](respondWithResult(_0x50c1ef,null))[_0xac8e('0x30')](handleError(_0x50c1ef,null));};exports[_0xac8e('0x6d')]=function(_0x3d54fd,_0x4c5a09,_0x2cfa2f){var _0x26ae1f={'raw':![],'where':{}};var _0x33262c={};var _0x34f09d={'count':0x0,'rows':[]};return db[_0xac8e('0x43')]['findOne']({'where':{'id':_0x3d54fd[_0xac8e('0x5d')]['id']}})[_0xac8e('0x39')](handleEntityNotFound(_0x4c5a09,null))['then'](function(_0x3eba28){if(_0x3eba28){_0x33262c[_0xac8e('0x47')]=_[_0xac8e('0x4a')](db[_0xac8e('0x6c')]['rawAttributes']);_0x33262c[_0xac8e('0x49')]=_[_0xac8e('0x4a')](_0x3d54fd[_0xac8e('0x49')]);_0x33262c[_0xac8e('0x53')]=_[_0xac8e('0x5f')](_0x33262c[_0xac8e('0x47')],_0x33262c[_0xac8e('0x49')]);_0x26ae1f[_0xac8e('0x4c')]=_[_0xac8e('0x5f')](_0x33262c['model'],qs[_0xac8e('0x4b')](_0x3d54fd[_0xac8e('0x49')][_0xac8e('0x4b')]));_0x26ae1f[_0xac8e('0x4c')]=_0x26ae1f[_0xac8e('0x4c')][_0xac8e('0x4d')]?_0x26ae1f['attributes']:_0x33262c['model'];if(!_0x3d54fd[_0xac8e('0x49')]['hasOwnProperty'](_0xac8e('0x4f'))){_0x26ae1f['limit']=qs[_0xac8e('0x34')](_0x3d54fd[_0xac8e('0x49')][_0xac8e('0x34')]);_0x26ae1f[_0xac8e('0x33')]=qs[_0xac8e('0x33')](_0x3d54fd[_0xac8e('0x49')]['offset']);}_0x26ae1f[_0xac8e('0x50')]=qs[_0xac8e('0x51')](_0x3d54fd[_0xac8e('0x49')][_0xac8e('0x51')]);_0x26ae1f['where']=qs['filters'](_[_0xac8e('0x54')](_0x3d54fd['query'],_0x33262c[_0xac8e('0x53')]));_0x26ae1f[_0xac8e('0x52')]['ChatWebsiteId']=_0x3eba28['id'];if(_0x3d54fd[_0xac8e('0x49')][_0xac8e('0x55')]){_0x26ae1f['where']=_[_0xac8e('0x56')](_0x26ae1f[_0xac8e('0x52')],{'$or':_['map'](_0x26ae1f[_0xac8e('0x4c')],function(_0x3a5dc6){var _0x1904a8={};_0x1904a8[_0x3a5dc6]={'$like':'%'+_0x3d54fd[_0xac8e('0x49')][_0xac8e('0x55')]+'%'};return _0x1904a8;})});}_0x26ae1f=_[_0xac8e('0x56')]({},_0x26ae1f,_0x3d54fd[_0xac8e('0x58')]);return db[_0xac8e('0x6c')][_0xac8e('0x59')]({'where':_0x26ae1f['where']})[_0xac8e('0x39')](function(_0x5c8224){_0x34f09d['count']=_0x5c8224;if(_0x3d54fd[_0xac8e('0x49')][_0xac8e('0x5a')]){_0x26ae1f['include']=[{'all':!![]}];}return db[_0xac8e('0x6c')]['findAll'](_0x26ae1f);})[_0xac8e('0x39')](function(_0x48abc){_0x34f09d[_0xac8e('0x6e')]=_0x48abc;return _0x34f09d;});}})[_0xac8e('0x39')](respondWithFilteredResult(_0x4c5a09,_0x26ae1f))['catch'](handleError(_0x4c5a09,null));};exports[_0xac8e('0x6f')]=function(_0x2d2b55,_0xce363a,_0x1679d7){return db[_0xac8e('0x43')][_0xac8e('0x60')]({'where':{'id':_0x2d2b55[_0xac8e('0x5d')]['id']}})[_0xac8e('0x39')](handleEntityNotFound(_0xce363a,null))[_0xac8e('0x39')](function(_0x36f9c9){if(_0x36f9c9){return _0x36f9c9[_0xac8e('0x6f')](_0x2d2b55['query']['ids']);}})[_0xac8e('0x39')](respondWithStatusCode(_0xce363a,null))[_0xac8e('0x30')](handleError(_0xce363a,null));};exports[_0xac8e('0x70')]=function(_0x57aab2,_0x3aa57e,_0x1791ea){if(_0x57aab2[_0xac8e('0x62')]['id']){delete _0x57aab2[_0xac8e('0x62')]['id'];}return db['ChatWebsite'][_0xac8e('0x60')]({'where':{'id':_0x57aab2[_0xac8e('0x5d')]['id']}})[_0xac8e('0x39')](handleEntityNotFound(_0x3aa57e,null))['then'](function(_0x206242){if(_0x206242){_0x57aab2[_0xac8e('0x62')][_0xac8e('0x6b')]=_0x206242['id'];return db[_0xac8e('0x71')][_0xac8e('0x61')](_0x57aab2[_0xac8e('0x62')]);}})[_0xac8e('0x39')](respondWithResult(_0x3aa57e,null))[_0xac8e('0x30')](handleError(_0x3aa57e,null));};exports[_0xac8e('0x72')]=function(_0x509811,_0x2023bf,_0x50b4e8){var _0x3d9516={'raw':![],'where':{}};var _0x263707={};var _0xe1a1ee={'count':0x0,'rows':[]};return db[_0xac8e('0x43')][_0xac8e('0x73')]({'where':{'id':_0x509811[_0xac8e('0x5d')]['id']}})[_0xac8e('0x39')](handleEntityNotFound(_0x2023bf,null))[_0xac8e('0x39')](function(_0x18069d){if(_0x18069d){_0x263707[_0xac8e('0x47')]=_[_0xac8e('0x4a')](db['CannedAnswer'][_0xac8e('0x74')]);_0x263707['query']=_['keys'](_0x509811[_0xac8e('0x49')]);_0x263707[_0xac8e('0x53')]=_[_0xac8e('0x5f')](_0x263707[_0xac8e('0x47')],_0x263707[_0xac8e('0x49')]);_0x3d9516[_0xac8e('0x4c')]=_['intersection'](_0x263707[_0xac8e('0x47')],qs[_0xac8e('0x4b')](_0x509811[_0xac8e('0x49')][_0xac8e('0x4b')]));_0x3d9516[_0xac8e('0x4c')]=_0x3d9516[_0xac8e('0x4c')]['length']?_0x3d9516[_0xac8e('0x4c')]:_0x263707['model'];if(!_0x509811[_0xac8e('0x49')]['hasOwnProperty'](_0xac8e('0x4f'))){_0x3d9516[_0xac8e('0x34')]=qs['limit'](_0x509811[_0xac8e('0x49')][_0xac8e('0x34')]);_0x3d9516[_0xac8e('0x33')]=qs[_0xac8e('0x33')](_0x509811[_0xac8e('0x49')]['offset']);}_0x3d9516[_0xac8e('0x50')]=qs['sort'](_0x509811[_0xac8e('0x49')]['sort']);_0x3d9516[_0xac8e('0x52')]=qs[_0xac8e('0x53')](_['pick'](_0x509811[_0xac8e('0x49')],_0x263707[_0xac8e('0x53')]));_0x3d9516[_0xac8e('0x52')]['ChatWebsiteId']=_0x18069d['id'];if(_0x509811[_0xac8e('0x49')][_0xac8e('0x55')]){_0x3d9516[_0xac8e('0x52')]=_[_0xac8e('0x56')](_0x3d9516['where'],{'$or':_[_0xac8e('0x48')](_0x3d9516[_0xac8e('0x4c')],function(_0x3f3f11){var _0x25b602={};_0x25b602[_0x3f3f11]={'$like':'%'+_0x509811[_0xac8e('0x49')][_0xac8e('0x55')]+'%'};return _0x25b602;})});}_0x3d9516=_['merge']({},_0x3d9516,_0x509811[_0xac8e('0x58')]);return db[_0xac8e('0x71')][_0xac8e('0x59')]({'where':_0x3d9516[_0xac8e('0x52')]})[_0xac8e('0x39')](function(_0x4376a4){_0xe1a1ee[_0xac8e('0x59')]=_0x4376a4;if(_0x509811[_0xac8e('0x49')][_0xac8e('0x5a')]){_0x3d9516[_0xac8e('0x5b')]=[{'all':!![]}];}return db[_0xac8e('0x71')]['findAll'](_0x3d9516);})[_0xac8e('0x39')](function(_0x41e12c){_0xe1a1ee[_0xac8e('0x6e')]=_0x41e12c;return _0xe1a1ee;});}})[_0xac8e('0x39')](respondWithFilteredResult(_0x2023bf,_0x3d9516))[_0xac8e('0x30')](handleError(_0x2023bf,null));};exports[_0xac8e('0x75')]=function(_0x173b7e,_0x2b24f2,_0x4cec59){return db['ChatWebsite'][_0xac8e('0x60')]({'where':{'id':_0x173b7e['params']['id']}})[_0xac8e('0x39')](handleEntityNotFound(_0x2b24f2,null))[_0xac8e('0x39')](function(_0x2b70a9){if(_0x2b70a9){return _0x2b70a9[_0xac8e('0x75')](_0x173b7e[_0xac8e('0x49')]['ids']);}})[_0xac8e('0x39')](respondWithStatusCode(_0x2b24f2,null))[_0xac8e('0x30')](handleError(_0x2b24f2,null));};exports[_0xac8e('0x76')]=function(_0x124699,_0x566997,_0xf62cf6){_0x124699[_0xac8e('0x62')][_0xac8e('0x77')]=_0x124699[_0xac8e('0x78')]['filename'];return db['ChatWebsite'][_0xac8e('0x60')]({'where':{'id':_0x124699['params']['id']}})[_0xac8e('0x39')](handleEntityNotFound(_0x566997,null))['then'](saveUpdates(_0x124699[_0xac8e('0x62')],null))['then'](respondWithResult(_0x566997,null))['catch'](handleError(_0x566997,null));};exports['addAvatar']=function(_0x3c6236,_0xab5e06,_0xf4f351){_0x3c6236[_0xac8e('0x62')]['agentAvatar']=_0x3c6236[_0xac8e('0x78')][_0xac8e('0x79')];return db['ChatWebsite']['find']({'where':{'id':_0x3c6236[_0xac8e('0x5d')]['id']}})['then'](handleEntityNotFound(_0xab5e06,null))[_0xac8e('0x39')](saveUpdates(_0x3c6236['body'],null))['then'](respondWithResult(_0xab5e06,null))[_0xac8e('0x30')](handleError(_0xab5e06,null));};exports[_0xac8e('0x7a')]=function(_0x3765b0,_0x31de0a,_0x126634){_0x3765b0[_0xac8e('0x62')][_0xac8e('0x7b')]=_0x3765b0[_0xac8e('0x78')][_0xac8e('0x79')];return db[_0xac8e('0x43')][_0xac8e('0x60')]({'where':{'id':_0x3765b0[_0xac8e('0x5d')]['id']}})['then'](handleEntityNotFound(_0x31de0a,null))[_0xac8e('0x39')](saveUpdates(_0x3765b0[_0xac8e('0x62')],null))['then'](respondWithResult(_0x31de0a,null))[_0xac8e('0x30')](handleError(_0x31de0a,null));};exports[_0xac8e('0x7c')]=function(_0x4553ca,_0xecd655,_0xfba744){_0x4553ca['body'][_0xac8e('0x7d')]=_0x4553ca[_0xac8e('0x78')]['filename'];return db[_0xac8e('0x43')]['find']({'where':{'id':_0x4553ca[_0xac8e('0x5d')]['id']}})[_0xac8e('0x39')](handleEntityNotFound(_0xecd655,null))[_0xac8e('0x39')](saveUpdates(_0x4553ca[_0xac8e('0x62')],null))[_0xac8e('0x39')](respondWithResult(_0xecd655,null))[_0xac8e('0x30')](handleError(_0xecd655,null));};exports['getLogo']=function(_0x140aae,_0x25207c,_0x34e390){var _0x52c310=path[_0xac8e('0x7e')](config[_0xac8e('0x7f')],_0xac8e('0x80'));var _0x310456={'where':{'id':_0x140aae[_0xac8e('0x5d')]['id']},'attributes':['id',_0xac8e('0x77')],'raw':!![]};var _0x39b844=![];return require(_0xac8e('0x81'))[_0xac8e('0x82')]()['then'](function(_0x4c9703){if(_0x4c9703){_0x39b844=_0x4c9703[_0xac8e('0x83')];}})[_0xac8e('0x39')](function(){return db[_0xac8e('0x43')]['find'](_0x310456);})[_0xac8e('0x39')](handleEntityNotFound(_0x25207c,null))[_0xac8e('0x39')](function(_0x5074dd){if(_0x5074dd){if(!_[_0xac8e('0x84')](_0x5074dd[_0xac8e('0x77')])){if(fs[_0xac8e('0x85')](path[_0xac8e('0x7e')](config[_0xac8e('0x7f')],_0xac8e('0x86'),_0x5074dd[_0xac8e('0x77')]))&&_0x39b844){_0x52c310=path[_0xac8e('0x7e')](config['root'],_0xac8e('0x86'),_0x5074dd['sitepic']);}}return _0x25207c['download'](_0x52c310);}})[_0xac8e('0x30')](handleError(_0x25207c,null));};exports[_0xac8e('0x87')]=function(_0x19783b,_0x239a24,_0x5dd83d){var _0x3d3a3c=path[_0xac8e('0x7e')](config[_0xac8e('0x7f')],_0xac8e('0x88'));var _0x417299={'where':{'id':_0x19783b[_0xac8e('0x5d')]['id']},'attributes':['id',_0xac8e('0x89')],'raw':!![]};return db['ChatWebsite'][_0xac8e('0x60')](_0x417299)[_0xac8e('0x39')](handleEntityNotFound(_0x239a24,null))['then'](function(_0x201823){if(_0x201823){if(!_[_0xac8e('0x84')](_0x201823[_0xac8e('0x89')])){if(fs[_0xac8e('0x85')](path['join'](config[_0xac8e('0x7f')],_0xac8e('0x8a'),_0x201823[_0xac8e('0x89')]))){_0x3d3a3c=path[_0xac8e('0x7e')](config[_0xac8e('0x7f')],_0xac8e('0x8a'),_0x201823[_0xac8e('0x89')]);}}return _0x239a24['download'](_0x3d3a3c);}})[_0xac8e('0x30')](handleError(_0x239a24,null));};exports[_0xac8e('0x8b')]=function(_0x3b5daf,_0x5a9e8d,_0x19d374){var _0x3f4b24=path['join'](config[_0xac8e('0x7f')],_0xac8e('0x8c'));var _0x4dc4cc={'where':{'id':_0x3b5daf[_0xac8e('0x5d')]['id']},'attributes':['id',_0xac8e('0x7b'),_0xac8e('0x8d')],'raw':!![]};return db[_0xac8e('0x43')]['find'](_0x4dc4cc)[_0xac8e('0x39')](handleEntityNotFound(_0x5a9e8d,null))['then'](function(_0x44d430){if(_0x44d430){if(!_[_0xac8e('0x84')](_0x44d430['customerAvatar'])){if(fs[_0xac8e('0x85')](path[_0xac8e('0x7e')](config[_0xac8e('0x7f')],'server/files/images/avatars/',_0x44d430[_0xac8e('0x7b')]))&&_0x44d430[_0xac8e('0x8d')]){_0x3f4b24=path[_0xac8e('0x7e')](config['root'],_0xac8e('0x8a'),_0x44d430['customerAvatar']);}}return _0x5a9e8d[_0xac8e('0x8e')](_0x3f4b24);}})[_0xac8e('0x30')](handleError(_0x5a9e8d,null));};exports[_0xac8e('0x8f')]=function(_0x359451,_0x46f50a,_0x43c6d4){var _0x1a60e1=path[_0xac8e('0x7e')](config[_0xac8e('0x7f')],_0xac8e('0x90'));var _0x1f4737={'where':{'id':_0x359451[_0xac8e('0x5d')]['id']},'attributes':['id',_0xac8e('0x7d')],'raw':!![]};return db[_0xac8e('0x43')][_0xac8e('0x60')](_0x1f4737)[_0xac8e('0x39')](handleEntityNotFound(_0x46f50a,null))[_0xac8e('0x39')](function(_0x375e53){if(_0x375e53){if(!_[_0xac8e('0x84')](_0x375e53[_0xac8e('0x7d')])){if(fs[_0xac8e('0x85')](path['join'](config[_0xac8e('0x7f')],_0xac8e('0x8a'),_0x375e53[_0xac8e('0x7d')]))){_0x1a60e1=path[_0xac8e('0x7e')](config['root'],'server/files/images/avatars/',_0x375e53[_0xac8e('0x7d')]);}}return _0x46f50a['download'](_0x1a60e1);}})[_0xac8e('0x30')](handleError(_0x46f50a,null));};exports[_0xac8e('0x91')]=function(_0xdda846,_0x3eb808,_0xbc1a73){var _0x3de0ca=require(_0xac8e('0x92'));var _0x45926d=new _0x3de0ca();var _0x2d8fa1=_0x45926d[_0xac8e('0x93')](_0xdda846[_0xac8e('0x94')][_0xac8e('0x95')])[_0xac8e('0x96')]();var _0x43919a={'body':_0xdda846[_0xac8e('0x62')],'channel':_0xac8e('0x97')};var _0x39167a=[];var _0x319dbe=[];var _0x3e6e75={};var _0x1d02f0=![];return db[_0xac8e('0x98')][_0xac8e('0x6a')]()[_0xac8e('0x39')](function(_0xeef40b){if(!_0xeef40b){throw new db['Sequelize'][(_0xac8e('0x26'))](_0xac8e('0x99'));}_0x39167a=_['difference'](_[_0xac8e('0x4a')](_0xeef40b),[_0xac8e('0x9a'),_0xac8e('0x9b')]);_0x319dbe=_['difference'](_[_0xac8e('0x4a')](_0xeef40b),['createdAt',_0xac8e('0x9b'),'CompanyId',_0xac8e('0x9c')]);if(_0xdda846[_0xac8e('0x62')]['id']){delete _0xdda846['body']['id'];}if(_[_0xac8e('0x84')](_0xdda846[_0xac8e('0x62')][_0xac8e('0x9d')])){throw new db[(_0xac8e('0x25'))]['ValidationError']('from\x20is\x20mandatory');}if(_['isNil'](_0xdda846[_0xac8e('0x62')][_0xac8e('0x62')])||_0xdda846[_0xac8e('0x62')][_0xac8e('0x62')]===''){throw new db[(_0xac8e('0x25'))][(_0xac8e('0x26'))](_0xac8e('0x9e'));}if(_[_0xac8e('0x84')](_0xdda846['body'][_0xac8e('0x9f')])){throw new db['Sequelize'][(_0xac8e('0x26'))](_0xac8e('0xa0')+_0x319dbe);}if(!_[_0xac8e('0xa1')](_0x319dbe,_0xdda846[_0xac8e('0x62')][_0xac8e('0x9f')])){throw new db[(_0xac8e('0x25'))][(_0xac8e('0x26'))](_0xac8e('0xa2')+_0x319dbe);}_0x3e6e75[_0xdda846[_0xac8e('0x62')][_0xac8e('0x9f')]]=_0xdda846[_0xac8e('0x62')][_0xac8e('0x9d')];})['then'](function(){return db[_0xac8e('0x43')]['find']({'where':{'id':_0xdda846[_0xac8e('0x5d')]['id']},'include':[{'model':db[_0xac8e('0xa3')],'as':_0xac8e('0xa4'),'include':[{'model':db['CmContact'],'as':_0xac8e('0xa5'),'where':_0x3e6e75,'limit':0x1,'order':[['updatedAt','DESC']]}]},{'model':db[_0xac8e('0xa6')],'as':_0xac8e('0xa7')}]});})[_0xac8e('0x39')](handleEntityNotFound(_0x3eb808,null))[_0xac8e('0x39')](function(_0x5e15be){if(_0x5e15be&&_0x5e15be[_0xac8e('0xa4')]){_0x43919a[_0xac8e('0xa8')]=_0x5e15be;_0x43919a['applications']=_0x5e15be[_0xac8e('0xa7')];_0x43919a[_0xac8e('0xa9')]=_0x5e15be[_0xac8e('0xa4')];_0x43919a['applications']=_[_0xac8e('0xaa')](_0x43919a[_0xac8e('0xab')],[_0xac8e('0xac')],[_0xac8e('0xad')]);if(_0x43919a[_0xac8e('0xa8')]['Applications']){delete _0x43919a[_0xac8e('0xa8')][_0xac8e('0xa7')];}if(_0x43919a[_0xac8e('0xa8')][_0xac8e('0xa4')]&&_0x43919a[_0xac8e('0xa8')][_0xac8e('0xa4')][_0xac8e('0xa5')]['length']){return _0x43919a['account'][_0xac8e('0xa4')][_0xac8e('0xa5')][0x0];}var _0x5ba41d=_[_0xac8e('0xae')](_0xdda846['body'],{'firstName':_0xdda846[_0xac8e('0x62')]['from'],'ListId':_0x5e15be[_0xac8e('0x9c')]});_0x5ba41d[_0xdda846[_0xac8e('0x62')][_0xac8e('0x9f')]]=_0xdda846[_0xac8e('0x62')][_0xac8e('0x9d')];return db['CmContact'][_0xac8e('0x61')](_0x5ba41d,{'fields':_0x39167a,'raw':!![]});}})[_0xac8e('0x39')](handleEntityNotFound(_0x3eb808,null))[_0xac8e('0x39')](function(_0x5068a5){_0x43919a[_0xac8e('0xaf')]=_0x5068a5;var _0x3f59cb=_0xdda846[_0xac8e('0x62')][_0xac8e('0xb0')];if(_0xdda846[_0xac8e('0x94')]['cf-connecting-ip']){_0x3f59cb=_0xdda846[_0xac8e('0x94')][_0xac8e('0xb1')];}else if(_0xdda846[_0xac8e('0x94')][_0xac8e('0xb2')]){_0x3f59cb=_[_0xac8e('0xb3')](_0xdda846[_0xac8e('0x94')][_0xac8e('0xb2')]['split'](','));}if(_0x5068a5){var _0x1a6d04={'ContactId':_0x5068a5['id'],'ChatWebsiteId':_0xdda846[_0xac8e('0x5d')]['id'],'from':(_0x5068a5[_0xac8e('0xb4')]||'')+'\x20'+(_0x5068a5[_0xac8e('0xb5')]||''),'customerIp':_0x3f59cb,'customerPort':_0xdda846['headers'][_0xac8e('0xb6')]?_0xdda846[_0xac8e('0x94')]['x-real-port']:null,'referer':_0xdda846[_0xac8e('0x62')][_0xac8e('0xb7')],'browserName':_0x2d8fa1['browser'][_0xac8e('0x3f')]&&_0x2d8fa1[_0xac8e('0xb8')][_0xac8e('0xb9')]?util['format'](_0xac8e('0xba'),_0x2d8fa1['browser'][_0xac8e('0x3f')],_0x2d8fa1['browser'][_0xac8e('0xb9')]):_0xac8e('0xbb'),'browserVersion':_0x2d8fa1[_0xac8e('0xb8')]['version']||_0xac8e('0xbb'),'osName':util[_0xac8e('0xbc')](_0xac8e('0xba'),_0x2d8fa1['os'][_0xac8e('0x3f')],_0x2d8fa1['os'][_0xac8e('0xb9')]),'osVersion':_0x2d8fa1['os'][_0xac8e('0xb9')],'deviceModel':_0x2d8fa1[_0xac8e('0xbd')][_0xac8e('0x47')]&&_0x2d8fa1[_0xac8e('0xbd')][_0xac8e('0xbe')]?util['format'](_0xac8e('0xbf'),_0x2d8fa1['device'][_0xac8e('0x47')],_0x2d8fa1[_0xac8e('0xbd')][_0xac8e('0xbe')],_0x2d8fa1[_0xac8e('0xbd')]['type']):null,'deviceVendor':_0x2d8fa1[_0xac8e('0xbd')][_0xac8e('0xbe')],'deviceType':_0x2d8fa1['device'][_0xac8e('0x45')],'formData':JSON[_0xac8e('0xc0')](_0xdda846['body'])};var _0x8f5415={'ChatWebsiteId':_0xdda846[_0xac8e('0x5d')]['id'],'closed':![]};if(_0xdda846[_0xac8e('0x62')][_0xac8e('0xc1')]){_0x8f5415['threadId']=_0xdda846[_0xac8e('0x62')][_0xac8e('0xc1')];return db[_0xac8e('0xc2')][_0xac8e('0x60')]({'where':_0x8f5415})['then'](function(_0x1b1b47){if(_0x1b1b47){return[_0x1b1b47,![]];}_0x1a6d04['threadId']=_0xdda846['body'][_0xac8e('0xc1')];_0x1a6d04[_0xac8e('0xc3')]=_0xdda846[_0xac8e('0x62')][_0xac8e('0xc3')];return db[_0xac8e('0xc2')]['create'](_0x1a6d04)[_0xac8e('0x39')](function(_0xb8a997){return[_0xb8a997,!![]];});});}_0x8f5415[_0xac8e('0xc4')]=_0x5068a5['id'];if(_0xdda846[_0xac8e('0x62')][_0xac8e('0xc5')]&&_0xdda846[_0xac8e('0x62')][_0xac8e('0xc5')]['id']){_0x8f5415['id']=_0xdda846['body']['interaction']['id'];return db[_0xac8e('0xc2')][_0xac8e('0x60')]({'where':_0x8f5415})['then'](function(_0x2c1c29){if(_0x2c1c29){return[_0x2c1c29,![]];}return db[_0xac8e('0xc2')][_0xac8e('0x61')](_0x1a6d04)[_0xac8e('0x39')](function(_0x2528f8){return[_0x2528f8,!![]];});});}return db[_0xac8e('0xc2')][_0xac8e('0x61')](_0x1a6d04)[_0xac8e('0x39')](function(_0x28348f){return[_0x28348f,!![]];});}})[_0xac8e('0xc6')](function(_0x2c8ac0,_0x14318f){if(_0x2c8ac0){_0x1d02f0=_0x14318f;if(!_0x14318f){var _0x41b6d6={'from':(_0x43919a[_0xac8e('0xaf')][_0xac8e('0xb4')]||'')+'\x20'+(_0x43919a[_0xac8e('0xaf')][_0xac8e('0xb5')]||'')};if(_0xdda846[_0xac8e('0x62')]['threadId']&&_0xdda846[_0xac8e('0x62')][_0xac8e('0xc7')]&&_0xdda846[_0xac8e('0x62')][_0xac8e('0xc1')]!=_0xdda846[_0xac8e('0x62')][_0xac8e('0xc7')]){_0x41b6d6['threadId']=_0xdda846[_0xac8e('0x62')][_0xac8e('0xc7')];}return _0x2c8ac0[_0xac8e('0x69')](_0x41b6d6);}else{return _0x2c8ac0;}}})['then'](function(_0x346c67){_0x43919a[_0xac8e('0xc5')]=_0x346c67['get']({'plain':!![]});_0x43919a[_0xac8e('0xc5')][_0xac8e('0xc8')]=_0x1d02f0;if(_0x43919a[_0xac8e('0xc5')][_0xac8e('0xc8')]){if(_0x43919a[_0xac8e('0xa8')][_0xac8e('0xc9')]){_0x43919a['applications']['push']({'id':0x0,'priority':_0x43919a['applications'][_0xac8e('0x4d')]+0x1,'app':_0xac8e('0xca'),'appdata':'unmanaged','interval':_0xac8e('0xcb')});}}return db[_0xac8e('0xcc')][_0xac8e('0x61')]({'body':_0xdda846[_0xac8e('0x62')][_0xac8e('0x62')],'ChatWebsiteId':_0xdda846[_0xac8e('0x5d')]['id'],'ChatInteractionId':_0x346c67['id'],'direction':'in','ContactId':_0x43919a[_0xac8e('0xaf')]['id'],'AttachmentId':_0xdda846['body'][_0xac8e('0xcd')]});})['then'](function(_0x1aeb2d){_0x43919a[_0xac8e('0x2e')]=_0x1aeb2d;if(_0x43919a['interaction']['UserId']){return db[_0xac8e('0xce')][_0xac8e('0x60')]({'attributes':['id',_0xac8e('0x3f')],'where':{'id':_0x43919a['interaction'][_0xac8e('0xcf')]}})[_0xac8e('0x39')](function(_0x293774){if(_0x293774){_0x43919a[_0xac8e('0xab')][_0xac8e('0xd0')]({'id':0x0,'priority':0x0,'app':'agent','appdata':_0x293774[_0xac8e('0x3f')]+','+(_0x43919a[_0xac8e('0xa8')][_0xac8e('0xd1')]||0xa),'interval':_0xac8e('0xcb')});_0x43919a[_0xac8e('0xd2')]=!![];}return respondWithRpcPromise('Start',_0xac8e('0xd3'),_0x43919a);});}return respondWithRpcPromise(_0xac8e('0xd4'),_0xac8e('0xd3'),_0x43919a);})[_0xac8e('0x39')](function(_0x4f7c33){respondWithRpcPromise(_0xac8e('0xd5'),_0xac8e('0xd5'),{'event':_0xac8e('0x91'),'message':_0x4f7c33},client9002);return _0x4f7c33;})[_0xac8e('0x39')](respondWithResult(_0x3eb808,null))[_0xac8e('0x30')](handleError(_0x3eb808,null));};exports[_0xac8e('0xd6')]=function(_0x17b5f6,_0x480ef3,_0xe4a9b2){var _0x5bada6,_0x53455f,_0x4fc39f;var _0x21a7f1=[];var _0x4b7bc0=[];var _0x543d10={};return db[_0xac8e('0x98')][_0xac8e('0x6a')]()[_0xac8e('0x39')](function(_0x2c7f3b){if(!_0x2c7f3b){throw new db['Sequelize'][(_0xac8e('0x26'))](_0xac8e('0x99'));}_0x4b7bc0=_[_0xac8e('0xd7')](_[_0xac8e('0x4a')](_0x2c7f3b),[_0xac8e('0x9a'),_0xac8e('0x9b')]);_0x21a7f1=_[_0xac8e('0xd7')](_[_0xac8e('0x4a')](_0x2c7f3b),['createdAt','updatedAt',_0xac8e('0xd8'),_0xac8e('0x9c')]);if(_0x17b5f6['body']['id']){delete _0x17b5f6[_0xac8e('0x62')]['id'];}if(_[_0xac8e('0x84')](_0x17b5f6[_0xac8e('0x62')]['from'])){throw _0x480ef3[_0xac8e('0x35')](0x1f4)[_0xac8e('0x40')](new db['Sequelize'][(_0xac8e('0x26'))](_0xac8e('0xd9')));}if(_[_0xac8e('0x84')](_0x17b5f6['body'][_0xac8e('0x62')])||_0x17b5f6['body'][_0xac8e('0x62')]===''){throw _0x480ef3[_0xac8e('0x35')](0x1f4)[_0xac8e('0x40')](new db[(_0xac8e('0x25'))][(_0xac8e('0x26'))](_0xac8e('0x9e')));}if(_[_0xac8e('0x84')](_0x17b5f6['body'][_0xac8e('0xda')])){throw _0x480ef3['status'](0x1f4)['send'](new db['Sequelize']['ValidationError']('mapKeyOffline\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20'+_0x21a7f1));}if(!_['includes'](_0x21a7f1,_0x17b5f6[_0xac8e('0x62')]['mapKeyOffline'])){throw _0x480ef3['status'](0x1f4)[_0xac8e('0x40')](new db[(_0xac8e('0x25'))][(_0xac8e('0x26'))]('mapKeyOffline\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20'+_0x21a7f1));}_0x543d10[_0x17b5f6['body'][_0xac8e('0xda')]]=_0x17b5f6[_0xac8e('0x62')][_0xac8e('0x9d')];})[_0xac8e('0x39')](function(){return db[_0xac8e('0x43')]['find']({'where':{'id':_0x17b5f6[_0xac8e('0x5d')]['id']},'include':[{'model':db[_0xac8e('0xa3')],'as':_0xac8e('0xa4')}]});})[_0xac8e('0x39')](handleEntityNotFound(_0x480ef3,null))[_0xac8e('0x39')](function(_0x5e19d0){if(_0x5e19d0&&_0x5e19d0['List']){_0x53455f=_0x5e19d0;var _0x5a44a2=_[_0xac8e('0xae')](_0x17b5f6[_0xac8e('0x62')],{'firstName':_0x17b5f6['body'][_0xac8e('0x9d')],'phone':_0x17b5f6[_0xac8e('0x62')]['from'],'ListId':_0x5e19d0[_0xac8e('0x9c')]});_0x5a44a2[_0x17b5f6[_0xac8e('0x62')][_0xac8e('0xda')]]=_0x17b5f6[_0xac8e('0x62')][_0xac8e('0x9d')];return db[_0xac8e('0x98')][_0xac8e('0xdb')]({'where':_0x543d10,'defaults':_0x5a44a2});}})[_0xac8e('0xc6')](function(_0x3a6919){if(_0x3a6919){_0x4fc39f=_0x3a6919;var _0x1684d5=fs[_0xac8e('0xdc')](path['join'](config[_0xac8e('0x7f')],_0xac8e('0xdd')),_0xac8e('0xde'));var _0x54f0dd=ejs['render'](_0x1684d5,{'body':_[_0xac8e('0xdf')](_0x17b5f6[_0xac8e('0x62')][_0xac8e('0x62')]),'bodyTitle':_0x53455f[_0xac8e('0xe0')]});return db[_0xac8e('0xe1')]['create']({'body':_0x54f0dd,'ContactId':_0x3a6919['id'],'ChatWebsiteId':_0x53455f['id']});}})[_0xac8e('0x39')](function(_0x2a1371){if(_0x2a1371){_0x5bada6=_0x2a1371;return db['MailAccount'][_0xac8e('0x73')]({'where':{'service':!![]},'include':[{'model':db['MailServerOut'],'as':'Smtp','raw':!![]}]});}})[_0xac8e('0x39')](function(_0x6ccf5d){if(_0x6ccf5d&&_0x6ccf5d[_0xac8e('0xe2')]&&_0x53455f['forwardOfflineAddress']){var _0xb5c4dd={'tls':{'rejectUnauthorized':![]}};if(_0x6ccf5d[_0xac8e('0xe2')]['service']){_0xb5c4dd[_0xac8e('0xe3')]=_0x6ccf5d['Smtp'][_0xac8e('0xe3')];}else{_0xb5c4dd[_0xac8e('0xe4')]=_0x6ccf5d[_0xac8e('0xe2')][_0xac8e('0xe4')];_0xb5c4dd['port']=_0x6ccf5d[_0xac8e('0xe2')][_0xac8e('0xe5')];_0xb5c4dd[_0xac8e('0xe6')]=_0x6ccf5d[_0xac8e('0xe2')][_0xac8e('0xe6')];}if(_0x6ccf5d['Smtp']['authentication']){_0xb5c4dd[_0xac8e('0xe7')]={'user':_0x6ccf5d[_0xac8e('0xe2')][_0xac8e('0x63')],'pass':_0x6ccf5d[_0xac8e('0xe2')][_0xac8e('0xe8')]};}return respondWithRpcPromise(_0xac8e('0xe9'),'sendMail',{'account':_0xb5c4dd,'message':{'from':util[_0xac8e('0xbc')](_0xac8e('0xea'),_0x6ccf5d[_0xac8e('0x3f')],_0x6ccf5d['email']||_0x6ccf5d['Smtp']['user']),'to':_0x53455f[_0xac8e('0xeb')],'subject':_0x53455f[_0xac8e('0xec')],'text':_0x5bada6['body']}},client9003)[_0xac8e('0x39')](function(){return _0x5bada6;})[_0xac8e('0x30')](function(_0xc77198){console[_0xac8e('0x2b')](_0xc77198);});}})['then'](function(){if(_0x5bada6){return _0x5bada6;}})[_0xac8e('0x39')](respondWithResult(_0x480ef3,null))[_0xac8e('0x30')](handleError(_0x480ef3,null));};exports[_0xac8e('0xed')]=function(_0x2120a0,_0x55582a,_0x254bfe){return db[_0xac8e('0xc2')]['find']({'where':{'id':_0x2120a0[_0xac8e('0x5d')]['id']}})['then'](handleEntityNotFound(_0x55582a,null))[_0xac8e('0x39')](function(_0x1394db){if(_0x1394db){return _0x1394db[_0xac8e('0xed')](_0x2120a0['body'][_0xac8e('0xee')],_['omit'](_0x2120a0[_0xac8e('0x62')],['ids','id'])||{});}})[_0xac8e('0x39')](respondWithResult(_0x55582a,null))[_0xac8e('0x30')](handleError(_0x55582a,null));};exports[_0xac8e('0xef')]=function(_0x39f746,_0x51b0ae,_0x1d66a6){var _0x103d6a={'raw':![],'where':{}};var _0x30c17a={};var _0x3c2235={'count':0x0,'rows':[]};return db['ChatWebsite'][_0xac8e('0x73')]({'where':{'id':_0x39f746[_0xac8e('0x5d')]['id']}})[_0xac8e('0x39')](handleEntityNotFound(_0x51b0ae,null))['then'](function(_0x1ad482){if(_0x1ad482){_0x30c17a[_0xac8e('0x47')]=_[_0xac8e('0x4a')](db[_0xac8e('0xc2')]['rawAttributes']);_0x30c17a[_0xac8e('0x49')]=_['keys'](_0x39f746[_0xac8e('0x49')]);_0x30c17a[_0xac8e('0x53')]=_['intersection'](_0x30c17a['model'],_0x30c17a[_0xac8e('0x49')]);_0x103d6a['attributes']=_[_0xac8e('0x5f')](_0x30c17a[_0xac8e('0x47')],qs['fields'](_0x39f746[_0xac8e('0x49')][_0xac8e('0x4b')]));_0x103d6a[_0xac8e('0x4c')]=_0x103d6a[_0xac8e('0x4c')][_0xac8e('0x4d')]?_0x103d6a[_0xac8e('0x4c')]:_0x30c17a[_0xac8e('0x47')];if(!_0x39f746[_0xac8e('0x49')][_0xac8e('0x4e')](_0xac8e('0x4f'))){_0x103d6a['limit']=qs[_0xac8e('0x34')](_0x39f746[_0xac8e('0x49')][_0xac8e('0x34')]);_0x103d6a[_0xac8e('0x33')]=qs[_0xac8e('0x33')](_0x39f746[_0xac8e('0x49')][_0xac8e('0x33')]);}_0x103d6a[_0xac8e('0x50')]=qs[_0xac8e('0x51')](_0x39f746[_0xac8e('0x49')][_0xac8e('0x51')]);_0x103d6a[_0xac8e('0x52')]=qs[_0xac8e('0x53')](_['pick'](_0x39f746[_0xac8e('0x49')],_0x30c17a[_0xac8e('0x53')]));_0x103d6a[_0xac8e('0x52')][_0xac8e('0x6b')]=_0x1ad482['id'];if(_0x39f746[_0xac8e('0x49')][_0xac8e('0x55')]){_0x103d6a[_0xac8e('0x52')]=_[_0xac8e('0x56')](_0x103d6a['where'],{'$or':_['map'](_0x103d6a[_0xac8e('0x4c')],function(_0x364cdd){var _0x28bce9={};_0x28bce9[_0x364cdd]={'$like':'%'+_0x39f746[_0xac8e('0x49')]['filter']+'%'};return _0x28bce9;})});}_0x103d6a=_[_0xac8e('0x56')]({},_0x103d6a,_0x39f746[_0xac8e('0x58')]);return db[_0xac8e('0xc2')][_0xac8e('0x59')]({'where':_0x103d6a[_0xac8e('0x52')]})[_0xac8e('0x39')](function(_0x212a90){_0x3c2235['count']=_0x212a90;if(_0x39f746['query'][_0xac8e('0x5a')]){_0x103d6a[_0xac8e('0x5b')]=[{'model':db[_0xac8e('0x98')],'as':'Contact','required':![]},{'model':db[_0xac8e('0xce')],'as':_0xac8e('0xf0'),'attributes':[_0xac8e('0x3f'),_0xac8e('0xf1'),_0xac8e('0xf2')],'required':![]},{'model':db[_0xac8e('0xf3')],'as':'Tags','attributes':['id',_0xac8e('0x3f'),_0xac8e('0xf4')],'where':_0x39f746[_0xac8e('0x49')][_0xac8e('0xf5')]?{'id':_0x39f746[_0xac8e('0x49')][_0xac8e('0xf5')]}:undefined,'required':_0x39f746[_0xac8e('0x49')][_0xac8e('0xf5')]?!![]:![]}];}return db['ChatInteraction'][_0xac8e('0xf6')](_0x103d6a);})[_0xac8e('0x39')](function(_0x70845c){_0x3c2235[_0xac8e('0x6e')]=_0x70845c;return _0x3c2235;});}})[_0xac8e('0x39')](respondWithFilteredResult(_0x51b0ae,_0x103d6a))[_0xac8e('0x30')](handleError(_0x51b0ae,null));};function iftimePromise(_0x2cf5b7,_0x309580){return respondWithRpcPromise(_0xac8e('0xf7'),_0xac8e('0xf8'),{'command':_0x309580[_0xac8e('0xf9')]?util[_0xac8e('0xbc')](_0xac8e('0xfa'),_0x2cf5b7[_0xac8e('0xfb')],_0x309580[_0xac8e('0xf9')]):util[_0xac8e('0xbc')](_0xac8e('0xfc'),_0x2cf5b7[_0xac8e('0xfb')])},client9002)['then'](function(_0x51bdf5){var _0x11a224=_0x51bdf5&&_0x51bdf5[_0xac8e('0xfd')](_0xac8e('0xfe'))>=0x0?!![]:![];logger[_0xac8e('0x28')](_0xac8e('0xff'),_0x309580['id'],_0x2cf5b7['id'],_0x2cf5b7['interval'],_0x11a224?'ONLINE':_0xac8e('0x100'),_0x309580[_0xac8e('0xf9')]?_0x309580[_0xac8e('0xf9')]:_0xac8e('0x101'));return _0x11a224;})['catch'](function(_0x5cbbe4){logger[_0xac8e('0x2b')]('[%s][INTERVAL][%s]\x20%s\x20%s\x20(%s)',_0x309580['id'],_0x2cf5b7['id'],_0x2cf5b7[_0xac8e('0xfb')],util['inspect'](_0x5cbbe4,{'showHidden':![],'depth':null}),_0x309580[_0xac8e('0xf9')]?_0x309580['timezone']:_0xac8e('0x101'));return![];});}exports[_0xac8e('0xf8')]=function(_0x550a05,_0x200b0a,_0xaa5f6a){var _0x29726f=0x0;var _0x4dc0c3=0x0;var _0x1b6951=![];var _0x2c234d;var _0x5c4f9a;return db['ChatWebsite'][_0xac8e('0x60')]({'where':{'id':_0x550a05['params']['id']},'include':[{'model':db[_0xac8e('0x102')],'as':'Interval','include':[{'model':db[_0xac8e('0x102')],'as':_0xac8e('0x103'),'attributes':['id',_0xac8e('0xfb')],'raw':!![]}]}]})[_0xac8e('0x39')](handleEntityNotFound(_0x200b0a,null))[_0xac8e('0x39')](function(_0x493208){if(_0x493208){_0x2c234d=_0x493208;return _0x493208[_0xac8e('0x104')]({'raw':!![]});}})[_0xac8e('0x39')](function(_0x1f26b9){if(_0x2c234d){if(_0x1f26b9){_0x5c4f9a=_0x1f26b9;}}return require('../../config/license/util')[_0xac8e('0x82')]();})['then'](function(_0xfc52e){if(_0xfc52e){_0x4dc0c3=_0xfc52e[_0xac8e('0x105')];_0x1b6951=_0xfc52e['custom'];}})[_0xac8e('0x39')](function(){return db[_0xac8e('0xc2')][_0xac8e('0x59')]({'where':{'closed':![]}});})[_0xac8e('0x39')](function(_0x584775){_0x29726f=_0x584775;if(_0x4dc0c3&&_0x584775>_0x4dc0c3){return db[_0xac8e('0x106')][_0xac8e('0x73')]({'where':{'id':0x1}})[_0xac8e('0x39')](function(_0x1ab7ff){if(_0x1ab7ff){_0x1ab7ff[_0xac8e('0x107')](_0xac8e('0x108'));}});}})['then'](function(){if(_0x2c234d[_0xac8e('0x102')]&&_0x2c234d[_0xac8e('0x102')]['Intervals']){var _0xa62dc0=[];for(var _0x1ec1dc=0x0;_0x1ec1dc<_0x2c234d['Interval'][_0xac8e('0x103')][_0xac8e('0x4d')];_0x1ec1dc++){var _0x58bb4f=_0x2c234d[_0xac8e('0x102')][_0xac8e('0x103')][_0x1ec1dc][_0xac8e('0x3b')]({'plain':!![]});_0xa62dc0[_0xac8e('0x109')](iftimePromise(_0x58bb4f,_0x2c234d));}return BPromise[_0xac8e('0x10a')](_0xa62dc0)[_0xac8e('0x39')](function(_0x1a3181){return _[_0xac8e('0x10b')](_0x1a3181);});}else{return!![];}})['then'](function(_0x4ab140){var _0x4093ae=fs[_0xac8e('0xdc')](path[_0xac8e('0x7e')](config['root'],_0xac8e('0x10c')),'utf8');var _0x20a995={'remote':_0x2c234d['remote'],'query':querystring[_0xac8e('0xc0')](_[_0xac8e('0x56')](_0x2c234d['get']({'plain':!![]}),{'customerIp':_0x550a05['headers']['x-forwarded-for']||_0x550a05[_0xac8e('0x94')][_0xac8e('0x10d')]||_0x550a05[_0xac8e('0x10e')][_0xac8e('0x10f')]||_0x550a05['ip'],'referer':_0x550a05[_0xac8e('0x94')][_0xac8e('0xb7')],'openedInteractions':_0x29726f,'maxInteractions':_0x4dc0c3,'virtual':_0x1b6951[_0xac8e('0x105')],'online':_0x4ab140,'custom':_0x1b6951}))['replace'](/'/g,'\x5c\x27')};_0x200b0a[_0xac8e('0x40')](ejs[_0xac8e('0x110')](Mustache[_0xac8e('0x110')](_0x4093ae,_0x20a995),{'proactiveActions':_0x5c4f9a,'alignment':_0x2c234d[_0xac8e('0x111')],'verticalAlignment':_0x2c234d[_0xac8e('0x112')],'div_color':_0x2c234d['color'],'text_color':_0x2c234d[_0xac8e('0x113')]}));})[_0xac8e('0x30')](handleError(_0x200b0a,null));};exports[_0xac8e('0x114')]=function(_0x520361,_0x425927,_0x408424){return db[_0xac8e('0x43')][_0xac8e('0x73')]({'where':{'id':_0x520361[_0xac8e('0x5d')]['id']}})[_0xac8e('0x39')](handleEntityNotFound(_0x425927,null))[_0xac8e('0x39')](function(_0x5a8e88){if(_0x5a8e88){return db[_0xac8e('0x115')]['transaction'](function(_0x394792){return db['ChatApplication']['destroy']({'where':{'ChatWebsiteId':_0x520361[_0xac8e('0x5d')]['id']},'transaction':_0x394792})[_0xac8e('0x39')](function(_0x292c76){var _0x39a071=_[_0xac8e('0x48')](_0x520361[_0xac8e('0x62')],function(_0x4e1774){_0x4e1774[_0xac8e('0x6b')]=_0x520361[_0xac8e('0x5d')]['id'];return _0x4e1774;});return db['ChatApplication']['bulkCreate'](_0x39a071,{'transaction':_0x394792});});})['then'](function(){return db[_0xac8e('0xa6')][_0xac8e('0x116')]({'where':{'ChatWebsiteId':_0x520361[_0xac8e('0x5d')]['id']},'order':_0xac8e('0xac')});});}})['then'](respondWithResult(_0x425927,null))[_0xac8e('0x30')](handleError(_0x425927,null));};exports[_0xac8e('0x117')]=function(_0x1b5b73,_0x52af66,_0x44d030){var _0x59969e={};var _0x319b6d={};var _0x526e09;var _0x2bce50;return db['ChatWebsite']['findOne']({'where':{'id':_0x1b5b73[_0xac8e('0x5d')]['id']}})[_0xac8e('0x39')](handleEntityNotFound(_0x52af66,null))[_0xac8e('0x39')](function(_0x56eaf6){if(_0x56eaf6){_0x526e09=_0x56eaf6;_0x319b6d[_0xac8e('0x47')]=_[_0xac8e('0x4a')](db[_0xac8e('0xa6')][_0xac8e('0x74')]);_0x319b6d[_0xac8e('0x49')]=_[_0xac8e('0x4a')](_0x1b5b73[_0xac8e('0x49')]);_0x319b6d['filters']=_[_0xac8e('0x5f')](_0x319b6d[_0xac8e('0x47')],_0x319b6d[_0xac8e('0x49')]);_0x59969e[_0xac8e('0x4c')]=_[_0xac8e('0x5f')](_0x319b6d['model'],qs['fields'](_0x1b5b73[_0xac8e('0x49')][_0xac8e('0x4b')]));_0x59969e[_0xac8e('0x4c')]=_0x59969e[_0xac8e('0x4c')][_0xac8e('0x4d')]?_0x59969e[_0xac8e('0x4c')]:_0x319b6d[_0xac8e('0x47')];_0x59969e[_0xac8e('0x50')]=qs['sort'](_0x1b5b73[_0xac8e('0x49')][_0xac8e('0x51')]);_0x59969e['where']=qs['filters'](_[_0xac8e('0x54')](_0x1b5b73[_0xac8e('0x49')],_0x319b6d[_0xac8e('0x53')]));if(_0x1b5b73[_0xac8e('0x49')][_0xac8e('0x55')]){_0x59969e[_0xac8e('0x52')]=_['merge'](_0x59969e[_0xac8e('0x52')],{'$or':_[_0xac8e('0x48')](_0x59969e[_0xac8e('0x4c')],function(_0x433dd3){var _0x349f5b={};_0x349f5b[_0x433dd3]={'$like':'%'+_0x1b5b73[_0xac8e('0x49')][_0xac8e('0x55')]+'%'};return _0x349f5b;})});}_0x59969e=_[_0xac8e('0x56')]({},_0x59969e,_0x1b5b73['options']);return _0x526e09[_0xac8e('0x117')](_0x59969e);}})[_0xac8e('0x39')](function(_0x4fb09f){if(_0x4fb09f){_0x2bce50=_0x4fb09f[_0xac8e('0x4d')];if(!_0x1b5b73[_0xac8e('0x49')][_0xac8e('0x4e')](_0xac8e('0x4f'))){_0x59969e[_0xac8e('0x34')]=qs[_0xac8e('0x34')](_0x1b5b73[_0xac8e('0x49')][_0xac8e('0x34')]);_0x59969e['offset']=qs[_0xac8e('0x33')](_0x1b5b73[_0xac8e('0x49')][_0xac8e('0x33')]);}return _0x526e09[_0xac8e('0x117')](_0x59969e);}})['then'](function(_0x25be53){if(_0x25be53){return _0x25be53?{'count':_0x2bce50,'rows':_0x25be53}:null;}})['then'](respondWithResult(_0x52af66,null))[_0xac8e('0x30')](handleError(_0x52af66,null));};exports['addProactiveActions']=function(_0x4eb47d,_0x2e9221,_0xf9794b){return db[_0xac8e('0x118')][_0xac8e('0x60')]({'where':{'id':_0x4eb47d['params']['id']}})[_0xac8e('0x39')](handleEntityNotFound(_0x2e9221,null))['then'](function(_0x5d545b){if(_0x5d545b){return _0x5d545b[_0xac8e('0x119')](_0x4eb47d[_0xac8e('0x62')]['ids'],_[_0xac8e('0x11a')](_0x4eb47d['body'],[_0xac8e('0xee'),'id'])||{});}})[_0xac8e('0x39')](respondWithResult(_0x2e9221,null))[_0xac8e('0x30')](handleError(_0x2e9221,null));};exports[_0xac8e('0x104')]=function(_0x321ffb,_0x2a8d7f,_0x322f85){var _0x4d7068={};var _0x39b1b2={};var _0x4070f7;var _0xada0d7;return db[_0xac8e('0x43')]['findOne']({'where':{'id':_0x321ffb[_0xac8e('0x5d')]['id']}})[_0xac8e('0x39')](handleEntityNotFound(_0x2a8d7f,null))[_0xac8e('0x39')](function(_0xa20821){if(_0xa20821){_0x4070f7=_0xa20821;_0x39b1b2[_0xac8e('0x47')]=_[_0xac8e('0x4a')](db[_0xac8e('0x11b')][_0xac8e('0x74')]);_0x39b1b2['query']=_[_0xac8e('0x4a')](_0x321ffb[_0xac8e('0x49')]);_0x39b1b2[_0xac8e('0x53')]=_[_0xac8e('0x5f')](_0x39b1b2['model'],_0x39b1b2[_0xac8e('0x49')]);_0x4d7068['attributes']=_[_0xac8e('0x5f')](_0x39b1b2[_0xac8e('0x47')],qs[_0xac8e('0x4b')](_0x321ffb[_0xac8e('0x49')]['fields']));_0x4d7068['attributes']=_0x4d7068[_0xac8e('0x4c')][_0xac8e('0x4d')]?_0x4d7068['attributes']:_0x39b1b2[_0xac8e('0x47')];_0x4d7068[_0xac8e('0x50')]=qs[_0xac8e('0x51')](_0x321ffb[_0xac8e('0x49')][_0xac8e('0x51')]);_0x4d7068['where']=qs[_0xac8e('0x53')](_[_0xac8e('0x54')](_0x321ffb['query'],_0x39b1b2[_0xac8e('0x53')]));if(_0x321ffb[_0xac8e('0x49')]['filter']){_0x4d7068[_0xac8e('0x52')]=_[_0xac8e('0x56')](_0x4d7068[_0xac8e('0x52')],{'$or':_['map'](_0x4d7068[_0xac8e('0x4c')],function(_0x14eb8c){var _0x11ce0d={};_0x11ce0d[_0x14eb8c]={'$like':'%'+_0x321ffb[_0xac8e('0x49')]['filter']+'%'};return _0x11ce0d;})});}_0x4d7068=_[_0xac8e('0x56')]({},_0x4d7068,_0x321ffb[_0xac8e('0x58')]);return _0x4070f7['getProactiveActions'](_0x4d7068);}})[_0xac8e('0x39')](function(_0x4dd8ef){if(_0x4dd8ef){_0xada0d7=_0x4dd8ef[_0xac8e('0x4d')];if(!_0x321ffb[_0xac8e('0x49')][_0xac8e('0x4e')](_0xac8e('0x4f'))){_0x4d7068[_0xac8e('0x34')]=qs['limit'](_0x321ffb[_0xac8e('0x49')]['limit']);_0x4d7068['offset']=qs[_0xac8e('0x33')](_0x321ffb['query'][_0xac8e('0x33')]);}return _0x4070f7['getProactiveActions'](_0x4d7068);}})['then'](function(_0x453c3c){if(_0x453c3c){return _0x453c3c?{'count':_0xada0d7,'rows':_0x453c3c}:null;}})[_0xac8e('0x39')](respondWithResult(_0x2a8d7f,null))[_0xac8e('0x30')](handleError(_0x2a8d7f,null));};exports[_0xac8e('0x11c')]=function(_0x194e02,_0x4a8b81,_0x488e02){var _0x43f39b=_0x194e02[_0xac8e('0x49')]['online']==='false'?_0xac8e('0x11d'):_0xac8e('0x11e');return db[_0xac8e('0x43')][_0xac8e('0x60')]({'attributes':['id',_0x43f39b],'where':{'id':_0x194e02[_0xac8e('0x5d')]['id']}})[_0xac8e('0x39')](handleEntityNotFound(_0x4a8b81,null))[_0xac8e('0x39')](function(_0xed3495){if(_0xed3495){var _0x262559=_0xed3495[_0x43f39b];var _0x15de05=_0x262559&&_0x262559[_0xac8e('0x11f')]?_0x262559[_0xac8e('0x11f')]:[];_0x4a8b81[_0xac8e('0x40')]({'fromKey':_['isNil'](_0x262559[_0xac8e('0x120')])?undefined:_0x262559['fromKey'],'count':_0x15de05[_0xac8e('0x4d')],'rows':_0x15de05});}})[_0xac8e('0x30')](handleError(_0x4a8b81,null));};exports['getOfflineMessages']=function(_0x5ade7c,_0x350088,_0x5db0ca){var _0xadedd9={'raw':![],'where':{}};var _0x250b18={};var _0x4e9149={'count':0x0,'rows':[]};return db[_0xac8e('0x43')][_0xac8e('0x73')]({'where':{'id':_0x5ade7c[_0xac8e('0x5d')]['id']}})[_0xac8e('0x39')](handleEntityNotFound(_0x350088,null))['then'](function(_0x2c73df){if(_0x2c73df){_0x250b18[_0xac8e('0x47')]=_[_0xac8e('0x4a')](db[_0xac8e('0xe1')][_0xac8e('0x74')]);_0x250b18['query']=_[_0xac8e('0x4a')](_0x5ade7c[_0xac8e('0x49')]);_0x250b18['filters']=_[_0xac8e('0x5f')](_0x250b18[_0xac8e('0x47')],_0x250b18[_0xac8e('0x49')]);_0xadedd9[_0xac8e('0x4c')]=_[_0xac8e('0x5f')](_0x250b18[_0xac8e('0x47')],qs[_0xac8e('0x4b')](_0x5ade7c['query'][_0xac8e('0x4b')]));_0xadedd9[_0xac8e('0x4c')]=_0xadedd9[_0xac8e('0x4c')]['length']?_0xadedd9[_0xac8e('0x4c')]:_0x250b18[_0xac8e('0x47')];if(!_0x5ade7c[_0xac8e('0x49')][_0xac8e('0x4e')](_0xac8e('0x4f'))){_0xadedd9[_0xac8e('0x34')]=qs[_0xac8e('0x34')](_0x5ade7c[_0xac8e('0x49')][_0xac8e('0x34')]);_0xadedd9[_0xac8e('0x33')]=qs[_0xac8e('0x33')](_0x5ade7c['query'][_0xac8e('0x33')]);}_0xadedd9[_0xac8e('0x50')]=qs[_0xac8e('0x51')](_0x5ade7c[_0xac8e('0x49')]['sort']);_0xadedd9[_0xac8e('0x52')]=qs[_0xac8e('0x53')](_['pick'](_0x5ade7c[_0xac8e('0x49')],_0x250b18[_0xac8e('0x53')]));_0xadedd9[_0xac8e('0x52')][_0xac8e('0x6b')]=_0x2c73df['id'];if(_0x5ade7c[_0xac8e('0x49')][_0xac8e('0x55')]){_0xadedd9[_0xac8e('0x52')]=_[_0xac8e('0x56')](_0xadedd9['where'],{'$or':_['map'](_0xadedd9['attributes'],function(_0x37326d){var _0x5bb5ef={};_0x5bb5ef[_0x37326d]={'$like':'%'+_0x5ade7c[_0xac8e('0x49')][_0xac8e('0x55')]+'%'};return _0x5bb5ef;})});}_0xadedd9=_[_0xac8e('0x56')]({},_0xadedd9,_0x5ade7c[_0xac8e('0x58')]);return db[_0xac8e('0xe1')][_0xac8e('0x59')]({'where':_0xadedd9[_0xac8e('0x52')]})[_0xac8e('0x39')](function(_0x5dec96){_0x4e9149['count']=_0x5dec96;if(_0x5ade7c[_0xac8e('0x49')]['includeAll']){_0xadedd9[_0xac8e('0x5b')]=[{'all':!![]}];}else{_0xadedd9['include']=[{'model':db[_0xac8e('0x98')],'as':_0xac8e('0x121'),'required':![]}];}return db[_0xac8e('0xe1')]['findAll'](_0xadedd9);})['then'](function(_0x516377){_0x4e9149['rows']=_0x516377;return _0x4e9149;});}})['then'](respondWithFilteredResult(_0x350088,_0xadedd9))[_0xac8e('0x30')](handleError(_0x350088,null));};exports[_0xac8e('0x122')]=function(_0xdd98df,_0xe2751a,_0x19759d){return db[_0xac8e('0x43')][_0xac8e('0x60')]({'where':{'id':_0xdd98df['params']['id']}})[_0xac8e('0x39')](handleEntityNotFound(_0xe2751a,null))['then'](function(_0x5a067c){if(_0x5a067c){return _0x5a067c[_0xac8e('0x122')](_0xdd98df[_0xac8e('0x62')][_0xac8e('0xee')],_[_0xac8e('0x11a')](_0xdd98df[_0xac8e('0x62')],[_0xac8e('0xee'),'id'])||{})['spread'](function(_0x3d4eb0){for(var _0x1ca548=0x0;_0x1ca548<_0xdd98df[_0xac8e('0x62')]['ids'][_0xac8e('0x4d')];_0x1ca548+=0x1){socket[_0xac8e('0x123')]('userChatWebsite:save',{'UserId':_0xdd98df[_0xac8e('0x62')]['ids'][_0x1ca548],'ChatWebsiteId':_0xdd98df[_0xac8e('0x5d')]['id']});}return _0x3d4eb0;});}})[_0xac8e('0x39')](respondWithResult(_0xe2751a,null))['catch'](handleError(_0xe2751a,null));};exports[_0xac8e('0x124')]=function(_0x5f3b40,_0x1f2f65,_0xc1527f){return db['ChatWebsite']['find']({'where':{'id':_0x5f3b40[_0xac8e('0x5d')]['id']}})[_0xac8e('0x39')](handleEntityNotFound(_0x1f2f65,null))[_0xac8e('0x39')](function(_0x2d2b05){if(_0x2d2b05){return _0x2d2b05[_0xac8e('0x124')](_0x5f3b40[_0xac8e('0x49')][_0xac8e('0xee')])[_0xac8e('0x39')](function(){if(_[_0xac8e('0x125')](_0x5f3b40[_0xac8e('0x49')]['ids'])){for(var _0x17961e=0x0;_0x17961e<_0x5f3b40['query'][_0xac8e('0xee')]['length'];_0x17961e+=0x1){socket[_0xac8e('0x123')](_0xac8e('0x126'),{'UserId':Number(_0x5f3b40[_0xac8e('0x49')][_0xac8e('0xee')][_0x17961e]),'ChatWebsiteId':Number(_0x5f3b40[_0xac8e('0x5d')]['id'])});}}else{socket[_0xac8e('0x123')](_0xac8e('0x126'),{'UserId':Number(_0x5f3b40[_0xac8e('0x49')][_0xac8e('0xee')]),'ChatWebsiteId':Number(_0x5f3b40[_0xac8e('0x5d')]['id'])});}});}})['then'](respondWithStatusCode(_0x1f2f65,null))[_0xac8e('0x30')](handleError(_0x1f2f65,null));};exports[_0xac8e('0x127')]=function(_0x3aa807,_0x216459,_0x2d8666){var _0x22c09b={};var _0x5f5257={};var _0x1ea5b9;var _0x20d93a;return db[_0xac8e('0x43')][_0xac8e('0x73')]({'where':{'id':_0x3aa807[_0xac8e('0x5d')]['id']}})['then'](handleEntityNotFound(_0x216459,null))[_0xac8e('0x39')](function(_0x547353){if(_0x547353){_0x1ea5b9=_0x547353;_0x5f5257[_0xac8e('0x47')]=_[_0xac8e('0x4a')](db[_0xac8e('0xce')][_0xac8e('0x74')]);_0x5f5257['query']=_['keys'](_0x3aa807['query']);_0x5f5257[_0xac8e('0x53')]=_[_0xac8e('0x5f')](_0x5f5257[_0xac8e('0x47')],_0x5f5257[_0xac8e('0x49')]);_0x22c09b[_0xac8e('0x4c')]=_['intersection'](_0x5f5257[_0xac8e('0x47')],qs['fields'](_0x3aa807[_0xac8e('0x49')][_0xac8e('0x4b')]));_0x22c09b[_0xac8e('0x4c')]=_0x22c09b[_0xac8e('0x4c')][_0xac8e('0x4d')]?_0x22c09b[_0xac8e('0x4c')]:_0x5f5257[_0xac8e('0x47')];_0x22c09b['order']=qs['sort'](_0x3aa807[_0xac8e('0x49')][_0xac8e('0x51')]);_0x22c09b['where']=qs[_0xac8e('0x53')](_[_0xac8e('0x54')](_0x3aa807[_0xac8e('0x49')],_0x5f5257[_0xac8e('0x53')]));if(_0x3aa807[_0xac8e('0x49')]['filter']){_0x22c09b[_0xac8e('0x52')]=_[_0xac8e('0x56')](_0x22c09b[_0xac8e('0x52')],{'$or':_[_0xac8e('0x48')](_0x22c09b[_0xac8e('0x4c')],function(_0x452527){var _0x3559c4={};_0x3559c4[_0x452527]={'$like':'%'+_0x3aa807[_0xac8e('0x49')]['filter']+'%'};return _0x3559c4;})});}_0x22c09b=_['merge']({},_0x22c09b,_0x3aa807[_0xac8e('0x58')]);return _0x1ea5b9[_0xac8e('0x127')](_0x22c09b);}})[_0xac8e('0x39')](function(_0x1ee5f8){if(_0x1ee5f8){_0x20d93a=_0x1ee5f8[_0xac8e('0x4d')];if(!_0x3aa807[_0xac8e('0x49')]['hasOwnProperty'](_0xac8e('0x4f'))){_0x22c09b[_0xac8e('0x34')]=qs[_0xac8e('0x34')](_0x3aa807[_0xac8e('0x49')][_0xac8e('0x34')]);_0x22c09b['offset']=qs[_0xac8e('0x33')](_0x3aa807[_0xac8e('0x49')][_0xac8e('0x33')]);}return _0x1ea5b9['getAgents'](_0x22c09b);}})[_0xac8e('0x39')](function(_0x500df7){if(_0x500df7){return _0x500df7?{'count':_0x20d93a,'rows':_0x500df7}:null;}})['then'](respondWithResult(_0x216459,null))[_0xac8e('0x30')](handleError(_0x216459,null));}; \ No newline at end of file +var _0x7967=['Contacts','ListId','contact','cf-connecting-ip','first','x-forwarded-for','split','lastName','x-real-port','referer','browser','format','%s\x20%s','version','unknown','device','vendor','stringify','threadId','ChatInteraction','externalUrl','ContactId','interaction','spread','firstName','messageId','created','autoclose','push','close','*,*,*,*','ChatMessage','AttachmentId','UserId','User','unshift','waitForTheAssignedAgent','forcedOwnership','Start','startRouting','EventManager','offline','mapKeyOffline','mapKeyOffline\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','mapKeyOffline\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','findOrCreate','readFileSync','server/files/templates/chatOfflineMessage.ejs','utf8','render','toPairs','offlineMessageBody','ChatOfflineMessage','MailAccount','MailServerOut','Smtp','forwardOfflineAddress','service','host','port','authentication','auth','SendMail','\x22%s\x22\x20<%s>','email','addInteraction','getInteractions','Contact','fullname','internal','Tag','Tags','tag','Command','getSnippet','timezone','iftime\x20%s,%s','interval','iftime\x20%s','indexOf','ONLINE','No\x20timezone','[%s][INTERVAL][%s]\x20%s\x20%s\x20(%s)','inspect','Interval','Intervals','../../config/license/util','virtual','custom','License','chatLicenseExceeded','all','some','server/files/chat/iframe.js','remote','remoteAddress','verticalAlignment','color','textColor','addApplications','sequelize','transaction','bulkCreate','findAndCountAll','priority','getApplications','chatProactiveAction','addProactiveActions','omit','getProactiveActions','getFields','online','false','offlineForm','onlineForm','items','fromKey','getOfflineMessages','addAgents','userChatWebsite:save','isArray','emit','userChatWebsite:remove','getAgents','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','util','path','sox','to-csv','lodash','squel','crypto','jsforce','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/environment','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./chatWebsite.socket','client','Sequelize','request','then','info','request\x20sent','error','code','ChatWebsite,\x20%s,\x20%s','message','catch','sendStatus','end','json','count','offset','limit','update','destroy','get','UserProfileResource','status','stack','send','index','Pause','rawAttributes','fieldName','type','key','model','map','name','filters','intersection','query','attributes','fields','length','hasOwnProperty','sort','where','pick','filter','merge','VIRTUAL','options','ChatWebsite','includeAll','include','findAll','rows','show','mandatoryDispositionPause','keys','find','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','ChatWebsites','UserProfileSection','userProfileId','autoAssociation','body','params','describe','ChatWebsiteId','Disposition','getDispositions','findOne','nolimit','order','removeDispositions','ids','addAnswer','getAnswers','CannedAnswer','addLogo','sitepic','file','filename','customerAvatar','getLogo','join','root','server/files/images/logos/default_logo.png','getLicense','isNil','existsSync','server/files/images/logos/','download','getAvatar','server/files/images/avatars/default_avatar.png','agentAvatar','server/files/images/avatars/','showCustomerAvatar','server/files/images/avatars/system_avatar.png','systemAvatar','setUA','headers','user-agent','getResult','chat','CmContact','ValidationError','difference','createdAt','updatedAt','CompanyId','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey','includes','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','from','CmList','List','DESC','ChatApplication','Applications','account','applications','orderBy','asc'];(function(_0x26d2ec,_0x35e34a){var _0x21edf2=function(_0x5dcf67){while(--_0x5dcf67){_0x26d2ec['push'](_0x26d2ec['shift']());}};_0x21edf2(++_0x35e34a);}(_0x7967,0x7c));var _0x7796=function(_0x223126,_0xe7bd89){_0x223126=_0x223126-0x0;var _0x5a92c6=_0x7967[_0x223126];return _0x5a92c6;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x7796('0x0'));var rimraf=require(_0x7796('0x1'));var zipdir=require(_0x7796('0x2'));var jsonpatch=require(_0x7796('0x3'));var rp=require('request-promise');var moment=require(_0x7796('0x4'));var BPromise=require(_0x7796('0x5'));var Mustache=require('mustache');var util=require(_0x7796('0x6'));var path=require(_0x7796('0x7'));var sox=require(_0x7796('0x8'));var csv=require(_0x7796('0x9'));var ejs=require('ejs');var fs=require('fs');var _=require(_0x7796('0xa'));var squel=require(_0x7796('0xb'));var crypto=require(_0x7796('0xc'));var jsforce=require(_0x7796('0xd'));var deskjs=require('desk.js');var toCsv=require(_0x7796('0x9'));var querystring=require('querystring');var Papa=require(_0x7796('0xe'));var Redis=require(_0x7796('0xf'));var authService=require('../../components/auth/service');var qs=require(_0x7796('0x10'));var as=require(_0x7796('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x7796('0x12'))(_0x7796('0x13'));var utils=require('../../config/utils');var config=require(_0x7796('0x14'));var db=require(_0x7796('0x15'))['db'];config[_0x7796('0x16')]=_[_0x7796('0x17')](config[_0x7796('0x16')],{'host':_0x7796('0x18'),'port':0x18eb});var socket=require(_0x7796('0x19'))(new Redis(config[_0x7796('0x16')]));require(_0x7796('0x1a'))['register'](socket);var jayson=require('jayson/promise');var client=jayson['client']['http']({'port':0x232c});var client9002=jayson[_0x7796('0x1b')]['http']({'port':0x232a});var client9003=jayson[_0x7796('0x1b')]['http']({'port':0x232b});function checkPasswordPattern(_0x28e90b,_0x28876e,_0x48fe61){if(_0x48fe61){var _0x5afc45=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x5afc45['test'](_0x28876e)){return _0x28e90b;}else{throw new db[(_0x7796('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 _0x28e90b;}}function respondWithRpcPromise(_0x2e81aa,_0x815be4,_0x2ee082,_0x5ac6bf){return new BPromise(function(_0x1a995e,_0x329146){var _0x356117=_0x5ac6bf||client;return _0x356117[_0x7796('0x1d')](_0x2e81aa,_0x2ee082)[_0x7796('0x1e')](function(_0x1f16c6){logger[_0x7796('0x1f')]('ChatWebsite,\x20%s,\x20%s',_0x815be4,_0x7796('0x20'));logger['debug']('ChatWebsite,\x20%s,\x20%s,\x20%s',_0x815be4,'request\x20sent',JSON['stringify'](_0x1f16c6));if(_0x1f16c6[_0x7796('0x21')]){if(_0x1f16c6['error'][_0x7796('0x22')]===0x1f4){logger[_0x7796('0x21')](_0x7796('0x23'),_0x815be4,_0x1f16c6[_0x7796('0x21')]['message']);return _0x329146(_0x1f16c6[_0x7796('0x21')][_0x7796('0x24')]);}logger[_0x7796('0x21')](_0x7796('0x23'),_0x815be4,_0x1f16c6['error'][_0x7796('0x24')]);return _0x1a995e(_0x1f16c6[_0x7796('0x21')]['message']);}else{logger[_0x7796('0x1f')](_0x7796('0x23'),_0x815be4,_0x7796('0x20'));_0x1a995e(_0x1f16c6['result'][_0x7796('0x24')]);}})[_0x7796('0x25')](function(_0x2b29fe){logger[_0x7796('0x21')](_0x7796('0x23'),_0x815be4,_0x2b29fe);_0x329146(_0x2b29fe);});});}function respondWithStatusCode(_0x1ce5e5,_0x281c65){_0x281c65=_0x281c65||0xcc;return function(_0xb85c4b){if(_0xb85c4b){return _0x1ce5e5[_0x7796('0x26')](_0x281c65);}return _0x1ce5e5['status'](_0x281c65)[_0x7796('0x27')]();};}function respondWithResult(_0x140ea3,_0x2e4aeb){_0x2e4aeb=_0x2e4aeb||0xc8;return function(_0x293f79){if(_0x293f79){return _0x140ea3['status'](_0x2e4aeb)[_0x7796('0x28')](_0x293f79);}};}function respondWithFilteredResult(_0x2fa58b,_0x320519){return function(_0x592317){if(_0x592317){var _0x612c84=_0x592317[_0x7796('0x29')],_0x4fddaa=_0x320519[_0x7796('0x2a')],_0x3c6e5d=_0x320519[_0x7796('0x2a')]+_0x320519[_0x7796('0x2b')],_0x53d245;if(_0x3c6e5d>=_0x612c84){_0x3c6e5d=_0x612c84;_0x53d245=0xc8;}else{_0x53d245=0xce;}_0x2fa58b['status'](_0x53d245);return _0x2fa58b['set']('Content-Range',_0x4fddaa+'-'+_0x3c6e5d+'/'+_0x612c84)[_0x7796('0x28')](_0x592317);}return null;};}function patchUpdates(_0x1725d8){return function(_0x5279e6){try{jsonpatch['apply'](_0x5279e6,_0x1725d8,!![]);}catch(_0x1b8c90){return BPromise['reject'](_0x1b8c90);}return _0x5279e6['save']();};}function saveUpdates(_0x4a31ac,_0x4d3029){return function(_0x418cb3){if(_0x418cb3){return _0x418cb3[_0x7796('0x2c')](_0x4a31ac)[_0x7796('0x1e')](function(_0x4e892b){return _0x4e892b;});}return null;};}function removeEntity(_0x1b85b5,_0x1eb76d){return function(_0x3af2d9){if(_0x3af2d9){return _0x3af2d9[_0x7796('0x2d')]()[_0x7796('0x1e')](function(){var _0x204e06=_0x3af2d9[_0x7796('0x2e')]({'plain':!![]});var _0x1030be='ChatWebsites';return db[_0x7796('0x2f')]['destroy']({'where':{'type':_0x1030be,'resourceId':_0x204e06['id']}})[_0x7796('0x1e')](function(){return _0x3af2d9;});})[_0x7796('0x1e')](function(){_0x1b85b5[_0x7796('0x30')](0xcc)[_0x7796('0x27')]();});}};}function handleEntityNotFound(_0x1237b5,_0x339461){return function(_0x5f5c1f){if(!_0x5f5c1f){_0x1237b5[_0x7796('0x26')](0x194);}return _0x5f5c1f;};}function handleError(_0x2edff8,_0x2a460b){_0x2a460b=_0x2a460b||0x1f4;return function(_0x258016){logger[_0x7796('0x21')](_0x258016[_0x7796('0x31')]);if(_0x258016['name']){delete _0x258016['name'];}_0x2edff8['status'](_0x2a460b)[_0x7796('0x32')](_0x258016);};}exports[_0x7796('0x33')]=function(_0xdf815d,_0x5b4777){var _0x1abf73={'include':[{'model':db[_0x7796('0x34')],'as':'mandatoryDispositionPause'}]},_0x5f0fcc={},_0xb0b0e1={'count':0x0,'rows':[]};var _0x4d6474=_['map'](db['ChatWebsite'][_0x7796('0x35')],function(_0x3be360){return{'name':_0x3be360[_0x7796('0x36')],'type':_0x3be360[_0x7796('0x37')][_0x7796('0x38')]};});_0x5f0fcc[_0x7796('0x39')]=_[_0x7796('0x3a')](_0x4d6474,_0x7796('0x3b'));_0x5f0fcc['query']=_['keys'](_0xdf815d['query']);_0x5f0fcc[_0x7796('0x3c')]=_[_0x7796('0x3d')](_0x5f0fcc['model'],_0x5f0fcc[_0x7796('0x3e')]);_0x1abf73[_0x7796('0x3f')]=_['intersection'](_0x5f0fcc[_0x7796('0x39')],qs['fields'](_0xdf815d[_0x7796('0x3e')][_0x7796('0x40')]));_0x1abf73['attributes']=_0x1abf73[_0x7796('0x3f')][_0x7796('0x41')]?_0x1abf73[_0x7796('0x3f')]:_0x5f0fcc[_0x7796('0x39')];if(!_0xdf815d[_0x7796('0x3e')][_0x7796('0x42')]('nolimit')){_0x1abf73[_0x7796('0x2b')]=qs[_0x7796('0x2b')](_0xdf815d[_0x7796('0x3e')][_0x7796('0x2b')]);_0x1abf73[_0x7796('0x2a')]=qs[_0x7796('0x2a')](_0xdf815d[_0x7796('0x3e')][_0x7796('0x2a')]);}_0x1abf73['order']=qs['sort'](_0xdf815d['query'][_0x7796('0x43')]);_0x1abf73[_0x7796('0x44')]=qs['filters'](_[_0x7796('0x45')](_0xdf815d[_0x7796('0x3e')],_0x5f0fcc[_0x7796('0x3c')]));if(_0xdf815d[_0x7796('0x3e')][_0x7796('0x46')]){_0x1abf73[_0x7796('0x44')]=_[_0x7796('0x47')](_0x1abf73[_0x7796('0x44')],{'$or':_[_0x7796('0x3a')](_0x4d6474,function(_0x22864c){if(_0x22864c[_0x7796('0x37')]!==_0x7796('0x48')){var _0x1c25ef={};_0x1c25ef[_0x22864c['name']]={'$like':'%'+_0xdf815d[_0x7796('0x3e')][_0x7796('0x46')]+'%'};return _0x1c25ef;}})});}_0x1abf73=_[_0x7796('0x47')]({},_0x1abf73,_0xdf815d[_0x7796('0x49')]);var _0x2a5e61={'where':_0x1abf73[_0x7796('0x44')]};return db[_0x7796('0x4a')][_0x7796('0x29')](_0x2a5e61)['then'](function(_0x4ea2a7){_0xb0b0e1[_0x7796('0x29')]=_0x4ea2a7;if(_0xdf815d[_0x7796('0x3e')][_0x7796('0x4b')]){_0x1abf73[_0x7796('0x4c')]=[{'all':!![]}];}return db[_0x7796('0x4a')][_0x7796('0x4d')](_0x1abf73);})[_0x7796('0x1e')](function(_0xa38bf2){_0xb0b0e1[_0x7796('0x4e')]=_0xa38bf2;return _0xb0b0e1;})['then'](respondWithFilteredResult(_0x5b4777,_0x1abf73))[_0x7796('0x25')](handleError(_0x5b4777,null));};exports[_0x7796('0x4f')]=function(_0x2a318d,_0xca466){var _0x58eaad={'raw':![],'where':{'id':_0x2a318d['params']['id']},'include':[{'model':db['Pause'],'as':_0x7796('0x50')}]},_0x553745={};_0x553745['model']=_['keys'](db[_0x7796('0x4a')][_0x7796('0x35')]);_0x553745[_0x7796('0x3e')]=_[_0x7796('0x51')](_0x2a318d['query']);_0x553745[_0x7796('0x3c')]=_[_0x7796('0x3d')](_0x553745[_0x7796('0x39')],_0x553745[_0x7796('0x3e')]);_0x58eaad[_0x7796('0x3f')]=_[_0x7796('0x3d')](_0x553745[_0x7796('0x39')],qs[_0x7796('0x40')](_0x2a318d[_0x7796('0x3e')]['fields']));_0x58eaad[_0x7796('0x3f')]=_0x58eaad[_0x7796('0x3f')]['length']?_0x58eaad[_0x7796('0x3f')]:_0x553745[_0x7796('0x39')];if(_0x2a318d[_0x7796('0x3e')][_0x7796('0x4b')]){_0x58eaad[_0x7796('0x4c')]=[{'all':!![]}];}_0x58eaad=_[_0x7796('0x47')]({},_0x58eaad,_0x2a318d[_0x7796('0x49')]);return db['ChatWebsite'][_0x7796('0x52')](_0x58eaad)[_0x7796('0x1e')](handleEntityNotFound(_0xca466,null))[_0x7796('0x1e')](respondWithResult(_0xca466,null))[_0x7796('0x25')](handleError(_0xca466,null));};exports[_0x7796('0x53')]=function(_0xc2f96d,_0x375cee){return db[_0x7796('0x4a')]['create'](_0xc2f96d['body'],{})['then'](function(_0x45fcd0){var _0x48a00c=_0xc2f96d[_0x7796('0x54')][_0x7796('0x2e')]({'plain':!![]});if(!_0x48a00c)throw new Error(_0x7796('0x55'));if(_0x48a00c[_0x7796('0x56')]===_0x7796('0x54')){var _0x5d4ec7=_0x45fcd0[_0x7796('0x2e')]({'plain':!![]});var _0x563f72=_0x7796('0x57');return db[_0x7796('0x58')][_0x7796('0x52')]({'where':{'name':_0x563f72,'userProfileId':_0x48a00c[_0x7796('0x59')]},'raw':!![]})[_0x7796('0x1e')](function(_0x41c2e3){if(_0x41c2e3&&_0x41c2e3[_0x7796('0x5a')]===0x0){return db[_0x7796('0x2f')][_0x7796('0x53')]({'name':_0x5d4ec7[_0x7796('0x3b')],'resourceId':_0x5d4ec7['id'],'type':_0x41c2e3[_0x7796('0x3b')],'sectionId':_0x41c2e3['id']},{})[_0x7796('0x1e')](function(){return _0x45fcd0;});}else{return _0x45fcd0;}})['catch'](function(_0x371c8a){logger[_0x7796('0x21')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x371c8a);throw _0x371c8a;});}return _0x45fcd0;})[_0x7796('0x1e')](respondWithResult(_0x375cee,0xc9))[_0x7796('0x25')](handleError(_0x375cee,null));};exports['update']=function(_0x327806,_0x42d825){if(_0x327806[_0x7796('0x5b')]['id']){delete _0x327806[_0x7796('0x5b')]['id'];}return db[_0x7796('0x4a')][_0x7796('0x52')]({'where':{'id':_0x327806[_0x7796('0x5c')]['id']},'include':[{'model':db['Pause'],'as':'mandatoryDispositionPause'}]})[_0x7796('0x1e')](handleEntityNotFound(_0x42d825,null))[_0x7796('0x1e')](saveUpdates(_0x327806[_0x7796('0x5b')],null))['then'](respondWithResult(_0x42d825,null))[_0x7796('0x25')](handleError(_0x42d825,null));};exports['destroy']=function(_0x1172bc,_0x524788){return db[_0x7796('0x4a')]['find']({'where':{'id':_0x1172bc[_0x7796('0x5c')]['id']}})[_0x7796('0x1e')](handleEntityNotFound(_0x524788,null))[_0x7796('0x1e')](removeEntity(_0x524788,null))[_0x7796('0x25')](handleError(_0x524788,null));};exports[_0x7796('0x5d')]=function(_0x3a53e8,_0x5ee855){return db[_0x7796('0x4a')][_0x7796('0x5d')]()['then'](respondWithResult(_0x5ee855,null))[_0x7796('0x25')](handleError(_0x5ee855,null));};exports['addDisposition']=function(_0x45fdf5,_0x3cd12b,_0x35f2fc){if(_0x45fdf5[_0x7796('0x5b')]['id']){delete _0x45fdf5[_0x7796('0x5b')]['id'];}return db[_0x7796('0x4a')][_0x7796('0x52')]({'where':{'id':_0x45fdf5[_0x7796('0x5c')]['id']}})[_0x7796('0x1e')](handleEntityNotFound(_0x3cd12b,null))[_0x7796('0x1e')](function(_0x403c8f){if(_0x403c8f){_0x45fdf5[_0x7796('0x5b')][_0x7796('0x5e')]=_0x403c8f['id'];return db[_0x7796('0x5f')][_0x7796('0x53')](_0x45fdf5[_0x7796('0x5b')]);}})[_0x7796('0x1e')](respondWithResult(_0x3cd12b,null))[_0x7796('0x25')](handleError(_0x3cd12b,null));};exports[_0x7796('0x60')]=function(_0x195db5,_0x27a2c2,_0x1d4860){var _0xce9e14={'raw':![],'where':{}};var _0x28d0a2={};var _0x365a07={'count':0x0,'rows':[]};return db['ChatWebsite'][_0x7796('0x61')]({'where':{'id':_0x195db5['params']['id']}})[_0x7796('0x1e')](handleEntityNotFound(_0x27a2c2,null))[_0x7796('0x1e')](function(_0x5a5737){if(_0x5a5737){_0x28d0a2['model']=_[_0x7796('0x51')](db[_0x7796('0x5f')][_0x7796('0x35')]);_0x28d0a2[_0x7796('0x3e')]=_[_0x7796('0x51')](_0x195db5['query']);_0x28d0a2[_0x7796('0x3c')]=_[_0x7796('0x3d')](_0x28d0a2[_0x7796('0x39')],_0x28d0a2[_0x7796('0x3e')]);_0xce9e14[_0x7796('0x3f')]=_['intersection'](_0x28d0a2[_0x7796('0x39')],qs[_0x7796('0x40')](_0x195db5[_0x7796('0x3e')][_0x7796('0x40')]));_0xce9e14[_0x7796('0x3f')]=_0xce9e14[_0x7796('0x3f')][_0x7796('0x41')]?_0xce9e14[_0x7796('0x3f')]:_0x28d0a2[_0x7796('0x39')];if(!_0x195db5[_0x7796('0x3e')][_0x7796('0x42')](_0x7796('0x62'))){_0xce9e14[_0x7796('0x2b')]=qs[_0x7796('0x2b')](_0x195db5[_0x7796('0x3e')]['limit']);_0xce9e14[_0x7796('0x2a')]=qs[_0x7796('0x2a')](_0x195db5[_0x7796('0x3e')]['offset']);}_0xce9e14[_0x7796('0x63')]=qs[_0x7796('0x43')](_0x195db5[_0x7796('0x3e')][_0x7796('0x43')]);_0xce9e14['where']=qs[_0x7796('0x3c')](_[_0x7796('0x45')](_0x195db5[_0x7796('0x3e')],_0x28d0a2['filters']));_0xce9e14[_0x7796('0x44')][_0x7796('0x5e')]=_0x5a5737['id'];if(_0x195db5[_0x7796('0x3e')]['filter']){_0xce9e14['where']=_[_0x7796('0x47')](_0xce9e14[_0x7796('0x44')],{'$or':_[_0x7796('0x3a')](_0xce9e14['attributes'],function(_0x9f20fb){var _0x49bb35={};_0x49bb35[_0x9f20fb]={'$like':'%'+_0x195db5[_0x7796('0x3e')][_0x7796('0x46')]+'%'};return _0x49bb35;})});}_0xce9e14=_['merge']({},_0xce9e14,_0x195db5['options']);return db[_0x7796('0x5f')][_0x7796('0x29')]({'where':_0xce9e14[_0x7796('0x44')]})[_0x7796('0x1e')](function(_0x17b68a){_0x365a07['count']=_0x17b68a;if(_0x195db5[_0x7796('0x3e')]['includeAll']){_0xce9e14[_0x7796('0x4c')]=[{'all':!![]}];}return db[_0x7796('0x5f')][_0x7796('0x4d')](_0xce9e14);})['then'](function(_0x29b720){_0x365a07[_0x7796('0x4e')]=_0x29b720;return _0x365a07;});}})['then'](respondWithFilteredResult(_0x27a2c2,_0xce9e14))['catch'](handleError(_0x27a2c2,null));};exports[_0x7796('0x64')]=function(_0x3c354f,_0x3205d5,_0xe826ad){return db['ChatWebsite'][_0x7796('0x52')]({'where':{'id':_0x3c354f[_0x7796('0x5c')]['id']}})['then'](handleEntityNotFound(_0x3205d5,null))[_0x7796('0x1e')](function(_0x4c8f73){if(_0x4c8f73){return _0x4c8f73['removeDispositions'](_0x3c354f[_0x7796('0x3e')][_0x7796('0x65')]);}})[_0x7796('0x1e')](respondWithStatusCode(_0x3205d5,null))[_0x7796('0x25')](handleError(_0x3205d5,null));};exports[_0x7796('0x66')]=function(_0x4ec2d6,_0x399adb,_0x4d3293){if(_0x4ec2d6['body']['id']){delete _0x4ec2d6[_0x7796('0x5b')]['id'];}return db[_0x7796('0x4a')][_0x7796('0x52')]({'where':{'id':_0x4ec2d6[_0x7796('0x5c')]['id']}})[_0x7796('0x1e')](handleEntityNotFound(_0x399adb,null))[_0x7796('0x1e')](function(_0x18fbd6){if(_0x18fbd6){_0x4ec2d6[_0x7796('0x5b')][_0x7796('0x5e')]=_0x18fbd6['id'];return db['CannedAnswer'][_0x7796('0x53')](_0x4ec2d6[_0x7796('0x5b')]);}})[_0x7796('0x1e')](respondWithResult(_0x399adb,null))[_0x7796('0x25')](handleError(_0x399adb,null));};exports[_0x7796('0x67')]=function(_0x3120a7,_0x4b1ac5,_0x4ba201){var _0x37ca9d={'raw':![],'where':{}};var _0xad951e={};var _0x21e178={'count':0x0,'rows':[]};return db[_0x7796('0x4a')][_0x7796('0x61')]({'where':{'id':_0x3120a7['params']['id']}})[_0x7796('0x1e')](handleEntityNotFound(_0x4b1ac5,null))[_0x7796('0x1e')](function(_0x24d6e5){if(_0x24d6e5){_0xad951e['model']=_[_0x7796('0x51')](db[_0x7796('0x68')][_0x7796('0x35')]);_0xad951e[_0x7796('0x3e')]=_[_0x7796('0x51')](_0x3120a7[_0x7796('0x3e')]);_0xad951e[_0x7796('0x3c')]=_[_0x7796('0x3d')](_0xad951e[_0x7796('0x39')],_0xad951e[_0x7796('0x3e')]);_0x37ca9d[_0x7796('0x3f')]=_[_0x7796('0x3d')](_0xad951e[_0x7796('0x39')],qs['fields'](_0x3120a7[_0x7796('0x3e')]['fields']));_0x37ca9d['attributes']=_0x37ca9d['attributes'][_0x7796('0x41')]?_0x37ca9d[_0x7796('0x3f')]:_0xad951e[_0x7796('0x39')];if(!_0x3120a7['query'][_0x7796('0x42')]('nolimit')){_0x37ca9d[_0x7796('0x2b')]=qs['limit'](_0x3120a7[_0x7796('0x3e')][_0x7796('0x2b')]);_0x37ca9d[_0x7796('0x2a')]=qs[_0x7796('0x2a')](_0x3120a7[_0x7796('0x3e')]['offset']);}_0x37ca9d['order']=qs[_0x7796('0x43')](_0x3120a7[_0x7796('0x3e')][_0x7796('0x43')]);_0x37ca9d[_0x7796('0x44')]=qs[_0x7796('0x3c')](_[_0x7796('0x45')](_0x3120a7[_0x7796('0x3e')],_0xad951e['filters']));_0x37ca9d[_0x7796('0x44')][_0x7796('0x5e')]=_0x24d6e5['id'];if(_0x3120a7[_0x7796('0x3e')]['filter']){_0x37ca9d[_0x7796('0x44')]=_[_0x7796('0x47')](_0x37ca9d[_0x7796('0x44')],{'$or':_[_0x7796('0x3a')](_0x37ca9d[_0x7796('0x3f')],function(_0x57a1b4){var _0x501c53={};_0x501c53[_0x57a1b4]={'$like':'%'+_0x3120a7[_0x7796('0x3e')][_0x7796('0x46')]+'%'};return _0x501c53;})});}_0x37ca9d=_[_0x7796('0x47')]({},_0x37ca9d,_0x3120a7['options']);return db[_0x7796('0x68')][_0x7796('0x29')]({'where':_0x37ca9d[_0x7796('0x44')]})[_0x7796('0x1e')](function(_0x257807){_0x21e178[_0x7796('0x29')]=_0x257807;if(_0x3120a7[_0x7796('0x3e')][_0x7796('0x4b')]){_0x37ca9d[_0x7796('0x4c')]=[{'all':!![]}];}return db[_0x7796('0x68')]['findAll'](_0x37ca9d);})[_0x7796('0x1e')](function(_0x33c6c9){_0x21e178[_0x7796('0x4e')]=_0x33c6c9;return _0x21e178;});}})[_0x7796('0x1e')](respondWithFilteredResult(_0x4b1ac5,_0x37ca9d))[_0x7796('0x25')](handleError(_0x4b1ac5,null));};exports['removeAnswers']=function(_0x1ea777,_0x4af152,_0x1bbebc){return db[_0x7796('0x4a')]['find']({'where':{'id':_0x1ea777[_0x7796('0x5c')]['id']}})['then'](handleEntityNotFound(_0x4af152,null))[_0x7796('0x1e')](function(_0x2f5aca){if(_0x2f5aca){return _0x2f5aca['removeAnswers'](_0x1ea777['query'][_0x7796('0x65')]);}})[_0x7796('0x1e')](respondWithStatusCode(_0x4af152,null))[_0x7796('0x25')](handleError(_0x4af152,null));};exports[_0x7796('0x69')]=function(_0x2c13f9,_0x507a0f,_0x502faa){_0x2c13f9[_0x7796('0x5b')][_0x7796('0x6a')]=_0x2c13f9[_0x7796('0x6b')][_0x7796('0x6c')];return db['ChatWebsite']['find']({'where':{'id':_0x2c13f9[_0x7796('0x5c')]['id']}})[_0x7796('0x1e')](handleEntityNotFound(_0x507a0f,null))[_0x7796('0x1e')](saveUpdates(_0x2c13f9[_0x7796('0x5b')],null))[_0x7796('0x1e')](respondWithResult(_0x507a0f,null))[_0x7796('0x25')](handleError(_0x507a0f,null));};exports['addAvatar']=function(_0x1c0337,_0x5ca745,_0x4553db){_0x1c0337[_0x7796('0x5b')]['agentAvatar']=_0x1c0337[_0x7796('0x6b')][_0x7796('0x6c')];return db[_0x7796('0x4a')]['find']({'where':{'id':_0x1c0337[_0x7796('0x5c')]['id']}})[_0x7796('0x1e')](handleEntityNotFound(_0x5ca745,null))[_0x7796('0x1e')](saveUpdates(_0x1c0337[_0x7796('0x5b')],null))[_0x7796('0x1e')](respondWithResult(_0x5ca745,null))['catch'](handleError(_0x5ca745,null));};exports['addCustomerAvatar']=function(_0x35a56d,_0x1f9d04,_0x4b5bb0){_0x35a56d[_0x7796('0x5b')][_0x7796('0x6d')]=_0x35a56d['file'][_0x7796('0x6c')];return db[_0x7796('0x4a')][_0x7796('0x52')]({'where':{'id':_0x35a56d['params']['id']}})[_0x7796('0x1e')](handleEntityNotFound(_0x1f9d04,null))[_0x7796('0x1e')](saveUpdates(_0x35a56d[_0x7796('0x5b')],null))['then'](respondWithResult(_0x1f9d04,null))[_0x7796('0x25')](handleError(_0x1f9d04,null));};exports['addSystemAvatar']=function(_0x3c03c2,_0x3724b8,_0x2d5fc6){_0x3c03c2[_0x7796('0x5b')]['systemAvatar']=_0x3c03c2['file'][_0x7796('0x6c')];return db[_0x7796('0x4a')][_0x7796('0x52')]({'where':{'id':_0x3c03c2[_0x7796('0x5c')]['id']}})[_0x7796('0x1e')](handleEntityNotFound(_0x3724b8,null))[_0x7796('0x1e')](saveUpdates(_0x3c03c2['body'],null))['then'](respondWithResult(_0x3724b8,null))[_0x7796('0x25')](handleError(_0x3724b8,null));};exports[_0x7796('0x6e')]=function(_0x43b054,_0x48c486,_0x2d1703){var _0x429b9d=path[_0x7796('0x6f')](config[_0x7796('0x70')],_0x7796('0x71'));var _0x465aa2={'where':{'id':_0x43b054[_0x7796('0x5c')]['id']},'attributes':['id',_0x7796('0x6a')],'raw':!![]};var _0x228a7c=![];return require('../../config/license/util')[_0x7796('0x72')]()[_0x7796('0x1e')](function(_0x38bcda){if(_0x38bcda){_0x228a7c=_0x38bcda['custom'];}})[_0x7796('0x1e')](function(){return db[_0x7796('0x4a')]['find'](_0x465aa2);})[_0x7796('0x1e')](handleEntityNotFound(_0x48c486,null))[_0x7796('0x1e')](function(_0x16c31a){if(_0x16c31a){if(!_[_0x7796('0x73')](_0x16c31a[_0x7796('0x6a')])){if(fs[_0x7796('0x74')](path[_0x7796('0x6f')](config[_0x7796('0x70')],'server/files/images/logos/',_0x16c31a['sitepic']))&&_0x228a7c){_0x429b9d=path['join'](config[_0x7796('0x70')],_0x7796('0x75'),_0x16c31a['sitepic']);}}return _0x48c486[_0x7796('0x76')](_0x429b9d);}})[_0x7796('0x25')](handleError(_0x48c486,null));};exports[_0x7796('0x77')]=function(_0x265857,_0xb32d6,_0x531fee){var _0x425060=path[_0x7796('0x6f')](config[_0x7796('0x70')],_0x7796('0x78'));var _0x417a3a={'where':{'id':_0x265857[_0x7796('0x5c')]['id']},'attributes':['id',_0x7796('0x79')],'raw':!![]};return db['ChatWebsite']['find'](_0x417a3a)[_0x7796('0x1e')](handleEntityNotFound(_0xb32d6,null))[_0x7796('0x1e')](function(_0x43be9b){if(_0x43be9b){if(!_[_0x7796('0x73')](_0x43be9b[_0x7796('0x79')])){if(fs[_0x7796('0x74')](path[_0x7796('0x6f')](config[_0x7796('0x70')],'server/files/images/avatars/',_0x43be9b[_0x7796('0x79')]))){_0x425060=path['join'](config[_0x7796('0x70')],_0x7796('0x7a'),_0x43be9b['agentAvatar']);}}return _0xb32d6['download'](_0x425060);}})[_0x7796('0x25')](handleError(_0xb32d6,null));};exports['getCustomerAvatar']=function(_0x5df78e,_0x2f2de9,_0x12fd7d){var _0xc57557=path[_0x7796('0x6f')](config['root'],'server/files/images/avatars/customer_avatar.png');var _0x340f75={'where':{'id':_0x5df78e['params']['id']},'attributes':['id',_0x7796('0x6d'),_0x7796('0x7b')],'raw':!![]};return db[_0x7796('0x4a')][_0x7796('0x52')](_0x340f75)['then'](handleEntityNotFound(_0x2f2de9,null))[_0x7796('0x1e')](function(_0x29ba79){if(_0x29ba79){if(!_[_0x7796('0x73')](_0x29ba79[_0x7796('0x6d')])){if(fs[_0x7796('0x74')](path['join'](config[_0x7796('0x70')],_0x7796('0x7a'),_0x29ba79['customerAvatar']))&&_0x29ba79[_0x7796('0x7b')]){_0xc57557=path[_0x7796('0x6f')](config[_0x7796('0x70')],'server/files/images/avatars/',_0x29ba79[_0x7796('0x6d')]);}}return _0x2f2de9[_0x7796('0x76')](_0xc57557);}})[_0x7796('0x25')](handleError(_0x2f2de9,null));};exports['getSystemAvatar']=function(_0xae26f1,_0x53108,_0x52ac4d){var _0x208e4e=path[_0x7796('0x6f')](config['root'],_0x7796('0x7c'));var _0x7d003f={'where':{'id':_0xae26f1[_0x7796('0x5c')]['id']},'attributes':['id',_0x7796('0x7d')],'raw':!![]};return db[_0x7796('0x4a')][_0x7796('0x52')](_0x7d003f)[_0x7796('0x1e')](handleEntityNotFound(_0x53108,null))[_0x7796('0x1e')](function(_0x31273b){if(_0x31273b){if(!_[_0x7796('0x73')](_0x31273b['systemAvatar'])){if(fs[_0x7796('0x74')](path[_0x7796('0x6f')](config[_0x7796('0x70')],_0x7796('0x7a'),_0x31273b[_0x7796('0x7d')]))){_0x208e4e=path[_0x7796('0x6f')](config['root'],'server/files/images/avatars/',_0x31273b[_0x7796('0x7d')]);}}return _0x53108['download'](_0x208e4e);}})['catch'](handleError(_0x53108,null));};exports['notify']=function(_0x174dde,_0x5bc0e0,_0x53ce15){var _0x236bd0=require('user-agent-parser');var _0x61cafe=new _0x236bd0();var _0x51d32e=_0x61cafe[_0x7796('0x7e')](_0x174dde[_0x7796('0x7f')][_0x7796('0x80')])[_0x7796('0x81')]();var _0x38c814={'body':_0x174dde[_0x7796('0x5b')],'channel':_0x7796('0x82')};var _0x357919=[];var _0x13a394=[];var _0x71096f={};var _0x16b635=![];return db[_0x7796('0x83')][_0x7796('0x5d')]()[_0x7796('0x1e')](function(_0x3dcfa6){if(!_0x3dcfa6){throw new db[(_0x7796('0x1c'))][(_0x7796('0x84'))]('no\x20available\x20attributes');}_0x357919=_[_0x7796('0x85')](_[_0x7796('0x51')](_0x3dcfa6),[_0x7796('0x86'),_0x7796('0x87')]);_0x13a394=_[_0x7796('0x85')](_[_0x7796('0x51')](_0x3dcfa6),[_0x7796('0x86'),_0x7796('0x87'),_0x7796('0x88'),'ListId']);if(_0x174dde['body']['id']){delete _0x174dde[_0x7796('0x5b')]['id'];}if(_['isNil'](_0x174dde['body']['from'])){throw new db[(_0x7796('0x1c'))][(_0x7796('0x84'))]('from\x20is\x20mandatory');}if(_[_0x7796('0x73')](_0x174dde['body'][_0x7796('0x5b')])||_0x174dde[_0x7796('0x5b')][_0x7796('0x5b')]===''){throw new db['Sequelize']['ValidationError'](_0x7796('0x89'));}if(_[_0x7796('0x73')](_0x174dde[_0x7796('0x5b')][_0x7796('0x8a')])){throw new db[(_0x7796('0x1c'))][(_0x7796('0x84'))]('mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20'+_0x13a394);}if(!_[_0x7796('0x8b')](_0x13a394,_0x174dde['body'][_0x7796('0x8a')])){throw new db[(_0x7796('0x1c'))][(_0x7796('0x84'))](_0x7796('0x8c')+_0x13a394);}_0x71096f[_0x174dde[_0x7796('0x5b')]['mapKey']]=_0x174dde['body'][_0x7796('0x8d')];})[_0x7796('0x1e')](function(){return db[_0x7796('0x4a')][_0x7796('0x52')]({'where':{'id':_0x174dde[_0x7796('0x5c')]['id']},'include':[{'model':db[_0x7796('0x8e')],'as':_0x7796('0x8f'),'include':[{'model':db[_0x7796('0x83')],'as':'Contacts','where':_0x71096f,'limit':0x1,'order':[[_0x7796('0x87'),_0x7796('0x90')]]}]},{'model':db[_0x7796('0x91')],'as':_0x7796('0x92')}]});})['then'](handleEntityNotFound(_0x5bc0e0,null))[_0x7796('0x1e')](function(_0x5dd73c){if(_0x5dd73c&&_0x5dd73c[_0x7796('0x8f')]){_0x38c814[_0x7796('0x93')]=_0x5dd73c;_0x38c814[_0x7796('0x94')]=_0x5dd73c[_0x7796('0x92')];_0x38c814['list']=_0x5dd73c[_0x7796('0x8f')];_0x38c814[_0x7796('0x94')]=_[_0x7796('0x95')](_0x38c814[_0x7796('0x94')],['priority'],[_0x7796('0x96')]);if(_0x38c814[_0x7796('0x93')][_0x7796('0x92')]){delete _0x38c814[_0x7796('0x93')][_0x7796('0x92')];}if(_0x38c814[_0x7796('0x93')]['List']&&_0x38c814['account']['List']['Contacts']['length']){return _0x38c814['account'][_0x7796('0x8f')][_0x7796('0x97')][0x0];}var _0x27a03f=_['defaults'](_0x174dde[_0x7796('0x5b')],{'firstName':_0x174dde[_0x7796('0x5b')][_0x7796('0x8d')],'ListId':_0x5dd73c[_0x7796('0x98')]});_0x27a03f[_0x174dde[_0x7796('0x5b')][_0x7796('0x8a')]]=_0x174dde[_0x7796('0x5b')]['from'];return db[_0x7796('0x83')][_0x7796('0x53')](_0x27a03f,{'fields':_0x357919,'raw':!![]});}})['then'](handleEntityNotFound(_0x5bc0e0,null))['then'](function(_0x4ce14a){_0x38c814[_0x7796('0x99')]=_0x4ce14a;var _0x2cdb61=_0x174dde['body']['customerIp'];if(_0x174dde[_0x7796('0x7f')][_0x7796('0x9a')]){_0x2cdb61=_0x174dde[_0x7796('0x7f')][_0x7796('0x9a')];}else if(_0x174dde[_0x7796('0x7f')]['x-forwarded-for']){_0x2cdb61=_[_0x7796('0x9b')](_0x174dde[_0x7796('0x7f')][_0x7796('0x9c')][_0x7796('0x9d')](','));}if(_0x4ce14a){var _0x5301b6={'ContactId':_0x4ce14a['id'],'ChatWebsiteId':_0x174dde['params']['id'],'from':(_0x4ce14a['firstName']||'')+'\x20'+(_0x4ce14a[_0x7796('0x9e')]||''),'customerIp':_0x2cdb61,'customerPort':_0x174dde[_0x7796('0x7f')][_0x7796('0x9f')]?_0x174dde[_0x7796('0x7f')][_0x7796('0x9f')]:null,'referer':_0x174dde[_0x7796('0x5b')][_0x7796('0xa0')],'browserName':_0x51d32e[_0x7796('0xa1')][_0x7796('0x3b')]&&_0x51d32e['browser']['version']?util[_0x7796('0xa2')](_0x7796('0xa3'),_0x51d32e[_0x7796('0xa1')][_0x7796('0x3b')],_0x51d32e[_0x7796('0xa1')][_0x7796('0xa4')]):_0x7796('0xa5'),'browserVersion':_0x51d32e[_0x7796('0xa1')][_0x7796('0xa4')]||_0x7796('0xa5'),'osName':util[_0x7796('0xa2')](_0x7796('0xa3'),_0x51d32e['os'][_0x7796('0x3b')],_0x51d32e['os'][_0x7796('0xa4')]),'osVersion':_0x51d32e['os']['version'],'deviceModel':_0x51d32e[_0x7796('0xa6')][_0x7796('0x39')]&&_0x51d32e[_0x7796('0xa6')]['vendor']?util[_0x7796('0xa2')]('%s\x20%s\x20%s',_0x51d32e[_0x7796('0xa6')][_0x7796('0x39')],_0x51d32e[_0x7796('0xa6')][_0x7796('0xa7')],_0x51d32e[_0x7796('0xa6')][_0x7796('0x37')]):null,'deviceVendor':_0x51d32e[_0x7796('0xa6')][_0x7796('0xa7')],'deviceType':_0x51d32e[_0x7796('0xa6')][_0x7796('0x37')],'formData':JSON[_0x7796('0xa8')](_0x174dde['body'])};var _0x2af0f8={'ChatWebsiteId':_0x174dde['params']['id'],'closed':![]};if(_0x174dde['body'][_0x7796('0xa9')]){_0x2af0f8[_0x7796('0xa9')]=_0x174dde[_0x7796('0x5b')]['threadId'];return db[_0x7796('0xaa')][_0x7796('0x52')]({'where':_0x2af0f8})[_0x7796('0x1e')](function(_0xfdc1b5){if(_0xfdc1b5){return[_0xfdc1b5,![]];}_0x5301b6[_0x7796('0xa9')]=_0x174dde[_0x7796('0x5b')][_0x7796('0xa9')];_0x5301b6[_0x7796('0xab')]=_0x174dde[_0x7796('0x5b')][_0x7796('0xab')];return db[_0x7796('0xaa')][_0x7796('0x53')](_0x5301b6)['then'](function(_0x20f451){return[_0x20f451,!![]];});});}_0x2af0f8[_0x7796('0xac')]=_0x4ce14a['id'];if(_0x174dde[_0x7796('0x5b')]['interaction']&&_0x174dde[_0x7796('0x5b')][_0x7796('0xad')]['id']){_0x2af0f8['id']=_0x174dde['body']['interaction']['id'];return db['ChatInteraction'][_0x7796('0x52')]({'where':_0x2af0f8})['then'](function(_0x1f7e18){if(_0x1f7e18){return[_0x1f7e18,![]];}return db[_0x7796('0xaa')][_0x7796('0x53')](_0x5301b6)[_0x7796('0x1e')](function(_0x367c8b){return[_0x367c8b,!![]];});});}return db[_0x7796('0xaa')][_0x7796('0x53')](_0x5301b6)['then'](function(_0x4fd569){return[_0x4fd569,!![]];});}})[_0x7796('0xae')](function(_0x24bbec,_0x1bb369){if(_0x24bbec){_0x16b635=_0x1bb369;if(!_0x1bb369){var _0x3f1596={'from':(_0x38c814[_0x7796('0x99')][_0x7796('0xaf')]||'')+'\x20'+(_0x38c814[_0x7796('0x99')][_0x7796('0x9e')]||'')};if(_0x174dde[_0x7796('0x5b')][_0x7796('0xa9')]&&_0x174dde['body']['messageId']&&_0x174dde[_0x7796('0x5b')]['threadId']!=_0x174dde['body'][_0x7796('0xb0')]){_0x3f1596[_0x7796('0xa9')]=_0x174dde['body']['messageId'];}return _0x24bbec['update'](_0x3f1596);}else{return _0x24bbec;}}})[_0x7796('0x1e')](function(_0xbd0022){_0x38c814[_0x7796('0xad')]=_0xbd0022['get']({'plain':!![]});_0x38c814[_0x7796('0xad')]['created']=_0x16b635;if(_0x38c814[_0x7796('0xad')][_0x7796('0xb1')]){if(_0x38c814[_0x7796('0x93')][_0x7796('0xb2')]){_0x38c814['applications'][_0x7796('0xb3')]({'id':0x0,'priority':_0x38c814['applications'][_0x7796('0x41')]+0x1,'app':_0x7796('0xb4'),'appdata':'unmanaged','interval':_0x7796('0xb5')});}}return db[_0x7796('0xb6')][_0x7796('0x53')]({'body':_0x174dde[_0x7796('0x5b')][_0x7796('0x5b')],'ChatWebsiteId':_0x174dde[_0x7796('0x5c')]['id'],'ChatInteractionId':_0xbd0022['id'],'direction':'in','ContactId':_0x38c814['contact']['id'],'AttachmentId':_0x174dde['body'][_0x7796('0xb7')]});})[_0x7796('0x1e')](function(_0x2c8ddf){_0x38c814[_0x7796('0x24')]=_0x2c8ddf;if(_0x38c814[_0x7796('0xad')][_0x7796('0xb8')]){return db[_0x7796('0xb9')]['find']({'attributes':['id','name'],'where':{'id':_0x38c814['interaction']['UserId']}})['then'](function(_0x2e7020){if(_0x2e7020){_0x38c814[_0x7796('0x94')][_0x7796('0xba')]({'id':0x0,'priority':0x0,'app':'agent','appdata':_0x2e7020['name']+','+(_0x38c814[_0x7796('0x93')][_0x7796('0xbb')]||0xa),'interval':'*,*,*,*'});_0x38c814[_0x7796('0xbc')]=!![];}return respondWithRpcPromise(_0x7796('0xbd'),_0x7796('0xbe'),_0x38c814);});}return respondWithRpcPromise(_0x7796('0xbd'),_0x7796('0xbe'),_0x38c814);})[_0x7796('0x1e')](function(_0x208b05){respondWithRpcPromise(_0x7796('0xbf'),'EventManager',{'event':'notify','message':_0x208b05},client9002);return _0x208b05;})[_0x7796('0x1e')](respondWithResult(_0x5bc0e0,null))['catch'](handleError(_0x5bc0e0,null));};exports[_0x7796('0xc0')]=function(_0x405412,_0x161a9f,_0x59ade7){var _0x2df78b,_0x5642f2,_0x8996f6;var _0x4ae4f6=[];var _0x30bd67=[];var _0x13a613={};return db['CmContact']['describe']()[_0x7796('0x1e')](function(_0x49917a){if(!_0x49917a){throw new db[(_0x7796('0x1c'))][(_0x7796('0x84'))]('no\x20available\x20attributes');}_0x30bd67=_[_0x7796('0x85')](_[_0x7796('0x51')](_0x49917a),['createdAt',_0x7796('0x87')]);_0x4ae4f6=_['difference'](_[_0x7796('0x51')](_0x49917a),['createdAt',_0x7796('0x87'),_0x7796('0x88'),'ListId']);if(_0x405412['body']['id']){delete _0x405412[_0x7796('0x5b')]['id'];}if(_[_0x7796('0x73')](_0x405412['body']['from'])){throw _0x161a9f[_0x7796('0x30')](0x1f4)[_0x7796('0x32')](new db[(_0x7796('0x1c'))][(_0x7796('0x84'))]('from\x20is\x20mandatory'));}if(_[_0x7796('0x73')](_0x405412[_0x7796('0x5b')][_0x7796('0x5b')])||_0x405412[_0x7796('0x5b')][_0x7796('0x5b')]===''){throw _0x161a9f[_0x7796('0x30')](0x1f4)[_0x7796('0x32')](new db['Sequelize']['ValidationError']('body\x20is\x20mandatory\x20and\x20not\x20empty'));}if(_['isNil'](_0x405412['body'][_0x7796('0xc1')])){throw _0x161a9f[_0x7796('0x30')](0x1f4)['send'](new db[(_0x7796('0x1c'))][(_0x7796('0x84'))](_0x7796('0xc2')+_0x4ae4f6));}if(!_[_0x7796('0x8b')](_0x4ae4f6,_0x405412['body']['mapKeyOffline'])){throw _0x161a9f[_0x7796('0x30')](0x1f4)['send'](new db[(_0x7796('0x1c'))][(_0x7796('0x84'))](_0x7796('0xc3')+_0x4ae4f6));}_0x13a613[_0x405412[_0x7796('0x5b')]['mapKeyOffline']]=_0x405412[_0x7796('0x5b')][_0x7796('0x8d')];})[_0x7796('0x1e')](function(){return db['ChatWebsite'][_0x7796('0x52')]({'where':{'id':_0x405412[_0x7796('0x5c')]['id']},'include':[{'model':db[_0x7796('0x8e')],'as':_0x7796('0x8f')}]});})['then'](handleEntityNotFound(_0x161a9f,null))[_0x7796('0x1e')](function(_0x4f903d){if(_0x4f903d&&_0x4f903d[_0x7796('0x8f')]){_0x5642f2=_0x4f903d;var _0x480fc2=_['defaults'](_0x405412['body'],{'firstName':_0x405412[_0x7796('0x5b')][_0x7796('0x8d')],'phone':_0x405412[_0x7796('0x5b')][_0x7796('0x8d')],'ListId':_0x4f903d[_0x7796('0x98')]});_0x480fc2[_0x405412[_0x7796('0x5b')]['mapKeyOffline']]=_0x405412[_0x7796('0x5b')][_0x7796('0x8d')];return db[_0x7796('0x83')][_0x7796('0xc4')]({'where':_0x13a613,'defaults':_0x480fc2});}})[_0x7796('0xae')](function(_0x483422){if(_0x483422){_0x8996f6=_0x483422;var _0x7ec7ab=fs[_0x7796('0xc5')](path[_0x7796('0x6f')](config[_0x7796('0x70')],_0x7796('0xc6')),_0x7796('0xc7'));var _0xd81ef=ejs[_0x7796('0xc8')](_0x7ec7ab,{'body':_[_0x7796('0xc9')](_0x405412[_0x7796('0x5b')]['body']),'bodyTitle':_0x5642f2[_0x7796('0xca')]});return db[_0x7796('0xcb')][_0x7796('0x53')]({'body':_0xd81ef,'ContactId':_0x483422['id'],'ChatWebsiteId':_0x5642f2['id']});}})[_0x7796('0x1e')](function(_0x46bb3f){if(_0x46bb3f){_0x2df78b=_0x46bb3f;return db[_0x7796('0xcc')]['findOne']({'where':{'service':!![]},'include':[{'model':db[_0x7796('0xcd')],'as':'Smtp','raw':!![]}]});}})[_0x7796('0x1e')](function(_0x5b2aff){if(_0x5b2aff&&_0x5b2aff[_0x7796('0xce')]&&_0x5642f2[_0x7796('0xcf')]){var _0x4ada49={'tls':{'rejectUnauthorized':![]}};if(_0x5b2aff['Smtp']['service']){_0x4ada49[_0x7796('0xd0')]=_0x5b2aff[_0x7796('0xce')][_0x7796('0xd0')];}else{_0x4ada49[_0x7796('0xd1')]=_0x5b2aff[_0x7796('0xce')][_0x7796('0xd1')];_0x4ada49[_0x7796('0xd2')]=_0x5b2aff[_0x7796('0xce')][_0x7796('0xd2')];_0x4ada49['secure']=_0x5b2aff['Smtp']['secure'];}if(_0x5b2aff[_0x7796('0xce')][_0x7796('0xd3')]){_0x4ada49[_0x7796('0xd4')]={'user':_0x5b2aff[_0x7796('0xce')][_0x7796('0x54')],'pass':_0x5b2aff[_0x7796('0xce')]['pass']};}return respondWithRpcPromise(_0x7796('0xd5'),'sendMail',{'account':_0x4ada49,'message':{'from':util['format'](_0x7796('0xd6'),_0x5b2aff[_0x7796('0x3b')],_0x5b2aff[_0x7796('0xd7')]||_0x5b2aff[_0x7796('0xce')]['user']),'to':_0x5642f2[_0x7796('0xcf')],'subject':_0x5642f2['offlineMessageSubject'],'text':_0x2df78b[_0x7796('0x5b')]}},client9003)[_0x7796('0x1e')](function(){return _0x2df78b;})['catch'](function(_0x172130){console[_0x7796('0x21')](_0x172130);});}})[_0x7796('0x1e')](function(){if(_0x2df78b){return _0x2df78b;}})[_0x7796('0x1e')](respondWithResult(_0x161a9f,null))[_0x7796('0x25')](handleError(_0x161a9f,null));};exports[_0x7796('0xd8')]=function(_0x21e24d,_0x2c2c65,_0x49d25c){return db['ChatInteraction'][_0x7796('0x52')]({'where':{'id':_0x21e24d[_0x7796('0x5c')]['id']}})[_0x7796('0x1e')](handleEntityNotFound(_0x2c2c65,null))[_0x7796('0x1e')](function(_0x371179){if(_0x371179){return _0x371179[_0x7796('0xd8')](_0x21e24d['body'][_0x7796('0x65')],_['omit'](_0x21e24d[_0x7796('0x5b')],[_0x7796('0x65'),'id'])||{});}})[_0x7796('0x1e')](respondWithResult(_0x2c2c65,null))['catch'](handleError(_0x2c2c65,null));};exports[_0x7796('0xd9')]=function(_0xce7607,_0x21ed33,_0x8f2e46){var _0x12caea={'raw':![],'where':{}};var _0xd8b257={};var _0x65a453={'count':0x0,'rows':[]};return db[_0x7796('0x4a')][_0x7796('0x61')]({'where':{'id':_0xce7607['params']['id']}})[_0x7796('0x1e')](handleEntityNotFound(_0x21ed33,null))[_0x7796('0x1e')](function(_0x520d79){if(_0x520d79){_0xd8b257[_0x7796('0x39')]=_[_0x7796('0x51')](db[_0x7796('0xaa')]['rawAttributes']);_0xd8b257[_0x7796('0x3e')]=_[_0x7796('0x51')](_0xce7607[_0x7796('0x3e')]);_0xd8b257[_0x7796('0x3c')]=_['intersection'](_0xd8b257[_0x7796('0x39')],_0xd8b257[_0x7796('0x3e')]);_0x12caea[_0x7796('0x3f')]=_[_0x7796('0x3d')](_0xd8b257[_0x7796('0x39')],qs[_0x7796('0x40')](_0xce7607[_0x7796('0x3e')][_0x7796('0x40')]));_0x12caea[_0x7796('0x3f')]=_0x12caea[_0x7796('0x3f')]['length']?_0x12caea[_0x7796('0x3f')]:_0xd8b257[_0x7796('0x39')];if(!_0xce7607[_0x7796('0x3e')][_0x7796('0x42')](_0x7796('0x62'))){_0x12caea[_0x7796('0x2b')]=qs[_0x7796('0x2b')](_0xce7607[_0x7796('0x3e')][_0x7796('0x2b')]);_0x12caea[_0x7796('0x2a')]=qs[_0x7796('0x2a')](_0xce7607['query'][_0x7796('0x2a')]);}_0x12caea['order']=qs[_0x7796('0x43')](_0xce7607[_0x7796('0x3e')]['sort']);_0x12caea[_0x7796('0x44')]=qs['filters'](_['pick'](_0xce7607[_0x7796('0x3e')],_0xd8b257[_0x7796('0x3c')]));_0x12caea[_0x7796('0x44')][_0x7796('0x5e')]=_0x520d79['id'];if(_0xce7607[_0x7796('0x3e')][_0x7796('0x46')]){_0x12caea['where']=_[_0x7796('0x47')](_0x12caea['where'],{'$or':_[_0x7796('0x3a')](_0x12caea[_0x7796('0x3f')],function(_0x5f214d){var _0x5d9284={};_0x5d9284[_0x5f214d]={'$like':'%'+_0xce7607['query'][_0x7796('0x46')]+'%'};return _0x5d9284;})});}_0x12caea=_[_0x7796('0x47')]({},_0x12caea,_0xce7607['options']);return db[_0x7796('0xaa')][_0x7796('0x29')]({'where':_0x12caea[_0x7796('0x44')]})[_0x7796('0x1e')](function(_0x4ee071){_0x65a453['count']=_0x4ee071;if(_0xce7607['query'][_0x7796('0x4b')]){_0x12caea['include']=[{'model':db['CmContact'],'as':_0x7796('0xda'),'required':![]},{'model':db[_0x7796('0xb9')],'as':'Owner','attributes':[_0x7796('0x3b'),_0x7796('0xdb'),_0x7796('0xdc')],'required':![]},{'model':db[_0x7796('0xdd')],'as':_0x7796('0xde'),'attributes':['id',_0x7796('0x3b'),'color'],'where':_0xce7607['query']['tag']?{'id':_0xce7607[_0x7796('0x3e')][_0x7796('0xdf')]}:undefined,'required':_0xce7607[_0x7796('0x3e')][_0x7796('0xdf')]?!![]:![]}];}return db[_0x7796('0xaa')][_0x7796('0x4d')](_0x12caea);})[_0x7796('0x1e')](function(_0x1ebfeb){_0x65a453['rows']=_0x1ebfeb;return _0x65a453;});}})[_0x7796('0x1e')](respondWithFilteredResult(_0x21ed33,_0x12caea))[_0x7796('0x25')](handleError(_0x21ed33,null));};function iftimePromise(_0x426ea4,_0xbe911d){return respondWithRpcPromise(_0x7796('0xe0'),_0x7796('0xe1'),{'command':_0xbe911d[_0x7796('0xe2')]?util[_0x7796('0xa2')](_0x7796('0xe3'),_0x426ea4[_0x7796('0xe4')],_0xbe911d[_0x7796('0xe2')]):util[_0x7796('0xa2')](_0x7796('0xe5'),_0x426ea4[_0x7796('0xe4')])},client9002)[_0x7796('0x1e')](function(_0x2a831c){var _0x5c64f0=_0x2a831c&&_0x2a831c[_0x7796('0xe6')]('true')>=0x0?!![]:![];logger[_0x7796('0x1f')]('[%s][INTERVAL][%s]\x20%s\x20%s\x20(%s)',_0xbe911d['id'],_0x426ea4['id'],_0x426ea4[_0x7796('0xe4')],_0x5c64f0?_0x7796('0xe7'):'OFFLINE',_0xbe911d['timezone']?_0xbe911d[_0x7796('0xe2')]:_0x7796('0xe8'));return _0x5c64f0;})['catch'](function(_0x3c1f3c){logger[_0x7796('0x21')](_0x7796('0xe9'),_0xbe911d['id'],_0x426ea4['id'],_0x426ea4['interval'],util[_0x7796('0xea')](_0x3c1f3c,{'showHidden':![],'depth':null}),_0xbe911d[_0x7796('0xe2')]?_0xbe911d['timezone']:_0x7796('0xe8'));return![];});}exports[_0x7796('0xe1')]=function(_0x538d2d,_0x3c8b72,_0xd9470e){var _0x55090d=0x0;var _0x3f292a=0x0;var _0xf22192=![];var _0xb84005;var _0x802e0;return db[_0x7796('0x4a')][_0x7796('0x52')]({'where':{'id':_0x538d2d[_0x7796('0x5c')]['id']},'include':[{'model':db[_0x7796('0xeb')],'as':'Interval','include':[{'model':db[_0x7796('0xeb')],'as':_0x7796('0xec'),'attributes':['id','interval'],'raw':!![]}]}]})[_0x7796('0x1e')](handleEntityNotFound(_0x3c8b72,null))[_0x7796('0x1e')](function(_0x1bd7d1){if(_0x1bd7d1){_0xb84005=_0x1bd7d1;return _0x1bd7d1['getProactiveActions']({'raw':!![]});}})[_0x7796('0x1e')](function(_0x52a601){if(_0xb84005){if(_0x52a601){_0x802e0=_0x52a601;}}return require(_0x7796('0xed'))[_0x7796('0x72')]();})[_0x7796('0x1e')](function(_0x3702c0){if(_0x3702c0){_0x3f292a=_0x3702c0[_0x7796('0xee')];_0xf22192=_0x3702c0[_0x7796('0xef')];}})[_0x7796('0x1e')](function(){return db[_0x7796('0xaa')][_0x7796('0x29')]({'where':{'closed':![]}});})[_0x7796('0x1e')](function(_0x1474f6){_0x55090d=_0x1474f6;if(_0x3f292a&&_0x1474f6>_0x3f292a){return db[_0x7796('0xf0')]['findOne']({'where':{'id':0x1}})[_0x7796('0x1e')](function(_0x41352e){if(_0x41352e){_0x41352e['increment'](_0x7796('0xf1'));}});}})[_0x7796('0x1e')](function(){if(_0xb84005[_0x7796('0xeb')]&&_0xb84005[_0x7796('0xeb')]['Intervals']){var _0x141662=[];for(var _0x195d3a=0x0;_0x195d3a<_0xb84005[_0x7796('0xeb')]['Intervals'][_0x7796('0x41')];_0x195d3a++){var _0x4e0fd6=_0xb84005[_0x7796('0xeb')][_0x7796('0xec')][_0x195d3a][_0x7796('0x2e')]({'plain':!![]});_0x141662[_0x7796('0xb3')](iftimePromise(_0x4e0fd6,_0xb84005));}return BPromise[_0x7796('0xf2')](_0x141662)[_0x7796('0x1e')](function(_0x2cd7b8){return _[_0x7796('0xf3')](_0x2cd7b8);});}else{return!![];}})[_0x7796('0x1e')](function(_0x40c6d8){var _0x500924=fs[_0x7796('0xc5')](path[_0x7796('0x6f')](config[_0x7796('0x70')],_0x7796('0xf4')),'utf8');var _0x6f8b5b={'remote':_0xb84005[_0x7796('0xf5')],'query':querystring['stringify'](_[_0x7796('0x47')](_0xb84005[_0x7796('0x2e')]({'plain':!![]}),{'customerIp':_0x538d2d[_0x7796('0x7f')]['x-forwarded-for']||_0x538d2d[_0x7796('0x7f')]['x-real-ip']||_0x538d2d['connection'][_0x7796('0xf6')]||_0x538d2d['ip'],'referer':_0x538d2d['headers']['referer'],'openedInteractions':_0x55090d,'maxInteractions':_0x3f292a,'virtual':_0xf22192[_0x7796('0xee')],'online':_0x40c6d8,'custom':_0xf22192}))['replace'](/'/g,'\x5c\x27')};_0x3c8b72['send'](ejs[_0x7796('0xc8')](Mustache[_0x7796('0xc8')](_0x500924,_0x6f8b5b),{'proactiveActions':_0x802e0,'alignment':_0xb84005['alignment'],'verticalAlignment':_0xb84005[_0x7796('0xf7')],'div_color':_0xb84005[_0x7796('0xf8')],'text_color':_0xb84005[_0x7796('0xf9')]}));})[_0x7796('0x25')](handleError(_0x3c8b72,null));};exports[_0x7796('0xfa')]=function(_0x4fa41b,_0x392d23,_0x251fbf){return db[_0x7796('0x4a')][_0x7796('0x61')]({'where':{'id':_0x4fa41b[_0x7796('0x5c')]['id']}})['then'](handleEntityNotFound(_0x392d23,null))[_0x7796('0x1e')](function(_0x8b45f4){if(_0x8b45f4){return db[_0x7796('0xfb')][_0x7796('0xfc')](function(_0x3a50e1){return db[_0x7796('0x91')][_0x7796('0x2d')]({'where':{'ChatWebsiteId':_0x4fa41b[_0x7796('0x5c')]['id']},'transaction':_0x3a50e1})[_0x7796('0x1e')](function(_0x3c8628){var _0x4438ec=_['map'](_0x4fa41b[_0x7796('0x5b')],function(_0x4b48b5){_0x4b48b5[_0x7796('0x5e')]=_0x4fa41b[_0x7796('0x5c')]['id'];return _0x4b48b5;});return db[_0x7796('0x91')][_0x7796('0xfd')](_0x4438ec,{'transaction':_0x3a50e1});});})[_0x7796('0x1e')](function(){return db[_0x7796('0x91')][_0x7796('0xfe')]({'where':{'ChatWebsiteId':_0x4fa41b['params']['id']},'order':_0x7796('0xff')});});}})['then'](respondWithResult(_0x392d23,null))[_0x7796('0x25')](handleError(_0x392d23,null));};exports['getApplications']=function(_0x39080e,_0x3f20a2,_0x415fda){var _0x51f1e3={};var _0x5af9ea={};var _0x427461;var _0x241077;return db[_0x7796('0x4a')]['findOne']({'where':{'id':_0x39080e['params']['id']}})['then'](handleEntityNotFound(_0x3f20a2,null))[_0x7796('0x1e')](function(_0x30f7f8){if(_0x30f7f8){_0x427461=_0x30f7f8;_0x5af9ea[_0x7796('0x39')]=_[_0x7796('0x51')](db['ChatApplication']['rawAttributes']);_0x5af9ea['query']=_['keys'](_0x39080e[_0x7796('0x3e')]);_0x5af9ea[_0x7796('0x3c')]=_['intersection'](_0x5af9ea[_0x7796('0x39')],_0x5af9ea[_0x7796('0x3e')]);_0x51f1e3['attributes']=_['intersection'](_0x5af9ea[_0x7796('0x39')],qs[_0x7796('0x40')](_0x39080e['query']['fields']));_0x51f1e3[_0x7796('0x3f')]=_0x51f1e3[_0x7796('0x3f')]['length']?_0x51f1e3[_0x7796('0x3f')]:_0x5af9ea[_0x7796('0x39')];_0x51f1e3[_0x7796('0x63')]=qs[_0x7796('0x43')](_0x39080e[_0x7796('0x3e')][_0x7796('0x43')]);_0x51f1e3[_0x7796('0x44')]=qs[_0x7796('0x3c')](_['pick'](_0x39080e[_0x7796('0x3e')],_0x5af9ea[_0x7796('0x3c')]));if(_0x39080e['query'][_0x7796('0x46')]){_0x51f1e3['where']=_['merge'](_0x51f1e3[_0x7796('0x44')],{'$or':_[_0x7796('0x3a')](_0x51f1e3[_0x7796('0x3f')],function(_0x18c7ab){var _0x112656={};_0x112656[_0x18c7ab]={'$like':'%'+_0x39080e[_0x7796('0x3e')][_0x7796('0x46')]+'%'};return _0x112656;})});}_0x51f1e3=_['merge']({},_0x51f1e3,_0x39080e[_0x7796('0x49')]);return _0x427461['getApplications'](_0x51f1e3);}})[_0x7796('0x1e')](function(_0x1796c6){if(_0x1796c6){_0x241077=_0x1796c6[_0x7796('0x41')];if(!_0x39080e['query'][_0x7796('0x42')](_0x7796('0x62'))){_0x51f1e3[_0x7796('0x2b')]=qs[_0x7796('0x2b')](_0x39080e['query'][_0x7796('0x2b')]);_0x51f1e3[_0x7796('0x2a')]=qs['offset'](_0x39080e['query'][_0x7796('0x2a')]);}return _0x427461[_0x7796('0x100')](_0x51f1e3);}})[_0x7796('0x1e')](function(_0x1935a0){if(_0x1935a0){return _0x1935a0?{'count':_0x241077,'rows':_0x1935a0}:null;}})[_0x7796('0x1e')](respondWithResult(_0x3f20a2,null))[_0x7796('0x25')](handleError(_0x3f20a2,null));};exports['addProactiveActions']=function(_0x3722e1,_0x5cee7e,_0x1898a2){return db[_0x7796('0x101')][_0x7796('0x52')]({'where':{'id':_0x3722e1[_0x7796('0x5c')]['id']}})[_0x7796('0x1e')](handleEntityNotFound(_0x5cee7e,null))[_0x7796('0x1e')](function(_0xecc749){if(_0xecc749){return _0xecc749[_0x7796('0x102')](_0x3722e1[_0x7796('0x5b')][_0x7796('0x65')],_[_0x7796('0x103')](_0x3722e1['body'],[_0x7796('0x65'),'id'])||{});}})['then'](respondWithResult(_0x5cee7e,null))['catch'](handleError(_0x5cee7e,null));};exports[_0x7796('0x104')]=function(_0x37d53b,_0x29adb6,_0x32b239){var _0x346dae={};var _0x37f8ca={};var _0x12c1bf;var _0x142b7a;return db[_0x7796('0x4a')][_0x7796('0x61')]({'where':{'id':_0x37d53b[_0x7796('0x5c')]['id']}})[_0x7796('0x1e')](handleEntityNotFound(_0x29adb6,null))[_0x7796('0x1e')](function(_0x62bc4){if(_0x62bc4){_0x12c1bf=_0x62bc4;_0x37f8ca[_0x7796('0x39')]=_[_0x7796('0x51')](db['ChatProactiveAction'][_0x7796('0x35')]);_0x37f8ca['query']=_[_0x7796('0x51')](_0x37d53b[_0x7796('0x3e')]);_0x37f8ca['filters']=_['intersection'](_0x37f8ca['model'],_0x37f8ca[_0x7796('0x3e')]);_0x346dae['attributes']=_['intersection'](_0x37f8ca[_0x7796('0x39')],qs[_0x7796('0x40')](_0x37d53b[_0x7796('0x3e')][_0x7796('0x40')]));_0x346dae['attributes']=_0x346dae[_0x7796('0x3f')][_0x7796('0x41')]?_0x346dae[_0x7796('0x3f')]:_0x37f8ca[_0x7796('0x39')];_0x346dae[_0x7796('0x63')]=qs[_0x7796('0x43')](_0x37d53b[_0x7796('0x3e')]['sort']);_0x346dae['where']=qs[_0x7796('0x3c')](_[_0x7796('0x45')](_0x37d53b[_0x7796('0x3e')],_0x37f8ca[_0x7796('0x3c')]));if(_0x37d53b[_0x7796('0x3e')][_0x7796('0x46')]){_0x346dae[_0x7796('0x44')]=_[_0x7796('0x47')](_0x346dae[_0x7796('0x44')],{'$or':_[_0x7796('0x3a')](_0x346dae[_0x7796('0x3f')],function(_0x12668f){var _0x4ec5a2={};_0x4ec5a2[_0x12668f]={'$like':'%'+_0x37d53b[_0x7796('0x3e')][_0x7796('0x46')]+'%'};return _0x4ec5a2;})});}_0x346dae=_[_0x7796('0x47')]({},_0x346dae,_0x37d53b[_0x7796('0x49')]);return _0x12c1bf['getProactiveActions'](_0x346dae);}})[_0x7796('0x1e')](function(_0x41dd50){if(_0x41dd50){_0x142b7a=_0x41dd50[_0x7796('0x41')];if(!_0x37d53b['query'][_0x7796('0x42')](_0x7796('0x62'))){_0x346dae['limit']=qs[_0x7796('0x2b')](_0x37d53b['query'][_0x7796('0x2b')]);_0x346dae[_0x7796('0x2a')]=qs[_0x7796('0x2a')](_0x37d53b[_0x7796('0x3e')]['offset']);}return _0x12c1bf['getProactiveActions'](_0x346dae);}})['then'](function(_0x353ef0){if(_0x353ef0){return _0x353ef0?{'count':_0x142b7a,'rows':_0x353ef0}:null;}})[_0x7796('0x1e')](respondWithResult(_0x29adb6,null))[_0x7796('0x25')](handleError(_0x29adb6,null));};exports[_0x7796('0x105')]=function(_0x2c4a8c,_0x2da61b,_0x423583){var _0x41a97f=_0x2c4a8c[_0x7796('0x3e')][_0x7796('0x106')]===_0x7796('0x107')?_0x7796('0x108'):_0x7796('0x109');return db[_0x7796('0x4a')][_0x7796('0x52')]({'attributes':['id',_0x41a97f],'where':{'id':_0x2c4a8c['params']['id']}})[_0x7796('0x1e')](handleEntityNotFound(_0x2da61b,null))['then'](function(_0x2cb73e){if(_0x2cb73e){var _0x2e02ee=_0x2cb73e[_0x41a97f];var _0x17ce00=_0x2e02ee&&_0x2e02ee[_0x7796('0x10a')]?_0x2e02ee['items']:[];_0x2da61b[_0x7796('0x32')]({'fromKey':_[_0x7796('0x73')](_0x2e02ee[_0x7796('0x10b')])?undefined:_0x2e02ee[_0x7796('0x10b')],'count':_0x17ce00['length'],'rows':_0x17ce00});}})['catch'](handleError(_0x2da61b,null));};exports[_0x7796('0x10c')]=function(_0x5e32e3,_0x27be73,_0x343898){var _0xe2f42={'raw':![],'where':{}};var _0x3e7cd9={};var _0x2588b7={'count':0x0,'rows':[]};return db[_0x7796('0x4a')][_0x7796('0x61')]({'where':{'id':_0x5e32e3['params']['id']}})[_0x7796('0x1e')](handleEntityNotFound(_0x27be73,null))['then'](function(_0x23abf2){if(_0x23abf2){_0x3e7cd9[_0x7796('0x39')]=_[_0x7796('0x51')](db[_0x7796('0xcb')][_0x7796('0x35')]);_0x3e7cd9['query']=_[_0x7796('0x51')](_0x5e32e3[_0x7796('0x3e')]);_0x3e7cd9[_0x7796('0x3c')]=_['intersection'](_0x3e7cd9[_0x7796('0x39')],_0x3e7cd9[_0x7796('0x3e')]);_0xe2f42['attributes']=_[_0x7796('0x3d')](_0x3e7cd9[_0x7796('0x39')],qs[_0x7796('0x40')](_0x5e32e3[_0x7796('0x3e')][_0x7796('0x40')]));_0xe2f42['attributes']=_0xe2f42['attributes'][_0x7796('0x41')]?_0xe2f42[_0x7796('0x3f')]:_0x3e7cd9[_0x7796('0x39')];if(!_0x5e32e3['query'][_0x7796('0x42')](_0x7796('0x62'))){_0xe2f42[_0x7796('0x2b')]=qs[_0x7796('0x2b')](_0x5e32e3[_0x7796('0x3e')]['limit']);_0xe2f42[_0x7796('0x2a')]=qs['offset'](_0x5e32e3[_0x7796('0x3e')][_0x7796('0x2a')]);}_0xe2f42['order']=qs['sort'](_0x5e32e3[_0x7796('0x3e')][_0x7796('0x43')]);_0xe2f42[_0x7796('0x44')]=qs[_0x7796('0x3c')](_[_0x7796('0x45')](_0x5e32e3[_0x7796('0x3e')],_0x3e7cd9[_0x7796('0x3c')]));_0xe2f42['where'][_0x7796('0x5e')]=_0x23abf2['id'];if(_0x5e32e3[_0x7796('0x3e')][_0x7796('0x46')]){_0xe2f42['where']=_[_0x7796('0x47')](_0xe2f42['where'],{'$or':_['map'](_0xe2f42[_0x7796('0x3f')],function(_0x417776){var _0x3ae3ff={};_0x3ae3ff[_0x417776]={'$like':'%'+_0x5e32e3[_0x7796('0x3e')][_0x7796('0x46')]+'%'};return _0x3ae3ff;})});}_0xe2f42=_[_0x7796('0x47')]({},_0xe2f42,_0x5e32e3['options']);return db[_0x7796('0xcb')]['count']({'where':_0xe2f42['where']})['then'](function(_0x2eecd2){_0x2588b7[_0x7796('0x29')]=_0x2eecd2;if(_0x5e32e3['query'][_0x7796('0x4b')]){_0xe2f42[_0x7796('0x4c')]=[{'all':!![]}];}else{_0xe2f42[_0x7796('0x4c')]=[{'model':db[_0x7796('0x83')],'as':_0x7796('0xda'),'required':![]}];}return db['ChatOfflineMessage'][_0x7796('0x4d')](_0xe2f42);})[_0x7796('0x1e')](function(_0x115d7c){_0x2588b7[_0x7796('0x4e')]=_0x115d7c;return _0x2588b7;});}})['then'](respondWithFilteredResult(_0x27be73,_0xe2f42))[_0x7796('0x25')](handleError(_0x27be73,null));};exports['addAgents']=function(_0x56158b,_0x459ef0,_0xc831ea){return db[_0x7796('0x4a')][_0x7796('0x52')]({'where':{'id':_0x56158b['params']['id']}})[_0x7796('0x1e')](handleEntityNotFound(_0x459ef0,null))[_0x7796('0x1e')](function(_0x344b3c){if(_0x344b3c){return _0x344b3c[_0x7796('0x10d')](_0x56158b[_0x7796('0x5b')][_0x7796('0x65')],_[_0x7796('0x103')](_0x56158b[_0x7796('0x5b')],[_0x7796('0x65'),'id'])||{})[_0x7796('0xae')](function(_0x15919f){for(var _0x4b1fc2=0x0;_0x4b1fc2<_0x56158b[_0x7796('0x5b')]['ids'][_0x7796('0x41')];_0x4b1fc2+=0x1){socket['emit'](_0x7796('0x10e'),{'UserId':_0x56158b[_0x7796('0x5b')][_0x7796('0x65')][_0x4b1fc2],'ChatWebsiteId':_0x56158b['params']['id']});}return _0x15919f;});}})['then'](respondWithResult(_0x459ef0,null))['catch'](handleError(_0x459ef0,null));};exports['removeAgents']=function(_0x126737,_0x9ca2c7,_0x38bada){return db['ChatWebsite'][_0x7796('0x52')]({'where':{'id':_0x126737[_0x7796('0x5c')]['id']}})['then'](handleEntityNotFound(_0x9ca2c7,null))['then'](function(_0x21cecf){if(_0x21cecf){return _0x21cecf['removeAgents'](_0x126737['query']['ids'])[_0x7796('0x1e')](function(){if(_[_0x7796('0x10f')](_0x126737['query'][_0x7796('0x65')])){for(var _0x5a1f01=0x0;_0x5a1f01<_0x126737['query'][_0x7796('0x65')]['length'];_0x5a1f01+=0x1){socket[_0x7796('0x110')](_0x7796('0x111'),{'UserId':Number(_0x126737['query'][_0x7796('0x65')][_0x5a1f01]),'ChatWebsiteId':Number(_0x126737[_0x7796('0x5c')]['id'])});}}else{socket[_0x7796('0x110')](_0x7796('0x111'),{'UserId':Number(_0x126737['query'][_0x7796('0x65')]),'ChatWebsiteId':Number(_0x126737[_0x7796('0x5c')]['id'])});}});}})['then'](respondWithStatusCode(_0x9ca2c7,null))[_0x7796('0x25')](handleError(_0x9ca2c7,null));};exports[_0x7796('0x112')]=function(_0x5156ef,_0x4d5faf,_0x3f2160){var _0x1c06b5={};var _0x5516b3={};var _0x51d9c1;var _0x258e78;return db['ChatWebsite'][_0x7796('0x61')]({'where':{'id':_0x5156ef['params']['id']}})[_0x7796('0x1e')](handleEntityNotFound(_0x4d5faf,null))[_0x7796('0x1e')](function(_0x5dfd5c){if(_0x5dfd5c){_0x51d9c1=_0x5dfd5c;_0x5516b3[_0x7796('0x39')]=_[_0x7796('0x51')](db[_0x7796('0xb9')]['rawAttributes']);_0x5516b3[_0x7796('0x3e')]=_[_0x7796('0x51')](_0x5156ef[_0x7796('0x3e')]);_0x5516b3[_0x7796('0x3c')]=_[_0x7796('0x3d')](_0x5516b3['model'],_0x5516b3[_0x7796('0x3e')]);_0x1c06b5[_0x7796('0x3f')]=_[_0x7796('0x3d')](_0x5516b3[_0x7796('0x39')],qs[_0x7796('0x40')](_0x5156ef[_0x7796('0x3e')][_0x7796('0x40')]));_0x1c06b5[_0x7796('0x3f')]=_0x1c06b5[_0x7796('0x3f')][_0x7796('0x41')]?_0x1c06b5[_0x7796('0x3f')]:_0x5516b3[_0x7796('0x39')];_0x1c06b5['order']=qs[_0x7796('0x43')](_0x5156ef[_0x7796('0x3e')][_0x7796('0x43')]);_0x1c06b5['where']=qs[_0x7796('0x3c')](_[_0x7796('0x45')](_0x5156ef[_0x7796('0x3e')],_0x5516b3[_0x7796('0x3c')]));if(_0x5156ef[_0x7796('0x3e')][_0x7796('0x46')]){_0x1c06b5[_0x7796('0x44')]=_[_0x7796('0x47')](_0x1c06b5[_0x7796('0x44')],{'$or':_[_0x7796('0x3a')](_0x1c06b5[_0x7796('0x3f')],function(_0x16f078){var _0x170245={};_0x170245[_0x16f078]={'$like':'%'+_0x5156ef[_0x7796('0x3e')][_0x7796('0x46')]+'%'};return _0x170245;})});}_0x1c06b5=_[_0x7796('0x47')]({},_0x1c06b5,_0x5156ef['options']);return _0x51d9c1[_0x7796('0x112')](_0x1c06b5);}})[_0x7796('0x1e')](function(_0x659ba9){if(_0x659ba9){_0x258e78=_0x659ba9[_0x7796('0x41')];if(!_0x5156ef['query'][_0x7796('0x42')](_0x7796('0x62'))){_0x1c06b5[_0x7796('0x2b')]=qs['limit'](_0x5156ef[_0x7796('0x3e')][_0x7796('0x2b')]);_0x1c06b5[_0x7796('0x2a')]=qs[_0x7796('0x2a')](_0x5156ef[_0x7796('0x3e')]['offset']);}return _0x51d9c1[_0x7796('0x112')](_0x1c06b5);}})['then'](function(_0x3270e6){if(_0x3270e6){return _0x3270e6?{'count':_0x258e78,'rows':_0x3270e6}:null;}})[_0x7796('0x1e')](respondWithResult(_0x4d5faf,null))[_0x7796('0x25')](handleError(_0x4d5faf,null));}; \ No newline at end of file diff --git a/server/api/chatWebsite/chatWebsite.events.js b/server/api/chatWebsite/chatWebsite.events.js index 190daac..65d6ad2 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 _0xdcf0=['events','../../mysqldb','setMaxListeners','save','remove','emit','hasOwnProperty','exports'];(function(_0x3843e8,_0x4eb657){var _0x30071d=function(_0x3ac1e8){while(--_0x3ac1e8){_0x3843e8['push'](_0x3843e8['shift']());}};_0x30071d(++_0x4eb657);}(_0xdcf0,0xb8));var _0x0dcf=function(_0x141461,_0x36f376){_0x141461=_0x141461-0x0;var _0x30a5a0=_0xdcf0[_0x141461];return _0x30a5a0;};'use strict';var EventEmitter=require(_0x0dcf('0x0'));var ChatWebsite=require(_0x0dcf('0x1'))['db']['ChatWebsite'];var ChatWebsiteEvents=new EventEmitter();ChatWebsiteEvents[_0x0dcf('0x2')](0x0);var events={'afterCreate':_0x0dcf('0x3'),'afterUpdate':'update','afterDestroy':_0x0dcf('0x4')};function emitEvent(_0x4d0371){return function(_0x4b1323,_0x388fc3,_0x1092bf){ChatWebsiteEvents[_0x0dcf('0x5')](_0x4d0371+':'+_0x4b1323['id'],_0x4b1323);ChatWebsiteEvents[_0x0dcf('0x5')](_0x4d0371,_0x4b1323);_0x1092bf(null);};}for(var e in events){if(events[_0x0dcf('0x6')](e)){var event=events[e];ChatWebsite['hook'](e,emitEvent(event));}}module[_0x0dcf('0x7')]=ChatWebsiteEvents; \ No newline at end of file +var _0x4350=['emit','hasOwnProperty','events','../../mysqldb','setMaxListeners','update','remove'];(function(_0x5f712,_0x1e26c1){var _0x62f147=function(_0x48434f){while(--_0x48434f){_0x5f712['push'](_0x5f712['shift']());}};_0x62f147(++_0x1e26c1);}(_0x4350,0x1d0));var _0x0435=function(_0x5ea418,_0x4748cf){_0x5ea418=_0x5ea418-0x0;var _0x1fb243=_0x4350[_0x5ea418];return _0x1fb243;};'use strict';var EventEmitter=require(_0x0435('0x0'));var ChatWebsite=require(_0x0435('0x1'))['db']['ChatWebsite'];var ChatWebsiteEvents=new EventEmitter();ChatWebsiteEvents[_0x0435('0x2')](0x0);var events={'afterCreate':'save','afterUpdate':_0x0435('0x3'),'afterDestroy':_0x0435('0x4')};function emitEvent(_0x517d8d){return function(_0x247a54,_0xd41628,_0x2dcbfe){ChatWebsiteEvents[_0x0435('0x5')](_0x517d8d+':'+_0x247a54['id'],_0x247a54);ChatWebsiteEvents['emit'](_0x517d8d,_0x247a54);_0x2dcbfe(null);};}for(var e in events){if(events[_0x0435('0x6')](e)){var event=events[e];ChatWebsite['hook'](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 a98ddf5..f4a69ee 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 _0xbee3=['define','ChatWebsite','chat_websites','util','moment','bluebird','path','rimraf','../../config/environment','exports'];(function(_0x2b7764,_0x2606f1){var _0x848dcb=function(_0x1ae85b){while(--_0x1ae85b){_0x2b7764['push'](_0x2b7764['shift']());}};_0x848dcb(++_0x2606f1);}(_0xbee3,0xd5));var _0x3bee=function(_0x4c5f64,_0x521a26){_0x4c5f64=_0x4c5f64-0x0;var _0x1264f5=_0xbee3[_0x4c5f64];return _0x1264f5;};'use strict';var _=require('lodash');var util=require(_0x3bee('0x0'));var logger=require('../../config/logger')('api');var moment=require(_0x3bee('0x1'));var BPromise=require(_0x3bee('0x2'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x3bee('0x3'));var rimraf=require(_0x3bee('0x4'));var config=require(_0x3bee('0x5'));var attributes=require('./chatWebsite.attributes');module[_0x3bee('0x6')]=function(_0x3baf77,_0x4c5ef5){return _0x3baf77[_0x3bee('0x7')](_0x3bee('0x8'),attributes,{'tableName':_0x3bee('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xd52d=['../../config/environment','./chatWebsite.attributes','exports','define','chat_websites','util','../../config/logger','moment','path','rimraf'];(function(_0x178d95,_0x5880c1){var _0x55688c=function(_0x481551){while(--_0x481551){_0x178d95['push'](_0x178d95['shift']());}};_0x55688c(++_0x5880c1);}(_0xd52d,0x1c7));var _0xdd52=function(_0x3c0f49,_0x384f92){_0x3c0f49=_0x3c0f49-0x0;var _0x4e5c1d=_0xd52d[_0x3c0f49];return _0x4e5c1d;};'use strict';var _=require('lodash');var util=require(_0xdd52('0x0'));var logger=require(_0xdd52('0x1'))('api');var moment=require(_0xdd52('0x2'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0xdd52('0x3'));var rimraf=require(_0xdd52('0x4'));var config=require(_0xdd52('0x5'));var attributes=require(_0xdd52('0x6'));module[_0xdd52('0x7')]=function(_0x3b56e5,_0x319c4a){return _0x3b56e5[_0xdd52('0x8')]('ChatWebsite',attributes,{'tableName':_0xdd52('0x9'),'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 75c45c3..3264728 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 _0x1967=['../../config/utils','../../config/logger','rpc','../../config/environment','client','http','redis','defaults','localhost','./chatWebsite.socket','register','request','then','info','ChatWebsite,\x20%s,\x20%s','request\x20sent','debug','ChatWebsite,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','util','moment','bluebird','randomstring','ioredis','../../mysqldb'];(function(_0x47c2b5,_0x3168e0){var _0x536d90=function(_0x4bad23){while(--_0x4bad23){_0x47c2b5['push'](_0x47c2b5['shift']());}};_0x536d90(++_0x3168e0);}(_0x1967,0x173));var _0x7196=function(_0x577f24,_0x59d4f9){_0x577f24=_0x577f24-0x0;var _0x44661f=_0x1967[_0x577f24];return _0x44661f;};'use strict';var _=require('lodash');var util=require(_0x7196('0x0'));var moment=require(_0x7196('0x1'));var BPromise=require(_0x7196('0x2'));var rs=require(_0x7196('0x3'));var fs=require('fs');var Redis=require(_0x7196('0x4'));var db=require(_0x7196('0x5'))['db'];var utils=require(_0x7196('0x6'));var logger=require(_0x7196('0x7'))(_0x7196('0x8'));var config=require(_0x7196('0x9'));var jayson=require('jayson/promise');var client=jayson[_0x7196('0xa')][_0x7196('0xb')]({'port':0x232a});config[_0x7196('0xc')]=_[_0x7196('0xd')](config[_0x7196('0xc')],{'host':_0x7196('0xe'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x7196('0xc')]));require(_0x7196('0xf'))[_0x7196('0x10')](socket);function respondWithRpcPromise(_0x259b18,_0x1e862d,_0x503070){return new BPromise(function(_0x49e5fb,_0x2028dd){return client[_0x7196('0x11')](_0x259b18,_0x503070)[_0x7196('0x12')](function(_0x107759){logger[_0x7196('0x13')](_0x7196('0x14'),_0x1e862d,_0x7196('0x15'));logger[_0x7196('0x16')](_0x7196('0x17'),_0x1e862d,_0x7196('0x15'),JSON[_0x7196('0x18')](_0x107759));if(_0x107759['error']){if(_0x107759[_0x7196('0x19')][_0x7196('0x1a')]===0x1f4){logger[_0x7196('0x19')](_0x7196('0x14'),_0x1e862d,_0x107759['error'][_0x7196('0x1b')]);return _0x2028dd(_0x107759['error'][_0x7196('0x1b')]);}logger[_0x7196('0x19')](_0x7196('0x14'),_0x1e862d,_0x107759[_0x7196('0x19')][_0x7196('0x1b')]);return _0x49e5fb(_0x107759[_0x7196('0x19')][_0x7196('0x1b')]);}else{logger[_0x7196('0x13')](_0x7196('0x14'),_0x1e862d,_0x7196('0x15'));_0x49e5fb(_0x107759[_0x7196('0x1c')]['message']);}})['catch'](function(_0x448f13){logger[_0x7196('0x19')](_0x7196('0x14'),_0x1e862d,_0x448f13);_0x2028dd(_0x448f13);});});} \ No newline at end of file +var _0xba34=['then','ChatWebsite,\x20%s,\x20%s','debug','request\x20sent','stringify','error','code','message','info','result','catch','lodash','util','moment','bluebird','randomstring','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','localhost','socket.io-emitter','./chatWebsite.socket','register'];(function(_0x2e3bb5,_0x44ed97){var _0x5ead58=function(_0x5b6b2e){while(--_0x5b6b2e){_0x2e3bb5['push'](_0x2e3bb5['shift']());}};_0x5ead58(++_0x44ed97);}(_0xba34,0x119));var _0x4ba3=function(_0x7847cd,_0x1487a6){_0x7847cd=_0x7847cd-0x0;var _0x1a56eb=_0xba34[_0x7847cd];return _0x1a56eb;};'use strict';var _=require(_0x4ba3('0x0'));var util=require(_0x4ba3('0x1'));var moment=require(_0x4ba3('0x2'));var BPromise=require(_0x4ba3('0x3'));var rs=require(_0x4ba3('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x4ba3('0x5'))(_0x4ba3('0x6'));var config=require(_0x4ba3('0x7'));var jayson=require(_0x4ba3('0x8'));var client=jayson[_0x4ba3('0x9')][_0x4ba3('0xa')]({'port':0x232a});config[_0x4ba3('0xb')]=_['defaults'](config[_0x4ba3('0xb')],{'host':_0x4ba3('0xc'),'port':0x18eb});var socket=require(_0x4ba3('0xd'))(new Redis(config[_0x4ba3('0xb')]));require(_0x4ba3('0xe'))[_0x4ba3('0xf')](socket);function respondWithRpcPromise(_0x292f58,_0x3f653c,_0x2ed106){return new BPromise(function(_0x14ebf2,_0x2d215b){return client['request'](_0x292f58,_0x2ed106)[_0x4ba3('0x10')](function(_0x9071){logger['info'](_0x4ba3('0x11'),_0x3f653c,'request\x20sent');logger[_0x4ba3('0x12')]('ChatWebsite,\x20%s,\x20%s,\x20%s',_0x3f653c,_0x4ba3('0x13'),JSON[_0x4ba3('0x14')](_0x9071));if(_0x9071[_0x4ba3('0x15')]){if(_0x9071[_0x4ba3('0x15')][_0x4ba3('0x16')]===0x1f4){logger[_0x4ba3('0x15')](_0x4ba3('0x11'),_0x3f653c,_0x9071[_0x4ba3('0x15')][_0x4ba3('0x17')]);return _0x2d215b(_0x9071[_0x4ba3('0x15')][_0x4ba3('0x17')]);}logger[_0x4ba3('0x15')](_0x4ba3('0x11'),_0x3f653c,_0x9071[_0x4ba3('0x15')][_0x4ba3('0x17')]);return _0x14ebf2(_0x9071[_0x4ba3('0x15')]['message']);}else{logger[_0x4ba3('0x18')](_0x4ba3('0x11'),_0x3f653c,_0x4ba3('0x13'));_0x14ebf2(_0x9071[_0x4ba3('0x19')]['message']);}})[_0x4ba3('0x1a')](function(_0xe4eff9){logger[_0x4ba3('0x15')](_0x4ba3('0x11'),_0x3f653c,_0xe4eff9);_0x2d215b(_0xe4eff9);});});} \ No newline at end of file diff --git a/server/api/chatWebsite/chatWebsite.socket.js b/server/api/chatWebsite/chatWebsite.socket.js index 7ff9bb7..2c25aeb 100644 --- a/server/api/chatWebsite/chatWebsite.socket.js +++ b/server/api/chatWebsite/chatWebsite.socket.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x5f2f=['remove','update','emit','removeListener','register','length','chatWebsite:','./chatWebsite.events','save'];(function(_0x3b3933,_0x4a5bd2){var _0x41d2c4=function(_0x4f295d){while(--_0x4f295d){_0x3b3933['push'](_0x3b3933['shift']());}};_0x41d2c4(++_0x4a5bd2);}(_0x5f2f,0x73));var _0xf5f2=function(_0x2d0a68,_0x411395){_0x2d0a68=_0x2d0a68-0x0;var _0x5b699a=_0x5f2f[_0x2d0a68];return _0x5b699a;};'use strict';var ChatWebsiteEvents=require(_0xf5f2('0x0'));var events=[_0xf5f2('0x1'),_0xf5f2('0x2'),_0xf5f2('0x3')];function createListener(_0x1172dd,_0x174bc7){return function(_0x3c72ee){_0x174bc7[_0xf5f2('0x4')](_0x1172dd,_0x3c72ee);};}function removeListener(_0x501fbd,_0x4854b6){return function(){ChatWebsiteEvents[_0xf5f2('0x5')](_0x501fbd,_0x4854b6);};}exports[_0xf5f2('0x6')]=function(_0xad7f65){for(var _0x3eebf6=0x0,_0x3133bc=events[_0xf5f2('0x7')];_0x3eebf6<_0x3133bc;_0x3eebf6++){var _0x5907aa=events[_0x3eebf6];var _0x466882=createListener(_0xf5f2('0x8')+_0x5907aa,_0xad7f65);ChatWebsiteEvents['on'](_0x5907aa,_0x466882);}}; \ No newline at end of file +var _0x5f2f=['remove','update','emit','removeListener','register','length','chatWebsite:','./chatWebsite.events','save'];(function(_0x3020ea,_0x2c71f6){var _0x2a8cc0=function(_0x16a1ec){while(--_0x16a1ec){_0x3020ea['push'](_0x3020ea['shift']());}};_0x2a8cc0(++_0x2c71f6);}(_0x5f2f,0x73));var _0xf5f2=function(_0x20017f,_0x55d6ba){_0x20017f=_0x20017f-0x0;var _0x3ac182=_0x5f2f[_0x20017f];return _0x3ac182;};'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 274abbf..c6c768c 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 _0x2a97=['removeAnswers','exports','multer','path','connect-timeout','express','Router','../../components/auth/service','../../config/environment','./chatWebsite.controller','index','get','isAuthenticated','describe','/:id','show','/:id/dispositions','getAnswers','/:id/logo','getLogo','/:id/avatar','/:id/customer_avatar','/:id/system_avatar','getSystemAvatar','/:id/interactions','getInteractions','/:id/snippet','/:id/applications','getApplications','getFields','getOfflineMessages','/:id/users','getAgents','post','create','/:id/canned_answers','addAnswer','diskStorage','join','root','server/files/images/logos/','format','%s-%s','now','single','file','addLogo','server/files/images/avatars/','originalname','addAvatar','addCustomerAvatar','addSystemAvatar','/:id/notify','notify','/:id/offline','offline','addInteraction','/:id/proactive_actions','addProactiveActions','addAgents','put','delete','destroy','removeDispositions'];(function(_0x27f7bf,_0x2d897e){var _0x30c6c4=function(_0x2beb51){while(--_0x2beb51){_0x27f7bf['push'](_0x27f7bf['shift']());}};_0x30c6c4(++_0x2d897e);}(_0x2a97,0x182));var _0x72a9=function(_0x1c494a,_0x4a4958){_0x1c494a=_0x1c494a-0x0;var _0x363086=_0x2a97[_0x1c494a];return _0x363086;};'use strict';var multer=require(_0x72a9('0x0'));var util=require('util');var path=require(_0x72a9('0x1'));var timeout=require(_0x72a9('0x2'));var express=require(_0x72a9('0x3'));var router=express[_0x72a9('0x4')]();var auth=require(_0x72a9('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x72a9('0x6'));var controller=require(_0x72a9('0x7'));router['get']('/',auth['isAuthenticated'](),controller[_0x72a9('0x8')]);router[_0x72a9('0x9')]('/describe',auth[_0x72a9('0xa')](),controller[_0x72a9('0xb')]);router[_0x72a9('0x9')](_0x72a9('0xc'),auth[_0x72a9('0xa')](),controller[_0x72a9('0xd')]);router[_0x72a9('0x9')](_0x72a9('0xe'),auth[_0x72a9('0xa')](),controller['getDispositions']);router[_0x72a9('0x9')]('/:id/canned_answers',auth[_0x72a9('0xa')](),controller[_0x72a9('0xf')]);router['get'](_0x72a9('0x10'),controller[_0x72a9('0x11')]);router[_0x72a9('0x9')](_0x72a9('0x12'),controller['getAvatar']);router[_0x72a9('0x9')](_0x72a9('0x13'),controller['getCustomerAvatar']);router['get'](_0x72a9('0x14'),controller[_0x72a9('0x15')]);router[_0x72a9('0x9')](_0x72a9('0x16'),auth['isAuthenticated'](),controller[_0x72a9('0x17')]);router[_0x72a9('0x9')](_0x72a9('0x18'),controller['getSnippet']);router['get'](_0x72a9('0x19'),auth[_0x72a9('0xa')](),controller[_0x72a9('0x1a')]);router[_0x72a9('0x9')]('/:id/proactive_actions',auth[_0x72a9('0xa')](),controller['getProactiveActions']);router[_0x72a9('0x9')]('/:id/fields',controller[_0x72a9('0x1b')]);router[_0x72a9('0x9')]('/:id/offline_messages',auth[_0x72a9('0xa')](),controller[_0x72a9('0x1c')]);router[_0x72a9('0x9')](_0x72a9('0x1d'),auth[_0x72a9('0xa')](),controller[_0x72a9('0x1e')]);router[_0x72a9('0x1f')]('/',auth[_0x72a9('0xa')](),controller[_0x72a9('0x20')]);router['post']('/:id/dispositions',auth[_0x72a9('0xa')](),controller['addDisposition']);router[_0x72a9('0x1f')](_0x72a9('0x21'),auth[_0x72a9('0xa')](),controller[_0x72a9('0x22')]);var upload=multer({'storage':multer[_0x72a9('0x23')]({'destination':function(_0x290264,_0x2ac7d8,_0xab6d5){_0xab6d5(null,path[_0x72a9('0x24')](config[_0x72a9('0x25')],_0x72a9('0x26')));},'filename':function(_0x5cbb78,_0x4b83bb,_0x3c7835){_0x3c7835(null,util[_0x72a9('0x27')](_0x72a9('0x28'),Date[_0x72a9('0x29')](),_0x4b83bb['originalname']));}})});router['post'](_0x72a9('0x10'),upload[_0x72a9('0x2a')](_0x72a9('0x2b')),controller[_0x72a9('0x2c')]);var upload=multer({'storage':multer[_0x72a9('0x23')]({'destination':function(_0x45106a,_0x8e9628,_0x3ad55d){_0x3ad55d(null,path[_0x72a9('0x24')](config['root'],_0x72a9('0x2d')));},'filename':function(_0x44e3ea,_0x1407c7,_0x1aa39d){_0x1aa39d(null,util[_0x72a9('0x27')](_0x72a9('0x28'),Date[_0x72a9('0x29')](),_0x1407c7[_0x72a9('0x2e')]));}})});router[_0x72a9('0x1f')](_0x72a9('0x12'),upload['single'](_0x72a9('0x2b')),controller[_0x72a9('0x2f')]);var upload=multer({'storage':multer[_0x72a9('0x23')]({'destination':function(_0x2ba664,_0x369b32,_0x8b01a1){_0x8b01a1(null,path['join'](config[_0x72a9('0x25')],_0x72a9('0x2d')));},'filename':function(_0x16d6ba,_0x5087ae,_0x48fd6d){_0x48fd6d(null,util[_0x72a9('0x27')](_0x72a9('0x28'),Date['now'](),_0x5087ae[_0x72a9('0x2e')]));}})});router['post'](_0x72a9('0x13'),upload[_0x72a9('0x2a')](_0x72a9('0x2b')),controller[_0x72a9('0x30')]);var upload=multer({'storage':multer[_0x72a9('0x23')]({'destination':function(_0x5d0883,_0x3300f1,_0x51b6b2){_0x51b6b2(null,path[_0x72a9('0x24')](config[_0x72a9('0x25')],_0x72a9('0x2d')));},'filename':function(_0x461bee,_0x19ff42,_0x3cb21b){_0x3cb21b(null,util[_0x72a9('0x27')]('%s-%s',Date[_0x72a9('0x29')](),_0x19ff42['originalname']));}})});router['post']('/:id/system_avatar',upload[_0x72a9('0x2a')](_0x72a9('0x2b')),controller[_0x72a9('0x31')]);router[_0x72a9('0x1f')](_0x72a9('0x32'),controller[_0x72a9('0x33')]);router[_0x72a9('0x1f')](_0x72a9('0x34'),controller[_0x72a9('0x35')]);router[_0x72a9('0x1f')](_0x72a9('0x16'),auth['isAuthenticated'](),controller[_0x72a9('0x36')]);router['post']('/:id/applications',auth[_0x72a9('0xa')](),controller['addApplications']);router[_0x72a9('0x1f')](_0x72a9('0x37'),auth['isAuthenticated'](),controller[_0x72a9('0x38')]);router['post']('/:id/users',auth[_0x72a9('0xa')](),controller[_0x72a9('0x39')]);router[_0x72a9('0x3a')]('/:id',auth['isAuthenticated'](),controller['update']);router[_0x72a9('0x3b')](_0x72a9('0xc'),auth[_0x72a9('0xa')](),controller[_0x72a9('0x3c')]);router[_0x72a9('0x3b')]('/:id/dispositions',auth[_0x72a9('0xa')](),controller[_0x72a9('0x3d')]);router[_0x72a9('0x3b')](_0x72a9('0x21'),auth[_0x72a9('0xa')](),controller[_0x72a9('0x3e')]);router['delete'](_0x72a9('0x1d'),auth[_0x72a9('0xa')](),controller['removeAgents']);module[_0x72a9('0x3f')]=router; \ No newline at end of file +var _0x60aa=['getDispositions','/:id/canned_answers','getAnswers','getLogo','/:id/avatar','getAvatar','/:id/customer_avatar','/:id/system_avatar','getSystemAvatar','getInteractions','/:id/snippet','getSnippet','/:id/applications','getApplications','/:id/proactive_actions','getProactiveActions','/:id/fields','getFields','/:id/offline_messages','getOfflineMessages','/:id/users','getAgents','post','addDisposition','addAnswer','server/files/images/logos/','%s-%s','now','/:id/logo','single','addLogo','join','root','file','diskStorage','server/files/images/avatars/','format','originalname','addCustomerAvatar','addSystemAvatar','/:id/notify','/:id/offline','offline','/:id/interactions','addInteraction','addProactiveActions','addAgents','put','/:id','update','delete','destroy','removeAgents','exports','util','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','get','isAuthenticated','index','describe','show','/:id/dispositions'];(function(_0x56122e,_0x5c6033){var _0x5b2382=function(_0x2d0e9e){while(--_0x2d0e9e){_0x56122e['push'](_0x56122e['shift']());}};_0x5b2382(++_0x5c6033);}(_0x60aa,0x13e));var _0xa60a=function(_0x412124,_0x6965f){_0x412124=_0x412124-0x0;var _0x386ed4=_0x60aa[_0x412124];return _0x386ed4;};'use strict';var multer=require('multer');var util=require(_0xa60a('0x0'));var path=require('path');var timeout=require(_0xa60a('0x1'));var express=require(_0xa60a('0x2'));var router=express[_0xa60a('0x3')]();var auth=require(_0xa60a('0x4'));var interaction=require(_0xa60a('0x5'));var config=require('../../config/environment');var controller=require('./chatWebsite.controller');router[_0xa60a('0x6')]('/',auth[_0xa60a('0x7')](),controller[_0xa60a('0x8')]);router[_0xa60a('0x6')]('/describe',auth[_0xa60a('0x7')](),controller[_0xa60a('0x9')]);router['get']('/:id',auth[_0xa60a('0x7')](),controller[_0xa60a('0xa')]);router[_0xa60a('0x6')](_0xa60a('0xb'),auth[_0xa60a('0x7')](),controller[_0xa60a('0xc')]);router[_0xa60a('0x6')](_0xa60a('0xd'),auth[_0xa60a('0x7')](),controller[_0xa60a('0xe')]);router[_0xa60a('0x6')]('/:id/logo',controller[_0xa60a('0xf')]);router[_0xa60a('0x6')](_0xa60a('0x10'),controller[_0xa60a('0x11')]);router[_0xa60a('0x6')](_0xa60a('0x12'),controller['getCustomerAvatar']);router[_0xa60a('0x6')](_0xa60a('0x13'),controller[_0xa60a('0x14')]);router['get']('/:id/interactions',auth[_0xa60a('0x7')](),controller[_0xa60a('0x15')]);router['get'](_0xa60a('0x16'),controller[_0xa60a('0x17')]);router[_0xa60a('0x6')](_0xa60a('0x18'),auth[_0xa60a('0x7')](),controller[_0xa60a('0x19')]);router['get'](_0xa60a('0x1a'),auth[_0xa60a('0x7')](),controller[_0xa60a('0x1b')]);router[_0xa60a('0x6')](_0xa60a('0x1c'),controller[_0xa60a('0x1d')]);router['get'](_0xa60a('0x1e'),auth[_0xa60a('0x7')](),controller[_0xa60a('0x1f')]);router[_0xa60a('0x6')](_0xa60a('0x20'),auth[_0xa60a('0x7')](),controller[_0xa60a('0x21')]);router[_0xa60a('0x22')]('/',auth['isAuthenticated'](),controller['create']);router[_0xa60a('0x22')]('/:id/dispositions',auth['isAuthenticated'](),controller[_0xa60a('0x23')]);router[_0xa60a('0x22')](_0xa60a('0xd'),auth[_0xa60a('0x7')](),controller[_0xa60a('0x24')]);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x2a5325,_0x35b21d,_0x32de62){_0x32de62(null,path['join'](config['root'],_0xa60a('0x25')));},'filename':function(_0x56fc54,_0x3b8a86,_0x362b40){_0x362b40(null,util['format'](_0xa60a('0x26'),Date[_0xa60a('0x27')](),_0x3b8a86['originalname']));}})});router['post'](_0xa60a('0x28'),upload[_0xa60a('0x29')]('file'),controller[_0xa60a('0x2a')]);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x12fa3b,_0x31ac5b,_0x21a287){_0x21a287(null,path[_0xa60a('0x2b')](config[_0xa60a('0x2c')],'server/files/images/avatars/'));},'filename':function(_0x1cf226,_0xe6dc1a,_0x2b8f4e){_0x2b8f4e(null,util['format'](_0xa60a('0x26'),Date[_0xa60a('0x27')](),_0xe6dc1a['originalname']));}})});router[_0xa60a('0x22')](_0xa60a('0x10'),upload['single'](_0xa60a('0x2d')),controller['addAvatar']);var upload=multer({'storage':multer[_0xa60a('0x2e')]({'destination':function(_0x80ab40,_0x6c05b8,_0x3ba7e0){_0x3ba7e0(null,path[_0xa60a('0x2b')](config['root'],_0xa60a('0x2f')));},'filename':function(_0x46833d,_0x2fa604,_0x3c767a){_0x3c767a(null,util[_0xa60a('0x30')](_0xa60a('0x26'),Date['now'](),_0x2fa604[_0xa60a('0x31')]));}})});router[_0xa60a('0x22')]('/:id/customer_avatar',upload[_0xa60a('0x29')]('file'),controller[_0xa60a('0x32')]);var upload=multer({'storage':multer[_0xa60a('0x2e')]({'destination':function(_0x43a691,_0xb7889e,_0x5deaeb){_0x5deaeb(null,path[_0xa60a('0x2b')](config[_0xa60a('0x2c')],_0xa60a('0x2f')));},'filename':function(_0x4cd8a3,_0x47e94f,_0xc2eefd){_0xc2eefd(null,util[_0xa60a('0x30')]('%s-%s',Date[_0xa60a('0x27')](),_0x47e94f[_0xa60a('0x31')]));}})});router['post'](_0xa60a('0x13'),upload['single'](_0xa60a('0x2d')),controller[_0xa60a('0x33')]);router[_0xa60a('0x22')](_0xa60a('0x34'),controller['notify']);router['post'](_0xa60a('0x35'),controller[_0xa60a('0x36')]);router[_0xa60a('0x22')](_0xa60a('0x37'),auth['isAuthenticated'](),controller[_0xa60a('0x38')]);router[_0xa60a('0x22')]('/:id/applications',auth[_0xa60a('0x7')](),controller['addApplications']);router[_0xa60a('0x22')](_0xa60a('0x1a'),auth[_0xa60a('0x7')](),controller[_0xa60a('0x39')]);router[_0xa60a('0x22')](_0xa60a('0x20'),auth[_0xa60a('0x7')](),controller[_0xa60a('0x3a')]);router[_0xa60a('0x3b')](_0xa60a('0x3c'),auth['isAuthenticated'](),controller[_0xa60a('0x3d')]);router[_0xa60a('0x3e')](_0xa60a('0x3c'),auth[_0xa60a('0x7')](),controller[_0xa60a('0x3f')]);router[_0xa60a('0x3e')](_0xa60a('0xb'),auth['isAuthenticated'](),controller['removeDispositions']);router[_0xa60a('0x3e')](_0xa60a('0xd'),auth[_0xa60a('0x7')](),controller['removeAnswers']);router[_0xa60a('0x3e')]('/:id/users',auth[_0xa60a('0x7')](),controller[_0xa60a('0x40')]);module[_0xa60a('0x41')]=router; \ No newline at end of file diff --git a/server/api/cloudProvider/cloudProvider.attributes.js b/server/api/cloudProvider/cloudProvider.attributes.js index b3bc562..861c2e7 100644 --- a/server/api/cloudProvider/cloudProvider.attributes.js +++ b/server/api/cloudProvider/cloudProvider.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x5fc3=['sequelize','exports','ENUM','AmazonAWS','Google','STRING'];(function(_0x4a4f00,_0x4c65ac){var _0x3e8d79=function(_0x5a18cd){while(--_0x5a18cd){_0x4a4f00['push'](_0x4a4f00['shift']());}};_0x3e8d79(++_0x4c65ac);}(_0x5fc3,0xa8));var _0x35fc=function(_0xdd2bfa,_0x5bd304){_0xdd2bfa=_0xdd2bfa-0x0;var _0x55397e=_0x5fc3[_0xdd2bfa];return _0x55397e;};'use strict';var Sequelize=require(_0x35fc('0x0'));module[_0x35fc('0x1')]={'name':{'type':Sequelize['STRING'],'allowNull':![],'validate':{'notEmpty':!![]}},'service':{'type':Sequelize[_0x35fc('0x2')](_0x35fc('0x3'),_0x35fc('0x4')),'allowNull':![],'validate':{'notEmpty':!![]}},'data1':{'type':Sequelize[_0x35fc('0x5')]},'data2':{'type':Sequelize[_0x35fc('0x5')]}}; \ No newline at end of file +var _0xf981=['AmazonAWS','Google','sequelize','exports','STRING','ENUM'];(function(_0x101179,_0x32bd8a){var _0x493c0a=function(_0x29ef68){while(--_0x29ef68){_0x101179['push'](_0x101179['shift']());}};_0x493c0a(++_0x32bd8a);}(_0xf981,0xe6));var _0x1f98=function(_0x3d1339,_0xff6ceb){_0x3d1339=_0x3d1339-0x0;var _0x313ae8=_0xf981[_0x3d1339];return _0x313ae8;};'use strict';var Sequelize=require(_0x1f98('0x0'));module[_0x1f98('0x1')]={'name':{'type':Sequelize[_0x1f98('0x2')],'allowNull':![],'validate':{'notEmpty':!![]}},'service':{'type':Sequelize[_0x1f98('0x3')](_0x1f98('0x4'),_0x1f98('0x5')),'allowNull':![],'validate':{'notEmpty':!![]}},'data1':{'type':Sequelize[_0x1f98('0x2')]},'data2':{'type':Sequelize[_0x1f98('0x2')]}}; \ No newline at end of file diff --git a/server/api/cloudProvider/cloudProvider.controller.js b/server/api/cloudProvider/cloudProvider.controller.js index b6f5e08..35c5e4b 100644 --- a/server/api/cloudProvider/cloudProvider.controller.js +++ b/server/api/cloudProvider/cloudProvider.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x83ed=['fieldName','type','key','query','keys','filters','model','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','pick','merge','VIRTUAL','filter','include','findAll','rows','catch','show','params','includeAll','options','find','body','html-pdf','eml-format','rimraf','request-promise','moment','bluebird','util','sox','ejs','lodash','squel','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','sendStatus','status','end','json','count','offset','limit','set','Content-Range','apply','save','update','then','destroy','error','stack','name','send','index','map','CloudProvider'];(function(_0x1aa289,_0x17ef90){var _0x52300d=function(_0x1a582f){while(--_0x1a582f){_0x1aa289['push'](_0x1aa289['shift']());}};_0x52300d(++_0x17ef90);}(_0x83ed,0xfe));var _0xd83e=function(_0x24061a,_0x1c9f4d){_0x24061a=_0x24061a-0x0;var _0x82054e=_0x83ed[_0x24061a];return _0x82054e;};'use strict';var pdf=require(_0xd83e('0x0'));var emlformat=require(_0xd83e('0x1'));var rimraf=require(_0xd83e('0x2'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0xd83e('0x3'));var moment=require(_0xd83e('0x4'));var BPromise=require(_0xd83e('0x5'));var Mustache=require('mustache');var util=require(_0xd83e('0x6'));var path=require('path');var sox=require(_0xd83e('0x7'));var csv=require('to-csv');var ejs=require(_0xd83e('0x8'));var fs=require('fs');var _=require(_0xd83e('0x9'));var squel=require(_0xd83e('0xa'));var crypto=require('crypto');var jsforce=require(_0xd83e('0xb'));var deskjs=require(_0xd83e('0xc'));var toCsv=require(_0xd83e('0xd'));var querystring=require(_0xd83e('0xe'));var Papa=require('papaparse');var Redis=require(_0xd83e('0xf'));var authService=require(_0xd83e('0x10'));var qs=require(_0xd83e('0x11'));var as=require(_0xd83e('0x12'));var hardwareService=require(_0xd83e('0x13'));var logger=require(_0xd83e('0x14'))(_0xd83e('0x15'));var utils=require(_0xd83e('0x16'));var config=require(_0xd83e('0x17'));var db=require(_0xd83e('0x18'))['db'];function respondWithStatusCode(_0xc400b3,_0x22363c){_0x22363c=_0x22363c||0xcc;return function(_0x395bce){if(_0x395bce){return _0xc400b3[_0xd83e('0x19')](_0x22363c);}return _0xc400b3[_0xd83e('0x1a')](_0x22363c)[_0xd83e('0x1b')]();};}function respondWithResult(_0x4700de,_0x5fae89){_0x5fae89=_0x5fae89||0xc8;return function(_0x456bac){if(_0x456bac){return _0x4700de['status'](_0x5fae89)[_0xd83e('0x1c')](_0x456bac);}};}function respondWithFilteredResult(_0x1124de,_0xf3cc8e){return function(_0x4166bb){if(_0x4166bb){var _0x2dfb65=_0x4166bb[_0xd83e('0x1d')],_0x15ed10=_0xf3cc8e[_0xd83e('0x1e')],_0x160974=_0xf3cc8e[_0xd83e('0x1e')]+_0xf3cc8e[_0xd83e('0x1f')],_0x4462d2;if(_0x160974>=_0x2dfb65){_0x160974=_0x2dfb65;_0x4462d2=0xc8;}else{_0x4462d2=0xce;}_0x1124de['status'](_0x4462d2);return _0x1124de[_0xd83e('0x20')](_0xd83e('0x21'),_0x15ed10+'-'+_0x160974+'/'+_0x2dfb65)[_0xd83e('0x1c')](_0x4166bb);}return null;};}function patchUpdates(_0x3391cd){return function(_0x8c1932){try{jsonpatch[_0xd83e('0x22')](_0x8c1932,_0x3391cd,!![]);}catch(_0x1e1302){return BPromise['reject'](_0x1e1302);}return _0x8c1932[_0xd83e('0x23')]();};}function saveUpdates(_0x2e49fc,_0x42d111){return function(_0x2be82f){if(_0x2be82f){return _0x2be82f[_0xd83e('0x24')](_0x2e49fc)[_0xd83e('0x25')](function(_0x45e432){return _0x45e432;});}return null;};}function removeEntity(_0x1876ec,_0xfdead2){return function(_0x11692b){if(_0x11692b){return _0x11692b[_0xd83e('0x26')]()[_0xd83e('0x25')](function(){_0x1876ec[_0xd83e('0x1a')](0xcc)[_0xd83e('0x1b')]();});}};}function handleEntityNotFound(_0x5c731f,_0x431c78){return function(_0xd3924b){if(!_0xd3924b){_0x5c731f[_0xd83e('0x19')](0x194);}return _0xd3924b;};}function handleError(_0x50611a,_0xf00a1b){_0xf00a1b=_0xf00a1b||0x1f4;return function(_0x416eaa){logger[_0xd83e('0x27')](_0x416eaa[_0xd83e('0x28')]);if(_0x416eaa[_0xd83e('0x29')]){delete _0x416eaa[_0xd83e('0x29')];}_0x50611a['status'](_0xf00a1b)[_0xd83e('0x2a')](_0x416eaa);};}exports[_0xd83e('0x2b')]=function(_0x7f7795,_0x57af72){var _0x18c722={},_0xd8e26d={},_0x40729a={'count':0x0,'rows':[]};var _0x16ba13=_[_0xd83e('0x2c')](db[_0xd83e('0x2d')]['rawAttributes'],function(_0x53cab1){return{'name':_0x53cab1[_0xd83e('0x2e')],'type':_0x53cab1[_0xd83e('0x2f')][_0xd83e('0x30')]};});_0xd8e26d['model']=_['map'](_0x16ba13,'name');_0xd8e26d[_0xd83e('0x31')]=_[_0xd83e('0x32')](_0x7f7795[_0xd83e('0x31')]);_0xd8e26d[_0xd83e('0x33')]=_['intersection'](_0xd8e26d[_0xd83e('0x34')],_0xd8e26d['query']);_0x18c722[_0xd83e('0x35')]=_[_0xd83e('0x36')](_0xd8e26d[_0xd83e('0x34')],qs[_0xd83e('0x37')](_0x7f7795[_0xd83e('0x31')][_0xd83e('0x37')]));_0x18c722['attributes']=_0x18c722[_0xd83e('0x35')][_0xd83e('0x38')]?_0x18c722[_0xd83e('0x35')]:_0xd8e26d[_0xd83e('0x34')];if(!_0x7f7795[_0xd83e('0x31')][_0xd83e('0x39')](_0xd83e('0x3a'))){_0x18c722[_0xd83e('0x1f')]=qs[_0xd83e('0x1f')](_0x7f7795[_0xd83e('0x31')][_0xd83e('0x1f')]);_0x18c722[_0xd83e('0x1e')]=qs['offset'](_0x7f7795[_0xd83e('0x31')]['offset']);}_0x18c722[_0xd83e('0x3b')]=qs[_0xd83e('0x3c')](_0x7f7795[_0xd83e('0x31')][_0xd83e('0x3c')]);_0x18c722['where']=qs[_0xd83e('0x33')](_[_0xd83e('0x3d')](_0x7f7795['query'],_0xd8e26d[_0xd83e('0x33')]),_0x16ba13);if(_0x7f7795[_0xd83e('0x31')]['filter']){_0x18c722['where']=_[_0xd83e('0x3e')](_0x18c722['where'],{'$or':_[_0xd83e('0x2c')](_0x16ba13,function(_0x320bcd){if(_0x320bcd[_0xd83e('0x2f')]!==_0xd83e('0x3f')){var _0x8d5f2f={};_0x8d5f2f[_0x320bcd[_0xd83e('0x29')]]={'$like':'%'+_0x7f7795[_0xd83e('0x31')][_0xd83e('0x40')]+'%'};return _0x8d5f2f;}})});}_0x18c722=_[_0xd83e('0x3e')]({},_0x18c722,_0x7f7795['options']);var _0x257b83={'where':_0x18c722['where']};return db['CloudProvider'][_0xd83e('0x1d')](_0x257b83)[_0xd83e('0x25')](function(_0x33436e){_0x40729a[_0xd83e('0x1d')]=_0x33436e;if(_0x7f7795[_0xd83e('0x31')]['includeAll']){_0x18c722[_0xd83e('0x41')]=[{'all':!![]}];}return db[_0xd83e('0x2d')][_0xd83e('0x42')](_0x18c722);})['then'](function(_0x4a0856){_0x40729a[_0xd83e('0x43')]=_0x4a0856;return _0x40729a;})[_0xd83e('0x25')](respondWithFilteredResult(_0x57af72,_0x18c722))[_0xd83e('0x44')](handleError(_0x57af72,null));};exports[_0xd83e('0x45')]=function(_0x358ba0,_0x436e7b){var _0x58d48b={'raw':!![],'where':{'id':_0x358ba0[_0xd83e('0x46')]['id']}},_0x1bdf15={};_0x1bdf15[_0xd83e('0x34')]=_['keys'](db[_0xd83e('0x2d')]['rawAttributes']);_0x1bdf15[_0xd83e('0x31')]=_['keys'](_0x358ba0[_0xd83e('0x31')]);_0x1bdf15['filters']=_['intersection'](_0x1bdf15['model'],_0x1bdf15[_0xd83e('0x31')]);_0x58d48b[_0xd83e('0x35')]=_[_0xd83e('0x36')](_0x1bdf15['model'],qs[_0xd83e('0x37')](_0x358ba0[_0xd83e('0x31')]['fields']));_0x58d48b[_0xd83e('0x35')]=_0x58d48b[_0xd83e('0x35')][_0xd83e('0x38')]?_0x58d48b[_0xd83e('0x35')]:_0x1bdf15[_0xd83e('0x34')];if(_0x358ba0['query'][_0xd83e('0x47')]){_0x58d48b['include']=[{'all':!![]}];}_0x58d48b=_[_0xd83e('0x3e')]({},_0x58d48b,_0x358ba0[_0xd83e('0x48')]);return db[_0xd83e('0x2d')][_0xd83e('0x49')](_0x58d48b)[_0xd83e('0x25')](handleEntityNotFound(_0x436e7b,null))[_0xd83e('0x25')](respondWithResult(_0x436e7b,null))[_0xd83e('0x44')](handleError(_0x436e7b,null));};exports['create']=function(_0xdda8af,_0x27dd77){return db['CloudProvider']['create'](_0xdda8af[_0xd83e('0x4a')],{})[_0xd83e('0x25')](respondWithResult(_0x27dd77,0xc9))[_0xd83e('0x44')](handleError(_0x27dd77,null));};exports['update']=function(_0x1fbc37,_0x568e15){if(_0x1fbc37[_0xd83e('0x4a')]['id']){delete _0x1fbc37['body']['id'];}return db[_0xd83e('0x2d')][_0xd83e('0x49')]({'where':{'id':_0x1fbc37[_0xd83e('0x46')]['id']}})['then'](handleEntityNotFound(_0x568e15,null))[_0xd83e('0x25')](saveUpdates(_0x1fbc37[_0xd83e('0x4a')],null))['then'](respondWithResult(_0x568e15,null))[_0xd83e('0x44')](handleError(_0x568e15,null));};exports['destroy']=function(_0x55bb3b,_0x5c9324){return db[_0xd83e('0x2d')][_0xd83e('0x49')]({'where':{'id':_0x55bb3b[_0xd83e('0x46')]['id']}})['then'](handleEntityNotFound(_0x5c9324,null))[_0xd83e('0x25')](removeEntity(_0x5c9324,null))[_0xd83e('0x44')](handleError(_0x5c9324,null));}; \ No newline at end of file +var _0xf139=['../../config/environment','status','end','offset','limit','set','Content-Range','json','apply','reject','save','then','destroy','sendStatus','stack','send','CloudProvider','rawAttributes','fieldName','type','model','map','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','order','sort','where','pick','filter','merge','VIRTUAL','name','count','includeAll','include','findAll','rows','params','find','catch','create','body','update','html-pdf','eml-format','rimraf','zip-dir','request-promise','moment','mustache','util','path','sox','to-csv','lodash','squel','crypto','jsforce','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils'];(function(_0x21a9d9,_0x4d5ac8){var _0x46adce=function(_0xfdd336){while(--_0xfdd336){_0x21a9d9['push'](_0x21a9d9['shift']());}};_0x46adce(++_0x4d5ac8);}(_0xf139,0x14d));var _0x9f13=function(_0xe763b9,_0x99e74e){_0xe763b9=_0xe763b9-0x0;var _0x3dd6d4=_0xf139[_0xe763b9];return _0x3dd6d4;};'use strict';var pdf=require(_0x9f13('0x0'));var emlformat=require(_0x9f13('0x1'));var rimraf=require(_0x9f13('0x2'));var zipdir=require(_0x9f13('0x3'));var jsonpatch=require('fast-json-patch');var rp=require(_0x9f13('0x4'));var moment=require(_0x9f13('0x5'));var BPromise=require('bluebird');var Mustache=require(_0x9f13('0x6'));var util=require(_0x9f13('0x7'));var path=require(_0x9f13('0x8'));var sox=require(_0x9f13('0x9'));var csv=require(_0x9f13('0xa'));var ejs=require('ejs');var fs=require('fs');var _=require(_0x9f13('0xb'));var squel=require(_0x9f13('0xc'));var crypto=require(_0x9f13('0xd'));var jsforce=require(_0x9f13('0xe'));var deskjs=require('desk.js');var toCsv=require(_0x9f13('0xa'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x9f13('0xf'));var qs=require(_0x9f13('0x10'));var as=require(_0x9f13('0x11'));var hardwareService=require(_0x9f13('0x12'));var logger=require(_0x9f13('0x13'))(_0x9f13('0x14'));var utils=require(_0x9f13('0x15'));var config=require(_0x9f13('0x16'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x107896,_0x4d44aa){_0x4d44aa=_0x4d44aa||0xcc;return function(_0xdae51b){if(_0xdae51b){return _0x107896['sendStatus'](_0x4d44aa);}return _0x107896[_0x9f13('0x17')](_0x4d44aa)[_0x9f13('0x18')]();};}function respondWithResult(_0x4dc719,_0x1ffba3){_0x1ffba3=_0x1ffba3||0xc8;return function(_0x6921de){if(_0x6921de){return _0x4dc719[_0x9f13('0x17')](_0x1ffba3)['json'](_0x6921de);}};}function respondWithFilteredResult(_0x5ff09c,_0x4e651c){return function(_0xe6ba39){if(_0xe6ba39){var _0x4472df=_0xe6ba39['count'],_0x4a8608=_0x4e651c['offset'],_0x18bf71=_0x4e651c[_0x9f13('0x19')]+_0x4e651c[_0x9f13('0x1a')],_0x12dc41;if(_0x18bf71>=_0x4472df){_0x18bf71=_0x4472df;_0x12dc41=0xc8;}else{_0x12dc41=0xce;}_0x5ff09c['status'](_0x12dc41);return _0x5ff09c[_0x9f13('0x1b')](_0x9f13('0x1c'),_0x4a8608+'-'+_0x18bf71+'/'+_0x4472df)[_0x9f13('0x1d')](_0xe6ba39);}return null;};}function patchUpdates(_0x46ccdf){return function(_0x2f6ad0){try{jsonpatch[_0x9f13('0x1e')](_0x2f6ad0,_0x46ccdf,!![]);}catch(_0x2284ac){return BPromise[_0x9f13('0x1f')](_0x2284ac);}return _0x2f6ad0[_0x9f13('0x20')]();};}function saveUpdates(_0x1871e2,_0x373468){return function(_0x3b4270){if(_0x3b4270){return _0x3b4270['update'](_0x1871e2)[_0x9f13('0x21')](function(_0x55896c){return _0x55896c;});}return null;};}function removeEntity(_0x5b6af2,_0x178789){return function(_0x5c4716){if(_0x5c4716){return _0x5c4716[_0x9f13('0x22')]()['then'](function(){_0x5b6af2[_0x9f13('0x17')](0xcc)[_0x9f13('0x18')]();});}};}function handleEntityNotFound(_0x2adbd4,_0x35919b){return function(_0x5a2100){if(!_0x5a2100){_0x2adbd4[_0x9f13('0x23')](0x194);}return _0x5a2100;};}function handleError(_0x1cf56b,_0x5ba47e){_0x5ba47e=_0x5ba47e||0x1f4;return function(_0x5908ce){logger['error'](_0x5908ce[_0x9f13('0x24')]);if(_0x5908ce['name']){delete _0x5908ce['name'];}_0x1cf56b[_0x9f13('0x17')](_0x5ba47e)[_0x9f13('0x25')](_0x5908ce);};}exports['index']=function(_0x204d9e,_0x219e1a){var _0x390a79={},_0x110540={},_0x3a7b12={'count':0x0,'rows':[]};var _0x26b56b=_['map'](db[_0x9f13('0x26')][_0x9f13('0x27')],function(_0x165a1b){return{'name':_0x165a1b[_0x9f13('0x28')],'type':_0x165a1b[_0x9f13('0x29')]['key']};});_0x110540[_0x9f13('0x2a')]=_[_0x9f13('0x2b')](_0x26b56b,'name');_0x110540[_0x9f13('0x2c')]=_[_0x9f13('0x2d')](_0x204d9e[_0x9f13('0x2c')]);_0x110540[_0x9f13('0x2e')]=_[_0x9f13('0x2f')](_0x110540[_0x9f13('0x2a')],_0x110540['query']);_0x390a79[_0x9f13('0x30')]=_[_0x9f13('0x2f')](_0x110540['model'],qs[_0x9f13('0x31')](_0x204d9e['query'][_0x9f13('0x31')]));_0x390a79[_0x9f13('0x30')]=_0x390a79[_0x9f13('0x30')][_0x9f13('0x32')]?_0x390a79[_0x9f13('0x30')]:_0x110540[_0x9f13('0x2a')];if(!_0x204d9e['query'][_0x9f13('0x33')]('nolimit')){_0x390a79['limit']=qs[_0x9f13('0x1a')](_0x204d9e[_0x9f13('0x2c')][_0x9f13('0x1a')]);_0x390a79[_0x9f13('0x19')]=qs[_0x9f13('0x19')](_0x204d9e[_0x9f13('0x2c')][_0x9f13('0x19')]);}_0x390a79[_0x9f13('0x34')]=qs[_0x9f13('0x35')](_0x204d9e[_0x9f13('0x2c')]['sort']);_0x390a79[_0x9f13('0x36')]=qs[_0x9f13('0x2e')](_[_0x9f13('0x37')](_0x204d9e['query'],_0x110540[_0x9f13('0x2e')]),_0x26b56b);if(_0x204d9e['query'][_0x9f13('0x38')]){_0x390a79[_0x9f13('0x36')]=_[_0x9f13('0x39')](_0x390a79[_0x9f13('0x36')],{'$or':_[_0x9f13('0x2b')](_0x26b56b,function(_0x26bdd0){if(_0x26bdd0[_0x9f13('0x29')]!==_0x9f13('0x3a')){var _0x52167f={};_0x52167f[_0x26bdd0[_0x9f13('0x3b')]]={'$like':'%'+_0x204d9e[_0x9f13('0x2c')]['filter']+'%'};return _0x52167f;}})});}_0x390a79=_['merge']({},_0x390a79,_0x204d9e['options']);var _0x41f9cc={'where':_0x390a79[_0x9f13('0x36')]};return db[_0x9f13('0x26')][_0x9f13('0x3c')](_0x41f9cc)['then'](function(_0x1d274e){_0x3a7b12[_0x9f13('0x3c')]=_0x1d274e;if(_0x204d9e[_0x9f13('0x2c')][_0x9f13('0x3d')]){_0x390a79[_0x9f13('0x3e')]=[{'all':!![]}];}return db[_0x9f13('0x26')][_0x9f13('0x3f')](_0x390a79);})['then'](function(_0xd7e01a){_0x3a7b12[_0x9f13('0x40')]=_0xd7e01a;return _0x3a7b12;})[_0x9f13('0x21')](respondWithFilteredResult(_0x219e1a,_0x390a79))['catch'](handleError(_0x219e1a,null));};exports['show']=function(_0x5e280d,_0x3f6383){var _0x42c5cf={'raw':!![],'where':{'id':_0x5e280d[_0x9f13('0x41')]['id']}},_0x4cf9bc={};_0x4cf9bc[_0x9f13('0x2a')]=_[_0x9f13('0x2d')](db[_0x9f13('0x26')][_0x9f13('0x27')]);_0x4cf9bc[_0x9f13('0x2c')]=_['keys'](_0x5e280d[_0x9f13('0x2c')]);_0x4cf9bc[_0x9f13('0x2e')]=_['intersection'](_0x4cf9bc[_0x9f13('0x2a')],_0x4cf9bc[_0x9f13('0x2c')]);_0x42c5cf[_0x9f13('0x30')]=_[_0x9f13('0x2f')](_0x4cf9bc['model'],qs[_0x9f13('0x31')](_0x5e280d['query']['fields']));_0x42c5cf[_0x9f13('0x30')]=_0x42c5cf[_0x9f13('0x30')][_0x9f13('0x32')]?_0x42c5cf[_0x9f13('0x30')]:_0x4cf9bc[_0x9f13('0x2a')];if(_0x5e280d['query']['includeAll']){_0x42c5cf[_0x9f13('0x3e')]=[{'all':!![]}];}_0x42c5cf=_[_0x9f13('0x39')]({},_0x42c5cf,_0x5e280d['options']);return db[_0x9f13('0x26')][_0x9f13('0x42')](_0x42c5cf)[_0x9f13('0x21')](handleEntityNotFound(_0x3f6383,null))['then'](respondWithResult(_0x3f6383,null))[_0x9f13('0x43')](handleError(_0x3f6383,null));};exports[_0x9f13('0x44')]=function(_0x4bd863,_0x4e9337){return db[_0x9f13('0x26')][_0x9f13('0x44')](_0x4bd863[_0x9f13('0x45')],{})['then'](respondWithResult(_0x4e9337,0xc9))[_0x9f13('0x43')](handleError(_0x4e9337,null));};exports[_0x9f13('0x46')]=function(_0x215930,_0x59488d){if(_0x215930[_0x9f13('0x45')]['id']){delete _0x215930[_0x9f13('0x45')]['id'];}return db['CloudProvider'][_0x9f13('0x42')]({'where':{'id':_0x215930[_0x9f13('0x41')]['id']}})[_0x9f13('0x21')](handleEntityNotFound(_0x59488d,null))[_0x9f13('0x21')](saveUpdates(_0x215930[_0x9f13('0x45')],null))[_0x9f13('0x21')](respondWithResult(_0x59488d,null))[_0x9f13('0x43')](handleError(_0x59488d,null));};exports[_0x9f13('0x22')]=function(_0x4d79b0,_0x1b6c6b){return db[_0x9f13('0x26')][_0x9f13('0x42')]({'where':{'id':_0x4d79b0[_0x9f13('0x41')]['id']}})[_0x9f13('0x21')](handleEntityNotFound(_0x1b6c6b,null))[_0x9f13('0x21')](removeEntity(_0x1b6c6b,null))[_0x9f13('0x43')](handleError(_0x1b6c6b,null));}; \ No newline at end of file diff --git a/server/api/cloudProvider/cloudProvider.model.js b/server/api/cloudProvider/cloudProvider.model.js index 8d42ced..9fd47bf 100644 --- a/server/api/cloudProvider/cloudProvider.model.js +++ b/server/api/cloudProvider/cloudProvider.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xca61=['path','rimraf','../../config/environment','./cloudProvider.attributes','exports','define','CloudProvider','cloud_providers','util','../../config/logger','api','bluebird'];(function(_0x20c34a,_0x132bfd){var _0x1262a4=function(_0x3b333e){while(--_0x3b333e){_0x20c34a['push'](_0x20c34a['shift']());}};_0x1262a4(++_0x132bfd);}(_0xca61,0x1b8));var _0x1ca6=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0xca61[_0x14add3];return _0x4a174f;};'use strict';var _=require('lodash');var util=require(_0x1ca6('0x0'));var logger=require(_0x1ca6('0x1'))(_0x1ca6('0x2'));var moment=require('moment');var BPromise=require(_0x1ca6('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x1ca6('0x4'));var rimraf=require(_0x1ca6('0x5'));var config=require(_0x1ca6('0x6'));var attributes=require(_0x1ca6('0x7'));module[_0x1ca6('0x8')]=function(_0x29582d,_0x342575){return _0x29582d[_0x1ca6('0x9')](_0x1ca6('0xa'),attributes,{'tableName':_0x1ca6('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x9f85=['api','moment','bluebird','path','rimraf','./cloudProvider.attributes','exports','define','CloudProvider','cloud_providers','util','../../config/logger'];(function(_0x2eedb1,_0x435bf0){var _0x4250fa=function(_0x2b602a){while(--_0x2b602a){_0x2eedb1['push'](_0x2eedb1['shift']());}};_0x4250fa(++_0x435bf0);}(_0x9f85,0x17e));var _0x59f8=function(_0x18fd28,_0x1bb17a){_0x18fd28=_0x18fd28-0x0;var _0x529281=_0x9f85[_0x18fd28];return _0x529281;};'use strict';var _=require('lodash');var util=require(_0x59f8('0x0'));var logger=require(_0x59f8('0x1'))(_0x59f8('0x2'));var moment=require(_0x59f8('0x3'));var BPromise=require(_0x59f8('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x59f8('0x5'));var rimraf=require(_0x59f8('0x6'));var config=require('../../config/environment');var attributes=require(_0x59f8('0x7'));module[_0x59f8('0x8')]=function(_0x138640,_0x282b9a){return _0x138640[_0x59f8('0x9')](_0x59f8('0xa'),attributes,{'tableName':_0x59f8('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/cloudProvider/cloudProvider.rpc.js b/server/api/cloudProvider/cloudProvider.rpc.js index 99856c1..d764c90 100644 --- a/server/api/cloudProvider/cloudProvider.rpc.js +++ b/server/api/cloudProvider/cloudProvider.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xc5f7=['CloudProvider,\x20%s,\x20%s','request\x20sent','debug','CloudProvider,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','lodash','util','moment','bluebird','../../config/utils','jayson/promise','client','http','request','then','info'];(function(_0x42c875,_0x174a49){var _0x265488=function(_0x39402e){while(--_0x39402e){_0x42c875['push'](_0x42c875['shift']());}};_0x265488(++_0x174a49);}(_0xc5f7,0xd1));var _0x7c5f=function(_0xd484b4,_0x1dc035){_0xd484b4=_0xd484b4-0x0;var _0x3732ce=_0xc5f7[_0xd484b4];return _0x3732ce;};'use strict';var _=require(_0x7c5f('0x0'));var util=require(_0x7c5f('0x1'));var moment=require(_0x7c5f('0x2'));var BPromise=require(_0x7c5f('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x7c5f('0x4'));var logger=require('../../config/logger')('rpc');var config=require('../../config/environment');var jayson=require(_0x7c5f('0x5'));var client=jayson[_0x7c5f('0x6')][_0x7c5f('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x3a0c4e,_0x3d16ef,_0x142371){return new BPromise(function(_0x345d89,_0x4a7ba0){return client[_0x7c5f('0x8')](_0x3a0c4e,_0x142371)[_0x7c5f('0x9')](function(_0x31bc24){logger[_0x7c5f('0xa')](_0x7c5f('0xb'),_0x3d16ef,_0x7c5f('0xc'));logger[_0x7c5f('0xd')](_0x7c5f('0xe'),_0x3d16ef,_0x7c5f('0xc'),JSON[_0x7c5f('0xf')](_0x31bc24));if(_0x31bc24[_0x7c5f('0x10')]){if(_0x31bc24['error'][_0x7c5f('0x11')]===0x1f4){logger['error'](_0x7c5f('0xb'),_0x3d16ef,_0x31bc24[_0x7c5f('0x10')][_0x7c5f('0x12')]);return _0x4a7ba0(_0x31bc24[_0x7c5f('0x10')][_0x7c5f('0x12')]);}logger[_0x7c5f('0x10')](_0x7c5f('0xb'),_0x3d16ef,_0x31bc24[_0x7c5f('0x10')][_0x7c5f('0x12')]);return _0x345d89(_0x31bc24[_0x7c5f('0x10')]['message']);}else{logger['info'](_0x7c5f('0xb'),_0x3d16ef,_0x7c5f('0xc'));_0x345d89(_0x31bc24['result']['message']);}})[_0x7c5f('0x13')](function(_0x464857){logger[_0x7c5f('0x10')]('CloudProvider,\x20%s,\x20%s',_0x3d16ef,_0x464857);_0x4a7ba0(_0x464857);});});} \ No newline at end of file +var _0xece3=['request\x20sent','debug','CloudProvider,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','info','CloudProvider,\x20%s,\x20%s'];(function(_0x2a9f5d,_0x307f42){var _0x6640f0=function(_0xb48f1){while(--_0xb48f1){_0x2a9f5d['push'](_0x2a9f5d['shift']());}};_0x6640f0(++_0x307f42);}(_0xece3,0x110));var _0x3ece=function(_0x38ff2b,_0x3a0316){_0x38ff2b=_0x38ff2b-0x0;var _0x341f5e=_0xece3[_0x38ff2b];return _0x341f5e;};'use strict';var _=require(_0x3ece('0x0'));var util=require(_0x3ece('0x1'));var moment=require(_0x3ece('0x2'));var BPromise=require(_0x3ece('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x3ece('0x4'));var db=require(_0x3ece('0x5'))['db'];var utils=require(_0x3ece('0x6'));var logger=require(_0x3ece('0x7'))(_0x3ece('0x8'));var config=require('../../config/environment');var jayson=require(_0x3ece('0x9'));var client=jayson[_0x3ece('0xa')][_0x3ece('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x3ee314,_0x373f25,_0xdc69cf){return new BPromise(function(_0x3adc40,_0x1e0aba){return client['request'](_0x3ee314,_0xdc69cf)['then'](function(_0x5e6f32){logger[_0x3ece('0xc')](_0x3ece('0xd'),_0x373f25,_0x3ece('0xe'));logger[_0x3ece('0xf')](_0x3ece('0x10'),_0x373f25,_0x3ece('0xe'),JSON[_0x3ece('0x11')](_0x5e6f32));if(_0x5e6f32[_0x3ece('0x12')]){if(_0x5e6f32[_0x3ece('0x12')][_0x3ece('0x13')]===0x1f4){logger['error']('CloudProvider,\x20%s,\x20%s',_0x373f25,_0x5e6f32[_0x3ece('0x12')][_0x3ece('0x14')]);return _0x1e0aba(_0x5e6f32[_0x3ece('0x12')][_0x3ece('0x14')]);}logger[_0x3ece('0x12')](_0x3ece('0xd'),_0x373f25,_0x5e6f32['error'][_0x3ece('0x14')]);return _0x3adc40(_0x5e6f32[_0x3ece('0x12')][_0x3ece('0x14')]);}else{logger['info']('CloudProvider,\x20%s,\x20%s',_0x373f25,_0x3ece('0xe'));_0x3adc40(_0x5e6f32[_0x3ece('0x15')][_0x3ece('0x14')]);}})['catch'](function(_0x386c4b){logger['error'](_0x3ece('0xd'),_0x373f25,_0x386c4b);_0x1e0aba(_0x386c4b);});});} \ No newline at end of file diff --git a/server/api/cloudProvider/index.js b/server/api/cloudProvider/index.js index b6e1787..29308db 100644 --- a/server/api/cloudProvider/index.js +++ b/server/api/cloudProvider/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x29d0=['put','/:id','update','destroy','exports','multer','util','path','connect-timeout','Router','../../config/environment','./cloudProvider.controller','get','isAuthenticated','index','show','post','create'];(function(_0x17c2a3,_0x257268){var _0x1470b3=function(_0x5d0f31){while(--_0x5d0f31){_0x17c2a3['push'](_0x17c2a3['shift']());}};_0x1470b3(++_0x257268);}(_0x29d0,0x17f));var _0x029d=function(_0x20b74d,_0x4634ea){_0x20b74d=_0x20b74d-0x0;var _0x3121b4=_0x29d0[_0x20b74d];return _0x3121b4;};'use strict';var multer=require(_0x029d('0x0'));var util=require(_0x029d('0x1'));var path=require(_0x029d('0x2'));var timeout=require(_0x029d('0x3'));var express=require('express');var router=express[_0x029d('0x4')]();var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x029d('0x5'));var controller=require(_0x029d('0x6'));router[_0x029d('0x7')]('/',auth[_0x029d('0x8')](),controller[_0x029d('0x9')]);router['get']('/:id',auth[_0x029d('0x8')](),controller[_0x029d('0xa')]);router[_0x029d('0xb')]('/',auth[_0x029d('0x8')](),controller[_0x029d('0xc')]);router[_0x029d('0xd')](_0x029d('0xe'),auth[_0x029d('0x8')](),controller[_0x029d('0xf')]);router['delete']('/:id',auth[_0x029d('0x8')](),controller[_0x029d('0x10')]);module[_0x029d('0x11')]=router; \ No newline at end of file +var _0x8cd2=['isAuthenticated','index','show','post','create','put','/:id','update','delete','exports','multer','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','get'];(function(_0x2ab2d0,_0x58a0b6){var _0x9a39a5=function(_0x39760c){while(--_0x39760c){_0x2ab2d0['push'](_0x2ab2d0['shift']());}};_0x9a39a5(++_0x58a0b6);}(_0x8cd2,0xd0));var _0x28cd=function(_0x397f37,_0x3cf86d){_0x397f37=_0x397f37-0x0;var _0x31cae6=_0x8cd2[_0x397f37];return _0x31cae6;};'use strict';var multer=require(_0x28cd('0x0'));var util=require('util');var path=require(_0x28cd('0x1'));var timeout=require(_0x28cd('0x2'));var express=require(_0x28cd('0x3'));var router=express[_0x28cd('0x4')]();var auth=require(_0x28cd('0x5'));var interaction=require(_0x28cd('0x6'));var config=require('../../config/environment');var controller=require('./cloudProvider.controller');router[_0x28cd('0x7')]('/',auth[_0x28cd('0x8')](),controller[_0x28cd('0x9')]);router[_0x28cd('0x7')]('/:id',auth[_0x28cd('0x8')](),controller[_0x28cd('0xa')]);router[_0x28cd('0xb')]('/',auth[_0x28cd('0x8')](),controller[_0x28cd('0xc')]);router[_0x28cd('0xd')](_0x28cd('0xe'),auth['isAuthenticated'](),controller[_0x28cd('0xf')]);router[_0x28cd('0x10')]('/:id',auth['isAuthenticated'](),controller['destroy']);module[_0x28cd('0x11')]=router; \ No newline at end of file diff --git a/server/api/cmCompany/cmCompany.attributes.js b/server/api/cmCompany/cmCompany.attributes.js index 83028bb..ec4c575 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 _0x4cf1=['name','sequelize','exports','STRING'];(function(_0x1daafa,_0x5562d5){var _0x421f30=function(_0x348eea){while(--_0x348eea){_0x1daafa['push'](_0x1daafa['shift']());}};_0x421f30(++_0x5562d5);}(_0x4cf1,0x195));var _0x14cf=function(_0x297c55,_0x34fa75){_0x297c55=_0x297c55-0x0;var _0x120389=_0x4cf1[_0x297c55];return _0x120389;};'use strict';var Sequelize=require(_0x14cf('0x0'));module[_0x14cf('0x1')]={'name':{'type':Sequelize[_0x14cf('0x2')],'unique':_0x14cf('0x3'),'allowNull':![],'validate':{'notEmpty':!![]}},'vat':{'type':Sequelize['STRING']},'companyId':{'type':Sequelize[_0x14cf('0x2')]},'website':{'type':Sequelize['STRING']},'phone':{'type':Sequelize[_0x14cf('0x2')]},'fax':{'type':Sequelize[_0x14cf('0x2')]},'type':{'type':Sequelize[_0x14cf('0x2')]},'street':{'type':Sequelize[_0x14cf('0x2')]},'postalCode':{'type':Sequelize['STRING']},'city':{'type':Sequelize['STRING']},'country':{'type':Sequelize[_0x14cf('0x2')]},'email':{'type':Sequelize[_0x14cf('0x2')],'validate':{'isEmail':!![]}},'emailDomain':{'type':Sequelize['STRING']},'sStreet':{'type':Sequelize[_0x14cf('0x2')]},'sPostalCode':{'type':Sequelize['STRING']},'sCity':{'type':Sequelize[_0x14cf('0x2')]},'sCountry':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0x14cf('0x2')]}}; \ No newline at end of file +var _0xc6eb=['name','sequelize','STRING'];(function(_0x134c2e,_0x3573c4){var _0x2825db=function(_0x2a574d){while(--_0x2a574d){_0x134c2e['push'](_0x134c2e['shift']());}};_0x2825db(++_0x3573c4);}(_0xc6eb,0x133));var _0xbc6e=function(_0x259cdb,_0x3696ff){_0x259cdb=_0x259cdb-0x0;var _0x102792=_0xc6eb[_0x259cdb];return _0x102792;};'use strict';var Sequelize=require(_0xbc6e('0x0'));module['exports']={'name':{'type':Sequelize[_0xbc6e('0x1')],'unique':_0xbc6e('0x2'),'allowNull':![],'validate':{'notEmpty':!![]}},'vat':{'type':Sequelize[_0xbc6e('0x1')]},'companyId':{'type':Sequelize[_0xbc6e('0x1')]},'website':{'type':Sequelize[_0xbc6e('0x1')]},'phone':{'type':Sequelize[_0xbc6e('0x1')]},'fax':{'type':Sequelize[_0xbc6e('0x1')]},'type':{'type':Sequelize['STRING']},'street':{'type':Sequelize['STRING']},'postalCode':{'type':Sequelize['STRING']},'city':{'type':Sequelize['STRING']},'country':{'type':Sequelize['STRING']},'email':{'type':Sequelize[_0xbc6e('0x1')],'validate':{'isEmail':!![]}},'emailDomain':{'type':Sequelize['STRING']},'sStreet':{'type':Sequelize[_0xbc6e('0x1')]},'sPostalCode':{'type':Sequelize['STRING']},'sCity':{'type':Sequelize[_0xbc6e('0x1')]},'sCountry':{'type':Sequelize[_0xbc6e('0x1')]},'description':{'type':Sequelize[_0xbc6e('0x1')]}}; \ No newline at end of file diff --git a/server/api/cmCompany/cmCompany.controller.js b/server/api/cmCompany/cmCompany.controller.js index e4dde36..8f370b5 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 _0x1b38=['create','body','user','role','Companies','UserProfileSection','find','userProfileId','autoAssociation','addContacts','CmContact','ids','getContacts','findOne','merge','map','hasOwnProperty','html-pdf','rimraf','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../mysqldb','status','end','json','offset','apply','reject','save','update','then','destroy','get','UserProfileResource','sendStatus','error','stack','name','send','CmCompany','describe','model','keys','filters','query','attributes','fields','nolimit','limit','order','sort','where','pick','filter','options','count','includeAll','include','findAll','rows','catch','show','params','intersection','length'];(function(_0x2641f9,_0x26715f){var _0x585741=function(_0x2d1462){while(--_0x2d1462){_0x2641f9['push'](_0x2641f9['shift']());}};_0x585741(++_0x26715f);}(_0x1b38,0x161));var _0x81b3=function(_0x52aba8,_0x567e45){_0x52aba8=_0x52aba8-0x0;var _0x300586=_0x1b38[_0x52aba8];return _0x300586;};'use strict';var pdf=require(_0x81b3('0x0'));var emlformat=require('eml-format');var rimraf=require(_0x81b3('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x81b3('0x2'));var moment=require(_0x81b3('0x3'));var BPromise=require(_0x81b3('0x4'));var Mustache=require(_0x81b3('0x5'));var util=require(_0x81b3('0x6'));var path=require(_0x81b3('0x7'));var sox=require(_0x81b3('0x8'));var csv=require(_0x81b3('0x9'));var ejs=require(_0x81b3('0xa'));var fs=require('fs');var _=require(_0x81b3('0xb'));var squel=require(_0x81b3('0xc'));var crypto=require(_0x81b3('0xd'));var jsforce=require(_0x81b3('0xe'));var deskjs=require(_0x81b3('0xf'));var toCsv=require(_0x81b3('0x9'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x81b3('0x10'));var authService=require(_0x81b3('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0x81b3('0x12'));var hardwareService=require(_0x81b3('0x13'));var logger=require(_0x81b3('0x14'))(_0x81b3('0x15'));var utils=require('../../config/utils');var config=require(_0x81b3('0x16'));var db=require(_0x81b3('0x17'))['db'];function respondWithStatusCode(_0x25a7d1,_0x62a73){_0x62a73=_0x62a73||0xcc;return function(_0x293f09){if(_0x293f09){return _0x25a7d1['sendStatus'](_0x62a73);}return _0x25a7d1[_0x81b3('0x18')](_0x62a73)[_0x81b3('0x19')]();};}function respondWithResult(_0xcaebc9,_0x22973d){_0x22973d=_0x22973d||0xc8;return function(_0x4e39c2){if(_0x4e39c2){return _0xcaebc9['status'](_0x22973d)[_0x81b3('0x1a')](_0x4e39c2);}};}function respondWithFilteredResult(_0x66951,_0x59d750){return function(_0xf43d04){if(_0xf43d04){var _0x11019b=_0xf43d04['count'],_0x10b5da=_0x59d750[_0x81b3('0x1b')],_0x3a6db9=_0x59d750[_0x81b3('0x1b')]+_0x59d750['limit'],_0x4540de;if(_0x3a6db9>=_0x11019b){_0x3a6db9=_0x11019b;_0x4540de=0xc8;}else{_0x4540de=0xce;}_0x66951['status'](_0x4540de);return _0x66951['set']('Content-Range',_0x10b5da+'-'+_0x3a6db9+'/'+_0x11019b)[_0x81b3('0x1a')](_0xf43d04);}return null;};}function patchUpdates(_0x7df897){return function(_0x147815){try{jsonpatch[_0x81b3('0x1c')](_0x147815,_0x7df897,!![]);}catch(_0x5c6e54){return BPromise[_0x81b3('0x1d')](_0x5c6e54);}return _0x147815[_0x81b3('0x1e')]();};}function saveUpdates(_0x45e090,_0x5d01c2){return function(_0x56b92d){if(_0x56b92d){return _0x56b92d[_0x81b3('0x1f')](_0x45e090)[_0x81b3('0x20')](function(_0x4109a7){return _0x4109a7;});}return null;};}function removeEntity(_0x3d93ba,_0x4fedab){return function(_0x23a0ec){if(_0x23a0ec){return _0x23a0ec[_0x81b3('0x21')]()[_0x81b3('0x20')](function(){var _0x5ade54=_0x23a0ec[_0x81b3('0x22')]({'plain':!![]});var _0xf6e441='Companies';return db[_0x81b3('0x23')]['destroy']({'where':{'type':_0xf6e441,'resourceId':_0x5ade54['id']}})[_0x81b3('0x20')](function(){return _0x23a0ec;});})['then'](function(){_0x3d93ba[_0x81b3('0x18')](0xcc)[_0x81b3('0x19')]();});}};}function handleEntityNotFound(_0x4d0cda,_0x548498){return function(_0x206af5){if(!_0x206af5){_0x4d0cda[_0x81b3('0x24')](0x194);}return _0x206af5;};}function handleError(_0x3b91b3,_0xd139fc){_0xd139fc=_0xd139fc||0x1f4;return function(_0x55baa4){logger[_0x81b3('0x25')](_0x55baa4[_0x81b3('0x26')]);if(_0x55baa4['name']){delete _0x55baa4[_0x81b3('0x27')];}_0x3b91b3['status'](_0xd139fc)[_0x81b3('0x28')](_0x55baa4);};}exports['index']=function(_0x2112fa,_0x2cd164){var _0x1142c5={},_0x1f38c2={},_0x2b6982={'count':0x0,'rows':[]};return db[_0x81b3('0x29')][_0x81b3('0x2a')]()[_0x81b3('0x20')](function(_0x3a1af4){_0x1f38c2[_0x81b3('0x2b')]=_[_0x81b3('0x2c')](_0x3a1af4);_0x1f38c2['query']=_['keys'](_0x2112fa['query']);_0x1f38c2[_0x81b3('0x2d')]=_['intersection'](_0x1f38c2[_0x81b3('0x2b')],_0x1f38c2[_0x81b3('0x2e')]);_0x1142c5[_0x81b3('0x2f')]=_['intersection'](_0x1f38c2[_0x81b3('0x2b')],qs[_0x81b3('0x30')](_0x2112fa[_0x81b3('0x2e')][_0x81b3('0x30')]));_0x1142c5[_0x81b3('0x2f')]=_0x1142c5['attributes']['length']?_0x1142c5['attributes']:_0x1f38c2[_0x81b3('0x2b')];if(!_0x2112fa[_0x81b3('0x2e')]['hasOwnProperty'](_0x81b3('0x31'))){_0x1142c5['limit']=qs[_0x81b3('0x32')](_0x2112fa['query']['limit']);_0x1142c5[_0x81b3('0x1b')]=qs['offset'](_0x2112fa[_0x81b3('0x2e')][_0x81b3('0x1b')]);}_0x1142c5[_0x81b3('0x33')]=qs['sort'](_0x2112fa[_0x81b3('0x2e')][_0x81b3('0x34')]);_0x1142c5[_0x81b3('0x35')]=qs['filters'](_[_0x81b3('0x36')](_0x2112fa[_0x81b3('0x2e')],_0x1f38c2[_0x81b3('0x2d')]));if(_0x2112fa[_0x81b3('0x2e')][_0x81b3('0x37')]){_0x1142c5[_0x81b3('0x35')]=_['merge'](_0x1142c5['where'],{'$or':_['map'](_0x1142c5[_0x81b3('0x2f')],function(_0x1dc2d8){var _0x555dbb={};_0x555dbb[_0x1dc2d8]={'$like':'%'+_0x2112fa[_0x81b3('0x2e')][_0x81b3('0x37')]+'%'};return _0x555dbb;})});}_0x1142c5=_['merge']({},_0x1142c5,_0x2112fa[_0x81b3('0x38')]);var _0x1865be={'where':_0x1142c5[_0x81b3('0x35')]};return db[_0x81b3('0x29')][_0x81b3('0x39')](_0x1865be)[_0x81b3('0x20')](function(_0x25cd8f){_0x2b6982[_0x81b3('0x39')]=_0x25cd8f;if(_0x2112fa[_0x81b3('0x2e')][_0x81b3('0x3a')]){_0x1142c5[_0x81b3('0x3b')]=[{'all':!![]}];}return db['CmCompany'][_0x81b3('0x3c')](_0x1142c5);})[_0x81b3('0x20')](function(_0x1b0d3b){_0x2b6982[_0x81b3('0x3d')]=_0x1b0d3b;return _0x2b6982;})[_0x81b3('0x20')](respondWithFilteredResult(_0x2cd164,_0x1142c5))[_0x81b3('0x3e')](handleError(_0x2cd164,null));})[_0x81b3('0x3e')](handleError(_0x2cd164,null));};exports[_0x81b3('0x3f')]=function(_0x384e33,_0x44cbf1){var _0x1f29ed={'raw':![],'where':{'id':_0x384e33[_0x81b3('0x40')]['id']}},_0x9093cd={};_0x9093cd[_0x81b3('0x2b')]=_[_0x81b3('0x2c')](db[_0x81b3('0x29')]['rawAttributes']);_0x9093cd['query']=_[_0x81b3('0x2c')](_0x384e33[_0x81b3('0x2e')]);_0x9093cd[_0x81b3('0x2d')]=_[_0x81b3('0x41')](_0x9093cd[_0x81b3('0x2b')],_0x9093cd[_0x81b3('0x2e')]);_0x1f29ed[_0x81b3('0x2f')]=_[_0x81b3('0x41')](_0x9093cd[_0x81b3('0x2b')],qs['fields'](_0x384e33[_0x81b3('0x2e')]['fields']));_0x1f29ed[_0x81b3('0x2f')]=_0x1f29ed['attributes'][_0x81b3('0x42')]?_0x1f29ed[_0x81b3('0x2f')]:_0x9093cd[_0x81b3('0x2b')];if(_0x384e33[_0x81b3('0x2e')][_0x81b3('0x3a')]){_0x1f29ed[_0x81b3('0x3b')]=[{'all':!![]}];}_0x1f29ed=_['merge']({},_0x1f29ed,_0x384e33[_0x81b3('0x38')]);return db[_0x81b3('0x29')]['find'](_0x1f29ed)[_0x81b3('0x20')](handleEntityNotFound(_0x44cbf1,null))[_0x81b3('0x20')](respondWithResult(_0x44cbf1,null))[_0x81b3('0x3e')](handleError(_0x44cbf1,null));};exports['create']=function(_0x12c862,_0x306356){return db[_0x81b3('0x29')][_0x81b3('0x43')](_0x12c862[_0x81b3('0x44')],{})[_0x81b3('0x20')](function(_0x2efb4f){var _0x1ba7bc=_0x12c862[_0x81b3('0x45')][_0x81b3('0x22')]({'plain':!![]});if(!_0x1ba7bc)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x1ba7bc[_0x81b3('0x46')]===_0x81b3('0x45')){var _0x59c5d5=_0x2efb4f['get']({'plain':!![]});var _0x951ebd=_0x81b3('0x47');return db[_0x81b3('0x48')][_0x81b3('0x49')]({'where':{'name':_0x951ebd,'userProfileId':_0x1ba7bc[_0x81b3('0x4a')]},'raw':!![]})[_0x81b3('0x20')](function(_0x302368){if(_0x302368&&_0x302368[_0x81b3('0x4b')]===0x0){return db[_0x81b3('0x23')]['create']({'name':_0x59c5d5[_0x81b3('0x27')],'resourceId':_0x59c5d5['id'],'type':_0x302368['name'],'sectionId':_0x302368['id']},{})[_0x81b3('0x20')](function(){return _0x2efb4f;});}else{return _0x2efb4f;}})[_0x81b3('0x3e')](function(_0x4fc347){logger[_0x81b3('0x25')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x4fc347);throw _0x4fc347;});}return _0x2efb4f;})[_0x81b3('0x20')](respondWithResult(_0x306356,0xc9))[_0x81b3('0x3e')](handleError(_0x306356,null));};exports['update']=function(_0x2f5dda,_0xa94de5){if(_0x2f5dda[_0x81b3('0x44')]['id']){delete _0x2f5dda['body']['id'];}return db[_0x81b3('0x29')][_0x81b3('0x49')]({'where':{'id':_0x2f5dda[_0x81b3('0x40')]['id']}})[_0x81b3('0x20')](handleEntityNotFound(_0xa94de5,null))[_0x81b3('0x20')](saveUpdates(_0x2f5dda[_0x81b3('0x44')],null))[_0x81b3('0x20')](respondWithResult(_0xa94de5,null))[_0x81b3('0x3e')](handleError(_0xa94de5,null));};exports[_0x81b3('0x21')]=function(_0xa26623,_0x86e2d8){return db[_0x81b3('0x29')][_0x81b3('0x49')]({'where':{'id':_0xa26623['params']['id']}})[_0x81b3('0x20')](handleEntityNotFound(_0x86e2d8,null))['then'](removeEntity(_0x86e2d8,null))[_0x81b3('0x3e')](handleError(_0x86e2d8,null));};exports[_0x81b3('0x2a')]=function(_0x2ab70b,_0x43886f){return db[_0x81b3('0x29')]['describe']()[_0x81b3('0x20')](respondWithResult(_0x43886f,null))[_0x81b3('0x3e')](handleError(_0x43886f,null));};exports[_0x81b3('0x4c')]=function(_0x1137fa,_0x2880c1,_0x54866c){return db[_0x81b3('0x4d')][_0x81b3('0x49')]({'where':{'id':_0x1137fa[_0x81b3('0x40')]['id']}})[_0x81b3('0x20')](handleEntityNotFound(_0x2880c1,null))['then'](function(_0x392a54){if(_0x392a54){return _0x392a54[_0x81b3('0x4c')](_0x1137fa[_0x81b3('0x44')]['ids'],_['omit'](_0x1137fa['body'],[_0x81b3('0x4e'),'id'])||{});}})[_0x81b3('0x20')](respondWithResult(_0x2880c1,null))[_0x81b3('0x3e')](handleError(_0x2880c1,null));};exports[_0x81b3('0x4f')]=function(_0x548584,_0x3bdb78,_0x26eff7){var _0x517806={};var _0x26a5d7={};var _0x4b0ca9;var _0xa9242;return db[_0x81b3('0x29')][_0x81b3('0x50')]({'where':{'id':_0x548584[_0x81b3('0x40')]['id']}})[_0x81b3('0x20')](handleEntityNotFound(_0x3bdb78,null))[_0x81b3('0x20')](function(_0x1c9afa){if(_0x1c9afa){_0x4b0ca9=_0x1c9afa;_0x26a5d7[_0x81b3('0x2b')]=_[_0x81b3('0x2c')](db[_0x81b3('0x4d')]['rawAttributes']);_0x26a5d7[_0x81b3('0x2e')]=_[_0x81b3('0x2c')](_0x548584[_0x81b3('0x2e')]);_0x26a5d7[_0x81b3('0x2d')]=_[_0x81b3('0x41')](_0x26a5d7[_0x81b3('0x2b')],_0x26a5d7[_0x81b3('0x2e')]);_0x517806[_0x81b3('0x2f')]=_[_0x81b3('0x41')](_0x26a5d7[_0x81b3('0x2b')],qs[_0x81b3('0x30')](_0x548584[_0x81b3('0x2e')][_0x81b3('0x30')]));_0x517806[_0x81b3('0x2f')]=_0x517806[_0x81b3('0x2f')][_0x81b3('0x42')]?_0x517806['attributes']:_0x26a5d7[_0x81b3('0x2b')];_0x517806['order']=qs['sort'](_0x548584[_0x81b3('0x2e')][_0x81b3('0x34')]);_0x517806[_0x81b3('0x35')]=qs[_0x81b3('0x2d')](_[_0x81b3('0x36')](_0x548584[_0x81b3('0x2e')],_0x26a5d7['filters']));if(_0x548584[_0x81b3('0x2e')][_0x81b3('0x37')]){_0x517806[_0x81b3('0x35')]=_[_0x81b3('0x51')](_0x517806['where'],{'$or':_[_0x81b3('0x52')](_0x517806[_0x81b3('0x2f')],function(_0x19ae7f){var _0x1bd740={};_0x1bd740[_0x19ae7f]={'$like':'%'+_0x548584[_0x81b3('0x2e')][_0x81b3('0x37')]+'%'};return _0x1bd740;})});}_0x517806=_[_0x81b3('0x51')]({},_0x517806,_0x548584[_0x81b3('0x38')]);return _0x4b0ca9[_0x81b3('0x4f')](_0x517806);}})[_0x81b3('0x20')](function(_0x2d9ce2){if(_0x2d9ce2){_0xa9242=_0x2d9ce2[_0x81b3('0x42')];if(!_0x548584['query'][_0x81b3('0x53')](_0x81b3('0x31'))){_0x517806[_0x81b3('0x32')]=qs['limit'](_0x548584['query']['limit']);_0x517806[_0x81b3('0x1b')]=qs['offset'](_0x548584[_0x81b3('0x2e')][_0x81b3('0x1b')]);}return _0x4b0ca9[_0x81b3('0x4f')](_0x517806);}})[_0x81b3('0x20')](function(_0x2f5144){if(_0x2f5144){return _0x2f5144?{'count':_0xa9242,'rows':_0x2f5144}:null;}})[_0x81b3('0x20')](respondWithResult(_0x3bdb78,null))['catch'](handleError(_0x3bdb78,null));}; \ No newline at end of file +var _0xe9a1=['bluebird','mustache','util','path','sox','to-csv','lodash','squel','crypto','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../mysqldb','sendStatus','status','end','count','offset','limit','set','Content-Range','json','apply','save','update','then','destroy','get','UserProfileResource','error','name','send','CmCompany','describe','model','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','where','pick','filter','merge','includeAll','findAll','rows','show','params','rawAttributes','include','find','catch','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','Companies','UserProfileSection','autoAssociation','create','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','addContacts','ids','omit','getContacts','findOne','CmContact','sort','options','html-pdf','zip-dir','fast-json-patch','moment'];(function(_0x2abd99,_0x1072fa){var _0x318783=function(_0x2b824b){while(--_0x2b824b){_0x2abd99['push'](_0x2abd99['shift']());}};_0x318783(++_0x1072fa);}(_0xe9a1,0xfe));var _0x1e9a=function(_0x472a97,_0x19dc07){_0x472a97=_0x472a97-0x0;var _0x1e6be6=_0xe9a1[_0x472a97];return _0x1e6be6;};'use strict';var pdf=require(_0x1e9a('0x0'));var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x1e9a('0x1'));var jsonpatch=require(_0x1e9a('0x2'));var rp=require('request-promise');var moment=require(_0x1e9a('0x3'));var BPromise=require(_0x1e9a('0x4'));var Mustache=require(_0x1e9a('0x5'));var util=require(_0x1e9a('0x6'));var path=require(_0x1e9a('0x7'));var sox=require(_0x1e9a('0x8'));var csv=require(_0x1e9a('0x9'));var ejs=require('ejs');var fs=require('fs');var _=require(_0x1e9a('0xa'));var squel=require(_0x1e9a('0xb'));var crypto=require(_0x1e9a('0xc'));var jsforce=require('jsforce');var deskjs=require(_0x1e9a('0xd'));var toCsv=require(_0x1e9a('0x9'));var querystring=require(_0x1e9a('0xe'));var Papa=require('papaparse');var Redis=require(_0x1e9a('0xf'));var authService=require(_0x1e9a('0x10'));var qs=require(_0x1e9a('0x11'));var as=require(_0x1e9a('0x12'));var hardwareService=require(_0x1e9a('0x13'));var logger=require(_0x1e9a('0x14'))(_0x1e9a('0x15'));var utils=require('../../config/utils');var config=require(_0x1e9a('0x16'));var db=require(_0x1e9a('0x17'))['db'];function respondWithStatusCode(_0xaa210e,_0x15d067){_0x15d067=_0x15d067||0xcc;return function(_0x112a9d){if(_0x112a9d){return _0xaa210e[_0x1e9a('0x18')](_0x15d067);}return _0xaa210e[_0x1e9a('0x19')](_0x15d067)[_0x1e9a('0x1a')]();};}function respondWithResult(_0x4e9ac4,_0x32e45d){_0x32e45d=_0x32e45d||0xc8;return function(_0xaf9959){if(_0xaf9959){return _0x4e9ac4[_0x1e9a('0x19')](_0x32e45d)['json'](_0xaf9959);}};}function respondWithFilteredResult(_0x1eebc2,_0x29ad94){return function(_0x11c026){if(_0x11c026){var _0x115d50=_0x11c026[_0x1e9a('0x1b')],_0x4a9906=_0x29ad94[_0x1e9a('0x1c')],_0x286a40=_0x29ad94['offset']+_0x29ad94[_0x1e9a('0x1d')],_0x25f6cd;if(_0x286a40>=_0x115d50){_0x286a40=_0x115d50;_0x25f6cd=0xc8;}else{_0x25f6cd=0xce;}_0x1eebc2['status'](_0x25f6cd);return _0x1eebc2[_0x1e9a('0x1e')](_0x1e9a('0x1f'),_0x4a9906+'-'+_0x286a40+'/'+_0x115d50)[_0x1e9a('0x20')](_0x11c026);}return null;};}function patchUpdates(_0xa0e29f){return function(_0x5dd976){try{jsonpatch[_0x1e9a('0x21')](_0x5dd976,_0xa0e29f,!![]);}catch(_0x21df32){return BPromise['reject'](_0x21df32);}return _0x5dd976[_0x1e9a('0x22')]();};}function saveUpdates(_0x43125f,_0x3cd0d3){return function(_0x1512af){if(_0x1512af){return _0x1512af[_0x1e9a('0x23')](_0x43125f)[_0x1e9a('0x24')](function(_0x5b5491){return _0x5b5491;});}return null;};}function removeEntity(_0x4f075,_0x3098cd){return function(_0x563e2b){if(_0x563e2b){return _0x563e2b[_0x1e9a('0x25')]()[_0x1e9a('0x24')](function(){var _0x409a80=_0x563e2b[_0x1e9a('0x26')]({'plain':!![]});var _0x32beae='Companies';return db[_0x1e9a('0x27')][_0x1e9a('0x25')]({'where':{'type':_0x32beae,'resourceId':_0x409a80['id']}})[_0x1e9a('0x24')](function(){return _0x563e2b;});})['then'](function(){_0x4f075[_0x1e9a('0x19')](0xcc)[_0x1e9a('0x1a')]();});}};}function handleEntityNotFound(_0x4151ed,_0x5e1d48){return function(_0x66bb32){if(!_0x66bb32){_0x4151ed['sendStatus'](0x194);}return _0x66bb32;};}function handleError(_0x191f51,_0x5dd01e){_0x5dd01e=_0x5dd01e||0x1f4;return function(_0x1907ca){logger[_0x1e9a('0x28')](_0x1907ca['stack']);if(_0x1907ca[_0x1e9a('0x29')]){delete _0x1907ca['name'];}_0x191f51['status'](_0x5dd01e)[_0x1e9a('0x2a')](_0x1907ca);};}exports['index']=function(_0x3e2cca,_0x4fdfcf){var _0x55d63f={},_0x278265={},_0x2cde86={'count':0x0,'rows':[]};return db[_0x1e9a('0x2b')][_0x1e9a('0x2c')]()[_0x1e9a('0x24')](function(_0x5b530e){_0x278265[_0x1e9a('0x2d')]=_[_0x1e9a('0x2e')](_0x5b530e);_0x278265[_0x1e9a('0x2f')]=_[_0x1e9a('0x2e')](_0x3e2cca[_0x1e9a('0x2f')]);_0x278265[_0x1e9a('0x30')]=_[_0x1e9a('0x31')](_0x278265[_0x1e9a('0x2d')],_0x278265['query']);_0x55d63f[_0x1e9a('0x32')]=_[_0x1e9a('0x31')](_0x278265[_0x1e9a('0x2d')],qs['fields'](_0x3e2cca[_0x1e9a('0x2f')][_0x1e9a('0x33')]));_0x55d63f[_0x1e9a('0x32')]=_0x55d63f['attributes'][_0x1e9a('0x34')]?_0x55d63f[_0x1e9a('0x32')]:_0x278265['model'];if(!_0x3e2cca['query'][_0x1e9a('0x35')](_0x1e9a('0x36'))){_0x55d63f[_0x1e9a('0x1d')]=qs['limit'](_0x3e2cca['query']['limit']);_0x55d63f['offset']=qs[_0x1e9a('0x1c')](_0x3e2cca[_0x1e9a('0x2f')][_0x1e9a('0x1c')]);}_0x55d63f[_0x1e9a('0x37')]=qs['sort'](_0x3e2cca[_0x1e9a('0x2f')]['sort']);_0x55d63f[_0x1e9a('0x38')]=qs[_0x1e9a('0x30')](_[_0x1e9a('0x39')](_0x3e2cca[_0x1e9a('0x2f')],_0x278265['filters']));if(_0x3e2cca[_0x1e9a('0x2f')][_0x1e9a('0x3a')]){_0x55d63f[_0x1e9a('0x38')]=_[_0x1e9a('0x3b')](_0x55d63f['where'],{'$or':_['map'](_0x55d63f['attributes'],function(_0x5d2853){var _0x2ff554={};_0x2ff554[_0x5d2853]={'$like':'%'+_0x3e2cca['query']['filter']+'%'};return _0x2ff554;})});}_0x55d63f=_[_0x1e9a('0x3b')]({},_0x55d63f,_0x3e2cca['options']);var _0x45f9a8={'where':_0x55d63f['where']};return db[_0x1e9a('0x2b')][_0x1e9a('0x1b')](_0x45f9a8)[_0x1e9a('0x24')](function(_0x3d3292){_0x2cde86[_0x1e9a('0x1b')]=_0x3d3292;if(_0x3e2cca[_0x1e9a('0x2f')][_0x1e9a('0x3c')]){_0x55d63f['include']=[{'all':!![]}];}return db[_0x1e9a('0x2b')][_0x1e9a('0x3d')](_0x55d63f);})[_0x1e9a('0x24')](function(_0x481ef8){_0x2cde86[_0x1e9a('0x3e')]=_0x481ef8;return _0x2cde86;})[_0x1e9a('0x24')](respondWithFilteredResult(_0x4fdfcf,_0x55d63f))['catch'](handleError(_0x4fdfcf,null));})['catch'](handleError(_0x4fdfcf,null));};exports[_0x1e9a('0x3f')]=function(_0x2c2588,_0x260551){var _0x4f4df0={'raw':![],'where':{'id':_0x2c2588[_0x1e9a('0x40')]['id']}},_0x5449df={};_0x5449df[_0x1e9a('0x2d')]=_[_0x1e9a('0x2e')](db['CmCompany'][_0x1e9a('0x41')]);_0x5449df[_0x1e9a('0x2f')]=_[_0x1e9a('0x2e')](_0x2c2588[_0x1e9a('0x2f')]);_0x5449df[_0x1e9a('0x30')]=_[_0x1e9a('0x31')](_0x5449df[_0x1e9a('0x2d')],_0x5449df['query']);_0x4f4df0['attributes']=_[_0x1e9a('0x31')](_0x5449df[_0x1e9a('0x2d')],qs[_0x1e9a('0x33')](_0x2c2588[_0x1e9a('0x2f')]['fields']));_0x4f4df0[_0x1e9a('0x32')]=_0x4f4df0[_0x1e9a('0x32')][_0x1e9a('0x34')]?_0x4f4df0[_0x1e9a('0x32')]:_0x5449df[_0x1e9a('0x2d')];if(_0x2c2588['query'][_0x1e9a('0x3c')]){_0x4f4df0[_0x1e9a('0x42')]=[{'all':!![]}];}_0x4f4df0=_[_0x1e9a('0x3b')]({},_0x4f4df0,_0x2c2588['options']);return db[_0x1e9a('0x2b')][_0x1e9a('0x43')](_0x4f4df0)['then'](handleEntityNotFound(_0x260551,null))[_0x1e9a('0x24')](respondWithResult(_0x260551,null))[_0x1e9a('0x44')](handleError(_0x260551,null));};exports['create']=function(_0x4dfa74,_0x5c71ed){return db[_0x1e9a('0x2b')]['create'](_0x4dfa74[_0x1e9a('0x45')],{})['then'](function(_0x3e2d8e){var _0x4884fa=_0x4dfa74[_0x1e9a('0x46')][_0x1e9a('0x26')]({'plain':!![]});if(!_0x4884fa)throw new Error(_0x1e9a('0x47'));if(_0x4884fa[_0x1e9a('0x48')]==='user'){var _0x481c40=_0x3e2d8e[_0x1e9a('0x26')]({'plain':!![]});var _0x92803f=_0x1e9a('0x49');return db[_0x1e9a('0x4a')][_0x1e9a('0x43')]({'where':{'name':_0x92803f,'userProfileId':_0x4884fa['userProfileId']},'raw':!![]})[_0x1e9a('0x24')](function(_0x210c61){if(_0x210c61&&_0x210c61[_0x1e9a('0x4b')]===0x0){return db[_0x1e9a('0x27')][_0x1e9a('0x4c')]({'name':_0x481c40['name'],'resourceId':_0x481c40['id'],'type':_0x210c61[_0x1e9a('0x29')],'sectionId':_0x210c61['id']},{})[_0x1e9a('0x24')](function(){return _0x3e2d8e;});}else{return _0x3e2d8e;}})['catch'](function(_0x300c34){logger[_0x1e9a('0x28')](_0x1e9a('0x4d'),_0x300c34);throw _0x300c34;});}return _0x3e2d8e;})[_0x1e9a('0x24')](respondWithResult(_0x5c71ed,0xc9))[_0x1e9a('0x44')](handleError(_0x5c71ed,null));};exports[_0x1e9a('0x23')]=function(_0x574edd,_0xff8f16){if(_0x574edd[_0x1e9a('0x45')]['id']){delete _0x574edd[_0x1e9a('0x45')]['id'];}return db[_0x1e9a('0x2b')][_0x1e9a('0x43')]({'where':{'id':_0x574edd['params']['id']}})['then'](handleEntityNotFound(_0xff8f16,null))[_0x1e9a('0x24')](saveUpdates(_0x574edd[_0x1e9a('0x45')],null))[_0x1e9a('0x24')](respondWithResult(_0xff8f16,null))[_0x1e9a('0x44')](handleError(_0xff8f16,null));};exports[_0x1e9a('0x25')]=function(_0x4c16f6,_0x1be5fc){return db[_0x1e9a('0x2b')]['find']({'where':{'id':_0x4c16f6[_0x1e9a('0x40')]['id']}})[_0x1e9a('0x24')](handleEntityNotFound(_0x1be5fc,null))['then'](removeEntity(_0x1be5fc,null))[_0x1e9a('0x44')](handleError(_0x1be5fc,null));};exports[_0x1e9a('0x2c')]=function(_0x240981,_0x432b01){return db['CmCompany']['describe']()[_0x1e9a('0x24')](respondWithResult(_0x432b01,null))['catch'](handleError(_0x432b01,null));};exports[_0x1e9a('0x4e')]=function(_0x71368f,_0x190dea,_0x4a31ef){return db['CmContact'][_0x1e9a('0x43')]({'where':{'id':_0x71368f[_0x1e9a('0x40')]['id']}})[_0x1e9a('0x24')](handleEntityNotFound(_0x190dea,null))[_0x1e9a('0x24')](function(_0x567630){if(_0x567630){return _0x567630[_0x1e9a('0x4e')](_0x71368f[_0x1e9a('0x45')][_0x1e9a('0x4f')],_[_0x1e9a('0x50')](_0x71368f[_0x1e9a('0x45')],['ids','id'])||{});}})[_0x1e9a('0x24')](respondWithResult(_0x190dea,null))['catch'](handleError(_0x190dea,null));};exports[_0x1e9a('0x51')]=function(_0x72e20b,_0x5f55c5,_0x47a279){var _0x30e36c={};var _0x2ba3e1={};var _0x31c0df;var _0x80c583;return db['CmCompany'][_0x1e9a('0x52')]({'where':{'id':_0x72e20b[_0x1e9a('0x40')]['id']}})['then'](handleEntityNotFound(_0x5f55c5,null))[_0x1e9a('0x24')](function(_0x4c4c35){if(_0x4c4c35){_0x31c0df=_0x4c4c35;_0x2ba3e1[_0x1e9a('0x2d')]=_[_0x1e9a('0x2e')](db[_0x1e9a('0x53')][_0x1e9a('0x41')]);_0x2ba3e1[_0x1e9a('0x2f')]=_['keys'](_0x72e20b[_0x1e9a('0x2f')]);_0x2ba3e1['filters']=_[_0x1e9a('0x31')](_0x2ba3e1[_0x1e9a('0x2d')],_0x2ba3e1[_0x1e9a('0x2f')]);_0x30e36c['attributes']=_['intersection'](_0x2ba3e1[_0x1e9a('0x2d')],qs[_0x1e9a('0x33')](_0x72e20b[_0x1e9a('0x2f')][_0x1e9a('0x33')]));_0x30e36c[_0x1e9a('0x32')]=_0x30e36c[_0x1e9a('0x32')]['length']?_0x30e36c[_0x1e9a('0x32')]:_0x2ba3e1['model'];_0x30e36c[_0x1e9a('0x37')]=qs[_0x1e9a('0x54')](_0x72e20b[_0x1e9a('0x2f')][_0x1e9a('0x54')]);_0x30e36c[_0x1e9a('0x38')]=qs['filters'](_[_0x1e9a('0x39')](_0x72e20b[_0x1e9a('0x2f')],_0x2ba3e1['filters']));if(_0x72e20b[_0x1e9a('0x2f')]['filter']){_0x30e36c[_0x1e9a('0x38')]=_[_0x1e9a('0x3b')](_0x30e36c['where'],{'$or':_['map'](_0x30e36c['attributes'],function(_0x1e226){var _0x3df876={};_0x3df876[_0x1e226]={'$like':'%'+_0x72e20b['query']['filter']+'%'};return _0x3df876;})});}_0x30e36c=_['merge']({},_0x30e36c,_0x72e20b[_0x1e9a('0x55')]);return _0x31c0df[_0x1e9a('0x51')](_0x30e36c);}})[_0x1e9a('0x24')](function(_0x35a9e3){if(_0x35a9e3){_0x80c583=_0x35a9e3[_0x1e9a('0x34')];if(!_0x72e20b[_0x1e9a('0x2f')][_0x1e9a('0x35')]('nolimit')){_0x30e36c[_0x1e9a('0x1d')]=qs[_0x1e9a('0x1d')](_0x72e20b['query']['limit']);_0x30e36c['offset']=qs[_0x1e9a('0x1c')](_0x72e20b[_0x1e9a('0x2f')][_0x1e9a('0x1c')]);}return _0x31c0df[_0x1e9a('0x51')](_0x30e36c);}})[_0x1e9a('0x24')](function(_0x4376d0){if(_0x4376d0){return _0x4376d0?{'count':_0x80c583,'rows':_0x4376d0}:null;}})['then'](respondWithResult(_0x5f55c5,null))['catch'](handleError(_0x5f55c5,null));}; \ No newline at end of file diff --git a/server/api/cmCompany/cmCompany.model.js b/server/api/cmCompany/cmCompany.model.js index b8b305f..9997eeb 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 _0x64f5=['./cmCompany.attributes','exports','CmCompany','cm_companies','lodash','moment','request-promise','path','../../config/environment'];(function(_0x1abceb,_0x45ab78){var _0x17a769=function(_0x16e616){while(--_0x16e616){_0x1abceb['push'](_0x1abceb['shift']());}};_0x17a769(++_0x45ab78);}(_0x64f5,0x17e));var _0x564f=function(_0xb5fc12,_0x52af9e){_0xb5fc12=_0xb5fc12-0x0;var _0x41063c=_0x64f5[_0xb5fc12];return _0x41063c;};'use strict';var _=require(_0x564f('0x0'));var util=require('util');var logger=require('../../config/logger')('api');var moment=require(_0x564f('0x1'));var BPromise=require('bluebird');var rp=require(_0x564f('0x2'));var fs=require('fs');var path=require(_0x564f('0x3'));var rimraf=require('rimraf');var config=require(_0x564f('0x4'));var attributes=require(_0x564f('0x5'));module[_0x564f('0x6')]=function(_0x72b009,_0x4bbedf){return _0x72b009['define'](_0x564f('0x7'),attributes,{'tableName':_0x564f('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x61df=['api','moment','request-promise','path','../../config/environment','./cmCompany.attributes','exports','define','cm_companies'];(function(_0x35bc30,_0x4fbab8){var _0x16310f=function(_0x364bc6){while(--_0x364bc6){_0x35bc30['push'](_0x35bc30['shift']());}};_0x16310f(++_0x4fbab8);}(_0x61df,0xbd));var _0xf61d=function(_0x34cb78,_0x525224){_0x34cb78=_0x34cb78-0x0;var _0x199788=_0x61df[_0x34cb78];return _0x199788;};'use strict';var _=require('lodash');var util=require('util');var logger=require('../../config/logger')(_0xf61d('0x0'));var moment=require(_0xf61d('0x1'));var BPromise=require('bluebird');var rp=require(_0xf61d('0x2'));var fs=require('fs');var path=require(_0xf61d('0x3'));var rimraf=require('rimraf');var config=require(_0xf61d('0x4'));var attributes=require(_0xf61d('0x5'));module[_0xf61d('0x6')]=function(_0x458eb9,_0x2d0791){return _0x458eb9[_0xf61d('0x7')]('CmCompany',attributes,{'tableName':_0xf61d('0x8'),'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 fe30f62..6487c39 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 _0xa305=['../../config/utils','../../config/logger','rpc','../../config/environment','http','then','info','CmCompany,\x20%s,\x20%s','request\x20sent','debug','CmCompany,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','util','moment','randomstring'];(function(_0x561a43,_0x40392f){var _0x4a3c61=function(_0x520c37){while(--_0x520c37){_0x561a43['push'](_0x561a43['shift']());}};_0x4a3c61(++_0x40392f);}(_0xa305,0x107));var _0x5a30=function(_0x2e50b2,_0x36bed8){_0x2e50b2=_0x2e50b2-0x0;var _0x1fed51=_0xa305[_0x2e50b2];return _0x1fed51;};'use strict';var _=require('lodash');var util=require(_0x5a30('0x0'));var moment=require(_0x5a30('0x1'));var BPromise=require('bluebird');var rs=require(_0x5a30('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x5a30('0x3'));var logger=require(_0x5a30('0x4'))(_0x5a30('0x5'));var config=require(_0x5a30('0x6'));var jayson=require('jayson/promise');var client=jayson['client'][_0x5a30('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x2517aa,_0x22c4d1,_0x27985d){return new BPromise(function(_0x4a48b6,_0x500fe2){return client['request'](_0x2517aa,_0x27985d)[_0x5a30('0x8')](function(_0x26bd3f){logger[_0x5a30('0x9')](_0x5a30('0xa'),_0x22c4d1,_0x5a30('0xb'));logger[_0x5a30('0xc')](_0x5a30('0xd'),_0x22c4d1,_0x5a30('0xb'),JSON[_0x5a30('0xe')](_0x26bd3f));if(_0x26bd3f['error']){if(_0x26bd3f[_0x5a30('0xf')][_0x5a30('0x10')]===0x1f4){logger[_0x5a30('0xf')](_0x5a30('0xa'),_0x22c4d1,_0x26bd3f[_0x5a30('0xf')][_0x5a30('0x11')]);return _0x500fe2(_0x26bd3f['error'][_0x5a30('0x11')]);}logger[_0x5a30('0xf')](_0x5a30('0xa'),_0x22c4d1,_0x26bd3f[_0x5a30('0xf')][_0x5a30('0x11')]);return _0x4a48b6(_0x26bd3f['error'][_0x5a30('0x11')]);}else{logger[_0x5a30('0x9')](_0x5a30('0xa'),_0x22c4d1,_0x5a30('0xb'));_0x4a48b6(_0x26bd3f[_0x5a30('0x12')][_0x5a30('0x11')]);}})['catch'](function(_0x39c5ec){logger[_0x5a30('0xf')](_0x5a30('0xa'),_0x22c4d1,_0x39c5ec);_0x500fe2(_0x39c5ec);});});} \ No newline at end of file +var _0x6987=['code','CmCompany,\x20%s,\x20%s','message','catch','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request','then','info','request\x20sent','debug','CmCompany,\x20%s,\x20%s,\x20%s','stringify','error'];(function(_0x461eaa,_0x5b9604){var _0x3f2756=function(_0xddf81a){while(--_0xddf81a){_0x461eaa['push'](_0x461eaa['shift']());}};_0x3f2756(++_0x5b9604);}(_0x6987,0x64));var _0x7698=function(_0x3ecc30,_0x75412b){_0x3ecc30=_0x3ecc30-0x0;var _0x2682bc=_0x6987[_0x3ecc30];return _0x2682bc;};'use strict';var _=require(_0x7698('0x0'));var util=require(_0x7698('0x1'));var moment=require(_0x7698('0x2'));var BPromise=require(_0x7698('0x3'));var rs=require(_0x7698('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x7698('0x5'))['db'];var utils=require(_0x7698('0x6'));var logger=require(_0x7698('0x7'))('rpc');var config=require(_0x7698('0x8'));var jayson=require(_0x7698('0x9'));var client=jayson[_0x7698('0xa')][_0x7698('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x15da1d,_0x48991b,_0x3d78a5){return new BPromise(function(_0x1927e7,_0x2b9a3c){return client[_0x7698('0xc')](_0x15da1d,_0x3d78a5)[_0x7698('0xd')](function(_0x539505){logger[_0x7698('0xe')]('CmCompany,\x20%s,\x20%s',_0x48991b,_0x7698('0xf'));logger[_0x7698('0x10')](_0x7698('0x11'),_0x48991b,'request\x20sent',JSON[_0x7698('0x12')](_0x539505));if(_0x539505['error']){if(_0x539505[_0x7698('0x13')][_0x7698('0x14')]===0x1f4){logger[_0x7698('0x13')](_0x7698('0x15'),_0x48991b,_0x539505[_0x7698('0x13')]['message']);return _0x2b9a3c(_0x539505[_0x7698('0x13')][_0x7698('0x16')]);}logger['error'](_0x7698('0x15'),_0x48991b,_0x539505[_0x7698('0x13')][_0x7698('0x16')]);return _0x1927e7(_0x539505['error'][_0x7698('0x16')]);}else{logger[_0x7698('0xe')]('CmCompany,\x20%s,\x20%s',_0x48991b,_0x7698('0xf'));_0x1927e7(_0x539505['result']['message']);}})[_0x7698('0x17')](function(_0x2529e1){logger[_0x7698('0x13')]('CmCompany,\x20%s,\x20%s',_0x48991b,_0x2529e1);_0x2b9a3c(_0x2529e1);});});} \ No newline at end of file diff --git a/server/api/cmCompany/index.js b/server/api/cmCompany/index.js index 577fa90..9a1236d 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 _0x8952=['/:id/contacts','getContacts','post','put','update','delete','destroy','exports','util','path','connect-timeout','express','Router','../../components/interaction/service','../../config/environment','./cmCompany.controller','isAuthenticated','index','get','describe','/:id','show'];(function(_0x5dc942,_0x51cd7a){var _0x58ba3f=function(_0x56f09d){while(--_0x56f09d){_0x5dc942['push'](_0x5dc942['shift']());}};_0x58ba3f(++_0x51cd7a);}(_0x8952,0x17e));var _0x2895=function(_0x4ea366,_0x2e6b8c){_0x4ea366=_0x4ea366-0x0;var _0xa6b75c=_0x8952[_0x4ea366];return _0xa6b75c;};'use strict';var multer=require('multer');var util=require(_0x2895('0x0'));var path=require(_0x2895('0x1'));var timeout=require(_0x2895('0x2'));var express=require(_0x2895('0x3'));var router=express[_0x2895('0x4')]();var auth=require('../../components/auth/service');var interaction=require(_0x2895('0x5'));var config=require(_0x2895('0x6'));var controller=require(_0x2895('0x7'));router['get']('/',auth[_0x2895('0x8')](),controller[_0x2895('0x9')]);router[_0x2895('0xa')]('/describe',auth['isAuthenticated'](),controller[_0x2895('0xb')]);router[_0x2895('0xa')](_0x2895('0xc'),auth[_0x2895('0x8')](),controller[_0x2895('0xd')]);router['get'](_0x2895('0xe'),auth['isAuthenticated'](),controller[_0x2895('0xf')]);router['post']('/',auth['isAuthenticated'](),controller['create']);router[_0x2895('0x10')](_0x2895('0xe'),auth[_0x2895('0x8')](),controller['addContacts']);router[_0x2895('0x11')](_0x2895('0xc'),auth['isAuthenticated'](),controller[_0x2895('0x12')]);router[_0x2895('0x13')]('/:id',auth['isAuthenticated'](),controller[_0x2895('0x14')]);module[_0x2895('0x15')]=router; \ No newline at end of file +var _0x0295=['index','/describe','/:id','show','/:id/contacts','getContacts','post','put','destroy','exports','multer','connect-timeout','../../components/auth/service','../../components/interaction/service','../../config/environment','./cmCompany.controller','get','isAuthenticated'];(function(_0x46412b,_0x2a3e72){var _0x4d6982=function(_0x1fcd92){while(--_0x1fcd92){_0x46412b['push'](_0x46412b['shift']());}};_0x4d6982(++_0x2a3e72);}(_0x0295,0x1f0));var _0x5029=function(_0x17017e,_0x509679){_0x17017e=_0x17017e-0x0;var _0xbc7086=_0x0295[_0x17017e];return _0xbc7086;};'use strict';var multer=require(_0x5029('0x0'));var util=require('util');var path=require('path');var timeout=require(_0x5029('0x1'));var express=require('express');var router=express['Router']();var auth=require(_0x5029('0x2'));var interaction=require(_0x5029('0x3'));var config=require(_0x5029('0x4'));var controller=require(_0x5029('0x5'));router[_0x5029('0x6')]('/',auth[_0x5029('0x7')](),controller[_0x5029('0x8')]);router[_0x5029('0x6')](_0x5029('0x9'),auth['isAuthenticated'](),controller['describe']);router['get'](_0x5029('0xa'),auth['isAuthenticated'](),controller[_0x5029('0xb')]);router['get'](_0x5029('0xc'),auth['isAuthenticated'](),controller[_0x5029('0xd')]);router[_0x5029('0xe')]('/',auth[_0x5029('0x7')](),controller['create']);router[_0x5029('0xe')](_0x5029('0xc'),auth[_0x5029('0x7')](),controller['addContacts']);router[_0x5029('0xf')](_0x5029('0xa'),auth['isAuthenticated'](),controller['update']);router['delete']('/:id',auth[_0x5029('0x7')](),controller[_0x5029('0x10')]);module[_0x5029('0x11')]=router; \ No newline at end of file diff --git a/server/api/cmContact/cmContact.attributes.js b/server/api/cmContact/cmContact.attributes.js index c409b7a..9748b17 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 _0x18ed=['DATE','NOW','lodash','STRING','INTEGER','UNSIGNED'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x18ed,0xe6));var _0xd18e=function(_0x1694f5,_0x49b7c3){_0x1694f5=_0x1694f5-0x0;var _0x5b4321=_0x18ed[_0x1694f5];return _0x5b4321;};'use strict';var _=require(_0xd18e('0x0'));var Sequelize=require('sequelize');module['exports']={'firstName':{'type':Sequelize[_0xd18e('0x1')],'allowNull':![]},'lastName':{'type':Sequelize['STRING']},'street':{'type':Sequelize[_0xd18e('0x1')]},'postalCode':{'type':Sequelize[_0xd18e('0x1')]},'city':{'type':Sequelize[_0xd18e('0x1')]},'country':{'type':Sequelize[_0xd18e('0x1')]},'dateOfBirth':{'type':Sequelize[_0xd18e('0x1')]},'description':{'type':Sequelize['TEXT']},'phone':{'type':Sequelize[_0xd18e('0x1')]},'mobile':{'type':Sequelize[_0xd18e('0x1')]},'fax':{'type':Sequelize['STRING']},'email':{'type':Sequelize['STRING']},'url':{'type':Sequelize[_0xd18e('0x1')]},'facebook':{'type':Sequelize[_0xd18e('0x1')]},'fb_data':{'type':Sequelize['STRING']},'twitter':{'type':Sequelize['STRING']},'skype':{'type':Sequelize[_0xd18e('0x1')]},'teams':{'type':Sequelize[_0xd18e('0x1')]},'viber':{'type':Sequelize['STRING']},'line':{'type':Sequelize[_0xd18e('0x1')]},'wechat':{'type':Sequelize[_0xd18e('0x1')]},'telegram':{'type':Sequelize['STRING']},'UserId':{'type':Sequelize[_0xd18e('0x2')]},'priority':{'type':Sequelize[_0xd18e('0x2')](0x2)[_0xd18e('0x3')],'defaultValue':0x2,'validate':{'min':0x0,'max':0x4}},'scheduledat':{'type':Sequelize[_0xd18e('0x4')],'defaultValue':Sequelize[_0xd18e('0x5')]}}; \ No newline at end of file +var _0xc413=['DATE','NOW','lodash','exports','STRING','TEXT','INTEGER','UNSIGNED'];(function(_0x47aa64,_0xfb8a07){var _0x549c7a=function(_0x266165){while(--_0x266165){_0x47aa64['push'](_0x47aa64['shift']());}};_0x549c7a(++_0xfb8a07);}(_0xc413,0x122));var _0x3c41=function(_0x501510,_0x61caa9){_0x501510=_0x501510-0x0;var _0x1e6ee5=_0xc413[_0x501510];return _0x1e6ee5;};'use strict';var _=require(_0x3c41('0x0'));var Sequelize=require('sequelize');module[_0x3c41('0x1')]={'firstName':{'type':Sequelize[_0x3c41('0x2')],'allowNull':![]},'lastName':{'type':Sequelize[_0x3c41('0x2')]},'street':{'type':Sequelize['STRING']},'postalCode':{'type':Sequelize[_0x3c41('0x2')]},'city':{'type':Sequelize[_0x3c41('0x2')]},'country':{'type':Sequelize[_0x3c41('0x2')]},'dateOfBirth':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0x3c41('0x3')]},'phone':{'type':Sequelize[_0x3c41('0x2')]},'mobile':{'type':Sequelize['STRING']},'fax':{'type':Sequelize[_0x3c41('0x2')]},'email':{'type':Sequelize['STRING']},'url':{'type':Sequelize['STRING']},'facebook':{'type':Sequelize[_0x3c41('0x2')]},'fb_data':{'type':Sequelize['STRING']},'twitter':{'type':Sequelize['STRING']},'skype':{'type':Sequelize['STRING']},'teams':{'type':Sequelize[_0x3c41('0x2')]},'viber':{'type':Sequelize[_0x3c41('0x2')]},'line':{'type':Sequelize['STRING']},'wechat':{'type':Sequelize[_0x3c41('0x2')]},'telegram':{'type':Sequelize[_0x3c41('0x2')]},'UserId':{'type':Sequelize[_0x3c41('0x4')]},'priority':{'type':Sequelize['INTEGER'](0x2)[_0x3c41('0x5')],'defaultValue':0x2,'validate':{'min':0x0,'max':0x4}},'scheduledat':{'type':Sequelize[_0x3c41('0x6')],'defaultValue':Sequelize[_0x3c41('0x7')]}}; \ No newline at end of file diff --git a/server/api/cmContact/cmContact.controller.js b/server/api/cmContact/cmContact.controller.js index 5ea17a4..f1b0492 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 _0x0283=['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.phone\x20LIKE\x20?','c.mobile\x20LIKE\x20?','c.fax\x20LIKE\x20?','isEmail','c.email\x20LIKE\x20?','c.lastName\x20LIKE\x20?','group','Sequelize','QueryTypes','clone','c.id','isEmpty','having','t.id\x20IN\x20?','resolve','some','user','getLists','c.ListId\x20IS\x20NULL','c.ListId\x20IN\x20?','sequelize','count','toString','keyBy','c.firstName','c.lastName','c.phone','c.fax','c.email','c.ListId','c.deletedAt','GROUP_CONCAT(DISTINCT\x20t.id)','TagIds','Tags','rows','params','catch','columnName','displayName','CmCustomField','alias','values','merge','body','findAll','get','mergeWith','tags','join','[CmContact][merge]\x20to\x20%s\x20from\x20%s','CmHopper','destroy','info','[CmContact][merge][destroy][CmHopper],\x20%s','CmHopperBlack','[CmContact][merge][destroy][CmHopperBlack],\x20%s','ChatInteraction','ChatMessage','ChatOfflineMessage','MailInteraction','MailMessage','SmsInteraction','SmsMessage','FaxMessage','OpenchannelInteraction','OpenchannelMessage','CmHopperFinal','ReportAgentPreview','VoiceCallReport','ChatQueueReport','FaxQueueReport','OpenchannelQueueReport','SmsQueueReport','JscriptySessionReport','create','each','duplicates','$or','ListId','findOrCreate','spread','show','find','color','omit','cf_%d','$and','pickBy','format','table','setFields','toParam','phone','getTags','rawAttributes','options','nolimit','setTags','ids','getHoppers','pick','ContactId','includeAll','include','getHopperHistories','CmHopperHistory','getHopperFinals','getJscriptySessions','uploadCsv','No\x20ListId\x20specified','binding_keys','No\x20association\x20keys\x20specified!','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','file','filename','chmodSync','0777','child_process','fork','../../components/import/cm/csv','binding_values','CompanyId','File\x20uploaded\x20correctly!','pid','createReadStream','parse','meta','agent','binding','../../components/import/cm/csv2','stringify','message','start\x20child\x20process\x20correctly!','html-pdf','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','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../mysqldb','redis','defaults','socket.io-emitter','register','sendStatus','end','status','offset','limit','set','Content-Range','json','apply','reject','save','update','then','error','name','send','CmContact','describe','keys','length','startsWith','push','findOne','trimStart','cf_','all','fieldType','type','model','query','filters','intersection','attributes','fields','hasOwnProperty','order','sort','where','select','field','from','tools_tags','cm_contacts','cm_user_has_contacts','uc.CmContactId\x20=\x20c.id','left_join','cm_contact_has_tags','t.id\x20=\x20ct.TagId','expr','parseSearch','search','sqlOperator','conditions','Tag','split','map','forEach','CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','union','User','and','uc.UserId\x20=\x20?','value','dateOfBirth','datetime','castTo','buildExpression','text','start','filter','isNil','Contact','concat','CONCAT_WS(\x27\x20\x27,\x20c.firstName,\x20c.lastName,\x20c.email)\x20LIKE\x20?','\x20=\x20?','tag','isArray'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x0283,0x92));var _0x3028=function(_0x40f991,_0x576819){_0x40f991=_0x40f991-0x0;var _0x38eca2=_0x0283[_0x40f991];return _0x38eca2;};'use strict';var pdf=require(_0x3028('0x0'));var emlformat=require(_0x3028('0x1'));var rimraf=require(_0x3028('0x2'));var zipdir=require(_0x3028('0x3'));var jsonpatch=require(_0x3028('0x4'));var rp=require(_0x3028('0x5'));var moment=require(_0x3028('0x6'));var BPromise=require(_0x3028('0x7'));var Mustache=require(_0x3028('0x8'));var util=require(_0x3028('0x9'));var path=require(_0x3028('0xa'));var sox=require('sox');var csv=require(_0x3028('0xb'));var ejs=require(_0x3028('0xc'));var fs=require('fs');var _=require(_0x3028('0xd'));var squel=require(_0x3028('0xe'));var crypto=require(_0x3028('0xf'));var jsforce=require(_0x3028('0x10'));var deskjs=require(_0x3028('0x11'));var toCsv=require(_0x3028('0xb'));var querystring=require(_0x3028('0x12'));var Papa=require(_0x3028('0x13'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x3028('0x14'));var as=require(_0x3028('0x15'));var hardwareService=require(_0x3028('0x16'));var logger=require(_0x3028('0x17'))('api');var utils=require(_0x3028('0x18'));var config=require('../../config/environment');var db=require(_0x3028('0x19'))['db'];config[_0x3028('0x1a')]=_[_0x3028('0x1b')](config[_0x3028('0x1a')],{'host':'localhost','port':0x18eb});var socket=require(_0x3028('0x1c'))(new Redis(config['redis']));require('./cmContact.socket')[_0x3028('0x1d')](socket);function respondWithStatusCode(_0x4695a5,_0x5e0f8d){_0x5e0f8d=_0x5e0f8d||0xcc;return function(_0x2246d7){if(_0x2246d7){return _0x4695a5[_0x3028('0x1e')](_0x5e0f8d);}return _0x4695a5['status'](_0x5e0f8d)[_0x3028('0x1f')]();};}function respondWithResult(_0x157b53,_0xc1d40f){_0xc1d40f=_0xc1d40f||0xc8;return function(_0x5139fd){if(_0x5139fd){return _0x157b53[_0x3028('0x20')](_0xc1d40f)['json'](_0x5139fd);}};}function respondWithFilteredResult(_0x1fe990,_0x55f2c1){return function(_0x4901e8){if(_0x4901e8){var _0x18af90=_0x4901e8['count'],_0x5e564b=_0x55f2c1[_0x3028('0x21')],_0x3dca41=_0x55f2c1[_0x3028('0x21')]+_0x55f2c1[_0x3028('0x22')],_0x12228c;if(_0x3dca41>=_0x18af90){_0x3dca41=_0x18af90;_0x12228c=0xc8;}else{_0x12228c=0xce;}_0x1fe990[_0x3028('0x20')](_0x12228c);return _0x1fe990[_0x3028('0x23')](_0x3028('0x24'),_0x5e564b+'-'+_0x3dca41+'/'+_0x18af90)[_0x3028('0x25')](_0x4901e8);}return null;};}function patchUpdates(_0x1d4189){return function(_0x31e55e){try{jsonpatch[_0x3028('0x26')](_0x31e55e,_0x1d4189,!![]);}catch(_0x5e3f79){return BPromise[_0x3028('0x27')](_0x5e3f79);}return _0x31e55e[_0x3028('0x28')]();};}function saveUpdates(_0x225f94,_0x251fcf){return function(_0x4a27d9){if(_0x4a27d9){return _0x4a27d9[_0x3028('0x29')](_0x225f94)[_0x3028('0x2a')](function(_0xf55bc5){return _0xf55bc5;});}return null;};}function removeEntity(_0x1ffb32,_0x389cd5){return function(_0x4edd1f){if(_0x4edd1f){return _0x4edd1f['destroy']()['then'](function(){_0x1ffb32[_0x3028('0x20')](0xcc)[_0x3028('0x1f')]();});}};}function handleEntityNotFound(_0x2528bc,_0x5c4578){return function(_0xe1bfb9){if(!_0xe1bfb9){_0x2528bc[_0x3028('0x1e')](0x194);}return _0xe1bfb9;};}function handleError(_0x102bce,_0x31c4d1){_0x31c4d1=_0x31c4d1||0x1f4;return function(_0x399cdc){logger[_0x3028('0x2b')](_0x399cdc['stack']);if(_0x399cdc[_0x3028('0x2c')]){delete _0x399cdc[_0x3028('0x2c')];}_0x102bce['status'](_0x31c4d1)[_0x3028('0x2d')](_0x399cdc);};}exports['index']=function(_0x5d34e5,_0x26d823){var _0x464829={},_0x13e5fb={},_0x22fce0={'count':0x0,'rows':[]};return db[_0x3028('0x2e')][_0x3028('0x2f')]()[_0x3028('0x2a')](function(_0x39e9e8){var _0x54ed9e=[];for(var _0x21cb11=0x0;_0x21cb110x1){_0x2a8bbe['or'](_0x3028('0x6d'),qs[_0x3028('0x6e')](_0x497aaa),null);}else{if(qs['isNumeric'](_0x497aaa)){_0x2a8bbe['or'](_0x3028('0x6f'),_0x497aaa+'%');_0x2a8bbe['or'](_0x3028('0x70'),_0x497aaa+'%');_0x2a8bbe['or'](_0x3028('0x71'),_0x497aaa+'%');_0x2a8bbe['or'](_0x3028('0x72'),_0x497aaa+'%');}else if(qs[_0x3028('0x73')](_0x497aaa)){_0x2a8bbe['or'](_0x3028('0x74'),_0x497aaa+'%');}else{_0x2a8bbe['or']('c.firstName\x20LIKE\x20?','%'+_0x497aaa+'%');_0x2a8bbe['or'](_0x3028('0x75'),'%'+_0x497aaa+'%');_0x2a8bbe['or'](_0x3028('0x74'),'%'+_0x497aaa+'%');}}}}_0xcd88c0['where'](_0x2a8bbe);_0xcd88c0[_0x3028('0x76')]('c.id');var _0x354867={'type':db[_0x3028('0x77')][_0x3028('0x78')]['SELECT'],'raw':!![]};var _0x59bfbd=_0xcd88c0[_0x3028('0x79')]()['field'](_0x3028('0x7a'));if(_0x464829['order']){_0x464829['order']['forEach'](function(_0x4add3c){_0xcd88c0[_0x3028('0x41')]('c.'+_0x4add3c[0x0],_0x4add3c[0x1]==='DESC'?![]:!![]);});}if(!_[_0x3028('0x7b')](_0x2de20a)){_0xcd88c0[_0x3028('0x7c')](_0x25d72d);_0x59bfbd['where'](_0x3028('0x7d'),_0x2de20a);}BPromise[_0x3028('0x7e')]()[_0x3028('0x2a')](function(){if(_0x50d012&&!_[_0x3028('0x7f')](_0x50d012[_0x3028('0x52')],[_0x3028('0x45'),_0x3028('0x59')])){return _0x5d34e5[_0x3028('0x80')][_0x3028('0x81')]({'attributes':['id'],'raw':!![]})[_0x3028('0x2a')](function(_0x11c591){if(_[_0x3028('0x7b')](_0x11c591)){_0x59bfbd['where']('c.ListId\x20IS\x20NULL');_0xcd88c0[_0x3028('0x43')](_0x3028('0x82'));}else{_0x59bfbd[_0x3028('0x43')]('c.ListId\x20IN\x20?',_[_0x3028('0x55')](_0x11c591,'id'));_0xcd88c0['where'](_0x3028('0x83'),_[_0x3028('0x55')](_0x11c591,'id'));}});}else{return;}})[_0x3028('0x2a')](function(){db[_0x3028('0x84')][_0x3028('0x3b')](_0x59bfbd['toString'](),_0x354867)[_0x3028('0x2a')](function(_0x4a7023){_0x22fce0[_0x3028('0x85')]=_0x4a7023[_0x3028('0x31')];if(_0x22fce0[_0x3028('0x85')]===0x0)return[];return db['sequelize'][_0x3028('0x3b')](_0x41e560[_0x3028('0x86')](),_0x354867);})[_0x3028('0x2a')](function(_0x740af2){_0x2d74ac=_[_0x3028('0x87')](_0x740af2,'id');_0x354867=_['merge'](_0x354867,{'model':db[_0x3028('0x2e')],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x5d34e5[_0x3028('0x3b')][_0x3028('0x3f')]){_0x464829[_0x3028('0x3e')][_0x3028('0x56')](function(_0x432043){_0xcd88c0['field']('c.'+_0x432043);});}else{_0xcd88c0[_0x3028('0x45')]('c.id');_0xcd88c0[_0x3028('0x45')](_0x3028('0x88'));_0xcd88c0['field'](_0x3028('0x89'));_0xcd88c0[_0x3028('0x45')](_0x3028('0x8a'));_0xcd88c0[_0x3028('0x45')]('c.mobile');_0xcd88c0[_0x3028('0x45')](_0x3028('0x8b'));_0xcd88c0[_0x3028('0x45')](_0x3028('0x8c'));_0xcd88c0['field'](_0x3028('0x8d'));_0xcd88c0[_0x3028('0x45')](_0x3028('0x8e'));_0xcd88c0[_0x3028('0x45')](_0x3028('0x8f'),_0x3028('0x90'));}if(_0x464829[_0x3028('0x22')])_0xcd88c0['limit'](_0x464829[_0x3028('0x22')]);if(_0x464829[_0x3028('0x21')])_0xcd88c0[_0x3028('0x21')](_0x464829[_0x3028('0x21')]);return db['sequelize'][_0x3028('0x3b')](_0xcd88c0['toString'](),_0x354867);})[_0x3028('0x2a')](function(_0x102cf9){_0x102cf9['forEach'](function(_0x3ab58a){if(_0x3ab58a['TagIds']){_0x3ab58a['Tags']=[];_0x3ab58a[_0x3028('0x90')]['split'](',')[_0x3028('0x56')](function(_0x54e63d){_0x3ab58a[_0x3028('0x91')][_0x3028('0x33')](_0x2d74ac[_0x54e63d]);});}delete _0x3ab58a[_0x3028('0x90')];});_0x22fce0[_0x3028('0x92')]=_0x102cf9;return _0x22fce0;})[_0x3028('0x2a')](respondWithFilteredResult(_0x26d823,_0x464829));});})['catch'](handleError(_0x26d823,null));};exports['destroy']=function(_0x50224f,_0x57960d){return db[_0x3028('0x2e')]['find']({'where':{'id':_0x50224f[_0x3028('0x93')]['id']}})[_0x3028('0x2a')](handleEntityNotFound(_0x57960d,null))[_0x3028('0x2a')](removeEntity(_0x57960d,null))[_0x3028('0x94')](handleError(_0x57960d,null));};exports[_0x3028('0x2f')]=function(_0x13e9be,_0x3561fc){return db[_0x3028('0x2e')]['describe']()[_0x3028('0x2a')](function(_0x405f0e){delete _0x405f0e['tags'];for(var _0x531eb2=0x0;_0x531eb2=_0x57fddb){_0x4601b2=_0x57fddb;_0xfbe0f3=0xc8;}else{_0xfbe0f3=0xce;}_0x791b31['status'](_0xfbe0f3);return _0x791b31[_0xbc46('0x23')](_0xbc46('0x24'),_0x24899e+'-'+_0x4601b2+'/'+_0x57fddb)['json'](_0x254098);}return null;};}function patchUpdates(_0x344656){return function(_0x33354e){try{jsonpatch[_0xbc46('0x25')](_0x33354e,_0x344656,!![]);}catch(_0x2f2cf3){return BPromise[_0xbc46('0x26')](_0x2f2cf3);}return _0x33354e['save']();};}function saveUpdates(_0x58d237,_0x260d16){return function(_0x19203a){if(_0x19203a){return _0x19203a[_0xbc46('0x27')](_0x58d237)[_0xbc46('0x28')](function(_0x44004d){return _0x44004d;});}return null;};}function removeEntity(_0x57c4a9,_0x7fe35c){return function(_0x1e53ec){if(_0x1e53ec){return _0x1e53ec[_0xbc46('0x29')]()[_0xbc46('0x28')](function(){_0x57c4a9[_0xbc46('0x1e')](0xcc)['end']();});}};}function handleEntityNotFound(_0x500f97,_0x170328){return function(_0x3ef76f){if(!_0x3ef76f){_0x500f97[_0xbc46('0x1d')](0x194);}return _0x3ef76f;};}function handleError(_0x4294c4,_0x59c9d5){_0x59c9d5=_0x59c9d5||0x1f4;return function(_0x38422f){logger[_0xbc46('0x2a')](_0x38422f[_0xbc46('0x2b')]);if(_0x38422f[_0xbc46('0x2c')]){delete _0x38422f['name'];}_0x4294c4['status'](_0x59c9d5)[_0xbc46('0x2d')](_0x38422f);};}exports[_0xbc46('0x2e')]=function(_0x2f3a21,_0x11bbd9){var _0x24c376={},_0x17bfd6={},_0x76a672={'count':0x0,'rows':[]};return db[_0xbc46('0x2f')]['describe']()[_0xbc46('0x28')](function(_0x4ac82e){var _0x757a9f=[];for(var _0x2c6c3d=0x0;_0x2c6c3d0x1){_0x554556['or'](_0xbc46('0x6b'),qs[_0xbc46('0x6c')](_0x279ab8),null);}else{if(qs['isNumeric'](_0x279ab8)){_0x554556['or'](_0xbc46('0x6d'),_0x279ab8+'%');_0x554556['or'](_0xbc46('0x6e'),_0x279ab8+'%');_0x554556['or']('c.mobile\x20LIKE\x20?',_0x279ab8+'%');_0x554556['or'](_0xbc46('0x6f'),_0x279ab8+'%');}else if(qs['isEmail'](_0x279ab8)){_0x554556['or'](_0xbc46('0x70'),_0x279ab8+'%');}else{_0x554556['or'](_0xbc46('0x71'),'%'+_0x279ab8+'%');_0x554556['or'](_0xbc46('0x72'),'%'+_0x279ab8+'%');_0x554556['or'](_0xbc46('0x70'),'%'+_0x279ab8+'%');}}}}_0x267af4[_0xbc46('0x41')](_0x554556);_0x267af4[_0xbc46('0x73')](_0xbc46('0x74'));var _0xe24724={'type':db[_0xbc46('0x75')][_0xbc46('0x76')][_0xbc46('0x77')],'raw':!![]};var _0x2ac755=_0x267af4[_0xbc46('0x78')]()[_0xbc46('0x44')](_0xbc46('0x74'));if(_0x24c376['order']){_0x24c376[_0xbc46('0x3f')][_0xbc46('0x55')](function(_0x4e5494){_0x267af4['order']('c.'+_0x4e5494[0x0],_0x4e5494[0x1]===_0xbc46('0x79')?![]:!![]);});}if(!_[_0xbc46('0x7a')](_0x2901df)){_0x267af4[_0xbc46('0x7b')](_0x55fad1);_0x2ac755[_0xbc46('0x41')](_0xbc46('0x7c'),_0x2901df);}BPromise[_0xbc46('0x7d')]()['then'](function(){if(_0x48112f&&!_[_0xbc46('0x7e')](_0x48112f['conditions'],[_0xbc46('0x44'),_0xbc46('0x57')])){return _0x2f3a21[_0xbc46('0x7f')]['getLists']({'attributes':['id'],'raw':!![]})[_0xbc46('0x28')](function(_0x871b7c){if(_['isEmpty'](_0x871b7c)){_0x2ac755[_0xbc46('0x41')](_0xbc46('0x80'));_0x267af4['where'](_0xbc46('0x80'));}else{_0x2ac755[_0xbc46('0x41')]('c.ListId\x20IN\x20?',_[_0xbc46('0x54')](_0x871b7c,'id'));_0x267af4[_0xbc46('0x41')](_0xbc46('0x65'),_[_0xbc46('0x54')](_0x871b7c,'id'));}});}else{return;}})[_0xbc46('0x28')](function(){db[_0xbc46('0x81')][_0xbc46('0x39')](_0x2ac755[_0xbc46('0x82')](),_0xe24724)['then'](function(_0x22797c){_0x76a672[_0xbc46('0x83')]=_0x22797c[_0xbc46('0x31')];if(_0x76a672[_0xbc46('0x83')]===0x0)return[];return db[_0xbc46('0x81')]['query'](_0x1bd662['toString'](),_0xe24724);})[_0xbc46('0x28')](function(_0x472810){_0x21234a=_[_0xbc46('0x84')](_0x472810,'id');_0xe24724=_[_0xbc46('0x85')](_0xe24724,{'model':db[_0xbc46('0x2f')],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x2f3a21[_0xbc46('0x39')]['fields']){_0x24c376[_0xbc46('0x3c')]['forEach'](function(_0x327dde){_0x267af4[_0xbc46('0x44')]('c.'+_0x327dde);});}else{_0x267af4['field'](_0xbc46('0x74'));_0x267af4['field']('c.firstName');_0x267af4[_0xbc46('0x44')](_0xbc46('0x86'));_0x267af4['field'](_0xbc46('0x87'));_0x267af4['field']('c.mobile');_0x267af4[_0xbc46('0x44')](_0xbc46('0x88'));_0x267af4[_0xbc46('0x44')](_0xbc46('0x89'));_0x267af4['field'](_0xbc46('0x8a'));_0x267af4[_0xbc46('0x44')](_0xbc46('0x8b'));_0x267af4[_0xbc46('0x44')](_0xbc46('0x8c'),'TagIds');}if(_0x24c376[_0xbc46('0x22')])_0x267af4['limit'](_0x24c376[_0xbc46('0x22')]);if(_0x24c376[_0xbc46('0x21')])_0x267af4['offset'](_0x24c376[_0xbc46('0x21')]);return db[_0xbc46('0x81')][_0xbc46('0x39')](_0x267af4[_0xbc46('0x82')](),_0xe24724);})['then'](function(_0x4a7ef2){_0x4a7ef2[_0xbc46('0x55')](function(_0x4abac0){if(_0x4abac0[_0xbc46('0x8d')]){_0x4abac0['Tags']=[];_0x4abac0[_0xbc46('0x8d')][_0xbc46('0x6a')](',')[_0xbc46('0x55')](function(_0x28393b){_0x4abac0[_0xbc46('0x8e')][_0xbc46('0x62')](_0x21234a[_0x28393b]);});}delete _0x4abac0['TagIds'];});_0x76a672[_0xbc46('0x8f')]=_0x4a7ef2;return _0x76a672;})[_0xbc46('0x28')](respondWithFilteredResult(_0x11bbd9,_0x24c376));});})['catch'](handleError(_0x11bbd9,null));};exports[_0xbc46('0x29')]=function(_0x584924,_0x354a14){return db[_0xbc46('0x2f')][_0xbc46('0x51')]({'where':{'id':_0x584924[_0xbc46('0x90')]['id']}})['then'](handleEntityNotFound(_0x354a14,null))[_0xbc46('0x28')](removeEntity(_0x354a14,null))[_0xbc46('0x91')](handleError(_0x354a14,null));};exports[_0xbc46('0x92')]=function(_0x1bf707,_0x3799ee){return db[_0xbc46('0x2f')][_0xbc46('0x92')]()['then'](function(_0x267e15){delete _0x267e15[_0xbc46('0x93')];for(var _0x115fef=0x0;_0x115fef{}\s\\|]/g,'-');_0x328693(null,util[_0x6eec('0x24')](_0x6eec('0x25'),path['basename'](_0x536429[_0x6eec('0x22')],path[_0x6eec('0x26')](_0x536429[_0x6eec('0x22')])),Date[_0x6eec('0x27')](),path[_0x6eec('0x26')](_0x536429[_0x6eec('0x22')])));}})});router['post'](_0x6eec('0x28'),upload[_0x6eec('0x29')](_0x6eec('0x2a')),controller[_0x6eec('0x2b')]);var upload=multer({'storage':multer[_0x6eec('0x1e')]({'destination':function(_0x1f386c,_0x29879c,_0x20bed3){_0x20bed3(null,path[_0x6eec('0x1f')](config['root'],_0x6eec('0x21')));},'filename':function(_0x44b31c,_0x30eb98,_0x275fd0){_0x30eb98['originalname']=_0x30eb98[_0x6eec('0x22')][_0x6eec('0x23')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0x275fd0(null,util['format']('%s-%s%s',path[_0x6eec('0x2c')](_0x30eb98['originalname'],path[_0x6eec('0x26')](_0x30eb98[_0x6eec('0x22')])),Date[_0x6eec('0x27')](),path[_0x6eec('0x26')](_0x30eb98[_0x6eec('0x22')])));}})});router[_0x6eec('0x17')](_0x6eec('0x2d'),upload[_0x6eec('0x29')](_0x6eec('0x2a')),controller[_0x6eec('0x2e')]);router['post'](_0x6eec('0x2f'),auth['isAuthenticated'](),controller[_0x6eec('0x30')]);router[_0x6eec('0x31')](_0x6eec('0xd'),auth['isAuthenticated'](),controller['update']);router['delete'](_0x6eec('0xd'),auth[_0x6eec('0xb')](),controller[_0x6eec('0x32')]);module[_0x6eec('0x33')]=router; \ No newline at end of file +var _0xb138=['file','upload','/upload/:id','import','put','/:id','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../config/environment','./cmContact.controller','get','index','isAuthenticated','describe','show','getTags','/:id/hoppers','/:id/hopper_histories','getHopperHistories','/:id/hopper_finals','/:id/jscripty_sessions','/merge','merge','post','/create_many','bulkCreate','/:id/tags','setTags','join','root','server/files/tmp','originalname','%s-%s%s','basename','extname','now','/csv','single','uploadCsv','format','/upload'];(function(_0x228641,_0x25d636){var _0x5d5d78=function(_0x4d5c6c){while(--_0x4d5c6c){_0x228641['push'](_0x228641['shift']());}};_0x5d5d78(++_0x25d636);}(_0xb138,0x1dd));var _0x8b13=function(_0x199a37,_0x5f545d){_0x199a37=_0x199a37-0x0;var _0x48d080=_0xb138[_0x199a37];return _0x48d080;};'use strict';var multer=require(_0x8b13('0x0'));var util=require(_0x8b13('0x1'));var path=require(_0x8b13('0x2'));var timeout=require(_0x8b13('0x3'));var express=require(_0x8b13('0x4'));var router=express[_0x8b13('0x5')]();var auth=require(_0x8b13('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x8b13('0x7'));var controller=require(_0x8b13('0x8'));router[_0x8b13('0x9')]('/',auth['isAuthenticated'](),controller[_0x8b13('0xa')]);router[_0x8b13('0x9')]('/describe',auth[_0x8b13('0xb')](),controller[_0x8b13('0xc')]);router[_0x8b13('0x9')]('/:id',auth[_0x8b13('0xb')](),controller[_0x8b13('0xd')]);router['get']('/:id/tags',auth[_0x8b13('0xb')](),controller[_0x8b13('0xe')]);router[_0x8b13('0x9')](_0x8b13('0xf'),auth[_0x8b13('0xb')](),controller['getHoppers']);router[_0x8b13('0x9')](_0x8b13('0x10'),auth[_0x8b13('0xb')](),controller[_0x8b13('0x11')]);router[_0x8b13('0x9')](_0x8b13('0x12'),auth['isAuthenticated'](),controller['getHopperFinals']);router[_0x8b13('0x9')](_0x8b13('0x13'),auth['isAuthenticated'](),controller['getJscriptySessions']);router['post'](_0x8b13('0x14'),auth[_0x8b13('0xb')](),controller[_0x8b13('0x15')]);router[_0x8b13('0x16')]('/',auth[_0x8b13('0xb')](),controller['create']);router[_0x8b13('0x16')](_0x8b13('0x17'),auth[_0x8b13('0xb')](),controller[_0x8b13('0x18')]);router[_0x8b13('0x16')](_0x8b13('0x19'),auth[_0x8b13('0xb')](),controller[_0x8b13('0x1a')]);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x4dac71,_0xae4966,_0x335709){_0x335709(null,path[_0x8b13('0x1b')](config[_0x8b13('0x1c')],_0x8b13('0x1d')));},'filename':function(_0x3cc9a0,_0x559442,_0x1e8a48){_0x559442[_0x8b13('0x1e')]=_0x559442[_0x8b13('0x1e')]['replace'](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0x1e8a48(null,util['format'](_0x8b13('0x1f'),path[_0x8b13('0x20')](_0x559442['originalname'],path[_0x8b13('0x21')](_0x559442[_0x8b13('0x1e')])),Date[_0x8b13('0x22')](),path[_0x8b13('0x21')](_0x559442[_0x8b13('0x1e')])));}})});router['post'](_0x8b13('0x23'),upload[_0x8b13('0x24')]('file'),controller[_0x8b13('0x25')]);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x420772,_0x325d68,_0x54786a){_0x54786a(null,path[_0x8b13('0x1b')](config[_0x8b13('0x1c')],'server/files/tmp'));},'filename':function(_0x134c5e,_0x14a739,_0x410122){_0x14a739[_0x8b13('0x1e')]=_0x14a739[_0x8b13('0x1e')]['replace'](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0x410122(null,util[_0x8b13('0x26')](_0x8b13('0x1f'),path[_0x8b13('0x20')](_0x14a739[_0x8b13('0x1e')],path[_0x8b13('0x21')](_0x14a739[_0x8b13('0x1e')])),Date['now'](),path[_0x8b13('0x21')](_0x14a739[_0x8b13('0x1e')])));}})});router[_0x8b13('0x16')](_0x8b13('0x27'),upload[_0x8b13('0x24')](_0x8b13('0x28')),controller[_0x8b13('0x29')]);router[_0x8b13('0x16')](_0x8b13('0x2a'),auth['isAuthenticated'](),controller[_0x8b13('0x2b')]);router[_0x8b13('0x2c')](_0x8b13('0x2d'),auth[_0x8b13('0xb')](),controller['update']);router['delete'](_0x8b13('0x2d'),auth['isAuthenticated'](),controller['destroy']);module[_0x8b13('0x2e')]=router; \ No newline at end of file diff --git a/server/api/cmCustomField/cmCustomField.attributes.js b/server/api/cmCustomField/cmCustomField.attributes.js index e64e89a..7feed4a 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 _0x25c1=['sequelize','exports','VIRTUAL','alias','STRING','setDataValue','getDataValue','name','TEXT','long','type','select','parse','values','isArray','stringify','BOOLEAN'];(function(_0x4d67b8,_0x565134){var _0x55af3b=function(_0x145904){while(--_0x145904){_0x4d67b8['push'](_0x4d67b8['shift']());}};_0x55af3b(++_0x565134);}(_0x25c1,0x88));var _0x125c=function(_0x3da1cc,_0x4ef2d8){_0x3da1cc=_0x3da1cc-0x0;var _0x22986a=_0x25c1[_0x3da1cc];return _0x22986a;};'use strict';var Sequelize=require(_0x125c('0x0'));var _=require('lodash');module[_0x125c('0x1')]={'name':{'type':Sequelize[_0x125c('0x2')],'get':function(_0x447150){return this['getDataValue'](_0x125c('0x3'));}},'alias':{'type':Sequelize[_0x125c('0x4')],'allowNull':![],'set':function(_0x384734){this[_0x125c('0x5')]('alias',_0x384734?_0x384734:this[_0x125c('0x6')](_0x125c('0x7')));}},'type':{'type':Sequelize[_0x125c('0x4')],'allowNull':![]},'values':{'type':Sequelize[_0x125c('0x8')](_0x125c('0x9')),'get':function(){if(this[_0x125c('0x6')](_0x125c('0xa'))===_0x125c('0xb')){return JSON[_0x125c('0xc')](this[_0x125c('0x6')](_0x125c('0xd')));}else{return this[_0x125c('0x6')]('values');}},'set':function(_0x2dece3){if(Array[_0x125c('0xe')](_0x2dece3)){this['setDataValue'](_0x125c('0xd'),JSON[_0x125c('0xf')](_0x2dece3));}else{this[_0x125c('0x5')](_0x125c('0xd'),_0x2dece3);}}},'required':{'type':Sequelize[_0x125c('0x10')],'defaultValue':![]}}; \ No newline at end of file +var _0xcc16=['lodash','VIRTUAL','getDataValue','alias','STRING','setDataValue','name','TEXT','long','values','isArray','stringify','sequelize'];(function(_0x1ff2ec,_0x386e86){var _0x405683=function(_0x22f921){while(--_0x22f921){_0x1ff2ec['push'](_0x1ff2ec['shift']());}};_0x405683(++_0x386e86);}(_0xcc16,0xb5));var _0x6cc1=function(_0x22af8a,_0x5cdd45){_0x22af8a=_0x22af8a-0x0;var _0x4ca03f=_0xcc16[_0x22af8a];return _0x4ca03f;};'use strict';var Sequelize=require(_0x6cc1('0x0'));var _=require(_0x6cc1('0x1'));module['exports']={'name':{'type':Sequelize[_0x6cc1('0x2')],'get':function(_0x3585ed){return this[_0x6cc1('0x3')](_0x6cc1('0x4'));}},'alias':{'type':Sequelize[_0x6cc1('0x5')],'allowNull':![],'set':function(_0x3a5dc5){this[_0x6cc1('0x6')]('alias',_0x3a5dc5?_0x3a5dc5:this['getDataValue'](_0x6cc1('0x7')));}},'type':{'type':Sequelize[_0x6cc1('0x5')],'allowNull':![]},'values':{'type':Sequelize[_0x6cc1('0x8')](_0x6cc1('0x9')),'get':function(){if(this[_0x6cc1('0x3')]('type')==='select'){return JSON['parse'](this['getDataValue']('values'));}else{return this[_0x6cc1('0x3')](_0x6cc1('0xa'));}},'set':function(_0xbe961f){if(Array[_0x6cc1('0xb')](_0xbe961f)){this['setDataValue']('values',JSON[_0x6cc1('0xc')](_0xbe961f));}else{this['setDataValue']('values',_0xbe961f);}}},'required':{'type':Sequelize['BOOLEAN'],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/cmCustomField/cmCustomField.controller.js b/server/api/cmCustomField/cmCustomField.controller.js index 0345efd..0214435 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 _0xc4e2=['query','filters','intersection','attributes','fields','length','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','count','include','findAll','rows','catch','show','includeAll','find','body','params','destroy','create','sequelize','transaction','Sequelize','TEXT','text','number','INTEGER','switch','BOOLEAN','defaultValue','queryInterface','addColumn','cm_contacts','format','cf_%d','html-pdf','eml-format','rimraf','fast-json-patch','bluebird','mustache','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','sendStatus','status','end','offset','limit','set','json','apply','reject','update','then','error','stack','name','send','index','map','CmCustomField','rawAttributes','type','key','model','keys'];(function(_0x1cc9f5,_0x5e27c7){var _0x475fb8=function(_0x1d4b44){while(--_0x1d4b44){_0x1cc9f5['push'](_0x1cc9f5['shift']());}};_0x475fb8(++_0x5e27c7);}(_0xc4e2,0x1d8));var _0x2c4e=function(_0x49ca18,_0x5e6d05){_0x49ca18=_0x49ca18-0x0;var _0x145d54=_0xc4e2[_0x49ca18];return _0x145d54;};'use strict';var pdf=require(_0x2c4e('0x0'));var emlformat=require(_0x2c4e('0x1'));var rimraf=require(_0x2c4e('0x2'));var zipdir=require('zip-dir');var jsonpatch=require(_0x2c4e('0x3'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x2c4e('0x4'));var Mustache=require(_0x2c4e('0x5'));var util=require(_0x2c4e('0x6'));var path=require(_0x2c4e('0x7'));var sox=require(_0x2c4e('0x8'));var csv=require(_0x2c4e('0x9'));var ejs=require(_0x2c4e('0xa'));var fs=require('fs');var _=require('lodash');var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x2c4e('0xb'));var deskjs=require(_0x2c4e('0xc'));var toCsv=require(_0x2c4e('0x9'));var querystring=require(_0x2c4e('0xd'));var Papa=require('papaparse');var Redis=require(_0x2c4e('0xe'));var authService=require(_0x2c4e('0xf'));var qs=require(_0x2c4e('0x10'));var as=require(_0x2c4e('0x11'));var hardwareService=require(_0x2c4e('0x12'));var logger=require(_0x2c4e('0x13'))(_0x2c4e('0x14'));var utils=require('../../config/utils');var config=require('../../config/environment');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x452dc1,_0x129a43){_0x129a43=_0x129a43||0xcc;return function(_0x2bfc25){if(_0x2bfc25){return _0x452dc1[_0x2c4e('0x15')](_0x129a43);}return _0x452dc1[_0x2c4e('0x16')](_0x129a43)[_0x2c4e('0x17')]();};}function respondWithResult(_0x49acec,_0x348347){_0x348347=_0x348347||0xc8;return function(_0x1401de){if(_0x1401de){return _0x49acec['status'](_0x348347)['json'](_0x1401de);}};}function respondWithFilteredResult(_0x4a7543,_0x51b6fc){return function(_0x1ad9b7){if(_0x1ad9b7){var _0x8ef411=_0x1ad9b7['count'],_0x37cb6b=_0x51b6fc['offset'],_0x169450=_0x51b6fc[_0x2c4e('0x18')]+_0x51b6fc[_0x2c4e('0x19')],_0x1ac4b8;if(_0x169450>=_0x8ef411){_0x169450=_0x8ef411;_0x1ac4b8=0xc8;}else{_0x1ac4b8=0xce;}_0x4a7543[_0x2c4e('0x16')](_0x1ac4b8);return _0x4a7543[_0x2c4e('0x1a')]('Content-Range',_0x37cb6b+'-'+_0x169450+'/'+_0x8ef411)[_0x2c4e('0x1b')](_0x1ad9b7);}return null;};}function patchUpdates(_0x4b5807){return function(_0x227766){try{jsonpatch[_0x2c4e('0x1c')](_0x227766,_0x4b5807,!![]);}catch(_0x3c7664){return BPromise[_0x2c4e('0x1d')](_0x3c7664);}return _0x227766['save']();};}function saveUpdates(_0xca9f3c,_0x549eb2){return function(_0x5de053){if(_0x5de053){return _0x5de053[_0x2c4e('0x1e')](_0xca9f3c)[_0x2c4e('0x1f')](function(_0x351de0){return _0x351de0;});}return null;};}function removeEntity(_0x3d4c7a,_0x201290){return function(_0xd904b6){if(_0xd904b6){return _0xd904b6['destroy']()[_0x2c4e('0x1f')](function(){_0x3d4c7a[_0x2c4e('0x16')](0xcc)[_0x2c4e('0x17')]();});}};}function handleEntityNotFound(_0x5eddcb,_0x3765c1){return function(_0x56ce29){if(!_0x56ce29){_0x5eddcb[_0x2c4e('0x15')](0x194);}return _0x56ce29;};}function handleError(_0x1dd73c,_0x33d4bd){_0x33d4bd=_0x33d4bd||0x1f4;return function(_0x59747f){logger[_0x2c4e('0x20')](_0x59747f[_0x2c4e('0x21')]);if(_0x59747f['name']){delete _0x59747f[_0x2c4e('0x22')];}_0x1dd73c[_0x2c4e('0x16')](_0x33d4bd)[_0x2c4e('0x23')](_0x59747f);};}exports[_0x2c4e('0x24')]=function(_0x2e9e4f,_0x42b83b){var _0x144b2c={},_0x724e23={},_0x20b417={'count':0x0,'rows':[]};var _0x232cbf=_[_0x2c4e('0x25')](db[_0x2c4e('0x26')][_0x2c4e('0x27')],function(_0x54faad){return{'name':_0x54faad['fieldName'],'type':_0x54faad[_0x2c4e('0x28')][_0x2c4e('0x29')]};});_0x724e23[_0x2c4e('0x2a')]=_['differenceBy'](_[_0x2c4e('0x25')](_0x232cbf,'name'),[_0x2c4e('0x22')]);_0x724e23['query']=_[_0x2c4e('0x2b')](_0x2e9e4f[_0x2c4e('0x2c')]);_0x724e23[_0x2c4e('0x2d')]=_[_0x2c4e('0x2e')](_0x724e23[_0x2c4e('0x2a')],_0x724e23['query']);_0x144b2c[_0x2c4e('0x2f')]=_[_0x2c4e('0x2e')](_0x724e23['model'],qs['fields'](_0x2e9e4f[_0x2c4e('0x2c')][_0x2c4e('0x30')]));_0x144b2c[_0x2c4e('0x2f')]=_0x144b2c[_0x2c4e('0x2f')][_0x2c4e('0x31')]?_0x144b2c[_0x2c4e('0x2f')]:_0x724e23[_0x2c4e('0x2a')];if(!_0x2e9e4f[_0x2c4e('0x2c')]['hasOwnProperty'](_0x2c4e('0x32'))){_0x144b2c[_0x2c4e('0x19')]=qs['limit'](_0x2e9e4f[_0x2c4e('0x2c')][_0x2c4e('0x19')]);_0x144b2c[_0x2c4e('0x18')]=qs['offset'](_0x2e9e4f[_0x2c4e('0x2c')][_0x2c4e('0x18')]);}_0x144b2c[_0x2c4e('0x33')]=qs[_0x2c4e('0x34')](_0x2e9e4f[_0x2c4e('0x2c')][_0x2c4e('0x34')]);_0x144b2c[_0x2c4e('0x35')]=qs[_0x2c4e('0x2d')](_[_0x2c4e('0x36')](_0x2e9e4f[_0x2c4e('0x2c')],_0x724e23[_0x2c4e('0x2d')]));if(_0x2e9e4f[_0x2c4e('0x2c')][_0x2c4e('0x37')]){_0x144b2c[_0x2c4e('0x35')]=_[_0x2c4e('0x38')](_0x144b2c['where'],{'$or':_[_0x2c4e('0x25')](_0x232cbf,function(_0x483d93){if(_0x483d93[_0x2c4e('0x28')]!==_0x2c4e('0x39')){var _0x2b1ba8={};_0x2b1ba8[_0x483d93[_0x2c4e('0x22')]]={'$like':'%'+_0x2e9e4f[_0x2c4e('0x2c')][_0x2c4e('0x37')]+'%'};return _0x2b1ba8;}})});}_0x144b2c=_[_0x2c4e('0x38')]({},_0x144b2c,_0x2e9e4f[_0x2c4e('0x3a')]);var _0x139a6b={'where':_0x144b2c[_0x2c4e('0x35')]};return db['CmCustomField'][_0x2c4e('0x3b')](_0x139a6b)['then'](function(_0x4b1dfd){_0x20b417[_0x2c4e('0x3b')]=_0x4b1dfd;if(_0x2e9e4f[_0x2c4e('0x2c')]['includeAll']){_0x144b2c[_0x2c4e('0x3c')]=[{'all':!![]}];}return db[_0x2c4e('0x26')][_0x2c4e('0x3d')](_0x144b2c);})['then'](function(_0x5f1ad6){_0x20b417[_0x2c4e('0x3e')]=_0x5f1ad6;return _0x20b417;})[_0x2c4e('0x1f')](respondWithFilteredResult(_0x42b83b,_0x144b2c))[_0x2c4e('0x3f')](handleError(_0x42b83b,null));};exports[_0x2c4e('0x40')]=function(_0x432302,_0x3cd00c){var _0xaef092={'raw':!![],'where':{'id':_0x432302['params']['id']}},_0x2444d4={};_0x2444d4[_0x2c4e('0x2a')]=_[_0x2c4e('0x2b')](db[_0x2c4e('0x26')][_0x2c4e('0x27')]);_0x2444d4[_0x2c4e('0x2c')]=_[_0x2c4e('0x2b')](_0x432302[_0x2c4e('0x2c')]);_0x2444d4[_0x2c4e('0x2d')]=_['intersection'](_0x2444d4[_0x2c4e('0x2a')],_0x2444d4[_0x2c4e('0x2c')]);_0xaef092['attributes']=_[_0x2c4e('0x2e')](_0x2444d4[_0x2c4e('0x2a')],qs[_0x2c4e('0x30')](_0x432302['query']['fields']));_0xaef092[_0x2c4e('0x2f')]=_0xaef092[_0x2c4e('0x2f')][_0x2c4e('0x31')]?_0xaef092['attributes']:_0x2444d4[_0x2c4e('0x2a')];if(_0x432302[_0x2c4e('0x2c')][_0x2c4e('0x41')]){_0xaef092[_0x2c4e('0x3c')]=[{'all':!![]}];}_0xaef092=_[_0x2c4e('0x38')]({},_0xaef092,_0x432302['options']);return db['CmCustomField'][_0x2c4e('0x42')](_0xaef092)['then'](handleEntityNotFound(_0x3cd00c,null))[_0x2c4e('0x1f')](respondWithResult(_0x3cd00c,null))[_0x2c4e('0x3f')](handleError(_0x3cd00c,null));};exports[_0x2c4e('0x1e')]=function(_0x5762ba,_0x1c6800){if(_0x5762ba[_0x2c4e('0x43')]['id']){delete _0x5762ba[_0x2c4e('0x43')]['id'];}return db[_0x2c4e('0x26')][_0x2c4e('0x42')]({'where':{'id':_0x5762ba[_0x2c4e('0x44')]['id']}})[_0x2c4e('0x1f')](handleEntityNotFound(_0x1c6800,null))['then'](saveUpdates(_0x5762ba['body'],null))['then'](respondWithResult(_0x1c6800,null))[_0x2c4e('0x3f')](handleError(_0x1c6800,null));};exports[_0x2c4e('0x45')]=function(_0x308217,_0x34f03e){return db['CmCustomField'][_0x2c4e('0x42')]({'where':{'id':_0x308217[_0x2c4e('0x44')]['id']}})['then'](handleEntityNotFound(_0x34f03e,null))['then'](removeEntity(_0x34f03e,null))[_0x2c4e('0x3f')](handleError(_0x34f03e,null));};exports[_0x2c4e('0x46')]=function(_0x1ff5cb,_0x752550){var _0xb7b6d9;return db[_0x2c4e('0x47')][_0x2c4e('0x48')](function(_0x460406){return db[_0x2c4e('0x26')]['create'](_0x1ff5cb['body'],{'transaction':_0x460406})[_0x2c4e('0x1f')](function(_0xe13515){_0xb7b6d9=_0xe13515;var _0x4afcd0={'type':db[_0x2c4e('0x49')][_0x2c4e('0x4a')],'transaction':_0x460406};switch(_0x1ff5cb[_0x2c4e('0x43')]['type']){case _0x2c4e('0x4b'):_0x4afcd0[_0x2c4e('0x28')]=db[_0x2c4e('0x49')][_0x2c4e('0x4a')];break;case _0x2c4e('0x4c'):_0x4afcd0[_0x2c4e('0x28')]=db[_0x2c4e('0x49')][_0x2c4e('0x4d')];break;case _0x2c4e('0x4e'):_0x4afcd0[_0x2c4e('0x28')]=db[_0x2c4e('0x49')][_0x2c4e('0x4f')];_0x4afcd0[_0x2c4e('0x50')]=![];break;default:}return db[_0x2c4e('0x47')][_0x2c4e('0x51')][_0x2c4e('0x52')](_0x2c4e('0x53'),util[_0x2c4e('0x54')](_0x2c4e('0x55'),_0xb7b6d9['id']),_0x4afcd0);})['then'](function(){return _0xb7b6d9;});})[_0x2c4e('0x1f')](respondWithResult(_0x752550,0xc9))[_0x2c4e('0x3f')](handleError(_0x752550,null));}; \ No newline at end of file +var _0x4f66=['filters','filter','merge','CmCustomField','count','includeAll','include','findAll','show','rawAttributes','length','catch','body','find','params','create','sequelize','transaction','TEXT','text','Sequelize','INTEGER','switch','BOOLEAN','defaultValue','queryInterface','addColumn','cm_contacts','format','cf_%d','html-pdf','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','path','sox','ejs','lodash','squel','crypto','desk.js','papaparse','ioredis','../../components/auth/service','../../config/logger','api','../../config/environment','../../mysqldb','sendStatus','end','status','json','offset','limit','set','Content-Range','apply','reject','save','update','then','destroy','error','name','send','index','map','fieldName','type','key','model','query','keys','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where'];(function(_0x3ddb4e,_0x5d9ecf){var _0x16202e=function(_0x505a25){while(--_0x505a25){_0x3ddb4e['push'](_0x3ddb4e['shift']());}};_0x16202e(++_0x5d9ecf);}(_0x4f66,0x16e));var _0x64f6=function(_0x101ccf,_0x37e172){_0x101ccf=_0x101ccf-0x0;var _0x99b0f1=_0x4f66[_0x101ccf];return _0x99b0f1;};'use strict';var pdf=require(_0x64f6('0x0'));var emlformat=require('eml-format');var rimraf=require(_0x64f6('0x1'));var zipdir=require(_0x64f6('0x2'));var jsonpatch=require(_0x64f6('0x3'));var rp=require(_0x64f6('0x4'));var moment=require('moment');var BPromise=require(_0x64f6('0x5'));var Mustache=require(_0x64f6('0x6'));var util=require('util');var path=require(_0x64f6('0x7'));var sox=require(_0x64f6('0x8'));var csv=require('to-csv');var ejs=require(_0x64f6('0x9'));var fs=require('fs');var _=require(_0x64f6('0xa'));var squel=require(_0x64f6('0xb'));var crypto=require(_0x64f6('0xc'));var jsforce=require('jsforce');var deskjs=require(_0x64f6('0xd'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x64f6('0xe'));var Redis=require(_0x64f6('0xf'));var authService=require(_0x64f6('0x10'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x64f6('0x11'))(_0x64f6('0x12'));var utils=require('../../config/utils');var config=require(_0x64f6('0x13'));var db=require(_0x64f6('0x14'))['db'];function respondWithStatusCode(_0x28232d,_0x373937){_0x373937=_0x373937||0xcc;return function(_0x448a84){if(_0x448a84){return _0x28232d[_0x64f6('0x15')](_0x373937);}return _0x28232d['status'](_0x373937)[_0x64f6('0x16')]();};}function respondWithResult(_0x5f40d5,_0x5d4d53){_0x5d4d53=_0x5d4d53||0xc8;return function(_0x31d128){if(_0x31d128){return _0x5f40d5[_0x64f6('0x17')](_0x5d4d53)[_0x64f6('0x18')](_0x31d128);}};}function respondWithFilteredResult(_0x417a95,_0xf4ebcb){return function(_0x3cbe0d){if(_0x3cbe0d){var _0x466d5d=_0x3cbe0d['count'],_0x3bfb50=_0xf4ebcb[_0x64f6('0x19')],_0x1b267b=_0xf4ebcb[_0x64f6('0x19')]+_0xf4ebcb[_0x64f6('0x1a')],_0x52a9c2;if(_0x1b267b>=_0x466d5d){_0x1b267b=_0x466d5d;_0x52a9c2=0xc8;}else{_0x52a9c2=0xce;}_0x417a95[_0x64f6('0x17')](_0x52a9c2);return _0x417a95[_0x64f6('0x1b')](_0x64f6('0x1c'),_0x3bfb50+'-'+_0x1b267b+'/'+_0x466d5d)[_0x64f6('0x18')](_0x3cbe0d);}return null;};}function patchUpdates(_0x283bbe){return function(_0x27c70e){try{jsonpatch[_0x64f6('0x1d')](_0x27c70e,_0x283bbe,!![]);}catch(_0xa74fc9){return BPromise[_0x64f6('0x1e')](_0xa74fc9);}return _0x27c70e[_0x64f6('0x1f')]();};}function saveUpdates(_0x24605b,_0x620c8f){return function(_0x3b0f5b){if(_0x3b0f5b){return _0x3b0f5b[_0x64f6('0x20')](_0x24605b)[_0x64f6('0x21')](function(_0xc3ecd4){return _0xc3ecd4;});}return null;};}function removeEntity(_0x456fe4,_0x4e0a59){return function(_0x5276c2){if(_0x5276c2){return _0x5276c2[_0x64f6('0x22')]()[_0x64f6('0x21')](function(){_0x456fe4['status'](0xcc)[_0x64f6('0x16')]();});}};}function handleEntityNotFound(_0x4cbc63,_0x1b1be9){return function(_0xd5bdd8){if(!_0xd5bdd8){_0x4cbc63[_0x64f6('0x15')](0x194);}return _0xd5bdd8;};}function handleError(_0x171589,_0x499f67){_0x499f67=_0x499f67||0x1f4;return function(_0x3e4bda){logger[_0x64f6('0x23')](_0x3e4bda['stack']);if(_0x3e4bda[_0x64f6('0x24')]){delete _0x3e4bda[_0x64f6('0x24')];}_0x171589[_0x64f6('0x17')](_0x499f67)[_0x64f6('0x25')](_0x3e4bda);};}exports[_0x64f6('0x26')]=function(_0x5c8c9e,_0xe205c7){var _0x4a1b4a={},_0x5e7e28={},_0x4eb062={'count':0x0,'rows':[]};var _0x47c572=_[_0x64f6('0x27')](db['CmCustomField']['rawAttributes'],function(_0x2737c9){return{'name':_0x2737c9[_0x64f6('0x28')],'type':_0x2737c9[_0x64f6('0x29')][_0x64f6('0x2a')]};});_0x5e7e28[_0x64f6('0x2b')]=_['differenceBy'](_[_0x64f6('0x27')](_0x47c572,_0x64f6('0x24')),[_0x64f6('0x24')]);_0x5e7e28[_0x64f6('0x2c')]=_[_0x64f6('0x2d')](_0x5c8c9e[_0x64f6('0x2c')]);_0x5e7e28['filters']=_[_0x64f6('0x2e')](_0x5e7e28[_0x64f6('0x2b')],_0x5e7e28[_0x64f6('0x2c')]);_0x4a1b4a[_0x64f6('0x2f')]=_[_0x64f6('0x2e')](_0x5e7e28[_0x64f6('0x2b')],qs[_0x64f6('0x30')](_0x5c8c9e[_0x64f6('0x2c')][_0x64f6('0x30')]));_0x4a1b4a[_0x64f6('0x2f')]=_0x4a1b4a['attributes']['length']?_0x4a1b4a['attributes']:_0x5e7e28['model'];if(!_0x5c8c9e[_0x64f6('0x2c')][_0x64f6('0x31')](_0x64f6('0x32'))){_0x4a1b4a[_0x64f6('0x1a')]=qs[_0x64f6('0x1a')](_0x5c8c9e['query'][_0x64f6('0x1a')]);_0x4a1b4a['offset']=qs[_0x64f6('0x19')](_0x5c8c9e[_0x64f6('0x2c')][_0x64f6('0x19')]);}_0x4a1b4a[_0x64f6('0x33')]=qs[_0x64f6('0x34')](_0x5c8c9e[_0x64f6('0x2c')][_0x64f6('0x34')]);_0x4a1b4a[_0x64f6('0x35')]=qs[_0x64f6('0x36')](_['pick'](_0x5c8c9e[_0x64f6('0x2c')],_0x5e7e28[_0x64f6('0x36')]));if(_0x5c8c9e[_0x64f6('0x2c')][_0x64f6('0x37')]){_0x4a1b4a['where']=_['merge'](_0x4a1b4a[_0x64f6('0x35')],{'$or':_[_0x64f6('0x27')](_0x47c572,function(_0x4d15e3){if(_0x4d15e3['type']!=='VIRTUAL'){var _0x1108b9={};_0x1108b9[_0x4d15e3['name']]={'$like':'%'+_0x5c8c9e['query'][_0x64f6('0x37')]+'%'};return _0x1108b9;}})});}_0x4a1b4a=_[_0x64f6('0x38')]({},_0x4a1b4a,_0x5c8c9e['options']);var _0x2655d8={'where':_0x4a1b4a[_0x64f6('0x35')]};return db[_0x64f6('0x39')][_0x64f6('0x3a')](_0x2655d8)['then'](function(_0x1b787c){_0x4eb062[_0x64f6('0x3a')]=_0x1b787c;if(_0x5c8c9e[_0x64f6('0x2c')][_0x64f6('0x3b')]){_0x4a1b4a[_0x64f6('0x3c')]=[{'all':!![]}];}return db[_0x64f6('0x39')][_0x64f6('0x3d')](_0x4a1b4a);})[_0x64f6('0x21')](function(_0xbb8b78){_0x4eb062['rows']=_0xbb8b78;return _0x4eb062;})[_0x64f6('0x21')](respondWithFilteredResult(_0xe205c7,_0x4a1b4a))['catch'](handleError(_0xe205c7,null));};exports[_0x64f6('0x3e')]=function(_0x55f656,_0x164184){var _0x46ab5f={'raw':!![],'where':{'id':_0x55f656['params']['id']}},_0x59a7fc={};_0x59a7fc['model']=_['keys'](db[_0x64f6('0x39')][_0x64f6('0x3f')]);_0x59a7fc['query']=_[_0x64f6('0x2d')](_0x55f656[_0x64f6('0x2c')]);_0x59a7fc['filters']=_['intersection'](_0x59a7fc[_0x64f6('0x2b')],_0x59a7fc[_0x64f6('0x2c')]);_0x46ab5f[_0x64f6('0x2f')]=_[_0x64f6('0x2e')](_0x59a7fc['model'],qs[_0x64f6('0x30')](_0x55f656['query'][_0x64f6('0x30')]));_0x46ab5f[_0x64f6('0x2f')]=_0x46ab5f[_0x64f6('0x2f')][_0x64f6('0x40')]?_0x46ab5f[_0x64f6('0x2f')]:_0x59a7fc[_0x64f6('0x2b')];if(_0x55f656[_0x64f6('0x2c')][_0x64f6('0x3b')]){_0x46ab5f['include']=[{'all':!![]}];}_0x46ab5f=_[_0x64f6('0x38')]({},_0x46ab5f,_0x55f656['options']);return db['CmCustomField']['find'](_0x46ab5f)['then'](handleEntityNotFound(_0x164184,null))['then'](respondWithResult(_0x164184,null))[_0x64f6('0x41')](handleError(_0x164184,null));};exports[_0x64f6('0x20')]=function(_0xb072ba,_0x4f60c8){if(_0xb072ba[_0x64f6('0x42')]['id']){delete _0xb072ba[_0x64f6('0x42')]['id'];}return db[_0x64f6('0x39')][_0x64f6('0x43')]({'where':{'id':_0xb072ba[_0x64f6('0x44')]['id']}})[_0x64f6('0x21')](handleEntityNotFound(_0x4f60c8,null))[_0x64f6('0x21')](saveUpdates(_0xb072ba[_0x64f6('0x42')],null))['then'](respondWithResult(_0x4f60c8,null))[_0x64f6('0x41')](handleError(_0x4f60c8,null));};exports[_0x64f6('0x22')]=function(_0x12f9be,_0x111fba){return db['CmCustomField']['find']({'where':{'id':_0x12f9be[_0x64f6('0x44')]['id']}})[_0x64f6('0x21')](handleEntityNotFound(_0x111fba,null))[_0x64f6('0x21')](removeEntity(_0x111fba,null))[_0x64f6('0x41')](handleError(_0x111fba,null));};exports[_0x64f6('0x45')]=function(_0x5d2353,_0xd8cf1e){var _0x39cc3e;return db[_0x64f6('0x46')][_0x64f6('0x47')](function(_0x335110){return db['CmCustomField'][_0x64f6('0x45')](_0x5d2353['body'],{'transaction':_0x335110})[_0x64f6('0x21')](function(_0x1a3a60){_0x39cc3e=_0x1a3a60;var _0x7464a4={'type':db['Sequelize'][_0x64f6('0x48')],'transaction':_0x335110};switch(_0x5d2353[_0x64f6('0x42')][_0x64f6('0x29')]){case _0x64f6('0x49'):_0x7464a4[_0x64f6('0x29')]=db[_0x64f6('0x4a')][_0x64f6('0x48')];break;case'number':_0x7464a4[_0x64f6('0x29')]=db['Sequelize'][_0x64f6('0x4b')];break;case _0x64f6('0x4c'):_0x7464a4[_0x64f6('0x29')]=db['Sequelize'][_0x64f6('0x4d')];_0x7464a4[_0x64f6('0x4e')]=![];break;default:}return db[_0x64f6('0x46')][_0x64f6('0x4f')][_0x64f6('0x50')](_0x64f6('0x51'),util[_0x64f6('0x52')](_0x64f6('0x53'),_0x39cc3e['id']),_0x7464a4);})[_0x64f6('0x21')](function(){return _0x39cc3e;});})[_0x64f6('0x21')](respondWithResult(_0xd8cf1e,0xc9))['catch'](handleError(_0xd8cf1e,null));}; \ No newline at end of file diff --git a/server/api/cmCustomField/cmCustomField.model.js b/server/api/cmCustomField/cmCustomField.model.js index c3ce8d7..d4ed517 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 _0x59c3=['exports','define','cm_custom_fields','lodash','util','../../config/logger','moment','rimraf','../../config/environment','./cmCustomField.attributes'];(function(_0x414da4,_0xc85c84){var _0x1b8504=function(_0x26686f){while(--_0x26686f){_0x414da4['push'](_0x414da4['shift']());}};_0x1b8504(++_0xc85c84);}(_0x59c3,0x1e3));var _0x359c=function(_0xbca1b1,_0x33f0ce){_0xbca1b1=_0xbca1b1-0x0;var _0x4e1686=_0x59c3[_0xbca1b1];return _0x4e1686;};'use strict';var _=require(_0x359c('0x0'));var util=require(_0x359c('0x1'));var logger=require(_0x359c('0x2'))('api');var moment=require(_0x359c('0x3'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x359c('0x4'));var config=require(_0x359c('0x5'));var attributes=require(_0x359c('0x6'));module[_0x359c('0x7')]=function(_0xef032f,_0x4a5cae){return _0xef032f[_0x359c('0x8')]('CmCustomField',attributes,{'tableName':_0x359c('0x9'),'paranoid':!![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xbbfd=['CmCustomField','cm_custom_fields','util','../../config/logger','api','bluebird','path','rimraf','../../config/environment','./cmCustomField.attributes','exports','define'];(function(_0x5b05de,_0x441400){var _0x1dbd07=function(_0x2ebed2){while(--_0x2ebed2){_0x5b05de['push'](_0x5b05de['shift']());}};_0x1dbd07(++_0x441400);}(_0xbbfd,0x86));var _0xdbbf=function(_0x2ec461,_0x5f588a){_0x2ec461=_0x2ec461-0x0;var _0x28603d=_0xbbfd[_0x2ec461];return _0x28603d;};'use strict';var _=require('lodash');var util=require(_0xdbbf('0x0'));var logger=require(_0xdbbf('0x1'))(_0xdbbf('0x2'));var moment=require('moment');var BPromise=require(_0xdbbf('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xdbbf('0x4'));var rimraf=require(_0xdbbf('0x5'));var config=require(_0xdbbf('0x6'));var attributes=require(_0xdbbf('0x7'));module[_0xdbbf('0x8')]=function(_0xb9514,_0x41b097){return _0xb9514[_0xdbbf('0x9')](_0xdbbf('0xa'),attributes,{'tableName':_0xdbbf('0xb'),'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 2dc3b79..f3d5533 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 _0x84ab=['message','result','catch','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','then','info','CmCustomField,\x20%s,\x20%s','request\x20sent','stringify','error','code'];(function(_0x328421,_0x5cbb0e){var _0x527972=function(_0x3a0d04){while(--_0x3a0d04){_0x328421['push'](_0x328421['shift']());}};_0x527972(++_0x5cbb0e);}(_0x84ab,0x12f));var _0xb84a=function(_0x57975f,_0x388556){_0x57975f=_0x57975f-0x0;var _0x4793b8=_0x84ab[_0x57975f];return _0x4793b8;};'use strict';var _=require(_0xb84a('0x0'));var util=require(_0xb84a('0x1'));var moment=require(_0xb84a('0x2'));var BPromise=require(_0xb84a('0x3'));var rs=require(_0xb84a('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xb84a('0x5'))['db'];var utils=require(_0xb84a('0x6'));var logger=require('../../config/logger')(_0xb84a('0x7'));var config=require(_0xb84a('0x8'));var jayson=require(_0xb84a('0x9'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x4dc496,_0xd445b5,_0x4fac4d){return new BPromise(function(_0x3e9086,_0x8d9dbe){return client['request'](_0x4dc496,_0x4fac4d)[_0xb84a('0xa')](function(_0x525cb7){logger[_0xb84a('0xb')](_0xb84a('0xc'),_0xd445b5,_0xb84a('0xd'));logger['debug']('CmCustomField,\x20%s,\x20%s,\x20%s',_0xd445b5,'request\x20sent',JSON[_0xb84a('0xe')](_0x525cb7));if(_0x525cb7[_0xb84a('0xf')]){if(_0x525cb7[_0xb84a('0xf')][_0xb84a('0x10')]===0x1f4){logger[_0xb84a('0xf')]('CmCustomField,\x20%s,\x20%s',_0xd445b5,_0x525cb7[_0xb84a('0xf')][_0xb84a('0x11')]);return _0x8d9dbe(_0x525cb7[_0xb84a('0xf')][_0xb84a('0x11')]);}logger[_0xb84a('0xf')](_0xb84a('0xc'),_0xd445b5,_0x525cb7[_0xb84a('0xf')][_0xb84a('0x11')]);return _0x3e9086(_0x525cb7[_0xb84a('0xf')][_0xb84a('0x11')]);}else{logger[_0xb84a('0xb')](_0xb84a('0xc'),_0xd445b5,'request\x20sent');_0x3e9086(_0x525cb7[_0xb84a('0x12')][_0xb84a('0x11')]);}})[_0xb84a('0x13')](function(_0x3c0b54){logger[_0xb84a('0xf')](_0xb84a('0xc'),_0xd445b5,_0x3c0b54);_0x8d9dbe(_0x3c0b54);});});} \ No newline at end of file +var _0xe14d=['../../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','message','result','catch','lodash','util','moment','bluebird','ioredis','../../mysqldb'];(function(_0x53a911,_0x4a48c1){var _0x19b3cd=function(_0x11a11d){while(--_0x11a11d){_0x53a911['push'](_0x53a911['shift']());}};_0x19b3cd(++_0x4a48c1);}(_0xe14d,0x1ee));var _0xde14=function(_0x433a86,_0x175b5c){_0x433a86=_0x433a86-0x0;var _0x23000c=_0xe14d[_0x433a86];return _0x23000c;};'use strict';var _=require(_0xde14('0x0'));var util=require(_0xde14('0x1'));var moment=require(_0xde14('0x2'));var BPromise=require(_0xde14('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xde14('0x4'));var db=require(_0xde14('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0xde14('0x6'))(_0xde14('0x7'));var config=require(_0xde14('0x8'));var jayson=require(_0xde14('0x9'));var client=jayson[_0xde14('0xa')][_0xde14('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x4b1f6b,_0x5a1344,_0x1bd49d){return new BPromise(function(_0x115b7d,_0x2b0e7c){return client[_0xde14('0xc')](_0x4b1f6b,_0x1bd49d)[_0xde14('0xd')](function(_0x176909){logger[_0xde14('0xe')](_0xde14('0xf'),_0x5a1344,'request\x20sent');logger[_0xde14('0x10')](_0xde14('0x11'),_0x5a1344,_0xde14('0x12'),JSON[_0xde14('0x13')](_0x176909));if(_0x176909[_0xde14('0x14')]){if(_0x176909[_0xde14('0x14')][_0xde14('0x15')]===0x1f4){logger[_0xde14('0x14')](_0xde14('0xf'),_0x5a1344,_0x176909[_0xde14('0x14')][_0xde14('0x16')]);return _0x2b0e7c(_0x176909[_0xde14('0x14')][_0xde14('0x16')]);}logger[_0xde14('0x14')](_0xde14('0xf'),_0x5a1344,_0x176909['error']['message']);return _0x115b7d(_0x176909[_0xde14('0x14')][_0xde14('0x16')]);}else{logger[_0xde14('0xe')]('CmCustomField,\x20%s,\x20%s',_0x5a1344,_0xde14('0x12'));_0x115b7d(_0x176909[_0xde14('0x17')][_0xde14('0x16')]);}})[_0xde14('0x18')](function(_0x3de959){logger[_0xde14('0x14')](_0xde14('0xf'),_0x5a1344,_0x3de959);_0x2b0e7c(_0x3de959);});});} \ No newline at end of file diff --git a/server/api/cmCustomField/index.js b/server/api/cmCustomField/index.js index 62808bd..99e004a 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 _0x1256=['index','/:id','show','isAuthenticated','create','put','update','delete','destroy','connect-timeout','express','Router','../../components/interaction/service','../../config/environment','./cmCustomField.controller','get'];(function(_0x5b561d,_0x422b7c){var _0x431060=function(_0x401409){while(--_0x401409){_0x5b561d['push'](_0x5b561d['shift']());}};_0x431060(++_0x422b7c);}(_0x1256,0x79));var _0x6125=function(_0x25df55,_0x381fe3){_0x25df55=_0x25df55-0x0;var _0x204423=_0x1256[_0x25df55];return _0x204423;};'use strict';var multer=require('multer');var util=require('util');var path=require('path');var timeout=require(_0x6125('0x0'));var express=require(_0x6125('0x1'));var router=express[_0x6125('0x2')]();var auth=require('../../components/auth/service');var interaction=require(_0x6125('0x3'));var config=require(_0x6125('0x4'));var controller=require(_0x6125('0x5'));router[_0x6125('0x6')]('/',auth['isAuthenticated'](),controller[_0x6125('0x7')]);router[_0x6125('0x6')](_0x6125('0x8'),auth['isAuthenticated'](),controller[_0x6125('0x9')]);router['post']('/',auth[_0x6125('0xa')](),controller[_0x6125('0xb')]);router[_0x6125('0xc')]('/:id',auth[_0x6125('0xa')](),controller[_0x6125('0xd')]);router[_0x6125('0xe')](_0x6125('0x8'),auth[_0x6125('0xa')](),controller[_0x6125('0xf')]);module['exports']=router; \ No newline at end of file +var _0xcd6d=['multer','util','path','connect-timeout','express','Router','../../components/interaction/service','../../config/environment','./cmCustomField.controller','isAuthenticated','index','get','show','post','create','/:id','delete','destroy','exports'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xcd6d,0xf7));var _0xdcd6=function(_0x457d21,_0x4956f2){_0x457d21=_0x457d21-0x0;var _0x4cab70=_0xcd6d[_0x457d21];return _0x4cab70;};'use strict';var multer=require(_0xdcd6('0x0'));var util=require(_0xdcd6('0x1'));var path=require(_0xdcd6('0x2'));var timeout=require(_0xdcd6('0x3'));var express=require(_0xdcd6('0x4'));var router=express[_0xdcd6('0x5')]();var auth=require('../../components/auth/service');var interaction=require(_0xdcd6('0x6'));var config=require(_0xdcd6('0x7'));var controller=require(_0xdcd6('0x8'));router['get']('/',auth[_0xdcd6('0x9')](),controller[_0xdcd6('0xa')]);router[_0xdcd6('0xb')]('/:id',auth[_0xdcd6('0x9')](),controller[_0xdcd6('0xc')]);router[_0xdcd6('0xd')]('/',auth[_0xdcd6('0x9')](),controller[_0xdcd6('0xe')]);router['put'](_0xdcd6('0xf'),auth['isAuthenticated'](),controller['update']);router[_0xdcd6('0x10')](_0xdcd6('0xf'),auth[_0xdcd6('0x9')](),controller[_0xdcd6('0x11')]);module[_0xdcd6('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 f4a1dfd..90baa55 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 _0x7fbe=['DATE','format','YYYY-MM-DD\x20HH:mm:ss','INTEGER','UNSIGNED','contactListQueue','exports','STRING','BOOLEAN'];(function(_0x2799df,_0x32e019){var _0x468700=function(_0x679d32){while(--_0x679d32){_0x2799df['push'](_0x2799df['shift']());}};_0x468700(++_0x32e019);}(_0x7fbe,0x1ec));var _0xe7fb=function(_0x344eb8,_0x12a8a5){_0x344eb8=_0x344eb8-0x0;var _0x3f197c=_0x7fbe[_0x344eb8];return _0x3f197c;};'use strict';var moment=require('moment');var Sequelize=require('sequelize');module[_0xe7fb('0x0')]={'phone':{'type':Sequelize[_0xe7fb('0x1')],'allowNull':![]},'active':{'type':Sequelize[_0xe7fb('0x2')],'defaultValue':![]},'scheduledat':{'type':Sequelize[_0xe7fb('0x3')],'defaultValue':moment()[_0xe7fb('0x4')](_0xe7fb('0x5'))},'countbusyretry':{'type':Sequelize[_0xe7fb('0x6')],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize[_0xe7fb('0x6')],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize[_0xe7fb('0x6')],'defaultValue':0x0},'callback':{'type':Sequelize[_0xe7fb('0x2')],'defaultValue':![]},'callbackuniqueid':{'type':Sequelize[_0xe7fb('0x1')],'defaultValue':null},'callbackat':{'type':Sequelize[_0xe7fb('0x3')]},'priority':{'type':Sequelize[_0xe7fb('0x6')](0x2)[_0xe7fb('0x7')],'defaultValue':0x2,'validate':{'min':0x0,'max':0x4}},'recallme':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'ContactId':{'type':Sequelize[_0xe7fb('0x6')],'unique':_0xe7fb('0x8')},'ListId':{'type':Sequelize[_0xe7fb('0x6')],'unique':_0xe7fb('0x8')},'UserId':{'type':Sequelize['INTEGER']},'VoiceQueueId':{'type':Sequelize['INTEGER'],'unique':_0xe7fb('0x8')},'CampaignId':{'type':Sequelize[_0xe7fb('0x6')]},'countnosuchnumberretry':{'type':Sequelize[_0xe7fb('0x6')],'defaultValue':0x0},'countdropretry':{'type':Sequelize[_0xe7fb('0x6')],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize[_0xe7fb('0x6')],'defaultValue':0x0},'countmachineretry':{'type':Sequelize[_0xe7fb('0x6')],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize[_0xe7fb('0x6')],'defaultValue':0x0}}; \ No newline at end of file +var _0xbd51=['moment','exports','STRING','BOOLEAN','DATE','INTEGER','UNSIGNED','contactListQueue'];(function(_0x8a28d6,_0x5bbf72){var _0x42c7b3=function(_0x4f1c12){while(--_0x4f1c12){_0x8a28d6['push'](_0x8a28d6['shift']());}};_0x42c7b3(++_0x5bbf72);}(_0xbd51,0x1a8));var _0x1bd5=function(_0x52fcea,_0x5324c1){_0x52fcea=_0x52fcea-0x0;var _0x5a5eaa=_0xbd51[_0x52fcea];return _0x5a5eaa;};'use strict';var moment=require(_0x1bd5('0x0'));var Sequelize=require('sequelize');module[_0x1bd5('0x1')]={'phone':{'type':Sequelize[_0x1bd5('0x2')],'allowNull':![]},'active':{'type':Sequelize[_0x1bd5('0x3')],'defaultValue':![]},'scheduledat':{'type':Sequelize[_0x1bd5('0x4')],'defaultValue':moment()['format']('YYYY-MM-DD\x20HH:mm:ss')},'countbusyretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize[_0x1bd5('0x5')],'defaultValue':0x0},'callback':{'type':Sequelize[_0x1bd5('0x3')],'defaultValue':![]},'callbackuniqueid':{'type':Sequelize[_0x1bd5('0x2')],'defaultValue':null},'callbackat':{'type':Sequelize['DATE']},'priority':{'type':Sequelize[_0x1bd5('0x5')](0x2)[_0x1bd5('0x6')],'defaultValue':0x2,'validate':{'min':0x0,'max':0x4}},'recallme':{'type':Sequelize[_0x1bd5('0x3')],'defaultValue':![]},'ContactId':{'type':Sequelize[_0x1bd5('0x5')],'unique':_0x1bd5('0x7')},'ListId':{'type':Sequelize['INTEGER'],'unique':_0x1bd5('0x7')},'UserId':{'type':Sequelize['INTEGER']},'VoiceQueueId':{'type':Sequelize[_0x1bd5('0x5')],'unique':_0x1bd5('0x7')},'CampaignId':{'type':Sequelize[_0x1bd5('0x5')]},'countnosuchnumberretry':{'type':Sequelize[_0x1bd5('0x5')],'defaultValue':0x0},'countdropretry':{'type':Sequelize[_0x1bd5('0x5')],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize[_0x1bd5('0x5')],'defaultValue':0x0},'countmachineretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize[_0x1bd5('0x5')],'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 88c64d5..511c11f 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 _0x13df=['state','statedesc','deleted','user','UserId','phone','campaigntype','ivr','CmContact','ContactId','firstName','lastName','isNil','calleridname','finally','CmHopperFinal','getPreview','preview','dialOrderByScheduledAt','sequelize','YYYY-MM-DD\x20HH:mm:ss','direction','prev','isEmpty','hopperIds','priority','ASC','scheduledAt','DESC','COALESCE(CmHopper.UserId,\x200)\x20ASC','literal','LOCK','CmCompany','CmList','List','dialActive','getOpenContacts','outbound','format','isNumber','entity\x20not\x20found','eml-format','rimraf','zip-dir','fast-json-patch','bluebird','mustache','util','path','sox','ejs','lodash','crypto','jsforce','to-csv','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','offset','set','apply','reject','save','update','then','error','stack','name','send','type','key','map','query','keys','filters','model','concat','$and','$or','$gt','$gte','$lt','$lte','$ne','$not','$between','$notBetween','$notIn','$notLike','$iLike','$notILike','$like','$overlap','$contained','$any','intersection','attributes','hasOwnProperty','nolimit','limit','order','sort','where','pick','merge','VIRTUAL','CmHopper','count','includeAll','findAll','rows','catch','show','params','rawAttributes','fields','length','include','find','create','body','describe','destroy','VoiceQueueId','VoiceQueue','Campaign','CampaignId','omit','dataValues'];(function(_0x54eac6,_0x56c715){var _0x3450cc=function(_0x4ee088){while(--_0x4ee088){_0x54eac6['push'](_0x54eac6['shift']());}};_0x3450cc(++_0x56c715);}(_0x13df,0x1cd));var _0xf13d=function(_0x267de6,_0x252345){_0x267de6=_0x267de6-0x0;var _0x5bd9d8=_0x13df[_0x267de6];return _0x5bd9d8;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0xf13d('0x0'));var rimraf=require(_0xf13d('0x1'));var zipdir=require(_0xf13d('0x2'));var jsonpatch=require(_0xf13d('0x3'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0xf13d('0x4'));var Mustache=require(_0xf13d('0x5'));var util=require(_0xf13d('0x6'));var path=require(_0xf13d('0x7'));var sox=require(_0xf13d('0x8'));var csv=require('to-csv');var ejs=require(_0xf13d('0x9'));var fs=require('fs');var _=require(_0xf13d('0xa'));var squel=require('squel');var crypto=require(_0xf13d('0xb'));var jsforce=require(_0xf13d('0xc'));var deskjs=require('desk.js');var toCsv=require(_0xf13d('0xd'));var querystring=require(_0xf13d('0xe'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0xf13d('0xf'));var qs=require(_0xf13d('0x10'));var as=require(_0xf13d('0x11'));var hardwareService=require(_0xf13d('0x12'));var logger=require(_0xf13d('0x13'))(_0xf13d('0x14'));var utils=require(_0xf13d('0x15'));var config=require(_0xf13d('0x16'));var db=require(_0xf13d('0x17'))['db'];function respondWithStatusCode(_0x5985b7,_0x8e5a56){_0x8e5a56=_0x8e5a56||0xcc;return function(_0x20ffc3){if(_0x20ffc3){return _0x5985b7[_0xf13d('0x18')](_0x8e5a56);}return _0x5985b7[_0xf13d('0x19')](_0x8e5a56)[_0xf13d('0x1a')]();};}function respondWithResult(_0x2359ee,_0x38b8ae){_0x38b8ae=_0x38b8ae||0xc8;return function(_0xe657e){if(_0xe657e){return _0x2359ee[_0xf13d('0x19')](_0x38b8ae)[_0xf13d('0x1b')](_0xe657e);}};}function respondWithFilteredResult(_0xaf3ad,_0x56df38){return function(_0x1d8781){if(_0x1d8781){var _0x2b7730=_0x1d8781['count'],_0x3d6230=_0x56df38[_0xf13d('0x1c')],_0x5c9450=_0x56df38[_0xf13d('0x1c')]+_0x56df38['limit'],_0x1f25dc;if(_0x5c9450>=_0x2b7730){_0x5c9450=_0x2b7730;_0x1f25dc=0xc8;}else{_0x1f25dc=0xce;}_0xaf3ad[_0xf13d('0x19')](_0x1f25dc);return _0xaf3ad[_0xf13d('0x1d')]('Content-Range',_0x3d6230+'-'+_0x5c9450+'/'+_0x2b7730)['json'](_0x1d8781);}return null;};}function patchUpdates(_0x5129f0){return function(_0x267965){try{jsonpatch[_0xf13d('0x1e')](_0x267965,_0x5129f0,!![]);}catch(_0x3e965a){return BPromise[_0xf13d('0x1f')](_0x3e965a);}return _0x267965[_0xf13d('0x20')]();};}function saveUpdates(_0x2f394c,_0x48cda0){return function(_0x5004de){if(_0x5004de){return _0x5004de[_0xf13d('0x21')](_0x2f394c)[_0xf13d('0x22')](function(_0x8ac7b5){return _0x8ac7b5;});}return null;};}function removeEntity(_0x4a3489,_0xf33e16){return function(_0x284772){if(_0x284772){return _0x284772['destroy']()['then'](function(){_0x4a3489[_0xf13d('0x19')](0xcc)[_0xf13d('0x1a')]();});}};}function handleEntityNotFound(_0x1bdcc9,_0x2c1553){return function(_0x5b6c07){if(!_0x5b6c07){_0x1bdcc9[_0xf13d('0x18')](0x194);}return _0x5b6c07;};}function handleError(_0x4122e5,_0x1c2d06){_0x1c2d06=_0x1c2d06||0x1f4;return function(_0x84a6a9){logger[_0xf13d('0x23')](_0x84a6a9[_0xf13d('0x24')]);if(_0x84a6a9[_0xf13d('0x25')]){delete _0x84a6a9['name'];}_0x4122e5[_0xf13d('0x19')](_0x1c2d06)[_0xf13d('0x26')](_0x84a6a9);};}exports['index']=function(_0x5f2083,_0x3b6548){var _0x425636={},_0x4a092c={},_0x56a180={'count':0x0,'rows':[]};var _0x5e2738=_['map'](db['CmHopper']['rawAttributes'],function(_0x187b20){return{'name':_0x187b20['fieldName'],'type':_0x187b20[_0xf13d('0x27')][_0xf13d('0x28')]};});_0x4a092c['model']=_[_0xf13d('0x29')](_0x5e2738,'name');_0x4a092c[_0xf13d('0x2a')]=_[_0xf13d('0x2b')](_0x5f2083['query']);_0x4a092c[_0xf13d('0x2c')]=_['intersection'](_0x4a092c[_0xf13d('0x2d')],_0x4a092c['query']);_0x4a092c[_0xf13d('0x2c')]=_[_0xf13d('0x2e')](_0x4a092c[_0xf13d('0x2c')],[_0xf13d('0x2f'),_0xf13d('0x30'),_0xf13d('0x31'),_0xf13d('0x32'),_0xf13d('0x33'),_0xf13d('0x34'),_0xf13d('0x35'),'$eq',_0xf13d('0x36'),_0xf13d('0x37'),_0xf13d('0x38'),'$in',_0xf13d('0x39'),'$like',_0xf13d('0x3a'),_0xf13d('0x3b'),_0xf13d('0x3c'),_0xf13d('0x3d'),_0xf13d('0x3e'),'$contains',_0xf13d('0x3f'),_0xf13d('0x40')]);_0x425636['attributes']=_[_0xf13d('0x41')](_0x4a092c[_0xf13d('0x2d')],qs['fields'](_0x5f2083['query']['fields']));_0x425636[_0xf13d('0x42')]=_0x425636['attributes']['length']?_0x425636['attributes']:_0x4a092c['model'];if(!_0x5f2083[_0xf13d('0x2a')][_0xf13d('0x43')](_0xf13d('0x44'))){_0x425636[_0xf13d('0x45')]=qs[_0xf13d('0x45')](_0x5f2083[_0xf13d('0x2a')]['limit']);_0x425636[_0xf13d('0x1c')]=qs['offset'](_0x5f2083['query']['offset']);}_0x425636[_0xf13d('0x46')]=qs[_0xf13d('0x47')](_0x5f2083[_0xf13d('0x2a')]['sort']);_0x425636[_0xf13d('0x48')]=qs[_0xf13d('0x2c')](_[_0xf13d('0x49')](_0x5f2083[_0xf13d('0x2a')],_0x4a092c[_0xf13d('0x2c')]));if(_0x5f2083[_0xf13d('0x2a')]['filter']){_0x425636[_0xf13d('0x48')]=_[_0xf13d('0x4a')](_0x425636[_0xf13d('0x48')],{'$or':_[_0xf13d('0x29')](_0x5e2738,function(_0x3e299c){if(_0x3e299c[_0xf13d('0x27')]!==_0xf13d('0x4b')){var _0x5e6189={};_0x5e6189[_0x3e299c[_0xf13d('0x25')]]={'$like':'%'+_0x5f2083[_0xf13d('0x2a')]['filter']+'%'};return _0x5e6189;}})});}_0x425636=_[_0xf13d('0x4a')]({},_0x425636,_0x5f2083['options']);var _0x40996d={'where':_0x425636[_0xf13d('0x48')]};return db[_0xf13d('0x4c')][_0xf13d('0x4d')](_0x40996d)[_0xf13d('0x22')](function(_0x3bd005){_0x56a180[_0xf13d('0x4d')]=_0x3bd005;if(_0x5f2083[_0xf13d('0x2a')][_0xf13d('0x4e')]){_0x425636['include']=[{'all':!![]}];}return db[_0xf13d('0x4c')][_0xf13d('0x4f')](_0x425636);})['then'](function(_0x384ce5){_0x56a180[_0xf13d('0x50')]=_0x384ce5;return _0x56a180;})[_0xf13d('0x22')](respondWithFilteredResult(_0x3b6548,_0x425636))[_0xf13d('0x51')](handleError(_0x3b6548,null));};exports[_0xf13d('0x52')]=function(_0xcd3038,_0x11ae06){var _0x3f6ca3={'raw':!![],'where':{'id':_0xcd3038[_0xf13d('0x53')]['id']}},_0x488ddf={};_0x488ddf[_0xf13d('0x2d')]=_[_0xf13d('0x2b')](db[_0xf13d('0x4c')][_0xf13d('0x54')]);_0x488ddf[_0xf13d('0x2a')]=_[_0xf13d('0x2b')](_0xcd3038[_0xf13d('0x2a')]);_0x488ddf[_0xf13d('0x2c')]=_[_0xf13d('0x41')](_0x488ddf[_0xf13d('0x2d')],_0x488ddf[_0xf13d('0x2a')]);_0x3f6ca3[_0xf13d('0x42')]=_['intersection'](_0x488ddf['model'],qs[_0xf13d('0x55')](_0xcd3038[_0xf13d('0x2a')][_0xf13d('0x55')]));_0x3f6ca3['attributes']=_0x3f6ca3[_0xf13d('0x42')][_0xf13d('0x56')]?_0x3f6ca3[_0xf13d('0x42')]:_0x488ddf[_0xf13d('0x2d')];if(_0xcd3038[_0xf13d('0x2a')][_0xf13d('0x4e')]){_0x3f6ca3[_0xf13d('0x57')]=[{'all':!![]}];}_0x3f6ca3=_[_0xf13d('0x4a')]({},_0x3f6ca3,_0xcd3038['options']);return db[_0xf13d('0x4c')][_0xf13d('0x58')](_0x3f6ca3)[_0xf13d('0x22')](handleEntityNotFound(_0x11ae06,null))[_0xf13d('0x22')](respondWithResult(_0x11ae06,null))[_0xf13d('0x51')](handleError(_0x11ae06,null));};exports[_0xf13d('0x59')]=function(_0x43905c,_0x21b8be){return db['CmHopper']['create'](_0x43905c[_0xf13d('0x5a')],{})[_0xf13d('0x22')](respondWithResult(_0x21b8be,0xc9))['catch'](handleError(_0x21b8be,null));};exports[_0xf13d('0x21')]=function(_0x11096b,_0x27c1f1){if(_0x11096b[_0xf13d('0x5a')]['id']){delete _0x11096b['body']['id'];}return db[_0xf13d('0x4c')][_0xf13d('0x58')]({'where':{'id':_0x11096b[_0xf13d('0x53')]['id']}})[_0xf13d('0x22')](handleEntityNotFound(_0x27c1f1,null))['then'](saveUpdates(_0x11096b[_0xf13d('0x5a')],null))['then'](respondWithResult(_0x27c1f1,null))[_0xf13d('0x51')](handleError(_0x27c1f1,null));};exports[_0xf13d('0x5b')]=function(_0x5d0c0e,_0x1ad51c){return db[_0xf13d('0x4c')]['describe']()['then'](respondWithResult(_0x1ad51c,null))[_0xf13d('0x51')](handleError(_0x1ad51c,null));};exports['destroy']=function(_0x319e5c,_0x28a0a2){var _0x4c682f;return db[_0xf13d('0x4c')][_0xf13d('0x58')]({'where':{'id':_0x319e5c[_0xf13d('0x53')]['id']}})['then'](handleEntityNotFound(_0x28a0a2,null))[_0xf13d('0x22')](function(_0x4fe1eb){if(_0x4fe1eb){return _0x4fe1eb[_0xf13d('0x5c')]()[_0xf13d('0x22')](function(_0x429393){return _0x429393;});}})['then'](function(_0x156d09){_0x4c682f=_0x156d09;if(_0x156d09){if(_0x156d09[_0xf13d('0x5d')]||_0x156d09['CampaignId']){return db[_0x156d09[_0xf13d('0x5d')]?_0xf13d('0x5e'):_0xf13d('0x5f')][_0xf13d('0x58')]({'where':{'id':_0x156d09['VoiceQueueId']?_0x156d09[_0xf13d('0x5d')]:_0x156d09[_0xf13d('0x60')]},'attributes':['id','name'],'raw':!![]});}}})[_0xf13d('0x22')](function(_0x565f27){var _0x42d999={};if(_0x565f27){_[_0xf13d('0x4a')](_0x42d999,_[_0xf13d('0x61')](_0x4c682f[_0xf13d('0x62')],['createdAt','updatedAt','id']));_0x42d999[_0xf13d('0x63')]=0x15;_0x42d999[_0xf13d('0x64')]=_0xf13d('0x65');_0x42d999['campaign']=_0x565f27[_0xf13d('0x25')];_0x42d999['membername']=_0x319e5c[_0xf13d('0x66')][_0xf13d('0x25')];_0x42d999[_0xf13d('0x67')]=_0x319e5c[_0xf13d('0x66')]['id'];_0x42d999['deleted']=!![];_0x42d999['deletedat']=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');_0x42d999['calleridnum']=_0x4c682f[_0xf13d('0x68')];_0x42d999[_0xf13d('0x69')]=_0x4c682f[_0xf13d('0x5d')]?'queue':_0xf13d('0x6a');return db[_0xf13d('0x6b')]['find']({'where':{'id':_0x42d999[_0xf13d('0x6c')]},'attributes':[_0xf13d('0x6d'),_0xf13d('0x6e')]})[_0xf13d('0x22')](function(_0x51faed){if(!_[_0xf13d('0x6f')](_0x28a0a2)&&!_[_0xf13d('0x6f')](_0x51faed['firstName'])){_0x42d999[_0xf13d('0x70')]=_0x51faed[_0xf13d('0x6d')];if(!_[_0xf13d('0x6f')](_0x51faed[_0xf13d('0x6e')])){_0x42d999['calleridname']+='\x20'+_0x51faed['lastName'];}}})[_0xf13d('0x71')](function(){return db[_0xf13d('0x72')]['create'](_0x42d999);});}})[_0xf13d('0x22')](function(){return _0x28a0a2['status'](0xcc)[_0xf13d('0x1a')]();})['catch'](handleError(_0x28a0a2,null));};exports[_0xf13d('0x73')]=function(_0x29da8a,_0x11336a,_0x36ef6a){var _0x3cc640=[];return db['CmContact'][_0xf13d('0x5b')]()[_0xf13d('0x22')](function(_0xb53014){_0x3cc640=_['keys'](_0xb53014);return _0x29da8a[_0xf13d('0x66')]['getVoiceQueues']({'where':{'type':'outbound','dialActive':!![],'dialMethod':_0xf13d('0x74')},'attributes':['id',_0xf13d('0x75')],'raw':!![]});})[_0xf13d('0x22')](function(_0x35ac09){if(_0x35ac09&&_0x35ac09[_0xf13d('0x56')]){return db[_0xf13d('0x76')]['transaction'](function(_0x3fe1d1){var _0x56916b={'active':![],'recallme':![],'scheduledAt':{'$lte':moment()['format'](_0xf13d('0x77'))},'VoiceQueueId':{'$in':_[_0xf13d('0x29')](_0x35ac09,'id')},'$or':[{'UserId':null},{'UserId':_0x29da8a[_0xf13d('0x66')]['id']}]};var _0x20ad0f=[];if(_0x29da8a['body'][_0xf13d('0x78')]&&_0x29da8a['body'][_0xf13d('0x78')]===_0xf13d('0x79')){if(!_[_0xf13d('0x7a')](_0x29da8a[_0xf13d('0x5a')][_0xf13d('0x7b')])){_0x56916b['id']={'$in':_0x29da8a[_0xf13d('0x5a')][_0xf13d('0x7b')]};}_0x20ad0f=[[_0xf13d('0x7c'),_0xf13d('0x7d')],[_0xf13d('0x7e'),_0x35ac09[0x0][_0xf13d('0x75')]===_0xf13d('0x7d')?_0xf13d('0x7f'):_0xf13d('0x7d')],db[_0xf13d('0x76')]['literal'](_0xf13d('0x80')),['id','DESC']];}else{if(!_[_0xf13d('0x7a')](_0x29da8a['body'][_0xf13d('0x7b')])){_0x56916b['id']={'$notIn':_0x29da8a[_0xf13d('0x5a')][_0xf13d('0x7b')]};}_0x20ad0f=[[_0xf13d('0x7c'),_0xf13d('0x7f')],[_0xf13d('0x7e'),_0x35ac09[0x0][_0xf13d('0x75')]],db[_0xf13d('0x76')][_0xf13d('0x81')]('COALESCE(CmHopper.UserId,\x200)\x20DESC'),['id',_0xf13d('0x7d')]];}return db[_0xf13d('0x4c')]['findOne']({'attributes':['id','scheduledat'],'where':_0x56916b,'order':_0x20ad0f,'transaction':_0x3fe1d1,'lock':_0x3fe1d1[_0xf13d('0x82')]['UPDATE'],'include':[{'model':db[_0xf13d('0x6b')],'as':'Contact','attributes':_0x3cc640,'include':[{'model':db[_0xf13d('0x83')],'as':'Company','attributes':['id',_0xf13d('0x25')]}]},{'model':db[_0xf13d('0x84')],'as':_0xf13d('0x85'),'attributes':['id',_0xf13d('0x25')]},{'model':db[_0xf13d('0x5e')],'as':'Queue','attributes':['id',_0xf13d('0x25'),_0xf13d('0x86')]}]})[_0xf13d('0x22')](function(_0x2318c9){if(_0x2318c9){return _0x2318c9[_0xf13d('0x21')]({'UserId':_0x29da8a['user']['id']},{'transaction':_0x3fe1d1});}});});}})['then'](handleEntityNotFound(_0x11336a,null))[_0xf13d('0x22')](respondWithResult(_0x11336a,null))[_0xf13d('0x51')](handleError(_0x11336a,null));};exports[_0xf13d('0x87')]=function(_0x34941e,_0xfd81d,_0x2c9ddb){return _0x34941e[_0xf13d('0x66')]['getVoiceQueues']({'where':{'type':_0xf13d('0x88'),'dialActive':!![],'dialMethod':_0xf13d('0x74')},'attributes':['id'],'raw':!![]})[_0xf13d('0x22')](function(_0xb258){if(_0xb258&&_0xb258[_0xf13d('0x56')]){return db['CmHopper']['count']({'where':{'active':![],'recallme':![],'scheduledAt':{'$lte':moment()[_0xf13d('0x89')](_0xf13d('0x77'))},'VoiceQueueId':{'$in':_[_0xf13d('0x29')](_0xb258,'id')},'$or':[{'UserId':null},{'UserId':_0x34941e[_0xf13d('0x66')]['id']}]}});}return 0x0;})[_0xf13d('0x22')](function(_0x32dcbd){if(!_[_0xf13d('0x6f')](_0x32dcbd)&&_[_0xf13d('0x8a')](_0x32dcbd)){return _0xfd81d[_0xf13d('0x19')](0xc8)['json']({'contacts':_0x32dcbd});}else{logger['error']('CmHopper,\x20%s,\x20%s,\x20%s',_0xf13d('0x87'),0x194,_0xf13d('0x8b'));_0xfd81d[_0xf13d('0x18')](0x194);}})['catch'](handleError(_0xfd81d,null));}; \ No newline at end of file +var _0x2b22=['$iLike','$like','$overlap','$contains','$contained','attributes','length','nolimit','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','rows','catch','rawAttributes','fields','find','create','params','body','describe','VoiceQueueId','VoiceQueue','Campaign','CampaignId','omit','createdAt','updatedAt','state','deleted','campaign','membername','user','format','YYYY-MM-DD\x20HH:mm:ss','calleridnum','phone','queue','ivr','ContactId','firstName','lastName','isNil','calleridname','finally','CmHopperFinal','CmContact','getVoiceQueues','outbound','sequelize','direction','isEmpty','hopperIds','priority','ASC','scheduledAt','dialOrderByScheduledAt','COALESCE(CmHopper.UserId,\x200)\x20ASC','DESC','literal','COALESCE(CmHopper.UserId,\x200)\x20DESC','findOne','scheduledat','LOCK','UPDATE','Contact','Company','CmList','List','Queue','dialActive','preview','isNumber','CmHopper,\x20%s,\x20%s,\x20%s','getOpenContacts','entity\x20not\x20found','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','util','path','sox','to-csv','ejs','lodash','jsforce','desk.js','querystring','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/environment','../../mysqldb','status','end','json','count','offset','limit','set','Content-Range','reject','update','then','destroy','sendStatus','error','stack','name','send','index','map','CmHopper','type','key','model','keys','query','filters','intersection','concat','$and','$or','$gt','$gte','$lte','$ne','$eq','$between','$notBetween','$in','$notIn','$notLike'];(function(_0x392951,_0xa1413e){var _0x482a16=function(_0x44fd5f){while(--_0x44fd5f){_0x392951['push'](_0x392951['shift']());}};_0x482a16(++_0xa1413e);}(_0x2b22,0x16d));var _0x22b2=function(_0x2b5863,_0x5ae46f){_0x2b5863=_0x2b5863-0x0;var _0x1f7ad8=_0x2b22[_0x2b5863];return _0x1f7ad8;};'use strict';var pdf=require(_0x22b2('0x0'));var emlformat=require(_0x22b2('0x1'));var rimraf=require(_0x22b2('0x2'));var zipdir=require(_0x22b2('0x3'));var jsonpatch=require(_0x22b2('0x4'));var rp=require('request-promise');var moment=require(_0x22b2('0x5'));var BPromise=require(_0x22b2('0x6'));var Mustache=require('mustache');var util=require(_0x22b2('0x7'));var path=require(_0x22b2('0x8'));var sox=require(_0x22b2('0x9'));var csv=require(_0x22b2('0xa'));var ejs=require(_0x22b2('0xb'));var fs=require('fs');var _=require(_0x22b2('0xc'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x22b2('0xd'));var deskjs=require(_0x22b2('0xe'));var toCsv=require(_0x22b2('0xa'));var querystring=require(_0x22b2('0xf'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x22b2('0x10'));var hardwareService=require(_0x22b2('0x11'));var logger=require('../../config/logger')(_0x22b2('0x12'));var utils=require('../../config/utils');var config=require(_0x22b2('0x13'));var db=require(_0x22b2('0x14'))['db'];function respondWithStatusCode(_0x7864f4,_0x42bc6f){_0x42bc6f=_0x42bc6f||0xcc;return function(_0x39969a){if(_0x39969a){return _0x7864f4['sendStatus'](_0x42bc6f);}return _0x7864f4[_0x22b2('0x15')](_0x42bc6f)[_0x22b2('0x16')]();};}function respondWithResult(_0x2fb78f,_0x189f33){_0x189f33=_0x189f33||0xc8;return function(_0x1efbb9){if(_0x1efbb9){return _0x2fb78f[_0x22b2('0x15')](_0x189f33)[_0x22b2('0x17')](_0x1efbb9);}};}function respondWithFilteredResult(_0x2c5388,_0x255a37){return function(_0x2f7827){if(_0x2f7827){var _0x3f9e2a=_0x2f7827[_0x22b2('0x18')],_0x4a8eed=_0x255a37[_0x22b2('0x19')],_0x29f27e=_0x255a37['offset']+_0x255a37[_0x22b2('0x1a')],_0x190115;if(_0x29f27e>=_0x3f9e2a){_0x29f27e=_0x3f9e2a;_0x190115=0xc8;}else{_0x190115=0xce;}_0x2c5388[_0x22b2('0x15')](_0x190115);return _0x2c5388[_0x22b2('0x1b')](_0x22b2('0x1c'),_0x4a8eed+'-'+_0x29f27e+'/'+_0x3f9e2a)[_0x22b2('0x17')](_0x2f7827);}return null;};}function patchUpdates(_0x32f290){return function(_0x527235){try{jsonpatch['apply'](_0x527235,_0x32f290,!![]);}catch(_0x1ad585){return BPromise[_0x22b2('0x1d')](_0x1ad585);}return _0x527235['save']();};}function saveUpdates(_0x2aa217,_0x4d1b9c){return function(_0x221dc7){if(_0x221dc7){return _0x221dc7[_0x22b2('0x1e')](_0x2aa217)[_0x22b2('0x1f')](function(_0x4841d3){return _0x4841d3;});}return null;};}function removeEntity(_0x40bf1a,_0xb05d6d){return function(_0x56920b){if(_0x56920b){return _0x56920b[_0x22b2('0x20')]()[_0x22b2('0x1f')](function(){_0x40bf1a[_0x22b2('0x15')](0xcc)[_0x22b2('0x16')]();});}};}function handleEntityNotFound(_0x462037,_0xeb3d0a){return function(_0x24c4b9){if(!_0x24c4b9){_0x462037[_0x22b2('0x21')](0x194);}return _0x24c4b9;};}function handleError(_0x4b5e11,_0x23f9ff){_0x23f9ff=_0x23f9ff||0x1f4;return function(_0x23ec32){logger[_0x22b2('0x22')](_0x23ec32[_0x22b2('0x23')]);if(_0x23ec32[_0x22b2('0x24')]){delete _0x23ec32[_0x22b2('0x24')];}_0x4b5e11[_0x22b2('0x15')](_0x23f9ff)[_0x22b2('0x25')](_0x23ec32);};}exports[_0x22b2('0x26')]=function(_0x182ee1,_0x15c618){var _0x2cc11a={},_0x5a4c28={},_0xccc1e3={'count':0x0,'rows':[]};var _0xd1d608=_[_0x22b2('0x27')](db[_0x22b2('0x28')]['rawAttributes'],function(_0x54c9ab){return{'name':_0x54c9ab['fieldName'],'type':_0x54c9ab[_0x22b2('0x29')][_0x22b2('0x2a')]};});_0x5a4c28[_0x22b2('0x2b')]=_[_0x22b2('0x27')](_0xd1d608,_0x22b2('0x24'));_0x5a4c28['query']=_[_0x22b2('0x2c')](_0x182ee1[_0x22b2('0x2d')]);_0x5a4c28[_0x22b2('0x2e')]=_[_0x22b2('0x2f')](_0x5a4c28[_0x22b2('0x2b')],_0x5a4c28['query']);_0x5a4c28[_0x22b2('0x2e')]=_[_0x22b2('0x30')](_0x5a4c28[_0x22b2('0x2e')],[_0x22b2('0x31'),_0x22b2('0x32'),_0x22b2('0x33'),_0x22b2('0x34'),'$lt',_0x22b2('0x35'),_0x22b2('0x36'),_0x22b2('0x37'),'$not',_0x22b2('0x38'),_0x22b2('0x39'),_0x22b2('0x3a'),_0x22b2('0x3b'),'$like',_0x22b2('0x3c'),_0x22b2('0x3d'),'$notILike',_0x22b2('0x3e'),_0x22b2('0x3f'),_0x22b2('0x40'),_0x22b2('0x41'),'$any']);_0x2cc11a[_0x22b2('0x42')]=_[_0x22b2('0x2f')](_0x5a4c28[_0x22b2('0x2b')],qs['fields'](_0x182ee1[_0x22b2('0x2d')]['fields']));_0x2cc11a[_0x22b2('0x42')]=_0x2cc11a[_0x22b2('0x42')][_0x22b2('0x43')]?_0x2cc11a[_0x22b2('0x42')]:_0x5a4c28[_0x22b2('0x2b')];if(!_0x182ee1['query']['hasOwnProperty'](_0x22b2('0x44'))){_0x2cc11a[_0x22b2('0x1a')]=qs[_0x22b2('0x1a')](_0x182ee1[_0x22b2('0x2d')][_0x22b2('0x1a')]);_0x2cc11a[_0x22b2('0x19')]=qs[_0x22b2('0x19')](_0x182ee1[_0x22b2('0x2d')][_0x22b2('0x19')]);}_0x2cc11a['order']=qs[_0x22b2('0x45')](_0x182ee1['query']['sort']);_0x2cc11a[_0x22b2('0x46')]=qs['filters'](_[_0x22b2('0x47')](_0x182ee1[_0x22b2('0x2d')],_0x5a4c28[_0x22b2('0x2e')]));if(_0x182ee1['query'][_0x22b2('0x48')]){_0x2cc11a['where']=_[_0x22b2('0x49')](_0x2cc11a['where'],{'$or':_['map'](_0xd1d608,function(_0x58c4f1){if(_0x58c4f1['type']!==_0x22b2('0x4a')){var _0x553e4f={};_0x553e4f[_0x58c4f1['name']]={'$like':'%'+_0x182ee1[_0x22b2('0x2d')][_0x22b2('0x48')]+'%'};return _0x553e4f;}})});}_0x2cc11a=_[_0x22b2('0x49')]({},_0x2cc11a,_0x182ee1[_0x22b2('0x4b')]);var _0x5cb23c={'where':_0x2cc11a[_0x22b2('0x46')]};return db[_0x22b2('0x28')]['count'](_0x5cb23c)['then'](function(_0x546178){_0xccc1e3['count']=_0x546178;if(_0x182ee1[_0x22b2('0x2d')][_0x22b2('0x4c')]){_0x2cc11a[_0x22b2('0x4d')]=[{'all':!![]}];}return db['CmHopper']['findAll'](_0x2cc11a);})['then'](function(_0x53f630){_0xccc1e3[_0x22b2('0x4e')]=_0x53f630;return _0xccc1e3;})[_0x22b2('0x1f')](respondWithFilteredResult(_0x15c618,_0x2cc11a))[_0x22b2('0x4f')](handleError(_0x15c618,null));};exports['show']=function(_0x298661,_0x5c2a3f){var _0x1783ee={'raw':!![],'where':{'id':_0x298661['params']['id']}},_0x29975e={};_0x29975e['model']=_[_0x22b2('0x2c')](db[_0x22b2('0x28')][_0x22b2('0x50')]);_0x29975e[_0x22b2('0x2d')]=_[_0x22b2('0x2c')](_0x298661[_0x22b2('0x2d')]);_0x29975e[_0x22b2('0x2e')]=_[_0x22b2('0x2f')](_0x29975e[_0x22b2('0x2b')],_0x29975e[_0x22b2('0x2d')]);_0x1783ee[_0x22b2('0x42')]=_[_0x22b2('0x2f')](_0x29975e['model'],qs[_0x22b2('0x51')](_0x298661['query']['fields']));_0x1783ee[_0x22b2('0x42')]=_0x1783ee[_0x22b2('0x42')][_0x22b2('0x43')]?_0x1783ee[_0x22b2('0x42')]:_0x29975e[_0x22b2('0x2b')];if(_0x298661[_0x22b2('0x2d')]['includeAll']){_0x1783ee[_0x22b2('0x4d')]=[{'all':!![]}];}_0x1783ee=_[_0x22b2('0x49')]({},_0x1783ee,_0x298661['options']);return db[_0x22b2('0x28')][_0x22b2('0x52')](_0x1783ee)[_0x22b2('0x1f')](handleEntityNotFound(_0x5c2a3f,null))[_0x22b2('0x1f')](respondWithResult(_0x5c2a3f,null))[_0x22b2('0x4f')](handleError(_0x5c2a3f,null));};exports[_0x22b2('0x53')]=function(_0xa1e218,_0x3343cc){return db['CmHopper'][_0x22b2('0x53')](_0xa1e218['body'],{})[_0x22b2('0x1f')](respondWithResult(_0x3343cc,0xc9))['catch'](handleError(_0x3343cc,null));};exports[_0x22b2('0x1e')]=function(_0x1f1690,_0x30f7c8){if(_0x1f1690['body']['id']){delete _0x1f1690['body']['id'];}return db[_0x22b2('0x28')][_0x22b2('0x52')]({'where':{'id':_0x1f1690[_0x22b2('0x54')]['id']}})[_0x22b2('0x1f')](handleEntityNotFound(_0x30f7c8,null))[_0x22b2('0x1f')](saveUpdates(_0x1f1690[_0x22b2('0x55')],null))['then'](respondWithResult(_0x30f7c8,null))['catch'](handleError(_0x30f7c8,null));};exports[_0x22b2('0x56')]=function(_0x19551e,_0x312f42){return db[_0x22b2('0x28')][_0x22b2('0x56')]()[_0x22b2('0x1f')](respondWithResult(_0x312f42,null))['catch'](handleError(_0x312f42,null));};exports[_0x22b2('0x20')]=function(_0x286c87,_0x36e0f8){var _0x51b55d;return db[_0x22b2('0x28')][_0x22b2('0x52')]({'where':{'id':_0x286c87[_0x22b2('0x54')]['id']}})[_0x22b2('0x1f')](handleEntityNotFound(_0x36e0f8,null))[_0x22b2('0x1f')](function(_0x5cac25){if(_0x5cac25){return _0x5cac25['destroy']()[_0x22b2('0x1f')](function(_0x3c4d66){return _0x3c4d66;});}})[_0x22b2('0x1f')](function(_0x220748){_0x51b55d=_0x220748;if(_0x220748){if(_0x220748['VoiceQueueId']||_0x220748['CampaignId']){return db[_0x220748[_0x22b2('0x57')]?_0x22b2('0x58'):_0x22b2('0x59')][_0x22b2('0x52')]({'where':{'id':_0x220748['VoiceQueueId']?_0x220748[_0x22b2('0x57')]:_0x220748[_0x22b2('0x5a')]},'attributes':['id',_0x22b2('0x24')],'raw':!![]});}}})[_0x22b2('0x1f')](function(_0x2361aa){var _0x58c12d={};if(_0x2361aa){_[_0x22b2('0x49')](_0x58c12d,_[_0x22b2('0x5b')](_0x51b55d['dataValues'],[_0x22b2('0x5c'),_0x22b2('0x5d'),'id']));_0x58c12d[_0x22b2('0x5e')]=0x15;_0x58c12d['statedesc']=_0x22b2('0x5f');_0x58c12d[_0x22b2('0x60')]=_0x2361aa['name'];_0x58c12d[_0x22b2('0x61')]=_0x286c87[_0x22b2('0x62')]['name'];_0x58c12d['UserId']=_0x286c87[_0x22b2('0x62')]['id'];_0x58c12d['deleted']=!![];_0x58c12d['deletedat']=moment()[_0x22b2('0x63')](_0x22b2('0x64'));_0x58c12d[_0x22b2('0x65')]=_0x51b55d[_0x22b2('0x66')];_0x58c12d['campaigntype']=_0x51b55d[_0x22b2('0x57')]?_0x22b2('0x67'):_0x22b2('0x68');return db['CmContact'][_0x22b2('0x52')]({'where':{'id':_0x58c12d[_0x22b2('0x69')]},'attributes':[_0x22b2('0x6a'),_0x22b2('0x6b')]})[_0x22b2('0x1f')](function(_0x348c4d){if(!_[_0x22b2('0x6c')](_0x36e0f8)&&!_[_0x22b2('0x6c')](_0x348c4d[_0x22b2('0x6a')])){_0x58c12d[_0x22b2('0x6d')]=_0x348c4d[_0x22b2('0x6a')];if(!_['isNil'](_0x348c4d[_0x22b2('0x6b')])){_0x58c12d[_0x22b2('0x6d')]+='\x20'+_0x348c4d['lastName'];}}})[_0x22b2('0x6e')](function(){return db[_0x22b2('0x6f')][_0x22b2('0x53')](_0x58c12d);});}})['then'](function(){return _0x36e0f8[_0x22b2('0x15')](0xcc)['end']();})[_0x22b2('0x4f')](handleError(_0x36e0f8,null));};exports['getPreview']=function(_0x26b511,_0x53d419,_0x5a6f32){var _0x30acf1=[];return db[_0x22b2('0x70')][_0x22b2('0x56')]()['then'](function(_0x5b3765){_0x30acf1=_[_0x22b2('0x2c')](_0x5b3765);return _0x26b511[_0x22b2('0x62')][_0x22b2('0x71')]({'where':{'type':_0x22b2('0x72'),'dialActive':!![],'dialMethod':'preview'},'attributes':['id','dialOrderByScheduledAt'],'raw':!![]});})[_0x22b2('0x1f')](function(_0x81576c){if(_0x81576c&&_0x81576c[_0x22b2('0x43')]){return db[_0x22b2('0x73')]['transaction'](function(_0x1320bc){var _0x3c50ba={'active':![],'recallme':![],'scheduledAt':{'$lte':moment()[_0x22b2('0x63')]('YYYY-MM-DD\x20HH:mm:ss')},'VoiceQueueId':{'$in':_[_0x22b2('0x27')](_0x81576c,'id')},'$or':[{'UserId':null},{'UserId':_0x26b511[_0x22b2('0x62')]['id']}]};var _0x5ddddf=[];if(_0x26b511['body'][_0x22b2('0x74')]&&_0x26b511[_0x22b2('0x55')][_0x22b2('0x74')]==='prev'){if(!_[_0x22b2('0x75')](_0x26b511[_0x22b2('0x55')][_0x22b2('0x76')])){_0x3c50ba['id']={'$in':_0x26b511[_0x22b2('0x55')][_0x22b2('0x76')]};}_0x5ddddf=[[_0x22b2('0x77'),_0x22b2('0x78')],[_0x22b2('0x79'),_0x81576c[0x0][_0x22b2('0x7a')]===_0x22b2('0x78')?'DESC':_0x22b2('0x78')],db[_0x22b2('0x73')]['literal'](_0x22b2('0x7b')),['id',_0x22b2('0x7c')]];}else{if(!_[_0x22b2('0x75')](_0x26b511[_0x22b2('0x55')][_0x22b2('0x76')])){_0x3c50ba['id']={'$notIn':_0x26b511['body'][_0x22b2('0x76')]};}_0x5ddddf=[[_0x22b2('0x77'),'DESC'],['scheduledAt',_0x81576c[0x0][_0x22b2('0x7a')]],db[_0x22b2('0x73')][_0x22b2('0x7d')](_0x22b2('0x7e')),['id',_0x22b2('0x78')]];}return db['CmHopper'][_0x22b2('0x7f')]({'attributes':['id',_0x22b2('0x80')],'where':_0x3c50ba,'order':_0x5ddddf,'transaction':_0x1320bc,'lock':_0x1320bc[_0x22b2('0x81')][_0x22b2('0x82')],'include':[{'model':db[_0x22b2('0x70')],'as':_0x22b2('0x83'),'attributes':_0x30acf1,'include':[{'model':db['CmCompany'],'as':_0x22b2('0x84'),'attributes':['id',_0x22b2('0x24')]}]},{'model':db[_0x22b2('0x85')],'as':_0x22b2('0x86'),'attributes':['id',_0x22b2('0x24')]},{'model':db[_0x22b2('0x58')],'as':_0x22b2('0x87'),'attributes':['id',_0x22b2('0x24'),_0x22b2('0x88')]}]})[_0x22b2('0x1f')](function(_0x1ad071){if(_0x1ad071){return _0x1ad071[_0x22b2('0x1e')]({'UserId':_0x26b511[_0x22b2('0x62')]['id']},{'transaction':_0x1320bc});}});});}})[_0x22b2('0x1f')](handleEntityNotFound(_0x53d419,null))[_0x22b2('0x1f')](respondWithResult(_0x53d419,null))['catch'](handleError(_0x53d419,null));};exports['getOpenContacts']=function(_0x31221e,_0x179563,_0x26e6a6){return _0x31221e[_0x22b2('0x62')]['getVoiceQueues']({'where':{'type':'outbound','dialActive':!![],'dialMethod':_0x22b2('0x89')},'attributes':['id'],'raw':!![]})[_0x22b2('0x1f')](function(_0x2ceb3b){if(_0x2ceb3b&&_0x2ceb3b[_0x22b2('0x43')]){return db[_0x22b2('0x28')][_0x22b2('0x18')]({'where':{'active':![],'recallme':![],'scheduledAt':{'$lte':moment()[_0x22b2('0x63')](_0x22b2('0x64'))},'VoiceQueueId':{'$in':_[_0x22b2('0x27')](_0x2ceb3b,'id')},'$or':[{'UserId':null},{'UserId':_0x31221e['user']['id']}]}});}return 0x0;})[_0x22b2('0x1f')](function(_0x2ec777){if(!_['isNil'](_0x2ec777)&&_[_0x22b2('0x8a')](_0x2ec777)){return _0x179563[_0x22b2('0x15')](0xc8)[_0x22b2('0x17')]({'contacts':_0x2ec777});}else{logger[_0x22b2('0x22')](_0x22b2('0x8b'),_0x22b2('0x8c'),0x194,_0x22b2('0x8d'));_0x179563['sendStatus'](0x194);}})[_0x22b2('0x4f')](handleError(_0x179563,null));}; \ No newline at end of file diff --git a/server/api/cmHopper/cmHopper.model.js b/server/api/cmHopper/cmHopper.model.js index ead69c0..9b9e0db 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 _0xa6b2=['define','CmHopper','cm_hopper','scheduledat','phone','priority','util','../../config/logger','api','moment','request-promise','path','rimraf','../../config/environment','./cmHopper.attributes'];(function(_0x1f33a8,_0x4d8b96){var _0x361cc8=function(_0x53297e){while(--_0x53297e){_0x1f33a8['push'](_0x1f33a8['shift']());}};_0x361cc8(++_0x4d8b96);}(_0xa6b2,0xab));var _0x2a6b=function(_0x215307,_0x426f48){_0x215307=_0x215307-0x0;var _0x1c6850=_0xa6b2[_0x215307];return _0x1c6850;};'use strict';var _=require('lodash');var util=require(_0x2a6b('0x0'));var logger=require(_0x2a6b('0x1'))(_0x2a6b('0x2'));var moment=require(_0x2a6b('0x3'));var BPromise=require('bluebird');var rp=require(_0x2a6b('0x4'));var fs=require('fs');var path=require(_0x2a6b('0x5'));var rimraf=require(_0x2a6b('0x6'));var config=require(_0x2a6b('0x7'));var attributes=require(_0x2a6b('0x8'));module['exports']=function(_0x196780,_0x3d2400){return _0x196780[_0x2a6b('0x9')](_0x2a6b('0xa'),attributes,{'tableName':_0x2a6b('0xb'),'paranoid':![],'indexes':[{'name':_0x2a6b('0xc'),'fields':[_0x2a6b('0xc')]},{'name':'phone','fields':[_0x2a6b('0xd')]},{'name':'priority','fields':[_0x2a6b('0xe')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x6367=['api','moment','bluebird','request-promise','path','rimraf','./cmHopper.attributes','exports','define','cm_hopper','scheduledat','phone','priority','util','../../config/logger'];(function(_0x40a045,_0x516f0e){var _0x1a687c=function(_0x48c9fe){while(--_0x48c9fe){_0x40a045['push'](_0x40a045['shift']());}};_0x1a687c(++_0x516f0e);}(_0x6367,0x11b));var _0x7636=function(_0x3c6ae2,_0x5c52d8){_0x3c6ae2=_0x3c6ae2-0x0;var _0x4edda=_0x6367[_0x3c6ae2];return _0x4edda;};'use strict';var _=require('lodash');var util=require(_0x7636('0x0'));var logger=require(_0x7636('0x1'))(_0x7636('0x2'));var moment=require(_0x7636('0x3'));var BPromise=require(_0x7636('0x4'));var rp=require(_0x7636('0x5'));var fs=require('fs');var path=require(_0x7636('0x6'));var rimraf=require(_0x7636('0x7'));var config=require('../../config/environment');var attributes=require(_0x7636('0x8'));module[_0x7636('0x9')]=function(_0x33f7f3,_0x179de1){return _0x33f7f3[_0x7636('0xa')]('CmHopper',attributes,{'tableName':_0x7636('0xb'),'paranoid':![],'indexes':[{'name':_0x7636('0xc'),'fields':['scheduledat']},{'name':_0x7636('0xd'),'fields':[_0x7636('0xd')]},{'name':_0x7636('0xe'),'fields':[_0x7636('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 03a8221..89194c8 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(_0x350a91,_0x2f02ee){_0x350a91=_0x350a91-0x0;var _0xea5346=_0x7a54[_0x350a91];return _0xea5346;};'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 _0xb10b=['order','LOCK','UPDATE','Contact','keys','User','Agent','name','voicePause','length','push','CmHopperFinal','MoveContactManagedDialer','CountReScheduled','COUNT','`scheduledat`\x20>=\x20','format','\x22%s\x22','\x20,\x201,\x20null','contactsRescheduled','GetContactRecallMe','all','lodash','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','info','CmHopper,\x20%s,\x20%s','CmHopper,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','result','GetCmHopper','CmHopper','findAll','options','raw','where','attributes','include','map','model','debug','catch','ShowCmHopper','CreateCmHopper','create','body','update','limit','UpdateCmHopper','destroy','DestroyCmHopper','GetContactDialer','CmContact','describe','sequelize','transaction'];(function(_0x432682,_0x253044){var _0x463d05=function(_0xa73403){while(--_0xa73403){_0x432682['push'](_0x432682['shift']());}};_0x463d05(++_0x253044);}(_0xb10b,0x12a));var _0xbb10=function(_0x4a7f3c,_0x74b703){_0x4a7f3c=_0x4a7f3c-0x0;var _0x89d3ae=_0xb10b[_0x4a7f3c];return _0x89d3ae;};'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')]({'raw':_0x378da8['options']?_0x378da8[_0xbb10('0x18')][_0xbb10('0x19')]===undefined?!![]:![]:!![],'where':_0x378da8[_0xbb10('0x18')]?_0x378da8[_0xbb10('0x18')][_0xbb10('0x1a')]||null:null,'attributes':_0x378da8[_0xbb10('0x18')]?_0x378da8['options'][_0xbb10('0x1b')]||null:null,'limit':_0x378da8[_0xbb10('0x18')]?_0x378da8['options']['limit']||null:null,'include':_0x378da8[_0xbb10('0x18')]?_0x378da8[_0xbb10('0x18')][_0xbb10('0x1c')]?_[_0xbb10('0x1d')](_0x378da8[_0xbb10('0x18')][_0xbb10('0x1c')],function(_0x407cb4){return{'model':db[_0x407cb4[_0xbb10('0x1e')]],'as':_0x407cb4['as'],'attributes':_0x407cb4[_0xbb10('0x1b')],'include':_0x407cb4[_0xbb10('0x1c')]?_[_0xbb10('0x1d')](_0x407cb4[_0xbb10('0x1c')],function(_0x537898){return{'model':db[_0x537898['model']],'as':_0x537898['as'],'attributes':_0x537898['attributes'],'include':_0x537898[_0xbb10('0x1c')]?_[_0xbb10('0x1d')](_0x537898[_0xbb10('0x1c')],function(_0x4e25ff){return{'model':db[_0x4e25ff[_0xbb10('0x1e')]],'as':_0x4e25ff['as'],'attributes':_0x4e25ff[_0xbb10('0x1b')]};}):[]};}):[]};}):[]:[]})[_0xbb10('0xc')](function(_0x1d5e95){logger[_0xbb10('0xd')](_0xbb10('0x15'),_0x378da8);logger[_0xbb10('0x1f')]('GetCmHopper',_0x378da8,JSON[_0xbb10('0x11')](_0x1d5e95));_0x575cca(_0x1d5e95);})[_0xbb10('0x20')](function(_0xfc3595){logger[_0xbb10('0x12')](_0xbb10('0x15'),_0xfc3595[_0xbb10('0x13')],_0x378da8);_0x30efc6(_0x1682a4['error'](0x1f4,_0xfc3595[_0xbb10('0x13')]));});});};exports['ShowCmHopper']=function(_0x448d5c){var _0x56f2da=this;return new Promise(function(_0x16ad2a,_0x1dcc9c){return db[_0xbb10('0x16')]['find']({'raw':_0x448d5c['options']?_0x448d5c[_0xbb10('0x18')][_0xbb10('0x19')]===undefined?!![]:![]:!![],'where':_0x448d5c['options']?_0x448d5c[_0xbb10('0x18')][_0xbb10('0x1a')]||null:null,'attributes':_0x448d5c[_0xbb10('0x18')]?_0x448d5c[_0xbb10('0x18')][_0xbb10('0x1b')]||null:null,'include':_0x448d5c[_0xbb10('0x18')]?_0x448d5c[_0xbb10('0x18')]['include']?_[_0xbb10('0x1d')](_0x448d5c[_0xbb10('0x18')][_0xbb10('0x1c')],function(_0x8c1ce6){return{'model':db[_0x8c1ce6[_0xbb10('0x1e')]],'as':_0x8c1ce6['as'],'attributes':_0x8c1ce6[_0xbb10('0x1b')],'include':_0x8c1ce6[_0xbb10('0x1c')]?_[_0xbb10('0x1d')](_0x8c1ce6[_0xbb10('0x1c')],function(_0x56943c){return{'model':db[_0x56943c[_0xbb10('0x1e')]],'as':_0x56943c['as'],'attributes':_0x56943c[_0xbb10('0x1b')],'include':_0x56943c[_0xbb10('0x1c')]?_[_0xbb10('0x1d')](_0x56943c['include'],function(_0x111762){return{'model':db[_0x111762['model']],'as':_0x111762['as'],'attributes':_0x111762['attributes']};}):[]};}):[]};}):[]:[]})[_0xbb10('0xc')](function(_0x40c164){logger[_0xbb10('0xd')](_0xbb10('0x21'),_0x448d5c);logger[_0xbb10('0x1f')](_0xbb10('0x21'),_0x448d5c,JSON['stringify'](_0x40c164));_0x16ad2a(_0x40c164);})[_0xbb10('0x20')](function(_0x25d72f){logger['error']('ShowCmHopper',_0x25d72f['message'],_0x448d5c);_0x1dcc9c(_0x56f2da[_0xbb10('0x12')](0x1f4,_0x25d72f[_0xbb10('0x13')]));});});};exports[_0xbb10('0x22')]=function(_0x4d5a9b){var _0x3c0cd7=this;return new Promise(function(_0x3e8538,_0x4345f3){return db['CmHopper'][_0xbb10('0x23')](_0x4d5a9b[_0xbb10('0x24')],{'raw':_0x4d5a9b[_0xbb10('0x18')]?_0x4d5a9b[_0xbb10('0x18')]['raw']===undefined?!![]:![]:!![]})[_0xbb10('0xc')](function(_0x110eb5){logger['info'](_0xbb10('0x22'),_0x4d5a9b);logger[_0xbb10('0x1f')](_0xbb10('0x22'),_0x4d5a9b,JSON[_0xbb10('0x11')](_0x110eb5));_0x3e8538(_0x110eb5);})[_0xbb10('0x20')](function(_0x185a52){logger['error'](_0xbb10('0x22'),_0x185a52[_0xbb10('0x13')],_0x4d5a9b);_0x4345f3(_0x3c0cd7[_0xbb10('0x12')](0x1f4,_0x185a52[_0xbb10('0x13')]));});});};exports['UpdateCmHopper']=function(_0x3fff6c){var _0x331751=this;return new Promise(function(_0x23dc18,_0x403beb){return db['CmHopper'][_0xbb10('0x25')](_0x3fff6c[_0xbb10('0x24')],{'raw':_0x3fff6c['options']?_0x3fff6c['options'][_0xbb10('0x19')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x3fff6c['options']?_0x3fff6c[_0xbb10('0x18')][_0xbb10('0x1a')]||null:null,'attributes':_0x3fff6c['options']?_0x3fff6c[_0xbb10('0x18')][_0xbb10('0x1b')]||null:null,'limit':_0x3fff6c[_0xbb10('0x18')]?_0x3fff6c['options'][_0xbb10('0x26')]||null:null})[_0xbb10('0xc')](function(_0x3b9fdf){logger[_0xbb10('0xd')](_0xbb10('0x27'),_0x3fff6c);logger[_0xbb10('0x1f')](_0xbb10('0x27'),_0x3fff6c,JSON[_0xbb10('0x11')](_0x3b9fdf));_0x23dc18(_0x3b9fdf);})[_0xbb10('0x20')](function(_0x43b948){logger[_0xbb10('0x12')](_0xbb10('0x27'),_0x43b948['message'],_0x3fff6c);_0x403beb(_0x331751[_0xbb10('0x12')](0x1f4,_0x43b948[_0xbb10('0x13')]));});});};exports['DestroyCmHopper']=function(_0x14e1cb){var _0x2f5027=this;return new Promise(function(_0x1a7df6,_0x5a5226){return db[_0xbb10('0x16')][_0xbb10('0x28')]({'where':_0x14e1cb[_0xbb10('0x18')]?_0x14e1cb['options']['where']||null:null})[_0xbb10('0xc')](function(_0x76a208){logger[_0xbb10('0xd')]('DestroyCmHopper',_0x14e1cb);logger['debug'](_0xbb10('0x29'),_0x14e1cb,JSON[_0xbb10('0x11')](_0x76a208));_0x1a7df6(_0x76a208);})[_0xbb10('0x20')](function(_0xf820fe){logger[_0xbb10('0x12')](_0xbb10('0x29'),_0xf820fe[_0xbb10('0x13')],_0x14e1cb);_0x5a5226(_0x2f5027[_0xbb10('0x12')](0x1f4,_0xf820fe[_0xbb10('0x13')]));});});};exports[_0xbb10('0x2a')]=function(_0x550111){var _0x5eafac=this;return new Promise(function(_0x412e13,_0x467dba){return db[_0xbb10('0x2b')][_0xbb10('0x2c')]()[_0xbb10('0xc')](function(_0x440f9e){return db[_0xbb10('0x2d')][_0xbb10('0x2e')](function(_0x1c0d8f){return db[_0xbb10('0x16')][_0xbb10('0x17')]({'where':_0x550111[_0xbb10('0x18')]?_0x550111[_0xbb10('0x18')][_0xbb10('0x1a')]||null:null,'attributes':_0x550111[_0xbb10('0x18')]?_0x550111['options'][_0xbb10('0x1b')]||null:null,'limit':_0x550111['options']?_0x550111[_0xbb10('0x18')][_0xbb10('0x26')]||null:null,'order':_0x550111[_0xbb10('0x18')]?_0x550111[_0xbb10('0x18')][_0xbb10('0x2f')]||null:null,'transaction':_0x1c0d8f,'lock':_0x1c0d8f[_0xbb10('0x30')][_0xbb10('0x31')],'include':[{'model':db[_0xbb10('0x2b')],'as':_0xbb10('0x32'),'attributes':_[_0xbb10('0x33')](_0x440f9e)},{'model':db[_0xbb10('0x34')],'as':_0xbb10('0x35'),'attributes':['id',_0xbb10('0x36'),_0xbb10('0x37')]}]})[_0xbb10('0xc')](function(_0x5de0cc){var _0x4571b6=[];for(var _0x466eb7=0x0;_0x466eb7<_0x5de0cc[_0xbb10('0x38')];_0x466eb7+=0x1){_0x4571b6[_0xbb10('0x39')](_0x5de0cc[_0x466eb7][_0xbb10('0x25')](_0x550111[_0xbb10('0x24')],{'transaction':_0x1c0d8f}));}return BPromise['all'](_0x4571b6);});})[_0xbb10('0xc')](function(_0x4731ce){logger[_0xbb10('0xd')](_0xbb10('0x2a'),_0x550111);logger[_0xbb10('0x1f')](_0xbb10('0x2a'),_0x550111,JSON[_0xbb10('0x11')](_0x4731ce));_0x412e13(_0x4731ce);})[_0xbb10('0x20')](function(_0x205e01){logger[_0xbb10('0x12')](_0xbb10('0x2a'),_0x205e01[_0xbb10('0x13')],_0x550111);_0x467dba(_0x5eafac[_0xbb10('0x12')](0x1f4,_0x205e01['message']));});});});};exports['MoveContactManagedDialer']=function(_0x16272d){var _0x3e6338=this;return new Promise(function(_0x3d0cb7,_0x8b0a7d){return db['sequelize']['transaction'](function(_0x79411e){return db[_0xbb10('0x3a')][_0xbb10('0x23')](_0x16272d[_0xbb10('0x24')],{'raw':_0x16272d[_0xbb10('0x18')]?_0x16272d[_0xbb10('0x18')][_0xbb10('0x19')]===undefined?!![]:![]:!![],'transaction':_0x79411e})['then'](function(){return db[_0xbb10('0x16')][_0xbb10('0x28')]({'where':_0x16272d['options']?_0x16272d['options']['where']||null:null,'transaction':_0x79411e});});})[_0xbb10('0xc')](function(_0x31c727){logger[_0xbb10('0xd')]('MoveContactManagedDialer',_0x16272d);logger['debug']('MoveContactManagedDialer',_0x16272d,JSON[_0xbb10('0x11')](_0x31c727));_0x3d0cb7(_0x31c727);})[_0xbb10('0x20')](function(_0x45167a){logger['error'](_0xbb10('0x3b'),_0x45167a[_0xbb10('0x13')],_0x16272d);_0x8b0a7d(_0x3e6338['error'](0x1f4,_0x45167a['message']));});});};exports[_0xbb10('0x3c')]=function(_0x308896){var _0xd77753=this;return new Promise(function(_0x237246,_0x54b7c5){return db[_0xbb10('0x16')][_0xbb10('0x17')]({'raw':_0x308896[_0xbb10('0x18')]?_0x308896['options'][_0xbb10('0x19')]===undefined?!![]:![]:!![],'where':_0x308896[_0xbb10('0x18')]?_0x308896[_0xbb10('0x18')]['where']||null:null,'attributes':[[db[_0xbb10('0x2d')]['fn'](_0xbb10('0x3d'),db[_0xbb10('0x2d')]['fn']('IF',db[_0xbb10('0x2d')]['literal'](_0xbb10('0x3e')+util[_0xbb10('0x3f')](_0xbb10('0x40'),moment()[_0xbb10('0x3f')]('YYYY-MM-DD\x20HH:mm:ss'))+_0xbb10('0x41')))),_0xbb10('0x42')]]})[_0xbb10('0xc')](function(_0x2ceb3e){logger[_0xbb10('0xd')](_0xbb10('0x3c'),_0x308896);logger[_0xbb10('0x1f')]('CountReScheduled',_0x308896,JSON['stringify'](_0x2ceb3e));_0x237246(_0x2ceb3e);})['catch'](function(_0xdfbc0b){logger[_0xbb10('0x12')](_0xbb10('0x3c'),_0xdfbc0b['message'],_0x308896);_0x54b7c5(_0xd77753['error'](0x1f4,_0xdfbc0b[_0xbb10('0x13')]));});});};exports[_0xbb10('0x43')]=function(_0xd9e743){var _0x3a9677=this;return new Promise(function(_0x260e06,_0x1ad2ed){return db['CmContact'][_0xbb10('0x2c')]()[_0xbb10('0xc')](function(_0x270fdb){return db[_0xbb10('0x2d')][_0xbb10('0x2e')](function(_0x5bfc68){return db['CmHopper']['findAll']({'where':_0xd9e743[_0xbb10('0x18')]?_0xd9e743[_0xbb10('0x18')][_0xbb10('0x1a')]||null:null,'attributes':_0xd9e743[_0xbb10('0x18')]?_0xd9e743[_0xbb10('0x18')][_0xbb10('0x1b')]||null:null,'limit':0x1,'order':_0xd9e743['options']?_0xd9e743[_0xbb10('0x18')]['order']||null:null,'group':db['CmHopper']['UserId'],'transaction':_0x5bfc68,'lock':_0x5bfc68[_0xbb10('0x30')][_0xbb10('0x31')],'include':_0xd9e743[_0xbb10('0x18')]?_0xd9e743[_0xbb10('0x18')]['include']?_[_0xbb10('0x1d')](_0xd9e743['options']['include'],function(_0x165fe9){return{'model':db[_0x165fe9[_0xbb10('0x1e')]],'as':_0x165fe9['as'],'attributes':_0x165fe9[_0xbb10('0x1b')],'include':_0x165fe9[_0xbb10('0x1c')]?_[_0xbb10('0x1d')](_0x165fe9['include'],function(_0x2d52ea){return{'model':db[_0x2d52ea[_0xbb10('0x1e')]],'as':_0x2d52ea['as'],'attributes':_0x2d52ea[_0xbb10('0x1b')],'include':_0x2d52ea[_0xbb10('0x1c')]?_[_0xbb10('0x1d')](_0x2d52ea[_0xbb10('0x1c')],function(_0x174395){return{'model':db[_0x174395['model']],'as':_0x174395['as'],'attributes':_0x174395[_0xbb10('0x1b')]};}):[]};}):[]};}):[]:[]})[_0xbb10('0xc')](function(_0x30f3ea){var _0x322b41=[];for(var _0x37b20e=0x0;_0x37b20e<_0x30f3ea[_0xbb10('0x38')];_0x37b20e+=0x1){_0x322b41[_0xbb10('0x39')](_0x30f3ea[_0x37b20e][_0xbb10('0x25')](_0xd9e743['body'],{'transaction':_0x5bfc68}));}return BPromise[_0xbb10('0x44')](_0x322b41);});})[_0xbb10('0xc')](function(_0x145baf){logger['info']('GetContactRecallMe',_0xd9e743);logger['debug'](_0xbb10('0x43'),_0xd9e743,JSON['stringify'](_0x145baf));_0x260e06(_0x145baf);})['catch'](function(_0x1701c5){logger[_0xbb10('0x12')](_0xbb10('0x43'),_0x1701c5[_0xbb10('0x13')],_0xd9e743);_0x1ad2ed(_0x3a9677[_0xbb10('0x12')](0x1f4,_0x1701c5[_0xbb10('0x13')]));});});});}; \ No newline at end of file diff --git a/server/api/cmHopper/index.js b/server/api/cmHopper/index.js index 9726943..85fdad9 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 _0x9a2d=['../../components/auth/service','../../components/interaction/service','../../config/environment','./cmHopper.controller','get','isAuthenticated','index','/describe','describe','/opencontacts','getOpenContacts','/:id','post','getPreview','put','update','delete','destroy','path','express','Router'];(function(_0x2dd2a5,_0x3c1267){var _0x2fc8c8=function(_0x1dfe0f){while(--_0x1dfe0f){_0x2dd2a5['push'](_0x2dd2a5['shift']());}};_0x2fc8c8(++_0x3c1267);}(_0x9a2d,0x123));var _0xd9a2=function(_0x247bf7,_0x31ecd9){_0x247bf7=_0x247bf7-0x0;var _0x103d93=_0x9a2d[_0x247bf7];return _0x103d93;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0xd9a2('0x0'));var timeout=require('connect-timeout');var express=require(_0xd9a2('0x1'));var router=express[_0xd9a2('0x2')]();var auth=require(_0xd9a2('0x3'));var interaction=require(_0xd9a2('0x4'));var config=require(_0xd9a2('0x5'));var controller=require(_0xd9a2('0x6'));router[_0xd9a2('0x7')]('/',auth[_0xd9a2('0x8')](),controller[_0xd9a2('0x9')]);router[_0xd9a2('0x7')](_0xd9a2('0xa'),auth[_0xd9a2('0x8')](),controller[_0xd9a2('0xb')]);router[_0xd9a2('0x7')](_0xd9a2('0xc'),auth[_0xd9a2('0x8')](),controller[_0xd9a2('0xd')]);router[_0xd9a2('0x7')](_0xd9a2('0xe'),auth[_0xd9a2('0x8')](),controller['show']);router['post']('/',auth[_0xd9a2('0x8')](),controller['create']);router[_0xd9a2('0xf')]('/preview',auth[_0xd9a2('0x8')](),controller[_0xd9a2('0x10')]);router[_0xd9a2('0x11')](_0xd9a2('0xe'),auth['isAuthenticated'](),controller[_0xd9a2('0x12')]);router[_0xd9a2('0x13')](_0xd9a2('0xe'),auth['isAuthenticated'](),controller[_0xd9a2('0x14')]);module['exports']=router; \ No newline at end of file +var _0x186d=['Router','../../components/auth/service','../../config/environment','./cmHopper.controller','get','/describe','isAuthenticated','/opencontacts','/:id','show','post','/preview','getPreview','put','update','destroy','exports','util','path','connect-timeout','express'];(function(_0x27e811,_0x20137c){var _0x1627fa=function(_0x4498ca){while(--_0x4498ca){_0x27e811['push'](_0x27e811['shift']());}};_0x1627fa(++_0x20137c);}(_0x186d,0x1ca));var _0xd186=function(_0x381f7f,_0x1321a9){_0x381f7f=_0x381f7f-0x0;var _0xd2ae6d=_0x186d[_0x381f7f];return _0xd2ae6d;};'use strict';var multer=require('multer');var util=require(_0xd186('0x0'));var path=require(_0xd186('0x1'));var timeout=require(_0xd186('0x2'));var express=require(_0xd186('0x3'));var router=express[_0xd186('0x4')]();var auth=require(_0xd186('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0xd186('0x6'));var controller=require(_0xd186('0x7'));router[_0xd186('0x8')]('/',auth['isAuthenticated'](),controller['index']);router[_0xd186('0x8')](_0xd186('0x9'),auth[_0xd186('0xa')](),controller['describe']);router[_0xd186('0x8')](_0xd186('0xb'),auth[_0xd186('0xa')](),controller['getOpenContacts']);router[_0xd186('0x8')](_0xd186('0xc'),auth[_0xd186('0xa')](),controller[_0xd186('0xd')]);router[_0xd186('0xe')]('/',auth[_0xd186('0xa')](),controller['create']);router['post'](_0xd186('0xf'),auth['isAuthenticated'](),controller[_0xd186('0x10')]);router[_0xd186('0x11')](_0xd186('0xc'),auth['isAuthenticated'](),controller[_0xd186('0x12')]);router['delete'](_0xd186('0xc'),auth[_0xd186('0xa')](),controller[_0xd186('0x13')]);module[_0xd186('0x14')]=router; \ No newline at end of file diff --git a/server/api/cmHopperBlack/cmHopperBlack.attributes.js b/server/api/cmHopperBlack/cmHopperBlack.attributes.js index a082494..a89519c 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 _0x2549=['exports','STRING','INTEGER','contactListQueue','sequelize'];(function(_0x4665c9,_0x6abe36){var _0xf8311f=function(_0x2e4daf){while(--_0x2e4daf){_0x4665c9['push'](_0x4665c9['shift']());}};_0xf8311f(++_0x6abe36);}(_0x2549,0xc2));var _0x9254=function(_0xea1f26,_0x30f159){_0xea1f26=_0xea1f26-0x0;var _0x19d97e=_0x2549[_0xea1f26];return _0x19d97e;};'use strict';var moment=require('moment');var Sequelize=require(_0x9254('0x0'));module[_0x9254('0x1')]={'phone':{'type':Sequelize[_0x9254('0x2')],'allowNull':![]},'ContactId':{'type':Sequelize[_0x9254('0x3')],'unique':_0x9254('0x4')},'ListId':{'type':Sequelize[_0x9254('0x3')],'unique':_0x9254('0x4')},'VoiceQueueId':{'type':Sequelize[_0x9254('0x3')],'unique':_0x9254('0x4')}}; \ No newline at end of file +var _0x4f52=['contactListQueue','sequelize','exports','INTEGER'];(function(_0x43dc75,_0x4fe855){var _0x28720f=function(_0x565b13){while(--_0x565b13){_0x43dc75['push'](_0x43dc75['shift']());}};_0x28720f(++_0x4fe855);}(_0x4f52,0x17d));var _0x24f5=function(_0xe41003,_0x360afe){_0xe41003=_0xe41003-0x0;var _0x371118=_0x4f52[_0xe41003];return _0x371118;};'use strict';var moment=require('moment');var Sequelize=require(_0x24f5('0x0'));module[_0x24f5('0x1')]={'phone':{'type':Sequelize['STRING'],'allowNull':![]},'ContactId':{'type':Sequelize[_0x24f5('0x2')],'unique':_0x24f5('0x3')},'ListId':{'type':Sequelize[_0x24f5('0x2')],'unique':_0x24f5('0x3')},'VoiceQueueId':{'type':Sequelize[_0x24f5('0x2')],'unique':_0x24f5('0x3')}}; \ No newline at end of file diff --git a/server/api/cmHopperBlack/cmHopperBlack.controller.js b/server/api/cmHopperBlack/cmHopperBlack.controller.js index 6f6eb11..3986cae 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 _0x6edc=['key','model','map','query','filters','intersection','attributes','fields','length','nolimit','order','sort','where','filter','merge','type','options','count','findAll','rows','params','keys','includeAll','include','find','body','catch','describe','html-pdf','eml-format','rimraf','zip-dir','moment','bluebird','mustache','util','sox','to-csv','ejs','squel','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','end','status','json','offset','limit','apply','reject','save','update','then','destroy','error','stack','name','send','index','CmHopperBlack','rawAttributes','fieldName'];(function(_0x551160,_0x5c74f0){var _0x13ca27=function(_0x544cda){while(--_0x544cda){_0x551160['push'](_0x551160['shift']());}};_0x13ca27(++_0x5c74f0);}(_0x6edc,0x138));var _0xc6ed=function(_0x75d766,_0x3c2b1e){_0x75d766=_0x75d766-0x0;var _0x3bd20d=_0x6edc[_0x75d766];return _0x3bd20d;};'use strict';var pdf=require(_0xc6ed('0x0'));var emlformat=require(_0xc6ed('0x1'));var rimraf=require(_0xc6ed('0x2'));var zipdir=require(_0xc6ed('0x3'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0xc6ed('0x4'));var BPromise=require(_0xc6ed('0x5'));var Mustache=require(_0xc6ed('0x6'));var util=require(_0xc6ed('0x7'));var path=require('path');var sox=require(_0xc6ed('0x8'));var csv=require(_0xc6ed('0x9'));var ejs=require(_0xc6ed('0xa'));var fs=require('fs');var _=require('lodash');var squel=require(_0xc6ed('0xb'));var crypto=require('crypto');var jsforce=require(_0xc6ed('0xc'));var deskjs=require(_0xc6ed('0xd'));var toCsv=require(_0xc6ed('0x9'));var querystring=require(_0xc6ed('0xe'));var Papa=require('papaparse');var Redis=require(_0xc6ed('0xf'));var authService=require(_0xc6ed('0x10'));var qs=require(_0xc6ed('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0xc6ed('0x12'))(_0xc6ed('0x13'));var utils=require(_0xc6ed('0x14'));var config=require(_0xc6ed('0x15'));var db=require(_0xc6ed('0x16'))['db'];function respondWithStatusCode(_0x47f799,_0x13fcd2){_0x13fcd2=_0x13fcd2||0xcc;return function(_0x502c32){if(_0x502c32){return _0x47f799[_0xc6ed('0x17')](_0x13fcd2);}return _0x47f799['status'](_0x13fcd2)[_0xc6ed('0x18')]();};}function respondWithResult(_0x39d8dd,_0x12ac9b){_0x12ac9b=_0x12ac9b||0xc8;return function(_0x5d36f6){if(_0x5d36f6){return _0x39d8dd[_0xc6ed('0x19')](_0x12ac9b)[_0xc6ed('0x1a')](_0x5d36f6);}};}function respondWithFilteredResult(_0xb14647,_0x5da6a5){return function(_0x55065e){if(_0x55065e){var _0x596897=_0x55065e['count'],_0x130bff=_0x5da6a5[_0xc6ed('0x1b')],_0x35e1d8=_0x5da6a5[_0xc6ed('0x1b')]+_0x5da6a5[_0xc6ed('0x1c')],_0x16ee41;if(_0x35e1d8>=_0x596897){_0x35e1d8=_0x596897;_0x16ee41=0xc8;}else{_0x16ee41=0xce;}_0xb14647[_0xc6ed('0x19')](_0x16ee41);return _0xb14647['set']('Content-Range',_0x130bff+'-'+_0x35e1d8+'/'+_0x596897)[_0xc6ed('0x1a')](_0x55065e);}return null;};}function patchUpdates(_0x9bbd08){return function(_0x38ea12){try{jsonpatch[_0xc6ed('0x1d')](_0x38ea12,_0x9bbd08,!![]);}catch(_0x41c5e8){return BPromise[_0xc6ed('0x1e')](_0x41c5e8);}return _0x38ea12[_0xc6ed('0x1f')]();};}function saveUpdates(_0xdbe2a1,_0xad393b){return function(_0x301a2a){if(_0x301a2a){return _0x301a2a[_0xc6ed('0x20')](_0xdbe2a1)[_0xc6ed('0x21')](function(_0x2664a9){return _0x2664a9;});}return null;};}function removeEntity(_0x37ed44,_0x587699){return function(_0x4c1e50){if(_0x4c1e50){return _0x4c1e50[_0xc6ed('0x22')]()['then'](function(){_0x37ed44['status'](0xcc)[_0xc6ed('0x18')]();});}};}function handleEntityNotFound(_0x487461,_0x2e6804){return function(_0x80bf){if(!_0x80bf){_0x487461[_0xc6ed('0x17')](0x194);}return _0x80bf;};}function handleError(_0x5b0d06,_0x4b63bc){_0x4b63bc=_0x4b63bc||0x1f4;return function(_0x4b5d2d){logger[_0xc6ed('0x23')](_0x4b5d2d[_0xc6ed('0x24')]);if(_0x4b5d2d[_0xc6ed('0x25')]){delete _0x4b5d2d[_0xc6ed('0x25')];}_0x5b0d06[_0xc6ed('0x19')](_0x4b63bc)[_0xc6ed('0x26')](_0x4b5d2d);};}exports[_0xc6ed('0x27')]=function(_0xec6c8b,_0x10e2a6){var _0x3c97e0={},_0xa7e8e3={},_0x1abee={'count':0x0,'rows':[]};var _0x491bd4=_['map'](db[_0xc6ed('0x28')][_0xc6ed('0x29')],function(_0x469d3d){return{'name':_0x469d3d[_0xc6ed('0x2a')],'type':_0x469d3d['type'][_0xc6ed('0x2b')]};});_0xa7e8e3[_0xc6ed('0x2c')]=_[_0xc6ed('0x2d')](_0x491bd4,_0xc6ed('0x25'));_0xa7e8e3[_0xc6ed('0x2e')]=_['keys'](_0xec6c8b[_0xc6ed('0x2e')]);_0xa7e8e3[_0xc6ed('0x2f')]=_[_0xc6ed('0x30')](_0xa7e8e3[_0xc6ed('0x2c')],_0xa7e8e3[_0xc6ed('0x2e')]);_0x3c97e0[_0xc6ed('0x31')]=_[_0xc6ed('0x30')](_0xa7e8e3[_0xc6ed('0x2c')],qs[_0xc6ed('0x32')](_0xec6c8b[_0xc6ed('0x2e')][_0xc6ed('0x32')]));_0x3c97e0['attributes']=_0x3c97e0[_0xc6ed('0x31')][_0xc6ed('0x33')]?_0x3c97e0[_0xc6ed('0x31')]:_0xa7e8e3[_0xc6ed('0x2c')];if(!_0xec6c8b[_0xc6ed('0x2e')]['hasOwnProperty'](_0xc6ed('0x34'))){_0x3c97e0['limit']=qs[_0xc6ed('0x1c')](_0xec6c8b[_0xc6ed('0x2e')]['limit']);_0x3c97e0['offset']=qs[_0xc6ed('0x1b')](_0xec6c8b[_0xc6ed('0x2e')]['offset']);}_0x3c97e0[_0xc6ed('0x35')]=qs[_0xc6ed('0x36')](_0xec6c8b['query']['sort']);_0x3c97e0[_0xc6ed('0x37')]=qs[_0xc6ed('0x2f')](_['pick'](_0xec6c8b[_0xc6ed('0x2e')],_0xa7e8e3[_0xc6ed('0x2f')]));if(_0xec6c8b[_0xc6ed('0x2e')][_0xc6ed('0x38')]){_0x3c97e0[_0xc6ed('0x37')]=_[_0xc6ed('0x39')](_0x3c97e0[_0xc6ed('0x37')],{'$or':_[_0xc6ed('0x2d')](_0x491bd4,function(_0x554d6c){if(_0x554d6c[_0xc6ed('0x3a')]!=='VIRTUAL'){var _0x193628={};_0x193628[_0x554d6c[_0xc6ed('0x25')]]={'$like':'%'+_0xec6c8b['query'][_0xc6ed('0x38')]+'%'};return _0x193628;}})});}_0x3c97e0=_[_0xc6ed('0x39')]({},_0x3c97e0,_0xec6c8b[_0xc6ed('0x3b')]);var _0x24197a={'where':_0x3c97e0[_0xc6ed('0x37')]};return db[_0xc6ed('0x28')]['count'](_0x24197a)[_0xc6ed('0x21')](function(_0x58bf8e){_0x1abee[_0xc6ed('0x3c')]=_0x58bf8e;if(_0xec6c8b[_0xc6ed('0x2e')]['includeAll']){_0x3c97e0['include']=[{'all':!![]}];}return db[_0xc6ed('0x28')][_0xc6ed('0x3d')](_0x3c97e0);})[_0xc6ed('0x21')](function(_0x464477){_0x1abee[_0xc6ed('0x3e')]=_0x464477;return _0x1abee;})[_0xc6ed('0x21')](respondWithFilteredResult(_0x10e2a6,_0x3c97e0))['catch'](handleError(_0x10e2a6,null));};exports['show']=function(_0x471582,_0x39ac43){var _0x2a041c={'raw':!![],'where':{'id':_0x471582[_0xc6ed('0x3f')]['id']}},_0x22b53b={};_0x22b53b[_0xc6ed('0x2c')]=_[_0xc6ed('0x40')](db[_0xc6ed('0x28')][_0xc6ed('0x29')]);_0x22b53b[_0xc6ed('0x2e')]=_['keys'](_0x471582[_0xc6ed('0x2e')]);_0x22b53b[_0xc6ed('0x2f')]=_['intersection'](_0x22b53b[_0xc6ed('0x2c')],_0x22b53b['query']);_0x2a041c[_0xc6ed('0x31')]=_[_0xc6ed('0x30')](_0x22b53b[_0xc6ed('0x2c')],qs[_0xc6ed('0x32')](_0x471582['query'][_0xc6ed('0x32')]));_0x2a041c[_0xc6ed('0x31')]=_0x2a041c['attributes'][_0xc6ed('0x33')]?_0x2a041c[_0xc6ed('0x31')]:_0x22b53b['model'];if(_0x471582[_0xc6ed('0x2e')][_0xc6ed('0x41')]){_0x2a041c[_0xc6ed('0x42')]=[{'all':!![]}];}_0x2a041c=_[_0xc6ed('0x39')]({},_0x2a041c,_0x471582[_0xc6ed('0x3b')]);return db[_0xc6ed('0x28')][_0xc6ed('0x43')](_0x2a041c)[_0xc6ed('0x21')](handleEntityNotFound(_0x39ac43,null))[_0xc6ed('0x21')](respondWithResult(_0x39ac43,null))['catch'](handleError(_0x39ac43,null));};exports[_0xc6ed('0x20')]=function(_0x1fc062,_0x2d9490){if(_0x1fc062['body']['id']){delete _0x1fc062[_0xc6ed('0x44')]['id'];}return db[_0xc6ed('0x28')][_0xc6ed('0x43')]({'where':{'id':_0x1fc062[_0xc6ed('0x3f')]['id']}})[_0xc6ed('0x21')](handleEntityNotFound(_0x2d9490,null))[_0xc6ed('0x21')](saveUpdates(_0x1fc062['body'],null))[_0xc6ed('0x21')](respondWithResult(_0x2d9490,null))[_0xc6ed('0x45')](handleError(_0x2d9490,null));};exports['destroy']=function(_0x5f53be,_0x1f260a){return db['CmHopperBlack'][_0xc6ed('0x43')]({'where':{'id':_0x5f53be[_0xc6ed('0x3f')]['id']}})[_0xc6ed('0x21')](handleEntityNotFound(_0x1f260a,null))[_0xc6ed('0x21')](removeEntity(_0x1f260a,null))[_0xc6ed('0x45')](handleError(_0x1f260a,null));};exports[_0xc6ed('0x46')]=function(_0x466519,_0x40ab64){return db[_0xc6ed('0x28')][_0xc6ed('0x46')]()[_0xc6ed('0x21')](respondWithResult(_0x40ab64,null))['catch'](handleError(_0x40ab64,null));}; \ No newline at end of file +var _0x0f97=['mustache','util','path','ejs','lodash','squel','crypto','to-csv','querystring','papaparse','ioredis','../../config/logger','api','../../config/utils','../../config/environment','sendStatus','status','count','offset','limit','set','Content-Range','apply','update','destroy','then','error','stack','name','send','index','map','CmHopperBlack','rawAttributes','fieldName','model','query','filters','attributes','fields','hasOwnProperty','nolimit','sort','where','pick','type','VIRTUAL','filter','merge','options','include','findAll','show','keys','length','includeAll','find','catch','body','params','describe','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird'];(function(_0x444921,_0x19a074){var _0x1d1c5b=function(_0x4007e8){while(--_0x4007e8){_0x444921['push'](_0x444921['shift']());}};_0x1d1c5b(++_0x19a074);}(_0x0f97,0x196));var _0x70f9=function(_0x474d97,_0x5909ce){_0x474d97=_0x474d97-0x0;var _0x1edf25=_0x0f97[_0x474d97];return _0x1edf25;};'use strict';var pdf=require(_0x70f9('0x0'));var emlformat=require(_0x70f9('0x1'));var rimraf=require(_0x70f9('0x2'));var zipdir=require(_0x70f9('0x3'));var jsonpatch=require(_0x70f9('0x4'));var rp=require(_0x70f9('0x5'));var moment=require(_0x70f9('0x6'));var BPromise=require(_0x70f9('0x7'));var Mustache=require(_0x70f9('0x8'));var util=require(_0x70f9('0x9'));var path=require(_0x70f9('0xa'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x70f9('0xb'));var fs=require('fs');var _=require(_0x70f9('0xc'));var squel=require(_0x70f9('0xd'));var crypto=require(_0x70f9('0xe'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x70f9('0xf'));var querystring=require(_0x70f9('0x10'));var Papa=require(_0x70f9('0x11'));var Redis=require(_0x70f9('0x12'));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(_0x70f9('0x13'))(_0x70f9('0x14'));var utils=require(_0x70f9('0x15'));var config=require(_0x70f9('0x16'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x32568f,_0x2ae8f0){_0x2ae8f0=_0x2ae8f0||0xcc;return function(_0x27d5cd){if(_0x27d5cd){return _0x32568f[_0x70f9('0x17')](_0x2ae8f0);}return _0x32568f[_0x70f9('0x18')](_0x2ae8f0)['end']();};}function respondWithResult(_0x6d9d9f,_0x5186dd){_0x5186dd=_0x5186dd||0xc8;return function(_0x57f942){if(_0x57f942){return _0x6d9d9f['status'](_0x5186dd)['json'](_0x57f942);}};}function respondWithFilteredResult(_0x30b651,_0x4d1deb){return function(_0x2a86bb){if(_0x2a86bb){var _0x36044f=_0x2a86bb[_0x70f9('0x19')],_0x138a8e=_0x4d1deb[_0x70f9('0x1a')],_0x3ce5ed=_0x4d1deb[_0x70f9('0x1a')]+_0x4d1deb[_0x70f9('0x1b')],_0x25b88f;if(_0x3ce5ed>=_0x36044f){_0x3ce5ed=_0x36044f;_0x25b88f=0xc8;}else{_0x25b88f=0xce;}_0x30b651['status'](_0x25b88f);return _0x30b651[_0x70f9('0x1c')](_0x70f9('0x1d'),_0x138a8e+'-'+_0x3ce5ed+'/'+_0x36044f)['json'](_0x2a86bb);}return null;};}function patchUpdates(_0x35ba0b){return function(_0x3634d3){try{jsonpatch[_0x70f9('0x1e')](_0x3634d3,_0x35ba0b,!![]);}catch(_0x22f7f7){return BPromise['reject'](_0x22f7f7);}return _0x3634d3['save']();};}function saveUpdates(_0x14de5c,_0x24a7f1){return function(_0x34e740){if(_0x34e740){return _0x34e740[_0x70f9('0x1f')](_0x14de5c)['then'](function(_0x15d7a8){return _0x15d7a8;});}return null;};}function removeEntity(_0x5156d5,_0x454339){return function(_0x309afd){if(_0x309afd){return _0x309afd[_0x70f9('0x20')]()[_0x70f9('0x21')](function(){_0x5156d5[_0x70f9('0x18')](0xcc)['end']();});}};}function handleEntityNotFound(_0x440f34,_0x38479d){return function(_0x388f13){if(!_0x388f13){_0x440f34['sendStatus'](0x194);}return _0x388f13;};}function handleError(_0x47057b,_0x474474){_0x474474=_0x474474||0x1f4;return function(_0xcc9c19){logger[_0x70f9('0x22')](_0xcc9c19[_0x70f9('0x23')]);if(_0xcc9c19['name']){delete _0xcc9c19[_0x70f9('0x24')];}_0x47057b[_0x70f9('0x18')](_0x474474)[_0x70f9('0x25')](_0xcc9c19);};}exports[_0x70f9('0x26')]=function(_0x345c11,_0xfe324e){var _0x54ddcd={},_0x470d0c={},_0x37d551={'count':0x0,'rows':[]};var _0x1a0da5=_[_0x70f9('0x27')](db[_0x70f9('0x28')][_0x70f9('0x29')],function(_0x3e29b9){return{'name':_0x3e29b9[_0x70f9('0x2a')],'type':_0x3e29b9['type']['key']};});_0x470d0c[_0x70f9('0x2b')]=_[_0x70f9('0x27')](_0x1a0da5,_0x70f9('0x24'));_0x470d0c['query']=_['keys'](_0x345c11[_0x70f9('0x2c')]);_0x470d0c[_0x70f9('0x2d')]=_['intersection'](_0x470d0c['model'],_0x470d0c[_0x70f9('0x2c')]);_0x54ddcd[_0x70f9('0x2e')]=_['intersection'](_0x470d0c[_0x70f9('0x2b')],qs[_0x70f9('0x2f')](_0x345c11['query'][_0x70f9('0x2f')]));_0x54ddcd[_0x70f9('0x2e')]=_0x54ddcd[_0x70f9('0x2e')]['length']?_0x54ddcd[_0x70f9('0x2e')]:_0x470d0c[_0x70f9('0x2b')];if(!_0x345c11['query'][_0x70f9('0x30')](_0x70f9('0x31'))){_0x54ddcd['limit']=qs[_0x70f9('0x1b')](_0x345c11[_0x70f9('0x2c')][_0x70f9('0x1b')]);_0x54ddcd[_0x70f9('0x1a')]=qs[_0x70f9('0x1a')](_0x345c11[_0x70f9('0x2c')][_0x70f9('0x1a')]);}_0x54ddcd['order']=qs[_0x70f9('0x32')](_0x345c11[_0x70f9('0x2c')][_0x70f9('0x32')]);_0x54ddcd[_0x70f9('0x33')]=qs[_0x70f9('0x2d')](_[_0x70f9('0x34')](_0x345c11['query'],_0x470d0c[_0x70f9('0x2d')]));if(_0x345c11[_0x70f9('0x2c')]['filter']){_0x54ddcd[_0x70f9('0x33')]=_['merge'](_0x54ddcd[_0x70f9('0x33')],{'$or':_['map'](_0x1a0da5,function(_0x53b955){if(_0x53b955[_0x70f9('0x35')]!==_0x70f9('0x36')){var _0x3385f9={};_0x3385f9[_0x53b955[_0x70f9('0x24')]]={'$like':'%'+_0x345c11[_0x70f9('0x2c')][_0x70f9('0x37')]+'%'};return _0x3385f9;}})});}_0x54ddcd=_[_0x70f9('0x38')]({},_0x54ddcd,_0x345c11[_0x70f9('0x39')]);var _0x16c40c={'where':_0x54ddcd['where']};return db[_0x70f9('0x28')][_0x70f9('0x19')](_0x16c40c)[_0x70f9('0x21')](function(_0x27b717){_0x37d551[_0x70f9('0x19')]=_0x27b717;if(_0x345c11[_0x70f9('0x2c')]['includeAll']){_0x54ddcd[_0x70f9('0x3a')]=[{'all':!![]}];}return db[_0x70f9('0x28')][_0x70f9('0x3b')](_0x54ddcd);})[_0x70f9('0x21')](function(_0x255a8f){_0x37d551['rows']=_0x255a8f;return _0x37d551;})[_0x70f9('0x21')](respondWithFilteredResult(_0xfe324e,_0x54ddcd))['catch'](handleError(_0xfe324e,null));};exports[_0x70f9('0x3c')]=function(_0x4cb3b8,_0x40cdd2){var _0x54452c={'raw':!![],'where':{'id':_0x4cb3b8['params']['id']}},_0x8c3827={};_0x8c3827['model']=_[_0x70f9('0x3d')](db['CmHopperBlack'][_0x70f9('0x29')]);_0x8c3827['query']=_[_0x70f9('0x3d')](_0x4cb3b8[_0x70f9('0x2c')]);_0x8c3827[_0x70f9('0x2d')]=_['intersection'](_0x8c3827['model'],_0x8c3827[_0x70f9('0x2c')]);_0x54452c[_0x70f9('0x2e')]=_['intersection'](_0x8c3827[_0x70f9('0x2b')],qs[_0x70f9('0x2f')](_0x4cb3b8[_0x70f9('0x2c')][_0x70f9('0x2f')]));_0x54452c[_0x70f9('0x2e')]=_0x54452c[_0x70f9('0x2e')][_0x70f9('0x3e')]?_0x54452c['attributes']:_0x8c3827[_0x70f9('0x2b')];if(_0x4cb3b8[_0x70f9('0x2c')][_0x70f9('0x3f')]){_0x54452c[_0x70f9('0x3a')]=[{'all':!![]}];}_0x54452c=_['merge']({},_0x54452c,_0x4cb3b8[_0x70f9('0x39')]);return db[_0x70f9('0x28')][_0x70f9('0x40')](_0x54452c)[_0x70f9('0x21')](handleEntityNotFound(_0x40cdd2,null))[_0x70f9('0x21')](respondWithResult(_0x40cdd2,null))[_0x70f9('0x41')](handleError(_0x40cdd2,null));};exports['update']=function(_0x34e4da,_0x15a22e){if(_0x34e4da[_0x70f9('0x42')]['id']){delete _0x34e4da[_0x70f9('0x42')]['id'];}return db['CmHopperBlack'][_0x70f9('0x40')]({'where':{'id':_0x34e4da['params']['id']}})[_0x70f9('0x21')](handleEntityNotFound(_0x15a22e,null))['then'](saveUpdates(_0x34e4da[_0x70f9('0x42')],null))[_0x70f9('0x21')](respondWithResult(_0x15a22e,null))[_0x70f9('0x41')](handleError(_0x15a22e,null));};exports[_0x70f9('0x20')]=function(_0x41cc84,_0x5a727e){return db[_0x70f9('0x28')]['find']({'where':{'id':_0x41cc84[_0x70f9('0x43')]['id']}})[_0x70f9('0x21')](handleEntityNotFound(_0x5a727e,null))[_0x70f9('0x21')](removeEntity(_0x5a727e,null))[_0x70f9('0x41')](handleError(_0x5a727e,null));};exports[_0x70f9('0x44')]=function(_0x59c385,_0x8bc338){return db['CmHopperBlack']['describe']()[_0x70f9('0x21')](respondWithResult(_0x8bc338,null))[_0x70f9('0x41')](handleError(_0x8bc338,null));}; \ No newline at end of file diff --git a/server/api/cmHopperBlack/cmHopperBlack.model.js b/server/api/cmHopperBlack/cmHopperBlack.model.js index fb32551..f82c8e6 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 _0x80dc=['./cmHopperBlack.attributes','exports','define','CmHopperBlack','cm_hopper_black','lodash','util','../../config/logger','api','moment','bluebird','path','rimraf','../../config/environment'];(function(_0x5f4164,_0x46f3a0){var _0xa39a0b=function(_0x3ad291){while(--_0x3ad291){_0x5f4164['push'](_0x5f4164['shift']());}};_0xa39a0b(++_0x46f3a0);}(_0x80dc,0xc9));var _0xc80d=function(_0x465028,_0x4570ac){_0x465028=_0x465028-0x0;var _0xb783d4=_0x80dc[_0x465028];return _0xb783d4;};'use strict';var _=require(_0xc80d('0x0'));var util=require(_0xc80d('0x1'));var logger=require(_0xc80d('0x2'))(_0xc80d('0x3'));var moment=require(_0xc80d('0x4'));var BPromise=require(_0xc80d('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xc80d('0x6'));var rimraf=require(_0xc80d('0x7'));var config=require(_0xc80d('0x8'));var attributes=require(_0xc80d('0x9'));module[_0xc80d('0xa')]=function(_0x44e9be,_0x5e9d88){return _0x44e9be[_0xc80d('0xb')](_0xc80d('0xc'),attributes,{'tableName':_0xc80d('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x0d34=['define','CmHopperBlack','cm_hopper_black','../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment','./cmHopperBlack.attributes','exports'];(function(_0x819464,_0x46fc91){var _0x49dcc0=function(_0x36b2b2){while(--_0x36b2b2){_0x819464['push'](_0x819464['shift']());}};_0x49dcc0(++_0x46fc91);}(_0x0d34,0x87));var _0x40d3=function(_0x1c9223,_0x1b17c9){_0x1c9223=_0x1c9223-0x0;var _0x3143c2=_0x0d34[_0x1c9223];return _0x3143c2;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x40d3('0x0'))(_0x40d3('0x1'));var moment=require(_0x40d3('0x2'));var BPromise=require(_0x40d3('0x3'));var rp=require(_0x40d3('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x40d3('0x5'));var config=require(_0x40d3('0x6'));var attributes=require(_0x40d3('0x7'));module[_0x40d3('0x8')]=function(_0x2aa8be,_0x45d086){return _0x2aa8be[_0x40d3('0x9')](_0x40d3('0xa'),attributes,{'tableName':_0x40d3('0xb'),'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 dd94984..c773ede 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 _0x845c=['stringify','error','code','message','result','catch','GetCmHopperBlack','CmHopperBlack','findAll','options','raw','where','attributes','limit','map','model','include','update','body','UpdateCmHopperBlack','destroy','then','DestroyCmHopperBlack','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','http','info','CmHopperBlack,\x20%s,\x20%s','debug','CmHopperBlack,\x20%s,\x20%s,\x20%s','request\x20sent'];(function(_0x2b83b5,_0x2ca8a8){var _0x333540=function(_0x53abe7){while(--_0x53abe7){_0x2b83b5['push'](_0x2b83b5['shift']());}};_0x333540(++_0x2ca8a8);}(_0x845c,0x12f));var _0xc845=function(_0x2641f9,_0x26715f){_0x2641f9=_0x2641f9-0x0;var _0x585741=_0x845c[_0x2641f9];return _0x585741;};'use strict';var _=require(_0xc845('0x0'));var util=require(_0xc845('0x1'));var moment=require(_0xc845('0x2'));var BPromise=require(_0xc845('0x3'));var rs=require(_0xc845('0x4'));var fs=require('fs');var Redis=require(_0xc845('0x5'));var db=require(_0xc845('0x6'))['db'];var utils=require(_0xc845('0x7'));var logger=require(_0xc845('0x8'))('rpc');var config=require(_0xc845('0x9'));var jayson=require(_0xc845('0xa'));var client=jayson['client'][_0xc845('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x177747,_0x36489a,_0x3081b6){return new BPromise(function(_0x2725ab,_0x26bf64){return client['request'](_0x177747,_0x3081b6)['then'](function(_0xdf9c33){logger[_0xc845('0xc')](_0xc845('0xd'),_0x36489a,'request\x20sent');logger[_0xc845('0xe')](_0xc845('0xf'),_0x36489a,_0xc845('0x10'),JSON[_0xc845('0x11')](_0xdf9c33));if(_0xdf9c33[_0xc845('0x12')]){if(_0xdf9c33['error'][_0xc845('0x13')]===0x1f4){logger[_0xc845('0x12')](_0xc845('0xd'),_0x36489a,_0xdf9c33[_0xc845('0x12')][_0xc845('0x14')]);return _0x26bf64(_0xdf9c33[_0xc845('0x12')][_0xc845('0x14')]);}logger[_0xc845('0x12')](_0xc845('0xd'),_0x36489a,_0xdf9c33['error'][_0xc845('0x14')]);return _0x2725ab(_0xdf9c33['error']['message']);}else{logger[_0xc845('0xc')](_0xc845('0xd'),_0x36489a,'request\x20sent');_0x2725ab(_0xdf9c33[_0xc845('0x15')]['message']);}})[_0xc845('0x16')](function(_0x513fa4){logger[_0xc845('0x12')](_0xc845('0xd'),_0x36489a,_0x513fa4);_0x26bf64(_0x513fa4);});});}exports[_0xc845('0x17')]=function(_0x3ee1bb){var _0x1f3390=this;return new Promise(function(_0x34f830,_0x30e58e){return db[_0xc845('0x18')][_0xc845('0x19')]({'raw':_0x3ee1bb['options']?_0x3ee1bb[_0xc845('0x1a')][_0xc845('0x1b')]===undefined?!![]:![]:!![],'where':_0x3ee1bb[_0xc845('0x1a')]?_0x3ee1bb[_0xc845('0x1a')][_0xc845('0x1c')]||null:null,'attributes':_0x3ee1bb['options']?_0x3ee1bb['options'][_0xc845('0x1d')]||null:null,'limit':_0x3ee1bb[_0xc845('0x1a')]?_0x3ee1bb[_0xc845('0x1a')][_0xc845('0x1e')]||null:null,'include':_0x3ee1bb[_0xc845('0x1a')]?_0x3ee1bb['options']['include']?_[_0xc845('0x1f')](_0x3ee1bb['options']['include'],function(_0x5729c0){return{'model':db[_0x5729c0[_0xc845('0x20')]],'as':_0x5729c0['as'],'attributes':_0x5729c0[_0xc845('0x1d')],'include':_0x5729c0[_0xc845('0x21')]?_[_0xc845('0x1f')](_0x5729c0[_0xc845('0x21')],function(_0x530b98){return{'model':db[_0x530b98[_0xc845('0x20')]],'as':_0x530b98['as'],'attributes':_0x530b98[_0xc845('0x1d')],'include':_0x530b98[_0xc845('0x21')]?_[_0xc845('0x1f')](_0x530b98['include'],function(_0x85af38){return{'model':db[_0x85af38[_0xc845('0x20')]],'as':_0x85af38['as'],'attributes':_0x85af38[_0xc845('0x1d')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x131822){logger[_0xc845('0xc')](_0xc845('0x17'),_0x3ee1bb);logger['debug'](_0xc845('0x17'),_0x3ee1bb,JSON[_0xc845('0x11')](_0x131822));_0x34f830(_0x131822);})[_0xc845('0x16')](function(_0x5dc5f3){logger['error']('GetCmHopperBlack',_0x5dc5f3[_0xc845('0x14')],_0x3ee1bb);_0x30e58e(_0x1f3390['error'](0x1f4,_0x5dc5f3[_0xc845('0x14')]));});});};exports['UpdateCmHopperBlack']=function(_0x2d4e47){var _0x8cbb55=this;return new Promise(function(_0x131a08,_0x4306e4){return db[_0xc845('0x18')][_0xc845('0x22')](_0x2d4e47[_0xc845('0x23')],{'raw':_0x2d4e47[_0xc845('0x1a')]?_0x2d4e47['options'][_0xc845('0x1b')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x2d4e47[_0xc845('0x1a')]?_0x2d4e47[_0xc845('0x1a')]['where']||null:null,'attributes':_0x2d4e47[_0xc845('0x1a')]?_0x2d4e47[_0xc845('0x1a')][_0xc845('0x1d')]||null:null,'limit':_0x2d4e47['options']?_0x2d4e47[_0xc845('0x1a')][_0xc845('0x1e')]||null:null})['then'](function(_0x5cfa55){logger[_0xc845('0xc')]('UpdateCmHopperBlack',_0x2d4e47);logger['debug'](_0xc845('0x24'),_0x2d4e47,JSON[_0xc845('0x11')](_0x5cfa55));_0x131a08(_0x5cfa55);})[_0xc845('0x16')](function(_0x2b4efd){logger[_0xc845('0x12')](_0xc845('0x24'),_0x2b4efd[_0xc845('0x14')],_0x2d4e47);_0x4306e4(_0x8cbb55[_0xc845('0x12')](0x1f4,_0x2b4efd[_0xc845('0x14')]));});});};exports['DestroyCmHopperBlack']=function(_0x30165f){var _0x573f91=this;return new Promise(function(_0x509af9,_0x49c199){return db[_0xc845('0x18')][_0xc845('0x25')]({'where':_0x30165f[_0xc845('0x1a')]?_0x30165f[_0xc845('0x1a')][_0xc845('0x1c')]||null:null})[_0xc845('0x26')](function(_0x1cd9e2){logger[_0xc845('0xc')](_0xc845('0x27'),_0x30165f);logger['debug'](_0xc845('0x27'),_0x30165f,JSON[_0xc845('0x11')](_0x1cd9e2));_0x509af9(_0x1cd9e2);})[_0xc845('0x16')](function(_0x231911){logger[_0xc845('0x12')](_0xc845('0x27'),_0x231911[_0xc845('0x14')],_0x30165f);_0x49c199(_0x573f91[_0xc845('0x12')](0x1f4,_0x231911['message']));});});}; \ No newline at end of file +var _0x70b1=['GetCmHopperBlack','CmHopperBlack','findAll','options','raw','where','attributes','limit','include','map','model','then','UpdateCmHopperBlack','update','debug','DestroyCmHopperBlack','destroy','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','jayson/promise','client','request','info','CmHopperBlack,\x20%s,\x20%s','request\x20sent','CmHopperBlack,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch'];(function(_0x2bf7cd,_0x56f201){var _0x39fc27=function(_0x1ac94e){while(--_0x1ac94e){_0x2bf7cd['push'](_0x2bf7cd['shift']());}};_0x39fc27(++_0x56f201);}(_0x70b1,0x15e));var _0x170b=function(_0x12e7e4,_0x3cbaef){_0x12e7e4=_0x12e7e4-0x0;var _0x1aa9d3=_0x70b1[_0x12e7e4];return _0x1aa9d3;};'use strict';var _=require('lodash');var util=require(_0x170b('0x0'));var moment=require('moment');var BPromise=require(_0x170b('0x1'));var rs=require(_0x170b('0x2'));var fs=require('fs');var Redis=require(_0x170b('0x3'));var db=require(_0x170b('0x4'))['db'];var utils=require(_0x170b('0x5'));var logger=require('../../config/logger')(_0x170b('0x6'));var config=require('../../config/environment');var jayson=require(_0x170b('0x7'));var client=jayson[_0x170b('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x947103,_0xeb5a47,_0x2704c3){return new BPromise(function(_0x4891a8,_0x12bae3){return client[_0x170b('0x9')](_0x947103,_0x2704c3)['then'](function(_0x1c3bd1){logger[_0x170b('0xa')](_0x170b('0xb'),_0xeb5a47,_0x170b('0xc'));logger['debug'](_0x170b('0xd'),_0xeb5a47,'request\x20sent',JSON[_0x170b('0xe')](_0x1c3bd1));if(_0x1c3bd1[_0x170b('0xf')]){if(_0x1c3bd1[_0x170b('0xf')][_0x170b('0x10')]===0x1f4){logger[_0x170b('0xf')](_0x170b('0xb'),_0xeb5a47,_0x1c3bd1[_0x170b('0xf')]['message']);return _0x12bae3(_0x1c3bd1[_0x170b('0xf')][_0x170b('0x11')]);}logger[_0x170b('0xf')](_0x170b('0xb'),_0xeb5a47,_0x1c3bd1[_0x170b('0xf')][_0x170b('0x11')]);return _0x4891a8(_0x1c3bd1[_0x170b('0xf')]['message']);}else{logger[_0x170b('0xa')]('CmHopperBlack,\x20%s,\x20%s',_0xeb5a47,_0x170b('0xc'));_0x4891a8(_0x1c3bd1[_0x170b('0x12')][_0x170b('0x11')]);}})[_0x170b('0x13')](function(_0x1ecc40){logger[_0x170b('0xf')](_0x170b('0xb'),_0xeb5a47,_0x1ecc40);_0x12bae3(_0x1ecc40);});});}exports[_0x170b('0x14')]=function(_0x27bb0c){var _0x560fb2=this;return new Promise(function(_0x37dc28,_0x540012){return db[_0x170b('0x15')][_0x170b('0x16')]({'raw':_0x27bb0c[_0x170b('0x17')]?_0x27bb0c[_0x170b('0x17')][_0x170b('0x18')]===undefined?!![]:![]:!![],'where':_0x27bb0c[_0x170b('0x17')]?_0x27bb0c[_0x170b('0x17')][_0x170b('0x19')]||null:null,'attributes':_0x27bb0c[_0x170b('0x17')]?_0x27bb0c[_0x170b('0x17')][_0x170b('0x1a')]||null:null,'limit':_0x27bb0c[_0x170b('0x17')]?_0x27bb0c[_0x170b('0x17')][_0x170b('0x1b')]||null:null,'include':_0x27bb0c[_0x170b('0x17')]?_0x27bb0c[_0x170b('0x17')][_0x170b('0x1c')]?_[_0x170b('0x1d')](_0x27bb0c[_0x170b('0x17')][_0x170b('0x1c')],function(_0x4eaab7){return{'model':db[_0x4eaab7[_0x170b('0x1e')]],'as':_0x4eaab7['as'],'attributes':_0x4eaab7['attributes'],'include':_0x4eaab7[_0x170b('0x1c')]?_[_0x170b('0x1d')](_0x4eaab7['include'],function(_0x230ebb){return{'model':db[_0x230ebb[_0x170b('0x1e')]],'as':_0x230ebb['as'],'attributes':_0x230ebb['attributes'],'include':_0x230ebb[_0x170b('0x1c')]?_[_0x170b('0x1d')](_0x230ebb[_0x170b('0x1c')],function(_0x55170c){return{'model':db[_0x55170c['model']],'as':_0x55170c['as'],'attributes':_0x55170c['attributes']};}):[]};}):[]};}):[]:[]})[_0x170b('0x1f')](function(_0x4a8b08){logger['info'](_0x170b('0x14'),_0x27bb0c);logger['debug'](_0x170b('0x14'),_0x27bb0c,JSON[_0x170b('0xe')](_0x4a8b08));_0x37dc28(_0x4a8b08);})[_0x170b('0x13')](function(_0x40b2af){logger['error'](_0x170b('0x14'),_0x40b2af[_0x170b('0x11')],_0x27bb0c);_0x540012(_0x560fb2['error'](0x1f4,_0x40b2af[_0x170b('0x11')]));});});};exports[_0x170b('0x20')]=function(_0x344ec8){var _0x1ff06a=this;return new Promise(function(_0x189c1f,_0xaa7e37){return db[_0x170b('0x15')][_0x170b('0x21')](_0x344ec8['body'],{'raw':_0x344ec8[_0x170b('0x17')]?_0x344ec8['options']['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x344ec8[_0x170b('0x17')]?_0x344ec8[_0x170b('0x17')][_0x170b('0x19')]||null:null,'attributes':_0x344ec8[_0x170b('0x17')]?_0x344ec8[_0x170b('0x17')][_0x170b('0x1a')]||null:null,'limit':_0x344ec8[_0x170b('0x17')]?_0x344ec8['options'][_0x170b('0x1b')]||null:null})[_0x170b('0x1f')](function(_0x239309){logger['info'](_0x170b('0x20'),_0x344ec8);logger[_0x170b('0x22')](_0x170b('0x20'),_0x344ec8,JSON[_0x170b('0xe')](_0x239309));_0x189c1f(_0x239309);})['catch'](function(_0x427552){logger[_0x170b('0xf')]('UpdateCmHopperBlack',_0x427552[_0x170b('0x11')],_0x344ec8);_0xaa7e37(_0x1ff06a['error'](0x1f4,_0x427552[_0x170b('0x11')]));});});};exports[_0x170b('0x23')]=function(_0x48860a){var _0x2de476=this;return new Promise(function(_0x162d63,_0x3dcd44){return db[_0x170b('0x15')][_0x170b('0x24')]({'where':_0x48860a[_0x170b('0x17')]?_0x48860a[_0x170b('0x17')]['where']||null:null})[_0x170b('0x1f')](function(_0x389bba){logger['info'](_0x170b('0x23'),_0x48860a);logger[_0x170b('0x22')](_0x170b('0x23'),_0x48860a,JSON[_0x170b('0xe')](_0x389bba));_0x162d63(_0x389bba);})[_0x170b('0x13')](function(_0x531f93){logger['error'](_0x170b('0x23'),_0x531f93[_0x170b('0x11')],_0x48860a);_0x3dcd44(_0x2de476['error'](0x1f4,_0x531f93['message']));});});}; \ No newline at end of file diff --git a/server/api/cmHopperBlack/index.js b/server/api/cmHopperBlack/index.js index 784d8e6..8e45fa6 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 _0xe5b3=['destroy','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./cmHopperBlack.controller','get','isAuthenticated','/describe','describe','/:id','update','delete'];(function(_0x5de1bc,_0x434be1){var _0x19f4b8=function(_0x35f764){while(--_0x35f764){_0x5de1bc['push'](_0x5de1bc['shift']());}};_0x19f4b8(++_0x434be1);}(_0xe5b3,0x133));var _0x3e5b=function(_0x4fa227,_0x1a93d4){_0x4fa227=_0x4fa227-0x0;var _0x30a825=_0xe5b3[_0x4fa227];return _0x30a825;};'use strict';var multer=require('multer');var util=require(_0x3e5b('0x0'));var path=require(_0x3e5b('0x1'));var timeout=require(_0x3e5b('0x2'));var express=require(_0x3e5b('0x3'));var router=express[_0x3e5b('0x4')]();var auth=require(_0x3e5b('0x5'));var interaction=require(_0x3e5b('0x6'));var config=require(_0x3e5b('0x7'));var controller=require(_0x3e5b('0x8'));router[_0x3e5b('0x9')]('/',auth[_0x3e5b('0xa')](),controller['index']);router[_0x3e5b('0x9')](_0x3e5b('0xb'),auth['isAuthenticated'](),controller[_0x3e5b('0xc')]);router[_0x3e5b('0x9')](_0x3e5b('0xd'),auth[_0x3e5b('0xa')](),controller['show']);router['put'](_0x3e5b('0xd'),auth[_0x3e5b('0xa')](),controller[_0x3e5b('0xe')]);router[_0x3e5b('0xf')](_0x3e5b('0xd'),auth['isAuthenticated'](),controller[_0x3e5b('0x10')]);module['exports']=router; \ No newline at end of file +var _0xeec6=['show','put','multer','util','path','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./cmHopperBlack.controller','get','index','isAuthenticated','describe','/:id'];(function(_0x18d486,_0x59d5bb){var _0x1f39d0=function(_0x26bdae){while(--_0x26bdae){_0x18d486['push'](_0x18d486['shift']());}};_0x1f39d0(++_0x59d5bb);}(_0xeec6,0x1c2));var _0x6eec=function(_0x14a0a0,_0x45d0cf){_0x14a0a0=_0x14a0a0-0x0;var _0x56b651=_0xeec6[_0x14a0a0];return _0x56b651;};'use strict';var multer=require(_0x6eec('0x0'));var util=require(_0x6eec('0x1'));var path=require(_0x6eec('0x2'));var timeout=require(_0x6eec('0x3'));var express=require('express');var router=express[_0x6eec('0x4')]();var auth=require(_0x6eec('0x5'));var interaction=require(_0x6eec('0x6'));var config=require(_0x6eec('0x7'));var controller=require(_0x6eec('0x8'));router[_0x6eec('0x9')]('/',auth['isAuthenticated'](),controller[_0x6eec('0xa')]);router[_0x6eec('0x9')]('/describe',auth[_0x6eec('0xb')](),controller[_0x6eec('0xc')]);router[_0x6eec('0x9')](_0x6eec('0xd'),auth['isAuthenticated'](),controller[_0x6eec('0xe')]);router[_0x6eec('0xf')](_0x6eec('0xd'),auth['isAuthenticated'](),controller['update']);router['delete'](_0x6eec('0xd'),auth[_0x6eec('0xb')](),controller['destroy']);module['exports']=router; \ No newline at end of file diff --git a/server/api/cmHopperFinal/cmHopperFinal.attributes.js b/server/api/cmHopperFinal/cmHopperFinal.attributes.js index cdecf4b..f37e77f 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 _0x5075=['INTEGER','STRING','DATE','getDataValue','endtime','setDataValue','followuptime','seconds','dispositionat','BOOLEAN','sequelize','moment'];(function(_0x166d93,_0x301f09){var _0xba708=function(_0x349bf7){while(--_0x349bf7){_0x166d93['push'](_0x166d93['shift']());}};_0xba708(++_0x301f09);}(_0x5075,0x6a));var _0x5507=function(_0x52cbe2,_0x5afefb){_0x52cbe2=_0x52cbe2-0x0;var _0x277141=_0x5075[_0x52cbe2];return _0x277141;};'use strict';var Sequelize=require(_0x5507('0x0'));var moment=require(_0x5507('0x1'));module['exports']={'state':{'type':Sequelize[_0x5507('0x2')](0x2)},'statedesc':{'type':Sequelize[_0x5507('0x3')]},'scheduledat':{'type':Sequelize[_0x5507('0x4')]},'countbusyretry':{'type':Sequelize[_0x5507('0x2')],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize[_0x5507('0x2')],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countglobal':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'uniqueid':{'type':Sequelize['STRING']},'originatecalleridnum':{'type':Sequelize[_0x5507('0x3')]},'originatecalleridname':{'type':Sequelize[_0x5507('0x3')]},'calleridnum':{'type':Sequelize['STRING']},'calleridname':{'type':Sequelize[_0x5507('0x3')]},'starttime':{'type':Sequelize[_0x5507('0x4')]},'responsetime':{'type':Sequelize[_0x5507('0x4')]},'answertime':{'type':Sequelize[_0x5507('0x4')]},'droptime':{'type':Sequelize[_0x5507('0x4')]},'endtime':{'type':Sequelize['DATE']},'ringtime':{'type':Sequelize[_0x5507('0x2')],'defaultValue':0x0},'holdtime':{'type':Sequelize[_0x5507('0x2')],'defaultValue':0x0},'talktime':{'type':Sequelize[_0x5507('0x2')],'defaultValue':0x0},'followuptime':{'type':Sequelize[_0x5507('0x2')],'defaultValue':0x0},'dropreason':{'type':Sequelize[_0x5507('0x3')]},'campaign':{'type':Sequelize[_0x5507('0x3')]},'campaigntype':{'type':Sequelize[_0x5507('0x3')]},'membername':{'type':Sequelize[_0x5507('0x3')]},'reason':{'type':Sequelize[_0x5507('0x3')]},'disposition':{'type':Sequelize[_0x5507('0x3')]},'dispositionat':{'type':Sequelize[_0x5507('0x4')],'set':function(_0x4bd596){var _0x52e768=this[_0x5507('0x5')](_0x5507('0x6'));if(_0x52e768&&_0x4bd596){this[_0x5507('0x7')](_0x5507('0x8'),moment(_0x4bd596)['diff'](moment(_0x52e768),_0x5507('0x9')));}return this['setDataValue'](_0x5507('0xa'),_0x4bd596);}},'amd':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'fax':{'type':Sequelize[_0x5507('0xb')],'defaultValue':![]},'blacklist':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'rescheduled':{'type':Sequelize[_0x5507('0xb')],'defaultValue':![]},'rescheduledat':{'type':Sequelize[_0x5507('0x4')]},'callback':{'type':Sequelize[_0x5507('0xb')],'defaultValue':![]},'callbackuniqueid':{'type':Sequelize[_0x5507('0x3')],'defaultValue':null},'callbackat':{'type':Sequelize['DATE']},'deleted':{'type':Sequelize['STRING'],'defaultValue':null},'deletedat':{'type':Sequelize[_0x5507('0x4')]},'recallme':{'type':Sequelize[_0x5507('0xb')],'defaultValue':![]},'agiafterat':{'type':Sequelize[_0x5507('0x4')]},'countnosuchnumberretry':{'type':Sequelize[_0x5507('0x2')],'defaultValue':0x0},'countdropretry':{'type':Sequelize[_0x5507('0x2')],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countmachineretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize[_0x5507('0x2')],'defaultValue':0x0}}; \ No newline at end of file +var _0x6319=['followuptime','diff','seconds','BOOLEAN','moment','INTEGER','STRING','DATE','getDataValue','endtime','setDataValue'];(function(_0xb1fd56,_0x51daa2){var _0x5b2512=function(_0x3823e1){while(--_0x3823e1){_0xb1fd56['push'](_0xb1fd56['shift']());}};_0x5b2512(++_0x51daa2);}(_0x6319,0xeb));var _0x9631=function(_0x13e838,_0xbb7d1){_0x13e838=_0x13e838-0x0;var _0x49910b=_0x6319[_0x13e838];return _0x49910b;};'use strict';var Sequelize=require('sequelize');var moment=require(_0x9631('0x0'));module['exports']={'state':{'type':Sequelize[_0x9631('0x1')](0x2)},'statedesc':{'type':Sequelize[_0x9631('0x2')]},'scheduledat':{'type':Sequelize[_0x9631('0x3')]},'countbusyretry':{'type':Sequelize[_0x9631('0x1')],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize[_0x9631('0x1')],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize[_0x9631('0x1')],'defaultValue':0x0},'countglobal':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'uniqueid':{'type':Sequelize['STRING']},'originatecalleridnum':{'type':Sequelize[_0x9631('0x2')]},'originatecalleridname':{'type':Sequelize[_0x9631('0x2')]},'calleridnum':{'type':Sequelize['STRING']},'calleridname':{'type':Sequelize[_0x9631('0x2')]},'starttime':{'type':Sequelize[_0x9631('0x3')]},'responsetime':{'type':Sequelize[_0x9631('0x3')]},'answertime':{'type':Sequelize['DATE']},'droptime':{'type':Sequelize['DATE']},'endtime':{'type':Sequelize['DATE']},'ringtime':{'type':Sequelize[_0x9631('0x1')],'defaultValue':0x0},'holdtime':{'type':Sequelize[_0x9631('0x1')],'defaultValue':0x0},'talktime':{'type':Sequelize[_0x9631('0x1')],'defaultValue':0x0},'followuptime':{'type':Sequelize[_0x9631('0x1')],'defaultValue':0x0},'dropreason':{'type':Sequelize['STRING']},'campaign':{'type':Sequelize[_0x9631('0x2')]},'campaigntype':{'type':Sequelize['STRING']},'membername':{'type':Sequelize['STRING']},'reason':{'type':Sequelize['STRING']},'disposition':{'type':Sequelize[_0x9631('0x2')]},'dispositionat':{'type':Sequelize['DATE'],'set':function(_0x52e6e5){var _0x5d577e=this[_0x9631('0x4')](_0x9631('0x5'));if(_0x5d577e&&_0x52e6e5){this[_0x9631('0x6')](_0x9631('0x7'),moment(_0x52e6e5)[_0x9631('0x8')](moment(_0x5d577e),_0x9631('0x9')));}return this['setDataValue']('dispositionat',_0x52e6e5);}},'amd':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'fax':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'blacklist':{'type':Sequelize[_0x9631('0xa')],'defaultValue':![]},'rescheduled':{'type':Sequelize[_0x9631('0xa')],'defaultValue':![]},'rescheduledat':{'type':Sequelize[_0x9631('0x3')]},'callback':{'type':Sequelize[_0x9631('0xa')],'defaultValue':![]},'callbackuniqueid':{'type':Sequelize['STRING'],'defaultValue':null},'callbackat':{'type':Sequelize[_0x9631('0x3')]},'deleted':{'type':Sequelize[_0x9631('0x2')],'defaultValue':null},'deletedat':{'type':Sequelize[_0x9631('0x3')]},'recallme':{'type':Sequelize[_0x9631('0xa')],'defaultValue':![]},'agiafterat':{'type':Sequelize[_0x9631('0x3')]},'countnosuchnumberretry':{'type':Sequelize[_0x9631('0x1')],'defaultValue':0x0},'countdropretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countmachineretry':{'type':Sequelize[_0x9631('0x1')],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize[_0x9631('0x1')],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/cmHopperFinal/cmHopperFinal.controller.js b/server/api/cmHopperFinal/cmHopperFinal.controller.js index 60bb86a..9e536ed 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 _0xe717=['../../config/logger','../../config/utils','../../config/environment','../../mysqldb','status','json','count','offset','set','Content-Range','apply','save','update','then','destroy','sendStatus','stack','name','send','index','CmHopperFinal','rawAttributes','fieldName','key','map','keys','query','intersection','model','fields','attributes','length','hasOwnProperty','nolimit','limit','order','sort','where','filters','merge','VIRTUAL','filter','include','rows','show','params','includeAll','options','find','catch','describe','body','uniqueid','countContactsQueueCampaignHopperFinal','sequelize','COUNT','`state`\x20=\x200,\x201,\x20null','`state`\x20=\x203,\x201,\x20null','noAnswerContacts','literal','`state`\x20=\x205,\x201,\x20null','busyContacts','`state`\x20=\x208,\x201,\x20null','congestionContacts','`state`\x20=\x2010\x20,\x201,\x20null','dropContacts','`state`\x20=\x2011\x20,\x201,\x20null','abandonedContacts','`state`\x20=\x2022,\x201,\x20null','reCallContacts','`state`\x20=\x2019,\x201,\x20null','answeringMachine','countContactsIvrCampaignHopperFinal','findAll','noSuchContacts','VoiceQueue','insert','fromQuery','scheduledAt','ContactId','ListId','VoiceQueueId','createdAt','updatedAt','select','field','ANY_VALUE(calleridnum)','NOW()','ANY_VALUE(ListId)','from','cm_hopper_final','state','toString','calleridnum\x20IS\x20NOT\x20NULL','phone','cm_hopper','VoiceQueueId\x20=\x20?','calleridnum\x20NOT\x20IN\x20(?)','state\x20=\x204','group','moveContactsIvrCampaignHopperFinal','Campaign','into','CampaignId','ANY_VALUE(ContactId)','ANY_VALUE(CampaignId)','CampaignId\x20=\x20?','state\x20=\x20?','calleridnum','CmHopper','html-pdf','rimraf','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','to-csv','squel','crypto','jsforce','desk.js','querystring','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch'];(function(_0x1c211a,_0x3a4746){var _0x11aa5d=function(_0x4b4875){while(--_0x4b4875){_0x1c211a['push'](_0x1c211a['shift']());}};_0x11aa5d(++_0x3a4746);}(_0xe717,0x1ee));var _0x7e71=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xe717[_0x3dd15e];return _0x231fd0;};'use strict';var pdf=require(_0x7e71('0x0'));var emlformat=require('eml-format');var rimraf=require(_0x7e71('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x7e71('0x2'));var rp=require(_0x7e71('0x3'));var moment=require('moment');var BPromise=require(_0x7e71('0x4'));var Mustache=require(_0x7e71('0x5'));var util=require(_0x7e71('0x6'));var path=require(_0x7e71('0x7'));var sox=require(_0x7e71('0x8'));var csv=require(_0x7e71('0x9'));var ejs=require('ejs');var fs=require('fs');var _=require('lodash');var squel=require(_0x7e71('0xa'));var crypto=require(_0x7e71('0xb'));var jsforce=require(_0x7e71('0xc'));var deskjs=require(_0x7e71('0xd'));var toCsv=require('to-csv');var querystring=require(_0x7e71('0xe'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x7e71('0xf'));var qs=require(_0x7e71('0x10'));var as=require(_0x7e71('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x7e71('0x12'))('api');var utils=require(_0x7e71('0x13'));var config=require(_0x7e71('0x14'));var db=require(_0x7e71('0x15'))['db'];function respondWithStatusCode(_0x16f5eb,_0x4f6524){_0x4f6524=_0x4f6524||0xcc;return function(_0x16f514){if(_0x16f514){return _0x16f5eb['sendStatus'](_0x4f6524);}return _0x16f5eb[_0x7e71('0x16')](_0x4f6524)['end']();};}function respondWithResult(_0x27ea75,_0x46659a){_0x46659a=_0x46659a||0xc8;return function(_0x541054){if(_0x541054){return _0x27ea75[_0x7e71('0x16')](_0x46659a)[_0x7e71('0x17')](_0x541054);}};}function respondWithFilteredResult(_0x43d55a,_0x26dec9){return function(_0x25c408){if(_0x25c408){var _0x13f5e2=_0x25c408[_0x7e71('0x18')],_0x449002=_0x26dec9[_0x7e71('0x19')],_0x4f7b1d=_0x26dec9[_0x7e71('0x19')]+_0x26dec9['limit'],_0x5d4b89;if(_0x4f7b1d>=_0x13f5e2){_0x4f7b1d=_0x13f5e2;_0x5d4b89=0xc8;}else{_0x5d4b89=0xce;}_0x43d55a[_0x7e71('0x16')](_0x5d4b89);return _0x43d55a[_0x7e71('0x1a')](_0x7e71('0x1b'),_0x449002+'-'+_0x4f7b1d+'/'+_0x13f5e2)[_0x7e71('0x17')](_0x25c408);}return null;};}function patchUpdates(_0x8cd08){return function(_0xccec72){try{jsonpatch[_0x7e71('0x1c')](_0xccec72,_0x8cd08,!![]);}catch(_0x303170){return BPromise['reject'](_0x303170);}return _0xccec72[_0x7e71('0x1d')]();};}function saveUpdates(_0x32542d,_0xeeeaed){return function(_0x39f237){if(_0x39f237){return _0x39f237[_0x7e71('0x1e')](_0x32542d)[_0x7e71('0x1f')](function(_0x2167cf){return _0x2167cf;});}return null;};}function removeEntity(_0xf91172,_0xe978c2){return function(_0x1ca3f3){if(_0x1ca3f3){return _0x1ca3f3[_0x7e71('0x20')]()[_0x7e71('0x1f')](function(){_0xf91172[_0x7e71('0x16')](0xcc)['end']();});}};}function handleEntityNotFound(_0xb88955,_0x54c300){return function(_0x35cd59){if(!_0x35cd59){_0xb88955[_0x7e71('0x21')](0x194);}return _0x35cd59;};}function handleError(_0x3d53f8,_0x10548c){_0x10548c=_0x10548c||0x1f4;return function(_0x33faa0){logger['error'](_0x33faa0[_0x7e71('0x22')]);if(_0x33faa0[_0x7e71('0x23')]){delete _0x33faa0[_0x7e71('0x23')];}_0x3d53f8['status'](_0x10548c)[_0x7e71('0x24')](_0x33faa0);};}exports[_0x7e71('0x25')]=function(_0x4eb38f,_0x5a4c36){var _0x3306da={},_0x16c92b={},_0x44560b={'count':0x0,'rows':[]};var _0x126379=_['map'](db[_0x7e71('0x26')][_0x7e71('0x27')],function(_0x266e8c){return{'name':_0x266e8c[_0x7e71('0x28')],'type':_0x266e8c['type'][_0x7e71('0x29')]};});_0x16c92b['model']=_[_0x7e71('0x2a')](_0x126379,_0x7e71('0x23'));_0x16c92b['query']=_[_0x7e71('0x2b')](_0x4eb38f[_0x7e71('0x2c')]);_0x16c92b['filters']=_[_0x7e71('0x2d')](_0x16c92b[_0x7e71('0x2e')],_0x16c92b[_0x7e71('0x2c')]);_0x3306da['attributes']=_['intersection'](_0x16c92b[_0x7e71('0x2e')],qs[_0x7e71('0x2f')](_0x4eb38f['query'][_0x7e71('0x2f')]));_0x3306da[_0x7e71('0x30')]=_0x3306da[_0x7e71('0x30')][_0x7e71('0x31')]?_0x3306da['attributes']:_0x16c92b[_0x7e71('0x2e')];if(!_0x4eb38f['query'][_0x7e71('0x32')](_0x7e71('0x33'))){_0x3306da['limit']=qs[_0x7e71('0x34')](_0x4eb38f[_0x7e71('0x2c')][_0x7e71('0x34')]);_0x3306da['offset']=qs['offset'](_0x4eb38f[_0x7e71('0x2c')][_0x7e71('0x19')]);}_0x3306da[_0x7e71('0x35')]=qs[_0x7e71('0x36')](_0x4eb38f['query'][_0x7e71('0x36')]);_0x3306da[_0x7e71('0x37')]=qs[_0x7e71('0x38')](_['pick'](_0x4eb38f[_0x7e71('0x2c')],_0x16c92b[_0x7e71('0x38')]));if(_0x4eb38f[_0x7e71('0x2c')]['filter']){_0x3306da['where']=_[_0x7e71('0x39')](_0x3306da[_0x7e71('0x37')],{'$or':_[_0x7e71('0x2a')](_0x126379,function(_0x4ed92f){if(_0x4ed92f['type']!==_0x7e71('0x3a')){var _0x55603b={};_0x55603b[_0x4ed92f[_0x7e71('0x23')]]={'$like':'%'+_0x4eb38f[_0x7e71('0x2c')][_0x7e71('0x3b')]+'%'};return _0x55603b;}})});}_0x3306da=_[_0x7e71('0x39')]({},_0x3306da,_0x4eb38f['options']);var _0x467d42={'where':_0x3306da[_0x7e71('0x37')]};return db['CmHopperFinal'][_0x7e71('0x18')](_0x467d42)[_0x7e71('0x1f')](function(_0x51d22b){_0x44560b[_0x7e71('0x18')]=_0x51d22b;if(_0x4eb38f['query']['includeAll']){_0x3306da[_0x7e71('0x3c')]=[{'all':!![]}];}return db[_0x7e71('0x26')]['findAll'](_0x3306da);})[_0x7e71('0x1f')](function(_0x2afbf6){_0x44560b[_0x7e71('0x3d')]=_0x2afbf6;return _0x44560b;})[_0x7e71('0x1f')](respondWithFilteredResult(_0x5a4c36,_0x3306da))['catch'](handleError(_0x5a4c36,null));};exports[_0x7e71('0x3e')]=function(_0x5b6231,_0x1dbeee){var _0x24d0f2={'raw':!![],'where':{'id':_0x5b6231[_0x7e71('0x3f')]['id']}},_0x48e66f={};_0x48e66f[_0x7e71('0x2e')]=_['keys'](db[_0x7e71('0x26')]['rawAttributes']);_0x48e66f[_0x7e71('0x2c')]=_[_0x7e71('0x2b')](_0x5b6231[_0x7e71('0x2c')]);_0x48e66f[_0x7e71('0x38')]=_[_0x7e71('0x2d')](_0x48e66f[_0x7e71('0x2e')],_0x48e66f[_0x7e71('0x2c')]);_0x24d0f2[_0x7e71('0x30')]=_['intersection'](_0x48e66f[_0x7e71('0x2e')],qs[_0x7e71('0x2f')](_0x5b6231['query']['fields']));_0x24d0f2[_0x7e71('0x30')]=_0x24d0f2[_0x7e71('0x30')][_0x7e71('0x31')]?_0x24d0f2['attributes']:_0x48e66f['model'];if(_0x5b6231[_0x7e71('0x2c')][_0x7e71('0x40')]){_0x24d0f2[_0x7e71('0x3c')]=[{'all':!![]}];}_0x24d0f2=_[_0x7e71('0x39')]({},_0x24d0f2,_0x5b6231[_0x7e71('0x41')]);return db[_0x7e71('0x26')][_0x7e71('0x42')](_0x24d0f2)[_0x7e71('0x1f')](handleEntityNotFound(_0x1dbeee,null))['then'](respondWithResult(_0x1dbeee,null))[_0x7e71('0x43')](handleError(_0x1dbeee,null));};exports[_0x7e71('0x44')]=function(_0x168522,_0x36e41e){return db['CmHopperFinal'][_0x7e71('0x44')]()[_0x7e71('0x1f')](respondWithResult(_0x36e41e,null))[_0x7e71('0x43')](handleError(_0x36e41e,null));};exports['update']=function(_0x318aff,_0x3ff0de){if(_0x318aff[_0x7e71('0x45')][_0x7e71('0x46')]){delete _0x318aff['body'][_0x7e71('0x46')];}return db['CmHopperFinal'][_0x7e71('0x42')]({'where':{'uniqueid':_0x318aff[_0x7e71('0x3f')]['id']}})[_0x7e71('0x1f')](handleEntityNotFound(_0x3ff0de,null))[_0x7e71('0x1f')](saveUpdates(_0x318aff[_0x7e71('0x45')],null))['then'](respondWithResult(_0x3ff0de,null))['catch'](handleError(_0x3ff0de,null));};exports[_0x7e71('0x47')]=function(_0x3c5972,_0x5539da,_0x2e9698){return db[_0x7e71('0x26')]['findAll']({'raw':![],'where':{'VoiceQueueId':_0x3c5972['params']['id']},'attributes':[[db[_0x7e71('0x48')]['fn'](_0x7e71('0x49'),db[_0x7e71('0x48')]['fn']('IF',db[_0x7e71('0x48')]['literal'](_0x7e71('0x4a')))),'noSuchContacts'],[db[_0x7e71('0x48')]['fn'](_0x7e71('0x49'),db[_0x7e71('0x48')]['fn']('IF',db[_0x7e71('0x48')]['literal'](_0x7e71('0x4b')))),_0x7e71('0x4c')],[db[_0x7e71('0x48')]['fn'](_0x7e71('0x49'),db[_0x7e71('0x48')]['fn']('IF',db[_0x7e71('0x48')][_0x7e71('0x4d')](_0x7e71('0x4e')))),_0x7e71('0x4f')],[db['sequelize']['fn'](_0x7e71('0x49'),db['sequelize']['fn']('IF',db[_0x7e71('0x48')][_0x7e71('0x4d')](_0x7e71('0x50')))),_0x7e71('0x51')],[db[_0x7e71('0x48')]['fn']('COUNT',db[_0x7e71('0x48')]['fn']('IF',db['sequelize']['literal'](_0x7e71('0x52')))),_0x7e71('0x53')],[db[_0x7e71('0x48')]['fn']('COUNT',db['sequelize']['fn']('IF',db[_0x7e71('0x48')][_0x7e71('0x4d')](_0x7e71('0x54')))),_0x7e71('0x55')],[db[_0x7e71('0x48')]['fn']('COUNT',db[_0x7e71('0x48')]['fn']('IF',db[_0x7e71('0x48')]['literal'](_0x7e71('0x56')))),_0x7e71('0x57')],[db[_0x7e71('0x48')]['fn'](_0x7e71('0x49'),db[_0x7e71('0x48')]['fn']('IF',db[_0x7e71('0x48')]['literal'](_0x7e71('0x58')))),_0x7e71('0x59')]]})[_0x7e71('0x1f')](handleEntityNotFound(_0x5539da,null))[_0x7e71('0x1f')](respondWithResult(_0x5539da,null))['catch'](handleError(_0x5539da,null));};exports[_0x7e71('0x5a')]=function(_0x3634cf,_0x5a9ca3,_0x32f8a5){return db[_0x7e71('0x26')][_0x7e71('0x5b')]({'raw':![],'where':{'CampaignId':_0x3634cf[_0x7e71('0x3f')]['id']},'attributes':[[db[_0x7e71('0x48')]['fn']('COUNT',db[_0x7e71('0x48')]['fn']('IF',db[_0x7e71('0x48')][_0x7e71('0x4d')](_0x7e71('0x4a')))),_0x7e71('0x5c')],[db[_0x7e71('0x48')]['fn'](_0x7e71('0x49'),db[_0x7e71('0x48')]['fn']('IF',db['sequelize'][_0x7e71('0x4d')]('`state`\x20=\x203,\x201,\x20null'))),_0x7e71('0x4c')],[db['sequelize']['fn'](_0x7e71('0x49'),db[_0x7e71('0x48')]['fn']('IF',db[_0x7e71('0x48')][_0x7e71('0x4d')](_0x7e71('0x4e')))),_0x7e71('0x4f')],[db[_0x7e71('0x48')]['fn'](_0x7e71('0x49'),db[_0x7e71('0x48')]['fn']('IF',db[_0x7e71('0x48')][_0x7e71('0x4d')](_0x7e71('0x50')))),_0x7e71('0x51')],[db[_0x7e71('0x48')]['fn'](_0x7e71('0x49'),db[_0x7e71('0x48')]['fn']('IF',db[_0x7e71('0x48')][_0x7e71('0x4d')](_0x7e71('0x52')))),_0x7e71('0x53')],[db[_0x7e71('0x48')]['fn']('COUNT',db[_0x7e71('0x48')]['fn']('IF',db[_0x7e71('0x48')][_0x7e71('0x4d')](_0x7e71('0x54')))),_0x7e71('0x55')],[db[_0x7e71('0x48')]['fn'](_0x7e71('0x49'),db[_0x7e71('0x48')]['fn']('IF',db[_0x7e71('0x48')][_0x7e71('0x4d')](_0x7e71('0x56')))),_0x7e71('0x57')],[db['sequelize']['fn'](_0x7e71('0x49'),db[_0x7e71('0x48')]['fn']('IF',db[_0x7e71('0x48')][_0x7e71('0x4d')](_0x7e71('0x58')))),'answeringMachine']]})['then'](handleEntityNotFound(_0x5a9ca3,null))[_0x7e71('0x1f')](respondWithResult(_0x5a9ca3,null))[_0x7e71('0x43')](handleError(_0x5a9ca3,null));};exports['moveContactsQueueCampaignHopperFinal']=function(_0x168c75,_0x123d45,_0xdd94fc){return db[_0x7e71('0x5d')][_0x7e71('0x42')]({'where':{'id':_0x168c75['params']['id']}})[_0x7e71('0x1f')](handleEntityNotFound(_0x123d45,null))[_0x7e71('0x1f')](function(_0x29570c){var _0x2b9158;if(_0x29570c){_0x2b9158=squel[_0x7e71('0x5e')]()['into']('cm_hopper')[_0x7e71('0x5f')](['phone',_0x7e71('0x60'),_0x7e71('0x61'),_0x7e71('0x62'),_0x7e71('0x63'),_0x7e71('0x64'),_0x7e71('0x65')],squel[_0x7e71('0x66')]()[_0x7e71('0x67')](_0x7e71('0x68'),'phone')[_0x7e71('0x67')](_0x7e71('0x69'),'scheduledAt')[_0x7e71('0x67')]('ANY_VALUE(ContactId)',_0x7e71('0x61'))[_0x7e71('0x67')](_0x7e71('0x6a'),_0x7e71('0x62'))[_0x7e71('0x67')]('ANY_VALUE(VoiceQueueId)',_0x7e71('0x63'))[_0x7e71('0x67')](_0x7e71('0x69'),'createdAt')['field']('NOW()','updatedAt')[_0x7e71('0x6b')](_0x7e71('0x6c'))['where']('VoiceQueueId\x20=\x20?',_0x168c75['params']['id']['toString']())[_0x7e71('0x37')]('state\x20=\x20?',_0x168c75[_0x7e71('0x45')][_0x7e71('0x6d')][_0x7e71('0x6e')]())[_0x7e71('0x37')](_0x7e71('0x6f'))[_0x7e71('0x37')]('calleridnum\x20NOT\x20IN\x20(?)',squel['select']()[_0x7e71('0x67')](_0x7e71('0x70'))[_0x7e71('0x6b')](_0x7e71('0x71'))[_0x7e71('0x37')](_0x7e71('0x72'),_0x168c75[_0x7e71('0x3f')]['id'][_0x7e71('0x6e')]()))['where'](_0x7e71('0x73'),squel[_0x7e71('0x66')]()[_0x7e71('0x67')]('calleridnum')[_0x7e71('0x6b')](_0x7e71('0x6c'))[_0x7e71('0x37')]('VoiceQueueId\x20=\x20?',_0x168c75[_0x7e71('0x3f')]['id'][_0x7e71('0x6e')]())[_0x7e71('0x37')](_0x7e71('0x74')))[_0x7e71('0x75')](_0x7e71('0x61')))[_0x7e71('0x6e')]();return db[_0x7e71('0x48')]['query'](_0x2b9158);}return[];})[_0x7e71('0x1f')](respondWithResult(_0x123d45,null))[_0x7e71('0x43')](handleError(_0x123d45,null));};exports[_0x7e71('0x76')]=function(_0x5951e1,_0x16b9c5,_0x4fdd4d){return db[_0x7e71('0x77')][_0x7e71('0x42')]({'where':{'id':_0x5951e1[_0x7e71('0x3f')]['id']}})[_0x7e71('0x1f')](handleEntityNotFound(_0x16b9c5,null))[_0x7e71('0x1f')](function(_0x16a9ea){var _0x257422;if(_0x16a9ea){_0x257422=squel['insert']()[_0x7e71('0x78')](_0x7e71('0x71'))[_0x7e71('0x5f')]([_0x7e71('0x70'),_0x7e71('0x60'),_0x7e71('0x61'),_0x7e71('0x62'),_0x7e71('0x79'),_0x7e71('0x64'),'updatedAt'],squel[_0x7e71('0x66')]()[_0x7e71('0x67')](_0x7e71('0x68'),_0x7e71('0x70'))[_0x7e71('0x67')](_0x7e71('0x69'),_0x7e71('0x60'))['field'](_0x7e71('0x7a'),'ContactId')['field'](_0x7e71('0x6a'),_0x7e71('0x62'))['field'](_0x7e71('0x7b'),'CampaignId')[_0x7e71('0x67')](_0x7e71('0x69'),_0x7e71('0x64'))['field'](_0x7e71('0x69'),'updatedAt')[_0x7e71('0x6b')](_0x7e71('0x6c'))[_0x7e71('0x37')](_0x7e71('0x7c'),_0x5951e1['params']['id']['toString']())[_0x7e71('0x37')](_0x7e71('0x7d'),_0x5951e1[_0x7e71('0x45')][_0x7e71('0x6d')][_0x7e71('0x6e')]())[_0x7e71('0x37')](_0x7e71('0x6f'))['where'](_0x7e71('0x73'),squel[_0x7e71('0x66')]()[_0x7e71('0x67')](_0x7e71('0x70'))[_0x7e71('0x6b')](_0x7e71('0x71'))[_0x7e71('0x37')](_0x7e71('0x7c'),_0x5951e1['params']['id'][_0x7e71('0x6e')]()))[_0x7e71('0x37')](_0x7e71('0x73'),squel[_0x7e71('0x66')]()[_0x7e71('0x67')](_0x7e71('0x7e'))['from'](_0x7e71('0x6c'))[_0x7e71('0x37')](_0x7e71('0x7c'),_0x5951e1['params']['id'][_0x7e71('0x6e')]())['where']('state\x20=\x204'))[_0x7e71('0x75')](_0x7e71('0x61')))[_0x7e71('0x6e')]();return db[_0x7e71('0x48')][_0x7e71('0x2c')](_0x257422);}return[];})[_0x7e71('0x1f')](respondWithResult(_0x16b9c5,null))[_0x7e71('0x43')](handleError(_0x16b9c5,null));};exports['checkContactHopper']=function(_0x51caab,_0x529499,_0x1f6cb0){return db[_0x7e71('0x7f')]['findOne']({'where':{'VoiceQueueId':_0x51caab[_0x7e71('0x45')][_0x7e71('0x63')],'CampaignId':_0x51caab[_0x7e71('0x45')][_0x7e71('0x79')],'ContactId':_0x51caab['body']['ContactId']}})[_0x7e71('0x1f')](handleEntityNotFound(_0x529499,null))[_0x7e71('0x1f')](function(_0x4b0394){if(_0x4b0394){return _0x4b0394;}return null;})[_0x7e71('0x1f')](respondWithResult(_0x529499,null))['catch'](handleError(_0x529499,null));}; \ No newline at end of file +var _0x801a=['limit','set','Content-Range','apply','reject','save','update','then','destroy','sendStatus','error','stack','name','index','map','rawAttributes','fieldName','type','key','query','keys','filters','model','intersection','fields','attributes','length','hasOwnProperty','nolimit','sort','pick','filter','merge','where','options','CmHopperFinal','includeAll','findAll','rows','catch','show','params','include','find','describe','body','uniqueid','countContactsQueueCampaignHopperFinal','sequelize','COUNT','literal','noSuchContacts','`state`\x20=\x203,\x201,\x20null','`state`\x20=\x205,\x201,\x20null','busyContacts','`state`\x20=\x208,\x201,\x20null','congestionContacts','`state`\x20=\x2010\x20,\x201,\x20null','dropContacts','`state`\x20=\x2011\x20,\x201,\x20null','`state`\x20=\x2022,\x201,\x20null','reCallContacts','answeringMachine','`state`\x20=\x200,\x201,\x20null','abandonedContacts','`state`\x20=\x2019,\x201,\x20null','moveContactsQueueCampaignHopperFinal','VoiceQueue','insert','into','cm_hopper','fromQuery','scheduledAt','ContactId','createdAt','updatedAt','field','phone','NOW()','ANY_VALUE(ContactId)','ANY_VALUE(ListId)','ListId','ANY_VALUE(VoiceQueueId)','VoiceQueueId','from','cm_hopper_final','toString','state\x20=\x20?','calleridnum\x20IS\x20NOT\x20NULL','calleridnum\x20NOT\x20IN\x20(?)','select','calleridnum','state\x20=\x204','moveContactsIvrCampaignHopperFinal','Campaign','CampaignId','ANY_VALUE(calleridnum)','ANY_VALUE(CampaignId)','CampaignId\x20=\x20?','state','group','checkContactHopper','CmHopper','findOne','html-pdf','eml-format','zip-dir','fast-json-patch','moment','bluebird','mustache','sox','ejs','lodash','squel','jsforce','desk.js','to-csv','papaparse','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../mysqldb','end','status','json','count','offset'];(function(_0x19950b,_0x53d0d7){var _0x3c6b41=function(_0x3924ad){while(--_0x3924ad){_0x19950b['push'](_0x19950b['shift']());}};_0x3c6b41(++_0x53d0d7);}(_0x801a,0x68));var _0xa801=function(_0xa1e2f5,_0x456846){_0xa1e2f5=_0xa1e2f5-0x0;var _0x213849=_0x801a[_0xa1e2f5];return _0x213849;};'use strict';var pdf=require(_0xa801('0x0'));var emlformat=require(_0xa801('0x1'));var rimraf=require('rimraf');var zipdir=require(_0xa801('0x2'));var jsonpatch=require(_0xa801('0x3'));var rp=require('request-promise');var moment=require(_0xa801('0x4'));var BPromise=require(_0xa801('0x5'));var Mustache=require(_0xa801('0x6'));var util=require('util');var path=require('path');var sox=require(_0xa801('0x7'));var csv=require('to-csv');var ejs=require(_0xa801('0x8'));var fs=require('fs');var _=require(_0xa801('0x9'));var squel=require(_0xa801('0xa'));var crypto=require('crypto');var jsforce=require(_0xa801('0xb'));var deskjs=require(_0xa801('0xc'));var toCsv=require(_0xa801('0xd'));var querystring=require('querystring');var Papa=require(_0xa801('0xe'));var Redis=require('ioredis');var authService=require(_0xa801('0xf'));var qs=require('../../components/parsers/qs');var as=require(_0xa801('0x10'));var hardwareService=require(_0xa801('0x11'));var logger=require('../../config/logger')('api');var utils=require('../../config/utils');var config=require('../../config/environment');var db=require(_0xa801('0x12'))['db'];function respondWithStatusCode(_0x5675f1,_0x6aefe8){_0x6aefe8=_0x6aefe8||0xcc;return function(_0x2e0f9f){if(_0x2e0f9f){return _0x5675f1['sendStatus'](_0x6aefe8);}return _0x5675f1['status'](_0x6aefe8)[_0xa801('0x13')]();};}function respondWithResult(_0x1ead96,_0x4efecd){_0x4efecd=_0x4efecd||0xc8;return function(_0x564c46){if(_0x564c46){return _0x1ead96[_0xa801('0x14')](_0x4efecd)[_0xa801('0x15')](_0x564c46);}};}function respondWithFilteredResult(_0x45e984,_0x1c1495){return function(_0x4f01b7){if(_0x4f01b7){var _0x1d3a12=_0x4f01b7[_0xa801('0x16')],_0x586d95=_0x1c1495[_0xa801('0x17')],_0x5dd498=_0x1c1495[_0xa801('0x17')]+_0x1c1495[_0xa801('0x18')],_0x1a17b6;if(_0x5dd498>=_0x1d3a12){_0x5dd498=_0x1d3a12;_0x1a17b6=0xc8;}else{_0x1a17b6=0xce;}_0x45e984['status'](_0x1a17b6);return _0x45e984[_0xa801('0x19')](_0xa801('0x1a'),_0x586d95+'-'+_0x5dd498+'/'+_0x1d3a12)['json'](_0x4f01b7);}return null;};}function patchUpdates(_0x5803cb){return function(_0x3e7f4f){try{jsonpatch[_0xa801('0x1b')](_0x3e7f4f,_0x5803cb,!![]);}catch(_0x1f8294){return BPromise[_0xa801('0x1c')](_0x1f8294);}return _0x3e7f4f[_0xa801('0x1d')]();};}function saveUpdates(_0x14615d,_0x1dcbaa){return function(_0x2ee1e4){if(_0x2ee1e4){return _0x2ee1e4[_0xa801('0x1e')](_0x14615d)[_0xa801('0x1f')](function(_0xfd2321){return _0xfd2321;});}return null;};}function removeEntity(_0x401426,_0xc19757){return function(_0xa738bd){if(_0xa738bd){return _0xa738bd[_0xa801('0x20')]()[_0xa801('0x1f')](function(){_0x401426[_0xa801('0x14')](0xcc)[_0xa801('0x13')]();});}};}function handleEntityNotFound(_0x4e79c2,_0x28bb29){return function(_0x467f35){if(!_0x467f35){_0x4e79c2[_0xa801('0x21')](0x194);}return _0x467f35;};}function handleError(_0x1c698d,_0x7dc97){_0x7dc97=_0x7dc97||0x1f4;return function(_0x2391d9){logger[_0xa801('0x22')](_0x2391d9[_0xa801('0x23')]);if(_0x2391d9[_0xa801('0x24')]){delete _0x2391d9[_0xa801('0x24')];}_0x1c698d[_0xa801('0x14')](_0x7dc97)['send'](_0x2391d9);};}exports[_0xa801('0x25')]=function(_0x3d37b6,_0x23472c){var _0x488be2={},_0x2a4215={},_0x10a54a={'count':0x0,'rows':[]};var _0x3ec779=_[_0xa801('0x26')](db['CmHopperFinal'][_0xa801('0x27')],function(_0xfe6c50){return{'name':_0xfe6c50[_0xa801('0x28')],'type':_0xfe6c50[_0xa801('0x29')][_0xa801('0x2a')]};});_0x2a4215['model']=_['map'](_0x3ec779,_0xa801('0x24'));_0x2a4215[_0xa801('0x2b')]=_[_0xa801('0x2c')](_0x3d37b6[_0xa801('0x2b')]);_0x2a4215[_0xa801('0x2d')]=_['intersection'](_0x2a4215[_0xa801('0x2e')],_0x2a4215[_0xa801('0x2b')]);_0x488be2['attributes']=_[_0xa801('0x2f')](_0x2a4215[_0xa801('0x2e')],qs[_0xa801('0x30')](_0x3d37b6[_0xa801('0x2b')]['fields']));_0x488be2['attributes']=_0x488be2[_0xa801('0x31')][_0xa801('0x32')]?_0x488be2[_0xa801('0x31')]:_0x2a4215[_0xa801('0x2e')];if(!_0x3d37b6[_0xa801('0x2b')][_0xa801('0x33')](_0xa801('0x34'))){_0x488be2[_0xa801('0x18')]=qs[_0xa801('0x18')](_0x3d37b6[_0xa801('0x2b')][_0xa801('0x18')]);_0x488be2[_0xa801('0x17')]=qs['offset'](_0x3d37b6[_0xa801('0x2b')]['offset']);}_0x488be2['order']=qs['sort'](_0x3d37b6[_0xa801('0x2b')][_0xa801('0x35')]);_0x488be2['where']=qs[_0xa801('0x2d')](_[_0xa801('0x36')](_0x3d37b6[_0xa801('0x2b')],_0x2a4215[_0xa801('0x2d')]));if(_0x3d37b6[_0xa801('0x2b')][_0xa801('0x37')]){_0x488be2['where']=_[_0xa801('0x38')](_0x488be2[_0xa801('0x39')],{'$or':_[_0xa801('0x26')](_0x3ec779,function(_0x10dd78){if(_0x10dd78['type']!=='VIRTUAL'){var _0x309df4={};_0x309df4[_0x10dd78[_0xa801('0x24')]]={'$like':'%'+_0x3d37b6[_0xa801('0x2b')][_0xa801('0x37')]+'%'};return _0x309df4;}})});}_0x488be2=_[_0xa801('0x38')]({},_0x488be2,_0x3d37b6[_0xa801('0x3a')]);var _0x29d600={'where':_0x488be2[_0xa801('0x39')]};return db[_0xa801('0x3b')][_0xa801('0x16')](_0x29d600)[_0xa801('0x1f')](function(_0x354a07){_0x10a54a[_0xa801('0x16')]=_0x354a07;if(_0x3d37b6[_0xa801('0x2b')][_0xa801('0x3c')]){_0x488be2['include']=[{'all':!![]}];}return db['CmHopperFinal'][_0xa801('0x3d')](_0x488be2);})[_0xa801('0x1f')](function(_0x46034c){_0x10a54a[_0xa801('0x3e')]=_0x46034c;return _0x10a54a;})['then'](respondWithFilteredResult(_0x23472c,_0x488be2))[_0xa801('0x3f')](handleError(_0x23472c,null));};exports[_0xa801('0x40')]=function(_0x505052,_0x21ed17){var _0x16806c={'raw':!![],'where':{'id':_0x505052[_0xa801('0x41')]['id']}},_0x1f9b95={};_0x1f9b95['model']=_['keys'](db[_0xa801('0x3b')][_0xa801('0x27')]);_0x1f9b95['query']=_['keys'](_0x505052[_0xa801('0x2b')]);_0x1f9b95[_0xa801('0x2d')]=_[_0xa801('0x2f')](_0x1f9b95[_0xa801('0x2e')],_0x1f9b95[_0xa801('0x2b')]);_0x16806c['attributes']=_[_0xa801('0x2f')](_0x1f9b95[_0xa801('0x2e')],qs['fields'](_0x505052[_0xa801('0x2b')][_0xa801('0x30')]));_0x16806c[_0xa801('0x31')]=_0x16806c['attributes'][_0xa801('0x32')]?_0x16806c[_0xa801('0x31')]:_0x1f9b95[_0xa801('0x2e')];if(_0x505052[_0xa801('0x2b')][_0xa801('0x3c')]){_0x16806c[_0xa801('0x42')]=[{'all':!![]}];}_0x16806c=_['merge']({},_0x16806c,_0x505052[_0xa801('0x3a')]);return db[_0xa801('0x3b')][_0xa801('0x43')](_0x16806c)[_0xa801('0x1f')](handleEntityNotFound(_0x21ed17,null))[_0xa801('0x1f')](respondWithResult(_0x21ed17,null))[_0xa801('0x3f')](handleError(_0x21ed17,null));};exports[_0xa801('0x44')]=function(_0x564920,_0xa528ff){return db[_0xa801('0x3b')][_0xa801('0x44')]()[_0xa801('0x1f')](respondWithResult(_0xa528ff,null))[_0xa801('0x3f')](handleError(_0xa528ff,null));};exports[_0xa801('0x1e')]=function(_0x3777e9,_0x35c2a4){if(_0x3777e9[_0xa801('0x45')][_0xa801('0x46')]){delete _0x3777e9[_0xa801('0x45')][_0xa801('0x46')];}return db[_0xa801('0x3b')][_0xa801('0x43')]({'where':{'uniqueid':_0x3777e9[_0xa801('0x41')]['id']}})[_0xa801('0x1f')](handleEntityNotFound(_0x35c2a4,null))[_0xa801('0x1f')](saveUpdates(_0x3777e9[_0xa801('0x45')],null))['then'](respondWithResult(_0x35c2a4,null))[_0xa801('0x3f')](handleError(_0x35c2a4,null));};exports[_0xa801('0x47')]=function(_0x4f4110,_0x4917d5,_0x39defb){return db[_0xa801('0x3b')][_0xa801('0x3d')]({'raw':![],'where':{'VoiceQueueId':_0x4f4110[_0xa801('0x41')]['id']},'attributes':[[db[_0xa801('0x48')]['fn'](_0xa801('0x49'),db[_0xa801('0x48')]['fn']('IF',db['sequelize'][_0xa801('0x4a')]('`state`\x20=\x200,\x201,\x20null'))),_0xa801('0x4b')],[db[_0xa801('0x48')]['fn'](_0xa801('0x49'),db['sequelize']['fn']('IF',db[_0xa801('0x48')][_0xa801('0x4a')](_0xa801('0x4c')))),'noAnswerContacts'],[db[_0xa801('0x48')]['fn'](_0xa801('0x49'),db['sequelize']['fn']('IF',db[_0xa801('0x48')][_0xa801('0x4a')](_0xa801('0x4d')))),_0xa801('0x4e')],[db['sequelize']['fn']('COUNT',db['sequelize']['fn']('IF',db[_0xa801('0x48')]['literal'](_0xa801('0x4f')))),_0xa801('0x50')],[db[_0xa801('0x48')]['fn']('COUNT',db[_0xa801('0x48')]['fn']('IF',db[_0xa801('0x48')][_0xa801('0x4a')](_0xa801('0x51')))),_0xa801('0x52')],[db[_0xa801('0x48')]['fn'](_0xa801('0x49'),db[_0xa801('0x48')]['fn']('IF',db[_0xa801('0x48')]['literal'](_0xa801('0x53')))),'abandonedContacts'],[db[_0xa801('0x48')]['fn'](_0xa801('0x49'),db[_0xa801('0x48')]['fn']('IF',db[_0xa801('0x48')][_0xa801('0x4a')](_0xa801('0x54')))),_0xa801('0x55')],[db[_0xa801('0x48')]['fn'](_0xa801('0x49'),db[_0xa801('0x48')]['fn']('IF',db['sequelize'][_0xa801('0x4a')]('`state`\x20=\x2019,\x201,\x20null'))),_0xa801('0x56')]]})[_0xa801('0x1f')](handleEntityNotFound(_0x4917d5,null))[_0xa801('0x1f')](respondWithResult(_0x4917d5,null))['catch'](handleError(_0x4917d5,null));};exports['countContactsIvrCampaignHopperFinal']=function(_0x2b97b4,_0x28a497,_0x3e4f31){return db[_0xa801('0x3b')][_0xa801('0x3d')]({'raw':![],'where':{'CampaignId':_0x2b97b4[_0xa801('0x41')]['id']},'attributes':[[db[_0xa801('0x48')]['fn'](_0xa801('0x49'),db['sequelize']['fn']('IF',db[_0xa801('0x48')][_0xa801('0x4a')](_0xa801('0x57')))),_0xa801('0x4b')],[db[_0xa801('0x48')]['fn'](_0xa801('0x49'),db[_0xa801('0x48')]['fn']('IF',db[_0xa801('0x48')]['literal'](_0xa801('0x4c')))),'noAnswerContacts'],[db[_0xa801('0x48')]['fn']('COUNT',db[_0xa801('0x48')]['fn']('IF',db[_0xa801('0x48')][_0xa801('0x4a')](_0xa801('0x4d')))),_0xa801('0x4e')],[db['sequelize']['fn']('COUNT',db[_0xa801('0x48')]['fn']('IF',db['sequelize'][_0xa801('0x4a')](_0xa801('0x4f')))),'congestionContacts'],[db[_0xa801('0x48')]['fn'](_0xa801('0x49'),db['sequelize']['fn']('IF',db[_0xa801('0x48')][_0xa801('0x4a')]('`state`\x20=\x2010\x20,\x201,\x20null'))),'dropContacts'],[db['sequelize']['fn'](_0xa801('0x49'),db['sequelize']['fn']('IF',db['sequelize']['literal'](_0xa801('0x53')))),_0xa801('0x58')],[db['sequelize']['fn'](_0xa801('0x49'),db[_0xa801('0x48')]['fn']('IF',db[_0xa801('0x48')][_0xa801('0x4a')](_0xa801('0x54')))),_0xa801('0x55')],[db[_0xa801('0x48')]['fn'](_0xa801('0x49'),db['sequelize']['fn']('IF',db[_0xa801('0x48')][_0xa801('0x4a')](_0xa801('0x59')))),'answeringMachine']]})[_0xa801('0x1f')](handleEntityNotFound(_0x28a497,null))[_0xa801('0x1f')](respondWithResult(_0x28a497,null))[_0xa801('0x3f')](handleError(_0x28a497,null));};exports[_0xa801('0x5a')]=function(_0x5645fe,_0x456449,_0x503be5){return db[_0xa801('0x5b')][_0xa801('0x43')]({'where':{'id':_0x5645fe[_0xa801('0x41')]['id']}})['then'](handleEntityNotFound(_0x456449,null))[_0xa801('0x1f')](function(_0x2c92e8){var _0xe319b3;if(_0x2c92e8){_0xe319b3=squel[_0xa801('0x5c')]()[_0xa801('0x5d')](_0xa801('0x5e'))[_0xa801('0x5f')](['phone',_0xa801('0x60'),_0xa801('0x61'),'ListId','VoiceQueueId',_0xa801('0x62'),_0xa801('0x63')],squel['select']()[_0xa801('0x64')]('ANY_VALUE(calleridnum)',_0xa801('0x65'))[_0xa801('0x64')](_0xa801('0x66'),_0xa801('0x60'))['field'](_0xa801('0x67'),_0xa801('0x61'))[_0xa801('0x64')](_0xa801('0x68'),_0xa801('0x69'))[_0xa801('0x64')](_0xa801('0x6a'),_0xa801('0x6b'))[_0xa801('0x64')](_0xa801('0x66'),_0xa801('0x62'))['field'](_0xa801('0x66'),_0xa801('0x63'))[_0xa801('0x6c')](_0xa801('0x6d'))[_0xa801('0x39')]('VoiceQueueId\x20=\x20?',_0x5645fe[_0xa801('0x41')]['id'][_0xa801('0x6e')]())[_0xa801('0x39')](_0xa801('0x6f'),_0x5645fe['body']['state'][_0xa801('0x6e')]())[_0xa801('0x39')](_0xa801('0x70'))['where'](_0xa801('0x71'),squel[_0xa801('0x72')]()[_0xa801('0x64')]('phone')[_0xa801('0x6c')](_0xa801('0x5e'))[_0xa801('0x39')]('VoiceQueueId\x20=\x20?',_0x5645fe['params']['id'][_0xa801('0x6e')]()))[_0xa801('0x39')](_0xa801('0x71'),squel[_0xa801('0x72')]()[_0xa801('0x64')](_0xa801('0x73'))[_0xa801('0x6c')]('cm_hopper_final')[_0xa801('0x39')]('VoiceQueueId\x20=\x20?',_0x5645fe[_0xa801('0x41')]['id'][_0xa801('0x6e')]())[_0xa801('0x39')](_0xa801('0x74')))['group']('ContactId'))[_0xa801('0x6e')]();return db['sequelize'][_0xa801('0x2b')](_0xe319b3);}return[];})[_0xa801('0x1f')](respondWithResult(_0x456449,null))[_0xa801('0x3f')](handleError(_0x456449,null));};exports[_0xa801('0x75')]=function(_0x2a37a1,_0x264a22,_0x59ea63){return db[_0xa801('0x76')][_0xa801('0x43')]({'where':{'id':_0x2a37a1[_0xa801('0x41')]['id']}})['then'](handleEntityNotFound(_0x264a22,null))['then'](function(_0x351614){var _0x524ac5;if(_0x351614){_0x524ac5=squel[_0xa801('0x5c')]()[_0xa801('0x5d')]('cm_hopper')['fromQuery']([_0xa801('0x65'),_0xa801('0x60'),_0xa801('0x61'),_0xa801('0x69'),_0xa801('0x77'),_0xa801('0x62'),_0xa801('0x63')],squel['select']()['field'](_0xa801('0x78'),_0xa801('0x65'))[_0xa801('0x64')](_0xa801('0x66'),_0xa801('0x60'))[_0xa801('0x64')](_0xa801('0x67'),_0xa801('0x61'))[_0xa801('0x64')](_0xa801('0x68'),_0xa801('0x69'))[_0xa801('0x64')](_0xa801('0x79'),_0xa801('0x77'))[_0xa801('0x64')](_0xa801('0x66'),_0xa801('0x62'))['field'](_0xa801('0x66'),_0xa801('0x63'))[_0xa801('0x6c')](_0xa801('0x6d'))['where'](_0xa801('0x7a'),_0x2a37a1[_0xa801('0x41')]['id']['toString']())[_0xa801('0x39')](_0xa801('0x6f'),_0x2a37a1['body'][_0xa801('0x7b')][_0xa801('0x6e')]())[_0xa801('0x39')](_0xa801('0x70'))['where']('calleridnum\x20NOT\x20IN\x20(?)',squel['select']()[_0xa801('0x64')](_0xa801('0x65'))[_0xa801('0x6c')](_0xa801('0x5e'))['where'](_0xa801('0x7a'),_0x2a37a1[_0xa801('0x41')]['id'][_0xa801('0x6e')]()))[_0xa801('0x39')](_0xa801('0x71'),squel[_0xa801('0x72')]()[_0xa801('0x64')](_0xa801('0x73'))[_0xa801('0x6c')]('cm_hopper_final')['where'](_0xa801('0x7a'),_0x2a37a1[_0xa801('0x41')]['id'][_0xa801('0x6e')]())['where'](_0xa801('0x74')))[_0xa801('0x7c')](_0xa801('0x61')))['toString']();return db['sequelize'][_0xa801('0x2b')](_0x524ac5);}return[];})[_0xa801('0x1f')](respondWithResult(_0x264a22,null))[_0xa801('0x3f')](handleError(_0x264a22,null));};exports[_0xa801('0x7d')]=function(_0x1c37b6,_0x29e79d,_0x2f754f){return db[_0xa801('0x7e')][_0xa801('0x7f')]({'where':{'VoiceQueueId':_0x1c37b6['body']['VoiceQueueId'],'CampaignId':_0x1c37b6[_0xa801('0x45')][_0xa801('0x77')],'ContactId':_0x1c37b6[_0xa801('0x45')][_0xa801('0x61')]}})[_0xa801('0x1f')](handleEntityNotFound(_0x29e79d,null))[_0xa801('0x1f')](function(_0x41aff7){if(_0x41aff7){return _0x41aff7;}return null;})['then'](respondWithResult(_0x29e79d,null))['catch'](handleError(_0x29e79d,null));}; \ No newline at end of file diff --git a/server/api/cmHopperFinal/cmHopperFinal.model.js b/server/api/cmHopperFinal/cmHopperFinal.model.js index 26dd362..1413410 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 _0x838a=['moment','bluebird','request-promise','path','rimraf','../../config/environment','./cmHopperFinal.attributes','exports','define','calleridnum','uniqueid','lodash','../../config/logger','api'];(function(_0x432682,_0x253044){var _0x463d05=function(_0xa73403){while(--_0xa73403){_0x432682['push'](_0x432682['shift']());}};_0x463d05(++_0x253044);}(_0x838a,0x131));var _0xa838=function(_0xea8947,_0x1b573d){_0xea8947=_0xea8947-0x0;var _0x2455e9=_0x838a[_0xea8947];return _0x2455e9;};'use strict';var _=require(_0xa838('0x0'));var util=require('util');var logger=require(_0xa838('0x1'))(_0xa838('0x2'));var moment=require(_0xa838('0x3'));var BPromise=require(_0xa838('0x4'));var rp=require(_0xa838('0x5'));var fs=require('fs');var path=require(_0xa838('0x6'));var rimraf=require(_0xa838('0x7'));var config=require(_0xa838('0x8'));var attributes=require(_0xa838('0x9'));module[_0xa838('0xa')]=function(_0x4eac69,_0x3d991b){return _0x4eac69[_0xa838('0xb')]('CmHopperFinal',attributes,{'tableName':'cm_hopper_final','paranoid':![],'indexes':[{'name':_0xa838('0xc'),'fields':['calleridnum']},{'name':_0xa838('0xd'),'fields':[_0xa838('0xd')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xf8f1=['define','CmHopperFinal','calleridnum','uniqueid','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','./cmHopperFinal.attributes','exports'];(function(_0x37a9d3,_0xb8d590){var _0x3c6e8b=function(_0x24de90){while(--_0x24de90){_0x37a9d3['push'](_0x37a9d3['shift']());}};_0x3c6e8b(++_0xb8d590);}(_0xf8f1,0x7c));var _0x1f8f=function(_0x3e4cbb,_0x1ec2fd){_0x3e4cbb=_0x3e4cbb-0x0;var _0x78c593=_0xf8f1[_0x3e4cbb];return _0x78c593;};'use strict';var _=require(_0x1f8f('0x0'));var util=require(_0x1f8f('0x1'));var logger=require(_0x1f8f('0x2'))(_0x1f8f('0x3'));var moment=require(_0x1f8f('0x4'));var BPromise=require(_0x1f8f('0x5'));var rp=require(_0x1f8f('0x6'));var fs=require('fs');var path=require(_0x1f8f('0x7'));var rimraf=require(_0x1f8f('0x8'));var config=require('../../config/environment');var attributes=require(_0x1f8f('0x9'));module[_0x1f8f('0xa')]=function(_0x59ee75,_0x4c3584){return _0x59ee75[_0x1f8f('0xb')](_0x1f8f('0xc'),attributes,{'tableName':'cm_hopper_final','paranoid':![],'indexes':[{'name':_0x1f8f('0xd'),'fields':[_0x1f8f('0xd')]},{'name':_0x1f8f('0xe'),'fields':[_0x1f8f('0xe')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/cmHopperFinal/cmHopperFinal.rpc.js b/server/api/cmHopperFinal/cmHopperFinal.rpc.js index 384f12b..5fc1429 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 _0x460a=['jayson/promise','client','request','then','info','CmHopperFinal,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','catch','CreateCmHopperFinal','create','body','options','raw','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment'];(function(_0x2b4448,_0x5bcc69){var _0xb4b465=function(_0x5ac741){while(--_0x5ac741){_0x2b4448['push'](_0x2b4448['shift']());}};_0xb4b465(++_0x5bcc69);}(_0x460a,0x69));var _0xa460=function(_0x343090,_0x433a80){_0x343090=_0x343090-0x0;var _0x3ff3e8=_0x460a[_0x343090];return _0x3ff3e8;};'use strict';var _=require(_0xa460('0x0'));var util=require(_0xa460('0x1'));var moment=require(_0xa460('0x2'));var BPromise=require(_0xa460('0x3'));var rs=require(_0xa460('0x4'));var fs=require('fs');var Redis=require(_0xa460('0x5'));var db=require(_0xa460('0x6'))['db'];var utils=require(_0xa460('0x7'));var logger=require(_0xa460('0x8'))(_0xa460('0x9'));var config=require(_0xa460('0xa'));var jayson=require(_0xa460('0xb'));var client=jayson[_0xa460('0xc')]['http']({'port':0x232a});function respondWithRpcPromise(_0x35d43e,_0xe00fca,_0x2c6089){return new BPromise(function(_0x1f405c,_0x5a4d7d){return client[_0xa460('0xd')](_0x35d43e,_0x2c6089)[_0xa460('0xe')](function(_0x3f81ca){logger[_0xa460('0xf')](_0xa460('0x10'),_0xe00fca,_0xa460('0x11'));logger[_0xa460('0x12')]('CmHopperFinal,\x20%s,\x20%s,\x20%s',_0xe00fca,'request\x20sent',JSON[_0xa460('0x13')](_0x3f81ca));if(_0x3f81ca[_0xa460('0x14')]){if(_0x3f81ca['error'][_0xa460('0x15')]===0x1f4){logger['error'](_0xa460('0x10'),_0xe00fca,_0x3f81ca[_0xa460('0x14')][_0xa460('0x16')]);return _0x5a4d7d(_0x3f81ca['error'][_0xa460('0x16')]);}logger['error']('CmHopperFinal,\x20%s,\x20%s',_0xe00fca,_0x3f81ca[_0xa460('0x14')][_0xa460('0x16')]);return _0x1f405c(_0x3f81ca['error'][_0xa460('0x16')]);}else{logger[_0xa460('0xf')](_0xa460('0x10'),_0xe00fca,_0xa460('0x11'));_0x1f405c(_0x3f81ca['result'][_0xa460('0x16')]);}})[_0xa460('0x17')](function(_0x39ee1d){logger[_0xa460('0x14')](_0xa460('0x10'),_0xe00fca,_0x39ee1d);_0x5a4d7d(_0x39ee1d);});});}exports[_0xa460('0x18')]=function(_0x3416a5){var _0x52ba9e=this;return new Promise(function(_0x4a41fe,_0x3a4cf2){return db['CmHopperFinal'][_0xa460('0x19')](_0x3416a5[_0xa460('0x1a')],{'raw':_0x3416a5[_0xa460('0x1b')]?_0x3416a5[_0xa460('0x1b')][_0xa460('0x1c')]===undefined?!![]:![]:!![]})[_0xa460('0xe')](function(_0x3b9f88){logger[_0xa460('0xf')](_0xa460('0x18'),_0x3416a5);logger[_0xa460('0x12')](_0xa460('0x18'),_0x3416a5,JSON['stringify'](_0x3b9f88));_0x4a41fe(_0x3b9f88);})[_0xa460('0x17')](function(_0x5ce005){logger[_0xa460('0x14')]('CreateCmHopperFinal',_0x5ce005[_0xa460('0x16')],_0x3416a5);_0x3a4cf2(_0x52ba9e[_0xa460('0x14')](0x1f4,_0x5ce005['message']));});});}; \ No newline at end of file +var _0x089f=['catch','create','body','options','raw','CreateCmHopperFinal','debug','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request','then','info','CmHopperFinal,\x20%s,\x20%s','request\x20sent','CmHopperFinal,\x20%s,\x20%s,\x20%s','stringify','error','code','message'];(function(_0x5372c9,_0x501abc){var _0x3a1ef7=function(_0x5ed769){while(--_0x5ed769){_0x5372c9['push'](_0x5372c9['shift']());}};_0x3a1ef7(++_0x501abc);}(_0x089f,0x1c7));var _0xf089=function(_0x19b251,_0x1d6724){_0x19b251=_0x19b251-0x0;var _0x389a3a=_0x089f[_0x19b251];return _0x389a3a;};'use strict';var _=require('lodash');var util=require(_0xf089('0x0'));var moment=require(_0xf089('0x1'));var BPromise=require(_0xf089('0x2'));var rs=require(_0xf089('0x3'));var fs=require('fs');var Redis=require(_0xf089('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0xf089('0x5'));var logger=require(_0xf089('0x6'))(_0xf089('0x7'));var config=require('../../config/environment');var jayson=require(_0xf089('0x8'));var client=jayson[_0xf089('0x9')][_0xf089('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x49b977,_0x21a3f7,_0x1987d9){return new BPromise(function(_0x115de6,_0x55e37a){return client[_0xf089('0xb')](_0x49b977,_0x1987d9)[_0xf089('0xc')](function(_0x433553){logger[_0xf089('0xd')](_0xf089('0xe'),_0x21a3f7,_0xf089('0xf'));logger['debug'](_0xf089('0x10'),_0x21a3f7,_0xf089('0xf'),JSON[_0xf089('0x11')](_0x433553));if(_0x433553['error']){if(_0x433553[_0xf089('0x12')][_0xf089('0x13')]===0x1f4){logger['error']('CmHopperFinal,\x20%s,\x20%s',_0x21a3f7,_0x433553[_0xf089('0x12')][_0xf089('0x14')]);return _0x55e37a(_0x433553['error'][_0xf089('0x14')]);}logger[_0xf089('0x12')](_0xf089('0xe'),_0x21a3f7,_0x433553[_0xf089('0x12')]['message']);return _0x115de6(_0x433553[_0xf089('0x12')]['message']);}else{logger[_0xf089('0xd')]('CmHopperFinal,\x20%s,\x20%s',_0x21a3f7,_0xf089('0xf'));_0x115de6(_0x433553['result'][_0xf089('0x14')]);}})[_0xf089('0x15')](function(_0x157371){logger[_0xf089('0x12')](_0xf089('0xe'),_0x21a3f7,_0x157371);_0x55e37a(_0x157371);});});}exports['CreateCmHopperFinal']=function(_0x7fbed5){var _0x4e714a=this;return new Promise(function(_0x407263,_0x3418c4){return db['CmHopperFinal'][_0xf089('0x16')](_0x7fbed5[_0xf089('0x17')],{'raw':_0x7fbed5['options']?_0x7fbed5[_0xf089('0x18')][_0xf089('0x19')]===undefined?!![]:![]:!![]})[_0xf089('0xc')](function(_0x2ab659){logger[_0xf089('0xd')](_0xf089('0x1a'),_0x7fbed5);logger[_0xf089('0x1b')](_0xf089('0x1a'),_0x7fbed5,JSON[_0xf089('0x11')](_0x2ab659));_0x407263(_0x2ab659);})[_0xf089('0x15')](function(_0x581180){logger[_0xf089('0x12')](_0xf089('0x1a'),_0x581180[_0xf089('0x14')],_0x7fbed5);_0x3418c4(_0x4e714a[_0xf089('0x12')](0x1f4,_0x581180[_0xf089('0x14')]));});});}; \ No newline at end of file diff --git a/server/api/cmHopperFinal/index.js b/server/api/cmHopperFinal/index.js index dfd6549..0dc2ae3 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 _0xa725=['post','/voice/queue/moveContacts/:id','moveContactsQueueCampaignHopperFinal','/voice/campaign/moveContacts/:id','moveContactsIvrCampaignHopperFinal','/checkContactHopper','checkContactHopper','update','exports','util','path','connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment','./cmHopperFinal.controller','get','isAuthenticated','index','/describe','/:id','show','/voice/queue/countAttributes/:id','countContactsQueueCampaignHopperFinal','countContactsIvrCampaignHopperFinal'];(function(_0x82129b,_0x484ae9){var _0x2ae5dc=function(_0x299e34){while(--_0x299e34){_0x82129b['push'](_0x82129b['shift']());}};_0x2ae5dc(++_0x484ae9);}(_0xa725,0x71));var _0x5a72=function(_0x5c6dd3,_0x196c31){_0x5c6dd3=_0x5c6dd3-0x0;var _0x54da38=_0xa725[_0x5c6dd3];return _0x54da38;};'use strict';var multer=require('multer');var util=require(_0x5a72('0x0'));var path=require(_0x5a72('0x1'));var timeout=require(_0x5a72('0x2'));var express=require(_0x5a72('0x3'));var router=express['Router']();var auth=require(_0x5a72('0x4'));var interaction=require(_0x5a72('0x5'));var config=require(_0x5a72('0x6'));var controller=require(_0x5a72('0x7'));router[_0x5a72('0x8')]('/',auth[_0x5a72('0x9')](),controller[_0x5a72('0xa')]);router[_0x5a72('0x8')](_0x5a72('0xb'),auth[_0x5a72('0x9')](),controller['describe']);router[_0x5a72('0x8')](_0x5a72('0xc'),auth[_0x5a72('0x9')](),controller[_0x5a72('0xd')]);router['get'](_0x5a72('0xe'),auth['isAuthenticated'](),controller[_0x5a72('0xf')]);router[_0x5a72('0x8')]('/campaign/countAttributes/:id',auth[_0x5a72('0x9')](),controller[_0x5a72('0x10')]);router[_0x5a72('0x11')](_0x5a72('0x12'),auth['isAuthenticated'](),controller[_0x5a72('0x13')]);router['post'](_0x5a72('0x14'),auth['isAuthenticated'](),controller[_0x5a72('0x15')]);router[_0x5a72('0x11')](_0x5a72('0x16'),auth['isAuthenticated'](),controller[_0x5a72('0x17')]);router['put'](_0x5a72('0xc'),auth['isAuthenticated'](),controller[_0x5a72('0x18')]);module[_0x5a72('0x19')]=router; \ No newline at end of file +var _0x83b3=['multer','path','connect-timeout','express','Router','../../components/interaction/service','../../config/environment','./cmHopperFinal.controller','get','isAuthenticated','index','/describe','describe','/:id','show','/voice/queue/countAttributes/:id','countContactsQueueCampaignHopperFinal','/campaign/countAttributes/:id','countContactsIvrCampaignHopperFinal','/voice/queue/moveContacts/:id','moveContactsQueueCampaignHopperFinal','/voice/campaign/moveContacts/:id','post','/checkContactHopper','put','update'];(function(_0x49a909,_0x2dc4fb){var _0x84967d=function(_0x83fb95){while(--_0x83fb95){_0x49a909['push'](_0x49a909['shift']());}};_0x84967d(++_0x2dc4fb);}(_0x83b3,0x1ba));var _0x383b=function(_0x1b4cde,_0x220a9f){_0x1b4cde=_0x1b4cde-0x0;var _0x26f2bc=_0x83b3[_0x1b4cde];return _0x26f2bc;};'use strict';var multer=require(_0x383b('0x0'));var util=require('util');var path=require(_0x383b('0x1'));var timeout=require(_0x383b('0x2'));var express=require(_0x383b('0x3'));var router=express[_0x383b('0x4')]();var auth=require('../../components/auth/service');var interaction=require(_0x383b('0x5'));var config=require(_0x383b('0x6'));var controller=require(_0x383b('0x7'));router[_0x383b('0x8')]('/',auth[_0x383b('0x9')](),controller[_0x383b('0xa')]);router[_0x383b('0x8')](_0x383b('0xb'),auth['isAuthenticated'](),controller[_0x383b('0xc')]);router[_0x383b('0x8')](_0x383b('0xd'),auth[_0x383b('0x9')](),controller[_0x383b('0xe')]);router[_0x383b('0x8')](_0x383b('0xf'),auth[_0x383b('0x9')](),controller[_0x383b('0x10')]);router[_0x383b('0x8')](_0x383b('0x11'),auth['isAuthenticated'](),controller[_0x383b('0x12')]);router['post'](_0x383b('0x13'),auth[_0x383b('0x9')](),controller[_0x383b('0x14')]);router['post'](_0x383b('0x15'),auth[_0x383b('0x9')](),controller['moveContactsIvrCampaignHopperFinal']);router[_0x383b('0x16')](_0x383b('0x17'),auth['isAuthenticated'](),controller['checkContactHopper']);router[_0x383b('0x18')](_0x383b('0xd'),auth[_0x383b('0x9')](),controller[_0x383b('0x19')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/cmHopperHistory/cmHopperHistory.attributes.js b/server/api/cmHopperHistory/cmHopperHistory.attributes.js index 992ed7b..cae30ca 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 _0x18b1=['sequelize','exports','INTEGER','STRING','DATE','BOOLEAN'];(function(_0x51a798,_0x2498c9){var _0x4994d3=function(_0x7146a6){while(--_0x7146a6){_0x51a798['push'](_0x51a798['shift']());}};_0x4994d3(++_0x2498c9);}(_0x18b1,0x132));var _0x118b=function(_0x179e11,_0xf65436){_0x179e11=_0x179e11-0x0;var _0x549f04=_0x18b1[_0x179e11];return _0x549f04;};'use strict';var Sequelize=require(_0x118b('0x0'));module[_0x118b('0x1')]={'state':{'type':Sequelize[_0x118b('0x2')](0x2)},'statedesc':{'type':Sequelize[_0x118b('0x3')]},'scheduledat':{'type':Sequelize[_0x118b('0x4')]},'countbusyretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize[_0x118b('0x2')],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize[_0x118b('0x2')],'defaultValue':0x0},'countglobal':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'uniqueid':{'type':Sequelize['STRING']},'originatecalleridnum':{'type':Sequelize[_0x118b('0x3')]},'originatecalleridname':{'type':Sequelize[_0x118b('0x3')]},'calleridnum':{'type':Sequelize[_0x118b('0x3')]},'calleridname':{'type':Sequelize['STRING']},'starttime':{'type':Sequelize[_0x118b('0x4')]},'responsetime':{'type':Sequelize[_0x118b('0x4')]},'answertime':{'type':Sequelize[_0x118b('0x4')]},'droptime':{'type':Sequelize[_0x118b('0x4')]},'endtime':{'type':Sequelize['DATE']},'ringtime':{'type':Sequelize[_0x118b('0x2')],'defaultValue':0x0},'holdtime':{'type':Sequelize[_0x118b('0x2')],'defaultValue':0x0},'talktime':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'followuptime':{'type':Sequelize[_0x118b('0x2')],'defaultValue':0x0},'dropreason':{'type':Sequelize[_0x118b('0x3')]},'campaign':{'type':Sequelize['STRING']},'campaigntype':{'type':Sequelize['STRING']},'membername':{'type':Sequelize[_0x118b('0x3')]},'reason':{'type':Sequelize[_0x118b('0x3')]},'amd':{'type':Sequelize[_0x118b('0x5')],'defaultValue':![]},'fax':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'callback':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'callbackuniqueid':{'type':Sequelize[_0x118b('0x3')],'defaultValue':null},'callbackat':{'type':Sequelize['DATE']},'recallme':{'type':Sequelize[_0x118b('0x5')],'defaultValue':![]},'editedat':{'type':Sequelize['DATE']},'edited':{'type':Sequelize[_0x118b('0x5')],'defaultValue':![]},'countnosuchnumberretry':{'type':Sequelize[_0x118b('0x2')],'defaultValue':0x0},'countdropretry':{'type':Sequelize[_0x118b('0x2')],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize[_0x118b('0x2')],'defaultValue':0x0},'countmachineretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0}}; \ No newline at end of file +var _0xd4ab=['STRING','DATE','BOOLEAN','sequelize','exports','INTEGER'];(function(_0x5c1c2d,_0x4387da){var _0x2fb642=function(_0x43e8e4){while(--_0x43e8e4){_0x5c1c2d['push'](_0x5c1c2d['shift']());}};_0x2fb642(++_0x4387da);}(_0xd4ab,0x1a7));var _0xbd4a=function(_0xfe61c,_0x1dc805){_0xfe61c=_0xfe61c-0x0;var _0x1191d5=_0xd4ab[_0xfe61c];return _0x1191d5;};'use strict';var Sequelize=require(_0xbd4a('0x0'));module[_0xbd4a('0x1')]={'state':{'type':Sequelize['INTEGER'](0x2)},'statedesc':{'type':Sequelize['STRING']},'scheduledat':{'type':Sequelize['DATE']},'countbusyretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize[_0xbd4a('0x2')],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize[_0xbd4a('0x2')],'defaultValue':0x0},'countglobal':{'type':Sequelize[_0xbd4a('0x2')],'defaultValue':0x0},'uniqueid':{'type':Sequelize[_0xbd4a('0x3')]},'originatecalleridnum':{'type':Sequelize[_0xbd4a('0x3')]},'originatecalleridname':{'type':Sequelize[_0xbd4a('0x3')]},'calleridnum':{'type':Sequelize[_0xbd4a('0x3')]},'calleridname':{'type':Sequelize[_0xbd4a('0x3')]},'starttime':{'type':Sequelize[_0xbd4a('0x4')]},'responsetime':{'type':Sequelize[_0xbd4a('0x4')]},'answertime':{'type':Sequelize['DATE']},'droptime':{'type':Sequelize['DATE']},'endtime':{'type':Sequelize['DATE']},'ringtime':{'type':Sequelize[_0xbd4a('0x2')],'defaultValue':0x0},'holdtime':{'type':Sequelize[_0xbd4a('0x2')],'defaultValue':0x0},'talktime':{'type':Sequelize[_0xbd4a('0x2')],'defaultValue':0x0},'followuptime':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'dropreason':{'type':Sequelize[_0xbd4a('0x3')]},'campaign':{'type':Sequelize['STRING']},'campaigntype':{'type':Sequelize[_0xbd4a('0x3')]},'membername':{'type':Sequelize['STRING']},'reason':{'type':Sequelize[_0xbd4a('0x3')]},'amd':{'type':Sequelize[_0xbd4a('0x5')],'defaultValue':![]},'fax':{'type':Sequelize[_0xbd4a('0x5')],'defaultValue':![]},'callback':{'type':Sequelize[_0xbd4a('0x5')],'defaultValue':![]},'callbackuniqueid':{'type':Sequelize[_0xbd4a('0x3')],'defaultValue':null},'callbackat':{'type':Sequelize['DATE']},'recallme':{'type':Sequelize[_0xbd4a('0x5')],'defaultValue':![]},'editedat':{'type':Sequelize['DATE']},'edited':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'countnosuchnumberretry':{'type':Sequelize[_0xbd4a('0x2')],'defaultValue':0x0},'countdropretry':{'type':Sequelize[_0xbd4a('0x2')],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countmachineretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize[_0xbd4a('0x2')],'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 513dc48..aa4b789 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 _0x8a56=['intersection','fields','nolimit','order','sort','pick','where','merge','VIRTUAL','name','filter','options','includeAll','include','findAll','rows','catch','show','keys','length','find','create','body','describe','uniqueid','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','path','sox','to-csv','ejs','squel','crypto','jsforce','desk.js','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/environment','status','json','count','offset','limit','Content-Range','apply','reject','save','then','destroy','error','stack','index','map','CmHopperHistory','fieldName','type','model','query','filters','attributes'];(function(_0x487b0c,_0x14ff74){var _0x1adbdc=function(_0x2e7b9d){while(--_0x2e7b9d){_0x487b0c['push'](_0x487b0c['shift']());}};_0x1adbdc(++_0x14ff74);}(_0x8a56,0x131));var _0x68a5=function(_0x1b1a3b,_0x52a88a){_0x1b1a3b=_0x1b1a3b-0x0;var _0x385347=_0x8a56[_0x1b1a3b];return _0x385347;};'use strict';var pdf=require(_0x68a5('0x0'));var emlformat=require(_0x68a5('0x1'));var rimraf=require(_0x68a5('0x2'));var zipdir=require(_0x68a5('0x3'));var jsonpatch=require(_0x68a5('0x4'));var rp=require('request-promise');var moment=require(_0x68a5('0x5'));var BPromise=require(_0x68a5('0x6'));var Mustache=require(_0x68a5('0x7'));var util=require('util');var path=require(_0x68a5('0x8'));var sox=require(_0x68a5('0x9'));var csv=require(_0x68a5('0xa'));var ejs=require(_0x68a5('0xb'));var fs=require('fs');var _=require('lodash');var squel=require(_0x68a5('0xc'));var crypto=require(_0x68a5('0xd'));var jsforce=require(_0x68a5('0xe'));var deskjs=require(_0x68a5('0xf'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x68a5('0x10'));var Redis=require('ioredis');var authService=require(_0x68a5('0x11'));var qs=require(_0x68a5('0x12'));var as=require(_0x68a5('0x13'));var hardwareService=require(_0x68a5('0x14'));var logger=require('../../config/logger')(_0x68a5('0x15'));var utils=require('../../config/utils');var config=require(_0x68a5('0x16'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x355b7f,_0x1e5971){_0x1e5971=_0x1e5971||0xcc;return function(_0x2c0db1){if(_0x2c0db1){return _0x355b7f['sendStatus'](_0x1e5971);}return _0x355b7f[_0x68a5('0x17')](_0x1e5971)['end']();};}function respondWithResult(_0x5ef28a,_0xe1a6c3){_0xe1a6c3=_0xe1a6c3||0xc8;return function(_0xe6e98){if(_0xe6e98){return _0x5ef28a[_0x68a5('0x17')](_0xe1a6c3)[_0x68a5('0x18')](_0xe6e98);}};}function respondWithFilteredResult(_0x2001bb,_0x410ea6){return function(_0x31e0ff){if(_0x31e0ff){var _0x4e9ccd=_0x31e0ff[_0x68a5('0x19')],_0x21a66f=_0x410ea6[_0x68a5('0x1a')],_0xf2f34e=_0x410ea6[_0x68a5('0x1a')]+_0x410ea6[_0x68a5('0x1b')],_0x36f409;if(_0xf2f34e>=_0x4e9ccd){_0xf2f34e=_0x4e9ccd;_0x36f409=0xc8;}else{_0x36f409=0xce;}_0x2001bb[_0x68a5('0x17')](_0x36f409);return _0x2001bb['set'](_0x68a5('0x1c'),_0x21a66f+'-'+_0xf2f34e+'/'+_0x4e9ccd)[_0x68a5('0x18')](_0x31e0ff);}return null;};}function patchUpdates(_0x161eb1){return function(_0x3b71f6){try{jsonpatch[_0x68a5('0x1d')](_0x3b71f6,_0x161eb1,!![]);}catch(_0x51325e){return BPromise[_0x68a5('0x1e')](_0x51325e);}return _0x3b71f6[_0x68a5('0x1f')]();};}function saveUpdates(_0x29ba52,_0x3c1fb0){return function(_0x3d7b83){if(_0x3d7b83){return _0x3d7b83['update'](_0x29ba52)[_0x68a5('0x20')](function(_0x43c749){return _0x43c749;});}return null;};}function removeEntity(_0x34cf53,_0x11bb97){return function(_0x58d971){if(_0x58d971){return _0x58d971[_0x68a5('0x21')]()[_0x68a5('0x20')](function(){_0x34cf53['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x57916b,_0x4d795b){return function(_0xa9a4db){if(!_0xa9a4db){_0x57916b['sendStatus'](0x194);}return _0xa9a4db;};}function handleError(_0x1e9ea4,_0x19014e){_0x19014e=_0x19014e||0x1f4;return function(_0x3f4e08){logger[_0x68a5('0x22')](_0x3f4e08[_0x68a5('0x23')]);if(_0x3f4e08['name']){delete _0x3f4e08['name'];}_0x1e9ea4[_0x68a5('0x17')](_0x19014e)['send'](_0x3f4e08);};}exports[_0x68a5('0x24')]=function(_0x3f928c,_0x4edeb7){var _0x414972={},_0x372a81={},_0x1eb0a3={'count':0x0,'rows':[]};var _0x6dab0e=_[_0x68a5('0x25')](db[_0x68a5('0x26')]['rawAttributes'],function(_0xf504b2){return{'name':_0xf504b2[_0x68a5('0x27')],'type':_0xf504b2[_0x68a5('0x28')]['key']};});_0x372a81[_0x68a5('0x29')]=_[_0x68a5('0x25')](_0x6dab0e,'name');_0x372a81[_0x68a5('0x2a')]=_['keys'](_0x3f928c['query']);_0x372a81[_0x68a5('0x2b')]=_['intersection'](_0x372a81[_0x68a5('0x29')],_0x372a81[_0x68a5('0x2a')]);_0x414972[_0x68a5('0x2c')]=_[_0x68a5('0x2d')](_0x372a81['model'],qs[_0x68a5('0x2e')](_0x3f928c['query']['fields']));_0x414972[_0x68a5('0x2c')]=_0x414972[_0x68a5('0x2c')]['length']?_0x414972[_0x68a5('0x2c')]:_0x372a81[_0x68a5('0x29')];if(!_0x3f928c['query']['hasOwnProperty'](_0x68a5('0x2f'))){_0x414972[_0x68a5('0x1b')]=qs[_0x68a5('0x1b')](_0x3f928c[_0x68a5('0x2a')]['limit']);_0x414972[_0x68a5('0x1a')]=qs[_0x68a5('0x1a')](_0x3f928c[_0x68a5('0x2a')][_0x68a5('0x1a')]);}_0x414972[_0x68a5('0x30')]=qs[_0x68a5('0x31')](_0x3f928c[_0x68a5('0x2a')][_0x68a5('0x31')]);_0x414972['where']=qs[_0x68a5('0x2b')](_[_0x68a5('0x32')](_0x3f928c[_0x68a5('0x2a')],_0x372a81['filters']));if(_0x3f928c['query']['filter']){_0x414972[_0x68a5('0x33')]=_[_0x68a5('0x34')](_0x414972[_0x68a5('0x33')],{'$or':_['map'](_0x6dab0e,function(_0x248b91){if(_0x248b91['type']!==_0x68a5('0x35')){var _0x568642={};_0x568642[_0x248b91[_0x68a5('0x36')]]={'$like':'%'+_0x3f928c['query'][_0x68a5('0x37')]+'%'};return _0x568642;}})});}_0x414972=_[_0x68a5('0x34')]({},_0x414972,_0x3f928c[_0x68a5('0x38')]);var _0x19fe33={'where':_0x414972[_0x68a5('0x33')]};return db[_0x68a5('0x26')][_0x68a5('0x19')](_0x19fe33)['then'](function(_0x2af485){_0x1eb0a3[_0x68a5('0x19')]=_0x2af485;if(_0x3f928c[_0x68a5('0x2a')][_0x68a5('0x39')]){_0x414972[_0x68a5('0x3a')]=[{'all':!![]}];}return db[_0x68a5('0x26')][_0x68a5('0x3b')](_0x414972);})[_0x68a5('0x20')](function(_0x5e702f){_0x1eb0a3[_0x68a5('0x3c')]=_0x5e702f;return _0x1eb0a3;})[_0x68a5('0x20')](respondWithFilteredResult(_0x4edeb7,_0x414972))[_0x68a5('0x3d')](handleError(_0x4edeb7,null));};exports[_0x68a5('0x3e')]=function(_0x265bff,_0x542f6c){var _0x54d016={'raw':!![],'where':{'id':_0x265bff['params']['id']}},_0x2d3dd9={};_0x2d3dd9[_0x68a5('0x29')]=_[_0x68a5('0x3f')](db[_0x68a5('0x26')]['rawAttributes']);_0x2d3dd9[_0x68a5('0x2a')]=_[_0x68a5('0x3f')](_0x265bff[_0x68a5('0x2a')]);_0x2d3dd9[_0x68a5('0x2b')]=_[_0x68a5('0x2d')](_0x2d3dd9[_0x68a5('0x29')],_0x2d3dd9['query']);_0x54d016['attributes']=_[_0x68a5('0x2d')](_0x2d3dd9[_0x68a5('0x29')],qs[_0x68a5('0x2e')](_0x265bff[_0x68a5('0x2a')]['fields']));_0x54d016[_0x68a5('0x2c')]=_0x54d016[_0x68a5('0x2c')][_0x68a5('0x40')]?_0x54d016[_0x68a5('0x2c')]:_0x2d3dd9[_0x68a5('0x29')];if(_0x265bff[_0x68a5('0x2a')][_0x68a5('0x39')]){_0x54d016['include']=[{'all':!![]}];}_0x54d016=_[_0x68a5('0x34')]({},_0x54d016,_0x265bff['options']);return db[_0x68a5('0x26')][_0x68a5('0x41')](_0x54d016)[_0x68a5('0x20')](handleEntityNotFound(_0x542f6c,null))['then'](respondWithResult(_0x542f6c,null))[_0x68a5('0x3d')](handleError(_0x542f6c,null));};exports[_0x68a5('0x42')]=function(_0x136456,_0x75d802){return db[_0x68a5('0x26')][_0x68a5('0x42')](_0x136456[_0x68a5('0x43')],{})[_0x68a5('0x20')](respondWithResult(_0x75d802,0xc9))[_0x68a5('0x3d')](handleError(_0x75d802,null));};exports[_0x68a5('0x44')]=function(_0x222bbd,_0xf12b49){return db[_0x68a5('0x26')][_0x68a5('0x44')]()[_0x68a5('0x20')](respondWithResult(_0xf12b49,null))[_0x68a5('0x3d')](handleError(_0xf12b49,null));};exports['update']=function(_0x42228b,_0x3f1518){if(_0x42228b[_0x68a5('0x43')][_0x68a5('0x45')]){delete _0x42228b['body']['uniqueid'];}return db[_0x68a5('0x26')][_0x68a5('0x41')]({'where':{'uniqueid':_0x42228b['params']['id']}})[_0x68a5('0x20')](handleEntityNotFound(_0x3f1518,null))[_0x68a5('0x20')](saveUpdates(_0x42228b['body'],null))[_0x68a5('0x20')](respondWithResult(_0x3f1518,null))['catch'](handleError(_0x3f1518,null));}; \ No newline at end of file +var _0x9467=['sendStatus','end','json','offset','limit','status','Content-Range','apply','reject','save','update','then','destroy','error','stack','name','send','index','map','CmHopperHistory','rawAttributes','fieldName','type','query','keys','filters','intersection','model','attributes','length','hasOwnProperty','sort','pick','filter','merge','where','VIRTUAL','count','includeAll','include','rows','catch','show','params','fields','options','create','describe','body','uniqueid','find','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','ejs','lodash','squel','crypto','jsforce','to-csv','ioredis','../../components/parsers/advancedSearch','api','../../config/environment'];(function(_0x53361f,_0x3b2cb6){var _0x279237=function(_0x317757){while(--_0x317757){_0x53361f['push'](_0x53361f['shift']());}};_0x279237(++_0x3b2cb6);}(_0x9467,0x10b));var _0x7946=function(_0x3931ec,_0x48af19){_0x3931ec=_0x3931ec-0x0;var _0xada0f5=_0x9467[_0x3931ec];return _0xada0f5;};'use strict';var pdf=require(_0x7946('0x0'));var emlformat=require(_0x7946('0x1'));var rimraf=require(_0x7946('0x2'));var zipdir=require(_0x7946('0x3'));var jsonpatch=require(_0x7946('0x4'));var rp=require(_0x7946('0x5'));var moment=require(_0x7946('0x6'));var BPromise=require(_0x7946('0x7'));var Mustache=require(_0x7946('0x8'));var util=require('util');var path=require(_0x7946('0x9'));var sox=require(_0x7946('0xa'));var csv=require('to-csv');var ejs=require(_0x7946('0xb'));var fs=require('fs');var _=require(_0x7946('0xc'));var squel=require(_0x7946('0xd'));var crypto=require(_0x7946('0xe'));var jsforce=require(_0x7946('0xf'));var deskjs=require('desk.js');var toCsv=require(_0x7946('0x10'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x7946('0x11'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x7946('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x7946('0x13'));var utils=require('../../config/utils');var config=require(_0x7946('0x14'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x33df75,_0xe022f8){_0xe022f8=_0xe022f8||0xcc;return function(_0x2f2cfe){if(_0x2f2cfe){return _0x33df75[_0x7946('0x15')](_0xe022f8);}return _0x33df75['status'](_0xe022f8)[_0x7946('0x16')]();};}function respondWithResult(_0x13b126,_0x28746a){_0x28746a=_0x28746a||0xc8;return function(_0x6c69e3){if(_0x6c69e3){return _0x13b126['status'](_0x28746a)[_0x7946('0x17')](_0x6c69e3);}};}function respondWithFilteredResult(_0x204eef,_0x2d3546){return function(_0x4edc96){if(_0x4edc96){var _0x5e7198=_0x4edc96['count'],_0x3603a8=_0x2d3546['offset'],_0x5ef226=_0x2d3546[_0x7946('0x18')]+_0x2d3546[_0x7946('0x19')],_0xd5673a;if(_0x5ef226>=_0x5e7198){_0x5ef226=_0x5e7198;_0xd5673a=0xc8;}else{_0xd5673a=0xce;}_0x204eef[_0x7946('0x1a')](_0xd5673a);return _0x204eef['set'](_0x7946('0x1b'),_0x3603a8+'-'+_0x5ef226+'/'+_0x5e7198)['json'](_0x4edc96);}return null;};}function patchUpdates(_0x263fff){return function(_0x3f8181){try{jsonpatch[_0x7946('0x1c')](_0x3f8181,_0x263fff,!![]);}catch(_0x814e18){return BPromise[_0x7946('0x1d')](_0x814e18);}return _0x3f8181[_0x7946('0x1e')]();};}function saveUpdates(_0x4c2006,_0x30c587){return function(_0x28ac49){if(_0x28ac49){return _0x28ac49[_0x7946('0x1f')](_0x4c2006)[_0x7946('0x20')](function(_0x402120){return _0x402120;});}return null;};}function removeEntity(_0x3d4be2,_0x14749a){return function(_0x198de5){if(_0x198de5){return _0x198de5[_0x7946('0x21')]()[_0x7946('0x20')](function(){_0x3d4be2[_0x7946('0x1a')](0xcc)[_0x7946('0x16')]();});}};}function handleEntityNotFound(_0x3fa552,_0x2a6105){return function(_0x179209){if(!_0x179209){_0x3fa552[_0x7946('0x15')](0x194);}return _0x179209;};}function handleError(_0x102cc4,_0x390e18){_0x390e18=_0x390e18||0x1f4;return function(_0x3b1dc7){logger[_0x7946('0x22')](_0x3b1dc7[_0x7946('0x23')]);if(_0x3b1dc7[_0x7946('0x24')]){delete _0x3b1dc7[_0x7946('0x24')];}_0x102cc4[_0x7946('0x1a')](_0x390e18)[_0x7946('0x25')](_0x3b1dc7);};}exports[_0x7946('0x26')]=function(_0x491647,_0x2f5ee8){var _0x23fcbb={},_0x47c15f={},_0x1eec86={'count':0x0,'rows':[]};var _0x1d14ce=_[_0x7946('0x27')](db[_0x7946('0x28')][_0x7946('0x29')],function(_0x35c06b){return{'name':_0x35c06b[_0x7946('0x2a')],'type':_0x35c06b[_0x7946('0x2b')]['key']};});_0x47c15f['model']=_[_0x7946('0x27')](_0x1d14ce,'name');_0x47c15f[_0x7946('0x2c')]=_[_0x7946('0x2d')](_0x491647[_0x7946('0x2c')]);_0x47c15f[_0x7946('0x2e')]=_[_0x7946('0x2f')](_0x47c15f[_0x7946('0x30')],_0x47c15f[_0x7946('0x2c')]);_0x23fcbb[_0x7946('0x31')]=_['intersection'](_0x47c15f[_0x7946('0x30')],qs['fields'](_0x491647[_0x7946('0x2c')]['fields']));_0x23fcbb[_0x7946('0x31')]=_0x23fcbb['attributes'][_0x7946('0x32')]?_0x23fcbb['attributes']:_0x47c15f['model'];if(!_0x491647[_0x7946('0x2c')][_0x7946('0x33')]('nolimit')){_0x23fcbb[_0x7946('0x19')]=qs[_0x7946('0x19')](_0x491647[_0x7946('0x2c')][_0x7946('0x19')]);_0x23fcbb[_0x7946('0x18')]=qs[_0x7946('0x18')](_0x491647[_0x7946('0x2c')][_0x7946('0x18')]);}_0x23fcbb['order']=qs[_0x7946('0x34')](_0x491647[_0x7946('0x2c')][_0x7946('0x34')]);_0x23fcbb['where']=qs['filters'](_[_0x7946('0x35')](_0x491647[_0x7946('0x2c')],_0x47c15f[_0x7946('0x2e')]));if(_0x491647[_0x7946('0x2c')][_0x7946('0x36')]){_0x23fcbb['where']=_[_0x7946('0x37')](_0x23fcbb[_0x7946('0x38')],{'$or':_['map'](_0x1d14ce,function(_0x52e62a){if(_0x52e62a['type']!==_0x7946('0x39')){var _0x2543d6={};_0x2543d6[_0x52e62a['name']]={'$like':'%'+_0x491647[_0x7946('0x2c')][_0x7946('0x36')]+'%'};return _0x2543d6;}})});}_0x23fcbb=_[_0x7946('0x37')]({},_0x23fcbb,_0x491647['options']);var _0x1d6672={'where':_0x23fcbb[_0x7946('0x38')]};return db[_0x7946('0x28')][_0x7946('0x3a')](_0x1d6672)[_0x7946('0x20')](function(_0x497569){_0x1eec86[_0x7946('0x3a')]=_0x497569;if(_0x491647['query'][_0x7946('0x3b')]){_0x23fcbb[_0x7946('0x3c')]=[{'all':!![]}];}return db[_0x7946('0x28')]['findAll'](_0x23fcbb);})[_0x7946('0x20')](function(_0x4f4c11){_0x1eec86[_0x7946('0x3d')]=_0x4f4c11;return _0x1eec86;})[_0x7946('0x20')](respondWithFilteredResult(_0x2f5ee8,_0x23fcbb))[_0x7946('0x3e')](handleError(_0x2f5ee8,null));};exports[_0x7946('0x3f')]=function(_0x3c4586,_0x4dca2f){var _0x282dfc={'raw':!![],'where':{'id':_0x3c4586[_0x7946('0x40')]['id']}},_0x386f63={};_0x386f63[_0x7946('0x30')]=_[_0x7946('0x2d')](db[_0x7946('0x28')]['rawAttributes']);_0x386f63['query']=_['keys'](_0x3c4586[_0x7946('0x2c')]);_0x386f63[_0x7946('0x2e')]=_['intersection'](_0x386f63[_0x7946('0x30')],_0x386f63[_0x7946('0x2c')]);_0x282dfc[_0x7946('0x31')]=_[_0x7946('0x2f')](_0x386f63[_0x7946('0x30')],qs[_0x7946('0x41')](_0x3c4586[_0x7946('0x2c')][_0x7946('0x41')]));_0x282dfc[_0x7946('0x31')]=_0x282dfc['attributes']['length']?_0x282dfc[_0x7946('0x31')]:_0x386f63['model'];if(_0x3c4586['query']['includeAll']){_0x282dfc[_0x7946('0x3c')]=[{'all':!![]}];}_0x282dfc=_[_0x7946('0x37')]({},_0x282dfc,_0x3c4586[_0x7946('0x42')]);return db[_0x7946('0x28')]['find'](_0x282dfc)['then'](handleEntityNotFound(_0x4dca2f,null))[_0x7946('0x20')](respondWithResult(_0x4dca2f,null))[_0x7946('0x3e')](handleError(_0x4dca2f,null));};exports['create']=function(_0x4a3ab9,_0xad1f64){return db[_0x7946('0x28')][_0x7946('0x43')](_0x4a3ab9['body'],{})[_0x7946('0x20')](respondWithResult(_0xad1f64,0xc9))[_0x7946('0x3e')](handleError(_0xad1f64,null));};exports[_0x7946('0x44')]=function(_0x2856b9,_0xe981de){return db[_0x7946('0x28')][_0x7946('0x44')]()['then'](respondWithResult(_0xe981de,null))[_0x7946('0x3e')](handleError(_0xe981de,null));};exports['update']=function(_0x39e4f0,_0x4cb579){if(_0x39e4f0[_0x7946('0x45')]['uniqueid']){delete _0x39e4f0[_0x7946('0x45')][_0x7946('0x46')];}return db[_0x7946('0x28')][_0x7946('0x47')]({'where':{'uniqueid':_0x39e4f0[_0x7946('0x40')]['id']}})[_0x7946('0x20')](handleEntityNotFound(_0x4cb579,null))['then'](saveUpdates(_0x39e4f0[_0x7946('0x45')],null))[_0x7946('0x20')](respondWithResult(_0x4cb579,null))[_0x7946('0x3e')](handleError(_0x4cb579,null));}; \ No newline at end of file diff --git a/server/api/cmHopperHistory/cmHopperHistory.model.js b/server/api/cmHopperHistory/cmHopperHistory.model.js index 324a106..aa571ca 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 _0xef60=['cm_hopper_history','endtime','uniqueid','util','../../config/logger','api','moment','bluebird','path','../../config/environment','define','CmHopperHistory'];(function(_0x30be97,_0x3ea719){var _0x1d3a90=function(_0x512e8a){while(--_0x512e8a){_0x30be97['push'](_0x30be97['shift']());}};_0x1d3a90(++_0x3ea719);}(_0xef60,0x1a7));var _0x0ef6=function(_0x19171e,_0x81022a){_0x19171e=_0x19171e-0x0;var _0x2d3111=_0xef60[_0x19171e];return _0x2d3111;};'use strict';var _=require('lodash');var util=require(_0x0ef6('0x0'));var logger=require(_0x0ef6('0x1'))(_0x0ef6('0x2'));var moment=require(_0x0ef6('0x3'));var BPromise=require(_0x0ef6('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x0ef6('0x5'));var rimraf=require('rimraf');var config=require(_0x0ef6('0x6'));var attributes=require('./cmHopperHistory.attributes');module['exports']=function(_0x111f61,_0x59835c){return _0x111f61[_0x0ef6('0x7')](_0x0ef6('0x8'),attributes,{'tableName':_0x0ef6('0x9'),'paranoid':![],'indexes':[{'name':_0x0ef6('0xa'),'fields':[_0x0ef6('0xa')]},{'name':_0x0ef6('0xb'),'fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file +var _0x7588=['define','CmHopperHistory','endtime','uniqueid','util','../../config/logger','bluebird','request-promise','path','rimraf','../../config/environment','./cmHopperHistory.attributes'];(function(_0x3bf2d3,_0x5c5f34){var _0x4f6be4=function(_0x3046f8){while(--_0x3046f8){_0x3bf2d3['push'](_0x3bf2d3['shift']());}};_0x4f6be4(++_0x5c5f34);}(_0x7588,0x70));var _0x8758=function(_0x1df19a,_0x581cb6){_0x1df19a=_0x1df19a-0x0;var _0x33ab8b=_0x7588[_0x1df19a];return _0x33ab8b;};'use strict';var _=require('lodash');var util=require(_0x8758('0x0'));var logger=require(_0x8758('0x1'))('api');var moment=require('moment');var BPromise=require(_0x8758('0x2'));var rp=require(_0x8758('0x3'));var fs=require('fs');var path=require(_0x8758('0x4'));var rimraf=require(_0x8758('0x5'));var config=require(_0x8758('0x6'));var attributes=require(_0x8758('0x7'));module['exports']=function(_0x3b5687,_0xc5a70c){return _0x3b5687[_0x8758('0x8')](_0x8758('0x9'),attributes,{'tableName':'cm_hopper_history','paranoid':![],'indexes':[{'name':_0x8758('0xa'),'fields':['endtime']},{'name':_0x8758('0xb'),'fields':[_0x8758('0xb')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/cmHopperHistory/cmHopperHistory.rpc.js b/server/api/cmHopperHistory/cmHopperHistory.rpc.js index 17b31e8..f595faf 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 _0x4fc2=['request\x20sent','debug','CmHopperHistory,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','create','body','options','raw','CreateCmHopperHistory','AvgHandleTime','CmHopperHistory','findAll','where','sequelize','col','predictiveIntervalTotalCalls','COUNT','literal','`state`\x20=\x204,\x201,\x20null','predictiveIntervalAnsweredCalls','`state`\x20=\x2010,\x201,\x20null','`state`\x20=\x2011,\x201,\x20null','predictiveIntervalDroppedCallsCallersExit','AVG','`state`\x20=\x204,\x20`holdtime`,\x20null','`state`\x20=\x204,\x20`talktime`,\x20null','predictiveIntervalAvgTalktime','name','`state`\x20=\x200,\x201,\x20null','`state`\x20=\x203,\x201,\x20null','outboundNoAnswerCallsDay','outboundAnswerCallsDay','`state`\x20=\x205,\x201,\x20null','outboundBusyCallsDay','`state`\x20=\x208,\x201,\x20null','outboundCongestionCallsDay','`state`\x20=\x2010\x20,\x201,\x20null','outboundDropCallsDayTimeout','outboundDropCallsDayCallersExit','outboundUnknownCallsDay','`state`\x20=\x2013,\x201,\x20null','outboundBlacklistCallsDay','`state`\x20=\x2014,\x201,\x20null','outboundRejectCallsDay','`state`\x20=\x2016,\x201,\x20null','outboundAnswerAgiCallsDay','`state`\x20=\x2020,\x201,\x20null','outboundReCallsDay','campaign','GetVoiceQueueHopperHistory','GetCampaignHopperHistory','ivrTotalCallsDays','ivrAnswerCallsDay','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','client','http','request','then','info','CmHopperHistory,\x20%s,\x20%s'];(function(_0x318696,_0x5069a5){var _0x16ef65=function(_0xbfa794){while(--_0xbfa794){_0x318696['push'](_0x318696['shift']());}};_0x16ef65(++_0x5069a5);}(_0x4fc2,0x111));var _0x24fc=function(_0x129253,_0x58e440){_0x129253=_0x129253-0x0;var _0x2e8565=_0x4fc2[_0x129253];return _0x2e8565;};'use strict';var _=require(_0x24fc('0x0'));var util=require(_0x24fc('0x1'));var moment=require(_0x24fc('0x2'));var BPromise=require(_0x24fc('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x24fc('0x4'));var db=require(_0x24fc('0x5'))['db'];var utils=require(_0x24fc('0x6'));var logger=require('../../config/logger')(_0x24fc('0x7'));var config=require(_0x24fc('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x24fc('0x9')][_0x24fc('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x4889f4,_0x115851,_0x22a0c8){return new BPromise(function(_0x220f9a,_0x123eff){return client[_0x24fc('0xb')](_0x4889f4,_0x22a0c8)[_0x24fc('0xc')](function(_0x5afdf1){logger[_0x24fc('0xd')](_0x24fc('0xe'),_0x115851,_0x24fc('0xf'));logger[_0x24fc('0x10')](_0x24fc('0x11'),_0x115851,_0x24fc('0xf'),JSON[_0x24fc('0x12')](_0x5afdf1));if(_0x5afdf1[_0x24fc('0x13')]){if(_0x5afdf1['error'][_0x24fc('0x14')]===0x1f4){logger[_0x24fc('0x13')]('CmHopperHistory,\x20%s,\x20%s',_0x115851,_0x5afdf1[_0x24fc('0x13')][_0x24fc('0x15')]);return _0x123eff(_0x5afdf1[_0x24fc('0x13')][_0x24fc('0x15')]);}logger[_0x24fc('0x13')](_0x24fc('0xe'),_0x115851,_0x5afdf1['error'][_0x24fc('0x15')]);return _0x220f9a(_0x5afdf1[_0x24fc('0x13')][_0x24fc('0x15')]);}else{logger[_0x24fc('0xd')]('CmHopperHistory,\x20%s,\x20%s',_0x115851,_0x24fc('0xf'));_0x220f9a(_0x5afdf1['result'][_0x24fc('0x15')]);}})[_0x24fc('0x16')](function(_0x218fb6){logger[_0x24fc('0x13')](_0x24fc('0xe'),_0x115851,_0x218fb6);_0x123eff(_0x218fb6);});});}exports['CreateCmHopperHistory']=function(_0x23873c){var _0x1cb3d0=this;return new Promise(function(_0x6cfa0a,_0x8ac114){return db['CmHopperHistory'][_0x24fc('0x17')](_0x23873c[_0x24fc('0x18')],{'raw':_0x23873c[_0x24fc('0x19')]?_0x23873c['options'][_0x24fc('0x1a')]===undefined?!![]:![]:!![]})[_0x24fc('0xc')](function(_0xbf1d6b){logger[_0x24fc('0xd')]('CreateCmHopperHistory',_0x23873c);logger[_0x24fc('0x10')]('CreateCmHopperHistory',_0x23873c,JSON[_0x24fc('0x12')](_0xbf1d6b));_0x6cfa0a(_0xbf1d6b);})['catch'](function(_0x3ed464){logger[_0x24fc('0x13')](_0x24fc('0x1b'),_0x3ed464['message'],_0x23873c);_0x8ac114(_0x1cb3d0[_0x24fc('0x13')](0x1f4,_0x3ed464['message']));});});};exports[_0x24fc('0x1c')]=function(_0x2bb93a){var _0x36a9b4=this;return new Promise(function(_0x34b5b2,_0x3296fc){return db[_0x24fc('0x1d')][_0x24fc('0x1e')]({'raw':_0x2bb93a[_0x24fc('0x19')]?_0x2bb93a[_0x24fc('0x19')][_0x24fc('0x1a')]===undefined?!![]:![]:!![],'where':_0x2bb93a['options']?_0x2bb93a[_0x24fc('0x19')][_0x24fc('0x1f')]||null:null,'attributes':[[db[_0x24fc('0x20')]['fn']('COUNT',db[_0x24fc('0x20')][_0x24fc('0x21')]('id')),_0x24fc('0x22')],[db[_0x24fc('0x20')]['fn'](_0x24fc('0x23'),db[_0x24fc('0x20')]['fn']('IF',db['sequelize'][_0x24fc('0x24')](_0x24fc('0x25')))),_0x24fc('0x26')],[db[_0x24fc('0x20')]['fn'](_0x24fc('0x23'),db['sequelize']['fn']('IF',db['sequelize']['literal'](_0x24fc('0x27')))),'predictiveIntervalDroppedCallsTimeout'],[db[_0x24fc('0x20')]['fn'](_0x24fc('0x23'),db[_0x24fc('0x20')]['fn']('IF',db[_0x24fc('0x20')]['literal'](_0x24fc('0x28')))),_0x24fc('0x29')],[db['sequelize']['fn'](_0x24fc('0x2a'),db[_0x24fc('0x20')]['fn']('IF',db['sequelize']['literal'](_0x24fc('0x2b')))),'predictiveIntervalAvgHoldtime'],[db[_0x24fc('0x20')]['fn'](_0x24fc('0x2a'),db['sequelize']['fn']('IF',db[_0x24fc('0x20')][_0x24fc('0x24')](_0x24fc('0x2c')))),_0x24fc('0x2d')]]})[_0x24fc('0xc')](function(_0x1e205d){logger[_0x24fc('0xd')](_0x24fc('0x1c'),_0x2bb93a);logger[_0x24fc('0x10')]('AvgHandleTime',_0x2bb93a,JSON[_0x24fc('0x12')](_0x1e205d));_0x34b5b2(_0x1e205d);})[_0x24fc('0x16')](function(_0x2fbe30){logger[_0x24fc('0x13')](_0x24fc('0x1c'),_0x2fbe30['message'],_0x2bb93a);_0x3296fc(_0x36a9b4['error'](0x1f4,_0x2fbe30[_0x24fc('0x15')]));});});};exports['GetVoiceQueueHopperHistory']=function(_0x22ef18){var _0x38798d=this;return new Promise(function(_0x10399f,_0x41b408){return db['CmHopperHistory'][_0x24fc('0x1e')]({'raw':_0x22ef18['options']?_0x22ef18[_0x24fc('0x19')][_0x24fc('0x1a')]===undefined?!![]:![]:!![],'where':_0x22ef18[_0x24fc('0x19')]?_0x22ef18[_0x24fc('0x19')][_0x24fc('0x1f')]||null:null,'attributes':[['campaign',_0x24fc('0x2e')],[db[_0x24fc('0x20')]['fn'](_0x24fc('0x23'),db[_0x24fc('0x20')]['fn']('IF',db['sequelize'][_0x24fc('0x24')](_0x24fc('0x2f')))),'outboundNoSuchCallsDay'],[db[_0x24fc('0x20')]['fn']('COUNT',db[_0x24fc('0x20')]['fn']('IF',db[_0x24fc('0x20')][_0x24fc('0x24')](_0x24fc('0x30')))),_0x24fc('0x31')],[db[_0x24fc('0x20')]['fn'](_0x24fc('0x23'),db[_0x24fc('0x20')]['fn']('IF',db['sequelize'][_0x24fc('0x24')](_0x24fc('0x25')))),_0x24fc('0x32')],[db['sequelize']['fn'](_0x24fc('0x23'),db[_0x24fc('0x20')]['fn']('IF',db['sequelize'][_0x24fc('0x24')](_0x24fc('0x33')))),_0x24fc('0x34')],[db['sequelize']['fn'](_0x24fc('0x23'),db[_0x24fc('0x20')]['fn']('IF',db['sequelize'][_0x24fc('0x24')](_0x24fc('0x35')))),_0x24fc('0x36')],[db[_0x24fc('0x20')]['fn']('COUNT',db[_0x24fc('0x20')]['fn']('IF',db[_0x24fc('0x20')][_0x24fc('0x24')](_0x24fc('0x37')))),_0x24fc('0x38')],[db['sequelize']['fn'](_0x24fc('0x23'),db[_0x24fc('0x20')]['fn']('IF',db[_0x24fc('0x20')][_0x24fc('0x24')]('`state`\x20=\x2011\x20,\x201,\x20null'))),_0x24fc('0x39')],[db[_0x24fc('0x20')]['fn']('COUNT',db['sequelize']['fn']('IF',db[_0x24fc('0x20')]['literal']('`state`\x20=\x2012,\x201,\x20null'))),_0x24fc('0x3a')],[db['sequelize']['fn'](_0x24fc('0x23'),db[_0x24fc('0x20')]['fn']('IF',db[_0x24fc('0x20')]['literal'](_0x24fc('0x3b')))),_0x24fc('0x3c')],[db[_0x24fc('0x20')]['fn'](_0x24fc('0x23'),db[_0x24fc('0x20')]['fn']('IF',db[_0x24fc('0x20')][_0x24fc('0x24')](_0x24fc('0x3d')))),'outboundOriginateFailureCallsDay'],[db['sequelize']['fn'](_0x24fc('0x23'),db[_0x24fc('0x20')]['fn']('IF',db[_0x24fc('0x20')]['literal']('`state`\x20=\x2018,\x201,\x20null'))),_0x24fc('0x3e')],[db[_0x24fc('0x20')]['fn'](_0x24fc('0x23'),db[_0x24fc('0x20')]['fn']('IF',db[_0x24fc('0x20')][_0x24fc('0x24')](_0x24fc('0x3f')))),_0x24fc('0x40')],[db[_0x24fc('0x20')]['fn'](_0x24fc('0x23'),db[_0x24fc('0x20')]['fn']('IF',db[_0x24fc('0x20')]['literal'](_0x24fc('0x41')))),_0x24fc('0x3e')],[db[_0x24fc('0x20')]['fn'](_0x24fc('0x23'),db[_0x24fc('0x20')]['fn']('IF',db['sequelize'][_0x24fc('0x24')]('`state`\x20=\x2022\x20or\x20`state`\x20=\x2023,\x201,\x20null'))),_0x24fc('0x42')]],'group':[_0x24fc('0x43')]})[_0x24fc('0xc')](function(_0x41ddfb){logger[_0x24fc('0xd')](_0x24fc('0x44'),_0x22ef18);logger['debug'](_0x24fc('0x44'),_0x22ef18,JSON[_0x24fc('0x12')](_0x41ddfb));_0x10399f(_0x41ddfb);})[_0x24fc('0x16')](function(_0x31a2ef){logger[_0x24fc('0x13')](_0x24fc('0x44'),_0x31a2ef['message'],_0x22ef18);_0x41b408(_0x38798d[_0x24fc('0x13')](0x1f4,_0x31a2ef[_0x24fc('0x15')]));});});};exports[_0x24fc('0x45')]=function(_0x1b69ad){var _0x3e739d=this;return new Promise(function(_0x385968,_0x1ffd5b){return db['CmHopperHistory'][_0x24fc('0x1e')]({'raw':_0x1b69ad[_0x24fc('0x19')]?_0x1b69ad['options'][_0x24fc('0x1a')]===undefined?!![]:![]:!![],'where':_0x1b69ad[_0x24fc('0x19')]?_0x1b69ad[_0x24fc('0x19')][_0x24fc('0x1f')]||null:null,'attributes':[[_0x24fc('0x43'),_0x24fc('0x2e')],[db['sequelize']['fn'](_0x24fc('0x23'),db['sequelize'][_0x24fc('0x21')]('id')),_0x24fc('0x46')],[db['sequelize']['fn'](_0x24fc('0x23'),db['sequelize']['fn']('IF',db[_0x24fc('0x20')]['literal'](_0x24fc('0x25')))),_0x24fc('0x47')]],'group':['campaign']})[_0x24fc('0xc')](function(_0x5d6539){logger[_0x24fc('0xd')](_0x24fc('0x45'),_0x1b69ad);logger['debug'](_0x24fc('0x45'),_0x1b69ad,JSON[_0x24fc('0x12')](_0x5d6539));_0x385968(_0x5d6539);})[_0x24fc('0x16')](function(_0x47179d){logger[_0x24fc('0x13')]('GetCampaignHopperHistory',_0x47179d[_0x24fc('0x15')],_0x1b69ad);_0x1ffd5b(_0x3e739d[_0x24fc('0x13')](0x1f4,_0x47179d[_0x24fc('0x15')]));});});}; \ No newline at end of file +var _0x6cb4=['../../config/environment','client','request','info','request\x20sent','debug','stringify','error','CmHopperHistory,\x20%s,\x20%s','message','result','catch','CmHopperHistory','create','body','options','raw','then','CreateCmHopperHistory','AvgHandleTime','findAll','COUNT','sequelize','col','predictiveIntervalTotalCalls','literal','`state`\x20=\x204,\x201,\x20null','predictiveIntervalAnsweredCalls','`state`\x20=\x2010,\x201,\x20null','`state`\x20=\x2011,\x201,\x20null','`state`\x20=\x204,\x20`holdtime`,\x20null','predictiveIntervalAvgHoldtime','AVG','predictiveIntervalAvgTalktime','GetVoiceQueueHopperHistory','campaign','`state`\x20=\x203,\x201,\x20null','outboundNoAnswerCallsDay','outboundAnswerCallsDay','`state`\x20=\x205,\x201,\x20null','outboundBusyCallsDay','`state`\x20=\x208,\x201,\x20null','`state`\x20=\x2010\x20,\x201,\x20null','`state`\x20=\x2011\x20,\x201,\x20null','outboundDropCallsDayCallersExit','outboundUnknownCallsDay','`state`\x20=\x2013,\x201,\x20null','`state`\x20=\x2014,\x201,\x20null','`state`\x20=\x2018,\x201,\x20null','outboundRejectCallsDay','`state`\x20=\x2016,\x201,\x20null','outboundAnswerAgiCallsDay','`state`\x20=\x2020,\x201,\x20null','GetCampaignHopperHistory','where','name','ivrTotalCallsDays','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger'];(function(_0x1347f8,_0x233feb){var _0x218368=function(_0x3f4ca3){while(--_0x3f4ca3){_0x1347f8['push'](_0x1347f8['shift']());}};_0x218368(++_0x233feb);}(_0x6cb4,0xff));var _0x46cb=function(_0x33a949,_0x2e2458){_0x33a949=_0x33a949-0x0;var _0x2056ed=_0x6cb4[_0x33a949];return _0x2056ed;};'use strict';var _=require(_0x46cb('0x0'));var util=require(_0x46cb('0x1'));var moment=require(_0x46cb('0x2'));var BPromise=require(_0x46cb('0x3'));var rs=require(_0x46cb('0x4'));var fs=require('fs');var Redis=require(_0x46cb('0x5'));var db=require(_0x46cb('0x6'))['db'];var utils=require(_0x46cb('0x7'));var logger=require(_0x46cb('0x8'))('rpc');var config=require(_0x46cb('0x9'));var jayson=require('jayson/promise');var client=jayson[_0x46cb('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x11262d,_0x148d0f,_0x31b35b){return new BPromise(function(_0x2d6c29,_0x24b4f5){return client[_0x46cb('0xb')](_0x11262d,_0x31b35b)['then'](function(_0x3d7663){logger[_0x46cb('0xc')]('CmHopperHistory,\x20%s,\x20%s',_0x148d0f,_0x46cb('0xd'));logger[_0x46cb('0xe')]('CmHopperHistory,\x20%s,\x20%s,\x20%s',_0x148d0f,_0x46cb('0xd'),JSON[_0x46cb('0xf')](_0x3d7663));if(_0x3d7663['error']){if(_0x3d7663['error']['code']===0x1f4){logger[_0x46cb('0x10')](_0x46cb('0x11'),_0x148d0f,_0x3d7663[_0x46cb('0x10')][_0x46cb('0x12')]);return _0x24b4f5(_0x3d7663['error'][_0x46cb('0x12')]);}logger[_0x46cb('0x10')](_0x46cb('0x11'),_0x148d0f,_0x3d7663[_0x46cb('0x10')][_0x46cb('0x12')]);return _0x2d6c29(_0x3d7663[_0x46cb('0x10')][_0x46cb('0x12')]);}else{logger[_0x46cb('0xc')](_0x46cb('0x11'),_0x148d0f,_0x46cb('0xd'));_0x2d6c29(_0x3d7663[_0x46cb('0x13')]['message']);}})[_0x46cb('0x14')](function(_0x5796d2){logger[_0x46cb('0x10')]('CmHopperHistory,\x20%s,\x20%s',_0x148d0f,_0x5796d2);_0x24b4f5(_0x5796d2);});});}exports['CreateCmHopperHistory']=function(_0x4e3454){var _0x1b6646=this;return new Promise(function(_0x1f2891,_0x4df1f0){return db[_0x46cb('0x15')][_0x46cb('0x16')](_0x4e3454[_0x46cb('0x17')],{'raw':_0x4e3454[_0x46cb('0x18')]?_0x4e3454[_0x46cb('0x18')][_0x46cb('0x19')]===undefined?!![]:![]:!![]})[_0x46cb('0x1a')](function(_0x149483){logger[_0x46cb('0xc')](_0x46cb('0x1b'),_0x4e3454);logger[_0x46cb('0xe')](_0x46cb('0x1b'),_0x4e3454,JSON[_0x46cb('0xf')](_0x149483));_0x1f2891(_0x149483);})[_0x46cb('0x14')](function(_0x1fb467){logger[_0x46cb('0x10')](_0x46cb('0x1b'),_0x1fb467[_0x46cb('0x12')],_0x4e3454);_0x4df1f0(_0x1b6646[_0x46cb('0x10')](0x1f4,_0x1fb467[_0x46cb('0x12')]));});});};exports[_0x46cb('0x1c')]=function(_0x40e0e5){var _0x5a1338=this;return new Promise(function(_0x4d663e,_0x6588f3){return db[_0x46cb('0x15')][_0x46cb('0x1d')]({'raw':_0x40e0e5[_0x46cb('0x18')]?_0x40e0e5[_0x46cb('0x18')]['raw']===undefined?!![]:![]:!![],'where':_0x40e0e5[_0x46cb('0x18')]?_0x40e0e5['options']['where']||null:null,'attributes':[[db['sequelize']['fn'](_0x46cb('0x1e'),db[_0x46cb('0x1f')][_0x46cb('0x20')]('id')),_0x46cb('0x21')],[db[_0x46cb('0x1f')]['fn'](_0x46cb('0x1e'),db[_0x46cb('0x1f')]['fn']('IF',db[_0x46cb('0x1f')][_0x46cb('0x22')](_0x46cb('0x23')))),_0x46cb('0x24')],[db['sequelize']['fn'](_0x46cb('0x1e'),db[_0x46cb('0x1f')]['fn']('IF',db['sequelize']['literal'](_0x46cb('0x25')))),'predictiveIntervalDroppedCallsTimeout'],[db[_0x46cb('0x1f')]['fn'](_0x46cb('0x1e'),db[_0x46cb('0x1f')]['fn']('IF',db[_0x46cb('0x1f')][_0x46cb('0x22')](_0x46cb('0x26')))),'predictiveIntervalDroppedCallsCallersExit'],[db[_0x46cb('0x1f')]['fn']('AVG',db[_0x46cb('0x1f')]['fn']('IF',db[_0x46cb('0x1f')]['literal'](_0x46cb('0x27')))),_0x46cb('0x28')],[db[_0x46cb('0x1f')]['fn'](_0x46cb('0x29'),db[_0x46cb('0x1f')]['fn']('IF',db['sequelize'][_0x46cb('0x22')]('`state`\x20=\x204,\x20`talktime`,\x20null'))),_0x46cb('0x2a')]]})[_0x46cb('0x1a')](function(_0x2630e0){logger['info'](_0x46cb('0x1c'),_0x40e0e5);logger[_0x46cb('0xe')]('AvgHandleTime',_0x40e0e5,JSON[_0x46cb('0xf')](_0x2630e0));_0x4d663e(_0x2630e0);})[_0x46cb('0x14')](function(_0x3ba467){logger[_0x46cb('0x10')](_0x46cb('0x1c'),_0x3ba467[_0x46cb('0x12')],_0x40e0e5);_0x6588f3(_0x5a1338[_0x46cb('0x10')](0x1f4,_0x3ba467[_0x46cb('0x12')]));});});};exports[_0x46cb('0x2b')]=function(_0xe4504e){var _0xba5e93=this;return new Promise(function(_0x4f0fb6,_0x5f1df0){return db['CmHopperHistory'][_0x46cb('0x1d')]({'raw':_0xe4504e[_0x46cb('0x18')]?_0xe4504e[_0x46cb('0x18')][_0x46cb('0x19')]===undefined?!![]:![]:!![],'where':_0xe4504e[_0x46cb('0x18')]?_0xe4504e[_0x46cb('0x18')]['where']||null:null,'attributes':[[_0x46cb('0x2c'),'name'],[db['sequelize']['fn'](_0x46cb('0x1e'),db['sequelize']['fn']('IF',db['sequelize'][_0x46cb('0x22')]('`state`\x20=\x200,\x201,\x20null'))),'outboundNoSuchCallsDay'],[db[_0x46cb('0x1f')]['fn'](_0x46cb('0x1e'),db[_0x46cb('0x1f')]['fn']('IF',db[_0x46cb('0x1f')][_0x46cb('0x22')](_0x46cb('0x2d')))),_0x46cb('0x2e')],[db['sequelize']['fn'](_0x46cb('0x1e'),db['sequelize']['fn']('IF',db[_0x46cb('0x1f')]['literal'](_0x46cb('0x23')))),_0x46cb('0x2f')],[db[_0x46cb('0x1f')]['fn']('COUNT',db[_0x46cb('0x1f')]['fn']('IF',db[_0x46cb('0x1f')]['literal'](_0x46cb('0x30')))),_0x46cb('0x31')],[db[_0x46cb('0x1f')]['fn'](_0x46cb('0x1e'),db[_0x46cb('0x1f')]['fn']('IF',db['sequelize']['literal'](_0x46cb('0x32')))),'outboundCongestionCallsDay'],[db[_0x46cb('0x1f')]['fn'](_0x46cb('0x1e'),db['sequelize']['fn']('IF',db[_0x46cb('0x1f')][_0x46cb('0x22')](_0x46cb('0x33')))),'outboundDropCallsDayTimeout'],[db['sequelize']['fn']('COUNT',db['sequelize']['fn']('IF',db[_0x46cb('0x1f')][_0x46cb('0x22')](_0x46cb('0x34')))),_0x46cb('0x35')],[db[_0x46cb('0x1f')]['fn']('COUNT',db['sequelize']['fn']('IF',db[_0x46cb('0x1f')][_0x46cb('0x22')]('`state`\x20=\x2012,\x201,\x20null'))),_0x46cb('0x36')],[db[_0x46cb('0x1f')]['fn'](_0x46cb('0x1e'),db[_0x46cb('0x1f')]['fn']('IF',db[_0x46cb('0x1f')][_0x46cb('0x22')](_0x46cb('0x37')))),'outboundBlacklistCallsDay'],[db['sequelize']['fn'](_0x46cb('0x1e'),db['sequelize']['fn']('IF',db[_0x46cb('0x1f')][_0x46cb('0x22')](_0x46cb('0x38')))),'outboundOriginateFailureCallsDay'],[db[_0x46cb('0x1f')]['fn']('COUNT',db['sequelize']['fn']('IF',db[_0x46cb('0x1f')][_0x46cb('0x22')](_0x46cb('0x39')))),_0x46cb('0x3a')],[db[_0x46cb('0x1f')]['fn'](_0x46cb('0x1e'),db[_0x46cb('0x1f')]['fn']('IF',db['sequelize']['literal'](_0x46cb('0x3b')))),_0x46cb('0x3c')],[db['sequelize']['fn'](_0x46cb('0x1e'),db[_0x46cb('0x1f')]['fn']('IF',db[_0x46cb('0x1f')][_0x46cb('0x22')](_0x46cb('0x3d')))),'outboundRejectCallsDay'],[db[_0x46cb('0x1f')]['fn'](_0x46cb('0x1e'),db[_0x46cb('0x1f')]['fn']('IF',db['sequelize'][_0x46cb('0x22')]('`state`\x20=\x2022\x20or\x20`state`\x20=\x2023,\x201,\x20null'))),'outboundReCallsDay']],'group':[_0x46cb('0x2c')]})[_0x46cb('0x1a')](function(_0x2fe0b1){logger[_0x46cb('0xc')](_0x46cb('0x2b'),_0xe4504e);logger['debug'](_0x46cb('0x2b'),_0xe4504e,JSON[_0x46cb('0xf')](_0x2fe0b1));_0x4f0fb6(_0x2fe0b1);})['catch'](function(_0x51a103){logger[_0x46cb('0x10')](_0x46cb('0x2b'),_0x51a103[_0x46cb('0x12')],_0xe4504e);_0x5f1df0(_0xba5e93['error'](0x1f4,_0x51a103[_0x46cb('0x12')]));});});};exports[_0x46cb('0x3e')]=function(_0x434df9){var _0x61aef9=this;return new Promise(function(_0x46407d,_0x3f415d){return db[_0x46cb('0x15')][_0x46cb('0x1d')]({'raw':_0x434df9[_0x46cb('0x18')]?_0x434df9['options'][_0x46cb('0x19')]===undefined?!![]:![]:!![],'where':_0x434df9['options']?_0x434df9[_0x46cb('0x18')][_0x46cb('0x3f')]||null:null,'attributes':[[_0x46cb('0x2c'),_0x46cb('0x40')],[db['sequelize']['fn'](_0x46cb('0x1e'),db[_0x46cb('0x1f')][_0x46cb('0x20')]('id')),_0x46cb('0x41')],[db[_0x46cb('0x1f')]['fn'](_0x46cb('0x1e'),db[_0x46cb('0x1f')]['fn']('IF',db[_0x46cb('0x1f')]['literal']('`state`\x20=\x204,\x201,\x20null'))),'ivrAnswerCallsDay']],'group':['campaign']})[_0x46cb('0x1a')](function(_0xdb582b){logger['info'](_0x46cb('0x3e'),_0x434df9);logger[_0x46cb('0xe')](_0x46cb('0x3e'),_0x434df9,JSON['stringify'](_0xdb582b));_0x46407d(_0xdb582b);})['catch'](function(_0x1ad6fc){logger['error'](_0x46cb('0x3e'),_0x1ad6fc[_0x46cb('0x12')],_0x434df9);_0x3f415d(_0x61aef9[_0x46cb('0x10')](0x1f4,_0x1ad6fc[_0x46cb('0x12')]));});});}; \ No newline at end of file diff --git a/server/api/cmHopperHistory/index.js b/server/api/cmHopperHistory/index.js index e781382..07bce46 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 _0x0f24=['get','isAuthenticated','/describe','/:id','show','put','update','exports','multer','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./cmHopperHistory.controller'];(function(_0x16b364,_0x76e0ae){var _0x3ba2da=function(_0x4738e4){while(--_0x4738e4){_0x16b364['push'](_0x16b364['shift']());}};_0x3ba2da(++_0x76e0ae);}(_0x0f24,0x16d));var _0x40f2=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x0f24[_0x14add3];return _0x4a174f;};'use strict';var multer=require(_0x40f2('0x0'));var util=require('util');var path=require(_0x40f2('0x1'));var timeout=require(_0x40f2('0x2'));var express=require(_0x40f2('0x3'));var router=express[_0x40f2('0x4')]();var auth=require(_0x40f2('0x5'));var interaction=require(_0x40f2('0x6'));var config=require(_0x40f2('0x7'));var controller=require(_0x40f2('0x8'));router[_0x40f2('0x9')]('/',auth[_0x40f2('0xa')](),controller['index']);router[_0x40f2('0x9')](_0x40f2('0xb'),auth[_0x40f2('0xa')](),controller['describe']);router[_0x40f2('0x9')](_0x40f2('0xc'),auth[_0x40f2('0xa')](),controller[_0x40f2('0xd')]);router['post']('/',auth[_0x40f2('0xa')](),controller['create']);router[_0x40f2('0xe')](_0x40f2('0xc'),auth['isAuthenticated'](),controller[_0x40f2('0xf')]);module[_0x40f2('0x10')]=router; \ No newline at end of file +var _0x672a=['create','put','update','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./cmHopperHistory.controller','get','index','/describe','isAuthenticated','describe','/:id','show','post'];(function(_0x1f27f4,_0x4e7a63){var _0x2ff2f2=function(_0x2c102f){while(--_0x2c102f){_0x1f27f4['push'](_0x1f27f4['shift']());}};_0x2ff2f2(++_0x4e7a63);}(_0x672a,0x122));var _0xa672=function(_0x1757dc,_0x4914dc){_0x1757dc=_0x1757dc-0x0;var _0x4454a5=_0x672a[_0x1757dc];return _0x4454a5;};'use strict';var multer=require(_0xa672('0x0'));var util=require(_0xa672('0x1'));var path=require(_0xa672('0x2'));var timeout=require(_0xa672('0x3'));var express=require(_0xa672('0x4'));var router=express[_0xa672('0x5')]();var auth=require(_0xa672('0x6'));var interaction=require(_0xa672('0x7'));var config=require(_0xa672('0x8'));var controller=require(_0xa672('0x9'));router[_0xa672('0xa')]('/',auth['isAuthenticated'](),controller[_0xa672('0xb')]);router[_0xa672('0xa')](_0xa672('0xc'),auth[_0xa672('0xd')](),controller[_0xa672('0xe')]);router[_0xa672('0xa')](_0xa672('0xf'),auth[_0xa672('0xd')](),controller[_0xa672('0x10')]);router[_0xa672('0x11')]('/',auth[_0xa672('0xd')](),controller[_0xa672('0x12')]);router[_0xa672('0x13')](_0xa672('0xf'),auth['isAuthenticated'](),controller[_0xa672('0x14')]);module[_0xa672('0x15')]=router; \ No newline at end of file diff --git a/server/api/cmList/cmList.attributes.js b/server/api/cmList/cmList.attributes.js index 650146f..026a9dc 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 _0x08e1=['STRING'];(function(_0x3de01a,_0xcc1fd4){var _0x43f31e=function(_0xf8e692){while(--_0xf8e692){_0x3de01a['push'](_0x3de01a['shift']());}};_0x43f31e(++_0xcc1fd4);}(_0x08e1,0x1b9));var _0x108e=function(_0x6c993a,_0x5ea3ab){_0x6c993a=_0x6c993a-0x0;var _0x27f547=_0x08e1[_0x6c993a];return _0x27f547;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize['STRING'],'unique':'name','allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize[_0x108e('0x0')]},'dialPrefix':{'type':Sequelize[_0x108e('0x0')]}}; \ No newline at end of file +var _0xed35=['STRING','name','sequelize','exports'];(function(_0x397e5f,_0x454c8f){var _0x5302b8=function(_0x1a29ef){while(--_0x1a29ef){_0x397e5f['push'](_0x397e5f['shift']());}};_0x5302b8(++_0x454c8f);}(_0xed35,0x15e));var _0x5ed3=function(_0xf668a2,_0x44efeb){_0xf668a2=_0xf668a2-0x0;var _0x4f02cb=_0xed35[_0xf668a2];return _0x4f02cb;};'use strict';var Sequelize=require(_0x5ed3('0x0'));module[_0x5ed3('0x1')]={'name':{'type':Sequelize[_0x5ed3('0x2')],'unique':_0x5ed3('0x3'),'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize[_0x5ed3('0x2')]},'dialPrefix':{'type':Sequelize[_0x5ed3('0x2')]}}; \ No newline at end of file diff --git a/server/api/cmList/cmList.controller.js b/server/api/cmList/cmList.controller.js index 6682d19..6c52ea4 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 _0xa9e0=['addAgents','spread','removeAgents','emit','userCmList:remove','getAgents','User','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','./cmList.socket','register','sendStatus','end','status','json','count','offset','limit','set','Content-Range','apply','reject','update','then','destroy','get','UserProfileResource','error','stack','name','send','index','map','CmList','rawAttributes','fieldName','type','model','query','keys','filters','attributes','intersection','fields','hasOwnProperty','order','sort','pick','filter','where','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','length','merge','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','describe','addDisposition','ListId','findOne','Disposition','removeDispositions','ids','addContacts','CmContact','tags','isArray','join','push','each','omit','success','errors','message','CmCustomField','CustomFields','concat','format','cf_%d','nolimit','raw','getContacts','isEmpty','now','/tmp/list_%d_%s.csv','setHeader','Content-disposition','attachment;\x20filename=','Content-type','text/csv','addCustomField','sequelize','transaction','addCustomFields','TEXT','text','Sequelize','number','INTEGER','switch','defaultValue','queryInterface','cm_contacts','cf_%s','getCustomFields','findAndCountAll'];(function(_0xd657a0,_0x1e6ade){var _0x2886fb=function(_0x29f545){while(--_0x29f545){_0xd657a0['push'](_0xd657a0['shift']());}};_0x2886fb(++_0x1e6ade);}(_0xa9e0,0x123));var _0x0a9e=function(_0xea8947,_0x1b573d){_0xea8947=_0xea8947-0x0;var _0x2455e9=_0xa9e0[_0xea8947];return _0x2455e9;};'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);function respondWithStatusCode(_0x2b4227,_0x281129){_0x281129=_0x281129||0xcc;return function(_0x44dcfd){if(_0x44dcfd){return _0x2b4227[_0x0a9e('0x1a')](_0x281129);}return _0x2b4227['status'](_0x281129)[_0x0a9e('0x1b')]();};}function respondWithResult(_0x5d0880,_0x1985b6){_0x1985b6=_0x1985b6||0xc8;return function(_0x519dfd){if(_0x519dfd){return _0x5d0880[_0x0a9e('0x1c')](_0x1985b6)[_0x0a9e('0x1d')](_0x519dfd);}};}function respondWithFilteredResult(_0x48f32d,_0x225616){return function(_0x5a0a06){if(_0x5a0a06){var _0x459eb1=_0x5a0a06[_0x0a9e('0x1e')],_0x478723=_0x225616[_0x0a9e('0x1f')],_0x106033=_0x225616[_0x0a9e('0x1f')]+_0x225616[_0x0a9e('0x20')],_0x205fd6;if(_0x106033>=_0x459eb1){_0x106033=_0x459eb1;_0x205fd6=0xc8;}else{_0x205fd6=0xce;}_0x48f32d[_0x0a9e('0x1c')](_0x205fd6);return _0x48f32d[_0x0a9e('0x21')](_0x0a9e('0x22'),_0x478723+'-'+_0x106033+'/'+_0x459eb1)[_0x0a9e('0x1d')](_0x5a0a06);}return null;};}function patchUpdates(_0x4bb1e3){return function(_0x2c3407){try{jsonpatch[_0x0a9e('0x23')](_0x2c3407,_0x4bb1e3,!![]);}catch(_0x53682f){return BPromise[_0x0a9e('0x24')](_0x53682f);}return _0x2c3407['save']();};}function saveUpdates(_0x588269,_0x3a02e1){return function(_0x432e56){if(_0x432e56){return _0x432e56[_0x0a9e('0x25')](_0x588269)[_0x0a9e('0x26')](function(_0x4abc77){return _0x4abc77;});}return null;};}function removeEntity(_0xfb6e48,_0x2fb0e4){return function(_0x3b45bc){if(_0x3b45bc){return _0x3b45bc[_0x0a9e('0x27')]()[_0x0a9e('0x26')](function(){var _0x42ac8f=_0x3b45bc[_0x0a9e('0x28')]({'plain':!![]});var _0x5ea472='Lists';return db[_0x0a9e('0x29')][_0x0a9e('0x27')]({'where':{'type':_0x5ea472,'resourceId':_0x42ac8f['id']}})[_0x0a9e('0x26')](function(){return _0x3b45bc;});})[_0x0a9e('0x26')](function(){_0xfb6e48['status'](0xcc)[_0x0a9e('0x1b')]();});}};}function handleEntityNotFound(_0x479bc4,_0x45a1e7){return function(_0x5bfb33){if(!_0x5bfb33){_0x479bc4[_0x0a9e('0x1a')](0x194);}return _0x5bfb33;};}function handleError(_0x34dc65,_0x25fba9){_0x25fba9=_0x25fba9||0x1f4;return function(_0x14433c){logger[_0x0a9e('0x2a')](_0x14433c[_0x0a9e('0x2b')]);if(_0x14433c[_0x0a9e('0x2c')]){delete _0x14433c[_0x0a9e('0x2c')];}_0x34dc65['status'](_0x25fba9)[_0x0a9e('0x2d')](_0x14433c);};}exports[_0x0a9e('0x2e')]=function(_0x2b1f27,_0x2ec755){var _0x5c877d={},_0x15b200={},_0x40e7a3={'count':0x0,'rows':[]};var _0x1843b2=_[_0x0a9e('0x2f')](db[_0x0a9e('0x30')][_0x0a9e('0x31')],function(_0x296f41){return{'name':_0x296f41[_0x0a9e('0x32')],'type':_0x296f41[_0x0a9e('0x33')]['key']};});_0x15b200[_0x0a9e('0x34')]=_['map'](_0x1843b2,_0x0a9e('0x2c'));_0x15b200[_0x0a9e('0x35')]=_[_0x0a9e('0x36')](_0x2b1f27[_0x0a9e('0x35')]);_0x15b200[_0x0a9e('0x37')]=_['intersection'](_0x15b200[_0x0a9e('0x34')],_0x15b200[_0x0a9e('0x35')]);_0x5c877d[_0x0a9e('0x38')]=_[_0x0a9e('0x39')](_0x15b200[_0x0a9e('0x34')],qs[_0x0a9e('0x3a')](_0x2b1f27[_0x0a9e('0x35')][_0x0a9e('0x3a')]));_0x5c877d['attributes']=_0x5c877d[_0x0a9e('0x38')]['length']?_0x5c877d[_0x0a9e('0x38')]:_0x15b200[_0x0a9e('0x34')];if(!_0x2b1f27[_0x0a9e('0x35')][_0x0a9e('0x3b')]('nolimit')){_0x5c877d[_0x0a9e('0x20')]=qs[_0x0a9e('0x20')](_0x2b1f27[_0x0a9e('0x35')][_0x0a9e('0x20')]);_0x5c877d['offset']=qs['offset'](_0x2b1f27[_0x0a9e('0x35')]['offset']);}_0x5c877d[_0x0a9e('0x3c')]=qs[_0x0a9e('0x3d')](_0x2b1f27[_0x0a9e('0x35')][_0x0a9e('0x3d')]);_0x5c877d['where']=qs[_0x0a9e('0x37')](_[_0x0a9e('0x3e')](_0x2b1f27[_0x0a9e('0x35')],_0x15b200['filters']));if(_0x2b1f27[_0x0a9e('0x35')][_0x0a9e('0x3f')]){_0x5c877d[_0x0a9e('0x40')]=_['merge'](_0x5c877d['where'],{'$or':_[_0x0a9e('0x2f')](_0x1843b2,function(_0x40d766){if(_0x40d766['type']!==_0x0a9e('0x41')){var _0x419125={};_0x419125[_0x40d766[_0x0a9e('0x2c')]]={'$like':'%'+_0x2b1f27[_0x0a9e('0x35')]['filter']+'%'};return _0x419125;}})});}_0x5c877d=_['merge']({},_0x5c877d,_0x2b1f27[_0x0a9e('0x42')]);var _0x45b3d0={'where':_0x5c877d['where']};return db[_0x0a9e('0x30')][_0x0a9e('0x1e')](_0x45b3d0)[_0x0a9e('0x26')](function(_0x5b4f5e){_0x40e7a3[_0x0a9e('0x1e')]=_0x5b4f5e;if(_0x2b1f27[_0x0a9e('0x35')][_0x0a9e('0x43')]){_0x5c877d[_0x0a9e('0x44')]=[{'all':!![]}];}return db[_0x0a9e('0x30')][_0x0a9e('0x45')](_0x5c877d);})[_0x0a9e('0x26')](function(_0x45a9b8){_0x40e7a3[_0x0a9e('0x46')]=_0x45a9b8;return _0x40e7a3;})[_0x0a9e('0x26')](respondWithFilteredResult(_0x2ec755,_0x5c877d))[_0x0a9e('0x47')](handleError(_0x2ec755,null));};exports[_0x0a9e('0x48')]=function(_0x1a7bce,_0x11ca30){var _0x37f6cc={'raw':![],'where':{'id':_0x1a7bce['params']['id']}},_0x4d04c8={};_0x4d04c8[_0x0a9e('0x34')]=_[_0x0a9e('0x36')](db[_0x0a9e('0x30')][_0x0a9e('0x31')]);_0x4d04c8[_0x0a9e('0x35')]=_[_0x0a9e('0x36')](_0x1a7bce[_0x0a9e('0x35')]);_0x4d04c8[_0x0a9e('0x37')]=_[_0x0a9e('0x39')](_0x4d04c8[_0x0a9e('0x34')],_0x4d04c8[_0x0a9e('0x35')]);_0x37f6cc[_0x0a9e('0x38')]=_['intersection'](_0x4d04c8[_0x0a9e('0x34')],qs[_0x0a9e('0x3a')](_0x1a7bce[_0x0a9e('0x35')][_0x0a9e('0x3a')]));_0x37f6cc[_0x0a9e('0x38')]=_0x37f6cc[_0x0a9e('0x38')][_0x0a9e('0x49')]?_0x37f6cc[_0x0a9e('0x38')]:_0x4d04c8['model'];if(_0x1a7bce[_0x0a9e('0x35')]['includeAll']){_0x37f6cc[_0x0a9e('0x44')]=[{'all':!![]}];}_0x37f6cc=_[_0x0a9e('0x4a')]({},_0x37f6cc,_0x1a7bce[_0x0a9e('0x42')]);return db['CmList'][_0x0a9e('0x4b')](_0x37f6cc)[_0x0a9e('0x26')](handleEntityNotFound(_0x11ca30,null))[_0x0a9e('0x26')](respondWithResult(_0x11ca30,null))[_0x0a9e('0x47')](handleError(_0x11ca30,null));};exports[_0x0a9e('0x4c')]=function(_0x37be73,_0x45bf7f){return db['CmList'][_0x0a9e('0x4c')](_0x37be73[_0x0a9e('0x4d')],{})[_0x0a9e('0x26')](function(_0x16f976){var _0x409789=_0x37be73[_0x0a9e('0x4e')][_0x0a9e('0x28')]({'plain':!![]});if(!_0x409789)throw new Error(_0x0a9e('0x4f'));if(_0x409789[_0x0a9e('0x50')]==='user'){var _0xe401a=_0x16f976[_0x0a9e('0x28')]({'plain':!![]});var _0x4f7240='Lists';return db['UserProfileSection'][_0x0a9e('0x4b')]({'where':{'name':_0x4f7240,'userProfileId':_0x409789[_0x0a9e('0x51')]},'raw':!![]})[_0x0a9e('0x26')](function(_0x11545a){if(_0x11545a&&_0x11545a[_0x0a9e('0x52')]===0x0){return db[_0x0a9e('0x29')][_0x0a9e('0x4c')]({'name':_0xe401a[_0x0a9e('0x2c')],'resourceId':_0xe401a['id'],'type':_0x11545a['name'],'sectionId':_0x11545a['id']},{})['then'](function(){return _0x16f976;});}else{return _0x16f976;}})['catch'](function(_0x39d77d){logger[_0x0a9e('0x2a')](_0x0a9e('0x53'),_0x39d77d);throw _0x39d77d;});}return _0x16f976;})['then'](respondWithResult(_0x45bf7f,0xc9))[_0x0a9e('0x47')](handleError(_0x45bf7f,null));};exports[_0x0a9e('0x25')]=function(_0x53d113,_0x5a88da){if(_0x53d113[_0x0a9e('0x4d')]['id']){delete _0x53d113['body']['id'];}return db[_0x0a9e('0x30')]['find']({'where':{'id':_0x53d113[_0x0a9e('0x54')]['id']}})[_0x0a9e('0x26')](handleEntityNotFound(_0x5a88da,null))[_0x0a9e('0x26')](saveUpdates(_0x53d113['body'],null))[_0x0a9e('0x26')](respondWithResult(_0x5a88da,null))[_0x0a9e('0x47')](handleError(_0x5a88da,null));};exports['destroy']=function(_0x50f687,_0x128aa6){return db[_0x0a9e('0x30')]['find']({'where':{'id':_0x50f687[_0x0a9e('0x54')]['id']}})['then'](handleEntityNotFound(_0x128aa6,null))[_0x0a9e('0x26')](removeEntity(_0x128aa6,null))['catch'](handleError(_0x128aa6,null));};exports[_0x0a9e('0x55')]=function(_0x4a6deb,_0x5da27d){return db['CmList'][_0x0a9e('0x55')]()['then'](respondWithResult(_0x5da27d,null))[_0x0a9e('0x47')](handleError(_0x5da27d,null));};exports[_0x0a9e('0x56')]=function(_0x3cfd00,_0x19b4df,_0x232830){if(_0x3cfd00[_0x0a9e('0x4d')]['id']){delete _0x3cfd00[_0x0a9e('0x4d')]['id'];}return db[_0x0a9e('0x30')]['find']({'where':{'id':_0x3cfd00[_0x0a9e('0x54')]['id']}})[_0x0a9e('0x26')](handleEntityNotFound(_0x19b4df,null))[_0x0a9e('0x26')](function(_0x30c491){if(_0x30c491){_0x3cfd00[_0x0a9e('0x4d')][_0x0a9e('0x57')]=_0x30c491['id'];return db['Disposition'][_0x0a9e('0x4c')](_0x3cfd00[_0x0a9e('0x4d')]);}})['then'](respondWithResult(_0x19b4df,null))[_0x0a9e('0x47')](handleError(_0x19b4df,null));};exports['getDispositions']=function(_0x20c668,_0x5ba1f9,_0x4b3c1a){var _0x5674ee={'raw':![],'where':{}};var _0x273cb5={};var _0x49d231={'count':0x0,'rows':[]};return db[_0x0a9e('0x30')][_0x0a9e('0x58')]({'where':{'id':_0x20c668[_0x0a9e('0x54')]['id']}})[_0x0a9e('0x26')](handleEntityNotFound(_0x5ba1f9,null))[_0x0a9e('0x26')](function(_0x26d7db){if(_0x26d7db){_0x273cb5['model']=_[_0x0a9e('0x36')](db['Disposition'][_0x0a9e('0x31')]);_0x273cb5[_0x0a9e('0x35')]=_[_0x0a9e('0x36')](_0x20c668['query']);_0x273cb5[_0x0a9e('0x37')]=_[_0x0a9e('0x39')](_0x273cb5[_0x0a9e('0x34')],_0x273cb5[_0x0a9e('0x35')]);_0x5674ee['attributes']=_[_0x0a9e('0x39')](_0x273cb5[_0x0a9e('0x34')],qs['fields'](_0x20c668[_0x0a9e('0x35')][_0x0a9e('0x3a')]));_0x5674ee[_0x0a9e('0x38')]=_0x5674ee[_0x0a9e('0x38')][_0x0a9e('0x49')]?_0x5674ee['attributes']:_0x273cb5[_0x0a9e('0x34')];if(!_0x20c668[_0x0a9e('0x35')][_0x0a9e('0x3b')]('nolimit')){_0x5674ee[_0x0a9e('0x20')]=qs['limit'](_0x20c668['query'][_0x0a9e('0x20')]);_0x5674ee[_0x0a9e('0x1f')]=qs[_0x0a9e('0x1f')](_0x20c668[_0x0a9e('0x35')][_0x0a9e('0x1f')]);}_0x5674ee[_0x0a9e('0x3c')]=qs[_0x0a9e('0x3d')](_0x20c668[_0x0a9e('0x35')][_0x0a9e('0x3d')]);_0x5674ee[_0x0a9e('0x40')]=qs[_0x0a9e('0x37')](_[_0x0a9e('0x3e')](_0x20c668[_0x0a9e('0x35')],_0x273cb5[_0x0a9e('0x37')]));_0x5674ee[_0x0a9e('0x40')][_0x0a9e('0x57')]=_0x26d7db['id'];if(_0x20c668[_0x0a9e('0x35')][_0x0a9e('0x3f')]){_0x5674ee['where']=_[_0x0a9e('0x4a')](_0x5674ee[_0x0a9e('0x40')],{'$or':_[_0x0a9e('0x2f')](_0x5674ee['attributes'],function(_0x1148a1){var _0x30944e={};_0x30944e[_0x1148a1]={'$like':'%'+_0x20c668['query'][_0x0a9e('0x3f')]+'%'};return _0x30944e;})});}_0x5674ee=_[_0x0a9e('0x4a')]({},_0x5674ee,_0x20c668[_0x0a9e('0x42')]);return db[_0x0a9e('0x59')][_0x0a9e('0x1e')]({'where':_0x5674ee['where']})['then'](function(_0x4a2438){_0x49d231[_0x0a9e('0x1e')]=_0x4a2438;if(_0x20c668[_0x0a9e('0x35')][_0x0a9e('0x43')]){_0x5674ee[_0x0a9e('0x44')]=[{'all':!![]}];}return db[_0x0a9e('0x59')][_0x0a9e('0x45')](_0x5674ee);})[_0x0a9e('0x26')](function(_0x1a0677){_0x49d231['rows']=_0x1a0677;return _0x49d231;});}})[_0x0a9e('0x26')](respondWithFilteredResult(_0x5ba1f9,_0x5674ee))[_0x0a9e('0x47')](handleError(_0x5ba1f9,null));};exports[_0x0a9e('0x5a')]=function(_0x4a4fc7,_0x2bdc44,_0x583b2e){return db[_0x0a9e('0x30')][_0x0a9e('0x4b')]({'where':{'id':_0x4a4fc7['params']['id']}})[_0x0a9e('0x26')](handleEntityNotFound(_0x2bdc44,null))[_0x0a9e('0x26')](function(_0x2cc7a7){if(_0x2cc7a7){return _0x2cc7a7[_0x0a9e('0x5a')](_0x4a4fc7['query'][_0x0a9e('0x5b')]);}})[_0x0a9e('0x26')](respondWithStatusCode(_0x2bdc44,null))[_0x0a9e('0x47')](handleError(_0x2bdc44,null));};exports[_0x0a9e('0x5c')]=function(_0x5b7fc3,_0x109ccb,_0x3d91db){return db[_0x0a9e('0x30')][_0x0a9e('0x4b')]({'where':{'id':_0x5b7fc3['params']['id']}})[_0x0a9e('0x26')](handleEntityNotFound(_0x109ccb,null))[_0x0a9e('0x26')](function(_0x30a4c7){if(_0x30a4c7){var _0xf410e5=[];var _0x332367={'success':[],'errors':[]};return db[_0x0a9e('0x5d')][_0x0a9e('0x55')]()[_0x0a9e('0x26')](function(_0x1a7b03){if(_0x5b7fc3[_0x0a9e('0x4d')][_0x0a9e('0x5e')]&&_[_0x0a9e('0x5f')](_0x5b7fc3[_0x0a9e('0x4d')][_0x0a9e('0x5e')])){if(_0x5b7fc3['body'][_0x0a9e('0x5e')][_0x0a9e('0x49')]){_0x5b7fc3[_0x0a9e('0x4d')]['tags']=_0x5b7fc3[_0x0a9e('0x4d')][_0x0a9e('0x5e')][_0x0a9e('0x60')](';')+';';}else{_0x5b7fc3[_0x0a9e('0x4d')]['tags']=null;}}else{_0x5b7fc3['body'][_0x0a9e('0x5e')]=null;}if(_0x5b7fc3[_0x0a9e('0x4d')]&&_['isArray'](_0x5b7fc3[_0x0a9e('0x4d')])){for(var _0x53a6a1=0x0;_0x53a6a1<_0x5b7fc3[_0x0a9e('0x4d')][_0x0a9e('0x49')];_0x53a6a1+=0x1){_0x5b7fc3['body'][_0x53a6a1][_0x0a9e('0x57')]=_0x5b7fc3[_0x0a9e('0x54')]['id'];_0xf410e5[_0x0a9e('0x61')](_0x5b7fc3[_0x0a9e('0x4d')][_0x53a6a1]);}return BPromise[_0x0a9e('0x62')](_0xf410e5,function(_0x1f42a0){return db[_0x0a9e('0x5d')]['create'](_[_0x0a9e('0x63')](_0x1f42a0,[_0x0a9e('0x5b'),'id'])||{},{'fields':_[_0x0a9e('0x36')](_0x1a7b03),'raw':!![]})[_0x0a9e('0x26')](function(_0x492543){_0x332367[_0x0a9e('0x64')][_0x0a9e('0x61')](_0x492543['dataValues']);})[_0x0a9e('0x47')](function(_0x5b7940){_0x332367[_0x0a9e('0x65')][_0x0a9e('0x61')]({'data':_0x1f42a0,'error':_0x5b7940[_0x0a9e('0x66')]});});})[_0x0a9e('0x26')](function(_0x5af453){return _0x332367;})['catch'](function(_0x353384){return _0x353384;});}else{_0x109ccb[_0x0a9e('0x1c')](0x190)[_0x0a9e('0x1d')]({'message':'Malformed\x20request\x20syntax'});}});}})[_0x0a9e('0x26')](respondWithResult(_0x109ccb,null))[_0x0a9e('0x47')](handleError(_0x109ccb,null));};exports['getContacts']=function(_0x4e46b2,_0xf0a802,_0x56acca){var _0x5ea541;return db['CmList'][_0x0a9e('0x4b')]({'where':{'id':_0x4e46b2[_0x0a9e('0x54')]['id']},'include':[{'model':db[_0x0a9e('0x67')],'as':_0x0a9e('0x68')}]})[_0x0a9e('0x26')](handleEntityNotFound(_0xf0a802,null))[_0x0a9e('0x26')](function(_0x5a8854){if(_0x5a8854){_0x5ea541=_0x5a8854;return db[_0x0a9e('0x5d')]['rawAttributes'];}})[_0x0a9e('0x26')](function(_0x2aabab){if(_0x2aabab){var _0x18ad56={};var _0x4566b0={};_0x4566b0['model']=_[_0x0a9e('0x69')](_[_0x0a9e('0x36')](_0x2aabab),_[_0x0a9e('0x2f')](_0x5ea541['CustomFields'],function(_0xb6e411){return util[_0x0a9e('0x6a')](_0x0a9e('0x6b'),_0xb6e411['id']);}));_0x4566b0[_0x0a9e('0x35')]=_[_0x0a9e('0x36')](_0x4e46b2[_0x0a9e('0x35')]);_0x4566b0[_0x0a9e('0x37')]=_[_0x0a9e('0x39')](_0x4566b0['model'],_0x4566b0[_0x0a9e('0x35')]);_0x18ad56[_0x0a9e('0x38')]=_['intersection'](_0x4566b0[_0x0a9e('0x34')],qs[_0x0a9e('0x3a')](_0x4e46b2[_0x0a9e('0x35')]['fields']));_0x18ad56[_0x0a9e('0x38')]=_0x18ad56['attributes'][_0x0a9e('0x49')]?_0x18ad56[_0x0a9e('0x38')]:_0x4566b0[_0x0a9e('0x34')];if(!_0x4e46b2[_0x0a9e('0x35')][_0x0a9e('0x3b')](_0x0a9e('0x6c'))){_0x18ad56[_0x0a9e('0x20')]=qs[_0x0a9e('0x20')](_0x4e46b2['query'][_0x0a9e('0x20')]);_0x18ad56[_0x0a9e('0x1f')]=qs[_0x0a9e('0x1f')](_0x4e46b2[_0x0a9e('0x35')][_0x0a9e('0x1f')]);}_0x18ad56[_0x0a9e('0x3c')]=qs[_0x0a9e('0x3d')](_0x4e46b2[_0x0a9e('0x35')][_0x0a9e('0x3d')]);_0x18ad56[_0x0a9e('0x40')]=qs[_0x0a9e('0x37')](_[_0x0a9e('0x3e')](_0x4e46b2[_0x0a9e('0x35')],_0x4566b0['filters']));_0x18ad56[_0x0a9e('0x6d')]=!![];if(_0x4e46b2[_0x0a9e('0x35')][_0x0a9e('0x3f')]){_0x18ad56[_0x0a9e('0x40')]=_[_0x0a9e('0x4a')](_0x18ad56['where'],{'$or':_[_0x0a9e('0x2f')](_0x18ad56[_0x0a9e('0x38')],function(_0x5ce99d){var _0x23b447={};_0x23b447[_0x5ce99d]={'$like':'%'+_0x4e46b2['query'][_0x0a9e('0x3f')]+'%'};return _0x23b447;})});}_0x18ad56=_[_0x0a9e('0x4a')]({},_0x18ad56,_0x4e46b2[_0x0a9e('0x42')]);return _0x5ea541[_0x0a9e('0x6e')](_0x18ad56);}})['then'](respondWithResult(_0xf0a802,null))[_0x0a9e('0x47')](handleError(_0xf0a802,null));};exports['getContactsCsv']=function(_0x2ec396,_0x3d0a77,_0x5e5b89){var _0x231c6a;return db[_0x0a9e('0x30')][_0x0a9e('0x4b')]({'where':{'id':_0x2ec396['params']['id']},'include':[{'model':db['CmCustomField'],'as':_0x0a9e('0x68')}]})[_0x0a9e('0x26')](handleEntityNotFound(_0x3d0a77,null))[_0x0a9e('0x26')](function(_0x413190){if(_0x413190){_0x231c6a=_0x413190;return db[_0x0a9e('0x5d')][_0x0a9e('0x31')];}})[_0x0a9e('0x26')](function(_0x3c75b9){if(_0x3c75b9){var _0x3f8124={};var _0x586510={};_0x586510[_0x0a9e('0x34')]=_['concat'](_[_0x0a9e('0x36')](_0x3c75b9),_[_0x0a9e('0x2f')](_0x231c6a[_0x0a9e('0x68')],function(_0x28ce92){return util[_0x0a9e('0x6a')]('cf_%d',_0x28ce92['id']);}));_0x586510[_0x0a9e('0x35')]=_[_0x0a9e('0x36')](_0x2ec396[_0x0a9e('0x35')]);_0x586510[_0x0a9e('0x37')]=_[_0x0a9e('0x39')](_0x586510['model'],_0x586510['query']);_0x3f8124[_0x0a9e('0x38')]=_['intersection'](_0x586510[_0x0a9e('0x34')],qs[_0x0a9e('0x3a')](_0x2ec396[_0x0a9e('0x35')][_0x0a9e('0x3a')]));_0x3f8124[_0x0a9e('0x38')]=_0x3f8124[_0x0a9e('0x38')]['length']?_0x3f8124['attributes']:_0x586510[_0x0a9e('0x34')];if(!_0x2ec396['query'][_0x0a9e('0x3b')]('nolimit')){_0x3f8124[_0x0a9e('0x20')]=qs['limit'](_0x2ec396['query'][_0x0a9e('0x20')]);_0x3f8124[_0x0a9e('0x1f')]=qs['offset'](_0x2ec396[_0x0a9e('0x35')][_0x0a9e('0x1f')]);}_0x3f8124[_0x0a9e('0x3c')]=qs[_0x0a9e('0x3d')](_0x2ec396[_0x0a9e('0x35')]['sort']);_0x3f8124['where']=qs[_0x0a9e('0x37')](_[_0x0a9e('0x3e')](_0x2ec396[_0x0a9e('0x35')],_0x586510[_0x0a9e('0x37')]));_0x3f8124[_0x0a9e('0x6d')]=!![];if(_0x2ec396['query'][_0x0a9e('0x3f')]){_0x3f8124[_0x0a9e('0x40')]=_['merge'](_0x3f8124[_0x0a9e('0x40')],{'$or':_[_0x0a9e('0x2f')](_0x3f8124[_0x0a9e('0x38')],function(_0x2427d5){var _0x23b25b={};_0x23b25b[_0x2427d5]={'$like':'%'+_0x2ec396[_0x0a9e('0x35')][_0x0a9e('0x3f')]+'%'};return _0x23b25b;})});}_0x3f8124=_[_0x0a9e('0x4a')]({},_0x3f8124,_0x2ec396[_0x0a9e('0x42')]);return _0x231c6a[_0x0a9e('0x6e')](_0x3f8124);}})['then'](function(_0x1065a7){if(!_[_0x0a9e('0x6f')](_0x1065a7)){var _0x2ada60=toCsv(_0x1065a7);var _0x1c4232=Date[_0x0a9e('0x70')]();fs['writeFileSync'](util['format'](_0x0a9e('0x71'),_0x231c6a['id'],_0x1c4232),_0x2ada60);_0x3d0a77[_0x0a9e('0x72')](_0x0a9e('0x73'),_0x0a9e('0x74')+util[_0x0a9e('0x6a')]('list_%d_%s.csv',_0x231c6a['id'],_0x1c4232));_0x3d0a77[_0x0a9e('0x72')](_0x0a9e('0x75'),_0x0a9e('0x76'));return _0x3d0a77['download'](util[_0x0a9e('0x6a')]('/tmp/list_%d_%s.csv',_0x231c6a['id'],_0x1c4232));}else{return _0x3d0a77[_0x0a9e('0x1a')](0xcc);}})['catch'](handleError(_0x3d0a77,null));};exports[_0x0a9e('0x77')]=function(_0x42b833,_0xe339b1,_0x5c500c){var _0xc9529d;delete _0x42b833['body']['id'];return db[_0x0a9e('0x30')][_0x0a9e('0x58')]({'where':{'id':_0x42b833[_0x0a9e('0x54')]['id']}})[_0x0a9e('0x26')](handleEntityNotFound(_0xe339b1,null))[_0x0a9e('0x26')](function(_0x1bee04){if(_0x1bee04){return db[_0x0a9e('0x78')][_0x0a9e('0x79')](function(_0x2aaf07){return db[_0x0a9e('0x67')][_0x0a9e('0x4c')](_0x42b833[_0x0a9e('0x4d')],{'transaction':_0x2aaf07})[_0x0a9e('0x26')](function(_0x399def){_0xc9529d=_0x399def;return _0x1bee04[_0x0a9e('0x7a')](_0x399def,{'transaction':_0x2aaf07});})[_0x0a9e('0x26')](function(){var _0x5b93dd={'type':db['Sequelize'][_0x0a9e('0x7b')],'transaction':_0x2aaf07};switch(_0x42b833['body'][_0x0a9e('0x33')]){case _0x0a9e('0x7c'):_0x5b93dd['type']=db[_0x0a9e('0x7d')][_0x0a9e('0x7b')];break;case _0x0a9e('0x7e'):_0x5b93dd[_0x0a9e('0x33')]=db['Sequelize'][_0x0a9e('0x7f')];break;case _0x0a9e('0x80'):_0x5b93dd[_0x0a9e('0x33')]=db[_0x0a9e('0x7d')]['BOOLEAN'];_0x5b93dd[_0x0a9e('0x81')]=![];break;default:}return db[_0x0a9e('0x78')][_0x0a9e('0x82')]['addColumn'](_0x0a9e('0x83'),util[_0x0a9e('0x6a')](_0x0a9e('0x84'),_0xc9529d['id']),_0x5b93dd);})['then'](function(){return _0xc9529d;});});}})[_0x0a9e('0x26')](respondWithResult(_0xe339b1,null))[_0x0a9e('0x47')](handleError(_0xe339b1,null));};exports[_0x0a9e('0x85')]=function(_0x1a7f58,_0x2394d3,_0x555780){var _0x3211d2={};var _0x289e65={};var _0x4795ae;var _0x3bab3e;return db[_0x0a9e('0x30')][_0x0a9e('0x58')]({'where':{'id':_0x1a7f58['params']['id']}})['then'](handleEntityNotFound(_0x2394d3,null))['then'](function(_0x1015aa){if(_0x1015aa){_0x4795ae=_0x1015aa;_0x289e65[_0x0a9e('0x34')]=_['keys'](db[_0x0a9e('0x67')][_0x0a9e('0x31')]);_0x289e65[_0x0a9e('0x35')]=_['keys'](_0x1a7f58[_0x0a9e('0x35')]);_0x289e65[_0x0a9e('0x37')]=_[_0x0a9e('0x39')](_0x289e65[_0x0a9e('0x34')],_0x289e65[_0x0a9e('0x35')]);_0x3211d2[_0x0a9e('0x38')]=_[_0x0a9e('0x39')](_0x289e65[_0x0a9e('0x34')],qs[_0x0a9e('0x3a')](_0x1a7f58['query'][_0x0a9e('0x3a')]));_0x3211d2['attributes']=_0x3211d2[_0x0a9e('0x38')][_0x0a9e('0x49')]?_0x3211d2[_0x0a9e('0x38')]:_0x289e65[_0x0a9e('0x34')];_0x3211d2[_0x0a9e('0x3c')]=qs[_0x0a9e('0x3d')](_0x1a7f58['query'][_0x0a9e('0x3d')]);_0x3211d2[_0x0a9e('0x40')]=qs[_0x0a9e('0x37')](_[_0x0a9e('0x3e')](_0x1a7f58['query'],_0x289e65[_0x0a9e('0x37')]));_0x3211d2[_0x0a9e('0x40')]=_[_0x0a9e('0x4a')](_0x3211d2[_0x0a9e('0x40')],{'$or':[{'ListId':_0x1015aa['id']},{'ListId':null}]});if(_0x1a7f58[_0x0a9e('0x35')][_0x0a9e('0x3f')]){_0x3211d2[_0x0a9e('0x40')]=_[_0x0a9e('0x4a')](_0x3211d2[_0x0a9e('0x40')],{'$or':_[_0x0a9e('0x2f')](_0x3211d2['attributes'],function(_0x2272bc){var _0x88b25f={};_0x88b25f[_0x2272bc]={'$like':'%'+_0x1a7f58[_0x0a9e('0x35')][_0x0a9e('0x3f')]+'%'};return _0x88b25f;})});}_0x3211d2=_[_0x0a9e('0x4a')]({},_0x3211d2,_0x1a7f58[_0x0a9e('0x42')]);return db[_0x0a9e('0x67')][_0x0a9e('0x86')](_0x3211d2);}})['then'](respondWithResult(_0x2394d3,null))[_0x0a9e('0x47')](handleError(_0x2394d3,null));};exports[_0x0a9e('0x87')]=function(_0x1a9ef1,_0x5c65fc,_0x1402c7){return db[_0x0a9e('0x30')][_0x0a9e('0x4b')]({'where':{'id':_0x1a9ef1[_0x0a9e('0x54')]['id']}})[_0x0a9e('0x26')](handleEntityNotFound(_0x5c65fc,null))[_0x0a9e('0x26')](function(_0x424f1b){if(_0x424f1b){return _0x424f1b[_0x0a9e('0x87')](_0x1a9ef1[_0x0a9e('0x4d')][_0x0a9e('0x5b')],_['omit'](_0x1a9ef1[_0x0a9e('0x4d')],[_0x0a9e('0x5b'),'id'])||{})[_0x0a9e('0x88')](function(_0x3db98f){for(var _0x2b624e=0x0;_0x2b624e<_0x1a9ef1[_0x0a9e('0x4d')]['ids'][_0x0a9e('0x49')];_0x2b624e+=0x1){socket['emit']('userCmList:save',{'UserId':_0x1a9ef1['body'][_0x0a9e('0x5b')][_0x2b624e],'CmListId':_0x1a9ef1[_0x0a9e('0x54')]['id']});}return _0x3db98f;});}})[_0x0a9e('0x26')](respondWithResult(_0x5c65fc,null))[_0x0a9e('0x47')](handleError(_0x5c65fc,null));};exports['removeAgents']=function(_0x4156a5,_0x309fa9,_0x3ddbc7){return db[_0x0a9e('0x30')][_0x0a9e('0x4b')]({'where':{'id':_0x4156a5['params']['id']}})['then'](handleEntityNotFound(_0x309fa9,null))[_0x0a9e('0x26')](function(_0x33bcb2){if(_0x33bcb2){return _0x33bcb2[_0x0a9e('0x89')](_0x4156a5['query'][_0x0a9e('0x5b')])[_0x0a9e('0x26')](function(){if(_[_0x0a9e('0x5f')](_0x4156a5['query'][_0x0a9e('0x5b')])){for(var _0x2bf85d=0x0;_0x2bf85d<_0x4156a5[_0x0a9e('0x35')]['ids'][_0x0a9e('0x49')];_0x2bf85d+=0x1){socket[_0x0a9e('0x8a')](_0x0a9e('0x8b'),{'UserId':Number(_0x4156a5['query']['ids'][_0x2bf85d]),'CmListId':Number(_0x4156a5['params']['id'])});}}else{socket[_0x0a9e('0x8a')](_0x0a9e('0x8b'),{'UserId':Number(_0x4156a5[_0x0a9e('0x35')][_0x0a9e('0x5b')]),'CmListId':Number(_0x4156a5['params']['id'])});}});}})[_0x0a9e('0x26')](respondWithStatusCode(_0x309fa9,null))['catch'](handleError(_0x309fa9,null));};exports[_0x0a9e('0x8c')]=function(_0x2ff2ab,_0x242f23,_0x57f673){var _0x33b4b3={};var _0x33a26c={};var _0xb8a476;var _0x580dd6;return db[_0x0a9e('0x30')]['findOne']({'where':{'id':_0x2ff2ab[_0x0a9e('0x54')]['id']}})['then'](handleEntityNotFound(_0x242f23,null))[_0x0a9e('0x26')](function(_0x57b7d4){if(_0x57b7d4){_0xb8a476=_0x57b7d4;_0x33a26c[_0x0a9e('0x34')]=_[_0x0a9e('0x36')](db[_0x0a9e('0x8d')][_0x0a9e('0x31')]);_0x33a26c[_0x0a9e('0x35')]=_[_0x0a9e('0x36')](_0x2ff2ab[_0x0a9e('0x35')]);_0x33a26c['filters']=_[_0x0a9e('0x39')](_0x33a26c[_0x0a9e('0x34')],_0x33a26c['query']);_0x33b4b3[_0x0a9e('0x38')]=_[_0x0a9e('0x39')](_0x33a26c['model'],qs[_0x0a9e('0x3a')](_0x2ff2ab[_0x0a9e('0x35')][_0x0a9e('0x3a')]));_0x33b4b3['attributes']=_0x33b4b3[_0x0a9e('0x38')][_0x0a9e('0x49')]?_0x33b4b3[_0x0a9e('0x38')]:_0x33a26c[_0x0a9e('0x34')];_0x33b4b3[_0x0a9e('0x3c')]=qs[_0x0a9e('0x3d')](_0x2ff2ab[_0x0a9e('0x35')][_0x0a9e('0x3d')]);_0x33b4b3[_0x0a9e('0x40')]=qs[_0x0a9e('0x37')](_['pick'](_0x2ff2ab[_0x0a9e('0x35')],_0x33a26c['filters']));if(_0x2ff2ab[_0x0a9e('0x35')][_0x0a9e('0x3f')]){_0x33b4b3[_0x0a9e('0x40')]=_[_0x0a9e('0x4a')](_0x33b4b3[_0x0a9e('0x40')],{'$or':_[_0x0a9e('0x2f')](_0x33b4b3['attributes'],function(_0x119708){var _0x469035={};_0x469035[_0x119708]={'$like':'%'+_0x2ff2ab[_0x0a9e('0x35')]['filter']+'%'};return _0x469035;})});}_0x33b4b3=_[_0x0a9e('0x4a')]({},_0x33b4b3,_0x2ff2ab[_0x0a9e('0x42')]);return _0xb8a476[_0x0a9e('0x8c')](_0x33b4b3);}})[_0x0a9e('0x26')](function(_0x31e1e0){if(_0x31e1e0){_0x580dd6=_0x31e1e0[_0x0a9e('0x49')];if(!_0x2ff2ab[_0x0a9e('0x35')]['hasOwnProperty'](_0x0a9e('0x6c'))){_0x33b4b3[_0x0a9e('0x20')]=qs[_0x0a9e('0x20')](_0x2ff2ab[_0x0a9e('0x35')][_0x0a9e('0x20')]);_0x33b4b3[_0x0a9e('0x1f')]=qs[_0x0a9e('0x1f')](_0x2ff2ab['query']['offset']);}return _0xb8a476[_0x0a9e('0x8c')](_0x33b4b3);}})[_0x0a9e('0x26')](function(_0x1f4929){if(_0x1f4929){return _0x1f4929?{'count':_0x580dd6,'rows':_0x1f4929}:null;}})[_0x0a9e('0x26')](respondWithResult(_0x242f23,null))[_0x0a9e('0x47')](handleError(_0x242f23,null));}; \ No newline at end of file +var _0x34e8=['isArray','userCmList:remove','getAgents','User','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','defaults','redis','socket.io-emitter','./cmList.socket','register','status','json','count','offset','limit','set','Content-Range','reject','save','update','destroy','then','get','end','error','stack','name','send','index','CmList','fieldName','type','key','model','map','query','keys','intersection','attributes','fields','length','hasOwnProperty','sort','where','filters','filter','merge','options','includeAll','include','findAll','show','params','rawAttributes','find','catch','create','body','user','role','UserProfileSection','userProfileId','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','addDisposition','ListId','Disposition','getDispositions','findOne','nolimit','order','pick','rows','removeDispositions','ids','CmContact','tags','push','each','success','dataValues','message','CustomFields','concat','format','cf_%d','raw','getContactsCsv','CmCustomField','getContacts','isEmpty','now','/tmp/list_%d_%s.csv','setHeader','Content-disposition','attachment;\x20filename=','list_%d_%s.csv','Content-type','text/csv','download','sequelize','transaction','Sequelize','TEXT','text','number','switch','defaultValue','addColumn','cm_contacts','cf_%s','getCustomFields','addAgents','omit','spread','emit','userCmList:save','removeAgents'];(function(_0x41f6f7,_0x5adab6){var _0x3b84c1=function(_0x1e6658){while(--_0x1e6658){_0x41f6f7['push'](_0x41f6f7['shift']());}};_0x3b84c1(++_0x5adab6);}(_0x34e8,0x12c));var _0x834e=function(_0x506dc0,_0x52772f){_0x506dc0=_0x506dc0-0x0;var _0x5abac0=_0x34e8[_0x506dc0];return _0x5abac0;};'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'];config['redis']=_[_0x834e('0x1d')](config[_0x834e('0x1e')],{'host':'localhost','port':0x18eb});var socket=require(_0x834e('0x1f'))(new Redis(config[_0x834e('0x1e')]));require(_0x834e('0x20'))[_0x834e('0x21')](socket);function respondWithStatusCode(_0x50e860,_0x43156c){_0x43156c=_0x43156c||0xcc;return function(_0x302cbd){if(_0x302cbd){return _0x50e860['sendStatus'](_0x43156c);}return _0x50e860[_0x834e('0x22')](_0x43156c)['end']();};}function respondWithResult(_0x38a8cd,_0x36d443){_0x36d443=_0x36d443||0xc8;return function(_0x478afe){if(_0x478afe){return _0x38a8cd[_0x834e('0x22')](_0x36d443)[_0x834e('0x23')](_0x478afe);}};}function respondWithFilteredResult(_0x370fb5,_0x50b3f6){return function(_0x283e56){if(_0x283e56){var _0x211e9a=_0x283e56[_0x834e('0x24')],_0x34e41a=_0x50b3f6[_0x834e('0x25')],_0xb993a1=_0x50b3f6['offset']+_0x50b3f6[_0x834e('0x26')],_0x237947;if(_0xb993a1>=_0x211e9a){_0xb993a1=_0x211e9a;_0x237947=0xc8;}else{_0x237947=0xce;}_0x370fb5[_0x834e('0x22')](_0x237947);return _0x370fb5[_0x834e('0x27')](_0x834e('0x28'),_0x34e41a+'-'+_0xb993a1+'/'+_0x211e9a)['json'](_0x283e56);}return null;};}function patchUpdates(_0x45a630){return function(_0x62f8f1){try{jsonpatch['apply'](_0x62f8f1,_0x45a630,!![]);}catch(_0x1b4bdf){return BPromise[_0x834e('0x29')](_0x1b4bdf);}return _0x62f8f1[_0x834e('0x2a')]();};}function saveUpdates(_0x5c55ca,_0x4e3f48){return function(_0x231619){if(_0x231619){return _0x231619[_0x834e('0x2b')](_0x5c55ca)['then'](function(_0x25ee1d){return _0x25ee1d;});}return null;};}function removeEntity(_0x1dc1e0,_0x58f4fd){return function(_0x3bc4f7){if(_0x3bc4f7){return _0x3bc4f7[_0x834e('0x2c')]()[_0x834e('0x2d')](function(){var _0x561cd2=_0x3bc4f7[_0x834e('0x2e')]({'plain':!![]});var _0x3e310f='Lists';return db['UserProfileResource'][_0x834e('0x2c')]({'where':{'type':_0x3e310f,'resourceId':_0x561cd2['id']}})['then'](function(){return _0x3bc4f7;});})[_0x834e('0x2d')](function(){_0x1dc1e0[_0x834e('0x22')](0xcc)[_0x834e('0x2f')]();});}};}function handleEntityNotFound(_0x2cc2eb,_0x3cd928){return function(_0x130cc5){if(!_0x130cc5){_0x2cc2eb['sendStatus'](0x194);}return _0x130cc5;};}function handleError(_0x510780,_0x4dc64a){_0x4dc64a=_0x4dc64a||0x1f4;return function(_0x58c1d7){logger[_0x834e('0x30')](_0x58c1d7[_0x834e('0x31')]);if(_0x58c1d7[_0x834e('0x32')]){delete _0x58c1d7['name'];}_0x510780[_0x834e('0x22')](_0x4dc64a)[_0x834e('0x33')](_0x58c1d7);};}exports[_0x834e('0x34')]=function(_0x1e026a,_0x4551f5){var _0x390119={},_0x3d149d={},_0xfaf716={'count':0x0,'rows':[]};var _0x278db3=_['map'](db[_0x834e('0x35')]['rawAttributes'],function(_0x2c75c2){return{'name':_0x2c75c2[_0x834e('0x36')],'type':_0x2c75c2[_0x834e('0x37')][_0x834e('0x38')]};});_0x3d149d[_0x834e('0x39')]=_[_0x834e('0x3a')](_0x278db3,_0x834e('0x32'));_0x3d149d[_0x834e('0x3b')]=_[_0x834e('0x3c')](_0x1e026a[_0x834e('0x3b')]);_0x3d149d['filters']=_[_0x834e('0x3d')](_0x3d149d[_0x834e('0x39')],_0x3d149d[_0x834e('0x3b')]);_0x390119[_0x834e('0x3e')]=_['intersection'](_0x3d149d[_0x834e('0x39')],qs[_0x834e('0x3f')](_0x1e026a['query']['fields']));_0x390119['attributes']=_0x390119[_0x834e('0x3e')][_0x834e('0x40')]?_0x390119[_0x834e('0x3e')]:_0x3d149d[_0x834e('0x39')];if(!_0x1e026a[_0x834e('0x3b')][_0x834e('0x41')]('nolimit')){_0x390119[_0x834e('0x26')]=qs['limit'](_0x1e026a[_0x834e('0x3b')][_0x834e('0x26')]);_0x390119['offset']=qs[_0x834e('0x25')](_0x1e026a[_0x834e('0x3b')]['offset']);}_0x390119['order']=qs[_0x834e('0x42')](_0x1e026a[_0x834e('0x3b')][_0x834e('0x42')]);_0x390119[_0x834e('0x43')]=qs[_0x834e('0x44')](_['pick'](_0x1e026a[_0x834e('0x3b')],_0x3d149d['filters']));if(_0x1e026a['query'][_0x834e('0x45')]){_0x390119['where']=_[_0x834e('0x46')](_0x390119[_0x834e('0x43')],{'$or':_[_0x834e('0x3a')](_0x278db3,function(_0x3c59af){if(_0x3c59af[_0x834e('0x37')]!=='VIRTUAL'){var _0x207523={};_0x207523[_0x3c59af[_0x834e('0x32')]]={'$like':'%'+_0x1e026a[_0x834e('0x3b')]['filter']+'%'};return _0x207523;}})});}_0x390119=_[_0x834e('0x46')]({},_0x390119,_0x1e026a[_0x834e('0x47')]);var _0x57b89a={'where':_0x390119[_0x834e('0x43')]};return db['CmList'][_0x834e('0x24')](_0x57b89a)[_0x834e('0x2d')](function(_0x4a18bb){_0xfaf716['count']=_0x4a18bb;if(_0x1e026a[_0x834e('0x3b')][_0x834e('0x48')]){_0x390119[_0x834e('0x49')]=[{'all':!![]}];}return db[_0x834e('0x35')][_0x834e('0x4a')](_0x390119);})[_0x834e('0x2d')](function(_0x195204){_0xfaf716['rows']=_0x195204;return _0xfaf716;})[_0x834e('0x2d')](respondWithFilteredResult(_0x4551f5,_0x390119))['catch'](handleError(_0x4551f5,null));};exports[_0x834e('0x4b')]=function(_0x540685,_0x1df5b0){var _0x5a5807={'raw':![],'where':{'id':_0x540685[_0x834e('0x4c')]['id']}},_0x361f60={};_0x361f60['model']=_[_0x834e('0x3c')](db[_0x834e('0x35')][_0x834e('0x4d')]);_0x361f60[_0x834e('0x3b')]=_[_0x834e('0x3c')](_0x540685[_0x834e('0x3b')]);_0x361f60[_0x834e('0x44')]=_[_0x834e('0x3d')](_0x361f60[_0x834e('0x39')],_0x361f60[_0x834e('0x3b')]);_0x5a5807['attributes']=_[_0x834e('0x3d')](_0x361f60[_0x834e('0x39')],qs['fields'](_0x540685[_0x834e('0x3b')][_0x834e('0x3f')]));_0x5a5807[_0x834e('0x3e')]=_0x5a5807[_0x834e('0x3e')][_0x834e('0x40')]?_0x5a5807[_0x834e('0x3e')]:_0x361f60['model'];if(_0x540685['query'][_0x834e('0x48')]){_0x5a5807[_0x834e('0x49')]=[{'all':!![]}];}_0x5a5807=_[_0x834e('0x46')]({},_0x5a5807,_0x540685[_0x834e('0x47')]);return db[_0x834e('0x35')][_0x834e('0x4e')](_0x5a5807)[_0x834e('0x2d')](handleEntityNotFound(_0x1df5b0,null))[_0x834e('0x2d')](respondWithResult(_0x1df5b0,null))[_0x834e('0x4f')](handleError(_0x1df5b0,null));};exports[_0x834e('0x50')]=function(_0xf02f0d,_0x385435){return db[_0x834e('0x35')][_0x834e('0x50')](_0xf02f0d[_0x834e('0x51')],{})[_0x834e('0x2d')](function(_0x3df078){var _0x32b8f7=_0xf02f0d[_0x834e('0x52')][_0x834e('0x2e')]({'plain':!![]});if(!_0x32b8f7)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x32b8f7[_0x834e('0x53')]===_0x834e('0x52')){var _0x4e73e0=_0x3df078[_0x834e('0x2e')]({'plain':!![]});var _0x3b0988='Lists';return db[_0x834e('0x54')][_0x834e('0x4e')]({'where':{'name':_0x3b0988,'userProfileId':_0x32b8f7[_0x834e('0x55')]},'raw':!![]})[_0x834e('0x2d')](function(_0x4288e4){if(_0x4288e4&&_0x4288e4[_0x834e('0x56')]===0x0){return db[_0x834e('0x57')]['create']({'name':_0x4e73e0[_0x834e('0x32')],'resourceId':_0x4e73e0['id'],'type':_0x4288e4[_0x834e('0x32')],'sectionId':_0x4288e4['id']},{})[_0x834e('0x2d')](function(){return _0x3df078;});}else{return _0x3df078;}})[_0x834e('0x4f')](function(_0x86ad2b){logger[_0x834e('0x30')](_0x834e('0x58'),_0x86ad2b);throw _0x86ad2b;});}return _0x3df078;})[_0x834e('0x2d')](respondWithResult(_0x385435,0xc9))['catch'](handleError(_0x385435,null));};exports[_0x834e('0x2b')]=function(_0x4dc104,_0x2f4bde){if(_0x4dc104['body']['id']){delete _0x4dc104[_0x834e('0x51')]['id'];}return db['CmList']['find']({'where':{'id':_0x4dc104[_0x834e('0x4c')]['id']}})[_0x834e('0x2d')](handleEntityNotFound(_0x2f4bde,null))['then'](saveUpdates(_0x4dc104['body'],null))[_0x834e('0x2d')](respondWithResult(_0x2f4bde,null))[_0x834e('0x4f')](handleError(_0x2f4bde,null));};exports[_0x834e('0x2c')]=function(_0x387365,_0x21c417){return db[_0x834e('0x35')][_0x834e('0x4e')]({'where':{'id':_0x387365[_0x834e('0x4c')]['id']}})['then'](handleEntityNotFound(_0x21c417,null))[_0x834e('0x2d')](removeEntity(_0x21c417,null))[_0x834e('0x4f')](handleError(_0x21c417,null));};exports['describe']=function(_0x281342,_0x4e2b22){return db[_0x834e('0x35')][_0x834e('0x59')]()['then'](respondWithResult(_0x4e2b22,null))[_0x834e('0x4f')](handleError(_0x4e2b22,null));};exports[_0x834e('0x5a')]=function(_0x2de29a,_0x25f720,_0x5a2924){if(_0x2de29a[_0x834e('0x51')]['id']){delete _0x2de29a[_0x834e('0x51')]['id'];}return db[_0x834e('0x35')]['find']({'where':{'id':_0x2de29a[_0x834e('0x4c')]['id']}})[_0x834e('0x2d')](handleEntityNotFound(_0x25f720,null))[_0x834e('0x2d')](function(_0x1a0cd0){if(_0x1a0cd0){_0x2de29a[_0x834e('0x51')][_0x834e('0x5b')]=_0x1a0cd0['id'];return db[_0x834e('0x5c')][_0x834e('0x50')](_0x2de29a[_0x834e('0x51')]);}})[_0x834e('0x2d')](respondWithResult(_0x25f720,null))[_0x834e('0x4f')](handleError(_0x25f720,null));};exports[_0x834e('0x5d')]=function(_0x1b7045,_0x1659c8,_0x460a7a){var _0x17b8e3={'raw':![],'where':{}};var _0x297cce={};var _0x14ed83={'count':0x0,'rows':[]};return db[_0x834e('0x35')][_0x834e('0x5e')]({'where':{'id':_0x1b7045[_0x834e('0x4c')]['id']}})[_0x834e('0x2d')](handleEntityNotFound(_0x1659c8,null))['then'](function(_0x2145cf){if(_0x2145cf){_0x297cce[_0x834e('0x39')]=_[_0x834e('0x3c')](db[_0x834e('0x5c')]['rawAttributes']);_0x297cce[_0x834e('0x3b')]=_['keys'](_0x1b7045['query']);_0x297cce[_0x834e('0x44')]=_[_0x834e('0x3d')](_0x297cce[_0x834e('0x39')],_0x297cce[_0x834e('0x3b')]);_0x17b8e3[_0x834e('0x3e')]=_[_0x834e('0x3d')](_0x297cce[_0x834e('0x39')],qs[_0x834e('0x3f')](_0x1b7045['query'][_0x834e('0x3f')]));_0x17b8e3['attributes']=_0x17b8e3[_0x834e('0x3e')][_0x834e('0x40')]?_0x17b8e3['attributes']:_0x297cce['model'];if(!_0x1b7045[_0x834e('0x3b')][_0x834e('0x41')](_0x834e('0x5f'))){_0x17b8e3[_0x834e('0x26')]=qs[_0x834e('0x26')](_0x1b7045['query'][_0x834e('0x26')]);_0x17b8e3[_0x834e('0x25')]=qs[_0x834e('0x25')](_0x1b7045[_0x834e('0x3b')][_0x834e('0x25')]);}_0x17b8e3[_0x834e('0x60')]=qs[_0x834e('0x42')](_0x1b7045[_0x834e('0x3b')][_0x834e('0x42')]);_0x17b8e3[_0x834e('0x43')]=qs['filters'](_[_0x834e('0x61')](_0x1b7045[_0x834e('0x3b')],_0x297cce[_0x834e('0x44')]));_0x17b8e3[_0x834e('0x43')]['ListId']=_0x2145cf['id'];if(_0x1b7045[_0x834e('0x3b')]['filter']){_0x17b8e3['where']=_['merge'](_0x17b8e3[_0x834e('0x43')],{'$or':_[_0x834e('0x3a')](_0x17b8e3['attributes'],function(_0x2645df){var _0x1b200d={};_0x1b200d[_0x2645df]={'$like':'%'+_0x1b7045['query'][_0x834e('0x45')]+'%'};return _0x1b200d;})});}_0x17b8e3=_[_0x834e('0x46')]({},_0x17b8e3,_0x1b7045['options']);return db['Disposition'][_0x834e('0x24')]({'where':_0x17b8e3[_0x834e('0x43')]})[_0x834e('0x2d')](function(_0x44c909){_0x14ed83[_0x834e('0x24')]=_0x44c909;if(_0x1b7045['query'][_0x834e('0x48')]){_0x17b8e3['include']=[{'all':!![]}];}return db[_0x834e('0x5c')][_0x834e('0x4a')](_0x17b8e3);})[_0x834e('0x2d')](function(_0x5afb41){_0x14ed83[_0x834e('0x62')]=_0x5afb41;return _0x14ed83;});}})[_0x834e('0x2d')](respondWithFilteredResult(_0x1659c8,_0x17b8e3))['catch'](handleError(_0x1659c8,null));};exports[_0x834e('0x63')]=function(_0x3c643f,_0xb4e130,_0x50d0a3){return db[_0x834e('0x35')][_0x834e('0x4e')]({'where':{'id':_0x3c643f[_0x834e('0x4c')]['id']}})[_0x834e('0x2d')](handleEntityNotFound(_0xb4e130,null))[_0x834e('0x2d')](function(_0x29bfd7){if(_0x29bfd7){return _0x29bfd7[_0x834e('0x63')](_0x3c643f[_0x834e('0x3b')][_0x834e('0x64')]);}})[_0x834e('0x2d')](respondWithStatusCode(_0xb4e130,null))['catch'](handleError(_0xb4e130,null));};exports['addContacts']=function(_0x4e466e,_0x36ede9,_0x1135a5){return db[_0x834e('0x35')][_0x834e('0x4e')]({'where':{'id':_0x4e466e[_0x834e('0x4c')]['id']}})['then'](handleEntityNotFound(_0x36ede9,null))['then'](function(_0x4520fc){if(_0x4520fc){var _0x1ad428=[];var _0x23ad7c={'success':[],'errors':[]};return db[_0x834e('0x65')][_0x834e('0x59')]()['then'](function(_0x2df0d5){if(_0x4e466e[_0x834e('0x51')][_0x834e('0x66')]&&_['isArray'](_0x4e466e[_0x834e('0x51')][_0x834e('0x66')])){if(_0x4e466e[_0x834e('0x51')][_0x834e('0x66')][_0x834e('0x40')]){_0x4e466e['body']['tags']=_0x4e466e[_0x834e('0x51')][_0x834e('0x66')]['join'](';')+';';}else{_0x4e466e[_0x834e('0x51')]['tags']=null;}}else{_0x4e466e[_0x834e('0x51')][_0x834e('0x66')]=null;}if(_0x4e466e[_0x834e('0x51')]&&_['isArray'](_0x4e466e[_0x834e('0x51')])){for(var _0x49e721=0x0;_0x49e721<_0x4e466e['body']['length'];_0x49e721+=0x1){_0x4e466e[_0x834e('0x51')][_0x49e721][_0x834e('0x5b')]=_0x4e466e[_0x834e('0x4c')]['id'];_0x1ad428[_0x834e('0x67')](_0x4e466e[_0x834e('0x51')][_0x49e721]);}return BPromise[_0x834e('0x68')](_0x1ad428,function(_0x3aa388){return db[_0x834e('0x65')][_0x834e('0x50')](_['omit'](_0x3aa388,[_0x834e('0x64'),'id'])||{},{'fields':_['keys'](_0x2df0d5),'raw':!![]})[_0x834e('0x2d')](function(_0x97c1a6){_0x23ad7c[_0x834e('0x69')][_0x834e('0x67')](_0x97c1a6[_0x834e('0x6a')]);})[_0x834e('0x4f')](function(_0x567992){_0x23ad7c['errors'][_0x834e('0x67')]({'data':_0x3aa388,'error':_0x567992[_0x834e('0x6b')]});});})['then'](function(_0x3cca51){return _0x23ad7c;})[_0x834e('0x4f')](function(_0x1bc5d1){return _0x1bc5d1;});}else{_0x36ede9[_0x834e('0x22')](0x190)[_0x834e('0x23')]({'message':'Malformed\x20request\x20syntax'});}});}})[_0x834e('0x2d')](respondWithResult(_0x36ede9,null))[_0x834e('0x4f')](handleError(_0x36ede9,null));};exports['getContacts']=function(_0x54178d,_0x5ede29,_0x1e5252){var _0x1f3e26;return db['CmList'][_0x834e('0x4e')]({'where':{'id':_0x54178d[_0x834e('0x4c')]['id']},'include':[{'model':db['CmCustomField'],'as':_0x834e('0x6c')}]})['then'](handleEntityNotFound(_0x5ede29,null))['then'](function(_0x41dfd9){if(_0x41dfd9){_0x1f3e26=_0x41dfd9;return db[_0x834e('0x65')][_0x834e('0x4d')];}})[_0x834e('0x2d')](function(_0x55e0f7){if(_0x55e0f7){var _0x3951ed={};var _0x34ecc8={};_0x34ecc8[_0x834e('0x39')]=_[_0x834e('0x6d')](_[_0x834e('0x3c')](_0x55e0f7),_[_0x834e('0x3a')](_0x1f3e26[_0x834e('0x6c')],function(_0x15e141){return util[_0x834e('0x6e')](_0x834e('0x6f'),_0x15e141['id']);}));_0x34ecc8[_0x834e('0x3b')]=_[_0x834e('0x3c')](_0x54178d[_0x834e('0x3b')]);_0x34ecc8[_0x834e('0x44')]=_[_0x834e('0x3d')](_0x34ecc8[_0x834e('0x39')],_0x34ecc8[_0x834e('0x3b')]);_0x3951ed[_0x834e('0x3e')]=_[_0x834e('0x3d')](_0x34ecc8[_0x834e('0x39')],qs[_0x834e('0x3f')](_0x54178d[_0x834e('0x3b')]['fields']));_0x3951ed[_0x834e('0x3e')]=_0x3951ed[_0x834e('0x3e')][_0x834e('0x40')]?_0x3951ed[_0x834e('0x3e')]:_0x34ecc8[_0x834e('0x39')];if(!_0x54178d[_0x834e('0x3b')][_0x834e('0x41')](_0x834e('0x5f'))){_0x3951ed[_0x834e('0x26')]=qs['limit'](_0x54178d['query']['limit']);_0x3951ed[_0x834e('0x25')]=qs['offset'](_0x54178d[_0x834e('0x3b')][_0x834e('0x25')]);}_0x3951ed[_0x834e('0x60')]=qs['sort'](_0x54178d[_0x834e('0x3b')][_0x834e('0x42')]);_0x3951ed[_0x834e('0x43')]=qs[_0x834e('0x44')](_[_0x834e('0x61')](_0x54178d[_0x834e('0x3b')],_0x34ecc8['filters']));_0x3951ed[_0x834e('0x70')]=!![];if(_0x54178d[_0x834e('0x3b')][_0x834e('0x45')]){_0x3951ed[_0x834e('0x43')]=_[_0x834e('0x46')](_0x3951ed['where'],{'$or':_['map'](_0x3951ed['attributes'],function(_0x5cbb14){var _0x1dfa2e={};_0x1dfa2e[_0x5cbb14]={'$like':'%'+_0x54178d[_0x834e('0x3b')]['filter']+'%'};return _0x1dfa2e;})});}_0x3951ed=_[_0x834e('0x46')]({},_0x3951ed,_0x54178d[_0x834e('0x47')]);return _0x1f3e26['getContacts'](_0x3951ed);}})[_0x834e('0x2d')](respondWithResult(_0x5ede29,null))[_0x834e('0x4f')](handleError(_0x5ede29,null));};exports[_0x834e('0x71')]=function(_0x43a6bf,_0x1d1075,_0x404bab){var _0x58a38d;return db['CmList'][_0x834e('0x4e')]({'where':{'id':_0x43a6bf[_0x834e('0x4c')]['id']},'include':[{'model':db[_0x834e('0x72')],'as':'CustomFields'}]})[_0x834e('0x2d')](handleEntityNotFound(_0x1d1075,null))[_0x834e('0x2d')](function(_0x582b24){if(_0x582b24){_0x58a38d=_0x582b24;return db[_0x834e('0x65')][_0x834e('0x4d')];}})[_0x834e('0x2d')](function(_0x30e3aa){if(_0x30e3aa){var _0x4cb802={};var _0x366a9f={};_0x366a9f['model']=_['concat'](_[_0x834e('0x3c')](_0x30e3aa),_[_0x834e('0x3a')](_0x58a38d[_0x834e('0x6c')],function(_0x3fde89){return util[_0x834e('0x6e')](_0x834e('0x6f'),_0x3fde89['id']);}));_0x366a9f['query']=_['keys'](_0x43a6bf[_0x834e('0x3b')]);_0x366a9f[_0x834e('0x44')]=_[_0x834e('0x3d')](_0x366a9f[_0x834e('0x39')],_0x366a9f[_0x834e('0x3b')]);_0x4cb802[_0x834e('0x3e')]=_[_0x834e('0x3d')](_0x366a9f['model'],qs[_0x834e('0x3f')](_0x43a6bf[_0x834e('0x3b')]['fields']));_0x4cb802[_0x834e('0x3e')]=_0x4cb802[_0x834e('0x3e')][_0x834e('0x40')]?_0x4cb802[_0x834e('0x3e')]:_0x366a9f[_0x834e('0x39')];if(!_0x43a6bf[_0x834e('0x3b')][_0x834e('0x41')](_0x834e('0x5f'))){_0x4cb802[_0x834e('0x26')]=qs[_0x834e('0x26')](_0x43a6bf[_0x834e('0x3b')][_0x834e('0x26')]);_0x4cb802[_0x834e('0x25')]=qs[_0x834e('0x25')](_0x43a6bf['query'][_0x834e('0x25')]);}_0x4cb802[_0x834e('0x60')]=qs['sort'](_0x43a6bf[_0x834e('0x3b')]['sort']);_0x4cb802[_0x834e('0x43')]=qs['filters'](_[_0x834e('0x61')](_0x43a6bf['query'],_0x366a9f[_0x834e('0x44')]));_0x4cb802[_0x834e('0x70')]=!![];if(_0x43a6bf[_0x834e('0x3b')][_0x834e('0x45')]){_0x4cb802['where']=_[_0x834e('0x46')](_0x4cb802[_0x834e('0x43')],{'$or':_[_0x834e('0x3a')](_0x4cb802[_0x834e('0x3e')],function(_0x35ec44){var _0x5270bd={};_0x5270bd[_0x35ec44]={'$like':'%'+_0x43a6bf[_0x834e('0x3b')][_0x834e('0x45')]+'%'};return _0x5270bd;})});}_0x4cb802=_[_0x834e('0x46')]({},_0x4cb802,_0x43a6bf[_0x834e('0x47')]);return _0x58a38d[_0x834e('0x73')](_0x4cb802);}})[_0x834e('0x2d')](function(_0x3a6546){if(!_[_0x834e('0x74')](_0x3a6546)){var _0x1c7061=toCsv(_0x3a6546);var _0xfec19d=Date[_0x834e('0x75')]();fs['writeFileSync'](util['format'](_0x834e('0x76'),_0x58a38d['id'],_0xfec19d),_0x1c7061);_0x1d1075[_0x834e('0x77')](_0x834e('0x78'),_0x834e('0x79')+util[_0x834e('0x6e')](_0x834e('0x7a'),_0x58a38d['id'],_0xfec19d));_0x1d1075[_0x834e('0x77')](_0x834e('0x7b'),_0x834e('0x7c'));return _0x1d1075[_0x834e('0x7d')](util[_0x834e('0x6e')](_0x834e('0x76'),_0x58a38d['id'],_0xfec19d));}else{return _0x1d1075['sendStatus'](0xcc);}})[_0x834e('0x4f')](handleError(_0x1d1075,null));};exports['addCustomField']=function(_0x2fdb72,_0x1beab1,_0x19e3a2){var _0x557373;delete _0x2fdb72[_0x834e('0x51')]['id'];return db[_0x834e('0x35')]['findOne']({'where':{'id':_0x2fdb72['params']['id']}})[_0x834e('0x2d')](handleEntityNotFound(_0x1beab1,null))[_0x834e('0x2d')](function(_0x4e0f4d){if(_0x4e0f4d){return db[_0x834e('0x7e')][_0x834e('0x7f')](function(_0x4643d9){return db[_0x834e('0x72')][_0x834e('0x50')](_0x2fdb72['body'],{'transaction':_0x4643d9})['then'](function(_0x453e58){_0x557373=_0x453e58;return _0x4e0f4d['addCustomFields'](_0x453e58,{'transaction':_0x4643d9});})['then'](function(){var _0x4d8f41={'type':db[_0x834e('0x80')][_0x834e('0x81')],'transaction':_0x4643d9};switch(_0x2fdb72['body'][_0x834e('0x37')]){case _0x834e('0x82'):_0x4d8f41[_0x834e('0x37')]=db[_0x834e('0x80')]['TEXT'];break;case _0x834e('0x83'):_0x4d8f41[_0x834e('0x37')]=db[_0x834e('0x80')]['INTEGER'];break;case _0x834e('0x84'):_0x4d8f41['type']=db[_0x834e('0x80')]['BOOLEAN'];_0x4d8f41[_0x834e('0x85')]=![];break;default:}return db[_0x834e('0x7e')]['queryInterface'][_0x834e('0x86')](_0x834e('0x87'),util[_0x834e('0x6e')](_0x834e('0x88'),_0x557373['id']),_0x4d8f41);})[_0x834e('0x2d')](function(){return _0x557373;});});}})[_0x834e('0x2d')](respondWithResult(_0x1beab1,null))['catch'](handleError(_0x1beab1,null));};exports[_0x834e('0x89')]=function(_0x464339,_0x3ab36e,_0x29dce9){var _0x306db2={};var _0x1b8e67={};var _0x5d3c6d;var _0x448420;return db['CmList']['findOne']({'where':{'id':_0x464339[_0x834e('0x4c')]['id']}})['then'](handleEntityNotFound(_0x3ab36e,null))['then'](function(_0xa64f40){if(_0xa64f40){_0x5d3c6d=_0xa64f40;_0x1b8e67[_0x834e('0x39')]=_[_0x834e('0x3c')](db[_0x834e('0x72')][_0x834e('0x4d')]);_0x1b8e67[_0x834e('0x3b')]=_[_0x834e('0x3c')](_0x464339[_0x834e('0x3b')]);_0x1b8e67[_0x834e('0x44')]=_[_0x834e('0x3d')](_0x1b8e67[_0x834e('0x39')],_0x1b8e67[_0x834e('0x3b')]);_0x306db2[_0x834e('0x3e')]=_[_0x834e('0x3d')](_0x1b8e67['model'],qs[_0x834e('0x3f')](_0x464339['query'][_0x834e('0x3f')]));_0x306db2[_0x834e('0x3e')]=_0x306db2[_0x834e('0x3e')][_0x834e('0x40')]?_0x306db2['attributes']:_0x1b8e67['model'];_0x306db2[_0x834e('0x60')]=qs[_0x834e('0x42')](_0x464339['query'][_0x834e('0x42')]);_0x306db2[_0x834e('0x43')]=qs['filters'](_[_0x834e('0x61')](_0x464339[_0x834e('0x3b')],_0x1b8e67[_0x834e('0x44')]));_0x306db2[_0x834e('0x43')]=_['merge'](_0x306db2['where'],{'$or':[{'ListId':_0xa64f40['id']},{'ListId':null}]});if(_0x464339['query']['filter']){_0x306db2[_0x834e('0x43')]=_[_0x834e('0x46')](_0x306db2['where'],{'$or':_[_0x834e('0x3a')](_0x306db2['attributes'],function(_0x8ca25b){var _0x13b39a={};_0x13b39a[_0x8ca25b]={'$like':'%'+_0x464339[_0x834e('0x3b')][_0x834e('0x45')]+'%'};return _0x13b39a;})});}_0x306db2=_[_0x834e('0x46')]({},_0x306db2,_0x464339[_0x834e('0x47')]);return db[_0x834e('0x72')]['findAndCountAll'](_0x306db2);}})[_0x834e('0x2d')](respondWithResult(_0x3ab36e,null))[_0x834e('0x4f')](handleError(_0x3ab36e,null));};exports['addAgents']=function(_0x22f4c7,_0x4551cb,_0x536f66){return db['CmList']['find']({'where':{'id':_0x22f4c7[_0x834e('0x4c')]['id']}})[_0x834e('0x2d')](handleEntityNotFound(_0x4551cb,null))[_0x834e('0x2d')](function(_0x4a61c7){if(_0x4a61c7){return _0x4a61c7[_0x834e('0x8a')](_0x22f4c7[_0x834e('0x51')][_0x834e('0x64')],_[_0x834e('0x8b')](_0x22f4c7[_0x834e('0x51')],[_0x834e('0x64'),'id'])||{})[_0x834e('0x8c')](function(_0x13af70){for(var _0x8804a8=0x0;_0x8804a8<_0x22f4c7[_0x834e('0x51')]['ids']['length'];_0x8804a8+=0x1){socket[_0x834e('0x8d')](_0x834e('0x8e'),{'UserId':_0x22f4c7[_0x834e('0x51')][_0x834e('0x64')][_0x8804a8],'CmListId':_0x22f4c7[_0x834e('0x4c')]['id']});}return _0x13af70;});}})[_0x834e('0x2d')](respondWithResult(_0x4551cb,null))[_0x834e('0x4f')](handleError(_0x4551cb,null));};exports[_0x834e('0x8f')]=function(_0x38151c,_0x97a4b2,_0x264adc){return db[_0x834e('0x35')][_0x834e('0x4e')]({'where':{'id':_0x38151c['params']['id']}})[_0x834e('0x2d')](handleEntityNotFound(_0x97a4b2,null))[_0x834e('0x2d')](function(_0x3f5b2e){if(_0x3f5b2e){return _0x3f5b2e[_0x834e('0x8f')](_0x38151c['query']['ids'])['then'](function(){if(_[_0x834e('0x90')](_0x38151c[_0x834e('0x3b')][_0x834e('0x64')])){for(var _0x23d7e6=0x0;_0x23d7e6<_0x38151c[_0x834e('0x3b')][_0x834e('0x64')][_0x834e('0x40')];_0x23d7e6+=0x1){socket[_0x834e('0x8d')]('userCmList:remove',{'UserId':Number(_0x38151c['query']['ids'][_0x23d7e6]),'CmListId':Number(_0x38151c['params']['id'])});}}else{socket[_0x834e('0x8d')](_0x834e('0x91'),{'UserId':Number(_0x38151c[_0x834e('0x3b')][_0x834e('0x64')]),'CmListId':Number(_0x38151c[_0x834e('0x4c')]['id'])});}});}})[_0x834e('0x2d')](respondWithStatusCode(_0x97a4b2,null))[_0x834e('0x4f')](handleError(_0x97a4b2,null));};exports[_0x834e('0x92')]=function(_0x33757d,_0x4e6525,_0x4b613c){var _0x4d1545={};var _0x5dc651={};var _0x11aff8;var _0x17025e;return db[_0x834e('0x35')][_0x834e('0x5e')]({'where':{'id':_0x33757d[_0x834e('0x4c')]['id']}})[_0x834e('0x2d')](handleEntityNotFound(_0x4e6525,null))[_0x834e('0x2d')](function(_0x333a44){if(_0x333a44){_0x11aff8=_0x333a44;_0x5dc651[_0x834e('0x39')]=_[_0x834e('0x3c')](db[_0x834e('0x93')][_0x834e('0x4d')]);_0x5dc651[_0x834e('0x3b')]=_[_0x834e('0x3c')](_0x33757d[_0x834e('0x3b')]);_0x5dc651[_0x834e('0x44')]=_['intersection'](_0x5dc651[_0x834e('0x39')],_0x5dc651['query']);_0x4d1545[_0x834e('0x3e')]=_[_0x834e('0x3d')](_0x5dc651[_0x834e('0x39')],qs['fields'](_0x33757d[_0x834e('0x3b')][_0x834e('0x3f')]));_0x4d1545['attributes']=_0x4d1545['attributes'][_0x834e('0x40')]?_0x4d1545[_0x834e('0x3e')]:_0x5dc651[_0x834e('0x39')];_0x4d1545[_0x834e('0x60')]=qs[_0x834e('0x42')](_0x33757d[_0x834e('0x3b')][_0x834e('0x42')]);_0x4d1545[_0x834e('0x43')]=qs['filters'](_[_0x834e('0x61')](_0x33757d[_0x834e('0x3b')],_0x5dc651[_0x834e('0x44')]));if(_0x33757d[_0x834e('0x3b')][_0x834e('0x45')]){_0x4d1545[_0x834e('0x43')]=_[_0x834e('0x46')](_0x4d1545['where'],{'$or':_[_0x834e('0x3a')](_0x4d1545['attributes'],function(_0x586fa5){var _0x1115b7={};_0x1115b7[_0x586fa5]={'$like':'%'+_0x33757d[_0x834e('0x3b')]['filter']+'%'};return _0x1115b7;})});}_0x4d1545=_[_0x834e('0x46')]({},_0x4d1545,_0x33757d[_0x834e('0x47')]);return _0x11aff8['getAgents'](_0x4d1545);}})[_0x834e('0x2d')](function(_0x418da2){if(_0x418da2){_0x17025e=_0x418da2['length'];if(!_0x33757d['query'][_0x834e('0x41')](_0x834e('0x5f'))){_0x4d1545['limit']=qs['limit'](_0x33757d[_0x834e('0x3b')][_0x834e('0x26')]);_0x4d1545['offset']=qs['offset'](_0x33757d['query']['offset']);}return _0x11aff8[_0x834e('0x92')](_0x4d1545);}})['then'](function(_0x3be4c3){if(_0x3be4c3){return _0x3be4c3?{'count':_0x17025e,'rows':_0x3be4c3}:null;}})['then'](respondWithResult(_0x4e6525,null))[_0x834e('0x4f')](handleError(_0x4e6525,null));}; \ No newline at end of file diff --git a/server/api/cmList/cmList.events.js b/server/api/cmList/cmList.events.js index 9c58a60..a1511c7 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 _0xc402=['save','update','emit','hook','exports','../../mysqldb','setMaxListeners'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xc402,0xd7));var _0x2c40=function(_0xe55aca,_0x2cb21f){_0xe55aca=_0xe55aca-0x0;var _0x1afa4e=_0xc402[_0xe55aca];return _0x1afa4e;};'use strict';var EventEmitter=require('events');var CmList=require(_0x2c40('0x0'))['db']['CmList'];var CmListEvents=new EventEmitter();CmListEvents[_0x2c40('0x1')](0x0);var events={'afterCreate':_0x2c40('0x2'),'afterUpdate':_0x2c40('0x3'),'afterDestroy':'remove'};function emitEvent(_0x12d43d){return function(_0x467564,_0x3b6a0b,_0x6993ea){CmListEvents[_0x2c40('0x4')](_0x12d43d+':'+_0x467564['id'],_0x467564);CmListEvents[_0x2c40('0x4')](_0x12d43d,_0x467564);_0x6993ea(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];CmList[_0x2c40('0x5')](e,emitEvent(event));}}module[_0x2c40('0x6')]=CmListEvents; \ No newline at end of file +var _0x8d57=['CmList','setMaxListeners','save','emit','hasOwnProperty','hook','../../mysqldb'];(function(_0xd0a847,_0x72562b){var _0x2536ec=function(_0x20e4db){while(--_0x20e4db){_0xd0a847['push'](_0xd0a847['shift']());}};_0x2536ec(++_0x72562b);}(_0x8d57,0x172));var _0x78d5=function(_0x2c0dc0,_0x19900d){_0x2c0dc0=_0x2c0dc0-0x0;var _0x4c0990=_0x8d57[_0x2c0dc0];return _0x4c0990;};'use strict';var EventEmitter=require('events');var CmList=require(_0x78d5('0x0'))['db'][_0x78d5('0x1')];var CmListEvents=new EventEmitter();CmListEvents[_0x78d5('0x2')](0x0);var events={'afterCreate':_0x78d5('0x3'),'afterUpdate':'update','afterDestroy':'remove'};function emitEvent(_0x33cb4c){return function(_0x56b5f2,_0x52bbe5,_0x649eb7){CmListEvents[_0x78d5('0x4')](_0x33cb4c+':'+_0x56b5f2['id'],_0x56b5f2);CmListEvents[_0x78d5('0x4')](_0x33cb4c,_0x56b5f2);_0x649eb7(null);};}for(var e in events){if(events[_0x78d5('0x5')](e)){var event=events[e];CmList[_0x78d5('0x6')](e,emitEvent(event));}}module['exports']=CmListEvents; \ No newline at end of file diff --git a/server/api/cmList/cmList.model.js b/server/api/cmList/cmList.model.js index 58ca39d..87943c1 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 _0x7ade=['bluebird','request-promise','path','./cmList.attributes','define','CmList','cm_lists','lodash','util','../../config/logger','api','moment'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x7ade,0x97));var _0xe7ad=function(_0x2f4a5a,_0x5d7251){_0x2f4a5a=_0x2f4a5a-0x0;var _0xb16bf0=_0x7ade[_0x2f4a5a];return _0xb16bf0;};'use strict';var _=require(_0xe7ad('0x0'));var util=require(_0xe7ad('0x1'));var logger=require(_0xe7ad('0x2'))(_0xe7ad('0x3'));var moment=require(_0xe7ad('0x4'));var BPromise=require(_0xe7ad('0x5'));var rp=require(_0xe7ad('0x6'));var fs=require('fs');var path=require(_0xe7ad('0x7'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0xe7ad('0x8'));module['exports']=function(_0x36179f,_0x50d0ff){return _0x36179f[_0xe7ad('0x9')](_0xe7ad('0xa'),attributes,{'tableName':_0xe7ad('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x895b=['bluebird','path','rimraf','exports','define','CmList','util','../../config/logger','api'];(function(_0x35d69a,_0x5b85d4){var _0x2070b7=function(_0x21274f){while(--_0x21274f){_0x35d69a['push'](_0x35d69a['shift']());}};_0x2070b7(++_0x5b85d4);}(_0x895b,0xde));var _0xb895=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x895b[_0x3dd15e];return _0x231fd0;};'use strict';var _=require('lodash');var util=require(_0xb895('0x0'));var logger=require(_0xb895('0x1'))(_0xb895('0x2'));var moment=require('moment');var BPromise=require(_0xb895('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xb895('0x4'));var rimraf=require(_0xb895('0x5'));var config=require('../../config/environment');var attributes=require('./cmList.attributes');module[_0xb895('0x6')]=function(_0x455aeb,_0x3b6711){return _0x455aeb[_0xb895('0x7')](_0xb895('0x8'),attributes,{'tableName':'cm_lists','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 d863676..743cdb1 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 _0x31d0=['util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','client','http','defaults','redis','localhost','socket.io-emitter','./cmList.socket','register','request','then','info','CmList,\x20%s,\x20%s','request\x20sent','debug','CmList,\x20%s,\x20%s,\x20%s','error','code','message','catch','lodash'];(function(_0x288f5e,_0x205edd){var _0x476cc9=function(_0x796f53){while(--_0x796f53){_0x288f5e['push'](_0x288f5e['shift']());}};_0x476cc9(++_0x205edd);}(_0x31d0,0x121));var _0x031d=function(_0x1529a3,_0x529f63){_0x1529a3=_0x1529a3-0x0;var _0x1a0d4b=_0x31d0[_0x1529a3];return _0x1a0d4b;};'use strict';var _=require(_0x031d('0x0'));var util=require(_0x031d('0x1'));var moment=require(_0x031d('0x2'));var BPromise=require(_0x031d('0x3'));var rs=require(_0x031d('0x4'));var fs=require('fs');var Redis=require(_0x031d('0x5'));var db=require(_0x031d('0x6'))['db'];var utils=require(_0x031d('0x7'));var logger=require('../../config/logger')(_0x031d('0x8'));var config=require(_0x031d('0x9'));var jayson=require('jayson/promise');var client=jayson[_0x031d('0xa')][_0x031d('0xb')]({'port':0x232a});config['redis']=_[_0x031d('0xc')](config[_0x031d('0xd')],{'host':_0x031d('0xe'),'port':0x18eb});var socket=require(_0x031d('0xf'))(new Redis(config[_0x031d('0xd')]));require(_0x031d('0x10'))[_0x031d('0x11')](socket);function respondWithRpcPromise(_0x445fba,_0xa994fa,_0xeb0ea){return new BPromise(function(_0xb745,_0x404435){return client[_0x031d('0x12')](_0x445fba,_0xeb0ea)[_0x031d('0x13')](function(_0x62897d){logger[_0x031d('0x14')](_0x031d('0x15'),_0xa994fa,_0x031d('0x16'));logger[_0x031d('0x17')](_0x031d('0x18'),_0xa994fa,'request\x20sent',JSON['stringify'](_0x62897d));if(_0x62897d['error']){if(_0x62897d[_0x031d('0x19')][_0x031d('0x1a')]===0x1f4){logger[_0x031d('0x19')](_0x031d('0x15'),_0xa994fa,_0x62897d[_0x031d('0x19')][_0x031d('0x1b')]);return _0x404435(_0x62897d[_0x031d('0x19')][_0x031d('0x1b')]);}logger[_0x031d('0x19')](_0x031d('0x15'),_0xa994fa,_0x62897d[_0x031d('0x19')][_0x031d('0x1b')]);return _0xb745(_0x62897d[_0x031d('0x19')][_0x031d('0x1b')]);}else{logger[_0x031d('0x14')](_0x031d('0x15'),_0xa994fa,_0x031d('0x16'));_0xb745(_0x62897d['result']['message']);}})[_0x031d('0x1c')](function(_0x579a4c){logger[_0x031d('0x19')]('CmList,\x20%s,\x20%s',_0xa994fa,_0x579a4c);_0x404435(_0x579a4c);});});} \ No newline at end of file +var _0x382c=['socket.io-emitter','register','info','CmList,\x20%s,\x20%s','request\x20sent','debug','CmList,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','lodash','util','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','http','redis','defaults','localhost'];(function(_0x3e6204,_0x12c8b4){var _0x173853=function(_0x10ddc3){while(--_0x10ddc3){_0x3e6204['push'](_0x3e6204['shift']());}};_0x173853(++_0x12c8b4);}(_0x382c,0x106));var _0xc382=function(_0x14f21c,_0x315b28){_0x14f21c=_0x14f21c-0x0;var _0x2b509b=_0x382c[_0x14f21c];return _0x2b509b;};'use strict';var _=require(_0xc382('0x0'));var util=require(_0xc382('0x1'));var moment=require('moment');var BPromise=require(_0xc382('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xc382('0x3'));var db=require(_0xc382('0x4'))['db'];var utils=require(_0xc382('0x5'));var logger=require(_0xc382('0x6'))(_0xc382('0x7'));var config=require(_0xc382('0x8'));var jayson=require('jayson/promise');var client=jayson['client'][_0xc382('0x9')]({'port':0x232a});config[_0xc382('0xa')]=_[_0xc382('0xb')](config[_0xc382('0xa')],{'host':_0xc382('0xc'),'port':0x18eb});var socket=require(_0xc382('0xd'))(new Redis(config['redis']));require('./cmList.socket')[_0xc382('0xe')](socket);function respondWithRpcPromise(_0x5b0472,_0x13b97e,_0x369c94){return new BPromise(function(_0x34b298,_0x1d1b6f){return client['request'](_0x5b0472,_0x369c94)['then'](function(_0xc0600a){logger[_0xc382('0xf')](_0xc382('0x10'),_0x13b97e,_0xc382('0x11'));logger[_0xc382('0x12')](_0xc382('0x13'),_0x13b97e,_0xc382('0x11'),JSON[_0xc382('0x14')](_0xc0600a));if(_0xc0600a[_0xc382('0x15')]){if(_0xc0600a['error']['code']===0x1f4){logger[_0xc382('0x15')](_0xc382('0x10'),_0x13b97e,_0xc0600a['error'][_0xc382('0x16')]);return _0x1d1b6f(_0xc0600a['error'][_0xc382('0x16')]);}logger[_0xc382('0x15')]('CmList,\x20%s,\x20%s',_0x13b97e,_0xc0600a[_0xc382('0x15')][_0xc382('0x16')]);return _0x34b298(_0xc0600a[_0xc382('0x15')][_0xc382('0x16')]);}else{logger[_0xc382('0xf')](_0xc382('0x10'),_0x13b97e,_0xc382('0x11'));_0x34b298(_0xc0600a[_0xc382('0x17')][_0xc382('0x16')]);}})[_0xc382('0x18')](function(_0x3972f2){logger[_0xc382('0x15')](_0xc382('0x10'),_0x13b97e,_0x3972f2);_0x1d1b6f(_0x3972f2);});});} \ No newline at end of file diff --git a/server/api/cmList/cmList.socket.js b/server/api/cmList/cmList.socket.js index 0ceda5c..11be15c 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 _0xeecc=['./cmList.events','save','remove','update','removeListener','register','cmList:'];(function(_0x5e815a,_0x59fbda){var _0x283d43=function(_0x494dbd){while(--_0x494dbd){_0x5e815a['push'](_0x5e815a['shift']());}};_0x283d43(++_0x59fbda);}(_0xeecc,0x12d));var _0xceec=function(_0x2dfdf0,_0x35d8f5){_0x2dfdf0=_0x2dfdf0-0x0;var _0x59f817=_0xeecc[_0x2dfdf0];return _0x59f817;};'use strict';var CmListEvents=require(_0xceec('0x0'));var events=[_0xceec('0x1'),_0xceec('0x2'),_0xceec('0x3')];function createListener(_0x4974bf,_0x23721e){return function(_0x4ce7cd){_0x23721e['emit'](_0x4974bf,_0x4ce7cd);};}function removeListener(_0x588f01,_0x15c89e){return function(){CmListEvents[_0xceec('0x4')](_0x588f01,_0x15c89e);};}exports[_0xceec('0x5')]=function(_0x2ae233){for(var _0x5889fb=0x0,_0x252885=events['length'];_0x5889fb<_0x252885;_0x5889fb++){var _0x30a3b1=events[_0x5889fb];var _0x19413a=createListener(_0xceec('0x6')+_0x30a3b1,_0x2ae233);CmListEvents['on'](_0x30a3b1,_0x19413a);}}; \ No newline at end of file +var _0x8b2d=['cmList:','remove','emit','removeListener','register','length'];(function(_0x4c2891,_0x5f42a1){var _0x4d3929=function(_0x192520){while(--_0x192520){_0x4c2891['push'](_0x4c2891['shift']());}};_0x4d3929(++_0x5f42a1);}(_0x8b2d,0xe5));var _0xd8b2=function(_0x13583c,_0x4f2af7){_0x13583c=_0x13583c-0x0;var _0x2191d5=_0x8b2d[_0x13583c];return _0x2191d5;};'use strict';var CmListEvents=require('./cmList.events');var events=['save',_0xd8b2('0x0'),'update'];function createListener(_0x3007a6,_0x429708){return function(_0x4d922e){_0x429708[_0xd8b2('0x1')](_0x3007a6,_0x4d922e);};}function removeListener(_0x3a7304,_0x55a03c){return function(){CmListEvents[_0xd8b2('0x2')](_0x3a7304,_0x55a03c);};}exports[_0xd8b2('0x3')]=function(_0x36eb23){for(var _0x282a58=0x0,_0x1c78f6=events[_0xd8b2('0x4')];_0x282a58<_0x1c78f6;_0x282a58++){var _0x42fe49=events[_0x282a58];var _0x210fe2=createListener(_0xd8b2('0x5')+_0x42fe49,_0x36eb23);CmListEvents['on'](_0x42fe49,_0x210fe2);}}; \ No newline at end of file diff --git a/server/api/cmList/index.js b/server/api/cmList/index.js index db021d1..76768f2 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 _0x614b=['isAuthenticated','/describe','describe','/:id','show','/:id/dispositions','getDispositions','/:id/contacts/csv','getContactsCsv','/:id/fields','/:id/users','getAgents','post','create','addDisposition','/:id/contacts','addContacts','addAgents','delete','exports','multer','util','path','connect-timeout','Router','../../components/auth/service','../../config/environment','get'];(function(_0x5daab1,_0xd9c4ac){var _0x170b09=function(_0x23c9cd){while(--_0x23c9cd){_0x5daab1['push'](_0x5daab1['shift']());}};_0x170b09(++_0xd9c4ac);}(_0x614b,0x110));var _0xb614=function(_0x42817d,_0x17482f){_0x42817d=_0x42817d-0x0;var _0x2edeb1=_0x614b[_0x42817d];return _0x2edeb1;};'use strict';var multer=require(_0xb614('0x0'));var util=require(_0xb614('0x1'));var path=require(_0xb614('0x2'));var timeout=require(_0xb614('0x3'));var express=require('express');var router=express[_0xb614('0x4')]();var auth=require(_0xb614('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0xb614('0x6'));var controller=require('./cmList.controller');router[_0xb614('0x7')]('/',auth[_0xb614('0x8')](),controller['index']);router[_0xb614('0x7')](_0xb614('0x9'),auth[_0xb614('0x8')](),controller[_0xb614('0xa')]);router['get'](_0xb614('0xb'),auth[_0xb614('0x8')](),controller[_0xb614('0xc')]);router[_0xb614('0x7')](_0xb614('0xd'),auth['isAuthenticated'](),controller[_0xb614('0xe')]);router['get']('/:id/contacts',auth[_0xb614('0x8')](),controller['getContacts']);router[_0xb614('0x7')](_0xb614('0xf'),auth[_0xb614('0x8')](),controller[_0xb614('0x10')]);router[_0xb614('0x7')](_0xb614('0x11'),auth[_0xb614('0x8')](),controller['getCustomFields']);router['get'](_0xb614('0x12'),auth[_0xb614('0x8')](),controller[_0xb614('0x13')]);router[_0xb614('0x14')]('/',auth[_0xb614('0x8')](),controller[_0xb614('0x15')]);router[_0xb614('0x14')](_0xb614('0xd'),auth[_0xb614('0x8')](),controller[_0xb614('0x16')]);router[_0xb614('0x14')](_0xb614('0x17'),auth['isAuthenticated'](),controller[_0xb614('0x18')]);router['post'](_0xb614('0x11'),auth['isAuthenticated'](),controller['addCustomField']);router['post'](_0xb614('0x12'),auth['isAuthenticated'](),controller[_0xb614('0x19')]);router['put']('/:id',auth[_0xb614('0x8')](),controller['update']);router[_0xb614('0x1a')](_0xb614('0xb'),auth['isAuthenticated'](),controller['destroy']);router[_0xb614('0x1a')](_0xb614('0xd'),auth[_0xb614('0x8')](),controller['removeDispositions']);router[_0xb614('0x1a')](_0xb614('0x12'),auth['isAuthenticated'](),controller['removeAgents']);module[_0xb614('0x1b')]=router; \ No newline at end of file +var _0x47a8=['removeAgents','exports','multer','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','./cmList.controller','get','isAuthenticated','index','/describe','describe','show','getDispositions','/:id/contacts','getContacts','/:id/contacts/csv','getContactsCsv','/:id/fields','getCustomFields','/:id/users','getAgents','post','/:id/dispositions','addDisposition','addContacts','put','/:id','update','delete','destroy','removeDispositions'];(function(_0x35543a,_0x933cf9){var _0x18b820=function(_0x2ecf10){while(--_0x2ecf10){_0x35543a['push'](_0x35543a['shift']());}};_0x18b820(++_0x933cf9);}(_0x47a8,0x8e));var _0x847a=function(_0x3b85e6,_0x384317){_0x3b85e6=_0x3b85e6-0x0;var _0x5817cd=_0x47a8[_0x3b85e6];return _0x5817cd;};'use strict';var multer=require(_0x847a('0x0'));var util=require('util');var path=require(_0x847a('0x1'));var timeout=require(_0x847a('0x2'));var express=require(_0x847a('0x3'));var router=express[_0x847a('0x4')]();var auth=require(_0x847a('0x5'));var interaction=require(_0x847a('0x6'));var config=require('../../config/environment');var controller=require(_0x847a('0x7'));router[_0x847a('0x8')]('/',auth[_0x847a('0x9')](),controller[_0x847a('0xa')]);router[_0x847a('0x8')](_0x847a('0xb'),auth[_0x847a('0x9')](),controller[_0x847a('0xc')]);router[_0x847a('0x8')]('/:id',auth[_0x847a('0x9')](),controller[_0x847a('0xd')]);router[_0x847a('0x8')]('/:id/dispositions',auth[_0x847a('0x9')](),controller[_0x847a('0xe')]);router[_0x847a('0x8')](_0x847a('0xf'),auth['isAuthenticated'](),controller[_0x847a('0x10')]);router[_0x847a('0x8')](_0x847a('0x11'),auth[_0x847a('0x9')](),controller[_0x847a('0x12')]);router[_0x847a('0x8')](_0x847a('0x13'),auth['isAuthenticated'](),controller[_0x847a('0x14')]);router[_0x847a('0x8')](_0x847a('0x15'),auth[_0x847a('0x9')](),controller[_0x847a('0x16')]);router[_0x847a('0x17')]('/',auth[_0x847a('0x9')](),controller['create']);router['post'](_0x847a('0x18'),auth[_0x847a('0x9')](),controller[_0x847a('0x19')]);router[_0x847a('0x17')](_0x847a('0xf'),auth[_0x847a('0x9')](),controller[_0x847a('0x1a')]);router['post'](_0x847a('0x13'),auth[_0x847a('0x9')](),controller['addCustomField']);router[_0x847a('0x17')](_0x847a('0x15'),auth['isAuthenticated'](),controller['addAgents']);router[_0x847a('0x1b')](_0x847a('0x1c'),auth['isAuthenticated'](),controller[_0x847a('0x1d')]);router[_0x847a('0x1e')]('/:id',auth[_0x847a('0x9')](),controller[_0x847a('0x1f')]);router[_0x847a('0x1e')](_0x847a('0x18'),auth[_0x847a('0x9')](),controller[_0x847a('0x20')]);router['delete']('/:id/users',auth[_0x847a('0x9')](),controller[_0x847a('0x21')]);module[_0x847a('0x22')]=router; \ No newline at end of file diff --git a/server/api/condition/condition.attributes.js b/server/api/condition/condition.attributes.js index b5bce90..1dd032e 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(_0x5c0617,_0x3bfae4){var _0x52f0db=function(_0x4b84e5){while(--_0x4b84e5){_0x5c0617['push'](_0x5c0617['shift']());}};_0x52f0db(++_0x3bfae4);}(_0xa9e0,0x123));var _0x0a9e=function(_0x1c546c,_0x5c57cb){_0x1c546c=_0x1c546c-0x0;var _0x2cc384=_0xa9e0[_0x1c546c];return _0x2cc384;};'use strict';var Sequelize=require(_0x0a9e('0x0'));module[_0x0a9e('0x1')]={'name':{'type':Sequelize[_0x0a9e('0x2')],'get':function(_0x5dd881){return this['getDataValue'](_0x0a9e('0x3'));}},'field':{'type':Sequelize['STRING'],'allowNull':![]},'operator':{'type':Sequelize[_0x0a9e('0x4')],'allowNull':![]},'value':{'type':Sequelize[_0x0a9e('0x4')],'allowNull':![]}}; \ No newline at end of file +var _0xa9e0=['STRING','sequelize','exports','VIRTUAL','field'];(function(_0x294e72,_0x1c92a9){var _0x37ef76=function(_0x193076){while(--_0x193076){_0x294e72['push'](_0x294e72['shift']());}};_0x37ef76(++_0x1c92a9);}(_0xa9e0,0x123));var _0x0a9e=function(_0x4baae2,_0x487ab6){_0x4baae2=_0x4baae2-0x0;var _0x1a2285=_0xa9e0[_0x4baae2];return _0x1a2285;};'use strict';var Sequelize=require(_0x0a9e('0x0'));module[_0x0a9e('0x1')]={'name':{'type':Sequelize[_0x0a9e('0x2')],'get':function(_0x5dd881){return this['getDataValue'](_0x0a9e('0x3'));}},'field':{'type':Sequelize['STRING'],'allowNull':![]},'operator':{'type':Sequelize[_0x0a9e('0x4')],'allowNull':![]},'value':{'type':Sequelize[_0x0a9e('0x4')],'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/condition/condition.controller.js b/server/api/condition/condition.controller.js index 9915f2c..ef1cb5d 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 _0x7939=['../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','sendStatus','status','end','json','count','offset','set','Content-Range','reject','update','then','destroy','error','stack','name','send','body','Condition','params','catch','find','eml-format','rimraf','zip-dir','fast-json-patch','mustache','util','path','sox','to-csv','ejs','lodash','crypto','jsforce','desk.js','papaparse','../../components/auth/service','../../components/parsers/qs'];(function(_0x40ac5e,_0x2de228){var _0x2839d6=function(_0x123d47){while(--_0x123d47){_0x40ac5e['push'](_0x40ac5e['shift']());}};_0x2839d6(++_0x2de228);}(_0x7939,0x11c));var _0x9793=function(_0x4983a5,_0x207110){_0x4983a5=_0x4983a5-0x0;var _0x3fdb60=_0x7939[_0x4983a5];return _0x3fdb60;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x9793('0x0'));var rimraf=require(_0x9793('0x1'));var zipdir=require(_0x9793('0x2'));var jsonpatch=require(_0x9793('0x3'));var rp=require('request-promise');var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x9793('0x4'));var util=require(_0x9793('0x5'));var path=require(_0x9793('0x6'));var sox=require(_0x9793('0x7'));var csv=require(_0x9793('0x8'));var ejs=require(_0x9793('0x9'));var fs=require('fs');var _=require(_0x9793('0xa'));var squel=require('squel');var crypto=require(_0x9793('0xb'));var jsforce=require(_0x9793('0xc'));var deskjs=require(_0x9793('0xd'));var toCsv=require(_0x9793('0x8'));var querystring=require('querystring');var Papa=require(_0x9793('0xe'));var Redis=require('ioredis');var authService=require(_0x9793('0xf'));var qs=require(_0x9793('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x9793('0x11'));var logger=require(_0x9793('0x12'))(_0x9793('0x13'));var utils=require(_0x9793('0x14'));var config=require(_0x9793('0x15'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x4d491d,_0x30ca14){_0x30ca14=_0x30ca14||0xcc;return function(_0x358345){if(_0x358345){return _0x4d491d[_0x9793('0x16')](_0x30ca14);}return _0x4d491d[_0x9793('0x17')](_0x30ca14)[_0x9793('0x18')]();};}function respondWithResult(_0x19694f,_0x1b7b8a){_0x1b7b8a=_0x1b7b8a||0xc8;return function(_0x14323c){if(_0x14323c){return _0x19694f[_0x9793('0x17')](_0x1b7b8a)[_0x9793('0x19')](_0x14323c);}};}function respondWithFilteredResult(_0x2467ae,_0x265da2){return function(_0x4f0d68){if(_0x4f0d68){var _0x277e9b=_0x4f0d68[_0x9793('0x1a')],_0x2953f9=_0x265da2['offset'],_0x54cacc=_0x265da2[_0x9793('0x1b')]+_0x265da2['limit'],_0x5cf237;if(_0x54cacc>=_0x277e9b){_0x54cacc=_0x277e9b;_0x5cf237=0xc8;}else{_0x5cf237=0xce;}_0x2467ae[_0x9793('0x17')](_0x5cf237);return _0x2467ae[_0x9793('0x1c')](_0x9793('0x1d'),_0x2953f9+'-'+_0x54cacc+'/'+_0x277e9b)['json'](_0x4f0d68);}return null;};}function patchUpdates(_0x58d994){return function(_0x2d6656){try{jsonpatch['apply'](_0x2d6656,_0x58d994,!![]);}catch(_0x5407c5){return BPromise[_0x9793('0x1e')](_0x5407c5);}return _0x2d6656['save']();};}function saveUpdates(_0x3f336b,_0x3c89fb){return function(_0xe3cd5d){if(_0xe3cd5d){return _0xe3cd5d[_0x9793('0x1f')](_0x3f336b)[_0x9793('0x20')](function(_0x539120){return _0x539120;});}return null;};}function removeEntity(_0x88088d,_0x6ed133){return function(_0x500782){if(_0x500782){return _0x500782[_0x9793('0x21')]()['then'](function(){_0x88088d[_0x9793('0x17')](0xcc)[_0x9793('0x18')]();});}};}function handleEntityNotFound(_0x566c92,_0x4eacb2){return function(_0x120bc2){if(!_0x120bc2){_0x566c92[_0x9793('0x16')](0x194);}return _0x120bc2;};}function handleError(_0x644ff8,_0x527a7f){_0x527a7f=_0x527a7f||0x1f4;return function(_0x362720){logger[_0x9793('0x22')](_0x362720[_0x9793('0x23')]);if(_0x362720[_0x9793('0x24')]){delete _0x362720[_0x9793('0x24')];}_0x644ff8[_0x9793('0x17')](_0x527a7f)[_0x9793('0x25')](_0x362720);};}exports[_0x9793('0x1f')]=function(_0x124951,_0x21a4cb){if(_0x124951[_0x9793('0x26')]['id']){delete _0x124951[_0x9793('0x26')]['id'];}return db[_0x9793('0x27')]['find']({'where':{'id':_0x124951[_0x9793('0x28')]['id']}})[_0x9793('0x20')](handleEntityNotFound(_0x21a4cb,null))[_0x9793('0x20')](saveUpdates(_0x124951[_0x9793('0x26')],null))['then'](respondWithResult(_0x21a4cb,null))[_0x9793('0x29')](handleError(_0x21a4cb,null));};exports[_0x9793('0x21')]=function(_0x563d54,_0x3048d8){return db[_0x9793('0x27')][_0x9793('0x2a')]({'where':{'id':_0x563d54['params']['id']}})[_0x9793('0x20')](handleEntityNotFound(_0x3048d8,null))[_0x9793('0x20')](removeEntity(_0x3048d8,null))[_0x9793('0x29')](handleError(_0x3048d8,null));}; \ No newline at end of file +var _0xfe56=['sendStatus','end','status','json','offset','limit','set','Content-Range','reject','save','update','then','destroy','error','stack','name','send','body','Condition','params','find','catch','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','path','sox','to-csv','ejs','lodash','crypto','desk.js','querystring','papaparse','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment'];(function(_0xaf5ec0,_0x204787){var _0x48c82e=function(_0x295ed3){while(--_0x295ed3){_0xaf5ec0['push'](_0xaf5ec0['shift']());}};_0x48c82e(++_0x204787);}(_0xfe56,0x9a));var _0x6fe5=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0xfe56[_0xa464c9];return _0x3d73c4;};'use strict';var pdf=require(_0x6fe5('0x0'));var emlformat=require(_0x6fe5('0x1'));var rimraf=require(_0x6fe5('0x2'));var zipdir=require(_0x6fe5('0x3'));var jsonpatch=require(_0x6fe5('0x4'));var rp=require(_0x6fe5('0x5'));var moment=require('moment');var BPromise=require(_0x6fe5('0x6'));var Mustache=require(_0x6fe5('0x7'));var util=require('util');var path=require(_0x6fe5('0x8'));var sox=require(_0x6fe5('0x9'));var csv=require(_0x6fe5('0xa'));var ejs=require(_0x6fe5('0xb'));var fs=require('fs');var _=require(_0x6fe5('0xc'));var squel=require('squel');var crypto=require(_0x6fe5('0xd'));var jsforce=require('jsforce');var deskjs=require(_0x6fe5('0xe'));var toCsv=require(_0x6fe5('0xa'));var querystring=require(_0x6fe5('0xf'));var Papa=require(_0x6fe5('0x10'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x6fe5('0x11'));var hardwareService=require(_0x6fe5('0x12'));var logger=require(_0x6fe5('0x13'))(_0x6fe5('0x14'));var utils=require('../../config/utils');var config=require(_0x6fe5('0x15'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0xcb6602,_0x2775c0){_0x2775c0=_0x2775c0||0xcc;return function(_0x391d95){if(_0x391d95){return _0xcb6602[_0x6fe5('0x16')](_0x2775c0);}return _0xcb6602['status'](_0x2775c0)[_0x6fe5('0x17')]();};}function respondWithResult(_0x40e595,_0x5121d0){_0x5121d0=_0x5121d0||0xc8;return function(_0x385d4b){if(_0x385d4b){return _0x40e595[_0x6fe5('0x18')](_0x5121d0)[_0x6fe5('0x19')](_0x385d4b);}};}function respondWithFilteredResult(_0x881bcd,_0x5dd2bf){return function(_0x4f19b7){if(_0x4f19b7){var _0x2c9600=_0x4f19b7['count'],_0x2a1481=_0x5dd2bf[_0x6fe5('0x1a')],_0xb9cb6d=_0x5dd2bf['offset']+_0x5dd2bf[_0x6fe5('0x1b')],_0x5e1fc5;if(_0xb9cb6d>=_0x2c9600){_0xb9cb6d=_0x2c9600;_0x5e1fc5=0xc8;}else{_0x5e1fc5=0xce;}_0x881bcd[_0x6fe5('0x18')](_0x5e1fc5);return _0x881bcd[_0x6fe5('0x1c')](_0x6fe5('0x1d'),_0x2a1481+'-'+_0xb9cb6d+'/'+_0x2c9600)[_0x6fe5('0x19')](_0x4f19b7);}return null;};}function patchUpdates(_0x413f02){return function(_0x1c9f4a){try{jsonpatch['apply'](_0x1c9f4a,_0x413f02,!![]);}catch(_0x27b059){return BPromise[_0x6fe5('0x1e')](_0x27b059);}return _0x1c9f4a[_0x6fe5('0x1f')]();};}function saveUpdates(_0x977d5d,_0x44bb2e){return function(_0x40cffe){if(_0x40cffe){return _0x40cffe[_0x6fe5('0x20')](_0x977d5d)[_0x6fe5('0x21')](function(_0x5b68c9){return _0x5b68c9;});}return null;};}function removeEntity(_0x4a9e3d,_0x183d6b){return function(_0x2ba2a0){if(_0x2ba2a0){return _0x2ba2a0[_0x6fe5('0x22')]()[_0x6fe5('0x21')](function(){_0x4a9e3d['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x110091,_0x50fdad){return function(_0x1a43f1){if(!_0x1a43f1){_0x110091['sendStatus'](0x194);}return _0x1a43f1;};}function handleError(_0x530a24,_0x25f3a1){_0x25f3a1=_0x25f3a1||0x1f4;return function(_0x3cf066){logger[_0x6fe5('0x23')](_0x3cf066[_0x6fe5('0x24')]);if(_0x3cf066[_0x6fe5('0x25')]){delete _0x3cf066[_0x6fe5('0x25')];}_0x530a24[_0x6fe5('0x18')](_0x25f3a1)[_0x6fe5('0x26')](_0x3cf066);};}exports['update']=function(_0x5b8a8c,_0x55fc8b){if(_0x5b8a8c[_0x6fe5('0x27')]['id']){delete _0x5b8a8c[_0x6fe5('0x27')]['id'];}return db[_0x6fe5('0x28')]['find']({'where':{'id':_0x5b8a8c[_0x6fe5('0x29')]['id']}})[_0x6fe5('0x21')](handleEntityNotFound(_0x55fc8b,null))[_0x6fe5('0x21')](saveUpdates(_0x5b8a8c[_0x6fe5('0x27')],null))[_0x6fe5('0x21')](respondWithResult(_0x55fc8b,null))['catch'](handleError(_0x55fc8b,null));};exports[_0x6fe5('0x22')]=function(_0xd53e35,_0x2e445a){return db['Condition'][_0x6fe5('0x2a')]({'where':{'id':_0xd53e35['params']['id']}})[_0x6fe5('0x21')](handleEntityNotFound(_0x2e445a,null))[_0x6fe5('0x21')](removeEntity(_0x2e445a,null))[_0x6fe5('0x2b')](handleError(_0x2e445a,null));}; \ No newline at end of file diff --git a/server/api/condition/condition.model.js b/server/api/condition/condition.model.js index a375354..5257a37 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 _0x13ed=['../../config/environment','./condition.attributes','exports','Condition','tools_conditions','util','bluebird','path','rimraf'];(function(_0x18a346,_0x52c71e){var _0x5e4d5f=function(_0x51a3cb){while(--_0x51a3cb){_0x18a346['push'](_0x18a346['shift']());}};_0x5e4d5f(++_0x52c71e);}(_0x13ed,0x15b));var _0xd13e=function(_0x58afd5,_0x534a48){_0x58afd5=_0x58afd5-0x0;var _0x3e503b=_0x13ed[_0x58afd5];return _0x3e503b;};'use strict';var _=require('lodash');var util=require(_0xd13e('0x0'));var logger=require('../../config/logger')('api');var moment=require('moment');var BPromise=require(_0xd13e('0x1'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xd13e('0x2'));var rimraf=require(_0xd13e('0x3'));var config=require(_0xd13e('0x4'));var attributes=require(_0xd13e('0x5'));module[_0xd13e('0x6')]=function(_0x6abad0,_0x544ad1){return _0x6abad0['define'](_0xd13e('0x7'),attributes,{'tableName':_0xd13e('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xe885=['../../config/environment','./condition.attributes','exports','define','tools_conditions','lodash','util','../../config/logger','api','moment','bluebird','path','rimraf'];(function(_0x198551,_0x38b413){var _0x2d199e=function(_0xe513d3){while(--_0xe513d3){_0x198551['push'](_0x198551['shift']());}};_0x2d199e(++_0x38b413);}(_0xe885,0x17e));var _0x5e88=function(_0x2eb0e9,_0x5deb7a){_0x2eb0e9=_0x2eb0e9-0x0;var _0x15d608=_0xe885[_0x2eb0e9];return _0x15d608;};'use strict';var _=require(_0x5e88('0x0'));var util=require(_0x5e88('0x1'));var logger=require(_0x5e88('0x2'))(_0x5e88('0x3'));var moment=require(_0x5e88('0x4'));var BPromise=require(_0x5e88('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x5e88('0x6'));var rimraf=require(_0x5e88('0x7'));var config=require(_0x5e88('0x8'));var attributes=require(_0x5e88('0x9'));module[_0x5e88('0xa')]=function(_0x25987c,_0x57d2f2){return _0x25987c[_0x5e88('0xb')]('Condition',attributes,{'tableName':_0x5e88('0xc'),'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 4afc2c8..ca4a7dd 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 _0xca50=['util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','http','then','request\x20sent','Condition,\x20%s,\x20%s,\x20%s','stringify','error','code','Condition,\x20%s,\x20%s','message','info','result'];(function(_0x111d83,_0x39ec2c){var _0x4c59d3=function(_0x166aad){while(--_0x166aad){_0x111d83['push'](_0x111d83['shift']());}};_0x4c59d3(++_0x39ec2c);}(_0xca50,0x130));var _0x0ca5=function(_0x254203,_0x6f79ec){_0x254203=_0x254203-0x0;var _0x343ef3=_0xca50[_0x254203];return _0x343ef3;};'use strict';var _=require('lodash');var util=require(_0x0ca5('0x0'));var moment=require(_0x0ca5('0x1'));var BPromise=require(_0x0ca5('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x0ca5('0x3'));var db=require(_0x0ca5('0x4'))['db'];var utils=require(_0x0ca5('0x5'));var logger=require(_0x0ca5('0x6'))('rpc');var config=require(_0x0ca5('0x7'));var jayson=require('jayson/promise');var client=jayson['client'][_0x0ca5('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x4eb4b5,_0x5918c7,_0x245c54){return new BPromise(function(_0x8fdd71,_0x3024bd){return client['request'](_0x4eb4b5,_0x245c54)[_0x0ca5('0x9')](function(_0x231803){logger['info']('Condition,\x20%s,\x20%s',_0x5918c7,_0x0ca5('0xa'));logger['debug'](_0x0ca5('0xb'),_0x5918c7,'request\x20sent',JSON[_0x0ca5('0xc')](_0x231803));if(_0x231803[_0x0ca5('0xd')]){if(_0x231803['error'][_0x0ca5('0xe')]===0x1f4){logger[_0x0ca5('0xd')](_0x0ca5('0xf'),_0x5918c7,_0x231803['error']['message']);return _0x3024bd(_0x231803[_0x0ca5('0xd')][_0x0ca5('0x10')]);}logger[_0x0ca5('0xd')](_0x0ca5('0xf'),_0x5918c7,_0x231803[_0x0ca5('0xd')][_0x0ca5('0x10')]);return _0x8fdd71(_0x231803[_0x0ca5('0xd')][_0x0ca5('0x10')]);}else{logger[_0x0ca5('0x11')](_0x0ca5('0xf'),_0x5918c7,_0x0ca5('0xa'));_0x8fdd71(_0x231803[_0x0ca5('0x12')][_0x0ca5('0x10')]);}})['catch'](function(_0x30deea){logger[_0x0ca5('0xd')](_0x0ca5('0xf'),_0x5918c7,_0x30deea);_0x3024bd(_0x30deea);});});} \ No newline at end of file +var _0x54c3=['ioredis','../../mysqldb','rpc','../../config/environment','client','request','info','Condition,\x20%s,\x20%s','debug','Condition,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','code','error','message','lodash','util','bluebird'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x54c3,0x7b));var _0x354c=function(_0x20edd4,_0x7c30f2){_0x20edd4=_0x20edd4-0x0;var _0xc4a1e4=_0x54c3[_0x20edd4];return _0xc4a1e4;};'use strict';var _=require(_0x354c('0x0'));var util=require(_0x354c('0x1'));var moment=require('moment');var BPromise=require(_0x354c('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x354c('0x3'));var db=require(_0x354c('0x4'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x354c('0x5'));var config=require(_0x354c('0x6'));var jayson=require('jayson/promise');var client=jayson[_0x354c('0x7')]['http']({'port':0x232a});function respondWithRpcPromise(_0x264e65,_0x3b221a,_0x4aa0dd){return new BPromise(function(_0x4f7130,_0x522225){return client[_0x354c('0x8')](_0x264e65,_0x4aa0dd)['then'](function(_0x324245){logger[_0x354c('0x9')](_0x354c('0xa'),_0x3b221a,'request\x20sent');logger[_0x354c('0xb')](_0x354c('0xc'),_0x3b221a,_0x354c('0xd'),JSON[_0x354c('0xe')](_0x324245));if(_0x324245['error']){if(_0x324245['error'][_0x354c('0xf')]===0x1f4){logger[_0x354c('0x10')](_0x354c('0xa'),_0x3b221a,_0x324245[_0x354c('0x10')][_0x354c('0x11')]);return _0x522225(_0x324245['error'][_0x354c('0x11')]);}logger[_0x354c('0x10')](_0x354c('0xa'),_0x3b221a,_0x324245['error'][_0x354c('0x11')]);return _0x4f7130(_0x324245['error'][_0x354c('0x11')]);}else{logger['info'](_0x354c('0xa'),_0x3b221a,_0x354c('0xd'));_0x4f7130(_0x324245['result'][_0x354c('0x11')]);}})['catch'](function(_0x25218b){logger[_0x354c('0x10')](_0x354c('0xa'),_0x3b221a,_0x25218b);_0x522225(_0x25218b);});});} \ No newline at end of file diff --git a/server/api/condition/index.js b/server/api/condition/index.js index 43e4332..d766d56 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 _0x56f4=['update','delete','destroy','exports','util','path','Router','../../components/interaction/service','./condition.controller','put','isAuthenticated'];(function(_0x594253,_0x44a11c){var _0x1414cd=function(_0x53d738){while(--_0x53d738){_0x594253['push'](_0x594253['shift']());}};_0x1414cd(++_0x44a11c);}(_0x56f4,0xb4));var _0x456f=function(_0x11fc1c,_0xee4019){_0x11fc1c=_0x11fc1c-0x0;var _0x15cf1a=_0x56f4[_0x11fc1c];return _0x15cf1a;};'use strict';var multer=require('multer');var util=require(_0x456f('0x0'));var path=require(_0x456f('0x1'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x456f('0x2')]();var auth=require('../../components/auth/service');var interaction=require(_0x456f('0x3'));var config=require('../../config/environment');var controller=require(_0x456f('0x4'));router[_0x456f('0x5')]('/:id',auth[_0x456f('0x6')](),controller[_0x456f('0x7')]);router[_0x456f('0x8')]('/:id',auth[_0x456f('0x6')](),controller[_0x456f('0x9')]);module[_0x456f('0xa')]=router; \ No newline at end of file +var _0x7774=['../../config/environment','./condition.controller','put','/:id','isAuthenticated','update','delete','exports','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);}(_0x7774,0x119));var _0x4777=function(_0x4fd109,_0x33c503){_0x4fd109=_0x4fd109-0x0;var _0x30f0a6=_0x7774[_0x4fd109];return _0x30f0a6;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x4777('0x0'));var timeout=require(_0x4777('0x1'));var express=require(_0x4777('0x2'));var router=express['Router']();var auth=require(_0x4777('0x3'));var interaction=require(_0x4777('0x4'));var config=require(_0x4777('0x5'));var controller=require(_0x4777('0x6'));router[_0x4777('0x7')](_0x4777('0x8'),auth[_0x4777('0x9')](),controller[_0x4777('0xa')]);router[_0x4777('0xb')](_0x4777('0x8'),auth[_0x4777('0x9')](),controller['destroy']);module[_0x4777('0xc')]=router; \ No newline at end of file diff --git a/server/api/dashboard/dashboard.attributes.js b/server/api/dashboard/dashboard.attributes.js index bf02e24..e6b2b19 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 _0x9a5a=['sequelize','exports','STRING','name'];(function(_0x242566,_0x4ec88d){var _0x1bc410=function(_0x2996fa){while(--_0x2996fa){_0x242566['push'](_0x242566['shift']());}};_0x1bc410(++_0x4ec88d);}(_0x9a5a,0x194));var _0xa9a5=function(_0xf0b2e5,_0x40f80f){_0xf0b2e5=_0xf0b2e5-0x0;var _0xb9fa36=_0x9a5a[_0xf0b2e5];return _0xb9fa36;};'use strict';var Sequelize=require(_0xa9a5('0x0'));module[_0xa9a5('0x1')]={'name':{'type':Sequelize[_0xa9a5('0x2')],'allowNull':![],'unique':_0xa9a5('0x3')},'description':{'type':Sequelize[_0xa9a5('0x2')]}}; \ No newline at end of file +var _0xc1fa=['exports','STRING','name','sequelize'];(function(_0x513302,_0x3bafd7){var _0x53be56=function(_0x337889){while(--_0x337889){_0x513302['push'](_0x513302['shift']());}};_0x53be56(++_0x3bafd7);}(_0xc1fa,0x83));var _0xac1f=function(_0x4358f5,_0x5b1ac6){_0x4358f5=_0x4358f5-0x0;var _0x4d8104=_0xc1fa[_0x4358f5];return _0x4d8104;};'use strict';var Sequelize=require(_0xac1f('0x0'));module[_0xac1f('0x1')]={'name':{'type':Sequelize[_0xac1f('0x2')],'allowNull':![],'unique':_0xac1f('0x3')},'description':{'type':Sequelize[_0xac1f('0x2')]}}; \ No newline at end of file diff --git a/server/api/dashboard/dashboard.controller.js b/server/api/dashboard/dashboard.controller.js index 4419751..2932649 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 _0x16d2=['rawAttributes','find','create','user','get','CustomDashboards','UserProfileSection','userProfileId','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','clone','omit','createdAt','body','updatedAt','includeAll','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','iframe','attrUrl','attrs','value','clock','attrHourFormat','attrTimezone','0.00','attrFontSize','counter','attrMetric','total','attrVoiceQueues','multibar-chart','attrSerie1','attrSerie2','attrSerie3','web-report','attrReport','reportType','attrRefresh','widgetAttributes:\x20%s','addItem','DashboardId','getItems','findOne','DashboardItem','order','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','api','../../config/utils','../../config/environment','../../mysqldb','redis','defaults','localhost','./dashboard.socket','sendStatus','end','status','json','count','offset','limit','Content-Range','reject','save','update','then','destroy','error','stack','name','send','index','map','Dashboard','fieldName','type','key','query','keys','filters','intersection','model','attributes','fields','length','nolimit','sort','where','pick','filter','VIRTUAL','merge','options','include','findAll','catch','show','params'];(function(_0x331dc6,_0x2819fd){var _0x3b4880=function(_0x420f79){while(--_0x420f79){_0x331dc6['push'](_0x331dc6['shift']());}};_0x3b4880(++_0x2819fd);}(_0x16d2,0x123));var _0x216d=function(_0x4b3c7e,_0x58aef9){_0x4b3c7e=_0x4b3c7e-0x0;var _0x3015af=_0x16d2[_0x4b3c7e];return _0x3015af;};'use strict';var pdf=require(_0x216d('0x0'));var emlformat=require(_0x216d('0x1'));var rimraf=require(_0x216d('0x2'));var zipdir=require(_0x216d('0x3'));var jsonpatch=require(_0x216d('0x4'));var rp=require(_0x216d('0x5'));var moment=require(_0x216d('0x6'));var BPromise=require(_0x216d('0x7'));var Mustache=require(_0x216d('0x8'));var util=require('util');var path=require(_0x216d('0x9'));var sox=require(_0x216d('0xa'));var csv=require(_0x216d('0xb'));var ejs=require(_0x216d('0xc'));var fs=require('fs');var _=require(_0x216d('0xd'));var squel=require(_0x216d('0xe'));var crypto=require(_0x216d('0xf'));var jsforce=require(_0x216d('0x10'));var deskjs=require('desk.js');var toCsv=require(_0x216d('0xb'));var querystring=require(_0x216d('0x11'));var Papa=require(_0x216d('0x12'));var Redis=require(_0x216d('0x13'));var authService=require(_0x216d('0x14'));var qs=require(_0x216d('0x15'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x216d('0x16'));var logger=require('../../config/logger')(_0x216d('0x17'));var utils=require(_0x216d('0x18'));var config=require(_0x216d('0x19'));var db=require(_0x216d('0x1a'))['db'];config[_0x216d('0x1b')]=_[_0x216d('0x1c')](config['redis'],{'host':_0x216d('0x1d'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x216d('0x1b')]));require(_0x216d('0x1e'))['register'](socket);function respondWithStatusCode(_0x165c19,_0x322e4b){_0x322e4b=_0x322e4b||0xcc;return function(_0x54a816){if(_0x54a816){return _0x165c19[_0x216d('0x1f')](_0x322e4b);}return _0x165c19['status'](_0x322e4b)[_0x216d('0x20')]();};}function respondWithResult(_0xf571a4,_0x4631b0){_0x4631b0=_0x4631b0||0xc8;return function(_0x23ff86){if(_0x23ff86){return _0xf571a4[_0x216d('0x21')](_0x4631b0)[_0x216d('0x22')](_0x23ff86);}};}function respondWithFilteredResult(_0x467cd5,_0x1496fe){return function(_0x19fdac){if(_0x19fdac){var _0x53d464=_0x19fdac[_0x216d('0x23')],_0x3b60dd=_0x1496fe[_0x216d('0x24')],_0x5124ab=_0x1496fe['offset']+_0x1496fe[_0x216d('0x25')],_0x4ddc51;if(_0x5124ab>=_0x53d464){_0x5124ab=_0x53d464;_0x4ddc51=0xc8;}else{_0x4ddc51=0xce;}_0x467cd5[_0x216d('0x21')](_0x4ddc51);return _0x467cd5['set'](_0x216d('0x26'),_0x3b60dd+'-'+_0x5124ab+'/'+_0x53d464)[_0x216d('0x22')](_0x19fdac);}return null;};}function patchUpdates(_0x430e81){return function(_0x3e9818){try{jsonpatch['apply'](_0x3e9818,_0x430e81,!![]);}catch(_0x20ee7c){return BPromise[_0x216d('0x27')](_0x20ee7c);}return _0x3e9818[_0x216d('0x28')]();};}function saveUpdates(_0x438981,_0x206782){return function(_0x57cfbd){if(_0x57cfbd){return _0x57cfbd[_0x216d('0x29')](_0x438981)[_0x216d('0x2a')](function(_0x188494){return _0x188494;});}return null;};}function removeEntity(_0x2880c6,_0x6fa4b3){return function(_0x54d96f){if(_0x54d96f){return _0x54d96f[_0x216d('0x2b')]()[_0x216d('0x2a')](function(){var _0xb9f1e=_0x54d96f['get']({'plain':!![]});var _0x4ec8a7='CustomDashboards';return db['UserProfileResource']['destroy']({'where':{'type':_0x4ec8a7,'resourceId':_0xb9f1e['id']}})[_0x216d('0x2a')](function(){return _0x54d96f;});})[_0x216d('0x2a')](function(){_0x2880c6[_0x216d('0x21')](0xcc)[_0x216d('0x20')]();});}};}function handleEntityNotFound(_0x46d0ef,_0x47fa6d){return function(_0x5b21d8){if(!_0x5b21d8){_0x46d0ef[_0x216d('0x1f')](0x194);}return _0x5b21d8;};}function handleError(_0x51b2bd,_0x23d1c3){_0x23d1c3=_0x23d1c3||0x1f4;return function(_0x42abbe){logger[_0x216d('0x2c')](_0x42abbe[_0x216d('0x2d')]);if(_0x42abbe[_0x216d('0x2e')]){delete _0x42abbe[_0x216d('0x2e')];}_0x51b2bd[_0x216d('0x21')](_0x23d1c3)[_0x216d('0x2f')](_0x42abbe);};}exports[_0x216d('0x30')]=function(_0x28f56a,_0x11be90){var _0x260134={},_0x4537fd={},_0x483324={'count':0x0,'rows':[]};var _0x38c452=_[_0x216d('0x31')](db[_0x216d('0x32')]['rawAttributes'],function(_0x3b312f){return{'name':_0x3b312f[_0x216d('0x33')],'type':_0x3b312f[_0x216d('0x34')][_0x216d('0x35')]};});_0x4537fd['model']=_[_0x216d('0x31')](_0x38c452,_0x216d('0x2e'));_0x4537fd[_0x216d('0x36')]=_[_0x216d('0x37')](_0x28f56a[_0x216d('0x36')]);_0x4537fd[_0x216d('0x38')]=_[_0x216d('0x39')](_0x4537fd[_0x216d('0x3a')],_0x4537fd[_0x216d('0x36')]);_0x260134[_0x216d('0x3b')]=_[_0x216d('0x39')](_0x4537fd['model'],qs[_0x216d('0x3c')](_0x28f56a[_0x216d('0x36')][_0x216d('0x3c')]));_0x260134['attributes']=_0x260134[_0x216d('0x3b')][_0x216d('0x3d')]?_0x260134['attributes']:_0x4537fd[_0x216d('0x3a')];if(!_0x28f56a['query']['hasOwnProperty'](_0x216d('0x3e'))){_0x260134[_0x216d('0x25')]=qs[_0x216d('0x25')](_0x28f56a[_0x216d('0x36')]['limit']);_0x260134['offset']=qs['offset'](_0x28f56a[_0x216d('0x36')][_0x216d('0x24')]);}_0x260134['order']=qs[_0x216d('0x3f')](_0x28f56a[_0x216d('0x36')]['sort']);_0x260134[_0x216d('0x40')]=qs[_0x216d('0x38')](_[_0x216d('0x41')](_0x28f56a[_0x216d('0x36')],_0x4537fd[_0x216d('0x38')]));if(_0x28f56a[_0x216d('0x36')][_0x216d('0x42')]){_0x260134[_0x216d('0x40')]=_['merge'](_0x260134['where'],{'$or':_[_0x216d('0x31')](_0x38c452,function(_0x2be24f){if(_0x2be24f['type']!==_0x216d('0x43')){var _0x377c4a={};_0x377c4a[_0x2be24f[_0x216d('0x2e')]]={'$like':'%'+_0x28f56a['query'][_0x216d('0x42')]+'%'};return _0x377c4a;}})});}_0x260134=_[_0x216d('0x44')]({},_0x260134,_0x28f56a[_0x216d('0x45')]);var _0x1b72ee={'where':_0x260134['where']};return db[_0x216d('0x32')][_0x216d('0x23')](_0x1b72ee)['then'](function(_0x37bf4a){_0x483324[_0x216d('0x23')]=_0x37bf4a;if(_0x28f56a['query']['includeAll']){_0x260134[_0x216d('0x46')]=[{'all':!![]}];}return db[_0x216d('0x32')][_0x216d('0x47')](_0x260134);})['then'](function(_0x3e361a){_0x483324['rows']=_0x3e361a;return _0x483324;})['then'](respondWithFilteredResult(_0x11be90,_0x260134))[_0x216d('0x48')](handleError(_0x11be90,null));};exports[_0x216d('0x49')]=function(_0xac81f,_0x5ddaeb){var _0xaccf45={'raw':![],'where':{'id':_0xac81f[_0x216d('0x4a')]['id']}},_0x488de3={};_0x488de3[_0x216d('0x3a')]=_[_0x216d('0x37')](db['Dashboard'][_0x216d('0x4b')]);_0x488de3[_0x216d('0x36')]=_[_0x216d('0x37')](_0xac81f[_0x216d('0x36')]);_0x488de3['filters']=_['intersection'](_0x488de3['model'],_0x488de3[_0x216d('0x36')]);_0xaccf45[_0x216d('0x3b')]=_[_0x216d('0x39')](_0x488de3[_0x216d('0x3a')],qs[_0x216d('0x3c')](_0xac81f[_0x216d('0x36')][_0x216d('0x3c')]));_0xaccf45[_0x216d('0x3b')]=_0xaccf45['attributes'][_0x216d('0x3d')]?_0xaccf45[_0x216d('0x3b')]:_0x488de3[_0x216d('0x3a')];if(_0xac81f[_0x216d('0x36')]['includeAll']){_0xaccf45[_0x216d('0x46')]=[{'all':!![]}];}_0xaccf45=_['merge']({},_0xaccf45,_0xac81f[_0x216d('0x45')]);return db[_0x216d('0x32')][_0x216d('0x4c')](_0xaccf45)['then'](handleEntityNotFound(_0x5ddaeb,null))['then'](respondWithResult(_0x5ddaeb,null))[_0x216d('0x48')](handleError(_0x5ddaeb,null));};exports[_0x216d('0x4d')]=function(_0x3932a3,_0x1340fe){return db[_0x216d('0x32')][_0x216d('0x4d')](_0x3932a3['body'],{})['then'](function(_0x26209c){var _0x542630=_0x3932a3[_0x216d('0x4e')][_0x216d('0x4f')]({'plain':!![]});if(!_0x542630)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x542630['role']==='user'){var _0x4bac14=_0x26209c[_0x216d('0x4f')]({'plain':!![]});var _0x318f70=_0x216d('0x50');return db[_0x216d('0x51')][_0x216d('0x4c')]({'where':{'name':_0x318f70,'userProfileId':_0x542630[_0x216d('0x52')]},'raw':!![]})[_0x216d('0x2a')](function(_0x4a39e4){if(_0x4a39e4&&_0x4a39e4[_0x216d('0x53')]===0x0){return db[_0x216d('0x54')][_0x216d('0x4d')]({'name':_0x4bac14['name'],'resourceId':_0x4bac14['id'],'type':_0x4a39e4[_0x216d('0x2e')],'sectionId':_0x4a39e4['id']},{})[_0x216d('0x2a')](function(){return _0x26209c;});}else{return _0x26209c;}})[_0x216d('0x48')](function(_0x3ae305){logger['error'](_0x216d('0x55'),_0x3ae305);throw _0x3ae305;});}return _0x26209c;})[_0x216d('0x2a')](respondWithResult(_0x1340fe,0xc9))[_0x216d('0x48')](handleError(_0x1340fe,null));};exports[_0x216d('0x56')]=function(_0x4d7705,_0x151106){var _0x2e46d2={'where':{'id':_0x4d7705[_0x216d('0x4a')]['id']}},_0x47cfcd={};_0x47cfcd['model']=_[_0x216d('0x37')](db[_0x216d('0x32')][_0x216d('0x4b')]);_0x2e46d2[_0x216d('0x3b')]=_[_0x216d('0x39')](_0x47cfcd[_0x216d('0x3a')],qs[_0x216d('0x3c')](_0x4d7705[_0x216d('0x36')][_0x216d('0x3c')]));_0x2e46d2['attributes']=_0x2e46d2[_0x216d('0x3b')][_0x216d('0x3d')]?_0x2e46d2['attributes']:_0x47cfcd[_0x216d('0x3a')];if(_0x4d7705[_0x216d('0x36')]['includeAll']){_0x2e46d2['include']=[{'all':!![]}];}_0x2e46d2=_[_0x216d('0x44')]({},_0x2e46d2,_0x4d7705['options']);return db[_0x216d('0x32')][_0x216d('0x4c')](_0x2e46d2)[_0x216d('0x2a')](handleEntityNotFound(_0x151106,null))['then'](function(_0x3acd4b){if(_0x3acd4b){var _0x5112ea=_0x3acd4b['get']({'plain':!![]});_0x5112ea=qs[_0x216d('0x57')](_0x5112ea,['id',_0x216d('0x58'),'updatedAt']);_0x4d7705[_0x216d('0x59')]=_[_0x216d('0x57')](_0x4d7705[_0x216d('0x59')],['id',_0x216d('0x58'),_0x216d('0x5a')]);return db[_0x216d('0x32')]['create'](_['merge'](_0x5112ea,_0x4d7705[_0x216d('0x59')]),{'include':_0x4d7705[_0x216d('0x36')][_0x216d('0x5b')]?[{'all':!![]}]:undefined})[_0x216d('0x2a')](function(_0x16742c){var _0x22eac7=_0x4d7705[_0x216d('0x4e')][_0x216d('0x4f')]({'plain':!![]});if(!_0x22eac7)throw new Error(_0x216d('0x5c'));if(_0x22eac7[_0x216d('0x5d')]===_0x216d('0x4e')){var _0x13da5c=_0x16742c['get']({'plain':!![]});var _0x563f11=_0x216d('0x50');return db[_0x216d('0x51')]['find']({'where':{'name':_0x563f11,'userProfileId':_0x22eac7[_0x216d('0x52')]},'raw':!![]})['then'](function(_0x5a42c7){if(_0x5a42c7&&_0x5a42c7[_0x216d('0x53')]===0x0){return db[_0x216d('0x54')][_0x216d('0x4d')]({'name':_0x13da5c[_0x216d('0x2e')],'resourceId':_0x13da5c['id'],'type':_0x5a42c7[_0x216d('0x2e')],'sectionId':_0x5a42c7['id']},{})[_0x216d('0x2a')](function(){return _0x16742c;});}else{return _0x16742c;}})[_0x216d('0x48')](function(_0x1c6639){logger[_0x216d('0x2c')](_0x216d('0x55'),_0x1c6639);throw _0x1c6639;});}return _0x16742c;});}})[_0x216d('0x2a')](respondWithResult(_0x151106,0xc9))[_0x216d('0x48')](handleError(_0x151106,null));};exports[_0x216d('0x29')]=function(_0x245137,_0x342561){if(_0x245137[_0x216d('0x59')]['id']){delete _0x245137[_0x216d('0x59')]['id'];}return db[_0x216d('0x32')][_0x216d('0x4c')]({'where':{'id':_0x245137[_0x216d('0x4a')]['id']}})[_0x216d('0x2a')](handleEntityNotFound(_0x342561,null))[_0x216d('0x2a')](saveUpdates(_0x245137['body'],null))[_0x216d('0x2a')](respondWithResult(_0x342561,null))['catch'](handleError(_0x342561,null));};exports[_0x216d('0x2b')]=function(_0x51507b,_0x13e00d){return db[_0x216d('0x32')]['find']({'where':{'id':_0x51507b[_0x216d('0x4a')]['id']}})[_0x216d('0x2a')](handleEntityNotFound(_0x13e00d,null))[_0x216d('0x2a')](removeEntity(_0x13e00d,null))[_0x216d('0x48')](handleError(_0x13e00d,null));};function widgetAttributes(_0x215187){try{switch(_0x215187[_0x216d('0x34')]){case _0x216d('0x5e'):return[{'name':_0x216d('0x5f'),'value':_0x215187[_0x216d('0x5f')]||(_0x215187['attrs']&&_0x215187[_0x216d('0x60')][0x0]?_0x215187[_0x216d('0x60')][0x0][_0x216d('0x61')]:undefined)||'https://'}];case'custom':return[{'name':'attrPath','value':_0x215187['attrPath']||(_0x215187[_0x216d('0x60')]&&_0x215187['attrs'][0x0]?_0x215187[_0x216d('0x60')][0x0][_0x216d('0x61')]:undefined)||''}];case _0x216d('0x62'):return[{'name':_0x216d('0x63'),'value':_0x215187[_0x216d('0x63')]||(_0x215187[_0x216d('0x60')]&&_0x215187[_0x216d('0x60')][0x0]?_0x215187[_0x216d('0x60')][0x0][_0x216d('0x61')]:undefined)||'HH:mm:ss'},{'name':_0x216d('0x64'),'value':_0x215187[_0x216d('0x64')]||(_0x215187['attrs']&&_0x215187[_0x216d('0x60')][0x1]?_0x215187[_0x216d('0x60')][0x1][_0x216d('0x61')]:undefined)||_0x216d('0x65')},{'name':_0x216d('0x66'),'value':_0x215187[_0x216d('0x66')]||(_0x215187['attrs']&&_0x215187['attrs'][0x2]?_0x215187[_0x216d('0x60')][0x2]['value']:undefined)||0xc}];case _0x216d('0x67'):return[{'name':_0x216d('0x68'),'value':_0x215187[_0x216d('0x68')]||(_0x215187['attrs']&&_0x215187['attrs'][0x0]?_0x215187['attrs'][0x0][_0x216d('0x61')]:undefined)||_0x216d('0x69')},{'name':_0x216d('0x6a'),'value':_0x215187[_0x216d('0x6a')]||(_0x215187['attrs']&&_0x215187[_0x216d('0x60')][0x1]?_0x215187[_0x216d('0x60')][0x1][_0x216d('0x61')]:undefined)||[]},{'name':'attrFontSize','value':_0x215187['attrFontSize']||(_0x215187[_0x216d('0x60')]&&_0x215187[_0x216d('0x60')][0x2]?_0x215187[_0x216d('0x60')][0x2][_0x216d('0x61')]:undefined)||0x14}];case _0x216d('0x6b'):case'pie-chart':return[{'name':_0x216d('0x6c'),'value':_0x215187[_0x216d('0x6c')]||(_0x215187[_0x216d('0x60')]&&_0x215187[_0x216d('0x60')][0x0]?_0x215187['attrs'][0x0][_0x216d('0x61')]:undefined)||'total'},{'name':_0x216d('0x6d'),'value':_0x215187['attrSerie2']||(_0x215187[_0x216d('0x60')]&&_0x215187[_0x216d('0x60')][0x1]?_0x215187[_0x216d('0x60')][0x1][_0x216d('0x61')]:undefined)||null},{'name':_0x216d('0x6e'),'value':_0x215187['attrSerie3']||(_0x215187[_0x216d('0x60')]&&_0x215187['attrs'][0x2]?_0x215187['attrs'][0x2]['value']:undefined)||null},{'name':'attrVoiceQueues','value':_0x215187[_0x216d('0x6a')]||(_0x215187[_0x216d('0x60')]&&_0x215187[_0x216d('0x60')][0x3]?_0x215187['attrs'][0x3]['value']:undefined)||[]}];case _0x216d('0x6f'):return[{'name':_0x216d('0x70'),'type':_0x215187[_0x216d('0x71')]||(_0x215187[_0x216d('0x60')]&&_0x215187[_0x216d('0x60')][0x0]?_0x215187['attrs'][0x0]['type']:undefined)||null,'value':_0x215187[_0x216d('0x70')]||(_0x215187['attrs']&&_0x215187[_0x216d('0x60')][0x0]?_0x215187['attrs'][0x0][_0x216d('0x61')]:undefined)||null},{'name':_0x216d('0x72'),'value':_0x215187[_0x216d('0x72')]||(_0x215187[_0x216d('0x60')]&&_0x215187['attrs'][0x1]?_0x215187['attrs'][0x1][_0x216d('0x61')]:undefined)||0x0}];default:return[];}}catch(_0xf2b2e3){logger[_0x216d('0x2c')](_0x216d('0x73'),JSON['stringify'](_0xf2b2e3));return[];}}exports[_0x216d('0x74')]=function(_0x3116ac,_0xd83874,_0x4c0469){if(_0x3116ac['body']['id']){delete _0x3116ac[_0x216d('0x59')]['id'];}return db['Dashboard'][_0x216d('0x4c')]({'where':{'id':_0x3116ac[_0x216d('0x4a')]['id']}})['then'](handleEntityNotFound(_0xd83874,null))['then'](function(_0x3000c4){if(_0x3000c4){_0x3116ac[_0x216d('0x59')][_0x216d('0x75')]=_0x3000c4['id'];_0x3116ac[_0x216d('0x59')][_0x216d('0x60')]=widgetAttributes(_0x3116ac[_0x216d('0x59')]);return db['DashboardItem']['create'](_0x3116ac[_0x216d('0x59')]);}})[_0x216d('0x2a')](respondWithResult(_0xd83874,null))[_0x216d('0x48')](handleError(_0xd83874,null));};exports[_0x216d('0x76')]=function(_0x1ddf53,_0x18beca,_0x46bda3){var _0xc64a7f={};var _0x1a401c={};var _0x2cbf1c;var _0x561de3;return db[_0x216d('0x32')][_0x216d('0x77')]({'where':{'id':_0x1ddf53[_0x216d('0x4a')]['id']}})[_0x216d('0x2a')](handleEntityNotFound(_0x18beca,null))[_0x216d('0x2a')](function(_0x487428){if(_0x487428){_0x2cbf1c=_0x487428;_0x1a401c[_0x216d('0x3a')]=_['keys'](db[_0x216d('0x78')]['rawAttributes']);_0x1a401c[_0x216d('0x36')]=_['keys'](_0x1ddf53['query']);_0x1a401c[_0x216d('0x38')]=_['intersection'](_0x1a401c['model'],_0x1a401c['query']);_0xc64a7f[_0x216d('0x3b')]=_['intersection'](_0x1a401c[_0x216d('0x3a')],qs['fields'](_0x1ddf53['query']['fields']));_0xc64a7f[_0x216d('0x3b')]=_0xc64a7f[_0x216d('0x3b')][_0x216d('0x3d')]?_0xc64a7f['attributes']:_0x1a401c[_0x216d('0x3a')];_0xc64a7f[_0x216d('0x79')]=qs[_0x216d('0x3f')](_0x1ddf53[_0x216d('0x36')][_0x216d('0x3f')]);_0xc64a7f[_0x216d('0x40')]=qs['filters'](_[_0x216d('0x41')](_0x1ddf53['query'],_0x1a401c[_0x216d('0x38')]));if(_0x1ddf53[_0x216d('0x36')][_0x216d('0x42')]){_0xc64a7f[_0x216d('0x40')]=_[_0x216d('0x44')](_0xc64a7f[_0x216d('0x40')],{'$or':_[_0x216d('0x31')](_0xc64a7f[_0x216d('0x3b')],function(_0x228cd5){var _0x1e1696={};_0x1e1696[_0x228cd5]={'$like':'%'+_0x1ddf53[_0x216d('0x36')][_0x216d('0x42')]+'%'};return _0x1e1696;})});}_0xc64a7f=_[_0x216d('0x44')]({},_0xc64a7f,_0x1ddf53[_0x216d('0x45')]);return _0x2cbf1c[_0x216d('0x76')](_0xc64a7f);}})[_0x216d('0x2a')](function(_0x575d24){if(_0x575d24){_0x561de3=_0x575d24[_0x216d('0x3d')];if(!_0x1ddf53[_0x216d('0x36')]['hasOwnProperty'](_0x216d('0x3e'))){_0xc64a7f['limit']=qs[_0x216d('0x25')](_0x1ddf53[_0x216d('0x36')][_0x216d('0x25')]);_0xc64a7f['offset']=qs[_0x216d('0x24')](_0x1ddf53['query'][_0x216d('0x24')]);}return _0x2cbf1c[_0x216d('0x76')](_0xc64a7f);}})[_0x216d('0x2a')](function(_0x1e1969){if(_0x1e1969){return _0x1e1969?{'count':_0x561de3,'rows':_0x1e1969}:null;}})['then'](respondWithResult(_0x18beca,null))[_0x216d('0x48')](handleError(_0x18beca,null));}; \ No newline at end of file +var _0x2be0=['find','userProfileId','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','clone','params','includeAll','createdAt','updatedAt','UserProfileSection','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','reportType','attrReport','attrRefresh','addItem','DashboardId','DashboardItem','findOne','pick','getItems','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','path','sox','to-csv','ejs','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../mysqldb','redis','defaults','localhost','./dashboard.socket','register','sendStatus','status','json','count','offset','limit','set','Content-Range','apply','reject','save','update','destroy','then','get','end','error','stack','name','send','rawAttributes','fieldName','type','key','model','map','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','VIRTUAL','filter','merge','options','include','rows','catch','show','keys','Dashboard','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','CustomDashboards'];(function(_0x138adb,_0x193fee){var _0x1b27f2=function(_0x5e97a2){while(--_0x5e97a2){_0x138adb['push'](_0x138adb['shift']());}};_0x1b27f2(++_0x193fee);}(_0x2be0,0x128));var _0x02be=function(_0x543084,_0x4337f5){_0x543084=_0x543084-0x0;var _0x306a57=_0x2be0[_0x543084];return _0x306a57;};'use strict';var pdf=require(_0x02be('0x0'));var emlformat=require(_0x02be('0x1'));var rimraf=require(_0x02be('0x2'));var zipdir=require(_0x02be('0x3'));var jsonpatch=require(_0x02be('0x4'));var rp=require('request-promise');var moment=require(_0x02be('0x5'));var BPromise=require(_0x02be('0x6'));var Mustache=require(_0x02be('0x7'));var util=require('util');var path=require(_0x02be('0x8'));var sox=require(_0x02be('0x9'));var csv=require(_0x02be('0xa'));var ejs=require(_0x02be('0xb'));var fs=require('fs');var _=require('lodash');var squel=require(_0x02be('0xc'));var crypto=require(_0x02be('0xd'));var jsforce=require(_0x02be('0xe'));var deskjs=require(_0x02be('0xf'));var toCsv=require(_0x02be('0xa'));var querystring=require(_0x02be('0x10'));var Papa=require(_0x02be('0x11'));var Redis=require(_0x02be('0x12'));var authService=require(_0x02be('0x13'));var qs=require(_0x02be('0x14'));var as=require(_0x02be('0x15'));var hardwareService=require(_0x02be('0x16'));var logger=require(_0x02be('0x17'))(_0x02be('0x18'));var utils=require('../../config/utils');var config=require(_0x02be('0x19'));var db=require(_0x02be('0x1a'))['db'];config[_0x02be('0x1b')]=_[_0x02be('0x1c')](config['redis'],{'host':_0x02be('0x1d'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x02be('0x1b')]));require(_0x02be('0x1e'))[_0x02be('0x1f')](socket);function respondWithStatusCode(_0x3179b3,_0x36ff34){_0x36ff34=_0x36ff34||0xcc;return function(_0x27d450){if(_0x27d450){return _0x3179b3[_0x02be('0x20')](_0x36ff34);}return _0x3179b3[_0x02be('0x21')](_0x36ff34)['end']();};}function respondWithResult(_0x3aa477,_0x242dac){_0x242dac=_0x242dac||0xc8;return function(_0x5ed522){if(_0x5ed522){return _0x3aa477['status'](_0x242dac)[_0x02be('0x22')](_0x5ed522);}};}function respondWithFilteredResult(_0x4888f1,_0x578d38){return function(_0x410584){if(_0x410584){var _0x492f93=_0x410584[_0x02be('0x23')],_0x2afd83=_0x578d38[_0x02be('0x24')],_0x1eadc5=_0x578d38[_0x02be('0x24')]+_0x578d38[_0x02be('0x25')],_0x172a40;if(_0x1eadc5>=_0x492f93){_0x1eadc5=_0x492f93;_0x172a40=0xc8;}else{_0x172a40=0xce;}_0x4888f1['status'](_0x172a40);return _0x4888f1[_0x02be('0x26')](_0x02be('0x27'),_0x2afd83+'-'+_0x1eadc5+'/'+_0x492f93)[_0x02be('0x22')](_0x410584);}return null;};}function patchUpdates(_0xb0d70a){return function(_0x423d1d){try{jsonpatch[_0x02be('0x28')](_0x423d1d,_0xb0d70a,!![]);}catch(_0x114b79){return BPromise[_0x02be('0x29')](_0x114b79);}return _0x423d1d[_0x02be('0x2a')]();};}function saveUpdates(_0x26a8ec,_0x2357ab){return function(_0x55ffc9){if(_0x55ffc9){return _0x55ffc9[_0x02be('0x2b')](_0x26a8ec)['then'](function(_0x2b73ae){return _0x2b73ae;});}return null;};}function removeEntity(_0x11ea4e,_0x7f4b6e){return function(_0x3c644b){if(_0x3c644b){return _0x3c644b[_0x02be('0x2c')]()[_0x02be('0x2d')](function(){var _0x48c6d2=_0x3c644b[_0x02be('0x2e')]({'plain':!![]});var _0x301348='CustomDashboards';return db['UserProfileResource'][_0x02be('0x2c')]({'where':{'type':_0x301348,'resourceId':_0x48c6d2['id']}})[_0x02be('0x2d')](function(){return _0x3c644b;});})[_0x02be('0x2d')](function(){_0x11ea4e[_0x02be('0x21')](0xcc)[_0x02be('0x2f')]();});}};}function handleEntityNotFound(_0x4f3650,_0x462098){return function(_0x9d8baa){if(!_0x9d8baa){_0x4f3650[_0x02be('0x20')](0x194);}return _0x9d8baa;};}function handleError(_0x2c6ba4,_0x3a59e0){_0x3a59e0=_0x3a59e0||0x1f4;return function(_0x251ee8){logger[_0x02be('0x30')](_0x251ee8[_0x02be('0x31')]);if(_0x251ee8[_0x02be('0x32')]){delete _0x251ee8['name'];}_0x2c6ba4[_0x02be('0x21')](_0x3a59e0)[_0x02be('0x33')](_0x251ee8);};}exports['index']=function(_0x261655,_0x5117ed){var _0x10c891={},_0x5122d1={},_0x4841eb={'count':0x0,'rows':[]};var _0x142856=_['map'](db['Dashboard'][_0x02be('0x34')],function(_0x19c215){return{'name':_0x19c215[_0x02be('0x35')],'type':_0x19c215[_0x02be('0x36')][_0x02be('0x37')]};});_0x5122d1[_0x02be('0x38')]=_[_0x02be('0x39')](_0x142856,'name');_0x5122d1[_0x02be('0x3a')]=_['keys'](_0x261655[_0x02be('0x3a')]);_0x5122d1[_0x02be('0x3b')]=_[_0x02be('0x3c')](_0x5122d1[_0x02be('0x38')],_0x5122d1['query']);_0x10c891[_0x02be('0x3d')]=_[_0x02be('0x3c')](_0x5122d1[_0x02be('0x38')],qs['fields'](_0x261655[_0x02be('0x3a')][_0x02be('0x3e')]));_0x10c891['attributes']=_0x10c891[_0x02be('0x3d')][_0x02be('0x3f')]?_0x10c891[_0x02be('0x3d')]:_0x5122d1[_0x02be('0x38')];if(!_0x261655[_0x02be('0x3a')][_0x02be('0x40')](_0x02be('0x41'))){_0x10c891[_0x02be('0x25')]=qs[_0x02be('0x25')](_0x261655[_0x02be('0x3a')][_0x02be('0x25')]);_0x10c891['offset']=qs[_0x02be('0x24')](_0x261655[_0x02be('0x3a')]['offset']);}_0x10c891[_0x02be('0x42')]=qs[_0x02be('0x43')](_0x261655[_0x02be('0x3a')][_0x02be('0x43')]);_0x10c891[_0x02be('0x44')]=qs[_0x02be('0x3b')](_['pick'](_0x261655[_0x02be('0x3a')],_0x5122d1['filters']));if(_0x261655[_0x02be('0x3a')]['filter']){_0x10c891[_0x02be('0x44')]=_['merge'](_0x10c891[_0x02be('0x44')],{'$or':_[_0x02be('0x39')](_0x142856,function(_0x14b9e0){if(_0x14b9e0[_0x02be('0x36')]!==_0x02be('0x45')){var _0x28eebc={};_0x28eebc[_0x14b9e0[_0x02be('0x32')]]={'$like':'%'+_0x261655[_0x02be('0x3a')][_0x02be('0x46')]+'%'};return _0x28eebc;}})});}_0x10c891=_[_0x02be('0x47')]({},_0x10c891,_0x261655[_0x02be('0x48')]);var _0x1541ef={'where':_0x10c891[_0x02be('0x44')]};return db['Dashboard'][_0x02be('0x23')](_0x1541ef)[_0x02be('0x2d')](function(_0x577b0d){_0x4841eb[_0x02be('0x23')]=_0x577b0d;if(_0x261655[_0x02be('0x3a')]['includeAll']){_0x10c891[_0x02be('0x49')]=[{'all':!![]}];}return db['Dashboard']['findAll'](_0x10c891);})[_0x02be('0x2d')](function(_0x322f4e){_0x4841eb[_0x02be('0x4a')]=_0x322f4e;return _0x4841eb;})[_0x02be('0x2d')](respondWithFilteredResult(_0x5117ed,_0x10c891))[_0x02be('0x4b')](handleError(_0x5117ed,null));};exports[_0x02be('0x4c')]=function(_0x581713,_0x9828b3){var _0x25b087={'raw':![],'where':{'id':_0x581713['params']['id']}},_0x512adc={};_0x512adc[_0x02be('0x38')]=_[_0x02be('0x4d')](db[_0x02be('0x4e')][_0x02be('0x34')]);_0x512adc[_0x02be('0x3a')]=_[_0x02be('0x4d')](_0x581713[_0x02be('0x3a')]);_0x512adc[_0x02be('0x3b')]=_[_0x02be('0x3c')](_0x512adc[_0x02be('0x38')],_0x512adc['query']);_0x25b087[_0x02be('0x3d')]=_[_0x02be('0x3c')](_0x512adc[_0x02be('0x38')],qs[_0x02be('0x3e')](_0x581713['query']['fields']));_0x25b087['attributes']=_0x25b087[_0x02be('0x3d')][_0x02be('0x3f')]?_0x25b087['attributes']:_0x512adc[_0x02be('0x38')];if(_0x581713['query']['includeAll']){_0x25b087[_0x02be('0x49')]=[{'all':!![]}];}_0x25b087=_[_0x02be('0x47')]({},_0x25b087,_0x581713[_0x02be('0x48')]);return db[_0x02be('0x4e')]['find'](_0x25b087)[_0x02be('0x2d')](handleEntityNotFound(_0x9828b3,null))[_0x02be('0x2d')](respondWithResult(_0x9828b3,null))['catch'](handleError(_0x9828b3,null));};exports[_0x02be('0x4f')]=function(_0x48711a,_0x1708da){return db[_0x02be('0x4e')]['create'](_0x48711a[_0x02be('0x50')],{})['then'](function(_0x5eb3cd){var _0x456e76=_0x48711a[_0x02be('0x51')][_0x02be('0x2e')]({'plain':!![]});if(!_0x456e76)throw new Error(_0x02be('0x52'));if(_0x456e76[_0x02be('0x53')]==='user'){var _0x4c57cf=_0x5eb3cd[_0x02be('0x2e')]({'plain':!![]});var _0x5bad18=_0x02be('0x54');return db['UserProfileSection'][_0x02be('0x55')]({'where':{'name':_0x5bad18,'userProfileId':_0x456e76[_0x02be('0x56')]},'raw':!![]})[_0x02be('0x2d')](function(_0x2ca651){if(_0x2ca651&&_0x2ca651[_0x02be('0x57')]===0x0){return db[_0x02be('0x58')]['create']({'name':_0x4c57cf['name'],'resourceId':_0x4c57cf['id'],'type':_0x2ca651['name'],'sectionId':_0x2ca651['id']},{})[_0x02be('0x2d')](function(){return _0x5eb3cd;});}else{return _0x5eb3cd;}})[_0x02be('0x4b')](function(_0x5b3d6c){logger[_0x02be('0x30')](_0x02be('0x59'),_0x5b3d6c);throw _0x5b3d6c;});}return _0x5eb3cd;})[_0x02be('0x2d')](respondWithResult(_0x1708da,0xc9))[_0x02be('0x4b')](handleError(_0x1708da,null));};exports[_0x02be('0x5a')]=function(_0x169148,_0x143ea7){var _0x399186={'where':{'id':_0x169148[_0x02be('0x5b')]['id']}},_0x20c7b8={};_0x20c7b8[_0x02be('0x38')]=_[_0x02be('0x4d')](db[_0x02be('0x4e')]['rawAttributes']);_0x399186[_0x02be('0x3d')]=_['intersection'](_0x20c7b8[_0x02be('0x38')],qs[_0x02be('0x3e')](_0x169148['query'][_0x02be('0x3e')]));_0x399186[_0x02be('0x3d')]=_0x399186[_0x02be('0x3d')][_0x02be('0x3f')]?_0x399186['attributes']:_0x20c7b8['model'];if(_0x169148[_0x02be('0x3a')][_0x02be('0x5c')]){_0x399186[_0x02be('0x49')]=[{'all':!![]}];}_0x399186=_[_0x02be('0x47')]({},_0x399186,_0x169148['options']);return db[_0x02be('0x4e')][_0x02be('0x55')](_0x399186)[_0x02be('0x2d')](handleEntityNotFound(_0x143ea7,null))[_0x02be('0x2d')](function(_0x5ac5e0){if(_0x5ac5e0){var _0x5a4dcb=_0x5ac5e0[_0x02be('0x2e')]({'plain':!![]});_0x5a4dcb=qs['omit'](_0x5a4dcb,['id',_0x02be('0x5d'),'updatedAt']);_0x169148[_0x02be('0x50')]=_['omit'](_0x169148[_0x02be('0x50')],['id',_0x02be('0x5d'),_0x02be('0x5e')]);return db['Dashboard'][_0x02be('0x4f')](_[_0x02be('0x47')](_0x5a4dcb,_0x169148[_0x02be('0x50')]),{'include':_0x169148[_0x02be('0x3a')][_0x02be('0x5c')]?[{'all':!![]}]:undefined})[_0x02be('0x2d')](function(_0x5b3ff8){var _0x5936ff=_0x169148[_0x02be('0x51')][_0x02be('0x2e')]({'plain':!![]});if(!_0x5936ff)throw new Error(_0x02be('0x52'));if(_0x5936ff[_0x02be('0x53')]===_0x02be('0x51')){var _0x46e466=_0x5b3ff8[_0x02be('0x2e')]({'plain':!![]});var _0x4e0e5f=_0x02be('0x54');return db[_0x02be('0x5f')][_0x02be('0x55')]({'where':{'name':_0x4e0e5f,'userProfileId':_0x5936ff[_0x02be('0x56')]},'raw':!![]})[_0x02be('0x2d')](function(_0x381f7b){if(_0x381f7b&&_0x381f7b[_0x02be('0x57')]===0x0){return db['UserProfileResource'][_0x02be('0x4f')]({'name':_0x46e466[_0x02be('0x32')],'resourceId':_0x46e466['id'],'type':_0x381f7b[_0x02be('0x32')],'sectionId':_0x381f7b['id']},{})[_0x02be('0x2d')](function(){return _0x5b3ff8;});}else{return _0x5b3ff8;}})[_0x02be('0x4b')](function(_0x5bf3b8){logger[_0x02be('0x30')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x5bf3b8);throw _0x5bf3b8;});}return _0x5b3ff8;});}})[_0x02be('0x2d')](respondWithResult(_0x143ea7,0xc9))[_0x02be('0x4b')](handleError(_0x143ea7,null));};exports[_0x02be('0x2b')]=function(_0x377c38,_0x818180){if(_0x377c38[_0x02be('0x50')]['id']){delete _0x377c38[_0x02be('0x50')]['id'];}return db[_0x02be('0x4e')][_0x02be('0x55')]({'where':{'id':_0x377c38[_0x02be('0x5b')]['id']}})['then'](handleEntityNotFound(_0x818180,null))[_0x02be('0x2d')](saveUpdates(_0x377c38[_0x02be('0x50')],null))[_0x02be('0x2d')](respondWithResult(_0x818180,null))[_0x02be('0x4b')](handleError(_0x818180,null));};exports['destroy']=function(_0x13d795,_0x1d514c){return db[_0x02be('0x4e')][_0x02be('0x55')]({'where':{'id':_0x13d795[_0x02be('0x5b')]['id']}})[_0x02be('0x2d')](handleEntityNotFound(_0x1d514c,null))[_0x02be('0x2d')](removeEntity(_0x1d514c,null))[_0x02be('0x4b')](handleError(_0x1d514c,null));};function widgetAttributes(_0x3cb556){try{switch(_0x3cb556[_0x02be('0x36')]){case _0x02be('0x60'):return[{'name':_0x02be('0x61'),'value':_0x3cb556['attrUrl']||(_0x3cb556[_0x02be('0x62')]&&_0x3cb556[_0x02be('0x62')][0x0]?_0x3cb556[_0x02be('0x62')][0x0][_0x02be('0x63')]:undefined)||_0x02be('0x64')}];case _0x02be('0x65'):return[{'name':_0x02be('0x66'),'value':_0x3cb556['attrPath']||(_0x3cb556[_0x02be('0x62')]&&_0x3cb556['attrs'][0x0]?_0x3cb556[_0x02be('0x62')][0x0][_0x02be('0x63')]:undefined)||''}];case _0x02be('0x67'):return[{'name':_0x02be('0x68'),'value':_0x3cb556[_0x02be('0x68')]||(_0x3cb556[_0x02be('0x62')]&&_0x3cb556[_0x02be('0x62')][0x0]?_0x3cb556[_0x02be('0x62')][0x0][_0x02be('0x63')]:undefined)||_0x02be('0x69')},{'name':'attrTimezone','value':_0x3cb556[_0x02be('0x6a')]||(_0x3cb556[_0x02be('0x62')]&&_0x3cb556[_0x02be('0x62')][0x1]?_0x3cb556['attrs'][0x1][_0x02be('0x63')]:undefined)||_0x02be('0x6b')},{'name':_0x02be('0x6c'),'value':_0x3cb556[_0x02be('0x6c')]||(_0x3cb556['attrs']&&_0x3cb556[_0x02be('0x62')][0x2]?_0x3cb556[_0x02be('0x62')][0x2][_0x02be('0x63')]:undefined)||0xc}];case _0x02be('0x6d'):return[{'name':_0x02be('0x6e'),'value':_0x3cb556[_0x02be('0x6e')]||(_0x3cb556['attrs']&&_0x3cb556[_0x02be('0x62')][0x0]?_0x3cb556['attrs'][0x0][_0x02be('0x63')]:undefined)||_0x02be('0x6f')},{'name':_0x02be('0x70'),'value':_0x3cb556[_0x02be('0x70')]||(_0x3cb556[_0x02be('0x62')]&&_0x3cb556[_0x02be('0x62')][0x1]?_0x3cb556[_0x02be('0x62')][0x1][_0x02be('0x63')]:undefined)||[]},{'name':_0x02be('0x6c'),'value':_0x3cb556['attrFontSize']||(_0x3cb556[_0x02be('0x62')]&&_0x3cb556[_0x02be('0x62')][0x2]?_0x3cb556[_0x02be('0x62')][0x2][_0x02be('0x63')]:undefined)||0x14}];case _0x02be('0x71'):case _0x02be('0x72'):return[{'name':_0x02be('0x73'),'value':_0x3cb556[_0x02be('0x73')]||(_0x3cb556[_0x02be('0x62')]&&_0x3cb556[_0x02be('0x62')][0x0]?_0x3cb556[_0x02be('0x62')][0x0][_0x02be('0x63')]:undefined)||_0x02be('0x6f')},{'name':_0x02be('0x74'),'value':_0x3cb556[_0x02be('0x74')]||(_0x3cb556['attrs']&&_0x3cb556[_0x02be('0x62')][0x1]?_0x3cb556[_0x02be('0x62')][0x1]['value']:undefined)||null},{'name':'attrSerie3','value':_0x3cb556[_0x02be('0x75')]||(_0x3cb556[_0x02be('0x62')]&&_0x3cb556[_0x02be('0x62')][0x2]?_0x3cb556[_0x02be('0x62')][0x2][_0x02be('0x63')]:undefined)||null},{'name':_0x02be('0x70'),'value':_0x3cb556[_0x02be('0x70')]||(_0x3cb556[_0x02be('0x62')]&&_0x3cb556[_0x02be('0x62')][0x3]?_0x3cb556[_0x02be('0x62')][0x3][_0x02be('0x63')]:undefined)||[]}];case'web-report':return[{'name':'attrReport','type':_0x3cb556[_0x02be('0x76')]||(_0x3cb556[_0x02be('0x62')]&&_0x3cb556[_0x02be('0x62')][0x0]?_0x3cb556[_0x02be('0x62')][0x0]['type']:undefined)||null,'value':_0x3cb556[_0x02be('0x77')]||(_0x3cb556['attrs']&&_0x3cb556['attrs'][0x0]?_0x3cb556[_0x02be('0x62')][0x0][_0x02be('0x63')]:undefined)||null},{'name':_0x02be('0x78'),'value':_0x3cb556[_0x02be('0x78')]||(_0x3cb556[_0x02be('0x62')]&&_0x3cb556[_0x02be('0x62')][0x1]?_0x3cb556[_0x02be('0x62')][0x1][_0x02be('0x63')]:undefined)||0x0}];default:return[];}}catch(_0x1039c5){logger[_0x02be('0x30')]('widgetAttributes:\x20%s',JSON['stringify'](_0x1039c5));return[];}}exports[_0x02be('0x79')]=function(_0x23c453,_0xda6dd0,_0x2ec667){if(_0x23c453[_0x02be('0x50')]['id']){delete _0x23c453[_0x02be('0x50')]['id'];}return db['Dashboard']['find']({'where':{'id':_0x23c453[_0x02be('0x5b')]['id']}})[_0x02be('0x2d')](handleEntityNotFound(_0xda6dd0,null))['then'](function(_0x25c36e){if(_0x25c36e){_0x23c453[_0x02be('0x50')][_0x02be('0x7a')]=_0x25c36e['id'];_0x23c453['body'][_0x02be('0x62')]=widgetAttributes(_0x23c453[_0x02be('0x50')]);return db[_0x02be('0x7b')][_0x02be('0x4f')](_0x23c453[_0x02be('0x50')]);}})['then'](respondWithResult(_0xda6dd0,null))[_0x02be('0x4b')](handleError(_0xda6dd0,null));};exports['getItems']=function(_0x20da2e,_0x49b2b5,_0x11d5bf){var _0x36cd50={};var _0x4d0906={};var _0x1c0cdf;var _0x12db55;return db['Dashboard'][_0x02be('0x7c')]({'where':{'id':_0x20da2e[_0x02be('0x5b')]['id']}})[_0x02be('0x2d')](handleEntityNotFound(_0x49b2b5,null))['then'](function(_0x569f51){if(_0x569f51){_0x1c0cdf=_0x569f51;_0x4d0906[_0x02be('0x38')]=_[_0x02be('0x4d')](db[_0x02be('0x7b')][_0x02be('0x34')]);_0x4d0906[_0x02be('0x3a')]=_[_0x02be('0x4d')](_0x20da2e[_0x02be('0x3a')]);_0x4d0906[_0x02be('0x3b')]=_[_0x02be('0x3c')](_0x4d0906[_0x02be('0x38')],_0x4d0906[_0x02be('0x3a')]);_0x36cd50[_0x02be('0x3d')]=_['intersection'](_0x4d0906[_0x02be('0x38')],qs[_0x02be('0x3e')](_0x20da2e[_0x02be('0x3a')][_0x02be('0x3e')]));_0x36cd50[_0x02be('0x3d')]=_0x36cd50[_0x02be('0x3d')]['length']?_0x36cd50[_0x02be('0x3d')]:_0x4d0906['model'];_0x36cd50[_0x02be('0x42')]=qs[_0x02be('0x43')](_0x20da2e[_0x02be('0x3a')]['sort']);_0x36cd50['where']=qs['filters'](_[_0x02be('0x7d')](_0x20da2e['query'],_0x4d0906['filters']));if(_0x20da2e['query'][_0x02be('0x46')]){_0x36cd50['where']=_[_0x02be('0x47')](_0x36cd50[_0x02be('0x44')],{'$or':_[_0x02be('0x39')](_0x36cd50[_0x02be('0x3d')],function(_0x21d37b){var _0x449323={};_0x449323[_0x21d37b]={'$like':'%'+_0x20da2e[_0x02be('0x3a')][_0x02be('0x46')]+'%'};return _0x449323;})});}_0x36cd50=_[_0x02be('0x47')]({},_0x36cd50,_0x20da2e[_0x02be('0x48')]);return _0x1c0cdf[_0x02be('0x7e')](_0x36cd50);}})['then'](function(_0x4e6a14){if(_0x4e6a14){_0x12db55=_0x4e6a14[_0x02be('0x3f')];if(!_0x20da2e[_0x02be('0x3a')][_0x02be('0x40')](_0x02be('0x41'))){_0x36cd50[_0x02be('0x25')]=qs[_0x02be('0x25')](_0x20da2e[_0x02be('0x3a')][_0x02be('0x25')]);_0x36cd50[_0x02be('0x24')]=qs[_0x02be('0x24')](_0x20da2e[_0x02be('0x3a')][_0x02be('0x24')]);}return _0x1c0cdf[_0x02be('0x7e')](_0x36cd50);}})[_0x02be('0x2d')](function(_0x24d9b3){if(_0x24d9b3){return _0x24d9b3?{'count':_0x12db55,'rows':_0x24d9b3}:null;}})[_0x02be('0x2d')](respondWithResult(_0x49b2b5,null))[_0x02be('0x4b')](handleError(_0x49b2b5,null));}; \ No newline at end of file diff --git a/server/api/dashboard/dashboard.events.js b/server/api/dashboard/dashboard.events.js index 1686a45..5cf3677 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 _0x9651=['save','remove','emit','events','../../mysqldb','Dashboard','setMaxListeners'];(function(_0x2663e5,_0x2145d3){var _0x2ca730=function(_0x55b54b){while(--_0x55b54b){_0x2663e5['push'](_0x2663e5['shift']());}};_0x2ca730(++_0x2145d3);}(_0x9651,0x17d));var _0x1965=function(_0x590af0,_0x1f08c1){_0x590af0=_0x590af0-0x0;var _0x1b281f=_0x9651[_0x590af0];return _0x1b281f;};'use strict';var EventEmitter=require(_0x1965('0x0'));var Dashboard=require(_0x1965('0x1'))['db'][_0x1965('0x2')];var DashboardEvents=new EventEmitter();DashboardEvents[_0x1965('0x3')](0x0);var events={'afterCreate':_0x1965('0x4'),'afterUpdate':'update','afterDestroy':_0x1965('0x5')};function emitEvent(_0x539d17){return function(_0x53a966,_0x291fa8,_0x42cfd2){DashboardEvents[_0x1965('0x6')](_0x539d17+':'+_0x53a966['id'],_0x53a966);DashboardEvents[_0x1965('0x6')](_0x539d17,_0x53a966);_0x42cfd2(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];Dashboard['hook'](e,emitEvent(event));}}module['exports']=DashboardEvents; \ No newline at end of file +var _0x0e9b=['remove','hook','exports','events','../../mysqldb','Dashboard','setMaxListeners','save'];(function(_0x1f0ed,_0x44cbed){var _0x3f5a25=function(_0x1d9bca){while(--_0x1d9bca){_0x1f0ed['push'](_0x1f0ed['shift']());}};_0x3f5a25(++_0x44cbed);}(_0x0e9b,0x1a3));var _0xb0e9=function(_0x100909,_0x34ae39){_0x100909=_0x100909-0x0;var _0x358d3b=_0x0e9b[_0x100909];return _0x358d3b;};'use strict';var EventEmitter=require(_0xb0e9('0x0'));var Dashboard=require(_0xb0e9('0x1'))['db'][_0xb0e9('0x2')];var DashboardEvents=new EventEmitter();DashboardEvents[_0xb0e9('0x3')](0x0);var events={'afterCreate':_0xb0e9('0x4'),'afterUpdate':'update','afterDestroy':_0xb0e9('0x5')};function emitEvent(_0x28998e){return function(_0xb30735,_0x41a26f,_0x4f722c){DashboardEvents['emit'](_0x28998e+':'+_0xb30735['id'],_0xb30735);DashboardEvents['emit'](_0x28998e,_0xb30735);_0x4f722c(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];Dashboard[_0xb0e9('0x6')](e,emitEvent(event));}}module[_0xb0e9('0x7')]=DashboardEvents; \ No newline at end of file diff --git a/server/api/dashboard/dashboard.model.js b/server/api/dashboard/dashboard.model.js index 8810c6a..0f1ce8f 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 _0x4f89=['./dashboard.attributes','exports','define','Dashboard','lodash','util','../../config/logger','api','bluebird','request-promise','path','../../config/environment'];(function(_0x1d1f59,_0xe26f12){var _0x3fbaf4=function(_0x92bf21){while(--_0x92bf21){_0x1d1f59['push'](_0x1d1f59['shift']());}};_0x3fbaf4(++_0xe26f12);}(_0x4f89,0x1f0));var _0x94f8=function(_0x3bae41,_0x5561de){_0x3bae41=_0x3bae41-0x0;var _0x5a2203=_0x4f89[_0x3bae41];return _0x5a2203;};'use strict';var _=require(_0x94f8('0x0'));var util=require(_0x94f8('0x1'));var logger=require(_0x94f8('0x2'))(_0x94f8('0x3'));var moment=require('moment');var BPromise=require(_0x94f8('0x4'));var rp=require(_0x94f8('0x5'));var fs=require('fs');var path=require(_0x94f8('0x6'));var rimraf=require('rimraf');var config=require(_0x94f8('0x7'));var attributes=require(_0x94f8('0x8'));module[_0x94f8('0x9')]=function(_0x29a84f,_0x5191f8){return _0x29a84f[_0x94f8('0xa')](_0x94f8('0xb'),attributes,{'tableName':'dashboards','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x2472=['lodash','../../config/logger','api','bluebird','rimraf','../../config/environment','./dashboard.attributes','exports','define','Dashboard'];(function(_0x3cd677,_0x5d9083){var _0x3d6ae4=function(_0x3027e3){while(--_0x3027e3){_0x3cd677['push'](_0x3cd677['shift']());}};_0x3d6ae4(++_0x5d9083);}(_0x2472,0x15e));var _0x2247=function(_0x777268,_0x51ab17){_0x777268=_0x777268-0x0;var _0x23d256=_0x2472[_0x777268];return _0x23d256;};'use strict';var _=require(_0x2247('0x0'));var util=require('util');var logger=require(_0x2247('0x1'))(_0x2247('0x2'));var moment=require('moment');var BPromise=require(_0x2247('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x2247('0x4'));var config=require(_0x2247('0x5'));var attributes=require(_0x2247('0x6'));module[_0x2247('0x7')]=function(_0x4b1818,_0x762548){return _0x4b1818[_0x2247('0x8')](_0x2247('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 c1fc38e..9f01714 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 _0xbc58=['../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','./dashboard.socket','request','then','Dashboard,\x20%s,\x20%s','request\x20sent','debug','Dashboard,\x20%s,\x20%s,\x20%s','stringify','error','message','info','lodash','bluebird','ioredis','../../mysqldb'];(function(_0x8af54b,_0x280be5){var _0x27d8f0=function(_0x559734){while(--_0x559734){_0x8af54b['push'](_0x8af54b['shift']());}};_0x27d8f0(++_0x280be5);}(_0xbc58,0xcc));var _0x8bc5=function(_0xefd1ec,_0x138236){_0xefd1ec=_0xefd1ec-0x0;var _0x5cf6e9=_0xbc58[_0xefd1ec];return _0x5cf6e9;};'use strict';var _=require(_0x8bc5('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0x8bc5('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x8bc5('0x2'));var db=require(_0x8bc5('0x3'))['db'];var utils=require(_0x8bc5('0x4'));var logger=require(_0x8bc5('0x5'))(_0x8bc5('0x6'));var config=require(_0x8bc5('0x7'));var jayson=require(_0x8bc5('0x8'));var client=jayson[_0x8bc5('0x9')][_0x8bc5('0xa')]({'port':0x232a});config[_0x8bc5('0xb')]=_[_0x8bc5('0xc')](config[_0x8bc5('0xb')],{'host':_0x8bc5('0xd'),'port':0x18eb});var socket=require(_0x8bc5('0xe'))(new Redis(config[_0x8bc5('0xb')]));require(_0x8bc5('0xf'))['register'](socket);function respondWithRpcPromise(_0x5d5027,_0x34e37a,_0x2149fd){return new BPromise(function(_0x25f0f0,_0x54124b){return client[_0x8bc5('0x10')](_0x5d5027,_0x2149fd)[_0x8bc5('0x11')](function(_0x302303){logger['info'](_0x8bc5('0x12'),_0x34e37a,_0x8bc5('0x13'));logger[_0x8bc5('0x14')](_0x8bc5('0x15'),_0x34e37a,_0x8bc5('0x13'),JSON[_0x8bc5('0x16')](_0x302303));if(_0x302303['error']){if(_0x302303['error']['code']===0x1f4){logger[_0x8bc5('0x17')](_0x8bc5('0x12'),_0x34e37a,_0x302303[_0x8bc5('0x17')]['message']);return _0x54124b(_0x302303[_0x8bc5('0x17')][_0x8bc5('0x18')]);}logger['error']('Dashboard,\x20%s,\x20%s',_0x34e37a,_0x302303[_0x8bc5('0x17')]['message']);return _0x25f0f0(_0x302303[_0x8bc5('0x17')][_0x8bc5('0x18')]);}else{logger[_0x8bc5('0x19')](_0x8bc5('0x12'),_0x34e37a,_0x8bc5('0x13'));_0x25f0f0(_0x302303['result'][_0x8bc5('0x18')]);}})['catch'](function(_0x31e69e){logger[_0x8bc5('0x17')](_0x8bc5('0x12'),_0x34e37a,_0x31e69e);_0x54124b(_0x31e69e);});});} \ No newline at end of file +var _0xf49a=['../../config/utils','../../config/logger','jayson/promise','http','redis','socket.io-emitter','request','then','info','Dashboard,\x20%s,\x20%s','request\x20sent','debug','Dashboard,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb'];(function(_0x528166,_0x29d47b){var _0x538a78=function(_0x1403f5){while(--_0x1403f5){_0x528166['push'](_0x528166['shift']());}};_0x538a78(++_0x29d47b);}(_0xf49a,0x199));var _0xaf49=function(_0x9ff51,_0x4c951f){_0x9ff51=_0x9ff51-0x0;var _0x31959b=_0xf49a[_0x9ff51];return _0x31959b;};'use strict';var _=require(_0xaf49('0x0'));var util=require(_0xaf49('0x1'));var moment=require(_0xaf49('0x2'));var BPromise=require(_0xaf49('0x3'));var rs=require(_0xaf49('0x4'));var fs=require('fs');var Redis=require(_0xaf49('0x5'));var db=require(_0xaf49('0x6'))['db'];var utils=require(_0xaf49('0x7'));var logger=require(_0xaf49('0x8'))('rpc');var config=require('../../config/environment');var jayson=require(_0xaf49('0x9'));var client=jayson['client'][_0xaf49('0xa')]({'port':0x232a});config[_0xaf49('0xb')]=_['defaults'](config[_0xaf49('0xb')],{'host':'localhost','port':0x18eb});var socket=require(_0xaf49('0xc'))(new Redis(config[_0xaf49('0xb')]));require('./dashboard.socket')['register'](socket);function respondWithRpcPromise(_0xfef8d9,_0x43bcce,_0x30cbc5){return new BPromise(function(_0x503549,_0x596419){return client[_0xaf49('0xd')](_0xfef8d9,_0x30cbc5)[_0xaf49('0xe')](function(_0x5ef020){logger[_0xaf49('0xf')](_0xaf49('0x10'),_0x43bcce,_0xaf49('0x11'));logger[_0xaf49('0x12')](_0xaf49('0x13'),_0x43bcce,_0xaf49('0x11'),JSON[_0xaf49('0x14')](_0x5ef020));if(_0x5ef020[_0xaf49('0x15')]){if(_0x5ef020[_0xaf49('0x15')][_0xaf49('0x16')]===0x1f4){logger[_0xaf49('0x15')](_0xaf49('0x10'),_0x43bcce,_0x5ef020['error'][_0xaf49('0x17')]);return _0x596419(_0x5ef020['error'][_0xaf49('0x17')]);}logger[_0xaf49('0x15')](_0xaf49('0x10'),_0x43bcce,_0x5ef020['error'][_0xaf49('0x17')]);return _0x503549(_0x5ef020[_0xaf49('0x15')][_0xaf49('0x17')]);}else{logger[_0xaf49('0xf')]('Dashboard,\x20%s,\x20%s',_0x43bcce,_0xaf49('0x11'));_0x503549(_0x5ef020[_0xaf49('0x18')][_0xaf49('0x17')]);}})[_0xaf49('0x19')](function(_0x3a650a){logger[_0xaf49('0x15')](_0xaf49('0x10'),_0x43bcce,_0x3a650a);_0x596419(_0x3a650a);});});} \ No newline at end of file diff --git a/server/api/dashboard/dashboard.socket.js b/server/api/dashboard/dashboard.socket.js index 8d4e3fb..94cd335 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 _0xe67c=['remove','update','emit','removeListener','length','./dashboard.events','save'];(function(_0x22ce56,_0xec1274){var _0x66390=function(_0x3b92a9){while(--_0x3b92a9){_0x22ce56['push'](_0x22ce56['shift']());}};_0x66390(++_0xec1274);}(_0xe67c,0x1be));var _0xce67=function(_0x959d80,_0x420b35){_0x959d80=_0x959d80-0x0;var _0x1b0f00=_0xe67c[_0x959d80];return _0x1b0f00;};'use strict';var DashboardEvents=require(_0xce67('0x0'));var events=[_0xce67('0x1'),_0xce67('0x2'),_0xce67('0x3')];function createListener(_0x38b1cf,_0x5cee47){return function(_0x2fa4d9){_0x5cee47[_0xce67('0x4')](_0x38b1cf,_0x2fa4d9);};}function removeListener(_0x1a2b33,_0x227536){return function(){DashboardEvents[_0xce67('0x5')](_0x1a2b33,_0x227536);};}exports['register']=function(_0x25d26b){for(var _0x25b942=0x0,_0x15071d=events[_0xce67('0x6')];_0x25b942<_0x15071d;_0x25b942++){var _0x24e023=events[_0x25b942];var _0x2dd494=createListener('dashboard:'+_0x24e023,_0x25d26b);DashboardEvents['on'](_0x24e023,_0x2dd494);}}; \ No newline at end of file +var _0x7540=['emit','removeListener','register','length','dashboard:','./dashboard.events'];(function(_0x294c36,_0x302cc1){var _0xf06881=function(_0x464b80){while(--_0x464b80){_0x294c36['push'](_0x294c36['shift']());}};_0xf06881(++_0x302cc1);}(_0x7540,0x143));var _0x0754=function(_0x2ce5e3,_0x429426){_0x2ce5e3=_0x2ce5e3-0x0;var _0xe1e73c=_0x7540[_0x2ce5e3];return _0xe1e73c;};'use strict';var DashboardEvents=require(_0x0754('0x0'));var events=['save','remove','update'];function createListener(_0x102bdc,_0x5ea2a8){return function(_0x51e5df){_0x5ea2a8[_0x0754('0x1')](_0x102bdc,_0x51e5df);};}function removeListener(_0x557cec,_0x14b31e){return function(){DashboardEvents[_0x0754('0x2')](_0x557cec,_0x14b31e);};}exports[_0x0754('0x3')]=function(_0x3380a3){for(var _0x3101e6=0x0,_0x32dad6=events[_0x0754('0x4')];_0x3101e6<_0x32dad6;_0x3101e6++){var _0x370f9d=events[_0x3101e6];var _0x5ac633=createListener(_0x0754('0x5')+_0x370f9d,_0x3380a3);DashboardEvents['on'](_0x370f9d,_0x5ac633);}}; \ No newline at end of file diff --git a/server/api/dashboard/index.js b/server/api/dashboard/index.js index e8984a3..9217c80 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 _0xa9e0=['/:id','/:id/items','post','create','/:id/clone','addItem','put','update','delete','destroy','exports','multer','util','path','Router','../../components/interaction/service','../../config/environment','./dashboard.controller','get','isAuthenticated'];(function(_0x2a15f3,_0x16f3d8){var _0x5b5cd8=function(_0x4612e3){while(--_0x4612e3){_0x2a15f3['push'](_0x2a15f3['shift']());}};_0x5b5cd8(++_0x16f3d8);}(_0xa9e0,0x123));var _0x0a9e=function(_0x491a7f,_0x28bb80){_0x491a7f=_0x491a7f-0x0;var _0x3d8f44=_0xa9e0[_0x491a7f];return _0x3d8f44;};'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['show']);router['get'](_0x0a9e('0xa'),auth['isAuthenticated'](),controller['getItems']);router[_0x0a9e('0xb')]('/',auth[_0x0a9e('0x8')](),controller[_0x0a9e('0xc')]);router[_0x0a9e('0xb')](_0x0a9e('0xd'),auth[_0x0a9e('0x8')](),controller['clone']);router['post']('/:id/items',auth['isAuthenticated'](),controller[_0x0a9e('0xe')]);router[_0x0a9e('0xf')](_0x0a9e('0x9'),auth[_0x0a9e('0x8')](),controller[_0x0a9e('0x10')]);router[_0x0a9e('0x11')]('/:id',auth[_0x0a9e('0x8')](),controller[_0x0a9e('0x12')]);module[_0x0a9e('0x13')]=router; \ No newline at end of file +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(_0x1e3c02,_0x5c07a2){var _0x4d26d7=function(_0x367ed9){while(--_0x367ed9){_0x1e3c02['push'](_0x1e3c02['shift']());}};_0x4d26d7(++_0x5c07a2);}(_0xe706,0xa3));var _0x6e70=function(_0xb6bddf,_0x2372c3){_0xb6bddf=_0xb6bddf-0x0;var _0x1a7749=_0xe706[_0xb6bddf];return _0x1a7749;};'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 diff --git a/server/api/dashboardItem/dashboardItem.attributes.js b/server/api/dashboardItem/dashboardItem.attributes.js index 852684d..a20c99e 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 _0x6e00=['INTEGER','#2196f3','sequelize','squel','lodash','exports','STRING','long','getDataValue','attrs','setDataValue','stringify'];(function(_0x122ef9,_0x451d2a){var _0x42fba0=function(_0x17c9d3){while(--_0x17c9d3){_0x122ef9['push'](_0x122ef9['shift']());}};_0x42fba0(++_0x451d2a);}(_0x6e00,0x1ee));var _0x06e0=function(_0x49c3d7,_0x545f73){_0x49c3d7=_0x49c3d7-0x0;var _0x5ee9f2=_0x6e00[_0x49c3d7];return _0x5ee9f2;};'use strict';var Sequelize=require(_0x06e0('0x0'));var squel=require(_0x06e0('0x1'));var _=require(_0x06e0('0x2'));module[_0x06e0('0x3')]={'title':{'type':Sequelize[_0x06e0('0x4')],'allowNull':![]},'type':{'type':Sequelize[_0x06e0('0x4')](0x14),'allowNull':![],'validate':{'len':[0x1,0x14]}},'attrs':{'type':Sequelize['TEXT'](_0x06e0('0x5')),'get':function(){try{return JSON['parse'](this[_0x06e0('0x6')](_0x06e0('0x7')));}catch(_0x58f028){return[];}},'set':function(_0x516844){try{this[_0x06e0('0x8')](_0x06e0('0x7'),JSON['stringify'](_0x516844));}catch(_0x34db85){this[_0x06e0('0x8')](_0x06e0('0x7'),JSON[_0x06e0('0x9')]([]));}}},'sizeX':{'type':Sequelize[_0x06e0('0xa')],'allowNull':![],'defaultValue':0x1},'sizeY':{'type':Sequelize[_0x06e0('0xa')],'allowNull':![],'defaultValue':0x1},'row':{'type':Sequelize[_0x06e0('0xa')]},'col':{'type':Sequelize[_0x06e0('0xa')]},'background':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':'#ffffff','validate':{'notEmpty':!![]}},'foreground':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0x06e0('0xb'),'validate':{'notEmpty':!![]}},'link':{'type':Sequelize[_0x06e0('0x4')]}}; \ No newline at end of file +var _0xa960=['STRING','TEXT','long','parse','getDataValue','attrs','INTEGER','#ffffff','#2196f3','sequelize','squel','lodash','exports'];(function(_0x5bdf85,_0x118fa){var _0x27e022=function(_0x44bcea){while(--_0x44bcea){_0x5bdf85['push'](_0x5bdf85['shift']());}};_0x27e022(++_0x118fa);}(_0xa960,0x18f));var _0x0a96=function(_0x498fc9,_0x3fa592){_0x498fc9=_0x498fc9-0x0;var _0x1ac533=_0xa960[_0x498fc9];return _0x1ac533;};'use strict';var Sequelize=require(_0x0a96('0x0'));var squel=require(_0x0a96('0x1'));var _=require(_0x0a96('0x2'));module[_0x0a96('0x3')]={'title':{'type':Sequelize[_0x0a96('0x4')],'allowNull':![]},'type':{'type':Sequelize[_0x0a96('0x4')](0x14),'allowNull':![],'validate':{'len':[0x1,0x14]}},'attrs':{'type':Sequelize[_0x0a96('0x5')](_0x0a96('0x6')),'get':function(){try{return JSON[_0x0a96('0x7')](this[_0x0a96('0x8')]('attrs'));}catch(_0x3dd93e){return[];}},'set':function(_0x37cec0){try{this['setDataValue']('attrs',JSON['stringify'](_0x37cec0));}catch(_0x4d33eb){this['setDataValue'](_0x0a96('0x9'),JSON['stringify']([]));}}},'sizeX':{'type':Sequelize[_0x0a96('0xa')],'allowNull':![],'defaultValue':0x1},'sizeY':{'type':Sequelize['INTEGER'],'allowNull':![],'defaultValue':0x1},'row':{'type':Sequelize['INTEGER']},'col':{'type':Sequelize[_0x0a96('0xa')]},'background':{'type':Sequelize[_0x0a96('0x4')],'allowNull':![],'defaultValue':_0x0a96('0xb'),'validate':{'notEmpty':!![]}},'foreground':{'type':Sequelize[_0x0a96('0x4')],'allowNull':![],'defaultValue':_0x0a96('0xc'),'validate':{'notEmpty':!![]}},'link':{'type':Sequelize[_0x0a96('0x4')]}}; \ No newline at end of file diff --git a/server/api/dashboardItem/dashboardItem.controller.js b/server/api/dashboardItem/dashboardItem.controller.js index b13f3e2..46bae39 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 _0xab90=['limit','set','Content-Range','reject','save','update','then','destroy','end','error','stack','show','model','keys','DashboardItem','query','filters','intersection','attributes','fields','length','includeAll','merge','options','find','catch','params','type','iframe','attrUrl','attrs','https://','attrPath','clock','attrHourFormat','value','HH:mm:ss','attrFontSize','attrMetric','total','attrVoiceQueues','pie-chart','attrSerie1','attrSerie2','attrSerie3','web-report','reportType','attrReport','attrRefresh','widgetAttributes:\x20%s','stringify','body','create','html-pdf','eml-format','rimraf','zip-dir','request-promise','moment','mustache','util','path','sox','to-csv','ejs','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','socket.io-emitter','redis','./dashboardItem.socket','register','sendStatus','status','json','count','offset'];(function(_0x5a776b,_0x46f785){var _0xbbef59=function(_0x38313e){while(--_0x38313e){_0x5a776b['push'](_0x5a776b['shift']());}};_0xbbef59(++_0x46f785);}(_0xab90,0xe9));var _0x0ab9=function(_0x5d6456,_0x58ecc7){_0x5d6456=_0x5d6456-0x0;var _0x4d66c1=_0xab90[_0x5d6456];return _0x4d66c1;};'use strict';var pdf=require(_0x0ab9('0x0'));var emlformat=require(_0x0ab9('0x1'));var rimraf=require(_0x0ab9('0x2'));var zipdir=require(_0x0ab9('0x3'));var jsonpatch=require('fast-json-patch');var rp=require(_0x0ab9('0x4'));var moment=require(_0x0ab9('0x5'));var BPromise=require('bluebird');var Mustache=require(_0x0ab9('0x6'));var util=require(_0x0ab9('0x7'));var path=require(_0x0ab9('0x8'));var sox=require(_0x0ab9('0x9'));var csv=require(_0x0ab9('0xa'));var ejs=require(_0x0ab9('0xb'));var fs=require('fs');var _=require('lodash');var squel=require(_0x0ab9('0xc'));var crypto=require(_0x0ab9('0xd'));var jsforce=require(_0x0ab9('0xe'));var deskjs=require(_0x0ab9('0xf'));var toCsv=require(_0x0ab9('0xa'));var querystring=require(_0x0ab9('0x10'));var Papa=require(_0x0ab9('0x11'));var Redis=require(_0x0ab9('0x12'));var authService=require(_0x0ab9('0x13'));var qs=require(_0x0ab9('0x14'));var as=require(_0x0ab9('0x15'));var hardwareService=require(_0x0ab9('0x16'));var logger=require(_0x0ab9('0x17'))(_0x0ab9('0x18'));var utils=require(_0x0ab9('0x19'));var config=require(_0x0ab9('0x1a'));var db=require(_0x0ab9('0x1b'))['db'];config['redis']=_['defaults'](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0x0ab9('0x1c'))(new Redis(config[_0x0ab9('0x1d')]));require(_0x0ab9('0x1e'))[_0x0ab9('0x1f')](socket);function respondWithStatusCode(_0x1a28ba,_0x1bc1f6){_0x1bc1f6=_0x1bc1f6||0xcc;return function(_0x1d54c6){if(_0x1d54c6){return _0x1a28ba[_0x0ab9('0x20')](_0x1bc1f6);}return _0x1a28ba['status'](_0x1bc1f6)['end']();};}function respondWithResult(_0x2f90a2,_0x5715bd){_0x5715bd=_0x5715bd||0xc8;return function(_0x569f28){if(_0x569f28){return _0x2f90a2[_0x0ab9('0x21')](_0x5715bd)[_0x0ab9('0x22')](_0x569f28);}};}function respondWithFilteredResult(_0x34297a,_0x32fec2){return function(_0x2eca44){if(_0x2eca44){var _0x219deb=_0x2eca44[_0x0ab9('0x23')],_0x1d5ee2=_0x32fec2[_0x0ab9('0x24')],_0x6895ab=_0x32fec2[_0x0ab9('0x24')]+_0x32fec2[_0x0ab9('0x25')],_0x393f11;if(_0x6895ab>=_0x219deb){_0x6895ab=_0x219deb;_0x393f11=0xc8;}else{_0x393f11=0xce;}_0x34297a[_0x0ab9('0x21')](_0x393f11);return _0x34297a[_0x0ab9('0x26')](_0x0ab9('0x27'),_0x1d5ee2+'-'+_0x6895ab+'/'+_0x219deb)[_0x0ab9('0x22')](_0x2eca44);}return null;};}function patchUpdates(_0x3782a2){return function(_0x24ce79){try{jsonpatch['apply'](_0x24ce79,_0x3782a2,!![]);}catch(_0x190d36){return BPromise[_0x0ab9('0x28')](_0x190d36);}return _0x24ce79[_0x0ab9('0x29')]();};}function saveUpdates(_0x30f59b,_0x66a8b){return function(_0x10a575){if(_0x10a575){return _0x10a575[_0x0ab9('0x2a')](_0x30f59b)[_0x0ab9('0x2b')](function(_0x1630ff){return _0x1630ff;});}return null;};}function removeEntity(_0x256011,_0x28ff33){return function(_0x44cd9c){if(_0x44cd9c){return _0x44cd9c[_0x0ab9('0x2c')]()[_0x0ab9('0x2b')](function(){_0x256011[_0x0ab9('0x21')](0xcc)[_0x0ab9('0x2d')]();});}};}function handleEntityNotFound(_0x7a0d53,_0x5b1d48){return function(_0x38cefe){if(!_0x38cefe){_0x7a0d53[_0x0ab9('0x20')](0x194);}return _0x38cefe;};}function handleError(_0x552af3,_0x1830ee){_0x1830ee=_0x1830ee||0x1f4;return function(_0x188380){logger[_0x0ab9('0x2e')](_0x188380[_0x0ab9('0x2f')]);if(_0x188380['name']){delete _0x188380['name'];}_0x552af3[_0x0ab9('0x21')](_0x1830ee)['send'](_0x188380);};}exports[_0x0ab9('0x30')]=function(_0x2c2cf5,_0x447077){var _0x31bcf5={'raw':![],'where':{'id':_0x2c2cf5['params']['id']}},_0xc4481a={};_0xc4481a[_0x0ab9('0x31')]=_[_0x0ab9('0x32')](db[_0x0ab9('0x33')]['rawAttributes']);_0xc4481a[_0x0ab9('0x34')]=_[_0x0ab9('0x32')](_0x2c2cf5[_0x0ab9('0x34')]);_0xc4481a[_0x0ab9('0x35')]=_[_0x0ab9('0x36')](_0xc4481a[_0x0ab9('0x31')],_0xc4481a[_0x0ab9('0x34')]);_0x31bcf5[_0x0ab9('0x37')]=_[_0x0ab9('0x36')](_0xc4481a[_0x0ab9('0x31')],qs[_0x0ab9('0x38')](_0x2c2cf5[_0x0ab9('0x34')]['fields']));_0x31bcf5[_0x0ab9('0x37')]=_0x31bcf5['attributes'][_0x0ab9('0x39')]?_0x31bcf5[_0x0ab9('0x37')]:_0xc4481a[_0x0ab9('0x31')];if(_0x2c2cf5['query'][_0x0ab9('0x3a')]){_0x31bcf5['include']=[{'all':!![]}];}_0x31bcf5=_[_0x0ab9('0x3b')]({},_0x31bcf5,_0x2c2cf5[_0x0ab9('0x3c')]);return db[_0x0ab9('0x33')][_0x0ab9('0x3d')](_0x31bcf5)[_0x0ab9('0x2b')](handleEntityNotFound(_0x447077,null))[_0x0ab9('0x2b')](respondWithResult(_0x447077,null))[_0x0ab9('0x3e')](handleError(_0x447077,null));};exports[_0x0ab9('0x2c')]=function(_0x211839,_0x58816b){return db['DashboardItem'][_0x0ab9('0x3d')]({'where':{'id':_0x211839[_0x0ab9('0x3f')]['id']}})[_0x0ab9('0x2b')](handleEntityNotFound(_0x58816b,null))[_0x0ab9('0x2b')](removeEntity(_0x58816b,null))[_0x0ab9('0x3e')](handleError(_0x58816b,null));};function widgetAttributes(_0x500883){try{switch(_0x500883[_0x0ab9('0x40')]){case _0x0ab9('0x41'):return[{'name':_0x0ab9('0x42'),'value':_0x500883[_0x0ab9('0x42')]||(_0x500883[_0x0ab9('0x43')]&&_0x500883[_0x0ab9('0x43')][0x0]?_0x500883[_0x0ab9('0x43')][0x0]['value']:undefined)||_0x0ab9('0x44')}];case'custom':return[{'name':_0x0ab9('0x45'),'value':_0x500883[_0x0ab9('0x45')]||(_0x500883[_0x0ab9('0x43')]&&_0x500883[_0x0ab9('0x43')][0x0]?_0x500883[_0x0ab9('0x43')][0x0]['value']:undefined)||''}];case _0x0ab9('0x46'):return[{'name':_0x0ab9('0x47'),'value':_0x500883[_0x0ab9('0x47')]||(_0x500883[_0x0ab9('0x43')]&&_0x500883[_0x0ab9('0x43')][0x0]?_0x500883[_0x0ab9('0x43')][0x0][_0x0ab9('0x48')]:undefined)||_0x0ab9('0x49')},{'name':'attrTimezone','value':_0x500883['attrTimezone']||(_0x500883[_0x0ab9('0x43')]&&_0x500883[_0x0ab9('0x43')][0x1]?_0x500883[_0x0ab9('0x43')][0x1][_0x0ab9('0x48')]:undefined)||'0.00'},{'name':_0x0ab9('0x4a'),'value':_0x500883[_0x0ab9('0x4a')]||(_0x500883[_0x0ab9('0x43')]&&_0x500883[_0x0ab9('0x43')][0x2]?_0x500883[_0x0ab9('0x43')][0x2][_0x0ab9('0x48')]:undefined)||0xc}];case'counter':return[{'name':'attrMetric','value':_0x500883[_0x0ab9('0x4b')]||(_0x500883[_0x0ab9('0x43')]&&_0x500883[_0x0ab9('0x43')][0x0]?_0x500883['attrs'][0x0][_0x0ab9('0x48')]:undefined)||_0x0ab9('0x4c')},{'name':_0x0ab9('0x4d'),'value':_0x500883['attrVoiceQueues']||(_0x500883[_0x0ab9('0x43')]&&_0x500883['attrs'][0x1]?_0x500883[_0x0ab9('0x43')][0x1][_0x0ab9('0x48')]:undefined)||[]},{'name':_0x0ab9('0x4a'),'value':_0x500883[_0x0ab9('0x4a')]||(_0x500883[_0x0ab9('0x43')]&&_0x500883[_0x0ab9('0x43')][0x2]?_0x500883[_0x0ab9('0x43')][0x2][_0x0ab9('0x48')]:undefined)||0x14}];case'multibar-chart':case _0x0ab9('0x4e'):return[{'name':_0x0ab9('0x4f'),'value':_0x500883['attrSerie1']||(_0x500883[_0x0ab9('0x43')]&&_0x500883[_0x0ab9('0x43')][0x0]?_0x500883[_0x0ab9('0x43')][0x0][_0x0ab9('0x48')]:undefined)||_0x0ab9('0x4c')},{'name':_0x0ab9('0x50'),'value':_0x500883[_0x0ab9('0x50')]||(_0x500883['attrs']&&_0x500883[_0x0ab9('0x43')][0x1]?_0x500883[_0x0ab9('0x43')][0x1][_0x0ab9('0x48')]:undefined)||null},{'name':_0x0ab9('0x51'),'value':_0x500883['attrSerie3']||(_0x500883[_0x0ab9('0x43')]&&_0x500883[_0x0ab9('0x43')][0x2]?_0x500883[_0x0ab9('0x43')][0x2]['value']:undefined)||null},{'name':_0x0ab9('0x4d'),'value':_0x500883[_0x0ab9('0x4d')]||(_0x500883[_0x0ab9('0x43')]&&_0x500883[_0x0ab9('0x43')][0x3]?_0x500883[_0x0ab9('0x43')][0x3][_0x0ab9('0x48')]:undefined)||[]}];case _0x0ab9('0x52'):return[{'name':'attrReport','type':_0x500883[_0x0ab9('0x53')]||(_0x500883[_0x0ab9('0x43')]&&_0x500883[_0x0ab9('0x43')][0x0]?_0x500883['attrs'][0x0][_0x0ab9('0x40')]:undefined)||null,'value':_0x500883[_0x0ab9('0x54')]||(_0x500883[_0x0ab9('0x43')]&&_0x500883[_0x0ab9('0x43')][0x0]?_0x500883[_0x0ab9('0x43')][0x0][_0x0ab9('0x48')]:undefined)||null},{'name':_0x0ab9('0x55'),'value':_0x500883[_0x0ab9('0x55')]||(_0x500883['attrs']&&_0x500883[_0x0ab9('0x43')][0x1]?_0x500883[_0x0ab9('0x43')][0x1][_0x0ab9('0x48')]:undefined)||0x0}];default:return[];}}catch(_0x322599){logger['error'](_0x0ab9('0x56'),JSON[_0x0ab9('0x57')](_0x322599));return[];}}exports['create']=function(_0x453a37,_0x565356){if(_0x453a37[_0x0ab9('0x58')]){_0x453a37[_0x0ab9('0x58')][_0x0ab9('0x43')]=widgetAttributes(_0x453a37[_0x0ab9('0x58')]);}return db[_0x0ab9('0x33')][_0x0ab9('0x59')](_0x453a37[_0x0ab9('0x58')],{})['then'](respondWithResult(_0x565356,0xc9))['catch'](handleError(_0x565356,null));};exports['update']=function(_0x1704bc,_0x5c2bd4){if(_0x1704bc[_0x0ab9('0x58')]['id']){delete _0x1704bc['body']['id'];}_0x1704bc[_0x0ab9('0x58')][_0x0ab9('0x43')]=widgetAttributes(_0x1704bc['body']);return db['DashboardItem'][_0x0ab9('0x3d')]({'where':{'id':_0x1704bc[_0x0ab9('0x3f')]['id']}})[_0x0ab9('0x2b')](handleEntityNotFound(_0x5c2bd4,null))[_0x0ab9('0x2b')](saveUpdates(_0x1704bc[_0x0ab9('0x58')],null))[_0x0ab9('0x2b')](respondWithResult(_0x5c2bd4,null))[_0x0ab9('0x3e')](handleError(_0x5c2bd4,null));}; \ No newline at end of file +var _0x31a6=['catch','type','iframe','attrs','value','https://','custom','attrPath','clock','attrHourFormat','HH:mm:ss','attrTimezone','0.00','attrFontSize','counter','attrMetric','attrVoiceQueues','pie-chart','attrSerie1','attrSerie2','attrSerie3','web-report','attrReport','attrRefresh','error','widgetAttributes:\x20%s','stringify','create','body','update','html-pdf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','sox','to-csv','ejs','squel','crypto','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','redis','defaults','localhost','socket.io-emitter','register','sendStatus','status','json','count','offset','limit','set','Content-Range','apply','save','then','destroy','end','name','send','show','params','model','rawAttributes','query','keys','filters','intersection','attributes','fields','include','merge','options','DashboardItem','find'];(function(_0x2a972c,_0x2f8026){var _0xc3c903=function(_0x2b66e6){while(--_0x2b66e6){_0x2a972c['push'](_0x2a972c['shift']());}};_0xc3c903(++_0x2f8026);}(_0x31a6,0x182));var _0x631a=function(_0x4f464e,_0x216a44){_0x4f464e=_0x4f464e-0x0;var _0x37c1df=_0x31a6[_0x4f464e];return _0x37c1df;};'use strict';var pdf=require(_0x631a('0x0'));var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x631a('0x1'));var jsonpatch=require(_0x631a('0x2'));var rp=require(_0x631a('0x3'));var moment=require(_0x631a('0x4'));var BPromise=require(_0x631a('0x5'));var Mustache=require(_0x631a('0x6'));var util=require('util');var path=require('path');var sox=require(_0x631a('0x7'));var csv=require(_0x631a('0x8'));var ejs=require(_0x631a('0x9'));var fs=require('fs');var _=require('lodash');var squel=require(_0x631a('0xa'));var crypto=require(_0x631a('0xb'));var jsforce=require('jsforce');var deskjs=require(_0x631a('0xc'));var toCsv=require(_0x631a('0x8'));var querystring=require('querystring');var Papa=require(_0x631a('0xd'));var Redis=require(_0x631a('0xe'));var authService=require(_0x631a('0xf'));var qs=require(_0x631a('0x10'));var as=require(_0x631a('0x11'));var hardwareService=require(_0x631a('0x12'));var logger=require(_0x631a('0x13'))(_0x631a('0x14'));var utils=require(_0x631a('0x15'));var config=require(_0x631a('0x16'));var db=require(_0x631a('0x17'))['db'];config[_0x631a('0x18')]=_[_0x631a('0x19')](config['redis'],{'host':_0x631a('0x1a'),'port':0x18eb});var socket=require(_0x631a('0x1b'))(new Redis(config[_0x631a('0x18')]));require('./dashboardItem.socket')[_0x631a('0x1c')](socket);function respondWithStatusCode(_0x3af73c,_0x4046a0){_0x4046a0=_0x4046a0||0xcc;return function(_0xc28a72){if(_0xc28a72){return _0x3af73c[_0x631a('0x1d')](_0x4046a0);}return _0x3af73c[_0x631a('0x1e')](_0x4046a0)['end']();};}function respondWithResult(_0x642c0c,_0x2848ee){_0x2848ee=_0x2848ee||0xc8;return function(_0x37c4e9){if(_0x37c4e9){return _0x642c0c['status'](_0x2848ee)[_0x631a('0x1f')](_0x37c4e9);}};}function respondWithFilteredResult(_0x1c0172,_0xe2f54){return function(_0x4dc98e){if(_0x4dc98e){var _0x4d0f78=_0x4dc98e[_0x631a('0x20')],_0xff2062=_0xe2f54['offset'],_0x681bc5=_0xe2f54[_0x631a('0x21')]+_0xe2f54[_0x631a('0x22')],_0x22b380;if(_0x681bc5>=_0x4d0f78){_0x681bc5=_0x4d0f78;_0x22b380=0xc8;}else{_0x22b380=0xce;}_0x1c0172[_0x631a('0x1e')](_0x22b380);return _0x1c0172[_0x631a('0x23')](_0x631a('0x24'),_0xff2062+'-'+_0x681bc5+'/'+_0x4d0f78)['json'](_0x4dc98e);}return null;};}function patchUpdates(_0x3d6c72){return function(_0x567dea){try{jsonpatch[_0x631a('0x25')](_0x567dea,_0x3d6c72,!![]);}catch(_0x541ea0){return BPromise['reject'](_0x541ea0);}return _0x567dea[_0x631a('0x26')]();};}function saveUpdates(_0x174203,_0x479f67){return function(_0x1333a0){if(_0x1333a0){return _0x1333a0['update'](_0x174203)[_0x631a('0x27')](function(_0x569c41){return _0x569c41;});}return null;};}function removeEntity(_0x3ed467,_0x128c1e){return function(_0x26bb84){if(_0x26bb84){return _0x26bb84[_0x631a('0x28')]()['then'](function(){_0x3ed467['status'](0xcc)[_0x631a('0x29')]();});}};}function handleEntityNotFound(_0x59452d,_0xcbfa4a){return function(_0x1c43e0){if(!_0x1c43e0){_0x59452d[_0x631a('0x1d')](0x194);}return _0x1c43e0;};}function handleError(_0x442801,_0x2c8fc7){_0x2c8fc7=_0x2c8fc7||0x1f4;return function(_0x523abd){logger['error'](_0x523abd['stack']);if(_0x523abd[_0x631a('0x2a')]){delete _0x523abd['name'];}_0x442801[_0x631a('0x1e')](_0x2c8fc7)[_0x631a('0x2b')](_0x523abd);};}exports[_0x631a('0x2c')]=function(_0xeaafa9,_0x153df6){var _0x337c47={'raw':![],'where':{'id':_0xeaafa9[_0x631a('0x2d')]['id']}},_0x3137a8={};_0x3137a8[_0x631a('0x2e')]=_['keys'](db['DashboardItem'][_0x631a('0x2f')]);_0x3137a8[_0x631a('0x30')]=_[_0x631a('0x31')](_0xeaafa9[_0x631a('0x30')]);_0x3137a8[_0x631a('0x32')]=_[_0x631a('0x33')](_0x3137a8[_0x631a('0x2e')],_0x3137a8[_0x631a('0x30')]);_0x337c47[_0x631a('0x34')]=_[_0x631a('0x33')](_0x3137a8[_0x631a('0x2e')],qs[_0x631a('0x35')](_0xeaafa9[_0x631a('0x30')][_0x631a('0x35')]));_0x337c47['attributes']=_0x337c47['attributes']['length']?_0x337c47[_0x631a('0x34')]:_0x3137a8[_0x631a('0x2e')];if(_0xeaafa9[_0x631a('0x30')]['includeAll']){_0x337c47[_0x631a('0x36')]=[{'all':!![]}];}_0x337c47=_[_0x631a('0x37')]({},_0x337c47,_0xeaafa9[_0x631a('0x38')]);return db[_0x631a('0x39')][_0x631a('0x3a')](_0x337c47)[_0x631a('0x27')](handleEntityNotFound(_0x153df6,null))[_0x631a('0x27')](respondWithResult(_0x153df6,null))[_0x631a('0x3b')](handleError(_0x153df6,null));};exports[_0x631a('0x28')]=function(_0x5d00a1,_0x4eb4a4){return db['DashboardItem'][_0x631a('0x3a')]({'where':{'id':_0x5d00a1['params']['id']}})[_0x631a('0x27')](handleEntityNotFound(_0x4eb4a4,null))[_0x631a('0x27')](removeEntity(_0x4eb4a4,null))[_0x631a('0x3b')](handleError(_0x4eb4a4,null));};function widgetAttributes(_0x4daaea){try{switch(_0x4daaea[_0x631a('0x3c')]){case _0x631a('0x3d'):return[{'name':'attrUrl','value':_0x4daaea['attrUrl']||(_0x4daaea['attrs']&&_0x4daaea[_0x631a('0x3e')][0x0]?_0x4daaea[_0x631a('0x3e')][0x0][_0x631a('0x3f')]:undefined)||_0x631a('0x40')}];case _0x631a('0x41'):return[{'name':_0x631a('0x42'),'value':_0x4daaea[_0x631a('0x42')]||(_0x4daaea['attrs']&&_0x4daaea['attrs'][0x0]?_0x4daaea[_0x631a('0x3e')][0x0][_0x631a('0x3f')]:undefined)||''}];case _0x631a('0x43'):return[{'name':_0x631a('0x44'),'value':_0x4daaea[_0x631a('0x44')]||(_0x4daaea[_0x631a('0x3e')]&&_0x4daaea[_0x631a('0x3e')][0x0]?_0x4daaea[_0x631a('0x3e')][0x0][_0x631a('0x3f')]:undefined)||_0x631a('0x45')},{'name':_0x631a('0x46'),'value':_0x4daaea[_0x631a('0x46')]||(_0x4daaea['attrs']&&_0x4daaea['attrs'][0x1]?_0x4daaea[_0x631a('0x3e')][0x1]['value']:undefined)||_0x631a('0x47')},{'name':_0x631a('0x48'),'value':_0x4daaea[_0x631a('0x48')]||(_0x4daaea[_0x631a('0x3e')]&&_0x4daaea[_0x631a('0x3e')][0x2]?_0x4daaea[_0x631a('0x3e')][0x2][_0x631a('0x3f')]:undefined)||0xc}];case _0x631a('0x49'):return[{'name':_0x631a('0x4a'),'value':_0x4daaea[_0x631a('0x4a')]||(_0x4daaea[_0x631a('0x3e')]&&_0x4daaea[_0x631a('0x3e')][0x0]?_0x4daaea['attrs'][0x0][_0x631a('0x3f')]:undefined)||'total'},{'name':_0x631a('0x4b'),'value':_0x4daaea[_0x631a('0x4b')]||(_0x4daaea[_0x631a('0x3e')]&&_0x4daaea[_0x631a('0x3e')][0x1]?_0x4daaea[_0x631a('0x3e')][0x1][_0x631a('0x3f')]:undefined)||[]},{'name':_0x631a('0x48'),'value':_0x4daaea[_0x631a('0x48')]||(_0x4daaea[_0x631a('0x3e')]&&_0x4daaea[_0x631a('0x3e')][0x2]?_0x4daaea[_0x631a('0x3e')][0x2]['value']:undefined)||0x14}];case'multibar-chart':case _0x631a('0x4c'):return[{'name':_0x631a('0x4d'),'value':_0x4daaea[_0x631a('0x4d')]||(_0x4daaea[_0x631a('0x3e')]&&_0x4daaea['attrs'][0x0]?_0x4daaea['attrs'][0x0]['value']:undefined)||'total'},{'name':_0x631a('0x4e'),'value':_0x4daaea[_0x631a('0x4e')]||(_0x4daaea[_0x631a('0x3e')]&&_0x4daaea[_0x631a('0x3e')][0x1]?_0x4daaea[_0x631a('0x3e')][0x1][_0x631a('0x3f')]:undefined)||null},{'name':'attrSerie3','value':_0x4daaea[_0x631a('0x4f')]||(_0x4daaea['attrs']&&_0x4daaea[_0x631a('0x3e')][0x2]?_0x4daaea['attrs'][0x2][_0x631a('0x3f')]:undefined)||null},{'name':_0x631a('0x4b'),'value':_0x4daaea[_0x631a('0x4b')]||(_0x4daaea[_0x631a('0x3e')]&&_0x4daaea[_0x631a('0x3e')][0x3]?_0x4daaea[_0x631a('0x3e')][0x3]['value']:undefined)||[]}];case _0x631a('0x50'):return[{'name':'attrReport','type':_0x4daaea['reportType']||(_0x4daaea[_0x631a('0x3e')]&&_0x4daaea[_0x631a('0x3e')][0x0]?_0x4daaea[_0x631a('0x3e')][0x0][_0x631a('0x3c')]:undefined)||null,'value':_0x4daaea[_0x631a('0x51')]||(_0x4daaea[_0x631a('0x3e')]&&_0x4daaea[_0x631a('0x3e')][0x0]?_0x4daaea[_0x631a('0x3e')][0x0]['value']:undefined)||null},{'name':'attrRefresh','value':_0x4daaea[_0x631a('0x52')]||(_0x4daaea['attrs']&&_0x4daaea['attrs'][0x1]?_0x4daaea['attrs'][0x1][_0x631a('0x3f')]:undefined)||0x0}];default:return[];}}catch(_0x1e810a){logger[_0x631a('0x53')](_0x631a('0x54'),JSON[_0x631a('0x55')](_0x1e810a));return[];}}exports[_0x631a('0x56')]=function(_0x471fbd,_0x35f273){if(_0x471fbd[_0x631a('0x57')]){_0x471fbd[_0x631a('0x57')][_0x631a('0x3e')]=widgetAttributes(_0x471fbd[_0x631a('0x57')]);}return db[_0x631a('0x39')][_0x631a('0x56')](_0x471fbd[_0x631a('0x57')],{})['then'](respondWithResult(_0x35f273,0xc9))[_0x631a('0x3b')](handleError(_0x35f273,null));};exports[_0x631a('0x58')]=function(_0x118282,_0x2e1e92){if(_0x118282[_0x631a('0x57')]['id']){delete _0x118282[_0x631a('0x57')]['id'];}_0x118282[_0x631a('0x57')][_0x631a('0x3e')]=widgetAttributes(_0x118282['body']);return db['DashboardItem'][_0x631a('0x3a')]({'where':{'id':_0x118282['params']['id']}})[_0x631a('0x27')](handleEntityNotFound(_0x2e1e92,null))['then'](saveUpdates(_0x118282['body'],null))['then'](respondWithResult(_0x2e1e92,null))[_0x631a('0x3b')](handleError(_0x2e1e92,null));}; \ No newline at end of file diff --git a/server/api/dashboardItem/dashboardItem.events.js b/server/api/dashboardItem/dashboardItem.events.js index 66340a2..2c214d3 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 _0x9abb=['hasOwnProperty','hook','exports','DashboardItem','setMaxListeners','save','update','remove','emit'];(function(_0x164eca,_0x555e28){var _0x2ce562=function(_0x148ca6){while(--_0x148ca6){_0x164eca['push'](_0x164eca['shift']());}};_0x2ce562(++_0x555e28);}(_0x9abb,0xae));var _0xb9ab=function(_0x1dc846,_0x3616de){_0x1dc846=_0x1dc846-0x0;var _0x3eff12=_0x9abb[_0x1dc846];return _0x3eff12;};'use strict';var EventEmitter=require('events');var DashboardItem=require('../../mysqldb')['db'][_0xb9ab('0x0')];var DashboardItemEvents=new EventEmitter();DashboardItemEvents[_0xb9ab('0x1')](0x0);var events={'afterCreate':_0xb9ab('0x2'),'afterUpdate':_0xb9ab('0x3'),'afterDestroy':_0xb9ab('0x4')};function emitEvent(_0x120b61){return function(_0x330721,_0xffea,_0x448a50){DashboardItemEvents[_0xb9ab('0x5')](_0x120b61+':'+_0x330721['id'],_0x330721);DashboardItemEvents[_0xb9ab('0x5')](_0x120b61,_0x330721);_0x448a50(null);};}for(var e in events){if(events[_0xb9ab('0x6')](e)){var event=events[e];DashboardItem[_0xb9ab('0x7')](e,emitEvent(event));}}module[_0xb9ab('0x8')]=DashboardItemEvents; \ No newline at end of file +var _0x9b88=['setMaxListeners','remove','emit','hook','exports','events','../../mysqldb','DashboardItem'];(function(_0x2641f9,_0x26715f){var _0x585741=function(_0x2d1462){while(--_0x2d1462){_0x2641f9['push'](_0x2641f9['shift']());}};_0x585741(++_0x26715f);}(_0x9b88,0x1bd));var _0x89b8=function(_0x3db1f7,_0x2beb9b){_0x3db1f7=_0x3db1f7-0x0;var _0x5016ed=_0x9b88[_0x3db1f7];return _0x5016ed;};'use strict';var EventEmitter=require(_0x89b8('0x0'));var DashboardItem=require(_0x89b8('0x1'))['db'][_0x89b8('0x2')];var DashboardItemEvents=new EventEmitter();DashboardItemEvents[_0x89b8('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':'update','afterDestroy':_0x89b8('0x4')};function emitEvent(_0x4c73a4){return function(_0x5b4512,_0x542766,_0xb1eec){DashboardItemEvents['emit'](_0x4c73a4+':'+_0x5b4512['id'],_0x5b4512);DashboardItemEvents[_0x89b8('0x5')](_0x4c73a4,_0x5b4512);_0xb1eec(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];DashboardItem[_0x89b8('0x6')](e,emitEvent(event));}}module[_0x89b8('0x7')]=DashboardItemEvents; \ No newline at end of file diff --git a/server/api/dashboardItem/dashboardItem.model.js b/server/api/dashboardItem/dashboardItem.model.js index e06bdfc..b0511ca 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 _0x960a=['bluebird','request-promise','path','rimraf','../../config/environment','./dashboardItem.attributes','exports','dashboard_items','lodash','../../config/logger','api','moment'];(function(_0x44eb31,_0x5c335e){var _0x3b901b=function(_0x113ed0){while(--_0x113ed0){_0x44eb31['push'](_0x44eb31['shift']());}};_0x3b901b(++_0x5c335e);}(_0x960a,0x104));var _0xa960=function(_0x13559f,_0x341c2d){_0x13559f=_0x13559f-0x0;var _0x129928=_0x960a[_0x13559f];return _0x129928;};'use strict';var _=require(_0xa960('0x0'));var util=require('util');var logger=require(_0xa960('0x1'))(_0xa960('0x2'));var moment=require(_0xa960('0x3'));var BPromise=require(_0xa960('0x4'));var rp=require(_0xa960('0x5'));var fs=require('fs');var path=require(_0xa960('0x6'));var rimraf=require(_0xa960('0x7'));var config=require(_0xa960('0x8'));var attributes=require(_0xa960('0x9'));module[_0xa960('0xa')]=function(_0x710086,_0x1f6932){return _0x710086['define']('DashboardItem',attributes,{'tableName':_0xa960('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xfad4=['./dashboardItem.attributes','define','DashboardItem','lodash','util','../../config/logger','bluebird','request-promise','path','../../config/environment'];(function(_0xbe35f2,_0xc16251){var _0x26ec9f=function(_0x142ae9){while(--_0x142ae9){_0xbe35f2['push'](_0xbe35f2['shift']());}};_0x26ec9f(++_0xc16251);}(_0xfad4,0x11b));var _0x4fad=function(_0x4c8270,_0xec4f72){_0x4c8270=_0x4c8270-0x0;var _0x38ff77=_0xfad4[_0x4c8270];return _0x38ff77;};'use strict';var _=require(_0x4fad('0x0'));var util=require(_0x4fad('0x1'));var logger=require(_0x4fad('0x2'))('api');var moment=require('moment');var BPromise=require(_0x4fad('0x3'));var rp=require(_0x4fad('0x4'));var fs=require('fs');var path=require(_0x4fad('0x5'));var rimraf=require('rimraf');var config=require(_0x4fad('0x6'));var attributes=require(_0x4fad('0x7'));module['exports']=function(_0x4efa61,_0x4cc53d){return _0x4efa61[_0x4fad('0x8')](_0x4fad('0x9'),attributes,{'tableName':'dashboard_items','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 693eeff..4a9d777 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 _0x35d1=['randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','client','http','defaults','redis','localhost','socket.io-emitter','./dashboardItem.socket','register','request','info','DashboardItem,\x20%s,\x20%s','request\x20sent','debug','DashboardItem,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','bluebird'];(function(_0x238830,_0x545f75){var _0x5917f0=function(_0x12f821){while(--_0x12f821){_0x238830['push'](_0x238830['shift']());}};_0x5917f0(++_0x545f75);}(_0x35d1,0x128));var _0x135d=function(_0x101802,_0x11f913){_0x101802=_0x101802-0x0;var _0x5d61ce=_0x35d1[_0x101802];return _0x5d61ce;};'use strict';var _=require('lodash');var util=require('util');var moment=require('moment');var BPromise=require(_0x135d('0x0'));var rs=require(_0x135d('0x1'));var fs=require('fs');var Redis=require(_0x135d('0x2'));var db=require(_0x135d('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0x135d('0x4'))(_0x135d('0x5'));var config=require(_0x135d('0x6'));var jayson=require('jayson/promise');var client=jayson[_0x135d('0x7')][_0x135d('0x8')]({'port':0x232a});config['redis']=_[_0x135d('0x9')](config[_0x135d('0xa')],{'host':_0x135d('0xb'),'port':0x18eb});var socket=require(_0x135d('0xc'))(new Redis(config[_0x135d('0xa')]));require(_0x135d('0xd'))[_0x135d('0xe')](socket);function respondWithRpcPromise(_0x4b7123,_0x382e26,_0x238885){return new BPromise(function(_0x1c0904,_0x4d625e){return client[_0x135d('0xf')](_0x4b7123,_0x238885)['then'](function(_0x42dd16){logger[_0x135d('0x10')](_0x135d('0x11'),_0x382e26,_0x135d('0x12'));logger[_0x135d('0x13')](_0x135d('0x14'),_0x382e26,_0x135d('0x12'),JSON[_0x135d('0x15')](_0x42dd16));if(_0x42dd16['error']){if(_0x42dd16[_0x135d('0x16')][_0x135d('0x17')]===0x1f4){logger[_0x135d('0x16')](_0x135d('0x11'),_0x382e26,_0x42dd16[_0x135d('0x16')]['message']);return _0x4d625e(_0x42dd16[_0x135d('0x16')][_0x135d('0x18')]);}logger['error'](_0x135d('0x11'),_0x382e26,_0x42dd16[_0x135d('0x16')][_0x135d('0x18')]);return _0x1c0904(_0x42dd16['error'][_0x135d('0x18')]);}else{logger[_0x135d('0x10')](_0x135d('0x11'),_0x382e26,_0x135d('0x12'));_0x1c0904(_0x42dd16[_0x135d('0x19')]['message']);}})[_0x135d('0x1a')](function(_0x29be7d){logger[_0x135d('0x16')](_0x135d('0x11'),_0x382e26,_0x29be7d);_0x4d625e(_0x29be7d);});});} \ No newline at end of file +var _0xe67a=['moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','redis','defaults','localhost','./dashboardItem.socket','register','then','info','DashboardItem,\x20%s,\x20%s','debug','DashboardItem,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','result','catch','lodash'];(function(_0x174d5f,_0x51d876){var _0x803d05=function(_0x54fedf){while(--_0x54fedf){_0x174d5f['push'](_0x174d5f['shift']());}};_0x803d05(++_0x51d876);}(_0xe67a,0xdf));var _0xae67=function(_0xab6e5c,_0x14be98){_0xab6e5c=_0xab6e5c-0x0;var _0x3020f8=_0xe67a[_0xab6e5c];return _0x3020f8;};'use strict';var _=require(_0xae67('0x0'));var util=require('util');var moment=require(_0xae67('0x1'));var BPromise=require(_0xae67('0x2'));var rs=require(_0xae67('0x3'));var fs=require('fs');var Redis=require(_0xae67('0x4'));var db=require(_0xae67('0x5'))['db'];var utils=require(_0xae67('0x6'));var logger=require(_0xae67('0x7'))(_0xae67('0x8'));var config=require(_0xae67('0x9'));var jayson=require('jayson/promise');var client=jayson[_0xae67('0xa')][_0xae67('0xb')]({'port':0x232a});config[_0xae67('0xc')]=_[_0xae67('0xd')](config[_0xae67('0xc')],{'host':_0xae67('0xe'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xae67('0xc')]));require(_0xae67('0xf'))[_0xae67('0x10')](socket);function respondWithRpcPromise(_0x146657,_0x2c0e08,_0xcb9b01){return new BPromise(function(_0x2ef68f,_0x2b44a7){return client['request'](_0x146657,_0xcb9b01)[_0xae67('0x11')](function(_0x1b3e94){logger[_0xae67('0x12')](_0xae67('0x13'),_0x2c0e08,'request\x20sent');logger[_0xae67('0x14')](_0xae67('0x15'),_0x2c0e08,_0xae67('0x16'),JSON['stringify'](_0x1b3e94));if(_0x1b3e94[_0xae67('0x17')]){if(_0x1b3e94[_0xae67('0x17')][_0xae67('0x18')]===0x1f4){logger[_0xae67('0x17')]('DashboardItem,\x20%s,\x20%s',_0x2c0e08,_0x1b3e94['error'][_0xae67('0x19')]);return _0x2b44a7(_0x1b3e94[_0xae67('0x17')]['message']);}logger[_0xae67('0x17')](_0xae67('0x13'),_0x2c0e08,_0x1b3e94[_0xae67('0x17')][_0xae67('0x19')]);return _0x2ef68f(_0x1b3e94[_0xae67('0x17')]['message']);}else{logger['info'](_0xae67('0x13'),_0x2c0e08,_0xae67('0x16'));_0x2ef68f(_0x1b3e94[_0xae67('0x1a')][_0xae67('0x19')]);}})[_0xae67('0x1b')](function(_0x372739){logger[_0xae67('0x17')]('DashboardItem,\x20%s,\x20%s',_0x2c0e08,_0x372739);_0x2b44a7(_0x372739);});});} \ No newline at end of file diff --git a/server/api/dashboardItem/dashboardItem.socket.js b/server/api/dashboardItem/dashboardItem.socket.js index 8078417..1706cf4 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 _0x4607=['register','length','dashboardItem:','save','update','emit','removeListener'];(function(_0x48a79f,_0x444128){var _0x4a3ebe=function(_0x2022bc){while(--_0x2022bc){_0x48a79f['push'](_0x48a79f['shift']());}};_0x4a3ebe(++_0x444128);}(_0x4607,0x1ed));var _0x7460=function(_0x4a1f7d,_0x3a958f){_0x4a1f7d=_0x4a1f7d-0x0;var _0x120ad5=_0x4607[_0x4a1f7d];return _0x120ad5;};'use strict';var DashboardItemEvents=require('./dashboardItem.events');var events=[_0x7460('0x0'),'remove',_0x7460('0x1')];function createListener(_0x156aaf,_0x5df577){return function(_0x59e754){_0x5df577[_0x7460('0x2')](_0x156aaf,_0x59e754);};}function removeListener(_0x3eed0c,_0x27220b){return function(){DashboardItemEvents[_0x7460('0x3')](_0x3eed0c,_0x27220b);};}exports[_0x7460('0x4')]=function(_0x52ef94){for(var _0x394a77=0x0,_0x4cc648=events[_0x7460('0x5')];_0x394a77<_0x4cc648;_0x394a77++){var _0x225493=events[_0x394a77];var _0x396da3=createListener(_0x7460('0x6')+_0x225493,_0x52ef94);DashboardItemEvents['on'](_0x225493,_0x396da3);}}; \ No newline at end of file +var _0x986f=['remove','update','register','length','./dashboardItem.events'];(function(_0x2f36c3,_0x24bea1){var _0x4386b8=function(_0x401c6f){while(--_0x401c6f){_0x2f36c3['push'](_0x2f36c3['shift']());}};_0x4386b8(++_0x24bea1);}(_0x986f,0xbd));var _0xf986=function(_0x1f44de,_0x510a48){_0x1f44de=_0x1f44de-0x0;var _0x308b95=_0x986f[_0x1f44de];return _0x308b95;};'use strict';var DashboardItemEvents=require(_0xf986('0x0'));var events=['save',_0xf986('0x1'),_0xf986('0x2')];function createListener(_0x35b821,_0x9d54d2){return function(_0xbb02f){_0x9d54d2['emit'](_0x35b821,_0xbb02f);};}function removeListener(_0x11294c,_0x21021e){return function(){DashboardItemEvents['removeListener'](_0x11294c,_0x21021e);};}exports[_0xf986('0x3')]=function(_0x8f014f){for(var _0x3f479=0x0,_0x123da9=events[_0xf986('0x4')];_0x3f479<_0x123da9;_0x3f479++){var _0x57d6df=events[_0x3f479];var _0x51daa4=createListener('dashboardItem:'+_0x57d6df,_0x8f014f);DashboardItemEvents['on'](_0x57d6df,_0x51daa4);}}; \ No newline at end of file diff --git a/server/api/dashboardItem/index.js b/server/api/dashboardItem/index.js index 7761f4d..d1f2b3b 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 _0xdbf5=['../../components/interaction/service','../../config/environment','./dashboardItem.controller','get','/:id','isAuthenticated','show','post','create','update','delete','exports','util','express','Router','../../components/auth/service'];(function(_0x3594bf,_0x479f17){var _0x1a714a=function(_0x4afd23){while(--_0x4afd23){_0x3594bf['push'](_0x3594bf['shift']());}};_0x1a714a(++_0x479f17);}(_0xdbf5,0x18c));var _0x5dbf=function(_0x2efe78,_0x46776d){_0x2efe78=_0x2efe78-0x0;var _0x6d1d79=_0xdbf5[_0x2efe78];return _0x6d1d79;};'use strict';var multer=require('multer');var util=require(_0x5dbf('0x0'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0x5dbf('0x1'));var router=express[_0x5dbf('0x2')]();var auth=require(_0x5dbf('0x3'));var interaction=require(_0x5dbf('0x4'));var config=require(_0x5dbf('0x5'));var controller=require(_0x5dbf('0x6'));router[_0x5dbf('0x7')](_0x5dbf('0x8'),auth[_0x5dbf('0x9')](),controller[_0x5dbf('0xa')]);router[_0x5dbf('0xb')]('/',auth[_0x5dbf('0x9')](),controller[_0x5dbf('0xc')]);router['put'](_0x5dbf('0x8'),auth['isAuthenticated'](),controller[_0x5dbf('0xd')]);router[_0x5dbf('0xe')](_0x5dbf('0x8'),auth[_0x5dbf('0x9')](),controller['destroy']);module[_0x5dbf('0xf')]=router; \ No newline at end of file +var _0x3f8a=['isAuthenticated','show','post','create','put','update','delete','destroy','exports','multer','util','path','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./dashboardItem.controller','get','/:id'];(function(_0x40a045,_0x516f0e){var _0x1a687c=function(_0x48c9fe){while(--_0x48c9fe){_0x40a045['push'](_0x40a045['shift']());}};_0x1a687c(++_0x516f0e);}(_0x3f8a,0x1d5));var _0xa3f8=function(_0x37b9ad,_0x179adf){_0x37b9ad=_0x37b9ad-0x0;var _0x6264e2=_0x3f8a[_0x37b9ad];return _0x6264e2;};'use strict';var multer=require(_0xa3f8('0x0'));var util=require(_0xa3f8('0x1'));var path=require(_0xa3f8('0x2'));var timeout=require(_0xa3f8('0x3'));var express=require('express');var router=express[_0xa3f8('0x4')]();var auth=require(_0xa3f8('0x5'));var interaction=require(_0xa3f8('0x6'));var config=require(_0xa3f8('0x7'));var controller=require(_0xa3f8('0x8'));router[_0xa3f8('0x9')](_0xa3f8('0xa'),auth[_0xa3f8('0xb')](),controller[_0xa3f8('0xc')]);router[_0xa3f8('0xd')]('/',auth[_0xa3f8('0xb')](),controller[_0xa3f8('0xe')]);router[_0xa3f8('0xf')](_0xa3f8('0xa'),auth[_0xa3f8('0xb')](),controller[_0xa3f8('0x10')]);router[_0xa3f8('0x11')]('/:id',auth[_0xa3f8('0xb')](),controller[_0xa3f8('0x12')]);module[_0xa3f8('0x13')]=router; \ No newline at end of file diff --git a/server/api/disposition/disposition.attributes.js b/server/api/disposition/disposition.attributes.js index b663f0a..daa5223 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 _0x47e5=['sequelize','exports','STRING'];(function(_0x3c75b4,_0x81b8c9){var _0xfeaf34=function(_0x3b06de){while(--_0x3b06de){_0x3c75b4['push'](_0x3c75b4['shift']());}};_0xfeaf34(++_0x81b8c9);}(_0x47e5,0xd8));var _0x547e=function(_0x274dd7,_0x2e6051){_0x274dd7=_0x274dd7-0x0;var _0x148829=_0x47e5[_0x274dd7];return _0x148829;};'use strict';var Sequelize=require(_0x547e('0x0'));module[_0x547e('0x1')]={'name':{'type':Sequelize[_0x547e('0x2')],'allowNull':![]}}; \ No newline at end of file +var _0xe019=['sequelize','exports','STRING'];(function(_0x1dbfd3,_0x1c10db){var _0x439baf=function(_0x5e793d){while(--_0x5e793d){_0x1dbfd3['push'](_0x1dbfd3['shift']());}};_0x439baf(++_0x1c10db);}(_0xe019,0x108));var _0x9e01=function(_0x493f77,_0x4567ac){_0x493f77=_0x493f77-0x0;var _0x472bf8=_0xe019[_0x493f77];return _0x472bf8;};'use strict';var Sequelize=require(_0x9e01('0x0'));module[_0x9e01('0x1')]={'name':{'type':Sequelize[_0x9e01('0x2')],'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/disposition/disposition.controller.js b/server/api/disposition/disposition.controller.js index 8bef2d1..83fd3de 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 _0x9b67=['create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','find','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','path','sox','to-csv','ejs','lodash','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/environment','../../mysqldb','sendStatus','status','end','json','count','offset','limit','set','Content-Range','apply','reject','update','then','get','Dispositions','destroy','stack','name','index','map','Disposition','fieldName','type','key','model','query','keys','attributes','intersection','fields','length','nolimit','order','sort','where','filters','filter','merge','options','includeAll','include','findAll','rows','catch','params','rawAttributes'];(function(_0x3f09ce,_0x4f8b7d){var _0x332e92=function(_0x1ceaaf){while(--_0x1ceaaf){_0x3f09ce['push'](_0x3f09ce['shift']());}};_0x332e92(++_0x4f8b7d);}(_0x9b67,0xf6));var _0x79b6=function(_0x20b4ae,_0x309cd9){_0x20b4ae=_0x20b4ae-0x0;var _0x3cefed=_0x9b67[_0x20b4ae];return _0x3cefed;};'use strict';var pdf=require(_0x79b6('0x0'));var emlformat=require(_0x79b6('0x1'));var rimraf=require(_0x79b6('0x2'));var zipdir=require(_0x79b6('0x3'));var jsonpatch=require(_0x79b6('0x4'));var rp=require('request-promise');var moment=require(_0x79b6('0x5'));var BPromise=require(_0x79b6('0x6'));var Mustache=require('mustache');var util=require('util');var path=require(_0x79b6('0x7'));var sox=require(_0x79b6('0x8'));var csv=require(_0x79b6('0x9'));var ejs=require(_0x79b6('0xa'));var fs=require('fs');var _=require(_0x79b6('0xb'));var squel=require(_0x79b6('0xc'));var crypto=require(_0x79b6('0xd'));var jsforce=require('jsforce');var deskjs=require(_0x79b6('0xe'));var toCsv=require(_0x79b6('0x9'));var querystring=require(_0x79b6('0xf'));var Papa=require(_0x79b6('0x10'));var Redis=require(_0x79b6('0x11'));var authService=require('../../components/auth/service');var qs=require(_0x79b6('0x12'));var as=require(_0x79b6('0x13'));var hardwareService=require(_0x79b6('0x14'));var logger=require(_0x79b6('0x15'))('api');var utils=require('../../config/utils');var config=require(_0x79b6('0x16'));var db=require(_0x79b6('0x17'))['db'];function respondWithStatusCode(_0x303cfb,_0x526727){_0x526727=_0x526727||0xcc;return function(_0xc05a77){if(_0xc05a77){return _0x303cfb[_0x79b6('0x18')](_0x526727);}return _0x303cfb[_0x79b6('0x19')](_0x526727)[_0x79b6('0x1a')]();};}function respondWithResult(_0x3b0721,_0x40478d){_0x40478d=_0x40478d||0xc8;return function(_0x19d5b2){if(_0x19d5b2){return _0x3b0721[_0x79b6('0x19')](_0x40478d)[_0x79b6('0x1b')](_0x19d5b2);}};}function respondWithFilteredResult(_0x114d8c,_0x2ac966){return function(_0x3563cc){if(_0x3563cc){var _0x1e8bf1=_0x3563cc[_0x79b6('0x1c')],_0x4cf491=_0x2ac966[_0x79b6('0x1d')],_0x207bcc=_0x2ac966[_0x79b6('0x1d')]+_0x2ac966[_0x79b6('0x1e')],_0x2a75d5;if(_0x207bcc>=_0x1e8bf1){_0x207bcc=_0x1e8bf1;_0x2a75d5=0xc8;}else{_0x2a75d5=0xce;}_0x114d8c[_0x79b6('0x19')](_0x2a75d5);return _0x114d8c[_0x79b6('0x1f')](_0x79b6('0x20'),_0x4cf491+'-'+_0x207bcc+'/'+_0x1e8bf1)[_0x79b6('0x1b')](_0x3563cc);}return null;};}function patchUpdates(_0x323376){return function(_0xa1a29a){try{jsonpatch[_0x79b6('0x21')](_0xa1a29a,_0x323376,!![]);}catch(_0x52a70f){return BPromise[_0x79b6('0x22')](_0x52a70f);}return _0xa1a29a['save']();};}function saveUpdates(_0x22a9eb,_0x532e65){return function(_0x28b9c2){if(_0x28b9c2){return _0x28b9c2[_0x79b6('0x23')](_0x22a9eb)[_0x79b6('0x24')](function(_0x56ebf4){return _0x56ebf4;});}return null;};}function removeEntity(_0x46304b,_0x30dc0b){return function(_0x53208a){if(_0x53208a){return _0x53208a['destroy']()[_0x79b6('0x24')](function(){var _0x2e2948=_0x53208a[_0x79b6('0x25')]({'plain':!![]});var _0x268826=_0x79b6('0x26');return db['UserProfileResource'][_0x79b6('0x27')]({'where':{'type':_0x268826,'resourceId':_0x2e2948['id']}})[_0x79b6('0x24')](function(){return _0x53208a;});})[_0x79b6('0x24')](function(){_0x46304b[_0x79b6('0x19')](0xcc)['end']();});}};}function handleEntityNotFound(_0x53c03c,_0x40ef76){return function(_0x2d16b2){if(!_0x2d16b2){_0x53c03c[_0x79b6('0x18')](0x194);}return _0x2d16b2;};}function handleError(_0xc25c99,_0x4adf15){_0x4adf15=_0x4adf15||0x1f4;return function(_0x6f6ca1){logger['error'](_0x6f6ca1[_0x79b6('0x28')]);if(_0x6f6ca1[_0x79b6('0x29')]){delete _0x6f6ca1[_0x79b6('0x29')];}_0xc25c99[_0x79b6('0x19')](_0x4adf15)['send'](_0x6f6ca1);};}exports[_0x79b6('0x2a')]=function(_0x310832,_0x53b463){var _0x158221={},_0x2d219c={},_0x1b1f2b={'count':0x0,'rows':[]};var _0x4f47dc=_[_0x79b6('0x2b')](db[_0x79b6('0x2c')]['rawAttributes'],function(_0x160d2a){return{'name':_0x160d2a[_0x79b6('0x2d')],'type':_0x160d2a[_0x79b6('0x2e')][_0x79b6('0x2f')]};});_0x2d219c[_0x79b6('0x30')]=_[_0x79b6('0x2b')](_0x4f47dc,'name');_0x2d219c[_0x79b6('0x31')]=_[_0x79b6('0x32')](_0x310832[_0x79b6('0x31')]);_0x2d219c['filters']=_['intersection'](_0x2d219c[_0x79b6('0x30')],_0x2d219c[_0x79b6('0x31')]);_0x158221[_0x79b6('0x33')]=_[_0x79b6('0x34')](_0x2d219c[_0x79b6('0x30')],qs[_0x79b6('0x35')](_0x310832['query']['fields']));_0x158221[_0x79b6('0x33')]=_0x158221['attributes'][_0x79b6('0x36')]?_0x158221['attributes']:_0x2d219c[_0x79b6('0x30')];if(!_0x310832[_0x79b6('0x31')]['hasOwnProperty'](_0x79b6('0x37'))){_0x158221[_0x79b6('0x1e')]=qs['limit'](_0x310832[_0x79b6('0x31')]['limit']);_0x158221[_0x79b6('0x1d')]=qs[_0x79b6('0x1d')](_0x310832[_0x79b6('0x31')][_0x79b6('0x1d')]);}_0x158221[_0x79b6('0x38')]=qs[_0x79b6('0x39')](_0x310832[_0x79b6('0x31')][_0x79b6('0x39')]);_0x158221[_0x79b6('0x3a')]=qs[_0x79b6('0x3b')](_['pick'](_0x310832['query'],_0x2d219c['filters']));if(_0x310832[_0x79b6('0x31')][_0x79b6('0x3c')]){_0x158221['where']=_[_0x79b6('0x3d')](_0x158221['where'],{'$or':_[_0x79b6('0x2b')](_0x4f47dc,function(_0x42757a){if(_0x42757a[_0x79b6('0x2e')]!=='VIRTUAL'){var _0x601bb8={};_0x601bb8[_0x42757a['name']]={'$like':'%'+_0x310832[_0x79b6('0x31')][_0x79b6('0x3c')]+'%'};return _0x601bb8;}})});}_0x158221=_[_0x79b6('0x3d')]({},_0x158221,_0x310832[_0x79b6('0x3e')]);var _0x1cb2a6={'where':_0x158221['where']};return db['Disposition'][_0x79b6('0x1c')](_0x1cb2a6)['then'](function(_0x4037c8){_0x1b1f2b[_0x79b6('0x1c')]=_0x4037c8;if(_0x310832[_0x79b6('0x31')][_0x79b6('0x3f')]){_0x158221[_0x79b6('0x40')]=[{'all':!![]}];}return db[_0x79b6('0x2c')][_0x79b6('0x41')](_0x158221);})['then'](function(_0x109514){_0x1b1f2b[_0x79b6('0x42')]=_0x109514;return _0x1b1f2b;})[_0x79b6('0x24')](respondWithFilteredResult(_0x53b463,_0x158221))[_0x79b6('0x43')](handleError(_0x53b463,null));};exports['show']=function(_0x12ea22,_0x4f803c){var _0x4ba212={'raw':!![],'where':{'id':_0x12ea22[_0x79b6('0x44')]['id']}},_0x22025a={};_0x22025a[_0x79b6('0x30')]=_[_0x79b6('0x32')](db[_0x79b6('0x2c')][_0x79b6('0x45')]);_0x22025a[_0x79b6('0x31')]=_[_0x79b6('0x32')](_0x12ea22['query']);_0x22025a[_0x79b6('0x3b')]=_['intersection'](_0x22025a['model'],_0x22025a[_0x79b6('0x31')]);_0x4ba212[_0x79b6('0x33')]=_[_0x79b6('0x34')](_0x22025a[_0x79b6('0x30')],qs[_0x79b6('0x35')](_0x12ea22[_0x79b6('0x31')][_0x79b6('0x35')]));_0x4ba212[_0x79b6('0x33')]=_0x4ba212[_0x79b6('0x33')]['length']?_0x4ba212[_0x79b6('0x33')]:_0x22025a[_0x79b6('0x30')];if(_0x12ea22[_0x79b6('0x31')][_0x79b6('0x3f')]){_0x4ba212[_0x79b6('0x40')]=[{'all':!![]}];}_0x4ba212=_['merge']({},_0x4ba212,_0x12ea22[_0x79b6('0x3e')]);return db[_0x79b6('0x2c')]['find'](_0x4ba212)['then'](handleEntityNotFound(_0x4f803c,null))[_0x79b6('0x24')](respondWithResult(_0x4f803c,null))[_0x79b6('0x43')](handleError(_0x4f803c,null));};exports[_0x79b6('0x46')]=function(_0xa0c396,_0x37f4b1){return db[_0x79b6('0x2c')][_0x79b6('0x46')](_0xa0c396[_0x79b6('0x47')],{})[_0x79b6('0x24')](function(_0x909351){var _0x15c795=_0xa0c396[_0x79b6('0x48')][_0x79b6('0x25')]({'plain':!![]});if(!_0x15c795)throw new Error(_0x79b6('0x49'));if(_0x15c795[_0x79b6('0x4a')]===_0x79b6('0x48')){var _0x26ab29=_0x909351[_0x79b6('0x25')]({'plain':!![]});var _0x29216c='Dispositions';return db['UserProfileSection']['find']({'where':{'name':_0x29216c,'userProfileId':_0x15c795['userProfileId']},'raw':!![]})['then'](function(_0x412c1e){if(_0x412c1e&&_0x412c1e[_0x79b6('0x4b')]===0x0){return db[_0x79b6('0x4c')][_0x79b6('0x46')]({'name':_0x26ab29[_0x79b6('0x29')],'resourceId':_0x26ab29['id'],'type':_0x412c1e[_0x79b6('0x29')],'sectionId':_0x412c1e['id']},{})['then'](function(){return _0x909351;});}else{return _0x909351;}})[_0x79b6('0x43')](function(_0xa2ba0e){logger['error'](_0x79b6('0x4d'),_0xa2ba0e);throw _0xa2ba0e;});}return _0x909351;})['then'](respondWithResult(_0x37f4b1,0xc9))[_0x79b6('0x43')](handleError(_0x37f4b1,null));};exports['update']=function(_0x48dd20,_0x46adb4){if(_0x48dd20[_0x79b6('0x47')]['id']){delete _0x48dd20[_0x79b6('0x47')]['id'];}return db[_0x79b6('0x2c')][_0x79b6('0x4e')]({'where':{'id':_0x48dd20[_0x79b6('0x44')]['id']}})['then'](handleEntityNotFound(_0x46adb4,null))['then'](saveUpdates(_0x48dd20[_0x79b6('0x47')],null))[_0x79b6('0x24')](respondWithResult(_0x46adb4,null))['catch'](handleError(_0x46adb4,null));};exports[_0x79b6('0x27')]=function(_0x251118,_0x12cb4c){return db[_0x79b6('0x2c')][_0x79b6('0x4e')]({'where':{'id':_0x251118[_0x79b6('0x44')]['id']}})[_0x79b6('0x24')](handleEntityNotFound(_0x12cb4c,null))['then'](removeEntity(_0x12cb4c,null))[_0x79b6('0x43')](handleError(_0x12cb4c,null));}; \ No newline at end of file +var _0x8958=['util','path','to-csv','ejs','lodash','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','status','end','count','offset','limit','set','Content-Range','json','apply','update','then','get','Dispositions','sendStatus','stack','name','send','rawAttributes','fieldName','type','key','map','query','filters','intersection','model','fields','attributes','hasOwnProperty','nolimit','order','sort','where','filter','merge','VIRTUAL','options','Disposition','includeAll','keys','length','include','find','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileResource','create','catch','error','params','destroy','eml-format','moment','mustache'];(function(_0x271942,_0x53d86e){var _0x221c6d=function(_0x5a74f1){while(--_0x5a74f1){_0x271942['push'](_0x271942['shift']());}};_0x221c6d(++_0x53d86e);}(_0x8958,0x93));var _0x8895=function(_0x2eb306,_0x2290ab){_0x2eb306=_0x2eb306-0x0;var _0x3dd996=_0x8958[_0x2eb306];return _0x3dd996;};'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(){var _0x5db3a0=_0xc1ce17[_0x8895('0x21')]({'plain':!![]});var _0x1f71f3=_0x8895('0x22');return db['UserProfileResource']['destroy']({'where':{'type':_0x1f71f3,'resourceId':_0x5db3a0['id']}})[_0x8895('0x20')](function(){return _0xc1ce17;});})[_0x8895('0x20')](function(){_0x35bda5[_0x8895('0x16')](0xcc)[_0x8895('0x17')]();});}};}function handleEntityNotFound(_0x4fc150,_0x25da11){return function(_0x1e8ac9){if(!_0x1e8ac9){_0x4fc150[_0x8895('0x23')](0x194);}return _0x1e8ac9;};}function handleError(_0x5486a6,_0x4aee03){_0x4aee03=_0x4aee03||0x1f4;return function(_0x78b57){logger['error'](_0x78b57[_0x8895('0x24')]);if(_0x78b57[_0x8895('0x25')]){delete _0x78b57[_0x8895('0x25')];}_0x5486a6[_0x8895('0x16')](_0x4aee03)[_0x8895('0x26')](_0x78b57);};}exports['index']=function(_0x4d567a,_0x6e449d){var _0x37ac3a={},_0x3fc4cc={},_0x16b65b={'count':0x0,'rows':[]};var _0x19b6dd=_['map'](db['Disposition'][_0x8895('0x27')],function(_0x848a11){return{'name':_0x848a11[_0x8895('0x28')],'type':_0x848a11[_0x8895('0x29')][_0x8895('0x2a')]};});_0x3fc4cc['model']=_[_0x8895('0x2b')](_0x19b6dd,'name');_0x3fc4cc[_0x8895('0x2c')]=_['keys'](_0x4d567a[_0x8895('0x2c')]);_0x3fc4cc[_0x8895('0x2d')]=_[_0x8895('0x2e')](_0x3fc4cc[_0x8895('0x2f')],_0x3fc4cc[_0x8895('0x2c')]);_0x37ac3a['attributes']=_[_0x8895('0x2e')](_0x3fc4cc[_0x8895('0x2f')],qs[_0x8895('0x30')](_0x4d567a[_0x8895('0x2c')][_0x8895('0x30')]));_0x37ac3a['attributes']=_0x37ac3a[_0x8895('0x31')]['length']?_0x37ac3a[_0x8895('0x31')]:_0x3fc4cc['model'];if(!_0x4d567a[_0x8895('0x2c')][_0x8895('0x32')](_0x8895('0x33'))){_0x37ac3a[_0x8895('0x1a')]=qs[_0x8895('0x1a')](_0x4d567a['query'][_0x8895('0x1a')]);_0x37ac3a['offset']=qs[_0x8895('0x19')](_0x4d567a[_0x8895('0x2c')][_0x8895('0x19')]);}_0x37ac3a[_0x8895('0x34')]=qs[_0x8895('0x35')](_0x4d567a[_0x8895('0x2c')]['sort']);_0x37ac3a[_0x8895('0x36')]=qs[_0x8895('0x2d')](_['pick'](_0x4d567a[_0x8895('0x2c')],_0x3fc4cc['filters']));if(_0x4d567a[_0x8895('0x2c')][_0x8895('0x37')]){_0x37ac3a['where']=_[_0x8895('0x38')](_0x37ac3a[_0x8895('0x36')],{'$or':_['map'](_0x19b6dd,function(_0x58751a){if(_0x58751a[_0x8895('0x29')]!==_0x8895('0x39')){var _0x55aacc={};_0x55aacc[_0x58751a[_0x8895('0x25')]]={'$like':'%'+_0x4d567a[_0x8895('0x2c')]['filter']+'%'};return _0x55aacc;}})});}_0x37ac3a=_[_0x8895('0x38')]({},_0x37ac3a,_0x4d567a[_0x8895('0x3a')]);var _0x394d7d={'where':_0x37ac3a[_0x8895('0x36')]};return db[_0x8895('0x3b')][_0x8895('0x18')](_0x394d7d)['then'](function(_0x174be1){_0x16b65b['count']=_0x174be1;if(_0x4d567a[_0x8895('0x2c')][_0x8895('0x3c')]){_0x37ac3a['include']=[{'all':!![]}];}return db[_0x8895('0x3b')]['findAll'](_0x37ac3a);})[_0x8895('0x20')](function(_0x5e6413){_0x16b65b['rows']=_0x5e6413;return _0x16b65b;})['then'](respondWithFilteredResult(_0x6e449d,_0x37ac3a))['catch'](handleError(_0x6e449d,null));};exports['show']=function(_0x47cf10,_0x447ed6){var _0x206f57={'raw':!![],'where':{'id':_0x47cf10['params']['id']}},_0x596531={};_0x596531[_0x8895('0x2f')]=_[_0x8895('0x3d')](db['Disposition'][_0x8895('0x27')]);_0x596531[_0x8895('0x2c')]=_[_0x8895('0x3d')](_0x47cf10[_0x8895('0x2c')]);_0x596531[_0x8895('0x2d')]=_['intersection'](_0x596531['model'],_0x596531['query']);_0x206f57[_0x8895('0x31')]=_['intersection'](_0x596531[_0x8895('0x2f')],qs[_0x8895('0x30')](_0x47cf10[_0x8895('0x2c')][_0x8895('0x30')]));_0x206f57['attributes']=_0x206f57[_0x8895('0x31')][_0x8895('0x3e')]?_0x206f57[_0x8895('0x31')]:_0x596531[_0x8895('0x2f')];if(_0x47cf10[_0x8895('0x2c')][_0x8895('0x3c')]){_0x206f57[_0x8895('0x3f')]=[{'all':!![]}];}_0x206f57=_[_0x8895('0x38')]({},_0x206f57,_0x47cf10['options']);return db[_0x8895('0x3b')][_0x8895('0x40')](_0x206f57)['then'](handleEntityNotFound(_0x447ed6,null))[_0x8895('0x20')](respondWithResult(_0x447ed6,null))['catch'](handleError(_0x447ed6,null));};exports['create']=function(_0x13546d,_0x337a9f){return db[_0x8895('0x3b')]['create'](_0x13546d[_0x8895('0x41')],{})['then'](function(_0x39a20c){var _0x152197=_0x13546d[_0x8895('0x42')][_0x8895('0x21')]({'plain':!![]});if(!_0x152197)throw new Error(_0x8895('0x43'));if(_0x152197[_0x8895('0x44')]===_0x8895('0x42')){var _0x4dde7c=_0x39a20c['get']({'plain':!![]});var _0x2a933c=_0x8895('0x22');return db['UserProfileSection'][_0x8895('0x40')]({'where':{'name':_0x2a933c,'userProfileId':_0x152197['userProfileId']},'raw':!![]})['then'](function(_0x2daafe){if(_0x2daafe&&_0x2daafe['autoAssociation']===0x0){return db[_0x8895('0x45')][_0x8895('0x46')]({'name':_0x4dde7c[_0x8895('0x25')],'resourceId':_0x4dde7c['id'],'type':_0x2daafe[_0x8895('0x25')],'sectionId':_0x2daafe['id']},{})[_0x8895('0x20')](function(){return _0x39a20c;});}else{return _0x39a20c;}})[_0x8895('0x47')](function(_0x306481){logger[_0x8895('0x48')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x306481);throw _0x306481;});}return _0x39a20c;})[_0x8895('0x20')](respondWithResult(_0x337a9f,0xc9))[_0x8895('0x47')](handleError(_0x337a9f,null));};exports[_0x8895('0x1f')]=function(_0x5a5bc6,_0x1935aa){if(_0x5a5bc6[_0x8895('0x41')]['id']){delete _0x5a5bc6[_0x8895('0x41')]['id'];}return db[_0x8895('0x3b')][_0x8895('0x40')]({'where':{'id':_0x5a5bc6[_0x8895('0x49')]['id']}})[_0x8895('0x20')](handleEntityNotFound(_0x1935aa,null))[_0x8895('0x20')](saveUpdates(_0x5a5bc6[_0x8895('0x41')],null))[_0x8895('0x20')](respondWithResult(_0x1935aa,null))['catch'](handleError(_0x1935aa,null));};exports[_0x8895('0x4a')]=function(_0x17256c,_0xb3d1ab){return db[_0x8895('0x3b')][_0x8895('0x40')]({'where':{'id':_0x17256c['params']['id']}})[_0x8895('0x20')](handleEntityNotFound(_0xb3d1ab,null))[_0x8895('0x20')](removeEntity(_0xb3d1ab,null))[_0x8895('0x47')](handleError(_0xb3d1ab,null));}; \ No newline at end of file diff --git a/server/api/disposition/disposition.model.js b/server/api/disposition/disposition.model.js index 7d2ed52..8a67ca8 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 _0x5149=['OpenchannelAccountId','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','exports','define','tools_dispositions','name_voice','name','ListId','name_chat','ChatWebsiteId','name_mail','MailAccountId','name_fax','FaxAccountId','name_openchannel'];(function(_0xefb1ca,_0x5691d1){var _0xf47f36=function(_0x59034e){while(--_0x59034e){_0xefb1ca['push'](_0xefb1ca['shift']());}};_0xf47f36(++_0x5691d1);}(_0x5149,0x1cf));var _0x9514=function(_0x391146,_0x385558){_0x391146=_0x391146-0x0;var _0x3ed05f=_0x5149[_0x391146];return _0x3ed05f;};'use strict';var _=require('lodash');var util=require(_0x9514('0x0'));var logger=require(_0x9514('0x1'))(_0x9514('0x2'));var moment=require(_0x9514('0x3'));var BPromise=require(_0x9514('0x4'));var rp=require(_0x9514('0x5'));var fs=require('fs');var path=require(_0x9514('0x6'));var rimraf=require(_0x9514('0x7'));var config=require('../../config/environment');var attributes=require('./disposition.attributes');module[_0x9514('0x8')]=function(_0x4bf27c,_0x8a347d){return _0x4bf27c[_0x9514('0x9')]('Disposition',attributes,{'tableName':_0x9514('0xa'),'paranoid':![],'indexes':[{'unique':!![],'name':_0x9514('0xb'),'fields':[_0x9514('0xc'),_0x9514('0xd')]},{'unique':!![],'name':_0x9514('0xe'),'fields':[_0x9514('0xc'),_0x9514('0xf')]},{'unique':!![],'name':_0x9514('0x10'),'fields':['name',_0x9514('0x11')]},{'unique':!![],'name':'name_sms','fields':[_0x9514('0xc'),'SmsAccountId']},{'unique':!![],'name':_0x9514('0x12'),'fields':[_0x9514('0xc'),_0x9514('0x13')]},{'unique':!![],'name':_0x9514('0x14'),'fields':[_0x9514('0xc'),_0x9514('0x15')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xc394=['name_fax','name_openchannel','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./disposition.attributes','define','Disposition','tools_dispositions','name_voice','name','ChatWebsiteId','name_mail','MailAccountId','SmsAccountId'];(function(_0x437425,_0x5d0439){var _0x340245=function(_0x26d0d3){while(--_0x26d0d3){_0x437425['push'](_0x437425['shift']());}};_0x340245(++_0x5d0439);}(_0xc394,0x80));var _0x4c39=function(_0x324ccb,_0x1e8dfb){_0x324ccb=_0x324ccb-0x0;var _0x11a1cb=_0xc394[_0x324ccb];return _0x11a1cb;};'use strict';var _=require('lodash');var util=require(_0x4c39('0x0'));var logger=require(_0x4c39('0x1'))(_0x4c39('0x2'));var moment=require(_0x4c39('0x3'));var BPromise=require(_0x4c39('0x4'));var rp=require(_0x4c39('0x5'));var fs=require('fs');var path=require(_0x4c39('0x6'));var rimraf=require(_0x4c39('0x7'));var config=require(_0x4c39('0x8'));var attributes=require(_0x4c39('0x9'));module['exports']=function(_0x135502,_0x4614f4){return _0x135502[_0x4c39('0xa')](_0x4c39('0xb'),attributes,{'tableName':_0x4c39('0xc'),'paranoid':![],'indexes':[{'unique':!![],'name':_0x4c39('0xd'),'fields':[_0x4c39('0xe'),'ListId']},{'unique':!![],'name':'name_chat','fields':[_0x4c39('0xe'),_0x4c39('0xf')]},{'unique':!![],'name':_0x4c39('0x10'),'fields':['name',_0x4c39('0x11')]},{'unique':!![],'name':'name_sms','fields':['name',_0x4c39('0x12')]},{'unique':!![],'name':_0x4c39('0x13'),'fields':[_0x4c39('0xe'),'FaxAccountId']},{'unique':!![],'name':_0x4c39('0x14'),'fields':[_0x4c39('0xe'),'OpenchannelAccountId']}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/disposition/disposition.rpc.js b/server/api/disposition/disposition.rpc.js index 7220259..fd79aa3 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 _0x3ce6=['../../config/environment','jayson/promise','request','then','info','Disposition,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','catch','lodash','util','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger'];(function(_0x151c84,_0x29149c){var _0x81f05b=function(_0x43fb5b){while(--_0x43fb5b){_0x151c84['push'](_0x151c84['shift']());}};_0x81f05b(++_0x29149c);}(_0x3ce6,0xad));var _0x63ce=function(_0x5d7ca2,_0x120ea6){_0x5d7ca2=_0x5d7ca2-0x0;var _0x4d285f=_0x3ce6[_0x5d7ca2];return _0x4d285f;};'use strict';var _=require(_0x63ce('0x0'));var util=require(_0x63ce('0x1'));var moment=require('moment');var BPromise=require(_0x63ce('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x63ce('0x3'));var db=require(_0x63ce('0x4'))['db'];var utils=require(_0x63ce('0x5'));var logger=require(_0x63ce('0x6'))('rpc');var config=require(_0x63ce('0x7'));var jayson=require(_0x63ce('0x8'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x559fbe,_0x33a69d,_0xb1d4cb){return new BPromise(function(_0xcc022c,_0x2ba809){return client[_0x63ce('0x9')](_0x559fbe,_0xb1d4cb)[_0x63ce('0xa')](function(_0x2fa6a1){logger[_0x63ce('0xb')](_0x63ce('0xc'),_0x33a69d,_0x63ce('0xd'));logger[_0x63ce('0xe')]('Disposition,\x20%s,\x20%s,\x20%s',_0x33a69d,_0x63ce('0xd'),JSON[_0x63ce('0xf')](_0x2fa6a1));if(_0x2fa6a1['error']){if(_0x2fa6a1[_0x63ce('0x10')][_0x63ce('0x11')]===0x1f4){logger['error']('Disposition,\x20%s,\x20%s',_0x33a69d,_0x2fa6a1[_0x63ce('0x10')]['message']);return _0x2ba809(_0x2fa6a1[_0x63ce('0x10')][_0x63ce('0x12')]);}logger[_0x63ce('0x10')](_0x63ce('0xc'),_0x33a69d,_0x2fa6a1[_0x63ce('0x10')]['message']);return _0xcc022c(_0x2fa6a1[_0x63ce('0x10')]['message']);}else{logger[_0x63ce('0xb')](_0x63ce('0xc'),_0x33a69d,_0x63ce('0xd'));_0xcc022c(_0x2fa6a1['result']['message']);}})[_0x63ce('0x13')](function(_0x11eb2f){logger[_0x63ce('0x10')](_0x63ce('0xc'),_0x33a69d,_0x11eb2f);_0x2ba809(_0x11eb2f);});});} \ No newline at end of file +var _0x13df=['../../config/environment','request','then','Disposition,\x20%s,\x20%s','request\x20sent','debug','Disposition,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','util','bluebird','ioredis','../../mysqldb','../../config/utils','rpc'];(function(_0x447ceb,_0x1855f9){var _0x1f3ee4=function(_0x4e9b6c){while(--_0x4e9b6c){_0x447ceb['push'](_0x447ceb['shift']());}};_0x1f3ee4(++_0x1855f9);}(_0x13df,0xad));var _0xf13d=function(_0x273a92,_0x945253){_0x273a92=_0x273a92-0x0;var _0x1103a2=_0x13df[_0x273a92];return _0x1103a2;};'use strict';var _=require(_0xf13d('0x0'));var util=require(_0xf13d('0x1'));var moment=require('moment');var BPromise=require(_0xf13d('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xf13d('0x3'));var db=require(_0xf13d('0x4'))['db'];var utils=require(_0xf13d('0x5'));var logger=require('../../config/logger')(_0xf13d('0x6'));var config=require(_0xf13d('0x7'));var jayson=require('jayson/promise');var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x1e6b7c,_0x5c56f2,_0x47c424){return new BPromise(function(_0x3838b8,_0x3737b6){return client[_0xf13d('0x8')](_0x1e6b7c,_0x47c424)[_0xf13d('0x9')](function(_0x2e8e40){logger['info'](_0xf13d('0xa'),_0x5c56f2,_0xf13d('0xb'));logger[_0xf13d('0xc')](_0xf13d('0xd'),_0x5c56f2,_0xf13d('0xb'),JSON[_0xf13d('0xe')](_0x2e8e40));if(_0x2e8e40[_0xf13d('0xf')]){if(_0x2e8e40[_0xf13d('0xf')][_0xf13d('0x10')]===0x1f4){logger['error'](_0xf13d('0xa'),_0x5c56f2,_0x2e8e40[_0xf13d('0xf')][_0xf13d('0x11')]);return _0x3737b6(_0x2e8e40['error']['message']);}logger[_0xf13d('0xf')](_0xf13d('0xa'),_0x5c56f2,_0x2e8e40['error'][_0xf13d('0x11')]);return _0x3838b8(_0x2e8e40[_0xf13d('0xf')][_0xf13d('0x11')]);}else{logger['info'](_0xf13d('0xa'),_0x5c56f2,'request\x20sent');_0x3838b8(_0x2e8e40[_0xf13d('0x12')][_0xf13d('0x11')]);}})[_0xf13d('0x13')](function(_0x53a704){logger['error'](_0xf13d('0xa'),_0x5c56f2,_0x53a704);_0x3737b6(_0x53a704);});});} \ No newline at end of file diff --git a/server/api/disposition/index.js b/server/api/disposition/index.js index f2d8a64..ec200b3 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 _0xeda7=['index','/:id','show','post','create','delete','destroy','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./disposition.controller','get','isAuthenticated'];(function(_0x189289,_0x299137){var _0x3c1255=function(_0x102c2f){while(--_0x102c2f){_0x189289['push'](_0x189289['shift']());}};_0x3c1255(++_0x299137);}(_0xeda7,0x196));var _0x7eda=function(_0x4b91c4,_0x23f35f){_0x4b91c4=_0x4b91c4-0x0;var _0x25cb80=_0xeda7[_0x4b91c4];return _0x25cb80;};'use strict';var multer=require(_0x7eda('0x0'));var util=require(_0x7eda('0x1'));var path=require(_0x7eda('0x2'));var timeout=require(_0x7eda('0x3'));var express=require(_0x7eda('0x4'));var router=express[_0x7eda('0x5')]();var auth=require(_0x7eda('0x6'));var interaction=require(_0x7eda('0x7'));var config=require(_0x7eda('0x8'));var controller=require(_0x7eda('0x9'));router[_0x7eda('0xa')]('/',auth[_0x7eda('0xb')](),controller[_0x7eda('0xc')]);router[_0x7eda('0xa')](_0x7eda('0xd'),auth[_0x7eda('0xb')](),controller[_0x7eda('0xe')]);router[_0x7eda('0xf')]('/',auth[_0x7eda('0xb')](),controller[_0x7eda('0x10')]);router['put'](_0x7eda('0xd'),auth['isAuthenticated'](),controller['update']);router[_0x7eda('0x11')](_0x7eda('0xd'),auth[_0x7eda('0xb')](),controller[_0x7eda('0x12')]);module['exports']=router; \ No newline at end of file +var _0x5853=['isAuthenticated','show','create','put','/:id','update','delete','destroy','exports','multer','util','path','connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment','./disposition.controller','get'];(function(_0x2db3c0,_0x565eb4){var _0x2f61ae=function(_0x364403){while(--_0x364403){_0x2db3c0['push'](_0x2db3c0['shift']());}};_0x2f61ae(++_0x565eb4);}(_0x5853,0x113));var _0x3585=function(_0x1af482,_0x1af5b7){_0x1af482=_0x1af482-0x0;var _0x7e7580=_0x5853[_0x1af482];return _0x7e7580;};'use strict';var multer=require(_0x3585('0x0'));var util=require(_0x3585('0x1'));var path=require(_0x3585('0x2'));var timeout=require(_0x3585('0x3'));var express=require(_0x3585('0x4'));var router=express['Router']();var auth=require(_0x3585('0x5'));var interaction=require(_0x3585('0x6'));var config=require(_0x3585('0x7'));var controller=require(_0x3585('0x8'));router[_0x3585('0x9')]('/',auth[_0x3585('0xa')](),controller['index']);router[_0x3585('0x9')]('/:id',auth['isAuthenticated'](),controller[_0x3585('0xb')]);router['post']('/',auth[_0x3585('0xa')](),controller[_0x3585('0xc')]);router[_0x3585('0xd')](_0x3585('0xe'),auth[_0x3585('0xa')](),controller[_0x3585('0xf')]);router[_0x3585('0x10')]('/:id',auth[_0x3585('0xa')](),controller[_0x3585('0x11')]);module[_0x3585('0x12')]=router; \ No newline at end of file diff --git a/server/api/faxAccount/faxAccount.attributes.js b/server/api/faxAccount/faxAccount.attributes.js index 366fbfc..810f1cd 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 _0x6186=['localstationid','2400','4800','9600','12000','14400','7200','v17,v27,v29','SIP','DADHI','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','mandatoryDispositionPauseId','setDataValue','sequelize','STRING','ENUM','yes'];(function(_0x362046,_0x5cf93f){var _0x419ffe=function(_0x18cb42){while(--_0x18cb42){_0x362046['push'](_0x362046['shift']());}};_0x419ffe(++_0x5cf93f);}(_0x6186,0xd8));var _0x6618=function(_0x6cf5ec,_0x194d2e){_0x6cf5ec=_0x6cf5ec-0x0;var _0x271c4f=_0x6186[_0x6cf5ec];return _0x271c4f;};'use strict';var Sequelize=require(_0x6618('0x0'));module['exports']={'name':{'type':Sequelize[_0x6618('0x1')],'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize[_0x6618('0x1')]},'ecm':{'type':Sequelize[_0x6618('0x2')](_0x6618('0x3'),'no'),'defaultValue':_0x6618('0x3')},'headerinfo':{'type':Sequelize[_0x6618('0x1')],'defaultValue':'xCALLY\x20Motion\x20Fax'},'localstationid':{'type':Sequelize[_0x6618('0x1')],'unique':_0x6618('0x4')},'minrate':{'type':Sequelize[_0x6618('0x2')](_0x6618('0x5'),_0x6618('0x6'),'7200',_0x6618('0x7'),_0x6618('0x8'),_0x6618('0x9')),'defaultValue':'4800'},'maxrate':{'type':Sequelize[_0x6618('0x2')](_0x6618('0x5'),_0x6618('0x6'),_0x6618('0xa'),_0x6618('0x7'),_0x6618('0x8'),_0x6618('0x9')),'defaultValue':_0x6618('0x9')},'modem':{'type':Sequelize[_0x6618('0x1')],'defaultValue':_0x6618('0xb')},'gateway':{'type':Sequelize[_0x6618('0x1')],'defaultValue':'no','validate':{'is':/^(?:yes|no|[0-9]+)$/}},'faxdetect':{'type':Sequelize[_0x6618('0x1')],'defaultValue':'no','validate':{'is':/^(?:yes|no|t38|cng|[0-9]+)$/}},'t38timeout':{'type':Sequelize['INTEGER'],'defaultValue':0x1388,'validate':{'min':0x3e8}},'tech':{'type':Sequelize[_0x6618('0x2')](_0x6618('0xc'),'IAX',_0x6618('0xd'),'KHOMP'),'defaultValue':_0x6618('0xc')},'key':{'type':Sequelize[_0x6618('0x1')],'allowNull':![]},'notificationTemplate':{'type':Sequelize[_0x6618('0xe')],'defaultValue':function(){return _0x6618('0xf');}},'notificationSound':{'type':Sequelize[_0x6618('0x10')],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0x6618('0x10')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0x6618('0x11')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize[_0x6618('0x10')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0x6618('0x11')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0x6618('0x10')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0x6618('0x11')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize[_0x6618('0x11')],'allowNull':!![],'defaultValue':null,'comment':_0x6618('0x12')},'mandatoryDisposition':{'type':Sequelize[_0x6618('0x10')],'defaultValue':![],'comment':_0x6618('0x13'),'set':function(_0x4cc29c){if(!_0x4cc29c)this['setDataValue'](_0x6618('0x14'),null);this[_0x6618('0x15')]('mandatoryDisposition',_0x4cc29c);}}}; \ No newline at end of file +var _0xf074=['2400','4800','12000','14400','9600','v17,v27,v29','INTEGER','SIP','TEXT','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}','BOOLEAN','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','setDataValue','mandatoryDispositionPauseId','sequelize','STRING','ENUM','yes','xCALLY\x20Motion\x20Fax'];(function(_0xb2b240,_0x1fa31f){var _0x1155f9=function(_0x40e83d){while(--_0x40e83d){_0xb2b240['push'](_0xb2b240['shift']());}};_0x1155f9(++_0x1fa31f);}(_0xf074,0x12b));var _0x4f07=function(_0x5c049a,_0x2c1263){_0x5c049a=_0x5c049a-0x0;var _0x168e70=_0xf074[_0x5c049a];return _0x168e70;};'use strict';var Sequelize=require(_0x4f07('0x0'));module['exports']={'name':{'type':Sequelize[_0x4f07('0x1')],'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize[_0x4f07('0x1')]},'ecm':{'type':Sequelize[_0x4f07('0x2')](_0x4f07('0x3'),'no'),'defaultValue':'yes'},'headerinfo':{'type':Sequelize[_0x4f07('0x1')],'defaultValue':_0x4f07('0x4')},'localstationid':{'type':Sequelize[_0x4f07('0x1')],'unique':'localstationid'},'minrate':{'type':Sequelize['ENUM'](_0x4f07('0x5'),_0x4f07('0x6'),'7200','9600',_0x4f07('0x7'),_0x4f07('0x8')),'defaultValue':'4800'},'maxrate':{'type':Sequelize[_0x4f07('0x2')](_0x4f07('0x5'),'4800','7200',_0x4f07('0x9'),_0x4f07('0x7'),_0x4f07('0x8')),'defaultValue':_0x4f07('0x8')},'modem':{'type':Sequelize[_0x4f07('0x1')],'defaultValue':_0x4f07('0xa')},'gateway':{'type':Sequelize['STRING'],'defaultValue':'no','validate':{'is':/^(?:yes|no|[0-9]+)$/}},'faxdetect':{'type':Sequelize[_0x4f07('0x1')],'defaultValue':'no','validate':{'is':/^(?:yes|no|t38|cng|[0-9]+)$/}},'t38timeout':{'type':Sequelize[_0x4f07('0xb')],'defaultValue':0x1388,'validate':{'min':0x3e8}},'tech':{'type':Sequelize['ENUM'](_0x4f07('0xc'),'IAX','DADHI','KHOMP'),'defaultValue':_0x4f07('0xc')},'key':{'type':Sequelize[_0x4f07('0x1')],'allowNull':![]},'notificationTemplate':{'type':Sequelize[_0x4f07('0xd')],'defaultValue':function(){return _0x4f07('0xe');}},'notificationSound':{'type':Sequelize[_0x4f07('0xf')],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0x4f07('0xf')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize[_0x4f07('0xf')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0x4f07('0xf')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0x4f07('0xb')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize[_0x4f07('0xb')],'allowNull':!![],'defaultValue':null,'comment':_0x4f07('0x10')},'mandatoryDisposition':{'type':Sequelize[_0x4f07('0xf')],'defaultValue':![],'comment':'Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','set':function(_0x417350){if(!_0x417350)this[_0x4f07('0x11')](_0x4f07('0x12'),null);this[_0x4f07('0x11')]('mandatoryDisposition',_0x417350);}}}; \ No newline at end of file diff --git a/server/api/faxAccount/faxAccount.controller.js b/server/api/faxAccount/faxAccount.controller.js index 1bef8d2..13f51ab 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 _0x36a5=['desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','redis','localhost','socket.io-emitter','./faxAccount.socket','jayson/promise','http','test','Sequelize','info','FaxAccount,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','catch','sendStatus','status','end','json','limit','set','Content-Range','apply','reject','save','update','then','destroy','get','FaxAccounts','stack','name','send','Pause','mandatoryDispositionPause','FaxAccount','rawAttributes','fieldName','type','key','model','map','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','offset','order','where','pick','filter','VIRTUAL','merge','count','includeAll','findAll','rows','show','params','include','options','create','body','user','role','find','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','addDisposition','FaxAccountId','Disposition','getDispositions','findOne','sort','removeDispositions','ids','addAnswer','CannedAnswer','getAnswers','removeAnswers','addInteraction','omit','getInteractions','FaxInteraction','CmContact','User','Owner','internal','Tag','Tags','tag','addApplications','transaction','FaxApplication','bulkCreate','findAndCountAll','priority','getApplications','context','from-voip-provider','exten','localstationid','app','system','description','Fax\x20Extension','appdata','push','Answer','Set','headerinfo','maxrate','minrate','modem','FAXOPT(','Wait','/var/opt/motion2/server/files/attachments/fax-${CALLERID(num)}-${CUT(UNIQUEID,.,1)}-${CUT(UNIQUEID,.,2)}-${STRFTIME(,,%C%y%m%d%H%M%S)}-rx.tif,d','addAccountApplications','sequelize','VoiceExtension','updateAccountApplications','createdAt','updatedAt','TrunkId','ListId','findById','$gte','split','format','YYYY-MM-DD\x20HH:mm:ss','FaxMessage','List','Contacts','attachments','root','basename','CheckAfterSend','isNil','from','\x22%s\x22\x20<%s>','fax','defaults','List\x20not\x20found','filename','Messages','Contact\x20not\x20found','spread','out','ContactId','dataValues','SendFax','SendFaxRpc,\x20%s','addAgents','emit','userFaxAccount:save','removeAgents','isArray','userFaxAccount:remove','getAgents','html-pdf','eml-format','rimraf','fast-json-patch','request-promise','bluebird','util','path','sox','to-csv','ejs','squel','crypto','jsforce'];(function(_0x19de10,_0x362046){var _0x4c2a2c=function(_0x1c8047){while(--_0x1c8047){_0x19de10['push'](_0x19de10['shift']());}};_0x4c2a2c(++_0x362046);}(_0x36a5,0xb4));var _0x536a=function(_0xd43495,_0x577042){_0xd43495=_0xd43495-0x0;var _0x567de0=_0x36a5[_0xd43495];return _0x567de0;};'use strict';var pdf=require(_0x536a('0x0'));var emlformat=require(_0x536a('0x1'));var rimraf=require(_0x536a('0x2'));var zipdir=require('zip-dir');var jsonpatch=require(_0x536a('0x3'));var rp=require(_0x536a('0x4'));var moment=require('moment');var BPromise=require(_0x536a('0x5'));var Mustache=require('mustache');var util=require(_0x536a('0x6'));var path=require(_0x536a('0x7'));var sox=require(_0x536a('0x8'));var csv=require(_0x536a('0x9'));var ejs=require(_0x536a('0xa'));var fs=require('fs');var _=require('lodash');var squel=require(_0x536a('0xb'));var crypto=require(_0x536a('0xc'));var jsforce=require(_0x536a('0xd'));var deskjs=require(_0x536a('0xe'));var toCsv=require('to-csv');var querystring=require(_0x536a('0xf'));var Papa=require(_0x536a('0x10'));var Redis=require(_0x536a('0x11'));var authService=require(_0x536a('0x12'));var qs=require(_0x536a('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x536a('0x14'));var logger=require(_0x536a('0x15'))(_0x536a('0x16'));var utils=require(_0x536a('0x17'));var config=require(_0x536a('0x18'));var db=require(_0x536a('0x19'))['db'];config['redis']=_['defaults'](config[_0x536a('0x1a')],{'host':_0x536a('0x1b'),'port':0x18eb});var socket=require(_0x536a('0x1c'))(new Redis(config[_0x536a('0x1a')]));require(_0x536a('0x1d'))['register'](socket);var jayson=require(_0x536a('0x1e'));var client=jayson['client']['http']({'port':0x232c});var client9002=jayson['client'][_0x536a('0x1f')]({'port':0x232a});function checkPasswordPattern(_0x76d21e,_0x4026c6,_0x538254){if(_0x538254){var _0xfc2359=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0xfc2359[_0x536a('0x20')](_0x4026c6)){return _0x76d21e;}else{throw new db[(_0x536a('0x21'))]['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 _0x76d21e;}}function respondWithRpcPromise(_0x39f821,_0x5daf0b,_0x25caf6,_0x204961){return new BPromise(function(_0xef8fb7,_0x2cf66b){var _0x40dcd1=_0x204961||client;return _0x40dcd1['request'](_0x39f821,_0x25caf6)['then'](function(_0x14514d){logger[_0x536a('0x22')](_0x536a('0x23'),_0x5daf0b,_0x536a('0x24'));logger[_0x536a('0x25')]('FaxAccount,\x20%s,\x20%s,\x20%s',_0x5daf0b,'request\x20sent',JSON[_0x536a('0x26')](_0x14514d));if(_0x14514d[_0x536a('0x27')]){if(_0x14514d[_0x536a('0x27')][_0x536a('0x28')]===0x1f4){logger[_0x536a('0x27')](_0x536a('0x23'),_0x5daf0b,_0x14514d['error'][_0x536a('0x29')]);return _0x2cf66b(_0x14514d['error'][_0x536a('0x29')]);}logger['error']('FaxAccount,\x20%s,\x20%s',_0x5daf0b,_0x14514d[_0x536a('0x27')][_0x536a('0x29')]);return _0xef8fb7(_0x14514d[_0x536a('0x27')][_0x536a('0x29')]);}else{logger[_0x536a('0x22')]('FaxAccount,\x20%s,\x20%s',_0x5daf0b,_0x536a('0x24'));_0xef8fb7(_0x14514d['result'][_0x536a('0x29')]);}})[_0x536a('0x2a')](function(_0x4c08fa){logger[_0x536a('0x27')](_0x536a('0x23'),_0x5daf0b,_0x4c08fa);_0x2cf66b(_0x4c08fa);});});}function respondWithStatusCode(_0x4cc881,_0x3af724){_0x3af724=_0x3af724||0xcc;return function(_0x4c90c2){if(_0x4c90c2){return _0x4cc881[_0x536a('0x2b')](_0x3af724);}return _0x4cc881[_0x536a('0x2c')](_0x3af724)[_0x536a('0x2d')]();};}function respondWithResult(_0x2ce515,_0x2f3e26){_0x2f3e26=_0x2f3e26||0xc8;return function(_0x55c306){if(_0x55c306){return _0x2ce515[_0x536a('0x2c')](_0x2f3e26)[_0x536a('0x2e')](_0x55c306);}};}function respondWithFilteredResult(_0x546175,_0x416195){return function(_0x334852){if(_0x334852){var _0x12cb92=_0x334852['count'],_0x58a072=_0x416195['offset'],_0x266a93=_0x416195['offset']+_0x416195[_0x536a('0x2f')],_0x273c25;if(_0x266a93>=_0x12cb92){_0x266a93=_0x12cb92;_0x273c25=0xc8;}else{_0x273c25=0xce;}_0x546175['status'](_0x273c25);return _0x546175[_0x536a('0x30')](_0x536a('0x31'),_0x58a072+'-'+_0x266a93+'/'+_0x12cb92)['json'](_0x334852);}return null;};}function patchUpdates(_0x1e8ee4){return function(_0x4a7df1){try{jsonpatch[_0x536a('0x32')](_0x4a7df1,_0x1e8ee4,!![]);}catch(_0xaa9a13){return BPromise[_0x536a('0x33')](_0xaa9a13);}return _0x4a7df1[_0x536a('0x34')]();};}function saveUpdates(_0x19b2da,_0x2062e0){return function(_0x1f2224){if(_0x1f2224){return _0x1f2224[_0x536a('0x35')](_0x19b2da)[_0x536a('0x36')](function(_0x1d6f6e){return _0x1d6f6e;});}return null;};}function removeEntity(_0x528e27,_0x2b4652){return function(_0x22870a){if(_0x22870a){return _0x22870a[_0x536a('0x37')]()['then'](function(){var _0x550423=_0x22870a[_0x536a('0x38')]({'plain':!![]});var _0x3cdad1=_0x536a('0x39');return db['UserProfileResource']['destroy']({'where':{'type':_0x3cdad1,'resourceId':_0x550423['id']}})['then'](function(){return _0x22870a;});})[_0x536a('0x36')](function(){_0x528e27[_0x536a('0x2c')](0xcc)[_0x536a('0x2d')]();});}};}function handleEntityNotFound(_0x21af3d,_0x2e239c){return function(_0x2c9ff1){if(!_0x2c9ff1){_0x21af3d[_0x536a('0x2b')](0x194);}return _0x2c9ff1;};}function handleError(_0x26f1c5,_0x4e8427){_0x4e8427=_0x4e8427||0x1f4;return function(_0x2b2168){logger[_0x536a('0x27')](_0x2b2168[_0x536a('0x3a')]);if(_0x2b2168[_0x536a('0x3b')]){delete _0x2b2168[_0x536a('0x3b')];}_0x26f1c5[_0x536a('0x2c')](_0x4e8427)[_0x536a('0x3c')](_0x2b2168);};}exports['index']=function(_0x22b173,_0x48301f){var _0x2d102f={'include':[{'model':db[_0x536a('0x3d')],'as':_0x536a('0x3e')}]},_0x4a7641={},_0x2724ed={'count':0x0,'rows':[]};var _0x3920ef=_['map'](db[_0x536a('0x3f')][_0x536a('0x40')],function(_0x4e8e63){return{'name':_0x4e8e63[_0x536a('0x41')],'type':_0x4e8e63[_0x536a('0x42')][_0x536a('0x43')]};});_0x4a7641[_0x536a('0x44')]=_[_0x536a('0x45')](_0x3920ef,_0x536a('0x3b'));_0x4a7641['query']=_[_0x536a('0x46')](_0x22b173[_0x536a('0x47')]);_0x4a7641[_0x536a('0x48')]=_[_0x536a('0x49')](_0x4a7641['model'],_0x4a7641[_0x536a('0x47')]);_0x2d102f[_0x536a('0x4a')]=_[_0x536a('0x49')](_0x4a7641[_0x536a('0x44')],qs['fields'](_0x22b173['query'][_0x536a('0x4b')]));_0x2d102f[_0x536a('0x4a')]=_0x2d102f['attributes'][_0x536a('0x4c')]?_0x2d102f[_0x536a('0x4a')]:_0x4a7641[_0x536a('0x44')];if(!_0x22b173['query'][_0x536a('0x4d')](_0x536a('0x4e'))){_0x2d102f[_0x536a('0x2f')]=qs['limit'](_0x22b173[_0x536a('0x47')][_0x536a('0x2f')]);_0x2d102f[_0x536a('0x4f')]=qs[_0x536a('0x4f')](_0x22b173[_0x536a('0x47')][_0x536a('0x4f')]);}_0x2d102f[_0x536a('0x50')]=qs['sort'](_0x22b173[_0x536a('0x47')]['sort']);_0x2d102f[_0x536a('0x51')]=qs[_0x536a('0x48')](_[_0x536a('0x52')](_0x22b173[_0x536a('0x47')],_0x4a7641[_0x536a('0x48')]));if(_0x22b173[_0x536a('0x47')][_0x536a('0x53')]){_0x2d102f[_0x536a('0x51')]=_['merge'](_0x2d102f[_0x536a('0x51')],{'$or':_[_0x536a('0x45')](_0x3920ef,function(_0x4e9aa0){if(_0x4e9aa0['type']!==_0x536a('0x54')){var _0x1842fb={};_0x1842fb[_0x4e9aa0['name']]={'$like':'%'+_0x22b173[_0x536a('0x47')][_0x536a('0x53')]+'%'};return _0x1842fb;}})});}_0x2d102f=_[_0x536a('0x55')]({},_0x2d102f,_0x22b173['options']);var _0x392bd5={'where':_0x2d102f[_0x536a('0x51')]};return db[_0x536a('0x3f')][_0x536a('0x56')](_0x392bd5)[_0x536a('0x36')](function(_0x2dbc8d){_0x2724ed[_0x536a('0x56')]=_0x2dbc8d;if(_0x22b173['query'][_0x536a('0x57')]){_0x2d102f['include']=[{'all':!![]}];}return db[_0x536a('0x3f')][_0x536a('0x58')](_0x2d102f);})[_0x536a('0x36')](function(_0xcd044c){_0x2724ed[_0x536a('0x59')]=_0xcd044c;return _0x2724ed;})[_0x536a('0x36')](respondWithFilteredResult(_0x48301f,_0x2d102f))[_0x536a('0x2a')](handleError(_0x48301f,null));};exports[_0x536a('0x5a')]=function(_0xceab29,_0x190e9f){var _0x5ea6a3={'raw':![],'where':{'id':_0xceab29[_0x536a('0x5b')]['id']},'include':[{'model':db['Pause'],'as':_0x536a('0x3e')}]},_0x3ac970={};_0x3ac970['model']=_[_0x536a('0x46')](db[_0x536a('0x3f')][_0x536a('0x40')]);_0x3ac970[_0x536a('0x47')]=_[_0x536a('0x46')](_0xceab29[_0x536a('0x47')]);_0x3ac970[_0x536a('0x48')]=_[_0x536a('0x49')](_0x3ac970['model'],_0x3ac970[_0x536a('0x47')]);_0x5ea6a3[_0x536a('0x4a')]=_['intersection'](_0x3ac970[_0x536a('0x44')],qs['fields'](_0xceab29[_0x536a('0x47')][_0x536a('0x4b')]));_0x5ea6a3['attributes']=_0x5ea6a3[_0x536a('0x4a')]['length']?_0x5ea6a3[_0x536a('0x4a')]:_0x3ac970[_0x536a('0x44')];if(_0xceab29['query'][_0x536a('0x57')]){_0x5ea6a3[_0x536a('0x5c')]=[{'all':!![]}];}_0x5ea6a3=_[_0x536a('0x55')]({},_0x5ea6a3,_0xceab29[_0x536a('0x5d')]);return db[_0x536a('0x3f')]['find'](_0x5ea6a3)['then'](handleEntityNotFound(_0x190e9f,null))['then'](respondWithResult(_0x190e9f,null))[_0x536a('0x2a')](handleError(_0x190e9f,null));};exports[_0x536a('0x5e')]=function(_0x1d88ce,_0x488d2b){return db[_0x536a('0x3f')]['create'](_0x1d88ce[_0x536a('0x5f')],{})[_0x536a('0x36')](function(_0x46cbce){var _0x1fb4ef=_0x1d88ce[_0x536a('0x60')][_0x536a('0x38')]({'plain':!![]});if(!_0x1fb4ef)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x1fb4ef[_0x536a('0x61')]===_0x536a('0x60')){var _0x3b9a6e=_0x46cbce[_0x536a('0x38')]({'plain':!![]});var _0x1e6556=_0x536a('0x39');return db['UserProfileSection'][_0x536a('0x62')]({'where':{'name':_0x1e6556,'userProfileId':_0x1fb4ef[_0x536a('0x63')]},'raw':!![]})[_0x536a('0x36')](function(_0x41b3a1){if(_0x41b3a1&&_0x41b3a1[_0x536a('0x64')]===0x0){return db['UserProfileResource']['create']({'name':_0x3b9a6e[_0x536a('0x3b')],'resourceId':_0x3b9a6e['id'],'type':_0x41b3a1[_0x536a('0x3b')],'sectionId':_0x41b3a1['id']},{})[_0x536a('0x36')](function(){return _0x46cbce;});}else{return _0x46cbce;}})[_0x536a('0x2a')](function(_0x18b4f9){logger['error'](_0x536a('0x65'),_0x18b4f9);throw _0x18b4f9;});}return _0x46cbce;})[_0x536a('0x36')](respondWithResult(_0x488d2b,0xc9))[_0x536a('0x2a')](handleError(_0x488d2b,null));};exports[_0x536a('0x35')]=function(_0x30da33,_0x30f85e){if(_0x30da33[_0x536a('0x5f')]['id']){delete _0x30da33[_0x536a('0x5f')]['id'];}return db[_0x536a('0x3f')]['find']({'where':{'id':_0x30da33['params']['id']},'include':[{'model':db[_0x536a('0x3d')],'as':'mandatoryDispositionPause'}]})[_0x536a('0x36')](handleEntityNotFound(_0x30f85e,null))[_0x536a('0x36')](saveUpdates(_0x30da33[_0x536a('0x5f')],null))[_0x536a('0x36')](respondWithResult(_0x30f85e,null))[_0x536a('0x2a')](handleError(_0x30f85e,null));};exports[_0x536a('0x37')]=function(_0x1141fb,_0x2fcef9){return db[_0x536a('0x3f')][_0x536a('0x62')]({'where':{'id':_0x1141fb[_0x536a('0x5b')]['id']}})[_0x536a('0x36')](handleEntityNotFound(_0x2fcef9,null))[_0x536a('0x36')](removeEntity(_0x2fcef9,null))['catch'](handleError(_0x2fcef9,null));};exports[_0x536a('0x66')]=function(_0x59e1b4,_0x535c27){return db[_0x536a('0x3f')][_0x536a('0x66')]()[_0x536a('0x36')](respondWithResult(_0x535c27,null))['catch'](handleError(_0x535c27,null));};exports[_0x536a('0x67')]=function(_0x43d6a4,_0x143930,_0x216cf1){if(_0x43d6a4[_0x536a('0x5f')]['id']){delete _0x43d6a4[_0x536a('0x5f')]['id'];}return db[_0x536a('0x3f')][_0x536a('0x62')]({'where':{'id':_0x43d6a4['params']['id']}})['then'](handleEntityNotFound(_0x143930,null))['then'](function(_0x3b5279){if(_0x3b5279){_0x43d6a4[_0x536a('0x5f')][_0x536a('0x68')]=_0x3b5279['id'];return db[_0x536a('0x69')][_0x536a('0x5e')](_0x43d6a4[_0x536a('0x5f')]);}})[_0x536a('0x36')](respondWithResult(_0x143930,null))[_0x536a('0x2a')](handleError(_0x143930,null));};exports[_0x536a('0x6a')]=function(_0x84f7d,_0xb7224,_0x239f56){var _0x5e2f30={'raw':![],'where':{}};var _0x11d02e={};var _0x22d2a5={'count':0x0,'rows':[]};return db[_0x536a('0x3f')][_0x536a('0x6b')]({'where':{'id':_0x84f7d[_0x536a('0x5b')]['id']}})[_0x536a('0x36')](handleEntityNotFound(_0xb7224,null))['then'](function(_0x3ce976){if(_0x3ce976){_0x11d02e['model']=_[_0x536a('0x46')](db[_0x536a('0x69')][_0x536a('0x40')]);_0x11d02e['query']=_[_0x536a('0x46')](_0x84f7d[_0x536a('0x47')]);_0x11d02e[_0x536a('0x48')]=_[_0x536a('0x49')](_0x11d02e[_0x536a('0x44')],_0x11d02e[_0x536a('0x47')]);_0x5e2f30[_0x536a('0x4a')]=_[_0x536a('0x49')](_0x11d02e[_0x536a('0x44')],qs[_0x536a('0x4b')](_0x84f7d[_0x536a('0x47')][_0x536a('0x4b')]));_0x5e2f30['attributes']=_0x5e2f30['attributes']['length']?_0x5e2f30[_0x536a('0x4a')]:_0x11d02e[_0x536a('0x44')];if(!_0x84f7d[_0x536a('0x47')][_0x536a('0x4d')](_0x536a('0x4e'))){_0x5e2f30[_0x536a('0x2f')]=qs['limit'](_0x84f7d['query'][_0x536a('0x2f')]);_0x5e2f30['offset']=qs['offset'](_0x84f7d[_0x536a('0x47')][_0x536a('0x4f')]);}_0x5e2f30[_0x536a('0x50')]=qs[_0x536a('0x6c')](_0x84f7d[_0x536a('0x47')][_0x536a('0x6c')]);_0x5e2f30['where']=qs[_0x536a('0x48')](_[_0x536a('0x52')](_0x84f7d[_0x536a('0x47')],_0x11d02e['filters']));_0x5e2f30[_0x536a('0x51')][_0x536a('0x68')]=_0x3ce976['id'];if(_0x84f7d['query'][_0x536a('0x53')]){_0x5e2f30[_0x536a('0x51')]=_[_0x536a('0x55')](_0x5e2f30[_0x536a('0x51')],{'$or':_[_0x536a('0x45')](_0x5e2f30[_0x536a('0x4a')],function(_0x451c6e){var _0x44dcfc={};_0x44dcfc[_0x451c6e]={'$like':'%'+_0x84f7d[_0x536a('0x47')]['filter']+'%'};return _0x44dcfc;})});}_0x5e2f30=_['merge']({},_0x5e2f30,_0x84f7d[_0x536a('0x5d')]);return db[_0x536a('0x69')][_0x536a('0x56')]({'where':_0x5e2f30['where']})[_0x536a('0x36')](function(_0x2bec85){_0x22d2a5['count']=_0x2bec85;if(_0x84f7d[_0x536a('0x47')]['includeAll']){_0x5e2f30[_0x536a('0x5c')]=[{'all':!![]}];}return db[_0x536a('0x69')][_0x536a('0x58')](_0x5e2f30);})[_0x536a('0x36')](function(_0x358bb9){_0x22d2a5[_0x536a('0x59')]=_0x358bb9;return _0x22d2a5;});}})[_0x536a('0x36')](respondWithFilteredResult(_0xb7224,_0x5e2f30))[_0x536a('0x2a')](handleError(_0xb7224,null));};exports['removeDispositions']=function(_0x316c0b,_0x4a9c8b,_0x4f1447){return db[_0x536a('0x3f')][_0x536a('0x62')]({'where':{'id':_0x316c0b[_0x536a('0x5b')]['id']}})['then'](handleEntityNotFound(_0x4a9c8b,null))[_0x536a('0x36')](function(_0x3732cc){if(_0x3732cc){return _0x3732cc[_0x536a('0x6d')](_0x316c0b[_0x536a('0x47')][_0x536a('0x6e')]);}})[_0x536a('0x36')](respondWithStatusCode(_0x4a9c8b,null))[_0x536a('0x2a')](handleError(_0x4a9c8b,null));};exports[_0x536a('0x6f')]=function(_0x3a5159,_0x31eaf7,_0xc1aef7){if(_0x3a5159[_0x536a('0x5f')]['id']){delete _0x3a5159[_0x536a('0x5f')]['id'];}return db[_0x536a('0x3f')]['find']({'where':{'id':_0x3a5159[_0x536a('0x5b')]['id']}})['then'](handleEntityNotFound(_0x31eaf7,null))[_0x536a('0x36')](function(_0x5451eb){if(_0x5451eb){_0x3a5159['body']['FaxAccountId']=_0x5451eb['id'];return db[_0x536a('0x70')][_0x536a('0x5e')](_0x3a5159[_0x536a('0x5f')]);}})[_0x536a('0x36')](respondWithResult(_0x31eaf7,null))[_0x536a('0x2a')](handleError(_0x31eaf7,null));};exports[_0x536a('0x71')]=function(_0x4b33d,_0x3f35d0,_0x570d9f){var _0x3f838b={'raw':![],'where':{}};var _0x2069a8={};var _0x37a10e={'count':0x0,'rows':[]};return db['FaxAccount'][_0x536a('0x6b')]({'where':{'id':_0x4b33d[_0x536a('0x5b')]['id']}})[_0x536a('0x36')](handleEntityNotFound(_0x3f35d0,null))[_0x536a('0x36')](function(_0x359bdc){if(_0x359bdc){_0x2069a8['model']=_['keys'](db[_0x536a('0x70')][_0x536a('0x40')]);_0x2069a8['query']=_[_0x536a('0x46')](_0x4b33d[_0x536a('0x47')]);_0x2069a8['filters']=_[_0x536a('0x49')](_0x2069a8[_0x536a('0x44')],_0x2069a8[_0x536a('0x47')]);_0x3f838b['attributes']=_[_0x536a('0x49')](_0x2069a8[_0x536a('0x44')],qs[_0x536a('0x4b')](_0x4b33d[_0x536a('0x47')][_0x536a('0x4b')]));_0x3f838b['attributes']=_0x3f838b['attributes'][_0x536a('0x4c')]?_0x3f838b['attributes']:_0x2069a8[_0x536a('0x44')];if(!_0x4b33d[_0x536a('0x47')][_0x536a('0x4d')]('nolimit')){_0x3f838b['limit']=qs[_0x536a('0x2f')](_0x4b33d[_0x536a('0x47')][_0x536a('0x2f')]);_0x3f838b[_0x536a('0x4f')]=qs[_0x536a('0x4f')](_0x4b33d[_0x536a('0x47')][_0x536a('0x4f')]);}_0x3f838b[_0x536a('0x50')]=qs[_0x536a('0x6c')](_0x4b33d['query'][_0x536a('0x6c')]);_0x3f838b[_0x536a('0x51')]=qs['filters'](_['pick'](_0x4b33d[_0x536a('0x47')],_0x2069a8['filters']));_0x3f838b[_0x536a('0x51')][_0x536a('0x68')]=_0x359bdc['id'];if(_0x4b33d[_0x536a('0x47')][_0x536a('0x53')]){_0x3f838b[_0x536a('0x51')]=_[_0x536a('0x55')](_0x3f838b['where'],{'$or':_['map'](_0x3f838b['attributes'],function(_0x4b67c1){var _0x382bdf={};_0x382bdf[_0x4b67c1]={'$like':'%'+_0x4b33d[_0x536a('0x47')]['filter']+'%'};return _0x382bdf;})});}_0x3f838b=_['merge']({},_0x3f838b,_0x4b33d[_0x536a('0x5d')]);return db['CannedAnswer'][_0x536a('0x56')]({'where':_0x3f838b[_0x536a('0x51')]})[_0x536a('0x36')](function(_0x3bd5c8){_0x37a10e[_0x536a('0x56')]=_0x3bd5c8;if(_0x4b33d[_0x536a('0x47')][_0x536a('0x57')]){_0x3f838b[_0x536a('0x5c')]=[{'all':!![]}];}return db[_0x536a('0x70')][_0x536a('0x58')](_0x3f838b);})[_0x536a('0x36')](function(_0x48c724){_0x37a10e[_0x536a('0x59')]=_0x48c724;return _0x37a10e;});}})[_0x536a('0x36')](respondWithFilteredResult(_0x3f35d0,_0x3f838b))[_0x536a('0x2a')](handleError(_0x3f35d0,null));};exports[_0x536a('0x72')]=function(_0x5e78a3,_0x432dc2,_0x2f6a6f){return db['FaxAccount'][_0x536a('0x62')]({'where':{'id':_0x5e78a3['params']['id']}})[_0x536a('0x36')](handleEntityNotFound(_0x432dc2,null))[_0x536a('0x36')](function(_0x5cf50a){if(_0x5cf50a){return _0x5cf50a[_0x536a('0x72')](_0x5e78a3[_0x536a('0x47')][_0x536a('0x6e')]);}})[_0x536a('0x36')](respondWithStatusCode(_0x432dc2,null))[_0x536a('0x2a')](handleError(_0x432dc2,null));};exports[_0x536a('0x73')]=function(_0x293cb8,_0xd533a3,_0x26d9a6){return db['FaxInteraction'][_0x536a('0x62')]({'where':{'id':_0x293cb8[_0x536a('0x5b')]['id']}})[_0x536a('0x36')](handleEntityNotFound(_0xd533a3,null))[_0x536a('0x36')](function(_0x46be9a){if(_0x46be9a){return _0x46be9a[_0x536a('0x73')](_0x293cb8[_0x536a('0x5f')][_0x536a('0x6e')],_[_0x536a('0x74')](_0x293cb8[_0x536a('0x5f')],[_0x536a('0x6e'),'id'])||{});}})[_0x536a('0x36')](respondWithResult(_0xd533a3,null))['catch'](handleError(_0xd533a3,null));};exports[_0x536a('0x75')]=function(_0x3cba48,_0x25db12,_0xb63930){var _0x253f14={'raw':![],'where':{}};var _0x1c2c96={};var _0x48ed6c={'count':0x0,'rows':[]};return db['FaxAccount'][_0x536a('0x6b')]({'where':{'id':_0x3cba48[_0x536a('0x5b')]['id']}})[_0x536a('0x36')](handleEntityNotFound(_0x25db12,null))[_0x536a('0x36')](function(_0x3d8c96){if(_0x3d8c96){_0x1c2c96['model']=_[_0x536a('0x46')](db[_0x536a('0x76')][_0x536a('0x40')]);_0x1c2c96[_0x536a('0x47')]=_[_0x536a('0x46')](_0x3cba48[_0x536a('0x47')]);_0x1c2c96[_0x536a('0x48')]=_[_0x536a('0x49')](_0x1c2c96[_0x536a('0x44')],_0x1c2c96[_0x536a('0x47')]);_0x253f14['attributes']=_[_0x536a('0x49')](_0x1c2c96[_0x536a('0x44')],qs['fields'](_0x3cba48[_0x536a('0x47')][_0x536a('0x4b')]));_0x253f14[_0x536a('0x4a')]=_0x253f14[_0x536a('0x4a')][_0x536a('0x4c')]?_0x253f14[_0x536a('0x4a')]:_0x1c2c96['model'];if(!_0x3cba48[_0x536a('0x47')][_0x536a('0x4d')](_0x536a('0x4e'))){_0x253f14[_0x536a('0x2f')]=qs[_0x536a('0x2f')](_0x3cba48[_0x536a('0x47')][_0x536a('0x2f')]);_0x253f14[_0x536a('0x4f')]=qs[_0x536a('0x4f')](_0x3cba48[_0x536a('0x47')][_0x536a('0x4f')]);}_0x253f14[_0x536a('0x50')]=qs[_0x536a('0x6c')](_0x3cba48[_0x536a('0x47')][_0x536a('0x6c')]);_0x253f14[_0x536a('0x51')]=qs[_0x536a('0x48')](_[_0x536a('0x52')](_0x3cba48[_0x536a('0x47')],_0x1c2c96[_0x536a('0x48')]));_0x253f14[_0x536a('0x51')]['FaxAccountId']=_0x3d8c96['id'];if(_0x3cba48[_0x536a('0x47')]['filter']){_0x253f14[_0x536a('0x51')]=_['merge'](_0x253f14[_0x536a('0x51')],{'$or':_[_0x536a('0x45')](_0x253f14['attributes'],function(_0x2031f3){var _0x7b9685={};_0x7b9685[_0x2031f3]={'$like':'%'+_0x3cba48[_0x536a('0x47')]['filter']+'%'};return _0x7b9685;})});}_0x253f14=_[_0x536a('0x55')]({},_0x253f14,_0x3cba48[_0x536a('0x5d')]);return db[_0x536a('0x76')]['count']({'where':_0x253f14[_0x536a('0x51')]})[_0x536a('0x36')](function(_0x5b0a20){_0x48ed6c[_0x536a('0x56')]=_0x5b0a20;if(_0x3cba48['query'][_0x536a('0x57')]){_0x253f14[_0x536a('0x5c')]=[{'model':db[_0x536a('0x77')],'as':'Contact','required':![]},{'model':db[_0x536a('0x78')],'as':_0x536a('0x79'),'attributes':[_0x536a('0x3b'),'fullname',_0x536a('0x7a')],'required':![]},{'model':db[_0x536a('0x7b')],'as':_0x536a('0x7c'),'attributes':['id',_0x536a('0x3b'),'color'],'where':_0x3cba48[_0x536a('0x47')]['tag']?{'id':_0x3cba48[_0x536a('0x47')][_0x536a('0x7d')]}:undefined,'required':_0x3cba48[_0x536a('0x47')][_0x536a('0x7d')]?!![]:![]}];}return db['FaxInteraction']['findAll'](_0x253f14);})[_0x536a('0x36')](function(_0x224f67){_0x48ed6c[_0x536a('0x59')]=_0x224f67;return _0x48ed6c;});}})['then'](respondWithFilteredResult(_0x25db12,_0x253f14))[_0x536a('0x2a')](handleError(_0x25db12,null));};exports[_0x536a('0x7e')]=function(_0x5b8215,_0x4805fd,_0x151b20){return db[_0x536a('0x3f')]['findOne']({'where':{'id':_0x5b8215[_0x536a('0x5b')]['id']}})['then'](handleEntityNotFound(_0x4805fd,null))[_0x536a('0x36')](function(_0x45e439){if(_0x45e439){return db['sequelize'][_0x536a('0x7f')](function(_0x24448f){return db[_0x536a('0x80')]['destroy']({'where':{'FaxAccountId':_0x5b8215[_0x536a('0x5b')]['id']},'transaction':_0x24448f})['then'](function(_0x5ed7a5){var _0x416896=_[_0x536a('0x45')](_0x5b8215['body'],function(_0x5d9a29){_0x5d9a29[_0x536a('0x68')]=_0x5b8215[_0x536a('0x5b')]['id'];return _0x5d9a29;});return db[_0x536a('0x80')][_0x536a('0x81')](_0x416896,{'transaction':_0x24448f});});})[_0x536a('0x36')](function(){return db[_0x536a('0x80')][_0x536a('0x82')]({'where':{'FaxAccountId':_0x5b8215['params']['id']},'order':_0x536a('0x83')});});}})[_0x536a('0x36')](respondWithResult(_0x4805fd,null))['catch'](handleError(_0x4805fd,null));};exports[_0x536a('0x84')]=function(_0x5c3b5b,_0x2e40e5,_0x5ec9e9){var _0x2e42e6={};var _0x2383e6={};var _0x3fc3ab;var _0x4a02a8;return db[_0x536a('0x3f')][_0x536a('0x6b')]({'where':{'id':_0x5c3b5b[_0x536a('0x5b')]['id']}})['then'](handleEntityNotFound(_0x2e40e5,null))[_0x536a('0x36')](function(_0x46480c){if(_0x46480c){_0x3fc3ab=_0x46480c;_0x2383e6['model']=_['keys'](db['FaxApplication']['rawAttributes']);_0x2383e6[_0x536a('0x47')]=_[_0x536a('0x46')](_0x5c3b5b[_0x536a('0x47')]);_0x2383e6[_0x536a('0x48')]=_[_0x536a('0x49')](_0x2383e6[_0x536a('0x44')],_0x2383e6['query']);_0x2e42e6[_0x536a('0x4a')]=_['intersection'](_0x2383e6[_0x536a('0x44')],qs[_0x536a('0x4b')](_0x5c3b5b['query'][_0x536a('0x4b')]));_0x2e42e6[_0x536a('0x4a')]=_0x2e42e6[_0x536a('0x4a')][_0x536a('0x4c')]?_0x2e42e6[_0x536a('0x4a')]:_0x2383e6[_0x536a('0x44')];_0x2e42e6[_0x536a('0x50')]=qs[_0x536a('0x6c')](_0x5c3b5b[_0x536a('0x47')]['sort']);_0x2e42e6['where']=qs[_0x536a('0x48')](_[_0x536a('0x52')](_0x5c3b5b[_0x536a('0x47')],_0x2383e6['filters']));if(_0x5c3b5b[_0x536a('0x47')]['filter']){_0x2e42e6[_0x536a('0x51')]=_[_0x536a('0x55')](_0x2e42e6[_0x536a('0x51')],{'$or':_[_0x536a('0x45')](_0x2e42e6[_0x536a('0x4a')],function(_0xa3e666){var _0x3c3c89={};_0x3c3c89[_0xa3e666]={'$like':'%'+_0x5c3b5b['query'][_0x536a('0x53')]+'%'};return _0x3c3c89;})});}_0x2e42e6=_[_0x536a('0x55')]({},_0x2e42e6,_0x5c3b5b[_0x536a('0x5d')]);return _0x3fc3ab[_0x536a('0x84')](_0x2e42e6);}})['then'](function(_0x515c56){if(_0x515c56){_0x4a02a8=_0x515c56[_0x536a('0x4c')];if(!_0x5c3b5b[_0x536a('0x47')][_0x536a('0x4d')](_0x536a('0x4e'))){_0x2e42e6['limit']=qs[_0x536a('0x2f')](_0x5c3b5b[_0x536a('0x47')]['limit']);_0x2e42e6[_0x536a('0x4f')]=qs['offset'](_0x5c3b5b[_0x536a('0x47')][_0x536a('0x4f')]);}return _0x3fc3ab[_0x536a('0x84')](_0x2e42e6);}})[_0x536a('0x36')](function(_0x194ebc){if(_0x194ebc){return _0x194ebc?{'count':_0x4a02a8,'rows':_0x194ebc}:null;}})[_0x536a('0x36')](respondWithResult(_0x2e40e5,null))[_0x536a('0x2a')](handleError(_0x2e40e5,null));};function Extension(_0x316be7,_0x2d4866,_0x24bca4,_0x1183c0){this[_0x536a('0x85')]=_0x536a('0x86');this[_0x536a('0x87')]=_0x316be7[_0x536a('0x88')];this[_0x536a('0x89')]=_0x1183c0;this[_0x536a('0x42')]=_0x536a('0x8a');this[_0x536a('0x8b')]=_0x536a('0x8c');this['FaxAccountId']=_0x316be7['id'];this[_0x536a('0x83')]=_0x2d4866;this[_0x536a('0x8d')]=_0x24bca4;}function createExtensionsReciveFax(_0x4bbc91){var _0x247104=0x1;var _0x34f177=[];_0x34f177[_0x536a('0x8e')](new Extension(_0x4bbc91,_0x247104,'',_0x536a('0x8f')));_0x247104+=0x1;_0x34f177[_0x536a('0x8e')](new Extension(_0x4bbc91,_0x247104,'CDR(type)=inbound-fax',_0x536a('0x90')));_0x247104+=0x1;for(var _0x13012c in _0x4bbc91){if(_0x4bbc91[_0x536a('0x4d')](_0x13012c)&&(_0x13012c==='ecm'||_0x13012c===_0x536a('0x88')||_0x13012c==='gateway'||_0x13012c==='faxdetect'||_0x13012c===_0x536a('0x91')||_0x13012c===_0x536a('0x92')||_0x13012c===_0x536a('0x93')||_0x13012c===_0x536a('0x94')||_0x13012c==='t38timeout')){_0x34f177['push'](new Extension(_0x4bbc91,_0x247104,_0x536a('0x95')+_0x13012c+')='+_0x4bbc91[_0x13012c],'Set'));_0x247104+=0x1;}}_0x34f177[_0x536a('0x8e')](new Extension(_0x4bbc91,_0x247104,'6',_0x536a('0x96')));_0x247104+=0x1;_0x34f177[_0x536a('0x8e')](new Extension(_0x4bbc91,_0x247104,_0x536a('0x97'),'ReceiveFax'));_0x247104=0x0;return _0x34f177;}exports[_0x536a('0x98')]=function(_0xc7bd64,_0x4b3798,_0x362653){var _0x5b94c1;return db[_0x536a('0x99')][_0x536a('0x7f')](function(_0x1cc5b5){return db[_0x536a('0x3f')]['create'](_0xc7bd64[_0x536a('0x5f')],{'transaction':_0x1cc5b5})[_0x536a('0x36')](function(_0x4eae8c){_0x5b94c1=_0x4eae8c['get']({'plain':!![]});return db[_0x536a('0x9a')][_0x536a('0x81')](createExtensionsReciveFax(_0x5b94c1),{'transaction':_0x1cc5b5});});})[_0x536a('0x36')](function(){return _0x5b94c1;})['then'](respondWithResult(_0x4b3798,null))['catch'](handleError(_0x4b3798,null));};exports[_0x536a('0x9b')]=function(_0x4fb0fb,_0x3480fe,_0x3ff963){var _0x43e946;return db[_0x536a('0x99')][_0x536a('0x7f')](function(_0x2363dc){return db[_0x536a('0x3f')][_0x536a('0x35')](_0x4fb0fb[_0x536a('0x5f')],{'where':{'id':_0x4fb0fb[_0x536a('0x5f')]['id']},'transaction':_0x2363dc})[_0x536a('0x36')](function(_0x5c2ea0){return db[_0x536a('0x9a')][_0x536a('0x37')]({'where':{'FaxAccountId':_0x4fb0fb[_0x536a('0x5f')]['id']},'transaction':_0x2363dc})[_0x536a('0x36')](function(_0x29d15d){return db[_0x536a('0x9a')][_0x536a('0x81')](createExtensionsReciveFax(_[_0x536a('0x74')](_0x4fb0fb[_0x536a('0x5f')],['tech',_0x536a('0x43'),_0x536a('0x9c'),_0x536a('0x9d'),_0x536a('0x9e'),_0x536a('0x9f')])),{'transaction':_0x2363dc});});});})['then'](function(){return db[_0x536a('0x3f')][_0x536a('0xa0')](_0x4fb0fb[_0x536a('0x5f')]['id']);})[_0x536a('0x36')](respondWithResult(_0x3480fe,null))['catch'](handleError(_0x3480fe,null));};exports['getMessages']=function(_0x2f62b7,_0xd49f33,_0xf52db4){var _0x3aa209={'raw':!![],'where':{}};var _0x471cbb={};var _0x2f10e8={'count':0x0,'rows':[]};return db['FaxAccount'][_0x536a('0x6b')]({'where':{'id':_0x2f62b7['params']['id']}})[_0x536a('0x36')](handleEntityNotFound(_0xd49f33,null))[_0x536a('0x36')](function(_0x584448){if(_0x584448){_0x471cbb['model']=_[_0x536a('0x46')](db['FaxMessage'][_0x536a('0x40')]);_0x471cbb[_0x536a('0x47')]=_[_0x536a('0x46')](_0x2f62b7[_0x536a('0x47')]);_0x471cbb[_0x536a('0x48')]=_['intersection'](_0x471cbb[_0x536a('0x44')],_0x471cbb[_0x536a('0x47')]);_0x3aa209[_0x536a('0x4a')]=_[_0x536a('0x49')](_0x471cbb[_0x536a('0x44')],qs[_0x536a('0x4b')](_0x2f62b7[_0x536a('0x47')][_0x536a('0x4b')]));_0x3aa209[_0x536a('0x4a')]=_0x3aa209['attributes']['length']?_0x3aa209[_0x536a('0x4a')]:_0x471cbb[_0x536a('0x44')];if(!_0x2f62b7[_0x536a('0x47')]['hasOwnProperty']('nolimit')){_0x3aa209[_0x536a('0x2f')]=qs[_0x536a('0x2f')](_0x2f62b7[_0x536a('0x47')]['limit']);_0x3aa209['offset']=qs[_0x536a('0x4f')](_0x2f62b7[_0x536a('0x47')][_0x536a('0x4f')]);}_0x3aa209[_0x536a('0x50')]=qs['sort'](_0x2f62b7[_0x536a('0x47')][_0x536a('0x6c')]);_0x3aa209['where']=qs[_0x536a('0x48')](_[_0x536a('0x52')](_0x2f62b7[_0x536a('0x47')],_0x471cbb[_0x536a('0x48')]));_0x3aa209[_0x536a('0x51')][_0x536a('0x68')]=_0x584448['id'];if(_0x2f62b7[_0x536a('0x47')]['filter']){_0x3aa209[_0x536a('0x51')]=_[_0x536a('0x55')](_0x3aa209['where'],{'$or':_['map'](_0x3aa209['attributes'],function(_0x3a4a7f){var _0x2442cb={};_0x2442cb[_0x3a4a7f]={'$like':'%'+_0x2f62b7[_0x536a('0x47')][_0x536a('0x53')]+'%'};return _0x2442cb;})});}if(_0x2f62b7['query'][_0x536a('0xa1')]){var _0x4fe25e=_0x2f62b7['query'][_0x536a('0xa1')][_0x536a('0xa2')](',');var _0x3baa70={};_0x3baa70[_0x4fe25e[0x0]]={'$gte':moment(_0x4fe25e[0x1])[_0x536a('0xa3')](_0x536a('0xa4'))};_0x3aa209['where']=_[_0x536a('0x55')](_0x3aa209[_0x536a('0x51')],_0x3baa70);}_0x3aa209=_[_0x536a('0x55')]({},_0x3aa209,_0x2f62b7[_0x536a('0x5d')]);return db[_0x536a('0xa5')]['count']({'where':_0x3aa209[_0x536a('0x51')]})[_0x536a('0x36')](function(_0x47094b){_0x2f10e8[_0x536a('0x56')]=_0x47094b;if(_0x2f62b7[_0x536a('0x47')]['includeAll']){_0x3aa209[_0x536a('0x5c')]=[{'all':!![]}];}return db[_0x536a('0xa5')]['findAll'](_0x3aa209);})[_0x536a('0x36')](function(_0xa85719){_0x2f10e8[_0x536a('0x59')]=_0xa85719;return _0x2f10e8;});}})['then'](respondWithFilteredResult(_0xd49f33,_0x3aa209))[_0x536a('0x2a')](handleError(_0xd49f33,null));};exports[_0x536a('0x3c')]=function(_0x12b499,_0x4edb20,_0x232d92){var _0x1b5121,_0x823203={},_0x51ecd0;if(_0x12b499['body']['to']){_0x51ecd0=_0x12b499[_0x536a('0x5f')]['to'][0x0];}return db[_0x536a('0x3f')][_0x536a('0x62')]({'where':{'id':_0x12b499[_0x536a('0x5b')]['id']},'include':[{'model':db['CmList'],'as':_0x536a('0xa6'),'include':[{'model':db['CmContact'],'as':_0x536a('0xa7'),'where':{'fax':_0x51ecd0},'limit':0x1,'order':[['updatedAt','DESC']]}]}]})[_0x536a('0x36')](handleEntityNotFound(_0x4edb20,null))[_0x536a('0x36')](function(_0x3b39a7){_0x1b5121=_0x3b39a7;if(_0x12b499[_0x536a('0x5f')][_0x536a('0xa8')]&&_0x12b499[_0x536a('0x5f')]['attachments'][_0x536a('0x4c')]){for(var _0x210dde=0x0;_0x210dde<_0x12b499['body'][_0x536a('0xa8')]['length'];_0x210dde+=0x1){_0x12b499['body'][_0x536a('0xa8')][_0x210dde]={'filename':_0x12b499[_0x536a('0x5f')][_0x536a('0xa8')][_0x210dde]['name'],'id':_0x12b499[_0x536a('0x5f')]['attachments'][_0x210dde]['id'],'path':path['join'](config[_0x536a('0xa9')],'server/files/attachments',_0x12b499['body'][_0x536a('0xa8')][_0x210dde][_0x536a('0xaa')])};}}return respondWithRpcPromise('CheckAfterSend',_0x536a('0xab'),{'FaxAccountId':_[_0x536a('0xac')](_0x12b499['params']['id'])?undefined:_0x12b499[_0x536a('0x5b')]['id'],'path':_['isNil'](_0x12b499[_0x536a('0x5f')][_0x536a('0xa8')][0x0]['path'])?undefined:_0x12b499['body'][_0x536a('0xa8')][0x0]['path'],'fax':_[_0x536a('0xac')](_0x12b499[_0x536a('0x5f')]['to'][0x0])?undefined:_0x12b499[_0x536a('0x5f')]['to'][0x0]},client9002);})[_0x536a('0x36')](function(){if(_0x1b5121){if(_[_0x536a('0xac')](_0x12b499['body']['from'])){_0x12b499['body'][_0x536a('0xad')]=util[_0x536a('0xa3')](_0x536a('0xae'),_0x1b5121[_0x536a('0x3b')],_0x1b5121[_0x536a('0xaf')]);}if(_0x1b5121[_0x536a('0xa6')]){if(_0x1b5121['List'][_0x536a('0xa7')][_0x536a('0x4c')]){return _0x1b5121[_0x536a('0xa6')][_0x536a('0xa7')][0x0];}else{return db[_0x536a('0x77')][_0x536a('0x5e')](_[_0x536a('0xb0')](_0x12b499[_0x536a('0x5f')],{'firstName':_0x12b499[_0x536a('0x5f')]['to'][0x0],'phone':_0x12b499[_0x536a('0x5f')]['to'][0x0],'fax':_0x12b499['body']['to'][0x0],'ListId':_0x1b5121[_0x536a('0x9f')]}));}}else{throw new Error(_0x536a('0xb1'));}}else{throw new Error('Send\x20Fax\x20failed');}})[_0x536a('0x36')](function(_0x4821ec){if(_0x4821ec){return db['FaxInteraction']['find']({'where':{'ContactId':_0x4821ec['id'],'closed':![],'FaxAccountId':_0x1b5121['id']}})[_0x536a('0x36')](function(_0x5e8333){if(_0x5e8333){return[_0x5e8333,![]];}return db['FaxInteraction'][_0x536a('0x5e')]({'UserId':_0x12b499[_0x536a('0x60')]['id'],'ContactId':_0x4821ec['id'],'FaxAccountId':_0x1b5121['id'],'fax':_0x12b499[_0x536a('0x5f')]['to'][0x0],'firstMsgDirection':'out','Messages':[_[_0x536a('0x55')](_0x12b499['body'],{'read':![],'body':_0x12b499['body'][_0x536a('0xa8')][0x0][_0x536a('0xb2')],'FaxAccountId':_0x1b5121['id'],'UserId':_0x12b499['user']['id'],'ContactId':_0x4821ec['id'],'AttachmentId':_0x12b499[_0x536a('0x5f')][_0x536a('0xa8')][0x0]['id']})]},{'include':[{'model':db[_0x536a('0xa5')],'as':_0x536a('0xb3')}]})['then'](function(_0x222f46){return[_0x222f46,!![]];});});}else{throw new Error(_0x536a('0xb4'));}})[_0x536a('0xb5')](function(_0x1b4971,_0x45b971){if(_0x45b971){return _0x1b4971;}return db[_0x536a('0xa5')]['create']({'direction':_0x536a('0xb6'),'read':![],'body':_0x12b499[_0x536a('0x5f')]['attachments'][0x0]['filename'],'FaxAccountId':_0x1b5121['id'],'FaxInteractionId':_0x1b4971['id'],'UserId':_0x12b499[_0x536a('0x60')]['id'],'ContactId':_0x1b4971[_0x536a('0xb7')],'AttachmentId':_0x12b499[_0x536a('0x5f')]['attachments'][0x0]['id']})[_0x536a('0x36')](function(_0x22d120){_0x1b4971[_0x536a('0xb8')][_0x536a('0xb3')]=[];_0x1b4971[_0x536a('0xb8')]['Messages'][_0x536a('0x8e')](_0x22d120[_0x536a('0xb8')]);return _0x1b4971;});})[_0x536a('0x36')](function(_0x511f90){respondWithRpcPromise(_0x536a('0xb9'),'SendFax',{'FaxAccountId':_['isNil'](_0x12b499[_0x536a('0x5b')]['id'])?undefined:_0x12b499[_0x536a('0x5b')]['id'],'path':_[_0x536a('0xac')](_0x12b499['body'][_0x536a('0xa8')][0x0][_0x536a('0x7')])?undefined:_0x12b499[_0x536a('0x5f')]['attachments'][0x0][_0x536a('0x7')],'fax':_['isNil'](_0x12b499[_0x536a('0x5f')]['to'][0x0])?undefined:_0x12b499[_0x536a('0x5f')]['to'][0x0],'AttachmentId':_0x12b499[_0x536a('0x5f')]['attachments'][0x0]['id']},client9002)[_0x536a('0x36')](function(_0x29d743){logger[_0x536a('0x22')](_0x536a('0xba'),_0x29d743);})[_0x536a('0x2a')](function(_0x3cc5ef){logger[_0x536a('0x22')]('SendFaxRpc,\x20%s',_0x3cc5ef);});return _0x511f90;})[_0x536a('0x36')](respondWithResult(_0x4edb20,null))[_0x536a('0x2a')](handleError(_0x4edb20,null));};exports[_0x536a('0xbb')]=function(_0x9c8ec,_0x2bea29,_0x4c3605){return db['FaxAccount'][_0x536a('0x62')]({'where':{'id':_0x9c8ec[_0x536a('0x5b')]['id']}})['then'](handleEntityNotFound(_0x2bea29,null))[_0x536a('0x36')](function(_0x211d70){if(_0x211d70){return _0x211d70['addAgents'](_0x9c8ec[_0x536a('0x5f')]['ids'],_['omit'](_0x9c8ec[_0x536a('0x5f')],[_0x536a('0x6e'),'id'])||{})[_0x536a('0xb5')](function(_0x523cbb){for(var _0x3c03df=0x0;_0x3c03df<_0x9c8ec[_0x536a('0x5f')]['ids'][_0x536a('0x4c')];_0x3c03df+=0x1){socket[_0x536a('0xbc')](_0x536a('0xbd'),{'UserId':_0x9c8ec[_0x536a('0x5f')]['ids'][_0x3c03df],'FaxAccountId':_0x9c8ec[_0x536a('0x5b')]['id']});}return _0x523cbb;});}})[_0x536a('0x36')](respondWithResult(_0x2bea29,null))[_0x536a('0x2a')](handleError(_0x2bea29,null));};exports[_0x536a('0xbe')]=function(_0x557132,_0x3f3352,_0x5cdb22){return db[_0x536a('0x3f')]['find']({'where':{'id':_0x557132['params']['id']}})[_0x536a('0x36')](handleEntityNotFound(_0x3f3352,null))[_0x536a('0x36')](function(_0x57b3c3){if(_0x57b3c3){return _0x57b3c3['removeAgents'](_0x557132[_0x536a('0x47')][_0x536a('0x6e')])[_0x536a('0x36')](function(){if(_[_0x536a('0xbf')](_0x557132[_0x536a('0x47')][_0x536a('0x6e')])){for(var _0x3dede2=0x0;_0x3dede2<_0x557132[_0x536a('0x47')][_0x536a('0x6e')][_0x536a('0x4c')];_0x3dede2+=0x1){socket['emit']('userFaxAccount:remove',{'UserId':Number(_0x557132[_0x536a('0x47')][_0x536a('0x6e')][_0x3dede2]),'FaxAccountId':Number(_0x557132[_0x536a('0x5b')]['id'])});}}else{socket[_0x536a('0xbc')](_0x536a('0xc0'),{'UserId':Number(_0x557132[_0x536a('0x47')][_0x536a('0x6e')]),'FaxAccountId':Number(_0x557132[_0x536a('0x5b')]['id'])});}});}})[_0x536a('0x36')](respondWithStatusCode(_0x3f3352,null))[_0x536a('0x2a')](handleError(_0x3f3352,null));};exports['getAgents']=function(_0x5aca1c,_0x41b7eb,_0x19d807){var _0x549784={};var _0xc7aa73={};var _0x53da06;var _0x41cef2;return db[_0x536a('0x3f')][_0x536a('0x6b')]({'where':{'id':_0x5aca1c[_0x536a('0x5b')]['id']}})[_0x536a('0x36')](handleEntityNotFound(_0x41b7eb,null))[_0x536a('0x36')](function(_0x102898){if(_0x102898){_0x53da06=_0x102898;_0xc7aa73[_0x536a('0x44')]=_[_0x536a('0x46')](db[_0x536a('0x78')]['rawAttributes']);_0xc7aa73[_0x536a('0x47')]=_['keys'](_0x5aca1c[_0x536a('0x47')]);_0xc7aa73[_0x536a('0x48')]=_['intersection'](_0xc7aa73[_0x536a('0x44')],_0xc7aa73[_0x536a('0x47')]);_0x549784['attributes']=_[_0x536a('0x49')](_0xc7aa73['model'],qs[_0x536a('0x4b')](_0x5aca1c[_0x536a('0x47')][_0x536a('0x4b')]));_0x549784[_0x536a('0x4a')]=_0x549784[_0x536a('0x4a')]['length']?_0x549784[_0x536a('0x4a')]:_0xc7aa73[_0x536a('0x44')];_0x549784[_0x536a('0x50')]=qs[_0x536a('0x6c')](_0x5aca1c[_0x536a('0x47')][_0x536a('0x6c')]);_0x549784[_0x536a('0x51')]=qs[_0x536a('0x48')](_[_0x536a('0x52')](_0x5aca1c[_0x536a('0x47')],_0xc7aa73['filters']));if(_0x5aca1c[_0x536a('0x47')][_0x536a('0x53')]){_0x549784[_0x536a('0x51')]=_[_0x536a('0x55')](_0x549784[_0x536a('0x51')],{'$or':_[_0x536a('0x45')](_0x549784[_0x536a('0x4a')],function(_0x9048b1){var _0x19834b={};_0x19834b[_0x9048b1]={'$like':'%'+_0x5aca1c['query'][_0x536a('0x53')]+'%'};return _0x19834b;})});}_0x549784=_[_0x536a('0x55')]({},_0x549784,_0x5aca1c[_0x536a('0x5d')]);return _0x53da06['getAgents'](_0x549784);}})[_0x536a('0x36')](function(_0x697656){if(_0x697656){_0x41cef2=_0x697656['length'];if(!_0x5aca1c[_0x536a('0x47')][_0x536a('0x4d')](_0x536a('0x4e'))){_0x549784[_0x536a('0x2f')]=qs[_0x536a('0x2f')](_0x5aca1c[_0x536a('0x47')][_0x536a('0x2f')]);_0x549784['offset']=qs[_0x536a('0x4f')](_0x5aca1c['query'][_0x536a('0x4f')]);}return _0x53da06[_0x536a('0xc1')](_0x549784);}})[_0x536a('0x36')](function(_0xb19e26){if(_0xb19e26){return _0xb19e26?{'count':_0x41cef2,'rows':_0xb19e26}:null;}})[_0x536a('0x36')](respondWithResult(_0x41b7eb,null))['catch'](handleError(_0x41b7eb,null));}; \ No newline at end of file +var _0x2c40=['system','description','Fax\x20Extension','appdata','Answer','push','CDR(type)=inbound-fax','Set','ecm','localstationid','gateway','faxdetect','headerinfo','maxrate','minrate','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','VoiceExtension','updateAccountApplications','tech','createdAt','updatedAt','TrunkId','ListId','findById','getMessages','FaxMessage','$gte','split','format','send','CmList','Contacts','attachments','join','root','server/files/attachments','basename','CheckAfterSend','isNil','path','\x22%s\x22\x20<%s>','fax','List','List\x20not\x20found','out','filename','Messages','Contact\x20not\x20found','spread','dataValues','SendFax','emit','userFaxAccount:save','removeAgents','isArray','userFaxAccount:remove','getAgents','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','sox','to-csv','lodash','squel','crypto','jsforce','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../mysqldb','defaults','redis','localhost','socket.io-emitter','./faxAccount.socket','jayson/promise','client','http','test','Sequelize','request','then','info','FaxAccount,\x20%s,\x20%s','request\x20sent','error','message','result','status','end','json','count','offset','limit','set','Content-Range','apply','reject','save','update','destroy','get','FaxAccounts','sendStatus','stack','name','index','Pause','mandatoryDispositionPause','map','FaxAccount','rawAttributes','fieldName','type','key','model','query','keys','filters','attributes','fields','length','hasOwnProperty','order','sort','where','pick','filter','merge','options','includeAll','include','findAll','rows','catch','intersection','find','create','body','user','userProfileId','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','describe','FaxAccountId','getDispositions','findOne','nolimit','Disposition','removeDispositions','addAnswer','CannedAnswer','getAnswers','removeAnswers','ids','addInteraction','FaxInteraction','omit','getInteractions','CmContact','User','Owner','fullname','internal','Tag','tag','sequelize','transaction','FaxApplication','bulkCreate','findAndCountAll','priority','getApplications','from-voip-provider','app'];(function(_0x3287d8,_0x4da652){var _0x58e06a=function(_0x210aee){while(--_0x210aee){_0x3287d8['push'](_0x3287d8['shift']());}};_0x58e06a(++_0x4da652);}(_0x2c40,0xfd));var _0x02c4=function(_0x236bc3,_0x5af813){_0x236bc3=_0x236bc3-0x0;var _0x1dd82e=_0x2c40[_0x236bc3];return _0x1dd82e;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x02c4('0x0'));var rimraf=require(_0x02c4('0x1'));var zipdir=require(_0x02c4('0x2'));var jsonpatch=require(_0x02c4('0x3'));var rp=require(_0x02c4('0x4'));var moment=require(_0x02c4('0x5'));var BPromise=require(_0x02c4('0x6'));var Mustache=require(_0x02c4('0x7'));var util=require('util');var path=require('path');var sox=require(_0x02c4('0x8'));var csv=require(_0x02c4('0x9'));var ejs=require('ejs');var fs=require('fs');var _=require(_0x02c4('0xa'));var squel=require(_0x02c4('0xb'));var crypto=require(_0x02c4('0xc'));var jsforce=require(_0x02c4('0xd'));var deskjs=require('desk.js');var toCsv=require(_0x02c4('0x9'));var querystring=require('querystring');var Papa=require(_0x02c4('0xe'));var Redis=require('ioredis');var authService=require(_0x02c4('0xf'));var qs=require(_0x02c4('0x10'));var as=require(_0x02c4('0x11'));var hardwareService=require(_0x02c4('0x12'));var logger=require(_0x02c4('0x13'))('api');var utils=require(_0x02c4('0x14'));var config=require('../../config/environment');var db=require(_0x02c4('0x15'))['db'];config['redis']=_[_0x02c4('0x16')](config[_0x02c4('0x17')],{'host':_0x02c4('0x18'),'port':0x18eb});var socket=require(_0x02c4('0x19'))(new Redis(config[_0x02c4('0x17')]));require(_0x02c4('0x1a'))['register'](socket);var jayson=require(_0x02c4('0x1b'));var client=jayson[_0x02c4('0x1c')][_0x02c4('0x1d')]({'port':0x232c});var client9002=jayson[_0x02c4('0x1c')][_0x02c4('0x1d')]({'port':0x232a});function checkPasswordPattern(_0x2fd86e,_0x30e6f0,_0x3effa1){if(_0x3effa1){var _0x44f865=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x44f865[_0x02c4('0x1e')](_0x30e6f0)){return _0x2fd86e;}else{throw new db[(_0x02c4('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 _0x2fd86e;}}function respondWithRpcPromise(_0x2c1d2d,_0x23ba6f,_0x17c703,_0x64d47c){return new BPromise(function(_0x5c6790,_0x499329){var _0x567c25=_0x64d47c||client;return _0x567c25[_0x02c4('0x20')](_0x2c1d2d,_0x17c703)[_0x02c4('0x21')](function(_0x3cd47f){logger[_0x02c4('0x22')](_0x02c4('0x23'),_0x23ba6f,'request\x20sent');logger['debug']('FaxAccount,\x20%s,\x20%s,\x20%s',_0x23ba6f,_0x02c4('0x24'),JSON['stringify'](_0x3cd47f));if(_0x3cd47f[_0x02c4('0x25')]){if(_0x3cd47f['error']['code']===0x1f4){logger[_0x02c4('0x25')](_0x02c4('0x23'),_0x23ba6f,_0x3cd47f[_0x02c4('0x25')][_0x02c4('0x26')]);return _0x499329(_0x3cd47f['error']['message']);}logger[_0x02c4('0x25')](_0x02c4('0x23'),_0x23ba6f,_0x3cd47f[_0x02c4('0x25')][_0x02c4('0x26')]);return _0x5c6790(_0x3cd47f[_0x02c4('0x25')][_0x02c4('0x26')]);}else{logger[_0x02c4('0x22')](_0x02c4('0x23'),_0x23ba6f,'request\x20sent');_0x5c6790(_0x3cd47f[_0x02c4('0x27')]['message']);}})['catch'](function(_0x16723d){logger[_0x02c4('0x25')](_0x02c4('0x23'),_0x23ba6f,_0x16723d);_0x499329(_0x16723d);});});}function respondWithStatusCode(_0x20f1ae,_0x5c37df){_0x5c37df=_0x5c37df||0xcc;return function(_0x1b8fbf){if(_0x1b8fbf){return _0x20f1ae['sendStatus'](_0x5c37df);}return _0x20f1ae[_0x02c4('0x28')](_0x5c37df)[_0x02c4('0x29')]();};}function respondWithResult(_0x349e5b,_0x543977){_0x543977=_0x543977||0xc8;return function(_0x310625){if(_0x310625){return _0x349e5b[_0x02c4('0x28')](_0x543977)[_0x02c4('0x2a')](_0x310625);}};}function respondWithFilteredResult(_0x9b3cbf,_0x1e509e){return function(_0x50252c){if(_0x50252c){var _0x444ca8=_0x50252c[_0x02c4('0x2b')],_0xc9a1bc=_0x1e509e[_0x02c4('0x2c')],_0x5319df=_0x1e509e['offset']+_0x1e509e[_0x02c4('0x2d')],_0x5f2f28;if(_0x5319df>=_0x444ca8){_0x5319df=_0x444ca8;_0x5f2f28=0xc8;}else{_0x5f2f28=0xce;}_0x9b3cbf[_0x02c4('0x28')](_0x5f2f28);return _0x9b3cbf[_0x02c4('0x2e')](_0x02c4('0x2f'),_0xc9a1bc+'-'+_0x5319df+'/'+_0x444ca8)[_0x02c4('0x2a')](_0x50252c);}return null;};}function patchUpdates(_0x438070){return function(_0x218497){try{jsonpatch[_0x02c4('0x30')](_0x218497,_0x438070,!![]);}catch(_0x471617){return BPromise[_0x02c4('0x31')](_0x471617);}return _0x218497[_0x02c4('0x32')]();};}function saveUpdates(_0x2abe56,_0x273492){return function(_0x8b96cf){if(_0x8b96cf){return _0x8b96cf[_0x02c4('0x33')](_0x2abe56)['then'](function(_0x1bd405){return _0x1bd405;});}return null;};}function removeEntity(_0x135df5,_0x596fd0){return function(_0x2382ae){if(_0x2382ae){return _0x2382ae[_0x02c4('0x34')]()[_0x02c4('0x21')](function(){var _0x2bdb37=_0x2382ae[_0x02c4('0x35')]({'plain':!![]});var _0x303013=_0x02c4('0x36');return db['UserProfileResource']['destroy']({'where':{'type':_0x303013,'resourceId':_0x2bdb37['id']}})['then'](function(){return _0x2382ae;});})[_0x02c4('0x21')](function(){_0x135df5[_0x02c4('0x28')](0xcc)['end']();});}};}function handleEntityNotFound(_0x4693b5,_0x568ffb){return function(_0x44ba19){if(!_0x44ba19){_0x4693b5[_0x02c4('0x37')](0x194);}return _0x44ba19;};}function handleError(_0xc52026,_0x26e7a2){_0x26e7a2=_0x26e7a2||0x1f4;return function(_0x19af65){logger[_0x02c4('0x25')](_0x19af65[_0x02c4('0x38')]);if(_0x19af65[_0x02c4('0x39')]){delete _0x19af65['name'];}_0xc52026['status'](_0x26e7a2)['send'](_0x19af65);};}exports[_0x02c4('0x3a')]=function(_0x2ffbbc,_0x22170a){var _0x2c6780={'include':[{'model':db[_0x02c4('0x3b')],'as':_0x02c4('0x3c')}]},_0x229f1b={},_0x1845a3={'count':0x0,'rows':[]};var _0x3e5731=_[_0x02c4('0x3d')](db[_0x02c4('0x3e')][_0x02c4('0x3f')],function(_0x58b3f1){return{'name':_0x58b3f1[_0x02c4('0x40')],'type':_0x58b3f1[_0x02c4('0x41')][_0x02c4('0x42')]};});_0x229f1b[_0x02c4('0x43')]=_[_0x02c4('0x3d')](_0x3e5731,_0x02c4('0x39'));_0x229f1b[_0x02c4('0x44')]=_[_0x02c4('0x45')](_0x2ffbbc[_0x02c4('0x44')]);_0x229f1b[_0x02c4('0x46')]=_['intersection'](_0x229f1b[_0x02c4('0x43')],_0x229f1b[_0x02c4('0x44')]);_0x2c6780[_0x02c4('0x47')]=_['intersection'](_0x229f1b['model'],qs[_0x02c4('0x48')](_0x2ffbbc[_0x02c4('0x44')]['fields']));_0x2c6780[_0x02c4('0x47')]=_0x2c6780[_0x02c4('0x47')][_0x02c4('0x49')]?_0x2c6780[_0x02c4('0x47')]:_0x229f1b[_0x02c4('0x43')];if(!_0x2ffbbc[_0x02c4('0x44')][_0x02c4('0x4a')]('nolimit')){_0x2c6780[_0x02c4('0x2d')]=qs[_0x02c4('0x2d')](_0x2ffbbc[_0x02c4('0x44')][_0x02c4('0x2d')]);_0x2c6780['offset']=qs[_0x02c4('0x2c')](_0x2ffbbc[_0x02c4('0x44')][_0x02c4('0x2c')]);}_0x2c6780[_0x02c4('0x4b')]=qs[_0x02c4('0x4c')](_0x2ffbbc[_0x02c4('0x44')]['sort']);_0x2c6780[_0x02c4('0x4d')]=qs[_0x02c4('0x46')](_[_0x02c4('0x4e')](_0x2ffbbc[_0x02c4('0x44')],_0x229f1b[_0x02c4('0x46')]));if(_0x2ffbbc[_0x02c4('0x44')]['filter']){_0x2c6780['where']=_['merge'](_0x2c6780[_0x02c4('0x4d')],{'$or':_[_0x02c4('0x3d')](_0x3e5731,function(_0x5df322){if(_0x5df322[_0x02c4('0x41')]!=='VIRTUAL'){var _0x2e29a1={};_0x2e29a1[_0x5df322[_0x02c4('0x39')]]={'$like':'%'+_0x2ffbbc['query'][_0x02c4('0x4f')]+'%'};return _0x2e29a1;}})});}_0x2c6780=_[_0x02c4('0x50')]({},_0x2c6780,_0x2ffbbc[_0x02c4('0x51')]);var _0x45e985={'where':_0x2c6780[_0x02c4('0x4d')]};return db['FaxAccount'][_0x02c4('0x2b')](_0x45e985)['then'](function(_0x3c28f7){_0x1845a3[_0x02c4('0x2b')]=_0x3c28f7;if(_0x2ffbbc[_0x02c4('0x44')][_0x02c4('0x52')]){_0x2c6780[_0x02c4('0x53')]=[{'all':!![]}];}return db[_0x02c4('0x3e')][_0x02c4('0x54')](_0x2c6780);})['then'](function(_0x29658f){_0x1845a3[_0x02c4('0x55')]=_0x29658f;return _0x1845a3;})[_0x02c4('0x21')](respondWithFilteredResult(_0x22170a,_0x2c6780))[_0x02c4('0x56')](handleError(_0x22170a,null));};exports['show']=function(_0x2b8ca9,_0x224b34){var _0x625440={'raw':![],'where':{'id':_0x2b8ca9['params']['id']},'include':[{'model':db['Pause'],'as':_0x02c4('0x3c')}]},_0x1a33a3={};_0x1a33a3[_0x02c4('0x43')]=_[_0x02c4('0x45')](db[_0x02c4('0x3e')][_0x02c4('0x3f')]);_0x1a33a3[_0x02c4('0x44')]=_[_0x02c4('0x45')](_0x2b8ca9['query']);_0x1a33a3['filters']=_[_0x02c4('0x57')](_0x1a33a3[_0x02c4('0x43')],_0x1a33a3['query']);_0x625440['attributes']=_[_0x02c4('0x57')](_0x1a33a3[_0x02c4('0x43')],qs['fields'](_0x2b8ca9[_0x02c4('0x44')]['fields']));_0x625440[_0x02c4('0x47')]=_0x625440[_0x02c4('0x47')][_0x02c4('0x49')]?_0x625440[_0x02c4('0x47')]:_0x1a33a3['model'];if(_0x2b8ca9[_0x02c4('0x44')][_0x02c4('0x52')]){_0x625440[_0x02c4('0x53')]=[{'all':!![]}];}_0x625440=_[_0x02c4('0x50')]({},_0x625440,_0x2b8ca9[_0x02c4('0x51')]);return db[_0x02c4('0x3e')][_0x02c4('0x58')](_0x625440)[_0x02c4('0x21')](handleEntityNotFound(_0x224b34,null))['then'](respondWithResult(_0x224b34,null))[_0x02c4('0x56')](handleError(_0x224b34,null));};exports['create']=function(_0x591ace,_0x18c1ee){return db[_0x02c4('0x3e')][_0x02c4('0x59')](_0x591ace[_0x02c4('0x5a')],{})['then'](function(_0x58f950){var _0xed5b67=_0x591ace[_0x02c4('0x5b')][_0x02c4('0x35')]({'plain':!![]});if(!_0xed5b67)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0xed5b67['role']==='user'){var _0x195fef=_0x58f950[_0x02c4('0x35')]({'plain':!![]});var _0x3c3c12=_0x02c4('0x36');return db['UserProfileSection']['find']({'where':{'name':_0x3c3c12,'userProfileId':_0xed5b67[_0x02c4('0x5c')]},'raw':!![]})[_0x02c4('0x21')](function(_0x58e59f){if(_0x58e59f&&_0x58e59f[_0x02c4('0x5d')]===0x0){return db[_0x02c4('0x5e')][_0x02c4('0x59')]({'name':_0x195fef[_0x02c4('0x39')],'resourceId':_0x195fef['id'],'type':_0x58e59f[_0x02c4('0x39')],'sectionId':_0x58e59f['id']},{})['then'](function(){return _0x58f950;});}else{return _0x58f950;}})[_0x02c4('0x56')](function(_0x1641f2){logger[_0x02c4('0x25')](_0x02c4('0x5f'),_0x1641f2);throw _0x1641f2;});}return _0x58f950;})[_0x02c4('0x21')](respondWithResult(_0x18c1ee,0xc9))[_0x02c4('0x56')](handleError(_0x18c1ee,null));};exports[_0x02c4('0x33')]=function(_0x2fb7c2,_0x7de988){if(_0x2fb7c2[_0x02c4('0x5a')]['id']){delete _0x2fb7c2[_0x02c4('0x5a')]['id'];}return db[_0x02c4('0x3e')]['find']({'where':{'id':_0x2fb7c2['params']['id']},'include':[{'model':db[_0x02c4('0x3b')],'as':_0x02c4('0x3c')}]})[_0x02c4('0x21')](handleEntityNotFound(_0x7de988,null))[_0x02c4('0x21')](saveUpdates(_0x2fb7c2['body'],null))[_0x02c4('0x21')](respondWithResult(_0x7de988,null))['catch'](handleError(_0x7de988,null));};exports[_0x02c4('0x34')]=function(_0x21f11b,_0x4d945f){return db[_0x02c4('0x3e')]['find']({'where':{'id':_0x21f11b[_0x02c4('0x60')]['id']}})[_0x02c4('0x21')](handleEntityNotFound(_0x4d945f,null))[_0x02c4('0x21')](removeEntity(_0x4d945f,null))['catch'](handleError(_0x4d945f,null));};exports[_0x02c4('0x61')]=function(_0x573da9,_0x15b070){return db[_0x02c4('0x3e')]['describe']()[_0x02c4('0x21')](respondWithResult(_0x15b070,null))[_0x02c4('0x56')](handleError(_0x15b070,null));};exports['addDisposition']=function(_0x3b03d1,_0x41e389,_0x26335e){if(_0x3b03d1[_0x02c4('0x5a')]['id']){delete _0x3b03d1['body']['id'];}return db[_0x02c4('0x3e')][_0x02c4('0x58')]({'where':{'id':_0x3b03d1[_0x02c4('0x60')]['id']}})[_0x02c4('0x21')](handleEntityNotFound(_0x41e389,null))[_0x02c4('0x21')](function(_0x4f2bc8){if(_0x4f2bc8){_0x3b03d1['body'][_0x02c4('0x62')]=_0x4f2bc8['id'];return db['Disposition'][_0x02c4('0x59')](_0x3b03d1['body']);}})[_0x02c4('0x21')](respondWithResult(_0x41e389,null))[_0x02c4('0x56')](handleError(_0x41e389,null));};exports[_0x02c4('0x63')]=function(_0x319b2a,_0x4d79d3,_0x59f9ed){var _0x313277={'raw':![],'where':{}};var _0x892f03={};var _0x36d44e={'count':0x0,'rows':[]};return db[_0x02c4('0x3e')][_0x02c4('0x64')]({'where':{'id':_0x319b2a[_0x02c4('0x60')]['id']}})[_0x02c4('0x21')](handleEntityNotFound(_0x4d79d3,null))[_0x02c4('0x21')](function(_0x29d25e){if(_0x29d25e){_0x892f03['model']=_[_0x02c4('0x45')](db['Disposition'][_0x02c4('0x3f')]);_0x892f03[_0x02c4('0x44')]=_[_0x02c4('0x45')](_0x319b2a[_0x02c4('0x44')]);_0x892f03[_0x02c4('0x46')]=_['intersection'](_0x892f03[_0x02c4('0x43')],_0x892f03[_0x02c4('0x44')]);_0x313277[_0x02c4('0x47')]=_[_0x02c4('0x57')](_0x892f03[_0x02c4('0x43')],qs[_0x02c4('0x48')](_0x319b2a[_0x02c4('0x44')][_0x02c4('0x48')]));_0x313277[_0x02c4('0x47')]=_0x313277[_0x02c4('0x47')][_0x02c4('0x49')]?_0x313277[_0x02c4('0x47')]:_0x892f03[_0x02c4('0x43')];if(!_0x319b2a[_0x02c4('0x44')]['hasOwnProperty'](_0x02c4('0x65'))){_0x313277[_0x02c4('0x2d')]=qs[_0x02c4('0x2d')](_0x319b2a[_0x02c4('0x44')]['limit']);_0x313277['offset']=qs[_0x02c4('0x2c')](_0x319b2a['query'][_0x02c4('0x2c')]);}_0x313277['order']=qs[_0x02c4('0x4c')](_0x319b2a[_0x02c4('0x44')][_0x02c4('0x4c')]);_0x313277[_0x02c4('0x4d')]=qs[_0x02c4('0x46')](_[_0x02c4('0x4e')](_0x319b2a[_0x02c4('0x44')],_0x892f03[_0x02c4('0x46')]));_0x313277[_0x02c4('0x4d')]['FaxAccountId']=_0x29d25e['id'];if(_0x319b2a[_0x02c4('0x44')][_0x02c4('0x4f')]){_0x313277[_0x02c4('0x4d')]=_[_0x02c4('0x50')](_0x313277[_0x02c4('0x4d')],{'$or':_[_0x02c4('0x3d')](_0x313277[_0x02c4('0x47')],function(_0x2dda6b){var _0x36fa9d={};_0x36fa9d[_0x2dda6b]={'$like':'%'+_0x319b2a[_0x02c4('0x44')][_0x02c4('0x4f')]+'%'};return _0x36fa9d;})});}_0x313277=_['merge']({},_0x313277,_0x319b2a[_0x02c4('0x51')]);return db[_0x02c4('0x66')][_0x02c4('0x2b')]({'where':_0x313277[_0x02c4('0x4d')]})[_0x02c4('0x21')](function(_0x422d48){_0x36d44e[_0x02c4('0x2b')]=_0x422d48;if(_0x319b2a[_0x02c4('0x44')][_0x02c4('0x52')]){_0x313277['include']=[{'all':!![]}];}return db[_0x02c4('0x66')][_0x02c4('0x54')](_0x313277);})[_0x02c4('0x21')](function(_0x2567fb){_0x36d44e[_0x02c4('0x55')]=_0x2567fb;return _0x36d44e;});}})[_0x02c4('0x21')](respondWithFilteredResult(_0x4d79d3,_0x313277))[_0x02c4('0x56')](handleError(_0x4d79d3,null));};exports[_0x02c4('0x67')]=function(_0x46ee31,_0xf9c2e5,_0x166e09){return db[_0x02c4('0x3e')][_0x02c4('0x58')]({'where':{'id':_0x46ee31[_0x02c4('0x60')]['id']}})[_0x02c4('0x21')](handleEntityNotFound(_0xf9c2e5,null))[_0x02c4('0x21')](function(_0x2a864a){if(_0x2a864a){return _0x2a864a[_0x02c4('0x67')](_0x46ee31[_0x02c4('0x44')]['ids']);}})[_0x02c4('0x21')](respondWithStatusCode(_0xf9c2e5,null))['catch'](handleError(_0xf9c2e5,null));};exports[_0x02c4('0x68')]=function(_0x5c77a2,_0x244391,_0x247dfb){if(_0x5c77a2['body']['id']){delete _0x5c77a2[_0x02c4('0x5a')]['id'];}return db['FaxAccount'][_0x02c4('0x58')]({'where':{'id':_0x5c77a2['params']['id']}})[_0x02c4('0x21')](handleEntityNotFound(_0x244391,null))['then'](function(_0x32886e){if(_0x32886e){_0x5c77a2[_0x02c4('0x5a')][_0x02c4('0x62')]=_0x32886e['id'];return db[_0x02c4('0x69')][_0x02c4('0x59')](_0x5c77a2['body']);}})[_0x02c4('0x21')](respondWithResult(_0x244391,null))[_0x02c4('0x56')](handleError(_0x244391,null));};exports[_0x02c4('0x6a')]=function(_0x32c00a,_0x666e07,_0x412a6f){var _0x137e23={'raw':![],'where':{}};var _0x3c8c32={};var _0xdf4bb8={'count':0x0,'rows':[]};return db[_0x02c4('0x3e')][_0x02c4('0x64')]({'where':{'id':_0x32c00a[_0x02c4('0x60')]['id']}})[_0x02c4('0x21')](handleEntityNotFound(_0x666e07,null))[_0x02c4('0x21')](function(_0x24a3f8){if(_0x24a3f8){_0x3c8c32['model']=_[_0x02c4('0x45')](db[_0x02c4('0x69')]['rawAttributes']);_0x3c8c32[_0x02c4('0x44')]=_[_0x02c4('0x45')](_0x32c00a[_0x02c4('0x44')]);_0x3c8c32[_0x02c4('0x46')]=_[_0x02c4('0x57')](_0x3c8c32[_0x02c4('0x43')],_0x3c8c32['query']);_0x137e23[_0x02c4('0x47')]=_[_0x02c4('0x57')](_0x3c8c32['model'],qs[_0x02c4('0x48')](_0x32c00a[_0x02c4('0x44')][_0x02c4('0x48')]));_0x137e23[_0x02c4('0x47')]=_0x137e23[_0x02c4('0x47')][_0x02c4('0x49')]?_0x137e23['attributes']:_0x3c8c32[_0x02c4('0x43')];if(!_0x32c00a['query'][_0x02c4('0x4a')]('nolimit')){_0x137e23[_0x02c4('0x2d')]=qs['limit'](_0x32c00a['query'][_0x02c4('0x2d')]);_0x137e23['offset']=qs[_0x02c4('0x2c')](_0x32c00a['query'][_0x02c4('0x2c')]);}_0x137e23[_0x02c4('0x4b')]=qs['sort'](_0x32c00a[_0x02c4('0x44')]['sort']);_0x137e23['where']=qs[_0x02c4('0x46')](_['pick'](_0x32c00a[_0x02c4('0x44')],_0x3c8c32[_0x02c4('0x46')]));_0x137e23[_0x02c4('0x4d')]['FaxAccountId']=_0x24a3f8['id'];if(_0x32c00a[_0x02c4('0x44')][_0x02c4('0x4f')]){_0x137e23[_0x02c4('0x4d')]=_[_0x02c4('0x50')](_0x137e23[_0x02c4('0x4d')],{'$or':_[_0x02c4('0x3d')](_0x137e23[_0x02c4('0x47')],function(_0x1ec31e){var _0x4f9e82={};_0x4f9e82[_0x1ec31e]={'$like':'%'+_0x32c00a[_0x02c4('0x44')]['filter']+'%'};return _0x4f9e82;})});}_0x137e23=_[_0x02c4('0x50')]({},_0x137e23,_0x32c00a[_0x02c4('0x51')]);return db[_0x02c4('0x69')]['count']({'where':_0x137e23['where']})[_0x02c4('0x21')](function(_0x3cc25a){_0xdf4bb8[_0x02c4('0x2b')]=_0x3cc25a;if(_0x32c00a[_0x02c4('0x44')][_0x02c4('0x52')]){_0x137e23['include']=[{'all':!![]}];}return db[_0x02c4('0x69')][_0x02c4('0x54')](_0x137e23);})[_0x02c4('0x21')](function(_0x578827){_0xdf4bb8['rows']=_0x578827;return _0xdf4bb8;});}})[_0x02c4('0x21')](respondWithFilteredResult(_0x666e07,_0x137e23))['catch'](handleError(_0x666e07,null));};exports[_0x02c4('0x6b')]=function(_0xf8d3b7,_0x2eab47,_0x1312d1){return db['FaxAccount'][_0x02c4('0x58')]({'where':{'id':_0xf8d3b7[_0x02c4('0x60')]['id']}})[_0x02c4('0x21')](handleEntityNotFound(_0x2eab47,null))[_0x02c4('0x21')](function(_0x4c6a0b){if(_0x4c6a0b){return _0x4c6a0b['removeAnswers'](_0xf8d3b7[_0x02c4('0x44')][_0x02c4('0x6c')]);}})[_0x02c4('0x21')](respondWithStatusCode(_0x2eab47,null))[_0x02c4('0x56')](handleError(_0x2eab47,null));};exports[_0x02c4('0x6d')]=function(_0x55e9f8,_0xeeab94,_0x261703){return db[_0x02c4('0x6e')][_0x02c4('0x58')]({'where':{'id':_0x55e9f8[_0x02c4('0x60')]['id']}})['then'](handleEntityNotFound(_0xeeab94,null))['then'](function(_0x3fc1f0){if(_0x3fc1f0){return _0x3fc1f0[_0x02c4('0x6d')](_0x55e9f8[_0x02c4('0x5a')][_0x02c4('0x6c')],_[_0x02c4('0x6f')](_0x55e9f8[_0x02c4('0x5a')],[_0x02c4('0x6c'),'id'])||{});}})[_0x02c4('0x21')](respondWithResult(_0xeeab94,null))['catch'](handleError(_0xeeab94,null));};exports[_0x02c4('0x70')]=function(_0x1ddf63,_0x2ab60e,_0x764590){var _0x293e6e={'raw':![],'where':{}};var _0x4e5c92={};var _0x20f57b={'count':0x0,'rows':[]};return db['FaxAccount'][_0x02c4('0x64')]({'where':{'id':_0x1ddf63[_0x02c4('0x60')]['id']}})[_0x02c4('0x21')](handleEntityNotFound(_0x2ab60e,null))[_0x02c4('0x21')](function(_0x2946f7){if(_0x2946f7){_0x4e5c92[_0x02c4('0x43')]=_[_0x02c4('0x45')](db[_0x02c4('0x6e')][_0x02c4('0x3f')]);_0x4e5c92[_0x02c4('0x44')]=_[_0x02c4('0x45')](_0x1ddf63[_0x02c4('0x44')]);_0x4e5c92[_0x02c4('0x46')]=_[_0x02c4('0x57')](_0x4e5c92['model'],_0x4e5c92['query']);_0x293e6e[_0x02c4('0x47')]=_[_0x02c4('0x57')](_0x4e5c92[_0x02c4('0x43')],qs[_0x02c4('0x48')](_0x1ddf63[_0x02c4('0x44')][_0x02c4('0x48')]));_0x293e6e[_0x02c4('0x47')]=_0x293e6e[_0x02c4('0x47')][_0x02c4('0x49')]?_0x293e6e['attributes']:_0x4e5c92[_0x02c4('0x43')];if(!_0x1ddf63['query']['hasOwnProperty'](_0x02c4('0x65'))){_0x293e6e[_0x02c4('0x2d')]=qs[_0x02c4('0x2d')](_0x1ddf63['query'][_0x02c4('0x2d')]);_0x293e6e['offset']=qs[_0x02c4('0x2c')](_0x1ddf63[_0x02c4('0x44')][_0x02c4('0x2c')]);}_0x293e6e[_0x02c4('0x4b')]=qs[_0x02c4('0x4c')](_0x1ddf63[_0x02c4('0x44')][_0x02c4('0x4c')]);_0x293e6e[_0x02c4('0x4d')]=qs[_0x02c4('0x46')](_[_0x02c4('0x4e')](_0x1ddf63['query'],_0x4e5c92[_0x02c4('0x46')]));_0x293e6e[_0x02c4('0x4d')]['FaxAccountId']=_0x2946f7['id'];if(_0x1ddf63['query'][_0x02c4('0x4f')]){_0x293e6e[_0x02c4('0x4d')]=_[_0x02c4('0x50')](_0x293e6e[_0x02c4('0x4d')],{'$or':_[_0x02c4('0x3d')](_0x293e6e[_0x02c4('0x47')],function(_0x50d1c6){var _0x3dd715={};_0x3dd715[_0x50d1c6]={'$like':'%'+_0x1ddf63[_0x02c4('0x44')]['filter']+'%'};return _0x3dd715;})});}_0x293e6e=_['merge']({},_0x293e6e,_0x1ddf63[_0x02c4('0x51')]);return db[_0x02c4('0x6e')][_0x02c4('0x2b')]({'where':_0x293e6e[_0x02c4('0x4d')]})[_0x02c4('0x21')](function(_0x41ee3f){_0x20f57b[_0x02c4('0x2b')]=_0x41ee3f;if(_0x1ddf63[_0x02c4('0x44')][_0x02c4('0x52')]){_0x293e6e[_0x02c4('0x53')]=[{'model':db[_0x02c4('0x71')],'as':'Contact','required':![]},{'model':db[_0x02c4('0x72')],'as':_0x02c4('0x73'),'attributes':[_0x02c4('0x39'),_0x02c4('0x74'),_0x02c4('0x75')],'required':![]},{'model':db[_0x02c4('0x76')],'as':'Tags','attributes':['id',_0x02c4('0x39'),'color'],'where':_0x1ddf63[_0x02c4('0x44')]['tag']?{'id':_0x1ddf63[_0x02c4('0x44')][_0x02c4('0x77')]}:undefined,'required':_0x1ddf63[_0x02c4('0x44')][_0x02c4('0x77')]?!![]:![]}];}return db[_0x02c4('0x6e')][_0x02c4('0x54')](_0x293e6e);})[_0x02c4('0x21')](function(_0x1a4fee){_0x20f57b[_0x02c4('0x55')]=_0x1a4fee;return _0x20f57b;});}})[_0x02c4('0x21')](respondWithFilteredResult(_0x2ab60e,_0x293e6e))['catch'](handleError(_0x2ab60e,null));};exports['addApplications']=function(_0x5eca47,_0x3eb4d2,_0x4fe590){return db[_0x02c4('0x3e')][_0x02c4('0x64')]({'where':{'id':_0x5eca47[_0x02c4('0x60')]['id']}})[_0x02c4('0x21')](handleEntityNotFound(_0x3eb4d2,null))[_0x02c4('0x21')](function(_0xc5b51){if(_0xc5b51){return db[_0x02c4('0x78')][_0x02c4('0x79')](function(_0x4ffb47){return db[_0x02c4('0x7a')][_0x02c4('0x34')]({'where':{'FaxAccountId':_0x5eca47['params']['id']},'transaction':_0x4ffb47})[_0x02c4('0x21')](function(_0x3ba804){var _0x570909=_[_0x02c4('0x3d')](_0x5eca47[_0x02c4('0x5a')],function(_0x2d9192){_0x2d9192['FaxAccountId']=_0x5eca47['params']['id'];return _0x2d9192;});return db[_0x02c4('0x7a')][_0x02c4('0x7b')](_0x570909,{'transaction':_0x4ffb47});});})[_0x02c4('0x21')](function(){return db[_0x02c4('0x7a')][_0x02c4('0x7c')]({'where':{'FaxAccountId':_0x5eca47['params']['id']},'order':_0x02c4('0x7d')});});}})[_0x02c4('0x21')](respondWithResult(_0x3eb4d2,null))[_0x02c4('0x56')](handleError(_0x3eb4d2,null));};exports[_0x02c4('0x7e')]=function(_0x51772c,_0xd93240,_0x2a340c){var _0x1b99f4={};var _0x1c471d={};var _0x400bc4;var _0x4ccc8c;return db['FaxAccount'][_0x02c4('0x64')]({'where':{'id':_0x51772c[_0x02c4('0x60')]['id']}})[_0x02c4('0x21')](handleEntityNotFound(_0xd93240,null))[_0x02c4('0x21')](function(_0x313cc4){if(_0x313cc4){_0x400bc4=_0x313cc4;_0x1c471d[_0x02c4('0x43')]=_[_0x02c4('0x45')](db[_0x02c4('0x7a')][_0x02c4('0x3f')]);_0x1c471d[_0x02c4('0x44')]=_['keys'](_0x51772c[_0x02c4('0x44')]);_0x1c471d[_0x02c4('0x46')]=_['intersection'](_0x1c471d[_0x02c4('0x43')],_0x1c471d[_0x02c4('0x44')]);_0x1b99f4[_0x02c4('0x47')]=_[_0x02c4('0x57')](_0x1c471d[_0x02c4('0x43')],qs[_0x02c4('0x48')](_0x51772c['query'][_0x02c4('0x48')]));_0x1b99f4[_0x02c4('0x47')]=_0x1b99f4[_0x02c4('0x47')]['length']?_0x1b99f4[_0x02c4('0x47')]:_0x1c471d[_0x02c4('0x43')];_0x1b99f4[_0x02c4('0x4b')]=qs[_0x02c4('0x4c')](_0x51772c['query'][_0x02c4('0x4c')]);_0x1b99f4['where']=qs[_0x02c4('0x46')](_[_0x02c4('0x4e')](_0x51772c['query'],_0x1c471d[_0x02c4('0x46')]));if(_0x51772c[_0x02c4('0x44')][_0x02c4('0x4f')]){_0x1b99f4[_0x02c4('0x4d')]=_[_0x02c4('0x50')](_0x1b99f4[_0x02c4('0x4d')],{'$or':_[_0x02c4('0x3d')](_0x1b99f4[_0x02c4('0x47')],function(_0x5bbee0){var _0x5caf64={};_0x5caf64[_0x5bbee0]={'$like':'%'+_0x51772c[_0x02c4('0x44')]['filter']+'%'};return _0x5caf64;})});}_0x1b99f4=_[_0x02c4('0x50')]({},_0x1b99f4,_0x51772c[_0x02c4('0x51')]);return _0x400bc4[_0x02c4('0x7e')](_0x1b99f4);}})['then'](function(_0x4016c2){if(_0x4016c2){_0x4ccc8c=_0x4016c2[_0x02c4('0x49')];if(!_0x51772c['query'][_0x02c4('0x4a')](_0x02c4('0x65'))){_0x1b99f4[_0x02c4('0x2d')]=qs['limit'](_0x51772c[_0x02c4('0x44')][_0x02c4('0x2d')]);_0x1b99f4['offset']=qs[_0x02c4('0x2c')](_0x51772c['query'][_0x02c4('0x2c')]);}return _0x400bc4[_0x02c4('0x7e')](_0x1b99f4);}})[_0x02c4('0x21')](function(_0x51ea72){if(_0x51ea72){return _0x51ea72?{'count':_0x4ccc8c,'rows':_0x51ea72}:null;}})['then'](respondWithResult(_0xd93240,null))[_0x02c4('0x56')](handleError(_0xd93240,null));};function Extension(_0x259706,_0x11cf61,_0x28440b,_0x53a99f){this['context']=_0x02c4('0x7f');this['exten']=_0x259706['localstationid'];this[_0x02c4('0x80')]=_0x53a99f;this[_0x02c4('0x41')]=_0x02c4('0x81');this[_0x02c4('0x82')]=_0x02c4('0x83');this['FaxAccountId']=_0x259706['id'];this[_0x02c4('0x7d')]=_0x11cf61;this[_0x02c4('0x84')]=_0x28440b;}function createExtensionsReciveFax(_0x4d13fd){var _0x3fe709=0x1;var _0x2baef6=[];_0x2baef6['push'](new Extension(_0x4d13fd,_0x3fe709,'',_0x02c4('0x85')));_0x3fe709+=0x1;_0x2baef6[_0x02c4('0x86')](new Extension(_0x4d13fd,_0x3fe709,_0x02c4('0x87'),_0x02c4('0x88')));_0x3fe709+=0x1;for(var _0x4de325 in _0x4d13fd){if(_0x4d13fd[_0x02c4('0x4a')](_0x4de325)&&(_0x4de325===_0x02c4('0x89')||_0x4de325===_0x02c4('0x8a')||_0x4de325===_0x02c4('0x8b')||_0x4de325===_0x02c4('0x8c')||_0x4de325===_0x02c4('0x8d')||_0x4de325===_0x02c4('0x8e')||_0x4de325===_0x02c4('0x8f')||_0x4de325===_0x02c4('0x90')||_0x4de325===_0x02c4('0x91'))){_0x2baef6['push'](new Extension(_0x4d13fd,_0x3fe709,_0x02c4('0x92')+_0x4de325+')='+_0x4d13fd[_0x4de325],_0x02c4('0x88')));_0x3fe709+=0x1;}}_0x2baef6['push'](new Extension(_0x4d13fd,_0x3fe709,'6',_0x02c4('0x93')));_0x3fe709+=0x1;_0x2baef6['push'](new Extension(_0x4d13fd,_0x3fe709,_0x02c4('0x94'),'ReceiveFax'));_0x3fe709=0x0;return _0x2baef6;}exports[_0x02c4('0x95')]=function(_0x545e63,_0x3627e0,_0x24cac2){var _0x5fbdc1;return db['sequelize'][_0x02c4('0x79')](function(_0x3ad014){return db[_0x02c4('0x3e')][_0x02c4('0x59')](_0x545e63[_0x02c4('0x5a')],{'transaction':_0x3ad014})['then'](function(_0x412089){_0x5fbdc1=_0x412089[_0x02c4('0x35')]({'plain':!![]});return db[_0x02c4('0x96')]['bulkCreate'](createExtensionsReciveFax(_0x5fbdc1),{'transaction':_0x3ad014});});})[_0x02c4('0x21')](function(){return _0x5fbdc1;})[_0x02c4('0x21')](respondWithResult(_0x3627e0,null))[_0x02c4('0x56')](handleError(_0x3627e0,null));};exports[_0x02c4('0x97')]=function(_0x2afbf3,_0x4242f9,_0x36a3d9){var _0x50b374;return db[_0x02c4('0x78')][_0x02c4('0x79')](function(_0x8d1bac){return db[_0x02c4('0x3e')][_0x02c4('0x33')](_0x2afbf3[_0x02c4('0x5a')],{'where':{'id':_0x2afbf3['body']['id']},'transaction':_0x8d1bac})[_0x02c4('0x21')](function(_0x3e4d60){return db[_0x02c4('0x96')][_0x02c4('0x34')]({'where':{'FaxAccountId':_0x2afbf3[_0x02c4('0x5a')]['id']},'transaction':_0x8d1bac})[_0x02c4('0x21')](function(_0x46d938){return db[_0x02c4('0x96')][_0x02c4('0x7b')](createExtensionsReciveFax(_['omit'](_0x2afbf3[_0x02c4('0x5a')],[_0x02c4('0x98'),'key',_0x02c4('0x99'),_0x02c4('0x9a'),_0x02c4('0x9b'),_0x02c4('0x9c')])),{'transaction':_0x8d1bac});});});})[_0x02c4('0x21')](function(){return db['FaxAccount'][_0x02c4('0x9d')](_0x2afbf3[_0x02c4('0x5a')]['id']);})[_0x02c4('0x21')](respondWithResult(_0x4242f9,null))[_0x02c4('0x56')](handleError(_0x4242f9,null));};exports[_0x02c4('0x9e')]=function(_0x3085ac,_0x1eb12c,_0x42697e){var _0x1ff116={'raw':!![],'where':{}};var _0x3383e7={};var _0x18acaa={'count':0x0,'rows':[]};return db['FaxAccount'][_0x02c4('0x64')]({'where':{'id':_0x3085ac[_0x02c4('0x60')]['id']}})['then'](handleEntityNotFound(_0x1eb12c,null))[_0x02c4('0x21')](function(_0x28d241){if(_0x28d241){_0x3383e7['model']=_['keys'](db[_0x02c4('0x9f')][_0x02c4('0x3f')]);_0x3383e7[_0x02c4('0x44')]=_[_0x02c4('0x45')](_0x3085ac[_0x02c4('0x44')]);_0x3383e7[_0x02c4('0x46')]=_['intersection'](_0x3383e7[_0x02c4('0x43')],_0x3383e7[_0x02c4('0x44')]);_0x1ff116[_0x02c4('0x47')]=_[_0x02c4('0x57')](_0x3383e7[_0x02c4('0x43')],qs[_0x02c4('0x48')](_0x3085ac[_0x02c4('0x44')][_0x02c4('0x48')]));_0x1ff116[_0x02c4('0x47')]=_0x1ff116[_0x02c4('0x47')][_0x02c4('0x49')]?_0x1ff116['attributes']:_0x3383e7[_0x02c4('0x43')];if(!_0x3085ac[_0x02c4('0x44')][_0x02c4('0x4a')](_0x02c4('0x65'))){_0x1ff116[_0x02c4('0x2d')]=qs[_0x02c4('0x2d')](_0x3085ac[_0x02c4('0x44')][_0x02c4('0x2d')]);_0x1ff116[_0x02c4('0x2c')]=qs[_0x02c4('0x2c')](_0x3085ac[_0x02c4('0x44')]['offset']);}_0x1ff116[_0x02c4('0x4b')]=qs['sort'](_0x3085ac[_0x02c4('0x44')][_0x02c4('0x4c')]);_0x1ff116[_0x02c4('0x4d')]=qs[_0x02c4('0x46')](_['pick'](_0x3085ac[_0x02c4('0x44')],_0x3383e7['filters']));_0x1ff116[_0x02c4('0x4d')]['FaxAccountId']=_0x28d241['id'];if(_0x3085ac[_0x02c4('0x44')][_0x02c4('0x4f')]){_0x1ff116['where']=_[_0x02c4('0x50')](_0x1ff116[_0x02c4('0x4d')],{'$or':_['map'](_0x1ff116['attributes'],function(_0x222e1f){var _0x3bc281={};_0x3bc281[_0x222e1f]={'$like':'%'+_0x3085ac[_0x02c4('0x44')][_0x02c4('0x4f')]+'%'};return _0x3bc281;})});}if(_0x3085ac[_0x02c4('0x44')][_0x02c4('0xa0')]){var _0x102e32=_0x3085ac[_0x02c4('0x44')][_0x02c4('0xa0')][_0x02c4('0xa1')](',');var _0x17ec9f={};_0x17ec9f[_0x102e32[0x0]]={'$gte':moment(_0x102e32[0x1])[_0x02c4('0xa2')]('YYYY-MM-DD\x20HH:mm:ss')};_0x1ff116[_0x02c4('0x4d')]=_[_0x02c4('0x50')](_0x1ff116[_0x02c4('0x4d')],_0x17ec9f);}_0x1ff116=_[_0x02c4('0x50')]({},_0x1ff116,_0x3085ac['options']);return db[_0x02c4('0x9f')][_0x02c4('0x2b')]({'where':_0x1ff116[_0x02c4('0x4d')]})[_0x02c4('0x21')](function(_0x100b30){_0x18acaa['count']=_0x100b30;if(_0x3085ac[_0x02c4('0x44')]['includeAll']){_0x1ff116[_0x02c4('0x53')]=[{'all':!![]}];}return db['FaxMessage'][_0x02c4('0x54')](_0x1ff116);})[_0x02c4('0x21')](function(_0x55ae8b){_0x18acaa[_0x02c4('0x55')]=_0x55ae8b;return _0x18acaa;});}})['then'](respondWithFilteredResult(_0x1eb12c,_0x1ff116))[_0x02c4('0x56')](handleError(_0x1eb12c,null));};exports[_0x02c4('0xa3')]=function(_0x71c6d5,_0x4e132c,_0x5484b6){var _0x2f58ea,_0x460a17={},_0x3dd027;if(_0x71c6d5[_0x02c4('0x5a')]['to']){_0x3dd027=_0x71c6d5[_0x02c4('0x5a')]['to'][0x0];}return db[_0x02c4('0x3e')][_0x02c4('0x58')]({'where':{'id':_0x71c6d5[_0x02c4('0x60')]['id']},'include':[{'model':db[_0x02c4('0xa4')],'as':'List','include':[{'model':db[_0x02c4('0x71')],'as':_0x02c4('0xa5'),'where':{'fax':_0x3dd027},'limit':0x1,'order':[[_0x02c4('0x9a'),'DESC']]}]}]})[_0x02c4('0x21')](handleEntityNotFound(_0x4e132c,null))[_0x02c4('0x21')](function(_0x401d72){_0x2f58ea=_0x401d72;if(_0x71c6d5[_0x02c4('0x5a')]['attachments']&&_0x71c6d5['body'][_0x02c4('0xa6')][_0x02c4('0x49')]){for(var _0x18ef52=0x0;_0x18ef52<_0x71c6d5[_0x02c4('0x5a')]['attachments'][_0x02c4('0x49')];_0x18ef52+=0x1){_0x71c6d5[_0x02c4('0x5a')][_0x02c4('0xa6')][_0x18ef52]={'filename':_0x71c6d5[_0x02c4('0x5a')][_0x02c4('0xa6')][_0x18ef52]['name'],'id':_0x71c6d5[_0x02c4('0x5a')][_0x02c4('0xa6')][_0x18ef52]['id'],'path':path[_0x02c4('0xa7')](config[_0x02c4('0xa8')],_0x02c4('0xa9'),_0x71c6d5[_0x02c4('0x5a')]['attachments'][_0x18ef52][_0x02c4('0xaa')])};}}return respondWithRpcPromise(_0x02c4('0xab'),_0x02c4('0xab'),{'FaxAccountId':_[_0x02c4('0xac')](_0x71c6d5[_0x02c4('0x60')]['id'])?undefined:_0x71c6d5['params']['id'],'path':_[_0x02c4('0xac')](_0x71c6d5[_0x02c4('0x5a')][_0x02c4('0xa6')][0x0][_0x02c4('0xad')])?undefined:_0x71c6d5['body'][_0x02c4('0xa6')][0x0]['path'],'fax':_[_0x02c4('0xac')](_0x71c6d5[_0x02c4('0x5a')]['to'][0x0])?undefined:_0x71c6d5[_0x02c4('0x5a')]['to'][0x0]},client9002);})['then'](function(){if(_0x2f58ea){if(_[_0x02c4('0xac')](_0x71c6d5[_0x02c4('0x5a')]['from'])){_0x71c6d5[_0x02c4('0x5a')]['from']=util['format'](_0x02c4('0xae'),_0x2f58ea['name'],_0x2f58ea[_0x02c4('0xaf')]);}if(_0x2f58ea[_0x02c4('0xb0')]){if(_0x2f58ea[_0x02c4('0xb0')][_0x02c4('0xa5')][_0x02c4('0x49')]){return _0x2f58ea['List'][_0x02c4('0xa5')][0x0];}else{return db[_0x02c4('0x71')][_0x02c4('0x59')](_[_0x02c4('0x16')](_0x71c6d5[_0x02c4('0x5a')],{'firstName':_0x71c6d5[_0x02c4('0x5a')]['to'][0x0],'phone':_0x71c6d5[_0x02c4('0x5a')]['to'][0x0],'fax':_0x71c6d5[_0x02c4('0x5a')]['to'][0x0],'ListId':_0x2f58ea['ListId']}));}}else{throw new Error(_0x02c4('0xb1'));}}else{throw new Error('Send\x20Fax\x20failed');}})[_0x02c4('0x21')](function(_0x3e9870){if(_0x3e9870){return db['FaxInteraction'][_0x02c4('0x58')]({'where':{'ContactId':_0x3e9870['id'],'closed':![],'FaxAccountId':_0x2f58ea['id']}})[_0x02c4('0x21')](function(_0x1a939c){if(_0x1a939c){return[_0x1a939c,![]];}return db[_0x02c4('0x6e')]['create']({'UserId':_0x71c6d5[_0x02c4('0x5b')]['id'],'ContactId':_0x3e9870['id'],'FaxAccountId':_0x2f58ea['id'],'fax':_0x71c6d5[_0x02c4('0x5a')]['to'][0x0],'firstMsgDirection':_0x02c4('0xb2'),'Messages':[_[_0x02c4('0x50')](_0x71c6d5[_0x02c4('0x5a')],{'read':![],'body':_0x71c6d5[_0x02c4('0x5a')][_0x02c4('0xa6')][0x0][_0x02c4('0xb3')],'FaxAccountId':_0x2f58ea['id'],'UserId':_0x71c6d5[_0x02c4('0x5b')]['id'],'ContactId':_0x3e9870['id'],'AttachmentId':_0x71c6d5[_0x02c4('0x5a')][_0x02c4('0xa6')][0x0]['id']})]},{'include':[{'model':db['FaxMessage'],'as':_0x02c4('0xb4')}]})[_0x02c4('0x21')](function(_0x4a6f90){return[_0x4a6f90,!![]];});});}else{throw new Error(_0x02c4('0xb5'));}})[_0x02c4('0xb6')](function(_0x5a6bac,_0x539d5e){if(_0x539d5e){return _0x5a6bac;}return db['FaxMessage'][_0x02c4('0x59')]({'direction':_0x02c4('0xb2'),'read':![],'body':_0x71c6d5[_0x02c4('0x5a')][_0x02c4('0xa6')][0x0][_0x02c4('0xb3')],'FaxAccountId':_0x2f58ea['id'],'FaxInteractionId':_0x5a6bac['id'],'UserId':_0x71c6d5['user']['id'],'ContactId':_0x5a6bac['ContactId'],'AttachmentId':_0x71c6d5[_0x02c4('0x5a')][_0x02c4('0xa6')][0x0]['id']})[_0x02c4('0x21')](function(_0x424c38){_0x5a6bac['dataValues']['Messages']=[];_0x5a6bac[_0x02c4('0xb7')]['Messages'][_0x02c4('0x86')](_0x424c38[_0x02c4('0xb7')]);return _0x5a6bac;});})['then'](function(_0x53949e){respondWithRpcPromise(_0x02c4('0xb8'),'SendFax',{'FaxAccountId':_[_0x02c4('0xac')](_0x71c6d5[_0x02c4('0x60')]['id'])?undefined:_0x71c6d5[_0x02c4('0x60')]['id'],'path':_[_0x02c4('0xac')](_0x71c6d5[_0x02c4('0x5a')][_0x02c4('0xa6')][0x0][_0x02c4('0xad')])?undefined:_0x71c6d5[_0x02c4('0x5a')]['attachments'][0x0][_0x02c4('0xad')],'fax':_['isNil'](_0x71c6d5[_0x02c4('0x5a')]['to'][0x0])?undefined:_0x71c6d5[_0x02c4('0x5a')]['to'][0x0],'AttachmentId':_0x71c6d5['body']['attachments'][0x0]['id']},client9002)['then'](function(_0x3a6df8){logger[_0x02c4('0x22')]('SendFaxRpc,\x20%s',_0x3a6df8);})[_0x02c4('0x56')](function(_0x241a77){logger[_0x02c4('0x22')]('SendFaxRpc,\x20%s',_0x241a77);});return _0x53949e;})[_0x02c4('0x21')](respondWithResult(_0x4e132c,null))[_0x02c4('0x56')](handleError(_0x4e132c,null));};exports['addAgents']=function(_0x241e4a,_0x4ab51b,_0x959425){return db[_0x02c4('0x3e')][_0x02c4('0x58')]({'where':{'id':_0x241e4a[_0x02c4('0x60')]['id']}})[_0x02c4('0x21')](handleEntityNotFound(_0x4ab51b,null))[_0x02c4('0x21')](function(_0x2860ea){if(_0x2860ea){return _0x2860ea['addAgents'](_0x241e4a['body'][_0x02c4('0x6c')],_['omit'](_0x241e4a[_0x02c4('0x5a')],[_0x02c4('0x6c'),'id'])||{})['spread'](function(_0x2d8cff){for(var _0x4c8fb3=0x0;_0x4c8fb3<_0x241e4a['body'][_0x02c4('0x6c')][_0x02c4('0x49')];_0x4c8fb3+=0x1){socket[_0x02c4('0xb9')](_0x02c4('0xba'),{'UserId':_0x241e4a[_0x02c4('0x5a')][_0x02c4('0x6c')][_0x4c8fb3],'FaxAccountId':_0x241e4a[_0x02c4('0x60')]['id']});}return _0x2d8cff;});}})[_0x02c4('0x21')](respondWithResult(_0x4ab51b,null))[_0x02c4('0x56')](handleError(_0x4ab51b,null));};exports[_0x02c4('0xbb')]=function(_0x12e0e7,_0x25f9ce,_0x9c2e42){return db[_0x02c4('0x3e')]['find']({'where':{'id':_0x12e0e7[_0x02c4('0x60')]['id']}})['then'](handleEntityNotFound(_0x25f9ce,null))[_0x02c4('0x21')](function(_0x29c646){if(_0x29c646){return _0x29c646[_0x02c4('0xbb')](_0x12e0e7[_0x02c4('0x44')][_0x02c4('0x6c')])[_0x02c4('0x21')](function(){if(_[_0x02c4('0xbc')](_0x12e0e7[_0x02c4('0x44')]['ids'])){for(var _0xa7f06a=0x0;_0xa7f06a<_0x12e0e7[_0x02c4('0x44')][_0x02c4('0x6c')][_0x02c4('0x49')];_0xa7f06a+=0x1){socket[_0x02c4('0xb9')]('userFaxAccount:remove',{'UserId':Number(_0x12e0e7[_0x02c4('0x44')][_0x02c4('0x6c')][_0xa7f06a]),'FaxAccountId':Number(_0x12e0e7[_0x02c4('0x60')]['id'])});}}else{socket[_0x02c4('0xb9')](_0x02c4('0xbd'),{'UserId':Number(_0x12e0e7[_0x02c4('0x44')][_0x02c4('0x6c')]),'FaxAccountId':Number(_0x12e0e7[_0x02c4('0x60')]['id'])});}});}})[_0x02c4('0x21')](respondWithStatusCode(_0x25f9ce,null))[_0x02c4('0x56')](handleError(_0x25f9ce,null));};exports[_0x02c4('0xbe')]=function(_0xea6feb,_0x18dbe8,_0x29bf22){var _0x590520={};var _0x13f5d2={};var _0x52e147;var _0x4063a4;return db[_0x02c4('0x3e')][_0x02c4('0x64')]({'where':{'id':_0xea6feb[_0x02c4('0x60')]['id']}})[_0x02c4('0x21')](handleEntityNotFound(_0x18dbe8,null))[_0x02c4('0x21')](function(_0x5479a9){if(_0x5479a9){_0x52e147=_0x5479a9;_0x13f5d2[_0x02c4('0x43')]=_[_0x02c4('0x45')](db[_0x02c4('0x72')]['rawAttributes']);_0x13f5d2[_0x02c4('0x44')]=_[_0x02c4('0x45')](_0xea6feb[_0x02c4('0x44')]);_0x13f5d2[_0x02c4('0x46')]=_[_0x02c4('0x57')](_0x13f5d2[_0x02c4('0x43')],_0x13f5d2[_0x02c4('0x44')]);_0x590520[_0x02c4('0x47')]=_[_0x02c4('0x57')](_0x13f5d2[_0x02c4('0x43')],qs[_0x02c4('0x48')](_0xea6feb[_0x02c4('0x44')][_0x02c4('0x48')]));_0x590520[_0x02c4('0x47')]=_0x590520[_0x02c4('0x47')][_0x02c4('0x49')]?_0x590520[_0x02c4('0x47')]:_0x13f5d2[_0x02c4('0x43')];_0x590520[_0x02c4('0x4b')]=qs['sort'](_0xea6feb[_0x02c4('0x44')][_0x02c4('0x4c')]);_0x590520[_0x02c4('0x4d')]=qs['filters'](_['pick'](_0xea6feb[_0x02c4('0x44')],_0x13f5d2[_0x02c4('0x46')]));if(_0xea6feb[_0x02c4('0x44')][_0x02c4('0x4f')]){_0x590520[_0x02c4('0x4d')]=_['merge'](_0x590520['where'],{'$or':_[_0x02c4('0x3d')](_0x590520[_0x02c4('0x47')],function(_0x34397c){var _0x33e4b2={};_0x33e4b2[_0x34397c]={'$like':'%'+_0xea6feb[_0x02c4('0x44')][_0x02c4('0x4f')]+'%'};return _0x33e4b2;})});}_0x590520=_['merge']({},_0x590520,_0xea6feb['options']);return _0x52e147[_0x02c4('0xbe')](_0x590520);}})[_0x02c4('0x21')](function(_0x30fd03){if(_0x30fd03){_0x4063a4=_0x30fd03['length'];if(!_0xea6feb[_0x02c4('0x44')]['hasOwnProperty']('nolimit')){_0x590520['limit']=qs[_0x02c4('0x2d')](_0xea6feb[_0x02c4('0x44')][_0x02c4('0x2d')]);_0x590520[_0x02c4('0x2c')]=qs['offset'](_0xea6feb['query'][_0x02c4('0x2c')]);}return _0x52e147[_0x02c4('0xbe')](_0x590520);}})[_0x02c4('0x21')](function(_0x4683e9){if(_0x4683e9){return _0x4683e9?{'count':_0x4063a4,'rows':_0x4683e9}:null;}})[_0x02c4('0x21')](respondWithResult(_0x18dbe8,null))[_0x02c4('0x56')](handleError(_0x18dbe8,null));}; \ No newline at end of file diff --git a/server/api/faxAccount/faxAccount.events.js b/server/api/faxAccount/faxAccount.events.js index 53cfd56..0108735 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 _0x331f=['events','../../mysqldb','update','remove','emit','hasOwnProperty'];(function(_0x47aa64,_0xfb8a07){var _0x549c7a=function(_0x266165){while(--_0x266165){_0x47aa64['push'](_0x47aa64['shift']());}};_0x549c7a(++_0xfb8a07);}(_0x331f,0xc6));var _0xf331=function(_0x25a214,_0x59edf8){_0x25a214=_0x25a214-0x0;var _0x3180ea=_0x331f[_0x25a214];return _0x3180ea;};'use strict';var EventEmitter=require(_0xf331('0x0'));var FaxAccount=require(_0xf331('0x1'))['db']['FaxAccount'];var FaxAccountEvents=new EventEmitter();FaxAccountEvents['setMaxListeners'](0x0);var events={'afterCreate':'save','afterUpdate':_0xf331('0x2'),'afterDestroy':_0xf331('0x3')};function emitEvent(_0x3c9cc0){return function(_0x22b98c,_0x496093,_0x33406c){FaxAccountEvents[_0xf331('0x4')](_0x3c9cc0+':'+_0x22b98c['id'],_0x22b98c);FaxAccountEvents['emit'](_0x3c9cc0,_0x22b98c);_0x33406c(null);};}for(var e in events){if(events[_0xf331('0x5')](e)){var event=events[e];FaxAccount['hook'](e,emitEvent(event));}}module['exports']=FaxAccountEvents; \ No newline at end of file +var _0xd243=['FaxAccount','setMaxListeners','save','update','remove','emit','hook','exports','events'];(function(_0x150404,_0x376ac8){var _0x3f4762=function(_0x484683){while(--_0x484683){_0x150404['push'](_0x150404['shift']());}};_0x3f4762(++_0x376ac8);}(_0xd243,0xaa));var _0x3d24=function(_0x4bb23d,_0x506de2){_0x4bb23d=_0x4bb23d-0x0;var _0x257161=_0xd243[_0x4bb23d];return _0x257161;};'use strict';var EventEmitter=require(_0x3d24('0x0'));var FaxAccount=require('../../mysqldb')['db'][_0x3d24('0x1')];var FaxAccountEvents=new EventEmitter();FaxAccountEvents[_0x3d24('0x2')](0x0);var events={'afterCreate':_0x3d24('0x3'),'afterUpdate':_0x3d24('0x4'),'afterDestroy':_0x3d24('0x5')};function emitEvent(_0x32c45f){return function(_0x2a8f5e,_0x3ca0a8,_0x4b106d){FaxAccountEvents['emit'](_0x32c45f+':'+_0x2a8f5e['id'],_0x2a8f5e);FaxAccountEvents[_0x3d24('0x6')](_0x32c45f,_0x2a8f5e);_0x4b106d(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];FaxAccount[_0x3d24('0x7')](e,emitEvent(event));}}module[_0x3d24('0x8')]=FaxAccountEvents; \ No newline at end of file diff --git a/server/api/faxAccount/faxAccount.model.js b/server/api/faxAccount/faxAccount.model.js index f3aab8d..19d151e 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 _0xd80b=['define','fax_accounts','util','../../config/logger','api','moment','bluebird','request-promise','path','../../config/environment'];(function(_0xa25ca7,_0x124626){var _0x29ff0a=function(_0x116828){while(--_0x116828){_0xa25ca7['push'](_0xa25ca7['shift']());}};_0x29ff0a(++_0x124626);}(_0xd80b,0xca));var _0xbd80=function(_0x36725f,_0x5a4bbe){_0x36725f=_0x36725f-0x0;var _0xe5cdcb=_0xd80b[_0x36725f];return _0xe5cdcb;};'use strict';var _=require('lodash');var util=require(_0xbd80('0x0'));var logger=require(_0xbd80('0x1'))(_0xbd80('0x2'));var moment=require(_0xbd80('0x3'));var BPromise=require(_0xbd80('0x4'));var rp=require(_0xbd80('0x5'));var fs=require('fs');var path=require(_0xbd80('0x6'));var rimraf=require('rimraf');var config=require(_0xbd80('0x7'));var attributes=require('./faxAccount.attributes');module['exports']=function(_0x1fbea1,_0x58992b){return _0x1fbea1[_0xbd80('0x8')]('FaxAccount',attributes,{'tableName':_0xbd80('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x0edd=['../../config/environment','./faxAccount.attributes','exports','define','FaxAccount','fax_accounts','lodash','util','api','moment','request-promise','path','rimraf'];(function(_0x3b2c2d,_0x234b54){var _0x41e26c=function(_0x453613){while(--_0x453613){_0x3b2c2d['push'](_0x3b2c2d['shift']());}};_0x41e26c(++_0x234b54);}(_0x0edd,0x1b3));var _0xd0ed=function(_0x6c993a,_0x5ea3ab){_0x6c993a=_0x6c993a-0x0;var _0x27f547=_0x0edd[_0x6c993a];return _0x27f547;};'use strict';var _=require(_0xd0ed('0x0'));var util=require(_0xd0ed('0x1'));var logger=require('../../config/logger')(_0xd0ed('0x2'));var moment=require(_0xd0ed('0x3'));var BPromise=require('bluebird');var rp=require(_0xd0ed('0x4'));var fs=require('fs');var path=require(_0xd0ed('0x5'));var rimraf=require(_0xd0ed('0x6'));var config=require(_0xd0ed('0x7'));var attributes=require(_0xd0ed('0x8'));module[_0xd0ed('0x9')]=function(_0x5cbd0b,_0x3d10e2){return _0x5cbd0b[_0xd0ed('0xa')](_0xd0ed('0xb'),attributes,{'tableName':_0xd0ed('0xc'),'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 8b8e674..6a851df 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 _0xa1f3=['created','interaction','FaxMessage','ContactId','AttachmentId','UserId','User','name','unshift','agent','waitForTheAssignedAgent','Start','startRouting','util','moment','bluebird','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','redis','localhost','socket.io-emitter','./faxAccount.socket','request','then','info','FaxAccount,\x20%s,\x20%s','request\x20sent','debug','FaxAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','GetFaxAccount','findAll','options','where','attributes','include','map','model','catch','NotifyFaxAccount','body','fax','CmContact','describe','Sequelize','no\x20available\x20attributes','difference','keys','createdAt','updatedAt','ListId','isNil','from','ValidationError','mapKey','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','find','account','List','Contacts','DESC','FaxApplication','Applications','get','applications','list','orderBy','priority','asc','create','contact','FaxInteraction','Contact\x20not\x20found','spread','autoclose','push','length','unmanaged','*,*,*,*'];(function(_0x34f0a0,_0x416020){var _0x362291=function(_0x5ac72b){while(--_0x5ac72b){_0x34f0a0['push'](_0x34f0a0['shift']());}};_0x362291(++_0x416020);}(_0xa1f3,0x16d));var _0x3a1f=function(_0x4565bf,_0x5ad9d6){_0x4565bf=_0x4565bf-0x0;var _0x5610ba=_0xa1f3[_0x4565bf];return _0x5610ba;};'use strict';var _=require('lodash');var util=require(_0x3a1f('0x0'));var moment=require(_0x3a1f('0x1'));var BPromise=require(_0x3a1f('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x3a1f('0x3'))['db'];var utils=require(_0x3a1f('0x4'));var logger=require(_0x3a1f('0x5'))('rpc');var config=require(_0x3a1f('0x6'));var jayson=require(_0x3a1f('0x7'));var client=jayson[_0x3a1f('0x8')][_0x3a1f('0x9')]({'port':0x232c});config[_0x3a1f('0xa')]=_['defaults'](config[_0x3a1f('0xa')],{'host':_0x3a1f('0xb'),'port':0x18eb});var socket=require(_0x3a1f('0xc'))(new Redis(config[_0x3a1f('0xa')]));require(_0x3a1f('0xd'))['register'](socket);function respondWithRpcPromise(_0x508a6b,_0x1e7e7b,_0x40fce4){return new BPromise(function(_0x1da9f9,_0x2ad68a){return client[_0x3a1f('0xe')](_0x508a6b,_0x40fce4)[_0x3a1f('0xf')](function(_0x41f449){logger[_0x3a1f('0x10')](_0x3a1f('0x11'),_0x1e7e7b,_0x3a1f('0x12'));logger[_0x3a1f('0x13')](_0x3a1f('0x14'),_0x1e7e7b,_0x3a1f('0x12'),JSON[_0x3a1f('0x15')](_0x41f449));if(_0x41f449[_0x3a1f('0x16')]){if(_0x41f449[_0x3a1f('0x16')][_0x3a1f('0x17')]===0x1f4){logger[_0x3a1f('0x16')](_0x3a1f('0x11'),_0x1e7e7b,_0x41f449[_0x3a1f('0x16')][_0x3a1f('0x18')]);return _0x2ad68a(_0x41f449[_0x3a1f('0x16')][_0x3a1f('0x18')]);}logger['error']('FaxAccount,\x20%s,\x20%s',_0x1e7e7b,_0x41f449[_0x3a1f('0x16')]['message']);return _0x1da9f9(_0x41f449['error'][_0x3a1f('0x18')]);}else{logger[_0x3a1f('0x10')](_0x3a1f('0x11'),_0x1e7e7b,_0x3a1f('0x12'));_0x1da9f9(_0x41f449[_0x3a1f('0x19')][_0x3a1f('0x18')]);}})['catch'](function(_0x17a4bb){logger[_0x3a1f('0x16')](_0x3a1f('0x11'),_0x1e7e7b,_0x17a4bb);_0x2ad68a(_0x17a4bb);});});}exports[_0x3a1f('0x1a')]=function(_0x243559){var _0x1dac4b=this;return new Promise(function(_0x528704,_0x5882a4){return db['FaxAccount'][_0x3a1f('0x1b')]({'raw':_0x243559[_0x3a1f('0x1c')]?_0x243559['options']['raw']===undefined?!![]:![]:!![],'where':_0x243559[_0x3a1f('0x1c')]?_0x243559['options'][_0x3a1f('0x1d')]||null:null,'attributes':_0x243559[_0x3a1f('0x1c')]?_0x243559[_0x3a1f('0x1c')][_0x3a1f('0x1e')]||null:null,'limit':_0x243559['options']?_0x243559[_0x3a1f('0x1c')]['limit']||null:null,'include':_0x243559[_0x3a1f('0x1c')]?_0x243559[_0x3a1f('0x1c')][_0x3a1f('0x1f')]?_[_0x3a1f('0x20')](_0x243559['options'][_0x3a1f('0x1f')],function(_0x2f8a0b){return{'model':db[_0x2f8a0b['model']],'as':_0x2f8a0b['as'],'attributes':_0x2f8a0b['attributes'],'include':_0x2f8a0b[_0x3a1f('0x1f')]?_[_0x3a1f('0x20')](_0x2f8a0b[_0x3a1f('0x1f')],function(_0x42fb4e){return{'model':db[_0x42fb4e['model']],'as':_0x42fb4e['as'],'attributes':_0x42fb4e[_0x3a1f('0x1e')],'include':_0x42fb4e[_0x3a1f('0x1f')]?_[_0x3a1f('0x20')](_0x42fb4e[_0x3a1f('0x1f')],function(_0x35c59a){return{'model':db[_0x35c59a[_0x3a1f('0x21')]],'as':_0x35c59a['as'],'attributes':_0x35c59a[_0x3a1f('0x1e')]};}):[]};}):[]};}):[]:[]})[_0x3a1f('0xf')](function(_0x3539c8){logger['info'](_0x3a1f('0x1a'),_0x243559);logger[_0x3a1f('0x13')](_0x3a1f('0x1a'),_0x243559,JSON['stringify'](_0x3539c8));_0x528704(_0x3539c8);})[_0x3a1f('0x22')](function(_0x429f2c){logger[_0x3a1f('0x16')](_0x3a1f('0x1a'),_0x429f2c[_0x3a1f('0x18')],_0x243559);_0x5882a4(_0x1dac4b[_0x3a1f('0x16')](0x1f4,_0x429f2c['message']));});});};exports[_0x3a1f('0x23')]=function(_0xa8b3a1,_0x12ed1a,_0x551397){var _0x16a73c=this;return new Promise(function(_0x4144e7,_0x2f360a){var _0x43554c={'body':_0xa8b3a1[_0x3a1f('0x24')],'channel':_0x3a1f('0x25')};var _0x2224c7=[];var _0xc9efe0=[];var _0x4997de={};return db[_0x3a1f('0x26')][_0x3a1f('0x27')]()[_0x3a1f('0xf')](function(_0x42e247){if(!_0x42e247){throw new db[(_0x3a1f('0x28'))]['ValidationError'](_0x3a1f('0x29'));}_0x2224c7=_[_0x3a1f('0x2a')](_[_0x3a1f('0x2b')](_0x42e247),[_0x3a1f('0x2c'),'updatedAt']);_0xc9efe0=_[_0x3a1f('0x2a')](_[_0x3a1f('0x2b')](_0x42e247),[_0x3a1f('0x2c'),_0x3a1f('0x2d'),'CompanyId',_0x3a1f('0x2e')]);if(_0xa8b3a1[_0x3a1f('0x24')]['id']){delete _0xa8b3a1['body']['id'];}if(_[_0x3a1f('0x2f')](_0xa8b3a1['body'][_0x3a1f('0x30')])){throw new db['Sequelize'][(_0x3a1f('0x31'))]('from\x20is\x20mandatory');}if(_[_0x3a1f('0x2f')](_0xa8b3a1['body'][_0x3a1f('0x24')])||_0xa8b3a1[_0x3a1f('0x24')][_0x3a1f('0x24')]===''){throw new db[(_0x3a1f('0x28'))][(_0x3a1f('0x31'))]('body\x20is\x20mandatory\x20and\x20not\x20empty');}if(_[_0x3a1f('0x2f')](_0xa8b3a1[_0x3a1f('0x24')][_0x3a1f('0x32')])){throw new db[(_0x3a1f('0x28'))]['ValidationError'](_0x3a1f('0x33')+_0xc9efe0);}if(!_['includes'](_0xc9efe0,_0xa8b3a1[_0x3a1f('0x24')]['mapKey'])){throw new db[(_0x3a1f('0x28'))][(_0x3a1f('0x31'))]('mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20'+_0xc9efe0);}_0x4997de[_0xa8b3a1[_0x3a1f('0x24')]['mapKey']]=_0xa8b3a1['body'][_0x3a1f('0x30')];})[_0x3a1f('0xf')](function(){return db['FaxAccount'][_0x3a1f('0x34')]({'where':{'id':_0xa8b3a1[_0x3a1f('0x35')]['id']},'include':[{'model':db['CmList'],'as':_0x3a1f('0x36'),'include':[{'model':db['CmContact'],'as':_0x3a1f('0x37'),'where':_0x4997de,'limit':0x1,'order':[['updatedAt',_0x3a1f('0x38')]]}]},{'model':db[_0x3a1f('0x39')],'as':_0x3a1f('0x3a')}]});})[_0x3a1f('0xf')](function(_0x508b75){if(_0x508b75&&_0x508b75[_0x3a1f('0x36')]){var _0x582ac8=_0x508b75[_0x3a1f('0x3b')]({'plain':!![]});_0x43554c['account']=_0x582ac8;_0x43554c[_0x3a1f('0x3c')]=_0x582ac8[_0x3a1f('0x3a')];_0x43554c[_0x3a1f('0x3d')]=_0x582ac8[_0x3a1f('0x36')];_0x43554c[_0x3a1f('0x3c')]=_[_0x3a1f('0x3e')](_0x43554c[_0x3a1f('0x3c')],[_0x3a1f('0x3f')],[_0x3a1f('0x40')]);if(_0x43554c['account']['Applications']){delete _0x43554c[_0x3a1f('0x35')][_0x3a1f('0x3a')];}if(_0x43554c[_0x3a1f('0x35')][_0x3a1f('0x36')]&&_0x43554c[_0x3a1f('0x35')][_0x3a1f('0x36')][_0x3a1f('0x37')]['length']){return _0x43554c[_0x3a1f('0x35')]['List'][_0x3a1f('0x37')][0x0];}var _0x23ec27=_['defaults'](_0xa8b3a1[_0x3a1f('0x24')],{'firstName':_0xa8b3a1['body'][_0x3a1f('0x30')],'ListId':_0x582ac8[_0x3a1f('0x2e')]});_0x23ec27[_0xa8b3a1['body'][_0x3a1f('0x32')]]=_0xa8b3a1['body'][_0x3a1f('0x30')];return db[_0x3a1f('0x26')][_0x3a1f('0x41')](_0x23ec27,{'fields':_0x2224c7,'raw':!![]});}})['then'](function(_0x5c5664){_0x43554c[_0x3a1f('0x42')]=_0x5c5664;if(_0x5c5664){var _0x2c6ba0={'ContactId':_0x5c5664['id'],'FaxAccountId':_0xa8b3a1['account']['id'],'fax':_0x5c5664['fax']};return db[_0x3a1f('0x43')][_0x3a1f('0x34')]({'where':{'ContactId':_0x5c5664['id'],'closed':![],'FaxAccountId':_0xa8b3a1['account']['id']}})[_0x3a1f('0xf')](function(_0xf82cc){if(_0xf82cc){return[_0xf82cc,![]];}return db[_0x3a1f('0x43')][_0x3a1f('0x41')](_0x2c6ba0)[_0x3a1f('0xf')](function(_0x50a333){return[_0x50a333,!![]];});});}else{throw new Error(_0x3a1f('0x44'));}})[_0x3a1f('0x45')](function(_0x201043,_0x5a9fa8){var _0x3d503c=_0x201043[_0x3a1f('0x3b')]({'plain':!![]});if(_0x5a9fa8){if(_0x43554c[_0x3a1f('0x35')][_0x3a1f('0x46')]){_0x43554c['applications'][_0x3a1f('0x47')]({'id':0x0,'priority':_0x43554c[_0x3a1f('0x3c')][_0x3a1f('0x48')]+0x1,'app':'close','appdata':_0x3a1f('0x49'),'interval':_0x3a1f('0x4a')});}_0x3d503c[_0x3a1f('0x4b')]=!![];}else{_0x3d503c[_0x3a1f('0x4b')]=![];}_0x43554c[_0x3a1f('0x4c')]=_0x3d503c;return db[_0x3a1f('0x4d')][_0x3a1f('0x41')]({'body':_0xa8b3a1['body'][_0x3a1f('0x24')],'FaxAccountId':_0xa8b3a1[_0x3a1f('0x35')]['id'],'FaxInteractionId':_0x201043['id'],'direction':'in','ContactId':_0x201043[_0x3a1f('0x4e')],'AttachmentId':_0xa8b3a1[_0x3a1f('0x24')][_0x3a1f('0x4f')]});})['then'](function(_0x23ae04){_0x43554c[_0x3a1f('0x18')]=_0x23ae04;if(_0x43554c[_0x3a1f('0x4c')][_0x3a1f('0x50')]){return db[_0x3a1f('0x51')][_0x3a1f('0x34')]({'attributes':['id',_0x3a1f('0x52')],'where':{'id':_0x43554c[_0x3a1f('0x4c')]['UserId']}})[_0x3a1f('0xf')](function(_0x249d51){if(_0x249d51){_0x43554c[_0x3a1f('0x3c')][_0x3a1f('0x53')]({'id':0x0,'priority':0x0,'app':_0x3a1f('0x54'),'appdata':_0x249d51[_0x3a1f('0x52')]+','+(_0x43554c[_0x3a1f('0x35')][_0x3a1f('0x55')]||0xa),'interval':_0x3a1f('0x4a')});}return respondWithRpcPromise(_0x3a1f('0x56'),_0x3a1f('0x57'),_0x43554c);});}return respondWithRpcPromise(_0x3a1f('0x56'),'startRouting',_0x43554c);})[_0x3a1f('0xf')](function(_0x5a5b09){_0x4144e7(_0x5a5b09);})['catch'](function(_0x4eb10b){_0x2f360a(_0x16a73c[_0x3a1f('0x16')](0x1f4,_0x4eb10b[_0x3a1f('0x18')]));});});}; \ No newline at end of file +var _0xd8d2=['bluebird','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','./faxAccount.socket','FaxAccount,\x20%s,\x20%s','request\x20sent','debug','FaxAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','catch','GetFaxAccount','findAll','options','where','include','map','attributes','model','then','NotifyFaxAccount','body','fax','CmContact','describe','Sequelize','ValidationError','keys','updatedAt','createdAt','CompanyId','isNil','from','from\x20is\x20mandatory','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','includes','FaxAccount','find','account','Contacts','DESC','FaxApplication','List','applications','Applications','list','orderBy','asc','length','ListId','create','FaxInteraction','Contact\x20not\x20found','spread','get','autoclose','close','unmanaged','*,*,*,*','created','interaction','FaxMessage','ContactId','AttachmentId','UserId','name','unshift','agent','waitForTheAssignedAgent','startRouting','lodash','moment'];(function(_0x3cb4c5,_0xb7be04){var _0x3042d4=function(_0x4f99d5){while(--_0x4f99d5){_0x3cb4c5['push'](_0x3cb4c5['shift']());}};_0x3042d4(++_0xb7be04);}(_0xd8d2,0x103));var _0x2d8d=function(_0x20c664,_0x317fce){_0x20c664=_0x20c664-0x0;var _0x49978f=_0xd8d2[_0x20c664];return _0x49978f;};'use strict';var _=require(_0x2d8d('0x0'));var util=require('util');var moment=require(_0x2d8d('0x1'));var BPromise=require(_0x2d8d('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x2d8d('0x3'));var db=require(_0x2d8d('0x4'))['db'];var utils=require(_0x2d8d('0x5'));var logger=require('../../config/logger')(_0x2d8d('0x6'));var config=require(_0x2d8d('0x7'));var jayson=require(_0x2d8d('0x8'));var client=jayson[_0x2d8d('0x9')][_0x2d8d('0xa')]({'port':0x232c});config[_0x2d8d('0xb')]=_[_0x2d8d('0xc')](config[_0x2d8d('0xb')],{'host':_0x2d8d('0xd'),'port':0x18eb});var socket=require(_0x2d8d('0xe'))(new Redis(config['redis']));require(_0x2d8d('0xf'))['register'](socket);function respondWithRpcPromise(_0x1f0bf9,_0x5e4387,_0xb829aa){return new BPromise(function(_0x78c095,_0xbad4f1){return client['request'](_0x1f0bf9,_0xb829aa)['then'](function(_0x394758){logger['info'](_0x2d8d('0x10'),_0x5e4387,_0x2d8d('0x11'));logger[_0x2d8d('0x12')](_0x2d8d('0x13'),_0x5e4387,'request\x20sent',JSON[_0x2d8d('0x14')](_0x394758));if(_0x394758[_0x2d8d('0x15')]){if(_0x394758[_0x2d8d('0x15')][_0x2d8d('0x16')]===0x1f4){logger['error'](_0x2d8d('0x10'),_0x5e4387,_0x394758[_0x2d8d('0x15')][_0x2d8d('0x17')]);return _0xbad4f1(_0x394758[_0x2d8d('0x15')][_0x2d8d('0x17')]);}logger[_0x2d8d('0x15')]('FaxAccount,\x20%s,\x20%s',_0x5e4387,_0x394758[_0x2d8d('0x15')][_0x2d8d('0x17')]);return _0x78c095(_0x394758[_0x2d8d('0x15')]['message']);}else{logger[_0x2d8d('0x18')](_0x2d8d('0x10'),_0x5e4387,_0x2d8d('0x11'));_0x78c095(_0x394758['result'][_0x2d8d('0x17')]);}})[_0x2d8d('0x19')](function(_0xa7db7e){logger[_0x2d8d('0x15')](_0x2d8d('0x10'),_0x5e4387,_0xa7db7e);_0xbad4f1(_0xa7db7e);});});}exports[_0x2d8d('0x1a')]=function(_0x2d6b59){var _0x45bd04=this;return new Promise(function(_0xac90ab,_0x5523a1){return db['FaxAccount'][_0x2d8d('0x1b')]({'raw':_0x2d6b59[_0x2d8d('0x1c')]?_0x2d6b59[_0x2d8d('0x1c')]['raw']===undefined?!![]:![]:!![],'where':_0x2d6b59['options']?_0x2d6b59[_0x2d8d('0x1c')][_0x2d8d('0x1d')]||null:null,'attributes':_0x2d6b59[_0x2d8d('0x1c')]?_0x2d6b59[_0x2d8d('0x1c')]['attributes']||null:null,'limit':_0x2d6b59[_0x2d8d('0x1c')]?_0x2d6b59[_0x2d8d('0x1c')]['limit']||null:null,'include':_0x2d6b59[_0x2d8d('0x1c')]?_0x2d6b59[_0x2d8d('0x1c')][_0x2d8d('0x1e')]?_[_0x2d8d('0x1f')](_0x2d6b59[_0x2d8d('0x1c')][_0x2d8d('0x1e')],function(_0x3f6560){return{'model':db[_0x3f6560['model']],'as':_0x3f6560['as'],'attributes':_0x3f6560[_0x2d8d('0x20')],'include':_0x3f6560['include']?_[_0x2d8d('0x1f')](_0x3f6560['include'],function(_0x33d899){return{'model':db[_0x33d899[_0x2d8d('0x21')]],'as':_0x33d899['as'],'attributes':_0x33d899[_0x2d8d('0x20')],'include':_0x33d899[_0x2d8d('0x1e')]?_['map'](_0x33d899[_0x2d8d('0x1e')],function(_0x4d8174){return{'model':db[_0x4d8174[_0x2d8d('0x21')]],'as':_0x4d8174['as'],'attributes':_0x4d8174[_0x2d8d('0x20')]};}):[]};}):[]};}):[]:[]})[_0x2d8d('0x22')](function(_0xe7e96e){logger['info'](_0x2d8d('0x1a'),_0x2d6b59);logger[_0x2d8d('0x12')](_0x2d8d('0x1a'),_0x2d6b59,JSON[_0x2d8d('0x14')](_0xe7e96e));_0xac90ab(_0xe7e96e);})[_0x2d8d('0x19')](function(_0x39bff6){logger[_0x2d8d('0x15')](_0x2d8d('0x1a'),_0x39bff6[_0x2d8d('0x17')],_0x2d6b59);_0x5523a1(_0x45bd04[_0x2d8d('0x15')](0x1f4,_0x39bff6[_0x2d8d('0x17')]));});});};exports[_0x2d8d('0x23')]=function(_0x587de7,_0x420190,_0x37cf97){var _0x103f9d=this;return new Promise(function(_0x1a7768,_0x4412c5){var _0x362bdb={'body':_0x587de7[_0x2d8d('0x24')],'channel':_0x2d8d('0x25')};var _0x1e268f=[];var _0x177110=[];var _0x4cc140={};return db[_0x2d8d('0x26')][_0x2d8d('0x27')]()[_0x2d8d('0x22')](function(_0x5600e3){if(!_0x5600e3){throw new db[(_0x2d8d('0x28'))][(_0x2d8d('0x29'))]('no\x20available\x20attributes');}_0x1e268f=_['difference'](_[_0x2d8d('0x2a')](_0x5600e3),['createdAt',_0x2d8d('0x2b')]);_0x177110=_['difference'](_[_0x2d8d('0x2a')](_0x5600e3),[_0x2d8d('0x2c'),_0x2d8d('0x2b'),_0x2d8d('0x2d'),'ListId']);if(_0x587de7[_0x2d8d('0x24')]['id']){delete _0x587de7['body']['id'];}if(_[_0x2d8d('0x2e')](_0x587de7[_0x2d8d('0x24')][_0x2d8d('0x2f')])){throw new db[(_0x2d8d('0x28'))][(_0x2d8d('0x29'))](_0x2d8d('0x30'));}if(_[_0x2d8d('0x2e')](_0x587de7[_0x2d8d('0x24')][_0x2d8d('0x24')])||_0x587de7['body'][_0x2d8d('0x24')]===''){throw new db[(_0x2d8d('0x28'))][(_0x2d8d('0x29'))](_0x2d8d('0x31'));}if(_[_0x2d8d('0x2e')](_0x587de7[_0x2d8d('0x24')][_0x2d8d('0x32')])){throw new db[(_0x2d8d('0x28'))]['ValidationError'](_0x2d8d('0x33')+_0x177110);}if(!_[_0x2d8d('0x34')](_0x177110,_0x587de7[_0x2d8d('0x24')][_0x2d8d('0x32')])){throw new db[(_0x2d8d('0x28'))][(_0x2d8d('0x29'))]('mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20'+_0x177110);}_0x4cc140[_0x587de7[_0x2d8d('0x24')][_0x2d8d('0x32')]]=_0x587de7[_0x2d8d('0x24')][_0x2d8d('0x2f')];})[_0x2d8d('0x22')](function(){return db[_0x2d8d('0x35')][_0x2d8d('0x36')]({'where':{'id':_0x587de7[_0x2d8d('0x37')]['id']},'include':[{'model':db['CmList'],'as':'List','include':[{'model':db[_0x2d8d('0x26')],'as':_0x2d8d('0x38'),'where':_0x4cc140,'limit':0x1,'order':[[_0x2d8d('0x2b'),_0x2d8d('0x39')]]}]},{'model':db[_0x2d8d('0x3a')],'as':'Applications'}]});})[_0x2d8d('0x22')](function(_0x2c3687){if(_0x2c3687&&_0x2c3687[_0x2d8d('0x3b')]){var _0x55a019=_0x2c3687['get']({'plain':!![]});_0x362bdb[_0x2d8d('0x37')]=_0x55a019;_0x362bdb[_0x2d8d('0x3c')]=_0x55a019[_0x2d8d('0x3d')];_0x362bdb[_0x2d8d('0x3e')]=_0x55a019[_0x2d8d('0x3b')];_0x362bdb[_0x2d8d('0x3c')]=_[_0x2d8d('0x3f')](_0x362bdb[_0x2d8d('0x3c')],['priority'],[_0x2d8d('0x40')]);if(_0x362bdb['account'][_0x2d8d('0x3d')]){delete _0x362bdb[_0x2d8d('0x37')][_0x2d8d('0x3d')];}if(_0x362bdb[_0x2d8d('0x37')][_0x2d8d('0x3b')]&&_0x362bdb[_0x2d8d('0x37')][_0x2d8d('0x3b')][_0x2d8d('0x38')][_0x2d8d('0x41')]){return _0x362bdb[_0x2d8d('0x37')][_0x2d8d('0x3b')][_0x2d8d('0x38')][0x0];}var _0x497c2c=_[_0x2d8d('0xc')](_0x587de7['body'],{'firstName':_0x587de7[_0x2d8d('0x24')]['from'],'ListId':_0x55a019[_0x2d8d('0x42')]});_0x497c2c[_0x587de7['body'][_0x2d8d('0x32')]]=_0x587de7['body'][_0x2d8d('0x2f')];return db[_0x2d8d('0x26')][_0x2d8d('0x43')](_0x497c2c,{'fields':_0x1e268f,'raw':!![]});}})[_0x2d8d('0x22')](function(_0xb3d8e9){_0x362bdb['contact']=_0xb3d8e9;if(_0xb3d8e9){var _0x1e37f8={'ContactId':_0xb3d8e9['id'],'FaxAccountId':_0x587de7[_0x2d8d('0x37')]['id'],'fax':_0xb3d8e9['fax']};return db[_0x2d8d('0x44')]['find']({'where':{'ContactId':_0xb3d8e9['id'],'closed':![],'FaxAccountId':_0x587de7[_0x2d8d('0x37')]['id']}})[_0x2d8d('0x22')](function(_0x58ed96){if(_0x58ed96){return[_0x58ed96,![]];}return db[_0x2d8d('0x44')]['create'](_0x1e37f8)['then'](function(_0x57dc4e){return[_0x57dc4e,!![]];});});}else{throw new Error(_0x2d8d('0x45'));}})[_0x2d8d('0x46')](function(_0x44cb74,_0x29aec7){var _0x2f06b0=_0x44cb74[_0x2d8d('0x47')]({'plain':!![]});if(_0x29aec7){if(_0x362bdb[_0x2d8d('0x37')][_0x2d8d('0x48')]){_0x362bdb[_0x2d8d('0x3c')]['push']({'id':0x0,'priority':_0x362bdb['applications'][_0x2d8d('0x41')]+0x1,'app':_0x2d8d('0x49'),'appdata':_0x2d8d('0x4a'),'interval':_0x2d8d('0x4b')});}_0x2f06b0['created']=!![];}else{_0x2f06b0[_0x2d8d('0x4c')]=![];}_0x362bdb[_0x2d8d('0x4d')]=_0x2f06b0;return db[_0x2d8d('0x4e')][_0x2d8d('0x43')]({'body':_0x587de7['body'][_0x2d8d('0x24')],'FaxAccountId':_0x587de7[_0x2d8d('0x37')]['id'],'FaxInteractionId':_0x44cb74['id'],'direction':'in','ContactId':_0x44cb74[_0x2d8d('0x4f')],'AttachmentId':_0x587de7[_0x2d8d('0x24')][_0x2d8d('0x50')]});})['then'](function(_0x94ba2e){_0x362bdb['message']=_0x94ba2e;if(_0x362bdb[_0x2d8d('0x4d')][_0x2d8d('0x51')]){return db['User'][_0x2d8d('0x36')]({'attributes':['id',_0x2d8d('0x52')],'where':{'id':_0x362bdb['interaction'][_0x2d8d('0x51')]}})[_0x2d8d('0x22')](function(_0x36846b){if(_0x36846b){_0x362bdb[_0x2d8d('0x3c')][_0x2d8d('0x53')]({'id':0x0,'priority':0x0,'app':_0x2d8d('0x54'),'appdata':_0x36846b[_0x2d8d('0x52')]+','+(_0x362bdb[_0x2d8d('0x37')][_0x2d8d('0x55')]||0xa),'interval':_0x2d8d('0x4b')});}return respondWithRpcPromise('Start',_0x2d8d('0x56'),_0x362bdb);});}return respondWithRpcPromise('Start',_0x2d8d('0x56'),_0x362bdb);})[_0x2d8d('0x22')](function(_0x5ae3e2){_0x1a7768(_0x5ae3e2);})[_0x2d8d('0x19')](function(_0x2fc10e){_0x4412c5(_0x103f9d[_0x2d8d('0x15')](0x1f4,_0x2fc10e[_0x2d8d('0x17')]));});});}; \ No newline at end of file diff --git a/server/api/faxAccount/faxAccount.socket.js b/server/api/faxAccount/faxAccount.socket.js index 62d5152..64997c0 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 _0x3d04=['remove','update','emit','removeListener','register','faxAccount:','./faxAccount.events','save'];(function(_0x4a6430,_0x30b8b4){var _0x33c2d0=function(_0x396740){while(--_0x396740){_0x4a6430['push'](_0x4a6430['shift']());}};_0x33c2d0(++_0x30b8b4);}(_0x3d04,0xbe));var _0x43d0=function(_0x5b644e,_0x2e5e07){_0x5b644e=_0x5b644e-0x0;var _0x49c6bf=_0x3d04[_0x5b644e];return _0x49c6bf;};'use strict';var FaxAccountEvents=require(_0x43d0('0x0'));var events=[_0x43d0('0x1'),_0x43d0('0x2'),_0x43d0('0x3')];function createListener(_0x191de5,_0x143fea){return function(_0x3d6e62){_0x143fea[_0x43d0('0x4')](_0x191de5,_0x3d6e62);};}function removeListener(_0x5a9e1d,_0x2a4d4c){return function(){FaxAccountEvents[_0x43d0('0x5')](_0x5a9e1d,_0x2a4d4c);};}exports[_0x43d0('0x6')]=function(_0x617bf){for(var _0x5e284f=0x0,_0x484271=events['length'];_0x5e284f<_0x484271;_0x5e284f++){var _0x5efb95=events[_0x5e284f];var _0x457550=createListener(_0x43d0('0x7')+_0x5efb95,_0x617bf);FaxAccountEvents['on'](_0x5efb95,_0x457550);}}; \ No newline at end of file +var _0x77e6=['removeListener','faxAccount:','./faxAccount.events','save','remove','update','emit'];(function(_0x1898bb,_0x219843){var _0x2f17b0=function(_0x10c74e){while(--_0x10c74e){_0x1898bb['push'](_0x1898bb['shift']());}};_0x2f17b0(++_0x219843);}(_0x77e6,0x1a6));var _0x677e=function(_0x49b7a2,_0x31f6ab){_0x49b7a2=_0x49b7a2-0x0;var _0x3d1601=_0x77e6[_0x49b7a2];return _0x3d1601;};'use strict';var FaxAccountEvents=require(_0x677e('0x0'));var events=[_0x677e('0x1'),_0x677e('0x2'),_0x677e('0x3')];function createListener(_0x2dba41,_0x3a0a0e){return function(_0x4142a3){_0x3a0a0e[_0x677e('0x4')](_0x2dba41,_0x4142a3);};}function removeListener(_0x50231c,_0x2f0307){return function(){FaxAccountEvents[_0x677e('0x5')](_0x50231c,_0x2f0307);};}exports['register']=function(_0x18c5e1){for(var _0x591b21=0x0,_0x40d314=events['length'];_0x591b21<_0x40d314;_0x591b21++){var _0x5a5dd3=events[_0x591b21];var _0x2eb40c=createListener(_0x677e('0x6')+_0x5a5dd3,_0x18c5e1);FaxAccountEvents['on'](_0x5a5dd3,_0x2eb40c);}}; \ No newline at end of file diff --git a/server/api/faxAccount/index.js b/server/api/faxAccount/index.js index b30bc97..080aa72 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 _0x4551=['removeAgents','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','./faxAccount.controller','isAuthenticated','index','get','describe','/:id','/:id/dispositions','getDispositions','/:id/canned_answers','getAnswers','/:id/interactions','/:id/applications','getApplications','/:id/messages','/:id/users','getAgents','create','post','addApplications','/addaccountapplications','addAccountApplications','/updateaccountapplications','updateAccountApplications','send','addAgents','update','delete','destroy','removeDispositions'];(function(_0x5f47b6,_0xdfe79d){var _0x31bb2d=function(_0x32e3ca){while(--_0x32e3ca){_0x5f47b6['push'](_0x5f47b6['shift']());}};_0x31bb2d(++_0xdfe79d);}(_0x4551,0x13a));var _0x1455=function(_0x280018,_0x54f59e){_0x280018=_0x280018-0x0;var _0x13152d=_0x4551[_0x280018];return _0x13152d;};'use strict';var multer=require(_0x1455('0x0'));var util=require(_0x1455('0x1'));var path=require(_0x1455('0x2'));var timeout=require(_0x1455('0x3'));var express=require(_0x1455('0x4'));var router=express[_0x1455('0x5')]();var auth=require(_0x1455('0x6'));var interaction=require(_0x1455('0x7'));var config=require('../../config/environment');var controller=require(_0x1455('0x8'));router['get']('/',auth[_0x1455('0x9')](),controller[_0x1455('0xa')]);router[_0x1455('0xb')]('/describe',auth['isAuthenticated'](),controller[_0x1455('0xc')]);router[_0x1455('0xb')](_0x1455('0xd'),auth[_0x1455('0x9')](),controller['show']);router[_0x1455('0xb')](_0x1455('0xe'),auth[_0x1455('0x9')](),controller[_0x1455('0xf')]);router[_0x1455('0xb')](_0x1455('0x10'),auth['isAuthenticated'](),controller[_0x1455('0x11')]);router[_0x1455('0xb')](_0x1455('0x12'),auth['isAuthenticated'](),controller['getInteractions']);router['get'](_0x1455('0x13'),auth['isAuthenticated'](),controller[_0x1455('0x14')]);router['get'](_0x1455('0x15'),auth[_0x1455('0x9')](),controller['getMessages']);router[_0x1455('0xb')](_0x1455('0x16'),auth[_0x1455('0x9')](),controller[_0x1455('0x17')]);router['post']('/',auth['isAuthenticated'](),controller[_0x1455('0x18')]);router[_0x1455('0x19')](_0x1455('0xe'),auth[_0x1455('0x9')](),controller['addDisposition']);router[_0x1455('0x19')](_0x1455('0x10'),auth[_0x1455('0x9')](),controller['addAnswer']);router['post']('/:id/interactions',auth[_0x1455('0x9')](),controller['addInteraction']);router[_0x1455('0x19')](_0x1455('0x13'),auth['isAuthenticated'](),controller[_0x1455('0x1a')]);router[_0x1455('0x19')](_0x1455('0x1b'),auth['isAuthenticated'](),controller[_0x1455('0x1c')]);router[_0x1455('0x19')](_0x1455('0x1d'),auth[_0x1455('0x9')](),controller[_0x1455('0x1e')]);router[_0x1455('0x19')]('/:id/send',auth[_0x1455('0x9')](),controller[_0x1455('0x1f')]);router[_0x1455('0x19')](_0x1455('0x16'),auth[_0x1455('0x9')](),controller[_0x1455('0x20')]);router['put'](_0x1455('0xd'),auth[_0x1455('0x9')](),controller[_0x1455('0x21')]);router[_0x1455('0x22')]('/:id',auth[_0x1455('0x9')](),controller[_0x1455('0x23')]);router[_0x1455('0x22')](_0x1455('0xe'),auth['isAuthenticated'](),controller[_0x1455('0x24')]);router[_0x1455('0x22')]('/:id/canned_answers',auth['isAuthenticated'](),controller['removeAnswers']);router[_0x1455('0x22')](_0x1455('0x16'),auth[_0x1455('0x9')](),controller[_0x1455('0x25')]);module[_0x1455('0x26')]=router; \ No newline at end of file +var _0x95a1=['getInteractions','/:id/applications','getApplications','/:id/messages','getMessages','getAgents','post','create','addDisposition','addAnswer','addApplications','/addaccountapplications','updateAccountApplications','/:id/send','send','/:id/users','addAgents','put','destroy','delete','removeAgents','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','./faxAccount.controller','get','isAuthenticated','/describe','describe','/:id','show','/:id/dispositions','/:id/canned_answers','getAnswers','/:id/interactions'];(function(_0x492af5,_0xd51471){var _0x59f529=function(_0x40c9aa){while(--_0x40c9aa){_0x492af5['push'](_0x492af5['shift']());}};_0x59f529(++_0xd51471);}(_0x95a1,0x1a6));var _0x195a=function(_0x10768c,_0x2aa239){_0x10768c=_0x10768c-0x0;var _0x405915=_0x95a1[_0x10768c];return _0x405915;};'use strict';var multer=require(_0x195a('0x0'));var util=require(_0x195a('0x1'));var path=require(_0x195a('0x2'));var timeout=require(_0x195a('0x3'));var express=require(_0x195a('0x4'));var router=express[_0x195a('0x5')]();var auth=require(_0x195a('0x6'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x195a('0x7'));router[_0x195a('0x8')]('/',auth[_0x195a('0x9')](),controller['index']);router[_0x195a('0x8')](_0x195a('0xa'),auth[_0x195a('0x9')](),controller[_0x195a('0xb')]);router[_0x195a('0x8')](_0x195a('0xc'),auth['isAuthenticated'](),controller[_0x195a('0xd')]);router[_0x195a('0x8')](_0x195a('0xe'),auth[_0x195a('0x9')](),controller['getDispositions']);router[_0x195a('0x8')](_0x195a('0xf'),auth[_0x195a('0x9')](),controller[_0x195a('0x10')]);router['get'](_0x195a('0x11'),auth['isAuthenticated'](),controller[_0x195a('0x12')]);router[_0x195a('0x8')](_0x195a('0x13'),auth[_0x195a('0x9')](),controller[_0x195a('0x14')]);router['get'](_0x195a('0x15'),auth[_0x195a('0x9')](),controller[_0x195a('0x16')]);router['get']('/:id/users',auth[_0x195a('0x9')](),controller[_0x195a('0x17')]);router[_0x195a('0x18')]('/',auth['isAuthenticated'](),controller[_0x195a('0x19')]);router[_0x195a('0x18')]('/:id/dispositions',auth['isAuthenticated'](),controller[_0x195a('0x1a')]);router['post'](_0x195a('0xf'),auth[_0x195a('0x9')](),controller[_0x195a('0x1b')]);router[_0x195a('0x18')](_0x195a('0x11'),auth[_0x195a('0x9')](),controller['addInteraction']);router[_0x195a('0x18')](_0x195a('0x13'),auth[_0x195a('0x9')](),controller[_0x195a('0x1c')]);router[_0x195a('0x18')](_0x195a('0x1d'),auth[_0x195a('0x9')](),controller['addAccountApplications']);router[_0x195a('0x18')]('/updateaccountapplications',auth[_0x195a('0x9')](),controller[_0x195a('0x1e')]);router['post'](_0x195a('0x1f'),auth[_0x195a('0x9')](),controller[_0x195a('0x20')]);router[_0x195a('0x18')](_0x195a('0x21'),auth[_0x195a('0x9')](),controller[_0x195a('0x22')]);router[_0x195a('0x23')](_0x195a('0xc'),auth[_0x195a('0x9')](),controller['update']);router['delete'](_0x195a('0xc'),auth[_0x195a('0x9')](),controller[_0x195a('0x24')]);router['delete'](_0x195a('0xe'),auth['isAuthenticated'](),controller['removeDispositions']);router[_0x195a('0x25')]('/:id/canned_answers',auth[_0x195a('0x9')](),controller['removeAnswers']);router[_0x195a('0x25')](_0x195a('0x21'),auth[_0x195a('0x9')](),controller[_0x195a('0x26')]);module[_0x195a('0x27')]=router; \ No newline at end of file diff --git a/server/api/faxApplication/faxApplication.attributes.js b/server/api/faxApplication/faxApplication.attributes.js index 8ddb36a..1b26fbf 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 _0x1107=['sequelize','exports','INTEGER','TEXT','STRING','*,*,*,*'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x1107,0xd8));var _0x7110=function(_0x28fca4,_0x11e78b){_0x28fca4=_0x28fca4-0x0;var _0x42fd01=_0x1107[_0x28fca4];return _0x42fd01;};'use strict';var Sequelize=require(_0x7110('0x0'));module[_0x7110('0x1')]={'priority':{'type':Sequelize[_0x7110('0x2')],'allowNull':![]},'app':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':'noop'},'appdata':{'type':Sequelize[_0x7110('0x3')]()},'description':{'type':Sequelize[_0x7110('0x4')]},'interval':{'type':Sequelize['STRING'],'defaultValue':_0x7110('0x5')}}; \ No newline at end of file +var _0x4e99=['exports','INTEGER','STRING','noop','*,*,*,*'];(function(_0x2b4411,_0x2625ed){var _0x8e41ef=function(_0x2aa8c1){while(--_0x2aa8c1){_0x2b4411['push'](_0x2b4411['shift']());}};_0x8e41ef(++_0x2625ed);}(_0x4e99,0x122));var _0x94e9=function(_0x45e087,_0x494d3e){_0x45e087=_0x45e087-0x0;var _0x41abe8=_0x4e99[_0x45e087];return _0x41abe8;};'use strict';var Sequelize=require('sequelize');module[_0x94e9('0x0')]={'priority':{'type':Sequelize[_0x94e9('0x1')],'allowNull':![]},'app':{'type':Sequelize[_0x94e9('0x2')],'allowNull':![],'defaultValue':_0x94e9('0x3')},'appdata':{'type':Sequelize['TEXT']()},'description':{'type':Sequelize[_0x94e9('0x2')]},'interval':{'type':Sequelize['STRING'],'defaultValue':_0x94e9('0x4')}}; \ No newline at end of file diff --git a/server/api/faxApplication/faxApplication.controller.js b/server/api/faxApplication/faxApplication.controller.js index e4cee94..8e15237 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 _0x3de0=['FaxApplication','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','limit','order','sort','where','pick','filter','map','VIRTUAL','merge','options','includeAll','include','findAll','rows','catch','show','find','create','body','update','html-pdf','rimraf','zip-dir','request-promise','moment','mustache','util','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/environment','../../mysqldb','sendStatus','status','end','json','count','offset','set','Content-Range','apply','reject','save','destroy','then','stack','name','index'];(function(_0xdf5f1e,_0x22a5de){var _0x53a3e1=function(_0x440bc3){while(--_0x440bc3){_0xdf5f1e['push'](_0xdf5f1e['shift']());}};_0x53a3e1(++_0x22a5de);}(_0x3de0,0x143));var _0x03de=function(_0x1f9461,_0x551e06){_0x1f9461=_0x1f9461-0x0;var _0xfd4099=_0x3de0[_0x1f9461];return _0xfd4099;};'use strict';var pdf=require(_0x03de('0x0'));var emlformat=require('eml-format');var rimraf=require(_0x03de('0x1'));var zipdir=require(_0x03de('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x03de('0x3'));var moment=require(_0x03de('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x03de('0x5'));var util=require(_0x03de('0x6'));var path=require('path');var sox=require('sox');var csv=require(_0x03de('0x7'));var ejs=require(_0x03de('0x8'));var fs=require('fs');var _=require(_0x03de('0x9'));var squel=require(_0x03de('0xa'));var crypto=require(_0x03de('0xb'));var jsforce=require(_0x03de('0xc'));var deskjs=require(_0x03de('0xd'));var toCsv=require(_0x03de('0x7'));var querystring=require('querystring');var Papa=require(_0x03de('0xe'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x03de('0xf'));var as=require(_0x03de('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x03de('0x11'))(_0x03de('0x12'));var utils=require('../../config/utils');var config=require(_0x03de('0x13'));var db=require(_0x03de('0x14'))['db'];function respondWithStatusCode(_0x48acfa,_0x3d6629){_0x3d6629=_0x3d6629||0xcc;return function(_0x10ab8b){if(_0x10ab8b){return _0x48acfa[_0x03de('0x15')](_0x3d6629);}return _0x48acfa[_0x03de('0x16')](_0x3d6629)[_0x03de('0x17')]();};}function respondWithResult(_0x5d37da,_0xf9553d){_0xf9553d=_0xf9553d||0xc8;return function(_0x1b467e){if(_0x1b467e){return _0x5d37da[_0x03de('0x16')](_0xf9553d)[_0x03de('0x18')](_0x1b467e);}};}function respondWithFilteredResult(_0x5dcade,_0x453564){return function(_0xedbc6b){if(_0xedbc6b){var _0x1aa88d=_0xedbc6b[_0x03de('0x19')],_0x45881e=_0x453564[_0x03de('0x1a')],_0x45fe9e=_0x453564[_0x03de('0x1a')]+_0x453564['limit'],_0x2828f0;if(_0x45fe9e>=_0x1aa88d){_0x45fe9e=_0x1aa88d;_0x2828f0=0xc8;}else{_0x2828f0=0xce;}_0x5dcade['status'](_0x2828f0);return _0x5dcade[_0x03de('0x1b')](_0x03de('0x1c'),_0x45881e+'-'+_0x45fe9e+'/'+_0x1aa88d)[_0x03de('0x18')](_0xedbc6b);}return null;};}function patchUpdates(_0x55ad7e){return function(_0x1d4060){try{jsonpatch[_0x03de('0x1d')](_0x1d4060,_0x55ad7e,!![]);}catch(_0x32cb0e){return BPromise[_0x03de('0x1e')](_0x32cb0e);}return _0x1d4060[_0x03de('0x1f')]();};}function saveUpdates(_0x27f814,_0x3cb6ff){return function(_0x5cb66b){if(_0x5cb66b){return _0x5cb66b['update'](_0x27f814)['then'](function(_0x29686b){return _0x29686b;});}return null;};}function removeEntity(_0x2884d7,_0x512d82){return function(_0x12337f){if(_0x12337f){return _0x12337f[_0x03de('0x20')]()[_0x03de('0x21')](function(){_0x2884d7['status'](0xcc)[_0x03de('0x17')]();});}};}function handleEntityNotFound(_0x396a57,_0x5f2317){return function(_0x13fb22){if(!_0x13fb22){_0x396a57[_0x03de('0x15')](0x194);}return _0x13fb22;};}function handleError(_0x8c74aa,_0xf03160){_0xf03160=_0xf03160||0x1f4;return function(_0x183e72){logger['error'](_0x183e72[_0x03de('0x22')]);if(_0x183e72[_0x03de('0x23')]){delete _0x183e72[_0x03de('0x23')];}_0x8c74aa[_0x03de('0x16')](_0xf03160)['send'](_0x183e72);};}exports[_0x03de('0x24')]=function(_0x28416a,_0x5ce3c2){var _0x5c371f={},_0xb3fed8={},_0x2147b3={'count':0x0,'rows':[]};var _0x500534=_['map'](db[_0x03de('0x25')][_0x03de('0x26')],function(_0x514232){return{'name':_0x514232[_0x03de('0x27')],'type':_0x514232[_0x03de('0x28')][_0x03de('0x29')]};});_0xb3fed8[_0x03de('0x2a')]=_['map'](_0x500534,'name');_0xb3fed8[_0x03de('0x2b')]=_[_0x03de('0x2c')](_0x28416a[_0x03de('0x2b')]);_0xb3fed8[_0x03de('0x2d')]=_[_0x03de('0x2e')](_0xb3fed8[_0x03de('0x2a')],_0xb3fed8['query']);_0x5c371f[_0x03de('0x2f')]=_[_0x03de('0x2e')](_0xb3fed8[_0x03de('0x2a')],qs[_0x03de('0x30')](_0x28416a[_0x03de('0x2b')][_0x03de('0x30')]));_0x5c371f['attributes']=_0x5c371f[_0x03de('0x2f')][_0x03de('0x31')]?_0x5c371f['attributes']:_0xb3fed8[_0x03de('0x2a')];if(!_0x28416a[_0x03de('0x2b')][_0x03de('0x32')](_0x03de('0x33'))){_0x5c371f['limit']=qs[_0x03de('0x34')](_0x28416a[_0x03de('0x2b')][_0x03de('0x34')]);_0x5c371f[_0x03de('0x1a')]=qs['offset'](_0x28416a[_0x03de('0x2b')][_0x03de('0x1a')]);}_0x5c371f[_0x03de('0x35')]=qs['sort'](_0x28416a[_0x03de('0x2b')][_0x03de('0x36')]);_0x5c371f[_0x03de('0x37')]=qs[_0x03de('0x2d')](_[_0x03de('0x38')](_0x28416a[_0x03de('0x2b')],_0xb3fed8[_0x03de('0x2d')]));if(_0x28416a['query'][_0x03de('0x39')]){_0x5c371f[_0x03de('0x37')]=_['merge'](_0x5c371f['where'],{'$or':_[_0x03de('0x3a')](_0x500534,function(_0x3061d9){if(_0x3061d9[_0x03de('0x28')]!==_0x03de('0x3b')){var _0x65e73c={};_0x65e73c[_0x3061d9[_0x03de('0x23')]]={'$like':'%'+_0x28416a[_0x03de('0x2b')][_0x03de('0x39')]+'%'};return _0x65e73c;}})});}_0x5c371f=_[_0x03de('0x3c')]({},_0x5c371f,_0x28416a[_0x03de('0x3d')]);var _0x11e804={'where':_0x5c371f[_0x03de('0x37')]};return db[_0x03de('0x25')][_0x03de('0x19')](_0x11e804)[_0x03de('0x21')](function(_0x19c038){_0x2147b3[_0x03de('0x19')]=_0x19c038;if(_0x28416a[_0x03de('0x2b')][_0x03de('0x3e')]){_0x5c371f[_0x03de('0x3f')]=[{'all':!![]}];}return db['FaxApplication'][_0x03de('0x40')](_0x5c371f);})[_0x03de('0x21')](function(_0x5b13ae){_0x2147b3[_0x03de('0x41')]=_0x5b13ae;return _0x2147b3;})[_0x03de('0x21')](respondWithFilteredResult(_0x5ce3c2,_0x5c371f))[_0x03de('0x42')](handleError(_0x5ce3c2,null));};exports[_0x03de('0x43')]=function(_0x180450,_0x176b60){var _0x4053c1={'raw':!![],'where':{'id':_0x180450['params']['id']}},_0x12dc8b={};_0x12dc8b[_0x03de('0x2a')]=_[_0x03de('0x2c')](db[_0x03de('0x25')][_0x03de('0x26')]);_0x12dc8b[_0x03de('0x2b')]=_[_0x03de('0x2c')](_0x180450[_0x03de('0x2b')]);_0x12dc8b[_0x03de('0x2d')]=_['intersection'](_0x12dc8b[_0x03de('0x2a')],_0x12dc8b['query']);_0x4053c1['attributes']=_[_0x03de('0x2e')](_0x12dc8b[_0x03de('0x2a')],qs[_0x03de('0x30')](_0x180450['query']['fields']));_0x4053c1[_0x03de('0x2f')]=_0x4053c1[_0x03de('0x2f')][_0x03de('0x31')]?_0x4053c1[_0x03de('0x2f')]:_0x12dc8b['model'];if(_0x180450[_0x03de('0x2b')]['includeAll']){_0x4053c1[_0x03de('0x3f')]=[{'all':!![]}];}_0x4053c1=_[_0x03de('0x3c')]({},_0x4053c1,_0x180450[_0x03de('0x3d')]);return db[_0x03de('0x25')][_0x03de('0x44')](_0x4053c1)[_0x03de('0x21')](handleEntityNotFound(_0x176b60,null))['then'](respondWithResult(_0x176b60,null))[_0x03de('0x42')](handleError(_0x176b60,null));};exports['create']=function(_0x2b8646,_0x4ebf51){return db[_0x03de('0x25')][_0x03de('0x45')](_0x2b8646[_0x03de('0x46')],{})['then'](respondWithResult(_0x4ebf51,0xc9))['catch'](handleError(_0x4ebf51,null));};exports[_0x03de('0x47')]=function(_0x1bd748,_0x3f94e1){if(_0x1bd748[_0x03de('0x46')]['id']){delete _0x1bd748[_0x03de('0x46')]['id'];}return db[_0x03de('0x25')][_0x03de('0x44')]({'where':{'id':_0x1bd748['params']['id']}})[_0x03de('0x21')](handleEntityNotFound(_0x3f94e1,null))[_0x03de('0x21')](saveUpdates(_0x1bd748['body'],null))[_0x03de('0x21')](respondWithResult(_0x3f94e1,null))[_0x03de('0x42')](handleError(_0x3f94e1,null));};exports['destroy']=function(_0x470d3c,_0x4165c3){return db['FaxApplication'][_0x03de('0x44')]({'where':{'id':_0x470d3c['params']['id']}})['then'](handleEntityNotFound(_0x4165c3,null))[_0x03de('0x21')](removeEntity(_0x4165c3,null))[_0x03de('0x42')](handleError(_0x4165c3,null));}; \ No newline at end of file +var _0x106f=['reject','save','update','destroy','then','end','error','stack','name','send','index','map','FaxApplication','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','limit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','findAll','rows','catch','show','params','include','find','create','body','html-pdf','eml-format','zip-dir','fast-json-patch','moment','mustache','util','path','sox','to-csv','ejs','lodash','crypto','jsforce','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','count','offset','set','Content-Range','json','apply'];(function(_0xdd79cf,_0x3523a0){var _0x315855=function(_0x294145){while(--_0x294145){_0xdd79cf['push'](_0xdd79cf['shift']());}};_0x315855(++_0x3523a0);}(_0x106f,0x162));var _0xf106=function(_0x59ed8f,_0x253d34){_0x59ed8f=_0x59ed8f-0x0;var _0x24381d=_0x106f[_0x59ed8f];return _0x24381d;};'use strict';var pdf=require(_0xf106('0x0'));var emlformat=require(_0xf106('0x1'));var rimraf=require('rimraf');var zipdir=require(_0xf106('0x2'));var jsonpatch=require(_0xf106('0x3'));var rp=require('request-promise');var moment=require(_0xf106('0x4'));var BPromise=require('bluebird');var Mustache=require(_0xf106('0x5'));var util=require(_0xf106('0x6'));var path=require(_0xf106('0x7'));var sox=require(_0xf106('0x8'));var csv=require(_0xf106('0x9'));var ejs=require(_0xf106('0xa'));var fs=require('fs');var _=require(_0xf106('0xb'));var squel=require('squel');var crypto=require(_0xf106('0xc'));var jsforce=require(_0xf106('0xd'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0xf106('0xe'));var qs=require(_0xf106('0xf'));var as=require(_0xf106('0x10'));var hardwareService=require(_0xf106('0x11'));var logger=require(_0xf106('0x12'))(_0xf106('0x13'));var utils=require(_0xf106('0x14'));var config=require(_0xf106('0x15'));var db=require(_0xf106('0x16'))['db'];function respondWithStatusCode(_0x1b1216,_0x31eebf){_0x31eebf=_0x31eebf||0xcc;return function(_0x5e9da8){if(_0x5e9da8){return _0x1b1216[_0xf106('0x17')](_0x31eebf);}return _0x1b1216[_0xf106('0x18')](_0x31eebf)['end']();};}function respondWithResult(_0x59854c,_0x322351){_0x322351=_0x322351||0xc8;return function(_0x2cdbf6){if(_0x2cdbf6){return _0x59854c[_0xf106('0x18')](_0x322351)['json'](_0x2cdbf6);}};}function respondWithFilteredResult(_0x26bd1b,_0x26186f){return function(_0xf05683){if(_0xf05683){var _0x48bfdd=_0xf05683[_0xf106('0x19')],_0x1e17e6=_0x26186f[_0xf106('0x1a')],_0x22e521=_0x26186f[_0xf106('0x1a')]+_0x26186f['limit'],_0x5a7c1a;if(_0x22e521>=_0x48bfdd){_0x22e521=_0x48bfdd;_0x5a7c1a=0xc8;}else{_0x5a7c1a=0xce;}_0x26bd1b['status'](_0x5a7c1a);return _0x26bd1b[_0xf106('0x1b')](_0xf106('0x1c'),_0x1e17e6+'-'+_0x22e521+'/'+_0x48bfdd)[_0xf106('0x1d')](_0xf05683);}return null;};}function patchUpdates(_0x4d395d){return function(_0x11d2a1){try{jsonpatch[_0xf106('0x1e')](_0x11d2a1,_0x4d395d,!![]);}catch(_0x30b3a6){return BPromise[_0xf106('0x1f')](_0x30b3a6);}return _0x11d2a1[_0xf106('0x20')]();};}function saveUpdates(_0x2dcd67,_0x29ae70){return function(_0x232a54){if(_0x232a54){return _0x232a54[_0xf106('0x21')](_0x2dcd67)['then'](function(_0x5caa6c){return _0x5caa6c;});}return null;};}function removeEntity(_0x206cbe,_0x59abbc){return function(_0x32ab30){if(_0x32ab30){return _0x32ab30[_0xf106('0x22')]()[_0xf106('0x23')](function(){_0x206cbe[_0xf106('0x18')](0xcc)[_0xf106('0x24')]();});}};}function handleEntityNotFound(_0x4f673f,_0x58febd){return function(_0x178890){if(!_0x178890){_0x4f673f[_0xf106('0x17')](0x194);}return _0x178890;};}function handleError(_0x4122dc,_0x25d00a){_0x25d00a=_0x25d00a||0x1f4;return function(_0x48c467){logger[_0xf106('0x25')](_0x48c467[_0xf106('0x26')]);if(_0x48c467[_0xf106('0x27')]){delete _0x48c467[_0xf106('0x27')];}_0x4122dc[_0xf106('0x18')](_0x25d00a)[_0xf106('0x28')](_0x48c467);};}exports[_0xf106('0x29')]=function(_0x5119c3,_0x4b14ad){var _0x53750e={},_0x2d87f7={},_0x2b8d48={'count':0x0,'rows':[]};var _0x27ed68=_[_0xf106('0x2a')](db[_0xf106('0x2b')][_0xf106('0x2c')],function(_0x4f90d1){return{'name':_0x4f90d1[_0xf106('0x2d')],'type':_0x4f90d1[_0xf106('0x2e')][_0xf106('0x2f')]};});_0x2d87f7[_0xf106('0x30')]=_['map'](_0x27ed68,_0xf106('0x27'));_0x2d87f7[_0xf106('0x31')]=_[_0xf106('0x32')](_0x5119c3[_0xf106('0x31')]);_0x2d87f7[_0xf106('0x33')]=_[_0xf106('0x34')](_0x2d87f7['model'],_0x2d87f7[_0xf106('0x31')]);_0x53750e[_0xf106('0x35')]=_[_0xf106('0x34')](_0x2d87f7[_0xf106('0x30')],qs['fields'](_0x5119c3[_0xf106('0x31')][_0xf106('0x36')]));_0x53750e['attributes']=_0x53750e[_0xf106('0x35')][_0xf106('0x37')]?_0x53750e[_0xf106('0x35')]:_0x2d87f7[_0xf106('0x30')];if(!_0x5119c3[_0xf106('0x31')][_0xf106('0x38')](_0xf106('0x39'))){_0x53750e[_0xf106('0x3a')]=qs[_0xf106('0x3a')](_0x5119c3[_0xf106('0x31')][_0xf106('0x3a')]);_0x53750e['offset']=qs['offset'](_0x5119c3[_0xf106('0x31')][_0xf106('0x1a')]);}_0x53750e[_0xf106('0x3b')]=qs['sort'](_0x5119c3[_0xf106('0x31')][_0xf106('0x3c')]);_0x53750e[_0xf106('0x3d')]=qs[_0xf106('0x33')](_[_0xf106('0x3e')](_0x5119c3['query'],_0x2d87f7[_0xf106('0x33')]));if(_0x5119c3['query'][_0xf106('0x3f')]){_0x53750e[_0xf106('0x3d')]=_[_0xf106('0x40')](_0x53750e[_0xf106('0x3d')],{'$or':_['map'](_0x27ed68,function(_0x336c40){if(_0x336c40[_0xf106('0x2e')]!==_0xf106('0x41')){var _0x4db587={};_0x4db587[_0x336c40['name']]={'$like':'%'+_0x5119c3['query']['filter']+'%'};return _0x4db587;}})});}_0x53750e=_['merge']({},_0x53750e,_0x5119c3[_0xf106('0x42')]);var _0x5de95b={'where':_0x53750e['where']};return db[_0xf106('0x2b')]['count'](_0x5de95b)['then'](function(_0x26ffc3){_0x2b8d48[_0xf106('0x19')]=_0x26ffc3;if(_0x5119c3[_0xf106('0x31')][_0xf106('0x43')]){_0x53750e['include']=[{'all':!![]}];}return db[_0xf106('0x2b')][_0xf106('0x44')](_0x53750e);})['then'](function(_0x5392d4){_0x2b8d48[_0xf106('0x45')]=_0x5392d4;return _0x2b8d48;})[_0xf106('0x23')](respondWithFilteredResult(_0x4b14ad,_0x53750e))[_0xf106('0x46')](handleError(_0x4b14ad,null));};exports[_0xf106('0x47')]=function(_0x430b36,_0x536a0d){var _0x57d61e={'raw':!![],'where':{'id':_0x430b36[_0xf106('0x48')]['id']}},_0x5f2ded={};_0x5f2ded['model']=_['keys'](db[_0xf106('0x2b')][_0xf106('0x2c')]);_0x5f2ded['query']=_['keys'](_0x430b36[_0xf106('0x31')]);_0x5f2ded['filters']=_[_0xf106('0x34')](_0x5f2ded[_0xf106('0x30')],_0x5f2ded[_0xf106('0x31')]);_0x57d61e[_0xf106('0x35')]=_[_0xf106('0x34')](_0x5f2ded[_0xf106('0x30')],qs[_0xf106('0x36')](_0x430b36[_0xf106('0x31')][_0xf106('0x36')]));_0x57d61e[_0xf106('0x35')]=_0x57d61e[_0xf106('0x35')][_0xf106('0x37')]?_0x57d61e[_0xf106('0x35')]:_0x5f2ded[_0xf106('0x30')];if(_0x430b36[_0xf106('0x31')][_0xf106('0x43')]){_0x57d61e[_0xf106('0x49')]=[{'all':!![]}];}_0x57d61e=_[_0xf106('0x40')]({},_0x57d61e,_0x430b36['options']);return db[_0xf106('0x2b')][_0xf106('0x4a')](_0x57d61e)[_0xf106('0x23')](handleEntityNotFound(_0x536a0d,null))[_0xf106('0x23')](respondWithResult(_0x536a0d,null))[_0xf106('0x46')](handleError(_0x536a0d,null));};exports['create']=function(_0x4c60d0,_0x57c9f4){return db['FaxApplication'][_0xf106('0x4b')](_0x4c60d0['body'],{})['then'](respondWithResult(_0x57c9f4,0xc9))[_0xf106('0x46')](handleError(_0x57c9f4,null));};exports[_0xf106('0x21')]=function(_0xd50443,_0x105337){if(_0xd50443['body']['id']){delete _0xd50443[_0xf106('0x4c')]['id'];}return db[_0xf106('0x2b')][_0xf106('0x4a')]({'where':{'id':_0xd50443[_0xf106('0x48')]['id']}})[_0xf106('0x23')](handleEntityNotFound(_0x105337,null))['then'](saveUpdates(_0xd50443['body'],null))[_0xf106('0x23')](respondWithResult(_0x105337,null))[_0xf106('0x46')](handleError(_0x105337,null));};exports[_0xf106('0x22')]=function(_0x489ace,_0x192edc){return db[_0xf106('0x2b')][_0xf106('0x4a')]({'where':{'id':_0x489ace[_0xf106('0x48')]['id']}})['then'](handleEntityNotFound(_0x192edc,null))[_0xf106('0x23')](removeEntity(_0x192edc,null))['catch'](handleError(_0x192edc,null));}; \ No newline at end of file diff --git a/server/api/faxApplication/faxApplication.model.js b/server/api/faxApplication/faxApplication.model.js index 1945411..6fac4f4 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 _0x3912=['rimraf','../../config/environment','./faxApplication.attributes','exports','FaxApplication','fax_applications','utf8mb4','utf8mb4_unicode_ci','util','api','bluebird','request-promise'];(function(_0x293405,_0x1a759d){var _0x147de7=function(_0x165af1){while(--_0x165af1){_0x293405['push'](_0x293405['shift']());}};_0x147de7(++_0x1a759d);}(_0x3912,0xb0));var _0x2391=function(_0xc77ad7,_0x524bb1){_0xc77ad7=_0xc77ad7-0x0;var _0x15ad78=_0x3912[_0xc77ad7];return _0x15ad78;};'use strict';var _=require('lodash');var util=require(_0x2391('0x0'));var logger=require('../../config/logger')(_0x2391('0x1'));var moment=require('moment');var BPromise=require(_0x2391('0x2'));var rp=require(_0x2391('0x3'));var fs=require('fs');var path=require('path');var rimraf=require(_0x2391('0x4'));var config=require(_0x2391('0x5'));var attributes=require(_0x2391('0x6'));module[_0x2391('0x7')]=function(_0x24ff66,_0x1e8294){return _0x24ff66['define'](_0x2391('0x8'),attributes,{'tableName':_0x2391('0x9'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x2391('0xa'),'collate':_0x2391('0xb')});}; \ No newline at end of file +var _0x44eb=['fax_applications','utf8mb4','utf8mb4_unicode_ci','lodash','../../config/logger','api','bluebird','request-promise','../../config/environment','exports','FaxApplication'];(function(_0x120376,_0x571898){var _0x28c529=function(_0x4f130c){while(--_0x4f130c){_0x120376['push'](_0x120376['shift']());}};_0x28c529(++_0x571898);}(_0x44eb,0xbe));var _0xb44e=function(_0x2fd8a7,_0x5db621){_0x2fd8a7=_0x2fd8a7-0x0;var _0x4bdc24=_0x44eb[_0x2fd8a7];return _0x4bdc24;};'use strict';var _=require(_0xb44e('0x0'));var util=require('util');var logger=require(_0xb44e('0x1'))(_0xb44e('0x2'));var moment=require('moment');var BPromise=require(_0xb44e('0x3'));var rp=require(_0xb44e('0x4'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0xb44e('0x5'));var attributes=require('./faxApplication.attributes');module[_0xb44e('0x6')]=function(_0x5ab01d,_0x52f0ae){return _0x5ab01d['define'](_0xb44e('0x7'),attributes,{'tableName':_0xb44e('0x8'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0xb44e('0x9'),'collate':_0xb44e('0xa')});}; \ No newline at end of file diff --git a/server/api/faxApplication/faxApplication.rpc.js b/server/api/faxApplication/faxApplication.rpc.js index ddd5532..e38d21a 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 _0xe6a8=['../../config/logger','rpc','../../config/environment','jayson/promise','http','then','info','request\x20sent','debug','FaxApplication,\x20%s,\x20%s,\x20%s','stringify','error','code','message','FaxApplication,\x20%s,\x20%s','result','UpdateFaxApplication','FaxApplication','body','options','raw','where','limit','catch','bluebird','ioredis','../../mysqldb','../../config/utils'];(function(_0x15fc3c,_0x35665b){var _0x94c5c8=function(_0xbab268){while(--_0xbab268){_0x15fc3c['push'](_0x15fc3c['shift']());}};_0x94c5c8(++_0x35665b);}(_0xe6a8,0x184));var _0x8e6a=function(_0x5d530e,_0x2c16ac){_0x5d530e=_0x5d530e-0x0;var _0x31d6db=_0xe6a8[_0x5d530e];return _0x31d6db;};'use strict';var _=require('lodash');var util=require('util');var moment=require('moment');var BPromise=require(_0x8e6a('0x0'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x8e6a('0x1'));var db=require(_0x8e6a('0x2'))['db'];var utils=require(_0x8e6a('0x3'));var logger=require(_0x8e6a('0x4'))(_0x8e6a('0x5'));var config=require(_0x8e6a('0x6'));var jayson=require(_0x8e6a('0x7'));var client=jayson['client'][_0x8e6a('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x2b15b7,_0xb619d7,_0x2a413d){return new BPromise(function(_0x2846cc,_0x24b45b){return client['request'](_0x2b15b7,_0x2a413d)[_0x8e6a('0x9')](function(_0x56e631){logger[_0x8e6a('0xa')]('FaxApplication,\x20%s,\x20%s',_0xb619d7,_0x8e6a('0xb'));logger[_0x8e6a('0xc')](_0x8e6a('0xd'),_0xb619d7,'request\x20sent',JSON[_0x8e6a('0xe')](_0x56e631));if(_0x56e631['error']){if(_0x56e631[_0x8e6a('0xf')][_0x8e6a('0x10')]===0x1f4){logger[_0x8e6a('0xf')]('FaxApplication,\x20%s,\x20%s',_0xb619d7,_0x56e631[_0x8e6a('0xf')][_0x8e6a('0x11')]);return _0x24b45b(_0x56e631[_0x8e6a('0xf')][_0x8e6a('0x11')]);}logger[_0x8e6a('0xf')](_0x8e6a('0x12'),_0xb619d7,_0x56e631[_0x8e6a('0xf')][_0x8e6a('0x11')]);return _0x2846cc(_0x56e631[_0x8e6a('0xf')]['message']);}else{logger[_0x8e6a('0xa')](_0x8e6a('0x12'),_0xb619d7,_0x8e6a('0xb'));_0x2846cc(_0x56e631[_0x8e6a('0x13')]['message']);}})['catch'](function(_0x5b2adf){logger[_0x8e6a('0xf')](_0x8e6a('0x12'),_0xb619d7,_0x5b2adf);_0x24b45b(_0x5b2adf);});});}exports[_0x8e6a('0x14')]=function(_0x271fdc){var _0x1aef87=this;return new Promise(function(_0x11c512,_0x49473a){return db[_0x8e6a('0x15')]['update'](_0x271fdc[_0x8e6a('0x16')],{'raw':_0x271fdc[_0x8e6a('0x17')]?_0x271fdc[_0x8e6a('0x17')][_0x8e6a('0x18')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x271fdc[_0x8e6a('0x17')]?_0x271fdc[_0x8e6a('0x17')][_0x8e6a('0x19')]||null:null,'attributes':_0x271fdc[_0x8e6a('0x17')]?_0x271fdc[_0x8e6a('0x17')]['attributes']||null:null,'limit':_0x271fdc[_0x8e6a('0x17')]?_0x271fdc[_0x8e6a('0x17')][_0x8e6a('0x1a')]||null:null})[_0x8e6a('0x9')](function(_0x39ae97){logger[_0x8e6a('0xa')](_0x8e6a('0x14'),_0x271fdc);logger[_0x8e6a('0xc')](_0x8e6a('0x14'),_0x271fdc,JSON[_0x8e6a('0xe')](_0x39ae97));_0x11c512(_0x39ae97);})[_0x8e6a('0x1b')](function(_0x17909d){logger[_0x8e6a('0xf')](_0x8e6a('0x14'),_0x17909d[_0x8e6a('0x11')],_0x271fdc);_0x49473a(_0x1aef87['error'](0x1f4,_0x17909d[_0x8e6a('0x11')]));});});}; \ No newline at end of file +var _0xcaea=['options','raw','attributes','limit','lodash','util','bluebird','randomstring','ioredis','../../config/logger','rpc','../../config/environment','client','http','then','info','FaxApplication,\x20%s,\x20%s','debug','FaxApplication,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','UpdateFaxApplication','FaxApplication','body'];(function(_0x1cc961,_0x2c42ee){var _0x471d86=function(_0x44e422){while(--_0x44e422){_0x1cc961['push'](_0x1cc961['shift']());}};_0x471d86(++_0x2c42ee);}(_0xcaea,0x1f1));var _0xacae=function(_0xd440b9,_0x5ec86a){_0xd440b9=_0xd440b9-0x0;var _0x4b0cbc=_0xcaea[_0xd440b9];return _0x4b0cbc;};'use strict';var _=require(_0xacae('0x0'));var util=require(_0xacae('0x1'));var moment=require('moment');var BPromise=require(_0xacae('0x2'));var rs=require(_0xacae('0x3'));var fs=require('fs');var Redis=require(_0xacae('0x4'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0xacae('0x5'))(_0xacae('0x6'));var config=require(_0xacae('0x7'));var jayson=require('jayson/promise');var client=jayson[_0xacae('0x8')][_0xacae('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x2c7753,_0x335469,_0x5b2558){return new BPromise(function(_0xffd4d6,_0x29b2bb){return client['request'](_0x2c7753,_0x5b2558)[_0xacae('0xa')](function(_0x5ef239){logger[_0xacae('0xb')](_0xacae('0xc'),_0x335469,'request\x20sent');logger[_0xacae('0xd')](_0xacae('0xe'),_0x335469,_0xacae('0xf'),JSON[_0xacae('0x10')](_0x5ef239));if(_0x5ef239[_0xacae('0x11')]){if(_0x5ef239[_0xacae('0x11')][_0xacae('0x12')]===0x1f4){logger[_0xacae('0x11')](_0xacae('0xc'),_0x335469,_0x5ef239[_0xacae('0x11')]['message']);return _0x29b2bb(_0x5ef239[_0xacae('0x11')]['message']);}logger[_0xacae('0x11')](_0xacae('0xc'),_0x335469,_0x5ef239[_0xacae('0x11')][_0xacae('0x13')]);return _0xffd4d6(_0x5ef239['error']['message']);}else{logger[_0xacae('0xb')](_0xacae('0xc'),_0x335469,_0xacae('0xf'));_0xffd4d6(_0x5ef239[_0xacae('0x14')][_0xacae('0x13')]);}})[_0xacae('0x15')](function(_0x216369){logger[_0xacae('0x11')](_0xacae('0xc'),_0x335469,_0x216369);_0x29b2bb(_0x216369);});});}exports[_0xacae('0x16')]=function(_0x5d01a5){var _0x6c95e5=this;return new Promise(function(_0x144ece,_0x2c2df3){return db[_0xacae('0x17')]['update'](_0x5d01a5[_0xacae('0x18')],{'raw':_0x5d01a5[_0xacae('0x19')]?_0x5d01a5[_0xacae('0x19')][_0xacae('0x1a')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x5d01a5[_0xacae('0x19')]?_0x5d01a5[_0xacae('0x19')]['where']||null:null,'attributes':_0x5d01a5[_0xacae('0x19')]?_0x5d01a5[_0xacae('0x19')][_0xacae('0x1b')]||null:null,'limit':_0x5d01a5[_0xacae('0x19')]?_0x5d01a5['options'][_0xacae('0x1c')]||null:null})[_0xacae('0xa')](function(_0x465f84){logger['info'](_0xacae('0x16'),_0x5d01a5);logger['debug'](_0xacae('0x16'),_0x5d01a5,JSON['stringify'](_0x465f84));_0x144ece(_0x465f84);})[_0xacae('0x15')](function(_0x577d41){logger[_0xacae('0x11')]('UpdateFaxApplication',_0x577d41[_0xacae('0x13')],_0x5d01a5);_0x2c2df3(_0x6c95e5[_0xacae('0x11')](0x1f4,_0x577d41[_0xacae('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/faxApplication/index.js b/server/api/faxApplication/index.js index e74bb04..530865e 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 _0x7fbe=['express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./faxApplication.controller','get','isAuthenticated','index','/:id','post','create','put','update','delete','destroy','exports','path','connect-timeout'];(function(_0x4936f7,_0x346bd3){var _0x564ccd=function(_0x38d82f){while(--_0x38d82f){_0x4936f7['push'](_0x4936f7['shift']());}};_0x564ccd(++_0x346bd3);}(_0x7fbe,0x1ec));var _0xe7fb=function(_0x4a7843,_0x24f6d1){_0x4a7843=_0x4a7843-0x0;var _0x2c57fe=_0x7fbe[_0x4a7843];return _0x2c57fe;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0xe7fb('0x0'));var timeout=require(_0xe7fb('0x1'));var express=require(_0xe7fb('0x2'));var router=express[_0xe7fb('0x3')]();var auth=require(_0xe7fb('0x4'));var interaction=require(_0xe7fb('0x5'));var config=require(_0xe7fb('0x6'));var controller=require(_0xe7fb('0x7'));router[_0xe7fb('0x8')]('/',auth[_0xe7fb('0x9')](),controller[_0xe7fb('0xa')]);router[_0xe7fb('0x8')](_0xe7fb('0xb'),auth[_0xe7fb('0x9')](),controller['show']);router[_0xe7fb('0xc')]('/',auth[_0xe7fb('0x9')](),controller[_0xe7fb('0xd')]);router[_0xe7fb('0xe')]('/:id',auth['isAuthenticated'](),controller[_0xe7fb('0xf')]);router[_0xe7fb('0x10')](_0xe7fb('0xb'),auth[_0xe7fb('0x9')](),controller[_0xe7fb('0x11')]);module[_0xe7fb('0x12')]=router; \ No newline at end of file +var _0x687b=['post','put','update','delete','destroy','exports','multer','util','path','connect-timeout','../../components/auth/service','../../components/interaction/service','../../config/environment','./faxApplication.controller','get','isAuthenticated','index','/:id'];(function(_0x138f59,_0x1b53fb){var _0x3d114d=function(_0x1f9461){while(--_0x1f9461){_0x138f59['push'](_0x138f59['shift']());}};_0x3d114d(++_0x1b53fb);}(_0x687b,0x14a));var _0xb687=function(_0xe31165,_0x23cebf){_0xe31165=_0xe31165-0x0;var _0x3cd681=_0x687b[_0xe31165];return _0x3cd681;};'use strict';var multer=require(_0xb687('0x0'));var util=require(_0xb687('0x1'));var path=require(_0xb687('0x2'));var timeout=require(_0xb687('0x3'));var express=require('express');var router=express['Router']();var auth=require(_0xb687('0x4'));var interaction=require(_0xb687('0x5'));var config=require(_0xb687('0x6'));var controller=require(_0xb687('0x7'));router[_0xb687('0x8')]('/',auth[_0xb687('0x9')](),controller[_0xb687('0xa')]);router[_0xb687('0x8')](_0xb687('0xb'),auth[_0xb687('0x9')](),controller['show']);router[_0xb687('0xc')]('/',auth[_0xb687('0x9')](),controller['create']);router[_0xb687('0xd')](_0xb687('0xb'),auth[_0xb687('0x9')](),controller[_0xb687('0xe')]);router[_0xb687('0xf')](_0xb687('0xb'),auth[_0xb687('0x9')](),controller[_0xb687('0x10')]);module[_0xb687('0x11')]=router; \ No newline at end of file diff --git a/server/api/faxInteraction/faxInteraction.attributes.js b/server/api/faxInteraction/faxInteraction.attributes.js index 56f6810..a47960c 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 _0x6c09=['ENUM','out','sequelize','BOOLEAN','DATE','STRING'];(function(_0x7488c6,_0x1b2889){var _0x50fafa=function(_0x5dbf64){while(--_0x5dbf64){_0x7488c6['push'](_0x7488c6['shift']());}};_0x50fafa(++_0x1b2889);}(_0x6c09,0xf8));var _0x96c0=function(_0x54c433,_0x221dad){_0x54c433=_0x54c433-0x0;var _0x2d1951=_0x6c09[_0x54c433];return _0x2d1951;};'use strict';var Sequelize=require(_0x96c0('0x0'));module['exports']={'closed':{'type':Sequelize[_0x96c0('0x1')],'defaultValue':![]},'closedAt':{'type':Sequelize[_0x96c0('0x2')]},'disposition':{'type':Sequelize[_0x96c0('0x3')]},'note':{'type':Sequelize[_0x96c0('0x3')]},'read1stAt':{'type':Sequelize[_0x96c0('0x2')]},'fax':{'type':Sequelize[_0x96c0('0x3')]},'firstMsgDirection':{'type':Sequelize[_0x96c0('0x4')]('in',_0x96c0('0x5')),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize[_0x96c0('0x2')]},'lastMsgDirection':{'type':Sequelize[_0x96c0('0x4')]('in',_0x96c0('0x5')),'defaultValue':'in','allowNull':![]}}; \ No newline at end of file +var _0xfef5=['STRING','out','ENUM','sequelize','BOOLEAN','DATE'];(function(_0x2cf4f6,_0xf083a4){var _0x1818b6=function(_0x2e4b8e){while(--_0x2e4b8e){_0x2cf4f6['push'](_0x2cf4f6['shift']());}};_0x1818b6(++_0xf083a4);}(_0xfef5,0x153));var _0x5fef=function(_0x54f967,_0xe0a87){_0x54f967=_0x54f967-0x0;var _0x2a6e8a=_0xfef5[_0x54f967];return _0x2a6e8a;};'use strict';var Sequelize=require(_0x5fef('0x0'));module['exports']={'closed':{'type':Sequelize[_0x5fef('0x1')],'defaultValue':![]},'closedAt':{'type':Sequelize[_0x5fef('0x2')]},'disposition':{'type':Sequelize[_0x5fef('0x3')]},'note':{'type':Sequelize[_0x5fef('0x3')]},'read1stAt':{'type':Sequelize['DATE']},'fax':{'type':Sequelize[_0x5fef('0x3')]},'firstMsgDirection':{'type':Sequelize['ENUM']('in',_0x5fef('0x4')),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize['DATE']},'lastMsgDirection':{'type':Sequelize[_0x5fef('0x5')]('in',_0x5fef('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 cfeb0bf..80378e3 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 _0x0c2b=['getFaxAccounts','i.FaxAccountId\x20IS\x20NULL','sequelize','toString','count','keyBy','merge','a.key','Account.key','a.mandatoryDisposition','i.*','c.firstName','Contact.firstName','c.lastName','Contact.lastName','c.email','Contact.email','Contact.mobile','c.fax','Contact.fax','o.fullname','Owner.fullname','o.internal','Owner.internal','GROUP_CONCAT(DISTINCT\x20t.id)','ui.FaxInteractionId\x20IN\x20?','FaxInteractionId','all','show','params','rawAttributes','includeAll','include','options','create','describe','addMessage','FaxMessage','ids','getMessages','findOne','hasOwnProperty','filter','$gte','YYYY-MM-DD\x20HH:mm:ss','findAll','rows','addTags','setTags','emit','faxInteractionTags:save','removeTags','download','join','root','server','files','tmp','Attachment','Messages','get','mkdirSync','basename','existsSync','createReadStream','err','html-pdf','eml-format','rimraf','fast-json-patch','moment','bluebird','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../mysqldb','defaults','redis','localhost','socket.io-emitter','./faxInteraction.socket','register','sendStatus','status','end','json','offset','limit','set','Content-Range','apply','reject','save','update','then','destroy','error','stack','name','Users','map','fullname','TagIds','Tags','split','push','catch','index','FaxInteraction','fieldName','type','key','model','query','keys','intersection','attributes','fields','nolimit','order','sort','where','filters','pick','select','field','color','from','tools_tags','u.id','u.fullname','ui.FaxInteractionId','left_join','users','fax_interactions','cm_contacts','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL','o.id\x20=\x20i.UserId','fax_accounts','a.id\x20=\x20i.FaxAccountId','fax_messages','me.FaxInteractionId\x20=\x20i.id','fax_interaction_has_tags','it.FaxInteractionId\x20=\x20i.id','expr','search','parseSearch','sqlOperator','conditions','unreadMessages','value','having','`\x20=\x200','Contact','operator','$substring','length','getFullTextValue','c.firstName\x20LIKE\x20?\x20OR\x20c.lastName\x20LIKE\x20?\x20OR\x20c.email\x20LIKE\x20?','find','ContactId','buildExpression','text','start','Tag','forEach','CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','union','CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?','UserId','body','some','FaxAccountId','i.FaxAccountId\x20IN\x20?','createdAt','parse','$lte','null','\x20=\x20?','read','`unreadMessages`\x20=\x200','`unreadMessages`\x20>\x200','tag','isArray','replace','isNumeric','i.id\x20LIKE\x20?','i.fax\x20LIKE\x20?','group','i.id','Sequelize','QueryTypes','clone','SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','DESC','t.id\x20IN\x20?','resolve','journey','user'];(function(_0x1f78a7,_0x1070fa){var _0x1917cb=function(_0x2fad9b){while(--_0x2fad9b){_0x1f78a7['push'](_0x1f78a7['shift']());}};_0x1917cb(++_0x1070fa);}(_0x0c2b,0x116));var _0xb0c2=function(_0x2571f6,_0x57be29){_0x2571f6=_0x2571f6-0x0;var _0xca8474=_0x0c2b[_0x2571f6];return _0xca8474;};'use strict';var pdf=require(_0xb0c2('0x0'));var emlformat=require(_0xb0c2('0x1'));var rimraf=require(_0xb0c2('0x2'));var zipdir=require('zip-dir');var jsonpatch=require(_0xb0c2('0x3'));var rp=require('request-promise');var moment=require(_0xb0c2('0x4'));var BPromise=require(_0xb0c2('0x5'));var Mustache=require('mustache');var util=require(_0xb0c2('0x6'));var path=require(_0xb0c2('0x7'));var sox=require(_0xb0c2('0x8'));var csv=require(_0xb0c2('0x9'));var ejs=require(_0xb0c2('0xa'));var fs=require('fs');var _=require(_0xb0c2('0xb'));var squel=require(_0xb0c2('0xc'));var crypto=require(_0xb0c2('0xd'));var jsforce=require(_0xb0c2('0xe'));var deskjs=require(_0xb0c2('0xf'));var toCsv=require(_0xb0c2('0x9'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0xb0c2('0x10'));var qs=require('../../components/parsers/qs');var as=require(_0xb0c2('0x11'));var hardwareService=require(_0xb0c2('0x12'));var logger=require(_0xb0c2('0x13'))(_0xb0c2('0x14'));var utils=require(_0xb0c2('0x15'));var config=require('../../config/environment');var db=require(_0xb0c2('0x16'))['db'];config['redis']=_[_0xb0c2('0x17')](config[_0xb0c2('0x18')],{'host':_0xb0c2('0x19'),'port':0x18eb});var socket=require(_0xb0c2('0x1a'))(new Redis(config[_0xb0c2('0x18')]));require(_0xb0c2('0x1b'))[_0xb0c2('0x1c')](socket);function respondWithStatusCode(_0x232934,_0x13c259){_0x13c259=_0x13c259||0xcc;return function(_0x4f2de1){if(_0x4f2de1){return _0x232934[_0xb0c2('0x1d')](_0x13c259);}return _0x232934[_0xb0c2('0x1e')](_0x13c259)[_0xb0c2('0x1f')]();};}function respondWithResult(_0x21cb72,_0x2f0cd1){_0x2f0cd1=_0x2f0cd1||0xc8;return function(_0x278ff1){if(_0x278ff1){return _0x21cb72[_0xb0c2('0x1e')](_0x2f0cd1)[_0xb0c2('0x20')](_0x278ff1);}};}function respondWithFilteredResult(_0x1ea7ac,_0x197258){return function(_0x4e9dae){if(_0x4e9dae){var _0x353f09=_0x4e9dae['count'],_0x3b3b4e=_0x197258[_0xb0c2('0x21')],_0x2b3b02=_0x197258[_0xb0c2('0x21')]+_0x197258[_0xb0c2('0x22')],_0x591a40;if(_0x2b3b02>=_0x353f09){_0x2b3b02=_0x353f09;_0x591a40=0xc8;}else{_0x591a40=0xce;}_0x1ea7ac[_0xb0c2('0x1e')](_0x591a40);return _0x1ea7ac[_0xb0c2('0x23')](_0xb0c2('0x24'),_0x3b3b4e+'-'+_0x2b3b02+'/'+_0x353f09)[_0xb0c2('0x20')](_0x4e9dae);}return null;};}function patchUpdates(_0x5cddf5){return function(_0x1461fc){try{jsonpatch[_0xb0c2('0x25')](_0x1461fc,_0x5cddf5,!![]);}catch(_0x28fc2c){return BPromise[_0xb0c2('0x26')](_0x28fc2c);}return _0x1461fc[_0xb0c2('0x27')]();};}function saveUpdates(_0x5bf57e,_0x225e53){return function(_0x4a732d){if(_0x4a732d){return _0x4a732d[_0xb0c2('0x28')](_0x5bf57e)[_0xb0c2('0x29')](function(_0x2f70d6){return _0x2f70d6;});}return null;};}function removeEntity(_0x1ae9ba,_0x24916a){return function(_0x57265f){if(_0x57265f){return _0x57265f[_0xb0c2('0x2a')]()[_0xb0c2('0x29')](function(){_0x1ae9ba[_0xb0c2('0x1e')](0xcc)[_0xb0c2('0x1f')]();});}};}function handleEntityNotFound(_0x1e4772,_0x212772){return function(_0x286232){if(!_0x286232){_0x1e4772[_0xb0c2('0x1d')](0x194);}return _0x286232;};}function handleError(_0x4d874c,_0x3ebc4f){_0x3ebc4f=_0x3ebc4f||0x1f4;return function(_0x38a046){logger[_0xb0c2('0x2b')](_0x38a046[_0xb0c2('0x2c')]);if(_0x38a046[_0xb0c2('0x2d')]){delete _0x38a046[_0xb0c2('0x2d')];}_0x4d874c[_0xb0c2('0x1e')](_0x3ebc4f)['send'](_0x38a046);};}function getInteractionUsers(_0x4318da,_0x11a11a){return new BPromise(function(_0xda41c5,_0x2e874c){try{if(_0x11a11a[_0x4318da['id']]){_0x4318da[_0xb0c2('0x2e')]=_[_0xb0c2('0x2f')](_0x11a11a[_0x4318da['id']],function(_0x1d2523){return{'id':_0x1d2523['id'],'fullname':_0x1d2523[_0xb0c2('0x30')]};});}}catch(_0x448471){_0x2e874c(_0x448471);}_0xda41c5(_0x4318da);});}function getInteractionTags(_0x4d2305,_0x8504f1){return new BPromise(function(_0xd7f61e,_0x192382){try{if(_0x4d2305[_0xb0c2('0x31')]){_0x4d2305[_0xb0c2('0x32')]=[];_0x4d2305[_0xb0c2('0x31')][_0xb0c2('0x33')](',')['forEach'](function(_0x18b802){_0x4d2305[_0xb0c2('0x32')][_0xb0c2('0x34')](_0x8504f1[_0x18b802]);});}delete _0x4d2305['TagIds'];}catch(_0x5a7ae8){_0x192382(_0x5a7ae8);}_0xd7f61e(_0x4d2305);});}function updateFaxInteraction(_0x5336ba,_0x290373,_0x4a222b){return new BPromise(function(_0x3ac32f,_0x33cf61){return getInteractionUsers(_0x5336ba,_0x4a222b)[_0xb0c2('0x29')](function(_0x2d9d19){return getInteractionTags(_0x2d9d19,_0x290373);})[_0xb0c2('0x29')](function(_0x1dcfad){_0x3ac32f(_0x1dcfad);})[_0xb0c2('0x35')](function(_0xd03793){_0x33cf61(_0xd03793);});});}exports[_0xb0c2('0x36')]=function(_0x220bc8,_0x5a28ac){var _0x3fd7a6={},_0x48f668={},_0x4fa568={'count':0x0,'rows':[]};var _0x44e172=_[_0xb0c2('0x2f')](db[_0xb0c2('0x37')]['rawAttributes'],function(_0x378b7){return{'name':_0x378b7[_0xb0c2('0x38')],'type':_0x378b7[_0xb0c2('0x39')][_0xb0c2('0x3a')]};});_0x48f668[_0xb0c2('0x3b')]=_[_0xb0c2('0x2f')](_0x44e172,'name');_0x48f668[_0xb0c2('0x3c')]=_[_0xb0c2('0x3d')](_0x220bc8[_0xb0c2('0x3c')]);_0x48f668['filters']=_[_0xb0c2('0x3e')](_0x48f668[_0xb0c2('0x3b')],_0x48f668[_0xb0c2('0x3c')]);_0x3fd7a6[_0xb0c2('0x3f')]=_[_0xb0c2('0x3e')](_0x48f668[_0xb0c2('0x3b')],qs[_0xb0c2('0x40')](_0x220bc8[_0xb0c2('0x3c')][_0xb0c2('0x40')]));_0x3fd7a6[_0xb0c2('0x3f')]=_0x3fd7a6[_0xb0c2('0x3f')]['length']?_0x3fd7a6[_0xb0c2('0x3f')]:_0x48f668[_0xb0c2('0x3b')];if(!_0x220bc8[_0xb0c2('0x3c')]['hasOwnProperty'](_0xb0c2('0x41'))){_0x3fd7a6[_0xb0c2('0x22')]=qs[_0xb0c2('0x22')](_0x220bc8['query'][_0xb0c2('0x22')]);_0x3fd7a6[_0xb0c2('0x21')]=qs[_0xb0c2('0x21')](_0x220bc8['query']['offset']);}_0x3fd7a6[_0xb0c2('0x42')]=qs[_0xb0c2('0x43')](_0x220bc8[_0xb0c2('0x3c')]['sort']);_0x3fd7a6[_0xb0c2('0x44')]=qs[_0xb0c2('0x45')](_[_0xb0c2('0x46')](_0x220bc8[_0xb0c2('0x3c')],_0x48f668['filters']));var _0xd249e4=[];var _0x3bf12d=squel[_0xb0c2('0x47')]()[_0xb0c2('0x48')]('id')['field']('name')['field'](_0xb0c2('0x49'))[_0xb0c2('0x4a')](_0xb0c2('0x4b'));var _0x343f3b=squel[_0xb0c2('0x47')]()['field'](_0xb0c2('0x4c'))[_0xb0c2('0x48')](_0xb0c2('0x4d'))['field'](_0xb0c2('0x4e'))['from']('user_has_fax_interactions','ui')[_0xb0c2('0x4f')](_0xb0c2('0x50'),'u','u.id\x20=\x20ui.UserId');var _0x4e53ae=squel[_0xb0c2('0x47')]()[_0xb0c2('0x4a')](_0xb0c2('0x51'),'i')[_0xb0c2('0x4f')](_0xb0c2('0x52'),'c',_0xb0c2('0x53'))[_0xb0c2('0x4f')](_0xb0c2('0x50'),'o',_0xb0c2('0x54'))['left_join'](_0xb0c2('0x55'),'a',_0xb0c2('0x56'))[_0xb0c2('0x4f')](_0xb0c2('0x57'),'me',_0xb0c2('0x58'))[_0xb0c2('0x4f')](_0xb0c2('0x59'),'it',_0xb0c2('0x5a'))[_0xb0c2('0x4f')](_0xb0c2('0x4b'),'t','t.id\x20=\x20it.TagId');var _0x274dbc=squel[_0xb0c2('0x5b')]();var _0x5c5fa0=[];var _0x3f107d=squel[_0xb0c2('0x5b')]();var _0x4367f6;if(_0x220bc8[_0xb0c2('0x3c')][_0xb0c2('0x5c')]){_0x4367f6=as[_0xb0c2('0x5d')](_0x220bc8[_0xb0c2('0x3c')][_0xb0c2('0x5c')]);var _0x569488=_0x4367f6[_0xb0c2('0x5e')];for(var _0x2985c5=0x0;_0x2985c5<_0x4367f6[_0xb0c2('0x5f')]['length'];_0x2985c5++){var _0x25a860=_0x4367f6[_0xb0c2('0x5f')][_0x2985c5];var _0x4e7cd2='i';var _0x2aa34a=_['find'](_0x44e172,[_0xb0c2('0x2d'),_0x25a860['field']]);if(!_0x2aa34a){switch(_0x25a860[_0xb0c2('0x48')]){case _0xb0c2('0x60'):if(_0x25a860[_0xb0c2('0x61')]==0x1){_0x4e53ae[_0xb0c2('0x62')]('`'+_0x25a860[_0xb0c2('0x48')]+_0xb0c2('0x63'));}else{_0x4e53ae['having']('`'+_0x25a860['field']+'`\x20>\x200');}break;case _0xb0c2('0x64'):if(_0x25a860[_0xb0c2('0x65')]===_0xb0c2('0x66')){if(_0x25a860['value'][_0xb0c2('0x33')]('\x20')[_0xb0c2('0x67')]>0x1){_0x274dbc[_0x569488]('MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)',qs[_0xb0c2('0x68')](_0x25a860[_0xb0c2('0x61')]),null);}else{var _0x290fac='%'+_0x25a860['value']+'%';_0x274dbc[_0x569488](_0xb0c2('0x69'),_0x290fac,_0x290fac,_0x290fac);}}else{_0x2aa34a=_[_0xb0c2('0x6a')](_0x44e172,['name',_0xb0c2('0x6b')]);_0x25a860[_0xb0c2('0x48')]=_0xb0c2('0x6b');_0xf4c186=as[_0xb0c2('0x6c')](_0x4e7cd2,_0x2aa34a['type'],_0x25a860);_0x274dbc[_0x569488](_0xf4c186[_0xb0c2('0x6d')],_0xf4c186[_0xb0c2('0x61')][_0xb0c2('0x6e')],_0xf4c186[_0xb0c2('0x61')][_0xb0c2('0x1f')]);}break;case _0xb0c2('0x6f'):var _0x2cf24b=_0x25a860[_0xb0c2('0x61')]['split'](',')[_0xb0c2('0x2f')](function(_0x51bac0){return Number(_0x51bac0);});_0x2cf24b[_0xb0c2('0x70')](function(_0x5f2da6){_0x3f107d['or'](_0xb0c2('0x71'),'%,'+_0x5f2da6+',%');});_0x5c5fa0=_[_0xb0c2('0x72')](_0x5c5fa0,_0x2cf24b);break;case'User':if(_0x25a860[_0xb0c2('0x65')]===_0xb0c2('0x66')){_0x274dbc[_0x569488](_0xb0c2('0x73'),'%'+_0x25a860[_0xb0c2('0x61')]+'%',null);}else{_0x2aa34a=_[_0xb0c2('0x6a')](_0x44e172,[_0xb0c2('0x2d'),_0xb0c2('0x74')]);_0x25a860[_0xb0c2('0x48')]=_0xb0c2('0x74');_0xf4c186=as[_0xb0c2('0x6c')](_0x4e7cd2,_0x2aa34a[_0xb0c2('0x39')],_0x25a860);_0x274dbc[_0x569488](_0xf4c186['text'],_0xf4c186[_0xb0c2('0x61')][_0xb0c2('0x6e')],_0xf4c186[_0xb0c2('0x61')]['end']);}break;case _0xb0c2('0x75'):_0xf4c186=as[_0xb0c2('0x6c')]('me',null,_0x25a860);_0x274dbc[_0x569488](_0xf4c186[_0xb0c2('0x6d')],_0xf4c186[_0xb0c2('0x61')][_0xb0c2('0x6e')],_0xf4c186[_0xb0c2('0x61')]['end']);break;}}else{var _0xf4c186=as[_0xb0c2('0x6c')](_0x4e7cd2,_0x2aa34a[_0xb0c2('0x39')],_0x25a860);_0x274dbc[_0x569488](_0xf4c186[_0xb0c2('0x6d')],_0xf4c186[_0xb0c2('0x61')][_0xb0c2('0x6e')],_0xf4c186[_0xb0c2('0x61')][_0xb0c2('0x1f')]);}}}else{var _0x19e0e1=_(_0x220bc8['query'])['keys']()[_0xb0c2('0x2f')](function(_0x1f813e){return _[_0xb0c2('0x76')](_0x44e172,[_0xb0c2('0x2d'),_0x1f813e])?_0x1f813e:undefined;})['compact']()[_0xb0c2('0x61')]();if(!_['isEmpty'](_0x19e0e1)){_0x19e0e1[_0xb0c2('0x70')](function(_0x26e47d){if(_0x26e47d===_0xb0c2('0x77')){_0x4e53ae[_0xb0c2('0x44')](_0xb0c2('0x78'),[]['concat'](_0x220bc8[_0xb0c2('0x3c')][_0x26e47d]));}else if(_0x26e47d===_0xb0c2('0x79')){var _0x4cac15=JSON[_0xb0c2('0x7a')](_0x220bc8[_0xb0c2('0x3c')][_0x26e47d])['$gte'];var _0x9da83a=JSON[_0xb0c2('0x7a')](_0x220bc8[_0xb0c2('0x3c')][_0x26e47d])[_0xb0c2('0x7b')];_0x4e53ae[_0xb0c2('0x44')]('i.createdAt\x20BETWEEN\x20?\x20AND\x20?',_0x4cac15,_0x9da83a);}else{if(_0x220bc8['query'][_0x26e47d]===_0xb0c2('0x7c')){_0x4e53ae[_0xb0c2('0x44')]('i.'+_0x26e47d+'\x20IS\x20NULL');}else{_0x4e53ae[_0xb0c2('0x44')]('i.'+_0x26e47d+_0xb0c2('0x7d'),_0x220bc8['query'][_0x26e47d]);}}});}if(_0x220bc8[_0xb0c2('0x3c')][_0xb0c2('0x7e')]){if(_0x220bc8[_0xb0c2('0x3c')]['read']==0x1){_0x4e53ae['having'](_0xb0c2('0x7f'));}else{_0x4e53ae['having'](_0xb0c2('0x80'));}}if(_0x220bc8[_0xb0c2('0x3c')][_0xb0c2('0x81')]){_0x5c5fa0=_[_0xb0c2('0x82')](_0x220bc8[_0xb0c2('0x3c')][_0xb0c2('0x81')])?_0x220bc8[_0xb0c2('0x3c')][_0xb0c2('0x81')]:new Array(_0x220bc8[_0xb0c2('0x3c')]['tag']);_0x5c5fa0['forEach'](function(_0x53615e){_0x3f107d['or'](_0xb0c2('0x71'),'%,'+_0x53615e+',%');});}if(_0x220bc8['query']['filter']){var _0x55bc8b=_0x220bc8[_0xb0c2('0x3c')]['filter'][_0xb0c2('0x83')]('\x5c','\x5c\x5c')[_0xb0c2('0x83')]('\x27\x27','\x27\x27\x27\x27');if(qs[_0xb0c2('0x84')](_0x55bc8b)){_0x274dbc['or'](_0xb0c2('0x85'),_0x55bc8b+'%')['or'](_0xb0c2('0x86'),_0x55bc8b+'%');}_0x274dbc['or']('CONCAT(c.firstName,\x20\x27\x20\x27,\x20c.lastName)\x20LIKE\x20?',_0x55bc8b+'%');}}_0x4e53ae[_0xb0c2('0x44')](_0x274dbc);_0x4e53ae[_0xb0c2('0x87')](_0xb0c2('0x88'));var _0x3872c8={'type':db[_0xb0c2('0x89')][_0xb0c2('0x8a')]['SELECT'],'raw':!![]};var _0x717438=_0x4e53ae[_0xb0c2('0x8b')]();_0x717438['field']('i.id');_0x717438[_0xb0c2('0x48')](_0xb0c2('0x8c'),_0xb0c2('0x60'));if(_0x3fd7a6[_0xb0c2('0x42')]){_0x3fd7a6[_0xb0c2('0x42')][_0xb0c2('0x70')](function(_0x38db47){_0x4e53ae[_0xb0c2('0x42')]('i.'+_0x38db47[0x0],_0x38db47[0x1]===_0xb0c2('0x8d')?![]:!![]);});}if(!_['isEmpty'](_0x5c5fa0)){_0x4e53ae[_0xb0c2('0x62')](_0x3f107d);_0x717438['where'](_0xb0c2('0x8e'),_0x5c5fa0);}BPromise[_0xb0c2('0x8f')]()[_0xb0c2('0x29')](function(){if(!_0x4367f6){if(_0x220bc8[_0xb0c2('0x3c')][_0xb0c2('0x77')]||_0x220bc8[_0xb0c2('0x3c')][_0xb0c2('0x90')])return;_0x717438[_0xb0c2('0x44')]('i.FaxAccountId\x20IS\x20NOT\x20NULL');_0x4e53ae['where']('i.FaxAccountId\x20IS\x20NOT\x20NULL');return;}return _0x220bc8[_0xb0c2('0x91')][_0xb0c2('0x92')]({'attributes':['id'],'raw':!![]})[_0xb0c2('0x29')](function(_0x5f5358){if(_['isEmpty'](_0x5f5358)){_0x717438[_0xb0c2('0x44')](_0xb0c2('0x93'));_0x4e53ae['where']('i.FaxAccountId\x20IS\x20NULL');}else{_0x717438[_0xb0c2('0x44')](_0xb0c2('0x78'),_[_0xb0c2('0x2f')](_0x5f5358,'id'));_0x4e53ae[_0xb0c2('0x44')](_0xb0c2('0x78'),_[_0xb0c2('0x2f')](_0x5f5358,'id'));}});})['then'](function(){db[_0xb0c2('0x94')][_0xb0c2('0x3c')](_0x717438[_0xb0c2('0x95')](),_0x3872c8)[_0xb0c2('0x29')](function(_0x40642e){_0x4fa568[_0xb0c2('0x96')]=_0x40642e[_0xb0c2('0x67')];if(_0x4fa568[_0xb0c2('0x96')]===0x0)return[];return db['sequelize'][_0xb0c2('0x3c')](_0x3bf12d[_0xb0c2('0x95')](),_0x3872c8)['then'](function(_0x380537){_0xd249e4=_[_0xb0c2('0x97')](_0x380537,'id');_0x3872c8=_[_0xb0c2('0x98')](_0x3872c8,{'model':db['FaxInteraction'],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x220bc8[_0xb0c2('0x3c')][_0xb0c2('0x40')]){_0x3fd7a6['attributes'][_0xb0c2('0x70')](function(_0x3a838c){_0x4e53ae['field']('i.'+_0x3a838c);});}else{_0x4e53ae[_0xb0c2('0x48')](_0xb0c2('0x8c'),_0xb0c2('0x60'));_0x4e53ae[_0xb0c2('0x48')](_0xb0c2('0x99'),_0xb0c2('0x9a'));_0x4e53ae['field'](_0xb0c2('0x9b'),'Account.mandatoryDisposition');_0x4e53ae[_0xb0c2('0x48')](_0xb0c2('0x9c'));_0x4e53ae[_0xb0c2('0x48')](_0xb0c2('0x9d'),_0xb0c2('0x9e'));_0x4e53ae[_0xb0c2('0x48')](_0xb0c2('0x9f'),_0xb0c2('0xa0'));_0x4e53ae[_0xb0c2('0x48')](_0xb0c2('0xa1'),_0xb0c2('0xa2'));_0x4e53ae[_0xb0c2('0x48')]('c.phone','Contact.phone');_0x4e53ae['field']('c.mobile',_0xb0c2('0xa3'));_0x4e53ae[_0xb0c2('0x48')](_0xb0c2('0xa4'),_0xb0c2('0xa5'));_0x4e53ae[_0xb0c2('0x48')](_0xb0c2('0xa6'),_0xb0c2('0xa7'));_0x4e53ae[_0xb0c2('0x48')](_0xb0c2('0xa8'),_0xb0c2('0xa9'));_0x4e53ae[_0xb0c2('0x48')](_0xb0c2('0xaa'),_0xb0c2('0x31'));}_0x4e53ae[_0xb0c2('0x22')](_0x3fd7a6[_0xb0c2('0x22')]);_0x4e53ae['offset'](_0x3fd7a6[_0xb0c2('0x21')]);return db[_0xb0c2('0x94')]['query'](_0x4e53ae['toString'](),_0x3872c8);})[_0xb0c2('0x29')](function(_0x42fb5f){_0x343f3b[_0xb0c2('0x44')](_0xb0c2('0xab'),_[_0xb0c2('0x2f')](_0x42fb5f,'id'));return db[_0xb0c2('0x94')][_0xb0c2('0x3c')](_0x343f3b['toString'](),_0x3872c8)[_0xb0c2('0x29')](function(_0x429776){var _0x2d3c15=_['groupBy'](_0x429776,_0xb0c2('0xac'));var _0x45f59b=[];_0x42fb5f['forEach'](function(_0x54c2e9){_0x45f59b['push'](updateFaxInteraction(_0x54c2e9,_0xd249e4,_0x2d3c15));});return BPromise[_0xb0c2('0xad')](_0x45f59b);});});})['then'](function(_0x473184){_0x4fa568['rows']=_0x473184;return _0x4fa568;})[_0xb0c2('0x29')](respondWithFilteredResult(_0x5a28ac,_0x3fd7a6));})[_0xb0c2('0x35')](handleError(_0x5a28ac,null));};exports[_0xb0c2('0xae')]=function(_0x346586,_0x5b59f5){var _0x291c4f={'raw':![],'where':{'id':_0x346586[_0xb0c2('0xaf')]['id']}},_0x1604e7={};_0x1604e7['model']=_[_0xb0c2('0x3d')](db[_0xb0c2('0x37')][_0xb0c2('0xb0')]);_0x1604e7[_0xb0c2('0x3c')]=_['keys'](_0x346586[_0xb0c2('0x3c')]);_0x1604e7[_0xb0c2('0x45')]=_['intersection'](_0x1604e7[_0xb0c2('0x3b')],_0x1604e7[_0xb0c2('0x3c')]);_0x291c4f[_0xb0c2('0x3f')]=_[_0xb0c2('0x3e')](_0x1604e7[_0xb0c2('0x3b')],qs['fields'](_0x346586[_0xb0c2('0x3c')][_0xb0c2('0x40')]));_0x291c4f[_0xb0c2('0x3f')]=_0x291c4f[_0xb0c2('0x3f')][_0xb0c2('0x67')]?_0x291c4f[_0xb0c2('0x3f')]:_0x1604e7['model'];if(_0x346586[_0xb0c2('0x3c')][_0xb0c2('0xb1')]){_0x291c4f[_0xb0c2('0xb2')]=[{'all':!![]}];}_0x291c4f=_[_0xb0c2('0x98')]({},_0x291c4f,_0x346586[_0xb0c2('0xb3')]);return db[_0xb0c2('0x37')][_0xb0c2('0x6a')](_0x291c4f)[_0xb0c2('0x29')](handleEntityNotFound(_0x5b59f5,null))[_0xb0c2('0x29')](respondWithResult(_0x5b59f5,null))[_0xb0c2('0x35')](handleError(_0x5b59f5,null));};exports[_0xb0c2('0xb4')]=function(_0x386aaa,_0x33334c){return db[_0xb0c2('0x37')][_0xb0c2('0xb4')](_0x386aaa['body'],{})['then'](respondWithResult(_0x33334c,0xc9))['catch'](handleError(_0x33334c,null));};exports[_0xb0c2('0x28')]=function(_0x52ace1,_0x1f1bb3){if(_0x52ace1[_0xb0c2('0x75')]['id']){delete _0x52ace1['body']['id'];}return db[_0xb0c2('0x37')][_0xb0c2('0x6a')]({'where':{'id':_0x52ace1[_0xb0c2('0xaf')]['id']}})[_0xb0c2('0x29')](handleEntityNotFound(_0x1f1bb3,null))[_0xb0c2('0x29')](saveUpdates(_0x52ace1[_0xb0c2('0x75')],null))[_0xb0c2('0x29')](respondWithResult(_0x1f1bb3,null))[_0xb0c2('0x35')](handleError(_0x1f1bb3,null));};exports[_0xb0c2('0x2a')]=function(_0x1b1471,_0x2c5628){return db[_0xb0c2('0x37')][_0xb0c2('0x6a')]({'where':{'id':_0x1b1471[_0xb0c2('0xaf')]['id']}})['then'](handleEntityNotFound(_0x2c5628,null))[_0xb0c2('0x29')](removeEntity(_0x2c5628,null))[_0xb0c2('0x35')](handleError(_0x2c5628,null));};exports[_0xb0c2('0xb5')]=function(_0x3bc834,_0x5d132f){return db[_0xb0c2('0x37')]['describe']()[_0xb0c2('0x29')](respondWithResult(_0x5d132f,null))['catch'](handleError(_0x5d132f,null));};exports[_0xb0c2('0xb6')]=function(_0x597917,_0x183de8,_0xfcdda4){return db[_0xb0c2('0xb7')][_0xb0c2('0x6a')]({'where':{'id':_0x597917[_0xb0c2('0xaf')]['id']}})[_0xb0c2('0x29')](handleEntityNotFound(_0x183de8,null))['then'](function(_0x59613d){if(_0x59613d){return _0x59613d[_0xb0c2('0xb6')](_0x597917[_0xb0c2('0x75')][_0xb0c2('0xb8')],_['omit'](_0x597917[_0xb0c2('0x75')],[_0xb0c2('0xb8'),'id'])||{});}})[_0xb0c2('0x29')](respondWithResult(_0x183de8,null))[_0xb0c2('0x35')](handleError(_0x183de8,null));};exports[_0xb0c2('0xb9')]=function(_0x3c1be2,_0x2122ef,_0x208813){var _0xc957bf={'raw':![],'where':{}};var _0x5005c8={};var _0x4d915e={'count':0x0,'rows':[]};return db[_0xb0c2('0x37')][_0xb0c2('0xba')]({'where':{'id':_0x3c1be2[_0xb0c2('0xaf')]['id']}})[_0xb0c2('0x29')](handleEntityNotFound(_0x2122ef,null))[_0xb0c2('0x29')](function(_0x2e6e5c){if(_0x2e6e5c){_0x5005c8[_0xb0c2('0x3b')]=_[_0xb0c2('0x3d')](db[_0xb0c2('0xb7')][_0xb0c2('0xb0')]);_0x5005c8['query']=_['keys'](_0x3c1be2[_0xb0c2('0x3c')]);_0x5005c8[_0xb0c2('0x45')]=_[_0xb0c2('0x3e')](_0x5005c8['model'],_0x5005c8[_0xb0c2('0x3c')]);_0xc957bf[_0xb0c2('0x3f')]=_[_0xb0c2('0x3e')](_0x5005c8[_0xb0c2('0x3b')],qs[_0xb0c2('0x40')](_0x3c1be2[_0xb0c2('0x3c')][_0xb0c2('0x40')]));_0xc957bf[_0xb0c2('0x3f')]=_0xc957bf[_0xb0c2('0x3f')][_0xb0c2('0x67')]?_0xc957bf[_0xb0c2('0x3f')]:_0x5005c8[_0xb0c2('0x3b')];if(!_0x3c1be2[_0xb0c2('0x3c')][_0xb0c2('0xbb')]('nolimit')){_0xc957bf[_0xb0c2('0x22')]=qs[_0xb0c2('0x22')](_0x3c1be2['query'][_0xb0c2('0x22')]);_0xc957bf[_0xb0c2('0x21')]=qs[_0xb0c2('0x21')](_0x3c1be2['query'][_0xb0c2('0x21')]);}_0xc957bf['order']=qs[_0xb0c2('0x43')](_0x3c1be2[_0xb0c2('0x3c')][_0xb0c2('0x43')]);_0xc957bf[_0xb0c2('0x44')]=qs[_0xb0c2('0x45')](_[_0xb0c2('0x46')](_0x3c1be2[_0xb0c2('0x3c')],_0x5005c8[_0xb0c2('0x45')]));_0xc957bf[_0xb0c2('0x44')][_0xb0c2('0xac')]=_0x2e6e5c['id'];if(_0x3c1be2[_0xb0c2('0x3c')][_0xb0c2('0xbc')]){_0xc957bf['where']=_[_0xb0c2('0x98')](_0xc957bf['where'],{'$or':_[_0xb0c2('0x2f')](_0xc957bf[_0xb0c2('0x3f')],function(_0x378376){var _0x7a7baf={};_0x7a7baf[_0x378376]={'$like':'%'+_0x3c1be2[_0xb0c2('0x3c')]['filter']+'%'};return _0x7a7baf;})});}if(_0x3c1be2[_0xb0c2('0x3c')][_0xb0c2('0xbd')]){var _0xeb836b=_0x3c1be2[_0xb0c2('0x3c')]['$gte'][_0xb0c2('0x33')](',');var _0x2af30f={};_0x2af30f[_0xeb836b[0x0]]={'$gte':moment(_0xeb836b[0x1])['format'](_0xb0c2('0xbe'))};_0xc957bf[_0xb0c2('0x44')]=_[_0xb0c2('0x98')](_0xc957bf['where'],_0x2af30f);}_0xc957bf=_['merge']({},_0xc957bf,_0x3c1be2['options']);return db[_0xb0c2('0xb7')][_0xb0c2('0x96')]({'where':_0xc957bf[_0xb0c2('0x44')]})[_0xb0c2('0x29')](function(_0x461f33){_0x4d915e['count']=_0x461f33;if(_0x3c1be2[_0xb0c2('0x3c')][_0xb0c2('0xb1')]){_0xc957bf[_0xb0c2('0xb2')]=[{'all':!![]}];}return db[_0xb0c2('0xb7')][_0xb0c2('0xbf')](_0xc957bf);})[_0xb0c2('0x29')](function(_0xa35a41){_0x4d915e[_0xb0c2('0xc0')]=_0xa35a41;return _0x4d915e;});}})['then'](respondWithFilteredResult(_0x2122ef,_0xc957bf))['catch'](handleError(_0x2122ef,null));};exports[_0xb0c2('0xc1')]=function(_0x17d564,_0x3431d8,_0x492ddb){return db[_0xb0c2('0x37')][_0xb0c2('0x6a')]({'where':{'id':_0x17d564['params']['id']}})[_0xb0c2('0x29')](handleEntityNotFound(_0x3431d8,null))[_0xb0c2('0x29')](function(_0x195bf2){if(_0x195bf2){return _0x195bf2[_0xb0c2('0xc2')](_0x17d564[_0xb0c2('0x75')][_0xb0c2('0xb8')],_['omit'](_0x17d564['body'],[_0xb0c2('0xb8'),'id'])||{})['spread'](function(){return db['Tag'][_0xb0c2('0xbf')]({'attributes':['id',_0xb0c2('0x2d'),_0xb0c2('0x49')],'where':{'id':_0x17d564[_0xb0c2('0x75')][_0xb0c2('0xb8')]}});})[_0xb0c2('0x29')](function(_0x57bb57){socket[_0xb0c2('0xc3')](_0xb0c2('0xc4'),{'id':Number(_0x17d564[_0xb0c2('0xaf')]['id']),'tags':_0x57bb57||[]});return{'id':Number(_0x17d564[_0xb0c2('0xaf')]['id']),'tags':_0x57bb57||[]};});}})['then'](respondWithResult(_0x3431d8,null))[_0xb0c2('0x35')](handleError(_0x3431d8,null));};exports[_0xb0c2('0xc5')]=function(_0x2501c4,_0x1e8f10,_0x20c1c1){return db[_0xb0c2('0x37')][_0xb0c2('0x6a')]({'where':{'id':_0x2501c4[_0xb0c2('0xaf')]['id']}})[_0xb0c2('0x29')](handleEntityNotFound(_0x1e8f10,null))[_0xb0c2('0x29')](function(_0x2f501e){if(_0x2f501e){return _0x2f501e[_0xb0c2('0xc5')](_0x2501c4['query']['ids']);}})[_0xb0c2('0x29')](respondWithStatusCode(_0x1e8f10,null))[_0xb0c2('0x35')](handleError(_0x1e8f10,null));};exports[_0xb0c2('0xc6')]=function(_0x334fc3,_0x49f3af){var _0x1d06d7=moment()['unix']()[_0xb0c2('0x95')]();var _0x361eb0=path[_0xb0c2('0xc7')](config[_0xb0c2('0xc8')],_0xb0c2('0xc9'),_0xb0c2('0xca'),_0xb0c2('0xcb'));var _0x472007=path[_0xb0c2('0xc7')](config[_0xb0c2('0xc8')],'server',_0xb0c2('0xca'),'attachments');var _0x434336=path[_0xb0c2('0xc7')](_0x361eb0,_0x1d06d7);var _0x5ecb87=util['format']('transcript-%d-%s.zip',_0x334fc3['params']['id'],_0x1d06d7);var _0xb358d9=path['join'](_0x361eb0,_0x5ecb87);var _0x78b202=[];_0x78b202[_0xb0c2('0x34')]({'model':db[_0xb0c2('0xcc')],'as':'Attachment','raw':!![]});var _0xc9eb49=[{'model':db[_0xb0c2('0xb7')],'as':'Messages','attributes':['id','body',_0xb0c2('0x79')],'include':_0x78b202}];return db[_0xb0c2('0x37')][_0xb0c2('0x6a')]({'where':{'id':_0x334fc3[_0xb0c2('0xaf')]['id']},'include':_0xc9eb49})[_0xb0c2('0x29')](handleEntityNotFound(_0x49f3af,null))[_0xb0c2('0x29')](function(_0x472cd8){if(_0x472cd8&&_0x472cd8[_0xb0c2('0xcd')]){var _0x10e9d8=_0x472cd8[_0xb0c2('0xce')]({'plain':!![]});fs[_0xb0c2('0xcf')](_0x434336);for(var _0x31b9ce=0x0;_0x31b9ce<_0x10e9d8[_0xb0c2('0xcd')][_0xb0c2('0x67')];_0x31b9ce++){var _0x235e8e=_0x10e9d8[_0xb0c2('0xcd')][_0x31b9ce][_0xb0c2('0xcc')];if(_0x235e8e){var _0x28ae44=path[_0xb0c2('0xc7')](_0x472007,_0x235e8e[_0xb0c2('0xd0')]);if(fs[_0xb0c2('0xd1')](_0x28ae44)){fs[_0xb0c2('0xd2')](_0x28ae44)['pipe'](fs['createWriteStream'](path['join'](_0x434336,_0x235e8e['basename'])));}}}return BPromise[_0xb0c2('0x8f')]()[_0xb0c2('0x29')](function(){return new BPromise(function(_0x40a831,_0x56ba83){zipdir(_0x434336,{'saveTo':_0xb358d9},function(_0x25bf2c,_0x532f16){if(_0x25bf2c)return _0x56ba83(_0x25bf2c);return _0x40a831(_0x532f16);});})[_0xb0c2('0x29')](function(){return new BPromise(function(_0x515dda,_0x56226b){rimraf(_0x434336,function(_0x66b74d){if(_0x66b74d)_0x56226b(_0x66b74d);return _0x515dda();});});})[_0xb0c2('0x29')](function(){return _0x49f3af[_0xb0c2('0xc6')](_0xb358d9,_0x5ecb87,function(_0x17dc4e){if(_0x17dc4e){console['log'](_0xb0c2('0xd3'),_0x17dc4e);}else{fs['unlinkSync'](_0xb358d9);}});});});}else{return _0x49f3af['sendStatus'](0xc8);}})[_0xb0c2('0x35')](handleError(_0x49f3af,null));}; \ No newline at end of file +var _0xa8cd=['attachments','push','Attachment','Messages','get','mkdirSync','existsSync','pipe','createWriteStream','basename','resolve','log','err','unlinkSync','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','to-csv','lodash','squel','crypto','desk.js','querystring','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./faxInteraction.socket','register','sendStatus','status','end','json','count','offset','set','Content-Range','reject','save','then','stack','name','send','Users','map','TagIds','Tags','split','forEach','catch','index','FaxInteraction','rawAttributes','fieldName','type','key','query','filters','intersection','model','fields','attributes','length','nolimit','limit','order','sort','pick','select','field','color','from','user_has_fax_interactions','left_join','u.id\x20=\x20ui.UserId','fax_interactions','cm_contacts','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL','users','o.id\x20=\x20i.UserId','fax_accounts','a.id\x20=\x20i.FaxAccountId','fax_messages','me.FaxInteractionId\x20=\x20i.id','it.FaxInteractionId\x20=\x20i.id','t.id\x20=\x20it.TagId','expr','parseSearch','search','sqlOperator','conditions','find','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','c.firstName\x20LIKE\x20?\x20OR\x20c.lastName\x20LIKE\x20?\x20OR\x20c.email\x20LIKE\x20?','ContactId','text','Tag','CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','union','User','CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?','UserId','start','body','buildExpression','keys','some','compact','FaxAccountId','where','createdAt','parse','null','read','`unreadMessages`\x20=\x200','`unreadMessages`\x20>\x200','isArray','tag','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?','i.id','Sequelize','SELECT','clone','SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','DESC','isEmpty','t.id\x20IN\x20?','journey','i.FaxAccountId\x20IS\x20NOT\x20NULL','user','i.FaxAccountId\x20IS\x20NULL','i.FaxAccountId\x20IN\x20?','sequelize','toString','merge','Account.key','a.mandatoryDisposition','Account.mandatoryDisposition','i.*','c.firstName','Contact.firstName','Contact.lastName','c.email','Contact.mobile','c.fax','Contact.fax','o.fullname','Owner.fullname','o.internal','Owner.internal','GROUP_CONCAT(DISTINCT\x20t.id)','FaxInteractionId','all','show','params','includeAll','options','create','update','destroy','addMessage','ids','getMessages','hasOwnProperty','$gte','format','YYYY-MM-DD\x20HH:mm:ss','FaxMessage','include','setTags','spread','findAll','emit','removeTags','download','join','root','server','files'];(function(_0x207a55,_0x29c24e){var _0x68b48a=function(_0x2d4da6){while(--_0x2d4da6){_0x207a55['push'](_0x207a55['shift']());}};_0x68b48a(++_0x29c24e);}(_0xa8cd,0x1ac));var _0xda8c=function(_0x2d994d,_0x168a27){_0x2d994d=_0x2d994d-0x0;var _0xd54be4=_0xa8cd[_0x2d994d];return _0xd54be4;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0xda8c('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xda8c('0x1'));var jsonpatch=require(_0xda8c('0x2'));var rp=require(_0xda8c('0x3'));var moment=require(_0xda8c('0x4'));var BPromise=require(_0xda8c('0x5'));var Mustache=require(_0xda8c('0x6'));var util=require('util');var path=require(_0xda8c('0x7'));var sox=require(_0xda8c('0x8'));var csv=require(_0xda8c('0x9'));var ejs=require('ejs');var fs=require('fs');var _=require(_0xda8c('0xa'));var squel=require(_0xda8c('0xb'));var crypto=require(_0xda8c('0xc'));var jsforce=require('jsforce');var deskjs=require(_0xda8c('0xd'));var toCsv=require('to-csv');var querystring=require(_0xda8c('0xe'));var Papa=require('papaparse');var Redis=require(_0xda8c('0xf'));var authService=require('../../components/auth/service');var qs=require(_0xda8c('0x10'));var as=require(_0xda8c('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xda8c('0x12'))(_0xda8c('0x13'));var utils=require(_0xda8c('0x14'));var config=require(_0xda8c('0x15'));var db=require(_0xda8c('0x16'))['db'];config[_0xda8c('0x17')]=_[_0xda8c('0x18')](config['redis'],{'host':_0xda8c('0x19'),'port':0x18eb});var socket=require(_0xda8c('0x1a'))(new Redis(config['redis']));require(_0xda8c('0x1b'))[_0xda8c('0x1c')](socket);function respondWithStatusCode(_0x4c96b4,_0x4139c7){_0x4139c7=_0x4139c7||0xcc;return function(_0x25bc79){if(_0x25bc79){return _0x4c96b4[_0xda8c('0x1d')](_0x4139c7);}return _0x4c96b4[_0xda8c('0x1e')](_0x4139c7)[_0xda8c('0x1f')]();};}function respondWithResult(_0x18cf92,_0x49d29d){_0x49d29d=_0x49d29d||0xc8;return function(_0x2f3049){if(_0x2f3049){return _0x18cf92[_0xda8c('0x1e')](_0x49d29d)[_0xda8c('0x20')](_0x2f3049);}};}function respondWithFilteredResult(_0x4b1341,_0x42c47d){return function(_0x2ae517){if(_0x2ae517){var _0x4d9eae=_0x2ae517[_0xda8c('0x21')],_0x11ad6e=_0x42c47d[_0xda8c('0x22')],_0x500f2e=_0x42c47d[_0xda8c('0x22')]+_0x42c47d['limit'],_0x42383e;if(_0x500f2e>=_0x4d9eae){_0x500f2e=_0x4d9eae;_0x42383e=0xc8;}else{_0x42383e=0xce;}_0x4b1341[_0xda8c('0x1e')](_0x42383e);return _0x4b1341[_0xda8c('0x23')](_0xda8c('0x24'),_0x11ad6e+'-'+_0x500f2e+'/'+_0x4d9eae)[_0xda8c('0x20')](_0x2ae517);}return null;};}function patchUpdates(_0x355d9d){return function(_0x3747b5){try{jsonpatch['apply'](_0x3747b5,_0x355d9d,!![]);}catch(_0x5947ed){return BPromise[_0xda8c('0x25')](_0x5947ed);}return _0x3747b5[_0xda8c('0x26')]();};}function saveUpdates(_0x4590dd,_0x29a7c8){return function(_0x4bf960){if(_0x4bf960){return _0x4bf960['update'](_0x4590dd)['then'](function(_0x43c751){return _0x43c751;});}return null;};}function removeEntity(_0x5050b3,_0x3e69e1){return function(_0xed8cd7){if(_0xed8cd7){return _0xed8cd7['destroy']()[_0xda8c('0x27')](function(){_0x5050b3[_0xda8c('0x1e')](0xcc)[_0xda8c('0x1f')]();});}};}function handleEntityNotFound(_0x14ca9f,_0x4f22ec){return function(_0x47ddb0){if(!_0x47ddb0){_0x14ca9f[_0xda8c('0x1d')](0x194);}return _0x47ddb0;};}function handleError(_0x4249ff,_0x3970d6){_0x3970d6=_0x3970d6||0x1f4;return function(_0x3bbe6f){logger['error'](_0x3bbe6f[_0xda8c('0x28')]);if(_0x3bbe6f[_0xda8c('0x29')]){delete _0x3bbe6f[_0xda8c('0x29')];}_0x4249ff['status'](_0x3970d6)[_0xda8c('0x2a')](_0x3bbe6f);};}function getInteractionUsers(_0x558dee,_0x55c4c5){return new BPromise(function(_0x393034,_0x230570){try{if(_0x55c4c5[_0x558dee['id']]){_0x558dee[_0xda8c('0x2b')]=_[_0xda8c('0x2c')](_0x55c4c5[_0x558dee['id']],function(_0x2730ea){return{'id':_0x2730ea['id'],'fullname':_0x2730ea['fullname']};});}}catch(_0x18d1fc){_0x230570(_0x18d1fc);}_0x393034(_0x558dee);});}function getInteractionTags(_0x3fcbae,_0x31b568){return new BPromise(function(_0x558d94,_0x27d16c){try{if(_0x3fcbae[_0xda8c('0x2d')]){_0x3fcbae[_0xda8c('0x2e')]=[];_0x3fcbae[_0xda8c('0x2d')][_0xda8c('0x2f')](',')[_0xda8c('0x30')](function(_0x4ecb47){_0x3fcbae[_0xda8c('0x2e')]['push'](_0x31b568[_0x4ecb47]);});}delete _0x3fcbae[_0xda8c('0x2d')];}catch(_0x390872){_0x27d16c(_0x390872);}_0x558d94(_0x3fcbae);});}function updateFaxInteraction(_0x444d84,_0x18b8f0,_0x88edba){return new BPromise(function(_0x302e11,_0x278710){return getInteractionUsers(_0x444d84,_0x88edba)['then'](function(_0x19165d){return getInteractionTags(_0x19165d,_0x18b8f0);})[_0xda8c('0x27')](function(_0x51f53a){_0x302e11(_0x51f53a);})[_0xda8c('0x31')](function(_0x3d3d44){_0x278710(_0x3d3d44);});});}exports[_0xda8c('0x32')]=function(_0x27c12a,_0x23760c){var _0x5104bf={},_0x359a43={},_0x61d757={'count':0x0,'rows':[]};var _0x338c6f=_[_0xda8c('0x2c')](db[_0xda8c('0x33')][_0xda8c('0x34')],function(_0x591ec7){return{'name':_0x591ec7[_0xda8c('0x35')],'type':_0x591ec7[_0xda8c('0x36')][_0xda8c('0x37')]};});_0x359a43['model']=_[_0xda8c('0x2c')](_0x338c6f,_0xda8c('0x29'));_0x359a43[_0xda8c('0x38')]=_['keys'](_0x27c12a[_0xda8c('0x38')]);_0x359a43[_0xda8c('0x39')]=_[_0xda8c('0x3a')](_0x359a43[_0xda8c('0x3b')],_0x359a43[_0xda8c('0x38')]);_0x5104bf['attributes']=_[_0xda8c('0x3a')](_0x359a43[_0xda8c('0x3b')],qs[_0xda8c('0x3c')](_0x27c12a[_0xda8c('0x38')][_0xda8c('0x3c')]));_0x5104bf['attributes']=_0x5104bf[_0xda8c('0x3d')][_0xda8c('0x3e')]?_0x5104bf[_0xda8c('0x3d')]:_0x359a43[_0xda8c('0x3b')];if(!_0x27c12a[_0xda8c('0x38')]['hasOwnProperty'](_0xda8c('0x3f'))){_0x5104bf['limit']=qs[_0xda8c('0x40')](_0x27c12a[_0xda8c('0x38')]['limit']);_0x5104bf[_0xda8c('0x22')]=qs[_0xda8c('0x22')](_0x27c12a['query'][_0xda8c('0x22')]);}_0x5104bf[_0xda8c('0x41')]=qs[_0xda8c('0x42')](_0x27c12a[_0xda8c('0x38')][_0xda8c('0x42')]);_0x5104bf['where']=qs[_0xda8c('0x39')](_[_0xda8c('0x43')](_0x27c12a[_0xda8c('0x38')],_0x359a43[_0xda8c('0x39')]));var _0x486b28=[];var _0x39c829=squel[_0xda8c('0x44')]()[_0xda8c('0x45')]('id')['field'](_0xda8c('0x29'))[_0xda8c('0x45')](_0xda8c('0x46'))[_0xda8c('0x47')]('tools_tags');var _0x3a847c=squel[_0xda8c('0x44')]()['field']('u.id')[_0xda8c('0x45')]('u.fullname')[_0xda8c('0x45')]('ui.FaxInteractionId')[_0xda8c('0x47')](_0xda8c('0x48'),'ui')[_0xda8c('0x49')]('users','u',_0xda8c('0x4a'));var _0xfa3930=squel[_0xda8c('0x44')]()[_0xda8c('0x47')](_0xda8c('0x4b'),'i')[_0xda8c('0x49')](_0xda8c('0x4c'),'c',_0xda8c('0x4d'))['left_join'](_0xda8c('0x4e'),'o',_0xda8c('0x4f'))[_0xda8c('0x49')](_0xda8c('0x50'),'a',_0xda8c('0x51'))[_0xda8c('0x49')](_0xda8c('0x52'),'me',_0xda8c('0x53'))[_0xda8c('0x49')]('fax_interaction_has_tags','it',_0xda8c('0x54'))[_0xda8c('0x49')]('tools_tags','t',_0xda8c('0x55'));var _0x11ab0a=squel[_0xda8c('0x56')]();var _0x16882a=[];var _0x1eb3e5=squel[_0xda8c('0x56')]();var _0x1e8be0;if(_0x27c12a[_0xda8c('0x38')]['search']){_0x1e8be0=as[_0xda8c('0x57')](_0x27c12a[_0xda8c('0x38')][_0xda8c('0x58')]);var _0x4c0118=_0x1e8be0[_0xda8c('0x59')];for(var _0x2b512a=0x0;_0x2b512a<_0x1e8be0[_0xda8c('0x5a')]['length'];_0x2b512a++){var _0x29e3ed=_0x1e8be0['conditions'][_0x2b512a];var _0xaf7823='i';var _0x25edc0=_[_0xda8c('0x5b')](_0x338c6f,['name',_0x29e3ed[_0xda8c('0x45')]]);if(!_0x25edc0){switch(_0x29e3ed[_0xda8c('0x45')]){case _0xda8c('0x5c'):if(_0x29e3ed[_0xda8c('0x5d')]==0x1){_0xfa3930[_0xda8c('0x5e')]('`'+_0x29e3ed[_0xda8c('0x45')]+_0xda8c('0x5f'));}else{_0xfa3930['having']('`'+_0x29e3ed[_0xda8c('0x45')]+'`\x20>\x200');}break;case _0xda8c('0x60'):if(_0x29e3ed[_0xda8c('0x61')]===_0xda8c('0x62')){if(_0x29e3ed[_0xda8c('0x5d')][_0xda8c('0x2f')]('\x20')['length']>0x1){_0x11ab0a[_0x4c0118](_0xda8c('0x63'),qs[_0xda8c('0x64')](_0x29e3ed['value']),null);}else{var _0xff6c3d='%'+_0x29e3ed[_0xda8c('0x5d')]+'%';_0x11ab0a[_0x4c0118](_0xda8c('0x65'),_0xff6c3d,_0xff6c3d,_0xff6c3d);}}else{_0x25edc0=_[_0xda8c('0x5b')](_0x338c6f,[_0xda8c('0x29'),_0xda8c('0x66')]);_0x29e3ed[_0xda8c('0x45')]=_0xda8c('0x66');_0xaa58d5=as['buildExpression'](_0xaf7823,_0x25edc0[_0xda8c('0x36')],_0x29e3ed);_0x11ab0a[_0x4c0118](_0xaa58d5[_0xda8c('0x67')],_0xaa58d5[_0xda8c('0x5d')]['start'],_0xaa58d5[_0xda8c('0x5d')]['end']);}break;case _0xda8c('0x68'):var _0x103290=_0x29e3ed[_0xda8c('0x5d')][_0xda8c('0x2f')](',')[_0xda8c('0x2c')](function(_0x2ad94a){return Number(_0x2ad94a);});_0x103290[_0xda8c('0x30')](function(_0x1e3f07){_0x1eb3e5['or'](_0xda8c('0x69'),'%,'+_0x1e3f07+',%');});_0x16882a=_[_0xda8c('0x6a')](_0x16882a,_0x103290);break;case _0xda8c('0x6b'):if(_0x29e3ed[_0xda8c('0x61')]===_0xda8c('0x62')){_0x11ab0a[_0x4c0118](_0xda8c('0x6c'),'%'+_0x29e3ed['value']+'%',null);}else{_0x25edc0=_['find'](_0x338c6f,[_0xda8c('0x29'),_0xda8c('0x6d')]);_0x29e3ed[_0xda8c('0x45')]=_0xda8c('0x6d');_0xaa58d5=as['buildExpression'](_0xaf7823,_0x25edc0[_0xda8c('0x36')],_0x29e3ed);_0x11ab0a[_0x4c0118](_0xaa58d5['text'],_0xaa58d5[_0xda8c('0x5d')][_0xda8c('0x6e')],_0xaa58d5[_0xda8c('0x5d')][_0xda8c('0x1f')]);}break;case _0xda8c('0x6f'):_0xaa58d5=as['buildExpression']('me',null,_0x29e3ed);_0x11ab0a[_0x4c0118](_0xaa58d5[_0xda8c('0x67')],_0xaa58d5[_0xda8c('0x5d')][_0xda8c('0x6e')],_0xaa58d5[_0xda8c('0x5d')][_0xda8c('0x1f')]);break;}}else{var _0xaa58d5=as[_0xda8c('0x70')](_0xaf7823,_0x25edc0[_0xda8c('0x36')],_0x29e3ed);_0x11ab0a[_0x4c0118](_0xaa58d5[_0xda8c('0x67')],_0xaa58d5[_0xda8c('0x5d')][_0xda8c('0x6e')],_0xaa58d5[_0xda8c('0x5d')][_0xda8c('0x1f')]);}}}else{var _0x5c7df7=_(_0x27c12a[_0xda8c('0x38')])[_0xda8c('0x71')]()['map'](function(_0x5788e2){return _[_0xda8c('0x72')](_0x338c6f,[_0xda8c('0x29'),_0x5788e2])?_0x5788e2:undefined;})[_0xda8c('0x73')]()[_0xda8c('0x5d')]();if(!_['isEmpty'](_0x5c7df7)){_0x5c7df7[_0xda8c('0x30')](function(_0x41d2e0){if(_0x41d2e0===_0xda8c('0x74')){_0xfa3930[_0xda8c('0x75')]('i.FaxAccountId\x20IN\x20?',[]['concat'](_0x27c12a['query'][_0x41d2e0]));}else if(_0x41d2e0===_0xda8c('0x76')){var _0x48c89e=JSON[_0xda8c('0x77')](_0x27c12a[_0xda8c('0x38')][_0x41d2e0])['$gte'];var _0x6fc5bd=JSON[_0xda8c('0x77')](_0x27c12a[_0xda8c('0x38')][_0x41d2e0])['$lte'];_0xfa3930[_0xda8c('0x75')]('i.createdAt\x20BETWEEN\x20?\x20AND\x20?',_0x48c89e,_0x6fc5bd);}else{if(_0x27c12a[_0xda8c('0x38')][_0x41d2e0]===_0xda8c('0x78')){_0xfa3930[_0xda8c('0x75')]('i.'+_0x41d2e0+'\x20IS\x20NULL');}else{_0xfa3930[_0xda8c('0x75')]('i.'+_0x41d2e0+'\x20=\x20?',_0x27c12a[_0xda8c('0x38')][_0x41d2e0]);}}});}if(_0x27c12a[_0xda8c('0x38')][_0xda8c('0x79')]){if(_0x27c12a[_0xda8c('0x38')][_0xda8c('0x79')]==0x1){_0xfa3930[_0xda8c('0x5e')](_0xda8c('0x7a'));}else{_0xfa3930[_0xda8c('0x5e')](_0xda8c('0x7b'));}}if(_0x27c12a[_0xda8c('0x38')]['tag']){_0x16882a=_[_0xda8c('0x7c')](_0x27c12a[_0xda8c('0x38')]['tag'])?_0x27c12a[_0xda8c('0x38')][_0xda8c('0x7d')]:new Array(_0x27c12a[_0xda8c('0x38')][_0xda8c('0x7d')]);_0x16882a[_0xda8c('0x30')](function(_0x52afff){_0x1eb3e5['or']('CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','%,'+_0x52afff+',%');});}if(_0x27c12a[_0xda8c('0x38')][_0xda8c('0x7e')]){var _0x78ec81=_0x27c12a[_0xda8c('0x38')][_0xda8c('0x7e')][_0xda8c('0x7f')]('\x5c','\x5c\x5c')[_0xda8c('0x7f')]('\x27\x27',_0xda8c('0x80'));if(qs[_0xda8c('0x81')](_0x78ec81)){_0x11ab0a['or'](_0xda8c('0x82'),_0x78ec81+'%')['or'](_0xda8c('0x83'),_0x78ec81+'%');}_0x11ab0a['or'](_0xda8c('0x84'),_0x78ec81+'%');}}_0xfa3930['where'](_0x11ab0a);_0xfa3930['group'](_0xda8c('0x85'));var _0x433086={'type':db[_0xda8c('0x86')]['QueryTypes'][_0xda8c('0x87')],'raw':!![]};var _0x1c3849=_0xfa3930[_0xda8c('0x88')]();_0x1c3849[_0xda8c('0x45')](_0xda8c('0x85'));_0x1c3849[_0xda8c('0x45')](_0xda8c('0x89'),_0xda8c('0x5c'));if(_0x5104bf[_0xda8c('0x41')]){_0x5104bf['order'][_0xda8c('0x30')](function(_0x2dfac2){_0xfa3930[_0xda8c('0x41')]('i.'+_0x2dfac2[0x0],_0x2dfac2[0x1]===_0xda8c('0x8a')?![]:!![]);});}if(!_[_0xda8c('0x8b')](_0x16882a)){_0xfa3930['having'](_0x1eb3e5);_0x1c3849[_0xda8c('0x75')](_0xda8c('0x8c'),_0x16882a);}BPromise['resolve']()[_0xda8c('0x27')](function(){if(!_0x1e8be0){if(_0x27c12a[_0xda8c('0x38')][_0xda8c('0x74')]||_0x27c12a[_0xda8c('0x38')][_0xda8c('0x8d')])return;_0x1c3849[_0xda8c('0x75')](_0xda8c('0x8e'));_0xfa3930[_0xda8c('0x75')](_0xda8c('0x8e'));return;}return _0x27c12a[_0xda8c('0x8f')]['getFaxAccounts']({'attributes':['id'],'raw':!![]})[_0xda8c('0x27')](function(_0x1ad6cf){if(_['isEmpty'](_0x1ad6cf)){_0x1c3849[_0xda8c('0x75')](_0xda8c('0x90'));_0xfa3930[_0xda8c('0x75')](_0xda8c('0x90'));}else{_0x1c3849[_0xda8c('0x75')]('i.FaxAccountId\x20IN\x20?',_[_0xda8c('0x2c')](_0x1ad6cf,'id'));_0xfa3930[_0xda8c('0x75')](_0xda8c('0x91'),_[_0xda8c('0x2c')](_0x1ad6cf,'id'));}});})[_0xda8c('0x27')](function(){db['sequelize']['query'](_0x1c3849['toString'](),_0x433086)[_0xda8c('0x27')](function(_0x2c9990){_0x61d757[_0xda8c('0x21')]=_0x2c9990['length'];if(_0x61d757[_0xda8c('0x21')]===0x0)return[];return db[_0xda8c('0x92')]['query'](_0x39c829[_0xda8c('0x93')](),_0x433086)[_0xda8c('0x27')](function(_0x40b82f){_0x486b28=_['keyBy'](_0x40b82f,'id');_0x433086=_[_0xda8c('0x94')](_0x433086,{'model':db['FaxInteraction'],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x27c12a['query']['fields']){_0x5104bf[_0xda8c('0x3d')][_0xda8c('0x30')](function(_0x1a0509){_0xfa3930[_0xda8c('0x45')]('i.'+_0x1a0509);});}else{_0xfa3930[_0xda8c('0x45')]('SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','unreadMessages');_0xfa3930['field']('a.key',_0xda8c('0x95'));_0xfa3930['field'](_0xda8c('0x96'),_0xda8c('0x97'));_0xfa3930[_0xda8c('0x45')](_0xda8c('0x98'));_0xfa3930[_0xda8c('0x45')](_0xda8c('0x99'),_0xda8c('0x9a'));_0xfa3930[_0xda8c('0x45')]('c.lastName',_0xda8c('0x9b'));_0xfa3930[_0xda8c('0x45')](_0xda8c('0x9c'),'Contact.email');_0xfa3930[_0xda8c('0x45')]('c.phone','Contact.phone');_0xfa3930['field']('c.mobile',_0xda8c('0x9d'));_0xfa3930['field'](_0xda8c('0x9e'),_0xda8c('0x9f'));_0xfa3930[_0xda8c('0x45')](_0xda8c('0xa0'),_0xda8c('0xa1'));_0xfa3930[_0xda8c('0x45')](_0xda8c('0xa2'),_0xda8c('0xa3'));_0xfa3930[_0xda8c('0x45')](_0xda8c('0xa4'),_0xda8c('0x2d'));}_0xfa3930['limit'](_0x5104bf[_0xda8c('0x40')]);_0xfa3930[_0xda8c('0x22')](_0x5104bf[_0xda8c('0x22')]);return db['sequelize'][_0xda8c('0x38')](_0xfa3930[_0xda8c('0x93')](),_0x433086);})[_0xda8c('0x27')](function(_0x4ed0e9){_0x3a847c['where']('ui.FaxInteractionId\x20IN\x20?',_[_0xda8c('0x2c')](_0x4ed0e9,'id'));return db['sequelize']['query'](_0x3a847c[_0xda8c('0x93')](),_0x433086)[_0xda8c('0x27')](function(_0x4828dd){var _0x26a5a8=_['groupBy'](_0x4828dd,_0xda8c('0xa5'));var _0x1d81e2=[];_0x4ed0e9[_0xda8c('0x30')](function(_0xbc5d4a){_0x1d81e2['push'](updateFaxInteraction(_0xbc5d4a,_0x486b28,_0x26a5a8));});return BPromise[_0xda8c('0xa6')](_0x1d81e2);});});})[_0xda8c('0x27')](function(_0x1b8d05){_0x61d757['rows']=_0x1b8d05;return _0x61d757;})[_0xda8c('0x27')](respondWithFilteredResult(_0x23760c,_0x5104bf));})[_0xda8c('0x31')](handleError(_0x23760c,null));};exports[_0xda8c('0xa7')]=function(_0x172854,_0x1652ed){var _0x2d17d8={'raw':![],'where':{'id':_0x172854[_0xda8c('0xa8')]['id']}},_0x1f6b3b={};_0x1f6b3b[_0xda8c('0x3b')]=_['keys'](db[_0xda8c('0x33')][_0xda8c('0x34')]);_0x1f6b3b['query']=_[_0xda8c('0x71')](_0x172854['query']);_0x1f6b3b['filters']=_[_0xda8c('0x3a')](_0x1f6b3b[_0xda8c('0x3b')],_0x1f6b3b[_0xda8c('0x38')]);_0x2d17d8[_0xda8c('0x3d')]=_[_0xda8c('0x3a')](_0x1f6b3b[_0xda8c('0x3b')],qs[_0xda8c('0x3c')](_0x172854[_0xda8c('0x38')]['fields']));_0x2d17d8[_0xda8c('0x3d')]=_0x2d17d8[_0xda8c('0x3d')][_0xda8c('0x3e')]?_0x2d17d8[_0xda8c('0x3d')]:_0x1f6b3b['model'];if(_0x172854[_0xda8c('0x38')][_0xda8c('0xa9')]){_0x2d17d8['include']=[{'all':!![]}];}_0x2d17d8=_[_0xda8c('0x94')]({},_0x2d17d8,_0x172854[_0xda8c('0xaa')]);return db[_0xda8c('0x33')][_0xda8c('0x5b')](_0x2d17d8)[_0xda8c('0x27')](handleEntityNotFound(_0x1652ed,null))['then'](respondWithResult(_0x1652ed,null))[_0xda8c('0x31')](handleError(_0x1652ed,null));};exports[_0xda8c('0xab')]=function(_0x225815,_0x538247){return db['FaxInteraction'][_0xda8c('0xab')](_0x225815[_0xda8c('0x6f')],{})[_0xda8c('0x27')](respondWithResult(_0x538247,0xc9))['catch'](handleError(_0x538247,null));};exports[_0xda8c('0xac')]=function(_0x319d0d,_0x20e5a5){if(_0x319d0d[_0xda8c('0x6f')]['id']){delete _0x319d0d[_0xda8c('0x6f')]['id'];}return db['FaxInteraction'][_0xda8c('0x5b')]({'where':{'id':_0x319d0d[_0xda8c('0xa8')]['id']}})[_0xda8c('0x27')](handleEntityNotFound(_0x20e5a5,null))[_0xda8c('0x27')](saveUpdates(_0x319d0d['body'],null))[_0xda8c('0x27')](respondWithResult(_0x20e5a5,null))['catch'](handleError(_0x20e5a5,null));};exports[_0xda8c('0xad')]=function(_0x105939,_0x5d4eaf){return db[_0xda8c('0x33')][_0xda8c('0x5b')]({'where':{'id':_0x105939[_0xda8c('0xa8')]['id']}})[_0xda8c('0x27')](handleEntityNotFound(_0x5d4eaf,null))[_0xda8c('0x27')](removeEntity(_0x5d4eaf,null))[_0xda8c('0x31')](handleError(_0x5d4eaf,null));};exports['describe']=function(_0x54ff8d,_0x42df8b){return db[_0xda8c('0x33')]['describe']()[_0xda8c('0x27')](respondWithResult(_0x42df8b,null))[_0xda8c('0x31')](handleError(_0x42df8b,null));};exports[_0xda8c('0xae')]=function(_0x2ed88d,_0x2e1b71,_0x3743e8){return db['FaxMessage'][_0xda8c('0x5b')]({'where':{'id':_0x2ed88d[_0xda8c('0xa8')]['id']}})[_0xda8c('0x27')](handleEntityNotFound(_0x2e1b71,null))[_0xda8c('0x27')](function(_0x451a4f){if(_0x451a4f){return _0x451a4f['addMessage'](_0x2ed88d[_0xda8c('0x6f')]['ids'],_['omit'](_0x2ed88d[_0xda8c('0x6f')],[_0xda8c('0xaf'),'id'])||{});}})[_0xda8c('0x27')](respondWithResult(_0x2e1b71,null))['catch'](handleError(_0x2e1b71,null));};exports[_0xda8c('0xb0')]=function(_0x4e4143,_0x3b77c4,_0x373a7f){var _0x5f9d4a={'raw':![],'where':{}};var _0x35c008={};var _0x4eb398={'count':0x0,'rows':[]};return db[_0xda8c('0x33')]['findOne']({'where':{'id':_0x4e4143[_0xda8c('0xa8')]['id']}})['then'](handleEntityNotFound(_0x3b77c4,null))[_0xda8c('0x27')](function(_0x5458b6){if(_0x5458b6){_0x35c008['model']=_[_0xda8c('0x71')](db['FaxMessage'][_0xda8c('0x34')]);_0x35c008[_0xda8c('0x38')]=_[_0xda8c('0x71')](_0x4e4143[_0xda8c('0x38')]);_0x35c008[_0xda8c('0x39')]=_['intersection'](_0x35c008[_0xda8c('0x3b')],_0x35c008[_0xda8c('0x38')]);_0x5f9d4a[_0xda8c('0x3d')]=_['intersection'](_0x35c008[_0xda8c('0x3b')],qs[_0xda8c('0x3c')](_0x4e4143['query']['fields']));_0x5f9d4a[_0xda8c('0x3d')]=_0x5f9d4a[_0xda8c('0x3d')]['length']?_0x5f9d4a[_0xda8c('0x3d')]:_0x35c008['model'];if(!_0x4e4143[_0xda8c('0x38')][_0xda8c('0xb1')]('nolimit')){_0x5f9d4a['limit']=qs['limit'](_0x4e4143[_0xda8c('0x38')][_0xda8c('0x40')]);_0x5f9d4a['offset']=qs['offset'](_0x4e4143[_0xda8c('0x38')]['offset']);}_0x5f9d4a[_0xda8c('0x41')]=qs[_0xda8c('0x42')](_0x4e4143['query'][_0xda8c('0x42')]);_0x5f9d4a[_0xda8c('0x75')]=qs[_0xda8c('0x39')](_['pick'](_0x4e4143[_0xda8c('0x38')],_0x35c008['filters']));_0x5f9d4a[_0xda8c('0x75')][_0xda8c('0xa5')]=_0x5458b6['id'];if(_0x4e4143[_0xda8c('0x38')][_0xda8c('0x7e')]){_0x5f9d4a[_0xda8c('0x75')]=_[_0xda8c('0x94')](_0x5f9d4a[_0xda8c('0x75')],{'$or':_[_0xda8c('0x2c')](_0x5f9d4a[_0xda8c('0x3d')],function(_0x4988f6){var _0x8f42fd={};_0x8f42fd[_0x4988f6]={'$like':'%'+_0x4e4143[_0xda8c('0x38')][_0xda8c('0x7e')]+'%'};return _0x8f42fd;})});}if(_0x4e4143[_0xda8c('0x38')][_0xda8c('0xb2')]){var _0x5bc74c=_0x4e4143[_0xda8c('0x38')]['$gte'][_0xda8c('0x2f')](',');var _0x527579={};_0x527579[_0x5bc74c[0x0]]={'$gte':moment(_0x5bc74c[0x1])[_0xda8c('0xb3')](_0xda8c('0xb4'))};_0x5f9d4a['where']=_['merge'](_0x5f9d4a['where'],_0x527579);}_0x5f9d4a=_[_0xda8c('0x94')]({},_0x5f9d4a,_0x4e4143[_0xda8c('0xaa')]);return db[_0xda8c('0xb5')][_0xda8c('0x21')]({'where':_0x5f9d4a[_0xda8c('0x75')]})[_0xda8c('0x27')](function(_0x44acd4){_0x4eb398['count']=_0x44acd4;if(_0x4e4143[_0xda8c('0x38')][_0xda8c('0xa9')]){_0x5f9d4a[_0xda8c('0xb6')]=[{'all':!![]}];}return db[_0xda8c('0xb5')]['findAll'](_0x5f9d4a);})[_0xda8c('0x27')](function(_0x283e6d){_0x4eb398['rows']=_0x283e6d;return _0x4eb398;});}})[_0xda8c('0x27')](respondWithFilteredResult(_0x3b77c4,_0x5f9d4a))[_0xda8c('0x31')](handleError(_0x3b77c4,null));};exports['addTags']=function(_0x561cf7,_0x1a2d2a,_0x1e2287){return db['FaxInteraction'][_0xda8c('0x5b')]({'where':{'id':_0x561cf7[_0xda8c('0xa8')]['id']}})[_0xda8c('0x27')](handleEntityNotFound(_0x1a2d2a,null))['then'](function(_0xafcee8){if(_0xafcee8){return _0xafcee8[_0xda8c('0xb7')](_0x561cf7[_0xda8c('0x6f')][_0xda8c('0xaf')],_['omit'](_0x561cf7[_0xda8c('0x6f')],[_0xda8c('0xaf'),'id'])||{})[_0xda8c('0xb8')](function(){return db['Tag'][_0xda8c('0xb9')]({'attributes':['id','name',_0xda8c('0x46')],'where':{'id':_0x561cf7[_0xda8c('0x6f')]['ids']}});})['then'](function(_0x275e3c){socket[_0xda8c('0xba')]('faxInteractionTags:save',{'id':Number(_0x561cf7[_0xda8c('0xa8')]['id']),'tags':_0x275e3c||[]});return{'id':Number(_0x561cf7[_0xda8c('0xa8')]['id']),'tags':_0x275e3c||[]};});}})[_0xda8c('0x27')](respondWithResult(_0x1a2d2a,null))['catch'](handleError(_0x1a2d2a,null));};exports[_0xda8c('0xbb')]=function(_0x4badfd,_0xf28ebf,_0x50c85c){return db[_0xda8c('0x33')][_0xda8c('0x5b')]({'where':{'id':_0x4badfd['params']['id']}})[_0xda8c('0x27')](handleEntityNotFound(_0xf28ebf,null))[_0xda8c('0x27')](function(_0xd1e884){if(_0xd1e884){return _0xd1e884['removeTags'](_0x4badfd['query'][_0xda8c('0xaf')]);}})['then'](respondWithStatusCode(_0xf28ebf,null))[_0xda8c('0x31')](handleError(_0xf28ebf,null));};exports[_0xda8c('0xbc')]=function(_0x116000,_0x5687e7){var _0x541ab3=moment()['unix']()['toString']();var _0x2f3ef2=path[_0xda8c('0xbd')](config[_0xda8c('0xbe')],_0xda8c('0xbf'),_0xda8c('0xc0'),'tmp');var _0x26c139=path[_0xda8c('0xbd')](config['root'],'server',_0xda8c('0xc0'),_0xda8c('0xc1'));var _0x37d5cd=path['join'](_0x2f3ef2,_0x541ab3);var _0x9a93e2=util[_0xda8c('0xb3')]('transcript-%d-%s.zip',_0x116000[_0xda8c('0xa8')]['id'],_0x541ab3);var _0x5e5d37=path[_0xda8c('0xbd')](_0x2f3ef2,_0x9a93e2);var _0x1f89ef=[];_0x1f89ef[_0xda8c('0xc2')]({'model':db[_0xda8c('0xc3')],'as':'Attachment','raw':!![]});var _0x2183bd=[{'model':db['FaxMessage'],'as':_0xda8c('0xc4'),'attributes':['id',_0xda8c('0x6f'),_0xda8c('0x76')],'include':_0x1f89ef}];return db[_0xda8c('0x33')][_0xda8c('0x5b')]({'where':{'id':_0x116000[_0xda8c('0xa8')]['id']},'include':_0x2183bd})[_0xda8c('0x27')](handleEntityNotFound(_0x5687e7,null))[_0xda8c('0x27')](function(_0x4c8ba0){if(_0x4c8ba0&&_0x4c8ba0[_0xda8c('0xc4')]){var _0x2582ec=_0x4c8ba0[_0xda8c('0xc5')]({'plain':!![]});fs[_0xda8c('0xc6')](_0x37d5cd);for(var _0x34e7c3=0x0;_0x34e7c3<_0x2582ec[_0xda8c('0xc4')][_0xda8c('0x3e')];_0x34e7c3++){var _0x41889c=_0x2582ec[_0xda8c('0xc4')][_0x34e7c3]['Attachment'];if(_0x41889c){var _0x4ce6ca=path['join'](_0x26c139,_0x41889c['basename']);if(fs[_0xda8c('0xc7')](_0x4ce6ca)){fs['createReadStream'](_0x4ce6ca)[_0xda8c('0xc8')](fs[_0xda8c('0xc9')](path[_0xda8c('0xbd')](_0x37d5cd,_0x41889c[_0xda8c('0xca')])));}}}return BPromise[_0xda8c('0xcb')]()[_0xda8c('0x27')](function(){return new BPromise(function(_0xc0d95,_0x24d4f0){zipdir(_0x37d5cd,{'saveTo':_0x5e5d37},function(_0x217da1,_0x21ff36){if(_0x217da1)return _0x24d4f0(_0x217da1);return _0xc0d95(_0x21ff36);});})[_0xda8c('0x27')](function(){return new BPromise(function(_0x2d7d6c,_0x322a7a){rimraf(_0x37d5cd,function(_0x58f481){if(_0x58f481)_0x322a7a(_0x58f481);return _0x2d7d6c();});});})[_0xda8c('0x27')](function(){return _0x5687e7[_0xda8c('0xbc')](_0x5e5d37,_0x9a93e2,function(_0x4f2d5d){if(_0x4f2d5d){console[_0xda8c('0xcc')](_0xda8c('0xcd'),_0x4f2d5d);}else{fs[_0xda8c('0xce')](_0x5e5d37);}});});});}else{return _0x5687e7[_0xda8c('0x1d')](0xc8);}})[_0xda8c('0x31')](handleError(_0x5687e7,null));}; \ No newline at end of file diff --git a/server/api/faxInteraction/faxInteraction.events.js b/server/api/faxInteraction/faxInteraction.events.js index 770bec0..f232f76 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(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x2ef3,0xba));var _0x32ef=function(_0x172fb7,_0x56c5bb){_0x172fb7=_0x172fb7-0x0;var _0x9ad70a=_0x2ef3[_0x172fb7];return _0x9ad70a;};'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 _0xadb5=['update','remove','getUsers','then','setDataValue','Users','map','findAll','unreadMessages','emit','catch','hasOwnProperty','exports','../../mysqldb','FaxMessage','setMaxListeners'];(function(_0x17b80d,_0x4561d1){var _0xf53559=function(_0x8b02ec){while(--_0x8b02ec){_0x17b80d['push'](_0x17b80d['shift']());}};_0xf53559(++_0x4561d1);}(_0xadb5,0xad));var _0x5adb=function(_0x2e3b8b,_0x16402b){_0x2e3b8b=_0x2e3b8b-0x0;var _0x90ed91=_0xadb5[_0x2e3b8b];return _0x90ed91;};'use strict';var EventEmitter=require('events');var FaxInteraction=require(_0x5adb('0x0'))['db']['FaxInteraction'];var FaxMessage=require(_0x5adb('0x0'))['db'][_0x5adb('0x1')];var FaxInteractionEvents=new EventEmitter();FaxInteractionEvents[_0x5adb('0x2')](0x0);var events={'afterCreate':'save','afterUpdate':_0x5adb('0x3'),'afterDestroy':_0x5adb('0x4')};function emitEvent(_0x2e3ef4){return function(_0x4cb1d1,_0x35a5d3,_0x168d89){_0x4cb1d1[_0x5adb('0x5')]({'attributes':['id'],'raw':!![]})[_0x5adb('0x6')](function(_0xdf3776){_0x4cb1d1[_0x5adb('0x7')](_0x5adb('0x8'),_0xdf3776[_0x5adb('0x9')](function(_0x41261c){return{'id':_0x41261c['id']};}));return FaxMessage[_0x5adb('0xa')]({'where':{'FaxInteractionId':_0x4cb1d1['id'],'direction':'in','read':![]},'raw':!![]});})[_0x5adb('0x6')](function(_0x336bad){_0x4cb1d1[_0x5adb('0x7')](_0x5adb('0xb'),_0x336bad['length']);FaxInteractionEvents['emit'](_0x2e3ef4+':'+_0x4cb1d1['id'],_0x4cb1d1);FaxInteractionEvents[_0x5adb('0xc')](_0x2e3ef4,_0x4cb1d1);_0x168d89(null);})[_0x5adb('0xd')](_0x168d89(null));};}for(var e in events){if(events[_0x5adb('0xe')](e)){var event=events[e];FaxInteraction['hook'](e,emitEvent(event));}}module[_0x5adb('0xf')]=FaxInteractionEvents; \ No newline at end of file diff --git a/server/api/faxInteraction/faxInteraction.model.js b/server/api/faxInteraction/faxInteraction.model.js index 6fcbb10..f48db74 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 _0xdf67=['exports','define','FaxInteraction','fax_interactions','changed','closedAt','format','YYYY-MM-DD\x20HH:mm:ss','lodash','util','moment','bluebird','request-promise','../../config/environment','./faxInteraction.attributes'];(function(_0x19b509,_0x100ba4){var _0x2b9958=function(_0x1be037){while(--_0x1be037){_0x19b509['push'](_0x19b509['shift']());}};_0x2b9958(++_0x100ba4);}(_0xdf67,0xad));var _0x7df6=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xdf67[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x7df6('0x0'));var util=require(_0x7df6('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0x7df6('0x2'));var BPromise=require(_0x7df6('0x3'));var rp=require(_0x7df6('0x4'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x7df6('0x5'));var attributes=require(_0x7df6('0x6'));module[_0x7df6('0x7')]=function(_0x24011a,_0x58cbae){return _0x24011a[_0x7df6('0x8')](_0x7df6('0x9'),attributes,{'tableName':_0x7df6('0xa'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x448b1b,_0x542ce0,_0x44ccfb){if(_0x448b1b[_0x7df6('0xb')]('closed')){_0x448b1b[_0x7df6('0xc')]=moment()[_0x7df6('0xd')](_0x7df6('0xe'));}_0x44ccfb(null,_0x448b1b);}}});}; \ No newline at end of file +var _0xd87c=['../../config/logger','api','moment','bluebird','path','rimraf','../../config/environment','exports','define','FaxInteraction','fax_interactions','changed','closed','format','YYYY-MM-DD\x20HH:mm:ss','lodash','util'];(function(_0x380307,_0x440ccd){var _0x9ea14b=function(_0x51024c){while(--_0x51024c){_0x380307['push'](_0x380307['shift']());}};_0x9ea14b(++_0x440ccd);}(_0xd87c,0x152));var _0xcd87=function(_0x1d40f5,_0xb19235){_0x1d40f5=_0x1d40f5-0x0;var _0x2ad578=_0xd87c[_0x1d40f5];return _0x2ad578;};'use strict';var _=require(_0xcd87('0x0'));var util=require(_0xcd87('0x1'));var logger=require(_0xcd87('0x2'))(_0xcd87('0x3'));var moment=require(_0xcd87('0x4'));var BPromise=require(_0xcd87('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xcd87('0x6'));var rimraf=require(_0xcd87('0x7'));var config=require(_0xcd87('0x8'));var attributes=require('./faxInteraction.attributes');module[_0xcd87('0x9')]=function(_0x22681e,_0x3b1faa){return _0x22681e[_0xcd87('0xa')](_0xcd87('0xb'),attributes,{'tableName':_0xcd87('0xc'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x4afb9a,_0x553263,_0x2aad3c){if(_0x4afb9a[_0xcd87('0xd')](_0xcd87('0xe'))){_0x4afb9a['closedAt']=moment()[_0xcd87('0xf')](_0xcd87('0x10'));}_0x2aad3c(null,_0x4afb9a);}}});}; \ No newline at end of file diff --git a/server/api/faxInteraction/faxInteraction.rpc.js b/server/api/faxInteraction/faxInteraction.rpc.js index 99f4dfc..2714c5f 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 _0x96e1=['FaxInteraction','update','body','options','raw','where','attributes','limit','AddTagsToFaxInteraction','find','ids','spread','AddTags','lodash','util','moment','ioredis','../../mysqldb','../../config/logger','rpc','jayson/promise','client','http','redis','localhost','socket.io-emitter','./faxInteraction.socket','register','request','then','info','FaxInteraction,\x20%s,\x20%s','request\x20sent','debug','FaxInteraction,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','UpdateFaxInteraction'];(function(_0x122d2b,_0x70044d){var _0x55ac23=function(_0x1a954b){while(--_0x1a954b){_0x122d2b['push'](_0x122d2b['shift']());}};_0x55ac23(++_0x70044d);}(_0x96e1,0x133));var _0x196e=function(_0x199572,_0x33e667){_0x199572=_0x199572-0x0;var _0x13cfa3=_0x96e1[_0x199572];return _0x13cfa3;};'use strict';var _=require(_0x196e('0x0'));var util=require(_0x196e('0x1'));var moment=require(_0x196e('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x196e('0x3'));var db=require(_0x196e('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x196e('0x5'))(_0x196e('0x6'));var config=require('../../config/environment');var jayson=require(_0x196e('0x7'));var client=jayson[_0x196e('0x8')][_0x196e('0x9')]({'port':0x232a});config['redis']=_['defaults'](config[_0x196e('0xa')],{'host':_0x196e('0xb'),'port':0x18eb});var socket=require(_0x196e('0xc'))(new Redis(config[_0x196e('0xa')]));require(_0x196e('0xd'))[_0x196e('0xe')](socket);function respondWithRpcPromise(_0x410b6f,_0x432cbc,_0x190421){return new BPromise(function(_0x3e9ed0,_0x16c567){return client[_0x196e('0xf')](_0x410b6f,_0x190421)[_0x196e('0x10')](function(_0x240d23){logger[_0x196e('0x11')](_0x196e('0x12'),_0x432cbc,_0x196e('0x13'));logger[_0x196e('0x14')](_0x196e('0x15'),_0x432cbc,_0x196e('0x13'),JSON[_0x196e('0x16')](_0x240d23));if(_0x240d23[_0x196e('0x17')]){if(_0x240d23[_0x196e('0x17')][_0x196e('0x18')]===0x1f4){logger[_0x196e('0x17')](_0x196e('0x12'),_0x432cbc,_0x240d23[_0x196e('0x17')][_0x196e('0x19')]);return _0x16c567(_0x240d23[_0x196e('0x17')][_0x196e('0x19')]);}logger[_0x196e('0x17')](_0x196e('0x12'),_0x432cbc,_0x240d23[_0x196e('0x17')]['message']);return _0x3e9ed0(_0x240d23[_0x196e('0x17')]['message']);}else{logger[_0x196e('0x11')](_0x196e('0x12'),_0x432cbc,_0x196e('0x13'));_0x3e9ed0(_0x240d23[_0x196e('0x1a')]['message']);}})[_0x196e('0x1b')](function(_0x3dfb3b){logger[_0x196e('0x17')](_0x196e('0x12'),_0x432cbc,_0x3dfb3b);_0x16c567(_0x3dfb3b);});});}exports[_0x196e('0x1c')]=function(_0x5932fa){var _0x2e017b=this;return new Promise(function(_0x3a728d,_0x4daf81){return db[_0x196e('0x1d')][_0x196e('0x1e')](_0x5932fa[_0x196e('0x1f')],{'raw':_0x5932fa[_0x196e('0x20')]?_0x5932fa[_0x196e('0x20')][_0x196e('0x21')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x5932fa['options']?_0x5932fa['options'][_0x196e('0x22')]||null:null,'attributes':_0x5932fa[_0x196e('0x20')]?_0x5932fa[_0x196e('0x20')][_0x196e('0x23')]||null:null,'limit':_0x5932fa[_0x196e('0x20')]?_0x5932fa[_0x196e('0x20')][_0x196e('0x24')]||null:null})[_0x196e('0x10')](function(_0x5015dd){logger[_0x196e('0x11')](_0x196e('0x1c'),_0x5932fa);logger[_0x196e('0x14')](_0x196e('0x1c'),_0x5932fa,JSON[_0x196e('0x16')](_0x5015dd));_0x3a728d(_0x5015dd);})[_0x196e('0x1b')](function(_0xc4fd82){logger[_0x196e('0x17')](_0x196e('0x1c'),_0xc4fd82[_0x196e('0x19')],_0x5932fa);_0x4daf81(_0x2e017b[_0x196e('0x17')](0x1f4,_0xc4fd82[_0x196e('0x19')]));});});};exports[_0x196e('0x25')]=function(_0x2760eb){return new Promise(function(_0x51335d,_0x2ae30c){return db[_0x196e('0x1d')][_0x196e('0x26')]({'where':_0x2760eb[_0x196e('0x20')]?_0x2760eb[_0x196e('0x20')][_0x196e('0x22')]||null:null})['then'](function(_0x1012c7){if(_0x1012c7){return _0x1012c7['addTags'](_0x2760eb[_0x196e('0x1f')][_0x196e('0x27')],_['omit'](_0x2760eb[_0x196e('0x1f')],['ids','id'])||{});}})[_0x196e('0x28')](function(_0x5a1bb7){logger[_0x196e('0x11')]('AddTags',_0x2760eb);logger['debug'](_0x196e('0x29'),_0x2760eb,JSON[_0x196e('0x16')](_0x5a1bb7));_0x51335d(_0x5a1bb7);})[_0x196e('0x1b')](function(_0x2110cd){logger[_0x196e('0x17')](_0x196e('0x29'),_0x2110cd[_0x196e('0x19')],_0x2760eb);_0x2ae30c(_this[_0x196e('0x17')](0x1f4,_0x2110cd['message']));});});}; \ No newline at end of file +var _0x6caf=['lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','jayson/promise','client','http','defaults','redis','socket.io-emitter','register','request','then','info','FaxInteraction,\x20%s,\x20%s','request\x20sent','debug','FaxInteraction,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','UpdateFaxInteraction','FaxInteraction','update','options','raw','where','attributes','limit','AddTagsToFaxInteraction','find','addTags','ids','omit','body','spread','AddTags'];(function(_0x59ee6f,_0x450239){var _0x4c0979=function(_0x565e92){while(--_0x565e92){_0x59ee6f['push'](_0x59ee6f['shift']());}};_0x4c0979(++_0x450239);}(_0x6caf,0x150));var _0xf6ca=function(_0xf51c06,_0x388e5b){_0xf51c06=_0xf51c06-0x0;var _0x1d5420=_0x6caf[_0xf51c06];return _0x1d5420;};'use strict';var _=require(_0xf6ca('0x0'));var util=require(_0xf6ca('0x1'));var moment=require(_0xf6ca('0x2'));var BPromise=require(_0xf6ca('0x3'));var rs=require(_0xf6ca('0x4'));var fs=require('fs');var Redis=require(_0xf6ca('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0xf6ca('0x6'));var logger=require('../../config/logger')('rpc');var config=require('../../config/environment');var jayson=require(_0xf6ca('0x7'));var client=jayson[_0xf6ca('0x8')][_0xf6ca('0x9')]({'port':0x232a});config['redis']=_[_0xf6ca('0xa')](config[_0xf6ca('0xb')],{'host':'localhost','port':0x18eb});var socket=require(_0xf6ca('0xc'))(new Redis(config[_0xf6ca('0xb')]));require('./faxInteraction.socket')[_0xf6ca('0xd')](socket);function respondWithRpcPromise(_0x5dfc4f,_0x61b37b,_0x2ebf5e){return new BPromise(function(_0x51053a,_0x38e6e9){return client[_0xf6ca('0xe')](_0x5dfc4f,_0x2ebf5e)[_0xf6ca('0xf')](function(_0xa0241e){logger[_0xf6ca('0x10')](_0xf6ca('0x11'),_0x61b37b,_0xf6ca('0x12'));logger[_0xf6ca('0x13')](_0xf6ca('0x14'),_0x61b37b,_0xf6ca('0x12'),JSON[_0xf6ca('0x15')](_0xa0241e));if(_0xa0241e[_0xf6ca('0x16')]){if(_0xa0241e[_0xf6ca('0x16')][_0xf6ca('0x17')]===0x1f4){logger['error'](_0xf6ca('0x11'),_0x61b37b,_0xa0241e[_0xf6ca('0x16')][_0xf6ca('0x18')]);return _0x38e6e9(_0xa0241e[_0xf6ca('0x16')][_0xf6ca('0x18')]);}logger[_0xf6ca('0x16')](_0xf6ca('0x11'),_0x61b37b,_0xa0241e[_0xf6ca('0x16')][_0xf6ca('0x18')]);return _0x51053a(_0xa0241e[_0xf6ca('0x16')][_0xf6ca('0x18')]);}else{logger['info']('FaxInteraction,\x20%s,\x20%s',_0x61b37b,'request\x20sent');_0x51053a(_0xa0241e['result'][_0xf6ca('0x18')]);}})[_0xf6ca('0x19')](function(_0x8d931a){logger[_0xf6ca('0x16')]('FaxInteraction,\x20%s,\x20%s',_0x61b37b,_0x8d931a);_0x38e6e9(_0x8d931a);});});}exports[_0xf6ca('0x1a')]=function(_0x90f8f4){var _0x1624f0=this;return new Promise(function(_0x3a501a,_0x2d240d){return db[_0xf6ca('0x1b')][_0xf6ca('0x1c')](_0x90f8f4['body'],{'raw':_0x90f8f4[_0xf6ca('0x1d')]?_0x90f8f4[_0xf6ca('0x1d')][_0xf6ca('0x1e')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x90f8f4[_0xf6ca('0x1d')]?_0x90f8f4[_0xf6ca('0x1d')][_0xf6ca('0x1f')]||null:null,'attributes':_0x90f8f4[_0xf6ca('0x1d')]?_0x90f8f4[_0xf6ca('0x1d')][_0xf6ca('0x20')]||null:null,'limit':_0x90f8f4[_0xf6ca('0x1d')]?_0x90f8f4[_0xf6ca('0x1d')][_0xf6ca('0x21')]||null:null})[_0xf6ca('0xf')](function(_0x484e4d){logger[_0xf6ca('0x10')](_0xf6ca('0x1a'),_0x90f8f4);logger[_0xf6ca('0x13')]('UpdateFaxInteraction',_0x90f8f4,JSON['stringify'](_0x484e4d));_0x3a501a(_0x484e4d);})[_0xf6ca('0x19')](function(_0x7bb7e3){logger[_0xf6ca('0x16')](_0xf6ca('0x1a'),_0x7bb7e3[_0xf6ca('0x18')],_0x90f8f4);_0x2d240d(_0x1624f0[_0xf6ca('0x16')](0x1f4,_0x7bb7e3[_0xf6ca('0x18')]));});});};exports[_0xf6ca('0x22')]=function(_0x2e7a13){return new Promise(function(_0x31837c,_0x210761){return db['FaxInteraction'][_0xf6ca('0x23')]({'where':_0x2e7a13[_0xf6ca('0x1d')]?_0x2e7a13[_0xf6ca('0x1d')]['where']||null:null})[_0xf6ca('0xf')](function(_0x4001b5){if(_0x4001b5){return _0x4001b5[_0xf6ca('0x24')](_0x2e7a13['body'][_0xf6ca('0x25')],_[_0xf6ca('0x26')](_0x2e7a13[_0xf6ca('0x27')],[_0xf6ca('0x25'),'id'])||{});}})[_0xf6ca('0x28')](function(_0x35ab83){logger['info'](_0xf6ca('0x29'),_0x2e7a13);logger[_0xf6ca('0x13')]('AddTags',_0x2e7a13,JSON[_0xf6ca('0x15')](_0x35ab83));_0x31837c(_0x35ab83);})[_0xf6ca('0x19')](function(_0x97e51c){logger[_0xf6ca('0x16')](_0xf6ca('0x29'),_0x97e51c['message'],_0x2e7a13);_0x210761(_this['error'](0x1f4,_0x97e51c['message']));});});}; \ No newline at end of file diff --git a/server/api/faxInteraction/faxInteraction.socket.js b/server/api/faxInteraction/faxInteraction.socket.js index 88a1819..e60e28a 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 _0xefe8=['remove','update','emit','removeListener','register','./faxInteraction.events','save'];(function(_0x4fdb0a,_0x47ddfd){var _0x57e3a2=function(_0x2c9ca6){while(--_0x2c9ca6){_0x4fdb0a['push'](_0x4fdb0a['shift']());}};_0x57e3a2(++_0x47ddfd);}(_0xefe8,0x1a9));var _0x8efe=function(_0x42387e,_0x59f43c){_0x42387e=_0x42387e-0x0;var _0x2292e2=_0xefe8[_0x42387e];return _0x2292e2;};'use strict';var FaxInteractionEvents=require(_0x8efe('0x0'));var events=[_0x8efe('0x1'),_0x8efe('0x2'),_0x8efe('0x3')];function createListener(_0x4630e5,_0x40eefe){return function(_0x590e6e){_0x40eefe[_0x8efe('0x4')](_0x4630e5,_0x590e6e);};}function removeListener(_0x5ceaa5,_0x1217e2){return function(){FaxInteractionEvents[_0x8efe('0x5')](_0x5ceaa5,_0x1217e2);};}exports[_0x8efe('0x6')]=function(_0xd748c3){for(var _0x2c2fa9=0x0,_0x2eed00=events['length'];_0x2c2fa9<_0x2eed00;_0x2c2fa9++){var _0x1e12b1=events[_0x2c2fa9];var _0x2282d0=createListener('faxInteraction:'+_0x1e12b1,_0xd748c3);FaxInteractionEvents['on'](_0x1e12b1,_0x2282d0);}}; \ No newline at end of file +var _0x5aea=['./faxInteraction.events','save','remove','update','emit','removeListener','length','faxInteraction:'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x5aea,0xd0));var _0xa5ae=function(_0x36aa92,_0x569b54){_0x36aa92=_0x36aa92-0x0;var _0x51e398=_0x5aea[_0x36aa92];return _0x51e398;};'use strict';var FaxInteractionEvents=require(_0xa5ae('0x0'));var events=[_0xa5ae('0x1'),_0xa5ae('0x2'),_0xa5ae('0x3')];function createListener(_0x3bf898,_0x1ed881){return function(_0x48b867){_0x1ed881[_0xa5ae('0x4')](_0x3bf898,_0x48b867);};}function removeListener(_0x5d17f4,_0x583577){return function(){FaxInteractionEvents[_0xa5ae('0x5')](_0x5d17f4,_0x583577);};}exports['register']=function(_0x26c7af){for(var _0x459bcc=0x0,_0x1cd873=events[_0xa5ae('0x6')];_0x459bcc<_0x1cd873;_0x459bcc++){var _0x2cd5ca=events[_0x459bcc];var _0x4b1ec3=createListener(_0xa5ae('0x7')+_0x2cd5ca,_0x26c7af);FaxInteractionEvents['on'](_0x2cd5ca,_0x4b1ec3);}}; \ No newline at end of file diff --git a/server/api/faxInteraction/index.js b/server/api/faxInteraction/index.js index 6e37e4c..a040845 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 _0x6d9f=['create','addMessage','/:id/tags','tracked','fax','put','faxinteraction:update','faxinteraction:destroy','destroy','delete','removeTags','exports','connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','describe','/:id','show','/:id/messages','getMessages','/:id/download','download','post'];(function(_0x375f65,_0x13e9fa){var _0x514d3b=function(_0x339e45){while(--_0x339e45){_0x375f65['push'](_0x375f65['shift']());}};_0x514d3b(++_0x13e9fa);}(_0x6d9f,0x16b));var _0xf6d9=function(_0x11f5da,_0x1441ed){_0x11f5da=_0x11f5da-0x0;var _0x3c46d5=_0x6d9f[_0x11f5da];return _0x3c46d5;};'use strict';var multer=require('multer');var util=require('util');var path=require('path');var timeout=require(_0xf6d9('0x0'));var express=require(_0xf6d9('0x1'));var router=express['Router']();var auth=require(_0xf6d9('0x2'));var interaction=require(_0xf6d9('0x3'));var config=require(_0xf6d9('0x4'));var controller=require('./faxInteraction.controller');router[_0xf6d9('0x5')]('/',auth['isAuthenticated'](),controller['index']);router[_0xf6d9('0x5')]('/describe',auth[_0xf6d9('0x6')](),controller[_0xf6d9('0x7')]);router[_0xf6d9('0x5')](_0xf6d9('0x8'),auth[_0xf6d9('0x6')](),controller[_0xf6d9('0x9')]);router['get'](_0xf6d9('0xa'),auth[_0xf6d9('0x6')](),controller[_0xf6d9('0xb')]);router['get'](_0xf6d9('0xc'),auth[_0xf6d9('0x6')](),controller[_0xf6d9('0xd')]);router[_0xf6d9('0xe')]('/',auth[_0xf6d9('0x6')](),controller[_0xf6d9('0xf')]);router[_0xf6d9('0xe')](_0xf6d9('0xa'),auth['isAuthenticated'](),controller[_0xf6d9('0x10')]);router[_0xf6d9('0xe')](_0xf6d9('0x11'),auth['isAuthenticated'](),interaction[_0xf6d9('0x12')](_0xf6d9('0x13'),'faxinteraction:addtags'),controller['addTags']);router[_0xf6d9('0x14')](_0xf6d9('0x8'),auth[_0xf6d9('0x6')](),interaction['tracked'](_0xf6d9('0x13'),_0xf6d9('0x15')),controller['update']);router['delete']('/:id',auth[_0xf6d9('0x6')](),interaction[_0xf6d9('0x12')](_0xf6d9('0x13'),_0xf6d9('0x16')),controller[_0xf6d9('0x17')]);router[_0xf6d9('0x18')](_0xf6d9('0x11'),auth[_0xf6d9('0x6')](),controller[_0xf6d9('0x19')]);module[_0xf6d9('0x1a')]=router; \ No newline at end of file +var _0x03a2=['faxinteraction:update','update','delete','removeTags','exports','multer','express','Router','../../components/interaction/service','../../config/environment','./faxInteraction.controller','get','isAuthenticated','index','/describe','describe','/:id','show','/:id/messages','getMessages','/:id/download','download','post','create','addMessage','/:id/tags','tracked','fax','faxinteraction:addtags','addTags'];(function(_0x3ff085,_0x27c92e){var _0x2b68c3=function(_0x37811e){while(--_0x37811e){_0x3ff085['push'](_0x3ff085['shift']());}};_0x2b68c3(++_0x27c92e);}(_0x03a2,0xd7));var _0x203a=function(_0x3953e7,_0x382bb4){_0x3953e7=_0x3953e7-0x0;var _0x334473=_0x03a2[_0x3953e7];return _0x334473;};'use strict';var multer=require(_0x203a('0x0'));var util=require('util');var path=require('path');var timeout=require('connect-timeout');var express=require(_0x203a('0x1'));var router=express[_0x203a('0x2')]();var auth=require('../../components/auth/service');var interaction=require(_0x203a('0x3'));var config=require(_0x203a('0x4'));var controller=require(_0x203a('0x5'));router[_0x203a('0x6')]('/',auth[_0x203a('0x7')](),controller[_0x203a('0x8')]);router[_0x203a('0x6')](_0x203a('0x9'),auth['isAuthenticated'](),controller[_0x203a('0xa')]);router[_0x203a('0x6')](_0x203a('0xb'),auth[_0x203a('0x7')](),controller[_0x203a('0xc')]);router[_0x203a('0x6')](_0x203a('0xd'),auth['isAuthenticated'](),controller[_0x203a('0xe')]);router['get'](_0x203a('0xf'),auth[_0x203a('0x7')](),controller[_0x203a('0x10')]);router[_0x203a('0x11')]('/',auth[_0x203a('0x7')](),controller[_0x203a('0x12')]);router[_0x203a('0x11')]('/:id/messages',auth['isAuthenticated'](),controller[_0x203a('0x13')]);router['post'](_0x203a('0x14'),auth[_0x203a('0x7')](),interaction[_0x203a('0x15')](_0x203a('0x16'),_0x203a('0x17')),controller[_0x203a('0x18')]);router['put'](_0x203a('0xb'),auth['isAuthenticated'](),interaction[_0x203a('0x15')]('fax',_0x203a('0x19')),controller[_0x203a('0x1a')]);router[_0x203a('0x1b')](_0x203a('0xb'),auth[_0x203a('0x7')](),interaction['tracked'](_0x203a('0x16'),'faxinteraction:destroy'),controller['destroy']);router[_0x203a('0x1b')](_0x203a('0x14'),auth[_0x203a('0x7')](),controller[_0x203a('0x1c')]);module[_0x203a('0x1d')]=router; \ No newline at end of file diff --git a/server/api/faxMessage/faxMessage.attributes.js b/server/api/faxMessage/faxMessage.attributes.js index 174572e..17a3ee6 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 _0x719e=['medium','BOOLEAN','DATE','TEXT'];(function(_0x16b9ed,_0x56517a){var _0x66b1f8=function(_0x1c883){while(--_0x1c883){_0x16b9ed['push'](_0x16b9ed['shift']());}};_0x66b1f8(++_0x56517a);}(_0x719e,0x1cf));var _0xe719=function(_0x403c20,_0x4a7b99){_0x403c20=_0x403c20-0x0;var _0x2b271a=_0x719e[_0x403c20];return _0x2b271a;};'use strict';var Sequelize=require('sequelize');module['exports']={'body':{'type':Sequelize[_0xe719('0x0')](_0xe719('0x1')),'allowNull':![]},'read':{'type':Sequelize[_0xe719('0x2')],'defaultValue':![]},'direction':{'type':Sequelize['ENUM']('in','out'),'defaultValue':'out','allowNull':![]},'failMessage':{'type':Sequelize[_0xe719('0x0')],'defaultValue':null},'readAt':{'type':Sequelize[_0xe719('0x3')]}}; \ No newline at end of file +var _0x2867=['TEXT','BOOLEAN','ENUM','out','DATE','sequelize','exports'];(function(_0x369126,_0x327180){var _0xdc650b=function(_0x5157ca){while(--_0x5157ca){_0x369126['push'](_0x369126['shift']());}};_0xdc650b(++_0x327180);}(_0x2867,0x91));var _0x7286=function(_0x49282b,_0x4e2125){_0x49282b=_0x49282b-0x0;var _0xcb542e=_0x2867[_0x49282b];return _0xcb542e;};'use strict';var Sequelize=require(_0x7286('0x0'));module[_0x7286('0x1')]={'body':{'type':Sequelize[_0x7286('0x2')]('medium'),'allowNull':![]},'read':{'type':Sequelize[_0x7286('0x3')],'defaultValue':![]},'direction':{'type':Sequelize[_0x7286('0x4')]('in',_0x7286('0x5')),'defaultValue':'out','allowNull':![]},'failMessage':{'type':Sequelize[_0x7286('0x2')],'defaultValue':null},'readAt':{'type':Sequelize[_0x7286('0x6')]}}; \ No newline at end of file diff --git a/server/api/faxMessage/faxMessage.controller.js b/server/api/faxMessage/faxMessage.controller.js index a48e368..a35af24 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(_0x33d0cc,_0x2f659c){var _0x4ca20c=function(_0x446f93){while(--_0x446f93){_0x33d0cc['push'](_0x33d0cc['shift']());}};_0x4ca20c(++_0x2f659c);}(_0xb10b,0x12a));var _0xbb10=function(_0x2040dd,_0x156a63){_0x2040dd=_0x2040dd-0x0;var _0x27688f=_0xb10b[_0x2040dd];return _0x27688f;};'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 _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(_0x2fabdd,_0xf5e708){var _0x3c50a3=function(_0x218558){while(--_0x218558){_0x2fabdd['push'](_0x2fabdd['shift']());}};_0x3c50a3(++_0xf5e708);}(_0xb10b,0x12a));var _0xbb10=function(_0x51bb38,_0x4e57a0){_0x51bb38=_0x51bb38-0x0;var _0x51c09b=_0xb10b[_0x51bb38];return _0x51c09b;};'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 diff --git a/server/api/faxMessage/faxMessage.events.js b/server/api/faxMessage/faxMessage.events.js index a764ad4..5d792ad 100644 --- a/server/api/faxMessage/faxMessage.events.js +++ b/server/api/faxMessage/faxMessage.events.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x008c=['save','remove','emit','hasOwnProperty','hook','events','../../mysqldb','FaxMessage','setMaxListeners'];(function(_0x2f8a45,_0x404242){var _0x438a03=function(_0x179863){while(--_0x179863){_0x2f8a45['push'](_0x2f8a45['shift']());}};_0x438a03(++_0x404242);}(_0x008c,0x188));var _0xc008=function(_0x9f05d9,_0x2ff1ca){_0x9f05d9=_0x9f05d9-0x0;var _0x5028a1=_0x008c[_0x9f05d9];return _0x5028a1;};'use strict';var EventEmitter=require(_0xc008('0x0'));var FaxMessage=require(_0xc008('0x1'))['db'][_0xc008('0x2')];var FaxMessageEvents=new EventEmitter();FaxMessageEvents[_0xc008('0x3')](0x0);var events={'afterCreate':_0xc008('0x4'),'afterUpdate':'update','afterDestroy':_0xc008('0x5')};function emitEvent(_0x47063f){return function(_0x10b33c,_0x163bd9,_0x1cbe76){FaxMessageEvents[_0xc008('0x6')](_0x47063f+':'+_0x10b33c['id'],_0x10b33c);FaxMessageEvents[_0xc008('0x6')](_0x47063f,_0x10b33c);_0x1cbe76(null);};}for(var e in events){if(events[_0xc008('0x7')](e)){var event=events[e];FaxMessage[_0xc008('0x8')](e,emitEvent(event));}}module['exports']=FaxMessageEvents; \ No newline at end of file +var _0xe14b=['hasOwnProperty','hook','exports','events','../../mysqldb','save','update','emit'];(function(_0x397e5f,_0x454c8f){var _0x5302b8=function(_0x1a29ef){while(--_0x1a29ef){_0x397e5f['push'](_0x397e5f['shift']());}};_0x5302b8(++_0x454c8f);}(_0xe14b,0x93));var _0xbe14=function(_0x5b9fc2,_0x161498){_0x5b9fc2=_0x5b9fc2-0x0;var _0x2a8c2a=_0xe14b[_0x5b9fc2];return _0x2a8c2a;};'use strict';var EventEmitter=require(_0xbe14('0x0'));var FaxMessage=require(_0xbe14('0x1'))['db']['FaxMessage'];var FaxMessageEvents=new EventEmitter();FaxMessageEvents['setMaxListeners'](0x0);var events={'afterCreate':_0xbe14('0x2'),'afterUpdate':_0xbe14('0x3'),'afterDestroy':'remove'};function emitEvent(_0x7d3665){return function(_0x5ce8fb,_0x496c04,_0x1833e3){FaxMessageEvents[_0xbe14('0x4')](_0x7d3665+':'+_0x5ce8fb['id'],_0x5ce8fb);FaxMessageEvents[_0xbe14('0x4')](_0x7d3665,_0x5ce8fb);_0x1833e3(null);};}for(var e in events){if(events[_0xbe14('0x5')](e)){var event=events[e];FaxMessage[_0xbe14('0x6')](e,emitEvent(event));}}module[_0xbe14('0x7')]=FaxMessageEvents; \ No newline at end of file diff --git a/server/api/faxMessage/faxMessage.model.js b/server/api/faxMessage/faxMessage.model.js index 7e8d575..3428301 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 _0xc4c7=['./faxMessage.attributes','exports','define','FaxMessage','fti_fax_messages','body','FULLTEXT','models','get','direction','toLowerCase','out','secret','isNil','UserId','FaxInteraction','FaxInteractionId','update','createdAt','catch','error','utf8mb4','lodash','util','moment','bluebird','rimraf','../../config/environment'];(function(_0x2ece65,_0x419a93){var _0x26c4f5=function(_0x5b03de){while(--_0x5b03de){_0x2ece65['push'](_0x2ece65['shift']());}};_0x26c4f5(++_0x419a93);}(_0xc4c7,0x166));var _0x7c4c=function(_0x18f152,_0x41585a){_0x18f152=_0x18f152-0x0;var _0xa10b34=_0xc4c7[_0x18f152];return _0xa10b34;};'use strict';var _=require(_0x7c4c('0x0'));var util=require(_0x7c4c('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0x7c4c('0x2'));var BPromise=require(_0x7c4c('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x7c4c('0x4'));var config=require(_0x7c4c('0x5'));var attributes=require(_0x7c4c('0x6'));module[_0x7c4c('0x7')]=function(_0x47ab52,_0x3237ff){return _0x47ab52[_0x7c4c('0x8')](_0x7c4c('0x9'),attributes,{'tableName':'fax_messages','paranoid':![],'indexes':[{'name':_0x7c4c('0xa'),'fields':[_0x7c4c('0xb')],'type':_0x7c4c('0xc')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x463071,_0x4b447a,_0x84ab30){var _0x4eefbf=_0x47ab52[_0x7c4c('0xd')];var _0xf64088=_0x463071[_0x7c4c('0xe')]({'plain':!![]});if(_0xf64088[_0x7c4c('0xf')]['toLowerCase']()==='in'||_0xf64088[_0x7c4c('0xf')][_0x7c4c('0x10')]()===_0x7c4c('0x11')&&!_0xf64088[_0x7c4c('0x12')]&&!_[_0x7c4c('0x13')](_0xf64088[_0x7c4c('0x14')])){_0x4eefbf[_0x7c4c('0x15')]['findOne']({'where':{'id':_0xf64088[_0x7c4c('0x16')]}})['then'](function(_0x3d42de){if(_0x3d42de){_0x3d42de[_0x7c4c('0x17')]({'lastMsgAt':_0xf64088[_0x7c4c('0x18')],'lastMsgDirection':_0xf64088[_0x7c4c('0xf')][_0x7c4c('0x10')]()});}})[_0x7c4c('0x19')](function(_0x276864){console[_0x7c4c('0x1a')](_0x276864);});}_0x84ab30();}},'charset':_0x7c4c('0x1b'),'collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file +var _0x94c9=['out','secret','isNil','UserId','FaxInteraction','findOne','FaxInteractionId','then','createdAt','catch','utf8mb4','utf8mb4_unicode_ci','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','exports','define','fax_messages','fti_fax_messages','body','FULLTEXT','models','get','direction','toLowerCase'];(function(_0x48fe16,_0x4d31fd){var _0x50816f=function(_0x45e25d){while(--_0x45e25d){_0x48fe16['push'](_0x48fe16['shift']());}};_0x50816f(++_0x4d31fd);}(_0x94c9,0x156));var _0x994c=function(_0x1ec905,_0x4c1778){_0x1ec905=_0x1ec905-0x0;var _0xc69fe=_0x94c9[_0x1ec905];return _0xc69fe;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x994c('0x0'))(_0x994c('0x1'));var moment=require(_0x994c('0x2'));var BPromise=require(_0x994c('0x3'));var rp=require(_0x994c('0x4'));var fs=require('fs');var path=require(_0x994c('0x5'));var rimraf=require(_0x994c('0x6'));var config=require(_0x994c('0x7'));var attributes=require('./faxMessage.attributes');module[_0x994c('0x8')]=function(_0x3f78ae,_0x54d663){return _0x3f78ae[_0x994c('0x9')]('FaxMessage',attributes,{'tableName':_0x994c('0xa'),'paranoid':![],'indexes':[{'name':_0x994c('0xb'),'fields':[_0x994c('0xc')],'type':_0x994c('0xd')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x9b6ea5,_0x328647,_0x3ec4dd){var _0x2c164d=_0x3f78ae[_0x994c('0xe')];var _0xc6d019=_0x9b6ea5[_0x994c('0xf')]({'plain':!![]});if(_0xc6d019[_0x994c('0x10')][_0x994c('0x11')]()==='in'||_0xc6d019[_0x994c('0x10')][_0x994c('0x11')]()===_0x994c('0x12')&&!_0xc6d019[_0x994c('0x13')]&&!_[_0x994c('0x14')](_0xc6d019[_0x994c('0x15')])){_0x2c164d[_0x994c('0x16')][_0x994c('0x17')]({'where':{'id':_0xc6d019[_0x994c('0x18')]}})[_0x994c('0x19')](function(_0x282738){if(_0x282738){_0x282738['update']({'lastMsgAt':_0xc6d019[_0x994c('0x1a')],'lastMsgDirection':_0xc6d019[_0x994c('0x10')][_0x994c('0x11')]()});}})[_0x994c('0x1b')](function(_0x3f33c7){console['error'](_0x3f33c7);});}_0x3ec4dd();}},'charset':_0x994c('0x1c'),'collate':_0x994c('0x1d')});}; \ No newline at end of file diff --git a/server/api/faxMessage/faxMessage.rpc.js b/server/api/faxMessage/faxMessage.rpc.js index a7a9634..e76d703 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 _0x26b9=['jayson/promise','client','http','localhost','socket.io-emitter','redis','./faxMessage.socket','register','request','then','info','FaxMessage,\x20%s,\x20%s','request\x20sent','debug','error','message','result','catch','CreateFaxMessage','FaxMessage','body','options','raw','stringify','update','where','attributes','limit','UpdateFaxMessage','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment'];(function(_0x5b644e,_0x2e5e07){var _0x49c6bf=function(_0x3032d9){while(--_0x3032d9){_0x5b644e['push'](_0x5b644e['shift']());}};_0x49c6bf(++_0x2e5e07);}(_0x26b9,0xb1));var _0x926b=function(_0x804022,_0x1c1df1){_0x804022=_0x804022-0x0;var _0xf804a8=_0x26b9[_0x804022];return _0xf804a8;};'use strict';var _=require('lodash');var util=require(_0x926b('0x0'));var moment=require('moment');var BPromise=require(_0x926b('0x1'));var rs=require(_0x926b('0x2'));var fs=require('fs');var Redis=require(_0x926b('0x3'));var db=require(_0x926b('0x4'))['db'];var utils=require(_0x926b('0x5'));var logger=require(_0x926b('0x6'))('rpc');var config=require(_0x926b('0x7'));var jayson=require(_0x926b('0x8'));var client=jayson[_0x926b('0x9')][_0x926b('0xa')]({'port':0x232a});config['redis']=_['defaults'](config['redis'],{'host':_0x926b('0xb'),'port':0x18eb});var socket=require(_0x926b('0xc'))(new Redis(config[_0x926b('0xd')]));require(_0x926b('0xe'))[_0x926b('0xf')](socket);function respondWithRpcPromise(_0x22be9e,_0x1aa234,_0x181e96){return new BPromise(function(_0x15422d,_0x45c518){return client[_0x926b('0x10')](_0x22be9e,_0x181e96)[_0x926b('0x11')](function(_0x13e92f){logger[_0x926b('0x12')](_0x926b('0x13'),_0x1aa234,_0x926b('0x14'));logger[_0x926b('0x15')]('FaxMessage,\x20%s,\x20%s,\x20%s',_0x1aa234,'request\x20sent',JSON['stringify'](_0x13e92f));if(_0x13e92f[_0x926b('0x16')]){if(_0x13e92f[_0x926b('0x16')]['code']===0x1f4){logger[_0x926b('0x16')](_0x926b('0x13'),_0x1aa234,_0x13e92f['error']['message']);return _0x45c518(_0x13e92f[_0x926b('0x16')][_0x926b('0x17')]);}logger[_0x926b('0x16')](_0x926b('0x13'),_0x1aa234,_0x13e92f[_0x926b('0x16')][_0x926b('0x17')]);return _0x15422d(_0x13e92f[_0x926b('0x16')][_0x926b('0x17')]);}else{logger[_0x926b('0x12')](_0x926b('0x13'),_0x1aa234,_0x926b('0x14'));_0x15422d(_0x13e92f[_0x926b('0x18')][_0x926b('0x17')]);}})[_0x926b('0x19')](function(_0x500864){logger['error'](_0x926b('0x13'),_0x1aa234,_0x500864);_0x45c518(_0x500864);});});}exports[_0x926b('0x1a')]=function(_0x3b6a6e){var _0x4b105d=this;return new Promise(function(_0x6ebdc9,_0x594ac6){return db[_0x926b('0x1b')]['create'](_0x3b6a6e[_0x926b('0x1c')],{'raw':_0x3b6a6e[_0x926b('0x1d')]?_0x3b6a6e[_0x926b('0x1d')][_0x926b('0x1e')]===undefined?!![]:![]:!![]})[_0x926b('0x11')](function(_0x3741f2){logger[_0x926b('0x12')](_0x926b('0x1a'),_0x3b6a6e);logger[_0x926b('0x15')](_0x926b('0x1a'),_0x3b6a6e,JSON[_0x926b('0x1f')](_0x3741f2));_0x6ebdc9(_0x3741f2);})[_0x926b('0x19')](function(_0x3ec748){logger[_0x926b('0x16')](_0x926b('0x1a'),_0x3ec748[_0x926b('0x17')],_0x3b6a6e);_0x594ac6(_0x4b105d['error'](0x1f4,_0x3ec748['message']));});});};exports['UpdateFaxMessage']=function(_0x5216a5){var _0x3fa8ef=this;return new Promise(function(_0x3315d1,_0x1e9d97){return db['FaxMessage'][_0x926b('0x20')](_0x5216a5[_0x926b('0x1c')],{'raw':_0x5216a5[_0x926b('0x1d')]?_0x5216a5[_0x926b('0x1d')][_0x926b('0x1e')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x5216a5[_0x926b('0x1d')]?_0x5216a5[_0x926b('0x1d')][_0x926b('0x21')]||null:null,'attributes':_0x5216a5[_0x926b('0x1d')]?_0x5216a5[_0x926b('0x1d')][_0x926b('0x22')]||null:null,'limit':_0x5216a5[_0x926b('0x1d')]?_0x5216a5['options'][_0x926b('0x23')]||null:null})['then'](function(_0x1a15a5){logger['info']('UpdateFaxMessage',_0x5216a5);logger['debug'](_0x926b('0x24'),_0x5216a5,JSON[_0x926b('0x1f')](_0x1a15a5));_0x3315d1(_0x1a15a5);})[_0x926b('0x19')](function(_0x2f772e){logger[_0x926b('0x16')](_0x926b('0x24'),_0x2f772e[_0x926b('0x17')],_0x5216a5);_0x1e9d97(_0x3fa8ef[_0x926b('0x16')](0x1f4,_0x2f772e[_0x926b('0x17')]));});});}; \ No newline at end of file +var _0x8f5d=['FaxMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','CreateFaxMessage','create','body','options','raw','UpdateFaxMessage','FaxMessage','update','lodash','moment','randomstring','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','register','request','then','info','FaxMessage,\x20%s,\x20%s','request\x20sent','debug'];(function(_0x2ff666,_0x58bc93){var _0x330bd0=function(_0x289249){while(--_0x289249){_0x2ff666['push'](_0x2ff666['shift']());}};_0x330bd0(++_0x58bc93);}(_0x8f5d,0x10b));var _0xd8f5=function(_0x44bcb0,_0x235aa9){_0x44bcb0=_0x44bcb0-0x0;var _0xfaf881=_0x8f5d[_0x44bcb0];return _0xfaf881;};'use strict';var _=require(_0xd8f5('0x0'));var util=require('util');var moment=require(_0xd8f5('0x1'));var BPromise=require('bluebird');var rs=require(_0xd8f5('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0xd8f5('0x3'));var logger=require(_0xd8f5('0x4'))(_0xd8f5('0x5'));var config=require(_0xd8f5('0x6'));var jayson=require(_0xd8f5('0x7'));var client=jayson[_0xd8f5('0x8')][_0xd8f5('0x9')]({'port':0x232a});config[_0xd8f5('0xa')]=_[_0xd8f5('0xb')](config[_0xd8f5('0xa')],{'host':_0xd8f5('0xc'),'port':0x18eb});var socket=require(_0xd8f5('0xd'))(new Redis(config[_0xd8f5('0xa')]));require('./faxMessage.socket')[_0xd8f5('0xe')](socket);function respondWithRpcPromise(_0x201c4b,_0x421e33,_0x383c3f){return new BPromise(function(_0x5a1ef3,_0x17ef48){return client[_0xd8f5('0xf')](_0x201c4b,_0x383c3f)[_0xd8f5('0x10')](function(_0x583334){logger[_0xd8f5('0x11')](_0xd8f5('0x12'),_0x421e33,_0xd8f5('0x13'));logger[_0xd8f5('0x14')](_0xd8f5('0x15'),_0x421e33,_0xd8f5('0x13'),JSON[_0xd8f5('0x16')](_0x583334));if(_0x583334[_0xd8f5('0x17')]){if(_0x583334[_0xd8f5('0x17')][_0xd8f5('0x18')]===0x1f4){logger[_0xd8f5('0x17')](_0xd8f5('0x12'),_0x421e33,_0x583334['error']['message']);return _0x17ef48(_0x583334[_0xd8f5('0x17')][_0xd8f5('0x19')]);}logger[_0xd8f5('0x17')]('FaxMessage,\x20%s,\x20%s',_0x421e33,_0x583334[_0xd8f5('0x17')][_0xd8f5('0x19')]);return _0x5a1ef3(_0x583334[_0xd8f5('0x17')][_0xd8f5('0x19')]);}else{logger[_0xd8f5('0x11')](_0xd8f5('0x12'),_0x421e33,_0xd8f5('0x13'));_0x5a1ef3(_0x583334[_0xd8f5('0x1a')][_0xd8f5('0x19')]);}})[_0xd8f5('0x1b')](function(_0x46270a){logger[_0xd8f5('0x17')](_0xd8f5('0x12'),_0x421e33,_0x46270a);_0x17ef48(_0x46270a);});});}exports[_0xd8f5('0x1c')]=function(_0x4c5032){var _0x1adab5=this;return new Promise(function(_0x513c1b,_0x527faf){return db['FaxMessage'][_0xd8f5('0x1d')](_0x4c5032[_0xd8f5('0x1e')],{'raw':_0x4c5032[_0xd8f5('0x1f')]?_0x4c5032[_0xd8f5('0x1f')][_0xd8f5('0x20')]===undefined?!![]:![]:!![]})['then'](function(_0x40d2b1){logger['info'](_0xd8f5('0x1c'),_0x4c5032);logger[_0xd8f5('0x14')]('CreateFaxMessage',_0x4c5032,JSON[_0xd8f5('0x16')](_0x40d2b1));_0x513c1b(_0x40d2b1);})[_0xd8f5('0x1b')](function(_0x304042){logger[_0xd8f5('0x17')]('CreateFaxMessage',_0x304042[_0xd8f5('0x19')],_0x4c5032);_0x527faf(_0x1adab5['error'](0x1f4,_0x304042[_0xd8f5('0x19')]));});});};exports[_0xd8f5('0x21')]=function(_0x31eb1d){var _0x18a12b=this;return new Promise(function(_0x27dc7d,_0x2247f9){return db[_0xd8f5('0x22')][_0xd8f5('0x23')](_0x31eb1d[_0xd8f5('0x1e')],{'raw':_0x31eb1d[_0xd8f5('0x1f')]?_0x31eb1d[_0xd8f5('0x1f')][_0xd8f5('0x20')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x31eb1d[_0xd8f5('0x1f')]?_0x31eb1d[_0xd8f5('0x1f')]['where']||null:null,'attributes':_0x31eb1d[_0xd8f5('0x1f')]?_0x31eb1d['options']['attributes']||null:null,'limit':_0x31eb1d[_0xd8f5('0x1f')]?_0x31eb1d[_0xd8f5('0x1f')]['limit']||null:null})[_0xd8f5('0x10')](function(_0x4ac606){logger[_0xd8f5('0x11')](_0xd8f5('0x21'),_0x31eb1d);logger[_0xd8f5('0x14')](_0xd8f5('0x21'),_0x31eb1d,JSON['stringify'](_0x4ac606));_0x27dc7d(_0x4ac606);})[_0xd8f5('0x1b')](function(_0x30cf8c){logger[_0xd8f5('0x17')](_0xd8f5('0x21'),_0x30cf8c[_0xd8f5('0x19')],_0x31eb1d);_0x2247f9(_0x18a12b['error'](0x1f4,_0x30cf8c[_0xd8f5('0x19')]));});});}; \ No newline at end of file diff --git a/server/api/faxMessage/faxMessage.socket.js b/server/api/faxMessage/faxMessage.socket.js index a7fbc57..1e88a0e 100644 --- a/server/api/faxMessage/faxMessage.socket.js +++ b/server/api/faxMessage/faxMessage.socket.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9957=['register','length','faxMessage:','./faxMessage.events','save','remove','update','emit','removeListener'];(function(_0x5834bc,_0x3d4801){var _0x3e183a=function(_0x18b023){while(--_0x18b023){_0x5834bc['push'](_0x5834bc['shift']());}};_0x3e183a(++_0x3d4801);}(_0x9957,0x93));var _0x7995=function(_0x1ac595,_0x5d2081){_0x1ac595=_0x1ac595-0x0;var _0x455fff=_0x9957[_0x1ac595];return _0x455fff;};'use strict';var FaxMessageEvents=require(_0x7995('0x0'));var events=[_0x7995('0x1'),_0x7995('0x2'),_0x7995('0x3')];function createListener(_0x5b96eb,_0x86c128){return function(_0x3c58eb){_0x86c128[_0x7995('0x4')](_0x5b96eb,_0x3c58eb);};}function removeListener(_0x462a03,_0x576d89){return function(){FaxMessageEvents[_0x7995('0x5')](_0x462a03,_0x576d89);};}exports[_0x7995('0x6')]=function(_0x137b6b){for(var _0x219534=0x0,_0xbda126=events[_0x7995('0x7')];_0x219534<_0xbda126;_0x219534++){var _0x4996ca=events[_0x219534];var _0x465276=createListener(_0x7995('0x8')+_0x4996ca,_0x137b6b);FaxMessageEvents['on'](_0x4996ca,_0x465276);}}; \ No newline at end of file +var _0xa9e0=['register','length','faxMessage:','./faxMessage.events','save','remove','emit','removeListener'];(function(_0x19950b,_0x53d0d7){var _0x3c6b41=function(_0x3924ad){while(--_0x3924ad){_0x19950b['push'](_0x19950b['shift']());}};_0x3c6b41(++_0x53d0d7);}(_0xa9e0,0x123));var _0x0a9e=function(_0xf50820,_0x56f041){_0xf50820=_0xf50820-0x0;var _0x2a9b10=_0xa9e0[_0xf50820];return _0x2a9b10;};'use strict';var FaxMessageEvents=require(_0x0a9e('0x0'));var events=[_0x0a9e('0x1'),_0x0a9e('0x2'),'update'];function createListener(_0x550fbc,_0x18d5c9){return function(_0x4ce2f1){_0x18d5c9[_0x0a9e('0x3')](_0x550fbc,_0x4ce2f1);};}function removeListener(_0x432180,_0x2ab90b){return function(){FaxMessageEvents[_0x0a9e('0x4')](_0x432180,_0x2ab90b);};}exports[_0x0a9e('0x5')]=function(_0x57b080){for(var _0x219af0=0x0,_0x441e3a=events[_0x0a9e('0x6')];_0x219af0<_0x441e3a;_0x219af0++){var _0x5f41ea=events[_0x219af0];var _0x503809=createListener(_0x0a9e('0x7')+_0x5f41ea,_0x57b080);FaxMessageEvents['on'](_0x5f41ea,_0x503809);}}; \ No newline at end of file diff --git a/server/api/faxMessage/index.js b/server/api/faxMessage/index.js index e6ed990..7e4d26c 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 _0x4f73=['Router','../../components/interaction/service','./faxMessage.controller','get','isAuthenticated','index','describe','/:id','show','download','tracked','fax','faxmessage:create','create','put','/:id/accept','accept','/:id/reject','reject','destroy','exports','multer','util','path','connect-timeout'];(function(_0x525c7b,_0x488fcc){var _0x27b33e=function(_0x56d43b){while(--_0x56d43b){_0x525c7b['push'](_0x525c7b['shift']());}};_0x27b33e(++_0x488fcc);}(_0x4f73,0x10f));var _0x34f7=function(_0x1820f1,_0x1403e7){_0x1820f1=_0x1820f1-0x0;var _0x167aed=_0x4f73[_0x1820f1];return _0x167aed;};'use strict';var multer=require(_0x34f7('0x0'));var util=require(_0x34f7('0x1'));var path=require(_0x34f7('0x2'));var timeout=require(_0x34f7('0x3'));var express=require('express');var router=express[_0x34f7('0x4')]();var auth=require('../../components/auth/service');var interaction=require(_0x34f7('0x5'));var config=require('../../config/environment');var controller=require(_0x34f7('0x6'));router[_0x34f7('0x7')]('/',auth[_0x34f7('0x8')](),controller[_0x34f7('0x9')]);router[_0x34f7('0x7')]('/describe',auth['isAuthenticated'](),controller[_0x34f7('0xa')]);router[_0x34f7('0x7')](_0x34f7('0xb'),auth[_0x34f7('0x8')](),controller[_0x34f7('0xc')]);router[_0x34f7('0x7')]('/:id/download',auth['isAuthenticated'](),controller[_0x34f7('0xd')]);router['post']('/',auth[_0x34f7('0x8')](),interaction[_0x34f7('0xe')](_0x34f7('0xf'),_0x34f7('0x10')),controller[_0x34f7('0x11')]);router[_0x34f7('0x12')](_0x34f7('0xb'),auth[_0x34f7('0x8')](),controller['update']);router[_0x34f7('0x12')](_0x34f7('0x13'),auth['isAuthenticated'](),controller[_0x34f7('0x14')]);router[_0x34f7('0x12')](_0x34f7('0x15'),auth[_0x34f7('0x8')](),controller[_0x34f7('0x16')]);router['delete'](_0x34f7('0xb'),auth[_0x34f7('0x8')](),controller[_0x34f7('0x17')]);module[_0x34f7('0x18')]=router; \ No newline at end of file +var _0x3e1d=['/describe','describe','/:id','show','/:id/download','download','tracked','fax','faxmessage:create','create','put','accept','/:id/reject','reject','delete','destroy','exports','path','connect-timeout','Router','../../components/interaction/service','../../config/environment','./faxMessage.controller','isAuthenticated','index','get'];(function(_0x4adc3a,_0x158557){var _0x1ab89d=function(_0x1f1dc5){while(--_0x1f1dc5){_0x4adc3a['push'](_0x4adc3a['shift']());}};_0x1ab89d(++_0x158557);}(_0x3e1d,0xad));var _0xd3e1=function(_0x300915,_0x320ae4){_0x300915=_0x300915-0x0;var _0x5887ed=_0x3e1d[_0x300915];return _0x5887ed;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0xd3e1('0x0'));var timeout=require(_0xd3e1('0x1'));var express=require('express');var router=express[_0xd3e1('0x2')]();var auth=require('../../components/auth/service');var interaction=require(_0xd3e1('0x3'));var config=require(_0xd3e1('0x4'));var controller=require(_0xd3e1('0x5'));router['get']('/',auth[_0xd3e1('0x6')](),controller[_0xd3e1('0x7')]);router[_0xd3e1('0x8')](_0xd3e1('0x9'),auth[_0xd3e1('0x6')](),controller[_0xd3e1('0xa')]);router[_0xd3e1('0x8')](_0xd3e1('0xb'),auth[_0xd3e1('0x6')](),controller[_0xd3e1('0xc')]);router[_0xd3e1('0x8')](_0xd3e1('0xd'),auth[_0xd3e1('0x6')](),controller[_0xd3e1('0xe')]);router['post']('/',auth['isAuthenticated'](),interaction[_0xd3e1('0xf')](_0xd3e1('0x10'),_0xd3e1('0x11')),controller[_0xd3e1('0x12')]);router[_0xd3e1('0x13')](_0xd3e1('0xb'),auth['isAuthenticated'](),controller['update']);router[_0xd3e1('0x13')]('/:id/accept',auth[_0xd3e1('0x6')](),controller[_0xd3e1('0x14')]);router[_0xd3e1('0x13')](_0xd3e1('0x15'),auth[_0xd3e1('0x6')](),controller[_0xd3e1('0x16')]);router[_0xd3e1('0x17')](_0xd3e1('0xb'),auth['isAuthenticated'](),controller[_0xd3e1('0x18')]);module[_0xd3e1('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 0b528d7..4daa9a5 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 _0x0c4c=['beepall','roundrobin','sequelize','exports','STRING','INTEGER','ENUM','rrmemory'];(function(_0x4fcd2,_0x57dc44){var _0x408b19=function(_0x408b0a){while(--_0x408b0a){_0x4fcd2['push'](_0x4fcd2['shift']());}};_0x408b19(++_0x57dc44);}(_0x0c4c,0x102));var _0xc0c4=function(_0x414a27,_0xa9ee99){_0x414a27=_0x414a27-0x0;var _0x10ed72=_0x0c4c[_0x414a27];return _0x10ed72;};'use strict';var Sequelize=require(_0xc0c4('0x0'));module[_0xc0c4('0x1')]={'name':{'type':Sequelize['STRING'],'unique':'name','allowNull':![],'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0xc0c4('0x2')]},'timeout':{'type':Sequelize[_0xc0c4('0x3')],'allowNull':![],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0xc0c4('0x4')](_0xc0c4('0x5'),_0xc0c4('0x6'),_0xc0c4('0x7')),'allowNull':![]},'lastAgent':{'type':Sequelize[_0xc0c4('0x3')],'defaultValue':0x0}}; \ No newline at end of file +var _0x5e24=['rrmemory','beepall','roundrobin','exports','name','INTEGER','ENUM'];(function(_0x464a0b,_0x5115ca){var _0x492c1b=function(_0x5de72b){while(--_0x5de72b){_0x464a0b['push'](_0x464a0b['shift']());}};_0x492c1b(++_0x5115ca);}(_0x5e24,0xb2));var _0x45e2=function(_0x419251,_0x63e074){_0x419251=_0x419251-0x0;var _0x1f65f3=_0x5e24[_0x419251];return _0x1f65f3;};'use strict';var Sequelize=require('sequelize');module[_0x45e2('0x0')]={'name':{'type':Sequelize['STRING'],'unique':_0x45e2('0x1'),'allowNull':![],'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize['STRING']},'timeout':{'type':Sequelize[_0x45e2('0x2')],'allowNull':![],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0x45e2('0x3')](_0x45e2('0x4'),_0x45e2('0x5'),_0x45e2('0x6')),'allowNull':![]},'lastAgent':{'type':Sequelize[_0x45e2('0x2')],'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 f17d59d..a21f5c1 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 _0x5453=['../../config/logger','../../config/environment','../../mysqldb','redis','defaults','./faxQueue.socket','sendStatus','status','offset','limit','set','Content-Range','json','apply','update','destroy','get','FaxQueues','UserProfileResource','then','end','name','send','index','map','FaxQueue','rawAttributes','type','key','query','keys','filters','intersection','model','attributes','fields','hasOwnProperty','nolimit','order','sort','where','pick','merge','filter','options','count','includeAll','include','rows','catch','show','params','length','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','userProfileId','autoAssociation','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','getMembers','findOne','UserFaxQueue','FaxQueueId','findAll','agent','faxPause','updatedAt','createdAt','format','SIP','getTeams','Team','addTeams','ids','User','online','voicePause','interface','flatMap','Agents','each','findOrCreate','forEach','userFaxQueue:save','removeTeams','select','field','from','team_has_fax_queues','join','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','FaxQueueId\x20=\x20?','clone','ut.UserId\x20=\x20?','push','sequelize','toString','every','TeamId','includes','all','union','compact','value','isEmpty','removeAgents','userFaxQueue:remove','addAgents','omit','spread','emit','isArray','getAgents','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','util','path','to-csv','lodash','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware'];(function(_0xdb01a,_0x54a83a){var _0x107ede=function(_0x98f457){while(--_0x98f457){_0xdb01a['push'](_0xdb01a['shift']());}};_0x107ede(++_0x54a83a);}(_0x5453,0x18b));var _0x3545=function(_0x138adb,_0x193fee){_0x138adb=_0x138adb-0x0;var _0x1b27f2=_0x5453[_0x138adb];return _0x1b27f2;};'use strict';var pdf=require(_0x3545('0x0'));var emlformat=require(_0x3545('0x1'));var rimraf=require(_0x3545('0x2'));var zipdir=require(_0x3545('0x3'));var jsonpatch=require(_0x3545('0x4'));var rp=require(_0x3545('0x5'));var moment=require(_0x3545('0x6'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x3545('0x7'));var path=require(_0x3545('0x8'));var sox=require('sox');var csv=require(_0x3545('0x9'));var ejs=require('ejs');var fs=require('fs');var _=require(_0x3545('0xa'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x3545('0xb'));var deskjs=require(_0x3545('0xc'));var toCsv=require(_0x3545('0x9'));var querystring=require('querystring');var Papa=require(_0x3545('0xd'));var Redis=require(_0x3545('0xe'));var authService=require(_0x3545('0xf'));var qs=require(_0x3545('0x10'));var as=require(_0x3545('0x11'));var hardwareService=require(_0x3545('0x12'));var logger=require(_0x3545('0x13'))('api');var utils=require('../../config/utils');var config=require(_0x3545('0x14'));var db=require(_0x3545('0x15'))['db'];config[_0x3545('0x16')]=_[_0x3545('0x17')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x3545('0x16')]));require(_0x3545('0x18'))['register'](socket);function respondWithStatusCode(_0x427f72,_0x5b5474){_0x5b5474=_0x5b5474||0xcc;return function(_0x4e83b8){if(_0x4e83b8){return _0x427f72[_0x3545('0x19')](_0x5b5474);}return _0x427f72[_0x3545('0x1a')](_0x5b5474)['end']();};}function respondWithResult(_0x29921b,_0x1717f6){_0x1717f6=_0x1717f6||0xc8;return function(_0x56d04e){if(_0x56d04e){return _0x29921b[_0x3545('0x1a')](_0x1717f6)['json'](_0x56d04e);}};}function respondWithFilteredResult(_0x3a232a,_0x16e2f8){return function(_0x2acafc){if(_0x2acafc){var _0x2c008a=_0x2acafc['count'],_0x4e3c95=_0x16e2f8[_0x3545('0x1b')],_0x573970=_0x16e2f8[_0x3545('0x1b')]+_0x16e2f8[_0x3545('0x1c')],_0x34a7f3;if(_0x573970>=_0x2c008a){_0x573970=_0x2c008a;_0x34a7f3=0xc8;}else{_0x34a7f3=0xce;}_0x3a232a[_0x3545('0x1a')](_0x34a7f3);return _0x3a232a[_0x3545('0x1d')](_0x3545('0x1e'),_0x4e3c95+'-'+_0x573970+'/'+_0x2c008a)[_0x3545('0x1f')](_0x2acafc);}return null;};}function patchUpdates(_0x365bc3){return function(_0x28d3ed){try{jsonpatch[_0x3545('0x20')](_0x28d3ed,_0x365bc3,!![]);}catch(_0x2050fd){return BPromise['reject'](_0x2050fd);}return _0x28d3ed['save']();};}function saveUpdates(_0x20800f,_0x580791){return function(_0x3fc41a){if(_0x3fc41a){return _0x3fc41a[_0x3545('0x21')](_0x20800f)['then'](function(_0x473c00){return _0x473c00;});}return null;};}function removeEntity(_0x528b30,_0x5de099){return function(_0x447bb2){if(_0x447bb2){return _0x447bb2[_0x3545('0x22')]()['then'](function(){var _0x3e756d=_0x447bb2[_0x3545('0x23')]({'plain':!![]});var _0x450b39=_0x3545('0x24');return db[_0x3545('0x25')][_0x3545('0x22')]({'where':{'type':_0x450b39,'resourceId':_0x3e756d['id']}})['then'](function(){return _0x447bb2;});})[_0x3545('0x26')](function(){_0x528b30[_0x3545('0x1a')](0xcc)[_0x3545('0x27')]();});}};}function handleEntityNotFound(_0xeea892,_0x864712){return function(_0x397d19){if(!_0x397d19){_0xeea892[_0x3545('0x19')](0x194);}return _0x397d19;};}function handleError(_0x5360df,_0x46450f){_0x46450f=_0x46450f||0x1f4;return function(_0x500080){logger['error'](_0x500080['stack']);if(_0x500080['name']){delete _0x500080[_0x3545('0x28')];}_0x5360df['status'](_0x46450f)[_0x3545('0x29')](_0x500080);};}exports[_0x3545('0x2a')]=function(_0x341ad3,_0x2f6057){var _0x3d78a9={},_0x77931f={},_0x2fb95f={'count':0x0,'rows':[]};var _0x176a4a=_[_0x3545('0x2b')](db[_0x3545('0x2c')][_0x3545('0x2d')],function(_0x4991f6){return{'name':_0x4991f6['fieldName'],'type':_0x4991f6[_0x3545('0x2e')][_0x3545('0x2f')]};});_0x77931f['model']=_[_0x3545('0x2b')](_0x176a4a,_0x3545('0x28'));_0x77931f[_0x3545('0x30')]=_[_0x3545('0x31')](_0x341ad3[_0x3545('0x30')]);_0x77931f[_0x3545('0x32')]=_[_0x3545('0x33')](_0x77931f[_0x3545('0x34')],_0x77931f[_0x3545('0x30')]);_0x3d78a9[_0x3545('0x35')]=_['intersection'](_0x77931f[_0x3545('0x34')],qs[_0x3545('0x36')](_0x341ad3[_0x3545('0x30')][_0x3545('0x36')]));_0x3d78a9[_0x3545('0x35')]=_0x3d78a9[_0x3545('0x35')]['length']?_0x3d78a9['attributes']:_0x77931f[_0x3545('0x34')];if(!_0x341ad3[_0x3545('0x30')][_0x3545('0x37')](_0x3545('0x38'))){_0x3d78a9[_0x3545('0x1c')]=qs[_0x3545('0x1c')](_0x341ad3['query'][_0x3545('0x1c')]);_0x3d78a9['offset']=qs['offset'](_0x341ad3['query'][_0x3545('0x1b')]);}_0x3d78a9[_0x3545('0x39')]=qs['sort'](_0x341ad3[_0x3545('0x30')][_0x3545('0x3a')]);_0x3d78a9[_0x3545('0x3b')]=qs[_0x3545('0x32')](_[_0x3545('0x3c')](_0x341ad3[_0x3545('0x30')],_0x77931f[_0x3545('0x32')]));if(_0x341ad3[_0x3545('0x30')]['filter']){_0x3d78a9[_0x3545('0x3b')]=_[_0x3545('0x3d')](_0x3d78a9[_0x3545('0x3b')],{'$or':_[_0x3545('0x2b')](_0x176a4a,function(_0x2f4de6){if(_0x2f4de6[_0x3545('0x2e')]!=='VIRTUAL'){var _0x496864={};_0x496864[_0x2f4de6[_0x3545('0x28')]]={'$like':'%'+_0x341ad3[_0x3545('0x30')][_0x3545('0x3e')]+'%'};return _0x496864;}})});}_0x3d78a9=_[_0x3545('0x3d')]({},_0x3d78a9,_0x341ad3[_0x3545('0x3f')]);var _0x5ec9c6={'where':_0x3d78a9[_0x3545('0x3b')]};return db[_0x3545('0x2c')][_0x3545('0x40')](_0x5ec9c6)['then'](function(_0x2531bf){_0x2fb95f[_0x3545('0x40')]=_0x2531bf;if(_0x341ad3['query'][_0x3545('0x41')]){_0x3d78a9[_0x3545('0x42')]=[{'all':!![]}];}return db[_0x3545('0x2c')]['findAll'](_0x3d78a9);})[_0x3545('0x26')](function(_0x23b79d){_0x2fb95f[_0x3545('0x43')]=_0x23b79d;return _0x2fb95f;})[_0x3545('0x26')](respondWithFilteredResult(_0x2f6057,_0x3d78a9))[_0x3545('0x44')](handleError(_0x2f6057,null));};exports[_0x3545('0x45')]=function(_0x530854,_0x505898){var _0x5c9303={'raw':!![],'where':{'id':_0x530854[_0x3545('0x46')]['id']}},_0x28571c={};_0x28571c[_0x3545('0x34')]=_[_0x3545('0x31')](db['FaxQueue'][_0x3545('0x2d')]);_0x28571c[_0x3545('0x30')]=_[_0x3545('0x31')](_0x530854[_0x3545('0x30')]);_0x28571c[_0x3545('0x32')]=_[_0x3545('0x33')](_0x28571c[_0x3545('0x34')],_0x28571c[_0x3545('0x30')]);_0x5c9303[_0x3545('0x35')]=_['intersection'](_0x28571c['model'],qs[_0x3545('0x36')](_0x530854['query'][_0x3545('0x36')]));_0x5c9303[_0x3545('0x35')]=_0x5c9303['attributes'][_0x3545('0x47')]?_0x5c9303[_0x3545('0x35')]:_0x28571c[_0x3545('0x34')];if(_0x530854[_0x3545('0x30')]['includeAll']){_0x5c9303['include']=[{'all':!![]}];}_0x5c9303=_[_0x3545('0x3d')]({},_0x5c9303,_0x530854[_0x3545('0x3f')]);return db['FaxQueue'][_0x3545('0x48')](_0x5c9303)['then'](handleEntityNotFound(_0x505898,null))[_0x3545('0x26')](respondWithResult(_0x505898,null))[_0x3545('0x44')](handleError(_0x505898,null));};exports['create']=function(_0x3350a9,_0x5bf672){return db[_0x3545('0x2c')][_0x3545('0x49')](_0x3350a9[_0x3545('0x4a')],{})[_0x3545('0x26')](function(_0x24ee85){var _0x3b2e0a=_0x3350a9[_0x3545('0x4b')][_0x3545('0x23')]({'plain':!![]});if(!_0x3b2e0a)throw new Error(_0x3545('0x4c'));if(_0x3b2e0a['role']===_0x3545('0x4b')){var _0x590866=_0x24ee85[_0x3545('0x23')]({'plain':!![]});var _0x5038ab='FaxQueues';return db[_0x3545('0x4d')][_0x3545('0x48')]({'where':{'name':_0x5038ab,'userProfileId':_0x3b2e0a[_0x3545('0x4e')]},'raw':!![]})[_0x3545('0x26')](function(_0x2781e8){if(_0x2781e8&&_0x2781e8[_0x3545('0x4f')]===0x0){return db[_0x3545('0x25')][_0x3545('0x49')]({'name':_0x590866[_0x3545('0x28')],'resourceId':_0x590866['id'],'type':_0x2781e8[_0x3545('0x28')],'sectionId':_0x2781e8['id']},{})['then'](function(){return _0x24ee85;});}else{return _0x24ee85;}})[_0x3545('0x44')](function(_0x57083e){logger[_0x3545('0x50')](_0x3545('0x51'),_0x57083e);throw _0x57083e;});}return _0x24ee85;})[_0x3545('0x26')](respondWithResult(_0x5bf672,0xc9))[_0x3545('0x44')](handleError(_0x5bf672,null));};exports[_0x3545('0x21')]=function(_0x5d3ed2,_0x557a73){if(_0x5d3ed2[_0x3545('0x4a')]['id']){delete _0x5d3ed2[_0x3545('0x4a')]['id'];}return db[_0x3545('0x2c')][_0x3545('0x48')]({'where':{'id':_0x5d3ed2['params']['id']}})[_0x3545('0x26')](handleEntityNotFound(_0x557a73,null))[_0x3545('0x26')](saveUpdates(_0x5d3ed2['body'],null))[_0x3545('0x26')](respondWithResult(_0x557a73,null))['catch'](handleError(_0x557a73,null));};exports[_0x3545('0x22')]=function(_0x4ae121,_0x4a8648){return db[_0x3545('0x2c')][_0x3545('0x48')]({'where':{'id':_0x4ae121[_0x3545('0x46')]['id']}})[_0x3545('0x26')](handleEntityNotFound(_0x4a8648,null))[_0x3545('0x26')](removeEntity(_0x4a8648,null))[_0x3545('0x44')](handleError(_0x4a8648,null));};exports[_0x3545('0x52')]=function(_0x3186b1,_0x377e3b){return db[_0x3545('0x2c')][_0x3545('0x52')]()[_0x3545('0x26')](respondWithResult(_0x377e3b,null))[_0x3545('0x44')](handleError(_0x377e3b,null));};exports[_0x3545('0x53')]=function(_0x424e89,_0x1f4a95,_0x211dec){var _0x4f08ae={'raw':!![],'where':{}},_0x278421={},_0x38877a;return db[_0x3545('0x2c')][_0x3545('0x54')]({'where':{'id':_0x424e89[_0x3545('0x46')]['id']}})[_0x3545('0x26')](handleEntityNotFound(_0x1f4a95,null))[_0x3545('0x26')](function(_0x3fa76e){if(_0x3fa76e){_0x38877a=_0x3fa76e[_0x3545('0x23')]({'plain':!![]});_0x278421[_0x3545('0x34')]=_[_0x3545('0x31')](db[_0x3545('0x55')][_0x3545('0x2d')]);_0x278421[_0x3545('0x30')]=_[_0x3545('0x31')](_0x424e89[_0x3545('0x30')]);_0x278421[_0x3545('0x32')]=_[_0x3545('0x33')](_0x278421[_0x3545('0x34')],_0x278421[_0x3545('0x30')]);_0x4f08ae[_0x3545('0x35')]=_[_0x3545('0x33')](_0x278421[_0x3545('0x34')],qs[_0x3545('0x36')](_0x424e89[_0x3545('0x30')]['fields']));_0x4f08ae[_0x3545('0x35')]=_0x4f08ae[_0x3545('0x35')][_0x3545('0x47')]?_0x4f08ae[_0x3545('0x35')]:_0x278421[_0x3545('0x34')];if(!_0x424e89[_0x3545('0x30')][_0x3545('0x37')]('nolimit')){_0x4f08ae[_0x3545('0x1c')]=qs[_0x3545('0x1c')](_0x424e89['query'][_0x3545('0x1c')]);_0x4f08ae[_0x3545('0x1b')]=qs[_0x3545('0x1b')](_0x424e89['query']['offset']);}_0x4f08ae[_0x3545('0x39')]=qs['sort'](_0x424e89[_0x3545('0x30')][_0x3545('0x3a')]);_0x4f08ae[_0x3545('0x3b')]=qs[_0x3545('0x32')](_[_0x3545('0x3c')](_0x424e89[_0x3545('0x30')],_0x278421[_0x3545('0x32')]));_0x4f08ae[_0x3545('0x3b')][_0x3545('0x56')]=_0x3fa76e['id'];if(_0x424e89[_0x3545('0x30')][_0x3545('0x3e')]){_0x4f08ae['where']=_['merge'](_0x4f08ae[_0x3545('0x3b')],{'$or':_[_0x3545('0x2b')](_0x4f08ae[_0x3545('0x35')],function(_0x5491a6){var _0x25b69d={};_0x25b69d[_0x5491a6]={'$like':'%'+_0x424e89['query'][_0x3545('0x3e')]+'%'};return _0x25b69d;})});}_0x4f08ae=_[_0x3545('0x3d')]({},_0x4f08ae,_0x424e89[_0x3545('0x3f')]);return db[_0x3545('0x55')][_0x3545('0x57')](_0x4f08ae);}})[_0x3545('0x26')](function(_0x179991){if(_0x179991){return db['User']['findAndCountAll']({'where':{'id':_[_0x3545('0x2b')](_0x179991,'UserId'),'role':_0x3545('0x58')},'attributes':['id',_0x3545('0x28'),_0x3545('0x59'),_0x3545('0x5a'),_0x3545('0x5b')]});}})[_0x3545('0x26')](function(_0x169887){if(_0x169887){return{'count':_0x169887[_0x3545('0x40')],'rows':_['map'](_0x169887[_0x3545('0x43')],function(_0x118bd2){return{'membername':_0x118bd2[_0x3545('0x28')],'UserId':_0x118bd2['id'],'queue_name':_0x38877a[_0x3545('0x28')],'FaxQueueId':_0x38877a['id'],'interface':util[_0x3545('0x5c')]('%s/%s',_0x3545('0x5d'),_0x118bd2['name']),'penalty':0x0,'paused':_0x118bd2[_0x3545('0x59')],'createdAt':_0x118bd2[_0x3545('0x5b')],'updatedAt':_0x118bd2['updatedAt']};})};}else{return{'count':0x0,'rows':[]};}})[_0x3545('0x26')](respondWithFilteredResult(_0x1f4a95,_0x4f08ae))[_0x3545('0x44')](handleError(_0x1f4a95,null));};exports[_0x3545('0x5e')]=function(_0x32a782,_0xe750c2,_0x153460){var _0x2210ab={};var _0x5e18a6={};var _0x4ece90;var _0x55469b;return db[_0x3545('0x2c')]['findOne']({'where':{'id':_0x32a782[_0x3545('0x46')]['id']}})[_0x3545('0x26')](handleEntityNotFound(_0xe750c2,null))[_0x3545('0x26')](function(_0x34dfd4){if(_0x34dfd4){_0x4ece90=_0x34dfd4;_0x5e18a6[_0x3545('0x34')]=_[_0x3545('0x31')](db[_0x3545('0x5f')][_0x3545('0x2d')]);_0x5e18a6['query']=_['keys'](_0x32a782[_0x3545('0x30')]);_0x5e18a6[_0x3545('0x32')]=_[_0x3545('0x33')](_0x5e18a6[_0x3545('0x34')],_0x5e18a6[_0x3545('0x30')]);_0x2210ab[_0x3545('0x35')]=_[_0x3545('0x33')](_0x5e18a6[_0x3545('0x34')],qs[_0x3545('0x36')](_0x32a782[_0x3545('0x30')]['fields']));_0x2210ab[_0x3545('0x35')]=_0x2210ab['attributes'][_0x3545('0x47')]?_0x2210ab[_0x3545('0x35')]:_0x5e18a6[_0x3545('0x34')];_0x2210ab[_0x3545('0x39')]=qs['sort'](_0x32a782[_0x3545('0x30')][_0x3545('0x3a')]);_0x2210ab[_0x3545('0x3b')]=qs[_0x3545('0x32')](_[_0x3545('0x3c')](_0x32a782[_0x3545('0x30')],_0x5e18a6[_0x3545('0x32')]));if(_0x32a782['query'][_0x3545('0x3e')]){_0x2210ab['where']=_[_0x3545('0x3d')](_0x2210ab[_0x3545('0x3b')],{'$or':_[_0x3545('0x2b')](_0x2210ab[_0x3545('0x35')],function(_0x4bd86d){var _0xca4a61={};_0xca4a61[_0x4bd86d]={'$like':'%'+_0x32a782['query']['filter']+'%'};return _0xca4a61;})});}_0x2210ab=_[_0x3545('0x3d')]({},_0x2210ab,_0x32a782[_0x3545('0x3f')]);return _0x4ece90[_0x3545('0x5e')](_0x2210ab);}})[_0x3545('0x26')](function(_0x5ae90a){if(_0x5ae90a){_0x55469b=_0x5ae90a[_0x3545('0x47')];if(!_0x32a782['query']['hasOwnProperty'](_0x3545('0x38'))){_0x2210ab[_0x3545('0x1c')]=qs[_0x3545('0x1c')](_0x32a782['query'][_0x3545('0x1c')]);_0x2210ab[_0x3545('0x1b')]=qs[_0x3545('0x1b')](_0x32a782[_0x3545('0x30')][_0x3545('0x1b')]);}return _0x4ece90[_0x3545('0x5e')](_0x2210ab);}})[_0x3545('0x26')](function(_0x482ad5){if(_0x482ad5){return _0x482ad5?{'count':_0x55469b,'rows':_0x482ad5}:null;}})[_0x3545('0x26')](respondWithResult(_0xe750c2,null))['catch'](handleError(_0xe750c2,null));};exports[_0x3545('0x60')]=function(_0x1040fa,_0x1551f9,_0x3a6767){var _0x979aa7=_0x1040fa[_0x3545('0x4a')][_0x3545('0x61')];return db[_0x3545('0x5f')]['findAll']({'where':{'id':_0x979aa7},'attributes':['id'],'include':[{'model':db[_0x3545('0x62')],'as':'Agents','attributes':['id',_0x3545('0x28'),_0x3545('0x63'),_0x3545('0x64'),_0x3545('0x65')],'raw':!![]}]})[_0x3545('0x26')](function(_0x55b142){if(_0x55b142){var _0x4d6f89=_[_0x3545('0x66')](_0x55b142,function(_0x39b2ea){var _0x458a55=_0x39b2ea[_0x3545('0x23')]({'plain':!![]});return _0x458a55[_0x3545('0x67')];});return db[_0x3545('0x2c')][_0x3545('0x48')]({'where':{'id':_0x1040fa['params']['id']}})[_0x3545('0x26')](function(_0x2b2471){return db['sequelize']['transaction'](function(_0x26656c){return _0x2b2471[_0x3545('0x60')](_0x979aa7,{'transaction':_0x26656c})[_0x3545('0x26')](function(){return BPromise[_0x3545('0x68')](_0x4d6f89,function(_0x4ce59d){return db['UserFaxQueue'][_0x3545('0x69')]({'where':{'UserId':_0x4ce59d['id'],'FaxQueueId':_0x1040fa[_0x3545('0x46')]['id']},'transaction':_0x26656c});});})['then'](function(){_0x4d6f89[_0x3545('0x6a')](function(_0x5e7c85){socket['emit'](_0x3545('0x6b'),{'UserId':_0x5e7c85['id'],'FaxQueueId':_0x2b2471['id']});});});});});}})[_0x3545('0x26')](respondWithStatusCode(_0x1551f9,null))[_0x3545('0x44')](handleError(_0x1551f9,null));};exports[_0x3545('0x6c')]=function(_0x1f0381,_0x5c0285,_0x1428fa){return db[_0x3545('0x5f')][_0x3545('0x57')]({'where':{'id':_0x1f0381['query'][_0x3545('0x61')]},'attributes':['id'],'include':[{'model':db['User'],'as':_0x3545('0x67'),'attributes':['id'],'raw':!![]}]})[_0x3545('0x26')](handleEntityNotFound(_0x5c0285,null))[_0x3545('0x26')](function(_0x5b0118){var _0x25c52d=_[_0x3545('0x2b')](_0x5b0118,'id');var _0x1f635b=[];var _0x2a6c95=[];var _0x1b9928=squel[_0x3545('0x6d')]();_0x1b9928[_0x3545('0x6e')]('tq.TeamId')[_0x3545('0x6f')](_0x3545('0x70'),'tq')[_0x3545('0x71')](_0x3545('0x72'),'ut',_0x3545('0x73'))[_0x3545('0x3b')](_0x3545('0x74'),_0x1f0381[_0x3545('0x46')]['id']);for(var _0x3c3569=0x0;_0x3c3569<_0x5b0118[_0x3545('0x47')];_0x3c3569+=0x1){let _0x1d7260=_0x5b0118[_0x3c3569];for(var _0xdb4d69=0x0;_0xdb4d69<_0x1d7260['Agents'][_0x3545('0x47')];_0xdb4d69+=0x1){let _0x32c2dd=_0x1d7260[_0x3545('0x67')][_0xdb4d69];var _0x56b0cf=_0x1b9928[_0x3545('0x75')]();_0x56b0cf[_0x3545('0x3b')](_0x3545('0x76'),_0x32c2dd['id']);_0x2a6c95[_0x3545('0x77')](db[_0x3545('0x78')][_0x3545('0x30')](_0x56b0cf[_0x3545('0x79')](),{'type':db[_0x3545('0x78')]['QueryTypes']['SELECT']})[_0x3545('0x26')](function(_0x15f420){if(_0x15f420[_0x3545('0x47')]===0x1){return _0x32c2dd['id'];}else{var _0x53aa27=_[_0x3545('0x7a')](_['map'](_0x15f420,_0x3545('0x7b')),function(_0x37e2ca){return _[_0x3545('0x7c')](_0x25c52d,_0x37e2ca);});if(_0x53aa27){return _0x32c2dd['id'];}}}));}}return BPromise[_0x3545('0x7d')](_0x2a6c95)[_0x3545('0x26')](function(_0x561c35){_0x1f635b=_(_0x1f635b)[_0x3545('0x7e')](_0x561c35)[_0x3545('0x7f')]()[_0x3545('0x80')]();return db[_0x3545('0x2c')][_0x3545('0x48')]({'where':{'id':_0x1f0381[_0x3545('0x46')]['id']}})[_0x3545('0x26')](function(_0x2b10c8){return db[_0x3545('0x78')]['transaction'](function(_0x225a6d){return _0x2b10c8['removeTeams'](_0x1f0381[_0x3545('0x30')][_0x3545('0x61')],{'transaction':_0x225a6d})[_0x3545('0x26')](function(){if(!_[_0x3545('0x81')](_0x1f635b)){return _0x2b10c8[_0x3545('0x82')](_0x1f635b,{'transaction':_0x225a6d});}})[_0x3545('0x26')](function(){_0x1f635b[_0x3545('0x6a')](function(_0x2779c1){socket['emit'](_0x3545('0x83'),{'UserId':_0x2779c1,'FaxQueueId':_0x2b10c8['id']});});});});});});})['then'](respondWithStatusCode(_0x5c0285,null))[_0x3545('0x44')](handleError(_0x5c0285,null));};exports['addAgents']=function(_0x5a1f45,_0x3299cb,_0x5d992d){return db[_0x3545('0x2c')][_0x3545('0x48')]({'where':{'id':_0x5a1f45[_0x3545('0x46')]['id']}})['then'](handleEntityNotFound(_0x3299cb,null))[_0x3545('0x26')](function(_0x29e71c){if(_0x29e71c){return _0x29e71c[_0x3545('0x84')](_0x5a1f45['body'][_0x3545('0x61')],_[_0x3545('0x85')](_0x5a1f45[_0x3545('0x4a')],[_0x3545('0x61'),'id'])||{})[_0x3545('0x86')](function(_0x42efcf){for(var _0x29fed7=0x0;_0x29fed7<_0x5a1f45[_0x3545('0x4a')][_0x3545('0x61')]['length'];_0x29fed7+=0x1){socket[_0x3545('0x87')](_0x3545('0x6b'),{'UserId':_0x5a1f45[_0x3545('0x4a')]['ids'][_0x29fed7],'FaxQueueId':_0x5a1f45[_0x3545('0x46')]['id']});}return _0x42efcf;});}})['then'](respondWithResult(_0x3299cb,null))[_0x3545('0x44')](handleError(_0x3299cb,null));};exports['removeAgents']=function(_0x120bb0,_0x1b74f8,_0x530a09){return db[_0x3545('0x2c')][_0x3545('0x48')]({'where':{'id':_0x120bb0[_0x3545('0x46')]['id']}})[_0x3545('0x26')](handleEntityNotFound(_0x1b74f8,null))['then'](function(_0x60b0b1){if(_0x60b0b1){return _0x60b0b1[_0x3545('0x82')](_0x120bb0[_0x3545('0x30')][_0x3545('0x61')])[_0x3545('0x26')](function(){if(_[_0x3545('0x88')](_0x120bb0[_0x3545('0x30')][_0x3545('0x61')])){for(var _0x2b0310=0x0;_0x2b0310<_0x120bb0[_0x3545('0x30')][_0x3545('0x61')][_0x3545('0x47')];_0x2b0310+=0x1){socket[_0x3545('0x87')](_0x3545('0x83'),{'UserId':Number(_0x120bb0[_0x3545('0x30')]['ids'][_0x2b0310]),'FaxQueueId':Number(_0x120bb0[_0x3545('0x46')]['id'])});}}else{socket[_0x3545('0x87')](_0x3545('0x83'),{'UserId':Number(_0x120bb0['query']['ids']),'FaxQueueId':Number(_0x120bb0[_0x3545('0x46')]['id'])});}});}})[_0x3545('0x26')](respondWithStatusCode(_0x1b74f8,null))[_0x3545('0x44')](handleError(_0x1b74f8,null));};exports['getAgents']=function(_0x5b9435,_0x492c61,_0x28d93a){var _0x14a737={};var _0x1de5cc={};var _0x5412e9;var _0x456cc8;return db[_0x3545('0x2c')][_0x3545('0x54')]({'where':{'id':_0x5b9435[_0x3545('0x46')]['id']}})['then'](handleEntityNotFound(_0x492c61,null))[_0x3545('0x26')](function(_0x52d368){if(_0x52d368){_0x5412e9=_0x52d368;_0x1de5cc['model']=_[_0x3545('0x31')](db['User'][_0x3545('0x2d')]);_0x1de5cc['query']=_[_0x3545('0x31')](_0x5b9435['query']);_0x1de5cc[_0x3545('0x32')]=_[_0x3545('0x33')](_0x1de5cc['model'],_0x1de5cc[_0x3545('0x30')]);_0x14a737[_0x3545('0x35')]=_[_0x3545('0x33')](_0x1de5cc['model'],qs[_0x3545('0x36')](_0x5b9435[_0x3545('0x30')][_0x3545('0x36')]));_0x14a737[_0x3545('0x35')]=_0x14a737[_0x3545('0x35')][_0x3545('0x47')]?_0x14a737[_0x3545('0x35')]:_0x1de5cc[_0x3545('0x34')];_0x14a737['order']=qs[_0x3545('0x3a')](_0x5b9435[_0x3545('0x30')]['sort']);_0x14a737[_0x3545('0x3b')]=qs['filters'](_['pick'](_0x5b9435[_0x3545('0x30')],_0x1de5cc[_0x3545('0x32')]));if(_0x5b9435[_0x3545('0x30')][_0x3545('0x3e')]){_0x14a737[_0x3545('0x3b')]=_[_0x3545('0x3d')](_0x14a737[_0x3545('0x3b')],{'$or':_[_0x3545('0x2b')](_0x14a737[_0x3545('0x35')],function(_0x27f9b3){var _0xf36bfd={};_0xf36bfd[_0x27f9b3]={'$like':'%'+_0x5b9435[_0x3545('0x30')][_0x3545('0x3e')]+'%'};return _0xf36bfd;})});}_0x14a737=_[_0x3545('0x3d')]({},_0x14a737,_0x5b9435['options']);return _0x5412e9[_0x3545('0x89')](_0x14a737);}})[_0x3545('0x26')](function(_0x147eff){if(_0x147eff){_0x456cc8=_0x147eff[_0x3545('0x47')];if(!_0x5b9435[_0x3545('0x30')][_0x3545('0x37')]('nolimit')){_0x14a737[_0x3545('0x1c')]=qs[_0x3545('0x1c')](_0x5b9435['query'][_0x3545('0x1c')]);_0x14a737['offset']=qs[_0x3545('0x1b')](_0x5b9435[_0x3545('0x30')][_0x3545('0x1b')]);}return _0x5412e9[_0x3545('0x89')](_0x14a737);}})[_0x3545('0x26')](function(_0x48460f){if(_0x48460f){return _0x48460f?{'count':_0x456cc8,'rows':_0x48460f}:null;}})[_0x3545('0x26')](respondWithResult(_0x492c61,null))['catch'](handleError(_0x492c61,null));}; \ No newline at end of file +var _0x5853=['path','sox','ejs','crypto','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','redis','register','status','end','json','count','offset','limit','Content-Range','apply','reject','save','destroy','then','get','UserProfileResource','sendStatus','error','stack','name','send','index','map','FaxQueue','rawAttributes','fieldName','model','query','filters','intersection','fields','attributes','nolimit','sort','where','pick','filter','merge','type','includeAll','include','findAll','rows','catch','params','keys','options','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','update','getMembers','findOne','UserFaxQueue','FaxQueueId','User','findAndCountAll','UserId','agent','faxPause','updatedAt','createdAt','format','%s/%s','SIP','length','getTeams','addTeams','Team','online','voicePause','interface','flatMap','Agents','sequelize','transaction','each','findOrCreate','forEach','emit','userFaxQueue:save','removeTeams','ids','select','field','tq.TeamId','from','team_has_fax_queues','join','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','FaxQueueId\x20=\x20?','ut.UserId\x20=\x20?','push','toString','QueryTypes','SELECT','every','includes','union','compact','value','removeAgents','userFaxQueue:remove','addAgents','omit','spread','isArray','getAgents','hasOwnProperty','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util'];(function(_0x4a4f29,_0x466e4c){var _0xd30993=function(_0x13afd1){while(--_0x13afd1){_0x4a4f29['push'](_0x4a4f29['shift']());}};_0xd30993(++_0x466e4c);}(_0x5853,0x113));var _0x3585=function(_0x187842,_0x58331c){_0x187842=_0x187842-0x0;var _0x5dbcf3=_0x5853[_0x187842];return _0x5dbcf3;};'use strict';var pdf=require(_0x3585('0x0'));var emlformat=require(_0x3585('0x1'));var rimraf=require(_0x3585('0x2'));var zipdir=require(_0x3585('0x3'));var jsonpatch=require(_0x3585('0x4'));var rp=require('request-promise');var moment=require(_0x3585('0x5'));var BPromise=require(_0x3585('0x6'));var Mustache=require(_0x3585('0x7'));var util=require(_0x3585('0x8'));var path=require(_0x3585('0x9'));var sox=require(_0x3585('0xa'));var csv=require('to-csv');var ejs=require(_0x3585('0xb'));var fs=require('fs');var _=require('lodash');var squel=require('squel');var crypto=require(_0x3585('0xc'));var jsforce=require('jsforce');var deskjs=require(_0x3585('0xd'));var toCsv=require(_0x3585('0xe'));var querystring=require(_0x3585('0xf'));var Papa=require(_0x3585('0x10'));var Redis=require(_0x3585('0x11'));var authService=require(_0x3585('0x12'));var qs=require(_0x3585('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x3585('0x14'));var logger=require(_0x3585('0x15'))(_0x3585('0x16'));var utils=require(_0x3585('0x17'));var config=require(_0x3585('0x18'));var db=require(_0x3585('0x19'))['db'];config[_0x3585('0x1a')]=_['defaults'](config[_0x3585('0x1a')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require('./faxQueue.socket')[_0x3585('0x1b')](socket);function respondWithStatusCode(_0x500ae0,_0x16b42a){_0x16b42a=_0x16b42a||0xcc;return function(_0x1cfae3){if(_0x1cfae3){return _0x500ae0['sendStatus'](_0x16b42a);}return _0x500ae0[_0x3585('0x1c')](_0x16b42a)[_0x3585('0x1d')]();};}function respondWithResult(_0x5e31b2,_0x366723){_0x366723=_0x366723||0xc8;return function(_0x10449b){if(_0x10449b){return _0x5e31b2[_0x3585('0x1c')](_0x366723)[_0x3585('0x1e')](_0x10449b);}};}function respondWithFilteredResult(_0x2496a4,_0x59e340){return function(_0x3bd298){if(_0x3bd298){var _0x48c1db=_0x3bd298[_0x3585('0x1f')],_0x22cfec=_0x59e340[_0x3585('0x20')],_0x4493e5=_0x59e340[_0x3585('0x20')]+_0x59e340[_0x3585('0x21')],_0x3206d6;if(_0x4493e5>=_0x48c1db){_0x4493e5=_0x48c1db;_0x3206d6=0xc8;}else{_0x3206d6=0xce;}_0x2496a4['status'](_0x3206d6);return _0x2496a4['set'](_0x3585('0x22'),_0x22cfec+'-'+_0x4493e5+'/'+_0x48c1db)[_0x3585('0x1e')](_0x3bd298);}return null;};}function patchUpdates(_0x2f3819){return function(_0x1eba01){try{jsonpatch[_0x3585('0x23')](_0x1eba01,_0x2f3819,!![]);}catch(_0x58e6d0){return BPromise[_0x3585('0x24')](_0x58e6d0);}return _0x1eba01[_0x3585('0x25')]();};}function saveUpdates(_0x35975c,_0x2de21d){return function(_0x610d07){if(_0x610d07){return _0x610d07['update'](_0x35975c)['then'](function(_0x5dbbec){return _0x5dbbec;});}return null;};}function removeEntity(_0x5ec4c3,_0x568937){return function(_0x4d0cf6){if(_0x4d0cf6){return _0x4d0cf6[_0x3585('0x26')]()[_0x3585('0x27')](function(){var _0x388fe2=_0x4d0cf6[_0x3585('0x28')]({'plain':!![]});var _0x41e2f2='FaxQueues';return db[_0x3585('0x29')][_0x3585('0x26')]({'where':{'type':_0x41e2f2,'resourceId':_0x388fe2['id']}})['then'](function(){return _0x4d0cf6;});})[_0x3585('0x27')](function(){_0x5ec4c3['status'](0xcc)[_0x3585('0x1d')]();});}};}function handleEntityNotFound(_0x22c66f,_0xeb24a0){return function(_0x490ab0){if(!_0x490ab0){_0x22c66f[_0x3585('0x2a')](0x194);}return _0x490ab0;};}function handleError(_0x29257e,_0x3cb377){_0x3cb377=_0x3cb377||0x1f4;return function(_0x149c99){logger[_0x3585('0x2b')](_0x149c99[_0x3585('0x2c')]);if(_0x149c99[_0x3585('0x2d')]){delete _0x149c99[_0x3585('0x2d')];}_0x29257e['status'](_0x3cb377)[_0x3585('0x2e')](_0x149c99);};}exports[_0x3585('0x2f')]=function(_0x15ab31,_0x269e30){var _0x2f7da9={},_0x462254={},_0x5f1fd0={'count':0x0,'rows':[]};var _0x404806=_[_0x3585('0x30')](db[_0x3585('0x31')][_0x3585('0x32')],function(_0x118849){return{'name':_0x118849[_0x3585('0x33')],'type':_0x118849['type']['key']};});_0x462254[_0x3585('0x34')]=_[_0x3585('0x30')](_0x404806,_0x3585('0x2d'));_0x462254[_0x3585('0x35')]=_['keys'](_0x15ab31['query']);_0x462254[_0x3585('0x36')]=_[_0x3585('0x37')](_0x462254[_0x3585('0x34')],_0x462254[_0x3585('0x35')]);_0x2f7da9['attributes']=_[_0x3585('0x37')](_0x462254[_0x3585('0x34')],qs['fields'](_0x15ab31[_0x3585('0x35')][_0x3585('0x38')]));_0x2f7da9['attributes']=_0x2f7da9[_0x3585('0x39')]['length']?_0x2f7da9['attributes']:_0x462254[_0x3585('0x34')];if(!_0x15ab31[_0x3585('0x35')]['hasOwnProperty'](_0x3585('0x3a'))){_0x2f7da9[_0x3585('0x21')]=qs[_0x3585('0x21')](_0x15ab31[_0x3585('0x35')][_0x3585('0x21')]);_0x2f7da9['offset']=qs[_0x3585('0x20')](_0x15ab31[_0x3585('0x35')][_0x3585('0x20')]);}_0x2f7da9['order']=qs[_0x3585('0x3b')](_0x15ab31['query'][_0x3585('0x3b')]);_0x2f7da9[_0x3585('0x3c')]=qs[_0x3585('0x36')](_[_0x3585('0x3d')](_0x15ab31['query'],_0x462254['filters']));if(_0x15ab31[_0x3585('0x35')][_0x3585('0x3e')]){_0x2f7da9['where']=_[_0x3585('0x3f')](_0x2f7da9[_0x3585('0x3c')],{'$or':_[_0x3585('0x30')](_0x404806,function(_0x3f1d2f){if(_0x3f1d2f[_0x3585('0x40')]!=='VIRTUAL'){var _0x10bb65={};_0x10bb65[_0x3f1d2f[_0x3585('0x2d')]]={'$like':'%'+_0x15ab31[_0x3585('0x35')][_0x3585('0x3e')]+'%'};return _0x10bb65;}})});}_0x2f7da9=_[_0x3585('0x3f')]({},_0x2f7da9,_0x15ab31['options']);var _0x4bdb77={'where':_0x2f7da9['where']};return db[_0x3585('0x31')]['count'](_0x4bdb77)[_0x3585('0x27')](function(_0x3d1aff){_0x5f1fd0[_0x3585('0x1f')]=_0x3d1aff;if(_0x15ab31[_0x3585('0x35')][_0x3585('0x41')]){_0x2f7da9[_0x3585('0x42')]=[{'all':!![]}];}return db[_0x3585('0x31')][_0x3585('0x43')](_0x2f7da9);})['then'](function(_0x491d6d){_0x5f1fd0[_0x3585('0x44')]=_0x491d6d;return _0x5f1fd0;})[_0x3585('0x27')](respondWithFilteredResult(_0x269e30,_0x2f7da9))[_0x3585('0x45')](handleError(_0x269e30,null));};exports['show']=function(_0x2ca4d3,_0x40b5ef){var _0x3bb158={'raw':!![],'where':{'id':_0x2ca4d3[_0x3585('0x46')]['id']}},_0xc7e54d={};_0xc7e54d[_0x3585('0x34')]=_[_0x3585('0x47')](db[_0x3585('0x31')][_0x3585('0x32')]);_0xc7e54d[_0x3585('0x35')]=_[_0x3585('0x47')](_0x2ca4d3[_0x3585('0x35')]);_0xc7e54d[_0x3585('0x36')]=_[_0x3585('0x37')](_0xc7e54d[_0x3585('0x34')],_0xc7e54d['query']);_0x3bb158['attributes']=_['intersection'](_0xc7e54d['model'],qs[_0x3585('0x38')](_0x2ca4d3[_0x3585('0x35')][_0x3585('0x38')]));_0x3bb158[_0x3585('0x39')]=_0x3bb158[_0x3585('0x39')]['length']?_0x3bb158['attributes']:_0xc7e54d[_0x3585('0x34')];if(_0x2ca4d3['query']['includeAll']){_0x3bb158[_0x3585('0x42')]=[{'all':!![]}];}_0x3bb158=_['merge']({},_0x3bb158,_0x2ca4d3[_0x3585('0x48')]);return db[_0x3585('0x31')][_0x3585('0x49')](_0x3bb158)[_0x3585('0x27')](handleEntityNotFound(_0x40b5ef,null))[_0x3585('0x27')](respondWithResult(_0x40b5ef,null))[_0x3585('0x45')](handleError(_0x40b5ef,null));};exports[_0x3585('0x4a')]=function(_0x2c6c5b,_0x2b0bdb){return db[_0x3585('0x31')][_0x3585('0x4a')](_0x2c6c5b[_0x3585('0x4b')],{})[_0x3585('0x27')](function(_0x33fd90){var _0x18298f=_0x2c6c5b[_0x3585('0x4c')][_0x3585('0x28')]({'plain':!![]});if(!_0x18298f)throw new Error(_0x3585('0x4d'));if(_0x18298f[_0x3585('0x4e')]===_0x3585('0x4c')){var _0x417540=_0x33fd90[_0x3585('0x28')]({'plain':!![]});var _0x2acc5d='FaxQueues';return db[_0x3585('0x4f')][_0x3585('0x49')]({'where':{'name':_0x2acc5d,'userProfileId':_0x18298f[_0x3585('0x50')]},'raw':!![]})[_0x3585('0x27')](function(_0x30bd9a){if(_0x30bd9a&&_0x30bd9a[_0x3585('0x51')]===0x0){return db['UserProfileResource']['create']({'name':_0x417540['name'],'resourceId':_0x417540['id'],'type':_0x30bd9a['name'],'sectionId':_0x30bd9a['id']},{})[_0x3585('0x27')](function(){return _0x33fd90;});}else{return _0x33fd90;}})[_0x3585('0x45')](function(_0x25b82c){logger[_0x3585('0x2b')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x25b82c);throw _0x25b82c;});}return _0x33fd90;})[_0x3585('0x27')](respondWithResult(_0x2b0bdb,0xc9))[_0x3585('0x45')](handleError(_0x2b0bdb,null));};exports[_0x3585('0x52')]=function(_0xc8348d,_0x23e635){if(_0xc8348d[_0x3585('0x4b')]['id']){delete _0xc8348d[_0x3585('0x4b')]['id'];}return db[_0x3585('0x31')]['find']({'where':{'id':_0xc8348d[_0x3585('0x46')]['id']}})[_0x3585('0x27')](handleEntityNotFound(_0x23e635,null))['then'](saveUpdates(_0xc8348d[_0x3585('0x4b')],null))[_0x3585('0x27')](respondWithResult(_0x23e635,null))[_0x3585('0x45')](handleError(_0x23e635,null));};exports[_0x3585('0x26')]=function(_0x5b6f1b,_0x1c68d9){return db['FaxQueue'][_0x3585('0x49')]({'where':{'id':_0x5b6f1b['params']['id']}})[_0x3585('0x27')](handleEntityNotFound(_0x1c68d9,null))['then'](removeEntity(_0x1c68d9,null))[_0x3585('0x45')](handleError(_0x1c68d9,null));};exports['describe']=function(_0x418aba,_0x5ce4f1){return db['FaxQueue']['describe']()[_0x3585('0x27')](respondWithResult(_0x5ce4f1,null))[_0x3585('0x45')](handleError(_0x5ce4f1,null));};exports[_0x3585('0x53')]=function(_0x175bb4,_0x148f6a,_0x508884){var _0x5c4d34={'raw':!![],'where':{}},_0x5ddd83={},_0x4a3484;return db[_0x3585('0x31')][_0x3585('0x54')]({'where':{'id':_0x175bb4[_0x3585('0x46')]['id']}})['then'](handleEntityNotFound(_0x148f6a,null))['then'](function(_0xb28aac){if(_0xb28aac){_0x4a3484=_0xb28aac['get']({'plain':!![]});_0x5ddd83['model']=_[_0x3585('0x47')](db[_0x3585('0x55')][_0x3585('0x32')]);_0x5ddd83['query']=_[_0x3585('0x47')](_0x175bb4['query']);_0x5ddd83[_0x3585('0x36')]=_[_0x3585('0x37')](_0x5ddd83['model'],_0x5ddd83[_0x3585('0x35')]);_0x5c4d34[_0x3585('0x39')]=_[_0x3585('0x37')](_0x5ddd83[_0x3585('0x34')],qs[_0x3585('0x38')](_0x175bb4[_0x3585('0x35')][_0x3585('0x38')]));_0x5c4d34[_0x3585('0x39')]=_0x5c4d34[_0x3585('0x39')]['length']?_0x5c4d34[_0x3585('0x39')]:_0x5ddd83[_0x3585('0x34')];if(!_0x175bb4[_0x3585('0x35')]['hasOwnProperty']('nolimit')){_0x5c4d34[_0x3585('0x21')]=qs[_0x3585('0x21')](_0x175bb4[_0x3585('0x35')]['limit']);_0x5c4d34[_0x3585('0x20')]=qs[_0x3585('0x20')](_0x175bb4['query'][_0x3585('0x20')]);}_0x5c4d34['order']=qs['sort'](_0x175bb4[_0x3585('0x35')][_0x3585('0x3b')]);_0x5c4d34[_0x3585('0x3c')]=qs['filters'](_[_0x3585('0x3d')](_0x175bb4[_0x3585('0x35')],_0x5ddd83['filters']));_0x5c4d34['where'][_0x3585('0x56')]=_0xb28aac['id'];if(_0x175bb4[_0x3585('0x35')][_0x3585('0x3e')]){_0x5c4d34[_0x3585('0x3c')]=_[_0x3585('0x3f')](_0x5c4d34['where'],{'$or':_['map'](_0x5c4d34[_0x3585('0x39')],function(_0x555717){var _0x534e16={};_0x534e16[_0x555717]={'$like':'%'+_0x175bb4[_0x3585('0x35')]['filter']+'%'};return _0x534e16;})});}_0x5c4d34=_[_0x3585('0x3f')]({},_0x5c4d34,_0x175bb4[_0x3585('0x48')]);return db[_0x3585('0x55')]['findAll'](_0x5c4d34);}})[_0x3585('0x27')](function(_0xa4d20a){if(_0xa4d20a){return db[_0x3585('0x57')][_0x3585('0x58')]({'where':{'id':_['map'](_0xa4d20a,_0x3585('0x59')),'role':_0x3585('0x5a')},'attributes':['id',_0x3585('0x2d'),_0x3585('0x5b'),_0x3585('0x5c'),_0x3585('0x5d')]});}})[_0x3585('0x27')](function(_0x124a61){if(_0x124a61){return{'count':_0x124a61['count'],'rows':_[_0x3585('0x30')](_0x124a61[_0x3585('0x44')],function(_0x2a3d23){return{'membername':_0x2a3d23[_0x3585('0x2d')],'UserId':_0x2a3d23['id'],'queue_name':_0x4a3484[_0x3585('0x2d')],'FaxQueueId':_0x4a3484['id'],'interface':util[_0x3585('0x5e')](_0x3585('0x5f'),_0x3585('0x60'),_0x2a3d23['name']),'penalty':0x0,'paused':_0x2a3d23[_0x3585('0x5b')],'createdAt':_0x2a3d23['createdAt'],'updatedAt':_0x2a3d23[_0x3585('0x5c')]};})};}else{return{'count':0x0,'rows':[]};}})['then'](respondWithFilteredResult(_0x148f6a,_0x5c4d34))[_0x3585('0x45')](handleError(_0x148f6a,null));};exports['getTeams']=function(_0x511e90,_0x51ca0f,_0x369712){var _0x38bc3a={};var _0x1b5cdc={};var _0x3af83c;var _0x140707;return db['FaxQueue'][_0x3585('0x54')]({'where':{'id':_0x511e90[_0x3585('0x46')]['id']}})[_0x3585('0x27')](handleEntityNotFound(_0x51ca0f,null))['then'](function(_0x2bd488){if(_0x2bd488){_0x3af83c=_0x2bd488;_0x1b5cdc[_0x3585('0x34')]=_['keys'](db['Team'][_0x3585('0x32')]);_0x1b5cdc[_0x3585('0x35')]=_[_0x3585('0x47')](_0x511e90[_0x3585('0x35')]);_0x1b5cdc[_0x3585('0x36')]=_[_0x3585('0x37')](_0x1b5cdc[_0x3585('0x34')],_0x1b5cdc[_0x3585('0x35')]);_0x38bc3a[_0x3585('0x39')]=_[_0x3585('0x37')](_0x1b5cdc['model'],qs[_0x3585('0x38')](_0x511e90['query'][_0x3585('0x38')]));_0x38bc3a['attributes']=_0x38bc3a[_0x3585('0x39')][_0x3585('0x61')]?_0x38bc3a['attributes']:_0x1b5cdc['model'];_0x38bc3a['order']=qs['sort'](_0x511e90[_0x3585('0x35')][_0x3585('0x3b')]);_0x38bc3a[_0x3585('0x3c')]=qs[_0x3585('0x36')](_[_0x3585('0x3d')](_0x511e90['query'],_0x1b5cdc['filters']));if(_0x511e90[_0x3585('0x35')]['filter']){_0x38bc3a[_0x3585('0x3c')]=_['merge'](_0x38bc3a[_0x3585('0x3c')],{'$or':_[_0x3585('0x30')](_0x38bc3a[_0x3585('0x39')],function(_0x352eb7){var _0x28f1af={};_0x28f1af[_0x352eb7]={'$like':'%'+_0x511e90[_0x3585('0x35')]['filter']+'%'};return _0x28f1af;})});}_0x38bc3a=_[_0x3585('0x3f')]({},_0x38bc3a,_0x511e90[_0x3585('0x48')]);return _0x3af83c[_0x3585('0x62')](_0x38bc3a);}})[_0x3585('0x27')](function(_0x50f598){if(_0x50f598){_0x140707=_0x50f598['length'];if(!_0x511e90[_0x3585('0x35')]['hasOwnProperty']('nolimit')){_0x38bc3a['limit']=qs[_0x3585('0x21')](_0x511e90['query'][_0x3585('0x21')]);_0x38bc3a[_0x3585('0x20')]=qs['offset'](_0x511e90[_0x3585('0x35')][_0x3585('0x20')]);}return _0x3af83c['getTeams'](_0x38bc3a);}})[_0x3585('0x27')](function(_0x2a7e10){if(_0x2a7e10){return _0x2a7e10?{'count':_0x140707,'rows':_0x2a7e10}:null;}})['then'](respondWithResult(_0x51ca0f,null))[_0x3585('0x45')](handleError(_0x51ca0f,null));};exports[_0x3585('0x63')]=function(_0x2b71fa,_0x4bc9a3,_0x20282f){var _0x8bee35=_0x2b71fa[_0x3585('0x4b')]['ids'];return db[_0x3585('0x64')]['findAll']({'where':{'id':_0x8bee35},'attributes':['id'],'include':[{'model':db['User'],'as':'Agents','attributes':['id',_0x3585('0x2d'),_0x3585('0x65'),_0x3585('0x66'),_0x3585('0x67')],'raw':!![]}]})['then'](function(_0x2c6143){if(_0x2c6143){var _0x4d05f0=_[_0x3585('0x68')](_0x2c6143,function(_0x1e6ce8){var _0x82ce5e=_0x1e6ce8[_0x3585('0x28')]({'plain':!![]});return _0x82ce5e[_0x3585('0x69')];});return db[_0x3585('0x31')][_0x3585('0x49')]({'where':{'id':_0x2b71fa['params']['id']}})[_0x3585('0x27')](function(_0x5d89f5){return db[_0x3585('0x6a')][_0x3585('0x6b')](function(_0x4f348f){return _0x5d89f5[_0x3585('0x63')](_0x8bee35,{'transaction':_0x4f348f})['then'](function(){return BPromise[_0x3585('0x6c')](_0x4d05f0,function(_0x2aa183){return db[_0x3585('0x55')][_0x3585('0x6d')]({'where':{'UserId':_0x2aa183['id'],'FaxQueueId':_0x2b71fa[_0x3585('0x46')]['id']},'transaction':_0x4f348f});});})[_0x3585('0x27')](function(){_0x4d05f0[_0x3585('0x6e')](function(_0x3898c4){socket[_0x3585('0x6f')](_0x3585('0x70'),{'UserId':_0x3898c4['id'],'FaxQueueId':_0x5d89f5['id']});});});});});}})[_0x3585('0x27')](respondWithStatusCode(_0x4bc9a3,null))[_0x3585('0x45')](handleError(_0x4bc9a3,null));};exports[_0x3585('0x71')]=function(_0x3fc306,_0x16876e,_0x38af70){return db[_0x3585('0x64')]['findAll']({'where':{'id':_0x3fc306['query'][_0x3585('0x72')]},'attributes':['id'],'include':[{'model':db[_0x3585('0x57')],'as':'Agents','attributes':['id'],'raw':!![]}]})['then'](handleEntityNotFound(_0x16876e,null))[_0x3585('0x27')](function(_0x3d6133){var _0x27c5c7=_[_0x3585('0x30')](_0x3d6133,'id');var _0x1d8713=[];var _0x507bc0=[];var _0xd61ab5=squel[_0x3585('0x73')]();_0xd61ab5[_0x3585('0x74')](_0x3585('0x75'))[_0x3585('0x76')](_0x3585('0x77'),'tq')[_0x3585('0x78')](_0x3585('0x79'),'ut',_0x3585('0x7a'))[_0x3585('0x3c')](_0x3585('0x7b'),_0x3fc306[_0x3585('0x46')]['id']);for(var _0x434780=0x0;_0x434780<_0x3d6133[_0x3585('0x61')];_0x434780+=0x1){let _0x25b767=_0x3d6133[_0x434780];for(var _0x123e33=0x0;_0x123e33<_0x25b767['Agents'][_0x3585('0x61')];_0x123e33+=0x1){let _0x2acb7d=_0x25b767[_0x3585('0x69')][_0x123e33];var _0x37f080=_0xd61ab5['clone']();_0x37f080['where'](_0x3585('0x7c'),_0x2acb7d['id']);_0x507bc0[_0x3585('0x7d')](db['sequelize'][_0x3585('0x35')](_0x37f080[_0x3585('0x7e')](),{'type':db[_0x3585('0x6a')][_0x3585('0x7f')][_0x3585('0x80')]})[_0x3585('0x27')](function(_0x24c39c){if(_0x24c39c[_0x3585('0x61')]===0x1){return _0x2acb7d['id'];}else{var _0x5cd337=_[_0x3585('0x81')](_['map'](_0x24c39c,'TeamId'),function(_0x200ba2){return _[_0x3585('0x82')](_0x27c5c7,_0x200ba2);});if(_0x5cd337){return _0x2acb7d['id'];}}}));}}return BPromise['all'](_0x507bc0)['then'](function(_0x3b824b){_0x1d8713=_(_0x1d8713)[_0x3585('0x83')](_0x3b824b)[_0x3585('0x84')]()[_0x3585('0x85')]();return db[_0x3585('0x31')][_0x3585('0x49')]({'where':{'id':_0x3fc306['params']['id']}})['then'](function(_0x1680e8){return db[_0x3585('0x6a')][_0x3585('0x6b')](function(_0xf1d0f6){return _0x1680e8[_0x3585('0x71')](_0x3fc306['query'][_0x3585('0x72')],{'transaction':_0xf1d0f6})[_0x3585('0x27')](function(){if(!_['isEmpty'](_0x1d8713)){return _0x1680e8[_0x3585('0x86')](_0x1d8713,{'transaction':_0xf1d0f6});}})['then'](function(){_0x1d8713[_0x3585('0x6e')](function(_0x3d0a01){socket[_0x3585('0x6f')](_0x3585('0x87'),{'UserId':_0x3d0a01,'FaxQueueId':_0x1680e8['id']});});});});});});})[_0x3585('0x27')](respondWithStatusCode(_0x16876e,null))[_0x3585('0x45')](handleError(_0x16876e,null));};exports[_0x3585('0x88')]=function(_0x12b8d5,_0x45cbe5,_0x211f2f){return db[_0x3585('0x31')]['find']({'where':{'id':_0x12b8d5[_0x3585('0x46')]['id']}})[_0x3585('0x27')](handleEntityNotFound(_0x45cbe5,null))['then'](function(_0x681432){if(_0x681432){return _0x681432[_0x3585('0x88')](_0x12b8d5[_0x3585('0x4b')][_0x3585('0x72')],_[_0x3585('0x89')](_0x12b8d5[_0x3585('0x4b')],[_0x3585('0x72'),'id'])||{})[_0x3585('0x8a')](function(_0xc90756){for(var _0x12f5fd=0x0;_0x12f5fd<_0x12b8d5['body']['ids'][_0x3585('0x61')];_0x12f5fd+=0x1){socket[_0x3585('0x6f')]('userFaxQueue:save',{'UserId':_0x12b8d5['body'][_0x3585('0x72')][_0x12f5fd],'FaxQueueId':_0x12b8d5[_0x3585('0x46')]['id']});}return _0xc90756;});}})[_0x3585('0x27')](respondWithResult(_0x45cbe5,null))[_0x3585('0x45')](handleError(_0x45cbe5,null));};exports[_0x3585('0x86')]=function(_0x34a970,_0x1ab294,_0x7c941a){return db[_0x3585('0x31')]['find']({'where':{'id':_0x34a970[_0x3585('0x46')]['id']}})[_0x3585('0x27')](handleEntityNotFound(_0x1ab294,null))[_0x3585('0x27')](function(_0x413769){if(_0x413769){return _0x413769[_0x3585('0x86')](_0x34a970[_0x3585('0x35')]['ids'])[_0x3585('0x27')](function(){if(_[_0x3585('0x8b')](_0x34a970['query'][_0x3585('0x72')])){for(var _0x5c8b31=0x0;_0x5c8b31<_0x34a970['query'][_0x3585('0x72')][_0x3585('0x61')];_0x5c8b31+=0x1){socket[_0x3585('0x6f')]('userFaxQueue:remove',{'UserId':Number(_0x34a970[_0x3585('0x35')][_0x3585('0x72')][_0x5c8b31]),'FaxQueueId':Number(_0x34a970['params']['id'])});}}else{socket[_0x3585('0x6f')](_0x3585('0x87'),{'UserId':Number(_0x34a970[_0x3585('0x35')][_0x3585('0x72')]),'FaxQueueId':Number(_0x34a970['params']['id'])});}});}})['then'](respondWithStatusCode(_0x1ab294,null))[_0x3585('0x45')](handleError(_0x1ab294,null));};exports['getAgents']=function(_0x361cb3,_0x29963b,_0x4eabcd){var _0xca4870={};var _0x2aa431={};var _0x879161;var _0x24d993;return db[_0x3585('0x31')]['findOne']({'where':{'id':_0x361cb3[_0x3585('0x46')]['id']}})[_0x3585('0x27')](handleEntityNotFound(_0x29963b,null))[_0x3585('0x27')](function(_0x471f91){if(_0x471f91){_0x879161=_0x471f91;_0x2aa431['model']=_['keys'](db['User']['rawAttributes']);_0x2aa431['query']=_[_0x3585('0x47')](_0x361cb3['query']);_0x2aa431[_0x3585('0x36')]=_[_0x3585('0x37')](_0x2aa431[_0x3585('0x34')],_0x2aa431[_0x3585('0x35')]);_0xca4870[_0x3585('0x39')]=_[_0x3585('0x37')](_0x2aa431[_0x3585('0x34')],qs['fields'](_0x361cb3[_0x3585('0x35')]['fields']));_0xca4870[_0x3585('0x39')]=_0xca4870[_0x3585('0x39')][_0x3585('0x61')]?_0xca4870[_0x3585('0x39')]:_0x2aa431[_0x3585('0x34')];_0xca4870['order']=qs[_0x3585('0x3b')](_0x361cb3[_0x3585('0x35')][_0x3585('0x3b')]);_0xca4870[_0x3585('0x3c')]=qs['filters'](_[_0x3585('0x3d')](_0x361cb3['query'],_0x2aa431[_0x3585('0x36')]));if(_0x361cb3['query']['filter']){_0xca4870[_0x3585('0x3c')]=_['merge'](_0xca4870[_0x3585('0x3c')],{'$or':_[_0x3585('0x30')](_0xca4870[_0x3585('0x39')],function(_0x23aaf3){var _0x368a3d={};_0x368a3d[_0x23aaf3]={'$like':'%'+_0x361cb3[_0x3585('0x35')]['filter']+'%'};return _0x368a3d;})});}_0xca4870=_[_0x3585('0x3f')]({},_0xca4870,_0x361cb3[_0x3585('0x48')]);return _0x879161[_0x3585('0x8c')](_0xca4870);}})[_0x3585('0x27')](function(_0x47e99c){if(_0x47e99c){_0x24d993=_0x47e99c[_0x3585('0x61')];if(!_0x361cb3['query'][_0x3585('0x8d')]('nolimit')){_0xca4870['limit']=qs[_0x3585('0x21')](_0x361cb3[_0x3585('0x35')][_0x3585('0x21')]);_0xca4870['offset']=qs[_0x3585('0x20')](_0x361cb3['query']['offset']);}return _0x879161['getAgents'](_0xca4870);}})['then'](function(_0x48600c){if(_0x48600c){return _0x48600c?{'count':_0x24d993,'rows':_0x48600c}:null;}})[_0x3585('0x27')](respondWithResult(_0x29963b,null))[_0x3585('0x45')](handleError(_0x29963b,null));}; \ No newline at end of file diff --git a/server/api/faxQueue/faxQueue.events.js b/server/api/faxQueue/faxQueue.events.js index 9adaf30..a82ac50 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 _0x00cb=['hook','events','FaxQueue','setMaxListeners','save','remove','emit','hasOwnProperty'];(function(_0x278696,_0x1a14a0){var _0xdce186=function(_0xc4431f){while(--_0xc4431f){_0x278696['push'](_0x278696['shift']());}};_0xdce186(++_0x1a14a0);}(_0x00cb,0x1c1));var _0xb00c=function(_0x24a2b0,_0x264053){_0x24a2b0=_0x24a2b0-0x0;var _0x477d85=_0x00cb[_0x24a2b0];return _0x477d85;};'use strict';var EventEmitter=require(_0xb00c('0x0'));var FaxQueue=require('../../mysqldb')['db'][_0xb00c('0x1')];var FaxQueueEvents=new EventEmitter();FaxQueueEvents[_0xb00c('0x2')](0x0);var events={'afterCreate':_0xb00c('0x3'),'afterUpdate':'update','afterDestroy':_0xb00c('0x4')};function emitEvent(_0x46618f){return function(_0x17f330,_0x2c414c,_0x5966ba){FaxQueueEvents[_0xb00c('0x5')](_0x46618f+':'+_0x17f330['id'],_0x17f330);FaxQueueEvents[_0xb00c('0x5')](_0x46618f,_0x17f330);_0x5966ba(null);};}for(var e in events){if(events[_0xb00c('0x6')](e)){var event=events[e];FaxQueue[_0xb00c('0x7')](e,emitEvent(event));}}module['exports']=FaxQueueEvents; \ No newline at end of file +var _0x64eb=['exports','FaxQueue','setMaxListeners','save','remove','emit','hasOwnProperty'];(function(_0x53ccf2,_0x13cb67){var _0x5a2964=function(_0x3b0514){while(--_0x3b0514){_0x53ccf2['push'](_0x53ccf2['shift']());}};_0x5a2964(++_0x13cb67);}(_0x64eb,0x197));var _0xb64e=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x64eb[_0x14add3];return _0x4a174f;};'use strict';var EventEmitter=require('events');var FaxQueue=require('../../mysqldb')['db'][_0xb64e('0x0')];var FaxQueueEvents=new EventEmitter();FaxQueueEvents[_0xb64e('0x1')](0x0);var events={'afterCreate':_0xb64e('0x2'),'afterUpdate':'update','afterDestroy':_0xb64e('0x3')};function emitEvent(_0x2259ad){return function(_0x3dad5d,_0x3e2c39,_0x1a5025){FaxQueueEvents['emit'](_0x2259ad+':'+_0x3dad5d['id'],_0x3dad5d);FaxQueueEvents[_0xb64e('0x4')](_0x2259ad,_0x3dad5d);_0x1a5025(null);};}for(var e in events){if(events[_0xb64e('0x5')](e)){var event=events[e];FaxQueue['hook'](e,emitEvent(event));}}module[_0xb64e('0x6')]=FaxQueueEvents; \ No newline at end of file diff --git a/server/api/faxQueue/faxQueue.model.js b/server/api/faxQueue/faxQueue.model.js index b1cab4f..18087e2 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 _0xdcbf=['define','FaxQueue','fax_queues','moment','bluebird','request-promise','path','../../config/environment','./faxQueue.attributes','exports'];(function(_0x4e92bc,_0x4feee2){var _0x342bfc=function(_0x29722a){while(--_0x29722a){_0x4e92bc['push'](_0x4e92bc['shift']());}};_0x342bfc(++_0x4feee2);}(_0xdcbf,0xf3));var _0xfdcb=function(_0x3947c9,_0x4d6c97){_0x3947c9=_0x3947c9-0x0;var _0x2e7871=_0xdcbf[_0x3947c9];return _0x2e7871;};'use strict';var _=require('lodash');var util=require('util');var logger=require('../../config/logger')('api');var moment=require(_0xfdcb('0x0'));var BPromise=require(_0xfdcb('0x1'));var rp=require(_0xfdcb('0x2'));var fs=require('fs');var path=require(_0xfdcb('0x3'));var rimraf=require('rimraf');var config=require(_0xfdcb('0x4'));var attributes=require(_0xfdcb('0x5'));module[_0xfdcb('0x6')]=function(_0x48b0b4,_0xc6708){return _0x48b0b4[_0xfdcb('0x7')](_0xfdcb('0x8'),attributes,{'tableName':_0xfdcb('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xff0c=['./faxQueue.attributes','exports','define','FaxQueue','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment'];(function(_0x59162a,_0x10e547){var _0x35e50d=function(_0x578425){while(--_0x578425){_0x59162a['push'](_0x59162a['shift']());}};_0x35e50d(++_0x10e547);}(_0xff0c,0x100));var _0xcff0=function(_0x628eee,_0x3f3fba){_0x628eee=_0x628eee-0x0;var _0x447718=_0xff0c[_0x628eee];return _0x447718;};'use strict';var _=require(_0xcff0('0x0'));var util=require(_0xcff0('0x1'));var logger=require(_0xcff0('0x2'))(_0xcff0('0x3'));var moment=require(_0xcff0('0x4'));var BPromise=require(_0xcff0('0x5'));var rp=require(_0xcff0('0x6'));var fs=require('fs');var path=require(_0xcff0('0x7'));var rimraf=require(_0xcff0('0x8'));var config=require(_0xcff0('0x9'));var attributes=require(_0xcff0('0xa'));module[_0xcff0('0xb')]=function(_0x5e7764,_0x1c8e33){return _0x5e7764[_0xcff0('0xc')](_0xcff0('0xd'),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 b83dd48..d801bb3 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 _0x6f08=['debug','catch','FaxQueue','find','ShowFaxQueue','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','http','defaults','redis','localhost','socket.io-emitter','./faxQueue.socket','register','request','then','info','FaxQueue,\x20%s,\x20%s','FaxQueue,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','GetFaxQueue','options','raw','where','attributes','limit','include','model','map'];(function(_0x56643c,_0x2afe4b){var _0x217d68=function(_0x511bd7){while(--_0x511bd7){_0x56643c['push'](_0x56643c['shift']());}};_0x217d68(++_0x2afe4b);}(_0x6f08,0xa5));var _0x86f0=function(_0x3d1582,_0x2b4737){_0x3d1582=_0x3d1582-0x0;var _0x5a1e09=_0x6f08[_0x3d1582];return _0x5a1e09;};'use strict';var _=require(_0x86f0('0x0'));var util=require(_0x86f0('0x1'));var moment=require(_0x86f0('0x2'));var BPromise=require(_0x86f0('0x3'));var rs=require(_0x86f0('0x4'));var fs=require('fs');var Redis=require(_0x86f0('0x5'));var db=require(_0x86f0('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0x86f0('0x7'))(_0x86f0('0x8'));var config=require(_0x86f0('0x9'));var jayson=require('jayson/promise');var client=jayson['client'][_0x86f0('0xa')]({'port':0x232a});config['redis']=_[_0x86f0('0xb')](config[_0x86f0('0xc')],{'host':_0x86f0('0xd'),'port':0x18eb});var socket=require(_0x86f0('0xe'))(new Redis(config['redis']));require(_0x86f0('0xf'))[_0x86f0('0x10')](socket);function respondWithRpcPromise(_0x443d84,_0x4420fc,_0x1c1fe9){return new BPromise(function(_0x416c0c,_0x507c5c){return client[_0x86f0('0x11')](_0x443d84,_0x1c1fe9)[_0x86f0('0x12')](function(_0x3415ca){logger[_0x86f0('0x13')](_0x86f0('0x14'),_0x4420fc,'request\x20sent');logger['debug'](_0x86f0('0x15'),_0x4420fc,_0x86f0('0x16'),JSON[_0x86f0('0x17')](_0x3415ca));if(_0x3415ca[_0x86f0('0x18')]){if(_0x3415ca[_0x86f0('0x18')]['code']===0x1f4){logger[_0x86f0('0x18')](_0x86f0('0x14'),_0x4420fc,_0x3415ca[_0x86f0('0x18')][_0x86f0('0x19')]);return _0x507c5c(_0x3415ca[_0x86f0('0x18')][_0x86f0('0x19')]);}logger['error'](_0x86f0('0x14'),_0x4420fc,_0x3415ca[_0x86f0('0x18')]['message']);return _0x416c0c(_0x3415ca['error'][_0x86f0('0x19')]);}else{logger[_0x86f0('0x13')](_0x86f0('0x14'),_0x4420fc,_0x86f0('0x16'));_0x416c0c(_0x3415ca['result'][_0x86f0('0x19')]);}})['catch'](function(_0x436bb7){logger['error'](_0x86f0('0x14'),_0x4420fc,_0x436bb7);_0x507c5c(_0x436bb7);});});}exports[_0x86f0('0x1a')]=function(_0x5a73fe){var _0x4c0163=this;return new Promise(function(_0x44a50e,_0x2b4460){return db['FaxQueue']['findAll']({'raw':_0x5a73fe[_0x86f0('0x1b')]?_0x5a73fe[_0x86f0('0x1b')][_0x86f0('0x1c')]===undefined?!![]:![]:!![],'where':_0x5a73fe[_0x86f0('0x1b')]?_0x5a73fe[_0x86f0('0x1b')][_0x86f0('0x1d')]||null:null,'attributes':_0x5a73fe[_0x86f0('0x1b')]?_0x5a73fe['options'][_0x86f0('0x1e')]||null:null,'limit':_0x5a73fe['options']?_0x5a73fe[_0x86f0('0x1b')][_0x86f0('0x1f')]||null:null,'include':_0x5a73fe[_0x86f0('0x1b')]?_0x5a73fe[_0x86f0('0x1b')][_0x86f0('0x20')]?_['map'](_0x5a73fe['options'][_0x86f0('0x20')],function(_0x45be4d){return{'model':db[_0x45be4d[_0x86f0('0x21')]],'as':_0x45be4d['as'],'attributes':_0x45be4d[_0x86f0('0x1e')],'include':_0x45be4d['include']?_[_0x86f0('0x22')](_0x45be4d['include'],function(_0x402801){return{'model':db[_0x402801[_0x86f0('0x21')]],'as':_0x402801['as'],'attributes':_0x402801['attributes'],'include':_0x402801['include']?_['map'](_0x402801[_0x86f0('0x20')],function(_0x1caacc){return{'model':db[_0x1caacc[_0x86f0('0x21')]],'as':_0x1caacc['as'],'attributes':_0x1caacc[_0x86f0('0x1e')]};}):[]};}):[]};}):[]:[]})[_0x86f0('0x12')](function(_0x375fe1){logger['info'](_0x86f0('0x1a'),_0x5a73fe);logger[_0x86f0('0x23')](_0x86f0('0x1a'),_0x5a73fe,JSON[_0x86f0('0x17')](_0x375fe1));_0x44a50e(_0x375fe1);})[_0x86f0('0x24')](function(_0x114b7a){logger[_0x86f0('0x18')](_0x86f0('0x1a'),_0x114b7a[_0x86f0('0x19')],_0x5a73fe);_0x2b4460(_0x4c0163[_0x86f0('0x18')](0x1f4,_0x114b7a[_0x86f0('0x19')]));});});};exports['ShowFaxQueue']=function(_0x3fc113){var _0x27b416=this;return new Promise(function(_0x318dfa,_0x373ec4){return db[_0x86f0('0x25')][_0x86f0('0x26')]({'raw':_0x3fc113['options']?_0x3fc113[_0x86f0('0x1b')]['raw']===undefined?!![]:![]:!![],'where':_0x3fc113[_0x86f0('0x1b')]?_0x3fc113[_0x86f0('0x1b')][_0x86f0('0x1d')]||null:null,'attributes':_0x3fc113[_0x86f0('0x1b')]?_0x3fc113[_0x86f0('0x1b')][_0x86f0('0x1e')]||null:null,'include':_0x3fc113[_0x86f0('0x1b')]?_0x3fc113[_0x86f0('0x1b')][_0x86f0('0x20')]?_[_0x86f0('0x22')](_0x3fc113['options']['include'],function(_0x2aae0c){return{'model':db[_0x2aae0c[_0x86f0('0x21')]],'as':_0x2aae0c['as'],'attributes':_0x2aae0c['attributes'],'include':_0x2aae0c[_0x86f0('0x20')]?_[_0x86f0('0x22')](_0x2aae0c[_0x86f0('0x20')],function(_0x42c02f){return{'model':db[_0x42c02f['model']],'as':_0x42c02f['as'],'attributes':_0x42c02f[_0x86f0('0x1e')],'include':_0x42c02f[_0x86f0('0x20')]?_['map'](_0x42c02f[_0x86f0('0x20')],function(_0x392696){return{'model':db[_0x392696[_0x86f0('0x21')]],'as':_0x392696['as'],'attributes':_0x392696[_0x86f0('0x1e')]};}):[]};}):[]};}):[]:[]})[_0x86f0('0x12')](function(_0x45129b){logger[_0x86f0('0x13')]('ShowFaxQueue',_0x3fc113);logger[_0x86f0('0x23')]('ShowFaxQueue',_0x3fc113,JSON[_0x86f0('0x17')](_0x45129b));_0x318dfa(_0x45129b);})[_0x86f0('0x24')](function(_0x2ada2f){logger[_0x86f0('0x18')](_0x86f0('0x27'),_0x2ada2f['message'],_0x3fc113);_0x373ec4(_0x27b416[_0x86f0('0x18')](0x1f4,_0x2ada2f[_0x86f0('0x19')]));});});}; \ No newline at end of file +var _0xac29=['localhost','./faxQueue.socket','request','then','info','FaxQueue,\x20%s,\x20%s','request\x20sent','debug','FaxQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','GetFaxQueue','FaxQueue','findAll','options','raw','where','attributes','limit','include','map','model','ShowFaxQueue','find','lodash','moment','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','redis','defaults'];(function(_0x211d4a,_0x9d4244){var _0x208576=function(_0x24a891){while(--_0x24a891){_0x211d4a['push'](_0x211d4a['shift']());}};_0x208576(++_0x9d4244);}(_0xac29,0xd9));var _0x9ac2=function(_0x271283,_0x1f3b91){_0x271283=_0x271283-0x0;var _0x4645eb=_0xac29[_0x271283];return _0x4645eb;};'use strict';var _=require(_0x9ac2('0x0'));var util=require('util');var moment=require(_0x9ac2('0x1'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x9ac2('0x2'))['db'];var utils=require(_0x9ac2('0x3'));var logger=require(_0x9ac2('0x4'))(_0x9ac2('0x5'));var config=require('../../config/environment');var jayson=require(_0x9ac2('0x6'));var client=jayson[_0x9ac2('0x7')][_0x9ac2('0x8')]({'port':0x232a});config[_0x9ac2('0x9')]=_[_0x9ac2('0xa')](config[_0x9ac2('0x9')],{'host':_0x9ac2('0xb'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0x9ac2('0xc'))['register'](socket);function respondWithRpcPromise(_0x4b8d5e,_0x3f6647,_0x12ff94){return new BPromise(function(_0x3621c8,_0x5d7104){return client[_0x9ac2('0xd')](_0x4b8d5e,_0x12ff94)[_0x9ac2('0xe')](function(_0x423fa8){logger[_0x9ac2('0xf')](_0x9ac2('0x10'),_0x3f6647,_0x9ac2('0x11'));logger[_0x9ac2('0x12')](_0x9ac2('0x13'),_0x3f6647,_0x9ac2('0x11'),JSON[_0x9ac2('0x14')](_0x423fa8));if(_0x423fa8[_0x9ac2('0x15')]){if(_0x423fa8[_0x9ac2('0x15')][_0x9ac2('0x16')]===0x1f4){logger[_0x9ac2('0x15')]('FaxQueue,\x20%s,\x20%s',_0x3f6647,_0x423fa8[_0x9ac2('0x15')]['message']);return _0x5d7104(_0x423fa8[_0x9ac2('0x15')]['message']);}logger['error'](_0x9ac2('0x10'),_0x3f6647,_0x423fa8[_0x9ac2('0x15')][_0x9ac2('0x17')]);return _0x3621c8(_0x423fa8[_0x9ac2('0x15')]['message']);}else{logger['info'](_0x9ac2('0x10'),_0x3f6647,'request\x20sent');_0x3621c8(_0x423fa8['result'][_0x9ac2('0x17')]);}})[_0x9ac2('0x18')](function(_0xbdc457){logger[_0x9ac2('0x15')](_0x9ac2('0x10'),_0x3f6647,_0xbdc457);_0x5d7104(_0xbdc457);});});}exports[_0x9ac2('0x19')]=function(_0x473d10){var _0x2493a1=this;return new Promise(function(_0xe3aa07,_0xdabd69){return db[_0x9ac2('0x1a')][_0x9ac2('0x1b')]({'raw':_0x473d10[_0x9ac2('0x1c')]?_0x473d10[_0x9ac2('0x1c')][_0x9ac2('0x1d')]===undefined?!![]:![]:!![],'where':_0x473d10[_0x9ac2('0x1c')]?_0x473d10['options'][_0x9ac2('0x1e')]||null:null,'attributes':_0x473d10[_0x9ac2('0x1c')]?_0x473d10['options'][_0x9ac2('0x1f')]||null:null,'limit':_0x473d10[_0x9ac2('0x1c')]?_0x473d10[_0x9ac2('0x1c')][_0x9ac2('0x20')]||null:null,'include':_0x473d10[_0x9ac2('0x1c')]?_0x473d10['options'][_0x9ac2('0x21')]?_[_0x9ac2('0x22')](_0x473d10[_0x9ac2('0x1c')][_0x9ac2('0x21')],function(_0x3f4c26){return{'model':db[_0x3f4c26[_0x9ac2('0x23')]],'as':_0x3f4c26['as'],'attributes':_0x3f4c26[_0x9ac2('0x1f')],'include':_0x3f4c26['include']?_[_0x9ac2('0x22')](_0x3f4c26[_0x9ac2('0x21')],function(_0x2ea19c){return{'model':db[_0x2ea19c['model']],'as':_0x2ea19c['as'],'attributes':_0x2ea19c['attributes'],'include':_0x2ea19c['include']?_['map'](_0x2ea19c[_0x9ac2('0x21')],function(_0x2fba5e){return{'model':db[_0x2fba5e['model']],'as':_0x2fba5e['as'],'attributes':_0x2fba5e[_0x9ac2('0x1f')]};}):[]};}):[]};}):[]:[]})[_0x9ac2('0xe')](function(_0x4f9e1c){logger['info']('GetFaxQueue',_0x473d10);logger[_0x9ac2('0x12')]('GetFaxQueue',_0x473d10,JSON[_0x9ac2('0x14')](_0x4f9e1c));_0xe3aa07(_0x4f9e1c);})['catch'](function(_0x3ce496){logger[_0x9ac2('0x15')](_0x9ac2('0x19'),_0x3ce496['message'],_0x473d10);_0xdabd69(_0x2493a1[_0x9ac2('0x15')](0x1f4,_0x3ce496[_0x9ac2('0x17')]));});});};exports[_0x9ac2('0x24')]=function(_0x46d431){var _0x45bf0a=this;return new Promise(function(_0x5c4361,_0xd5db05){return db[_0x9ac2('0x1a')][_0x9ac2('0x25')]({'raw':_0x46d431[_0x9ac2('0x1c')]?_0x46d431[_0x9ac2('0x1c')][_0x9ac2('0x1d')]===undefined?!![]:![]:!![],'where':_0x46d431['options']?_0x46d431['options'][_0x9ac2('0x1e')]||null:null,'attributes':_0x46d431[_0x9ac2('0x1c')]?_0x46d431[_0x9ac2('0x1c')][_0x9ac2('0x1f')]||null:null,'include':_0x46d431[_0x9ac2('0x1c')]?_0x46d431[_0x9ac2('0x1c')]['include']?_['map'](_0x46d431[_0x9ac2('0x1c')][_0x9ac2('0x21')],function(_0x1f946c){return{'model':db[_0x1f946c[_0x9ac2('0x23')]],'as':_0x1f946c['as'],'attributes':_0x1f946c[_0x9ac2('0x1f')],'include':_0x1f946c[_0x9ac2('0x21')]?_['map'](_0x1f946c[_0x9ac2('0x21')],function(_0x3ae8c3){return{'model':db[_0x3ae8c3[_0x9ac2('0x23')]],'as':_0x3ae8c3['as'],'attributes':_0x3ae8c3['attributes'],'include':_0x3ae8c3[_0x9ac2('0x21')]?_[_0x9ac2('0x22')](_0x3ae8c3[_0x9ac2('0x21')],function(_0x52e2cf){return{'model':db[_0x52e2cf['model']],'as':_0x52e2cf['as'],'attributes':_0x52e2cf[_0x9ac2('0x1f')]};}):[]};}):[]};}):[]:[]})[_0x9ac2('0xe')](function(_0x573e19){logger['info'](_0x9ac2('0x24'),_0x46d431);logger[_0x9ac2('0x12')](_0x9ac2('0x24'),_0x46d431,JSON['stringify'](_0x573e19));_0x5c4361(_0x573e19);})[_0x9ac2('0x18')](function(_0xa3eadc){logger[_0x9ac2('0x15')](_0x9ac2('0x24'),_0xa3eadc['message'],_0x46d431);_0xd5db05(_0x45bf0a['error'](0x1f4,_0xa3eadc[_0x9ac2('0x17')]));});});}; \ No newline at end of file diff --git a/server/api/faxQueue/faxQueue.socket.js b/server/api/faxQueue/faxQueue.socket.js index e33638e..94e3854 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 _0x635e=['removeListener','length','faxQueue:','./faxQueue.events','save','remove','update'];(function(_0x1aade0,_0x3064a6){var _0x2d3f9d=function(_0x49db60){while(--_0x49db60){_0x1aade0['push'](_0x1aade0['shift']());}};_0x2d3f9d(++_0x3064a6);}(_0x635e,0xff));var _0xe635=function(_0x313c2c,_0x1fca6d){_0x313c2c=_0x313c2c-0x0;var _0x2ea01c=_0x635e[_0x313c2c];return _0x2ea01c;};'use strict';var FaxQueueEvents=require(_0xe635('0x0'));var events=[_0xe635('0x1'),_0xe635('0x2'),_0xe635('0x3')];function createListener(_0x4e5cb0,_0x406b8b){return function(_0x502a70){_0x406b8b['emit'](_0x4e5cb0,_0x502a70);};}function removeListener(_0x3c503d,_0x5e2c56){return function(){FaxQueueEvents[_0xe635('0x4')](_0x3c503d,_0x5e2c56);};}exports['register']=function(_0x57038b){for(var _0x28be25=0x0,_0x6ba0f9=events[_0xe635('0x5')];_0x28be25<_0x6ba0f9;_0x28be25++){var _0x567cbf=events[_0x28be25];var _0x30734f=createListener(_0xe635('0x6')+_0x567cbf,_0x57038b);FaxQueueEvents['on'](_0x567cbf,_0x30734f);}}; \ No newline at end of file +var _0x411d=['length','faxQueue:','./faxQueue.events','save','remove','update','emit','removeListener'];(function(_0x39cf70,_0x3ec55b){var _0x580424=function(_0x580a4e){while(--_0x580a4e){_0x39cf70['push'](_0x39cf70['shift']());}};_0x580424(++_0x3ec55b);}(_0x411d,0xe2));var _0xd411=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x411d[_0x20a584];return _0x4b41a8;};'use strict';var FaxQueueEvents=require(_0xd411('0x0'));var events=[_0xd411('0x1'),_0xd411('0x2'),_0xd411('0x3')];function createListener(_0x44d8aa,_0x56c19e){return function(_0x1fc0ee){_0x56c19e[_0xd411('0x4')](_0x44d8aa,_0x1fc0ee);};}function removeListener(_0x983214,_0x148439){return function(){FaxQueueEvents[_0xd411('0x5')](_0x983214,_0x148439);};}exports['register']=function(_0x1fe828){for(var _0x172d68=0x0,_0x5557bd=events[_0xd411('0x6')];_0x172d68<_0x5557bd;_0x172d68++){var _0x4c94ff=events[_0x172d68];var _0x28269e=createListener(_0xd411('0x7')+_0x4c94ff,_0x1fe828);FaxQueueEvents['on'](_0x4c94ff,_0x28269e);}}; \ No newline at end of file diff --git a/server/api/faxQueue/index.js b/server/api/faxQueue/index.js index 287a59f..5f85639 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(_0x280ae7,_0x456fb1){var _0x418b9e=function(_0x4d730d){while(--_0x4d730d){_0x280ae7['push'](_0x280ae7['shift']());}};_0x418b9e(++_0x456fb1);}(_0x0b0e,0x187));var _0xe0b0=function(_0x39479f,_0x822ae4){_0x39479f=_0x39479f-0x0;var _0x4a6d96=_0x0b0e[_0x39479f];return _0x4a6d96;};'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 _0xb10b=['addTeams','addAgents','put','update','delete','destroy','removeTeams','removeAgents','multer','path','connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment','./faxQueue.controller','get','isAuthenticated','/describe','describe','/:id','show','/:id/members','/:id/teams','getTeams','/:id/users','getAgents','post','create'];(function(_0x4fc9e6,_0xc51915){var _0x551d28=function(_0x1a603b){while(--_0x1a603b){_0x4fc9e6['push'](_0x4fc9e6['shift']());}};_0x551d28(++_0xc51915);}(_0xb10b,0x12a));var _0xbb10=function(_0xd3da2a,_0x22241c){_0xd3da2a=_0xd3da2a-0x0;var _0x10ab61=_0xb10b[_0xd3da2a];return _0x10ab61;};'use strict';var multer=require(_0xbb10('0x0'));var util=require('util');var path=require(_0xbb10('0x1'));var timeout=require(_0xbb10('0x2'));var express=require(_0xbb10('0x3'));var router=express['Router']();var auth=require(_0xbb10('0x4'));var interaction=require(_0xbb10('0x5'));var config=require(_0xbb10('0x6'));var controller=require(_0xbb10('0x7'));router[_0xbb10('0x8')]('/',auth[_0xbb10('0x9')](),controller['index']);router[_0xbb10('0x8')](_0xbb10('0xa'),auth['isAuthenticated'](),controller[_0xbb10('0xb')]);router[_0xbb10('0x8')](_0xbb10('0xc'),auth[_0xbb10('0x9')](),controller[_0xbb10('0xd')]);router[_0xbb10('0x8')](_0xbb10('0xe'),auth[_0xbb10('0x9')](),controller['getMembers']);router['get'](_0xbb10('0xf'),auth[_0xbb10('0x9')](),controller[_0xbb10('0x10')]);router['get'](_0xbb10('0x11'),auth['isAuthenticated'](),controller[_0xbb10('0x12')]);router[_0xbb10('0x13')]('/',auth[_0xbb10('0x9')](),controller[_0xbb10('0x14')]);router[_0xbb10('0x13')](_0xbb10('0xf'),auth['isAuthenticated'](),controller[_0xbb10('0x15')]);router[_0xbb10('0x13')](_0xbb10('0x11'),auth[_0xbb10('0x9')](),controller[_0xbb10('0x16')]);router[_0xbb10('0x17')](_0xbb10('0xc'),auth[_0xbb10('0x9')](),controller[_0xbb10('0x18')]);router[_0xbb10('0x19')]('/:id',auth[_0xbb10('0x9')](),controller[_0xbb10('0x1a')]);router[_0xbb10('0x19')](_0xbb10('0xf'),auth[_0xbb10('0x9')](),controller[_0xbb10('0x1b')]);router[_0xbb10('0x19')](_0xbb10('0x11'),auth[_0xbb10('0x9')](),controller[_0xbb10('0x1c')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/faxQueueReport/faxQueueReport.attributes.js b/server/api/faxQueueReport/faxQueueReport.attributes.js index 2e6786c..2dfadb9 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 _0x971c=['STRING','DATE','sequelize','exports'];(function(_0x25c9ce,_0x10152a){var _0xcc7ac0=function(_0x363263){while(--_0x363263){_0x25c9ce['push'](_0x25c9ce['shift']());}};_0xcc7ac0(++_0x10152a);}(_0x971c,0x122));var _0xc971=function(_0x56482c,_0x16118d){_0x56482c=_0x56482c-0x0;var _0x5aae7a=_0x971c[_0x56482c];return _0x5aae7a;};'use strict';var moment=require('moment');var Sequelize=require(_0xc971('0x0'));module[_0xc971('0x1')]={'uniqueid':{'type':Sequelize[_0xc971('0x2')],'allowNull':![]},'from':{'type':Sequelize['STRING']},'joinAt':{'type':Sequelize[_0xc971('0x3')]},'leaveAt':{'type':Sequelize[_0xc971('0x3')]},'acceptAt':{'type':Sequelize[_0xc971('0x3')]},'exitAt':{'type':Sequelize[_0xc971('0x3')]},'reason':{'type':Sequelize[_0xc971('0x2')]}}; \ No newline at end of file +var _0x34b4=['moment','sequelize','DATE'];(function(_0x52753e,_0x1718bc){var _0x5b2cd5=function(_0x3e1c7c){while(--_0x3e1c7c){_0x52753e['push'](_0x52753e['shift']());}};_0x5b2cd5(++_0x1718bc);}(_0x34b4,0x12c));var _0x434b=function(_0x3d1948,_0x292b8e){_0x3d1948=_0x3d1948-0x0;var _0x56ffb4=_0x34b4[_0x3d1948];return _0x56ffb4;};'use strict';var moment=require(_0x434b('0x0'));var Sequelize=require(_0x434b('0x1'));module['exports']={'uniqueid':{'type':Sequelize['STRING'],'allowNull':![]},'from':{'type':Sequelize['STRING']},'joinAt':{'type':Sequelize[_0x434b('0x2')]},'leaveAt':{'type':Sequelize[_0x434b('0x2')]},'acceptAt':{'type':Sequelize[_0x434b('0x2')]},'exitAt':{'type':Sequelize[_0x434b('0x2')]},'reason':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/faxQueueReport/faxQueueReport.controller.js b/server/api/faxQueueReport/faxQueueReport.controller.js index 6c0296b..c075a3f 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 _0xb127=['../../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','save','update','then','error','stack','index','map','FaxQueueReport','rawAttributes','fieldName','type','model','name','keys','intersection','query','attributes','fields','hasOwnProperty','nolimit','order','sort','where','filters','filter','merge','options','include','findAll','rows','params','length','find','catch','create','body','destroy','describe','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','to-csv','lodash','squel','crypto','desk.js','querystring','papaparse','ioredis'];(function(_0x4d1fbf,_0x3cf245){var _0x1cd725=function(_0x3a4ea6){while(--_0x3a4ea6){_0x4d1fbf['push'](_0x4d1fbf['shift']());}};_0x1cd725(++_0x3cf245);}(_0xb127,0xc7));var _0x7b12=function(_0x4c8880,_0x111050){_0x4c8880=_0x4c8880-0x0;var _0xdf3ba5=_0xb127[_0x4c8880];return _0xdf3ba5;};'use strict';var pdf=require('html-pdf');var emlformat=require('eml-format');var rimraf=require(_0x7b12('0x0'));var zipdir=require(_0x7b12('0x1'));var jsonpatch=require(_0x7b12('0x2'));var rp=require(_0x7b12('0x3'));var moment=require('moment');var BPromise=require(_0x7b12('0x4'));var Mustache=require(_0x7b12('0x5'));var util=require(_0x7b12('0x6'));var path=require(_0x7b12('0x7'));var sox=require(_0x7b12('0x8'));var csv=require(_0x7b12('0x9'));var ejs=require('ejs');var fs=require('fs');var _=require(_0x7b12('0xa'));var squel=require(_0x7b12('0xb'));var crypto=require(_0x7b12('0xc'));var jsforce=require('jsforce');var deskjs=require(_0x7b12('0xd'));var toCsv=require(_0x7b12('0x9'));var querystring=require(_0x7b12('0xe'));var Papa=require(_0x7b12('0xf'));var Redis=require(_0x7b12('0x10'));var authService=require(_0x7b12('0x11'));var qs=require(_0x7b12('0x12'));var as=require(_0x7b12('0x13'));var hardwareService=require(_0x7b12('0x14'));var logger=require(_0x7b12('0x15'))(_0x7b12('0x16'));var utils=require(_0x7b12('0x17'));var config=require(_0x7b12('0x18'));var db=require(_0x7b12('0x19'))['db'];function respondWithStatusCode(_0x4aaf0b,_0x19e31b){_0x19e31b=_0x19e31b||0xcc;return function(_0x515ca4){if(_0x515ca4){return _0x4aaf0b[_0x7b12('0x1a')](_0x19e31b);}return _0x4aaf0b[_0x7b12('0x1b')](_0x19e31b)[_0x7b12('0x1c')]();};}function respondWithResult(_0xd428bb,_0x423634){_0x423634=_0x423634||0xc8;return function(_0x2906b3){if(_0x2906b3){return _0xd428bb[_0x7b12('0x1b')](_0x423634)['json'](_0x2906b3);}};}function respondWithFilteredResult(_0x50a83b,_0x1d81ed){return function(_0x46da70){if(_0x46da70){var _0x531745=_0x46da70[_0x7b12('0x1d')],_0x132dfe=_0x1d81ed[_0x7b12('0x1e')],_0x583a77=_0x1d81ed[_0x7b12('0x1e')]+_0x1d81ed[_0x7b12('0x1f')],_0x50ca0d;if(_0x583a77>=_0x531745){_0x583a77=_0x531745;_0x50ca0d=0xc8;}else{_0x50ca0d=0xce;}_0x50a83b[_0x7b12('0x1b')](_0x50ca0d);return _0x50a83b[_0x7b12('0x20')](_0x7b12('0x21'),_0x132dfe+'-'+_0x583a77+'/'+_0x531745)['json'](_0x46da70);}return null;};}function patchUpdates(_0x1c0313){return function(_0x85b97d){try{jsonpatch['apply'](_0x85b97d,_0x1c0313,!![]);}catch(_0x251a55){return BPromise['reject'](_0x251a55);}return _0x85b97d[_0x7b12('0x22')]();};}function saveUpdates(_0x3e98b2,_0x104277){return function(_0x26b8eb){if(_0x26b8eb){return _0x26b8eb[_0x7b12('0x23')](_0x3e98b2)[_0x7b12('0x24')](function(_0x5d1f75){return _0x5d1f75;});}return null;};}function removeEntity(_0x590a4f,_0x5b7e99){return function(_0xbeee6c){if(_0xbeee6c){return _0xbeee6c['destroy']()[_0x7b12('0x24')](function(){_0x590a4f[_0x7b12('0x1b')](0xcc)[_0x7b12('0x1c')]();});}};}function handleEntityNotFound(_0x38e54f,_0x472e7e){return function(_0x1e941e){if(!_0x1e941e){_0x38e54f[_0x7b12('0x1a')](0x194);}return _0x1e941e;};}function handleError(_0x2f714a,_0x5d7d7f){_0x5d7d7f=_0x5d7d7f||0x1f4;return function(_0x465b1a){logger[_0x7b12('0x25')](_0x465b1a[_0x7b12('0x26')]);if(_0x465b1a['name']){delete _0x465b1a['name'];}_0x2f714a[_0x7b12('0x1b')](_0x5d7d7f)['send'](_0x465b1a);};}exports[_0x7b12('0x27')]=function(_0x2afc02,_0x1a9fe3){var _0x3359ef={},_0x27d000={},_0x56d8dd={'count':0x0,'rows':[]};var _0x2bbe0c=_[_0x7b12('0x28')](db[_0x7b12('0x29')][_0x7b12('0x2a')],function(_0x4d945e){return{'name':_0x4d945e[_0x7b12('0x2b')],'type':_0x4d945e[_0x7b12('0x2c')]['key']};});_0x27d000[_0x7b12('0x2d')]=_[_0x7b12('0x28')](_0x2bbe0c,_0x7b12('0x2e'));_0x27d000['query']=_[_0x7b12('0x2f')](_0x2afc02['query']);_0x27d000['filters']=_[_0x7b12('0x30')](_0x27d000[_0x7b12('0x2d')],_0x27d000[_0x7b12('0x31')]);_0x3359ef[_0x7b12('0x32')]=_[_0x7b12('0x30')](_0x27d000['model'],qs['fields'](_0x2afc02[_0x7b12('0x31')][_0x7b12('0x33')]));_0x3359ef[_0x7b12('0x32')]=_0x3359ef[_0x7b12('0x32')]['length']?_0x3359ef[_0x7b12('0x32')]:_0x27d000[_0x7b12('0x2d')];if(!_0x2afc02['query'][_0x7b12('0x34')](_0x7b12('0x35'))){_0x3359ef[_0x7b12('0x1f')]=qs[_0x7b12('0x1f')](_0x2afc02[_0x7b12('0x31')]['limit']);_0x3359ef[_0x7b12('0x1e')]=qs[_0x7b12('0x1e')](_0x2afc02[_0x7b12('0x31')][_0x7b12('0x1e')]);}_0x3359ef[_0x7b12('0x36')]=qs[_0x7b12('0x37')](_0x2afc02[_0x7b12('0x31')][_0x7b12('0x37')]);_0x3359ef[_0x7b12('0x38')]=qs[_0x7b12('0x39')](_['pick'](_0x2afc02[_0x7b12('0x31')],_0x27d000['filters']));if(_0x2afc02[_0x7b12('0x31')][_0x7b12('0x3a')]){_0x3359ef[_0x7b12('0x38')]=_['merge'](_0x3359ef[_0x7b12('0x38')],{'$or':_['map'](_0x2bbe0c,function(_0x16cd3a){if(_0x16cd3a[_0x7b12('0x2c')]!=='VIRTUAL'){var _0x244b94={};_0x244b94[_0x16cd3a['name']]={'$like':'%'+_0x2afc02['query']['filter']+'%'};return _0x244b94;}})});}_0x3359ef=_[_0x7b12('0x3b')]({},_0x3359ef,_0x2afc02[_0x7b12('0x3c')]);var _0x5a5e96={'where':_0x3359ef[_0x7b12('0x38')]};return db['FaxQueueReport'][_0x7b12('0x1d')](_0x5a5e96)[_0x7b12('0x24')](function(_0x5863f9){_0x56d8dd[_0x7b12('0x1d')]=_0x5863f9;if(_0x2afc02['query']['includeAll']){_0x3359ef[_0x7b12('0x3d')]=[{'all':!![]}];}return db[_0x7b12('0x29')][_0x7b12('0x3e')](_0x3359ef);})[_0x7b12('0x24')](function(_0xe4cb5d){_0x56d8dd[_0x7b12('0x3f')]=_0xe4cb5d;return _0x56d8dd;})['then'](respondWithFilteredResult(_0x1a9fe3,_0x3359ef))['catch'](handleError(_0x1a9fe3,null));};exports['show']=function(_0x2de216,_0x118f96){var _0x348c30={'raw':!![],'where':{'id':_0x2de216[_0x7b12('0x40')]['id']}},_0x1954e4={};_0x1954e4[_0x7b12('0x2d')]=_['keys'](db[_0x7b12('0x29')]['rawAttributes']);_0x1954e4[_0x7b12('0x31')]=_[_0x7b12('0x2f')](_0x2de216[_0x7b12('0x31')]);_0x1954e4['filters']=_[_0x7b12('0x30')](_0x1954e4[_0x7b12('0x2d')],_0x1954e4[_0x7b12('0x31')]);_0x348c30[_0x7b12('0x32')]=_[_0x7b12('0x30')](_0x1954e4[_0x7b12('0x2d')],qs[_0x7b12('0x33')](_0x2de216[_0x7b12('0x31')][_0x7b12('0x33')]));_0x348c30['attributes']=_0x348c30[_0x7b12('0x32')][_0x7b12('0x41')]?_0x348c30[_0x7b12('0x32')]:_0x1954e4[_0x7b12('0x2d')];if(_0x2de216[_0x7b12('0x31')]['includeAll']){_0x348c30[_0x7b12('0x3d')]=[{'all':!![]}];}_0x348c30=_[_0x7b12('0x3b')]({},_0x348c30,_0x2de216['options']);return db[_0x7b12('0x29')][_0x7b12('0x42')](_0x348c30)[_0x7b12('0x24')](handleEntityNotFound(_0x118f96,null))[_0x7b12('0x24')](respondWithResult(_0x118f96,null))[_0x7b12('0x43')](handleError(_0x118f96,null));};exports[_0x7b12('0x44')]=function(_0x3786da,_0xc7cc00){return db[_0x7b12('0x29')][_0x7b12('0x44')](_0x3786da[_0x7b12('0x45')],{})[_0x7b12('0x24')](respondWithResult(_0xc7cc00,0xc9))[_0x7b12('0x43')](handleError(_0xc7cc00,null));};exports[_0x7b12('0x23')]=function(_0x1b5a84,_0x5e0f8d){if(_0x1b5a84[_0x7b12('0x45')]['id']){delete _0x1b5a84[_0x7b12('0x45')]['id'];}return db['FaxQueueReport']['find']({'where':{'id':_0x1b5a84['params']['id']}})[_0x7b12('0x24')](handleEntityNotFound(_0x5e0f8d,null))['then'](saveUpdates(_0x1b5a84[_0x7b12('0x45')],null))[_0x7b12('0x24')](respondWithResult(_0x5e0f8d,null))[_0x7b12('0x43')](handleError(_0x5e0f8d,null));};exports[_0x7b12('0x46')]=function(_0x468ca5,_0x15a9c4){return db[_0x7b12('0x29')][_0x7b12('0x42')]({'where':{'id':_0x468ca5[_0x7b12('0x40')]['id']}})[_0x7b12('0x24')](handleEntityNotFound(_0x15a9c4,null))[_0x7b12('0x24')](removeEntity(_0x15a9c4,null))[_0x7b12('0x43')](handleError(_0x15a9c4,null));};exports[_0x7b12('0x47')]=function(_0x20e70c,_0x17dc98){return db[_0x7b12('0x29')][_0x7b12('0x47')]()[_0x7b12('0x24')](respondWithResult(_0x17dc98,null))['catch'](handleError(_0x17dc98,null));}; \ No newline at end of file +var _0x3a93=['destroy','error','stack','name','send','index','map','rawAttributes','fieldName','type','keys','model','query','attributes','intersection','fields','length','nolimit','limit','order','sort','where','filters','pick','merge','VIRTUAL','filter','options','count','includeAll','FaxQueueReport','rows','catch','show','params','include','find','create','body','describe','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','sox','to-csv','ejs','lodash','squel','crypto','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../mysqldb','sendStatus','status','end','json','offset','set','apply','reject','save','update','then'];(function(_0x452cde,_0x4ffd00){var _0x4102bd=function(_0x19ac65){while(--_0x19ac65){_0x452cde['push'](_0x452cde['shift']());}};_0x4102bd(++_0x4ffd00);}(_0x3a93,0x72));var _0x33a9=function(_0x33852c,_0x4718b4){_0x33852c=_0x33852c-0x0;var _0x192904=_0x3a93[_0x33852c];return _0x192904;};'use strict';var pdf=require(_0x33a9('0x0'));var emlformat=require(_0x33a9('0x1'));var rimraf=require(_0x33a9('0x2'));var zipdir=require(_0x33a9('0x3'));var jsonpatch=require(_0x33a9('0x4'));var rp=require(_0x33a9('0x5'));var moment=require(_0x33a9('0x6'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require('util');var path=require('path');var sox=require(_0x33a9('0x7'));var csv=require(_0x33a9('0x8'));var ejs=require(_0x33a9('0x9'));var fs=require('fs');var _=require(_0x33a9('0xa'));var squel=require(_0x33a9('0xb'));var crypto=require(_0x33a9('0xc'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x33a9('0x8'));var querystring=require(_0x33a9('0xd'));var Papa=require(_0x33a9('0xe'));var Redis=require(_0x33a9('0xf'));var authService=require(_0x33a9('0x10'));var qs=require('../../components/parsers/qs');var as=require(_0x33a9('0x11'));var hardwareService=require(_0x33a9('0x12'));var logger=require(_0x33a9('0x13'))(_0x33a9('0x14'));var utils=require('../../config/utils');var config=require(_0x33a9('0x15'));var db=require(_0x33a9('0x16'))['db'];function respondWithStatusCode(_0xc95120,_0x136259){_0x136259=_0x136259||0xcc;return function(_0x3bee1f){if(_0x3bee1f){return _0xc95120[_0x33a9('0x17')](_0x136259);}return _0xc95120[_0x33a9('0x18')](_0x136259)[_0x33a9('0x19')]();};}function respondWithResult(_0x359fe2,_0x455eb7){_0x455eb7=_0x455eb7||0xc8;return function(_0x55fa40){if(_0x55fa40){return _0x359fe2[_0x33a9('0x18')](_0x455eb7)[_0x33a9('0x1a')](_0x55fa40);}};}function respondWithFilteredResult(_0x2e32ed,_0x2e3045){return function(_0x449974){if(_0x449974){var _0x2f636d=_0x449974['count'],_0x34fbff=_0x2e3045[_0x33a9('0x1b')],_0x4f5d6f=_0x2e3045[_0x33a9('0x1b')]+_0x2e3045['limit'],_0x580ce1;if(_0x4f5d6f>=_0x2f636d){_0x4f5d6f=_0x2f636d;_0x580ce1=0xc8;}else{_0x580ce1=0xce;}_0x2e32ed[_0x33a9('0x18')](_0x580ce1);return _0x2e32ed[_0x33a9('0x1c')]('Content-Range',_0x34fbff+'-'+_0x4f5d6f+'/'+_0x2f636d)[_0x33a9('0x1a')](_0x449974);}return null;};}function patchUpdates(_0x101093){return function(_0x5652dd){try{jsonpatch[_0x33a9('0x1d')](_0x5652dd,_0x101093,!![]);}catch(_0x27ece8){return BPromise[_0x33a9('0x1e')](_0x27ece8);}return _0x5652dd[_0x33a9('0x1f')]();};}function saveUpdates(_0x741304,_0x2b3267){return function(_0x498b83){if(_0x498b83){return _0x498b83[_0x33a9('0x20')](_0x741304)[_0x33a9('0x21')](function(_0xc6f95d){return _0xc6f95d;});}return null;};}function removeEntity(_0x3c5138,_0x2bb0cb){return function(_0x286965){if(_0x286965){return _0x286965[_0x33a9('0x22')]()[_0x33a9('0x21')](function(){_0x3c5138[_0x33a9('0x18')](0xcc)[_0x33a9('0x19')]();});}};}function handleEntityNotFound(_0x216f9f,_0x4f8075){return function(_0xce5cc4){if(!_0xce5cc4){_0x216f9f['sendStatus'](0x194);}return _0xce5cc4;};}function handleError(_0x18394b,_0x320a55){_0x320a55=_0x320a55||0x1f4;return function(_0x3ba32f){logger[_0x33a9('0x23')](_0x3ba32f[_0x33a9('0x24')]);if(_0x3ba32f[_0x33a9('0x25')]){delete _0x3ba32f[_0x33a9('0x25')];}_0x18394b[_0x33a9('0x18')](_0x320a55)[_0x33a9('0x26')](_0x3ba32f);};}exports[_0x33a9('0x27')]=function(_0x39ceb7,_0x52f6b4){var _0x2582cb={},_0x2d55f8={},_0x6622de={'count':0x0,'rows':[]};var _0x290781=_[_0x33a9('0x28')](db['FaxQueueReport'][_0x33a9('0x29')],function(_0x479b10){return{'name':_0x479b10[_0x33a9('0x2a')],'type':_0x479b10[_0x33a9('0x2b')]['key']};});_0x2d55f8['model']=_[_0x33a9('0x28')](_0x290781,_0x33a9('0x25'));_0x2d55f8['query']=_[_0x33a9('0x2c')](_0x39ceb7['query']);_0x2d55f8['filters']=_['intersection'](_0x2d55f8[_0x33a9('0x2d')],_0x2d55f8[_0x33a9('0x2e')]);_0x2582cb[_0x33a9('0x2f')]=_[_0x33a9('0x30')](_0x2d55f8[_0x33a9('0x2d')],qs[_0x33a9('0x31')](_0x39ceb7[_0x33a9('0x2e')][_0x33a9('0x31')]));_0x2582cb[_0x33a9('0x2f')]=_0x2582cb[_0x33a9('0x2f')][_0x33a9('0x32')]?_0x2582cb[_0x33a9('0x2f')]:_0x2d55f8[_0x33a9('0x2d')];if(!_0x39ceb7['query']['hasOwnProperty'](_0x33a9('0x33'))){_0x2582cb[_0x33a9('0x34')]=qs[_0x33a9('0x34')](_0x39ceb7['query']['limit']);_0x2582cb[_0x33a9('0x1b')]=qs['offset'](_0x39ceb7[_0x33a9('0x2e')][_0x33a9('0x1b')]);}_0x2582cb[_0x33a9('0x35')]=qs[_0x33a9('0x36')](_0x39ceb7[_0x33a9('0x2e')][_0x33a9('0x36')]);_0x2582cb[_0x33a9('0x37')]=qs[_0x33a9('0x38')](_[_0x33a9('0x39')](_0x39ceb7[_0x33a9('0x2e')],_0x2d55f8['filters']));if(_0x39ceb7[_0x33a9('0x2e')]['filter']){_0x2582cb[_0x33a9('0x37')]=_[_0x33a9('0x3a')](_0x2582cb[_0x33a9('0x37')],{'$or':_['map'](_0x290781,function(_0x333b72){if(_0x333b72[_0x33a9('0x2b')]!==_0x33a9('0x3b')){var _0x1124f0={};_0x1124f0[_0x333b72['name']]={'$like':'%'+_0x39ceb7[_0x33a9('0x2e')][_0x33a9('0x3c')]+'%'};return _0x1124f0;}})});}_0x2582cb=_[_0x33a9('0x3a')]({},_0x2582cb,_0x39ceb7[_0x33a9('0x3d')]);var _0x3ef77d={'where':_0x2582cb['where']};return db['FaxQueueReport'][_0x33a9('0x3e')](_0x3ef77d)[_0x33a9('0x21')](function(_0x300469){_0x6622de['count']=_0x300469;if(_0x39ceb7[_0x33a9('0x2e')][_0x33a9('0x3f')]){_0x2582cb['include']=[{'all':!![]}];}return db[_0x33a9('0x40')]['findAll'](_0x2582cb);})[_0x33a9('0x21')](function(_0x51542b){_0x6622de[_0x33a9('0x41')]=_0x51542b;return _0x6622de;})[_0x33a9('0x21')](respondWithFilteredResult(_0x52f6b4,_0x2582cb))[_0x33a9('0x42')](handleError(_0x52f6b4,null));};exports[_0x33a9('0x43')]=function(_0x54fa28,_0x55c687){var _0x11f524={'raw':!![],'where':{'id':_0x54fa28[_0x33a9('0x44')]['id']}},_0x5ba986={};_0x5ba986[_0x33a9('0x2d')]=_[_0x33a9('0x2c')](db[_0x33a9('0x40')][_0x33a9('0x29')]);_0x5ba986[_0x33a9('0x2e')]=_['keys'](_0x54fa28[_0x33a9('0x2e')]);_0x5ba986[_0x33a9('0x38')]=_[_0x33a9('0x30')](_0x5ba986[_0x33a9('0x2d')],_0x5ba986[_0x33a9('0x2e')]);_0x11f524['attributes']=_[_0x33a9('0x30')](_0x5ba986[_0x33a9('0x2d')],qs['fields'](_0x54fa28[_0x33a9('0x2e')][_0x33a9('0x31')]));_0x11f524[_0x33a9('0x2f')]=_0x11f524[_0x33a9('0x2f')][_0x33a9('0x32')]?_0x11f524['attributes']:_0x5ba986['model'];if(_0x54fa28[_0x33a9('0x2e')]['includeAll']){_0x11f524[_0x33a9('0x45')]=[{'all':!![]}];}_0x11f524=_[_0x33a9('0x3a')]({},_0x11f524,_0x54fa28['options']);return db[_0x33a9('0x40')][_0x33a9('0x46')](_0x11f524)[_0x33a9('0x21')](handleEntityNotFound(_0x55c687,null))[_0x33a9('0x21')](respondWithResult(_0x55c687,null))[_0x33a9('0x42')](handleError(_0x55c687,null));};exports[_0x33a9('0x47')]=function(_0x4878fc,_0x526a90){return db['FaxQueueReport'][_0x33a9('0x47')](_0x4878fc[_0x33a9('0x48')],{})['then'](respondWithResult(_0x526a90,0xc9))['catch'](handleError(_0x526a90,null));};exports[_0x33a9('0x20')]=function(_0x2715a9,_0x4a6d30){if(_0x2715a9[_0x33a9('0x48')]['id']){delete _0x2715a9['body']['id'];}return db[_0x33a9('0x40')][_0x33a9('0x46')]({'where':{'id':_0x2715a9[_0x33a9('0x44')]['id']}})['then'](handleEntityNotFound(_0x4a6d30,null))[_0x33a9('0x21')](saveUpdates(_0x2715a9[_0x33a9('0x48')],null))[_0x33a9('0x21')](respondWithResult(_0x4a6d30,null))[_0x33a9('0x42')](handleError(_0x4a6d30,null));};exports['destroy']=function(_0x456438,_0xdf209b){return db['FaxQueueReport'][_0x33a9('0x46')]({'where':{'id':_0x456438[_0x33a9('0x44')]['id']}})[_0x33a9('0x21')](handleEntityNotFound(_0xdf209b,null))[_0x33a9('0x21')](removeEntity(_0xdf209b,null))[_0x33a9('0x42')](handleError(_0xdf209b,null));};exports[_0x33a9('0x49')]=function(_0x1d2fcb,_0x179161){return db[_0x33a9('0x40')]['describe']()['then'](respondWithResult(_0x179161,null))[_0x33a9('0x42')](handleError(_0x179161,null));}; \ No newline at end of file diff --git a/server/api/faxQueueReport/faxQueueReport.model.js b/server/api/faxQueueReport/faxQueueReport.model.js index cde9569..b9b9464 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 _0x0da1=['../../config/environment','./faxQueueReport.attributes','exports','define','FaxQueueReport','uniqueid','api','path'];(function(_0x578e04,_0x43c433){var _0x54f2b5=function(_0x2930f9){while(--_0x2930f9){_0x578e04['push'](_0x578e04['shift']());}};_0x54f2b5(++_0x43c433);}(_0x0da1,0x18e));var _0x10da=function(_0x1fc122,_0x5e2c17){_0x1fc122=_0x1fc122-0x0;var _0xa2cb13=_0x0da1[_0x1fc122];return _0xa2cb13;};'use strict';var _=require('lodash');var util=require('util');var logger=require('../../config/logger')(_0x10da('0x0'));var moment=require('moment');var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x10da('0x1'));var rimraf=require('rimraf');var config=require(_0x10da('0x2'));var attributes=require(_0x10da('0x3'));module[_0x10da('0x4')]=function(_0x590975,_0x22f1b0){return _0x590975[_0x10da('0x5')](_0x10da('0x6'),attributes,{'tableName':'report_fax_queue','paranoid':![],'indexes':[{'name':'uniqueid','fields':[_0x10da('0x7')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x7997=['lodash','../../config/logger','bluebird','request-promise','rimraf','./faxQueueReport.attributes','define','FaxQueueReport','report_fax_queue','uniqueid'];(function(_0x331bbe,_0xde8cea){var _0x54f889=function(_0x8d2b03){while(--_0x8d2b03){_0x331bbe['push'](_0x331bbe['shift']());}};_0x54f889(++_0xde8cea);}(_0x7997,0x140));var _0x7799=function(_0x4a41f5,_0x346fc2){_0x4a41f5=_0x4a41f5-0x0;var _0x5c29fb=_0x7997[_0x4a41f5];return _0x5c29fb;};'use strict';var _=require(_0x7799('0x0'));var util=require('util');var logger=require(_0x7799('0x1'))('api');var moment=require('moment');var BPromise=require(_0x7799('0x2'));var rp=require(_0x7799('0x3'));var fs=require('fs');var path=require('path');var rimraf=require(_0x7799('0x4'));var config=require('../../config/environment');var attributes=require(_0x7799('0x5'));module['exports']=function(_0x355e89,_0x562a2e){return _0x355e89[_0x7799('0x6')](_0x7799('0x7'),attributes,{'tableName':_0x7799('0x8'),'paranoid':![],'indexes':[{'name':_0x7799('0x9'),'fields':[_0x7799('0x9')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/faxQueueReport/faxQueueReport.rpc.js b/server/api/faxQueueReport/faxQueueReport.rpc.js index c5bd056..83832f7 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 _0x6ad7=['util','moment','randomstring','ioredis','../../mysqldb','rpc','../../config/environment','jayson/promise','client','then','info','request\x20sent','debug','stringify','error','code','message','FaxQueueReport,\x20%s,\x20%s','result','catch','CreateFaxQueueReport','FaxQueueReport','body','options','raw','UpdateFaxQueueReport','update','where','limit'];(function(_0x3040ab,_0x437de1){var _0x3df432=function(_0x35d686){while(--_0x35d686){_0x3040ab['push'](_0x3040ab['shift']());}};_0x3df432(++_0x437de1);}(_0x6ad7,0x196));var _0x76ad=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x6ad7[_0x3dd15e];return _0x231fd0;};'use strict';var _=require('lodash');var util=require(_0x76ad('0x0'));var moment=require(_0x76ad('0x1'));var BPromise=require('bluebird');var rs=require(_0x76ad('0x2'));var fs=require('fs');var Redis=require(_0x76ad('0x3'));var db=require(_0x76ad('0x4'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x76ad('0x5'));var config=require(_0x76ad('0x6'));var jayson=require(_0x76ad('0x7'));var client=jayson[_0x76ad('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x617ce,_0xfdfdd6,_0x5bf0d9){return new BPromise(function(_0x5e1114,_0x25276b){return client['request'](_0x617ce,_0x5bf0d9)[_0x76ad('0x9')](function(_0x2bd708){logger[_0x76ad('0xa')]('FaxQueueReport,\x20%s,\x20%s',_0xfdfdd6,_0x76ad('0xb'));logger[_0x76ad('0xc')]('FaxQueueReport,\x20%s,\x20%s,\x20%s',_0xfdfdd6,_0x76ad('0xb'),JSON[_0x76ad('0xd')](_0x2bd708));if(_0x2bd708['error']){if(_0x2bd708[_0x76ad('0xe')][_0x76ad('0xf')]===0x1f4){logger[_0x76ad('0xe')]('FaxQueueReport,\x20%s,\x20%s',_0xfdfdd6,_0x2bd708[_0x76ad('0xe')][_0x76ad('0x10')]);return _0x25276b(_0x2bd708[_0x76ad('0xe')]['message']);}logger[_0x76ad('0xe')](_0x76ad('0x11'),_0xfdfdd6,_0x2bd708['error'][_0x76ad('0x10')]);return _0x5e1114(_0x2bd708['error'][_0x76ad('0x10')]);}else{logger['info'](_0x76ad('0x11'),_0xfdfdd6,'request\x20sent');_0x5e1114(_0x2bd708[_0x76ad('0x12')][_0x76ad('0x10')]);}})[_0x76ad('0x13')](function(_0x3ce11a){logger[_0x76ad('0xe')]('FaxQueueReport,\x20%s,\x20%s',_0xfdfdd6,_0x3ce11a);_0x25276b(_0x3ce11a);});});}exports[_0x76ad('0x14')]=function(_0x144929){var _0x25ed22=this;return new Promise(function(_0x55bf61,_0x5d058b){return db[_0x76ad('0x15')]['create'](_0x144929[_0x76ad('0x16')],{'raw':_0x144929[_0x76ad('0x17')]?_0x144929[_0x76ad('0x17')][_0x76ad('0x18')]===undefined?!![]:![]:!![]})[_0x76ad('0x9')](function(_0x43693c){logger[_0x76ad('0xa')](_0x76ad('0x14'),_0x144929);logger['debug']('CreateFaxQueueReport',_0x144929,JSON[_0x76ad('0xd')](_0x43693c));_0x55bf61(_0x43693c);})[_0x76ad('0x13')](function(_0x11c8fe){logger[_0x76ad('0xe')](_0x76ad('0x14'),_0x11c8fe[_0x76ad('0x10')],_0x144929);_0x5d058b(_0x25ed22[_0x76ad('0xe')](0x1f4,_0x11c8fe[_0x76ad('0x10')]));});});};exports[_0x76ad('0x19')]=function(_0x3977be){var _0x36032a=this;return new Promise(function(_0x426b48,_0xb223d2){return db[_0x76ad('0x15')][_0x76ad('0x1a')](_0x3977be[_0x76ad('0x16')],{'raw':_0x3977be[_0x76ad('0x17')]?_0x3977be['options'][_0x76ad('0x18')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x3977be['options']?_0x3977be['options'][_0x76ad('0x1b')]||null:null,'attributes':_0x3977be[_0x76ad('0x17')]?_0x3977be[_0x76ad('0x17')]['attributes']||null:null,'limit':_0x3977be[_0x76ad('0x17')]?_0x3977be['options'][_0x76ad('0x1c')]||null:null})[_0x76ad('0x9')](function(_0x134b60){logger[_0x76ad('0xa')](_0x76ad('0x19'),_0x3977be);logger['debug']('UpdateFaxQueueReport',_0x3977be,JSON['stringify'](_0x134b60));_0x426b48(_0x134b60);})[_0x76ad('0x13')](function(_0xca8374){logger[_0x76ad('0xe')](_0x76ad('0x19'),_0xca8374['message'],_0x3977be);_0xb223d2(_0x36032a[_0x76ad('0xe')](0x1f4,_0xca8374[_0x76ad('0x10')]));});});}; \ No newline at end of file +var _0x53ec=['info','FaxQueueReport,\x20%s,\x20%s','request\x20sent','debug','FaxQueueReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','CreateFaxQueueReport','FaxQueueReport','body','options','then','UpdateFaxQueueReport','raw','where','attributes','limit','util','moment','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request'];(function(_0x462f4a,_0x420131){var _0x4f1316=function(_0x43a8b7){while(--_0x43a8b7){_0x462f4a['push'](_0x462f4a['shift']());}};_0x4f1316(++_0x420131);}(_0x53ec,0x78));var _0xc53e=function(_0xa2c0a3,_0x5bbac0){_0xa2c0a3=_0xa2c0a3-0x0;var _0x52c618=_0x53ec[_0xa2c0a3];return _0x52c618;};'use strict';var _=require('lodash');var util=require(_0xc53e('0x0'));var moment=require(_0xc53e('0x1'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xc53e('0x2'));var db=require(_0xc53e('0x3'))['db'];var utils=require(_0xc53e('0x4'));var logger=require(_0xc53e('0x5'))(_0xc53e('0x6'));var config=require(_0xc53e('0x7'));var jayson=require(_0xc53e('0x8'));var client=jayson[_0xc53e('0x9')][_0xc53e('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x2f6fb7,_0x122d52,_0x130d6f){return new BPromise(function(_0x5cca54,_0x49cf0d){return client[_0xc53e('0xb')](_0x2f6fb7,_0x130d6f)['then'](function(_0x2e88ac){logger[_0xc53e('0xc')](_0xc53e('0xd'),_0x122d52,_0xc53e('0xe'));logger[_0xc53e('0xf')](_0xc53e('0x10'),_0x122d52,_0xc53e('0xe'),JSON[_0xc53e('0x11')](_0x2e88ac));if(_0x2e88ac[_0xc53e('0x12')]){if(_0x2e88ac[_0xc53e('0x12')][_0xc53e('0x13')]===0x1f4){logger[_0xc53e('0x12')](_0xc53e('0xd'),_0x122d52,_0x2e88ac[_0xc53e('0x12')][_0xc53e('0x14')]);return _0x49cf0d(_0x2e88ac[_0xc53e('0x12')][_0xc53e('0x14')]);}logger[_0xc53e('0x12')](_0xc53e('0xd'),_0x122d52,_0x2e88ac[_0xc53e('0x12')][_0xc53e('0x14')]);return _0x5cca54(_0x2e88ac[_0xc53e('0x12')][_0xc53e('0x14')]);}else{logger['info'](_0xc53e('0xd'),_0x122d52,'request\x20sent');_0x5cca54(_0x2e88ac[_0xc53e('0x15')]['message']);}})[_0xc53e('0x16')](function(_0x212a7c){logger[_0xc53e('0x12')](_0xc53e('0xd'),_0x122d52,_0x212a7c);_0x49cf0d(_0x212a7c);});});}exports[_0xc53e('0x17')]=function(_0x4650fa){var _0x1f0ca2=this;return new Promise(function(_0x5f0fe1,_0x6b85f9){return db[_0xc53e('0x18')]['create'](_0x4650fa[_0xc53e('0x19')],{'raw':_0x4650fa[_0xc53e('0x1a')]?_0x4650fa[_0xc53e('0x1a')]['raw']===undefined?!![]:![]:!![]})[_0xc53e('0x1b')](function(_0x179823){logger['info']('CreateFaxQueueReport',_0x4650fa);logger['debug'](_0xc53e('0x17'),_0x4650fa,JSON['stringify'](_0x179823));_0x5f0fe1(_0x179823);})[_0xc53e('0x16')](function(_0x13a50c){logger[_0xc53e('0x12')](_0xc53e('0x17'),_0x13a50c[_0xc53e('0x14')],_0x4650fa);_0x6b85f9(_0x1f0ca2[_0xc53e('0x12')](0x1f4,_0x13a50c['message']));});});};exports[_0xc53e('0x1c')]=function(_0x4ba8c3){var _0x165aea=this;return new Promise(function(_0x3cde93,_0xe846e4){return db['FaxQueueReport']['update'](_0x4ba8c3[_0xc53e('0x19')],{'raw':_0x4ba8c3['options']?_0x4ba8c3[_0xc53e('0x1a')][_0xc53e('0x1d')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x4ba8c3[_0xc53e('0x1a')]?_0x4ba8c3['options'][_0xc53e('0x1e')]||null:null,'attributes':_0x4ba8c3[_0xc53e('0x1a')]?_0x4ba8c3[_0xc53e('0x1a')][_0xc53e('0x1f')]||null:null,'limit':_0x4ba8c3['options']?_0x4ba8c3[_0xc53e('0x1a')][_0xc53e('0x20')]||null:null})['then'](function(_0x57d3d0){logger[_0xc53e('0xc')](_0xc53e('0x1c'),_0x4ba8c3);logger[_0xc53e('0xf')](_0xc53e('0x1c'),_0x4ba8c3,JSON[_0xc53e('0x11')](_0x57d3d0));_0x3cde93(_0x57d3d0);})[_0xc53e('0x16')](function(_0x1dad38){logger['error'](_0xc53e('0x1c'),_0x1dad38[_0xc53e('0x14')],_0x4ba8c3);_0xe846e4(_0x165aea[_0xc53e('0x12')](0x1f4,_0x1dad38[_0xc53e('0x14')]));});});}; \ No newline at end of file diff --git a/server/api/faxQueueReport/index.js b/server/api/faxQueueReport/index.js index 36f4a55..5d1c6fc 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 _0x9479=['util','path','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/describe','describe','/:id','post','create','update','delete','destroy','exports','multer'];(function(_0x4ff817,_0x4cd662){var _0x2d3940=function(_0x501e6d){while(--_0x501e6d){_0x4ff817['push'](_0x4ff817['shift']());}};_0x2d3940(++_0x4cd662);}(_0x9479,0xef));var _0x9947=function(_0x48fb54,_0x27f4ee){_0x48fb54=_0x48fb54-0x0;var _0x9fee11=_0x9479[_0x48fb54];return _0x9fee11;};'use strict';var multer=require(_0x9947('0x0'));var util=require(_0x9947('0x1'));var path=require(_0x9947('0x2'));var timeout=require(_0x9947('0x3'));var express=require('express');var router=express[_0x9947('0x4')]();var auth=require(_0x9947('0x5'));var interaction=require(_0x9947('0x6'));var config=require(_0x9947('0x7'));var controller=require('./faxQueueReport.controller');router[_0x9947('0x8')]('/',auth[_0x9947('0x9')](),controller[_0x9947('0xa')]);router['get'](_0x9947('0xb'),auth[_0x9947('0x9')](),controller[_0x9947('0xc')]);router[_0x9947('0x8')](_0x9947('0xd'),auth[_0x9947('0x9')](),controller['show']);router[_0x9947('0xe')]('/',auth[_0x9947('0x9')](),controller[_0x9947('0xf')]);router['put'](_0x9947('0xd'),auth[_0x9947('0x9')](),controller[_0x9947('0x10')]);router[_0x9947('0x11')](_0x9947('0xd'),auth[_0x9947('0x9')](),controller[_0x9947('0x12')]);module[_0x9947('0x13')]=router; \ No newline at end of file +var _0x4ec3=['create','put','update','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./faxQueueReport.controller','get','isAuthenticated','/:id','post'];(function(_0x4f891d,_0x36051c){var _0x1d03f9=function(_0x506c59){while(--_0x506c59){_0x4f891d['push'](_0x4f891d['shift']());}};_0x1d03f9(++_0x36051c);}(_0x4ec3,0x7e));var _0x34ec=function(_0x5a187b,_0x1f64fe){_0x5a187b=_0x5a187b-0x0;var _0x14d601=_0x4ec3[_0x5a187b];return _0x14d601;};'use strict';var multer=require(_0x34ec('0x0'));var util=require(_0x34ec('0x1'));var path=require(_0x34ec('0x2'));var timeout=require(_0x34ec('0x3'));var express=require(_0x34ec('0x4'));var router=express[_0x34ec('0x5')]();var auth=require(_0x34ec('0x6'));var interaction=require(_0x34ec('0x7'));var config=require(_0x34ec('0x8'));var controller=require(_0x34ec('0x9'));router[_0x34ec('0xa')]('/',auth[_0x34ec('0xb')](),controller['index']);router[_0x34ec('0xa')]('/describe',auth[_0x34ec('0xb')](),controller['describe']);router['get'](_0x34ec('0xc'),auth[_0x34ec('0xb')](),controller['show']);router[_0x34ec('0xd')]('/',auth[_0x34ec('0xb')](),controller[_0x34ec('0xe')]);router[_0x34ec('0xf')](_0x34ec('0xc'),auth[_0x34ec('0xb')](),controller[_0x34ec('0x10')]);router[_0x34ec('0x11')](_0x34ec('0xc'),auth[_0x34ec('0xb')](),controller[_0x34ec('0x12')]);module[_0x34ec('0x13')]=router; \ No newline at end of file diff --git a/server/api/faxTransferReport/faxTransferReport.attributes.js b/server/api/faxTransferReport/faxTransferReport.attributes.js index 845879e..0f0ce3b 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 _0x9876=['DATE','NOW','moment','sequelize','exports','STRING','account','agent','queue'];(function(_0x43a814,_0x2a1010){var _0x574744=function(_0x645a7a){while(--_0x645a7a){_0x43a814['push'](_0x43a814['shift']());}};_0x574744(++_0x2a1010);}(_0x9876,0x6e));var _0x6987=function(_0x32b847,_0x2666e0){_0x32b847=_0x32b847-0x0;var _0x373859=_0x9876[_0x32b847];return _0x373859;};'use strict';var moment=require(_0x6987('0x0'));var Sequelize=require(_0x6987('0x1'));module[_0x6987('0x2')]={'uniqueid':{'type':Sequelize[_0x6987('0x3')],'allowNull':![]},'type':{'type':Sequelize['ENUM'](_0x6987('0x4'),_0x6987('0x5'),'queue'),'allowNull':![],'defaultValue':_0x6987('0x6')},'transferredAt':{'type':Sequelize[_0x6987('0x7')],'allowNull':![],'defaultValue':Sequelize[_0x6987('0x8')]}}; \ No newline at end of file +var _0x865f=['account','agent','NOW','moment','sequelize','exports','STRING','ENUM'];(function(_0x7b0169,_0xb2b94c){var _0x4381d6=function(_0x46777b){while(--_0x46777b){_0x7b0169['push'](_0x7b0169['shift']());}};_0x4381d6(++_0xb2b94c);}(_0x865f,0x133));var _0xf865=function(_0x4cec75,_0x2f8679){_0x4cec75=_0x4cec75-0x0;var _0x4074ef=_0x865f[_0x4cec75];return _0x4074ef;};'use strict';var moment=require(_0xf865('0x0'));var Sequelize=require(_0xf865('0x1'));module[_0xf865('0x2')]={'uniqueid':{'type':Sequelize[_0xf865('0x3')],'allowNull':![]},'type':{'type':Sequelize[_0xf865('0x4')](_0xf865('0x5'),_0xf865('0x6'),'queue'),'allowNull':![],'defaultValue':'queue'},'transferredAt':{'type':Sequelize['DATE'],'allowNull':![],'defaultValue':Sequelize[_0xf865('0x7')]}}; \ No newline at end of file diff --git a/server/api/faxTransferReport/faxTransferReport.controller.js b/server/api/faxTransferReport/faxTransferReport.controller.js index cba2b6f..705dadf 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 _0xb2fd=['map','VIRTUAL','merge','options','include','findAll','show','params','keys','length','includeAll','catch','create','body','find','describe','html-pdf','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','../../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','set','Content-Range','reject','update','then','destroy','name','send','index','FaxTransferReport','rawAttributes','type','key','query','filters','intersection','model','fields','attributes','hasOwnProperty','nolimit','limit','order','sort','where','pick','filter'];(function(_0x28eb88,_0x659a98){var _0x5e00bd=function(_0x2a0b9f){while(--_0x2a0b9f){_0x28eb88['push'](_0x28eb88['shift']());}};_0x5e00bd(++_0x659a98);}(_0xb2fd,0xa8));var _0xdb2f=function(_0x13cfc5,_0x1da452){_0x13cfc5=_0x13cfc5-0x0;var _0x1273db=_0xb2fd[_0x13cfc5];return _0x1273db;};'use strict';var pdf=require(_0xdb2f('0x0'));var emlformat=require(_0xdb2f('0x1'));var rimraf=require('rimraf');var zipdir=require(_0xdb2f('0x2'));var jsonpatch=require(_0xdb2f('0x3'));var rp=require(_0xdb2f('0x4'));var moment=require(_0xdb2f('0x5'));var BPromise=require(_0xdb2f('0x6'));var Mustache=require(_0xdb2f('0x7'));var util=require(_0xdb2f('0x8'));var path=require('path');var sox=require(_0xdb2f('0x9'));var csv=require(_0xdb2f('0xa'));var ejs=require(_0xdb2f('0xb'));var fs=require('fs');var _=require(_0xdb2f('0xc'));var squel=require(_0xdb2f('0xd'));var crypto=require(_0xdb2f('0xe'));var jsforce=require(_0xdb2f('0xf'));var deskjs=require(_0xdb2f('0x10'));var toCsv=require('to-csv');var querystring=require(_0xdb2f('0x11'));var Papa=require(_0xdb2f('0x12'));var Redis=require('ioredis');var authService=require(_0xdb2f('0x13'));var qs=require(_0xdb2f('0x14'));var as=require(_0xdb2f('0x15'));var hardwareService=require(_0xdb2f('0x16'));var logger=require(_0xdb2f('0x17'))(_0xdb2f('0x18'));var utils=require(_0xdb2f('0x19'));var config=require(_0xdb2f('0x1a'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x243ae4,_0x13dc1a){_0x13dc1a=_0x13dc1a||0xcc;return function(_0x2f170a){if(_0x2f170a){return _0x243ae4[_0xdb2f('0x1b')](_0x13dc1a);}return _0x243ae4[_0xdb2f('0x1c')](_0x13dc1a)[_0xdb2f('0x1d')]();};}function respondWithResult(_0x586c56,_0x4f1575){_0x4f1575=_0x4f1575||0xc8;return function(_0x1e553a){if(_0x1e553a){return _0x586c56['status'](_0x4f1575)[_0xdb2f('0x1e')](_0x1e553a);}};}function respondWithFilteredResult(_0x18d5a2,_0x2d1b36){return function(_0x1867ac){if(_0x1867ac){var _0x27de14=_0x1867ac[_0xdb2f('0x1f')],_0x56860d=_0x2d1b36['offset'],_0x5daf91=_0x2d1b36[_0xdb2f('0x20')]+_0x2d1b36['limit'],_0x1df4c7;if(_0x5daf91>=_0x27de14){_0x5daf91=_0x27de14;_0x1df4c7=0xc8;}else{_0x1df4c7=0xce;}_0x18d5a2[_0xdb2f('0x1c')](_0x1df4c7);return _0x18d5a2[_0xdb2f('0x21')](_0xdb2f('0x22'),_0x56860d+'-'+_0x5daf91+'/'+_0x27de14)[_0xdb2f('0x1e')](_0x1867ac);}return null;};}function patchUpdates(_0x378b36){return function(_0x200957){try{jsonpatch['apply'](_0x200957,_0x378b36,!![]);}catch(_0x25724e){return BPromise[_0xdb2f('0x23')](_0x25724e);}return _0x200957['save']();};}function saveUpdates(_0x397c11,_0x542073){return function(_0x190fa8){if(_0x190fa8){return _0x190fa8[_0xdb2f('0x24')](_0x397c11)[_0xdb2f('0x25')](function(_0xd1fa2c){return _0xd1fa2c;});}return null;};}function removeEntity(_0x5bc013,_0x3a533d){return function(_0xf2e940){if(_0xf2e940){return _0xf2e940[_0xdb2f('0x26')]()[_0xdb2f('0x25')](function(){_0x5bc013['status'](0xcc)[_0xdb2f('0x1d')]();});}};}function handleEntityNotFound(_0x4ad972,_0x4ded24){return function(_0x2dc3d0){if(!_0x2dc3d0){_0x4ad972[_0xdb2f('0x1b')](0x194);}return _0x2dc3d0;};}function handleError(_0x50debc,_0x65ac46){_0x65ac46=_0x65ac46||0x1f4;return function(_0x1ae36c){logger['error'](_0x1ae36c['stack']);if(_0x1ae36c['name']){delete _0x1ae36c[_0xdb2f('0x27')];}_0x50debc['status'](_0x65ac46)[_0xdb2f('0x28')](_0x1ae36c);};}exports[_0xdb2f('0x29')]=function(_0x1f0ec9,_0x50c5c9){var _0x18e41c={},_0x2da037={},_0x1d153b={'count':0x0,'rows':[]};var _0x28caec=_['map'](db[_0xdb2f('0x2a')][_0xdb2f('0x2b')],function(_0x232edd){return{'name':_0x232edd['fieldName'],'type':_0x232edd[_0xdb2f('0x2c')][_0xdb2f('0x2d')]};});_0x2da037['model']=_['map'](_0x28caec,'name');_0x2da037[_0xdb2f('0x2e')]=_['keys'](_0x1f0ec9[_0xdb2f('0x2e')]);_0x2da037[_0xdb2f('0x2f')]=_[_0xdb2f('0x30')](_0x2da037[_0xdb2f('0x31')],_0x2da037[_0xdb2f('0x2e')]);_0x18e41c['attributes']=_[_0xdb2f('0x30')](_0x2da037[_0xdb2f('0x31')],qs[_0xdb2f('0x32')](_0x1f0ec9[_0xdb2f('0x2e')][_0xdb2f('0x32')]));_0x18e41c[_0xdb2f('0x33')]=_0x18e41c[_0xdb2f('0x33')]['length']?_0x18e41c[_0xdb2f('0x33')]:_0x2da037[_0xdb2f('0x31')];if(!_0x1f0ec9['query'][_0xdb2f('0x34')](_0xdb2f('0x35'))){_0x18e41c[_0xdb2f('0x36')]=qs['limit'](_0x1f0ec9[_0xdb2f('0x2e')]['limit']);_0x18e41c[_0xdb2f('0x20')]=qs['offset'](_0x1f0ec9[_0xdb2f('0x2e')]['offset']);}_0x18e41c[_0xdb2f('0x37')]=qs[_0xdb2f('0x38')](_0x1f0ec9[_0xdb2f('0x2e')][_0xdb2f('0x38')]);_0x18e41c[_0xdb2f('0x39')]=qs[_0xdb2f('0x2f')](_[_0xdb2f('0x3a')](_0x1f0ec9[_0xdb2f('0x2e')],_0x2da037[_0xdb2f('0x2f')]));if(_0x1f0ec9['query'][_0xdb2f('0x3b')]){_0x18e41c[_0xdb2f('0x39')]=_['merge'](_0x18e41c['where'],{'$or':_[_0xdb2f('0x3c')](_0x28caec,function(_0x1a8be0){if(_0x1a8be0[_0xdb2f('0x2c')]!==_0xdb2f('0x3d')){var _0x5f0cb5={};_0x5f0cb5[_0x1a8be0[_0xdb2f('0x27')]]={'$like':'%'+_0x1f0ec9[_0xdb2f('0x2e')][_0xdb2f('0x3b')]+'%'};return _0x5f0cb5;}})});}_0x18e41c=_[_0xdb2f('0x3e')]({},_0x18e41c,_0x1f0ec9[_0xdb2f('0x3f')]);var _0xa839e4={'where':_0x18e41c['where']};return db[_0xdb2f('0x2a')][_0xdb2f('0x1f')](_0xa839e4)[_0xdb2f('0x25')](function(_0x36f018){_0x1d153b[_0xdb2f('0x1f')]=_0x36f018;if(_0x1f0ec9[_0xdb2f('0x2e')]['includeAll']){_0x18e41c[_0xdb2f('0x40')]=[{'all':!![]}];}return db[_0xdb2f('0x2a')][_0xdb2f('0x41')](_0x18e41c);})[_0xdb2f('0x25')](function(_0x166122){_0x1d153b['rows']=_0x166122;return _0x1d153b;})['then'](respondWithFilteredResult(_0x50c5c9,_0x18e41c))['catch'](handleError(_0x50c5c9,null));};exports[_0xdb2f('0x42')]=function(_0x539651,_0x5f25af){var _0x2039c7={'raw':!![],'where':{'id':_0x539651[_0xdb2f('0x43')]['id']}},_0x54af15={};_0x54af15['model']=_['keys'](db[_0xdb2f('0x2a')][_0xdb2f('0x2b')]);_0x54af15[_0xdb2f('0x2e')]=_[_0xdb2f('0x44')](_0x539651[_0xdb2f('0x2e')]);_0x54af15[_0xdb2f('0x2f')]=_[_0xdb2f('0x30')](_0x54af15[_0xdb2f('0x31')],_0x54af15[_0xdb2f('0x2e')]);_0x2039c7['attributes']=_[_0xdb2f('0x30')](_0x54af15[_0xdb2f('0x31')],qs[_0xdb2f('0x32')](_0x539651[_0xdb2f('0x2e')][_0xdb2f('0x32')]));_0x2039c7['attributes']=_0x2039c7[_0xdb2f('0x33')][_0xdb2f('0x45')]?_0x2039c7[_0xdb2f('0x33')]:_0x54af15[_0xdb2f('0x31')];if(_0x539651['query'][_0xdb2f('0x46')]){_0x2039c7[_0xdb2f('0x40')]=[{'all':!![]}];}_0x2039c7=_[_0xdb2f('0x3e')]({},_0x2039c7,_0x539651[_0xdb2f('0x3f')]);return db[_0xdb2f('0x2a')]['find'](_0x2039c7)[_0xdb2f('0x25')](handleEntityNotFound(_0x5f25af,null))[_0xdb2f('0x25')](respondWithResult(_0x5f25af,null))[_0xdb2f('0x47')](handleError(_0x5f25af,null));};exports[_0xdb2f('0x48')]=function(_0x2ab3f5,_0x3219ff){return db[_0xdb2f('0x2a')][_0xdb2f('0x48')](_0x2ab3f5[_0xdb2f('0x49')],{})[_0xdb2f('0x25')](respondWithResult(_0x3219ff,0xc9))[_0xdb2f('0x47')](handleError(_0x3219ff,null));};exports[_0xdb2f('0x24')]=function(_0x374657,_0x5f50ab){if(_0x374657[_0xdb2f('0x49')]['id']){delete _0x374657['body']['id'];}return db[_0xdb2f('0x2a')][_0xdb2f('0x4a')]({'where':{'id':_0x374657[_0xdb2f('0x43')]['id']}})[_0xdb2f('0x25')](handleEntityNotFound(_0x5f50ab,null))[_0xdb2f('0x25')](saveUpdates(_0x374657[_0xdb2f('0x49')],null))[_0xdb2f('0x25')](respondWithResult(_0x5f50ab,null))[_0xdb2f('0x47')](handleError(_0x5f50ab,null));};exports[_0xdb2f('0x26')]=function(_0x44d1ca,_0x119786){return db['FaxTransferReport']['find']({'where':{'id':_0x44d1ca[_0xdb2f('0x43')]['id']}})[_0xdb2f('0x25')](handleEntityNotFound(_0x119786,null))[_0xdb2f('0x25')](removeEntity(_0x119786,null))[_0xdb2f('0x47')](handleError(_0x119786,null));};exports['describe']=function(_0x52852a,_0x10ee4c){return db[_0xdb2f('0x2a')][_0xdb2f('0x4b')]()[_0xdb2f('0x25')](respondWithResult(_0x10ee4c,null))[_0xdb2f('0x47')](handleError(_0x10ee4c,null));}; \ No newline at end of file +var _0x6c7b=['rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','sox','lodash','squel','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/utils','../../config/environment','../../mysqldb','sendStatus','end','json','count','offset','limit','status','set','Content-Range','apply','reject','update','then','destroy','error','stack','map','FaxTransferReport','fieldName','model','name','query','keys','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','pick','filter','where','merge','VIRTUAL','includeAll','include','findAll','catch','show','rawAttributes','options','find','body','params','describe','html-pdf','eml-format'];(function(_0x5171c5,_0x17b190){var _0x290f62=function(_0x223ffb){while(--_0x223ffb){_0x5171c5['push'](_0x5171c5['shift']());}};_0x290f62(++_0x17b190);}(_0x6c7b,0xd6));var _0xb6c7=function(_0x3f474a,_0xd54130){_0x3f474a=_0x3f474a-0x0;var _0x272589=_0x6c7b[_0x3f474a];return _0x272589;};'use strict';var pdf=require(_0xb6c7('0x0'));var emlformat=require(_0xb6c7('0x1'));var rimraf=require(_0xb6c7('0x2'));var zipdir=require(_0xb6c7('0x3'));var jsonpatch=require(_0xb6c7('0x4'));var rp=require(_0xb6c7('0x5'));var moment=require(_0xb6c7('0x6'));var BPromise=require('bluebird');var Mustache=require(_0xb6c7('0x7'));var util=require(_0xb6c7('0x8'));var path=require('path');var sox=require(_0xb6c7('0x9'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var _=require(_0xb6c7('0xa'));var squel=require(_0xb6c7('0xb'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0xb6c7('0xc'));var toCsv=require(_0xb6c7('0xd'));var querystring=require(_0xb6c7('0xe'));var Papa=require(_0xb6c7('0xf'));var Redis=require(_0xb6c7('0x10'));var authService=require(_0xb6c7('0x11'));var qs=require(_0xb6c7('0x12'));var as=require(_0xb6c7('0x13'));var hardwareService=require(_0xb6c7('0x14'));var logger=require('../../config/logger')('api');var utils=require(_0xb6c7('0x15'));var config=require(_0xb6c7('0x16'));var db=require(_0xb6c7('0x17'))['db'];function respondWithStatusCode(_0x5c2fb3,_0x441dfd){_0x441dfd=_0x441dfd||0xcc;return function(_0x401369){if(_0x401369){return _0x5c2fb3[_0xb6c7('0x18')](_0x441dfd);}return _0x5c2fb3['status'](_0x441dfd)[_0xb6c7('0x19')]();};}function respondWithResult(_0x36b433,_0x4794a0){_0x4794a0=_0x4794a0||0xc8;return function(_0x37b990){if(_0x37b990){return _0x36b433['status'](_0x4794a0)[_0xb6c7('0x1a')](_0x37b990);}};}function respondWithFilteredResult(_0x3861bf,_0x1eaee2){return function(_0x11ca9a){if(_0x11ca9a){var _0x290ffe=_0x11ca9a[_0xb6c7('0x1b')],_0x1d6f6a=_0x1eaee2[_0xb6c7('0x1c')],_0x11a554=_0x1eaee2[_0xb6c7('0x1c')]+_0x1eaee2[_0xb6c7('0x1d')],_0x20cd57;if(_0x11a554>=_0x290ffe){_0x11a554=_0x290ffe;_0x20cd57=0xc8;}else{_0x20cd57=0xce;}_0x3861bf[_0xb6c7('0x1e')](_0x20cd57);return _0x3861bf[_0xb6c7('0x1f')](_0xb6c7('0x20'),_0x1d6f6a+'-'+_0x11a554+'/'+_0x290ffe)['json'](_0x11ca9a);}return null;};}function patchUpdates(_0x332013){return function(_0x4a2e2){try{jsonpatch[_0xb6c7('0x21')](_0x4a2e2,_0x332013,!![]);}catch(_0x96241){return BPromise[_0xb6c7('0x22')](_0x96241);}return _0x4a2e2['save']();};}function saveUpdates(_0x205f4e,_0x1e30b5){return function(_0xa424b7){if(_0xa424b7){return _0xa424b7[_0xb6c7('0x23')](_0x205f4e)[_0xb6c7('0x24')](function(_0x28151b){return _0x28151b;});}return null;};}function removeEntity(_0x42cb47,_0x1a71a0){return function(_0x2870a8){if(_0x2870a8){return _0x2870a8[_0xb6c7('0x25')]()[_0xb6c7('0x24')](function(){_0x42cb47['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x500ddc,_0x29e74a){return function(_0x1d35e1){if(!_0x1d35e1){_0x500ddc[_0xb6c7('0x18')](0x194);}return _0x1d35e1;};}function handleError(_0x219206,_0x2c46dd){_0x2c46dd=_0x2c46dd||0x1f4;return function(_0x15e4fe){logger[_0xb6c7('0x26')](_0x15e4fe[_0xb6c7('0x27')]);if(_0x15e4fe['name']){delete _0x15e4fe['name'];}_0x219206[_0xb6c7('0x1e')](_0x2c46dd)['send'](_0x15e4fe);};}exports['index']=function(_0x5db99d,_0x5d658b){var _0x175ec6={},_0x168082={},_0x7e6157={'count':0x0,'rows':[]};var _0x4f91b9=_[_0xb6c7('0x28')](db[_0xb6c7('0x29')]['rawAttributes'],function(_0x1f0481){return{'name':_0x1f0481[_0xb6c7('0x2a')],'type':_0x1f0481['type']['key']};});_0x168082[_0xb6c7('0x2b')]=_[_0xb6c7('0x28')](_0x4f91b9,_0xb6c7('0x2c'));_0x168082[_0xb6c7('0x2d')]=_[_0xb6c7('0x2e')](_0x5db99d[_0xb6c7('0x2d')]);_0x168082[_0xb6c7('0x2f')]=_['intersection'](_0x168082['model'],_0x168082[_0xb6c7('0x2d')]);_0x175ec6[_0xb6c7('0x30')]=_[_0xb6c7('0x31')](_0x168082[_0xb6c7('0x2b')],qs['fields'](_0x5db99d[_0xb6c7('0x2d')][_0xb6c7('0x32')]));_0x175ec6[_0xb6c7('0x30')]=_0x175ec6[_0xb6c7('0x30')][_0xb6c7('0x33')]?_0x175ec6[_0xb6c7('0x30')]:_0x168082[_0xb6c7('0x2b')];if(!_0x5db99d[_0xb6c7('0x2d')][_0xb6c7('0x34')](_0xb6c7('0x35'))){_0x175ec6[_0xb6c7('0x1d')]=qs[_0xb6c7('0x1d')](_0x5db99d[_0xb6c7('0x2d')][_0xb6c7('0x1d')]);_0x175ec6[_0xb6c7('0x1c')]=qs[_0xb6c7('0x1c')](_0x5db99d[_0xb6c7('0x2d')][_0xb6c7('0x1c')]);}_0x175ec6[_0xb6c7('0x36')]=qs[_0xb6c7('0x37')](_0x5db99d[_0xb6c7('0x2d')][_0xb6c7('0x37')]);_0x175ec6['where']=qs[_0xb6c7('0x2f')](_[_0xb6c7('0x38')](_0x5db99d[_0xb6c7('0x2d')],_0x168082[_0xb6c7('0x2f')]));if(_0x5db99d[_0xb6c7('0x2d')][_0xb6c7('0x39')]){_0x175ec6[_0xb6c7('0x3a')]=_[_0xb6c7('0x3b')](_0x175ec6[_0xb6c7('0x3a')],{'$or':_['map'](_0x4f91b9,function(_0x5fd010){if(_0x5fd010['type']!==_0xb6c7('0x3c')){var _0x1124f2={};_0x1124f2[_0x5fd010[_0xb6c7('0x2c')]]={'$like':'%'+_0x5db99d[_0xb6c7('0x2d')][_0xb6c7('0x39')]+'%'};return _0x1124f2;}})});}_0x175ec6=_[_0xb6c7('0x3b')]({},_0x175ec6,_0x5db99d['options']);var _0x4543bb={'where':_0x175ec6[_0xb6c7('0x3a')]};return db['FaxTransferReport'][_0xb6c7('0x1b')](_0x4543bb)[_0xb6c7('0x24')](function(_0x548423){_0x7e6157['count']=_0x548423;if(_0x5db99d[_0xb6c7('0x2d')][_0xb6c7('0x3d')]){_0x175ec6[_0xb6c7('0x3e')]=[{'all':!![]}];}return db[_0xb6c7('0x29')][_0xb6c7('0x3f')](_0x175ec6);})[_0xb6c7('0x24')](function(_0x19d627){_0x7e6157['rows']=_0x19d627;return _0x7e6157;})[_0xb6c7('0x24')](respondWithFilteredResult(_0x5d658b,_0x175ec6))[_0xb6c7('0x40')](handleError(_0x5d658b,null));};exports[_0xb6c7('0x41')]=function(_0x2e60cc,_0x57d778){var _0x394d0d={'raw':!![],'where':{'id':_0x2e60cc['params']['id']}},_0x2c5d27={};_0x2c5d27[_0xb6c7('0x2b')]=_[_0xb6c7('0x2e')](db[_0xb6c7('0x29')][_0xb6c7('0x42')]);_0x2c5d27[_0xb6c7('0x2d')]=_[_0xb6c7('0x2e')](_0x2e60cc[_0xb6c7('0x2d')]);_0x2c5d27['filters']=_[_0xb6c7('0x31')](_0x2c5d27[_0xb6c7('0x2b')],_0x2c5d27['query']);_0x394d0d[_0xb6c7('0x30')]=_[_0xb6c7('0x31')](_0x2c5d27[_0xb6c7('0x2b')],qs[_0xb6c7('0x32')](_0x2e60cc[_0xb6c7('0x2d')][_0xb6c7('0x32')]));_0x394d0d['attributes']=_0x394d0d[_0xb6c7('0x30')][_0xb6c7('0x33')]?_0x394d0d['attributes']:_0x2c5d27['model'];if(_0x2e60cc[_0xb6c7('0x2d')]['includeAll']){_0x394d0d[_0xb6c7('0x3e')]=[{'all':!![]}];}_0x394d0d=_[_0xb6c7('0x3b')]({},_0x394d0d,_0x2e60cc[_0xb6c7('0x43')]);return db[_0xb6c7('0x29')][_0xb6c7('0x44')](_0x394d0d)[_0xb6c7('0x24')](handleEntityNotFound(_0x57d778,null))[_0xb6c7('0x24')](respondWithResult(_0x57d778,null))[_0xb6c7('0x40')](handleError(_0x57d778,null));};exports['create']=function(_0x25d351,_0x2a5155){return db['FaxTransferReport']['create'](_0x25d351['body'],{})[_0xb6c7('0x24')](respondWithResult(_0x2a5155,0xc9))[_0xb6c7('0x40')](handleError(_0x2a5155,null));};exports['update']=function(_0xb3ba04,_0x428295){if(_0xb3ba04[_0xb6c7('0x45')]['id']){delete _0xb3ba04['body']['id'];}return db[_0xb6c7('0x29')][_0xb6c7('0x44')]({'where':{'id':_0xb3ba04[_0xb6c7('0x46')]['id']}})[_0xb6c7('0x24')](handleEntityNotFound(_0x428295,null))[_0xb6c7('0x24')](saveUpdates(_0xb3ba04[_0xb6c7('0x45')],null))['then'](respondWithResult(_0x428295,null))[_0xb6c7('0x40')](handleError(_0x428295,null));};exports[_0xb6c7('0x25')]=function(_0x44ddf6,_0x3fc974){return db[_0xb6c7('0x29')][_0xb6c7('0x44')]({'where':{'id':_0x44ddf6[_0xb6c7('0x46')]['id']}})[_0xb6c7('0x24')](handleEntityNotFound(_0x3fc974,null))[_0xb6c7('0x24')](removeEntity(_0x3fc974,null))[_0xb6c7('0x40')](handleError(_0x3fc974,null));};exports[_0xb6c7('0x47')]=function(_0x5b5cef,_0x208c4c){return db[_0xb6c7('0x29')][_0xb6c7('0x47')]()[_0xb6c7('0x24')](respondWithResult(_0x208c4c,null))['catch'](handleError(_0x208c4c,null));}; \ No newline at end of file diff --git a/server/api/faxTransferReport/faxTransferReport.model.js b/server/api/faxTransferReport/faxTransferReport.model.js index ea84867..898624d 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 _0x1a82=['./faxTransferReport.attributes','exports','define','FaxTransferReport','report_fax_transfer','uniqueid','lodash','moment','bluebird','request-promise','path','rimraf','../../config/environment'];(function(_0x4b9ca4,_0x4686c9){var _0x54af37=function(_0x552f67){while(--_0x552f67){_0x4b9ca4['push'](_0x4b9ca4['shift']());}};_0x54af37(++_0x4686c9);}(_0x1a82,0xc9));var _0x21a8=function(_0x383356,_0x33d2f5){_0x383356=_0x383356-0x0;var _0x32ee5a=_0x1a82[_0x383356];return _0x32ee5a;};'use strict';var _=require(_0x21a8('0x0'));var util=require('util');var logger=require('../../config/logger')('api');var moment=require(_0x21a8('0x1'));var BPromise=require(_0x21a8('0x2'));var rp=require(_0x21a8('0x3'));var fs=require('fs');var path=require(_0x21a8('0x4'));var rimraf=require(_0x21a8('0x5'));var config=require(_0x21a8('0x6'));var attributes=require(_0x21a8('0x7'));module[_0x21a8('0x8')]=function(_0x1863a7,_0x578957){return _0x1863a7[_0x21a8('0x9')](_0x21a8('0xa'),attributes,{'tableName':_0x21a8('0xb'),'paranoid':![],'indexes':[{'name':_0x21a8('0xc'),'fields':[_0x21a8('0xc')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xcde5=['lodash','api','moment','bluebird','path','rimraf','../../config/environment','./faxTransferReport.attributes','exports','define','FaxTransferReport','uniqueid'];(function(_0x38eb23,_0x196e8b){var _0x48506a=function(_0x36edb0){while(--_0x36edb0){_0x38eb23['push'](_0x38eb23['shift']());}};_0x48506a(++_0x196e8b);}(_0xcde5,0x1ec));var _0x5cde=function(_0x8f37f8,_0x1b7467){_0x8f37f8=_0x8f37f8-0x0;var _0x3ec325=_0xcde5[_0x8f37f8];return _0x3ec325;};'use strict';var _=require(_0x5cde('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x5cde('0x1'));var moment=require(_0x5cde('0x2'));var BPromise=require(_0x5cde('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x5cde('0x4'));var rimraf=require(_0x5cde('0x5'));var config=require(_0x5cde('0x6'));var attributes=require(_0x5cde('0x7'));module[_0x5cde('0x8')]=function(_0x799008,_0x1af5bb){return _0x799008[_0x5cde('0x9')](_0x5cde('0xa'),attributes,{'tableName':'report_fax_transfer','paranoid':![],'indexes':[{'name':_0x5cde('0xb'),'fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/faxTransferReport/faxTransferReport.rpc.js b/server/api/faxTransferReport/faxTransferReport.rpc.js index d4f49e5..a3b5f67 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 _0x505d=['info','FaxTransferReport,\x20%s,\x20%s','request\x20sent','FaxTransferReport,\x20%s,\x20%s,\x20%s','stringify','error','message','catch','lodash','util','ioredis','../../config/utils','../../config/logger','rpc','jayson/promise','client','request','then'];(function(_0x3e71f6,_0x94d17f){var _0x3d1f7f=function(_0x5e69f3){while(--_0x5e69f3){_0x3e71f6['push'](_0x3e71f6['shift']());}};_0x3d1f7f(++_0x94d17f);}(_0x505d,0x1a6));var _0xd505=function(_0x5ddb1c,_0x5ea4df){_0x5ddb1c=_0x5ddb1c-0x0;var _0x354adc=_0x505d[_0x5ddb1c];return _0x354adc;};'use strict';var _=require(_0xd505('0x0'));var util=require(_0xd505('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xd505('0x2'));var db=require('../../mysqldb')['db'];var utils=require(_0xd505('0x3'));var logger=require(_0xd505('0x4'))(_0xd505('0x5'));var config=require('../../config/environment');var jayson=require(_0xd505('0x6'));var client=jayson[_0xd505('0x7')]['http']({'port':0x232a});function respondWithRpcPromise(_0x55e542,_0x4247b1,_0xe7fd77){return new BPromise(function(_0x2905b0,_0x89359b){return client[_0xd505('0x8')](_0x55e542,_0xe7fd77)[_0xd505('0x9')](function(_0x750798){logger[_0xd505('0xa')](_0xd505('0xb'),_0x4247b1,_0xd505('0xc'));logger['debug'](_0xd505('0xd'),_0x4247b1,_0xd505('0xc'),JSON[_0xd505('0xe')](_0x750798));if(_0x750798[_0xd505('0xf')]){if(_0x750798['error']['code']===0x1f4){logger[_0xd505('0xf')](_0xd505('0xb'),_0x4247b1,_0x750798[_0xd505('0xf')][_0xd505('0x10')]);return _0x89359b(_0x750798['error'][_0xd505('0x10')]);}logger['error'](_0xd505('0xb'),_0x4247b1,_0x750798[_0xd505('0xf')][_0xd505('0x10')]);return _0x2905b0(_0x750798[_0xd505('0xf')][_0xd505('0x10')]);}else{logger[_0xd505('0xa')]('FaxTransferReport,\x20%s,\x20%s',_0x4247b1,_0xd505('0xc'));_0x2905b0(_0x750798['result'][_0xd505('0x10')]);}})[_0xd505('0x11')](function(_0x2480ba){logger[_0xd505('0xf')]('FaxTransferReport,\x20%s,\x20%s',_0x4247b1,_0x2480ba);_0x89359b(_0x2480ba);});});} \ No newline at end of file +var _0xf4c4=['request','then','info','FaxTransferReport,\x20%s,\x20%s','debug','FaxTransferReport,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','result','catch','lodash','util','moment','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http'];(function(_0x1e9905,_0x106f1c){var _0x4f43d1=function(_0x320ecc){while(--_0x320ecc){_0x1e9905['push'](_0x1e9905['shift']());}};_0x4f43d1(++_0x106f1c);}(_0xf4c4,0x1c1));var _0x4f4c=function(_0x2678d6,_0x4e2001){_0x2678d6=_0x2678d6-0x0;var _0x475503=_0xf4c4[_0x2678d6];return _0x475503;};'use strict';var _=require(_0x4f4c('0x0'));var util=require(_0x4f4c('0x1'));var moment=require(_0x4f4c('0x2'));var BPromise=require('bluebird');var rs=require(_0x4f4c('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x4f4c('0x4'))['db'];var utils=require(_0x4f4c('0x5'));var logger=require(_0x4f4c('0x6'))(_0x4f4c('0x7'));var config=require(_0x4f4c('0x8'));var jayson=require(_0x4f4c('0x9'));var client=jayson['client'][_0x4f4c('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x21c811,_0x1b1a1f,_0x14c941){return new BPromise(function(_0x254667,_0x524c2c){return client[_0x4f4c('0xb')](_0x21c811,_0x14c941)[_0x4f4c('0xc')](function(_0x1e486c){logger[_0x4f4c('0xd')](_0x4f4c('0xe'),_0x1b1a1f,'request\x20sent');logger[_0x4f4c('0xf')](_0x4f4c('0x10'),_0x1b1a1f,_0x4f4c('0x11'),JSON['stringify'](_0x1e486c));if(_0x1e486c['error']){if(_0x1e486c[_0x4f4c('0x12')][_0x4f4c('0x13')]===0x1f4){logger[_0x4f4c('0x12')](_0x4f4c('0xe'),_0x1b1a1f,_0x1e486c['error']['message']);return _0x524c2c(_0x1e486c['error'][_0x4f4c('0x14')]);}logger[_0x4f4c('0x12')]('FaxTransferReport,\x20%s,\x20%s',_0x1b1a1f,_0x1e486c[_0x4f4c('0x12')]['message']);return _0x254667(_0x1e486c[_0x4f4c('0x12')]['message']);}else{logger[_0x4f4c('0xd')](_0x4f4c('0xe'),_0x1b1a1f,_0x4f4c('0x11'));_0x254667(_0x1e486c[_0x4f4c('0x15')][_0x4f4c('0x14')]);}})[_0x4f4c('0x16')](function(_0x3a15ec){logger[_0x4f4c('0x12')](_0x4f4c('0xe'),_0x1b1a1f,_0x3a15ec);_0x524c2c(_0x3a15ec);});});} \ No newline at end of file diff --git a/server/api/faxTransferReport/index.js b/server/api/faxTransferReport/index.js index 659ceb1..2405496 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 _0x06e3=['/:id','show','post','create','put','delete','destroy','exports','multer','util','connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment','./faxTransferReport.controller','/describe','isAuthenticated','describe','get'];(function(_0x5c925d,_0x2e042a){var _0x45792e=function(_0x32888e){while(--_0x32888e){_0x5c925d['push'](_0x5c925d['shift']());}};_0x45792e(++_0x2e042a);}(_0x06e3,0x148));var _0x306e=function(_0x1ac823,_0x23568a){_0x1ac823=_0x1ac823-0x0;var _0x20f89e=_0x06e3[_0x1ac823];return _0x20f89e;};'use strict';var multer=require(_0x306e('0x0'));var util=require(_0x306e('0x1'));var path=require('path');var timeout=require(_0x306e('0x2'));var express=require(_0x306e('0x3'));var router=express['Router']();var auth=require(_0x306e('0x4'));var interaction=require(_0x306e('0x5'));var config=require(_0x306e('0x6'));var controller=require(_0x306e('0x7'));router['get']('/',auth['isAuthenticated'](),controller['index']);router['get'](_0x306e('0x8'),auth[_0x306e('0x9')](),controller[_0x306e('0xa')]);router[_0x306e('0xb')](_0x306e('0xc'),auth[_0x306e('0x9')](),controller[_0x306e('0xd')]);router[_0x306e('0xe')]('/',auth[_0x306e('0x9')](),controller[_0x306e('0xf')]);router[_0x306e('0x10')](_0x306e('0xc'),auth[_0x306e('0x9')](),controller['update']);router[_0x306e('0x11')]('/:id',auth[_0x306e('0x9')](),controller[_0x306e('0x12')]);module[_0x306e('0x13')]=router; \ No newline at end of file +var _0xb82b=['isAuthenticated','index','/describe','/:id','post','create','put','delete','destroy','exports','multer','util','path','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./faxTransferReport.controller','get'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xb82b,0x101));var _0xbb82=function(_0x1facfa,_0x1acf7d){_0x1facfa=_0x1facfa-0x0;var _0x9ec701=_0xb82b[_0x1facfa];return _0x9ec701;};'use strict';var multer=require(_0xbb82('0x0'));var util=require(_0xbb82('0x1'));var path=require(_0xbb82('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0xbb82('0x3')]();var auth=require(_0xbb82('0x4'));var interaction=require(_0xbb82('0x5'));var config=require(_0xbb82('0x6'));var controller=require(_0xbb82('0x7'));router[_0xbb82('0x8')]('/',auth[_0xbb82('0x9')](),controller[_0xbb82('0xa')]);router['get'](_0xbb82('0xb'),auth[_0xbb82('0x9')](),controller['describe']);router[_0xbb82('0x8')](_0xbb82('0xc'),auth[_0xbb82('0x9')](),controller['show']);router[_0xbb82('0xd')]('/',auth[_0xbb82('0x9')](),controller[_0xbb82('0xe')]);router[_0xbb82('0xf')](_0xbb82('0xc'),auth[_0xbb82('0x9')](),controller['update']);router[_0xbb82('0x10')]('/:id',auth[_0xbb82('0x9')](),controller[_0xbb82('0x11')]);module[_0xbb82('0x12')]=router; \ No newline at end of file diff --git a/server/api/intDeskAccount/index.js b/server/api/intDeskAccount/index.js index 7f56e4e..a391441 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 _0xdf98=['getFields','post','create','/:id/configurations','addConfiguration','put','/:id','update','delete','multer','path','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./intDeskAccount.controller','get','isAuthenticated','index','show','getConfigurations','/:id/fields'];(function(_0x51e8c9,_0x2824db){var _0x465dd1=function(_0x2d883e){while(--_0x2d883e){_0x51e8c9['push'](_0x51e8c9['shift']());}};_0x465dd1(++_0x2824db);}(_0xdf98,0xcf));var _0x8df9=function(_0x23c827,_0x37332a){_0x23c827=_0x23c827-0x0;var _0x3d7f1f=_0xdf98[_0x23c827];return _0x3d7f1f;};'use strict';var multer=require(_0x8df9('0x0'));var util=require('util');var path=require(_0x8df9('0x1'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x8df9('0x2')]();var auth=require(_0x8df9('0x3'));var interaction=require(_0x8df9('0x4'));var config=require(_0x8df9('0x5'));var controller=require(_0x8df9('0x6'));router[_0x8df9('0x7')]('/',auth[_0x8df9('0x8')](),controller[_0x8df9('0x9')]);router[_0x8df9('0x7')]('/:id',auth[_0x8df9('0x8')](),controller[_0x8df9('0xa')]);router[_0x8df9('0x7')]('/:id/configurations',auth['isAuthenticated'](),controller[_0x8df9('0xb')]);router['get'](_0x8df9('0xc'),auth[_0x8df9('0x8')](),controller[_0x8df9('0xd')]);router[_0x8df9('0xe')]('/',auth[_0x8df9('0x8')](),controller[_0x8df9('0xf')]);router[_0x8df9('0xe')](_0x8df9('0x10'),auth['isAuthenticated'](),controller[_0x8df9('0x11')]);router[_0x8df9('0x12')](_0x8df9('0x13'),auth['isAuthenticated'](),controller[_0x8df9('0x14')]);router[_0x8df9('0x15')](_0x8df9('0x13'),auth[_0x8df9('0x8')](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0x02a7=['isAuthenticated','show','/:id/configurations','getConfigurations','/:id/fields','post','create','addConfiguration','put','update','delete','destroy','util','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./intDeskAccount.controller','get','index','/:id'];(function(_0x44fdb9,_0x3cc6e8){var _0x30876b=function(_0x204847){while(--_0x204847){_0x44fdb9['push'](_0x44fdb9['shift']());}};_0x30876b(++_0x3cc6e8);}(_0x02a7,0x7a));var _0x702a=function(_0x2acf44,_0x12b588){_0x2acf44=_0x2acf44-0x0;var _0x467cb9=_0x02a7[_0x2acf44];return _0x467cb9;};'use strict';var multer=require('multer');var util=require(_0x702a('0x0'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0x702a('0x1'));var router=express[_0x702a('0x2')]();var auth=require(_0x702a('0x3'));var interaction=require(_0x702a('0x4'));var config=require(_0x702a('0x5'));var controller=require(_0x702a('0x6'));router[_0x702a('0x7')]('/',auth['isAuthenticated'](),controller[_0x702a('0x8')]);router['get'](_0x702a('0x9'),auth[_0x702a('0xa')](),controller[_0x702a('0xb')]);router[_0x702a('0x7')](_0x702a('0xc'),auth[_0x702a('0xa')](),controller[_0x702a('0xd')]);router['get'](_0x702a('0xe'),auth['isAuthenticated'](),controller['getFields']);router[_0x702a('0xf')]('/',auth[_0x702a('0xa')](),controller[_0x702a('0x10')]);router[_0x702a('0xf')]('/:id/configurations',auth[_0x702a('0xa')](),controller[_0x702a('0x11')]);router[_0x702a('0x12')](_0x702a('0x9'),auth[_0x702a('0xa')](),controller[_0x702a('0x13')]);router[_0x702a('0x14')]('/:id',auth['isAuthenticated'](),controller[_0x702a('0x15')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/intDeskAccount/intDeskAccount.attributes.js b/server/api/intDeskAccount/intDeskAccount.attributes.js index 4e3be52..6d04ef0 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 _0xe732=['newTab','sequelize','exports','STRING','ENUM','basic','integrationTab'];(function(_0x4503df,_0xfec122){var _0x3f1b2b=function(_0x32b1de){while(--_0x32b1de){_0x4503df['push'](_0x4503df['shift']());}};_0x3f1b2b(++_0xfec122);}(_0xe732,0x1ac));var _0x2e73=function(_0x502c7d,_0x2f1285){_0x502c7d=_0x502c7d-0x0;var _0x30b7ed=_0xe732[_0x502c7d];return _0x30b7ed;};'use strict';var Sequelize=require(_0x2e73('0x0'));module[_0x2e73('0x1')]={'name':{'type':Sequelize[_0x2e73('0x2')]},'description':{'type':Sequelize[_0x2e73('0x2')]},'username':{'type':Sequelize[_0x2e73('0x2')]},'remoteUri':{'type':Sequelize[_0x2e73('0x2')]},'authType':{'type':Sequelize[_0x2e73('0x3')](_0x2e73('0x4')),'defaultValue':_0x2e73('0x4')},'password':{'type':Sequelize['STRING']},'consumerKey':{'type':Sequelize['STRING']},'consumerSecret':{'type':Sequelize[_0x2e73('0x2')]},'token':{'type':Sequelize['STRING']},'tokenSecret':{'type':Sequelize[_0x2e73('0x2')]},'serverUrl':{'type':Sequelize[_0x2e73('0x2')]},'type':{'type':Sequelize['ENUM'](_0x2e73('0x5'),_0x2e73('0x6')),'defaultValue':'integrationTab'}}; \ No newline at end of file +var _0x4909=['ENUM','basic','integrationTab','exports','STRING'];(function(_0x596bae,_0x2d215b){var _0x537e0d=function(_0x4b1f8c){while(--_0x4b1f8c){_0x596bae['push'](_0x596bae['shift']());}};_0x537e0d(++_0x2d215b);}(_0x4909,0x1c0));var _0x9490=function(_0x560485,_0x244601){_0x560485=_0x560485-0x0;var _0x3e7f69=_0x4909[_0x560485];return _0x3e7f69;};'use strict';var Sequelize=require('sequelize');module[_0x9490('0x0')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0x9490('0x1')]},'username':{'type':Sequelize['STRING']},'remoteUri':{'type':Sequelize[_0x9490('0x1')]},'authType':{'type':Sequelize[_0x9490('0x2')](_0x9490('0x3')),'defaultValue':_0x9490('0x3')},'password':{'type':Sequelize[_0x9490('0x1')]},'consumerKey':{'type':Sequelize[_0x9490('0x1')]},'consumerSecret':{'type':Sequelize[_0x9490('0x1')]},'token':{'type':Sequelize[_0x9490('0x1')]},'tokenSecret':{'type':Sequelize[_0x9490('0x1')]},'serverUrl':{'type':Sequelize['STRING']},'type':{'type':Sequelize[_0x9490('0x2')](_0x9490('0x4'),'newTab'),'defaultValue':_0x9490('0x4')}}; \ No newline at end of file diff --git a/server/api/intDeskAccount/intDeskAccount.controller.js b/server/api/intDeskAccount/intDeskAccount.controller.js index 1009ff3..1df737f 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 _0x7e47=['order','sort','where','filter','merge','VIRTUAL','then','includeAll','include','findAll','rows','show','params','create','body','find','getConfigurations','findOne','DeskConfiguration','pick','options','limit','addConfiguration','AccountId','Subjects','channel','Descriptions','getDescriptions','DeskField','getFields','priority','remoteUri','authType','password','consumerKey','consumerSecret','tokenSecret','substring','GET','%s/custom_fields','application/json','headers','format','%s:%s','username','base64','_embedded','active','label','statusCode','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','util','sox','to-csv','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../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','info','DeskAccount,\x20%s,\x20%s','DeskAccount,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','sendStatus','status','end','json','count','offset','set','Content-Range','apply','reject','save','update','destroy','stack','name','send','map','DeskAccount','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit'];(function(_0x4001df,_0x58d72f){var _0xa2fbec=function(_0x50d98f){while(--_0x50d98f){_0x4001df['push'](_0x4001df['shift']());}};_0xa2fbec(++_0x58d72f);}(_0x7e47,0x19d));var _0x77e4=function(_0x820ac7,_0x3f4ce6){_0x820ac7=_0x820ac7-0x0;var _0x26f9f8=_0x7e47[_0x820ac7];return _0x26f9f8;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x77e4('0x0'));var rimraf=require(_0x77e4('0x1'));var zipdir=require(_0x77e4('0x2'));var jsonpatch=require(_0x77e4('0x3'));var rp=require(_0x77e4('0x4'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x77e4('0x5'));var path=require('path');var sox=require(_0x77e4('0x6'));var csv=require(_0x77e4('0x7'));var ejs=require('ejs');var fs=require('fs');var _=require('lodash');var squel=require(_0x77e4('0x8'));var crypto=require(_0x77e4('0x9'));var jsforce=require(_0x77e4('0xa'));var deskjs=require(_0x77e4('0xb'));var toCsv=require('to-csv');var querystring=require(_0x77e4('0xc'));var Papa=require(_0x77e4('0xd'));var Redis=require('ioredis');var authService=require(_0x77e4('0xe'));var qs=require(_0x77e4('0xf'));var as=require(_0x77e4('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x77e4('0x11'));var utils=require('../../config/utils');var config=require(_0x77e4('0x12'));var db=require(_0x77e4('0x13'))['db'];var integrations=require(_0x77e4('0x14'));var jayson=require(_0x77e4('0x15'));var client=jayson[_0x77e4('0x16')][_0x77e4('0x17')]({'port':0x232a});function checkPasswordPattern(_0x4ef98d,_0x11f6fa,_0x116a8e){if(_0x116a8e){var _0x593813=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x593813[_0x77e4('0x18')](_0x11f6fa)){return _0x4ef98d;}else{throw new db[(_0x77e4('0x19'))][(_0x77e4('0x1a'))](_0x77e4('0x1b'));}}else{return _0x4ef98d;}}function respondWithRpcPromise(_0x324d59,_0x4cf44a,_0x6a3513,_0x5b79cb){return new BPromise(function(_0x5ecc4f,_0x434a93){var _0x2ec7de=_0x5b79cb||client;return _0x2ec7de[_0x77e4('0x1c')](_0x324d59,_0x6a3513)['then'](function(_0x544872){logger[_0x77e4('0x1d')](_0x77e4('0x1e'),_0x4cf44a,'request\x20sent');logger['debug'](_0x77e4('0x1f'),_0x4cf44a,_0x77e4('0x20'),JSON[_0x77e4('0x21')](_0x544872));if(_0x544872['error']){if(_0x544872[_0x77e4('0x22')][_0x77e4('0x23')]===0x1f4){logger[_0x77e4('0x22')](_0x77e4('0x1e'),_0x4cf44a,_0x544872[_0x77e4('0x22')][_0x77e4('0x24')]);return _0x434a93(_0x544872[_0x77e4('0x22')][_0x77e4('0x24')]);}logger['error']('DeskAccount,\x20%s,\x20%s',_0x4cf44a,_0x544872[_0x77e4('0x22')][_0x77e4('0x24')]);return _0x5ecc4f(_0x544872[_0x77e4('0x22')][_0x77e4('0x24')]);}else{logger['info']('DeskAccount,\x20%s,\x20%s',_0x4cf44a,_0x77e4('0x20'));_0x5ecc4f(_0x544872[_0x77e4('0x25')][_0x77e4('0x24')]);}})[_0x77e4('0x26')](function(_0x1b4ea7){logger['error'](_0x77e4('0x1e'),_0x4cf44a,_0x1b4ea7);_0x434a93(_0x1b4ea7);});});}function respondWithStatusCode(_0x5e8fa5,_0x2f2b13){_0x2f2b13=_0x2f2b13||0xcc;return function(_0x41959c){if(_0x41959c){return _0x5e8fa5[_0x77e4('0x27')](_0x2f2b13);}return _0x5e8fa5[_0x77e4('0x28')](_0x2f2b13)[_0x77e4('0x29')]();};}function respondWithResult(_0x1fa766,_0x36f1de){_0x36f1de=_0x36f1de||0xc8;return function(_0xdc5f78){if(_0xdc5f78){return _0x1fa766['status'](_0x36f1de)[_0x77e4('0x2a')](_0xdc5f78);}};}function respondWithFilteredResult(_0x4184db,_0x5c5b0b){return function(_0x3b97c5){if(_0x3b97c5){var _0x79ef32=_0x3b97c5[_0x77e4('0x2b')],_0x54ba9e=_0x5c5b0b[_0x77e4('0x2c')],_0x356c47=_0x5c5b0b[_0x77e4('0x2c')]+_0x5c5b0b['limit'],_0x32ab48;if(_0x356c47>=_0x79ef32){_0x356c47=_0x79ef32;_0x32ab48=0xc8;}else{_0x32ab48=0xce;}_0x4184db[_0x77e4('0x28')](_0x32ab48);return _0x4184db[_0x77e4('0x2d')](_0x77e4('0x2e'),_0x54ba9e+'-'+_0x356c47+'/'+_0x79ef32)[_0x77e4('0x2a')](_0x3b97c5);}return null;};}function patchUpdates(_0xe1fa82){return function(_0x45cc63){try{jsonpatch[_0x77e4('0x2f')](_0x45cc63,_0xe1fa82,!![]);}catch(_0x19ecad){return BPromise[_0x77e4('0x30')](_0x19ecad);}return _0x45cc63[_0x77e4('0x31')]();};}function saveUpdates(_0x4d2598,_0x18e86c){return function(_0x3b99a5){if(_0x3b99a5){return _0x3b99a5[_0x77e4('0x32')](_0x4d2598)['then'](function(_0x3755b9){return _0x3755b9;});}return null;};}function removeEntity(_0x5e92e5,_0x4d4a6d){return function(_0x2da8a2){if(_0x2da8a2){return _0x2da8a2[_0x77e4('0x33')]()['then'](function(){_0x5e92e5[_0x77e4('0x28')](0xcc)[_0x77e4('0x29')]();});}};}function handleEntityNotFound(_0xc5ce74,_0x535636){return function(_0x2b8874){if(!_0x2b8874){_0xc5ce74[_0x77e4('0x27')](0x194);}return _0x2b8874;};}function handleError(_0x2b01d1,_0x242f24){_0x242f24=_0x242f24||0x1f4;return function(_0x3a3cef){logger['error'](_0x3a3cef[_0x77e4('0x34')]);if(_0x3a3cef['name']){delete _0x3a3cef[_0x77e4('0x35')];}_0x2b01d1[_0x77e4('0x28')](_0x242f24)[_0x77e4('0x36')](_0x3a3cef);};}exports['index']=function(_0x40ee48,_0x5a461f){var _0x4322bd={},_0x4bb947={},_0x3b6b3a={'count':0x0,'rows':[]};var _0x58d59e=_[_0x77e4('0x37')](db[_0x77e4('0x38')][_0x77e4('0x39')],function(_0x5b7dad){return{'name':_0x5b7dad[_0x77e4('0x3a')],'type':_0x5b7dad[_0x77e4('0x3b')][_0x77e4('0x3c')]};});_0x4bb947[_0x77e4('0x3d')]=_[_0x77e4('0x37')](_0x58d59e,'name');_0x4bb947[_0x77e4('0x3e')]=_[_0x77e4('0x3f')](_0x40ee48[_0x77e4('0x3e')]);_0x4bb947[_0x77e4('0x40')]=_[_0x77e4('0x41')](_0x4bb947[_0x77e4('0x3d')],_0x4bb947[_0x77e4('0x3e')]);_0x4322bd[_0x77e4('0x42')]=_[_0x77e4('0x41')](_0x4bb947[_0x77e4('0x3d')],qs[_0x77e4('0x43')](_0x40ee48[_0x77e4('0x3e')]['fields']));_0x4322bd[_0x77e4('0x42')]=_0x4322bd[_0x77e4('0x42')][_0x77e4('0x44')]?_0x4322bd[_0x77e4('0x42')]:_0x4bb947[_0x77e4('0x3d')];if(!_0x40ee48[_0x77e4('0x3e')][_0x77e4('0x45')](_0x77e4('0x46'))){_0x4322bd['limit']=qs['limit'](_0x40ee48[_0x77e4('0x3e')]['limit']);_0x4322bd['offset']=qs[_0x77e4('0x2c')](_0x40ee48[_0x77e4('0x3e')][_0x77e4('0x2c')]);}_0x4322bd[_0x77e4('0x47')]=qs[_0x77e4('0x48')](_0x40ee48[_0x77e4('0x3e')][_0x77e4('0x48')]);_0x4322bd[_0x77e4('0x49')]=qs[_0x77e4('0x40')](_['pick'](_0x40ee48[_0x77e4('0x3e')],_0x4bb947[_0x77e4('0x40')]));if(_0x40ee48[_0x77e4('0x3e')][_0x77e4('0x4a')]){_0x4322bd['where']=_[_0x77e4('0x4b')](_0x4322bd['where'],{'$or':_['map'](_0x58d59e,function(_0x259bc9){if(_0x259bc9['type']!==_0x77e4('0x4c')){var _0x510e07={};_0x510e07[_0x259bc9[_0x77e4('0x35')]]={'$like':'%'+_0x40ee48[_0x77e4('0x3e')][_0x77e4('0x4a')]+'%'};return _0x510e07;}})});}_0x4322bd=_['merge']({},_0x4322bd,_0x40ee48['options']);var _0x559fb9={'where':_0x4322bd[_0x77e4('0x49')]};return db[_0x77e4('0x38')]['count'](_0x559fb9)[_0x77e4('0x4d')](function(_0x465fb2){_0x3b6b3a['count']=_0x465fb2;if(_0x40ee48[_0x77e4('0x3e')][_0x77e4('0x4e')]){_0x4322bd[_0x77e4('0x4f')]=[{'all':!![]}];}return db[_0x77e4('0x38')][_0x77e4('0x50')](_0x4322bd);})['then'](function(_0x5a62a6){_0x3b6b3a[_0x77e4('0x51')]=_0x5a62a6;return _0x3b6b3a;})['then'](respondWithFilteredResult(_0x5a461f,_0x4322bd))[_0x77e4('0x26')](handleError(_0x5a461f,null));};exports[_0x77e4('0x52')]=function(_0x3d3bbb,_0x43e94a){var _0x85d56c={'raw':![],'where':{'id':_0x3d3bbb[_0x77e4('0x53')]['id']}},_0x5abed8={};_0x5abed8['model']=_['keys'](db[_0x77e4('0x38')][_0x77e4('0x39')]);_0x5abed8[_0x77e4('0x3e')]=_['keys'](_0x3d3bbb[_0x77e4('0x3e')]);_0x5abed8[_0x77e4('0x40')]=_['intersection'](_0x5abed8[_0x77e4('0x3d')],_0x5abed8[_0x77e4('0x3e')]);_0x85d56c['attributes']=_[_0x77e4('0x41')](_0x5abed8[_0x77e4('0x3d')],qs[_0x77e4('0x43')](_0x3d3bbb[_0x77e4('0x3e')]['fields']));_0x85d56c[_0x77e4('0x42')]=_0x85d56c['attributes'][_0x77e4('0x44')]?_0x85d56c[_0x77e4('0x42')]:_0x5abed8[_0x77e4('0x3d')];if(_0x3d3bbb[_0x77e4('0x3e')][_0x77e4('0x4e')]){_0x85d56c[_0x77e4('0x4f')]=[{'all':!![]}];}_0x85d56c=_[_0x77e4('0x4b')]({},_0x85d56c,_0x3d3bbb['options']);return db[_0x77e4('0x38')]['find'](_0x85d56c)[_0x77e4('0x4d')](handleEntityNotFound(_0x43e94a,null))['then'](respondWithResult(_0x43e94a,null))[_0x77e4('0x26')](handleError(_0x43e94a,null));};exports[_0x77e4('0x54')]=function(_0x47852b,_0x3c86a2){return db['DeskAccount'][_0x77e4('0x54')](_0x47852b[_0x77e4('0x55')],{})[_0x77e4('0x4d')](respondWithResult(_0x3c86a2,0xc9))['catch'](handleError(_0x3c86a2,null));};exports[_0x77e4('0x32')]=function(_0xc3c467,_0x1fe630){if(_0xc3c467[_0x77e4('0x55')]['id']){delete _0xc3c467['body']['id'];}return db[_0x77e4('0x38')][_0x77e4('0x56')]({'where':{'id':_0xc3c467[_0x77e4('0x53')]['id']}})[_0x77e4('0x4d')](handleEntityNotFound(_0x1fe630,null))['then'](saveUpdates(_0xc3c467[_0x77e4('0x55')],null))[_0x77e4('0x4d')](respondWithResult(_0x1fe630,null))[_0x77e4('0x26')](handleError(_0x1fe630,null));};exports[_0x77e4('0x33')]=function(_0x9318cf,_0x45a416){return db[_0x77e4('0x38')]['find']({'where':{'id':_0x9318cf['params']['id']}})[_0x77e4('0x4d')](handleEntityNotFound(_0x45a416,null))[_0x77e4('0x4d')](removeEntity(_0x45a416,null))['catch'](handleError(_0x45a416,null));};exports[_0x77e4('0x57')]=function(_0xf7c323,_0x1ca05d,_0x47721b){var _0x34386e={};var _0x1aa7bc={};var _0xe7f168;var _0x5b6b18;return db[_0x77e4('0x38')][_0x77e4('0x58')]({'where':{'id':_0xf7c323['params']['id']}})[_0x77e4('0x4d')](handleEntityNotFound(_0x1ca05d,null))[_0x77e4('0x4d')](function(_0x305661){if(_0x305661){_0xe7f168=_0x305661;_0x1aa7bc[_0x77e4('0x3d')]=_[_0x77e4('0x3f')](db[_0x77e4('0x59')][_0x77e4('0x39')]);_0x1aa7bc[_0x77e4('0x3e')]=_['keys'](_0xf7c323[_0x77e4('0x3e')]);_0x1aa7bc[_0x77e4('0x40')]=_[_0x77e4('0x41')](_0x1aa7bc[_0x77e4('0x3d')],_0x1aa7bc[_0x77e4('0x3e')]);_0x34386e[_0x77e4('0x42')]=_[_0x77e4('0x41')](_0x1aa7bc[_0x77e4('0x3d')],qs[_0x77e4('0x43')](_0xf7c323[_0x77e4('0x3e')][_0x77e4('0x43')]));_0x34386e[_0x77e4('0x42')]=_0x34386e[_0x77e4('0x42')]['length']?_0x34386e[_0x77e4('0x42')]:_0x1aa7bc['model'];_0x34386e[_0x77e4('0x47')]=qs[_0x77e4('0x48')](_0xf7c323['query'][_0x77e4('0x48')]);_0x34386e[_0x77e4('0x49')]=qs[_0x77e4('0x40')](_[_0x77e4('0x5a')](_0xf7c323[_0x77e4('0x3e')],_0x1aa7bc[_0x77e4('0x40')]));if(_0xf7c323[_0x77e4('0x3e')][_0x77e4('0x4a')]){_0x34386e[_0x77e4('0x49')]=_[_0x77e4('0x4b')](_0x34386e[_0x77e4('0x49')],{'$or':_[_0x77e4('0x37')](_0x34386e[_0x77e4('0x42')],function(_0xd8c27a){var _0xcbf39={};_0xcbf39[_0xd8c27a]={'$like':'%'+_0xf7c323[_0x77e4('0x3e')]['filter']+'%'};return _0xcbf39;})});}_0x34386e=_['merge']({},_0x34386e,_0xf7c323[_0x77e4('0x5b')]);return _0xe7f168['getConfigurations'](_0x34386e);}})[_0x77e4('0x4d')](function(_0xee18f1){if(_0xee18f1){_0x5b6b18=_0xee18f1[_0x77e4('0x44')];if(!_0xf7c323[_0x77e4('0x3e')][_0x77e4('0x45')]('nolimit')){_0x34386e[_0x77e4('0x5c')]=qs[_0x77e4('0x5c')](_0xf7c323[_0x77e4('0x3e')]['limit']);_0x34386e[_0x77e4('0x2c')]=qs[_0x77e4('0x2c')](_0xf7c323['query'][_0x77e4('0x2c')]);}return _0xe7f168['getConfigurations'](_0x34386e);}})['then'](function(_0x226a13){if(_0x226a13){return _0x226a13?{'count':_0x5b6b18,'rows':_0x226a13}:null;}})[_0x77e4('0x4d')](respondWithResult(_0x1ca05d,null))[_0x77e4('0x26')](handleError(_0x1ca05d,null));};exports[_0x77e4('0x5d')]=function(_0x26e20d,_0x259025,_0x446821){if(_0x26e20d[_0x77e4('0x55')]['id']){delete _0x26e20d[_0x77e4('0x55')]['id'];}return db[_0x77e4('0x38')][_0x77e4('0x58')]({'where':{'id':_0x26e20d['params']['id']}})[_0x77e4('0x4d')](handleEntityNotFound(_0x259025,null))[_0x77e4('0x4d')](function(_0x45d42b){if(_0x45d42b){_0x26e20d[_0x77e4('0x55')][_0x77e4('0x5e')]=_0x45d42b['id'];_0x26e20d[_0x77e4('0x55')][_0x77e4('0x5f')]=integrations['getSubjects'](_0x26e20d['body'][_0x77e4('0x60')],_0x26e20d[_0x77e4('0x55')][_0x77e4('0x3b')]);_0x26e20d['body'][_0x77e4('0x61')]=integrations[_0x77e4('0x62')](_0x26e20d[_0x77e4('0x55')][_0x77e4('0x60')],_0x26e20d[_0x77e4('0x55')][_0x77e4('0x3b')]);return db[_0x77e4('0x59')][_0x77e4('0x54')](_0x26e20d[_0x77e4('0x55')],{'include':[{'model':db[_0x77e4('0x63')],'as':'Subjects'},{'model':db[_0x77e4('0x63')],'as':'Descriptions'}]});}return null;})[_0x77e4('0x4d')](respondWithResult(_0x259025,null))[_0x77e4('0x26')](handleError(_0x259025,null));};exports[_0x77e4('0x64')]=function(_0x24e52d,_0x24ac05,_0x33ecc3){var _0x5e4036=[{'name':_0x77e4('0x65'),'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 _0x36bd6b='';return db[_0x77e4('0x38')]['findOne']({'where':{'id':_0x24e52d['params']['id']},'attributes':['id',_0x77e4('0x66'),_0x77e4('0x67'),'username',_0x77e4('0x68'),_0x77e4('0x69'),_0x77e4('0x6a'),'token',_0x77e4('0x6b')]})[_0x77e4('0x4d')](handleEntityNotFound(_0x24ac05,null))[_0x77e4('0x4d')](function(_0x16b7c1){if(_0x16b7c1){_0x36bd6b=_0x16b7c1['remoteUri'];var _0x48c35f=_0x36bd6b['slice'](-0x1);if(_0x48c35f==='/'){_0x36bd6b=_0x36bd6b[_0x77e4('0x6c')](0x0,_0x36bd6b['lastIndexOf'](_0x48c35f));}var _0x44c02e={'method':_0x77e4('0x6d'),'uri':util['format'](_0x77e4('0x6e'),_0x36bd6b),'headers':{'Content-Type':_0x77e4('0x6f'),'Accept':_0x77e4('0x6f')},'json':!![]};if(_0x16b7c1[_0x77e4('0x67')]==='basic'){_0x44c02e[_0x77e4('0x70')]['Authorization']=util[_0x77e4('0x71')]('Basic\x20%s',new Buffer(util[_0x77e4('0x71')](_0x77e4('0x72'),_0x16b7c1[_0x77e4('0x73')],_0x16b7c1[_0x77e4('0x68')]))['toString'](_0x77e4('0x74')));}return rp(_0x44c02e)[_0x77e4('0x4d')](function(_0x3eca02){return _0x5e4036['concat'](_['map'](_0x3eca02[_0x77e4('0x75')]['entries'],function(_0x360a08){return{'id':_0x360a08[_0x77e4('0x35')],'name':_0x360a08[_0x77e4('0x35')],'type':_0x360a08[_0x77e4('0x3b')],'active':_0x360a08[_0x77e4('0x76')],'label':_0x360a08[_0x77e4('0x77')],'custom':!![]};}));});}})[_0x77e4('0x4d')](function(_0x3c7e19){return{'count':_0x3c7e19[_0x77e4('0x44')],'rows':_0x3c7e19};})[_0x77e4('0x4d')](respondWithResult(_0x24ac05,null))[_0x77e4('0x26')](function(_0x1a5fe7){var _0x381c70=_0x24e52d['query']['test']?0x1f4:_0x1a5fe7[_0x77e4('0x78')]||0x1f4;logger[_0x77e4('0x22')]('getFields,\x20%s,\x20%s,\x20%s',_0x77e4('0x64'),_0x381c70,JSON[_0x77e4('0x21')](_0x1a5fe7));delete _0x1a5fe7[_0x77e4('0x35')];if(_0x381c70===0x191){_0x381c70=0x190;}_0x24ac05[_0x77e4('0x28')](_0x381c70)['send'](_0x24e52d['query'][_0x77e4('0x18')]?{'message':'Wrong\x20credentials','statusCode':_0x1a5fe7['statusCode']}:_0x1a5fe7);});}; \ No newline at end of file +var _0x6093=['headers','format','Basic\x20%s','password','toString','concat','entries','active','label','statusCode','getFields,\x20%s,\x20%s,\x20%s','getFields','Wrong\x20credentials','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','util','path','sox','to-csv','lodash','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../mysqldb','../../components/integrations/configuration','jayson/promise','client','test','Sequelize','ValidationError','The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.','request','then','DeskAccount,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','catch','sendStatus','status','json','count','offset','set','Content-Range','apply','reject','save','update','destroy','end','stack','name','send','index','map','rawAttributes','fieldName','query','keys','filters','attributes','intersection','model','fields','hasOwnProperty','nolimit','limit','order','sort','where','pick','filter','type','VIRTUAL','merge','options','DeskAccount','findAll','rows','length','includeAll','include','find','create','body','params','getConfigurations','findOne','DeskConfiguration','AccountId','Subjects','getSubjects','channel','getDescriptions','DeskField','priority','remoteUri','authType','username','consumerKey','token','tokenSecret','slice','%s/custom_fields','application/json','basic'];(function(_0x4f3cfd,_0x500e7c){var _0xe0f636=function(_0x18fb5a){while(--_0x18fb5a){_0x4f3cfd['push'](_0x4f3cfd['shift']());}};_0xe0f636(++_0x500e7c);}(_0x6093,0x107));var _0x3609=function(_0x17ff10,_0x96c2fc){_0x17ff10=_0x17ff10-0x0;var _0x1f934d=_0x6093[_0x17ff10];return _0x1f934d;};'use strict';var pdf=require(_0x3609('0x0'));var emlformat=require(_0x3609('0x1'));var rimraf=require(_0x3609('0x2'));var zipdir=require(_0x3609('0x3'));var jsonpatch=require(_0x3609('0x4'));var rp=require(_0x3609('0x5'));var moment=require(_0x3609('0x6'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x3609('0x7'));var path=require(_0x3609('0x8'));var sox=require(_0x3609('0x9'));var csv=require(_0x3609('0xa'));var ejs=require('ejs');var fs=require('fs');var _=require(_0x3609('0xb'));var squel=require(_0x3609('0xc'));var crypto=require(_0x3609('0xd'));var jsforce=require('jsforce');var deskjs=require(_0x3609('0xe'));var toCsv=require(_0x3609('0xa'));var querystring=require(_0x3609('0xf'));var Papa=require(_0x3609('0x10'));var Redis=require(_0x3609('0x11'));var authService=require(_0x3609('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0x3609('0x13'));var hardwareService=require(_0x3609('0x14'));var logger=require(_0x3609('0x15'))(_0x3609('0x16'));var utils=require('../../config/utils');var config=require(_0x3609('0x17'));var db=require(_0x3609('0x18'))['db'];var integrations=require(_0x3609('0x19'));var jayson=require(_0x3609('0x1a'));var client=jayson[_0x3609('0x1b')]['http']({'port':0x232a});function checkPasswordPattern(_0x50815f,_0x4b339b,_0xb0bc29){if(_0xb0bc29){var _0x68b346=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x68b346[_0x3609('0x1c')](_0x4b339b)){return _0x50815f;}else{throw new db[(_0x3609('0x1d'))][(_0x3609('0x1e'))](_0x3609('0x1f'));}}else{return _0x50815f;}}function respondWithRpcPromise(_0x2d875f,_0x1c53f6,_0x51a27c,_0x4aae0a){return new BPromise(function(_0x34fb17,_0x22a075){var _0x5e32c4=_0x4aae0a||client;return _0x5e32c4[_0x3609('0x20')](_0x2d875f,_0x51a27c)[_0x3609('0x21')](function(_0x29af63){logger['info'](_0x3609('0x22'),_0x1c53f6,_0x3609('0x23'));logger[_0x3609('0x24')]('DeskAccount,\x20%s,\x20%s,\x20%s',_0x1c53f6,_0x3609('0x23'),JSON[_0x3609('0x25')](_0x29af63));if(_0x29af63[_0x3609('0x26')]){if(_0x29af63[_0x3609('0x26')][_0x3609('0x27')]===0x1f4){logger[_0x3609('0x26')](_0x3609('0x22'),_0x1c53f6,_0x29af63[_0x3609('0x26')][_0x3609('0x28')]);return _0x22a075(_0x29af63[_0x3609('0x26')][_0x3609('0x28')]);}logger[_0x3609('0x26')](_0x3609('0x22'),_0x1c53f6,_0x29af63[_0x3609('0x26')]['message']);return _0x34fb17(_0x29af63[_0x3609('0x26')][_0x3609('0x28')]);}else{logger['info'](_0x3609('0x22'),_0x1c53f6,_0x3609('0x23'));_0x34fb17(_0x29af63[_0x3609('0x29')][_0x3609('0x28')]);}})[_0x3609('0x2a')](function(_0x5430a8){logger[_0x3609('0x26')]('DeskAccount,\x20%s,\x20%s',_0x1c53f6,_0x5430a8);_0x22a075(_0x5430a8);});});}function respondWithStatusCode(_0x4a7f51,_0xc7978b){_0xc7978b=_0xc7978b||0xcc;return function(_0x2e7c5f){if(_0x2e7c5f){return _0x4a7f51[_0x3609('0x2b')](_0xc7978b);}return _0x4a7f51['status'](_0xc7978b)['end']();};}function respondWithResult(_0xfb6ac,_0x28beee){_0x28beee=_0x28beee||0xc8;return function(_0x14f26a){if(_0x14f26a){return _0xfb6ac[_0x3609('0x2c')](_0x28beee)[_0x3609('0x2d')](_0x14f26a);}};}function respondWithFilteredResult(_0x34dc2a,_0x4d8a08){return function(_0x52c7e5){if(_0x52c7e5){var _0x443f5d=_0x52c7e5[_0x3609('0x2e')],_0x4d40b0=_0x4d8a08['offset'],_0x53880b=_0x4d8a08[_0x3609('0x2f')]+_0x4d8a08['limit'],_0x52bd2a;if(_0x53880b>=_0x443f5d){_0x53880b=_0x443f5d;_0x52bd2a=0xc8;}else{_0x52bd2a=0xce;}_0x34dc2a[_0x3609('0x2c')](_0x52bd2a);return _0x34dc2a[_0x3609('0x30')](_0x3609('0x31'),_0x4d40b0+'-'+_0x53880b+'/'+_0x443f5d)[_0x3609('0x2d')](_0x52c7e5);}return null;};}function patchUpdates(_0x54d3fd){return function(_0x3e72f0){try{jsonpatch[_0x3609('0x32')](_0x3e72f0,_0x54d3fd,!![]);}catch(_0x491e30){return BPromise[_0x3609('0x33')](_0x491e30);}return _0x3e72f0[_0x3609('0x34')]();};}function saveUpdates(_0x43fc05,_0x48e549){return function(_0x1eb025){if(_0x1eb025){return _0x1eb025[_0x3609('0x35')](_0x43fc05)[_0x3609('0x21')](function(_0xdee081){return _0xdee081;});}return null;};}function removeEntity(_0x78e9d1,_0x2ec056){return function(_0x52c8d8){if(_0x52c8d8){return _0x52c8d8[_0x3609('0x36')]()['then'](function(){_0x78e9d1[_0x3609('0x2c')](0xcc)[_0x3609('0x37')]();});}};}function handleEntityNotFound(_0x46e3e5,_0x41989e){return function(_0x47e39f){if(!_0x47e39f){_0x46e3e5[_0x3609('0x2b')](0x194);}return _0x47e39f;};}function handleError(_0x4433af,_0x387de0){_0x387de0=_0x387de0||0x1f4;return function(_0x5153d5){logger[_0x3609('0x26')](_0x5153d5[_0x3609('0x38')]);if(_0x5153d5[_0x3609('0x39')]){delete _0x5153d5[_0x3609('0x39')];}_0x4433af[_0x3609('0x2c')](_0x387de0)[_0x3609('0x3a')](_0x5153d5);};}exports[_0x3609('0x3b')]=function(_0x4a030d,_0x37f1e6){var _0x27aaa8={},_0x4548fd={},_0x23ca59={'count':0x0,'rows':[]};var _0x32bfd2=_[_0x3609('0x3c')](db['DeskAccount'][_0x3609('0x3d')],function(_0x5de8a5){return{'name':_0x5de8a5[_0x3609('0x3e')],'type':_0x5de8a5['type']['key']};});_0x4548fd['model']=_[_0x3609('0x3c')](_0x32bfd2,_0x3609('0x39'));_0x4548fd[_0x3609('0x3f')]=_[_0x3609('0x40')](_0x4a030d[_0x3609('0x3f')]);_0x4548fd[_0x3609('0x41')]=_['intersection'](_0x4548fd['model'],_0x4548fd[_0x3609('0x3f')]);_0x27aaa8[_0x3609('0x42')]=_[_0x3609('0x43')](_0x4548fd[_0x3609('0x44')],qs[_0x3609('0x45')](_0x4a030d[_0x3609('0x3f')][_0x3609('0x45')]));_0x27aaa8['attributes']=_0x27aaa8[_0x3609('0x42')]['length']?_0x27aaa8['attributes']:_0x4548fd[_0x3609('0x44')];if(!_0x4a030d[_0x3609('0x3f')][_0x3609('0x46')](_0x3609('0x47'))){_0x27aaa8[_0x3609('0x48')]=qs[_0x3609('0x48')](_0x4a030d[_0x3609('0x3f')][_0x3609('0x48')]);_0x27aaa8['offset']=qs[_0x3609('0x2f')](_0x4a030d[_0x3609('0x3f')]['offset']);}_0x27aaa8[_0x3609('0x49')]=qs[_0x3609('0x4a')](_0x4a030d['query'][_0x3609('0x4a')]);_0x27aaa8[_0x3609('0x4b')]=qs[_0x3609('0x41')](_[_0x3609('0x4c')](_0x4a030d[_0x3609('0x3f')],_0x4548fd[_0x3609('0x41')]));if(_0x4a030d[_0x3609('0x3f')][_0x3609('0x4d')]){_0x27aaa8[_0x3609('0x4b')]=_['merge'](_0x27aaa8[_0x3609('0x4b')],{'$or':_[_0x3609('0x3c')](_0x32bfd2,function(_0x3c4bf0){if(_0x3c4bf0[_0x3609('0x4e')]!==_0x3609('0x4f')){var _0x26f2ef={};_0x26f2ef[_0x3c4bf0[_0x3609('0x39')]]={'$like':'%'+_0x4a030d[_0x3609('0x3f')]['filter']+'%'};return _0x26f2ef;}})});}_0x27aaa8=_[_0x3609('0x50')]({},_0x27aaa8,_0x4a030d[_0x3609('0x51')]);var _0x1e933b={'where':_0x27aaa8[_0x3609('0x4b')]};return db[_0x3609('0x52')][_0x3609('0x2e')](_0x1e933b)['then'](function(_0x2f3e72){_0x23ca59[_0x3609('0x2e')]=_0x2f3e72;if(_0x4a030d[_0x3609('0x3f')]['includeAll']){_0x27aaa8['include']=[{'all':!![]}];}return db['DeskAccount'][_0x3609('0x53')](_0x27aaa8);})[_0x3609('0x21')](function(_0x16d4bc){_0x23ca59[_0x3609('0x54')]=_0x16d4bc;return _0x23ca59;})[_0x3609('0x21')](respondWithFilteredResult(_0x37f1e6,_0x27aaa8))[_0x3609('0x2a')](handleError(_0x37f1e6,null));};exports['show']=function(_0x3ee546,_0x5217cf){var _0x15a332={'raw':![],'where':{'id':_0x3ee546['params']['id']}},_0x38f2e0={};_0x38f2e0[_0x3609('0x44')]=_[_0x3609('0x40')](db['DeskAccount'][_0x3609('0x3d')]);_0x38f2e0['query']=_[_0x3609('0x40')](_0x3ee546['query']);_0x38f2e0[_0x3609('0x41')]=_['intersection'](_0x38f2e0[_0x3609('0x44')],_0x38f2e0[_0x3609('0x3f')]);_0x15a332[_0x3609('0x42')]=_[_0x3609('0x43')](_0x38f2e0[_0x3609('0x44')],qs['fields'](_0x3ee546[_0x3609('0x3f')][_0x3609('0x45')]));_0x15a332[_0x3609('0x42')]=_0x15a332['attributes'][_0x3609('0x55')]?_0x15a332['attributes']:_0x38f2e0['model'];if(_0x3ee546[_0x3609('0x3f')][_0x3609('0x56')]){_0x15a332[_0x3609('0x57')]=[{'all':!![]}];}_0x15a332=_['merge']({},_0x15a332,_0x3ee546[_0x3609('0x51')]);return db[_0x3609('0x52')][_0x3609('0x58')](_0x15a332)[_0x3609('0x21')](handleEntityNotFound(_0x5217cf,null))['then'](respondWithResult(_0x5217cf,null))[_0x3609('0x2a')](handleError(_0x5217cf,null));};exports[_0x3609('0x59')]=function(_0x3d283d,_0x5365f4){return db[_0x3609('0x52')][_0x3609('0x59')](_0x3d283d[_0x3609('0x5a')],{})[_0x3609('0x21')](respondWithResult(_0x5365f4,0xc9))['catch'](handleError(_0x5365f4,null));};exports[_0x3609('0x35')]=function(_0xfc5c2d,_0x1145d7){if(_0xfc5c2d['body']['id']){delete _0xfc5c2d[_0x3609('0x5a')]['id'];}return db[_0x3609('0x52')]['find']({'where':{'id':_0xfc5c2d[_0x3609('0x5b')]['id']}})[_0x3609('0x21')](handleEntityNotFound(_0x1145d7,null))[_0x3609('0x21')](saveUpdates(_0xfc5c2d[_0x3609('0x5a')],null))[_0x3609('0x21')](respondWithResult(_0x1145d7,null))['catch'](handleError(_0x1145d7,null));};exports[_0x3609('0x36')]=function(_0xab1926,_0x494216){return db[_0x3609('0x52')]['find']({'where':{'id':_0xab1926[_0x3609('0x5b')]['id']}})['then'](handleEntityNotFound(_0x494216,null))['then'](removeEntity(_0x494216,null))[_0x3609('0x2a')](handleError(_0x494216,null));};exports[_0x3609('0x5c')]=function(_0x4c9a04,_0x48c0ce,_0x2a1504){var _0xaff0b1={};var _0x3e9068={};var _0x4b1c7d;var _0xc8b666;return db[_0x3609('0x52')][_0x3609('0x5d')]({'where':{'id':_0x4c9a04[_0x3609('0x5b')]['id']}})[_0x3609('0x21')](handleEntityNotFound(_0x48c0ce,null))[_0x3609('0x21')](function(_0x1365c4){if(_0x1365c4){_0x4b1c7d=_0x1365c4;_0x3e9068[_0x3609('0x44')]=_[_0x3609('0x40')](db[_0x3609('0x5e')][_0x3609('0x3d')]);_0x3e9068['query']=_[_0x3609('0x40')](_0x4c9a04['query']);_0x3e9068[_0x3609('0x41')]=_[_0x3609('0x43')](_0x3e9068[_0x3609('0x44')],_0x3e9068['query']);_0xaff0b1[_0x3609('0x42')]=_[_0x3609('0x43')](_0x3e9068[_0x3609('0x44')],qs[_0x3609('0x45')](_0x4c9a04['query'][_0x3609('0x45')]));_0xaff0b1[_0x3609('0x42')]=_0xaff0b1[_0x3609('0x42')][_0x3609('0x55')]?_0xaff0b1['attributes']:_0x3e9068[_0x3609('0x44')];_0xaff0b1['order']=qs['sort'](_0x4c9a04[_0x3609('0x3f')][_0x3609('0x4a')]);_0xaff0b1[_0x3609('0x4b')]=qs[_0x3609('0x41')](_[_0x3609('0x4c')](_0x4c9a04[_0x3609('0x3f')],_0x3e9068['filters']));if(_0x4c9a04['query'][_0x3609('0x4d')]){_0xaff0b1['where']=_['merge'](_0xaff0b1['where'],{'$or':_[_0x3609('0x3c')](_0xaff0b1[_0x3609('0x42')],function(_0x226499){var _0x3caf17={};_0x3caf17[_0x226499]={'$like':'%'+_0x4c9a04[_0x3609('0x3f')][_0x3609('0x4d')]+'%'};return _0x3caf17;})});}_0xaff0b1=_[_0x3609('0x50')]({},_0xaff0b1,_0x4c9a04[_0x3609('0x51')]);return _0x4b1c7d[_0x3609('0x5c')](_0xaff0b1);}})[_0x3609('0x21')](function(_0x51d747){if(_0x51d747){_0xc8b666=_0x51d747[_0x3609('0x55')];if(!_0x4c9a04[_0x3609('0x3f')][_0x3609('0x46')](_0x3609('0x47'))){_0xaff0b1[_0x3609('0x48')]=qs[_0x3609('0x48')](_0x4c9a04['query'][_0x3609('0x48')]);_0xaff0b1['offset']=qs['offset'](_0x4c9a04[_0x3609('0x3f')][_0x3609('0x2f')]);}return _0x4b1c7d[_0x3609('0x5c')](_0xaff0b1);}})['then'](function(_0x1ef27f){if(_0x1ef27f){return _0x1ef27f?{'count':_0xc8b666,'rows':_0x1ef27f}:null;}})[_0x3609('0x21')](respondWithResult(_0x48c0ce,null))['catch'](handleError(_0x48c0ce,null));};exports['addConfiguration']=function(_0x3c954a,_0x45f3d9,_0x3e2ed5){if(_0x3c954a[_0x3609('0x5a')]['id']){delete _0x3c954a['body']['id'];}return db[_0x3609('0x52')]['findOne']({'where':{'id':_0x3c954a[_0x3609('0x5b')]['id']}})['then'](handleEntityNotFound(_0x45f3d9,null))['then'](function(_0x516805){if(_0x516805){_0x3c954a[_0x3609('0x5a')][_0x3609('0x5f')]=_0x516805['id'];_0x3c954a[_0x3609('0x5a')][_0x3609('0x60')]=integrations[_0x3609('0x61')](_0x3c954a[_0x3609('0x5a')][_0x3609('0x62')],_0x3c954a[_0x3609('0x5a')][_0x3609('0x4e')]);_0x3c954a['body']['Descriptions']=integrations[_0x3609('0x63')](_0x3c954a[_0x3609('0x5a')][_0x3609('0x62')],_0x3c954a[_0x3609('0x5a')][_0x3609('0x4e')]);return db['DeskConfiguration'][_0x3609('0x59')](_0x3c954a[_0x3609('0x5a')],{'include':[{'model':db[_0x3609('0x64')],'as':_0x3609('0x60')},{'model':db[_0x3609('0x64')],'as':'Descriptions'}]});}return null;})[_0x3609('0x21')](respondWithResult(_0x45f3d9,null))['catch'](handleError(_0x45f3d9,null));};exports['getFields']=function(_0x1f85e4,_0x3986fd,_0x3cab1){var _0x41bec1=[{'name':_0x3609('0x65'),'label':_0x3609('0x65'),'custom':![],'options':[{'name':0x1,'value':0x1},{'name':0x2,'value':0x2},{'name':0x3,'value':0x3},{'name':0x4,'value':0x4},{'name':0x5,'value':0x5},{'name':0x6,'value':0x6},{'name':0x7,'value':0x7},{'name':0x8,'value':0x8},{'name':0x9,'value':0x9},{'name':0xa,'value':0xa}]}];var _0x3201ef='';return db[_0x3609('0x52')][_0x3609('0x5d')]({'where':{'id':_0x1f85e4[_0x3609('0x5b')]['id']},'attributes':['id',_0x3609('0x66'),_0x3609('0x67'),_0x3609('0x68'),'password',_0x3609('0x69'),'consumerSecret',_0x3609('0x6a'),_0x3609('0x6b')]})['then'](handleEntityNotFound(_0x3986fd,null))[_0x3609('0x21')](function(_0x297f12){if(_0x297f12){_0x3201ef=_0x297f12[_0x3609('0x66')];var _0x3e414b=_0x3201ef[_0x3609('0x6c')](-0x1);if(_0x3e414b==='/'){_0x3201ef=_0x3201ef['substring'](0x0,_0x3201ef['lastIndexOf'](_0x3e414b));}var _0x48a319={'method':'GET','uri':util['format'](_0x3609('0x6d'),_0x3201ef),'headers':{'Content-Type':_0x3609('0x6e'),'Accept':_0x3609('0x6e')},'json':!![]};if(_0x297f12[_0x3609('0x67')]===_0x3609('0x6f')){_0x48a319[_0x3609('0x70')]['Authorization']=util[_0x3609('0x71')](_0x3609('0x72'),new Buffer(util['format']('%s:%s',_0x297f12['username'],_0x297f12[_0x3609('0x73')]))[_0x3609('0x74')]('base64'));}return rp(_0x48a319)['then'](function(_0x25e12f){return _0x41bec1[_0x3609('0x75')](_['map'](_0x25e12f['_embedded'][_0x3609('0x76')],function(_0x179e6d){return{'id':_0x179e6d[_0x3609('0x39')],'name':_0x179e6d[_0x3609('0x39')],'type':_0x179e6d['type'],'active':_0x179e6d[_0x3609('0x77')],'label':_0x179e6d[_0x3609('0x78')],'custom':!![]};}));});}})[_0x3609('0x21')](function(_0x238c63){return{'count':_0x238c63[_0x3609('0x55')],'rows':_0x238c63};})[_0x3609('0x21')](respondWithResult(_0x3986fd,null))['catch'](function(_0x45a4c9){var _0x521508=_0x1f85e4['query'][_0x3609('0x1c')]?0x1f4:_0x45a4c9[_0x3609('0x79')]||0x1f4;logger[_0x3609('0x26')](_0x3609('0x7a'),_0x3609('0x7b'),_0x521508,JSON[_0x3609('0x25')](_0x45a4c9));delete _0x45a4c9[_0x3609('0x39')];if(_0x521508===0x191){_0x521508=0x190;}_0x3986fd[_0x3609('0x2c')](_0x521508)[_0x3609('0x3a')](_0x1f85e4[_0x3609('0x3f')][_0x3609('0x1c')]?{'message':_0x3609('0x7c'),'statusCode':_0x45a4c9['statusCode']}:_0x45a4c9);});}; \ No newline at end of file diff --git a/server/api/intDeskAccount/intDeskAccount.model.js b/server/api/intDeskAccount/intDeskAccount.model.js index c8ced5f..10de1fa 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 _0x9320=['path','rimraf','./intDeskAccount.attributes','../../components/integrations/configuration','exports','define','DeskAccount','int_desk_accounts','lodash','util','../../config/logger','request-promise'];(function(_0x5019c4,_0x1aaf0e){var _0x252f3a=function(_0x16c73f){while(--_0x16c73f){_0x5019c4['push'](_0x5019c4['shift']());}};_0x252f3a(++_0x1aaf0e);}(_0x9320,0x11c));var _0x0932=function(_0x213782,_0x140387){_0x213782=_0x213782-0x0;var _0x26a5b7=_0x9320[_0x213782];return _0x26a5b7;};'use strict';var _=require(_0x0932('0x0'));var util=require(_0x0932('0x1'));var logger=require(_0x0932('0x2'))('api');var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x0932('0x3'));var fs=require('fs');var path=require(_0x0932('0x4'));var rimraf=require(_0x0932('0x5'));var config=require('../../config/environment');var attributes=require(_0x0932('0x6'));var integrations=require(_0x0932('0x7'));module[_0x0932('0x8')]=function(_0x43e80c,_0x45d831){return _0x43e80c[_0x0932('0x9')](_0x0932('0xa'),attributes,{'tableName':_0x0932('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x5a3f=['define','DeskAccount','lodash','util','api','moment','bluebird','request-promise','rimraf','../../config/environment','../../components/integrations/configuration','exports'];(function(_0x5ec0c3,_0x4a66ac){var _0x14edeb=function(_0x2dc5e9){while(--_0x2dc5e9){_0x5ec0c3['push'](_0x5ec0c3['shift']());}};_0x14edeb(++_0x4a66ac);}(_0x5a3f,0x122));var _0xf5a3=function(_0x1fea22,_0x520b48){_0x1fea22=_0x1fea22-0x0;var _0x43c2a2=_0x5a3f[_0x1fea22];return _0x43c2a2;};'use strict';var _=require(_0xf5a3('0x0'));var util=require(_0xf5a3('0x1'));var logger=require('../../config/logger')(_0xf5a3('0x2'));var moment=require(_0xf5a3('0x3'));var BPromise=require(_0xf5a3('0x4'));var rp=require(_0xf5a3('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0xf5a3('0x6'));var config=require(_0xf5a3('0x7'));var attributes=require('./intDeskAccount.attributes');var integrations=require(_0xf5a3('0x8'));module[_0xf5a3('0x9')]=function(_0x1a167c,_0x189b7a){return _0x1a167c[_0xf5a3('0xa')](_0xf5a3('0xb'),attributes,{'tableName':'int_desk_accounts','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intDeskAccount/intDeskAccount.rpc.js b/server/api/intDeskAccount/intDeskAccount.rpc.js index e8f53dd..e685a7e 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 _0x8ae7=['rpc','../../config/environment','jayson/promise','http','request','then','DeskAccount,\x20%s,\x20%s','request\x20sent','debug','DeskAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','catch','GetDeskAccount','findAll','options','raw','where','attributes','limit','include','map','model','ShowDeskAccount','DeskAccount','find','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger'];(function(_0x5d6456,_0x58ecc7){var _0x4d66c1=function(_0x4335e3){while(--_0x4335e3){_0x5d6456['push'](_0x5d6456['shift']());}};_0x4d66c1(++_0x58ecc7);}(_0x8ae7,0x17b));var _0x78ae=function(_0x8ae943,_0x59b4be){_0x8ae943=_0x8ae943-0x0;var _0x158d35=_0x8ae7[_0x8ae943];return _0x158d35;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x78ae('0x0'));var BPromise=require(_0x78ae('0x1'));var rs=require(_0x78ae('0x2'));var fs=require('fs');var Redis=require(_0x78ae('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x78ae('0x4'));var logger=require(_0x78ae('0x5'))(_0x78ae('0x6'));var config=require(_0x78ae('0x7'));var jayson=require(_0x78ae('0x8'));var client=jayson['client'][_0x78ae('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x50da2e,_0x506ce1,_0x32550d){return new BPromise(function(_0x4fb92a,_0x2ae054){return client[_0x78ae('0xa')](_0x50da2e,_0x32550d)[_0x78ae('0xb')](function(_0x363d25){logger['info'](_0x78ae('0xc'),_0x506ce1,_0x78ae('0xd'));logger[_0x78ae('0xe')](_0x78ae('0xf'),_0x506ce1,'request\x20sent',JSON[_0x78ae('0x10')](_0x363d25));if(_0x363d25[_0x78ae('0x11')]){if(_0x363d25[_0x78ae('0x11')][_0x78ae('0x12')]===0x1f4){logger[_0x78ae('0x11')](_0x78ae('0xc'),_0x506ce1,_0x363d25[_0x78ae('0x11')]['message']);return _0x2ae054(_0x363d25[_0x78ae('0x11')]['message']);}logger[_0x78ae('0x11')](_0x78ae('0xc'),_0x506ce1,_0x363d25['error'][_0x78ae('0x13')]);return _0x4fb92a(_0x363d25[_0x78ae('0x11')]['message']);}else{logger[_0x78ae('0x14')]('DeskAccount,\x20%s,\x20%s',_0x506ce1,_0x78ae('0xd'));_0x4fb92a(_0x363d25['result'][_0x78ae('0x13')]);}})[_0x78ae('0x15')](function(_0x1598e1){logger[_0x78ae('0x11')](_0x78ae('0xc'),_0x506ce1,_0x1598e1);_0x2ae054(_0x1598e1);});});}exports[_0x78ae('0x16')]=function(_0x41d0d0){var _0x4d78f7=this;return new Promise(function(_0x48c2f2,_0x18fdf4){return db['DeskAccount'][_0x78ae('0x17')]({'raw':_0x41d0d0['options']?_0x41d0d0[_0x78ae('0x18')][_0x78ae('0x19')]===undefined?!![]:![]:!![],'where':_0x41d0d0[_0x78ae('0x18')]?_0x41d0d0[_0x78ae('0x18')][_0x78ae('0x1a')]||null:null,'attributes':_0x41d0d0['options']?_0x41d0d0[_0x78ae('0x18')][_0x78ae('0x1b')]||null:null,'limit':_0x41d0d0[_0x78ae('0x18')]?_0x41d0d0[_0x78ae('0x18')][_0x78ae('0x1c')]||null:null,'include':_0x41d0d0[_0x78ae('0x18')]?_0x41d0d0['options'][_0x78ae('0x1d')]?_[_0x78ae('0x1e')](_0x41d0d0[_0x78ae('0x18')][_0x78ae('0x1d')],function(_0x33e601){return{'model':db[_0x33e601[_0x78ae('0x1f')]],'as':_0x33e601['as'],'attributes':_0x33e601['attributes'],'include':_0x33e601[_0x78ae('0x1d')]?_['map'](_0x33e601['include'],function(_0x56a8d0){return{'model':db[_0x56a8d0[_0x78ae('0x1f')]],'as':_0x56a8d0['as'],'attributes':_0x56a8d0['attributes'],'include':_0x56a8d0[_0x78ae('0x1d')]?_[_0x78ae('0x1e')](_0x56a8d0['include'],function(_0x4b7943){return{'model':db[_0x4b7943['model']],'as':_0x4b7943['as'],'attributes':_0x4b7943[_0x78ae('0x1b')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x2fdbab){logger[_0x78ae('0x14')](_0x78ae('0x16'),_0x41d0d0);logger['debug']('GetDeskAccount',_0x41d0d0,JSON[_0x78ae('0x10')](_0x2fdbab));_0x48c2f2(_0x2fdbab);})[_0x78ae('0x15')](function(_0x26b065){logger[_0x78ae('0x11')](_0x78ae('0x16'),_0x26b065[_0x78ae('0x13')],_0x41d0d0);_0x18fdf4(_0x4d78f7[_0x78ae('0x11')](0x1f4,_0x26b065[_0x78ae('0x13')]));});});};exports[_0x78ae('0x20')]=function(_0x53fa12){var _0x163c22=this;return new Promise(function(_0x15cbbc,_0x149c17){return db[_0x78ae('0x21')][_0x78ae('0x22')]({'raw':_0x53fa12[_0x78ae('0x18')]?_0x53fa12[_0x78ae('0x18')][_0x78ae('0x19')]===undefined?!![]:![]:!![],'where':_0x53fa12[_0x78ae('0x18')]?_0x53fa12['options'][_0x78ae('0x1a')]||null:null,'attributes':_0x53fa12['options']?_0x53fa12['options']['attributes']||null:null,'include':_0x53fa12['options']?_0x53fa12[_0x78ae('0x18')]['include']?_['map'](_0x53fa12[_0x78ae('0x18')][_0x78ae('0x1d')],function(_0x17b450){return{'model':db[_0x17b450[_0x78ae('0x1f')]],'as':_0x17b450['as'],'attributes':_0x17b450['attributes'],'include':_0x17b450[_0x78ae('0x1d')]?_['map'](_0x17b450[_0x78ae('0x1d')],function(_0x393eac){return{'model':db[_0x393eac[_0x78ae('0x1f')]],'as':_0x393eac['as'],'attributes':_0x393eac[_0x78ae('0x1b')],'include':_0x393eac[_0x78ae('0x1d')]?_[_0x78ae('0x1e')](_0x393eac['include'],function(_0x495ebd){return{'model':db[_0x495ebd['model']],'as':_0x495ebd['as'],'attributes':_0x495ebd['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x43efff){logger[_0x78ae('0x14')]('ShowDeskAccount',_0x53fa12);logger[_0x78ae('0xe')](_0x78ae('0x20'),_0x53fa12,JSON['stringify'](_0x43efff));_0x15cbbc(_0x43efff);})[_0x78ae('0x15')](function(_0x18e580){logger['error'](_0x78ae('0x20'),_0x18e580[_0x78ae('0x13')],_0x53fa12);_0x149c17(_0x163c22[_0x78ae('0x11')](0x1f4,_0x18e580[_0x78ae('0x13')]));});});}; \ No newline at end of file +var _0xb7de=['where','lodash','util','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','request','then','debug','error','code','message','info','DeskAccount,\x20%s,\x20%s','result','catch','GetDeskAccount','DeskAccount','findAll','options','raw','attributes','limit','include','map','model','stringify','ShowDeskAccount','find'];(function(_0x4c139d,_0xf5e7bf){var _0x5d7bb1=function(_0x2ddf30){while(--_0x2ddf30){_0x4c139d['push'](_0x4c139d['shift']());}};_0x5d7bb1(++_0xf5e7bf);}(_0xb7de,0x67));var _0xeb7d=function(_0x3ff085,_0x27c92e){_0x3ff085=_0x3ff085-0x0;var _0x2b68c3=_0xb7de[_0x3ff085];return _0x2b68c3;};'use strict';var _=require(_0xeb7d('0x0'));var util=require(_0xeb7d('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0xeb7d('0x2'));var fs=require('fs');var Redis=require(_0xeb7d('0x3'));var db=require(_0xeb7d('0x4'))['db'];var utils=require(_0xeb7d('0x5'));var logger=require(_0xeb7d('0x6'))(_0xeb7d('0x7'));var config=require('../../config/environment');var jayson=require(_0xeb7d('0x8'));var client=jayson[_0xeb7d('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x484af5,_0x2885e8,_0x1c371c){return new BPromise(function(_0x25f3bf,_0x4ec0df){return client[_0xeb7d('0xa')](_0x484af5,_0x1c371c)[_0xeb7d('0xb')](function(_0x2df23c){logger['info']('DeskAccount,\x20%s,\x20%s',_0x2885e8,'request\x20sent');logger[_0xeb7d('0xc')]('DeskAccount,\x20%s,\x20%s,\x20%s',_0x2885e8,'request\x20sent',JSON['stringify'](_0x2df23c));if(_0x2df23c[_0xeb7d('0xd')]){if(_0x2df23c[_0xeb7d('0xd')][_0xeb7d('0xe')]===0x1f4){logger[_0xeb7d('0xd')]('DeskAccount,\x20%s,\x20%s',_0x2885e8,_0x2df23c[_0xeb7d('0xd')][_0xeb7d('0xf')]);return _0x4ec0df(_0x2df23c['error'][_0xeb7d('0xf')]);}logger[_0xeb7d('0xd')]('DeskAccount,\x20%s,\x20%s',_0x2885e8,_0x2df23c[_0xeb7d('0xd')][_0xeb7d('0xf')]);return _0x25f3bf(_0x2df23c[_0xeb7d('0xd')]['message']);}else{logger[_0xeb7d('0x10')](_0xeb7d('0x11'),_0x2885e8,'request\x20sent');_0x25f3bf(_0x2df23c[_0xeb7d('0x12')][_0xeb7d('0xf')]);}})[_0xeb7d('0x13')](function(_0x20d497){logger[_0xeb7d('0xd')](_0xeb7d('0x11'),_0x2885e8,_0x20d497);_0x4ec0df(_0x20d497);});});}exports[_0xeb7d('0x14')]=function(_0x2f32d7){var _0x2c22b4=this;return new Promise(function(_0xd004ce,_0x52c811){return db[_0xeb7d('0x15')][_0xeb7d('0x16')]({'raw':_0x2f32d7[_0xeb7d('0x17')]?_0x2f32d7['options'][_0xeb7d('0x18')]===undefined?!![]:![]:!![],'where':_0x2f32d7[_0xeb7d('0x17')]?_0x2f32d7['options']['where']||null:null,'attributes':_0x2f32d7[_0xeb7d('0x17')]?_0x2f32d7[_0xeb7d('0x17')][_0xeb7d('0x19')]||null:null,'limit':_0x2f32d7['options']?_0x2f32d7[_0xeb7d('0x17')][_0xeb7d('0x1a')]||null:null,'include':_0x2f32d7[_0xeb7d('0x17')]?_0x2f32d7[_0xeb7d('0x17')][_0xeb7d('0x1b')]?_[_0xeb7d('0x1c')](_0x2f32d7[_0xeb7d('0x17')]['include'],function(_0x34234b){return{'model':db[_0x34234b[_0xeb7d('0x1d')]],'as':_0x34234b['as'],'attributes':_0x34234b[_0xeb7d('0x19')],'include':_0x34234b[_0xeb7d('0x1b')]?_[_0xeb7d('0x1c')](_0x34234b[_0xeb7d('0x1b')],function(_0x17812c){return{'model':db[_0x17812c[_0xeb7d('0x1d')]],'as':_0x17812c['as'],'attributes':_0x17812c[_0xeb7d('0x19')],'include':_0x17812c[_0xeb7d('0x1b')]?_[_0xeb7d('0x1c')](_0x17812c[_0xeb7d('0x1b')],function(_0x5a0027){return{'model':db[_0x5a0027[_0xeb7d('0x1d')]],'as':_0x5a0027['as'],'attributes':_0x5a0027[_0xeb7d('0x19')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x142fb3){logger[_0xeb7d('0x10')]('GetDeskAccount',_0x2f32d7);logger[_0xeb7d('0xc')](_0xeb7d('0x14'),_0x2f32d7,JSON[_0xeb7d('0x1e')](_0x142fb3));_0xd004ce(_0x142fb3);})[_0xeb7d('0x13')](function(_0x4a4fdb){logger[_0xeb7d('0xd')](_0xeb7d('0x14'),_0x4a4fdb['message'],_0x2f32d7);_0x52c811(_0x2c22b4[_0xeb7d('0xd')](0x1f4,_0x4a4fdb[_0xeb7d('0xf')]));});});};exports[_0xeb7d('0x1f')]=function(_0x2d335b){var _0x534f1d=this;return new Promise(function(_0x3007d2,_0x4dc251){return db['DeskAccount'][_0xeb7d('0x20')]({'raw':_0x2d335b['options']?_0x2d335b['options'][_0xeb7d('0x18')]===undefined?!![]:![]:!![],'where':_0x2d335b['options']?_0x2d335b['options'][_0xeb7d('0x21')]||null:null,'attributes':_0x2d335b['options']?_0x2d335b[_0xeb7d('0x17')][_0xeb7d('0x19')]||null:null,'include':_0x2d335b[_0xeb7d('0x17')]?_0x2d335b[_0xeb7d('0x17')][_0xeb7d('0x1b')]?_[_0xeb7d('0x1c')](_0x2d335b[_0xeb7d('0x17')][_0xeb7d('0x1b')],function(_0xd844de){return{'model':db[_0xd844de['model']],'as':_0xd844de['as'],'attributes':_0xd844de['attributes'],'include':_0xd844de['include']?_['map'](_0xd844de['include'],function(_0x51cabf){return{'model':db[_0x51cabf[_0xeb7d('0x1d')]],'as':_0x51cabf['as'],'attributes':_0x51cabf[_0xeb7d('0x19')],'include':_0x51cabf[_0xeb7d('0x1b')]?_[_0xeb7d('0x1c')](_0x51cabf['include'],function(_0x433578){return{'model':db[_0x433578[_0xeb7d('0x1d')]],'as':_0x433578['as'],'attributes':_0x433578[_0xeb7d('0x19')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x38cb12){logger[_0xeb7d('0x10')](_0xeb7d('0x1f'),_0x2d335b);logger[_0xeb7d('0xc')](_0xeb7d('0x1f'),_0x2d335b,JSON[_0xeb7d('0x1e')](_0x38cb12));_0x3007d2(_0x38cb12);})[_0xeb7d('0x13')](function(_0x2a27dc){logger[_0xeb7d('0xd')](_0xeb7d('0x1f'),_0x2a27dc['message'],_0x2d335b);_0x4dc251(_0x534f1d[_0xeb7d('0xd')](0x1f4,_0x2a27dc[_0xeb7d('0xf')]));});});}; \ No newline at end of file diff --git a/server/api/intDeskConfiguration/index.js b/server/api/intDeskConfiguration/index.js index 203ae2f..9b80e19 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 _0x7524=['getTags','post','create','/:id/tags','setTags','update','delete','destroy','util','path','express','Router','../../config/environment','get','isAuthenticated','index','/:id','show','getFields','/:id/subjects','/:id/descriptions','getDescriptions'];(function(_0x53b117,_0x4e4767){var _0x1494f8=function(_0x395a23){while(--_0x395a23){_0x53b117['push'](_0x53b117['shift']());}};_0x1494f8(++_0x4e4767);}(_0x7524,0xce));var _0x4752=function(_0xd20c8,_0x578c49){_0xd20c8=_0xd20c8-0x0;var _0x2c9d96=_0x7524[_0xd20c8];return _0x2c9d96;};'use strict';var multer=require('multer');var util=require(_0x4752('0x0'));var path=require(_0x4752('0x1'));var timeout=require('connect-timeout');var express=require(_0x4752('0x2'));var router=express[_0x4752('0x3')]();var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x4752('0x4'));var controller=require('./intDeskConfiguration.controller');router[_0x4752('0x5')]('/',auth[_0x4752('0x6')](),controller[_0x4752('0x7')]);router[_0x4752('0x5')](_0x4752('0x8'),auth['isAuthenticated'](),controller[_0x4752('0x9')]);router[_0x4752('0x5')]('/:id/fields',auth['isAuthenticated'](),controller[_0x4752('0xa')]);router[_0x4752('0x5')](_0x4752('0xb'),auth[_0x4752('0x6')](),controller['getSubjects']);router[_0x4752('0x5')](_0x4752('0xc'),auth[_0x4752('0x6')](),controller[_0x4752('0xd')]);router[_0x4752('0x5')]('/:id/tags',auth[_0x4752('0x6')](),controller[_0x4752('0xe')]);router[_0x4752('0xf')]('/',auth[_0x4752('0x6')](),controller[_0x4752('0x10')]);router[_0x4752('0xf')](_0x4752('0x11'),auth['isAuthenticated'](),controller[_0x4752('0x12')]);router['put'](_0x4752('0x8'),auth[_0x4752('0x6')](),controller[_0x4752('0x13')]);router[_0x4752('0x14')](_0x4752('0x8'),auth[_0x4752('0x6')](),controller[_0x4752('0x15')]);module['exports']=router; \ No newline at end of file +var _0x627e=['getDescriptions','/:id/tags','getTags','post','put','update','delete','exports','multer','util','path','connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment','index','get','/:id','isAuthenticated','show','/:id/subjects','/:id/descriptions'];(function(_0x410fda,_0x3a5a6f){var _0x3bfb38=function(_0x187d11){while(--_0x187d11){_0x410fda['push'](_0x410fda['shift']());}};_0x3bfb38(++_0x3a5a6f);}(_0x627e,0x14a));var _0xe627=function(_0x3e6b6b,_0x1c9aaa){_0x3e6b6b=_0x3e6b6b-0x0;var _0x3968ab=_0x627e[_0x3e6b6b];return _0x3968ab;};'use strict';var multer=require(_0xe627('0x0'));var util=require(_0xe627('0x1'));var path=require(_0xe627('0x2'));var timeout=require(_0xe627('0x3'));var express=require(_0xe627('0x4'));var router=express['Router']();var auth=require(_0xe627('0x5'));var interaction=require(_0xe627('0x6'));var config=require(_0xe627('0x7'));var controller=require('./intDeskConfiguration.controller');router['get']('/',auth['isAuthenticated'](),controller[_0xe627('0x8')]);router[_0xe627('0x9')](_0xe627('0xa'),auth[_0xe627('0xb')](),controller[_0xe627('0xc')]);router[_0xe627('0x9')]('/:id/fields',auth[_0xe627('0xb')](),controller['getFields']);router['get'](_0xe627('0xd'),auth[_0xe627('0xb')](),controller['getSubjects']);router['get'](_0xe627('0xe'),auth[_0xe627('0xb')](),controller[_0xe627('0xf')]);router[_0xe627('0x9')](_0xe627('0x10'),auth[_0xe627('0xb')](),controller[_0xe627('0x11')]);router[_0xe627('0x12')]('/',auth[_0xe627('0xb')](),controller['create']);router[_0xe627('0x12')](_0xe627('0x10'),auth[_0xe627('0xb')](),controller['setTags']);router[_0xe627('0x13')](_0xe627('0xa'),auth[_0xe627('0xb')](),controller[_0xe627('0x14')]);router[_0xe627('0x15')](_0xe627('0xa'),auth[_0xe627('0xb')](),controller['destroy']);module[_0xe627('0x16')]=router; \ No newline at end of file diff --git a/server/api/intDeskConfiguration/intDeskConfiguration.attributes.js b/server/api/intDeskConfiguration/intDeskConfiguration.attributes.js index 9722788..bbd075c 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 _0x71a1=['sequelize','exports','STRING'];(function(_0x5c5d71,_0x453140){var _0x2a8a1e=function(_0x41d9f6){while(--_0x41d9f6){_0x5c5d71['push'](_0x5c5d71['shift']());}};_0x2a8a1e(++_0x453140);}(_0x71a1,0x17a));var _0x171a=function(_0x158406,_0x2068cd){_0x158406=_0x158406-0x0;var _0x574c6c=_0x71a1[_0x158406];return _0x574c6c;};'use strict';var Sequelize=require(_0x171a('0x0'));module[_0x171a('0x1')]={'name':{'type':Sequelize[_0x171a('0x2')]},'description':{'type':Sequelize[_0x171a('0x2')]}}; \ No newline at end of file +var _0x7e2d=['sequelize','exports','STRING'];(function(_0x29da35,_0x49cf6b){var _0x391e99=function(_0x36d5c4){while(--_0x36d5c4){_0x29da35['push'](_0x29da35['shift']());}};_0x391e99(++_0x49cf6b);}(_0x7e2d,0x7b));var _0xd7e2=function(_0x31cb5f,_0x2df766){_0x31cb5f=_0x31cb5f-0x0;var _0x586042=_0x7e2d[_0x31cb5f];return _0x586042;};'use strict';var Sequelize=require(_0xd7e2('0x0'));module[_0xd7e2('0x1')]={'name':{'type':Sequelize[_0xd7e2('0x2')]},'description':{'type':Sequelize[_0xd7e2('0x2')]}}; \ No newline at end of file diff --git a/server/api/intDeskConfiguration/intDeskConfiguration.controller.js b/server/api/intDeskConfiguration/intDeskConfiguration.controller.js index cbeb08d..90f72eb 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 _0x6c9d=['create','body','update','params','getFields','findOne','DeskField','hasOwnProperty','getSubjects','getDescriptions','getTags','Tag','setTags','ids','html-pdf','eml-format','rimraf','zip-dir','moment','bluebird','mustache','util','path','ejs','lodash','squel','jsforce','desk.js','to-csv','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','jayson/promise','client','test','ValidationError','request','info','DeskConfiguration,\x20%s,\x20%s','request\x20sent','debug','error','message','result','catch','sendStatus','status','end','count','offset','limit','Content-Range','json','apply','reject','save','then','destroy','stack','name','send','index','map','rawAttributes','fieldName','type','model','query','keys','filters','attributes','intersection','fields','length','nolimit','order','sort','where','pick','filter','VIRTUAL','merge','options','DeskConfiguration','includeAll','include','rows','find'];(function(_0x1f3736,_0x410d19){var _0x1f92e8=function(_0x3a940b){while(--_0x3a940b){_0x1f3736['push'](_0x1f3736['shift']());}};_0x1f92e8(++_0x410d19);}(_0x6c9d,0x1df));var _0xd6c9=function(_0x315971,_0x53646e){_0x315971=_0x315971-0x0;var _0x262c48=_0x6c9d[_0x315971];return _0x262c48;};'use strict';var pdf=require(_0xd6c9('0x0'));var emlformat=require(_0xd6c9('0x1'));var rimraf=require(_0xd6c9('0x2'));var zipdir=require(_0xd6c9('0x3'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0xd6c9('0x4'));var BPromise=require(_0xd6c9('0x5'));var Mustache=require(_0xd6c9('0x6'));var util=require(_0xd6c9('0x7'));var path=require(_0xd6c9('0x8'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0xd6c9('0x9'));var fs=require('fs');var _=require(_0xd6c9('0xa'));var squel=require(_0xd6c9('0xb'));var crypto=require('crypto');var jsforce=require(_0xd6c9('0xc'));var deskjs=require(_0xd6c9('0xd'));var toCsv=require(_0xd6c9('0xe'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0xd6c9('0xf'));var authService=require(_0xd6c9('0x10'));var qs=require(_0xd6c9('0x11'));var as=require(_0xd6c9('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xd6c9('0x13'))(_0xd6c9('0x14'));var utils=require(_0xd6c9('0x15'));var config=require(_0xd6c9('0x16'));var db=require('../../mysqldb')['db'];var jayson=require(_0xd6c9('0x17'));var client=jayson[_0xd6c9('0x18')]['http']({'port':0x232a});function checkPasswordPattern(_0x20e875,_0x1b066d,_0x45e5b9){if(_0x45e5b9){var _0x4edf59=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x4edf59[_0xd6c9('0x19')](_0x1b066d)){return _0x20e875;}else{throw new db['Sequelize'][(_0xd6c9('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 _0x20e875;}}function respondWithRpcPromise(_0x543f29,_0x126453,_0x432e5c,_0x828290){return new BPromise(function(_0x7860ac,_0x856251){var _0x11f6c9=_0x828290||client;return _0x11f6c9[_0xd6c9('0x1b')](_0x543f29,_0x432e5c)['then'](function(_0x236b5d){logger[_0xd6c9('0x1c')](_0xd6c9('0x1d'),_0x126453,_0xd6c9('0x1e'));logger[_0xd6c9('0x1f')]('DeskConfiguration,\x20%s,\x20%s,\x20%s',_0x126453,_0xd6c9('0x1e'),JSON['stringify'](_0x236b5d));if(_0x236b5d[_0xd6c9('0x20')]){if(_0x236b5d[_0xd6c9('0x20')]['code']===0x1f4){logger[_0xd6c9('0x20')]('DeskConfiguration,\x20%s,\x20%s',_0x126453,_0x236b5d[_0xd6c9('0x20')]['message']);return _0x856251(_0x236b5d[_0xd6c9('0x20')][_0xd6c9('0x21')]);}logger[_0xd6c9('0x20')](_0xd6c9('0x1d'),_0x126453,_0x236b5d['error'][_0xd6c9('0x21')]);return _0x7860ac(_0x236b5d[_0xd6c9('0x20')][_0xd6c9('0x21')]);}else{logger['info']('DeskConfiguration,\x20%s,\x20%s',_0x126453,_0xd6c9('0x1e'));_0x7860ac(_0x236b5d[_0xd6c9('0x22')][_0xd6c9('0x21')]);}})[_0xd6c9('0x23')](function(_0x38303f){logger['error']('DeskConfiguration,\x20%s,\x20%s',_0x126453,_0x38303f);_0x856251(_0x38303f);});});}function respondWithStatusCode(_0x22dbf1,_0x685bb8){_0x685bb8=_0x685bb8||0xcc;return function(_0x2810a6){if(_0x2810a6){return _0x22dbf1[_0xd6c9('0x24')](_0x685bb8);}return _0x22dbf1[_0xd6c9('0x25')](_0x685bb8)[_0xd6c9('0x26')]();};}function respondWithResult(_0x16951f,_0x6b2727){_0x6b2727=_0x6b2727||0xc8;return function(_0x3c811b){if(_0x3c811b){return _0x16951f[_0xd6c9('0x25')](_0x6b2727)['json'](_0x3c811b);}};}function respondWithFilteredResult(_0x553130,_0x9a68c9){return function(_0x5eee3a){if(_0x5eee3a){var _0x2d0f09=_0x5eee3a[_0xd6c9('0x27')],_0x360a48=_0x9a68c9['offset'],_0x16be9c=_0x9a68c9[_0xd6c9('0x28')]+_0x9a68c9[_0xd6c9('0x29')],_0x148312;if(_0x16be9c>=_0x2d0f09){_0x16be9c=_0x2d0f09;_0x148312=0xc8;}else{_0x148312=0xce;}_0x553130[_0xd6c9('0x25')](_0x148312);return _0x553130['set'](_0xd6c9('0x2a'),_0x360a48+'-'+_0x16be9c+'/'+_0x2d0f09)[_0xd6c9('0x2b')](_0x5eee3a);}return null;};}function patchUpdates(_0x13174f){return function(_0x2114c4){try{jsonpatch[_0xd6c9('0x2c')](_0x2114c4,_0x13174f,!![]);}catch(_0x557d76){return BPromise[_0xd6c9('0x2d')](_0x557d76);}return _0x2114c4[_0xd6c9('0x2e')]();};}function saveUpdates(_0x12968d,_0x42e674){return function(_0x142afd){if(_0x142afd){return _0x142afd['update'](_0x12968d)[_0xd6c9('0x2f')](function(_0x4b1110){return _0x4b1110;});}return null;};}function removeEntity(_0x11b471,_0x2ab1b0){return function(_0x1b1efc){if(_0x1b1efc){return _0x1b1efc[_0xd6c9('0x30')]()[_0xd6c9('0x2f')](function(){_0x11b471[_0xd6c9('0x25')](0xcc)[_0xd6c9('0x26')]();});}};}function handleEntityNotFound(_0x26e464,_0x229084){return function(_0x231c86){if(!_0x231c86){_0x26e464['sendStatus'](0x194);}return _0x231c86;};}function handleError(_0x3bda7f,_0x5a8ff4){_0x5a8ff4=_0x5a8ff4||0x1f4;return function(_0x5ce180){logger[_0xd6c9('0x20')](_0x5ce180[_0xd6c9('0x31')]);if(_0x5ce180[_0xd6c9('0x32')]){delete _0x5ce180[_0xd6c9('0x32')];}_0x3bda7f[_0xd6c9('0x25')](_0x5a8ff4)[_0xd6c9('0x33')](_0x5ce180);};}exports[_0xd6c9('0x34')]=function(_0x1f6618,_0x1a7875){var _0x13b536={},_0x53a38c={},_0x5f2d37={'count':0x0,'rows':[]};var _0x442d25=_[_0xd6c9('0x35')](db['DeskConfiguration'][_0xd6c9('0x36')],function(_0x4739bc){return{'name':_0x4739bc[_0xd6c9('0x37')],'type':_0x4739bc[_0xd6c9('0x38')]['key']};});_0x53a38c[_0xd6c9('0x39')]=_['map'](_0x442d25,_0xd6c9('0x32'));_0x53a38c[_0xd6c9('0x3a')]=_[_0xd6c9('0x3b')](_0x1f6618[_0xd6c9('0x3a')]);_0x53a38c[_0xd6c9('0x3c')]=_['intersection'](_0x53a38c['model'],_0x53a38c[_0xd6c9('0x3a')]);_0x13b536[_0xd6c9('0x3d')]=_[_0xd6c9('0x3e')](_0x53a38c['model'],qs[_0xd6c9('0x3f')](_0x1f6618[_0xd6c9('0x3a')][_0xd6c9('0x3f')]));_0x13b536[_0xd6c9('0x3d')]=_0x13b536[_0xd6c9('0x3d')][_0xd6c9('0x40')]?_0x13b536[_0xd6c9('0x3d')]:_0x53a38c[_0xd6c9('0x39')];if(!_0x1f6618['query']['hasOwnProperty'](_0xd6c9('0x41'))){_0x13b536['limit']=qs[_0xd6c9('0x29')](_0x1f6618[_0xd6c9('0x3a')][_0xd6c9('0x29')]);_0x13b536[_0xd6c9('0x28')]=qs[_0xd6c9('0x28')](_0x1f6618['query'][_0xd6c9('0x28')]);}_0x13b536[_0xd6c9('0x42')]=qs[_0xd6c9('0x43')](_0x1f6618['query'][_0xd6c9('0x43')]);_0x13b536[_0xd6c9('0x44')]=qs[_0xd6c9('0x3c')](_[_0xd6c9('0x45')](_0x1f6618['query'],_0x53a38c[_0xd6c9('0x3c')]));if(_0x1f6618['query'][_0xd6c9('0x46')]){_0x13b536['where']=_['merge'](_0x13b536['where'],{'$or':_[_0xd6c9('0x35')](_0x442d25,function(_0x152ae2){if(_0x152ae2[_0xd6c9('0x38')]!==_0xd6c9('0x47')){var _0x10ba0d={};_0x10ba0d[_0x152ae2[_0xd6c9('0x32')]]={'$like':'%'+_0x1f6618[_0xd6c9('0x3a')][_0xd6c9('0x46')]+'%'};return _0x10ba0d;}})});}_0x13b536=_[_0xd6c9('0x48')]({},_0x13b536,_0x1f6618[_0xd6c9('0x49')]);var _0x256eaf={'where':_0x13b536['where']};return db[_0xd6c9('0x4a')]['count'](_0x256eaf)[_0xd6c9('0x2f')](function(_0x5751ef){_0x5f2d37['count']=_0x5751ef;if(_0x1f6618[_0xd6c9('0x3a')][_0xd6c9('0x4b')]){_0x13b536[_0xd6c9('0x4c')]=[{'all':!![]}];}return db['DeskConfiguration']['findAll'](_0x13b536);})[_0xd6c9('0x2f')](function(_0x3f01ec){_0x5f2d37[_0xd6c9('0x4d')]=_0x3f01ec;return _0x5f2d37;})[_0xd6c9('0x2f')](respondWithFilteredResult(_0x1a7875,_0x13b536))['catch'](handleError(_0x1a7875,null));};exports['show']=function(_0x54b1bf,_0x417e6b){var _0x5e12af={'raw':![],'where':{'id':_0x54b1bf['params']['id']}},_0x1f5077={};_0x1f5077[_0xd6c9('0x39')]=_[_0xd6c9('0x3b')](db[_0xd6c9('0x4a')][_0xd6c9('0x36')]);_0x1f5077[_0xd6c9('0x3a')]=_[_0xd6c9('0x3b')](_0x54b1bf['query']);_0x1f5077[_0xd6c9('0x3c')]=_[_0xd6c9('0x3e')](_0x1f5077[_0xd6c9('0x39')],_0x1f5077['query']);_0x5e12af[_0xd6c9('0x3d')]=_['intersection'](_0x1f5077[_0xd6c9('0x39')],qs[_0xd6c9('0x3f')](_0x54b1bf[_0xd6c9('0x3a')][_0xd6c9('0x3f')]));_0x5e12af[_0xd6c9('0x3d')]=_0x5e12af[_0xd6c9('0x3d')]['length']?_0x5e12af[_0xd6c9('0x3d')]:_0x1f5077[_0xd6c9('0x39')];if(_0x54b1bf[_0xd6c9('0x3a')]['includeAll']){_0x5e12af['include']=[{'all':!![]}];}_0x5e12af=_[_0xd6c9('0x48')]({},_0x5e12af,_0x54b1bf[_0xd6c9('0x49')]);return db[_0xd6c9('0x4a')][_0xd6c9('0x4e')](_0x5e12af)[_0xd6c9('0x2f')](handleEntityNotFound(_0x417e6b,null))[_0xd6c9('0x2f')](respondWithResult(_0x417e6b,null))[_0xd6c9('0x23')](handleError(_0x417e6b,null));};exports['create']=function(_0x548c91,_0x441258){return db[_0xd6c9('0x4a')][_0xd6c9('0x4f')](_0x548c91[_0xd6c9('0x50')],{})[_0xd6c9('0x2f')](respondWithResult(_0x441258,0xc9))[_0xd6c9('0x23')](handleError(_0x441258,null));};exports[_0xd6c9('0x51')]=function(_0x2e9654,_0x2f9ae1){if(_0x2e9654[_0xd6c9('0x50')]['id']){delete _0x2e9654['body']['id'];}return db[_0xd6c9('0x4a')][_0xd6c9('0x4e')]({'where':{'id':_0x2e9654[_0xd6c9('0x52')]['id']}})[_0xd6c9('0x2f')](handleEntityNotFound(_0x2f9ae1,null))[_0xd6c9('0x2f')](saveUpdates(_0x2e9654[_0xd6c9('0x50')],null))[_0xd6c9('0x2f')](respondWithResult(_0x2f9ae1,null))['catch'](handleError(_0x2f9ae1,null));};exports[_0xd6c9('0x30')]=function(_0x9d3bde,_0x2915c6){return db[_0xd6c9('0x4a')][_0xd6c9('0x4e')]({'where':{'id':_0x9d3bde[_0xd6c9('0x52')]['id']}})['then'](handleEntityNotFound(_0x2915c6,null))[_0xd6c9('0x2f')](removeEntity(_0x2915c6,null))[_0xd6c9('0x23')](handleError(_0x2915c6,null));};exports[_0xd6c9('0x53')]=function(_0xfb1cd7,_0x24d0ff,_0x5dbd21){var _0x53bc3f={};var _0x17dc53={};var _0x3aae84;var _0x3d9d79;return db['DeskConfiguration'][_0xd6c9('0x54')]({'where':{'id':_0xfb1cd7[_0xd6c9('0x52')]['id']}})[_0xd6c9('0x2f')](handleEntityNotFound(_0x24d0ff,null))[_0xd6c9('0x2f')](function(_0x376063){if(_0x376063){_0x3aae84=_0x376063;_0x17dc53[_0xd6c9('0x39')]=_['keys'](db[_0xd6c9('0x55')][_0xd6c9('0x36')]);_0x17dc53[_0xd6c9('0x3a')]=_['keys'](_0xfb1cd7['query']);_0x17dc53[_0xd6c9('0x3c')]=_[_0xd6c9('0x3e')](_0x17dc53[_0xd6c9('0x39')],_0x17dc53[_0xd6c9('0x3a')]);_0x53bc3f[_0xd6c9('0x3d')]=_[_0xd6c9('0x3e')](_0x17dc53[_0xd6c9('0x39')],qs[_0xd6c9('0x3f')](_0xfb1cd7[_0xd6c9('0x3a')][_0xd6c9('0x3f')]));_0x53bc3f[_0xd6c9('0x3d')]=_0x53bc3f[_0xd6c9('0x3d')][_0xd6c9('0x40')]?_0x53bc3f[_0xd6c9('0x3d')]:_0x17dc53[_0xd6c9('0x39')];_0x53bc3f[_0xd6c9('0x42')]=qs[_0xd6c9('0x43')](_0xfb1cd7[_0xd6c9('0x3a')][_0xd6c9('0x43')]);_0x53bc3f[_0xd6c9('0x44')]=qs[_0xd6c9('0x3c')](_[_0xd6c9('0x45')](_0xfb1cd7[_0xd6c9('0x3a')],_0x17dc53[_0xd6c9('0x3c')]));if(_0xfb1cd7[_0xd6c9('0x3a')][_0xd6c9('0x46')]){_0x53bc3f['where']=_['merge'](_0x53bc3f[_0xd6c9('0x44')],{'$or':_['map'](_0x53bc3f[_0xd6c9('0x3d')],function(_0xbe1d63){var _0xe0d6e7={};_0xe0d6e7[_0xbe1d63]={'$like':'%'+_0xfb1cd7['query'][_0xd6c9('0x46')]+'%'};return _0xe0d6e7;})});}_0x53bc3f=_[_0xd6c9('0x48')]({},_0x53bc3f,_0xfb1cd7[_0xd6c9('0x49')]);return _0x3aae84[_0xd6c9('0x53')](_0x53bc3f);}})[_0xd6c9('0x2f')](function(_0x58366e){if(_0x58366e){_0x3d9d79=_0x58366e[_0xd6c9('0x40')];if(!_0xfb1cd7[_0xd6c9('0x3a')][_0xd6c9('0x56')]('nolimit')){_0x53bc3f[_0xd6c9('0x29')]=qs['limit'](_0xfb1cd7[_0xd6c9('0x3a')][_0xd6c9('0x29')]);_0x53bc3f[_0xd6c9('0x28')]=qs['offset'](_0xfb1cd7[_0xd6c9('0x3a')][_0xd6c9('0x28')]);}return _0x3aae84[_0xd6c9('0x53')](_0x53bc3f);}})['then'](function(_0x1b960d){if(_0x1b960d){return _0x1b960d?{'count':_0x3d9d79,'rows':_0x1b960d}:null;}})[_0xd6c9('0x2f')](respondWithResult(_0x24d0ff,null))[_0xd6c9('0x23')](handleError(_0x24d0ff,null));};exports[_0xd6c9('0x57')]=function(_0x541edb,_0x3e5ed5,_0x331181){var _0x28fcb7={};var _0x3f482f={};var _0xc0e3dd;var _0x2042d8;return db['DeskConfiguration'][_0xd6c9('0x54')]({'where':{'id':_0x541edb[_0xd6c9('0x52')]['id']}})[_0xd6c9('0x2f')](handleEntityNotFound(_0x3e5ed5,null))[_0xd6c9('0x2f')](function(_0x431055){if(_0x431055){_0xc0e3dd=_0x431055;_0x3f482f[_0xd6c9('0x39')]=_[_0xd6c9('0x3b')](db[_0xd6c9('0x55')][_0xd6c9('0x36')]);_0x3f482f['query']=_[_0xd6c9('0x3b')](_0x541edb[_0xd6c9('0x3a')]);_0x3f482f[_0xd6c9('0x3c')]=_[_0xd6c9('0x3e')](_0x3f482f[_0xd6c9('0x39')],_0x3f482f[_0xd6c9('0x3a')]);_0x28fcb7['attributes']=_[_0xd6c9('0x3e')](_0x3f482f[_0xd6c9('0x39')],qs[_0xd6c9('0x3f')](_0x541edb[_0xd6c9('0x3a')][_0xd6c9('0x3f')]));_0x28fcb7[_0xd6c9('0x3d')]=_0x28fcb7['attributes'][_0xd6c9('0x40')]?_0x28fcb7[_0xd6c9('0x3d')]:_0x3f482f['model'];_0x28fcb7[_0xd6c9('0x42')]=qs[_0xd6c9('0x43')](_0x541edb[_0xd6c9('0x3a')][_0xd6c9('0x43')]);_0x28fcb7[_0xd6c9('0x44')]=qs['filters'](_['pick'](_0x541edb[_0xd6c9('0x3a')],_0x3f482f[_0xd6c9('0x3c')]));if(_0x541edb['query'][_0xd6c9('0x46')]){_0x28fcb7[_0xd6c9('0x44')]=_[_0xd6c9('0x48')](_0x28fcb7[_0xd6c9('0x44')],{'$or':_['map'](_0x28fcb7[_0xd6c9('0x3d')],function(_0x47d173){var _0x3ff87a={};_0x3ff87a[_0x47d173]={'$like':'%'+_0x541edb[_0xd6c9('0x3a')][_0xd6c9('0x46')]+'%'};return _0x3ff87a;})});}_0x28fcb7=_[_0xd6c9('0x48')]({},_0x28fcb7,_0x541edb[_0xd6c9('0x49')]);return _0xc0e3dd[_0xd6c9('0x57')](_0x28fcb7);}})[_0xd6c9('0x2f')](function(_0x61e3e7){if(_0x61e3e7){_0x2042d8=_0x61e3e7[_0xd6c9('0x40')];if(!_0x541edb['query'][_0xd6c9('0x56')]('nolimit')){_0x28fcb7[_0xd6c9('0x29')]=qs[_0xd6c9('0x29')](_0x541edb[_0xd6c9('0x3a')]['limit']);_0x28fcb7[_0xd6c9('0x28')]=qs[_0xd6c9('0x28')](_0x541edb['query']['offset']);}return _0xc0e3dd[_0xd6c9('0x57')](_0x28fcb7);}})[_0xd6c9('0x2f')](function(_0x472d5c){if(_0x472d5c){return _0x472d5c?{'count':_0x2042d8,'rows':_0x472d5c}:null;}})[_0xd6c9('0x2f')](respondWithResult(_0x3e5ed5,null))[_0xd6c9('0x23')](handleError(_0x3e5ed5,null));};exports[_0xd6c9('0x58')]=function(_0x2355ac,_0x19fe7e,_0xda8c88){var _0x5259f1={};var _0x5449fe={};var _0x197b73;var _0x364f52;return db[_0xd6c9('0x4a')]['findOne']({'where':{'id':_0x2355ac[_0xd6c9('0x52')]['id']}})['then'](handleEntityNotFound(_0x19fe7e,null))['then'](function(_0x2d2245){if(_0x2d2245){_0x197b73=_0x2d2245;_0x5449fe[_0xd6c9('0x39')]=_['keys'](db[_0xd6c9('0x55')][_0xd6c9('0x36')]);_0x5449fe['query']=_[_0xd6c9('0x3b')](_0x2355ac[_0xd6c9('0x3a')]);_0x5449fe[_0xd6c9('0x3c')]=_[_0xd6c9('0x3e')](_0x5449fe[_0xd6c9('0x39')],_0x5449fe[_0xd6c9('0x3a')]);_0x5259f1['attributes']=_[_0xd6c9('0x3e')](_0x5449fe[_0xd6c9('0x39')],qs['fields'](_0x2355ac[_0xd6c9('0x3a')][_0xd6c9('0x3f')]));_0x5259f1[_0xd6c9('0x3d')]=_0x5259f1[_0xd6c9('0x3d')][_0xd6c9('0x40')]?_0x5259f1[_0xd6c9('0x3d')]:_0x5449fe[_0xd6c9('0x39')];_0x5259f1[_0xd6c9('0x42')]=qs['sort'](_0x2355ac[_0xd6c9('0x3a')][_0xd6c9('0x43')]);_0x5259f1[_0xd6c9('0x44')]=qs[_0xd6c9('0x3c')](_['pick'](_0x2355ac[_0xd6c9('0x3a')],_0x5449fe[_0xd6c9('0x3c')]));if(_0x2355ac[_0xd6c9('0x3a')]['filter']){_0x5259f1['where']=_[_0xd6c9('0x48')](_0x5259f1['where'],{'$or':_[_0xd6c9('0x35')](_0x5259f1[_0xd6c9('0x3d')],function(_0xe6744b){var _0x5b2d02={};_0x5b2d02[_0xe6744b]={'$like':'%'+_0x2355ac[_0xd6c9('0x3a')]['filter']+'%'};return _0x5b2d02;})});}_0x5259f1=_['merge']({},_0x5259f1,_0x2355ac[_0xd6c9('0x49')]);return _0x197b73[_0xd6c9('0x58')](_0x5259f1);}})['then'](function(_0x198840){if(_0x198840){_0x364f52=_0x198840['length'];if(!_0x2355ac[_0xd6c9('0x3a')]['hasOwnProperty'](_0xd6c9('0x41'))){_0x5259f1[_0xd6c9('0x29')]=qs[_0xd6c9('0x29')](_0x2355ac[_0xd6c9('0x3a')]['limit']);_0x5259f1['offset']=qs[_0xd6c9('0x28')](_0x2355ac[_0xd6c9('0x3a')][_0xd6c9('0x28')]);}return _0x197b73[_0xd6c9('0x58')](_0x5259f1);}})[_0xd6c9('0x2f')](function(_0x5b6fe5){if(_0x5b6fe5){return _0x5b6fe5?{'count':_0x364f52,'rows':_0x5b6fe5}:null;}})['then'](respondWithResult(_0x19fe7e,null))['catch'](handleError(_0x19fe7e,null));};exports[_0xd6c9('0x59')]=function(_0x32e48f,_0x5264bf,_0x7969a8){var _0x4661b6={};var _0x4c077e={};var _0x48cf1c;var _0x19d8f7;return db[_0xd6c9('0x4a')][_0xd6c9('0x54')]({'where':{'id':_0x32e48f[_0xd6c9('0x52')]['id']}})[_0xd6c9('0x2f')](handleEntityNotFound(_0x5264bf,null))[_0xd6c9('0x2f')](function(_0x13bbf1){if(_0x13bbf1){_0x48cf1c=_0x13bbf1;_0x4c077e['model']=_[_0xd6c9('0x3b')](db[_0xd6c9('0x5a')][_0xd6c9('0x36')]);_0x4c077e[_0xd6c9('0x3a')]=_[_0xd6c9('0x3b')](_0x32e48f[_0xd6c9('0x3a')]);_0x4c077e[_0xd6c9('0x3c')]=_[_0xd6c9('0x3e')](_0x4c077e['model'],_0x4c077e[_0xd6c9('0x3a')]);_0x4661b6[_0xd6c9('0x3d')]=_['intersection'](_0x4c077e['model'],qs['fields'](_0x32e48f[_0xd6c9('0x3a')][_0xd6c9('0x3f')]));_0x4661b6[_0xd6c9('0x3d')]=_0x4661b6[_0xd6c9('0x3d')][_0xd6c9('0x40')]?_0x4661b6['attributes']:_0x4c077e[_0xd6c9('0x39')];_0x4661b6[_0xd6c9('0x42')]=qs['sort'](_0x32e48f[_0xd6c9('0x3a')][_0xd6c9('0x43')]);_0x4661b6['where']=qs[_0xd6c9('0x3c')](_['pick'](_0x32e48f[_0xd6c9('0x3a')],_0x4c077e[_0xd6c9('0x3c')]));if(_0x32e48f[_0xd6c9('0x3a')][_0xd6c9('0x46')]){_0x4661b6[_0xd6c9('0x44')]=_['merge'](_0x4661b6[_0xd6c9('0x44')],{'$or':_[_0xd6c9('0x35')](_0x4661b6[_0xd6c9('0x3d')],function(_0x5397b2){var _0x2d357d={};_0x2d357d[_0x5397b2]={'$like':'%'+_0x32e48f[_0xd6c9('0x3a')]['filter']+'%'};return _0x2d357d;})});}_0x4661b6=_[_0xd6c9('0x48')]({},_0x4661b6,_0x32e48f[_0xd6c9('0x49')]);return _0x48cf1c[_0xd6c9('0x59')](_0x4661b6);}})[_0xd6c9('0x2f')](function(_0x1b836e){if(_0x1b836e){_0x19d8f7=_0x1b836e[_0xd6c9('0x40')];if(!_0x32e48f['query'][_0xd6c9('0x56')](_0xd6c9('0x41'))){_0x4661b6[_0xd6c9('0x29')]=qs[_0xd6c9('0x29')](_0x32e48f[_0xd6c9('0x3a')]['limit']);_0x4661b6[_0xd6c9('0x28')]=qs[_0xd6c9('0x28')](_0x32e48f['query'][_0xd6c9('0x28')]);}return _0x48cf1c[_0xd6c9('0x59')](_0x4661b6);}})[_0xd6c9('0x2f')](function(_0x4022f9){if(_0x4022f9){return _0x4022f9?{'count':_0x19d8f7,'rows':_0x4022f9}:null;}})[_0xd6c9('0x2f')](respondWithResult(_0x5264bf,null))[_0xd6c9('0x23')](handleError(_0x5264bf,null));};exports[_0xd6c9('0x5b')]=function(_0x3865ac,_0x538adc,_0x1d225d){if(_0x3865ac[_0xd6c9('0x50')]['id']){delete _0x3865ac[_0xd6c9('0x50')]['id'];}return db[_0xd6c9('0x4a')]['findOne']({'where':{'id':_0x3865ac['params']['id']}})[_0xd6c9('0x2f')](handleEntityNotFound(_0x538adc,null))[_0xd6c9('0x2f')](function(_0x595d94){if(_0x595d94){return _0x595d94[_0xd6c9('0x5b')](_0x3865ac[_0xd6c9('0x50')][_0xd6c9('0x5c')]||[]);}return null;})[_0xd6c9('0x2f')](respondWithResult(_0x538adc,null))['catch'](handleError(_0x538adc,null));}; \ No newline at end of file +var _0x9c38=['keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','filter','merge','options','includeAll','include','findAll','rows','show','params','length','find','body','update','getFields','findOne','DeskField','pick','getSubjects','getDescriptions','getTags','setTags','ids','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','util','path','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','papaparse','../../components/auth/service','../../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','info','DeskConfiguration,\x20%s,\x20%s','request\x20sent','DeskConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','message','catch','end','status','json','count','offset','limit','Content-Range','save','then','destroy','stack','name','send','map','DeskConfiguration','rawAttributes','fieldName','type','model','query'];(function(_0x559861,_0x36ed16){var _0xe01688=function(_0x1ff83e){while(--_0x1ff83e){_0x559861['push'](_0x559861['shift']());}};_0xe01688(++_0x36ed16);}(_0x9c38,0x18c));var _0x89c3=function(_0x21037a,_0x198152){_0x21037a=_0x21037a-0x0;var _0x50f9ae=_0x9c38[_0x21037a];return _0x50f9ae;};'use strict';var pdf=require(_0x89c3('0x0'));var emlformat=require(_0x89c3('0x1'));var rimraf=require(_0x89c3('0x2'));var zipdir=require(_0x89c3('0x3'));var jsonpatch=require(_0x89c3('0x4'));var rp=require(_0x89c3('0x5'));var moment=require('moment');var BPromise=require(_0x89c3('0x6'));var Mustache=require('mustache');var util=require(_0x89c3('0x7'));var path=require(_0x89c3('0x8'));var sox=require('sox');var csv=require(_0x89c3('0x9'));var ejs=require(_0x89c3('0xa'));var fs=require('fs');var _=require(_0x89c3('0xb'));var squel=require(_0x89c3('0xc'));var crypto=require(_0x89c3('0xd'));var jsforce=require(_0x89c3('0xe'));var deskjs=require(_0x89c3('0xf'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x89c3('0x10'));var Redis=require('ioredis');var authService=require(_0x89c3('0x11'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x89c3('0x12'));var logger=require(_0x89c3('0x13'))(_0x89c3('0x14'));var utils=require(_0x89c3('0x15'));var config=require(_0x89c3('0x16'));var db=require(_0x89c3('0x17'))['db'];var jayson=require(_0x89c3('0x18'));var client=jayson[_0x89c3('0x19')][_0x89c3('0x1a')]({'port':0x232a});function checkPasswordPattern(_0x394466,_0x19532d,_0x250154){if(_0x250154){var _0x416271=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x416271[_0x89c3('0x1b')](_0x19532d)){return _0x394466;}else{throw new db[(_0x89c3('0x1c'))]['ValidationError'](_0x89c3('0x1d'));}}else{return _0x394466;}}function respondWithRpcPromise(_0x3f18af,_0x1c1f89,_0x486e4b,_0x9aff1e){return new BPromise(function(_0x55e89a,_0x16ddae){var _0x50b266=_0x9aff1e||client;return _0x50b266[_0x89c3('0x1e')](_0x3f18af,_0x486e4b)['then'](function(_0x328e92){logger[_0x89c3('0x1f')](_0x89c3('0x20'),_0x1c1f89,_0x89c3('0x21'));logger['debug'](_0x89c3('0x22'),_0x1c1f89,_0x89c3('0x21'),JSON[_0x89c3('0x23')](_0x328e92));if(_0x328e92[_0x89c3('0x24')]){if(_0x328e92[_0x89c3('0x24')]['code']===0x1f4){logger['error'](_0x89c3('0x20'),_0x1c1f89,_0x328e92[_0x89c3('0x24')][_0x89c3('0x25')]);return _0x16ddae(_0x328e92[_0x89c3('0x24')][_0x89c3('0x25')]);}logger[_0x89c3('0x24')](_0x89c3('0x20'),_0x1c1f89,_0x328e92[_0x89c3('0x24')][_0x89c3('0x25')]);return _0x55e89a(_0x328e92[_0x89c3('0x24')][_0x89c3('0x25')]);}else{logger[_0x89c3('0x1f')](_0x89c3('0x20'),_0x1c1f89,_0x89c3('0x21'));_0x55e89a(_0x328e92['result'][_0x89c3('0x25')]);}})[_0x89c3('0x26')](function(_0x5ccde0){logger[_0x89c3('0x24')](_0x89c3('0x20'),_0x1c1f89,_0x5ccde0);_0x16ddae(_0x5ccde0);});});}function respondWithStatusCode(_0x57df63,_0x359431){_0x359431=_0x359431||0xcc;return function(_0xd65779){if(_0xd65779){return _0x57df63['sendStatus'](_0x359431);}return _0x57df63['status'](_0x359431)[_0x89c3('0x27')]();};}function respondWithResult(_0x172afc,_0x5effb4){_0x5effb4=_0x5effb4||0xc8;return function(_0xb3cf88){if(_0xb3cf88){return _0x172afc[_0x89c3('0x28')](_0x5effb4)[_0x89c3('0x29')](_0xb3cf88);}};}function respondWithFilteredResult(_0x15467f,_0x4137bf){return function(_0x477bca){if(_0x477bca){var _0x45ad76=_0x477bca[_0x89c3('0x2a')],_0xc59112=_0x4137bf[_0x89c3('0x2b')],_0xc1cc66=_0x4137bf[_0x89c3('0x2b')]+_0x4137bf[_0x89c3('0x2c')],_0x4f5bef;if(_0xc1cc66>=_0x45ad76){_0xc1cc66=_0x45ad76;_0x4f5bef=0xc8;}else{_0x4f5bef=0xce;}_0x15467f[_0x89c3('0x28')](_0x4f5bef);return _0x15467f['set'](_0x89c3('0x2d'),_0xc59112+'-'+_0xc1cc66+'/'+_0x45ad76)['json'](_0x477bca);}return null;};}function patchUpdates(_0xf53559){return function(_0x4c2940){try{jsonpatch['apply'](_0x4c2940,_0xf53559,!![]);}catch(_0x25a7cd){return BPromise['reject'](_0x25a7cd);}return _0x4c2940[_0x89c3('0x2e')]();};}function saveUpdates(_0x320df8,_0xa3299f){return function(_0x2f9cb5){if(_0x2f9cb5){return _0x2f9cb5['update'](_0x320df8)[_0x89c3('0x2f')](function(_0x4b963b){return _0x4b963b;});}return null;};}function removeEntity(_0x3c39ed,_0x44d65d){return function(_0x2f3e16){if(_0x2f3e16){return _0x2f3e16[_0x89c3('0x30')]()[_0x89c3('0x2f')](function(){_0x3c39ed['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x857ee6,_0x3f1802){return function(_0x4b016d){if(!_0x4b016d){_0x857ee6['sendStatus'](0x194);}return _0x4b016d;};}function handleError(_0x2318ef,_0x5eecad){_0x5eecad=_0x5eecad||0x1f4;return function(_0x1e8805){logger[_0x89c3('0x24')](_0x1e8805[_0x89c3('0x31')]);if(_0x1e8805[_0x89c3('0x32')]){delete _0x1e8805[_0x89c3('0x32')];}_0x2318ef[_0x89c3('0x28')](_0x5eecad)[_0x89c3('0x33')](_0x1e8805);};}exports['index']=function(_0x3a2e4e,_0x4e1ee5){var _0x22b02f={},_0x207091={},_0x12839a={'count':0x0,'rows':[]};var _0x3ccf14=_[_0x89c3('0x34')](db[_0x89c3('0x35')][_0x89c3('0x36')],function(_0x4c3598){return{'name':_0x4c3598[_0x89c3('0x37')],'type':_0x4c3598[_0x89c3('0x38')]['key']};});_0x207091[_0x89c3('0x39')]=_[_0x89c3('0x34')](_0x3ccf14,_0x89c3('0x32'));_0x207091[_0x89c3('0x3a')]=_[_0x89c3('0x3b')](_0x3a2e4e[_0x89c3('0x3a')]);_0x207091[_0x89c3('0x3c')]=_[_0x89c3('0x3d')](_0x207091[_0x89c3('0x39')],_0x207091['query']);_0x22b02f[_0x89c3('0x3e')]=_['intersection'](_0x207091[_0x89c3('0x39')],qs[_0x89c3('0x3f')](_0x3a2e4e[_0x89c3('0x3a')][_0x89c3('0x3f')]));_0x22b02f[_0x89c3('0x3e')]=_0x22b02f[_0x89c3('0x3e')]['length']?_0x22b02f['attributes']:_0x207091[_0x89c3('0x39')];if(!_0x3a2e4e[_0x89c3('0x3a')][_0x89c3('0x40')](_0x89c3('0x41'))){_0x22b02f[_0x89c3('0x2c')]=qs[_0x89c3('0x2c')](_0x3a2e4e[_0x89c3('0x3a')]['limit']);_0x22b02f[_0x89c3('0x2b')]=qs['offset'](_0x3a2e4e[_0x89c3('0x3a')]['offset']);}_0x22b02f[_0x89c3('0x42')]=qs[_0x89c3('0x43')](_0x3a2e4e['query'][_0x89c3('0x43')]);_0x22b02f[_0x89c3('0x44')]=qs[_0x89c3('0x3c')](_['pick'](_0x3a2e4e[_0x89c3('0x3a')],_0x207091[_0x89c3('0x3c')]));if(_0x3a2e4e['query'][_0x89c3('0x45')]){_0x22b02f[_0x89c3('0x44')]=_[_0x89c3('0x46')](_0x22b02f[_0x89c3('0x44')],{'$or':_['map'](_0x3ccf14,function(_0x42ff2a){if(_0x42ff2a[_0x89c3('0x38')]!=='VIRTUAL'){var _0x5b87e9={};_0x5b87e9[_0x42ff2a[_0x89c3('0x32')]]={'$like':'%'+_0x3a2e4e[_0x89c3('0x3a')][_0x89c3('0x45')]+'%'};return _0x5b87e9;}})});}_0x22b02f=_[_0x89c3('0x46')]({},_0x22b02f,_0x3a2e4e[_0x89c3('0x47')]);var _0x424ab2={'where':_0x22b02f[_0x89c3('0x44')]};return db[_0x89c3('0x35')][_0x89c3('0x2a')](_0x424ab2)['then'](function(_0x5a83f9){_0x12839a[_0x89c3('0x2a')]=_0x5a83f9;if(_0x3a2e4e['query'][_0x89c3('0x48')]){_0x22b02f[_0x89c3('0x49')]=[{'all':!![]}];}return db[_0x89c3('0x35')][_0x89c3('0x4a')](_0x22b02f);})['then'](function(_0x1cf9c8){_0x12839a[_0x89c3('0x4b')]=_0x1cf9c8;return _0x12839a;})['then'](respondWithFilteredResult(_0x4e1ee5,_0x22b02f))['catch'](handleError(_0x4e1ee5,null));};exports[_0x89c3('0x4c')]=function(_0x2c8b9a,_0x2f6e45){var _0x1cf5a7={'raw':![],'where':{'id':_0x2c8b9a[_0x89c3('0x4d')]['id']}},_0x40c4fd={};_0x40c4fd[_0x89c3('0x39')]=_[_0x89c3('0x3b')](db[_0x89c3('0x35')][_0x89c3('0x36')]);_0x40c4fd[_0x89c3('0x3a')]=_[_0x89c3('0x3b')](_0x2c8b9a[_0x89c3('0x3a')]);_0x40c4fd[_0x89c3('0x3c')]=_[_0x89c3('0x3d')](_0x40c4fd[_0x89c3('0x39')],_0x40c4fd[_0x89c3('0x3a')]);_0x1cf5a7[_0x89c3('0x3e')]=_[_0x89c3('0x3d')](_0x40c4fd[_0x89c3('0x39')],qs[_0x89c3('0x3f')](_0x2c8b9a['query'][_0x89c3('0x3f')]));_0x1cf5a7['attributes']=_0x1cf5a7[_0x89c3('0x3e')][_0x89c3('0x4e')]?_0x1cf5a7[_0x89c3('0x3e')]:_0x40c4fd[_0x89c3('0x39')];if(_0x2c8b9a[_0x89c3('0x3a')][_0x89c3('0x48')]){_0x1cf5a7[_0x89c3('0x49')]=[{'all':!![]}];}_0x1cf5a7=_['merge']({},_0x1cf5a7,_0x2c8b9a[_0x89c3('0x47')]);return db[_0x89c3('0x35')][_0x89c3('0x4f')](_0x1cf5a7)[_0x89c3('0x2f')](handleEntityNotFound(_0x2f6e45,null))[_0x89c3('0x2f')](respondWithResult(_0x2f6e45,null))[_0x89c3('0x26')](handleError(_0x2f6e45,null));};exports['create']=function(_0x50d1ae,_0x1706a4){return db[_0x89c3('0x35')]['create'](_0x50d1ae[_0x89c3('0x50')],{})['then'](respondWithResult(_0x1706a4,0xc9))[_0x89c3('0x26')](handleError(_0x1706a4,null));};exports[_0x89c3('0x51')]=function(_0x5c05a8,_0x5d099e){if(_0x5c05a8[_0x89c3('0x50')]['id']){delete _0x5c05a8['body']['id'];}return db['DeskConfiguration'][_0x89c3('0x4f')]({'where':{'id':_0x5c05a8['params']['id']}})[_0x89c3('0x2f')](handleEntityNotFound(_0x5d099e,null))['then'](saveUpdates(_0x5c05a8[_0x89c3('0x50')],null))[_0x89c3('0x2f')](respondWithResult(_0x5d099e,null))[_0x89c3('0x26')](handleError(_0x5d099e,null));};exports['destroy']=function(_0x3a937e,_0x3dfb16){return db['DeskConfiguration']['find']({'where':{'id':_0x3a937e['params']['id']}})['then'](handleEntityNotFound(_0x3dfb16,null))[_0x89c3('0x2f')](removeEntity(_0x3dfb16,null))['catch'](handleError(_0x3dfb16,null));};exports[_0x89c3('0x52')]=function(_0x99cdc2,_0x37dbad,_0x41c678){var _0x3b2b27={};var _0x1559c5={};var _0x425ff0;var _0x13bd4f;return db[_0x89c3('0x35')][_0x89c3('0x53')]({'where':{'id':_0x99cdc2[_0x89c3('0x4d')]['id']}})[_0x89c3('0x2f')](handleEntityNotFound(_0x37dbad,null))[_0x89c3('0x2f')](function(_0x4b4cc6){if(_0x4b4cc6){_0x425ff0=_0x4b4cc6;_0x1559c5['model']=_[_0x89c3('0x3b')](db[_0x89c3('0x54')][_0x89c3('0x36')]);_0x1559c5['query']=_['keys'](_0x99cdc2['query']);_0x1559c5['filters']=_[_0x89c3('0x3d')](_0x1559c5[_0x89c3('0x39')],_0x1559c5[_0x89c3('0x3a')]);_0x3b2b27['attributes']=_['intersection'](_0x1559c5[_0x89c3('0x39')],qs[_0x89c3('0x3f')](_0x99cdc2[_0x89c3('0x3a')][_0x89c3('0x3f')]));_0x3b2b27[_0x89c3('0x3e')]=_0x3b2b27[_0x89c3('0x3e')][_0x89c3('0x4e')]?_0x3b2b27[_0x89c3('0x3e')]:_0x1559c5[_0x89c3('0x39')];_0x3b2b27[_0x89c3('0x42')]=qs[_0x89c3('0x43')](_0x99cdc2['query'][_0x89c3('0x43')]);_0x3b2b27[_0x89c3('0x44')]=qs[_0x89c3('0x3c')](_[_0x89c3('0x55')](_0x99cdc2[_0x89c3('0x3a')],_0x1559c5[_0x89c3('0x3c')]));if(_0x99cdc2[_0x89c3('0x3a')]['filter']){_0x3b2b27[_0x89c3('0x44')]=_['merge'](_0x3b2b27[_0x89c3('0x44')],{'$or':_['map'](_0x3b2b27['attributes'],function(_0x1e2beb){var _0x2c78e5={};_0x2c78e5[_0x1e2beb]={'$like':'%'+_0x99cdc2[_0x89c3('0x3a')][_0x89c3('0x45')]+'%'};return _0x2c78e5;})});}_0x3b2b27=_[_0x89c3('0x46')]({},_0x3b2b27,_0x99cdc2['options']);return _0x425ff0['getFields'](_0x3b2b27);}})['then'](function(_0x3eab9d){if(_0x3eab9d){_0x13bd4f=_0x3eab9d['length'];if(!_0x99cdc2[_0x89c3('0x3a')][_0x89c3('0x40')](_0x89c3('0x41'))){_0x3b2b27[_0x89c3('0x2c')]=qs['limit'](_0x99cdc2[_0x89c3('0x3a')][_0x89c3('0x2c')]);_0x3b2b27[_0x89c3('0x2b')]=qs['offset'](_0x99cdc2[_0x89c3('0x3a')][_0x89c3('0x2b')]);}return _0x425ff0['getFields'](_0x3b2b27);}})[_0x89c3('0x2f')](function(_0x401fec){if(_0x401fec){return _0x401fec?{'count':_0x13bd4f,'rows':_0x401fec}:null;}})['then'](respondWithResult(_0x37dbad,null))[_0x89c3('0x26')](handleError(_0x37dbad,null));};exports[_0x89c3('0x56')]=function(_0x388bbe,_0xb91a66,_0x148703){var _0x601c00={};var _0x7c5559={};var _0x3a9e75;var _0x5133ee;return db[_0x89c3('0x35')][_0x89c3('0x53')]({'where':{'id':_0x388bbe[_0x89c3('0x4d')]['id']}})['then'](handleEntityNotFound(_0xb91a66,null))[_0x89c3('0x2f')](function(_0x4ab0e0){if(_0x4ab0e0){_0x3a9e75=_0x4ab0e0;_0x7c5559['model']=_[_0x89c3('0x3b')](db[_0x89c3('0x54')][_0x89c3('0x36')]);_0x7c5559[_0x89c3('0x3a')]=_[_0x89c3('0x3b')](_0x388bbe[_0x89c3('0x3a')]);_0x7c5559[_0x89c3('0x3c')]=_[_0x89c3('0x3d')](_0x7c5559['model'],_0x7c5559[_0x89c3('0x3a')]);_0x601c00[_0x89c3('0x3e')]=_[_0x89c3('0x3d')](_0x7c5559[_0x89c3('0x39')],qs[_0x89c3('0x3f')](_0x388bbe[_0x89c3('0x3a')][_0x89c3('0x3f')]));_0x601c00[_0x89c3('0x3e')]=_0x601c00[_0x89c3('0x3e')][_0x89c3('0x4e')]?_0x601c00[_0x89c3('0x3e')]:_0x7c5559[_0x89c3('0x39')];_0x601c00[_0x89c3('0x42')]=qs[_0x89c3('0x43')](_0x388bbe['query'][_0x89c3('0x43')]);_0x601c00['where']=qs[_0x89c3('0x3c')](_['pick'](_0x388bbe[_0x89c3('0x3a')],_0x7c5559['filters']));if(_0x388bbe[_0x89c3('0x3a')]['filter']){_0x601c00[_0x89c3('0x44')]=_[_0x89c3('0x46')](_0x601c00['where'],{'$or':_[_0x89c3('0x34')](_0x601c00[_0x89c3('0x3e')],function(_0x228c8a){var _0x326c33={};_0x326c33[_0x228c8a]={'$like':'%'+_0x388bbe['query'][_0x89c3('0x45')]+'%'};return _0x326c33;})});}_0x601c00=_[_0x89c3('0x46')]({},_0x601c00,_0x388bbe[_0x89c3('0x47')]);return _0x3a9e75[_0x89c3('0x56')](_0x601c00);}})[_0x89c3('0x2f')](function(_0x1d8e14){if(_0x1d8e14){_0x5133ee=_0x1d8e14[_0x89c3('0x4e')];if(!_0x388bbe[_0x89c3('0x3a')]['hasOwnProperty'](_0x89c3('0x41'))){_0x601c00[_0x89c3('0x2c')]=qs[_0x89c3('0x2c')](_0x388bbe[_0x89c3('0x3a')]['limit']);_0x601c00[_0x89c3('0x2b')]=qs[_0x89c3('0x2b')](_0x388bbe[_0x89c3('0x3a')]['offset']);}return _0x3a9e75[_0x89c3('0x56')](_0x601c00);}})['then'](function(_0x39b657){if(_0x39b657){return _0x39b657?{'count':_0x5133ee,'rows':_0x39b657}:null;}})[_0x89c3('0x2f')](respondWithResult(_0xb91a66,null))[_0x89c3('0x26')](handleError(_0xb91a66,null));};exports[_0x89c3('0x57')]=function(_0x4707c8,_0x332703,_0x35b6b5){var _0xe239c3={};var _0x37cb69={};var _0xcc30cd;var _0x3f57ae;return db[_0x89c3('0x35')][_0x89c3('0x53')]({'where':{'id':_0x4707c8[_0x89c3('0x4d')]['id']}})[_0x89c3('0x2f')](handleEntityNotFound(_0x332703,null))[_0x89c3('0x2f')](function(_0x2d7691){if(_0x2d7691){_0xcc30cd=_0x2d7691;_0x37cb69['model']=_[_0x89c3('0x3b')](db[_0x89c3('0x54')][_0x89c3('0x36')]);_0x37cb69['query']=_[_0x89c3('0x3b')](_0x4707c8['query']);_0x37cb69[_0x89c3('0x3c')]=_[_0x89c3('0x3d')](_0x37cb69['model'],_0x37cb69[_0x89c3('0x3a')]);_0xe239c3[_0x89c3('0x3e')]=_['intersection'](_0x37cb69[_0x89c3('0x39')],qs['fields'](_0x4707c8[_0x89c3('0x3a')][_0x89c3('0x3f')]));_0xe239c3[_0x89c3('0x3e')]=_0xe239c3[_0x89c3('0x3e')][_0x89c3('0x4e')]?_0xe239c3[_0x89c3('0x3e')]:_0x37cb69[_0x89c3('0x39')];_0xe239c3[_0x89c3('0x42')]=qs[_0x89c3('0x43')](_0x4707c8['query']['sort']);_0xe239c3[_0x89c3('0x44')]=qs['filters'](_[_0x89c3('0x55')](_0x4707c8['query'],_0x37cb69[_0x89c3('0x3c')]));if(_0x4707c8['query'][_0x89c3('0x45')]){_0xe239c3['where']=_[_0x89c3('0x46')](_0xe239c3[_0x89c3('0x44')],{'$or':_[_0x89c3('0x34')](_0xe239c3[_0x89c3('0x3e')],function(_0x1551e2){var _0x283e0e={};_0x283e0e[_0x1551e2]={'$like':'%'+_0x4707c8[_0x89c3('0x3a')][_0x89c3('0x45')]+'%'};return _0x283e0e;})});}_0xe239c3=_[_0x89c3('0x46')]({},_0xe239c3,_0x4707c8['options']);return _0xcc30cd['getDescriptions'](_0xe239c3);}})['then'](function(_0x4fdb50){if(_0x4fdb50){_0x3f57ae=_0x4fdb50['length'];if(!_0x4707c8[_0x89c3('0x3a')][_0x89c3('0x40')](_0x89c3('0x41'))){_0xe239c3[_0x89c3('0x2c')]=qs[_0x89c3('0x2c')](_0x4707c8[_0x89c3('0x3a')][_0x89c3('0x2c')]);_0xe239c3[_0x89c3('0x2b')]=qs['offset'](_0x4707c8[_0x89c3('0x3a')][_0x89c3('0x2b')]);}return _0xcc30cd[_0x89c3('0x57')](_0xe239c3);}})['then'](function(_0x51624c){if(_0x51624c){return _0x51624c?{'count':_0x3f57ae,'rows':_0x51624c}:null;}})['then'](respondWithResult(_0x332703,null))[_0x89c3('0x26')](handleError(_0x332703,null));};exports['getTags']=function(_0x33a75e,_0x4de211,_0x474010){var _0x18efde={};var _0x23e609={};var _0x501593;var _0x774ddd;return db[_0x89c3('0x35')][_0x89c3('0x53')]({'where':{'id':_0x33a75e[_0x89c3('0x4d')]['id']}})[_0x89c3('0x2f')](handleEntityNotFound(_0x4de211,null))[_0x89c3('0x2f')](function(_0x35035b){if(_0x35035b){_0x501593=_0x35035b;_0x23e609[_0x89c3('0x39')]=_[_0x89c3('0x3b')](db['Tag'][_0x89c3('0x36')]);_0x23e609[_0x89c3('0x3a')]=_[_0x89c3('0x3b')](_0x33a75e[_0x89c3('0x3a')]);_0x23e609['filters']=_[_0x89c3('0x3d')](_0x23e609[_0x89c3('0x39')],_0x23e609[_0x89c3('0x3a')]);_0x18efde[_0x89c3('0x3e')]=_[_0x89c3('0x3d')](_0x23e609['model'],qs[_0x89c3('0x3f')](_0x33a75e[_0x89c3('0x3a')][_0x89c3('0x3f')]));_0x18efde[_0x89c3('0x3e')]=_0x18efde[_0x89c3('0x3e')][_0x89c3('0x4e')]?_0x18efde[_0x89c3('0x3e')]:_0x23e609[_0x89c3('0x39')];_0x18efde[_0x89c3('0x42')]=qs[_0x89c3('0x43')](_0x33a75e[_0x89c3('0x3a')][_0x89c3('0x43')]);_0x18efde['where']=qs[_0x89c3('0x3c')](_[_0x89c3('0x55')](_0x33a75e[_0x89c3('0x3a')],_0x23e609['filters']));if(_0x33a75e[_0x89c3('0x3a')][_0x89c3('0x45')]){_0x18efde[_0x89c3('0x44')]=_['merge'](_0x18efde[_0x89c3('0x44')],{'$or':_[_0x89c3('0x34')](_0x18efde['attributes'],function(_0x4a076a){var _0x46aad={};_0x46aad[_0x4a076a]={'$like':'%'+_0x33a75e[_0x89c3('0x3a')][_0x89c3('0x45')]+'%'};return _0x46aad;})});}_0x18efde=_[_0x89c3('0x46')]({},_0x18efde,_0x33a75e[_0x89c3('0x47')]);return _0x501593[_0x89c3('0x58')](_0x18efde);}})[_0x89c3('0x2f')](function(_0x503f81){if(_0x503f81){_0x774ddd=_0x503f81[_0x89c3('0x4e')];if(!_0x33a75e[_0x89c3('0x3a')]['hasOwnProperty'](_0x89c3('0x41'))){_0x18efde['limit']=qs[_0x89c3('0x2c')](_0x33a75e['query'][_0x89c3('0x2c')]);_0x18efde['offset']=qs[_0x89c3('0x2b')](_0x33a75e[_0x89c3('0x3a')][_0x89c3('0x2b')]);}return _0x501593[_0x89c3('0x58')](_0x18efde);}})['then'](function(_0x3bb3c4){if(_0x3bb3c4){return _0x3bb3c4?{'count':_0x774ddd,'rows':_0x3bb3c4}:null;}})['then'](respondWithResult(_0x4de211,null))['catch'](handleError(_0x4de211,null));};exports['setTags']=function(_0x6750da,_0x5a6b0a,_0xfaac15){if(_0x6750da[_0x89c3('0x50')]['id']){delete _0x6750da[_0x89c3('0x50')]['id'];}return db['DeskConfiguration']['findOne']({'where':{'id':_0x6750da[_0x89c3('0x4d')]['id']}})['then'](handleEntityNotFound(_0x5a6b0a,null))[_0x89c3('0x2f')](function(_0x1b2bdc){if(_0x1b2bdc){return _0x1b2bdc[_0x89c3('0x59')](_0x6750da[_0x89c3('0x50')][_0x89c3('0x5a')]||[]);}return null;})['then'](respondWithResult(_0x5a6b0a,null))['catch'](handleError(_0x5a6b0a,null));}; \ No newline at end of file diff --git a/server/api/intDeskConfiguration/intDeskConfiguration.model.js b/server/api/intDeskConfiguration/intDeskConfiguration.model.js index dff1957..3cce026 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 _0x127e=['request-promise','path','rimraf','./intDeskConfiguration.attributes','int_desk_configurations','lodash','util','api','moment'];(function(_0x550838,_0x3dfd85){var _0x4168ce=function(_0x476e4e){while(--_0x476e4e){_0x550838['push'](_0x550838['shift']());}};_0x4168ce(++_0x3dfd85);}(_0x127e,0x1be));var _0xe127=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x127e[_0x20a584];return _0x4b41a8;};'use strict';var _=require(_0xe127('0x0'));var util=require(_0xe127('0x1'));var logger=require('../../config/logger')(_0xe127('0x2'));var moment=require(_0xe127('0x3'));var BPromise=require('bluebird');var rp=require(_0xe127('0x4'));var fs=require('fs');var path=require(_0xe127('0x5'));var rimraf=require(_0xe127('0x6'));var config=require('../../config/environment');var attributes=require(_0xe127('0x7'));module['exports']=function(_0x41c6dd,_0x5e8f78){return _0x41c6dd['define']('DeskConfiguration',attributes,{'tableName':_0xe127('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x3640=['path','rimraf','../../config/environment','exports','lodash','../../config/logger','api','moment','request-promise'];(function(_0x42cae2,_0x284ef8){var _0x5f256f=function(_0x41abc8){while(--_0x41abc8){_0x42cae2['push'](_0x42cae2['shift']());}};_0x5f256f(++_0x284ef8);}(_0x3640,0xdc));var _0x0364=function(_0x4154a6,_0x2c0b8e){_0x4154a6=_0x4154a6-0x0;var _0x3b2786=_0x3640[_0x4154a6];return _0x3b2786;};'use strict';var _=require(_0x0364('0x0'));var util=require('util');var logger=require(_0x0364('0x1'))(_0x0364('0x2'));var moment=require(_0x0364('0x3'));var BPromise=require('bluebird');var rp=require(_0x0364('0x4'));var fs=require('fs');var path=require(_0x0364('0x5'));var rimraf=require(_0x0364('0x6'));var config=require(_0x0364('0x7'));var attributes=require('./intDeskConfiguration.attributes');module[_0x0364('0x8')]=function(_0x321f93,_0x14bbce){return _0x321f93['define']('DeskConfiguration',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 985f1d9..3d16a6d 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 _0x8278=['rpc','jayson/promise','client','http','request','then','info','DeskConfiguration,\x20%s,\x20%s','debug','DeskConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','util','moment','bluebird','../../mysqldb','../../config/utils','../../config/logger'];(function(_0x565ac7,_0x304c66){var _0x177708=function(_0x1954f3){while(--_0x1954f3){_0x565ac7['push'](_0x565ac7['shift']());}};_0x177708(++_0x304c66);}(_0x8278,0x1ae));var _0x8827=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x8278[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x8827('0x0'));var util=require(_0x8827('0x1'));var moment=require(_0x8827('0x2'));var BPromise=require(_0x8827('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x8827('0x4'))['db'];var utils=require(_0x8827('0x5'));var logger=require(_0x8827('0x6'))(_0x8827('0x7'));var config=require('../../config/environment');var jayson=require(_0x8827('0x8'));var client=jayson[_0x8827('0x9')][_0x8827('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x31d236,_0x2b674e,_0xfb36a9){return new BPromise(function(_0xb78af,_0x24af1d){return client[_0x8827('0xb')](_0x31d236,_0xfb36a9)[_0x8827('0xc')](function(_0x3c1ba6){logger[_0x8827('0xd')](_0x8827('0xe'),_0x2b674e,'request\x20sent');logger[_0x8827('0xf')](_0x8827('0x10'),_0x2b674e,'request\x20sent',JSON[_0x8827('0x11')](_0x3c1ba6));if(_0x3c1ba6[_0x8827('0x12')]){if(_0x3c1ba6['error'][_0x8827('0x13')]===0x1f4){logger['error']('DeskConfiguration,\x20%s,\x20%s',_0x2b674e,_0x3c1ba6[_0x8827('0x12')][_0x8827('0x14')]);return _0x24af1d(_0x3c1ba6[_0x8827('0x12')][_0x8827('0x14')]);}logger['error'](_0x8827('0xe'),_0x2b674e,_0x3c1ba6[_0x8827('0x12')][_0x8827('0x14')]);return _0xb78af(_0x3c1ba6[_0x8827('0x12')][_0x8827('0x14')]);}else{logger[_0x8827('0xd')](_0x8827('0xe'),_0x2b674e,'request\x20sent');_0xb78af(_0x3c1ba6[_0x8827('0x15')][_0x8827('0x14')]);}})[_0x8827('0x16')](function(_0x5b1370){logger[_0x8827('0x12')](_0x8827('0xe'),_0x2b674e,_0x5b1370);_0x24af1d(_0x5b1370);});});} \ No newline at end of file +var _0x0e35=['../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','request','then','info','DeskConfiguration,\x20%s,\x20%s','request\x20sent','debug','DeskConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis'];(function(_0x179420,_0x32aa73){var _0x5e556a=function(_0x330216){while(--_0x330216){_0x179420['push'](_0x179420['shift']());}};_0x5e556a(++_0x32aa73);}(_0x0e35,0xc2));var _0x50e3=function(_0x107704,_0x5b0de0){_0x107704=_0x107704-0x0;var _0x159551=_0x0e35[_0x107704];return _0x159551;};'use strict';var _=require(_0x50e3('0x0'));var util=require(_0x50e3('0x1'));var moment=require(_0x50e3('0x2'));var BPromise=require(_0x50e3('0x3'));var rs=require(_0x50e3('0x4'));var fs=require('fs');var Redis=require(_0x50e3('0x5'));var db=require(_0x50e3('0x6'))['db'];var utils=require(_0x50e3('0x7'));var logger=require(_0x50e3('0x8'))(_0x50e3('0x9'));var config=require('../../config/environment');var jayson=require(_0x50e3('0xa'));var client=jayson[_0x50e3('0xb')]['http']({'port':0x232a});function respondWithRpcPromise(_0x5defe6,_0x2ac084,_0x1ed6ec){return new BPromise(function(_0x57bb5f,_0x48382f){return client[_0x50e3('0xc')](_0x5defe6,_0x1ed6ec)[_0x50e3('0xd')](function(_0x3e0a06){logger[_0x50e3('0xe')](_0x50e3('0xf'),_0x2ac084,_0x50e3('0x10'));logger[_0x50e3('0x11')](_0x50e3('0x12'),_0x2ac084,_0x50e3('0x10'),JSON[_0x50e3('0x13')](_0x3e0a06));if(_0x3e0a06[_0x50e3('0x14')]){if(_0x3e0a06[_0x50e3('0x14')][_0x50e3('0x15')]===0x1f4){logger['error'](_0x50e3('0xf'),_0x2ac084,_0x3e0a06[_0x50e3('0x14')][_0x50e3('0x16')]);return _0x48382f(_0x3e0a06[_0x50e3('0x14')]['message']);}logger[_0x50e3('0x14')](_0x50e3('0xf'),_0x2ac084,_0x3e0a06['error'][_0x50e3('0x16')]);return _0x57bb5f(_0x3e0a06[_0x50e3('0x14')][_0x50e3('0x16')]);}else{logger[_0x50e3('0xe')](_0x50e3('0xf'),_0x2ac084,'request\x20sent');_0x57bb5f(_0x3e0a06[_0x50e3('0x17')]['message']);}})[_0x50e3('0x18')](function(_0x1bf9df){logger[_0x50e3('0x14')]('DeskConfiguration,\x20%s,\x20%s',_0x2ac084,_0x1bf9df);_0x48382f(_0x1bf9df);});});} \ No newline at end of file diff --git a/server/api/intDeskField/index.js b/server/api/intDeskField/index.js index f1a0de8..96079c6 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 _0xfc87=['path','connect-timeout','express','Router','../../components/interaction/service','../../config/environment','./intDeskField.controller','get','isAuthenticated','index','show','create','put','/:id','destroy','multer','util'];(function(_0x167cc1,_0x56ef5a){var _0x10bc4b=function(_0xd6a255){while(--_0xd6a255){_0x167cc1['push'](_0x167cc1['shift']());}};_0x10bc4b(++_0x56ef5a);}(_0xfc87,0x174));var _0x7fc8=function(_0x16dc82,_0x24d9ed){_0x16dc82=_0x16dc82-0x0;var _0x218b14=_0xfc87[_0x16dc82];return _0x218b14;};'use strict';var multer=require(_0x7fc8('0x0'));var util=require(_0x7fc8('0x1'));var path=require(_0x7fc8('0x2'));var timeout=require(_0x7fc8('0x3'));var express=require(_0x7fc8('0x4'));var router=express[_0x7fc8('0x5')]();var auth=require('../../components/auth/service');var interaction=require(_0x7fc8('0x6'));var config=require(_0x7fc8('0x7'));var controller=require(_0x7fc8('0x8'));router[_0x7fc8('0x9')]('/',auth[_0x7fc8('0xa')](),controller[_0x7fc8('0xb')]);router[_0x7fc8('0x9')]('/:id',auth['isAuthenticated'](),controller[_0x7fc8('0xc')]);router['post']('/',auth[_0x7fc8('0xa')](),controller[_0x7fc8('0xd')]);router[_0x7fc8('0xe')]('/:id',auth['isAuthenticated'](),controller['update']);router['delete'](_0x7fc8('0xf'),auth['isAuthenticated'](),controller[_0x7fc8('0x10')]);module['exports']=router; \ No newline at end of file +var _0x1c23=['isAuthenticated','create','put','update','delete','destroy','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','./intDeskField.controller','get','index','/:id','post'];(function(_0xeb75d3,_0x1dcea2){var _0x40063a=function(_0x1d160c){while(--_0x1d160c){_0xeb75d3['push'](_0xeb75d3['shift']());}};_0x40063a(++_0x1dcea2);}(_0x1c23,0x8e));var _0x31c2=function(_0x4391db,_0x18f254){_0x4391db=_0x4391db-0x0;var _0x51cb84=_0x1c23[_0x4391db];return _0x51cb84;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x31c2('0x0'));var timeout=require(_0x31c2('0x1'));var express=require(_0x31c2('0x2'));var router=express[_0x31c2('0x3')]();var auth=require(_0x31c2('0x4'));var interaction=require(_0x31c2('0x5'));var config=require('../../config/environment');var controller=require(_0x31c2('0x6'));router[_0x31c2('0x7')]('/',auth['isAuthenticated'](),controller[_0x31c2('0x8')]);router[_0x31c2('0x7')](_0x31c2('0x9'),auth['isAuthenticated'](),controller['show']);router[_0x31c2('0xa')]('/',auth[_0x31c2('0xb')](),controller[_0x31c2('0xc')]);router[_0x31c2('0xd')]('/:id',auth[_0x31c2('0xb')](),controller[_0x31c2('0xe')]);router[_0x31c2('0xf')](_0x31c2('0x9'),auth[_0x31c2('0xb')](),controller[_0x31c2('0x10')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/intDeskField/intDeskField.attributes.js b/server/api/intDeskField/intDeskField.attributes.js index 02f46c5..6524ffa 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 _0x6fbf=['customVariable','keyValue','STRING','ENUM','BOOLEAN','exports','string'];(function(_0xfec4f2,_0x27b2aa){var _0x4ee052=function(_0x195ba5){while(--_0x195ba5){_0xfec4f2['push'](_0xfec4f2['shift']());}};_0x4ee052(++_0x27b2aa);}(_0x6fbf,0x91));var _0xf6fb=function(_0x2a2166,_0x3a077f){_0x2a2166=_0x2a2166-0x0;var _0x3bcf50=_0x6fbf[_0x2a2166];return _0x3bcf50;};'use strict';var Sequelize=require('sequelize');module[_0xf6fb('0x0')]={'type':{'type':Sequelize['ENUM'](_0xf6fb('0x1'),'variable',_0xf6fb('0x2'),_0xf6fb('0x3')),'defaultValue':_0xf6fb('0x1')},'content':{'type':Sequelize['STRING']},'key':{'type':Sequelize[_0xf6fb('0x4')]},'keyType':{'type':Sequelize[_0xf6fb('0x5')](_0xf6fb('0x1'),'variable',_0xf6fb('0x2'))},'keyContent':{'type':Sequelize[_0xf6fb('0x4')]},'idField':{'type':Sequelize['STRING']},'nameField':{'type':Sequelize['STRING']},'customField':{'type':Sequelize[_0xf6fb('0x6')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0xf6fb('0x4')]}}; \ No newline at end of file +var _0x682e=['string','variable','customVariable','STRING','BOOLEAN'];(function(_0x36884e,_0x48008f){var _0x1cc367=function(_0x388a78){while(--_0x388a78){_0x36884e['push'](_0x36884e['shift']());}};_0x1cc367(++_0x48008f);}(_0x682e,0x1d6));var _0xe682=function(_0x57f7c9,_0x4c307d){_0x57f7c9=_0x57f7c9-0x0;var _0x4d21ab=_0x682e[_0x57f7c9];return _0x4d21ab;};'use strict';var Sequelize=require('sequelize');module['exports']={'type':{'type':Sequelize['ENUM'](_0xe682('0x0'),_0xe682('0x1'),_0xe682('0x2'),'keyValue'),'defaultValue':'string'},'content':{'type':Sequelize[_0xe682('0x3')]},'key':{'type':Sequelize[_0xe682('0x3')]},'keyType':{'type':Sequelize['ENUM'](_0xe682('0x0'),'variable',_0xe682('0x2'))},'keyContent':{'type':Sequelize[_0xe682('0x3')]},'idField':{'type':Sequelize[_0xe682('0x3')]},'nameField':{'type':Sequelize[_0xe682('0x3')]},'customField':{'type':Sequelize[_0xe682('0x4')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0xe682('0x3')]}}; \ No newline at end of file diff --git a/server/api/intDeskField/intDeskField.controller.js b/server/api/intDeskField/intDeskField.controller.js index 7304f94..cdaf008 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 _0x07c3=['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/advancedSearch','../../config/license/hardware','../../config/logger','api','../../mysqldb','status','end','json','count','offset','limit','set','Content-Range','apply','reject','then','sendStatus','stack','send','index','map','rawAttributes','fieldName','type','key','model','name','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','order','sort','where','pick','filter','merge','DeskField','include','findAll','rows','catch','show','params','find','create','body','update','destroy','html-pdf','eml-format','rimraf'];(function(_0x43b3d8,_0x5bd44d){var _0x2323a7=function(_0x3ae51b){while(--_0x3ae51b){_0x43b3d8['push'](_0x43b3d8['shift']());}};_0x2323a7(++_0x5bd44d);}(_0x07c3,0x1bf));var _0x307c=function(_0x29631f,_0xdb767){_0x29631f=_0x29631f-0x0;var _0x486d87=_0x07c3[_0x29631f];return _0x486d87;};'use strict';var pdf=require(_0x307c('0x0'));var emlformat=require(_0x307c('0x1'));var rimraf=require(_0x307c('0x2'));var zipdir=require(_0x307c('0x3'));var jsonpatch=require(_0x307c('0x4'));var rp=require(_0x307c('0x5'));var moment=require(_0x307c('0x6'));var BPromise=require(_0x307c('0x7'));var Mustache=require('mustache');var util=require(_0x307c('0x8'));var path=require(_0x307c('0x9'));var sox=require(_0x307c('0xa'));var csv=require(_0x307c('0xb'));var ejs=require(_0x307c('0xc'));var fs=require('fs');var _=require(_0x307c('0xd'));var squel=require(_0x307c('0xe'));var crypto=require(_0x307c('0xf'));var jsforce=require(_0x307c('0x10'));var deskjs=require(_0x307c('0x11'));var toCsv=require(_0x307c('0xb'));var querystring=require(_0x307c('0x12'));var Papa=require(_0x307c('0x13'));var Redis=require(_0x307c('0x14'));var authService=require(_0x307c('0x15'));var qs=require('../../components/parsers/qs');var as=require(_0x307c('0x16'));var hardwareService=require(_0x307c('0x17'));var logger=require(_0x307c('0x18'))(_0x307c('0x19'));var utils=require('../../config/utils');var config=require('../../config/environment');var db=require(_0x307c('0x1a'))['db'];function respondWithStatusCode(_0x478951,_0x3c21fb){_0x3c21fb=_0x3c21fb||0xcc;return function(_0x1a00ec){if(_0x1a00ec){return _0x478951['sendStatus'](_0x3c21fb);}return _0x478951[_0x307c('0x1b')](_0x3c21fb)[_0x307c('0x1c')]();};}function respondWithResult(_0x10534d,_0x45ef78){_0x45ef78=_0x45ef78||0xc8;return function(_0x4193d8){if(_0x4193d8){return _0x10534d[_0x307c('0x1b')](_0x45ef78)[_0x307c('0x1d')](_0x4193d8);}};}function respondWithFilteredResult(_0x46c5d8,_0x65678e){return function(_0x38f028){if(_0x38f028){var _0x405273=_0x38f028[_0x307c('0x1e')],_0x424a74=_0x65678e[_0x307c('0x1f')],_0x53e2f4=_0x65678e[_0x307c('0x1f')]+_0x65678e[_0x307c('0x20')],_0x2a3edc;if(_0x53e2f4>=_0x405273){_0x53e2f4=_0x405273;_0x2a3edc=0xc8;}else{_0x2a3edc=0xce;}_0x46c5d8[_0x307c('0x1b')](_0x2a3edc);return _0x46c5d8[_0x307c('0x21')](_0x307c('0x22'),_0x424a74+'-'+_0x53e2f4+'/'+_0x405273)[_0x307c('0x1d')](_0x38f028);}return null;};}function patchUpdates(_0x5e03d0){return function(_0x4922de){try{jsonpatch[_0x307c('0x23')](_0x4922de,_0x5e03d0,!![]);}catch(_0x4aa3c8){return BPromise[_0x307c('0x24')](_0x4aa3c8);}return _0x4922de['save']();};}function saveUpdates(_0x4cf649,_0x4bcc1a){return function(_0x25a503){if(_0x25a503){return _0x25a503['update'](_0x4cf649)[_0x307c('0x25')](function(_0xa79b24){return _0xa79b24;});}return null;};}function removeEntity(_0x5b640f,_0x1cdc48){return function(_0x45fe2){if(_0x45fe2){return _0x45fe2['destroy']()[_0x307c('0x25')](function(){_0x5b640f[_0x307c('0x1b')](0xcc)[_0x307c('0x1c')]();});}};}function handleEntityNotFound(_0x519985,_0x36802c){return function(_0x2b5f2f){if(!_0x2b5f2f){_0x519985[_0x307c('0x26')](0x194);}return _0x2b5f2f;};}function handleError(_0x383065,_0xa278fc){_0xa278fc=_0xa278fc||0x1f4;return function(_0x657402){logger['error'](_0x657402[_0x307c('0x27')]);if(_0x657402['name']){delete _0x657402['name'];}_0x383065[_0x307c('0x1b')](_0xa278fc)[_0x307c('0x28')](_0x657402);};}exports[_0x307c('0x29')]=function(_0x332e81,_0x25dede){var _0x1591d1={},_0x4fd125={},_0x1fbdda={'count':0x0,'rows':[]};var _0x181fa2=_[_0x307c('0x2a')](db['DeskField'][_0x307c('0x2b')],function(_0x1781ab){return{'name':_0x1781ab[_0x307c('0x2c')],'type':_0x1781ab[_0x307c('0x2d')][_0x307c('0x2e')]};});_0x4fd125[_0x307c('0x2f')]=_['map'](_0x181fa2,_0x307c('0x30'));_0x4fd125[_0x307c('0x31')]=_[_0x307c('0x32')](_0x332e81[_0x307c('0x31')]);_0x4fd125[_0x307c('0x33')]=_[_0x307c('0x34')](_0x4fd125[_0x307c('0x2f')],_0x4fd125[_0x307c('0x31')]);_0x1591d1[_0x307c('0x35')]=_['intersection'](_0x4fd125[_0x307c('0x2f')],qs[_0x307c('0x36')](_0x332e81[_0x307c('0x31')][_0x307c('0x36')]));_0x1591d1[_0x307c('0x35')]=_0x1591d1[_0x307c('0x35')][_0x307c('0x37')]?_0x1591d1[_0x307c('0x35')]:_0x4fd125[_0x307c('0x2f')];if(!_0x332e81[_0x307c('0x31')][_0x307c('0x38')]('nolimit')){_0x1591d1[_0x307c('0x20')]=qs[_0x307c('0x20')](_0x332e81['query'][_0x307c('0x20')]);_0x1591d1[_0x307c('0x1f')]=qs['offset'](_0x332e81[_0x307c('0x31')]['offset']);}_0x1591d1[_0x307c('0x39')]=qs[_0x307c('0x3a')](_0x332e81[_0x307c('0x31')][_0x307c('0x3a')]);_0x1591d1[_0x307c('0x3b')]=qs[_0x307c('0x33')](_[_0x307c('0x3c')](_0x332e81['query'],_0x4fd125[_0x307c('0x33')]));if(_0x332e81[_0x307c('0x31')][_0x307c('0x3d')]){_0x1591d1[_0x307c('0x3b')]=_[_0x307c('0x3e')](_0x1591d1[_0x307c('0x3b')],{'$or':_[_0x307c('0x2a')](_0x181fa2,function(_0x5da51b){if(_0x5da51b['type']!=='VIRTUAL'){var _0x456e1d={};_0x456e1d[_0x5da51b[_0x307c('0x30')]]={'$like':'%'+_0x332e81[_0x307c('0x31')]['filter']+'%'};return _0x456e1d;}})});}_0x1591d1=_[_0x307c('0x3e')]({},_0x1591d1,_0x332e81['options']);var _0x3d14c8={'where':_0x1591d1[_0x307c('0x3b')]};return db[_0x307c('0x3f')][_0x307c('0x1e')](_0x3d14c8)[_0x307c('0x25')](function(_0x70fc50){_0x1fbdda[_0x307c('0x1e')]=_0x70fc50;if(_0x332e81[_0x307c('0x31')]['includeAll']){_0x1591d1[_0x307c('0x40')]=[{'all':!![]}];}return db['DeskField'][_0x307c('0x41')](_0x1591d1);})['then'](function(_0x6b3b66){_0x1fbdda[_0x307c('0x42')]=_0x6b3b66;return _0x1fbdda;})[_0x307c('0x25')](respondWithFilteredResult(_0x25dede,_0x1591d1))[_0x307c('0x43')](handleError(_0x25dede,null));};exports[_0x307c('0x44')]=function(_0x2b34a7,_0x42c97e){var _0x45cc33={'raw':!![],'where':{'id':_0x2b34a7[_0x307c('0x45')]['id']}},_0x1ae04b={};_0x1ae04b[_0x307c('0x2f')]=_[_0x307c('0x32')](db['DeskField']['rawAttributes']);_0x1ae04b[_0x307c('0x31')]=_[_0x307c('0x32')](_0x2b34a7[_0x307c('0x31')]);_0x1ae04b[_0x307c('0x33')]=_[_0x307c('0x34')](_0x1ae04b[_0x307c('0x2f')],_0x1ae04b['query']);_0x45cc33['attributes']=_[_0x307c('0x34')](_0x1ae04b['model'],qs[_0x307c('0x36')](_0x2b34a7[_0x307c('0x31')][_0x307c('0x36')]));_0x45cc33['attributes']=_0x45cc33[_0x307c('0x35')][_0x307c('0x37')]?_0x45cc33[_0x307c('0x35')]:_0x1ae04b[_0x307c('0x2f')];if(_0x2b34a7[_0x307c('0x31')]['includeAll']){_0x45cc33[_0x307c('0x40')]=[{'all':!![]}];}_0x45cc33=_[_0x307c('0x3e')]({},_0x45cc33,_0x2b34a7['options']);return db[_0x307c('0x3f')][_0x307c('0x46')](_0x45cc33)[_0x307c('0x25')](handleEntityNotFound(_0x42c97e,null))[_0x307c('0x25')](respondWithResult(_0x42c97e,null))[_0x307c('0x43')](handleError(_0x42c97e,null));};exports[_0x307c('0x47')]=function(_0x1ac427,_0x5dbe31){return db[_0x307c('0x3f')][_0x307c('0x47')](_0x1ac427[_0x307c('0x48')],{})['then'](respondWithResult(_0x5dbe31,0xc9))[_0x307c('0x43')](handleError(_0x5dbe31,null));};exports[_0x307c('0x49')]=function(_0x2ced73,_0x3a5160){if(_0x2ced73['body']['id']){delete _0x2ced73[_0x307c('0x48')]['id'];}return db['DeskField']['find']({'where':{'id':_0x2ced73['params']['id']}})[_0x307c('0x25')](handleEntityNotFound(_0x3a5160,null))[_0x307c('0x25')](saveUpdates(_0x2ced73[_0x307c('0x48')],null))[_0x307c('0x25')](respondWithResult(_0x3a5160,null))['catch'](handleError(_0x3a5160,null));};exports[_0x307c('0x4a')]=function(_0x42263f,_0x398ef5){return db[_0x307c('0x3f')][_0x307c('0x46')]({'where':{'id':_0x42263f[_0x307c('0x45')]['id']}})[_0x307c('0x25')](handleEntityNotFound(_0x398ef5,null))['then'](removeEntity(_0x398ef5,null))['catch'](handleError(_0x398ef5,null));}; \ No newline at end of file +var _0x4b19=['then','destroy','error','stack','name','send','map','DeskField','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','count','includeAll','findAll','rows','catch','show','find','create','body','params','html-pdf','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','path','sox','ejs','lodash','crypto','jsforce','desk.js','querystring','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../mysqldb','status','end','offset','limit','set','Content-Range','json','apply','save','update'];(function(_0x2b737c,_0x274adf){var _0x466ed5=function(_0x593124){while(--_0x593124){_0x2b737c['push'](_0x2b737c['shift']());}};_0x466ed5(++_0x274adf);}(_0x4b19,0x195));var _0x94b1=function(_0x588cf2,_0x2e250a){_0x588cf2=_0x588cf2-0x0;var _0x437057=_0x4b19[_0x588cf2];return _0x437057;};'use strict';var pdf=require(_0x94b1('0x0'));var emlformat=require('eml-format');var rimraf=require(_0x94b1('0x1'));var zipdir=require(_0x94b1('0x2'));var jsonpatch=require(_0x94b1('0x3'));var rp=require('request-promise');var moment=require(_0x94b1('0x4'));var BPromise=require(_0x94b1('0x5'));var Mustache=require(_0x94b1('0x6'));var util=require('util');var path=require(_0x94b1('0x7'));var sox=require(_0x94b1('0x8'));var csv=require('to-csv');var ejs=require(_0x94b1('0x9'));var fs=require('fs');var _=require(_0x94b1('0xa'));var squel=require('squel');var crypto=require(_0x94b1('0xb'));var jsforce=require(_0x94b1('0xc'));var deskjs=require(_0x94b1('0xd'));var toCsv=require('to-csv');var querystring=require(_0x94b1('0xe'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x94b1('0xf'));var qs=require(_0x94b1('0x10'));var as=require(_0x94b1('0x11'));var hardwareService=require(_0x94b1('0x12'));var logger=require(_0x94b1('0x13'))(_0x94b1('0x14'));var utils=require('../../config/utils');var config=require(_0x94b1('0x15'));var db=require(_0x94b1('0x16'))['db'];function respondWithStatusCode(_0x340a29,_0x2b378c){_0x2b378c=_0x2b378c||0xcc;return function(_0x5cbf96){if(_0x5cbf96){return _0x340a29['sendStatus'](_0x2b378c);}return _0x340a29[_0x94b1('0x17')](_0x2b378c)[_0x94b1('0x18')]();};}function respondWithResult(_0x57de2f,_0x5059d8){_0x5059d8=_0x5059d8||0xc8;return function(_0x9329c9){if(_0x9329c9){return _0x57de2f[_0x94b1('0x17')](_0x5059d8)['json'](_0x9329c9);}};}function respondWithFilteredResult(_0x3f3eab,_0x58fab3){return function(_0x4ea6a4){if(_0x4ea6a4){var _0x192c03=_0x4ea6a4['count'],_0x1f0560=_0x58fab3[_0x94b1('0x19')],_0x258e98=_0x58fab3[_0x94b1('0x19')]+_0x58fab3[_0x94b1('0x1a')],_0x1977f4;if(_0x258e98>=_0x192c03){_0x258e98=_0x192c03;_0x1977f4=0xc8;}else{_0x1977f4=0xce;}_0x3f3eab[_0x94b1('0x17')](_0x1977f4);return _0x3f3eab[_0x94b1('0x1b')](_0x94b1('0x1c'),_0x1f0560+'-'+_0x258e98+'/'+_0x192c03)[_0x94b1('0x1d')](_0x4ea6a4);}return null;};}function patchUpdates(_0x59d7cf){return function(_0x30f969){try{jsonpatch[_0x94b1('0x1e')](_0x30f969,_0x59d7cf,!![]);}catch(_0x1fcb91){return BPromise['reject'](_0x1fcb91);}return _0x30f969[_0x94b1('0x1f')]();};}function saveUpdates(_0x32f329,_0x4c40c5){return function(_0x602c3b){if(_0x602c3b){return _0x602c3b[_0x94b1('0x20')](_0x32f329)[_0x94b1('0x21')](function(_0x2ed3b7){return _0x2ed3b7;});}return null;};}function removeEntity(_0x3a9c3c,_0x38448d){return function(_0x36180a){if(_0x36180a){return _0x36180a[_0x94b1('0x22')]()[_0x94b1('0x21')](function(){_0x3a9c3c[_0x94b1('0x17')](0xcc)['end']();});}};}function handleEntityNotFound(_0xa333a8,_0xa112b1){return function(_0x34c324){if(!_0x34c324){_0xa333a8['sendStatus'](0x194);}return _0x34c324;};}function handleError(_0x374611,_0x5af4f5){_0x5af4f5=_0x5af4f5||0x1f4;return function(_0x269925){logger[_0x94b1('0x23')](_0x269925[_0x94b1('0x24')]);if(_0x269925[_0x94b1('0x25')]){delete _0x269925['name'];}_0x374611['status'](_0x5af4f5)[_0x94b1('0x26')](_0x269925);};}exports['index']=function(_0x1aa525,_0x5c3a9a){var _0x4694de={},_0x2f06b1={},_0x1eda8c={'count':0x0,'rows':[]};var _0x4c2732=_[_0x94b1('0x27')](db[_0x94b1('0x28')][_0x94b1('0x29')],function(_0x319618){return{'name':_0x319618[_0x94b1('0x2a')],'type':_0x319618[_0x94b1('0x2b')][_0x94b1('0x2c')]};});_0x2f06b1[_0x94b1('0x2d')]=_[_0x94b1('0x27')](_0x4c2732,'name');_0x2f06b1[_0x94b1('0x2e')]=_[_0x94b1('0x2f')](_0x1aa525['query']);_0x2f06b1[_0x94b1('0x30')]=_[_0x94b1('0x31')](_0x2f06b1[_0x94b1('0x2d')],_0x2f06b1[_0x94b1('0x2e')]);_0x4694de[_0x94b1('0x32')]=_[_0x94b1('0x31')](_0x2f06b1['model'],qs[_0x94b1('0x33')](_0x1aa525['query'][_0x94b1('0x33')]));_0x4694de['attributes']=_0x4694de['attributes'][_0x94b1('0x34')]?_0x4694de[_0x94b1('0x32')]:_0x2f06b1[_0x94b1('0x2d')];if(!_0x1aa525[_0x94b1('0x2e')][_0x94b1('0x35')](_0x94b1('0x36'))){_0x4694de[_0x94b1('0x1a')]=qs[_0x94b1('0x1a')](_0x1aa525[_0x94b1('0x2e')][_0x94b1('0x1a')]);_0x4694de[_0x94b1('0x19')]=qs[_0x94b1('0x19')](_0x1aa525['query']['offset']);}_0x4694de[_0x94b1('0x37')]=qs[_0x94b1('0x38')](_0x1aa525[_0x94b1('0x2e')][_0x94b1('0x38')]);_0x4694de[_0x94b1('0x39')]=qs[_0x94b1('0x30')](_[_0x94b1('0x3a')](_0x1aa525[_0x94b1('0x2e')],_0x2f06b1[_0x94b1('0x30')]));if(_0x1aa525['query'][_0x94b1('0x3b')]){_0x4694de['where']=_[_0x94b1('0x3c')](_0x4694de[_0x94b1('0x39')],{'$or':_[_0x94b1('0x27')](_0x4c2732,function(_0x586ae0){if(_0x586ae0[_0x94b1('0x2b')]!==_0x94b1('0x3d')){var _0x27c9e4={};_0x27c9e4[_0x586ae0['name']]={'$like':'%'+_0x1aa525[_0x94b1('0x2e')][_0x94b1('0x3b')]+'%'};return _0x27c9e4;}})});}_0x4694de=_[_0x94b1('0x3c')]({},_0x4694de,_0x1aa525[_0x94b1('0x3e')]);var _0x3e5b02={'where':_0x4694de[_0x94b1('0x39')]};return db[_0x94b1('0x28')][_0x94b1('0x3f')](_0x3e5b02)[_0x94b1('0x21')](function(_0x2d6f38){_0x1eda8c[_0x94b1('0x3f')]=_0x2d6f38;if(_0x1aa525[_0x94b1('0x2e')][_0x94b1('0x40')]){_0x4694de['include']=[{'all':!![]}];}return db[_0x94b1('0x28')][_0x94b1('0x41')](_0x4694de);})[_0x94b1('0x21')](function(_0x44d53d){_0x1eda8c[_0x94b1('0x42')]=_0x44d53d;return _0x1eda8c;})['then'](respondWithFilteredResult(_0x5c3a9a,_0x4694de))[_0x94b1('0x43')](handleError(_0x5c3a9a,null));};exports[_0x94b1('0x44')]=function(_0x186575,_0x300747){var _0x3cf664={'raw':!![],'where':{'id':_0x186575['params']['id']}},_0x2c9398={};_0x2c9398[_0x94b1('0x2d')]=_[_0x94b1('0x2f')](db['DeskField'][_0x94b1('0x29')]);_0x2c9398[_0x94b1('0x2e')]=_['keys'](_0x186575[_0x94b1('0x2e')]);_0x2c9398[_0x94b1('0x30')]=_[_0x94b1('0x31')](_0x2c9398['model'],_0x2c9398[_0x94b1('0x2e')]);_0x3cf664[_0x94b1('0x32')]=_[_0x94b1('0x31')](_0x2c9398[_0x94b1('0x2d')],qs[_0x94b1('0x33')](_0x186575[_0x94b1('0x2e')][_0x94b1('0x33')]));_0x3cf664['attributes']=_0x3cf664[_0x94b1('0x32')][_0x94b1('0x34')]?_0x3cf664[_0x94b1('0x32')]:_0x2c9398['model'];if(_0x186575[_0x94b1('0x2e')][_0x94b1('0x40')]){_0x3cf664['include']=[{'all':!![]}];}_0x3cf664=_[_0x94b1('0x3c')]({},_0x3cf664,_0x186575[_0x94b1('0x3e')]);return db[_0x94b1('0x28')][_0x94b1('0x45')](_0x3cf664)[_0x94b1('0x21')](handleEntityNotFound(_0x300747,null))[_0x94b1('0x21')](respondWithResult(_0x300747,null))[_0x94b1('0x43')](handleError(_0x300747,null));};exports[_0x94b1('0x46')]=function(_0x24f906,_0xe2381d){return db[_0x94b1('0x28')][_0x94b1('0x46')](_0x24f906[_0x94b1('0x47')],{})[_0x94b1('0x21')](respondWithResult(_0xe2381d,0xc9))[_0x94b1('0x43')](handleError(_0xe2381d,null));};exports[_0x94b1('0x20')]=function(_0xfe1c8f,_0x2b22ee){if(_0xfe1c8f[_0x94b1('0x47')]['id']){delete _0xfe1c8f['body']['id'];}return db[_0x94b1('0x28')]['find']({'where':{'id':_0xfe1c8f[_0x94b1('0x48')]['id']}})[_0x94b1('0x21')](handleEntityNotFound(_0x2b22ee,null))[_0x94b1('0x21')](saveUpdates(_0xfe1c8f['body'],null))['then'](respondWithResult(_0x2b22ee,null))['catch'](handleError(_0x2b22ee,null));};exports[_0x94b1('0x22')]=function(_0x43f072,_0x276ab1){return db['DeskField']['find']({'where':{'id':_0x43f072['params']['id']}})[_0x94b1('0x21')](handleEntityNotFound(_0x276ab1,null))[_0x94b1('0x21')](removeEntity(_0x276ab1,null))[_0x94b1('0x43')](handleError(_0x276ab1,null));}; \ No newline at end of file diff --git a/server/api/intDeskField/intDeskField.model.js b/server/api/intDeskField/intDeskField.model.js index 8c54ece..3b4191f 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 _0xdbab=['lodash','util','../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment','./intDeskField.attributes','exports','define','DeskField','int_desk_fields','idField','FieldId'];(function(_0x4e5138,_0x2ccb70){var _0x473da5=function(_0xe83bd1){while(--_0xe83bd1){_0x4e5138['push'](_0x4e5138['shift']());}};_0x473da5(++_0x2ccb70);}(_0xdbab,0x110));var _0xbdba=function(_0x4b6420,_0x126201){_0x4b6420=_0x4b6420-0x0;var _0x37076f=_0xdbab[_0x4b6420];return _0x37076f;};'use strict';var _=require(_0xbdba('0x0'));var util=require(_0xbdba('0x1'));var logger=require(_0xbdba('0x2'))(_0xbdba('0x3'));var moment=require(_0xbdba('0x4'));var BPromise=require(_0xbdba('0x5'));var rp=require(_0xbdba('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0xbdba('0x7'));var config=require(_0xbdba('0x8'));var attributes=require(_0xbdba('0x9'));module[_0xbdba('0xa')]=function(_0x21ce41,_0x3aa80b){return _0x21ce41[_0xbdba('0xb')](_0xbdba('0xc'),attributes,{'tableName':_0xbdba('0xd'),'paranoid':![],'indexes':[{'name':'desk_unique_index','fields':[_0xbdba('0xe'),_0xbdba('0xf')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0x3edd=['rimraf','../../config/environment','./intDeskField.attributes','exports','int_desk_fields','desk_unique_index','idField','FieldId','lodash','util','../../config/logger','api','moment','bluebird'];(function(_0x278a91,_0x4b4297){var _0x99d497=function(_0x19a299){while(--_0x19a299){_0x278a91['push'](_0x278a91['shift']());}};_0x99d497(++_0x4b4297);}(_0x3edd,0x104));var _0xd3ed=function(_0x97bf63,_0x499da7){_0x97bf63=_0x97bf63-0x0;var _0x25b6b5=_0x3edd[_0x97bf63];return _0x25b6b5;};'use strict';var _=require(_0xd3ed('0x0'));var util=require(_0xd3ed('0x1'));var logger=require(_0xd3ed('0x2'))(_0xd3ed('0x3'));var moment=require(_0xd3ed('0x4'));var BPromise=require(_0xd3ed('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0xd3ed('0x6'));var config=require(_0xd3ed('0x7'));var attributes=require(_0xd3ed('0x8'));module[_0xd3ed('0x9')]=function(_0x113905,_0x53c071){return _0x113905['define']('DeskField',attributes,{'tableName':_0xd3ed('0xa'),'paranoid':![],'indexes':[{'name':_0xd3ed('0xb'),'fields':[_0xd3ed('0xc'),_0xd3ed('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 822ec7b..11d7d81 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 _0x0f06=['jayson/promise','client','http','request','then','DeskField,\x20%s,\x20%s','request\x20sent','error','code','message','info','result','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc'];(function(_0x137b8c,_0x3a98fe){var _0x5386c7=function(_0x37184d){while(--_0x37184d){_0x137b8c['push'](_0x137b8c['shift']());}};_0x5386c7(++_0x3a98fe);}(_0x0f06,0x110));var _0x60f0=function(_0x559da0,_0x371559){_0x559da0=_0x559da0-0x0;var _0x284239=_0x0f06[_0x559da0];return _0x284239;};'use strict';var _=require(_0x60f0('0x0'));var util=require('util');var moment=require(_0x60f0('0x1'));var BPromise=require(_0x60f0('0x2'));var rs=require(_0x60f0('0x3'));var fs=require('fs');var Redis=require(_0x60f0('0x4'));var db=require(_0x60f0('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x60f0('0x6'))(_0x60f0('0x7'));var config=require('../../config/environment');var jayson=require(_0x60f0('0x8'));var client=jayson[_0x60f0('0x9')][_0x60f0('0xa')]({'port':0x232a});function respondWithRpcPromise(_0xb09005,_0x477de4,_0x225cda){return new BPromise(function(_0x1aa9ab,_0x31bac5){return client[_0x60f0('0xb')](_0xb09005,_0x225cda)[_0x60f0('0xc')](function(_0x433cb2){logger['info'](_0x60f0('0xd'),_0x477de4,'request\x20sent');logger['debug']('DeskField,\x20%s,\x20%s,\x20%s',_0x477de4,_0x60f0('0xe'),JSON['stringify'](_0x433cb2));if(_0x433cb2['error']){if(_0x433cb2[_0x60f0('0xf')][_0x60f0('0x10')]===0x1f4){logger[_0x60f0('0xf')](_0x60f0('0xd'),_0x477de4,_0x433cb2[_0x60f0('0xf')][_0x60f0('0x11')]);return _0x31bac5(_0x433cb2[_0x60f0('0xf')][_0x60f0('0x11')]);}logger[_0x60f0('0xf')](_0x60f0('0xd'),_0x477de4,_0x433cb2[_0x60f0('0xf')][_0x60f0('0x11')]);return _0x1aa9ab(_0x433cb2[_0x60f0('0xf')]['message']);}else{logger[_0x60f0('0x12')](_0x60f0('0xd'),_0x477de4,_0x60f0('0xe'));_0x1aa9ab(_0x433cb2[_0x60f0('0x13')][_0x60f0('0x11')]);}})['catch'](function(_0x57e749){logger[_0x60f0('0xf')](_0x60f0('0xd'),_0x477de4,_0x57e749);_0x31bac5(_0x57e749);});});} \ No newline at end of file +var _0x29f2=['client','http','request','then','info','DeskField,\x20%s,\x20%s','request\x20sent','debug','DeskField,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','lodash','moment','bluebird','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise'];(function(_0xae9b05,_0x438dd2){var _0x45f0a7=function(_0x19baf5){while(--_0x19baf5){_0xae9b05['push'](_0xae9b05['shift']());}};_0x45f0a7(++_0x438dd2);}(_0x29f2,0x1c3));var _0x229f=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x29f2[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x229f('0x0'));var util=require('util');var moment=require(_0x229f('0x1'));var BPromise=require(_0x229f('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x229f('0x3'))['db'];var utils=require(_0x229f('0x4'));var logger=require(_0x229f('0x5'))(_0x229f('0x6'));var config=require(_0x229f('0x7'));var jayson=require(_0x229f('0x8'));var client=jayson[_0x229f('0x9')][_0x229f('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x297a46,_0x83116f,_0x25748a){return new BPromise(function(_0x529a8e,_0x20559f){return client[_0x229f('0xb')](_0x297a46,_0x25748a)[_0x229f('0xc')](function(_0x3e1bf2){logger[_0x229f('0xd')](_0x229f('0xe'),_0x83116f,_0x229f('0xf'));logger[_0x229f('0x10')](_0x229f('0x11'),_0x83116f,'request\x20sent',JSON['stringify'](_0x3e1bf2));if(_0x3e1bf2['error']){if(_0x3e1bf2[_0x229f('0x12')][_0x229f('0x13')]===0x1f4){logger['error'](_0x229f('0xe'),_0x83116f,_0x3e1bf2['error'][_0x229f('0x14')]);return _0x20559f(_0x3e1bf2['error'][_0x229f('0x14')]);}logger[_0x229f('0x12')]('DeskField,\x20%s,\x20%s',_0x83116f,_0x3e1bf2[_0x229f('0x12')][_0x229f('0x14')]);return _0x529a8e(_0x3e1bf2['error'][_0x229f('0x14')]);}else{logger[_0x229f('0xd')]('DeskField,\x20%s,\x20%s',_0x83116f,_0x229f('0xf'));_0x529a8e(_0x3e1bf2[_0x229f('0x15')][_0x229f('0x14')]);}})[_0x229f('0x16')](function(_0x5034c2){logger[_0x229f('0x12')](_0x229f('0xe'),_0x83116f,_0x5034c2);_0x20559f(_0x5034c2);});});} \ No newline at end of file diff --git a/server/api/intDynamics365Account/index.js b/server/api/intDynamics365Account/index.js index a6e33a7..804faa0 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 _0xc5b4=['addConfiguration','put','/:id','delete','destroy','exports','multer','util','path','connect-timeout','express','../../components/auth/service','../../components/interaction/service','./intDynamics365Account.controller','isAuthenticated','get','show','getConfigurations','/:id/fields','getFields','post','create'];(function(_0x1eb5a8,_0xf4a39d){var _0x1055b4=function(_0x5dda08){while(--_0x5dda08){_0x1eb5a8['push'](_0x1eb5a8['shift']());}};_0x1055b4(++_0xf4a39d);}(_0xc5b4,0x150));var _0x4c5b=function(_0x2c5edd,_0x4513b6){_0x2c5edd=_0x2c5edd-0x0;var _0x5dd822=_0xc5b4[_0x2c5edd];return _0x5dd822;};'use strict';var multer=require(_0x4c5b('0x0'));var util=require(_0x4c5b('0x1'));var path=require(_0x4c5b('0x2'));var timeout=require(_0x4c5b('0x3'));var express=require(_0x4c5b('0x4'));var router=express['Router']();var auth=require(_0x4c5b('0x5'));var interaction=require(_0x4c5b('0x6'));var config=require('../../config/environment');var controller=require(_0x4c5b('0x7'));router['get']('/',auth[_0x4c5b('0x8')](),controller['index']);router[_0x4c5b('0x9')]('/:id',auth['isAuthenticated'](),controller[_0x4c5b('0xa')]);router[_0x4c5b('0x9')]('/:id/configurations',auth[_0x4c5b('0x8')](),controller[_0x4c5b('0xb')]);router[_0x4c5b('0x9')](_0x4c5b('0xc'),auth[_0x4c5b('0x8')](),controller[_0x4c5b('0xd')]);router[_0x4c5b('0xe')]('/',auth[_0x4c5b('0x8')](),controller[_0x4c5b('0xf')]);router[_0x4c5b('0xe')]('/:id/configurations',auth[_0x4c5b('0x8')](),controller[_0x4c5b('0x10')]);router[_0x4c5b('0x11')](_0x4c5b('0x12'),auth['isAuthenticated'](),controller['update']);router[_0x4c5b('0x13')]('/:id',auth[_0x4c5b('0x8')](),controller[_0x4c5b('0x14')]);module[_0x4c5b('0x15')]=router; \ No newline at end of file +var _0x3e18=['isAuthenticated','index','show','/:id/configurations','getConfigurations','get','/:id/fields','getFields','create','post','addConfiguration','update','delete','/:id','destroy','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../config/environment','./intDynamics365Account.controller'];(function(_0x3b380d,_0x4bf247){var _0x54502b=function(_0x35d207){while(--_0x35d207){_0x3b380d['push'](_0x3b380d['shift']());}};_0x54502b(++_0x4bf247);}(_0x3e18,0xb7));var _0x83e1=function(_0x4f6c3d,_0x58c96a){_0x4f6c3d=_0x4f6c3d-0x0;var _0x59f5b9=_0x3e18[_0x4f6c3d];return _0x59f5b9;};'use strict';var multer=require(_0x83e1('0x0'));var util=require(_0x83e1('0x1'));var path=require(_0x83e1('0x2'));var timeout=require(_0x83e1('0x3'));var express=require(_0x83e1('0x4'));var router=express[_0x83e1('0x5')]();var auth=require(_0x83e1('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x83e1('0x7'));var controller=require(_0x83e1('0x8'));router['get']('/',auth[_0x83e1('0x9')](),controller[_0x83e1('0xa')]);router['get']('/:id',auth[_0x83e1('0x9')](),controller[_0x83e1('0xb')]);router['get'](_0x83e1('0xc'),auth['isAuthenticated'](),controller[_0x83e1('0xd')]);router[_0x83e1('0xe')](_0x83e1('0xf'),auth[_0x83e1('0x9')](),controller[_0x83e1('0x10')]);router['post']('/',auth['isAuthenticated'](),controller[_0x83e1('0x11')]);router[_0x83e1('0x12')](_0x83e1('0xc'),auth['isAuthenticated'](),controller[_0x83e1('0x13')]);router['put']('/:id',auth[_0x83e1('0x9')](),controller[_0x83e1('0x14')]);router[_0x83e1('0x15')](_0x83e1('0x16'),auth[_0x83e1('0x9')](),controller[_0x83e1('0x17')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/intDynamics365Account/intDynamics365Account.attributes.js b/server/api/intDynamics365Account/intDynamics365Account.attributes.js index c9a8d71..7d83349 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 _0x54bf=['STRING'];(function(_0x4a45b4,_0x59804f){var _0x1a99c9=function(_0x3aa517){while(--_0x3aa517){_0x4a45b4['push'](_0x4a45b4['shift']());}};_0x1a99c9(++_0x59804f);}(_0x54bf,0x198));var _0xf54b=function(_0x200dd1,_0x5b702d){_0x200dd1=_0x200dd1-0x0;var _0x145ecd=_0x54bf[_0x200dd1];return _0x145ecd;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize[_0xf54b('0x0')]},'username':{'type':Sequelize[_0xf54b('0x0')]},'password':{'type':Sequelize[_0xf54b('0x0')]},'remoteUri':{'type':Sequelize[_0xf54b('0x0')]},'tenantId':{'type':Sequelize['STRING']},'clientId':{'type':Sequelize[_0xf54b('0x0')]},'clientSecret':{'type':Sequelize['STRING']},'serverUrl':{'type':Sequelize[_0xf54b('0x0')]},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0xeec6=['STRING','exports'];(function(_0x273c83,_0x2b2100){var _0x1ade28=function(_0x242135){while(--_0x242135){_0x273c83['push'](_0x273c83['shift']());}};_0x1ade28(++_0x2b2100);}(_0xeec6,0x1d5));var _0x6eec=function(_0x46aff0,_0x122890){_0x46aff0=_0x46aff0-0x0;var _0x9d78cf=_0xeec6[_0x46aff0];return _0x9d78cf;};'use strict';var Sequelize=require('sequelize');module[_0x6eec('0x0')]={'name':{'type':Sequelize[_0x6eec('0x1')]},'username':{'type':Sequelize['STRING']},'password':{'type':Sequelize[_0x6eec('0x1')]},'remoteUri':{'type':Sequelize[_0x6eec('0x1')]},'tenantId':{'type':Sequelize[_0x6eec('0x1')]},'clientId':{'type':Sequelize[_0x6eec('0x1')]},'clientSecret':{'type':Sequelize['STRING']},'serverUrl':{'type':Sequelize[_0x6eec('0x1')]},'description':{'type':Sequelize[_0x6eec('0x1')]}}; \ No newline at end of file diff --git a/server/api/intDynamics365Account/intDynamics365Account.controller.js b/server/api/intDynamics365Account/intDynamics365Account.controller.js index 1b5ae95..642987a 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 _0xa668=['includes','LogicalName','PicklistAttributeMetadata','push','MetadataId','all','forEach','isNil','@odata.type','BooleanAttributeMetadata','StringAttributeMetadata','MemoAttributeMetadata','EntityNameAttributeMetadata','StateAttributeMetadata','DecimalAttributeMetadata','concat','Wrong\x20credentials','statusCode',')/Microsoft.Dynamics.CRM.PicklistAttributeMetadata?','Options','Label','UserLocalizedLabel','DisplayName',')/Attributes(',')/Microsoft.Dynamics.CRM.BooleanAttributeMetadata?$select=DisplayName,LogicalName&$expand=OptionSet($select=FalseOption,\x20TrueOption)','OptionSet','TrueOption','true','FalseOption','false',')/Microsoft.Dynamics.CRM.','?$select=DisplayName,LogicalName','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','to-csv','ejs','lodash','squel','jsforce','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../components/integrations/configuration','client','http','test','Sequelize','ValidationError','The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.','request','then','info','request\x20sent','Dynamics365Account,\x20%s,\x20%s,\x20%s','stringify','error','code','Dynamics365Account,\x20%s,\x20%s','message','result','catch','sendStatus','status','end','json','count','offset','limit','destroy','stack','name','send','index','map','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','filter','merge','where','Dynamics365Account','includeAll','findAll','rows','show','length','include','options','find','create','body','update','params','getConfigurations','findOne','Dynamics365Configuration','pick','addConfiguration','AccountId','Subjects','getSubjects','Descriptions','Dynamics365Field','getFields','ticketType','customerid','ownerid','caseorigincode','phonenumber','regardingobjectid','directioncode','phonecall_activity_parties','accountidname','accountidyominame','actualserviceunits','contactidyominame','contractdetailidname','createdbyexternalpartyyominame','createdbyyominame','createdon','createdonbehalfbyname','customeridname','customeridyominame','emailaddress','entitlementidname','entityimage_timestamp','entityimage_url','escalatedon','exchangerate','firstresponsebykpiidname','followupby','influencescore','lastonholdtime','masteridname','modifiedbyexternalpartyname','modifiedbyyominame','modifiedon','modifiedonbehalfbyname','modifiedonbehalfbyyominame','msdyn_iotalertname','onholdtime','overriddencreatedon','owneridname','owneridyominame','parentcaseidname','primarycontactidname','primarycontactidyominame','productidname','productserialnumber','resolveby','responseby','responsiblecontactidyominame','sentimentvalue','slainvokedidname','socialprofileidname','statuscode','subjectidname','timezoneruleversionnumber','transactioncurrencyidname','password','remoteUri','tenantId','clientSecret','substring','lastIndexOf','format','%s/api/data/v9.0/','POST','/oauth2/token','clientId','username','access_token','EntityDefinitions?$select=DisplayName,EntitySetName&$filter=SchemaName\x20eq\x20\x27','Bearer\x20','4.0','value','GET','EntityDefinitions(',')?$select=LogicalName&$expand=Attributes($select=LogicalName)','Attributes'];(function(_0x15ab38,_0xf64703){var _0x388a44=function(_0x16fa83){while(--_0x16fa83){_0x15ab38['push'](_0x15ab38['shift']());}};_0x388a44(++_0xf64703);}(_0xa668,0xec));var _0x8a66=function(_0x3af6ed,_0x2f7f88){_0x3af6ed=_0x3af6ed-0x0;var _0x25b391=_0xa668[_0x3af6ed];return _0x25b391;};'use strict';var pdf=require(_0x8a66('0x0'));var emlformat=require(_0x8a66('0x1'));var rimraf=require(_0x8a66('0x2'));var zipdir=require(_0x8a66('0x3'));var jsonpatch=require(_0x8a66('0x4'));var rp=require(_0x8a66('0x5'));var moment=require(_0x8a66('0x6'));var BPromise=require(_0x8a66('0x7'));var Mustache=require(_0x8a66('0x8'));var util=require('util');var path=require(_0x8a66('0x9'));var sox=require(_0x8a66('0xa'));var csv=require(_0x8a66('0xb'));var ejs=require(_0x8a66('0xc'));var fs=require('fs');var _=require(_0x8a66('0xd'));var squel=require(_0x8a66('0xe'));var crypto=require('crypto');var jsforce=require(_0x8a66('0xf'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x8a66('0x10'));var Redis=require('ioredis');var authService=require(_0x8a66('0x11'));var qs=require(_0x8a66('0x12'));var as=require(_0x8a66('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x8a66('0x14'))('api');var utils=require(_0x8a66('0x15'));var config=require('../../config/environment');var db=require('../../mysqldb')['db'];var integrations=require(_0x8a66('0x16'));var jayson=require('jayson/promise');var client=jayson[_0x8a66('0x17')][_0x8a66('0x18')]({'port':0x232a});function checkPasswordPattern(_0x2c3396,_0x51d204,_0x111522){if(_0x111522){var _0x42d5d0=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x42d5d0[_0x8a66('0x19')](_0x51d204)){return _0x2c3396;}else{throw new db[(_0x8a66('0x1a'))][(_0x8a66('0x1b'))](_0x8a66('0x1c'));}}else{return _0x2c3396;}}function respondWithRpcPromise(_0x290a15,_0x20eb3d,_0x56f17e,_0x38e846){return new BPromise(function(_0x7e4516,_0x5819bb){var _0x503f22=_0x38e846||client;return _0x503f22[_0x8a66('0x1d')](_0x290a15,_0x56f17e)[_0x8a66('0x1e')](function(_0xaeba2c){logger[_0x8a66('0x1f')]('Dynamics365Account,\x20%s,\x20%s',_0x20eb3d,_0x8a66('0x20'));logger['debug'](_0x8a66('0x21'),_0x20eb3d,_0x8a66('0x20'),JSON[_0x8a66('0x22')](_0xaeba2c));if(_0xaeba2c[_0x8a66('0x23')]){if(_0xaeba2c[_0x8a66('0x23')][_0x8a66('0x24')]===0x1f4){logger[_0x8a66('0x23')](_0x8a66('0x25'),_0x20eb3d,_0xaeba2c[_0x8a66('0x23')][_0x8a66('0x26')]);return _0x5819bb(_0xaeba2c[_0x8a66('0x23')][_0x8a66('0x26')]);}logger['error'](_0x8a66('0x25'),_0x20eb3d,_0xaeba2c[_0x8a66('0x23')][_0x8a66('0x26')]);return _0x7e4516(_0xaeba2c['error']['message']);}else{logger[_0x8a66('0x1f')](_0x8a66('0x25'),_0x20eb3d,'request\x20sent');_0x7e4516(_0xaeba2c[_0x8a66('0x27')][_0x8a66('0x26')]);}})[_0x8a66('0x28')](function(_0x2a55cb){logger[_0x8a66('0x23')](_0x8a66('0x25'),_0x20eb3d,_0x2a55cb);_0x5819bb(_0x2a55cb);});});}function respondWithStatusCode(_0x2afc60,_0x4d6e99){_0x4d6e99=_0x4d6e99||0xcc;return function(_0x548eef){if(_0x548eef){return _0x2afc60[_0x8a66('0x29')](_0x4d6e99);}return _0x2afc60[_0x8a66('0x2a')](_0x4d6e99)[_0x8a66('0x2b')]();};}function respondWithResult(_0x133bae,_0x4257eb){_0x4257eb=_0x4257eb||0xc8;return function(_0x1700b3){if(_0x1700b3){return _0x133bae[_0x8a66('0x2a')](_0x4257eb)[_0x8a66('0x2c')](_0x1700b3);}};}function respondWithFilteredResult(_0x51979a,_0x32f921){return function(_0x1584ea){if(_0x1584ea){var _0x527917=_0x1584ea[_0x8a66('0x2d')],_0x121cf6=_0x32f921[_0x8a66('0x2e')],_0x1ce16a=_0x32f921[_0x8a66('0x2e')]+_0x32f921[_0x8a66('0x2f')],_0x47ee20;if(_0x1ce16a>=_0x527917){_0x1ce16a=_0x527917;_0x47ee20=0xc8;}else{_0x47ee20=0xce;}_0x51979a[_0x8a66('0x2a')](_0x47ee20);return _0x51979a['set']('Content-Range',_0x121cf6+'-'+_0x1ce16a+'/'+_0x527917)[_0x8a66('0x2c')](_0x1584ea);}return null;};}function patchUpdates(_0x39a5f0){return function(_0x3d6bac){try{jsonpatch['apply'](_0x3d6bac,_0x39a5f0,!![]);}catch(_0x1c5159){return BPromise['reject'](_0x1c5159);}return _0x3d6bac['save']();};}function saveUpdates(_0x3b8441,_0xe64aa){return function(_0x5ca10e){if(_0x5ca10e){return _0x5ca10e['update'](_0x3b8441)['then'](function(_0x1bcb3a){return _0x1bcb3a;});}return null;};}function removeEntity(_0x47f2a8,_0x50a033){return function(_0x27795e){if(_0x27795e){return _0x27795e[_0x8a66('0x30')]()['then'](function(){_0x47f2a8[_0x8a66('0x2a')](0xcc)[_0x8a66('0x2b')]();});}};}function handleEntityNotFound(_0x866e68,_0x2005b3){return function(_0x5dd1fc){if(!_0x5dd1fc){_0x866e68[_0x8a66('0x29')](0x194);}return _0x5dd1fc;};}function handleError(_0x3c2ed5,_0x495210){_0x495210=_0x495210||0x1f4;return function(_0x24a508){logger[_0x8a66('0x23')](_0x24a508[_0x8a66('0x31')]);if(_0x24a508[_0x8a66('0x32')]){delete _0x24a508[_0x8a66('0x32')];}_0x3c2ed5[_0x8a66('0x2a')](_0x495210)[_0x8a66('0x33')](_0x24a508);};}exports[_0x8a66('0x34')]=function(_0x3f0fc0,_0x9ed91){var _0x5869c6={},_0x117cfc={},_0x3abccf={'count':0x0,'rows':[]};var _0xea979c=_[_0x8a66('0x35')](db['Dynamics365Account'][_0x8a66('0x36')],function(_0x12b865){return{'name':_0x12b865[_0x8a66('0x37')],'type':_0x12b865[_0x8a66('0x38')][_0x8a66('0x39')]};});_0x117cfc[_0x8a66('0x3a')]=_['map'](_0xea979c,_0x8a66('0x32'));_0x117cfc[_0x8a66('0x3b')]=_[_0x8a66('0x3c')](_0x3f0fc0['query']);_0x117cfc[_0x8a66('0x3d')]=_[_0x8a66('0x3e')](_0x117cfc[_0x8a66('0x3a')],_0x117cfc[_0x8a66('0x3b')]);_0x5869c6[_0x8a66('0x3f')]=_[_0x8a66('0x3e')](_0x117cfc[_0x8a66('0x3a')],qs['fields'](_0x3f0fc0['query'][_0x8a66('0x40')]));_0x5869c6[_0x8a66('0x3f')]=_0x5869c6[_0x8a66('0x3f')]['length']?_0x5869c6['attributes']:_0x117cfc[_0x8a66('0x3a')];if(!_0x3f0fc0['query'][_0x8a66('0x41')](_0x8a66('0x42'))){_0x5869c6['limit']=qs[_0x8a66('0x2f')](_0x3f0fc0[_0x8a66('0x3b')][_0x8a66('0x2f')]);_0x5869c6[_0x8a66('0x2e')]=qs[_0x8a66('0x2e')](_0x3f0fc0[_0x8a66('0x3b')]['offset']);}_0x5869c6[_0x8a66('0x43')]=qs[_0x8a66('0x44')](_0x3f0fc0[_0x8a66('0x3b')]['sort']);_0x5869c6['where']=qs[_0x8a66('0x3d')](_['pick'](_0x3f0fc0[_0x8a66('0x3b')],_0x117cfc['filters']));if(_0x3f0fc0['query'][_0x8a66('0x45')]){_0x5869c6['where']=_[_0x8a66('0x46')](_0x5869c6['where'],{'$or':_['map'](_0xea979c,function(_0x42a275){if(_0x42a275[_0x8a66('0x38')]!=='VIRTUAL'){var _0x2f4b64={};_0x2f4b64[_0x42a275[_0x8a66('0x32')]]={'$like':'%'+_0x3f0fc0['query'][_0x8a66('0x45')]+'%'};return _0x2f4b64;}})});}_0x5869c6=_[_0x8a66('0x46')]({},_0x5869c6,_0x3f0fc0['options']);var _0x51bf34={'where':_0x5869c6[_0x8a66('0x47')]};return db[_0x8a66('0x48')][_0x8a66('0x2d')](_0x51bf34)['then'](function(_0x14752c){_0x3abccf[_0x8a66('0x2d')]=_0x14752c;if(_0x3f0fc0['query'][_0x8a66('0x49')]){_0x5869c6['include']=[{'all':!![]}];}return db['Dynamics365Account'][_0x8a66('0x4a')](_0x5869c6);})[_0x8a66('0x1e')](function(_0x38fae8){_0x3abccf[_0x8a66('0x4b')]=_0x38fae8;return _0x3abccf;})[_0x8a66('0x1e')](respondWithFilteredResult(_0x9ed91,_0x5869c6))[_0x8a66('0x28')](handleError(_0x9ed91,null));};exports[_0x8a66('0x4c')]=function(_0x18936a,_0x330d56){var _0x4b0615={'raw':![],'where':{'id':_0x18936a['params']['id']}},_0x14a2a3={};_0x14a2a3[_0x8a66('0x3a')]=_['keys'](db[_0x8a66('0x48')][_0x8a66('0x36')]);_0x14a2a3[_0x8a66('0x3b')]=_[_0x8a66('0x3c')](_0x18936a['query']);_0x14a2a3[_0x8a66('0x3d')]=_['intersection'](_0x14a2a3[_0x8a66('0x3a')],_0x14a2a3[_0x8a66('0x3b')]);_0x4b0615[_0x8a66('0x3f')]=_[_0x8a66('0x3e')](_0x14a2a3['model'],qs[_0x8a66('0x40')](_0x18936a['query'][_0x8a66('0x40')]));_0x4b0615[_0x8a66('0x3f')]=_0x4b0615[_0x8a66('0x3f')][_0x8a66('0x4d')]?_0x4b0615[_0x8a66('0x3f')]:_0x14a2a3[_0x8a66('0x3a')];if(_0x18936a[_0x8a66('0x3b')][_0x8a66('0x49')]){_0x4b0615[_0x8a66('0x4e')]=[{'all':!![]}];}_0x4b0615=_[_0x8a66('0x46')]({},_0x4b0615,_0x18936a[_0x8a66('0x4f')]);return db[_0x8a66('0x48')][_0x8a66('0x50')](_0x4b0615)['then'](handleEntityNotFound(_0x330d56,null))['then'](respondWithResult(_0x330d56,null))[_0x8a66('0x28')](handleError(_0x330d56,null));};exports[_0x8a66('0x51')]=function(_0x59ac25,_0x4dca87){return db[_0x8a66('0x48')][_0x8a66('0x51')](_0x59ac25[_0x8a66('0x52')],{})[_0x8a66('0x1e')](respondWithResult(_0x4dca87,0xc9))[_0x8a66('0x28')](handleError(_0x4dca87,null));};exports[_0x8a66('0x53')]=function(_0x3a0a07,_0x90eb46){if(_0x3a0a07[_0x8a66('0x52')]['id']){delete _0x3a0a07[_0x8a66('0x52')]['id'];}return db[_0x8a66('0x48')]['find']({'where':{'id':_0x3a0a07[_0x8a66('0x54')]['id']}})[_0x8a66('0x1e')](handleEntityNotFound(_0x90eb46,null))['then'](saveUpdates(_0x3a0a07['body'],null))[_0x8a66('0x1e')](respondWithResult(_0x90eb46,null))[_0x8a66('0x28')](handleError(_0x90eb46,null));};exports[_0x8a66('0x30')]=function(_0x4a7f73,_0x48905d){return db[_0x8a66('0x48')][_0x8a66('0x50')]({'where':{'id':_0x4a7f73[_0x8a66('0x54')]['id']}})['then'](handleEntityNotFound(_0x48905d,null))[_0x8a66('0x1e')](removeEntity(_0x48905d,null))[_0x8a66('0x28')](handleError(_0x48905d,null));};exports[_0x8a66('0x55')]=function(_0x3ca91a,_0x352365,_0x30c2f4){var _0x2d1db0={};var _0x377b64={};var _0x20be47;var _0x2e58b2;return db['Dynamics365Account'][_0x8a66('0x56')]({'where':{'id':_0x3ca91a[_0x8a66('0x54')]['id']}})[_0x8a66('0x1e')](handleEntityNotFound(_0x352365,null))[_0x8a66('0x1e')](function(_0x27877a){if(_0x27877a){_0x20be47=_0x27877a;_0x377b64[_0x8a66('0x3a')]=_[_0x8a66('0x3c')](db[_0x8a66('0x57')][_0x8a66('0x36')]);_0x377b64[_0x8a66('0x3b')]=_[_0x8a66('0x3c')](_0x3ca91a[_0x8a66('0x3b')]);_0x377b64[_0x8a66('0x3d')]=_[_0x8a66('0x3e')](_0x377b64['model'],_0x377b64[_0x8a66('0x3b')]);_0x2d1db0[_0x8a66('0x3f')]=_[_0x8a66('0x3e')](_0x377b64[_0x8a66('0x3a')],qs[_0x8a66('0x40')](_0x3ca91a[_0x8a66('0x3b')][_0x8a66('0x40')]));_0x2d1db0[_0x8a66('0x3f')]=_0x2d1db0[_0x8a66('0x3f')][_0x8a66('0x4d')]?_0x2d1db0['attributes']:_0x377b64['model'];_0x2d1db0[_0x8a66('0x43')]=qs[_0x8a66('0x44')](_0x3ca91a[_0x8a66('0x3b')][_0x8a66('0x44')]);_0x2d1db0[_0x8a66('0x47')]=qs['filters'](_[_0x8a66('0x58')](_0x3ca91a[_0x8a66('0x3b')],_0x377b64[_0x8a66('0x3d')]));if(_0x3ca91a['query'][_0x8a66('0x45')]){_0x2d1db0[_0x8a66('0x47')]=_['merge'](_0x2d1db0[_0x8a66('0x47')],{'$or':_[_0x8a66('0x35')](_0x2d1db0[_0x8a66('0x3f')],function(_0x28ae42){var _0x5d7a3a={};_0x5d7a3a[_0x28ae42]={'$like':'%'+_0x3ca91a[_0x8a66('0x3b')][_0x8a66('0x45')]+'%'};return _0x5d7a3a;})});}_0x2d1db0=_[_0x8a66('0x46')]({},_0x2d1db0,_0x3ca91a['options']);return _0x20be47[_0x8a66('0x55')](_0x2d1db0);}})[_0x8a66('0x1e')](function(_0x1a4df1){if(_0x1a4df1){_0x2e58b2=_0x1a4df1[_0x8a66('0x4d')];if(!_0x3ca91a['query'][_0x8a66('0x41')](_0x8a66('0x42'))){_0x2d1db0[_0x8a66('0x2f')]=qs['limit'](_0x3ca91a[_0x8a66('0x3b')]['limit']);_0x2d1db0['offset']=qs['offset'](_0x3ca91a['query']['offset']);}return _0x20be47['getConfigurations'](_0x2d1db0);}})[_0x8a66('0x1e')](function(_0x394862){if(_0x394862){return _0x394862?{'count':_0x2e58b2,'rows':_0x394862}:null;}})[_0x8a66('0x1e')](respondWithResult(_0x352365,null))[_0x8a66('0x28')](handleError(_0x352365,null));};exports[_0x8a66('0x59')]=function(_0x1033e7,_0x5c0b52,_0x2a42e5){if(_0x1033e7['body']['id']){delete _0x1033e7[_0x8a66('0x52')]['id'];}return db[_0x8a66('0x48')][_0x8a66('0x56')]({'where':{'id':_0x1033e7[_0x8a66('0x54')]['id']}})[_0x8a66('0x1e')](handleEntityNotFound(_0x5c0b52,null))[_0x8a66('0x1e')](function(_0x1b49c2){if(_0x1b49c2){_0x1033e7[_0x8a66('0x52')][_0x8a66('0x5a')]=_0x1b49c2['id'];_0x1033e7[_0x8a66('0x52')][_0x8a66('0x5b')]=integrations[_0x8a66('0x5c')](_0x1033e7[_0x8a66('0x52')]['channel'],_0x1033e7[_0x8a66('0x52')]['type']);_0x1033e7[_0x8a66('0x52')][_0x8a66('0x5d')]=integrations['getDescriptions'](_0x1033e7[_0x8a66('0x52')]['channel'],_0x1033e7['body'][_0x8a66('0x38')]);return db[_0x8a66('0x57')]['create'](_0x1033e7['body'],{'include':[{'model':db[_0x8a66('0x5e')],'as':'Subjects'},{'model':db[_0x8a66('0x5e')],'as':_0x8a66('0x5d')}]});}return null;})[_0x8a66('0x1e')](respondWithResult(_0x5c0b52,null))[_0x8a66('0x28')](handleError(_0x5c0b52,null));};exports[_0x8a66('0x5f')]=function(_0x1ea95a,_0x2093fc,_0x2cdbca){var _0x55fc97=_0x1ea95a[_0x8a66('0x3b')][_0x8a66('0x60')];var _0x3adb6a=_0x55fc97==='incident'?'Incident':'PhoneCall';var _0x21c740='';var _0x92cfd8='';var _0x574282='';var _0x2c9e06='';var _0x551512='';var _0x2d073f='';var _0x500350='';var _0xd2d722='';var _0x706502=['title','description',_0x8a66('0x61'),_0x8a66('0x62'),_0x8a66('0x63'),'subject',_0x8a66('0x64'),_0x8a66('0x65'),_0x8a66('0x66'),_0x8a66('0x67')];var _0x5e7868=[_0x8a66('0x68'),_0x8a66('0x69'),_0x8a66('0x6a'),'billedserviceunits','contactidname',_0x8a66('0x6b'),_0x8a66('0x6c'),'contractidname','createdbyexternalpartyname',_0x8a66('0x6d'),'createdbyname',_0x8a66('0x6e'),_0x8a66('0x6f'),_0x8a66('0x70'),'createdonbehalfbyyominame',_0x8a66('0x71'),'customeridtype',_0x8a66('0x72'),_0x8a66('0x73'),_0x8a66('0x74'),_0x8a66('0x75'),_0x8a66('0x76'),_0x8a66('0x77'),_0x8a66('0x78'),_0x8a66('0x79'),_0x8a66('0x7a'),'importsequencenumber',_0x8a66('0x7b'),'kbarticleidname',_0x8a66('0x7c'),_0x8a66('0x7d'),_0x8a66('0x7e'),'modifiedbyexternalpartyyominame','modifiedbyname',_0x8a66('0x7f'),_0x8a66('0x80'),_0x8a66('0x81'),_0x8a66('0x82'),'msdyn_incidenttypename',_0x8a66('0x83'),'numberofchildincidents',_0x8a66('0x84'),_0x8a66('0x85'),_0x8a66('0x86'),'owneridtype',_0x8a66('0x87'),_0x8a66('0x88'),_0x8a66('0x89'),_0x8a66('0x8a'),'prioritycodename',_0x8a66('0x8b'),_0x8a66('0x8c'),_0x8a66('0x8d'),'resolvebykpiidname',_0x8a66('0x8e'),'responsiblecontactidname',_0x8a66('0x8f'),_0x8a66('0x90'),_0x8a66('0x91'),'slaname',_0x8a66('0x92'),'statecode',_0x8a66('0x93'),_0x8a66('0x94'),'ticketnumber',_0x8a66('0x95'),_0x8a66('0x96'),'traversedpath','utcconversiontimezonecode','versionnumber'];var _0x8e6de2=_0x706502['concat'](_0x5e7868);return db[_0x8a66('0x48')][_0x8a66('0x56')]({'where':{'id':_0x1ea95a[_0x8a66('0x54')]['id']},'attributes':['id','username',_0x8a66('0x97'),_0x8a66('0x98'),_0x8a66('0x99'),'clientId',_0x8a66('0x9a')]})[_0x8a66('0x1e')](handleEntityNotFound(_0x2093fc,null))['then'](function(_0x31101e){if(_0x31101e){_0xd2d722=_0x31101e[_0x8a66('0x98')];var _0x426f5a=_0xd2d722['slice'](-0x1);if(_0x426f5a==='/'){_0xd2d722=_0xd2d722[_0x8a66('0x9b')](0x0,_0xd2d722[_0x8a66('0x9c')](_0x426f5a));}_0x500350=util[_0x8a66('0x9d')](_0x8a66('0x9e'),_0xd2d722);var _0x228226={'method':_0x8a66('0x9f'),'uri':'https://login.microsoftonline.com/'+_0x31101e[_0x8a66('0x99')]+_0x8a66('0xa0'),'form':{'client_id':_0x31101e[_0x8a66('0xa1')],'resource':_0xd2d722,'username':_0x31101e[_0x8a66('0xa2')],'password':_0x31101e[_0x8a66('0x97')],'grant_type':_0x8a66('0x97'),'client_secret':_0x31101e[_0x8a66('0x9a')]},'json':!![]};return rp(_0x228226);}})['then'](function(_0xf094ff){_0x2d073f=_0xf094ff[_0x8a66('0xa3')];var _0x25c8da={'method':'GET','uri':encodeURI(_0x500350+_0x8a66('0xa4')+_0x3adb6a+'\x27'),'headers':{'Authorization':_0x8a66('0xa5')+_0x2d073f,'If-None-Match':null,'OData-Version':_0x8a66('0xa6')},'json':!![]};return rp(_0x25c8da);})['then'](function(_0x2fcf0b){var _0x21365f=_0x2fcf0b[_0x8a66('0xa7')][0x0];var _0x1a35c5=_0x21365f['MetadataId'];var _0x17fe2b={'method':_0x8a66('0xa8'),'uri':_0x500350+_0x8a66('0xa9')+_0x1a35c5+_0x8a66('0xaa'),'headers':{'Authorization':'Bearer\x20'+_0x2d073f,'If-None-Match':null,'OData-Version':_0x8a66('0xa6')},'json':!![]};return rp(_0x17fe2b);})[_0x8a66('0x1e')](function(_0x374ee8){_0x21c740=_0x374ee8;_0x92cfd8=_0x21c740[_0x8a66('0xab')];_0x92cfd8=_['remove'](_0x92cfd8,function(_0x5ec4db){return!_0x8e6de2[_0x8a66('0xac')](_0x5ec4db[_0x8a66('0xad')]);});var _0x53dda6=[];var _0x65b6d1=[];_0x92cfd8['forEach'](function(_0x2d4ba3){if(_0x2d4ba3['@odata.type']){var _0x55459c=_0x2d4ba3['@odata.type'][_0x8a66('0x9b')](_0x2d4ba3['@odata.type'][_0x8a66('0x9c')]('.')+0x1);if(_0x55459c===_0x8a66('0xae')){_0x53dda6[_0x8a66('0xaf')](getSelectList(_0x500350,_0x55fc97,_0x65b6d1,_0x21c740[_0x8a66('0xb0')],_0x2d4ba3[_0x8a66('0xb0')],_0x2d073f));}}});return Promise[_0x8a66('0xb1')](_0x53dda6);})[_0x8a66('0x1e')](function(_0x2c9858){_0x574282=_0x2c9858[0x0];var _0x1c998c=[];var _0x157240=[];_0x92cfd8[_0x8a66('0xb2')](function(_0x183ae6){if(!_[_0x8a66('0xb3')](_0x183ae6[_0x8a66('0xb4')])){var _0x501c3d=_0x183ae6[_0x8a66('0xb4')][_0x8a66('0x9b')](_0x183ae6[_0x8a66('0xb4')]['lastIndexOf']('.')+0x1);if(_0x501c3d===_0x8a66('0xb5')){_0x1c998c[_0x8a66('0xaf')](getBooleanList(_0x500350,_0x55fc97,_0x157240,_0x21c740[_0x8a66('0xb0')],_0x183ae6['MetadataId'],_0x2d073f));}}});return Promise[_0x8a66('0xb1')](_0x1c998c);})['then'](function(_0x358eb2){_0x2c9e06=_0x358eb2[0x0];var _0xe9a7b5=[];var _0x371b51=[];_0x92cfd8[_0x8a66('0xb2')](function(_0x3f9bbc){if(_0x3f9bbc[_0x8a66('0xb4')]){var _0x182e4c=_0x3f9bbc[_0x8a66('0xb4')][_0x8a66('0x9b')](_0x3f9bbc[_0x8a66('0xb4')][_0x8a66('0x9c')]('.')+0x1);if(_0x182e4c===_0x8a66('0xb6')||_0x182e4c==='DoubleAttributeMetadata'||_0x182e4c==='BigIntAttributeMetadata'||_0x182e4c==='IntegerAttributeMetadata'||_0x182e4c===_0x8a66('0xb7')||_0x182e4c==='DateTimeAttributeMetadata'||_0x182e4c==='StatusAttributeMetadata'||_0x182e4c===_0x8a66('0xb8')||_0x182e4c===_0x8a66('0xb9')||_0x182e4c===_0x8a66('0xba')){_0xe9a7b5[_0x8a66('0xaf')](getInputList(_0x500350,_0x55fc97,_0x182e4c,_0x371b51,_0x21c740[_0x8a66('0xb0')],_0x3f9bbc[_0x8a66('0xb0')],_0x2d073f));}}});return Promise[_0x8a66('0xb1')](_0xe9a7b5);})[_0x8a66('0x1e')](function(_0x1292bb){_0x551512=_0x1292bb[0x0];var _0x5f21df=_0x574282[_0x8a66('0xbb')](_0x2c9e06)[_0x8a66('0xbb')](_0x551512);var _0x1e7f4b={'count':_0x5f21df[_0x8a66('0x4d')],'rows':_0x5f21df};return _0x1e7f4b;})['then'](respondWithResult(_0x2093fc,null))[_0x8a66('0x28')](function(_0x4e7c21){var _0x1a23f5=_0x1ea95a[_0x8a66('0x3b')][_0x8a66('0x19')]?0x1f4:_0x4e7c21['statusCode']||0x1f4;logger[_0x8a66('0x23')](_0x4e7c21['stack']);delete _0x4e7c21[_0x8a66('0x32')];if(_0x1a23f5===0x191){_0x1a23f5=0x190;}_0x2093fc[_0x8a66('0x2a')](_0x1a23f5)[_0x8a66('0x33')](_0x1ea95a[_0x8a66('0x3b')][_0x8a66('0x19')]?{'message':_0x8a66('0xbc'),'statusCode':_0x4e7c21[_0x8a66('0xbd')]}:_0x4e7c21);});};function getSelectList(_0x31ea0c,_0x522a80,_0x44c5f4,_0x2b22c1,_0x4db8b4,_0x288b84){var _0x5a842f={'method':'GET','uri':_0x31ea0c+_0x8a66('0xa9')+_0x2b22c1+')/Attributes('+_0x4db8b4+_0x8a66('0xbe')+'$select=DisplayName,LogicalName&$expand=OptionSet($select=Options)','headers':{'Authorization':_0x8a66('0xa5')+_0x288b84,'If-None-Match':null,'OData-Version':_0x8a66('0xa6')},'json':!![]};return rp(_0x5a842f)[_0x8a66('0x1e')](function(_0x38d56a){var _0x4cf98b=[];var _0x38dfc2=_0x38d56a['OptionSet'][_0x8a66('0xbf')];_0x38dfc2[_0x8a66('0xb2')](function(_0x41699e){_0x4cf98b[_0x8a66('0xaf')]({'name':_0x41699e[_0x8a66('0xc0')][_0x8a66('0xc1')]['Label'],'value':String(_0x41699e['Value'])});});var _0x2140f7={'id':_0x522a80+'_'+_0x38d56a[_0x8a66('0xad')],'name':_0x38d56a[_0x8a66('0xc2')][_0x8a66('0xc1')][_0x8a66('0xc0')],'custom':![],'options':_0x4cf98b};_0x44c5f4[_0x8a66('0xaf')](_0x2140f7);return _0x44c5f4;});}function getBooleanList(_0x5c8257,_0x3609c3,_0x250d52,_0x18f367,_0x2a676e,_0x34fe16){var _0x547cdb={'method':_0x8a66('0xa8'),'uri':_0x5c8257+'EntityDefinitions('+_0x18f367+_0x8a66('0xc3')+_0x2a676e+_0x8a66('0xc4'),'headers':{'Authorization':'Bearer\x20'+_0x34fe16,'If-None-Match':null,'OData-Version':_0x8a66('0xa6')},'json':!![]};return rp(_0x547cdb)['then'](function(_0x41264e){var _0x31033d=[];_0x31033d['push']({'name':_0x41264e[_0x8a66('0xc5')][_0x8a66('0xc6')][_0x8a66('0xc0')]['UserLocalizedLabel'][_0x8a66('0xc0')],'value':_0x8a66('0xc7')},{'name':_0x41264e[_0x8a66('0xc5')][_0x8a66('0xc8')][_0x8a66('0xc0')][_0x8a66('0xc1')][_0x8a66('0xc0')],'value':_0x8a66('0xc9')});var _0x1cb559={'id':_0x3609c3+'_'+_0x41264e[_0x8a66('0xad')],'name':_0x41264e[_0x8a66('0xc2')]['UserLocalizedLabel']['Label'],'custom':![],'options':_0x31033d};_0x250d52[_0x8a66('0xaf')](_0x1cb559);return _0x250d52;});}function getInputList(_0xf5d375,_0x3c739e,_0xd6937,_0x5e032a,_0x422858,_0x5485e4,_0x2a03){var _0x2b450a={'method':_0x8a66('0xa8'),'uri':_0xf5d375+_0x8a66('0xa9')+_0x422858+_0x8a66('0xc3')+_0x5485e4+_0x8a66('0xca')+_0xd6937+_0x8a66('0xcb'),'headers':{'Authorization':'Bearer\x20'+_0x2a03,'If-None-Match':null,'OData-Version':_0x8a66('0xa6')},'json':!![]};return rp(_0x2b450a)[_0x8a66('0x1e')](function(_0x369782){var _0x293df4={'id':_0x3c739e+'_'+_0x369782[_0x8a66('0xad')],'name':_0x369782[_0x8a66('0xc2')][_0x8a66('0xc1')]?_0x369782[_0x8a66('0xc2')][_0x8a66('0xc1')][_0x8a66('0xc0')]:_0x369782[_0x8a66('0xad')],'custom':![],'options':[]};_0x5e032a[_0x8a66('0xaf')](_0x293df4);return _0x5e032a;});} \ No newline at end of file +var _0x6f71=['zip-dir','fast-json-patch','moment','util','path','sox','to-csv','ejs','lodash','squel','crypto','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','jayson/promise','client','test','Sequelize','ValidationError','The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.','request','info','Dynamics365Account,\x20%s,\x20%s','request\x20sent','debug','error','code','message','result','catch','end','status','json','count','offset','limit','set','Content-Range','apply','save','then','sendStatus','name','send','index','map','Dynamics365Account','rawAttributes','type','key','model','query','keys','filters','attributes','fields','length','hasOwnProperty','nolimit','order','sort','pick','where','VIRTUAL','filter','merge','options','includeAll','include','findAll','rows','params','intersection','find','create','update','body','getConfigurations','Dynamics365Configuration','addConfiguration','findOne','AccountId','Subjects','getSubjects','channel','Descriptions','Dynamics365Field','getFields','ticketType','incident','Incident','PhoneCall','title','ownerid','caseorigincode','subject','phonenumber','directioncode','phonecall_activity_parties','actualserviceunits','billedserviceunits','contractdetailidname','contractidname','createdbyexternalpartyname','createdbyexternalpartyyominame','createdbyname','createdbyyominame','createdon','createdonbehalfbyname','createdonbehalfbyyominame','customeridname','customeridyominame','emailaddress','entityimage_timestamp','entityimage_url','escalatedon','exchangerate','followupby','importsequencenumber','influencescore','masteridname','modifiedbyexternalpartyname','modifiedbyexternalpartyyominame','modifiedbyname','modifiedbyyominame','modifiedon','modifiedonbehalfbyname','modifiedonbehalfbyyominame','msdyn_incidenttypename','msdyn_iotalertname','numberofchildincidents','onholdtime','overriddencreatedon','owneridname','owneridtype','owneridyominame','parentcaseidname','primarycontactidname','primarycontactidyominame','prioritycodename','productidname','productserialnumber','resolvebykpiidname','responseby','responsiblecontactidname','sentimentvalue','slainvokedidname','statuscode','subjectidname','ticketnumber','transactioncurrencyidname','traversedpath','utcconversiontimezonecode','concat','username','password','remoteUri','clientId','clientSecret','slice','substring','lastIndexOf','format','%s/api/data/v9.0/','/oauth2/token','Bearer\x20','value','MetadataId','GET',')?$select=LogicalName&$expand=Attributes($select=LogicalName)','4.0','remove','includes','forEach','@odata.type','PicklistAttributeMetadata','push','all','isNil','DoubleAttributeMetadata','BigIntAttributeMetadata','IntegerAttributeMetadata','DateTimeAttributeMetadata','EntityNameAttributeMetadata','StateAttributeMetadata','DecimalAttributeMetadata','stack','Wrong\x20credentials','statusCode','EntityDefinitions(',')/Attributes(',')/Microsoft.Dynamics.CRM.PicklistAttributeMetadata?','$select=DisplayName,LogicalName&$expand=OptionSet($select=Options)','OptionSet','Options','Label','UserLocalizedLabel','Value',')/Microsoft.Dynamics.CRM.BooleanAttributeMetadata?$select=DisplayName,LogicalName&$expand=OptionSet($select=FalseOption,\x20TrueOption)','TrueOption','true','FalseOption','false','DisplayName',')/Microsoft.Dynamics.CRM.','?$select=DisplayName,LogicalName','LogicalName','eml-format','rimraf'];(function(_0x440d4c,_0x5ea9e1){var _0x21fba9=function(_0x13d8ce){while(--_0x13d8ce){_0x440d4c['push'](_0x440d4c['shift']());}};_0x21fba9(++_0x5ea9e1);}(_0x6f71,0x1aa));var _0x16f7=function(_0x5e3abf,_0x26cc0b){_0x5e3abf=_0x5e3abf-0x0;var _0x330166=_0x6f71[_0x5e3abf];return _0x330166;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x16f7('0x0'));var rimraf=require(_0x16f7('0x1'));var zipdir=require(_0x16f7('0x2'));var jsonpatch=require(_0x16f7('0x3'));var rp=require('request-promise');var moment=require(_0x16f7('0x4'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x16f7('0x5'));var path=require(_0x16f7('0x6'));var sox=require(_0x16f7('0x7'));var csv=require(_0x16f7('0x8'));var ejs=require(_0x16f7('0x9'));var fs=require('fs');var _=require(_0x16f7('0xa'));var squel=require(_0x16f7('0xb'));var crypto=require(_0x16f7('0xc'));var jsforce=require('jsforce');var deskjs=require(_0x16f7('0xd'));var toCsv=require(_0x16f7('0x8'));var querystring=require('querystring');var Papa=require(_0x16f7('0xe'));var Redis=require(_0x16f7('0xf'));var authService=require(_0x16f7('0x10'));var qs=require('../../components/parsers/qs');var as=require(_0x16f7('0x11'));var hardwareService=require(_0x16f7('0x12'));var logger=require('../../config/logger')(_0x16f7('0x13'));var utils=require(_0x16f7('0x14'));var config=require('../../config/environment');var db=require('../../mysqldb')['db'];var integrations=require('../../components/integrations/configuration');var jayson=require(_0x16f7('0x15'));var client=jayson[_0x16f7('0x16')]['http']({'port':0x232a});function checkPasswordPattern(_0x293fb5,_0x263d92,_0x1d6a23){if(_0x1d6a23){var _0x5571f2=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x5571f2[_0x16f7('0x17')](_0x263d92)){return _0x293fb5;}else{throw new db[(_0x16f7('0x18'))][(_0x16f7('0x19'))](_0x16f7('0x1a'));}}else{return _0x293fb5;}}function respondWithRpcPromise(_0x42ce4a,_0x174976,_0x2f6b5a,_0x1b0011){return new BPromise(function(_0x2c1a53,_0x21eb04){var _0x7d286b=_0x1b0011||client;return _0x7d286b[_0x16f7('0x1b')](_0x42ce4a,_0x2f6b5a)['then'](function(_0x1d231c){logger[_0x16f7('0x1c')](_0x16f7('0x1d'),_0x174976,_0x16f7('0x1e'));logger[_0x16f7('0x1f')]('Dynamics365Account,\x20%s,\x20%s,\x20%s',_0x174976,_0x16f7('0x1e'),JSON['stringify'](_0x1d231c));if(_0x1d231c[_0x16f7('0x20')]){if(_0x1d231c[_0x16f7('0x20')][_0x16f7('0x21')]===0x1f4){logger[_0x16f7('0x20')](_0x16f7('0x1d'),_0x174976,_0x1d231c[_0x16f7('0x20')]['message']);return _0x21eb04(_0x1d231c[_0x16f7('0x20')]['message']);}logger[_0x16f7('0x20')](_0x16f7('0x1d'),_0x174976,_0x1d231c[_0x16f7('0x20')][_0x16f7('0x22')]);return _0x2c1a53(_0x1d231c[_0x16f7('0x20')][_0x16f7('0x22')]);}else{logger[_0x16f7('0x1c')](_0x16f7('0x1d'),_0x174976,_0x16f7('0x1e'));_0x2c1a53(_0x1d231c[_0x16f7('0x23')][_0x16f7('0x22')]);}})[_0x16f7('0x24')](function(_0x5a6299){logger[_0x16f7('0x20')](_0x16f7('0x1d'),_0x174976,_0x5a6299);_0x21eb04(_0x5a6299);});});}function respondWithStatusCode(_0x4692e7,_0x5d0dd4){_0x5d0dd4=_0x5d0dd4||0xcc;return function(_0x3dfd15){if(_0x3dfd15){return _0x4692e7['sendStatus'](_0x5d0dd4);}return _0x4692e7['status'](_0x5d0dd4)[_0x16f7('0x25')]();};}function respondWithResult(_0x5c7867,_0x3c6c25){_0x3c6c25=_0x3c6c25||0xc8;return function(_0x12e544){if(_0x12e544){return _0x5c7867[_0x16f7('0x26')](_0x3c6c25)[_0x16f7('0x27')](_0x12e544);}};}function respondWithFilteredResult(_0x3a2f6d,_0x923826){return function(_0x1a80d7){if(_0x1a80d7){var _0x4c055d=_0x1a80d7[_0x16f7('0x28')],_0x42099c=_0x923826['offset'],_0x4db617=_0x923826[_0x16f7('0x29')]+_0x923826[_0x16f7('0x2a')],_0xf59528;if(_0x4db617>=_0x4c055d){_0x4db617=_0x4c055d;_0xf59528=0xc8;}else{_0xf59528=0xce;}_0x3a2f6d[_0x16f7('0x26')](_0xf59528);return _0x3a2f6d[_0x16f7('0x2b')](_0x16f7('0x2c'),_0x42099c+'-'+_0x4db617+'/'+_0x4c055d)['json'](_0x1a80d7);}return null;};}function patchUpdates(_0x2448c4){return function(_0x4acaea){try{jsonpatch[_0x16f7('0x2d')](_0x4acaea,_0x2448c4,!![]);}catch(_0x4e8b58){return BPromise['reject'](_0x4e8b58);}return _0x4acaea[_0x16f7('0x2e')]();};}function saveUpdates(_0x1ba660,_0x4fe857){return function(_0x9f6a81){if(_0x9f6a81){return _0x9f6a81['update'](_0x1ba660)[_0x16f7('0x2f')](function(_0x5967da){return _0x5967da;});}return null;};}function removeEntity(_0xf30077,_0xf93152){return function(_0x5401be){if(_0x5401be){return _0x5401be['destroy']()['then'](function(){_0xf30077[_0x16f7('0x26')](0xcc)['end']();});}};}function handleEntityNotFound(_0x5a1f5c,_0x2a8486){return function(_0x4f9090){if(!_0x4f9090){_0x5a1f5c[_0x16f7('0x30')](0x194);}return _0x4f9090;};}function handleError(_0x358194,_0x45d902){_0x45d902=_0x45d902||0x1f4;return function(_0x1f93ae){logger[_0x16f7('0x20')](_0x1f93ae['stack']);if(_0x1f93ae[_0x16f7('0x31')]){delete _0x1f93ae[_0x16f7('0x31')];}_0x358194['status'](_0x45d902)[_0x16f7('0x32')](_0x1f93ae);};}exports[_0x16f7('0x33')]=function(_0x2bdc61,_0xf64336){var _0x2b3b01={},_0x16d22d={},_0x474557={'count':0x0,'rows':[]};var _0x29321a=_[_0x16f7('0x34')](db[_0x16f7('0x35')][_0x16f7('0x36')],function(_0x4524af){return{'name':_0x4524af['fieldName'],'type':_0x4524af[_0x16f7('0x37')][_0x16f7('0x38')]};});_0x16d22d[_0x16f7('0x39')]=_['map'](_0x29321a,_0x16f7('0x31'));_0x16d22d[_0x16f7('0x3a')]=_[_0x16f7('0x3b')](_0x2bdc61[_0x16f7('0x3a')]);_0x16d22d[_0x16f7('0x3c')]=_['intersection'](_0x16d22d[_0x16f7('0x39')],_0x16d22d[_0x16f7('0x3a')]);_0x2b3b01[_0x16f7('0x3d')]=_['intersection'](_0x16d22d[_0x16f7('0x39')],qs[_0x16f7('0x3e')](_0x2bdc61[_0x16f7('0x3a')][_0x16f7('0x3e')]));_0x2b3b01['attributes']=_0x2b3b01[_0x16f7('0x3d')][_0x16f7('0x3f')]?_0x2b3b01[_0x16f7('0x3d')]:_0x16d22d[_0x16f7('0x39')];if(!_0x2bdc61[_0x16f7('0x3a')][_0x16f7('0x40')](_0x16f7('0x41'))){_0x2b3b01[_0x16f7('0x2a')]=qs[_0x16f7('0x2a')](_0x2bdc61[_0x16f7('0x3a')][_0x16f7('0x2a')]);_0x2b3b01[_0x16f7('0x29')]=qs[_0x16f7('0x29')](_0x2bdc61[_0x16f7('0x3a')][_0x16f7('0x29')]);}_0x2b3b01[_0x16f7('0x42')]=qs[_0x16f7('0x43')](_0x2bdc61[_0x16f7('0x3a')][_0x16f7('0x43')]);_0x2b3b01['where']=qs['filters'](_[_0x16f7('0x44')](_0x2bdc61[_0x16f7('0x3a')],_0x16d22d[_0x16f7('0x3c')]));if(_0x2bdc61['query']['filter']){_0x2b3b01['where']=_['merge'](_0x2b3b01[_0x16f7('0x45')],{'$or':_[_0x16f7('0x34')](_0x29321a,function(_0x3a8542){if(_0x3a8542['type']!==_0x16f7('0x46')){var _0x39541b={};_0x39541b[_0x3a8542[_0x16f7('0x31')]]={'$like':'%'+_0x2bdc61[_0x16f7('0x3a')][_0x16f7('0x47')]+'%'};return _0x39541b;}})});}_0x2b3b01=_[_0x16f7('0x48')]({},_0x2b3b01,_0x2bdc61[_0x16f7('0x49')]);var _0x386410={'where':_0x2b3b01[_0x16f7('0x45')]};return db['Dynamics365Account'][_0x16f7('0x28')](_0x386410)[_0x16f7('0x2f')](function(_0x5cab8e){_0x474557[_0x16f7('0x28')]=_0x5cab8e;if(_0x2bdc61[_0x16f7('0x3a')][_0x16f7('0x4a')]){_0x2b3b01[_0x16f7('0x4b')]=[{'all':!![]}];}return db[_0x16f7('0x35')][_0x16f7('0x4c')](_0x2b3b01);})[_0x16f7('0x2f')](function(_0x45bb94){_0x474557[_0x16f7('0x4d')]=_0x45bb94;return _0x474557;})['then'](respondWithFilteredResult(_0xf64336,_0x2b3b01))['catch'](handleError(_0xf64336,null));};exports['show']=function(_0x4b092d,_0x14711a){var _0x21c8dc={'raw':![],'where':{'id':_0x4b092d[_0x16f7('0x4e')]['id']}},_0x1badd2={};_0x1badd2['model']=_[_0x16f7('0x3b')](db[_0x16f7('0x35')]['rawAttributes']);_0x1badd2[_0x16f7('0x3a')]=_['keys'](_0x4b092d[_0x16f7('0x3a')]);_0x1badd2[_0x16f7('0x3c')]=_[_0x16f7('0x4f')](_0x1badd2[_0x16f7('0x39')],_0x1badd2[_0x16f7('0x3a')]);_0x21c8dc['attributes']=_[_0x16f7('0x4f')](_0x1badd2[_0x16f7('0x39')],qs[_0x16f7('0x3e')](_0x4b092d['query'][_0x16f7('0x3e')]));_0x21c8dc[_0x16f7('0x3d')]=_0x21c8dc[_0x16f7('0x3d')]['length']?_0x21c8dc['attributes']:_0x1badd2[_0x16f7('0x39')];if(_0x4b092d[_0x16f7('0x3a')][_0x16f7('0x4a')]){_0x21c8dc[_0x16f7('0x4b')]=[{'all':!![]}];}_0x21c8dc=_[_0x16f7('0x48')]({},_0x21c8dc,_0x4b092d[_0x16f7('0x49')]);return db['Dynamics365Account'][_0x16f7('0x50')](_0x21c8dc)['then'](handleEntityNotFound(_0x14711a,null))[_0x16f7('0x2f')](respondWithResult(_0x14711a,null))['catch'](handleError(_0x14711a,null));};exports[_0x16f7('0x51')]=function(_0x15ab2e,_0x22dc0f){return db[_0x16f7('0x35')][_0x16f7('0x51')](_0x15ab2e['body'],{})[_0x16f7('0x2f')](respondWithResult(_0x22dc0f,0xc9))[_0x16f7('0x24')](handleError(_0x22dc0f,null));};exports[_0x16f7('0x52')]=function(_0x4aad82,_0x212d9d){if(_0x4aad82[_0x16f7('0x53')]['id']){delete _0x4aad82[_0x16f7('0x53')]['id'];}return db[_0x16f7('0x35')][_0x16f7('0x50')]({'where':{'id':_0x4aad82[_0x16f7('0x4e')]['id']}})[_0x16f7('0x2f')](handleEntityNotFound(_0x212d9d,null))[_0x16f7('0x2f')](saveUpdates(_0x4aad82[_0x16f7('0x53')],null))[_0x16f7('0x2f')](respondWithResult(_0x212d9d,null))[_0x16f7('0x24')](handleError(_0x212d9d,null));};exports['destroy']=function(_0x1cb6b6,_0x4d63ba){return db['Dynamics365Account'][_0x16f7('0x50')]({'where':{'id':_0x1cb6b6['params']['id']}})[_0x16f7('0x2f')](handleEntityNotFound(_0x4d63ba,null))['then'](removeEntity(_0x4d63ba,null))[_0x16f7('0x24')](handleError(_0x4d63ba,null));};exports[_0x16f7('0x54')]=function(_0xd69740,_0x11c0e2,_0x47ada5){var _0x46af10={};var _0x322c66={};var _0x42f57a;var _0x3419ee;return db[_0x16f7('0x35')]['findOne']({'where':{'id':_0xd69740['params']['id']}})[_0x16f7('0x2f')](handleEntityNotFound(_0x11c0e2,null))['then'](function(_0x14bb1e){if(_0x14bb1e){_0x42f57a=_0x14bb1e;_0x322c66[_0x16f7('0x39')]=_[_0x16f7('0x3b')](db[_0x16f7('0x55')][_0x16f7('0x36')]);_0x322c66['query']=_[_0x16f7('0x3b')](_0xd69740[_0x16f7('0x3a')]);_0x322c66[_0x16f7('0x3c')]=_['intersection'](_0x322c66[_0x16f7('0x39')],_0x322c66['query']);_0x46af10[_0x16f7('0x3d')]=_['intersection'](_0x322c66[_0x16f7('0x39')],qs['fields'](_0xd69740[_0x16f7('0x3a')][_0x16f7('0x3e')]));_0x46af10[_0x16f7('0x3d')]=_0x46af10[_0x16f7('0x3d')][_0x16f7('0x3f')]?_0x46af10[_0x16f7('0x3d')]:_0x322c66[_0x16f7('0x39')];_0x46af10[_0x16f7('0x42')]=qs[_0x16f7('0x43')](_0xd69740[_0x16f7('0x3a')][_0x16f7('0x43')]);_0x46af10['where']=qs[_0x16f7('0x3c')](_[_0x16f7('0x44')](_0xd69740[_0x16f7('0x3a')],_0x322c66[_0x16f7('0x3c')]));if(_0xd69740[_0x16f7('0x3a')][_0x16f7('0x47')]){_0x46af10[_0x16f7('0x45')]=_[_0x16f7('0x48')](_0x46af10['where'],{'$or':_['map'](_0x46af10[_0x16f7('0x3d')],function(_0x197ac9){var _0x2ef1b5={};_0x2ef1b5[_0x197ac9]={'$like':'%'+_0xd69740[_0x16f7('0x3a')][_0x16f7('0x47')]+'%'};return _0x2ef1b5;})});}_0x46af10=_[_0x16f7('0x48')]({},_0x46af10,_0xd69740[_0x16f7('0x49')]);return _0x42f57a[_0x16f7('0x54')](_0x46af10);}})[_0x16f7('0x2f')](function(_0x109298){if(_0x109298){_0x3419ee=_0x109298[_0x16f7('0x3f')];if(!_0xd69740[_0x16f7('0x3a')][_0x16f7('0x40')]('nolimit')){_0x46af10['limit']=qs['limit'](_0xd69740[_0x16f7('0x3a')][_0x16f7('0x2a')]);_0x46af10[_0x16f7('0x29')]=qs[_0x16f7('0x29')](_0xd69740[_0x16f7('0x3a')][_0x16f7('0x29')]);}return _0x42f57a[_0x16f7('0x54')](_0x46af10);}})['then'](function(_0x5a44f6){if(_0x5a44f6){return _0x5a44f6?{'count':_0x3419ee,'rows':_0x5a44f6}:null;}})[_0x16f7('0x2f')](respondWithResult(_0x11c0e2,null))[_0x16f7('0x24')](handleError(_0x11c0e2,null));};exports[_0x16f7('0x56')]=function(_0x1244b4,_0x853fee,_0x11a073){if(_0x1244b4[_0x16f7('0x53')]['id']){delete _0x1244b4[_0x16f7('0x53')]['id'];}return db[_0x16f7('0x35')][_0x16f7('0x57')]({'where':{'id':_0x1244b4['params']['id']}})[_0x16f7('0x2f')](handleEntityNotFound(_0x853fee,null))[_0x16f7('0x2f')](function(_0x5867e){if(_0x5867e){_0x1244b4[_0x16f7('0x53')][_0x16f7('0x58')]=_0x5867e['id'];_0x1244b4['body'][_0x16f7('0x59')]=integrations[_0x16f7('0x5a')](_0x1244b4[_0x16f7('0x53')][_0x16f7('0x5b')],_0x1244b4['body']['type']);_0x1244b4[_0x16f7('0x53')][_0x16f7('0x5c')]=integrations['getDescriptions'](_0x1244b4[_0x16f7('0x53')][_0x16f7('0x5b')],_0x1244b4[_0x16f7('0x53')][_0x16f7('0x37')]);return db[_0x16f7('0x55')][_0x16f7('0x51')](_0x1244b4[_0x16f7('0x53')],{'include':[{'model':db[_0x16f7('0x5d')],'as':'Subjects'},{'model':db['Dynamics365Field'],'as':_0x16f7('0x5c')}]});}return null;})[_0x16f7('0x2f')](respondWithResult(_0x853fee,null))[_0x16f7('0x24')](handleError(_0x853fee,null));};exports[_0x16f7('0x5e')]=function(_0x524d69,_0x22e688,_0x5cd281){var _0x296331=_0x524d69[_0x16f7('0x3a')][_0x16f7('0x5f')];var _0xa0131=_0x296331===_0x16f7('0x60')?_0x16f7('0x61'):_0x16f7('0x62');var _0x4937ef='';var _0x36866a='';var _0x5888be='';var _0x59e186='';var _0x775d88='';var _0x3d52c6='';var _0x2438c2='';var _0x16b7b6='';var _0x533d33=[_0x16f7('0x63'),'description','customerid',_0x16f7('0x64'),_0x16f7('0x65'),_0x16f7('0x66'),_0x16f7('0x67'),'regardingobjectid',_0x16f7('0x68'),_0x16f7('0x69')];var _0x47db4e=['accountidname','accountidyominame',_0x16f7('0x6a'),_0x16f7('0x6b'),'contactidname','contactidyominame',_0x16f7('0x6c'),_0x16f7('0x6d'),_0x16f7('0x6e'),_0x16f7('0x6f'),_0x16f7('0x70'),_0x16f7('0x71'),_0x16f7('0x72'),_0x16f7('0x73'),_0x16f7('0x74'),_0x16f7('0x75'),'customeridtype',_0x16f7('0x76'),_0x16f7('0x77'),'entitlementidname',_0x16f7('0x78'),_0x16f7('0x79'),_0x16f7('0x7a'),_0x16f7('0x7b'),'firstresponsebykpiidname',_0x16f7('0x7c'),_0x16f7('0x7d'),_0x16f7('0x7e'),'kbarticleidname','lastonholdtime',_0x16f7('0x7f'),_0x16f7('0x80'),_0x16f7('0x81'),_0x16f7('0x82'),_0x16f7('0x83'),_0x16f7('0x84'),_0x16f7('0x85'),_0x16f7('0x86'),_0x16f7('0x87'),_0x16f7('0x88'),_0x16f7('0x89'),_0x16f7('0x8a'),_0x16f7('0x8b'),_0x16f7('0x8c'),_0x16f7('0x8d'),_0x16f7('0x8e'),_0x16f7('0x8f'),_0x16f7('0x90'),_0x16f7('0x91'),_0x16f7('0x92'),_0x16f7('0x93'),_0x16f7('0x94'),'resolveby',_0x16f7('0x95'),_0x16f7('0x96'),_0x16f7('0x97'),'responsiblecontactidyominame',_0x16f7('0x98'),_0x16f7('0x99'),'slaname','socialprofileidname','statecode',_0x16f7('0x9a'),_0x16f7('0x9b'),_0x16f7('0x9c'),'timezoneruleversionnumber',_0x16f7('0x9d'),_0x16f7('0x9e'),_0x16f7('0x9f'),'versionnumber'];var _0x85ae3b=_0x533d33[_0x16f7('0xa0')](_0x47db4e);return db[_0x16f7('0x35')][_0x16f7('0x57')]({'where':{'id':_0x524d69[_0x16f7('0x4e')]['id']},'attributes':['id',_0x16f7('0xa1'),_0x16f7('0xa2'),_0x16f7('0xa3'),'tenantId',_0x16f7('0xa4'),_0x16f7('0xa5')]})[_0x16f7('0x2f')](handleEntityNotFound(_0x22e688,null))[_0x16f7('0x2f')](function(_0x140488){if(_0x140488){_0x16b7b6=_0x140488['remoteUri'];var _0x3bb59d=_0x16b7b6[_0x16f7('0xa6')](-0x1);if(_0x3bb59d==='/'){_0x16b7b6=_0x16b7b6[_0x16f7('0xa7')](0x0,_0x16b7b6[_0x16f7('0xa8')](_0x3bb59d));}_0x2438c2=util[_0x16f7('0xa9')](_0x16f7('0xaa'),_0x16b7b6);var _0x12b83d={'method':'POST','uri':'https://login.microsoftonline.com/'+_0x140488['tenantId']+_0x16f7('0xab'),'form':{'client_id':_0x140488[_0x16f7('0xa4')],'resource':_0x16b7b6,'username':_0x140488['username'],'password':_0x140488[_0x16f7('0xa2')],'grant_type':_0x16f7('0xa2'),'client_secret':_0x140488[_0x16f7('0xa5')]},'json':!![]};return rp(_0x12b83d);}})[_0x16f7('0x2f')](function(_0x7693b8){_0x3d52c6=_0x7693b8['access_token'];var _0x2e4c05={'method':'GET','uri':encodeURI(_0x2438c2+'EntityDefinitions?$select=DisplayName,EntitySetName&$filter=SchemaName\x20eq\x20\x27'+_0xa0131+'\x27'),'headers':{'Authorization':_0x16f7('0xac')+_0x3d52c6,'If-None-Match':null,'OData-Version':'4.0'},'json':!![]};return rp(_0x2e4c05);})['then'](function(_0x4966ad){var _0x1e9705=_0x4966ad[_0x16f7('0xad')][0x0];var _0x2b29c9=_0x1e9705[_0x16f7('0xae')];var _0x41c847={'method':_0x16f7('0xaf'),'uri':_0x2438c2+'EntityDefinitions('+_0x2b29c9+_0x16f7('0xb0'),'headers':{'Authorization':_0x16f7('0xac')+_0x3d52c6,'If-None-Match':null,'OData-Version':_0x16f7('0xb1')},'json':!![]};return rp(_0x41c847);})[_0x16f7('0x2f')](function(_0x15cfc3){_0x4937ef=_0x15cfc3;_0x36866a=_0x4937ef['Attributes'];_0x36866a=_[_0x16f7('0xb2')](_0x36866a,function(_0x229ec8){return!_0x85ae3b[_0x16f7('0xb3')](_0x229ec8['LogicalName']);});var _0xa6f5fb=[];var _0x2dbf54=[];_0x36866a[_0x16f7('0xb4')](function(_0x16d926){if(_0x16d926[_0x16f7('0xb5')]){var _0x241f6d=_0x16d926[_0x16f7('0xb5')][_0x16f7('0xa7')](_0x16d926[_0x16f7('0xb5')][_0x16f7('0xa8')]('.')+0x1);if(_0x241f6d===_0x16f7('0xb6')){_0xa6f5fb[_0x16f7('0xb7')](getSelectList(_0x2438c2,_0x296331,_0x2dbf54,_0x4937ef[_0x16f7('0xae')],_0x16d926[_0x16f7('0xae')],_0x3d52c6));}}});return Promise[_0x16f7('0xb8')](_0xa6f5fb);})['then'](function(_0x4cc952){_0x5888be=_0x4cc952[0x0];var _0x3e140b=[];var _0x115ce0=[];_0x36866a[_0x16f7('0xb4')](function(_0x8b6156){if(!_[_0x16f7('0xb9')](_0x8b6156['@odata.type'])){var _0x2789ef=_0x8b6156['@odata.type'][_0x16f7('0xa7')](_0x8b6156[_0x16f7('0xb5')][_0x16f7('0xa8')]('.')+0x1);if(_0x2789ef==='BooleanAttributeMetadata'){_0x3e140b[_0x16f7('0xb7')](getBooleanList(_0x2438c2,_0x296331,_0x115ce0,_0x4937ef['MetadataId'],_0x8b6156[_0x16f7('0xae')],_0x3d52c6));}}});return Promise[_0x16f7('0xb8')](_0x3e140b);})[_0x16f7('0x2f')](function(_0x4410e9){_0x59e186=_0x4410e9[0x0];var _0x4de233=[];var _0x4146cc=[];_0x36866a[_0x16f7('0xb4')](function(_0x379bb8){if(_0x379bb8[_0x16f7('0xb5')]){var _0x336d33=_0x379bb8[_0x16f7('0xb5')][_0x16f7('0xa7')](_0x379bb8[_0x16f7('0xb5')][_0x16f7('0xa8')]('.')+0x1);if(_0x336d33==='StringAttributeMetadata'||_0x336d33===_0x16f7('0xba')||_0x336d33===_0x16f7('0xbb')||_0x336d33===_0x16f7('0xbc')||_0x336d33==='MemoAttributeMetadata'||_0x336d33===_0x16f7('0xbd')||_0x336d33==='StatusAttributeMetadata'||_0x336d33===_0x16f7('0xbe')||_0x336d33===_0x16f7('0xbf')||_0x336d33===_0x16f7('0xc0')){_0x4de233[_0x16f7('0xb7')](getInputList(_0x2438c2,_0x296331,_0x336d33,_0x4146cc,_0x4937ef[_0x16f7('0xae')],_0x379bb8[_0x16f7('0xae')],_0x3d52c6));}}});return Promise[_0x16f7('0xb8')](_0x4de233);})[_0x16f7('0x2f')](function(_0x221715){_0x775d88=_0x221715[0x0];var _0x338caf=_0x5888be[_0x16f7('0xa0')](_0x59e186)[_0x16f7('0xa0')](_0x775d88);var _0x37be4c={'count':_0x338caf[_0x16f7('0x3f')],'rows':_0x338caf};return _0x37be4c;})[_0x16f7('0x2f')](respondWithResult(_0x22e688,null))['catch'](function(_0xdeea53){var _0x48965f=_0x524d69[_0x16f7('0x3a')]['test']?0x1f4:_0xdeea53['statusCode']||0x1f4;logger[_0x16f7('0x20')](_0xdeea53[_0x16f7('0xc1')]);delete _0xdeea53['name'];if(_0x48965f===0x191){_0x48965f=0x190;}_0x22e688[_0x16f7('0x26')](_0x48965f)[_0x16f7('0x32')](_0x524d69[_0x16f7('0x3a')][_0x16f7('0x17')]?{'message':_0x16f7('0xc2'),'statusCode':_0xdeea53[_0x16f7('0xc3')]}:_0xdeea53);});};function getSelectList(_0x4f9796,_0x2e1ca9,_0x3e5341,_0x197349,_0x47f588,_0x17ecdd){var _0x285099={'method':_0x16f7('0xaf'),'uri':_0x4f9796+_0x16f7('0xc4')+_0x197349+_0x16f7('0xc5')+_0x47f588+_0x16f7('0xc6')+_0x16f7('0xc7'),'headers':{'Authorization':'Bearer\x20'+_0x17ecdd,'If-None-Match':null,'OData-Version':_0x16f7('0xb1')},'json':!![]};return rp(_0x285099)[_0x16f7('0x2f')](function(_0xa31187){var _0x4b3a95=[];var _0x1941a9=_0xa31187[_0x16f7('0xc8')][_0x16f7('0xc9')];_0x1941a9[_0x16f7('0xb4')](function(_0x2e128e){_0x4b3a95[_0x16f7('0xb7')]({'name':_0x2e128e[_0x16f7('0xca')][_0x16f7('0xcb')][_0x16f7('0xca')],'value':String(_0x2e128e[_0x16f7('0xcc')])});});var _0x4bdba4={'id':_0x2e1ca9+'_'+_0xa31187['LogicalName'],'name':_0xa31187['DisplayName']['UserLocalizedLabel'][_0x16f7('0xca')],'custom':![],'options':_0x4b3a95};_0x3e5341[_0x16f7('0xb7')](_0x4bdba4);return _0x3e5341;});}function getBooleanList(_0x4a9ae9,_0x39f7bb,_0x45687d,_0x142258,_0x39eebd,_0x3782e1){var _0x107b6c={'method':_0x16f7('0xaf'),'uri':_0x4a9ae9+_0x16f7('0xc4')+_0x142258+')/Attributes('+_0x39eebd+_0x16f7('0xcd'),'headers':{'Authorization':_0x16f7('0xac')+_0x3782e1,'If-None-Match':null,'OData-Version':_0x16f7('0xb1')},'json':!![]};return rp(_0x107b6c)[_0x16f7('0x2f')](function(_0x4c3d81){var _0x2a3d84=[];_0x2a3d84[_0x16f7('0xb7')]({'name':_0x4c3d81[_0x16f7('0xc8')][_0x16f7('0xce')][_0x16f7('0xca')][_0x16f7('0xcb')][_0x16f7('0xca')],'value':_0x16f7('0xcf')},{'name':_0x4c3d81['OptionSet'][_0x16f7('0xd0')][_0x16f7('0xca')][_0x16f7('0xcb')]['Label'],'value':_0x16f7('0xd1')});var _0x1c529e={'id':_0x39f7bb+'_'+_0x4c3d81['LogicalName'],'name':_0x4c3d81[_0x16f7('0xd2')][_0x16f7('0xcb')][_0x16f7('0xca')],'custom':![],'options':_0x2a3d84};_0x45687d[_0x16f7('0xb7')](_0x1c529e);return _0x45687d;});}function getInputList(_0x161f21,_0x98e404,_0x747272,_0x3876ea,_0x29735d,_0x29651b,_0x483d10){var _0x1e872d={'method':_0x16f7('0xaf'),'uri':_0x161f21+_0x16f7('0xc4')+_0x29735d+_0x16f7('0xc5')+_0x29651b+_0x16f7('0xd3')+_0x747272+_0x16f7('0xd4'),'headers':{'Authorization':_0x16f7('0xac')+_0x483d10,'If-None-Match':null,'OData-Version':_0x16f7('0xb1')},'json':!![]};return rp(_0x1e872d)[_0x16f7('0x2f')](function(_0x1054ef){var _0x188bb6={'id':_0x98e404+'_'+_0x1054ef[_0x16f7('0xd5')],'name':_0x1054ef['DisplayName'][_0x16f7('0xcb')]?_0x1054ef[_0x16f7('0xd2')][_0x16f7('0xcb')][_0x16f7('0xca')]:_0x1054ef[_0x16f7('0xd5')],'custom':![],'options':[]};_0x3876ea[_0x16f7('0xb7')](_0x188bb6);return _0x3876ea;});} \ No newline at end of file diff --git a/server/api/intDynamics365Account/intDynamics365Account.model.js b/server/api/intDynamics365Account/intDynamics365Account.model.js index c516947..4a097e3 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 _0x4581=['bluebird','request-promise','path','rimraf','./intDynamics365Account.attributes','../../components/integrations/configuration','exports','define','Dynamics365Account','int_dynamics365_accounts','util','../../config/logger','moment'];(function(_0x526209,_0x57ffbf){var _0x4fbc56=function(_0x4f570f){while(--_0x4f570f){_0x526209['push'](_0x526209['shift']());}};_0x4fbc56(++_0x57ffbf);}(_0x4581,0xb3));var _0x1458=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x4581[_0x20a584];return _0x4b41a8;};'use strict';var _=require('lodash');var util=require(_0x1458('0x0'));var logger=require(_0x1458('0x1'))('api');var moment=require(_0x1458('0x2'));var BPromise=require(_0x1458('0x3'));var rp=require(_0x1458('0x4'));var fs=require('fs');var path=require(_0x1458('0x5'));var rimraf=require(_0x1458('0x6'));var config=require('../../config/environment');var attributes=require(_0x1458('0x7'));var integrations=require(_0x1458('0x8'));module[_0x1458('0x9')]=function(_0x3e56d5,_0x3c4b1e){return _0x3e56d5[_0x1458('0xa')](_0x1458('0xb'),attributes,{'tableName':_0x1458('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x48a2=['bluebird','path','rimraf','../../config/environment','./intDynamics365Account.attributes','../../components/integrations/configuration','exports','define','Dynamics365Account','int_dynamics365_accounts','lodash','../../config/logger','api','moment'];(function(_0x1bd230,_0x1da01e){var _0x19a3e3=function(_0x3cb9fa){while(--_0x3cb9fa){_0x1bd230['push'](_0x1bd230['shift']());}};_0x19a3e3(++_0x1da01e);}(_0x48a2,0x1ca));var _0x248a=function(_0x18ccd6,_0x1098e8){_0x18ccd6=_0x18ccd6-0x0;var _0x587d2c=_0x48a2[_0x18ccd6];return _0x587d2c;};'use strict';var _=require(_0x248a('0x0'));var util=require('util');var logger=require(_0x248a('0x1'))(_0x248a('0x2'));var moment=require(_0x248a('0x3'));var BPromise=require(_0x248a('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x248a('0x5'));var rimraf=require(_0x248a('0x6'));var config=require(_0x248a('0x7'));var attributes=require(_0x248a('0x8'));var integrations=require(_0x248a('0x9'));module[_0x248a('0xa')]=function(_0xedf7e4,_0x10a991){return _0xedf7e4[_0x248a('0xb')](_0x248a('0xc'),attributes,{'tableName':_0x248a('0xd'),'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 75b3567..0d7b4b4 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 _0x1a38=['include','model','map','debug','GetDynamics365Account','ShowDynamics365Account','lodash','util','moment','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','then','info','Dynamics365Account,\x20%s,\x20%s','request\x20sent','Dynamics365Account,\x20%s,\x20%s,\x20%s','stringify','code','error','message','result','catch','Dynamics365Account','findAll','options','raw','where','attributes'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x1a38,0xb0));var _0x81a3=function(_0x142020,_0x1f7233){_0x142020=_0x142020-0x0;var _0x40da8f=_0x1a38[_0x142020];return _0x40da8f;};'use strict';var _=require(_0x81a3('0x0'));var util=require(_0x81a3('0x1'));var moment=require(_0x81a3('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x81a3('0x3'))['db'];var utils=require(_0x81a3('0x4'));var logger=require(_0x81a3('0x5'))(_0x81a3('0x6'));var config=require(_0x81a3('0x7'));var jayson=require(_0x81a3('0x8'));var client=jayson[_0x81a3('0x9')][_0x81a3('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x3153ee,_0x2d331e,_0x207345){return new BPromise(function(_0xe10e0a,_0x3be616){return client['request'](_0x3153ee,_0x207345)[_0x81a3('0xb')](function(_0x252685){logger[_0x81a3('0xc')](_0x81a3('0xd'),_0x2d331e,_0x81a3('0xe'));logger['debug'](_0x81a3('0xf'),_0x2d331e,_0x81a3('0xe'),JSON[_0x81a3('0x10')](_0x252685));if(_0x252685['error']){if(_0x252685['error'][_0x81a3('0x11')]===0x1f4){logger[_0x81a3('0x12')](_0x81a3('0xd'),_0x2d331e,_0x252685[_0x81a3('0x12')][_0x81a3('0x13')]);return _0x3be616(_0x252685[_0x81a3('0x12')][_0x81a3('0x13')]);}logger[_0x81a3('0x12')](_0x81a3('0xd'),_0x2d331e,_0x252685[_0x81a3('0x12')][_0x81a3('0x13')]);return _0xe10e0a(_0x252685[_0x81a3('0x12')]['message']);}else{logger[_0x81a3('0xc')](_0x81a3('0xd'),_0x2d331e,_0x81a3('0xe'));_0xe10e0a(_0x252685[_0x81a3('0x14')]['message']);}})[_0x81a3('0x15')](function(_0x18fc8d){logger['error'](_0x81a3('0xd'),_0x2d331e,_0x18fc8d);_0x3be616(_0x18fc8d);});});}exports['GetDynamics365Account']=function(_0x4d4b86){var _0x984158=this;return new Promise(function(_0x1cd821,_0x8422ee){return db[_0x81a3('0x16')][_0x81a3('0x17')]({'raw':_0x4d4b86[_0x81a3('0x18')]?_0x4d4b86[_0x81a3('0x18')][_0x81a3('0x19')]===undefined?!![]:![]:!![],'where':_0x4d4b86['options']?_0x4d4b86[_0x81a3('0x18')][_0x81a3('0x1a')]||null:null,'attributes':_0x4d4b86['options']?_0x4d4b86[_0x81a3('0x18')][_0x81a3('0x1b')]||null:null,'limit':_0x4d4b86[_0x81a3('0x18')]?_0x4d4b86[_0x81a3('0x18')]['limit']||null:null,'include':_0x4d4b86[_0x81a3('0x18')]?_0x4d4b86[_0x81a3('0x18')][_0x81a3('0x1c')]?_['map'](_0x4d4b86['options'][_0x81a3('0x1c')],function(_0x328b0d){return{'model':db[_0x328b0d[_0x81a3('0x1d')]],'as':_0x328b0d['as'],'attributes':_0x328b0d[_0x81a3('0x1b')],'include':_0x328b0d['include']?_['map'](_0x328b0d['include'],function(_0x1583fd){return{'model':db[_0x1583fd[_0x81a3('0x1d')]],'as':_0x1583fd['as'],'attributes':_0x1583fd[_0x81a3('0x1b')],'include':_0x1583fd[_0x81a3('0x1c')]?_[_0x81a3('0x1e')](_0x1583fd[_0x81a3('0x1c')],function(_0x3f850d){return{'model':db[_0x3f850d[_0x81a3('0x1d')]],'as':_0x3f850d['as'],'attributes':_0x3f850d[_0x81a3('0x1b')]};}):[]};}):[]};}):[]:[]})[_0x81a3('0xb')](function(_0x113863){logger[_0x81a3('0xc')]('GetDynamics365Account',_0x4d4b86);logger[_0x81a3('0x1f')](_0x81a3('0x20'),_0x4d4b86,JSON[_0x81a3('0x10')](_0x113863));_0x1cd821(_0x113863);})['catch'](function(_0x4afd80){logger[_0x81a3('0x12')](_0x81a3('0x20'),_0x4afd80['message'],_0x4d4b86);_0x8422ee(_0x984158['error'](0x1f4,_0x4afd80['message']));});});};exports[_0x81a3('0x21')]=function(_0x313c04){var _0x2f4db2=this;return new Promise(function(_0x1d154f,_0x332d3f){return db[_0x81a3('0x16')]['find']({'raw':_0x313c04[_0x81a3('0x18')]?_0x313c04['options'][_0x81a3('0x19')]===undefined?!![]:![]:!![],'where':_0x313c04[_0x81a3('0x18')]?_0x313c04[_0x81a3('0x18')][_0x81a3('0x1a')]||null:null,'attributes':_0x313c04[_0x81a3('0x18')]?_0x313c04[_0x81a3('0x18')][_0x81a3('0x1b')]||null:null,'include':_0x313c04[_0x81a3('0x18')]?_0x313c04[_0x81a3('0x18')]['include']?_['map'](_0x313c04[_0x81a3('0x18')]['include'],function(_0x44cc1d){return{'model':db[_0x44cc1d['model']],'as':_0x44cc1d['as'],'attributes':_0x44cc1d['attributes'],'include':_0x44cc1d[_0x81a3('0x1c')]?_[_0x81a3('0x1e')](_0x44cc1d[_0x81a3('0x1c')],function(_0x2cd89f){return{'model':db[_0x2cd89f['model']],'as':_0x2cd89f['as'],'attributes':_0x2cd89f[_0x81a3('0x1b')],'include':_0x2cd89f[_0x81a3('0x1c')]?_[_0x81a3('0x1e')](_0x2cd89f['include'],function(_0x1721d9){return{'model':db[_0x1721d9['model']],'as':_0x1721d9['as'],'attributes':_0x1721d9['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x1bd7f4){logger[_0x81a3('0xc')]('ShowDynamics365Account',_0x313c04);logger[_0x81a3('0x1f')](_0x81a3('0x21'),_0x313c04,JSON[_0x81a3('0x10')](_0x1bd7f4));_0x1d154f(_0x1bd7f4);})['catch'](function(_0x503707){logger[_0x81a3('0x12')](_0x81a3('0x21'),_0x503707['message'],_0x313c04);_0x332d3f(_0x2f4db2[_0x81a3('0x12')](0x1f4,_0x503707[_0x81a3('0x13')]));});});}; \ No newline at end of file +var _0x90b5=['bluebird','randomstring','ioredis','../../config/logger','rpc','jayson/promise','client','http','request','then','info','Dynamics365Account,\x20%s,\x20%s','debug','Dynamics365Account,\x20%s,\x20%s,\x20%s','stringify','error','code','message','request\x20sent','result','catch','GetDynamics365Account','Dynamics365Account','options','raw','where','limit','map','model','include','attributes','ShowDynamics365Account','find','lodash','moment'];(function(_0x522162,_0x5c02e4){var _0x3a585f=function(_0x200a8f){while(--_0x200a8f){_0x522162['push'](_0x522162['shift']());}};_0x3a585f(++_0x5c02e4);}(_0x90b5,0x139));var _0x590b=function(_0x2fa4ee,_0x3e1dea){_0x2fa4ee=_0x2fa4ee-0x0;var _0x11b8aa=_0x90b5[_0x2fa4ee];return _0x11b8aa;};'use strict';var _=require(_0x590b('0x0'));var util=require('util');var moment=require(_0x590b('0x1'));var BPromise=require(_0x590b('0x2'));var rs=require(_0x590b('0x3'));var fs=require('fs');var Redis=require(_0x590b('0x4'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x590b('0x5'))(_0x590b('0x6'));var config=require('../../config/environment');var jayson=require(_0x590b('0x7'));var client=jayson[_0x590b('0x8')][_0x590b('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x5e54fe,_0x30bc6e,_0x3663a0){return new BPromise(function(_0x3ec156,_0x9c408b){return client[_0x590b('0xa')](_0x5e54fe,_0x3663a0)[_0x590b('0xb')](function(_0x2103c0){logger[_0x590b('0xc')](_0x590b('0xd'),_0x30bc6e,'request\x20sent');logger[_0x590b('0xe')](_0x590b('0xf'),_0x30bc6e,'request\x20sent',JSON[_0x590b('0x10')](_0x2103c0));if(_0x2103c0['error']){if(_0x2103c0[_0x590b('0x11')][_0x590b('0x12')]===0x1f4){logger[_0x590b('0x11')](_0x590b('0xd'),_0x30bc6e,_0x2103c0['error'][_0x590b('0x13')]);return _0x9c408b(_0x2103c0[_0x590b('0x11')][_0x590b('0x13')]);}logger[_0x590b('0x11')](_0x590b('0xd'),_0x30bc6e,_0x2103c0[_0x590b('0x11')][_0x590b('0x13')]);return _0x3ec156(_0x2103c0[_0x590b('0x11')][_0x590b('0x13')]);}else{logger[_0x590b('0xc')](_0x590b('0xd'),_0x30bc6e,_0x590b('0x14'));_0x3ec156(_0x2103c0[_0x590b('0x15')][_0x590b('0x13')]);}})[_0x590b('0x16')](function(_0x4f2512){logger[_0x590b('0x11')]('Dynamics365Account,\x20%s,\x20%s',_0x30bc6e,_0x4f2512);_0x9c408b(_0x4f2512);});});}exports[_0x590b('0x17')]=function(_0x115309){var _0xf05b00=this;return new Promise(function(_0x53337c,_0x4b2c3c){return db[_0x590b('0x18')]['findAll']({'raw':_0x115309[_0x590b('0x19')]?_0x115309[_0x590b('0x19')][_0x590b('0x1a')]===undefined?!![]:![]:!![],'where':_0x115309['options']?_0x115309[_0x590b('0x19')][_0x590b('0x1b')]||null:null,'attributes':_0x115309[_0x590b('0x19')]?_0x115309[_0x590b('0x19')]['attributes']||null:null,'limit':_0x115309[_0x590b('0x19')]?_0x115309['options'][_0x590b('0x1c')]||null:null,'include':_0x115309[_0x590b('0x19')]?_0x115309['options']['include']?_[_0x590b('0x1d')](_0x115309[_0x590b('0x19')]['include'],function(_0x21638c){return{'model':db[_0x21638c[_0x590b('0x1e')]],'as':_0x21638c['as'],'attributes':_0x21638c['attributes'],'include':_0x21638c['include']?_[_0x590b('0x1d')](_0x21638c['include'],function(_0x39fead){return{'model':db[_0x39fead['model']],'as':_0x39fead['as'],'attributes':_0x39fead['attributes'],'include':_0x39fead[_0x590b('0x1f')]?_[_0x590b('0x1d')](_0x39fead['include'],function(_0x1febcd){return{'model':db[_0x1febcd[_0x590b('0x1e')]],'as':_0x1febcd['as'],'attributes':_0x1febcd[_0x590b('0x20')]};}):[]};}):[]};}):[]:[]})[_0x590b('0xb')](function(_0x320a45){logger['info'](_0x590b('0x17'),_0x115309);logger[_0x590b('0xe')](_0x590b('0x17'),_0x115309,JSON[_0x590b('0x10')](_0x320a45));_0x53337c(_0x320a45);})[_0x590b('0x16')](function(_0x3b881f){logger['error'](_0x590b('0x17'),_0x3b881f['message'],_0x115309);_0x4b2c3c(_0xf05b00[_0x590b('0x11')](0x1f4,_0x3b881f[_0x590b('0x13')]));});});};exports[_0x590b('0x21')]=function(_0x33931e){var _0x53a751=this;return new Promise(function(_0x1041e5,_0x4ef071){return db[_0x590b('0x18')][_0x590b('0x22')]({'raw':_0x33931e[_0x590b('0x19')]?_0x33931e[_0x590b('0x19')][_0x590b('0x1a')]===undefined?!![]:![]:!![],'where':_0x33931e['options']?_0x33931e[_0x590b('0x19')][_0x590b('0x1b')]||null:null,'attributes':_0x33931e[_0x590b('0x19')]?_0x33931e[_0x590b('0x19')]['attributes']||null:null,'include':_0x33931e['options']?_0x33931e[_0x590b('0x19')][_0x590b('0x1f')]?_[_0x590b('0x1d')](_0x33931e[_0x590b('0x19')]['include'],function(_0x557cf2){return{'model':db[_0x557cf2[_0x590b('0x1e')]],'as':_0x557cf2['as'],'attributes':_0x557cf2['attributes'],'include':_0x557cf2[_0x590b('0x1f')]?_[_0x590b('0x1d')](_0x557cf2[_0x590b('0x1f')],function(_0x3c2d0f){return{'model':db[_0x3c2d0f[_0x590b('0x1e')]],'as':_0x3c2d0f['as'],'attributes':_0x3c2d0f[_0x590b('0x20')],'include':_0x3c2d0f[_0x590b('0x1f')]?_[_0x590b('0x1d')](_0x3c2d0f[_0x590b('0x1f')],function(_0x3e5c5e){return{'model':db[_0x3e5c5e['model']],'as':_0x3e5c5e['as'],'attributes':_0x3e5c5e['attributes']};}):[]};}):[]};}):[]:[]})[_0x590b('0xb')](function(_0x446db1){logger[_0x590b('0xc')](_0x590b('0x21'),_0x33931e);logger[_0x590b('0xe')]('ShowDynamics365Account',_0x33931e,JSON[_0x590b('0x10')](_0x446db1));_0x1041e5(_0x446db1);})[_0x590b('0x16')](function(_0x3e5ca5){logger[_0x590b('0x11')](_0x590b('0x21'),_0x3e5ca5['message'],_0x33931e);_0x4ef071(_0x53a751[_0x590b('0x11')](0x1f4,_0x3e5ca5[_0x590b('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/intDynamics365Configuration/index.js b/server/api/intDynamics365Configuration/index.js index a03d147..a83e31a 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 _0x4bc3=['/:id','isAuthenticated','/:id/fields','getFields','/:id/subjects','getSubjects','/:id/descriptions','post','create','update','delete','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./intDynamics365Configuration.controller','get'];(function(_0x4bc732,_0x57d27f){var _0x4e2302=function(_0x3ee898){while(--_0x3ee898){_0x4bc732['push'](_0x4bc732['shift']());}};_0x4e2302(++_0x57d27f);}(_0x4bc3,0x1ad));var _0x34bc=function(_0x119d5a,_0x19b457){_0x119d5a=_0x119d5a-0x0;var _0x15bff4=_0x4bc3[_0x119d5a];return _0x15bff4;};'use strict';var multer=require(_0x34bc('0x0'));var util=require(_0x34bc('0x1'));var path=require(_0x34bc('0x2'));var timeout=require(_0x34bc('0x3'));var express=require(_0x34bc('0x4'));var router=express[_0x34bc('0x5')]();var auth=require(_0x34bc('0x6'));var interaction=require(_0x34bc('0x7'));var config=require(_0x34bc('0x8'));var controller=require(_0x34bc('0x9'));router[_0x34bc('0xa')]('/',auth['isAuthenticated'](),controller['index']);router[_0x34bc('0xa')](_0x34bc('0xb'),auth[_0x34bc('0xc')](),controller['show']);router[_0x34bc('0xa')](_0x34bc('0xd'),auth[_0x34bc('0xc')](),controller[_0x34bc('0xe')]);router[_0x34bc('0xa')](_0x34bc('0xf'),auth[_0x34bc('0xc')](),controller[_0x34bc('0x10')]);router[_0x34bc('0xa')](_0x34bc('0x11'),auth[_0x34bc('0xc')](),controller['getDescriptions']);router[_0x34bc('0x12')]('/',auth[_0x34bc('0xc')](),controller[_0x34bc('0x13')]);router['put'](_0x34bc('0xb'),auth[_0x34bc('0xc')](),controller[_0x34bc('0x14')]);router[_0x34bc('0x15')](_0x34bc('0xb'),auth[_0x34bc('0xc')](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0x1744=['/:id/subjects','/:id/descriptions','getDescriptions','post','create','put','update','delete','multer','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/:id','getFields'];(function(_0x2f4d41,_0x104d39){var _0x2197d1=function(_0x2427ee){while(--_0x2427ee){_0x2f4d41['push'](_0x2f4d41['shift']());}};_0x2197d1(++_0x104d39);}(_0x1744,0x1d6));var _0x4174=function(_0x34331b,_0x22a64c){_0x34331b=_0x34331b-0x0;var _0x1f97c8=_0x1744[_0x34331b];return _0x1f97c8;};'use strict';var multer=require(_0x4174('0x0'));var util=require('util');var path=require(_0x4174('0x1'));var timeout=require(_0x4174('0x2'));var express=require(_0x4174('0x3'));var router=express[_0x4174('0x4')]();var auth=require(_0x4174('0x5'));var interaction=require(_0x4174('0x6'));var config=require(_0x4174('0x7'));var controller=require('./intDynamics365Configuration.controller');router[_0x4174('0x8')]('/',auth[_0x4174('0x9')](),controller[_0x4174('0xa')]);router[_0x4174('0x8')](_0x4174('0xb'),auth[_0x4174('0x9')](),controller['show']);router['get']('/:id/fields',auth[_0x4174('0x9')](),controller[_0x4174('0xc')]);router['get'](_0x4174('0xd'),auth[_0x4174('0x9')](),controller['getSubjects']);router[_0x4174('0x8')](_0x4174('0xe'),auth[_0x4174('0x9')](),controller[_0x4174('0xf')]);router[_0x4174('0x10')]('/',auth[_0x4174('0x9')](),controller[_0x4174('0x11')]);router[_0x4174('0x12')](_0x4174('0xb'),auth[_0x4174('0x9')](),controller[_0x4174('0x13')]);router[_0x4174('0x14')](_0x4174('0xb'),auth[_0x4174('0x9')](),controller['destroy']);module['exports']=router; \ No newline at end of file diff --git a/server/api/intDynamics365Configuration/intDynamics365Configuration.attributes.js b/server/api/intDynamics365Configuration/intDynamics365Configuration.attributes.js index f280967..54d24ea 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 _0x2cc4=['phonecall','sequelize','STRING','incident'];(function(_0x1d4760,_0x12268d){var _0x52a295=function(_0x367054){while(--_0x367054){_0x1d4760['push'](_0x1d4760['shift']());}};_0x52a295(++_0x12268d);}(_0x2cc4,0x69));var _0x42cc=function(_0x4232d8,_0x13fd09){_0x4232d8=_0x4232d8-0x0;var _0x324de2=_0x2cc4[_0x4232d8];return _0x324de2;};'use strict';var Sequelize=require(_0x42cc('0x0'));module['exports']={'name':{'type':Sequelize[_0x42cc('0x1')]},'description':{'type':Sequelize['STRING']},'ticketType':{'type':Sequelize['ENUM'](_0x42cc('0x2'),_0x42cc('0x3')),'defaultValue':'incident'}}; \ No newline at end of file +var _0xc1da=['STRING','incident'];(function(_0x741334,_0x4dadd8){var _0x11f9e0=function(_0x96e2a5){while(--_0x96e2a5){_0x741334['push'](_0x741334['shift']());}};_0x11f9e0(++_0x4dadd8);}(_0xc1da,0x1cc));var _0xac1d=function(_0x471df1,_0x4f8043){_0x471df1=_0x471df1-0x0;var _0x48dc99=_0xc1da[_0x471df1];return _0x48dc99;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize[_0xac1d('0x0')]},'description':{'type':Sequelize['STRING']},'ticketType':{'type':Sequelize['ENUM'](_0xac1d('0x1'),'phonecall'),'defaultValue':'incident'}}; \ No newline at end of file diff --git a/server/api/intDynamics365Configuration/intDynamics365Configuration.controller.js b/server/api/intDynamics365Configuration/intDynamics365Configuration.controller.js index 64de649..95bde14 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 _0x8cd1=['attributes','fields','query','hasOwnProperty','limit','order','sort','where','pick','merge','filter','includeAll','include','findAll','rows','show','length','create','body','find','params','getFields','findOne','Dynamics365Field','options','nolimit','getSubjects','getDescriptions','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/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','Dynamics365Configuration,\x20%s,\x20%s','request\x20sent','Dynamics365Configuration,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','status','end','json','count','offset','set','apply','reject','save','update','destroy','sendStatus','stack','name','index','Dynamics365Configuration','rawAttributes','fieldName','key','model','map','keys','filters','intersection'];(function(_0x42ce25,_0x7f11aa){var _0x14b4cd=function(_0x9e4b0c){while(--_0x9e4b0c){_0x42ce25['push'](_0x42ce25['shift']());}};_0x14b4cd(++_0x7f11aa);}(_0x8cd1,0x7b));var _0x18cd=function(_0x2a4121,_0xbcd897){_0x2a4121=_0x2a4121-0x0;var _0x4a21ae=_0x8cd1[_0x2a4121];return _0x4a21ae;};'use strict';var pdf=require(_0x18cd('0x0'));var emlformat=require(_0x18cd('0x1'));var rimraf=require(_0x18cd('0x2'));var zipdir=require(_0x18cd('0x3'));var jsonpatch=require(_0x18cd('0x4'));var rp=require(_0x18cd('0x5'));var moment=require(_0x18cd('0x6'));var BPromise=require('bluebird');var Mustache=require(_0x18cd('0x7'));var util=require(_0x18cd('0x8'));var path=require(_0x18cd('0x9'));var sox=require('sox');var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var _=require(_0x18cd('0xa'));var squel=require(_0x18cd('0xb'));var crypto=require(_0x18cd('0xc'));var jsforce=require(_0x18cd('0xd'));var deskjs=require(_0x18cd('0xe'));var toCsv=require(_0x18cd('0xf'));var querystring=require(_0x18cd('0x10'));var Papa=require('papaparse');var Redis=require(_0x18cd('0x11'));var authService=require(_0x18cd('0x12'));var qs=require(_0x18cd('0x13'));var as=require(_0x18cd('0x14'));var hardwareService=require(_0x18cd('0x15'));var logger=require(_0x18cd('0x16'))('api');var utils=require(_0x18cd('0x17'));var config=require(_0x18cd('0x18'));var db=require(_0x18cd('0x19'))['db'];var jayson=require(_0x18cd('0x1a'));var client=jayson[_0x18cd('0x1b')][_0x18cd('0x1c')]({'port':0x232a});function checkPasswordPattern(_0x133d6b,_0x537f1d,_0xa46b34){if(_0xa46b34){var _0x185354=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x185354[_0x18cd('0x1d')](_0x537f1d)){return _0x133d6b;}else{throw new db[(_0x18cd('0x1e'))]['ValidationError'](_0x18cd('0x1f'));}}else{return _0x133d6b;}}function respondWithRpcPromise(_0x5e16c7,_0x402737,_0x44038e,_0x39da3a){return new BPromise(function(_0xa118c8,_0x596b94){var _0x195ba1=_0x39da3a||client;return _0x195ba1[_0x18cd('0x20')](_0x5e16c7,_0x44038e)[_0x18cd('0x21')](function(_0x11881a){logger[_0x18cd('0x22')](_0x18cd('0x23'),_0x402737,_0x18cd('0x24'));logger['debug'](_0x18cd('0x25'),_0x402737,_0x18cd('0x24'),JSON[_0x18cd('0x26')](_0x11881a));if(_0x11881a[_0x18cd('0x27')]){if(_0x11881a[_0x18cd('0x27')][_0x18cd('0x28')]===0x1f4){logger[_0x18cd('0x27')]('Dynamics365Configuration,\x20%s,\x20%s',_0x402737,_0x11881a[_0x18cd('0x27')]['message']);return _0x596b94(_0x11881a['error']['message']);}logger['error']('Dynamics365Configuration,\x20%s,\x20%s',_0x402737,_0x11881a[_0x18cd('0x27')]['message']);return _0xa118c8(_0x11881a['error'][_0x18cd('0x29')]);}else{logger[_0x18cd('0x22')]('Dynamics365Configuration,\x20%s,\x20%s',_0x402737,'request\x20sent');_0xa118c8(_0x11881a['result'][_0x18cd('0x29')]);}})[_0x18cd('0x2a')](function(_0xd6a069){logger[_0x18cd('0x27')](_0x18cd('0x23'),_0x402737,_0xd6a069);_0x596b94(_0xd6a069);});});}function respondWithStatusCode(_0x5e2433,_0x3c7ecd){_0x3c7ecd=_0x3c7ecd||0xcc;return function(_0x13bd2a){if(_0x13bd2a){return _0x5e2433['sendStatus'](_0x3c7ecd);}return _0x5e2433[_0x18cd('0x2b')](_0x3c7ecd)[_0x18cd('0x2c')]();};}function respondWithResult(_0x5af684,_0xd68f4b){_0xd68f4b=_0xd68f4b||0xc8;return function(_0x54bfe4){if(_0x54bfe4){return _0x5af684[_0x18cd('0x2b')](_0xd68f4b)[_0x18cd('0x2d')](_0x54bfe4);}};}function respondWithFilteredResult(_0x250680,_0x5af3f5){return function(_0x226eae){if(_0x226eae){var _0x2ffff1=_0x226eae[_0x18cd('0x2e')],_0x91fc5c=_0x5af3f5[_0x18cd('0x2f')],_0x56c688=_0x5af3f5[_0x18cd('0x2f')]+_0x5af3f5['limit'],_0xbfa8d2;if(_0x56c688>=_0x2ffff1){_0x56c688=_0x2ffff1;_0xbfa8d2=0xc8;}else{_0xbfa8d2=0xce;}_0x250680[_0x18cd('0x2b')](_0xbfa8d2);return _0x250680[_0x18cd('0x30')]('Content-Range',_0x91fc5c+'-'+_0x56c688+'/'+_0x2ffff1)[_0x18cd('0x2d')](_0x226eae);}return null;};}function patchUpdates(_0x5c6bfb){return function(_0x5a9754){try{jsonpatch[_0x18cd('0x31')](_0x5a9754,_0x5c6bfb,!![]);}catch(_0x4e1ab9){return BPromise[_0x18cd('0x32')](_0x4e1ab9);}return _0x5a9754[_0x18cd('0x33')]();};}function saveUpdates(_0x8df7bb,_0x3b82c5){return function(_0x106a1d){if(_0x106a1d){return _0x106a1d[_0x18cd('0x34')](_0x8df7bb)[_0x18cd('0x21')](function(_0x4abb51){return _0x4abb51;});}return null;};}function removeEntity(_0x455477,_0x4aec27){return function(_0x4d36c6){if(_0x4d36c6){return _0x4d36c6[_0x18cd('0x35')]()['then'](function(){_0x455477[_0x18cd('0x2b')](0xcc)[_0x18cd('0x2c')]();});}};}function handleEntityNotFound(_0x4c23a4,_0x452a86){return function(_0x43f960){if(!_0x43f960){_0x4c23a4[_0x18cd('0x36')](0x194);}return _0x43f960;};}function handleError(_0x13f249,_0x30b832){_0x30b832=_0x30b832||0x1f4;return function(_0x42e778){logger[_0x18cd('0x27')](_0x42e778[_0x18cd('0x37')]);if(_0x42e778[_0x18cd('0x38')]){delete _0x42e778[_0x18cd('0x38')];}_0x13f249['status'](_0x30b832)['send'](_0x42e778);};}exports[_0x18cd('0x39')]=function(_0x41a1a1,_0x100fcd){var _0x2bbbd5={},_0x960795={},_0x219cf4={'count':0x0,'rows':[]};var _0xc1fe0a=_['map'](db[_0x18cd('0x3a')][_0x18cd('0x3b')],function(_0xe5dd98){return{'name':_0xe5dd98[_0x18cd('0x3c')],'type':_0xe5dd98['type'][_0x18cd('0x3d')]};});_0x960795[_0x18cd('0x3e')]=_[_0x18cd('0x3f')](_0xc1fe0a,_0x18cd('0x38'));_0x960795['query']=_[_0x18cd('0x40')](_0x41a1a1['query']);_0x960795[_0x18cd('0x41')]=_[_0x18cd('0x42')](_0x960795[_0x18cd('0x3e')],_0x960795['query']);_0x2bbbd5[_0x18cd('0x43')]=_['intersection'](_0x960795[_0x18cd('0x3e')],qs['fields'](_0x41a1a1['query'][_0x18cd('0x44')]));_0x2bbbd5[_0x18cd('0x43')]=_0x2bbbd5[_0x18cd('0x43')]['length']?_0x2bbbd5['attributes']:_0x960795[_0x18cd('0x3e')];if(!_0x41a1a1[_0x18cd('0x45')][_0x18cd('0x46')]('nolimit')){_0x2bbbd5[_0x18cd('0x47')]=qs[_0x18cd('0x47')](_0x41a1a1[_0x18cd('0x45')][_0x18cd('0x47')]);_0x2bbbd5['offset']=qs[_0x18cd('0x2f')](_0x41a1a1[_0x18cd('0x45')][_0x18cd('0x2f')]);}_0x2bbbd5[_0x18cd('0x48')]=qs[_0x18cd('0x49')](_0x41a1a1[_0x18cd('0x45')][_0x18cd('0x49')]);_0x2bbbd5[_0x18cd('0x4a')]=qs[_0x18cd('0x41')](_[_0x18cd('0x4b')](_0x41a1a1[_0x18cd('0x45')],_0x960795[_0x18cd('0x41')]));if(_0x41a1a1[_0x18cd('0x45')]['filter']){_0x2bbbd5['where']=_[_0x18cd('0x4c')](_0x2bbbd5['where'],{'$or':_[_0x18cd('0x3f')](_0xc1fe0a,function(_0xbd5e49){if(_0xbd5e49['type']!=='VIRTUAL'){var _0x1eef46={};_0x1eef46[_0xbd5e49[_0x18cd('0x38')]]={'$like':'%'+_0x41a1a1[_0x18cd('0x45')][_0x18cd('0x4d')]+'%'};return _0x1eef46;}})});}_0x2bbbd5=_[_0x18cd('0x4c')]({},_0x2bbbd5,_0x41a1a1['options']);var _0xb9e236={'where':_0x2bbbd5[_0x18cd('0x4a')]};return db[_0x18cd('0x3a')][_0x18cd('0x2e')](_0xb9e236)[_0x18cd('0x21')](function(_0x2b04b7){_0x219cf4['count']=_0x2b04b7;if(_0x41a1a1[_0x18cd('0x45')][_0x18cd('0x4e')]){_0x2bbbd5[_0x18cd('0x4f')]=[{'all':!![]}];}return db[_0x18cd('0x3a')][_0x18cd('0x50')](_0x2bbbd5);})['then'](function(_0x3e6b0f){_0x219cf4[_0x18cd('0x51')]=_0x3e6b0f;return _0x219cf4;})[_0x18cd('0x21')](respondWithFilteredResult(_0x100fcd,_0x2bbbd5))['catch'](handleError(_0x100fcd,null));};exports[_0x18cd('0x52')]=function(_0x32f097,_0x318076){var _0x2ca7d7={'raw':![],'where':{'id':_0x32f097['params']['id']}},_0x49ab43={};_0x49ab43['model']=_[_0x18cd('0x40')](db['Dynamics365Configuration']['rawAttributes']);_0x49ab43[_0x18cd('0x45')]=_[_0x18cd('0x40')](_0x32f097['query']);_0x49ab43[_0x18cd('0x41')]=_[_0x18cd('0x42')](_0x49ab43[_0x18cd('0x3e')],_0x49ab43[_0x18cd('0x45')]);_0x2ca7d7[_0x18cd('0x43')]=_['intersection'](_0x49ab43[_0x18cd('0x3e')],qs[_0x18cd('0x44')](_0x32f097['query'][_0x18cd('0x44')]));_0x2ca7d7['attributes']=_0x2ca7d7[_0x18cd('0x43')][_0x18cd('0x53')]?_0x2ca7d7[_0x18cd('0x43')]:_0x49ab43[_0x18cd('0x3e')];if(_0x32f097[_0x18cd('0x45')][_0x18cd('0x4e')]){_0x2ca7d7[_0x18cd('0x4f')]=[{'all':!![]}];}_0x2ca7d7=_['merge']({},_0x2ca7d7,_0x32f097['options']);return db[_0x18cd('0x3a')]['find'](_0x2ca7d7)[_0x18cd('0x21')](handleEntityNotFound(_0x318076,null))['then'](respondWithResult(_0x318076,null))[_0x18cd('0x2a')](handleError(_0x318076,null));};exports['create']=function(_0x13fb93,_0x11148b){return db[_0x18cd('0x3a')][_0x18cd('0x54')](_0x13fb93[_0x18cd('0x55')],{})[_0x18cd('0x21')](respondWithResult(_0x11148b,0xc9))['catch'](handleError(_0x11148b,null));};exports[_0x18cd('0x34')]=function(_0xd72e47,_0x4a5fc9){if(_0xd72e47[_0x18cd('0x55')]['id']){delete _0xd72e47['body']['id'];}return db['Dynamics365Configuration'][_0x18cd('0x56')]({'where':{'id':_0xd72e47[_0x18cd('0x57')]['id']}})[_0x18cd('0x21')](handleEntityNotFound(_0x4a5fc9,null))[_0x18cd('0x21')](saveUpdates(_0xd72e47[_0x18cd('0x55')],null))['then'](respondWithResult(_0x4a5fc9,null))['catch'](handleError(_0x4a5fc9,null));};exports['destroy']=function(_0x374dc2,_0x1e44fb){return db[_0x18cd('0x3a')]['find']({'where':{'id':_0x374dc2[_0x18cd('0x57')]['id']}})[_0x18cd('0x21')](handleEntityNotFound(_0x1e44fb,null))[_0x18cd('0x21')](removeEntity(_0x1e44fb,null))[_0x18cd('0x2a')](handleError(_0x1e44fb,null));};exports[_0x18cd('0x58')]=function(_0x572364,_0x51d598,_0x483d92){var _0x57a2be={};var _0x81a5af={};var _0x34ce7f;var _0x208ce1;return db[_0x18cd('0x3a')][_0x18cd('0x59')]({'where':{'id':_0x572364[_0x18cd('0x57')]['id']}})[_0x18cd('0x21')](handleEntityNotFound(_0x51d598,null))['then'](function(_0x5e2d38){if(_0x5e2d38){_0x34ce7f=_0x5e2d38;_0x81a5af[_0x18cd('0x3e')]=_[_0x18cd('0x40')](db[_0x18cd('0x5a')][_0x18cd('0x3b')]);_0x81a5af[_0x18cd('0x45')]=_[_0x18cd('0x40')](_0x572364['query']);_0x81a5af['filters']=_[_0x18cd('0x42')](_0x81a5af[_0x18cd('0x3e')],_0x81a5af[_0x18cd('0x45')]);_0x57a2be['attributes']=_['intersection'](_0x81a5af[_0x18cd('0x3e')],qs[_0x18cd('0x44')](_0x572364['query'][_0x18cd('0x44')]));_0x57a2be['attributes']=_0x57a2be['attributes']['length']?_0x57a2be['attributes']:_0x81a5af['model'];_0x57a2be[_0x18cd('0x48')]=qs['sort'](_0x572364['query'][_0x18cd('0x49')]);_0x57a2be[_0x18cd('0x4a')]=qs[_0x18cd('0x41')](_[_0x18cd('0x4b')](_0x572364['query'],_0x81a5af[_0x18cd('0x41')]));if(_0x572364[_0x18cd('0x45')][_0x18cd('0x4d')]){_0x57a2be[_0x18cd('0x4a')]=_[_0x18cd('0x4c')](_0x57a2be[_0x18cd('0x4a')],{'$or':_['map'](_0x57a2be[_0x18cd('0x43')],function(_0x47c16c){var _0x56219e={};_0x56219e[_0x47c16c]={'$like':'%'+_0x572364[_0x18cd('0x45')][_0x18cd('0x4d')]+'%'};return _0x56219e;})});}_0x57a2be=_[_0x18cd('0x4c')]({},_0x57a2be,_0x572364[_0x18cd('0x5b')]);return _0x34ce7f[_0x18cd('0x58')](_0x57a2be);}})[_0x18cd('0x21')](function(_0x1e3fd1){if(_0x1e3fd1){_0x208ce1=_0x1e3fd1[_0x18cd('0x53')];if(!_0x572364[_0x18cd('0x45')][_0x18cd('0x46')](_0x18cd('0x5c'))){_0x57a2be[_0x18cd('0x47')]=qs['limit'](_0x572364[_0x18cd('0x45')]['limit']);_0x57a2be[_0x18cd('0x2f')]=qs[_0x18cd('0x2f')](_0x572364[_0x18cd('0x45')][_0x18cd('0x2f')]);}return _0x34ce7f[_0x18cd('0x58')](_0x57a2be);}})[_0x18cd('0x21')](function(_0x38f75f){if(_0x38f75f){return _0x38f75f?{'count':_0x208ce1,'rows':_0x38f75f}:null;}})[_0x18cd('0x21')](respondWithResult(_0x51d598,null))[_0x18cd('0x2a')](handleError(_0x51d598,null));};exports[_0x18cd('0x5d')]=function(_0x2e02a6,_0x2cb6c9,_0x15751c){var _0x13ff74={};var _0x2a862a={};var _0x145f8a;var _0x327f99;return db[_0x18cd('0x3a')][_0x18cd('0x59')]({'where':{'id':_0x2e02a6[_0x18cd('0x57')]['id']}})[_0x18cd('0x21')](handleEntityNotFound(_0x2cb6c9,null))[_0x18cd('0x21')](function(_0x41241c){if(_0x41241c){_0x145f8a=_0x41241c;_0x2a862a[_0x18cd('0x3e')]=_[_0x18cd('0x40')](db[_0x18cd('0x5a')]['rawAttributes']);_0x2a862a['query']=_['keys'](_0x2e02a6[_0x18cd('0x45')]);_0x2a862a['filters']=_['intersection'](_0x2a862a['model'],_0x2a862a[_0x18cd('0x45')]);_0x13ff74['attributes']=_[_0x18cd('0x42')](_0x2a862a[_0x18cd('0x3e')],qs[_0x18cd('0x44')](_0x2e02a6[_0x18cd('0x45')][_0x18cd('0x44')]));_0x13ff74[_0x18cd('0x43')]=_0x13ff74[_0x18cd('0x43')]['length']?_0x13ff74[_0x18cd('0x43')]:_0x2a862a[_0x18cd('0x3e')];_0x13ff74['order']=qs[_0x18cd('0x49')](_0x2e02a6['query'][_0x18cd('0x49')]);_0x13ff74[_0x18cd('0x4a')]=qs[_0x18cd('0x41')](_[_0x18cd('0x4b')](_0x2e02a6[_0x18cd('0x45')],_0x2a862a[_0x18cd('0x41')]));if(_0x2e02a6['query'][_0x18cd('0x4d')]){_0x13ff74[_0x18cd('0x4a')]=_[_0x18cd('0x4c')](_0x13ff74[_0x18cd('0x4a')],{'$or':_[_0x18cd('0x3f')](_0x13ff74[_0x18cd('0x43')],function(_0xa94d01){var _0x164605={};_0x164605[_0xa94d01]={'$like':'%'+_0x2e02a6['query']['filter']+'%'};return _0x164605;})});}_0x13ff74=_['merge']({},_0x13ff74,_0x2e02a6[_0x18cd('0x5b')]);return _0x145f8a[_0x18cd('0x5d')](_0x13ff74);}})[_0x18cd('0x21')](function(_0x3da19c){if(_0x3da19c){_0x327f99=_0x3da19c[_0x18cd('0x53')];if(!_0x2e02a6[_0x18cd('0x45')]['hasOwnProperty'](_0x18cd('0x5c'))){_0x13ff74['limit']=qs[_0x18cd('0x47')](_0x2e02a6[_0x18cd('0x45')]['limit']);_0x13ff74[_0x18cd('0x2f')]=qs[_0x18cd('0x2f')](_0x2e02a6[_0x18cd('0x45')][_0x18cd('0x2f')]);}return _0x145f8a[_0x18cd('0x5d')](_0x13ff74);}})[_0x18cd('0x21')](function(_0x17f83d){if(_0x17f83d){return _0x17f83d?{'count':_0x327f99,'rows':_0x17f83d}:null;}})[_0x18cd('0x21')](respondWithResult(_0x2cb6c9,null))[_0x18cd('0x2a')](handleError(_0x2cb6c9,null));};exports['getDescriptions']=function(_0x5ab35a,_0x31ae5d,_0x673f8){var _0x4bcf4a={};var _0x244abb={};var _0x3e0b37;var _0x18919b;return db[_0x18cd('0x3a')][_0x18cd('0x59')]({'where':{'id':_0x5ab35a[_0x18cd('0x57')]['id']}})[_0x18cd('0x21')](handleEntityNotFound(_0x31ae5d,null))['then'](function(_0x1b62f3){if(_0x1b62f3){_0x3e0b37=_0x1b62f3;_0x244abb[_0x18cd('0x3e')]=_[_0x18cd('0x40')](db[_0x18cd('0x5a')][_0x18cd('0x3b')]);_0x244abb[_0x18cd('0x45')]=_[_0x18cd('0x40')](_0x5ab35a[_0x18cd('0x45')]);_0x244abb[_0x18cd('0x41')]=_[_0x18cd('0x42')](_0x244abb[_0x18cd('0x3e')],_0x244abb[_0x18cd('0x45')]);_0x4bcf4a['attributes']=_[_0x18cd('0x42')](_0x244abb[_0x18cd('0x3e')],qs['fields'](_0x5ab35a[_0x18cd('0x45')]['fields']));_0x4bcf4a[_0x18cd('0x43')]=_0x4bcf4a[_0x18cd('0x43')]['length']?_0x4bcf4a['attributes']:_0x244abb[_0x18cd('0x3e')];_0x4bcf4a[_0x18cd('0x48')]=qs['sort'](_0x5ab35a[_0x18cd('0x45')]['sort']);_0x4bcf4a[_0x18cd('0x4a')]=qs[_0x18cd('0x41')](_[_0x18cd('0x4b')](_0x5ab35a[_0x18cd('0x45')],_0x244abb[_0x18cd('0x41')]));if(_0x5ab35a[_0x18cd('0x45')][_0x18cd('0x4d')]){_0x4bcf4a[_0x18cd('0x4a')]=_[_0x18cd('0x4c')](_0x4bcf4a[_0x18cd('0x4a')],{'$or':_['map'](_0x4bcf4a[_0x18cd('0x43')],function(_0x44d4ff){var _0x3dea67={};_0x3dea67[_0x44d4ff]={'$like':'%'+_0x5ab35a[_0x18cd('0x45')][_0x18cd('0x4d')]+'%'};return _0x3dea67;})});}_0x4bcf4a=_[_0x18cd('0x4c')]({},_0x4bcf4a,_0x5ab35a[_0x18cd('0x5b')]);return _0x3e0b37['getDescriptions'](_0x4bcf4a);}})[_0x18cd('0x21')](function(_0x15b842){if(_0x15b842){_0x18919b=_0x15b842['length'];if(!_0x5ab35a[_0x18cd('0x45')][_0x18cd('0x46')]('nolimit')){_0x4bcf4a['limit']=qs['limit'](_0x5ab35a[_0x18cd('0x45')]['limit']);_0x4bcf4a[_0x18cd('0x2f')]=qs[_0x18cd('0x2f')](_0x5ab35a[_0x18cd('0x45')]['offset']);}return _0x3e0b37[_0x18cd('0x5e')](_0x4bcf4a);}})[_0x18cd('0x21')](function(_0x5e467f){if(_0x5e467f){return _0x5e467f?{'count':_0x18919b,'rows':_0x5e467f}:null;}})['then'](respondWithResult(_0x31ae5d,null))[_0x18cd('0x2a')](handleError(_0x31ae5d,null));}; \ No newline at end of file +var _0x1f96=['sort','hasOwnProperty','nolimit','Dynamics365Field','pick','getSubjects','getDescriptions','html-pdf','rimraf','zip-dir','fast-json-patch','request-promise','util','path','sox','to-csv','ejs','lodash','crypto','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/environment','../../mysqldb','jayson/promise','client','http','test','ValidationError','request','then','Dynamics365Configuration,\x20%s,\x20%s','request\x20sent','debug','Dynamics365Configuration,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','catch','status','end','json','offset','Content-Range','apply','save','update','destroy','sendStatus','stack','name','index','rawAttributes','fieldName','type','key','map','query','filters','intersection','model','attributes','fields','length','limit','order','where','filter','merge','VIRTUAL','options','Dynamics365Configuration','count','includeAll','include','findAll','rows','params','keys','find','create','body','getFields','findOne'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x1f96,0xbb));var _0x61f9=function(_0x45eb69,_0x4ec50c){_0x45eb69=_0x45eb69-0x0;var _0x1a80cf=_0x1f96[_0x45eb69];return _0x1a80cf;};'use strict';var pdf=require(_0x61f9('0x0'));var emlformat=require('eml-format');var rimraf=require(_0x61f9('0x1'));var zipdir=require(_0x61f9('0x2'));var jsonpatch=require(_0x61f9('0x3'));var rp=require(_0x61f9('0x4'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x61f9('0x5'));var path=require(_0x61f9('0x6'));var sox=require(_0x61f9('0x7'));var csv=require(_0x61f9('0x8'));var ejs=require(_0x61f9('0x9'));var fs=require('fs');var _=require(_0x61f9('0xa'));var squel=require('squel');var crypto=require(_0x61f9('0xb'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x61f9('0xc'));var Redis=require(_0x61f9('0xd'));var authService=require(_0x61f9('0xe'));var qs=require(_0x61f9('0xf'));var as=require(_0x61f9('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x61f9('0x11'))(_0x61f9('0x12'));var utils=require('../../config/utils');var config=require(_0x61f9('0x13'));var db=require(_0x61f9('0x14'))['db'];var jayson=require(_0x61f9('0x15'));var client=jayson[_0x61f9('0x16')][_0x61f9('0x17')]({'port':0x232a});function checkPasswordPattern(_0x2c082c,_0x58b758,_0x8b9db1){if(_0x8b9db1){var _0x29b1b5=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x29b1b5[_0x61f9('0x18')](_0x58b758)){return _0x2c082c;}else{throw new db['Sequelize'][(_0x61f9('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 _0x2c082c;}}function respondWithRpcPromise(_0x293846,_0x2ded0b,_0x45e7fb,_0x4bb2b1){return new BPromise(function(_0x18bdca,_0x2b1334){var _0x5b8f03=_0x4bb2b1||client;return _0x5b8f03[_0x61f9('0x1a')](_0x293846,_0x45e7fb)[_0x61f9('0x1b')](function(_0x5305a4){logger['info'](_0x61f9('0x1c'),_0x2ded0b,_0x61f9('0x1d'));logger[_0x61f9('0x1e')](_0x61f9('0x1f'),_0x2ded0b,_0x61f9('0x1d'),JSON[_0x61f9('0x20')](_0x5305a4));if(_0x5305a4[_0x61f9('0x21')]){if(_0x5305a4['error'][_0x61f9('0x22')]===0x1f4){logger[_0x61f9('0x21')]('Dynamics365Configuration,\x20%s,\x20%s',_0x2ded0b,_0x5305a4['error'][_0x61f9('0x23')]);return _0x2b1334(_0x5305a4[_0x61f9('0x21')][_0x61f9('0x23')]);}logger[_0x61f9('0x21')](_0x61f9('0x1c'),_0x2ded0b,_0x5305a4['error'][_0x61f9('0x23')]);return _0x18bdca(_0x5305a4['error'][_0x61f9('0x23')]);}else{logger[_0x61f9('0x24')](_0x61f9('0x1c'),_0x2ded0b,_0x61f9('0x1d'));_0x18bdca(_0x5305a4['result'][_0x61f9('0x23')]);}})[_0x61f9('0x25')](function(_0x29f42d){logger[_0x61f9('0x21')](_0x61f9('0x1c'),_0x2ded0b,_0x29f42d);_0x2b1334(_0x29f42d);});});}function respondWithStatusCode(_0x3f56d1,_0x4e05a9){_0x4e05a9=_0x4e05a9||0xcc;return function(_0x1177cd){if(_0x1177cd){return _0x3f56d1['sendStatus'](_0x4e05a9);}return _0x3f56d1[_0x61f9('0x26')](_0x4e05a9)[_0x61f9('0x27')]();};}function respondWithResult(_0x18d5ca,_0x3b42d9){_0x3b42d9=_0x3b42d9||0xc8;return function(_0x5e294c){if(_0x5e294c){return _0x18d5ca[_0x61f9('0x26')](_0x3b42d9)[_0x61f9('0x28')](_0x5e294c);}};}function respondWithFilteredResult(_0x4d6275,_0xb443e4){return function(_0x4678d5){if(_0x4678d5){var _0x1b4575=_0x4678d5['count'],_0x15dddd=_0xb443e4['offset'],_0x2623ba=_0xb443e4[_0x61f9('0x29')]+_0xb443e4['limit'],_0x14f8e8;if(_0x2623ba>=_0x1b4575){_0x2623ba=_0x1b4575;_0x14f8e8=0xc8;}else{_0x14f8e8=0xce;}_0x4d6275[_0x61f9('0x26')](_0x14f8e8);return _0x4d6275['set'](_0x61f9('0x2a'),_0x15dddd+'-'+_0x2623ba+'/'+_0x1b4575)[_0x61f9('0x28')](_0x4678d5);}return null;};}function patchUpdates(_0x80bf71){return function(_0xf03a8e){try{jsonpatch[_0x61f9('0x2b')](_0xf03a8e,_0x80bf71,!![]);}catch(_0x20c8e8){return BPromise['reject'](_0x20c8e8);}return _0xf03a8e[_0x61f9('0x2c')]();};}function saveUpdates(_0x282c35,_0x42e8c9){return function(_0x2d0bd0){if(_0x2d0bd0){return _0x2d0bd0[_0x61f9('0x2d')](_0x282c35)[_0x61f9('0x1b')](function(_0x4deaae){return _0x4deaae;});}return null;};}function removeEntity(_0x3d78ab,_0x59d762){return function(_0x37b533){if(_0x37b533){return _0x37b533[_0x61f9('0x2e')]()[_0x61f9('0x1b')](function(){_0x3d78ab['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x37be7e,_0x5382b0){return function(_0x2d95c4){if(!_0x2d95c4){_0x37be7e[_0x61f9('0x2f')](0x194);}return _0x2d95c4;};}function handleError(_0x25eb0a,_0x3a1f01){_0x3a1f01=_0x3a1f01||0x1f4;return function(_0x5dcd03){logger[_0x61f9('0x21')](_0x5dcd03[_0x61f9('0x30')]);if(_0x5dcd03[_0x61f9('0x31')]){delete _0x5dcd03[_0x61f9('0x31')];}_0x25eb0a['status'](_0x3a1f01)['send'](_0x5dcd03);};}exports[_0x61f9('0x32')]=function(_0x3f8433,_0x2c9947){var _0x765902={},_0x59a9e3={},_0x33300e={'count':0x0,'rows':[]};var _0x120fe9=_['map'](db['Dynamics365Configuration'][_0x61f9('0x33')],function(_0x1dfca1){return{'name':_0x1dfca1[_0x61f9('0x34')],'type':_0x1dfca1[_0x61f9('0x35')][_0x61f9('0x36')]};});_0x59a9e3['model']=_[_0x61f9('0x37')](_0x120fe9,_0x61f9('0x31'));_0x59a9e3[_0x61f9('0x38')]=_['keys'](_0x3f8433['query']);_0x59a9e3[_0x61f9('0x39')]=_[_0x61f9('0x3a')](_0x59a9e3[_0x61f9('0x3b')],_0x59a9e3[_0x61f9('0x38')]);_0x765902[_0x61f9('0x3c')]=_[_0x61f9('0x3a')](_0x59a9e3['model'],qs[_0x61f9('0x3d')](_0x3f8433['query'][_0x61f9('0x3d')]));_0x765902[_0x61f9('0x3c')]=_0x765902['attributes'][_0x61f9('0x3e')]?_0x765902[_0x61f9('0x3c')]:_0x59a9e3['model'];if(!_0x3f8433[_0x61f9('0x38')]['hasOwnProperty']('nolimit')){_0x765902[_0x61f9('0x3f')]=qs[_0x61f9('0x3f')](_0x3f8433['query']['limit']);_0x765902[_0x61f9('0x29')]=qs['offset'](_0x3f8433[_0x61f9('0x38')][_0x61f9('0x29')]);}_0x765902[_0x61f9('0x40')]=qs['sort'](_0x3f8433[_0x61f9('0x38')]['sort']);_0x765902[_0x61f9('0x41')]=qs[_0x61f9('0x39')](_['pick'](_0x3f8433[_0x61f9('0x38')],_0x59a9e3[_0x61f9('0x39')]));if(_0x3f8433['query'][_0x61f9('0x42')]){_0x765902[_0x61f9('0x41')]=_[_0x61f9('0x43')](_0x765902[_0x61f9('0x41')],{'$or':_['map'](_0x120fe9,function(_0x31889e){if(_0x31889e['type']!==_0x61f9('0x44')){var _0x21f72a={};_0x21f72a[_0x31889e[_0x61f9('0x31')]]={'$like':'%'+_0x3f8433[_0x61f9('0x38')]['filter']+'%'};return _0x21f72a;}})});}_0x765902=_[_0x61f9('0x43')]({},_0x765902,_0x3f8433[_0x61f9('0x45')]);var _0x3ca773={'where':_0x765902[_0x61f9('0x41')]};return db[_0x61f9('0x46')][_0x61f9('0x47')](_0x3ca773)[_0x61f9('0x1b')](function(_0x21c00a){_0x33300e[_0x61f9('0x47')]=_0x21c00a;if(_0x3f8433['query'][_0x61f9('0x48')]){_0x765902[_0x61f9('0x49')]=[{'all':!![]}];}return db[_0x61f9('0x46')][_0x61f9('0x4a')](_0x765902);})[_0x61f9('0x1b')](function(_0x1153ac){_0x33300e[_0x61f9('0x4b')]=_0x1153ac;return _0x33300e;})[_0x61f9('0x1b')](respondWithFilteredResult(_0x2c9947,_0x765902))[_0x61f9('0x25')](handleError(_0x2c9947,null));};exports['show']=function(_0x105a29,_0x2e98ad){var _0x563ce2={'raw':![],'where':{'id':_0x105a29[_0x61f9('0x4c')]['id']}},_0x34988e={};_0x34988e[_0x61f9('0x3b')]=_[_0x61f9('0x4d')](db[_0x61f9('0x46')][_0x61f9('0x33')]);_0x34988e[_0x61f9('0x38')]=_['keys'](_0x105a29[_0x61f9('0x38')]);_0x34988e[_0x61f9('0x39')]=_['intersection'](_0x34988e[_0x61f9('0x3b')],_0x34988e[_0x61f9('0x38')]);_0x563ce2[_0x61f9('0x3c')]=_['intersection'](_0x34988e['model'],qs['fields'](_0x105a29[_0x61f9('0x38')][_0x61f9('0x3d')]));_0x563ce2[_0x61f9('0x3c')]=_0x563ce2[_0x61f9('0x3c')]['length']?_0x563ce2[_0x61f9('0x3c')]:_0x34988e[_0x61f9('0x3b')];if(_0x105a29[_0x61f9('0x38')][_0x61f9('0x48')]){_0x563ce2[_0x61f9('0x49')]=[{'all':!![]}];}_0x563ce2=_[_0x61f9('0x43')]({},_0x563ce2,_0x105a29[_0x61f9('0x45')]);return db[_0x61f9('0x46')][_0x61f9('0x4e')](_0x563ce2)[_0x61f9('0x1b')](handleEntityNotFound(_0x2e98ad,null))[_0x61f9('0x1b')](respondWithResult(_0x2e98ad,null))[_0x61f9('0x25')](handleError(_0x2e98ad,null));};exports['create']=function(_0x20d082,_0x517243){return db[_0x61f9('0x46')][_0x61f9('0x4f')](_0x20d082[_0x61f9('0x50')],{})['then'](respondWithResult(_0x517243,0xc9))['catch'](handleError(_0x517243,null));};exports[_0x61f9('0x2d')]=function(_0x54c686,_0x299ec5){if(_0x54c686[_0x61f9('0x50')]['id']){delete _0x54c686[_0x61f9('0x50')]['id'];}return db['Dynamics365Configuration'][_0x61f9('0x4e')]({'where':{'id':_0x54c686['params']['id']}})[_0x61f9('0x1b')](handleEntityNotFound(_0x299ec5,null))[_0x61f9('0x1b')](saveUpdates(_0x54c686[_0x61f9('0x50')],null))[_0x61f9('0x1b')](respondWithResult(_0x299ec5,null))[_0x61f9('0x25')](handleError(_0x299ec5,null));};exports[_0x61f9('0x2e')]=function(_0x527b7c,_0x4fabc4){return db['Dynamics365Configuration'][_0x61f9('0x4e')]({'where':{'id':_0x527b7c[_0x61f9('0x4c')]['id']}})[_0x61f9('0x1b')](handleEntityNotFound(_0x4fabc4,null))['then'](removeEntity(_0x4fabc4,null))[_0x61f9('0x25')](handleError(_0x4fabc4,null));};exports[_0x61f9('0x51')]=function(_0x4e7e17,_0x80de93,_0x413192){var _0x218394={};var _0x577e81={};var _0x1d7e13;var _0x305075;return db['Dynamics365Configuration'][_0x61f9('0x52')]({'where':{'id':_0x4e7e17['params']['id']}})[_0x61f9('0x1b')](handleEntityNotFound(_0x80de93,null))['then'](function(_0x2796da){if(_0x2796da){_0x1d7e13=_0x2796da;_0x577e81['model']=_['keys'](db['Dynamics365Field']['rawAttributes']);_0x577e81['query']=_[_0x61f9('0x4d')](_0x4e7e17[_0x61f9('0x38')]);_0x577e81['filters']=_[_0x61f9('0x3a')](_0x577e81['model'],_0x577e81['query']);_0x218394[_0x61f9('0x3c')]=_[_0x61f9('0x3a')](_0x577e81[_0x61f9('0x3b')],qs[_0x61f9('0x3d')](_0x4e7e17['query']['fields']));_0x218394[_0x61f9('0x3c')]=_0x218394[_0x61f9('0x3c')][_0x61f9('0x3e')]?_0x218394[_0x61f9('0x3c')]:_0x577e81['model'];_0x218394['order']=qs['sort'](_0x4e7e17[_0x61f9('0x38')][_0x61f9('0x53')]);_0x218394[_0x61f9('0x41')]=qs[_0x61f9('0x39')](_['pick'](_0x4e7e17[_0x61f9('0x38')],_0x577e81['filters']));if(_0x4e7e17[_0x61f9('0x38')]['filter']){_0x218394[_0x61f9('0x41')]=_['merge'](_0x218394[_0x61f9('0x41')],{'$or':_[_0x61f9('0x37')](_0x218394[_0x61f9('0x3c')],function(_0x4d0a9e){var _0x681460={};_0x681460[_0x4d0a9e]={'$like':'%'+_0x4e7e17[_0x61f9('0x38')][_0x61f9('0x42')]+'%'};return _0x681460;})});}_0x218394=_[_0x61f9('0x43')]({},_0x218394,_0x4e7e17[_0x61f9('0x45')]);return _0x1d7e13[_0x61f9('0x51')](_0x218394);}})['then'](function(_0x4906c6){if(_0x4906c6){_0x305075=_0x4906c6[_0x61f9('0x3e')];if(!_0x4e7e17['query'][_0x61f9('0x54')](_0x61f9('0x55'))){_0x218394[_0x61f9('0x3f')]=qs['limit'](_0x4e7e17[_0x61f9('0x38')][_0x61f9('0x3f')]);_0x218394[_0x61f9('0x29')]=qs[_0x61f9('0x29')](_0x4e7e17[_0x61f9('0x38')]['offset']);}return _0x1d7e13['getFields'](_0x218394);}})[_0x61f9('0x1b')](function(_0xb2a2de){if(_0xb2a2de){return _0xb2a2de?{'count':_0x305075,'rows':_0xb2a2de}:null;}})[_0x61f9('0x1b')](respondWithResult(_0x80de93,null))[_0x61f9('0x25')](handleError(_0x80de93,null));};exports['getSubjects']=function(_0x13ad46,_0x585e94,_0x422656){var _0x4d66a1={};var _0x294c7e={};var _0x161485;var _0x9739b6;return db['Dynamics365Configuration'][_0x61f9('0x52')]({'where':{'id':_0x13ad46['params']['id']}})[_0x61f9('0x1b')](handleEntityNotFound(_0x585e94,null))['then'](function(_0x2cb484){if(_0x2cb484){_0x161485=_0x2cb484;_0x294c7e['model']=_[_0x61f9('0x4d')](db[_0x61f9('0x56')]['rawAttributes']);_0x294c7e['query']=_[_0x61f9('0x4d')](_0x13ad46['query']);_0x294c7e[_0x61f9('0x39')]=_[_0x61f9('0x3a')](_0x294c7e['model'],_0x294c7e[_0x61f9('0x38')]);_0x4d66a1[_0x61f9('0x3c')]=_[_0x61f9('0x3a')](_0x294c7e[_0x61f9('0x3b')],qs[_0x61f9('0x3d')](_0x13ad46[_0x61f9('0x38')][_0x61f9('0x3d')]));_0x4d66a1[_0x61f9('0x3c')]=_0x4d66a1[_0x61f9('0x3c')][_0x61f9('0x3e')]?_0x4d66a1[_0x61f9('0x3c')]:_0x294c7e[_0x61f9('0x3b')];_0x4d66a1[_0x61f9('0x40')]=qs[_0x61f9('0x53')](_0x13ad46[_0x61f9('0x38')][_0x61f9('0x53')]);_0x4d66a1[_0x61f9('0x41')]=qs[_0x61f9('0x39')](_[_0x61f9('0x57')](_0x13ad46[_0x61f9('0x38')],_0x294c7e[_0x61f9('0x39')]));if(_0x13ad46[_0x61f9('0x38')][_0x61f9('0x42')]){_0x4d66a1['where']=_[_0x61f9('0x43')](_0x4d66a1['where'],{'$or':_[_0x61f9('0x37')](_0x4d66a1[_0x61f9('0x3c')],function(_0x4e5873){var _0x12693a={};_0x12693a[_0x4e5873]={'$like':'%'+_0x13ad46[_0x61f9('0x38')][_0x61f9('0x42')]+'%'};return _0x12693a;})});}_0x4d66a1=_[_0x61f9('0x43')]({},_0x4d66a1,_0x13ad46[_0x61f9('0x45')]);return _0x161485['getSubjects'](_0x4d66a1);}})[_0x61f9('0x1b')](function(_0x224369){if(_0x224369){_0x9739b6=_0x224369[_0x61f9('0x3e')];if(!_0x13ad46[_0x61f9('0x38')][_0x61f9('0x54')](_0x61f9('0x55'))){_0x4d66a1[_0x61f9('0x3f')]=qs[_0x61f9('0x3f')](_0x13ad46['query']['limit']);_0x4d66a1[_0x61f9('0x29')]=qs[_0x61f9('0x29')](_0x13ad46[_0x61f9('0x38')]['offset']);}return _0x161485[_0x61f9('0x58')](_0x4d66a1);}})[_0x61f9('0x1b')](function(_0x15b47b){if(_0x15b47b){return _0x15b47b?{'count':_0x9739b6,'rows':_0x15b47b}:null;}})['then'](respondWithResult(_0x585e94,null))[_0x61f9('0x25')](handleError(_0x585e94,null));};exports['getDescriptions']=function(_0x37b827,_0x318522,_0x22c57b){var _0x3d788c={};var _0xc1d392={};var _0x28209f;var _0x385509;return db[_0x61f9('0x46')][_0x61f9('0x52')]({'where':{'id':_0x37b827['params']['id']}})[_0x61f9('0x1b')](handleEntityNotFound(_0x318522,null))['then'](function(_0x9de73a){if(_0x9de73a){_0x28209f=_0x9de73a;_0xc1d392[_0x61f9('0x3b')]=_[_0x61f9('0x4d')](db['Dynamics365Field'][_0x61f9('0x33')]);_0xc1d392[_0x61f9('0x38')]=_[_0x61f9('0x4d')](_0x37b827[_0x61f9('0x38')]);_0xc1d392[_0x61f9('0x39')]=_[_0x61f9('0x3a')](_0xc1d392[_0x61f9('0x3b')],_0xc1d392[_0x61f9('0x38')]);_0x3d788c[_0x61f9('0x3c')]=_['intersection'](_0xc1d392[_0x61f9('0x3b')],qs[_0x61f9('0x3d')](_0x37b827['query'][_0x61f9('0x3d')]));_0x3d788c[_0x61f9('0x3c')]=_0x3d788c['attributes'][_0x61f9('0x3e')]?_0x3d788c['attributes']:_0xc1d392['model'];_0x3d788c['order']=qs[_0x61f9('0x53')](_0x37b827[_0x61f9('0x38')]['sort']);_0x3d788c[_0x61f9('0x41')]=qs['filters'](_[_0x61f9('0x57')](_0x37b827[_0x61f9('0x38')],_0xc1d392['filters']));if(_0x37b827[_0x61f9('0x38')][_0x61f9('0x42')]){_0x3d788c['where']=_[_0x61f9('0x43')](_0x3d788c[_0x61f9('0x41')],{'$or':_[_0x61f9('0x37')](_0x3d788c[_0x61f9('0x3c')],function(_0x40e8fb){var _0x440bcb={};_0x440bcb[_0x40e8fb]={'$like':'%'+_0x37b827[_0x61f9('0x38')][_0x61f9('0x42')]+'%'};return _0x440bcb;})});}_0x3d788c=_['merge']({},_0x3d788c,_0x37b827['options']);return _0x28209f[_0x61f9('0x59')](_0x3d788c);}})['then'](function(_0x5ca9c5){if(_0x5ca9c5){_0x385509=_0x5ca9c5[_0x61f9('0x3e')];if(!_0x37b827[_0x61f9('0x38')]['hasOwnProperty'](_0x61f9('0x55'))){_0x3d788c[_0x61f9('0x3f')]=qs[_0x61f9('0x3f')](_0x37b827['query']['limit']);_0x3d788c[_0x61f9('0x29')]=qs['offset'](_0x37b827[_0x61f9('0x38')]['offset']);}return _0x28209f[_0x61f9('0x59')](_0x3d788c);}})[_0x61f9('0x1b')](function(_0x131c28){if(_0x131c28){return _0x131c28?{'count':_0x385509,'rows':_0x131c28}:null;}})[_0x61f9('0x1b')](respondWithResult(_0x318522,null))[_0x61f9('0x25')](handleError(_0x318522,null));}; \ No newline at end of file diff --git a/server/api/intDynamics365Configuration/intDynamics365Configuration.model.js b/server/api/intDynamics365Configuration/intDynamics365Configuration.model.js index 2793d08..9272162 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 _0x80ce=['moment','request-promise','path','rimraf','define','Dynamics365Configuration','api'];(function(_0xf2628e,_0x521bf7){var _0x13863a=function(_0x2b04ab){while(--_0x2b04ab){_0xf2628e['push'](_0xf2628e['shift']());}};_0x13863a(++_0x521bf7);}(_0x80ce,0xae));var _0xe80c=function(_0x39d1b2,_0x5e3154){_0x39d1b2=_0x39d1b2-0x0;var _0xc919af=_0x80ce[_0x39d1b2];return _0xc919af;};'use strict';var _=require('lodash');var util=require('util');var logger=require('../../config/logger')(_0xe80c('0x0'));var moment=require(_0xe80c('0x1'));var BPromise=require('bluebird');var rp=require(_0xe80c('0x2'));var fs=require('fs');var path=require(_0xe80c('0x3'));var rimraf=require(_0xe80c('0x4'));var config=require('../../config/environment');var attributes=require('./intDynamics365Configuration.attributes');module['exports']=function(_0x48d62c,_0x19b480){return _0x48d62c[_0xe80c('0x5')](_0xe80c('0x6'),attributes,{'tableName':'int_dynamics365_configurations','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x02ba=['../../config/environment','./intDynamics365Configuration.attributes','exports','define','int_dynamics365_configurations','util','../../config/logger','moment','path','rimraf'];(function(_0x5d80de,_0x2cf15d){var _0x1c7556=function(_0x5bd806){while(--_0x5bd806){_0x5d80de['push'](_0x5d80de['shift']());}};_0x1c7556(++_0x2cf15d);}(_0x02ba,0x109));var _0xa02b=function(_0x33cfca,_0x3058d1){_0x33cfca=_0x33cfca-0x0;var _0x68d722=_0x02ba[_0x33cfca];return _0x68d722;};'use strict';var _=require('lodash');var util=require(_0xa02b('0x0'));var logger=require(_0xa02b('0x1'))('api');var moment=require(_0xa02b('0x2'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0xa02b('0x3'));var rimraf=require(_0xa02b('0x4'));var config=require(_0xa02b('0x5'));var attributes=require(_0xa02b('0x6'));module[_0xa02b('0x7')]=function(_0x2e4236,_0x1f08f9){return _0x2e4236[_0xa02b('0x8')]('Dynamics365Configuration',attributes,{'tableName':_0xa02b('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intDynamics365Configuration/intDynamics365Configuration.rpc.js b/server/api/intDynamics365Configuration/intDynamics365Configuration.rpc.js index 11c8ae4..4dfc222 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 _0x41a0=['then','info','request\x20sent','debug','Dynamics365Configuration,\x20%s,\x20%s,\x20%s','stringify','error','Dynamics365Configuration,\x20%s,\x20%s','message','result','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','http','request'];(function(_0x23e7c1,_0x35110c){var _0x1add43=function(_0x238918){while(--_0x238918){_0x23e7c1['push'](_0x23e7c1['shift']());}};_0x1add43(++_0x35110c);}(_0x41a0,0x196));var _0x041a=function(_0x55eaf5,_0x534a6e){_0x55eaf5=_0x55eaf5-0x0;var _0x250896=_0x41a0[_0x55eaf5];return _0x250896;};'use strict';var _=require(_0x041a('0x0'));var util=require(_0x041a('0x1'));var moment=require('moment');var BPromise=require(_0x041a('0x2'));var rs=require(_0x041a('0x3'));var fs=require('fs');var Redis=require(_0x041a('0x4'));var db=require(_0x041a('0x5'))['db'];var utils=require(_0x041a('0x6'));var logger=require(_0x041a('0x7'))(_0x041a('0x8'));var config=require('../../config/environment');var jayson=require(_0x041a('0x9'));var client=jayson['client'][_0x041a('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x40b317,_0x3cec4d,_0x150b83){return new BPromise(function(_0x5c303e,_0x4d9e27){return client[_0x041a('0xb')](_0x40b317,_0x150b83)[_0x041a('0xc')](function(_0x4de1c7){logger[_0x041a('0xd')]('Dynamics365Configuration,\x20%s,\x20%s',_0x3cec4d,_0x041a('0xe'));logger[_0x041a('0xf')](_0x041a('0x10'),_0x3cec4d,'request\x20sent',JSON[_0x041a('0x11')](_0x4de1c7));if(_0x4de1c7[_0x041a('0x12')]){if(_0x4de1c7[_0x041a('0x12')]['code']===0x1f4){logger[_0x041a('0x12')](_0x041a('0x13'),_0x3cec4d,_0x4de1c7['error'][_0x041a('0x14')]);return _0x4d9e27(_0x4de1c7[_0x041a('0x12')][_0x041a('0x14')]);}logger[_0x041a('0x12')](_0x041a('0x13'),_0x3cec4d,_0x4de1c7[_0x041a('0x12')][_0x041a('0x14')]);return _0x5c303e(_0x4de1c7[_0x041a('0x12')][_0x041a('0x14')]);}else{logger[_0x041a('0xd')](_0x041a('0x13'),_0x3cec4d,_0x041a('0xe'));_0x5c303e(_0x4de1c7[_0x041a('0x15')][_0x041a('0x14')]);}})['catch'](function(_0x2f0baf){logger['error'](_0x041a('0x13'),_0x3cec4d,_0x2f0baf);_0x4d9e27(_0x2f0baf);});});} \ No newline at end of file +var _0x59af=['debug','Dynamics365Configuration,\x20%s,\x20%s,\x20%s','error','code','Dynamics365Configuration,\x20%s,\x20%s','message','result','catch','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','client','then','info','request\x20sent'];(function(_0x17bd96,_0x552071){var _0x20d398=function(_0x3680d0){while(--_0x3680d0){_0x17bd96['push'](_0x17bd96['shift']());}};_0x20d398(++_0x552071);}(_0x59af,0x119));var _0xf59a=function(_0xdaec2e,_0x2d7312){_0xdaec2e=_0xdaec2e-0x0;var _0x1ba0d7=_0x59af[_0xdaec2e];return _0x1ba0d7;};'use strict';var _=require(_0xf59a('0x0'));var util=require(_0xf59a('0x1'));var moment=require(_0xf59a('0x2'));var BPromise=require('bluebird');var rs=require(_0xf59a('0x3'));var fs=require('fs');var Redis=require(_0xf59a('0x4'));var db=require(_0xf59a('0x5'))['db'];var utils=require(_0xf59a('0x6'));var logger=require(_0xf59a('0x7'))('rpc');var config=require(_0xf59a('0x8'));var jayson=require('jayson/promise');var client=jayson[_0xf59a('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x4748f7,_0x47aa25,_0x4f5134){return new BPromise(function(_0x1c1964,_0x1a03e4){return client['request'](_0x4748f7,_0x4f5134)[_0xf59a('0xa')](function(_0x1bfff2){logger[_0xf59a('0xb')]('Dynamics365Configuration,\x20%s,\x20%s',_0x47aa25,_0xf59a('0xc'));logger[_0xf59a('0xd')](_0xf59a('0xe'),_0x47aa25,_0xf59a('0xc'),JSON['stringify'](_0x1bfff2));if(_0x1bfff2[_0xf59a('0xf')]){if(_0x1bfff2['error'][_0xf59a('0x10')]===0x1f4){logger[_0xf59a('0xf')](_0xf59a('0x11'),_0x47aa25,_0x1bfff2[_0xf59a('0xf')][_0xf59a('0x12')]);return _0x1a03e4(_0x1bfff2[_0xf59a('0xf')][_0xf59a('0x12')]);}logger[_0xf59a('0xf')]('Dynamics365Configuration,\x20%s,\x20%s',_0x47aa25,_0x1bfff2['error'][_0xf59a('0x12')]);return _0x1c1964(_0x1bfff2[_0xf59a('0xf')][_0xf59a('0x12')]);}else{logger['info']('Dynamics365Configuration,\x20%s,\x20%s',_0x47aa25,'request\x20sent');_0x1c1964(_0x1bfff2[_0xf59a('0x13')][_0xf59a('0x12')]);}})[_0xf59a('0x14')](function(_0x2eb271){logger[_0xf59a('0xf')](_0xf59a('0x11'),_0x47aa25,_0x2eb271);_0x1a03e4(_0x2eb271);});});} \ No newline at end of file diff --git a/server/api/intDynamics365Field/index.js b/server/api/intDynamics365Field/index.js index cd5f1b2..1f94f70 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 _0x750a=['/:id','show','create','delete','exports','util','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./intDynamics365Field.controller','get','isAuthenticated','index'];(function(_0x2c22b6,_0x3c9a8c){var _0x4fff70=function(_0x5bf954){while(--_0x5bf954){_0x2c22b6['push'](_0x2c22b6['shift']());}};_0x4fff70(++_0x3c9a8c);}(_0x750a,0x140));var _0xa750=function(_0x5e4eef,_0x5e6489){_0x5e4eef=_0x5e4eef-0x0;var _0x5959a8=_0x750a[_0x5e4eef];return _0x5959a8;};'use strict';var multer=require('multer');var util=require(_0xa750('0x0'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0xa750('0x1'));var router=express[_0xa750('0x2')]();var auth=require(_0xa750('0x3'));var interaction=require(_0xa750('0x4'));var config=require(_0xa750('0x5'));var controller=require(_0xa750('0x6'));router[_0xa750('0x7')]('/',auth[_0xa750('0x8')](),controller[_0xa750('0x9')]);router[_0xa750('0x7')](_0xa750('0xa'),auth[_0xa750('0x8')](),controller[_0xa750('0xb')]);router['post']('/',auth['isAuthenticated'](),controller[_0xa750('0xc')]);router['put'](_0xa750('0xa'),auth[_0xa750('0x8')](),controller['update']);router[_0xa750('0xd')](_0xa750('0xa'),auth['isAuthenticated'](),controller['destroy']);module[_0xa750('0xe')]=router; \ No newline at end of file +var _0xb821=['post','create','put','update','delete','destroy','exports','util','path','Router','../../config/environment','./intDynamics365Field.controller','get','isAuthenticated','/:id','show'];(function(_0x5895ca,_0x5e67f1){var _0x4b6055=function(_0x2b5bdd){while(--_0x2b5bdd){_0x5895ca['push'](_0x5895ca['shift']());}};_0x4b6055(++_0x5e67f1);}(_0xb821,0xa7));var _0x1b82=function(_0x50b012,_0x63deed){_0x50b012=_0x50b012-0x0;var _0x5a6cf0=_0xb821[_0x50b012];return _0x5a6cf0;};'use strict';var multer=require('multer');var util=require(_0x1b82('0x0'));var path=require(_0x1b82('0x1'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x1b82('0x2')]();var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x1b82('0x3'));var controller=require(_0x1b82('0x4'));router[_0x1b82('0x5')]('/',auth[_0x1b82('0x6')](),controller['index']);router[_0x1b82('0x5')](_0x1b82('0x7'),auth[_0x1b82('0x6')](),controller[_0x1b82('0x8')]);router[_0x1b82('0x9')]('/',auth[_0x1b82('0x6')](),controller[_0x1b82('0xa')]);router[_0x1b82('0xb')](_0x1b82('0x7'),auth['isAuthenticated'](),controller[_0x1b82('0xc')]);router[_0x1b82('0xd')](_0x1b82('0x7'),auth[_0x1b82('0x6')](),controller[_0x1b82('0xe')]);module[_0x1b82('0xf')]=router; \ No newline at end of file diff --git a/server/api/intDynamics365Field/intDynamics365Field.attributes.js b/server/api/intDynamics365Field/intDynamics365Field.attributes.js index 9faaa9b..02f9dea 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 _0x8c7f=['variable','BOOLEAN','sequelize','exports','ENUM','string','customVariable','STRING'];(function(_0x68c979,_0x431cff){var _0x4f0001=function(_0xa7595d){while(--_0xa7595d){_0x68c979['push'](_0x68c979['shift']());}};_0x4f0001(++_0x431cff);}(_0x8c7f,0xb2));var _0xf8c7=function(_0x2f5ac5,_0x1ee939){_0x2f5ac5=_0x2f5ac5-0x0;var _0x37c9a8=_0x8c7f[_0x2f5ac5];return _0x37c9a8;};'use strict';var Sequelize=require(_0xf8c7('0x0'));module[_0xf8c7('0x1')]={'type':{'type':Sequelize[_0xf8c7('0x2')](_0xf8c7('0x3'),'variable',_0xf8c7('0x4'),'keyValue'),'defaultValue':_0xf8c7('0x3')},'content':{'type':Sequelize['STRING']},'key':{'type':Sequelize[_0xf8c7('0x5')]},'keyType':{'type':Sequelize[_0xf8c7('0x2')]('string',_0xf8c7('0x6'),_0xf8c7('0x4'))},'keyContent':{'type':Sequelize[_0xf8c7('0x5')]},'idField':{'type':Sequelize[_0xf8c7('0x5')]},'nameField':{'type':Sequelize['STRING']},'customField':{'type':Sequelize[_0xf8c7('0x7')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0xf8c7('0x5')]}}; \ No newline at end of file +var _0x4dca=['sequelize','exports','ENUM','variable','customVariable','keyValue','STRING','string'];(function(_0x1f6825,_0xd28e80){var _0x37c0b6=function(_0x4757ab){while(--_0x4757ab){_0x1f6825['push'](_0x1f6825['shift']());}};_0x37c0b6(++_0xd28e80);}(_0x4dca,0x1c0));var _0xa4dc=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x4dca[_0x20a584];return _0x4b41a8;};'use strict';var Sequelize=require(_0xa4dc('0x0'));module[_0xa4dc('0x1')]={'type':{'type':Sequelize[_0xa4dc('0x2')]('string',_0xa4dc('0x3'),_0xa4dc('0x4'),_0xa4dc('0x5')),'defaultValue':'string'},'content':{'type':Sequelize[_0xa4dc('0x6')]},'key':{'type':Sequelize[_0xa4dc('0x6')]},'keyType':{'type':Sequelize['ENUM'](_0xa4dc('0x7'),'variable',_0xa4dc('0x4'))},'keyContent':{'type':Sequelize[_0xa4dc('0x6')]},'idField':{'type':Sequelize[_0xa4dc('0x6')]},'nameField':{'type':Sequelize[_0xa4dc('0x6')]},'customField':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'variableName':{'type':Sequelize[_0xa4dc('0x6')]}}; \ No newline at end of file diff --git a/server/api/intDynamics365Field/intDynamics365Field.controller.js b/server/api/intDynamics365Field/intDynamics365Field.controller.js index baefb82..9e4a6a5 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 _0xfba8=['keys','options','find','create','catch','body','params','destroy','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/environment','../../mysqldb','status','end','offset','limit','set','Content-Range','json','apply','reject','save','update','then','sendStatus','stack','name','index','Dynamics365Field','rawAttributes','fieldName','type','key','model','map','query','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','count','includeAll','include','findAll','rows','show'];(function(_0x5d4607,_0x6b5e7b){var _0x5e4a86=function(_0x46891a){while(--_0x46891a){_0x5d4607['push'](_0x5d4607['shift']());}};_0x5e4a86(++_0x6b5e7b);}(_0xfba8,0x1d6));var _0x8fba=function(_0x4a3bba,_0x23ae9c){_0x4a3bba=_0x4a3bba-0x0;var _0x627b40=_0xfba8[_0x4a3bba];return _0x627b40;};'use strict';var pdf=require(_0x8fba('0x0'));var emlformat=require(_0x8fba('0x1'));var rimraf=require(_0x8fba('0x2'));var zipdir=require(_0x8fba('0x3'));var jsonpatch=require(_0x8fba('0x4'));var rp=require(_0x8fba('0x5'));var moment=require(_0x8fba('0x6'));var BPromise=require(_0x8fba('0x7'));var Mustache=require(_0x8fba('0x8'));var util=require('util');var path=require(_0x8fba('0x9'));var sox=require('sox');var csv=require(_0x8fba('0xa'));var ejs=require(_0x8fba('0xb'));var fs=require('fs');var _=require(_0x8fba('0xc'));var squel=require(_0x8fba('0xd'));var crypto=require(_0x8fba('0xe'));var jsforce=require(_0x8fba('0xf'));var deskjs=require(_0x8fba('0x10'));var toCsv=require('to-csv');var querystring=require(_0x8fba('0x11'));var Papa=require('papaparse');var Redis=require(_0x8fba('0x12'));var authService=require(_0x8fba('0x13'));var qs=require(_0x8fba('0x14'));var as=require(_0x8fba('0x15'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x8fba('0x16'))(_0x8fba('0x17'));var utils=require('../../config/utils');var config=require(_0x8fba('0x18'));var db=require(_0x8fba('0x19'))['db'];function respondWithStatusCode(_0x5306dc,_0x5e9b9f){_0x5e9b9f=_0x5e9b9f||0xcc;return function(_0x468ba7){if(_0x468ba7){return _0x5306dc['sendStatus'](_0x5e9b9f);}return _0x5306dc[_0x8fba('0x1a')](_0x5e9b9f)[_0x8fba('0x1b')]();};}function respondWithResult(_0x2506cf,_0x745513){_0x745513=_0x745513||0xc8;return function(_0x41f4cc){if(_0x41f4cc){return _0x2506cf[_0x8fba('0x1a')](_0x745513)['json'](_0x41f4cc);}};}function respondWithFilteredResult(_0x54b4d1,_0x307b94){return function(_0xbd4229){if(_0xbd4229){var _0x2fa3ed=_0xbd4229['count'],_0x56cc5=_0x307b94[_0x8fba('0x1c')],_0x259c3e=_0x307b94[_0x8fba('0x1c')]+_0x307b94[_0x8fba('0x1d')],_0x2eeaef;if(_0x259c3e>=_0x2fa3ed){_0x259c3e=_0x2fa3ed;_0x2eeaef=0xc8;}else{_0x2eeaef=0xce;}_0x54b4d1[_0x8fba('0x1a')](_0x2eeaef);return _0x54b4d1[_0x8fba('0x1e')](_0x8fba('0x1f'),_0x56cc5+'-'+_0x259c3e+'/'+_0x2fa3ed)[_0x8fba('0x20')](_0xbd4229);}return null;};}function patchUpdates(_0x1e9cf9){return function(_0x5e9991){try{jsonpatch[_0x8fba('0x21')](_0x5e9991,_0x1e9cf9,!![]);}catch(_0x1eaeb1){return BPromise[_0x8fba('0x22')](_0x1eaeb1);}return _0x5e9991[_0x8fba('0x23')]();};}function saveUpdates(_0x9479d3,_0x5a2406){return function(_0xf2aab7){if(_0xf2aab7){return _0xf2aab7[_0x8fba('0x24')](_0x9479d3)['then'](function(_0x357485){return _0x357485;});}return null;};}function removeEntity(_0x5201a2,_0x525c86){return function(_0x38a46e){if(_0x38a46e){return _0x38a46e['destroy']()[_0x8fba('0x25')](function(){_0x5201a2[_0x8fba('0x1a')](0xcc)[_0x8fba('0x1b')]();});}};}function handleEntityNotFound(_0x2f3225,_0x52eebd){return function(_0x31eaee){if(!_0x31eaee){_0x2f3225[_0x8fba('0x26')](0x194);}return _0x31eaee;};}function handleError(_0x316f18,_0x57eaff){_0x57eaff=_0x57eaff||0x1f4;return function(_0x3778d4){logger['error'](_0x3778d4[_0x8fba('0x27')]);if(_0x3778d4[_0x8fba('0x28')]){delete _0x3778d4[_0x8fba('0x28')];}_0x316f18['status'](_0x57eaff)['send'](_0x3778d4);};}exports[_0x8fba('0x29')]=function(_0x3bfc80,_0x4a128c){var _0x241d9b={},_0x964d27={},_0x224168={'count':0x0,'rows':[]};var _0x4e9209=_['map'](db[_0x8fba('0x2a')][_0x8fba('0x2b')],function(_0x3f0c26){return{'name':_0x3f0c26[_0x8fba('0x2c')],'type':_0x3f0c26[_0x8fba('0x2d')][_0x8fba('0x2e')]};});_0x964d27[_0x8fba('0x2f')]=_[_0x8fba('0x30')](_0x4e9209,'name');_0x964d27[_0x8fba('0x31')]=_['keys'](_0x3bfc80[_0x8fba('0x31')]);_0x964d27[_0x8fba('0x32')]=_[_0x8fba('0x33')](_0x964d27[_0x8fba('0x2f')],_0x964d27[_0x8fba('0x31')]);_0x241d9b[_0x8fba('0x34')]=_[_0x8fba('0x33')](_0x964d27['model'],qs['fields'](_0x3bfc80[_0x8fba('0x31')][_0x8fba('0x35')]));_0x241d9b[_0x8fba('0x34')]=_0x241d9b[_0x8fba('0x34')]['length']?_0x241d9b[_0x8fba('0x34')]:_0x964d27[_0x8fba('0x2f')];if(!_0x3bfc80[_0x8fba('0x31')][_0x8fba('0x36')](_0x8fba('0x37'))){_0x241d9b[_0x8fba('0x1d')]=qs[_0x8fba('0x1d')](_0x3bfc80[_0x8fba('0x31')][_0x8fba('0x1d')]);_0x241d9b[_0x8fba('0x1c')]=qs[_0x8fba('0x1c')](_0x3bfc80[_0x8fba('0x31')][_0x8fba('0x1c')]);}_0x241d9b[_0x8fba('0x38')]=qs[_0x8fba('0x39')](_0x3bfc80[_0x8fba('0x31')]['sort']);_0x241d9b[_0x8fba('0x3a')]=qs[_0x8fba('0x32')](_[_0x8fba('0x3b')](_0x3bfc80[_0x8fba('0x31')],_0x964d27[_0x8fba('0x32')]));if(_0x3bfc80['query'][_0x8fba('0x3c')]){_0x241d9b[_0x8fba('0x3a')]=_[_0x8fba('0x3d')](_0x241d9b[_0x8fba('0x3a')],{'$or':_['map'](_0x4e9209,function(_0x67aff3){if(_0x67aff3['type']!==_0x8fba('0x3e')){var _0x66c11c={};_0x66c11c[_0x67aff3[_0x8fba('0x28')]]={'$like':'%'+_0x3bfc80[_0x8fba('0x31')][_0x8fba('0x3c')]+'%'};return _0x66c11c;}})});}_0x241d9b=_[_0x8fba('0x3d')]({},_0x241d9b,_0x3bfc80['options']);var _0x44e859={'where':_0x241d9b[_0x8fba('0x3a')]};return db[_0x8fba('0x2a')][_0x8fba('0x3f')](_0x44e859)[_0x8fba('0x25')](function(_0x1984b7){_0x224168[_0x8fba('0x3f')]=_0x1984b7;if(_0x3bfc80[_0x8fba('0x31')][_0x8fba('0x40')]){_0x241d9b[_0x8fba('0x41')]=[{'all':!![]}];}return db[_0x8fba('0x2a')][_0x8fba('0x42')](_0x241d9b);})[_0x8fba('0x25')](function(_0x1fcc22){_0x224168[_0x8fba('0x43')]=_0x1fcc22;return _0x224168;})['then'](respondWithFilteredResult(_0x4a128c,_0x241d9b))['catch'](handleError(_0x4a128c,null));};exports[_0x8fba('0x44')]=function(_0x11495d,_0x569c4f){var _0x1b7478={'raw':!![],'where':{'id':_0x11495d['params']['id']}},_0x481ccb={};_0x481ccb[_0x8fba('0x2f')]=_[_0x8fba('0x45')](db[_0x8fba('0x2a')][_0x8fba('0x2b')]);_0x481ccb['query']=_[_0x8fba('0x45')](_0x11495d[_0x8fba('0x31')]);_0x481ccb[_0x8fba('0x32')]=_[_0x8fba('0x33')](_0x481ccb['model'],_0x481ccb[_0x8fba('0x31')]);_0x1b7478[_0x8fba('0x34')]=_[_0x8fba('0x33')](_0x481ccb[_0x8fba('0x2f')],qs[_0x8fba('0x35')](_0x11495d['query'][_0x8fba('0x35')]));_0x1b7478[_0x8fba('0x34')]=_0x1b7478[_0x8fba('0x34')]['length']?_0x1b7478[_0x8fba('0x34')]:_0x481ccb['model'];if(_0x11495d[_0x8fba('0x31')][_0x8fba('0x40')]){_0x1b7478[_0x8fba('0x41')]=[{'all':!![]}];}_0x1b7478=_[_0x8fba('0x3d')]({},_0x1b7478,_0x11495d[_0x8fba('0x46')]);return db[_0x8fba('0x2a')][_0x8fba('0x47')](_0x1b7478)[_0x8fba('0x25')](handleEntityNotFound(_0x569c4f,null))[_0x8fba('0x25')](respondWithResult(_0x569c4f,null))['catch'](handleError(_0x569c4f,null));};exports[_0x8fba('0x48')]=function(_0x58d4a6,_0x2bbc06){return db[_0x8fba('0x2a')][_0x8fba('0x48')](_0x58d4a6['body'],{})[_0x8fba('0x25')](respondWithResult(_0x2bbc06,0xc9))[_0x8fba('0x49')](handleError(_0x2bbc06,null));};exports[_0x8fba('0x24')]=function(_0xce6a3,_0x3f2afb){if(_0xce6a3[_0x8fba('0x4a')]['id']){delete _0xce6a3['body']['id'];}return db['Dynamics365Field']['find']({'where':{'id':_0xce6a3[_0x8fba('0x4b')]['id']}})[_0x8fba('0x25')](handleEntityNotFound(_0x3f2afb,null))[_0x8fba('0x25')](saveUpdates(_0xce6a3['body'],null))['then'](respondWithResult(_0x3f2afb,null))['catch'](handleError(_0x3f2afb,null));};exports[_0x8fba('0x4c')]=function(_0x2b4876,_0x222da8){return db['Dynamics365Field'][_0x8fba('0x47')]({'where':{'id':_0x2b4876['params']['id']}})[_0x8fba('0x25')](handleEntityNotFound(_0x222da8,null))[_0x8fba('0x25')](removeEntity(_0x222da8,null))[_0x8fba('0x49')](handleError(_0x222da8,null));}; \ No newline at end of file +var _0xef0a=['eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','to-csv','ejs','lodash','squel','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../mysqldb','sendStatus','status','end','json','offset','set','apply','reject','update','then','error','name','send','index','map','rawAttributes','fieldName','key','model','keys','query','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','limit','sort','where','pick','filter','merge','VIRTUAL','options','Dynamics365Field','count','includeAll','include','findAll','rows','catch','show','find','create','body','destroy','html-pdf'];(function(_0x9c8c83,_0x16ebdd){var _0x4636ac=function(_0x5bacfc){while(--_0x5bacfc){_0x9c8c83['push'](_0x9c8c83['shift']());}};_0x4636ac(++_0x16ebdd);}(_0xef0a,0xdd));var _0xaef0=function(_0x5ca9fd,_0xd18db){_0x5ca9fd=_0x5ca9fd-0x0;var _0x3f10d8=_0xef0a[_0x5ca9fd];return _0x3f10d8;};'use strict';var pdf=require(_0xaef0('0x0'));var emlformat=require(_0xaef0('0x1'));var rimraf=require(_0xaef0('0x2'));var zipdir=require(_0xaef0('0x3'));var jsonpatch=require(_0xaef0('0x4'));var rp=require(_0xaef0('0x5'));var moment=require(_0xaef0('0x6'));var BPromise=require(_0xaef0('0x7'));var Mustache=require(_0xaef0('0x8'));var util=require(_0xaef0('0x9'));var path=require(_0xaef0('0xa'));var sox=require('sox');var csv=require(_0xaef0('0xb'));var ejs=require(_0xaef0('0xc'));var fs=require('fs');var _=require(_0xaef0('0xd'));var squel=require(_0xaef0('0xe'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0xaef0('0xf'));var toCsv=require(_0xaef0('0xb'));var querystring=require(_0xaef0('0x10'));var Papa=require(_0xaef0('0x11'));var Redis=require(_0xaef0('0x12'));var authService=require(_0xaef0('0x13'));var qs=require(_0xaef0('0x14'));var as=require(_0xaef0('0x15'));var hardwareService=require(_0xaef0('0x16'));var logger=require('../../config/logger')(_0xaef0('0x17'));var utils=require(_0xaef0('0x18'));var config=require('../../config/environment');var db=require(_0xaef0('0x19'))['db'];function respondWithStatusCode(_0x5d0a29,_0x5dc8ba){_0x5dc8ba=_0x5dc8ba||0xcc;return function(_0xebe3){if(_0xebe3){return _0x5d0a29[_0xaef0('0x1a')](_0x5dc8ba);}return _0x5d0a29[_0xaef0('0x1b')](_0x5dc8ba)[_0xaef0('0x1c')]();};}function respondWithResult(_0x20e24e,_0x682982){_0x682982=_0x682982||0xc8;return function(_0x112b81){if(_0x112b81){return _0x20e24e[_0xaef0('0x1b')](_0x682982)[_0xaef0('0x1d')](_0x112b81);}};}function respondWithFilteredResult(_0x426e82,_0x271c23){return function(_0x92e88c){if(_0x92e88c){var _0x44cd68=_0x92e88c['count'],_0x56fe98=_0x271c23[_0xaef0('0x1e')],_0x2c2e18=_0x271c23[_0xaef0('0x1e')]+_0x271c23['limit'],_0x14363c;if(_0x2c2e18>=_0x44cd68){_0x2c2e18=_0x44cd68;_0x14363c=0xc8;}else{_0x14363c=0xce;}_0x426e82[_0xaef0('0x1b')](_0x14363c);return _0x426e82[_0xaef0('0x1f')]('Content-Range',_0x56fe98+'-'+_0x2c2e18+'/'+_0x44cd68)['json'](_0x92e88c);}return null;};}function patchUpdates(_0x1a9ebc){return function(_0x13ef39){try{jsonpatch[_0xaef0('0x20')](_0x13ef39,_0x1a9ebc,!![]);}catch(_0x363df9){return BPromise[_0xaef0('0x21')](_0x363df9);}return _0x13ef39['save']();};}function saveUpdates(_0x15a51e,_0x450ea4){return function(_0x4d9b41){if(_0x4d9b41){return _0x4d9b41[_0xaef0('0x22')](_0x15a51e)['then'](function(_0x2ade9a){return _0x2ade9a;});}return null;};}function removeEntity(_0x52156b,_0x15f151){return function(_0x3b352b){if(_0x3b352b){return _0x3b352b['destroy']()[_0xaef0('0x23')](function(){_0x52156b['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x294f2e,_0x4da865){return function(_0xec243e){if(!_0xec243e){_0x294f2e[_0xaef0('0x1a')](0x194);}return _0xec243e;};}function handleError(_0x59ac43,_0x12ab91){_0x12ab91=_0x12ab91||0x1f4;return function(_0x3b935d){logger[_0xaef0('0x24')](_0x3b935d['stack']);if(_0x3b935d[_0xaef0('0x25')]){delete _0x3b935d['name'];}_0x59ac43[_0xaef0('0x1b')](_0x12ab91)[_0xaef0('0x26')](_0x3b935d);};}exports[_0xaef0('0x27')]=function(_0x1a8566,_0x2d3c8b){var _0x3a1792={},_0x21de10={},_0x98bcc7={'count':0x0,'rows':[]};var _0x1eaf50=_[_0xaef0('0x28')](db['Dynamics365Field'][_0xaef0('0x29')],function(_0x3b83ce){return{'name':_0x3b83ce[_0xaef0('0x2a')],'type':_0x3b83ce['type'][_0xaef0('0x2b')]};});_0x21de10[_0xaef0('0x2c')]=_['map'](_0x1eaf50,'name');_0x21de10['query']=_[_0xaef0('0x2d')](_0x1a8566[_0xaef0('0x2e')]);_0x21de10[_0xaef0('0x2f')]=_[_0xaef0('0x30')](_0x21de10[_0xaef0('0x2c')],_0x21de10[_0xaef0('0x2e')]);_0x3a1792['attributes']=_[_0xaef0('0x30')](_0x21de10[_0xaef0('0x2c')],qs[_0xaef0('0x31')](_0x1a8566[_0xaef0('0x2e')][_0xaef0('0x31')]));_0x3a1792['attributes']=_0x3a1792[_0xaef0('0x32')][_0xaef0('0x33')]?_0x3a1792[_0xaef0('0x32')]:_0x21de10[_0xaef0('0x2c')];if(!_0x1a8566['query'][_0xaef0('0x34')](_0xaef0('0x35'))){_0x3a1792[_0xaef0('0x36')]=qs['limit'](_0x1a8566[_0xaef0('0x2e')]['limit']);_0x3a1792[_0xaef0('0x1e')]=qs['offset'](_0x1a8566[_0xaef0('0x2e')][_0xaef0('0x1e')]);}_0x3a1792['order']=qs[_0xaef0('0x37')](_0x1a8566['query'][_0xaef0('0x37')]);_0x3a1792[_0xaef0('0x38')]=qs[_0xaef0('0x2f')](_[_0xaef0('0x39')](_0x1a8566['query'],_0x21de10[_0xaef0('0x2f')]));if(_0x1a8566[_0xaef0('0x2e')][_0xaef0('0x3a')]){_0x3a1792['where']=_[_0xaef0('0x3b')](_0x3a1792['where'],{'$or':_[_0xaef0('0x28')](_0x1eaf50,function(_0x53488c){if(_0x53488c['type']!==_0xaef0('0x3c')){var _0x65193b={};_0x65193b[_0x53488c['name']]={'$like':'%'+_0x1a8566['query']['filter']+'%'};return _0x65193b;}})});}_0x3a1792=_['merge']({},_0x3a1792,_0x1a8566[_0xaef0('0x3d')]);var _0x44b5={'where':_0x3a1792[_0xaef0('0x38')]};return db[_0xaef0('0x3e')][_0xaef0('0x3f')](_0x44b5)[_0xaef0('0x23')](function(_0x3a9d15){_0x98bcc7[_0xaef0('0x3f')]=_0x3a9d15;if(_0x1a8566['query'][_0xaef0('0x40')]){_0x3a1792[_0xaef0('0x41')]=[{'all':!![]}];}return db[_0xaef0('0x3e')][_0xaef0('0x42')](_0x3a1792);})[_0xaef0('0x23')](function(_0xf9f7a8){_0x98bcc7[_0xaef0('0x43')]=_0xf9f7a8;return _0x98bcc7;})[_0xaef0('0x23')](respondWithFilteredResult(_0x2d3c8b,_0x3a1792))[_0xaef0('0x44')](handleError(_0x2d3c8b,null));};exports[_0xaef0('0x45')]=function(_0x49f888,_0x34ba07){var _0x37eafe={'raw':!![],'where':{'id':_0x49f888['params']['id']}},_0x35fd67={};_0x35fd67['model']=_[_0xaef0('0x2d')](db['Dynamics365Field'][_0xaef0('0x29')]);_0x35fd67[_0xaef0('0x2e')]=_[_0xaef0('0x2d')](_0x49f888[_0xaef0('0x2e')]);_0x35fd67[_0xaef0('0x2f')]=_['intersection'](_0x35fd67[_0xaef0('0x2c')],_0x35fd67[_0xaef0('0x2e')]);_0x37eafe[_0xaef0('0x32')]=_[_0xaef0('0x30')](_0x35fd67[_0xaef0('0x2c')],qs[_0xaef0('0x31')](_0x49f888[_0xaef0('0x2e')][_0xaef0('0x31')]));_0x37eafe[_0xaef0('0x32')]=_0x37eafe[_0xaef0('0x32')][_0xaef0('0x33')]?_0x37eafe['attributes']:_0x35fd67[_0xaef0('0x2c')];if(_0x49f888[_0xaef0('0x2e')][_0xaef0('0x40')]){_0x37eafe[_0xaef0('0x41')]=[{'all':!![]}];}_0x37eafe=_[_0xaef0('0x3b')]({},_0x37eafe,_0x49f888[_0xaef0('0x3d')]);return db[_0xaef0('0x3e')][_0xaef0('0x46')](_0x37eafe)[_0xaef0('0x23')](handleEntityNotFound(_0x34ba07,null))['then'](respondWithResult(_0x34ba07,null))[_0xaef0('0x44')](handleError(_0x34ba07,null));};exports[_0xaef0('0x47')]=function(_0x182cdc,_0x287c0e){return db[_0xaef0('0x3e')][_0xaef0('0x47')](_0x182cdc[_0xaef0('0x48')],{})[_0xaef0('0x23')](respondWithResult(_0x287c0e,0xc9))[_0xaef0('0x44')](handleError(_0x287c0e,null));};exports[_0xaef0('0x22')]=function(_0x29dfbc,_0x12c29f){if(_0x29dfbc['body']['id']){delete _0x29dfbc['body']['id'];}return db[_0xaef0('0x3e')][_0xaef0('0x46')]({'where':{'id':_0x29dfbc['params']['id']}})['then'](handleEntityNotFound(_0x12c29f,null))[_0xaef0('0x23')](saveUpdates(_0x29dfbc[_0xaef0('0x48')],null))[_0xaef0('0x23')](respondWithResult(_0x12c29f,null))['catch'](handleError(_0x12c29f,null));};exports[_0xaef0('0x49')]=function(_0x1520c1,_0x56c4b4){return db[_0xaef0('0x3e')][_0xaef0('0x46')]({'where':{'id':_0x1520c1['params']['id']}})[_0xaef0('0x23')](handleEntityNotFound(_0x56c4b4,null))[_0xaef0('0x23')](removeEntity(_0x56c4b4,null))[_0xaef0('0x44')](handleError(_0x56c4b4,null));}; \ No newline at end of file diff --git a/server/api/intDynamics365Field/intDynamics365Field.model.js b/server/api/intDynamics365Field/intDynamics365Field.model.js index f45d48a..e094622 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 _0xeb05=['../../config/environment','./intDynamics365Field.attributes','exports','Dynamics365Field','int_dynamics365_fields','dynamics365_unique_index','idField','FieldId','lodash','../../config/logger','moment','bluebird','rimraf'];(function(_0x3b0731,_0xcf9925){var _0x4204d7=function(_0x635ac5){while(--_0x635ac5){_0x3b0731['push'](_0x3b0731['shift']());}};_0x4204d7(++_0xcf9925);}(_0xeb05,0xb1));var _0x5eb0=function(_0x4b8801,_0x1e8061){_0x4b8801=_0x4b8801-0x0;var _0x7b5f5a=_0xeb05[_0x4b8801];return _0x7b5f5a;};'use strict';var _=require(_0x5eb0('0x0'));var util=require('util');var logger=require(_0x5eb0('0x1'))('api');var moment=require(_0x5eb0('0x2'));var BPromise=require(_0x5eb0('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x5eb0('0x4'));var config=require(_0x5eb0('0x5'));var attributes=require(_0x5eb0('0x6'));module[_0x5eb0('0x7')]=function(_0x2e5639,_0x1efb01){return _0x2e5639['define'](_0x5eb0('0x8'),attributes,{'tableName':_0x5eb0('0x9'),'paranoid':![],'indexes':[{'name':_0x5eb0('0xa'),'fields':[_0x5eb0('0xb'),_0x5eb0('0xc')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0x5add=['../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment','./intDynamics365Field.attributes','exports','define','Dynamics365Field','int_dynamics365_fields','dynamics365_unique_index','FieldId','lodash','util'];(function(_0x48881b,_0x2e62bb){var _0x1c2b1d=function(_0x194519){while(--_0x194519){_0x48881b['push'](_0x48881b['shift']());}};_0x1c2b1d(++_0x2e62bb);}(_0x5add,0x15e));var _0xd5ad=function(_0x496029,_0x3285be){_0x496029=_0x496029-0x0;var _0x4a4a4c=_0x5add[_0x496029];return _0x4a4a4c;};'use strict';var _=require(_0xd5ad('0x0'));var util=require(_0xd5ad('0x1'));var logger=require(_0xd5ad('0x2'))('api');var moment=require(_0xd5ad('0x3'));var BPromise=require(_0xd5ad('0x4'));var rp=require(_0xd5ad('0x5'));var fs=require('fs');var path=require(_0xd5ad('0x6'));var rimraf=require(_0xd5ad('0x7'));var config=require(_0xd5ad('0x8'));var attributes=require(_0xd5ad('0x9'));module[_0xd5ad('0xa')]=function(_0x49b570,_0x1c0b86){return _0x49b570[_0xd5ad('0xb')](_0xd5ad('0xc'),attributes,{'tableName':_0xd5ad('0xd'),'paranoid':![],'indexes':[{'name':_0xd5ad('0xe'),'fields':['idField',_0xd5ad('0xf')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intDynamics365Field/intDynamics365Field.rpc.js b/server/api/intDynamics365Field/intDynamics365Field.rpc.js index 3a42cc7..a28ddd9 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 _0x1a61=['error','code','Dynamics365Field,\x20%s,\x20%s','message','request\x20sent','result','lodash','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/environment','jayson/promise','http','request','then','debug','Dynamics365Field,\x20%s,\x20%s,\x20%s','stringify'];(function(_0x126c0d,_0x1644a5){var _0x299c58=function(_0x2f5a42){while(--_0x2f5a42){_0x126c0d['push'](_0x126c0d['shift']());}};_0x299c58(++_0x1644a5);}(_0x1a61,0x1e6));var _0x11a6=function(_0x1ab27b,_0x4e13a0){_0x1ab27b=_0x1ab27b-0x0;var _0x3e9c88=_0x1a61[_0x1ab27b];return _0x3e9c88;};'use strict';var _=require(_0x11a6('0x0'));var util=require('util');var moment=require(_0x11a6('0x1'));var BPromise=require('bluebird');var rs=require(_0x11a6('0x2'));var fs=require('fs');var Redis=require(_0x11a6('0x3'));var db=require(_0x11a6('0x4'))['db'];var utils=require(_0x11a6('0x5'));var logger=require('../../config/logger')('rpc');var config=require(_0x11a6('0x6'));var jayson=require(_0x11a6('0x7'));var client=jayson['client'][_0x11a6('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x1c4b31,_0x124855,_0x333ec2){return new BPromise(function(_0x1c67ce,_0x33b9b4){return client[_0x11a6('0x9')](_0x1c4b31,_0x333ec2)[_0x11a6('0xa')](function(_0x1a7d57){logger['info']('Dynamics365Field,\x20%s,\x20%s',_0x124855,'request\x20sent');logger[_0x11a6('0xb')](_0x11a6('0xc'),_0x124855,'request\x20sent',JSON[_0x11a6('0xd')](_0x1a7d57));if(_0x1a7d57[_0x11a6('0xe')]){if(_0x1a7d57[_0x11a6('0xe')][_0x11a6('0xf')]===0x1f4){logger[_0x11a6('0xe')](_0x11a6('0x10'),_0x124855,_0x1a7d57['error']['message']);return _0x33b9b4(_0x1a7d57[_0x11a6('0xe')][_0x11a6('0x11')]);}logger['error'](_0x11a6('0x10'),_0x124855,_0x1a7d57[_0x11a6('0xe')]['message']);return _0x1c67ce(_0x1a7d57[_0x11a6('0xe')][_0x11a6('0x11')]);}else{logger['info'](_0x11a6('0x10'),_0x124855,_0x11a6('0x12'));_0x1c67ce(_0x1a7d57[_0x11a6('0x13')][_0x11a6('0x11')]);}})['catch'](function(_0x3d6457){logger[_0x11a6('0xe')](_0x11a6('0x10'),_0x124855,_0x3d6457);_0x33b9b4(_0x3d6457);});});} \ No newline at end of file +var _0x0650=['result','lodash','util','moment','bluebird','ioredis','../../config/logger','rpc','../../config/environment','http','then','Dynamics365Field,\x20%s,\x20%s','request\x20sent','stringify','error','message','info'];(function(_0x2601b4,_0x315e78){var _0x3e3661=function(_0x13b45b){while(--_0x13b45b){_0x2601b4['push'](_0x2601b4['shift']());}};_0x3e3661(++_0x315e78);}(_0x0650,0x1aa));var _0x0065=function(_0x3e8c34,_0x549d3c){_0x3e8c34=_0x3e8c34-0x0;var _0x14969e=_0x0650[_0x3e8c34];return _0x14969e;};'use strict';var _=require(_0x0065('0x0'));var util=require(_0x0065('0x1'));var moment=require(_0x0065('0x2'));var BPromise=require(_0x0065('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x0065('0x4'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x0065('0x5'))(_0x0065('0x6'));var config=require(_0x0065('0x7'));var jayson=require('jayson/promise');var client=jayson['client'][_0x0065('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x5792dc,_0x517b9f,_0x49d04d){return new BPromise(function(_0x576ca0,_0x25892a){return client['request'](_0x5792dc,_0x49d04d)[_0x0065('0x9')](function(_0x141e01){logger['info'](_0x0065('0xa'),_0x517b9f,_0x0065('0xb'));logger['debug']('Dynamics365Field,\x20%s,\x20%s,\x20%s',_0x517b9f,_0x0065('0xb'),JSON[_0x0065('0xc')](_0x141e01));if(_0x141e01[_0x0065('0xd')]){if(_0x141e01[_0x0065('0xd')]['code']===0x1f4){logger['error'](_0x0065('0xa'),_0x517b9f,_0x141e01['error']['message']);return _0x25892a(_0x141e01[_0x0065('0xd')]['message']);}logger[_0x0065('0xd')]('Dynamics365Field,\x20%s,\x20%s',_0x517b9f,_0x141e01['error'][_0x0065('0xe')]);return _0x576ca0(_0x141e01[_0x0065('0xd')][_0x0065('0xe')]);}else{logger[_0x0065('0xf')](_0x0065('0xa'),_0x517b9f,_0x0065('0xb'));_0x576ca0(_0x141e01[_0x0065('0x10')][_0x0065('0xe')]);}})['catch'](function(_0x26f491){logger[_0x0065('0xd')](_0x0065('0xa'),_0x517b9f,_0x26f491);_0x25892a(_0x26f491);});});} \ No newline at end of file diff --git a/server/api/intFreshdeskAccount/index.js b/server/api/intFreshdeskAccount/index.js index 7c7fe51..3797aff 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 _0xfe35=['isAuthenticated','/:id','show','/:id/configurations','getConfigurations','/:id/fields','getFields','post','delete','exports','multer','util','path','connect-timeout','express','../../components/auth/service','../../components/interaction/service','./intFreshdeskAccount.controller','get'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xfe35,0x127));var _0x5fe3=function(_0x37b73b,_0x33d66a){_0x37b73b=_0x37b73b-0x0;var _0x30becf=_0xfe35[_0x37b73b];return _0x30becf;};'use strict';var multer=require(_0x5fe3('0x0'));var util=require(_0x5fe3('0x1'));var path=require(_0x5fe3('0x2'));var timeout=require(_0x5fe3('0x3'));var express=require(_0x5fe3('0x4'));var router=express['Router']();var auth=require(_0x5fe3('0x5'));var interaction=require(_0x5fe3('0x6'));var config=require('../../config/environment');var controller=require(_0x5fe3('0x7'));router[_0x5fe3('0x8')]('/',auth[_0x5fe3('0x9')](),controller['index']);router[_0x5fe3('0x8')](_0x5fe3('0xa'),auth[_0x5fe3('0x9')](),controller[_0x5fe3('0xb')]);router['get'](_0x5fe3('0xc'),auth[_0x5fe3('0x9')](),controller[_0x5fe3('0xd')]);router['get'](_0x5fe3('0xe'),auth[_0x5fe3('0x9')](),controller[_0x5fe3('0xf')]);router[_0x5fe3('0x10')]('/',auth[_0x5fe3('0x9')](),controller['create']);router['post'](_0x5fe3('0xc'),auth[_0x5fe3('0x9')](),controller['addConfiguration']);router['put'](_0x5fe3('0xa'),auth[_0x5fe3('0x9')](),controller['update']);router[_0x5fe3('0x11')](_0x5fe3('0xa'),auth['isAuthenticated'](),controller['destroy']);module[_0x5fe3('0x12')]=router; \ No newline at end of file +var _0x53be=['/:id/configurations','getConfigurations','getFields','post','create','addConfiguration','put','/:id','delete','destroy','exports','multer','util','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./intFreshdeskAccount.controller','isAuthenticated','index','get'];(function(_0x4f2801,_0x366dd1){var _0x3ac22a=function(_0x39862a){while(--_0x39862a){_0x4f2801['push'](_0x4f2801['shift']());}};_0x3ac22a(++_0x366dd1);}(_0x53be,0x136));var _0xe53b=function(_0x3ceab2,_0x100a3a){_0x3ceab2=_0x3ceab2-0x0;var _0x5d6322=_0x53be[_0x3ceab2];return _0x5d6322;};'use strict';var multer=require(_0xe53b('0x0'));var util=require(_0xe53b('0x1'));var path=require('path');var timeout=require(_0xe53b('0x2'));var express=require(_0xe53b('0x3'));var router=express[_0xe53b('0x4')]();var auth=require(_0xe53b('0x5'));var interaction=require(_0xe53b('0x6'));var config=require(_0xe53b('0x7'));var controller=require(_0xe53b('0x8'));router['get']('/',auth[_0xe53b('0x9')](),controller[_0xe53b('0xa')]);router[_0xe53b('0xb')]('/:id',auth[_0xe53b('0x9')](),controller['show']);router[_0xe53b('0xb')](_0xe53b('0xc'),auth[_0xe53b('0x9')](),controller[_0xe53b('0xd')]);router[_0xe53b('0xb')]('/:id/fields',auth[_0xe53b('0x9')](),controller[_0xe53b('0xe')]);router[_0xe53b('0xf')]('/',auth[_0xe53b('0x9')](),controller[_0xe53b('0x10')]);router['post'](_0xe53b('0xc'),auth['isAuthenticated'](),controller[_0xe53b('0x11')]);router[_0xe53b('0x12')](_0xe53b('0x13'),auth['isAuthenticated'](),controller['update']);router[_0xe53b('0x14')]('/:id',auth['isAuthenticated'](),controller[_0xe53b('0x15')]);module[_0xe53b('0x16')]=router; \ No newline at end of file diff --git a/server/api/intFreshdeskAccount/intFreshdeskAccount.attributes.js b/server/api/intFreshdeskAccount/intFreshdeskAccount.attributes.js index b85e4b2..68a187b 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 _0xbbbc=['remoteUri','sequelize','exports','STRING','username'];(function(_0x320d30,_0x3fa814){var _0x457c8a=function(_0x4604b2){while(--_0x4604b2){_0x320d30['push'](_0x320d30['shift']());}};_0x457c8a(++_0x3fa814);}(_0xbbbc,0xf6));var _0xcbbb=function(_0x2f6b24,_0x50f80d){_0x2f6b24=_0x2f6b24-0x0;var _0x24f471=_0xbbbc[_0x2f6b24];return _0x24f471;};'use strict';var Sequelize=require(_0xcbbb('0x0'));module[_0xcbbb('0x1')]={'name':{'type':Sequelize[_0xcbbb('0x2')]},'description':{'type':Sequelize[_0xcbbb('0x2')]},'username':{'type':Sequelize[_0xcbbb('0x2')],'unique':_0xcbbb('0x3')},'apiKey':{'type':Sequelize[_0xcbbb('0x2')]},'remoteUri':{'type':Sequelize['STRING'],'unique':_0xcbbb('0x4')},'serverUrl':{'type':Sequelize[_0xcbbb('0x2')]}}; \ No newline at end of file +var _0xaafc=['exports','STRING'];(function(_0x481ed9,_0x191060){var _0x5abb22=function(_0x1cbe36){while(--_0x1cbe36){_0x481ed9['push'](_0x481ed9['shift']());}};_0x5abb22(++_0x191060);}(_0xaafc,0x176));var _0xcaaf=function(_0x56978c,_0x2170be){_0x56978c=_0x56978c-0x0;var _0x8c680e=_0xaafc[_0x56978c];return _0x8c680e;};'use strict';var Sequelize=require('sequelize');module[_0xcaaf('0x0')]={'name':{'type':Sequelize[_0xcaaf('0x1')]},'description':{'type':Sequelize[_0xcaaf('0x1')]},'username':{'type':Sequelize[_0xcaaf('0x1')],'unique':'username'},'apiKey':{'type':Sequelize[_0xcaaf('0x1')]},'remoteUri':{'type':Sequelize[_0xcaaf('0x1')],'unique':'remoteUri'},'serverUrl':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/intFreshdeskAccount/intFreshdeskAccount.controller.js b/server/api/intFreshdeskAccount/intFreshdeskAccount.controller.js index 6c47253..e6f8093 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 _0x649f=['send','index','FreshdeskAccount','rawAttributes','fieldName','key','model','map','query','keys','intersection','attributes','nolimit','order','sort','where','pick','filters','type','VIRTUAL','filter','merge','includeAll','include','findAll','rows','show','params','fields','length','find','create','body','destroy','getConfigurations','options','hasOwnProperty','findOne','AccountId','Subjects','getSubjects','Descriptions','getDescriptions','FreshdeskConfiguration','FreshdeskField','remoteUri','lastIndexOf','GET','format','%s/%s','Basic\x20%s','%s:X','toString','base64','requester','subject','description','priority','group','ticket_type','remove','custom_text','custom_dropdown','label','default','choices','statusCode','getFields,\x20%s,\x20%s,\x20%s','Wrong\x20credentials','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','util','path','to-csv','lodash','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../components/integrations/configuration','jayson/promise','client','http','test','Sequelize','The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.','then','info','request\x20sent','FreshdeskAccount,\x20%s,\x20%s,\x20%s','stringify','error','FreshdeskAccount,\x20%s,\x20%s','message','result','catch','sendStatus','status','end','count','offset','limit','Content-Range','json','apply','reject','save','name'];(function(_0x580b65,_0x39234f){var _0x6e3000=function(_0x1ad986){while(--_0x1ad986){_0x580b65['push'](_0x580b65['shift']());}};_0x6e3000(++_0x39234f);}(_0x649f,0x1b3));var _0xf649=function(_0x46698a,_0x8de1e4){_0x46698a=_0x46698a-0x0;var _0x356db0=_0x649f[_0x46698a];return _0x356db0;};'use strict';var pdf=require(_0xf649('0x0'));var emlformat=require(_0xf649('0x1'));var rimraf=require(_0xf649('0x2'));var zipdir=require(_0xf649('0x3'));var jsonpatch=require(_0xf649('0x4'));var rp=require(_0xf649('0x5'));var moment=require(_0xf649('0x6'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0xf649('0x7'));var path=require(_0xf649('0x8'));var sox=require('sox');var csv=require(_0xf649('0x9'));var ejs=require('ejs');var fs=require('fs');var _=require(_0xf649('0xa'));var squel=require(_0xf649('0xb'));var crypto=require(_0xf649('0xc'));var jsforce=require(_0xf649('0xd'));var deskjs=require(_0xf649('0xe'));var toCsv=require(_0xf649('0x9'));var querystring=require('querystring');var Papa=require(_0xf649('0xf'));var Redis=require(_0xf649('0x10'));var authService=require(_0xf649('0x11'));var qs=require(_0xf649('0x12'));var as=require(_0xf649('0x13'));var hardwareService=require(_0xf649('0x14'));var logger=require(_0xf649('0x15'))(_0xf649('0x16'));var utils=require('../../config/utils');var config=require(_0xf649('0x17'));var db=require('../../mysqldb')['db'];var integrations=require(_0xf649('0x18'));var jayson=require(_0xf649('0x19'));var client=jayson[_0xf649('0x1a')][_0xf649('0x1b')]({'port':0x232a});function checkPasswordPattern(_0x540165,_0x28e627,_0x210a68){if(_0x210a68){var _0x6fc866=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x6fc866[_0xf649('0x1c')](_0x28e627)){return _0x540165;}else{throw new db[(_0xf649('0x1d'))]['ValidationError'](_0xf649('0x1e'));}}else{return _0x540165;}}function respondWithRpcPromise(_0x5bad44,_0x287de5,_0x29398e,_0x3fa3f9){return new BPromise(function(_0x5775a1,_0x48623d){var _0x234072=_0x3fa3f9||client;return _0x234072['request'](_0x5bad44,_0x29398e)[_0xf649('0x1f')](function(_0x59db21){logger[_0xf649('0x20')]('FreshdeskAccount,\x20%s,\x20%s',_0x287de5,_0xf649('0x21'));logger['debug'](_0xf649('0x22'),_0x287de5,_0xf649('0x21'),JSON[_0xf649('0x23')](_0x59db21));if(_0x59db21[_0xf649('0x24')]){if(_0x59db21[_0xf649('0x24')]['code']===0x1f4){logger[_0xf649('0x24')](_0xf649('0x25'),_0x287de5,_0x59db21['error'][_0xf649('0x26')]);return _0x48623d(_0x59db21['error'][_0xf649('0x26')]);}logger[_0xf649('0x24')](_0xf649('0x25'),_0x287de5,_0x59db21[_0xf649('0x24')][_0xf649('0x26')]);return _0x5775a1(_0x59db21['error'][_0xf649('0x26')]);}else{logger[_0xf649('0x20')](_0xf649('0x25'),_0x287de5,_0xf649('0x21'));_0x5775a1(_0x59db21[_0xf649('0x27')][_0xf649('0x26')]);}})[_0xf649('0x28')](function(_0x1c0d31){logger['error'](_0xf649('0x25'),_0x287de5,_0x1c0d31);_0x48623d(_0x1c0d31);});});}function respondWithStatusCode(_0x288321,_0x5c835f){_0x5c835f=_0x5c835f||0xcc;return function(_0x356768){if(_0x356768){return _0x288321[_0xf649('0x29')](_0x5c835f);}return _0x288321[_0xf649('0x2a')](_0x5c835f)[_0xf649('0x2b')]();};}function respondWithResult(_0xe1b9f7,_0x246b61){_0x246b61=_0x246b61||0xc8;return function(_0xf84e82){if(_0xf84e82){return _0xe1b9f7[_0xf649('0x2a')](_0x246b61)['json'](_0xf84e82);}};}function respondWithFilteredResult(_0x4a8662,_0xe6658b){return function(_0x596584){if(_0x596584){var _0x58edb1=_0x596584[_0xf649('0x2c')],_0x1baed2=_0xe6658b['offset'],_0x5d1e4f=_0xe6658b[_0xf649('0x2d')]+_0xe6658b[_0xf649('0x2e')],_0x2cc5d7;if(_0x5d1e4f>=_0x58edb1){_0x5d1e4f=_0x58edb1;_0x2cc5d7=0xc8;}else{_0x2cc5d7=0xce;}_0x4a8662[_0xf649('0x2a')](_0x2cc5d7);return _0x4a8662['set'](_0xf649('0x2f'),_0x1baed2+'-'+_0x5d1e4f+'/'+_0x58edb1)[_0xf649('0x30')](_0x596584);}return null;};}function patchUpdates(_0x2ae0b2){return function(_0x188f06){try{jsonpatch[_0xf649('0x31')](_0x188f06,_0x2ae0b2,!![]);}catch(_0xa3ad12){return BPromise[_0xf649('0x32')](_0xa3ad12);}return _0x188f06[_0xf649('0x33')]();};}function saveUpdates(_0x3850e7,_0x244a1d){return function(_0x1a3f01){if(_0x1a3f01){return _0x1a3f01['update'](_0x3850e7)[_0xf649('0x1f')](function(_0x4d2fdc){return _0x4d2fdc;});}return null;};}function removeEntity(_0x30c162,_0x3fd700){return function(_0x176cf3){if(_0x176cf3){return _0x176cf3['destroy']()[_0xf649('0x1f')](function(){_0x30c162[_0xf649('0x2a')](0xcc)[_0xf649('0x2b')]();});}};}function handleEntityNotFound(_0x54574b,_0x503703){return function(_0x7281f1){if(!_0x7281f1){_0x54574b[_0xf649('0x29')](0x194);}return _0x7281f1;};}function handleError(_0x48016f,_0x5e195f){_0x5e195f=_0x5e195f||0x1f4;return function(_0x3b7169){logger[_0xf649('0x24')](_0x3b7169['stack']);if(_0x3b7169[_0xf649('0x34')]){delete _0x3b7169['name'];}_0x48016f[_0xf649('0x2a')](_0x5e195f)[_0xf649('0x35')](_0x3b7169);};}exports[_0xf649('0x36')]=function(_0xadbd54,_0x13ea33){var _0x221e6b={},_0x1a8fb6={},_0x570e9a={'count':0x0,'rows':[]};var _0x55c127=_['map'](db[_0xf649('0x37')][_0xf649('0x38')],function(_0x46307c){return{'name':_0x46307c[_0xf649('0x39')],'type':_0x46307c['type'][_0xf649('0x3a')]};});_0x1a8fb6[_0xf649('0x3b')]=_[_0xf649('0x3c')](_0x55c127,_0xf649('0x34'));_0x1a8fb6[_0xf649('0x3d')]=_[_0xf649('0x3e')](_0xadbd54[_0xf649('0x3d')]);_0x1a8fb6['filters']=_[_0xf649('0x3f')](_0x1a8fb6[_0xf649('0x3b')],_0x1a8fb6[_0xf649('0x3d')]);_0x221e6b[_0xf649('0x40')]=_[_0xf649('0x3f')](_0x1a8fb6[_0xf649('0x3b')],qs['fields'](_0xadbd54[_0xf649('0x3d')]['fields']));_0x221e6b[_0xf649('0x40')]=_0x221e6b['attributes']['length']?_0x221e6b[_0xf649('0x40')]:_0x1a8fb6[_0xf649('0x3b')];if(!_0xadbd54[_0xf649('0x3d')]['hasOwnProperty'](_0xf649('0x41'))){_0x221e6b['limit']=qs['limit'](_0xadbd54[_0xf649('0x3d')]['limit']);_0x221e6b['offset']=qs[_0xf649('0x2d')](_0xadbd54['query'][_0xf649('0x2d')]);}_0x221e6b[_0xf649('0x42')]=qs['sort'](_0xadbd54[_0xf649('0x3d')][_0xf649('0x43')]);_0x221e6b[_0xf649('0x44')]=qs['filters'](_[_0xf649('0x45')](_0xadbd54[_0xf649('0x3d')],_0x1a8fb6[_0xf649('0x46')]));if(_0xadbd54['query']['filter']){_0x221e6b[_0xf649('0x44')]=_['merge'](_0x221e6b[_0xf649('0x44')],{'$or':_[_0xf649('0x3c')](_0x55c127,function(_0x48a9ee){if(_0x48a9ee[_0xf649('0x47')]!==_0xf649('0x48')){var _0x2f8d01={};_0x2f8d01[_0x48a9ee[_0xf649('0x34')]]={'$like':'%'+_0xadbd54[_0xf649('0x3d')][_0xf649('0x49')]+'%'};return _0x2f8d01;}})});}_0x221e6b=_[_0xf649('0x4a')]({},_0x221e6b,_0xadbd54['options']);var _0x25b7ce={'where':_0x221e6b[_0xf649('0x44')]};return db['FreshdeskAccount'][_0xf649('0x2c')](_0x25b7ce)['then'](function(_0x51696d){_0x570e9a['count']=_0x51696d;if(_0xadbd54[_0xf649('0x3d')][_0xf649('0x4b')]){_0x221e6b[_0xf649('0x4c')]=[{'all':!![]}];}return db[_0xf649('0x37')][_0xf649('0x4d')](_0x221e6b);})[_0xf649('0x1f')](function(_0x4348f8){_0x570e9a[_0xf649('0x4e')]=_0x4348f8;return _0x570e9a;})[_0xf649('0x1f')](respondWithFilteredResult(_0x13ea33,_0x221e6b))[_0xf649('0x28')](handleError(_0x13ea33,null));};exports[_0xf649('0x4f')]=function(_0x967864,_0x48f11a){var _0x378873={'raw':![],'where':{'id':_0x967864[_0xf649('0x50')]['id']}},_0x1005e7={};_0x1005e7[_0xf649('0x3b')]=_[_0xf649('0x3e')](db['FreshdeskAccount'][_0xf649('0x38')]);_0x1005e7[_0xf649('0x3d')]=_[_0xf649('0x3e')](_0x967864[_0xf649('0x3d')]);_0x1005e7[_0xf649('0x46')]=_[_0xf649('0x3f')](_0x1005e7['model'],_0x1005e7[_0xf649('0x3d')]);_0x378873[_0xf649('0x40')]=_[_0xf649('0x3f')](_0x1005e7[_0xf649('0x3b')],qs['fields'](_0x967864[_0xf649('0x3d')][_0xf649('0x51')]));_0x378873['attributes']=_0x378873['attributes'][_0xf649('0x52')]?_0x378873[_0xf649('0x40')]:_0x1005e7[_0xf649('0x3b')];if(_0x967864[_0xf649('0x3d')][_0xf649('0x4b')]){_0x378873[_0xf649('0x4c')]=[{'all':!![]}];}_0x378873=_[_0xf649('0x4a')]({},_0x378873,_0x967864['options']);return db[_0xf649('0x37')][_0xf649('0x53')](_0x378873)[_0xf649('0x1f')](handleEntityNotFound(_0x48f11a,null))['then'](respondWithResult(_0x48f11a,null))[_0xf649('0x28')](handleError(_0x48f11a,null));};exports[_0xf649('0x54')]=function(_0x455a67,_0x1b318d){return db[_0xf649('0x37')][_0xf649('0x54')](_0x455a67[_0xf649('0x55')],{})[_0xf649('0x1f')](respondWithResult(_0x1b318d,0xc9))[_0xf649('0x28')](handleError(_0x1b318d,null));};exports['update']=function(_0x3037cd,_0x18faea){if(_0x3037cd[_0xf649('0x55')]['id']){delete _0x3037cd['body']['id'];}return db[_0xf649('0x37')][_0xf649('0x53')]({'where':{'id':_0x3037cd[_0xf649('0x50')]['id']}})[_0xf649('0x1f')](handleEntityNotFound(_0x18faea,null))[_0xf649('0x1f')](saveUpdates(_0x3037cd['body'],null))[_0xf649('0x1f')](respondWithResult(_0x18faea,null))[_0xf649('0x28')](handleError(_0x18faea,null));};exports[_0xf649('0x56')]=function(_0x27ec3a,_0xb72cbe){return db[_0xf649('0x37')]['find']({'where':{'id':_0x27ec3a['params']['id']}})[_0xf649('0x1f')](handleEntityNotFound(_0xb72cbe,null))[_0xf649('0x1f')](removeEntity(_0xb72cbe,null))[_0xf649('0x28')](handleError(_0xb72cbe,null));};exports[_0xf649('0x57')]=function(_0x5b3590,_0x233e24,_0x27c001){var _0x3cf6df={};var _0xc2f0b={};var _0x49479f;var _0x5809a4;return db['FreshdeskAccount']['findOne']({'where':{'id':_0x5b3590[_0xf649('0x50')]['id']}})[_0xf649('0x1f')](handleEntityNotFound(_0x233e24,null))[_0xf649('0x1f')](function(_0x521d19){if(_0x521d19){_0x49479f=_0x521d19;_0xc2f0b[_0xf649('0x3b')]=_[_0xf649('0x3e')](db['FreshdeskConfiguration'][_0xf649('0x38')]);_0xc2f0b[_0xf649('0x3d')]=_['keys'](_0x5b3590[_0xf649('0x3d')]);_0xc2f0b[_0xf649('0x46')]=_[_0xf649('0x3f')](_0xc2f0b[_0xf649('0x3b')],_0xc2f0b['query']);_0x3cf6df[_0xf649('0x40')]=_[_0xf649('0x3f')](_0xc2f0b['model'],qs[_0xf649('0x51')](_0x5b3590[_0xf649('0x3d')]['fields']));_0x3cf6df[_0xf649('0x40')]=_0x3cf6df[_0xf649('0x40')]['length']?_0x3cf6df[_0xf649('0x40')]:_0xc2f0b[_0xf649('0x3b')];_0x3cf6df[_0xf649('0x42')]=qs['sort'](_0x5b3590[_0xf649('0x3d')][_0xf649('0x43')]);_0x3cf6df[_0xf649('0x44')]=qs['filters'](_['pick'](_0x5b3590[_0xf649('0x3d')],_0xc2f0b['filters']));if(_0x5b3590[_0xf649('0x3d')][_0xf649('0x49')]){_0x3cf6df[_0xf649('0x44')]=_[_0xf649('0x4a')](_0x3cf6df[_0xf649('0x44')],{'$or':_[_0xf649('0x3c')](_0x3cf6df[_0xf649('0x40')],function(_0x3ab01e){var _0x4342c1={};_0x4342c1[_0x3ab01e]={'$like':'%'+_0x5b3590[_0xf649('0x3d')][_0xf649('0x49')]+'%'};return _0x4342c1;})});}_0x3cf6df=_[_0xf649('0x4a')]({},_0x3cf6df,_0x5b3590[_0xf649('0x58')]);return _0x49479f[_0xf649('0x57')](_0x3cf6df);}})['then'](function(_0x3f71d6){if(_0x3f71d6){_0x5809a4=_0x3f71d6[_0xf649('0x52')];if(!_0x5b3590[_0xf649('0x3d')][_0xf649('0x59')](_0xf649('0x41'))){_0x3cf6df['limit']=qs[_0xf649('0x2e')](_0x5b3590[_0xf649('0x3d')][_0xf649('0x2e')]);_0x3cf6df[_0xf649('0x2d')]=qs['offset'](_0x5b3590[_0xf649('0x3d')][_0xf649('0x2d')]);}return _0x49479f[_0xf649('0x57')](_0x3cf6df);}})['then'](function(_0x308b11){if(_0x308b11){return _0x308b11?{'count':_0x5809a4,'rows':_0x308b11}:null;}})['then'](respondWithResult(_0x233e24,null))[_0xf649('0x28')](handleError(_0x233e24,null));};exports['addConfiguration']=function(_0x516eab,_0x521827,_0x5296ce){if(_0x516eab['body']['id']){delete _0x516eab[_0xf649('0x55')]['id'];}return db[_0xf649('0x37')][_0xf649('0x5a')]({'where':{'id':_0x516eab[_0xf649('0x50')]['id']}})[_0xf649('0x1f')](handleEntityNotFound(_0x521827,null))[_0xf649('0x1f')](function(_0x28e78d){if(_0x28e78d){_0x516eab[_0xf649('0x55')][_0xf649('0x5b')]=_0x28e78d['id'];_0x516eab['body'][_0xf649('0x5c')]=integrations[_0xf649('0x5d')](_0x516eab[_0xf649('0x55')]['channel'],_0x516eab[_0xf649('0x55')][_0xf649('0x47')]);_0x516eab['body'][_0xf649('0x5e')]=integrations[_0xf649('0x5f')](_0x516eab[_0xf649('0x55')]['channel'],_0x516eab[_0xf649('0x55')]['type']);return db[_0xf649('0x60')][_0xf649('0x54')](_0x516eab[_0xf649('0x55')],{'include':[{'model':db[_0xf649('0x61')],'as':'Subjects'},{'model':db[_0xf649('0x61')],'as':'Descriptions'}]});}return null;})[_0xf649('0x1f')](respondWithResult(_0x521827,null))['catch'](handleError(_0x521827,null));};exports['getFields']=function(_0x3cc759,_0x2852d1,_0x49065d){var _0x85b54e='';return db[_0xf649('0x37')]['findOne']({'where':{'id':_0x3cc759[_0xf649('0x50')]['id']},'attributes':['id',_0xf649('0x62'),'apiKey']})[_0xf649('0x1f')](handleEntityNotFound(_0x2852d1,null))[_0xf649('0x1f')](function(_0xf96e15){if(_0xf96e15){_0x85b54e=_0xf96e15[_0xf649('0x62')];var _0x327cce=_0x85b54e['slice'](-0x1);if(_0x327cce==='/'){_0x85b54e=_0x85b54e['substring'](0x0,_0x85b54e[_0xf649('0x63')](_0x327cce));}return rp({'method':_0xf649('0x64'),'uri':util[_0xf649('0x65')](_0xf649('0x66'),_0x85b54e,'api/v2/ticket_fields'),'headers':{'Authorization':util[_0xf649('0x65')](_0xf649('0x67'),new Buffer(util[_0xf649('0x65')](_0xf649('0x68'),_0xf96e15['apiKey']))[_0xf649('0x69')](_0xf649('0x6a')))},'json':!![]});}})[_0xf649('0x1f')](function(_0x549cb5){if(_0x549cb5){var _0x59babf=[_0xf649('0x6b'),_0xf649('0x6c'),'agent',_0xf649('0x6d'),_0xf649('0x2a'),_0xf649('0x6e'),_0xf649('0x6f'),'source',_0xf649('0x70'),_0xf649('0x6f'),'company'];_[_0xf649('0x71')](_0x549cb5,function(_0x2dcade){return _0x59babf['includes'](_0x2dcade[_0xf649('0x34')])||!_0x2dcade['default']&&_0x2dcade[_0xf649('0x47')]!==_0xf649('0x72')&&_0x2dcade[_0xf649('0x47')]!==_0xf649('0x73');});return{'count':_0x549cb5[_0xf649('0x52')],'rows':_[_0xf649('0x3c')](_0x549cb5,function(_0x257cf0){return{'id':_0x257cf0[_0xf649('0x34')],'name':_0x257cf0[_0xf649('0x74')],'custom':!_0x257cf0[_0xf649('0x75')],'options':_0x257cf0[_0xf649('0x76')]?_[_0xf649('0x3c')](_0x257cf0[_0xf649('0x76')],function(_0x33cf3e){return{'name':_['capitalize'](_0x33cf3e),'value':_0x33cf3e};}):[]};})};}})[_0xf649('0x1f')](respondWithResult(_0x2852d1,null))[_0xf649('0x28')](function(_0x64a176){var _0x3ad624=_0x3cc759[_0xf649('0x3d')]['test']?0x1f4:_0x64a176[_0xf649('0x77')]||0x1f4;logger[_0xf649('0x24')](_0xf649('0x78'),'getFields',_0x3ad624,JSON['stringify'](_0x64a176));delete _0x64a176[_0xf649('0x34')];if(_0x3ad624===0x191){_0x3ad624=0x190;}_0x2852d1[_0xf649('0x2a')](_0x3ad624)[_0xf649('0x35')](_0x3cc759['query'][_0xf649('0x1c')]?{'message':_0xf649('0x79'),'statusCode':_0x64a176['statusCode']}:_0x64a176);});}; \ No newline at end of file +var _0xe5ef=['catch','sendStatus','end','json','count','offset','limit','status','Content-Range','apply','reject','save','then','destroy','name','index','FreshdeskAccount','fieldName','type','key','model','map','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filter','options','rows','show','params','keys','includeAll','include','find','create','body','update','findOne','rawAttributes','merge','getConfigurations','addConfiguration','AccountId','channel','FreshdeskConfiguration','FreshdeskField','Descriptions','getFields','remoteUri','substring','lastIndexOf','format','%s/%s','api/v2/ticket_fields','Basic\x20%s','%s:X','apiKey','toString','base64','requester','subject','agent','priority','group','ticket_type','remove','includes','default','custom_text','custom_dropdown','label','choices','capitalize','getFields,\x20%s,\x20%s,\x20%s','send','Wrong\x20credentials','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','to-csv','ejs','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../components/integrations/configuration','client','test','Sequelize','The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.','request','info','FreshdeskAccount,\x20%s,\x20%s','debug','FreshdeskAccount,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message'];(function(_0x9a0335,_0xb6426e){var _0x4f6dd2=function(_0x2ea8e8){while(--_0x2ea8e8){_0x9a0335['push'](_0x9a0335['shift']());}};_0x4f6dd2(++_0xb6426e);}(_0xe5ef,0xcf));var _0xfe5e=function(_0x5f565d,_0x2a1de0){_0x5f565d=_0x5f565d-0x0;var _0x437377=_0xe5ef[_0x5f565d];return _0x437377;};'use strict';var pdf=require(_0xfe5e('0x0'));var emlformat=require(_0xfe5e('0x1'));var rimraf=require(_0xfe5e('0x2'));var zipdir=require(_0xfe5e('0x3'));var jsonpatch=require(_0xfe5e('0x4'));var rp=require('request-promise');var moment=require(_0xfe5e('0x5'));var BPromise=require(_0xfe5e('0x6'));var Mustache=require(_0xfe5e('0x7'));var util=require(_0xfe5e('0x8'));var path=require(_0xfe5e('0x9'));var sox=require('sox');var csv=require(_0xfe5e('0xa'));var ejs=require(_0xfe5e('0xb'));var fs=require('fs');var _=require('lodash');var squel=require(_0xfe5e('0xc'));var crypto=require('crypto');var jsforce=require(_0xfe5e('0xd'));var deskjs=require(_0xfe5e('0xe'));var toCsv=require(_0xfe5e('0xa'));var querystring=require(_0xfe5e('0xf'));var Papa=require(_0xfe5e('0x10'));var Redis=require(_0xfe5e('0x11'));var authService=require('../../components/auth/service');var qs=require(_0xfe5e('0x12'));var as=require(_0xfe5e('0x13'));var hardwareService=require(_0xfe5e('0x14'));var logger=require('../../config/logger')(_0xfe5e('0x15'));var utils=require(_0xfe5e('0x16'));var config=require(_0xfe5e('0x17'));var db=require('../../mysqldb')['db'];var integrations=require(_0xfe5e('0x18'));var jayson=require('jayson/promise');var client=jayson[_0xfe5e('0x19')]['http']({'port':0x232a});function checkPasswordPattern(_0x1a19a4,_0x496128,_0x414294){if(_0x414294){var _0x558d61=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x558d61[_0xfe5e('0x1a')](_0x496128)){return _0x1a19a4;}else{throw new db[(_0xfe5e('0x1b'))]['ValidationError'](_0xfe5e('0x1c'));}}else{return _0x1a19a4;}}function respondWithRpcPromise(_0x27c4c8,_0x49dc73,_0x3f094e,_0x4be371){return new BPromise(function(_0x30ec4d,_0x363f45){var _0x6ca8c4=_0x4be371||client;return _0x6ca8c4[_0xfe5e('0x1d')](_0x27c4c8,_0x3f094e)['then'](function(_0x4a8f76){logger[_0xfe5e('0x1e')](_0xfe5e('0x1f'),_0x49dc73,'request\x20sent');logger[_0xfe5e('0x20')](_0xfe5e('0x21'),_0x49dc73,_0xfe5e('0x22'),JSON[_0xfe5e('0x23')](_0x4a8f76));if(_0x4a8f76[_0xfe5e('0x24')]){if(_0x4a8f76['error'][_0xfe5e('0x25')]===0x1f4){logger['error'](_0xfe5e('0x1f'),_0x49dc73,_0x4a8f76[_0xfe5e('0x24')]['message']);return _0x363f45(_0x4a8f76[_0xfe5e('0x24')]['message']);}logger[_0xfe5e('0x24')](_0xfe5e('0x1f'),_0x49dc73,_0x4a8f76[_0xfe5e('0x24')][_0xfe5e('0x26')]);return _0x30ec4d(_0x4a8f76['error'][_0xfe5e('0x26')]);}else{logger[_0xfe5e('0x1e')](_0xfe5e('0x1f'),_0x49dc73,'request\x20sent');_0x30ec4d(_0x4a8f76['result'][_0xfe5e('0x26')]);}})[_0xfe5e('0x27')](function(_0x11ae61){logger[_0xfe5e('0x24')]('FreshdeskAccount,\x20%s,\x20%s',_0x49dc73,_0x11ae61);_0x363f45(_0x11ae61);});});}function respondWithStatusCode(_0x3fc438,_0x5133f0){_0x5133f0=_0x5133f0||0xcc;return function(_0x35dda3){if(_0x35dda3){return _0x3fc438[_0xfe5e('0x28')](_0x5133f0);}return _0x3fc438['status'](_0x5133f0)[_0xfe5e('0x29')]();};}function respondWithResult(_0x52fe01,_0x3d1ee3){_0x3d1ee3=_0x3d1ee3||0xc8;return function(_0x4bced0){if(_0x4bced0){return _0x52fe01['status'](_0x3d1ee3)[_0xfe5e('0x2a')](_0x4bced0);}};}function respondWithFilteredResult(_0x5d3253,_0x3c7dfa){return function(_0x2aea77){if(_0x2aea77){var _0x22a102=_0x2aea77[_0xfe5e('0x2b')],_0x5e3901=_0x3c7dfa[_0xfe5e('0x2c')],_0x42c4=_0x3c7dfa['offset']+_0x3c7dfa[_0xfe5e('0x2d')],_0x57d035;if(_0x42c4>=_0x22a102){_0x42c4=_0x22a102;_0x57d035=0xc8;}else{_0x57d035=0xce;}_0x5d3253[_0xfe5e('0x2e')](_0x57d035);return _0x5d3253['set'](_0xfe5e('0x2f'),_0x5e3901+'-'+_0x42c4+'/'+_0x22a102)[_0xfe5e('0x2a')](_0x2aea77);}return null;};}function patchUpdates(_0x3e106f){return function(_0x595b2c){try{jsonpatch[_0xfe5e('0x30')](_0x595b2c,_0x3e106f,!![]);}catch(_0x2a77fc){return BPromise[_0xfe5e('0x31')](_0x2a77fc);}return _0x595b2c[_0xfe5e('0x32')]();};}function saveUpdates(_0x44674c,_0x240ac0){return function(_0x38416d){if(_0x38416d){return _0x38416d['update'](_0x44674c)[_0xfe5e('0x33')](function(_0x16a4fd){return _0x16a4fd;});}return null;};}function removeEntity(_0x227fed,_0x268c0a){return function(_0x135b79){if(_0x135b79){return _0x135b79[_0xfe5e('0x34')]()['then'](function(){_0x227fed[_0xfe5e('0x2e')](0xcc)['end']();});}};}function handleEntityNotFound(_0x2305b3,_0x339f03){return function(_0x476a6c){if(!_0x476a6c){_0x2305b3[_0xfe5e('0x28')](0x194);}return _0x476a6c;};}function handleError(_0x13ce0c,_0x12e93d){_0x12e93d=_0x12e93d||0x1f4;return function(_0x72e9f7){logger['error'](_0x72e9f7['stack']);if(_0x72e9f7[_0xfe5e('0x35')]){delete _0x72e9f7[_0xfe5e('0x35')];}_0x13ce0c[_0xfe5e('0x2e')](_0x12e93d)['send'](_0x72e9f7);};}exports[_0xfe5e('0x36')]=function(_0x47ce42,_0x322246){var _0x2046ca={},_0x2d69d2={},_0x148eaa={'count':0x0,'rows':[]};var _0x19da5f=_['map'](db[_0xfe5e('0x37')]['rawAttributes'],function(_0xa23185){return{'name':_0xa23185[_0xfe5e('0x38')],'type':_0xa23185[_0xfe5e('0x39')][_0xfe5e('0x3a')]};});_0x2d69d2[_0xfe5e('0x3b')]=_[_0xfe5e('0x3c')](_0x19da5f,_0xfe5e('0x35'));_0x2d69d2[_0xfe5e('0x3d')]=_['keys'](_0x47ce42[_0xfe5e('0x3d')]);_0x2d69d2[_0xfe5e('0x3e')]=_[_0xfe5e('0x3f')](_0x2d69d2['model'],_0x2d69d2['query']);_0x2046ca[_0xfe5e('0x40')]=_[_0xfe5e('0x3f')](_0x2d69d2[_0xfe5e('0x3b')],qs['fields'](_0x47ce42[_0xfe5e('0x3d')][_0xfe5e('0x41')]));_0x2046ca[_0xfe5e('0x40')]=_0x2046ca[_0xfe5e('0x40')][_0xfe5e('0x42')]?_0x2046ca[_0xfe5e('0x40')]:_0x2d69d2[_0xfe5e('0x3b')];if(!_0x47ce42[_0xfe5e('0x3d')][_0xfe5e('0x43')](_0xfe5e('0x44'))){_0x2046ca['limit']=qs[_0xfe5e('0x2d')](_0x47ce42[_0xfe5e('0x3d')]['limit']);_0x2046ca[_0xfe5e('0x2c')]=qs[_0xfe5e('0x2c')](_0x47ce42[_0xfe5e('0x3d')][_0xfe5e('0x2c')]);}_0x2046ca[_0xfe5e('0x45')]=qs['sort'](_0x47ce42[_0xfe5e('0x3d')][_0xfe5e('0x46')]);_0x2046ca[_0xfe5e('0x47')]=qs[_0xfe5e('0x3e')](_['pick'](_0x47ce42[_0xfe5e('0x3d')],_0x2d69d2[_0xfe5e('0x3e')]));if(_0x47ce42[_0xfe5e('0x3d')][_0xfe5e('0x48')]){_0x2046ca['where']=_['merge'](_0x2046ca[_0xfe5e('0x47')],{'$or':_[_0xfe5e('0x3c')](_0x19da5f,function(_0x5c8697){if(_0x5c8697['type']!=='VIRTUAL'){var _0x33d52e={};_0x33d52e[_0x5c8697[_0xfe5e('0x35')]]={'$like':'%'+_0x47ce42[_0xfe5e('0x3d')][_0xfe5e('0x48')]+'%'};return _0x33d52e;}})});}_0x2046ca=_['merge']({},_0x2046ca,_0x47ce42[_0xfe5e('0x49')]);var _0x29ac23={'where':_0x2046ca[_0xfe5e('0x47')]};return db[_0xfe5e('0x37')]['count'](_0x29ac23)[_0xfe5e('0x33')](function(_0x16417d){_0x148eaa[_0xfe5e('0x2b')]=_0x16417d;if(_0x47ce42[_0xfe5e('0x3d')]['includeAll']){_0x2046ca['include']=[{'all':!![]}];}return db[_0xfe5e('0x37')]['findAll'](_0x2046ca);})[_0xfe5e('0x33')](function(_0x24f195){_0x148eaa[_0xfe5e('0x4a')]=_0x24f195;return _0x148eaa;})[_0xfe5e('0x33')](respondWithFilteredResult(_0x322246,_0x2046ca))['catch'](handleError(_0x322246,null));};exports[_0xfe5e('0x4b')]=function(_0x20bbc8,_0x29627c){var _0x12062d={'raw':![],'where':{'id':_0x20bbc8[_0xfe5e('0x4c')]['id']}},_0x268edf={};_0x268edf[_0xfe5e('0x3b')]=_[_0xfe5e('0x4d')](db[_0xfe5e('0x37')]['rawAttributes']);_0x268edf['query']=_['keys'](_0x20bbc8[_0xfe5e('0x3d')]);_0x268edf['filters']=_[_0xfe5e('0x3f')](_0x268edf['model'],_0x268edf[_0xfe5e('0x3d')]);_0x12062d[_0xfe5e('0x40')]=_['intersection'](_0x268edf[_0xfe5e('0x3b')],qs[_0xfe5e('0x41')](_0x20bbc8[_0xfe5e('0x3d')][_0xfe5e('0x41')]));_0x12062d[_0xfe5e('0x40')]=_0x12062d[_0xfe5e('0x40')][_0xfe5e('0x42')]?_0x12062d['attributes']:_0x268edf[_0xfe5e('0x3b')];if(_0x20bbc8[_0xfe5e('0x3d')][_0xfe5e('0x4e')]){_0x12062d[_0xfe5e('0x4f')]=[{'all':!![]}];}_0x12062d=_['merge']({},_0x12062d,_0x20bbc8[_0xfe5e('0x49')]);return db['FreshdeskAccount'][_0xfe5e('0x50')](_0x12062d)[_0xfe5e('0x33')](handleEntityNotFound(_0x29627c,null))[_0xfe5e('0x33')](respondWithResult(_0x29627c,null))[_0xfe5e('0x27')](handleError(_0x29627c,null));};exports[_0xfe5e('0x51')]=function(_0x2ab36d,_0x33c849){return db[_0xfe5e('0x37')][_0xfe5e('0x51')](_0x2ab36d[_0xfe5e('0x52')],{})['then'](respondWithResult(_0x33c849,0xc9))[_0xfe5e('0x27')](handleError(_0x33c849,null));};exports[_0xfe5e('0x53')]=function(_0x17055c,_0x1d2d96){if(_0x17055c[_0xfe5e('0x52')]['id']){delete _0x17055c[_0xfe5e('0x52')]['id'];}return db[_0xfe5e('0x37')][_0xfe5e('0x50')]({'where':{'id':_0x17055c[_0xfe5e('0x4c')]['id']}})[_0xfe5e('0x33')](handleEntityNotFound(_0x1d2d96,null))[_0xfe5e('0x33')](saveUpdates(_0x17055c[_0xfe5e('0x52')],null))[_0xfe5e('0x33')](respondWithResult(_0x1d2d96,null))['catch'](handleError(_0x1d2d96,null));};exports[_0xfe5e('0x34')]=function(_0x35fbfa,_0x369cea){return db['FreshdeskAccount']['find']({'where':{'id':_0x35fbfa['params']['id']}})[_0xfe5e('0x33')](handleEntityNotFound(_0x369cea,null))['then'](removeEntity(_0x369cea,null))[_0xfe5e('0x27')](handleError(_0x369cea,null));};exports['getConfigurations']=function(_0x25a63a,_0x5f2580,_0x27d1f6){var _0xea7b0b={};var _0x50666e={};var _0x343162;var _0x4aa41d;return db[_0xfe5e('0x37')][_0xfe5e('0x54')]({'where':{'id':_0x25a63a['params']['id']}})[_0xfe5e('0x33')](handleEntityNotFound(_0x5f2580,null))['then'](function(_0x11d3a8){if(_0x11d3a8){_0x343162=_0x11d3a8;_0x50666e['model']=_['keys'](db['FreshdeskConfiguration'][_0xfe5e('0x55')]);_0x50666e[_0xfe5e('0x3d')]=_['keys'](_0x25a63a[_0xfe5e('0x3d')]);_0x50666e['filters']=_[_0xfe5e('0x3f')](_0x50666e[_0xfe5e('0x3b')],_0x50666e[_0xfe5e('0x3d')]);_0xea7b0b[_0xfe5e('0x40')]=_[_0xfe5e('0x3f')](_0x50666e[_0xfe5e('0x3b')],qs[_0xfe5e('0x41')](_0x25a63a['query'][_0xfe5e('0x41')]));_0xea7b0b[_0xfe5e('0x40')]=_0xea7b0b[_0xfe5e('0x40')][_0xfe5e('0x42')]?_0xea7b0b[_0xfe5e('0x40')]:_0x50666e[_0xfe5e('0x3b')];_0xea7b0b[_0xfe5e('0x45')]=qs[_0xfe5e('0x46')](_0x25a63a['query'][_0xfe5e('0x46')]);_0xea7b0b[_0xfe5e('0x47')]=qs['filters'](_['pick'](_0x25a63a['query'],_0x50666e['filters']));if(_0x25a63a[_0xfe5e('0x3d')][_0xfe5e('0x48')]){_0xea7b0b[_0xfe5e('0x47')]=_[_0xfe5e('0x56')](_0xea7b0b[_0xfe5e('0x47')],{'$or':_[_0xfe5e('0x3c')](_0xea7b0b[_0xfe5e('0x40')],function(_0x237aa9){var _0x24d57e={};_0x24d57e[_0x237aa9]={'$like':'%'+_0x25a63a['query'][_0xfe5e('0x48')]+'%'};return _0x24d57e;})});}_0xea7b0b=_['merge']({},_0xea7b0b,_0x25a63a['options']);return _0x343162['getConfigurations'](_0xea7b0b);}})[_0xfe5e('0x33')](function(_0xed0f27){if(_0xed0f27){_0x4aa41d=_0xed0f27['length'];if(!_0x25a63a[_0xfe5e('0x3d')]['hasOwnProperty'](_0xfe5e('0x44'))){_0xea7b0b['limit']=qs['limit'](_0x25a63a[_0xfe5e('0x3d')][_0xfe5e('0x2d')]);_0xea7b0b[_0xfe5e('0x2c')]=qs[_0xfe5e('0x2c')](_0x25a63a[_0xfe5e('0x3d')][_0xfe5e('0x2c')]);}return _0x343162[_0xfe5e('0x57')](_0xea7b0b);}})[_0xfe5e('0x33')](function(_0x35b6f4){if(_0x35b6f4){return _0x35b6f4?{'count':_0x4aa41d,'rows':_0x35b6f4}:null;}})[_0xfe5e('0x33')](respondWithResult(_0x5f2580,null))[_0xfe5e('0x27')](handleError(_0x5f2580,null));};exports[_0xfe5e('0x58')]=function(_0x4caa4c,_0x39d643,_0x12e1ff){if(_0x4caa4c[_0xfe5e('0x52')]['id']){delete _0x4caa4c[_0xfe5e('0x52')]['id'];}return db[_0xfe5e('0x37')][_0xfe5e('0x54')]({'where':{'id':_0x4caa4c[_0xfe5e('0x4c')]['id']}})[_0xfe5e('0x33')](handleEntityNotFound(_0x39d643,null))['then'](function(_0x53d6c4){if(_0x53d6c4){_0x4caa4c[_0xfe5e('0x52')][_0xfe5e('0x59')]=_0x53d6c4['id'];_0x4caa4c[_0xfe5e('0x52')]['Subjects']=integrations['getSubjects'](_0x4caa4c[_0xfe5e('0x52')][_0xfe5e('0x5a')],_0x4caa4c[_0xfe5e('0x52')][_0xfe5e('0x39')]);_0x4caa4c[_0xfe5e('0x52')]['Descriptions']=integrations['getDescriptions'](_0x4caa4c['body'][_0xfe5e('0x5a')],_0x4caa4c[_0xfe5e('0x52')][_0xfe5e('0x39')]);return db[_0xfe5e('0x5b')][_0xfe5e('0x51')](_0x4caa4c[_0xfe5e('0x52')],{'include':[{'model':db[_0xfe5e('0x5c')],'as':'Subjects'},{'model':db['FreshdeskField'],'as':_0xfe5e('0x5d')}]});}return null;})[_0xfe5e('0x33')](respondWithResult(_0x39d643,null))[_0xfe5e('0x27')](handleError(_0x39d643,null));};exports[_0xfe5e('0x5e')]=function(_0x49c4bc,_0x48f2c7,_0x192ef5){var _0x46c8c9='';return db[_0xfe5e('0x37')][_0xfe5e('0x54')]({'where':{'id':_0x49c4bc[_0xfe5e('0x4c')]['id']},'attributes':['id',_0xfe5e('0x5f'),'apiKey']})[_0xfe5e('0x33')](handleEntityNotFound(_0x48f2c7,null))[_0xfe5e('0x33')](function(_0xa94370){if(_0xa94370){_0x46c8c9=_0xa94370[_0xfe5e('0x5f')];var _0x157828=_0x46c8c9['slice'](-0x1);if(_0x157828==='/'){_0x46c8c9=_0x46c8c9[_0xfe5e('0x60')](0x0,_0x46c8c9[_0xfe5e('0x61')](_0x157828));}return rp({'method':'GET','uri':util[_0xfe5e('0x62')](_0xfe5e('0x63'),_0x46c8c9,_0xfe5e('0x64')),'headers':{'Authorization':util['format'](_0xfe5e('0x65'),new Buffer(util[_0xfe5e('0x62')](_0xfe5e('0x66'),_0xa94370[_0xfe5e('0x67')]))[_0xfe5e('0x68')](_0xfe5e('0x69')))},'json':!![]});}})[_0xfe5e('0x33')](function(_0x5d83f9){if(_0x5d83f9){var _0x550163=[_0xfe5e('0x6a'),_0xfe5e('0x6b'),_0xfe5e('0x6c'),'description',_0xfe5e('0x2e'),_0xfe5e('0x6d'),_0xfe5e('0x6e'),'source',_0xfe5e('0x6f'),'group','company'];_[_0xfe5e('0x70')](_0x5d83f9,function(_0x242108){return _0x550163[_0xfe5e('0x71')](_0x242108[_0xfe5e('0x35')])||!_0x242108[_0xfe5e('0x72')]&&_0x242108[_0xfe5e('0x39')]!==_0xfe5e('0x73')&&_0x242108[_0xfe5e('0x39')]!==_0xfe5e('0x74');});return{'count':_0x5d83f9[_0xfe5e('0x42')],'rows':_[_0xfe5e('0x3c')](_0x5d83f9,function(_0x187ed6){return{'id':_0x187ed6['name'],'name':_0x187ed6[_0xfe5e('0x75')],'custom':!_0x187ed6['default'],'options':_0x187ed6[_0xfe5e('0x76')]?_[_0xfe5e('0x3c')](_0x187ed6[_0xfe5e('0x76')],function(_0x4445fe){return{'name':_[_0xfe5e('0x77')](_0x4445fe),'value':_0x4445fe};}):[]};})};}})['then'](respondWithResult(_0x48f2c7,null))[_0xfe5e('0x27')](function(_0x5be2aa){var _0x4a2d3e=_0x49c4bc[_0xfe5e('0x3d')][_0xfe5e('0x1a')]?0x1f4:_0x5be2aa['statusCode']||0x1f4;logger[_0xfe5e('0x24')](_0xfe5e('0x78'),'getFields',_0x4a2d3e,JSON[_0xfe5e('0x23')](_0x5be2aa));delete _0x5be2aa[_0xfe5e('0x35')];if(_0x4a2d3e===0x191){_0x4a2d3e=0x190;}_0x48f2c7['status'](_0x4a2d3e)[_0xfe5e('0x79')](_0x49c4bc[_0xfe5e('0x3d')][_0xfe5e('0x1a')]?{'message':_0xfe5e('0x7a'),'statusCode':_0x5be2aa['statusCode']}:_0x5be2aa);});}; \ No newline at end of file diff --git a/server/api/intFreshdeskAccount/intFreshdeskAccount.model.js b/server/api/intFreshdeskAccount/intFreshdeskAccount.model.js index c7f5b8f..1c9f500 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 _0x22df=['../../config/environment','../../components/integrations/configuration','int_freshdesk_accounts','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf'];(function(_0x4d1d29,_0x5e19aa){var _0x4c88c6=function(_0x541f10){while(--_0x541f10){_0x4d1d29['push'](_0x4d1d29['shift']());}};_0x4c88c6(++_0x5e19aa);}(_0x22df,0x93));var _0xf22d=function(_0x182f05,_0xf318b7){_0x182f05=_0x182f05-0x0;var _0x383eaa=_0x22df[_0x182f05];return _0x383eaa;};'use strict';var _=require(_0xf22d('0x0'));var util=require(_0xf22d('0x1'));var logger=require(_0xf22d('0x2'))(_0xf22d('0x3'));var moment=require(_0xf22d('0x4'));var BPromise=require(_0xf22d('0x5'));var rp=require(_0xf22d('0x6'));var fs=require('fs');var path=require(_0xf22d('0x7'));var rimraf=require(_0xf22d('0x8'));var config=require(_0xf22d('0x9'));var attributes=require('./intFreshdeskAccount.attributes');var integrations=require(_0xf22d('0xa'));module['exports']=function(_0x50e36c,_0x978c3f){return _0x50e36c['define']('FreshdeskAccount',attributes,{'tableName':_0xf22d('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x2034=['./intFreshdeskAccount.attributes','exports','define','FreshdeskAccount','lodash','util','../../config/logger','api','moment','bluebird','path','rimraf'];(function(_0x4243a3,_0x447337){var _0x1b2a33=function(_0x6a8200){while(--_0x6a8200){_0x4243a3['push'](_0x4243a3['shift']());}};_0x1b2a33(++_0x447337);}(_0x2034,0xd0));var _0x4203=function(_0x46c07d,_0x2782ed){_0x46c07d=_0x46c07d-0x0;var _0x33f849=_0x2034[_0x46c07d];return _0x33f849;};'use strict';var _=require(_0x4203('0x0'));var util=require(_0x4203('0x1'));var logger=require(_0x4203('0x2'))(_0x4203('0x3'));var moment=require(_0x4203('0x4'));var BPromise=require(_0x4203('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x4203('0x6'));var rimraf=require(_0x4203('0x7'));var config=require('../../config/environment');var attributes=require(_0x4203('0x8'));var integrations=require('../../components/integrations/configuration');module[_0x4203('0x9')]=function(_0xd3801a,_0x36986c){return _0xd3801a[_0x4203('0xa')](_0x4203('0xb'),attributes,{'tableName':'int_freshdesk_accounts','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 dc8c6eb..9a5c8ec 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 _0xc853=['attributes','limit','include','map','model','GetFreshdeskAccount','ShowFreshdeskAccount','find','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','request','then','info','FreshdeskAccount,\x20%s,\x20%s','debug','FreshdeskAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','FreshdeskAccount','findAll','options','raw','where'];(function(_0x381589,_0x27a707){var _0x2a075d=function(_0x4ea19d){while(--_0x4ea19d){_0x381589['push'](_0x381589['shift']());}};_0x2a075d(++_0x27a707);}(_0xc853,0xc1));var _0x3c85=function(_0x1855b0,_0x192f9a){_0x1855b0=_0x1855b0-0x0;var _0x44387e=_0xc853[_0x1855b0];return _0x44387e;};'use strict';var _=require(_0x3c85('0x0'));var util=require(_0x3c85('0x1'));var moment=require('moment');var BPromise=require(_0x3c85('0x2'));var rs=require(_0x3c85('0x3'));var fs=require('fs');var Redis=require(_0x3c85('0x4'));var db=require(_0x3c85('0x5'))['db'];var utils=require(_0x3c85('0x6'));var logger=require(_0x3c85('0x7'))(_0x3c85('0x8'));var config=require(_0x3c85('0x9'));var jayson=require('jayson/promise');var client=jayson[_0x3c85('0xa')][_0x3c85('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x4ee019,_0xaa16dc,_0x2205f9){return new BPromise(function(_0x1673e9,_0x3d48c7){return client[_0x3c85('0xc')](_0x4ee019,_0x2205f9)[_0x3c85('0xd')](function(_0x46984e){logger[_0x3c85('0xe')](_0x3c85('0xf'),_0xaa16dc,'request\x20sent');logger[_0x3c85('0x10')](_0x3c85('0x11'),_0xaa16dc,'request\x20sent',JSON[_0x3c85('0x12')](_0x46984e));if(_0x46984e['error']){if(_0x46984e[_0x3c85('0x13')][_0x3c85('0x14')]===0x1f4){logger['error'](_0x3c85('0xf'),_0xaa16dc,_0x46984e[_0x3c85('0x13')][_0x3c85('0x15')]);return _0x3d48c7(_0x46984e[_0x3c85('0x13')][_0x3c85('0x15')]);}logger[_0x3c85('0x13')]('FreshdeskAccount,\x20%s,\x20%s',_0xaa16dc,_0x46984e[_0x3c85('0x13')][_0x3c85('0x15')]);return _0x1673e9(_0x46984e[_0x3c85('0x13')]['message']);}else{logger[_0x3c85('0xe')](_0x3c85('0xf'),_0xaa16dc,'request\x20sent');_0x1673e9(_0x46984e[_0x3c85('0x16')][_0x3c85('0x15')]);}})[_0x3c85('0x17')](function(_0x162fca){logger[_0x3c85('0x13')](_0x3c85('0xf'),_0xaa16dc,_0x162fca);_0x3d48c7(_0x162fca);});});}exports['GetFreshdeskAccount']=function(_0x5db496){var _0x34ca12=this;return new Promise(function(_0x746f39,_0x5c9926){return db[_0x3c85('0x18')][_0x3c85('0x19')]({'raw':_0x5db496[_0x3c85('0x1a')]?_0x5db496[_0x3c85('0x1a')][_0x3c85('0x1b')]===undefined?!![]:![]:!![],'where':_0x5db496[_0x3c85('0x1a')]?_0x5db496[_0x3c85('0x1a')][_0x3c85('0x1c')]||null:null,'attributes':_0x5db496[_0x3c85('0x1a')]?_0x5db496['options'][_0x3c85('0x1d')]||null:null,'limit':_0x5db496[_0x3c85('0x1a')]?_0x5db496['options'][_0x3c85('0x1e')]||null:null,'include':_0x5db496[_0x3c85('0x1a')]?_0x5db496['options'][_0x3c85('0x1f')]?_[_0x3c85('0x20')](_0x5db496[_0x3c85('0x1a')][_0x3c85('0x1f')],function(_0xb985bc){return{'model':db[_0xb985bc[_0x3c85('0x21')]],'as':_0xb985bc['as'],'attributes':_0xb985bc[_0x3c85('0x1d')],'include':_0xb985bc[_0x3c85('0x1f')]?_[_0x3c85('0x20')](_0xb985bc[_0x3c85('0x1f')],function(_0x13e260){return{'model':db[_0x13e260[_0x3c85('0x21')]],'as':_0x13e260['as'],'attributes':_0x13e260[_0x3c85('0x1d')],'include':_0x13e260[_0x3c85('0x1f')]?_[_0x3c85('0x20')](_0x13e260[_0x3c85('0x1f')],function(_0x4ab1b1){return{'model':db[_0x4ab1b1[_0x3c85('0x21')]],'as':_0x4ab1b1['as'],'attributes':_0x4ab1b1['attributes']};}):[]};}):[]};}):[]:[]})[_0x3c85('0xd')](function(_0x3f8caf){logger['info'](_0x3c85('0x22'),_0x5db496);logger[_0x3c85('0x10')]('GetFreshdeskAccount',_0x5db496,JSON[_0x3c85('0x12')](_0x3f8caf));_0x746f39(_0x3f8caf);})['catch'](function(_0x2551ac){logger[_0x3c85('0x13')](_0x3c85('0x22'),_0x2551ac['message'],_0x5db496);_0x5c9926(_0x34ca12[_0x3c85('0x13')](0x1f4,_0x2551ac[_0x3c85('0x15')]));});});};exports[_0x3c85('0x23')]=function(_0x4be37c){var _0x127024=this;return new Promise(function(_0x45557c,_0x25f846){return db[_0x3c85('0x18')][_0x3c85('0x24')]({'raw':_0x4be37c['options']?_0x4be37c[_0x3c85('0x1a')][_0x3c85('0x1b')]===undefined?!![]:![]:!![],'where':_0x4be37c['options']?_0x4be37c[_0x3c85('0x1a')][_0x3c85('0x1c')]||null:null,'attributes':_0x4be37c[_0x3c85('0x1a')]?_0x4be37c['options'][_0x3c85('0x1d')]||null:null,'include':_0x4be37c[_0x3c85('0x1a')]?_0x4be37c[_0x3c85('0x1a')][_0x3c85('0x1f')]?_[_0x3c85('0x20')](_0x4be37c[_0x3c85('0x1a')]['include'],function(_0x1ef706){return{'model':db[_0x1ef706[_0x3c85('0x21')]],'as':_0x1ef706['as'],'attributes':_0x1ef706[_0x3c85('0x1d')],'include':_0x1ef706[_0x3c85('0x1f')]?_['map'](_0x1ef706['include'],function(_0x5ee4d1){return{'model':db[_0x5ee4d1['model']],'as':_0x5ee4d1['as'],'attributes':_0x5ee4d1[_0x3c85('0x1d')],'include':_0x5ee4d1[_0x3c85('0x1f')]?_[_0x3c85('0x20')](_0x5ee4d1[_0x3c85('0x1f')],function(_0x127069){return{'model':db[_0x127069['model']],'as':_0x127069['as'],'attributes':_0x127069[_0x3c85('0x1d')]};}):[]};}):[]};}):[]:[]})[_0x3c85('0xd')](function(_0x975efd){logger[_0x3c85('0xe')]('ShowFreshdeskAccount',_0x4be37c);logger[_0x3c85('0x10')](_0x3c85('0x23'),_0x4be37c,JSON[_0x3c85('0x12')](_0x975efd));_0x45557c(_0x975efd);})[_0x3c85('0x17')](function(_0x17d91f){logger[_0x3c85('0x13')](_0x3c85('0x23'),_0x17d91f[_0x3c85('0x15')],_0x4be37c);_0x25f846(_0x127024[_0x3c85('0x13')](0x1f4,_0x17d91f[_0x3c85('0x15')]));});});}; \ No newline at end of file +var _0xfba3=['findAll','options','where','attributes','limit','include','map','model','ShowFreshdeskAccount','find','raw','lodash','util','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','debug','FreshdeskAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','FreshdeskAccount,\x20%s,\x20%s','GetFreshdeskAccount','FreshdeskAccount'];(function(_0x47193f,_0x19d3dd){var _0x38007f=function(_0x51457f){while(--_0x51457f){_0x47193f['push'](_0x47193f['shift']());}};_0x38007f(++_0x19d3dd);}(_0xfba3,0x10e));var _0x3fba=function(_0x165173,_0x4a4444){_0x165173=_0x165173-0x0;var _0x3a6d08=_0xfba3[_0x165173];return _0x3a6d08;};'use strict';var _=require(_0x3fba('0x0'));var util=require(_0x3fba('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x3fba('0x2'));var fs=require('fs');var Redis=require(_0x3fba('0x3'));var db=require(_0x3fba('0x4'))['db'];var utils=require(_0x3fba('0x5'));var logger=require(_0x3fba('0x6'))(_0x3fba('0x7'));var config=require(_0x3fba('0x8'));var jayson=require(_0x3fba('0x9'));var client=jayson[_0x3fba('0xa')][_0x3fba('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x302472,_0x2773a7,_0xe76680){return new BPromise(function(_0x1bf1ec,_0x198ef3){return client[_0x3fba('0xc')](_0x302472,_0xe76680)[_0x3fba('0xd')](function(_0x13c4af){logger['info']('FreshdeskAccount,\x20%s,\x20%s',_0x2773a7,'request\x20sent');logger[_0x3fba('0xe')](_0x3fba('0xf'),_0x2773a7,'request\x20sent',JSON[_0x3fba('0x10')](_0x13c4af));if(_0x13c4af['error']){if(_0x13c4af[_0x3fba('0x11')][_0x3fba('0x12')]===0x1f4){logger[_0x3fba('0x11')]('FreshdeskAccount,\x20%s,\x20%s',_0x2773a7,_0x13c4af[_0x3fba('0x11')]['message']);return _0x198ef3(_0x13c4af[_0x3fba('0x11')][_0x3fba('0x13')]);}logger[_0x3fba('0x11')]('FreshdeskAccount,\x20%s,\x20%s',_0x2773a7,_0x13c4af[_0x3fba('0x11')]['message']);return _0x1bf1ec(_0x13c4af[_0x3fba('0x11')]['message']);}else{logger[_0x3fba('0x14')]('FreshdeskAccount,\x20%s,\x20%s',_0x2773a7,'request\x20sent');_0x1bf1ec(_0x13c4af[_0x3fba('0x15')]['message']);}})[_0x3fba('0x16')](function(_0x12eb7e){logger[_0x3fba('0x11')](_0x3fba('0x17'),_0x2773a7,_0x12eb7e);_0x198ef3(_0x12eb7e);});});}exports[_0x3fba('0x18')]=function(_0x2c8967){var _0x5218f4=this;return new Promise(function(_0x3b2dc2,_0x6666e7){return db[_0x3fba('0x19')][_0x3fba('0x1a')]({'raw':_0x2c8967[_0x3fba('0x1b')]?_0x2c8967[_0x3fba('0x1b')]['raw']===undefined?!![]:![]:!![],'where':_0x2c8967[_0x3fba('0x1b')]?_0x2c8967[_0x3fba('0x1b')][_0x3fba('0x1c')]||null:null,'attributes':_0x2c8967[_0x3fba('0x1b')]?_0x2c8967[_0x3fba('0x1b')][_0x3fba('0x1d')]||null:null,'limit':_0x2c8967[_0x3fba('0x1b')]?_0x2c8967[_0x3fba('0x1b')][_0x3fba('0x1e')]||null:null,'include':_0x2c8967[_0x3fba('0x1b')]?_0x2c8967[_0x3fba('0x1b')][_0x3fba('0x1f')]?_[_0x3fba('0x20')](_0x2c8967[_0x3fba('0x1b')][_0x3fba('0x1f')],function(_0x5d3d86){return{'model':db[_0x5d3d86[_0x3fba('0x21')]],'as':_0x5d3d86['as'],'attributes':_0x5d3d86['attributes'],'include':_0x5d3d86[_0x3fba('0x1f')]?_['map'](_0x5d3d86[_0x3fba('0x1f')],function(_0x593400){return{'model':db[_0x593400['model']],'as':_0x593400['as'],'attributes':_0x593400[_0x3fba('0x1d')],'include':_0x593400[_0x3fba('0x1f')]?_[_0x3fba('0x20')](_0x593400['include'],function(_0x3a9853){return{'model':db[_0x3a9853[_0x3fba('0x21')]],'as':_0x3a9853['as'],'attributes':_0x3a9853[_0x3fba('0x1d')]};}):[]};}):[]};}):[]:[]})[_0x3fba('0xd')](function(_0x4910ce){logger[_0x3fba('0x14')](_0x3fba('0x18'),_0x2c8967);logger[_0x3fba('0xe')](_0x3fba('0x18'),_0x2c8967,JSON[_0x3fba('0x10')](_0x4910ce));_0x3b2dc2(_0x4910ce);})['catch'](function(_0x11889e){logger[_0x3fba('0x11')](_0x3fba('0x18'),_0x11889e[_0x3fba('0x13')],_0x2c8967);_0x6666e7(_0x5218f4[_0x3fba('0x11')](0x1f4,_0x11889e[_0x3fba('0x13')]));});});};exports[_0x3fba('0x22')]=function(_0xe88e3){var _0x78bdcd=this;return new Promise(function(_0x4644a0,_0x18cad5){return db[_0x3fba('0x19')][_0x3fba('0x23')]({'raw':_0xe88e3[_0x3fba('0x1b')]?_0xe88e3[_0x3fba('0x1b')][_0x3fba('0x24')]===undefined?!![]:![]:!![],'where':_0xe88e3['options']?_0xe88e3['options'][_0x3fba('0x1c')]||null:null,'attributes':_0xe88e3['options']?_0xe88e3[_0x3fba('0x1b')][_0x3fba('0x1d')]||null:null,'include':_0xe88e3[_0x3fba('0x1b')]?_0xe88e3['options']['include']?_[_0x3fba('0x20')](_0xe88e3[_0x3fba('0x1b')]['include'],function(_0x45bf32){return{'model':db[_0x45bf32['model']],'as':_0x45bf32['as'],'attributes':_0x45bf32['attributes'],'include':_0x45bf32[_0x3fba('0x1f')]?_[_0x3fba('0x20')](_0x45bf32['include'],function(_0x342bd1){return{'model':db[_0x342bd1[_0x3fba('0x21')]],'as':_0x342bd1['as'],'attributes':_0x342bd1['attributes'],'include':_0x342bd1[_0x3fba('0x1f')]?_[_0x3fba('0x20')](_0x342bd1[_0x3fba('0x1f')],function(_0x367813){return{'model':db[_0x367813[_0x3fba('0x21')]],'as':_0x367813['as'],'attributes':_0x367813['attributes']};}):[]};}):[]};}):[]:[]})[_0x3fba('0xd')](function(_0x7867e4){logger[_0x3fba('0x14')]('ShowFreshdeskAccount',_0xe88e3);logger[_0x3fba('0xe')](_0x3fba('0x22'),_0xe88e3,JSON['stringify'](_0x7867e4));_0x4644a0(_0x7867e4);})[_0x3fba('0x16')](function(_0x57c86e){logger[_0x3fba('0x11')](_0x3fba('0x22'),_0x57c86e[_0x3fba('0x13')],_0xe88e3);_0x18cad5(_0x78bdcd[_0x3fba('0x11')](0x1f4,_0x57c86e[_0x3fba('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/intFreshdeskConfiguration/index.js b/server/api/intFreshdeskConfiguration/index.js index 127e6c3..1cad57b 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 _0x20a1=['show','/:id/descriptions','getDescriptions','/:id/tags','getTags','post','create','/:id','delete','destroy','multer','path','connect-timeout','express','Router','../../components/auth/service','isAuthenticated','index','get'];(function(_0x321059,_0x4a60a4){var _0x1c688c=function(_0x4caadd){while(--_0x4caadd){_0x321059['push'](_0x321059['shift']());}};_0x1c688c(++_0x4a60a4);}(_0x20a1,0x114));var _0x120a=function(_0x25018a,_0x1d2a40){_0x25018a=_0x25018a-0x0;var _0x39e10c=_0x20a1[_0x25018a];return _0x39e10c;};'use strict';var multer=require(_0x120a('0x0'));var util=require('util');var path=require(_0x120a('0x1'));var timeout=require(_0x120a('0x2'));var express=require(_0x120a('0x3'));var router=express[_0x120a('0x4')]();var auth=require(_0x120a('0x5'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require('./intFreshdeskConfiguration.controller');router['get']('/',auth[_0x120a('0x6')](),controller[_0x120a('0x7')]);router[_0x120a('0x8')]('/:id',auth[_0x120a('0x6')](),controller[_0x120a('0x9')]);router[_0x120a('0x8')]('/:id/fields',auth[_0x120a('0x6')](),controller['getFields']);router[_0x120a('0x8')]('/:id/subjects',auth['isAuthenticated'](),controller['getSubjects']);router[_0x120a('0x8')](_0x120a('0xa'),auth[_0x120a('0x6')](),controller[_0x120a('0xb')]);router[_0x120a('0x8')](_0x120a('0xc'),auth[_0x120a('0x6')](),controller[_0x120a('0xd')]);router[_0x120a('0xe')]('/',auth[_0x120a('0x6')](),controller[_0x120a('0xf')]);router[_0x120a('0xe')](_0x120a('0xc'),auth[_0x120a('0x6')](),controller['setTags']);router['put'](_0x120a('0x10'),auth[_0x120a('0x6')](),controller['update']);router[_0x120a('0x11')]('/:id',auth['isAuthenticated'](),controller[_0x120a('0x12')]);module['exports']=router; \ No newline at end of file +var _0x4286=['../../components/interaction/service','../../config/environment','./intFreshdeskConfiguration.controller','get','isAuthenticated','index','show','/:id/subjects','getSubjects','/:id/descriptions','getDescriptions','/:id/tags','create','setTags','put','/:id','update','destroy','multer','util','connect-timeout','express','Router','../../components/auth/service'];(function(_0x327615,_0xa589c3){var _0x4e90ba=function(_0xf2d8a7){while(--_0xf2d8a7){_0x327615['push'](_0x327615['shift']());}};_0x4e90ba(++_0xa589c3);}(_0x4286,0x17a));var _0x6428=function(_0x11cdab,_0x338f67){_0x11cdab=_0x11cdab-0x0;var _0x4e5fd5=_0x4286[_0x11cdab];return _0x4e5fd5;};'use strict';var multer=require(_0x6428('0x0'));var util=require(_0x6428('0x1'));var path=require('path');var timeout=require(_0x6428('0x2'));var express=require(_0x6428('0x3'));var router=express[_0x6428('0x4')]();var auth=require(_0x6428('0x5'));var interaction=require(_0x6428('0x6'));var config=require(_0x6428('0x7'));var controller=require(_0x6428('0x8'));router[_0x6428('0x9')]('/',auth[_0x6428('0xa')](),controller[_0x6428('0xb')]);router[_0x6428('0x9')]('/:id',auth['isAuthenticated'](),controller[_0x6428('0xc')]);router[_0x6428('0x9')]('/:id/fields',auth[_0x6428('0xa')](),controller['getFields']);router[_0x6428('0x9')](_0x6428('0xd'),auth['isAuthenticated'](),controller[_0x6428('0xe')]);router[_0x6428('0x9')](_0x6428('0xf'),auth[_0x6428('0xa')](),controller[_0x6428('0x10')]);router[_0x6428('0x9')](_0x6428('0x11'),auth[_0x6428('0xa')](),controller['getTags']);router['post']('/',auth[_0x6428('0xa')](),controller[_0x6428('0x12')]);router['post'](_0x6428('0x11'),auth[_0x6428('0xa')](),controller[_0x6428('0x13')]);router[_0x6428('0x14')](_0x6428('0x15'),auth[_0x6428('0xa')](),controller[_0x6428('0x16')]);router['delete'](_0x6428('0x15'),auth[_0x6428('0xa')](),controller[_0x6428('0x17')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.attributes.js b/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.attributes.js index 63c52b4..b9afb95 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 _0xf7e9=['STRING','sequelize'];(function(_0x5da588,_0x3379a2){var _0x2f875a=function(_0x444da0){while(--_0x444da0){_0x5da588['push'](_0x5da588['shift']());}};_0x2f875a(++_0x3379a2);}(_0xf7e9,0x153));var _0x9f7e=function(_0x10c16d,_0x2b3e14){_0x10c16d=_0x10c16d-0x0;var _0x5896f4=_0xf7e9[_0x10c16d];return _0x5896f4;};'use strict';var Sequelize=require(_0x9f7e('0x0'));module['exports']={'name':{'type':Sequelize[_0x9f7e('0x1')]},'description':{'type':Sequelize[_0x9f7e('0x1')]}}; \ No newline at end of file +var _0xc458=['sequelize','exports','STRING'];(function(_0x4cc125,_0x328ad5){var _0x44cd01=function(_0x90ca62){while(--_0x90ca62){_0x4cc125['push'](_0x4cc125['shift']());}};_0x44cd01(++_0x328ad5);}(_0xc458,0x8a));var _0x8c45=function(_0x5a69df,_0x2b21fd){_0x5a69df=_0x5a69df-0x0;var _0x220ad0=_0xc458[_0x5a69df];return _0x220ad0;};'use strict';var Sequelize=require(_0x8c45('0x0'));module[_0x8c45('0x1')]={'name':{'type':Sequelize[_0x8c45('0x2')]},'description':{'type':Sequelize[_0x8c45('0x2')]}}; \ No newline at end of file diff --git a/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.controller.js b/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.controller.js index 82ba38a..d86f7a4 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 _0x2c94=['The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.','request','then','info','FreshdeskConfiguration,\x20%s,\x20%s','request\x20sent','debug','FreshdeskConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','message','catch','sendStatus','status','end','count','limit','set','Content-Range','json','apply','reject','save','update','stack','name','send','map','FreshdeskConfiguration','rawAttributes','fieldName','type','key','query','filters','intersection','model','fields','attributes','length','hasOwnProperty','offset','order','sort','where','pick','filter','merge','options','includeAll','include','findAll','rows','params','keys','find','create','body','getFields','FreshdeskField','nolimit','getSubjects','getDescriptions','getTags','findOne','Tag','setTags','ids','html-pdf','rimraf','fast-json-patch','request-promise','moment','mustache','path','sox','ejs','lodash','crypto','jsforce','desk.js','to-csv','querystring','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../mysqldb','jayson/promise','client','test','Sequelize'];(function(_0x5095bb,_0x3f16aa){var _0x5386b3=function(_0x1baaaf){while(--_0x1baaaf){_0x5095bb['push'](_0x5095bb['shift']());}};_0x5386b3(++_0x3f16aa);}(_0x2c94,0xa3));var _0x42c9=function(_0x41b5df,_0xe8c49b){_0x41b5df=_0x41b5df-0x0;var _0x5ded9e=_0x2c94[_0x41b5df];return _0x5ded9e;};'use strict';var pdf=require(_0x42c9('0x0'));var emlformat=require('eml-format');var rimraf=require(_0x42c9('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x42c9('0x2'));var rp=require(_0x42c9('0x3'));var moment=require(_0x42c9('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x42c9('0x5'));var util=require('util');var path=require(_0x42c9('0x6'));var sox=require(_0x42c9('0x7'));var csv=require('to-csv');var ejs=require(_0x42c9('0x8'));var fs=require('fs');var _=require(_0x42c9('0x9'));var squel=require('squel');var crypto=require(_0x42c9('0xa'));var jsforce=require(_0x42c9('0xb'));var deskjs=require(_0x42c9('0xc'));var toCsv=require(_0x42c9('0xd'));var querystring=require(_0x42c9('0xe'));var Papa=require('papaparse');var Redis=require(_0x42c9('0xf'));var authService=require('../../components/auth/service');var qs=require(_0x42c9('0x10'));var as=require(_0x42c9('0x11'));var hardwareService=require(_0x42c9('0x12'));var logger=require(_0x42c9('0x13'))(_0x42c9('0x14'));var utils=require('../../config/utils');var config=require(_0x42c9('0x15'));var db=require(_0x42c9('0x16'))['db'];var jayson=require(_0x42c9('0x17'));var client=jayson[_0x42c9('0x18')]['http']({'port':0x232a});function checkPasswordPattern(_0x7eda26,_0x5a4f5f,_0x3c1969){if(_0x3c1969){var _0x50b8ad=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x50b8ad[_0x42c9('0x19')](_0x5a4f5f)){return _0x7eda26;}else{throw new db[(_0x42c9('0x1a'))]['ValidationError'](_0x42c9('0x1b'));}}else{return _0x7eda26;}}function respondWithRpcPromise(_0x30ab45,_0x9df364,_0xfbfd72,_0x32bb3b){return new BPromise(function(_0x43f262,_0x20598c){var _0x26b218=_0x32bb3b||client;return _0x26b218[_0x42c9('0x1c')](_0x30ab45,_0xfbfd72)[_0x42c9('0x1d')](function(_0x5db5cb){logger[_0x42c9('0x1e')](_0x42c9('0x1f'),_0x9df364,_0x42c9('0x20'));logger[_0x42c9('0x21')](_0x42c9('0x22'),_0x9df364,_0x42c9('0x20'),JSON[_0x42c9('0x23')](_0x5db5cb));if(_0x5db5cb[_0x42c9('0x24')]){if(_0x5db5cb['error']['code']===0x1f4){logger[_0x42c9('0x24')](_0x42c9('0x1f'),_0x9df364,_0x5db5cb['error'][_0x42c9('0x25')]);return _0x20598c(_0x5db5cb[_0x42c9('0x24')][_0x42c9('0x25')]);}logger['error'](_0x42c9('0x1f'),_0x9df364,_0x5db5cb[_0x42c9('0x24')]['message']);return _0x43f262(_0x5db5cb['error'][_0x42c9('0x25')]);}else{logger[_0x42c9('0x1e')](_0x42c9('0x1f'),_0x9df364,_0x42c9('0x20'));_0x43f262(_0x5db5cb['result'][_0x42c9('0x25')]);}})[_0x42c9('0x26')](function(_0x5dfe5d){logger['error'](_0x42c9('0x1f'),_0x9df364,_0x5dfe5d);_0x20598c(_0x5dfe5d);});});}function respondWithStatusCode(_0x195dff,_0x2e46f3){_0x2e46f3=_0x2e46f3||0xcc;return function(_0x9ce5a9){if(_0x9ce5a9){return _0x195dff[_0x42c9('0x27')](_0x2e46f3);}return _0x195dff[_0x42c9('0x28')](_0x2e46f3)[_0x42c9('0x29')]();};}function respondWithResult(_0x79bb27,_0xdebce2){_0xdebce2=_0xdebce2||0xc8;return function(_0x3acff9){if(_0x3acff9){return _0x79bb27[_0x42c9('0x28')](_0xdebce2)['json'](_0x3acff9);}};}function respondWithFilteredResult(_0x37f0b5,_0xde3377){return function(_0x163284){if(_0x163284){var _0x580ea5=_0x163284[_0x42c9('0x2a')],_0x79d083=_0xde3377['offset'],_0x1e7744=_0xde3377['offset']+_0xde3377[_0x42c9('0x2b')],_0x380c97;if(_0x1e7744>=_0x580ea5){_0x1e7744=_0x580ea5;_0x380c97=0xc8;}else{_0x380c97=0xce;}_0x37f0b5['status'](_0x380c97);return _0x37f0b5[_0x42c9('0x2c')](_0x42c9('0x2d'),_0x79d083+'-'+_0x1e7744+'/'+_0x580ea5)[_0x42c9('0x2e')](_0x163284);}return null;};}function patchUpdates(_0x2f80f4){return function(_0x3814dc){try{jsonpatch[_0x42c9('0x2f')](_0x3814dc,_0x2f80f4,!![]);}catch(_0x5d9c97){return BPromise[_0x42c9('0x30')](_0x5d9c97);}return _0x3814dc[_0x42c9('0x31')]();};}function saveUpdates(_0x588744,_0x142feb){return function(_0x28180c){if(_0x28180c){return _0x28180c[_0x42c9('0x32')](_0x588744)[_0x42c9('0x1d')](function(_0x5d254d){return _0x5d254d;});}return null;};}function removeEntity(_0x428200,_0x578d37){return function(_0x44ee80){if(_0x44ee80){return _0x44ee80['destroy']()[_0x42c9('0x1d')](function(){_0x428200['status'](0xcc)[_0x42c9('0x29')]();});}};}function handleEntityNotFound(_0x2bd3d1,_0x4c054f){return function(_0x499b93){if(!_0x499b93){_0x2bd3d1[_0x42c9('0x27')](0x194);}return _0x499b93;};}function handleError(_0x42cea7,_0x183c1b){_0x183c1b=_0x183c1b||0x1f4;return function(_0x43cf4d){logger[_0x42c9('0x24')](_0x43cf4d[_0x42c9('0x33')]);if(_0x43cf4d[_0x42c9('0x34')]){delete _0x43cf4d[_0x42c9('0x34')];}_0x42cea7[_0x42c9('0x28')](_0x183c1b)[_0x42c9('0x35')](_0x43cf4d);};}exports['index']=function(_0x3869f0,_0x3cc003){var _0x2cf7b6={},_0x19dbdc={},_0x1b823d={'count':0x0,'rows':[]};var _0x48049e=_[_0x42c9('0x36')](db[_0x42c9('0x37')][_0x42c9('0x38')],function(_0x1d2d8f){return{'name':_0x1d2d8f[_0x42c9('0x39')],'type':_0x1d2d8f[_0x42c9('0x3a')][_0x42c9('0x3b')]};});_0x19dbdc['model']=_[_0x42c9('0x36')](_0x48049e,_0x42c9('0x34'));_0x19dbdc[_0x42c9('0x3c')]=_['keys'](_0x3869f0[_0x42c9('0x3c')]);_0x19dbdc[_0x42c9('0x3d')]=_[_0x42c9('0x3e')](_0x19dbdc[_0x42c9('0x3f')],_0x19dbdc[_0x42c9('0x3c')]);_0x2cf7b6['attributes']=_[_0x42c9('0x3e')](_0x19dbdc[_0x42c9('0x3f')],qs['fields'](_0x3869f0[_0x42c9('0x3c')][_0x42c9('0x40')]));_0x2cf7b6[_0x42c9('0x41')]=_0x2cf7b6['attributes'][_0x42c9('0x42')]?_0x2cf7b6['attributes']:_0x19dbdc[_0x42c9('0x3f')];if(!_0x3869f0['query'][_0x42c9('0x43')]('nolimit')){_0x2cf7b6[_0x42c9('0x2b')]=qs[_0x42c9('0x2b')](_0x3869f0[_0x42c9('0x3c')][_0x42c9('0x2b')]);_0x2cf7b6[_0x42c9('0x44')]=qs[_0x42c9('0x44')](_0x3869f0[_0x42c9('0x3c')]['offset']);}_0x2cf7b6[_0x42c9('0x45')]=qs[_0x42c9('0x46')](_0x3869f0[_0x42c9('0x3c')][_0x42c9('0x46')]);_0x2cf7b6[_0x42c9('0x47')]=qs[_0x42c9('0x3d')](_[_0x42c9('0x48')](_0x3869f0[_0x42c9('0x3c')],_0x19dbdc[_0x42c9('0x3d')]));if(_0x3869f0[_0x42c9('0x3c')][_0x42c9('0x49')]){_0x2cf7b6[_0x42c9('0x47')]=_[_0x42c9('0x4a')](_0x2cf7b6[_0x42c9('0x47')],{'$or':_[_0x42c9('0x36')](_0x48049e,function(_0x32031b){if(_0x32031b[_0x42c9('0x3a')]!=='VIRTUAL'){var _0x4fdf5e={};_0x4fdf5e[_0x32031b[_0x42c9('0x34')]]={'$like':'%'+_0x3869f0[_0x42c9('0x3c')]['filter']+'%'};return _0x4fdf5e;}})});}_0x2cf7b6=_[_0x42c9('0x4a')]({},_0x2cf7b6,_0x3869f0[_0x42c9('0x4b')]);var _0x2f9f9f={'where':_0x2cf7b6[_0x42c9('0x47')]};return db[_0x42c9('0x37')][_0x42c9('0x2a')](_0x2f9f9f)[_0x42c9('0x1d')](function(_0x47405c){_0x1b823d[_0x42c9('0x2a')]=_0x47405c;if(_0x3869f0[_0x42c9('0x3c')][_0x42c9('0x4c')]){_0x2cf7b6[_0x42c9('0x4d')]=[{'all':!![]}];}return db[_0x42c9('0x37')][_0x42c9('0x4e')](_0x2cf7b6);})[_0x42c9('0x1d')](function(_0x4a2152){_0x1b823d[_0x42c9('0x4f')]=_0x4a2152;return _0x1b823d;})[_0x42c9('0x1d')](respondWithFilteredResult(_0x3cc003,_0x2cf7b6))[_0x42c9('0x26')](handleError(_0x3cc003,null));};exports['show']=function(_0x56c8a5,_0x20aafc){var _0x2ff17d={'raw':![],'where':{'id':_0x56c8a5[_0x42c9('0x50')]['id']}},_0x17f3d1={};_0x17f3d1[_0x42c9('0x3f')]=_[_0x42c9('0x51')](db[_0x42c9('0x37')][_0x42c9('0x38')]);_0x17f3d1[_0x42c9('0x3c')]=_['keys'](_0x56c8a5['query']);_0x17f3d1[_0x42c9('0x3d')]=_[_0x42c9('0x3e')](_0x17f3d1['model'],_0x17f3d1[_0x42c9('0x3c')]);_0x2ff17d[_0x42c9('0x41')]=_['intersection'](_0x17f3d1['model'],qs[_0x42c9('0x40')](_0x56c8a5[_0x42c9('0x3c')][_0x42c9('0x40')]));_0x2ff17d[_0x42c9('0x41')]=_0x2ff17d[_0x42c9('0x41')][_0x42c9('0x42')]?_0x2ff17d[_0x42c9('0x41')]:_0x17f3d1['model'];if(_0x56c8a5[_0x42c9('0x3c')][_0x42c9('0x4c')]){_0x2ff17d[_0x42c9('0x4d')]=[{'all':!![]}];}_0x2ff17d=_['merge']({},_0x2ff17d,_0x56c8a5[_0x42c9('0x4b')]);return db[_0x42c9('0x37')][_0x42c9('0x52')](_0x2ff17d)[_0x42c9('0x1d')](handleEntityNotFound(_0x20aafc,null))['then'](respondWithResult(_0x20aafc,null))[_0x42c9('0x26')](handleError(_0x20aafc,null));};exports[_0x42c9('0x53')]=function(_0x47ac56,_0x4767db){return db['FreshdeskConfiguration'][_0x42c9('0x53')](_0x47ac56['body'],{})[_0x42c9('0x1d')](respondWithResult(_0x4767db,0xc9))['catch'](handleError(_0x4767db,null));};exports[_0x42c9('0x32')]=function(_0x3237dd,_0x58cca0){if(_0x3237dd['body']['id']){delete _0x3237dd[_0x42c9('0x54')]['id'];}return db[_0x42c9('0x37')][_0x42c9('0x52')]({'where':{'id':_0x3237dd[_0x42c9('0x50')]['id']}})[_0x42c9('0x1d')](handleEntityNotFound(_0x58cca0,null))['then'](saveUpdates(_0x3237dd[_0x42c9('0x54')],null))[_0x42c9('0x1d')](respondWithResult(_0x58cca0,null))[_0x42c9('0x26')](handleError(_0x58cca0,null));};exports['destroy']=function(_0x1f9114,_0x371607){return db[_0x42c9('0x37')]['find']({'where':{'id':_0x1f9114[_0x42c9('0x50')]['id']}})[_0x42c9('0x1d')](handleEntityNotFound(_0x371607,null))[_0x42c9('0x1d')](removeEntity(_0x371607,null))[_0x42c9('0x26')](handleError(_0x371607,null));};exports[_0x42c9('0x55')]=function(_0x498796,_0x10e0c7,_0x1820c6){var _0x4a86ba={};var _0x3b7e88={};var _0x2c65af;var _0x4718a4;return db[_0x42c9('0x37')]['findOne']({'where':{'id':_0x498796[_0x42c9('0x50')]['id']}})[_0x42c9('0x1d')](handleEntityNotFound(_0x10e0c7,null))['then'](function(_0x19b029){if(_0x19b029){_0x2c65af=_0x19b029;_0x3b7e88[_0x42c9('0x3f')]=_[_0x42c9('0x51')](db[_0x42c9('0x56')][_0x42c9('0x38')]);_0x3b7e88[_0x42c9('0x3c')]=_[_0x42c9('0x51')](_0x498796['query']);_0x3b7e88['filters']=_[_0x42c9('0x3e')](_0x3b7e88[_0x42c9('0x3f')],_0x3b7e88[_0x42c9('0x3c')]);_0x4a86ba[_0x42c9('0x41')]=_[_0x42c9('0x3e')](_0x3b7e88['model'],qs[_0x42c9('0x40')](_0x498796[_0x42c9('0x3c')]['fields']));_0x4a86ba[_0x42c9('0x41')]=_0x4a86ba[_0x42c9('0x41')][_0x42c9('0x42')]?_0x4a86ba[_0x42c9('0x41')]:_0x3b7e88[_0x42c9('0x3f')];_0x4a86ba[_0x42c9('0x45')]=qs[_0x42c9('0x46')](_0x498796[_0x42c9('0x3c')]['sort']);_0x4a86ba[_0x42c9('0x47')]=qs['filters'](_[_0x42c9('0x48')](_0x498796[_0x42c9('0x3c')],_0x3b7e88[_0x42c9('0x3d')]));if(_0x498796[_0x42c9('0x3c')][_0x42c9('0x49')]){_0x4a86ba[_0x42c9('0x47')]=_['merge'](_0x4a86ba['where'],{'$or':_[_0x42c9('0x36')](_0x4a86ba[_0x42c9('0x41')],function(_0x3017a1){var _0x138e7a={};_0x138e7a[_0x3017a1]={'$like':'%'+_0x498796[_0x42c9('0x3c')][_0x42c9('0x49')]+'%'};return _0x138e7a;})});}_0x4a86ba=_[_0x42c9('0x4a')]({},_0x4a86ba,_0x498796[_0x42c9('0x4b')]);return _0x2c65af[_0x42c9('0x55')](_0x4a86ba);}})[_0x42c9('0x1d')](function(_0x4f0c1c){if(_0x4f0c1c){_0x4718a4=_0x4f0c1c[_0x42c9('0x42')];if(!_0x498796['query']['hasOwnProperty'](_0x42c9('0x57'))){_0x4a86ba['limit']=qs[_0x42c9('0x2b')](_0x498796['query']['limit']);_0x4a86ba[_0x42c9('0x44')]=qs[_0x42c9('0x44')](_0x498796['query'][_0x42c9('0x44')]);}return _0x2c65af['getFields'](_0x4a86ba);}})[_0x42c9('0x1d')](function(_0x50125b){if(_0x50125b){return _0x50125b?{'count':_0x4718a4,'rows':_0x50125b}:null;}})['then'](respondWithResult(_0x10e0c7,null))[_0x42c9('0x26')](handleError(_0x10e0c7,null));};exports[_0x42c9('0x58')]=function(_0x38b19f,_0x17ddb5,_0x5acb05){var _0x40c622={};var _0x4d2edb={};var _0x4fe8d9;var _0x4760a6;return db[_0x42c9('0x37')]['findOne']({'where':{'id':_0x38b19f[_0x42c9('0x50')]['id']}})['then'](handleEntityNotFound(_0x17ddb5,null))['then'](function(_0x351bd0){if(_0x351bd0){_0x4fe8d9=_0x351bd0;_0x4d2edb[_0x42c9('0x3f')]=_[_0x42c9('0x51')](db[_0x42c9('0x56')][_0x42c9('0x38')]);_0x4d2edb[_0x42c9('0x3c')]=_[_0x42c9('0x51')](_0x38b19f[_0x42c9('0x3c')]);_0x4d2edb[_0x42c9('0x3d')]=_[_0x42c9('0x3e')](_0x4d2edb['model'],_0x4d2edb[_0x42c9('0x3c')]);_0x40c622[_0x42c9('0x41')]=_[_0x42c9('0x3e')](_0x4d2edb['model'],qs[_0x42c9('0x40')](_0x38b19f[_0x42c9('0x3c')][_0x42c9('0x40')]));_0x40c622['attributes']=_0x40c622[_0x42c9('0x41')][_0x42c9('0x42')]?_0x40c622[_0x42c9('0x41')]:_0x4d2edb[_0x42c9('0x3f')];_0x40c622[_0x42c9('0x45')]=qs[_0x42c9('0x46')](_0x38b19f[_0x42c9('0x3c')][_0x42c9('0x46')]);_0x40c622[_0x42c9('0x47')]=qs[_0x42c9('0x3d')](_['pick'](_0x38b19f['query'],_0x4d2edb['filters']));if(_0x38b19f['query'][_0x42c9('0x49')]){_0x40c622[_0x42c9('0x47')]=_[_0x42c9('0x4a')](_0x40c622[_0x42c9('0x47')],{'$or':_[_0x42c9('0x36')](_0x40c622[_0x42c9('0x41')],function(_0x2bb286){var _0x123d40={};_0x123d40[_0x2bb286]={'$like':'%'+_0x38b19f[_0x42c9('0x3c')]['filter']+'%'};return _0x123d40;})});}_0x40c622=_['merge']({},_0x40c622,_0x38b19f[_0x42c9('0x4b')]);return _0x4fe8d9[_0x42c9('0x58')](_0x40c622);}})[_0x42c9('0x1d')](function(_0x476553){if(_0x476553){_0x4760a6=_0x476553[_0x42c9('0x42')];if(!_0x38b19f[_0x42c9('0x3c')][_0x42c9('0x43')]('nolimit')){_0x40c622[_0x42c9('0x2b')]=qs[_0x42c9('0x2b')](_0x38b19f[_0x42c9('0x3c')][_0x42c9('0x2b')]);_0x40c622['offset']=qs[_0x42c9('0x44')](_0x38b19f['query'][_0x42c9('0x44')]);}return _0x4fe8d9[_0x42c9('0x58')](_0x40c622);}})[_0x42c9('0x1d')](function(_0x41420b){if(_0x41420b){return _0x41420b?{'count':_0x4760a6,'rows':_0x41420b}:null;}})[_0x42c9('0x1d')](respondWithResult(_0x17ddb5,null))['catch'](handleError(_0x17ddb5,null));};exports['getDescriptions']=function(_0x2ec6a5,_0x4a8843,_0x301fe4){var _0x1423cf={};var _0xcc3f58={};var _0x1c53cb;var _0x5d08ce;return db[_0x42c9('0x37')]['findOne']({'where':{'id':_0x2ec6a5[_0x42c9('0x50')]['id']}})[_0x42c9('0x1d')](handleEntityNotFound(_0x4a8843,null))[_0x42c9('0x1d')](function(_0x3085aa){if(_0x3085aa){_0x1c53cb=_0x3085aa;_0xcc3f58['model']=_[_0x42c9('0x51')](db[_0x42c9('0x56')][_0x42c9('0x38')]);_0xcc3f58[_0x42c9('0x3c')]=_[_0x42c9('0x51')](_0x2ec6a5[_0x42c9('0x3c')]);_0xcc3f58[_0x42c9('0x3d')]=_['intersection'](_0xcc3f58[_0x42c9('0x3f')],_0xcc3f58[_0x42c9('0x3c')]);_0x1423cf['attributes']=_['intersection'](_0xcc3f58[_0x42c9('0x3f')],qs['fields'](_0x2ec6a5['query']['fields']));_0x1423cf[_0x42c9('0x41')]=_0x1423cf[_0x42c9('0x41')][_0x42c9('0x42')]?_0x1423cf[_0x42c9('0x41')]:_0xcc3f58[_0x42c9('0x3f')];_0x1423cf['order']=qs[_0x42c9('0x46')](_0x2ec6a5[_0x42c9('0x3c')][_0x42c9('0x46')]);_0x1423cf['where']=qs[_0x42c9('0x3d')](_['pick'](_0x2ec6a5['query'],_0xcc3f58[_0x42c9('0x3d')]));if(_0x2ec6a5['query'][_0x42c9('0x49')]){_0x1423cf[_0x42c9('0x47')]=_['merge'](_0x1423cf[_0x42c9('0x47')],{'$or':_['map'](_0x1423cf[_0x42c9('0x41')],function(_0x1b8e9a){var _0x3c5245={};_0x3c5245[_0x1b8e9a]={'$like':'%'+_0x2ec6a5[_0x42c9('0x3c')][_0x42c9('0x49')]+'%'};return _0x3c5245;})});}_0x1423cf=_[_0x42c9('0x4a')]({},_0x1423cf,_0x2ec6a5[_0x42c9('0x4b')]);return _0x1c53cb[_0x42c9('0x59')](_0x1423cf);}})['then'](function(_0x73079e){if(_0x73079e){_0x5d08ce=_0x73079e[_0x42c9('0x42')];if(!_0x2ec6a5['query']['hasOwnProperty'](_0x42c9('0x57'))){_0x1423cf[_0x42c9('0x2b')]=qs[_0x42c9('0x2b')](_0x2ec6a5[_0x42c9('0x3c')]['limit']);_0x1423cf[_0x42c9('0x44')]=qs[_0x42c9('0x44')](_0x2ec6a5['query'][_0x42c9('0x44')]);}return _0x1c53cb[_0x42c9('0x59')](_0x1423cf);}})[_0x42c9('0x1d')](function(_0x2d68d1){if(_0x2d68d1){return _0x2d68d1?{'count':_0x5d08ce,'rows':_0x2d68d1}:null;}})[_0x42c9('0x1d')](respondWithResult(_0x4a8843,null))[_0x42c9('0x26')](handleError(_0x4a8843,null));};exports[_0x42c9('0x5a')]=function(_0x9022d3,_0x1a711c,_0x5092d1){var _0x5807bf={};var _0x1ba390={};var _0x450fbd;var _0x530028;return db[_0x42c9('0x37')][_0x42c9('0x5b')]({'where':{'id':_0x9022d3[_0x42c9('0x50')]['id']}})['then'](handleEntityNotFound(_0x1a711c,null))['then'](function(_0x318fa3){if(_0x318fa3){_0x450fbd=_0x318fa3;_0x1ba390[_0x42c9('0x3f')]=_[_0x42c9('0x51')](db[_0x42c9('0x5c')][_0x42c9('0x38')]);_0x1ba390[_0x42c9('0x3c')]=_[_0x42c9('0x51')](_0x9022d3[_0x42c9('0x3c')]);_0x1ba390[_0x42c9('0x3d')]=_[_0x42c9('0x3e')](_0x1ba390[_0x42c9('0x3f')],_0x1ba390[_0x42c9('0x3c')]);_0x5807bf['attributes']=_[_0x42c9('0x3e')](_0x1ba390[_0x42c9('0x3f')],qs[_0x42c9('0x40')](_0x9022d3[_0x42c9('0x3c')][_0x42c9('0x40')]));_0x5807bf[_0x42c9('0x41')]=_0x5807bf[_0x42c9('0x41')]['length']?_0x5807bf[_0x42c9('0x41')]:_0x1ba390[_0x42c9('0x3f')];_0x5807bf['order']=qs['sort'](_0x9022d3[_0x42c9('0x3c')][_0x42c9('0x46')]);_0x5807bf[_0x42c9('0x47')]=qs[_0x42c9('0x3d')](_[_0x42c9('0x48')](_0x9022d3[_0x42c9('0x3c')],_0x1ba390[_0x42c9('0x3d')]));if(_0x9022d3[_0x42c9('0x3c')][_0x42c9('0x49')]){_0x5807bf['where']=_['merge'](_0x5807bf['where'],{'$or':_[_0x42c9('0x36')](_0x5807bf[_0x42c9('0x41')],function(_0x1493c0){var _0x532e47={};_0x532e47[_0x1493c0]={'$like':'%'+_0x9022d3[_0x42c9('0x3c')]['filter']+'%'};return _0x532e47;})});}_0x5807bf=_[_0x42c9('0x4a')]({},_0x5807bf,_0x9022d3[_0x42c9('0x4b')]);return _0x450fbd[_0x42c9('0x5a')](_0x5807bf);}})['then'](function(_0x560c2f){if(_0x560c2f){_0x530028=_0x560c2f[_0x42c9('0x42')];if(!_0x9022d3[_0x42c9('0x3c')][_0x42c9('0x43')](_0x42c9('0x57'))){_0x5807bf['limit']=qs[_0x42c9('0x2b')](_0x9022d3['query'][_0x42c9('0x2b')]);_0x5807bf['offset']=qs[_0x42c9('0x44')](_0x9022d3['query'][_0x42c9('0x44')]);}return _0x450fbd['getTags'](_0x5807bf);}})[_0x42c9('0x1d')](function(_0x4884fa){if(_0x4884fa){return _0x4884fa?{'count':_0x530028,'rows':_0x4884fa}:null;}})['then'](respondWithResult(_0x1a711c,null))[_0x42c9('0x26')](handleError(_0x1a711c,null));};exports['setTags']=function(_0x170e9c,_0x497a25,_0x218f77){if(_0x170e9c[_0x42c9('0x54')]['id']){delete _0x170e9c[_0x42c9('0x54')]['id'];}return db[_0x42c9('0x37')][_0x42c9('0x5b')]({'where':{'id':_0x170e9c[_0x42c9('0x50')]['id']}})[_0x42c9('0x1d')](handleEntityNotFound(_0x497a25,null))[_0x42c9('0x1d')](function(_0x104983){if(_0x104983){return _0x104983[_0x42c9('0x5d')](_0x170e9c[_0x42c9('0x54')][_0x42c9('0x5e')]||[]);}return null;})['then'](respondWithResult(_0x497a25,null))['catch'](handleError(_0x497a25,null));}; \ No newline at end of file +var _0xcdb9=['key','query','filters','intersection','model','attributes','fields','length','hasOwnProperty','order','sort','where','filter','merge','VIRTUAL','options','include','rows','show','params','keys','rawAttributes','find','catch','create','body','findOne','FreshdeskField','pick','nolimit','getFields','getSubjects','getDescriptions','getTags','Tag','setTags','ids','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','to-csv','lodash','crypto','jsforce','desk.js','querystring','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/utils','../../config/environment','../../mysqldb','jayson/promise','client','http','test','Sequelize','ValidationError','request','info','FreshdeskConfiguration,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','status','json','count','offset','limit','set','Content-Range','reject','save','update','then','destroy','sendStatus','stack','name','send','map','FreshdeskConfiguration','fieldName'];(function(_0x18d67d,_0xb823f){var _0x3b8d06=function(_0x2215f8){while(--_0x2215f8){_0x18d67d['push'](_0x18d67d['shift']());}};_0x3b8d06(++_0xb823f);}(_0xcdb9,0x82));var _0x9cdb=function(_0x2b6b13,_0x3f075a){_0x2b6b13=_0x2b6b13-0x0;var _0x360069=_0xcdb9[_0x2b6b13];return _0x360069;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x9cdb('0x0'));var rimraf=require(_0x9cdb('0x1'));var zipdir=require(_0x9cdb('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x9cdb('0x3'));var moment=require(_0x9cdb('0x4'));var BPromise=require(_0x9cdb('0x5'));var Mustache=require(_0x9cdb('0x6'));var util=require(_0x9cdb('0x7'));var path=require('path');var sox=require('sox');var csv=require(_0x9cdb('0x8'));var ejs=require('ejs');var fs=require('fs');var _=require(_0x9cdb('0x9'));var squel=require('squel');var crypto=require(_0x9cdb('0xa'));var jsforce=require(_0x9cdb('0xb'));var deskjs=require(_0x9cdb('0xc'));var toCsv=require(_0x9cdb('0x8'));var querystring=require(_0x9cdb('0xd'));var Papa=require('papaparse');var Redis=require(_0x9cdb('0xe'));var authService=require('../../components/auth/service');var qs=require(_0x9cdb('0xf'));var as=require(_0x9cdb('0x10'));var hardwareService=require(_0x9cdb('0x11'));var logger=require('../../config/logger')('api');var utils=require(_0x9cdb('0x12'));var config=require(_0x9cdb('0x13'));var db=require(_0x9cdb('0x14'))['db'];var jayson=require(_0x9cdb('0x15'));var client=jayson[_0x9cdb('0x16')][_0x9cdb('0x17')]({'port':0x232a});function checkPasswordPattern(_0x1ff96c,_0x55215f,_0x147e76){if(_0x147e76){var _0x4a25cf=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x4a25cf[_0x9cdb('0x18')](_0x55215f)){return _0x1ff96c;}else{throw new db[(_0x9cdb('0x19'))][(_0x9cdb('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 _0x1ff96c;}}function respondWithRpcPromise(_0x279fab,_0x11858c,_0x238144,_0x3f0c4e){return new BPromise(function(_0x5d5579,_0x2f86b3){var _0x4cbc7d=_0x3f0c4e||client;return _0x4cbc7d[_0x9cdb('0x1b')](_0x279fab,_0x238144)['then'](function(_0x3ed04b){logger[_0x9cdb('0x1c')](_0x9cdb('0x1d'),_0x11858c,_0x9cdb('0x1e'));logger[_0x9cdb('0x1f')]('FreshdeskConfiguration,\x20%s,\x20%s,\x20%s',_0x11858c,_0x9cdb('0x1e'),JSON[_0x9cdb('0x20')](_0x3ed04b));if(_0x3ed04b[_0x9cdb('0x21')]){if(_0x3ed04b[_0x9cdb('0x21')][_0x9cdb('0x22')]===0x1f4){logger[_0x9cdb('0x21')](_0x9cdb('0x1d'),_0x11858c,_0x3ed04b['error'][_0x9cdb('0x23')]);return _0x2f86b3(_0x3ed04b[_0x9cdb('0x21')][_0x9cdb('0x23')]);}logger[_0x9cdb('0x21')](_0x9cdb('0x1d'),_0x11858c,_0x3ed04b[_0x9cdb('0x21')]['message']);return _0x5d5579(_0x3ed04b['error'][_0x9cdb('0x23')]);}else{logger[_0x9cdb('0x1c')]('FreshdeskConfiguration,\x20%s,\x20%s',_0x11858c,_0x9cdb('0x1e'));_0x5d5579(_0x3ed04b[_0x9cdb('0x24')]['message']);}})['catch'](function(_0x35b056){logger[_0x9cdb('0x21')]('FreshdeskConfiguration,\x20%s,\x20%s',_0x11858c,_0x35b056);_0x2f86b3(_0x35b056);});});}function respondWithStatusCode(_0x29170c,_0xda496a){_0xda496a=_0xda496a||0xcc;return function(_0x31ec0c){if(_0x31ec0c){return _0x29170c['sendStatus'](_0xda496a);}return _0x29170c['status'](_0xda496a)['end']();};}function respondWithResult(_0x4a8e8c,_0x614e1e){_0x614e1e=_0x614e1e||0xc8;return function(_0x443da8){if(_0x443da8){return _0x4a8e8c[_0x9cdb('0x25')](_0x614e1e)[_0x9cdb('0x26')](_0x443da8);}};}function respondWithFilteredResult(_0x5c530e,_0x4345f3){return function(_0x37d66e){if(_0x37d66e){var _0x47a21d=_0x37d66e[_0x9cdb('0x27')],_0x317685=_0x4345f3[_0x9cdb('0x28')],_0x3392c5=_0x4345f3[_0x9cdb('0x28')]+_0x4345f3[_0x9cdb('0x29')],_0xb1b9f8;if(_0x3392c5>=_0x47a21d){_0x3392c5=_0x47a21d;_0xb1b9f8=0xc8;}else{_0xb1b9f8=0xce;}_0x5c530e[_0x9cdb('0x25')](_0xb1b9f8);return _0x5c530e[_0x9cdb('0x2a')](_0x9cdb('0x2b'),_0x317685+'-'+_0x3392c5+'/'+_0x47a21d)[_0x9cdb('0x26')](_0x37d66e);}return null;};}function patchUpdates(_0x434617){return function(_0x253e6e){try{jsonpatch['apply'](_0x253e6e,_0x434617,!![]);}catch(_0xf63f2b){return BPromise[_0x9cdb('0x2c')](_0xf63f2b);}return _0x253e6e[_0x9cdb('0x2d')]();};}function saveUpdates(_0x3b08d7,_0x1387bb){return function(_0x1523fd){if(_0x1523fd){return _0x1523fd[_0x9cdb('0x2e')](_0x3b08d7)[_0x9cdb('0x2f')](function(_0x382401){return _0x382401;});}return null;};}function removeEntity(_0x1993b8,_0x2145b4){return function(_0x44fa53){if(_0x44fa53){return _0x44fa53[_0x9cdb('0x30')]()[_0x9cdb('0x2f')](function(){_0x1993b8[_0x9cdb('0x25')](0xcc)['end']();});}};}function handleEntityNotFound(_0x2fc26f,_0x356cd4){return function(_0x37cdda){if(!_0x37cdda){_0x2fc26f[_0x9cdb('0x31')](0x194);}return _0x37cdda;};}function handleError(_0x5d2b16,_0x3b2833){_0x3b2833=_0x3b2833||0x1f4;return function(_0x3bd423){logger[_0x9cdb('0x21')](_0x3bd423[_0x9cdb('0x32')]);if(_0x3bd423[_0x9cdb('0x33')]){delete _0x3bd423['name'];}_0x5d2b16['status'](_0x3b2833)[_0x9cdb('0x34')](_0x3bd423);};}exports['index']=function(_0x4ca545,_0x6c94b8){var _0x5d7239={},_0x50a2e2={},_0x4c2fcd={'count':0x0,'rows':[]};var _0x2f9c8e=_[_0x9cdb('0x35')](db[_0x9cdb('0x36')]['rawAttributes'],function(_0x2e8af0){return{'name':_0x2e8af0[_0x9cdb('0x37')],'type':_0x2e8af0['type'][_0x9cdb('0x38')]};});_0x50a2e2['model']=_[_0x9cdb('0x35')](_0x2f9c8e,_0x9cdb('0x33'));_0x50a2e2['query']=_['keys'](_0x4ca545[_0x9cdb('0x39')]);_0x50a2e2[_0x9cdb('0x3a')]=_[_0x9cdb('0x3b')](_0x50a2e2[_0x9cdb('0x3c')],_0x50a2e2[_0x9cdb('0x39')]);_0x5d7239[_0x9cdb('0x3d')]=_[_0x9cdb('0x3b')](_0x50a2e2[_0x9cdb('0x3c')],qs[_0x9cdb('0x3e')](_0x4ca545[_0x9cdb('0x39')][_0x9cdb('0x3e')]));_0x5d7239[_0x9cdb('0x3d')]=_0x5d7239[_0x9cdb('0x3d')][_0x9cdb('0x3f')]?_0x5d7239['attributes']:_0x50a2e2['model'];if(!_0x4ca545[_0x9cdb('0x39')][_0x9cdb('0x40')]('nolimit')){_0x5d7239[_0x9cdb('0x29')]=qs['limit'](_0x4ca545[_0x9cdb('0x39')][_0x9cdb('0x29')]);_0x5d7239[_0x9cdb('0x28')]=qs['offset'](_0x4ca545['query'][_0x9cdb('0x28')]);}_0x5d7239[_0x9cdb('0x41')]=qs[_0x9cdb('0x42')](_0x4ca545['query'][_0x9cdb('0x42')]);_0x5d7239[_0x9cdb('0x43')]=qs['filters'](_['pick'](_0x4ca545[_0x9cdb('0x39')],_0x50a2e2[_0x9cdb('0x3a')]));if(_0x4ca545[_0x9cdb('0x39')][_0x9cdb('0x44')]){_0x5d7239['where']=_[_0x9cdb('0x45')](_0x5d7239[_0x9cdb('0x43')],{'$or':_[_0x9cdb('0x35')](_0x2f9c8e,function(_0x381319){if(_0x381319['type']!==_0x9cdb('0x46')){var _0x136efe={};_0x136efe[_0x381319[_0x9cdb('0x33')]]={'$like':'%'+_0x4ca545[_0x9cdb('0x39')][_0x9cdb('0x44')]+'%'};return _0x136efe;}})});}_0x5d7239=_[_0x9cdb('0x45')]({},_0x5d7239,_0x4ca545[_0x9cdb('0x47')]);var _0x46f603={'where':_0x5d7239[_0x9cdb('0x43')]};return db[_0x9cdb('0x36')][_0x9cdb('0x27')](_0x46f603)[_0x9cdb('0x2f')](function(_0x361df6){_0x4c2fcd[_0x9cdb('0x27')]=_0x361df6;if(_0x4ca545[_0x9cdb('0x39')]['includeAll']){_0x5d7239[_0x9cdb('0x48')]=[{'all':!![]}];}return db['FreshdeskConfiguration']['findAll'](_0x5d7239);})['then'](function(_0x537145){_0x4c2fcd[_0x9cdb('0x49')]=_0x537145;return _0x4c2fcd;})['then'](respondWithFilteredResult(_0x6c94b8,_0x5d7239))['catch'](handleError(_0x6c94b8,null));};exports[_0x9cdb('0x4a')]=function(_0x4e74fb,_0x4bd505){var _0x5d4fc4={'raw':![],'where':{'id':_0x4e74fb[_0x9cdb('0x4b')]['id']}},_0xb44876={};_0xb44876[_0x9cdb('0x3c')]=_[_0x9cdb('0x4c')](db[_0x9cdb('0x36')][_0x9cdb('0x4d')]);_0xb44876[_0x9cdb('0x39')]=_[_0x9cdb('0x4c')](_0x4e74fb['query']);_0xb44876[_0x9cdb('0x3a')]=_[_0x9cdb('0x3b')](_0xb44876['model'],_0xb44876['query']);_0x5d4fc4[_0x9cdb('0x3d')]=_[_0x9cdb('0x3b')](_0xb44876[_0x9cdb('0x3c')],qs[_0x9cdb('0x3e')](_0x4e74fb[_0x9cdb('0x39')][_0x9cdb('0x3e')]));_0x5d4fc4[_0x9cdb('0x3d')]=_0x5d4fc4[_0x9cdb('0x3d')][_0x9cdb('0x3f')]?_0x5d4fc4[_0x9cdb('0x3d')]:_0xb44876[_0x9cdb('0x3c')];if(_0x4e74fb[_0x9cdb('0x39')]['includeAll']){_0x5d4fc4[_0x9cdb('0x48')]=[{'all':!![]}];}_0x5d4fc4=_[_0x9cdb('0x45')]({},_0x5d4fc4,_0x4e74fb['options']);return db[_0x9cdb('0x36')][_0x9cdb('0x4e')](_0x5d4fc4)[_0x9cdb('0x2f')](handleEntityNotFound(_0x4bd505,null))[_0x9cdb('0x2f')](respondWithResult(_0x4bd505,null))[_0x9cdb('0x4f')](handleError(_0x4bd505,null));};exports[_0x9cdb('0x50')]=function(_0x286b75,_0xe2e3f){return db[_0x9cdb('0x36')]['create'](_0x286b75[_0x9cdb('0x51')],{})[_0x9cdb('0x2f')](respondWithResult(_0xe2e3f,0xc9))[_0x9cdb('0x4f')](handleError(_0xe2e3f,null));};exports[_0x9cdb('0x2e')]=function(_0x1fb4f7,_0x5258ca){if(_0x1fb4f7[_0x9cdb('0x51')]['id']){delete _0x1fb4f7[_0x9cdb('0x51')]['id'];}return db[_0x9cdb('0x36')][_0x9cdb('0x4e')]({'where':{'id':_0x1fb4f7['params']['id']}})[_0x9cdb('0x2f')](handleEntityNotFound(_0x5258ca,null))['then'](saveUpdates(_0x1fb4f7[_0x9cdb('0x51')],null))[_0x9cdb('0x2f')](respondWithResult(_0x5258ca,null))[_0x9cdb('0x4f')](handleError(_0x5258ca,null));};exports['destroy']=function(_0x45c0d8,_0x507d1c){return db[_0x9cdb('0x36')]['find']({'where':{'id':_0x45c0d8[_0x9cdb('0x4b')]['id']}})['then'](handleEntityNotFound(_0x507d1c,null))[_0x9cdb('0x2f')](removeEntity(_0x507d1c,null))[_0x9cdb('0x4f')](handleError(_0x507d1c,null));};exports['getFields']=function(_0x140ad3,_0x491d50,_0x550364){var _0x1d6666={};var _0x358a32={};var _0x3a22e7;var _0x5a8e23;return db['FreshdeskConfiguration'][_0x9cdb('0x52')]({'where':{'id':_0x140ad3['params']['id']}})[_0x9cdb('0x2f')](handleEntityNotFound(_0x491d50,null))[_0x9cdb('0x2f')](function(_0x449726){if(_0x449726){_0x3a22e7=_0x449726;_0x358a32[_0x9cdb('0x3c')]=_[_0x9cdb('0x4c')](db[_0x9cdb('0x53')][_0x9cdb('0x4d')]);_0x358a32[_0x9cdb('0x39')]=_[_0x9cdb('0x4c')](_0x140ad3[_0x9cdb('0x39')]);_0x358a32[_0x9cdb('0x3a')]=_[_0x9cdb('0x3b')](_0x358a32[_0x9cdb('0x3c')],_0x358a32[_0x9cdb('0x39')]);_0x1d6666[_0x9cdb('0x3d')]=_[_0x9cdb('0x3b')](_0x358a32['model'],qs[_0x9cdb('0x3e')](_0x140ad3['query'][_0x9cdb('0x3e')]));_0x1d6666['attributes']=_0x1d6666[_0x9cdb('0x3d')]['length']?_0x1d6666[_0x9cdb('0x3d')]:_0x358a32['model'];_0x1d6666['order']=qs[_0x9cdb('0x42')](_0x140ad3[_0x9cdb('0x39')][_0x9cdb('0x42')]);_0x1d6666[_0x9cdb('0x43')]=qs[_0x9cdb('0x3a')](_[_0x9cdb('0x54')](_0x140ad3[_0x9cdb('0x39')],_0x358a32[_0x9cdb('0x3a')]));if(_0x140ad3[_0x9cdb('0x39')][_0x9cdb('0x44')]){_0x1d6666[_0x9cdb('0x43')]=_['merge'](_0x1d6666[_0x9cdb('0x43')],{'$or':_['map'](_0x1d6666['attributes'],function(_0x483e70){var _0x5aadd6={};_0x5aadd6[_0x483e70]={'$like':'%'+_0x140ad3[_0x9cdb('0x39')][_0x9cdb('0x44')]+'%'};return _0x5aadd6;})});}_0x1d6666=_[_0x9cdb('0x45')]({},_0x1d6666,_0x140ad3['options']);return _0x3a22e7['getFields'](_0x1d6666);}})[_0x9cdb('0x2f')](function(_0xebd5b8){if(_0xebd5b8){_0x5a8e23=_0xebd5b8[_0x9cdb('0x3f')];if(!_0x140ad3[_0x9cdb('0x39')][_0x9cdb('0x40')](_0x9cdb('0x55'))){_0x1d6666[_0x9cdb('0x29')]=qs[_0x9cdb('0x29')](_0x140ad3[_0x9cdb('0x39')]['limit']);_0x1d6666[_0x9cdb('0x28')]=qs[_0x9cdb('0x28')](_0x140ad3[_0x9cdb('0x39')][_0x9cdb('0x28')]);}return _0x3a22e7[_0x9cdb('0x56')](_0x1d6666);}})['then'](function(_0x2ef53a){if(_0x2ef53a){return _0x2ef53a?{'count':_0x5a8e23,'rows':_0x2ef53a}:null;}})[_0x9cdb('0x2f')](respondWithResult(_0x491d50,null))[_0x9cdb('0x4f')](handleError(_0x491d50,null));};exports[_0x9cdb('0x57')]=function(_0x557bd3,_0x48a331,_0x5945d4){var _0x32584b={};var _0x5718da={};var _0x54f88c;var _0x16a20d;return db[_0x9cdb('0x36')][_0x9cdb('0x52')]({'where':{'id':_0x557bd3['params']['id']}})[_0x9cdb('0x2f')](handleEntityNotFound(_0x48a331,null))[_0x9cdb('0x2f')](function(_0x5274f2){if(_0x5274f2){_0x54f88c=_0x5274f2;_0x5718da[_0x9cdb('0x3c')]=_['keys'](db[_0x9cdb('0x53')]['rawAttributes']);_0x5718da[_0x9cdb('0x39')]=_[_0x9cdb('0x4c')](_0x557bd3[_0x9cdb('0x39')]);_0x5718da[_0x9cdb('0x3a')]=_[_0x9cdb('0x3b')](_0x5718da['model'],_0x5718da[_0x9cdb('0x39')]);_0x32584b[_0x9cdb('0x3d')]=_[_0x9cdb('0x3b')](_0x5718da[_0x9cdb('0x3c')],qs[_0x9cdb('0x3e')](_0x557bd3['query']['fields']));_0x32584b[_0x9cdb('0x3d')]=_0x32584b[_0x9cdb('0x3d')]['length']?_0x32584b[_0x9cdb('0x3d')]:_0x5718da['model'];_0x32584b[_0x9cdb('0x41')]=qs[_0x9cdb('0x42')](_0x557bd3[_0x9cdb('0x39')][_0x9cdb('0x42')]);_0x32584b['where']=qs[_0x9cdb('0x3a')](_['pick'](_0x557bd3[_0x9cdb('0x39')],_0x5718da[_0x9cdb('0x3a')]));if(_0x557bd3[_0x9cdb('0x39')][_0x9cdb('0x44')]){_0x32584b[_0x9cdb('0x43')]=_['merge'](_0x32584b[_0x9cdb('0x43')],{'$or':_['map'](_0x32584b[_0x9cdb('0x3d')],function(_0x28528e){var _0x4325a8={};_0x4325a8[_0x28528e]={'$like':'%'+_0x557bd3['query'][_0x9cdb('0x44')]+'%'};return _0x4325a8;})});}_0x32584b=_[_0x9cdb('0x45')]({},_0x32584b,_0x557bd3[_0x9cdb('0x47')]);return _0x54f88c['getSubjects'](_0x32584b);}})['then'](function(_0x1ebd08){if(_0x1ebd08){_0x16a20d=_0x1ebd08['length'];if(!_0x557bd3[_0x9cdb('0x39')][_0x9cdb('0x40')](_0x9cdb('0x55'))){_0x32584b['limit']=qs['limit'](_0x557bd3[_0x9cdb('0x39')]['limit']);_0x32584b[_0x9cdb('0x28')]=qs[_0x9cdb('0x28')](_0x557bd3[_0x9cdb('0x39')]['offset']);}return _0x54f88c[_0x9cdb('0x57')](_0x32584b);}})[_0x9cdb('0x2f')](function(_0xe75073){if(_0xe75073){return _0xe75073?{'count':_0x16a20d,'rows':_0xe75073}:null;}})[_0x9cdb('0x2f')](respondWithResult(_0x48a331,null))[_0x9cdb('0x4f')](handleError(_0x48a331,null));};exports['getDescriptions']=function(_0x19a622,_0x4b583,_0xec947){var _0x553a71={};var _0x2d21be={};var _0x22119d;var _0x3f28f1;return db[_0x9cdb('0x36')]['findOne']({'where':{'id':_0x19a622['params']['id']}})['then'](handleEntityNotFound(_0x4b583,null))[_0x9cdb('0x2f')](function(_0x2edc98){if(_0x2edc98){_0x22119d=_0x2edc98;_0x2d21be[_0x9cdb('0x3c')]=_[_0x9cdb('0x4c')](db['FreshdeskField']['rawAttributes']);_0x2d21be[_0x9cdb('0x39')]=_[_0x9cdb('0x4c')](_0x19a622[_0x9cdb('0x39')]);_0x2d21be[_0x9cdb('0x3a')]=_['intersection'](_0x2d21be[_0x9cdb('0x3c')],_0x2d21be[_0x9cdb('0x39')]);_0x553a71[_0x9cdb('0x3d')]=_['intersection'](_0x2d21be[_0x9cdb('0x3c')],qs[_0x9cdb('0x3e')](_0x19a622[_0x9cdb('0x39')]['fields']));_0x553a71[_0x9cdb('0x3d')]=_0x553a71[_0x9cdb('0x3d')][_0x9cdb('0x3f')]?_0x553a71[_0x9cdb('0x3d')]:_0x2d21be[_0x9cdb('0x3c')];_0x553a71['order']=qs[_0x9cdb('0x42')](_0x19a622['query'][_0x9cdb('0x42')]);_0x553a71[_0x9cdb('0x43')]=qs[_0x9cdb('0x3a')](_[_0x9cdb('0x54')](_0x19a622[_0x9cdb('0x39')],_0x2d21be['filters']));if(_0x19a622['query']['filter']){_0x553a71[_0x9cdb('0x43')]=_[_0x9cdb('0x45')](_0x553a71[_0x9cdb('0x43')],{'$or':_[_0x9cdb('0x35')](_0x553a71['attributes'],function(_0x483913){var _0xb4bd49={};_0xb4bd49[_0x483913]={'$like':'%'+_0x19a622[_0x9cdb('0x39')][_0x9cdb('0x44')]+'%'};return _0xb4bd49;})});}_0x553a71=_[_0x9cdb('0x45')]({},_0x553a71,_0x19a622[_0x9cdb('0x47')]);return _0x22119d[_0x9cdb('0x58')](_0x553a71);}})[_0x9cdb('0x2f')](function(_0x5dd98e){if(_0x5dd98e){_0x3f28f1=_0x5dd98e[_0x9cdb('0x3f')];if(!_0x19a622[_0x9cdb('0x39')][_0x9cdb('0x40')]('nolimit')){_0x553a71['limit']=qs['limit'](_0x19a622[_0x9cdb('0x39')]['limit']);_0x553a71['offset']=qs[_0x9cdb('0x28')](_0x19a622['query'][_0x9cdb('0x28')]);}return _0x22119d[_0x9cdb('0x58')](_0x553a71);}})[_0x9cdb('0x2f')](function(_0x5e523e){if(_0x5e523e){return _0x5e523e?{'count':_0x3f28f1,'rows':_0x5e523e}:null;}})[_0x9cdb('0x2f')](respondWithResult(_0x4b583,null))['catch'](handleError(_0x4b583,null));};exports[_0x9cdb('0x59')]=function(_0x15469c,_0x30f2d0,_0x3d0350){var _0x191134={};var _0x447d1e={};var _0x2c05cc;var _0x116ca9;return db[_0x9cdb('0x36')]['findOne']({'where':{'id':_0x15469c['params']['id']}})[_0x9cdb('0x2f')](handleEntityNotFound(_0x30f2d0,null))['then'](function(_0x42decc){if(_0x42decc){_0x2c05cc=_0x42decc;_0x447d1e['model']=_[_0x9cdb('0x4c')](db[_0x9cdb('0x5a')][_0x9cdb('0x4d')]);_0x447d1e[_0x9cdb('0x39')]=_[_0x9cdb('0x4c')](_0x15469c[_0x9cdb('0x39')]);_0x447d1e[_0x9cdb('0x3a')]=_[_0x9cdb('0x3b')](_0x447d1e[_0x9cdb('0x3c')],_0x447d1e['query']);_0x191134[_0x9cdb('0x3d')]=_['intersection'](_0x447d1e[_0x9cdb('0x3c')],qs[_0x9cdb('0x3e')](_0x15469c[_0x9cdb('0x39')][_0x9cdb('0x3e')]));_0x191134['attributes']=_0x191134[_0x9cdb('0x3d')][_0x9cdb('0x3f')]?_0x191134[_0x9cdb('0x3d')]:_0x447d1e['model'];_0x191134[_0x9cdb('0x41')]=qs[_0x9cdb('0x42')](_0x15469c[_0x9cdb('0x39')][_0x9cdb('0x42')]);_0x191134['where']=qs[_0x9cdb('0x3a')](_[_0x9cdb('0x54')](_0x15469c[_0x9cdb('0x39')],_0x447d1e[_0x9cdb('0x3a')]));if(_0x15469c['query']['filter']){_0x191134[_0x9cdb('0x43')]=_[_0x9cdb('0x45')](_0x191134['where'],{'$or':_[_0x9cdb('0x35')](_0x191134['attributes'],function(_0x42527a){var _0x48d64c={};_0x48d64c[_0x42527a]={'$like':'%'+_0x15469c[_0x9cdb('0x39')][_0x9cdb('0x44')]+'%'};return _0x48d64c;})});}_0x191134=_[_0x9cdb('0x45')]({},_0x191134,_0x15469c['options']);return _0x2c05cc['getTags'](_0x191134);}})[_0x9cdb('0x2f')](function(_0x1f421d){if(_0x1f421d){_0x116ca9=_0x1f421d['length'];if(!_0x15469c[_0x9cdb('0x39')][_0x9cdb('0x40')](_0x9cdb('0x55'))){_0x191134[_0x9cdb('0x29')]=qs[_0x9cdb('0x29')](_0x15469c[_0x9cdb('0x39')][_0x9cdb('0x29')]);_0x191134[_0x9cdb('0x28')]=qs['offset'](_0x15469c[_0x9cdb('0x39')][_0x9cdb('0x28')]);}return _0x2c05cc[_0x9cdb('0x59')](_0x191134);}})[_0x9cdb('0x2f')](function(_0x40ced1){if(_0x40ced1){return _0x40ced1?{'count':_0x116ca9,'rows':_0x40ced1}:null;}})[_0x9cdb('0x2f')](respondWithResult(_0x30f2d0,null))[_0x9cdb('0x4f')](handleError(_0x30f2d0,null));};exports[_0x9cdb('0x5b')]=function(_0x5fbd76,_0x2871c5,_0x44fc1c){if(_0x5fbd76[_0x9cdb('0x51')]['id']){delete _0x5fbd76['body']['id'];}return db[_0x9cdb('0x36')][_0x9cdb('0x52')]({'where':{'id':_0x5fbd76[_0x9cdb('0x4b')]['id']}})[_0x9cdb('0x2f')](handleEntityNotFound(_0x2871c5,null))['then'](function(_0x3c76b0){if(_0x3c76b0){return _0x3c76b0[_0x9cdb('0x5b')](_0x5fbd76[_0x9cdb('0x51')][_0x9cdb('0x5c')]||[]);}return null;})[_0x9cdb('0x2f')](respondWithResult(_0x2871c5,null))[_0x9cdb('0x4f')](handleError(_0x2871c5,null));}; \ No newline at end of file diff --git a/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.model.js b/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.model.js index b277543..fc099e7 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 _0x7295=['bluebird','request-promise','rimraf','../../config/environment','./intFreshdeskConfiguration.attributes','exports','define','FreshdeskConfiguration','lodash','util','../../config/logger','moment'];(function(_0xf1dcd2,_0x3f0c34){var _0x2afa35=function(_0x160d03){while(--_0x160d03){_0xf1dcd2['push'](_0xf1dcd2['shift']());}};_0x2afa35(++_0x3f0c34);}(_0x7295,0x68));var _0x5729=function(_0x2d3134,_0x477c10){_0x2d3134=_0x2d3134-0x0;var _0x2dd03e=_0x7295[_0x2d3134];return _0x2dd03e;};'use strict';var _=require(_0x5729('0x0'));var util=require(_0x5729('0x1'));var logger=require(_0x5729('0x2'))('api');var moment=require(_0x5729('0x3'));var BPromise=require(_0x5729('0x4'));var rp=require(_0x5729('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x5729('0x6'));var config=require(_0x5729('0x7'));var attributes=require(_0x5729('0x8'));module[_0x5729('0x9')]=function(_0x3782eb,_0x19f3a9){return _0x3782eb[_0x5729('0xa')](_0x5729('0xb'),attributes,{'tableName':'int_freshdesk_configurations','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xb506=['util','../../config/logger','api','moment','bluebird','request-promise','rimraf','./intFreshdeskConfiguration.attributes','define','FreshdeskConfiguration','int_freshdesk_configurations'];(function(_0x3e9033,_0x35fb43){var _0x8666e3=function(_0x387204){while(--_0x387204){_0x3e9033['push'](_0x3e9033['shift']());}};_0x8666e3(++_0x35fb43);}(_0xb506,0xbb));var _0x6b50=function(_0x839578,_0x40cde9){_0x839578=_0x839578-0x0;var _0x4db4af=_0xb506[_0x839578];return _0x4db4af;};'use strict';var _=require('lodash');var util=require(_0x6b50('0x0'));var logger=require(_0x6b50('0x1'))(_0x6b50('0x2'));var moment=require(_0x6b50('0x3'));var BPromise=require(_0x6b50('0x4'));var rp=require(_0x6b50('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x6b50('0x6'));var config=require('../../config/environment');var attributes=require(_0x6b50('0x7'));module['exports']=function(_0x55a07f,_0x30963d){return _0x55a07f[_0x6b50('0x8')](_0x6b50('0x9'),attributes,{'tableName':_0x6b50('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 2974a9b..f5bdc14 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 _0x04b4=['then','info','FreshdeskConfiguration,\x20%s,\x20%s','request\x20sent','FreshdeskConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','util','moment','randomstring','ioredis','../../config/logger','rpc','../../config/environment','jayson/promise','client','http'];(function(_0x4ee72f,_0x16a445){var _0x4de662=function(_0x52bbbc){while(--_0x52bbbc){_0x4ee72f['push'](_0x4ee72f['shift']());}};_0x4de662(++_0x16a445);}(_0x04b4,0x82));var _0x404b=function(_0x2b07ac,_0x539395){_0x2b07ac=_0x2b07ac-0x0;var _0x449e82=_0x04b4[_0x2b07ac];return _0x449e82;};'use strict';var _=require('lodash');var util=require(_0x404b('0x0'));var moment=require(_0x404b('0x1'));var BPromise=require('bluebird');var rs=require(_0x404b('0x2'));var fs=require('fs');var Redis=require(_0x404b('0x3'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x404b('0x4'))(_0x404b('0x5'));var config=require(_0x404b('0x6'));var jayson=require(_0x404b('0x7'));var client=jayson[_0x404b('0x8')][_0x404b('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x28d2f9,_0x1e5028,_0x23b096){return new BPromise(function(_0x135ea6,_0x995e3a){return client['request'](_0x28d2f9,_0x23b096)[_0x404b('0xa')](function(_0x53733b){logger[_0x404b('0xb')](_0x404b('0xc'),_0x1e5028,_0x404b('0xd'));logger['debug'](_0x404b('0xe'),_0x1e5028,'request\x20sent',JSON[_0x404b('0xf')](_0x53733b));if(_0x53733b['error']){if(_0x53733b[_0x404b('0x10')][_0x404b('0x11')]===0x1f4){logger[_0x404b('0x10')](_0x404b('0xc'),_0x1e5028,_0x53733b[_0x404b('0x10')][_0x404b('0x12')]);return _0x995e3a(_0x53733b[_0x404b('0x10')]['message']);}logger[_0x404b('0x10')](_0x404b('0xc'),_0x1e5028,_0x53733b[_0x404b('0x10')][_0x404b('0x12')]);return _0x135ea6(_0x53733b[_0x404b('0x10')][_0x404b('0x12')]);}else{logger[_0x404b('0xb')](_0x404b('0xc'),_0x1e5028,_0x404b('0xd'));_0x135ea6(_0x53733b['result'][_0x404b('0x12')]);}})[_0x404b('0x13')](function(_0x3f8178){logger[_0x404b('0x10')](_0x404b('0xc'),_0x1e5028,_0x3f8178);_0x995e3a(_0x3f8178);});});} \ No newline at end of file +var _0xc32c=['lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','jayson/promise','client','http','request','then','info','FreshdeskConfiguration,\x20%s,\x20%s','debug','request\x20sent','error','code','message','result'];(function(_0xa9cbe0,_0x4cc0e5){var _0x211843=function(_0x61314){while(--_0x61314){_0xa9cbe0['push'](_0xa9cbe0['shift']());}};_0x211843(++_0x4cc0e5);}(_0xc32c,0x108));var _0xcc32=function(_0xe667cd,_0x48aecb){_0xe667cd=_0xe667cd-0x0;var _0x518684=_0xc32c[_0xe667cd];return _0x518684;};'use strict';var _=require(_0xcc32('0x0'));var util=require(_0xcc32('0x1'));var moment=require(_0xcc32('0x2'));var BPromise=require(_0xcc32('0x3'));var rs=require(_0xcc32('0x4'));var fs=require('fs');var Redis=require(_0xcc32('0x5'));var db=require(_0xcc32('0x6'))['db'];var utils=require(_0xcc32('0x7'));var logger=require('../../config/logger')(_0xcc32('0x8'));var config=require('../../config/environment');var jayson=require(_0xcc32('0x9'));var client=jayson[_0xcc32('0xa')][_0xcc32('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x15b968,_0x1239a6,_0x1c756e){return new BPromise(function(_0x1223ae,_0x2b5de2){return client[_0xcc32('0xc')](_0x15b968,_0x1c756e)[_0xcc32('0xd')](function(_0x458466){logger[_0xcc32('0xe')](_0xcc32('0xf'),_0x1239a6,'request\x20sent');logger[_0xcc32('0x10')]('FreshdeskConfiguration,\x20%s,\x20%s,\x20%s',_0x1239a6,_0xcc32('0x11'),JSON['stringify'](_0x458466));if(_0x458466[_0xcc32('0x12')]){if(_0x458466['error'][_0xcc32('0x13')]===0x1f4){logger[_0xcc32('0x12')]('FreshdeskConfiguration,\x20%s,\x20%s',_0x1239a6,_0x458466['error']['message']);return _0x2b5de2(_0x458466[_0xcc32('0x12')][_0xcc32('0x14')]);}logger[_0xcc32('0x12')](_0xcc32('0xf'),_0x1239a6,_0x458466[_0xcc32('0x12')]['message']);return _0x1223ae(_0x458466[_0xcc32('0x12')][_0xcc32('0x14')]);}else{logger[_0xcc32('0xe')](_0xcc32('0xf'),_0x1239a6,_0xcc32('0x11'));_0x1223ae(_0x458466[_0xcc32('0x15')][_0xcc32('0x14')]);}})['catch'](function(_0x149903){logger['error'](_0xcc32('0xf'),_0x1239a6,_0x149903);_0x2b5de2(_0x149903);});});} \ No newline at end of file diff --git a/server/api/intFreshdeskField/index.js b/server/api/intFreshdeskField/index.js index d1845bf..ab8f1b8 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 _0x34e8=['multer','util','path','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./intFreshdeskField.controller','get','isAuthenticated','show','post','create','put','/:id','update','delete','destroy','exports'];(function(_0x259d17,_0x220710){var _0x407535=function(_0x49bc38){while(--_0x49bc38){_0x259d17['push'](_0x259d17['shift']());}};_0x407535(++_0x220710);}(_0x34e8,0x12c));var _0x834e=function(_0x15ddb7,_0x5d48a2){_0x15ddb7=_0x15ddb7-0x0;var _0x253cc2=_0x34e8[_0x15ddb7];return _0x253cc2;};'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('0xc')]('/',auth[_0x834e('0xa')](),controller[_0x834e('0xd')]);router[_0x834e('0xe')](_0x834e('0xf'),auth[_0x834e('0xa')](),controller[_0x834e('0x10')]);router[_0x834e('0x11')](_0x834e('0xf'),auth[_0x834e('0xa')](),controller[_0x834e('0x12')]);module[_0x834e('0x13')]=router; \ No newline at end of file +var _0xedd9=['util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','post','create','put','delete','/:id','destroy','exports'];(function(_0x26462c,_0xd20a35){var _0x509a42=function(_0x1b22c9){while(--_0x1b22c9){_0x26462c['push'](_0x26462c['shift']());}};_0x509a42(++_0xd20a35);}(_0xedd9,0xfc));var _0x9edd=function(_0x44761c,_0x4816b0){_0x44761c=_0x44761c-0x0;var _0x3f2d8c=_0xedd9[_0x44761c];return _0x3f2d8c;};'use strict';var multer=require('multer');var util=require(_0x9edd('0x0'));var path=require(_0x9edd('0x1'));var timeout=require(_0x9edd('0x2'));var express=require(_0x9edd('0x3'));var router=express[_0x9edd('0x4')]();var auth=require(_0x9edd('0x5'));var interaction=require(_0x9edd('0x6'));var config=require(_0x9edd('0x7'));var controller=require('./intFreshdeskField.controller');router[_0x9edd('0x8')]('/',auth[_0x9edd('0x9')](),controller[_0x9edd('0xa')]);router[_0x9edd('0x8')]('/:id',auth[_0x9edd('0x9')](),controller['show']);router[_0x9edd('0xb')]('/',auth[_0x9edd('0x9')](),controller[_0x9edd('0xc')]);router[_0x9edd('0xd')]('/:id',auth[_0x9edd('0x9')](),controller['update']);router[_0x9edd('0xe')](_0x9edd('0xf'),auth['isAuthenticated'](),controller[_0x9edd('0x10')]);module[_0x9edd('0x11')]=router; \ No newline at end of file diff --git a/server/api/intFreshdeskField/intFreshdeskField.attributes.js b/server/api/intFreshdeskField/intFreshdeskField.attributes.js index 7b16ce0..b404cb9 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 _0x15ff=['exports','string','customVariable','keyValue','STRING','ENUM','variable','BOOLEAN','sequelize'];(function(_0x1d1779,_0x284147){var _0x2377e9=function(_0x299f6f){while(--_0x299f6f){_0x1d1779['push'](_0x1d1779['shift']());}};_0x2377e9(++_0x284147);}(_0x15ff,0x74));var _0xf15f=function(_0x37249a,_0x1ec7eb){_0x37249a=_0x37249a-0x0;var _0x545fab=_0x15ff[_0x37249a];return _0x545fab;};'use strict';var Sequelize=require(_0xf15f('0x0'));module[_0xf15f('0x1')]={'type':{'type':Sequelize['ENUM'](_0xf15f('0x2'),'variable',_0xf15f('0x3'),_0xf15f('0x4')),'defaultValue':_0xf15f('0x2')},'content':{'type':Sequelize[_0xf15f('0x5')]},'key':{'type':Sequelize[_0xf15f('0x5')]},'keyType':{'type':Sequelize[_0xf15f('0x6')]('string',_0xf15f('0x7'),'customVariable')},'keyContent':{'type':Sequelize[_0xf15f('0x5')]},'idField':{'type':Sequelize[_0xf15f('0x5')]},'nameField':{'type':Sequelize[_0xf15f('0x5')]},'customField':{'type':Sequelize[_0xf15f('0x8')],'defaultValue':!![]},'variableName':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x004c=['ENUM','string','customVariable','keyValue','STRING','variable','BOOLEAN','sequelize','exports'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x004c,0x85));var _0xc004=function(_0x2aea9e,_0x1f587f){_0x2aea9e=_0x2aea9e-0x0;var _0x430b92=_0x004c[_0x2aea9e];return _0x430b92;};'use strict';var Sequelize=require(_0xc004('0x0'));module[_0xc004('0x1')]={'type':{'type':Sequelize[_0xc004('0x2')](_0xc004('0x3'),'variable',_0xc004('0x4'),_0xc004('0x5')),'defaultValue':_0xc004('0x3')},'content':{'type':Sequelize[_0xc004('0x6')]},'key':{'type':Sequelize['STRING']},'keyType':{'type':Sequelize[_0xc004('0x2')]('string',_0xc004('0x7'),_0xc004('0x4'))},'keyContent':{'type':Sequelize[_0xc004('0x6')]},'idField':{'type':Sequelize['STRING']},'nameField':{'type':Sequelize[_0xc004('0x6')]},'customField':{'type':Sequelize[_0xc004('0x8')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0xc004('0x6')]}}; \ No newline at end of file diff --git a/server/api/intFreshdeskField/intFreshdeskField.controller.js b/server/api/intFreshdeskField/intFreshdeskField.controller.js index 37db97a..7d919a9 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 _0xa1a9=['show','params','keys','rawAttributes','create','body','find','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','to-csv','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../mysqldb','sendStatus','status','end','json','count','offset','limit','set','Content-Range','apply','reject','save','update','then','destroy','error','stack','name','index','map','FreshdeskField','key','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filter','type','merge','options','includeAll','include','findAll','rows','catch'];(function(_0xd99de,_0x2270a9){var _0x54116b=function(_0x371846){while(--_0x371846){_0xd99de['push'](_0xd99de['shift']());}};_0x54116b(++_0x2270a9);}(_0xa1a9,0x183));var _0x9a1a=function(_0x323f79,_0x3e3c20){_0x323f79=_0x323f79-0x0;var _0x5a0c50=_0xa1a9[_0x323f79];return _0x5a0c50;};'use strict';var pdf=require(_0x9a1a('0x0'));var emlformat=require(_0x9a1a('0x1'));var rimraf=require(_0x9a1a('0x2'));var zipdir=require(_0x9a1a('0x3'));var jsonpatch=require(_0x9a1a('0x4'));var rp=require(_0x9a1a('0x5'));var moment=require(_0x9a1a('0x6'));var BPromise=require(_0x9a1a('0x7'));var Mustache=require(_0x9a1a('0x8'));var util=require(_0x9a1a('0x9'));var path=require('path');var sox=require(_0x9a1a('0xa'));var csv=require(_0x9a1a('0xb'));var ejs=require('ejs');var fs=require('fs');var _=require(_0x9a1a('0xc'));var squel=require(_0x9a1a('0xd'));var crypto=require(_0x9a1a('0xe'));var jsforce=require(_0x9a1a('0xf'));var deskjs=require(_0x9a1a('0x10'));var toCsv=require('to-csv');var querystring=require(_0x9a1a('0x11'));var Papa=require(_0x9a1a('0x12'));var Redis=require(_0x9a1a('0x13'));var authService=require(_0x9a1a('0x14'));var qs=require('../../components/parsers/qs');var as=require(_0x9a1a('0x15'));var hardwareService=require(_0x9a1a('0x16'));var logger=require('../../config/logger')(_0x9a1a('0x17'));var utils=require(_0x9a1a('0x18'));var config=require('../../config/environment');var db=require(_0x9a1a('0x19'))['db'];function respondWithStatusCode(_0x240ed8,_0x5882da){_0x5882da=_0x5882da||0xcc;return function(_0x54987d){if(_0x54987d){return _0x240ed8[_0x9a1a('0x1a')](_0x5882da);}return _0x240ed8[_0x9a1a('0x1b')](_0x5882da)[_0x9a1a('0x1c')]();};}function respondWithResult(_0x49aa73,_0x2eeb8e){_0x2eeb8e=_0x2eeb8e||0xc8;return function(_0x24d9a5){if(_0x24d9a5){return _0x49aa73[_0x9a1a('0x1b')](_0x2eeb8e)[_0x9a1a('0x1d')](_0x24d9a5);}};}function respondWithFilteredResult(_0x25f2ea,_0x377dcc){return function(_0x521943){if(_0x521943){var _0x142153=_0x521943[_0x9a1a('0x1e')],_0x41d57d=_0x377dcc[_0x9a1a('0x1f')],_0x2c6544=_0x377dcc[_0x9a1a('0x1f')]+_0x377dcc[_0x9a1a('0x20')],_0x2fc1fd;if(_0x2c6544>=_0x142153){_0x2c6544=_0x142153;_0x2fc1fd=0xc8;}else{_0x2fc1fd=0xce;}_0x25f2ea[_0x9a1a('0x1b')](_0x2fc1fd);return _0x25f2ea[_0x9a1a('0x21')](_0x9a1a('0x22'),_0x41d57d+'-'+_0x2c6544+'/'+_0x142153)[_0x9a1a('0x1d')](_0x521943);}return null;};}function patchUpdates(_0xab2c2c){return function(_0x1d19b9){try{jsonpatch[_0x9a1a('0x23')](_0x1d19b9,_0xab2c2c,!![]);}catch(_0x2b2e98){return BPromise[_0x9a1a('0x24')](_0x2b2e98);}return _0x1d19b9[_0x9a1a('0x25')]();};}function saveUpdates(_0x5e2b50,_0x500777){return function(_0x1e1e46){if(_0x1e1e46){return _0x1e1e46[_0x9a1a('0x26')](_0x5e2b50)[_0x9a1a('0x27')](function(_0x467c11){return _0x467c11;});}return null;};}function removeEntity(_0x3cc330,_0x369155){return function(_0x1b642a){if(_0x1b642a){return _0x1b642a[_0x9a1a('0x28')]()['then'](function(){_0x3cc330[_0x9a1a('0x1b')](0xcc)['end']();});}};}function handleEntityNotFound(_0x577e4a,_0x544946){return function(_0x591b84){if(!_0x591b84){_0x577e4a[_0x9a1a('0x1a')](0x194);}return _0x591b84;};}function handleError(_0x2c358b,_0x2c654c){_0x2c654c=_0x2c654c||0x1f4;return function(_0xc1251f){logger[_0x9a1a('0x29')](_0xc1251f[_0x9a1a('0x2a')]);if(_0xc1251f['name']){delete _0xc1251f[_0x9a1a('0x2b')];}_0x2c358b[_0x9a1a('0x1b')](_0x2c654c)['send'](_0xc1251f);};}exports[_0x9a1a('0x2c')]=function(_0x1f25f4,_0xcb31bd){var _0x1026b0={},_0x2cab9d={},_0x8ac1ab={'count':0x0,'rows':[]};var _0x36f695=_[_0x9a1a('0x2d')](db[_0x9a1a('0x2e')]['rawAttributes'],function(_0x3f3d2e){return{'name':_0x3f3d2e['fieldName'],'type':_0x3f3d2e['type'][_0x9a1a('0x2f')]};});_0x2cab9d[_0x9a1a('0x30')]=_[_0x9a1a('0x2d')](_0x36f695,_0x9a1a('0x2b'));_0x2cab9d[_0x9a1a('0x31')]=_['keys'](_0x1f25f4['query']);_0x2cab9d[_0x9a1a('0x32')]=_[_0x9a1a('0x33')](_0x2cab9d[_0x9a1a('0x30')],_0x2cab9d[_0x9a1a('0x31')]);_0x1026b0[_0x9a1a('0x34')]=_[_0x9a1a('0x33')](_0x2cab9d[_0x9a1a('0x30')],qs['fields'](_0x1f25f4[_0x9a1a('0x31')][_0x9a1a('0x35')]));_0x1026b0['attributes']=_0x1026b0[_0x9a1a('0x34')][_0x9a1a('0x36')]?_0x1026b0[_0x9a1a('0x34')]:_0x2cab9d[_0x9a1a('0x30')];if(!_0x1f25f4[_0x9a1a('0x31')][_0x9a1a('0x37')](_0x9a1a('0x38'))){_0x1026b0[_0x9a1a('0x20')]=qs[_0x9a1a('0x20')](_0x1f25f4[_0x9a1a('0x31')][_0x9a1a('0x20')]);_0x1026b0[_0x9a1a('0x1f')]=qs['offset'](_0x1f25f4[_0x9a1a('0x31')][_0x9a1a('0x1f')]);}_0x1026b0[_0x9a1a('0x39')]=qs['sort'](_0x1f25f4[_0x9a1a('0x31')][_0x9a1a('0x3a')]);_0x1026b0[_0x9a1a('0x3b')]=qs[_0x9a1a('0x32')](_['pick'](_0x1f25f4[_0x9a1a('0x31')],_0x2cab9d[_0x9a1a('0x32')]));if(_0x1f25f4[_0x9a1a('0x31')][_0x9a1a('0x3c')]){_0x1026b0['where']=_['merge'](_0x1026b0['where'],{'$or':_[_0x9a1a('0x2d')](_0x36f695,function(_0x570891){if(_0x570891[_0x9a1a('0x3d')]!=='VIRTUAL'){var _0x2ff37f={};_0x2ff37f[_0x570891['name']]={'$like':'%'+_0x1f25f4[_0x9a1a('0x31')][_0x9a1a('0x3c')]+'%'};return _0x2ff37f;}})});}_0x1026b0=_[_0x9a1a('0x3e')]({},_0x1026b0,_0x1f25f4[_0x9a1a('0x3f')]);var _0x338ca9={'where':_0x1026b0[_0x9a1a('0x3b')]};return db[_0x9a1a('0x2e')][_0x9a1a('0x1e')](_0x338ca9)[_0x9a1a('0x27')](function(_0x30a409){_0x8ac1ab[_0x9a1a('0x1e')]=_0x30a409;if(_0x1f25f4[_0x9a1a('0x31')][_0x9a1a('0x40')]){_0x1026b0[_0x9a1a('0x41')]=[{'all':!![]}];}return db[_0x9a1a('0x2e')][_0x9a1a('0x42')](_0x1026b0);})[_0x9a1a('0x27')](function(_0x32eeba){_0x8ac1ab[_0x9a1a('0x43')]=_0x32eeba;return _0x8ac1ab;})[_0x9a1a('0x27')](respondWithFilteredResult(_0xcb31bd,_0x1026b0))[_0x9a1a('0x44')](handleError(_0xcb31bd,null));};exports[_0x9a1a('0x45')]=function(_0x5e39b2,_0x3a7af0){var _0x40f112={'raw':!![],'where':{'id':_0x5e39b2[_0x9a1a('0x46')]['id']}},_0x1d4064={};_0x1d4064['model']=_[_0x9a1a('0x47')](db[_0x9a1a('0x2e')][_0x9a1a('0x48')]);_0x1d4064[_0x9a1a('0x31')]=_[_0x9a1a('0x47')](_0x5e39b2[_0x9a1a('0x31')]);_0x1d4064[_0x9a1a('0x32')]=_[_0x9a1a('0x33')](_0x1d4064[_0x9a1a('0x30')],_0x1d4064['query']);_0x40f112['attributes']=_[_0x9a1a('0x33')](_0x1d4064[_0x9a1a('0x30')],qs[_0x9a1a('0x35')](_0x5e39b2[_0x9a1a('0x31')][_0x9a1a('0x35')]));_0x40f112[_0x9a1a('0x34')]=_0x40f112['attributes']['length']?_0x40f112[_0x9a1a('0x34')]:_0x1d4064[_0x9a1a('0x30')];if(_0x5e39b2[_0x9a1a('0x31')][_0x9a1a('0x40')]){_0x40f112[_0x9a1a('0x41')]=[{'all':!![]}];}_0x40f112=_[_0x9a1a('0x3e')]({},_0x40f112,_0x5e39b2[_0x9a1a('0x3f')]);return db['FreshdeskField']['find'](_0x40f112)['then'](handleEntityNotFound(_0x3a7af0,null))[_0x9a1a('0x27')](respondWithResult(_0x3a7af0,null))[_0x9a1a('0x44')](handleError(_0x3a7af0,null));};exports[_0x9a1a('0x49')]=function(_0xa6f1e0,_0x197a63){return db['FreshdeskField'][_0x9a1a('0x49')](_0xa6f1e0['body'],{})[_0x9a1a('0x27')](respondWithResult(_0x197a63,0xc9))[_0x9a1a('0x44')](handleError(_0x197a63,null));};exports[_0x9a1a('0x26')]=function(_0x59cd5f,_0x564335){if(_0x59cd5f['body']['id']){delete _0x59cd5f[_0x9a1a('0x4a')]['id'];}return db[_0x9a1a('0x2e')][_0x9a1a('0x4b')]({'where':{'id':_0x59cd5f['params']['id']}})[_0x9a1a('0x27')](handleEntityNotFound(_0x564335,null))[_0x9a1a('0x27')](saveUpdates(_0x59cd5f[_0x9a1a('0x4a')],null))[_0x9a1a('0x27')](respondWithResult(_0x564335,null))[_0x9a1a('0x44')](handleError(_0x564335,null));};exports[_0x9a1a('0x28')]=function(_0x288cd3,_0x3c9916){return db['FreshdeskField']['find']({'where':{'id':_0x288cd3[_0x9a1a('0x46')]['id']}})[_0x9a1a('0x27')](handleEntityNotFound(_0x3c9916,null))[_0x9a1a('0x27')](removeEntity(_0x3c9916,null))[_0x9a1a('0x44')](handleError(_0x3c9916,null));}; \ No newline at end of file +var _0x707d=['ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../mysqldb','status','end','json','count','offset','limit','set','Content-Range','apply','save','then','sendStatus','error','stack','name','send','index','FreshdeskField','rawAttributes','fieldName','type','key','model','map','query','keys','filters','fields','attributes','length','nolimit','order','sort','filter','where','merge','VIRTUAL','includeAll','include','rows','catch','show','intersection','find','create','body','update','destroy','params','html-pdf','rimraf','zip-dir','request-promise','bluebird','mustache','util','sox','to-csv','ejs','lodash','crypto','jsforce','desk.js','querystring','papaparse'];(function(_0x2b480e,_0x39a3e5){var _0x4448bf=function(_0xed8cb0){while(--_0xed8cb0){_0x2b480e['push'](_0x2b480e['shift']());}};_0x4448bf(++_0x39a3e5);}(_0x707d,0x114));var _0xd707=function(_0x53d7ae,_0x20cc34){_0x53d7ae=_0x53d7ae-0x0;var _0x44f3ae=_0x707d[_0x53d7ae];return _0x44f3ae;};'use strict';var pdf=require(_0xd707('0x0'));var emlformat=require('eml-format');var rimraf=require(_0xd707('0x1'));var zipdir=require(_0xd707('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xd707('0x3'));var moment=require('moment');var BPromise=require(_0xd707('0x4'));var Mustache=require(_0xd707('0x5'));var util=require(_0xd707('0x6'));var path=require('path');var sox=require(_0xd707('0x7'));var csv=require(_0xd707('0x8'));var ejs=require(_0xd707('0x9'));var fs=require('fs');var _=require(_0xd707('0xa'));var squel=require('squel');var crypto=require(_0xd707('0xb'));var jsforce=require(_0xd707('0xc'));var deskjs=require(_0xd707('0xd'));var toCsv=require('to-csv');var querystring=require(_0xd707('0xe'));var Papa=require(_0xd707('0xf'));var Redis=require(_0xd707('0x10'));var authService=require(_0xd707('0x11'));var qs=require(_0xd707('0x12'));var as=require(_0xd707('0x13'));var hardwareService=require(_0xd707('0x14'));var logger=require('../../config/logger')(_0xd707('0x15'));var utils=require(_0xd707('0x16'));var config=require('../../config/environment');var db=require(_0xd707('0x17'))['db'];function respondWithStatusCode(_0x4e967b,_0x2b5c2e){_0x2b5c2e=_0x2b5c2e||0xcc;return function(_0x338f12){if(_0x338f12){return _0x4e967b['sendStatus'](_0x2b5c2e);}return _0x4e967b[_0xd707('0x18')](_0x2b5c2e)[_0xd707('0x19')]();};}function respondWithResult(_0x2a01c1,_0x4e1b15){_0x4e1b15=_0x4e1b15||0xc8;return function(_0x1fe806){if(_0x1fe806){return _0x2a01c1[_0xd707('0x18')](_0x4e1b15)[_0xd707('0x1a')](_0x1fe806);}};}function respondWithFilteredResult(_0x1be0f5,_0x5508cc){return function(_0xbcca5a){if(_0xbcca5a){var _0x3b06fe=_0xbcca5a[_0xd707('0x1b')],_0x159940=_0x5508cc[_0xd707('0x1c')],_0xad5bd2=_0x5508cc[_0xd707('0x1c')]+_0x5508cc[_0xd707('0x1d')],_0x800141;if(_0xad5bd2>=_0x3b06fe){_0xad5bd2=_0x3b06fe;_0x800141=0xc8;}else{_0x800141=0xce;}_0x1be0f5[_0xd707('0x18')](_0x800141);return _0x1be0f5[_0xd707('0x1e')](_0xd707('0x1f'),_0x159940+'-'+_0xad5bd2+'/'+_0x3b06fe)[_0xd707('0x1a')](_0xbcca5a);}return null;};}function patchUpdates(_0x33a141){return function(_0x32e68f){try{jsonpatch[_0xd707('0x20')](_0x32e68f,_0x33a141,!![]);}catch(_0x130f0b){return BPromise['reject'](_0x130f0b);}return _0x32e68f[_0xd707('0x21')]();};}function saveUpdates(_0x115b82,_0x2d58b9){return function(_0x2e6a4d){if(_0x2e6a4d){return _0x2e6a4d['update'](_0x115b82)['then'](function(_0x5de4a2){return _0x5de4a2;});}return null;};}function removeEntity(_0x3e1133,_0x343b90){return function(_0x3578e4){if(_0x3578e4){return _0x3578e4['destroy']()[_0xd707('0x22')](function(){_0x3e1133['status'](0xcc)[_0xd707('0x19')]();});}};}function handleEntityNotFound(_0x21feab,_0x493652){return function(_0x390309){if(!_0x390309){_0x21feab[_0xd707('0x23')](0x194);}return _0x390309;};}function handleError(_0x4eef94,_0x4c795c){_0x4c795c=_0x4c795c||0x1f4;return function(_0x56df7c){logger[_0xd707('0x24')](_0x56df7c[_0xd707('0x25')]);if(_0x56df7c[_0xd707('0x26')]){delete _0x56df7c[_0xd707('0x26')];}_0x4eef94[_0xd707('0x18')](_0x4c795c)[_0xd707('0x27')](_0x56df7c);};}exports[_0xd707('0x28')]=function(_0x1bc980,_0x51b7c6){var _0x1e2b87={},_0xe23b75={},_0x3542d0={'count':0x0,'rows':[]};var _0x5e5681=_['map'](db[_0xd707('0x29')][_0xd707('0x2a')],function(_0x2f31d4){return{'name':_0x2f31d4[_0xd707('0x2b')],'type':_0x2f31d4[_0xd707('0x2c')][_0xd707('0x2d')]};});_0xe23b75[_0xd707('0x2e')]=_[_0xd707('0x2f')](_0x5e5681,'name');_0xe23b75[_0xd707('0x30')]=_[_0xd707('0x31')](_0x1bc980[_0xd707('0x30')]);_0xe23b75[_0xd707('0x32')]=_['intersection'](_0xe23b75[_0xd707('0x2e')],_0xe23b75[_0xd707('0x30')]);_0x1e2b87['attributes']=_['intersection'](_0xe23b75[_0xd707('0x2e')],qs[_0xd707('0x33')](_0x1bc980[_0xd707('0x30')][_0xd707('0x33')]));_0x1e2b87['attributes']=_0x1e2b87[_0xd707('0x34')][_0xd707('0x35')]?_0x1e2b87['attributes']:_0xe23b75['model'];if(!_0x1bc980[_0xd707('0x30')]['hasOwnProperty'](_0xd707('0x36'))){_0x1e2b87[_0xd707('0x1d')]=qs['limit'](_0x1bc980[_0xd707('0x30')][_0xd707('0x1d')]);_0x1e2b87[_0xd707('0x1c')]=qs['offset'](_0x1bc980[_0xd707('0x30')][_0xd707('0x1c')]);}_0x1e2b87[_0xd707('0x37')]=qs[_0xd707('0x38')](_0x1bc980[_0xd707('0x30')]['sort']);_0x1e2b87['where']=qs[_0xd707('0x32')](_['pick'](_0x1bc980[_0xd707('0x30')],_0xe23b75[_0xd707('0x32')]));if(_0x1bc980[_0xd707('0x30')][_0xd707('0x39')]){_0x1e2b87[_0xd707('0x3a')]=_[_0xd707('0x3b')](_0x1e2b87[_0xd707('0x3a')],{'$or':_['map'](_0x5e5681,function(_0x29d43f){if(_0x29d43f[_0xd707('0x2c')]!==_0xd707('0x3c')){var _0x1ab7b8={};_0x1ab7b8[_0x29d43f[_0xd707('0x26')]]={'$like':'%'+_0x1bc980[_0xd707('0x30')]['filter']+'%'};return _0x1ab7b8;}})});}_0x1e2b87=_[_0xd707('0x3b')]({},_0x1e2b87,_0x1bc980['options']);var _0xf4ea95={'where':_0x1e2b87[_0xd707('0x3a')]};return db['FreshdeskField'][_0xd707('0x1b')](_0xf4ea95)[_0xd707('0x22')](function(_0x45fa7f){_0x3542d0['count']=_0x45fa7f;if(_0x1bc980[_0xd707('0x30')][_0xd707('0x3d')]){_0x1e2b87[_0xd707('0x3e')]=[{'all':!![]}];}return db['FreshdeskField']['findAll'](_0x1e2b87);})['then'](function(_0x19e69c){_0x3542d0[_0xd707('0x3f')]=_0x19e69c;return _0x3542d0;})[_0xd707('0x22')](respondWithFilteredResult(_0x51b7c6,_0x1e2b87))[_0xd707('0x40')](handleError(_0x51b7c6,null));};exports[_0xd707('0x41')]=function(_0x1e324f,_0x3732c8){var _0x5a7f9c={'raw':!![],'where':{'id':_0x1e324f['params']['id']}},_0x44fdc8={};_0x44fdc8[_0xd707('0x2e')]=_['keys'](db[_0xd707('0x29')][_0xd707('0x2a')]);_0x44fdc8[_0xd707('0x30')]=_[_0xd707('0x31')](_0x1e324f[_0xd707('0x30')]);_0x44fdc8[_0xd707('0x32')]=_[_0xd707('0x42')](_0x44fdc8[_0xd707('0x2e')],_0x44fdc8[_0xd707('0x30')]);_0x5a7f9c[_0xd707('0x34')]=_[_0xd707('0x42')](_0x44fdc8[_0xd707('0x2e')],qs[_0xd707('0x33')](_0x1e324f[_0xd707('0x30')][_0xd707('0x33')]));_0x5a7f9c[_0xd707('0x34')]=_0x5a7f9c[_0xd707('0x34')][_0xd707('0x35')]?_0x5a7f9c['attributes']:_0x44fdc8[_0xd707('0x2e')];if(_0x1e324f[_0xd707('0x30')][_0xd707('0x3d')]){_0x5a7f9c['include']=[{'all':!![]}];}_0x5a7f9c=_[_0xd707('0x3b')]({},_0x5a7f9c,_0x1e324f['options']);return db[_0xd707('0x29')][_0xd707('0x43')](_0x5a7f9c)['then'](handleEntityNotFound(_0x3732c8,null))[_0xd707('0x22')](respondWithResult(_0x3732c8,null))[_0xd707('0x40')](handleError(_0x3732c8,null));};exports[_0xd707('0x44')]=function(_0x4b071c,_0xb96923){return db['FreshdeskField'][_0xd707('0x44')](_0x4b071c[_0xd707('0x45')],{})[_0xd707('0x22')](respondWithResult(_0xb96923,0xc9))['catch'](handleError(_0xb96923,null));};exports[_0xd707('0x46')]=function(_0x1cb4c1,_0x4dc5c1){if(_0x1cb4c1['body']['id']){delete _0x1cb4c1[_0xd707('0x45')]['id'];}return db[_0xd707('0x29')][_0xd707('0x43')]({'where':{'id':_0x1cb4c1['params']['id']}})[_0xd707('0x22')](handleEntityNotFound(_0x4dc5c1,null))[_0xd707('0x22')](saveUpdates(_0x1cb4c1[_0xd707('0x45')],null))[_0xd707('0x22')](respondWithResult(_0x4dc5c1,null))[_0xd707('0x40')](handleError(_0x4dc5c1,null));};exports[_0xd707('0x47')]=function(_0x50953e,_0x5b4d84){return db['FreshdeskField'][_0xd707('0x43')]({'where':{'id':_0x50953e[_0xd707('0x48')]['id']}})[_0xd707('0x22')](handleEntityNotFound(_0x5b4d84,null))[_0xd707('0x22')](removeEntity(_0x5b4d84,null))[_0xd707('0x40')](handleError(_0x5b4d84,null));}; \ No newline at end of file diff --git a/server/api/intFreshdeskField/intFreshdeskField.model.js b/server/api/intFreshdeskField/intFreshdeskField.model.js index 9368ecc..2eb6642 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 _0x2691=['rimraf','../../config/environment','define','FreshdeskField','freshdesk_unique_index','idField','FieldId','../../config/logger','api','moment','bluebird','request-promise','path'];(function(_0x21931a,_0x2f0893){var _0x2835f7=function(_0x513d0e){while(--_0x513d0e){_0x21931a['push'](_0x21931a['shift']());}};_0x2835f7(++_0x2f0893);}(_0x2691,0x1db));var _0x1269=function(_0x8b8d99,_0x7858b6){_0x8b8d99=_0x8b8d99-0x0;var _0x214aa9=_0x2691[_0x8b8d99];return _0x214aa9;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x1269('0x0'))(_0x1269('0x1'));var moment=require(_0x1269('0x2'));var BPromise=require(_0x1269('0x3'));var rp=require(_0x1269('0x4'));var fs=require('fs');var path=require(_0x1269('0x5'));var rimraf=require(_0x1269('0x6'));var config=require(_0x1269('0x7'));var attributes=require('./intFreshdeskField.attributes');module['exports']=function(_0x509739,_0x4eb218){return _0x509739[_0x1269('0x8')](_0x1269('0x9'),attributes,{'tableName':'int_freshdesk_fields','paranoid':![],'indexes':[{'name':_0x1269('0xa'),'fields':[_0x1269('0xb'),_0x1269('0xc')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0x3c3e=['path','rimraf','../../config/environment','./intFreshdeskField.attributes','exports','define','FreshdeskField','idField','FieldId','lodash','util','../../config/logger','api','moment'];(function(_0x29b2b5,_0x16d2b5){var _0x2d196=function(_0x2bbed6){while(--_0x2bbed6){_0x29b2b5['push'](_0x29b2b5['shift']());}};_0x2d196(++_0x16d2b5);}(_0x3c3e,0xcd));var _0xe3c3=function(_0x53c893,_0x5d3a03){_0x53c893=_0x53c893-0x0;var _0x3275d8=_0x3c3e[_0x53c893];return _0x3275d8;};'use strict';var _=require(_0xe3c3('0x0'));var util=require(_0xe3c3('0x1'));var logger=require(_0xe3c3('0x2'))(_0xe3c3('0x3'));var moment=require(_0xe3c3('0x4'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0xe3c3('0x5'));var rimraf=require(_0xe3c3('0x6'));var config=require(_0xe3c3('0x7'));var attributes=require(_0xe3c3('0x8'));module[_0xe3c3('0x9')]=function(_0x7a2e4,_0x44123b){return _0x7a2e4[_0xe3c3('0xa')](_0xe3c3('0xb'),attributes,{'tableName':'int_freshdesk_fields','paranoid':![],'indexes':[{'name':'freshdesk_unique_index','fields':[_0xe3c3('0xc'),_0xe3c3('0xd')],'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 c2b16f5..a250d17 100644 --- a/server/api/intFreshdeskField/intFreshdeskField.rpc.js +++ b/server/api/intFreshdeskField/intFreshdeskField.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x7a54=['info','FreshdeskField,\x20%s,\x20%s','debug','stringify','error','code','message','request\x20sent','result','catch','lodash','util','moment','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http'];(function(_0x3b380d,_0x4bf247){var _0x54502b=function(_0x35d207){while(--_0x35d207){_0x3b380d['push'](_0x3b380d['shift']());}};_0x54502b(++_0x4bf247);}(_0x7a54,0x106));var _0x47a5=function(_0x2dc73a,_0x3a3a4e){_0x2dc73a=_0x2dc73a-0x0;var _0xebd454=_0x7a54[_0x2dc73a];return _0xebd454;};'use strict';var _=require(_0x47a5('0x0'));var util=require(_0x47a5('0x1'));var moment=require(_0x47a5('0x2'));var BPromise=require('bluebird');var rs=require(_0x47a5('0x3'));var fs=require('fs');var Redis=require(_0x47a5('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x47a5('0x5'));var logger=require(_0x47a5('0x6'))(_0x47a5('0x7'));var config=require(_0x47a5('0x8'));var jayson=require(_0x47a5('0x9'));var client=jayson['client'][_0x47a5('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x59199c,_0x343372,_0x30e405){return new BPromise(function(_0x506eda,_0x194fb0){return client['request'](_0x59199c,_0x30e405)['then'](function(_0x582352){logger[_0x47a5('0xb')](_0x47a5('0xc'),_0x343372,'request\x20sent');logger[_0x47a5('0xd')]('FreshdeskField,\x20%s,\x20%s,\x20%s',_0x343372,'request\x20sent',JSON[_0x47a5('0xe')](_0x582352));if(_0x582352[_0x47a5('0xf')]){if(_0x582352[_0x47a5('0xf')][_0x47a5('0x10')]===0x1f4){logger[_0x47a5('0xf')](_0x47a5('0xc'),_0x343372,_0x582352[_0x47a5('0xf')]['message']);return _0x194fb0(_0x582352[_0x47a5('0xf')][_0x47a5('0x11')]);}logger[_0x47a5('0xf')](_0x47a5('0xc'),_0x343372,_0x582352[_0x47a5('0xf')][_0x47a5('0x11')]);return _0x506eda(_0x582352[_0x47a5('0xf')][_0x47a5('0x11')]);}else{logger['info'](_0x47a5('0xc'),_0x343372,_0x47a5('0x12'));_0x506eda(_0x582352[_0x47a5('0x13')][_0x47a5('0x11')]);}})[_0x47a5('0x14')](function(_0x574af6){logger['error'](_0x47a5('0xc'),_0x343372,_0x574af6);_0x194fb0(_0x574af6);});});} \ No newline at end of file +var _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(_0x11a958,_0x4606e2){var _0x2d5359=function(_0x3d933a){while(--_0x3d933a){_0x11a958['push'](_0x11a958['shift']());}};_0x2d5359(++_0x4606e2);}(_0xb10b,0x12a));var _0xbb10=function(_0x17ac5b,_0x1a2d16){_0x17ac5b=_0x17ac5b-0x0;var _0x2dcec9=_0xb10b[_0x17ac5b];return _0x2dcec9;};'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 acc2a87..dff3eba 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 _0x44c3=['multer','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./intFreshsalesAccount.controller','get','isAuthenticated','index','/:id','show','/:id/configurations','getConfigurations','/:id/fields','getFields','post','create','addConfiguration','put','update','delete','destroy','exports'];(function(_0x46e221,_0x4edf1d){var _0x6ab8ee=function(_0x2636d9){while(--_0x2636d9){_0x46e221['push'](_0x46e221['shift']());}};_0x6ab8ee(++_0x4edf1d);}(_0x44c3,0x186));var _0x344c=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x44c3[_0x321bb2];return _0x9c12ed;};'use strict';var multer=require(_0x344c('0x0'));var util=require('util');var path=require(_0x344c('0x1'));var timeout=require(_0x344c('0x2'));var express=require(_0x344c('0x3'));var router=express[_0x344c('0x4')]();var auth=require(_0x344c('0x5'));var interaction=require(_0x344c('0x6'));var config=require(_0x344c('0x7'));var controller=require(_0x344c('0x8'));router[_0x344c('0x9')]('/',auth[_0x344c('0xa')](),controller[_0x344c('0xb')]);router[_0x344c('0x9')](_0x344c('0xc'),auth[_0x344c('0xa')](),controller[_0x344c('0xd')]);router[_0x344c('0x9')](_0x344c('0xe'),auth[_0x344c('0xa')](),controller[_0x344c('0xf')]);router['get'](_0x344c('0x10'),auth[_0x344c('0xa')](),controller[_0x344c('0x11')]);router[_0x344c('0x12')]('/',auth[_0x344c('0xa')](),controller[_0x344c('0x13')]);router[_0x344c('0x12')]('/:id/configurations',auth[_0x344c('0xa')](),controller[_0x344c('0x14')]);router[_0x344c('0x15')](_0x344c('0xc'),auth[_0x344c('0xa')](),controller[_0x344c('0x16')]);router[_0x344c('0x17')](_0x344c('0xc'),auth['isAuthenticated'](),controller[_0x344c('0x18')]);module[_0x344c('0x19')]=router; \ No newline at end of file +var _0xb710=['show','/:id/configurations','getConfigurations','/:id/fields','getFields','create','addConfiguration','put','update','delete','destroy','exports','multer','path','connect-timeout','Router','../../components/interaction/service','../../config/environment','./intFreshsalesAccount.controller','get','isAuthenticated','index','/:id'];(function(_0x1c62a9,_0x374488){var _0x20ac7b=function(_0x12448a){while(--_0x12448a){_0x1c62a9['push'](_0x1c62a9['shift']());}};_0x20ac7b(++_0x374488);}(_0xb710,0x68));var _0x0b71=function(_0x396276,_0x38db66){_0x396276=_0x396276-0x0;var _0x27d4de=_0xb710[_0x396276];return _0x27d4de;};'use strict';var multer=require(_0x0b71('0x0'));var util=require('util');var path=require(_0x0b71('0x1'));var timeout=require(_0x0b71('0x2'));var express=require('express');var router=express[_0x0b71('0x3')]();var auth=require('../../components/auth/service');var interaction=require(_0x0b71('0x4'));var config=require(_0x0b71('0x5'));var controller=require(_0x0b71('0x6'));router[_0x0b71('0x7')]('/',auth[_0x0b71('0x8')](),controller[_0x0b71('0x9')]);router['get'](_0x0b71('0xa'),auth[_0x0b71('0x8')](),controller[_0x0b71('0xb')]);router[_0x0b71('0x7')](_0x0b71('0xc'),auth[_0x0b71('0x8')](),controller[_0x0b71('0xd')]);router[_0x0b71('0x7')](_0x0b71('0xe'),auth[_0x0b71('0x8')](),controller[_0x0b71('0xf')]);router['post']('/',auth[_0x0b71('0x8')](),controller[_0x0b71('0x10')]);router['post'](_0x0b71('0xc'),auth['isAuthenticated'](),controller[_0x0b71('0x11')]);router[_0x0b71('0x12')](_0x0b71('0xa'),auth['isAuthenticated'](),controller[_0x0b71('0x13')]);router[_0x0b71('0x14')]('/:id',auth[_0x0b71('0x8')](),controller[_0x0b71('0x15')]);module[_0x0b71('0x16')]=router; \ No newline at end of file diff --git a/server/api/intFreshsalesAccount/intFreshsalesAccount.attributes.js b/server/api/intFreshsalesAccount/intFreshsalesAccount.attributes.js index a147287..aaf18ba 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 _0x1cbc=['sequelize','STRING','username','remoteUri'];(function(_0x46e363,_0x45d7e2){var _0x3fb059=function(_0x5e6274){while(--_0x5e6274){_0x46e363['push'](_0x46e363['shift']());}};_0x3fb059(++_0x45d7e2);}(_0x1cbc,0xf4));var _0xc1cb=function(_0x20b29c,_0xe22528){_0x20b29c=_0x20b29c-0x0;var _0x20d81b=_0x1cbc[_0x20b29c];return _0x20d81b;};'use strict';var Sequelize=require(_0xc1cb('0x0'));module['exports']={'name':{'type':Sequelize[_0xc1cb('0x1')]},'description':{'type':Sequelize[_0xc1cb('0x1')]},'username':{'type':Sequelize[_0xc1cb('0x1')],'unique':_0xc1cb('0x2')},'apiKey':{'type':Sequelize[_0xc1cb('0x1')]},'remoteUri':{'type':Sequelize[_0xc1cb('0x1')],'unique':_0xc1cb('0x3')},'serverUrl':{'type':Sequelize[_0xc1cb('0x1')]}}; \ No newline at end of file +var _0x01a6=['username','remoteUri','sequelize','STRING'];(function(_0x2fa585,_0x4f5d94){var _0x5da777=function(_0x3ca809){while(--_0x3ca809){_0x2fa585['push'](_0x2fa585['shift']());}};_0x5da777(++_0x4f5d94);}(_0x01a6,0x162));var _0x601a=function(_0x34cac5,_0x5e7d3d){_0x34cac5=_0x34cac5-0x0;var _0x35c4d2=_0x01a6[_0x34cac5];return _0x35c4d2;};'use strict';var Sequelize=require(_0x601a('0x0'));module['exports']={'name':{'type':Sequelize[_0x601a('0x1')]},'description':{'type':Sequelize[_0x601a('0x1')]},'username':{'type':Sequelize[_0x601a('0x1')],'unique':_0x601a('0x2')},'apiKey':{'type':Sequelize[_0x601a('0x1')]},'remoteUri':{'type':Sequelize['STRING'],'unique':_0x601a('0x3')},'serverUrl':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/intFreshsalesAccount/intFreshsalesAccount.controller.js b/server/api/intFreshsalesAccount/intFreshsalesAccount.controller.js index e004a68..2098c84 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 _0x0298=['merge','filter','options','findAll','rows','show','params','keys','length','include','body','destroy','getConfigurations','findOne','FreshsalesConfiguration','order','addConfiguration','AccountId','Subjects','getSubjects','channel','Descriptions','create','FreshsalesField','username','remoteUri','apiKey','lastIndexOf','format','%s%s','/api/selector/owners','Token\x20token=','users','email','statusCode','getFields,\x20%s,\x20%s,\x20%s','getFields','stringify','Wrong\x20credentials','html-pdf','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','to-csv','ejs','squel','crypto','jsforce','desk.js','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/logger','api','../../config/environment','../../components/integrations/configuration','jayson/promise','client','http','test','Sequelize','ValidationError','request','info','FreshsalesAccount,\x20%s,\x20%s','request\x20sent','FreshsalesAccount,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','sendStatus','status','end','json','count','offset','set','apply','reject','save','update','then','name','send','index','map','FreshsalesAccount','rawAttributes','type','key','model','query','filters','intersection','attributes','fields','hasOwnProperty','nolimit','limit','sort','where','pick'];(function(_0x3d6785,_0x492ea3){var _0x39a624=function(_0x27d7db){while(--_0x27d7db){_0x3d6785['push'](_0x3d6785['shift']());}};_0x39a624(++_0x492ea3);}(_0x0298,0x95));var _0x8029=function(_0x2a7082,_0x362c5e){_0x2a7082=_0x2a7082-0x0;var _0x39c954=_0x0298[_0x2a7082];return _0x39c954;};'use strict';var pdf=require(_0x8029('0x0'));var emlformat=require('eml-format');var rimraf=require(_0x8029('0x1'));var zipdir=require(_0x8029('0x2'));var jsonpatch=require(_0x8029('0x3'));var rp=require(_0x8029('0x4'));var moment=require(_0x8029('0x5'));var BPromise=require(_0x8029('0x6'));var Mustache=require(_0x8029('0x7'));var util=require(_0x8029('0x8'));var path=require(_0x8029('0x9'));var sox=require('sox');var csv=require(_0x8029('0xa'));var ejs=require(_0x8029('0xb'));var fs=require('fs');var _=require('lodash');var squel=require(_0x8029('0xc'));var crypto=require(_0x8029('0xd'));var jsforce=require(_0x8029('0xe'));var deskjs=require(_0x8029('0xf'));var toCsv=require(_0x8029('0xa'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x8029('0x10'));var authService=require(_0x8029('0x11'));var qs=require(_0x8029('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x8029('0x13'))(_0x8029('0x14'));var utils=require('../../config/utils');var config=require(_0x8029('0x15'));var db=require('../../mysqldb')['db'];var integrations=require(_0x8029('0x16'));var jayson=require(_0x8029('0x17'));var client=jayson[_0x8029('0x18')][_0x8029('0x19')]({'port':0x232a});function checkPasswordPattern(_0x1aeebc,_0x243ba9,_0x594c05){if(_0x594c05){var _0x16f994=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x16f994[_0x8029('0x1a')](_0x243ba9)){return _0x1aeebc;}else{throw new db[(_0x8029('0x1b'))][(_0x8029('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 _0x1aeebc;}}function respondWithRpcPromise(_0x4b4904,_0x4a7abc,_0x3fdf4b,_0xcea0a8){return new BPromise(function(_0x6615a5,_0x1cef49){var _0x14ad14=_0xcea0a8||client;return _0x14ad14[_0x8029('0x1d')](_0x4b4904,_0x3fdf4b)['then'](function(_0x43117d){logger[_0x8029('0x1e')](_0x8029('0x1f'),_0x4a7abc,_0x8029('0x20'));logger['debug'](_0x8029('0x21'),_0x4a7abc,_0x8029('0x20'),JSON['stringify'](_0x43117d));if(_0x43117d[_0x8029('0x22')]){if(_0x43117d['error'][_0x8029('0x23')]===0x1f4){logger[_0x8029('0x22')](_0x8029('0x1f'),_0x4a7abc,_0x43117d[_0x8029('0x22')]['message']);return _0x1cef49(_0x43117d[_0x8029('0x22')][_0x8029('0x24')]);}logger['error']('FreshsalesAccount,\x20%s,\x20%s',_0x4a7abc,_0x43117d[_0x8029('0x22')][_0x8029('0x24')]);return _0x6615a5(_0x43117d[_0x8029('0x22')][_0x8029('0x24')]);}else{logger[_0x8029('0x1e')](_0x8029('0x1f'),_0x4a7abc,_0x8029('0x20'));_0x6615a5(_0x43117d[_0x8029('0x25')][_0x8029('0x24')]);}})[_0x8029('0x26')](function(_0x4689bc){logger[_0x8029('0x22')](_0x8029('0x1f'),_0x4a7abc,_0x4689bc);_0x1cef49(_0x4689bc);});});}function respondWithStatusCode(_0x468de9,_0x40093a){_0x40093a=_0x40093a||0xcc;return function(_0x33e1cd){if(_0x33e1cd){return _0x468de9[_0x8029('0x27')](_0x40093a);}return _0x468de9[_0x8029('0x28')](_0x40093a)[_0x8029('0x29')]();};}function respondWithResult(_0x194fbd,_0x53de5b){_0x53de5b=_0x53de5b||0xc8;return function(_0x3525ed){if(_0x3525ed){return _0x194fbd['status'](_0x53de5b)[_0x8029('0x2a')](_0x3525ed);}};}function respondWithFilteredResult(_0x472482,_0xe3a48){return function(_0x1ad970){if(_0x1ad970){var _0x411bcb=_0x1ad970[_0x8029('0x2b')],_0x523e52=_0xe3a48[_0x8029('0x2c')],_0x2ac692=_0xe3a48[_0x8029('0x2c')]+_0xe3a48['limit'],_0x7f9656;if(_0x2ac692>=_0x411bcb){_0x2ac692=_0x411bcb;_0x7f9656=0xc8;}else{_0x7f9656=0xce;}_0x472482[_0x8029('0x28')](_0x7f9656);return _0x472482[_0x8029('0x2d')]('Content-Range',_0x523e52+'-'+_0x2ac692+'/'+_0x411bcb)[_0x8029('0x2a')](_0x1ad970);}return null;};}function patchUpdates(_0x533ed8){return function(_0x3ed3d4){try{jsonpatch[_0x8029('0x2e')](_0x3ed3d4,_0x533ed8,!![]);}catch(_0x44907a){return BPromise[_0x8029('0x2f')](_0x44907a);}return _0x3ed3d4[_0x8029('0x30')]();};}function saveUpdates(_0x7d407f,_0x59fc7e){return function(_0x218209){if(_0x218209){return _0x218209[_0x8029('0x31')](_0x7d407f)[_0x8029('0x32')](function(_0x31d95d){return _0x31d95d;});}return null;};}function removeEntity(_0x50ae52,_0x5f41d9){return function(_0x4af222){if(_0x4af222){return _0x4af222['destroy']()[_0x8029('0x32')](function(){_0x50ae52[_0x8029('0x28')](0xcc)[_0x8029('0x29')]();});}};}function handleEntityNotFound(_0x1b2097,_0x27d1c4){return function(_0x36353b){if(!_0x36353b){_0x1b2097['sendStatus'](0x194);}return _0x36353b;};}function handleError(_0x2bf869,_0x19a39e){_0x19a39e=_0x19a39e||0x1f4;return function(_0x327a79){logger['error'](_0x327a79['stack']);if(_0x327a79[_0x8029('0x33')]){delete _0x327a79[_0x8029('0x33')];}_0x2bf869['status'](_0x19a39e)[_0x8029('0x34')](_0x327a79);};}exports[_0x8029('0x35')]=function(_0xbda09f,_0x23037c){var _0x139b77={},_0x7cb54c={},_0x403256={'count':0x0,'rows':[]};var _0x1b5315=_[_0x8029('0x36')](db[_0x8029('0x37')][_0x8029('0x38')],function(_0x545cfd){return{'name':_0x545cfd['fieldName'],'type':_0x545cfd[_0x8029('0x39')][_0x8029('0x3a')]};});_0x7cb54c[_0x8029('0x3b')]=_['map'](_0x1b5315,_0x8029('0x33'));_0x7cb54c[_0x8029('0x3c')]=_['keys'](_0xbda09f[_0x8029('0x3c')]);_0x7cb54c[_0x8029('0x3d')]=_[_0x8029('0x3e')](_0x7cb54c[_0x8029('0x3b')],_0x7cb54c[_0x8029('0x3c')]);_0x139b77[_0x8029('0x3f')]=_[_0x8029('0x3e')](_0x7cb54c['model'],qs['fields'](_0xbda09f[_0x8029('0x3c')][_0x8029('0x40')]));_0x139b77[_0x8029('0x3f')]=_0x139b77[_0x8029('0x3f')]['length']?_0x139b77[_0x8029('0x3f')]:_0x7cb54c[_0x8029('0x3b')];if(!_0xbda09f['query'][_0x8029('0x41')](_0x8029('0x42'))){_0x139b77[_0x8029('0x43')]=qs[_0x8029('0x43')](_0xbda09f[_0x8029('0x3c')][_0x8029('0x43')]);_0x139b77['offset']=qs[_0x8029('0x2c')](_0xbda09f['query'][_0x8029('0x2c')]);}_0x139b77['order']=qs[_0x8029('0x44')](_0xbda09f[_0x8029('0x3c')][_0x8029('0x44')]);_0x139b77[_0x8029('0x45')]=qs[_0x8029('0x3d')](_[_0x8029('0x46')](_0xbda09f[_0x8029('0x3c')],_0x7cb54c['filters']));if(_0xbda09f[_0x8029('0x3c')]['filter']){_0x139b77[_0x8029('0x45')]=_[_0x8029('0x47')](_0x139b77['where'],{'$or':_[_0x8029('0x36')](_0x1b5315,function(_0x4e2c23){if(_0x4e2c23[_0x8029('0x39')]!=='VIRTUAL'){var _0x16521c={};_0x16521c[_0x4e2c23[_0x8029('0x33')]]={'$like':'%'+_0xbda09f[_0x8029('0x3c')][_0x8029('0x48')]+'%'};return _0x16521c;}})});}_0x139b77=_[_0x8029('0x47')]({},_0x139b77,_0xbda09f[_0x8029('0x49')]);var _0xf69de2={'where':_0x139b77[_0x8029('0x45')]};return db[_0x8029('0x37')][_0x8029('0x2b')](_0xf69de2)[_0x8029('0x32')](function(_0xb408ae){_0x403256[_0x8029('0x2b')]=_0xb408ae;if(_0xbda09f[_0x8029('0x3c')]['includeAll']){_0x139b77['include']=[{'all':!![]}];}return db[_0x8029('0x37')][_0x8029('0x4a')](_0x139b77);})[_0x8029('0x32')](function(_0x5f31ec){_0x403256[_0x8029('0x4b')]=_0x5f31ec;return _0x403256;})[_0x8029('0x32')](respondWithFilteredResult(_0x23037c,_0x139b77))[_0x8029('0x26')](handleError(_0x23037c,null));};exports[_0x8029('0x4c')]=function(_0x462fea,_0x5255f6){var _0x5cdc5c={'raw':![],'where':{'id':_0x462fea[_0x8029('0x4d')]['id']}},_0x47724b={};_0x47724b[_0x8029('0x3b')]=_[_0x8029('0x4e')](db[_0x8029('0x37')][_0x8029('0x38')]);_0x47724b[_0x8029('0x3c')]=_['keys'](_0x462fea[_0x8029('0x3c')]);_0x47724b['filters']=_[_0x8029('0x3e')](_0x47724b['model'],_0x47724b['query']);_0x5cdc5c[_0x8029('0x3f')]=_[_0x8029('0x3e')](_0x47724b['model'],qs['fields'](_0x462fea[_0x8029('0x3c')][_0x8029('0x40')]));_0x5cdc5c[_0x8029('0x3f')]=_0x5cdc5c[_0x8029('0x3f')][_0x8029('0x4f')]?_0x5cdc5c[_0x8029('0x3f')]:_0x47724b[_0x8029('0x3b')];if(_0x462fea['query']['includeAll']){_0x5cdc5c[_0x8029('0x50')]=[{'all':!![]}];}_0x5cdc5c=_['merge']({},_0x5cdc5c,_0x462fea[_0x8029('0x49')]);return db[_0x8029('0x37')]['find'](_0x5cdc5c)['then'](handleEntityNotFound(_0x5255f6,null))['then'](respondWithResult(_0x5255f6,null))['catch'](handleError(_0x5255f6,null));};exports['create']=function(_0x2fb465,_0x30d0aa){return db[_0x8029('0x37')]['create'](_0x2fb465['body'],{})[_0x8029('0x32')](respondWithResult(_0x30d0aa,0xc9))['catch'](handleError(_0x30d0aa,null));};exports[_0x8029('0x31')]=function(_0x5caffa,_0x1509ff){if(_0x5caffa[_0x8029('0x51')]['id']){delete _0x5caffa['body']['id'];}return db[_0x8029('0x37')]['find']({'where':{'id':_0x5caffa['params']['id']}})[_0x8029('0x32')](handleEntityNotFound(_0x1509ff,null))[_0x8029('0x32')](saveUpdates(_0x5caffa[_0x8029('0x51')],null))[_0x8029('0x32')](respondWithResult(_0x1509ff,null))[_0x8029('0x26')](handleError(_0x1509ff,null));};exports[_0x8029('0x52')]=function(_0x13bf56,_0x4636a0){return db[_0x8029('0x37')]['find']({'where':{'id':_0x13bf56[_0x8029('0x4d')]['id']}})[_0x8029('0x32')](handleEntityNotFound(_0x4636a0,null))[_0x8029('0x32')](removeEntity(_0x4636a0,null))[_0x8029('0x26')](handleError(_0x4636a0,null));};exports[_0x8029('0x53')]=function(_0x21fd30,_0x1e4496,_0xad1fe){var _0x52c3d8={};var _0x2f67f8={};var _0x37f1f4;var _0x5e2485;return db[_0x8029('0x37')][_0x8029('0x54')]({'where':{'id':_0x21fd30[_0x8029('0x4d')]['id']}})['then'](handleEntityNotFound(_0x1e4496,null))[_0x8029('0x32')](function(_0xc5d037){if(_0xc5d037){_0x37f1f4=_0xc5d037;_0x2f67f8[_0x8029('0x3b')]=_['keys'](db[_0x8029('0x55')]['rawAttributes']);_0x2f67f8[_0x8029('0x3c')]=_[_0x8029('0x4e')](_0x21fd30[_0x8029('0x3c')]);_0x2f67f8[_0x8029('0x3d')]=_[_0x8029('0x3e')](_0x2f67f8[_0x8029('0x3b')],_0x2f67f8['query']);_0x52c3d8[_0x8029('0x3f')]=_[_0x8029('0x3e')](_0x2f67f8[_0x8029('0x3b')],qs[_0x8029('0x40')](_0x21fd30[_0x8029('0x3c')][_0x8029('0x40')]));_0x52c3d8[_0x8029('0x3f')]=_0x52c3d8['attributes'][_0x8029('0x4f')]?_0x52c3d8[_0x8029('0x3f')]:_0x2f67f8[_0x8029('0x3b')];_0x52c3d8[_0x8029('0x56')]=qs[_0x8029('0x44')](_0x21fd30['query'][_0x8029('0x44')]);_0x52c3d8[_0x8029('0x45')]=qs[_0x8029('0x3d')](_[_0x8029('0x46')](_0x21fd30[_0x8029('0x3c')],_0x2f67f8[_0x8029('0x3d')]));if(_0x21fd30[_0x8029('0x3c')]['filter']){_0x52c3d8['where']=_['merge'](_0x52c3d8[_0x8029('0x45')],{'$or':_[_0x8029('0x36')](_0x52c3d8[_0x8029('0x3f')],function(_0x4f68d9){var _0x1d75a3={};_0x1d75a3[_0x4f68d9]={'$like':'%'+_0x21fd30[_0x8029('0x3c')][_0x8029('0x48')]+'%'};return _0x1d75a3;})});}_0x52c3d8=_[_0x8029('0x47')]({},_0x52c3d8,_0x21fd30[_0x8029('0x49')]);return _0x37f1f4[_0x8029('0x53')](_0x52c3d8);}})[_0x8029('0x32')](function(_0x44d258){if(_0x44d258){_0x5e2485=_0x44d258['length'];if(!_0x21fd30['query'][_0x8029('0x41')](_0x8029('0x42'))){_0x52c3d8['limit']=qs[_0x8029('0x43')](_0x21fd30[_0x8029('0x3c')][_0x8029('0x43')]);_0x52c3d8['offset']=qs[_0x8029('0x2c')](_0x21fd30['query'][_0x8029('0x2c')]);}return _0x37f1f4[_0x8029('0x53')](_0x52c3d8);}})[_0x8029('0x32')](function(_0x262d61){if(_0x262d61){return _0x262d61?{'count':_0x5e2485,'rows':_0x262d61}:null;}})[_0x8029('0x32')](respondWithResult(_0x1e4496,null))[_0x8029('0x26')](handleError(_0x1e4496,null));};exports[_0x8029('0x57')]=function(_0x34495b,_0x38907f,_0x5b99ce){if(_0x34495b[_0x8029('0x51')]['id']){delete _0x34495b[_0x8029('0x51')]['id'];}return db[_0x8029('0x37')][_0x8029('0x54')]({'where':{'id':_0x34495b[_0x8029('0x4d')]['id']}})[_0x8029('0x32')](handleEntityNotFound(_0x38907f,null))[_0x8029('0x32')](function(_0x1635e6){if(_0x1635e6){_0x34495b['body'][_0x8029('0x58')]=_0x1635e6['id'];_0x34495b['body'][_0x8029('0x59')]=integrations[_0x8029('0x5a')](_0x34495b[_0x8029('0x51')][_0x8029('0x5b')],_0x34495b[_0x8029('0x51')][_0x8029('0x39')]);_0x34495b[_0x8029('0x51')][_0x8029('0x5c')]=integrations['getDescriptions'](_0x34495b[_0x8029('0x51')][_0x8029('0x5b')],_0x34495b[_0x8029('0x51')][_0x8029('0x39')]);return db[_0x8029('0x55')][_0x8029('0x5d')](_0x34495b[_0x8029('0x51')],{'include':[{'model':db[_0x8029('0x5e')],'as':_0x8029('0x59')},{'model':db[_0x8029('0x5e')],'as':_0x8029('0x5c')}]});}return null;})[_0x8029('0x32')](respondWithResult(_0x38907f,null))[_0x8029('0x26')](handleError(_0x38907f,null));};exports['getFields']=function(_0x3649de,_0x5650c8,_0x516cbf){var _0x2f7e15='';var _0x133368='';return db['FreshsalesAccount'][_0x8029('0x54')]({'where':{'id':_0x3649de[_0x8029('0x4d')]['id']},'attributes':['id',_0x8029('0x5f'),_0x8029('0x60'),_0x8029('0x61')]})['then'](handleEntityNotFound(_0x5650c8,null))[_0x8029('0x32')](function(_0x4fa49c){if(_0x4fa49c){_0x133368=_0x4fa49c[_0x8029('0x5f')];_0x2f7e15=_0x4fa49c['remoteUri'];var _0x1f1f97=_0x4fa49c[_0x8029('0x60')]['slice'](-0x1);if(_0x1f1f97==='/'){_0x2f7e15=_0x2f7e15['substring'](0x0,_0x2f7e15[_0x8029('0x62')](_0x1f1f97));}return rp({'method':'GET','uri':util[_0x8029('0x63')](_0x8029('0x64'),_0x2f7e15,_0x8029('0x65')),'headers':{'Authorization':_0x8029('0x66')+_0x4fa49c[_0x8029('0x61')]},'json':!![]});}})['then'](function(_0xcea16a){if(_0xcea16a){var _0x5e9f18=_0xcea16a[_0x8029('0x67')];var _0x3e3d62=![];var _0x105dd3=null;for(_0x105dd3=0x0;_0x105dd3<_0x5e9f18['length'];_0x105dd3++){if(_0x5e9f18[_0x105dd3][_0x8029('0x68')]===_0x133368){_0x3e3d62=!![];}}if(_0x3e3d62){return!![];}else{throw new Error({'statusCode':0x194,'message':'Requested\x20Resource\x20not\x20Found'});}}})[_0x8029('0x32')](respondWithResult(_0x5650c8,null))[_0x8029('0x26')](function(_0x974e00){var _0x4ba332=_0x3649de[_0x8029('0x3c')][_0x8029('0x1a')]?0x1f4:_0x974e00[_0x8029('0x69')]||0x1f4;logger[_0x8029('0x22')](_0x8029('0x6a'),_0x8029('0x6b'),_0x4ba332,JSON[_0x8029('0x6c')](_0x974e00));delete _0x974e00[_0x8029('0x33')];if(_0x4ba332===0x191){_0x4ba332=0x190;}_0x5650c8[_0x8029('0x28')](_0x4ba332)[_0x8029('0x34')](_0x3649de['query']['test']?{'message':_0x8029('0x6d'),'statusCode':_0x974e00[_0x8029('0x69')]}:_0x974e00);});}; \ No newline at end of file +var _0x2c92=['limit','order','sort','where','filter','merge','VIRTUAL','options','include','findAll','params','keys','rawAttributes','includeAll','find','body','update','getConfigurations','FreshsalesConfiguration','pick','findOne','AccountId','getSubjects','channel','Descriptions','FreshsalesField','Subjects','getFields','username','remoteUri','apiKey','substring','lastIndexOf','format','%s%s','users','email','statusCode','getFields,\x20%s,\x20%s,\x20%s','Wrong\x20credentials','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','sox','to-csv','ejs','lodash','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','jayson/promise','client','test','Sequelize','request','info','FreshsalesAccount,\x20%s,\x20%s','debug','FreshsalesAccount,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','sendStatus','status','end','json','count','offset','apply','then','destroy','stack','name','send','index','map','FreshsalesAccount','type','key','model','query','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit'];(function(_0x2e3658,_0x1e1acd){var _0x3b0b0c=function(_0x1639de){while(--_0x1639de){_0x2e3658['push'](_0x2e3658['shift']());}};_0x3b0b0c(++_0x1e1acd);}(_0x2c92,0x93));var _0x22c9=function(_0x5e3b04,_0xbb6795){_0x5e3b04=_0x5e3b04-0x0;var _0x1fc44d=_0x2c92[_0x5e3b04];return _0x1fc44d;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x22c9('0x0'));var rimraf=require(_0x22c9('0x1'));var zipdir=require(_0x22c9('0x2'));var jsonpatch=require(_0x22c9('0x3'));var rp=require(_0x22c9('0x4'));var moment=require(_0x22c9('0x5'));var BPromise=require(_0x22c9('0x6'));var Mustache=require('mustache');var util=require(_0x22c9('0x7'));var path=require(_0x22c9('0x8'));var sox=require(_0x22c9('0x9'));var csv=require(_0x22c9('0xa'));var ejs=require(_0x22c9('0xb'));var fs=require('fs');var _=require(_0x22c9('0xc'));var squel=require('squel');var crypto=require(_0x22c9('0xd'));var jsforce=require(_0x22c9('0xe'));var deskjs=require(_0x22c9('0xf'));var toCsv=require(_0x22c9('0xa'));var querystring=require('querystring');var Papa=require(_0x22c9('0x10'));var Redis=require(_0x22c9('0x11'));var authService=require(_0x22c9('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0x22c9('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x22c9('0x14'))(_0x22c9('0x15'));var utils=require(_0x22c9('0x16'));var config=require(_0x22c9('0x17'));var db=require(_0x22c9('0x18'))['db'];var integrations=require('../../components/integrations/configuration');var jayson=require(_0x22c9('0x19'));var client=jayson[_0x22c9('0x1a')]['http']({'port':0x232a});function checkPasswordPattern(_0x2ebdb6,_0x252b04,_0x145427){if(_0x145427){var _0x260b9f=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x260b9f[_0x22c9('0x1b')](_0x252b04)){return _0x2ebdb6;}else{throw new db[(_0x22c9('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 _0x2ebdb6;}}function respondWithRpcPromise(_0x5a8a00,_0x9dc817,_0x317297,_0x3525f7){return new BPromise(function(_0x37ba64,_0x467dfc){var _0x1bff38=_0x3525f7||client;return _0x1bff38[_0x22c9('0x1d')](_0x5a8a00,_0x317297)['then'](function(_0x434651){logger[_0x22c9('0x1e')](_0x22c9('0x1f'),_0x9dc817,'request\x20sent');logger[_0x22c9('0x20')](_0x22c9('0x21'),_0x9dc817,_0x22c9('0x22'),JSON[_0x22c9('0x23')](_0x434651));if(_0x434651[_0x22c9('0x24')]){if(_0x434651[_0x22c9('0x24')][_0x22c9('0x25')]===0x1f4){logger[_0x22c9('0x24')](_0x22c9('0x1f'),_0x9dc817,_0x434651[_0x22c9('0x24')]['message']);return _0x467dfc(_0x434651[_0x22c9('0x24')][_0x22c9('0x26')]);}logger['error'](_0x22c9('0x1f'),_0x9dc817,_0x434651['error']['message']);return _0x37ba64(_0x434651[_0x22c9('0x24')][_0x22c9('0x26')]);}else{logger[_0x22c9('0x1e')](_0x22c9('0x1f'),_0x9dc817,_0x22c9('0x22'));_0x37ba64(_0x434651[_0x22c9('0x27')]['message']);}})[_0x22c9('0x28')](function(_0x292140){logger['error'](_0x22c9('0x1f'),_0x9dc817,_0x292140);_0x467dfc(_0x292140);});});}function respondWithStatusCode(_0x3a38bb,_0xb70b3e){_0xb70b3e=_0xb70b3e||0xcc;return function(_0x355c25){if(_0x355c25){return _0x3a38bb[_0x22c9('0x29')](_0xb70b3e);}return _0x3a38bb[_0x22c9('0x2a')](_0xb70b3e)[_0x22c9('0x2b')]();};}function respondWithResult(_0x52029c,_0x115923){_0x115923=_0x115923||0xc8;return function(_0x303cdd){if(_0x303cdd){return _0x52029c[_0x22c9('0x2a')](_0x115923)[_0x22c9('0x2c')](_0x303cdd);}};}function respondWithFilteredResult(_0x5e171d,_0x47313e){return function(_0x31f25d){if(_0x31f25d){var _0x4eca7f=_0x31f25d[_0x22c9('0x2d')],_0x56c0b2=_0x47313e[_0x22c9('0x2e')],_0xda0dba=_0x47313e[_0x22c9('0x2e')]+_0x47313e['limit'],_0x397cae;if(_0xda0dba>=_0x4eca7f){_0xda0dba=_0x4eca7f;_0x397cae=0xc8;}else{_0x397cae=0xce;}_0x5e171d[_0x22c9('0x2a')](_0x397cae);return _0x5e171d['set']('Content-Range',_0x56c0b2+'-'+_0xda0dba+'/'+_0x4eca7f)[_0x22c9('0x2c')](_0x31f25d);}return null;};}function patchUpdates(_0x1b1892){return function(_0x5bafac){try{jsonpatch[_0x22c9('0x2f')](_0x5bafac,_0x1b1892,!![]);}catch(_0xc88c07){return BPromise['reject'](_0xc88c07);}return _0x5bafac['save']();};}function saveUpdates(_0x204c00,_0x12be8f){return function(_0x5b1c52){if(_0x5b1c52){return _0x5b1c52['update'](_0x204c00)[_0x22c9('0x30')](function(_0x8bd48){return _0x8bd48;});}return null;};}function removeEntity(_0x507652,_0x20bb0a){return function(_0x7648d3){if(_0x7648d3){return _0x7648d3[_0x22c9('0x31')]()['then'](function(){_0x507652[_0x22c9('0x2a')](0xcc)[_0x22c9('0x2b')]();});}};}function handleEntityNotFound(_0x41c35f,_0x5d250a){return function(_0x58b6c1){if(!_0x58b6c1){_0x41c35f[_0x22c9('0x29')](0x194);}return _0x58b6c1;};}function handleError(_0x291295,_0x3e799b){_0x3e799b=_0x3e799b||0x1f4;return function(_0x45539b){logger['error'](_0x45539b[_0x22c9('0x32')]);if(_0x45539b[_0x22c9('0x33')]){delete _0x45539b[_0x22c9('0x33')];}_0x291295['status'](_0x3e799b)[_0x22c9('0x34')](_0x45539b);};}exports[_0x22c9('0x35')]=function(_0x1317bf,_0x1b8b5c){var _0x12ca90={},_0x1d9fe7={},_0x540c1a={'count':0x0,'rows':[]};var _0x2f552d=_[_0x22c9('0x36')](db[_0x22c9('0x37')]['rawAttributes'],function(_0x219296){return{'name':_0x219296['fieldName'],'type':_0x219296[_0x22c9('0x38')][_0x22c9('0x39')]};});_0x1d9fe7[_0x22c9('0x3a')]=_['map'](_0x2f552d,_0x22c9('0x33'));_0x1d9fe7['query']=_['keys'](_0x1317bf[_0x22c9('0x3b')]);_0x1d9fe7[_0x22c9('0x3c')]=_['intersection'](_0x1d9fe7['model'],_0x1d9fe7['query']);_0x12ca90['attributes']=_[_0x22c9('0x3d')](_0x1d9fe7[_0x22c9('0x3a')],qs[_0x22c9('0x3e')](_0x1317bf[_0x22c9('0x3b')][_0x22c9('0x3e')]));_0x12ca90[_0x22c9('0x3f')]=_0x12ca90['attributes'][_0x22c9('0x40')]?_0x12ca90[_0x22c9('0x3f')]:_0x1d9fe7['model'];if(!_0x1317bf['query'][_0x22c9('0x41')](_0x22c9('0x42'))){_0x12ca90['limit']=qs['limit'](_0x1317bf['query'][_0x22c9('0x43')]);_0x12ca90[_0x22c9('0x2e')]=qs['offset'](_0x1317bf[_0x22c9('0x3b')][_0x22c9('0x2e')]);}_0x12ca90[_0x22c9('0x44')]=qs[_0x22c9('0x45')](_0x1317bf[_0x22c9('0x3b')]['sort']);_0x12ca90[_0x22c9('0x46')]=qs[_0x22c9('0x3c')](_['pick'](_0x1317bf[_0x22c9('0x3b')],_0x1d9fe7['filters']));if(_0x1317bf[_0x22c9('0x3b')][_0x22c9('0x47')]){_0x12ca90[_0x22c9('0x46')]=_[_0x22c9('0x48')](_0x12ca90['where'],{'$or':_[_0x22c9('0x36')](_0x2f552d,function(_0x14f7c4){if(_0x14f7c4[_0x22c9('0x38')]!==_0x22c9('0x49')){var _0x26b55f={};_0x26b55f[_0x14f7c4[_0x22c9('0x33')]]={'$like':'%'+_0x1317bf[_0x22c9('0x3b')][_0x22c9('0x47')]+'%'};return _0x26b55f;}})});}_0x12ca90=_[_0x22c9('0x48')]({},_0x12ca90,_0x1317bf[_0x22c9('0x4a')]);var _0x491e75={'where':_0x12ca90[_0x22c9('0x46')]};return db[_0x22c9('0x37')][_0x22c9('0x2d')](_0x491e75)[_0x22c9('0x30')](function(_0x6f935b){_0x540c1a[_0x22c9('0x2d')]=_0x6f935b;if(_0x1317bf[_0x22c9('0x3b')]['includeAll']){_0x12ca90[_0x22c9('0x4b')]=[{'all':!![]}];}return db[_0x22c9('0x37')][_0x22c9('0x4c')](_0x12ca90);})[_0x22c9('0x30')](function(_0x1ed542){_0x540c1a['rows']=_0x1ed542;return _0x540c1a;})[_0x22c9('0x30')](respondWithFilteredResult(_0x1b8b5c,_0x12ca90))[_0x22c9('0x28')](handleError(_0x1b8b5c,null));};exports['show']=function(_0xc96c85,_0x282846){var _0x2a9144={'raw':![],'where':{'id':_0xc96c85[_0x22c9('0x4d')]['id']}},_0x5bcd3d={};_0x5bcd3d[_0x22c9('0x3a')]=_[_0x22c9('0x4e')](db['FreshsalesAccount'][_0x22c9('0x4f')]);_0x5bcd3d[_0x22c9('0x3b')]=_[_0x22c9('0x4e')](_0xc96c85[_0x22c9('0x3b')]);_0x5bcd3d[_0x22c9('0x3c')]=_[_0x22c9('0x3d')](_0x5bcd3d['model'],_0x5bcd3d[_0x22c9('0x3b')]);_0x2a9144[_0x22c9('0x3f')]=_[_0x22c9('0x3d')](_0x5bcd3d[_0x22c9('0x3a')],qs[_0x22c9('0x3e')](_0xc96c85[_0x22c9('0x3b')][_0x22c9('0x3e')]));_0x2a9144['attributes']=_0x2a9144['attributes'][_0x22c9('0x40')]?_0x2a9144[_0x22c9('0x3f')]:_0x5bcd3d[_0x22c9('0x3a')];if(_0xc96c85[_0x22c9('0x3b')][_0x22c9('0x50')]){_0x2a9144[_0x22c9('0x4b')]=[{'all':!![]}];}_0x2a9144=_[_0x22c9('0x48')]({},_0x2a9144,_0xc96c85['options']);return db[_0x22c9('0x37')][_0x22c9('0x51')](_0x2a9144)[_0x22c9('0x30')](handleEntityNotFound(_0x282846,null))[_0x22c9('0x30')](respondWithResult(_0x282846,null))[_0x22c9('0x28')](handleError(_0x282846,null));};exports['create']=function(_0x318c19,_0x493ba8){return db['FreshsalesAccount']['create'](_0x318c19[_0x22c9('0x52')],{})[_0x22c9('0x30')](respondWithResult(_0x493ba8,0xc9))[_0x22c9('0x28')](handleError(_0x493ba8,null));};exports[_0x22c9('0x53')]=function(_0x55596e,_0x358fc7){if(_0x55596e[_0x22c9('0x52')]['id']){delete _0x55596e[_0x22c9('0x52')]['id'];}return db[_0x22c9('0x37')]['find']({'where':{'id':_0x55596e[_0x22c9('0x4d')]['id']}})[_0x22c9('0x30')](handleEntityNotFound(_0x358fc7,null))[_0x22c9('0x30')](saveUpdates(_0x55596e[_0x22c9('0x52')],null))[_0x22c9('0x30')](respondWithResult(_0x358fc7,null))[_0x22c9('0x28')](handleError(_0x358fc7,null));};exports[_0x22c9('0x31')]=function(_0x4e75c9,_0x12ee44){return db[_0x22c9('0x37')][_0x22c9('0x51')]({'where':{'id':_0x4e75c9[_0x22c9('0x4d')]['id']}})[_0x22c9('0x30')](handleEntityNotFound(_0x12ee44,null))[_0x22c9('0x30')](removeEntity(_0x12ee44,null))['catch'](handleError(_0x12ee44,null));};exports[_0x22c9('0x54')]=function(_0x299d85,_0x62f141,_0x1e42a1){var _0x243f39={};var _0x10f85e={};var _0x4f31af;var _0x3bdd39;return db[_0x22c9('0x37')]['findOne']({'where':{'id':_0x299d85['params']['id']}})[_0x22c9('0x30')](handleEntityNotFound(_0x62f141,null))[_0x22c9('0x30')](function(_0x5459e1){if(_0x5459e1){_0x4f31af=_0x5459e1;_0x10f85e[_0x22c9('0x3a')]=_[_0x22c9('0x4e')](db[_0x22c9('0x55')][_0x22c9('0x4f')]);_0x10f85e[_0x22c9('0x3b')]=_['keys'](_0x299d85[_0x22c9('0x3b')]);_0x10f85e[_0x22c9('0x3c')]=_['intersection'](_0x10f85e['model'],_0x10f85e[_0x22c9('0x3b')]);_0x243f39[_0x22c9('0x3f')]=_[_0x22c9('0x3d')](_0x10f85e[_0x22c9('0x3a')],qs[_0x22c9('0x3e')](_0x299d85[_0x22c9('0x3b')][_0x22c9('0x3e')]));_0x243f39[_0x22c9('0x3f')]=_0x243f39['attributes']['length']?_0x243f39[_0x22c9('0x3f')]:_0x10f85e['model'];_0x243f39['order']=qs[_0x22c9('0x45')](_0x299d85[_0x22c9('0x3b')][_0x22c9('0x45')]);_0x243f39['where']=qs[_0x22c9('0x3c')](_[_0x22c9('0x56')](_0x299d85['query'],_0x10f85e[_0x22c9('0x3c')]));if(_0x299d85['query'][_0x22c9('0x47')]){_0x243f39[_0x22c9('0x46')]=_[_0x22c9('0x48')](_0x243f39[_0x22c9('0x46')],{'$or':_[_0x22c9('0x36')](_0x243f39[_0x22c9('0x3f')],function(_0x2e60a7){var _0x5cc0cf={};_0x5cc0cf[_0x2e60a7]={'$like':'%'+_0x299d85[_0x22c9('0x3b')][_0x22c9('0x47')]+'%'};return _0x5cc0cf;})});}_0x243f39=_[_0x22c9('0x48')]({},_0x243f39,_0x299d85['options']);return _0x4f31af[_0x22c9('0x54')](_0x243f39);}})[_0x22c9('0x30')](function(_0x4e5895){if(_0x4e5895){_0x3bdd39=_0x4e5895['length'];if(!_0x299d85[_0x22c9('0x3b')]['hasOwnProperty'](_0x22c9('0x42'))){_0x243f39[_0x22c9('0x43')]=qs[_0x22c9('0x43')](_0x299d85[_0x22c9('0x3b')]['limit']);_0x243f39[_0x22c9('0x2e')]=qs[_0x22c9('0x2e')](_0x299d85[_0x22c9('0x3b')][_0x22c9('0x2e')]);}return _0x4f31af[_0x22c9('0x54')](_0x243f39);}})[_0x22c9('0x30')](function(_0x20b6f4){if(_0x20b6f4){return _0x20b6f4?{'count':_0x3bdd39,'rows':_0x20b6f4}:null;}})[_0x22c9('0x30')](respondWithResult(_0x62f141,null))[_0x22c9('0x28')](handleError(_0x62f141,null));};exports['addConfiguration']=function(_0x3c7db1,_0x350b0f,_0x37c2ff){if(_0x3c7db1[_0x22c9('0x52')]['id']){delete _0x3c7db1[_0x22c9('0x52')]['id'];}return db[_0x22c9('0x37')][_0x22c9('0x57')]({'where':{'id':_0x3c7db1[_0x22c9('0x4d')]['id']}})[_0x22c9('0x30')](handleEntityNotFound(_0x350b0f,null))[_0x22c9('0x30')](function(_0x3b1b5b){if(_0x3b1b5b){_0x3c7db1[_0x22c9('0x52')][_0x22c9('0x58')]=_0x3b1b5b['id'];_0x3c7db1[_0x22c9('0x52')]['Subjects']=integrations[_0x22c9('0x59')](_0x3c7db1[_0x22c9('0x52')][_0x22c9('0x5a')],_0x3c7db1[_0x22c9('0x52')][_0x22c9('0x38')]);_0x3c7db1[_0x22c9('0x52')][_0x22c9('0x5b')]=integrations['getDescriptions'](_0x3c7db1[_0x22c9('0x52')][_0x22c9('0x5a')],_0x3c7db1[_0x22c9('0x52')][_0x22c9('0x38')]);return db[_0x22c9('0x55')]['create'](_0x3c7db1[_0x22c9('0x52')],{'include':[{'model':db[_0x22c9('0x5c')],'as':_0x22c9('0x5d')},{'model':db[_0x22c9('0x5c')],'as':'Descriptions'}]});}return null;})[_0x22c9('0x30')](respondWithResult(_0x350b0f,null))[_0x22c9('0x28')](handleError(_0x350b0f,null));};exports[_0x22c9('0x5e')]=function(_0x16f311,_0x4f0f80,_0x1e0bfa){var _0x5a2249='';var _0x26a0e6='';return db['FreshsalesAccount'][_0x22c9('0x57')]({'where':{'id':_0x16f311[_0x22c9('0x4d')]['id']},'attributes':['id',_0x22c9('0x5f'),_0x22c9('0x60'),_0x22c9('0x61')]})['then'](handleEntityNotFound(_0x4f0f80,null))[_0x22c9('0x30')](function(_0x2d5b36){if(_0x2d5b36){_0x26a0e6=_0x2d5b36[_0x22c9('0x5f')];_0x5a2249=_0x2d5b36[_0x22c9('0x60')];var _0x302ca2=_0x2d5b36['remoteUri']['slice'](-0x1);if(_0x302ca2==='/'){_0x5a2249=_0x5a2249[_0x22c9('0x62')](0x0,_0x5a2249[_0x22c9('0x63')](_0x302ca2));}return rp({'method':'GET','uri':util[_0x22c9('0x64')](_0x22c9('0x65'),_0x5a2249,'/api/selector/owners'),'headers':{'Authorization':'Token\x20token='+_0x2d5b36[_0x22c9('0x61')]},'json':!![]});}})[_0x22c9('0x30')](function(_0x14d805){if(_0x14d805){var _0x4ae4ec=_0x14d805[_0x22c9('0x66')];var _0x4e9327=![];var _0x24c1b6=null;for(_0x24c1b6=0x0;_0x24c1b6<_0x4ae4ec['length'];_0x24c1b6++){if(_0x4ae4ec[_0x24c1b6][_0x22c9('0x67')]===_0x26a0e6){_0x4e9327=!![];}}if(_0x4e9327){return!![];}else{throw new Error({'statusCode':0x194,'message':'Requested\x20Resource\x20not\x20Found'});}}})[_0x22c9('0x30')](respondWithResult(_0x4f0f80,null))[_0x22c9('0x28')](function(_0x5cbf7f){var _0x482765=_0x16f311[_0x22c9('0x3b')]['test']?0x1f4:_0x5cbf7f[_0x22c9('0x68')]||0x1f4;logger[_0x22c9('0x24')](_0x22c9('0x69'),_0x22c9('0x5e'),_0x482765,JSON[_0x22c9('0x23')](_0x5cbf7f));delete _0x5cbf7f[_0x22c9('0x33')];if(_0x482765===0x191){_0x482765=0x190;}_0x4f0f80[_0x22c9('0x2a')](_0x482765)[_0x22c9('0x34')](_0x16f311[_0x22c9('0x3b')][_0x22c9('0x1b')]?{'message':_0x22c9('0x6a'),'statusCode':_0x5cbf7f[_0x22c9('0x68')]}:_0x5cbf7f);});}; \ No newline at end of file diff --git a/server/api/intFreshsalesAccount/intFreshsalesAccount.model.js b/server/api/intFreshsalesAccount/intFreshsalesAccount.model.js index 9c1989e..a690d07 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 _0x082f=['moment','bluebird','request-promise','path','rimraf','../../config/environment','exports','define','FreshsalesAccount','int_freshsales_accounts','util','../../config/logger','api'];(function(_0x344207,_0x1f8049){var _0x24a58f=function(_0x1b2e29){while(--_0x1b2e29){_0x344207['push'](_0x344207['shift']());}};_0x24a58f(++_0x1f8049);}(_0x082f,0xf4));var _0xf082=function(_0x381606,_0x53382c){_0x381606=_0x381606-0x0;var _0x31c4ca=_0x082f[_0x381606];return _0x31c4ca;};'use strict';var _=require('lodash');var util=require(_0xf082('0x0'));var logger=require(_0xf082('0x1'))(_0xf082('0x2'));var moment=require(_0xf082('0x3'));var BPromise=require(_0xf082('0x4'));var rp=require(_0xf082('0x5'));var fs=require('fs');var path=require(_0xf082('0x6'));var rimraf=require(_0xf082('0x7'));var config=require(_0xf082('0x8'));var attributes=require('./intFreshsalesAccount.attributes');var integrations=require('../../components/integrations/configuration');module[_0xf082('0x9')]=function(_0x36a099,_0x4e899e){return _0x36a099[_0xf082('0xa')](_0xf082('0xb'),attributes,{'tableName':_0xf082('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x8952=['api','moment','bluebird','path','rimraf','../../config/environment','../../components/integrations/configuration','exports','FreshsalesAccount','int_freshsales_accounts','util','../../config/logger'];(function(_0x2c1aa8,_0x3e0609){var _0x4019f5=function(_0x916eac){while(--_0x916eac){_0x2c1aa8['push'](_0x2c1aa8['shift']());}};_0x4019f5(++_0x3e0609);}(_0x8952,0x17e));var _0x2895=function(_0x473ad1,_0xcc08c1){_0x473ad1=_0x473ad1-0x0;var _0x585a2d=_0x8952[_0x473ad1];return _0x585a2d;};'use strict';var _=require('lodash');var util=require(_0x2895('0x0'));var logger=require(_0x2895('0x1'))(_0x2895('0x2'));var moment=require(_0x2895('0x3'));var BPromise=require(_0x2895('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x2895('0x5'));var rimraf=require(_0x2895('0x6'));var config=require(_0x2895('0x7'));var attributes=require('./intFreshsalesAccount.attributes');var integrations=require(_0x2895('0x8'));module[_0x2895('0x9')]=function(_0x37305b,_0x4ea619){return _0x37305b['define'](_0x2895('0xa'),attributes,{'tableName':_0x2895('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intFreshsalesAccount/intFreshsalesAccount.rpc.js b/server/api/intFreshsalesAccount/intFreshsalesAccount.rpc.js index 3296f0f..397a6c1 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 _0xd1ca=['info','FreshsalesAccount,\x20%s,\x20%s','request\x20sent','debug','FreshsalesAccount,\x20%s,\x20%s,\x20%s','error','message','result','catch','GetFreshsalesAccount','FreshsalesAccount','findAll','options','raw','attributes','limit','map','include','model','ShowFreshsalesAccount','find','where','stringify','lodash','util','ioredis','../../mysqldb','../../config/utils','rpc','client','http','request','then'];(function(_0x52b195,_0x4bd9f9){var _0x259e65=function(_0x125f94){while(--_0x125f94){_0x52b195['push'](_0x52b195['shift']());}};_0x259e65(++_0x4bd9f9);}(_0xd1ca,0x140));var _0xad1c=function(_0x1d1779,_0x284147){_0x1d1779=_0x1d1779-0x0;var _0x2377e9=_0xd1ca[_0x1d1779];return _0x2377e9;};'use strict';var _=require(_0xad1c('0x0'));var util=require(_0xad1c('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xad1c('0x2'));var db=require(_0xad1c('0x3'))['db'];var utils=require(_0xad1c('0x4'));var logger=require('../../config/logger')(_0xad1c('0x5'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0xad1c('0x6')][_0xad1c('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x3953ef,_0x5eb923,_0x353097){return new BPromise(function(_0x51b05c,_0x45bfc8){return client[_0xad1c('0x8')](_0x3953ef,_0x353097)[_0xad1c('0x9')](function(_0x8238ed){logger[_0xad1c('0xa')](_0xad1c('0xb'),_0x5eb923,_0xad1c('0xc'));logger[_0xad1c('0xd')](_0xad1c('0xe'),_0x5eb923,_0xad1c('0xc'),JSON['stringify'](_0x8238ed));if(_0x8238ed[_0xad1c('0xf')]){if(_0x8238ed[_0xad1c('0xf')]['code']===0x1f4){logger[_0xad1c('0xf')](_0xad1c('0xb'),_0x5eb923,_0x8238ed[_0xad1c('0xf')][_0xad1c('0x10')]);return _0x45bfc8(_0x8238ed[_0xad1c('0xf')][_0xad1c('0x10')]);}logger[_0xad1c('0xf')]('FreshsalesAccount,\x20%s,\x20%s',_0x5eb923,_0x8238ed[_0xad1c('0xf')][_0xad1c('0x10')]);return _0x51b05c(_0x8238ed[_0xad1c('0xf')][_0xad1c('0x10')]);}else{logger[_0xad1c('0xa')]('FreshsalesAccount,\x20%s,\x20%s',_0x5eb923,_0xad1c('0xc'));_0x51b05c(_0x8238ed[_0xad1c('0x11')][_0xad1c('0x10')]);}})[_0xad1c('0x12')](function(_0x4aa785){logger[_0xad1c('0xf')]('FreshsalesAccount,\x20%s,\x20%s',_0x5eb923,_0x4aa785);_0x45bfc8(_0x4aa785);});});}exports[_0xad1c('0x13')]=function(_0x417112){var _0x536fc9=this;return new Promise(function(_0x587867,_0x2c8a0d){return db[_0xad1c('0x14')][_0xad1c('0x15')]({'raw':_0x417112[_0xad1c('0x16')]?_0x417112['options'][_0xad1c('0x17')]===undefined?!![]:![]:!![],'where':_0x417112[_0xad1c('0x16')]?_0x417112[_0xad1c('0x16')]['where']||null:null,'attributes':_0x417112['options']?_0x417112[_0xad1c('0x16')][_0xad1c('0x18')]||null:null,'limit':_0x417112[_0xad1c('0x16')]?_0x417112[_0xad1c('0x16')][_0xad1c('0x19')]||null:null,'include':_0x417112[_0xad1c('0x16')]?_0x417112[_0xad1c('0x16')]['include']?_[_0xad1c('0x1a')](_0x417112[_0xad1c('0x16')][_0xad1c('0x1b')],function(_0x509c13){return{'model':db[_0x509c13[_0xad1c('0x1c')]],'as':_0x509c13['as'],'attributes':_0x509c13[_0xad1c('0x18')],'include':_0x509c13['include']?_[_0xad1c('0x1a')](_0x509c13['include'],function(_0x3893a3){return{'model':db[_0x3893a3[_0xad1c('0x1c')]],'as':_0x3893a3['as'],'attributes':_0x3893a3[_0xad1c('0x18')],'include':_0x3893a3[_0xad1c('0x1b')]?_['map'](_0x3893a3[_0xad1c('0x1b')],function(_0x996162){return{'model':db[_0x996162[_0xad1c('0x1c')]],'as':_0x996162['as'],'attributes':_0x996162[_0xad1c('0x18')]};}):[]};}):[]};}):[]:[]})[_0xad1c('0x9')](function(_0x5c1203){logger[_0xad1c('0xa')]('GetFreshsalesAccount',_0x417112);logger[_0xad1c('0xd')](_0xad1c('0x13'),_0x417112,JSON['stringify'](_0x5c1203));_0x587867(_0x5c1203);})[_0xad1c('0x12')](function(_0x8e1238){logger[_0xad1c('0xf')]('GetFreshsalesAccount',_0x8e1238['message'],_0x417112);_0x2c8a0d(_0x536fc9[_0xad1c('0xf')](0x1f4,_0x8e1238['message']));});});};exports[_0xad1c('0x1d')]=function(_0x5294f6){var _0x448b36=this;return new Promise(function(_0x55d377,_0xd715a3){return db[_0xad1c('0x14')][_0xad1c('0x1e')]({'raw':_0x5294f6[_0xad1c('0x16')]?_0x5294f6[_0xad1c('0x16')][_0xad1c('0x17')]===undefined?!![]:![]:!![],'where':_0x5294f6[_0xad1c('0x16')]?_0x5294f6[_0xad1c('0x16')][_0xad1c('0x1f')]||null:null,'attributes':_0x5294f6[_0xad1c('0x16')]?_0x5294f6['options'][_0xad1c('0x18')]||null:null,'include':_0x5294f6[_0xad1c('0x16')]?_0x5294f6['options'][_0xad1c('0x1b')]?_[_0xad1c('0x1a')](_0x5294f6[_0xad1c('0x16')]['include'],function(_0x48cc83){return{'model':db[_0x48cc83[_0xad1c('0x1c')]],'as':_0x48cc83['as'],'attributes':_0x48cc83['attributes'],'include':_0x48cc83[_0xad1c('0x1b')]?_[_0xad1c('0x1a')](_0x48cc83[_0xad1c('0x1b')],function(_0x1ceeae){return{'model':db[_0x1ceeae[_0xad1c('0x1c')]],'as':_0x1ceeae['as'],'attributes':_0x1ceeae['attributes'],'include':_0x1ceeae[_0xad1c('0x1b')]?_[_0xad1c('0x1a')](_0x1ceeae[_0xad1c('0x1b')],function(_0x1faa36){return{'model':db[_0x1faa36[_0xad1c('0x1c')]],'as':_0x1faa36['as'],'attributes':_0x1faa36['attributes']};}):[]};}):[]};}):[]:[]})[_0xad1c('0x9')](function(_0x3c9a94){logger[_0xad1c('0xa')](_0xad1c('0x1d'),_0x5294f6);logger[_0xad1c('0xd')](_0xad1c('0x1d'),_0x5294f6,JSON[_0xad1c('0x20')](_0x3c9a94));_0x55d377(_0x3c9a94);})[_0xad1c('0x12')](function(_0x2dcdbb){logger['error'](_0xad1c('0x1d'),_0x2dcdbb[_0xad1c('0x10')],_0x5294f6);_0xd715a3(_0x448b36[_0xad1c('0xf')](0x1f4,_0x2dcdbb['message']));});});}; \ No newline at end of file +var _0x27eb=['stringify','find','where','ShowFreshsalesAccount','lodash','util','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','info','FreshsalesAccount,\x20%s,\x20%s','debug','FreshsalesAccount,\x20%s,\x20%s,\x20%s','error','code','message','request\x20sent','result','catch','GetFreshsalesAccount','FreshsalesAccount','options','attributes','limit','include','model','map'];(function(_0x506826,_0x363358){var _0x14c0b2=function(_0x118034){while(--_0x118034){_0x506826['push'](_0x506826['shift']());}};_0x14c0b2(++_0x363358);}(_0x27eb,0xd0));var _0xb27e=function(_0xbe72a9,_0x391939){_0xbe72a9=_0xbe72a9-0x0;var _0x47e6ad=_0x27eb[_0xbe72a9];return _0x47e6ad;};'use strict';var _=require(_0xb27e('0x0'));var util=require(_0xb27e('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0xb27e('0x2'));var fs=require('fs');var Redis=require(_0xb27e('0x3'));var db=require(_0xb27e('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0xb27e('0x5'))(_0xb27e('0x6'));var config=require(_0xb27e('0x7'));var jayson=require(_0xb27e('0x8'));var client=jayson['client'][_0xb27e('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x333512,_0x1e76db,_0x45c0ea){return new BPromise(function(_0x3b0cb4,_0x4c3857){return client[_0xb27e('0xa')](_0x333512,_0x45c0ea)[_0xb27e('0xb')](function(_0x694d26){logger[_0xb27e('0xc')](_0xb27e('0xd'),_0x1e76db,'request\x20sent');logger[_0xb27e('0xe')](_0xb27e('0xf'),_0x1e76db,'request\x20sent',JSON['stringify'](_0x694d26));if(_0x694d26[_0xb27e('0x10')]){if(_0x694d26['error'][_0xb27e('0x11')]===0x1f4){logger[_0xb27e('0x10')]('FreshsalesAccount,\x20%s,\x20%s',_0x1e76db,_0x694d26['error']['message']);return _0x4c3857(_0x694d26[_0xb27e('0x10')]['message']);}logger[_0xb27e('0x10')]('FreshsalesAccount,\x20%s,\x20%s',_0x1e76db,_0x694d26[_0xb27e('0x10')]['message']);return _0x3b0cb4(_0x694d26[_0xb27e('0x10')][_0xb27e('0x12')]);}else{logger[_0xb27e('0xc')]('FreshsalesAccount,\x20%s,\x20%s',_0x1e76db,_0xb27e('0x13'));_0x3b0cb4(_0x694d26[_0xb27e('0x14')][_0xb27e('0x12')]);}})[_0xb27e('0x15')](function(_0x240767){logger[_0xb27e('0x10')](_0xb27e('0xd'),_0x1e76db,_0x240767);_0x4c3857(_0x240767);});});}exports[_0xb27e('0x16')]=function(_0x317f4e){var _0x48b70f=this;return new Promise(function(_0x8be243,_0x165295){return db[_0xb27e('0x17')]['findAll']({'raw':_0x317f4e[_0xb27e('0x18')]?_0x317f4e['options']['raw']===undefined?!![]:![]:!![],'where':_0x317f4e[_0xb27e('0x18')]?_0x317f4e[_0xb27e('0x18')]['where']||null:null,'attributes':_0x317f4e[_0xb27e('0x18')]?_0x317f4e[_0xb27e('0x18')][_0xb27e('0x19')]||null:null,'limit':_0x317f4e[_0xb27e('0x18')]?_0x317f4e['options'][_0xb27e('0x1a')]||null:null,'include':_0x317f4e['options']?_0x317f4e[_0xb27e('0x18')][_0xb27e('0x1b')]?_['map'](_0x317f4e['options'][_0xb27e('0x1b')],function(_0xfbc258){return{'model':db[_0xfbc258[_0xb27e('0x1c')]],'as':_0xfbc258['as'],'attributes':_0xfbc258[_0xb27e('0x19')],'include':_0xfbc258[_0xb27e('0x1b')]?_['map'](_0xfbc258[_0xb27e('0x1b')],function(_0x4cba0b){return{'model':db[_0x4cba0b[_0xb27e('0x1c')]],'as':_0x4cba0b['as'],'attributes':_0x4cba0b[_0xb27e('0x19')],'include':_0x4cba0b[_0xb27e('0x1b')]?_[_0xb27e('0x1d')](_0x4cba0b[_0xb27e('0x1b')],function(_0x4dab95){return{'model':db[_0x4dab95[_0xb27e('0x1c')]],'as':_0x4dab95['as'],'attributes':_0x4dab95['attributes']};}):[]};}):[]};}):[]:[]})[_0xb27e('0xb')](function(_0x2f44f3){logger[_0xb27e('0xc')](_0xb27e('0x16'),_0x317f4e);logger[_0xb27e('0xe')](_0xb27e('0x16'),_0x317f4e,JSON[_0xb27e('0x1e')](_0x2f44f3));_0x8be243(_0x2f44f3);})[_0xb27e('0x15')](function(_0x42c5de){logger['error'](_0xb27e('0x16'),_0x42c5de[_0xb27e('0x12')],_0x317f4e);_0x165295(_0x48b70f[_0xb27e('0x10')](0x1f4,_0x42c5de[_0xb27e('0x12')]));});});};exports['ShowFreshsalesAccount']=function(_0x1ba773){var _0x28927a=this;return new Promise(function(_0xbcc473,_0x3dccaa){return db[_0xb27e('0x17')][_0xb27e('0x1f')]({'raw':_0x1ba773[_0xb27e('0x18')]?_0x1ba773['options']['raw']===undefined?!![]:![]:!![],'where':_0x1ba773[_0xb27e('0x18')]?_0x1ba773['options'][_0xb27e('0x20')]||null:null,'attributes':_0x1ba773['options']?_0x1ba773[_0xb27e('0x18')][_0xb27e('0x19')]||null:null,'include':_0x1ba773[_0xb27e('0x18')]?_0x1ba773[_0xb27e('0x18')][_0xb27e('0x1b')]?_[_0xb27e('0x1d')](_0x1ba773['options'][_0xb27e('0x1b')],function(_0x5042c4){return{'model':db[_0x5042c4[_0xb27e('0x1c')]],'as':_0x5042c4['as'],'attributes':_0x5042c4['attributes'],'include':_0x5042c4[_0xb27e('0x1b')]?_['map'](_0x5042c4[_0xb27e('0x1b')],function(_0x292315){return{'model':db[_0x292315['model']],'as':_0x292315['as'],'attributes':_0x292315['attributes'],'include':_0x292315[_0xb27e('0x1b')]?_['map'](_0x292315['include'],function(_0x58fb5b){return{'model':db[_0x58fb5b[_0xb27e('0x1c')]],'as':_0x58fb5b['as'],'attributes':_0x58fb5b[_0xb27e('0x19')]};}):[]};}):[]};}):[]:[]})['then'](function(_0xa6ff7b){logger[_0xb27e('0xc')]('ShowFreshsalesAccount',_0x1ba773);logger['debug'](_0xb27e('0x21'),_0x1ba773,JSON['stringify'](_0xa6ff7b));_0xbcc473(_0xa6ff7b);})[_0xb27e('0x15')](function(_0x551038){logger[_0xb27e('0x10')](_0xb27e('0x21'),_0x551038[_0xb27e('0x12')],_0x1ba773);_0x3dccaa(_0x28927a[_0xb27e('0x10')](0x1f4,_0x551038[_0xb27e('0x12')]));});});}; \ No newline at end of file diff --git a/server/api/intFreshsalesConfiguration/index.js b/server/api/intFreshsalesConfiguration/index.js index b30e842..3f98feb 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 _0x6c3a=['getFields','post','create','update','delete','destroy','util','path','connect-timeout','express','Router','../../components/interaction/service','./intFreshsalesConfiguration.controller','get','isAuthenticated','index','/:id','show','getSubjects','/:id/descriptions','getDescriptions','/:id/fields'];(function(_0xa1f942,_0x246898){var _0x5d5177=function(_0x52c75a){while(--_0x52c75a){_0xa1f942['push'](_0xa1f942['shift']());}};_0x5d5177(++_0x246898);}(_0x6c3a,0xe2));var _0xa6c3=function(_0x2a6809,_0x44edde){_0x2a6809=_0x2a6809-0x0;var _0x11c371=_0x6c3a[_0x2a6809];return _0x11c371;};'use strict';var multer=require('multer');var util=require(_0xa6c3('0x0'));var path=require(_0xa6c3('0x1'));var timeout=require(_0xa6c3('0x2'));var express=require(_0xa6c3('0x3'));var router=express[_0xa6c3('0x4')]();var auth=require('../../components/auth/service');var interaction=require(_0xa6c3('0x5'));var config=require('../../config/environment');var controller=require(_0xa6c3('0x6'));router[_0xa6c3('0x7')]('/',auth[_0xa6c3('0x8')](),controller[_0xa6c3('0x9')]);router[_0xa6c3('0x7')](_0xa6c3('0xa'),auth[_0xa6c3('0x8')](),controller[_0xa6c3('0xb')]);router[_0xa6c3('0x7')]('/:id/subjects',auth[_0xa6c3('0x8')](),controller[_0xa6c3('0xc')]);router[_0xa6c3('0x7')](_0xa6c3('0xd'),auth[_0xa6c3('0x8')](),controller[_0xa6c3('0xe')]);router[_0xa6c3('0x7')](_0xa6c3('0xf'),auth[_0xa6c3('0x8')](),controller[_0xa6c3('0x10')]);router[_0xa6c3('0x11')]('/',auth[_0xa6c3('0x8')](),controller[_0xa6c3('0x12')]);router['put'](_0xa6c3('0xa'),auth['isAuthenticated'](),controller[_0xa6c3('0x13')]);router[_0xa6c3('0x14')](_0xa6c3('0xa'),auth['isAuthenticated'](),controller[_0xa6c3('0x15')]);module['exports']=router; \ No newline at end of file +var _0x1c6e=['destroy','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','./intFreshsalesConfiguration.controller','get','index','/:id','isAuthenticated','show','/:id/subjects','getSubjects','/:id/descriptions','/:id/fields','getFields','post','create','delete'];(function(_0x41766c,_0x375417){var _0x243ef8=function(_0x35b689){while(--_0x35b689){_0x41766c['push'](_0x41766c['shift']());}};_0x243ef8(++_0x375417);}(_0x1c6e,0x1e5));var _0xe1c6=function(_0x35d4e9,_0x298c61){_0x35d4e9=_0x35d4e9-0x0;var _0x5c2770=_0x1c6e[_0x35d4e9];return _0x5c2770;};'use strict';var multer=require(_0xe1c6('0x0'));var util=require(_0xe1c6('0x1'));var path=require(_0xe1c6('0x2'));var timeout=require(_0xe1c6('0x3'));var express=require(_0xe1c6('0x4'));var router=express[_0xe1c6('0x5')]();var auth=require(_0xe1c6('0x6'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0xe1c6('0x7'));router[_0xe1c6('0x8')]('/',auth['isAuthenticated'](),controller[_0xe1c6('0x9')]);router[_0xe1c6('0x8')](_0xe1c6('0xa'),auth[_0xe1c6('0xb')](),controller[_0xe1c6('0xc')]);router[_0xe1c6('0x8')](_0xe1c6('0xd'),auth[_0xe1c6('0xb')](),controller[_0xe1c6('0xe')]);router[_0xe1c6('0x8')](_0xe1c6('0xf'),auth[_0xe1c6('0xb')](),controller['getDescriptions']);router[_0xe1c6('0x8')](_0xe1c6('0x10'),auth['isAuthenticated'](),controller[_0xe1c6('0x11')]);router[_0xe1c6('0x12')]('/',auth[_0xe1c6('0xb')](),controller[_0xe1c6('0x13')]);router['put'](_0xe1c6('0xa'),auth[_0xe1c6('0xb')](),controller['update']);router[_0xe1c6('0x14')](_0xe1c6('0xa'),auth['isAuthenticated'](),controller[_0xe1c6('0x15')]);module[_0xe1c6('0x16')]=router; \ No newline at end of file diff --git a/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.attributes.js b/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.attributes.js index 2e6fa9e..b9518a4 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 _0x7437=['exports','STRING'];(function(_0x567e8c,_0xcc3a11){var _0xc46c53=function(_0x5b2e59){while(--_0x5b2e59){_0x567e8c['push'](_0x567e8c['shift']());}};_0xc46c53(++_0xcc3a11);}(_0x7437,0x174));var _0x7743=function(_0x13ea36,_0x2805ad){_0x13ea36=_0x13ea36-0x0;var _0x312066=_0x7437[_0x13ea36];return _0x312066;};'use strict';var Sequelize=require('sequelize');module[_0x7743('0x0')]={'name':{'type':Sequelize[_0x7743('0x1')]},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0xf989=['STRING','sequelize','exports'];(function(_0x3cc9d9,_0x69ed38){var _0x1a425d=function(_0x44d109){while(--_0x44d109){_0x3cc9d9['push'](_0x3cc9d9['shift']());}};_0x1a425d(++_0x69ed38);}(_0xf989,0x15d));var _0x9f98=function(_0x4fdcc0,_0x560a01){_0x4fdcc0=_0x4fdcc0-0x0;var _0xc0ce94=_0xf989[_0x4fdcc0];return _0xc0ce94;};'use strict';var Sequelize=require(_0x9f98('0x0'));module[_0x9f98('0x1')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0x9f98('0x2')]}}; \ No newline at end of file diff --git a/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.controller.js b/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.controller.js index aed8b2e..6355c6e 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 _0xff2a=['FreshsalesConfiguration,\x20%s,\x20%s','request\x20sent','debug','FreshsalesConfiguration,\x20%s,\x20%s,\x20%s','error','code','message','catch','sendStatus','status','end','json','count','offset','limit','set','Content-Range','apply','destroy','then','name','send','index','FreshsalesConfiguration','type','model','query','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','where','merge','VIRTUAL','filter','includeAll','include','findAll','rows','show','params','keys','rawAttributes','options','create','body','find','getSubjects','findOne','FreshsalesField','map','getDescriptions','pick','getFields','eml-format','rimraf','fast-json-patch','request-promise','bluebird','util','path','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','jayson/promise','client','http','test','ValidationError','request','info'];(function(_0x1d84b1,_0x599872){var _0x54fa39=function(_0x48ef05){while(--_0x48ef05){_0x1d84b1['push'](_0x1d84b1['shift']());}};_0x54fa39(++_0x599872);}(_0xff2a,0x93));var _0xaff2=function(_0x187e82,_0x5254eb){_0x187e82=_0x187e82-0x0;var _0x58625e=_0xff2a[_0x187e82];return _0x58625e;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0xaff2('0x0'));var rimraf=require(_0xaff2('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xaff2('0x2'));var rp=require(_0xaff2('0x3'));var moment=require('moment');var BPromise=require(_0xaff2('0x4'));var Mustache=require('mustache');var util=require(_0xaff2('0x5'));var path=require(_0xaff2('0x6'));var sox=require('sox');var csv=require(_0xaff2('0x7'));var ejs=require(_0xaff2('0x8'));var fs=require('fs');var _=require(_0xaff2('0x9'));var squel=require(_0xaff2('0xa'));var crypto=require(_0xaff2('0xb'));var jsforce=require(_0xaff2('0xc'));var deskjs=require(_0xaff2('0xd'));var toCsv=require(_0xaff2('0x7'));var querystring=require(_0xaff2('0xe'));var Papa=require(_0xaff2('0xf'));var Redis=require('ioredis');var authService=require(_0xaff2('0x10'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xaff2('0x11'));var logger=require(_0xaff2('0x12'))(_0xaff2('0x13'));var utils=require(_0xaff2('0x14'));var config=require(_0xaff2('0x15'));var db=require('../../mysqldb')['db'];var jayson=require(_0xaff2('0x16'));var client=jayson[_0xaff2('0x17')][_0xaff2('0x18')]({'port':0x232a});function checkPasswordPattern(_0x58930b,_0x460040,_0x4032e5){if(_0x4032e5){var _0x5db6a7=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x5db6a7[_0xaff2('0x19')](_0x460040)){return _0x58930b;}else{throw new db['Sequelize'][(_0xaff2('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 _0x58930b;}}function respondWithRpcPromise(_0x4e358b,_0x32ec13,_0x5186d4,_0x423844){return new BPromise(function(_0x19029b,_0x3d4d8c){var _0x155e64=_0x423844||client;return _0x155e64[_0xaff2('0x1b')](_0x4e358b,_0x5186d4)['then'](function(_0xd2adb8){logger[_0xaff2('0x1c')](_0xaff2('0x1d'),_0x32ec13,_0xaff2('0x1e'));logger[_0xaff2('0x1f')](_0xaff2('0x20'),_0x32ec13,_0xaff2('0x1e'),JSON['stringify'](_0xd2adb8));if(_0xd2adb8[_0xaff2('0x21')]){if(_0xd2adb8['error'][_0xaff2('0x22')]===0x1f4){logger['error']('FreshsalesConfiguration,\x20%s,\x20%s',_0x32ec13,_0xd2adb8[_0xaff2('0x21')]['message']);return _0x3d4d8c(_0xd2adb8['error'][_0xaff2('0x23')]);}logger[_0xaff2('0x21')](_0xaff2('0x1d'),_0x32ec13,_0xd2adb8[_0xaff2('0x21')][_0xaff2('0x23')]);return _0x19029b(_0xd2adb8[_0xaff2('0x21')]['message']);}else{logger['info'](_0xaff2('0x1d'),_0x32ec13,_0xaff2('0x1e'));_0x19029b(_0xd2adb8['result']['message']);}})[_0xaff2('0x24')](function(_0xf357ae){logger[_0xaff2('0x21')]('FreshsalesConfiguration,\x20%s,\x20%s',_0x32ec13,_0xf357ae);_0x3d4d8c(_0xf357ae);});});}function respondWithStatusCode(_0x24ccfb,_0x306eb6){_0x306eb6=_0x306eb6||0xcc;return function(_0x3d3d39){if(_0x3d3d39){return _0x24ccfb[_0xaff2('0x25')](_0x306eb6);}return _0x24ccfb[_0xaff2('0x26')](_0x306eb6)[_0xaff2('0x27')]();};}function respondWithResult(_0x28d59c,_0x3dc2c8){_0x3dc2c8=_0x3dc2c8||0xc8;return function(_0x173365){if(_0x173365){return _0x28d59c[_0xaff2('0x26')](_0x3dc2c8)[_0xaff2('0x28')](_0x173365);}};}function respondWithFilteredResult(_0x24147e,_0x44d04a){return function(_0x5a4592){if(_0x5a4592){var _0x3ccb90=_0x5a4592[_0xaff2('0x29')],_0x29a0ca=_0x44d04a['offset'],_0x58e572=_0x44d04a[_0xaff2('0x2a')]+_0x44d04a[_0xaff2('0x2b')],_0x3bfca4;if(_0x58e572>=_0x3ccb90){_0x58e572=_0x3ccb90;_0x3bfca4=0xc8;}else{_0x3bfca4=0xce;}_0x24147e[_0xaff2('0x26')](_0x3bfca4);return _0x24147e[_0xaff2('0x2c')](_0xaff2('0x2d'),_0x29a0ca+'-'+_0x58e572+'/'+_0x3ccb90)[_0xaff2('0x28')](_0x5a4592);}return null;};}function patchUpdates(_0x13ab61){return function(_0xde301e){try{jsonpatch[_0xaff2('0x2e')](_0xde301e,_0x13ab61,!![]);}catch(_0xed46f0){return BPromise['reject'](_0xed46f0);}return _0xde301e['save']();};}function saveUpdates(_0x4a107a,_0xbb301d){return function(_0x2a09ce){if(_0x2a09ce){return _0x2a09ce['update'](_0x4a107a)['then'](function(_0x22f6ab){return _0x22f6ab;});}return null;};}function removeEntity(_0x3c5064,_0x2e2a54){return function(_0xa5ba32){if(_0xa5ba32){return _0xa5ba32[_0xaff2('0x2f')]()[_0xaff2('0x30')](function(){_0x3c5064['status'](0xcc)[_0xaff2('0x27')]();});}};}function handleEntityNotFound(_0x3a0de0,_0x21c70f){return function(_0x2a1b5c){if(!_0x2a1b5c){_0x3a0de0[_0xaff2('0x25')](0x194);}return _0x2a1b5c;};}function handleError(_0x29a8d6,_0x41f388){_0x41f388=_0x41f388||0x1f4;return function(_0x25aa95){logger[_0xaff2('0x21')](_0x25aa95['stack']);if(_0x25aa95['name']){delete _0x25aa95[_0xaff2('0x31')];}_0x29a8d6[_0xaff2('0x26')](_0x41f388)[_0xaff2('0x32')](_0x25aa95);};}exports[_0xaff2('0x33')]=function(_0x253d28,_0x15c10b){var _0x375e10={},_0x1bd71c={},_0x498b66={'count':0x0,'rows':[]};var _0x397314=_['map'](db[_0xaff2('0x34')]['rawAttributes'],function(_0x50e1ee){return{'name':_0x50e1ee['fieldName'],'type':_0x50e1ee[_0xaff2('0x35')]['key']};});_0x1bd71c[_0xaff2('0x36')]=_['map'](_0x397314,_0xaff2('0x31'));_0x1bd71c[_0xaff2('0x37')]=_['keys'](_0x253d28[_0xaff2('0x37')]);_0x1bd71c[_0xaff2('0x38')]=_['intersection'](_0x1bd71c[_0xaff2('0x36')],_0x1bd71c[_0xaff2('0x37')]);_0x375e10[_0xaff2('0x39')]=_[_0xaff2('0x3a')](_0x1bd71c[_0xaff2('0x36')],qs[_0xaff2('0x3b')](_0x253d28[_0xaff2('0x37')][_0xaff2('0x3b')]));_0x375e10[_0xaff2('0x39')]=_0x375e10[_0xaff2('0x39')][_0xaff2('0x3c')]?_0x375e10[_0xaff2('0x39')]:_0x1bd71c['model'];if(!_0x253d28['query'][_0xaff2('0x3d')](_0xaff2('0x3e'))){_0x375e10['limit']=qs[_0xaff2('0x2b')](_0x253d28[_0xaff2('0x37')][_0xaff2('0x2b')]);_0x375e10[_0xaff2('0x2a')]=qs['offset'](_0x253d28['query'][_0xaff2('0x2a')]);}_0x375e10[_0xaff2('0x3f')]=qs[_0xaff2('0x40')](_0x253d28[_0xaff2('0x37')]['sort']);_0x375e10['where']=qs[_0xaff2('0x38')](_['pick'](_0x253d28[_0xaff2('0x37')],_0x1bd71c[_0xaff2('0x38')]));if(_0x253d28[_0xaff2('0x37')]['filter']){_0x375e10[_0xaff2('0x41')]=_[_0xaff2('0x42')](_0x375e10[_0xaff2('0x41')],{'$or':_['map'](_0x397314,function(_0x1dc239){if(_0x1dc239[_0xaff2('0x35')]!==_0xaff2('0x43')){var _0x3b70ca={};_0x3b70ca[_0x1dc239['name']]={'$like':'%'+_0x253d28['query'][_0xaff2('0x44')]+'%'};return _0x3b70ca;}})});}_0x375e10=_[_0xaff2('0x42')]({},_0x375e10,_0x253d28['options']);var _0x93721c={'where':_0x375e10['where']};return db['FreshsalesConfiguration'][_0xaff2('0x29')](_0x93721c)['then'](function(_0x55eae1){_0x498b66[_0xaff2('0x29')]=_0x55eae1;if(_0x253d28[_0xaff2('0x37')][_0xaff2('0x45')]){_0x375e10[_0xaff2('0x46')]=[{'all':!![]}];}return db[_0xaff2('0x34')][_0xaff2('0x47')](_0x375e10);})['then'](function(_0x4d1fb3){_0x498b66[_0xaff2('0x48')]=_0x4d1fb3;return _0x498b66;})[_0xaff2('0x30')](respondWithFilteredResult(_0x15c10b,_0x375e10))[_0xaff2('0x24')](handleError(_0x15c10b,null));};exports[_0xaff2('0x49')]=function(_0x4928d2,_0xd04518){var _0x38f241={'raw':![],'where':{'id':_0x4928d2[_0xaff2('0x4a')]['id']}},_0x232b52={};_0x232b52['model']=_[_0xaff2('0x4b')](db[_0xaff2('0x34')][_0xaff2('0x4c')]);_0x232b52[_0xaff2('0x37')]=_[_0xaff2('0x4b')](_0x4928d2[_0xaff2('0x37')]);_0x232b52[_0xaff2('0x38')]=_['intersection'](_0x232b52[_0xaff2('0x36')],_0x232b52[_0xaff2('0x37')]);_0x38f241[_0xaff2('0x39')]=_[_0xaff2('0x3a')](_0x232b52[_0xaff2('0x36')],qs[_0xaff2('0x3b')](_0x4928d2['query'][_0xaff2('0x3b')]));_0x38f241['attributes']=_0x38f241[_0xaff2('0x39')][_0xaff2('0x3c')]?_0x38f241['attributes']:_0x232b52[_0xaff2('0x36')];if(_0x4928d2[_0xaff2('0x37')][_0xaff2('0x45')]){_0x38f241['include']=[{'all':!![]}];}_0x38f241=_['merge']({},_0x38f241,_0x4928d2[_0xaff2('0x4d')]);return db['FreshsalesConfiguration']['find'](_0x38f241)[_0xaff2('0x30')](handleEntityNotFound(_0xd04518,null))['then'](respondWithResult(_0xd04518,null))[_0xaff2('0x24')](handleError(_0xd04518,null));};exports[_0xaff2('0x4e')]=function(_0x2583b2,_0x290e93){return db[_0xaff2('0x34')][_0xaff2('0x4e')](_0x2583b2['body'],{})[_0xaff2('0x30')](respondWithResult(_0x290e93,0xc9))[_0xaff2('0x24')](handleError(_0x290e93,null));};exports['update']=function(_0x160e31,_0x3b8b9b){if(_0x160e31['body']['id']){delete _0x160e31[_0xaff2('0x4f')]['id'];}return db[_0xaff2('0x34')][_0xaff2('0x50')]({'where':{'id':_0x160e31[_0xaff2('0x4a')]['id']}})[_0xaff2('0x30')](handleEntityNotFound(_0x3b8b9b,null))[_0xaff2('0x30')](saveUpdates(_0x160e31['body'],null))['then'](respondWithResult(_0x3b8b9b,null))[_0xaff2('0x24')](handleError(_0x3b8b9b,null));};exports['destroy']=function(_0x14eb09,_0x35f39d){return db[_0xaff2('0x34')][_0xaff2('0x50')]({'where':{'id':_0x14eb09['params']['id']}})[_0xaff2('0x30')](handleEntityNotFound(_0x35f39d,null))[_0xaff2('0x30')](removeEntity(_0x35f39d,null))[_0xaff2('0x24')](handleError(_0x35f39d,null));};exports[_0xaff2('0x51')]=function(_0x2dc860,_0x25adbb,_0x524fd1){var _0x2b35c5={};var _0x281987={};var _0x3a7e25;var _0x4ee3ca;return db['FreshsalesConfiguration'][_0xaff2('0x52')]({'where':{'id':_0x2dc860['params']['id']}})[_0xaff2('0x30')](handleEntityNotFound(_0x25adbb,null))[_0xaff2('0x30')](function(_0x6e3fab){if(_0x6e3fab){_0x3a7e25=_0x6e3fab;_0x281987[_0xaff2('0x36')]=_[_0xaff2('0x4b')](db[_0xaff2('0x53')][_0xaff2('0x4c')]);_0x281987['query']=_[_0xaff2('0x4b')](_0x2dc860['query']);_0x281987['filters']=_[_0xaff2('0x3a')](_0x281987[_0xaff2('0x36')],_0x281987['query']);_0x2b35c5[_0xaff2('0x39')]=_[_0xaff2('0x3a')](_0x281987[_0xaff2('0x36')],qs[_0xaff2('0x3b')](_0x2dc860['query'][_0xaff2('0x3b')]));_0x2b35c5[_0xaff2('0x39')]=_0x2b35c5[_0xaff2('0x39')][_0xaff2('0x3c')]?_0x2b35c5[_0xaff2('0x39')]:_0x281987['model'];_0x2b35c5[_0xaff2('0x3f')]=qs[_0xaff2('0x40')](_0x2dc860['query'][_0xaff2('0x40')]);_0x2b35c5[_0xaff2('0x41')]=qs[_0xaff2('0x38')](_['pick'](_0x2dc860['query'],_0x281987[_0xaff2('0x38')]));if(_0x2dc860[_0xaff2('0x37')][_0xaff2('0x44')]){_0x2b35c5[_0xaff2('0x41')]=_['merge'](_0x2b35c5[_0xaff2('0x41')],{'$or':_[_0xaff2('0x54')](_0x2b35c5[_0xaff2('0x39')],function(_0x53f8cb){var _0x107435={};_0x107435[_0x53f8cb]={'$like':'%'+_0x2dc860['query']['filter']+'%'};return _0x107435;})});}_0x2b35c5=_[_0xaff2('0x42')]({},_0x2b35c5,_0x2dc860[_0xaff2('0x4d')]);return _0x3a7e25[_0xaff2('0x51')](_0x2b35c5);}})[_0xaff2('0x30')](function(_0x43ab27){if(_0x43ab27){_0x4ee3ca=_0x43ab27[_0xaff2('0x3c')];if(!_0x2dc860['query'][_0xaff2('0x3d')]('nolimit')){_0x2b35c5[_0xaff2('0x2b')]=qs[_0xaff2('0x2b')](_0x2dc860['query'][_0xaff2('0x2b')]);_0x2b35c5[_0xaff2('0x2a')]=qs[_0xaff2('0x2a')](_0x2dc860[_0xaff2('0x37')][_0xaff2('0x2a')]);}return _0x3a7e25[_0xaff2('0x51')](_0x2b35c5);}})[_0xaff2('0x30')](function(_0xa663d6){if(_0xa663d6){return _0xa663d6?{'count':_0x4ee3ca,'rows':_0xa663d6}:null;}})['then'](respondWithResult(_0x25adbb,null))[_0xaff2('0x24')](handleError(_0x25adbb,null));};exports[_0xaff2('0x55')]=function(_0xdc504c,_0x19ce7c,_0x5d459b){var _0x48f27a={};var _0x2b2b2a={};var _0x3052a7;var _0x51b463;return db[_0xaff2('0x34')][_0xaff2('0x52')]({'where':{'id':_0xdc504c['params']['id']}})[_0xaff2('0x30')](handleEntityNotFound(_0x19ce7c,null))[_0xaff2('0x30')](function(_0x64c2e8){if(_0x64c2e8){_0x3052a7=_0x64c2e8;_0x2b2b2a[_0xaff2('0x36')]=_[_0xaff2('0x4b')](db['FreshsalesField'][_0xaff2('0x4c')]);_0x2b2b2a['query']=_['keys'](_0xdc504c[_0xaff2('0x37')]);_0x2b2b2a[_0xaff2('0x38')]=_['intersection'](_0x2b2b2a[_0xaff2('0x36')],_0x2b2b2a[_0xaff2('0x37')]);_0x48f27a['attributes']=_[_0xaff2('0x3a')](_0x2b2b2a[_0xaff2('0x36')],qs['fields'](_0xdc504c['query'][_0xaff2('0x3b')]));_0x48f27a['attributes']=_0x48f27a['attributes'][_0xaff2('0x3c')]?_0x48f27a[_0xaff2('0x39')]:_0x2b2b2a[_0xaff2('0x36')];_0x48f27a['order']=qs[_0xaff2('0x40')](_0xdc504c['query'][_0xaff2('0x40')]);_0x48f27a[_0xaff2('0x41')]=qs['filters'](_['pick'](_0xdc504c[_0xaff2('0x37')],_0x2b2b2a[_0xaff2('0x38')]));if(_0xdc504c['query'][_0xaff2('0x44')]){_0x48f27a[_0xaff2('0x41')]=_[_0xaff2('0x42')](_0x48f27a[_0xaff2('0x41')],{'$or':_[_0xaff2('0x54')](_0x48f27a['attributes'],function(_0x659ec2){var _0x431ec7={};_0x431ec7[_0x659ec2]={'$like':'%'+_0xdc504c[_0xaff2('0x37')]['filter']+'%'};return _0x431ec7;})});}_0x48f27a=_[_0xaff2('0x42')]({},_0x48f27a,_0xdc504c[_0xaff2('0x4d')]);return _0x3052a7[_0xaff2('0x55')](_0x48f27a);}})[_0xaff2('0x30')](function(_0x178725){if(_0x178725){_0x51b463=_0x178725[_0xaff2('0x3c')];if(!_0xdc504c[_0xaff2('0x37')][_0xaff2('0x3d')]('nolimit')){_0x48f27a[_0xaff2('0x2b')]=qs['limit'](_0xdc504c[_0xaff2('0x37')][_0xaff2('0x2b')]);_0x48f27a[_0xaff2('0x2a')]=qs[_0xaff2('0x2a')](_0xdc504c[_0xaff2('0x37')][_0xaff2('0x2a')]);}return _0x3052a7[_0xaff2('0x55')](_0x48f27a);}})[_0xaff2('0x30')](function(_0x59de96){if(_0x59de96){return _0x59de96?{'count':_0x51b463,'rows':_0x59de96}:null;}})[_0xaff2('0x30')](respondWithResult(_0x19ce7c,null))[_0xaff2('0x24')](handleError(_0x19ce7c,null));};exports['getFields']=function(_0x4b10ac,_0x46145a,_0x5e9afa){var _0x4d070f={};var _0x4e8ead={};var _0x3264ae;var _0xb3ac2;return db[_0xaff2('0x34')][_0xaff2('0x52')]({'where':{'id':_0x4b10ac['params']['id']}})[_0xaff2('0x30')](handleEntityNotFound(_0x46145a,null))[_0xaff2('0x30')](function(_0x8372db){if(_0x8372db){_0x3264ae=_0x8372db;_0x4e8ead[_0xaff2('0x36')]=_[_0xaff2('0x4b')](db[_0xaff2('0x53')][_0xaff2('0x4c')]);_0x4e8ead[_0xaff2('0x37')]=_[_0xaff2('0x4b')](_0x4b10ac['query']);_0x4e8ead['filters']=_[_0xaff2('0x3a')](_0x4e8ead[_0xaff2('0x36')],_0x4e8ead[_0xaff2('0x37')]);_0x4d070f['attributes']=_['intersection'](_0x4e8ead[_0xaff2('0x36')],qs[_0xaff2('0x3b')](_0x4b10ac['query']['fields']));_0x4d070f[_0xaff2('0x39')]=_0x4d070f[_0xaff2('0x39')][_0xaff2('0x3c')]?_0x4d070f[_0xaff2('0x39')]:_0x4e8ead['model'];_0x4d070f[_0xaff2('0x3f')]=qs[_0xaff2('0x40')](_0x4b10ac[_0xaff2('0x37')][_0xaff2('0x40')]);_0x4d070f['where']=qs[_0xaff2('0x38')](_[_0xaff2('0x56')](_0x4b10ac[_0xaff2('0x37')],_0x4e8ead[_0xaff2('0x38')]));if(_0x4b10ac[_0xaff2('0x37')]['filter']){_0x4d070f['where']=_[_0xaff2('0x42')](_0x4d070f[_0xaff2('0x41')],{'$or':_['map'](_0x4d070f[_0xaff2('0x39')],function(_0x18388c){var _0x2b19ad={};_0x2b19ad[_0x18388c]={'$like':'%'+_0x4b10ac[_0xaff2('0x37')]['filter']+'%'};return _0x2b19ad;})});}_0x4d070f=_[_0xaff2('0x42')]({},_0x4d070f,_0x4b10ac[_0xaff2('0x4d')]);return _0x3264ae[_0xaff2('0x57')](_0x4d070f);}})['then'](function(_0x2ead98){if(_0x2ead98){_0xb3ac2=_0x2ead98[_0xaff2('0x3c')];if(!_0x4b10ac[_0xaff2('0x37')][_0xaff2('0x3d')](_0xaff2('0x3e'))){_0x4d070f[_0xaff2('0x2b')]=qs[_0xaff2('0x2b')](_0x4b10ac[_0xaff2('0x37')][_0xaff2('0x2b')]);_0x4d070f[_0xaff2('0x2a')]=qs[_0xaff2('0x2a')](_0x4b10ac[_0xaff2('0x37')][_0xaff2('0x2a')]);}return _0x3264ae[_0xaff2('0x57')](_0x4d070f);}})[_0xaff2('0x30')](function(_0x38f5d7){if(_0x38f5d7){return _0x38f5d7?{'count':_0xb3ac2,'rows':_0x38f5d7}:null;}})[_0xaff2('0x30')](respondWithResult(_0x46145a,null))['catch'](handleError(_0x46145a,null));}; \ No newline at end of file +var _0x4e83=['Sequelize','ValidationError','The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.','then','info','FreshsalesConfiguration,\x20%s,\x20%s','request\x20sent','debug','FreshsalesConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','message','result','sendStatus','status','json','count','offset','limit','Content-Range','apply','reject','save','update','destroy','stack','name','send','index','map','FreshsalesConfiguration','rawAttributes','type','key','model','query','filters','intersection','attributes','fields','hasOwnProperty','nolimit','sort','where','pick','merge','VIRTUAL','include','rows','catch','show','params','keys','includeAll','options','find','create','body','getSubjects','findOne','length','order','filter','getDescriptions','FreshsalesField','getFields','html-pdf','rimraf','zip-dir','fast-json-patch','request-promise','moment','sox','to-csv','lodash','squel','crypto','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','jayson/promise','client','test'];(function(_0x36ab65,_0x467daa){var _0x32da56=function(_0x50f4b2){while(--_0x50f4b2){_0x36ab65['push'](_0x36ab65['shift']());}};_0x32da56(++_0x467daa);}(_0x4e83,0x1ae));var _0x34e8=function(_0x4e85ec,_0x2913b6){_0x4e85ec=_0x4e85ec-0x0;var _0x1c1ab3=_0x4e83[_0x4e85ec];return _0x1c1ab3;};'use strict';var pdf=require(_0x34e8('0x0'));var emlformat=require('eml-format');var rimraf=require(_0x34e8('0x1'));var zipdir=require(_0x34e8('0x2'));var jsonpatch=require(_0x34e8('0x3'));var rp=require(_0x34e8('0x4'));var moment=require(_0x34e8('0x5'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require('util');var path=require('path');var sox=require(_0x34e8('0x6'));var csv=require(_0x34e8('0x7'));var ejs=require('ejs');var fs=require('fs');var _=require(_0x34e8('0x8'));var squel=require(_0x34e8('0x9'));var crypto=require(_0x34e8('0xa'));var jsforce=require('jsforce');var deskjs=require(_0x34e8('0xb'));var toCsv=require(_0x34e8('0x7'));var querystring=require(_0x34e8('0xc'));var Papa=require('papaparse');var Redis=require(_0x34e8('0xd'));var authService=require(_0x34e8('0xe'));var qs=require(_0x34e8('0xf'));var as=require(_0x34e8('0x10'));var hardwareService=require(_0x34e8('0x11'));var logger=require(_0x34e8('0x12'))(_0x34e8('0x13'));var utils=require(_0x34e8('0x14'));var config=require(_0x34e8('0x15'));var db=require('../../mysqldb')['db'];var jayson=require(_0x34e8('0x16'));var client=jayson[_0x34e8('0x17')]['http']({'port':0x232a});function checkPasswordPattern(_0x6454fd,_0x4160ec,_0x368d5f){if(_0x368d5f){var _0x26301a=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x26301a[_0x34e8('0x18')](_0x4160ec)){return _0x6454fd;}else{throw new db[(_0x34e8('0x19'))][(_0x34e8('0x1a'))](_0x34e8('0x1b'));}}else{return _0x6454fd;}}function respondWithRpcPromise(_0x4498d0,_0x4c516a,_0xeb505,_0x4447d3){return new BPromise(function(_0x36adfb,_0x332735){var _0x3772d7=_0x4447d3||client;return _0x3772d7['request'](_0x4498d0,_0xeb505)[_0x34e8('0x1c')](function(_0x37b6ae){logger[_0x34e8('0x1d')](_0x34e8('0x1e'),_0x4c516a,_0x34e8('0x1f'));logger[_0x34e8('0x20')](_0x34e8('0x21'),_0x4c516a,_0x34e8('0x1f'),JSON[_0x34e8('0x22')](_0x37b6ae));if(_0x37b6ae[_0x34e8('0x23')]){if(_0x37b6ae[_0x34e8('0x23')]['code']===0x1f4){logger[_0x34e8('0x23')](_0x34e8('0x1e'),_0x4c516a,_0x37b6ae[_0x34e8('0x23')][_0x34e8('0x24')]);return _0x332735(_0x37b6ae[_0x34e8('0x23')][_0x34e8('0x24')]);}logger[_0x34e8('0x23')](_0x34e8('0x1e'),_0x4c516a,_0x37b6ae['error'][_0x34e8('0x24')]);return _0x36adfb(_0x37b6ae[_0x34e8('0x23')]['message']);}else{logger[_0x34e8('0x1d')]('FreshsalesConfiguration,\x20%s,\x20%s',_0x4c516a,_0x34e8('0x1f'));_0x36adfb(_0x37b6ae[_0x34e8('0x25')][_0x34e8('0x24')]);}})['catch'](function(_0x58cb2f){logger[_0x34e8('0x23')](_0x34e8('0x1e'),_0x4c516a,_0x58cb2f);_0x332735(_0x58cb2f);});});}function respondWithStatusCode(_0xb8c9f,_0x2dad57){_0x2dad57=_0x2dad57||0xcc;return function(_0x2e29fb){if(_0x2e29fb){return _0xb8c9f[_0x34e8('0x26')](_0x2dad57);}return _0xb8c9f[_0x34e8('0x27')](_0x2dad57)['end']();};}function respondWithResult(_0x29be75,_0x44ca6d){_0x44ca6d=_0x44ca6d||0xc8;return function(_0x46c2a0){if(_0x46c2a0){return _0x29be75[_0x34e8('0x27')](_0x44ca6d)[_0x34e8('0x28')](_0x46c2a0);}};}function respondWithFilteredResult(_0x23934c,_0x21f31e){return function(_0xae7ab8){if(_0xae7ab8){var _0x2b445a=_0xae7ab8[_0x34e8('0x29')],_0x18490b=_0x21f31e[_0x34e8('0x2a')],_0x3f5421=_0x21f31e[_0x34e8('0x2a')]+_0x21f31e[_0x34e8('0x2b')],_0x6f4428;if(_0x3f5421>=_0x2b445a){_0x3f5421=_0x2b445a;_0x6f4428=0xc8;}else{_0x6f4428=0xce;}_0x23934c[_0x34e8('0x27')](_0x6f4428);return _0x23934c['set'](_0x34e8('0x2c'),_0x18490b+'-'+_0x3f5421+'/'+_0x2b445a)[_0x34e8('0x28')](_0xae7ab8);}return null;};}function patchUpdates(_0x5b951f){return function(_0x461c32){try{jsonpatch[_0x34e8('0x2d')](_0x461c32,_0x5b951f,!![]);}catch(_0x10d1ad){return BPromise[_0x34e8('0x2e')](_0x10d1ad);}return _0x461c32[_0x34e8('0x2f')]();};}function saveUpdates(_0x270c8c,_0x1b64a0){return function(_0x1673d3){if(_0x1673d3){return _0x1673d3[_0x34e8('0x30')](_0x270c8c)[_0x34e8('0x1c')](function(_0x15b5fd){return _0x15b5fd;});}return null;};}function removeEntity(_0xbc8217,_0x22698d){return function(_0x33d27b){if(_0x33d27b){return _0x33d27b[_0x34e8('0x31')]()[_0x34e8('0x1c')](function(){_0xbc8217[_0x34e8('0x27')](0xcc)['end']();});}};}function handleEntityNotFound(_0x3b5395,_0x3580d3){return function(_0x59fcc2){if(!_0x59fcc2){_0x3b5395[_0x34e8('0x26')](0x194);}return _0x59fcc2;};}function handleError(_0x38a525,_0x1fb985){_0x1fb985=_0x1fb985||0x1f4;return function(_0xde0d37){logger[_0x34e8('0x23')](_0xde0d37[_0x34e8('0x32')]);if(_0xde0d37[_0x34e8('0x33')]){delete _0xde0d37['name'];}_0x38a525['status'](_0x1fb985)[_0x34e8('0x34')](_0xde0d37);};}exports[_0x34e8('0x35')]=function(_0x356269,_0x5988b4){var _0x32f216={},_0x42f63b={},_0x2bdd19={'count':0x0,'rows':[]};var _0x96742=_[_0x34e8('0x36')](db[_0x34e8('0x37')][_0x34e8('0x38')],function(_0x2e4fce){return{'name':_0x2e4fce['fieldName'],'type':_0x2e4fce[_0x34e8('0x39')][_0x34e8('0x3a')]};});_0x42f63b[_0x34e8('0x3b')]=_['map'](_0x96742,_0x34e8('0x33'));_0x42f63b[_0x34e8('0x3c')]=_['keys'](_0x356269['query']);_0x42f63b[_0x34e8('0x3d')]=_[_0x34e8('0x3e')](_0x42f63b['model'],_0x42f63b[_0x34e8('0x3c')]);_0x32f216[_0x34e8('0x3f')]=_[_0x34e8('0x3e')](_0x42f63b[_0x34e8('0x3b')],qs[_0x34e8('0x40')](_0x356269[_0x34e8('0x3c')][_0x34e8('0x40')]));_0x32f216[_0x34e8('0x3f')]=_0x32f216[_0x34e8('0x3f')]['length']?_0x32f216['attributes']:_0x42f63b[_0x34e8('0x3b')];if(!_0x356269['query'][_0x34e8('0x41')](_0x34e8('0x42'))){_0x32f216[_0x34e8('0x2b')]=qs[_0x34e8('0x2b')](_0x356269['query'][_0x34e8('0x2b')]);_0x32f216[_0x34e8('0x2a')]=qs[_0x34e8('0x2a')](_0x356269[_0x34e8('0x3c')][_0x34e8('0x2a')]);}_0x32f216['order']=qs[_0x34e8('0x43')](_0x356269['query'][_0x34e8('0x43')]);_0x32f216[_0x34e8('0x44')]=qs['filters'](_[_0x34e8('0x45')](_0x356269[_0x34e8('0x3c')],_0x42f63b[_0x34e8('0x3d')]));if(_0x356269[_0x34e8('0x3c')]['filter']){_0x32f216[_0x34e8('0x44')]=_[_0x34e8('0x46')](_0x32f216['where'],{'$or':_['map'](_0x96742,function(_0x2dc751){if(_0x2dc751['type']!==_0x34e8('0x47')){var _0x4af150={};_0x4af150[_0x2dc751[_0x34e8('0x33')]]={'$like':'%'+_0x356269[_0x34e8('0x3c')]['filter']+'%'};return _0x4af150;}})});}_0x32f216=_[_0x34e8('0x46')]({},_0x32f216,_0x356269['options']);var _0x44ad37={'where':_0x32f216['where']};return db[_0x34e8('0x37')][_0x34e8('0x29')](_0x44ad37)[_0x34e8('0x1c')](function(_0x1150af){_0x2bdd19[_0x34e8('0x29')]=_0x1150af;if(_0x356269['query']['includeAll']){_0x32f216[_0x34e8('0x48')]=[{'all':!![]}];}return db[_0x34e8('0x37')]['findAll'](_0x32f216);})[_0x34e8('0x1c')](function(_0x3cdfa7){_0x2bdd19[_0x34e8('0x49')]=_0x3cdfa7;return _0x2bdd19;})['then'](respondWithFilteredResult(_0x5988b4,_0x32f216))[_0x34e8('0x4a')](handleError(_0x5988b4,null));};exports[_0x34e8('0x4b')]=function(_0x484ea1,_0x51a814){var _0x2de2e9={'raw':![],'where':{'id':_0x484ea1[_0x34e8('0x4c')]['id']}},_0x489cdd={};_0x489cdd[_0x34e8('0x3b')]=_[_0x34e8('0x4d')](db[_0x34e8('0x37')][_0x34e8('0x38')]);_0x489cdd[_0x34e8('0x3c')]=_[_0x34e8('0x4d')](_0x484ea1[_0x34e8('0x3c')]);_0x489cdd[_0x34e8('0x3d')]=_['intersection'](_0x489cdd['model'],_0x489cdd[_0x34e8('0x3c')]);_0x2de2e9[_0x34e8('0x3f')]=_[_0x34e8('0x3e')](_0x489cdd[_0x34e8('0x3b')],qs[_0x34e8('0x40')](_0x484ea1[_0x34e8('0x3c')][_0x34e8('0x40')]));_0x2de2e9[_0x34e8('0x3f')]=_0x2de2e9[_0x34e8('0x3f')]['length']?_0x2de2e9['attributes']:_0x489cdd[_0x34e8('0x3b')];if(_0x484ea1[_0x34e8('0x3c')][_0x34e8('0x4e')]){_0x2de2e9[_0x34e8('0x48')]=[{'all':!![]}];}_0x2de2e9=_[_0x34e8('0x46')]({},_0x2de2e9,_0x484ea1[_0x34e8('0x4f')]);return db['FreshsalesConfiguration'][_0x34e8('0x50')](_0x2de2e9)[_0x34e8('0x1c')](handleEntityNotFound(_0x51a814,null))['then'](respondWithResult(_0x51a814,null))[_0x34e8('0x4a')](handleError(_0x51a814,null));};exports[_0x34e8('0x51')]=function(_0x419211,_0x2bc025){return db[_0x34e8('0x37')][_0x34e8('0x51')](_0x419211[_0x34e8('0x52')],{})[_0x34e8('0x1c')](respondWithResult(_0x2bc025,0xc9))[_0x34e8('0x4a')](handleError(_0x2bc025,null));};exports[_0x34e8('0x30')]=function(_0x21c119,_0x2360d9){if(_0x21c119[_0x34e8('0x52')]['id']){delete _0x21c119[_0x34e8('0x52')]['id'];}return db[_0x34e8('0x37')][_0x34e8('0x50')]({'where':{'id':_0x21c119[_0x34e8('0x4c')]['id']}})['then'](handleEntityNotFound(_0x2360d9,null))[_0x34e8('0x1c')](saveUpdates(_0x21c119[_0x34e8('0x52')],null))[_0x34e8('0x1c')](respondWithResult(_0x2360d9,null))[_0x34e8('0x4a')](handleError(_0x2360d9,null));};exports[_0x34e8('0x31')]=function(_0x3b5842,_0x97da41){return db[_0x34e8('0x37')][_0x34e8('0x50')]({'where':{'id':_0x3b5842[_0x34e8('0x4c')]['id']}})[_0x34e8('0x1c')](handleEntityNotFound(_0x97da41,null))[_0x34e8('0x1c')](removeEntity(_0x97da41,null))['catch'](handleError(_0x97da41,null));};exports[_0x34e8('0x53')]=function(_0x18ccf0,_0x2c5bbd,_0x3d0a3a){var _0x36116b={};var _0x1ebba9={};var _0x12134f;var _0x2d152a;return db[_0x34e8('0x37')][_0x34e8('0x54')]({'where':{'id':_0x18ccf0[_0x34e8('0x4c')]['id']}})[_0x34e8('0x1c')](handleEntityNotFound(_0x2c5bbd,null))[_0x34e8('0x1c')](function(_0x4e0945){if(_0x4e0945){_0x12134f=_0x4e0945;_0x1ebba9[_0x34e8('0x3b')]=_['keys'](db['FreshsalesField'][_0x34e8('0x38')]);_0x1ebba9['query']=_[_0x34e8('0x4d')](_0x18ccf0['query']);_0x1ebba9[_0x34e8('0x3d')]=_['intersection'](_0x1ebba9[_0x34e8('0x3b')],_0x1ebba9[_0x34e8('0x3c')]);_0x36116b[_0x34e8('0x3f')]=_[_0x34e8('0x3e')](_0x1ebba9['model'],qs[_0x34e8('0x40')](_0x18ccf0[_0x34e8('0x3c')][_0x34e8('0x40')]));_0x36116b['attributes']=_0x36116b[_0x34e8('0x3f')][_0x34e8('0x55')]?_0x36116b[_0x34e8('0x3f')]:_0x1ebba9['model'];_0x36116b[_0x34e8('0x56')]=qs['sort'](_0x18ccf0[_0x34e8('0x3c')][_0x34e8('0x43')]);_0x36116b['where']=qs[_0x34e8('0x3d')](_[_0x34e8('0x45')](_0x18ccf0['query'],_0x1ebba9['filters']));if(_0x18ccf0['query'][_0x34e8('0x57')]){_0x36116b[_0x34e8('0x44')]=_['merge'](_0x36116b[_0x34e8('0x44')],{'$or':_[_0x34e8('0x36')](_0x36116b[_0x34e8('0x3f')],function(_0x43785b){var _0x36f061={};_0x36f061[_0x43785b]={'$like':'%'+_0x18ccf0[_0x34e8('0x3c')][_0x34e8('0x57')]+'%'};return _0x36f061;})});}_0x36116b=_[_0x34e8('0x46')]({},_0x36116b,_0x18ccf0[_0x34e8('0x4f')]);return _0x12134f[_0x34e8('0x53')](_0x36116b);}})[_0x34e8('0x1c')](function(_0x505bc1){if(_0x505bc1){_0x2d152a=_0x505bc1[_0x34e8('0x55')];if(!_0x18ccf0[_0x34e8('0x3c')]['hasOwnProperty'](_0x34e8('0x42'))){_0x36116b[_0x34e8('0x2b')]=qs['limit'](_0x18ccf0['query'][_0x34e8('0x2b')]);_0x36116b['offset']=qs['offset'](_0x18ccf0['query'][_0x34e8('0x2a')]);}return _0x12134f['getSubjects'](_0x36116b);}})[_0x34e8('0x1c')](function(_0x10a52c){if(_0x10a52c){return _0x10a52c?{'count':_0x2d152a,'rows':_0x10a52c}:null;}})[_0x34e8('0x1c')](respondWithResult(_0x2c5bbd,null))[_0x34e8('0x4a')](handleError(_0x2c5bbd,null));};exports[_0x34e8('0x58')]=function(_0x282660,_0x409fdd,_0x2505d8){var _0x101b37={};var _0x3c203b={};var _0x2db132;var _0x4b47ed;return db[_0x34e8('0x37')][_0x34e8('0x54')]({'where':{'id':_0x282660[_0x34e8('0x4c')]['id']}})[_0x34e8('0x1c')](handleEntityNotFound(_0x409fdd,null))[_0x34e8('0x1c')](function(_0x2a293d){if(_0x2a293d){_0x2db132=_0x2a293d;_0x3c203b[_0x34e8('0x3b')]=_[_0x34e8('0x4d')](db[_0x34e8('0x59')][_0x34e8('0x38')]);_0x3c203b[_0x34e8('0x3c')]=_[_0x34e8('0x4d')](_0x282660[_0x34e8('0x3c')]);_0x3c203b[_0x34e8('0x3d')]=_[_0x34e8('0x3e')](_0x3c203b[_0x34e8('0x3b')],_0x3c203b[_0x34e8('0x3c')]);_0x101b37[_0x34e8('0x3f')]=_[_0x34e8('0x3e')](_0x3c203b[_0x34e8('0x3b')],qs[_0x34e8('0x40')](_0x282660['query'][_0x34e8('0x40')]));_0x101b37[_0x34e8('0x3f')]=_0x101b37['attributes'][_0x34e8('0x55')]?_0x101b37['attributes']:_0x3c203b[_0x34e8('0x3b')];_0x101b37[_0x34e8('0x56')]=qs[_0x34e8('0x43')](_0x282660['query'][_0x34e8('0x43')]);_0x101b37[_0x34e8('0x44')]=qs['filters'](_[_0x34e8('0x45')](_0x282660['query'],_0x3c203b[_0x34e8('0x3d')]));if(_0x282660[_0x34e8('0x3c')]['filter']){_0x101b37[_0x34e8('0x44')]=_[_0x34e8('0x46')](_0x101b37[_0x34e8('0x44')],{'$or':_[_0x34e8('0x36')](_0x101b37[_0x34e8('0x3f')],function(_0xba5f97){var _0x1efd5f={};_0x1efd5f[_0xba5f97]={'$like':'%'+_0x282660[_0x34e8('0x3c')][_0x34e8('0x57')]+'%'};return _0x1efd5f;})});}_0x101b37=_[_0x34e8('0x46')]({},_0x101b37,_0x282660[_0x34e8('0x4f')]);return _0x2db132[_0x34e8('0x58')](_0x101b37);}})['then'](function(_0x5027b2){if(_0x5027b2){_0x4b47ed=_0x5027b2[_0x34e8('0x55')];if(!_0x282660[_0x34e8('0x3c')][_0x34e8('0x41')](_0x34e8('0x42'))){_0x101b37[_0x34e8('0x2b')]=qs[_0x34e8('0x2b')](_0x282660[_0x34e8('0x3c')][_0x34e8('0x2b')]);_0x101b37[_0x34e8('0x2a')]=qs[_0x34e8('0x2a')](_0x282660[_0x34e8('0x3c')][_0x34e8('0x2a')]);}return _0x2db132[_0x34e8('0x58')](_0x101b37);}})[_0x34e8('0x1c')](function(_0x4ae9df){if(_0x4ae9df){return _0x4ae9df?{'count':_0x4b47ed,'rows':_0x4ae9df}:null;}})[_0x34e8('0x1c')](respondWithResult(_0x409fdd,null))[_0x34e8('0x4a')](handleError(_0x409fdd,null));};exports[_0x34e8('0x5a')]=function(_0x3ebaf1,_0xdf2c20,_0x43c3f5){var _0x1b4f6f={};var _0x2911be={};var _0x4c1bb7;var _0x3b3dd6;return db[_0x34e8('0x37')]['findOne']({'where':{'id':_0x3ebaf1[_0x34e8('0x4c')]['id']}})[_0x34e8('0x1c')](handleEntityNotFound(_0xdf2c20,null))[_0x34e8('0x1c')](function(_0x395bab){if(_0x395bab){_0x4c1bb7=_0x395bab;_0x2911be[_0x34e8('0x3b')]=_[_0x34e8('0x4d')](db[_0x34e8('0x59')][_0x34e8('0x38')]);_0x2911be[_0x34e8('0x3c')]=_[_0x34e8('0x4d')](_0x3ebaf1[_0x34e8('0x3c')]);_0x2911be['filters']=_[_0x34e8('0x3e')](_0x2911be[_0x34e8('0x3b')],_0x2911be[_0x34e8('0x3c')]);_0x1b4f6f[_0x34e8('0x3f')]=_[_0x34e8('0x3e')](_0x2911be[_0x34e8('0x3b')],qs['fields'](_0x3ebaf1[_0x34e8('0x3c')][_0x34e8('0x40')]));_0x1b4f6f['attributes']=_0x1b4f6f[_0x34e8('0x3f')][_0x34e8('0x55')]?_0x1b4f6f[_0x34e8('0x3f')]:_0x2911be[_0x34e8('0x3b')];_0x1b4f6f[_0x34e8('0x56')]=qs[_0x34e8('0x43')](_0x3ebaf1[_0x34e8('0x3c')][_0x34e8('0x43')]);_0x1b4f6f[_0x34e8('0x44')]=qs[_0x34e8('0x3d')](_[_0x34e8('0x45')](_0x3ebaf1[_0x34e8('0x3c')],_0x2911be[_0x34e8('0x3d')]));if(_0x3ebaf1[_0x34e8('0x3c')][_0x34e8('0x57')]){_0x1b4f6f[_0x34e8('0x44')]=_[_0x34e8('0x46')](_0x1b4f6f['where'],{'$or':_['map'](_0x1b4f6f[_0x34e8('0x3f')],function(_0x1a3d7d){var _0x91dfb={};_0x91dfb[_0x1a3d7d]={'$like':'%'+_0x3ebaf1[_0x34e8('0x3c')][_0x34e8('0x57')]+'%'};return _0x91dfb;})});}_0x1b4f6f=_['merge']({},_0x1b4f6f,_0x3ebaf1[_0x34e8('0x4f')]);return _0x4c1bb7[_0x34e8('0x5a')](_0x1b4f6f);}})['then'](function(_0x596a50){if(_0x596a50){_0x3b3dd6=_0x596a50['length'];if(!_0x3ebaf1['query'][_0x34e8('0x41')](_0x34e8('0x42'))){_0x1b4f6f['limit']=qs[_0x34e8('0x2b')](_0x3ebaf1[_0x34e8('0x3c')]['limit']);_0x1b4f6f[_0x34e8('0x2a')]=qs['offset'](_0x3ebaf1[_0x34e8('0x3c')][_0x34e8('0x2a')]);}return _0x4c1bb7['getFields'](_0x1b4f6f);}})[_0x34e8('0x1c')](function(_0x3af602){if(_0x3af602){return _0x3af602?{'count':_0x3b3dd6,'rows':_0x3af602}:null;}})[_0x34e8('0x1c')](respondWithResult(_0xdf2c20,null))['catch'](handleError(_0xdf2c20,null));}; \ No newline at end of file diff --git a/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.model.js b/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.model.js index 970b461..85ee790 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 _0x682e=['lodash','util','../../config/logger','api','moment','bluebird','path','rimraf','../../config/environment','./intFreshsalesConfiguration.attributes','exports','define','FreshsalesConfiguration','int_freshsales_configurations'];(function(_0x50bdc7,_0x2bbb23){var _0x4f8e3e=function(_0x1012c9){while(--_0x1012c9){_0x50bdc7['push'](_0x50bdc7['shift']());}};_0x4f8e3e(++_0x2bbb23);}(_0x682e,0x1ce));var _0xe682=function(_0xb8beaa,_0x3aa379){_0xb8beaa=_0xb8beaa-0x0;var _0xdcdfcc=_0x682e[_0xb8beaa];return _0xdcdfcc;};'use strict';var _=require(_0xe682('0x0'));var util=require(_0xe682('0x1'));var logger=require(_0xe682('0x2'))(_0xe682('0x3'));var moment=require(_0xe682('0x4'));var BPromise=require(_0xe682('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xe682('0x6'));var rimraf=require(_0xe682('0x7'));var config=require(_0xe682('0x8'));var attributes=require(_0xe682('0x9'));module[_0xe682('0xa')]=function(_0x51e786,_0x3b4c98){return _0x51e786[_0xe682('0xb')](_0xe682('0xc'),attributes,{'tableName':_0xe682('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x0ff2=['../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment','exports','define','FreshsalesConfiguration','int_freshsales_configurations','lodash'];(function(_0x4c2f17,_0x5c6821){var _0x20919e=function(_0x31eef7){while(--_0x31eef7){_0x4c2f17['push'](_0x4c2f17['shift']());}};_0x20919e(++_0x5c6821);}(_0x0ff2,0x197));var _0x20ff=function(_0x10afee,_0x534712){_0x10afee=_0x10afee-0x0;var _0x285e58=_0x0ff2[_0x10afee];return _0x285e58;};'use strict';var _=require(_0x20ff('0x0'));var util=require('util');var logger=require(_0x20ff('0x1'))('api');var moment=require(_0x20ff('0x2'));var BPromise=require(_0x20ff('0x3'));var rp=require(_0x20ff('0x4'));var fs=require('fs');var path=require(_0x20ff('0x5'));var rimraf=require(_0x20ff('0x6'));var config=require(_0x20ff('0x7'));var attributes=require('./intFreshsalesConfiguration.attributes');module[_0x20ff('0x8')]=function(_0x342011,_0x229397){return _0x342011[_0x20ff('0x9')](_0x20ff('0xa'),attributes,{'tableName':_0x20ff('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 f027775..429f15e 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 _0x8533=['catch','lodash','util','moment','randomstring','ioredis','../../config/utils','rpc','jayson/promise','client','http','info','FreshsalesConfiguration,\x20%s,\x20%s','request\x20sent','FreshsalesConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result'];(function(_0x536a81,_0x4e4d08){var _0x486d16=function(_0x14d0d9){while(--_0x14d0d9){_0x536a81['push'](_0x536a81['shift']());}};_0x486d16(++_0x4e4d08);}(_0x8533,0x141));var _0x3853=function(_0x157482,_0x5d3178){_0x157482=_0x157482-0x0;var _0x16e916=_0x8533[_0x157482];return _0x16e916;};'use strict';var _=require(_0x3853('0x0'));var util=require(_0x3853('0x1'));var moment=require(_0x3853('0x2'));var BPromise=require('bluebird');var rs=require(_0x3853('0x3'));var fs=require('fs');var Redis=require(_0x3853('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x3853('0x5'));var logger=require('../../config/logger')(_0x3853('0x6'));var config=require('../../config/environment');var jayson=require(_0x3853('0x7'));var client=jayson[_0x3853('0x8')][_0x3853('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x2d95dc,_0x4eaf82,_0x3ba106){return new BPromise(function(_0xe1273c,_0x4597d1){return client['request'](_0x2d95dc,_0x3ba106)['then'](function(_0x153baa){logger[_0x3853('0xa')](_0x3853('0xb'),_0x4eaf82,_0x3853('0xc'));logger['debug'](_0x3853('0xd'),_0x4eaf82,_0x3853('0xc'),JSON[_0x3853('0xe')](_0x153baa));if(_0x153baa[_0x3853('0xf')]){if(_0x153baa[_0x3853('0xf')][_0x3853('0x10')]===0x1f4){logger['error'](_0x3853('0xb'),_0x4eaf82,_0x153baa[_0x3853('0xf')][_0x3853('0x11')]);return _0x4597d1(_0x153baa[_0x3853('0xf')]['message']);}logger[_0x3853('0xf')](_0x3853('0xb'),_0x4eaf82,_0x153baa[_0x3853('0xf')][_0x3853('0x11')]);return _0xe1273c(_0x153baa['error']['message']);}else{logger['info'](_0x3853('0xb'),_0x4eaf82,_0x3853('0xc'));_0xe1273c(_0x153baa[_0x3853('0x12')][_0x3853('0x11')]);}})[_0x3853('0x13')](function(_0x59eb33){logger[_0x3853('0xf')]('FreshsalesConfiguration,\x20%s,\x20%s',_0x4eaf82,_0x59eb33);_0x4597d1(_0x59eb33);});});} \ No newline at end of file +var _0x8369=['../../mysqldb','../../config/logger','../../config/environment','jayson/promise','http','request','info','FreshsalesConfiguration,\x20%s,\x20%s','request\x20sent','FreshsalesConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis'];(function(_0x17d9e3,_0x1f969c){var _0x14192d=function(_0x159745){while(--_0x159745){_0x17d9e3['push'](_0x17d9e3['shift']());}};_0x14192d(++_0x1f969c);}(_0x8369,0x10b));var _0x9836=function(_0x24fc8d,_0xd85c26){_0x24fc8d=_0x24fc8d-0x0;var _0x4aa33a=_0x8369[_0x24fc8d];return _0x4aa33a;};'use strict';var _=require(_0x9836('0x0'));var util=require(_0x9836('0x1'));var moment=require(_0x9836('0x2'));var BPromise=require(_0x9836('0x3'));var rs=require(_0x9836('0x4'));var fs=require('fs');var Redis=require(_0x9836('0x5'));var db=require(_0x9836('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0x9836('0x7'))('rpc');var config=require(_0x9836('0x8'));var jayson=require(_0x9836('0x9'));var client=jayson['client'][_0x9836('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x2e4979,_0x52ae78,_0x37214e){return new BPromise(function(_0x3007ed,_0x16db95){return client[_0x9836('0xb')](_0x2e4979,_0x37214e)['then'](function(_0x30bc66){logger[_0x9836('0xc')](_0x9836('0xd'),_0x52ae78,_0x9836('0xe'));logger['debug'](_0x9836('0xf'),_0x52ae78,_0x9836('0xe'),JSON[_0x9836('0x10')](_0x30bc66));if(_0x30bc66[_0x9836('0x11')]){if(_0x30bc66[_0x9836('0x11')]['code']===0x1f4){logger[_0x9836('0x11')](_0x9836('0xd'),_0x52ae78,_0x30bc66[_0x9836('0x11')][_0x9836('0x12')]);return _0x16db95(_0x30bc66[_0x9836('0x11')][_0x9836('0x12')]);}logger[_0x9836('0x11')](_0x9836('0xd'),_0x52ae78,_0x30bc66['error'][_0x9836('0x12')]);return _0x3007ed(_0x30bc66[_0x9836('0x11')][_0x9836('0x12')]);}else{logger['info'](_0x9836('0xd'),_0x52ae78,'request\x20sent');_0x3007ed(_0x30bc66[_0x9836('0x13')]['message']);}})[_0x9836('0x14')](function(_0x22f9b5){logger[_0x9836('0x11')](_0x9836('0xd'),_0x52ae78,_0x22f9b5);_0x16db95(_0x22f9b5);});});} \ No newline at end of file diff --git a/server/api/intFreshsalesField/index.js b/server/api/intFreshsalesField/index.js index 75cfeab..96cf5d5 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 _0xca96=['update','delete','destroy','exports','multer','util','path','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','get','index','/:id','show','post','isAuthenticated','create','put'];(function(_0x550e70,_0x3d9c91){var _0x4ac7da=function(_0x2f1ecc){while(--_0x2f1ecc){_0x550e70['push'](_0x550e70['shift']());}};_0x4ac7da(++_0x3d9c91);}(_0xca96,0xf4));var _0x6ca9=function(_0x145a3f,_0x90e0a5){_0x145a3f=_0x145a3f-0x0;var _0x18dec0=_0xca96[_0x145a3f];return _0x18dec0;};'use strict';var multer=require(_0x6ca9('0x0'));var util=require(_0x6ca9('0x1'));var path=require(_0x6ca9('0x2'));var timeout=require(_0x6ca9('0x3'));var express=require('express');var router=express[_0x6ca9('0x4')]();var auth=require(_0x6ca9('0x5'));var interaction=require(_0x6ca9('0x6'));var config=require(_0x6ca9('0x7'));var controller=require('./intFreshsalesField.controller');router[_0x6ca9('0x8')]('/',auth['isAuthenticated'](),controller[_0x6ca9('0x9')]);router[_0x6ca9('0x8')](_0x6ca9('0xa'),auth['isAuthenticated'](),controller[_0x6ca9('0xb')]);router[_0x6ca9('0xc')]('/',auth[_0x6ca9('0xd')](),controller[_0x6ca9('0xe')]);router[_0x6ca9('0xf')](_0x6ca9('0xa'),auth['isAuthenticated'](),controller[_0x6ca9('0x10')]);router[_0x6ca9('0x11')](_0x6ca9('0xa'),auth[_0x6ca9('0xd')](),controller[_0x6ca9('0x12')]);module[_0x6ca9('0x13')]=router; \ No newline at end of file +var _0x6898=['connect-timeout','express','Router','../../components/interaction/service','../../config/environment','get','isAuthenticated','show','post','create','delete','/:id','destroy','exports','multer','path'];(function(_0x1ac740,_0x3e549f){var _0x4d9de3=function(_0x3cb41e){while(--_0x3cb41e){_0x1ac740['push'](_0x1ac740['shift']());}};_0x4d9de3(++_0x3e549f);}(_0x6898,0x14e));var _0x8689=function(_0x30e786,_0x4c8af9){_0x30e786=_0x30e786-0x0;var _0x55df5a=_0x6898[_0x30e786];return _0x55df5a;};'use strict';var multer=require(_0x8689('0x0'));var util=require('util');var path=require(_0x8689('0x1'));var timeout=require(_0x8689('0x2'));var express=require(_0x8689('0x3'));var router=express[_0x8689('0x4')]();var auth=require('../../components/auth/service');var interaction=require(_0x8689('0x5'));var config=require(_0x8689('0x6'));var controller=require('./intFreshsalesField.controller');router[_0x8689('0x7')]('/',auth['isAuthenticated'](),controller['index']);router[_0x8689('0x7')]('/:id',auth[_0x8689('0x8')](),controller[_0x8689('0x9')]);router[_0x8689('0xa')]('/',auth['isAuthenticated'](),controller[_0x8689('0xb')]);router['put']('/:id',auth[_0x8689('0x8')](),controller['update']);router[_0x8689('0xc')](_0x8689('0xd'),auth[_0x8689('0x8')](),controller[_0x8689('0xe')]);module[_0x8689('0xf')]=router; \ No newline at end of file diff --git a/server/api/intFreshsalesField/intFreshsalesField.attributes.js b/server/api/intFreshsalesField/intFreshsalesField.attributes.js index 0b25828..4295d3d 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 _0xdf4b=['customVariable','STRING','ENUM','sequelize','exports','string','variable'];(function(_0x2eadf4,_0x592302){var _0x44ad1a=function(_0x4c1828){while(--_0x4c1828){_0x2eadf4['push'](_0x2eadf4['shift']());}};_0x44ad1a(++_0x592302);}(_0xdf4b,0x88));var _0xbdf4=function(_0x3bbfcc,_0x4b2a78){_0x3bbfcc=_0x3bbfcc-0x0;var _0x17915d=_0xdf4b[_0x3bbfcc];return _0x17915d;};'use strict';var Sequelize=require(_0xbdf4('0x0'));module[_0xbdf4('0x1')]={'type':{'type':Sequelize['ENUM'](_0xbdf4('0x2'),_0xbdf4('0x3'),_0xbdf4('0x4'),'keyValue'),'defaultValue':'string'},'content':{'type':Sequelize['STRING']},'key':{'type':Sequelize[_0xbdf4('0x5')]},'keyType':{'type':Sequelize[_0xbdf4('0x6')](_0xbdf4('0x2'),_0xbdf4('0x3'),'customVariable')},'keyContent':{'type':Sequelize[_0xbdf4('0x5')]},'idField':{'type':Sequelize[_0xbdf4('0x5')]},'nameField':{'type':Sequelize['STRING']},'customField':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'variableName':{'type':Sequelize[_0xbdf4('0x5')]}}; \ No newline at end of file +var _0xaf5a=['keyValue','STRING','ENUM','BOOLEAN','exports','string','variable','customVariable'];(function(_0x4c445a,_0x4ee80f){var _0x2f611c=function(_0x4f3699){while(--_0x4f3699){_0x4c445a['push'](_0x4c445a['shift']());}};_0x2f611c(++_0x4ee80f);}(_0xaf5a,0x144));var _0xaaf5=function(_0x3e4a61,_0x59a7c0){_0x3e4a61=_0x3e4a61-0x0;var _0x2361b5=_0xaf5a[_0x3e4a61];return _0x2361b5;};'use strict';var Sequelize=require('sequelize');module[_0xaaf5('0x0')]={'type':{'type':Sequelize['ENUM'](_0xaaf5('0x1'),_0xaaf5('0x2'),_0xaaf5('0x3'),_0xaaf5('0x4')),'defaultValue':_0xaaf5('0x1')},'content':{'type':Sequelize[_0xaaf5('0x5')]},'key':{'type':Sequelize[_0xaaf5('0x5')]},'keyType':{'type':Sequelize[_0xaaf5('0x6')]('string',_0xaaf5('0x2'),'customVariable')},'keyContent':{'type':Sequelize[_0xaaf5('0x5')]},'idField':{'type':Sequelize[_0xaaf5('0x5')]},'nameField':{'type':Sequelize[_0xaaf5('0x5')]},'customField':{'type':Sequelize[_0xaaf5('0x7')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0xaaf5('0x5')]}}; \ No newline at end of file diff --git a/server/api/intFreshsalesField/intFreshsalesField.controller.js b/server/api/intFreshsalesField/intFreshsalesField.controller.js index 4c10d3b..2fc29d3 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 _0x4bde=['moment','bluebird','util','path','sox','to-csv','ejs','lodash','crypto','jsforce','desk.js','querystring','papaparse','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','status','json','count','offset','limit','set','Content-Range','reject','save','update','destroy','then','end','sendStatus','stack','name','send','index','map','FreshsalesField','rawAttributes','fieldName','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','type','VIRTUAL','includeAll','include','catch','show','params','find','create','body','html-pdf','eml-format','rimraf','fast-json-patch','request-promise'];(function(_0x1a8132,_0x1d4978){var _0x5b9329=function(_0x1f1447){while(--_0x1f1447){_0x1a8132['push'](_0x1a8132['shift']());}};_0x5b9329(++_0x1d4978);}(_0x4bde,0x1b1));var _0xe4bd=function(_0x8a0f1b,_0x2d4e7c){_0x8a0f1b=_0x8a0f1b-0x0;var _0x4af837=_0x4bde[_0x8a0f1b];return _0x4af837;};'use strict';var pdf=require(_0xe4bd('0x0'));var emlformat=require(_0xe4bd('0x1'));var rimraf=require(_0xe4bd('0x2'));var zipdir=require('zip-dir');var jsonpatch=require(_0xe4bd('0x3'));var rp=require(_0xe4bd('0x4'));var moment=require(_0xe4bd('0x5'));var BPromise=require(_0xe4bd('0x6'));var Mustache=require('mustache');var util=require(_0xe4bd('0x7'));var path=require(_0xe4bd('0x8'));var sox=require(_0xe4bd('0x9'));var csv=require(_0xe4bd('0xa'));var ejs=require(_0xe4bd('0xb'));var fs=require('fs');var _=require(_0xe4bd('0xc'));var squel=require('squel');var crypto=require(_0xe4bd('0xd'));var jsforce=require(_0xe4bd('0xe'));var deskjs=require(_0xe4bd('0xf'));var toCsv=require(_0xe4bd('0xa'));var querystring=require(_0xe4bd('0x10'));var Papa=require(_0xe4bd('0x11'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0xe4bd('0x12'));var hardwareService=require(_0xe4bd('0x13'));var logger=require(_0xe4bd('0x14'))('api');var utils=require(_0xe4bd('0x15'));var config=require(_0xe4bd('0x16'));var db=require(_0xe4bd('0x17'))['db'];function respondWithStatusCode(_0x460916,_0x507e85){_0x507e85=_0x507e85||0xcc;return function(_0x7949ea){if(_0x7949ea){return _0x460916['sendStatus'](_0x507e85);}return _0x460916[_0xe4bd('0x18')](_0x507e85)['end']();};}function respondWithResult(_0x3ce098,_0x15b9f9){_0x15b9f9=_0x15b9f9||0xc8;return function(_0x25b993){if(_0x25b993){return _0x3ce098[_0xe4bd('0x18')](_0x15b9f9)[_0xe4bd('0x19')](_0x25b993);}};}function respondWithFilteredResult(_0x37dd1b,_0x15c3f0){return function(_0x44ef1d){if(_0x44ef1d){var _0x193221=_0x44ef1d[_0xe4bd('0x1a')],_0x2476f=_0x15c3f0['offset'],_0x355922=_0x15c3f0[_0xe4bd('0x1b')]+_0x15c3f0[_0xe4bd('0x1c')],_0x4337f7;if(_0x355922>=_0x193221){_0x355922=_0x193221;_0x4337f7=0xc8;}else{_0x4337f7=0xce;}_0x37dd1b['status'](_0x4337f7);return _0x37dd1b[_0xe4bd('0x1d')](_0xe4bd('0x1e'),_0x2476f+'-'+_0x355922+'/'+_0x193221)['json'](_0x44ef1d);}return null;};}function patchUpdates(_0x1ab4bc){return function(_0x56d572){try{jsonpatch['apply'](_0x56d572,_0x1ab4bc,!![]);}catch(_0x20cce4){return BPromise[_0xe4bd('0x1f')](_0x20cce4);}return _0x56d572[_0xe4bd('0x20')]();};}function saveUpdates(_0x3aea8a,_0x10a234){return function(_0x12a646){if(_0x12a646){return _0x12a646[_0xe4bd('0x21')](_0x3aea8a)['then'](function(_0x2ce8c4){return _0x2ce8c4;});}return null;};}function removeEntity(_0x185db8,_0x5bd480){return function(_0x2a5f40){if(_0x2a5f40){return _0x2a5f40[_0xe4bd('0x22')]()[_0xe4bd('0x23')](function(){_0x185db8[_0xe4bd('0x18')](0xcc)[_0xe4bd('0x24')]();});}};}function handleEntityNotFound(_0x2cfab3,_0x10d9fc){return function(_0x1e2abf){if(!_0x1e2abf){_0x2cfab3[_0xe4bd('0x25')](0x194);}return _0x1e2abf;};}function handleError(_0x4edd31,_0x1ab72b){_0x1ab72b=_0x1ab72b||0x1f4;return function(_0x2ebf25){logger['error'](_0x2ebf25[_0xe4bd('0x26')]);if(_0x2ebf25[_0xe4bd('0x27')]){delete _0x2ebf25[_0xe4bd('0x27')];}_0x4edd31[_0xe4bd('0x18')](_0x1ab72b)[_0xe4bd('0x28')](_0x2ebf25);};}exports[_0xe4bd('0x29')]=function(_0x40e9c7,_0x3d8fc8){var _0x534fdb={},_0x3eb927={},_0x234b73={'count':0x0,'rows':[]};var _0x1e04e7=_[_0xe4bd('0x2a')](db[_0xe4bd('0x2b')][_0xe4bd('0x2c')],function(_0x243da2){return{'name':_0x243da2[_0xe4bd('0x2d')],'type':_0x243da2['type'][_0xe4bd('0x2e')]};});_0x3eb927[_0xe4bd('0x2f')]=_[_0xe4bd('0x2a')](_0x1e04e7,_0xe4bd('0x27'));_0x3eb927[_0xe4bd('0x30')]=_[_0xe4bd('0x31')](_0x40e9c7[_0xe4bd('0x30')]);_0x3eb927[_0xe4bd('0x32')]=_[_0xe4bd('0x33')](_0x3eb927[_0xe4bd('0x2f')],_0x3eb927[_0xe4bd('0x30')]);_0x534fdb[_0xe4bd('0x34')]=_['intersection'](_0x3eb927['model'],qs[_0xe4bd('0x35')](_0x40e9c7[_0xe4bd('0x30')][_0xe4bd('0x35')]));_0x534fdb[_0xe4bd('0x34')]=_0x534fdb['attributes'][_0xe4bd('0x36')]?_0x534fdb[_0xe4bd('0x34')]:_0x3eb927[_0xe4bd('0x2f')];if(!_0x40e9c7[_0xe4bd('0x30')][_0xe4bd('0x37')](_0xe4bd('0x38'))){_0x534fdb[_0xe4bd('0x1c')]=qs['limit'](_0x40e9c7['query']['limit']);_0x534fdb[_0xe4bd('0x1b')]=qs['offset'](_0x40e9c7['query'][_0xe4bd('0x1b')]);}_0x534fdb[_0xe4bd('0x39')]=qs['sort'](_0x40e9c7['query'][_0xe4bd('0x3a')]);_0x534fdb[_0xe4bd('0x3b')]=qs['filters'](_[_0xe4bd('0x3c')](_0x40e9c7[_0xe4bd('0x30')],_0x3eb927[_0xe4bd('0x32')]));if(_0x40e9c7[_0xe4bd('0x30')][_0xe4bd('0x3d')]){_0x534fdb[_0xe4bd('0x3b')]=_[_0xe4bd('0x3e')](_0x534fdb[_0xe4bd('0x3b')],{'$or':_[_0xe4bd('0x2a')](_0x1e04e7,function(_0x313d6a){if(_0x313d6a[_0xe4bd('0x3f')]!==_0xe4bd('0x40')){var _0x249976={};_0x249976[_0x313d6a[_0xe4bd('0x27')]]={'$like':'%'+_0x40e9c7['query'][_0xe4bd('0x3d')]+'%'};return _0x249976;}})});}_0x534fdb=_[_0xe4bd('0x3e')]({},_0x534fdb,_0x40e9c7['options']);var _0x38b553={'where':_0x534fdb['where']};return db[_0xe4bd('0x2b')][_0xe4bd('0x1a')](_0x38b553)[_0xe4bd('0x23')](function(_0x4cf4c4){_0x234b73['count']=_0x4cf4c4;if(_0x40e9c7[_0xe4bd('0x30')][_0xe4bd('0x41')]){_0x534fdb[_0xe4bd('0x42')]=[{'all':!![]}];}return db[_0xe4bd('0x2b')]['findAll'](_0x534fdb);})['then'](function(_0x198bf5){_0x234b73['rows']=_0x198bf5;return _0x234b73;})[_0xe4bd('0x23')](respondWithFilteredResult(_0x3d8fc8,_0x534fdb))[_0xe4bd('0x43')](handleError(_0x3d8fc8,null));};exports[_0xe4bd('0x44')]=function(_0x564184,_0x520934){var _0x14517f={'raw':!![],'where':{'id':_0x564184[_0xe4bd('0x45')]['id']}},_0xabf9ab={};_0xabf9ab[_0xe4bd('0x2f')]=_['keys'](db[_0xe4bd('0x2b')][_0xe4bd('0x2c')]);_0xabf9ab[_0xe4bd('0x30')]=_[_0xe4bd('0x31')](_0x564184['query']);_0xabf9ab[_0xe4bd('0x32')]=_[_0xe4bd('0x33')](_0xabf9ab['model'],_0xabf9ab[_0xe4bd('0x30')]);_0x14517f[_0xe4bd('0x34')]=_[_0xe4bd('0x33')](_0xabf9ab[_0xe4bd('0x2f')],qs[_0xe4bd('0x35')](_0x564184[_0xe4bd('0x30')][_0xe4bd('0x35')]));_0x14517f['attributes']=_0x14517f[_0xe4bd('0x34')][_0xe4bd('0x36')]?_0x14517f[_0xe4bd('0x34')]:_0xabf9ab[_0xe4bd('0x2f')];if(_0x564184[_0xe4bd('0x30')][_0xe4bd('0x41')]){_0x14517f[_0xe4bd('0x42')]=[{'all':!![]}];}_0x14517f=_['merge']({},_0x14517f,_0x564184['options']);return db[_0xe4bd('0x2b')][_0xe4bd('0x46')](_0x14517f)[_0xe4bd('0x23')](handleEntityNotFound(_0x520934,null))['then'](respondWithResult(_0x520934,null))['catch'](handleError(_0x520934,null));};exports[_0xe4bd('0x47')]=function(_0x4e5417,_0x346c59){return db[_0xe4bd('0x2b')]['create'](_0x4e5417[_0xe4bd('0x48')],{})[_0xe4bd('0x23')](respondWithResult(_0x346c59,0xc9))[_0xe4bd('0x43')](handleError(_0x346c59,null));};exports[_0xe4bd('0x21')]=function(_0x92952e,_0x2fa2e9){if(_0x92952e[_0xe4bd('0x48')]['id']){delete _0x92952e['body']['id'];}return db['FreshsalesField'][_0xe4bd('0x46')]({'where':{'id':_0x92952e[_0xe4bd('0x45')]['id']}})[_0xe4bd('0x23')](handleEntityNotFound(_0x2fa2e9,null))[_0xe4bd('0x23')](saveUpdates(_0x92952e[_0xe4bd('0x48')],null))[_0xe4bd('0x23')](respondWithResult(_0x2fa2e9,null))[_0xe4bd('0x43')](handleError(_0x2fa2e9,null));};exports['destroy']=function(_0x3d5388,_0xff9b4b){return db['FreshsalesField']['find']({'where':{'id':_0x3d5388[_0xe4bd('0x45')]['id']}})[_0xe4bd('0x23')](handleEntityNotFound(_0xff9b4b,null))[_0xe4bd('0x23')](removeEntity(_0xff9b4b,null))['catch'](handleError(_0xff9b4b,null));}; \ No newline at end of file +var _0x3a25=['eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/environment','../../mysqldb','sendStatus','status','end','json','count','limit','set','Content-Range','reject','update','destroy','then','error','name','send','index','map','FreshsalesField','rawAttributes','fieldName','type','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','offset','sort','merge','VIRTUAL','filter','where','includeAll','include','catch','params','find','body','html-pdf'];(function(_0x304b67,_0x31cb39){var _0x493afb=function(_0x21dce3){while(--_0x21dce3){_0x304b67['push'](_0x304b67['shift']());}};_0x493afb(++_0x31cb39);}(_0x3a25,0x15d));var _0x53a2=function(_0x44c5f0,_0x32669d){_0x44c5f0=_0x44c5f0-0x0;var _0x38c003=_0x3a25[_0x44c5f0];return _0x38c003;};'use strict';var pdf=require(_0x53a2('0x0'));var emlformat=require(_0x53a2('0x1'));var rimraf=require(_0x53a2('0x2'));var zipdir=require(_0x53a2('0x3'));var jsonpatch=require(_0x53a2('0x4'));var rp=require(_0x53a2('0x5'));var moment=require(_0x53a2('0x6'));var BPromise=require(_0x53a2('0x7'));var Mustache=require(_0x53a2('0x8'));var util=require(_0x53a2('0x9'));var path=require(_0x53a2('0xa'));var sox=require(_0x53a2('0xb'));var csv=require(_0x53a2('0xc'));var ejs=require(_0x53a2('0xd'));var fs=require('fs');var _=require(_0x53a2('0xe'));var squel=require('squel');var crypto=require(_0x53a2('0xf'));var jsforce=require('jsforce');var deskjs=require(_0x53a2('0x10'));var toCsv=require(_0x53a2('0xc'));var querystring=require(_0x53a2('0x11'));var Papa=require(_0x53a2('0x12'));var Redis=require(_0x53a2('0x13'));var authService=require(_0x53a2('0x14'));var qs=require(_0x53a2('0x15'));var as=require(_0x53a2('0x16'));var hardwareService=require(_0x53a2('0x17'));var logger=require(_0x53a2('0x18'))('api');var utils=require('../../config/utils');var config=require(_0x53a2('0x19'));var db=require(_0x53a2('0x1a'))['db'];function respondWithStatusCode(_0x573957,_0x564ca9){_0x564ca9=_0x564ca9||0xcc;return function(_0x47881a){if(_0x47881a){return _0x573957[_0x53a2('0x1b')](_0x564ca9);}return _0x573957[_0x53a2('0x1c')](_0x564ca9)[_0x53a2('0x1d')]();};}function respondWithResult(_0x5a7f66,_0x58070c){_0x58070c=_0x58070c||0xc8;return function(_0x4e2228){if(_0x4e2228){return _0x5a7f66[_0x53a2('0x1c')](_0x58070c)[_0x53a2('0x1e')](_0x4e2228);}};}function respondWithFilteredResult(_0x411186,_0xf9b589){return function(_0x4d3a40){if(_0x4d3a40){var _0x1779ef=_0x4d3a40[_0x53a2('0x1f')],_0x3343d3=_0xf9b589['offset'],_0x4401b7=_0xf9b589['offset']+_0xf9b589[_0x53a2('0x20')],_0x42db86;if(_0x4401b7>=_0x1779ef){_0x4401b7=_0x1779ef;_0x42db86=0xc8;}else{_0x42db86=0xce;}_0x411186[_0x53a2('0x1c')](_0x42db86);return _0x411186[_0x53a2('0x21')](_0x53a2('0x22'),_0x3343d3+'-'+_0x4401b7+'/'+_0x1779ef)[_0x53a2('0x1e')](_0x4d3a40);}return null;};}function patchUpdates(_0x395dfd){return function(_0x542d31){try{jsonpatch['apply'](_0x542d31,_0x395dfd,!![]);}catch(_0x3446c2){return BPromise[_0x53a2('0x23')](_0x3446c2);}return _0x542d31['save']();};}function saveUpdates(_0x2b7059,_0x3fb15b){return function(_0x3efc90){if(_0x3efc90){return _0x3efc90[_0x53a2('0x24')](_0x2b7059)['then'](function(_0x32a804){return _0x32a804;});}return null;};}function removeEntity(_0x372f7e,_0xd9693c){return function(_0x2cda68){if(_0x2cda68){return _0x2cda68[_0x53a2('0x25')]()[_0x53a2('0x26')](function(){_0x372f7e[_0x53a2('0x1c')](0xcc)[_0x53a2('0x1d')]();});}};}function handleEntityNotFound(_0x4a1a34,_0x579b10){return function(_0x473042){if(!_0x473042){_0x4a1a34[_0x53a2('0x1b')](0x194);}return _0x473042;};}function handleError(_0x25f46b,_0x2852a1){_0x2852a1=_0x2852a1||0x1f4;return function(_0x2615ac){logger[_0x53a2('0x27')](_0x2615ac['stack']);if(_0x2615ac[_0x53a2('0x28')]){delete _0x2615ac[_0x53a2('0x28')];}_0x25f46b[_0x53a2('0x1c')](_0x2852a1)[_0x53a2('0x29')](_0x2615ac);};}exports[_0x53a2('0x2a')]=function(_0x3e4e69,_0x21325d){var _0x41ae20={},_0x2f2062={},_0x10e271={'count':0x0,'rows':[]};var _0x18d6df=_[_0x53a2('0x2b')](db[_0x53a2('0x2c')][_0x53a2('0x2d')],function(_0x2a6428){return{'name':_0x2a6428[_0x53a2('0x2e')],'type':_0x2a6428[_0x53a2('0x2f')]['key']};});_0x2f2062[_0x53a2('0x30')]=_[_0x53a2('0x2b')](_0x18d6df,_0x53a2('0x28'));_0x2f2062[_0x53a2('0x31')]=_[_0x53a2('0x32')](_0x3e4e69[_0x53a2('0x31')]);_0x2f2062[_0x53a2('0x33')]=_[_0x53a2('0x34')](_0x2f2062[_0x53a2('0x30')],_0x2f2062[_0x53a2('0x31')]);_0x41ae20[_0x53a2('0x35')]=_['intersection'](_0x2f2062[_0x53a2('0x30')],qs[_0x53a2('0x36')](_0x3e4e69[_0x53a2('0x31')][_0x53a2('0x36')]));_0x41ae20[_0x53a2('0x35')]=_0x41ae20[_0x53a2('0x35')][_0x53a2('0x37')]?_0x41ae20[_0x53a2('0x35')]:_0x2f2062['model'];if(!_0x3e4e69[_0x53a2('0x31')][_0x53a2('0x38')](_0x53a2('0x39'))){_0x41ae20[_0x53a2('0x20')]=qs['limit'](_0x3e4e69[_0x53a2('0x31')][_0x53a2('0x20')]);_0x41ae20[_0x53a2('0x3a')]=qs[_0x53a2('0x3a')](_0x3e4e69[_0x53a2('0x31')][_0x53a2('0x3a')]);}_0x41ae20['order']=qs[_0x53a2('0x3b')](_0x3e4e69[_0x53a2('0x31')][_0x53a2('0x3b')]);_0x41ae20['where']=qs[_0x53a2('0x33')](_['pick'](_0x3e4e69[_0x53a2('0x31')],_0x2f2062[_0x53a2('0x33')]));if(_0x3e4e69[_0x53a2('0x31')]['filter']){_0x41ae20['where']=_[_0x53a2('0x3c')](_0x41ae20['where'],{'$or':_[_0x53a2('0x2b')](_0x18d6df,function(_0x397cfb){if(_0x397cfb[_0x53a2('0x2f')]!==_0x53a2('0x3d')){var _0x2f85db={};_0x2f85db[_0x397cfb[_0x53a2('0x28')]]={'$like':'%'+_0x3e4e69['query'][_0x53a2('0x3e')]+'%'};return _0x2f85db;}})});}_0x41ae20=_[_0x53a2('0x3c')]({},_0x41ae20,_0x3e4e69['options']);var _0x536e65={'where':_0x41ae20[_0x53a2('0x3f')]};return db['FreshsalesField'][_0x53a2('0x1f')](_0x536e65)[_0x53a2('0x26')](function(_0x594961){_0x10e271[_0x53a2('0x1f')]=_0x594961;if(_0x3e4e69[_0x53a2('0x31')][_0x53a2('0x40')]){_0x41ae20[_0x53a2('0x41')]=[{'all':!![]}];}return db[_0x53a2('0x2c')]['findAll'](_0x41ae20);})[_0x53a2('0x26')](function(_0x331e62){_0x10e271['rows']=_0x331e62;return _0x10e271;})[_0x53a2('0x26')](respondWithFilteredResult(_0x21325d,_0x41ae20))[_0x53a2('0x42')](handleError(_0x21325d,null));};exports['show']=function(_0xc69953,_0x501de6){var _0xd5bcc8={'raw':!![],'where':{'id':_0xc69953[_0x53a2('0x43')]['id']}},_0x405891={};_0x405891[_0x53a2('0x30')]=_[_0x53a2('0x32')](db[_0x53a2('0x2c')]['rawAttributes']);_0x405891[_0x53a2('0x31')]=_[_0x53a2('0x32')](_0xc69953[_0x53a2('0x31')]);_0x405891[_0x53a2('0x33')]=_[_0x53a2('0x34')](_0x405891[_0x53a2('0x30')],_0x405891[_0x53a2('0x31')]);_0xd5bcc8[_0x53a2('0x35')]=_[_0x53a2('0x34')](_0x405891[_0x53a2('0x30')],qs[_0x53a2('0x36')](_0xc69953[_0x53a2('0x31')][_0x53a2('0x36')]));_0xd5bcc8[_0x53a2('0x35')]=_0xd5bcc8[_0x53a2('0x35')][_0x53a2('0x37')]?_0xd5bcc8['attributes']:_0x405891[_0x53a2('0x30')];if(_0xc69953[_0x53a2('0x31')]['includeAll']){_0xd5bcc8['include']=[{'all':!![]}];}_0xd5bcc8=_[_0x53a2('0x3c')]({},_0xd5bcc8,_0xc69953['options']);return db['FreshsalesField'][_0x53a2('0x44')](_0xd5bcc8)[_0x53a2('0x26')](handleEntityNotFound(_0x501de6,null))[_0x53a2('0x26')](respondWithResult(_0x501de6,null))[_0x53a2('0x42')](handleError(_0x501de6,null));};exports['create']=function(_0x5ed98a,_0x53ecf0){return db[_0x53a2('0x2c')]['create'](_0x5ed98a['body'],{})[_0x53a2('0x26')](respondWithResult(_0x53ecf0,0xc9))[_0x53a2('0x42')](handleError(_0x53ecf0,null));};exports[_0x53a2('0x24')]=function(_0x32a6fd,_0x2d07bb){if(_0x32a6fd['body']['id']){delete _0x32a6fd[_0x53a2('0x45')]['id'];}return db['FreshsalesField'][_0x53a2('0x44')]({'where':{'id':_0x32a6fd[_0x53a2('0x43')]['id']}})['then'](handleEntityNotFound(_0x2d07bb,null))[_0x53a2('0x26')](saveUpdates(_0x32a6fd[_0x53a2('0x45')],null))[_0x53a2('0x26')](respondWithResult(_0x2d07bb,null))[_0x53a2('0x42')](handleError(_0x2d07bb,null));};exports[_0x53a2('0x25')]=function(_0x6fd478,_0x622575){return db['FreshsalesField'][_0x53a2('0x44')]({'where':{'id':_0x6fd478[_0x53a2('0x43')]['id']}})[_0x53a2('0x26')](handleEntityNotFound(_0x622575,null))['then'](removeEntity(_0x622575,null))[_0x53a2('0x42')](handleError(_0x622575,null));}; \ No newline at end of file diff --git a/server/api/intFreshsalesField/intFreshsalesField.model.js b/server/api/intFreshsalesField/intFreshsalesField.model.js index 39c291e..b312bfa 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 _0xd75f=['request-promise','path','rimraf','../../config/environment','./intFreshsalesField.attributes','exports','FreshsalesField','int_freshsales_fields','freshsales_unique_index','idField','FieldId','../../config/logger','api','bluebird'];(function(_0x4632bc,_0x7fb5f2){var _0x2a5cff=function(_0x4c9603){while(--_0x4c9603){_0x4632bc['push'](_0x4632bc['shift']());}};_0x2a5cff(++_0x7fb5f2);}(_0xd75f,0x13f));var _0xfd75=function(_0x12030f,_0x349963){_0x12030f=_0x12030f-0x0;var _0x23583e=_0xd75f[_0x12030f];return _0x23583e;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0xfd75('0x0'))(_0xfd75('0x1'));var moment=require('moment');var BPromise=require(_0xfd75('0x2'));var rp=require(_0xfd75('0x3'));var fs=require('fs');var path=require(_0xfd75('0x4'));var rimraf=require(_0xfd75('0x5'));var config=require(_0xfd75('0x6'));var attributes=require(_0xfd75('0x7'));module[_0xfd75('0x8')]=function(_0x581279,_0x41b086){return _0x581279['define'](_0xfd75('0x9'),attributes,{'tableName':_0xfd75('0xa'),'paranoid':![],'indexes':[{'name':_0xfd75('0xb'),'fields':[_0xfd75('0xc'),_0xfd75('0xd')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0xb79a=['FreshsalesField','int_freshsales_fields','freshsales_unique_index','idField','lodash','util','../../config/logger','bluebird','path','rimraf','../../config/environment','exports','define'];(function(_0x29b609,_0x19d388){var _0x54c952=function(_0xb3c38d){while(--_0xb3c38d){_0x29b609['push'](_0x29b609['shift']());}};_0x54c952(++_0x19d388);}(_0xb79a,0x163));var _0xab79=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0xb79a[_0x321bb2];return _0x9c12ed;};'use strict';var _=require(_0xab79('0x0'));var util=require(_0xab79('0x1'));var logger=require(_0xab79('0x2'))('api');var moment=require('moment');var BPromise=require(_0xab79('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xab79('0x4'));var rimraf=require(_0xab79('0x5'));var config=require(_0xab79('0x6'));var attributes=require('./intFreshsalesField.attributes');module[_0xab79('0x7')]=function(_0x571943,_0x44f09d){return _0x571943[_0xab79('0x8')](_0xab79('0x9'),attributes,{'tableName':_0xab79('0xa'),'paranoid':![],'indexes':[{'name':_0xab79('0xb'),'fields':[_0xab79('0xc'),'FieldId'],'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 a535440..f9a73bd 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 _0x4e6b=['info','FreshsalesField,\x20%s,\x20%s','debug','request\x20sent','stringify','error','code','message','result','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then'];(function(_0x175e89,_0x20835f){var _0x2ed996=function(_0x56239f){while(--_0x56239f){_0x175e89['push'](_0x175e89['shift']());}};_0x2ed996(++_0x20835f);}(_0x4e6b,0x134));var _0xb4e6=function(_0x3bf83f,_0x181cac){_0x3bf83f=_0x3bf83f-0x0;var _0x22c4a9=_0x4e6b[_0x3bf83f];return _0x22c4a9;};'use strict';var _=require(_0xb4e6('0x0'));var util=require(_0xb4e6('0x1'));var moment=require(_0xb4e6('0x2'));var BPromise=require(_0xb4e6('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xb4e6('0x4'));var db=require(_0xb4e6('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0xb4e6('0x6'))(_0xb4e6('0x7'));var config=require(_0xb4e6('0x8'));var jayson=require(_0xb4e6('0x9'));var client=jayson[_0xb4e6('0xa')][_0xb4e6('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x10c4ab,_0xb60f63,_0x3ecfe6){return new BPromise(function(_0x5ab7e8,_0x186dbb){return client[_0xb4e6('0xc')](_0x10c4ab,_0x3ecfe6)[_0xb4e6('0xd')](function(_0xf6ba88){logger[_0xb4e6('0xe')](_0xb4e6('0xf'),_0xb60f63,'request\x20sent');logger[_0xb4e6('0x10')]('FreshsalesField,\x20%s,\x20%s,\x20%s',_0xb60f63,_0xb4e6('0x11'),JSON[_0xb4e6('0x12')](_0xf6ba88));if(_0xf6ba88[_0xb4e6('0x13')]){if(_0xf6ba88[_0xb4e6('0x13')][_0xb4e6('0x14')]===0x1f4){logger[_0xb4e6('0x13')](_0xb4e6('0xf'),_0xb60f63,_0xf6ba88[_0xb4e6('0x13')]['message']);return _0x186dbb(_0xf6ba88['error']['message']);}logger['error'](_0xb4e6('0xf'),_0xb60f63,_0xf6ba88[_0xb4e6('0x13')][_0xb4e6('0x15')]);return _0x5ab7e8(_0xf6ba88['error'][_0xb4e6('0x15')]);}else{logger[_0xb4e6('0xe')](_0xb4e6('0xf'),_0xb60f63,_0xb4e6('0x11'));_0x5ab7e8(_0xf6ba88[_0xb4e6('0x16')][_0xb4e6('0x15')]);}})['catch'](function(_0x8023aa){logger[_0xb4e6('0x13')](_0xb4e6('0xf'),_0xb60f63,_0x8023aa);_0x186dbb(_0x8023aa);});});} \ No newline at end of file +var _0xb9d9=['lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','info','request\x20sent','FreshsalesField,\x20%s,\x20%s,\x20%s','stringify','error','FreshsalesField,\x20%s,\x20%s','message','catch'];(function(_0xcbf03b,_0x2ddbfd){var _0x2384a6=function(_0x58a614){while(--_0x58a614){_0xcbf03b['push'](_0xcbf03b['shift']());}};_0x2384a6(++_0x2ddbfd);}(_0xb9d9,0x104));var _0x9b9d=function(_0x2dafbe,_0x5d04de){_0x2dafbe=_0x2dafbe-0x0;var _0x58a45a=_0xb9d9[_0x2dafbe];return _0x58a45a;};'use strict';var _=require(_0x9b9d('0x0'));var util=require(_0x9b9d('0x1'));var moment=require(_0x9b9d('0x2'));var BPromise=require(_0x9b9d('0x3'));var rs=require(_0x9b9d('0x4'));var fs=require('fs');var Redis=require(_0x9b9d('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x9b9d('0x6'));var logger=require(_0x9b9d('0x7'))(_0x9b9d('0x8'));var config=require(_0x9b9d('0x9'));var jayson=require('jayson/promise');var client=jayson[_0x9b9d('0xa')][_0x9b9d('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x58229e,_0x2cc391,_0x447bdb){return new BPromise(function(_0x4086a3,_0x4456c8){return client['request'](_0x58229e,_0x447bdb)['then'](function(_0x5bca35){logger[_0x9b9d('0xc')]('FreshsalesField,\x20%s,\x20%s',_0x2cc391,_0x9b9d('0xd'));logger['debug'](_0x9b9d('0xe'),_0x2cc391,_0x9b9d('0xd'),JSON[_0x9b9d('0xf')](_0x5bca35));if(_0x5bca35[_0x9b9d('0x10')]){if(_0x5bca35[_0x9b9d('0x10')]['code']===0x1f4){logger['error'](_0x9b9d('0x11'),_0x2cc391,_0x5bca35[_0x9b9d('0x10')]['message']);return _0x4456c8(_0x5bca35[_0x9b9d('0x10')][_0x9b9d('0x12')]);}logger[_0x9b9d('0x10')]('FreshsalesField,\x20%s,\x20%s',_0x2cc391,_0x5bca35[_0x9b9d('0x10')][_0x9b9d('0x12')]);return _0x4086a3(_0x5bca35[_0x9b9d('0x10')][_0x9b9d('0x12')]);}else{logger[_0x9b9d('0xc')](_0x9b9d('0x11'),_0x2cc391,'request\x20sent');_0x4086a3(_0x5bca35['result'][_0x9b9d('0x12')]);}})[_0x9b9d('0x13')](function(_0x4492ed){logger[_0x9b9d('0x10')](_0x9b9d('0x11'),_0x2cc391,_0x4492ed);_0x4456c8(_0x4492ed);});});} \ No newline at end of file diff --git a/server/api/intSalesforceAccount/index.js b/server/api/intSalesforceAccount/index.js index 162adc1..bb7c5d3 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 _0x1472=['index','get','show','/:id/configurations','getConfigurations','/:id/fields','getFields','post','create','/:id','update','delete','exports','multer','path','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','isAuthenticated'];(function(_0x1cbcf1,_0x3f9fd9){var _0x3a06f0=function(_0x5425d4){while(--_0x5425d4){_0x1cbcf1['push'](_0x1cbcf1['shift']());}};_0x3a06f0(++_0x3f9fd9);}(_0x1472,0xe9));var _0x2147=function(_0x1af8d3,_0x544d86){_0x1af8d3=_0x1af8d3-0x0;var _0x3a50c5=_0x1472[_0x1af8d3];return _0x3a50c5;};'use strict';var multer=require(_0x2147('0x0'));var util=require('util');var path=require(_0x2147('0x1'));var timeout=require(_0x2147('0x2'));var express=require('express');var router=express[_0x2147('0x3')]();var auth=require(_0x2147('0x4'));var interaction=require(_0x2147('0x5'));var config=require('../../config/environment');var controller=require('./intSalesforceAccount.controller');router['get']('/',auth[_0x2147('0x6')](),controller[_0x2147('0x7')]);router[_0x2147('0x8')]('/:id',auth['isAuthenticated'](),controller[_0x2147('0x9')]);router[_0x2147('0x8')](_0x2147('0xa'),auth[_0x2147('0x6')](),controller[_0x2147('0xb')]);router[_0x2147('0x8')](_0x2147('0xc'),auth[_0x2147('0x6')](),controller[_0x2147('0xd')]);router[_0x2147('0xe')]('/',auth[_0x2147('0x6')](),controller[_0x2147('0xf')]);router[_0x2147('0xe')]('/:id/configurations',auth[_0x2147('0x6')](),controller['addConfiguration']);router['put'](_0x2147('0x10'),auth[_0x2147('0x6')](),controller[_0x2147('0x11')]);router[_0x2147('0x12')](_0x2147('0x10'),auth[_0x2147('0x6')](),controller['destroy']);module[_0x2147('0x13')]=router; \ No newline at end of file +var _0xcd4c=['exports','util','path','connect-timeout','express','Router','../../components/interaction/service','./intSalesforceAccount.controller','index','get','isAuthenticated','/:id/configurations','getConfigurations','/:id/fields','create','post','addConfiguration','put','/:id','update','delete','destroy'];(function(_0x256a17,_0x303dbb){var _0x20c28f=function(_0x39421e){while(--_0x39421e){_0x256a17['push'](_0x256a17['shift']());}};_0x20c28f(++_0x303dbb);}(_0xcd4c,0x11f));var _0xccd4=function(_0x2782c7,_0x4a177f){_0x2782c7=_0x2782c7-0x0;var _0x11542a=_0xcd4c[_0x2782c7];return _0x11542a;};'use strict';var multer=require('multer');var util=require(_0xccd4('0x0'));var path=require(_0xccd4('0x1'));var timeout=require(_0xccd4('0x2'));var express=require(_0xccd4('0x3'));var router=express[_0xccd4('0x4')]();var auth=require('../../components/auth/service');var interaction=require(_0xccd4('0x5'));var config=require('../../config/environment');var controller=require(_0xccd4('0x6'));router['get']('/',auth['isAuthenticated'](),controller[_0xccd4('0x7')]);router[_0xccd4('0x8')]('/:id',auth[_0xccd4('0x9')](),controller['show']);router['get'](_0xccd4('0xa'),auth[_0xccd4('0x9')](),controller[_0xccd4('0xb')]);router[_0xccd4('0x8')](_0xccd4('0xc'),auth[_0xccd4('0x9')](),controller['getFields']);router['post']('/',auth[_0xccd4('0x9')](),controller[_0xccd4('0xd')]);router[_0xccd4('0xe')](_0xccd4('0xa'),auth[_0xccd4('0x9')](),controller[_0xccd4('0xf')]);router[_0xccd4('0x10')](_0xccd4('0x11'),auth['isAuthenticated'](),controller[_0xccd4('0x12')]);router[_0xccd4('0x13')](_0xccd4('0x11'),auth[_0xccd4('0x9')](),controller[_0xccd4('0x14')]);module[_0xccd4('0x15')]=router; \ No newline at end of file diff --git a/server/api/intSalesforceAccount/intSalesforceAccount.attributes.js b/server/api/intSalesforceAccount/intSalesforceAccount.attributes.js index b294e27..9941a35 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 _0x4975=['username','integrationTab','sequelize','STRING'];(function(_0x23be51,_0xc02a1b){var _0x47a26d=function(_0xa92395){while(--_0xa92395){_0x23be51['push'](_0x23be51['shift']());}};_0x47a26d(++_0xc02a1b);}(_0x4975,0x86));var _0x5497=function(_0x4b0b50,_0x3a27b0){_0x4b0b50=_0x4b0b50-0x0;var _0x1e9db6=_0x4975[_0x4b0b50];return _0x1e9db6;};'use strict';var Sequelize=require(_0x5497('0x0'));module['exports']={'name':{'type':Sequelize[_0x5497('0x1')]},'description':{'type':Sequelize[_0x5497('0x1')]},'username':{'type':Sequelize[_0x5497('0x1')],'unique':_0x5497('0x2')},'remoteUri':{'type':Sequelize[_0x5497('0x1')]},'password':{'type':Sequelize[_0x5497('0x1')]},'clientId':{'type':Sequelize[_0x5497('0x1')]},'clientSecret':{'type':Sequelize[_0x5497('0x1')]},'securityToken':{'type':Sequelize[_0x5497('0x1')]},'serverUrl':{'type':Sequelize[_0x5497('0x1')]},'type':{'type':Sequelize['ENUM'](_0x5497('0x3'),'newTab'),'defaultValue':_0x5497('0x3')}}; \ No newline at end of file +var _0x7217=['sequelize','STRING','username','ENUM','integrationTab','newTab'];(function(_0x5a8795,_0x462f13){var _0x140a4e=function(_0x35ae00){while(--_0x35ae00){_0x5a8795['push'](_0x5a8795['shift']());}};_0x140a4e(++_0x462f13);}(_0x7217,0x19e));var _0x7721=function(_0x491a7f,_0x28bb80){_0x491a7f=_0x491a7f-0x0;var _0x3d8f44=_0x7217[_0x491a7f];return _0x3d8f44;};'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 diff --git a/server/api/intSalesforceAccount/intSalesforceAccount.controller.js b/server/api/intSalesforceAccount/intSalesforceAccount.controller.js index 6cbf7d4..b903998 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 _0x814b=['Status','Priority','IsEscalated','SuppliedCompany','remove','includes','custom','picklistValues','value','boolean','True','true','False','false','statusCode','Wrong\x20credentials','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','to-csv','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../mysqldb','../../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','SalesforceAccount,\x20%s,\x20%s','request\x20sent','stringify','code','error','message','result','catch','sendStatus','status','end','count','offset','limit','set','apply','reject','then','destroy','stack','name','send','SalesforceAccount','type','model','map','filters','intersection','query','fields','attributes','length','hasOwnProperty','order','sort','where','pick','filter','merge','options','includeAll','rows','show','keys','rawAttributes','include','create','body','find','params','findOne','getConfigurations','nolimit','addConfiguration','AccountId','Subjects','getSubjects','channel','Descriptions','getDescriptions','SalesforceConfiguration','getFields','Task','remoteUri','clientId','password','slice','substring','Connection','clientSecret','username','securityToken','isNil','ticketType','sobject','describe','CallDisposition','CallDurationInSeconds','CallObject','Case','Type','Origin','Reason'];(function(_0x4169d8,_0x3d7cd4){var _0x32084a=function(_0x5f59c6){while(--_0x5f59c6){_0x4169d8['push'](_0x4169d8['shift']());}};_0x32084a(++_0x3d7cd4);}(_0x814b,0x1a2));var _0xb814=function(_0x146837,_0x2aa6a2){_0x146837=_0x146837-0x0;var _0x3d7e60=_0x814b[_0x146837];return _0x3d7e60;};'use strict';var pdf=require(_0xb814('0x0'));var emlformat=require(_0xb814('0x1'));var rimraf=require(_0xb814('0x2'));var zipdir=require(_0xb814('0x3'));var jsonpatch=require(_0xb814('0x4'));var rp=require(_0xb814('0x5'));var moment=require('moment');var BPromise=require(_0xb814('0x6'));var Mustache=require(_0xb814('0x7'));var util=require(_0xb814('0x8'));var path=require(_0xb814('0x9'));var sox=require(_0xb814('0xa'));var csv=require(_0xb814('0xb'));var ejs=require('ejs');var fs=require('fs');var _=require(_0xb814('0xc'));var squel=require(_0xb814('0xd'));var crypto=require('crypto');var jsforce=require(_0xb814('0xe'));var deskjs=require(_0xb814('0xf'));var toCsv=require(_0xb814('0xb'));var querystring=require(_0xb814('0x10'));var Papa=require(_0xb814('0x11'));var Redis=require(_0xb814('0x12'));var authService=require(_0xb814('0x13'));var qs=require(_0xb814('0x14'));var as=require(_0xb814('0x15'));var hardwareService=require(_0xb814('0x16'));var logger=require(_0xb814('0x17'))('api');var utils=require(_0xb814('0x18'));var config=require('../../config/environment');var db=require(_0xb814('0x19'))['db'];var integrations=require(_0xb814('0x1a'));var jayson=require(_0xb814('0x1b'));var client=jayson[_0xb814('0x1c')][_0xb814('0x1d')]({'port':0x232a});function checkPasswordPattern(_0x3bde14,_0x1438e7,_0x41ed7b){if(_0x41ed7b){var _0xa0a2e5=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0xa0a2e5[_0xb814('0x1e')](_0x1438e7)){return _0x3bde14;}else{throw new db[(_0xb814('0x1f'))][(_0xb814('0x20'))](_0xb814('0x21'));}}else{return _0x3bde14;}}function respondWithRpcPromise(_0x39bfcf,_0x303aca,_0x3a71d6,_0x45e0d0){return new BPromise(function(_0x265a83,_0x125ce2){var _0x21b73f=_0x45e0d0||client;return _0x21b73f[_0xb814('0x22')](_0x39bfcf,_0x3a71d6)['then'](function(_0x168a48){logger['info'](_0xb814('0x23'),_0x303aca,_0xb814('0x24'));logger['debug']('SalesforceAccount,\x20%s,\x20%s,\x20%s',_0x303aca,'request\x20sent',JSON[_0xb814('0x25')](_0x168a48));if(_0x168a48['error']){if(_0x168a48['error'][_0xb814('0x26')]===0x1f4){logger[_0xb814('0x27')](_0xb814('0x23'),_0x303aca,_0x168a48['error'][_0xb814('0x28')]);return _0x125ce2(_0x168a48['error'][_0xb814('0x28')]);}logger[_0xb814('0x27')](_0xb814('0x23'),_0x303aca,_0x168a48[_0xb814('0x27')][_0xb814('0x28')]);return _0x265a83(_0x168a48[_0xb814('0x27')][_0xb814('0x28')]);}else{logger['info'](_0xb814('0x23'),_0x303aca,'request\x20sent');_0x265a83(_0x168a48[_0xb814('0x29')][_0xb814('0x28')]);}})[_0xb814('0x2a')](function(_0x208927){logger[_0xb814('0x27')](_0xb814('0x23'),_0x303aca,_0x208927);_0x125ce2(_0x208927);});});}function respondWithStatusCode(_0x3d836c,_0x5755ea){_0x5755ea=_0x5755ea||0xcc;return function(_0x392222){if(_0x392222){return _0x3d836c[_0xb814('0x2b')](_0x5755ea);}return _0x3d836c[_0xb814('0x2c')](_0x5755ea)[_0xb814('0x2d')]();};}function respondWithResult(_0x32ed56,_0x1d5965){_0x1d5965=_0x1d5965||0xc8;return function(_0x3f0150){if(_0x3f0150){return _0x32ed56[_0xb814('0x2c')](_0x1d5965)['json'](_0x3f0150);}};}function respondWithFilteredResult(_0x271aa8,_0x328a08){return function(_0x52ed64){if(_0x52ed64){var _0x9008b2=_0x52ed64[_0xb814('0x2e')],_0x37d24d=_0x328a08[_0xb814('0x2f')],_0x530744=_0x328a08['offset']+_0x328a08[_0xb814('0x30')],_0x499f22;if(_0x530744>=_0x9008b2){_0x530744=_0x9008b2;_0x499f22=0xc8;}else{_0x499f22=0xce;}_0x271aa8['status'](_0x499f22);return _0x271aa8[_0xb814('0x31')]('Content-Range',_0x37d24d+'-'+_0x530744+'/'+_0x9008b2)['json'](_0x52ed64);}return null;};}function patchUpdates(_0x419cd9){return function(_0x4a4f27){try{jsonpatch[_0xb814('0x32')](_0x4a4f27,_0x419cd9,!![]);}catch(_0x19469b){return BPromise[_0xb814('0x33')](_0x19469b);}return _0x4a4f27['save']();};}function saveUpdates(_0x51d5ae,_0x26d3a9){return function(_0x336e2b){if(_0x336e2b){return _0x336e2b['update'](_0x51d5ae)[_0xb814('0x34')](function(_0xe558d5){return _0xe558d5;});}return null;};}function removeEntity(_0x692c72,_0x217b7e){return function(_0x1b78de){if(_0x1b78de){return _0x1b78de[_0xb814('0x35')]()[_0xb814('0x34')](function(){_0x692c72['status'](0xcc)[_0xb814('0x2d')]();});}};}function handleEntityNotFound(_0x2263f6,_0x30de5a){return function(_0x424e2b){if(!_0x424e2b){_0x2263f6[_0xb814('0x2b')](0x194);}return _0x424e2b;};}function handleError(_0x4ff31a,_0x16ef82){_0x16ef82=_0x16ef82||0x1f4;return function(_0x57e6e6){logger[_0xb814('0x27')](_0x57e6e6[_0xb814('0x36')]);if(_0x57e6e6[_0xb814('0x37')]){delete _0x57e6e6['name'];}_0x4ff31a[_0xb814('0x2c')](_0x16ef82)[_0xb814('0x38')](_0x57e6e6);};}exports['index']=function(_0x2fcd92,_0x2d0e27){var _0x1a8bd0={},_0x1f7cd8={},_0xd77d96={'count':0x0,'rows':[]};var _0x467cf9=_['map'](db[_0xb814('0x39')]['rawAttributes'],function(_0x2aaf1c){return{'name':_0x2aaf1c['fieldName'],'type':_0x2aaf1c[_0xb814('0x3a')]['key']};});_0x1f7cd8[_0xb814('0x3b')]=_[_0xb814('0x3c')](_0x467cf9,'name');_0x1f7cd8['query']=_['keys'](_0x2fcd92['query']);_0x1f7cd8[_0xb814('0x3d')]=_[_0xb814('0x3e')](_0x1f7cd8[_0xb814('0x3b')],_0x1f7cd8[_0xb814('0x3f')]);_0x1a8bd0['attributes']=_['intersection'](_0x1f7cd8[_0xb814('0x3b')],qs['fields'](_0x2fcd92[_0xb814('0x3f')][_0xb814('0x40')]));_0x1a8bd0[_0xb814('0x41')]=_0x1a8bd0[_0xb814('0x41')][_0xb814('0x42')]?_0x1a8bd0[_0xb814('0x41')]:_0x1f7cd8[_0xb814('0x3b')];if(!_0x2fcd92[_0xb814('0x3f')][_0xb814('0x43')]('nolimit')){_0x1a8bd0['limit']=qs['limit'](_0x2fcd92[_0xb814('0x3f')]['limit']);_0x1a8bd0[_0xb814('0x2f')]=qs['offset'](_0x2fcd92[_0xb814('0x3f')][_0xb814('0x2f')]);}_0x1a8bd0[_0xb814('0x44')]=qs[_0xb814('0x45')](_0x2fcd92['query'][_0xb814('0x45')]);_0x1a8bd0[_0xb814('0x46')]=qs[_0xb814('0x3d')](_[_0xb814('0x47')](_0x2fcd92[_0xb814('0x3f')],_0x1f7cd8[_0xb814('0x3d')]));if(_0x2fcd92['query'][_0xb814('0x48')]){_0x1a8bd0[_0xb814('0x46')]=_[_0xb814('0x49')](_0x1a8bd0[_0xb814('0x46')],{'$or':_[_0xb814('0x3c')](_0x467cf9,function(_0x144d37){if(_0x144d37[_0xb814('0x3a')]!=='VIRTUAL'){var _0x4a5e84={};_0x4a5e84[_0x144d37[_0xb814('0x37')]]={'$like':'%'+_0x2fcd92[_0xb814('0x3f')][_0xb814('0x48')]+'%'};return _0x4a5e84;}})});}_0x1a8bd0=_[_0xb814('0x49')]({},_0x1a8bd0,_0x2fcd92[_0xb814('0x4a')]);var _0x40e627={'where':_0x1a8bd0[_0xb814('0x46')]};return db[_0xb814('0x39')][_0xb814('0x2e')](_0x40e627)[_0xb814('0x34')](function(_0xe73300){_0xd77d96['count']=_0xe73300;if(_0x2fcd92[_0xb814('0x3f')][_0xb814('0x4b')]){_0x1a8bd0['include']=[{'all':!![]}];}return db[_0xb814('0x39')]['findAll'](_0x1a8bd0);})[_0xb814('0x34')](function(_0x37866f){_0xd77d96[_0xb814('0x4c')]=_0x37866f;return _0xd77d96;})[_0xb814('0x34')](respondWithFilteredResult(_0x2d0e27,_0x1a8bd0))[_0xb814('0x2a')](handleError(_0x2d0e27,null));};exports[_0xb814('0x4d')]=function(_0x2cc806,_0x45480e){var _0x32a397={'raw':![],'where':{'id':_0x2cc806['params']['id']}},_0x2a422a={};_0x2a422a['model']=_[_0xb814('0x4e')](db[_0xb814('0x39')][_0xb814('0x4f')]);_0x2a422a[_0xb814('0x3f')]=_[_0xb814('0x4e')](_0x2cc806[_0xb814('0x3f')]);_0x2a422a[_0xb814('0x3d')]=_['intersection'](_0x2a422a[_0xb814('0x3b')],_0x2a422a[_0xb814('0x3f')]);_0x32a397[_0xb814('0x41')]=_['intersection'](_0x2a422a[_0xb814('0x3b')],qs['fields'](_0x2cc806[_0xb814('0x3f')]['fields']));_0x32a397[_0xb814('0x41')]=_0x32a397[_0xb814('0x41')]['length']?_0x32a397[_0xb814('0x41')]:_0x2a422a[_0xb814('0x3b')];if(_0x2cc806[_0xb814('0x3f')]['includeAll']){_0x32a397[_0xb814('0x50')]=[{'all':!![]}];}_0x32a397=_['merge']({},_0x32a397,_0x2cc806[_0xb814('0x4a')]);return db[_0xb814('0x39')]['find'](_0x32a397)[_0xb814('0x34')](handleEntityNotFound(_0x45480e,null))['then'](respondWithResult(_0x45480e,null))['catch'](handleError(_0x45480e,null));};exports[_0xb814('0x51')]=function(_0x35f59a,_0x34935b){return db['SalesforceAccount'][_0xb814('0x51')](_0x35f59a['body'],{})[_0xb814('0x34')](respondWithResult(_0x34935b,0xc9))[_0xb814('0x2a')](handleError(_0x34935b,null));};exports['update']=function(_0x2db5a6,_0x5c32c2){if(_0x2db5a6[_0xb814('0x52')]['id']){delete _0x2db5a6[_0xb814('0x52')]['id'];}return db[_0xb814('0x39')][_0xb814('0x53')]({'where':{'id':_0x2db5a6[_0xb814('0x54')]['id']}})[_0xb814('0x34')](handleEntityNotFound(_0x5c32c2,null))[_0xb814('0x34')](saveUpdates(_0x2db5a6[_0xb814('0x52')],null))['then'](respondWithResult(_0x5c32c2,null))[_0xb814('0x2a')](handleError(_0x5c32c2,null));};exports[_0xb814('0x35')]=function(_0x5d71d5,_0x29a127){return db[_0xb814('0x39')]['find']({'where':{'id':_0x5d71d5[_0xb814('0x54')]['id']}})['then'](handleEntityNotFound(_0x29a127,null))['then'](removeEntity(_0x29a127,null))[_0xb814('0x2a')](handleError(_0x29a127,null));};exports['getConfigurations']=function(_0x3ff213,_0xd1cd8b,_0x2dec52){var _0x586957={};var _0x1a0ef4={};var _0x4df65c;var _0x2ef77d;return db[_0xb814('0x39')][_0xb814('0x55')]({'where':{'id':_0x3ff213[_0xb814('0x54')]['id']}})[_0xb814('0x34')](handleEntityNotFound(_0xd1cd8b,null))[_0xb814('0x34')](function(_0x2e5f99){if(_0x2e5f99){_0x4df65c=_0x2e5f99;_0x1a0ef4[_0xb814('0x3b')]=_[_0xb814('0x4e')](db['SalesforceConfiguration'][_0xb814('0x4f')]);_0x1a0ef4[_0xb814('0x3f')]=_[_0xb814('0x4e')](_0x3ff213[_0xb814('0x3f')]);_0x1a0ef4[_0xb814('0x3d')]=_[_0xb814('0x3e')](_0x1a0ef4['model'],_0x1a0ef4[_0xb814('0x3f')]);_0x586957['attributes']=_[_0xb814('0x3e')](_0x1a0ef4[_0xb814('0x3b')],qs[_0xb814('0x40')](_0x3ff213['query'][_0xb814('0x40')]));_0x586957['attributes']=_0x586957[_0xb814('0x41')]['length']?_0x586957[_0xb814('0x41')]:_0x1a0ef4[_0xb814('0x3b')];_0x586957[_0xb814('0x44')]=qs[_0xb814('0x45')](_0x3ff213[_0xb814('0x3f')][_0xb814('0x45')]);_0x586957[_0xb814('0x46')]=qs['filters'](_[_0xb814('0x47')](_0x3ff213['query'],_0x1a0ef4[_0xb814('0x3d')]));if(_0x3ff213[_0xb814('0x3f')][_0xb814('0x48')]){_0x586957[_0xb814('0x46')]=_[_0xb814('0x49')](_0x586957[_0xb814('0x46')],{'$or':_['map'](_0x586957[_0xb814('0x41')],function(_0x1a2603){var _0x4a49ba={};_0x4a49ba[_0x1a2603]={'$like':'%'+_0x3ff213[_0xb814('0x3f')][_0xb814('0x48')]+'%'};return _0x4a49ba;})});}_0x586957=_[_0xb814('0x49')]({},_0x586957,_0x3ff213[_0xb814('0x4a')]);return _0x4df65c[_0xb814('0x56')](_0x586957);}})['then'](function(_0x3a4d4b){if(_0x3a4d4b){_0x2ef77d=_0x3a4d4b['length'];if(!_0x3ff213[_0xb814('0x3f')][_0xb814('0x43')](_0xb814('0x57'))){_0x586957[_0xb814('0x30')]=qs[_0xb814('0x30')](_0x3ff213[_0xb814('0x3f')]['limit']);_0x586957['offset']=qs['offset'](_0x3ff213[_0xb814('0x3f')]['offset']);}return _0x4df65c[_0xb814('0x56')](_0x586957);}})[_0xb814('0x34')](function(_0x25db89){if(_0x25db89){return _0x25db89?{'count':_0x2ef77d,'rows':_0x25db89}:null;}})['then'](respondWithResult(_0xd1cd8b,null))[_0xb814('0x2a')](handleError(_0xd1cd8b,null));};exports[_0xb814('0x58')]=function(_0xee204,_0x5aabbe,_0x30f717){if(_0xee204[_0xb814('0x52')]['id']){delete _0xee204[_0xb814('0x52')]['id'];}return db[_0xb814('0x39')]['findOne']({'where':{'id':_0xee204['params']['id']}})[_0xb814('0x34')](handleEntityNotFound(_0x5aabbe,null))[_0xb814('0x34')](function(_0x39863d){if(_0x39863d){_0xee204[_0xb814('0x52')][_0xb814('0x59')]=_0x39863d['id'];_0xee204[_0xb814('0x52')][_0xb814('0x5a')]=integrations[_0xb814('0x5b')](_0xee204[_0xb814('0x52')][_0xb814('0x5c')],_0xee204[_0xb814('0x52')][_0xb814('0x3a')]);_0xee204[_0xb814('0x52')][_0xb814('0x5d')]=integrations[_0xb814('0x5e')](_0xee204['body'][_0xb814('0x5c')],_0xee204[_0xb814('0x52')][_0xb814('0x3a')]);return db[_0xb814('0x5f')][_0xb814('0x51')](_0xee204[_0xb814('0x52')],{'include':[{'model':db['SalesforceField'],'as':_0xb814('0x5a')},{'model':db['SalesforceField'],'as':_0xb814('0x5d')}]});}return null;})[_0xb814('0x34')](respondWithResult(_0x5aabbe,null))[_0xb814('0x2a')](handleError(_0x5aabbe,null));};exports[_0xb814('0x60')]=function(_0x265a25,_0x5ce177,_0x4c44ee){var _0xea9cee;var _0x1b502b='';var _0x1bca54=_0xb814('0x61');return db['SalesforceAccount'][_0xb814('0x55')]({'where':{'id':_0x265a25['params']['id']},'attributes':['id',_0xb814('0x62'),_0xb814('0x63'),'clientSecret','username',_0xb814('0x64'),'securityToken']})[_0xb814('0x34')](handleEntityNotFound(_0x5ce177,null))[_0xb814('0x34')](function(_0x3c770d){if(_0x3c770d){_0x1b502b=_0x3c770d[_0xb814('0x62')];var _0x46784f=_0x1b502b[_0xb814('0x65')](-0x1);if(_0x46784f==='/'){_0x1b502b=_0x1b502b[_0xb814('0x66')](0x0,_0x1b502b['lastIndexOf'](_0x46784f));}_0xea9cee=new jsforce[(_0xb814('0x67'))]({'oauth2':{'loginUrl':_0x1b502b,'clientId':_0x3c770d['clientId'],'clientSecret':_0x3c770d[_0xb814('0x68')]}});return _0xea9cee['login'](_0x3c770d[_0xb814('0x69')],_0x3c770d[_0xb814('0x64')]['concat'](_0x3c770d[_0xb814('0x6a')]));}})['then'](function(_0x37adec){if(_0x37adec){if(!_[_0xb814('0x6b')](_0x265a25['query']['ticketType'])){_0x1bca54=_0x265a25[_0xb814('0x3f')][_0xb814('0x6c')];}return _0xea9cee[_0xb814('0x6d')](_0x1bca54)[_0xb814('0x6e')]();}})[_0xb814('0x34')](function(_0x4394da){var _0x2b12a9=[_0xb814('0x6f'),_0xb814('0x70'),_0xb814('0x71'),'CallType','IsArchived','Priority','Status','Type'];if(!_[_0xb814('0x6b')](_0x265a25[_0xb814('0x3f')][_0xb814('0x6c')])&&_0x265a25['query'][_0xb814('0x6c')]===_0xb814('0x72')){_0x2b12a9=[_0xb814('0x73'),_0xb814('0x74'),_0xb814('0x75'),_0xb814('0x76'),_0xb814('0x77'),_0xb814('0x78'),'SuppliedName',_0xb814('0x79')];}if(_0x4394da){_[_0xb814('0x7a')](_0x4394da[_0xb814('0x40')],function(_0x30faa0){return _0x30faa0['custom']===![]&&!_0x2b12a9[_0xb814('0x7b')](_0x30faa0[_0xb814('0x37')]);});return{'count':_0x4394da[_0xb814('0x40')][_0xb814('0x42')],'rows':_[_0xb814('0x3c')](_0x4394da['fields'],function(_0x4db6e2){return{'id':_0x4db6e2[_0xb814('0x37')],'name':_0x4db6e2['label'],'custom':_0x4db6e2[_0xb814('0x7c')],'options':_0x4db6e2[_0xb814('0x7d')]['length']>0x0?_[_0xb814('0x3c')](_0x4db6e2['picklistValues'],function(_0xe17e86){return{'name':_0xe17e86['label'],'value':_0xe17e86[_0xb814('0x7e')]};}):_0x4db6e2[_0xb814('0x3a')]==_0xb814('0x7f')?[{'name':_0xb814('0x80'),'value':_0xb814('0x81')},{'name':_0xb814('0x82'),'value':_0xb814('0x83')}]:[]};})};}})['then'](respondWithResult(_0x5ce177,null))['catch'](function(_0x21aa36){var _0x50ed93=_0x265a25['query'][_0xb814('0x1e')]?0x1f4:_0x21aa36[_0xb814('0x84')]||0x1f4;logger[_0xb814('0x27')]('getFields,\x20%s,\x20%s,\x20%s',_0xb814('0x60'),_0x50ed93,JSON['stringify'](_0x21aa36));delete _0x21aa36[_0xb814('0x37')];if(_0x50ed93===0x191){_0x50ed93=0x190;}_0x5ce177[_0xb814('0x2c')](_0x50ed93)[_0xb814('0x38')](_0x265a25[_0xb814('0x3f')]['test']?{'message':_0xb814('0x85'),'statusCode':_0x21aa36[_0xb814('0x84')]}:_0x21aa36);});}; \ No newline at end of file +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(_0x4a9fb1,_0x273043){var _0x348672=function(_0x142b69){while(--_0x142b69){_0x4a9fb1['push'](_0x4a9fb1['shift']());}};_0x348672(++_0x273043);}(_0x1cb9,0x14e));var _0x91cb=function(_0x2a46e7,_0x1447a9){_0x2a46e7=_0x2a46e7-0x0;var _0x2c9055=_0x1cb9[_0x2a46e7];return _0x2c9055;};'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 diff --git a/server/api/intSalesforceAccount/intSalesforceAccount.model.js b/server/api/intSalesforceAccount/intSalesforceAccount.model.js index 39e3d3b..6afe2c6 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 _0x85d8=['request-promise','path','rimraf','../../config/environment','./intSalesforceAccount.attributes','../../components/integrations/configuration','exports','define','SalesforceAccount','int_salesforce_accounts','lodash','util','../../config/logger','api','moment'];(function(_0x456fb1,_0x859a1d){var _0x4083d6=function(_0xe1d0f2){while(--_0xe1d0f2){_0x456fb1['push'](_0x456fb1['shift']());}};_0x4083d6(++_0x859a1d);}(_0x85d8,0x82));var _0x885d=function(_0x3ea74d,_0x2f8496){_0x3ea74d=_0x3ea74d-0x0;var _0x6f9c6b=_0x85d8[_0x3ea74d];return _0x6f9c6b;};'use strict';var _=require(_0x885d('0x0'));var util=require(_0x885d('0x1'));var logger=require(_0x885d('0x2'))(_0x885d('0x3'));var moment=require(_0x885d('0x4'));var BPromise=require('bluebird');var rp=require(_0x885d('0x5'));var fs=require('fs');var path=require(_0x885d('0x6'));var rimraf=require(_0x885d('0x7'));var config=require(_0x885d('0x8'));var attributes=require(_0x885d('0x9'));var integrations=require(_0x885d('0xa'));module[_0x885d('0xb')]=function(_0x46d383,_0x4eeec5){return _0x46d383[_0x885d('0xc')](_0x885d('0xd'),attributes,{'tableName':_0x885d('0xe'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x9675=['api','bluebird','request-promise','path','rimraf','./intSalesforceAccount.attributes','exports','SalesforceAccount','int_salesforce_accounts','lodash','util','../../config/logger'];(function(_0x45f143,_0x42ba90){var _0x898312=function(_0xe86ac3){while(--_0xe86ac3){_0x45f143['push'](_0x45f143['shift']());}};_0x898312(++_0x42ba90);}(_0x9675,0x99));var _0x5967=function(_0x32d107,_0x429ff8){_0x32d107=_0x32d107-0x0;var _0x451357=_0x9675[_0x32d107];return _0x451357;};'use strict';var _=require(_0x5967('0x0'));var util=require(_0x5967('0x1'));var logger=require(_0x5967('0x2'))(_0x5967('0x3'));var moment=require('moment');var BPromise=require(_0x5967('0x4'));var rp=require(_0x5967('0x5'));var fs=require('fs');var path=require(_0x5967('0x6'));var rimraf=require(_0x5967('0x7'));var config=require('../../config/environment');var attributes=require(_0x5967('0x8'));var integrations=require('../../components/integrations/configuration');module[_0x5967('0x9')]=function(_0x22290d,_0x18a4b6){return _0x22290d['define'](_0x5967('0xa'),attributes,{'tableName':_0x5967('0xb'),'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 f173dcc..c07b537 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 _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(_0x247ebe,_0x253781){var _0x340abb=function(_0x4b78ae){while(--_0x4b78ae){_0x247ebe['push'](_0x247ebe['shift']());}};_0x340abb(++_0x253781);}(_0xf72b,0x1d9));var _0xbf72=function(_0x42e4e1,_0x524433){_0x42e4e1=_0x42e4e1-0x0;var _0x25603b=_0xf72b[_0x42e4e1];return _0x25603b;};'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 +var _0xd3d1=['client','http','request','then','info','SalesforceAccount,\x20%s,\x20%s','request\x20sent','debug','SalesforceAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','GetSalesforceAccount','SalesforceAccount','findAll','options','attributes','limit','include','map','model','find','raw','where','ShowSalesforceAccount','lodash','util','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise'];(function(_0x175782,_0x402e25){var _0x54df78=function(_0x3e4a18){while(--_0x3e4a18){_0x175782['push'](_0x175782['shift']());}};_0x54df78(++_0x402e25);}(_0xd3d1,0x172));var _0x1d3d=function(_0xbd08b4,_0x4790ed){_0xbd08b4=_0xbd08b4-0x0;var _0x314f1e=_0xd3d1[_0xbd08b4];return _0x314f1e;};'use strict';var _=require(_0x1d3d('0x0'));var util=require(_0x1d3d('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x1d3d('0x2'));var fs=require('fs');var Redis=require(_0x1d3d('0x3'));var db=require(_0x1d3d('0x4'))['db'];var utils=require(_0x1d3d('0x5'));var logger=require(_0x1d3d('0x6'))(_0x1d3d('0x7'));var config=require(_0x1d3d('0x8'));var jayson=require(_0x1d3d('0x9'));var client=jayson[_0x1d3d('0xa')][_0x1d3d('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x3831ce,_0xb1b3c6,_0xe10bca){return new BPromise(function(_0x2c377c,_0xbea61e){return client[_0x1d3d('0xc')](_0x3831ce,_0xe10bca)[_0x1d3d('0xd')](function(_0x510a37){logger[_0x1d3d('0xe')](_0x1d3d('0xf'),_0xb1b3c6,_0x1d3d('0x10'));logger[_0x1d3d('0x11')](_0x1d3d('0x12'),_0xb1b3c6,_0x1d3d('0x10'),JSON[_0x1d3d('0x13')](_0x510a37));if(_0x510a37[_0x1d3d('0x14')]){if(_0x510a37[_0x1d3d('0x14')][_0x1d3d('0x15')]===0x1f4){logger[_0x1d3d('0x14')]('SalesforceAccount,\x20%s,\x20%s',_0xb1b3c6,_0x510a37[_0x1d3d('0x14')][_0x1d3d('0x16')]);return _0xbea61e(_0x510a37['error']['message']);}logger[_0x1d3d('0x14')](_0x1d3d('0xf'),_0xb1b3c6,_0x510a37[_0x1d3d('0x14')]['message']);return _0x2c377c(_0x510a37[_0x1d3d('0x14')]['message']);}else{logger[_0x1d3d('0xe')](_0x1d3d('0xf'),_0xb1b3c6,_0x1d3d('0x10'));_0x2c377c(_0x510a37[_0x1d3d('0x17')][_0x1d3d('0x16')]);}})[_0x1d3d('0x18')](function(_0x3dcb67){logger['error']('SalesforceAccount,\x20%s,\x20%s',_0xb1b3c6,_0x3dcb67);_0xbea61e(_0x3dcb67);});});}exports[_0x1d3d('0x19')]=function(_0xe0a583){var _0x50bab4=this;return new Promise(function(_0x3b9174,_0x57d6de){return db[_0x1d3d('0x1a')][_0x1d3d('0x1b')]({'raw':_0xe0a583[_0x1d3d('0x1c')]?_0xe0a583[_0x1d3d('0x1c')]['raw']===undefined?!![]:![]:!![],'where':_0xe0a583[_0x1d3d('0x1c')]?_0xe0a583['options']['where']||null:null,'attributes':_0xe0a583[_0x1d3d('0x1c')]?_0xe0a583[_0x1d3d('0x1c')][_0x1d3d('0x1d')]||null:null,'limit':_0xe0a583[_0x1d3d('0x1c')]?_0xe0a583[_0x1d3d('0x1c')][_0x1d3d('0x1e')]||null:null,'include':_0xe0a583[_0x1d3d('0x1c')]?_0xe0a583[_0x1d3d('0x1c')][_0x1d3d('0x1f')]?_[_0x1d3d('0x20')](_0xe0a583[_0x1d3d('0x1c')]['include'],function(_0xfc3606){return{'model':db[_0xfc3606[_0x1d3d('0x21')]],'as':_0xfc3606['as'],'attributes':_0xfc3606['attributes'],'include':_0xfc3606[_0x1d3d('0x1f')]?_['map'](_0xfc3606[_0x1d3d('0x1f')],function(_0x20ae6d){return{'model':db[_0x20ae6d[_0x1d3d('0x21')]],'as':_0x20ae6d['as'],'attributes':_0x20ae6d[_0x1d3d('0x1d')],'include':_0x20ae6d[_0x1d3d('0x1f')]?_[_0x1d3d('0x20')](_0x20ae6d[_0x1d3d('0x1f')],function(_0x298fd3){return{'model':db[_0x298fd3[_0x1d3d('0x21')]],'as':_0x298fd3['as'],'attributes':_0x298fd3[_0x1d3d('0x1d')]};}):[]};}):[]};}):[]:[]})[_0x1d3d('0xd')](function(_0x4f0aa7){logger[_0x1d3d('0xe')]('GetSalesforceAccount',_0xe0a583);logger[_0x1d3d('0x11')](_0x1d3d('0x19'),_0xe0a583,JSON['stringify'](_0x4f0aa7));_0x3b9174(_0x4f0aa7);})[_0x1d3d('0x18')](function(_0x16b7b3){logger[_0x1d3d('0x14')](_0x1d3d('0x19'),_0x16b7b3['message'],_0xe0a583);_0x57d6de(_0x50bab4[_0x1d3d('0x14')](0x1f4,_0x16b7b3[_0x1d3d('0x16')]));});});};exports['ShowSalesforceAccount']=function(_0x2b8433){var _0x4845b7=this;return new Promise(function(_0x4c04a8,_0x36e2d2){return db['SalesforceAccount'][_0x1d3d('0x22')]({'raw':_0x2b8433[_0x1d3d('0x1c')]?_0x2b8433[_0x1d3d('0x1c')][_0x1d3d('0x23')]===undefined?!![]:![]:!![],'where':_0x2b8433[_0x1d3d('0x1c')]?_0x2b8433[_0x1d3d('0x1c')][_0x1d3d('0x24')]||null:null,'attributes':_0x2b8433[_0x1d3d('0x1c')]?_0x2b8433[_0x1d3d('0x1c')]['attributes']||null:null,'include':_0x2b8433[_0x1d3d('0x1c')]?_0x2b8433[_0x1d3d('0x1c')][_0x1d3d('0x1f')]?_[_0x1d3d('0x20')](_0x2b8433['options']['include'],function(_0x3dacee){return{'model':db[_0x3dacee[_0x1d3d('0x21')]],'as':_0x3dacee['as'],'attributes':_0x3dacee['attributes'],'include':_0x3dacee[_0x1d3d('0x1f')]?_[_0x1d3d('0x20')](_0x3dacee[_0x1d3d('0x1f')],function(_0x3704b9){return{'model':db[_0x3704b9['model']],'as':_0x3704b9['as'],'attributes':_0x3704b9['attributes'],'include':_0x3704b9[_0x1d3d('0x1f')]?_['map'](_0x3704b9[_0x1d3d('0x1f')],function(_0x1fc39a){return{'model':db[_0x1fc39a[_0x1d3d('0x21')]],'as':_0x1fc39a['as'],'attributes':_0x1fc39a[_0x1d3d('0x1d')]};}):[]};}):[]};}):[]:[]})[_0x1d3d('0xd')](function(_0x195e3e){logger[_0x1d3d('0xe')](_0x1d3d('0x25'),_0x2b8433);logger['debug'](_0x1d3d('0x25'),_0x2b8433,JSON['stringify'](_0x195e3e));_0x4c04a8(_0x195e3e);})[_0x1d3d('0x18')](function(_0x206e4c){logger['error'](_0x1d3d('0x25'),_0x206e4c[_0x1d3d('0x16')],_0x2b8433);_0x36e2d2(_0x4845b7[_0x1d3d('0x14')](0x1f4,_0x206e4c[_0x1d3d('0x16')]));});});}; \ No newline at end of file diff --git a/server/api/intSalesforceConfiguration/index.js b/server/api/intSalesforceConfiguration/index.js index 01d25a7..fe4f579 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 _0x4928=['post','create','delete','destroy','exports','path','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','/:id','show','/:id/fields','/:id/subjects','getSubjects','/:id/descriptions','getDescriptions'];(function(_0x448ae2,_0x1676f5){var _0x4fdd34=function(_0x30e907){while(--_0x30e907){_0x448ae2['push'](_0x448ae2['shift']());}};_0x4fdd34(++_0x1676f5);}(_0x4928,0x145));var _0x8492=function(_0x443a81,_0x3e0602){_0x443a81=_0x443a81-0x0;var _0x467e32=_0x4928[_0x443a81];return _0x467e32;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x8492('0x0'));var timeout=require('connect-timeout');var express=require(_0x8492('0x1'));var router=express[_0x8492('0x2')]();var auth=require(_0x8492('0x3'));var interaction=require(_0x8492('0x4'));var config=require(_0x8492('0x5'));var controller=require('./intSalesforceConfiguration.controller');router[_0x8492('0x6')]('/',auth[_0x8492('0x7')](),controller['index']);router[_0x8492('0x6')](_0x8492('0x8'),auth[_0x8492('0x7')](),controller[_0x8492('0x9')]);router[_0x8492('0x6')](_0x8492('0xa'),auth[_0x8492('0x7')](),controller['getFields']);router['get'](_0x8492('0xb'),auth['isAuthenticated'](),controller[_0x8492('0xc')]);router['get'](_0x8492('0xd'),auth[_0x8492('0x7')](),controller[_0x8492('0xe')]);router[_0x8492('0xf')]('/',auth[_0x8492('0x7')](),controller[_0x8492('0x10')]);router['put']('/:id',auth[_0x8492('0x7')](),controller['update']);router[_0x8492('0x11')](_0x8492('0x8'),auth[_0x8492('0x7')](),controller[_0x8492('0x12')]);module[_0x8492('0x13')]=router; \ No newline at end of file +var _0xf45b=['isAuthenticated','index','/:id','/:id/fields','getFields','/:id/subjects','getSubjects','/:id/descriptions','post','create','put','delete','destroy','multer','util','path','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./intSalesforceConfiguration.controller','get'];(function(_0x16b2ab,_0x514d75){var _0x5b7fa0=function(_0x4acbb0){while(--_0x4acbb0){_0x16b2ab['push'](_0x16b2ab['shift']());}};_0x5b7fa0(++_0x514d75);}(_0xf45b,0xa7));var _0xbf45=function(_0xd6a1c9,_0x203324){_0xd6a1c9=_0xd6a1c9-0x0;var _0x51ea29=_0xf45b[_0xd6a1c9];return _0x51ea29;};'use strict';var multer=require(_0xbf45('0x0'));var util=require(_0xbf45('0x1'));var path=require(_0xbf45('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0xbf45('0x3')]();var auth=require(_0xbf45('0x4'));var interaction=require(_0xbf45('0x5'));var config=require(_0xbf45('0x6'));var controller=require(_0xbf45('0x7'));router[_0xbf45('0x8')]('/',auth[_0xbf45('0x9')](),controller[_0xbf45('0xa')]);router[_0xbf45('0x8')](_0xbf45('0xb'),auth['isAuthenticated'](),controller['show']);router[_0xbf45('0x8')](_0xbf45('0xc'),auth['isAuthenticated'](),controller[_0xbf45('0xd')]);router['get'](_0xbf45('0xe'),auth[_0xbf45('0x9')](),controller[_0xbf45('0xf')]);router['get'](_0xbf45('0x10'),auth['isAuthenticated'](),controller['getDescriptions']);router[_0xbf45('0x11')]('/',auth[_0xbf45('0x9')](),controller[_0xbf45('0x12')]);router[_0xbf45('0x13')](_0xbf45('0xb'),auth['isAuthenticated'](),controller['update']);router[_0xbf45('0x14')](_0xbf45('0xb'),auth[_0xbf45('0x9')](),controller[_0xbf45('0x15')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/intSalesforceConfiguration/intSalesforceConfiguration.attributes.js b/server/api/intSalesforceConfiguration/intSalesforceConfiguration.attributes.js index b60f6f1..0d0069d 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 _0x53d4=['Task','Case','contact_lead','lead','nothing','sequelize','STRING','ENUM'];(function(_0x43b650,_0x3db9f0){var _0xb964b9=function(_0x3ab9ee){while(--_0x3ab9ee){_0x43b650['push'](_0x43b650['shift']());}};_0xb964b9(++_0x3db9f0);}(_0x53d4,0x18d));var _0x453d=function(_0x19fd49,_0x155ed1){_0x19fd49=_0x19fd49-0x0;var _0x4814b8=_0x53d4[_0x19fd49];return _0x4814b8;};'use strict';var Sequelize=require(_0x453d('0x0'));module['exports']={'name':{'type':Sequelize[_0x453d('0x1')]},'description':{'type':Sequelize['STRING']},'ticketType':{'type':Sequelize[_0x453d('0x2')](_0x453d('0x3'),_0x453d('0x4')),'defaultValue':_0x453d('0x3')},'moduleSearch':{'type':Sequelize[_0x453d('0x2')](_0x453d('0x5'),'contact',_0x453d('0x6')),'defaultValue':'contact_lead'},'moduleCreate':{'type':Sequelize[_0x453d('0x2')](_0x453d('0x7'),'contact',_0x453d('0x6')),'defaultValue':'lead'}}; \ No newline at end of file +var _0x4713=['ENUM','Task','Case','contact','lead','contact_lead','exports','STRING'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x4713,0x196));var _0x3471=function(_0x5e2aaf,_0x5ee3e3){_0x5e2aaf=_0x5e2aaf-0x0;var _0x508383=_0x4713[_0x5e2aaf];return _0x508383;};'use strict';var Sequelize=require('sequelize');module[_0x3471('0x0')]={'name':{'type':Sequelize[_0x3471('0x1')]},'description':{'type':Sequelize[_0x3471('0x1')]},'ticketType':{'type':Sequelize[_0x3471('0x2')](_0x3471('0x3'),_0x3471('0x4')),'defaultValue':_0x3471('0x3')},'moduleSearch':{'type':Sequelize[_0x3471('0x2')]('contact_lead',_0x3471('0x5'),_0x3471('0x6')),'defaultValue':_0x3471('0x7')},'moduleCreate':{'type':Sequelize[_0x3471('0x2')]('nothing',_0x3471('0x5'),_0x3471('0x6')),'defaultValue':'lead'}}; \ No newline at end of file diff --git a/server/api/intSalesforceConfiguration/intSalesforceConfiguration.controller.js b/server/api/intSalesforceConfiguration/intSalesforceConfiguration.controller.js index 7421207..c546f65 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 _0x9b67=['name','index','map','type','key','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','limit','order','sort','pick','filter','where','VIRTUAL','merge','include','findAll','rows','show','params','keys','SalesforceConfiguration','rawAttributes','options','find','create','body','update','destroy','findOne','SalesforceField','getSubjects','getDescriptions','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','to-csv','lodash','squel','crypto','jsforce','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','jayson/promise','http','test','Sequelize','The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.','then','SalesforceConfiguration,\x20%s,\x20%s','request\x20sent','SalesforceConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','status','end','json','count','offset','Content-Range','reject','sendStatus','stack'];(function(_0x9df060,_0x253d33){var _0x338dfe=function(_0x17d9a5){while(--_0x17d9a5){_0x9df060['push'](_0x9df060['shift']());}};_0x338dfe(++_0x253d33);}(_0x9b67,0x133));var _0x79b6=function(_0x3511c1,_0x278187){_0x3511c1=_0x3511c1-0x0;var _0x274be=_0x9b67[_0x3511c1];return _0x274be;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x79b6('0x0'));var rimraf=require(_0x79b6('0x1'));var zipdir=require(_0x79b6('0x2'));var jsonpatch=require(_0x79b6('0x3'));var rp=require(_0x79b6('0x4'));var moment=require(_0x79b6('0x5'));var BPromise=require(_0x79b6('0x6'));var Mustache=require(_0x79b6('0x7'));var util=require(_0x79b6('0x8'));var path=require('path');var sox=require(_0x79b6('0x9'));var csv=require(_0x79b6('0xa'));var ejs=require('ejs');var fs=require('fs');var _=require(_0x79b6('0xb'));var squel=require(_0x79b6('0xc'));var crypto=require(_0x79b6('0xd'));var jsforce=require(_0x79b6('0xe'));var deskjs=require('desk.js');var toCsv=require(_0x79b6('0xa'));var querystring=require('querystring');var Papa=require(_0x79b6('0xf'));var Redis=require(_0x79b6('0x10'));var authService=require(_0x79b6('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0x79b6('0x12'));var hardwareService=require(_0x79b6('0x13'));var logger=require(_0x79b6('0x14'))(_0x79b6('0x15'));var utils=require(_0x79b6('0x16'));var config=require(_0x79b6('0x17'));var db=require(_0x79b6('0x18'))['db'];var jayson=require(_0x79b6('0x19'));var client=jayson['client'][_0x79b6('0x1a')]({'port':0x232a});function checkPasswordPattern(_0x229e04,_0x1cabd2,_0x29de3e){if(_0x29de3e){var _0x4eb925=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x4eb925[_0x79b6('0x1b')](_0x1cabd2)){return _0x229e04;}else{throw new db[(_0x79b6('0x1c'))]['ValidationError'](_0x79b6('0x1d'));}}else{return _0x229e04;}}function respondWithRpcPromise(_0x785c38,_0x5cca50,_0x4c217e,_0x1671f5){return new BPromise(function(_0x422f3e,_0x4f3489){var _0x25fffa=_0x1671f5||client;return _0x25fffa['request'](_0x785c38,_0x4c217e)[_0x79b6('0x1e')](function(_0x989d56){logger['info'](_0x79b6('0x1f'),_0x5cca50,_0x79b6('0x20'));logger['debug'](_0x79b6('0x21'),_0x5cca50,_0x79b6('0x20'),JSON[_0x79b6('0x22')](_0x989d56));if(_0x989d56['error']){if(_0x989d56[_0x79b6('0x23')][_0x79b6('0x24')]===0x1f4){logger[_0x79b6('0x23')](_0x79b6('0x1f'),_0x5cca50,_0x989d56[_0x79b6('0x23')]['message']);return _0x4f3489(_0x989d56[_0x79b6('0x23')][_0x79b6('0x25')]);}logger[_0x79b6('0x23')]('SalesforceConfiguration,\x20%s,\x20%s',_0x5cca50,_0x989d56[_0x79b6('0x23')]['message']);return _0x422f3e(_0x989d56[_0x79b6('0x23')][_0x79b6('0x25')]);}else{logger['info'](_0x79b6('0x1f'),_0x5cca50,_0x79b6('0x20'));_0x422f3e(_0x989d56[_0x79b6('0x26')]['message']);}})[_0x79b6('0x27')](function(_0x5383e1){logger['error'](_0x79b6('0x1f'),_0x5cca50,_0x5383e1);_0x4f3489(_0x5383e1);});});}function respondWithStatusCode(_0x37316c,_0x1222f8){_0x1222f8=_0x1222f8||0xcc;return function(_0x5a5af6){if(_0x5a5af6){return _0x37316c['sendStatus'](_0x1222f8);}return _0x37316c[_0x79b6('0x28')](_0x1222f8)[_0x79b6('0x29')]();};}function respondWithResult(_0x7fa5c0,_0x2088a6){_0x2088a6=_0x2088a6||0xc8;return function(_0x3a5f86){if(_0x3a5f86){return _0x7fa5c0[_0x79b6('0x28')](_0x2088a6)[_0x79b6('0x2a')](_0x3a5f86);}};}function respondWithFilteredResult(_0x20c536,_0x397880){return function(_0x54a3f1){if(_0x54a3f1){var _0x31f6a9=_0x54a3f1[_0x79b6('0x2b')],_0xec50f6=_0x397880[_0x79b6('0x2c')],_0x540759=_0x397880[_0x79b6('0x2c')]+_0x397880['limit'],_0x5a4a9e;if(_0x540759>=_0x31f6a9){_0x540759=_0x31f6a9;_0x5a4a9e=0xc8;}else{_0x5a4a9e=0xce;}_0x20c536[_0x79b6('0x28')](_0x5a4a9e);return _0x20c536['set'](_0x79b6('0x2d'),_0xec50f6+'-'+_0x540759+'/'+_0x31f6a9)[_0x79b6('0x2a')](_0x54a3f1);}return null;};}function patchUpdates(_0x5573c8){return function(_0x166284){try{jsonpatch['apply'](_0x166284,_0x5573c8,!![]);}catch(_0x5633f7){return BPromise[_0x79b6('0x2e')](_0x5633f7);}return _0x166284['save']();};}function saveUpdates(_0x34d67a,_0x10be95){return function(_0x492dba){if(_0x492dba){return _0x492dba['update'](_0x34d67a)[_0x79b6('0x1e')](function(_0x5ca86d){return _0x5ca86d;});}return null;};}function removeEntity(_0x521884,_0x4a5672){return function(_0x40d998){if(_0x40d998){return _0x40d998['destroy']()[_0x79b6('0x1e')](function(){_0x521884[_0x79b6('0x28')](0xcc)[_0x79b6('0x29')]();});}};}function handleEntityNotFound(_0x46239a,_0x4210ff){return function(_0x2315c2){if(!_0x2315c2){_0x46239a[_0x79b6('0x2f')](0x194);}return _0x2315c2;};}function handleError(_0x5869b7,_0x28a454){_0x28a454=_0x28a454||0x1f4;return function(_0x5415fb){logger[_0x79b6('0x23')](_0x5415fb[_0x79b6('0x30')]);if(_0x5415fb['name']){delete _0x5415fb[_0x79b6('0x31')];}_0x5869b7[_0x79b6('0x28')](_0x28a454)['send'](_0x5415fb);};}exports[_0x79b6('0x32')]=function(_0x1c4ebc,_0x2de95f){var _0x3c2e1f={},_0x60dfbc={},_0x4bcb01={'count':0x0,'rows':[]};var _0x40c0d8=_[_0x79b6('0x33')](db['SalesforceConfiguration']['rawAttributes'],function(_0x50e3c1){return{'name':_0x50e3c1['fieldName'],'type':_0x50e3c1[_0x79b6('0x34')][_0x79b6('0x35')]};});_0x60dfbc[_0x79b6('0x36')]=_[_0x79b6('0x33')](_0x40c0d8,_0x79b6('0x31'));_0x60dfbc[_0x79b6('0x37')]=_['keys'](_0x1c4ebc[_0x79b6('0x37')]);_0x60dfbc[_0x79b6('0x38')]=_[_0x79b6('0x39')](_0x60dfbc[_0x79b6('0x36')],_0x60dfbc[_0x79b6('0x37')]);_0x3c2e1f[_0x79b6('0x3a')]=_[_0x79b6('0x39')](_0x60dfbc[_0x79b6('0x36')],qs['fields'](_0x1c4ebc[_0x79b6('0x37')][_0x79b6('0x3b')]));_0x3c2e1f[_0x79b6('0x3a')]=_0x3c2e1f[_0x79b6('0x3a')][_0x79b6('0x3c')]?_0x3c2e1f['attributes']:_0x60dfbc['model'];if(!_0x1c4ebc[_0x79b6('0x37')][_0x79b6('0x3d')](_0x79b6('0x3e'))){_0x3c2e1f[_0x79b6('0x3f')]=qs[_0x79b6('0x3f')](_0x1c4ebc[_0x79b6('0x37')][_0x79b6('0x3f')]);_0x3c2e1f['offset']=qs[_0x79b6('0x2c')](_0x1c4ebc['query'][_0x79b6('0x2c')]);}_0x3c2e1f[_0x79b6('0x40')]=qs[_0x79b6('0x41')](_0x1c4ebc[_0x79b6('0x37')]['sort']);_0x3c2e1f['where']=qs['filters'](_[_0x79b6('0x42')](_0x1c4ebc['query'],_0x60dfbc[_0x79b6('0x38')]));if(_0x1c4ebc[_0x79b6('0x37')][_0x79b6('0x43')]){_0x3c2e1f[_0x79b6('0x44')]=_['merge'](_0x3c2e1f[_0x79b6('0x44')],{'$or':_['map'](_0x40c0d8,function(_0x57a0d0){if(_0x57a0d0['type']!==_0x79b6('0x45')){var _0x49252b={};_0x49252b[_0x57a0d0[_0x79b6('0x31')]]={'$like':'%'+_0x1c4ebc[_0x79b6('0x37')][_0x79b6('0x43')]+'%'};return _0x49252b;}})});}_0x3c2e1f=_[_0x79b6('0x46')]({},_0x3c2e1f,_0x1c4ebc['options']);var _0x5dd2cb={'where':_0x3c2e1f['where']};return db['SalesforceConfiguration']['count'](_0x5dd2cb)[_0x79b6('0x1e')](function(_0x3e72e4){_0x4bcb01['count']=_0x3e72e4;if(_0x1c4ebc[_0x79b6('0x37')]['includeAll']){_0x3c2e1f[_0x79b6('0x47')]=[{'all':!![]}];}return db['SalesforceConfiguration'][_0x79b6('0x48')](_0x3c2e1f);})[_0x79b6('0x1e')](function(_0x38310a){_0x4bcb01[_0x79b6('0x49')]=_0x38310a;return _0x4bcb01;})[_0x79b6('0x1e')](respondWithFilteredResult(_0x2de95f,_0x3c2e1f))[_0x79b6('0x27')](handleError(_0x2de95f,null));};exports[_0x79b6('0x4a')]=function(_0x73e1cd,_0x568a80){var _0x474578={'raw':![],'where':{'id':_0x73e1cd[_0x79b6('0x4b')]['id']}},_0x5380f9={};_0x5380f9['model']=_[_0x79b6('0x4c')](db[_0x79b6('0x4d')][_0x79b6('0x4e')]);_0x5380f9['query']=_['keys'](_0x73e1cd['query']);_0x5380f9['filters']=_[_0x79b6('0x39')](_0x5380f9[_0x79b6('0x36')],_0x5380f9[_0x79b6('0x37')]);_0x474578[_0x79b6('0x3a')]=_[_0x79b6('0x39')](_0x5380f9[_0x79b6('0x36')],qs[_0x79b6('0x3b')](_0x73e1cd['query'][_0x79b6('0x3b')]));_0x474578['attributes']=_0x474578[_0x79b6('0x3a')]['length']?_0x474578[_0x79b6('0x3a')]:_0x5380f9['model'];if(_0x73e1cd['query']['includeAll']){_0x474578[_0x79b6('0x47')]=[{'all':!![]}];}_0x474578=_['merge']({},_0x474578,_0x73e1cd[_0x79b6('0x4f')]);return db['SalesforceConfiguration'][_0x79b6('0x50')](_0x474578)[_0x79b6('0x1e')](handleEntityNotFound(_0x568a80,null))['then'](respondWithResult(_0x568a80,null))[_0x79b6('0x27')](handleError(_0x568a80,null));};exports[_0x79b6('0x51')]=function(_0x4cb7d1,_0x1ad475){return db[_0x79b6('0x4d')][_0x79b6('0x51')](_0x4cb7d1[_0x79b6('0x52')],{})[_0x79b6('0x1e')](respondWithResult(_0x1ad475,0xc9))[_0x79b6('0x27')](handleError(_0x1ad475,null));};exports[_0x79b6('0x53')]=function(_0x1eaed2,_0x301960){if(_0x1eaed2[_0x79b6('0x52')]['id']){delete _0x1eaed2[_0x79b6('0x52')]['id'];}return db[_0x79b6('0x4d')]['find']({'where':{'id':_0x1eaed2[_0x79b6('0x4b')]['id']}})[_0x79b6('0x1e')](handleEntityNotFound(_0x301960,null))[_0x79b6('0x1e')](saveUpdates(_0x1eaed2['body'],null))[_0x79b6('0x1e')](respondWithResult(_0x301960,null))[_0x79b6('0x27')](handleError(_0x301960,null));};exports[_0x79b6('0x54')]=function(_0x183fcd,_0x2ffa70){return db[_0x79b6('0x4d')]['find']({'where':{'id':_0x183fcd['params']['id']}})['then'](handleEntityNotFound(_0x2ffa70,null))['then'](removeEntity(_0x2ffa70,null))[_0x79b6('0x27')](handleError(_0x2ffa70,null));};exports['getFields']=function(_0x3ecb39,_0xf49f35,_0x1248ec){var _0xac176e={};var _0x37ddcb={};var _0x226639;var _0x207cdc;return db[_0x79b6('0x4d')][_0x79b6('0x55')]({'where':{'id':_0x3ecb39[_0x79b6('0x4b')]['id']}})[_0x79b6('0x1e')](handleEntityNotFound(_0xf49f35,null))[_0x79b6('0x1e')](function(_0x57df2f){if(_0x57df2f){_0x226639=_0x57df2f;_0x37ddcb['model']=_[_0x79b6('0x4c')](db[_0x79b6('0x56')]['rawAttributes']);_0x37ddcb[_0x79b6('0x37')]=_[_0x79b6('0x4c')](_0x3ecb39[_0x79b6('0x37')]);_0x37ddcb['filters']=_['intersection'](_0x37ddcb[_0x79b6('0x36')],_0x37ddcb[_0x79b6('0x37')]);_0xac176e[_0x79b6('0x3a')]=_[_0x79b6('0x39')](_0x37ddcb['model'],qs[_0x79b6('0x3b')](_0x3ecb39[_0x79b6('0x37')]['fields']));_0xac176e[_0x79b6('0x3a')]=_0xac176e[_0x79b6('0x3a')]['length']?_0xac176e[_0x79b6('0x3a')]:_0x37ddcb[_0x79b6('0x36')];_0xac176e['order']=qs[_0x79b6('0x41')](_0x3ecb39[_0x79b6('0x37')][_0x79b6('0x41')]);_0xac176e[_0x79b6('0x44')]=qs['filters'](_[_0x79b6('0x42')](_0x3ecb39['query'],_0x37ddcb[_0x79b6('0x38')]));if(_0x3ecb39[_0x79b6('0x37')][_0x79b6('0x43')]){_0xac176e['where']=_['merge'](_0xac176e['where'],{'$or':_[_0x79b6('0x33')](_0xac176e[_0x79b6('0x3a')],function(_0x492c65){var _0x4f3734={};_0x4f3734[_0x492c65]={'$like':'%'+_0x3ecb39[_0x79b6('0x37')][_0x79b6('0x43')]+'%'};return _0x4f3734;})});}_0xac176e=_[_0x79b6('0x46')]({},_0xac176e,_0x3ecb39[_0x79b6('0x4f')]);return _0x226639['getFields'](_0xac176e);}})[_0x79b6('0x1e')](function(_0x36f59b){if(_0x36f59b){_0x207cdc=_0x36f59b['length'];if(!_0x3ecb39['query'][_0x79b6('0x3d')](_0x79b6('0x3e'))){_0xac176e[_0x79b6('0x3f')]=qs[_0x79b6('0x3f')](_0x3ecb39[_0x79b6('0x37')][_0x79b6('0x3f')]);_0xac176e[_0x79b6('0x2c')]=qs[_0x79b6('0x2c')](_0x3ecb39[_0x79b6('0x37')][_0x79b6('0x2c')]);}return _0x226639['getFields'](_0xac176e);}})['then'](function(_0x4dedb1){if(_0x4dedb1){return _0x4dedb1?{'count':_0x207cdc,'rows':_0x4dedb1}:null;}})[_0x79b6('0x1e')](respondWithResult(_0xf49f35,null))[_0x79b6('0x27')](handleError(_0xf49f35,null));};exports[_0x79b6('0x57')]=function(_0x31e898,_0x37ec81,_0x49058d){var _0x1e78c8={};var _0x1e2569={};var _0x25392a;var _0x521e75;return db[_0x79b6('0x4d')][_0x79b6('0x55')]({'where':{'id':_0x31e898[_0x79b6('0x4b')]['id']}})[_0x79b6('0x1e')](handleEntityNotFound(_0x37ec81,null))['then'](function(_0x2b81d1){if(_0x2b81d1){_0x25392a=_0x2b81d1;_0x1e2569[_0x79b6('0x36')]=_[_0x79b6('0x4c')](db[_0x79b6('0x56')]['rawAttributes']);_0x1e2569['query']=_[_0x79b6('0x4c')](_0x31e898[_0x79b6('0x37')]);_0x1e2569[_0x79b6('0x38')]=_[_0x79b6('0x39')](_0x1e2569[_0x79b6('0x36')],_0x1e2569[_0x79b6('0x37')]);_0x1e78c8[_0x79b6('0x3a')]=_[_0x79b6('0x39')](_0x1e2569['model'],qs[_0x79b6('0x3b')](_0x31e898['query'][_0x79b6('0x3b')]));_0x1e78c8[_0x79b6('0x3a')]=_0x1e78c8[_0x79b6('0x3a')][_0x79b6('0x3c')]?_0x1e78c8[_0x79b6('0x3a')]:_0x1e2569['model'];_0x1e78c8['order']=qs[_0x79b6('0x41')](_0x31e898[_0x79b6('0x37')][_0x79b6('0x41')]);_0x1e78c8[_0x79b6('0x44')]=qs['filters'](_[_0x79b6('0x42')](_0x31e898[_0x79b6('0x37')],_0x1e2569['filters']));if(_0x31e898['query'][_0x79b6('0x43')]){_0x1e78c8[_0x79b6('0x44')]=_[_0x79b6('0x46')](_0x1e78c8[_0x79b6('0x44')],{'$or':_[_0x79b6('0x33')](_0x1e78c8[_0x79b6('0x3a')],function(_0x3a98d8){var _0x2b4bd6={};_0x2b4bd6[_0x3a98d8]={'$like':'%'+_0x31e898[_0x79b6('0x37')][_0x79b6('0x43')]+'%'};return _0x2b4bd6;})});}_0x1e78c8=_[_0x79b6('0x46')]({},_0x1e78c8,_0x31e898[_0x79b6('0x4f')]);return _0x25392a[_0x79b6('0x57')](_0x1e78c8);}})['then'](function(_0x225a67){if(_0x225a67){_0x521e75=_0x225a67[_0x79b6('0x3c')];if(!_0x31e898[_0x79b6('0x37')][_0x79b6('0x3d')](_0x79b6('0x3e'))){_0x1e78c8[_0x79b6('0x3f')]=qs[_0x79b6('0x3f')](_0x31e898['query']['limit']);_0x1e78c8['offset']=qs[_0x79b6('0x2c')](_0x31e898[_0x79b6('0x37')][_0x79b6('0x2c')]);}return _0x25392a[_0x79b6('0x57')](_0x1e78c8);}})[_0x79b6('0x1e')](function(_0x17b7e7){if(_0x17b7e7){return _0x17b7e7?{'count':_0x521e75,'rows':_0x17b7e7}:null;}})[_0x79b6('0x1e')](respondWithResult(_0x37ec81,null))[_0x79b6('0x27')](handleError(_0x37ec81,null));};exports['getDescriptions']=function(_0x1070fd,_0x4b193d,_0xd0a98b){var _0x573cf7={};var _0x27a215={};var _0x16c7aa;var _0x1c4e2c;return db[_0x79b6('0x4d')]['findOne']({'where':{'id':_0x1070fd['params']['id']}})[_0x79b6('0x1e')](handleEntityNotFound(_0x4b193d,null))[_0x79b6('0x1e')](function(_0x4034ed){if(_0x4034ed){_0x16c7aa=_0x4034ed;_0x27a215[_0x79b6('0x36')]=_[_0x79b6('0x4c')](db[_0x79b6('0x56')]['rawAttributes']);_0x27a215[_0x79b6('0x37')]=_[_0x79b6('0x4c')](_0x1070fd[_0x79b6('0x37')]);_0x27a215[_0x79b6('0x38')]=_[_0x79b6('0x39')](_0x27a215[_0x79b6('0x36')],_0x27a215[_0x79b6('0x37')]);_0x573cf7[_0x79b6('0x3a')]=_[_0x79b6('0x39')](_0x27a215[_0x79b6('0x36')],qs[_0x79b6('0x3b')](_0x1070fd['query']['fields']));_0x573cf7[_0x79b6('0x3a')]=_0x573cf7['attributes'][_0x79b6('0x3c')]?_0x573cf7['attributes']:_0x27a215['model'];_0x573cf7[_0x79b6('0x40')]=qs[_0x79b6('0x41')](_0x1070fd[_0x79b6('0x37')][_0x79b6('0x41')]);_0x573cf7[_0x79b6('0x44')]=qs[_0x79b6('0x38')](_['pick'](_0x1070fd[_0x79b6('0x37')],_0x27a215['filters']));if(_0x1070fd[_0x79b6('0x37')]['filter']){_0x573cf7['where']=_[_0x79b6('0x46')](_0x573cf7[_0x79b6('0x44')],{'$or':_[_0x79b6('0x33')](_0x573cf7[_0x79b6('0x3a')],function(_0x3db8c2){var _0x4ffa0c={};_0x4ffa0c[_0x3db8c2]={'$like':'%'+_0x1070fd[_0x79b6('0x37')][_0x79b6('0x43')]+'%'};return _0x4ffa0c;})});}_0x573cf7=_['merge']({},_0x573cf7,_0x1070fd[_0x79b6('0x4f')]);return _0x16c7aa[_0x79b6('0x58')](_0x573cf7);}})[_0x79b6('0x1e')](function(_0x139d34){if(_0x139d34){_0x1c4e2c=_0x139d34['length'];if(!_0x1070fd['query']['hasOwnProperty'](_0x79b6('0x3e'))){_0x573cf7[_0x79b6('0x3f')]=qs[_0x79b6('0x3f')](_0x1070fd[_0x79b6('0x37')][_0x79b6('0x3f')]);_0x573cf7['offset']=qs[_0x79b6('0x2c')](_0x1070fd[_0x79b6('0x37')][_0x79b6('0x2c')]);}return _0x16c7aa[_0x79b6('0x58')](_0x573cf7);}})[_0x79b6('0x1e')](function(_0x278ade){if(_0x278ade){return _0x278ade?{'count':_0x1c4e2c,'rows':_0x278ade}:null;}})[_0x79b6('0x1e')](respondWithResult(_0x4b193d,null))[_0x79b6('0x27')](handleError(_0x4b193d,null));}; \ No newline at end of file +var _0x75f0=['stack','name','send','index','map','SalesforceConfiguration','rawAttributes','fieldName','type','key','model','query','keys','intersection','attributes','fields','nolimit','sort','where','filters','pick','merge','VIRTUAL','filter','options','includeAll','include','findAll','show','params','length','find','create','body','findOne','SalesforceField','order','getFields','hasOwnProperty','getSubjects','getDescriptions','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','path','sox','to-csv','ejs','lodash','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/logger','api','../../config/environment','jayson/promise','client','test','Sequelize','ValidationError','The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.','request','then','info','SalesforceConfiguration,\x20%s,\x20%s','request\x20sent','debug','error','code','message','result','catch','sendStatus','status','count','offset','limit','set','Content-Range','reject','save','update','destroy','end'];(function(_0x4b4411,_0x1e7dc9){var _0x457510=function(_0x1e70d9){while(--_0x1e70d9){_0x4b4411['push'](_0x4b4411['shift']());}};_0x457510(++_0x1e7dc9);}(_0x75f0,0x85));var _0x075f=function(_0x3452c5,_0x11829a){_0x3452c5=_0x3452c5-0x0;var _0x3d2172=_0x75f0[_0x3452c5];return _0x3d2172;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x075f('0x0'));var rimraf=require(_0x075f('0x1'));var zipdir=require(_0x075f('0x2'));var jsonpatch=require(_0x075f('0x3'));var rp=require('request-promise');var moment=require(_0x075f('0x4'));var BPromise=require(_0x075f('0x5'));var Mustache=require(_0x075f('0x6'));var util=require('util');var path=require(_0x075f('0x7'));var sox=require(_0x075f('0x8'));var csv=require(_0x075f('0x9'));var ejs=require(_0x075f('0xa'));var fs=require('fs');var _=require(_0x075f('0xb'));var squel=require('squel');var crypto=require(_0x075f('0xc'));var jsforce=require(_0x075f('0xd'));var deskjs=require('desk.js');var toCsv=require(_0x075f('0x9'));var querystring=require(_0x075f('0xe'));var Papa=require(_0x075f('0xf'));var Redis=require(_0x075f('0x10'));var authService=require(_0x075f('0x11'));var qs=require(_0x075f('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x075f('0x13'))(_0x075f('0x14'));var utils=require('../../config/utils');var config=require(_0x075f('0x15'));var db=require('../../mysqldb')['db'];var jayson=require(_0x075f('0x16'));var client=jayson[_0x075f('0x17')]['http']({'port':0x232a});function checkPasswordPattern(_0x1d52ca,_0x424d44,_0x26710f){if(_0x26710f){var _0x4a896d=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x4a896d[_0x075f('0x18')](_0x424d44)){return _0x1d52ca;}else{throw new db[(_0x075f('0x19'))][(_0x075f('0x1a'))](_0x075f('0x1b'));}}else{return _0x1d52ca;}}function respondWithRpcPromise(_0x5cf54d,_0x36116d,_0x2589f0,_0x1ed08b){return new BPromise(function(_0x590e68,_0x30261c){var _0x198ca5=_0x1ed08b||client;return _0x198ca5[_0x075f('0x1c')](_0x5cf54d,_0x2589f0)[_0x075f('0x1d')](function(_0x162d91){logger[_0x075f('0x1e')](_0x075f('0x1f'),_0x36116d,_0x075f('0x20'));logger[_0x075f('0x21')]('SalesforceConfiguration,\x20%s,\x20%s,\x20%s',_0x36116d,'request\x20sent',JSON['stringify'](_0x162d91));if(_0x162d91[_0x075f('0x22')]){if(_0x162d91[_0x075f('0x22')][_0x075f('0x23')]===0x1f4){logger['error'](_0x075f('0x1f'),_0x36116d,_0x162d91[_0x075f('0x22')][_0x075f('0x24')]);return _0x30261c(_0x162d91[_0x075f('0x22')]['message']);}logger['error'](_0x075f('0x1f'),_0x36116d,_0x162d91[_0x075f('0x22')][_0x075f('0x24')]);return _0x590e68(_0x162d91['error'][_0x075f('0x24')]);}else{logger[_0x075f('0x1e')](_0x075f('0x1f'),_0x36116d,_0x075f('0x20'));_0x590e68(_0x162d91[_0x075f('0x25')][_0x075f('0x24')]);}})[_0x075f('0x26')](function(_0x3d47b9){logger['error']('SalesforceConfiguration,\x20%s,\x20%s',_0x36116d,_0x3d47b9);_0x30261c(_0x3d47b9);});});}function respondWithStatusCode(_0x528627,_0x4af6ed){_0x4af6ed=_0x4af6ed||0xcc;return function(_0xaf4903){if(_0xaf4903){return _0x528627[_0x075f('0x27')](_0x4af6ed);}return _0x528627['status'](_0x4af6ed)['end']();};}function respondWithResult(_0x43aa6d,_0x53a9ec){_0x53a9ec=_0x53a9ec||0xc8;return function(_0x29bb09){if(_0x29bb09){return _0x43aa6d[_0x075f('0x28')](_0x53a9ec)['json'](_0x29bb09);}};}function respondWithFilteredResult(_0x16f4bc,_0x4f485c){return function(_0x5e7c64){if(_0x5e7c64){var _0x50f1f6=_0x5e7c64[_0x075f('0x29')],_0x2f2010=_0x4f485c[_0x075f('0x2a')],_0x5700f0=_0x4f485c['offset']+_0x4f485c[_0x075f('0x2b')],_0xacfe4b;if(_0x5700f0>=_0x50f1f6){_0x5700f0=_0x50f1f6;_0xacfe4b=0xc8;}else{_0xacfe4b=0xce;}_0x16f4bc[_0x075f('0x28')](_0xacfe4b);return _0x16f4bc[_0x075f('0x2c')](_0x075f('0x2d'),_0x2f2010+'-'+_0x5700f0+'/'+_0x50f1f6)['json'](_0x5e7c64);}return null;};}function patchUpdates(_0x489ba6){return function(_0xe2703c){try{jsonpatch['apply'](_0xe2703c,_0x489ba6,!![]);}catch(_0x5e25a6){return BPromise[_0x075f('0x2e')](_0x5e25a6);}return _0xe2703c[_0x075f('0x2f')]();};}function saveUpdates(_0x5387b9,_0x59aa9a){return function(_0x40ea33){if(_0x40ea33){return _0x40ea33[_0x075f('0x30')](_0x5387b9)[_0x075f('0x1d')](function(_0x48fb3b){return _0x48fb3b;});}return null;};}function removeEntity(_0x30aa76,_0x52e1b7){return function(_0x43432e){if(_0x43432e){return _0x43432e[_0x075f('0x31')]()[_0x075f('0x1d')](function(){_0x30aa76[_0x075f('0x28')](0xcc)[_0x075f('0x32')]();});}};}function handleEntityNotFound(_0xa43bd7,_0x6b3e9b){return function(_0x3d6322){if(!_0x3d6322){_0xa43bd7[_0x075f('0x27')](0x194);}return _0x3d6322;};}function handleError(_0x358d13,_0x4ea131){_0x4ea131=_0x4ea131||0x1f4;return function(_0x2289b9){logger[_0x075f('0x22')](_0x2289b9[_0x075f('0x33')]);if(_0x2289b9[_0x075f('0x34')]){delete _0x2289b9[_0x075f('0x34')];}_0x358d13[_0x075f('0x28')](_0x4ea131)[_0x075f('0x35')](_0x2289b9);};}exports[_0x075f('0x36')]=function(_0xd601cf,_0x21bc1b){var _0x24c60a={},_0x5a2ea5={},_0x2fa82c={'count':0x0,'rows':[]};var _0x3f1783=_[_0x075f('0x37')](db[_0x075f('0x38')][_0x075f('0x39')],function(_0x146838){return{'name':_0x146838[_0x075f('0x3a')],'type':_0x146838[_0x075f('0x3b')][_0x075f('0x3c')]};});_0x5a2ea5[_0x075f('0x3d')]=_[_0x075f('0x37')](_0x3f1783,_0x075f('0x34'));_0x5a2ea5[_0x075f('0x3e')]=_[_0x075f('0x3f')](_0xd601cf[_0x075f('0x3e')]);_0x5a2ea5['filters']=_[_0x075f('0x40')](_0x5a2ea5['model'],_0x5a2ea5[_0x075f('0x3e')]);_0x24c60a[_0x075f('0x41')]=_['intersection'](_0x5a2ea5['model'],qs[_0x075f('0x42')](_0xd601cf[_0x075f('0x3e')][_0x075f('0x42')]));_0x24c60a[_0x075f('0x41')]=_0x24c60a['attributes']['length']?_0x24c60a[_0x075f('0x41')]:_0x5a2ea5[_0x075f('0x3d')];if(!_0xd601cf[_0x075f('0x3e')]['hasOwnProperty'](_0x075f('0x43'))){_0x24c60a[_0x075f('0x2b')]=qs[_0x075f('0x2b')](_0xd601cf[_0x075f('0x3e')][_0x075f('0x2b')]);_0x24c60a[_0x075f('0x2a')]=qs['offset'](_0xd601cf[_0x075f('0x3e')][_0x075f('0x2a')]);}_0x24c60a['order']=qs[_0x075f('0x44')](_0xd601cf['query']['sort']);_0x24c60a[_0x075f('0x45')]=qs[_0x075f('0x46')](_[_0x075f('0x47')](_0xd601cf['query'],_0x5a2ea5['filters']));if(_0xd601cf[_0x075f('0x3e')]['filter']){_0x24c60a[_0x075f('0x45')]=_[_0x075f('0x48')](_0x24c60a[_0x075f('0x45')],{'$or':_[_0x075f('0x37')](_0x3f1783,function(_0x466a02){if(_0x466a02['type']!==_0x075f('0x49')){var _0x190c26={};_0x190c26[_0x466a02['name']]={'$like':'%'+_0xd601cf[_0x075f('0x3e')][_0x075f('0x4a')]+'%'};return _0x190c26;}})});}_0x24c60a=_['merge']({},_0x24c60a,_0xd601cf[_0x075f('0x4b')]);var _0x400608={'where':_0x24c60a[_0x075f('0x45')]};return db[_0x075f('0x38')]['count'](_0x400608)['then'](function(_0x2b72c5){_0x2fa82c[_0x075f('0x29')]=_0x2b72c5;if(_0xd601cf['query'][_0x075f('0x4c')]){_0x24c60a[_0x075f('0x4d')]=[{'all':!![]}];}return db[_0x075f('0x38')][_0x075f('0x4e')](_0x24c60a);})[_0x075f('0x1d')](function(_0x395633){_0x2fa82c['rows']=_0x395633;return _0x2fa82c;})[_0x075f('0x1d')](respondWithFilteredResult(_0x21bc1b,_0x24c60a))[_0x075f('0x26')](handleError(_0x21bc1b,null));};exports[_0x075f('0x4f')]=function(_0x48bde1,_0x23d1ac){var _0x3b660a={'raw':![],'where':{'id':_0x48bde1[_0x075f('0x50')]['id']}},_0x38cba4={};_0x38cba4[_0x075f('0x3d')]=_[_0x075f('0x3f')](db['SalesforceConfiguration'][_0x075f('0x39')]);_0x38cba4['query']=_[_0x075f('0x3f')](_0x48bde1['query']);_0x38cba4['filters']=_[_0x075f('0x40')](_0x38cba4['model'],_0x38cba4[_0x075f('0x3e')]);_0x3b660a[_0x075f('0x41')]=_[_0x075f('0x40')](_0x38cba4[_0x075f('0x3d')],qs[_0x075f('0x42')](_0x48bde1[_0x075f('0x3e')][_0x075f('0x42')]));_0x3b660a[_0x075f('0x41')]=_0x3b660a[_0x075f('0x41')][_0x075f('0x51')]?_0x3b660a['attributes']:_0x38cba4[_0x075f('0x3d')];if(_0x48bde1['query'][_0x075f('0x4c')]){_0x3b660a[_0x075f('0x4d')]=[{'all':!![]}];}_0x3b660a=_[_0x075f('0x48')]({},_0x3b660a,_0x48bde1[_0x075f('0x4b')]);return db['SalesforceConfiguration'][_0x075f('0x52')](_0x3b660a)[_0x075f('0x1d')](handleEntityNotFound(_0x23d1ac,null))[_0x075f('0x1d')](respondWithResult(_0x23d1ac,null))[_0x075f('0x26')](handleError(_0x23d1ac,null));};exports['create']=function(_0x3baef3,_0x4b6526){return db[_0x075f('0x38')][_0x075f('0x53')](_0x3baef3[_0x075f('0x54')],{})[_0x075f('0x1d')](respondWithResult(_0x4b6526,0xc9))['catch'](handleError(_0x4b6526,null));};exports['update']=function(_0x21fde4,_0x506dfe){if(_0x21fde4[_0x075f('0x54')]['id']){delete _0x21fde4[_0x075f('0x54')]['id'];}return db[_0x075f('0x38')][_0x075f('0x52')]({'where':{'id':_0x21fde4[_0x075f('0x50')]['id']}})[_0x075f('0x1d')](handleEntityNotFound(_0x506dfe,null))[_0x075f('0x1d')](saveUpdates(_0x21fde4[_0x075f('0x54')],null))[_0x075f('0x1d')](respondWithResult(_0x506dfe,null))[_0x075f('0x26')](handleError(_0x506dfe,null));};exports['destroy']=function(_0x3603d6,_0x4bb816){return db[_0x075f('0x38')][_0x075f('0x52')]({'where':{'id':_0x3603d6[_0x075f('0x50')]['id']}})[_0x075f('0x1d')](handleEntityNotFound(_0x4bb816,null))[_0x075f('0x1d')](removeEntity(_0x4bb816,null))[_0x075f('0x26')](handleError(_0x4bb816,null));};exports['getFields']=function(_0x5e1395,_0x5b8d78,_0x4379b0){var _0x5d080e={};var _0x4664ba={};var _0x128408;var _0x591ef;return db['SalesforceConfiguration'][_0x075f('0x55')]({'where':{'id':_0x5e1395[_0x075f('0x50')]['id']}})[_0x075f('0x1d')](handleEntityNotFound(_0x5b8d78,null))[_0x075f('0x1d')](function(_0x2307e7){if(_0x2307e7){_0x128408=_0x2307e7;_0x4664ba[_0x075f('0x3d')]=_[_0x075f('0x3f')](db[_0x075f('0x56')]['rawAttributes']);_0x4664ba[_0x075f('0x3e')]=_[_0x075f('0x3f')](_0x5e1395[_0x075f('0x3e')]);_0x4664ba[_0x075f('0x46')]=_[_0x075f('0x40')](_0x4664ba['model'],_0x4664ba[_0x075f('0x3e')]);_0x5d080e[_0x075f('0x41')]=_['intersection'](_0x4664ba['model'],qs[_0x075f('0x42')](_0x5e1395[_0x075f('0x3e')]['fields']));_0x5d080e[_0x075f('0x41')]=_0x5d080e[_0x075f('0x41')][_0x075f('0x51')]?_0x5d080e[_0x075f('0x41')]:_0x4664ba[_0x075f('0x3d')];_0x5d080e[_0x075f('0x57')]=qs['sort'](_0x5e1395[_0x075f('0x3e')][_0x075f('0x44')]);_0x5d080e['where']=qs[_0x075f('0x46')](_[_0x075f('0x47')](_0x5e1395[_0x075f('0x3e')],_0x4664ba[_0x075f('0x46')]));if(_0x5e1395[_0x075f('0x3e')][_0x075f('0x4a')]){_0x5d080e[_0x075f('0x45')]=_[_0x075f('0x48')](_0x5d080e['where'],{'$or':_['map'](_0x5d080e[_0x075f('0x41')],function(_0x5c67af){var _0x1e8e14={};_0x1e8e14[_0x5c67af]={'$like':'%'+_0x5e1395[_0x075f('0x3e')][_0x075f('0x4a')]+'%'};return _0x1e8e14;})});}_0x5d080e=_[_0x075f('0x48')]({},_0x5d080e,_0x5e1395['options']);return _0x128408[_0x075f('0x58')](_0x5d080e);}})[_0x075f('0x1d')](function(_0x3a9d05){if(_0x3a9d05){_0x591ef=_0x3a9d05[_0x075f('0x51')];if(!_0x5e1395['query'][_0x075f('0x59')](_0x075f('0x43'))){_0x5d080e[_0x075f('0x2b')]=qs[_0x075f('0x2b')](_0x5e1395['query'][_0x075f('0x2b')]);_0x5d080e[_0x075f('0x2a')]=qs['offset'](_0x5e1395[_0x075f('0x3e')][_0x075f('0x2a')]);}return _0x128408[_0x075f('0x58')](_0x5d080e);}})[_0x075f('0x1d')](function(_0x58c074){if(_0x58c074){return _0x58c074?{'count':_0x591ef,'rows':_0x58c074}:null;}})[_0x075f('0x1d')](respondWithResult(_0x5b8d78,null))['catch'](handleError(_0x5b8d78,null));};exports[_0x075f('0x5a')]=function(_0x4679a,_0x51cfb1,_0x4e9251){var _0x1fe0d9={};var _0x276976={};var _0x116a8a;var _0x48cfdb;return db[_0x075f('0x38')]['findOne']({'where':{'id':_0x4679a[_0x075f('0x50')]['id']}})['then'](handleEntityNotFound(_0x51cfb1,null))[_0x075f('0x1d')](function(_0x57297a){if(_0x57297a){_0x116a8a=_0x57297a;_0x276976[_0x075f('0x3d')]=_[_0x075f('0x3f')](db[_0x075f('0x56')]['rawAttributes']);_0x276976[_0x075f('0x3e')]=_['keys'](_0x4679a[_0x075f('0x3e')]);_0x276976[_0x075f('0x46')]=_[_0x075f('0x40')](_0x276976[_0x075f('0x3d')],_0x276976[_0x075f('0x3e')]);_0x1fe0d9[_0x075f('0x41')]=_[_0x075f('0x40')](_0x276976[_0x075f('0x3d')],qs[_0x075f('0x42')](_0x4679a[_0x075f('0x3e')]['fields']));_0x1fe0d9[_0x075f('0x41')]=_0x1fe0d9['attributes'][_0x075f('0x51')]?_0x1fe0d9['attributes']:_0x276976['model'];_0x1fe0d9[_0x075f('0x57')]=qs[_0x075f('0x44')](_0x4679a[_0x075f('0x3e')][_0x075f('0x44')]);_0x1fe0d9[_0x075f('0x45')]=qs[_0x075f('0x46')](_[_0x075f('0x47')](_0x4679a['query'],_0x276976['filters']));if(_0x4679a[_0x075f('0x3e')][_0x075f('0x4a')]){_0x1fe0d9['where']=_['merge'](_0x1fe0d9[_0x075f('0x45')],{'$or':_[_0x075f('0x37')](_0x1fe0d9[_0x075f('0x41')],function(_0x5054e8){var _0x34398a={};_0x34398a[_0x5054e8]={'$like':'%'+_0x4679a[_0x075f('0x3e')][_0x075f('0x4a')]+'%'};return _0x34398a;})});}_0x1fe0d9=_[_0x075f('0x48')]({},_0x1fe0d9,_0x4679a[_0x075f('0x4b')]);return _0x116a8a[_0x075f('0x5a')](_0x1fe0d9);}})['then'](function(_0x5dd3e2){if(_0x5dd3e2){_0x48cfdb=_0x5dd3e2[_0x075f('0x51')];if(!_0x4679a['query'][_0x075f('0x59')](_0x075f('0x43'))){_0x1fe0d9[_0x075f('0x2b')]=qs[_0x075f('0x2b')](_0x4679a[_0x075f('0x3e')][_0x075f('0x2b')]);_0x1fe0d9[_0x075f('0x2a')]=qs[_0x075f('0x2a')](_0x4679a['query'][_0x075f('0x2a')]);}return _0x116a8a[_0x075f('0x5a')](_0x1fe0d9);}})['then'](function(_0x46cbd3){if(_0x46cbd3){return _0x46cbd3?{'count':_0x48cfdb,'rows':_0x46cbd3}:null;}})[_0x075f('0x1d')](respondWithResult(_0x51cfb1,null))[_0x075f('0x26')](handleError(_0x51cfb1,null));};exports[_0x075f('0x5b')]=function(_0x29fcc7,_0x473476,_0x5b98f7){var _0x3bbc3f={};var _0xfcf6f={};var _0xd6bf48;var _0x1a8ade;return db['SalesforceConfiguration']['findOne']({'where':{'id':_0x29fcc7[_0x075f('0x50')]['id']}})[_0x075f('0x1d')](handleEntityNotFound(_0x473476,null))[_0x075f('0x1d')](function(_0x24709c){if(_0x24709c){_0xd6bf48=_0x24709c;_0xfcf6f[_0x075f('0x3d')]=_[_0x075f('0x3f')](db[_0x075f('0x56')][_0x075f('0x39')]);_0xfcf6f[_0x075f('0x3e')]=_[_0x075f('0x3f')](_0x29fcc7[_0x075f('0x3e')]);_0xfcf6f[_0x075f('0x46')]=_['intersection'](_0xfcf6f[_0x075f('0x3d')],_0xfcf6f[_0x075f('0x3e')]);_0x3bbc3f[_0x075f('0x41')]=_[_0x075f('0x40')](_0xfcf6f[_0x075f('0x3d')],qs[_0x075f('0x42')](_0x29fcc7[_0x075f('0x3e')][_0x075f('0x42')]));_0x3bbc3f[_0x075f('0x41')]=_0x3bbc3f[_0x075f('0x41')]['length']?_0x3bbc3f[_0x075f('0x41')]:_0xfcf6f['model'];_0x3bbc3f[_0x075f('0x57')]=qs['sort'](_0x29fcc7['query']['sort']);_0x3bbc3f[_0x075f('0x45')]=qs[_0x075f('0x46')](_[_0x075f('0x47')](_0x29fcc7['query'],_0xfcf6f[_0x075f('0x46')]));if(_0x29fcc7['query']['filter']){_0x3bbc3f['where']=_[_0x075f('0x48')](_0x3bbc3f[_0x075f('0x45')],{'$or':_[_0x075f('0x37')](_0x3bbc3f[_0x075f('0x41')],function(_0x336a12){var _0x3ad8f0={};_0x3ad8f0[_0x336a12]={'$like':'%'+_0x29fcc7[_0x075f('0x3e')][_0x075f('0x4a')]+'%'};return _0x3ad8f0;})});}_0x3bbc3f=_[_0x075f('0x48')]({},_0x3bbc3f,_0x29fcc7[_0x075f('0x4b')]);return _0xd6bf48[_0x075f('0x5b')](_0x3bbc3f);}})['then'](function(_0x280879){if(_0x280879){_0x1a8ade=_0x280879[_0x075f('0x51')];if(!_0x29fcc7[_0x075f('0x3e')][_0x075f('0x59')](_0x075f('0x43'))){_0x3bbc3f[_0x075f('0x2b')]=qs[_0x075f('0x2b')](_0x29fcc7[_0x075f('0x3e')]['limit']);_0x3bbc3f[_0x075f('0x2a')]=qs['offset'](_0x29fcc7['query']['offset']);}return _0xd6bf48[_0x075f('0x5b')](_0x3bbc3f);}})['then'](function(_0x5d65ec){if(_0x5d65ec){return _0x5d65ec?{'count':_0x1a8ade,'rows':_0x5d65ec}:null;}})['then'](respondWithResult(_0x473476,null))[_0x075f('0x26')](handleError(_0x473476,null));}; \ No newline at end of file diff --git a/server/api/intSalesforceConfiguration/intSalesforceConfiguration.model.js b/server/api/intSalesforceConfiguration/intSalesforceConfiguration.model.js index ed1e669..efcf7d0 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 _0x0d8d=['int_salesforce_configurations','lodash','util','../../config/logger','api','moment','bluebird','rimraf','../../config/environment','exports','SalesforceConfiguration'];(function(_0x29a1d3,_0x20ebc5){var _0x2513fe=function(_0x149a1e){while(--_0x149a1e){_0x29a1d3['push'](_0x29a1d3['shift']());}};_0x2513fe(++_0x20ebc5);}(_0x0d8d,0x182));var _0xd0d8=function(_0x19a883,_0x23ec5b){_0x19a883=_0x19a883-0x0;var _0x55c323=_0x0d8d[_0x19a883];return _0x55c323;};'use strict';var _=require(_0xd0d8('0x0'));var util=require(_0xd0d8('0x1'));var logger=require(_0xd0d8('0x2'))(_0xd0d8('0x3'));var moment=require(_0xd0d8('0x4'));var BPromise=require(_0xd0d8('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0xd0d8('0x6'));var config=require(_0xd0d8('0x7'));var attributes=require('./intSalesforceConfiguration.attributes');module[_0xd0d8('0x8')]=function(_0x5e624f,_0x2c8499){return _0x5e624f['define'](_0xd0d8('0x9'),attributes,{'tableName':_0xd0d8('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x35c3=['bluebird','request-promise','path','../../config/environment','./intSalesforceConfiguration.attributes','exports','define','SalesforceConfiguration','int_salesforce_configurations','lodash','util','../../config/logger','api','moment'];(function(_0xcb6388,_0x386026){var _0x3ba619=function(_0x229ff9){while(--_0x229ff9){_0xcb6388['push'](_0xcb6388['shift']());}};_0x3ba619(++_0x386026);}(_0x35c3,0x175));var _0x335c=function(_0x136d87,_0xfabe71){_0x136d87=_0x136d87-0x0;var _0x480759=_0x35c3[_0x136d87];return _0x480759;};'use strict';var _=require(_0x335c('0x0'));var util=require(_0x335c('0x1'));var logger=require(_0x335c('0x2'))(_0x335c('0x3'));var moment=require(_0x335c('0x4'));var BPromise=require(_0x335c('0x5'));var rp=require(_0x335c('0x6'));var fs=require('fs');var path=require(_0x335c('0x7'));var rimraf=require('rimraf');var config=require(_0x335c('0x8'));var attributes=require(_0x335c('0x9'));module[_0x335c('0xa')]=function(_0x322127,_0x1ee90a){return _0x322127[_0x335c('0xb')](_0x335c('0xc'),attributes,{'tableName':_0x335c('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 755798b..36526a5 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 _0x018e=['moment','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','info','SalesforceConfiguration,\x20%s,\x20%s','request\x20sent','debug','SalesforceConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result'];(function(_0x122ef9,_0x451d2a){var _0x42fba0=function(_0x17c9d3){while(--_0x17c9d3){_0x122ef9['push'](_0x122ef9['shift']());}};_0x42fba0(++_0x451d2a);}(_0x018e,0x18f));var _0xe018=function(_0x430f44,_0x4ae21b){_0x430f44=_0x430f44-0x0;var _0x1f6b0f=_0x018e[_0x430f44];return _0x1f6b0f;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0xe018('0x0'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xe018('0x1'));var db=require(_0xe018('0x2'))['db'];var utils=require(_0xe018('0x3'));var logger=require(_0xe018('0x4'))(_0xe018('0x5'));var config=require(_0xe018('0x6'));var jayson=require('jayson/promise');var client=jayson[_0xe018('0x7')][_0xe018('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x538a6d,_0x1df22f,_0x5ac559){return new BPromise(function(_0x240010,_0x26b481){return client['request'](_0x538a6d,_0x5ac559)['then'](function(_0x4fb24e){logger[_0xe018('0x9')](_0xe018('0xa'),_0x1df22f,_0xe018('0xb'));logger[_0xe018('0xc')](_0xe018('0xd'),_0x1df22f,_0xe018('0xb'),JSON[_0xe018('0xe')](_0x4fb24e));if(_0x4fb24e[_0xe018('0xf')]){if(_0x4fb24e['error'][_0xe018('0x10')]===0x1f4){logger[_0xe018('0xf')](_0xe018('0xa'),_0x1df22f,_0x4fb24e[_0xe018('0xf')][_0xe018('0x11')]);return _0x26b481(_0x4fb24e['error']['message']);}logger[_0xe018('0xf')](_0xe018('0xa'),_0x1df22f,_0x4fb24e[_0xe018('0xf')][_0xe018('0x11')]);return _0x240010(_0x4fb24e[_0xe018('0xf')][_0xe018('0x11')]);}else{logger[_0xe018('0x9')](_0xe018('0xa'),_0x1df22f,_0xe018('0xb'));_0x240010(_0x4fb24e[_0xe018('0x12')][_0xe018('0x11')]);}})['catch'](function(_0x2787b5){logger[_0xe018('0xf')]('SalesforceConfiguration,\x20%s,\x20%s',_0x1df22f,_0x2787b5);_0x26b481(_0x2787b5);});});} \ No newline at end of file +var _0x6bd1=['catch','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request','then','SalesforceConfiguration,\x20%s,\x20%s','request\x20sent','SalesforceConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result'];(function(_0x4e7ef9,_0x48ed3c){var _0x3bb171=function(_0xe846a2){while(--_0xe846a2){_0x4e7ef9['push'](_0x4e7ef9['shift']());}};_0x3bb171(++_0x48ed3c);}(_0x6bd1,0xc1));var _0x16bd=function(_0x57b54c,_0x54ce0d){_0x57b54c=_0x57b54c-0x0;var _0x59cc19=_0x6bd1[_0x57b54c];return _0x59cc19;};'use strict';var _=require(_0x16bd('0x0'));var util=require('util');var moment=require(_0x16bd('0x1'));var BPromise=require(_0x16bd('0x2'));var rs=require(_0x16bd('0x3'));var fs=require('fs');var Redis=require(_0x16bd('0x4'));var db=require(_0x16bd('0x5'))['db'];var utils=require(_0x16bd('0x6'));var logger=require(_0x16bd('0x7'))('rpc');var config=require(_0x16bd('0x8'));var jayson=require(_0x16bd('0x9'));var client=jayson[_0x16bd('0xa')][_0x16bd('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x2a719b,_0x2b7460,_0x2dce79){return new BPromise(function(_0x3d66c4,_0x30e455){return client[_0x16bd('0xc')](_0x2a719b,_0x2dce79)[_0x16bd('0xd')](function(_0x156ff1){logger['info'](_0x16bd('0xe'),_0x2b7460,_0x16bd('0xf'));logger['debug'](_0x16bd('0x10'),_0x2b7460,'request\x20sent',JSON[_0x16bd('0x11')](_0x156ff1));if(_0x156ff1[_0x16bd('0x12')]){if(_0x156ff1[_0x16bd('0x12')][_0x16bd('0x13')]===0x1f4){logger[_0x16bd('0x12')](_0x16bd('0xe'),_0x2b7460,_0x156ff1['error'][_0x16bd('0x14')]);return _0x30e455(_0x156ff1[_0x16bd('0x12')][_0x16bd('0x14')]);}logger[_0x16bd('0x12')](_0x16bd('0xe'),_0x2b7460,_0x156ff1[_0x16bd('0x12')][_0x16bd('0x14')]);return _0x3d66c4(_0x156ff1[_0x16bd('0x12')]['message']);}else{logger[_0x16bd('0x15')](_0x16bd('0xe'),_0x2b7460,'request\x20sent');_0x3d66c4(_0x156ff1[_0x16bd('0x16')][_0x16bd('0x14')]);}})[_0x16bd('0x17')](function(_0x54be09){logger[_0x16bd('0x12')](_0x16bd('0xe'),_0x2b7460,_0x54be09);_0x30e455(_0x54be09);});});} \ No newline at end of file diff --git a/server/api/intSalesforceField/index.js b/server/api/intSalesforceField/index.js index 2e45d1b..d768103 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 _0xafc4=['multer','path','express','Router','../../components/auth/service','../../components/interaction/service','isAuthenticated','index','get','/:id','show','create','put','update','exports'];(function(_0x282895,_0x53c75a){var _0x6f3695=function(_0x454edb){while(--_0x454edb){_0x282895['push'](_0x282895['shift']());}};_0x6f3695(++_0x53c75a);}(_0xafc4,0x69));var _0x4afc=function(_0x334b85,_0x2ab36a){_0x334b85=_0x334b85-0x0;var _0x7f974b=_0xafc4[_0x334b85];return _0x7f974b;};'use strict';var multer=require(_0x4afc('0x0'));var util=require('util');var path=require(_0x4afc('0x1'));var timeout=require('connect-timeout');var express=require(_0x4afc('0x2'));var router=express[_0x4afc('0x3')]();var auth=require(_0x4afc('0x4'));var interaction=require(_0x4afc('0x5'));var config=require('../../config/environment');var controller=require('./intSalesforceField.controller');router['get']('/',auth[_0x4afc('0x6')](),controller[_0x4afc('0x7')]);router[_0x4afc('0x8')](_0x4afc('0x9'),auth[_0x4afc('0x6')](),controller[_0x4afc('0xa')]);router['post']('/',auth[_0x4afc('0x6')](),controller[_0x4afc('0xb')]);router[_0x4afc('0xc')](_0x4afc('0x9'),auth[_0x4afc('0x6')](),controller[_0x4afc('0xd')]);router['delete']('/:id',auth[_0x4afc('0x6')](),controller['destroy']);module[_0x4afc('0xe')]=router; \ No newline at end of file +var _0x8ace=['index','show','create','/:id','update','delete','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./intSalesforceField.controller','get','isAuthenticated'];(function(_0x2d1c88,_0x192205){var _0x2881f0=function(_0x36f1e8){while(--_0x36f1e8){_0x2d1c88['push'](_0x2d1c88['shift']());}};_0x2881f0(++_0x192205);}(_0x8ace,0x1bc));var _0xe8ac=function(_0x1f1731,_0x4b77eb){_0x1f1731=_0x1f1731-0x0;var _0x1f7625=_0x8ace[_0x1f1731];return _0x1f7625;};'use strict';var multer=require(_0xe8ac('0x0'));var util=require(_0xe8ac('0x1'));var path=require(_0xe8ac('0x2'));var timeout=require(_0xe8ac('0x3'));var express=require(_0xe8ac('0x4'));var router=express[_0xe8ac('0x5')]();var auth=require(_0xe8ac('0x6'));var interaction=require(_0xe8ac('0x7'));var config=require(_0xe8ac('0x8'));var controller=require(_0xe8ac('0x9'));router[_0xe8ac('0xa')]('/',auth[_0xe8ac('0xb')](),controller[_0xe8ac('0xc')]);router[_0xe8ac('0xa')]('/:id',auth[_0xe8ac('0xb')](),controller[_0xe8ac('0xd')]);router['post']('/',auth['isAuthenticated'](),controller[_0xe8ac('0xe')]);router['put'](_0xe8ac('0xf'),auth[_0xe8ac('0xb')](),controller[_0xe8ac('0x10')]);router[_0xe8ac('0x11')](_0xe8ac('0xf'),auth[_0xe8ac('0xb')](),controller['destroy']);module[_0xe8ac('0x12')]=router; \ No newline at end of file diff --git a/server/api/intSalesforceField/intSalesforceField.attributes.js b/server/api/intSalesforceField/intSalesforceField.attributes.js index c42c597..b4797c7 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 _0x5807=['customVariable','STRING','exports','ENUM','string','variable'];(function(_0x47c902,_0x220fd2){var _0x1ad6a0=function(_0xf9fdb0){while(--_0xf9fdb0){_0x47c902['push'](_0x47c902['shift']());}};_0x1ad6a0(++_0x220fd2);}(_0x5807,0x1e8));var _0x7580=function(_0x65c50e,_0x1aa926){_0x65c50e=_0x65c50e-0x0;var _0x4573e7=_0x5807[_0x65c50e];return _0x4573e7;};'use strict';var Sequelize=require('sequelize');module[_0x7580('0x0')]={'type':{'type':Sequelize[_0x7580('0x1')](_0x7580('0x2'),_0x7580('0x3'),_0x7580('0x4'),'keyValue'),'defaultValue':'string'},'content':{'type':Sequelize['STRING']},'key':{'type':Sequelize[_0x7580('0x5')]},'keyType':{'type':Sequelize[_0x7580('0x1')](_0x7580('0x2'),_0x7580('0x3'),_0x7580('0x4'))},'keyContent':{'type':Sequelize[_0x7580('0x5')]},'idField':{'type':Sequelize[_0x7580('0x5')]},'variableName':{'type':Sequelize[_0x7580('0x5')]}}; \ No newline at end of file +var _0x7841=['ENUM','string','customVariable','keyValue','STRING','variable','sequelize','exports'];(function(_0x5c4880,_0x5a9619){var _0x17257a=function(_0x30197d){while(--_0x30197d){_0x5c4880['push'](_0x5c4880['shift']());}};_0x17257a(++_0x5a9619);}(_0x7841,0x196));var _0x1784=function(_0x19e57f,_0x4ae750){_0x19e57f=_0x19e57f-0x0;var _0x469556=_0x7841[_0x19e57f];return _0x469556;};'use strict';var Sequelize=require(_0x1784('0x0'));module[_0x1784('0x1')]={'type':{'type':Sequelize[_0x1784('0x2')](_0x1784('0x3'),'variable',_0x1784('0x4'),_0x1784('0x5')),'defaultValue':_0x1784('0x3')},'content':{'type':Sequelize['STRING']},'key':{'type':Sequelize[_0x1784('0x6')]},'keyType':{'type':Sequelize[_0x1784('0x2')](_0x1784('0x3'),_0x1784('0x7'),_0x1784('0x4'))},'keyContent':{'type':Sequelize[_0x1784('0x6')]},'idField':{'type':Sequelize[_0x1784('0x6')]},'variableName':{'type':Sequelize[_0x1784('0x6')]}}; \ No newline at end of file diff --git a/server/api/intSalesforceField/intSalesforceField.controller.js b/server/api/intSalesforceField/intSalesforceField.controller.js index b437912..2f00770 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(_0x5aecb9,_0x431f00){var _0x2bac52=function(_0x44076f){while(--_0x44076f){_0x5aecb9['push'](_0x5aecb9['shift']());}};_0x2bac52(++_0x431f00);}(_0x2ef3,0xba));var _0x32ef=function(_0x2f537d,_0x1f5130){_0x2f537d=_0x2f537d-0x0;var _0x3bdb83=_0x2ef3[_0x2f537d];return _0x3bdb83;};'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 _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(_0x5a84d1,_0x4a330f){var _0x4b656c=function(_0x3477f7){while(--_0x3477f7){_0x5a84d1['push'](_0x5a84d1['shift']());}};_0x4b656c(++_0x4a330f);}(_0x2ef3,0xba));var _0x32ef=function(_0x1e65e2,_0x125372){_0x1e65e2=_0x1e65e2-0x0;var _0x138998=_0x2ef3[_0x1e65e2];return _0x138998;};'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 diff --git a/server/api/intSalesforceField/intSalesforceField.model.js b/server/api/intSalesforceField/intSalesforceField.model.js index 28dfbdf..74b723e 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 _0x11a6=['api','moment','bluebird','request-promise','path','rimraf','../../config/environment','exports','define','int_salesforce_fields','salesforce_unique_index','FieldId','lodash','util','../../config/logger'];(function(_0x5a9c0c,_0x4ec485){var _0x53c77d=function(_0x1cf384){while(--_0x1cf384){_0x5a9c0c['push'](_0x5a9c0c['shift']());}};_0x53c77d(++_0x4ec485);}(_0x11a6,0xfc));var _0x611a=function(_0x3e52dc,_0x24306f){_0x3e52dc=_0x3e52dc-0x0;var _0x6061fa=_0x11a6[_0x3e52dc];return _0x6061fa;};'use strict';var _=require(_0x611a('0x0'));var util=require(_0x611a('0x1'));var logger=require(_0x611a('0x2'))(_0x611a('0x3'));var moment=require(_0x611a('0x4'));var BPromise=require(_0x611a('0x5'));var rp=require(_0x611a('0x6'));var fs=require('fs');var path=require(_0x611a('0x7'));var rimraf=require(_0x611a('0x8'));var config=require(_0x611a('0x9'));var attributes=require('./intSalesforceField.attributes');module[_0x611a('0xa')]=function(_0x43fb50,_0x1a82c4){return _0x43fb50[_0x611a('0xb')]('SalesforceField',attributes,{'tableName':_0x611a('0xc'),'paranoid':![],'indexes':[{'name':_0x611a('0xd'),'fields':['idField',_0x611a('0xe')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0x2706=['int_salesforce_fields','salesforce_unique_index','idField','FieldId','lodash','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./intSalesforceField.attributes','exports','define','SalesforceField'];(function(_0x3a1769,_0x22369a){var _0x486817=function(_0x3e26fb){while(--_0x3e26fb){_0x3a1769['push'](_0x3a1769['shift']());}};_0x486817(++_0x22369a);}(_0x2706,0x1b4));var _0x6270=function(_0x418eaf,_0x436e5e){_0x418eaf=_0x418eaf-0x0;var _0x4a7b80=_0x2706[_0x418eaf];return _0x4a7b80;};'use strict';var _=require(_0x6270('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x6270('0x1'));var moment=require(_0x6270('0x2'));var BPromise=require(_0x6270('0x3'));var rp=require(_0x6270('0x4'));var fs=require('fs');var path=require(_0x6270('0x5'));var rimraf=require(_0x6270('0x6'));var config=require(_0x6270('0x7'));var attributes=require(_0x6270('0x8'));module[_0x6270('0x9')]=function(_0x315886,_0x28691e){return _0x315886[_0x6270('0xa')](_0x6270('0xb'),attributes,{'tableName':_0x6270('0xc'),'paranoid':![],'indexes':[{'name':_0x6270('0xd'),'fields':[_0x6270('0xe'),_0x6270('0xf')],'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 f1f27bf..33cd504 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 _0xd8b0=['../../mysqldb','../../config/utils','../../config/logger','rpc','client','http','request','then','info','SalesforceField,\x20%s,\x20%s','request\x20sent','debug','SalesforceField,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','util','ioredis'];(function(_0x2e986d,_0x4b6b63){var _0x351c79=function(_0xf178c7){while(--_0xf178c7){_0x2e986d['push'](_0x2e986d['shift']());}};_0x351c79(++_0x4b6b63);}(_0xd8b0,0xad));var _0x0d8b=function(_0x122ef9,_0x451d2a){_0x122ef9=_0x122ef9-0x0;var _0x42fba0=_0xd8b0[_0x122ef9];return _0x42fba0;};'use strict';var _=require(_0x0d8b('0x0'));var util=require(_0x0d8b('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x0d8b('0x2'));var db=require(_0x0d8b('0x3'))['db'];var utils=require(_0x0d8b('0x4'));var logger=require(_0x0d8b('0x5'))(_0x0d8b('0x6'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x0d8b('0x7')][_0x0d8b('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x39f43a,_0x4a4470,_0x413284){return new BPromise(function(_0x284169,_0x58e4e2){return client[_0x0d8b('0x9')](_0x39f43a,_0x413284)[_0x0d8b('0xa')](function(_0x3b027f){logger[_0x0d8b('0xb')](_0x0d8b('0xc'),_0x4a4470,_0x0d8b('0xd'));logger[_0x0d8b('0xe')](_0x0d8b('0xf'),_0x4a4470,'request\x20sent',JSON[_0x0d8b('0x10')](_0x3b027f));if(_0x3b027f['error']){if(_0x3b027f[_0x0d8b('0x11')][_0x0d8b('0x12')]===0x1f4){logger[_0x0d8b('0x11')](_0x0d8b('0xc'),_0x4a4470,_0x3b027f[_0x0d8b('0x11')][_0x0d8b('0x13')]);return _0x58e4e2(_0x3b027f[_0x0d8b('0x11')][_0x0d8b('0x13')]);}logger[_0x0d8b('0x11')](_0x0d8b('0xc'),_0x4a4470,_0x3b027f[_0x0d8b('0x11')][_0x0d8b('0x13')]);return _0x284169(_0x3b027f[_0x0d8b('0x11')][_0x0d8b('0x13')]);}else{logger['info'](_0x0d8b('0xc'),_0x4a4470,_0x0d8b('0xd'));_0x284169(_0x3b027f[_0x0d8b('0x14')][_0x0d8b('0x13')]);}})[_0x0d8b('0x15')](function(_0x5cd485){logger[_0x0d8b('0x11')](_0x0d8b('0xc'),_0x4a4470,_0x5cd485);_0x58e4e2(_0x5cd485);});});} \ No newline at end of file +var _0x750a=['error','code','SalesforceField,\x20%s,\x20%s','message','catch','util','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','info','request\x20sent','debug','stringify'];(function(_0x3e06be,_0x2459ce){var _0x9d4c4=function(_0x2d76e9){while(--_0x2d76e9){_0x3e06be['push'](_0x3e06be['shift']());}};_0x9d4c4(++_0x2459ce);}(_0x750a,0x140));var _0xa750=function(_0x1fbf49,_0x29bd7b){_0x1fbf49=_0x1fbf49-0x0;var _0x4ce84f=_0x750a[_0x1fbf49];return _0x4ce84f;};'use strict';var _=require('lodash');var util=require(_0xa750('0x0'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0xa750('0x1'));var fs=require('fs');var Redis=require(_0xa750('0x2'));var db=require(_0xa750('0x3'))['db'];var utils=require(_0xa750('0x4'));var logger=require(_0xa750('0x5'))(_0xa750('0x6'));var config=require(_0xa750('0x7'));var jayson=require(_0xa750('0x8'));var client=jayson[_0xa750('0x9')][_0xa750('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x197299,_0x1ae455,_0x3d7c43){return new BPromise(function(_0x47a4dd,_0x53f2cb){return client[_0xa750('0xb')](_0x197299,_0x3d7c43)['then'](function(_0x4458b1){logger[_0xa750('0xc')]('SalesforceField,\x20%s,\x20%s',_0x1ae455,_0xa750('0xd'));logger[_0xa750('0xe')]('SalesforceField,\x20%s,\x20%s,\x20%s',_0x1ae455,'request\x20sent',JSON[_0xa750('0xf')](_0x4458b1));if(_0x4458b1['error']){if(_0x4458b1[_0xa750('0x10')][_0xa750('0x11')]===0x1f4){logger['error'](_0xa750('0x12'),_0x1ae455,_0x4458b1[_0xa750('0x10')][_0xa750('0x13')]);return _0x53f2cb(_0x4458b1['error'][_0xa750('0x13')]);}logger[_0xa750('0x10')](_0xa750('0x12'),_0x1ae455,_0x4458b1[_0xa750('0x10')][_0xa750('0x13')]);return _0x47a4dd(_0x4458b1[_0xa750('0x10')]['message']);}else{logger[_0xa750('0xc')](_0xa750('0x12'),_0x1ae455,_0xa750('0xd'));_0x47a4dd(_0x4458b1['result'][_0xa750('0x13')]);}})[_0xa750('0x14')](function(_0x58639b){logger['error'](_0xa750('0x12'),_0x1ae455,_0x58639b);_0x53f2cb(_0x58639b);});});} \ No newline at end of file diff --git a/server/api/intServicenowAccount/index.js b/server/api/intServicenowAccount/index.js index 5019c9d..e6307c9 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 _0x63be=['./intServicenowAccount.controller','isAuthenticated','index','get','show','/:id/configurations','getConfigurations','getFields','post','create','addConfiguration','put','/:id','update','delete','destroy','exports','path','connect-timeout','Router','../../components/auth/service','../../components/interaction/service'];(function(_0x17d9e3,_0x1f969c){var _0x14192d=function(_0x159745){while(--_0x159745){_0x17d9e3['push'](_0x17d9e3['shift']());}};_0x14192d(++_0x1f969c);}(_0x63be,0xd7));var _0xe63b=function(_0x4916d5,_0x2f83d4){_0x4916d5=_0x4916d5-0x0;var _0x406d38=_0x63be[_0x4916d5];return _0x406d38;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0xe63b('0x0'));var timeout=require(_0xe63b('0x1'));var express=require('express');var router=express[_0xe63b('0x2')]();var auth=require(_0xe63b('0x3'));var interaction=require(_0xe63b('0x4'));var config=require('../../config/environment');var controller=require(_0xe63b('0x5'));router['get']('/',auth[_0xe63b('0x6')](),controller[_0xe63b('0x7')]);router[_0xe63b('0x8')]('/:id',auth[_0xe63b('0x6')](),controller[_0xe63b('0x9')]);router[_0xe63b('0x8')](_0xe63b('0xa'),auth[_0xe63b('0x6')](),controller[_0xe63b('0xb')]);router[_0xe63b('0x8')]('/:id/fields',auth[_0xe63b('0x6')](),controller[_0xe63b('0xc')]);router[_0xe63b('0xd')]('/',auth[_0xe63b('0x6')](),controller[_0xe63b('0xe')]);router[_0xe63b('0xd')]('/:id/configurations',auth[_0xe63b('0x6')](),controller[_0xe63b('0xf')]);router[_0xe63b('0x10')](_0xe63b('0x11'),auth[_0xe63b('0x6')](),controller[_0xe63b('0x12')]);router[_0xe63b('0x13')](_0xe63b('0x11'),auth[_0xe63b('0x6')](),controller[_0xe63b('0x14')]);module[_0xe63b('0x15')]=router; \ No newline at end of file +var _0x661c=['/:id','show','/:id/configurations','getConfigurations','/:id/fields','getFields','post','create','addConfiguration','put','update','delete','destroy','exports','multer','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./intServicenowAccount.controller','get','isAuthenticated'];(function(_0x4c1f48,_0xa9a87a){var _0x39e7a6=function(_0x31a892){while(--_0x31a892){_0x4c1f48['push'](_0x4c1f48['shift']());}};_0x39e7a6(++_0xa9a87a);}(_0x661c,0x122));var _0xc661=function(_0x500419,_0x549162){_0x500419=_0x500419-0x0;var _0x241c1a=_0x661c[_0x500419];return _0x241c1a;};'use strict';var multer=require(_0xc661('0x0'));var util=require('util');var path=require('path');var timeout=require(_0xc661('0x1'));var express=require('express');var router=express[_0xc661('0x2')]();var auth=require(_0xc661('0x3'));var interaction=require(_0xc661('0x4'));var config=require(_0xc661('0x5'));var controller=require(_0xc661('0x6'));router[_0xc661('0x7')]('/',auth[_0xc661('0x8')](),controller['index']);router['get'](_0xc661('0x9'),auth['isAuthenticated'](),controller[_0xc661('0xa')]);router['get'](_0xc661('0xb'),auth['isAuthenticated'](),controller[_0xc661('0xc')]);router[_0xc661('0x7')](_0xc661('0xd'),auth[_0xc661('0x8')](),controller[_0xc661('0xe')]);router[_0xc661('0xf')]('/',auth['isAuthenticated'](),controller[_0xc661('0x10')]);router['post'](_0xc661('0xb'),auth[_0xc661('0x8')](),controller[_0xc661('0x11')]);router[_0xc661('0x12')]('/:id',auth[_0xc661('0x8')](),controller[_0xc661('0x13')]);router[_0xc661('0x14')](_0xc661('0x9'),auth['isAuthenticated'](),controller[_0xc661('0x15')]);module[_0xc661('0x16')]=router; \ No newline at end of file diff --git a/server/api/intServicenowAccount/intServicenowAccount.attributes.js b/server/api/intServicenowAccount/intServicenowAccount.attributes.js index 80aba1d..8b35c36 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 _0x2744=['username','remoteUri','sequelize','STRING'];(function(_0x590515,_0x46f0a0){var _0x16d834=function(_0x2c6fa4){while(--_0x2c6fa4){_0x590515['push'](_0x590515['shift']());}};_0x16d834(++_0x46f0a0);}(_0x2744,0x11a));var _0x4274=function(_0x5aa3f4,_0xe6b94b){_0x5aa3f4=_0x5aa3f4-0x0;var _0x5dfc90=_0x2744[_0x5aa3f4];return _0x5dfc90;};'use strict';var Sequelize=require(_0x4274('0x0'));module['exports']={'name':{'type':Sequelize[_0x4274('0x1')]},'description':{'type':Sequelize[_0x4274('0x1')]},'username':{'type':Sequelize[_0x4274('0x1')],'unique':_0x4274('0x2')},'password':{'type':Sequelize[_0x4274('0x1')]},'email':{'type':Sequelize[_0x4274('0x1')]},'remoteUri':{'type':Sequelize['STRING'],'unique':_0x4274('0x3')},'serverUrl':{'type':Sequelize[_0x4274('0x1')]}}; \ No newline at end of file +var _0xe3bc=['STRING','username','remoteUri'];(function(_0x18d238,_0x5ab60d){var _0x2b2fd9=function(_0x4034fc){while(--_0x4034fc){_0x18d238['push'](_0x18d238['shift']());}};_0x2b2fd9(++_0x5ab60d);}(_0xe3bc,0x14a));var _0xce3b=function(_0x5669c3,_0x193f91){_0x5669c3=_0x5669c3-0x0;var _0x45da4a=_0xe3bc[_0x5669c3];return _0x45da4a;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0xce3b('0x0')]},'username':{'type':Sequelize[_0xce3b('0x0')],'unique':_0xce3b('0x1')},'password':{'type':Sequelize['STRING']},'email':{'type':Sequelize[_0xce3b('0x0')]},'remoteUri':{'type':Sequelize['STRING'],'unique':_0xce3b('0x2')},'serverUrl':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/intServicenowAccount/intServicenowAccount.controller.js b/server/api/intServicenowAccount/intServicenowAccount.controller.js index 0f55128..04cc8c2 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 _0xe54c=['options','includeAll','include','findAll','rows','catch','keys','find','create','body','params','destroy','getConfigurations','findOne','addConfiguration','AccountId','Subjects','Descriptions','ServicenowConfiguration','ServicenowField','getFields','made_sla','hold_reason','knowledge','subcategory','close_code','notify','incident_state','severity','category','watch_list','resolved_by','sys_updated_by','opened_by','user_input','sys_created_on','sys_domain','state','sys_created_by','calendar_stc','closed_at','impact','active','work_notes_list','priority','sys_domain_path','time_worked','expected_start','opened_at','business_duration','work_end','reopened_time','resolved_at','approval_set','work_notes','short_description','correlation_display','business_stc','additional_assignee_list','calendar_duration','close_notes','closed_by','follow_up','parent_incident','sys_id','contact_type','reopened_by','urgency','problem_id','company','activity_due','assigned_to','comments','sla_due','comments_and_work_notes','sys_mod_count','reopen_count','sys_tags','escalation','correlation_id','password','email','remoteUri','serverUrl','slice','substring','lastIndexOf','format','%s/api/now/table/','username','GET','incident?sysparm_display_value=all','log','incident\x20table\x20objects','assign','remove','includes','internalType','label','push','all','forEach','concat','ServiceNow\x20error:\x20','statusCode','send','Wrong\x20credentials','boolean','True','true','False','false','sys_choice?sysparm_query=name=incident^element=','html-pdf','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','ejs','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../mysqldb','jayson/promise','client','test','Sequelize','ValidationError','The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.','then','request\x20sent','debug','ServicenowAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','ServicenowAccount,\x20%s,\x20%s','sendStatus','end','status','json','count','offset','limit','set','Content-Range','apply','reject','update','index','map','ServicenowAccount','rawAttributes','type','model','name','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL'];(function(_0x3a0b3e,_0x12f96b){var _0x1d08a3=function(_0x21f643){while(--_0x21f643){_0x3a0b3e['push'](_0x3a0b3e['shift']());}};_0x1d08a3(++_0x12f96b);}(_0xe54c,0x71));var _0xce54=function(_0x1865d4,_0x569a81){_0x1865d4=_0x1865d4-0x0;var _0x1f0e1c=_0xe54c[_0x1865d4];return _0x1f0e1c;};'use strict';var pdf=require(_0xce54('0x0'));var emlformat=require('eml-format');var rimraf=require(_0xce54('0x1'));var zipdir=require(_0xce54('0x2'));var jsonpatch=require(_0xce54('0x3'));var rp=require(_0xce54('0x4'));var moment=require(_0xce54('0x5'));var BPromise=require('bluebird');var Mustache=require(_0xce54('0x6'));var util=require(_0xce54('0x7'));var path=require(_0xce54('0x8'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0xce54('0x9'));var fs=require('fs');var _=require(_0xce54('0xa'));var squel=require(_0xce54('0xb'));var crypto=require(_0xce54('0xc'));var jsforce=require(_0xce54('0xd'));var deskjs=require(_0xce54('0xe'));var toCsv=require(_0xce54('0xf'));var querystring=require(_0xce54('0x10'));var Papa=require('papaparse');var Redis=require(_0xce54('0x11'));var authService=require(_0xce54('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0xce54('0x13'));var hardwareService=require(_0xce54('0x14'));var logger=require('../../config/logger')(_0xce54('0x15'));var utils=require(_0xce54('0x16'));var config=require(_0xce54('0x17'));var db=require(_0xce54('0x18'))['db'];var integrations=require('../../components/integrations/configuration');var jayson=require(_0xce54('0x19'));var client=jayson[_0xce54('0x1a')]['http']({'port':0x232a});function checkPasswordPattern(_0x39151c,_0x279a04,_0x1cbf66){if(_0x1cbf66){var _0x30ce02=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x30ce02[_0xce54('0x1b')](_0x279a04)){return _0x39151c;}else{throw new db[(_0xce54('0x1c'))][(_0xce54('0x1d'))](_0xce54('0x1e'));}}else{return _0x39151c;}}function respondWithRpcPromise(_0x5d70fb,_0x1ccdfb,_0x58fd0c,_0x1d9f40){return new BPromise(function(_0x3c149b,_0x58b372){var _0x1f2bec=_0x1d9f40||client;return _0x1f2bec['request'](_0x5d70fb,_0x58fd0c)[_0xce54('0x1f')](function(_0x4c2814){logger['info']('ServicenowAccount,\x20%s,\x20%s',_0x1ccdfb,_0xce54('0x20'));logger[_0xce54('0x21')](_0xce54('0x22'),_0x1ccdfb,_0xce54('0x20'),JSON[_0xce54('0x23')](_0x4c2814));if(_0x4c2814[_0xce54('0x24')]){if(_0x4c2814[_0xce54('0x24')][_0xce54('0x25')]===0x1f4){logger[_0xce54('0x24')]('ServicenowAccount,\x20%s,\x20%s',_0x1ccdfb,_0x4c2814['error']['message']);return _0x58b372(_0x4c2814['error'][_0xce54('0x26')]);}logger[_0xce54('0x24')]('ServicenowAccount,\x20%s,\x20%s',_0x1ccdfb,_0x4c2814[_0xce54('0x24')][_0xce54('0x26')]);return _0x3c149b(_0x4c2814[_0xce54('0x24')][_0xce54('0x26')]);}else{logger[_0xce54('0x27')]('ServicenowAccount,\x20%s,\x20%s',_0x1ccdfb,_0xce54('0x20'));_0x3c149b(_0x4c2814[_0xce54('0x28')][_0xce54('0x26')]);}})['catch'](function(_0x5cc839){logger['error'](_0xce54('0x29'),_0x1ccdfb,_0x5cc839);_0x58b372(_0x5cc839);});});}function respondWithStatusCode(_0x292606,_0x48a582){_0x48a582=_0x48a582||0xcc;return function(_0x394b0f){if(_0x394b0f){return _0x292606[_0xce54('0x2a')](_0x48a582);}return _0x292606['status'](_0x48a582)[_0xce54('0x2b')]();};}function respondWithResult(_0xf36982,_0x2d0257){_0x2d0257=_0x2d0257||0xc8;return function(_0x27a5ea){if(_0x27a5ea){return _0xf36982[_0xce54('0x2c')](_0x2d0257)[_0xce54('0x2d')](_0x27a5ea);}};}function respondWithFilteredResult(_0x37de35,_0x5a37f3){return function(_0x34db79){if(_0x34db79){var _0x5832ff=_0x34db79[_0xce54('0x2e')],_0xc17568=_0x5a37f3[_0xce54('0x2f')],_0x3546a7=_0x5a37f3[_0xce54('0x2f')]+_0x5a37f3[_0xce54('0x30')],_0x38f7bd;if(_0x3546a7>=_0x5832ff){_0x3546a7=_0x5832ff;_0x38f7bd=0xc8;}else{_0x38f7bd=0xce;}_0x37de35[_0xce54('0x2c')](_0x38f7bd);return _0x37de35[_0xce54('0x31')](_0xce54('0x32'),_0xc17568+'-'+_0x3546a7+'/'+_0x5832ff)[_0xce54('0x2d')](_0x34db79);}return null;};}function patchUpdates(_0x26b463){return function(_0x28e672){try{jsonpatch[_0xce54('0x33')](_0x28e672,_0x26b463,!![]);}catch(_0x129b5f){return BPromise[_0xce54('0x34')](_0x129b5f);}return _0x28e672['save']();};}function saveUpdates(_0x2d3ab3,_0x11f60d){return function(_0x3c5321){if(_0x3c5321){return _0x3c5321[_0xce54('0x35')](_0x2d3ab3)[_0xce54('0x1f')](function(_0xeb25ee){return _0xeb25ee;});}return null;};}function removeEntity(_0xd880dd,_0x55635f){return function(_0x19e3f2){if(_0x19e3f2){return _0x19e3f2['destroy']()['then'](function(){_0xd880dd[_0xce54('0x2c')](0xcc)[_0xce54('0x2b')]();});}};}function handleEntityNotFound(_0xed69f2,_0x3f7dcb){return function(_0x4cd3c6){if(!_0x4cd3c6){_0xed69f2['sendStatus'](0x194);}return _0x4cd3c6;};}function handleError(_0x18a389,_0x22c772){_0x22c772=_0x22c772||0x1f4;return function(_0x1d0e88){logger[_0xce54('0x24')](_0x1d0e88['stack']);if(_0x1d0e88['name']){delete _0x1d0e88['name'];}_0x18a389['status'](_0x22c772)['send'](_0x1d0e88);};}exports[_0xce54('0x36')]=function(_0x1e8c16,_0x3ebe69){var _0x451fa1={},_0x1032a8={},_0xce87e2={'count':0x0,'rows':[]};var _0x3bb74b=_[_0xce54('0x37')](db[_0xce54('0x38')][_0xce54('0x39')],function(_0x32b910){return{'name':_0x32b910['fieldName'],'type':_0x32b910[_0xce54('0x3a')]['key']};});_0x1032a8[_0xce54('0x3b')]=_['map'](_0x3bb74b,_0xce54('0x3c'));_0x1032a8['query']=_['keys'](_0x1e8c16[_0xce54('0x3d')]);_0x1032a8[_0xce54('0x3e')]=_[_0xce54('0x3f')](_0x1032a8[_0xce54('0x3b')],_0x1032a8[_0xce54('0x3d')]);_0x451fa1[_0xce54('0x40')]=_[_0xce54('0x3f')](_0x1032a8[_0xce54('0x3b')],qs[_0xce54('0x41')](_0x1e8c16['query'][_0xce54('0x41')]));_0x451fa1[_0xce54('0x40')]=_0x451fa1[_0xce54('0x40')][_0xce54('0x42')]?_0x451fa1['attributes']:_0x1032a8[_0xce54('0x3b')];if(!_0x1e8c16[_0xce54('0x3d')][_0xce54('0x43')](_0xce54('0x44'))){_0x451fa1[_0xce54('0x30')]=qs['limit'](_0x1e8c16[_0xce54('0x3d')][_0xce54('0x30')]);_0x451fa1[_0xce54('0x2f')]=qs[_0xce54('0x2f')](_0x1e8c16[_0xce54('0x3d')][_0xce54('0x2f')]);}_0x451fa1[_0xce54('0x45')]=qs[_0xce54('0x46')](_0x1e8c16[_0xce54('0x3d')]['sort']);_0x451fa1[_0xce54('0x47')]=qs['filters'](_[_0xce54('0x48')](_0x1e8c16[_0xce54('0x3d')],_0x1032a8[_0xce54('0x3e')]));if(_0x1e8c16['query'][_0xce54('0x49')]){_0x451fa1['where']=_[_0xce54('0x4a')](_0x451fa1[_0xce54('0x47')],{'$or':_['map'](_0x3bb74b,function(_0xeff16f){if(_0xeff16f[_0xce54('0x3a')]!==_0xce54('0x4b')){var _0x2bd350={};_0x2bd350[_0xeff16f[_0xce54('0x3c')]]={'$like':'%'+_0x1e8c16[_0xce54('0x3d')]['filter']+'%'};return _0x2bd350;}})});}_0x451fa1=_[_0xce54('0x4a')]({},_0x451fa1,_0x1e8c16[_0xce54('0x4c')]);var _0x55d29c={'where':_0x451fa1[_0xce54('0x47')]};return db[_0xce54('0x38')][_0xce54('0x2e')](_0x55d29c)[_0xce54('0x1f')](function(_0x92b93e){_0xce87e2[_0xce54('0x2e')]=_0x92b93e;if(_0x1e8c16['query'][_0xce54('0x4d')]){_0x451fa1[_0xce54('0x4e')]=[{'all':!![]}];}return db[_0xce54('0x38')][_0xce54('0x4f')](_0x451fa1);})[_0xce54('0x1f')](function(_0x1b233c){_0xce87e2[_0xce54('0x50')]=_0x1b233c;return _0xce87e2;})[_0xce54('0x1f')](respondWithFilteredResult(_0x3ebe69,_0x451fa1))[_0xce54('0x51')](handleError(_0x3ebe69,null));};exports['show']=function(_0x3f2d1e,_0x7fbc9){var _0x4b7a5c={'raw':![],'where':{'id':_0x3f2d1e['params']['id']}},_0x3757ef={};_0x3757ef[_0xce54('0x3b')]=_[_0xce54('0x52')](db[_0xce54('0x38')][_0xce54('0x39')]);_0x3757ef[_0xce54('0x3d')]=_[_0xce54('0x52')](_0x3f2d1e['query']);_0x3757ef[_0xce54('0x3e')]=_['intersection'](_0x3757ef[_0xce54('0x3b')],_0x3757ef[_0xce54('0x3d')]);_0x4b7a5c[_0xce54('0x40')]=_[_0xce54('0x3f')](_0x3757ef[_0xce54('0x3b')],qs[_0xce54('0x41')](_0x3f2d1e['query'][_0xce54('0x41')]));_0x4b7a5c[_0xce54('0x40')]=_0x4b7a5c[_0xce54('0x40')][_0xce54('0x42')]?_0x4b7a5c[_0xce54('0x40')]:_0x3757ef['model'];if(_0x3f2d1e['query'][_0xce54('0x4d')]){_0x4b7a5c[_0xce54('0x4e')]=[{'all':!![]}];}_0x4b7a5c=_[_0xce54('0x4a')]({},_0x4b7a5c,_0x3f2d1e[_0xce54('0x4c')]);return db[_0xce54('0x38')][_0xce54('0x53')](_0x4b7a5c)[_0xce54('0x1f')](handleEntityNotFound(_0x7fbc9,null))[_0xce54('0x1f')](respondWithResult(_0x7fbc9,null))[_0xce54('0x51')](handleError(_0x7fbc9,null));};exports['create']=function(_0x2108ce,_0x35cfc7){return db[_0xce54('0x38')][_0xce54('0x54')](_0x2108ce[_0xce54('0x55')],{})[_0xce54('0x1f')](respondWithResult(_0x35cfc7,0xc9))[_0xce54('0x51')](handleError(_0x35cfc7,null));};exports[_0xce54('0x35')]=function(_0x5ee83c,_0x4aa439){if(_0x5ee83c[_0xce54('0x55')]['id']){delete _0x5ee83c[_0xce54('0x55')]['id'];}return db[_0xce54('0x38')]['find']({'where':{'id':_0x5ee83c[_0xce54('0x56')]['id']}})['then'](handleEntityNotFound(_0x4aa439,null))[_0xce54('0x1f')](saveUpdates(_0x5ee83c[_0xce54('0x55')],null))[_0xce54('0x1f')](respondWithResult(_0x4aa439,null))[_0xce54('0x51')](handleError(_0x4aa439,null));};exports[_0xce54('0x57')]=function(_0x768c51,_0x2ce449){return db[_0xce54('0x38')][_0xce54('0x53')]({'where':{'id':_0x768c51[_0xce54('0x56')]['id']}})[_0xce54('0x1f')](handleEntityNotFound(_0x2ce449,null))[_0xce54('0x1f')](removeEntity(_0x2ce449,null))[_0xce54('0x51')](handleError(_0x2ce449,null));};exports[_0xce54('0x58')]=function(_0x44a1ca,_0x7015d0,_0x9cec48){var _0x4647d1={};var _0x2c3cef={};var _0x2cd2d2;var _0x5af5f8;return db['ServicenowAccount'][_0xce54('0x59')]({'where':{'id':_0x44a1ca['params']['id']}})[_0xce54('0x1f')](handleEntityNotFound(_0x7015d0,null))[_0xce54('0x1f')](function(_0x4ac2ea){if(_0x4ac2ea){_0x2cd2d2=_0x4ac2ea;_0x2c3cef['model']=_[_0xce54('0x52')](db['ServicenowConfiguration']['rawAttributes']);_0x2c3cef['query']=_[_0xce54('0x52')](_0x44a1ca[_0xce54('0x3d')]);_0x2c3cef['filters']=_[_0xce54('0x3f')](_0x2c3cef['model'],_0x2c3cef[_0xce54('0x3d')]);_0x4647d1[_0xce54('0x40')]=_[_0xce54('0x3f')](_0x2c3cef['model'],qs[_0xce54('0x41')](_0x44a1ca[_0xce54('0x3d')]['fields']));_0x4647d1[_0xce54('0x40')]=_0x4647d1[_0xce54('0x40')][_0xce54('0x42')]?_0x4647d1[_0xce54('0x40')]:_0x2c3cef[_0xce54('0x3b')];_0x4647d1[_0xce54('0x45')]=qs[_0xce54('0x46')](_0x44a1ca[_0xce54('0x3d')]['sort']);_0x4647d1[_0xce54('0x47')]=qs[_0xce54('0x3e')](_['pick'](_0x44a1ca['query'],_0x2c3cef[_0xce54('0x3e')]));if(_0x44a1ca[_0xce54('0x3d')][_0xce54('0x49')]){_0x4647d1[_0xce54('0x47')]=_[_0xce54('0x4a')](_0x4647d1[_0xce54('0x47')],{'$or':_[_0xce54('0x37')](_0x4647d1['attributes'],function(_0x43b8e3){var _0xdbfe27={};_0xdbfe27[_0x43b8e3]={'$like':'%'+_0x44a1ca[_0xce54('0x3d')][_0xce54('0x49')]+'%'};return _0xdbfe27;})});}_0x4647d1=_[_0xce54('0x4a')]({},_0x4647d1,_0x44a1ca[_0xce54('0x4c')]);return _0x2cd2d2[_0xce54('0x58')](_0x4647d1);}})[_0xce54('0x1f')](function(_0x39891a){if(_0x39891a){_0x5af5f8=_0x39891a[_0xce54('0x42')];if(!_0x44a1ca[_0xce54('0x3d')][_0xce54('0x43')](_0xce54('0x44'))){_0x4647d1[_0xce54('0x30')]=qs[_0xce54('0x30')](_0x44a1ca[_0xce54('0x3d')][_0xce54('0x30')]);_0x4647d1['offset']=qs[_0xce54('0x2f')](_0x44a1ca['query'][_0xce54('0x2f')]);}return _0x2cd2d2[_0xce54('0x58')](_0x4647d1);}})[_0xce54('0x1f')](function(_0x49e6dd){if(_0x49e6dd){return _0x49e6dd?{'count':_0x5af5f8,'rows':_0x49e6dd}:null;}})[_0xce54('0x1f')](respondWithResult(_0x7015d0,null))[_0xce54('0x51')](handleError(_0x7015d0,null));};exports[_0xce54('0x5a')]=function(_0x1043a7,_0x1e4317,_0x25f2ed){if(_0x1043a7[_0xce54('0x55')]['id']){delete _0x1043a7['body']['id'];}return db[_0xce54('0x38')][_0xce54('0x59')]({'where':{'id':_0x1043a7[_0xce54('0x56')]['id']}})[_0xce54('0x1f')](handleEntityNotFound(_0x1e4317,null))[_0xce54('0x1f')](function(_0x19b155){if(_0x19b155){_0x1043a7[_0xce54('0x55')][_0xce54('0x5b')]=_0x19b155['id'];_0x1043a7[_0xce54('0x55')][_0xce54('0x5c')]=integrations['getSubjects'](_0x1043a7[_0xce54('0x55')]['channel'],_0x1043a7[_0xce54('0x55')][_0xce54('0x3a')]);_0x1043a7[_0xce54('0x55')][_0xce54('0x5d')]=integrations['getDescriptions'](_0x1043a7[_0xce54('0x55')]['channel'],_0x1043a7[_0xce54('0x55')][_0xce54('0x3a')]);return db[_0xce54('0x5e')][_0xce54('0x54')](_0x1043a7[_0xce54('0x55')],{'include':[{'model':db[_0xce54('0x5f')],'as':_0xce54('0x5c')},{'model':db[_0xce54('0x5f')],'as':_0xce54('0x5d')}]});}return null;})[_0xce54('0x1f')](respondWithResult(_0x1e4317,null))[_0xce54('0x51')](handleError(_0x1e4317,null));};exports[_0xce54('0x60')]=function(_0x3fb3a8,_0x36094f,_0x196494){var _0x2e1757=[_0xce54('0x61'),_0xce54('0x62'),_0xce54('0x63'),_0xce54('0x64'),_0xce54('0x65'),_0xce54('0x66'),_0xce54('0x67'),_0xce54('0x68'),_0xce54('0x69')];var _0x25cdff=['parent',_0xce54('0x61'),'caused_by',_0xce54('0x6a'),'upon_reject','sys_updated_on','child_incidents',_0xce54('0x62'),'approval_history','number',_0xce54('0x6b'),_0xce54('0x6c'),_0xce54('0x6d'),_0xce54('0x6e'),_0xce54('0x6f'),_0xce54('0x70'),_0xce54('0x71'),_0xce54('0x72'),_0xce54('0x63'),_0xce54('0x45'),_0xce54('0x73'),_0xce54('0x74'),'cmdb_ci','delivery_plan',_0xce54('0x75'),_0xce54('0x76'),_0xce54('0x77'),'business_service',_0xce54('0x78'),_0xce54('0x79'),'rfc',_0xce54('0x7a'),_0xce54('0x7b'),_0xce54('0x7c'),_0xce54('0x7d'),'group_list',_0xce54('0x7e'),_0xce54('0x7f'),_0xce54('0x80'),'caller_id',_0xce54('0x81'),_0xce54('0x64'),_0xce54('0x82'),_0xce54('0x83'),_0xce54('0x65'),_0xce54('0x84'),'delivery_task','work_start','assignment_group',_0xce54('0x85'),_0xce54('0x86'),'description',_0xce54('0x87'),_0xce54('0x66'),'sys_class_name',_0xce54('0x88'),_0xce54('0x89'),_0xce54('0x8a'),_0xce54('0x8b'),_0xce54('0x8c'),_0xce54('0x8d'),_0xce54('0x8e'),_0xce54('0x67'),_0xce54('0x8f'),_0xce54('0x90'),_0xce54('0x91'),'reassignment_count',_0xce54('0x92'),_0xce54('0x93'),_0xce54('0x68'),_0xce54('0x94'),_0xce54('0x95'),'approval',_0xce54('0x96'),'due_date',_0xce54('0x97'),_0xce54('0x98'),_0xce54('0x99'),_0xce54('0x9a'),'upon_approval',_0xce54('0x9b'),'location',_0xce54('0x69')];var _0x55c339='';var _0x4be6dc='';var _0x41ce23=[];var _0x5b2545='';var _0x17bcbb='';var _0x422d6e=[];var _0x5040c6='';var _0x1ada66='';var _0x404f8b={};var _0x13834e='';return db[_0xce54('0x38')][_0xce54('0x59')]({'where':{'id':_0x3fb3a8[_0xce54('0x56')]['id']},'attributes':['id','username',_0xce54('0x9c'),_0xce54('0x9d'),_0xce54('0x9e'),_0xce54('0x9f')]})[_0xce54('0x1f')](handleEntityNotFound(_0x36094f,null))['then'](function(_0xc2d118){if(_0xc2d118){_0x13834e=_0xc2d118[_0xce54('0x9e')];var _0x486690=_0x13834e[_0xce54('0xa0')](-0x1);if(_0x486690==='/'){_0x13834e=_0x13834e[_0xce54('0xa1')](0x0,_0x13834e[_0xce54('0xa2')](_0x486690));}_0x1ada66=util[_0xce54('0xa3')]('%s/api/now/doc/table/schema/',_0x13834e);_0x5040c6=util['format'](_0xce54('0xa4'),_0x13834e);_0x404f8b={'user':_0xc2d118[_0xce54('0xa5')],'pass':_0xc2d118[_0xce54('0x9c')]};var _0xcc6213={'method':_0xce54('0xa6'),'uri':_0x1ada66+_0xce54('0xa7'),'auth':_0x404f8b,'json':!![]};return rp(_0xcc6213);}})[_0xce54('0x1f')](function(_0x30b2df){if(_0x30b2df[_0xce54('0x28')]['length']>0x0){_0x55c339=_0x30b2df[_0xce54('0x28')];}console[_0xce54('0xa8')](_0xce54('0xa9'),_0x55c339);_0x422d6e=[];_0x4be6dc=Object[_0xce54('0xaa')]([],_0x55c339);_[_0xce54('0xab')](_0x4be6dc,function(_0x190e1a){return!_0x2e1757[_0xce54('0xac')](_0x190e1a[_0xce54('0x3c')]);});_0x4be6dc['forEach'](function(_0x35c0e4){var _0x12c0e9=createFieldObject(_0x5040c6,_0x404f8b,_0x35c0e4[_0xce54('0xad')],_0x35c0e4[_0xce54('0x3c')],_0x35c0e4[_0xce54('0xae')],![]);_0x422d6e[_0xce54('0xaf')](_0x12c0e9);});return Promise[_0xce54('0xb0')](_0x422d6e);})[_0xce54('0x1f')](function(_0x55cf05){_0x41ce23=_0x55cf05;_0x5b2545=Object[_0xce54('0xaa')]([],_0x55c339);console[_0xce54('0xa8')]('TCL:\x20_object',_0x55c339);_['remove'](_0x5b2545,function(_0x454008){return _0x25cdff[_0xce54('0xac')](_0x454008[_0xce54('0x3c')]);});console[_0xce54('0xa8')]('TCL:\x20exports.getEntityFields\x20->\x20_objectsCustom',_0x5b2545);_0x422d6e=[];_0x5b2545[_0xce54('0xb1')](function(_0x1d8daf){var _0x47d924=createFieldObject(_0x5040c6,_0x404f8b,_0x1d8daf[_0xce54('0xad')],_0x1d8daf[_0xce54('0x3c')],_0x1d8daf['label'],!![]);_0x422d6e[_0xce54('0xaf')](_0x47d924);});return Promise[_0xce54('0xb0')](_0x422d6e);})[_0xce54('0x1f')](function(_0x188a47){_0x17bcbb=_0x188a47;var _0x128144=_0x41ce23[_0xce54('0xb2')](_0x17bcbb);return{'count':_0x128144[_0xce54('0x42')],'rows':_0x128144};})[_0xce54('0x1f')](respondWithResult(_0x36094f,null))['catch'](function(_0x190136){console[_0xce54('0xa8')](_0xce54('0xb3')+_0x190136);var _0x657f6c=_0x3fb3a8[_0xce54('0x3d')]['test']?0x1f4:_0x190136[_0xce54('0xb4')]||0x1f4;logger[_0xce54('0x24')](_0x190136['stack']);delete _0x190136['name'];if(_0x657f6c===0x191){_0x657f6c=0x190;}_0x36094f[_0xce54('0x2c')](_0x657f6c)[_0xce54('0xb5')](_0x3fb3a8[_0xce54('0x3d')][_0xce54('0x1b')]?{'message':_0xce54('0xb6'),'statusCode':_0x190136['statusCode']}:_0x190136);});};function createFieldObject(_0x38f11c,_0x2cbea2,_0x3901e5,_0x4e4708,_0x2844d4,_0x31c906){return new Promise(function(_0x287879,_0x4c9713){var _0x2875ea={'id':_0x4e4708,'name':_0x2844d4,'custom':_0x31c906};if(_0x3901e5===_0xce54('0xb7')){_0x2875ea['options']=[{'name':_0xce54('0xb8'),'value':_0xce54('0xb9')},{'name':_0xce54('0xba'),'value':_0xce54('0xbb')}];_0x287879(_0x2875ea);}else{var _0x2d8427={'method':_0xce54('0xa6'),'uri':_0x38f11c+_0xce54('0xbc')+_0x4e4708,'auth':_0x2cbea2,'json':!![]};return rp(_0x2d8427)[_0xce54('0x1f')](function(_0x2936d7){var _0xc6e174=[];if(_0x2936d7['result']['length']>0x0){_0x2936d7[_0xce54('0x28')][_0xce54('0xb1')](function(_0x13bc5a){if(_0x13bc5a['inactive']===_0xce54('0xbb')){var _0x14be73={'name':_0x13bc5a['label'],'value':_0x13bc5a['value']};_0xc6e174[_0xce54('0xaf')](_0x14be73);}});}_0x2875ea[_0xce54('0x4c')]=_0xc6e174;if(_0x2875ea[_0xce54('0x4c')][_0xce54('0x42')]>0x0){_0x287879(_0x2875ea);}else{if(_0x31c906==![]){_0x287879();}else{_0x287879(_0x2875ea);}}});}});} \ No newline at end of file +var _0x7e9a=['all','log','TCL:\x20_object','concat','statusCode','Wrong\x20credentials','boolean','true','False','false','sys_choice?sysparm_query=name=incident^element=','value','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','ejs','squel','crypto','jsforce','desk.js','to-csv','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../components/integrations/configuration','jayson/promise','client','http','test','ValidationError','The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.','request','then','ServicenowAccount,\x20%s,\x20%s','request\x20sent','stringify','code','error','message','result','catch','sendStatus','end','json','count','offset','limit','status','set','reject','save','update','destroy','stack','name','send','index','map','ServicenowAccount','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','nolimit','sort','where','filter','VIRTUAL','options','includeAll','include','findAll','rows','show','rawAttributes','merge','find','create','body','params','getConfigurations','order','pick','addConfiguration','AccountId','Subjects','getSubjects','channel','Descriptions','getDescriptions','ServicenowConfiguration','ServicenowField','getFields','made_sla','hold_reason','knowledge','close_code','incident_state','category','parent','caused_by','watch_list','upon_reject','sys_updated_on','number','resolved_by','sys_updated_by','sys_created_on','sys_domain','sys_created_by','calendar_stc','closed_at','cmdb_ci','active','work_notes_list','business_service','rfc','time_worked','expected_start','business_duration','group_list','reopened_time','subcategory','work_notes','short_description','correlation_display','delivery_task','work_start','business_stc','additional_assignee_list','description','calendar_duration','notify','sys_class_name','close_notes','closed_by','follow_up','parent_incident','sys_id','reopened_by','urgency','problem_id','reassignment_count','activity_due','assigned_to','severity','comments','sla_due','due_date','sys_mod_count','reopen_count','sys_tags','escalation','upon_approval','correlation_id','location','findOne','username','email','serverUrl','substring','lastIndexOf','format','%s/api/now/table/','password','GET','incident\x20table\x20objects','assign','remove','includes','forEach','internalType','label','push'];(function(_0x51020b,_0x38c2c7){var _0x371e47=function(_0x2a538f){while(--_0x2a538f){_0x51020b['push'](_0x51020b['shift']());}};_0x371e47(++_0x38c2c7);}(_0x7e9a,0x194));var _0xa7e9=function(_0xb90639,_0x200a2a){_0xb90639=_0xb90639-0x0;var _0x2acb12=_0x7e9a[_0xb90639];return _0x2acb12;};'use strict';var pdf=require(_0xa7e9('0x0'));var emlformat=require(_0xa7e9('0x1'));var rimraf=require(_0xa7e9('0x2'));var zipdir=require(_0xa7e9('0x3'));var jsonpatch=require(_0xa7e9('0x4'));var rp=require(_0xa7e9('0x5'));var moment=require(_0xa7e9('0x6'));var BPromise=require(_0xa7e9('0x7'));var Mustache=require(_0xa7e9('0x8'));var util=require(_0xa7e9('0x9'));var path=require(_0xa7e9('0xa'));var sox=require(_0xa7e9('0xb'));var csv=require('to-csv');var ejs=require(_0xa7e9('0xc'));var fs=require('fs');var _=require('lodash');var squel=require(_0xa7e9('0xd'));var crypto=require(_0xa7e9('0xe'));var jsforce=require(_0xa7e9('0xf'));var deskjs=require(_0xa7e9('0x10'));var toCsv=require(_0xa7e9('0x11'));var querystring=require(_0xa7e9('0x12'));var Papa=require('papaparse');var Redis=require(_0xa7e9('0x13'));var authService=require(_0xa7e9('0x14'));var qs=require(_0xa7e9('0x15'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xa7e9('0x16'));var logger=require(_0xa7e9('0x17'))(_0xa7e9('0x18'));var utils=require(_0xa7e9('0x19'));var config=require(_0xa7e9('0x1a'));var db=require('../../mysqldb')['db'];var integrations=require(_0xa7e9('0x1b'));var jayson=require(_0xa7e9('0x1c'));var client=jayson[_0xa7e9('0x1d')][_0xa7e9('0x1e')]({'port':0x232a});function checkPasswordPattern(_0x431f59,_0x192607,_0xc02e58){if(_0xc02e58){var _0x53bf93=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x53bf93[_0xa7e9('0x1f')](_0x192607)){return _0x431f59;}else{throw new db['Sequelize'][(_0xa7e9('0x20'))](_0xa7e9('0x21'));}}else{return _0x431f59;}}function respondWithRpcPromise(_0x4a0800,_0x1dcdc7,_0x50977c,_0x5346f6){return new BPromise(function(_0x8457f0,_0x1360d0){var _0x21f550=_0x5346f6||client;return _0x21f550[_0xa7e9('0x22')](_0x4a0800,_0x50977c)[_0xa7e9('0x23')](function(_0x114b31){logger['info'](_0xa7e9('0x24'),_0x1dcdc7,'request\x20sent');logger['debug']('ServicenowAccount,\x20%s,\x20%s,\x20%s',_0x1dcdc7,_0xa7e9('0x25'),JSON[_0xa7e9('0x26')](_0x114b31));if(_0x114b31['error']){if(_0x114b31['error'][_0xa7e9('0x27')]===0x1f4){logger[_0xa7e9('0x28')](_0xa7e9('0x24'),_0x1dcdc7,_0x114b31[_0xa7e9('0x28')][_0xa7e9('0x29')]);return _0x1360d0(_0x114b31['error'][_0xa7e9('0x29')]);}logger[_0xa7e9('0x28')](_0xa7e9('0x24'),_0x1dcdc7,_0x114b31[_0xa7e9('0x28')][_0xa7e9('0x29')]);return _0x8457f0(_0x114b31[_0xa7e9('0x28')]['message']);}else{logger['info']('ServicenowAccount,\x20%s,\x20%s',_0x1dcdc7,_0xa7e9('0x25'));_0x8457f0(_0x114b31[_0xa7e9('0x2a')][_0xa7e9('0x29')]);}})[_0xa7e9('0x2b')](function(_0x38f9d2){logger[_0xa7e9('0x28')](_0xa7e9('0x24'),_0x1dcdc7,_0x38f9d2);_0x1360d0(_0x38f9d2);});});}function respondWithStatusCode(_0x39ae2e,_0x2aaf8a){_0x2aaf8a=_0x2aaf8a||0xcc;return function(_0x5da570){if(_0x5da570){return _0x39ae2e[_0xa7e9('0x2c')](_0x2aaf8a);}return _0x39ae2e['status'](_0x2aaf8a)[_0xa7e9('0x2d')]();};}function respondWithResult(_0x2249c8,_0x525a67){_0x525a67=_0x525a67||0xc8;return function(_0x5c276f){if(_0x5c276f){return _0x2249c8['status'](_0x525a67)[_0xa7e9('0x2e')](_0x5c276f);}};}function respondWithFilteredResult(_0x265678,_0x180965){return function(_0xe28166){if(_0xe28166){var _0x486407=_0xe28166[_0xa7e9('0x2f')],_0x414ad0=_0x180965[_0xa7e9('0x30')],_0x277240=_0x180965[_0xa7e9('0x30')]+_0x180965[_0xa7e9('0x31')],_0x417f11;if(_0x277240>=_0x486407){_0x277240=_0x486407;_0x417f11=0xc8;}else{_0x417f11=0xce;}_0x265678[_0xa7e9('0x32')](_0x417f11);return _0x265678[_0xa7e9('0x33')]('Content-Range',_0x414ad0+'-'+_0x277240+'/'+_0x486407)['json'](_0xe28166);}return null;};}function patchUpdates(_0x3625a3){return function(_0x4c2b3b){try{jsonpatch['apply'](_0x4c2b3b,_0x3625a3,!![]);}catch(_0x14d818){return BPromise[_0xa7e9('0x34')](_0x14d818);}return _0x4c2b3b[_0xa7e9('0x35')]();};}function saveUpdates(_0x3b29da,_0x1ccb2a){return function(_0x2ee136){if(_0x2ee136){return _0x2ee136[_0xa7e9('0x36')](_0x3b29da)[_0xa7e9('0x23')](function(_0xb6a28f){return _0xb6a28f;});}return null;};}function removeEntity(_0xfa8dbf,_0x58a016){return function(_0x1f7b03){if(_0x1f7b03){return _0x1f7b03[_0xa7e9('0x37')]()[_0xa7e9('0x23')](function(){_0xfa8dbf[_0xa7e9('0x32')](0xcc)[_0xa7e9('0x2d')]();});}};}function handleEntityNotFound(_0x3b126b,_0x177dae){return function(_0x348fa8){if(!_0x348fa8){_0x3b126b[_0xa7e9('0x2c')](0x194);}return _0x348fa8;};}function handleError(_0x3dd184,_0x5679c2){_0x5679c2=_0x5679c2||0x1f4;return function(_0x562c8c){logger[_0xa7e9('0x28')](_0x562c8c[_0xa7e9('0x38')]);if(_0x562c8c[_0xa7e9('0x39')]){delete _0x562c8c[_0xa7e9('0x39')];}_0x3dd184['status'](_0x5679c2)[_0xa7e9('0x3a')](_0x562c8c);};}exports[_0xa7e9('0x3b')]=function(_0x5d5ef3,_0x35097b){var _0x27ed47={},_0x59f798={},_0x31dc11={'count':0x0,'rows':[]};var _0x448304=_[_0xa7e9('0x3c')](db[_0xa7e9('0x3d')]['rawAttributes'],function(_0x2e9ff2){return{'name':_0x2e9ff2[_0xa7e9('0x3e')],'type':_0x2e9ff2[_0xa7e9('0x3f')][_0xa7e9('0x40')]};});_0x59f798[_0xa7e9('0x41')]=_[_0xa7e9('0x3c')](_0x448304,_0xa7e9('0x39'));_0x59f798[_0xa7e9('0x42')]=_[_0xa7e9('0x43')](_0x5d5ef3['query']);_0x59f798[_0xa7e9('0x44')]=_[_0xa7e9('0x45')](_0x59f798[_0xa7e9('0x41')],_0x59f798[_0xa7e9('0x42')]);_0x27ed47[_0xa7e9('0x46')]=_[_0xa7e9('0x45')](_0x59f798['model'],qs[_0xa7e9('0x47')](_0x5d5ef3[_0xa7e9('0x42')][_0xa7e9('0x47')]));_0x27ed47[_0xa7e9('0x46')]=_0x27ed47[_0xa7e9('0x46')][_0xa7e9('0x48')]?_0x27ed47['attributes']:_0x59f798[_0xa7e9('0x41')];if(!_0x5d5ef3[_0xa7e9('0x42')]['hasOwnProperty'](_0xa7e9('0x49'))){_0x27ed47[_0xa7e9('0x31')]=qs[_0xa7e9('0x31')](_0x5d5ef3[_0xa7e9('0x42')][_0xa7e9('0x31')]);_0x27ed47[_0xa7e9('0x30')]=qs['offset'](_0x5d5ef3[_0xa7e9('0x42')][_0xa7e9('0x30')]);}_0x27ed47['order']=qs[_0xa7e9('0x4a')](_0x5d5ef3['query'][_0xa7e9('0x4a')]);_0x27ed47[_0xa7e9('0x4b')]=qs[_0xa7e9('0x44')](_['pick'](_0x5d5ef3[_0xa7e9('0x42')],_0x59f798[_0xa7e9('0x44')]));if(_0x5d5ef3['query'][_0xa7e9('0x4c')]){_0x27ed47['where']=_['merge'](_0x27ed47['where'],{'$or':_[_0xa7e9('0x3c')](_0x448304,function(_0x430e37){if(_0x430e37[_0xa7e9('0x3f')]!==_0xa7e9('0x4d')){var _0x424f37={};_0x424f37[_0x430e37['name']]={'$like':'%'+_0x5d5ef3['query'][_0xa7e9('0x4c')]+'%'};return _0x424f37;}})});}_0x27ed47=_['merge']({},_0x27ed47,_0x5d5ef3[_0xa7e9('0x4e')]);var _0x23689b={'where':_0x27ed47[_0xa7e9('0x4b')]};return db[_0xa7e9('0x3d')][_0xa7e9('0x2f')](_0x23689b)['then'](function(_0x489301){_0x31dc11['count']=_0x489301;if(_0x5d5ef3[_0xa7e9('0x42')][_0xa7e9('0x4f')]){_0x27ed47[_0xa7e9('0x50')]=[{'all':!![]}];}return db['ServicenowAccount'][_0xa7e9('0x51')](_0x27ed47);})[_0xa7e9('0x23')](function(_0x1e352c){_0x31dc11[_0xa7e9('0x52')]=_0x1e352c;return _0x31dc11;})[_0xa7e9('0x23')](respondWithFilteredResult(_0x35097b,_0x27ed47))['catch'](handleError(_0x35097b,null));};exports[_0xa7e9('0x53')]=function(_0x6911ed,_0xa02c34){var _0x4730f2={'raw':![],'where':{'id':_0x6911ed['params']['id']}},_0x412a1a={};_0x412a1a[_0xa7e9('0x41')]=_['keys'](db[_0xa7e9('0x3d')][_0xa7e9('0x54')]);_0x412a1a[_0xa7e9('0x42')]=_[_0xa7e9('0x43')](_0x6911ed[_0xa7e9('0x42')]);_0x412a1a[_0xa7e9('0x44')]=_[_0xa7e9('0x45')](_0x412a1a[_0xa7e9('0x41')],_0x412a1a[_0xa7e9('0x42')]);_0x4730f2[_0xa7e9('0x46')]=_[_0xa7e9('0x45')](_0x412a1a['model'],qs['fields'](_0x6911ed['query'][_0xa7e9('0x47')]));_0x4730f2[_0xa7e9('0x46')]=_0x4730f2[_0xa7e9('0x46')][_0xa7e9('0x48')]?_0x4730f2[_0xa7e9('0x46')]:_0x412a1a[_0xa7e9('0x41')];if(_0x6911ed[_0xa7e9('0x42')][_0xa7e9('0x4f')]){_0x4730f2[_0xa7e9('0x50')]=[{'all':!![]}];}_0x4730f2=_[_0xa7e9('0x55')]({},_0x4730f2,_0x6911ed[_0xa7e9('0x4e')]);return db[_0xa7e9('0x3d')][_0xa7e9('0x56')](_0x4730f2)['then'](handleEntityNotFound(_0xa02c34,null))[_0xa7e9('0x23')](respondWithResult(_0xa02c34,null))[_0xa7e9('0x2b')](handleError(_0xa02c34,null));};exports[_0xa7e9('0x57')]=function(_0x28972b,_0x401256){return db[_0xa7e9('0x3d')]['create'](_0x28972b['body'],{})[_0xa7e9('0x23')](respondWithResult(_0x401256,0xc9))[_0xa7e9('0x2b')](handleError(_0x401256,null));};exports[_0xa7e9('0x36')]=function(_0x4af3d5,_0x5d8dab){if(_0x4af3d5[_0xa7e9('0x58')]['id']){delete _0x4af3d5[_0xa7e9('0x58')]['id'];}return db['ServicenowAccount'][_0xa7e9('0x56')]({'where':{'id':_0x4af3d5[_0xa7e9('0x59')]['id']}})['then'](handleEntityNotFound(_0x5d8dab,null))[_0xa7e9('0x23')](saveUpdates(_0x4af3d5[_0xa7e9('0x58')],null))[_0xa7e9('0x23')](respondWithResult(_0x5d8dab,null))[_0xa7e9('0x2b')](handleError(_0x5d8dab,null));};exports[_0xa7e9('0x37')]=function(_0x5c40f,_0x64bcb3){return db['ServicenowAccount'][_0xa7e9('0x56')]({'where':{'id':_0x5c40f['params']['id']}})[_0xa7e9('0x23')](handleEntityNotFound(_0x64bcb3,null))[_0xa7e9('0x23')](removeEntity(_0x64bcb3,null))['catch'](handleError(_0x64bcb3,null));};exports[_0xa7e9('0x5a')]=function(_0x35c4cf,_0x342c5d,_0x22e378){var _0xcfe7d4={};var _0xfa05de={};var _0x43371c;var _0x109965;return db[_0xa7e9('0x3d')]['findOne']({'where':{'id':_0x35c4cf[_0xa7e9('0x59')]['id']}})[_0xa7e9('0x23')](handleEntityNotFound(_0x342c5d,null))[_0xa7e9('0x23')](function(_0x1db493){if(_0x1db493){_0x43371c=_0x1db493;_0xfa05de['model']=_[_0xa7e9('0x43')](db['ServicenowConfiguration'][_0xa7e9('0x54')]);_0xfa05de['query']=_[_0xa7e9('0x43')](_0x35c4cf[_0xa7e9('0x42')]);_0xfa05de['filters']=_[_0xa7e9('0x45')](_0xfa05de['model'],_0xfa05de[_0xa7e9('0x42')]);_0xcfe7d4['attributes']=_[_0xa7e9('0x45')](_0xfa05de[_0xa7e9('0x41')],qs[_0xa7e9('0x47')](_0x35c4cf[_0xa7e9('0x42')][_0xa7e9('0x47')]));_0xcfe7d4[_0xa7e9('0x46')]=_0xcfe7d4['attributes'][_0xa7e9('0x48')]?_0xcfe7d4[_0xa7e9('0x46')]:_0xfa05de[_0xa7e9('0x41')];_0xcfe7d4[_0xa7e9('0x5b')]=qs['sort'](_0x35c4cf[_0xa7e9('0x42')][_0xa7e9('0x4a')]);_0xcfe7d4['where']=qs[_0xa7e9('0x44')](_[_0xa7e9('0x5c')](_0x35c4cf[_0xa7e9('0x42')],_0xfa05de['filters']));if(_0x35c4cf[_0xa7e9('0x42')][_0xa7e9('0x4c')]){_0xcfe7d4['where']=_[_0xa7e9('0x55')](_0xcfe7d4[_0xa7e9('0x4b')],{'$or':_[_0xa7e9('0x3c')](_0xcfe7d4[_0xa7e9('0x46')],function(_0x5e151e){var _0x25ba8a={};_0x25ba8a[_0x5e151e]={'$like':'%'+_0x35c4cf[_0xa7e9('0x42')]['filter']+'%'};return _0x25ba8a;})});}_0xcfe7d4=_[_0xa7e9('0x55')]({},_0xcfe7d4,_0x35c4cf[_0xa7e9('0x4e')]);return _0x43371c[_0xa7e9('0x5a')](_0xcfe7d4);}})[_0xa7e9('0x23')](function(_0x2cc922){if(_0x2cc922){_0x109965=_0x2cc922[_0xa7e9('0x48')];if(!_0x35c4cf[_0xa7e9('0x42')]['hasOwnProperty'](_0xa7e9('0x49'))){_0xcfe7d4[_0xa7e9('0x31')]=qs[_0xa7e9('0x31')](_0x35c4cf[_0xa7e9('0x42')]['limit']);_0xcfe7d4[_0xa7e9('0x30')]=qs[_0xa7e9('0x30')](_0x35c4cf[_0xa7e9('0x42')][_0xa7e9('0x30')]);}return _0x43371c['getConfigurations'](_0xcfe7d4);}})[_0xa7e9('0x23')](function(_0x623260){if(_0x623260){return _0x623260?{'count':_0x109965,'rows':_0x623260}:null;}})[_0xa7e9('0x23')](respondWithResult(_0x342c5d,null))['catch'](handleError(_0x342c5d,null));};exports[_0xa7e9('0x5d')]=function(_0x2afc13,_0x5926f6,_0x3befc9){if(_0x2afc13[_0xa7e9('0x58')]['id']){delete _0x2afc13[_0xa7e9('0x58')]['id'];}return db[_0xa7e9('0x3d')]['findOne']({'where':{'id':_0x2afc13[_0xa7e9('0x59')]['id']}})['then'](handleEntityNotFound(_0x5926f6,null))[_0xa7e9('0x23')](function(_0x4f894e){if(_0x4f894e){_0x2afc13[_0xa7e9('0x58')][_0xa7e9('0x5e')]=_0x4f894e['id'];_0x2afc13[_0xa7e9('0x58')][_0xa7e9('0x5f')]=integrations[_0xa7e9('0x60')](_0x2afc13[_0xa7e9('0x58')][_0xa7e9('0x61')],_0x2afc13[_0xa7e9('0x58')][_0xa7e9('0x3f')]);_0x2afc13['body'][_0xa7e9('0x62')]=integrations[_0xa7e9('0x63')](_0x2afc13[_0xa7e9('0x58')]['channel'],_0x2afc13[_0xa7e9('0x58')][_0xa7e9('0x3f')]);return db[_0xa7e9('0x64')]['create'](_0x2afc13['body'],{'include':[{'model':db[_0xa7e9('0x65')],'as':_0xa7e9('0x5f')},{'model':db[_0xa7e9('0x65')],'as':_0xa7e9('0x62')}]});}return null;})[_0xa7e9('0x23')](respondWithResult(_0x5926f6,null))['catch'](handleError(_0x5926f6,null));};exports[_0xa7e9('0x66')]=function(_0xe61ef,_0x3abe82,_0xd55795){var _0x588476=[_0xa7e9('0x67'),_0xa7e9('0x68'),_0xa7e9('0x69'),'subcategory',_0xa7e9('0x6a'),'notify',_0xa7e9('0x6b'),'severity',_0xa7e9('0x6c')];var _0x7c107c=[_0xa7e9('0x6d'),_0xa7e9('0x67'),_0xa7e9('0x6e'),_0xa7e9('0x6f'),_0xa7e9('0x70'),_0xa7e9('0x71'),'child_incidents','hold_reason','approval_history',_0xa7e9('0x72'),_0xa7e9('0x73'),_0xa7e9('0x74'),'opened_by','user_input',_0xa7e9('0x75'),_0xa7e9('0x76'),'state',_0xa7e9('0x77'),_0xa7e9('0x69'),_0xa7e9('0x5b'),_0xa7e9('0x78'),_0xa7e9('0x79'),_0xa7e9('0x7a'),'delivery_plan','impact',_0xa7e9('0x7b'),_0xa7e9('0x7c'),_0xa7e9('0x7d'),'priority','sys_domain_path',_0xa7e9('0x7e'),_0xa7e9('0x7f'),_0xa7e9('0x80'),'opened_at',_0xa7e9('0x81'),_0xa7e9('0x82'),'work_end',_0xa7e9('0x83'),'resolved_at','caller_id','approval_set',_0xa7e9('0x84'),_0xa7e9('0x85'),_0xa7e9('0x86'),'close_code',_0xa7e9('0x87'),_0xa7e9('0x88'),_0xa7e9('0x89'),'assignment_group',_0xa7e9('0x8a'),_0xa7e9('0x8b'),_0xa7e9('0x8c'),_0xa7e9('0x8d'),_0xa7e9('0x8e'),_0xa7e9('0x8f'),_0xa7e9('0x90'),_0xa7e9('0x91'),_0xa7e9('0x92'),_0xa7e9('0x93'),_0xa7e9('0x94'),'contact_type',_0xa7e9('0x95'),_0xa7e9('0x6b'),_0xa7e9('0x96'),_0xa7e9('0x97'),'company',_0xa7e9('0x98'),_0xa7e9('0x99'),_0xa7e9('0x9a'),_0xa7e9('0x9b'),_0xa7e9('0x9c'),_0xa7e9('0x9d'),'approval','comments_and_work_notes',_0xa7e9('0x9e'),_0xa7e9('0x9f'),_0xa7e9('0xa0'),_0xa7e9('0xa1'),_0xa7e9('0xa2'),_0xa7e9('0xa3'),_0xa7e9('0xa4'),_0xa7e9('0xa5'),_0xa7e9('0x6c')];var _0x5cc709='';var _0x488381='';var _0x148404=[];var _0x26e782='';var _0x18fba0='';var _0x3f75e8=[];var _0x13bb06='';var _0x4c34a2='';var _0x134032={};var _0x3d0100='';return db['ServicenowAccount'][_0xa7e9('0xa6')]({'where':{'id':_0xe61ef[_0xa7e9('0x59')]['id']},'attributes':['id',_0xa7e9('0xa7'),'password',_0xa7e9('0xa8'),'remoteUri',_0xa7e9('0xa9')]})[_0xa7e9('0x23')](handleEntityNotFound(_0x3abe82,null))[_0xa7e9('0x23')](function(_0x6ec1a4){if(_0x6ec1a4){_0x3d0100=_0x6ec1a4['remoteUri'];var _0x57c823=_0x3d0100['slice'](-0x1);if(_0x57c823==='/'){_0x3d0100=_0x3d0100[_0xa7e9('0xaa')](0x0,_0x3d0100[_0xa7e9('0xab')](_0x57c823));}_0x4c34a2=util['format']('%s/api/now/doc/table/schema/',_0x3d0100);_0x13bb06=util[_0xa7e9('0xac')](_0xa7e9('0xad'),_0x3d0100);_0x134032={'user':_0x6ec1a4[_0xa7e9('0xa7')],'pass':_0x6ec1a4[_0xa7e9('0xae')]};var _0x426084={'method':_0xa7e9('0xaf'),'uri':_0x4c34a2+'incident?sysparm_display_value=all','auth':_0x134032,'json':!![]};return rp(_0x426084);}})[_0xa7e9('0x23')](function(_0x536f80){if(_0x536f80[_0xa7e9('0x2a')]['length']>0x0){_0x5cc709=_0x536f80[_0xa7e9('0x2a')];}console['log'](_0xa7e9('0xb0'),_0x5cc709);_0x3f75e8=[];_0x488381=Object[_0xa7e9('0xb1')]([],_0x5cc709);_[_0xa7e9('0xb2')](_0x488381,function(_0x49af3d){return!_0x588476[_0xa7e9('0xb3')](_0x49af3d['name']);});_0x488381[_0xa7e9('0xb4')](function(_0x3a323b){var _0x4d7d28=createFieldObject(_0x13bb06,_0x134032,_0x3a323b[_0xa7e9('0xb5')],_0x3a323b[_0xa7e9('0x39')],_0x3a323b[_0xa7e9('0xb6')],![]);_0x3f75e8[_0xa7e9('0xb7')](_0x4d7d28);});return Promise[_0xa7e9('0xb8')](_0x3f75e8);})[_0xa7e9('0x23')](function(_0x4b8427){_0x148404=_0x4b8427;_0x26e782=Object[_0xa7e9('0xb1')]([],_0x5cc709);console[_0xa7e9('0xb9')](_0xa7e9('0xba'),_0x5cc709);_['remove'](_0x26e782,function(_0x21cc17){return _0x7c107c['includes'](_0x21cc17[_0xa7e9('0x39')]);});console[_0xa7e9('0xb9')]('TCL:\x20exports.getEntityFields\x20->\x20_objectsCustom',_0x26e782);_0x3f75e8=[];_0x26e782[_0xa7e9('0xb4')](function(_0x1c3555){var _0xe652fa=createFieldObject(_0x13bb06,_0x134032,_0x1c3555[_0xa7e9('0xb5')],_0x1c3555[_0xa7e9('0x39')],_0x1c3555['label'],!![]);_0x3f75e8[_0xa7e9('0xb7')](_0xe652fa);});return Promise[_0xa7e9('0xb8')](_0x3f75e8);})[_0xa7e9('0x23')](function(_0x49db79){_0x18fba0=_0x49db79;var _0xb902e8=_0x148404[_0xa7e9('0xbb')](_0x18fba0);return{'count':_0xb902e8['length'],'rows':_0xb902e8};})['then'](respondWithResult(_0x3abe82,null))[_0xa7e9('0x2b')](function(_0x381435){console[_0xa7e9('0xb9')]('ServiceNow\x20error:\x20'+_0x381435);var _0x4a1ee9=_0xe61ef[_0xa7e9('0x42')][_0xa7e9('0x1f')]?0x1f4:_0x381435[_0xa7e9('0xbc')]||0x1f4;logger[_0xa7e9('0x28')](_0x381435[_0xa7e9('0x38')]);delete _0x381435[_0xa7e9('0x39')];if(_0x4a1ee9===0x191){_0x4a1ee9=0x190;}_0x3abe82[_0xa7e9('0x32')](_0x4a1ee9)[_0xa7e9('0x3a')](_0xe61ef[_0xa7e9('0x42')][_0xa7e9('0x1f')]?{'message':_0xa7e9('0xbd'),'statusCode':_0x381435[_0xa7e9('0xbc')]}:_0x381435);});};function createFieldObject(_0x57d645,_0x5b57e5,_0x58de4f,_0x1393e0,_0x4727de,_0x146ef2){return new Promise(function(_0x46cb7c,_0x2fdca6){var _0x3020fb={'id':_0x1393e0,'name':_0x4727de,'custom':_0x146ef2};if(_0x58de4f===_0xa7e9('0xbe')){_0x3020fb[_0xa7e9('0x4e')]=[{'name':'True','value':_0xa7e9('0xbf')},{'name':_0xa7e9('0xc0'),'value':_0xa7e9('0xc1')}];_0x46cb7c(_0x3020fb);}else{var _0x8c7068={'method':_0xa7e9('0xaf'),'uri':_0x57d645+_0xa7e9('0xc2')+_0x1393e0,'auth':_0x5b57e5,'json':!![]};return rp(_0x8c7068)[_0xa7e9('0x23')](function(_0x1b6b37){var _0x10e3f5=[];if(_0x1b6b37[_0xa7e9('0x2a')][_0xa7e9('0x48')]>0x0){_0x1b6b37[_0xa7e9('0x2a')][_0xa7e9('0xb4')](function(_0xb12bb7){if(_0xb12bb7['inactive']==='false'){var _0x58135e={'name':_0xb12bb7['label'],'value':_0xb12bb7[_0xa7e9('0xc3')]};_0x10e3f5[_0xa7e9('0xb7')](_0x58135e);}});}_0x3020fb['options']=_0x10e3f5;if(_0x3020fb[_0xa7e9('0x4e')]['length']>0x0){_0x46cb7c(_0x3020fb);}else{if(_0x146ef2==![]){_0x46cb7c();}else{_0x46cb7c(_0x3020fb);}}});}});} \ No newline at end of file diff --git a/server/api/intServicenowAccount/intServicenowAccount.model.js b/server/api/intServicenowAccount/intServicenowAccount.model.js index 8778210..eb62004 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 _0x50a6=['define','ServicenowAccount','lodash','util','moment','request-promise','path','rimraf','./intServicenowAccount.attributes'];(function(_0x1e1f21,_0x59f39b){var _0x4a5b6f=function(_0x45c6cd){while(--_0x45c6cd){_0x1e1f21['push'](_0x1e1f21['shift']());}};_0x4a5b6f(++_0x59f39b);}(_0x50a6,0xa4));var _0x650a=function(_0x11d947,_0xcbf4d8){_0x11d947=_0x11d947-0x0;var _0x47929e=_0x50a6[_0x11d947];return _0x47929e;};'use strict';var _=require(_0x650a('0x0'));var util=require(_0x650a('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0x650a('0x2'));var BPromise=require('bluebird');var rp=require(_0x650a('0x3'));var fs=require('fs');var path=require(_0x650a('0x4'));var rimraf=require(_0x650a('0x5'));var config=require('../../config/environment');var attributes=require(_0x650a('0x6'));var integrations=require('../../components/integrations/configuration');module['exports']=function(_0x2d486d,_0x2d1bb4){return _0x2d486d[_0x650a('0x7')](_0x650a('0x8'),attributes,{'tableName':'int_servicenow_accounts','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xfb65=['moment','request-promise','path','rimraf','../../config/environment','./intServicenowAccount.attributes','../../components/integrations/configuration','define','ServicenowAccount','int_servicenow_accounts','util','../../config/logger'];(function(_0x3a90f7,_0x570414){var _0x587e68=function(_0x107609){while(--_0x107609){_0x3a90f7['push'](_0x3a90f7['shift']());}};_0x587e68(++_0x570414);}(_0xfb65,0x82));var _0x5fb6=function(_0x2dc154,_0x1a3464){_0x2dc154=_0x2dc154-0x0;var _0x329085=_0xfb65[_0x2dc154];return _0x329085;};'use strict';var _=require('lodash');var util=require(_0x5fb6('0x0'));var logger=require(_0x5fb6('0x1'))('api');var moment=require(_0x5fb6('0x2'));var BPromise=require('bluebird');var rp=require(_0x5fb6('0x3'));var fs=require('fs');var path=require(_0x5fb6('0x4'));var rimraf=require(_0x5fb6('0x5'));var config=require(_0x5fb6('0x6'));var attributes=require(_0x5fb6('0x7'));var integrations=require(_0x5fb6('0x8'));module['exports']=function(_0x50782b,_0x238914){return _0x50782b[_0x5fb6('0x9')](_0x5fb6('0xa'),attributes,{'tableName':_0x5fb6('0xb'),'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 0a13a04..74b2280 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 _0x384d=['find','map','lodash','util','moment','ioredis','../../mysqldb','../../config/utils','rpc','jayson/promise','client','http','then','info','ServicenowAccount,\x20%s,\x20%s','request\x20sent','debug','ServicenowAccount,\x20%s,\x20%s,\x20%s','stringify','error','message','result','options','raw','where','attributes','include','model','GetServicenowAccount','catch','ShowServicenowAccount','ServicenowAccount'];(function(_0x7e2eb0,_0x17cd58){var _0xd92de4=function(_0x5d005b){while(--_0x5d005b){_0x7e2eb0['push'](_0x7e2eb0['shift']());}};_0xd92de4(++_0x17cd58);}(_0x384d,0x1c2));var _0xd384=function(_0x5322db,_0x223dc5){_0x5322db=_0x5322db-0x0;var _0x21c030=_0x384d[_0x5322db];return _0x21c030;};'use strict';var _=require(_0xd384('0x0'));var util=require(_0xd384('0x1'));var moment=require(_0xd384('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xd384('0x3'));var db=require(_0xd384('0x4'))['db'];var utils=require(_0xd384('0x5'));var logger=require('../../config/logger')(_0xd384('0x6'));var config=require('../../config/environment');var jayson=require(_0xd384('0x7'));var client=jayson[_0xd384('0x8')][_0xd384('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x18ece9,_0x2f2337,_0x249471){return new BPromise(function(_0x8bd581,_0x3b76d1){return client['request'](_0x18ece9,_0x249471)[_0xd384('0xa')](function(_0x4d4902){logger[_0xd384('0xb')](_0xd384('0xc'),_0x2f2337,_0xd384('0xd'));logger[_0xd384('0xe')](_0xd384('0xf'),_0x2f2337,_0xd384('0xd'),JSON[_0xd384('0x10')](_0x4d4902));if(_0x4d4902[_0xd384('0x11')]){if(_0x4d4902['error']['code']===0x1f4){logger['error'](_0xd384('0xc'),_0x2f2337,_0x4d4902[_0xd384('0x11')][_0xd384('0x12')]);return _0x3b76d1(_0x4d4902[_0xd384('0x11')]['message']);}logger[_0xd384('0x11')](_0xd384('0xc'),_0x2f2337,_0x4d4902[_0xd384('0x11')][_0xd384('0x12')]);return _0x8bd581(_0x4d4902['error'][_0xd384('0x12')]);}else{logger[_0xd384('0xb')](_0xd384('0xc'),_0x2f2337,'request\x20sent');_0x8bd581(_0x4d4902[_0xd384('0x13')]['message']);}})['catch'](function(_0x190070){logger[_0xd384('0x11')](_0xd384('0xc'),_0x2f2337,_0x190070);_0x3b76d1(_0x190070);});});}exports['GetServicenowAccount']=function(_0x513e2d){var _0x2d112d=this;return new Promise(function(_0x2a1d07,_0x351e1c){return db['ServicenowAccount']['findAll']({'raw':_0x513e2d[_0xd384('0x14')]?_0x513e2d['options'][_0xd384('0x15')]===undefined?!![]:![]:!![],'where':_0x513e2d[_0xd384('0x14')]?_0x513e2d[_0xd384('0x14')][_0xd384('0x16')]||null:null,'attributes':_0x513e2d[_0xd384('0x14')]?_0x513e2d['options'][_0xd384('0x17')]||null:null,'limit':_0x513e2d['options']?_0x513e2d[_0xd384('0x14')]['limit']||null:null,'include':_0x513e2d[_0xd384('0x14')]?_0x513e2d['options'][_0xd384('0x18')]?_['map'](_0x513e2d[_0xd384('0x14')]['include'],function(_0x52b935){return{'model':db[_0x52b935['model']],'as':_0x52b935['as'],'attributes':_0x52b935['attributes'],'include':_0x52b935[_0xd384('0x18')]?_['map'](_0x52b935[_0xd384('0x18')],function(_0x45d4e4){return{'model':db[_0x45d4e4[_0xd384('0x19')]],'as':_0x45d4e4['as'],'attributes':_0x45d4e4[_0xd384('0x17')],'include':_0x45d4e4['include']?_['map'](_0x45d4e4[_0xd384('0x18')],function(_0x21abf9){return{'model':db[_0x21abf9['model']],'as':_0x21abf9['as'],'attributes':_0x21abf9['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x297c20){logger[_0xd384('0xb')](_0xd384('0x1a'),_0x513e2d);logger[_0xd384('0xe')](_0xd384('0x1a'),_0x513e2d,JSON['stringify'](_0x297c20));_0x2a1d07(_0x297c20);})[_0xd384('0x1b')](function(_0x557c50){logger[_0xd384('0x11')]('GetServicenowAccount',_0x557c50[_0xd384('0x12')],_0x513e2d);_0x351e1c(_0x2d112d[_0xd384('0x11')](0x1f4,_0x557c50[_0xd384('0x12')]));});});};exports[_0xd384('0x1c')]=function(_0x150279){var _0x5a1c58=this;return new Promise(function(_0x52409f,_0x55c361){return db[_0xd384('0x1d')][_0xd384('0x1e')]({'raw':_0x150279['options']?_0x150279[_0xd384('0x14')][_0xd384('0x15')]===undefined?!![]:![]:!![],'where':_0x150279['options']?_0x150279[_0xd384('0x14')][_0xd384('0x16')]||null:null,'attributes':_0x150279['options']?_0x150279['options'][_0xd384('0x17')]||null:null,'include':_0x150279[_0xd384('0x14')]?_0x150279[_0xd384('0x14')][_0xd384('0x18')]?_[_0xd384('0x1f')](_0x150279[_0xd384('0x14')][_0xd384('0x18')],function(_0x19f53b){return{'model':db[_0x19f53b[_0xd384('0x19')]],'as':_0x19f53b['as'],'attributes':_0x19f53b[_0xd384('0x17')],'include':_0x19f53b[_0xd384('0x18')]?_[_0xd384('0x1f')](_0x19f53b[_0xd384('0x18')],function(_0x27e2a4){return{'model':db[_0x27e2a4[_0xd384('0x19')]],'as':_0x27e2a4['as'],'attributes':_0x27e2a4[_0xd384('0x17')],'include':_0x27e2a4[_0xd384('0x18')]?_[_0xd384('0x1f')](_0x27e2a4[_0xd384('0x18')],function(_0x1a15d3){return{'model':db[_0x1a15d3[_0xd384('0x19')]],'as':_0x1a15d3['as'],'attributes':_0x1a15d3[_0xd384('0x17')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x53f018){logger[_0xd384('0xb')](_0xd384('0x1c'),_0x150279);logger[_0xd384('0xe')](_0xd384('0x1c'),_0x150279,JSON['stringify'](_0x53f018));_0x52409f(_0x53f018);})[_0xd384('0x1b')](function(_0x47425b){logger[_0xd384('0x11')](_0xd384('0x1c'),_0x47425b[_0xd384('0x12')],_0x150279);_0x55c361(_0x5a1c58['error'](0x1f4,_0x47425b[_0xd384('0x12')]));});});}; \ No newline at end of file +var _0x50e6=['result','GetServicenowAccount','ServicenowAccount','raw','options','where','attributes','limit','include','map','model','then','debug','stringify','catch','find','ShowServicenowAccount','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','request','info','ServicenowAccount,\x20%s,\x20%s','request\x20sent','ServicenowAccount,\x20%s,\x20%s,\x20%s','error','code','message'];(function(_0x1e04e0,_0x146fa2){var _0x55ad6d=function(_0x8ca710){while(--_0x8ca710){_0x1e04e0['push'](_0x1e04e0['shift']());}};_0x55ad6d(++_0x146fa2);}(_0x50e6,0x7d));var _0x650e=function(_0x5179d6,_0x548074){_0x5179d6=_0x5179d6-0x0;var _0x21a38f=_0x50e6[_0x5179d6];return _0x21a38f;};'use strict';var _=require(_0x650e('0x0'));var util=require(_0x650e('0x1'));var moment=require(_0x650e('0x2'));var BPromise=require(_0x650e('0x3'));var rs=require(_0x650e('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x650e('0x5'))['db'];var utils=require(_0x650e('0x6'));var logger=require(_0x650e('0x7'))(_0x650e('0x8'));var config=require(_0x650e('0x9'));var jayson=require(_0x650e('0xa'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x97c688,_0x2e8342,_0xfa2985){return new BPromise(function(_0x4dc6f5,_0x4669d1){return client[_0x650e('0xb')](_0x97c688,_0xfa2985)['then'](function(_0x474b21){logger[_0x650e('0xc')](_0x650e('0xd'),_0x2e8342,_0x650e('0xe'));logger['debug'](_0x650e('0xf'),_0x2e8342,_0x650e('0xe'),JSON['stringify'](_0x474b21));if(_0x474b21[_0x650e('0x10')]){if(_0x474b21[_0x650e('0x10')][_0x650e('0x11')]===0x1f4){logger['error']('ServicenowAccount,\x20%s,\x20%s',_0x2e8342,_0x474b21[_0x650e('0x10')][_0x650e('0x12')]);return _0x4669d1(_0x474b21[_0x650e('0x10')]['message']);}logger['error']('ServicenowAccount,\x20%s,\x20%s',_0x2e8342,_0x474b21[_0x650e('0x10')][_0x650e('0x12')]);return _0x4dc6f5(_0x474b21[_0x650e('0x10')]['message']);}else{logger['info'](_0x650e('0xd'),_0x2e8342,_0x650e('0xe'));_0x4dc6f5(_0x474b21[_0x650e('0x13')]['message']);}})['catch'](function(_0x487360){logger[_0x650e('0x10')]('ServicenowAccount,\x20%s,\x20%s',_0x2e8342,_0x487360);_0x4669d1(_0x487360);});});}exports[_0x650e('0x14')]=function(_0x270746){var _0x50d46f=this;return new Promise(function(_0x403a2d,_0x2140d0){return db[_0x650e('0x15')]['findAll']({'raw':_0x270746['options']?_0x270746['options'][_0x650e('0x16')]===undefined?!![]:![]:!![],'where':_0x270746[_0x650e('0x17')]?_0x270746[_0x650e('0x17')][_0x650e('0x18')]||null:null,'attributes':_0x270746[_0x650e('0x17')]?_0x270746[_0x650e('0x17')][_0x650e('0x19')]||null:null,'limit':_0x270746[_0x650e('0x17')]?_0x270746['options'][_0x650e('0x1a')]||null:null,'include':_0x270746[_0x650e('0x17')]?_0x270746[_0x650e('0x17')][_0x650e('0x1b')]?_[_0x650e('0x1c')](_0x270746[_0x650e('0x17')][_0x650e('0x1b')],function(_0x536373){return{'model':db[_0x536373[_0x650e('0x1d')]],'as':_0x536373['as'],'attributes':_0x536373[_0x650e('0x19')],'include':_0x536373['include']?_[_0x650e('0x1c')](_0x536373[_0x650e('0x1b')],function(_0x108c8c){return{'model':db[_0x108c8c[_0x650e('0x1d')]],'as':_0x108c8c['as'],'attributes':_0x108c8c['attributes'],'include':_0x108c8c['include']?_[_0x650e('0x1c')](_0x108c8c[_0x650e('0x1b')],function(_0x181964){return{'model':db[_0x181964[_0x650e('0x1d')]],'as':_0x181964['as'],'attributes':_0x181964['attributes']};}):[]};}):[]};}):[]:[]})[_0x650e('0x1e')](function(_0xc7ae33){logger['info'](_0x650e('0x14'),_0x270746);logger[_0x650e('0x1f')](_0x650e('0x14'),_0x270746,JSON[_0x650e('0x20')](_0xc7ae33));_0x403a2d(_0xc7ae33);})[_0x650e('0x21')](function(_0xf2ec2a){logger[_0x650e('0x10')](_0x650e('0x14'),_0xf2ec2a['message'],_0x270746);_0x2140d0(_0x50d46f['error'](0x1f4,_0xf2ec2a[_0x650e('0x12')]));});});};exports['ShowServicenowAccount']=function(_0x363600){var _0x373db8=this;return new Promise(function(_0x41d0ff,_0x12f25a){return db['ServicenowAccount'][_0x650e('0x22')]({'raw':_0x363600[_0x650e('0x17')]?_0x363600['options']['raw']===undefined?!![]:![]:!![],'where':_0x363600[_0x650e('0x17')]?_0x363600[_0x650e('0x17')][_0x650e('0x18')]||null:null,'attributes':_0x363600['options']?_0x363600[_0x650e('0x17')][_0x650e('0x19')]||null:null,'include':_0x363600[_0x650e('0x17')]?_0x363600[_0x650e('0x17')][_0x650e('0x1b')]?_['map'](_0x363600['options'][_0x650e('0x1b')],function(_0x3905f4){return{'model':db[_0x3905f4['model']],'as':_0x3905f4['as'],'attributes':_0x3905f4[_0x650e('0x19')],'include':_0x3905f4['include']?_[_0x650e('0x1c')](_0x3905f4[_0x650e('0x1b')],function(_0x159f26){return{'model':db[_0x159f26[_0x650e('0x1d')]],'as':_0x159f26['as'],'attributes':_0x159f26['attributes'],'include':_0x159f26[_0x650e('0x1b')]?_[_0x650e('0x1c')](_0x159f26[_0x650e('0x1b')],function(_0x4f74ef){return{'model':db[_0x4f74ef['model']],'as':_0x4f74ef['as'],'attributes':_0x4f74ef[_0x650e('0x19')]};}):[]};}):[]};}):[]:[]})[_0x650e('0x1e')](function(_0x5111e3){logger[_0x650e('0xc')]('ShowServicenowAccount',_0x363600);logger[_0x650e('0x1f')](_0x650e('0x23'),_0x363600,JSON[_0x650e('0x20')](_0x5111e3));_0x41d0ff(_0x5111e3);})['catch'](function(_0x3faabc){logger[_0x650e('0x10')](_0x650e('0x23'),_0x3faabc['message'],_0x363600);_0x12f25a(_0x373db8[_0x650e('0x10')](0x1f4,_0x3faabc[_0x650e('0x12')]));});});}; \ No newline at end of file diff --git a/server/api/intServicenowConfiguration/index.js b/server/api/intServicenowConfiguration/index.js index 8372386..d216c39 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 _0x4e6c=['destroy','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./intServicenowConfiguration.controller','get','isAuthenticated','index','/:id','show','getFields','getSubjects','/:id/descriptions','getDescriptions','create','put','delete'];(function(_0x5d98d2,_0x4995a1){var _0x28c917=function(_0x459f02){while(--_0x459f02){_0x5d98d2['push'](_0x5d98d2['shift']());}};_0x28c917(++_0x4995a1);}(_0x4e6c,0x7a));var _0xc4e6=function(_0x50c093,_0x256694){_0x50c093=_0x50c093-0x0;var _0x54b81e=_0x4e6c[_0x50c093];return _0x54b81e;};'use strict';var multer=require(_0xc4e6('0x0'));var util=require(_0xc4e6('0x1'));var path=require(_0xc4e6('0x2'));var timeout=require(_0xc4e6('0x3'));var express=require(_0xc4e6('0x4'));var router=express[_0xc4e6('0x5')]();var auth=require(_0xc4e6('0x6'));var interaction=require(_0xc4e6('0x7'));var config=require(_0xc4e6('0x8'));var controller=require(_0xc4e6('0x9'));router[_0xc4e6('0xa')]('/',auth[_0xc4e6('0xb')](),controller[_0xc4e6('0xc')]);router[_0xc4e6('0xa')](_0xc4e6('0xd'),auth[_0xc4e6('0xb')](),controller[_0xc4e6('0xe')]);router[_0xc4e6('0xa')]('/:id/fields',auth[_0xc4e6('0xb')](),controller[_0xc4e6('0xf')]);router[_0xc4e6('0xa')]('/:id/subjects',auth[_0xc4e6('0xb')](),controller[_0xc4e6('0x10')]);router[_0xc4e6('0xa')](_0xc4e6('0x11'),auth[_0xc4e6('0xb')](),controller[_0xc4e6('0x12')]);router['post']('/',auth[_0xc4e6('0xb')](),controller[_0xc4e6('0x13')]);router[_0xc4e6('0x14')](_0xc4e6('0xd'),auth[_0xc4e6('0xb')](),controller['update']);router[_0xc4e6('0x15')](_0xc4e6('0xd'),auth[_0xc4e6('0xb')](),controller[_0xc4e6('0x16')]);module[_0xc4e6('0x17')]=router; \ No newline at end of file +var _0x3082=['exports','connect-timeout','express','Router','../../config/environment','./intServicenowConfiguration.controller','get','/:id','isAuthenticated','show','/:id/fields','/:id/subjects','getSubjects','/:id/descriptions','put','update','delete'];(function(_0x5618c7,_0xc4bbc7){var _0x48c433=function(_0x595dab){while(--_0x595dab){_0x5618c7['push'](_0x5618c7['shift']());}};_0x48c433(++_0xc4bbc7);}(_0x3082,0x199));var _0x2308=function(_0x37336c,_0x166f7a){_0x37336c=_0x37336c-0x0;var _0x361451=_0x3082[_0x37336c];return _0x361451;};'use strict';var multer=require('multer');var util=require('util');var path=require('path');var timeout=require(_0x2308('0x0'));var express=require(_0x2308('0x1'));var router=express[_0x2308('0x2')]();var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x2308('0x3'));var controller=require(_0x2308('0x4'));router[_0x2308('0x5')]('/',auth['isAuthenticated'](),controller['index']);router[_0x2308('0x5')](_0x2308('0x6'),auth[_0x2308('0x7')](),controller[_0x2308('0x8')]);router['get'](_0x2308('0x9'),auth[_0x2308('0x7')](),controller['getFields']);router[_0x2308('0x5')](_0x2308('0xa'),auth[_0x2308('0x7')](),controller[_0x2308('0xb')]);router['get'](_0x2308('0xc'),auth['isAuthenticated'](),controller['getDescriptions']);router['post']('/',auth[_0x2308('0x7')](),controller['create']);router[_0x2308('0xd')](_0x2308('0x6'),auth[_0x2308('0x7')](),controller[_0x2308('0xe')]);router[_0x2308('0xf')](_0x2308('0x6'),auth[_0x2308('0x7')](),controller['destroy']);module[_0x2308('0x10')]=router; \ No newline at end of file diff --git a/server/api/intServicenowConfiguration/intServicenowConfiguration.attributes.js b/server/api/intServicenowConfiguration/intServicenowConfiguration.attributes.js index d9576f3..89b0d25 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 _0x03e9=['exports','STRING'];(function(_0x2b9b8d,_0xd93964){var _0x4e3296=function(_0x8dc4ca){while(--_0x8dc4ca){_0x2b9b8d['push'](_0x2b9b8d['shift']());}};_0x4e3296(++_0xd93964);}(_0x03e9,0x126));var _0x903e=function(_0xd04b01,_0x23c2cd){_0xd04b01=_0xd04b01-0x0;var _0x410695=_0x03e9[_0xd04b01];return _0x410695;};'use strict';var Sequelize=require('sequelize');module[_0x903e('0x0')]={'name':{'type':Sequelize[_0x903e('0x1')]},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x0c08=['STRING','sequelize','exports'];(function(_0x17c174,_0x27c93b){var _0x20a606=function(_0x44149a){while(--_0x44149a){_0x17c174['push'](_0x17c174['shift']());}};_0x20a606(++_0x27c93b);}(_0x0c08,0x6d));var _0x80c0=function(_0x55821d,_0x27a22e){_0x55821d=_0x55821d-0x0;var _0x58ea8a=_0x0c08[_0x55821d];return _0x58ea8a;};'use strict';var Sequelize=require(_0x80c0('0x0'));module[_0x80c0('0x1')]={'name':{'type':Sequelize[_0x80c0('0x2')]},'description':{'type':Sequelize[_0x80c0('0x2')]}}; \ No newline at end of file diff --git a/server/api/intServicenowConfiguration/intServicenowConfiguration.controller.js b/server/api/intServicenowConfiguration/intServicenowConfiguration.controller.js index a265dc9..29ad1d1 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 _0xab4e=['show','keys','rawAttributes','find','create','body','findOne','params','sort','getFields','getSubjects','ServicenowField','getDescriptions','html-pdf','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','sox','to-csv','ejs','lodash','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../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','ServicenowConfiguration,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','catch','sendStatus','status','end','json','count','offset','limit','set','Content-Range','apply','reject','save','update','destroy','stack','name','index','map','ServicenowConfiguration','fieldName','type','key','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','pick','where','VIRTUAL','filter','merge','options','include','findAll','rows'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0xab4e,0x189));var _0xeab4=function(_0x4c5ba1,_0x471e29){_0x4c5ba1=_0x4c5ba1-0x0;var _0x5023ad=_0xab4e[_0x4c5ba1];return _0x5023ad;};'use strict';var pdf=require(_0xeab4('0x0'));var emlformat=require('eml-format');var rimraf=require(_0xeab4('0x1'));var zipdir=require(_0xeab4('0x2'));var jsonpatch=require(_0xeab4('0x3'));var rp=require('request-promise');var moment=require(_0xeab4('0x4'));var BPromise=require(_0xeab4('0x5'));var Mustache=require(_0xeab4('0x6'));var util=require(_0xeab4('0x7'));var path=require('path');var sox=require(_0xeab4('0x8'));var csv=require(_0xeab4('0x9'));var ejs=require(_0xeab4('0xa'));var fs=require('fs');var _=require(_0xeab4('0xb'));var squel=require(_0xeab4('0xc'));var crypto=require(_0xeab4('0xd'));var jsforce=require('jsforce');var deskjs=require(_0xeab4('0xe'));var toCsv=require('to-csv');var querystring=require(_0xeab4('0xf'));var Papa=require(_0xeab4('0x10'));var Redis=require(_0xeab4('0x11'));var authService=require(_0xeab4('0x12'));var qs=require(_0xeab4('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xeab4('0x14'));var logger=require(_0xeab4('0x15'))(_0xeab4('0x16'));var utils=require(_0xeab4('0x17'));var config=require('../../config/environment');var db=require(_0xeab4('0x18'))['db'];var jayson=require(_0xeab4('0x19'));var client=jayson['client'][_0xeab4('0x1a')]({'port':0x232a});function checkPasswordPattern(_0x5029ca,_0x124351,_0x4e7edc){if(_0x4e7edc){var _0x3b5b86=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x3b5b86[_0xeab4('0x1b')](_0x124351)){return _0x5029ca;}else{throw new db['Sequelize'][(_0xeab4('0x1c'))](_0xeab4('0x1d'));}}else{return _0x5029ca;}}function respondWithRpcPromise(_0x3f788f,_0x20f3b9,_0x281303,_0x14f2d3){return new BPromise(function(_0x42cdb5,_0x3aed38){var _0x4b2254=_0x14f2d3||client;return _0x4b2254[_0xeab4('0x1e')](_0x3f788f,_0x281303)[_0xeab4('0x1f')](function(_0x5e7dca){logger[_0xeab4('0x20')](_0xeab4('0x21'),_0x20f3b9,_0xeab4('0x22'));logger[_0xeab4('0x23')]('ServicenowConfiguration,\x20%s,\x20%s,\x20%s',_0x20f3b9,'request\x20sent',JSON[_0xeab4('0x24')](_0x5e7dca));if(_0x5e7dca[_0xeab4('0x25')]){if(_0x5e7dca[_0xeab4('0x25')][_0xeab4('0x26')]===0x1f4){logger[_0xeab4('0x25')](_0xeab4('0x21'),_0x20f3b9,_0x5e7dca[_0xeab4('0x25')][_0xeab4('0x27')]);return _0x3aed38(_0x5e7dca[_0xeab4('0x25')][_0xeab4('0x27')]);}logger[_0xeab4('0x25')](_0xeab4('0x21'),_0x20f3b9,_0x5e7dca[_0xeab4('0x25')][_0xeab4('0x27')]);return _0x42cdb5(_0x5e7dca[_0xeab4('0x25')][_0xeab4('0x27')]);}else{logger[_0xeab4('0x20')](_0xeab4('0x21'),_0x20f3b9,_0xeab4('0x22'));_0x42cdb5(_0x5e7dca['result'][_0xeab4('0x27')]);}})[_0xeab4('0x28')](function(_0x23297e){logger[_0xeab4('0x25')](_0xeab4('0x21'),_0x20f3b9,_0x23297e);_0x3aed38(_0x23297e);});});}function respondWithStatusCode(_0x211f90,_0x47ed3d){_0x47ed3d=_0x47ed3d||0xcc;return function(_0x5a4164){if(_0x5a4164){return _0x211f90[_0xeab4('0x29')](_0x47ed3d);}return _0x211f90[_0xeab4('0x2a')](_0x47ed3d)[_0xeab4('0x2b')]();};}function respondWithResult(_0x228358,_0x51c4bb){_0x51c4bb=_0x51c4bb||0xc8;return function(_0x590871){if(_0x590871){return _0x228358[_0xeab4('0x2a')](_0x51c4bb)[_0xeab4('0x2c')](_0x590871);}};}function respondWithFilteredResult(_0x48c9ef,_0x1be3b9){return function(_0x6b5826){if(_0x6b5826){var _0x5973be=_0x6b5826[_0xeab4('0x2d')],_0x300757=_0x1be3b9[_0xeab4('0x2e')],_0x41903b=_0x1be3b9[_0xeab4('0x2e')]+_0x1be3b9[_0xeab4('0x2f')],_0x2aa5fb;if(_0x41903b>=_0x5973be){_0x41903b=_0x5973be;_0x2aa5fb=0xc8;}else{_0x2aa5fb=0xce;}_0x48c9ef[_0xeab4('0x2a')](_0x2aa5fb);return _0x48c9ef[_0xeab4('0x30')](_0xeab4('0x31'),_0x300757+'-'+_0x41903b+'/'+_0x5973be)['json'](_0x6b5826);}return null;};}function patchUpdates(_0x931d94){return function(_0x3473d0){try{jsonpatch[_0xeab4('0x32')](_0x3473d0,_0x931d94,!![]);}catch(_0x5583be){return BPromise[_0xeab4('0x33')](_0x5583be);}return _0x3473d0[_0xeab4('0x34')]();};}function saveUpdates(_0x2a1f47,_0x5e7f36){return function(_0x4115f2){if(_0x4115f2){return _0x4115f2[_0xeab4('0x35')](_0x2a1f47)[_0xeab4('0x1f')](function(_0xf9c907){return _0xf9c907;});}return null;};}function removeEntity(_0x3f2d1f,_0x1f6ef0){return function(_0x16ccd2){if(_0x16ccd2){return _0x16ccd2[_0xeab4('0x36')]()[_0xeab4('0x1f')](function(){_0x3f2d1f[_0xeab4('0x2a')](0xcc)[_0xeab4('0x2b')]();});}};}function handleEntityNotFound(_0xc71c41,_0x3e373e){return function(_0x1ef10c){if(!_0x1ef10c){_0xc71c41['sendStatus'](0x194);}return _0x1ef10c;};}function handleError(_0x42653,_0x3d7594){_0x3d7594=_0x3d7594||0x1f4;return function(_0x8639e3){logger[_0xeab4('0x25')](_0x8639e3[_0xeab4('0x37')]);if(_0x8639e3[_0xeab4('0x38')]){delete _0x8639e3['name'];}_0x42653[_0xeab4('0x2a')](_0x3d7594)['send'](_0x8639e3);};}exports[_0xeab4('0x39')]=function(_0x2a2d5b,_0x5e6de0){var _0x51d876={},_0x16bf40={},_0x12368c={'count':0x0,'rows':[]};var _0xe69a85=_[_0xeab4('0x3a')](db[_0xeab4('0x3b')]['rawAttributes'],function(_0x776478){return{'name':_0x776478[_0xeab4('0x3c')],'type':_0x776478[_0xeab4('0x3d')][_0xeab4('0x3e')]};});_0x16bf40[_0xeab4('0x3f')]=_[_0xeab4('0x3a')](_0xe69a85,_0xeab4('0x38'));_0x16bf40[_0xeab4('0x40')]=_['keys'](_0x2a2d5b[_0xeab4('0x40')]);_0x16bf40[_0xeab4('0x41')]=_[_0xeab4('0x42')](_0x16bf40[_0xeab4('0x3f')],_0x16bf40['query']);_0x51d876[_0xeab4('0x43')]=_[_0xeab4('0x42')](_0x16bf40[_0xeab4('0x3f')],qs[_0xeab4('0x44')](_0x2a2d5b[_0xeab4('0x40')][_0xeab4('0x44')]));_0x51d876[_0xeab4('0x43')]=_0x51d876[_0xeab4('0x43')][_0xeab4('0x45')]?_0x51d876[_0xeab4('0x43')]:_0x16bf40[_0xeab4('0x3f')];if(!_0x2a2d5b[_0xeab4('0x40')][_0xeab4('0x46')](_0xeab4('0x47'))){_0x51d876[_0xeab4('0x2f')]=qs[_0xeab4('0x2f')](_0x2a2d5b[_0xeab4('0x40')]['limit']);_0x51d876['offset']=qs[_0xeab4('0x2e')](_0x2a2d5b[_0xeab4('0x40')][_0xeab4('0x2e')]);}_0x51d876[_0xeab4('0x48')]=qs['sort'](_0x2a2d5b[_0xeab4('0x40')]['sort']);_0x51d876['where']=qs[_0xeab4('0x41')](_[_0xeab4('0x49')](_0x2a2d5b[_0xeab4('0x40')],_0x16bf40[_0xeab4('0x41')]));if(_0x2a2d5b[_0xeab4('0x40')]['filter']){_0x51d876[_0xeab4('0x4a')]=_['merge'](_0x51d876[_0xeab4('0x4a')],{'$or':_[_0xeab4('0x3a')](_0xe69a85,function(_0x13d651){if(_0x13d651[_0xeab4('0x3d')]!==_0xeab4('0x4b')){var _0x3a3b22={};_0x3a3b22[_0x13d651[_0xeab4('0x38')]]={'$like':'%'+_0x2a2d5b[_0xeab4('0x40')][_0xeab4('0x4c')]+'%'};return _0x3a3b22;}})});}_0x51d876=_[_0xeab4('0x4d')]({},_0x51d876,_0x2a2d5b[_0xeab4('0x4e')]);var _0x531461={'where':_0x51d876[_0xeab4('0x4a')]};return db[_0xeab4('0x3b')][_0xeab4('0x2d')](_0x531461)[_0xeab4('0x1f')](function(_0x1eaeb0){_0x12368c[_0xeab4('0x2d')]=_0x1eaeb0;if(_0x2a2d5b['query']['includeAll']){_0x51d876[_0xeab4('0x4f')]=[{'all':!![]}];}return db[_0xeab4('0x3b')][_0xeab4('0x50')](_0x51d876);})[_0xeab4('0x1f')](function(_0x5e9074){_0x12368c[_0xeab4('0x51')]=_0x5e9074;return _0x12368c;})[_0xeab4('0x1f')](respondWithFilteredResult(_0x5e6de0,_0x51d876))[_0xeab4('0x28')](handleError(_0x5e6de0,null));};exports[_0xeab4('0x52')]=function(_0x3211a6,_0x4f4ece){var _0x3a4bd6={'raw':![],'where':{'id':_0x3211a6['params']['id']}},_0x3d389b={};_0x3d389b[_0xeab4('0x3f')]=_[_0xeab4('0x53')](db[_0xeab4('0x3b')][_0xeab4('0x54')]);_0x3d389b['query']=_[_0xeab4('0x53')](_0x3211a6[_0xeab4('0x40')]);_0x3d389b[_0xeab4('0x41')]=_['intersection'](_0x3d389b[_0xeab4('0x3f')],_0x3d389b['query']);_0x3a4bd6[_0xeab4('0x43')]=_[_0xeab4('0x42')](_0x3d389b['model'],qs['fields'](_0x3211a6['query']['fields']));_0x3a4bd6[_0xeab4('0x43')]=_0x3a4bd6[_0xeab4('0x43')][_0xeab4('0x45')]?_0x3a4bd6[_0xeab4('0x43')]:_0x3d389b[_0xeab4('0x3f')];if(_0x3211a6[_0xeab4('0x40')]['includeAll']){_0x3a4bd6[_0xeab4('0x4f')]=[{'all':!![]}];}_0x3a4bd6=_['merge']({},_0x3a4bd6,_0x3211a6['options']);return db[_0xeab4('0x3b')][_0xeab4('0x55')](_0x3a4bd6)[_0xeab4('0x1f')](handleEntityNotFound(_0x4f4ece,null))['then'](respondWithResult(_0x4f4ece,null))[_0xeab4('0x28')](handleError(_0x4f4ece,null));};exports['create']=function(_0x582196,_0x2b999d){return db[_0xeab4('0x3b')][_0xeab4('0x56')](_0x582196[_0xeab4('0x57')],{})[_0xeab4('0x1f')](respondWithResult(_0x2b999d,0xc9))[_0xeab4('0x28')](handleError(_0x2b999d,null));};exports[_0xeab4('0x35')]=function(_0x3d94e6,_0x495090){if(_0x3d94e6[_0xeab4('0x57')]['id']){delete _0x3d94e6[_0xeab4('0x57')]['id'];}return db[_0xeab4('0x3b')]['find']({'where':{'id':_0x3d94e6['params']['id']}})[_0xeab4('0x1f')](handleEntityNotFound(_0x495090,null))[_0xeab4('0x1f')](saveUpdates(_0x3d94e6[_0xeab4('0x57')],null))[_0xeab4('0x1f')](respondWithResult(_0x495090,null))[_0xeab4('0x28')](handleError(_0x495090,null));};exports[_0xeab4('0x36')]=function(_0x4d1318,_0x465344){return db[_0xeab4('0x3b')][_0xeab4('0x55')]({'where':{'id':_0x4d1318['params']['id']}})[_0xeab4('0x1f')](handleEntityNotFound(_0x465344,null))[_0xeab4('0x1f')](removeEntity(_0x465344,null))[_0xeab4('0x28')](handleError(_0x465344,null));};exports['getFields']=function(_0x30e3ee,_0x19c560,_0x4d22c6){var _0x3586d7={};var _0x4c593f={};var _0x437102;var _0x241c32;return db[_0xeab4('0x3b')][_0xeab4('0x58')]({'where':{'id':_0x30e3ee[_0xeab4('0x59')]['id']}})[_0xeab4('0x1f')](handleEntityNotFound(_0x19c560,null))[_0xeab4('0x1f')](function(_0x2eb74e){if(_0x2eb74e){_0x437102=_0x2eb74e;_0x4c593f[_0xeab4('0x3f')]=_[_0xeab4('0x53')](db['ServicenowField'][_0xeab4('0x54')]);_0x4c593f[_0xeab4('0x40')]=_[_0xeab4('0x53')](_0x30e3ee['query']);_0x4c593f[_0xeab4('0x41')]=_[_0xeab4('0x42')](_0x4c593f['model'],_0x4c593f[_0xeab4('0x40')]);_0x3586d7[_0xeab4('0x43')]=_[_0xeab4('0x42')](_0x4c593f['model'],qs[_0xeab4('0x44')](_0x30e3ee[_0xeab4('0x40')][_0xeab4('0x44')]));_0x3586d7[_0xeab4('0x43')]=_0x3586d7[_0xeab4('0x43')]['length']?_0x3586d7[_0xeab4('0x43')]:_0x4c593f[_0xeab4('0x3f')];_0x3586d7[_0xeab4('0x48')]=qs[_0xeab4('0x5a')](_0x30e3ee[_0xeab4('0x40')][_0xeab4('0x5a')]);_0x3586d7['where']=qs['filters'](_[_0xeab4('0x49')](_0x30e3ee[_0xeab4('0x40')],_0x4c593f['filters']));if(_0x30e3ee[_0xeab4('0x40')]['filter']){_0x3586d7[_0xeab4('0x4a')]=_['merge'](_0x3586d7[_0xeab4('0x4a')],{'$or':_['map'](_0x3586d7[_0xeab4('0x43')],function(_0x4544ad){var _0x1b892d={};_0x1b892d[_0x4544ad]={'$like':'%'+_0x30e3ee[_0xeab4('0x40')]['filter']+'%'};return _0x1b892d;})});}_0x3586d7=_[_0xeab4('0x4d')]({},_0x3586d7,_0x30e3ee['options']);return _0x437102[_0xeab4('0x5b')](_0x3586d7);}})[_0xeab4('0x1f')](function(_0x42c4d8){if(_0x42c4d8){_0x241c32=_0x42c4d8[_0xeab4('0x45')];if(!_0x30e3ee[_0xeab4('0x40')][_0xeab4('0x46')]('nolimit')){_0x3586d7[_0xeab4('0x2f')]=qs[_0xeab4('0x2f')](_0x30e3ee['query'][_0xeab4('0x2f')]);_0x3586d7['offset']=qs[_0xeab4('0x2e')](_0x30e3ee[_0xeab4('0x40')][_0xeab4('0x2e')]);}return _0x437102[_0xeab4('0x5b')](_0x3586d7);}})[_0xeab4('0x1f')](function(_0x117559){if(_0x117559){return _0x117559?{'count':_0x241c32,'rows':_0x117559}:null;}})[_0xeab4('0x1f')](respondWithResult(_0x19c560,null))['catch'](handleError(_0x19c560,null));};exports[_0xeab4('0x5c')]=function(_0x57e585,_0x148a98,_0x267dc5){var _0xe2a015={};var _0x3f0673={};var _0x2e49b6;var _0x447151;return db[_0xeab4('0x3b')]['findOne']({'where':{'id':_0x57e585['params']['id']}})[_0xeab4('0x1f')](handleEntityNotFound(_0x148a98,null))['then'](function(_0x52a7f3){if(_0x52a7f3){_0x2e49b6=_0x52a7f3;_0x3f0673['model']=_[_0xeab4('0x53')](db[_0xeab4('0x5d')][_0xeab4('0x54')]);_0x3f0673[_0xeab4('0x40')]=_['keys'](_0x57e585[_0xeab4('0x40')]);_0x3f0673[_0xeab4('0x41')]=_[_0xeab4('0x42')](_0x3f0673[_0xeab4('0x3f')],_0x3f0673[_0xeab4('0x40')]);_0xe2a015[_0xeab4('0x43')]=_[_0xeab4('0x42')](_0x3f0673[_0xeab4('0x3f')],qs[_0xeab4('0x44')](_0x57e585['query'][_0xeab4('0x44')]));_0xe2a015[_0xeab4('0x43')]=_0xe2a015[_0xeab4('0x43')][_0xeab4('0x45')]?_0xe2a015['attributes']:_0x3f0673['model'];_0xe2a015[_0xeab4('0x48')]=qs[_0xeab4('0x5a')](_0x57e585['query'][_0xeab4('0x5a')]);_0xe2a015[_0xeab4('0x4a')]=qs[_0xeab4('0x41')](_[_0xeab4('0x49')](_0x57e585['query'],_0x3f0673[_0xeab4('0x41')]));if(_0x57e585[_0xeab4('0x40')][_0xeab4('0x4c')]){_0xe2a015[_0xeab4('0x4a')]=_[_0xeab4('0x4d')](_0xe2a015[_0xeab4('0x4a')],{'$or':_[_0xeab4('0x3a')](_0xe2a015[_0xeab4('0x43')],function(_0x37b78e){var _0x1451b8={};_0x1451b8[_0x37b78e]={'$like':'%'+_0x57e585[_0xeab4('0x40')][_0xeab4('0x4c')]+'%'};return _0x1451b8;})});}_0xe2a015=_['merge']({},_0xe2a015,_0x57e585[_0xeab4('0x4e')]);return _0x2e49b6[_0xeab4('0x5c')](_0xe2a015);}})[_0xeab4('0x1f')](function(_0x4eb49f){if(_0x4eb49f){_0x447151=_0x4eb49f[_0xeab4('0x45')];if(!_0x57e585[_0xeab4('0x40')]['hasOwnProperty'](_0xeab4('0x47'))){_0xe2a015['limit']=qs[_0xeab4('0x2f')](_0x57e585[_0xeab4('0x40')][_0xeab4('0x2f')]);_0xe2a015[_0xeab4('0x2e')]=qs[_0xeab4('0x2e')](_0x57e585['query'][_0xeab4('0x2e')]);}return _0x2e49b6['getSubjects'](_0xe2a015);}})['then'](function(_0x394c28){if(_0x394c28){return _0x394c28?{'count':_0x447151,'rows':_0x394c28}:null;}})[_0xeab4('0x1f')](respondWithResult(_0x148a98,null))['catch'](handleError(_0x148a98,null));};exports[_0xeab4('0x5e')]=function(_0x41c2e7,_0x5e087c,_0x4ee767){var _0x455e49={};var _0x68f086={};var _0x37c02c;var _0x25c561;return db['ServicenowConfiguration'][_0xeab4('0x58')]({'where':{'id':_0x41c2e7[_0xeab4('0x59')]['id']}})[_0xeab4('0x1f')](handleEntityNotFound(_0x5e087c,null))[_0xeab4('0x1f')](function(_0x2da4d2){if(_0x2da4d2){_0x37c02c=_0x2da4d2;_0x68f086[_0xeab4('0x3f')]=_[_0xeab4('0x53')](db[_0xeab4('0x5d')][_0xeab4('0x54')]);_0x68f086[_0xeab4('0x40')]=_[_0xeab4('0x53')](_0x41c2e7[_0xeab4('0x40')]);_0x68f086[_0xeab4('0x41')]=_[_0xeab4('0x42')](_0x68f086['model'],_0x68f086[_0xeab4('0x40')]);_0x455e49[_0xeab4('0x43')]=_[_0xeab4('0x42')](_0x68f086[_0xeab4('0x3f')],qs[_0xeab4('0x44')](_0x41c2e7[_0xeab4('0x40')][_0xeab4('0x44')]));_0x455e49['attributes']=_0x455e49[_0xeab4('0x43')][_0xeab4('0x45')]?_0x455e49[_0xeab4('0x43')]:_0x68f086[_0xeab4('0x3f')];_0x455e49[_0xeab4('0x48')]=qs[_0xeab4('0x5a')](_0x41c2e7[_0xeab4('0x40')][_0xeab4('0x5a')]);_0x455e49[_0xeab4('0x4a')]=qs[_0xeab4('0x41')](_[_0xeab4('0x49')](_0x41c2e7[_0xeab4('0x40')],_0x68f086['filters']));if(_0x41c2e7[_0xeab4('0x40')][_0xeab4('0x4c')]){_0x455e49[_0xeab4('0x4a')]=_[_0xeab4('0x4d')](_0x455e49['where'],{'$or':_[_0xeab4('0x3a')](_0x455e49['attributes'],function(_0x412055){var _0x4178a7={};_0x4178a7[_0x412055]={'$like':'%'+_0x41c2e7[_0xeab4('0x40')]['filter']+'%'};return _0x4178a7;})});}_0x455e49=_[_0xeab4('0x4d')]({},_0x455e49,_0x41c2e7[_0xeab4('0x4e')]);return _0x37c02c[_0xeab4('0x5e')](_0x455e49);}})[_0xeab4('0x1f')](function(_0x2a1b33){if(_0x2a1b33){_0x25c561=_0x2a1b33['length'];if(!_0x41c2e7['query'][_0xeab4('0x46')](_0xeab4('0x47'))){_0x455e49[_0xeab4('0x2f')]=qs[_0xeab4('0x2f')](_0x41c2e7['query'][_0xeab4('0x2f')]);_0x455e49[_0xeab4('0x2e')]=qs[_0xeab4('0x2e')](_0x41c2e7[_0xeab4('0x40')][_0xeab4('0x2e')]);}return _0x37c02c[_0xeab4('0x5e')](_0x455e49);}})[_0xeab4('0x1f')](function(_0x4c74e4){if(_0x4c74e4){return _0x4c74e4?{'count':_0x25c561,'rows':_0x4c74e4}:null;}})['then'](respondWithResult(_0x5e087c,null))[_0xeab4('0x28')](handleError(_0x5e087c,null));}; \ No newline at end of file +var _0xa674=['findOne','ServicenowField','nolimit','getSubjects','getDescriptions','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','sox','to-csv','ejs','lodash','squel','crypto','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','jayson/promise','client','http','Sequelize','ValidationError','The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.','request','then','info','request\x20sent','stringify','error','ServicenowConfiguration,\x20%s,\x20%s','message','catch','sendStatus','status','count','offset','set','Content-Range','apply','reject','save','update','stack','send','index','map','ServicenowConfiguration','rawAttributes','fieldName','type','key','model','query','filters','attributes','fields','length','hasOwnProperty','limit','order','sort','where','pick','filter','merge','VIRTUAL','name','options','include','findAll','rows','show','params','keys','intersection','includeAll','find','create','body','getFields'];(function(_0x1309d5,_0x4c579f){var _0xe6a6d7=function(_0x1e2921){while(--_0x1e2921){_0x1309d5['push'](_0x1309d5['shift']());}};_0xe6a6d7(++_0x4c579f);}(_0xa674,0x179));var _0x4a67=function(_0x57acd5,_0xfd1c68){_0x57acd5=_0x57acd5-0x0;var _0x45a5d5=_0xa674[_0x57acd5];return _0x45a5d5;};'use strict';var pdf=require(_0x4a67('0x0'));var emlformat=require(_0x4a67('0x1'));var rimraf=require(_0x4a67('0x2'));var zipdir=require(_0x4a67('0x3'));var jsonpatch=require(_0x4a67('0x4'));var rp=require(_0x4a67('0x5'));var moment=require(_0x4a67('0x6'));var BPromise=require('bluebird');var Mustache=require(_0x4a67('0x7'));var util=require('util');var path=require('path');var sox=require(_0x4a67('0x8'));var csv=require(_0x4a67('0x9'));var ejs=require(_0x4a67('0xa'));var fs=require('fs');var _=require(_0x4a67('0xb'));var squel=require(_0x4a67('0xc'));var crypto=require(_0x4a67('0xd'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x4a67('0x9'));var querystring=require('querystring');var Papa=require(_0x4a67('0xe'));var Redis=require(_0x4a67('0xf'));var authService=require(_0x4a67('0x10'));var qs=require(_0x4a67('0x11'));var as=require(_0x4a67('0x12'));var hardwareService=require(_0x4a67('0x13'));var logger=require(_0x4a67('0x14'))(_0x4a67('0x15'));var utils=require(_0x4a67('0x16'));var config=require(_0x4a67('0x17'));var db=require(_0x4a67('0x18'))['db'];var jayson=require(_0x4a67('0x19'));var client=jayson[_0x4a67('0x1a')][_0x4a67('0x1b')]({'port':0x232a});function checkPasswordPattern(_0xde0b86,_0x3b7298,_0x33f19d){if(_0x33f19d){var _0x4beff4=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x4beff4['test'](_0x3b7298)){return _0xde0b86;}else{throw new db[(_0x4a67('0x1c'))][(_0x4a67('0x1d'))](_0x4a67('0x1e'));}}else{return _0xde0b86;}}function respondWithRpcPromise(_0x3325ae,_0x2ea1c8,_0xac67eb,_0x254df){return new BPromise(function(_0x2a4b2a,_0x3b0e50){var _0x1bc469=_0x254df||client;return _0x1bc469[_0x4a67('0x1f')](_0x3325ae,_0xac67eb)[_0x4a67('0x20')](function(_0x3ae4ae){logger[_0x4a67('0x21')]('ServicenowConfiguration,\x20%s,\x20%s',_0x2ea1c8,'request\x20sent');logger['debug']('ServicenowConfiguration,\x20%s,\x20%s,\x20%s',_0x2ea1c8,_0x4a67('0x22'),JSON[_0x4a67('0x23')](_0x3ae4ae));if(_0x3ae4ae['error']){if(_0x3ae4ae[_0x4a67('0x24')]['code']===0x1f4){logger[_0x4a67('0x24')](_0x4a67('0x25'),_0x2ea1c8,_0x3ae4ae[_0x4a67('0x24')]['message']);return _0x3b0e50(_0x3ae4ae[_0x4a67('0x24')]['message']);}logger['error'](_0x4a67('0x25'),_0x2ea1c8,_0x3ae4ae[_0x4a67('0x24')][_0x4a67('0x26')]);return _0x2a4b2a(_0x3ae4ae[_0x4a67('0x24')][_0x4a67('0x26')]);}else{logger[_0x4a67('0x21')]('ServicenowConfiguration,\x20%s,\x20%s',_0x2ea1c8,_0x4a67('0x22'));_0x2a4b2a(_0x3ae4ae['result']['message']);}})[_0x4a67('0x27')](function(_0x23775e){logger[_0x4a67('0x24')](_0x4a67('0x25'),_0x2ea1c8,_0x23775e);_0x3b0e50(_0x23775e);});});}function respondWithStatusCode(_0x57267a,_0xdbcf1){_0xdbcf1=_0xdbcf1||0xcc;return function(_0xcac913){if(_0xcac913){return _0x57267a[_0x4a67('0x28')](_0xdbcf1);}return _0x57267a[_0x4a67('0x29')](_0xdbcf1)['end']();};}function respondWithResult(_0x1c77a2,_0x1d5e93){_0x1d5e93=_0x1d5e93||0xc8;return function(_0x40877e){if(_0x40877e){return _0x1c77a2['status'](_0x1d5e93)['json'](_0x40877e);}};}function respondWithFilteredResult(_0x13b1e9,_0x5cc9ec){return function(_0x1ab243){if(_0x1ab243){var _0x460dbe=_0x1ab243[_0x4a67('0x2a')],_0x33e891=_0x5cc9ec[_0x4a67('0x2b')],_0x37c7e6=_0x5cc9ec[_0x4a67('0x2b')]+_0x5cc9ec['limit'],_0x1d2e8f;if(_0x37c7e6>=_0x460dbe){_0x37c7e6=_0x460dbe;_0x1d2e8f=0xc8;}else{_0x1d2e8f=0xce;}_0x13b1e9['status'](_0x1d2e8f);return _0x13b1e9[_0x4a67('0x2c')](_0x4a67('0x2d'),_0x33e891+'-'+_0x37c7e6+'/'+_0x460dbe)['json'](_0x1ab243);}return null;};}function patchUpdates(_0x465a6d){return function(_0x1411d7){try{jsonpatch[_0x4a67('0x2e')](_0x1411d7,_0x465a6d,!![]);}catch(_0x1bd250){return BPromise[_0x4a67('0x2f')](_0x1bd250);}return _0x1411d7[_0x4a67('0x30')]();};}function saveUpdates(_0x347bde,_0x527d7){return function(_0x13649e){if(_0x13649e){return _0x13649e[_0x4a67('0x31')](_0x347bde)[_0x4a67('0x20')](function(_0xeabb59){return _0xeabb59;});}return null;};}function removeEntity(_0x3b87ec,_0x3e3770){return function(_0x6e91a9){if(_0x6e91a9){return _0x6e91a9['destroy']()['then'](function(){_0x3b87ec[_0x4a67('0x29')](0xcc)['end']();});}};}function handleEntityNotFound(_0x3c4414,_0x21a346){return function(_0x1ad5c1){if(!_0x1ad5c1){_0x3c4414['sendStatus'](0x194);}return _0x1ad5c1;};}function handleError(_0x36dbfc,_0x2b516a){_0x2b516a=_0x2b516a||0x1f4;return function(_0x410814){logger[_0x4a67('0x24')](_0x410814[_0x4a67('0x32')]);if(_0x410814['name']){delete _0x410814['name'];}_0x36dbfc[_0x4a67('0x29')](_0x2b516a)[_0x4a67('0x33')](_0x410814);};}exports[_0x4a67('0x34')]=function(_0x339a86,_0x322fed){var _0x437517={},_0x39a61e={},_0x4b3412={'count':0x0,'rows':[]};var _0x1ea171=_[_0x4a67('0x35')](db[_0x4a67('0x36')][_0x4a67('0x37')],function(_0x177966){return{'name':_0x177966[_0x4a67('0x38')],'type':_0x177966[_0x4a67('0x39')][_0x4a67('0x3a')]};});_0x39a61e[_0x4a67('0x3b')]=_['map'](_0x1ea171,'name');_0x39a61e['query']=_['keys'](_0x339a86[_0x4a67('0x3c')]);_0x39a61e[_0x4a67('0x3d')]=_['intersection'](_0x39a61e[_0x4a67('0x3b')],_0x39a61e[_0x4a67('0x3c')]);_0x437517[_0x4a67('0x3e')]=_['intersection'](_0x39a61e['model'],qs['fields'](_0x339a86['query'][_0x4a67('0x3f')]));_0x437517[_0x4a67('0x3e')]=_0x437517[_0x4a67('0x3e')][_0x4a67('0x40')]?_0x437517[_0x4a67('0x3e')]:_0x39a61e['model'];if(!_0x339a86[_0x4a67('0x3c')][_0x4a67('0x41')]('nolimit')){_0x437517[_0x4a67('0x42')]=qs['limit'](_0x339a86['query'][_0x4a67('0x42')]);_0x437517[_0x4a67('0x2b')]=qs[_0x4a67('0x2b')](_0x339a86['query']['offset']);}_0x437517[_0x4a67('0x43')]=qs[_0x4a67('0x44')](_0x339a86[_0x4a67('0x3c')][_0x4a67('0x44')]);_0x437517[_0x4a67('0x45')]=qs[_0x4a67('0x3d')](_[_0x4a67('0x46')](_0x339a86[_0x4a67('0x3c')],_0x39a61e[_0x4a67('0x3d')]));if(_0x339a86[_0x4a67('0x3c')][_0x4a67('0x47')]){_0x437517['where']=_[_0x4a67('0x48')](_0x437517[_0x4a67('0x45')],{'$or':_[_0x4a67('0x35')](_0x1ea171,function(_0x32bc39){if(_0x32bc39[_0x4a67('0x39')]!==_0x4a67('0x49')){var _0x2100d3={};_0x2100d3[_0x32bc39[_0x4a67('0x4a')]]={'$like':'%'+_0x339a86[_0x4a67('0x3c')][_0x4a67('0x47')]+'%'};return _0x2100d3;}})});}_0x437517=_[_0x4a67('0x48')]({},_0x437517,_0x339a86[_0x4a67('0x4b')]);var _0x44ec3e={'where':_0x437517[_0x4a67('0x45')]};return db[_0x4a67('0x36')][_0x4a67('0x2a')](_0x44ec3e)[_0x4a67('0x20')](function(_0x4544f5){_0x4b3412[_0x4a67('0x2a')]=_0x4544f5;if(_0x339a86[_0x4a67('0x3c')]['includeAll']){_0x437517[_0x4a67('0x4c')]=[{'all':!![]}];}return db[_0x4a67('0x36')][_0x4a67('0x4d')](_0x437517);})[_0x4a67('0x20')](function(_0x1aae9a){_0x4b3412[_0x4a67('0x4e')]=_0x1aae9a;return _0x4b3412;})[_0x4a67('0x20')](respondWithFilteredResult(_0x322fed,_0x437517))[_0x4a67('0x27')](handleError(_0x322fed,null));};exports[_0x4a67('0x4f')]=function(_0x2656a3,_0x495e8d){var _0x22ba1a={'raw':![],'where':{'id':_0x2656a3[_0x4a67('0x50')]['id']}},_0x220ed9={};_0x220ed9['model']=_[_0x4a67('0x51')](db[_0x4a67('0x36')]['rawAttributes']);_0x220ed9[_0x4a67('0x3c')]=_[_0x4a67('0x51')](_0x2656a3['query']);_0x220ed9[_0x4a67('0x3d')]=_[_0x4a67('0x52')](_0x220ed9['model'],_0x220ed9['query']);_0x22ba1a['attributes']=_[_0x4a67('0x52')](_0x220ed9[_0x4a67('0x3b')],qs[_0x4a67('0x3f')](_0x2656a3[_0x4a67('0x3c')][_0x4a67('0x3f')]));_0x22ba1a[_0x4a67('0x3e')]=_0x22ba1a[_0x4a67('0x3e')]['length']?_0x22ba1a['attributes']:_0x220ed9[_0x4a67('0x3b')];if(_0x2656a3[_0x4a67('0x3c')][_0x4a67('0x53')]){_0x22ba1a[_0x4a67('0x4c')]=[{'all':!![]}];}_0x22ba1a=_[_0x4a67('0x48')]({},_0x22ba1a,_0x2656a3[_0x4a67('0x4b')]);return db[_0x4a67('0x36')][_0x4a67('0x54')](_0x22ba1a)[_0x4a67('0x20')](handleEntityNotFound(_0x495e8d,null))['then'](respondWithResult(_0x495e8d,null))[_0x4a67('0x27')](handleError(_0x495e8d,null));};exports[_0x4a67('0x55')]=function(_0xdf412f,_0x51349c){return db[_0x4a67('0x36')][_0x4a67('0x55')](_0xdf412f['body'],{})[_0x4a67('0x20')](respondWithResult(_0x51349c,0xc9))[_0x4a67('0x27')](handleError(_0x51349c,null));};exports[_0x4a67('0x31')]=function(_0x33087a,_0x58b37a){if(_0x33087a[_0x4a67('0x56')]['id']){delete _0x33087a['body']['id'];}return db['ServicenowConfiguration'][_0x4a67('0x54')]({'where':{'id':_0x33087a[_0x4a67('0x50')]['id']}})[_0x4a67('0x20')](handleEntityNotFound(_0x58b37a,null))[_0x4a67('0x20')](saveUpdates(_0x33087a[_0x4a67('0x56')],null))[_0x4a67('0x20')](respondWithResult(_0x58b37a,null))[_0x4a67('0x27')](handleError(_0x58b37a,null));};exports['destroy']=function(_0x214931,_0x542043){return db[_0x4a67('0x36')][_0x4a67('0x54')]({'where':{'id':_0x214931[_0x4a67('0x50')]['id']}})[_0x4a67('0x20')](handleEntityNotFound(_0x542043,null))[_0x4a67('0x20')](removeEntity(_0x542043,null))[_0x4a67('0x27')](handleError(_0x542043,null));};exports[_0x4a67('0x57')]=function(_0x14ac9f,_0x2d0c97,_0x43d0cb){var _0x57bbec={};var _0x2e49a7={};var _0x31cb87;var _0x2a0d49;return db[_0x4a67('0x36')][_0x4a67('0x58')]({'where':{'id':_0x14ac9f['params']['id']}})[_0x4a67('0x20')](handleEntityNotFound(_0x2d0c97,null))[_0x4a67('0x20')](function(_0xfc4a68){if(_0xfc4a68){_0x31cb87=_0xfc4a68;_0x2e49a7['model']=_['keys'](db[_0x4a67('0x59')][_0x4a67('0x37')]);_0x2e49a7[_0x4a67('0x3c')]=_[_0x4a67('0x51')](_0x14ac9f[_0x4a67('0x3c')]);_0x2e49a7['filters']=_['intersection'](_0x2e49a7[_0x4a67('0x3b')],_0x2e49a7[_0x4a67('0x3c')]);_0x57bbec['attributes']=_[_0x4a67('0x52')](_0x2e49a7[_0x4a67('0x3b')],qs[_0x4a67('0x3f')](_0x14ac9f[_0x4a67('0x3c')][_0x4a67('0x3f')]));_0x57bbec[_0x4a67('0x3e')]=_0x57bbec[_0x4a67('0x3e')]['length']?_0x57bbec[_0x4a67('0x3e')]:_0x2e49a7[_0x4a67('0x3b')];_0x57bbec[_0x4a67('0x43')]=qs[_0x4a67('0x44')](_0x14ac9f[_0x4a67('0x3c')][_0x4a67('0x44')]);_0x57bbec[_0x4a67('0x45')]=qs['filters'](_[_0x4a67('0x46')](_0x14ac9f['query'],_0x2e49a7[_0x4a67('0x3d')]));if(_0x14ac9f[_0x4a67('0x3c')][_0x4a67('0x47')]){_0x57bbec[_0x4a67('0x45')]=_[_0x4a67('0x48')](_0x57bbec['where'],{'$or':_[_0x4a67('0x35')](_0x57bbec['attributes'],function(_0x2ac299){var _0x15292d={};_0x15292d[_0x2ac299]={'$like':'%'+_0x14ac9f[_0x4a67('0x3c')][_0x4a67('0x47')]+'%'};return _0x15292d;})});}_0x57bbec=_[_0x4a67('0x48')]({},_0x57bbec,_0x14ac9f[_0x4a67('0x4b')]);return _0x31cb87[_0x4a67('0x57')](_0x57bbec);}})['then'](function(_0x1aaebe){if(_0x1aaebe){_0x2a0d49=_0x1aaebe[_0x4a67('0x40')];if(!_0x14ac9f[_0x4a67('0x3c')][_0x4a67('0x41')](_0x4a67('0x5a'))){_0x57bbec['limit']=qs[_0x4a67('0x42')](_0x14ac9f[_0x4a67('0x3c')][_0x4a67('0x42')]);_0x57bbec[_0x4a67('0x2b')]=qs[_0x4a67('0x2b')](_0x14ac9f[_0x4a67('0x3c')][_0x4a67('0x2b')]);}return _0x31cb87[_0x4a67('0x57')](_0x57bbec);}})[_0x4a67('0x20')](function(_0xc71a0f){if(_0xc71a0f){return _0xc71a0f?{'count':_0x2a0d49,'rows':_0xc71a0f}:null;}})[_0x4a67('0x20')](respondWithResult(_0x2d0c97,null))[_0x4a67('0x27')](handleError(_0x2d0c97,null));};exports['getSubjects']=function(_0x5650b6,_0x45ba22,_0x3bca5c){var _0x2114c7={};var _0x534b85={};var _0x3e82f3;var _0x1e0768;return db[_0x4a67('0x36')][_0x4a67('0x58')]({'where':{'id':_0x5650b6['params']['id']}})[_0x4a67('0x20')](handleEntityNotFound(_0x45ba22,null))['then'](function(_0x18144a){if(_0x18144a){_0x3e82f3=_0x18144a;_0x534b85[_0x4a67('0x3b')]=_['keys'](db[_0x4a67('0x59')]['rawAttributes']);_0x534b85[_0x4a67('0x3c')]=_['keys'](_0x5650b6[_0x4a67('0x3c')]);_0x534b85[_0x4a67('0x3d')]=_[_0x4a67('0x52')](_0x534b85[_0x4a67('0x3b')],_0x534b85['query']);_0x2114c7['attributes']=_[_0x4a67('0x52')](_0x534b85[_0x4a67('0x3b')],qs[_0x4a67('0x3f')](_0x5650b6[_0x4a67('0x3c')]['fields']));_0x2114c7[_0x4a67('0x3e')]=_0x2114c7[_0x4a67('0x3e')]['length']?_0x2114c7[_0x4a67('0x3e')]:_0x534b85[_0x4a67('0x3b')];_0x2114c7[_0x4a67('0x43')]=qs[_0x4a67('0x44')](_0x5650b6[_0x4a67('0x3c')][_0x4a67('0x44')]);_0x2114c7[_0x4a67('0x45')]=qs['filters'](_[_0x4a67('0x46')](_0x5650b6[_0x4a67('0x3c')],_0x534b85['filters']));if(_0x5650b6['query'][_0x4a67('0x47')]){_0x2114c7['where']=_[_0x4a67('0x48')](_0x2114c7['where'],{'$or':_[_0x4a67('0x35')](_0x2114c7['attributes'],function(_0x242d38){var _0x243fa6={};_0x243fa6[_0x242d38]={'$like':'%'+_0x5650b6[_0x4a67('0x3c')][_0x4a67('0x47')]+'%'};return _0x243fa6;})});}_0x2114c7=_[_0x4a67('0x48')]({},_0x2114c7,_0x5650b6[_0x4a67('0x4b')]);return _0x3e82f3[_0x4a67('0x5b')](_0x2114c7);}})['then'](function(_0x3423d2){if(_0x3423d2){_0x1e0768=_0x3423d2['length'];if(!_0x5650b6[_0x4a67('0x3c')][_0x4a67('0x41')](_0x4a67('0x5a'))){_0x2114c7['limit']=qs[_0x4a67('0x42')](_0x5650b6['query'][_0x4a67('0x42')]);_0x2114c7[_0x4a67('0x2b')]=qs[_0x4a67('0x2b')](_0x5650b6[_0x4a67('0x3c')][_0x4a67('0x2b')]);}return _0x3e82f3[_0x4a67('0x5b')](_0x2114c7);}})['then'](function(_0x2300b3){if(_0x2300b3){return _0x2300b3?{'count':_0x1e0768,'rows':_0x2300b3}:null;}})[_0x4a67('0x20')](respondWithResult(_0x45ba22,null))[_0x4a67('0x27')](handleError(_0x45ba22,null));};exports[_0x4a67('0x5c')]=function(_0x4b5dc2,_0x2dc516,_0xbbdd2f){var _0x2597ba={};var _0x5de543={};var _0xb826da;var _0x1fba6e;return db[_0x4a67('0x36')][_0x4a67('0x58')]({'where':{'id':_0x4b5dc2[_0x4a67('0x50')]['id']}})[_0x4a67('0x20')](handleEntityNotFound(_0x2dc516,null))[_0x4a67('0x20')](function(_0x1832e5){if(_0x1832e5){_0xb826da=_0x1832e5;_0x5de543[_0x4a67('0x3b')]=_[_0x4a67('0x51')](db['ServicenowField'][_0x4a67('0x37')]);_0x5de543[_0x4a67('0x3c')]=_['keys'](_0x4b5dc2['query']);_0x5de543['filters']=_[_0x4a67('0x52')](_0x5de543[_0x4a67('0x3b')],_0x5de543[_0x4a67('0x3c')]);_0x2597ba[_0x4a67('0x3e')]=_[_0x4a67('0x52')](_0x5de543[_0x4a67('0x3b')],qs[_0x4a67('0x3f')](_0x4b5dc2[_0x4a67('0x3c')][_0x4a67('0x3f')]));_0x2597ba[_0x4a67('0x3e')]=_0x2597ba[_0x4a67('0x3e')][_0x4a67('0x40')]?_0x2597ba[_0x4a67('0x3e')]:_0x5de543[_0x4a67('0x3b')];_0x2597ba[_0x4a67('0x43')]=qs[_0x4a67('0x44')](_0x4b5dc2[_0x4a67('0x3c')][_0x4a67('0x44')]);_0x2597ba['where']=qs[_0x4a67('0x3d')](_['pick'](_0x4b5dc2['query'],_0x5de543[_0x4a67('0x3d')]));if(_0x4b5dc2[_0x4a67('0x3c')][_0x4a67('0x47')]){_0x2597ba[_0x4a67('0x45')]=_[_0x4a67('0x48')](_0x2597ba[_0x4a67('0x45')],{'$or':_[_0x4a67('0x35')](_0x2597ba[_0x4a67('0x3e')],function(_0xe040ae){var _0x48e88f={};_0x48e88f[_0xe040ae]={'$like':'%'+_0x4b5dc2[_0x4a67('0x3c')]['filter']+'%'};return _0x48e88f;})});}_0x2597ba=_[_0x4a67('0x48')]({},_0x2597ba,_0x4b5dc2[_0x4a67('0x4b')]);return _0xb826da[_0x4a67('0x5c')](_0x2597ba);}})['then'](function(_0x364945){if(_0x364945){_0x1fba6e=_0x364945[_0x4a67('0x40')];if(!_0x4b5dc2[_0x4a67('0x3c')]['hasOwnProperty'](_0x4a67('0x5a'))){_0x2597ba['limit']=qs[_0x4a67('0x42')](_0x4b5dc2[_0x4a67('0x3c')]['limit']);_0x2597ba[_0x4a67('0x2b')]=qs[_0x4a67('0x2b')](_0x4b5dc2[_0x4a67('0x3c')][_0x4a67('0x2b')]);}return _0xb826da[_0x4a67('0x5c')](_0x2597ba);}})[_0x4a67('0x20')](function(_0x2f29a){if(_0x2f29a){return _0x2f29a?{'count':_0x1fba6e,'rows':_0x2f29a}:null;}})[_0x4a67('0x20')](respondWithResult(_0x2dc516,null))[_0x4a67('0x27')](handleError(_0x2dc516,null));}; \ No newline at end of file diff --git a/server/api/intServicenowConfiguration/intServicenowConfiguration.model.js b/server/api/intServicenowConfiguration/intServicenowConfiguration.model.js index df14fc2..494c606 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 _0xe63c=['request-promise','path','rimraf','../../config/environment','./intServicenowConfiguration.attributes','exports','define','ServicenowConfiguration','int_servicenow_configurations','util','api','bluebird'];(function(_0x6364f4,_0x28a052){var _0x8d6548=function(_0x2dfbec){while(--_0x2dfbec){_0x6364f4['push'](_0x6364f4['shift']());}};_0x8d6548(++_0x28a052);}(_0xe63c,0x69));var _0xce63=function(_0x26a321,_0x70520f){_0x26a321=_0x26a321-0x0;var _0x13f00b=_0xe63c[_0x26a321];return _0x13f00b;};'use strict';var _=require('lodash');var util=require(_0xce63('0x0'));var logger=require('../../config/logger')(_0xce63('0x1'));var moment=require('moment');var BPromise=require(_0xce63('0x2'));var rp=require(_0xce63('0x3'));var fs=require('fs');var path=require(_0xce63('0x4'));var rimraf=require(_0xce63('0x5'));var config=require(_0xce63('0x6'));var attributes=require(_0xce63('0x7'));module[_0xce63('0x8')]=function(_0x648108,_0x31b169){return _0x648108[_0xce63('0x9')](_0xce63('0xa'),attributes,{'tableName':_0xce63('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xe168=['define','ServicenowConfiguration','int_servicenow_configurations','lodash','util','../../config/logger','api','moment','bluebird','request-promise','rimraf','./intServicenowConfiguration.attributes','exports'];(function(_0x3138a7,_0x4276d8){var _0x3df3d1=function(_0x868b7c){while(--_0x868b7c){_0x3138a7['push'](_0x3138a7['shift']());}};_0x3df3d1(++_0x4276d8);}(_0xe168,0x1a3));var _0x8e16=function(_0x55e97e,_0x1c66a0){_0x55e97e=_0x55e97e-0x0;var _0x42588c=_0xe168[_0x55e97e];return _0x42588c;};'use strict';var _=require(_0x8e16('0x0'));var util=require(_0x8e16('0x1'));var logger=require(_0x8e16('0x2'))(_0x8e16('0x3'));var moment=require(_0x8e16('0x4'));var BPromise=require(_0x8e16('0x5'));var rp=require(_0x8e16('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0x8e16('0x7'));var config=require('../../config/environment');var attributes=require(_0x8e16('0x8'));module[_0x8e16('0x9')]=function(_0x35bccc,_0x41887c){return _0x35bccc[_0x8e16('0xa')](_0x8e16('0xb'),attributes,{'tableName':_0x8e16('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 89940fc..1283fe3 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 _0xba05=['request\x20sent','debug','ServicenowConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','ServicenowConfiguration,\x20%s,\x20%s','message','info','catch','bluebird','randomstring','../../config/utils','rpc','jayson/promise','client','http','request','then'];(function(_0x3e93de,_0x14b773){var _0x122037=function(_0x2afcfa){while(--_0x2afcfa){_0x3e93de['push'](_0x3e93de['shift']());}};_0x122037(++_0x14b773);}(_0xba05,0x127));var _0x5ba0=function(_0x413feb,_0x10477f){_0x413feb=_0x413feb-0x0;var _0x40ee88=_0xba05[_0x413feb];return _0x40ee88;};'use strict';var _=require('lodash');var util=require('util');var moment=require('moment');var BPromise=require(_0x5ba0('0x0'));var rs=require(_0x5ba0('0x1'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x5ba0('0x2'));var logger=require('../../config/logger')(_0x5ba0('0x3'));var config=require('../../config/environment');var jayson=require(_0x5ba0('0x4'));var client=jayson[_0x5ba0('0x5')][_0x5ba0('0x6')]({'port':0x232a});function respondWithRpcPromise(_0xdd6da8,_0x3e3154,_0x4cc31f){return new BPromise(function(_0x351cf9,_0x2cc1d5){return client[_0x5ba0('0x7')](_0xdd6da8,_0x4cc31f)[_0x5ba0('0x8')](function(_0x39f8d3){logger['info']('ServicenowConfiguration,\x20%s,\x20%s',_0x3e3154,_0x5ba0('0x9'));logger[_0x5ba0('0xa')](_0x5ba0('0xb'),_0x3e3154,'request\x20sent',JSON[_0x5ba0('0xc')](_0x39f8d3));if(_0x39f8d3['error']){if(_0x39f8d3[_0x5ba0('0xd')][_0x5ba0('0xe')]===0x1f4){logger[_0x5ba0('0xd')](_0x5ba0('0xf'),_0x3e3154,_0x39f8d3[_0x5ba0('0xd')][_0x5ba0('0x10')]);return _0x2cc1d5(_0x39f8d3['error']['message']);}logger['error']('ServicenowConfiguration,\x20%s,\x20%s',_0x3e3154,_0x39f8d3[_0x5ba0('0xd')]['message']);return _0x351cf9(_0x39f8d3['error'][_0x5ba0('0x10')]);}else{logger[_0x5ba0('0x11')](_0x5ba0('0xf'),_0x3e3154,_0x5ba0('0x9'));_0x351cf9(_0x39f8d3['result'][_0x5ba0('0x10')]);}})[_0x5ba0('0x12')](function(_0x379901){logger['error'](_0x5ba0('0xf'),_0x3e3154,_0x379901);_0x2cc1d5(_0x379901);});});} \ No newline at end of file +var _0x549e=['request','then','info','ServicenowConfiguration,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','catch','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client'];(function(_0x696fc0,_0x2dc536){var _0x24e0e5=function(_0x1dde0c){while(--_0x1dde0c){_0x696fc0['push'](_0x696fc0['shift']());}};_0x24e0e5(++_0x2dc536);}(_0x549e,0x172));var _0xe549=function(_0x370bb5,_0x4da4d0){_0x370bb5=_0x370bb5-0x0;var _0x478af5=_0x549e[_0x370bb5];return _0x478af5;};'use strict';var _=require('lodash');var util=require('util');var moment=require('moment');var BPromise=require(_0xe549('0x0'));var rs=require(_0xe549('0x1'));var fs=require('fs');var Redis=require(_0xe549('0x2'));var db=require(_0xe549('0x3'))['db'];var utils=require(_0xe549('0x4'));var logger=require(_0xe549('0x5'))(_0xe549('0x6'));var config=require(_0xe549('0x7'));var jayson=require(_0xe549('0x8'));var client=jayson[_0xe549('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x45d61c,_0x5705e1,_0x1e1fd6){return new BPromise(function(_0x43ff54,_0x5e53d9){return client[_0xe549('0xa')](_0x45d61c,_0x1e1fd6)[_0xe549('0xb')](function(_0x18e28b){logger[_0xe549('0xc')](_0xe549('0xd'),_0x5705e1,_0xe549('0xe'));logger['debug']('ServicenowConfiguration,\x20%s,\x20%s,\x20%s',_0x5705e1,_0xe549('0xe'),JSON[_0xe549('0xf')](_0x18e28b));if(_0x18e28b[_0xe549('0x10')]){if(_0x18e28b['error'][_0xe549('0x11')]===0x1f4){logger[_0xe549('0x10')](_0xe549('0xd'),_0x5705e1,_0x18e28b[_0xe549('0x10')][_0xe549('0x12')]);return _0x5e53d9(_0x18e28b[_0xe549('0x10')][_0xe549('0x12')]);}logger['error'](_0xe549('0xd'),_0x5705e1,_0x18e28b[_0xe549('0x10')][_0xe549('0x12')]);return _0x43ff54(_0x18e28b[_0xe549('0x10')]['message']);}else{logger[_0xe549('0xc')](_0xe549('0xd'),_0x5705e1,_0xe549('0xe'));_0x43ff54(_0x18e28b['result'][_0xe549('0x12')]);}})[_0xe549('0x13')](function(_0x13cf9c){logger['error'](_0xe549('0xd'),_0x5705e1,_0x13cf9c);_0x5e53d9(_0x13cf9c);});});} \ No newline at end of file diff --git a/server/api/intServicenowField/index.js b/server/api/intServicenowField/index.js index 4c77415..0da4ac6 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 _0xb509=['destroy','exports','util','path','connect-timeout','express','Router','../../components/auth/service','./intServicenowField.controller','get','isAuthenticated','index','/:id','post','create','put'];(function(_0x2261ce,_0x9ed8b6){var _0x524640=function(_0x3cbb90){while(--_0x3cbb90){_0x2261ce['push'](_0x2261ce['shift']());}};_0x524640(++_0x9ed8b6);}(_0xb509,0x172));var _0x9b50=function(_0x5608a3,_0x5b33c5){_0x5608a3=_0x5608a3-0x0;var _0x1ed50a=_0xb509[_0x5608a3];return _0x1ed50a;};'use strict';var multer=require('multer');var util=require(_0x9b50('0x0'));var path=require(_0x9b50('0x1'));var timeout=require(_0x9b50('0x2'));var express=require(_0x9b50('0x3'));var router=express[_0x9b50('0x4')]();var auth=require(_0x9b50('0x5'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x9b50('0x6'));router[_0x9b50('0x7')]('/',auth[_0x9b50('0x8')](),controller[_0x9b50('0x9')]);router[_0x9b50('0x7')](_0x9b50('0xa'),auth[_0x9b50('0x8')](),controller['show']);router[_0x9b50('0xb')]('/',auth[_0x9b50('0x8')](),controller[_0x9b50('0xc')]);router[_0x9b50('0xd')](_0x9b50('0xa'),auth[_0x9b50('0x8')](),controller['update']);router['delete'](_0x9b50('0xa'),auth[_0x9b50('0x8')](),controller[_0x9b50('0xe')]);module[_0x9b50('0xf')]=router; \ No newline at end of file +var _0xdcda=['Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./intServicenowField.controller','get','isAuthenticated','index','/:id','show','create','put','update','delete','exports','multer','util','path','connect-timeout','express'];(function(_0x7e525e,_0x15eb31){var _0xf5506b=function(_0x5127a3){while(--_0x5127a3){_0x7e525e['push'](_0x7e525e['shift']());}};_0xf5506b(++_0x15eb31);}(_0xdcda,0xc3));var _0xadcd=function(_0x465a0c,_0x19d4d5){_0x465a0c=_0x465a0c-0x0;var _0x1e202e=_0xdcda[_0x465a0c];return _0x1e202e;};'use strict';var multer=require(_0xadcd('0x0'));var util=require(_0xadcd('0x1'));var path=require(_0xadcd('0x2'));var timeout=require(_0xadcd('0x3'));var express=require(_0xadcd('0x4'));var router=express[_0xadcd('0x5')]();var auth=require(_0xadcd('0x6'));var interaction=require(_0xadcd('0x7'));var config=require(_0xadcd('0x8'));var controller=require(_0xadcd('0x9'));router[_0xadcd('0xa')]('/',auth[_0xadcd('0xb')](),controller[_0xadcd('0xc')]);router[_0xadcd('0xa')](_0xadcd('0xd'),auth['isAuthenticated'](),controller[_0xadcd('0xe')]);router['post']('/',auth[_0xadcd('0xb')](),controller[_0xadcd('0xf')]);router[_0xadcd('0x10')]('/:id',auth[_0xadcd('0xb')](),controller[_0xadcd('0x11')]);router[_0xadcd('0x12')]('/:id',auth[_0xadcd('0xb')](),controller['destroy']);module[_0xadcd('0x13')]=router; \ No newline at end of file diff --git a/server/api/intServicenowField/intServicenowField.attributes.js b/server/api/intServicenowField/intServicenowField.attributes.js index 0648423..45f614e 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 _0x9456=['string','STRING','variable','sequelize','ENUM','customVariable','keyValue'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x9456,0x1f4));var _0x6945=function(_0x578a0f,_0x37d272){_0x578a0f=_0x578a0f-0x0;var _0x400945=_0x9456[_0x578a0f];return _0x400945;};'use strict';var Sequelize=require(_0x6945('0x0'));module['exports']={'type':{'type':Sequelize[_0x6945('0x1')]('string','variable',_0x6945('0x2'),_0x6945('0x3')),'defaultValue':_0x6945('0x4')},'content':{'type':Sequelize[_0x6945('0x5')]},'key':{'type':Sequelize[_0x6945('0x5')]},'keyType':{'type':Sequelize['ENUM'](_0x6945('0x4'),_0x6945('0x6'),_0x6945('0x2'))},'keyContent':{'type':Sequelize['STRING']},'idField':{'type':Sequelize[_0x6945('0x5')]},'nameField':{'type':Sequelize[_0x6945('0x5')]},'customField':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x6945('0x5')]}}; \ No newline at end of file +var _0x59b7=['ENUM','string','variable','customVariable','keyValue','STRING','BOOLEAN','sequelize','exports'];(function(_0x1b1365,_0x205568){var _0x5edfd8=function(_0xae9b3d){while(--_0xae9b3d){_0x1b1365['push'](_0x1b1365['shift']());}};_0x5edfd8(++_0x205568);}(_0x59b7,0x1ae));var _0x759b=function(_0x37c10a,_0xedc88a){_0x37c10a=_0x37c10a-0x0;var _0x11ee6e=_0x59b7[_0x37c10a];return _0x11ee6e;};'use strict';var Sequelize=require(_0x759b('0x0'));module[_0x759b('0x1')]={'type':{'type':Sequelize[_0x759b('0x2')](_0x759b('0x3'),_0x759b('0x4'),_0x759b('0x5'),_0x759b('0x6')),'defaultValue':_0x759b('0x3')},'content':{'type':Sequelize[_0x759b('0x7')]},'key':{'type':Sequelize[_0x759b('0x7')]},'keyType':{'type':Sequelize[_0x759b('0x2')]('string','variable','customVariable')},'keyContent':{'type':Sequelize[_0x759b('0x7')]},'idField':{'type':Sequelize[_0x759b('0x7')]},'nameField':{'type':Sequelize[_0x759b('0x7')]},'customField':{'type':Sequelize[_0x759b('0x8')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x759b('0x7')]}}; \ No newline at end of file diff --git a/server/api/intServicenowField/intServicenowField.controller.js b/server/api/intServicenowField/intServicenowField.controller.js index 4ca2b44..4a0a4f9 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 _0x4bda=['query','keys','fields','attributes','length','hasOwnProperty','nolimit','limit','order','sort','where','pick','filters','VIRTUAL','merge','options','then','include','findAll','rows','show','params','intersection','catch','create','body','find','destroy','html-pdf','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','api','../../mysqldb','sendStatus','status','end','count','offset','set','Content-Range','apply','reject','save','update','error','stack','name','send','index','map','ServicenowField','fieldName','type','model'];(function(_0x194370,_0x4c66eb){var _0x4c72b1=function(_0x3018c0){while(--_0x3018c0){_0x194370['push'](_0x194370['shift']());}};_0x4c72b1(++_0x4c66eb);}(_0x4bda,0x134));var _0xa4bd=function(_0x26a188,_0x532b1c){_0x26a188=_0x26a188-0x0;var _0x21af47=_0x4bda[_0x26a188];return _0x21af47;};'use strict';var pdf=require(_0xa4bd('0x0'));var emlformat=require('eml-format');var rimraf=require(_0xa4bd('0x1'));var zipdir=require(_0xa4bd('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xa4bd('0x3'));var moment=require(_0xa4bd('0x4'));var BPromise=require(_0xa4bd('0x5'));var Mustache=require(_0xa4bd('0x6'));var util=require(_0xa4bd('0x7'));var path=require(_0xa4bd('0x8'));var sox=require(_0xa4bd('0x9'));var csv=require(_0xa4bd('0xa'));var ejs=require(_0xa4bd('0xb'));var fs=require('fs');var _=require(_0xa4bd('0xc'));var squel=require('squel');var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0xa4bd('0xd'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0xa4bd('0xe'));var Redis=require(_0xa4bd('0xf'));var authService=require(_0xa4bd('0x10'));var qs=require(_0xa4bd('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xa4bd('0x12'));var logger=require('../../config/logger')(_0xa4bd('0x13'));var utils=require('../../config/utils');var config=require('../../config/environment');var db=require(_0xa4bd('0x14'))['db'];function respondWithStatusCode(_0x5dd219,_0x427224){_0x427224=_0x427224||0xcc;return function(_0x39f44a){if(_0x39f44a){return _0x5dd219[_0xa4bd('0x15')](_0x427224);}return _0x5dd219[_0xa4bd('0x16')](_0x427224)[_0xa4bd('0x17')]();};}function respondWithResult(_0x10be9f,_0x2fd4ff){_0x2fd4ff=_0x2fd4ff||0xc8;return function(_0x4d0aa5){if(_0x4d0aa5){return _0x10be9f['status'](_0x2fd4ff)['json'](_0x4d0aa5);}};}function respondWithFilteredResult(_0xf541ea,_0x46e3a8){return function(_0x204c59){if(_0x204c59){var _0x8f5cdc=_0x204c59[_0xa4bd('0x18')],_0x7b094f=_0x46e3a8['offset'],_0xc7c600=_0x46e3a8[_0xa4bd('0x19')]+_0x46e3a8['limit'],_0x3da7b2;if(_0xc7c600>=_0x8f5cdc){_0xc7c600=_0x8f5cdc;_0x3da7b2=0xc8;}else{_0x3da7b2=0xce;}_0xf541ea[_0xa4bd('0x16')](_0x3da7b2);return _0xf541ea[_0xa4bd('0x1a')](_0xa4bd('0x1b'),_0x7b094f+'-'+_0xc7c600+'/'+_0x8f5cdc)['json'](_0x204c59);}return null;};}function patchUpdates(_0xa38319){return function(_0xb2d7ee){try{jsonpatch[_0xa4bd('0x1c')](_0xb2d7ee,_0xa38319,!![]);}catch(_0x5a1c54){return BPromise[_0xa4bd('0x1d')](_0x5a1c54);}return _0xb2d7ee[_0xa4bd('0x1e')]();};}function saveUpdates(_0x468e4e,_0x103353){return function(_0x471e9f){if(_0x471e9f){return _0x471e9f[_0xa4bd('0x1f')](_0x468e4e)['then'](function(_0x127925){return _0x127925;});}return null;};}function removeEntity(_0x5aefbf,_0x4946d7){return function(_0x28fc8d){if(_0x28fc8d){return _0x28fc8d['destroy']()['then'](function(){_0x5aefbf[_0xa4bd('0x16')](0xcc)['end']();});}};}function handleEntityNotFound(_0x4f8aea,_0x3ec100){return function(_0x3c5ed2){if(!_0x3c5ed2){_0x4f8aea['sendStatus'](0x194);}return _0x3c5ed2;};}function handleError(_0x25aacc,_0x294515){_0x294515=_0x294515||0x1f4;return function(_0x3adc33){logger[_0xa4bd('0x20')](_0x3adc33[_0xa4bd('0x21')]);if(_0x3adc33['name']){delete _0x3adc33[_0xa4bd('0x22')];}_0x25aacc[_0xa4bd('0x16')](_0x294515)[_0xa4bd('0x23')](_0x3adc33);};}exports[_0xa4bd('0x24')]=function(_0x364ca8,_0x485ebe){var _0x1e19c9={},_0x182219={},_0x393f0c={'count':0x0,'rows':[]};var _0xd1aec4=_[_0xa4bd('0x25')](db[_0xa4bd('0x26')]['rawAttributes'],function(_0x367291){return{'name':_0x367291[_0xa4bd('0x27')],'type':_0x367291[_0xa4bd('0x28')]['key']};});_0x182219[_0xa4bd('0x29')]=_[_0xa4bd('0x25')](_0xd1aec4,_0xa4bd('0x22'));_0x182219[_0xa4bd('0x2a')]=_[_0xa4bd('0x2b')](_0x364ca8[_0xa4bd('0x2a')]);_0x182219['filters']=_['intersection'](_0x182219['model'],_0x182219['query']);_0x1e19c9['attributes']=_['intersection'](_0x182219[_0xa4bd('0x29')],qs['fields'](_0x364ca8[_0xa4bd('0x2a')][_0xa4bd('0x2c')]));_0x1e19c9[_0xa4bd('0x2d')]=_0x1e19c9[_0xa4bd('0x2d')][_0xa4bd('0x2e')]?_0x1e19c9[_0xa4bd('0x2d')]:_0x182219[_0xa4bd('0x29')];if(!_0x364ca8[_0xa4bd('0x2a')][_0xa4bd('0x2f')](_0xa4bd('0x30'))){_0x1e19c9[_0xa4bd('0x31')]=qs[_0xa4bd('0x31')](_0x364ca8[_0xa4bd('0x2a')][_0xa4bd('0x31')]);_0x1e19c9[_0xa4bd('0x19')]=qs[_0xa4bd('0x19')](_0x364ca8['query'][_0xa4bd('0x19')]);}_0x1e19c9[_0xa4bd('0x32')]=qs[_0xa4bd('0x33')](_0x364ca8[_0xa4bd('0x2a')][_0xa4bd('0x33')]);_0x1e19c9[_0xa4bd('0x34')]=qs['filters'](_[_0xa4bd('0x35')](_0x364ca8[_0xa4bd('0x2a')],_0x182219[_0xa4bd('0x36')]));if(_0x364ca8[_0xa4bd('0x2a')]['filter']){_0x1e19c9[_0xa4bd('0x34')]=_['merge'](_0x1e19c9[_0xa4bd('0x34')],{'$or':_['map'](_0xd1aec4,function(_0x4cc41a){if(_0x4cc41a[_0xa4bd('0x28')]!==_0xa4bd('0x37')){var _0x74861f={};_0x74861f[_0x4cc41a['name']]={'$like':'%'+_0x364ca8[_0xa4bd('0x2a')]['filter']+'%'};return _0x74861f;}})});}_0x1e19c9=_[_0xa4bd('0x38')]({},_0x1e19c9,_0x364ca8[_0xa4bd('0x39')]);var _0x4b229b={'where':_0x1e19c9[_0xa4bd('0x34')]};return db[_0xa4bd('0x26')][_0xa4bd('0x18')](_0x4b229b)[_0xa4bd('0x3a')](function(_0x40fe2b){_0x393f0c[_0xa4bd('0x18')]=_0x40fe2b;if(_0x364ca8['query']['includeAll']){_0x1e19c9[_0xa4bd('0x3b')]=[{'all':!![]}];}return db[_0xa4bd('0x26')][_0xa4bd('0x3c')](_0x1e19c9);})[_0xa4bd('0x3a')](function(_0x1978e0){_0x393f0c[_0xa4bd('0x3d')]=_0x1978e0;return _0x393f0c;})[_0xa4bd('0x3a')](respondWithFilteredResult(_0x485ebe,_0x1e19c9))['catch'](handleError(_0x485ebe,null));};exports[_0xa4bd('0x3e')]=function(_0x38a70c,_0xbfecc6){var _0x2a50a7={'raw':!![],'where':{'id':_0x38a70c[_0xa4bd('0x3f')]['id']}},_0x3138a8={};_0x3138a8[_0xa4bd('0x29')]=_[_0xa4bd('0x2b')](db['ServicenowField']['rawAttributes']);_0x3138a8['query']=_['keys'](_0x38a70c[_0xa4bd('0x2a')]);_0x3138a8[_0xa4bd('0x36')]=_['intersection'](_0x3138a8['model'],_0x3138a8[_0xa4bd('0x2a')]);_0x2a50a7[_0xa4bd('0x2d')]=_[_0xa4bd('0x40')](_0x3138a8[_0xa4bd('0x29')],qs[_0xa4bd('0x2c')](_0x38a70c[_0xa4bd('0x2a')][_0xa4bd('0x2c')]));_0x2a50a7[_0xa4bd('0x2d')]=_0x2a50a7['attributes'][_0xa4bd('0x2e')]?_0x2a50a7[_0xa4bd('0x2d')]:_0x3138a8[_0xa4bd('0x29')];if(_0x38a70c[_0xa4bd('0x2a')]['includeAll']){_0x2a50a7['include']=[{'all':!![]}];}_0x2a50a7=_[_0xa4bd('0x38')]({},_0x2a50a7,_0x38a70c['options']);return db[_0xa4bd('0x26')]['find'](_0x2a50a7)['then'](handleEntityNotFound(_0xbfecc6,null))[_0xa4bd('0x3a')](respondWithResult(_0xbfecc6,null))[_0xa4bd('0x41')](handleError(_0xbfecc6,null));};exports[_0xa4bd('0x42')]=function(_0x306b3d,_0x2b9a51){return db[_0xa4bd('0x26')][_0xa4bd('0x42')](_0x306b3d[_0xa4bd('0x43')],{})[_0xa4bd('0x3a')](respondWithResult(_0x2b9a51,0xc9))[_0xa4bd('0x41')](handleError(_0x2b9a51,null));};exports[_0xa4bd('0x1f')]=function(_0x49879b,_0x5bb01e){if(_0x49879b[_0xa4bd('0x43')]['id']){delete _0x49879b[_0xa4bd('0x43')]['id'];}return db[_0xa4bd('0x26')][_0xa4bd('0x44')]({'where':{'id':_0x49879b['params']['id']}})[_0xa4bd('0x3a')](handleEntityNotFound(_0x5bb01e,null))[_0xa4bd('0x3a')](saveUpdates(_0x49879b[_0xa4bd('0x43')],null))[_0xa4bd('0x3a')](respondWithResult(_0x5bb01e,null))[_0xa4bd('0x41')](handleError(_0x5bb01e,null));};exports[_0xa4bd('0x45')]=function(_0xb996f3,_0x1706bf){return db[_0xa4bd('0x26')][_0xa4bd('0x44')]({'where':{'id':_0xb996f3[_0xa4bd('0x3f')]['id']}})[_0xa4bd('0x3a')](handleEntityNotFound(_0x1706bf,null))[_0xa4bd('0x3a')](removeEntity(_0x1706bf,null))[_0xa4bd('0x41')](handleError(_0x1706bf,null));}; \ No newline at end of file +var _0x23b9=['rimraf','fast-json-patch','request-promise','moment','util','path','lodash','crypto','jsforce','desk.js','to-csv','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../mysqldb','sendStatus','end','count','offset','status','set','Content-Range','json','apply','reject','save','update','then','destroy','stack','name','send','map','ServicenowField','type','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','limit','sort','pick','filter','merge','VIRTUAL','options','where','includeAll','findAll','rows','catch','show','params','create','body','find','eml-format'];(function(_0x26acda,_0x506025){var _0x5a01d8=function(_0x4a7cfb){while(--_0x4a7cfb){_0x26acda['push'](_0x26acda['shift']());}};_0x5a01d8(++_0x506025);}(_0x23b9,0xce));var _0x923b=function(_0x3d231a,_0x2e2d09){_0x3d231a=_0x3d231a-0x0;var _0x5c0148=_0x23b9[_0x3d231a];return _0x5c0148;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x923b('0x0'));var rimraf=require(_0x923b('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x923b('0x2'));var rp=require(_0x923b('0x3'));var moment=require(_0x923b('0x4'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x923b('0x5'));var path=require(_0x923b('0x6'));var sox=require('sox');var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var _=require(_0x923b('0x7'));var squel=require('squel');var crypto=require(_0x923b('0x8'));var jsforce=require(_0x923b('0x9'));var deskjs=require(_0x923b('0xa'));var toCsv=require(_0x923b('0xb'));var querystring=require(_0x923b('0xc'));var Papa=require('papaparse');var Redis=require(_0x923b('0xd'));var authService=require(_0x923b('0xe'));var qs=require(_0x923b('0xf'));var as=require(_0x923b('0x10'));var hardwareService=require(_0x923b('0x11'));var logger=require(_0x923b('0x12'))(_0x923b('0x13'));var utils=require('../../config/utils');var config=require(_0x923b('0x14'));var db=require(_0x923b('0x15'))['db'];function respondWithStatusCode(_0x568860,_0x1996f5){_0x1996f5=_0x1996f5||0xcc;return function(_0x17d4ab){if(_0x17d4ab){return _0x568860[_0x923b('0x16')](_0x1996f5);}return _0x568860['status'](_0x1996f5)[_0x923b('0x17')]();};}function respondWithResult(_0x29cbde,_0x4858bf){_0x4858bf=_0x4858bf||0xc8;return function(_0x48b61e){if(_0x48b61e){return _0x29cbde['status'](_0x4858bf)['json'](_0x48b61e);}};}function respondWithFilteredResult(_0x41aa9f,_0x3a5a70){return function(_0x1cdc1a){if(_0x1cdc1a){var _0x310d48=_0x1cdc1a[_0x923b('0x18')],_0x5057b1=_0x3a5a70[_0x923b('0x19')],_0x1405a5=_0x3a5a70[_0x923b('0x19')]+_0x3a5a70['limit'],_0x5754cb;if(_0x1405a5>=_0x310d48){_0x1405a5=_0x310d48;_0x5754cb=0xc8;}else{_0x5754cb=0xce;}_0x41aa9f[_0x923b('0x1a')](_0x5754cb);return _0x41aa9f[_0x923b('0x1b')](_0x923b('0x1c'),_0x5057b1+'-'+_0x1405a5+'/'+_0x310d48)[_0x923b('0x1d')](_0x1cdc1a);}return null;};}function patchUpdates(_0x17bd75){return function(_0x2a0be5){try{jsonpatch[_0x923b('0x1e')](_0x2a0be5,_0x17bd75,!![]);}catch(_0x350502){return BPromise[_0x923b('0x1f')](_0x350502);}return _0x2a0be5[_0x923b('0x20')]();};}function saveUpdates(_0x5826dd,_0x180489){return function(_0x3fcd0d){if(_0x3fcd0d){return _0x3fcd0d[_0x923b('0x21')](_0x5826dd)[_0x923b('0x22')](function(_0x5e851c){return _0x5e851c;});}return null;};}function removeEntity(_0x357104,_0x4f8c43){return function(_0x5ae515){if(_0x5ae515){return _0x5ae515[_0x923b('0x23')]()[_0x923b('0x22')](function(){_0x357104[_0x923b('0x1a')](0xcc)[_0x923b('0x17')]();});}};}function handleEntityNotFound(_0x4d8bf7,_0x6ea10d){return function(_0x1cce0e){if(!_0x1cce0e){_0x4d8bf7['sendStatus'](0x194);}return _0x1cce0e;};}function handleError(_0xdbd17e,_0x334995){_0x334995=_0x334995||0x1f4;return function(_0x32f806){logger['error'](_0x32f806[_0x923b('0x24')]);if(_0x32f806[_0x923b('0x25')]){delete _0x32f806[_0x923b('0x25')];}_0xdbd17e[_0x923b('0x1a')](_0x334995)[_0x923b('0x26')](_0x32f806);};}exports['index']=function(_0x5ecdd6,_0x2df490){var _0x3c209b={},_0x1824eb={},_0x4c348f={'count':0x0,'rows':[]};var _0x3dbbd7=_[_0x923b('0x27')](db[_0x923b('0x28')]['rawAttributes'],function(_0x115212){return{'name':_0x115212['fieldName'],'type':_0x115212[_0x923b('0x29')]['key']};});_0x1824eb[_0x923b('0x2a')]=_['map'](_0x3dbbd7,_0x923b('0x25'));_0x1824eb[_0x923b('0x2b')]=_[_0x923b('0x2c')](_0x5ecdd6[_0x923b('0x2b')]);_0x1824eb[_0x923b('0x2d')]=_[_0x923b('0x2e')](_0x1824eb[_0x923b('0x2a')],_0x1824eb[_0x923b('0x2b')]);_0x3c209b[_0x923b('0x2f')]=_['intersection'](_0x1824eb['model'],qs['fields'](_0x5ecdd6['query'][_0x923b('0x30')]));_0x3c209b[_0x923b('0x2f')]=_0x3c209b[_0x923b('0x2f')][_0x923b('0x31')]?_0x3c209b[_0x923b('0x2f')]:_0x1824eb[_0x923b('0x2a')];if(!_0x5ecdd6['query'][_0x923b('0x32')](_0x923b('0x33'))){_0x3c209b[_0x923b('0x34')]=qs[_0x923b('0x34')](_0x5ecdd6[_0x923b('0x2b')][_0x923b('0x34')]);_0x3c209b[_0x923b('0x19')]=qs[_0x923b('0x19')](_0x5ecdd6['query'][_0x923b('0x19')]);}_0x3c209b['order']=qs[_0x923b('0x35')](_0x5ecdd6[_0x923b('0x2b')]['sort']);_0x3c209b['where']=qs[_0x923b('0x2d')](_[_0x923b('0x36')](_0x5ecdd6[_0x923b('0x2b')],_0x1824eb[_0x923b('0x2d')]));if(_0x5ecdd6[_0x923b('0x2b')][_0x923b('0x37')]){_0x3c209b['where']=_[_0x923b('0x38')](_0x3c209b['where'],{'$or':_[_0x923b('0x27')](_0x3dbbd7,function(_0x4e574e){if(_0x4e574e['type']!==_0x923b('0x39')){var _0x5adbb4={};_0x5adbb4[_0x4e574e[_0x923b('0x25')]]={'$like':'%'+_0x5ecdd6['query'][_0x923b('0x37')]+'%'};return _0x5adbb4;}})});}_0x3c209b=_[_0x923b('0x38')]({},_0x3c209b,_0x5ecdd6[_0x923b('0x3a')]);var _0x31d557={'where':_0x3c209b[_0x923b('0x3b')]};return db[_0x923b('0x28')][_0x923b('0x18')](_0x31d557)[_0x923b('0x22')](function(_0x29f3be){_0x4c348f[_0x923b('0x18')]=_0x29f3be;if(_0x5ecdd6[_0x923b('0x2b')][_0x923b('0x3c')]){_0x3c209b['include']=[{'all':!![]}];}return db[_0x923b('0x28')][_0x923b('0x3d')](_0x3c209b);})[_0x923b('0x22')](function(_0x2ad90b){_0x4c348f[_0x923b('0x3e')]=_0x2ad90b;return _0x4c348f;})[_0x923b('0x22')](respondWithFilteredResult(_0x2df490,_0x3c209b))[_0x923b('0x3f')](handleError(_0x2df490,null));};exports[_0x923b('0x40')]=function(_0x240f39,_0x320d5d){var _0x4ac24f={'raw':!![],'where':{'id':_0x240f39[_0x923b('0x41')]['id']}},_0x5064ff={};_0x5064ff[_0x923b('0x2a')]=_['keys'](db[_0x923b('0x28')]['rawAttributes']);_0x5064ff[_0x923b('0x2b')]=_[_0x923b('0x2c')](_0x240f39[_0x923b('0x2b')]);_0x5064ff[_0x923b('0x2d')]=_['intersection'](_0x5064ff[_0x923b('0x2a')],_0x5064ff[_0x923b('0x2b')]);_0x4ac24f[_0x923b('0x2f')]=_['intersection'](_0x5064ff['model'],qs[_0x923b('0x30')](_0x240f39[_0x923b('0x2b')][_0x923b('0x30')]));_0x4ac24f[_0x923b('0x2f')]=_0x4ac24f['attributes']['length']?_0x4ac24f['attributes']:_0x5064ff[_0x923b('0x2a')];if(_0x240f39[_0x923b('0x2b')][_0x923b('0x3c')]){_0x4ac24f['include']=[{'all':!![]}];}_0x4ac24f=_['merge']({},_0x4ac24f,_0x240f39[_0x923b('0x3a')]);return db[_0x923b('0x28')]['find'](_0x4ac24f)[_0x923b('0x22')](handleEntityNotFound(_0x320d5d,null))['then'](respondWithResult(_0x320d5d,null))[_0x923b('0x3f')](handleError(_0x320d5d,null));};exports[_0x923b('0x42')]=function(_0x4439eb,_0x35d804){return db['ServicenowField'][_0x923b('0x42')](_0x4439eb[_0x923b('0x43')],{})['then'](respondWithResult(_0x35d804,0xc9))[_0x923b('0x3f')](handleError(_0x35d804,null));};exports[_0x923b('0x21')]=function(_0x4eca06,_0xf2ace7){if(_0x4eca06['body']['id']){delete _0x4eca06[_0x923b('0x43')]['id'];}return db[_0x923b('0x28')][_0x923b('0x44')]({'where':{'id':_0x4eca06[_0x923b('0x41')]['id']}})[_0x923b('0x22')](handleEntityNotFound(_0xf2ace7,null))['then'](saveUpdates(_0x4eca06['body'],null))['then'](respondWithResult(_0xf2ace7,null))[_0x923b('0x3f')](handleError(_0xf2ace7,null));};exports['destroy']=function(_0x3a430c,_0x48eb46){return db['ServicenowField'][_0x923b('0x44')]({'where':{'id':_0x3a430c['params']['id']}})[_0x923b('0x22')](handleEntityNotFound(_0x48eb46,null))[_0x923b('0x22')](removeEntity(_0x48eb46,null))[_0x923b('0x3f')](handleError(_0x48eb46,null));}; \ No newline at end of file diff --git a/server/api/intServicenowField/intServicenowField.model.js b/server/api/intServicenowField/intServicenowField.model.js index 4901b02..a5660a7 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 _0x316b=['bluebird','path','../../config/environment','./intServicenowField.attributes','exports','define','ServicenowField','servicenow_unique_index','FieldId','lodash','util','../../config/logger','moment'];(function(_0x1b4002,_0x5b4094){var _0x1716f3=function(_0x47cfd1){while(--_0x47cfd1){_0x1b4002['push'](_0x1b4002['shift']());}};_0x1716f3(++_0x5b4094);}(_0x316b,0xe6));var _0xb316=function(_0xd413a4,_0x3120fe){_0xd413a4=_0xd413a4-0x0;var _0x9170f4=_0x316b[_0xd413a4];return _0x9170f4;};'use strict';var _=require(_0xb316('0x0'));var util=require(_0xb316('0x1'));var logger=require(_0xb316('0x2'))('api');var moment=require(_0xb316('0x3'));var BPromise=require(_0xb316('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xb316('0x5'));var rimraf=require('rimraf');var config=require(_0xb316('0x6'));var attributes=require(_0xb316('0x7'));module[_0xb316('0x8')]=function(_0x22c523,_0x2650f0){return _0x22c523[_0xb316('0x9')](_0xb316('0xa'),attributes,{'tableName':'int_servicenow_fields','paranoid':![],'indexes':[{'name':_0xb316('0xb'),'fields':['idField',_0xb316('0xc')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0x1299=['FieldId','lodash','util','../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment','./intServicenowField.attributes','ServicenowField','int_servicenow_fields','idField'];(function(_0x651c32,_0x554df9){var _0x25c174=function(_0x466ce1){while(--_0x466ce1){_0x651c32['push'](_0x651c32['shift']());}};_0x25c174(++_0x554df9);}(_0x1299,0xd3));var _0x9129=function(_0x25da73,_0x775cb3){_0x25da73=_0x25da73-0x0;var _0x288954=_0x1299[_0x25da73];return _0x288954;};'use strict';var _=require(_0x9129('0x0'));var util=require(_0x9129('0x1'));var logger=require(_0x9129('0x2'))(_0x9129('0x3'));var moment=require(_0x9129('0x4'));var BPromise=require(_0x9129('0x5'));var rp=require(_0x9129('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0x9129('0x7'));var config=require(_0x9129('0x8'));var attributes=require(_0x9129('0x9'));module['exports']=function(_0x5a00a7,_0x1c838e){return _0x5a00a7['define'](_0x9129('0xa'),attributes,{'tableName':_0x9129('0xb'),'paranoid':![],'indexes':[{'name':'servicenow_unique_index','fields':[_0x9129('0xc'),_0x9129('0xd')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intServicenowField/intServicenowField.rpc.js b/server/api/intServicenowField/intServicenowField.rpc.js index 696c734..2cac97d 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 _0x24f9=['error','code','ServicenowField,\x20%s,\x20%s','message','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','jayson/promise','http','then','info','debug','ServicenowField,\x20%s,\x20%s,\x20%s','request\x20sent'];(function(_0x53ddab,_0x4ada9d){var _0x5819ac=function(_0x4d5fc8){while(--_0x4d5fc8){_0x53ddab['push'](_0x53ddab['shift']());}};_0x5819ac(++_0x4ada9d);}(_0x24f9,0x122));var _0x924f=function(_0x4f68c4,_0xedbb92){_0x4f68c4=_0x4f68c4-0x0;var _0x59a74a=_0x24f9[_0x4f68c4];return _0x59a74a;};'use strict';var _=require(_0x924f('0x0'));var util=require(_0x924f('0x1'));var moment=require(_0x924f('0x2'));var BPromise=require(_0x924f('0x3'));var rs=require(_0x924f('0x4'));var fs=require('fs');var Redis=require(_0x924f('0x5'));var db=require(_0x924f('0x6'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')('rpc');var config=require('../../config/environment');var jayson=require(_0x924f('0x7'));var client=jayson['client'][_0x924f('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x46e154,_0x27b17a,_0x232d3e){return new BPromise(function(_0x2d74ba,_0x2405e0){return client['request'](_0x46e154,_0x232d3e)[_0x924f('0x9')](function(_0x3e26ed){logger[_0x924f('0xa')]('ServicenowField,\x20%s,\x20%s',_0x27b17a,'request\x20sent');logger[_0x924f('0xb')](_0x924f('0xc'),_0x27b17a,_0x924f('0xd'),JSON['stringify'](_0x3e26ed));if(_0x3e26ed[_0x924f('0xe')]){if(_0x3e26ed['error'][_0x924f('0xf')]===0x1f4){logger[_0x924f('0xe')](_0x924f('0x10'),_0x27b17a,_0x3e26ed['error'][_0x924f('0x11')]);return _0x2405e0(_0x3e26ed['error'][_0x924f('0x11')]);}logger[_0x924f('0xe')](_0x924f('0x10'),_0x27b17a,_0x3e26ed[_0x924f('0xe')]['message']);return _0x2d74ba(_0x3e26ed[_0x924f('0xe')]['message']);}else{logger[_0x924f('0xa')](_0x924f('0x10'),_0x27b17a,'request\x20sent');_0x2d74ba(_0x3e26ed['result'][_0x924f('0x11')]);}})[_0x924f('0x12')](function(_0x3e4086){logger[_0x924f('0xe')]('ServicenowField,\x20%s,\x20%s',_0x27b17a,_0x3e4086);_0x2405e0(_0x3e4086);});});} \ No newline at end of file +var _0x9f99=['lodash','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request','info','ServicenowField,\x20%s,\x20%s','request\x20sent','ServicenowField,\x20%s,\x20%s,\x20%s','error','code','message'];(function(_0x95e21d,_0x36861e){var _0x3fd266=function(_0x4857bb){while(--_0x4857bb){_0x95e21d['push'](_0x95e21d['shift']());}};_0x3fd266(++_0x36861e);}(_0x9f99,0x18c));var _0x99f9=function(_0x6d93f,_0x4ad549){_0x6d93f=_0x6d93f-0x0;var _0x5635e6=_0x9f99[_0x6d93f];return _0x5635e6;};'use strict';var _=require(_0x99f9('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0x99f9('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x99f9('0x2'));var db=require(_0x99f9('0x3'))['db'];var utils=require(_0x99f9('0x4'));var logger=require(_0x99f9('0x5'))('rpc');var config=require(_0x99f9('0x6'));var jayson=require(_0x99f9('0x7'));var client=jayson[_0x99f9('0x8')][_0x99f9('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x575f00,_0x6b6f21,_0x5ae0ca){return new BPromise(function(_0x4384ed,_0x166cf7){return client[_0x99f9('0xa')](_0x575f00,_0x5ae0ca)['then'](function(_0x4d37ab){logger[_0x99f9('0xb')](_0x99f9('0xc'),_0x6b6f21,_0x99f9('0xd'));logger['debug'](_0x99f9('0xe'),_0x6b6f21,'request\x20sent',JSON['stringify'](_0x4d37ab));if(_0x4d37ab[_0x99f9('0xf')]){if(_0x4d37ab[_0x99f9('0xf')][_0x99f9('0x10')]===0x1f4){logger[_0x99f9('0xf')](_0x99f9('0xc'),_0x6b6f21,_0x4d37ab[_0x99f9('0xf')][_0x99f9('0x11')]);return _0x166cf7(_0x4d37ab[_0x99f9('0xf')][_0x99f9('0x11')]);}logger[_0x99f9('0xf')]('ServicenowField,\x20%s,\x20%s',_0x6b6f21,_0x4d37ab[_0x99f9('0xf')][_0x99f9('0x11')]);return _0x4384ed(_0x4d37ab[_0x99f9('0xf')][_0x99f9('0x11')]);}else{logger[_0x99f9('0xb')](_0x99f9('0xc'),_0x6b6f21,_0x99f9('0xd'));_0x4384ed(_0x4d37ab['result'][_0x99f9('0x11')]);}})['catch'](function(_0x32904e){logger[_0x99f9('0xf')]('ServicenowField,\x20%s,\x20%s',_0x6b6f21,_0x32904e);_0x166cf7(_0x32904e);});});} \ No newline at end of file diff --git a/server/api/intSugarcrmAccount/index.js b/server/api/intSugarcrmAccount/index.js index 15e92ac..63b74b9 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 _0xcdc2=['index','show','/:id/configurations','/:id/fields','post','create','addConfiguration','put','/:id','update','exports','util','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./intSugarcrmAccount.controller','get','isAuthenticated'];(function(_0x2786be,_0x23c6df){var _0x5bb80a=function(_0x1d854b){while(--_0x1d854b){_0x2786be['push'](_0x2786be['shift']());}};_0x5bb80a(++_0x23c6df);}(_0xcdc2,0x1eb));var _0x2cdc=function(_0x3c6edf,_0x18487d){_0x3c6edf=_0x3c6edf-0x0;var _0x15e916=_0xcdc2[_0x3c6edf];return _0x15e916;};'use strict';var multer=require('multer');var util=require(_0x2cdc('0x0'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0x2cdc('0x1'));var router=express[_0x2cdc('0x2')]();var auth=require(_0x2cdc('0x3'));var interaction=require(_0x2cdc('0x4'));var config=require(_0x2cdc('0x5'));var controller=require(_0x2cdc('0x6'));router[_0x2cdc('0x7')]('/',auth[_0x2cdc('0x8')](),controller[_0x2cdc('0x9')]);router['get']('/:id',auth[_0x2cdc('0x8')](),controller[_0x2cdc('0xa')]);router[_0x2cdc('0x7')](_0x2cdc('0xb'),auth['isAuthenticated'](),controller['getConfigurations']);router[_0x2cdc('0x7')](_0x2cdc('0xc'),auth[_0x2cdc('0x8')](),controller['getFields']);router[_0x2cdc('0xd')]('/',auth[_0x2cdc('0x8')](),controller[_0x2cdc('0xe')]);router[_0x2cdc('0xd')](_0x2cdc('0xb'),auth[_0x2cdc('0x8')](),controller[_0x2cdc('0xf')]);router[_0x2cdc('0x10')](_0x2cdc('0x11'),auth[_0x2cdc('0x8')](),controller[_0x2cdc('0x12')]);router['delete'](_0x2cdc('0x11'),auth[_0x2cdc('0x8')](),controller['destroy']);module[_0x2cdc('0x13')]=router; \ No newline at end of file +var _0x1aa2=['create','post','put','update','delete','destroy','multer','path','connect-timeout','express','Router','../../components/interaction/service','../../config/environment','./intSugarcrmAccount.controller','isAuthenticated','index','get','/:id','/:id/configurations','getConfigurations','/:id/fields'];(function(_0x5f5268,_0x311a70){var _0x204d0a=function(_0x99e3bc){while(--_0x99e3bc){_0x5f5268['push'](_0x5f5268['shift']());}};_0x204d0a(++_0x311a70);}(_0x1aa2,0xd8));var _0x21aa=function(_0x48f7cf,_0x4baa04){_0x48f7cf=_0x48f7cf-0x0;var _0xc201c0=_0x1aa2[_0x48f7cf];return _0xc201c0;};'use strict';var multer=require(_0x21aa('0x0'));var util=require('util');var path=require(_0x21aa('0x1'));var timeout=require(_0x21aa('0x2'));var express=require(_0x21aa('0x3'));var router=express[_0x21aa('0x4')]();var auth=require('../../components/auth/service');var interaction=require(_0x21aa('0x5'));var config=require(_0x21aa('0x6'));var controller=require(_0x21aa('0x7'));router['get']('/',auth[_0x21aa('0x8')](),controller[_0x21aa('0x9')]);router[_0x21aa('0xa')](_0x21aa('0xb'),auth[_0x21aa('0x8')](),controller['show']);router[_0x21aa('0xa')](_0x21aa('0xc'),auth[_0x21aa('0x8')](),controller[_0x21aa('0xd')]);router['get'](_0x21aa('0xe'),auth[_0x21aa('0x8')](),controller['getFields']);router['post']('/',auth[_0x21aa('0x8')](),controller[_0x21aa('0xf')]);router[_0x21aa('0x10')](_0x21aa('0xc'),auth[_0x21aa('0x8')](),controller['addConfiguration']);router[_0x21aa('0x11')](_0x21aa('0xb'),auth[_0x21aa('0x8')](),controller[_0x21aa('0x12')]);router[_0x21aa('0x13')](_0x21aa('0xb'),auth['isAuthenticated'](),controller[_0x21aa('0x14')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/intSugarcrmAccount/intSugarcrmAccount.attributes.js b/server/api/intSugarcrmAccount/intSugarcrmAccount.attributes.js index 14a8722..f832005 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 _0x1ff2=['remoteUri','sequelize','exports','STRING','username'];(function(_0x332cde,_0x55fa8c){var _0x42d383=function(_0x1fe245){while(--_0x1fe245){_0x332cde['push'](_0x332cde['shift']());}};_0x42d383(++_0x55fa8c);}(_0x1ff2,0x141));var _0x21ff=function(_0x251499,_0x7f77b5){_0x251499=_0x251499-0x0;var _0x13a9f6=_0x1ff2[_0x251499];return _0x13a9f6;};'use strict';var Sequelize=require(_0x21ff('0x0'));module[_0x21ff('0x1')]={'name':{'type':Sequelize[_0x21ff('0x2')]},'description':{'type':Sequelize[_0x21ff('0x2')]},'username':{'type':Sequelize[_0x21ff('0x2')],'unique':_0x21ff('0x3')},'password':{'type':Sequelize[_0x21ff('0x2')]},'remoteUri':{'type':Sequelize[_0x21ff('0x2')],'unique':_0x21ff('0x4')},'serverUrl':{'type':Sequelize[_0x21ff('0x2')]}}; \ No newline at end of file +var _0x781e=['remoteUri','sequelize','exports','STRING'];(function(_0x27d86c,_0x8cf966){var _0x3af5d0=function(_0x1278b4){while(--_0x1278b4){_0x27d86c['push'](_0x27d86c['shift']());}};_0x3af5d0(++_0x8cf966);}(_0x781e,0x13d));var _0xe781=function(_0x17d9e3,_0x1f969c){_0x17d9e3=_0x17d9e3-0x0;var _0x14192d=_0x781e[_0x17d9e3];return _0x14192d;};'use strict';var Sequelize=require(_0xe781('0x0'));module[_0xe781('0x1')]={'name':{'type':Sequelize[_0xe781('0x2')]},'description':{'type':Sequelize[_0xe781('0x2')]},'username':{'type':Sequelize[_0xe781('0x2')],'unique':'username'},'password':{'type':Sequelize[_0xe781('0x2')]},'remoteUri':{'type':Sequelize[_0xe781('0x2')],'unique':_0xe781('0x3')},'serverUrl':{'type':Sequelize[_0xe781('0x2')]}}; \ No newline at end of file diff --git a/server/api/intSugarcrmAccount/intSugarcrmAccount.controller.js b/server/api/intSugarcrmAccount/intSugarcrmAccount.controller.js index 14dd068..ba9242e 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 _0xbc61=['includes','label','value','test','getFields,\x20%s,\x20%s,\x20%s','getFields','Wrong\x20credentials','statusCode','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','to-csv','ejs','lodash','crypto','jsforce','desk.js','querystring','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../mysqldb','jayson/promise','http','ValidationError','The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.','request','then','info','request\x20sent','debug','SugarcrmAccount,\x20%s,\x20%s,\x20%s','stringify','error','SugarcrmAccount,\x20%s,\x20%s','message','result','sendStatus','status','end','json','count','offset','apply','reject','update','destroy','stack','name','send','index','map','rawAttributes','fieldName','type','query','keys','filters','model','fields','attributes','nolimit','limit','order','sort','pick','filter','where','merge','VIRTUAL','options','SugarcrmAccount','findAll','rows','catch','show','params','intersection','length','includeAll','find','create','body','getConfigurations','findOne','addConfiguration','AccountId','Subjects','getSubjects','channel','Descriptions','getDescriptions','SugarcrmConfiguration','assigned_user_id','created_by','description','date_start','duration_hours','duration_minutes','parent_type','parent_name','username','password','slice','substring','lastIndexOf','POST','format','%s%s','/service/v4_1/rest.php','login','JSON','PLAIN','xCALLY\x20Motion\x20Integration','Invalid\x20Login','Calls','values','module_fields','remove'];(function(_0x4565bf,_0x5ad9d6){var _0x5610ba=function(_0x170988){while(--_0x170988){_0x4565bf['push'](_0x4565bf['shift']());}};_0x5610ba(++_0x5ad9d6);}(_0xbc61,0x10c));var _0x1bc6=function(_0x403062,_0x56f0fe){_0x403062=_0x403062-0x0;var _0x131ab9=_0xbc61[_0x403062];return _0x131ab9;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x1bc6('0x0'));var rimraf=require(_0x1bc6('0x1'));var zipdir=require(_0x1bc6('0x2'));var jsonpatch=require(_0x1bc6('0x3'));var rp=require(_0x1bc6('0x4'));var moment=require(_0x1bc6('0x5'));var BPromise=require(_0x1bc6('0x6'));var Mustache=require(_0x1bc6('0x7'));var util=require('util');var path=require(_0x1bc6('0x8'));var sox=require(_0x1bc6('0x9'));var csv=require(_0x1bc6('0xa'));var ejs=require(_0x1bc6('0xb'));var fs=require('fs');var _=require(_0x1bc6('0xc'));var squel=require('squel');var crypto=require(_0x1bc6('0xd'));var jsforce=require(_0x1bc6('0xe'));var deskjs=require(_0x1bc6('0xf'));var toCsv=require(_0x1bc6('0xa'));var querystring=require(_0x1bc6('0x10'));var Papa=require(_0x1bc6('0x11'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x1bc6('0x12'));var as=require(_0x1bc6('0x13'));var hardwareService=require(_0x1bc6('0x14'));var logger=require(_0x1bc6('0x15'))(_0x1bc6('0x16'));var utils=require('../../config/utils');var config=require(_0x1bc6('0x17'));var db=require(_0x1bc6('0x18'))['db'];var integrations=require('../../components/integrations/configuration');var jayson=require(_0x1bc6('0x19'));var client=jayson['client'][_0x1bc6('0x1a')]({'port':0x232a});function checkPasswordPattern(_0x59096c,_0x158426,_0x40ba26){if(_0x40ba26){var _0x505c99=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x505c99['test'](_0x158426)){return _0x59096c;}else{throw new db['Sequelize'][(_0x1bc6('0x1b'))](_0x1bc6('0x1c'));}}else{return _0x59096c;}}function respondWithRpcPromise(_0x2c0305,_0xebaf39,_0x1e2e7a,_0xadf9c3){return new BPromise(function(_0x567568,_0x572ae0){var _0x6f751f=_0xadf9c3||client;return _0x6f751f[_0x1bc6('0x1d')](_0x2c0305,_0x1e2e7a)[_0x1bc6('0x1e')](function(_0x4d2141){logger[_0x1bc6('0x1f')]('SugarcrmAccount,\x20%s,\x20%s',_0xebaf39,_0x1bc6('0x20'));logger[_0x1bc6('0x21')](_0x1bc6('0x22'),_0xebaf39,_0x1bc6('0x20'),JSON[_0x1bc6('0x23')](_0x4d2141));if(_0x4d2141['error']){if(_0x4d2141[_0x1bc6('0x24')]['code']===0x1f4){logger[_0x1bc6('0x24')](_0x1bc6('0x25'),_0xebaf39,_0x4d2141[_0x1bc6('0x24')][_0x1bc6('0x26')]);return _0x572ae0(_0x4d2141[_0x1bc6('0x24')][_0x1bc6('0x26')]);}logger[_0x1bc6('0x24')](_0x1bc6('0x25'),_0xebaf39,_0x4d2141['error'][_0x1bc6('0x26')]);return _0x567568(_0x4d2141['error'][_0x1bc6('0x26')]);}else{logger[_0x1bc6('0x1f')](_0x1bc6('0x25'),_0xebaf39,'request\x20sent');_0x567568(_0x4d2141[_0x1bc6('0x27')][_0x1bc6('0x26')]);}})['catch'](function(_0x183712){logger[_0x1bc6('0x24')](_0x1bc6('0x25'),_0xebaf39,_0x183712);_0x572ae0(_0x183712);});});}function respondWithStatusCode(_0x477da6,_0x2e9806){_0x2e9806=_0x2e9806||0xcc;return function(_0x1f2ab4){if(_0x1f2ab4){return _0x477da6[_0x1bc6('0x28')](_0x2e9806);}return _0x477da6[_0x1bc6('0x29')](_0x2e9806)[_0x1bc6('0x2a')]();};}function respondWithResult(_0x23a559,_0x186c87){_0x186c87=_0x186c87||0xc8;return function(_0x12c2af){if(_0x12c2af){return _0x23a559['status'](_0x186c87)[_0x1bc6('0x2b')](_0x12c2af);}};}function respondWithFilteredResult(_0x5ac10c,_0x7a9a3f){return function(_0x488232){if(_0x488232){var _0xdff3b0=_0x488232[_0x1bc6('0x2c')],_0x7b366=_0x7a9a3f[_0x1bc6('0x2d')],_0x1c1350=_0x7a9a3f['offset']+_0x7a9a3f['limit'],_0x3109ec;if(_0x1c1350>=_0xdff3b0){_0x1c1350=_0xdff3b0;_0x3109ec=0xc8;}else{_0x3109ec=0xce;}_0x5ac10c[_0x1bc6('0x29')](_0x3109ec);return _0x5ac10c['set']('Content-Range',_0x7b366+'-'+_0x1c1350+'/'+_0xdff3b0)['json'](_0x488232);}return null;};}function patchUpdates(_0x1b52d8){return function(_0x1f9523){try{jsonpatch[_0x1bc6('0x2e')](_0x1f9523,_0x1b52d8,!![]);}catch(_0x3a6f67){return BPromise[_0x1bc6('0x2f')](_0x3a6f67);}return _0x1f9523['save']();};}function saveUpdates(_0x589f1a,_0x11735c){return function(_0x3a567a){if(_0x3a567a){return _0x3a567a[_0x1bc6('0x30')](_0x589f1a)['then'](function(_0x295bae){return _0x295bae;});}return null;};}function removeEntity(_0x303fa7,_0x2dab44){return function(_0x2ba317){if(_0x2ba317){return _0x2ba317[_0x1bc6('0x31')]()[_0x1bc6('0x1e')](function(){_0x303fa7[_0x1bc6('0x29')](0xcc)[_0x1bc6('0x2a')]();});}};}function handleEntityNotFound(_0x24c1b9,_0x5b96a7){return function(_0x11c943){if(!_0x11c943){_0x24c1b9[_0x1bc6('0x28')](0x194);}return _0x11c943;};}function handleError(_0x506849,_0xa5d50c){_0xa5d50c=_0xa5d50c||0x1f4;return function(_0x459692){logger[_0x1bc6('0x24')](_0x459692[_0x1bc6('0x32')]);if(_0x459692[_0x1bc6('0x33')]){delete _0x459692[_0x1bc6('0x33')];}_0x506849[_0x1bc6('0x29')](_0xa5d50c)[_0x1bc6('0x34')](_0x459692);};}exports[_0x1bc6('0x35')]=function(_0x390d6c,_0x5ca88e){var _0x1f5752={},_0xc7e348={},_0x28000e={'count':0x0,'rows':[]};var _0x1b97a9=_[_0x1bc6('0x36')](db['SugarcrmAccount'][_0x1bc6('0x37')],function(_0x2058b9){return{'name':_0x2058b9[_0x1bc6('0x38')],'type':_0x2058b9[_0x1bc6('0x39')]['key']};});_0xc7e348['model']=_[_0x1bc6('0x36')](_0x1b97a9,'name');_0xc7e348[_0x1bc6('0x3a')]=_[_0x1bc6('0x3b')](_0x390d6c[_0x1bc6('0x3a')]);_0xc7e348[_0x1bc6('0x3c')]=_['intersection'](_0xc7e348['model'],_0xc7e348[_0x1bc6('0x3a')]);_0x1f5752['attributes']=_['intersection'](_0xc7e348[_0x1bc6('0x3d')],qs[_0x1bc6('0x3e')](_0x390d6c[_0x1bc6('0x3a')]['fields']));_0x1f5752[_0x1bc6('0x3f')]=_0x1f5752[_0x1bc6('0x3f')]['length']?_0x1f5752[_0x1bc6('0x3f')]:_0xc7e348[_0x1bc6('0x3d')];if(!_0x390d6c[_0x1bc6('0x3a')]['hasOwnProperty'](_0x1bc6('0x40'))){_0x1f5752[_0x1bc6('0x41')]=qs['limit'](_0x390d6c['query'][_0x1bc6('0x41')]);_0x1f5752[_0x1bc6('0x2d')]=qs[_0x1bc6('0x2d')](_0x390d6c[_0x1bc6('0x3a')][_0x1bc6('0x2d')]);}_0x1f5752[_0x1bc6('0x42')]=qs['sort'](_0x390d6c[_0x1bc6('0x3a')][_0x1bc6('0x43')]);_0x1f5752['where']=qs[_0x1bc6('0x3c')](_[_0x1bc6('0x44')](_0x390d6c[_0x1bc6('0x3a')],_0xc7e348[_0x1bc6('0x3c')]));if(_0x390d6c[_0x1bc6('0x3a')][_0x1bc6('0x45')]){_0x1f5752[_0x1bc6('0x46')]=_[_0x1bc6('0x47')](_0x1f5752['where'],{'$or':_[_0x1bc6('0x36')](_0x1b97a9,function(_0x8adad8){if(_0x8adad8[_0x1bc6('0x39')]!==_0x1bc6('0x48')){var _0x344d6f={};_0x344d6f[_0x8adad8[_0x1bc6('0x33')]]={'$like':'%'+_0x390d6c[_0x1bc6('0x3a')][_0x1bc6('0x45')]+'%'};return _0x344d6f;}})});}_0x1f5752=_[_0x1bc6('0x47')]({},_0x1f5752,_0x390d6c[_0x1bc6('0x49')]);var _0x32d030={'where':_0x1f5752[_0x1bc6('0x46')]};return db[_0x1bc6('0x4a')][_0x1bc6('0x2c')](_0x32d030)[_0x1bc6('0x1e')](function(_0xf5421d){_0x28000e['count']=_0xf5421d;if(_0x390d6c[_0x1bc6('0x3a')]['includeAll']){_0x1f5752['include']=[{'all':!![]}];}return db[_0x1bc6('0x4a')][_0x1bc6('0x4b')](_0x1f5752);})[_0x1bc6('0x1e')](function(_0x38fbf8){_0x28000e[_0x1bc6('0x4c')]=_0x38fbf8;return _0x28000e;})[_0x1bc6('0x1e')](respondWithFilteredResult(_0x5ca88e,_0x1f5752))[_0x1bc6('0x4d')](handleError(_0x5ca88e,null));};exports[_0x1bc6('0x4e')]=function(_0x5947e6,_0x4b9037){var _0xcf3e62={'raw':![],'where':{'id':_0x5947e6[_0x1bc6('0x4f')]['id']}},_0x519fa1={};_0x519fa1[_0x1bc6('0x3d')]=_[_0x1bc6('0x3b')](db[_0x1bc6('0x4a')]['rawAttributes']);_0x519fa1[_0x1bc6('0x3a')]=_[_0x1bc6('0x3b')](_0x5947e6[_0x1bc6('0x3a')]);_0x519fa1[_0x1bc6('0x3c')]=_[_0x1bc6('0x50')](_0x519fa1[_0x1bc6('0x3d')],_0x519fa1['query']);_0xcf3e62[_0x1bc6('0x3f')]=_['intersection'](_0x519fa1[_0x1bc6('0x3d')],qs[_0x1bc6('0x3e')](_0x5947e6[_0x1bc6('0x3a')]['fields']));_0xcf3e62[_0x1bc6('0x3f')]=_0xcf3e62[_0x1bc6('0x3f')][_0x1bc6('0x51')]?_0xcf3e62['attributes']:_0x519fa1[_0x1bc6('0x3d')];if(_0x5947e6[_0x1bc6('0x3a')][_0x1bc6('0x52')]){_0xcf3e62['include']=[{'all':!![]}];}_0xcf3e62=_[_0x1bc6('0x47')]({},_0xcf3e62,_0x5947e6['options']);return db[_0x1bc6('0x4a')][_0x1bc6('0x53')](_0xcf3e62)[_0x1bc6('0x1e')](handleEntityNotFound(_0x4b9037,null))['then'](respondWithResult(_0x4b9037,null))[_0x1bc6('0x4d')](handleError(_0x4b9037,null));};exports[_0x1bc6('0x54')]=function(_0xe4f931,_0x892337){return db[_0x1bc6('0x4a')][_0x1bc6('0x54')](_0xe4f931[_0x1bc6('0x55')],{})[_0x1bc6('0x1e')](respondWithResult(_0x892337,0xc9))[_0x1bc6('0x4d')](handleError(_0x892337,null));};exports[_0x1bc6('0x30')]=function(_0x2fb679,_0x398825){if(_0x2fb679['body']['id']){delete _0x2fb679[_0x1bc6('0x55')]['id'];}return db['SugarcrmAccount'][_0x1bc6('0x53')]({'where':{'id':_0x2fb679['params']['id']}})[_0x1bc6('0x1e')](handleEntityNotFound(_0x398825,null))[_0x1bc6('0x1e')](saveUpdates(_0x2fb679[_0x1bc6('0x55')],null))['then'](respondWithResult(_0x398825,null))['catch'](handleError(_0x398825,null));};exports['destroy']=function(_0x46997d,_0x3bf96c){return db[_0x1bc6('0x4a')]['find']({'where':{'id':_0x46997d[_0x1bc6('0x4f')]['id']}})['then'](handleEntityNotFound(_0x3bf96c,null))[_0x1bc6('0x1e')](removeEntity(_0x3bf96c,null))[_0x1bc6('0x4d')](handleError(_0x3bf96c,null));};exports[_0x1bc6('0x56')]=function(_0x3f045b,_0x5297ed,_0x3090cf){var _0x578166={};var _0x469a58={};var _0x4c12ee;var _0x896a3c;return db['SugarcrmAccount'][_0x1bc6('0x57')]({'where':{'id':_0x3f045b[_0x1bc6('0x4f')]['id']}})[_0x1bc6('0x1e')](handleEntityNotFound(_0x5297ed,null))['then'](function(_0x49be2e){if(_0x49be2e){_0x4c12ee=_0x49be2e;_0x469a58[_0x1bc6('0x3d')]=_[_0x1bc6('0x3b')](db['SugarcrmConfiguration']['rawAttributes']);_0x469a58[_0x1bc6('0x3a')]=_['keys'](_0x3f045b[_0x1bc6('0x3a')]);_0x469a58['filters']=_[_0x1bc6('0x50')](_0x469a58[_0x1bc6('0x3d')],_0x469a58[_0x1bc6('0x3a')]);_0x578166['attributes']=_[_0x1bc6('0x50')](_0x469a58[_0x1bc6('0x3d')],qs[_0x1bc6('0x3e')](_0x3f045b['query'][_0x1bc6('0x3e')]));_0x578166[_0x1bc6('0x3f')]=_0x578166['attributes'][_0x1bc6('0x51')]?_0x578166[_0x1bc6('0x3f')]:_0x469a58['model'];_0x578166['order']=qs[_0x1bc6('0x43')](_0x3f045b[_0x1bc6('0x3a')]['sort']);_0x578166[_0x1bc6('0x46')]=qs[_0x1bc6('0x3c')](_[_0x1bc6('0x44')](_0x3f045b[_0x1bc6('0x3a')],_0x469a58[_0x1bc6('0x3c')]));if(_0x3f045b[_0x1bc6('0x3a')][_0x1bc6('0x45')]){_0x578166[_0x1bc6('0x46')]=_[_0x1bc6('0x47')](_0x578166[_0x1bc6('0x46')],{'$or':_['map'](_0x578166['attributes'],function(_0x4f3f94){var _0x9127a8={};_0x9127a8[_0x4f3f94]={'$like':'%'+_0x3f045b[_0x1bc6('0x3a')][_0x1bc6('0x45')]+'%'};return _0x9127a8;})});}_0x578166=_[_0x1bc6('0x47')]({},_0x578166,_0x3f045b[_0x1bc6('0x49')]);return _0x4c12ee['getConfigurations'](_0x578166);}})['then'](function(_0x409421){if(_0x409421){_0x896a3c=_0x409421[_0x1bc6('0x51')];if(!_0x3f045b[_0x1bc6('0x3a')]['hasOwnProperty'](_0x1bc6('0x40'))){_0x578166[_0x1bc6('0x41')]=qs['limit'](_0x3f045b[_0x1bc6('0x3a')]['limit']);_0x578166[_0x1bc6('0x2d')]=qs[_0x1bc6('0x2d')](_0x3f045b[_0x1bc6('0x3a')][_0x1bc6('0x2d')]);}return _0x4c12ee[_0x1bc6('0x56')](_0x578166);}})[_0x1bc6('0x1e')](function(_0x150eb4){if(_0x150eb4){return _0x150eb4?{'count':_0x896a3c,'rows':_0x150eb4}:null;}})[_0x1bc6('0x1e')](respondWithResult(_0x5297ed,null))[_0x1bc6('0x4d')](handleError(_0x5297ed,null));};exports[_0x1bc6('0x58')]=function(_0x379e9a,_0x51aee3,_0x32b9b5){if(_0x379e9a[_0x1bc6('0x55')]['id']){delete _0x379e9a['body']['id'];}return db[_0x1bc6('0x4a')][_0x1bc6('0x57')]({'where':{'id':_0x379e9a['params']['id']}})[_0x1bc6('0x1e')](handleEntityNotFound(_0x51aee3,null))[_0x1bc6('0x1e')](function(_0x2773a2){if(_0x2773a2){_0x379e9a[_0x1bc6('0x55')][_0x1bc6('0x59')]=_0x2773a2['id'];_0x379e9a[_0x1bc6('0x55')][_0x1bc6('0x5a')]=integrations[_0x1bc6('0x5b')](_0x379e9a[_0x1bc6('0x55')][_0x1bc6('0x5c')],_0x379e9a[_0x1bc6('0x55')][_0x1bc6('0x39')]);_0x379e9a['body'][_0x1bc6('0x5d')]=integrations[_0x1bc6('0x5e')](_0x379e9a[_0x1bc6('0x55')]['channel'],_0x379e9a[_0x1bc6('0x55')]['type']);return db[_0x1bc6('0x5f')]['create'](_0x379e9a[_0x1bc6('0x55')],{'include':[{'model':db['SugarcrmField'],'as':'Subjects'},{'model':db['SugarcrmField'],'as':'Descriptions'}]});}return null;})[_0x1bc6('0x1e')](respondWithResult(_0x51aee3,null))[_0x1bc6('0x4d')](handleError(_0x51aee3,null));};exports['getFields']=function(_0x36890a,_0x4e959a,_0x1cc521){var _0x4f75ad='';var _0x55535c=['id',_0x1bc6('0x33'),_0x1bc6('0x60'),_0x1bc6('0x61'),_0x1bc6('0x62'),_0x1bc6('0x63'),_0x1bc6('0x64'),_0x1bc6('0x65'),'parent_id',_0x1bc6('0x66'),_0x1bc6('0x67'),'direction'];return db[_0x1bc6('0x4a')][_0x1bc6('0x57')]({'where':{'id':_0x36890a[_0x1bc6('0x4f')]['id']},'attributes':['id',_0x1bc6('0x68'),_0x1bc6('0x69'),'remoteUri']})[_0x1bc6('0x1e')](handleEntityNotFound(_0x4e959a,null))['then'](function(_0x12c2fc){if(_0x12c2fc){_0x4f75ad=_0x12c2fc['remoteUri'];var _0x4a6ff2=_0x4f75ad[_0x1bc6('0x6a')](-0x1);if(_0x4a6ff2==='/'){_0x4f75ad=_0x4f75ad[_0x1bc6('0x6b')](0x0,_0x4f75ad[_0x1bc6('0x6c')](_0x4a6ff2));}return rp({'method':_0x1bc6('0x6d'),'uri':util[_0x1bc6('0x6e')](_0x1bc6('0x6f'),_0x4f75ad,_0x1bc6('0x70')),'json':!![],'form':{'method':_0x1bc6('0x71'),'input_type':_0x1bc6('0x72'),'response_type':_0x1bc6('0x72'),'rest_data':JSON[_0x1bc6('0x23')]({'user_auth':{'user_name':_0x12c2fc[_0x1bc6('0x68')],'password':_0x12c2fc['password'],'encryption':_0x1bc6('0x73')},'application':_0x1bc6('0x74')})}});}})[_0x1bc6('0x1e')](function(_0x26b937){if(_0x26b937&&_0x26b937['name']!==_0x1bc6('0x75')&&_0x26b937[_0x1bc6('0x33')]!=='Password\x20Expired'){return rp({'method':'POST','uri':util['format'](_0x1bc6('0x6f'),_0x4f75ad,_0x1bc6('0x70')),'json':!![],'form':{'method':'get_module_fields','input_type':'JSON','response_type':_0x1bc6('0x72'),'rest_data':JSON['stringify']({'session':_0x26b937['id'],'module_name':_0x1bc6('0x76')})}})['then'](function(_0x65a6af){if(_0x65a6af){var _0x48bd19=_[_0x1bc6('0x77')](_0x65a6af[_0x1bc6('0x78')]);_[_0x1bc6('0x79')](_0x48bd19,function(_0x4b8257){return _0x55535c[_0x1bc6('0x7a')](_0x4b8257[_0x1bc6('0x33')]);});return{'count':_0x48bd19[_0x1bc6('0x51')],'rows':_[_0x1bc6('0x36')](_0x48bd19,function(_0x2fe45a){return{'id':_0x2fe45a[_0x1bc6('0x33')],'name':_0x2fe45a[_0x1bc6('0x7b')],'custom':_['endsWith'](_0x2fe45a[_0x1bc6('0x33')],'_c')?!![]:![],'options':_0x2fe45a['options']?_[_0x1bc6('0x36')](_[_0x1bc6('0x77')](_0x2fe45a[_0x1bc6('0x49')]),function(_0x1bd6a1){return{'name':_0x1bd6a1[_0x1bc6('0x7c')],'value':_0x1bd6a1[_0x1bc6('0x33')]};}):[]};})};}})[_0x1bc6('0x1e')](respondWithResult(_0x4e959a,null))['catch'](function(_0x141af2){var _0xd9579e=_0x36890a['query'][_0x1bc6('0x7d')]?0x1f4:_0x141af2['statusCode']||0x1f4;logger[_0x1bc6('0x24')](_0x1bc6('0x7e'),_0x1bc6('0x7f'),_0xd9579e,JSON['stringify'](_0x141af2));delete _0x141af2[_0x1bc6('0x33')];if(_0xd9579e===0x191){_0xd9579e=0x190;}_0x4e959a[_0x1bc6('0x29')](_0xd9579e)[_0x1bc6('0x34')](_0x36890a['query'][_0x1bc6('0x7d')]?{'message':_0x1bc6('0x80'),'statusCode':_0x141af2[_0x1bc6('0x81')]}:_0x141af2);});}else{var _0x32cb50=0x1f4;_0x4e959a[_0x1bc6('0x29')](_0x32cb50)['send']({'message':_0x1bc6('0x80'),'statusCode':0x190});}});}; \ No newline at end of file +var _0xc34c=['include','create','body','find','params','getConfigurations','addConfiguration','findOne','Subjects','getSubjects','channel','Descriptions','getDescriptions','SugarcrmConfiguration','SugarcrmField','getFields','assigned_user_id','description','date_start','duration_hours','duration_minutes','parent_id','parent_type','parent_name','direction','password','remoteUri','slice','substring','lastIndexOf','POST','format','/service/v4_1/rest.php','JSON','stringify','username','PLAIN','xCALLY\x20Motion\x20Integration','Invalid\x20Login','%s%s','get_module_fields','Calls','values','module_fields','remove','includes','label','endsWith','test','statusCode','getFields,\x20%s,\x20%s,\x20%s','Wrong\x20credentials','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/logger','api','../../components/integrations/configuration','jayson/promise','http','Sequelize','ValidationError','then','info','SugarcrmAccount,\x20%s,\x20%s','request\x20sent','debug','error','message','sendStatus','status','end','count','offset','limit','set','reject','update','destroy','stack','name','send','index','map','SugarcrmAccount','rawAttributes','key','model','query','keys','filters','attributes','intersection','fields','length','nolimit','order','sort','pick','filter','where','merge','type','VIRTUAL','options','includeAll','findAll','rows','catch','show'];(function(_0x5a3749,_0x442ed2){var _0x5a426c=function(_0x16b226){while(--_0x16b226){_0x5a3749['push'](_0x5a3749['shift']());}};_0x5a426c(++_0x442ed2);}(_0xc34c,0x130));var _0xcc34=function(_0x4e676e,_0x2a7c6d){_0x4e676e=_0x4e676e-0x0;var _0x336a3c=_0xc34c[_0x4e676e];return _0x336a3c;};'use strict';var pdf=require(_0xcc34('0x0'));var emlformat=require(_0xcc34('0x1'));var rimraf=require(_0xcc34('0x2'));var zipdir=require(_0xcc34('0x3'));var jsonpatch=require(_0xcc34('0x4'));var rp=require('request-promise');var moment=require(_0xcc34('0x5'));var BPromise=require(_0xcc34('0x6'));var Mustache=require(_0xcc34('0x7'));var util=require('util');var path=require('path');var sox=require('sox');var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var _=require(_0xcc34('0x8'));var squel=require(_0xcc34('0x9'));var crypto=require(_0xcc34('0xa'));var jsforce=require(_0xcc34('0xb'));var deskjs=require(_0xcc34('0xc'));var toCsv=require(_0xcc34('0xd'));var querystring=require(_0xcc34('0xe'));var Papa=require(_0xcc34('0xf'));var Redis=require(_0xcc34('0x10'));var authService=require(_0xcc34('0x11'));var qs=require(_0xcc34('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0xcc34('0x13'))(_0xcc34('0x14'));var utils=require('../../config/utils');var config=require('../../config/environment');var db=require('../../mysqldb')['db'];var integrations=require(_0xcc34('0x15'));var jayson=require(_0xcc34('0x16'));var client=jayson['client'][_0xcc34('0x17')]({'port':0x232a});function checkPasswordPattern(_0x169d05,_0x1e46a4,_0x4f5680){if(_0x4f5680){var _0x3e3b32=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x3e3b32['test'](_0x1e46a4)){return _0x169d05;}else{throw new db[(_0xcc34('0x18'))][(_0xcc34('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 _0x169d05;}}function respondWithRpcPromise(_0x13468f,_0x486620,_0x43eb65,_0x31ebed){return new BPromise(function(_0xafac28,_0x2124de){var _0x9ad216=_0x31ebed||client;return _0x9ad216['request'](_0x13468f,_0x43eb65)[_0xcc34('0x1a')](function(_0x4bf08d){logger[_0xcc34('0x1b')](_0xcc34('0x1c'),_0x486620,_0xcc34('0x1d'));logger[_0xcc34('0x1e')]('SugarcrmAccount,\x20%s,\x20%s,\x20%s',_0x486620,'request\x20sent',JSON['stringify'](_0x4bf08d));if(_0x4bf08d[_0xcc34('0x1f')]){if(_0x4bf08d[_0xcc34('0x1f')]['code']===0x1f4){logger['error'](_0xcc34('0x1c'),_0x486620,_0x4bf08d[_0xcc34('0x1f')][_0xcc34('0x20')]);return _0x2124de(_0x4bf08d[_0xcc34('0x1f')][_0xcc34('0x20')]);}logger['error'](_0xcc34('0x1c'),_0x486620,_0x4bf08d[_0xcc34('0x1f')][_0xcc34('0x20')]);return _0xafac28(_0x4bf08d[_0xcc34('0x1f')][_0xcc34('0x20')]);}else{logger['info']('SugarcrmAccount,\x20%s,\x20%s',_0x486620,'request\x20sent');_0xafac28(_0x4bf08d['result'][_0xcc34('0x20')]);}})['catch'](function(_0x55b8c6){logger[_0xcc34('0x1f')](_0xcc34('0x1c'),_0x486620,_0x55b8c6);_0x2124de(_0x55b8c6);});});}function respondWithStatusCode(_0x4ce017,_0x40a2c6){_0x40a2c6=_0x40a2c6||0xcc;return function(_0x355f36){if(_0x355f36){return _0x4ce017[_0xcc34('0x21')](_0x40a2c6);}return _0x4ce017[_0xcc34('0x22')](_0x40a2c6)[_0xcc34('0x23')]();};}function respondWithResult(_0x3ee926,_0x5deaeb){_0x5deaeb=_0x5deaeb||0xc8;return function(_0x52c327){if(_0x52c327){return _0x3ee926[_0xcc34('0x22')](_0x5deaeb)['json'](_0x52c327);}};}function respondWithFilteredResult(_0x28e9b1,_0x4a4f2a){return function(_0x507f94){if(_0x507f94){var _0x44dacd=_0x507f94[_0xcc34('0x24')],_0x105314=_0x4a4f2a[_0xcc34('0x25')],_0x5c2c03=_0x4a4f2a[_0xcc34('0x25')]+_0x4a4f2a[_0xcc34('0x26')],_0x579eb8;if(_0x5c2c03>=_0x44dacd){_0x5c2c03=_0x44dacd;_0x579eb8=0xc8;}else{_0x579eb8=0xce;}_0x28e9b1[_0xcc34('0x22')](_0x579eb8);return _0x28e9b1[_0xcc34('0x27')]('Content-Range',_0x105314+'-'+_0x5c2c03+'/'+_0x44dacd)['json'](_0x507f94);}return null;};}function patchUpdates(_0x4beefd){return function(_0x3c27d5){try{jsonpatch['apply'](_0x3c27d5,_0x4beefd,!![]);}catch(_0x59680b){return BPromise[_0xcc34('0x28')](_0x59680b);}return _0x3c27d5['save']();};}function saveUpdates(_0x4d3681,_0x52c605){return function(_0x53b2df){if(_0x53b2df){return _0x53b2df[_0xcc34('0x29')](_0x4d3681)[_0xcc34('0x1a')](function(_0xfeeea0){return _0xfeeea0;});}return null;};}function removeEntity(_0x25daaf,_0x1fa05e){return function(_0x2f3f22){if(_0x2f3f22){return _0x2f3f22[_0xcc34('0x2a')]()[_0xcc34('0x1a')](function(){_0x25daaf[_0xcc34('0x22')](0xcc)[_0xcc34('0x23')]();});}};}function handleEntityNotFound(_0x326fa6,_0x48aebc){return function(_0x5b390a){if(!_0x5b390a){_0x326fa6[_0xcc34('0x21')](0x194);}return _0x5b390a;};}function handleError(_0x484a6b,_0x4c4d8d){_0x4c4d8d=_0x4c4d8d||0x1f4;return function(_0x51ed67){logger['error'](_0x51ed67[_0xcc34('0x2b')]);if(_0x51ed67[_0xcc34('0x2c')]){delete _0x51ed67[_0xcc34('0x2c')];}_0x484a6b[_0xcc34('0x22')](_0x4c4d8d)[_0xcc34('0x2d')](_0x51ed67);};}exports[_0xcc34('0x2e')]=function(_0x2f21b5,_0x4f9563){var _0x58b2d8={},_0x12ee53={},_0x5e454b={'count':0x0,'rows':[]};var _0x18d9cf=_[_0xcc34('0x2f')](db[_0xcc34('0x30')][_0xcc34('0x31')],function(_0x52f0b3){return{'name':_0x52f0b3['fieldName'],'type':_0x52f0b3['type'][_0xcc34('0x32')]};});_0x12ee53[_0xcc34('0x33')]=_[_0xcc34('0x2f')](_0x18d9cf,'name');_0x12ee53[_0xcc34('0x34')]=_[_0xcc34('0x35')](_0x2f21b5[_0xcc34('0x34')]);_0x12ee53[_0xcc34('0x36')]=_['intersection'](_0x12ee53[_0xcc34('0x33')],_0x12ee53['query']);_0x58b2d8[_0xcc34('0x37')]=_[_0xcc34('0x38')](_0x12ee53[_0xcc34('0x33')],qs[_0xcc34('0x39')](_0x2f21b5[_0xcc34('0x34')][_0xcc34('0x39')]));_0x58b2d8[_0xcc34('0x37')]=_0x58b2d8[_0xcc34('0x37')][_0xcc34('0x3a')]?_0x58b2d8[_0xcc34('0x37')]:_0x12ee53['model'];if(!_0x2f21b5[_0xcc34('0x34')]['hasOwnProperty'](_0xcc34('0x3b'))){_0x58b2d8[_0xcc34('0x26')]=qs[_0xcc34('0x26')](_0x2f21b5['query']['limit']);_0x58b2d8[_0xcc34('0x25')]=qs[_0xcc34('0x25')](_0x2f21b5[_0xcc34('0x34')]['offset']);}_0x58b2d8[_0xcc34('0x3c')]=qs[_0xcc34('0x3d')](_0x2f21b5[_0xcc34('0x34')][_0xcc34('0x3d')]);_0x58b2d8['where']=qs[_0xcc34('0x36')](_[_0xcc34('0x3e')](_0x2f21b5['query'],_0x12ee53[_0xcc34('0x36')]));if(_0x2f21b5[_0xcc34('0x34')][_0xcc34('0x3f')]){_0x58b2d8[_0xcc34('0x40')]=_[_0xcc34('0x41')](_0x58b2d8[_0xcc34('0x40')],{'$or':_[_0xcc34('0x2f')](_0x18d9cf,function(_0x170931){if(_0x170931[_0xcc34('0x42')]!==_0xcc34('0x43')){var _0x434fc8={};_0x434fc8[_0x170931[_0xcc34('0x2c')]]={'$like':'%'+_0x2f21b5['query'][_0xcc34('0x3f')]+'%'};return _0x434fc8;}})});}_0x58b2d8=_[_0xcc34('0x41')]({},_0x58b2d8,_0x2f21b5[_0xcc34('0x44')]);var _0x2608eb={'where':_0x58b2d8[_0xcc34('0x40')]};return db[_0xcc34('0x30')][_0xcc34('0x24')](_0x2608eb)[_0xcc34('0x1a')](function(_0x346b3d){_0x5e454b['count']=_0x346b3d;if(_0x2f21b5['query'][_0xcc34('0x45')]){_0x58b2d8['include']=[{'all':!![]}];}return db[_0xcc34('0x30')][_0xcc34('0x46')](_0x58b2d8);})[_0xcc34('0x1a')](function(_0x1bf030){_0x5e454b[_0xcc34('0x47')]=_0x1bf030;return _0x5e454b;})[_0xcc34('0x1a')](respondWithFilteredResult(_0x4f9563,_0x58b2d8))[_0xcc34('0x48')](handleError(_0x4f9563,null));};exports[_0xcc34('0x49')]=function(_0x42e70f,_0x234fb8){var _0x1aa788={'raw':![],'where':{'id':_0x42e70f['params']['id']}},_0x4a78ce={};_0x4a78ce[_0xcc34('0x33')]=_[_0xcc34('0x35')](db[_0xcc34('0x30')][_0xcc34('0x31')]);_0x4a78ce[_0xcc34('0x34')]=_['keys'](_0x42e70f[_0xcc34('0x34')]);_0x4a78ce[_0xcc34('0x36')]=_['intersection'](_0x4a78ce[_0xcc34('0x33')],_0x4a78ce[_0xcc34('0x34')]);_0x1aa788['attributes']=_['intersection'](_0x4a78ce[_0xcc34('0x33')],qs[_0xcc34('0x39')](_0x42e70f[_0xcc34('0x34')][_0xcc34('0x39')]));_0x1aa788['attributes']=_0x1aa788[_0xcc34('0x37')][_0xcc34('0x3a')]?_0x1aa788[_0xcc34('0x37')]:_0x4a78ce[_0xcc34('0x33')];if(_0x42e70f[_0xcc34('0x34')][_0xcc34('0x45')]){_0x1aa788[_0xcc34('0x4a')]=[{'all':!![]}];}_0x1aa788=_['merge']({},_0x1aa788,_0x42e70f['options']);return db[_0xcc34('0x30')]['find'](_0x1aa788)[_0xcc34('0x1a')](handleEntityNotFound(_0x234fb8,null))[_0xcc34('0x1a')](respondWithResult(_0x234fb8,null))[_0xcc34('0x48')](handleError(_0x234fb8,null));};exports[_0xcc34('0x4b')]=function(_0x1dfef7,_0x1d172c){return db['SugarcrmAccount'][_0xcc34('0x4b')](_0x1dfef7[_0xcc34('0x4c')],{})['then'](respondWithResult(_0x1d172c,0xc9))['catch'](handleError(_0x1d172c,null));};exports[_0xcc34('0x29')]=function(_0x40c359,_0x55da70){if(_0x40c359[_0xcc34('0x4c')]['id']){delete _0x40c359['body']['id'];}return db[_0xcc34('0x30')][_0xcc34('0x4d')]({'where':{'id':_0x40c359['params']['id']}})[_0xcc34('0x1a')](handleEntityNotFound(_0x55da70,null))[_0xcc34('0x1a')](saveUpdates(_0x40c359[_0xcc34('0x4c')],null))['then'](respondWithResult(_0x55da70,null))['catch'](handleError(_0x55da70,null));};exports[_0xcc34('0x2a')]=function(_0x1dc3aa,_0x1ea2ec){return db['SugarcrmAccount']['find']({'where':{'id':_0x1dc3aa[_0xcc34('0x4e')]['id']}})[_0xcc34('0x1a')](handleEntityNotFound(_0x1ea2ec,null))['then'](removeEntity(_0x1ea2ec,null))[_0xcc34('0x48')](handleError(_0x1ea2ec,null));};exports['getConfigurations']=function(_0x5bdb81,_0x38af51,_0x25a47e){var _0x10e340={};var _0x126cd0={};var _0x347416;var _0x4c3a36;return db[_0xcc34('0x30')]['findOne']({'where':{'id':_0x5bdb81[_0xcc34('0x4e')]['id']}})[_0xcc34('0x1a')](handleEntityNotFound(_0x38af51,null))[_0xcc34('0x1a')](function(_0xa3a66b){if(_0xa3a66b){_0x347416=_0xa3a66b;_0x126cd0[_0xcc34('0x33')]=_['keys'](db['SugarcrmConfiguration'][_0xcc34('0x31')]);_0x126cd0[_0xcc34('0x34')]=_['keys'](_0x5bdb81['query']);_0x126cd0['filters']=_[_0xcc34('0x38')](_0x126cd0['model'],_0x126cd0[_0xcc34('0x34')]);_0x10e340['attributes']=_['intersection'](_0x126cd0[_0xcc34('0x33')],qs['fields'](_0x5bdb81[_0xcc34('0x34')][_0xcc34('0x39')]));_0x10e340[_0xcc34('0x37')]=_0x10e340['attributes']['length']?_0x10e340[_0xcc34('0x37')]:_0x126cd0[_0xcc34('0x33')];_0x10e340[_0xcc34('0x3c')]=qs['sort'](_0x5bdb81['query'][_0xcc34('0x3d')]);_0x10e340['where']=qs[_0xcc34('0x36')](_['pick'](_0x5bdb81['query'],_0x126cd0['filters']));if(_0x5bdb81[_0xcc34('0x34')][_0xcc34('0x3f')]){_0x10e340[_0xcc34('0x40')]=_[_0xcc34('0x41')](_0x10e340[_0xcc34('0x40')],{'$or':_[_0xcc34('0x2f')](_0x10e340[_0xcc34('0x37')],function(_0x2ed245){var _0x5c72d3={};_0x5c72d3[_0x2ed245]={'$like':'%'+_0x5bdb81[_0xcc34('0x34')][_0xcc34('0x3f')]+'%'};return _0x5c72d3;})});}_0x10e340=_[_0xcc34('0x41')]({},_0x10e340,_0x5bdb81['options']);return _0x347416[_0xcc34('0x4f')](_0x10e340);}})[_0xcc34('0x1a')](function(_0x41319d){if(_0x41319d){_0x4c3a36=_0x41319d['length'];if(!_0x5bdb81[_0xcc34('0x34')]['hasOwnProperty'](_0xcc34('0x3b'))){_0x10e340[_0xcc34('0x26')]=qs['limit'](_0x5bdb81[_0xcc34('0x34')][_0xcc34('0x26')]);_0x10e340['offset']=qs['offset'](_0x5bdb81[_0xcc34('0x34')][_0xcc34('0x25')]);}return _0x347416['getConfigurations'](_0x10e340);}})[_0xcc34('0x1a')](function(_0x37639f){if(_0x37639f){return _0x37639f?{'count':_0x4c3a36,'rows':_0x37639f}:null;}})['then'](respondWithResult(_0x38af51,null))['catch'](handleError(_0x38af51,null));};exports[_0xcc34('0x50')]=function(_0x24dc79,_0x46f9d4,_0x32d154){if(_0x24dc79[_0xcc34('0x4c')]['id']){delete _0x24dc79['body']['id'];}return db[_0xcc34('0x30')][_0xcc34('0x51')]({'where':{'id':_0x24dc79[_0xcc34('0x4e')]['id']}})[_0xcc34('0x1a')](handleEntityNotFound(_0x46f9d4,null))[_0xcc34('0x1a')](function(_0x75a881){if(_0x75a881){_0x24dc79['body']['AccountId']=_0x75a881['id'];_0x24dc79['body'][_0xcc34('0x52')]=integrations[_0xcc34('0x53')](_0x24dc79[_0xcc34('0x4c')][_0xcc34('0x54')],_0x24dc79['body']['type']);_0x24dc79[_0xcc34('0x4c')][_0xcc34('0x55')]=integrations[_0xcc34('0x56')](_0x24dc79[_0xcc34('0x4c')][_0xcc34('0x54')],_0x24dc79['body'][_0xcc34('0x42')]);return db[_0xcc34('0x57')][_0xcc34('0x4b')](_0x24dc79[_0xcc34('0x4c')],{'include':[{'model':db[_0xcc34('0x58')],'as':'Subjects'},{'model':db['SugarcrmField'],'as':'Descriptions'}]});}return null;})[_0xcc34('0x1a')](respondWithResult(_0x46f9d4,null))[_0xcc34('0x48')](handleError(_0x46f9d4,null));};exports[_0xcc34('0x59')]=function(_0x3b058f,_0x462e73,_0x27f0eb){var _0x2607c2='';var _0x13b363=['id',_0xcc34('0x2c'),_0xcc34('0x5a'),'created_by',_0xcc34('0x5b'),_0xcc34('0x5c'),_0xcc34('0x5d'),_0xcc34('0x5e'),_0xcc34('0x5f'),_0xcc34('0x60'),_0xcc34('0x61'),_0xcc34('0x62')];return db['SugarcrmAccount']['findOne']({'where':{'id':_0x3b058f['params']['id']},'attributes':['id','username',_0xcc34('0x63'),'remoteUri']})[_0xcc34('0x1a')](handleEntityNotFound(_0x462e73,null))[_0xcc34('0x1a')](function(_0x20c8a8){if(_0x20c8a8){_0x2607c2=_0x20c8a8[_0xcc34('0x64')];var _0x4ffef6=_0x2607c2[_0xcc34('0x65')](-0x1);if(_0x4ffef6==='/'){_0x2607c2=_0x2607c2[_0xcc34('0x66')](0x0,_0x2607c2[_0xcc34('0x67')](_0x4ffef6));}return rp({'method':_0xcc34('0x68'),'uri':util[_0xcc34('0x69')]('%s%s',_0x2607c2,_0xcc34('0x6a')),'json':!![],'form':{'method':'login','input_type':_0xcc34('0x6b'),'response_type':_0xcc34('0x6b'),'rest_data':JSON[_0xcc34('0x6c')]({'user_auth':{'user_name':_0x20c8a8[_0xcc34('0x6d')],'password':_0x20c8a8['password'],'encryption':_0xcc34('0x6e')},'application':_0xcc34('0x6f')})}});}})[_0xcc34('0x1a')](function(_0x11d856){if(_0x11d856&&_0x11d856[_0xcc34('0x2c')]!==_0xcc34('0x70')&&_0x11d856[_0xcc34('0x2c')]!=='Password\x20Expired'){return rp({'method':_0xcc34('0x68'),'uri':util[_0xcc34('0x69')](_0xcc34('0x71'),_0x2607c2,_0xcc34('0x6a')),'json':!![],'form':{'method':_0xcc34('0x72'),'input_type':_0xcc34('0x6b'),'response_type':'JSON','rest_data':JSON[_0xcc34('0x6c')]({'session':_0x11d856['id'],'module_name':_0xcc34('0x73')})}})[_0xcc34('0x1a')](function(_0x613e49){if(_0x613e49){var _0x198ea8=_[_0xcc34('0x74')](_0x613e49[_0xcc34('0x75')]);_[_0xcc34('0x76')](_0x198ea8,function(_0x2a4ab2){return _0x13b363[_0xcc34('0x77')](_0x2a4ab2[_0xcc34('0x2c')]);});return{'count':_0x198ea8['length'],'rows':_[_0xcc34('0x2f')](_0x198ea8,function(_0x476ab2){return{'id':_0x476ab2['name'],'name':_0x476ab2[_0xcc34('0x78')],'custom':_[_0xcc34('0x79')](_0x476ab2[_0xcc34('0x2c')],'_c')?!![]:![],'options':_0x476ab2[_0xcc34('0x44')]?_['map'](_['values'](_0x476ab2[_0xcc34('0x44')]),function(_0x304b65){return{'name':_0x304b65['value'],'value':_0x304b65[_0xcc34('0x2c')]};}):[]};})};}})[_0xcc34('0x1a')](respondWithResult(_0x462e73,null))[_0xcc34('0x48')](function(_0x43f586){var _0x12359f=_0x3b058f[_0xcc34('0x34')][_0xcc34('0x7a')]?0x1f4:_0x43f586[_0xcc34('0x7b')]||0x1f4;logger['error'](_0xcc34('0x7c'),_0xcc34('0x59'),_0x12359f,JSON[_0xcc34('0x6c')](_0x43f586));delete _0x43f586[_0xcc34('0x2c')];if(_0x12359f===0x191){_0x12359f=0x190;}_0x462e73[_0xcc34('0x22')](_0x12359f)[_0xcc34('0x2d')](_0x3b058f[_0xcc34('0x34')][_0xcc34('0x7a')]?{'message':'Wrong\x20credentials','statusCode':_0x43f586[_0xcc34('0x7b')]}:_0x43f586);});}else{var _0x385e72=0x1f4;_0x462e73['status'](_0x385e72)[_0xcc34('0x2d')]({'message':_0xcc34('0x7d'),'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 c72861a..8687942 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 _0x685f=['request-promise','path','rimraf','../../config/environment','./intSugarcrmAccount.attributes','../../components/integrations/configuration','exports','define','SugarcrmAccount','int_sugarcrm_accounts','../../config/logger','moment'];(function(_0x374993,_0x4f6e6a){var _0xb10b3c=function(_0x28d2dc){while(--_0x28d2dc){_0x374993['push'](_0x374993['shift']());}};_0xb10b3c(++_0x4f6e6a);}(_0x685f,0x17e));var _0xf685=function(_0x4f230c,_0x3350d8){_0x4f230c=_0x4f230c-0x0;var _0x15b1cf=_0x685f[_0x4f230c];return _0x15b1cf;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0xf685('0x0'))('api');var moment=require(_0xf685('0x1'));var BPromise=require('bluebird');var rp=require(_0xf685('0x2'));var fs=require('fs');var path=require(_0xf685('0x3'));var rimraf=require(_0xf685('0x4'));var config=require(_0xf685('0x5'));var attributes=require(_0xf685('0x6'));var integrations=require(_0xf685('0x7'));module[_0xf685('0x8')]=function(_0x1969c9,_0x449c98){return _0x1969c9[_0xf685('0x9')](_0xf685('0xa'),attributes,{'tableName':_0xf685('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xb339=['path','rimraf','../../components/integrations/configuration','exports','define','SugarcrmAccount','lodash','util','api','moment','bluebird'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xb339,0x69));var _0x9b33=function(_0x2046dd,_0x40a9ab){_0x2046dd=_0x2046dd-0x0;var _0x2eb055=_0xb339[_0x2046dd];return _0x2eb055;};'use strict';var _=require(_0x9b33('0x0'));var util=require(_0x9b33('0x1'));var logger=require('../../config/logger')(_0x9b33('0x2'));var moment=require(_0x9b33('0x3'));var BPromise=require(_0x9b33('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x9b33('0x5'));var rimraf=require(_0x9b33('0x6'));var config=require('../../config/environment');var attributes=require('./intSugarcrmAccount.attributes');var integrations=require(_0x9b33('0x7'));module[_0x9b33('0x8')]=function(_0x586f18,_0x42d14f){return _0x586f18[_0x9b33('0x9')](_0x9b33('0xa'),attributes,{'tableName':'int_sugarcrm_accounts','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 8d58b04..d8a4a18 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 _0xf634=['include','map','model','GetSugarcrmAccount','catch','ShowSugarcrmAccount','raw','util','moment','bluebird','ioredis','../../config/utils','rpc','client','then','info','SugarcrmAccount,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','SugarcrmAccount','findAll','options','where','attributes','limit'];(function(_0xc2d1dc,_0x56b390){var _0x4ea771=function(_0x1dc261){while(--_0x1dc261){_0xc2d1dc['push'](_0xc2d1dc['shift']());}};_0x4ea771(++_0x56b390);}(_0xf634,0xf7));var _0x4f63=function(_0x3c356c,_0x3f3bec){_0x3c356c=_0x3c356c-0x0;var _0x512812=_0xf634[_0x3c356c];return _0x512812;};'use strict';var _=require('lodash');var util=require(_0x4f63('0x0'));var moment=require(_0x4f63('0x1'));var BPromise=require(_0x4f63('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x4f63('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x4f63('0x4'));var logger=require('../../config/logger')(_0x4f63('0x5'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x4f63('0x6')]['http']({'port':0x232a});function respondWithRpcPromise(_0x4064e3,_0xd95e42,_0xc0dddd){return new BPromise(function(_0x5db5a2,_0xd35b2d){return client['request'](_0x4064e3,_0xc0dddd)[_0x4f63('0x7')](function(_0xffded7){logger[_0x4f63('0x8')](_0x4f63('0x9'),_0xd95e42,_0x4f63('0xa'));logger[_0x4f63('0xb')]('SugarcrmAccount,\x20%s,\x20%s,\x20%s',_0xd95e42,_0x4f63('0xa'),JSON[_0x4f63('0xc')](_0xffded7));if(_0xffded7[_0x4f63('0xd')]){if(_0xffded7['error'][_0x4f63('0xe')]===0x1f4){logger[_0x4f63('0xd')](_0x4f63('0x9'),_0xd95e42,_0xffded7[_0x4f63('0xd')][_0x4f63('0xf')]);return _0xd35b2d(_0xffded7[_0x4f63('0xd')]['message']);}logger[_0x4f63('0xd')](_0x4f63('0x9'),_0xd95e42,_0xffded7[_0x4f63('0xd')][_0x4f63('0xf')]);return _0x5db5a2(_0xffded7[_0x4f63('0xd')][_0x4f63('0xf')]);}else{logger[_0x4f63('0x8')](_0x4f63('0x9'),_0xd95e42,_0x4f63('0xa'));_0x5db5a2(_0xffded7[_0x4f63('0x10')][_0x4f63('0xf')]);}})['catch'](function(_0x4b6166){logger[_0x4f63('0xd')](_0x4f63('0x9'),_0xd95e42,_0x4b6166);_0xd35b2d(_0x4b6166);});});}exports['GetSugarcrmAccount']=function(_0x4c9094){var _0x2dcf81=this;return new Promise(function(_0x110b3b,_0x11eca4){return db[_0x4f63('0x11')][_0x4f63('0x12')]({'raw':_0x4c9094['options']?_0x4c9094[_0x4f63('0x13')]['raw']===undefined?!![]:![]:!![],'where':_0x4c9094[_0x4f63('0x13')]?_0x4c9094[_0x4f63('0x13')][_0x4f63('0x14')]||null:null,'attributes':_0x4c9094[_0x4f63('0x13')]?_0x4c9094['options'][_0x4f63('0x15')]||null:null,'limit':_0x4c9094[_0x4f63('0x13')]?_0x4c9094[_0x4f63('0x13')][_0x4f63('0x16')]||null:null,'include':_0x4c9094[_0x4f63('0x13')]?_0x4c9094['options'][_0x4f63('0x17')]?_['map'](_0x4c9094[_0x4f63('0x13')]['include'],function(_0x154e7b){return{'model':db[_0x154e7b['model']],'as':_0x154e7b['as'],'attributes':_0x154e7b[_0x4f63('0x15')],'include':_0x154e7b[_0x4f63('0x17')]?_['map'](_0x154e7b['include'],function(_0x43d54b){return{'model':db[_0x43d54b['model']],'as':_0x43d54b['as'],'attributes':_0x43d54b['attributes'],'include':_0x43d54b['include']?_[_0x4f63('0x18')](_0x43d54b[_0x4f63('0x17')],function(_0xfec797){return{'model':db[_0xfec797[_0x4f63('0x19')]],'as':_0xfec797['as'],'attributes':_0xfec797[_0x4f63('0x15')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x3dffc1){logger[_0x4f63('0x8')](_0x4f63('0x1a'),_0x4c9094);logger[_0x4f63('0xb')](_0x4f63('0x1a'),_0x4c9094,JSON[_0x4f63('0xc')](_0x3dffc1));_0x110b3b(_0x3dffc1);})[_0x4f63('0x1b')](function(_0x57b93e){logger[_0x4f63('0xd')](_0x4f63('0x1a'),_0x57b93e[_0x4f63('0xf')],_0x4c9094);_0x11eca4(_0x2dcf81[_0x4f63('0xd')](0x1f4,_0x57b93e['message']));});});};exports[_0x4f63('0x1c')]=function(_0x15569a){var _0x3bf614=this;return new Promise(function(_0x3a91e3,_0x5a522c){return db[_0x4f63('0x11')]['find']({'raw':_0x15569a[_0x4f63('0x13')]?_0x15569a[_0x4f63('0x13')][_0x4f63('0x1d')]===undefined?!![]:![]:!![],'where':_0x15569a[_0x4f63('0x13')]?_0x15569a[_0x4f63('0x13')]['where']||null:null,'attributes':_0x15569a[_0x4f63('0x13')]?_0x15569a[_0x4f63('0x13')][_0x4f63('0x15')]||null:null,'include':_0x15569a[_0x4f63('0x13')]?_0x15569a[_0x4f63('0x13')]['include']?_['map'](_0x15569a[_0x4f63('0x13')][_0x4f63('0x17')],function(_0x25959b){return{'model':db[_0x25959b['model']],'as':_0x25959b['as'],'attributes':_0x25959b[_0x4f63('0x15')],'include':_0x25959b['include']?_['map'](_0x25959b[_0x4f63('0x17')],function(_0x429b8e){return{'model':db[_0x429b8e[_0x4f63('0x19')]],'as':_0x429b8e['as'],'attributes':_0x429b8e['attributes'],'include':_0x429b8e[_0x4f63('0x17')]?_[_0x4f63('0x18')](_0x429b8e[_0x4f63('0x17')],function(_0x4af723){return{'model':db[_0x4af723[_0x4f63('0x19')]],'as':_0x4af723['as'],'attributes':_0x4af723[_0x4f63('0x15')]};}):[]};}):[]};}):[]:[]})[_0x4f63('0x7')](function(_0x46b726){logger[_0x4f63('0x8')]('ShowSugarcrmAccount',_0x15569a);logger[_0x4f63('0xb')](_0x4f63('0x1c'),_0x15569a,JSON['stringify'](_0x46b726));_0x3a91e3(_0x46b726);})[_0x4f63('0x1b')](function(_0x229118){logger[_0x4f63('0xd')](_0x4f63('0x1c'),_0x229118[_0x4f63('0xf')],_0x15569a);_0x5a522c(_0x3bf614[_0x4f63('0xd')](0x1f4,_0x229118[_0x4f63('0xf')]));});});}; \ No newline at end of file +var _0x0922=['message','SugarcrmAccount,\x20%s,\x20%s','result','catch','GetSugarcrmAccount','SugarcrmAccount','findAll','options','raw','where','limit','include','map','model','attributes','debug','ShowSugarcrmAccount','lodash','moment','randomstring','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','then','info','SugarcrmAccount,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code'];(function(_0x20845e,_0x211e78){var _0x28cf2b=function(_0x31d613){while(--_0x31d613){_0x20845e['push'](_0x20845e['shift']());}};_0x28cf2b(++_0x211e78);}(_0x0922,0xb6));var _0x2092=function(_0x1ccbcc,_0x5c948b){_0x1ccbcc=_0x1ccbcc-0x0;var _0x1e873f=_0x0922[_0x1ccbcc];return _0x1e873f;};'use strict';var _=require(_0x2092('0x0'));var util=require('util');var moment=require(_0x2092('0x1'));var BPromise=require('bluebird');var rs=require(_0x2092('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x2092('0x3'));var logger=require(_0x2092('0x4'))(_0x2092('0x5'));var config=require('../../config/environment');var jayson=require(_0x2092('0x6'));var client=jayson[_0x2092('0x7')][_0x2092('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x3bf65e,_0x5c9242,_0x5e3a19){return new BPromise(function(_0x10215a,_0x210b95){return client['request'](_0x3bf65e,_0x5e3a19)[_0x2092('0x9')](function(_0x10ff6d){logger[_0x2092('0xa')]('SugarcrmAccount,\x20%s,\x20%s',_0x5c9242,'request\x20sent');logger['debug'](_0x2092('0xb'),_0x5c9242,_0x2092('0xc'),JSON[_0x2092('0xd')](_0x10ff6d));if(_0x10ff6d[_0x2092('0xe')]){if(_0x10ff6d[_0x2092('0xe')][_0x2092('0xf')]===0x1f4){logger[_0x2092('0xe')]('SugarcrmAccount,\x20%s,\x20%s',_0x5c9242,_0x10ff6d[_0x2092('0xe')]['message']);return _0x210b95(_0x10ff6d[_0x2092('0xe')][_0x2092('0x10')]);}logger[_0x2092('0xe')](_0x2092('0x11'),_0x5c9242,_0x10ff6d[_0x2092('0xe')]['message']);return _0x10215a(_0x10ff6d[_0x2092('0xe')][_0x2092('0x10')]);}else{logger[_0x2092('0xa')](_0x2092('0x11'),_0x5c9242,_0x2092('0xc'));_0x10215a(_0x10ff6d[_0x2092('0x12')][_0x2092('0x10')]);}})[_0x2092('0x13')](function(_0x39ac6e){logger[_0x2092('0xe')](_0x2092('0x11'),_0x5c9242,_0x39ac6e);_0x210b95(_0x39ac6e);});});}exports[_0x2092('0x14')]=function(_0x3783f3){var _0x85fa11=this;return new Promise(function(_0x3c7bd3,_0x355264){return db[_0x2092('0x15')][_0x2092('0x16')]({'raw':_0x3783f3[_0x2092('0x17')]?_0x3783f3[_0x2092('0x17')][_0x2092('0x18')]===undefined?!![]:![]:!![],'where':_0x3783f3[_0x2092('0x17')]?_0x3783f3[_0x2092('0x17')][_0x2092('0x19')]||null:null,'attributes':_0x3783f3[_0x2092('0x17')]?_0x3783f3['options']['attributes']||null:null,'limit':_0x3783f3[_0x2092('0x17')]?_0x3783f3[_0x2092('0x17')][_0x2092('0x1a')]||null:null,'include':_0x3783f3[_0x2092('0x17')]?_0x3783f3[_0x2092('0x17')][_0x2092('0x1b')]?_[_0x2092('0x1c')](_0x3783f3['options'][_0x2092('0x1b')],function(_0x2d5719){return{'model':db[_0x2d5719[_0x2092('0x1d')]],'as':_0x2d5719['as'],'attributes':_0x2d5719[_0x2092('0x1e')],'include':_0x2d5719[_0x2092('0x1b')]?_[_0x2092('0x1c')](_0x2d5719[_0x2092('0x1b')],function(_0x44149f){return{'model':db[_0x44149f[_0x2092('0x1d')]],'as':_0x44149f['as'],'attributes':_0x44149f[_0x2092('0x1e')],'include':_0x44149f[_0x2092('0x1b')]?_[_0x2092('0x1c')](_0x44149f[_0x2092('0x1b')],function(_0x40bccc){return{'model':db[_0x40bccc[_0x2092('0x1d')]],'as':_0x40bccc['as'],'attributes':_0x40bccc[_0x2092('0x1e')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x174f0c){logger[_0x2092('0xa')](_0x2092('0x14'),_0x3783f3);logger[_0x2092('0x1f')]('GetSugarcrmAccount',_0x3783f3,JSON[_0x2092('0xd')](_0x174f0c));_0x3c7bd3(_0x174f0c);})[_0x2092('0x13')](function(_0x30d0ad){logger[_0x2092('0xe')](_0x2092('0x14'),_0x30d0ad[_0x2092('0x10')],_0x3783f3);_0x355264(_0x85fa11[_0x2092('0xe')](0x1f4,_0x30d0ad[_0x2092('0x10')]));});});};exports['ShowSugarcrmAccount']=function(_0x53aae1){var _0x2ebc78=this;return new Promise(function(_0x20d736,_0x369050){return db[_0x2092('0x15')]['find']({'raw':_0x53aae1[_0x2092('0x17')]?_0x53aae1[_0x2092('0x17')]['raw']===undefined?!![]:![]:!![],'where':_0x53aae1[_0x2092('0x17')]?_0x53aae1['options']['where']||null:null,'attributes':_0x53aae1[_0x2092('0x17')]?_0x53aae1[_0x2092('0x17')]['attributes']||null:null,'include':_0x53aae1['options']?_0x53aae1[_0x2092('0x17')][_0x2092('0x1b')]?_[_0x2092('0x1c')](_0x53aae1[_0x2092('0x17')]['include'],function(_0x55dc4b){return{'model':db[_0x55dc4b['model']],'as':_0x55dc4b['as'],'attributes':_0x55dc4b[_0x2092('0x1e')],'include':_0x55dc4b['include']?_[_0x2092('0x1c')](_0x55dc4b[_0x2092('0x1b')],function(_0x439ddb){return{'model':db[_0x439ddb[_0x2092('0x1d')]],'as':_0x439ddb['as'],'attributes':_0x439ddb[_0x2092('0x1e')],'include':_0x439ddb[_0x2092('0x1b')]?_[_0x2092('0x1c')](_0x439ddb['include'],function(_0xdbfa9){return{'model':db[_0xdbfa9[_0x2092('0x1d')]],'as':_0xdbfa9['as'],'attributes':_0xdbfa9[_0x2092('0x1e')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x177218){logger[_0x2092('0xa')](_0x2092('0x20'),_0x53aae1);logger['debug'](_0x2092('0x20'),_0x53aae1,JSON['stringify'](_0x177218));_0x20d736(_0x177218);})['catch'](function(_0x48684f){logger[_0x2092('0xe')]('ShowSugarcrmAccount',_0x48684f[_0x2092('0x10')],_0x53aae1);_0x369050(_0x2ebc78[_0x2092('0xe')](0x1f4,_0x48684f['message']));});});}; \ No newline at end of file diff --git a/server/api/intSugarcrmConfiguration/index.js b/server/api/intSugarcrmConfiguration/index.js index 5a638e8..baf9334 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 _0x68ff=['put','delete','destroy','exports','multer','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./intSugarcrmConfiguration.controller','get','isAuthenticated','/:id','/:id/fields','getFields','/:id/subjects','/:id/descriptions','getDescriptions','post','create'];(function(_0x25ad30,_0x4d9cb8){var _0x97c45e=function(_0x2f3b62){while(--_0x2f3b62){_0x25ad30['push'](_0x25ad30['shift']());}};_0x97c45e(++_0x4d9cb8);}(_0x68ff,0x101));var _0xf68f=function(_0x6c891d,_0x5e52d8){_0x6c891d=_0x6c891d-0x0;var _0x100230=_0x68ff[_0x6c891d];return _0x100230;};'use strict';var multer=require(_0xf68f('0x0'));var util=require('util');var path=require(_0xf68f('0x1'));var timeout=require(_0xf68f('0x2'));var express=require(_0xf68f('0x3'));var router=express[_0xf68f('0x4')]();var auth=require(_0xf68f('0x5'));var interaction=require(_0xf68f('0x6'));var config=require(_0xf68f('0x7'));var controller=require(_0xf68f('0x8'));router[_0xf68f('0x9')]('/',auth[_0xf68f('0xa')](),controller['index']);router[_0xf68f('0x9')](_0xf68f('0xb'),auth['isAuthenticated'](),controller['show']);router[_0xf68f('0x9')](_0xf68f('0xc'),auth[_0xf68f('0xa')](),controller[_0xf68f('0xd')]);router['get'](_0xf68f('0xe'),auth[_0xf68f('0xa')](),controller['getSubjects']);router[_0xf68f('0x9')](_0xf68f('0xf'),auth[_0xf68f('0xa')](),controller[_0xf68f('0x10')]);router[_0xf68f('0x11')]('/',auth[_0xf68f('0xa')](),controller[_0xf68f('0x12')]);router[_0xf68f('0x13')](_0xf68f('0xb'),auth[_0xf68f('0xa')](),controller['update']);router[_0xf68f('0x14')]('/:id',auth['isAuthenticated'](),controller[_0xf68f('0x15')]);module[_0xf68f('0x16')]=router; \ No newline at end of file +var _0x3bf7=['post','create','/:id','destroy','exports','util','path','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/:id/subjects','getSubjects','/:id/descriptions','getDescriptions'];(function(_0x3a9d2b,_0x4a754d){var _0x50dff9=function(_0x300429){while(--_0x300429){_0x3a9d2b['push'](_0x3a9d2b['shift']());}};_0x50dff9(++_0x4a754d);}(_0x3bf7,0x1a7));var _0x73bf=function(_0x58a167,_0x68d863){_0x58a167=_0x58a167-0x0;var _0x409187=_0x3bf7[_0x58a167];return _0x409187;};'use strict';var multer=require('multer');var util=require(_0x73bf('0x0'));var path=require(_0x73bf('0x1'));var timeout=require(_0x73bf('0x2'));var express=require('express');var router=express[_0x73bf('0x3')]();var auth=require(_0x73bf('0x4'));var interaction=require(_0x73bf('0x5'));var config=require(_0x73bf('0x6'));var controller=require('./intSugarcrmConfiguration.controller');router[_0x73bf('0x7')]('/',auth[_0x73bf('0x8')](),controller[_0x73bf('0x9')]);router[_0x73bf('0x7')]('/:id',auth[_0x73bf('0x8')](),controller['show']);router[_0x73bf('0x7')]('/:id/fields',auth[_0x73bf('0x8')](),controller['getFields']);router[_0x73bf('0x7')](_0x73bf('0xa'),auth[_0x73bf('0x8')](),controller[_0x73bf('0xb')]);router['get'](_0x73bf('0xc'),auth[_0x73bf('0x8')](),controller[_0x73bf('0xd')]);router[_0x73bf('0xe')]('/',auth[_0x73bf('0x8')](),controller[_0x73bf('0xf')]);router['put'](_0x73bf('0x10'),auth[_0x73bf('0x8')](),controller['update']);router['delete'](_0x73bf('0x10'),auth[_0x73bf('0x8')](),controller[_0x73bf('0x11')]);module[_0x73bf('0x12')]=router; \ No newline at end of file diff --git a/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.attributes.js b/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.attributes.js index 67b7426..ca1e99d 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 _0xf532=['sequelize','STRING'];(function(_0x155304,_0x1a1594){var _0xbd8796=function(_0x37a300){while(--_0x37a300){_0x155304['push'](_0x155304['shift']());}};_0xbd8796(++_0x1a1594);}(_0xf532,0xb8));var _0x2f53=function(_0x2f3794,_0x3c3bec){_0x2f3794=_0x2f3794-0x0;var _0x1c9fbe=_0xf532[_0x2f3794];return _0x1c9fbe;};'use strict';var Sequelize=require(_0x2f53('0x0'));module['exports']={'name':{'type':Sequelize[_0x2f53('0x1')]},'description':{'type':Sequelize[_0x2f53('0x1')]}}; \ No newline at end of file +var _0xf012=['STRING','sequelize'];(function(_0x27a43f,_0x4b7cc9){var _0x4c9aab=function(_0x566328){while(--_0x566328){_0x27a43f['push'](_0x27a43f['shift']());}};_0x4c9aab(++_0x4b7cc9);}(_0xf012,0x1bb));var _0x2f01=function(_0xf27a5d,_0x5a3b2f){_0xf27a5d=_0xf27a5d-0x0;var _0x217da7=_0xf012[_0xf27a5d];return _0x217da7;};'use strict';var Sequelize=require(_0x2f01('0x0'));module['exports']={'name':{'type':Sequelize[_0x2f01('0x1')]},'description':{'type':Sequelize[_0x2f01('0x1')]}}; \ No newline at end of file diff --git a/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.controller.js b/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.controller.js index 9e1e641..3b5fa56 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 _0x03bd=['SugarcrmConfiguration,\x20%s,\x20%s','request\x20sent','debug','SugarcrmConfiguration,\x20%s,\x20%s,\x20%s','error','code','message','info','sendStatus','status','end','json','count','offset','limit','set','Content-Range','apply','reject','update','destroy','stack','name','send','SugarcrmConfiguration','fieldName','model','map','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','order','sort','where','pick','filter','merge','type','VIRTUAL','options','includeAll','include','catch','show','params','rawAttributes','find','create','body','getFields','SugarcrmField','nolimit','getSubjects','getDescriptions','findOne','html-pdf','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','path','sox','ejs','lodash','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','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~!@#$%^&-_=+[{]}.','then'];(function(_0x56e74c,_0x43a3bd){var _0x44a912=function(_0x20fc4c){while(--_0x20fc4c){_0x56e74c['push'](_0x56e74c['shift']());}};_0x44a912(++_0x43a3bd);}(_0x03bd,0x99));var _0xd03b=function(_0x16375b,_0x431357){_0x16375b=_0x16375b-0x0;var _0x371400=_0x03bd[_0x16375b];return _0x371400;};'use strict';var pdf=require(_0xd03b('0x0'));var emlformat=require(_0xd03b('0x1'));var rimraf=require('rimraf');var zipdir=require(_0xd03b('0x2'));var jsonpatch=require(_0xd03b('0x3'));var rp=require(_0xd03b('0x4'));var moment=require(_0xd03b('0x5'));var BPromise=require(_0xd03b('0x6'));var Mustache=require('mustache');var util=require('util');var path=require(_0xd03b('0x7'));var sox=require(_0xd03b('0x8'));var csv=require('to-csv');var ejs=require(_0xd03b('0x9'));var fs=require('fs');var _=require(_0xd03b('0xa'));var squel=require('squel');var crypto=require(_0xd03b('0xb'));var jsforce=require(_0xd03b('0xc'));var deskjs=require(_0xd03b('0xd'));var toCsv=require(_0xd03b('0xe'));var querystring=require(_0xd03b('0xf'));var Papa=require(_0xd03b('0x10'));var Redis=require(_0xd03b('0x11'));var authService=require(_0xd03b('0x12'));var qs=require(_0xd03b('0x13'));var as=require(_0xd03b('0x14'));var hardwareService=require(_0xd03b('0x15'));var logger=require('../../config/logger')(_0xd03b('0x16'));var utils=require(_0xd03b('0x17'));var config=require('../../config/environment');var db=require(_0xd03b('0x18'))['db'];var jayson=require(_0xd03b('0x19'));var client=jayson[_0xd03b('0x1a')][_0xd03b('0x1b')]({'port':0x232a});function checkPasswordPattern(_0xc91633,_0x521280,_0x35715c){if(_0x35715c){var _0xc615b1=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0xc615b1[_0xd03b('0x1c')](_0x521280)){return _0xc91633;}else{throw new db[(_0xd03b('0x1d'))][(_0xd03b('0x1e'))](_0xd03b('0x1f'));}}else{return _0xc91633;}}function respondWithRpcPromise(_0x28aa61,_0x58174a,_0x4b7198,_0x470f5c){return new BPromise(function(_0x2ef9ea,_0x5a0432){var _0x2d623f=_0x470f5c||client;return _0x2d623f['request'](_0x28aa61,_0x4b7198)[_0xd03b('0x20')](function(_0x24877c){logger['info'](_0xd03b('0x21'),_0x58174a,_0xd03b('0x22'));logger[_0xd03b('0x23')](_0xd03b('0x24'),_0x58174a,'request\x20sent',JSON['stringify'](_0x24877c));if(_0x24877c[_0xd03b('0x25')]){if(_0x24877c[_0xd03b('0x25')][_0xd03b('0x26')]===0x1f4){logger['error'](_0xd03b('0x21'),_0x58174a,_0x24877c[_0xd03b('0x25')]['message']);return _0x5a0432(_0x24877c[_0xd03b('0x25')][_0xd03b('0x27')]);}logger[_0xd03b('0x25')](_0xd03b('0x21'),_0x58174a,_0x24877c['error'][_0xd03b('0x27')]);return _0x2ef9ea(_0x24877c[_0xd03b('0x25')][_0xd03b('0x27')]);}else{logger[_0xd03b('0x28')](_0xd03b('0x21'),_0x58174a,_0xd03b('0x22'));_0x2ef9ea(_0x24877c['result'][_0xd03b('0x27')]);}})['catch'](function(_0x3ad361){logger['error'](_0xd03b('0x21'),_0x58174a,_0x3ad361);_0x5a0432(_0x3ad361);});});}function respondWithStatusCode(_0x2a03c1,_0xfe7b23){_0xfe7b23=_0xfe7b23||0xcc;return function(_0x4b1280){if(_0x4b1280){return _0x2a03c1[_0xd03b('0x29')](_0xfe7b23);}return _0x2a03c1[_0xd03b('0x2a')](_0xfe7b23)[_0xd03b('0x2b')]();};}function respondWithResult(_0x1e62d3,_0x1c1772){_0x1c1772=_0x1c1772||0xc8;return function(_0x5990a1){if(_0x5990a1){return _0x1e62d3['status'](_0x1c1772)[_0xd03b('0x2c')](_0x5990a1);}};}function respondWithFilteredResult(_0x56de9b,_0xb3463e){return function(_0x7a36aa){if(_0x7a36aa){var _0x5726d9=_0x7a36aa[_0xd03b('0x2d')],_0x348ae2=_0xb3463e[_0xd03b('0x2e')],_0x599fb7=_0xb3463e[_0xd03b('0x2e')]+_0xb3463e[_0xd03b('0x2f')],_0x55b28f;if(_0x599fb7>=_0x5726d9){_0x599fb7=_0x5726d9;_0x55b28f=0xc8;}else{_0x55b28f=0xce;}_0x56de9b[_0xd03b('0x2a')](_0x55b28f);return _0x56de9b[_0xd03b('0x30')](_0xd03b('0x31'),_0x348ae2+'-'+_0x599fb7+'/'+_0x5726d9)[_0xd03b('0x2c')](_0x7a36aa);}return null;};}function patchUpdates(_0x24cb34){return function(_0x3a2ef0){try{jsonpatch[_0xd03b('0x32')](_0x3a2ef0,_0x24cb34,!![]);}catch(_0x2157e6){return BPromise[_0xd03b('0x33')](_0x2157e6);}return _0x3a2ef0['save']();};}function saveUpdates(_0x1fbe43,_0x1946a7){return function(_0x331371){if(_0x331371){return _0x331371[_0xd03b('0x34')](_0x1fbe43)['then'](function(_0x13c159){return _0x13c159;});}return null;};}function removeEntity(_0x137a4e,_0x3e0ae5){return function(_0x26252a){if(_0x26252a){return _0x26252a[_0xd03b('0x35')]()[_0xd03b('0x20')](function(){_0x137a4e[_0xd03b('0x2a')](0xcc)[_0xd03b('0x2b')]();});}};}function handleEntityNotFound(_0x1c7a29,_0x1beeef){return function(_0x5a02dc){if(!_0x5a02dc){_0x1c7a29['sendStatus'](0x194);}return _0x5a02dc;};}function handleError(_0x3b6743,_0x49074d){_0x49074d=_0x49074d||0x1f4;return function(_0x5c967a){logger[_0xd03b('0x25')](_0x5c967a[_0xd03b('0x36')]);if(_0x5c967a[_0xd03b('0x37')]){delete _0x5c967a[_0xd03b('0x37')];}_0x3b6743[_0xd03b('0x2a')](_0x49074d)[_0xd03b('0x38')](_0x5c967a);};}exports['index']=function(_0x45e31d,_0x12b9f2){var _0x423298={},_0x340036={},_0x3f800a={'count':0x0,'rows':[]};var _0x332761=_['map'](db[_0xd03b('0x39')]['rawAttributes'],function(_0x3276b1){return{'name':_0x3276b1[_0xd03b('0x3a')],'type':_0x3276b1['type']['key']};});_0x340036[_0xd03b('0x3b')]=_[_0xd03b('0x3c')](_0x332761,'name');_0x340036[_0xd03b('0x3d')]=_[_0xd03b('0x3e')](_0x45e31d[_0xd03b('0x3d')]);_0x340036[_0xd03b('0x3f')]=_[_0xd03b('0x40')](_0x340036[_0xd03b('0x3b')],_0x340036['query']);_0x423298[_0xd03b('0x41')]=_[_0xd03b('0x40')](_0x340036[_0xd03b('0x3b')],qs[_0xd03b('0x42')](_0x45e31d[_0xd03b('0x3d')]['fields']));_0x423298[_0xd03b('0x41')]=_0x423298[_0xd03b('0x41')][_0xd03b('0x43')]?_0x423298['attributes']:_0x340036[_0xd03b('0x3b')];if(!_0x45e31d['query'][_0xd03b('0x44')]('nolimit')){_0x423298[_0xd03b('0x2f')]=qs['limit'](_0x45e31d['query'][_0xd03b('0x2f')]);_0x423298['offset']=qs['offset'](_0x45e31d['query']['offset']);}_0x423298[_0xd03b('0x45')]=qs[_0xd03b('0x46')](_0x45e31d[_0xd03b('0x3d')][_0xd03b('0x46')]);_0x423298[_0xd03b('0x47')]=qs['filters'](_[_0xd03b('0x48')](_0x45e31d[_0xd03b('0x3d')],_0x340036['filters']));if(_0x45e31d['query'][_0xd03b('0x49')]){_0x423298[_0xd03b('0x47')]=_[_0xd03b('0x4a')](_0x423298[_0xd03b('0x47')],{'$or':_['map'](_0x332761,function(_0x277555){if(_0x277555[_0xd03b('0x4b')]!==_0xd03b('0x4c')){var _0x1e2d58={};_0x1e2d58[_0x277555[_0xd03b('0x37')]]={'$like':'%'+_0x45e31d[_0xd03b('0x3d')][_0xd03b('0x49')]+'%'};return _0x1e2d58;}})});}_0x423298=_[_0xd03b('0x4a')]({},_0x423298,_0x45e31d[_0xd03b('0x4d')]);var _0x533fa0={'where':_0x423298['where']};return db[_0xd03b('0x39')][_0xd03b('0x2d')](_0x533fa0)[_0xd03b('0x20')](function(_0x58620d){_0x3f800a[_0xd03b('0x2d')]=_0x58620d;if(_0x45e31d[_0xd03b('0x3d')][_0xd03b('0x4e')]){_0x423298[_0xd03b('0x4f')]=[{'all':!![]}];}return db[_0xd03b('0x39')]['findAll'](_0x423298);})['then'](function(_0x539ac6){_0x3f800a['rows']=_0x539ac6;return _0x3f800a;})[_0xd03b('0x20')](respondWithFilteredResult(_0x12b9f2,_0x423298))[_0xd03b('0x50')](handleError(_0x12b9f2,null));};exports[_0xd03b('0x51')]=function(_0x4b6b63,_0x3cd5bf){var _0x5a9fc8={'raw':![],'where':{'id':_0x4b6b63[_0xd03b('0x52')]['id']}},_0x5afbcf={};_0x5afbcf[_0xd03b('0x3b')]=_[_0xd03b('0x3e')](db[_0xd03b('0x39')][_0xd03b('0x53')]);_0x5afbcf[_0xd03b('0x3d')]=_[_0xd03b('0x3e')](_0x4b6b63['query']);_0x5afbcf[_0xd03b('0x3f')]=_[_0xd03b('0x40')](_0x5afbcf[_0xd03b('0x3b')],_0x5afbcf['query']);_0x5a9fc8['attributes']=_['intersection'](_0x5afbcf[_0xd03b('0x3b')],qs[_0xd03b('0x42')](_0x4b6b63[_0xd03b('0x3d')][_0xd03b('0x42')]));_0x5a9fc8['attributes']=_0x5a9fc8[_0xd03b('0x41')]['length']?_0x5a9fc8[_0xd03b('0x41')]:_0x5afbcf[_0xd03b('0x3b')];if(_0x4b6b63[_0xd03b('0x3d')][_0xd03b('0x4e')]){_0x5a9fc8[_0xd03b('0x4f')]=[{'all':!![]}];}_0x5a9fc8=_['merge']({},_0x5a9fc8,_0x4b6b63[_0xd03b('0x4d')]);return db[_0xd03b('0x39')][_0xd03b('0x54')](_0x5a9fc8)['then'](handleEntityNotFound(_0x3cd5bf,null))[_0xd03b('0x20')](respondWithResult(_0x3cd5bf,null))['catch'](handleError(_0x3cd5bf,null));};exports['create']=function(_0x1e3a73,_0x5da1de){return db[_0xd03b('0x39')][_0xd03b('0x55')](_0x1e3a73[_0xd03b('0x56')],{})[_0xd03b('0x20')](respondWithResult(_0x5da1de,0xc9))[_0xd03b('0x50')](handleError(_0x5da1de,null));};exports['update']=function(_0x201ece,_0xa9cf27){if(_0x201ece['body']['id']){delete _0x201ece['body']['id'];}return db[_0xd03b('0x39')][_0xd03b('0x54')]({'where':{'id':_0x201ece[_0xd03b('0x52')]['id']}})[_0xd03b('0x20')](handleEntityNotFound(_0xa9cf27,null))['then'](saveUpdates(_0x201ece[_0xd03b('0x56')],null))[_0xd03b('0x20')](respondWithResult(_0xa9cf27,null))['catch'](handleError(_0xa9cf27,null));};exports[_0xd03b('0x35')]=function(_0x5dc10c,_0x3faca8){return db[_0xd03b('0x39')][_0xd03b('0x54')]({'where':{'id':_0x5dc10c[_0xd03b('0x52')]['id']}})['then'](handleEntityNotFound(_0x3faca8,null))[_0xd03b('0x20')](removeEntity(_0x3faca8,null))[_0xd03b('0x50')](handleError(_0x3faca8,null));};exports[_0xd03b('0x57')]=function(_0x265a53,_0x4ab239,_0x2aec9d){var _0x157a49={};var _0x55bb70={};var _0x2892b4;var _0x5b6759;return db[_0xd03b('0x39')]['findOne']({'where':{'id':_0x265a53['params']['id']}})[_0xd03b('0x20')](handleEntityNotFound(_0x4ab239,null))[_0xd03b('0x20')](function(_0xafa274){if(_0xafa274){_0x2892b4=_0xafa274;_0x55bb70[_0xd03b('0x3b')]=_[_0xd03b('0x3e')](db[_0xd03b('0x58')][_0xd03b('0x53')]);_0x55bb70[_0xd03b('0x3d')]=_[_0xd03b('0x3e')](_0x265a53['query']);_0x55bb70[_0xd03b('0x3f')]=_[_0xd03b('0x40')](_0x55bb70[_0xd03b('0x3b')],_0x55bb70[_0xd03b('0x3d')]);_0x157a49[_0xd03b('0x41')]=_[_0xd03b('0x40')](_0x55bb70[_0xd03b('0x3b')],qs[_0xd03b('0x42')](_0x265a53[_0xd03b('0x3d')][_0xd03b('0x42')]));_0x157a49['attributes']=_0x157a49['attributes']['length']?_0x157a49[_0xd03b('0x41')]:_0x55bb70[_0xd03b('0x3b')];_0x157a49['order']=qs['sort'](_0x265a53[_0xd03b('0x3d')][_0xd03b('0x46')]);_0x157a49[_0xd03b('0x47')]=qs[_0xd03b('0x3f')](_['pick'](_0x265a53[_0xd03b('0x3d')],_0x55bb70['filters']));if(_0x265a53[_0xd03b('0x3d')][_0xd03b('0x49')]){_0x157a49[_0xd03b('0x47')]=_[_0xd03b('0x4a')](_0x157a49[_0xd03b('0x47')],{'$or':_[_0xd03b('0x3c')](_0x157a49[_0xd03b('0x41')],function(_0x33f55e){var _0x4c8835={};_0x4c8835[_0x33f55e]={'$like':'%'+_0x265a53[_0xd03b('0x3d')]['filter']+'%'};return _0x4c8835;})});}_0x157a49=_['merge']({},_0x157a49,_0x265a53['options']);return _0x2892b4[_0xd03b('0x57')](_0x157a49);}})['then'](function(_0x593838){if(_0x593838){_0x5b6759=_0x593838['length'];if(!_0x265a53[_0xd03b('0x3d')][_0xd03b('0x44')](_0xd03b('0x59'))){_0x157a49[_0xd03b('0x2f')]=qs['limit'](_0x265a53[_0xd03b('0x3d')][_0xd03b('0x2f')]);_0x157a49[_0xd03b('0x2e')]=qs['offset'](_0x265a53[_0xd03b('0x3d')][_0xd03b('0x2e')]);}return _0x2892b4['getFields'](_0x157a49);}})[_0xd03b('0x20')](function(_0x345486){if(_0x345486){return _0x345486?{'count':_0x5b6759,'rows':_0x345486}:null;}})[_0xd03b('0x20')](respondWithResult(_0x4ab239,null))[_0xd03b('0x50')](handleError(_0x4ab239,null));};exports[_0xd03b('0x5a')]=function(_0x264153,_0x2d5946,_0x73c7dc){var _0x2abcac={};var _0x92e267={};var _0x100fab;var _0x313c05;return db['SugarcrmConfiguration']['findOne']({'where':{'id':_0x264153[_0xd03b('0x52')]['id']}})['then'](handleEntityNotFound(_0x2d5946,null))['then'](function(_0x3919fe){if(_0x3919fe){_0x100fab=_0x3919fe;_0x92e267[_0xd03b('0x3b')]=_[_0xd03b('0x3e')](db[_0xd03b('0x58')][_0xd03b('0x53')]);_0x92e267[_0xd03b('0x3d')]=_['keys'](_0x264153[_0xd03b('0x3d')]);_0x92e267['filters']=_[_0xd03b('0x40')](_0x92e267[_0xd03b('0x3b')],_0x92e267['query']);_0x2abcac[_0xd03b('0x41')]=_['intersection'](_0x92e267[_0xd03b('0x3b')],qs[_0xd03b('0x42')](_0x264153[_0xd03b('0x3d')]['fields']));_0x2abcac[_0xd03b('0x41')]=_0x2abcac[_0xd03b('0x41')][_0xd03b('0x43')]?_0x2abcac['attributes']:_0x92e267[_0xd03b('0x3b')];_0x2abcac[_0xd03b('0x45')]=qs[_0xd03b('0x46')](_0x264153[_0xd03b('0x3d')]['sort']);_0x2abcac[_0xd03b('0x47')]=qs['filters'](_[_0xd03b('0x48')](_0x264153[_0xd03b('0x3d')],_0x92e267['filters']));if(_0x264153[_0xd03b('0x3d')]['filter']){_0x2abcac[_0xd03b('0x47')]=_[_0xd03b('0x4a')](_0x2abcac[_0xd03b('0x47')],{'$or':_[_0xd03b('0x3c')](_0x2abcac['attributes'],function(_0x145cc1){var _0x5bca91={};_0x5bca91[_0x145cc1]={'$like':'%'+_0x264153['query'][_0xd03b('0x49')]+'%'};return _0x5bca91;})});}_0x2abcac=_['merge']({},_0x2abcac,_0x264153[_0xd03b('0x4d')]);return _0x100fab[_0xd03b('0x5a')](_0x2abcac);}})[_0xd03b('0x20')](function(_0x52e6ed){if(_0x52e6ed){_0x313c05=_0x52e6ed['length'];if(!_0x264153[_0xd03b('0x3d')][_0xd03b('0x44')]('nolimit')){_0x2abcac[_0xd03b('0x2f')]=qs[_0xd03b('0x2f')](_0x264153['query'][_0xd03b('0x2f')]);_0x2abcac[_0xd03b('0x2e')]=qs[_0xd03b('0x2e')](_0x264153['query'][_0xd03b('0x2e')]);}return _0x100fab['getSubjects'](_0x2abcac);}})[_0xd03b('0x20')](function(_0x2b8134){if(_0x2b8134){return _0x2b8134?{'count':_0x313c05,'rows':_0x2b8134}:null;}})['then'](respondWithResult(_0x2d5946,null))[_0xd03b('0x50')](handleError(_0x2d5946,null));};exports[_0xd03b('0x5b')]=function(_0x56f7ef,_0x13a272,_0x3cf9b8){var _0x3be5d2={};var _0x53fcec={};var _0x103cf9;var _0x37cc4c;return db[_0xd03b('0x39')][_0xd03b('0x5c')]({'where':{'id':_0x56f7ef[_0xd03b('0x52')]['id']}})['then'](handleEntityNotFound(_0x13a272,null))[_0xd03b('0x20')](function(_0xe2fc16){if(_0xe2fc16){_0x103cf9=_0xe2fc16;_0x53fcec[_0xd03b('0x3b')]=_[_0xd03b('0x3e')](db[_0xd03b('0x58')][_0xd03b('0x53')]);_0x53fcec[_0xd03b('0x3d')]=_[_0xd03b('0x3e')](_0x56f7ef[_0xd03b('0x3d')]);_0x53fcec['filters']=_['intersection'](_0x53fcec[_0xd03b('0x3b')],_0x53fcec['query']);_0x3be5d2['attributes']=_[_0xd03b('0x40')](_0x53fcec[_0xd03b('0x3b')],qs[_0xd03b('0x42')](_0x56f7ef['query'][_0xd03b('0x42')]));_0x3be5d2[_0xd03b('0x41')]=_0x3be5d2['attributes']['length']?_0x3be5d2['attributes']:_0x53fcec[_0xd03b('0x3b')];_0x3be5d2[_0xd03b('0x45')]=qs[_0xd03b('0x46')](_0x56f7ef[_0xd03b('0x3d')][_0xd03b('0x46')]);_0x3be5d2[_0xd03b('0x47')]=qs[_0xd03b('0x3f')](_['pick'](_0x56f7ef[_0xd03b('0x3d')],_0x53fcec[_0xd03b('0x3f')]));if(_0x56f7ef[_0xd03b('0x3d')][_0xd03b('0x49')]){_0x3be5d2[_0xd03b('0x47')]=_[_0xd03b('0x4a')](_0x3be5d2['where'],{'$or':_[_0xd03b('0x3c')](_0x3be5d2[_0xd03b('0x41')],function(_0x29c145){var _0x3df0b2={};_0x3df0b2[_0x29c145]={'$like':'%'+_0x56f7ef[_0xd03b('0x3d')]['filter']+'%'};return _0x3df0b2;})});}_0x3be5d2=_['merge']({},_0x3be5d2,_0x56f7ef[_0xd03b('0x4d')]);return _0x103cf9[_0xd03b('0x5b')](_0x3be5d2);}})[_0xd03b('0x20')](function(_0x11927d){if(_0x11927d){_0x37cc4c=_0x11927d[_0xd03b('0x43')];if(!_0x56f7ef['query'][_0xd03b('0x44')](_0xd03b('0x59'))){_0x3be5d2[_0xd03b('0x2f')]=qs[_0xd03b('0x2f')](_0x56f7ef[_0xd03b('0x3d')][_0xd03b('0x2f')]);_0x3be5d2[_0xd03b('0x2e')]=qs[_0xd03b('0x2e')](_0x56f7ef[_0xd03b('0x3d')][_0xd03b('0x2e')]);}return _0x103cf9[_0xd03b('0x5b')](_0x3be5d2);}})[_0xd03b('0x20')](function(_0x175075){if(_0x175075){return _0x175075?{'count':_0x37cc4c,'rows':_0x175075}:null;}})[_0xd03b('0x20')](respondWithResult(_0x13a272,null))[_0xd03b('0x50')](handleError(_0x13a272,null));}; \ No newline at end of file +var _0xc7f2=['Sequelize','request','then','info','SugarcrmConfiguration,\x20%s,\x20%s','request\x20sent','debug','SugarcrmConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','sendStatus','status','end','json','count','offset','set','Content-Range','apply','reject','update','destroy','stack','name','fieldName','type','key','model','map','keys','query','intersection','fields','attributes','hasOwnProperty','nolimit','limit','sort','where','filters','pick','filter','merge','options','SugarcrmConfiguration','includeAll','include','findAll','rows','params','rawAttributes','create','body','find','getFields','findOne','SugarcrmField','length','order','getSubjects','getDescriptions','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','api','../../config/environment','jayson/promise','client','http','test'];(function(_0x2dee82,_0x5a4509){var _0xc58f=function(_0x4d2a27){while(--_0x4d2a27){_0x2dee82['push'](_0x2dee82['shift']());}};_0xc58f(++_0x5a4509);}(_0xc7f2,0xf4));var _0x2c7f=function(_0x3c1099,_0x4cd808){_0x3c1099=_0x3c1099-0x0;var _0x1ae4bf=_0xc7f2[_0x3c1099];return _0x1ae4bf;};'use strict';var pdf=require(_0x2c7f('0x0'));var emlformat=require(_0x2c7f('0x1'));var rimraf=require(_0x2c7f('0x2'));var zipdir=require(_0x2c7f('0x3'));var jsonpatch=require(_0x2c7f('0x4'));var rp=require(_0x2c7f('0x5'));var moment=require(_0x2c7f('0x6'));var BPromise=require(_0x2c7f('0x7'));var Mustache=require(_0x2c7f('0x8'));var util=require('util');var path=require(_0x2c7f('0x9'));var sox=require('sox');var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var _=require(_0x2c7f('0xa'));var squel=require(_0x2c7f('0xb'));var crypto=require(_0x2c7f('0xc'));var jsforce=require(_0x2c7f('0xd'));var deskjs=require(_0x2c7f('0xe'));var toCsv=require(_0x2c7f('0xf'));var querystring=require(_0x2c7f('0x10'));var Papa=require(_0x2c7f('0x11'));var Redis=require('ioredis');var authService=require(_0x2c7f('0x12'));var qs=require(_0x2c7f('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x2c7f('0x14'));var utils=require('../../config/utils');var config=require(_0x2c7f('0x15'));var db=require('../../mysqldb')['db'];var jayson=require(_0x2c7f('0x16'));var client=jayson[_0x2c7f('0x17')][_0x2c7f('0x18')]({'port':0x232a});function checkPasswordPattern(_0x579ddb,_0x347ff1,_0xf75311){if(_0xf75311){var _0x310a82=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x310a82[_0x2c7f('0x19')](_0x347ff1)){return _0x579ddb;}else{throw new db[(_0x2c7f('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 _0x579ddb;}}function respondWithRpcPromise(_0xe4f0e7,_0x18c621,_0x3a40ca,_0x3fd6c9){return new BPromise(function(_0x372aef,_0x5d797a){var _0x3089c1=_0x3fd6c9||client;return _0x3089c1[_0x2c7f('0x1b')](_0xe4f0e7,_0x3a40ca)[_0x2c7f('0x1c')](function(_0x3f3a89){logger[_0x2c7f('0x1d')](_0x2c7f('0x1e'),_0x18c621,_0x2c7f('0x1f'));logger[_0x2c7f('0x20')](_0x2c7f('0x21'),_0x18c621,_0x2c7f('0x1f'),JSON[_0x2c7f('0x22')](_0x3f3a89));if(_0x3f3a89['error']){if(_0x3f3a89[_0x2c7f('0x23')][_0x2c7f('0x24')]===0x1f4){logger[_0x2c7f('0x23')](_0x2c7f('0x1e'),_0x18c621,_0x3f3a89[_0x2c7f('0x23')][_0x2c7f('0x25')]);return _0x5d797a(_0x3f3a89[_0x2c7f('0x23')][_0x2c7f('0x25')]);}logger[_0x2c7f('0x23')](_0x2c7f('0x1e'),_0x18c621,_0x3f3a89[_0x2c7f('0x23')]['message']);return _0x372aef(_0x3f3a89[_0x2c7f('0x23')][_0x2c7f('0x25')]);}else{logger[_0x2c7f('0x1d')]('SugarcrmConfiguration,\x20%s,\x20%s',_0x18c621,_0x2c7f('0x1f'));_0x372aef(_0x3f3a89['result'][_0x2c7f('0x25')]);}})[_0x2c7f('0x26')](function(_0x3c0d05){logger['error'](_0x2c7f('0x1e'),_0x18c621,_0x3c0d05);_0x5d797a(_0x3c0d05);});});}function respondWithStatusCode(_0x1658cd,_0x5a5d95){_0x5a5d95=_0x5a5d95||0xcc;return function(_0x155361){if(_0x155361){return _0x1658cd[_0x2c7f('0x27')](_0x5a5d95);}return _0x1658cd[_0x2c7f('0x28')](_0x5a5d95)[_0x2c7f('0x29')]();};}function respondWithResult(_0x333d45,_0x386bf2){_0x386bf2=_0x386bf2||0xc8;return function(_0xb8dab3){if(_0xb8dab3){return _0x333d45[_0x2c7f('0x28')](_0x386bf2)[_0x2c7f('0x2a')](_0xb8dab3);}};}function respondWithFilteredResult(_0x4410ab,_0x71c3d1){return function(_0x195ab6){if(_0x195ab6){var _0x26be01=_0x195ab6[_0x2c7f('0x2b')],_0x998821=_0x71c3d1[_0x2c7f('0x2c')],_0x5ab098=_0x71c3d1[_0x2c7f('0x2c')]+_0x71c3d1['limit'],_0x20f151;if(_0x5ab098>=_0x26be01){_0x5ab098=_0x26be01;_0x20f151=0xc8;}else{_0x20f151=0xce;}_0x4410ab['status'](_0x20f151);return _0x4410ab[_0x2c7f('0x2d')](_0x2c7f('0x2e'),_0x998821+'-'+_0x5ab098+'/'+_0x26be01)[_0x2c7f('0x2a')](_0x195ab6);}return null;};}function patchUpdates(_0x5393ea){return function(_0x36c25c){try{jsonpatch[_0x2c7f('0x2f')](_0x36c25c,_0x5393ea,!![]);}catch(_0x2b9aef){return BPromise[_0x2c7f('0x30')](_0x2b9aef);}return _0x36c25c['save']();};}function saveUpdates(_0x1f83ae,_0x5e0d0e){return function(_0xab6e1f){if(_0xab6e1f){return _0xab6e1f[_0x2c7f('0x31')](_0x1f83ae)[_0x2c7f('0x1c')](function(_0x2bb6e9){return _0x2bb6e9;});}return null;};}function removeEntity(_0x382ce6,_0x16864d){return function(_0x227182){if(_0x227182){return _0x227182[_0x2c7f('0x32')]()[_0x2c7f('0x1c')](function(){_0x382ce6[_0x2c7f('0x28')](0xcc)[_0x2c7f('0x29')]();});}};}function handleEntityNotFound(_0x1446fa,_0x39b377){return function(_0x215bfb){if(!_0x215bfb){_0x1446fa[_0x2c7f('0x27')](0x194);}return _0x215bfb;};}function handleError(_0x3c1c8e,_0x312e63){_0x312e63=_0x312e63||0x1f4;return function(_0x1aa52b){logger[_0x2c7f('0x23')](_0x1aa52b[_0x2c7f('0x33')]);if(_0x1aa52b[_0x2c7f('0x34')]){delete _0x1aa52b[_0x2c7f('0x34')];}_0x3c1c8e[_0x2c7f('0x28')](_0x312e63)['send'](_0x1aa52b);};}exports['index']=function(_0x2e0394,_0x11b437){var _0x43ba16={},_0x4c6c42={},_0x301633={'count':0x0,'rows':[]};var _0x3196ea=_['map'](db['SugarcrmConfiguration']['rawAttributes'],function(_0x336afa){return{'name':_0x336afa[_0x2c7f('0x35')],'type':_0x336afa[_0x2c7f('0x36')][_0x2c7f('0x37')]};});_0x4c6c42[_0x2c7f('0x38')]=_[_0x2c7f('0x39')](_0x3196ea,_0x2c7f('0x34'));_0x4c6c42['query']=_[_0x2c7f('0x3a')](_0x2e0394[_0x2c7f('0x3b')]);_0x4c6c42['filters']=_[_0x2c7f('0x3c')](_0x4c6c42[_0x2c7f('0x38')],_0x4c6c42[_0x2c7f('0x3b')]);_0x43ba16['attributes']=_[_0x2c7f('0x3c')](_0x4c6c42[_0x2c7f('0x38')],qs[_0x2c7f('0x3d')](_0x2e0394['query'][_0x2c7f('0x3d')]));_0x43ba16[_0x2c7f('0x3e')]=_0x43ba16[_0x2c7f('0x3e')]['length']?_0x43ba16[_0x2c7f('0x3e')]:_0x4c6c42[_0x2c7f('0x38')];if(!_0x2e0394[_0x2c7f('0x3b')][_0x2c7f('0x3f')](_0x2c7f('0x40'))){_0x43ba16[_0x2c7f('0x41')]=qs[_0x2c7f('0x41')](_0x2e0394['query'][_0x2c7f('0x41')]);_0x43ba16[_0x2c7f('0x2c')]=qs[_0x2c7f('0x2c')](_0x2e0394[_0x2c7f('0x3b')][_0x2c7f('0x2c')]);}_0x43ba16['order']=qs[_0x2c7f('0x42')](_0x2e0394[_0x2c7f('0x3b')]['sort']);_0x43ba16[_0x2c7f('0x43')]=qs[_0x2c7f('0x44')](_[_0x2c7f('0x45')](_0x2e0394['query'],_0x4c6c42[_0x2c7f('0x44')]));if(_0x2e0394[_0x2c7f('0x3b')][_0x2c7f('0x46')]){_0x43ba16[_0x2c7f('0x43')]=_['merge'](_0x43ba16[_0x2c7f('0x43')],{'$or':_[_0x2c7f('0x39')](_0x3196ea,function(_0x89049d){if(_0x89049d[_0x2c7f('0x36')]!=='VIRTUAL'){var _0x943928={};_0x943928[_0x89049d[_0x2c7f('0x34')]]={'$like':'%'+_0x2e0394[_0x2c7f('0x3b')]['filter']+'%'};return _0x943928;}})});}_0x43ba16=_[_0x2c7f('0x47')]({},_0x43ba16,_0x2e0394[_0x2c7f('0x48')]);var _0x42e9b2={'where':_0x43ba16[_0x2c7f('0x43')]};return db[_0x2c7f('0x49')][_0x2c7f('0x2b')](_0x42e9b2)['then'](function(_0x2365c5){_0x301633[_0x2c7f('0x2b')]=_0x2365c5;if(_0x2e0394[_0x2c7f('0x3b')][_0x2c7f('0x4a')]){_0x43ba16[_0x2c7f('0x4b')]=[{'all':!![]}];}return db[_0x2c7f('0x49')][_0x2c7f('0x4c')](_0x43ba16);})[_0x2c7f('0x1c')](function(_0x564fee){_0x301633[_0x2c7f('0x4d')]=_0x564fee;return _0x301633;})[_0x2c7f('0x1c')](respondWithFilteredResult(_0x11b437,_0x43ba16))[_0x2c7f('0x26')](handleError(_0x11b437,null));};exports['show']=function(_0x2e3951,_0x3b00ce){var _0x37de21={'raw':![],'where':{'id':_0x2e3951[_0x2c7f('0x4e')]['id']}},_0x3ff09d={};_0x3ff09d['model']=_[_0x2c7f('0x3a')](db[_0x2c7f('0x49')][_0x2c7f('0x4f')]);_0x3ff09d[_0x2c7f('0x3b')]=_['keys'](_0x2e3951[_0x2c7f('0x3b')]);_0x3ff09d['filters']=_[_0x2c7f('0x3c')](_0x3ff09d[_0x2c7f('0x38')],_0x3ff09d[_0x2c7f('0x3b')]);_0x37de21[_0x2c7f('0x3e')]=_[_0x2c7f('0x3c')](_0x3ff09d[_0x2c7f('0x38')],qs[_0x2c7f('0x3d')](_0x2e3951['query'][_0x2c7f('0x3d')]));_0x37de21[_0x2c7f('0x3e')]=_0x37de21[_0x2c7f('0x3e')]['length']?_0x37de21[_0x2c7f('0x3e')]:_0x3ff09d[_0x2c7f('0x38')];if(_0x2e3951[_0x2c7f('0x3b')]['includeAll']){_0x37de21[_0x2c7f('0x4b')]=[{'all':!![]}];}_0x37de21=_[_0x2c7f('0x47')]({},_0x37de21,_0x2e3951[_0x2c7f('0x48')]);return db[_0x2c7f('0x49')]['find'](_0x37de21)[_0x2c7f('0x1c')](handleEntityNotFound(_0x3b00ce,null))['then'](respondWithResult(_0x3b00ce,null))[_0x2c7f('0x26')](handleError(_0x3b00ce,null));};exports[_0x2c7f('0x50')]=function(_0x27d793,_0x43b4e9){return db[_0x2c7f('0x49')]['create'](_0x27d793[_0x2c7f('0x51')],{})[_0x2c7f('0x1c')](respondWithResult(_0x43b4e9,0xc9))[_0x2c7f('0x26')](handleError(_0x43b4e9,null));};exports[_0x2c7f('0x31')]=function(_0x8f2e9,_0x3f7f47){if(_0x8f2e9[_0x2c7f('0x51')]['id']){delete _0x8f2e9[_0x2c7f('0x51')]['id'];}return db[_0x2c7f('0x49')]['find']({'where':{'id':_0x8f2e9[_0x2c7f('0x4e')]['id']}})[_0x2c7f('0x1c')](handleEntityNotFound(_0x3f7f47,null))[_0x2c7f('0x1c')](saveUpdates(_0x8f2e9[_0x2c7f('0x51')],null))['then'](respondWithResult(_0x3f7f47,null))[_0x2c7f('0x26')](handleError(_0x3f7f47,null));};exports['destroy']=function(_0x46487d,_0x345dc3){return db[_0x2c7f('0x49')][_0x2c7f('0x52')]({'where':{'id':_0x46487d[_0x2c7f('0x4e')]['id']}})[_0x2c7f('0x1c')](handleEntityNotFound(_0x345dc3,null))[_0x2c7f('0x1c')](removeEntity(_0x345dc3,null))['catch'](handleError(_0x345dc3,null));};exports[_0x2c7f('0x53')]=function(_0x1ffa2a,_0x1460ee,_0x367e9c){var _0x5f174c={};var _0x16657e={};var _0x406f53;var _0x6347ec;return db['SugarcrmConfiguration'][_0x2c7f('0x54')]({'where':{'id':_0x1ffa2a[_0x2c7f('0x4e')]['id']}})['then'](handleEntityNotFound(_0x1460ee,null))[_0x2c7f('0x1c')](function(_0x2c59f7){if(_0x2c59f7){_0x406f53=_0x2c59f7;_0x16657e[_0x2c7f('0x38')]=_['keys'](db[_0x2c7f('0x55')][_0x2c7f('0x4f')]);_0x16657e[_0x2c7f('0x3b')]=_[_0x2c7f('0x3a')](_0x1ffa2a[_0x2c7f('0x3b')]);_0x16657e['filters']=_[_0x2c7f('0x3c')](_0x16657e[_0x2c7f('0x38')],_0x16657e[_0x2c7f('0x3b')]);_0x5f174c[_0x2c7f('0x3e')]=_[_0x2c7f('0x3c')](_0x16657e[_0x2c7f('0x38')],qs[_0x2c7f('0x3d')](_0x1ffa2a[_0x2c7f('0x3b')]['fields']));_0x5f174c['attributes']=_0x5f174c[_0x2c7f('0x3e')]['length']?_0x5f174c[_0x2c7f('0x3e')]:_0x16657e[_0x2c7f('0x38')];_0x5f174c['order']=qs[_0x2c7f('0x42')](_0x1ffa2a['query'][_0x2c7f('0x42')]);_0x5f174c['where']=qs[_0x2c7f('0x44')](_['pick'](_0x1ffa2a[_0x2c7f('0x3b')],_0x16657e[_0x2c7f('0x44')]));if(_0x1ffa2a[_0x2c7f('0x3b')]['filter']){_0x5f174c[_0x2c7f('0x43')]=_[_0x2c7f('0x47')](_0x5f174c['where'],{'$or':_[_0x2c7f('0x39')](_0x5f174c[_0x2c7f('0x3e')],function(_0xb0b20){var _0x2f33a8={};_0x2f33a8[_0xb0b20]={'$like':'%'+_0x1ffa2a[_0x2c7f('0x3b')][_0x2c7f('0x46')]+'%'};return _0x2f33a8;})});}_0x5f174c=_['merge']({},_0x5f174c,_0x1ffa2a[_0x2c7f('0x48')]);return _0x406f53['getFields'](_0x5f174c);}})[_0x2c7f('0x1c')](function(_0x1a2fbf){if(_0x1a2fbf){_0x6347ec=_0x1a2fbf[_0x2c7f('0x56')];if(!_0x1ffa2a[_0x2c7f('0x3b')][_0x2c7f('0x3f')]('nolimit')){_0x5f174c[_0x2c7f('0x41')]=qs[_0x2c7f('0x41')](_0x1ffa2a['query'][_0x2c7f('0x41')]);_0x5f174c[_0x2c7f('0x2c')]=qs[_0x2c7f('0x2c')](_0x1ffa2a[_0x2c7f('0x3b')][_0x2c7f('0x2c')]);}return _0x406f53[_0x2c7f('0x53')](_0x5f174c);}})[_0x2c7f('0x1c')](function(_0x2ec858){if(_0x2ec858){return _0x2ec858?{'count':_0x6347ec,'rows':_0x2ec858}:null;}})[_0x2c7f('0x1c')](respondWithResult(_0x1460ee,null))['catch'](handleError(_0x1460ee,null));};exports['getSubjects']=function(_0x12de2f,_0x4517a8,_0x5893fe){var _0x4a00e9={};var _0x1f7600={};var _0x48aa53;var _0x35addc;return db['SugarcrmConfiguration'][_0x2c7f('0x54')]({'where':{'id':_0x12de2f[_0x2c7f('0x4e')]['id']}})[_0x2c7f('0x1c')](handleEntityNotFound(_0x4517a8,null))['then'](function(_0xf702b1){if(_0xf702b1){_0x48aa53=_0xf702b1;_0x1f7600[_0x2c7f('0x38')]=_['keys'](db[_0x2c7f('0x55')][_0x2c7f('0x4f')]);_0x1f7600[_0x2c7f('0x3b')]=_[_0x2c7f('0x3a')](_0x12de2f[_0x2c7f('0x3b')]);_0x1f7600['filters']=_[_0x2c7f('0x3c')](_0x1f7600[_0x2c7f('0x38')],_0x1f7600[_0x2c7f('0x3b')]);_0x4a00e9[_0x2c7f('0x3e')]=_['intersection'](_0x1f7600[_0x2c7f('0x38')],qs['fields'](_0x12de2f[_0x2c7f('0x3b')][_0x2c7f('0x3d')]));_0x4a00e9[_0x2c7f('0x3e')]=_0x4a00e9[_0x2c7f('0x3e')][_0x2c7f('0x56')]?_0x4a00e9[_0x2c7f('0x3e')]:_0x1f7600[_0x2c7f('0x38')];_0x4a00e9[_0x2c7f('0x57')]=qs[_0x2c7f('0x42')](_0x12de2f[_0x2c7f('0x3b')][_0x2c7f('0x42')]);_0x4a00e9[_0x2c7f('0x43')]=qs['filters'](_['pick'](_0x12de2f['query'],_0x1f7600['filters']));if(_0x12de2f[_0x2c7f('0x3b')][_0x2c7f('0x46')]){_0x4a00e9['where']=_[_0x2c7f('0x47')](_0x4a00e9[_0x2c7f('0x43')],{'$or':_[_0x2c7f('0x39')](_0x4a00e9[_0x2c7f('0x3e')],function(_0x2add6d){var _0x2c8b28={};_0x2c8b28[_0x2add6d]={'$like':'%'+_0x12de2f[_0x2c7f('0x3b')][_0x2c7f('0x46')]+'%'};return _0x2c8b28;})});}_0x4a00e9=_['merge']({},_0x4a00e9,_0x12de2f[_0x2c7f('0x48')]);return _0x48aa53[_0x2c7f('0x58')](_0x4a00e9);}})[_0x2c7f('0x1c')](function(_0x54604b){if(_0x54604b){_0x35addc=_0x54604b['length'];if(!_0x12de2f[_0x2c7f('0x3b')][_0x2c7f('0x3f')](_0x2c7f('0x40'))){_0x4a00e9[_0x2c7f('0x41')]=qs[_0x2c7f('0x41')](_0x12de2f[_0x2c7f('0x3b')][_0x2c7f('0x41')]);_0x4a00e9['offset']=qs[_0x2c7f('0x2c')](_0x12de2f['query'][_0x2c7f('0x2c')]);}return _0x48aa53[_0x2c7f('0x58')](_0x4a00e9);}})[_0x2c7f('0x1c')](function(_0x4788a1){if(_0x4788a1){return _0x4788a1?{'count':_0x35addc,'rows':_0x4788a1}:null;}})[_0x2c7f('0x1c')](respondWithResult(_0x4517a8,null))[_0x2c7f('0x26')](handleError(_0x4517a8,null));};exports[_0x2c7f('0x59')]=function(_0xee34,_0x24f2ea,_0xd3aba2){var _0x2e92d6={};var _0x4d5220={};var _0x52b1ab;var _0x141b6a;return db[_0x2c7f('0x49')]['findOne']({'where':{'id':_0xee34[_0x2c7f('0x4e')]['id']}})[_0x2c7f('0x1c')](handleEntityNotFound(_0x24f2ea,null))[_0x2c7f('0x1c')](function(_0xa74932){if(_0xa74932){_0x52b1ab=_0xa74932;_0x4d5220[_0x2c7f('0x38')]=_[_0x2c7f('0x3a')](db[_0x2c7f('0x55')][_0x2c7f('0x4f')]);_0x4d5220['query']=_['keys'](_0xee34[_0x2c7f('0x3b')]);_0x4d5220[_0x2c7f('0x44')]=_[_0x2c7f('0x3c')](_0x4d5220[_0x2c7f('0x38')],_0x4d5220['query']);_0x2e92d6[_0x2c7f('0x3e')]=_['intersection'](_0x4d5220['model'],qs[_0x2c7f('0x3d')](_0xee34['query'][_0x2c7f('0x3d')]));_0x2e92d6['attributes']=_0x2e92d6['attributes']['length']?_0x2e92d6[_0x2c7f('0x3e')]:_0x4d5220[_0x2c7f('0x38')];_0x2e92d6[_0x2c7f('0x57')]=qs[_0x2c7f('0x42')](_0xee34['query'][_0x2c7f('0x42')]);_0x2e92d6[_0x2c7f('0x43')]=qs['filters'](_['pick'](_0xee34[_0x2c7f('0x3b')],_0x4d5220[_0x2c7f('0x44')]));if(_0xee34['query'][_0x2c7f('0x46')]){_0x2e92d6['where']=_[_0x2c7f('0x47')](_0x2e92d6[_0x2c7f('0x43')],{'$or':_['map'](_0x2e92d6[_0x2c7f('0x3e')],function(_0x31ad88){var _0x5b5fa0={};_0x5b5fa0[_0x31ad88]={'$like':'%'+_0xee34[_0x2c7f('0x3b')][_0x2c7f('0x46')]+'%'};return _0x5b5fa0;})});}_0x2e92d6=_[_0x2c7f('0x47')]({},_0x2e92d6,_0xee34[_0x2c7f('0x48')]);return _0x52b1ab[_0x2c7f('0x59')](_0x2e92d6);}})[_0x2c7f('0x1c')](function(_0x1f50b3){if(_0x1f50b3){_0x141b6a=_0x1f50b3[_0x2c7f('0x56')];if(!_0xee34[_0x2c7f('0x3b')][_0x2c7f('0x3f')](_0x2c7f('0x40'))){_0x2e92d6['limit']=qs[_0x2c7f('0x41')](_0xee34[_0x2c7f('0x3b')][_0x2c7f('0x41')]);_0x2e92d6['offset']=qs[_0x2c7f('0x2c')](_0xee34['query'][_0x2c7f('0x2c')]);}return _0x52b1ab['getDescriptions'](_0x2e92d6);}})[_0x2c7f('0x1c')](function(_0x5b49ad){if(_0x5b49ad){return _0x5b49ad?{'count':_0x141b6a,'rows':_0x5b49ad}:null;}})[_0x2c7f('0x1c')](respondWithResult(_0x24f2ea,null))[_0x2c7f('0x26')](handleError(_0x24f2ea,null));}; \ No newline at end of file diff --git a/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.model.js b/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.model.js index 40b67ab..87cf5dd 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 _0x5484=['lodash','util','../../config/logger','api','request-promise','path','../../config/environment','./intSugarcrmConfiguration.attributes','define','SugarcrmConfiguration'];(function(_0x46d0c9,_0x526bfa){var _0x174506=function(_0x654bc6){while(--_0x654bc6){_0x46d0c9['push'](_0x46d0c9['shift']());}};_0x174506(++_0x526bfa);}(_0x5484,0x19a));var _0x4548=function(_0x4392a0,_0x1a873e){_0x4392a0=_0x4392a0-0x0;var _0x493616=_0x5484[_0x4392a0];return _0x493616;};'use strict';var _=require(_0x4548('0x0'));var util=require(_0x4548('0x1'));var logger=require(_0x4548('0x2'))(_0x4548('0x3'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x4548('0x4'));var fs=require('fs');var path=require(_0x4548('0x5'));var rimraf=require('rimraf');var config=require(_0x4548('0x6'));var attributes=require(_0x4548('0x7'));module['exports']=function(_0x580dd2,_0x52ddb8){return _0x580dd2[_0x4548('0x8')](_0x4548('0x9'),attributes,{'tableName':'int_sugarcrm_configurations','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x39cf=['lodash','util','api','bluebird','request-promise','path','rimraf','../../config/environment','exports','define','int_sugarcrm_configurations'];(function(_0x2c7dc6,_0x3c4ce0){var _0x10002b=function(_0x26f390){while(--_0x26f390){_0x2c7dc6['push'](_0x2c7dc6['shift']());}};_0x10002b(++_0x3c4ce0);}(_0x39cf,0x1d9));var _0xf39c=function(_0x28669c,_0x1f62c4){_0x28669c=_0x28669c-0x0;var _0x4a3af6=_0x39cf[_0x28669c];return _0x4a3af6;};'use strict';var _=require(_0xf39c('0x0'));var util=require(_0xf39c('0x1'));var logger=require('../../config/logger')(_0xf39c('0x2'));var moment=require('moment');var BPromise=require(_0xf39c('0x3'));var rp=require(_0xf39c('0x4'));var fs=require('fs');var path=require(_0xf39c('0x5'));var rimraf=require(_0xf39c('0x6'));var config=require(_0xf39c('0x7'));var attributes=require('./intSugarcrmConfiguration.attributes');module[_0xf39c('0x8')]=function(_0x2ff185,_0x152fa3){return _0x2ff185[_0xf39c('0x9')]('SugarcrmConfiguration',attributes,{'tableName':_0xf39c('0xa'),'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 1ed8096..d97d0df 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 _0x9b31=['ioredis','../../mysqldb','../../config/utils','../../config/environment','jayson/promise','client','http','then','SugarcrmConfiguration,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','lodash','util','moment','randomstring'];(function(_0x110c3d,_0x12ee06){var _0x226d67=function(_0x1fb6e1){while(--_0x1fb6e1){_0x110c3d['push'](_0x110c3d['shift']());}};_0x226d67(++_0x12ee06);}(_0x9b31,0xb0));var _0x19b3=function(_0x5b1820,_0x546dc7){_0x5b1820=_0x5b1820-0x0;var _0x4ead13=_0x9b31[_0x5b1820];return _0x4ead13;};'use strict';var _=require(_0x19b3('0x0'));var util=require(_0x19b3('0x1'));var moment=require(_0x19b3('0x2'));var BPromise=require('bluebird');var rs=require(_0x19b3('0x3'));var fs=require('fs');var Redis=require(_0x19b3('0x4'));var db=require(_0x19b3('0x5'))['db'];var utils=require(_0x19b3('0x6'));var logger=require('../../config/logger')('rpc');var config=require(_0x19b3('0x7'));var jayson=require(_0x19b3('0x8'));var client=jayson[_0x19b3('0x9')][_0x19b3('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x26f76f,_0x4c76f4,_0x5d9bbc){return new BPromise(function(_0x479c19,_0x295b00){return client['request'](_0x26f76f,_0x5d9bbc)[_0x19b3('0xb')](function(_0x518aee){logger['info'](_0x19b3('0xc'),_0x4c76f4,_0x19b3('0xd'));logger[_0x19b3('0xe')]('SugarcrmConfiguration,\x20%s,\x20%s,\x20%s',_0x4c76f4,_0x19b3('0xd'),JSON[_0x19b3('0xf')](_0x518aee));if(_0x518aee[_0x19b3('0x10')]){if(_0x518aee['error'][_0x19b3('0x11')]===0x1f4){logger[_0x19b3('0x10')]('SugarcrmConfiguration,\x20%s,\x20%s',_0x4c76f4,_0x518aee['error'][_0x19b3('0x12')]);return _0x295b00(_0x518aee[_0x19b3('0x10')][_0x19b3('0x12')]);}logger['error'](_0x19b3('0xc'),_0x4c76f4,_0x518aee[_0x19b3('0x10')][_0x19b3('0x12')]);return _0x479c19(_0x518aee[_0x19b3('0x10')][_0x19b3('0x12')]);}else{logger['info'](_0x19b3('0xc'),_0x4c76f4,'request\x20sent');_0x479c19(_0x518aee[_0x19b3('0x13')]['message']);}})['catch'](function(_0x4ededa){logger[_0x19b3('0x10')](_0x19b3('0xc'),_0x4c76f4,_0x4ededa);_0x295b00(_0x4ededa);});});} \ No newline at end of file +var _0x40d7=['lodash','util','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','http','request','then','SugarcrmConfiguration,\x20%s,\x20%s','request\x20sent','debug','SugarcrmConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch'];(function(_0x408e38,_0x23cda8){var _0x426b0e=function(_0x8f2898){while(--_0x8f2898){_0x408e38['push'](_0x408e38['shift']());}};_0x426b0e(++_0x23cda8);}(_0x40d7,0x1a4));var _0x740d=function(_0x1035c1,_0x2d8583){_0x1035c1=_0x1035c1-0x0;var _0x308d67=_0x40d7[_0x1035c1];return _0x308d67;};'use strict';var _=require(_0x740d('0x0'));var util=require(_0x740d('0x1'));var moment=require('moment');var BPromise=require(_0x740d('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x740d('0x3'));var db=require(_0x740d('0x4'))['db'];var utils=require(_0x740d('0x5'));var logger=require(_0x740d('0x6'))('rpc');var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson['client'][_0x740d('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x5c9697,_0x3085c5,_0x57bbbb){return new BPromise(function(_0x4f3a04,_0x1c88bc){return client[_0x740d('0x8')](_0x5c9697,_0x57bbbb)[_0x740d('0x9')](function(_0xef4f37){logger['info'](_0x740d('0xa'),_0x3085c5,_0x740d('0xb'));logger[_0x740d('0xc')](_0x740d('0xd'),_0x3085c5,'request\x20sent',JSON[_0x740d('0xe')](_0xef4f37));if(_0xef4f37[_0x740d('0xf')]){if(_0xef4f37[_0x740d('0xf')][_0x740d('0x10')]===0x1f4){logger[_0x740d('0xf')](_0x740d('0xa'),_0x3085c5,_0xef4f37['error']['message']);return _0x1c88bc(_0xef4f37[_0x740d('0xf')][_0x740d('0x11')]);}logger[_0x740d('0xf')]('SugarcrmConfiguration,\x20%s,\x20%s',_0x3085c5,_0xef4f37[_0x740d('0xf')][_0x740d('0x11')]);return _0x4f3a04(_0xef4f37[_0x740d('0xf')][_0x740d('0x11')]);}else{logger[_0x740d('0x12')]('SugarcrmConfiguration,\x20%s,\x20%s',_0x3085c5,'request\x20sent');_0x4f3a04(_0xef4f37[_0x740d('0x13')][_0x740d('0x11')]);}})[_0x740d('0x14')](function(_0x400d19){logger[_0x740d('0xf')](_0x740d('0xa'),_0x3085c5,_0x400d19);_0x1c88bc(_0x400d19);});});} \ No newline at end of file diff --git a/server/api/intSugarcrmField/index.js b/server/api/intSugarcrmField/index.js index 7e33f1f..49b870e 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 _0x589f=['multer','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','get','/:id','show','post','create','put','isAuthenticated','update','delete','destroy','exports'];(function(_0x5d80de,_0x2cf15d){var _0x1c7556=function(_0x5bd806){while(--_0x5bd806){_0x5d80de['push'](_0x5d80de['shift']());}};_0x1c7556(++_0x2cf15d);}(_0x589f,0x72));var _0xf589=function(_0x78c442,_0x1d9dad){_0x78c442=_0x78c442-0x0;var _0x345210=_0x589f[_0x78c442];return _0x345210;};'use strict';var multer=require(_0xf589('0x0'));var util=require('util');var path=require(_0xf589('0x1'));var timeout=require(_0xf589('0x2'));var express=require(_0xf589('0x3'));var router=express[_0xf589('0x4')]();var auth=require(_0xf589('0x5'));var interaction=require(_0xf589('0x6'));var config=require(_0xf589('0x7'));var controller=require('./intSugarcrmField.controller');router[_0xf589('0x8')]('/',auth['isAuthenticated'](),controller['index']);router[_0xf589('0x8')](_0xf589('0x9'),auth['isAuthenticated'](),controller[_0xf589('0xa')]);router[_0xf589('0xb')]('/',auth['isAuthenticated'](),controller[_0xf589('0xc')]);router[_0xf589('0xd')](_0xf589('0x9'),auth[_0xf589('0xe')](),controller[_0xf589('0xf')]);router[_0xf589('0x10')]('/:id',auth[_0xf589('0xe')](),controller[_0xf589('0x11')]);module[_0xf589('0x12')]=router; \ No newline at end of file +var _0x0bef=['delete','destroy','exports','multer','path','connect-timeout','../../components/auth/service','../../components/interaction/service','../../config/environment','./intSugarcrmField.controller','get','isAuthenticated','index','/:id','show','create','put'];(function(_0x2c0d8f,_0xb43cf9){var _0x414f77=function(_0x3e6fa5){while(--_0x3e6fa5){_0x2c0d8f['push'](_0x2c0d8f['shift']());}};_0x414f77(++_0xb43cf9);}(_0x0bef,0x1f0));var _0xf0be=function(_0x2516e1,_0xc8239c){_0x2516e1=_0x2516e1-0x0;var _0x198f83=_0x0bef[_0x2516e1];return _0x198f83;};'use strict';var multer=require(_0xf0be('0x0'));var util=require('util');var path=require(_0xf0be('0x1'));var timeout=require(_0xf0be('0x2'));var express=require('express');var router=express['Router']();var auth=require(_0xf0be('0x3'));var interaction=require(_0xf0be('0x4'));var config=require(_0xf0be('0x5'));var controller=require(_0xf0be('0x6'));router[_0xf0be('0x7')]('/',auth[_0xf0be('0x8')](),controller[_0xf0be('0x9')]);router[_0xf0be('0x7')](_0xf0be('0xa'),auth['isAuthenticated'](),controller[_0xf0be('0xb')]);router['post']('/',auth[_0xf0be('0x8')](),controller[_0xf0be('0xc')]);router[_0xf0be('0xd')](_0xf0be('0xa'),auth['isAuthenticated'](),controller['update']);router[_0xf0be('0xe')]('/:id',auth['isAuthenticated'](),controller[_0xf0be('0xf')]);module[_0xf0be('0x10')]=router; \ No newline at end of file diff --git a/server/api/intSugarcrmField/intSugarcrmField.attributes.js b/server/api/intSugarcrmField/intSugarcrmField.attributes.js index 03cd449..c023540 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 _0xbe44=['ENUM','string','customVariable','STRING','variable','BOOLEAN','sequelize'];(function(_0x16c277,_0x378d76){var _0x22b908=function(_0x5e3805){while(--_0x5e3805){_0x16c277['push'](_0x16c277['shift']());}};_0x22b908(++_0x378d76);}(_0xbe44,0x13a));var _0x4be4=function(_0x2605dc,_0x50cf7e){_0x2605dc=_0x2605dc-0x0;var _0x4568c9=_0xbe44[_0x2605dc];return _0x4568c9;};'use strict';var Sequelize=require(_0x4be4('0x0'));module['exports']={'type':{'type':Sequelize[_0x4be4('0x1')](_0x4be4('0x2'),'variable',_0x4be4('0x3'),'keyValue'),'defaultValue':_0x4be4('0x2')},'content':{'type':Sequelize[_0x4be4('0x4')]},'key':{'type':Sequelize['STRING']},'keyType':{'type':Sequelize[_0x4be4('0x1')](_0x4be4('0x2'),_0x4be4('0x5'),_0x4be4('0x3'))},'keyContent':{'type':Sequelize[_0x4be4('0x4')]},'idField':{'type':Sequelize[_0x4be4('0x4')]},'nameField':{'type':Sequelize[_0x4be4('0x4')]},'customField':{'type':Sequelize[_0x4be4('0x6')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x4be4('0x4')]}}; \ No newline at end of file +var _0xfafd=['customVariable','keyValue','STRING','BOOLEAN','exports','ENUM','string','variable'];(function(_0x1bc611,_0x57c66e){var _0x356f76=function(_0x5a9d9d){while(--_0x5a9d9d){_0x1bc611['push'](_0x1bc611['shift']());}};_0x356f76(++_0x57c66e);}(_0xfafd,0xcc));var _0xdfaf=function(_0x568826,_0x34e05c){_0x568826=_0x568826-0x0;var _0x2074d0=_0xfafd[_0x568826];return _0x2074d0;};'use strict';var Sequelize=require('sequelize');module[_0xdfaf('0x0')]={'type':{'type':Sequelize[_0xdfaf('0x1')](_0xdfaf('0x2'),_0xdfaf('0x3'),_0xdfaf('0x4'),_0xdfaf('0x5')),'defaultValue':_0xdfaf('0x2')},'content':{'type':Sequelize[_0xdfaf('0x6')]},'key':{'type':Sequelize[_0xdfaf('0x6')]},'keyType':{'type':Sequelize[_0xdfaf('0x1')](_0xdfaf('0x2'),_0xdfaf('0x3'),_0xdfaf('0x4'))},'keyContent':{'type':Sequelize[_0xdfaf('0x6')]},'idField':{'type':Sequelize[_0xdfaf('0x6')]},'nameField':{'type':Sequelize['STRING']},'customField':{'type':Sequelize[_0xdfaf('0x7')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0xdfaf('0x6')]}}; \ No newline at end of file diff --git a/server/api/intSugarcrmField/intSugarcrmField.controller.js b/server/api/intSugarcrmField/intSugarcrmField.controller.js index 7e41ffd..c7f7c0b 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 _0xc178=['options','SugarcrmField','includeAll','rows','catch','params','find','create','body','html-pdf','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','count','offset','Content-Range','apply','reject','save','update','destroy','then','error','stack','name','send','index','map','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','limit','sort','where','pick','merge','VIRTUAL'];(function(_0x1027cd,_0x55055a){var _0x13317b=function(_0x2b87c9){while(--_0x2b87c9){_0x1027cd['push'](_0x1027cd['shift']());}};_0x13317b(++_0x55055a);}(_0xc178,0xea));var _0x8c17=function(_0x563de1,_0x511a6b){_0x563de1=_0x563de1-0x0;var _0x36433a=_0xc178[_0x563de1];return _0x36433a;};'use strict';var pdf=require(_0x8c17('0x0'));var emlformat=require(_0x8c17('0x1'));var rimraf=require('rimraf');var zipdir=require(_0x8c17('0x2'));var jsonpatch=require(_0x8c17('0x3'));var rp=require(_0x8c17('0x4'));var moment=require(_0x8c17('0x5'));var BPromise=require(_0x8c17('0x6'));var Mustache=require(_0x8c17('0x7'));var util=require(_0x8c17('0x8'));var path=require(_0x8c17('0x9'));var sox=require(_0x8c17('0xa'));var csv=require(_0x8c17('0xb'));var ejs=require(_0x8c17('0xc'));var fs=require('fs');var _=require(_0x8c17('0xd'));var squel=require(_0x8c17('0xe'));var crypto=require('crypto');var jsforce=require(_0x8c17('0xf'));var deskjs=require(_0x8c17('0x10'));var toCsv=require(_0x8c17('0xb'));var querystring=require(_0x8c17('0x11'));var Papa=require(_0x8c17('0x12'));var Redis=require(_0x8c17('0x13'));var authService=require('../../components/auth/service');var qs=require(_0x8c17('0x14'));var as=require(_0x8c17('0x15'));var hardwareService=require(_0x8c17('0x16'));var logger=require(_0x8c17('0x17'))(_0x8c17('0x18'));var utils=require(_0x8c17('0x19'));var config=require(_0x8c17('0x1a'));var db=require(_0x8c17('0x1b'))['db'];function respondWithStatusCode(_0x4ba66f,_0x7c7bda){_0x7c7bda=_0x7c7bda||0xcc;return function(_0x2e3fe2){if(_0x2e3fe2){return _0x4ba66f[_0x8c17('0x1c')](_0x7c7bda);}return _0x4ba66f[_0x8c17('0x1d')](_0x7c7bda)[_0x8c17('0x1e')]();};}function respondWithResult(_0x5d5684,_0x43ee2e){_0x43ee2e=_0x43ee2e||0xc8;return function(_0x4e3208){if(_0x4e3208){return _0x5d5684[_0x8c17('0x1d')](_0x43ee2e)['json'](_0x4e3208);}};}function respondWithFilteredResult(_0xa3b52c,_0x5d976d){return function(_0x49f0bb){if(_0x49f0bb){var _0x2f37c3=_0x49f0bb[_0x8c17('0x1f')],_0x3708c3=_0x5d976d[_0x8c17('0x20')],_0x1feebd=_0x5d976d[_0x8c17('0x20')]+_0x5d976d['limit'],_0x2e7d1f;if(_0x1feebd>=_0x2f37c3){_0x1feebd=_0x2f37c3;_0x2e7d1f=0xc8;}else{_0x2e7d1f=0xce;}_0xa3b52c['status'](_0x2e7d1f);return _0xa3b52c['set'](_0x8c17('0x21'),_0x3708c3+'-'+_0x1feebd+'/'+_0x2f37c3)['json'](_0x49f0bb);}return null;};}function patchUpdates(_0x17e88d){return function(_0xdddff3){try{jsonpatch[_0x8c17('0x22')](_0xdddff3,_0x17e88d,!![]);}catch(_0x3c7aa0){return BPromise[_0x8c17('0x23')](_0x3c7aa0);}return _0xdddff3[_0x8c17('0x24')]();};}function saveUpdates(_0x147031,_0x5a28eb){return function(_0x26bd79){if(_0x26bd79){return _0x26bd79[_0x8c17('0x25')](_0x147031)['then'](function(_0x1f5706){return _0x1f5706;});}return null;};}function removeEntity(_0x469d01,_0x2d4715){return function(_0x2a14f9){if(_0x2a14f9){return _0x2a14f9[_0x8c17('0x26')]()[_0x8c17('0x27')](function(){_0x469d01[_0x8c17('0x1d')](0xcc)[_0x8c17('0x1e')]();});}};}function handleEntityNotFound(_0x395261,_0x309186){return function(_0x78cd9a){if(!_0x78cd9a){_0x395261[_0x8c17('0x1c')](0x194);}return _0x78cd9a;};}function handleError(_0x3f4fca,_0x349a09){_0x349a09=_0x349a09||0x1f4;return function(_0x2c5bb0){logger[_0x8c17('0x28')](_0x2c5bb0[_0x8c17('0x29')]);if(_0x2c5bb0['name']){delete _0x2c5bb0[_0x8c17('0x2a')];}_0x3f4fca[_0x8c17('0x1d')](_0x349a09)[_0x8c17('0x2b')](_0x2c5bb0);};}exports[_0x8c17('0x2c')]=function(_0x47e6a5,_0x37f346){var _0x2716c4={},_0x404f31={},_0x387771={'count':0x0,'rows':[]};var _0x14030a=_[_0x8c17('0x2d')](db['SugarcrmField'][_0x8c17('0x2e')],function(_0x9b9422){return{'name':_0x9b9422[_0x8c17('0x2f')],'type':_0x9b9422[_0x8c17('0x30')][_0x8c17('0x31')]};});_0x404f31[_0x8c17('0x32')]=_[_0x8c17('0x2d')](_0x14030a,'name');_0x404f31[_0x8c17('0x33')]=_[_0x8c17('0x34')](_0x47e6a5[_0x8c17('0x33')]);_0x404f31[_0x8c17('0x35')]=_[_0x8c17('0x36')](_0x404f31['model'],_0x404f31[_0x8c17('0x33')]);_0x2716c4[_0x8c17('0x37')]=_[_0x8c17('0x36')](_0x404f31[_0x8c17('0x32')],qs['fields'](_0x47e6a5[_0x8c17('0x33')][_0x8c17('0x38')]));_0x2716c4['attributes']=_0x2716c4[_0x8c17('0x37')][_0x8c17('0x39')]?_0x2716c4['attributes']:_0x404f31[_0x8c17('0x32')];if(!_0x47e6a5[_0x8c17('0x33')][_0x8c17('0x3a')](_0x8c17('0x3b'))){_0x2716c4[_0x8c17('0x3c')]=qs[_0x8c17('0x3c')](_0x47e6a5[_0x8c17('0x33')][_0x8c17('0x3c')]);_0x2716c4[_0x8c17('0x20')]=qs[_0x8c17('0x20')](_0x47e6a5[_0x8c17('0x33')][_0x8c17('0x20')]);}_0x2716c4['order']=qs[_0x8c17('0x3d')](_0x47e6a5[_0x8c17('0x33')][_0x8c17('0x3d')]);_0x2716c4[_0x8c17('0x3e')]=qs['filters'](_[_0x8c17('0x3f')](_0x47e6a5[_0x8c17('0x33')],_0x404f31[_0x8c17('0x35')]));if(_0x47e6a5[_0x8c17('0x33')]['filter']){_0x2716c4[_0x8c17('0x3e')]=_[_0x8c17('0x40')](_0x2716c4[_0x8c17('0x3e')],{'$or':_[_0x8c17('0x2d')](_0x14030a,function(_0x42f40c){if(_0x42f40c['type']!==_0x8c17('0x41')){var _0x562638={};_0x562638[_0x42f40c[_0x8c17('0x2a')]]={'$like':'%'+_0x47e6a5[_0x8c17('0x33')]['filter']+'%'};return _0x562638;}})});}_0x2716c4=_['merge']({},_0x2716c4,_0x47e6a5[_0x8c17('0x42')]);var _0x1dc31a={'where':_0x2716c4[_0x8c17('0x3e')]};return db[_0x8c17('0x43')][_0x8c17('0x1f')](_0x1dc31a)[_0x8c17('0x27')](function(_0x34ac31){_0x387771[_0x8c17('0x1f')]=_0x34ac31;if(_0x47e6a5[_0x8c17('0x33')][_0x8c17('0x44')]){_0x2716c4['include']=[{'all':!![]}];}return db[_0x8c17('0x43')]['findAll'](_0x2716c4);})['then'](function(_0x471177){_0x387771[_0x8c17('0x45')]=_0x471177;return _0x387771;})[_0x8c17('0x27')](respondWithFilteredResult(_0x37f346,_0x2716c4))[_0x8c17('0x46')](handleError(_0x37f346,null));};exports['show']=function(_0xf57f7f,_0x56cb84){var _0x1b4b74={'raw':!![],'where':{'id':_0xf57f7f[_0x8c17('0x47')]['id']}},_0x5b2d85={};_0x5b2d85[_0x8c17('0x32')]=_[_0x8c17('0x34')](db[_0x8c17('0x43')]['rawAttributes']);_0x5b2d85[_0x8c17('0x33')]=_[_0x8c17('0x34')](_0xf57f7f[_0x8c17('0x33')]);_0x5b2d85[_0x8c17('0x35')]=_['intersection'](_0x5b2d85[_0x8c17('0x32')],_0x5b2d85['query']);_0x1b4b74[_0x8c17('0x37')]=_[_0x8c17('0x36')](_0x5b2d85[_0x8c17('0x32')],qs[_0x8c17('0x38')](_0xf57f7f[_0x8c17('0x33')]['fields']));_0x1b4b74[_0x8c17('0x37')]=_0x1b4b74[_0x8c17('0x37')]['length']?_0x1b4b74[_0x8c17('0x37')]:_0x5b2d85[_0x8c17('0x32')];if(_0xf57f7f[_0x8c17('0x33')][_0x8c17('0x44')]){_0x1b4b74['include']=[{'all':!![]}];}_0x1b4b74=_[_0x8c17('0x40')]({},_0x1b4b74,_0xf57f7f[_0x8c17('0x42')]);return db[_0x8c17('0x43')][_0x8c17('0x48')](_0x1b4b74)[_0x8c17('0x27')](handleEntityNotFound(_0x56cb84,null))['then'](respondWithResult(_0x56cb84,null))[_0x8c17('0x46')](handleError(_0x56cb84,null));};exports[_0x8c17('0x49')]=function(_0x492791,_0x1657f3){return db[_0x8c17('0x43')]['create'](_0x492791[_0x8c17('0x4a')],{})['then'](respondWithResult(_0x1657f3,0xc9))[_0x8c17('0x46')](handleError(_0x1657f3,null));};exports[_0x8c17('0x25')]=function(_0x956582,_0x5d4e6a){if(_0x956582[_0x8c17('0x4a')]['id']){delete _0x956582[_0x8c17('0x4a')]['id'];}return db[_0x8c17('0x43')][_0x8c17('0x48')]({'where':{'id':_0x956582[_0x8c17('0x47')]['id']}})[_0x8c17('0x27')](handleEntityNotFound(_0x5d4e6a,null))[_0x8c17('0x27')](saveUpdates(_0x956582[_0x8c17('0x4a')],null))[_0x8c17('0x27')](respondWithResult(_0x5d4e6a,null))[_0x8c17('0x46')](handleError(_0x5d4e6a,null));};exports[_0x8c17('0x26')]=function(_0x44e592,_0x3538d9){return db[_0x8c17('0x43')]['find']({'where':{'id':_0x44e592[_0x8c17('0x47')]['id']}})[_0x8c17('0x27')](handleEntityNotFound(_0x3538d9,null))[_0x8c17('0x27')](removeEntity(_0x3538d9,null))[_0x8c17('0x46')](handleError(_0x3538d9,null));}; \ No newline at end of file +var _0x660d=['stack','name','send','index','SugarcrmField','rawAttributes','type','key','map','keys','query','filters','intersection','model','fields','attributes','length','limit','order','sort','where','pick','merge','VIRTUAL','filter','options','includeAll','include','findAll','catch','show','params','find','create','body','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','to-csv','ejs','squel','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/environment','../../mysqldb','sendStatus','status','json','count','offset','Content-Range','apply','update','then','destroy','error'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x660d,0xa9));var _0xd660=function(_0x55b467,_0x1ac105){_0x55b467=_0x55b467-0x0;var _0x39ba23=_0x660d[_0x55b467];return _0x39ba23;};'use strict';var pdf=require('html-pdf');var emlformat=require('eml-format');var rimraf=require(_0xd660('0x0'));var zipdir=require(_0xd660('0x1'));var jsonpatch=require(_0xd660('0x2'));var rp=require(_0xd660('0x3'));var moment=require(_0xd660('0x4'));var BPromise=require(_0xd660('0x5'));var Mustache=require(_0xd660('0x6'));var util=require(_0xd660('0x7'));var path=require('path');var sox=require(_0xd660('0x8'));var csv=require(_0xd660('0x9'));var ejs=require(_0xd660('0xa'));var fs=require('fs');var _=require('lodash');var squel=require(_0xd660('0xb'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0xd660('0x9'));var querystring=require('querystring');var Papa=require(_0xd660('0xc'));var Redis=require(_0xd660('0xd'));var authService=require(_0xd660('0xe'));var qs=require(_0xd660('0xf'));var as=require(_0xd660('0x10'));var hardwareService=require(_0xd660('0x11'));var logger=require(_0xd660('0x12'))('api');var utils=require('../../config/utils');var config=require(_0xd660('0x13'));var db=require(_0xd660('0x14'))['db'];function respondWithStatusCode(_0x280041,_0x5b5533){_0x5b5533=_0x5b5533||0xcc;return function(_0x17b723){if(_0x17b723){return _0x280041[_0xd660('0x15')](_0x5b5533);}return _0x280041[_0xd660('0x16')](_0x5b5533)['end']();};}function respondWithResult(_0x2bd215,_0x3b5c7b){_0x3b5c7b=_0x3b5c7b||0xc8;return function(_0x74121a){if(_0x74121a){return _0x2bd215[_0xd660('0x16')](_0x3b5c7b)[_0xd660('0x17')](_0x74121a);}};}function respondWithFilteredResult(_0x4ae7a0,_0x2f48c6){return function(_0x5da808){if(_0x5da808){var _0x1c8d00=_0x5da808[_0xd660('0x18')],_0x52580b=_0x2f48c6[_0xd660('0x19')],_0x4af5ee=_0x2f48c6[_0xd660('0x19')]+_0x2f48c6['limit'],_0x402099;if(_0x4af5ee>=_0x1c8d00){_0x4af5ee=_0x1c8d00;_0x402099=0xc8;}else{_0x402099=0xce;}_0x4ae7a0[_0xd660('0x16')](_0x402099);return _0x4ae7a0['set'](_0xd660('0x1a'),_0x52580b+'-'+_0x4af5ee+'/'+_0x1c8d00)['json'](_0x5da808);}return null;};}function patchUpdates(_0x15ab23){return function(_0x60510c){try{jsonpatch[_0xd660('0x1b')](_0x60510c,_0x15ab23,!![]);}catch(_0x3f0346){return BPromise['reject'](_0x3f0346);}return _0x60510c['save']();};}function saveUpdates(_0x2d1ac7,_0x4de885){return function(_0xbd0c2b){if(_0xbd0c2b){return _0xbd0c2b[_0xd660('0x1c')](_0x2d1ac7)[_0xd660('0x1d')](function(_0x4bfe0a){return _0x4bfe0a;});}return null;};}function removeEntity(_0x16e53b,_0x5a3b40){return function(_0x16eaf0){if(_0x16eaf0){return _0x16eaf0[_0xd660('0x1e')]()[_0xd660('0x1d')](function(){_0x16e53b[_0xd660('0x16')](0xcc)['end']();});}};}function handleEntityNotFound(_0x52a291,_0x1373cf){return function(_0x35f0fd){if(!_0x35f0fd){_0x52a291[_0xd660('0x15')](0x194);}return _0x35f0fd;};}function handleError(_0x264f39,_0x519112){_0x519112=_0x519112||0x1f4;return function(_0x1447c5){logger[_0xd660('0x1f')](_0x1447c5[_0xd660('0x20')]);if(_0x1447c5[_0xd660('0x21')]){delete _0x1447c5['name'];}_0x264f39[_0xd660('0x16')](_0x519112)[_0xd660('0x22')](_0x1447c5);};}exports[_0xd660('0x23')]=function(_0x167e38,_0x1c1e7b){var _0x8ba9ba={},_0x51d8d3={},_0x4825fc={'count':0x0,'rows':[]};var _0x438edf=_['map'](db[_0xd660('0x24')][_0xd660('0x25')],function(_0x24e28){return{'name':_0x24e28['fieldName'],'type':_0x24e28[_0xd660('0x26')][_0xd660('0x27')]};});_0x51d8d3['model']=_[_0xd660('0x28')](_0x438edf,'name');_0x51d8d3['query']=_[_0xd660('0x29')](_0x167e38[_0xd660('0x2a')]);_0x51d8d3[_0xd660('0x2b')]=_['intersection'](_0x51d8d3['model'],_0x51d8d3[_0xd660('0x2a')]);_0x8ba9ba['attributes']=_[_0xd660('0x2c')](_0x51d8d3[_0xd660('0x2d')],qs['fields'](_0x167e38[_0xd660('0x2a')][_0xd660('0x2e')]));_0x8ba9ba[_0xd660('0x2f')]=_0x8ba9ba[_0xd660('0x2f')][_0xd660('0x30')]?_0x8ba9ba[_0xd660('0x2f')]:_0x51d8d3[_0xd660('0x2d')];if(!_0x167e38[_0xd660('0x2a')]['hasOwnProperty']('nolimit')){_0x8ba9ba[_0xd660('0x31')]=qs[_0xd660('0x31')](_0x167e38['query'][_0xd660('0x31')]);_0x8ba9ba['offset']=qs[_0xd660('0x19')](_0x167e38[_0xd660('0x2a')][_0xd660('0x19')]);}_0x8ba9ba[_0xd660('0x32')]=qs['sort'](_0x167e38[_0xd660('0x2a')][_0xd660('0x33')]);_0x8ba9ba[_0xd660('0x34')]=qs['filters'](_[_0xd660('0x35')](_0x167e38[_0xd660('0x2a')],_0x51d8d3[_0xd660('0x2b')]));if(_0x167e38['query']['filter']){_0x8ba9ba[_0xd660('0x34')]=_[_0xd660('0x36')](_0x8ba9ba[_0xd660('0x34')],{'$or':_[_0xd660('0x28')](_0x438edf,function(_0x58e21c){if(_0x58e21c['type']!==_0xd660('0x37')){var _0xf11ffb={};_0xf11ffb[_0x58e21c[_0xd660('0x21')]]={'$like':'%'+_0x167e38['query'][_0xd660('0x38')]+'%'};return _0xf11ffb;}})});}_0x8ba9ba=_[_0xd660('0x36')]({},_0x8ba9ba,_0x167e38[_0xd660('0x39')]);var _0xd25588={'where':_0x8ba9ba[_0xd660('0x34')]};return db['SugarcrmField']['count'](_0xd25588)['then'](function(_0x3e75fb){_0x4825fc['count']=_0x3e75fb;if(_0x167e38[_0xd660('0x2a')][_0xd660('0x3a')]){_0x8ba9ba[_0xd660('0x3b')]=[{'all':!![]}];}return db[_0xd660('0x24')][_0xd660('0x3c')](_0x8ba9ba);})['then'](function(_0x28187){_0x4825fc['rows']=_0x28187;return _0x4825fc;})[_0xd660('0x1d')](respondWithFilteredResult(_0x1c1e7b,_0x8ba9ba))[_0xd660('0x3d')](handleError(_0x1c1e7b,null));};exports[_0xd660('0x3e')]=function(_0x375372,_0x4390e5){var _0x55931a={'raw':!![],'where':{'id':_0x375372[_0xd660('0x3f')]['id']}},_0x58b71c={};_0x58b71c[_0xd660('0x2d')]=_['keys'](db[_0xd660('0x24')][_0xd660('0x25')]);_0x58b71c[_0xd660('0x2a')]=_[_0xd660('0x29')](_0x375372[_0xd660('0x2a')]);_0x58b71c[_0xd660('0x2b')]=_[_0xd660('0x2c')](_0x58b71c[_0xd660('0x2d')],_0x58b71c[_0xd660('0x2a')]);_0x55931a[_0xd660('0x2f')]=_[_0xd660('0x2c')](_0x58b71c['model'],qs['fields'](_0x375372[_0xd660('0x2a')][_0xd660('0x2e')]));_0x55931a[_0xd660('0x2f')]=_0x55931a['attributes'][_0xd660('0x30')]?_0x55931a[_0xd660('0x2f')]:_0x58b71c[_0xd660('0x2d')];if(_0x375372['query'][_0xd660('0x3a')]){_0x55931a[_0xd660('0x3b')]=[{'all':!![]}];}_0x55931a=_[_0xd660('0x36')]({},_0x55931a,_0x375372[_0xd660('0x39')]);return db[_0xd660('0x24')][_0xd660('0x40')](_0x55931a)[_0xd660('0x1d')](handleEntityNotFound(_0x4390e5,null))[_0xd660('0x1d')](respondWithResult(_0x4390e5,null))[_0xd660('0x3d')](handleError(_0x4390e5,null));};exports[_0xd660('0x41')]=function(_0x5b99e6,_0x4f73f6){return db[_0xd660('0x24')][_0xd660('0x41')](_0x5b99e6[_0xd660('0x42')],{})[_0xd660('0x1d')](respondWithResult(_0x4f73f6,0xc9))[_0xd660('0x3d')](handleError(_0x4f73f6,null));};exports[_0xd660('0x1c')]=function(_0x3028f6,_0xd07ea6){if(_0x3028f6[_0xd660('0x42')]['id']){delete _0x3028f6[_0xd660('0x42')]['id'];}return db[_0xd660('0x24')][_0xd660('0x40')]({'where':{'id':_0x3028f6['params']['id']}})[_0xd660('0x1d')](handleEntityNotFound(_0xd07ea6,null))[_0xd660('0x1d')](saveUpdates(_0x3028f6[_0xd660('0x42')],null))['then'](respondWithResult(_0xd07ea6,null))[_0xd660('0x3d')](handleError(_0xd07ea6,null));};exports[_0xd660('0x1e')]=function(_0x441828,_0x5d8952){return db['SugarcrmField'][_0xd660('0x40')]({'where':{'id':_0x441828[_0xd660('0x3f')]['id']}})['then'](handleEntityNotFound(_0x5d8952,null))[_0xd660('0x1d')](removeEntity(_0x5d8952,null))[_0xd660('0x3d')](handleError(_0x5d8952,null));}; \ No newline at end of file diff --git a/server/api/intSugarcrmField/intSugarcrmField.model.js b/server/api/intSugarcrmField/intSugarcrmField.model.js index 6aeb8c4..309912c 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 _0x7337=['rimraf','../../config/environment','define','int_sugarcrm_fields','FieldId','lodash','api','moment','bluebird','request-promise','path'];(function(_0x113426,_0x122454){var _0x3a07c1=function(_0x8c74c8){while(--_0x8c74c8){_0x113426['push'](_0x113426['shift']());}};_0x3a07c1(++_0x122454);}(_0x7337,0xc0));var _0x7733=function(_0x5d2f7d,_0x238a9c){_0x5d2f7d=_0x5d2f7d-0x0;var _0x53fe3a=_0x7337[_0x5d2f7d];return _0x53fe3a;};'use strict';var _=require(_0x7733('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x7733('0x1'));var moment=require(_0x7733('0x2'));var BPromise=require(_0x7733('0x3'));var rp=require(_0x7733('0x4'));var fs=require('fs');var path=require(_0x7733('0x5'));var rimraf=require(_0x7733('0x6'));var config=require(_0x7733('0x7'));var attributes=require('./intSugarcrmField.attributes');module['exports']=function(_0x2fb18f,_0x5d9c4b){return _0x2fb18f[_0x7733('0x8')]('SugarcrmField',attributes,{'tableName':_0x7733('0x9'),'paranoid':![],'indexes':[{'name':'sugarcrm_unique_index','fields':['idField',_0x7733('0xa')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0x9378=['api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./intSugarcrmField.attributes','exports','SugarcrmField','int_sugarcrm_fields','sugarcrm_unique_index','idField','FieldId','util','../../config/logger'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x9378,0x13e));var _0x8937=function(_0x327d7c,_0x20948e){_0x327d7c=_0x327d7c-0x0;var _0x2a3f9c=_0x9378[_0x327d7c];return _0x2a3f9c;};'use strict';var _=require('lodash');var util=require(_0x8937('0x0'));var logger=require(_0x8937('0x1'))(_0x8937('0x2'));var moment=require(_0x8937('0x3'));var BPromise=require(_0x8937('0x4'));var rp=require(_0x8937('0x5'));var fs=require('fs');var path=require(_0x8937('0x6'));var rimraf=require(_0x8937('0x7'));var config=require(_0x8937('0x8'));var attributes=require(_0x8937('0x9'));module[_0x8937('0xa')]=function(_0x1f8b78,_0x472a75){return _0x1f8b78['define'](_0x8937('0xb'),attributes,{'tableName':_0x8937('0xc'),'paranoid':![],'indexes':[{'name':_0x8937('0xd'),'fields':[_0x8937('0xe'),_0x8937('0xf')],'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 d80e830..15cf82b 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 _0x14a0=['../../mysqldb','../../config/utils','../../config/environment','jayson/promise','client','then','debug','request\x20sent','stringify','error','code','SugarcrmField,\x20%s,\x20%s','message','info','result','catch','util','moment','bluebird','randomstring','ioredis'];(function(_0x150c65,_0x303f38){var _0x4ca489=function(_0x2c2e26){while(--_0x2c2e26){_0x150c65['push'](_0x150c65['shift']());}};_0x4ca489(++_0x303f38);}(_0x14a0,0x8e));var _0x014a=function(_0x1e80c0,_0x154d9c){_0x1e80c0=_0x1e80c0-0x0;var _0x6f68ff=_0x14a0[_0x1e80c0];return _0x6f68ff;};'use strict';var _=require('lodash');var util=require(_0x014a('0x0'));var moment=require(_0x014a('0x1'));var BPromise=require(_0x014a('0x2'));var rs=require(_0x014a('0x3'));var fs=require('fs');var Redis=require(_0x014a('0x4'));var db=require(_0x014a('0x5'))['db'];var utils=require(_0x014a('0x6'));var logger=require('../../config/logger')('rpc');var config=require(_0x014a('0x7'));var jayson=require(_0x014a('0x8'));var client=jayson[_0x014a('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x5a61ac,_0x11b8ce,_0x6d05f2){return new BPromise(function(_0x22f17c,_0x4d943b){return client['request'](_0x5a61ac,_0x6d05f2)[_0x014a('0xa')](function(_0x4f5506){logger['info']('SugarcrmField,\x20%s,\x20%s',_0x11b8ce,'request\x20sent');logger[_0x014a('0xb')]('SugarcrmField,\x20%s,\x20%s,\x20%s',_0x11b8ce,_0x014a('0xc'),JSON[_0x014a('0xd')](_0x4f5506));if(_0x4f5506['error']){if(_0x4f5506[_0x014a('0xe')][_0x014a('0xf')]===0x1f4){logger[_0x014a('0xe')](_0x014a('0x10'),_0x11b8ce,_0x4f5506[_0x014a('0xe')][_0x014a('0x11')]);return _0x4d943b(_0x4f5506[_0x014a('0xe')][_0x014a('0x11')]);}logger[_0x014a('0xe')](_0x014a('0x10'),_0x11b8ce,_0x4f5506[_0x014a('0xe')][_0x014a('0x11')]);return _0x22f17c(_0x4f5506['error'][_0x014a('0x11')]);}else{logger[_0x014a('0x12')]('SugarcrmField,\x20%s,\x20%s',_0x11b8ce,_0x014a('0xc'));_0x22f17c(_0x4f5506[_0x014a('0x13')]['message']);}})[_0x014a('0x14')](function(_0x17e4be){logger[_0x014a('0xe')](_0x014a('0x10'),_0x11b8ce,_0x17e4be);_0x4d943b(_0x17e4be);});});} \ No newline at end of file +var _0x5f66=['../../mysqldb','../../config/utils','rpc','jayson/promise','client','request','then','SugarcrmField,\x20%s,\x20%s','request\x20sent','debug','SugarcrmField,\x20%s,\x20%s,\x20%s','stringify','code','message','error','info','catch','util','bluebird','randomstring','ioredis'];(function(_0x5f152a,_0x420f2d){var _0x5943f1=function(_0x385c5a){while(--_0x385c5a){_0x5f152a['push'](_0x5f152a['shift']());}};_0x5943f1(++_0x420f2d);}(_0x5f66,0x1a0));var _0x65f6=function(_0x580576,_0x2f107d){_0x580576=_0x580576-0x0;var _0x3f55a0=_0x5f66[_0x580576];return _0x3f55a0;};'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')]('SugarcrmField,\x20%s,\x20%s',_0x1c0e12,_0x65f6('0xc'));_0x112079(_0x48d85c['result']['message']);}})[_0x65f6('0x14')](function(_0x5c69f8){logger[_0x65f6('0x12')](_0x65f6('0xb'),_0x1c0e12,_0x5c69f8);_0x8f6451(_0x5c69f8);});});} \ No newline at end of file diff --git a/server/api/intVtigerAccount/index.js b/server/api/intVtigerAccount/index.js index fbb80fd..d8cf5b7 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 _0xef93=['express','../../components/auth/service','../../components/interaction/service','./intVtigerAccount.controller','get','isAuthenticated','index','/:id','show','/:id/configurations','getConfigurations','/:id/fields','getFields','post','addConfiguration','put','update','delete','exports','multer','util','path'];(function(_0x3d3cc9,_0x57b7b2){var _0x2df889=function(_0x4f0adb){while(--_0x4f0adb){_0x3d3cc9['push'](_0x3d3cc9['shift']());}};_0x2df889(++_0x57b7b2);}(_0xef93,0x173));var _0x3ef9=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xef93[_0x20a584];return _0x4b41a8;};'use strict';var multer=require(_0x3ef9('0x0'));var util=require(_0x3ef9('0x1'));var path=require(_0x3ef9('0x2'));var timeout=require('connect-timeout');var express=require(_0x3ef9('0x3'));var router=express['Router']();var auth=require(_0x3ef9('0x4'));var interaction=require(_0x3ef9('0x5'));var config=require('../../config/environment');var controller=require(_0x3ef9('0x6'));router[_0x3ef9('0x7')]('/',auth[_0x3ef9('0x8')](),controller[_0x3ef9('0x9')]);router[_0x3ef9('0x7')](_0x3ef9('0xa'),auth[_0x3ef9('0x8')](),controller[_0x3ef9('0xb')]);router[_0x3ef9('0x7')](_0x3ef9('0xc'),auth[_0x3ef9('0x8')](),controller[_0x3ef9('0xd')]);router['get'](_0x3ef9('0xe'),auth['isAuthenticated'](),controller[_0x3ef9('0xf')]);router[_0x3ef9('0x10')]('/',auth[_0x3ef9('0x8')](),controller['create']);router['post'](_0x3ef9('0xc'),auth[_0x3ef9('0x8')](),controller[_0x3ef9('0x11')]);router[_0x3ef9('0x12')](_0x3ef9('0xa'),auth[_0x3ef9('0x8')](),controller[_0x3ef9('0x13')]);router[_0x3ef9('0x14')](_0x3ef9('0xa'),auth[_0x3ef9('0x8')](),controller['destroy']);module[_0x3ef9('0x15')]=router; \ No newline at end of file +var _0xa24c=['path','connect-timeout','Router','../../components/auth/service','../../config/environment','./intVtigerAccount.controller','get','isAuthenticated','index','/:id','/:id/configurations','/:id/fields','post','put','delete','destroy','exports','util'];(function(_0x5d6456,_0x58ecc7){var _0x4d66c1=function(_0x4335e3){while(--_0x4335e3){_0x5d6456['push'](_0x5d6456['shift']());}};_0x4d66c1(++_0x58ecc7);}(_0xa24c,0x155));var _0xca24=function(_0x27868a,_0x48e405){_0x27868a=_0x27868a-0x0;var _0x18fcfc=_0xa24c[_0x27868a];return _0x18fcfc;};'use strict';var multer=require('multer');var util=require(_0xca24('0x0'));var path=require(_0xca24('0x1'));var timeout=require(_0xca24('0x2'));var express=require('express');var router=express[_0xca24('0x3')]();var auth=require(_0xca24('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0xca24('0x5'));var controller=require(_0xca24('0x6'));router[_0xca24('0x7')]('/',auth[_0xca24('0x8')](),controller[_0xca24('0x9')]);router[_0xca24('0x7')](_0xca24('0xa'),auth[_0xca24('0x8')](),controller['show']);router[_0xca24('0x7')](_0xca24('0xb'),auth['isAuthenticated'](),controller['getConfigurations']);router[_0xca24('0x7')](_0xca24('0xc'),auth[_0xca24('0x8')](),controller['getFields']);router[_0xca24('0xd')]('/',auth['isAuthenticated'](),controller['create']);router[_0xca24('0xd')](_0xca24('0xb'),auth[_0xca24('0x8')](),controller['addConfiguration']);router[_0xca24('0xe')](_0xca24('0xa'),auth[_0xca24('0x8')](),controller['update']);router[_0xca24('0xf')](_0xca24('0xa'),auth[_0xca24('0x8')](),controller[_0xca24('0x10')]);module[_0xca24('0x11')]=router; \ No newline at end of file diff --git a/server/api/intVtigerAccount/intVtigerAccount.attributes.js b/server/api/intVtigerAccount/intVtigerAccount.attributes.js index 2e2ca83..e0170ec 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 _0x5715=['HelpDesk','sequelize','STRING'];(function(_0x2641f9,_0x26715f){var _0x585741=function(_0x2d1462){while(--_0x2d1462){_0x2641f9['push'](_0x2641f9['shift']());}};_0x585741(++_0x26715f);}(_0x5715,0x6d));var _0x5571=function(_0x1b1a3b,_0x52a88a){_0x1b1a3b=_0x1b1a3b-0x0;var _0x385347=_0x5715[_0x1b1a3b];return _0x385347;};'use strict';var Sequelize=require(_0x5571('0x0'));module['exports']={'name':{'type':Sequelize[_0x5571('0x1')],'allowNull':![]},'description':{'type':Sequelize[_0x5571('0x1')]},'username':{'type':Sequelize[_0x5571('0x1')],'allowNull':![]},'moduleName':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0x5571('0x2')},'remoteUri':{'type':Sequelize['STRING'],'allowNull':![]},'serverUrl':{'type':Sequelize[_0x5571('0x1')]},'accessKey':{'type':Sequelize[_0x5571('0x1')],'allowNull':![]}}; \ No newline at end of file +var _0x5b81=['HelpDesk','sequelize','exports','STRING'];(function(_0x416e17,_0x4d57c8){var _0x5077b0=function(_0x32974f){while(--_0x32974f){_0x416e17['push'](_0x416e17['shift']());}};_0x5077b0(++_0x4d57c8);}(_0x5b81,0x85));var _0x15b8=function(_0x27f11d,_0x498a00){_0x27f11d=_0x27f11d-0x0;var _0x4a6697=_0x5b81[_0x27f11d];return _0x4a6697;};'use strict';var Sequelize=require(_0x15b8('0x0'));module[_0x15b8('0x1')]={'name':{'type':Sequelize[_0x15b8('0x2')],'allowNull':![]},'description':{'type':Sequelize[_0x15b8('0x2')]},'username':{'type':Sequelize[_0x15b8('0x2')],'allowNull':![]},'moduleName':{'type':Sequelize[_0x15b8('0x2')],'allowNull':![],'defaultValue':_0x15b8('0x3')},'remoteUri':{'type':Sequelize[_0x15b8('0x2')],'allowNull':![]},'serverUrl':{'type':Sequelize['STRING']},'accessKey':{'type':Sequelize[_0x15b8('0x2')],'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/intVtigerAccount/intVtigerAccount.controller.js b/server/api/intVtigerAccount/intVtigerAccount.controller.js index bcf5d8b..080f7e4 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 _0x084b=['end','stack','name','send','index','VtigerAccount','rawAttributes','fieldName','key','model','map','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filter','merge','type','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','find','create','body','params','destroy','getConfigurations','findOne','VtigerConfiguration','pick','AccountId','Subjects','getSubjects','channel','Descriptions','VtigerField','md5','username','description','moduleName','remoteUri','serverUrl','accessKey','slice','substring','%s/webservice.php','GET','getchallenge','POST','login','token','success','describe','sessionName','autogenerated','reference','remove','includes','editable','false','label','startsWith','cf_','picklistValues','value','statusCode','getFields','stringify','test','Wrong\x20credentials','html-pdf','fast-json-patch','request-promise','bluebird','mustache','util','sox','ejs','lodash','squel','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','client','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','error','code','message','result','sendStatus','status','count','offset','limit','set','Content-Range','apply','save','update'];(function(_0x1c2343,_0x231a32){var _0xa19890=function(_0x2425f0){while(--_0x2425f0){_0x1c2343['push'](_0x1c2343['shift']());}};_0xa19890(++_0x231a32);}(_0x084b,0xd5));var _0xb084=function(_0x2a58e9,_0x53778f){_0x2a58e9=_0x2a58e9-0x0;var _0x55d13a=_0x084b[_0x2a58e9];return _0x55d13a;};'use strict';var pdf=require(_0xb084('0x0'));var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0xb084('0x1'));var rp=require(_0xb084('0x2'));var moment=require('moment');var BPromise=require(_0xb084('0x3'));var Mustache=require(_0xb084('0x4'));var util=require(_0xb084('0x5'));var path=require('path');var sox=require(_0xb084('0x6'));var csv=require('to-csv');var ejs=require(_0xb084('0x7'));var fs=require('fs');var _=require(_0xb084('0x8'));var squel=require(_0xb084('0x9'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0xb084('0xa'));var toCsv=require(_0xb084('0xb'));var querystring=require(_0xb084('0xc'));var Papa=require(_0xb084('0xd'));var Redis=require(_0xb084('0xe'));var authService=require(_0xb084('0xf'));var qs=require(_0xb084('0x10'));var as=require(_0xb084('0x11'));var hardwareService=require(_0xb084('0x12'));var logger=require(_0xb084('0x13'))(_0xb084('0x14'));var utils=require(_0xb084('0x15'));var config=require(_0xb084('0x16'));var db=require(_0xb084('0x17'))['db'];var integrations=require('../../components/integrations/configuration');var jayson=require('jayson/promise');var client=jayson[_0xb084('0x18')]['http']({'port':0x232a});function checkPasswordPattern(_0x5db793,_0x1228c8,_0xd24ff9){if(_0xd24ff9){var _0x5bae3a=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x5bae3a['test'](_0x1228c8)){return _0x5db793;}else{throw new db[(_0xb084('0x19'))][(_0xb084('0x1a'))](_0xb084('0x1b'));}}else{return _0x5db793;}}function respondWithRpcPromise(_0x28ad2d,_0xc6df71,_0x5a5d11,_0x240838){return new BPromise(function(_0x357391,_0x17bd4e){var _0xbcdb1f=_0x240838||client;return _0xbcdb1f[_0xb084('0x1c')](_0x28ad2d,_0x5a5d11)[_0xb084('0x1d')](function(_0x3e32f4){logger[_0xb084('0x1e')](_0xb084('0x1f'),_0xc6df71,_0xb084('0x20'));logger['debug']('VtigerAccount,\x20%s,\x20%s,\x20%s',_0xc6df71,'request\x20sent',JSON['stringify'](_0x3e32f4));if(_0x3e32f4[_0xb084('0x21')]){if(_0x3e32f4['error'][_0xb084('0x22')]===0x1f4){logger[_0xb084('0x21')](_0xb084('0x1f'),_0xc6df71,_0x3e32f4[_0xb084('0x21')][_0xb084('0x23')]);return _0x17bd4e(_0x3e32f4[_0xb084('0x21')][_0xb084('0x23')]);}logger[_0xb084('0x21')]('VtigerAccount,\x20%s,\x20%s',_0xc6df71,_0x3e32f4['error'][_0xb084('0x23')]);return _0x357391(_0x3e32f4[_0xb084('0x21')][_0xb084('0x23')]);}else{logger[_0xb084('0x1e')](_0xb084('0x1f'),_0xc6df71,'request\x20sent');_0x357391(_0x3e32f4[_0xb084('0x24')][_0xb084('0x23')]);}})['catch'](function(_0x46c8c9){logger['error'](_0xb084('0x1f'),_0xc6df71,_0x46c8c9);_0x17bd4e(_0x46c8c9);});});}function respondWithStatusCode(_0x22059f,_0x5d9314){_0x5d9314=_0x5d9314||0xcc;return function(_0x18e172){if(_0x18e172){return _0x22059f[_0xb084('0x25')](_0x5d9314);}return _0x22059f[_0xb084('0x26')](_0x5d9314)['end']();};}function respondWithResult(_0x1579ba,_0x49123d){_0x49123d=_0x49123d||0xc8;return function(_0x2f26d3){if(_0x2f26d3){return _0x1579ba[_0xb084('0x26')](_0x49123d)['json'](_0x2f26d3);}};}function respondWithFilteredResult(_0x70c7cc,_0x37b1a0){return function(_0x49cbd6){if(_0x49cbd6){var _0x4587e7=_0x49cbd6[_0xb084('0x27')],_0x1a7726=_0x37b1a0['offset'],_0x57406f=_0x37b1a0[_0xb084('0x28')]+_0x37b1a0[_0xb084('0x29')],_0x1ad27b;if(_0x57406f>=_0x4587e7){_0x57406f=_0x4587e7;_0x1ad27b=0xc8;}else{_0x1ad27b=0xce;}_0x70c7cc[_0xb084('0x26')](_0x1ad27b);return _0x70c7cc[_0xb084('0x2a')](_0xb084('0x2b'),_0x1a7726+'-'+_0x57406f+'/'+_0x4587e7)['json'](_0x49cbd6);}return null;};}function patchUpdates(_0x318b34){return function(_0x10f445){try{jsonpatch[_0xb084('0x2c')](_0x10f445,_0x318b34,!![]);}catch(_0x2173da){return BPromise['reject'](_0x2173da);}return _0x10f445[_0xb084('0x2d')]();};}function saveUpdates(_0x2ec14d,_0xe31bd7){return function(_0x11552c){if(_0x11552c){return _0x11552c[_0xb084('0x2e')](_0x2ec14d)['then'](function(_0x5f05bf){return _0x5f05bf;});}return null;};}function removeEntity(_0xd622c0,_0x4e9b68){return function(_0x45a5c0){if(_0x45a5c0){return _0x45a5c0['destroy']()[_0xb084('0x1d')](function(){_0xd622c0[_0xb084('0x26')](0xcc)[_0xb084('0x2f')]();});}};}function handleEntityNotFound(_0x2e09d4,_0x5bba55){return function(_0x3931db){if(!_0x3931db){_0x2e09d4[_0xb084('0x25')](0x194);}return _0x3931db;};}function handleError(_0x36c44,_0x2ad60c){_0x2ad60c=_0x2ad60c||0x1f4;return function(_0x3d27cf){logger['error'](_0x3d27cf[_0xb084('0x30')]);if(_0x3d27cf[_0xb084('0x31')]){delete _0x3d27cf['name'];}_0x36c44['status'](_0x2ad60c)[_0xb084('0x32')](_0x3d27cf);};}exports[_0xb084('0x33')]=function(_0xa55c17,_0xdea33c){var _0xae0c45={},_0x273f94={},_0x42c9ba={'count':0x0,'rows':[]};var _0x31b0e5=_['map'](db[_0xb084('0x34')][_0xb084('0x35')],function(_0x4d1361){return{'name':_0x4d1361[_0xb084('0x36')],'type':_0x4d1361['type'][_0xb084('0x37')]};});_0x273f94[_0xb084('0x38')]=_[_0xb084('0x39')](_0x31b0e5,_0xb084('0x31'));_0x273f94[_0xb084('0x3a')]=_[_0xb084('0x3b')](_0xa55c17[_0xb084('0x3a')]);_0x273f94[_0xb084('0x3c')]=_[_0xb084('0x3d')](_0x273f94[_0xb084('0x38')],_0x273f94[_0xb084('0x3a')]);_0xae0c45[_0xb084('0x3e')]=_[_0xb084('0x3d')](_0x273f94[_0xb084('0x38')],qs[_0xb084('0x3f')](_0xa55c17[_0xb084('0x3a')]['fields']));_0xae0c45['attributes']=_0xae0c45[_0xb084('0x3e')][_0xb084('0x40')]?_0xae0c45['attributes']:_0x273f94['model'];if(!_0xa55c17[_0xb084('0x3a')][_0xb084('0x41')](_0xb084('0x42'))){_0xae0c45['limit']=qs[_0xb084('0x29')](_0xa55c17[_0xb084('0x3a')][_0xb084('0x29')]);_0xae0c45['offset']=qs[_0xb084('0x28')](_0xa55c17[_0xb084('0x3a')][_0xb084('0x28')]);}_0xae0c45[_0xb084('0x43')]=qs['sort'](_0xa55c17[_0xb084('0x3a')][_0xb084('0x44')]);_0xae0c45[_0xb084('0x45')]=qs[_0xb084('0x3c')](_['pick'](_0xa55c17[_0xb084('0x3a')],_0x273f94[_0xb084('0x3c')]));if(_0xa55c17[_0xb084('0x3a')][_0xb084('0x46')]){_0xae0c45[_0xb084('0x45')]=_[_0xb084('0x47')](_0xae0c45[_0xb084('0x45')],{'$or':_[_0xb084('0x39')](_0x31b0e5,function(_0x2c7c4a){if(_0x2c7c4a[_0xb084('0x48')]!==_0xb084('0x49')){var _0x4419f8={};_0x4419f8[_0x2c7c4a[_0xb084('0x31')]]={'$like':'%'+_0xa55c17[_0xb084('0x3a')][_0xb084('0x46')]+'%'};return _0x4419f8;}})});}_0xae0c45=_['merge']({},_0xae0c45,_0xa55c17[_0xb084('0x4a')]);var _0xd60720={'where':_0xae0c45[_0xb084('0x45')]};return db[_0xb084('0x34')][_0xb084('0x27')](_0xd60720)[_0xb084('0x1d')](function(_0x5298fb){_0x42c9ba[_0xb084('0x27')]=_0x5298fb;if(_0xa55c17[_0xb084('0x3a')][_0xb084('0x4b')]){_0xae0c45[_0xb084('0x4c')]=[{'all':!![]}];}return db[_0xb084('0x34')][_0xb084('0x4d')](_0xae0c45);})[_0xb084('0x1d')](function(_0x48e48d){_0x42c9ba[_0xb084('0x4e')]=_0x48e48d;return _0x42c9ba;})[_0xb084('0x1d')](respondWithFilteredResult(_0xdea33c,_0xae0c45))[_0xb084('0x4f')](handleError(_0xdea33c,null));};exports[_0xb084('0x50')]=function(_0x32014e,_0xb1fdeb){var _0x8bf851={'raw':![],'where':{'id':_0x32014e['params']['id']}},_0x461b1f={};_0x461b1f[_0xb084('0x38')]=_[_0xb084('0x3b')](db['VtigerAccount'][_0xb084('0x35')]);_0x461b1f[_0xb084('0x3a')]=_[_0xb084('0x3b')](_0x32014e[_0xb084('0x3a')]);_0x461b1f[_0xb084('0x3c')]=_['intersection'](_0x461b1f[_0xb084('0x38')],_0x461b1f['query']);_0x8bf851[_0xb084('0x3e')]=_[_0xb084('0x3d')](_0x461b1f[_0xb084('0x38')],qs[_0xb084('0x3f')](_0x32014e[_0xb084('0x3a')][_0xb084('0x3f')]));_0x8bf851[_0xb084('0x3e')]=_0x8bf851['attributes']['length']?_0x8bf851['attributes']:_0x461b1f[_0xb084('0x38')];if(_0x32014e[_0xb084('0x3a')][_0xb084('0x4b')]){_0x8bf851[_0xb084('0x4c')]=[{'all':!![]}];}_0x8bf851=_[_0xb084('0x47')]({},_0x8bf851,_0x32014e[_0xb084('0x4a')]);return db[_0xb084('0x34')][_0xb084('0x51')](_0x8bf851)[_0xb084('0x1d')](handleEntityNotFound(_0xb1fdeb,null))[_0xb084('0x1d')](respondWithResult(_0xb1fdeb,null))[_0xb084('0x4f')](handleError(_0xb1fdeb,null));};exports['create']=function(_0x2250ff,_0x10ef49){return db[_0xb084('0x34')][_0xb084('0x52')](_0x2250ff[_0xb084('0x53')],{})[_0xb084('0x1d')](respondWithResult(_0x10ef49,0xc9))[_0xb084('0x4f')](handleError(_0x10ef49,null));};exports[_0xb084('0x2e')]=function(_0x5bf706,_0x2ff1b4){if(_0x5bf706['body']['id']){delete _0x5bf706['body']['id'];}return db[_0xb084('0x34')][_0xb084('0x51')]({'where':{'id':_0x5bf706[_0xb084('0x54')]['id']}})[_0xb084('0x1d')](handleEntityNotFound(_0x2ff1b4,null))['then'](saveUpdates(_0x5bf706[_0xb084('0x53')],null))['then'](respondWithResult(_0x2ff1b4,null))[_0xb084('0x4f')](handleError(_0x2ff1b4,null));};exports[_0xb084('0x55')]=function(_0x63315e,_0x570f91){return db[_0xb084('0x34')][_0xb084('0x51')]({'where':{'id':_0x63315e['params']['id']}})[_0xb084('0x1d')](handleEntityNotFound(_0x570f91,null))[_0xb084('0x1d')](removeEntity(_0x570f91,null))[_0xb084('0x4f')](handleError(_0x570f91,null));};exports[_0xb084('0x56')]=function(_0x7c2302,_0x172056,_0x5bfcc1){var _0x4266e7={};var _0x3e4750={};var _0x3e4cb0;var _0x7abce0;return db['VtigerAccount'][_0xb084('0x57')]({'where':{'id':_0x7c2302[_0xb084('0x54')]['id']}})[_0xb084('0x1d')](handleEntityNotFound(_0x172056,null))['then'](function(_0x441d48){if(_0x441d48){_0x3e4cb0=_0x441d48;_0x3e4750['model']=_[_0xb084('0x3b')](db[_0xb084('0x58')][_0xb084('0x35')]);_0x3e4750['query']=_['keys'](_0x7c2302[_0xb084('0x3a')]);_0x3e4750['filters']=_[_0xb084('0x3d')](_0x3e4750[_0xb084('0x38')],_0x3e4750[_0xb084('0x3a')]);_0x4266e7[_0xb084('0x3e')]=_['intersection'](_0x3e4750['model'],qs['fields'](_0x7c2302[_0xb084('0x3a')][_0xb084('0x3f')]));_0x4266e7[_0xb084('0x3e')]=_0x4266e7[_0xb084('0x3e')][_0xb084('0x40')]?_0x4266e7[_0xb084('0x3e')]:_0x3e4750[_0xb084('0x38')];_0x4266e7['order']=qs[_0xb084('0x44')](_0x7c2302[_0xb084('0x3a')][_0xb084('0x44')]);_0x4266e7[_0xb084('0x45')]=qs[_0xb084('0x3c')](_[_0xb084('0x59')](_0x7c2302[_0xb084('0x3a')],_0x3e4750['filters']));if(_0x7c2302[_0xb084('0x3a')][_0xb084('0x46')]){_0x4266e7[_0xb084('0x45')]=_[_0xb084('0x47')](_0x4266e7[_0xb084('0x45')],{'$or':_[_0xb084('0x39')](_0x4266e7[_0xb084('0x3e')],function(_0x28c332){var _0x52ba0f={};_0x52ba0f[_0x28c332]={'$like':'%'+_0x7c2302[_0xb084('0x3a')][_0xb084('0x46')]+'%'};return _0x52ba0f;})});}_0x4266e7=_['merge']({},_0x4266e7,_0x7c2302[_0xb084('0x4a')]);return _0x3e4cb0[_0xb084('0x56')](_0x4266e7);}})['then'](function(_0x4a5846){if(_0x4a5846){_0x7abce0=_0x4a5846[_0xb084('0x40')];if(!_0x7c2302[_0xb084('0x3a')]['hasOwnProperty']('nolimit')){_0x4266e7[_0xb084('0x29')]=qs['limit'](_0x7c2302['query'][_0xb084('0x29')]);_0x4266e7[_0xb084('0x28')]=qs[_0xb084('0x28')](_0x7c2302[_0xb084('0x3a')][_0xb084('0x28')]);}return _0x3e4cb0['getConfigurations'](_0x4266e7);}})[_0xb084('0x1d')](function(_0x3c27f1){if(_0x3c27f1){return _0x3c27f1?{'count':_0x7abce0,'rows':_0x3c27f1}:null;}})[_0xb084('0x1d')](respondWithResult(_0x172056,null))[_0xb084('0x4f')](handleError(_0x172056,null));};exports['addConfiguration']=function(_0x3cfa58,_0x40a7c7,_0x32ea2c){if(_0x3cfa58[_0xb084('0x53')]['id']){delete _0x3cfa58[_0xb084('0x53')]['id'];}return db['VtigerAccount']['findOne']({'where':{'id':_0x3cfa58[_0xb084('0x54')]['id']}})[_0xb084('0x1d')](handleEntityNotFound(_0x40a7c7,null))[_0xb084('0x1d')](function(_0x20963d){if(_0x20963d){_0x3cfa58['body'][_0xb084('0x5a')]=_0x20963d['id'];_0x3cfa58[_0xb084('0x53')][_0xb084('0x5b')]=integrations[_0xb084('0x5c')](_0x3cfa58['body'][_0xb084('0x5d')],_0x3cfa58[_0xb084('0x53')][_0xb084('0x48')]);_0x3cfa58[_0xb084('0x53')][_0xb084('0x5e')]=integrations['getDescriptions'](_0x3cfa58[_0xb084('0x53')][_0xb084('0x5d')],_0x3cfa58['body'][_0xb084('0x48')]);return db[_0xb084('0x58')][_0xb084('0x52')](_0x3cfa58[_0xb084('0x53')],{'include':[{'model':db[_0xb084('0x5f')],'as':_0xb084('0x5b')},{'model':db['VtigerField'],'as':_0xb084('0x5e')}]});}return null;})[_0xb084('0x1d')](respondWithResult(_0x40a7c7,null))[_0xb084('0x4f')](handleError(_0x40a7c7,null));};var md5=require(_0xb084('0x60'));exports['getFields']=function(_0x243d45,_0x439299,_0x5d84c5){var _0x230ee3=null;var _0x9cd5e9=null;var _0xbad10e=null;var _0x434d64=null;var _0x3d024e='';return db[_0xb084('0x34')][_0xb084('0x57')]({'where':{'id':_0x243d45[_0xb084('0x54')]['id']},'attributes':['id',_0xb084('0x31'),_0xb084('0x61'),_0xb084('0x62'),_0xb084('0x63'),_0xb084('0x64'),_0xb084('0x65'),_0xb084('0x66')]})[_0xb084('0x1d')](handleEntityNotFound(_0x439299,null))['then'](function(_0x39bd5c){if(_0x39bd5c){_0x230ee3=_0x39bd5c[_0xb084('0x61')];_0x9cd5e9=_0x39bd5c['accessKey'];_0xbad10e=_0x39bd5c[_0xb084('0x63')];_0x3d024e=_0x39bd5c[_0xb084('0x64')];var _0x9e14ef=_0x3d024e[_0xb084('0x67')](-0x1);if(_0x9e14ef==='/'){_0x3d024e=_0x3d024e[_0xb084('0x68')](0x0,_0x3d024e['lastIndexOf'](_0x9e14ef));}_0x434d64=util['format'](_0xb084('0x69'),_0x3d024e);var _0x27d371={'method':_0xb084('0x6a'),'uri':_0x434d64,'qs':{'operation':_0xb084('0x6b'),'username':_0x39bd5c[_0xb084('0x61')]},'json':!![]};return rp(_0x27d371);}})['then'](function(_0x1029a4){if(_0x1029a4['success']){var _0x31f707={'method':_0xb084('0x6c'),'uri':_0x434d64,'form':{'operation':_0xb084('0x6d'),'username':_0x230ee3,'accessKey':md5(_0x1029a4['result'][_0xb084('0x6e')]+_0x9cd5e9)},'json':!![]};return rp(_0x31f707);}})['then'](function(_0x344f84){if(_0x344f84[_0xb084('0x6f')]){var _0x28114d={'method':_0xb084('0x6a'),'uri':_0x434d64,'qs':{'operation':_0xb084('0x70'),'username':_0x230ee3,'sessionName':_0x344f84[_0xb084('0x24')][_0xb084('0x71')],'elementType':_0xbad10e},'json':!![]};return rp(_0x28114d);}})['then'](function(_0x23f770){if(_0x23f770['success']){var _0x5cd4e5=[_0xb084('0x72'),_0xb084('0x73'),'owner'];_[_0xb084('0x74')](_0x23f770[_0xb084('0x24')][_0xb084('0x3f')],function(_0x2b7b8b){return _0x5cd4e5[_0xb084('0x75')](_0x2b7b8b[_0xb084('0x48')][_0xb084('0x31')]);});_[_0xb084('0x74')](_0x23f770[_0xb084('0x24')][_0xb084('0x3f')],function(_0x11ca51){return _0x11ca51[_0xb084('0x76')]===_0xb084('0x77');});return{'count':_0x23f770['result'][_0xb084('0x3f')]['length'],'rows':_[_0xb084('0x39')](_0x23f770[_0xb084('0x24')][_0xb084('0x3f')],function(_0x26fb54){return{'id':_0x26fb54[_0xb084('0x31')],'name':_0x26fb54[_0xb084('0x78')],'custom':_[_0xb084('0x79')](_0x26fb54[_0xb084('0x31')],_0xb084('0x7a'))?!![]:![],'options':_0x26fb54[_0xb084('0x48')]['name']==='picklist'&&_0x26fb54[_0xb084('0x48')][_0xb084('0x7b')][_0xb084('0x40')]>0x0?_[_0xb084('0x39')](_0x26fb54[_0xb084('0x48')][_0xb084('0x7b')],function(_0x5489cd){return{'name':_0x5489cd[_0xb084('0x78')],'value':_0x5489cd[_0xb084('0x7c')]};}):[]};})};}})['then'](respondWithResult(_0x439299,null))['catch'](function(_0x210135){console['log']('vTiger\x20error:\x20'+_0x210135);var _0x211ef9=_0x243d45['query']['test']?0x1f4:_0x210135[_0xb084('0x7d')]||0x1f4;logger['error']('getFields,\x20%s,\x20%s,\x20%s',_0xb084('0x7e'),_0x211ef9,JSON[_0xb084('0x7f')](_0x210135));delete _0x210135[_0xb084('0x31')];if(_0x211ef9===0x191){_0x211ef9=0x190;}_0x439299[_0xb084('0x26')](_0x211ef9)[_0xb084('0x32')](_0x243d45[_0xb084('0x3a')][_0xb084('0x80')]?{'message':_0xb084('0x81'),'statusCode':_0x210135[_0xb084('0x7d')]}:_0x210135);});}; \ No newline at end of file +var _0xe321=['log','vTiger\x20error:\x20','statusCode','getFields,\x20%s,\x20%s,\x20%s','stringify','eml-format','rimraf','zip-dir','moment','util','path','sox','to-csv','ejs','lodash','squel','crypto','desk.js','querystring','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../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','info','VtigerAccount,\x20%s,\x20%s','request\x20sent','debug','VtigerAccount,\x20%s,\x20%s,\x20%s','error','code','message','sendStatus','status','end','json','count','offset','limit','Content-Range','apply','reject','save','update','destroy','stack','name','send','index','map','fieldName','type','query','model','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','merge','VIRTUAL','filter','options','VtigerAccount','includeAll','findAll','then','catch','show','params','keys','include','find','create','body','getConfigurations','findOne','VtigerConfiguration','rawAttributes','pick','addConfiguration','AccountId','Subjects','getSubjects','channel','Descriptions','getDescriptions','VtigerField','getFields','username','remoteUri','serverUrl','accessKey','slice','substring','lastIndexOf','format','%s/webservice.php','GET','success','POST','login','result','token','describe','sessionName','autogenerated','reference','owner','remove','editable','false','label','startsWith','cf_','picklist','picklistValues','value'];(function(_0x5ea53f,_0x5adf11){var _0x50ef06=function(_0x16152e){while(--_0x16152e){_0x5ea53f['push'](_0x5ea53f['shift']());}};_0x50ef06(++_0x5adf11);}(_0xe321,0x194));var _0x1e32=function(_0x4c722c,_0x53db4b){_0x4c722c=_0x4c722c-0x0;var _0x59d533=_0xe321[_0x4c722c];return _0x59d533;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x1e32('0x0'));var rimraf=require(_0x1e32('0x1'));var zipdir=require(_0x1e32('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x1e32('0x3'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x1e32('0x4'));var path=require(_0x1e32('0x5'));var sox=require(_0x1e32('0x6'));var csv=require(_0x1e32('0x7'));var ejs=require(_0x1e32('0x8'));var fs=require('fs');var _=require(_0x1e32('0x9'));var squel=require(_0x1e32('0xa'));var crypto=require(_0x1e32('0xb'));var jsforce=require('jsforce');var deskjs=require(_0x1e32('0xc'));var toCsv=require('to-csv');var querystring=require(_0x1e32('0xd'));var Papa=require(_0x1e32('0xe'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x1e32('0xf'));var as=require(_0x1e32('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x1e32('0x11'))(_0x1e32('0x12'));var utils=require(_0x1e32('0x13'));var config=require(_0x1e32('0x14'));var db=require(_0x1e32('0x15'))['db'];var integrations=require('../../components/integrations/configuration');var jayson=require(_0x1e32('0x16'));var client=jayson['client'][_0x1e32('0x17')]({'port':0x232a});function checkPasswordPattern(_0x5e3b1b,_0x504b5c,_0x42929b){if(_0x42929b){var _0x12bd78=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x12bd78[_0x1e32('0x18')](_0x504b5c)){return _0x5e3b1b;}else{throw new db[(_0x1e32('0x19'))][(_0x1e32('0x1a'))](_0x1e32('0x1b'));}}else{return _0x5e3b1b;}}function respondWithRpcPromise(_0x4ce03c,_0x167879,_0x1771f1,_0x1815d8){return new BPromise(function(_0x481056,_0x6b6dac){var _0x16f489=_0x1815d8||client;return _0x16f489[_0x1e32('0x1c')](_0x4ce03c,_0x1771f1)['then'](function(_0x443101){logger[_0x1e32('0x1d')](_0x1e32('0x1e'),_0x167879,_0x1e32('0x1f'));logger[_0x1e32('0x20')](_0x1e32('0x21'),_0x167879,_0x1e32('0x1f'),JSON['stringify'](_0x443101));if(_0x443101[_0x1e32('0x22')]){if(_0x443101[_0x1e32('0x22')][_0x1e32('0x23')]===0x1f4){logger['error'](_0x1e32('0x1e'),_0x167879,_0x443101['error'][_0x1e32('0x24')]);return _0x6b6dac(_0x443101[_0x1e32('0x22')][_0x1e32('0x24')]);}logger[_0x1e32('0x22')](_0x1e32('0x1e'),_0x167879,_0x443101[_0x1e32('0x22')][_0x1e32('0x24')]);return _0x481056(_0x443101[_0x1e32('0x22')]['message']);}else{logger[_0x1e32('0x1d')]('VtigerAccount,\x20%s,\x20%s',_0x167879,_0x1e32('0x1f'));_0x481056(_0x443101['result'][_0x1e32('0x24')]);}})['catch'](function(_0x2f6ffe){logger['error'](_0x1e32('0x1e'),_0x167879,_0x2f6ffe);_0x6b6dac(_0x2f6ffe);});});}function respondWithStatusCode(_0x51e22e,_0x4e3369){_0x4e3369=_0x4e3369||0xcc;return function(_0x4f00e8){if(_0x4f00e8){return _0x51e22e[_0x1e32('0x25')](_0x4e3369);}return _0x51e22e[_0x1e32('0x26')](_0x4e3369)[_0x1e32('0x27')]();};}function respondWithResult(_0x5b50d3,_0x2445af){_0x2445af=_0x2445af||0xc8;return function(_0x254772){if(_0x254772){return _0x5b50d3['status'](_0x2445af)[_0x1e32('0x28')](_0x254772);}};}function respondWithFilteredResult(_0x4de653,_0x204cea){return function(_0x2b4b7f){if(_0x2b4b7f){var _0x49b0a2=_0x2b4b7f[_0x1e32('0x29')],_0x3ccdee=_0x204cea['offset'],_0x3a3949=_0x204cea[_0x1e32('0x2a')]+_0x204cea[_0x1e32('0x2b')],_0x5cbf21;if(_0x3a3949>=_0x49b0a2){_0x3a3949=_0x49b0a2;_0x5cbf21=0xc8;}else{_0x5cbf21=0xce;}_0x4de653[_0x1e32('0x26')](_0x5cbf21);return _0x4de653['set'](_0x1e32('0x2c'),_0x3ccdee+'-'+_0x3a3949+'/'+_0x49b0a2)[_0x1e32('0x28')](_0x2b4b7f);}return null;};}function patchUpdates(_0x406a1e){return function(_0x38d6a4){try{jsonpatch[_0x1e32('0x2d')](_0x38d6a4,_0x406a1e,!![]);}catch(_0x68e9b6){return BPromise[_0x1e32('0x2e')](_0x68e9b6);}return _0x38d6a4[_0x1e32('0x2f')]();};}function saveUpdates(_0x3395c9,_0x28ce11){return function(_0x444a56){if(_0x444a56){return _0x444a56[_0x1e32('0x30')](_0x3395c9)['then'](function(_0x5b5989){return _0x5b5989;});}return null;};}function removeEntity(_0x2484b1,_0x49c6d4){return function(_0x8d04a2){if(_0x8d04a2){return _0x8d04a2[_0x1e32('0x31')]()['then'](function(){_0x2484b1[_0x1e32('0x26')](0xcc)[_0x1e32('0x27')]();});}};}function handleEntityNotFound(_0x385892,_0x57b6f5){return function(_0x246559){if(!_0x246559){_0x385892[_0x1e32('0x25')](0x194);}return _0x246559;};}function handleError(_0x5f05c5,_0x49c70b){_0x49c70b=_0x49c70b||0x1f4;return function(_0x481271){logger[_0x1e32('0x22')](_0x481271[_0x1e32('0x32')]);if(_0x481271[_0x1e32('0x33')]){delete _0x481271['name'];}_0x5f05c5[_0x1e32('0x26')](_0x49c70b)[_0x1e32('0x34')](_0x481271);};}exports[_0x1e32('0x35')]=function(_0x50505d,_0x233923){var _0x34d9b6={},_0x4f0c8a={},_0x2a4251={'count':0x0,'rows':[]};var _0x203155=_[_0x1e32('0x36')](db['VtigerAccount']['rawAttributes'],function(_0x59e1ef){return{'name':_0x59e1ef[_0x1e32('0x37')],'type':_0x59e1ef[_0x1e32('0x38')]['key']};});_0x4f0c8a['model']=_['map'](_0x203155,'name');_0x4f0c8a[_0x1e32('0x39')]=_['keys'](_0x50505d[_0x1e32('0x39')]);_0x4f0c8a['filters']=_['intersection'](_0x4f0c8a[_0x1e32('0x3a')],_0x4f0c8a[_0x1e32('0x39')]);_0x34d9b6[_0x1e32('0x3b')]=_[_0x1e32('0x3c')](_0x4f0c8a['model'],qs[_0x1e32('0x3d')](_0x50505d[_0x1e32('0x39')][_0x1e32('0x3d')]));_0x34d9b6[_0x1e32('0x3b')]=_0x34d9b6['attributes'][_0x1e32('0x3e')]?_0x34d9b6[_0x1e32('0x3b')]:_0x4f0c8a[_0x1e32('0x3a')];if(!_0x50505d['query'][_0x1e32('0x3f')](_0x1e32('0x40'))){_0x34d9b6['limit']=qs['limit'](_0x50505d[_0x1e32('0x39')][_0x1e32('0x2b')]);_0x34d9b6[_0x1e32('0x2a')]=qs[_0x1e32('0x2a')](_0x50505d[_0x1e32('0x39')]['offset']);}_0x34d9b6[_0x1e32('0x41')]=qs[_0x1e32('0x42')](_0x50505d[_0x1e32('0x39')][_0x1e32('0x42')]);_0x34d9b6[_0x1e32('0x43')]=qs[_0x1e32('0x44')](_['pick'](_0x50505d[_0x1e32('0x39')],_0x4f0c8a['filters']));if(_0x50505d[_0x1e32('0x39')]['filter']){_0x34d9b6[_0x1e32('0x43')]=_[_0x1e32('0x45')](_0x34d9b6[_0x1e32('0x43')],{'$or':_[_0x1e32('0x36')](_0x203155,function(_0x3151f0){if(_0x3151f0[_0x1e32('0x38')]!==_0x1e32('0x46')){var _0x56a6df={};_0x56a6df[_0x3151f0[_0x1e32('0x33')]]={'$like':'%'+_0x50505d[_0x1e32('0x39')][_0x1e32('0x47')]+'%'};return _0x56a6df;}})});}_0x34d9b6=_[_0x1e32('0x45')]({},_0x34d9b6,_0x50505d[_0x1e32('0x48')]);var _0x41e913={'where':_0x34d9b6[_0x1e32('0x43')]};return db[_0x1e32('0x49')][_0x1e32('0x29')](_0x41e913)['then'](function(_0x1bcfdd){_0x2a4251[_0x1e32('0x29')]=_0x1bcfdd;if(_0x50505d[_0x1e32('0x39')][_0x1e32('0x4a')]){_0x34d9b6['include']=[{'all':!![]}];}return db[_0x1e32('0x49')][_0x1e32('0x4b')](_0x34d9b6);})[_0x1e32('0x4c')](function(_0x47b022){_0x2a4251['rows']=_0x47b022;return _0x2a4251;})[_0x1e32('0x4c')](respondWithFilteredResult(_0x233923,_0x34d9b6))[_0x1e32('0x4d')](handleError(_0x233923,null));};exports[_0x1e32('0x4e')]=function(_0x2cca4b,_0x493654){var _0x478db8={'raw':![],'where':{'id':_0x2cca4b[_0x1e32('0x4f')]['id']}},_0x2efab9={};_0x2efab9[_0x1e32('0x3a')]=_[_0x1e32('0x50')](db['VtigerAccount']['rawAttributes']);_0x2efab9[_0x1e32('0x39')]=_[_0x1e32('0x50')](_0x2cca4b[_0x1e32('0x39')]);_0x2efab9[_0x1e32('0x44')]=_[_0x1e32('0x3c')](_0x2efab9[_0x1e32('0x3a')],_0x2efab9[_0x1e32('0x39')]);_0x478db8[_0x1e32('0x3b')]=_[_0x1e32('0x3c')](_0x2efab9[_0x1e32('0x3a')],qs[_0x1e32('0x3d')](_0x2cca4b[_0x1e32('0x39')]['fields']));_0x478db8[_0x1e32('0x3b')]=_0x478db8[_0x1e32('0x3b')][_0x1e32('0x3e')]?_0x478db8['attributes']:_0x2efab9[_0x1e32('0x3a')];if(_0x2cca4b['query'][_0x1e32('0x4a')]){_0x478db8[_0x1e32('0x51')]=[{'all':!![]}];}_0x478db8=_[_0x1e32('0x45')]({},_0x478db8,_0x2cca4b[_0x1e32('0x48')]);return db[_0x1e32('0x49')][_0x1e32('0x52')](_0x478db8)['then'](handleEntityNotFound(_0x493654,null))[_0x1e32('0x4c')](respondWithResult(_0x493654,null))[_0x1e32('0x4d')](handleError(_0x493654,null));};exports[_0x1e32('0x53')]=function(_0x18b6a1,_0x5487c6){return db['VtigerAccount'][_0x1e32('0x53')](_0x18b6a1[_0x1e32('0x54')],{})[_0x1e32('0x4c')](respondWithResult(_0x5487c6,0xc9))['catch'](handleError(_0x5487c6,null));};exports[_0x1e32('0x30')]=function(_0x4e2955,_0x4d2d3b){if(_0x4e2955['body']['id']){delete _0x4e2955[_0x1e32('0x54')]['id'];}return db[_0x1e32('0x49')][_0x1e32('0x52')]({'where':{'id':_0x4e2955['params']['id']}})[_0x1e32('0x4c')](handleEntityNotFound(_0x4d2d3b,null))[_0x1e32('0x4c')](saveUpdates(_0x4e2955['body'],null))[_0x1e32('0x4c')](respondWithResult(_0x4d2d3b,null))[_0x1e32('0x4d')](handleError(_0x4d2d3b,null));};exports[_0x1e32('0x31')]=function(_0x4e4964,_0x153880){return db[_0x1e32('0x49')][_0x1e32('0x52')]({'where':{'id':_0x4e4964['params']['id']}})['then'](handleEntityNotFound(_0x153880,null))['then'](removeEntity(_0x153880,null))['catch'](handleError(_0x153880,null));};exports[_0x1e32('0x55')]=function(_0x16eff8,_0x2eda79,_0x4cdd5a){var _0x561ce5={};var _0x44fcd6={};var _0x165ff1;var _0x4223b7;return db[_0x1e32('0x49')][_0x1e32('0x56')]({'where':{'id':_0x16eff8[_0x1e32('0x4f')]['id']}})['then'](handleEntityNotFound(_0x2eda79,null))['then'](function(_0x28f9ad){if(_0x28f9ad){_0x165ff1=_0x28f9ad;_0x44fcd6[_0x1e32('0x3a')]=_[_0x1e32('0x50')](db[_0x1e32('0x57')][_0x1e32('0x58')]);_0x44fcd6[_0x1e32('0x39')]=_['keys'](_0x16eff8[_0x1e32('0x39')]);_0x44fcd6[_0x1e32('0x44')]=_[_0x1e32('0x3c')](_0x44fcd6[_0x1e32('0x3a')],_0x44fcd6[_0x1e32('0x39')]);_0x561ce5[_0x1e32('0x3b')]=_[_0x1e32('0x3c')](_0x44fcd6[_0x1e32('0x3a')],qs[_0x1e32('0x3d')](_0x16eff8[_0x1e32('0x39')][_0x1e32('0x3d')]));_0x561ce5['attributes']=_0x561ce5[_0x1e32('0x3b')][_0x1e32('0x3e')]?_0x561ce5[_0x1e32('0x3b')]:_0x44fcd6[_0x1e32('0x3a')];_0x561ce5[_0x1e32('0x41')]=qs[_0x1e32('0x42')](_0x16eff8['query']['sort']);_0x561ce5[_0x1e32('0x43')]=qs[_0x1e32('0x44')](_[_0x1e32('0x59')](_0x16eff8[_0x1e32('0x39')],_0x44fcd6['filters']));if(_0x16eff8[_0x1e32('0x39')][_0x1e32('0x47')]){_0x561ce5['where']=_[_0x1e32('0x45')](_0x561ce5[_0x1e32('0x43')],{'$or':_[_0x1e32('0x36')](_0x561ce5['attributes'],function(_0x4d277f){var _0x33720f={};_0x33720f[_0x4d277f]={'$like':'%'+_0x16eff8[_0x1e32('0x39')][_0x1e32('0x47')]+'%'};return _0x33720f;})});}_0x561ce5=_[_0x1e32('0x45')]({},_0x561ce5,_0x16eff8['options']);return _0x165ff1[_0x1e32('0x55')](_0x561ce5);}})[_0x1e32('0x4c')](function(_0x55c8bc){if(_0x55c8bc){_0x4223b7=_0x55c8bc[_0x1e32('0x3e')];if(!_0x16eff8['query'][_0x1e32('0x3f')]('nolimit')){_0x561ce5['limit']=qs[_0x1e32('0x2b')](_0x16eff8[_0x1e32('0x39')][_0x1e32('0x2b')]);_0x561ce5[_0x1e32('0x2a')]=qs['offset'](_0x16eff8[_0x1e32('0x39')][_0x1e32('0x2a')]);}return _0x165ff1['getConfigurations'](_0x561ce5);}})[_0x1e32('0x4c')](function(_0x200ee8){if(_0x200ee8){return _0x200ee8?{'count':_0x4223b7,'rows':_0x200ee8}:null;}})[_0x1e32('0x4c')](respondWithResult(_0x2eda79,null))[_0x1e32('0x4d')](handleError(_0x2eda79,null));};exports[_0x1e32('0x5a')]=function(_0x5653f2,_0x16478a,_0x3bc7d4){if(_0x5653f2[_0x1e32('0x54')]['id']){delete _0x5653f2[_0x1e32('0x54')]['id'];}return db[_0x1e32('0x49')]['findOne']({'where':{'id':_0x5653f2[_0x1e32('0x4f')]['id']}})[_0x1e32('0x4c')](handleEntityNotFound(_0x16478a,null))[_0x1e32('0x4c')](function(_0x28733f){if(_0x28733f){_0x5653f2[_0x1e32('0x54')][_0x1e32('0x5b')]=_0x28733f['id'];_0x5653f2[_0x1e32('0x54')][_0x1e32('0x5c')]=integrations[_0x1e32('0x5d')](_0x5653f2[_0x1e32('0x54')][_0x1e32('0x5e')],_0x5653f2[_0x1e32('0x54')]['type']);_0x5653f2[_0x1e32('0x54')][_0x1e32('0x5f')]=integrations[_0x1e32('0x60')](_0x5653f2[_0x1e32('0x54')][_0x1e32('0x5e')],_0x5653f2[_0x1e32('0x54')][_0x1e32('0x38')]);return db['VtigerConfiguration'][_0x1e32('0x53')](_0x5653f2[_0x1e32('0x54')],{'include':[{'model':db[_0x1e32('0x61')],'as':_0x1e32('0x5c')},{'model':db[_0x1e32('0x61')],'as':_0x1e32('0x5f')}]});}return null;})['then'](respondWithResult(_0x16478a,null))[_0x1e32('0x4d')](handleError(_0x16478a,null));};var md5=require('md5');exports[_0x1e32('0x62')]=function(_0x208446,_0x4895ed,_0x44c5b3){var _0x3d6550=null;var _0x35d87c=null;var _0x39d0ac=null;var _0x9e649f=null;var _0x3ae6b3='';return db[_0x1e32('0x49')][_0x1e32('0x56')]({'where':{'id':_0x208446[_0x1e32('0x4f')]['id']},'attributes':['id',_0x1e32('0x33'),_0x1e32('0x63'),'description','moduleName',_0x1e32('0x64'),_0x1e32('0x65'),_0x1e32('0x66')]})[_0x1e32('0x4c')](handleEntityNotFound(_0x4895ed,null))[_0x1e32('0x4c')](function(_0xe75b7a){if(_0xe75b7a){_0x3d6550=_0xe75b7a['username'];_0x35d87c=_0xe75b7a[_0x1e32('0x66')];_0x39d0ac=_0xe75b7a['moduleName'];_0x3ae6b3=_0xe75b7a[_0x1e32('0x64')];var _0x1440bc=_0x3ae6b3[_0x1e32('0x67')](-0x1);if(_0x1440bc==='/'){_0x3ae6b3=_0x3ae6b3[_0x1e32('0x68')](0x0,_0x3ae6b3[_0x1e32('0x69')](_0x1440bc));}_0x9e649f=util[_0x1e32('0x6a')](_0x1e32('0x6b'),_0x3ae6b3);var _0x3cb51f={'method':_0x1e32('0x6c'),'uri':_0x9e649f,'qs':{'operation':'getchallenge','username':_0xe75b7a['username']},'json':!![]};return rp(_0x3cb51f);}})['then'](function(_0xb4feb){if(_0xb4feb[_0x1e32('0x6d')]){var _0x219a52={'method':_0x1e32('0x6e'),'uri':_0x9e649f,'form':{'operation':_0x1e32('0x6f'),'username':_0x3d6550,'accessKey':md5(_0xb4feb[_0x1e32('0x70')][_0x1e32('0x71')]+_0x35d87c)},'json':!![]};return rp(_0x219a52);}})[_0x1e32('0x4c')](function(_0x357897){if(_0x357897[_0x1e32('0x6d')]){var _0x5ebec8={'method':_0x1e32('0x6c'),'uri':_0x9e649f,'qs':{'operation':_0x1e32('0x72'),'username':_0x3d6550,'sessionName':_0x357897[_0x1e32('0x70')][_0x1e32('0x73')],'elementType':_0x39d0ac},'json':!![]};return rp(_0x5ebec8);}})[_0x1e32('0x4c')](function(_0x289858){if(_0x289858[_0x1e32('0x6d')]){var _0x12a77a=[_0x1e32('0x74'),_0x1e32('0x75'),_0x1e32('0x76')];_['remove'](_0x289858[_0x1e32('0x70')][_0x1e32('0x3d')],function(_0xe14504){return _0x12a77a['includes'](_0xe14504[_0x1e32('0x38')][_0x1e32('0x33')]);});_[_0x1e32('0x77')](_0x289858[_0x1e32('0x70')][_0x1e32('0x3d')],function(_0x194969){return _0x194969[_0x1e32('0x78')]===_0x1e32('0x79');});return{'count':_0x289858[_0x1e32('0x70')][_0x1e32('0x3d')]['length'],'rows':_[_0x1e32('0x36')](_0x289858[_0x1e32('0x70')]['fields'],function(_0x4f1508){return{'id':_0x4f1508[_0x1e32('0x33')],'name':_0x4f1508[_0x1e32('0x7a')],'custom':_[_0x1e32('0x7b')](_0x4f1508[_0x1e32('0x33')],_0x1e32('0x7c'))?!![]:![],'options':_0x4f1508[_0x1e32('0x38')]['name']===_0x1e32('0x7d')&&_0x4f1508[_0x1e32('0x38')][_0x1e32('0x7e')][_0x1e32('0x3e')]>0x0?_['map'](_0x4f1508[_0x1e32('0x38')][_0x1e32('0x7e')],function(_0x2ddc67){return{'name':_0x2ddc67['label'],'value':_0x2ddc67[_0x1e32('0x7f')]};}):[]};})};}})[_0x1e32('0x4c')](respondWithResult(_0x4895ed,null))[_0x1e32('0x4d')](function(_0x285ff7){console[_0x1e32('0x80')](_0x1e32('0x81')+_0x285ff7);var _0x517077=_0x208446['query'][_0x1e32('0x18')]?0x1f4:_0x285ff7[_0x1e32('0x82')]||0x1f4;logger[_0x1e32('0x22')](_0x1e32('0x83'),_0x1e32('0x62'),_0x517077,JSON[_0x1e32('0x84')](_0x285ff7));delete _0x285ff7['name'];if(_0x517077===0x191){_0x517077=0x190;}_0x4895ed[_0x1e32('0x26')](_0x517077)['send'](_0x208446['query'][_0x1e32('0x18')]?{'message':'Wrong\x20credentials','statusCode':_0x285ff7['statusCode']}:_0x285ff7);});}; \ No newline at end of file diff --git a/server/api/intVtigerAccount/intVtigerAccount.model.js b/server/api/intVtigerAccount/intVtigerAccount.model.js index 404164e..1e7b419 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 _0xcbf1=['api','bluebird','request-promise','rimraf','../../config/environment','./intVtigerAccount.attributes','define','int_vtiger_accounts','lodash','util','../../config/logger'];(function(_0x9a6b9b,_0x492490){var _0x48ee7a=function(_0x9afff0){while(--_0x9afff0){_0x9a6b9b['push'](_0x9a6b9b['shift']());}};_0x48ee7a(++_0x492490);}(_0xcbf1,0x168));var _0x1cbf=function(_0x42cae2,_0x284ef8){_0x42cae2=_0x42cae2-0x0;var _0x5f256f=_0xcbf1[_0x42cae2];return _0x5f256f;};'use strict';var _=require(_0x1cbf('0x0'));var util=require(_0x1cbf('0x1'));var logger=require(_0x1cbf('0x2'))(_0x1cbf('0x3'));var moment=require('moment');var BPromise=require(_0x1cbf('0x4'));var rp=require(_0x1cbf('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x1cbf('0x6'));var config=require(_0x1cbf('0x7'));var attributes=require(_0x1cbf('0x8'));var integrations=require('../../components/integrations/configuration');module['exports']=function(_0xd8a680,_0x30f2e5){return _0xd8a680[_0x1cbf('0x9')]('VtigerAccount',attributes,{'tableName':_0x1cbf('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x7777=['VtigerAccount','int_vtiger_accounts','util','api','bluebird','request-promise','path','rimraf','./intVtigerAccount.attributes','../../components/integrations/configuration'];(function(_0x5416db,_0x55683a){var _0x243e35=function(_0x1eb623){while(--_0x1eb623){_0x5416db['push'](_0x5416db['shift']());}};_0x243e35(++_0x55683a);}(_0x7777,0xc0));var _0x7777=function(_0x5193cd,_0xcd459f){_0x5193cd=_0x5193cd-0x0;var _0x264954=_0x7777[_0x5193cd];return _0x264954;};'use strict';var _=require('lodash');var util=require(_0x7777('0x0'));var logger=require('../../config/logger')(_0x7777('0x1'));var moment=require('moment');var BPromise=require(_0x7777('0x2'));var rp=require(_0x7777('0x3'));var fs=require('fs');var path=require(_0x7777('0x4'));var rimraf=require(_0x7777('0x5'));var config=require('../../config/environment');var attributes=require(_0x7777('0x6'));var integrations=require(_0x7777('0x7'));module['exports']=function(_0x160c20,_0x175c32){return _0x160c20['define'](_0x7777('0x8'),attributes,{'tableName':_0x7777('0x9'),'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 619d394..0bcd1dc 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 _0x0e1c=['attributes','limit','include','map','model','catch','ShowVtigerAccount','find','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request','then','info','VtigerAccount,\x20%s,\x20%s','debug','VtigerAccount,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','GetVtigerAccount','VtigerAccount','findAll','options','raw','where'];(function(_0x58ae8a,_0x3c619e){var _0x2f0b6b=function(_0x6db940){while(--_0x6db940){_0x58ae8a['push'](_0x58ae8a['shift']());}};_0x2f0b6b(++_0x3c619e);}(_0x0e1c,0xc6));var _0xc0e1=function(_0x5f2900,_0x557df0){_0x5f2900=_0x5f2900-0x0;var _0x3400d6=_0x0e1c[_0x5f2900];return _0x3400d6;};'use strict';var _=require(_0xc0e1('0x0'));var util=require(_0xc0e1('0x1'));var moment=require(_0xc0e1('0x2'));var BPromise=require('bluebird');var rs=require(_0xc0e1('0x3'));var fs=require('fs');var Redis=require(_0xc0e1('0x4'));var db=require(_0xc0e1('0x5'))['db'];var utils=require(_0xc0e1('0x6'));var logger=require(_0xc0e1('0x7'))(_0xc0e1('0x8'));var config=require('../../config/environment');var jayson=require(_0xc0e1('0x9'));var client=jayson[_0xc0e1('0xa')][_0xc0e1('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x1689b6,_0x5de093,_0x595ab2){return new BPromise(function(_0x57679b,_0x4d39d9){return client[_0xc0e1('0xc')](_0x1689b6,_0x595ab2)[_0xc0e1('0xd')](function(_0x388147){logger[_0xc0e1('0xe')](_0xc0e1('0xf'),_0x5de093,'request\x20sent');logger[_0xc0e1('0x10')](_0xc0e1('0x11'),_0x5de093,_0xc0e1('0x12'),JSON[_0xc0e1('0x13')](_0x388147));if(_0x388147[_0xc0e1('0x14')]){if(_0x388147['error'][_0xc0e1('0x15')]===0x1f4){logger['error'](_0xc0e1('0xf'),_0x5de093,_0x388147[_0xc0e1('0x14')][_0xc0e1('0x16')]);return _0x4d39d9(_0x388147[_0xc0e1('0x14')][_0xc0e1('0x16')]);}logger[_0xc0e1('0x14')](_0xc0e1('0xf'),_0x5de093,_0x388147['error'][_0xc0e1('0x16')]);return _0x57679b(_0x388147['error'][_0xc0e1('0x16')]);}else{logger[_0xc0e1('0xe')]('VtigerAccount,\x20%s,\x20%s',_0x5de093,_0xc0e1('0x12'));_0x57679b(_0x388147[_0xc0e1('0x17')][_0xc0e1('0x16')]);}})['catch'](function(_0x5c69c5){logger['error'](_0xc0e1('0xf'),_0x5de093,_0x5c69c5);_0x4d39d9(_0x5c69c5);});});}exports[_0xc0e1('0x18')]=function(_0x1b42d5){var _0x1d91f6=this;return new Promise(function(_0x56a8a5,_0x3ab3c9){return db[_0xc0e1('0x19')][_0xc0e1('0x1a')]({'raw':_0x1b42d5['options']?_0x1b42d5[_0xc0e1('0x1b')][_0xc0e1('0x1c')]===undefined?!![]:![]:!![],'where':_0x1b42d5[_0xc0e1('0x1b')]?_0x1b42d5[_0xc0e1('0x1b')][_0xc0e1('0x1d')]||null:null,'attributes':_0x1b42d5[_0xc0e1('0x1b')]?_0x1b42d5[_0xc0e1('0x1b')][_0xc0e1('0x1e')]||null:null,'limit':_0x1b42d5[_0xc0e1('0x1b')]?_0x1b42d5[_0xc0e1('0x1b')][_0xc0e1('0x1f')]||null:null,'include':_0x1b42d5[_0xc0e1('0x1b')]?_0x1b42d5[_0xc0e1('0x1b')][_0xc0e1('0x20')]?_[_0xc0e1('0x21')](_0x1b42d5[_0xc0e1('0x1b')][_0xc0e1('0x20')],function(_0x5471f3){return{'model':db[_0x5471f3['model']],'as':_0x5471f3['as'],'attributes':_0x5471f3[_0xc0e1('0x1e')],'include':_0x5471f3[_0xc0e1('0x20')]?_[_0xc0e1('0x21')](_0x5471f3['include'],function(_0xd18e72){return{'model':db[_0xd18e72[_0xc0e1('0x22')]],'as':_0xd18e72['as'],'attributes':_0xd18e72['attributes'],'include':_0xd18e72[_0xc0e1('0x20')]?_[_0xc0e1('0x21')](_0xd18e72[_0xc0e1('0x20')],function(_0x115486){return{'model':db[_0x115486[_0xc0e1('0x22')]],'as':_0x115486['as'],'attributes':_0x115486[_0xc0e1('0x1e')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x5c1ad2){logger[_0xc0e1('0xe')](_0xc0e1('0x18'),_0x1b42d5);logger[_0xc0e1('0x10')](_0xc0e1('0x18'),_0x1b42d5,JSON[_0xc0e1('0x13')](_0x5c1ad2));_0x56a8a5(_0x5c1ad2);})[_0xc0e1('0x23')](function(_0x3c8de9){logger[_0xc0e1('0x14')](_0xc0e1('0x18'),_0x3c8de9[_0xc0e1('0x16')],_0x1b42d5);_0x3ab3c9(_0x1d91f6[_0xc0e1('0x14')](0x1f4,_0x3c8de9[_0xc0e1('0x16')]));});});};exports[_0xc0e1('0x24')]=function(_0x823545){var _0x2307c0=this;return new Promise(function(_0x5aefee,_0x32c174){return db['VtigerAccount'][_0xc0e1('0x25')]({'raw':_0x823545[_0xc0e1('0x1b')]?_0x823545[_0xc0e1('0x1b')][_0xc0e1('0x1c')]===undefined?!![]:![]:!![],'where':_0x823545['options']?_0x823545[_0xc0e1('0x1b')][_0xc0e1('0x1d')]||null:null,'attributes':_0x823545[_0xc0e1('0x1b')]?_0x823545[_0xc0e1('0x1b')][_0xc0e1('0x1e')]||null:null,'include':_0x823545[_0xc0e1('0x1b')]?_0x823545['options'][_0xc0e1('0x20')]?_['map'](_0x823545[_0xc0e1('0x1b')][_0xc0e1('0x20')],function(_0x37052b){return{'model':db[_0x37052b[_0xc0e1('0x22')]],'as':_0x37052b['as'],'attributes':_0x37052b[_0xc0e1('0x1e')],'include':_0x37052b['include']?_['map'](_0x37052b[_0xc0e1('0x20')],function(_0x4a0c6d){return{'model':db[_0x4a0c6d['model']],'as':_0x4a0c6d['as'],'attributes':_0x4a0c6d[_0xc0e1('0x1e')],'include':_0x4a0c6d['include']?_[_0xc0e1('0x21')](_0x4a0c6d[_0xc0e1('0x20')],function(_0xb3deb5){return{'model':db[_0xb3deb5[_0xc0e1('0x22')]],'as':_0xb3deb5['as'],'attributes':_0xb3deb5[_0xc0e1('0x1e')]};}):[]};}):[]};}):[]:[]})[_0xc0e1('0xd')](function(_0x340e5e){logger[_0xc0e1('0xe')](_0xc0e1('0x24'),_0x823545);logger[_0xc0e1('0x10')](_0xc0e1('0x24'),_0x823545,JSON[_0xc0e1('0x13')](_0x340e5e));_0x5aefee(_0x340e5e);})[_0xc0e1('0x23')](function(_0x109d79){logger[_0xc0e1('0x14')](_0xc0e1('0x24'),_0x109d79['message'],_0x823545);_0x32c174(_0x2307c0['error'](0x1f4,_0x109d79[_0xc0e1('0x16')]));});});}; \ No newline at end of file +var _0x817b=['message','result','catch','GetVtigerAccount','VtigerAccount','findAll','options','raw','where','limit','include','map','model','attributes','ShowVtigerAccount','find','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request','then','info','VtigerAccount,\x20%s,\x20%s','request\x20sent','debug','VtigerAccount,\x20%s,\x20%s,\x20%s','stringify','error','code'];(function(_0x3ff867,_0x3c37b0){var _0x37fdfa=function(_0x349faa){while(--_0x349faa){_0x3ff867['push'](_0x3ff867['shift']());}};_0x37fdfa(++_0x3c37b0);}(_0x817b,0x11a));var _0xb817=function(_0x3fbaa5,_0x5cde17){_0x3fbaa5=_0x3fbaa5-0x0;var _0x59612c=_0x817b[_0x3fbaa5];return _0x59612c;};'use strict';var _=require(_0xb817('0x0'));var util=require('util');var moment=require(_0xb817('0x1'));var BPromise=require(_0xb817('0x2'));var rs=require(_0xb817('0x3'));var fs=require('fs');var Redis=require(_0xb817('0x4'));var db=require(_0xb817('0x5'))['db'];var utils=require(_0xb817('0x6'));var logger=require(_0xb817('0x7'))(_0xb817('0x8'));var config=require('../../config/environment');var jayson=require(_0xb817('0x9'));var client=jayson[_0xb817('0xa')][_0xb817('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x1c2bd2,_0x4d3f45,_0x29e662){return new BPromise(function(_0x3cf55c,_0x2fc299){return client[_0xb817('0xc')](_0x1c2bd2,_0x29e662)[_0xb817('0xd')](function(_0xae99f6){logger[_0xb817('0xe')](_0xb817('0xf'),_0x4d3f45,_0xb817('0x10'));logger[_0xb817('0x11')](_0xb817('0x12'),_0x4d3f45,_0xb817('0x10'),JSON[_0xb817('0x13')](_0xae99f6));if(_0xae99f6[_0xb817('0x14')]){if(_0xae99f6['error'][_0xb817('0x15')]===0x1f4){logger[_0xb817('0x14')]('VtigerAccount,\x20%s,\x20%s',_0x4d3f45,_0xae99f6[_0xb817('0x14')][_0xb817('0x16')]);return _0x2fc299(_0xae99f6[_0xb817('0x14')][_0xb817('0x16')]);}logger[_0xb817('0x14')](_0xb817('0xf'),_0x4d3f45,_0xae99f6[_0xb817('0x14')][_0xb817('0x16')]);return _0x3cf55c(_0xae99f6[_0xb817('0x14')][_0xb817('0x16')]);}else{logger['info'](_0xb817('0xf'),_0x4d3f45,'request\x20sent');_0x3cf55c(_0xae99f6[_0xb817('0x17')][_0xb817('0x16')]);}})[_0xb817('0x18')](function(_0x584645){logger['error'](_0xb817('0xf'),_0x4d3f45,_0x584645);_0x2fc299(_0x584645);});});}exports[_0xb817('0x19')]=function(_0x3511eb){var _0x360c2f=this;return new Promise(function(_0x5f70bd,_0x26c488){return db[_0xb817('0x1a')][_0xb817('0x1b')]({'raw':_0x3511eb['options']?_0x3511eb[_0xb817('0x1c')][_0xb817('0x1d')]===undefined?!![]:![]:!![],'where':_0x3511eb[_0xb817('0x1c')]?_0x3511eb['options'][_0xb817('0x1e')]||null:null,'attributes':_0x3511eb[_0xb817('0x1c')]?_0x3511eb[_0xb817('0x1c')]['attributes']||null:null,'limit':_0x3511eb[_0xb817('0x1c')]?_0x3511eb[_0xb817('0x1c')][_0xb817('0x1f')]||null:null,'include':_0x3511eb[_0xb817('0x1c')]?_0x3511eb[_0xb817('0x1c')][_0xb817('0x20')]?_[_0xb817('0x21')](_0x3511eb[_0xb817('0x1c')]['include'],function(_0xf84e3e){return{'model':db[_0xf84e3e[_0xb817('0x22')]],'as':_0xf84e3e['as'],'attributes':_0xf84e3e[_0xb817('0x23')],'include':_0xf84e3e[_0xb817('0x20')]?_['map'](_0xf84e3e[_0xb817('0x20')],function(_0x23f35d){return{'model':db[_0x23f35d[_0xb817('0x22')]],'as':_0x23f35d['as'],'attributes':_0x23f35d[_0xb817('0x23')],'include':_0x23f35d['include']?_[_0xb817('0x21')](_0x23f35d[_0xb817('0x20')],function(_0x29bfba){return{'model':db[_0x29bfba[_0xb817('0x22')]],'as':_0x29bfba['as'],'attributes':_0x29bfba[_0xb817('0x23')]};}):[]};}):[]};}):[]:[]})[_0xb817('0xd')](function(_0x40288d){logger[_0xb817('0xe')](_0xb817('0x19'),_0x3511eb);logger[_0xb817('0x11')](_0xb817('0x19'),_0x3511eb,JSON['stringify'](_0x40288d));_0x5f70bd(_0x40288d);})['catch'](function(_0x527d5c){logger[_0xb817('0x14')](_0xb817('0x19'),_0x527d5c[_0xb817('0x16')],_0x3511eb);_0x26c488(_0x360c2f['error'](0x1f4,_0x527d5c['message']));});});};exports[_0xb817('0x24')]=function(_0x1f9be9){var _0x3a11d5=this;return new Promise(function(_0x392802,_0x5d0f6f){return db['VtigerAccount'][_0xb817('0x25')]({'raw':_0x1f9be9['options']?_0x1f9be9['options'][_0xb817('0x1d')]===undefined?!![]:![]:!![],'where':_0x1f9be9[_0xb817('0x1c')]?_0x1f9be9[_0xb817('0x1c')]['where']||null:null,'attributes':_0x1f9be9[_0xb817('0x1c')]?_0x1f9be9[_0xb817('0x1c')][_0xb817('0x23')]||null:null,'include':_0x1f9be9[_0xb817('0x1c')]?_0x1f9be9[_0xb817('0x1c')][_0xb817('0x20')]?_[_0xb817('0x21')](_0x1f9be9['options'][_0xb817('0x20')],function(_0xfbdfd){return{'model':db[_0xfbdfd[_0xb817('0x22')]],'as':_0xfbdfd['as'],'attributes':_0xfbdfd[_0xb817('0x23')],'include':_0xfbdfd['include']?_[_0xb817('0x21')](_0xfbdfd[_0xb817('0x20')],function(_0x314a5b){return{'model':db[_0x314a5b[_0xb817('0x22')]],'as':_0x314a5b['as'],'attributes':_0x314a5b[_0xb817('0x23')],'include':_0x314a5b[_0xb817('0x20')]?_[_0xb817('0x21')](_0x314a5b[_0xb817('0x20')],function(_0x4b1d68){return{'model':db[_0x4b1d68[_0xb817('0x22')]],'as':_0x4b1d68['as'],'attributes':_0x4b1d68[_0xb817('0x23')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x19ad2c){logger['info'](_0xb817('0x24'),_0x1f9be9);logger[_0xb817('0x11')](_0xb817('0x24'),_0x1f9be9,JSON[_0xb817('0x13')](_0x19ad2c));_0x392802(_0x19ad2c);})[_0xb817('0x18')](function(_0x515206){logger['error'](_0xb817('0x24'),_0x515206[_0xb817('0x16')],_0x1f9be9);_0x5d0f6f(_0x3a11d5[_0xb817('0x14')](0x1f4,_0x515206[_0xb817('0x16')]));});});}; \ No newline at end of file diff --git a/server/api/intVtigerConfiguration/index.js b/server/api/intVtigerConfiguration/index.js index bbaae43..342ba20 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(_0x440c7f,_0x1d7a93){var _0x1af0ff=function(_0x24d834){while(--_0x24d834){_0x440c7f['push'](_0x440c7f['shift']());}};_0x1af0ff(++_0x1d7a93);}(_0xb10b,0x12a));var _0xbb10=function(_0x27380a,_0x11b4db){_0x27380a=_0x27380a-0x0;var _0x49557d=_0xb10b[_0x27380a];return _0x49557d;};'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(_0x15b682,_0x2a11eb){var _0x9475fc=function(_0x300c26){while(--_0x300c26){_0x15b682['push'](_0x15b682['shift']());}};_0x9475fc(++_0x2a11eb);}(_0xb10b,0x12a));var _0xbb10=function(_0x53f218,_0x27514c){_0x53f218=_0x53f218-0x0;var _0x21890a=_0xb10b[_0x53f218];return _0x21890a;};'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 387bc2a..4bac4b8 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 _0xcaab=['STRING','sequelize','exports'];(function(_0x41e208,_0x5ac10a){var _0x52047a=function(_0x5c1ae8){while(--_0x5c1ae8){_0x41e208['push'](_0x41e208['shift']());}};_0x52047a(++_0x5ac10a);}(_0xcaab,0xb8));var _0xbcaa=function(_0xf5eba8,_0x4301b5){_0xf5eba8=_0xf5eba8-0x0;var _0x2afb2e=_0xcaab[_0xf5eba8];return _0x2afb2e;};'use strict';var Sequelize=require(_0xbcaa('0x0'));module[_0xbcaa('0x1')]={'name':{'type':Sequelize[_0xbcaa('0x2')]},'description':{'type':Sequelize[_0xbcaa('0x2')]}}; \ No newline at end of file +var _0xd725=['STRING','sequelize'];(function(_0x5c4992,_0x5b546f){var _0x23a30a=function(_0x6b7743){while(--_0x6b7743){_0x5c4992['push'](_0x5c4992['shift']());}};_0x23a30a(++_0x5b546f);}(_0xd725,0x6f));var _0x5d72=function(_0x5db92f,_0x32258d){_0x5db92f=_0x5db92f-0x0;var _0x350841=_0xd725[_0x5db92f];return _0x350841;};'use strict';var Sequelize=require(_0x5d72('0x0'));module['exports']={'name':{'type':Sequelize[_0x5d72('0x1')]},'description':{'type':Sequelize[_0x5d72('0x1')]}}; \ No newline at end of file diff --git a/server/api/intVtigerConfiguration/intVtigerConfiguration.controller.js b/server/api/intVtigerConfiguration/intVtigerConfiguration.controller.js index 5995915..0cf495b 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 _0x93d5=['code','message','result','catch','sendStatus','status','end','json','count','offset','limit','Content-Range','apply','reject','save','update','name','send','map','rawAttributes','fieldName','key','model','query','filters','intersection','fields','length','attributes','hasOwnProperty','nolimit','order','pick','filter','where','type','VIRTUAL','includeAll','include','VtigerConfiguration','findAll','rows','show','params','keys','merge','options','find','create','body','destroy','getFields','findOne','VtigerField','sort','getSubjects','getDescriptions','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','sox','to-csv','lodash','squel','crypto','jsforce','papaparse','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../mysqldb','http','test','Sequelize','ValidationError','The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.','request','then','info','VtigerConfiguration,\x20%s,\x20%s','request\x20sent','debug','stringify','error'];(function(_0x360dc4,_0x1e4ffb){var _0x238fb1=function(_0x54b28a){while(--_0x54b28a){_0x360dc4['push'](_0x360dc4['shift']());}};_0x238fb1(++_0x1e4ffb);}(_0x93d5,0x93));var _0x593d=function(_0x6b38ea,_0x258e70){_0x6b38ea=_0x6b38ea-0x0;var _0x3cda42=_0x93d5[_0x6b38ea];return _0x3cda42;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x593d('0x0'));var rimraf=require(_0x593d('0x1'));var zipdir=require(_0x593d('0x2'));var jsonpatch=require(_0x593d('0x3'));var rp=require(_0x593d('0x4'));var moment=require(_0x593d('0x5'));var BPromise=require('bluebird');var Mustache=require(_0x593d('0x6'));var util=require(_0x593d('0x7'));var path=require('path');var sox=require(_0x593d('0x8'));var csv=require(_0x593d('0x9'));var ejs=require('ejs');var fs=require('fs');var _=require(_0x593d('0xa'));var squel=require(_0x593d('0xb'));var crypto=require(_0x593d('0xc'));var jsforce=require(_0x593d('0xd'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x593d('0xe'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x593d('0xf'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x593d('0x10'))(_0x593d('0x11'));var utils=require(_0x593d('0x12'));var config=require('../../config/environment');var db=require(_0x593d('0x13'))['db'];var jayson=require('jayson/promise');var client=jayson['client'][_0x593d('0x14')]({'port':0x232a});function checkPasswordPattern(_0x376b55,_0x26d89c,_0x43fc70){if(_0x43fc70){var _0x600345=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x600345[_0x593d('0x15')](_0x26d89c)){return _0x376b55;}else{throw new db[(_0x593d('0x16'))][(_0x593d('0x17'))](_0x593d('0x18'));}}else{return _0x376b55;}}function respondWithRpcPromise(_0xbe5b16,_0xfbaa83,_0x1d30f3,_0x3dde6f){return new BPromise(function(_0x542a63,_0x299bfd){var _0x3d47c2=_0x3dde6f||client;return _0x3d47c2[_0x593d('0x19')](_0xbe5b16,_0x1d30f3)[_0x593d('0x1a')](function(_0x3631ca){logger[_0x593d('0x1b')](_0x593d('0x1c'),_0xfbaa83,_0x593d('0x1d'));logger[_0x593d('0x1e')]('VtigerConfiguration,\x20%s,\x20%s,\x20%s',_0xfbaa83,_0x593d('0x1d'),JSON[_0x593d('0x1f')](_0x3631ca));if(_0x3631ca['error']){if(_0x3631ca[_0x593d('0x20')][_0x593d('0x21')]===0x1f4){logger[_0x593d('0x20')](_0x593d('0x1c'),_0xfbaa83,_0x3631ca[_0x593d('0x20')][_0x593d('0x22')]);return _0x299bfd(_0x3631ca[_0x593d('0x20')]['message']);}logger[_0x593d('0x20')]('VtigerConfiguration,\x20%s,\x20%s',_0xfbaa83,_0x3631ca[_0x593d('0x20')]['message']);return _0x542a63(_0x3631ca['error'][_0x593d('0x22')]);}else{logger[_0x593d('0x1b')](_0x593d('0x1c'),_0xfbaa83,'request\x20sent');_0x542a63(_0x3631ca[_0x593d('0x23')][_0x593d('0x22')]);}})[_0x593d('0x24')](function(_0x297095){logger[_0x593d('0x20')](_0x593d('0x1c'),_0xfbaa83,_0x297095);_0x299bfd(_0x297095);});});}function respondWithStatusCode(_0x2b6ddf,_0x4a7927){_0x4a7927=_0x4a7927||0xcc;return function(_0x26912c){if(_0x26912c){return _0x2b6ddf[_0x593d('0x25')](_0x4a7927);}return _0x2b6ddf[_0x593d('0x26')](_0x4a7927)[_0x593d('0x27')]();};}function respondWithResult(_0x5dd308,_0x7e718d){_0x7e718d=_0x7e718d||0xc8;return function(_0x396dd8){if(_0x396dd8){return _0x5dd308[_0x593d('0x26')](_0x7e718d)[_0x593d('0x28')](_0x396dd8);}};}function respondWithFilteredResult(_0x14eac9,_0x461108){return function(_0x285653){if(_0x285653){var _0x188f6a=_0x285653[_0x593d('0x29')],_0x132ccd=_0x461108[_0x593d('0x2a')],_0x470c75=_0x461108[_0x593d('0x2a')]+_0x461108[_0x593d('0x2b')],_0x65aede;if(_0x470c75>=_0x188f6a){_0x470c75=_0x188f6a;_0x65aede=0xc8;}else{_0x65aede=0xce;}_0x14eac9[_0x593d('0x26')](_0x65aede);return _0x14eac9['set'](_0x593d('0x2c'),_0x132ccd+'-'+_0x470c75+'/'+_0x188f6a)[_0x593d('0x28')](_0x285653);}return null;};}function patchUpdates(_0x54682c){return function(_0x1599e2){try{jsonpatch[_0x593d('0x2d')](_0x1599e2,_0x54682c,!![]);}catch(_0x53bcbf){return BPromise[_0x593d('0x2e')](_0x53bcbf);}return _0x1599e2[_0x593d('0x2f')]();};}function saveUpdates(_0x147ef6,_0x54c1b9){return function(_0x4c39f9){if(_0x4c39f9){return _0x4c39f9[_0x593d('0x30')](_0x147ef6)[_0x593d('0x1a')](function(_0x2a3871){return _0x2a3871;});}return null;};}function removeEntity(_0x244024,_0x2461bf){return function(_0x15dafc){if(_0x15dafc){return _0x15dafc['destroy']()[_0x593d('0x1a')](function(){_0x244024['status'](0xcc)[_0x593d('0x27')]();});}};}function handleEntityNotFound(_0x594ece,_0x4aaa4e){return function(_0x58291c){if(!_0x58291c){_0x594ece[_0x593d('0x25')](0x194);}return _0x58291c;};}function handleError(_0x64a10a,_0x23313f){_0x23313f=_0x23313f||0x1f4;return function(_0x3be157){logger[_0x593d('0x20')](_0x3be157['stack']);if(_0x3be157[_0x593d('0x31')]){delete _0x3be157[_0x593d('0x31')];}_0x64a10a[_0x593d('0x26')](_0x23313f)[_0x593d('0x32')](_0x3be157);};}exports['index']=function(_0x4c0692,_0x492a64){var _0x34bada={},_0x2c6b7a={},_0x44a26b={'count':0x0,'rows':[]};var _0x42543b=_[_0x593d('0x33')](db['VtigerConfiguration'][_0x593d('0x34')],function(_0xdcebad){return{'name':_0xdcebad[_0x593d('0x35')],'type':_0xdcebad['type'][_0x593d('0x36')]};});_0x2c6b7a[_0x593d('0x37')]=_['map'](_0x42543b,_0x593d('0x31'));_0x2c6b7a[_0x593d('0x38')]=_['keys'](_0x4c0692[_0x593d('0x38')]);_0x2c6b7a[_0x593d('0x39')]=_[_0x593d('0x3a')](_0x2c6b7a[_0x593d('0x37')],_0x2c6b7a['query']);_0x34bada['attributes']=_['intersection'](_0x2c6b7a['model'],qs[_0x593d('0x3b')](_0x4c0692[_0x593d('0x38')]['fields']));_0x34bada['attributes']=_0x34bada['attributes'][_0x593d('0x3c')]?_0x34bada[_0x593d('0x3d')]:_0x2c6b7a[_0x593d('0x37')];if(!_0x4c0692['query'][_0x593d('0x3e')](_0x593d('0x3f'))){_0x34bada[_0x593d('0x2b')]=qs[_0x593d('0x2b')](_0x4c0692[_0x593d('0x38')][_0x593d('0x2b')]);_0x34bada[_0x593d('0x2a')]=qs[_0x593d('0x2a')](_0x4c0692[_0x593d('0x38')][_0x593d('0x2a')]);}_0x34bada[_0x593d('0x40')]=qs['sort'](_0x4c0692['query']['sort']);_0x34bada['where']=qs[_0x593d('0x39')](_[_0x593d('0x41')](_0x4c0692[_0x593d('0x38')],_0x2c6b7a[_0x593d('0x39')]));if(_0x4c0692[_0x593d('0x38')][_0x593d('0x42')]){_0x34bada[_0x593d('0x43')]=_['merge'](_0x34bada[_0x593d('0x43')],{'$or':_[_0x593d('0x33')](_0x42543b,function(_0x4b2877){if(_0x4b2877[_0x593d('0x44')]!==_0x593d('0x45')){var _0x26a4ce={};_0x26a4ce[_0x4b2877['name']]={'$like':'%'+_0x4c0692['query'][_0x593d('0x42')]+'%'};return _0x26a4ce;}})});}_0x34bada=_['merge']({},_0x34bada,_0x4c0692['options']);var _0x3934bc={'where':_0x34bada[_0x593d('0x43')]};return db['VtigerConfiguration']['count'](_0x3934bc)['then'](function(_0x1d55a5){_0x44a26b[_0x593d('0x29')]=_0x1d55a5;if(_0x4c0692[_0x593d('0x38')][_0x593d('0x46')]){_0x34bada[_0x593d('0x47')]=[{'all':!![]}];}return db[_0x593d('0x48')][_0x593d('0x49')](_0x34bada);})[_0x593d('0x1a')](function(_0x4ac3b0){_0x44a26b[_0x593d('0x4a')]=_0x4ac3b0;return _0x44a26b;})[_0x593d('0x1a')](respondWithFilteredResult(_0x492a64,_0x34bada))['catch'](handleError(_0x492a64,null));};exports[_0x593d('0x4b')]=function(_0x15e473,_0x7cc050){var _0x29e5c6={'raw':![],'where':{'id':_0x15e473[_0x593d('0x4c')]['id']}},_0x34c99={};_0x34c99[_0x593d('0x37')]=_['keys'](db[_0x593d('0x48')][_0x593d('0x34')]);_0x34c99[_0x593d('0x38')]=_[_0x593d('0x4d')](_0x15e473[_0x593d('0x38')]);_0x34c99[_0x593d('0x39')]=_[_0x593d('0x3a')](_0x34c99[_0x593d('0x37')],_0x34c99[_0x593d('0x38')]);_0x29e5c6[_0x593d('0x3d')]=_['intersection'](_0x34c99[_0x593d('0x37')],qs[_0x593d('0x3b')](_0x15e473[_0x593d('0x38')][_0x593d('0x3b')]));_0x29e5c6[_0x593d('0x3d')]=_0x29e5c6[_0x593d('0x3d')][_0x593d('0x3c')]?_0x29e5c6[_0x593d('0x3d')]:_0x34c99[_0x593d('0x37')];if(_0x15e473[_0x593d('0x38')][_0x593d('0x46')]){_0x29e5c6['include']=[{'all':!![]}];}_0x29e5c6=_[_0x593d('0x4e')]({},_0x29e5c6,_0x15e473[_0x593d('0x4f')]);return db[_0x593d('0x48')][_0x593d('0x50')](_0x29e5c6)[_0x593d('0x1a')](handleEntityNotFound(_0x7cc050,null))[_0x593d('0x1a')](respondWithResult(_0x7cc050,null))[_0x593d('0x24')](handleError(_0x7cc050,null));};exports[_0x593d('0x51')]=function(_0x281f2e,_0x5149d9){return db[_0x593d('0x48')][_0x593d('0x51')](_0x281f2e[_0x593d('0x52')],{})[_0x593d('0x1a')](respondWithResult(_0x5149d9,0xc9))[_0x593d('0x24')](handleError(_0x5149d9,null));};exports[_0x593d('0x30')]=function(_0x2d1888,_0xbe9cb3){if(_0x2d1888['body']['id']){delete _0x2d1888[_0x593d('0x52')]['id'];}return db[_0x593d('0x48')][_0x593d('0x50')]({'where':{'id':_0x2d1888[_0x593d('0x4c')]['id']}})[_0x593d('0x1a')](handleEntityNotFound(_0xbe9cb3,null))['then'](saveUpdates(_0x2d1888[_0x593d('0x52')],null))[_0x593d('0x1a')](respondWithResult(_0xbe9cb3,null))[_0x593d('0x24')](handleError(_0xbe9cb3,null));};exports[_0x593d('0x53')]=function(_0x25e381,_0x270df2){return db[_0x593d('0x48')][_0x593d('0x50')]({'where':{'id':_0x25e381[_0x593d('0x4c')]['id']}})['then'](handleEntityNotFound(_0x270df2,null))[_0x593d('0x1a')](removeEntity(_0x270df2,null))[_0x593d('0x24')](handleError(_0x270df2,null));};exports[_0x593d('0x54')]=function(_0x2f66f2,_0x4197e7,_0x21fe8f){var _0x5bad89={};var _0x3d3f9c={};var _0x3ba903;var _0xe2d721;return db[_0x593d('0x48')][_0x593d('0x55')]({'where':{'id':_0x2f66f2[_0x593d('0x4c')]['id']}})[_0x593d('0x1a')](handleEntityNotFound(_0x4197e7,null))[_0x593d('0x1a')](function(_0x50517b){if(_0x50517b){_0x3ba903=_0x50517b;_0x3d3f9c[_0x593d('0x37')]=_[_0x593d('0x4d')](db[_0x593d('0x56')]['rawAttributes']);_0x3d3f9c[_0x593d('0x38')]=_[_0x593d('0x4d')](_0x2f66f2['query']);_0x3d3f9c['filters']=_[_0x593d('0x3a')](_0x3d3f9c[_0x593d('0x37')],_0x3d3f9c[_0x593d('0x38')]);_0x5bad89[_0x593d('0x3d')]=_[_0x593d('0x3a')](_0x3d3f9c[_0x593d('0x37')],qs[_0x593d('0x3b')](_0x2f66f2[_0x593d('0x38')][_0x593d('0x3b')]));_0x5bad89[_0x593d('0x3d')]=_0x5bad89[_0x593d('0x3d')]['length']?_0x5bad89[_0x593d('0x3d')]:_0x3d3f9c[_0x593d('0x37')];_0x5bad89[_0x593d('0x40')]=qs[_0x593d('0x57')](_0x2f66f2[_0x593d('0x38')][_0x593d('0x57')]);_0x5bad89[_0x593d('0x43')]=qs[_0x593d('0x39')](_[_0x593d('0x41')](_0x2f66f2[_0x593d('0x38')],_0x3d3f9c[_0x593d('0x39')]));if(_0x2f66f2[_0x593d('0x38')]['filter']){_0x5bad89['where']=_[_0x593d('0x4e')](_0x5bad89[_0x593d('0x43')],{'$or':_['map'](_0x5bad89['attributes'],function(_0x5ccb4f){var _0x48e962={};_0x48e962[_0x5ccb4f]={'$like':'%'+_0x2f66f2[_0x593d('0x38')][_0x593d('0x42')]+'%'};return _0x48e962;})});}_0x5bad89=_[_0x593d('0x4e')]({},_0x5bad89,_0x2f66f2['options']);return _0x3ba903[_0x593d('0x54')](_0x5bad89);}})[_0x593d('0x1a')](function(_0x5e226a){if(_0x5e226a){_0xe2d721=_0x5e226a['length'];if(!_0x2f66f2['query'][_0x593d('0x3e')](_0x593d('0x3f'))){_0x5bad89[_0x593d('0x2b')]=qs['limit'](_0x2f66f2[_0x593d('0x38')][_0x593d('0x2b')]);_0x5bad89[_0x593d('0x2a')]=qs[_0x593d('0x2a')](_0x2f66f2[_0x593d('0x38')][_0x593d('0x2a')]);}return _0x3ba903['getFields'](_0x5bad89);}})[_0x593d('0x1a')](function(_0x3621d5){if(_0x3621d5){return _0x3621d5?{'count':_0xe2d721,'rows':_0x3621d5}:null;}})[_0x593d('0x1a')](respondWithResult(_0x4197e7,null))[_0x593d('0x24')](handleError(_0x4197e7,null));};exports[_0x593d('0x58')]=function(_0x26598e,_0xcaf2dc,_0x521fac){var _0x147939={};var _0x3bfcda={};var _0x5895e4;var _0x4b9e7f;return db[_0x593d('0x48')][_0x593d('0x55')]({'where':{'id':_0x26598e[_0x593d('0x4c')]['id']}})[_0x593d('0x1a')](handleEntityNotFound(_0xcaf2dc,null))['then'](function(_0x65cb0c){if(_0x65cb0c){_0x5895e4=_0x65cb0c;_0x3bfcda[_0x593d('0x37')]=_[_0x593d('0x4d')](db['VtigerField'][_0x593d('0x34')]);_0x3bfcda['query']=_[_0x593d('0x4d')](_0x26598e[_0x593d('0x38')]);_0x3bfcda[_0x593d('0x39')]=_[_0x593d('0x3a')](_0x3bfcda[_0x593d('0x37')],_0x3bfcda[_0x593d('0x38')]);_0x147939['attributes']=_[_0x593d('0x3a')](_0x3bfcda['model'],qs[_0x593d('0x3b')](_0x26598e[_0x593d('0x38')]['fields']));_0x147939[_0x593d('0x3d')]=_0x147939[_0x593d('0x3d')]['length']?_0x147939[_0x593d('0x3d')]:_0x3bfcda[_0x593d('0x37')];_0x147939['order']=qs[_0x593d('0x57')](_0x26598e[_0x593d('0x38')][_0x593d('0x57')]);_0x147939[_0x593d('0x43')]=qs[_0x593d('0x39')](_[_0x593d('0x41')](_0x26598e[_0x593d('0x38')],_0x3bfcda[_0x593d('0x39')]));if(_0x26598e[_0x593d('0x38')]['filter']){_0x147939['where']=_[_0x593d('0x4e')](_0x147939['where'],{'$or':_[_0x593d('0x33')](_0x147939[_0x593d('0x3d')],function(_0x4b0c23){var _0x100e05={};_0x100e05[_0x4b0c23]={'$like':'%'+_0x26598e[_0x593d('0x38')][_0x593d('0x42')]+'%'};return _0x100e05;})});}_0x147939=_['merge']({},_0x147939,_0x26598e['options']);return _0x5895e4[_0x593d('0x58')](_0x147939);}})[_0x593d('0x1a')](function(_0x290bbc){if(_0x290bbc){_0x4b9e7f=_0x290bbc[_0x593d('0x3c')];if(!_0x26598e[_0x593d('0x38')]['hasOwnProperty'](_0x593d('0x3f'))){_0x147939[_0x593d('0x2b')]=qs[_0x593d('0x2b')](_0x26598e[_0x593d('0x38')]['limit']);_0x147939[_0x593d('0x2a')]=qs['offset'](_0x26598e['query'][_0x593d('0x2a')]);}return _0x5895e4[_0x593d('0x58')](_0x147939);}})['then'](function(_0x4d0d51){if(_0x4d0d51){return _0x4d0d51?{'count':_0x4b9e7f,'rows':_0x4d0d51}:null;}})['then'](respondWithResult(_0xcaf2dc,null))['catch'](handleError(_0xcaf2dc,null));};exports['getDescriptions']=function(_0x3ff57e,_0x5b3f33,_0x4eff22){var _0x1303dd={};var _0x4a172f={};var _0x47d1a0;var _0x5e578b;return db[_0x593d('0x48')]['findOne']({'where':{'id':_0x3ff57e['params']['id']}})[_0x593d('0x1a')](handleEntityNotFound(_0x5b3f33,null))[_0x593d('0x1a')](function(_0x4148ad){if(_0x4148ad){_0x47d1a0=_0x4148ad;_0x4a172f[_0x593d('0x37')]=_[_0x593d('0x4d')](db[_0x593d('0x56')][_0x593d('0x34')]);_0x4a172f['query']=_[_0x593d('0x4d')](_0x3ff57e[_0x593d('0x38')]);_0x4a172f[_0x593d('0x39')]=_[_0x593d('0x3a')](_0x4a172f[_0x593d('0x37')],_0x4a172f[_0x593d('0x38')]);_0x1303dd['attributes']=_[_0x593d('0x3a')](_0x4a172f[_0x593d('0x37')],qs[_0x593d('0x3b')](_0x3ff57e[_0x593d('0x38')][_0x593d('0x3b')]));_0x1303dd[_0x593d('0x3d')]=_0x1303dd[_0x593d('0x3d')][_0x593d('0x3c')]?_0x1303dd[_0x593d('0x3d')]:_0x4a172f[_0x593d('0x37')];_0x1303dd[_0x593d('0x40')]=qs[_0x593d('0x57')](_0x3ff57e[_0x593d('0x38')]['sort']);_0x1303dd[_0x593d('0x43')]=qs[_0x593d('0x39')](_[_0x593d('0x41')](_0x3ff57e[_0x593d('0x38')],_0x4a172f[_0x593d('0x39')]));if(_0x3ff57e[_0x593d('0x38')][_0x593d('0x42')]){_0x1303dd[_0x593d('0x43')]=_[_0x593d('0x4e')](_0x1303dd[_0x593d('0x43')],{'$or':_[_0x593d('0x33')](_0x1303dd[_0x593d('0x3d')],function(_0x23f32c){var _0x2188bb={};_0x2188bb[_0x23f32c]={'$like':'%'+_0x3ff57e[_0x593d('0x38')]['filter']+'%'};return _0x2188bb;})});}_0x1303dd=_[_0x593d('0x4e')]({},_0x1303dd,_0x3ff57e[_0x593d('0x4f')]);return _0x47d1a0['getDescriptions'](_0x1303dd);}})['then'](function(_0x27aac8){if(_0x27aac8){_0x5e578b=_0x27aac8[_0x593d('0x3c')];if(!_0x3ff57e[_0x593d('0x38')][_0x593d('0x3e')](_0x593d('0x3f'))){_0x1303dd[_0x593d('0x2b')]=qs[_0x593d('0x2b')](_0x3ff57e[_0x593d('0x38')][_0x593d('0x2b')]);_0x1303dd[_0x593d('0x2a')]=qs[_0x593d('0x2a')](_0x3ff57e['query'][_0x593d('0x2a')]);}return _0x47d1a0[_0x593d('0x59')](_0x1303dd);}})[_0x593d('0x1a')](function(_0x6fb588){if(_0x6fb588){return _0x6fb588?{'count':_0x5e578b,'rows':_0x6fb588}:null;}})[_0x593d('0x1a')](respondWithResult(_0x5b3f33,null))['catch'](handleError(_0x5b3f33,null));}; \ No newline at end of file +var _0x812e=['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','VtigerConfiguration,\x20%s,\x20%s','request\x20sent','VtigerConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','sendStatus','status','end','count','offset','limit','set','json','apply','reject','save','then','destroy','stack','name','send','VtigerConfiguration','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','pick','filter','merge','where','VIRTUAL','includeAll','include','rows','show','params','length','options','find','create','body','update','findOne','VtigerField','map','getFields','getSubjects','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/auth/service','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../mysqldb','client'];(function(_0x725b8e,_0xc22b48){var _0x43ac45=function(_0x46bb4a){while(--_0x46bb4a){_0x725b8e['push'](_0x725b8e['shift']());}};_0x43ac45(++_0xc22b48);}(_0x812e,0x1c0));var _0xe812=function(_0x29b2ab,_0x23c6a1){_0x29b2ab=_0x29b2ab-0x0;var _0x5548c6=_0x812e[_0x29b2ab];return _0x5548c6;};'use strict';var pdf=require(_0xe812('0x0'));var emlformat=require(_0xe812('0x1'));var rimraf=require(_0xe812('0x2'));var zipdir=require(_0xe812('0x3'));var jsonpatch=require(_0xe812('0x4'));var rp=require(_0xe812('0x5'));var moment=require(_0xe812('0x6'));var BPromise=require(_0xe812('0x7'));var Mustache=require(_0xe812('0x8'));var util=require(_0xe812('0x9'));var path=require(_0xe812('0xa'));var sox=require(_0xe812('0xb'));var csv=require(_0xe812('0xc'));var ejs=require(_0xe812('0xd'));var fs=require('fs');var _=require(_0xe812('0xe'));var squel=require(_0xe812('0xf'));var crypto=require(_0xe812('0x10'));var jsforce=require(_0xe812('0x11'));var deskjs=require(_0xe812('0x12'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0xe812('0x13'));var Redis=require(_0xe812('0x14'));var authService=require(_0xe812('0x15'));var qs=require('../../components/parsers/qs');var as=require(_0xe812('0x16'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xe812('0x17'))('api');var utils=require(_0xe812('0x18'));var config=require('../../config/environment');var db=require(_0xe812('0x19'))['db'];var jayson=require('jayson/promise');var client=jayson[_0xe812('0x1a')]['http']({'port':0x232a});function checkPasswordPattern(_0x4acb14,_0x9d7ac6,_0x529f0e){if(_0x529f0e){var _0x4d30a1=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x4d30a1[_0xe812('0x1b')](_0x9d7ac6)){return _0x4acb14;}else{throw new db[(_0xe812('0x1c'))][(_0xe812('0x1d'))](_0xe812('0x1e'));}}else{return _0x4acb14;}}function respondWithRpcPromise(_0x44e519,_0xc69357,_0x27786d,_0x24de3f){return new BPromise(function(_0x3db5f1,_0x167a5b){var _0x577655=_0x24de3f||client;return _0x577655[_0xe812('0x1f')](_0x44e519,_0x27786d)['then'](function(_0x12ed6a){logger[_0xe812('0x20')](_0xe812('0x21'),_0xc69357,_0xe812('0x22'));logger['debug'](_0xe812('0x23'),_0xc69357,_0xe812('0x22'),JSON[_0xe812('0x24')](_0x12ed6a));if(_0x12ed6a[_0xe812('0x25')]){if(_0x12ed6a[_0xe812('0x25')][_0xe812('0x26')]===0x1f4){logger['error'](_0xe812('0x21'),_0xc69357,_0x12ed6a['error'][_0xe812('0x27')]);return _0x167a5b(_0x12ed6a[_0xe812('0x25')][_0xe812('0x27')]);}logger['error'](_0xe812('0x21'),_0xc69357,_0x12ed6a['error'][_0xe812('0x27')]);return _0x3db5f1(_0x12ed6a[_0xe812('0x25')][_0xe812('0x27')]);}else{logger['info'](_0xe812('0x21'),_0xc69357,_0xe812('0x22'));_0x3db5f1(_0x12ed6a[_0xe812('0x28')][_0xe812('0x27')]);}})[_0xe812('0x29')](function(_0x5a785b){logger[_0xe812('0x25')](_0xe812('0x21'),_0xc69357,_0x5a785b);_0x167a5b(_0x5a785b);});});}function respondWithStatusCode(_0x5b6c30,_0x22dda5){_0x22dda5=_0x22dda5||0xcc;return function(_0x4d1db8){if(_0x4d1db8){return _0x5b6c30[_0xe812('0x2a')](_0x22dda5);}return _0x5b6c30[_0xe812('0x2b')](_0x22dda5)[_0xe812('0x2c')]();};}function respondWithResult(_0x32b326,_0x3c3945){_0x3c3945=_0x3c3945||0xc8;return function(_0x56bccb){if(_0x56bccb){return _0x32b326['status'](_0x3c3945)['json'](_0x56bccb);}};}function respondWithFilteredResult(_0x38dd5f,_0x38f652){return function(_0x34a0b4){if(_0x34a0b4){var _0x48a513=_0x34a0b4[_0xe812('0x2d')],_0x3fc653=_0x38f652[_0xe812('0x2e')],_0x5a954a=_0x38f652['offset']+_0x38f652[_0xe812('0x2f')],_0x513f60;if(_0x5a954a>=_0x48a513){_0x5a954a=_0x48a513;_0x513f60=0xc8;}else{_0x513f60=0xce;}_0x38dd5f[_0xe812('0x2b')](_0x513f60);return _0x38dd5f[_0xe812('0x30')]('Content-Range',_0x3fc653+'-'+_0x5a954a+'/'+_0x48a513)[_0xe812('0x31')](_0x34a0b4);}return null;};}function patchUpdates(_0x5d692f){return function(_0x223825){try{jsonpatch[_0xe812('0x32')](_0x223825,_0x5d692f,!![]);}catch(_0x2c86e3){return BPromise[_0xe812('0x33')](_0x2c86e3);}return _0x223825[_0xe812('0x34')]();};}function saveUpdates(_0x1c09a8,_0x42e3b9){return function(_0x25ce47){if(_0x25ce47){return _0x25ce47['update'](_0x1c09a8)[_0xe812('0x35')](function(_0x46e69f){return _0x46e69f;});}return null;};}function removeEntity(_0x5a73fc,_0x1eb5f1){return function(_0x3d2e70){if(_0x3d2e70){return _0x3d2e70[_0xe812('0x36')]()['then'](function(){_0x5a73fc[_0xe812('0x2b')](0xcc)[_0xe812('0x2c')]();});}};}function handleEntityNotFound(_0x47a39,_0x8e0ca2){return function(_0x45d5ae){if(!_0x45d5ae){_0x47a39[_0xe812('0x2a')](0x194);}return _0x45d5ae;};}function handleError(_0x121bb0,_0x5ae8ef){_0x5ae8ef=_0x5ae8ef||0x1f4;return function(_0xc628d3){logger[_0xe812('0x25')](_0xc628d3[_0xe812('0x37')]);if(_0xc628d3[_0xe812('0x38')]){delete _0xc628d3[_0xe812('0x38')];}_0x121bb0['status'](_0x5ae8ef)[_0xe812('0x39')](_0xc628d3);};}exports['index']=function(_0xa26543,_0x17df63){var _0x4d07af={},_0x43ab85={},_0x5e0a40={'count':0x0,'rows':[]};var _0x4c1088=_['map'](db[_0xe812('0x3a')][_0xe812('0x3b')],function(_0x5b71fc){return{'name':_0x5b71fc[_0xe812('0x3c')],'type':_0x5b71fc[_0xe812('0x3d')][_0xe812('0x3e')]};});_0x43ab85[_0xe812('0x3f')]=_['map'](_0x4c1088,'name');_0x43ab85[_0xe812('0x40')]=_[_0xe812('0x41')](_0xa26543[_0xe812('0x40')]);_0x43ab85[_0xe812('0x42')]=_[_0xe812('0x43')](_0x43ab85[_0xe812('0x3f')],_0x43ab85[_0xe812('0x40')]);_0x4d07af[_0xe812('0x44')]=_['intersection'](_0x43ab85['model'],qs[_0xe812('0x45')](_0xa26543['query']['fields']));_0x4d07af[_0xe812('0x44')]=_0x4d07af[_0xe812('0x44')]['length']?_0x4d07af[_0xe812('0x44')]:_0x43ab85['model'];if(!_0xa26543[_0xe812('0x40')][_0xe812('0x46')](_0xe812('0x47'))){_0x4d07af[_0xe812('0x2f')]=qs[_0xe812('0x2f')](_0xa26543[_0xe812('0x40')][_0xe812('0x2f')]);_0x4d07af['offset']=qs[_0xe812('0x2e')](_0xa26543[_0xe812('0x40')][_0xe812('0x2e')]);}_0x4d07af[_0xe812('0x48')]=qs[_0xe812('0x49')](_0xa26543['query'][_0xe812('0x49')]);_0x4d07af['where']=qs[_0xe812('0x42')](_[_0xe812('0x4a')](_0xa26543[_0xe812('0x40')],_0x43ab85['filters']));if(_0xa26543[_0xe812('0x40')][_0xe812('0x4b')]){_0x4d07af['where']=_[_0xe812('0x4c')](_0x4d07af[_0xe812('0x4d')],{'$or':_['map'](_0x4c1088,function(_0x2630d9){if(_0x2630d9['type']!==_0xe812('0x4e')){var _0x33d3a6={};_0x33d3a6[_0x2630d9[_0xe812('0x38')]]={'$like':'%'+_0xa26543['query'][_0xe812('0x4b')]+'%'};return _0x33d3a6;}})});}_0x4d07af=_[_0xe812('0x4c')]({},_0x4d07af,_0xa26543['options']);var _0x77e5b4={'where':_0x4d07af['where']};return db['VtigerConfiguration'][_0xe812('0x2d')](_0x77e5b4)[_0xe812('0x35')](function(_0x5df898){_0x5e0a40[_0xe812('0x2d')]=_0x5df898;if(_0xa26543[_0xe812('0x40')][_0xe812('0x4f')]){_0x4d07af[_0xe812('0x50')]=[{'all':!![]}];}return db[_0xe812('0x3a')]['findAll'](_0x4d07af);})[_0xe812('0x35')](function(_0x136be8){_0x5e0a40[_0xe812('0x51')]=_0x136be8;return _0x5e0a40;})['then'](respondWithFilteredResult(_0x17df63,_0x4d07af))['catch'](handleError(_0x17df63,null));};exports[_0xe812('0x52')]=function(_0x5dc2c7,_0x36f18b){var _0x4787ba={'raw':![],'where':{'id':_0x5dc2c7[_0xe812('0x53')]['id']}},_0x52bc6e={};_0x52bc6e[_0xe812('0x3f')]=_[_0xe812('0x41')](db['VtigerConfiguration'][_0xe812('0x3b')]);_0x52bc6e[_0xe812('0x40')]=_[_0xe812('0x41')](_0x5dc2c7[_0xe812('0x40')]);_0x52bc6e[_0xe812('0x42')]=_[_0xe812('0x43')](_0x52bc6e[_0xe812('0x3f')],_0x52bc6e[_0xe812('0x40')]);_0x4787ba[_0xe812('0x44')]=_[_0xe812('0x43')](_0x52bc6e[_0xe812('0x3f')],qs[_0xe812('0x45')](_0x5dc2c7[_0xe812('0x40')]['fields']));_0x4787ba['attributes']=_0x4787ba[_0xe812('0x44')][_0xe812('0x54')]?_0x4787ba[_0xe812('0x44')]:_0x52bc6e[_0xe812('0x3f')];if(_0x5dc2c7[_0xe812('0x40')][_0xe812('0x4f')]){_0x4787ba[_0xe812('0x50')]=[{'all':!![]}];}_0x4787ba=_[_0xe812('0x4c')]({},_0x4787ba,_0x5dc2c7[_0xe812('0x55')]);return db[_0xe812('0x3a')][_0xe812('0x56')](_0x4787ba)[_0xe812('0x35')](handleEntityNotFound(_0x36f18b,null))[_0xe812('0x35')](respondWithResult(_0x36f18b,null))['catch'](handleError(_0x36f18b,null));};exports[_0xe812('0x57')]=function(_0x2e9692,_0x21d275){return db[_0xe812('0x3a')][_0xe812('0x57')](_0x2e9692[_0xe812('0x58')],{})['then'](respondWithResult(_0x21d275,0xc9))['catch'](handleError(_0x21d275,null));};exports[_0xe812('0x59')]=function(_0x14688c,_0x1c1642){if(_0x14688c[_0xe812('0x58')]['id']){delete _0x14688c[_0xe812('0x58')]['id'];}return db[_0xe812('0x3a')][_0xe812('0x56')]({'where':{'id':_0x14688c['params']['id']}})['then'](handleEntityNotFound(_0x1c1642,null))[_0xe812('0x35')](saveUpdates(_0x14688c[_0xe812('0x58')],null))[_0xe812('0x35')](respondWithResult(_0x1c1642,null))[_0xe812('0x29')](handleError(_0x1c1642,null));};exports[_0xe812('0x36')]=function(_0x416eb7,_0xac1b0d){return db[_0xe812('0x3a')][_0xe812('0x56')]({'where':{'id':_0x416eb7[_0xe812('0x53')]['id']}})['then'](handleEntityNotFound(_0xac1b0d,null))[_0xe812('0x35')](removeEntity(_0xac1b0d,null))['catch'](handleError(_0xac1b0d,null));};exports['getFields']=function(_0x1edf14,_0x120843,_0x123d41){var _0xc78c02={};var _0x32d6fc={};var _0x519bb2;var _0x3f640d;return db[_0xe812('0x3a')][_0xe812('0x5a')]({'where':{'id':_0x1edf14[_0xe812('0x53')]['id']}})['then'](handleEntityNotFound(_0x120843,null))[_0xe812('0x35')](function(_0x12d850){if(_0x12d850){_0x519bb2=_0x12d850;_0x32d6fc[_0xe812('0x3f')]=_['keys'](db[_0xe812('0x5b')]['rawAttributes']);_0x32d6fc[_0xe812('0x40')]=_[_0xe812('0x41')](_0x1edf14[_0xe812('0x40')]);_0x32d6fc['filters']=_[_0xe812('0x43')](_0x32d6fc['model'],_0x32d6fc[_0xe812('0x40')]);_0xc78c02[_0xe812('0x44')]=_[_0xe812('0x43')](_0x32d6fc[_0xe812('0x3f')],qs[_0xe812('0x45')](_0x1edf14['query'][_0xe812('0x45')]));_0xc78c02['attributes']=_0xc78c02['attributes'][_0xe812('0x54')]?_0xc78c02['attributes']:_0x32d6fc[_0xe812('0x3f')];_0xc78c02[_0xe812('0x48')]=qs[_0xe812('0x49')](_0x1edf14[_0xe812('0x40')][_0xe812('0x49')]);_0xc78c02[_0xe812('0x4d')]=qs['filters'](_['pick'](_0x1edf14['query'],_0x32d6fc[_0xe812('0x42')]));if(_0x1edf14[_0xe812('0x40')]['filter']){_0xc78c02[_0xe812('0x4d')]=_['merge'](_0xc78c02[_0xe812('0x4d')],{'$or':_[_0xe812('0x5c')](_0xc78c02['attributes'],function(_0x148ebb){var _0x4dee75={};_0x4dee75[_0x148ebb]={'$like':'%'+_0x1edf14[_0xe812('0x40')][_0xe812('0x4b')]+'%'};return _0x4dee75;})});}_0xc78c02=_[_0xe812('0x4c')]({},_0xc78c02,_0x1edf14[_0xe812('0x55')]);return _0x519bb2[_0xe812('0x5d')](_0xc78c02);}})[_0xe812('0x35')](function(_0x3eabc2){if(_0x3eabc2){_0x3f640d=_0x3eabc2[_0xe812('0x54')];if(!_0x1edf14[_0xe812('0x40')][_0xe812('0x46')](_0xe812('0x47'))){_0xc78c02[_0xe812('0x2f')]=qs[_0xe812('0x2f')](_0x1edf14[_0xe812('0x40')][_0xe812('0x2f')]);_0xc78c02[_0xe812('0x2e')]=qs['offset'](_0x1edf14[_0xe812('0x40')]['offset']);}return _0x519bb2[_0xe812('0x5d')](_0xc78c02);}})[_0xe812('0x35')](function(_0x5bc6a0){if(_0x5bc6a0){return _0x5bc6a0?{'count':_0x3f640d,'rows':_0x5bc6a0}:null;}})[_0xe812('0x35')](respondWithResult(_0x120843,null))['catch'](handleError(_0x120843,null));};exports['getSubjects']=function(_0xe8d686,_0x4f3954,_0x1a4b92){var _0x1b3038={};var _0x4ad7eb={};var _0x5ae6b4;var _0x51f254;return db[_0xe812('0x3a')][_0xe812('0x5a')]({'where':{'id':_0xe8d686[_0xe812('0x53')]['id']}})[_0xe812('0x35')](handleEntityNotFound(_0x4f3954,null))[_0xe812('0x35')](function(_0x40e692){if(_0x40e692){_0x5ae6b4=_0x40e692;_0x4ad7eb[_0xe812('0x3f')]=_[_0xe812('0x41')](db[_0xe812('0x5b')][_0xe812('0x3b')]);_0x4ad7eb[_0xe812('0x40')]=_[_0xe812('0x41')](_0xe8d686[_0xe812('0x40')]);_0x4ad7eb[_0xe812('0x42')]=_[_0xe812('0x43')](_0x4ad7eb[_0xe812('0x3f')],_0x4ad7eb[_0xe812('0x40')]);_0x1b3038[_0xe812('0x44')]=_['intersection'](_0x4ad7eb[_0xe812('0x3f')],qs[_0xe812('0x45')](_0xe8d686[_0xe812('0x40')][_0xe812('0x45')]));_0x1b3038[_0xe812('0x44')]=_0x1b3038[_0xe812('0x44')][_0xe812('0x54')]?_0x1b3038[_0xe812('0x44')]:_0x4ad7eb[_0xe812('0x3f')];_0x1b3038['order']=qs[_0xe812('0x49')](_0xe8d686[_0xe812('0x40')][_0xe812('0x49')]);_0x1b3038['where']=qs['filters'](_[_0xe812('0x4a')](_0xe8d686[_0xe812('0x40')],_0x4ad7eb['filters']));if(_0xe8d686[_0xe812('0x40')][_0xe812('0x4b')]){_0x1b3038['where']=_[_0xe812('0x4c')](_0x1b3038['where'],{'$or':_['map'](_0x1b3038['attributes'],function(_0x3b18e1){var _0x3c636d={};_0x3c636d[_0x3b18e1]={'$like':'%'+_0xe8d686[_0xe812('0x40')][_0xe812('0x4b')]+'%'};return _0x3c636d;})});}_0x1b3038=_[_0xe812('0x4c')]({},_0x1b3038,_0xe8d686[_0xe812('0x55')]);return _0x5ae6b4[_0xe812('0x5e')](_0x1b3038);}})[_0xe812('0x35')](function(_0x2b2ca1){if(_0x2b2ca1){_0x51f254=_0x2b2ca1['length'];if(!_0xe8d686[_0xe812('0x40')][_0xe812('0x46')](_0xe812('0x47'))){_0x1b3038['limit']=qs[_0xe812('0x2f')](_0xe8d686['query'][_0xe812('0x2f')]);_0x1b3038[_0xe812('0x2e')]=qs[_0xe812('0x2e')](_0xe8d686[_0xe812('0x40')]['offset']);}return _0x5ae6b4[_0xe812('0x5e')](_0x1b3038);}})[_0xe812('0x35')](function(_0x3e16e9){if(_0x3e16e9){return _0x3e16e9?{'count':_0x51f254,'rows':_0x3e16e9}:null;}})[_0xe812('0x35')](respondWithResult(_0x4f3954,null))[_0xe812('0x29')](handleError(_0x4f3954,null));};exports['getDescriptions']=function(_0x5d1f3b,_0x47b33f,_0x34425c){var _0x4a33ba={};var _0x36cd66={};var _0x9f2b5f;var _0x33eaaf;return db[_0xe812('0x3a')][_0xe812('0x5a')]({'where':{'id':_0x5d1f3b[_0xe812('0x53')]['id']}})[_0xe812('0x35')](handleEntityNotFound(_0x47b33f,null))[_0xe812('0x35')](function(_0x311e4e){if(_0x311e4e){_0x9f2b5f=_0x311e4e;_0x36cd66['model']=_[_0xe812('0x41')](db[_0xe812('0x5b')][_0xe812('0x3b')]);_0x36cd66['query']=_[_0xe812('0x41')](_0x5d1f3b['query']);_0x36cd66[_0xe812('0x42')]=_[_0xe812('0x43')](_0x36cd66[_0xe812('0x3f')],_0x36cd66[_0xe812('0x40')]);_0x4a33ba[_0xe812('0x44')]=_[_0xe812('0x43')](_0x36cd66['model'],qs[_0xe812('0x45')](_0x5d1f3b[_0xe812('0x40')][_0xe812('0x45')]));_0x4a33ba[_0xe812('0x44')]=_0x4a33ba[_0xe812('0x44')]['length']?_0x4a33ba['attributes']:_0x36cd66[_0xe812('0x3f')];_0x4a33ba[_0xe812('0x48')]=qs['sort'](_0x5d1f3b['query']['sort']);_0x4a33ba['where']=qs['filters'](_[_0xe812('0x4a')](_0x5d1f3b[_0xe812('0x40')],_0x36cd66[_0xe812('0x42')]));if(_0x5d1f3b[_0xe812('0x40')][_0xe812('0x4b')]){_0x4a33ba[_0xe812('0x4d')]=_[_0xe812('0x4c')](_0x4a33ba['where'],{'$or':_['map'](_0x4a33ba[_0xe812('0x44')],function(_0x4c868d){var _0x3ca04b={};_0x3ca04b[_0x4c868d]={'$like':'%'+_0x5d1f3b['query']['filter']+'%'};return _0x3ca04b;})});}_0x4a33ba=_['merge']({},_0x4a33ba,_0x5d1f3b['options']);return _0x9f2b5f['getDescriptions'](_0x4a33ba);}})[_0xe812('0x35')](function(_0x146556){if(_0x146556){_0x33eaaf=_0x146556[_0xe812('0x54')];if(!_0x5d1f3b[_0xe812('0x40')][_0xe812('0x46')](_0xe812('0x47'))){_0x4a33ba[_0xe812('0x2f')]=qs[_0xe812('0x2f')](_0x5d1f3b[_0xe812('0x40')][_0xe812('0x2f')]);_0x4a33ba['offset']=qs[_0xe812('0x2e')](_0x5d1f3b[_0xe812('0x40')]['offset']);}return _0x9f2b5f['getDescriptions'](_0x4a33ba);}})[_0xe812('0x35')](function(_0x38a5cc){if(_0x38a5cc){return _0x38a5cc?{'count':_0x33eaaf,'rows':_0x38a5cc}:null;}})['then'](respondWithResult(_0x47b33f,null))[_0xe812('0x29')](handleError(_0x47b33f,null));}; \ No newline at end of file diff --git a/server/api/intVtigerConfiguration/intVtigerConfiguration.model.js b/server/api/intVtigerConfiguration/intVtigerConfiguration.model.js index 99c0fe2..66faeba 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 _0x92af=['define','VtigerConfiguration','int_vtiger_configurations','lodash','util','../../config/logger','api','moment','request-promise','path','../../config/environment','./intVtigerConfiguration.attributes','exports'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x92af,0x1e4));var _0xf92a=function(_0x412f24,_0x3aa90a){_0x412f24=_0x412f24-0x0;var _0x5a0244=_0x92af[_0x412f24];return _0x5a0244;};'use strict';var _=require(_0xf92a('0x0'));var util=require(_0xf92a('0x1'));var logger=require(_0xf92a('0x2'))(_0xf92a('0x3'));var moment=require(_0xf92a('0x4'));var BPromise=require('bluebird');var rp=require(_0xf92a('0x5'));var fs=require('fs');var path=require(_0xf92a('0x6'));var rimraf=require('rimraf');var config=require(_0xf92a('0x7'));var attributes=require(_0xf92a('0x8'));module[_0xf92a('0x9')]=function(_0x44eefa,_0x4a6291){return _0x44eefa[_0xf92a('0xa')](_0xf92a('0xb'),attributes,{'tableName':_0xf92a('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x0e3b=['moment','bluebird','request-promise','path','../../config/environment','define','int_vtiger_configurations','lodash','util','../../config/logger','api'];(function(_0x227d16,_0x3a4f7a){var _0x1e7ce3=function(_0x57cae8){while(--_0x57cae8){_0x227d16['push'](_0x227d16['shift']());}};_0x1e7ce3(++_0x3a4f7a);}(_0x0e3b,0xac));var _0xb0e3=function(_0x3fd345,_0x4e4115){_0x3fd345=_0x3fd345-0x0;var _0x482306=_0x0e3b[_0x3fd345];return _0x482306;};'use strict';var _=require(_0xb0e3('0x0'));var util=require(_0xb0e3('0x1'));var logger=require(_0xb0e3('0x2'))(_0xb0e3('0x3'));var moment=require(_0xb0e3('0x4'));var BPromise=require(_0xb0e3('0x5'));var rp=require(_0xb0e3('0x6'));var fs=require('fs');var path=require(_0xb0e3('0x7'));var rimraf=require('rimraf');var config=require(_0xb0e3('0x8'));var attributes=require('./intVtigerConfiguration.attributes');module['exports']=function(_0x5525f6,_0x29ac94){return _0x5525f6[_0xb0e3('0x9')]('VtigerConfiguration',attributes,{'tableName':_0xb0e3('0xa'),'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 aba0ceb..ddaf45c 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 _0xb9ab=['catch','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','then','info','request\x20sent','debug','VtigerConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','message','VtigerConfiguration,\x20%s,\x20%s'];(function(_0x4ed303,_0x48ae86){var _0x1eedcf=function(_0x1642d4){while(--_0x1642d4){_0x4ed303['push'](_0x4ed303['shift']());}};_0x1eedcf(++_0x48ae86);}(_0xb9ab,0x1cf));var _0xbb9a=function(_0x15e831,_0x138c2d){_0x15e831=_0x15e831-0x0;var _0x30ad30=_0xb9ab[_0x15e831];return _0x30ad30;};'use strict';var _=require('lodash');var util=require(_0xbb9a('0x0'));var moment=require('moment');var BPromise=require(_0xbb9a('0x1'));var rs=require(_0xbb9a('0x2'));var fs=require('fs');var Redis=require(_0xbb9a('0x3'));var db=require(_0xbb9a('0x4'))['db'];var utils=require(_0xbb9a('0x5'));var logger=require(_0xbb9a('0x6'))(_0xbb9a('0x7'));var config=require(_0xbb9a('0x8'));var jayson=require(_0xbb9a('0x9'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x469d5a,_0x270957,_0x2438ba){return new BPromise(function(_0x3a6e43,_0x2edfc7){return client['request'](_0x469d5a,_0x2438ba)[_0xbb9a('0xa')](function(_0x544d7b){logger[_0xbb9a('0xb')]('VtigerConfiguration,\x20%s,\x20%s',_0x270957,_0xbb9a('0xc'));logger[_0xbb9a('0xd')](_0xbb9a('0xe'),_0x270957,_0xbb9a('0xc'),JSON[_0xbb9a('0xf')](_0x544d7b));if(_0x544d7b['error']){if(_0x544d7b[_0xbb9a('0x10')][_0xbb9a('0x11')]===0x1f4){logger[_0xbb9a('0x10')]('VtigerConfiguration,\x20%s,\x20%s',_0x270957,_0x544d7b[_0xbb9a('0x10')][_0xbb9a('0x12')]);return _0x2edfc7(_0x544d7b['error'][_0xbb9a('0x12')]);}logger['error'](_0xbb9a('0x13'),_0x270957,_0x544d7b[_0xbb9a('0x10')][_0xbb9a('0x12')]);return _0x3a6e43(_0x544d7b[_0xbb9a('0x10')][_0xbb9a('0x12')]);}else{logger['info'](_0xbb9a('0x13'),_0x270957,_0xbb9a('0xc'));_0x3a6e43(_0x544d7b['result'][_0xbb9a('0x12')]);}})[_0xbb9a('0x14')](function(_0x585d8d){logger[_0xbb9a('0x10')]('VtigerConfiguration,\x20%s,\x20%s',_0x270957,_0x585d8d);_0x2edfc7(_0x585d8d);});});} \ No newline at end of file +var _0x48f9=['info','VtigerConfiguration,\x20%s,\x20%s','request\x20sent','debug','code','error','message','result','catch','moment','bluebird','randomstring','ioredis','../../config/utils','rpc','jayson/promise','client','request','then'];(function(_0x8007f2,_0x305cd0){var _0x158056=function(_0x42649d){while(--_0x42649d){_0x8007f2['push'](_0x8007f2['shift']());}};_0x158056(++_0x305cd0);}(_0x48f9,0x15f));var _0x948f=function(_0x2062d9,_0x350947){_0x2062d9=_0x2062d9-0x0;var _0x259ae9=_0x48f9[_0x2062d9];return _0x259ae9;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x948f('0x0'));var BPromise=require(_0x948f('0x1'));var rs=require(_0x948f('0x2'));var fs=require('fs');var Redis=require(_0x948f('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x948f('0x4'));var logger=require('../../config/logger')(_0x948f('0x5'));var config=require('../../config/environment');var jayson=require(_0x948f('0x6'));var client=jayson[_0x948f('0x7')]['http']({'port':0x232a});function respondWithRpcPromise(_0x4d3ed9,_0x3b197b,_0x305fcb){return new BPromise(function(_0x2646fa,_0x28d328){return client[_0x948f('0x8')](_0x4d3ed9,_0x305fcb)[_0x948f('0x9')](function(_0x4f5f59){logger[_0x948f('0xa')](_0x948f('0xb'),_0x3b197b,_0x948f('0xc'));logger[_0x948f('0xd')]('VtigerConfiguration,\x20%s,\x20%s,\x20%s',_0x3b197b,'request\x20sent',JSON['stringify'](_0x4f5f59));if(_0x4f5f59['error']){if(_0x4f5f59['error'][_0x948f('0xe')]===0x1f4){logger[_0x948f('0xf')](_0x948f('0xb'),_0x3b197b,_0x4f5f59[_0x948f('0xf')]['message']);return _0x28d328(_0x4f5f59[_0x948f('0xf')][_0x948f('0x10')]);}logger['error'](_0x948f('0xb'),_0x3b197b,_0x4f5f59['error'][_0x948f('0x10')]);return _0x2646fa(_0x4f5f59[_0x948f('0xf')][_0x948f('0x10')]);}else{logger[_0x948f('0xa')](_0x948f('0xb'),_0x3b197b,_0x948f('0xc'));_0x2646fa(_0x4f5f59[_0x948f('0x11')][_0x948f('0x10')]);}})[_0x948f('0x12')](function(_0x43799d){logger[_0x948f('0xf')](_0x948f('0xb'),_0x3b197b,_0x43799d);_0x28d328(_0x43799d);});});} \ No newline at end of file diff --git a/server/api/intVtigerField/index.js b/server/api/intVtigerField/index.js index f0c4e21..11ad438 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 _0x6944=['express','Router','../../components/auth/service','../../config/environment','get','isAuthenticated','index','show','post','create','put','update','delete','/:id','destroy','exports','util','path','connect-timeout'];(function(_0xc4001c,_0x1bf8f0){var _0x49f7bc=function(_0x1059b8){while(--_0x1059b8){_0xc4001c['push'](_0xc4001c['shift']());}};_0x49f7bc(++_0x1bf8f0);}(_0x6944,0x82));var _0x4694=function(_0x5951a7,_0x24e83f){_0x5951a7=_0x5951a7-0x0;var _0x593dcf=_0x6944[_0x5951a7];return _0x593dcf;};'use strict';var multer=require('multer');var util=require(_0x4694('0x0'));var path=require(_0x4694('0x1'));var timeout=require(_0x4694('0x2'));var express=require(_0x4694('0x3'));var router=express[_0x4694('0x4')]();var auth=require(_0x4694('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x4694('0x6'));var controller=require('./intVtigerField.controller');router[_0x4694('0x7')]('/',auth[_0x4694('0x8')](),controller[_0x4694('0x9')]);router[_0x4694('0x7')]('/:id',auth['isAuthenticated'](),controller[_0x4694('0xa')]);router[_0x4694('0xb')]('/',auth[_0x4694('0x8')](),controller[_0x4694('0xc')]);router[_0x4694('0xd')]('/:id',auth[_0x4694('0x8')](),controller[_0x4694('0xe')]);router[_0x4694('0xf')](_0x4694('0x10'),auth['isAuthenticated'](),controller[_0x4694('0x11')]);module[_0x4694('0x12')]=router; \ No newline at end of file +var _0x82f4=['express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/:id','show','create','put','delete','destroy','exports','multer','util','connect-timeout'];(function(_0x3248e8,_0x57b9ae){var _0x1a1373=function(_0x18e476){while(--_0x18e476){_0x3248e8['push'](_0x3248e8['shift']());}};_0x1a1373(++_0x57b9ae);}(_0x82f4,0x1bf));var _0x482f=function(_0x6c343b,_0x34abbd){_0x6c343b=_0x6c343b-0x0;var _0x367cab=_0x82f4[_0x6c343b];return _0x367cab;};'use strict';var multer=require(_0x482f('0x0'));var util=require(_0x482f('0x1'));var path=require('path');var timeout=require(_0x482f('0x2'));var express=require(_0x482f('0x3'));var router=express[_0x482f('0x4')]();var auth=require(_0x482f('0x5'));var interaction=require(_0x482f('0x6'));var config=require(_0x482f('0x7'));var controller=require('./intVtigerField.controller');router[_0x482f('0x8')]('/',auth[_0x482f('0x9')](),controller[_0x482f('0xa')]);router['get'](_0x482f('0xb'),auth[_0x482f('0x9')](),controller[_0x482f('0xc')]);router['post']('/',auth[_0x482f('0x9')](),controller[_0x482f('0xd')]);router[_0x482f('0xe')](_0x482f('0xb'),auth['isAuthenticated'](),controller['update']);router[_0x482f('0xf')]('/:id',auth[_0x482f('0x9')](),controller[_0x482f('0x10')]);module[_0x482f('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 e911cf1..fab0f3a 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 _0x737d=['exports','keyValue','STRING','ENUM','string','variable','customVariable','BOOLEAN','sequelize'];(function(_0x2514f6,_0xec77b7){var _0x2e6f20=function(_0x3a363f){while(--_0x3a363f){_0x2514f6['push'](_0x2514f6['shift']());}};_0x2e6f20(++_0xec77b7);}(_0x737d,0xbc));var _0xd737=function(_0x16ffe5,_0x4fe048){_0x16ffe5=_0x16ffe5-0x0;var _0x4022f7=_0x737d[_0x16ffe5];return _0x4022f7;};'use strict';var Sequelize=require(_0xd737('0x0'));module[_0xd737('0x1')]={'type':{'type':Sequelize['ENUM']('string','variable','customVariable',_0xd737('0x2')),'defaultValue':'string'},'content':{'type':Sequelize[_0xd737('0x3')]},'key':{'type':Sequelize['STRING']},'keyType':{'type':Sequelize[_0xd737('0x4')](_0xd737('0x5'),_0xd737('0x6'),_0xd737('0x7'))},'keyContent':{'type':Sequelize[_0xd737('0x3')]},'idField':{'type':Sequelize[_0xd737('0x3')]},'nameField':{'type':Sequelize[_0xd737('0x3')]},'customField':{'type':Sequelize[_0xd737('0x8')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0xd737('0x3')]}}; \ No newline at end of file +var _0x43e7=['keyValue','STRING','variable','sequelize','ENUM'];(function(_0x618414,_0x1a7a60){var _0x21c19a=function(_0x507b17){while(--_0x507b17){_0x618414['push'](_0x618414['shift']());}};_0x21c19a(++_0x1a7a60);}(_0x43e7,0xda));var _0x743e=function(_0x136a0d,_0x476fe2){_0x136a0d=_0x136a0d-0x0;var _0x212ea5=_0x43e7[_0x136a0d];return _0x212ea5;};'use strict';var Sequelize=require(_0x743e('0x0'));module['exports']={'type':{'type':Sequelize[_0x743e('0x1')]('string','variable','customVariable',_0x743e('0x2')),'defaultValue':'string'},'content':{'type':Sequelize[_0x743e('0x3')]},'key':{'type':Sequelize[_0x743e('0x3')]},'keyType':{'type':Sequelize['ENUM']('string',_0x743e('0x4'),'customVariable')},'keyContent':{'type':Sequelize[_0x743e('0x3')]},'idField':{'type':Sequelize['STRING']},'nameField':{'type':Sequelize['STRING']},'customField':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'variableName':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/intVtigerField/intVtigerField.controller.js b/server/api/intVtigerField/intVtigerField.controller.js index 6fec06b..3d5edbe 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 _0x368f=['moment','bluebird','mustache','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../mysqldb','sendStatus','status','end','count','offset','limit','set','Content-Range','json','apply','reject','save','then','destroy','error','stack','name','rawAttributes','fieldName','model','map','query','keys','intersection','attributes','fields','hasOwnProperty','order','sort','where','filters','pick','filter','type','VIRTUAL','merge','options','VtigerField','findAll','rows','catch','show','params','includeAll','include','find','body','html-pdf','rimraf','zip-dir','request-promise'];(function(_0x35af23,_0x9190f6){var _0x340506=function(_0xd4c26b){while(--_0xd4c26b){_0x35af23['push'](_0x35af23['shift']());}};_0x340506(++_0x9190f6);}(_0x368f,0x1ed));var _0xf368=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x368f[_0x3dd15e];return _0x231fd0;};'use strict';var pdf=require(_0xf368('0x0'));var emlformat=require('eml-format');var rimraf=require(_0xf368('0x1'));var zipdir=require(_0xf368('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xf368('0x3'));var moment=require(_0xf368('0x4'));var BPromise=require(_0xf368('0x5'));var Mustache=require(_0xf368('0x6'));var util=require('util');var path=require('path');var sox=require(_0xf368('0x7'));var csv=require(_0xf368('0x8'));var ejs=require(_0xf368('0x9'));var fs=require('fs');var _=require(_0xf368('0xa'));var squel=require(_0xf368('0xb'));var crypto=require(_0xf368('0xc'));var jsforce=require(_0xf368('0xd'));var deskjs=require(_0xf368('0xe'));var toCsv=require(_0xf368('0x8'));var querystring=require('querystring');var Papa=require(_0xf368('0xf'));var Redis=require(_0xf368('0x10'));var authService=require(_0xf368('0x11'));var qs=require(_0xf368('0x12'));var as=require(_0xf368('0x13'));var hardwareService=require(_0xf368('0x14'));var logger=require(_0xf368('0x15'))('api');var utils=require(_0xf368('0x16'));var config=require('../../config/environment');var db=require(_0xf368('0x17'))['db'];function respondWithStatusCode(_0x27da9b,_0x42477b){_0x42477b=_0x42477b||0xcc;return function(_0x317eb6){if(_0x317eb6){return _0x27da9b[_0xf368('0x18')](_0x42477b);}return _0x27da9b[_0xf368('0x19')](_0x42477b)[_0xf368('0x1a')]();};}function respondWithResult(_0x18c8ed,_0x201184){_0x201184=_0x201184||0xc8;return function(_0x39fa3f){if(_0x39fa3f){return _0x18c8ed['status'](_0x201184)['json'](_0x39fa3f);}};}function respondWithFilteredResult(_0x208b74,_0x16b34a){return function(_0x5792d9){if(_0x5792d9){var _0xbf8ee7=_0x5792d9[_0xf368('0x1b')],_0x584ea0=_0x16b34a['offset'],_0x501eaa=_0x16b34a[_0xf368('0x1c')]+_0x16b34a[_0xf368('0x1d')],_0x16de43;if(_0x501eaa>=_0xbf8ee7){_0x501eaa=_0xbf8ee7;_0x16de43=0xc8;}else{_0x16de43=0xce;}_0x208b74[_0xf368('0x19')](_0x16de43);return _0x208b74[_0xf368('0x1e')](_0xf368('0x1f'),_0x584ea0+'-'+_0x501eaa+'/'+_0xbf8ee7)[_0xf368('0x20')](_0x5792d9);}return null;};}function patchUpdates(_0xdfa34){return function(_0x42ffed){try{jsonpatch[_0xf368('0x21')](_0x42ffed,_0xdfa34,!![]);}catch(_0x387e3e){return BPromise[_0xf368('0x22')](_0x387e3e);}return _0x42ffed[_0xf368('0x23')]();};}function saveUpdates(_0x4baef0,_0x38ee25){return function(_0x1aaed2){if(_0x1aaed2){return _0x1aaed2['update'](_0x4baef0)[_0xf368('0x24')](function(_0x4074d0){return _0x4074d0;});}return null;};}function removeEntity(_0x340ce7,_0x187816){return function(_0x3c70c7){if(_0x3c70c7){return _0x3c70c7[_0xf368('0x25')]()[_0xf368('0x24')](function(){_0x340ce7[_0xf368('0x19')](0xcc)[_0xf368('0x1a')]();});}};}function handleEntityNotFound(_0x56ae59,_0x446bf1){return function(_0x15d2d8){if(!_0x15d2d8){_0x56ae59[_0xf368('0x18')](0x194);}return _0x15d2d8;};}function handleError(_0x3df7fa,_0x4cd66f){_0x4cd66f=_0x4cd66f||0x1f4;return function(_0x1340f6){logger[_0xf368('0x26')](_0x1340f6[_0xf368('0x27')]);if(_0x1340f6[_0xf368('0x28')]){delete _0x1340f6[_0xf368('0x28')];}_0x3df7fa[_0xf368('0x19')](_0x4cd66f)['send'](_0x1340f6);};}exports['index']=function(_0x2b83fd,_0x47f07e){var _0x3861e9={},_0x532491={},_0x43f6c6={'count':0x0,'rows':[]};var _0xbcc574=_['map'](db['VtigerField'][_0xf368('0x29')],function(_0x364510){return{'name':_0x364510[_0xf368('0x2a')],'type':_0x364510['type']['key']};});_0x532491[_0xf368('0x2b')]=_[_0xf368('0x2c')](_0xbcc574,'name');_0x532491[_0xf368('0x2d')]=_[_0xf368('0x2e')](_0x2b83fd[_0xf368('0x2d')]);_0x532491['filters']=_[_0xf368('0x2f')](_0x532491[_0xf368('0x2b')],_0x532491[_0xf368('0x2d')]);_0x3861e9[_0xf368('0x30')]=_[_0xf368('0x2f')](_0x532491[_0xf368('0x2b')],qs[_0xf368('0x31')](_0x2b83fd[_0xf368('0x2d')][_0xf368('0x31')]));_0x3861e9[_0xf368('0x30')]=_0x3861e9['attributes']['length']?_0x3861e9[_0xf368('0x30')]:_0x532491['model'];if(!_0x2b83fd[_0xf368('0x2d')][_0xf368('0x32')]('nolimit')){_0x3861e9[_0xf368('0x1d')]=qs[_0xf368('0x1d')](_0x2b83fd[_0xf368('0x2d')][_0xf368('0x1d')]);_0x3861e9[_0xf368('0x1c')]=qs[_0xf368('0x1c')](_0x2b83fd[_0xf368('0x2d')]['offset']);}_0x3861e9[_0xf368('0x33')]=qs[_0xf368('0x34')](_0x2b83fd['query'][_0xf368('0x34')]);_0x3861e9[_0xf368('0x35')]=qs[_0xf368('0x36')](_[_0xf368('0x37')](_0x2b83fd['query'],_0x532491['filters']));if(_0x2b83fd[_0xf368('0x2d')][_0xf368('0x38')]){_0x3861e9[_0xf368('0x35')]=_['merge'](_0x3861e9[_0xf368('0x35')],{'$or':_[_0xf368('0x2c')](_0xbcc574,function(_0x486ed4){if(_0x486ed4[_0xf368('0x39')]!==_0xf368('0x3a')){var _0x533eed={};_0x533eed[_0x486ed4[_0xf368('0x28')]]={'$like':'%'+_0x2b83fd[_0xf368('0x2d')][_0xf368('0x38')]+'%'};return _0x533eed;}})});}_0x3861e9=_[_0xf368('0x3b')]({},_0x3861e9,_0x2b83fd[_0xf368('0x3c')]);var _0x2625b0={'where':_0x3861e9['where']};return db[_0xf368('0x3d')][_0xf368('0x1b')](_0x2625b0)['then'](function(_0x215acb){_0x43f6c6[_0xf368('0x1b')]=_0x215acb;if(_0x2b83fd['query']['includeAll']){_0x3861e9['include']=[{'all':!![]}];}return db['VtigerField'][_0xf368('0x3e')](_0x3861e9);})[_0xf368('0x24')](function(_0x189fa9){_0x43f6c6[_0xf368('0x3f')]=_0x189fa9;return _0x43f6c6;})[_0xf368('0x24')](respondWithFilteredResult(_0x47f07e,_0x3861e9))[_0xf368('0x40')](handleError(_0x47f07e,null));};exports[_0xf368('0x41')]=function(_0x49d0af,_0x1c1aae){var _0x412daf={'raw':!![],'where':{'id':_0x49d0af[_0xf368('0x42')]['id']}},_0x270cc8={};_0x270cc8[_0xf368('0x2b')]=_[_0xf368('0x2e')](db[_0xf368('0x3d')][_0xf368('0x29')]);_0x270cc8[_0xf368('0x2d')]=_[_0xf368('0x2e')](_0x49d0af[_0xf368('0x2d')]);_0x270cc8['filters']=_[_0xf368('0x2f')](_0x270cc8[_0xf368('0x2b')],_0x270cc8[_0xf368('0x2d')]);_0x412daf[_0xf368('0x30')]=_[_0xf368('0x2f')](_0x270cc8[_0xf368('0x2b')],qs[_0xf368('0x31')](_0x49d0af['query'][_0xf368('0x31')]));_0x412daf[_0xf368('0x30')]=_0x412daf[_0xf368('0x30')]['length']?_0x412daf['attributes']:_0x270cc8['model'];if(_0x49d0af[_0xf368('0x2d')][_0xf368('0x43')]){_0x412daf[_0xf368('0x44')]=[{'all':!![]}];}_0x412daf=_['merge']({},_0x412daf,_0x49d0af[_0xf368('0x3c')]);return db[_0xf368('0x3d')][_0xf368('0x45')](_0x412daf)[_0xf368('0x24')](handleEntityNotFound(_0x1c1aae,null))[_0xf368('0x24')](respondWithResult(_0x1c1aae,null))[_0xf368('0x40')](handleError(_0x1c1aae,null));};exports['create']=function(_0x235f3a,_0x2036bf){return db[_0xf368('0x3d')]['create'](_0x235f3a[_0xf368('0x46')],{})[_0xf368('0x24')](respondWithResult(_0x2036bf,0xc9))['catch'](handleError(_0x2036bf,null));};exports['update']=function(_0x43edc4,_0x35ee71){if(_0x43edc4[_0xf368('0x46')]['id']){delete _0x43edc4[_0xf368('0x46')]['id'];}return db[_0xf368('0x3d')][_0xf368('0x45')]({'where':{'id':_0x43edc4[_0xf368('0x42')]['id']}})[_0xf368('0x24')](handleEntityNotFound(_0x35ee71,null))['then'](saveUpdates(_0x43edc4[_0xf368('0x46')],null))[_0xf368('0x24')](respondWithResult(_0x35ee71,null))[_0xf368('0x40')](handleError(_0x35ee71,null));};exports[_0xf368('0x25')]=function(_0x5d821d,_0x239f3b){return db[_0xf368('0x3d')][_0xf368('0x45')]({'where':{'id':_0x5d821d[_0xf368('0x42')]['id']}})[_0xf368('0x24')](handleEntityNotFound(_0x239f3b,null))[_0xf368('0x24')](removeEntity(_0x239f3b,null))[_0xf368('0x40')](handleError(_0x239f3b,null));}; \ No newline at end of file +var _0x0d89=['key','model','keys','query','filters','intersection','attributes','fields','limit','sort','where','pick','filter','merge','options','VtigerField','rows','show','length','includeAll','include','create','body','params','catch','find','html-pdf','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','sox','lodash','crypto','jsforce','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/environment','../../mysqldb','sendStatus','status','end','json','count','offset','set','reject','save','update','then','destroy','error','name','send','index','map','rawAttributes','fieldName','type'];(function(_0x47cc4d,_0x5c4be5){var _0x460c24=function(_0x4f6ad0){while(--_0x4f6ad0){_0x47cc4d['push'](_0x47cc4d['shift']());}};_0x460c24(++_0x5c4be5);}(_0x0d89,0x9e));var _0x90d8=function(_0x700428,_0x4b8500){_0x700428=_0x700428-0x0;var _0x19bbc4=_0x0d89[_0x700428];return _0x19bbc4;};'use strict';var pdf=require(_0x90d8('0x0'));var emlformat=require('eml-format');var rimraf=require(_0x90d8('0x1'));var zipdir=require(_0x90d8('0x2'));var jsonpatch=require(_0x90d8('0x3'));var rp=require(_0x90d8('0x4'));var moment=require(_0x90d8('0x5'));var BPromise=require(_0x90d8('0x6'));var Mustache=require('mustache');var util=require(_0x90d8('0x7'));var path=require('path');var sox=require(_0x90d8('0x8'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var _=require(_0x90d8('0x9'));var squel=require('squel');var crypto=require(_0x90d8('0xa'));var jsforce=require(_0x90d8('0xb'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x90d8('0xc'));var Redis=require(_0x90d8('0xd'));var authService=require(_0x90d8('0xe'));var qs=require('../../components/parsers/qs');var as=require(_0x90d8('0xf'));var hardwareService=require(_0x90d8('0x10'));var logger=require('../../config/logger')(_0x90d8('0x11'));var utils=require('../../config/utils');var config=require(_0x90d8('0x12'));var db=require(_0x90d8('0x13'))['db'];function respondWithStatusCode(_0x5ba0aa,_0x511493){_0x511493=_0x511493||0xcc;return function(_0xcd881){if(_0xcd881){return _0x5ba0aa[_0x90d8('0x14')](_0x511493);}return _0x5ba0aa[_0x90d8('0x15')](_0x511493)[_0x90d8('0x16')]();};}function respondWithResult(_0x49ea31,_0x926cdd){_0x926cdd=_0x926cdd||0xc8;return function(_0x3fa1f0){if(_0x3fa1f0){return _0x49ea31[_0x90d8('0x15')](_0x926cdd)[_0x90d8('0x17')](_0x3fa1f0);}};}function respondWithFilteredResult(_0x2576bf,_0x237873){return function(_0x418d02){if(_0x418d02){var _0x2b2a68=_0x418d02[_0x90d8('0x18')],_0x23f1ad=_0x237873[_0x90d8('0x19')],_0x4bcd33=_0x237873[_0x90d8('0x19')]+_0x237873['limit'],_0xc6639e;if(_0x4bcd33>=_0x2b2a68){_0x4bcd33=_0x2b2a68;_0xc6639e=0xc8;}else{_0xc6639e=0xce;}_0x2576bf[_0x90d8('0x15')](_0xc6639e);return _0x2576bf[_0x90d8('0x1a')]('Content-Range',_0x23f1ad+'-'+_0x4bcd33+'/'+_0x2b2a68)['json'](_0x418d02);}return null;};}function patchUpdates(_0x1d6683){return function(_0x59e653){try{jsonpatch['apply'](_0x59e653,_0x1d6683,!![]);}catch(_0xa1b6b3){return BPromise[_0x90d8('0x1b')](_0xa1b6b3);}return _0x59e653[_0x90d8('0x1c')]();};}function saveUpdates(_0x14a27f,_0xf2f434){return function(_0x9bdb52){if(_0x9bdb52){return _0x9bdb52[_0x90d8('0x1d')](_0x14a27f)[_0x90d8('0x1e')](function(_0x4f5777){return _0x4f5777;});}return null;};}function removeEntity(_0x26b2ba,_0x5ca1bb){return function(_0x312400){if(_0x312400){return _0x312400[_0x90d8('0x1f')]()[_0x90d8('0x1e')](function(){_0x26b2ba['status'](0xcc)[_0x90d8('0x16')]();});}};}function handleEntityNotFound(_0x4516f6,_0x5b645c){return function(_0xabcb82){if(!_0xabcb82){_0x4516f6[_0x90d8('0x14')](0x194);}return _0xabcb82;};}function handleError(_0x48235a,_0x62bb5b){_0x62bb5b=_0x62bb5b||0x1f4;return function(_0x3b4198){logger[_0x90d8('0x20')](_0x3b4198['stack']);if(_0x3b4198[_0x90d8('0x21')]){delete _0x3b4198['name'];}_0x48235a[_0x90d8('0x15')](_0x62bb5b)[_0x90d8('0x22')](_0x3b4198);};}exports[_0x90d8('0x23')]=function(_0x273fc3,_0x5c3c76){var _0x4748ba={},_0x1c0eb9={},_0x52b97e={'count':0x0,'rows':[]};var _0x2b98e4=_[_0x90d8('0x24')](db['VtigerField'][_0x90d8('0x25')],function(_0x2e1691){return{'name':_0x2e1691[_0x90d8('0x26')],'type':_0x2e1691[_0x90d8('0x27')][_0x90d8('0x28')]};});_0x1c0eb9[_0x90d8('0x29')]=_['map'](_0x2b98e4,_0x90d8('0x21'));_0x1c0eb9['query']=_[_0x90d8('0x2a')](_0x273fc3[_0x90d8('0x2b')]);_0x1c0eb9[_0x90d8('0x2c')]=_[_0x90d8('0x2d')](_0x1c0eb9[_0x90d8('0x29')],_0x1c0eb9[_0x90d8('0x2b')]);_0x4748ba[_0x90d8('0x2e')]=_[_0x90d8('0x2d')](_0x1c0eb9['model'],qs[_0x90d8('0x2f')](_0x273fc3[_0x90d8('0x2b')][_0x90d8('0x2f')]));_0x4748ba[_0x90d8('0x2e')]=_0x4748ba['attributes']['length']?_0x4748ba[_0x90d8('0x2e')]:_0x1c0eb9[_0x90d8('0x29')];if(!_0x273fc3[_0x90d8('0x2b')]['hasOwnProperty']('nolimit')){_0x4748ba[_0x90d8('0x30')]=qs[_0x90d8('0x30')](_0x273fc3[_0x90d8('0x2b')][_0x90d8('0x30')]);_0x4748ba['offset']=qs[_0x90d8('0x19')](_0x273fc3[_0x90d8('0x2b')][_0x90d8('0x19')]);}_0x4748ba['order']=qs[_0x90d8('0x31')](_0x273fc3[_0x90d8('0x2b')][_0x90d8('0x31')]);_0x4748ba[_0x90d8('0x32')]=qs['filters'](_[_0x90d8('0x33')](_0x273fc3[_0x90d8('0x2b')],_0x1c0eb9['filters']));if(_0x273fc3[_0x90d8('0x2b')][_0x90d8('0x34')]){_0x4748ba[_0x90d8('0x32')]=_[_0x90d8('0x35')](_0x4748ba[_0x90d8('0x32')],{'$or':_[_0x90d8('0x24')](_0x2b98e4,function(_0x1c80c2){if(_0x1c80c2['type']!=='VIRTUAL'){var _0x275b35={};_0x275b35[_0x1c80c2['name']]={'$like':'%'+_0x273fc3['query'][_0x90d8('0x34')]+'%'};return _0x275b35;}})});}_0x4748ba=_[_0x90d8('0x35')]({},_0x4748ba,_0x273fc3[_0x90d8('0x36')]);var _0x1716aa={'where':_0x4748ba[_0x90d8('0x32')]};return db[_0x90d8('0x37')][_0x90d8('0x18')](_0x1716aa)[_0x90d8('0x1e')](function(_0xf0df74){_0x52b97e[_0x90d8('0x18')]=_0xf0df74;if(_0x273fc3['query']['includeAll']){_0x4748ba['include']=[{'all':!![]}];}return db['VtigerField']['findAll'](_0x4748ba);})['then'](function(_0x836353){_0x52b97e[_0x90d8('0x38')]=_0x836353;return _0x52b97e;})[_0x90d8('0x1e')](respondWithFilteredResult(_0x5c3c76,_0x4748ba))['catch'](handleError(_0x5c3c76,null));};exports[_0x90d8('0x39')]=function(_0x656a8b,_0x12ce4a){var _0x2400ca={'raw':!![],'where':{'id':_0x656a8b['params']['id']}},_0x419360={};_0x419360[_0x90d8('0x29')]=_[_0x90d8('0x2a')](db[_0x90d8('0x37')][_0x90d8('0x25')]);_0x419360['query']=_[_0x90d8('0x2a')](_0x656a8b[_0x90d8('0x2b')]);_0x419360['filters']=_['intersection'](_0x419360[_0x90d8('0x29')],_0x419360[_0x90d8('0x2b')]);_0x2400ca[_0x90d8('0x2e')]=_[_0x90d8('0x2d')](_0x419360[_0x90d8('0x29')],qs['fields'](_0x656a8b[_0x90d8('0x2b')][_0x90d8('0x2f')]));_0x2400ca[_0x90d8('0x2e')]=_0x2400ca['attributes'][_0x90d8('0x3a')]?_0x2400ca['attributes']:_0x419360[_0x90d8('0x29')];if(_0x656a8b[_0x90d8('0x2b')][_0x90d8('0x3b')]){_0x2400ca[_0x90d8('0x3c')]=[{'all':!![]}];}_0x2400ca=_[_0x90d8('0x35')]({},_0x2400ca,_0x656a8b[_0x90d8('0x36')]);return db['VtigerField']['find'](_0x2400ca)['then'](handleEntityNotFound(_0x12ce4a,null))['then'](respondWithResult(_0x12ce4a,null))['catch'](handleError(_0x12ce4a,null));};exports[_0x90d8('0x3d')]=function(_0xe052b4,_0x11efd3){return db['VtigerField'][_0x90d8('0x3d')](_0xe052b4[_0x90d8('0x3e')],{})[_0x90d8('0x1e')](respondWithResult(_0x11efd3,0xc9))['catch'](handleError(_0x11efd3,null));};exports[_0x90d8('0x1d')]=function(_0x551545,_0x456c06){if(_0x551545['body']['id']){delete _0x551545['body']['id'];}return db[_0x90d8('0x37')]['find']({'where':{'id':_0x551545[_0x90d8('0x3f')]['id']}})[_0x90d8('0x1e')](handleEntityNotFound(_0x456c06,null))[_0x90d8('0x1e')](saveUpdates(_0x551545[_0x90d8('0x3e')],null))[_0x90d8('0x1e')](respondWithResult(_0x456c06,null))[_0x90d8('0x40')](handleError(_0x456c06,null));};exports[_0x90d8('0x1f')]=function(_0x367515,_0x3427ed){return db[_0x90d8('0x37')][_0x90d8('0x41')]({'where':{'id':_0x367515[_0x90d8('0x3f')]['id']}})[_0x90d8('0x1e')](handleEntityNotFound(_0x3427ed,null))[_0x90d8('0x1e')](removeEntity(_0x3427ed,null))[_0x90d8('0x40')](handleError(_0x3427ed,null));}; \ No newline at end of file diff --git a/server/api/intVtigerField/intVtigerField.model.js b/server/api/intVtigerField/intVtigerField.model.js index c2633d0..6166715 100644 --- a/server/api/intVtigerField/intVtigerField.model.js +++ b/server/api/intVtigerField/intVtigerField.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x7a54=['int_vtiger_fields','idField','lodash','util','../../config/logger','moment','bluebird','path','rimraf','../../config/environment','./intVtigerField.attributes','exports','VtigerField'];(function(_0x2d4b74,_0x517899){var _0x43d413=function(_0x1a5d9b){while(--_0x1a5d9b){_0x2d4b74['push'](_0x2d4b74['shift']());}};_0x43d413(++_0x517899);}(_0x7a54,0x106));var _0x47a5=function(_0x57c46d,_0x53a0cb){_0x57c46d=_0x57c46d-0x0;var _0x259aec=_0x7a54[_0x57c46d];return _0x259aec;};'use strict';var _=require(_0x47a5('0x0'));var util=require(_0x47a5('0x1'));var logger=require(_0x47a5('0x2'))('api');var moment=require(_0x47a5('0x3'));var BPromise=require(_0x47a5('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x47a5('0x5'));var rimraf=require(_0x47a5('0x6'));var config=require(_0x47a5('0x7'));var attributes=require(_0x47a5('0x8'));module[_0x47a5('0x9')]=function(_0x545a97,_0x3d5629){return _0x545a97['define'](_0x47a5('0xa'),attributes,{'tableName':_0x47a5('0xb'),'paranoid':![],'indexes':[{'name':'vtiger_unique_index','fields':[_0x47a5('0xc'),'FieldId'],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0x7a54=['int_vtiger_fields','idField','lodash','util','../../config/logger','moment','bluebird','path','rimraf','../../config/environment','./intVtigerField.attributes','exports','VtigerField'];(function(_0x4977ac,_0x245f72){var _0x5f4932=function(_0x5bd6c9){while(--_0x5bd6c9){_0x4977ac['push'](_0x4977ac['shift']());}};_0x5f4932(++_0x245f72);}(_0x7a54,0x106));var _0x47a5=function(_0x1c4583,_0x5b4fbb){_0x1c4583=_0x1c4583-0x0;var _0xfbdc73=_0x7a54[_0x1c4583];return _0xfbdc73;};'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 62c8a60..d68f2a8 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 _0xe605=['rpc','../../config/environment','jayson/promise','client','http','then','info','VtigerField,\x20%s,\x20%s','request\x20sent','debug','error','code','message','result','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger'];(function(_0x5dd485,_0x42060a){var _0x22a4ac=function(_0x31c9a9){while(--_0x31c9a9){_0x5dd485['push'](_0x5dd485['shift']());}};_0x22a4ac(++_0x42060a);}(_0xe605,0x92));var _0x5e60=function(_0x5201ba,_0x71fe90){_0x5201ba=_0x5201ba-0x0;var _0xacc6ea=_0xe605[_0x5201ba];return _0xacc6ea;};'use strict';var _=require(_0x5e60('0x0'));var util=require(_0x5e60('0x1'));var moment=require('moment');var BPromise=require(_0x5e60('0x2'));var rs=require(_0x5e60('0x3'));var fs=require('fs');var Redis=require(_0x5e60('0x4'));var db=require(_0x5e60('0x5'))['db'];var utils=require(_0x5e60('0x6'));var logger=require(_0x5e60('0x7'))(_0x5e60('0x8'));var config=require(_0x5e60('0x9'));var jayson=require(_0x5e60('0xa'));var client=jayson[_0x5e60('0xb')][_0x5e60('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x168a14,_0x4e3501,_0x1c5a6f){return new BPromise(function(_0x55ff5c,_0x593118){return client['request'](_0x168a14,_0x1c5a6f)[_0x5e60('0xd')](function(_0xe93f9c){logger[_0x5e60('0xe')](_0x5e60('0xf'),_0x4e3501,_0x5e60('0x10'));logger[_0x5e60('0x11')]('VtigerField,\x20%s,\x20%s,\x20%s',_0x4e3501,_0x5e60('0x10'),JSON['stringify'](_0xe93f9c));if(_0xe93f9c[_0x5e60('0x12')]){if(_0xe93f9c[_0x5e60('0x12')][_0x5e60('0x13')]===0x1f4){logger['error'](_0x5e60('0xf'),_0x4e3501,_0xe93f9c[_0x5e60('0x12')][_0x5e60('0x14')]);return _0x593118(_0xe93f9c[_0x5e60('0x12')][_0x5e60('0x14')]);}logger[_0x5e60('0x12')]('VtigerField,\x20%s,\x20%s',_0x4e3501,_0xe93f9c[_0x5e60('0x12')][_0x5e60('0x14')]);return _0x55ff5c(_0xe93f9c[_0x5e60('0x12')][_0x5e60('0x14')]);}else{logger['info'](_0x5e60('0xf'),_0x4e3501,'request\x20sent');_0x55ff5c(_0xe93f9c[_0x5e60('0x15')][_0x5e60('0x14')]);}})['catch'](function(_0x39be57){logger[_0x5e60('0x12')](_0x5e60('0xf'),_0x4e3501,_0x39be57);_0x593118(_0x39be57);});});} \ No newline at end of file +var _0x9458=['moment','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','VtigerField,\x20%s,\x20%s','debug','VtigerField,\x20%s,\x20%s,\x20%s','error','code','message','request\x20sent','catch'];(function(_0x4ff09b,_0x53f67d){var _0x3f5c2e=function(_0x124592){while(--_0x124592){_0x4ff09b['push'](_0x4ff09b['shift']());}};_0x3f5c2e(++_0x53f67d);}(_0x9458,0x1b8));var _0x8945=function(_0xa8d350,_0x80c0f1){_0xa8d350=_0xa8d350-0x0;var _0x386ddd=_0x9458[_0xa8d350];return _0x386ddd;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x8945('0x0'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x8945('0x1'));var db=require('../../mysqldb')['db'];var utils=require(_0x8945('0x2'));var logger=require(_0x8945('0x3'))(_0x8945('0x4'));var config=require(_0x8945('0x5'));var jayson=require(_0x8945('0x6'));var client=jayson[_0x8945('0x7')][_0x8945('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x12187d,_0x928802,_0x1a2b8f){return new BPromise(function(_0x4aec0b,_0x29eaed){return client[_0x8945('0x9')](_0x12187d,_0x1a2b8f)[_0x8945('0xa')](function(_0x307b9e){logger[_0x8945('0xb')](_0x8945('0xc'),_0x928802,'request\x20sent');logger[_0x8945('0xd')](_0x8945('0xe'),_0x928802,'request\x20sent',JSON['stringify'](_0x307b9e));if(_0x307b9e[_0x8945('0xf')]){if(_0x307b9e['error'][_0x8945('0x10')]===0x1f4){logger[_0x8945('0xf')](_0x8945('0xc'),_0x928802,_0x307b9e[_0x8945('0xf')][_0x8945('0x11')]);return _0x29eaed(_0x307b9e[_0x8945('0xf')]['message']);}logger[_0x8945('0xf')](_0x8945('0xc'),_0x928802,_0x307b9e['error'][_0x8945('0x11')]);return _0x4aec0b(_0x307b9e[_0x8945('0xf')][_0x8945('0x11')]);}else{logger[_0x8945('0xb')](_0x8945('0xc'),_0x928802,_0x8945('0x12'));_0x4aec0b(_0x307b9e['result']['message']);}})[_0x8945('0x13')](function(_0x4c0b8f){logger['error'](_0x8945('0xc'),_0x928802,_0x4c0b8f);_0x29eaed(_0x4c0b8f);});});} \ No newline at end of file diff --git a/server/api/intZendeskAccount/index.js b/server/api/intZendeskAccount/index.js index 768217f..30f0e36 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 _0x206a=['connect-timeout','express','Router','../../config/environment','./intZendeskAccount.controller','get','isAuthenticated','show','/:id/configurations','getConfigurations','/:id/fields','post','addConfiguration','put','/:id','delete','exports','util','path'];(function(_0x434407,_0x50c0ab){var _0x237365=function(_0x3033d7){while(--_0x3033d7){_0x434407['push'](_0x434407['shift']());}};_0x237365(++_0x50c0ab);}(_0x206a,0xf5));var _0xa206=function(_0x1515c9,_0x3db945){_0x1515c9=_0x1515c9-0x0;var _0x3e9c59=_0x206a[_0x1515c9];return _0x3e9c59;};'use strict';var multer=require('multer');var util=require(_0xa206('0x0'));var path=require(_0xa206('0x1'));var timeout=require(_0xa206('0x2'));var express=require(_0xa206('0x3'));var router=express[_0xa206('0x4')]();var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0xa206('0x5'));var controller=require(_0xa206('0x6'));router[_0xa206('0x7')]('/',auth[_0xa206('0x8')](),controller['index']);router[_0xa206('0x7')]('/:id',auth[_0xa206('0x8')](),controller[_0xa206('0x9')]);router[_0xa206('0x7')](_0xa206('0xa'),auth['isAuthenticated'](),controller[_0xa206('0xb')]);router[_0xa206('0x7')](_0xa206('0xc'),auth[_0xa206('0x8')](),controller['getFields']);router[_0xa206('0xd')]('/',auth['isAuthenticated'](),controller['create']);router[_0xa206('0xd')](_0xa206('0xa'),auth[_0xa206('0x8')](),controller[_0xa206('0xe')]);router[_0xa206('0xf')](_0xa206('0x10'),auth[_0xa206('0x8')](),controller['update']);router[_0xa206('0x11')](_0xa206('0x10'),auth[_0xa206('0x8')](),controller['destroy']);module[_0xa206('0x12')]=router; \ No newline at end of file +var _0xbb0e=['path','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','./intZendeskAccount.controller','get','isAuthenticated','index','/:id','/:id/configurations','getConfigurations','/:id/fields','post','create','addConfiguration','put','delete','destroy','exports','multer'];(function(_0x2adb3a,_0x4e46bf){var _0x4e9ba8=function(_0x51bbf8){while(--_0x51bbf8){_0x2adb3a['push'](_0x2adb3a['shift']());}};_0x4e9ba8(++_0x4e46bf);}(_0xbb0e,0x1b8));var _0xebb0=function(_0xac0dd2,_0x86bbea){_0xac0dd2=_0xac0dd2-0x0;var _0x1d75e4=_0xbb0e[_0xac0dd2];return _0x1d75e4;};'use strict';var multer=require(_0xebb0('0x0'));var util=require('util');var path=require(_0xebb0('0x1'));var timeout=require(_0xebb0('0x2'));var express=require('express');var router=express[_0xebb0('0x3')]();var auth=require(_0xebb0('0x4'));var interaction=require(_0xebb0('0x5'));var config=require('../../config/environment');var controller=require(_0xebb0('0x6'));router[_0xebb0('0x7')]('/',auth[_0xebb0('0x8')](),controller[_0xebb0('0x9')]);router['get'](_0xebb0('0xa'),auth[_0xebb0('0x8')](),controller['show']);router[_0xebb0('0x7')](_0xebb0('0xb'),auth[_0xebb0('0x8')](),controller[_0xebb0('0xc')]);router['get'](_0xebb0('0xd'),auth[_0xebb0('0x8')](),controller['getFields']);router[_0xebb0('0xe')]('/',auth[_0xebb0('0x8')](),controller[_0xebb0('0xf')]);router[_0xebb0('0xe')](_0xebb0('0xb'),auth[_0xebb0('0x8')](),controller[_0xebb0('0x10')]);router[_0xebb0('0x11')]('/:id',auth[_0xebb0('0x8')](),controller['update']);router[_0xebb0('0x12')]('/:id',auth[_0xebb0('0x8')](),controller[_0xebb0('0x13')]);module[_0xebb0('0x14')]=router; \ No newline at end of file diff --git a/server/api/intZendeskAccount/intZendeskAccount.attributes.js b/server/api/intZendeskAccount/intZendeskAccount.attributes.js index 6df5feb..bc06a94 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 _0x1d86=['token','password','integrationTab','newTab','sequelize','STRING','username','remoteUri','ENUM'];(function(_0x3de253,_0x3a2293){var _0x50ed65=function(_0x5ace51){while(--_0x5ace51){_0x3de253['push'](_0x3de253['shift']());}};_0x50ed65(++_0x3a2293);}(_0x1d86,0x17e));var _0x61d8=function(_0x45a4f3,_0x225f6e){_0x45a4f3=_0x45a4f3-0x0;var _0x2a3953=_0x1d86[_0x45a4f3];return _0x2a3953;};'use strict';var Sequelize=require(_0x61d8('0x0'));module['exports']={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0x61d8('0x1')]},'username':{'type':Sequelize[_0x61d8('0x1')],'unique':_0x61d8('0x2')},'password':{'type':Sequelize[_0x61d8('0x1')]},'token':{'type':Sequelize[_0x61d8('0x1')]},'remoteUri':{'type':Sequelize[_0x61d8('0x1')],'unique':_0x61d8('0x3')},'authType':{'type':Sequelize[_0x61d8('0x4')]('password',_0x61d8('0x5')),'defaultValue':_0x61d8('0x6')},'serverUrl':{'type':Sequelize[_0x61d8('0x1')]},'type':{'type':Sequelize[_0x61d8('0x4')](_0x61d8('0x7'),_0x61d8('0x8')),'defaultValue':_0x61d8('0x7')}}; \ No newline at end of file +var _0x479c=['sequelize','STRING','username','remoteUri','ENUM','password','newTab','integrationTab'];(function(_0x3dc089,_0x5ccb0d){var _0x34d9d3=function(_0x4556bf){while(--_0x4556bf){_0x3dc089['push'](_0x3dc089['shift']());}};_0x34d9d3(++_0x5ccb0d);}(_0x479c,0xe8));var _0xc479=function(_0xa148b7,_0x2f3eb2){_0xa148b7=_0xa148b7-0x0;var _0x51efd3=_0x479c[_0xa148b7];return _0x51efd3;};'use strict';var Sequelize=require(_0xc479('0x0'));module['exports']={'name':{'type':Sequelize[_0xc479('0x1')]},'description':{'type':Sequelize['STRING']},'username':{'type':Sequelize[_0xc479('0x1')],'unique':_0xc479('0x2')},'password':{'type':Sequelize[_0xc479('0x1')]},'token':{'type':Sequelize[_0xc479('0x1')]},'remoteUri':{'type':Sequelize['STRING'],'unique':_0xc479('0x3')},'authType':{'type':Sequelize[_0xc479('0x4')](_0xc479('0x5'),'token'),'defaultValue':'password'},'serverUrl':{'type':Sequelize[_0xc479('0x1')]},'type':{'type':Sequelize[_0xc479('0x4')]('integrationTab',_0xc479('0x6')),'defaultValue':_0xc479('0x7')}}; \ No newline at end of file diff --git a/server/api/intZendeskAccount/intZendeskAccount.controller.js b/server/api/intZendeskAccount/intZendeskAccount.controller.js index f656743..4aaacdc 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 _0xe59d=['system_field_options','custom_field_options','statusCode','getFields,\x20%s,\x20%s,\x20%s','getFields','html-pdf','fast-json-patch','request-promise','moment','mustache','util','sox','to-csv','ejs','lodash','squel','crypto','querystring','papaparse','ioredis','../../components/parsers/qs','api','../../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','ZendeskAccount,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','info','result','catch','sendStatus','status','json','count','limit','set','Content-Range','apply','reject','save','destroy','name','index','map','ZendeskAccount','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','offset','sort','where','pick','filter','merge','include','findAll','show','params','includeAll','find','create','body','update','getConfigurations','ZendeskConfiguration','rawAttributes','order','options','addConfiguration','findOne','Subjects','getSubjects','channel','ZendeskField','password','remoteUri','substring','lastIndexOf','format','%s/%s','ticket_fields','headers','Basic\x20%s','%s:%s','username','toString','base64','%s/token:%s','Unknown\x20authentication\x20type','assignee','remove','position','title'];(function(_0x3bb5b4,_0x128455){var _0x586c60=function(_0x179226){while(--_0x179226){_0x3bb5b4['push'](_0x3bb5b4['shift']());}};_0x586c60(++_0x128455);}(_0xe59d,0xf1));var _0xde59=function(_0x380016,_0x178dd6){_0x380016=_0x380016-0x0;var _0x5c7ac0=_0xe59d[_0x380016];return _0x5c7ac0;};'use strict';var pdf=require(_0xde59('0x0'));var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0xde59('0x1'));var rp=require(_0xde59('0x2'));var moment=require(_0xde59('0x3'));var BPromise=require('bluebird');var Mustache=require(_0xde59('0x4'));var util=require(_0xde59('0x5'));var path=require('path');var sox=require(_0xde59('0x6'));var csv=require(_0xde59('0x7'));var ejs=require(_0xde59('0x8'));var fs=require('fs');var _=require(_0xde59('0x9'));var squel=require(_0xde59('0xa'));var crypto=require(_0xde59('0xb'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0xde59('0xc'));var Papa=require(_0xde59('0xd'));var Redis=require(_0xde59('0xe'));var authService=require('../../components/auth/service');var qs=require(_0xde59('0xf'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0xde59('0x10'));var utils=require(_0xde59('0x11'));var config=require(_0xde59('0x12'));var db=require(_0xde59('0x13'))['db'];var integrations=require(_0xde59('0x14'));var jayson=require(_0xde59('0x15'));var client=jayson[_0xde59('0x16')][_0xde59('0x17')]({'port':0x232a});function checkPasswordPattern(_0x2c1bf7,_0xe3e8c5,_0x43a1bb){if(_0x43a1bb){var _0x41d8e2=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x41d8e2[_0xde59('0x18')](_0xe3e8c5)){return _0x2c1bf7;}else{throw new db[(_0xde59('0x19'))][(_0xde59('0x1a'))](_0xde59('0x1b'));}}else{return _0x2c1bf7;}}function respondWithRpcPromise(_0x4c14f3,_0x9c7cff,_0x262d8b,_0x4d1c22){return new BPromise(function(_0x35017f,_0x22c556){var _0x4e742d=_0x4d1c22||client;return _0x4e742d[_0xde59('0x1c')](_0x4c14f3,_0x262d8b)[_0xde59('0x1d')](function(_0x4b878c){logger['info'](_0xde59('0x1e'),_0x9c7cff,_0xde59('0x1f'));logger[_0xde59('0x20')]('ZendeskAccount,\x20%s,\x20%s,\x20%s',_0x9c7cff,'request\x20sent',JSON[_0xde59('0x21')](_0x4b878c));if(_0x4b878c['error']){if(_0x4b878c[_0xde59('0x22')][_0xde59('0x23')]===0x1f4){logger[_0xde59('0x22')](_0xde59('0x1e'),_0x9c7cff,_0x4b878c['error'][_0xde59('0x24')]);return _0x22c556(_0x4b878c[_0xde59('0x22')]['message']);}logger[_0xde59('0x22')](_0xde59('0x1e'),_0x9c7cff,_0x4b878c[_0xde59('0x22')]['message']);return _0x35017f(_0x4b878c[_0xde59('0x22')]['message']);}else{logger[_0xde59('0x25')](_0xde59('0x1e'),_0x9c7cff,_0xde59('0x1f'));_0x35017f(_0x4b878c[_0xde59('0x26')][_0xde59('0x24')]);}})[_0xde59('0x27')](function(_0x1e9112){logger[_0xde59('0x22')]('ZendeskAccount,\x20%s,\x20%s',_0x9c7cff,_0x1e9112);_0x22c556(_0x1e9112);});});}function respondWithStatusCode(_0x1dc0cd,_0x158deb){_0x158deb=_0x158deb||0xcc;return function(_0x3f3112){if(_0x3f3112){return _0x1dc0cd[_0xde59('0x28')](_0x158deb);}return _0x1dc0cd[_0xde59('0x29')](_0x158deb)['end']();};}function respondWithResult(_0x57cd2c,_0x578d5e){_0x578d5e=_0x578d5e||0xc8;return function(_0x2f2e28){if(_0x2f2e28){return _0x57cd2c[_0xde59('0x29')](_0x578d5e)[_0xde59('0x2a')](_0x2f2e28);}};}function respondWithFilteredResult(_0xa2d9e0,_0x4e327b){return function(_0x1ef602){if(_0x1ef602){var _0x5400e4=_0x1ef602[_0xde59('0x2b')],_0x5d49f3=_0x4e327b['offset'],_0x549abb=_0x4e327b['offset']+_0x4e327b[_0xde59('0x2c')],_0x349baa;if(_0x549abb>=_0x5400e4){_0x549abb=_0x5400e4;_0x349baa=0xc8;}else{_0x349baa=0xce;}_0xa2d9e0['status'](_0x349baa);return _0xa2d9e0[_0xde59('0x2d')](_0xde59('0x2e'),_0x5d49f3+'-'+_0x549abb+'/'+_0x5400e4)[_0xde59('0x2a')](_0x1ef602);}return null;};}function patchUpdates(_0xbc8922){return function(_0x441ded){try{jsonpatch[_0xde59('0x2f')](_0x441ded,_0xbc8922,!![]);}catch(_0x1829f7){return BPromise[_0xde59('0x30')](_0x1829f7);}return _0x441ded[_0xde59('0x31')]();};}function saveUpdates(_0x4f3735,_0x142217){return function(_0xa3f750){if(_0xa3f750){return _0xa3f750['update'](_0x4f3735)[_0xde59('0x1d')](function(_0x3e3a3c){return _0x3e3a3c;});}return null;};}function removeEntity(_0x2a1b9d,_0x3b5a4c){return function(_0x370127){if(_0x370127){return _0x370127[_0xde59('0x32')]()[_0xde59('0x1d')](function(){_0x2a1b9d[_0xde59('0x29')](0xcc)['end']();});}};}function handleEntityNotFound(_0x38f167,_0xad0f20){return function(_0x18c077){if(!_0x18c077){_0x38f167[_0xde59('0x28')](0x194);}return _0x18c077;};}function handleError(_0x4fa3eb,_0x3ee20d){_0x3ee20d=_0x3ee20d||0x1f4;return function(_0x11b834){logger[_0xde59('0x22')](_0x11b834['stack']);if(_0x11b834[_0xde59('0x33')]){delete _0x11b834[_0xde59('0x33')];}_0x4fa3eb[_0xde59('0x29')](_0x3ee20d)['send'](_0x11b834);};}exports[_0xde59('0x34')]=function(_0x4a982f,_0x5979b7){var _0x158bb1={},_0x35e7b1={},_0x33ecd8={'count':0x0,'rows':[]};var _0x177942=_[_0xde59('0x35')](db[_0xde59('0x36')]['rawAttributes'],function(_0x1369e6){return{'name':_0x1369e6[_0xde59('0x37')],'type':_0x1369e6[_0xde59('0x38')][_0xde59('0x39')]};});_0x35e7b1[_0xde59('0x3a')]=_[_0xde59('0x35')](_0x177942,'name');_0x35e7b1[_0xde59('0x3b')]=_[_0xde59('0x3c')](_0x4a982f['query']);_0x35e7b1[_0xde59('0x3d')]=_[_0xde59('0x3e')](_0x35e7b1[_0xde59('0x3a')],_0x35e7b1['query']);_0x158bb1[_0xde59('0x3f')]=_['intersection'](_0x35e7b1[_0xde59('0x3a')],qs[_0xde59('0x40')](_0x4a982f[_0xde59('0x3b')][_0xde59('0x40')]));_0x158bb1[_0xde59('0x3f')]=_0x158bb1[_0xde59('0x3f')][_0xde59('0x41')]?_0x158bb1[_0xde59('0x3f')]:_0x35e7b1[_0xde59('0x3a')];if(!_0x4a982f[_0xde59('0x3b')][_0xde59('0x42')](_0xde59('0x43'))){_0x158bb1['limit']=qs[_0xde59('0x2c')](_0x4a982f['query'][_0xde59('0x2c')]);_0x158bb1['offset']=qs['offset'](_0x4a982f[_0xde59('0x3b')][_0xde59('0x44')]);}_0x158bb1['order']=qs[_0xde59('0x45')](_0x4a982f[_0xde59('0x3b')]['sort']);_0x158bb1[_0xde59('0x46')]=qs[_0xde59('0x3d')](_[_0xde59('0x47')](_0x4a982f[_0xde59('0x3b')],_0x35e7b1[_0xde59('0x3d')]));if(_0x4a982f['query'][_0xde59('0x48')]){_0x158bb1[_0xde59('0x46')]=_['merge'](_0x158bb1['where'],{'$or':_[_0xde59('0x35')](_0x177942,function(_0x37f733){if(_0x37f733[_0xde59('0x38')]!=='VIRTUAL'){var _0x106892={};_0x106892[_0x37f733['name']]={'$like':'%'+_0x4a982f[_0xde59('0x3b')][_0xde59('0x48')]+'%'};return _0x106892;}})});}_0x158bb1=_[_0xde59('0x49')]({},_0x158bb1,_0x4a982f['options']);var _0x5c6ef3={'where':_0x158bb1[_0xde59('0x46')]};return db[_0xde59('0x36')][_0xde59('0x2b')](_0x5c6ef3)[_0xde59('0x1d')](function(_0x2d10d5){_0x33ecd8[_0xde59('0x2b')]=_0x2d10d5;if(_0x4a982f[_0xde59('0x3b')]['includeAll']){_0x158bb1[_0xde59('0x4a')]=[{'all':!![]}];}return db[_0xde59('0x36')][_0xde59('0x4b')](_0x158bb1);})[_0xde59('0x1d')](function(_0xa50c4){_0x33ecd8['rows']=_0xa50c4;return _0x33ecd8;})[_0xde59('0x1d')](respondWithFilteredResult(_0x5979b7,_0x158bb1))[_0xde59('0x27')](handleError(_0x5979b7,null));};exports[_0xde59('0x4c')]=function(_0x389bf0,_0x2ba657){var _0x16ae25={'raw':![],'where':{'id':_0x389bf0[_0xde59('0x4d')]['id']}},_0x5268ee={};_0x5268ee[_0xde59('0x3a')]=_[_0xde59('0x3c')](db[_0xde59('0x36')]['rawAttributes']);_0x5268ee[_0xde59('0x3b')]=_['keys'](_0x389bf0[_0xde59('0x3b')]);_0x5268ee['filters']=_[_0xde59('0x3e')](_0x5268ee['model'],_0x5268ee[_0xde59('0x3b')]);_0x16ae25[_0xde59('0x3f')]=_[_0xde59('0x3e')](_0x5268ee[_0xde59('0x3a')],qs['fields'](_0x389bf0[_0xde59('0x3b')][_0xde59('0x40')]));_0x16ae25[_0xde59('0x3f')]=_0x16ae25[_0xde59('0x3f')][_0xde59('0x41')]?_0x16ae25[_0xde59('0x3f')]:_0x5268ee[_0xde59('0x3a')];if(_0x389bf0[_0xde59('0x3b')][_0xde59('0x4e')]){_0x16ae25['include']=[{'all':!![]}];}_0x16ae25=_['merge']({},_0x16ae25,_0x389bf0['options']);return db[_0xde59('0x36')][_0xde59('0x4f')](_0x16ae25)[_0xde59('0x1d')](handleEntityNotFound(_0x2ba657,null))['then'](respondWithResult(_0x2ba657,null))[_0xde59('0x27')](handleError(_0x2ba657,null));};exports[_0xde59('0x50')]=function(_0x3aca41,_0x498b2b){return db[_0xde59('0x36')][_0xde59('0x50')](_0x3aca41[_0xde59('0x51')],{})[_0xde59('0x1d')](respondWithResult(_0x498b2b,0xc9))[_0xde59('0x27')](handleError(_0x498b2b,null));};exports[_0xde59('0x52')]=function(_0xf6d74b,_0x101f21){if(_0xf6d74b[_0xde59('0x51')]['id']){delete _0xf6d74b[_0xde59('0x51')]['id'];}return db[_0xde59('0x36')][_0xde59('0x4f')]({'where':{'id':_0xf6d74b['params']['id']}})['then'](handleEntityNotFound(_0x101f21,null))[_0xde59('0x1d')](saveUpdates(_0xf6d74b[_0xde59('0x51')],null))[_0xde59('0x1d')](respondWithResult(_0x101f21,null))[_0xde59('0x27')](handleError(_0x101f21,null));};exports['destroy']=function(_0x319912,_0x790a3a){return db[_0xde59('0x36')][_0xde59('0x4f')]({'where':{'id':_0x319912[_0xde59('0x4d')]['id']}})[_0xde59('0x1d')](handleEntityNotFound(_0x790a3a,null))[_0xde59('0x1d')](removeEntity(_0x790a3a,null))[_0xde59('0x27')](handleError(_0x790a3a,null));};exports[_0xde59('0x53')]=function(_0x1b7286,_0x11b216,_0x43e6c5){var _0x3ef1ab={};var _0x1a02cc={};var _0x570b22;var _0x13900d;return db[_0xde59('0x36')]['findOne']({'where':{'id':_0x1b7286[_0xde59('0x4d')]['id']}})[_0xde59('0x1d')](handleEntityNotFound(_0x11b216,null))['then'](function(_0x813740){if(_0x813740){_0x570b22=_0x813740;_0x1a02cc[_0xde59('0x3a')]=_[_0xde59('0x3c')](db[_0xde59('0x54')][_0xde59('0x55')]);_0x1a02cc[_0xde59('0x3b')]=_[_0xde59('0x3c')](_0x1b7286[_0xde59('0x3b')]);_0x1a02cc['filters']=_['intersection'](_0x1a02cc[_0xde59('0x3a')],_0x1a02cc['query']);_0x3ef1ab[_0xde59('0x3f')]=_[_0xde59('0x3e')](_0x1a02cc[_0xde59('0x3a')],qs['fields'](_0x1b7286['query'][_0xde59('0x40')]));_0x3ef1ab[_0xde59('0x3f')]=_0x3ef1ab[_0xde59('0x3f')]['length']?_0x3ef1ab[_0xde59('0x3f')]:_0x1a02cc['model'];_0x3ef1ab[_0xde59('0x56')]=qs[_0xde59('0x45')](_0x1b7286[_0xde59('0x3b')][_0xde59('0x45')]);_0x3ef1ab[_0xde59('0x46')]=qs[_0xde59('0x3d')](_['pick'](_0x1b7286[_0xde59('0x3b')],_0x1a02cc[_0xde59('0x3d')]));if(_0x1b7286[_0xde59('0x3b')][_0xde59('0x48')]){_0x3ef1ab['where']=_['merge'](_0x3ef1ab[_0xde59('0x46')],{'$or':_['map'](_0x3ef1ab[_0xde59('0x3f')],function(_0x460a8a){var _0x449947={};_0x449947[_0x460a8a]={'$like':'%'+_0x1b7286['query'][_0xde59('0x48')]+'%'};return _0x449947;})});}_0x3ef1ab=_[_0xde59('0x49')]({},_0x3ef1ab,_0x1b7286[_0xde59('0x57')]);return _0x570b22[_0xde59('0x53')](_0x3ef1ab);}})[_0xde59('0x1d')](function(_0x498981){if(_0x498981){_0x13900d=_0x498981[_0xde59('0x41')];if(!_0x1b7286[_0xde59('0x3b')]['hasOwnProperty']('nolimit')){_0x3ef1ab[_0xde59('0x2c')]=qs['limit'](_0x1b7286[_0xde59('0x3b')][_0xde59('0x2c')]);_0x3ef1ab[_0xde59('0x44')]=qs[_0xde59('0x44')](_0x1b7286['query'][_0xde59('0x44')]);}return _0x570b22[_0xde59('0x53')](_0x3ef1ab);}})['then'](function(_0x2c5489){if(_0x2c5489){return _0x2c5489?{'count':_0x13900d,'rows':_0x2c5489}:null;}})[_0xde59('0x1d')](respondWithResult(_0x11b216,null))[_0xde59('0x27')](handleError(_0x11b216,null));};exports[_0xde59('0x58')]=function(_0x6a5bc5,_0x4e0230,_0x138247){if(_0x6a5bc5[_0xde59('0x51')]['id']){delete _0x6a5bc5['body']['id'];}return db[_0xde59('0x36')][_0xde59('0x59')]({'where':{'id':_0x6a5bc5[_0xde59('0x4d')]['id']}})[_0xde59('0x1d')](handleEntityNotFound(_0x4e0230,null))[_0xde59('0x1d')](function(_0x78be20){if(_0x78be20){_0x6a5bc5['body']['AccountId']=_0x78be20['id'];_0x6a5bc5[_0xde59('0x51')][_0xde59('0x5a')]=integrations[_0xde59('0x5b')](_0x6a5bc5[_0xde59('0x51')][_0xde59('0x5c')],_0x6a5bc5['body']['type']);_0x6a5bc5[_0xde59('0x51')]['Descriptions']=integrations['getDescriptions'](_0x6a5bc5[_0xde59('0x51')][_0xde59('0x5c')],_0x6a5bc5[_0xde59('0x51')]['type']);return db[_0xde59('0x54')][_0xde59('0x50')](_0x6a5bc5[_0xde59('0x51')],{'include':[{'model':db['ZendeskField'],'as':_0xde59('0x5a')},{'model':db[_0xde59('0x5d')],'as':'Descriptions'}]});}return null;})[_0xde59('0x1d')](respondWithResult(_0x4e0230,null))['catch'](handleError(_0x4e0230,null));};exports['getFields']=function(_0x5a475f,_0x87c480,_0x56cdc4){var _0x5f4f18='';return db['ZendeskAccount']['findOne']({'where':{'id':_0x5a475f[_0xde59('0x4d')]['id']},'attributes':['id','username',_0xde59('0x5e'),'token','authType',_0xde59('0x5f')]})['then'](handleEntityNotFound(_0x87c480,null))[_0xde59('0x1d')](function(_0x29daaa){if(_0x29daaa){_0x5f4f18=_0x29daaa['remoteUri'];var _0x57c5e9=_0x5f4f18['slice'](-0x1);if(_0x57c5e9==='/'){_0x5f4f18=_0x5f4f18[_0xde59('0x60')](0x0,_0x5f4f18[_0xde59('0x61')](_0x57c5e9));}var _0x7e6bec={'method':'GET','uri':util[_0xde59('0x62')](_0xde59('0x63'),_0x5f4f18,_0xde59('0x64')),'json':!![]};switch(_0x29daaa['authType']){case'password':_0x7e6bec[_0xde59('0x65')]={'Authorization':util[_0xde59('0x62')](_0xde59('0x66'),new Buffer(util[_0xde59('0x62')](_0xde59('0x67'),_0x29daaa[_0xde59('0x68')],_0x29daaa[_0xde59('0x5e')]))[_0xde59('0x69')](_0xde59('0x6a')))};break;case'token':_0x7e6bec['headers']={'Authorization':util[_0xde59('0x62')](_0xde59('0x66'),new Buffer(util['format'](_0xde59('0x6b'),_0x29daaa[_0xde59('0x68')],_0x29daaa['token']))[_0xde59('0x69')]('base64'))};break;default:throw new db[(_0xde59('0x19'))][(_0xde59('0x1a'))](_0xde59('0x6c'));}return rp(_0x7e6bec);}})[_0xde59('0x1d')](function(_0x4040ae){if(_0x4040ae){var _0x519698=['subject','description','group',_0xde59('0x6d')];_[_0xde59('0x6e')](_0x4040ae['ticket_fields'],function(_0x52537f){return _0x519698['includes'](_0x52537f[_0xde59('0x38')]);});return{'count':_0x4040ae['ticket_fields'][_0xde59('0x41')],'rows':_[_0xde59('0x35')](_0x4040ae[_0xde59('0x64')],function(_0x46f460){return{'id':_0x46f460['id'],'name':_0x46f460[_0xde59('0x6f')]>0x7?_0x46f460[_0xde59('0x70')]:_0x46f460[_0xde59('0x38')],'custom':_0x46f460[_0xde59('0x6f')]>0x7?!![]:![],'options':_0x46f460['system_field_options']?_0x46f460[_0xde59('0x71')]:_0x46f460[_0xde59('0x72')]?_0x46f460[_0xde59('0x72')]:[]};})};}})[_0xde59('0x1d')](respondWithResult(_0x87c480,null))[_0xde59('0x27')](function(_0x2ca007){var _0x1da0ac=_0x5a475f['query'][_0xde59('0x18')]?0x1f4:_0x2ca007[_0xde59('0x73')]||0x1f4;logger[_0xde59('0x22')](_0xde59('0x74'),_0xde59('0x75'),_0x1da0ac,JSON['stringify'](_0x2ca007));delete _0x2ca007[_0xde59('0x33')];if(_0x1da0ac===0x191){_0x1da0ac=0x190;}_0x87c480['status'](_0x1da0ac)['send'](_0x5a475f[_0xde59('0x3b')][_0xde59('0x18')]?{'message':'Wrong\x20credentials','statusCode':_0x2ca007[_0xde59('0x73')]}:_0x2ca007);});}; \ No newline at end of file +var _0xeb62=['../../config/utils','test','Sequelize','The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.','request','then','info','ZendeskAccount,\x20%s,\x20%s','request\x20sent','debug','ZendeskAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','sendStatus','end','status','json','count','offset','set','apply','reject','save','update','destroy','stack','send','map','ZendeskAccount','fieldName','type','key','model','name','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','limit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','show','params','find','create','body','getConfigurations','findOne','ZendeskConfiguration','rawAttributes','addConfiguration','AccountId','Subjects','getSubjects','Descriptions','getDescriptions','channel','ZendeskField','password','token','authType','remoteUri','slice','substring','GET','format','%s/%s','headers','Basic\x20%s','%s:%s','username','%s/token:%s','base64','ValidationError','description','group','ticket_fields','includes','position','title','system_field_options','custom_field_options','statusCode','getFields,\x20%s,\x20%s,\x20%s','Wrong\x20credentials','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','util','to-csv','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api'];(function(_0x508314,_0x419aed){var _0x13d76d=function(_0x3a3c30){while(--_0x3a3c30){_0x508314['push'](_0x508314['shift']());}};_0x13d76d(++_0x419aed);}(_0xeb62,0x66));var _0x2eb6=function(_0x4f3995,_0x3b6fb3){_0x4f3995=_0x4f3995-0x0;var _0x3ed1cd=_0xeb62[_0x4f3995];return _0x3ed1cd;};'use strict';var pdf=require(_0x2eb6('0x0'));var emlformat=require(_0x2eb6('0x1'));var rimraf=require(_0x2eb6('0x2'));var zipdir=require(_0x2eb6('0x3'));var jsonpatch=require(_0x2eb6('0x4'));var rp=require(_0x2eb6('0x5'));var moment=require(_0x2eb6('0x6'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x2eb6('0x7'));var path=require('path');var sox=require('sox');var csv=require(_0x2eb6('0x8'));var ejs=require('ejs');var fs=require('fs');var _=require('lodash');var squel=require(_0x2eb6('0x9'));var crypto=require(_0x2eb6('0xa'));var jsforce=require(_0x2eb6('0xb'));var deskjs=require('desk.js');var toCsv=require(_0x2eb6('0x8'));var querystring=require(_0x2eb6('0xc'));var Papa=require(_0x2eb6('0xd'));var Redis=require(_0x2eb6('0xe'));var authService=require(_0x2eb6('0xf'));var qs=require(_0x2eb6('0x10'));var as=require(_0x2eb6('0x11'));var hardwareService=require(_0x2eb6('0x12'));var logger=require(_0x2eb6('0x13'))(_0x2eb6('0x14'));var utils=require(_0x2eb6('0x15'));var config=require('../../config/environment');var db=require('../../mysqldb')['db'];var integrations=require('../../components/integrations/configuration');var jayson=require('jayson/promise');var client=jayson['client']['http']({'port':0x232a});function checkPasswordPattern(_0x467de8,_0x51dd3e,_0xa14ee3){if(_0xa14ee3){var _0x29f539=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x29f539[_0x2eb6('0x16')](_0x51dd3e)){return _0x467de8;}else{throw new db[(_0x2eb6('0x17'))]['ValidationError'](_0x2eb6('0x18'));}}else{return _0x467de8;}}function respondWithRpcPromise(_0x222c9d,_0x21a4ea,_0x4d5959,_0x42f238){return new BPromise(function(_0x4183f0,_0x1c9e5c){var _0xd377f7=_0x42f238||client;return _0xd377f7[_0x2eb6('0x19')](_0x222c9d,_0x4d5959)[_0x2eb6('0x1a')](function(_0x667f5d){logger[_0x2eb6('0x1b')](_0x2eb6('0x1c'),_0x21a4ea,_0x2eb6('0x1d'));logger[_0x2eb6('0x1e')](_0x2eb6('0x1f'),_0x21a4ea,_0x2eb6('0x1d'),JSON[_0x2eb6('0x20')](_0x667f5d));if(_0x667f5d[_0x2eb6('0x21')]){if(_0x667f5d[_0x2eb6('0x21')][_0x2eb6('0x22')]===0x1f4){logger['error'](_0x2eb6('0x1c'),_0x21a4ea,_0x667f5d['error'][_0x2eb6('0x23')]);return _0x1c9e5c(_0x667f5d[_0x2eb6('0x21')]['message']);}logger['error']('ZendeskAccount,\x20%s,\x20%s',_0x21a4ea,_0x667f5d[_0x2eb6('0x21')][_0x2eb6('0x23')]);return _0x4183f0(_0x667f5d[_0x2eb6('0x21')][_0x2eb6('0x23')]);}else{logger[_0x2eb6('0x1b')](_0x2eb6('0x1c'),_0x21a4ea,_0x2eb6('0x1d'));_0x4183f0(_0x667f5d['result']['message']);}})[_0x2eb6('0x24')](function(_0xc9333a){logger['error'](_0x2eb6('0x1c'),_0x21a4ea,_0xc9333a);_0x1c9e5c(_0xc9333a);});});}function respondWithStatusCode(_0x17b739,_0x5e8aea){_0x5e8aea=_0x5e8aea||0xcc;return function(_0x23ad1c){if(_0x23ad1c){return _0x17b739[_0x2eb6('0x25')](_0x5e8aea);}return _0x17b739['status'](_0x5e8aea)[_0x2eb6('0x26')]();};}function respondWithResult(_0x20a401,_0x1801f1){_0x1801f1=_0x1801f1||0xc8;return function(_0x15e9e2){if(_0x15e9e2){return _0x20a401[_0x2eb6('0x27')](_0x1801f1)[_0x2eb6('0x28')](_0x15e9e2);}};}function respondWithFilteredResult(_0x411689,_0x14a4a5){return function(_0x40ff9f){if(_0x40ff9f){var _0xfa7a2d=_0x40ff9f[_0x2eb6('0x29')],_0x4c2e31=_0x14a4a5[_0x2eb6('0x2a')],_0x28787f=_0x14a4a5[_0x2eb6('0x2a')]+_0x14a4a5['limit'],_0x3a002c;if(_0x28787f>=_0xfa7a2d){_0x28787f=_0xfa7a2d;_0x3a002c=0xc8;}else{_0x3a002c=0xce;}_0x411689['status'](_0x3a002c);return _0x411689[_0x2eb6('0x2b')]('Content-Range',_0x4c2e31+'-'+_0x28787f+'/'+_0xfa7a2d)[_0x2eb6('0x28')](_0x40ff9f);}return null;};}function patchUpdates(_0x3c37a2){return function(_0x137d6c){try{jsonpatch[_0x2eb6('0x2c')](_0x137d6c,_0x3c37a2,!![]);}catch(_0x51db13){return BPromise[_0x2eb6('0x2d')](_0x51db13);}return _0x137d6c[_0x2eb6('0x2e')]();};}function saveUpdates(_0x2e6dde,_0x22a2b6){return function(_0x1024ea){if(_0x1024ea){return _0x1024ea[_0x2eb6('0x2f')](_0x2e6dde)['then'](function(_0x198318){return _0x198318;});}return null;};}function removeEntity(_0x323930,_0x3772e9){return function(_0x1d73b6){if(_0x1d73b6){return _0x1d73b6[_0x2eb6('0x30')]()[_0x2eb6('0x1a')](function(){_0x323930[_0x2eb6('0x27')](0xcc)[_0x2eb6('0x26')]();});}};}function handleEntityNotFound(_0x18affe,_0x29b462){return function(_0x22ccd2){if(!_0x22ccd2){_0x18affe['sendStatus'](0x194);}return _0x22ccd2;};}function handleError(_0x36ce2c,_0x4269d4){_0x4269d4=_0x4269d4||0x1f4;return function(_0x37bc80){logger[_0x2eb6('0x21')](_0x37bc80[_0x2eb6('0x31')]);if(_0x37bc80['name']){delete _0x37bc80['name'];}_0x36ce2c[_0x2eb6('0x27')](_0x4269d4)[_0x2eb6('0x32')](_0x37bc80);};}exports['index']=function(_0xda0164,_0x413239){var _0x39857f={},_0xb505be={},_0x37fa1c={'count':0x0,'rows':[]};var _0x4beac2=_[_0x2eb6('0x33')](db[_0x2eb6('0x34')]['rawAttributes'],function(_0x584112){return{'name':_0x584112[_0x2eb6('0x35')],'type':_0x584112[_0x2eb6('0x36')][_0x2eb6('0x37')]};});_0xb505be[_0x2eb6('0x38')]=_[_0x2eb6('0x33')](_0x4beac2,_0x2eb6('0x39'));_0xb505be[_0x2eb6('0x3a')]=_[_0x2eb6('0x3b')](_0xda0164[_0x2eb6('0x3a')]);_0xb505be[_0x2eb6('0x3c')]=_[_0x2eb6('0x3d')](_0xb505be['model'],_0xb505be[_0x2eb6('0x3a')]);_0x39857f['attributes']=_[_0x2eb6('0x3d')](_0xb505be[_0x2eb6('0x38')],qs[_0x2eb6('0x3e')](_0xda0164[_0x2eb6('0x3a')][_0x2eb6('0x3e')]));_0x39857f['attributes']=_0x39857f[_0x2eb6('0x3f')][_0x2eb6('0x40')]?_0x39857f[_0x2eb6('0x3f')]:_0xb505be[_0x2eb6('0x38')];if(!_0xda0164['query'][_0x2eb6('0x41')](_0x2eb6('0x42'))){_0x39857f['limit']=qs[_0x2eb6('0x43')](_0xda0164[_0x2eb6('0x3a')]['limit']);_0x39857f[_0x2eb6('0x2a')]=qs[_0x2eb6('0x2a')](_0xda0164[_0x2eb6('0x3a')]['offset']);}_0x39857f[_0x2eb6('0x44')]=qs[_0x2eb6('0x45')](_0xda0164[_0x2eb6('0x3a')][_0x2eb6('0x45')]);_0x39857f[_0x2eb6('0x46')]=qs['filters'](_[_0x2eb6('0x47')](_0xda0164[_0x2eb6('0x3a')],_0xb505be[_0x2eb6('0x3c')]));if(_0xda0164[_0x2eb6('0x3a')][_0x2eb6('0x48')]){_0x39857f[_0x2eb6('0x46')]=_[_0x2eb6('0x49')](_0x39857f['where'],{'$or':_['map'](_0x4beac2,function(_0x5b49a7){if(_0x5b49a7[_0x2eb6('0x36')]!==_0x2eb6('0x4a')){var _0x40381f={};_0x40381f[_0x5b49a7[_0x2eb6('0x39')]]={'$like':'%'+_0xda0164[_0x2eb6('0x3a')][_0x2eb6('0x48')]+'%'};return _0x40381f;}})});}_0x39857f=_[_0x2eb6('0x49')]({},_0x39857f,_0xda0164[_0x2eb6('0x4b')]);var _0x1cc9af={'where':_0x39857f[_0x2eb6('0x46')]};return db[_0x2eb6('0x34')][_0x2eb6('0x29')](_0x1cc9af)[_0x2eb6('0x1a')](function(_0x11150b){_0x37fa1c['count']=_0x11150b;if(_0xda0164[_0x2eb6('0x3a')][_0x2eb6('0x4c')]){_0x39857f[_0x2eb6('0x4d')]=[{'all':!![]}];}return db[_0x2eb6('0x34')][_0x2eb6('0x4e')](_0x39857f);})[_0x2eb6('0x1a')](function(_0x1a65c8){_0x37fa1c['rows']=_0x1a65c8;return _0x37fa1c;})[_0x2eb6('0x1a')](respondWithFilteredResult(_0x413239,_0x39857f))[_0x2eb6('0x24')](handleError(_0x413239,null));};exports[_0x2eb6('0x4f')]=function(_0x3af8e7,_0x5f4ce8){var _0x2e4277={'raw':![],'where':{'id':_0x3af8e7[_0x2eb6('0x50')]['id']}},_0x1efa27={};_0x1efa27['model']=_[_0x2eb6('0x3b')](db[_0x2eb6('0x34')]['rawAttributes']);_0x1efa27['query']=_[_0x2eb6('0x3b')](_0x3af8e7[_0x2eb6('0x3a')]);_0x1efa27[_0x2eb6('0x3c')]=_[_0x2eb6('0x3d')](_0x1efa27[_0x2eb6('0x38')],_0x1efa27[_0x2eb6('0x3a')]);_0x2e4277[_0x2eb6('0x3f')]=_[_0x2eb6('0x3d')](_0x1efa27[_0x2eb6('0x38')],qs['fields'](_0x3af8e7[_0x2eb6('0x3a')][_0x2eb6('0x3e')]));_0x2e4277[_0x2eb6('0x3f')]=_0x2e4277[_0x2eb6('0x3f')][_0x2eb6('0x40')]?_0x2e4277['attributes']:_0x1efa27[_0x2eb6('0x38')];if(_0x3af8e7[_0x2eb6('0x3a')][_0x2eb6('0x4c')]){_0x2e4277[_0x2eb6('0x4d')]=[{'all':!![]}];}_0x2e4277=_[_0x2eb6('0x49')]({},_0x2e4277,_0x3af8e7[_0x2eb6('0x4b')]);return db[_0x2eb6('0x34')][_0x2eb6('0x51')](_0x2e4277)[_0x2eb6('0x1a')](handleEntityNotFound(_0x5f4ce8,null))[_0x2eb6('0x1a')](respondWithResult(_0x5f4ce8,null))[_0x2eb6('0x24')](handleError(_0x5f4ce8,null));};exports[_0x2eb6('0x52')]=function(_0x2220f8,_0x4de830){return db[_0x2eb6('0x34')][_0x2eb6('0x52')](_0x2220f8['body'],{})[_0x2eb6('0x1a')](respondWithResult(_0x4de830,0xc9))[_0x2eb6('0x24')](handleError(_0x4de830,null));};exports['update']=function(_0x4e4e33,_0x43f200){if(_0x4e4e33[_0x2eb6('0x53')]['id']){delete _0x4e4e33['body']['id'];}return db[_0x2eb6('0x34')][_0x2eb6('0x51')]({'where':{'id':_0x4e4e33[_0x2eb6('0x50')]['id']}})[_0x2eb6('0x1a')](handleEntityNotFound(_0x43f200,null))[_0x2eb6('0x1a')](saveUpdates(_0x4e4e33[_0x2eb6('0x53')],null))['then'](respondWithResult(_0x43f200,null))[_0x2eb6('0x24')](handleError(_0x43f200,null));};exports[_0x2eb6('0x30')]=function(_0x54d3f7,_0x13c286){return db[_0x2eb6('0x34')][_0x2eb6('0x51')]({'where':{'id':_0x54d3f7[_0x2eb6('0x50')]['id']}})[_0x2eb6('0x1a')](handleEntityNotFound(_0x13c286,null))['then'](removeEntity(_0x13c286,null))[_0x2eb6('0x24')](handleError(_0x13c286,null));};exports[_0x2eb6('0x54')]=function(_0x1910d6,_0x9a9435,_0x53e5de){var _0x348a60={};var _0x3fef67={};var _0x120fdd;var _0x15c2fc;return db['ZendeskAccount'][_0x2eb6('0x55')]({'where':{'id':_0x1910d6[_0x2eb6('0x50')]['id']}})[_0x2eb6('0x1a')](handleEntityNotFound(_0x9a9435,null))[_0x2eb6('0x1a')](function(_0x45f663){if(_0x45f663){_0x120fdd=_0x45f663;_0x3fef67[_0x2eb6('0x38')]=_[_0x2eb6('0x3b')](db[_0x2eb6('0x56')][_0x2eb6('0x57')]);_0x3fef67[_0x2eb6('0x3a')]=_[_0x2eb6('0x3b')](_0x1910d6[_0x2eb6('0x3a')]);_0x3fef67[_0x2eb6('0x3c')]=_[_0x2eb6('0x3d')](_0x3fef67[_0x2eb6('0x38')],_0x3fef67['query']);_0x348a60['attributes']=_[_0x2eb6('0x3d')](_0x3fef67[_0x2eb6('0x38')],qs['fields'](_0x1910d6[_0x2eb6('0x3a')]['fields']));_0x348a60['attributes']=_0x348a60[_0x2eb6('0x3f')][_0x2eb6('0x40')]?_0x348a60[_0x2eb6('0x3f')]:_0x3fef67['model'];_0x348a60['order']=qs[_0x2eb6('0x45')](_0x1910d6[_0x2eb6('0x3a')][_0x2eb6('0x45')]);_0x348a60[_0x2eb6('0x46')]=qs[_0x2eb6('0x3c')](_['pick'](_0x1910d6[_0x2eb6('0x3a')],_0x3fef67[_0x2eb6('0x3c')]));if(_0x1910d6[_0x2eb6('0x3a')][_0x2eb6('0x48')]){_0x348a60[_0x2eb6('0x46')]=_['merge'](_0x348a60['where'],{'$or':_[_0x2eb6('0x33')](_0x348a60[_0x2eb6('0x3f')],function(_0x497b30){var _0x4d3a09={};_0x4d3a09[_0x497b30]={'$like':'%'+_0x1910d6[_0x2eb6('0x3a')][_0x2eb6('0x48')]+'%'};return _0x4d3a09;})});}_0x348a60=_['merge']({},_0x348a60,_0x1910d6[_0x2eb6('0x4b')]);return _0x120fdd['getConfigurations'](_0x348a60);}})[_0x2eb6('0x1a')](function(_0x597d0b){if(_0x597d0b){_0x15c2fc=_0x597d0b[_0x2eb6('0x40')];if(!_0x1910d6[_0x2eb6('0x3a')][_0x2eb6('0x41')](_0x2eb6('0x42'))){_0x348a60['limit']=qs[_0x2eb6('0x43')](_0x1910d6[_0x2eb6('0x3a')][_0x2eb6('0x43')]);_0x348a60[_0x2eb6('0x2a')]=qs['offset'](_0x1910d6['query'][_0x2eb6('0x2a')]);}return _0x120fdd[_0x2eb6('0x54')](_0x348a60);}})['then'](function(_0x48085f){if(_0x48085f){return _0x48085f?{'count':_0x15c2fc,'rows':_0x48085f}:null;}})[_0x2eb6('0x1a')](respondWithResult(_0x9a9435,null))[_0x2eb6('0x24')](handleError(_0x9a9435,null));};exports[_0x2eb6('0x58')]=function(_0x300d88,_0x5acc88,_0x116432){if(_0x300d88[_0x2eb6('0x53')]['id']){delete _0x300d88[_0x2eb6('0x53')]['id'];}return db[_0x2eb6('0x34')][_0x2eb6('0x55')]({'where':{'id':_0x300d88[_0x2eb6('0x50')]['id']}})[_0x2eb6('0x1a')](handleEntityNotFound(_0x5acc88,null))[_0x2eb6('0x1a')](function(_0x3cebe0){if(_0x3cebe0){_0x300d88['body'][_0x2eb6('0x59')]=_0x3cebe0['id'];_0x300d88['body'][_0x2eb6('0x5a')]=integrations[_0x2eb6('0x5b')](_0x300d88[_0x2eb6('0x53')]['channel'],_0x300d88[_0x2eb6('0x53')]['type']);_0x300d88[_0x2eb6('0x53')][_0x2eb6('0x5c')]=integrations[_0x2eb6('0x5d')](_0x300d88[_0x2eb6('0x53')][_0x2eb6('0x5e')],_0x300d88[_0x2eb6('0x53')]['type']);return db['ZendeskConfiguration'][_0x2eb6('0x52')](_0x300d88['body'],{'include':[{'model':db[_0x2eb6('0x5f')],'as':_0x2eb6('0x5a')},{'model':db[_0x2eb6('0x5f')],'as':_0x2eb6('0x5c')}]});}return null;})['then'](respondWithResult(_0x5acc88,null))[_0x2eb6('0x24')](handleError(_0x5acc88,null));};exports['getFields']=function(_0xe1acec,_0x56c736,_0x22648b){var _0x2ed7b0='';return db['ZendeskAccount'][_0x2eb6('0x55')]({'where':{'id':_0xe1acec[_0x2eb6('0x50')]['id']},'attributes':['id','username',_0x2eb6('0x60'),_0x2eb6('0x61'),_0x2eb6('0x62'),_0x2eb6('0x63')]})[_0x2eb6('0x1a')](handleEntityNotFound(_0x56c736,null))[_0x2eb6('0x1a')](function(_0x10fd8d){if(_0x10fd8d){_0x2ed7b0=_0x10fd8d[_0x2eb6('0x63')];var _0x4bd08e=_0x2ed7b0[_0x2eb6('0x64')](-0x1);if(_0x4bd08e==='/'){_0x2ed7b0=_0x2ed7b0[_0x2eb6('0x65')](0x0,_0x2ed7b0['lastIndexOf'](_0x4bd08e));}var _0x1a6e70={'method':_0x2eb6('0x66'),'uri':util[_0x2eb6('0x67')](_0x2eb6('0x68'),_0x2ed7b0,'ticket_fields'),'json':!![]};switch(_0x10fd8d['authType']){case'password':_0x1a6e70[_0x2eb6('0x69')]={'Authorization':util[_0x2eb6('0x67')](_0x2eb6('0x6a'),new Buffer(util['format'](_0x2eb6('0x6b'),_0x10fd8d[_0x2eb6('0x6c')],_0x10fd8d['password']))['toString']('base64'))};break;case _0x2eb6('0x61'):_0x1a6e70[_0x2eb6('0x69')]={'Authorization':util['format'](_0x2eb6('0x6a'),new Buffer(util[_0x2eb6('0x67')](_0x2eb6('0x6d'),_0x10fd8d['username'],_0x10fd8d['token']))['toString'](_0x2eb6('0x6e')))};break;default:throw new db[(_0x2eb6('0x17'))][(_0x2eb6('0x6f'))]('Unknown\x20authentication\x20type');}return rp(_0x1a6e70);}})[_0x2eb6('0x1a')](function(_0x348ffa){if(_0x348ffa){var _0x44daf4=['subject',_0x2eb6('0x70'),_0x2eb6('0x71'),'assignee'];_['remove'](_0x348ffa[_0x2eb6('0x72')],function(_0x3b3864){return _0x44daf4[_0x2eb6('0x73')](_0x3b3864[_0x2eb6('0x36')]);});return{'count':_0x348ffa['ticket_fields'][_0x2eb6('0x40')],'rows':_[_0x2eb6('0x33')](_0x348ffa['ticket_fields'],function(_0x12083f){return{'id':_0x12083f['id'],'name':_0x12083f[_0x2eb6('0x74')]>0x7?_0x12083f[_0x2eb6('0x75')]:_0x12083f[_0x2eb6('0x36')],'custom':_0x12083f['position']>0x7?!![]:![],'options':_0x12083f[_0x2eb6('0x76')]?_0x12083f[_0x2eb6('0x76')]:_0x12083f['custom_field_options']?_0x12083f[_0x2eb6('0x77')]:[]};})};}})[_0x2eb6('0x1a')](respondWithResult(_0x56c736,null))[_0x2eb6('0x24')](function(_0x38fd7e){var _0x3b3126=_0xe1acec[_0x2eb6('0x3a')][_0x2eb6('0x16')]?0x1f4:_0x38fd7e[_0x2eb6('0x78')]||0x1f4;logger[_0x2eb6('0x21')](_0x2eb6('0x79'),'getFields',_0x3b3126,JSON[_0x2eb6('0x20')](_0x38fd7e));delete _0x38fd7e[_0x2eb6('0x39')];if(_0x3b3126===0x191){_0x3b3126=0x190;}_0x56c736[_0x2eb6('0x27')](_0x3b3126)[_0x2eb6('0x32')](_0xe1acec['query'][_0x2eb6('0x16')]?{'message':_0x2eb6('0x7a'),'statusCode':_0x38fd7e[_0x2eb6('0x78')]}:_0x38fd7e);});}; \ No newline at end of file diff --git a/server/api/intZendeskAccount/intZendeskAccount.model.js b/server/api/intZendeskAccount/intZendeskAccount.model.js index 7d9de20..8099a05 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 _0xfcdf=['int_zendesk_accounts','util','moment','rimraf','exports','define','ZendeskAccount'];(function(_0x22d1f,_0x57af7d){var _0x3abf50=function(_0x3e3128){while(--_0x3e3128){_0x22d1f['push'](_0x22d1f['shift']());}};_0x3abf50(++_0x57af7d);}(_0xfcdf,0xb0));var _0xffcd=function(_0x13215e,_0x414851){_0x13215e=_0x13215e-0x0;var _0xf2bed0=_0xfcdf[_0x13215e];return _0xf2bed0;};'use strict';var _=require('lodash');var util=require(_0xffcd('0x0'));var logger=require('../../config/logger')('api');var moment=require(_0xffcd('0x1'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0xffcd('0x2'));var config=require('../../config/environment');var attributes=require('./intZendeskAccount.attributes');var integrations=require('../../components/integrations/configuration');module[_0xffcd('0x3')]=function(_0x5e271c,_0x3e48b8){return _0x5e271c[_0xffcd('0x4')](_0xffcd('0x5'),attributes,{'tableName':_0xffcd('0x6'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x5739=['rimraf','define','ZendeskAccount','int_zendesk_accounts','lodash','../../config/logger','moment','bluebird','request-promise','path'];(function(_0x133891,_0x34edf7){var _0x34ed8c=function(_0xda8aeb){while(--_0xda8aeb){_0x133891['push'](_0x133891['shift']());}};_0x34ed8c(++_0x34edf7);}(_0x5739,0xc2));var _0x9573=function(_0x46ad77,_0x5d57e2){_0x46ad77=_0x46ad77-0x0;var _0x95f2af=_0x5739[_0x46ad77];return _0x95f2af;};'use strict';var _=require(_0x9573('0x0'));var util=require('util');var logger=require(_0x9573('0x1'))('api');var moment=require(_0x9573('0x2'));var BPromise=require(_0x9573('0x3'));var rp=require(_0x9573('0x4'));var fs=require('fs');var path=require(_0x9573('0x5'));var rimraf=require(_0x9573('0x6'));var config=require('../../config/environment');var attributes=require('./intZendeskAccount.attributes');var integrations=require('../../components/integrations/configuration');module['exports']=function(_0x41df10,_0x5a9bad){return _0x41df10[_0x9573('0x7')](_0x9573('0x8'),attributes,{'tableName':_0x9573('0x9'),'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 bf10f9b..d7e1e10 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 _0x757a=['stringify','error','message','result','catch','GetZendeskAccount','ZendeskAccount','findAll','options','where','attributes','limit','include','map','model','ShowZendeskAccount','find','raw','util','moment','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','info','ZendeskAccount,\x20%s,\x20%s','request\x20sent','debug','ZendeskAccount,\x20%s,\x20%s,\x20%s'];(function(_0x2b420d,_0x2bf963){var _0xf638cf=function(_0x50bb96){while(--_0x50bb96){_0x2b420d['push'](_0x2b420d['shift']());}};_0xf638cf(++_0x2bf963);}(_0x757a,0xde));var _0xa757=function(_0x1ba985,_0x19b2d9){_0x1ba985=_0x1ba985-0x0;var _0x10b50c=_0x757a[_0x1ba985];return _0x10b50c;};'use strict';var _=require('lodash');var util=require(_0xa757('0x0'));var moment=require(_0xa757('0x1'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0xa757('0x2'))['db'];var utils=require(_0xa757('0x3'));var logger=require(_0xa757('0x4'))(_0xa757('0x5'));var config=require(_0xa757('0x6'));var jayson=require(_0xa757('0x7'));var client=jayson['client'][_0xa757('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x4343b6,_0x53be0e,_0x2930fa){return new BPromise(function(_0x2f7793,_0x447344){return client[_0xa757('0x9')](_0x4343b6,_0x2930fa)[_0xa757('0xa')](function(_0x5aef8a){logger[_0xa757('0xb')](_0xa757('0xc'),_0x53be0e,_0xa757('0xd'));logger[_0xa757('0xe')](_0xa757('0xf'),_0x53be0e,_0xa757('0xd'),JSON[_0xa757('0x10')](_0x5aef8a));if(_0x5aef8a['error']){if(_0x5aef8a['error']['code']===0x1f4){logger['error']('ZendeskAccount,\x20%s,\x20%s',_0x53be0e,_0x5aef8a[_0xa757('0x11')]['message']);return _0x447344(_0x5aef8a['error'][_0xa757('0x12')]);}logger['error']('ZendeskAccount,\x20%s,\x20%s',_0x53be0e,_0x5aef8a[_0xa757('0x11')][_0xa757('0x12')]);return _0x2f7793(_0x5aef8a[_0xa757('0x11')][_0xa757('0x12')]);}else{logger[_0xa757('0xb')](_0xa757('0xc'),_0x53be0e,_0xa757('0xd'));_0x2f7793(_0x5aef8a[_0xa757('0x13')][_0xa757('0x12')]);}})[_0xa757('0x14')](function(_0x50aac1){logger[_0xa757('0x11')](_0xa757('0xc'),_0x53be0e,_0x50aac1);_0x447344(_0x50aac1);});});}exports[_0xa757('0x15')]=function(_0x4d9f58){var _0x54b305=this;return new Promise(function(_0x151c04,_0x468d45){return db[_0xa757('0x16')][_0xa757('0x17')]({'raw':_0x4d9f58[_0xa757('0x18')]?_0x4d9f58[_0xa757('0x18')]['raw']===undefined?!![]:![]:!![],'where':_0x4d9f58[_0xa757('0x18')]?_0x4d9f58['options'][_0xa757('0x19')]||null:null,'attributes':_0x4d9f58[_0xa757('0x18')]?_0x4d9f58[_0xa757('0x18')][_0xa757('0x1a')]||null:null,'limit':_0x4d9f58['options']?_0x4d9f58['options'][_0xa757('0x1b')]||null:null,'include':_0x4d9f58[_0xa757('0x18')]?_0x4d9f58[_0xa757('0x18')][_0xa757('0x1c')]?_[_0xa757('0x1d')](_0x4d9f58[_0xa757('0x18')][_0xa757('0x1c')],function(_0x21f1af){return{'model':db[_0x21f1af[_0xa757('0x1e')]],'as':_0x21f1af['as'],'attributes':_0x21f1af['attributes'],'include':_0x21f1af[_0xa757('0x1c')]?_['map'](_0x21f1af[_0xa757('0x1c')],function(_0x47903b){return{'model':db[_0x47903b[_0xa757('0x1e')]],'as':_0x47903b['as'],'attributes':_0x47903b[_0xa757('0x1a')],'include':_0x47903b[_0xa757('0x1c')]?_['map'](_0x47903b[_0xa757('0x1c')],function(_0xcd98bd){return{'model':db[_0xcd98bd[_0xa757('0x1e')]],'as':_0xcd98bd['as'],'attributes':_0xcd98bd[_0xa757('0x1a')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x449a7d){logger['info']('GetZendeskAccount',_0x4d9f58);logger['debug']('GetZendeskAccount',_0x4d9f58,JSON[_0xa757('0x10')](_0x449a7d));_0x151c04(_0x449a7d);})['catch'](function(_0x2208f9){logger[_0xa757('0x11')]('GetZendeskAccount',_0x2208f9[_0xa757('0x12')],_0x4d9f58);_0x468d45(_0x54b305['error'](0x1f4,_0x2208f9[_0xa757('0x12')]));});});};exports[_0xa757('0x1f')]=function(_0x5307c3){var _0x235e54=this;return new Promise(function(_0x5ade7b,_0x3a4a66){return db[_0xa757('0x16')][_0xa757('0x20')]({'raw':_0x5307c3[_0xa757('0x18')]?_0x5307c3[_0xa757('0x18')][_0xa757('0x21')]===undefined?!![]:![]:!![],'where':_0x5307c3[_0xa757('0x18')]?_0x5307c3[_0xa757('0x18')][_0xa757('0x19')]||null:null,'attributes':_0x5307c3[_0xa757('0x18')]?_0x5307c3[_0xa757('0x18')][_0xa757('0x1a')]||null:null,'include':_0x5307c3[_0xa757('0x18')]?_0x5307c3[_0xa757('0x18')][_0xa757('0x1c')]?_[_0xa757('0x1d')](_0x5307c3[_0xa757('0x18')][_0xa757('0x1c')],function(_0x1eacde){return{'model':db[_0x1eacde[_0xa757('0x1e')]],'as':_0x1eacde['as'],'attributes':_0x1eacde[_0xa757('0x1a')],'include':_0x1eacde[_0xa757('0x1c')]?_[_0xa757('0x1d')](_0x1eacde[_0xa757('0x1c')],function(_0x59700d){return{'model':db[_0x59700d[_0xa757('0x1e')]],'as':_0x59700d['as'],'attributes':_0x59700d[_0xa757('0x1a')],'include':_0x59700d[_0xa757('0x1c')]?_[_0xa757('0x1d')](_0x59700d[_0xa757('0x1c')],function(_0x51e2aa){return{'model':db[_0x51e2aa[_0xa757('0x1e')]],'as':_0x51e2aa['as'],'attributes':_0x51e2aa[_0xa757('0x1a')]};}):[]};}):[]};}):[]:[]})[_0xa757('0xa')](function(_0x2c34b1){logger[_0xa757('0xb')](_0xa757('0x1f'),_0x5307c3);logger['debug'](_0xa757('0x1f'),_0x5307c3,JSON[_0xa757('0x10')](_0x2c34b1));_0x5ade7b(_0x2c34b1);})[_0xa757('0x14')](function(_0xc34409){logger[_0xa757('0x11')](_0xa757('0x1f'),_0xc34409[_0xa757('0x12')],_0x5307c3);_0x3a4a66(_0x235e54[_0xa757('0x11')](0x1f4,_0xc34409[_0xa757('0x12')]));});});}; \ No newline at end of file +var _0xb7e7=['request','then','info','ZendeskAccount,\x20%s,\x20%s','debug','ZendeskAccount,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','catch','GetZendeskAccount','ZendeskAccount','findAll','options','raw','attributes','limit','include','map','model','ShowZendeskAccount','find','where','lodash','moment','randomstring','../../mysqldb','../../config/logger','rpc','../../config/environment','http'];(function(_0x9e535e,_0x38dbb3){var _0x3b139f=function(_0x44a438){while(--_0x44a438){_0x9e535e['push'](_0x9e535e['shift']());}};_0x3b139f(++_0x38dbb3);}(_0xb7e7,0x121));var _0x7b7e=function(_0x9df060,_0x253d33){_0x9df060=_0x9df060-0x0;var _0x338dfe=_0xb7e7[_0x9df060];return _0x338dfe;};'use strict';var _=require(_0x7b7e('0x0'));var util=require('util');var moment=require(_0x7b7e('0x1'));var BPromise=require('bluebird');var rs=require(_0x7b7e('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x7b7e('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0x7b7e('0x4'))(_0x7b7e('0x5'));var config=require(_0x7b7e('0x6'));var jayson=require('jayson/promise');var client=jayson['client'][_0x7b7e('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x372bde,_0x7f87e0,_0x55ce81){return new BPromise(function(_0x42b871,_0x223587){return client[_0x7b7e('0x8')](_0x372bde,_0x55ce81)[_0x7b7e('0x9')](function(_0x148964){logger[_0x7b7e('0xa')](_0x7b7e('0xb'),_0x7f87e0,'request\x20sent');logger[_0x7b7e('0xc')](_0x7b7e('0xd'),_0x7f87e0,_0x7b7e('0xe'),JSON[_0x7b7e('0xf')](_0x148964));if(_0x148964[_0x7b7e('0x10')]){if(_0x148964[_0x7b7e('0x10')][_0x7b7e('0x11')]===0x1f4){logger[_0x7b7e('0x10')](_0x7b7e('0xb'),_0x7f87e0,_0x148964['error'][_0x7b7e('0x12')]);return _0x223587(_0x148964[_0x7b7e('0x10')]['message']);}logger[_0x7b7e('0x10')]('ZendeskAccount,\x20%s,\x20%s',_0x7f87e0,_0x148964['error'][_0x7b7e('0x12')]);return _0x42b871(_0x148964[_0x7b7e('0x10')][_0x7b7e('0x12')]);}else{logger[_0x7b7e('0xa')](_0x7b7e('0xb'),_0x7f87e0,'request\x20sent');_0x42b871(_0x148964['result'][_0x7b7e('0x12')]);}})[_0x7b7e('0x13')](function(_0x27f999){logger[_0x7b7e('0x10')](_0x7b7e('0xb'),_0x7f87e0,_0x27f999);_0x223587(_0x27f999);});});}exports[_0x7b7e('0x14')]=function(_0x242368){var _0x200ef7=this;return new Promise(function(_0x2acb8c,_0x429a0e){return db[_0x7b7e('0x15')][_0x7b7e('0x16')]({'raw':_0x242368[_0x7b7e('0x17')]?_0x242368[_0x7b7e('0x17')][_0x7b7e('0x18')]===undefined?!![]:![]:!![],'where':_0x242368[_0x7b7e('0x17')]?_0x242368[_0x7b7e('0x17')]['where']||null:null,'attributes':_0x242368[_0x7b7e('0x17')]?_0x242368[_0x7b7e('0x17')][_0x7b7e('0x19')]||null:null,'limit':_0x242368['options']?_0x242368[_0x7b7e('0x17')][_0x7b7e('0x1a')]||null:null,'include':_0x242368[_0x7b7e('0x17')]?_0x242368[_0x7b7e('0x17')][_0x7b7e('0x1b')]?_[_0x7b7e('0x1c')](_0x242368[_0x7b7e('0x17')][_0x7b7e('0x1b')],function(_0x53bbb3){return{'model':db[_0x53bbb3['model']],'as':_0x53bbb3['as'],'attributes':_0x53bbb3['attributes'],'include':_0x53bbb3[_0x7b7e('0x1b')]?_[_0x7b7e('0x1c')](_0x53bbb3[_0x7b7e('0x1b')],function(_0x483c6f){return{'model':db[_0x483c6f['model']],'as':_0x483c6f['as'],'attributes':_0x483c6f['attributes'],'include':_0x483c6f[_0x7b7e('0x1b')]?_[_0x7b7e('0x1c')](_0x483c6f[_0x7b7e('0x1b')],function(_0x7aa71){return{'model':db[_0x7aa71[_0x7b7e('0x1d')]],'as':_0x7aa71['as'],'attributes':_0x7aa71['attributes']};}):[]};}):[]};}):[]:[]})[_0x7b7e('0x9')](function(_0x21a15){logger['info']('GetZendeskAccount',_0x242368);logger['debug'](_0x7b7e('0x14'),_0x242368,JSON[_0x7b7e('0xf')](_0x21a15));_0x2acb8c(_0x21a15);})['catch'](function(_0x3db8c4){logger['error'](_0x7b7e('0x14'),_0x3db8c4[_0x7b7e('0x12')],_0x242368);_0x429a0e(_0x200ef7[_0x7b7e('0x10')](0x1f4,_0x3db8c4['message']));});});};exports[_0x7b7e('0x1e')]=function(_0xe31336){var _0x35602a=this;return new Promise(function(_0x326dd2,_0x33f9a1){return db['ZendeskAccount'][_0x7b7e('0x1f')]({'raw':_0xe31336['options']?_0xe31336[_0x7b7e('0x17')][_0x7b7e('0x18')]===undefined?!![]:![]:!![],'where':_0xe31336[_0x7b7e('0x17')]?_0xe31336[_0x7b7e('0x17')][_0x7b7e('0x20')]||null:null,'attributes':_0xe31336[_0x7b7e('0x17')]?_0xe31336[_0x7b7e('0x17')]['attributes']||null:null,'include':_0xe31336['options']?_0xe31336[_0x7b7e('0x17')][_0x7b7e('0x1b')]?_['map'](_0xe31336[_0x7b7e('0x17')][_0x7b7e('0x1b')],function(_0x2ca366){return{'model':db[_0x2ca366['model']],'as':_0x2ca366['as'],'attributes':_0x2ca366[_0x7b7e('0x19')],'include':_0x2ca366[_0x7b7e('0x1b')]?_[_0x7b7e('0x1c')](_0x2ca366[_0x7b7e('0x1b')],function(_0x31043a){return{'model':db[_0x31043a[_0x7b7e('0x1d')]],'as':_0x31043a['as'],'attributes':_0x31043a[_0x7b7e('0x19')],'include':_0x31043a[_0x7b7e('0x1b')]?_[_0x7b7e('0x1c')](_0x31043a[_0x7b7e('0x1b')],function(_0xd5a64d){return{'model':db[_0xd5a64d[_0x7b7e('0x1d')]],'as':_0xd5a64d['as'],'attributes':_0xd5a64d[_0x7b7e('0x19')]};}):[]};}):[]};}):[]:[]})[_0x7b7e('0x9')](function(_0x116563){logger[_0x7b7e('0xa')]('ShowZendeskAccount',_0xe31336);logger[_0x7b7e('0xc')](_0x7b7e('0x1e'),_0xe31336,JSON[_0x7b7e('0xf')](_0x116563));_0x326dd2(_0x116563);})[_0x7b7e('0x13')](function(_0x36abfc){logger[_0x7b7e('0x10')](_0x7b7e('0x1e'),_0x36abfc[_0x7b7e('0x12')],_0xe31336);_0x33f9a1(_0x35602a[_0x7b7e('0x10')](0x1f4,_0x36abfc[_0x7b7e('0x12')]));});});}; \ No newline at end of file diff --git a/server/api/intZendeskConfiguration/index.js b/server/api/intZendeskConfiguration/index.js index 4a39116..6b6dbe2 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 _0x3f9d=['./intZendeskConfiguration.controller','get','index','/:id','show','/:id/fields','isAuthenticated','getFields','/:id/subjects','getSubjects','/:id/descriptions','getDescriptions','/:id/tags','getTags','post','create','put','delete','exports','multer','util','path','connect-timeout','express','../../components/interaction/service'];(function(_0x492649,_0x3c6d30){var _0x2e6f93=function(_0x52f085){while(--_0x52f085){_0x492649['push'](_0x492649['shift']());}};_0x2e6f93(++_0x3c6d30);}(_0x3f9d,0xf4));var _0xd3f9=function(_0x55fc38,_0x19bc7d){_0x55fc38=_0x55fc38-0x0;var _0x3cd5e4=_0x3f9d[_0x55fc38];return _0x3cd5e4;};'use strict';var multer=require(_0xd3f9('0x0'));var util=require(_0xd3f9('0x1'));var path=require(_0xd3f9('0x2'));var timeout=require(_0xd3f9('0x3'));var express=require(_0xd3f9('0x4'));var router=express['Router']();var auth=require('../../components/auth/service');var interaction=require(_0xd3f9('0x5'));var config=require('../../config/environment');var controller=require(_0xd3f9('0x6'));router[_0xd3f9('0x7')]('/',auth['isAuthenticated'](),controller[_0xd3f9('0x8')]);router[_0xd3f9('0x7')](_0xd3f9('0x9'),auth['isAuthenticated'](),controller[_0xd3f9('0xa')]);router[_0xd3f9('0x7')](_0xd3f9('0xb'),auth[_0xd3f9('0xc')](),controller[_0xd3f9('0xd')]);router[_0xd3f9('0x7')](_0xd3f9('0xe'),auth[_0xd3f9('0xc')](),controller[_0xd3f9('0xf')]);router[_0xd3f9('0x7')](_0xd3f9('0x10'),auth[_0xd3f9('0xc')](),controller[_0xd3f9('0x11')]);router[_0xd3f9('0x7')](_0xd3f9('0x12'),auth['isAuthenticated'](),controller[_0xd3f9('0x13')]);router[_0xd3f9('0x14')]('/',auth['isAuthenticated'](),controller[_0xd3f9('0x15')]);router[_0xd3f9('0x14')](_0xd3f9('0x12'),auth[_0xd3f9('0xc')](),controller['setTags']);router[_0xd3f9('0x16')](_0xd3f9('0x9'),auth[_0xd3f9('0xc')](),controller['update']);router[_0xd3f9('0x17')](_0xd3f9('0x9'),auth[_0xd3f9('0xc')](),controller['destroy']);module[_0xd3f9('0x18')]=router; \ No newline at end of file +var _0x3409=['util','path','../../components/auth/service','../../components/interaction/service','../../config/environment','./intZendeskConfiguration.controller','get','isAuthenticated','index','show','/:id/fields','getFields','/:id/subjects','getSubjects','/:id/descriptions','getTags','create','post','/:id/tags','setTags','put','update','delete','/:id','destroy','exports','multer'];(function(_0x5e901e,_0x3b4509){var _0x202f94=function(_0x175313){while(--_0x175313){_0x5e901e['push'](_0x5e901e['shift']());}};_0x202f94(++_0x3b4509);}(_0x3409,0x194));var _0x9340=function(_0x1b65bb,_0x1195b1){_0x1b65bb=_0x1b65bb-0x0;var _0x509a46=_0x3409[_0x1b65bb];return _0x509a46;};'use strict';var multer=require(_0x9340('0x0'));var util=require(_0x9340('0x1'));var path=require(_0x9340('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express['Router']();var auth=require(_0x9340('0x3'));var interaction=require(_0x9340('0x4'));var config=require(_0x9340('0x5'));var controller=require(_0x9340('0x6'));router[_0x9340('0x7')]('/',auth[_0x9340('0x8')](),controller[_0x9340('0x9')]);router['get']('/:id',auth[_0x9340('0x8')](),controller[_0x9340('0xa')]);router[_0x9340('0x7')](_0x9340('0xb'),auth[_0x9340('0x8')](),controller[_0x9340('0xc')]);router[_0x9340('0x7')](_0x9340('0xd'),auth[_0x9340('0x8')](),controller[_0x9340('0xe')]);router[_0x9340('0x7')](_0x9340('0xf'),auth[_0x9340('0x8')](),controller['getDescriptions']);router['get']('/:id/tags',auth[_0x9340('0x8')](),controller[_0x9340('0x10')]);router['post']('/',auth[_0x9340('0x8')](),controller[_0x9340('0x11')]);router[_0x9340('0x12')](_0x9340('0x13'),auth[_0x9340('0x8')](),controller[_0x9340('0x14')]);router[_0x9340('0x15')]('/:id',auth[_0x9340('0x8')](),controller[_0x9340('0x16')]);router[_0x9340('0x17')](_0x9340('0x18'),auth['isAuthenticated'](),controller[_0x9340('0x19')]);module[_0x9340('0x1a')]=router; \ No newline at end of file diff --git a/server/api/intZendeskConfiguration/intZendeskConfiguration.attributes.js b/server/api/intZendeskConfiguration/intZendeskConfiguration.attributes.js index 0f1c52d..5cc6cb0 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 _0x7512=['STRING','sequelize','exports'];(function(_0x194691,_0x4edc49){var _0xb73d95=function(_0x5e4fdf){while(--_0x5e4fdf){_0x194691['push'](_0x194691['shift']());}};_0xb73d95(++_0x4edc49);}(_0x7512,0x163));var _0x2751=function(_0x59ab65,_0x410a52){_0x59ab65=_0x59ab65-0x0;var _0x57db9b=_0x7512[_0x59ab65];return _0x57db9b;};'use strict';var Sequelize=require(_0x2751('0x0'));module[_0x2751('0x1')]={'name':{'type':Sequelize[_0x2751('0x2')]},'description':{'type':Sequelize[_0x2751('0x2')]}}; \ No newline at end of file +var _0x519a=['STRING','sequelize','exports'];(function(_0xbd1351,_0x4ec620){var _0xe555c4=function(_0x56a698){while(--_0x56a698){_0xbd1351['push'](_0xbd1351['shift']());}};_0xe555c4(++_0x4ec620);}(_0x519a,0x97));var _0xa519=function(_0xbc2974,_0xec3342){_0xbc2974=_0xbc2974-0x0;var _0x3a5b4f=_0x519a[_0xbc2974];return _0x3a5b4f;};'use strict';var Sequelize=require(_0xa519('0x0'));module[_0xa519('0x1')]={'name':{'type':Sequelize[_0xa519('0x2')]},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/intZendeskConfiguration/intZendeskConfiguration.controller.js b/server/api/intZendeskConfiguration/intZendeskConfiguration.controller.js index 9295b17..58a82e0 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 _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(_0x2b6600,_0x24c497){var _0x912ee2=function(_0x5d6484){while(--_0x5d6484){_0x2b6600['push'](_0x2b6600['shift']());}};_0x912ee2(++_0x24c497);}(_0xc4aa,0x1b7));var _0xac4a=function(_0x565ed7,_0x398228){_0x565ed7=_0x565ed7-0x0;var _0x183ad7=_0xc4aa[_0x565ed7];return _0x183ad7;};'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 +var _0x814b=['filters','pick','merge','type','VIRTUAL','filter','options','ZendeskConfiguration','count','includeAll','include','findAll','rows','show','params','keys','find','body','getFields','findOne','ZendeskField','getSubjects','getDescriptions','getTags','setTags','ids','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','to-csv','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../mysqldb','jayson/promise','client','http','test','Sequelize','ValidationError','The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.','request','then','info','request\x20sent','debug','error','ZendeskConfiguration,\x20%s,\x20%s','message','catch','sendStatus','status','end','json','offset','Content-Range','reject','save','update','destroy','stack','name','send','index','map','rawAttributes','fieldName','key','intersection','model','query','attributes','fields','length','hasOwnProperty','nolimit','limit','order','sort','where'];(function(_0x265501,_0x57c6c4){var _0x5060a4=function(_0x6be3d2){while(--_0x6be3d2){_0x265501['push'](_0x265501['shift']());}};_0x5060a4(++_0x57c6c4);}(_0x814b,0x1a2));var _0xb814=function(_0x30c2ae,_0x4c98a2){_0x30c2ae=_0x30c2ae-0x0;var _0x1ee1cc=_0x814b[_0x30c2ae];return _0x1ee1cc;};'use strict';var pdf=require(_0xb814('0x0'));var emlformat=require(_0xb814('0x1'));var rimraf=require(_0xb814('0x2'));var zipdir=require(_0xb814('0x3'));var jsonpatch=require(_0xb814('0x4'));var rp=require(_0xb814('0x5'));var moment=require('moment');var BPromise=require(_0xb814('0x6'));var Mustache=require(_0xb814('0x7'));var util=require(_0xb814('0x8'));var path=require(_0xb814('0x9'));var sox=require(_0xb814('0xa'));var csv=require(_0xb814('0xb'));var ejs=require('ejs');var fs=require('fs');var _=require(_0xb814('0xc'));var squel=require(_0xb814('0xd'));var crypto=require('crypto');var jsforce=require(_0xb814('0xe'));var deskjs=require(_0xb814('0xf'));var toCsv=require(_0xb814('0xb'));var querystring=require(_0xb814('0x10'));var Papa=require(_0xb814('0x11'));var Redis=require(_0xb814('0x12'));var authService=require(_0xb814('0x13'));var qs=require(_0xb814('0x14'));var as=require(_0xb814('0x15'));var hardwareService=require(_0xb814('0x16'));var logger=require(_0xb814('0x17'))('api');var utils=require(_0xb814('0x18'));var config=require('../../config/environment');var db=require(_0xb814('0x19'))['db'];var jayson=require(_0xb814('0x1a'));var client=jayson[_0xb814('0x1b')][_0xb814('0x1c')]({'port':0x232a});function checkPasswordPattern(_0x2ce718,_0x3bde14,_0x1438e7){if(_0x1438e7){var _0x41ed7b=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x41ed7b[_0xb814('0x1d')](_0x3bde14)){return _0x2ce718;}else{throw new db[(_0xb814('0x1e'))][(_0xb814('0x1f'))](_0xb814('0x20'));}}else{return _0x2ce718;}}function respondWithRpcPromise(_0x17f5bd,_0x39bfcf,_0x303aca,_0x3a71d6){return new BPromise(function(_0x45e0d0,_0x265a83){var _0x125ce2=_0x3a71d6||client;return _0x125ce2[_0xb814('0x21')](_0x17f5bd,_0x303aca)[_0xb814('0x22')](function(_0x48c9df){logger[_0xb814('0x23')]('ZendeskConfiguration,\x20%s,\x20%s',_0x39bfcf,_0xb814('0x24'));logger[_0xb814('0x25')]('ZendeskConfiguration,\x20%s,\x20%s,\x20%s',_0x39bfcf,'request\x20sent',JSON['stringify'](_0x48c9df));if(_0x48c9df[_0xb814('0x26')]){if(_0x48c9df['error']['code']===0x1f4){logger[_0xb814('0x26')](_0xb814('0x27'),_0x39bfcf,_0x48c9df[_0xb814('0x26')]['message']);return _0x265a83(_0x48c9df[_0xb814('0x26')]['message']);}logger[_0xb814('0x26')](_0xb814('0x27'),_0x39bfcf,_0x48c9df[_0xb814('0x26')][_0xb814('0x28')]);return _0x45e0d0(_0x48c9df[_0xb814('0x26')][_0xb814('0x28')]);}else{logger[_0xb814('0x23')]('ZendeskConfiguration,\x20%s,\x20%s',_0x39bfcf,_0xb814('0x24'));_0x45e0d0(_0x48c9df['result'][_0xb814('0x28')]);}})[_0xb814('0x29')](function(_0x31c7ec){logger[_0xb814('0x26')](_0xb814('0x27'),_0x39bfcf,_0x31c7ec);_0x265a83(_0x31c7ec);});});}function respondWithStatusCode(_0xb9e57d,_0x3d836c){_0x3d836c=_0x3d836c||0xcc;return function(_0x5755ea){if(_0x5755ea){return _0xb9e57d[_0xb814('0x2a')](_0x3d836c);}return _0xb9e57d[_0xb814('0x2b')](_0x3d836c)[_0xb814('0x2c')]();};}function respondWithResult(_0x349394,_0x32ed56){_0x32ed56=_0x32ed56||0xc8;return function(_0x1d5965){if(_0x1d5965){return _0x349394[_0xb814('0x2b')](_0x32ed56)[_0xb814('0x2d')](_0x1d5965);}};}function respondWithFilteredResult(_0x5a6291,_0x271aa8){return function(_0x328a08){if(_0x328a08){var _0x52ed64=_0x328a08['count'],_0x9008b2=_0x271aa8[_0xb814('0x2e')],_0x37d24d=_0x271aa8[_0xb814('0x2e')]+_0x271aa8['limit'],_0x530744;if(_0x37d24d>=_0x52ed64){_0x37d24d=_0x52ed64;_0x530744=0xc8;}else{_0x530744=0xce;}_0x5a6291[_0xb814('0x2b')](_0x530744);return _0x5a6291['set'](_0xb814('0x2f'),_0x9008b2+'-'+_0x37d24d+'/'+_0x52ed64)['json'](_0x328a08);}return null;};}function patchUpdates(_0x4cfc58){return function(_0x419cd9){try{jsonpatch['apply'](_0x419cd9,_0x4cfc58,!![]);}catch(_0x2431e2){return BPromise[_0xb814('0x30')](_0x2431e2);}return _0x419cd9[_0xb814('0x31')]();};}function saveUpdates(_0x599f9f,_0x51d5ae){return function(_0x26d3a9){if(_0x26d3a9){return _0x26d3a9[_0xb814('0x32')](_0x599f9f)['then'](function(_0x2c8943){return _0x2c8943;});}return null;};}function removeEntity(_0xe558d5,_0x692c72){return function(_0x217b7e){if(_0x217b7e){return _0x217b7e[_0xb814('0x33')]()[_0xb814('0x22')](function(){_0xe558d5[_0xb814('0x2b')](0xcc)['end']();});}};}function handleEntityNotFound(_0x3207ec,_0x2263f6){return function(_0x30de5a){if(!_0x30de5a){_0x3207ec[_0xb814('0x2a')](0x194);}return _0x30de5a;};}function handleError(_0x14100d,_0x4ff31a){_0x4ff31a=_0x4ff31a||0x1f4;return function(_0x16ef82){logger['error'](_0x16ef82[_0xb814('0x34')]);if(_0x16ef82[_0xb814('0x35')]){delete _0x16ef82[_0xb814('0x35')];}_0x14100d['status'](_0x4ff31a)[_0xb814('0x36')](_0x16ef82);};}exports[_0xb814('0x37')]=function(_0x4ea6f8,_0x2fcd92){var _0x2d0e27={},_0x1a8bd0={},_0x1f7cd8={'count':0x0,'rows':[]};var _0xd77d96=_[_0xb814('0x38')](db['ZendeskConfiguration'][_0xb814('0x39')],function(_0x4e4684){return{'name':_0x4e4684[_0xb814('0x3a')],'type':_0x4e4684['type'][_0xb814('0x3b')]};});_0x1a8bd0['model']=_[_0xb814('0x38')](_0xd77d96,_0xb814('0x35'));_0x1a8bd0['query']=_['keys'](_0x4ea6f8['query']);_0x1a8bd0['filters']=_[_0xb814('0x3c')](_0x1a8bd0[_0xb814('0x3d')],_0x1a8bd0[_0xb814('0x3e')]);_0x2d0e27[_0xb814('0x3f')]=_['intersection'](_0x1a8bd0['model'],qs[_0xb814('0x40')](_0x4ea6f8['query'][_0xb814('0x40')]));_0x2d0e27[_0xb814('0x3f')]=_0x2d0e27[_0xb814('0x3f')][_0xb814('0x41')]?_0x2d0e27[_0xb814('0x3f')]:_0x1a8bd0[_0xb814('0x3d')];if(!_0x4ea6f8[_0xb814('0x3e')][_0xb814('0x42')](_0xb814('0x43'))){_0x2d0e27['limit']=qs['limit'](_0x4ea6f8['query'][_0xb814('0x44')]);_0x2d0e27['offset']=qs[_0xb814('0x2e')](_0x4ea6f8['query'][_0xb814('0x2e')]);}_0x2d0e27[_0xb814('0x45')]=qs[_0xb814('0x46')](_0x4ea6f8[_0xb814('0x3e')]['sort']);_0x2d0e27[_0xb814('0x47')]=qs[_0xb814('0x48')](_[_0xb814('0x49')](_0x4ea6f8[_0xb814('0x3e')],_0x1a8bd0[_0xb814('0x48')]));if(_0x4ea6f8[_0xb814('0x3e')]['filter']){_0x2d0e27[_0xb814('0x47')]=_[_0xb814('0x4a')](_0x2d0e27[_0xb814('0x47')],{'$or':_[_0xb814('0x38')](_0xd77d96,function(_0x46408b){if(_0x46408b[_0xb814('0x4b')]!==_0xb814('0x4c')){var _0x519545={};_0x519545[_0x46408b['name']]={'$like':'%'+_0x4ea6f8[_0xb814('0x3e')][_0xb814('0x4d')]+'%'};return _0x519545;}})});}_0x2d0e27=_[_0xb814('0x4a')]({},_0x2d0e27,_0x4ea6f8[_0xb814('0x4e')]);var _0x43f1b={'where':_0x2d0e27[_0xb814('0x47')]};return db[_0xb814('0x4f')][_0xb814('0x50')](_0x43f1b)[_0xb814('0x22')](function(_0x344198){_0x1f7cd8[_0xb814('0x50')]=_0x344198;if(_0x4ea6f8['query'][_0xb814('0x51')]){_0x2d0e27[_0xb814('0x52')]=[{'all':!![]}];}return db['ZendeskConfiguration'][_0xb814('0x53')](_0x2d0e27);})['then'](function(_0x2fb0f7){_0x1f7cd8[_0xb814('0x54')]=_0x2fb0f7;return _0x1f7cd8;})[_0xb814('0x22')](respondWithFilteredResult(_0x2fcd92,_0x2d0e27))[_0xb814('0x29')](handleError(_0x2fcd92,null));};exports[_0xb814('0x55')]=function(_0x4096d4,_0x2cc806){var _0x45480e={'raw':![],'where':{'id':_0x4096d4[_0xb814('0x56')]['id']}},_0x32a397={};_0x32a397['model']=_['keys'](db[_0xb814('0x4f')][_0xb814('0x39')]);_0x32a397[_0xb814('0x3e')]=_[_0xb814('0x57')](_0x4096d4[_0xb814('0x3e')]);_0x32a397[_0xb814('0x48')]=_[_0xb814('0x3c')](_0x32a397['model'],_0x32a397[_0xb814('0x3e')]);_0x45480e[_0xb814('0x3f')]=_[_0xb814('0x3c')](_0x32a397['model'],qs[_0xb814('0x40')](_0x4096d4['query'][_0xb814('0x40')]));_0x45480e['attributes']=_0x45480e[_0xb814('0x3f')][_0xb814('0x41')]?_0x45480e['attributes']:_0x32a397[_0xb814('0x3d')];if(_0x4096d4[_0xb814('0x3e')][_0xb814('0x51')]){_0x45480e['include']=[{'all':!![]}];}_0x45480e=_[_0xb814('0x4a')]({},_0x45480e,_0x4096d4['options']);return db[_0xb814('0x4f')][_0xb814('0x58')](_0x45480e)['then'](handleEntityNotFound(_0x2cc806,null))[_0xb814('0x22')](respondWithResult(_0x2cc806,null))['catch'](handleError(_0x2cc806,null));};exports['create']=function(_0x3b9709,_0x35f59a){return db[_0xb814('0x4f')]['create'](_0x3b9709[_0xb814('0x59')],{})['then'](respondWithResult(_0x35f59a,0xc9))[_0xb814('0x29')](handleError(_0x35f59a,null));};exports[_0xb814('0x32')]=function(_0x58d6e5,_0x2db5a6){if(_0x58d6e5['body']['id']){delete _0x58d6e5[_0xb814('0x59')]['id'];}return db[_0xb814('0x4f')][_0xb814('0x58')]({'where':{'id':_0x58d6e5[_0xb814('0x56')]['id']}})[_0xb814('0x22')](handleEntityNotFound(_0x2db5a6,null))[_0xb814('0x22')](saveUpdates(_0x58d6e5[_0xb814('0x59')],null))[_0xb814('0x22')](respondWithResult(_0x2db5a6,null))['catch'](handleError(_0x2db5a6,null));};exports[_0xb814('0x33')]=function(_0x5441c5,_0x5d71d5){return db[_0xb814('0x4f')][_0xb814('0x58')]({'where':{'id':_0x5441c5['params']['id']}})[_0xb814('0x22')](handleEntityNotFound(_0x5d71d5,null))['then'](removeEntity(_0x5d71d5,null))['catch'](handleError(_0x5d71d5,null));};exports[_0xb814('0x5a')]=function(_0x5257be,_0x3ff213,_0xd1cd8b){var _0x2dec52={};var _0x586957={};var _0x1a0ef4;var _0x4df65c;return db[_0xb814('0x4f')][_0xb814('0x5b')]({'where':{'id':_0x5257be[_0xb814('0x56')]['id']}})[_0xb814('0x22')](handleEntityNotFound(_0x3ff213,null))[_0xb814('0x22')](function(_0x3b374b){if(_0x3b374b){_0x1a0ef4=_0x3b374b;_0x586957[_0xb814('0x3d')]=_[_0xb814('0x57')](db[_0xb814('0x5c')]['rawAttributes']);_0x586957[_0xb814('0x3e')]=_[_0xb814('0x57')](_0x5257be[_0xb814('0x3e')]);_0x586957[_0xb814('0x48')]=_[_0xb814('0x3c')](_0x586957[_0xb814('0x3d')],_0x586957['query']);_0x2dec52[_0xb814('0x3f')]=_['intersection'](_0x586957[_0xb814('0x3d')],qs[_0xb814('0x40')](_0x5257be[_0xb814('0x3e')]['fields']));_0x2dec52[_0xb814('0x3f')]=_0x2dec52['attributes'][_0xb814('0x41')]?_0x2dec52['attributes']:_0x586957[_0xb814('0x3d')];_0x2dec52[_0xb814('0x45')]=qs[_0xb814('0x46')](_0x5257be[_0xb814('0x3e')][_0xb814('0x46')]);_0x2dec52[_0xb814('0x47')]=qs[_0xb814('0x48')](_['pick'](_0x5257be[_0xb814('0x3e')],_0x586957['filters']));if(_0x5257be[_0xb814('0x3e')][_0xb814('0x4d')]){_0x2dec52[_0xb814('0x47')]=_[_0xb814('0x4a')](_0x2dec52[_0xb814('0x47')],{'$or':_[_0xb814('0x38')](_0x2dec52['attributes'],function(_0x12882a){var _0x1a2603={};_0x1a2603[_0x12882a]={'$like':'%'+_0x5257be['query'][_0xb814('0x4d')]+'%'};return _0x1a2603;})});}_0x2dec52=_[_0xb814('0x4a')]({},_0x2dec52,_0x5257be[_0xb814('0x4e')]);return _0x1a0ef4[_0xb814('0x5a')](_0x2dec52);}})[_0xb814('0x22')](function(_0x51d834){if(_0x51d834){_0x4df65c=_0x51d834[_0xb814('0x41')];if(!_0x5257be['query'][_0xb814('0x42')](_0xb814('0x43'))){_0x2dec52[_0xb814('0x44')]=qs[_0xb814('0x44')](_0x5257be[_0xb814('0x3e')][_0xb814('0x44')]);_0x2dec52['offset']=qs['offset'](_0x5257be['query'][_0xb814('0x2e')]);}return _0x1a0ef4['getFields'](_0x2dec52);}})[_0xb814('0x22')](function(_0x1d3954){if(_0x1d3954){return _0x1d3954?{'count':_0x4df65c,'rows':_0x1d3954}:null;}})[_0xb814('0x22')](respondWithResult(_0x3ff213,null))['catch'](handleError(_0x3ff213,null));};exports[_0xb814('0x5d')]=function(_0x3e5ce8,_0xee204,_0x5aabbe){var _0x30f717={};var _0x1bf0b7={};var _0x1f39c0;var _0x3564e0;return db['ZendeskConfiguration']['findOne']({'where':{'id':_0x3e5ce8[_0xb814('0x56')]['id']}})[_0xb814('0x22')](handleEntityNotFound(_0xee204,null))[_0xb814('0x22')](function(_0x408870){if(_0x408870){_0x1f39c0=_0x408870;_0x1bf0b7[_0xb814('0x3d')]=_[_0xb814('0x57')](db[_0xb814('0x5c')][_0xb814('0x39')]);_0x1bf0b7[_0xb814('0x3e')]=_[_0xb814('0x57')](_0x3e5ce8[_0xb814('0x3e')]);_0x1bf0b7[_0xb814('0x48')]=_[_0xb814('0x3c')](_0x1bf0b7[_0xb814('0x3d')],_0x1bf0b7[_0xb814('0x3e')]);_0x30f717['attributes']=_[_0xb814('0x3c')](_0x1bf0b7[_0xb814('0x3d')],qs[_0xb814('0x40')](_0x3e5ce8[_0xb814('0x3e')][_0xb814('0x40')]));_0x30f717[_0xb814('0x3f')]=_0x30f717['attributes'][_0xb814('0x41')]?_0x30f717['attributes']:_0x1bf0b7[_0xb814('0x3d')];_0x30f717[_0xb814('0x45')]=qs[_0xb814('0x46')](_0x3e5ce8[_0xb814('0x3e')][_0xb814('0x46')]);_0x30f717['where']=qs['filters'](_[_0xb814('0x49')](_0x3e5ce8[_0xb814('0x3e')],_0x1bf0b7[_0xb814('0x48')]));if(_0x3e5ce8[_0xb814('0x3e')]['filter']){_0x30f717[_0xb814('0x47')]=_['merge'](_0x30f717[_0xb814('0x47')],{'$or':_[_0xb814('0x38')](_0x30f717['attributes'],function(_0x58b016){var _0x2fa6b7={};_0x2fa6b7[_0x58b016]={'$like':'%'+_0x3e5ce8['query'][_0xb814('0x4d')]+'%'};return _0x2fa6b7;})});}_0x30f717=_[_0xb814('0x4a')]({},_0x30f717,_0x3e5ce8[_0xb814('0x4e')]);return _0x1f39c0[_0xb814('0x5d')](_0x30f717);}})[_0xb814('0x22')](function(_0x420bde){if(_0x420bde){_0x3564e0=_0x420bde[_0xb814('0x41')];if(!_0x3e5ce8['query'][_0xb814('0x42')]('nolimit')){_0x30f717[_0xb814('0x44')]=qs['limit'](_0x3e5ce8[_0xb814('0x3e')][_0xb814('0x44')]);_0x30f717['offset']=qs[_0xb814('0x2e')](_0x3e5ce8['query'][_0xb814('0x2e')]);}return _0x1f39c0[_0xb814('0x5d')](_0x30f717);}})['then'](function(_0x5a0c4a){if(_0x5a0c4a){return _0x5a0c4a?{'count':_0x3564e0,'rows':_0x5a0c4a}:null;}})[_0xb814('0x22')](respondWithResult(_0xee204,null))[_0xb814('0x29')](handleError(_0xee204,null));};exports[_0xb814('0x5e')]=function(_0x6f5e6a,_0x220f8b,_0x4394da){var _0x2b12a9={};var _0x314600={};var _0x8cb107;var _0x34f49c;return db['ZendeskConfiguration']['findOne']({'where':{'id':_0x6f5e6a['params']['id']}})['then'](handleEntityNotFound(_0x220f8b,null))['then'](function(_0x45a202){if(_0x45a202){_0x8cb107=_0x45a202;_0x314600[_0xb814('0x3d')]=_[_0xb814('0x57')](db['ZendeskField'][_0xb814('0x39')]);_0x314600[_0xb814('0x3e')]=_[_0xb814('0x57')](_0x6f5e6a[_0xb814('0x3e')]);_0x314600[_0xb814('0x48')]=_[_0xb814('0x3c')](_0x314600[_0xb814('0x3d')],_0x314600[_0xb814('0x3e')]);_0x2b12a9['attributes']=_[_0xb814('0x3c')](_0x314600[_0xb814('0x3d')],qs[_0xb814('0x40')](_0x6f5e6a[_0xb814('0x3e')]['fields']));_0x2b12a9[_0xb814('0x3f')]=_0x2b12a9[_0xb814('0x3f')][_0xb814('0x41')]?_0x2b12a9[_0xb814('0x3f')]:_0x314600[_0xb814('0x3d')];_0x2b12a9['order']=qs['sort'](_0x6f5e6a[_0xb814('0x3e')]['sort']);_0x2b12a9[_0xb814('0x47')]=qs[_0xb814('0x48')](_['pick'](_0x6f5e6a[_0xb814('0x3e')],_0x314600['filters']));if(_0x6f5e6a[_0xb814('0x3e')]['filter']){_0x2b12a9[_0xb814('0x47')]=_[_0xb814('0x4a')](_0x2b12a9[_0xb814('0x47')],{'$or':_[_0xb814('0x38')](_0x2b12a9[_0xb814('0x3f')],function(_0x1ae812){var _0x455b22={};_0x455b22[_0x1ae812]={'$like':'%'+_0x6f5e6a['query']['filter']+'%'};return _0x455b22;})});}_0x2b12a9=_[_0xb814('0x4a')]({},_0x2b12a9,_0x6f5e6a['options']);return _0x8cb107['getDescriptions'](_0x2b12a9);}})[_0xb814('0x22')](function(_0x8fbda1){if(_0x8fbda1){_0x34f49c=_0x8fbda1[_0xb814('0x41')];if(!_0x6f5e6a['query'][_0xb814('0x42')]('nolimit')){_0x2b12a9[_0xb814('0x44')]=qs[_0xb814('0x44')](_0x6f5e6a[_0xb814('0x3e')][_0xb814('0x44')]);_0x2b12a9['offset']=qs[_0xb814('0x2e')](_0x6f5e6a[_0xb814('0x3e')][_0xb814('0x2e')]);}return _0x8cb107['getDescriptions'](_0x2b12a9);}})[_0xb814('0x22')](function(_0x3fc77d){if(_0x3fc77d){return _0x3fc77d?{'count':_0x34f49c,'rows':_0x3fc77d}:null;}})[_0xb814('0x22')](respondWithResult(_0x220f8b,null))['catch'](handleError(_0x220f8b,null));};exports[_0xb814('0x5f')]=function(_0x2d0651,_0x9dc06b,_0x216d67){var _0x40b3c5={};var _0x1ae8e8={};var _0x37a7ab;var _0x472c38;return db[_0xb814('0x4f')][_0xb814('0x5b')]({'where':{'id':_0x2d0651[_0xb814('0x56')]['id']}})[_0xb814('0x22')](handleEntityNotFound(_0x9dc06b,null))[_0xb814('0x22')](function(_0x5b8d2e){if(_0x5b8d2e){_0x37a7ab=_0x5b8d2e;_0x1ae8e8['model']=_[_0xb814('0x57')](db['Tag'][_0xb814('0x39')]);_0x1ae8e8[_0xb814('0x3e')]=_[_0xb814('0x57')](_0x2d0651[_0xb814('0x3e')]);_0x1ae8e8[_0xb814('0x48')]=_[_0xb814('0x3c')](_0x1ae8e8[_0xb814('0x3d')],_0x1ae8e8['query']);_0x40b3c5['attributes']=_[_0xb814('0x3c')](_0x1ae8e8['model'],qs[_0xb814('0x40')](_0x2d0651[_0xb814('0x3e')][_0xb814('0x40')]));_0x40b3c5['attributes']=_0x40b3c5[_0xb814('0x3f')][_0xb814('0x41')]?_0x40b3c5[_0xb814('0x3f')]:_0x1ae8e8[_0xb814('0x3d')];_0x40b3c5[_0xb814('0x45')]=qs['sort'](_0x2d0651[_0xb814('0x3e')][_0xb814('0x46')]);_0x40b3c5['where']=qs[_0xb814('0x48')](_[_0xb814('0x49')](_0x2d0651[_0xb814('0x3e')],_0x1ae8e8['filters']));if(_0x2d0651[_0xb814('0x3e')][_0xb814('0x4d')]){_0x40b3c5['where']=_[_0xb814('0x4a')](_0x40b3c5[_0xb814('0x47')],{'$or':_['map'](_0x40b3c5[_0xb814('0x3f')],function(_0x269832){var _0x3f4cbf={};_0x3f4cbf[_0x269832]={'$like':'%'+_0x2d0651[_0xb814('0x3e')][_0xb814('0x4d')]+'%'};return _0x3f4cbf;})});}_0x40b3c5=_[_0xb814('0x4a')]({},_0x40b3c5,_0x2d0651[_0xb814('0x4e')]);return _0x37a7ab[_0xb814('0x5f')](_0x40b3c5);}})[_0xb814('0x22')](function(_0x1f8c7a){if(_0x1f8c7a){_0x472c38=_0x1f8c7a[_0xb814('0x41')];if(!_0x2d0651[_0xb814('0x3e')]['hasOwnProperty']('nolimit')){_0x40b3c5[_0xb814('0x44')]=qs['limit'](_0x2d0651['query'][_0xb814('0x44')]);_0x40b3c5['offset']=qs['offset'](_0x2d0651['query'][_0xb814('0x2e')]);}return _0x37a7ab[_0xb814('0x5f')](_0x40b3c5);}})[_0xb814('0x22')](function(_0x5eb4b1){if(_0x5eb4b1){return _0x5eb4b1?{'count':_0x472c38,'rows':_0x5eb4b1}:null;}})[_0xb814('0x22')](respondWithResult(_0x9dc06b,null))['catch'](handleError(_0x9dc06b,null));};exports[_0xb814('0x60')]=function(_0x2e6660,_0x49a8de,_0x3c6a59){if(_0x2e6660['body']['id']){delete _0x2e6660[_0xb814('0x59')]['id'];}return db[_0xb814('0x4f')][_0xb814('0x5b')]({'where':{'id':_0x2e6660[_0xb814('0x56')]['id']}})[_0xb814('0x22')](handleEntityNotFound(_0x49a8de,null))[_0xb814('0x22')](function(_0x1f2ef8){if(_0x1f2ef8){return _0x1f2ef8[_0xb814('0x60')](_0x2e6660[_0xb814('0x59')][_0xb814('0x61')]||[]);}return null;})[_0xb814('0x22')](respondWithResult(_0x49a8de,null))[_0xb814('0x29')](handleError(_0x49a8de,null));}; \ No newline at end of file diff --git a/server/api/intZendeskConfiguration/intZendeskConfiguration.model.js b/server/api/intZendeskConfiguration/intZendeskConfiguration.model.js index 70cd863..dedaa8c 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 _0x089f=['../../config/environment','./intZendeskConfiguration.attributes','exports','define','ZendeskConfiguration','int_zendesk_configurations','lodash','util','moment','bluebird','request-promise'];(function(_0x55191b,_0x58c350){var _0x1d25d4=function(_0x13c57e){while(--_0x13c57e){_0x55191b['push'](_0x55191b['shift']());}};_0x1d25d4(++_0x58c350);}(_0x089f,0x103));var _0xf089=function(_0x144e83,_0x4bdc00){_0x144e83=_0x144e83-0x0;var _0x408560=_0x089f[_0x144e83];return _0x408560;};'use strict';var _=require(_0xf089('0x0'));var util=require(_0xf089('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0xf089('0x2'));var BPromise=require(_0xf089('0x3'));var rp=require(_0xf089('0x4'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0xf089('0x5'));var attributes=require(_0xf089('0x6'));module[_0xf089('0x7')]=function(_0x130e79,_0x5e5fe1){return _0x130e79[_0xf089('0x8')](_0xf089('0x9'),attributes,{'tableName':_0xf089('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x04c7=['moment','bluebird','rimraf','../../config/environment','./intZendeskConfiguration.attributes','exports','define','ZendeskConfiguration','lodash','util','../../config/logger'];(function(_0x2a5ee1,_0x59fc6d){var _0x4ed7c9=function(_0x5c9766){while(--_0x5c9766){_0x2a5ee1['push'](_0x2a5ee1['shift']());}};_0x4ed7c9(++_0x59fc6d);}(_0x04c7,0x8c));var _0x704c=function(_0x256b72,_0x340985){_0x256b72=_0x256b72-0x0;var _0x2183e3=_0x04c7[_0x256b72];return _0x2183e3;};'use strict';var _=require(_0x704c('0x0'));var util=require(_0x704c('0x1'));var logger=require(_0x704c('0x2'))('api');var moment=require(_0x704c('0x3'));var BPromise=require(_0x704c('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x704c('0x5'));var config=require(_0x704c('0x6'));var attributes=require(_0x704c('0x7'));module[_0x704c('0x8')]=function(_0x28e9ed,_0x41568c){return _0x28e9ed[_0x704c('0x9')](_0x704c('0xa'),attributes,{'tableName':'int_zendesk_configurations','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intZendeskConfiguration/intZendeskConfiguration.rpc.js b/server/api/intZendeskConfiguration/intZendeskConfiguration.rpc.js index d1fbcd2..ef56840 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 _0x54bb=['http','request','then','info','ZendeskConfiguration,\x20%s,\x20%s','debug','ZendeskConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','message','request\x20sent','result','catch','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client'];(function(_0x27e9ab,_0x32371d){var _0x36d840=function(_0x9dedbd){while(--_0x9dedbd){_0x27e9ab['push'](_0x27e9ab['shift']());}};_0x36d840(++_0x32371d);}(_0x54bb,0xa4));var _0xb54b=function(_0x13ce62,_0x189733){_0x13ce62=_0x13ce62-0x0;var _0x659d2=_0x54bb[_0x13ce62];return _0x659d2;};'use strict';var _=require(_0xb54b('0x0'));var util=require(_0xb54b('0x1'));var moment=require('moment');var BPromise=require(_0xb54b('0x2'));var rs=require(_0xb54b('0x3'));var fs=require('fs');var Redis=require(_0xb54b('0x4'));var db=require(_0xb54b('0x5'))['db'];var utils=require(_0xb54b('0x6'));var logger=require(_0xb54b('0x7'))(_0xb54b('0x8'));var config=require(_0xb54b('0x9'));var jayson=require('jayson/promise');var client=jayson[_0xb54b('0xa')][_0xb54b('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x44c927,_0xd0fdaa,_0x30f203){return new BPromise(function(_0x5cf158,_0x2db50a){return client[_0xb54b('0xc')](_0x44c927,_0x30f203)[_0xb54b('0xd')](function(_0x5b1805){logger[_0xb54b('0xe')](_0xb54b('0xf'),_0xd0fdaa,'request\x20sent');logger[_0xb54b('0x10')](_0xb54b('0x11'),_0xd0fdaa,'request\x20sent',JSON[_0xb54b('0x12')](_0x5b1805));if(_0x5b1805[_0xb54b('0x13')]){if(_0x5b1805[_0xb54b('0x13')][_0xb54b('0x14')]===0x1f4){logger['error'](_0xb54b('0xf'),_0xd0fdaa,_0x5b1805[_0xb54b('0x13')][_0xb54b('0x15')]);return _0x2db50a(_0x5b1805['error'][_0xb54b('0x15')]);}logger[_0xb54b('0x13')](_0xb54b('0xf'),_0xd0fdaa,_0x5b1805['error']['message']);return _0x5cf158(_0x5b1805[_0xb54b('0x13')]['message']);}else{logger[_0xb54b('0xe')]('ZendeskConfiguration,\x20%s,\x20%s',_0xd0fdaa,_0xb54b('0x16'));_0x5cf158(_0x5b1805[_0xb54b('0x17')][_0xb54b('0x15')]);}})[_0xb54b('0x18')](function(_0x235379){logger[_0xb54b('0x13')](_0xb54b('0xf'),_0xd0fdaa,_0x235379);_0x2db50a(_0x235379);});});} \ No newline at end of file +var _0xd369=['http','request','then','info','request\x20sent','debug','ZendeskConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','message','ZendeskConfiguration,\x20%s,\x20%s','result','catch','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/environment','jayson/promise','client'];(function(_0x352494,_0xf8026e){var _0x1daf3b=function(_0x2ec3bc){while(--_0x2ec3bc){_0x352494['push'](_0x352494['shift']());}};_0x1daf3b(++_0xf8026e);}(_0xd369,0x80));var _0x9d36=function(_0x2fba03,_0x1eca01){_0x2fba03=_0x2fba03-0x0;var _0x18c8d4=_0xd369[_0x2fba03];return _0x18c8d4;};'use strict';var _=require(_0x9d36('0x0'));var util=require(_0x9d36('0x1'));var moment=require(_0x9d36('0x2'));var BPromise=require('bluebird');var rs=require(_0x9d36('0x3'));var fs=require('fs');var Redis=require(_0x9d36('0x4'));var db=require(_0x9d36('0x5'))['db'];var utils=require(_0x9d36('0x6'));var logger=require('../../config/logger')('rpc');var config=require(_0x9d36('0x7'));var jayson=require(_0x9d36('0x8'));var client=jayson[_0x9d36('0x9')][_0x9d36('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x17c04b,_0x57109b,_0xfa6c8e){return new BPromise(function(_0x41df8d,_0x1a7cbe){return client[_0x9d36('0xb')](_0x17c04b,_0xfa6c8e)[_0x9d36('0xc')](function(_0x35540a){logger[_0x9d36('0xd')]('ZendeskConfiguration,\x20%s,\x20%s',_0x57109b,_0x9d36('0xe'));logger[_0x9d36('0xf')](_0x9d36('0x10'),_0x57109b,'request\x20sent',JSON[_0x9d36('0x11')](_0x35540a));if(_0x35540a[_0x9d36('0x12')]){if(_0x35540a[_0x9d36('0x12')]['code']===0x1f4){logger[_0x9d36('0x12')]('ZendeskConfiguration,\x20%s,\x20%s',_0x57109b,_0x35540a['error'][_0x9d36('0x13')]);return _0x1a7cbe(_0x35540a[_0x9d36('0x12')][_0x9d36('0x13')]);}logger['error'](_0x9d36('0x14'),_0x57109b,_0x35540a['error'][_0x9d36('0x13')]);return _0x41df8d(_0x35540a['error'][_0x9d36('0x13')]);}else{logger[_0x9d36('0xd')](_0x9d36('0x14'),_0x57109b,_0x9d36('0xe'));_0x41df8d(_0x35540a[_0x9d36('0x15')]['message']);}})[_0x9d36('0x16')](function(_0x45ccb9){logger['error']('ZendeskConfiguration,\x20%s,\x20%s',_0x57109b,_0x45ccb9);_0x1a7cbe(_0x45ccb9);});});} \ No newline at end of file diff --git a/server/api/intZendeskField/index.js b/server/api/intZendeskField/index.js index 3331b2e..769d78e 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 _0x644e=['/:id','isAuthenticated','create','put','update','destroy','exports','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./intZendeskField.controller','get','index'];(function(_0x203d54,_0x33d420){var _0x1df6c4=function(_0x4e8f80){while(--_0x4e8f80){_0x203d54['push'](_0x203d54['shift']());}};_0x1df6c4(++_0x33d420);}(_0x644e,0x103));var _0xe644=function(_0x2bf27d,_0x5387b7){_0x2bf27d=_0x2bf27d-0x0;var _0x373805=_0x644e[_0x2bf27d];return _0x373805;};'use strict';var multer=require('multer');var util=require(_0xe644('0x0'));var path=require(_0xe644('0x1'));var timeout=require(_0xe644('0x2'));var express=require(_0xe644('0x3'));var router=express[_0xe644('0x4')]();var auth=require(_0xe644('0x5'));var interaction=require(_0xe644('0x6'));var config=require(_0xe644('0x7'));var controller=require(_0xe644('0x8'));router[_0xe644('0x9')]('/',auth['isAuthenticated'](),controller[_0xe644('0xa')]);router[_0xe644('0x9')](_0xe644('0xb'),auth[_0xe644('0xc')](),controller['show']);router['post']('/',auth[_0xe644('0xc')](),controller[_0xe644('0xd')]);router[_0xe644('0xe')](_0xe644('0xb'),auth[_0xe644('0xc')](),controller[_0xe644('0xf')]);router['delete'](_0xe644('0xb'),auth[_0xe644('0xc')](),controller[_0xe644('0x10')]);module[_0xe644('0x11')]=router; \ No newline at end of file +var _0x6d04=['connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment','./intZendeskField.controller','get','isAuthenticated','/:id','post','create','put','update','destroy','exports','util','path'];(function(_0x4f9b18,_0x2cb5ca){var _0x29f20c=function(_0x268b3d){while(--_0x268b3d){_0x4f9b18['push'](_0x4f9b18['shift']());}};_0x29f20c(++_0x2cb5ca);}(_0x6d04,0x11f));var _0x46d0=function(_0x4bb256,_0x401b5d){_0x4bb256=_0x4bb256-0x0;var _0x17bb7c=_0x6d04[_0x4bb256];return _0x17bb7c;};'use strict';var multer=require('multer');var util=require(_0x46d0('0x0'));var path=require(_0x46d0('0x1'));var timeout=require(_0x46d0('0x2'));var express=require(_0x46d0('0x3'));var router=express['Router']();var auth=require(_0x46d0('0x4'));var interaction=require(_0x46d0('0x5'));var config=require(_0x46d0('0x6'));var controller=require(_0x46d0('0x7'));router[_0x46d0('0x8')]('/',auth[_0x46d0('0x9')](),controller['index']);router[_0x46d0('0x8')](_0x46d0('0xa'),auth[_0x46d0('0x9')](),controller['show']);router[_0x46d0('0xb')]('/',auth[_0x46d0('0x9')](),controller[_0x46d0('0xc')]);router[_0x46d0('0xd')]('/:id',auth[_0x46d0('0x9')](),controller[_0x46d0('0xe')]);router['delete'](_0x46d0('0xa'),auth['isAuthenticated'](),controller[_0x46d0('0xf')]);module[_0x46d0('0x10')]=router; \ No newline at end of file diff --git a/server/api/intZendeskField/intZendeskField.attributes.js b/server/api/intZendeskField/intZendeskField.attributes.js index 1e844a0..a109904 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 _0xf822=['string','variable','customVariable','keyValue','STRING','BOOLEAN','sequelize','ENUM'];(function(_0x142e22,_0x51c6fe){var _0x3cd51b=function(_0x4d1191){while(--_0x4d1191){_0x142e22['push'](_0x142e22['shift']());}};_0x3cd51b(++_0x51c6fe);}(_0xf822,0x19e));var _0x2f82=function(_0x4f0859,_0x371806){_0x4f0859=_0x4f0859-0x0;var _0x17d638=_0xf822[_0x4f0859];return _0x17d638;};'use strict';var Sequelize=require(_0x2f82('0x0'));module['exports']={'type':{'type':Sequelize[_0x2f82('0x1')](_0x2f82('0x2'),_0x2f82('0x3'),_0x2f82('0x4'),_0x2f82('0x5')),'defaultValue':_0x2f82('0x2')},'content':{'type':Sequelize['STRING']},'key':{'type':Sequelize[_0x2f82('0x6')]},'keyType':{'type':Sequelize[_0x2f82('0x1')](_0x2f82('0x2'),'variable',_0x2f82('0x4'))},'keyContent':{'type':Sequelize['STRING']},'idField':{'type':Sequelize[_0x2f82('0x6')]},'nameField':{'type':Sequelize[_0x2f82('0x6')]},'customField':{'type':Sequelize[_0x2f82('0x7')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x2f82('0x6')]}}; \ No newline at end of file +var _0xa25a=['sequelize','exports','ENUM','string','variable','customVariable','keyValue','STRING'];(function(_0x420fdd,_0x127224){var _0x116df3=function(_0x216356){while(--_0x216356){_0x420fdd['push'](_0x420fdd['shift']());}};_0x116df3(++_0x127224);}(_0xa25a,0x160));var _0xaa25=function(_0x4c408f,_0x26a862){_0x4c408f=_0x4c408f-0x0;var _0x181de4=_0xa25a[_0x4c408f];return _0x181de4;};'use strict';var Sequelize=require(_0xaa25('0x0'));module[_0xaa25('0x1')]={'type':{'type':Sequelize[_0xaa25('0x2')](_0xaa25('0x3'),_0xaa25('0x4'),_0xaa25('0x5'),_0xaa25('0x6')),'defaultValue':_0xaa25('0x3')},'content':{'type':Sequelize[_0xaa25('0x7')]},'key':{'type':Sequelize['STRING']},'keyType':{'type':Sequelize['ENUM'](_0xaa25('0x3'),_0xaa25('0x4'),'customVariable')},'keyContent':{'type':Sequelize[_0xaa25('0x7')]},'idField':{'type':Sequelize[_0xaa25('0x7')]},'nameField':{'type':Sequelize['STRING']},'customField':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'variableName':{'type':Sequelize[_0xaa25('0x7')]}}; \ No newline at end of file diff --git a/server/api/intZendeskField/intZendeskField.controller.js b/server/api/intZendeskField/intZendeskField.controller.js index c8ba863..7a1ae8b 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 _0x7623=['squel','crypto','desk.js','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','status','json','offset','Content-Range','apply','reject','then','destroy','sendStatus','error','stack','name','send','index','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','nolimit','limit','order','sort','filter','where','merge','VIRTUAL','options','count','includeAll','include','ZendeskField','findAll','rows','catch','show','params','rawAttributes','find','create','update','body','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','sox','to-csv','lodash'];(function(_0x573987,_0x2f7cee){var _0xaafbe5=function(_0x3708d2){while(--_0x3708d2){_0x573987['push'](_0x573987['shift']());}};_0xaafbe5(++_0x2f7cee);}(_0x7623,0xce));var _0x3762=function(_0x1046ba,_0x17699d){_0x1046ba=_0x1046ba-0x0;var _0x31ae08=_0x7623[_0x1046ba];return _0x31ae08;};'use strict';var pdf=require(_0x3762('0x0'));var emlformat=require(_0x3762('0x1'));var rimraf=require(_0x3762('0x2'));var zipdir=require(_0x3762('0x3'));var jsonpatch=require(_0x3762('0x4'));var rp=require('request-promise');var moment=require(_0x3762('0x5'));var BPromise=require(_0x3762('0x6'));var Mustache=require(_0x3762('0x7'));var util=require(_0x3762('0x8'));var path=require(_0x3762('0x9'));var sox=require(_0x3762('0xa'));var csv=require(_0x3762('0xb'));var ejs=require('ejs');var fs=require('fs');var _=require(_0x3762('0xc'));var squel=require(_0x3762('0xd'));var crypto=require(_0x3762('0xe'));var jsforce=require('jsforce');var deskjs=require(_0x3762('0xf'));var toCsv=require(_0x3762('0xb'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x3762('0x10'));var authService=require('../../components/auth/service');var qs=require(_0x3762('0x11'));var as=require(_0x3762('0x12'));var hardwareService=require(_0x3762('0x13'));var logger=require(_0x3762('0x14'))(_0x3762('0x15'));var utils=require(_0x3762('0x16'));var config=require(_0x3762('0x17'));var db=require(_0x3762('0x18'))['db'];function respondWithStatusCode(_0x1176c1,_0x25aeec){_0x25aeec=_0x25aeec||0xcc;return function(_0x3fb0fd){if(_0x3fb0fd){return _0x1176c1['sendStatus'](_0x25aeec);}return _0x1176c1[_0x3762('0x19')](_0x25aeec)['end']();};}function respondWithResult(_0x4331f9,_0x5442c9){_0x5442c9=_0x5442c9||0xc8;return function(_0x4b5dfa){if(_0x4b5dfa){return _0x4331f9[_0x3762('0x19')](_0x5442c9)[_0x3762('0x1a')](_0x4b5dfa);}};}function respondWithFilteredResult(_0xffc694,_0x35e417){return function(_0x58ca1c){if(_0x58ca1c){var _0x114ba4=_0x58ca1c['count'],_0x191ad8=_0x35e417['offset'],_0x56e633=_0x35e417[_0x3762('0x1b')]+_0x35e417['limit'],_0x549bee;if(_0x56e633>=_0x114ba4){_0x56e633=_0x114ba4;_0x549bee=0xc8;}else{_0x549bee=0xce;}_0xffc694[_0x3762('0x19')](_0x549bee);return _0xffc694['set'](_0x3762('0x1c'),_0x191ad8+'-'+_0x56e633+'/'+_0x114ba4)['json'](_0x58ca1c);}return null;};}function patchUpdates(_0x3e05b8){return function(_0xb606f1){try{jsonpatch[_0x3762('0x1d')](_0xb606f1,_0x3e05b8,!![]);}catch(_0x4f6b9f){return BPromise[_0x3762('0x1e')](_0x4f6b9f);}return _0xb606f1['save']();};}function saveUpdates(_0x195726,_0x515e0a){return function(_0x1a4130){if(_0x1a4130){return _0x1a4130['update'](_0x195726)[_0x3762('0x1f')](function(_0x578079){return _0x578079;});}return null;};}function removeEntity(_0x5b7806,_0x2a1b3e){return function(_0x13e790){if(_0x13e790){return _0x13e790[_0x3762('0x20')]()['then'](function(){_0x5b7806['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x206a12,_0x4b0cf8){return function(_0x418e9b){if(!_0x418e9b){_0x206a12[_0x3762('0x21')](0x194);}return _0x418e9b;};}function handleError(_0x238b40,_0x33d7a8){_0x33d7a8=_0x33d7a8||0x1f4;return function(_0x2ad0c9){logger[_0x3762('0x22')](_0x2ad0c9[_0x3762('0x23')]);if(_0x2ad0c9[_0x3762('0x24')]){delete _0x2ad0c9[_0x3762('0x24')];}_0x238b40[_0x3762('0x19')](_0x33d7a8)[_0x3762('0x25')](_0x2ad0c9);};}exports[_0x3762('0x26')]=function(_0x49f658,_0x1557ba){var _0x23bbdc={},_0x521d5b={},_0x53b26a={'count':0x0,'rows':[]};var _0x256e26=_['map'](db['ZendeskField']['rawAttributes'],function(_0x56138c){return{'name':_0x56138c[_0x3762('0x27')],'type':_0x56138c[_0x3762('0x28')][_0x3762('0x29')]};});_0x521d5b[_0x3762('0x2a')]=_['map'](_0x256e26,_0x3762('0x24'));_0x521d5b[_0x3762('0x2b')]=_[_0x3762('0x2c')](_0x49f658['query']);_0x521d5b[_0x3762('0x2d')]=_[_0x3762('0x2e')](_0x521d5b[_0x3762('0x2a')],_0x521d5b[_0x3762('0x2b')]);_0x23bbdc[_0x3762('0x2f')]=_['intersection'](_0x521d5b[_0x3762('0x2a')],qs[_0x3762('0x30')](_0x49f658[_0x3762('0x2b')][_0x3762('0x30')]));_0x23bbdc[_0x3762('0x2f')]=_0x23bbdc[_0x3762('0x2f')][_0x3762('0x31')]?_0x23bbdc[_0x3762('0x2f')]:_0x521d5b[_0x3762('0x2a')];if(!_0x49f658['query']['hasOwnProperty'](_0x3762('0x32'))){_0x23bbdc[_0x3762('0x33')]=qs[_0x3762('0x33')](_0x49f658[_0x3762('0x2b')]['limit']);_0x23bbdc[_0x3762('0x1b')]=qs[_0x3762('0x1b')](_0x49f658[_0x3762('0x2b')][_0x3762('0x1b')]);}_0x23bbdc[_0x3762('0x34')]=qs[_0x3762('0x35')](_0x49f658[_0x3762('0x2b')]['sort']);_0x23bbdc['where']=qs[_0x3762('0x2d')](_['pick'](_0x49f658[_0x3762('0x2b')],_0x521d5b['filters']));if(_0x49f658[_0x3762('0x2b')][_0x3762('0x36')]){_0x23bbdc[_0x3762('0x37')]=_[_0x3762('0x38')](_0x23bbdc[_0x3762('0x37')],{'$or':_['map'](_0x256e26,function(_0x43af56){if(_0x43af56[_0x3762('0x28')]!==_0x3762('0x39')){var _0xa296e7={};_0xa296e7[_0x43af56['name']]={'$like':'%'+_0x49f658[_0x3762('0x2b')][_0x3762('0x36')]+'%'};return _0xa296e7;}})});}_0x23bbdc=_['merge']({},_0x23bbdc,_0x49f658[_0x3762('0x3a')]);var _0x1905e7={'where':_0x23bbdc[_0x3762('0x37')]};return db['ZendeskField']['count'](_0x1905e7)[_0x3762('0x1f')](function(_0x344d3f){_0x53b26a[_0x3762('0x3b')]=_0x344d3f;if(_0x49f658[_0x3762('0x2b')][_0x3762('0x3c')]){_0x23bbdc[_0x3762('0x3d')]=[{'all':!![]}];}return db[_0x3762('0x3e')][_0x3762('0x3f')](_0x23bbdc);})[_0x3762('0x1f')](function(_0x386fbf){_0x53b26a[_0x3762('0x40')]=_0x386fbf;return _0x53b26a;})[_0x3762('0x1f')](respondWithFilteredResult(_0x1557ba,_0x23bbdc))[_0x3762('0x41')](handleError(_0x1557ba,null));};exports[_0x3762('0x42')]=function(_0x161103,_0x51c430){var _0x4c2055={'raw':!![],'where':{'id':_0x161103[_0x3762('0x43')]['id']}},_0x48f958={};_0x48f958['model']=_[_0x3762('0x2c')](db[_0x3762('0x3e')][_0x3762('0x44')]);_0x48f958[_0x3762('0x2b')]=_[_0x3762('0x2c')](_0x161103[_0x3762('0x2b')]);_0x48f958['filters']=_[_0x3762('0x2e')](_0x48f958[_0x3762('0x2a')],_0x48f958[_0x3762('0x2b')]);_0x4c2055['attributes']=_[_0x3762('0x2e')](_0x48f958['model'],qs['fields'](_0x161103['query'][_0x3762('0x30')]));_0x4c2055[_0x3762('0x2f')]=_0x4c2055[_0x3762('0x2f')]['length']?_0x4c2055[_0x3762('0x2f')]:_0x48f958['model'];if(_0x161103['query'][_0x3762('0x3c')]){_0x4c2055[_0x3762('0x3d')]=[{'all':!![]}];}_0x4c2055=_[_0x3762('0x38')]({},_0x4c2055,_0x161103['options']);return db[_0x3762('0x3e')][_0x3762('0x45')](_0x4c2055)[_0x3762('0x1f')](handleEntityNotFound(_0x51c430,null))[_0x3762('0x1f')](respondWithResult(_0x51c430,null))['catch'](handleError(_0x51c430,null));};exports[_0x3762('0x46')]=function(_0x54ec46,_0x12b301){return db[_0x3762('0x3e')][_0x3762('0x46')](_0x54ec46['body'],{})[_0x3762('0x1f')](respondWithResult(_0x12b301,0xc9))[_0x3762('0x41')](handleError(_0x12b301,null));};exports[_0x3762('0x47')]=function(_0x30e7ab,_0x17a91b){if(_0x30e7ab[_0x3762('0x48')]['id']){delete _0x30e7ab[_0x3762('0x48')]['id'];}return db[_0x3762('0x3e')][_0x3762('0x45')]({'where':{'id':_0x30e7ab[_0x3762('0x43')]['id']}})[_0x3762('0x1f')](handleEntityNotFound(_0x17a91b,null))['then'](saveUpdates(_0x30e7ab[_0x3762('0x48')],null))['then'](respondWithResult(_0x17a91b,null))[_0x3762('0x41')](handleError(_0x17a91b,null));};exports['destroy']=function(_0x3dedbf,_0x3d2c9b){return db[_0x3762('0x3e')][_0x3762('0x45')]({'where':{'id':_0x3dedbf[_0x3762('0x43')]['id']}})['then'](handleEntityNotFound(_0x3d2c9b,null))['then'](removeEntity(_0x3d2c9b,null))['catch'](handleError(_0x3d2c9b,null));}; \ No newline at end of file +var _0x1a5c=['fields','length','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','include','rows','show','find','catch','create','update','body','params','html-pdf','eml-format','rimraf','request-promise','moment','mustache','util','sox','squel','jsforce','desk.js','papaparse','ioredis','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','end','status','json','count','offset','limit','Content-Range','apply','reject','save','then','destroy','error','stack','name','send','index','map','ZendeskField','rawAttributes','type','key','model','query','keys','filters','intersection','attributes'];(function(_0x5c491f,_0x6becb9){var _0x4c69b3=function(_0x4fa2a2){while(--_0x4fa2a2){_0x5c491f['push'](_0x5c491f['shift']());}};_0x4c69b3(++_0x6becb9);}(_0x1a5c,0x120));var _0xc1a5=function(_0x31e29a,_0x349c9b){_0x31e29a=_0x31e29a-0x0;var _0x32d892=_0x1a5c[_0x31e29a];return _0x32d892;};'use strict';var pdf=require(_0xc1a5('0x0'));var emlformat=require(_0xc1a5('0x1'));var rimraf=require(_0xc1a5('0x2'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0xc1a5('0x3'));var moment=require(_0xc1a5('0x4'));var BPromise=require('bluebird');var Mustache=require(_0xc1a5('0x5'));var util=require(_0xc1a5('0x6'));var path=require('path');var sox=require(_0xc1a5('0x7'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var _=require('lodash');var squel=require(_0xc1a5('0x8'));var crypto=require('crypto');var jsforce=require(_0xc1a5('0x9'));var deskjs=require(_0xc1a5('0xa'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0xc1a5('0xb'));var Redis=require(_0xc1a5('0xc'));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(_0xc1a5('0xd'))(_0xc1a5('0xe'));var utils=require(_0xc1a5('0xf'));var config=require(_0xc1a5('0x10'));var db=require(_0xc1a5('0x11'))['db'];function respondWithStatusCode(_0x339a62,_0x2bc9c4){_0x2bc9c4=_0x2bc9c4||0xcc;return function(_0x5badc7){if(_0x5badc7){return _0x339a62[_0xc1a5('0x12')](_0x2bc9c4);}return _0x339a62['status'](_0x2bc9c4)[_0xc1a5('0x13')]();};}function respondWithResult(_0x1255e8,_0x59e177){_0x59e177=_0x59e177||0xc8;return function(_0x1f3392){if(_0x1f3392){return _0x1255e8[_0xc1a5('0x14')](_0x59e177)[_0xc1a5('0x15')](_0x1f3392);}};}function respondWithFilteredResult(_0x297a9f,_0x2cb240){return function(_0x16afc2){if(_0x16afc2){var _0x7a1d3c=_0x16afc2[_0xc1a5('0x16')],_0x37a9e4=_0x2cb240['offset'],_0x161444=_0x2cb240[_0xc1a5('0x17')]+_0x2cb240[_0xc1a5('0x18')],_0x116fa8;if(_0x161444>=_0x7a1d3c){_0x161444=_0x7a1d3c;_0x116fa8=0xc8;}else{_0x116fa8=0xce;}_0x297a9f[_0xc1a5('0x14')](_0x116fa8);return _0x297a9f['set'](_0xc1a5('0x19'),_0x37a9e4+'-'+_0x161444+'/'+_0x7a1d3c)[_0xc1a5('0x15')](_0x16afc2);}return null;};}function patchUpdates(_0x3adfc2){return function(_0x36309a){try{jsonpatch[_0xc1a5('0x1a')](_0x36309a,_0x3adfc2,!![]);}catch(_0x15f28e){return BPromise[_0xc1a5('0x1b')](_0x15f28e);}return _0x36309a[_0xc1a5('0x1c')]();};}function saveUpdates(_0x35151e,_0x2060f2){return function(_0x43ccfb){if(_0x43ccfb){return _0x43ccfb['update'](_0x35151e)[_0xc1a5('0x1d')](function(_0x4cf30d){return _0x4cf30d;});}return null;};}function removeEntity(_0x2f3529,_0x4f8f59){return function(_0x4748cd){if(_0x4748cd){return _0x4748cd[_0xc1a5('0x1e')]()[_0xc1a5('0x1d')](function(){_0x2f3529[_0xc1a5('0x14')](0xcc)['end']();});}};}function handleEntityNotFound(_0x31fa6f,_0x351832){return function(_0x4f0fc2){if(!_0x4f0fc2){_0x31fa6f[_0xc1a5('0x12')](0x194);}return _0x4f0fc2;};}function handleError(_0x2b02f6,_0xab1e2f){_0xab1e2f=_0xab1e2f||0x1f4;return function(_0x28e7a6){logger[_0xc1a5('0x1f')](_0x28e7a6[_0xc1a5('0x20')]);if(_0x28e7a6[_0xc1a5('0x21')]){delete _0x28e7a6[_0xc1a5('0x21')];}_0x2b02f6['status'](_0xab1e2f)[_0xc1a5('0x22')](_0x28e7a6);};}exports[_0xc1a5('0x23')]=function(_0x54cb75,_0x466142){var _0x943011={},_0x12c264={},_0x407e94={'count':0x0,'rows':[]};var _0x5bece4=_[_0xc1a5('0x24')](db[_0xc1a5('0x25')][_0xc1a5('0x26')],function(_0x28bb9e){return{'name':_0x28bb9e['fieldName'],'type':_0x28bb9e[_0xc1a5('0x27')][_0xc1a5('0x28')]};});_0x12c264[_0xc1a5('0x29')]=_['map'](_0x5bece4,_0xc1a5('0x21'));_0x12c264[_0xc1a5('0x2a')]=_[_0xc1a5('0x2b')](_0x54cb75[_0xc1a5('0x2a')]);_0x12c264[_0xc1a5('0x2c')]=_[_0xc1a5('0x2d')](_0x12c264[_0xc1a5('0x29')],_0x12c264[_0xc1a5('0x2a')]);_0x943011[_0xc1a5('0x2e')]=_[_0xc1a5('0x2d')](_0x12c264[_0xc1a5('0x29')],qs[_0xc1a5('0x2f')](_0x54cb75[_0xc1a5('0x2a')][_0xc1a5('0x2f')]));_0x943011[_0xc1a5('0x2e')]=_0x943011[_0xc1a5('0x2e')][_0xc1a5('0x30')]?_0x943011['attributes']:_0x12c264[_0xc1a5('0x29')];if(!_0x54cb75[_0xc1a5('0x2a')]['hasOwnProperty'](_0xc1a5('0x31'))){_0x943011['limit']=qs[_0xc1a5('0x18')](_0x54cb75['query']['limit']);_0x943011[_0xc1a5('0x17')]=qs['offset'](_0x54cb75[_0xc1a5('0x2a')][_0xc1a5('0x17')]);}_0x943011[_0xc1a5('0x32')]=qs[_0xc1a5('0x33')](_0x54cb75[_0xc1a5('0x2a')][_0xc1a5('0x33')]);_0x943011[_0xc1a5('0x34')]=qs[_0xc1a5('0x2c')](_[_0xc1a5('0x35')](_0x54cb75[_0xc1a5('0x2a')],_0x12c264[_0xc1a5('0x2c')]));if(_0x54cb75[_0xc1a5('0x2a')][_0xc1a5('0x36')]){_0x943011['where']=_[_0xc1a5('0x37')](_0x943011[_0xc1a5('0x34')],{'$or':_[_0xc1a5('0x24')](_0x5bece4,function(_0x414b32){if(_0x414b32[_0xc1a5('0x27')]!==_0xc1a5('0x38')){var _0x34a435={};_0x34a435[_0x414b32['name']]={'$like':'%'+_0x54cb75['query'][_0xc1a5('0x36')]+'%'};return _0x34a435;}})});}_0x943011=_[_0xc1a5('0x37')]({},_0x943011,_0x54cb75[_0xc1a5('0x39')]);var _0x1e964a={'where':_0x943011[_0xc1a5('0x34')]};return db['ZendeskField']['count'](_0x1e964a)[_0xc1a5('0x1d')](function(_0x43ce42){_0x407e94[_0xc1a5('0x16')]=_0x43ce42;if(_0x54cb75[_0xc1a5('0x2a')]['includeAll']){_0x943011[_0xc1a5('0x3a')]=[{'all':!![]}];}return db[_0xc1a5('0x25')]['findAll'](_0x943011);})[_0xc1a5('0x1d')](function(_0x563188){_0x407e94[_0xc1a5('0x3b')]=_0x563188;return _0x407e94;})[_0xc1a5('0x1d')](respondWithFilteredResult(_0x466142,_0x943011))['catch'](handleError(_0x466142,null));};exports[_0xc1a5('0x3c')]=function(_0x5b58c5,_0x87b02){var _0x8f26d5={'raw':!![],'where':{'id':_0x5b58c5['params']['id']}},_0x4bd4d8={};_0x4bd4d8[_0xc1a5('0x29')]=_[_0xc1a5('0x2b')](db[_0xc1a5('0x25')][_0xc1a5('0x26')]);_0x4bd4d8[_0xc1a5('0x2a')]=_[_0xc1a5('0x2b')](_0x5b58c5[_0xc1a5('0x2a')]);_0x4bd4d8[_0xc1a5('0x2c')]=_[_0xc1a5('0x2d')](_0x4bd4d8['model'],_0x4bd4d8[_0xc1a5('0x2a')]);_0x8f26d5[_0xc1a5('0x2e')]=_[_0xc1a5('0x2d')](_0x4bd4d8[_0xc1a5('0x29')],qs['fields'](_0x5b58c5[_0xc1a5('0x2a')][_0xc1a5('0x2f')]));_0x8f26d5[_0xc1a5('0x2e')]=_0x8f26d5[_0xc1a5('0x2e')][_0xc1a5('0x30')]?_0x8f26d5[_0xc1a5('0x2e')]:_0x4bd4d8[_0xc1a5('0x29')];if(_0x5b58c5[_0xc1a5('0x2a')]['includeAll']){_0x8f26d5['include']=[{'all':!![]}];}_0x8f26d5=_['merge']({},_0x8f26d5,_0x5b58c5[_0xc1a5('0x39')]);return db[_0xc1a5('0x25')][_0xc1a5('0x3d')](_0x8f26d5)[_0xc1a5('0x1d')](handleEntityNotFound(_0x87b02,null))[_0xc1a5('0x1d')](respondWithResult(_0x87b02,null))[_0xc1a5('0x3e')](handleError(_0x87b02,null));};exports['create']=function(_0x26f318,_0xc3e437){return db[_0xc1a5('0x25')][_0xc1a5('0x3f')](_0x26f318['body'],{})[_0xc1a5('0x1d')](respondWithResult(_0xc3e437,0xc9))[_0xc1a5('0x3e')](handleError(_0xc3e437,null));};exports[_0xc1a5('0x40')]=function(_0x4c3bff,_0x1a2798){if(_0x4c3bff[_0xc1a5('0x41')]['id']){delete _0x4c3bff[_0xc1a5('0x41')]['id'];}return db[_0xc1a5('0x25')]['find']({'where':{'id':_0x4c3bff[_0xc1a5('0x42')]['id']}})[_0xc1a5('0x1d')](handleEntityNotFound(_0x1a2798,null))['then'](saveUpdates(_0x4c3bff[_0xc1a5('0x41')],null))[_0xc1a5('0x1d')](respondWithResult(_0x1a2798,null))[_0xc1a5('0x3e')](handleError(_0x1a2798,null));};exports['destroy']=function(_0x352a97,_0x15ab06){return db['ZendeskField']['find']({'where':{'id':_0x352a97[_0xc1a5('0x42')]['id']}})[_0xc1a5('0x1d')](handleEntityNotFound(_0x15ab06,null))[_0xc1a5('0x1d')](removeEntity(_0x15ab06,null))[_0xc1a5('0x3e')](handleError(_0x15ab06,null));}; \ No newline at end of file diff --git a/server/api/intZendeskField/intZendeskField.model.js b/server/api/intZendeskField/intZendeskField.model.js index 123cb44..137972c 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 _0x3d15=['rimraf','../../config/environment','./intZendeskField.attributes','ZendeskField','int_zendesk_fields','zendesk_unique_index','FieldId','util','../../config/logger','moment','bluebird','request-promise'];(function(_0x21a9d9,_0x4d5ac8){var _0x46adce=function(_0xfdd336){while(--_0xfdd336){_0x21a9d9['push'](_0x21a9d9['shift']());}};_0x46adce(++_0x4d5ac8);}(_0x3d15,0x127));var _0x53d1=function(_0xa1e7d7,_0x5714bb){_0xa1e7d7=_0xa1e7d7-0x0;var _0x287bee=_0x3d15[_0xa1e7d7];return _0x287bee;};'use strict';var _=require('lodash');var util=require(_0x53d1('0x0'));var logger=require(_0x53d1('0x1'))('api');var moment=require(_0x53d1('0x2'));var BPromise=require(_0x53d1('0x3'));var rp=require(_0x53d1('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x53d1('0x5'));var config=require(_0x53d1('0x6'));var attributes=require(_0x53d1('0x7'));module['exports']=function(_0x3b3e81,_0x74eec6){return _0x3b3e81['define'](_0x53d1('0x8'),attributes,{'tableName':_0x53d1('0x9'),'paranoid':![],'indexes':[{'name':_0x53d1('0xa'),'fields':['idField',_0x53d1('0xb')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0x04b8=['request-promise','path','../../config/environment','./intZendeskField.attributes','exports','define','ZendeskField','zendesk_unique_index','idField','util','api','moment'];(function(_0x5cdad4,_0x213007){var _0x4f78b2=function(_0x290566){while(--_0x290566){_0x5cdad4['push'](_0x5cdad4['shift']());}};_0x4f78b2(++_0x213007);}(_0x04b8,0x159));var _0x804b=function(_0x8e45f4,_0x4ec7fb){_0x8e45f4=_0x8e45f4-0x0;var _0x547279=_0x04b8[_0x8e45f4];return _0x547279;};'use strict';var _=require('lodash');var util=require(_0x804b('0x0'));var logger=require('../../config/logger')(_0x804b('0x1'));var moment=require(_0x804b('0x2'));var BPromise=require('bluebird');var rp=require(_0x804b('0x3'));var fs=require('fs');var path=require(_0x804b('0x4'));var rimraf=require('rimraf');var config=require(_0x804b('0x5'));var attributes=require(_0x804b('0x6'));module[_0x804b('0x7')]=function(_0x5a8a5b,_0x2c22e3){return _0x5a8a5b[_0x804b('0x8')](_0x804b('0x9'),attributes,{'tableName':'int_zendesk_fields','paranoid':![],'indexes':[{'name':_0x804b('0xa'),'fields':[_0x804b('0xb'),'FieldId'],'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 93d583e..52f0a1b 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 _0xe301=['stringify','error','code','message','info','result','catch','util','moment','randomstring','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request','then','ZendeskField,\x20%s,\x20%s','request\x20sent','debug','ZendeskField,\x20%s,\x20%s,\x20%s'];(function(_0x5e233c,_0xaf92a1){var _0x1bc668=function(_0x19c308){while(--_0x19c308){_0x5e233c['push'](_0x5e233c['shift']());}};_0x1bc668(++_0xaf92a1);}(_0xe301,0x125));var _0x1e30=function(_0x3e8930,_0x154364){_0x3e8930=_0x3e8930-0x0;var _0x15b38f=_0xe301[_0x3e8930];return _0x15b38f;};'use strict';var _=require('lodash');var util=require(_0x1e30('0x0'));var moment=require(_0x1e30('0x1'));var BPromise=require('bluebird');var rs=require(_0x1e30('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x1e30('0x3'));var logger=require(_0x1e30('0x4'))('rpc');var config=require(_0x1e30('0x5'));var jayson=require(_0x1e30('0x6'));var client=jayson[_0x1e30('0x7')][_0x1e30('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x4ddb19,_0x71ff09,_0x552885){return new BPromise(function(_0x29af77,_0xd4eac5){return client[_0x1e30('0x9')](_0x4ddb19,_0x552885)[_0x1e30('0xa')](function(_0x50776d){logger['info'](_0x1e30('0xb'),_0x71ff09,_0x1e30('0xc'));logger[_0x1e30('0xd')](_0x1e30('0xe'),_0x71ff09,_0x1e30('0xc'),JSON[_0x1e30('0xf')](_0x50776d));if(_0x50776d[_0x1e30('0x10')]){if(_0x50776d[_0x1e30('0x10')][_0x1e30('0x11')]===0x1f4){logger[_0x1e30('0x10')]('ZendeskField,\x20%s,\x20%s',_0x71ff09,_0x50776d[_0x1e30('0x10')][_0x1e30('0x12')]);return _0xd4eac5(_0x50776d[_0x1e30('0x10')][_0x1e30('0x12')]);}logger[_0x1e30('0x10')]('ZendeskField,\x20%s,\x20%s',_0x71ff09,_0x50776d[_0x1e30('0x10')]['message']);return _0x29af77(_0x50776d[_0x1e30('0x10')][_0x1e30('0x12')]);}else{logger[_0x1e30('0x13')](_0x1e30('0xb'),_0x71ff09,_0x1e30('0xc'));_0x29af77(_0x50776d[_0x1e30('0x14')][_0x1e30('0x12')]);}})[_0x1e30('0x15')](function(_0x2117ee){logger[_0x1e30('0x10')]('ZendeskField,\x20%s,\x20%s',_0x71ff09,_0x2117ee);_0xd4eac5(_0x2117ee);});});} \ No newline at end of file +var _0xeb42=['info','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','ZendeskField,\x20%s,\x20%s','request\x20sent','debug','ZendeskField,\x20%s,\x20%s,\x20%s','stringify','error','code','message'];(function(_0x1b406a,_0x4466b8){var _0x26d88a=function(_0x33c9b9){while(--_0x33c9b9){_0x1b406a['push'](_0x1b406a['shift']());}};_0x26d88a(++_0x4466b8);}(_0xeb42,0x147));var _0x2eb4=function(_0x311909,_0x414bf7){_0x311909=_0x311909-0x0;var _0x8d3163=_0xeb42[_0x311909];return _0x8d3163;};'use strict';var _=require(_0x2eb4('0x0'));var util=require(_0x2eb4('0x1'));var moment=require(_0x2eb4('0x2'));var BPromise=require(_0x2eb4('0x3'));var rs=require(_0x2eb4('0x4'));var fs=require('fs');var Redis=require(_0x2eb4('0x5'));var db=require(_0x2eb4('0x6'))['db'];var utils=require(_0x2eb4('0x7'));var logger=require(_0x2eb4('0x8'))(_0x2eb4('0x9'));var config=require(_0x2eb4('0xa'));var jayson=require(_0x2eb4('0xb'));var client=jayson[_0x2eb4('0xc')][_0x2eb4('0xd')]({'port':0x232a});function respondWithRpcPromise(_0x390b0a,_0x3c4256,_0x784072){return new BPromise(function(_0x5c0c1a,_0x493e94){return client[_0x2eb4('0xe')](_0x390b0a,_0x784072)[_0x2eb4('0xf')](function(_0x5adc0f){logger['info'](_0x2eb4('0x10'),_0x3c4256,_0x2eb4('0x11'));logger[_0x2eb4('0x12')](_0x2eb4('0x13'),_0x3c4256,_0x2eb4('0x11'),JSON[_0x2eb4('0x14')](_0x5adc0f));if(_0x5adc0f[_0x2eb4('0x15')]){if(_0x5adc0f[_0x2eb4('0x15')][_0x2eb4('0x16')]===0x1f4){logger['error'](_0x2eb4('0x10'),_0x3c4256,_0x5adc0f[_0x2eb4('0x15')][_0x2eb4('0x17')]);return _0x493e94(_0x5adc0f[_0x2eb4('0x15')][_0x2eb4('0x17')]);}logger[_0x2eb4('0x15')](_0x2eb4('0x10'),_0x3c4256,_0x5adc0f['error'][_0x2eb4('0x17')]);return _0x5c0c1a(_0x5adc0f[_0x2eb4('0x15')]['message']);}else{logger[_0x2eb4('0x18')](_0x2eb4('0x10'),_0x3c4256,_0x2eb4('0x11'));_0x5c0c1a(_0x5adc0f[_0x2eb4('0x19')][_0x2eb4('0x17')]);}})[_0x2eb4('0x1a')](function(_0x40909f){logger[_0x2eb4('0x15')](_0x2eb4('0x10'),_0x3c4256,_0x40909f);_0x493e94(_0x40909f);});});} \ No newline at end of file diff --git a/server/api/intZohoAccount/index.js b/server/api/intZohoAccount/index.js index aebb763..d5c6994 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 _0x481a=['/:id','update','delete','destroy','exports','util','Router','../../components/auth/service','../../config/environment','./intZohoAccount.controller','get','isAuthenticated','index','/:id/configurations','getConfigurations','/:id/fields','getFields','post','create','addConfiguration','put'];(function(_0x12e707,_0x798cad){var _0x2c3ae8=function(_0x54f9af){while(--_0x54f9af){_0x12e707['push'](_0x12e707['shift']());}};_0x2c3ae8(++_0x798cad);}(_0x481a,0x1d3));var _0xa481=function(_0x24f004,_0x40f832){_0x24f004=_0x24f004-0x0;var _0x3f4286=_0x481a[_0x24f004];return _0x3f4286;};'use strict';var multer=require('multer');var util=require(_0xa481('0x0'));var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express[_0xa481('0x1')]();var auth=require(_0xa481('0x2'));var interaction=require('../../components/interaction/service');var config=require(_0xa481('0x3'));var controller=require(_0xa481('0x4'));router[_0xa481('0x5')]('/',auth[_0xa481('0x6')](),controller[_0xa481('0x7')]);router['get']('/:id',auth[_0xa481('0x6')](),controller['show']);router[_0xa481('0x5')](_0xa481('0x8'),auth[_0xa481('0x6')](),controller[_0xa481('0x9')]);router[_0xa481('0x5')](_0xa481('0xa'),auth[_0xa481('0x6')](),controller[_0xa481('0xb')]);router[_0xa481('0xc')]('/',auth['isAuthenticated'](),controller[_0xa481('0xd')]);router[_0xa481('0xc')](_0xa481('0x8'),auth[_0xa481('0x6')](),controller[_0xa481('0xe')]);router[_0xa481('0xf')](_0xa481('0x10'),auth['isAuthenticated'](),controller[_0xa481('0x11')]);router[_0xa481('0x12')](_0xa481('0x10'),auth[_0xa481('0x6')](),controller[_0xa481('0x13')]);module[_0xa481('0x14')]=router; \ No newline at end of file +var _0x1445=['../../config/environment','./intZohoAccount.controller','get','isAuthenticated','index','show','/:id/configurations','getConfigurations','create','post','addConfiguration','put','/:id','update','delete','exports','multer','util','path','express','Router','../../components/auth/service','../../components/interaction/service'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x1445,0x1dc));var _0x5144=function(_0x59564d,_0x3ca8e9){_0x59564d=_0x59564d-0x0;var _0x47b75d=_0x1445[_0x59564d];return _0x47b75d;};'use strict';var multer=require(_0x5144('0x0'));var util=require(_0x5144('0x1'));var path=require(_0x5144('0x2'));var timeout=require('connect-timeout');var express=require(_0x5144('0x3'));var router=express[_0x5144('0x4')]();var auth=require(_0x5144('0x5'));var interaction=require(_0x5144('0x6'));var config=require(_0x5144('0x7'));var controller=require(_0x5144('0x8'));router[_0x5144('0x9')]('/',auth[_0x5144('0xa')](),controller[_0x5144('0xb')]);router[_0x5144('0x9')]('/:id',auth['isAuthenticated'](),controller[_0x5144('0xc')]);router[_0x5144('0x9')](_0x5144('0xd'),auth[_0x5144('0xa')](),controller[_0x5144('0xe')]);router['get']('/:id/fields',auth[_0x5144('0xa')](),controller['getFields']);router['post']('/',auth[_0x5144('0xa')](),controller[_0x5144('0xf')]);router[_0x5144('0x10')](_0x5144('0xd'),auth[_0x5144('0xa')](),controller[_0x5144('0x11')]);router[_0x5144('0x12')](_0x5144('0x13'),auth[_0x5144('0xa')](),controller[_0x5144('0x14')]);router[_0x5144('0x15')]('/:id',auth[_0x5144('0xa')](),controller['destroy']);module[_0x5144('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 97788f5..6cfd219 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 _0x6719=['exports','STRING'];(function(_0x5da5b1,_0x416be4){var _0x476405=function(_0x47dc1f){while(--_0x47dc1f){_0x5da5b1['push'](_0x5da5b1['shift']());}};_0x476405(++_0x416be4);}(_0x6719,0x1b0));var _0x9671=function(_0x22fb94,_0x9a235c){_0x22fb94=_0x22fb94-0x0;var _0x33da77=_0x6719[_0x22fb94];return _0x33da77;};'use strict';var Sequelize=require('sequelize');module[_0x9671('0x0')]={'name':{'type':Sequelize[_0x9671('0x1')]},'description':{'type':Sequelize[_0x9671('0x1')]},'host':{'type':Sequelize[_0x9671('0x1')]},'zone':{'type':Sequelize['STRING']},'clientId':{'type':Sequelize[_0x9671('0x1')]},'clientSecret':{'type':Sequelize[_0x9671('0x1')]},'serverUrl':{'type':Sequelize['STRING']},'code':{'type':Sequelize[_0x9671('0x1')]},'refreshToken':{'type':Sequelize[_0x9671('0x1')]}}; \ No newline at end of file +var _0x536e=['STRING','sequelize'];(function(_0x2e3107,_0x25f970){var _0x833d69=function(_0x420e78){while(--_0x420e78){_0x2e3107['push'](_0x2e3107['shift']());}};_0x833d69(++_0x25f970);}(_0x536e,0x19f));var _0xe536=function(_0x4629ed,_0x59ef85){_0x4629ed=_0x4629ed-0x0;var _0x52ca04=_0x536e[_0x4629ed];return _0x52ca04;};'use strict';var Sequelize=require(_0xe536('0x0'));module['exports']={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize['STRING']},'host':{'type':Sequelize[_0xe536('0x1')]},'zone':{'type':Sequelize[_0xe536('0x1')]},'clientId':{'type':Sequelize[_0xe536('0x1')]},'clientSecret':{'type':Sequelize[_0xe536('0x1')]},'serverUrl':{'type':Sequelize[_0xe536('0x1')]},'code':{'type':Sequelize[_0xe536('0x1')]},'refreshToken':{'type':Sequelize[_0xe536('0x1')]}}; \ No newline at end of file diff --git a/server/api/intZohoAccount/intZohoAccount.controller.js b/server/api/intZohoAccount/intZohoAccount.controller.js index 9d60f31..00d3711 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 _0x40e0=['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','ZohoAccount,\x20%s,\x20%s','request\x20sent','debug','ZohoAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','sendStatus','end','json','count','offset','limit','status','Content-Range','apply','reject','update','name','send','index','ZohoAccount','rawAttributes','fieldName','type','key','model','map','filters','intersection','attributes','query','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','rows','show','params','keys','includeAll','include','create','body','find','getConfigurations','findOne','ZohoConfiguration','addConfiguration','getSubjects','Descriptions','getDescriptions','channel','ZohoField','https://accounts.zoho.com','https://accounts.zoho.com.au','https://accounts.zoho.eu','https://accounts.zoho.in','https://accounts.zoho.com.cn','POST','refreshToken','refresh_token','access_token','getFields','zone','clientSecret','serverUrl','zoho.eu','slice','lastIndexOf','Refresh\x20Token\x20not\x20available\x20for\x20the\x20account','GET','format','Calls','response','Subject','Description','WhoId','Call_Result','Call_Type','remove','includes','api_name','push','custom_field','data_type','picklist','pick_list_values','statusCode','test','Wrong\x20credentials','eml-format','fast-json-patch','request-promise','moment','bluebird','mustache','util','crypto','jsforce','desk.js','querystring','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','../../components/integrations/configuration','jayson/promise','client','http'];(function(_0x57b54c,_0x54ce0d){var _0x59cc19=function(_0xa33bc6){while(--_0xa33bc6){_0x57b54c['push'](_0x57b54c['shift']());}};_0x59cc19(++_0x54ce0d);}(_0x40e0,0x1f0));var _0x040e=function(_0x889989,_0x4a8da6){_0x889989=_0x889989-0x0;var _0x3bf7d7=_0x40e0[_0x889989];return _0x3bf7d7;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x040e('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x040e('0x1'));var rp=require(_0x040e('0x2'));var moment=require(_0x040e('0x3'));var BPromise=require(_0x040e('0x4'));var Mustache=require(_0x040e('0x5'));var util=require(_0x040e('0x6'));var path=require('path');var sox=require('sox');var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var _=require('lodash');var squel=require('squel');var crypto=require(_0x040e('0x7'));var jsforce=require(_0x040e('0x8'));var deskjs=require(_0x040e('0x9'));var toCsv=require('to-csv');var querystring=require(_0x040e('0xa'));var Papa=require('papaparse');var Redis=require(_0x040e('0xb'));var authService=require('../../components/auth/service');var qs=require(_0x040e('0xc'));var as=require(_0x040e('0xd'));var hardwareService=require(_0x040e('0xe'));var logger=require(_0x040e('0xf'))(_0x040e('0x10'));var utils=require(_0x040e('0x11'));var config=require(_0x040e('0x12'));var db=require(_0x040e('0x13'))['db'];var integrations=require(_0x040e('0x14'));var jayson=require(_0x040e('0x15'));var client=jayson[_0x040e('0x16')][_0x040e('0x17')]({'port':0x232a});function checkPasswordPattern(_0x2e56c3,_0x266161,_0x3d9ea1){if(_0x3d9ea1){var _0x217ec8=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x217ec8['test'](_0x266161)){return _0x2e56c3;}else{throw new db[(_0x040e('0x18'))][(_0x040e('0x19'))](_0x040e('0x1a'));}}else{return _0x2e56c3;}}function respondWithRpcPromise(_0x40fc12,_0x6714a9,_0xe8b648,_0x15e49b){return new BPromise(function(_0x447c2c,_0xd6a714){var _0x23c291=_0x15e49b||client;return _0x23c291['request'](_0x40fc12,_0xe8b648)[_0x040e('0x1b')](function(_0x521592){logger[_0x040e('0x1c')](_0x040e('0x1d'),_0x6714a9,_0x040e('0x1e'));logger[_0x040e('0x1f')](_0x040e('0x20'),_0x6714a9,_0x040e('0x1e'),JSON[_0x040e('0x21')](_0x521592));if(_0x521592[_0x040e('0x22')]){if(_0x521592[_0x040e('0x22')][_0x040e('0x23')]===0x1f4){logger[_0x040e('0x22')](_0x040e('0x1d'),_0x6714a9,_0x521592['error'][_0x040e('0x24')]);return _0xd6a714(_0x521592['error']['message']);}logger[_0x040e('0x22')](_0x040e('0x1d'),_0x6714a9,_0x521592[_0x040e('0x22')]['message']);return _0x447c2c(_0x521592['error'][_0x040e('0x24')]);}else{logger[_0x040e('0x1c')](_0x040e('0x1d'),_0x6714a9,_0x040e('0x1e'));_0x447c2c(_0x521592['result'][_0x040e('0x24')]);}})[_0x040e('0x25')](function(_0x194820){logger['error'](_0x040e('0x1d'),_0x6714a9,_0x194820);_0xd6a714(_0x194820);});});}function respondWithStatusCode(_0x2b7d25,_0x11dfce){_0x11dfce=_0x11dfce||0xcc;return function(_0x1769fe){if(_0x1769fe){return _0x2b7d25[_0x040e('0x26')](_0x11dfce);}return _0x2b7d25['status'](_0x11dfce)[_0x040e('0x27')]();};}function respondWithResult(_0x1179bd,_0x1954e7){_0x1954e7=_0x1954e7||0xc8;return function(_0x5a9696){if(_0x5a9696){return _0x1179bd['status'](_0x1954e7)[_0x040e('0x28')](_0x5a9696);}};}function respondWithFilteredResult(_0x43b828,_0x3e6eba){return function(_0x345931){if(_0x345931){var _0x38d0dc=_0x345931[_0x040e('0x29')],_0x394df1=_0x3e6eba[_0x040e('0x2a')],_0x14e756=_0x3e6eba['offset']+_0x3e6eba[_0x040e('0x2b')],_0x5356ae;if(_0x14e756>=_0x38d0dc){_0x14e756=_0x38d0dc;_0x5356ae=0xc8;}else{_0x5356ae=0xce;}_0x43b828[_0x040e('0x2c')](_0x5356ae);return _0x43b828['set'](_0x040e('0x2d'),_0x394df1+'-'+_0x14e756+'/'+_0x38d0dc)['json'](_0x345931);}return null;};}function patchUpdates(_0x4be846){return function(_0x292cb7){try{jsonpatch[_0x040e('0x2e')](_0x292cb7,_0x4be846,!![]);}catch(_0x55f6fe){return BPromise[_0x040e('0x2f')](_0x55f6fe);}return _0x292cb7['save']();};}function saveUpdates(_0x21f8f0,_0x58f526){return function(_0xadcd1a){if(_0xadcd1a){return _0xadcd1a[_0x040e('0x30')](_0x21f8f0)[_0x040e('0x1b')](function(_0x5c8d40){return _0x5c8d40;});}return null;};}function removeEntity(_0x25bfdc,_0x100ab9){return function(_0x1c0fe3){if(_0x1c0fe3){return _0x1c0fe3['destroy']()[_0x040e('0x1b')](function(){_0x25bfdc['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x5b1178,_0x4249ea){return function(_0x16a66f){if(!_0x16a66f){_0x5b1178[_0x040e('0x26')](0x194);}return _0x16a66f;};}function handleError(_0x11f425,_0x26d536){_0x26d536=_0x26d536||0x1f4;return function(_0x162207){logger[_0x040e('0x22')](_0x162207['stack']);if(_0x162207[_0x040e('0x31')]){delete _0x162207[_0x040e('0x31')];}_0x11f425[_0x040e('0x2c')](_0x26d536)[_0x040e('0x32')](_0x162207);};}exports[_0x040e('0x33')]=function(_0x31953,_0x21b336){var _0x324bad={},_0x1cea29={},_0x5915f9={'count':0x0,'rows':[]};var _0x12be38=_['map'](db[_0x040e('0x34')][_0x040e('0x35')],function(_0x3470ec){return{'name':_0x3470ec[_0x040e('0x36')],'type':_0x3470ec[_0x040e('0x37')][_0x040e('0x38')]};});_0x1cea29[_0x040e('0x39')]=_[_0x040e('0x3a')](_0x12be38,'name');_0x1cea29['query']=_['keys'](_0x31953['query']);_0x1cea29[_0x040e('0x3b')]=_[_0x040e('0x3c')](_0x1cea29[_0x040e('0x39')],_0x1cea29['query']);_0x324bad[_0x040e('0x3d')]=_[_0x040e('0x3c')](_0x1cea29[_0x040e('0x39')],qs['fields'](_0x31953[_0x040e('0x3e')][_0x040e('0x3f')]));_0x324bad[_0x040e('0x3d')]=_0x324bad['attributes'][_0x040e('0x40')]?_0x324bad['attributes']:_0x1cea29[_0x040e('0x39')];if(!_0x31953[_0x040e('0x3e')][_0x040e('0x41')](_0x040e('0x42'))){_0x324bad['limit']=qs[_0x040e('0x2b')](_0x31953[_0x040e('0x3e')][_0x040e('0x2b')]);_0x324bad['offset']=qs['offset'](_0x31953[_0x040e('0x3e')][_0x040e('0x2a')]);}_0x324bad[_0x040e('0x43')]=qs[_0x040e('0x44')](_0x31953[_0x040e('0x3e')][_0x040e('0x44')]);_0x324bad[_0x040e('0x45')]=qs[_0x040e('0x3b')](_[_0x040e('0x46')](_0x31953[_0x040e('0x3e')],_0x1cea29['filters']));if(_0x31953[_0x040e('0x3e')][_0x040e('0x47')]){_0x324bad['where']=_[_0x040e('0x48')](_0x324bad[_0x040e('0x45')],{'$or':_[_0x040e('0x3a')](_0x12be38,function(_0xcfe61f){if(_0xcfe61f[_0x040e('0x37')]!==_0x040e('0x49')){var _0x20f103={};_0x20f103[_0xcfe61f['name']]={'$like':'%'+_0x31953['query'][_0x040e('0x47')]+'%'};return _0x20f103;}})});}_0x324bad=_[_0x040e('0x48')]({},_0x324bad,_0x31953[_0x040e('0x4a')]);var _0x288f1f={'where':_0x324bad[_0x040e('0x45')]};return db[_0x040e('0x34')][_0x040e('0x29')](_0x288f1f)[_0x040e('0x1b')](function(_0x4baec0){_0x5915f9[_0x040e('0x29')]=_0x4baec0;if(_0x31953[_0x040e('0x3e')]['includeAll']){_0x324bad['include']=[{'all':!![]}];}return db['ZohoAccount']['findAll'](_0x324bad);})[_0x040e('0x1b')](function(_0x333169){_0x5915f9[_0x040e('0x4b')]=_0x333169;return _0x5915f9;})['then'](respondWithFilteredResult(_0x21b336,_0x324bad))[_0x040e('0x25')](handleError(_0x21b336,null));};exports[_0x040e('0x4c')]=function(_0x2da667,_0x3c0e14){var _0x3381f9={'raw':![],'where':{'id':_0x2da667[_0x040e('0x4d')]['id']}},_0x5934dd={};_0x5934dd[_0x040e('0x39')]=_[_0x040e('0x4e')](db['ZohoAccount'][_0x040e('0x35')]);_0x5934dd[_0x040e('0x3e')]=_[_0x040e('0x4e')](_0x2da667[_0x040e('0x3e')]);_0x5934dd[_0x040e('0x3b')]=_['intersection'](_0x5934dd[_0x040e('0x39')],_0x5934dd[_0x040e('0x3e')]);_0x3381f9[_0x040e('0x3d')]=_[_0x040e('0x3c')](_0x5934dd[_0x040e('0x39')],qs[_0x040e('0x3f')](_0x2da667[_0x040e('0x3e')][_0x040e('0x3f')]));_0x3381f9[_0x040e('0x3d')]=_0x3381f9[_0x040e('0x3d')][_0x040e('0x40')]?_0x3381f9[_0x040e('0x3d')]:_0x5934dd[_0x040e('0x39')];if(_0x2da667[_0x040e('0x3e')][_0x040e('0x4f')]){_0x3381f9[_0x040e('0x50')]=[{'all':!![]}];}_0x3381f9=_[_0x040e('0x48')]({},_0x3381f9,_0x2da667[_0x040e('0x4a')]);return db[_0x040e('0x34')]['find'](_0x3381f9)['then'](handleEntityNotFound(_0x3c0e14,null))['then'](respondWithResult(_0x3c0e14,null))[_0x040e('0x25')](handleError(_0x3c0e14,null));};exports[_0x040e('0x51')]=function(_0x570606,_0x575a7c){return db['ZohoAccount'][_0x040e('0x51')](_0x570606[_0x040e('0x52')],{})[_0x040e('0x1b')](respondWithResult(_0x575a7c,0xc9))[_0x040e('0x25')](handleError(_0x575a7c,null));};exports[_0x040e('0x30')]=function(_0x26f775,_0x20a19a){if(_0x26f775[_0x040e('0x52')]['id']){delete _0x26f775['body']['id'];}return db[_0x040e('0x34')]['find']({'where':{'id':_0x26f775[_0x040e('0x4d')]['id']}})[_0x040e('0x1b')](handleEntityNotFound(_0x20a19a,null))[_0x040e('0x1b')](saveUpdates(_0x26f775['body'],null))[_0x040e('0x1b')](respondWithResult(_0x20a19a,null))[_0x040e('0x25')](handleError(_0x20a19a,null));};exports['destroy']=function(_0x566ca2,_0x1cf247){return db[_0x040e('0x34')][_0x040e('0x53')]({'where':{'id':_0x566ca2[_0x040e('0x4d')]['id']}})[_0x040e('0x1b')](handleEntityNotFound(_0x1cf247,null))['then'](removeEntity(_0x1cf247,null))['catch'](handleError(_0x1cf247,null));};exports[_0x040e('0x54')]=function(_0x1f8315,_0x389509,_0x5ae010){var _0x4265ce={};var _0x3c3d2e={};var _0x2c9ec8;var _0x2ca8bd;return db[_0x040e('0x34')][_0x040e('0x55')]({'where':{'id':_0x1f8315[_0x040e('0x4d')]['id']}})['then'](handleEntityNotFound(_0x389509,null))[_0x040e('0x1b')](function(_0x366e48){if(_0x366e48){_0x2c9ec8=_0x366e48;_0x3c3d2e[_0x040e('0x39')]=_[_0x040e('0x4e')](db[_0x040e('0x56')][_0x040e('0x35')]);_0x3c3d2e[_0x040e('0x3e')]=_[_0x040e('0x4e')](_0x1f8315[_0x040e('0x3e')]);_0x3c3d2e[_0x040e('0x3b')]=_[_0x040e('0x3c')](_0x3c3d2e[_0x040e('0x39')],_0x3c3d2e['query']);_0x4265ce[_0x040e('0x3d')]=_[_0x040e('0x3c')](_0x3c3d2e['model'],qs[_0x040e('0x3f')](_0x1f8315[_0x040e('0x3e')][_0x040e('0x3f')]));_0x4265ce[_0x040e('0x3d')]=_0x4265ce[_0x040e('0x3d')]['length']?_0x4265ce[_0x040e('0x3d')]:_0x3c3d2e['model'];_0x4265ce[_0x040e('0x43')]=qs['sort'](_0x1f8315[_0x040e('0x3e')][_0x040e('0x44')]);_0x4265ce['where']=qs[_0x040e('0x3b')](_[_0x040e('0x46')](_0x1f8315[_0x040e('0x3e')],_0x3c3d2e[_0x040e('0x3b')]));if(_0x1f8315['query']['filter']){_0x4265ce[_0x040e('0x45')]=_[_0x040e('0x48')](_0x4265ce['where'],{'$or':_['map'](_0x4265ce[_0x040e('0x3d')],function(_0x5dd2b4){var _0x4051c4={};_0x4051c4[_0x5dd2b4]={'$like':'%'+_0x1f8315[_0x040e('0x3e')]['filter']+'%'};return _0x4051c4;})});}_0x4265ce=_['merge']({},_0x4265ce,_0x1f8315[_0x040e('0x4a')]);return _0x2c9ec8[_0x040e('0x54')](_0x4265ce);}})[_0x040e('0x1b')](function(_0x366f7b){if(_0x366f7b){_0x2ca8bd=_0x366f7b[_0x040e('0x40')];if(!_0x1f8315[_0x040e('0x3e')][_0x040e('0x41')]('nolimit')){_0x4265ce[_0x040e('0x2b')]=qs[_0x040e('0x2b')](_0x1f8315[_0x040e('0x3e')][_0x040e('0x2b')]);_0x4265ce[_0x040e('0x2a')]=qs[_0x040e('0x2a')](_0x1f8315['query'][_0x040e('0x2a')]);}return _0x2c9ec8['getConfigurations'](_0x4265ce);}})[_0x040e('0x1b')](function(_0xd0f3cf){if(_0xd0f3cf){return _0xd0f3cf?{'count':_0x2ca8bd,'rows':_0xd0f3cf}:null;}})['then'](respondWithResult(_0x389509,null))[_0x040e('0x25')](handleError(_0x389509,null));};exports[_0x040e('0x57')]=function(_0x28d7f9,_0x41ed60,_0x2c9fdd){if(_0x28d7f9[_0x040e('0x52')]['id']){delete _0x28d7f9[_0x040e('0x52')]['id'];}return db[_0x040e('0x34')]['findOne']({'where':{'id':_0x28d7f9[_0x040e('0x4d')]['id']}})[_0x040e('0x1b')](handleEntityNotFound(_0x41ed60,null))[_0x040e('0x1b')](function(_0x526830){if(_0x526830){_0x28d7f9['body']['AccountId']=_0x526830['id'];_0x28d7f9[_0x040e('0x52')]['Subjects']=integrations[_0x040e('0x58')](_0x28d7f9['body']['channel'],_0x28d7f9[_0x040e('0x52')][_0x040e('0x37')]);_0x28d7f9['body'][_0x040e('0x59')]=integrations[_0x040e('0x5a')](_0x28d7f9[_0x040e('0x52')][_0x040e('0x5b')],_0x28d7f9[_0x040e('0x52')][_0x040e('0x37')]);return db['ZohoConfiguration'][_0x040e('0x51')](_0x28d7f9[_0x040e('0x52')],{'include':[{'model':db[_0x040e('0x5c')],'as':'Subjects'},{'model':db[_0x040e('0x5c')],'as':'Descriptions'}]});}return null;})[_0x040e('0x1b')](respondWithResult(_0x41ed60,null))[_0x040e('0x25')](handleError(_0x41ed60,null));};function getAccessToken(_0x2a649d){return new Promise(function(_0x29a25a,_0x45b29e){var _0xcd702d;switch(_0x2a649d['zone']){case'US':_0xcd702d=_0x040e('0x5d');break;case'AU':_0xcd702d=_0x040e('0x5e');break;case'EU':_0xcd702d=_0x040e('0x5f');break;case'IN':_0xcd702d=_0x040e('0x60');break;case'CN':_0xcd702d=_0x040e('0x61');break;default:_0xcd702d=_0x040e('0x5f');break;}var _0x1a119f={'method':_0x040e('0x62'),'uri':_0xcd702d+'/oauth/v2/token','qs':{'refresh_token':_0x2a649d[_0x040e('0x63')],'client_id':_0x2a649d['clientId'],'client_secret':_0x2a649d['clientSecret'],'grant_type':_0x040e('0x64')},'json':!![]};return rp(_0x1a119f)[_0x040e('0x1b')](function(_0x2286a5){if(_0x2286a5[_0x040e('0x65')]){_0x29a25a(_0x2286a5['access_token']);}else{_0x45b29e('Unable\x20to\x20retrieve\x20the\x20access\x20token');}})[_0x040e('0x25')](function(_0x2b5cac){_0x45b29e(_0x2b5cac);});});}exports[_0x040e('0x66')]=function(_0x129126,_0x582fe3,_0x3ecee4){var _0xd5229a,_0x38063e,_0x2d54f4,_0x29cd0f,_0x47872d;return db[_0x040e('0x34')]['findOne']({'where':{'id':_0x129126['params']['id']},'attributes':['id','host',_0x040e('0x67'),'clientId',_0x040e('0x68'),_0x040e('0x69'),_0x040e('0x23'),_0x040e('0x63')]})['then'](handleEntityNotFound(_0x582fe3,null))[_0x040e('0x1b')](function(_0x279506){_0x47872d=_0x279506;_0xd5229a=_0x47872d['host'];_0x38063e=_0xd5229a===_0x040e('0x6a')?'eu':'com';_0x2d54f4=_0x47872d[_0x040e('0x69')];var _0x484b28=_0x2d54f4[_0x040e('0x6b')](-0x1);if(_0x484b28==='/'||_0x484b28==='\x5c'||_0x484b28===':'){_0x2d54f4=_0x2d54f4['substring'](0x0,_0x2d54f4[_0x040e('0x6c')](_0x484b28));}if(!_0x47872d['refreshToken']){throw new Error(_0x040e('0x6d'));}return getAccessToken(_0x47872d);})['then'](function(_0x31d12c){if(_0x31d12c){return rp({'method':_0x040e('0x6e'),'uri':util[_0x040e('0x6f')]('https://www.zohoapis.%s/crm/v2/settings/fields',_0x38063e),'qs':{'module':_0x040e('0x70')},'headers':{'Authorization':'Zoho-oauthtoken\x20'+_0x31d12c},'json':!![]});}})[_0x040e('0x1b')](function(_0x4c7c70){if(_0x4c7c70){if(_0x4c7c70['response']&&_0x4c7c70[_0x040e('0x71')][_0x040e('0x22')]){throw new Error(_0x4c7c70[_0x040e('0x71')][_0x040e('0x22')][_0x040e('0x24')]);}var _0x4bda4c=[];var _0x9a9f32=[];var _0x457dbe=['Owner',_0x040e('0x72'),_0x040e('0x73'),_0x040e('0x74'),'Call_Duration',_0x040e('0x75'),'Call_Start_Time',_0x040e('0x76')];_0x9a9f32=_[_0x040e('0x77')](_0x4c7c70[_0x040e('0x3f')],function(_0x30a8b6){return _0x457dbe[_0x040e('0x78')](_0x30a8b6[_0x040e('0x79')]);});for(var _0x7ed1ff=0x0;_0x7ed1ff<_0x9a9f32['length'];_0x7ed1ff++){if(_0x9a9f32[_0x7ed1ff]['system_mandatory']===![]){_0x4bda4c[_0x040e('0x7a')]({'id':_0x9a9f32[_0x7ed1ff]['id'],'name':_0x9a9f32[_0x7ed1ff]['display_label'],'custom':_0x9a9f32[_0x7ed1ff][_0x040e('0x7b')],'options':_0x9a9f32[_0x7ed1ff][_0x040e('0x7c')]===_0x040e('0x7d')&&_0x9a9f32[_0x7ed1ff][_0x040e('0x7e')]['length']>-0x1?_[_0x040e('0x3a')](_0x9a9f32[_0x7ed1ff]['pick_list_values'],function(_0x2df3f0){return{'name':_0x2df3f0,'value':_0x2df3f0};}):[]});}}return{'count':_0x4bda4c[_0x040e('0x40')],'rows':_0x4bda4c};}else{return{'count':0x0,'rows':[]};}})[_0x040e('0x1b')](respondWithResult(_0x582fe3,null))[_0x040e('0x25')](function(_0x1a1d52){var _0x45acf6=_0x129126[_0x040e('0x3e')]['test']?0x1f4:_0x1a1d52[_0x040e('0x7f')]||0x1f4;logger[_0x040e('0x22')]('getFields,\x20%s,\x20%s,\x20%s','getFields',_0x45acf6,JSON[_0x040e('0x21')](_0x1a1d52));delete _0x1a1d52[_0x040e('0x31')];if(_0x45acf6===0x191){_0x45acf6=0x190;}_0x582fe3[_0x040e('0x2c')](_0x45acf6)[_0x040e('0x32')](_0x129126[_0x040e('0x3e')][_0x040e('0x80')]?{'message':_0x040e('0x81'),'statusCode':_0x1a1d52[_0x040e('0x7f')]}:_0x1a1d52);});}; \ No newline at end of file +var _0x5646=['https://accounts.zoho.com','https://accounts.zoho.com.au','https://accounts.zoho.com.cn','https://accounts.zoho.eu','POST','/oauth/v2/token','refreshToken','clientId','clientSecret','refresh_token','access_token','getFields','host','serverUrl','zoho.eu','lastIndexOf','format','https://www.zohoapis.%s/crm/v2/settings/fields','Calls','Zoho-oauthtoken\x20','response','Owner','Description','WhoId','Call_Duration','Call_Start_Time','remove','includes','api_name','system_mandatory','display_label','custom_field','data_type','picklist','pick_list_values','statusCode','send','Wrong\x20credentials','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','mustache','util','path','to-csv','ejs','lodash','squel','crypto','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','../../components/integrations/configuration','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','ZohoAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','ZohoAccount,\x20%s,\x20%s','message','result','catch','sendStatus','status','json','count','offset','limit','set','Content-Range','apply','reject','save','update','destroy','end','stack','name','index','map','ZohoAccount','rawAttributes','fieldName','type','query','keys','filters','intersection','model','fields','attributes','length','hasOwnProperty','nolimit','order','where','pick','filter','options','include','findAll','rows','show','params','merge','find','create','body','getConfigurations','findOne','ZohoConfiguration','sort','addConfiguration','AccountId','Subjects','Descriptions','getDescriptions','ZohoField','zone'];(function(_0xb78120,_0x35ee22){var _0x3c8540=function(_0x17eaf1){while(--_0x17eaf1){_0xb78120['push'](_0xb78120['shift']());}};_0x3c8540(++_0x35ee22);}(_0x5646,0x1b8));var _0x6564=function(_0x5400b,_0x55943a){_0x5400b=_0x5400b-0x0;var _0x36a39b=_0x5646[_0x5400b];return _0x36a39b;};'use strict';var pdf=require(_0x6564('0x0'));var emlformat=require(_0x6564('0x1'));var rimraf=require(_0x6564('0x2'));var zipdir=require(_0x6564('0x3'));var jsonpatch=require(_0x6564('0x4'));var rp=require('request-promise');var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x6564('0x5'));var util=require(_0x6564('0x6'));var path=require(_0x6564('0x7'));var sox=require('sox');var csv=require(_0x6564('0x8'));var ejs=require(_0x6564('0x9'));var fs=require('fs');var _=require(_0x6564('0xa'));var squel=require(_0x6564('0xb'));var crypto=require(_0x6564('0xc'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x6564('0x8'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x6564('0xd'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x6564('0xe'));var hardwareService=require(_0x6564('0xf'));var logger=require(_0x6564('0x10'))(_0x6564('0x11'));var utils=require(_0x6564('0x12'));var config=require(_0x6564('0x13'));var db=require(_0x6564('0x14'))['db'];var integrations=require(_0x6564('0x15'));var jayson=require('jayson/promise');var client=jayson['client'][_0x6564('0x16')]({'port':0x232a});function checkPasswordPattern(_0x50732e,_0x5c270e,_0x3c4670){if(_0x3c4670){var _0x360279=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x360279[_0x6564('0x17')](_0x5c270e)){return _0x50732e;}else{throw new db[(_0x6564('0x18'))][(_0x6564('0x19'))](_0x6564('0x1a'));}}else{return _0x50732e;}}function respondWithRpcPromise(_0x530770,_0x183f90,_0x101ac9,_0x509330){return new BPromise(function(_0x42811a,_0x221fca){var _0x175a91=_0x509330||client;return _0x175a91[_0x6564('0x1b')](_0x530770,_0x101ac9)[_0x6564('0x1c')](function(_0x2dbb4d){logger[_0x6564('0x1d')]('ZohoAccount,\x20%s,\x20%s',_0x183f90,_0x6564('0x1e'));logger['debug'](_0x6564('0x1f'),_0x183f90,_0x6564('0x1e'),JSON[_0x6564('0x20')](_0x2dbb4d));if(_0x2dbb4d[_0x6564('0x21')]){if(_0x2dbb4d['error'][_0x6564('0x22')]===0x1f4){logger[_0x6564('0x21')](_0x6564('0x23'),_0x183f90,_0x2dbb4d[_0x6564('0x21')][_0x6564('0x24')]);return _0x221fca(_0x2dbb4d[_0x6564('0x21')]['message']);}logger[_0x6564('0x21')](_0x6564('0x23'),_0x183f90,_0x2dbb4d[_0x6564('0x21')][_0x6564('0x24')]);return _0x42811a(_0x2dbb4d['error'][_0x6564('0x24')]);}else{logger['info'](_0x6564('0x23'),_0x183f90,_0x6564('0x1e'));_0x42811a(_0x2dbb4d[_0x6564('0x25')][_0x6564('0x24')]);}})[_0x6564('0x26')](function(_0x3e48eb){logger[_0x6564('0x21')](_0x6564('0x23'),_0x183f90,_0x3e48eb);_0x221fca(_0x3e48eb);});});}function respondWithStatusCode(_0x4c6c8e,_0x5b064d){_0x5b064d=_0x5b064d||0xcc;return function(_0x4775a2){if(_0x4775a2){return _0x4c6c8e[_0x6564('0x27')](_0x5b064d);}return _0x4c6c8e['status'](_0x5b064d)['end']();};}function respondWithResult(_0xac6f4,_0x5e3335){_0x5e3335=_0x5e3335||0xc8;return function(_0x4cc364){if(_0x4cc364){return _0xac6f4[_0x6564('0x28')](_0x5e3335)[_0x6564('0x29')](_0x4cc364);}};}function respondWithFilteredResult(_0x4564bc,_0x459b27){return function(_0x1cd168){if(_0x1cd168){var _0x5b92b2=_0x1cd168[_0x6564('0x2a')],_0x2e7108=_0x459b27[_0x6564('0x2b')],_0x49aa3e=_0x459b27[_0x6564('0x2b')]+_0x459b27[_0x6564('0x2c')],_0x443648;if(_0x49aa3e>=_0x5b92b2){_0x49aa3e=_0x5b92b2;_0x443648=0xc8;}else{_0x443648=0xce;}_0x4564bc[_0x6564('0x28')](_0x443648);return _0x4564bc[_0x6564('0x2d')](_0x6564('0x2e'),_0x2e7108+'-'+_0x49aa3e+'/'+_0x5b92b2)[_0x6564('0x29')](_0x1cd168);}return null;};}function patchUpdates(_0x4e250d){return function(_0x29a4e7){try{jsonpatch[_0x6564('0x2f')](_0x29a4e7,_0x4e250d,!![]);}catch(_0x2d128c){return BPromise[_0x6564('0x30')](_0x2d128c);}return _0x29a4e7[_0x6564('0x31')]();};}function saveUpdates(_0x2c7954,_0x501fe4){return function(_0x2fec34){if(_0x2fec34){return _0x2fec34[_0x6564('0x32')](_0x2c7954)['then'](function(_0xd9de64){return _0xd9de64;});}return null;};}function removeEntity(_0x5da438,_0x4007b0){return function(_0x1bfa1f){if(_0x1bfa1f){return _0x1bfa1f[_0x6564('0x33')]()[_0x6564('0x1c')](function(){_0x5da438['status'](0xcc)[_0x6564('0x34')]();});}};}function handleEntityNotFound(_0x117d68,_0x25f94d){return function(_0x3c6b6b){if(!_0x3c6b6b){_0x117d68['sendStatus'](0x194);}return _0x3c6b6b;};}function handleError(_0x16bb0e,_0x3e6fe9){_0x3e6fe9=_0x3e6fe9||0x1f4;return function(_0x37140d){logger[_0x6564('0x21')](_0x37140d[_0x6564('0x35')]);if(_0x37140d['name']){delete _0x37140d[_0x6564('0x36')];}_0x16bb0e['status'](_0x3e6fe9)['send'](_0x37140d);};}exports[_0x6564('0x37')]=function(_0x291aec,_0x28befe){var _0x4fd494={},_0x214937={},_0x363ca9={'count':0x0,'rows':[]};var _0x329ee8=_[_0x6564('0x38')](db[_0x6564('0x39')][_0x6564('0x3a')],function(_0x1b6c43){return{'name':_0x1b6c43[_0x6564('0x3b')],'type':_0x1b6c43[_0x6564('0x3c')]['key']};});_0x214937['model']=_[_0x6564('0x38')](_0x329ee8,'name');_0x214937[_0x6564('0x3d')]=_[_0x6564('0x3e')](_0x291aec[_0x6564('0x3d')]);_0x214937[_0x6564('0x3f')]=_[_0x6564('0x40')](_0x214937[_0x6564('0x41')],_0x214937[_0x6564('0x3d')]);_0x4fd494['attributes']=_[_0x6564('0x40')](_0x214937[_0x6564('0x41')],qs[_0x6564('0x42')](_0x291aec[_0x6564('0x3d')][_0x6564('0x42')]));_0x4fd494[_0x6564('0x43')]=_0x4fd494[_0x6564('0x43')][_0x6564('0x44')]?_0x4fd494[_0x6564('0x43')]:_0x214937[_0x6564('0x41')];if(!_0x291aec[_0x6564('0x3d')][_0x6564('0x45')](_0x6564('0x46'))){_0x4fd494[_0x6564('0x2c')]=qs[_0x6564('0x2c')](_0x291aec['query']['limit']);_0x4fd494[_0x6564('0x2b')]=qs[_0x6564('0x2b')](_0x291aec[_0x6564('0x3d')]['offset']);}_0x4fd494[_0x6564('0x47')]=qs['sort'](_0x291aec[_0x6564('0x3d')]['sort']);_0x4fd494[_0x6564('0x48')]=qs[_0x6564('0x3f')](_[_0x6564('0x49')](_0x291aec[_0x6564('0x3d')],_0x214937[_0x6564('0x3f')]));if(_0x291aec[_0x6564('0x3d')][_0x6564('0x4a')]){_0x4fd494[_0x6564('0x48')]=_['merge'](_0x4fd494[_0x6564('0x48')],{'$or':_[_0x6564('0x38')](_0x329ee8,function(_0x8f62c3){if(_0x8f62c3[_0x6564('0x3c')]!=='VIRTUAL'){var _0x2d1ae2={};_0x2d1ae2[_0x8f62c3[_0x6564('0x36')]]={'$like':'%'+_0x291aec[_0x6564('0x3d')]['filter']+'%'};return _0x2d1ae2;}})});}_0x4fd494=_['merge']({},_0x4fd494,_0x291aec[_0x6564('0x4b')]);var _0x58b77b={'where':_0x4fd494[_0x6564('0x48')]};return db[_0x6564('0x39')][_0x6564('0x2a')](_0x58b77b)[_0x6564('0x1c')](function(_0x3ee938){_0x363ca9['count']=_0x3ee938;if(_0x291aec['query']['includeAll']){_0x4fd494[_0x6564('0x4c')]=[{'all':!![]}];}return db[_0x6564('0x39')][_0x6564('0x4d')](_0x4fd494);})[_0x6564('0x1c')](function(_0x66147){_0x363ca9[_0x6564('0x4e')]=_0x66147;return _0x363ca9;})[_0x6564('0x1c')](respondWithFilteredResult(_0x28befe,_0x4fd494))[_0x6564('0x26')](handleError(_0x28befe,null));};exports[_0x6564('0x4f')]=function(_0x54bd42,_0x57849d){var _0x152773={'raw':![],'where':{'id':_0x54bd42[_0x6564('0x50')]['id']}},_0x16cee4={};_0x16cee4[_0x6564('0x41')]=_['keys'](db['ZohoAccount']['rawAttributes']);_0x16cee4[_0x6564('0x3d')]=_[_0x6564('0x3e')](_0x54bd42[_0x6564('0x3d')]);_0x16cee4[_0x6564('0x3f')]=_[_0x6564('0x40')](_0x16cee4[_0x6564('0x41')],_0x16cee4[_0x6564('0x3d')]);_0x152773[_0x6564('0x43')]=_['intersection'](_0x16cee4['model'],qs[_0x6564('0x42')](_0x54bd42[_0x6564('0x3d')]['fields']));_0x152773[_0x6564('0x43')]=_0x152773['attributes'][_0x6564('0x44')]?_0x152773[_0x6564('0x43')]:_0x16cee4[_0x6564('0x41')];if(_0x54bd42[_0x6564('0x3d')]['includeAll']){_0x152773['include']=[{'all':!![]}];}_0x152773=_[_0x6564('0x51')]({},_0x152773,_0x54bd42[_0x6564('0x4b')]);return db[_0x6564('0x39')][_0x6564('0x52')](_0x152773)[_0x6564('0x1c')](handleEntityNotFound(_0x57849d,null))[_0x6564('0x1c')](respondWithResult(_0x57849d,null))['catch'](handleError(_0x57849d,null));};exports[_0x6564('0x53')]=function(_0x28b5c5,_0x1cf385){return db[_0x6564('0x39')][_0x6564('0x53')](_0x28b5c5[_0x6564('0x54')],{})['then'](respondWithResult(_0x1cf385,0xc9))['catch'](handleError(_0x1cf385,null));};exports['update']=function(_0x2b009f,_0x4d0002){if(_0x2b009f['body']['id']){delete _0x2b009f[_0x6564('0x54')]['id'];}return db[_0x6564('0x39')][_0x6564('0x52')]({'where':{'id':_0x2b009f[_0x6564('0x50')]['id']}})[_0x6564('0x1c')](handleEntityNotFound(_0x4d0002,null))['then'](saveUpdates(_0x2b009f[_0x6564('0x54')],null))[_0x6564('0x1c')](respondWithResult(_0x4d0002,null))[_0x6564('0x26')](handleError(_0x4d0002,null));};exports[_0x6564('0x33')]=function(_0x28f6f4,_0x389e4a){return db[_0x6564('0x39')]['find']({'where':{'id':_0x28f6f4[_0x6564('0x50')]['id']}})[_0x6564('0x1c')](handleEntityNotFound(_0x389e4a,null))[_0x6564('0x1c')](removeEntity(_0x389e4a,null))[_0x6564('0x26')](handleError(_0x389e4a,null));};exports[_0x6564('0x55')]=function(_0x219018,_0x24af2b,_0x48b58d){var _0x374649={};var _0x38f9f2={};var _0x3c1790;var _0x14a5ae;return db[_0x6564('0x39')][_0x6564('0x56')]({'where':{'id':_0x219018[_0x6564('0x50')]['id']}})['then'](handleEntityNotFound(_0x24af2b,null))[_0x6564('0x1c')](function(_0x7e7058){if(_0x7e7058){_0x3c1790=_0x7e7058;_0x38f9f2[_0x6564('0x41')]=_[_0x6564('0x3e')](db[_0x6564('0x57')][_0x6564('0x3a')]);_0x38f9f2[_0x6564('0x3d')]=_[_0x6564('0x3e')](_0x219018[_0x6564('0x3d')]);_0x38f9f2[_0x6564('0x3f')]=_[_0x6564('0x40')](_0x38f9f2['model'],_0x38f9f2['query']);_0x374649[_0x6564('0x43')]=_[_0x6564('0x40')](_0x38f9f2[_0x6564('0x41')],qs[_0x6564('0x42')](_0x219018['query'][_0x6564('0x42')]));_0x374649[_0x6564('0x43')]=_0x374649[_0x6564('0x43')][_0x6564('0x44')]?_0x374649[_0x6564('0x43')]:_0x38f9f2[_0x6564('0x41')];_0x374649[_0x6564('0x47')]=qs[_0x6564('0x58')](_0x219018['query'][_0x6564('0x58')]);_0x374649[_0x6564('0x48')]=qs[_0x6564('0x3f')](_[_0x6564('0x49')](_0x219018['query'],_0x38f9f2[_0x6564('0x3f')]));if(_0x219018[_0x6564('0x3d')][_0x6564('0x4a')]){_0x374649['where']=_[_0x6564('0x51')](_0x374649[_0x6564('0x48')],{'$or':_[_0x6564('0x38')](_0x374649[_0x6564('0x43')],function(_0x1a0fe5){var _0x299fa1={};_0x299fa1[_0x1a0fe5]={'$like':'%'+_0x219018[_0x6564('0x3d')]['filter']+'%'};return _0x299fa1;})});}_0x374649=_[_0x6564('0x51')]({},_0x374649,_0x219018['options']);return _0x3c1790['getConfigurations'](_0x374649);}})[_0x6564('0x1c')](function(_0x42b149){if(_0x42b149){_0x14a5ae=_0x42b149['length'];if(!_0x219018[_0x6564('0x3d')][_0x6564('0x45')](_0x6564('0x46'))){_0x374649[_0x6564('0x2c')]=qs['limit'](_0x219018[_0x6564('0x3d')][_0x6564('0x2c')]);_0x374649[_0x6564('0x2b')]=qs[_0x6564('0x2b')](_0x219018[_0x6564('0x3d')][_0x6564('0x2b')]);}return _0x3c1790[_0x6564('0x55')](_0x374649);}})[_0x6564('0x1c')](function(_0x4bf538){if(_0x4bf538){return _0x4bf538?{'count':_0x14a5ae,'rows':_0x4bf538}:null;}})[_0x6564('0x1c')](respondWithResult(_0x24af2b,null))['catch'](handleError(_0x24af2b,null));};exports[_0x6564('0x59')]=function(_0x4941e9,_0x5efee0,_0x1d8ccf){if(_0x4941e9['body']['id']){delete _0x4941e9[_0x6564('0x54')]['id'];}return db[_0x6564('0x39')]['findOne']({'where':{'id':_0x4941e9[_0x6564('0x50')]['id']}})[_0x6564('0x1c')](handleEntityNotFound(_0x5efee0,null))[_0x6564('0x1c')](function(_0xe2e808){if(_0xe2e808){_0x4941e9[_0x6564('0x54')][_0x6564('0x5a')]=_0xe2e808['id'];_0x4941e9[_0x6564('0x54')][_0x6564('0x5b')]=integrations['getSubjects'](_0x4941e9['body']['channel'],_0x4941e9[_0x6564('0x54')][_0x6564('0x3c')]);_0x4941e9[_0x6564('0x54')][_0x6564('0x5c')]=integrations[_0x6564('0x5d')](_0x4941e9[_0x6564('0x54')]['channel'],_0x4941e9[_0x6564('0x54')][_0x6564('0x3c')]);return db[_0x6564('0x57')][_0x6564('0x53')](_0x4941e9[_0x6564('0x54')],{'include':[{'model':db['ZohoField'],'as':'Subjects'},{'model':db[_0x6564('0x5e')],'as':_0x6564('0x5c')}]});}return null;})[_0x6564('0x1c')](respondWithResult(_0x5efee0,null))['catch'](handleError(_0x5efee0,null));};function getAccessToken(_0x8897f6){return new Promise(function(_0xd97c8,_0xa1c9dc){var _0x4c5f6c;switch(_0x8897f6[_0x6564('0x5f')]){case'US':_0x4c5f6c=_0x6564('0x60');break;case'AU':_0x4c5f6c=_0x6564('0x61');break;case'EU':_0x4c5f6c='https://accounts.zoho.eu';break;case'IN':_0x4c5f6c='https://accounts.zoho.in';break;case'CN':_0x4c5f6c=_0x6564('0x62');break;default:_0x4c5f6c=_0x6564('0x63');break;}var _0x142390={'method':_0x6564('0x64'),'uri':_0x4c5f6c+_0x6564('0x65'),'qs':{'refresh_token':_0x8897f6[_0x6564('0x66')],'client_id':_0x8897f6[_0x6564('0x67')],'client_secret':_0x8897f6[_0x6564('0x68')],'grant_type':_0x6564('0x69')},'json':!![]};return rp(_0x142390)[_0x6564('0x1c')](function(_0x993a52){if(_0x993a52[_0x6564('0x6a')]){_0xd97c8(_0x993a52[_0x6564('0x6a')]);}else{_0xa1c9dc('Unable\x20to\x20retrieve\x20the\x20access\x20token');}})[_0x6564('0x26')](function(_0x4859b5){_0xa1c9dc(_0x4859b5);});});}exports[_0x6564('0x6b')]=function(_0x192423,_0x28e06c,_0x47b459){var _0xca6a63,_0xc11f95,_0x4ad429,_0x55440f,_0x45aac8;return db[_0x6564('0x39')][_0x6564('0x56')]({'where':{'id':_0x192423[_0x6564('0x50')]['id']},'attributes':['id',_0x6564('0x6c'),_0x6564('0x5f'),_0x6564('0x67'),_0x6564('0x68'),_0x6564('0x6d'),'code',_0x6564('0x66')]})['then'](handleEntityNotFound(_0x28e06c,null))['then'](function(_0x5111ae){_0x45aac8=_0x5111ae;_0xca6a63=_0x45aac8[_0x6564('0x6c')];_0xc11f95=_0xca6a63===_0x6564('0x6e')?'eu':'com';_0x4ad429=_0x45aac8['serverUrl'];var _0x5e31a2=_0x4ad429['slice'](-0x1);if(_0x5e31a2==='/'||_0x5e31a2==='\x5c'||_0x5e31a2===':'){_0x4ad429=_0x4ad429['substring'](0x0,_0x4ad429[_0x6564('0x6f')](_0x5e31a2));}if(!_0x45aac8['refreshToken']){throw new Error('Refresh\x20Token\x20not\x20available\x20for\x20the\x20account');}return getAccessToken(_0x45aac8);})[_0x6564('0x1c')](function(_0x234a30){if(_0x234a30){return rp({'method':'GET','uri':util[_0x6564('0x70')](_0x6564('0x71'),_0xc11f95),'qs':{'module':_0x6564('0x72')},'headers':{'Authorization':_0x6564('0x73')+_0x234a30},'json':!![]});}})[_0x6564('0x1c')](function(_0x16912e){if(_0x16912e){if(_0x16912e[_0x6564('0x74')]&&_0x16912e[_0x6564('0x74')]['error']){throw new Error(_0x16912e[_0x6564('0x74')]['error']['message']);}var _0x863fe2=[];var _0x1bf7d9=[];var _0x5731b2=[_0x6564('0x75'),'Subject',_0x6564('0x76'),_0x6564('0x77'),_0x6564('0x78'),'Call_Result',_0x6564('0x79'),'Call_Type'];_0x1bf7d9=_[_0x6564('0x7a')](_0x16912e[_0x6564('0x42')],function(_0x952549){return _0x5731b2[_0x6564('0x7b')](_0x952549[_0x6564('0x7c')]);});for(var _0x2655d=0x0;_0x2655d<_0x1bf7d9['length'];_0x2655d++){if(_0x1bf7d9[_0x2655d][_0x6564('0x7d')]===![]){_0x863fe2['push']({'id':_0x1bf7d9[_0x2655d]['id'],'name':_0x1bf7d9[_0x2655d][_0x6564('0x7e')],'custom':_0x1bf7d9[_0x2655d][_0x6564('0x7f')],'options':_0x1bf7d9[_0x2655d][_0x6564('0x80')]===_0x6564('0x81')&&_0x1bf7d9[_0x2655d][_0x6564('0x82')][_0x6564('0x44')]>-0x1?_[_0x6564('0x38')](_0x1bf7d9[_0x2655d][_0x6564('0x82')],function(_0xc214cd){return{'name':_0xc214cd,'value':_0xc214cd};}):[]});}}return{'count':_0x863fe2[_0x6564('0x44')],'rows':_0x863fe2};}else{return{'count':0x0,'rows':[]};}})[_0x6564('0x1c')](respondWithResult(_0x28e06c,null))[_0x6564('0x26')](function(_0x239a63){var _0x357e1a=_0x192423[_0x6564('0x3d')][_0x6564('0x17')]?0x1f4:_0x239a63[_0x6564('0x83')]||0x1f4;logger['error']('getFields,\x20%s,\x20%s,\x20%s',_0x6564('0x6b'),_0x357e1a,JSON['stringify'](_0x239a63));delete _0x239a63[_0x6564('0x36')];if(_0x357e1a===0x191){_0x357e1a=0x190;}_0x28e06c[_0x6564('0x28')](_0x357e1a)[_0x6564('0x84')](_0x192423[_0x6564('0x3d')]['test']?{'message':_0x6564('0x85'),'statusCode':_0x239a63[_0x6564('0x83')]}:_0x239a63);});}; \ No newline at end of file diff --git a/server/api/intZohoAccount/intZohoAccount.model.js b/server/api/intZohoAccount/intZohoAccount.model.js index e930a57..c07fd37 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 _0x945e=['error','format','ZohoAccount,\x20Unable\x20to\x20generate\x20the\x20refresh\x20token\x20for\x20account\x20\x22%s\x22\x20#%d','inspect','catch','https://accounts.zoho.com','https://accounts.zoho.com.cn','/oauth/v2/token','lodash','util','../../config/logger','api','moment','request-promise','rimraf','../../config/environment','./intZohoAccount.attributes','../../components/integrations/configuration','define','ZohoAccount','int_zoho_accounts','changed','zone','serverUrl','clientId','clientSecret','code','host','slice','substring','lastIndexOf','https://accounts.zoho.com.au','https://accounts.zoho.in','https://accounts.zoho.eu','POST','application/x-www-form-urlencoded','refresh_token','refreshToken','info','ZohoAccount,\x20Refresh\x20token\x20successfully\x20generated\x20for\x20account\x20\x22%s\x22\x20#%d','name'];(function(_0x1a1b93,_0x5d8eae){var _0x4c3ce0=function(_0x2a45ea){while(--_0x2a45ea){_0x1a1b93['push'](_0x1a1b93['shift']());}};_0x4c3ce0(++_0x5d8eae);}(_0x945e,0xfe));var _0xe945=function(_0x403c20,_0x4a7b99){_0x403c20=_0x403c20-0x0;var _0x2b271a=_0x945e[_0x403c20];return _0x2b271a;};'use strict';var _=require(_0xe945('0x0'));var util=require(_0xe945('0x1'));var logger=require(_0xe945('0x2'))(_0xe945('0x3'));var moment=require(_0xe945('0x4'));var BPromise=require('bluebird');var rp=require(_0xe945('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0xe945('0x6'));var config=require(_0xe945('0x7'));var attributes=require(_0xe945('0x8'));var integrations=require(_0xe945('0x9'));module['exports']=function(_0x41a35c,_0x7db856){return _0x41a35c[_0xe945('0xa')](_0xe945('0xb'),attributes,{'tableName':_0xe945('0xc'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeCreate':function(_0x4ceefc,_0x34d60f,_0x2b152a){if(_0x4ceefc[_0xe945('0xd')](_0xe945('0xe'))||_0x4ceefc[_0xe945('0xd')](_0xe945('0xf'))||_0x4ceefc['changed'](_0xe945('0x10'))||_0x4ceefc[_0xe945('0xd')](_0xe945('0x11'))||_0x4ceefc[_0xe945('0xd')](_0xe945('0x12'))||_0x4ceefc[_0xe945('0xd')](_0xe945('0x13'))){var _0x5df31e,_0x2cd9fb;_0x5df31e=_0x4ceefc[_0xe945('0xf')];var _0x24ac75=_0x5df31e[_0xe945('0x14')](-0x1);if(_0x24ac75==='/'||_0x24ac75==='\x5c'||_0x24ac75===':'){_0x5df31e=_0x5df31e[_0xe945('0x15')](0x0,_0x5df31e[_0xe945('0x16')](_0x24ac75));}switch(_0x4ceefc[_0xe945('0xe')]){case'US':_0x2cd9fb='https://accounts.zoho.com';break;case'AU':_0x2cd9fb=_0xe945('0x17');break;case'IN':_0x2cd9fb=_0xe945('0x18');break;case'CN':_0x2cd9fb='https://accounts.zoho.com.cn';break;default:_0x2cd9fb=_0xe945('0x19');break;}var _0x3c63e0={'method':_0xe945('0x1a'),'uri':_0x2cd9fb+'/oauth/v2/token','form':{'grant_type':'authorization_code','client_id':_0x4ceefc['clientId'],'client_secret':_0x4ceefc[_0xe945('0x11')],'redirect_uri':_0x4ceefc[_0xe945('0xf')],'code':_0x4ceefc['code']},'headers':{'Content-Type':_0xe945('0x1b')}};return rp(_0x3c63e0)['then'](function(_0x34be4a){var _0x310ef2=JSON['parse'](_0x34be4a);if(_0x310ef2[_0xe945('0x1c')]){_0x4ceefc[_0xe945('0x1d')]=_0x310ef2['refresh_token'];logger[_0xe945('0x1e')](util['format'](_0xe945('0x1f'),_0x4ceefc[_0xe945('0x20')],_0x4ceefc['id']));}else{logger[_0xe945('0x21')](util[_0xe945('0x22')](_0xe945('0x23'),_0x4ceefc[_0xe945('0x20')],_0x4ceefc['id']),util[_0xe945('0x24')](_0x310ef2,{'showHidden':![],'depth':null}));}return _0x2b152a(null,_0x34d60f);})[_0xe945('0x25')](function(_0x4e58ec){logger[_0xe945('0x21')](util[_0xe945('0x22')](_0xe945('0x23'),_0x4ceefc[_0xe945('0x20')],_0x4ceefc['id']),util[_0xe945('0x24')](parsedResult,{'showHidden':![],'depth':null}));return _0x2b152a(_0x4e58ec);});}else{return _0x2b152a(null,_0x34d60f);}},'beforeUpdate':function(_0x3e4d71,_0x487af4,_0x4d50f1){if(_0x3e4d71[_0xe945('0xd')]('zone')||_0x3e4d71[_0xe945('0xd')](_0xe945('0xf'))||_0x3e4d71[_0xe945('0xd')](_0xe945('0x10'))||_0x3e4d71[_0xe945('0xd')](_0xe945('0x11'))||_0x3e4d71[_0xe945('0xd')](_0xe945('0x12'))||_0x3e4d71[_0xe945('0xd')](_0xe945('0x13'))){var _0x2aa50c,_0x1144f8;_0x2aa50c=_0x3e4d71[_0xe945('0xf')];var _0xe7b24e=_0x2aa50c[_0xe945('0x14')](-0x1);if(_0xe7b24e==='/'||_0xe7b24e==='\x5c'||_0xe7b24e===':'){_0x2aa50c=_0x2aa50c[_0xe945('0x15')](0x0,_0x2aa50c[_0xe945('0x16')](_0xe7b24e));}switch(_0x3e4d71[_0xe945('0xe')]){case'US':_0x1144f8=_0xe945('0x26');break;case'AU':_0x1144f8=_0xe945('0x17');break;case'IN':_0x1144f8='https://accounts.zoho.in';break;case'CN':_0x1144f8=_0xe945('0x27');break;default:_0x1144f8='https://accounts.zoho.eu';break;}var _0x1c1128={'method':_0xe945('0x1a'),'uri':_0x1144f8+_0xe945('0x28'),'form':{'grant_type':'authorization_code','client_id':_0x3e4d71['clientId'],'client_secret':_0x3e4d71[_0xe945('0x11')],'redirect_uri':_0x3e4d71['serverUrl'],'code':_0x3e4d71[_0xe945('0x12')]},'headers':{'Content-Type':'application/x-www-form-urlencoded'}};return rp(_0x1c1128)['then'](function(_0x16d57b){var _0x3d0eba=JSON['parse'](_0x16d57b);if(_0x3d0eba[_0xe945('0x1c')]){_0x3e4d71[_0xe945('0x1d')]=_0x3d0eba[_0xe945('0x1c')];logger[_0xe945('0x1e')](util[_0xe945('0x22')]('ZohoAccount,\x20Refresh\x20token\x20successfully\x20generated\x20for\x20account\x20\x22%s\x22\x20#%d',_0x3e4d71[_0xe945('0x20')],_0x3e4d71['id']));}else{logger['error'](util[_0xe945('0x22')]('ZohoAccount,\x20Unable\x20to\x20generate\x20the\x20refresh\x20token\x20for\x20account\x20\x22%s\x22\x20#%d',_0x3e4d71[_0xe945('0x20')],_0x3e4d71['id']),util[_0xe945('0x24')](_0x3d0eba,{'showHidden':![],'depth':null}));}return _0x4d50f1(null,_0x487af4);})[_0xe945('0x25')](function(_0x123a33){logger['error'](util[_0xe945('0x22')](_0xe945('0x23'),_0x3e4d71['name'],_0x3e4d71['id']),util[_0xe945('0x24')](parsedResult,{'showHidden':![],'depth':null}));return _0x4d50f1(_0x123a33);});}else{return _0x4d50f1(null,_0x487af4);}}}});}; \ No newline at end of file +var _0x2f4d=['define','ZohoAccount','int_zoho_accounts','zone','changed','clientId','code','serverUrl','substring','https://accounts.zoho.com','https://accounts.zoho.com.au','https://accounts.zoho.eu','POST','/oauth/v2/token','authorization_code','application/x-www-form-urlencoded','then','parse','refreshToken','refresh_token','info','format','ZohoAccount,\x20Refresh\x20token\x20successfully\x20generated\x20for\x20account\x20\x22%s\x22\x20#%d','error','ZohoAccount,\x20Unable\x20to\x20generate\x20the\x20refresh\x20token\x20for\x20account\x20\x22%s\x22\x20#%d','name','inspect','clientSecret','host','slice','https://accounts.zoho.in','https://accounts.zoho.com.cn','lodash','util','../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment','./intZohoAccount.attributes','exports'];(function(_0x5c06fe,_0x12193a){var _0xf8ec9a=function(_0x3a7026){while(--_0x3a7026){_0x5c06fe['push'](_0x5c06fe['shift']());}};_0xf8ec9a(++_0x12193a);}(_0x2f4d,0xcc));var _0xd2f4=function(_0xe1ce93,_0x4a8c61){_0xe1ce93=_0xe1ce93-0x0;var _0x4e9668=_0x2f4d[_0xe1ce93];return _0x4e9668;};'use strict';var _=require(_0xd2f4('0x0'));var util=require(_0xd2f4('0x1'));var logger=require(_0xd2f4('0x2'))(_0xd2f4('0x3'));var moment=require(_0xd2f4('0x4'));var BPromise=require(_0xd2f4('0x5'));var rp=require(_0xd2f4('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0xd2f4('0x7'));var config=require(_0xd2f4('0x8'));var attributes=require(_0xd2f4('0x9'));var integrations=require('../../components/integrations/configuration');module[_0xd2f4('0xa')]=function(_0x44391d,_0x59514c){return _0x44391d[_0xd2f4('0xb')](_0xd2f4('0xc'),attributes,{'tableName':_0xd2f4('0xd'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeCreate':function(_0xc4d209,_0x29c0e5,_0x43c00b){if(_0xc4d209['changed'](_0xd2f4('0xe'))||_0xc4d209[_0xd2f4('0xf')]('serverUrl')||_0xc4d209[_0xd2f4('0xf')](_0xd2f4('0x10'))||_0xc4d209[_0xd2f4('0xf')]('clientSecret')||_0xc4d209[_0xd2f4('0xf')](_0xd2f4('0x11'))||_0xc4d209[_0xd2f4('0xf')]('host')){var _0x11753b,_0x3395d8;_0x11753b=_0xc4d209[_0xd2f4('0x12')];var _0x2d72b5=_0x11753b['slice'](-0x1);if(_0x2d72b5==='/'||_0x2d72b5==='\x5c'||_0x2d72b5===':'){_0x11753b=_0x11753b[_0xd2f4('0x13')](0x0,_0x11753b['lastIndexOf'](_0x2d72b5));}switch(_0xc4d209[_0xd2f4('0xe')]){case'US':_0x3395d8=_0xd2f4('0x14');break;case'AU':_0x3395d8=_0xd2f4('0x15');break;case'IN':_0x3395d8='https://accounts.zoho.in';break;case'CN':_0x3395d8='https://accounts.zoho.com.cn';break;default:_0x3395d8=_0xd2f4('0x16');break;}var _0x42c41a={'method':_0xd2f4('0x17'),'uri':_0x3395d8+_0xd2f4('0x18'),'form':{'grant_type':_0xd2f4('0x19'),'client_id':_0xc4d209['clientId'],'client_secret':_0xc4d209['clientSecret'],'redirect_uri':_0xc4d209[_0xd2f4('0x12')],'code':_0xc4d209['code']},'headers':{'Content-Type':_0xd2f4('0x1a')}};return rp(_0x42c41a)[_0xd2f4('0x1b')](function(_0x24c372){var _0x5e0c83=JSON[_0xd2f4('0x1c')](_0x24c372);if(_0x5e0c83['refresh_token']){_0xc4d209[_0xd2f4('0x1d')]=_0x5e0c83[_0xd2f4('0x1e')];logger[_0xd2f4('0x1f')](util[_0xd2f4('0x20')](_0xd2f4('0x21'),_0xc4d209['name'],_0xc4d209['id']));}else{logger[_0xd2f4('0x22')](util['format'](_0xd2f4('0x23'),_0xc4d209[_0xd2f4('0x24')],_0xc4d209['id']),util[_0xd2f4('0x25')](_0x5e0c83,{'showHidden':![],'depth':null}));}return _0x43c00b(null,_0x29c0e5);})['catch'](function(_0x1fbdcf){logger[_0xd2f4('0x22')](util['format'](_0xd2f4('0x23'),_0xc4d209[_0xd2f4('0x24')],_0xc4d209['id']),util['inspect'](parsedResult,{'showHidden':![],'depth':null}));return _0x43c00b(_0x1fbdcf);});}else{return _0x43c00b(null,_0x29c0e5);}},'beforeUpdate':function(_0x45f014,_0x526ad0,_0x505270){if(_0x45f014[_0xd2f4('0xf')](_0xd2f4('0xe'))||_0x45f014[_0xd2f4('0xf')](_0xd2f4('0x12'))||_0x45f014[_0xd2f4('0xf')](_0xd2f4('0x10'))||_0x45f014[_0xd2f4('0xf')](_0xd2f4('0x26'))||_0x45f014[_0xd2f4('0xf')]('code')||_0x45f014[_0xd2f4('0xf')](_0xd2f4('0x27'))){var _0xc1a4d3,_0xc607fe;_0xc1a4d3=_0x45f014[_0xd2f4('0x12')];var _0x214e97=_0xc1a4d3[_0xd2f4('0x28')](-0x1);if(_0x214e97==='/'||_0x214e97==='\x5c'||_0x214e97===':'){_0xc1a4d3=_0xc1a4d3[_0xd2f4('0x13')](0x0,_0xc1a4d3['lastIndexOf'](_0x214e97));}switch(_0x45f014[_0xd2f4('0xe')]){case'US':_0xc607fe=_0xd2f4('0x14');break;case'AU':_0xc607fe='https://accounts.zoho.com.au';break;case'IN':_0xc607fe=_0xd2f4('0x29');break;case'CN':_0xc607fe=_0xd2f4('0x2a');break;default:_0xc607fe=_0xd2f4('0x16');break;}var _0x1f020b={'method':_0xd2f4('0x17'),'uri':_0xc607fe+_0xd2f4('0x18'),'form':{'grant_type':'authorization_code','client_id':_0x45f014[_0xd2f4('0x10')],'client_secret':_0x45f014[_0xd2f4('0x26')],'redirect_uri':_0x45f014['serverUrl'],'code':_0x45f014[_0xd2f4('0x11')]},'headers':{'Content-Type':_0xd2f4('0x1a')}};return rp(_0x1f020b)[_0xd2f4('0x1b')](function(_0x3bdf41){var _0x5a538e=JSON['parse'](_0x3bdf41);if(_0x5a538e[_0xd2f4('0x1e')]){_0x45f014[_0xd2f4('0x1d')]=_0x5a538e[_0xd2f4('0x1e')];logger[_0xd2f4('0x1f')](util['format'](_0xd2f4('0x21'),_0x45f014[_0xd2f4('0x24')],_0x45f014['id']));}else{logger[_0xd2f4('0x22')](util['format'](_0xd2f4('0x23'),_0x45f014[_0xd2f4('0x24')],_0x45f014['id']),util[_0xd2f4('0x25')](_0x5a538e,{'showHidden':![],'depth':null}));}return _0x505270(null,_0x526ad0);})['catch'](function(_0x1f8121){logger[_0xd2f4('0x22')](util['format'](_0xd2f4('0x23'),_0x45f014[_0xd2f4('0x24')],_0x45f014['id']),util[_0xd2f4('0x25')](parsedResult,{'showHidden':![],'depth':null}));return _0x505270(_0x1f8121);});}else{return _0x505270(null,_0x526ad0);}}}});}; \ No newline at end of file diff --git a/server/api/intZohoAccount/intZohoAccount.rpc.js b/server/api/intZohoAccount/intZohoAccount.rpc.js index 850efee..401f923 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 _0x69c5=['rpc','../../config/environment','jayson/promise','client','http','request','then','info','request\x20sent','debug','ZohoAccount,\x20%s,\x20%s,\x20%s','error','code','ZohoAccount,\x20%s,\x20%s','message','catch','GetZohoAccount','findAll','options','include','map','model','attributes','stringify','ZohoAccount','find','raw','where','ShowZohoAccount','lodash','util','moment','bluebird','../../mysqldb','../../config/utils','../../config/logger'];(function(_0x2dafbe,_0x5d04de){var _0x58a45a=function(_0x50ac96){while(--_0x50ac96){_0x2dafbe['push'](_0x2dafbe['shift']());}};_0x58a45a(++_0x5d04de);}(_0x69c5,0xad));var _0x569c=function(_0x447bb7,_0x5aebbf){_0x447bb7=_0x447bb7-0x0;var _0x72154f=_0x69c5[_0x447bb7];return _0x72154f;};'use strict';var _=require(_0x569c('0x0'));var util=require(_0x569c('0x1'));var moment=require(_0x569c('0x2'));var BPromise=require(_0x569c('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x569c('0x4'))['db'];var utils=require(_0x569c('0x5'));var logger=require(_0x569c('0x6'))(_0x569c('0x7'));var config=require(_0x569c('0x8'));var jayson=require(_0x569c('0x9'));var client=jayson[_0x569c('0xa')][_0x569c('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x670c06,_0x47f449,_0x691cd0){return new BPromise(function(_0x22d8cf,_0x32faa6){return client[_0x569c('0xc')](_0x670c06,_0x691cd0)[_0x569c('0xd')](function(_0xeb5a0){logger[_0x569c('0xe')]('ZohoAccount,\x20%s,\x20%s',_0x47f449,_0x569c('0xf'));logger[_0x569c('0x10')](_0x569c('0x11'),_0x47f449,'request\x20sent',JSON['stringify'](_0xeb5a0));if(_0xeb5a0[_0x569c('0x12')]){if(_0xeb5a0[_0x569c('0x12')][_0x569c('0x13')]===0x1f4){logger[_0x569c('0x12')](_0x569c('0x14'),_0x47f449,_0xeb5a0[_0x569c('0x12')]['message']);return _0x32faa6(_0xeb5a0[_0x569c('0x12')][_0x569c('0x15')]);}logger[_0x569c('0x12')]('ZohoAccount,\x20%s,\x20%s',_0x47f449,_0xeb5a0[_0x569c('0x12')][_0x569c('0x15')]);return _0x22d8cf(_0xeb5a0[_0x569c('0x12')][_0x569c('0x15')]);}else{logger[_0x569c('0xe')]('ZohoAccount,\x20%s,\x20%s',_0x47f449,_0x569c('0xf'));_0x22d8cf(_0xeb5a0['result'][_0x569c('0x15')]);}})[_0x569c('0x16')](function(_0x3f4903){logger[_0x569c('0x12')](_0x569c('0x14'),_0x47f449,_0x3f4903);_0x32faa6(_0x3f4903);});});}exports[_0x569c('0x17')]=function(_0x168e85){var _0x453a43=this;return new Promise(function(_0x4acefd,_0x38d6a8){return db['ZohoAccount'][_0x569c('0x18')]({'raw':_0x168e85[_0x569c('0x19')]?_0x168e85[_0x569c('0x19')]['raw']===undefined?!![]:![]:!![],'where':_0x168e85[_0x569c('0x19')]?_0x168e85[_0x569c('0x19')]['where']||null:null,'attributes':_0x168e85[_0x569c('0x19')]?_0x168e85[_0x569c('0x19')]['attributes']||null:null,'limit':_0x168e85[_0x569c('0x19')]?_0x168e85[_0x569c('0x19')]['limit']||null:null,'include':_0x168e85[_0x569c('0x19')]?_0x168e85['options'][_0x569c('0x1a')]?_[_0x569c('0x1b')](_0x168e85[_0x569c('0x19')][_0x569c('0x1a')],function(_0x1ad84a){return{'model':db[_0x1ad84a[_0x569c('0x1c')]],'as':_0x1ad84a['as'],'attributes':_0x1ad84a[_0x569c('0x1d')],'include':_0x1ad84a[_0x569c('0x1a')]?_[_0x569c('0x1b')](_0x1ad84a[_0x569c('0x1a')],function(_0x2bef04){return{'model':db[_0x2bef04[_0x569c('0x1c')]],'as':_0x2bef04['as'],'attributes':_0x2bef04['attributes'],'include':_0x2bef04['include']?_[_0x569c('0x1b')](_0x2bef04[_0x569c('0x1a')],function(_0xaacc78){return{'model':db[_0xaacc78['model']],'as':_0xaacc78['as'],'attributes':_0xaacc78[_0x569c('0x1d')]};}):[]};}):[]};}):[]:[]})[_0x569c('0xd')](function(_0x20785a){logger[_0x569c('0xe')](_0x569c('0x17'),_0x168e85);logger['debug'](_0x569c('0x17'),_0x168e85,JSON[_0x569c('0x1e')](_0x20785a));_0x4acefd(_0x20785a);})[_0x569c('0x16')](function(_0x3bae65){logger[_0x569c('0x12')](_0x569c('0x17'),_0x3bae65['message'],_0x168e85);_0x38d6a8(_0x453a43['error'](0x1f4,_0x3bae65['message']));});});};exports['ShowZohoAccount']=function(_0x4aa5a2){var _0x2a83d5=this;return new Promise(function(_0x58856d,_0x49ceff){return db[_0x569c('0x1f')][_0x569c('0x20')]({'raw':_0x4aa5a2['options']?_0x4aa5a2['options'][_0x569c('0x21')]===undefined?!![]:![]:!![],'where':_0x4aa5a2[_0x569c('0x19')]?_0x4aa5a2[_0x569c('0x19')][_0x569c('0x22')]||null:null,'attributes':_0x4aa5a2['options']?_0x4aa5a2[_0x569c('0x19')][_0x569c('0x1d')]||null:null,'include':_0x4aa5a2[_0x569c('0x19')]?_0x4aa5a2[_0x569c('0x19')][_0x569c('0x1a')]?_[_0x569c('0x1b')](_0x4aa5a2[_0x569c('0x19')][_0x569c('0x1a')],function(_0x4c4ed6){return{'model':db[_0x4c4ed6[_0x569c('0x1c')]],'as':_0x4c4ed6['as'],'attributes':_0x4c4ed6[_0x569c('0x1d')],'include':_0x4c4ed6[_0x569c('0x1a')]?_[_0x569c('0x1b')](_0x4c4ed6[_0x569c('0x1a')],function(_0x455a79){return{'model':db[_0x455a79['model']],'as':_0x455a79['as'],'attributes':_0x455a79[_0x569c('0x1d')],'include':_0x455a79['include']?_[_0x569c('0x1b')](_0x455a79[_0x569c('0x1a')],function(_0x387bb7){return{'model':db[_0x387bb7[_0x569c('0x1c')]],'as':_0x387bb7['as'],'attributes':_0x387bb7[_0x569c('0x1d')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x8accfc){logger[_0x569c('0xe')](_0x569c('0x23'),_0x4aa5a2);logger['debug'](_0x569c('0x23'),_0x4aa5a2,JSON[_0x569c('0x1e')](_0x8accfc));_0x58856d(_0x8accfc);})[_0x569c('0x16')](function(_0x193346){logger[_0x569c('0x12')](_0x569c('0x23'),_0x193346['message'],_0x4aa5a2);_0x49ceff(_0x2a83d5[_0x569c('0x12')](0x1f4,_0x193346['message']));});});}; \ No newline at end of file +var _0xd325=['raw','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','http','request','info','ZohoAccount,\x20%s,\x20%s','request\x20sent','debug','ZohoAccount,\x20%s,\x20%s,\x20%s','error','code','message','catch','GetZohoAccount','ZohoAccount','findAll','options','where','attributes','limit','include','map','model','then','stringify','ShowZohoAccount','find'];(function(_0x31f739,_0x468cf6){var _0x3d0ac1=function(_0x23b956){while(--_0x23b956){_0x31f739['push'](_0x31f739['shift']());}};_0x3d0ac1(++_0x468cf6);}(_0xd325,0x18d));var _0x5d32=function(_0x2d9c6a,_0x59393d){_0x2d9c6a=_0x2d9c6a-0x0;var _0xf3c918=_0xd325[_0x2d9c6a];return _0xf3c918;};'use strict';var _=require('lodash');var util=require(_0x5d32('0x0'));var moment=require(_0x5d32('0x1'));var BPromise=require(_0x5d32('0x2'));var rs=require(_0x5d32('0x3'));var fs=require('fs');var Redis=require(_0x5d32('0x4'));var db=require(_0x5d32('0x5'))['db'];var utils=require(_0x5d32('0x6'));var logger=require(_0x5d32('0x7'))(_0x5d32('0x8'));var config=require(_0x5d32('0x9'));var jayson=require('jayson/promise');var client=jayson['client'][_0x5d32('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x3512fd,_0x5263f1,_0x39f4cc){return new BPromise(function(_0x3fb85e,_0x1b4684){return client[_0x5d32('0xb')](_0x3512fd,_0x39f4cc)['then'](function(_0x4fdb24){logger[_0x5d32('0xc')](_0x5d32('0xd'),_0x5263f1,_0x5d32('0xe'));logger[_0x5d32('0xf')](_0x5d32('0x10'),_0x5263f1,'request\x20sent',JSON['stringify'](_0x4fdb24));if(_0x4fdb24[_0x5d32('0x11')]){if(_0x4fdb24[_0x5d32('0x11')][_0x5d32('0x12')]===0x1f4){logger['error'](_0x5d32('0xd'),_0x5263f1,_0x4fdb24['error'][_0x5d32('0x13')]);return _0x1b4684(_0x4fdb24[_0x5d32('0x11')][_0x5d32('0x13')]);}logger[_0x5d32('0x11')]('ZohoAccount,\x20%s,\x20%s',_0x5263f1,_0x4fdb24[_0x5d32('0x11')][_0x5d32('0x13')]);return _0x3fb85e(_0x4fdb24[_0x5d32('0x11')]['message']);}else{logger[_0x5d32('0xc')](_0x5d32('0xd'),_0x5263f1,'request\x20sent');_0x3fb85e(_0x4fdb24['result']['message']);}})[_0x5d32('0x14')](function(_0x94c524){logger[_0x5d32('0x11')](_0x5d32('0xd'),_0x5263f1,_0x94c524);_0x1b4684(_0x94c524);});});}exports[_0x5d32('0x15')]=function(_0x330384){var _0x4be425=this;return new Promise(function(_0x1c88b8,_0xb37983){return db[_0x5d32('0x16')][_0x5d32('0x17')]({'raw':_0x330384[_0x5d32('0x18')]?_0x330384[_0x5d32('0x18')]['raw']===undefined?!![]:![]:!![],'where':_0x330384[_0x5d32('0x18')]?_0x330384['options'][_0x5d32('0x19')]||null:null,'attributes':_0x330384[_0x5d32('0x18')]?_0x330384['options'][_0x5d32('0x1a')]||null:null,'limit':_0x330384[_0x5d32('0x18')]?_0x330384[_0x5d32('0x18')][_0x5d32('0x1b')]||null:null,'include':_0x330384[_0x5d32('0x18')]?_0x330384[_0x5d32('0x18')][_0x5d32('0x1c')]?_[_0x5d32('0x1d')](_0x330384[_0x5d32('0x18')]['include'],function(_0xf7b13b){return{'model':db[_0xf7b13b[_0x5d32('0x1e')]],'as':_0xf7b13b['as'],'attributes':_0xf7b13b['attributes'],'include':_0xf7b13b[_0x5d32('0x1c')]?_[_0x5d32('0x1d')](_0xf7b13b[_0x5d32('0x1c')],function(_0x2042f1){return{'model':db[_0x2042f1[_0x5d32('0x1e')]],'as':_0x2042f1['as'],'attributes':_0x2042f1[_0x5d32('0x1a')],'include':_0x2042f1['include']?_[_0x5d32('0x1d')](_0x2042f1[_0x5d32('0x1c')],function(_0x378dca){return{'model':db[_0x378dca[_0x5d32('0x1e')]],'as':_0x378dca['as'],'attributes':_0x378dca[_0x5d32('0x1a')]};}):[]};}):[]};}):[]:[]})[_0x5d32('0x1f')](function(_0x410ada){logger[_0x5d32('0xc')](_0x5d32('0x15'),_0x330384);logger[_0x5d32('0xf')](_0x5d32('0x15'),_0x330384,JSON[_0x5d32('0x20')](_0x410ada));_0x1c88b8(_0x410ada);})[_0x5d32('0x14')](function(_0x17b05d){logger[_0x5d32('0x11')](_0x5d32('0x15'),_0x17b05d[_0x5d32('0x13')],_0x330384);_0xb37983(_0x4be425['error'](0x1f4,_0x17b05d['message']));});});};exports[_0x5d32('0x21')]=function(_0x487396){var _0x1a8982=this;return new Promise(function(_0x46ba9d,_0x2f4510){return db[_0x5d32('0x16')][_0x5d32('0x22')]({'raw':_0x487396[_0x5d32('0x18')]?_0x487396['options'][_0x5d32('0x23')]===undefined?!![]:![]:!![],'where':_0x487396[_0x5d32('0x18')]?_0x487396['options'][_0x5d32('0x19')]||null:null,'attributes':_0x487396[_0x5d32('0x18')]?_0x487396[_0x5d32('0x18')]['attributes']||null:null,'include':_0x487396['options']?_0x487396[_0x5d32('0x18')][_0x5d32('0x1c')]?_[_0x5d32('0x1d')](_0x487396[_0x5d32('0x18')][_0x5d32('0x1c')],function(_0x2604fd){return{'model':db[_0x2604fd[_0x5d32('0x1e')]],'as':_0x2604fd['as'],'attributes':_0x2604fd[_0x5d32('0x1a')],'include':_0x2604fd[_0x5d32('0x1c')]?_[_0x5d32('0x1d')](_0x2604fd[_0x5d32('0x1c')],function(_0x27768e){return{'model':db[_0x27768e[_0x5d32('0x1e')]],'as':_0x27768e['as'],'attributes':_0x27768e[_0x5d32('0x1a')],'include':_0x27768e[_0x5d32('0x1c')]?_['map'](_0x27768e[_0x5d32('0x1c')],function(_0x233a7b){return{'model':db[_0x233a7b[_0x5d32('0x1e')]],'as':_0x233a7b['as'],'attributes':_0x233a7b[_0x5d32('0x1a')]};}):[]};}):[]};}):[]:[]})[_0x5d32('0x1f')](function(_0x1ee9bc){logger[_0x5d32('0xc')](_0x5d32('0x21'),_0x487396);logger[_0x5d32('0xf')](_0x5d32('0x21'),_0x487396,JSON[_0x5d32('0x20')](_0x1ee9bc));_0x46ba9d(_0x1ee9bc);})[_0x5d32('0x14')](function(_0x29d228){logger[_0x5d32('0x11')](_0x5d32('0x21'),_0x29d228[_0x5d32('0x13')],_0x487396);_0x2f4510(_0x1a8982[_0x5d32('0x11')](0x1f4,_0x29d228['message']));});});}; \ No newline at end of file diff --git a/server/api/intZohoConfiguration/index.js b/server/api/intZohoConfiguration/index.js index fd42f62..ceff6f1 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 _0x43c8=['connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./intZohoConfiguration.controller','isAuthenticated','index','get','/:id','/:id/fields','getFields','/:id/descriptions','getDescriptions','create','put','update','delete','destroy','exports','util'];(function(_0x535a58,_0x56a9ec){var _0x5230b7=function(_0x4aef07){while(--_0x4aef07){_0x535a58['push'](_0x535a58['shift']());}};_0x5230b7(++_0x56a9ec);}(_0x43c8,0xaf));var _0x843c=function(_0x21885d,_0x2391ac){_0x21885d=_0x21885d-0x0;var _0x56311c=_0x43c8[_0x21885d];return _0x56311c;};'use strict';var multer=require('multer');var util=require(_0x843c('0x0'));var path=require('path');var timeout=require(_0x843c('0x1'));var express=require(_0x843c('0x2'));var router=express[_0x843c('0x3')]();var auth=require(_0x843c('0x4'));var interaction=require(_0x843c('0x5'));var config=require(_0x843c('0x6'));var controller=require(_0x843c('0x7'));router['get']('/',auth[_0x843c('0x8')](),controller[_0x843c('0x9')]);router[_0x843c('0xa')](_0x843c('0xb'),auth[_0x843c('0x8')](),controller['show']);router[_0x843c('0xa')](_0x843c('0xc'),auth['isAuthenticated'](),controller[_0x843c('0xd')]);router['get']('/:id/subjects',auth[_0x843c('0x8')](),controller['getSubjects']);router[_0x843c('0xa')](_0x843c('0xe'),auth[_0x843c('0x8')](),controller[_0x843c('0xf')]);router['post']('/',auth[_0x843c('0x8')](),controller[_0x843c('0x10')]);router[_0x843c('0x11')](_0x843c('0xb'),auth[_0x843c('0x8')](),controller[_0x843c('0x12')]);router[_0x843c('0x13')](_0x843c('0xb'),auth[_0x843c('0x8')](),controller[_0x843c('0x14')]);module[_0x843c('0x15')]=router; \ No newline at end of file +var _0x0cee=['/:id/fields','getFields','/:id/subjects','getDescriptions','post','create','put','update','delete','multer','util','path','connect-timeout','express','Router','../../config/environment','./intZohoConfiguration.controller','get','isAuthenticated','index','/:id'];(function(_0x239a5e,_0x4efdfe){var _0x3bd956=function(_0x1e336f){while(--_0x1e336f){_0x239a5e['push'](_0x239a5e['shift']());}};_0x3bd956(++_0x4efdfe);}(_0x0cee,0x12f));var _0xe0ce=function(_0xe6a3cd,_0x577053){_0xe6a3cd=_0xe6a3cd-0x0;var _0x5066a3=_0x0cee[_0xe6a3cd];return _0x5066a3;};'use strict';var multer=require(_0xe0ce('0x0'));var util=require(_0xe0ce('0x1'));var path=require(_0xe0ce('0x2'));var timeout=require(_0xe0ce('0x3'));var express=require(_0xe0ce('0x4'));var router=express[_0xe0ce('0x5')]();var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0xe0ce('0x6'));var controller=require(_0xe0ce('0x7'));router[_0xe0ce('0x8')]('/',auth[_0xe0ce('0x9')](),controller[_0xe0ce('0xa')]);router[_0xe0ce('0x8')](_0xe0ce('0xb'),auth[_0xe0ce('0x9')](),controller['show']);router[_0xe0ce('0x8')](_0xe0ce('0xc'),auth['isAuthenticated'](),controller[_0xe0ce('0xd')]);router[_0xe0ce('0x8')](_0xe0ce('0xe'),auth[_0xe0ce('0x9')](),controller['getSubjects']);router['get']('/:id/descriptions',auth[_0xe0ce('0x9')](),controller[_0xe0ce('0xf')]);router[_0xe0ce('0x10')]('/',auth[_0xe0ce('0x9')](),controller[_0xe0ce('0x11')]);router[_0xe0ce('0x12')](_0xe0ce('0xb'),auth[_0xe0ce('0x9')](),controller[_0xe0ce('0x13')]);router[_0xe0ce('0x14')](_0xe0ce('0xb'),auth[_0xe0ce('0x9')](),controller['destroy']);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 90e7e7e..1669707 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 _0xafeb=['exports','STRING','ENUM','lead','contact','contact_lead','sequelize'];(function(_0x9fb081,_0x48f480){var _0x43f8b0=function(_0x418570){while(--_0x418570){_0x9fb081['push'](_0x9fb081['shift']());}};_0x43f8b0(++_0x48f480);}(_0xafeb,0xd8));var _0xbafe=function(_0x2a2d0d,_0x532160){_0x2a2d0d=_0x2a2d0d-0x0;var _0x1c4060=_0xafeb[_0x2a2d0d];return _0x1c4060;};'use strict';var Sequelize=require(_0xbafe('0x0'));module[_0xbafe('0x1')]={'name':{'type':Sequelize[_0xbafe('0x2')]},'moduleCreate':{'type':Sequelize[_0xbafe('0x3')](_0xbafe('0x4'),_0xbafe('0x5'),'nothing'),'defaultValue':_0xbafe('0x4')},'moduleSearch':{'type':Sequelize[_0xbafe('0x3')](_0xbafe('0x6'),_0xbafe('0x5'),_0xbafe('0x4')),'defaultValue':_0xbafe('0x6')},'description':{'type':Sequelize[_0xbafe('0x2')]}}; \ No newline at end of file +var _0x4d03=['lead','nothing','contact_lead','contact','sequelize','exports','STRING','ENUM'];(function(_0x17dfbd,_0x28d8f7){var _0x1453df=function(_0x2de240){while(--_0x2de240){_0x17dfbd['push'](_0x17dfbd['shift']());}};_0x1453df(++_0x28d8f7);}(_0x4d03,0x12c));var _0x34d0=function(_0x5252e1,_0x34962c){_0x5252e1=_0x5252e1-0x0;var _0x148cdf=_0x4d03[_0x5252e1];return _0x148cdf;};'use strict';var Sequelize=require(_0x34d0('0x0'));module[_0x34d0('0x1')]={'name':{'type':Sequelize[_0x34d0('0x2')]},'moduleCreate':{'type':Sequelize[_0x34d0('0x3')](_0x34d0('0x4'),'contact',_0x34d0('0x5')),'defaultValue':_0x34d0('0x4')},'moduleSearch':{'type':Sequelize[_0x34d0('0x3')](_0x34d0('0x6'),_0x34d0('0x7'),_0x34d0('0x4')),'defaultValue':_0x34d0('0x6')},'description':{'type':Sequelize[_0x34d0('0x2')]}}; \ No newline at end of file diff --git a/server/api/intZohoConfiguration/intZohoConfiguration.controller.js b/server/api/intZohoConfiguration/intZohoConfiguration.controller.js index c768b95..9afead2 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 _0x5fc3=['lodash','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/environment','../../mysqldb','http','test','Sequelize','request','info','request\x20sent','debug','ZohoConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','ZohoConfiguration,\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','ZohoConfiguration','includeAll','findAll','params','include','find','create','body','getFields','findOne','rawAttributes','pick','getSubjects','ZohoField','getDescriptions','html-pdf','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','sox'];(function(_0x7a68b,_0x964789){var _0x110d37=function(_0x482401){while(--_0x482401){_0x7a68b['push'](_0x7a68b['shift']());}};_0x110d37(++_0x964789);}(_0x5fc3,0xa8));var _0x35fc=function(_0x72a33d,_0x5691da){_0x72a33d=_0x72a33d-0x0;var _0x2621d5=_0x5fc3[_0x72a33d];return _0x2621d5;};'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')]('ZohoConfiguration,\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['ZohoConfiguration']['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['ZohoConfiguration'][_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['ZohoConfiguration'][_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['ZohoConfiguration'][_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['ZohoConfiguration'][_0x35fc('0x53')]({'where':{'id':_0x164c7b[_0x35fc('0x4d')]['id']}})[_0x35fc('0x33')](handleEntityNotFound(_0x1c46b1,null))['then'](function(_0x243871){if(_0x243871){_0x8501d1=_0x243871;_0x41453b['model']=_['keys'](db['ZohoField'][_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['ZohoConfiguration'][_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));}; \ No newline at end of file +var _0x55ca=['attributes','hasOwnProperty','nolimit','order','sort','where','filters','filter','merge','includeAll','findAll','rows','catch','params','keys','length','include','options','find','create','body','getFields','findOne','ZohoField','pick','getSubjects','getDescriptions','html-pdf','eml-format','request-promise','moment','mustache','util','path','sox','to-csv','ejs','lodash','crypto','jsforce','querystring','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','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','info','ZohoConfiguration,\x20%s,\x20%s','debug','ZohoConfiguration,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','sendStatus','status','end','count','offset','limit','set','json','apply','reject','save','update','stack','name','index','ZohoConfiguration','rawAttributes','type','key','map','query','intersection','model','fields'];(function(_0x5bc5e8,_0x310627){var _0x4fa231=function(_0x18295c){while(--_0x18295c){_0x5bc5e8['push'](_0x5bc5e8['shift']());}};_0x4fa231(++_0x310627);}(_0x55ca,0x126));var _0xa55c=function(_0x2d8d69,_0x8e47ff){_0x2d8d69=_0x2d8d69-0x0;var _0x39ae22=_0x55ca[_0x2d8d69];return _0x39ae22;};'use strict';var pdf=require(_0xa55c('0x0'));var emlformat=require(_0xa55c('0x1'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0xa55c('0x2'));var moment=require(_0xa55c('0x3'));var BPromise=require('bluebird');var Mustache=require(_0xa55c('0x4'));var util=require(_0xa55c('0x5'));var path=require(_0xa55c('0x6'));var sox=require(_0xa55c('0x7'));var csv=require(_0xa55c('0x8'));var ejs=require(_0xa55c('0x9'));var fs=require('fs');var _=require(_0xa55c('0xa'));var squel=require('squel');var crypto=require(_0xa55c('0xb'));var jsforce=require(_0xa55c('0xc'));var deskjs=require('desk.js');var toCsv=require(_0xa55c('0x8'));var querystring=require(_0xa55c('0xd'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0xa55c('0xe'));var qs=require(_0xa55c('0xf'));var as=require(_0xa55c('0x10'));var hardwareService=require(_0xa55c('0x11'));var logger=require(_0xa55c('0x12'))(_0xa55c('0x13'));var utils=require(_0xa55c('0x14'));var config=require(_0xa55c('0x15'));var db=require(_0xa55c('0x16'))['db'];var jayson=require(_0xa55c('0x17'));var client=jayson['client']['http']({'port':0x232a});function checkPasswordPattern(_0x2a35be,_0x576044,_0x5a3672){if(_0x5a3672){var _0x59ea8d=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x59ea8d[_0xa55c('0x18')](_0x576044)){return _0x2a35be;}else{throw new db[(_0xa55c('0x19'))][(_0xa55c('0x1a'))](_0xa55c('0x1b'));}}else{return _0x2a35be;}}function respondWithRpcPromise(_0x458480,_0x247e77,_0x4e0b2f,_0x3ccf65){return new BPromise(function(_0x3dcf4f,_0x25934f){var _0x31e10d=_0x3ccf65||client;return _0x31e10d[_0xa55c('0x1c')](_0x458480,_0x4e0b2f)[_0xa55c('0x1d')](function(_0x51590e){logger[_0xa55c('0x1e')](_0xa55c('0x1f'),_0x247e77,'request\x20sent');logger[_0xa55c('0x20')](_0xa55c('0x21'),_0x247e77,_0xa55c('0x22'),JSON[_0xa55c('0x23')](_0x51590e));if(_0x51590e[_0xa55c('0x24')]){if(_0x51590e[_0xa55c('0x24')]['code']===0x1f4){logger['error'](_0xa55c('0x1f'),_0x247e77,_0x51590e[_0xa55c('0x24')][_0xa55c('0x25')]);return _0x25934f(_0x51590e['error'][_0xa55c('0x25')]);}logger[_0xa55c('0x24')]('ZohoConfiguration,\x20%s,\x20%s',_0x247e77,_0x51590e[_0xa55c('0x24')][_0xa55c('0x25')]);return _0x3dcf4f(_0x51590e[_0xa55c('0x24')][_0xa55c('0x25')]);}else{logger[_0xa55c('0x1e')]('ZohoConfiguration,\x20%s,\x20%s',_0x247e77,_0xa55c('0x22'));_0x3dcf4f(_0x51590e['result']['message']);}})['catch'](function(_0x19ae88){logger['error'](_0xa55c('0x1f'),_0x247e77,_0x19ae88);_0x25934f(_0x19ae88);});});}function respondWithStatusCode(_0x190757,_0x3f64de){_0x3f64de=_0x3f64de||0xcc;return function(_0xf0e574){if(_0xf0e574){return _0x190757[_0xa55c('0x26')](_0x3f64de);}return _0x190757[_0xa55c('0x27')](_0x3f64de)[_0xa55c('0x28')]();};}function respondWithResult(_0x11e7f7,_0x192df2){_0x192df2=_0x192df2||0xc8;return function(_0x3cd152){if(_0x3cd152){return _0x11e7f7[_0xa55c('0x27')](_0x192df2)['json'](_0x3cd152);}};}function respondWithFilteredResult(_0x430d55,_0x28814f){return function(_0x1c9f6b){if(_0x1c9f6b){var _0x906caa=_0x1c9f6b[_0xa55c('0x29')],_0x5d940d=_0x28814f[_0xa55c('0x2a')],_0x1377b0=_0x28814f[_0xa55c('0x2a')]+_0x28814f[_0xa55c('0x2b')],_0x22f6b6;if(_0x1377b0>=_0x906caa){_0x1377b0=_0x906caa;_0x22f6b6=0xc8;}else{_0x22f6b6=0xce;}_0x430d55['status'](_0x22f6b6);return _0x430d55[_0xa55c('0x2c')]('Content-Range',_0x5d940d+'-'+_0x1377b0+'/'+_0x906caa)[_0xa55c('0x2d')](_0x1c9f6b);}return null;};}function patchUpdates(_0x1d730b){return function(_0x1cc53e){try{jsonpatch[_0xa55c('0x2e')](_0x1cc53e,_0x1d730b,!![]);}catch(_0x4d8416){return BPromise[_0xa55c('0x2f')](_0x4d8416);}return _0x1cc53e[_0xa55c('0x30')]();};}function saveUpdates(_0x331e58,_0x20da31){return function(_0x10f4b7){if(_0x10f4b7){return _0x10f4b7[_0xa55c('0x31')](_0x331e58)[_0xa55c('0x1d')](function(_0x24d44d){return _0x24d44d;});}return null;};}function removeEntity(_0x2808e9,_0xcbaf2e){return function(_0x197099){if(_0x197099){return _0x197099['destroy']()['then'](function(){_0x2808e9[_0xa55c('0x27')](0xcc)[_0xa55c('0x28')]();});}};}function handleEntityNotFound(_0x4932d0,_0x30fadd){return function(_0x2f0110){if(!_0x2f0110){_0x4932d0[_0xa55c('0x26')](0x194);}return _0x2f0110;};}function handleError(_0x1839ac,_0x30d4f8){_0x30d4f8=_0x30d4f8||0x1f4;return function(_0x38ff96){logger[_0xa55c('0x24')](_0x38ff96[_0xa55c('0x32')]);if(_0x38ff96[_0xa55c('0x33')]){delete _0x38ff96['name'];}_0x1839ac['status'](_0x30d4f8)['send'](_0x38ff96);};}exports[_0xa55c('0x34')]=function(_0x18e00e,_0x2bb4f0){var _0x5802e4={},_0x768408={},_0x547930={'count':0x0,'rows':[]};var _0x119220=_['map'](db[_0xa55c('0x35')][_0xa55c('0x36')],function(_0x3c0ec1){return{'name':_0x3c0ec1['fieldName'],'type':_0x3c0ec1[_0xa55c('0x37')][_0xa55c('0x38')]};});_0x768408['model']=_[_0xa55c('0x39')](_0x119220,_0xa55c('0x33'));_0x768408['query']=_['keys'](_0x18e00e[_0xa55c('0x3a')]);_0x768408['filters']=_[_0xa55c('0x3b')](_0x768408[_0xa55c('0x3c')],_0x768408['query']);_0x5802e4['attributes']=_['intersection'](_0x768408['model'],qs[_0xa55c('0x3d')](_0x18e00e[_0xa55c('0x3a')][_0xa55c('0x3d')]));_0x5802e4[_0xa55c('0x3e')]=_0x5802e4[_0xa55c('0x3e')]['length']?_0x5802e4[_0xa55c('0x3e')]:_0x768408[_0xa55c('0x3c')];if(!_0x18e00e[_0xa55c('0x3a')][_0xa55c('0x3f')](_0xa55c('0x40'))){_0x5802e4[_0xa55c('0x2b')]=qs['limit'](_0x18e00e[_0xa55c('0x3a')]['limit']);_0x5802e4['offset']=qs[_0xa55c('0x2a')](_0x18e00e[_0xa55c('0x3a')]['offset']);}_0x5802e4[_0xa55c('0x41')]=qs['sort'](_0x18e00e['query'][_0xa55c('0x42')]);_0x5802e4[_0xa55c('0x43')]=qs[_0xa55c('0x44')](_['pick'](_0x18e00e[_0xa55c('0x3a')],_0x768408[_0xa55c('0x44')]));if(_0x18e00e['query'][_0xa55c('0x45')]){_0x5802e4['where']=_[_0xa55c('0x46')](_0x5802e4[_0xa55c('0x43')],{'$or':_['map'](_0x119220,function(_0x66d1de){if(_0x66d1de[_0xa55c('0x37')]!=='VIRTUAL'){var _0x40c352={};_0x40c352[_0x66d1de[_0xa55c('0x33')]]={'$like':'%'+_0x18e00e[_0xa55c('0x3a')]['filter']+'%'};return _0x40c352;}})});}_0x5802e4=_[_0xa55c('0x46')]({},_0x5802e4,_0x18e00e['options']);var _0x2f9717={'where':_0x5802e4[_0xa55c('0x43')]};return db[_0xa55c('0x35')]['count'](_0x2f9717)[_0xa55c('0x1d')](function(_0x106adb){_0x547930['count']=_0x106adb;if(_0x18e00e[_0xa55c('0x3a')][_0xa55c('0x47')]){_0x5802e4['include']=[{'all':!![]}];}return db[_0xa55c('0x35')][_0xa55c('0x48')](_0x5802e4);})['then'](function(_0x46f839){_0x547930[_0xa55c('0x49')]=_0x46f839;return _0x547930;})[_0xa55c('0x1d')](respondWithFilteredResult(_0x2bb4f0,_0x5802e4))[_0xa55c('0x4a')](handleError(_0x2bb4f0,null));};exports['show']=function(_0x143989,_0x58a7ea){var _0x2157d6={'raw':![],'where':{'id':_0x143989[_0xa55c('0x4b')]['id']}},_0x213100={};_0x213100['model']=_[_0xa55c('0x4c')](db[_0xa55c('0x35')]['rawAttributes']);_0x213100[_0xa55c('0x3a')]=_[_0xa55c('0x4c')](_0x143989[_0xa55c('0x3a')]);_0x213100[_0xa55c('0x44')]=_[_0xa55c('0x3b')](_0x213100[_0xa55c('0x3c')],_0x213100[_0xa55c('0x3a')]);_0x2157d6[_0xa55c('0x3e')]=_[_0xa55c('0x3b')](_0x213100[_0xa55c('0x3c')],qs['fields'](_0x143989[_0xa55c('0x3a')][_0xa55c('0x3d')]));_0x2157d6[_0xa55c('0x3e')]=_0x2157d6['attributes'][_0xa55c('0x4d')]?_0x2157d6[_0xa55c('0x3e')]:_0x213100['model'];if(_0x143989[_0xa55c('0x3a')]['includeAll']){_0x2157d6[_0xa55c('0x4e')]=[{'all':!![]}];}_0x2157d6=_[_0xa55c('0x46')]({},_0x2157d6,_0x143989[_0xa55c('0x4f')]);return db[_0xa55c('0x35')][_0xa55c('0x50')](_0x2157d6)['then'](handleEntityNotFound(_0x58a7ea,null))[_0xa55c('0x1d')](respondWithResult(_0x58a7ea,null))[_0xa55c('0x4a')](handleError(_0x58a7ea,null));};exports['create']=function(_0x3929a6,_0x2291e0){return db[_0xa55c('0x35')][_0xa55c('0x51')](_0x3929a6['body'],{})['then'](respondWithResult(_0x2291e0,0xc9))[_0xa55c('0x4a')](handleError(_0x2291e0,null));};exports[_0xa55c('0x31')]=function(_0x3ca5b8,_0x44ac57){if(_0x3ca5b8['body']['id']){delete _0x3ca5b8[_0xa55c('0x52')]['id'];}return db['ZohoConfiguration'][_0xa55c('0x50')]({'where':{'id':_0x3ca5b8[_0xa55c('0x4b')]['id']}})[_0xa55c('0x1d')](handleEntityNotFound(_0x44ac57,null))[_0xa55c('0x1d')](saveUpdates(_0x3ca5b8[_0xa55c('0x52')],null))['then'](respondWithResult(_0x44ac57,null))[_0xa55c('0x4a')](handleError(_0x44ac57,null));};exports['destroy']=function(_0x23f67f,_0x157afe){return db[_0xa55c('0x35')][_0xa55c('0x50')]({'where':{'id':_0x23f67f[_0xa55c('0x4b')]['id']}})[_0xa55c('0x1d')](handleEntityNotFound(_0x157afe,null))[_0xa55c('0x1d')](removeEntity(_0x157afe,null))['catch'](handleError(_0x157afe,null));};exports[_0xa55c('0x53')]=function(_0x449e00,_0x2f2d21,_0x23a30e){var _0x3fa00f={};var _0x5ba2b0={};var _0xa72718;var _0x3cd40d;return db[_0xa55c('0x35')][_0xa55c('0x54')]({'where':{'id':_0x449e00[_0xa55c('0x4b')]['id']}})['then'](handleEntityNotFound(_0x2f2d21,null))[_0xa55c('0x1d')](function(_0x21725b){if(_0x21725b){_0xa72718=_0x21725b;_0x5ba2b0[_0xa55c('0x3c')]=_[_0xa55c('0x4c')](db[_0xa55c('0x55')]['rawAttributes']);_0x5ba2b0[_0xa55c('0x3a')]=_['keys'](_0x449e00[_0xa55c('0x3a')]);_0x5ba2b0['filters']=_[_0xa55c('0x3b')](_0x5ba2b0['model'],_0x5ba2b0[_0xa55c('0x3a')]);_0x3fa00f[_0xa55c('0x3e')]=_[_0xa55c('0x3b')](_0x5ba2b0[_0xa55c('0x3c')],qs[_0xa55c('0x3d')](_0x449e00[_0xa55c('0x3a')][_0xa55c('0x3d')]));_0x3fa00f[_0xa55c('0x3e')]=_0x3fa00f[_0xa55c('0x3e')][_0xa55c('0x4d')]?_0x3fa00f['attributes']:_0x5ba2b0[_0xa55c('0x3c')];_0x3fa00f[_0xa55c('0x41')]=qs['sort'](_0x449e00[_0xa55c('0x3a')][_0xa55c('0x42')]);_0x3fa00f[_0xa55c('0x43')]=qs[_0xa55c('0x44')](_[_0xa55c('0x56')](_0x449e00[_0xa55c('0x3a')],_0x5ba2b0[_0xa55c('0x44')]));if(_0x449e00[_0xa55c('0x3a')]['filter']){_0x3fa00f[_0xa55c('0x43')]=_[_0xa55c('0x46')](_0x3fa00f[_0xa55c('0x43')],{'$or':_[_0xa55c('0x39')](_0x3fa00f[_0xa55c('0x3e')],function(_0x1bcb40){var _0x2f1237={};_0x2f1237[_0x1bcb40]={'$like':'%'+_0x449e00[_0xa55c('0x3a')][_0xa55c('0x45')]+'%'};return _0x2f1237;})});}_0x3fa00f=_['merge']({},_0x3fa00f,_0x449e00[_0xa55c('0x4f')]);return _0xa72718[_0xa55c('0x53')](_0x3fa00f);}})[_0xa55c('0x1d')](function(_0x26606c){if(_0x26606c){_0x3cd40d=_0x26606c[_0xa55c('0x4d')];if(!_0x449e00[_0xa55c('0x3a')][_0xa55c('0x3f')](_0xa55c('0x40'))){_0x3fa00f[_0xa55c('0x2b')]=qs[_0xa55c('0x2b')](_0x449e00[_0xa55c('0x3a')]['limit']);_0x3fa00f[_0xa55c('0x2a')]=qs['offset'](_0x449e00[_0xa55c('0x3a')][_0xa55c('0x2a')]);}return _0xa72718[_0xa55c('0x53')](_0x3fa00f);}})['then'](function(_0x4d9722){if(_0x4d9722){return _0x4d9722?{'count':_0x3cd40d,'rows':_0x4d9722}:null;}})[_0xa55c('0x1d')](respondWithResult(_0x2f2d21,null))[_0xa55c('0x4a')](handleError(_0x2f2d21,null));};exports[_0xa55c('0x57')]=function(_0x42529f,_0x4c7ee1,_0x149cb9){var _0xd02251={};var _0x8ea1c6={};var _0x3a9910;var _0x21fc9b;return db['ZohoConfiguration']['findOne']({'where':{'id':_0x42529f[_0xa55c('0x4b')]['id']}})[_0xa55c('0x1d')](handleEntityNotFound(_0x4c7ee1,null))[_0xa55c('0x1d')](function(_0x36ee32){if(_0x36ee32){_0x3a9910=_0x36ee32;_0x8ea1c6[_0xa55c('0x3c')]=_['keys'](db[_0xa55c('0x55')][_0xa55c('0x36')]);_0x8ea1c6['query']=_[_0xa55c('0x4c')](_0x42529f[_0xa55c('0x3a')]);_0x8ea1c6[_0xa55c('0x44')]=_['intersection'](_0x8ea1c6[_0xa55c('0x3c')],_0x8ea1c6[_0xa55c('0x3a')]);_0xd02251[_0xa55c('0x3e')]=_[_0xa55c('0x3b')](_0x8ea1c6[_0xa55c('0x3c')],qs['fields'](_0x42529f[_0xa55c('0x3a')][_0xa55c('0x3d')]));_0xd02251['attributes']=_0xd02251['attributes'][_0xa55c('0x4d')]?_0xd02251['attributes']:_0x8ea1c6[_0xa55c('0x3c')];_0xd02251[_0xa55c('0x41')]=qs[_0xa55c('0x42')](_0x42529f[_0xa55c('0x3a')][_0xa55c('0x42')]);_0xd02251[_0xa55c('0x43')]=qs[_0xa55c('0x44')](_[_0xa55c('0x56')](_0x42529f[_0xa55c('0x3a')],_0x8ea1c6['filters']));if(_0x42529f[_0xa55c('0x3a')][_0xa55c('0x45')]){_0xd02251[_0xa55c('0x43')]=_[_0xa55c('0x46')](_0xd02251['where'],{'$or':_[_0xa55c('0x39')](_0xd02251[_0xa55c('0x3e')],function(_0x1baa8b){var _0x2298ac={};_0x2298ac[_0x1baa8b]={'$like':'%'+_0x42529f['query']['filter']+'%'};return _0x2298ac;})});}_0xd02251=_[_0xa55c('0x46')]({},_0xd02251,_0x42529f[_0xa55c('0x4f')]);return _0x3a9910[_0xa55c('0x57')](_0xd02251);}})[_0xa55c('0x1d')](function(_0x5e87cb){if(_0x5e87cb){_0x21fc9b=_0x5e87cb['length'];if(!_0x42529f[_0xa55c('0x3a')][_0xa55c('0x3f')](_0xa55c('0x40'))){_0xd02251[_0xa55c('0x2b')]=qs[_0xa55c('0x2b')](_0x42529f[_0xa55c('0x3a')][_0xa55c('0x2b')]);_0xd02251['offset']=qs[_0xa55c('0x2a')](_0x42529f['query'][_0xa55c('0x2a')]);}return _0x3a9910['getSubjects'](_0xd02251);}})[_0xa55c('0x1d')](function(_0x313cdc){if(_0x313cdc){return _0x313cdc?{'count':_0x21fc9b,'rows':_0x313cdc}:null;}})[_0xa55c('0x1d')](respondWithResult(_0x4c7ee1,null))[_0xa55c('0x4a')](handleError(_0x4c7ee1,null));};exports[_0xa55c('0x58')]=function(_0x402f02,_0x1ea5b6,_0x2c71ca){var _0x576a1b={};var _0x59414d={};var _0x14cb74;var _0x2948b1;return db[_0xa55c('0x35')][_0xa55c('0x54')]({'where':{'id':_0x402f02[_0xa55c('0x4b')]['id']}})[_0xa55c('0x1d')](handleEntityNotFound(_0x1ea5b6,null))['then'](function(_0x889869){if(_0x889869){_0x14cb74=_0x889869;_0x59414d[_0xa55c('0x3c')]=_[_0xa55c('0x4c')](db[_0xa55c('0x55')][_0xa55c('0x36')]);_0x59414d[_0xa55c('0x3a')]=_[_0xa55c('0x4c')](_0x402f02[_0xa55c('0x3a')]);_0x59414d['filters']=_[_0xa55c('0x3b')](_0x59414d[_0xa55c('0x3c')],_0x59414d[_0xa55c('0x3a')]);_0x576a1b[_0xa55c('0x3e')]=_[_0xa55c('0x3b')](_0x59414d['model'],qs[_0xa55c('0x3d')](_0x402f02[_0xa55c('0x3a')]['fields']));_0x576a1b['attributes']=_0x576a1b[_0xa55c('0x3e')][_0xa55c('0x4d')]?_0x576a1b['attributes']:_0x59414d['model'];_0x576a1b['order']=qs['sort'](_0x402f02[_0xa55c('0x3a')][_0xa55c('0x42')]);_0x576a1b[_0xa55c('0x43')]=qs[_0xa55c('0x44')](_[_0xa55c('0x56')](_0x402f02[_0xa55c('0x3a')],_0x59414d['filters']));if(_0x402f02[_0xa55c('0x3a')][_0xa55c('0x45')]){_0x576a1b[_0xa55c('0x43')]=_[_0xa55c('0x46')](_0x576a1b['where'],{'$or':_[_0xa55c('0x39')](_0x576a1b[_0xa55c('0x3e')],function(_0x36824c){var _0x4cc104={};_0x4cc104[_0x36824c]={'$like':'%'+_0x402f02[_0xa55c('0x3a')]['filter']+'%'};return _0x4cc104;})});}_0x576a1b=_['merge']({},_0x576a1b,_0x402f02[_0xa55c('0x4f')]);return _0x14cb74[_0xa55c('0x58')](_0x576a1b);}})[_0xa55c('0x1d')](function(_0x249b0c){if(_0x249b0c){_0x2948b1=_0x249b0c[_0xa55c('0x4d')];if(!_0x402f02[_0xa55c('0x3a')][_0xa55c('0x3f')]('nolimit')){_0x576a1b['limit']=qs[_0xa55c('0x2b')](_0x402f02[_0xa55c('0x3a')][_0xa55c('0x2b')]);_0x576a1b[_0xa55c('0x2a')]=qs[_0xa55c('0x2a')](_0x402f02[_0xa55c('0x3a')][_0xa55c('0x2a')]);}return _0x14cb74[_0xa55c('0x58')](_0x576a1b);}})[_0xa55c('0x1d')](function(_0x115fc4){if(_0x115fc4){return _0x115fc4?{'count':_0x2948b1,'rows':_0x115fc4}:null;}})['then'](respondWithResult(_0x1ea5b6,null))[_0xa55c('0x4a')](handleError(_0x1ea5b6,null));}; \ No newline at end of file diff --git a/server/api/intZohoConfiguration/intZohoConfiguration.model.js b/server/api/intZohoConfiguration/intZohoConfiguration.model.js index 5d9c132..7a2bd83 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 _0x7132=['moment','bluebird','request-promise','path','../../config/environment','./intZohoConfiguration.attributes','exports','define','int_zoho_configurations','lodash','util','../../config/logger','api'];(function(_0x11b884,_0x600ea4){var _0x356c66=function(_0x1bc5ab){while(--_0x1bc5ab){_0x11b884['push'](_0x11b884['shift']());}};_0x356c66(++_0x600ea4);}(_0x7132,0x168));var _0x2713=function(_0x5ef905,_0x564b87){_0x5ef905=_0x5ef905-0x0;var _0x367808=_0x7132[_0x5ef905];return _0x367808;};'use strict';var _=require(_0x2713('0x0'));var util=require(_0x2713('0x1'));var logger=require(_0x2713('0x2'))(_0x2713('0x3'));var moment=require(_0x2713('0x4'));var BPromise=require(_0x2713('0x5'));var rp=require(_0x2713('0x6'));var fs=require('fs');var path=require(_0x2713('0x7'));var rimraf=require('rimraf');var config=require(_0x2713('0x8'));var attributes=require(_0x2713('0x9'));module[_0x2713('0xa')]=function(_0x4640bd,_0x511672){return _0x4640bd[_0x2713('0xb')]('ZohoConfiguration',attributes,{'tableName':_0x2713('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x259d=['int_zoho_configurations','util','../../config/logger','api','bluebird','request-promise','rimraf','../../config/environment','./intZohoConfiguration.attributes','define','ZohoConfiguration'];(function(_0x13e741,_0x5d3c24){var _0x3f8bb3=function(_0x4440a0){while(--_0x4440a0){_0x13e741['push'](_0x13e741['shift']());}};_0x3f8bb3(++_0x5d3c24);}(_0x259d,0x14b));var _0xd259=function(_0x58b753,_0x1d7aaa){_0x58b753=_0x58b753-0x0;var _0x41f276=_0x259d[_0x58b753];return _0x41f276;};'use strict';var _=require('lodash');var util=require(_0xd259('0x0'));var logger=require(_0xd259('0x1'))(_0xd259('0x2'));var moment=require('moment');var BPromise=require(_0xd259('0x3'));var rp=require(_0xd259('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0xd259('0x5'));var config=require(_0xd259('0x6'));var attributes=require(_0xd259('0x7'));module['exports']=function(_0x2fbc49,_0x40d94d){return _0x2fbc49[_0xd259('0x8')](_0xd259('0x9'),attributes,{'tableName':_0xd259('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intZohoConfiguration/intZohoConfiguration.rpc.js b/server/api/intZohoConfiguration/intZohoConfiguration.rpc.js index 2ba3592..a034c1b 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 _0x8748=['message','result','catch','lodash','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','ZohoConfiguration,\x20%s,\x20%s','request\x20sent','debug','ZohoConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code'];(function(_0x5cfaf6,_0x504d64){var _0xa6a666=function(_0x3fac32){while(--_0x3fac32){_0x5cfaf6['push'](_0x5cfaf6['shift']());}};_0xa6a666(++_0x504d64);}(_0x8748,0x193));var _0x8874=function(_0x44731a,_0x175a32){_0x44731a=_0x44731a-0x0;var _0xe377b6=_0x8748[_0x44731a];return _0xe377b6;};'use strict';var _=require(_0x8874('0x0'));var util=require('util');var moment=require(_0x8874('0x1'));var BPromise=require('bluebird');var rs=require(_0x8874('0x2'));var fs=require('fs');var Redis=require(_0x8874('0x3'));var db=require(_0x8874('0x4'))['db'];var utils=require(_0x8874('0x5'));var logger=require(_0x8874('0x6'))(_0x8874('0x7'));var config=require(_0x8874('0x8'));var jayson=require(_0x8874('0x9'));var client=jayson[_0x8874('0xa')][_0x8874('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x293b94,_0x354be0,_0x2cc42a){return new BPromise(function(_0x53ef21,_0x531535){return client[_0x8874('0xc')](_0x293b94,_0x2cc42a)[_0x8874('0xd')](function(_0x47f9db){logger[_0x8874('0xe')](_0x8874('0xf'),_0x354be0,_0x8874('0x10'));logger[_0x8874('0x11')](_0x8874('0x12'),_0x354be0,_0x8874('0x10'),JSON[_0x8874('0x13')](_0x47f9db));if(_0x47f9db[_0x8874('0x14')]){if(_0x47f9db['error'][_0x8874('0x15')]===0x1f4){logger[_0x8874('0x14')](_0x8874('0xf'),_0x354be0,_0x47f9db['error'][_0x8874('0x16')]);return _0x531535(_0x47f9db['error']['message']);}logger['error']('ZohoConfiguration,\x20%s,\x20%s',_0x354be0,_0x47f9db[_0x8874('0x14')]['message']);return _0x53ef21(_0x47f9db[_0x8874('0x14')][_0x8874('0x16')]);}else{logger[_0x8874('0xe')](_0x8874('0xf'),_0x354be0,'request\x20sent');_0x53ef21(_0x47f9db[_0x8874('0x17')][_0x8874('0x16')]);}})[_0x8874('0x18')](function(_0x27454a){logger[_0x8874('0x14')](_0x8874('0xf'),_0x354be0,_0x27454a);_0x531535(_0x27454a);});});} \ No newline at end of file +var _0x39a1=['request','then','info','ZohoConfiguration,\x20%s,\x20%s','request\x20sent','debug','ZohoConfiguration,\x20%s,\x20%s,\x20%s','error','message','result','util','moment','randomstring','ioredis','../../mysqldb','../../config/logger','../../config/environment','jayson/promise','http'];(function(_0x270dba,_0x1817d2){var _0x36b83b=function(_0x15a276){while(--_0x15a276){_0x270dba['push'](_0x270dba['shift']());}};_0x36b83b(++_0x1817d2);}(_0x39a1,0x101));var _0x139a=function(_0x44d2be,_0x33272c){_0x44d2be=_0x44d2be-0x0;var _0xe20492=_0x39a1[_0x44d2be];return _0xe20492;};'use strict';var _=require('lodash');var util=require(_0x139a('0x0'));var moment=require(_0x139a('0x1'));var BPromise=require('bluebird');var rs=require(_0x139a('0x2'));var fs=require('fs');var Redis=require(_0x139a('0x3'));var db=require(_0x139a('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x139a('0x5'))('rpc');var config=require(_0x139a('0x6'));var jayson=require(_0x139a('0x7'));var client=jayson['client'][_0x139a('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x5a964d,_0x1ea6f5,_0x36700c){return new BPromise(function(_0x553bb2,_0x35bca3){return client[_0x139a('0x9')](_0x5a964d,_0x36700c)[_0x139a('0xa')](function(_0x415ce5){logger[_0x139a('0xb')](_0x139a('0xc'),_0x1ea6f5,_0x139a('0xd'));logger[_0x139a('0xe')](_0x139a('0xf'),_0x1ea6f5,'request\x20sent',JSON['stringify'](_0x415ce5));if(_0x415ce5[_0x139a('0x10')]){if(_0x415ce5[_0x139a('0x10')]['code']===0x1f4){logger[_0x139a('0x10')](_0x139a('0xc'),_0x1ea6f5,_0x415ce5[_0x139a('0x10')][_0x139a('0x11')]);return _0x35bca3(_0x415ce5[_0x139a('0x10')][_0x139a('0x11')]);}logger[_0x139a('0x10')](_0x139a('0xc'),_0x1ea6f5,_0x415ce5[_0x139a('0x10')][_0x139a('0x11')]);return _0x553bb2(_0x415ce5[_0x139a('0x10')][_0x139a('0x11')]);}else{logger[_0x139a('0xb')](_0x139a('0xc'),_0x1ea6f5,_0x139a('0xd'));_0x553bb2(_0x415ce5[_0x139a('0x12')][_0x139a('0x11')]);}})['catch'](function(_0x2fb7f5){logger[_0x139a('0x10')]('ZohoConfiguration,\x20%s,\x20%s',_0x1ea6f5,_0x2fb7f5);_0x35bca3(_0x2fb7f5);});});} \ No newline at end of file diff --git a/server/api/intZohoField/index.js b/server/api/intZohoField/index.js index 37f6fd9..2fa9d0e 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 _0xdd4f=['Router','../../components/interaction/service','../../config/environment','./intZohoField.controller','isAuthenticated','index','get','/:id','post','create','put','update','destroy','exports','multer','express'];(function(_0x1589dd,_0x2b9d22){var _0x1bddd1=function(_0x3687f8){while(--_0x3687f8){_0x1589dd['push'](_0x1589dd['shift']());}};_0x1bddd1(++_0x2b9d22);}(_0xdd4f,0x1ce));var _0xfdd4=function(_0x371024,_0x86195f){_0x371024=_0x371024-0x0;var _0x3e1643=_0xdd4f[_0x371024];return _0x3e1643;};'use strict';var multer=require(_0xfdd4('0x0'));var util=require('util');var path=require('path');var timeout=require('connect-timeout');var express=require(_0xfdd4('0x1'));var router=express[_0xfdd4('0x2')]();var auth=require('../../components/auth/service');var interaction=require(_0xfdd4('0x3'));var config=require(_0xfdd4('0x4'));var controller=require(_0xfdd4('0x5'));router['get']('/',auth[_0xfdd4('0x6')](),controller[_0xfdd4('0x7')]);router[_0xfdd4('0x8')](_0xfdd4('0x9'),auth[_0xfdd4('0x6')](),controller['show']);router[_0xfdd4('0xa')]('/',auth['isAuthenticated'](),controller[_0xfdd4('0xb')]);router[_0xfdd4('0xc')](_0xfdd4('0x9'),auth['isAuthenticated'](),controller[_0xfdd4('0xd')]);router['delete'](_0xfdd4('0x9'),auth[_0xfdd4('0x6')](),controller[_0xfdd4('0xe')]);module[_0xfdd4('0xf')]=router; \ No newline at end of file +var _0x0120=['connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./intZohoField.controller','get','isAuthenticated','show','post','create','/:id','update','delete','exports','multer','util','path'];(function(_0x43693a,_0x24c83e){var _0x10985b=function(_0x32dc7b){while(--_0x32dc7b){_0x43693a['push'](_0x43693a['shift']());}};_0x10985b(++_0x24c83e);}(_0x0120,0x6f));var _0x0012=function(_0x1facfa,_0x1acf7d){_0x1facfa=_0x1facfa-0x0;var _0x9ec701=_0x0120[_0x1facfa];return _0x9ec701;};'use strict';var multer=require(_0x0012('0x0'));var util=require(_0x0012('0x1'));var path=require(_0x0012('0x2'));var timeout=require(_0x0012('0x3'));var express=require(_0x0012('0x4'));var router=express[_0x0012('0x5')]();var auth=require(_0x0012('0x6'));var interaction=require(_0x0012('0x7'));var config=require(_0x0012('0x8'));var controller=require(_0x0012('0x9'));router[_0x0012('0xa')]('/',auth[_0x0012('0xb')](),controller['index']);router['get']('/:id',auth[_0x0012('0xb')](),controller[_0x0012('0xc')]);router[_0x0012('0xd')]('/',auth[_0x0012('0xb')](),controller[_0x0012('0xe')]);router['put'](_0x0012('0xf'),auth[_0x0012('0xb')](),controller[_0x0012('0x10')]);router[_0x0012('0x11')]('/:id',auth[_0x0012('0xb')](),controller['destroy']);module[_0x0012('0x12')]=router; \ No newline at end of file diff --git a/server/api/intZohoField/intZohoField.attributes.js b/server/api/intZohoField/intZohoField.attributes.js index a17cc50..d5de783 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 _0x1294=['STRING','BOOLEAN','sequelize','ENUM','variable','customVariable','string'];(function(_0x597ad0,_0x2fd289){var _0x2ee4a2=function(_0x4185e9){while(--_0x4185e9){_0x597ad0['push'](_0x597ad0['shift']());}};_0x2ee4a2(++_0x2fd289);}(_0x1294,0xb8));var _0x4129=function(_0x4b043b,_0x598b17){_0x4b043b=_0x4b043b-0x0;var _0x398f5a=_0x1294[_0x4b043b];return _0x398f5a;};'use strict';var Sequelize=require(_0x4129('0x0'));module['exports']={'type':{'type':Sequelize[_0x4129('0x1')]('string',_0x4129('0x2'),_0x4129('0x3'),'keyValue'),'defaultValue':_0x4129('0x4')},'content':{'type':Sequelize[_0x4129('0x5')]},'key':{'type':Sequelize[_0x4129('0x5')]},'keyType':{'type':Sequelize[_0x4129('0x1')](_0x4129('0x4'),_0x4129('0x2'),_0x4129('0x3'))},'keyContent':{'type':Sequelize[_0x4129('0x5')]},'idField':{'type':Sequelize[_0x4129('0x5')]},'nameField':{'type':Sequelize[_0x4129('0x5')]},'customField':{'type':Sequelize[_0x4129('0x6')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x4129('0x5')]}}; \ No newline at end of file +var _0x0fda=['sequelize','ENUM','string','variable','customVariable','keyValue','STRING','BOOLEAN'];(function(_0x3054be,_0x1bdc8b){var _0x3df150=function(_0x56cfbf){while(--_0x56cfbf){_0x3054be['push'](_0x3054be['shift']());}};_0x3df150(++_0x1bdc8b);}(_0x0fda,0x1a0));var _0xa0fd=function(_0x532d2f,_0x8098b3){_0x532d2f=_0x532d2f-0x0;var _0x3dc57a=_0x0fda[_0x532d2f];return _0x3dc57a;};'use strict';var Sequelize=require(_0xa0fd('0x0'));module['exports']={'type':{'type':Sequelize[_0xa0fd('0x1')](_0xa0fd('0x2'),_0xa0fd('0x3'),_0xa0fd('0x4'),_0xa0fd('0x5')),'defaultValue':_0xa0fd('0x2')},'content':{'type':Sequelize[_0xa0fd('0x6')]},'key':{'type':Sequelize['STRING']},'keyType':{'type':Sequelize['ENUM'](_0xa0fd('0x2'),'variable','customVariable')},'keyContent':{'type':Sequelize[_0xa0fd('0x6')]},'idField':{'type':Sequelize[_0xa0fd('0x6')]},'nameField':{'type':Sequelize[_0xa0fd('0x6')]},'customField':{'type':Sequelize[_0xa0fd('0x7')],'defaultValue':!![]},'variableName':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/intZohoField/intZohoField.controller.js b/server/api/intZohoField/intZohoField.controller.js index 5b115d5..50e83a2 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 _0xd293=['../../config/environment','../../mysqldb','status','end','json','count','limit','set','Content-Range','apply','reject','update','then','destroy','sendStatus','error','stack','name','send','index','rawAttributes','fieldName','type','model','map','query','keys','filters','intersection','attributes','fields','nolimit','offset','sort','where','pick','filter','merge','options','ZohoField','includeAll','include','rows','catch','show','params','find','create','body','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api'];(function(_0x4b6453,_0x2a987b){var _0x47aa45=function(_0x282347){while(--_0x282347){_0x4b6453['push'](_0x4b6453['shift']());}};_0x47aa45(++_0x2a987b);}(_0xd293,0x106));var _0x3d29=function(_0x31bdd1,_0x537ba1){_0x31bdd1=_0x31bdd1-0x0;var _0x4aa0ad=_0xd293[_0x31bdd1];return _0x4aa0ad;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x3d29('0x0'));var rimraf=require(_0x3d29('0x1'));var zipdir=require(_0x3d29('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x3d29('0x3'));var moment=require(_0x3d29('0x4'));var BPromise=require(_0x3d29('0x5'));var Mustache=require(_0x3d29('0x6'));var util=require(_0x3d29('0x7'));var path=require(_0x3d29('0x8'));var sox=require(_0x3d29('0x9'));var csv=require(_0x3d29('0xa'));var ejs=require('ejs');var fs=require('fs');var _=require('lodash');var squel=require(_0x3d29('0xb'));var crypto=require(_0x3d29('0xc'));var jsforce=require(_0x3d29('0xd'));var deskjs=require('desk.js');var toCsv=require(_0x3d29('0xa'));var querystring=require(_0x3d29('0xe'));var Papa=require(_0x3d29('0xf'));var Redis=require(_0x3d29('0x10'));var authService=require(_0x3d29('0x11'));var qs=require(_0x3d29('0x12'));var as=require(_0x3d29('0x13'));var hardwareService=require(_0x3d29('0x14'));var logger=require('../../config/logger')(_0x3d29('0x15'));var utils=require('../../config/utils');var config=require(_0x3d29('0x16'));var db=require(_0x3d29('0x17'))['db'];function respondWithStatusCode(_0x422434,_0x36fc54){_0x36fc54=_0x36fc54||0xcc;return function(_0x254f8b){if(_0x254f8b){return _0x422434['sendStatus'](_0x36fc54);}return _0x422434[_0x3d29('0x18')](_0x36fc54)[_0x3d29('0x19')]();};}function respondWithResult(_0xcea019,_0x9503cb){_0x9503cb=_0x9503cb||0xc8;return function(_0x69f1c9){if(_0x69f1c9){return _0xcea019[_0x3d29('0x18')](_0x9503cb)[_0x3d29('0x1a')](_0x69f1c9);}};}function respondWithFilteredResult(_0x440d8a,_0x18b4fb){return function(_0x1d8c60){if(_0x1d8c60){var _0x5a0ebf=_0x1d8c60[_0x3d29('0x1b')],_0x4aacd9=_0x18b4fb['offset'],_0x52c592=_0x18b4fb['offset']+_0x18b4fb[_0x3d29('0x1c')],_0x175d3a;if(_0x52c592>=_0x5a0ebf){_0x52c592=_0x5a0ebf;_0x175d3a=0xc8;}else{_0x175d3a=0xce;}_0x440d8a[_0x3d29('0x18')](_0x175d3a);return _0x440d8a[_0x3d29('0x1d')](_0x3d29('0x1e'),_0x4aacd9+'-'+_0x52c592+'/'+_0x5a0ebf)['json'](_0x1d8c60);}return null;};}function patchUpdates(_0x136118){return function(_0x1c6642){try{jsonpatch[_0x3d29('0x1f')](_0x1c6642,_0x136118,!![]);}catch(_0xeafb44){return BPromise[_0x3d29('0x20')](_0xeafb44);}return _0x1c6642['save']();};}function saveUpdates(_0x283cc7,_0x5b04c8){return function(_0x358b30){if(_0x358b30){return _0x358b30[_0x3d29('0x21')](_0x283cc7)[_0x3d29('0x22')](function(_0x216f7d){return _0x216f7d;});}return null;};}function removeEntity(_0x2d919f,_0x4677f3){return function(_0x3415cc){if(_0x3415cc){return _0x3415cc[_0x3d29('0x23')]()[_0x3d29('0x22')](function(){_0x2d919f['status'](0xcc)[_0x3d29('0x19')]();});}};}function handleEntityNotFound(_0x4f9794,_0xf03afa){return function(_0x5c842f){if(!_0x5c842f){_0x4f9794[_0x3d29('0x24')](0x194);}return _0x5c842f;};}function handleError(_0x5c3939,_0x3725d4){_0x3725d4=_0x3725d4||0x1f4;return function(_0x25a018){logger[_0x3d29('0x25')](_0x25a018[_0x3d29('0x26')]);if(_0x25a018[_0x3d29('0x27')]){delete _0x25a018[_0x3d29('0x27')];}_0x5c3939[_0x3d29('0x18')](_0x3725d4)[_0x3d29('0x28')](_0x25a018);};}exports[_0x3d29('0x29')]=function(_0x4920cb,_0x531a6a){var _0x527801={},_0x4bc2a1={},_0x1969b9={'count':0x0,'rows':[]};var _0x532efe=_['map'](db['ZohoField'][_0x3d29('0x2a')],function(_0x289ef1){return{'name':_0x289ef1[_0x3d29('0x2b')],'type':_0x289ef1[_0x3d29('0x2c')]['key']};});_0x4bc2a1[_0x3d29('0x2d')]=_[_0x3d29('0x2e')](_0x532efe,_0x3d29('0x27'));_0x4bc2a1[_0x3d29('0x2f')]=_[_0x3d29('0x30')](_0x4920cb[_0x3d29('0x2f')]);_0x4bc2a1[_0x3d29('0x31')]=_[_0x3d29('0x32')](_0x4bc2a1[_0x3d29('0x2d')],_0x4bc2a1[_0x3d29('0x2f')]);_0x527801[_0x3d29('0x33')]=_['intersection'](_0x4bc2a1[_0x3d29('0x2d')],qs[_0x3d29('0x34')](_0x4920cb[_0x3d29('0x2f')]['fields']));_0x527801[_0x3d29('0x33')]=_0x527801['attributes']['length']?_0x527801[_0x3d29('0x33')]:_0x4bc2a1['model'];if(!_0x4920cb[_0x3d29('0x2f')]['hasOwnProperty'](_0x3d29('0x35'))){_0x527801['limit']=qs[_0x3d29('0x1c')](_0x4920cb[_0x3d29('0x2f')][_0x3d29('0x1c')]);_0x527801[_0x3d29('0x36')]=qs[_0x3d29('0x36')](_0x4920cb[_0x3d29('0x2f')][_0x3d29('0x36')]);}_0x527801['order']=qs[_0x3d29('0x37')](_0x4920cb[_0x3d29('0x2f')][_0x3d29('0x37')]);_0x527801[_0x3d29('0x38')]=qs['filters'](_[_0x3d29('0x39')](_0x4920cb['query'],_0x4bc2a1['filters']));if(_0x4920cb[_0x3d29('0x2f')][_0x3d29('0x3a')]){_0x527801[_0x3d29('0x38')]=_[_0x3d29('0x3b')](_0x527801[_0x3d29('0x38')],{'$or':_['map'](_0x532efe,function(_0x55ad57){if(_0x55ad57[_0x3d29('0x2c')]!=='VIRTUAL'){var _0x5ef3f1={};_0x5ef3f1[_0x55ad57['name']]={'$like':'%'+_0x4920cb['query'][_0x3d29('0x3a')]+'%'};return _0x5ef3f1;}})});}_0x527801=_[_0x3d29('0x3b')]({},_0x527801,_0x4920cb[_0x3d29('0x3c')]);var _0x5a7b07={'where':_0x527801['where']};return db[_0x3d29('0x3d')]['count'](_0x5a7b07)[_0x3d29('0x22')](function(_0x46c265){_0x1969b9[_0x3d29('0x1b')]=_0x46c265;if(_0x4920cb[_0x3d29('0x2f')][_0x3d29('0x3e')]){_0x527801[_0x3d29('0x3f')]=[{'all':!![]}];}return db[_0x3d29('0x3d')]['findAll'](_0x527801);})[_0x3d29('0x22')](function(_0x41691f){_0x1969b9[_0x3d29('0x40')]=_0x41691f;return _0x1969b9;})['then'](respondWithFilteredResult(_0x531a6a,_0x527801))[_0x3d29('0x41')](handleError(_0x531a6a,null));};exports[_0x3d29('0x42')]=function(_0x577558,_0x146176){var _0x55264f={'raw':!![],'where':{'id':_0x577558[_0x3d29('0x43')]['id']}},_0x41f361={};_0x41f361[_0x3d29('0x2d')]=_[_0x3d29('0x30')](db['ZohoField'][_0x3d29('0x2a')]);_0x41f361[_0x3d29('0x2f')]=_[_0x3d29('0x30')](_0x577558[_0x3d29('0x2f')]);_0x41f361[_0x3d29('0x31')]=_[_0x3d29('0x32')](_0x41f361[_0x3d29('0x2d')],_0x41f361[_0x3d29('0x2f')]);_0x55264f[_0x3d29('0x33')]=_[_0x3d29('0x32')](_0x41f361[_0x3d29('0x2d')],qs[_0x3d29('0x34')](_0x577558[_0x3d29('0x2f')]['fields']));_0x55264f[_0x3d29('0x33')]=_0x55264f[_0x3d29('0x33')]['length']?_0x55264f['attributes']:_0x41f361[_0x3d29('0x2d')];if(_0x577558[_0x3d29('0x2f')][_0x3d29('0x3e')]){_0x55264f[_0x3d29('0x3f')]=[{'all':!![]}];}_0x55264f=_[_0x3d29('0x3b')]({},_0x55264f,_0x577558[_0x3d29('0x3c')]);return db[_0x3d29('0x3d')][_0x3d29('0x44')](_0x55264f)[_0x3d29('0x22')](handleEntityNotFound(_0x146176,null))[_0x3d29('0x22')](respondWithResult(_0x146176,null))[_0x3d29('0x41')](handleError(_0x146176,null));};exports[_0x3d29('0x45')]=function(_0x1a268a,_0x328d33){return db[_0x3d29('0x3d')][_0x3d29('0x45')](_0x1a268a[_0x3d29('0x46')],{})['then'](respondWithResult(_0x328d33,0xc9))[_0x3d29('0x41')](handleError(_0x328d33,null));};exports[_0x3d29('0x21')]=function(_0x4650a9,_0x49793a){if(_0x4650a9[_0x3d29('0x46')]['id']){delete _0x4650a9[_0x3d29('0x46')]['id'];}return db[_0x3d29('0x3d')]['find']({'where':{'id':_0x4650a9['params']['id']}})[_0x3d29('0x22')](handleEntityNotFound(_0x49793a,null))['then'](saveUpdates(_0x4650a9[_0x3d29('0x46')],null))[_0x3d29('0x22')](respondWithResult(_0x49793a,null))[_0x3d29('0x41')](handleError(_0x49793a,null));};exports['destroy']=function(_0x30fbc0,_0x220668){return db[_0x3d29('0x3d')][_0x3d29('0x44')]({'where':{'id':_0x30fbc0[_0x3d29('0x43')]['id']}})['then'](handleEntityNotFound(_0x220668,null))[_0x3d29('0x22')](removeEntity(_0x220668,null))[_0x3d29('0x41')](handleError(_0x220668,null));}; \ No newline at end of file +var _0x3c1d=['sort','where','pick','filter','merge','options','count','includeAll','include','findAll','rows','show','params','length','catch','create','body','find','html-pdf','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','status','json','offset','limit','set','Content-Range','apply','reject','save','update','destroy','then','end','sendStatus','error','stack','name','send','index','map','ZohoField','rawAttributes','type','key','model','keys','query','filters','intersection','fields','attributes','order'];(function(_0x368392,_0x40d3c5){var _0x328c40=function(_0x4a5705){while(--_0x4a5705){_0x368392['push'](_0x368392['shift']());}};_0x328c40(++_0x40d3c5);}(_0x3c1d,0xaa));var _0xd3c1=function(_0x565ed7,_0x398228){_0x565ed7=_0x565ed7-0x0;var _0x183ad7=_0x3c1d[_0x565ed7];return _0x183ad7;};'use strict';var pdf=require(_0xd3c1('0x0'));var emlformat=require(_0xd3c1('0x1'));var rimraf=require('rimraf');var zipdir=require(_0xd3c1('0x2'));var jsonpatch=require(_0xd3c1('0x3'));var rp=require(_0xd3c1('0x4'));var moment=require(_0xd3c1('0x5'));var BPromise=require(_0xd3c1('0x6'));var Mustache=require(_0xd3c1('0x7'));var util=require('util');var path=require(_0xd3c1('0x8'));var sox=require(_0xd3c1('0x9'));var csv=require(_0xd3c1('0xa'));var ejs=require(_0xd3c1('0xb'));var fs=require('fs');var _=require(_0xd3c1('0xc'));var squel=require(_0xd3c1('0xd'));var crypto=require(_0xd3c1('0xe'));var jsforce=require(_0xd3c1('0xf'));var deskjs=require(_0xd3c1('0x10'));var toCsv=require(_0xd3c1('0xa'));var querystring=require(_0xd3c1('0x11'));var Papa=require(_0xd3c1('0x12'));var Redis=require(_0xd3c1('0x13'));var authService=require(_0xd3c1('0x14'));var qs=require('../../components/parsers/qs');var as=require(_0xd3c1('0x15'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xd3c1('0x16'))('api');var utils=require(_0xd3c1('0x17'));var config=require(_0xd3c1('0x18'));var db=require(_0xd3c1('0x19'))['db'];function respondWithStatusCode(_0x594784,_0xbddeef){_0xbddeef=_0xbddeef||0xcc;return function(_0xb236f2){if(_0xb236f2){return _0x594784['sendStatus'](_0xbddeef);}return _0x594784[_0xd3c1('0x1a')](_0xbddeef)['end']();};}function respondWithResult(_0x4ad35c,_0x5e0a3b){_0x5e0a3b=_0x5e0a3b||0xc8;return function(_0xc8f53c){if(_0xc8f53c){return _0x4ad35c[_0xd3c1('0x1a')](_0x5e0a3b)[_0xd3c1('0x1b')](_0xc8f53c);}};}function respondWithFilteredResult(_0x12568a,_0x104829){return function(_0x150764){if(_0x150764){var _0x3f958c=_0x150764['count'],_0x5a6eed=_0x104829[_0xd3c1('0x1c')],_0x2b122e=_0x104829[_0xd3c1('0x1c')]+_0x104829[_0xd3c1('0x1d')],_0x29087a;if(_0x2b122e>=_0x3f958c){_0x2b122e=_0x3f958c;_0x29087a=0xc8;}else{_0x29087a=0xce;}_0x12568a['status'](_0x29087a);return _0x12568a[_0xd3c1('0x1e')](_0xd3c1('0x1f'),_0x5a6eed+'-'+_0x2b122e+'/'+_0x3f958c)['json'](_0x150764);}return null;};}function patchUpdates(_0x1a4334){return function(_0x146f88){try{jsonpatch[_0xd3c1('0x20')](_0x146f88,_0x1a4334,!![]);}catch(_0x102e9e){return BPromise[_0xd3c1('0x21')](_0x102e9e);}return _0x146f88[_0xd3c1('0x22')]();};}function saveUpdates(_0x569e58,_0x11e626){return function(_0xedf5e6){if(_0xedf5e6){return _0xedf5e6[_0xd3c1('0x23')](_0x569e58)['then'](function(_0x269e3c){return _0x269e3c;});}return null;};}function removeEntity(_0x35e7a8,_0x3aef73){return function(_0x8d2aee){if(_0x8d2aee){return _0x8d2aee[_0xd3c1('0x24')]()[_0xd3c1('0x25')](function(){_0x35e7a8['status'](0xcc)[_0xd3c1('0x26')]();});}};}function handleEntityNotFound(_0x3ce2bb,_0x2c4ace){return function(_0xb4010c){if(!_0xb4010c){_0x3ce2bb[_0xd3c1('0x27')](0x194);}return _0xb4010c;};}function handleError(_0x135f8c,_0x423867){_0x423867=_0x423867||0x1f4;return function(_0x2c49a2){logger[_0xd3c1('0x28')](_0x2c49a2[_0xd3c1('0x29')]);if(_0x2c49a2[_0xd3c1('0x2a')]){delete _0x2c49a2['name'];}_0x135f8c[_0xd3c1('0x1a')](_0x423867)[_0xd3c1('0x2b')](_0x2c49a2);};}exports[_0xd3c1('0x2c')]=function(_0x347592,_0x321ebc){var _0x361db3={},_0x44cd2a={},_0x53cb40={'count':0x0,'rows':[]};var _0x2ebc90=_[_0xd3c1('0x2d')](db[_0xd3c1('0x2e')][_0xd3c1('0x2f')],function(_0x1ed262){return{'name':_0x1ed262['fieldName'],'type':_0x1ed262[_0xd3c1('0x30')][_0xd3c1('0x31')]};});_0x44cd2a[_0xd3c1('0x32')]=_['map'](_0x2ebc90,_0xd3c1('0x2a'));_0x44cd2a['query']=_[_0xd3c1('0x33')](_0x347592[_0xd3c1('0x34')]);_0x44cd2a[_0xd3c1('0x35')]=_[_0xd3c1('0x36')](_0x44cd2a[_0xd3c1('0x32')],_0x44cd2a[_0xd3c1('0x34')]);_0x361db3['attributes']=_[_0xd3c1('0x36')](_0x44cd2a[_0xd3c1('0x32')],qs[_0xd3c1('0x37')](_0x347592[_0xd3c1('0x34')][_0xd3c1('0x37')]));_0x361db3['attributes']=_0x361db3[_0xd3c1('0x38')]['length']?_0x361db3[_0xd3c1('0x38')]:_0x44cd2a[_0xd3c1('0x32')];if(!_0x347592[_0xd3c1('0x34')]['hasOwnProperty']('nolimit')){_0x361db3['limit']=qs[_0xd3c1('0x1d')](_0x347592[_0xd3c1('0x34')][_0xd3c1('0x1d')]);_0x361db3[_0xd3c1('0x1c')]=qs[_0xd3c1('0x1c')](_0x347592[_0xd3c1('0x34')][_0xd3c1('0x1c')]);}_0x361db3[_0xd3c1('0x39')]=qs['sort'](_0x347592[_0xd3c1('0x34')][_0xd3c1('0x3a')]);_0x361db3[_0xd3c1('0x3b')]=qs[_0xd3c1('0x35')](_[_0xd3c1('0x3c')](_0x347592[_0xd3c1('0x34')],_0x44cd2a['filters']));if(_0x347592[_0xd3c1('0x34')][_0xd3c1('0x3d')]){_0x361db3[_0xd3c1('0x3b')]=_[_0xd3c1('0x3e')](_0x361db3[_0xd3c1('0x3b')],{'$or':_[_0xd3c1('0x2d')](_0x2ebc90,function(_0x18f694){if(_0x18f694[_0xd3c1('0x30')]!=='VIRTUAL'){var _0x17ba0e={};_0x17ba0e[_0x18f694[_0xd3c1('0x2a')]]={'$like':'%'+_0x347592[_0xd3c1('0x34')][_0xd3c1('0x3d')]+'%'};return _0x17ba0e;}})});}_0x361db3=_[_0xd3c1('0x3e')]({},_0x361db3,_0x347592[_0xd3c1('0x3f')]);var _0x21b6af={'where':_0x361db3[_0xd3c1('0x3b')]};return db['ZohoField']['count'](_0x21b6af)['then'](function(_0x3a394c){_0x53cb40[_0xd3c1('0x40')]=_0x3a394c;if(_0x347592[_0xd3c1('0x34')][_0xd3c1('0x41')]){_0x361db3[_0xd3c1('0x42')]=[{'all':!![]}];}return db[_0xd3c1('0x2e')][_0xd3c1('0x43')](_0x361db3);})['then'](function(_0x1e3cc0){_0x53cb40[_0xd3c1('0x44')]=_0x1e3cc0;return _0x53cb40;})['then'](respondWithFilteredResult(_0x321ebc,_0x361db3))['catch'](handleError(_0x321ebc,null));};exports[_0xd3c1('0x45')]=function(_0x1618c2,_0x3bc242){var _0x29c390={'raw':!![],'where':{'id':_0x1618c2[_0xd3c1('0x46')]['id']}},_0x21a3b7={};_0x21a3b7[_0xd3c1('0x32')]=_[_0xd3c1('0x33')](db[_0xd3c1('0x2e')][_0xd3c1('0x2f')]);_0x21a3b7[_0xd3c1('0x34')]=_[_0xd3c1('0x33')](_0x1618c2['query']);_0x21a3b7[_0xd3c1('0x35')]=_['intersection'](_0x21a3b7[_0xd3c1('0x32')],_0x21a3b7[_0xd3c1('0x34')]);_0x29c390[_0xd3c1('0x38')]=_['intersection'](_0x21a3b7['model'],qs['fields'](_0x1618c2['query'][_0xd3c1('0x37')]));_0x29c390[_0xd3c1('0x38')]=_0x29c390[_0xd3c1('0x38')][_0xd3c1('0x47')]?_0x29c390[_0xd3c1('0x38')]:_0x21a3b7[_0xd3c1('0x32')];if(_0x1618c2[_0xd3c1('0x34')]['includeAll']){_0x29c390[_0xd3c1('0x42')]=[{'all':!![]}];}_0x29c390=_[_0xd3c1('0x3e')]({},_0x29c390,_0x1618c2[_0xd3c1('0x3f')]);return db[_0xd3c1('0x2e')]['find'](_0x29c390)['then'](handleEntityNotFound(_0x3bc242,null))[_0xd3c1('0x25')](respondWithResult(_0x3bc242,null))[_0xd3c1('0x48')](handleError(_0x3bc242,null));};exports[_0xd3c1('0x49')]=function(_0x1f3473,_0x42981c){return db[_0xd3c1('0x2e')][_0xd3c1('0x49')](_0x1f3473[_0xd3c1('0x4a')],{})[_0xd3c1('0x25')](respondWithResult(_0x42981c,0xc9))[_0xd3c1('0x48')](handleError(_0x42981c,null));};exports[_0xd3c1('0x23')]=function(_0xb54230,_0x3c3b8a){if(_0xb54230[_0xd3c1('0x4a')]['id']){delete _0xb54230[_0xd3c1('0x4a')]['id'];}return db['ZohoField'][_0xd3c1('0x4b')]({'where':{'id':_0xb54230['params']['id']}})[_0xd3c1('0x25')](handleEntityNotFound(_0x3c3b8a,null))['then'](saveUpdates(_0xb54230['body'],null))['then'](respondWithResult(_0x3c3b8a,null))[_0xd3c1('0x48')](handleError(_0x3c3b8a,null));};exports[_0xd3c1('0x24')]=function(_0x425b21,_0x14a475){return db[_0xd3c1('0x2e')][_0xd3c1('0x4b')]({'where':{'id':_0x425b21['params']['id']}})[_0xd3c1('0x25')](handleEntityNotFound(_0x14a475,null))[_0xd3c1('0x25')](removeEntity(_0x14a475,null))[_0xd3c1('0x48')](handleError(_0x14a475,null));}; \ No newline at end of file diff --git a/server/api/intZohoField/intZohoField.model.js b/server/api/intZohoField/intZohoField.model.js index 10eca0e..42bf871 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 _0xad4d=['FieldId','util','bluebird','path','rimraf','../../config/environment','./intZohoField.attributes','exports','define','zoho_unique_index','idField'];(function(_0x48a28b,_0x444dcd){var _0x464e81=function(_0x11d338){while(--_0x11d338){_0x48a28b['push'](_0x48a28b['shift']());}};_0x464e81(++_0x444dcd);}(_0xad4d,0x7a));var _0xdad4=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0xad4d[_0x321bb2];return _0x9c12ed;};'use strict';var _=require('lodash');var util=require(_0xdad4('0x0'));var logger=require('../../config/logger')('api');var moment=require('moment');var BPromise=require(_0xdad4('0x1'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xdad4('0x2'));var rimraf=require(_0xdad4('0x3'));var config=require(_0xdad4('0x4'));var attributes=require(_0xdad4('0x5'));module[_0xdad4('0x6')]=function(_0x462716,_0x5a0232){return _0x462716[_0xdad4('0x7')]('ZohoField',attributes,{'tableName':'int_zoho_fields','paranoid':![],'indexes':[{'name':_0xdad4('0x8'),'fields':[_0xdad4('0x9'),_0xdad4('0xa')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0x8435=['exports','ZohoField','idField','FieldId','util','../../config/logger','api','moment','request-promise','path','rimraf','../../config/environment','./intZohoField.attributes'];(function(_0x3e4a11,_0x449e5a){var _0x23ca7f=function(_0x5ee447){while(--_0x5ee447){_0x3e4a11['push'](_0x3e4a11['shift']());}};_0x23ca7f(++_0x449e5a);}(_0x8435,0x163));var _0x5843=function(_0x27c6f1,_0x3e1bfc){_0x27c6f1=_0x27c6f1-0x0;var _0x35befe=_0x8435[_0x27c6f1];return _0x35befe;};'use strict';var _=require('lodash');var util=require(_0x5843('0x0'));var logger=require(_0x5843('0x1'))(_0x5843('0x2'));var moment=require(_0x5843('0x3'));var BPromise=require('bluebird');var rp=require(_0x5843('0x4'));var fs=require('fs');var path=require(_0x5843('0x5'));var rimraf=require(_0x5843('0x6'));var config=require(_0x5843('0x7'));var attributes=require(_0x5843('0x8'));module[_0x5843('0x9')]=function(_0x27b870,_0xaf145a){return _0x27b870['define'](_0x5843('0xa'),attributes,{'tableName':'int_zoho_fields','paranoid':![],'indexes':[{'name':'zoho_unique_index','fields':[_0x5843('0xb'),_0x5843('0xc')],'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 2121557..11d6972 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 _0x425d=['lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request','then','info','ZohoField,\x20%s,\x20%s','request\x20sent','debug','ZohoField,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch'];(function(_0xfafc1e,_0x4f911f){var _0x13eb5b=function(_0x3fe8dc){while(--_0x3fe8dc){_0xfafc1e['push'](_0xfafc1e['shift']());}};_0x13eb5b(++_0x4f911f);}(_0x425d,0x1e0));var _0xd425=function(_0x5d39d5,_0x15c987){_0x5d39d5=_0x5d39d5-0x0;var _0x371e07=_0x425d[_0x5d39d5];return _0x371e07;};'use strict';var _=require(_0xd425('0x0'));var util=require('util');var moment=require(_0xd425('0x1'));var BPromise=require(_0xd425('0x2'));var rs=require(_0xd425('0x3'));var fs=require('fs');var Redis=require(_0xd425('0x4'));var db=require(_0xd425('0x5'))['db'];var utils=require(_0xd425('0x6'));var logger=require(_0xd425('0x7'))('rpc');var config=require(_0xd425('0x8'));var jayson=require(_0xd425('0x9'));var client=jayson[_0xd425('0xa')][_0xd425('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x1d97d9,_0x1d2ed0,_0x50b061){return new BPromise(function(_0xb6ba8e,_0x374c3d){return client[_0xd425('0xc')](_0x1d97d9,_0x50b061)[_0xd425('0xd')](function(_0x2db9da){logger[_0xd425('0xe')](_0xd425('0xf'),_0x1d2ed0,_0xd425('0x10'));logger[_0xd425('0x11')](_0xd425('0x12'),_0x1d2ed0,_0xd425('0x10'),JSON[_0xd425('0x13')](_0x2db9da));if(_0x2db9da[_0xd425('0x14')]){if(_0x2db9da[_0xd425('0x14')][_0xd425('0x15')]===0x1f4){logger[_0xd425('0x14')](_0xd425('0xf'),_0x1d2ed0,_0x2db9da[_0xd425('0x14')][_0xd425('0x16')]);return _0x374c3d(_0x2db9da[_0xd425('0x14')]['message']);}logger[_0xd425('0x14')](_0xd425('0xf'),_0x1d2ed0,_0x2db9da[_0xd425('0x14')]['message']);return _0xb6ba8e(_0x2db9da[_0xd425('0x14')][_0xd425('0x16')]);}else{logger[_0xd425('0xe')](_0xd425('0xf'),_0x1d2ed0,_0xd425('0x10'));_0xb6ba8e(_0x2db9da['result'][_0xd425('0x16')]);}})[_0xd425('0x17')](function(_0x7e267e){logger[_0xd425('0x14')]('ZohoField,\x20%s,\x20%s',_0x1d2ed0,_0x7e267e);_0x374c3d(_0x7e267e);});});} \ No newline at end of file +var _0xb458=['ZohoField,\x20%s,\x20%s,\x20%s','code','error','message','request\x20sent','result','catch','lodash','util','moment','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','http','request','then','info','ZohoField,\x20%s,\x20%s','debug'];(function(_0x1b6186,_0x1ec7f2){var _0x186121=function(_0x1748a8){while(--_0x1748a8){_0x1b6186['push'](_0x1b6186['shift']());}};_0x186121(++_0x1ec7f2);}(_0xb458,0x103));var _0x8b45=function(_0xc051b2,_0x3d6d9d){_0xc051b2=_0xc051b2-0x0;var _0x599dc2=_0xb458[_0xc051b2];return _0x599dc2;};'use strict';var _=require(_0x8b45('0x0'));var util=require(_0x8b45('0x1'));var moment=require(_0x8b45('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x8b45('0x3'));var db=require(_0x8b45('0x4'))['db'];var utils=require(_0x8b45('0x5'));var logger=require(_0x8b45('0x6'))('rpc');var config=require(_0x8b45('0x7'));var jayson=require('jayson/promise');var client=jayson['client'][_0x8b45('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x12bd05,_0x2daa9a,_0x3a8ccb){return new BPromise(function(_0x32342f,_0x4d1718){return client[_0x8b45('0x9')](_0x12bd05,_0x3a8ccb)[_0x8b45('0xa')](function(_0x33f30e){logger[_0x8b45('0xb')](_0x8b45('0xc'),_0x2daa9a,'request\x20sent');logger[_0x8b45('0xd')](_0x8b45('0xe'),_0x2daa9a,'request\x20sent',JSON['stringify'](_0x33f30e));if(_0x33f30e['error']){if(_0x33f30e['error'][_0x8b45('0xf')]===0x1f4){logger[_0x8b45('0x10')](_0x8b45('0xc'),_0x2daa9a,_0x33f30e['error'][_0x8b45('0x11')]);return _0x4d1718(_0x33f30e[_0x8b45('0x10')][_0x8b45('0x11')]);}logger[_0x8b45('0x10')](_0x8b45('0xc'),_0x2daa9a,_0x33f30e[_0x8b45('0x10')]['message']);return _0x32342f(_0x33f30e['error'][_0x8b45('0x11')]);}else{logger[_0x8b45('0xb')](_0x8b45('0xc'),_0x2daa9a,_0x8b45('0x12'));_0x32342f(_0x33f30e[_0x8b45('0x13')][_0x8b45('0x11')]);}})[_0x8b45('0x14')](function(_0x147d6b){logger[_0x8b45('0x10')](_0x8b45('0xc'),_0x2daa9a,_0x147d6b);_0x4d1718(_0x147d6b);});});} \ No newline at end of file diff --git a/server/api/integration/index.js b/server/api/integration/index.js index 1676d6c..78a63f9 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 _0x6a48=['path','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','multer','util'];(function(_0x30f436,_0x481f9a){var _0x13a648=function(_0x36f131){while(--_0x36f131){_0x30f436['push'](_0x30f436['shift']());}};_0x13a648(++_0x481f9a);}(_0x6a48,0x1ae));var _0x86a4=function(_0x3fb20c,_0x29b223){_0x3fb20c=_0x3fb20c-0x0;var _0x46cc6c=_0x6a48[_0x3fb20c];return _0x46cc6c;};'use strict';var multer=require(_0x86a4('0x0'));var util=require(_0x86a4('0x1'));var path=require(_0x86a4('0x2'));var timeout=require('connect-timeout');var express=require(_0x86a4('0x3'));var router=express[_0x86a4('0x4')]();var auth=require(_0x86a4('0x5'));var interaction=require(_0x86a4('0x6'));var config=require(_0x86a4('0x7'));module['exports']=router; \ No newline at end of file +var _0xc269=['connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','exports','util'];(function(_0x413feb,_0x10477f){var _0x40ee88=function(_0x32a3f6){while(--_0x32a3f6){_0x413feb['push'](_0x413feb['shift']());}};_0x40ee88(++_0x10477f);}(_0xc269,0x127));var _0x9c26=function(_0x538eb9,_0x3bea91){_0x538eb9=_0x538eb9-0x0;var _0x48488d=_0xc269[_0x538eb9];return _0x48488d;};'use strict';var multer=require('multer');var util=require(_0x9c26('0x0'));var path=require('path');var timeout=require(_0x9c26('0x1'));var express=require(_0x9c26('0x2'));var router=express[_0x9c26('0x3')]();var auth=require(_0x9c26('0x4'));var interaction=require(_0x9c26('0x5'));var config=require(_0x9c26('0x6'));module[_0x9c26('0x7')]=router; \ No newline at end of file diff --git a/server/api/integration/integration.attributes.js b/server/api/integration/integration.attributes.js index 17b7102..5389adb 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 _0x49db=['unique_name_and_version','app.js','state','sequelize','STRING'];(function(_0x1943d9,_0x245bb8){var _0x4b4f3f=function(_0x3bba90){while(--_0x3bba90){_0x1943d9['push'](_0x1943d9['shift']());}};_0x4b4f3f(++_0x245bb8);}(_0x49db,0x14d));var _0xb49d=function(_0x4548ff,_0x1d720c){_0x4548ff=_0x4548ff-0x0;var _0x246a87=_0x49db[_0x4548ff];return _0x246a87;};'use strict';var Sequelize=require(_0xb49d('0x0'));module['exports']={'name':{'type':Sequelize[_0xb49d('0x1')],'allowNull':![],'unique':_0xb49d('0x2')},'version':{'type':Sequelize[_0xb49d('0x1')],'allowNull':![],'unique':_0xb49d('0x2')},'main':{'type':Sequelize[_0xb49d('0x1')],'defaultValue':_0xb49d('0x3')},'filename':{'type':Sequelize[_0xb49d('0x1')]},'path':{'type':Sequelize[_0xb49d('0x1')]},'type':{'type':Sequelize['STRING']},'size':{'type':Sequelize['INTEGER']},'active':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'author':{'type':Sequelize[_0xb49d('0x1')]},'logo':{'type':Sequelize[_0xb49d('0x1')]},'state':{'type':Sequelize['STRING'],'unique':_0xb49d('0x4')},'description':{'type':Sequelize[_0xb49d('0x1')]},'title':{'type':Sequelize[_0xb49d('0x1')]},'remoteUri':{'type':Sequelize[_0xb49d('0x1')]},'link':{'type':Sequelize[_0xb49d('0x1')],'defaultValue':'#'}}; \ No newline at end of file +var _0x4a09=['app.js','INTEGER','BOOLEAN','state','STRING','unique_name_and_version'];(function(_0x1b9b71,_0x7548a5){var _0x4d9e33=function(_0x49130e){while(--_0x49130e){_0x1b9b71['push'](_0x1b9b71['shift']());}};_0x4d9e33(++_0x7548a5);}(_0x4a09,0xa0));var _0x94a0=function(_0x5d0e26,_0x546a4a){_0x5d0e26=_0x5d0e26-0x0;var _0x589811=_0x4a09[_0x5d0e26];return _0x589811;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize[_0x94a0('0x0')],'allowNull':![],'unique':_0x94a0('0x1')},'version':{'type':Sequelize['STRING'],'allowNull':![],'unique':_0x94a0('0x1')},'main':{'type':Sequelize[_0x94a0('0x0')],'defaultValue':_0x94a0('0x2')},'filename':{'type':Sequelize[_0x94a0('0x0')]},'path':{'type':Sequelize['STRING']},'type':{'type':Sequelize[_0x94a0('0x0')]},'size':{'type':Sequelize[_0x94a0('0x3')]},'active':{'type':Sequelize[_0x94a0('0x4')],'defaultValue':![]},'author':{'type':Sequelize[_0x94a0('0x0')]},'logo':{'type':Sequelize['STRING']},'state':{'type':Sequelize[_0x94a0('0x0')],'unique':_0x94a0('0x5')},'description':{'type':Sequelize['STRING']},'title':{'type':Sequelize[_0x94a0('0x0')]},'remoteUri':{'type':Sequelize[_0x94a0('0x0')]},'link':{'type':Sequelize[_0x94a0('0x0')],'defaultValue':'#'}}; \ No newline at end of file diff --git a/server/api/integration/integration.controller.js b/server/api/integration/integration.controller.js index 32b1bfb..a912ea4 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 _0xdc76=['to-csv','lodash','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','sendStatus','json','offset','Content-Range','apply','reject','save','update','then','destroy','status','end','stack','name','send','index','map','Integration','rawAttributes','type','key','keys','filters','model','query','attributes','intersection','fields','length','hasOwnProperty','limit','sort','where','pick','merge','VIRTUAL','options','count','includeAll','include','findAll','catch','show','params','find','create','body','html-pdf','eml-format','zip-dir','request-promise','moment','mustache','util','path'];(function(_0x550b95,_0x2125d4){var _0x5966f4=function(_0x31c55d){while(--_0x31c55d){_0x550b95['push'](_0x550b95['shift']());}};_0x5966f4(++_0x2125d4);}(_0xdc76,0xca));var _0x6dc7=function(_0x19e35c,_0x29cd1e){_0x19e35c=_0x19e35c-0x0;var _0x3e1fe8=_0xdc76[_0x19e35c];return _0x3e1fe8;};'use strict';var pdf=require(_0x6dc7('0x0'));var emlformat=require(_0x6dc7('0x1'));var rimraf=require('rimraf');var zipdir=require(_0x6dc7('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x6dc7('0x3'));var moment=require(_0x6dc7('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x6dc7('0x5'));var util=require(_0x6dc7('0x6'));var path=require(_0x6dc7('0x7'));var sox=require('sox');var csv=require(_0x6dc7('0x8'));var ejs=require('ejs');var fs=require('fs');var _=require(_0x6dc7('0x9'));var squel=require(_0x6dc7('0xa'));var crypto=require(_0x6dc7('0xb'));var jsforce=require(_0x6dc7('0xc'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x6dc7('0xd'));var Papa=require(_0x6dc7('0xe'));var Redis=require(_0x6dc7('0xf'));var authService=require(_0x6dc7('0x10'));var qs=require(_0x6dc7('0x11'));var as=require(_0x6dc7('0x12'));var hardwareService=require(_0x6dc7('0x13'));var logger=require(_0x6dc7('0x14'))(_0x6dc7('0x15'));var utils=require(_0x6dc7('0x16'));var config=require('../../config/environment');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x1c0264,_0x42fe0b){_0x42fe0b=_0x42fe0b||0xcc;return function(_0x5db6d0){if(_0x5db6d0){return _0x1c0264[_0x6dc7('0x17')](_0x42fe0b);}return _0x1c0264['status'](_0x42fe0b)['end']();};}function respondWithResult(_0x41d60a,_0x1ddc09){_0x1ddc09=_0x1ddc09||0xc8;return function(_0x3587d3){if(_0x3587d3){return _0x41d60a['status'](_0x1ddc09)[_0x6dc7('0x18')](_0x3587d3);}};}function respondWithFilteredResult(_0x22a9e3,_0x1b3128){return function(_0x309088){if(_0x309088){var _0x1495c0=_0x309088['count'],_0x38e350=_0x1b3128[_0x6dc7('0x19')],_0x4ff941=_0x1b3128[_0x6dc7('0x19')]+_0x1b3128['limit'],_0x48a14e;if(_0x4ff941>=_0x1495c0){_0x4ff941=_0x1495c0;_0x48a14e=0xc8;}else{_0x48a14e=0xce;}_0x22a9e3['status'](_0x48a14e);return _0x22a9e3['set'](_0x6dc7('0x1a'),_0x38e350+'-'+_0x4ff941+'/'+_0x1495c0)[_0x6dc7('0x18')](_0x309088);}return null;};}function patchUpdates(_0x44d33b){return function(_0xa60a8e){try{jsonpatch[_0x6dc7('0x1b')](_0xa60a8e,_0x44d33b,!![]);}catch(_0xfb0bb8){return BPromise[_0x6dc7('0x1c')](_0xfb0bb8);}return _0xa60a8e[_0x6dc7('0x1d')]();};}function saveUpdates(_0x1766f0,_0x7569f8){return function(_0x29b1d3){if(_0x29b1d3){return _0x29b1d3[_0x6dc7('0x1e')](_0x1766f0)[_0x6dc7('0x1f')](function(_0x18835d){return _0x18835d;});}return null;};}function removeEntity(_0x2d764a,_0xf79f6f){return function(_0x4229d1){if(_0x4229d1){return _0x4229d1[_0x6dc7('0x20')]()[_0x6dc7('0x1f')](function(){_0x2d764a[_0x6dc7('0x21')](0xcc)[_0x6dc7('0x22')]();});}};}function handleEntityNotFound(_0x2f43f1,_0x28cce9){return function(_0x5aed7d){if(!_0x5aed7d){_0x2f43f1[_0x6dc7('0x17')](0x194);}return _0x5aed7d;};}function handleError(_0xbfd67a,_0x4f6fd8){_0x4f6fd8=_0x4f6fd8||0x1f4;return function(_0x3432e7){logger['error'](_0x3432e7[_0x6dc7('0x23')]);if(_0x3432e7[_0x6dc7('0x24')]){delete _0x3432e7['name'];}_0xbfd67a[_0x6dc7('0x21')](_0x4f6fd8)[_0x6dc7('0x25')](_0x3432e7);};}exports[_0x6dc7('0x26')]=function(_0x145492,_0x20cca3){var _0x360e3c={},_0x1cc1d9={},_0x511a90={'count':0x0,'rows':[]};var _0x5d950f=_[_0x6dc7('0x27')](db[_0x6dc7('0x28')][_0x6dc7('0x29')],function(_0x7db0d2){return{'name':_0x7db0d2['fieldName'],'type':_0x7db0d2[_0x6dc7('0x2a')][_0x6dc7('0x2b')]};});_0x1cc1d9['model']=_[_0x6dc7('0x27')](_0x5d950f,_0x6dc7('0x24'));_0x1cc1d9['query']=_[_0x6dc7('0x2c')](_0x145492['query']);_0x1cc1d9[_0x6dc7('0x2d')]=_['intersection'](_0x1cc1d9[_0x6dc7('0x2e')],_0x1cc1d9[_0x6dc7('0x2f')]);_0x360e3c[_0x6dc7('0x30')]=_[_0x6dc7('0x31')](_0x1cc1d9[_0x6dc7('0x2e')],qs[_0x6dc7('0x32')](_0x145492[_0x6dc7('0x2f')][_0x6dc7('0x32')]));_0x360e3c[_0x6dc7('0x30')]=_0x360e3c[_0x6dc7('0x30')][_0x6dc7('0x33')]?_0x360e3c[_0x6dc7('0x30')]:_0x1cc1d9[_0x6dc7('0x2e')];if(!_0x145492['query'][_0x6dc7('0x34')]('nolimit')){_0x360e3c['limit']=qs[_0x6dc7('0x35')](_0x145492[_0x6dc7('0x2f')]['limit']);_0x360e3c[_0x6dc7('0x19')]=qs['offset'](_0x145492[_0x6dc7('0x2f')]['offset']);}_0x360e3c['order']=qs[_0x6dc7('0x36')](_0x145492[_0x6dc7('0x2f')][_0x6dc7('0x36')]);_0x360e3c[_0x6dc7('0x37')]=qs['filters'](_[_0x6dc7('0x38')](_0x145492[_0x6dc7('0x2f')],_0x1cc1d9[_0x6dc7('0x2d')]));if(_0x145492[_0x6dc7('0x2f')]['filter']){_0x360e3c[_0x6dc7('0x37')]=_[_0x6dc7('0x39')](_0x360e3c[_0x6dc7('0x37')],{'$or':_[_0x6dc7('0x27')](_0x5d950f,function(_0x1c8ce5){if(_0x1c8ce5[_0x6dc7('0x2a')]!==_0x6dc7('0x3a')){var _0x4a5ab8={};_0x4a5ab8[_0x1c8ce5[_0x6dc7('0x24')]]={'$like':'%'+_0x145492[_0x6dc7('0x2f')]['filter']+'%'};return _0x4a5ab8;}})});}_0x360e3c=_['merge']({},_0x360e3c,_0x145492[_0x6dc7('0x3b')]);var _0x2be51f={'where':_0x360e3c[_0x6dc7('0x37')]};return db['Integration'][_0x6dc7('0x3c')](_0x2be51f)[_0x6dc7('0x1f')](function(_0x1b9891){_0x511a90[_0x6dc7('0x3c')]=_0x1b9891;if(_0x145492[_0x6dc7('0x2f')][_0x6dc7('0x3d')]){_0x360e3c[_0x6dc7('0x3e')]=[{'all':!![]}];}return db[_0x6dc7('0x28')][_0x6dc7('0x3f')](_0x360e3c);})[_0x6dc7('0x1f')](function(_0x4d00a3){_0x511a90['rows']=_0x4d00a3;return _0x511a90;})[_0x6dc7('0x1f')](respondWithFilteredResult(_0x20cca3,_0x360e3c))[_0x6dc7('0x40')](handleError(_0x20cca3,null));};exports[_0x6dc7('0x41')]=function(_0x3760c9,_0x300f86){var _0x562abc={'raw':![],'where':{'id':_0x3760c9[_0x6dc7('0x42')]['id']}},_0x59fbda={};_0x59fbda[_0x6dc7('0x2e')]=_[_0x6dc7('0x2c')](db['Integration']['rawAttributes']);_0x59fbda['query']=_['keys'](_0x3760c9[_0x6dc7('0x2f')]);_0x59fbda[_0x6dc7('0x2d')]=_[_0x6dc7('0x31')](_0x59fbda['model'],_0x59fbda[_0x6dc7('0x2f')]);_0x562abc[_0x6dc7('0x30')]=_['intersection'](_0x59fbda[_0x6dc7('0x2e')],qs[_0x6dc7('0x32')](_0x3760c9[_0x6dc7('0x2f')][_0x6dc7('0x32')]));_0x562abc['attributes']=_0x562abc['attributes'][_0x6dc7('0x33')]?_0x562abc['attributes']:_0x59fbda['model'];if(_0x3760c9[_0x6dc7('0x2f')][_0x6dc7('0x3d')]){_0x562abc[_0x6dc7('0x3e')]=[{'all':!![]}];}_0x562abc=_['merge']({},_0x562abc,_0x3760c9[_0x6dc7('0x3b')]);return db[_0x6dc7('0x28')][_0x6dc7('0x43')](_0x562abc)['then'](handleEntityNotFound(_0x300f86,null))[_0x6dc7('0x1f')](respondWithResult(_0x300f86,null))[_0x6dc7('0x40')](handleError(_0x300f86,null));};exports[_0x6dc7('0x44')]=function(_0x5eee32,_0x1b7be0){return db[_0x6dc7('0x28')]['create'](_0x5eee32[_0x6dc7('0x45')],{})['then'](respondWithResult(_0x1b7be0,0xc9))[_0x6dc7('0x40')](handleError(_0x1b7be0,null));};exports[_0x6dc7('0x1e')]=function(_0x33ffe6,_0x2839d0){if(_0x33ffe6[_0x6dc7('0x45')]['id']){delete _0x33ffe6[_0x6dc7('0x45')]['id'];}return db[_0x6dc7('0x28')][_0x6dc7('0x43')]({'where':{'id':_0x33ffe6[_0x6dc7('0x42')]['id']}})[_0x6dc7('0x1f')](handleEntityNotFound(_0x2839d0,null))[_0x6dc7('0x1f')](saveUpdates(_0x33ffe6['body'],null))['then'](respondWithResult(_0x2839d0,null))[_0x6dc7('0x40')](handleError(_0x2839d0,null));};exports['destroy']=function(_0xe4d4eb,_0x329e9a){return db[_0x6dc7('0x28')][_0x6dc7('0x43')]({'where':{'id':_0xe4d4eb['params']['id']}})['then'](handleEntityNotFound(_0x329e9a,null))[_0x6dc7('0x1f')](removeEntity(_0x329e9a,null))['catch'](handleError(_0x329e9a,null));}; \ No newline at end of file +var _0xc6b0=['json','reject','save','then','destroy','error','name','send','map','Integration','rawAttributes','fieldName','type','key','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','limit','order','sort','where','pick','merge','VIRTUAL','filter','options','includeAll','include','findAll','rows','catch','params','keys','find','create','body','update','rimraf','zip-dir','request-promise','bluebird','util','path','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','count','offset'];(function(_0x32a370,_0x4dab40){var _0x358b58=function(_0x2509a3){while(--_0x2509a3){_0x32a370['push'](_0x32a370['shift']());}};_0x358b58(++_0x4dab40);}(_0xc6b0,0x100));var _0x0c6b=function(_0x2a8d0f,_0x42983b){_0x2a8d0f=_0x2a8d0f-0x0;var _0xf4cc50=_0xc6b0[_0x2a8d0f];return _0xf4cc50;};'use strict';var pdf=require('html-pdf');var emlformat=require('eml-format');var rimraf=require(_0x0c6b('0x0'));var zipdir=require(_0x0c6b('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x0c6b('0x2'));var moment=require('moment');var BPromise=require(_0x0c6b('0x3'));var Mustache=require('mustache');var util=require(_0x0c6b('0x4'));var path=require(_0x0c6b('0x5'));var sox=require('sox');var csv=require(_0x0c6b('0x6'));var ejs=require(_0x0c6b('0x7'));var fs=require('fs');var _=require(_0x0c6b('0x8'));var squel=require(_0x0c6b('0x9'));var crypto=require(_0x0c6b('0xa'));var jsforce=require(_0x0c6b('0xb'));var deskjs=require(_0x0c6b('0xc'));var toCsv=require(_0x0c6b('0x6'));var querystring=require(_0x0c6b('0xd'));var Papa=require(_0x0c6b('0xe'));var Redis=require(_0x0c6b('0xf'));var authService=require(_0x0c6b('0x10'));var qs=require('../../components/parsers/qs');var as=require(_0x0c6b('0x11'));var hardwareService=require(_0x0c6b('0x12'));var logger=require('../../config/logger')(_0x0c6b('0x13'));var utils=require(_0x0c6b('0x14'));var config=require(_0x0c6b('0x15'));var db=require(_0x0c6b('0x16'))['db'];function respondWithStatusCode(_0x27d97e,_0x508a3f){_0x508a3f=_0x508a3f||0xcc;return function(_0x18c936){if(_0x18c936){return _0x27d97e[_0x0c6b('0x17')](_0x508a3f);}return _0x27d97e[_0x0c6b('0x18')](_0x508a3f)[_0x0c6b('0x19')]();};}function respondWithResult(_0x594030,_0x35e9ed){_0x35e9ed=_0x35e9ed||0xc8;return function(_0x174f6c){if(_0x174f6c){return _0x594030[_0x0c6b('0x18')](_0x35e9ed)['json'](_0x174f6c);}};}function respondWithFilteredResult(_0x5d2988,_0x23649c){return function(_0x160acd){if(_0x160acd){var _0x398f75=_0x160acd[_0x0c6b('0x1a')],_0x355003=_0x23649c[_0x0c6b('0x1b')],_0x4216d9=_0x23649c[_0x0c6b('0x1b')]+_0x23649c['limit'],_0x2c57e9;if(_0x4216d9>=_0x398f75){_0x4216d9=_0x398f75;_0x2c57e9=0xc8;}else{_0x2c57e9=0xce;}_0x5d2988[_0x0c6b('0x18')](_0x2c57e9);return _0x5d2988['set']('Content-Range',_0x355003+'-'+_0x4216d9+'/'+_0x398f75)[_0x0c6b('0x1c')](_0x160acd);}return null;};}function patchUpdates(_0x247f45){return function(_0x4e4cce){try{jsonpatch['apply'](_0x4e4cce,_0x247f45,!![]);}catch(_0x1f8dd5){return BPromise[_0x0c6b('0x1d')](_0x1f8dd5);}return _0x4e4cce[_0x0c6b('0x1e')]();};}function saveUpdates(_0x3a382b,_0x5ebfd0){return function(_0x4a2c96){if(_0x4a2c96){return _0x4a2c96['update'](_0x3a382b)[_0x0c6b('0x1f')](function(_0x107d38){return _0x107d38;});}return null;};}function removeEntity(_0x5c7788,_0x56f05a){return function(_0x3f37ba){if(_0x3f37ba){return _0x3f37ba[_0x0c6b('0x20')]()['then'](function(){_0x5c7788[_0x0c6b('0x18')](0xcc)['end']();});}};}function handleEntityNotFound(_0x4ada46,_0x5043d1){return function(_0x1730b9){if(!_0x1730b9){_0x4ada46[_0x0c6b('0x17')](0x194);}return _0x1730b9;};}function handleError(_0x491e92,_0x73122e){_0x73122e=_0x73122e||0x1f4;return function(_0x188178){logger[_0x0c6b('0x21')](_0x188178['stack']);if(_0x188178[_0x0c6b('0x22')]){delete _0x188178[_0x0c6b('0x22')];}_0x491e92[_0x0c6b('0x18')](_0x73122e)[_0x0c6b('0x23')](_0x188178);};}exports['index']=function(_0xda4a44,_0x45723d){var _0x20a5fd={},_0x239569={},_0x116036={'count':0x0,'rows':[]};var _0x552ee1=_[_0x0c6b('0x24')](db[_0x0c6b('0x25')][_0x0c6b('0x26')],function(_0x1ad2a0){return{'name':_0x1ad2a0[_0x0c6b('0x27')],'type':_0x1ad2a0[_0x0c6b('0x28')][_0x0c6b('0x29')]};});_0x239569[_0x0c6b('0x2a')]=_[_0x0c6b('0x24')](_0x552ee1,_0x0c6b('0x22'));_0x239569[_0x0c6b('0x2b')]=_['keys'](_0xda4a44[_0x0c6b('0x2b')]);_0x239569[_0x0c6b('0x2c')]=_[_0x0c6b('0x2d')](_0x239569[_0x0c6b('0x2a')],_0x239569[_0x0c6b('0x2b')]);_0x20a5fd[_0x0c6b('0x2e')]=_['intersection'](_0x239569[_0x0c6b('0x2a')],qs[_0x0c6b('0x2f')](_0xda4a44[_0x0c6b('0x2b')]['fields']));_0x20a5fd[_0x0c6b('0x2e')]=_0x20a5fd[_0x0c6b('0x2e')][_0x0c6b('0x30')]?_0x20a5fd[_0x0c6b('0x2e')]:_0x239569[_0x0c6b('0x2a')];if(!_0xda4a44[_0x0c6b('0x2b')][_0x0c6b('0x31')](_0x0c6b('0x32'))){_0x20a5fd[_0x0c6b('0x33')]=qs['limit'](_0xda4a44[_0x0c6b('0x2b')][_0x0c6b('0x33')]);_0x20a5fd[_0x0c6b('0x1b')]=qs[_0x0c6b('0x1b')](_0xda4a44[_0x0c6b('0x2b')][_0x0c6b('0x1b')]);}_0x20a5fd[_0x0c6b('0x34')]=qs['sort'](_0xda4a44[_0x0c6b('0x2b')][_0x0c6b('0x35')]);_0x20a5fd[_0x0c6b('0x36')]=qs[_0x0c6b('0x2c')](_[_0x0c6b('0x37')](_0xda4a44['query'],_0x239569['filters']));if(_0xda4a44[_0x0c6b('0x2b')]['filter']){_0x20a5fd[_0x0c6b('0x36')]=_[_0x0c6b('0x38')](_0x20a5fd['where'],{'$or':_['map'](_0x552ee1,function(_0x491eda){if(_0x491eda[_0x0c6b('0x28')]!==_0x0c6b('0x39')){var _0x44d78b={};_0x44d78b[_0x491eda[_0x0c6b('0x22')]]={'$like':'%'+_0xda4a44['query'][_0x0c6b('0x3a')]+'%'};return _0x44d78b;}})});}_0x20a5fd=_[_0x0c6b('0x38')]({},_0x20a5fd,_0xda4a44[_0x0c6b('0x3b')]);var _0x5e8d2d={'where':_0x20a5fd[_0x0c6b('0x36')]};return db['Integration']['count'](_0x5e8d2d)[_0x0c6b('0x1f')](function(_0xee56d2){_0x116036[_0x0c6b('0x1a')]=_0xee56d2;if(_0xda4a44['query'][_0x0c6b('0x3c')]){_0x20a5fd[_0x0c6b('0x3d')]=[{'all':!![]}];}return db['Integration'][_0x0c6b('0x3e')](_0x20a5fd);})[_0x0c6b('0x1f')](function(_0x3f5afa){_0x116036[_0x0c6b('0x3f')]=_0x3f5afa;return _0x116036;})[_0x0c6b('0x1f')](respondWithFilteredResult(_0x45723d,_0x20a5fd))[_0x0c6b('0x40')](handleError(_0x45723d,null));};exports['show']=function(_0x503d97,_0x20a515){var _0x571eae={'raw':![],'where':{'id':_0x503d97[_0x0c6b('0x41')]['id']}},_0x2fa800={};_0x2fa800[_0x0c6b('0x2a')]=_['keys'](db[_0x0c6b('0x25')]['rawAttributes']);_0x2fa800[_0x0c6b('0x2b')]=_[_0x0c6b('0x42')](_0x503d97[_0x0c6b('0x2b')]);_0x2fa800['filters']=_['intersection'](_0x2fa800[_0x0c6b('0x2a')],_0x2fa800['query']);_0x571eae['attributes']=_[_0x0c6b('0x2d')](_0x2fa800[_0x0c6b('0x2a')],qs[_0x0c6b('0x2f')](_0x503d97[_0x0c6b('0x2b')][_0x0c6b('0x2f')]));_0x571eae[_0x0c6b('0x2e')]=_0x571eae[_0x0c6b('0x2e')][_0x0c6b('0x30')]?_0x571eae['attributes']:_0x2fa800[_0x0c6b('0x2a')];if(_0x503d97[_0x0c6b('0x2b')][_0x0c6b('0x3c')]){_0x571eae[_0x0c6b('0x3d')]=[{'all':!![]}];}_0x571eae=_[_0x0c6b('0x38')]({},_0x571eae,_0x503d97[_0x0c6b('0x3b')]);return db['Integration'][_0x0c6b('0x43')](_0x571eae)[_0x0c6b('0x1f')](handleEntityNotFound(_0x20a515,null))[_0x0c6b('0x1f')](respondWithResult(_0x20a515,null))[_0x0c6b('0x40')](handleError(_0x20a515,null));};exports[_0x0c6b('0x44')]=function(_0x5c1b10,_0x55cef3){return db[_0x0c6b('0x25')]['create'](_0x5c1b10[_0x0c6b('0x45')],{})[_0x0c6b('0x1f')](respondWithResult(_0x55cef3,0xc9))[_0x0c6b('0x40')](handleError(_0x55cef3,null));};exports[_0x0c6b('0x46')]=function(_0x3487bc,_0x5a2ba0){if(_0x3487bc[_0x0c6b('0x45')]['id']){delete _0x3487bc[_0x0c6b('0x45')]['id'];}return db[_0x0c6b('0x25')][_0x0c6b('0x43')]({'where':{'id':_0x3487bc[_0x0c6b('0x41')]['id']}})[_0x0c6b('0x1f')](handleEntityNotFound(_0x5a2ba0,null))['then'](saveUpdates(_0x3487bc[_0x0c6b('0x45')],null))[_0x0c6b('0x1f')](respondWithResult(_0x5a2ba0,null))[_0x0c6b('0x40')](handleError(_0x5a2ba0,null));};exports['destroy']=function(_0x2fb01f,_0x22a99c){return db['Integration']['find']({'where':{'id':_0x2fb01f[_0x0c6b('0x41')]['id']}})['then'](handleEntityNotFound(_0x22a99c,null))['then'](removeEntity(_0x22a99c,null))[_0x0c6b('0x40')](handleError(_0x22a99c,null));}; \ No newline at end of file diff --git a/server/api/integration/integration.model.js b/server/api/integration/integration.model.js index 7e5dd81..3d36ebb 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 _0x41fe=['api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./integration.attributes','exports','define','Integration','lodash','../../config/logger'];(function(_0x4a3168,_0x494f38){var _0x35c154=function(_0x1ab446){while(--_0x1ab446){_0x4a3168['push'](_0x4a3168['shift']());}};_0x35c154(++_0x494f38);}(_0x41fe,0x15d));var _0xe41f=function(_0x1a36a5,_0x746928){_0x1a36a5=_0x1a36a5-0x0;var _0x746243=_0x41fe[_0x1a36a5];return _0x746243;};'use strict';var _=require(_0xe41f('0x0'));var util=require('util');var logger=require(_0xe41f('0x1'))(_0xe41f('0x2'));var moment=require(_0xe41f('0x3'));var BPromise=require(_0xe41f('0x4'));var rp=require(_0xe41f('0x5'));var fs=require('fs');var path=require(_0xe41f('0x6'));var rimraf=require(_0xe41f('0x7'));var config=require(_0xe41f('0x8'));var attributes=require(_0xe41f('0x9'));module[_0xe41f('0xa')]=function(_0x45ad58,_0x37d2f8){return _0x45ad58[_0xe41f('0xb')](_0xe41f('0xc'),attributes,{'tableName':'integrations','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x4bac=['./integration.attributes','define','Integration','integrations','lodash','util','moment','request-promise','path','rimraf','../../config/environment'];(function(_0x26e605,_0x26837d){var _0x1dddc9=function(_0x3c127b){while(--_0x3c127b){_0x26e605['push'](_0x26e605['shift']());}};_0x1dddc9(++_0x26837d);}(_0x4bac,0x164));var _0xc4ba=function(_0x42478e,_0x7b2b04){_0x42478e=_0x42478e-0x0;var _0x356877=_0x4bac[_0x42478e];return _0x356877;};'use strict';var _=require(_0xc4ba('0x0'));var util=require(_0xc4ba('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0xc4ba('0x2'));var BPromise=require('bluebird');var rp=require(_0xc4ba('0x3'));var fs=require('fs');var path=require(_0xc4ba('0x4'));var rimraf=require(_0xc4ba('0x5'));var config=require(_0xc4ba('0x6'));var attributes=require(_0xc4ba('0x7'));module['exports']=function(_0x4d00d3,_0x45fe43){return _0x4d00d3[_0xc4ba('0x8')](_0xc4ba('0x9'),attributes,{'tableName':_0xc4ba('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/integration/integration.rpc.js b/server/api/integration/integration.rpc.js index 7de98ba..c216b21 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 _0x8a8b=['error','code','message','lodash','bluebird','randomstring','../../mysqldb','../../config/logger','../../config/environment','jayson/promise','client','request','then','info','Integration,\x20%s,\x20%s','request\x20sent','debug','Integration,\x20%s,\x20%s,\x20%s','stringify'];(function(_0x6518f6,_0x153325){var _0x3f569b=function(_0x12ed6c){while(--_0x12ed6c){_0x6518f6['push'](_0x6518f6['shift']());}};_0x3f569b(++_0x153325);}(_0x8a8b,0xae));var _0xb8a8=function(_0x179080,_0x552ed7){_0x179080=_0x179080-0x0;var _0x419e6b=_0x8a8b[_0x179080];return _0x419e6b;};'use strict';var _=require(_0xb8a8('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0xb8a8('0x1'));var rs=require(_0xb8a8('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xb8a8('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0xb8a8('0x4'))('rpc');var config=require(_0xb8a8('0x5'));var jayson=require(_0xb8a8('0x6'));var client=jayson[_0xb8a8('0x7')]['http']({'port':0x232a});function respondWithRpcPromise(_0x37e48d,_0x59cf56,_0x32d542){return new BPromise(function(_0x4c46e9,_0x79cb4a){return client[_0xb8a8('0x8')](_0x37e48d,_0x32d542)[_0xb8a8('0x9')](function(_0x5b1515){logger[_0xb8a8('0xa')](_0xb8a8('0xb'),_0x59cf56,_0xb8a8('0xc'));logger[_0xb8a8('0xd')](_0xb8a8('0xe'),_0x59cf56,_0xb8a8('0xc'),JSON[_0xb8a8('0xf')](_0x5b1515));if(_0x5b1515[_0xb8a8('0x10')]){if(_0x5b1515[_0xb8a8('0x10')][_0xb8a8('0x11')]===0x1f4){logger[_0xb8a8('0x10')](_0xb8a8('0xb'),_0x59cf56,_0x5b1515[_0xb8a8('0x10')]['message']);return _0x79cb4a(_0x5b1515[_0xb8a8('0x10')][_0xb8a8('0x12')]);}logger[_0xb8a8('0x10')](_0xb8a8('0xb'),_0x59cf56,_0x5b1515[_0xb8a8('0x10')][_0xb8a8('0x12')]);return _0x4c46e9(_0x5b1515[_0xb8a8('0x10')][_0xb8a8('0x12')]);}else{logger[_0xb8a8('0xa')](_0xb8a8('0xb'),_0x59cf56,_0xb8a8('0xc'));_0x4c46e9(_0x5b1515['result'][_0xb8a8('0x12')]);}})['catch'](function(_0x9bd9af){logger[_0xb8a8('0x10')](_0xb8a8('0xb'),_0x59cf56,_0x9bd9af);_0x79cb4a(_0x9bd9af);});});} \ No newline at end of file +var _0xeb79=['../../config/environment','jayson/promise','request','then','info','request\x20sent','debug','Integration,\x20%s,\x20%s,\x20%s','stringify','error','code','Integration,\x20%s,\x20%s','message','result','catch','moment','randomstring','../../mysqldb','../../config/logger','rpc'];(function(_0x4b2863,_0x494899){var _0x567d67=function(_0x751f03){while(--_0x751f03){_0x4b2863['push'](_0x4b2863['shift']());}};_0x567d67(++_0x494899);}(_0xeb79,0x87));var _0x9eb7=function(_0x1904a3,_0x21fe28){_0x1904a3=_0x1904a3-0x0;var _0x3b45e1=_0xeb79[_0x1904a3];return _0x3b45e1;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x9eb7('0x0'));var BPromise=require('bluebird');var rs=require(_0x9eb7('0x1'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x9eb7('0x2'))['db'];var utils=require('../../config/utils');var logger=require(_0x9eb7('0x3'))(_0x9eb7('0x4'));var config=require(_0x9eb7('0x5'));var jayson=require(_0x9eb7('0x6'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0xaa486a,_0x5ae8e6,_0x152a72){return new BPromise(function(_0x127fb9,_0x352bb8){return client[_0x9eb7('0x7')](_0xaa486a,_0x152a72)[_0x9eb7('0x8')](function(_0x21a767){logger[_0x9eb7('0x9')]('Integration,\x20%s,\x20%s',_0x5ae8e6,_0x9eb7('0xa'));logger[_0x9eb7('0xb')](_0x9eb7('0xc'),_0x5ae8e6,_0x9eb7('0xa'),JSON[_0x9eb7('0xd')](_0x21a767));if(_0x21a767[_0x9eb7('0xe')]){if(_0x21a767[_0x9eb7('0xe')][_0x9eb7('0xf')]===0x1f4){logger[_0x9eb7('0xe')](_0x9eb7('0x10'),_0x5ae8e6,_0x21a767[_0x9eb7('0xe')][_0x9eb7('0x11')]);return _0x352bb8(_0x21a767[_0x9eb7('0xe')][_0x9eb7('0x11')]);}logger[_0x9eb7('0xe')]('Integration,\x20%s,\x20%s',_0x5ae8e6,_0x21a767[_0x9eb7('0xe')][_0x9eb7('0x11')]);return _0x127fb9(_0x21a767[_0x9eb7('0xe')][_0x9eb7('0x11')]);}else{logger[_0x9eb7('0x9')](_0x9eb7('0x10'),_0x5ae8e6,_0x9eb7('0xa'));_0x127fb9(_0x21a767[_0x9eb7('0x12')][_0x9eb7('0x11')]);}})[_0x9eb7('0x13')](function(_0xc8aa18){logger[_0x9eb7('0xe')](_0x9eb7('0x10'),_0x5ae8e6,_0xc8aa18);_0x352bb8(_0xc8aa18);});});} \ No newline at end of file diff --git a/server/api/integrationReport/index.js b/server/api/integrationReport/index.js index 0bcb53c..9c675a9 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 _0xf164=['create','put','/:id','update','destroy','multer','util','path','connect-timeout','../../components/interaction/service','./integrationReport.controller','get','isAuthenticated','index','/describe','show'];(function(_0x1c06f4,_0x2feba6){var _0x1a727e=function(_0x2e83af){while(--_0x2e83af){_0x1c06f4['push'](_0x1c06f4['shift']());}};_0x1a727e(++_0x2feba6);}(_0xf164,0xe5));var _0x4f16=function(_0x24c963,_0x5f32a4){_0x24c963=_0x24c963-0x0;var _0x32a0eb=_0xf164[_0x24c963];return _0x32a0eb;};'use strict';var multer=require(_0x4f16('0x0'));var util=require(_0x4f16('0x1'));var path=require(_0x4f16('0x2'));var timeout=require(_0x4f16('0x3'));var express=require('express');var router=express['Router']();var auth=require('../../components/auth/service');var interaction=require(_0x4f16('0x4'));var config=require('../../config/environment');var controller=require(_0x4f16('0x5'));router[_0x4f16('0x6')]('/',auth[_0x4f16('0x7')](),controller[_0x4f16('0x8')]);router['get'](_0x4f16('0x9'),auth[_0x4f16('0x7')](),controller['describe']);router['get']('/:id',auth['isAuthenticated'](),controller[_0x4f16('0xa')]);router['post']('/',auth['isAuthenticated'](),controller[_0x4f16('0xb')]);router[_0x4f16('0xc')](_0x4f16('0xd'),auth['isAuthenticated'](),controller[_0x4f16('0xe')]);router['delete'](_0x4f16('0xd'),auth['isAuthenticated'](),controller[_0x4f16('0xf')]);module['exports']=router; \ No newline at end of file +var _0x5063=['exports','util','path','connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment','isAuthenticated','index','get','/:id','show','create','update','delete'];(function(_0x2ab746,_0xa84195){var _0x3e8295=function(_0x59c6f6){while(--_0x59c6f6){_0x2ab746['push'](_0x2ab746['shift']());}};_0x3e8295(++_0xa84195);}(_0x5063,0x151));var _0x3506=function(_0x4827c0,_0x20ef9d){_0x4827c0=_0x4827c0-0x0;var _0x13bc6b=_0x5063[_0x4827c0];return _0x13bc6b;};'use strict';var multer=require('multer');var util=require(_0x3506('0x0'));var path=require(_0x3506('0x1'));var timeout=require(_0x3506('0x2'));var express=require(_0x3506('0x3'));var router=express['Router']();var auth=require(_0x3506('0x4'));var interaction=require(_0x3506('0x5'));var config=require(_0x3506('0x6'));var controller=require('./integrationReport.controller');router['get']('/',auth[_0x3506('0x7')](),controller[_0x3506('0x8')]);router[_0x3506('0x9')]('/describe',auth[_0x3506('0x7')](),controller['describe']);router[_0x3506('0x9')](_0x3506('0xa'),auth['isAuthenticated'](),controller[_0x3506('0xb')]);router['post']('/',auth['isAuthenticated'](),controller[_0x3506('0xc')]);router['put'](_0x3506('0xa'),auth[_0x3506('0x7')](),controller[_0x3506('0xd')]);router[_0x3506('0xe')](_0x3506('0xa'),auth[_0x3506('0x7')](),controller['destroy']);module[_0x3506('0xf')]=router; \ No newline at end of file diff --git a/server/api/integrationReport/integrationReport.attributes.js b/server/api/integrationReport/integrationReport.attributes.js index 8a648ee..c5b14ba 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 _0xbae0=['RECEIVED','FAILED','sequelize','exports','STRING','DATE','BOOLEAN','INTEGER','TEXT','ENUM','SENT','SENDING'];(function(_0x2b365f,_0x17aa37){var _0x26b060=function(_0x5e0a39){while(--_0x5e0a39){_0x2b365f['push'](_0x2b365f['shift']());}};_0x26b060(++_0x17aa37);}(_0xbae0,0x1d6));var _0x0bae=function(_0xa3fadc,_0xd1e16){_0xa3fadc=_0xa3fadc-0x0;var _0x23ecb8=_0xbae0[_0xa3fadc];return _0x23ecb8;};'use strict';var Sequelize=require(_0x0bae('0x0'));module[_0x0bae('0x1')]={'integration':{'type':Sequelize[_0x0bae('0x2')]},'eventChannel':{'type':Sequelize[_0x0bae('0x2')]},'exitStatus':{'type':Sequelize[_0x0bae('0x2')]},'ticketId':{'type':Sequelize[_0x0bae('0x2')]},'integrationId':{'type':Sequelize['INTEGER']},'contacts':{'type':Sequelize['STRING']},'uniqueid':{'type':Sequelize['STRING']},'calleridnum':{'type':Sequelize[_0x0bae('0x2')]},'calleridname':{'type':Sequelize[_0x0bae('0x2')]},'queue':{'type':Sequelize[_0x0bae('0x2')]},'interface':{'type':Sequelize[_0x0bae('0x2')]},'membername':{'type':Sequelize[_0x0bae('0x2')]},'agentcalledAt':{'type':Sequelize[_0x0bae('0x3')]},'agentconnectAt':{'type':Sequelize[_0x0bae('0x3')]},'holdtime':{'type':Sequelize['INTEGER']},'agentcomplete':{'type':Sequelize[_0x0bae('0x4')],'defaultValue':![]},'agentcompleteAt':{'type':Sequelize['DATE']},'talktime':{'type':Sequelize[_0x0bae('0x5')]},'agentacw':{'type':Sequelize[_0x0bae('0x4')],'defaultValue':![]},'acwtime':{'type':Sequelize[_0x0bae('0x5')]},'reason':{'type':Sequelize[_0x0bae('0x2')]},'agentringnoanswer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentringnoanswerAt':{'type':Sequelize['DATE']},'agentdump':{'type':Sequelize[_0x0bae('0x4')],'defaultValue':![]},'agentdumpAt':{'type':Sequelize['DATE']},'lastevent':{'type':Sequelize[_0x0bae('0x2')]},'channel':{'type':Sequelize[_0x0bae('0x2')]},'channelstate':{'type':Sequelize[_0x0bae('0x5')]},'channelstatedesc':{'type':Sequelize[_0x0bae('0x2')]},'connectedlinenum':{'type':Sequelize[_0x0bae('0x2')]},'connectedlinename':{'type':Sequelize['STRING']},'language':{'type':Sequelize[_0x0bae('0x2')]},'accountcode':{'type':Sequelize['STRING']},'context':{'type':Sequelize['STRING']},'exten':{'type':Sequelize[_0x0bae('0x2')]},'priority':{'type':Sequelize[_0x0bae('0x2')]},'destchannel':{'type':Sequelize['STRING']},'destchannelstate':{'type':Sequelize[_0x0bae('0x5')]},'destchannelstatedesc':{'type':Sequelize[_0x0bae('0x2')]},'destcalleridnum':{'type':Sequelize[_0x0bae('0x2')]},'destcalleridname':{'type':Sequelize['STRING']},'destconnectedlinenum':{'type':Sequelize[_0x0bae('0x2')]},'destconnectedlinename':{'type':Sequelize[_0x0bae('0x2')]},'destlanguage':{'type':Sequelize[_0x0bae('0x2')]},'destaccountcode':{'type':Sequelize['STRING']},'destcontext':{'type':Sequelize['STRING']},'destexten':{'type':Sequelize['STRING']},'destpriority':{'type':Sequelize[_0x0bae('0x2')]},'destuniqueid':{'type':Sequelize[_0x0bae('0x2')]},'messageId':{'type':Sequelize[_0x0bae('0x2')]},'inReplyTo':{'type':Sequelize[_0x0bae('0x2')]},'subject':{'type':Sequelize[_0x0bae('0x2')]},'from':{'type':Sequelize[_0x0bae('0x2')]},'to':{'type':Sequelize['STRING']},'cc':{'type':Sequelize['STRING']},'attachment':{'type':Sequelize['TEXT']},'html':{'type':Sequelize['TEXT']},'text':{'type':Sequelize[_0x0bae('0x6')]},'status':{'type':Sequelize[_0x0bae('0x7')](_0x0bae('0x8'),_0x0bae('0x9'),_0x0bae('0xa'),_0x0bae('0xb'))},'url':{'type':Sequelize['STRING']},'app':{'type':Sequelize['STRING']},'appdata':{'type':Sequelize[_0x0bae('0x2')]},'projectId':{'type':Sequelize['INTEGER']}}; \ No newline at end of file +var _0xb69a=['INTEGER','TEXT','ENUM','SENDING','RECEIVED','FAILED','sequelize','exports','STRING','BOOLEAN','DATE'];(function(_0x131cf2,_0x21baeb){var _0x1a7ccd=function(_0x4c0552){while(--_0x4c0552){_0x131cf2['push'](_0x131cf2['shift']());}};_0x1a7ccd(++_0x21baeb);}(_0xb69a,0x19d));var _0xab69=function(_0x243b2f,_0x30aa15){_0x243b2f=_0x243b2f-0x0;var _0xcb3c2d=_0xb69a[_0x243b2f];return _0xcb3c2d;};'use strict';var Sequelize=require(_0xab69('0x0'));module[_0xab69('0x1')]={'integration':{'type':Sequelize['STRING']},'eventChannel':{'type':Sequelize[_0xab69('0x2')]},'exitStatus':{'type':Sequelize['STRING']},'ticketId':{'type':Sequelize['STRING']},'integrationId':{'type':Sequelize['INTEGER']},'contacts':{'type':Sequelize[_0xab69('0x2')]},'uniqueid':{'type':Sequelize[_0xab69('0x2')]},'calleridnum':{'type':Sequelize[_0xab69('0x2')]},'calleridname':{'type':Sequelize['STRING']},'queue':{'type':Sequelize[_0xab69('0x2')]},'interface':{'type':Sequelize['STRING']},'membername':{'type':Sequelize['STRING']},'agentcalledAt':{'type':Sequelize['DATE']},'agentconnectAt':{'type':Sequelize['DATE']},'holdtime':{'type':Sequelize['INTEGER']},'agentcomplete':{'type':Sequelize[_0xab69('0x3')],'defaultValue':![]},'agentcompleteAt':{'type':Sequelize[_0xab69('0x4')]},'talktime':{'type':Sequelize[_0xab69('0x5')]},'agentacw':{'type':Sequelize[_0xab69('0x3')],'defaultValue':![]},'acwtime':{'type':Sequelize[_0xab69('0x5')]},'reason':{'type':Sequelize[_0xab69('0x2')]},'agentringnoanswer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentringnoanswerAt':{'type':Sequelize[_0xab69('0x4')]},'agentdump':{'type':Sequelize[_0xab69('0x3')],'defaultValue':![]},'agentdumpAt':{'type':Sequelize['DATE']},'lastevent':{'type':Sequelize['STRING']},'channel':{'type':Sequelize[_0xab69('0x2')]},'channelstate':{'type':Sequelize[_0xab69('0x5')]},'channelstatedesc':{'type':Sequelize[_0xab69('0x2')]},'connectedlinenum':{'type':Sequelize[_0xab69('0x2')]},'connectedlinename':{'type':Sequelize[_0xab69('0x2')]},'language':{'type':Sequelize[_0xab69('0x2')]},'accountcode':{'type':Sequelize[_0xab69('0x2')]},'context':{'type':Sequelize[_0xab69('0x2')]},'exten':{'type':Sequelize['STRING']},'priority':{'type':Sequelize['STRING']},'destchannel':{'type':Sequelize[_0xab69('0x2')]},'destchannelstate':{'type':Sequelize[_0xab69('0x5')]},'destchannelstatedesc':{'type':Sequelize[_0xab69('0x2')]},'destcalleridnum':{'type':Sequelize[_0xab69('0x2')]},'destcalleridname':{'type':Sequelize[_0xab69('0x2')]},'destconnectedlinenum':{'type':Sequelize[_0xab69('0x2')]},'destconnectedlinename':{'type':Sequelize[_0xab69('0x2')]},'destlanguage':{'type':Sequelize[_0xab69('0x2')]},'destaccountcode':{'type':Sequelize['STRING']},'destcontext':{'type':Sequelize[_0xab69('0x2')]},'destexten':{'type':Sequelize[_0xab69('0x2')]},'destpriority':{'type':Sequelize['STRING']},'destuniqueid':{'type':Sequelize[_0xab69('0x2')]},'messageId':{'type':Sequelize['STRING']},'inReplyTo':{'type':Sequelize['STRING']},'subject':{'type':Sequelize['STRING']},'from':{'type':Sequelize[_0xab69('0x2')]},'to':{'type':Sequelize[_0xab69('0x2')]},'cc':{'type':Sequelize[_0xab69('0x2')]},'attachment':{'type':Sequelize[_0xab69('0x6')]},'html':{'type':Sequelize['TEXT']},'text':{'type':Sequelize[_0xab69('0x6')]},'status':{'type':Sequelize[_0xab69('0x7')]('SENT',_0xab69('0x8'),_0xab69('0x9'),_0xab69('0xa'))},'url':{'type':Sequelize[_0xab69('0x2')]},'app':{'type':Sequelize[_0xab69('0x2')]},'appdata':{'type':Sequelize[_0xab69('0x2')]},'projectId':{'type':Sequelize[_0xab69('0x5')]}}; \ No newline at end of file diff --git a/server/api/integrationReport/integrationReport.controller.js b/server/api/integrationReport/integrationReport.controller.js index 80d1f69..3d850f8 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 _0x68a5=['stack','name','send','index','map','IntegrationReport','rawAttributes','fieldName','type','key','model','query','keys','filters','attributes','intersection','fields','length','order','sort','pick','filter','where','merge','includeAll','include','findAll','rows','catch','show','options','find','create','body','destroy','describe','html-pdf','rimraf','zip-dir','request-promise','moment','bluebird','mustache','path','to-csv','ejs','lodash','squel','jsforce','querystring','papaparse','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/environment','../../mysqldb','sendStatus','status','end','json','count','offset','limit','set','Content-Range','apply','reject','save','update','then','error'];(function(_0x1358d6,_0xb7ae9e){var _0x3851a2=function(_0x347c9b){while(--_0x347c9b){_0x1358d6['push'](_0x1358d6['shift']());}};_0x3851a2(++_0xb7ae9e);}(_0x68a5,0xfc));var _0x568a=function(_0x6b6adb,_0x297ddf){_0x6b6adb=_0x6b6adb-0x0;var _0x46b088=_0x68a5[_0x6b6adb];return _0x46b088;};'use strict';var pdf=require(_0x568a('0x0'));var emlformat=require('eml-format');var rimraf=require(_0x568a('0x1'));var zipdir=require(_0x568a('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x568a('0x3'));var moment=require(_0x568a('0x4'));var BPromise=require(_0x568a('0x5'));var Mustache=require(_0x568a('0x6'));var util=require('util');var path=require(_0x568a('0x7'));var sox=require('sox');var csv=require(_0x568a('0x8'));var ejs=require(_0x568a('0x9'));var fs=require('fs');var _=require(_0x568a('0xa'));var squel=require(_0x568a('0xb'));var crypto=require('crypto');var jsforce=require(_0x568a('0xc'));var deskjs=require('desk.js');var toCsv=require(_0x568a('0x8'));var querystring=require(_0x568a('0xd'));var Papa=require(_0x568a('0xe'));var Redis=require(_0x568a('0xf'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x568a('0x10'));var hardwareService=require(_0x568a('0x11'));var logger=require('../../config/logger')(_0x568a('0x12'));var utils=require('../../config/utils');var config=require(_0x568a('0x13'));var db=require(_0x568a('0x14'))['db'];function respondWithStatusCode(_0xea9341,_0x22bc5b){_0x22bc5b=_0x22bc5b||0xcc;return function(_0x365871){if(_0x365871){return _0xea9341[_0x568a('0x15')](_0x22bc5b);}return _0xea9341[_0x568a('0x16')](_0x22bc5b)[_0x568a('0x17')]();};}function respondWithResult(_0x441119,_0x37903b){_0x37903b=_0x37903b||0xc8;return function(_0x3dd9af){if(_0x3dd9af){return _0x441119[_0x568a('0x16')](_0x37903b)[_0x568a('0x18')](_0x3dd9af);}};}function respondWithFilteredResult(_0x2c7b3c,_0x110ac2){return function(_0x1f9cc4){if(_0x1f9cc4){var _0x375bac=_0x1f9cc4[_0x568a('0x19')],_0x4e6f9a=_0x110ac2[_0x568a('0x1a')],_0x323bf3=_0x110ac2['offset']+_0x110ac2[_0x568a('0x1b')],_0x573b17;if(_0x323bf3>=_0x375bac){_0x323bf3=_0x375bac;_0x573b17=0xc8;}else{_0x573b17=0xce;}_0x2c7b3c['status'](_0x573b17);return _0x2c7b3c[_0x568a('0x1c')](_0x568a('0x1d'),_0x4e6f9a+'-'+_0x323bf3+'/'+_0x375bac)[_0x568a('0x18')](_0x1f9cc4);}return null;};}function patchUpdates(_0x16a7c5){return function(_0x5f0b12){try{jsonpatch[_0x568a('0x1e')](_0x5f0b12,_0x16a7c5,!![]);}catch(_0x4fd8e8){return BPromise[_0x568a('0x1f')](_0x4fd8e8);}return _0x5f0b12[_0x568a('0x20')]();};}function saveUpdates(_0x15fb1b,_0x3b9968){return function(_0x252bb8){if(_0x252bb8){return _0x252bb8[_0x568a('0x21')](_0x15fb1b)[_0x568a('0x22')](function(_0x29c358){return _0x29c358;});}return null;};}function removeEntity(_0x4d1172,_0x3171d8){return function(_0x1f12b5){if(_0x1f12b5){return _0x1f12b5['destroy']()[_0x568a('0x22')](function(){_0x4d1172[_0x568a('0x16')](0xcc)[_0x568a('0x17')]();});}};}function handleEntityNotFound(_0x4f5c30,_0x1826aa){return function(_0x378f0e){if(!_0x378f0e){_0x4f5c30[_0x568a('0x15')](0x194);}return _0x378f0e;};}function handleError(_0x1df7ab,_0xdb83a1){_0xdb83a1=_0xdb83a1||0x1f4;return function(_0x401109){logger[_0x568a('0x23')](_0x401109[_0x568a('0x24')]);if(_0x401109[_0x568a('0x25')]){delete _0x401109['name'];}_0x1df7ab[_0x568a('0x16')](_0xdb83a1)[_0x568a('0x26')](_0x401109);};}exports[_0x568a('0x27')]=function(_0x22b097,_0x45f7e8){var _0x438402={},_0x5d8c2e={},_0x473ba8={'count':0x0,'rows':[]};var _0x3d14ab=_[_0x568a('0x28')](db[_0x568a('0x29')][_0x568a('0x2a')],function(_0x5911f4){return{'name':_0x5911f4[_0x568a('0x2b')],'type':_0x5911f4[_0x568a('0x2c')][_0x568a('0x2d')]};});_0x5d8c2e[_0x568a('0x2e')]=_[_0x568a('0x28')](_0x3d14ab,_0x568a('0x25'));_0x5d8c2e[_0x568a('0x2f')]=_[_0x568a('0x30')](_0x22b097[_0x568a('0x2f')]);_0x5d8c2e[_0x568a('0x31')]=_['intersection'](_0x5d8c2e[_0x568a('0x2e')],_0x5d8c2e[_0x568a('0x2f')]);_0x438402[_0x568a('0x32')]=_[_0x568a('0x33')](_0x5d8c2e[_0x568a('0x2e')],qs[_0x568a('0x34')](_0x22b097['query']['fields']));_0x438402['attributes']=_0x438402[_0x568a('0x32')][_0x568a('0x35')]?_0x438402[_0x568a('0x32')]:_0x5d8c2e[_0x568a('0x2e')];if(!_0x22b097[_0x568a('0x2f')]['hasOwnProperty']('nolimit')){_0x438402[_0x568a('0x1b')]=qs[_0x568a('0x1b')](_0x22b097[_0x568a('0x2f')][_0x568a('0x1b')]);_0x438402[_0x568a('0x1a')]=qs['offset'](_0x22b097[_0x568a('0x2f')]['offset']);}_0x438402[_0x568a('0x36')]=qs[_0x568a('0x37')](_0x22b097['query'][_0x568a('0x37')]);_0x438402['where']=qs[_0x568a('0x31')](_[_0x568a('0x38')](_0x22b097[_0x568a('0x2f')],_0x5d8c2e['filters']));if(_0x22b097['query'][_0x568a('0x39')]){_0x438402[_0x568a('0x3a')]=_[_0x568a('0x3b')](_0x438402[_0x568a('0x3a')],{'$or':_[_0x568a('0x28')](_0x3d14ab,function(_0x458f84){if(_0x458f84[_0x568a('0x2c')]!=='VIRTUAL'){var _0x52df42={};_0x52df42[_0x458f84[_0x568a('0x25')]]={'$like':'%'+_0x22b097[_0x568a('0x2f')][_0x568a('0x39')]+'%'};return _0x52df42;}})});}_0x438402=_['merge']({},_0x438402,_0x22b097['options']);var _0x3ba130={'where':_0x438402[_0x568a('0x3a')]};return db['IntegrationReport'][_0x568a('0x19')](_0x3ba130)[_0x568a('0x22')](function(_0x580290){_0x473ba8[_0x568a('0x19')]=_0x580290;if(_0x22b097[_0x568a('0x2f')][_0x568a('0x3c')]){_0x438402[_0x568a('0x3d')]=[{'all':!![]}];}return db[_0x568a('0x29')][_0x568a('0x3e')](_0x438402);})['then'](function(_0x4da8da){_0x473ba8[_0x568a('0x3f')]=_0x4da8da;return _0x473ba8;})[_0x568a('0x22')](respondWithFilteredResult(_0x45f7e8,_0x438402))[_0x568a('0x40')](handleError(_0x45f7e8,null));};exports[_0x568a('0x41')]=function(_0x115284,_0x1d8d29){var _0x3ba483={'raw':![],'where':{'id':_0x115284['params']['id']}},_0x64143a={};_0x64143a[_0x568a('0x2e')]=_[_0x568a('0x30')](db[_0x568a('0x29')][_0x568a('0x2a')]);_0x64143a[_0x568a('0x2f')]=_['keys'](_0x115284[_0x568a('0x2f')]);_0x64143a['filters']=_[_0x568a('0x33')](_0x64143a[_0x568a('0x2e')],_0x64143a[_0x568a('0x2f')]);_0x3ba483[_0x568a('0x32')]=_[_0x568a('0x33')](_0x64143a[_0x568a('0x2e')],qs[_0x568a('0x34')](_0x115284['query'][_0x568a('0x34')]));_0x3ba483[_0x568a('0x32')]=_0x3ba483[_0x568a('0x32')]['length']?_0x3ba483[_0x568a('0x32')]:_0x64143a['model'];if(_0x115284['query'][_0x568a('0x3c')]){_0x3ba483['include']=[{'all':!![]}];}_0x3ba483=_[_0x568a('0x3b')]({},_0x3ba483,_0x115284[_0x568a('0x42')]);return db['IntegrationReport'][_0x568a('0x43')](_0x3ba483)[_0x568a('0x22')](handleEntityNotFound(_0x1d8d29,null))[_0x568a('0x22')](respondWithResult(_0x1d8d29,null))[_0x568a('0x40')](handleError(_0x1d8d29,null));};exports[_0x568a('0x44')]=function(_0x51a774,_0x27ddf9){return db[_0x568a('0x29')]['create'](_0x51a774[_0x568a('0x45')],{})[_0x568a('0x22')](respondWithResult(_0x27ddf9,0xc9))[_0x568a('0x40')](handleError(_0x27ddf9,null));};exports[_0x568a('0x21')]=function(_0x8d9aa5,_0x3e224b){if(_0x8d9aa5[_0x568a('0x45')]['id']){delete _0x8d9aa5['body']['id'];}return db[_0x568a('0x29')][_0x568a('0x43')]({'where':{'id':_0x8d9aa5['params']['id']}})[_0x568a('0x22')](handleEntityNotFound(_0x3e224b,null))[_0x568a('0x22')](saveUpdates(_0x8d9aa5['body'],null))[_0x568a('0x22')](respondWithResult(_0x3e224b,null))['catch'](handleError(_0x3e224b,null));};exports[_0x568a('0x46')]=function(_0x3b21ac,_0x2e3dc7){return db[_0x568a('0x29')][_0x568a('0x43')]({'where':{'id':_0x3b21ac['params']['id']}})[_0x568a('0x22')](handleEntityNotFound(_0x2e3dc7,null))[_0x568a('0x22')](removeEntity(_0x2e3dc7,null))['catch'](handleError(_0x2e3dc7,null));};exports[_0x568a('0x47')]=function(_0xc5f51a,_0x1f849e){return db[_0x568a('0x29')]['describe']()[_0x568a('0x22')](respondWithResult(_0x1f849e,null))[_0x568a('0x40')](handleError(_0x1f849e,null));}; \ No newline at end of file +var _0x0570=['filter','merge','options','IntegrationReport','includeAll','include','rows','catch','show','params','fields','find','create','body','describe','eml-format','rimraf','zip-dir','request-promise','bluebird','util','path','sox','to-csv','ejs','squel','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../mysqldb','sendStatus','status','end','count','offset','set','json','apply','reject','save','update','then','destroy','name','send','index','map','rawAttributes','fieldName','type','query','keys','filters','intersection','model','attributes','length','hasOwnProperty','nolimit','limit','order','sort','pick','where','VIRTUAL'];(function(_0x2deed4,_0x2793e8){var _0xfb91f4=function(_0x31cb98){while(--_0x31cb98){_0x2deed4['push'](_0x2deed4['shift']());}};_0xfb91f4(++_0x2793e8);}(_0x0570,0x172));var _0x0057=function(_0x2ea236,_0x83a454){_0x2ea236=_0x2ea236-0x0;var _0x3696e8=_0x0570[_0x2ea236];return _0x3696e8;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x0057('0x0'));var rimraf=require(_0x0057('0x1'));var zipdir=require(_0x0057('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x0057('0x3'));var moment=require('moment');var BPromise=require(_0x0057('0x4'));var Mustache=require('mustache');var util=require(_0x0057('0x5'));var path=require(_0x0057('0x6'));var sox=require(_0x0057('0x7'));var csv=require(_0x0057('0x8'));var ejs=require(_0x0057('0x9'));var fs=require('fs');var _=require('lodash');var squel=require(_0x0057('0xa'));var crypto=require('crypto');var jsforce=require(_0x0057('0xb'));var deskjs=require(_0x0057('0xc'));var toCsv=require(_0x0057('0x8'));var querystring=require(_0x0057('0xd'));var Papa=require(_0x0057('0xe'));var Redis=require('ioredis');var authService=require(_0x0057('0xf'));var qs=require(_0x0057('0x10'));var as=require(_0x0057('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x0057('0x12'))(_0x0057('0x13'));var utils=require('../../config/utils');var config=require('../../config/environment');var db=require(_0x0057('0x14'))['db'];function respondWithStatusCode(_0x471f7c,_0x33ed2c){_0x33ed2c=_0x33ed2c||0xcc;return function(_0x4d9117){if(_0x4d9117){return _0x471f7c[_0x0057('0x15')](_0x33ed2c);}return _0x471f7c[_0x0057('0x16')](_0x33ed2c)[_0x0057('0x17')]();};}function respondWithResult(_0x344d8e,_0x567515){_0x567515=_0x567515||0xc8;return function(_0x1feb22){if(_0x1feb22){return _0x344d8e[_0x0057('0x16')](_0x567515)['json'](_0x1feb22);}};}function respondWithFilteredResult(_0x20e69e,_0x25628f){return function(_0x581e76){if(_0x581e76){var _0x17549f=_0x581e76[_0x0057('0x18')],_0x59a3e7=_0x25628f[_0x0057('0x19')],_0x399018=_0x25628f['offset']+_0x25628f['limit'],_0x51524e;if(_0x399018>=_0x17549f){_0x399018=_0x17549f;_0x51524e=0xc8;}else{_0x51524e=0xce;}_0x20e69e[_0x0057('0x16')](_0x51524e);return _0x20e69e[_0x0057('0x1a')]('Content-Range',_0x59a3e7+'-'+_0x399018+'/'+_0x17549f)[_0x0057('0x1b')](_0x581e76);}return null;};}function patchUpdates(_0x5b5a4b){return function(_0x96bd7f){try{jsonpatch[_0x0057('0x1c')](_0x96bd7f,_0x5b5a4b,!![]);}catch(_0xa6b45e){return BPromise[_0x0057('0x1d')](_0xa6b45e);}return _0x96bd7f[_0x0057('0x1e')]();};}function saveUpdates(_0x26a524,_0xdea279){return function(_0x320c62){if(_0x320c62){return _0x320c62[_0x0057('0x1f')](_0x26a524)[_0x0057('0x20')](function(_0x5e6499){return _0x5e6499;});}return null;};}function removeEntity(_0xc1ba0,_0x74a47c){return function(_0x43454a){if(_0x43454a){return _0x43454a[_0x0057('0x21')]()['then'](function(){_0xc1ba0[_0x0057('0x16')](0xcc)[_0x0057('0x17')]();});}};}function handleEntityNotFound(_0x5b7c01,_0x620fcc){return function(_0xa8d716){if(!_0xa8d716){_0x5b7c01['sendStatus'](0x194);}return _0xa8d716;};}function handleError(_0x464d79,_0x2472de){_0x2472de=_0x2472de||0x1f4;return function(_0x426304){logger['error'](_0x426304['stack']);if(_0x426304[_0x0057('0x22')]){delete _0x426304[_0x0057('0x22')];}_0x464d79[_0x0057('0x16')](_0x2472de)[_0x0057('0x23')](_0x426304);};}exports[_0x0057('0x24')]=function(_0x22ba65,_0x491ef3){var _0x5f3818={},_0x5cc3e0={},_0x32e92b={'count':0x0,'rows':[]};var _0x45ff9e=_[_0x0057('0x25')](db['IntegrationReport'][_0x0057('0x26')],function(_0xa4fb6a){return{'name':_0xa4fb6a[_0x0057('0x27')],'type':_0xa4fb6a[_0x0057('0x28')]['key']};});_0x5cc3e0['model']=_[_0x0057('0x25')](_0x45ff9e,'name');_0x5cc3e0[_0x0057('0x29')]=_[_0x0057('0x2a')](_0x22ba65[_0x0057('0x29')]);_0x5cc3e0[_0x0057('0x2b')]=_[_0x0057('0x2c')](_0x5cc3e0[_0x0057('0x2d')],_0x5cc3e0[_0x0057('0x29')]);_0x5f3818[_0x0057('0x2e')]=_['intersection'](_0x5cc3e0[_0x0057('0x2d')],qs['fields'](_0x22ba65[_0x0057('0x29')]['fields']));_0x5f3818['attributes']=_0x5f3818[_0x0057('0x2e')][_0x0057('0x2f')]?_0x5f3818[_0x0057('0x2e')]:_0x5cc3e0[_0x0057('0x2d')];if(!_0x22ba65['query'][_0x0057('0x30')](_0x0057('0x31'))){_0x5f3818[_0x0057('0x32')]=qs[_0x0057('0x32')](_0x22ba65[_0x0057('0x29')][_0x0057('0x32')]);_0x5f3818['offset']=qs[_0x0057('0x19')](_0x22ba65['query'][_0x0057('0x19')]);}_0x5f3818[_0x0057('0x33')]=qs[_0x0057('0x34')](_0x22ba65['query'][_0x0057('0x34')]);_0x5f3818['where']=qs['filters'](_[_0x0057('0x35')](_0x22ba65['query'],_0x5cc3e0[_0x0057('0x2b')]));if(_0x22ba65[_0x0057('0x29')]['filter']){_0x5f3818[_0x0057('0x36')]=_['merge'](_0x5f3818[_0x0057('0x36')],{'$or':_[_0x0057('0x25')](_0x45ff9e,function(_0x34e7b1){if(_0x34e7b1[_0x0057('0x28')]!==_0x0057('0x37')){var _0x5976f4={};_0x5976f4[_0x34e7b1[_0x0057('0x22')]]={'$like':'%'+_0x22ba65[_0x0057('0x29')][_0x0057('0x38')]+'%'};return _0x5976f4;}})});}_0x5f3818=_[_0x0057('0x39')]({},_0x5f3818,_0x22ba65[_0x0057('0x3a')]);var _0x48b875={'where':_0x5f3818[_0x0057('0x36')]};return db[_0x0057('0x3b')]['count'](_0x48b875)['then'](function(_0x556fc4){_0x32e92b[_0x0057('0x18')]=_0x556fc4;if(_0x22ba65[_0x0057('0x29')][_0x0057('0x3c')]){_0x5f3818[_0x0057('0x3d')]=[{'all':!![]}];}return db[_0x0057('0x3b')]['findAll'](_0x5f3818);})[_0x0057('0x20')](function(_0x583066){_0x32e92b[_0x0057('0x3e')]=_0x583066;return _0x32e92b;})['then'](respondWithFilteredResult(_0x491ef3,_0x5f3818))[_0x0057('0x3f')](handleError(_0x491ef3,null));};exports[_0x0057('0x40')]=function(_0x1b5743,_0x577d65){var _0x54e9a2={'raw':![],'where':{'id':_0x1b5743[_0x0057('0x41')]['id']}},_0x419f26={};_0x419f26[_0x0057('0x2d')]=_[_0x0057('0x2a')](db[_0x0057('0x3b')][_0x0057('0x26')]);_0x419f26[_0x0057('0x29')]=_[_0x0057('0x2a')](_0x1b5743[_0x0057('0x29')]);_0x419f26['filters']=_['intersection'](_0x419f26[_0x0057('0x2d')],_0x419f26[_0x0057('0x29')]);_0x54e9a2['attributes']=_[_0x0057('0x2c')](_0x419f26[_0x0057('0x2d')],qs[_0x0057('0x42')](_0x1b5743['query'][_0x0057('0x42')]));_0x54e9a2[_0x0057('0x2e')]=_0x54e9a2['attributes'][_0x0057('0x2f')]?_0x54e9a2[_0x0057('0x2e')]:_0x419f26['model'];if(_0x1b5743[_0x0057('0x29')][_0x0057('0x3c')]){_0x54e9a2[_0x0057('0x3d')]=[{'all':!![]}];}_0x54e9a2=_['merge']({},_0x54e9a2,_0x1b5743[_0x0057('0x3a')]);return db['IntegrationReport'][_0x0057('0x43')](_0x54e9a2)[_0x0057('0x20')](handleEntityNotFound(_0x577d65,null))['then'](respondWithResult(_0x577d65,null))[_0x0057('0x3f')](handleError(_0x577d65,null));};exports[_0x0057('0x44')]=function(_0x34797e,_0x5e8149){return db[_0x0057('0x3b')]['create'](_0x34797e[_0x0057('0x45')],{})[_0x0057('0x20')](respondWithResult(_0x5e8149,0xc9))[_0x0057('0x3f')](handleError(_0x5e8149,null));};exports[_0x0057('0x1f')]=function(_0x2733d9,_0x47886a){if(_0x2733d9[_0x0057('0x45')]['id']){delete _0x2733d9[_0x0057('0x45')]['id'];}return db[_0x0057('0x3b')]['find']({'where':{'id':_0x2733d9[_0x0057('0x41')]['id']}})[_0x0057('0x20')](handleEntityNotFound(_0x47886a,null))['then'](saveUpdates(_0x2733d9[_0x0057('0x45')],null))[_0x0057('0x20')](respondWithResult(_0x47886a,null))[_0x0057('0x3f')](handleError(_0x47886a,null));};exports['destroy']=function(_0x25ee88,_0x98e77e){return db['IntegrationReport'][_0x0057('0x43')]({'where':{'id':_0x25ee88['params']['id']}})[_0x0057('0x20')](handleEntityNotFound(_0x98e77e,null))['then'](removeEntity(_0x98e77e,null))[_0x0057('0x3f')](handleError(_0x98e77e,null));};exports[_0x0057('0x46')]=function(_0x6978a2,_0x5d7c7a){return db[_0x0057('0x3b')][_0x0057('0x46')]()[_0x0057('0x20')](respondWithResult(_0x5d7c7a,null))[_0x0057('0x3f')](handleError(_0x5d7c7a,null));}; \ No newline at end of file diff --git a/server/api/integrationReport/integrationReport.model.js b/server/api/integrationReport/integrationReport.model.js index b34f470..5910941 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 _0x246a=['lodash','util','../../config/logger','api','bluebird','request-promise','path','rimraf','../../config/environment','exports','define','IntegrationReport','report_integration'];(function(_0x49700f,_0x2c4820){var _0xd864e7=function(_0x2a4cef){while(--_0x2a4cef){_0x49700f['push'](_0x49700f['shift']());}};_0xd864e7(++_0x2c4820);}(_0x246a,0x179));var _0xa246=function(_0x4245e1,_0x35ce3c){_0x4245e1=_0x4245e1-0x0;var _0x588f21=_0x246a[_0x4245e1];return _0x588f21;};'use strict';var _=require(_0xa246('0x0'));var util=require(_0xa246('0x1'));var logger=require(_0xa246('0x2'))(_0xa246('0x3'));var moment=require('moment');var BPromise=require(_0xa246('0x4'));var rp=require(_0xa246('0x5'));var fs=require('fs');var path=require(_0xa246('0x6'));var rimraf=require(_0xa246('0x7'));var config=require(_0xa246('0x8'));var attributes=require('./integrationReport.attributes');module[_0xa246('0x9')]=function(_0x309c7e,_0x56a88d){return _0x309c7e[_0xa246('0xa')](_0xa246('0xb'),attributes,{'tableName':_0xa246('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x8dde=['request-promise','path','./integrationReport.attributes','exports','define','IntegrationReport','report_integration','lodash','../../config/logger','api','moment','bluebird'];(function(_0x4a37f1,_0x5612fd){var _0x5ac26a=function(_0x1bf840){while(--_0x1bf840){_0x4a37f1['push'](_0x4a37f1['shift']());}};_0x5ac26a(++_0x5612fd);}(_0x8dde,0x8b));var _0xe8dd=function(_0x1f1a97,_0xadfc15){_0x1f1a97=_0x1f1a97-0x0;var _0x29fc6a=_0x8dde[_0x1f1a97];return _0x29fc6a;};'use strict';var _=require(_0xe8dd('0x0'));var util=require('util');var logger=require(_0xe8dd('0x1'))(_0xe8dd('0x2'));var moment=require(_0xe8dd('0x3'));var BPromise=require(_0xe8dd('0x4'));var rp=require(_0xe8dd('0x5'));var fs=require('fs');var path=require(_0xe8dd('0x6'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0xe8dd('0x7'));module[_0xe8dd('0x8')]=function(_0x43cd4d,_0x545445){return _0x43cd4d[_0xe8dd('0x9')](_0xe8dd('0xa'),attributes,{'tableName':_0xe8dd('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/integrationReport/integrationReport.rpc.js b/server/api/integrationReport/integrationReport.rpc.js index 5fdb79f..61328c3 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 _0x2032=['ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','IntegrationReport,\x20%s,\x20%s','request\x20sent','debug','error','code','message','info','result','catch','util','moment','bluebird'];(function(_0xd0ccef,_0x1b0418){var _0x2172ff=function(_0x1f3522){while(--_0x1f3522){_0xd0ccef['push'](_0xd0ccef['shift']());}};_0x2172ff(++_0x1b0418);}(_0x2032,0xd9));var _0x2203=function(_0x38627d,_0x5ad652){_0x38627d=_0x38627d-0x0;var _0x2e904a=_0x2032[_0x38627d];return _0x2e904a;};'use strict';var _=require('lodash');var util=require(_0x2203('0x0'));var moment=require(_0x2203('0x1'));var BPromise=require(_0x2203('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x2203('0x3'));var db=require(_0x2203('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x2203('0x5'))(_0x2203('0x6'));var config=require(_0x2203('0x7'));var jayson=require(_0x2203('0x8'));var client=jayson[_0x2203('0x9')][_0x2203('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x2e0f63,_0x2676aa,_0x18c4d6){return new BPromise(function(_0x2049ff,_0x2999ed){return client['request'](_0x2e0f63,_0x18c4d6)['then'](function(_0x10f055){logger['info'](_0x2203('0xb'),_0x2676aa,_0x2203('0xc'));logger[_0x2203('0xd')]('IntegrationReport,\x20%s,\x20%s,\x20%s',_0x2676aa,_0x2203('0xc'),JSON['stringify'](_0x10f055));if(_0x10f055[_0x2203('0xe')]){if(_0x10f055['error'][_0x2203('0xf')]===0x1f4){logger[_0x2203('0xe')]('IntegrationReport,\x20%s,\x20%s',_0x2676aa,_0x10f055['error']['message']);return _0x2999ed(_0x10f055['error']['message']);}logger[_0x2203('0xe')]('IntegrationReport,\x20%s,\x20%s',_0x2676aa,_0x10f055['error'][_0x2203('0x10')]);return _0x2049ff(_0x10f055[_0x2203('0xe')][_0x2203('0x10')]);}else{logger[_0x2203('0x11')](_0x2203('0xb'),_0x2676aa,_0x2203('0xc'));_0x2049ff(_0x10f055[_0x2203('0x12')][_0x2203('0x10')]);}})[_0x2203('0x13')](function(_0x3053f3){logger['error'](_0x2203('0xb'),_0x2676aa,_0x3053f3);_0x2999ed(_0x3053f3);});});} \ No newline at end of file +var _0x757a=['request','then','info','IntegrationReport,\x20%s,\x20%s','request\x20sent','debug','IntegrationReport,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','util','moment','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http'];(function(_0x513725,_0x163391){var _0x157160=function(_0x3cf5a8){while(--_0x3cf5a8){_0x513725['push'](_0x513725['shift']());}};_0x157160(++_0x163391);}(_0x757a,0xde));var _0xa757=function(_0x2dc896,_0x28d03c){_0x2dc896=_0x2dc896-0x0;var _0x518558=_0x757a[_0x2dc896];return _0x518558;};'use strict';var _=require('lodash');var util=require(_0xa757('0x0'));var moment=require(_0xa757('0x1'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0xa757('0x2'))['db'];var utils=require(_0xa757('0x3'));var logger=require(_0xa757('0x4'))(_0xa757('0x5'));var config=require(_0xa757('0x6'));var jayson=require(_0xa757('0x7'));var client=jayson['client'][_0xa757('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x4343b6,_0x53be0e,_0x2930fa){return new BPromise(function(_0x2f7793,_0x447344){return client[_0xa757('0x9')](_0x4343b6,_0x2930fa)[_0xa757('0xa')](function(_0x5aef8a){logger[_0xa757('0xb')](_0xa757('0xc'),_0x53be0e,_0xa757('0xd'));logger[_0xa757('0xe')](_0xa757('0xf'),_0x53be0e,_0xa757('0xd'),JSON[_0xa757('0x10')](_0x5aef8a));if(_0x5aef8a['error']){if(_0x5aef8a['error']['code']===0x1f4){logger['error']('IntegrationReport,\x20%s,\x20%s',_0x53be0e,_0x5aef8a[_0xa757('0x11')]['message']);return _0x447344(_0x5aef8a['error'][_0xa757('0x12')]);}logger['error']('IntegrationReport,\x20%s,\x20%s',_0x53be0e,_0x5aef8a[_0xa757('0x11')][_0xa757('0x12')]);return _0x2f7793(_0x5aef8a[_0xa757('0x11')][_0xa757('0x12')]);}else{logger[_0xa757('0xb')](_0xa757('0xc'),_0x53be0e,_0xa757('0xd'));_0x2f7793(_0x5aef8a[_0xa757('0x13')][_0xa757('0x12')]);}})[_0xa757('0x14')](function(_0x50aac1){logger[_0xa757('0x11')](_0xa757('0xc'),_0x53be0e,_0x50aac1);_0x447344(_0x50aac1);});});} \ No newline at end of file diff --git a/server/api/interval/index.js b/server/api/interval/index.js index 1544153..f03e912 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 _0x7217=['multer','path','connect-timeout','express','Router','../../components/auth/service','./interval.controller','get','isAuthenticated','index','/:id','show','/:id/sub_intervals','getIntervals','post','create','addInterval','/:id/sub_intervals/create_many','addIntervals','put','update','destroy','exports'];(function(_0x2df84e,_0x190b5a){var _0x335612=function(_0x22af42){while(--_0x22af42){_0x2df84e['push'](_0x2df84e['shift']());}};_0x335612(++_0x190b5a);}(_0x7217,0x19e));var _0x7721=function(_0x5783f4,_0x4a9e0a){_0x5783f4=_0x5783f4-0x0;var _0x28e380=_0x7217[_0x5783f4];return _0x28e380;};'use strict';var multer=require(_0x7721('0x0'));var util=require('util');var path=require(_0x7721('0x1'));var timeout=require(_0x7721('0x2'));var express=require(_0x7721('0x3'));var router=express[_0x7721('0x4')]();var auth=require(_0x7721('0x5'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x7721('0x6'));router[_0x7721('0x7')]('/',auth[_0x7721('0x8')](),controller[_0x7721('0x9')]);router[_0x7721('0x7')](_0x7721('0xa'),auth[_0x7721('0x8')](),controller[_0x7721('0xb')]);router[_0x7721('0x7')](_0x7721('0xc'),auth[_0x7721('0x8')](),controller[_0x7721('0xd')]);router[_0x7721('0xe')]('/',auth[_0x7721('0x8')](),controller[_0x7721('0xf')]);router['post'](_0x7721('0xc'),auth[_0x7721('0x8')](),controller[_0x7721('0x10')]);router[_0x7721('0xe')](_0x7721('0x11'),auth[_0x7721('0x8')](),controller[_0x7721('0x12')]);router[_0x7721('0x13')]('/:id',auth[_0x7721('0x8')](),controller[_0x7721('0x14')]);router['delete'](_0x7721('0xa'),auth[_0x7721('0x8')](),controller[_0x7721('0x15')]);module[_0x7721('0x16')]=router; \ No newline at end of file +var _0x008c=['express','../../components/auth/service','../../components/interaction/service','../../config/environment','./interval.controller','get','isAuthenticated','index','/:id','show','/:id/sub_intervals','post','addInterval','/:id/sub_intervals/create_many','addIntervals','put','update','exports','multer','util','path','connect-timeout'];(function(_0x4d1371,_0xca6ff7){var _0x37c183=function(_0x1663ae){while(--_0x1663ae){_0x4d1371['push'](_0x4d1371['shift']());}};_0x37c183(++_0xca6ff7);}(_0x008c,0x188));var _0xc008=function(_0x911353,_0x1648ed){_0x911353=_0x911353-0x0;var _0x2f05fa=_0x008c[_0x911353];return _0x2f05fa;};'use strict';var multer=require(_0xc008('0x0'));var util=require(_0xc008('0x1'));var path=require(_0xc008('0x2'));var timeout=require(_0xc008('0x3'));var express=require(_0xc008('0x4'));var router=express['Router']();var auth=require(_0xc008('0x5'));var interaction=require(_0xc008('0x6'));var config=require(_0xc008('0x7'));var controller=require(_0xc008('0x8'));router[_0xc008('0x9')]('/',auth[_0xc008('0xa')](),controller[_0xc008('0xb')]);router[_0xc008('0x9')](_0xc008('0xc'),auth['isAuthenticated'](),controller[_0xc008('0xd')]);router['get'](_0xc008('0xe'),auth['isAuthenticated'](),controller['getIntervals']);router[_0xc008('0xf')]('/',auth[_0xc008('0xa')](),controller['create']);router['post']('/:id/sub_intervals',auth[_0xc008('0xa')](),controller[_0xc008('0x10')]);router['post'](_0xc008('0x11'),auth[_0xc008('0xa')](),controller[_0xc008('0x12')]);router[_0xc008('0x13')](_0xc008('0xc'),auth[_0xc008('0xa')](),controller[_0xc008('0x14')]);router['delete']('/:id',auth[_0xc008('0xa')](),controller['destroy']);module[_0xc008('0x15')]=router; \ No newline at end of file diff --git a/server/api/interval/interval.attributes.js b/server/api/interval/interval.attributes.js index 86e04eb..e48a4ac 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 _0x71e2=['exports','STRING','sequelize'];(function(_0x199572,_0x33e667){var _0x13cfa3=function(_0x53c075){while(--_0x53c075){_0x199572['push'](_0x199572['shift']());}};_0x13cfa3(++_0x33e667);}(_0x71e2,0xc5));var _0x271e=function(_0x38bfc9,_0x5af23e){_0x38bfc9=_0x38bfc9-0x0;var _0x124625=_0x71e2[_0x38bfc9];return _0x124625;};'use strict';var Sequelize=require(_0x271e('0x0'));module[_0x271e('0x1')]={'name':{'type':Sequelize[_0x271e('0x2')]},'description':{'type':Sequelize[_0x271e('0x2')]},'interval':{'type':Sequelize['STRING'],'allowNull':!![]}}; \ No newline at end of file +var _0x1b43=['sequelize','exports','STRING'];(function(_0x5d7aea,_0xf498b9){var _0x3f61c8=function(_0x937752){while(--_0x937752){_0x5d7aea['push'](_0x5d7aea['shift']());}};_0x3f61c8(++_0xf498b9);}(_0x1b43,0xe4));var _0x31b4=function(_0x4ae625,_0xf396d0){_0x4ae625=_0x4ae625-0x0;var _0x31accf=_0x1b43[_0x4ae625];return _0x31accf;};'use strict';var Sequelize=require(_0x31b4('0x0'));module[_0x31b4('0x1')]={'name':{'type':Sequelize[_0x31b4('0x2')]},'description':{'type':Sequelize[_0x31b4('0x2')]},'interval':{'type':Sequelize[_0x31b4('0x2')],'allowNull':!![]}}; \ No newline at end of file diff --git a/server/api/interval/interval.controller.js b/server/api/interval/interval.controller.js index 7048946..290dd77 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 _0x008c=['query','keys','filters','intersection','attributes','fields','length','nolimit','limit','offset','order','sort','pick','where','VIRTUAL','filter','merge','options','Interval','include','findAll','catch','show','params','rawAttributes','includeAll','find','create','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','Intervals','UserProfileSection','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','body','addInterval','getIntervals','findOne','hasOwnProperty','sequelize','IntervalId','bulkCreate','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','crypto','desk.js','papaparse','ioredis','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','../../components/extensions/rewrite','end','status','json','count','set','Content-Range','save','destroy','then','get','UserProfileResource','sendStatus','name','send','map','fieldName','type','key','model'];(function(_0x4f5a01,_0x590de4){var _0x3c882a=function(_0x260482){while(--_0x260482){_0x4f5a01['push'](_0x4f5a01['shift']());}};_0x3c882a(++_0x590de4);}(_0x008c,0x188));var _0xc008=function(_0x32dce6,_0x23f570){_0x32dce6=_0x32dce6-0x0;var _0x1191ba=_0x008c[_0x32dce6];return _0x1191ba;};'use strict';var pdf=require(_0xc008('0x0'));var emlformat=require(_0xc008('0x1'));var rimraf=require(_0xc008('0x2'));var zipdir=require(_0xc008('0x3'));var jsonpatch=require(_0xc008('0x4'));var rp=require('request-promise');var moment=require(_0xc008('0x5'));var BPromise=require(_0xc008('0x6'));var Mustache=require(_0xc008('0x7'));var util=require(_0xc008('0x8'));var path=require(_0xc008('0x9'));var sox=require(_0xc008('0xa'));var csv=require(_0xc008('0xb'));var ejs=require(_0xc008('0xc'));var fs=require('fs');var _=require(_0xc008('0xd'));var squel=require('squel');var crypto=require(_0xc008('0xe'));var jsforce=require('jsforce');var deskjs=require(_0xc008('0xf'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0xc008('0x10'));var Redis=require(_0xc008('0x11'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xc008('0x12'));var logger=require(_0xc008('0x13'))('api');var utils=require(_0xc008('0x14'));var config=require(_0xc008('0x15'));var db=require(_0xc008('0x16'))['db'];var extensions=require(_0xc008('0x17'));function respondWithStatusCode(_0x9ffa93,_0x1819c6){_0x1819c6=_0x1819c6||0xcc;return function(_0x69726e){if(_0x69726e){return _0x9ffa93['sendStatus'](_0x1819c6);}return _0x9ffa93['status'](_0x1819c6)[_0xc008('0x18')]();};}function respondWithResult(_0x50c1ab,_0x25e13f){_0x25e13f=_0x25e13f||0xc8;return function(_0x4584e1){if(_0x4584e1){return _0x50c1ab[_0xc008('0x19')](_0x25e13f)[_0xc008('0x1a')](_0x4584e1);}};}function respondWithFilteredResult(_0x3f0ecf,_0x5ee00b){return function(_0x5e894e){if(_0x5e894e){var _0x4bd0f4=_0x5e894e[_0xc008('0x1b')],_0x11ef38=_0x5ee00b['offset'],_0x15a6ad=_0x5ee00b['offset']+_0x5ee00b['limit'],_0x3cafe3;if(_0x15a6ad>=_0x4bd0f4){_0x15a6ad=_0x4bd0f4;_0x3cafe3=0xc8;}else{_0x3cafe3=0xce;}_0x3f0ecf['status'](_0x3cafe3);return _0x3f0ecf[_0xc008('0x1c')](_0xc008('0x1d'),_0x11ef38+'-'+_0x15a6ad+'/'+_0x4bd0f4)['json'](_0x5e894e);}return null;};}function patchUpdates(_0x813397){return function(_0x5906e6){try{jsonpatch['apply'](_0x5906e6,_0x813397,!![]);}catch(_0x543e5d){return BPromise['reject'](_0x543e5d);}return _0x5906e6[_0xc008('0x1e')]();};}function saveUpdates(_0x4b9726,_0x5560b1){return function(_0x590a71){if(_0x590a71){return _0x590a71['update'](_0x4b9726)['then'](function(_0x13a263){return _0x13a263;});}return null;};}function removeEntity(_0x4777a6,_0x251db2){return function(_0x415af3){if(_0x415af3){return _0x415af3[_0xc008('0x1f')]()[_0xc008('0x20')](function(){var _0x4f43e2=_0x415af3[_0xc008('0x21')]({'plain':!![]});var _0x5c85f2='Intervals';return db[_0xc008('0x22')][_0xc008('0x1f')]({'where':{'type':_0x5c85f2,'resourceId':_0x4f43e2['id']}})[_0xc008('0x20')](function(){return _0x415af3;});})[_0xc008('0x20')](function(){_0x4777a6['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x5de1e9,_0x3f7b07){return function(_0x15dade){if(!_0x15dade){_0x5de1e9[_0xc008('0x23')](0x194);}return _0x15dade;};}function handleError(_0x2e31c2,_0x5bebd9){_0x5bebd9=_0x5bebd9||0x1f4;return function(_0x5e2aca){logger['error'](_0x5e2aca['stack']);if(_0x5e2aca['name']){delete _0x5e2aca[_0xc008('0x24')];}_0x2e31c2[_0xc008('0x19')](_0x5bebd9)[_0xc008('0x25')](_0x5e2aca);};}exports['index']=function(_0x24c14c,_0x32390d){var _0x209591={},_0x2a7d4f={},_0x4c5dec={'count':0x0,'rows':[]};var _0xcdb32b=_[_0xc008('0x26')](db['Interval']['rawAttributes'],function(_0x539766){return{'name':_0x539766[_0xc008('0x27')],'type':_0x539766[_0xc008('0x28')][_0xc008('0x29')]};});_0x2a7d4f[_0xc008('0x2a')]=_[_0xc008('0x26')](_0xcdb32b,_0xc008('0x24'));_0x2a7d4f[_0xc008('0x2b')]=_[_0xc008('0x2c')](_0x24c14c[_0xc008('0x2b')]);_0x2a7d4f[_0xc008('0x2d')]=_[_0xc008('0x2e')](_0x2a7d4f[_0xc008('0x2a')],_0x2a7d4f['query']);_0x209591[_0xc008('0x2f')]=_[_0xc008('0x2e')](_0x2a7d4f['model'],qs[_0xc008('0x30')](_0x24c14c[_0xc008('0x2b')][_0xc008('0x30')]));_0x209591[_0xc008('0x2f')]=_0x209591[_0xc008('0x2f')][_0xc008('0x31')]?_0x209591[_0xc008('0x2f')]:_0x2a7d4f[_0xc008('0x2a')];if(!_0x24c14c[_0xc008('0x2b')]['hasOwnProperty'](_0xc008('0x32'))){_0x209591[_0xc008('0x33')]=qs[_0xc008('0x33')](_0x24c14c[_0xc008('0x2b')][_0xc008('0x33')]);_0x209591[_0xc008('0x34')]=qs[_0xc008('0x34')](_0x24c14c['query'][_0xc008('0x34')]);}_0x209591[_0xc008('0x35')]=qs['sort'](_0x24c14c[_0xc008('0x2b')][_0xc008('0x36')]);_0x209591['where']=qs[_0xc008('0x2d')](_[_0xc008('0x37')](_0x24c14c[_0xc008('0x2b')],_0x2a7d4f['filters']));if(_0x24c14c['query']['filter']){_0x209591[_0xc008('0x38')]=_['merge'](_0x209591[_0xc008('0x38')],{'$or':_[_0xc008('0x26')](_0xcdb32b,function(_0x6a4ccb){if(_0x6a4ccb[_0xc008('0x28')]!==_0xc008('0x39')){var _0xa381d1={};_0xa381d1[_0x6a4ccb[_0xc008('0x24')]]={'$like':'%'+_0x24c14c[_0xc008('0x2b')][_0xc008('0x3a')]+'%'};return _0xa381d1;}})});}_0x209591=_[_0xc008('0x3b')]({},_0x209591,_0x24c14c[_0xc008('0x3c')]);var _0xdfca2e={'where':_0x209591[_0xc008('0x38')]};return db[_0xc008('0x3d')]['count'](_0xdfca2e)[_0xc008('0x20')](function(_0x23c4db){_0x4c5dec[_0xc008('0x1b')]=_0x23c4db;if(_0x24c14c[_0xc008('0x2b')]['includeAll']){_0x209591[_0xc008('0x3e')]=[{'all':!![]}];}return db[_0xc008('0x3d')][_0xc008('0x3f')](_0x209591);})[_0xc008('0x20')](function(_0x2d142d){_0x4c5dec['rows']=_0x2d142d;return _0x4c5dec;})[_0xc008('0x20')](respondWithFilteredResult(_0x32390d,_0x209591))[_0xc008('0x40')](handleError(_0x32390d,null));};exports[_0xc008('0x41')]=function(_0x3e9a99,_0x7279e8){var _0x4f93a4={'raw':!![],'where':{'id':_0x3e9a99[_0xc008('0x42')]['id']}},_0xf4cc4b={};_0xf4cc4b[_0xc008('0x2a')]=_[_0xc008('0x2c')](db['Interval'][_0xc008('0x43')]);_0xf4cc4b[_0xc008('0x2b')]=_[_0xc008('0x2c')](_0x3e9a99['query']);_0xf4cc4b[_0xc008('0x2d')]=_['intersection'](_0xf4cc4b[_0xc008('0x2a')],_0xf4cc4b['query']);_0x4f93a4[_0xc008('0x2f')]=_[_0xc008('0x2e')](_0xf4cc4b['model'],qs[_0xc008('0x30')](_0x3e9a99[_0xc008('0x2b')][_0xc008('0x30')]));_0x4f93a4['attributes']=_0x4f93a4[_0xc008('0x2f')][_0xc008('0x31')]?_0x4f93a4[_0xc008('0x2f')]:_0xf4cc4b[_0xc008('0x2a')];if(_0x3e9a99[_0xc008('0x2b')][_0xc008('0x44')]){_0x4f93a4['include']=[{'all':!![]}];}_0x4f93a4=_['merge']({},_0x4f93a4,_0x3e9a99['options']);return db[_0xc008('0x3d')][_0xc008('0x45')](_0x4f93a4)[_0xc008('0x20')](handleEntityNotFound(_0x7279e8,null))[_0xc008('0x20')](respondWithResult(_0x7279e8,null))[_0xc008('0x40')](handleError(_0x7279e8,null));};exports[_0xc008('0x46')]=function(_0x2cf641,_0x33be4f){return db['Interval']['create'](_0x2cf641['body'],{})[_0xc008('0x20')](function(_0x2651cf){var _0x158eae=_0x2cf641['user'][_0xc008('0x21')]({'plain':!![]});if(!_0x158eae)throw new Error(_0xc008('0x47'));if(_0x158eae[_0xc008('0x48')]===_0xc008('0x49')){var _0x4981b4=_0x2651cf[_0xc008('0x21')]({'plain':!![]});var _0x17ec90=_0xc008('0x4a');return db[_0xc008('0x4b')][_0xc008('0x45')]({'where':{'name':_0x17ec90,'userProfileId':_0x158eae['userProfileId']},'raw':!![]})['then'](function(_0x223056){if(_0x223056&&_0x223056['autoAssociation']===0x0){return db[_0xc008('0x22')][_0xc008('0x46')]({'name':_0x4981b4[_0xc008('0x24')],'resourceId':_0x4981b4['id'],'type':_0x223056['name'],'sectionId':_0x223056['id']},{})[_0xc008('0x20')](function(){return _0x2651cf;});}else{return _0x2651cf;}})[_0xc008('0x40')](function(_0xee64){logger[_0xc008('0x4c')](_0xc008('0x4d'),_0xee64);throw _0xee64;});}return _0x2651cf;})['then'](respondWithResult(_0x33be4f,0xc9))[_0xc008('0x40')](handleError(_0x33be4f,null));};exports[_0xc008('0x4e')]=function(_0x4b4c6d,_0x24f775){if(_0x4b4c6d[_0xc008('0x4f')]['id']){delete _0x4b4c6d['body']['id'];}return db['Interval'][_0xc008('0x45')]({'where':{'id':_0x4b4c6d[_0xc008('0x42')]['id']}})[_0xc008('0x20')](handleEntityNotFound(_0x24f775,null))[_0xc008('0x20')](saveUpdates(_0x4b4c6d[_0xc008('0x4f')],null))['then'](respondWithResult(_0x24f775,null))['catch'](handleError(_0x24f775,null));};exports[_0xc008('0x1f')]=function(_0x5d815d,_0x3d7cce){return db[_0xc008('0x3d')][_0xc008('0x45')]({'where':{'id':_0x5d815d[_0xc008('0x42')]['id']}})[_0xc008('0x20')](handleEntityNotFound(_0x3d7cce,null))[_0xc008('0x20')](removeEntity(_0x3d7cce,null))['catch'](handleError(_0x3d7cce,null));};exports[_0xc008('0x50')]=function(_0xbd7422,_0x9a7abc,_0x2b350c){if(_0xbd7422[_0xc008('0x4f')]['id']){delete _0xbd7422['body']['id'];}return db[_0xc008('0x3d')]['find']({'where':{'id':_0xbd7422['params']['id']}})['then'](handleEntityNotFound(_0x9a7abc,null))[_0xc008('0x20')](function(_0x1bcbb1){if(_0x1bcbb1){_0xbd7422[_0xc008('0x4f')]['IntervalId']=_0x1bcbb1['id'];return db[_0xc008('0x3d')][_0xc008('0x46')](_0xbd7422[_0xc008('0x4f')]);}})['then'](respondWithResult(_0x9a7abc,null))[_0xc008('0x40')](handleError(_0x9a7abc,null));};exports[_0xc008('0x51')]=function(_0x12ba3f,_0x1b5a22,_0x5baff1){var _0x4022dd={};var _0x4eaa6d={};var _0x23ef33;var _0x422e1f;return db[_0xc008('0x3d')][_0xc008('0x52')]({'where':{'id':_0x12ba3f[_0xc008('0x42')]['id']}})[_0xc008('0x20')](handleEntityNotFound(_0x1b5a22,null))['then'](function(_0x375e71){if(_0x375e71){_0x23ef33=_0x375e71;_0x4eaa6d['model']=_['keys'](db[_0xc008('0x3d')][_0xc008('0x43')]);_0x4eaa6d['query']=_[_0xc008('0x2c')](_0x12ba3f[_0xc008('0x2b')]);_0x4eaa6d[_0xc008('0x2d')]=_[_0xc008('0x2e')](_0x4eaa6d[_0xc008('0x2a')],_0x4eaa6d[_0xc008('0x2b')]);_0x4022dd[_0xc008('0x2f')]=_['intersection'](_0x4eaa6d[_0xc008('0x2a')],qs[_0xc008('0x30')](_0x12ba3f[_0xc008('0x2b')][_0xc008('0x30')]));_0x4022dd[_0xc008('0x2f')]=_0x4022dd[_0xc008('0x2f')][_0xc008('0x31')]?_0x4022dd[_0xc008('0x2f')]:_0x4eaa6d[_0xc008('0x2a')];_0x4022dd[_0xc008('0x35')]=qs[_0xc008('0x36')](_0x12ba3f[_0xc008('0x2b')][_0xc008('0x36')]);_0x4022dd[_0xc008('0x38')]=qs['filters'](_[_0xc008('0x37')](_0x12ba3f[_0xc008('0x2b')],_0x4eaa6d[_0xc008('0x2d')]));if(_0x12ba3f['query'][_0xc008('0x3a')]){_0x4022dd[_0xc008('0x38')]=_['merge'](_0x4022dd['where'],{'$or':_[_0xc008('0x26')](_0x4022dd[_0xc008('0x2f')],function(_0x7bad14){var _0x39083c={};_0x39083c[_0x7bad14]={'$like':'%'+_0x12ba3f[_0xc008('0x2b')][_0xc008('0x3a')]+'%'};return _0x39083c;})});}_0x4022dd=_[_0xc008('0x3b')]({},_0x4022dd,_0x12ba3f[_0xc008('0x3c')]);return _0x23ef33[_0xc008('0x51')](_0x4022dd);}})[_0xc008('0x20')](function(_0x383325){if(_0x383325){_0x422e1f=_0x383325['length'];if(!_0x12ba3f[_0xc008('0x2b')][_0xc008('0x53')](_0xc008('0x32'))){_0x4022dd[_0xc008('0x33')]=qs['limit'](_0x12ba3f[_0xc008('0x2b')]['limit']);_0x4022dd[_0xc008('0x34')]=qs[_0xc008('0x34')](_0x12ba3f[_0xc008('0x2b')]['offset']);}return _0x23ef33[_0xc008('0x51')](_0x4022dd);}})[_0xc008('0x20')](function(_0xa80000){if(_0xa80000){return _0xa80000?{'count':_0x422e1f,'rows':_0xa80000}:null;}})['then'](respondWithResult(_0x1b5a22,null))[_0xc008('0x40')](handleError(_0x1b5a22,null));};exports['addIntervals']=function(_0x50ee03,_0xee7a85,_0x23012c){return db[_0xc008('0x3d')][_0xc008('0x52')]({'where':{'id':_0x50ee03['params']['id']}})[_0xc008('0x20')](handleEntityNotFound(_0xee7a85,null))[_0xc008('0x20')](function(_0x49493b){if(_0x49493b){return db[_0xc008('0x54')]['transaction'](function(_0x278cbe){return db['Interval'][_0xc008('0x1f')]({'where':{'IntervalId':_0x50ee03['params']['id']},'transaction':_0x278cbe})[_0xc008('0x20')](function(_0x103d75){var _0x33d8e4=_[_0xc008('0x26')](_0x50ee03['body'],function(_0x57752c){delete _0x57752c['id'];_0x57752c[_0xc008('0x55')]=_0x50ee03[_0xc008('0x42')]['id'];return _0x57752c;});return db[_0xc008('0x3d')][_0xc008('0x56')](_0x33d8e4,{'transaction':_0x278cbe});});})[_0xc008('0x20')](function(){return db[_0xc008('0x3d')][_0xc008('0x3f')]({'where':{'IntervalId':_0x50ee03['params']['id']}});});}})[_0xc008('0x20')](respondWithResult(_0xee7a85,null))['catch'](handleError(_0xee7a85,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(_0x5117ee,_0x38ee65){var _0x100654=function(_0x462778){while(--_0x462778){_0x5117ee['push'](_0x5117ee['shift']());}};_0x100654(++_0x38ee65);}(_0x9c44,0x178));var _0x49c4=function(_0x5f09c5,_0x2bfca0){_0x5f09c5=_0x5f09c5-0x0;var _0x426ad9=_0x9c44[_0x5f09c5];return _0x426ad9;};'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 7433a64..d6f3a45 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 _0x0eaa=['bluebird','path','rimraf','../../config/environment','./interval.attributes','../../components/extensions/rewrite','Interval','tools_intervals','rewrite','lodash','util','moment'];(function(_0xac151d,_0x4ea1d2){var _0x111dba=function(_0x13d7f4){while(--_0x13d7f4){_0xac151d['push'](_0xac151d['shift']());}};_0x111dba(++_0x4ea1d2);}(_0x0eaa,0x1c5));var _0xa0ea=function(_0x324177,_0x129938){_0x324177=_0x324177-0x0;var _0x15a88c=_0x0eaa[_0x324177];return _0x15a88c;};'use strict';var _=require(_0xa0ea('0x0'));var util=require(_0xa0ea('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0xa0ea('0x2'));var BPromise=require(_0xa0ea('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xa0ea('0x4'));var rimraf=require(_0xa0ea('0x5'));var config=require(_0xa0ea('0x6'));var attributes=require(_0xa0ea('0x7'));var extensions=require(_0xa0ea('0x8'));module['exports']=function(_0x3c6586,_0x521881){return _0x3c6586['define'](_0xa0ea('0x9'),attributes,{'tableName':_0xa0ea('0xa'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'afterCreate':function(_0x5b2adc,_0x4dbe00){extensions[_0xa0ea('0xb')](_0x3c6586,_0x5b2adc);},'afterBulkCreate':function(_0x2746f2,_0x28cd6d,_0x309f0b){_0x309f0b();extensions[_0xa0ea('0xb')](_0x3c6586,_0x2746f2[0x0]);},'afterUpdate':function(_0x5ec608,_0x38b2f0){extensions[_0xa0ea('0xb')](_0x3c6586,_0x5ec608);},'afterDestroy':function(_0x33572c,_0x2ff061){extensions['rewrite'](_0x3c6586,_0x33572c);}}});}; \ No newline at end of file +var _0xabd8=['path','rimraf','../../config/environment','./interval.attributes','../../components/extensions/rewrite','exports','define','Interval','tools_intervals','rewrite','api','moment','bluebird'];(function(_0xc66af2,_0x14f6d8){var _0x38d439=function(_0x544ab8){while(--_0x544ab8){_0xc66af2['push'](_0xc66af2['shift']());}};_0x38d439(++_0x14f6d8);}(_0xabd8,0x142));var _0x8abd=function(_0x43fdf8,_0x8426b3){_0x43fdf8=_0x43fdf8-0x0;var _0x1160c6=_0xabd8[_0x43fdf8];return _0x1160c6;};'use strict';var _=require('lodash');var util=require('util');var logger=require('../../config/logger')(_0x8abd('0x0'));var moment=require(_0x8abd('0x1'));var BPromise=require(_0x8abd('0x2'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x8abd('0x3'));var rimraf=require(_0x8abd('0x4'));var config=require(_0x8abd('0x5'));var attributes=require(_0x8abd('0x6'));var extensions=require(_0x8abd('0x7'));module[_0x8abd('0x8')]=function(_0x2907b1,_0x7e8824){return _0x2907b1[_0x8abd('0x9')](_0x8abd('0xa'),attributes,{'tableName':_0x8abd('0xb'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'afterCreate':function(_0x7c4bd0,_0x324d79){extensions['rewrite'](_0x2907b1,_0x7c4bd0);},'afterBulkCreate':function(_0x30d682,_0x2bd76d,_0x343ecb){_0x343ecb();extensions[_0x8abd('0xc')](_0x2907b1,_0x30d682[0x0]);},'afterUpdate':function(_0x2366b3,_0x3b3492){extensions[_0x8abd('0xc')](_0x2907b1,_0x2366b3);},'afterDestroy':function(_0x3907ec,_0x14c8f6){extensions[_0x8abd('0xc')](_0x2907b1,_0x3907ec);}}});}; \ No newline at end of file diff --git a/server/api/interval/interval.rpc.js b/server/api/interval/interval.rpc.js index e024056..acacc66 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 _0x9261=['request','then','Interval,\x20%s,\x20%s','request\x20sent','debug','Interval,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','Interval','findAll','options','raw','where','attributes','limit','map','include','model','GetInterval','ShowInterval','find','catch','util','moment','randomstring','../../mysqldb','../../config/utils','client','http'];(function(_0x3c157f,_0x25bb5b){var _0x2dbe37=function(_0x409dc2){while(--_0x409dc2){_0x3c157f['push'](_0x3c157f['shift']());}};_0x2dbe37(++_0x25bb5b);}(_0x9261,0x164));var _0x1926=function(_0x187718,_0x427383){_0x187718=_0x187718-0x0;var _0x29ddf4=_0x9261[_0x187718];return _0x29ddf4;};'use strict';var _=require('lodash');var util=require(_0x1926('0x0'));var moment=require(_0x1926('0x1'));var BPromise=require('bluebird');var rs=require(_0x1926('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x1926('0x3'))['db'];var utils=require(_0x1926('0x4'));var logger=require('../../config/logger')('rpc');var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x1926('0x5')][_0x1926('0x6')]({'port':0x232a});function respondWithRpcPromise(_0x59476f,_0x57ca9a,_0x401827){return new BPromise(function(_0x1c647e,_0x5c0ffb){return client[_0x1926('0x7')](_0x59476f,_0x401827)[_0x1926('0x8')](function(_0x868c71){logger['info'](_0x1926('0x9'),_0x57ca9a,_0x1926('0xa'));logger[_0x1926('0xb')](_0x1926('0xc'),_0x57ca9a,'request\x20sent',JSON[_0x1926('0xd')](_0x868c71));if(_0x868c71['error']){if(_0x868c71[_0x1926('0xe')][_0x1926('0xf')]===0x1f4){logger['error'](_0x1926('0x9'),_0x57ca9a,_0x868c71[_0x1926('0xe')][_0x1926('0x10')]);return _0x5c0ffb(_0x868c71[_0x1926('0xe')][_0x1926('0x10')]);}logger['error']('Interval,\x20%s,\x20%s',_0x57ca9a,_0x868c71[_0x1926('0xe')]['message']);return _0x1c647e(_0x868c71[_0x1926('0xe')][_0x1926('0x10')]);}else{logger[_0x1926('0x11')](_0x1926('0x9'),_0x57ca9a,_0x1926('0xa'));_0x1c647e(_0x868c71[_0x1926('0x12')]['message']);}})['catch'](function(_0x579598){logger[_0x1926('0xe')](_0x1926('0x9'),_0x57ca9a,_0x579598);_0x5c0ffb(_0x579598);});});}exports['GetInterval']=function(_0x28b883){var _0x16a28d=this;return new Promise(function(_0x22e05c,_0x28dc6b){return db[_0x1926('0x13')][_0x1926('0x14')]({'raw':_0x28b883[_0x1926('0x15')]?_0x28b883[_0x1926('0x15')][_0x1926('0x16')]===undefined?!![]:![]:!![],'where':_0x28b883[_0x1926('0x15')]?_0x28b883[_0x1926('0x15')][_0x1926('0x17')]||null:null,'attributes':_0x28b883['options']?_0x28b883['options'][_0x1926('0x18')]||null:null,'limit':_0x28b883[_0x1926('0x15')]?_0x28b883[_0x1926('0x15')][_0x1926('0x19')]||null:null,'include':_0x28b883['options']?_0x28b883[_0x1926('0x15')]['include']?_[_0x1926('0x1a')](_0x28b883['options'][_0x1926('0x1b')],function(_0x53076a){return{'model':db[_0x53076a[_0x1926('0x1c')]],'as':_0x53076a['as'],'attributes':_0x53076a['attributes'],'include':_0x53076a[_0x1926('0x1b')]?_[_0x1926('0x1a')](_0x53076a[_0x1926('0x1b')],function(_0x1f812f){return{'model':db[_0x1f812f[_0x1926('0x1c')]],'as':_0x1f812f['as'],'attributes':_0x1f812f[_0x1926('0x18')],'include':_0x1f812f[_0x1926('0x1b')]?_['map'](_0x1f812f[_0x1926('0x1b')],function(_0x5f5d4e){return{'model':db[_0x5f5d4e[_0x1926('0x1c')]],'as':_0x5f5d4e['as'],'attributes':_0x5f5d4e[_0x1926('0x18')]};}):[]};}):[]};}):[]:[]})[_0x1926('0x8')](function(_0x1d47e0){logger[_0x1926('0x11')](_0x1926('0x1d'),_0x28b883);logger[_0x1926('0xb')]('GetInterval',_0x28b883,JSON['stringify'](_0x1d47e0));_0x22e05c(_0x1d47e0);})['catch'](function(_0x5e9972){logger[_0x1926('0xe')](_0x1926('0x1d'),_0x5e9972['message'],_0x28b883);_0x28dc6b(_0x16a28d[_0x1926('0xe')](0x1f4,_0x5e9972[_0x1926('0x10')]));});});};exports[_0x1926('0x1e')]=function(_0x4e7908){var _0x1209cd=this;return new Promise(function(_0x408d85,_0x534675){return db[_0x1926('0x13')][_0x1926('0x1f')]({'raw':_0x4e7908[_0x1926('0x15')]?_0x4e7908[_0x1926('0x15')]['raw']===undefined?!![]:![]:!![],'where':_0x4e7908[_0x1926('0x15')]?_0x4e7908[_0x1926('0x15')][_0x1926('0x17')]||null:null,'attributes':_0x4e7908['options']?_0x4e7908['options']['attributes']||null:null,'include':_0x4e7908[_0x1926('0x15')]?_0x4e7908[_0x1926('0x15')][_0x1926('0x1b')]?_[_0x1926('0x1a')](_0x4e7908[_0x1926('0x15')]['include'],function(_0x523e8f){return{'model':db[_0x523e8f[_0x1926('0x1c')]],'as':_0x523e8f['as'],'attributes':_0x523e8f[_0x1926('0x18')],'include':_0x523e8f['include']?_[_0x1926('0x1a')](_0x523e8f['include'],function(_0x2178b4){return{'model':db[_0x2178b4[_0x1926('0x1c')]],'as':_0x2178b4['as'],'attributes':_0x2178b4[_0x1926('0x18')],'include':_0x2178b4[_0x1926('0x1b')]?_[_0x1926('0x1a')](_0x2178b4['include'],function(_0x46dcad){return{'model':db[_0x46dcad['model']],'as':_0x46dcad['as'],'attributes':_0x46dcad[_0x1926('0x18')]};}):[]};}):[]};}):[]:[]})[_0x1926('0x8')](function(_0x3105f7){logger[_0x1926('0x11')](_0x1926('0x1e'),_0x4e7908);logger[_0x1926('0xb')](_0x1926('0x1e'),_0x4e7908,JSON[_0x1926('0xd')](_0x3105f7));_0x408d85(_0x3105f7);})[_0x1926('0x20')](function(_0x2ee1a8){logger['error'](_0x1926('0x1e'),_0x2ee1a8[_0x1926('0x10')],_0x4e7908);_0x534675(_0x1209cd['error'](0x1f4,_0x2ee1a8[_0x1926('0x10')]));});});}; \ No newline at end of file +var _0x9653=['jayson/promise','client','http','request','then','info','Interval,\x20%s,\x20%s','request\x20sent','debug','stringify','error','message','result','catch','GetInterval','Interval','findAll','options','raw','attributes','limit','include','map','model','ShowInterval','where','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment'];(function(_0x1cdada,_0x4553ff){var _0x2ee6ef=function(_0x55c076){while(--_0x55c076){_0x1cdada['push'](_0x1cdada['shift']());}};_0x2ee6ef(++_0x4553ff);}(_0x9653,0x1ee));var _0x3965=function(_0x42642f,_0x16a458){_0x42642f=_0x42642f-0x0;var _0x57c5e8=_0x9653[_0x42642f];return _0x57c5e8;};'use strict';var _=require(_0x3965('0x0'));var util=require(_0x3965('0x1'));var moment=require(_0x3965('0x2'));var BPromise=require(_0x3965('0x3'));var rs=require(_0x3965('0x4'));var fs=require('fs');var Redis=require(_0x3965('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x3965('0x6'));var logger=require(_0x3965('0x7'))(_0x3965('0x8'));var config=require(_0x3965('0x9'));var jayson=require(_0x3965('0xa'));var client=jayson[_0x3965('0xb')][_0x3965('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x146f2a,_0x3ba0e8,_0x5e8cef){return new BPromise(function(_0x40e98b,_0x1620bd){return client[_0x3965('0xd')](_0x146f2a,_0x5e8cef)[_0x3965('0xe')](function(_0x120a5f){logger[_0x3965('0xf')](_0x3965('0x10'),_0x3ba0e8,_0x3965('0x11'));logger[_0x3965('0x12')]('Interval,\x20%s,\x20%s,\x20%s',_0x3ba0e8,'request\x20sent',JSON[_0x3965('0x13')](_0x120a5f));if(_0x120a5f['error']){if(_0x120a5f['error']['code']===0x1f4){logger[_0x3965('0x14')]('Interval,\x20%s,\x20%s',_0x3ba0e8,_0x120a5f['error'][_0x3965('0x15')]);return _0x1620bd(_0x120a5f[_0x3965('0x14')]['message']);}logger[_0x3965('0x14')]('Interval,\x20%s,\x20%s',_0x3ba0e8,_0x120a5f[_0x3965('0x14')][_0x3965('0x15')]);return _0x40e98b(_0x120a5f[_0x3965('0x14')][_0x3965('0x15')]);}else{logger[_0x3965('0xf')](_0x3965('0x10'),_0x3ba0e8,_0x3965('0x11'));_0x40e98b(_0x120a5f[_0x3965('0x16')][_0x3965('0x15')]);}})[_0x3965('0x17')](function(_0x4c8036){logger[_0x3965('0x14')]('Interval,\x20%s,\x20%s',_0x3ba0e8,_0x4c8036);_0x1620bd(_0x4c8036);});});}exports[_0x3965('0x18')]=function(_0x367374){var _0x1f4cb8=this;return new Promise(function(_0x47d703,_0x3eccb5){return db[_0x3965('0x19')][_0x3965('0x1a')]({'raw':_0x367374[_0x3965('0x1b')]?_0x367374['options'][_0x3965('0x1c')]===undefined?!![]:![]:!![],'where':_0x367374[_0x3965('0x1b')]?_0x367374[_0x3965('0x1b')]['where']||null:null,'attributes':_0x367374[_0x3965('0x1b')]?_0x367374['options'][_0x3965('0x1d')]||null:null,'limit':_0x367374[_0x3965('0x1b')]?_0x367374['options'][_0x3965('0x1e')]||null:null,'include':_0x367374[_0x3965('0x1b')]?_0x367374[_0x3965('0x1b')][_0x3965('0x1f')]?_[_0x3965('0x20')](_0x367374[_0x3965('0x1b')][_0x3965('0x1f')],function(_0xb51850){return{'model':db[_0xb51850[_0x3965('0x21')]],'as':_0xb51850['as'],'attributes':_0xb51850[_0x3965('0x1d')],'include':_0xb51850[_0x3965('0x1f')]?_['map'](_0xb51850[_0x3965('0x1f')],function(_0x19ddaf){return{'model':db[_0x19ddaf[_0x3965('0x21')]],'as':_0x19ddaf['as'],'attributes':_0x19ddaf[_0x3965('0x1d')],'include':_0x19ddaf[_0x3965('0x1f')]?_[_0x3965('0x20')](_0x19ddaf['include'],function(_0x837e55){return{'model':db[_0x837e55[_0x3965('0x21')]],'as':_0x837e55['as'],'attributes':_0x837e55[_0x3965('0x1d')]};}):[]};}):[]};}):[]:[]})[_0x3965('0xe')](function(_0x14bd17){logger['info']('GetInterval',_0x367374);logger[_0x3965('0x12')](_0x3965('0x18'),_0x367374,JSON[_0x3965('0x13')](_0x14bd17));_0x47d703(_0x14bd17);})[_0x3965('0x17')](function(_0x29ca36){logger[_0x3965('0x14')]('GetInterval',_0x29ca36[_0x3965('0x15')],_0x367374);_0x3eccb5(_0x1f4cb8[_0x3965('0x14')](0x1f4,_0x29ca36[_0x3965('0x15')]));});});};exports[_0x3965('0x22')]=function(_0x424181){var _0x1101b7=this;return new Promise(function(_0x93eb35,_0x12d726){return db[_0x3965('0x19')]['find']({'raw':_0x424181[_0x3965('0x1b')]?_0x424181[_0x3965('0x1b')][_0x3965('0x1c')]===undefined?!![]:![]:!![],'where':_0x424181[_0x3965('0x1b')]?_0x424181[_0x3965('0x1b')][_0x3965('0x23')]||null:null,'attributes':_0x424181[_0x3965('0x1b')]?_0x424181['options'][_0x3965('0x1d')]||null:null,'include':_0x424181[_0x3965('0x1b')]?_0x424181['options'][_0x3965('0x1f')]?_[_0x3965('0x20')](_0x424181[_0x3965('0x1b')][_0x3965('0x1f')],function(_0x2675b6){return{'model':db[_0x2675b6[_0x3965('0x21')]],'as':_0x2675b6['as'],'attributes':_0x2675b6[_0x3965('0x1d')],'include':_0x2675b6[_0x3965('0x1f')]?_[_0x3965('0x20')](_0x2675b6[_0x3965('0x1f')],function(_0x1ea68f){return{'model':db[_0x1ea68f[_0x3965('0x21')]],'as':_0x1ea68f['as'],'attributes':_0x1ea68f[_0x3965('0x1d')],'include':_0x1ea68f[_0x3965('0x1f')]?_['map'](_0x1ea68f[_0x3965('0x1f')],function(_0xfa2811){return{'model':db[_0xfa2811['model']],'as':_0xfa2811['as'],'attributes':_0xfa2811['attributes']};}):[]};}):[]};}):[]:[]})[_0x3965('0xe')](function(_0x417706){logger['info'](_0x3965('0x22'),_0x424181);logger[_0x3965('0x12')](_0x3965('0x22'),_0x424181,JSON[_0x3965('0x13')](_0x417706));_0x93eb35(_0x417706);})[_0x3965('0x17')](function(_0x32c497){logger[_0x3965('0x14')]('ShowInterval',_0x32c497[_0x3965('0x15')],_0x424181);_0x12d726(_0x1101b7[_0x3965('0x14')](0x1f4,_0x32c497[_0x3965('0x15')]));});});}; \ No newline at end of file diff --git a/server/api/jira/index.js b/server/api/jira/index.js index c91cca2..e0b8843 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 _0x94ba=['../../components/auth/service','./jira.controller','post','send','express','Router'];(function(_0x254727,_0x15d291){var _0x1bf51b=function(_0x4d5fd7){while(--_0x4d5fd7){_0x254727['push'](_0x254727['shift']());}};_0x1bf51b(++_0x15d291);}(_0x94ba,0xbe));var _0xa94b=function(_0x10bcb7,_0x518c99){_0x10bcb7=_0x10bcb7-0x0;var _0x3c1b3b=_0x94ba[_0x10bcb7];return _0x3c1b3b;};'use strict';var express=require(_0xa94b('0x0'));var router=express[_0xa94b('0x1')]();var auth=require(_0xa94b('0x2'));var controller=require(_0xa94b('0x3'));router[_0xa94b('0x4')]('/',auth['isAuthenticated'](),controller[_0xa94b('0x5')]);module['exports']=router; \ No newline at end of file +var _0xdfe8=['express','Router','../../components/auth/service','./jira.controller','isAuthenticated','send'];(function(_0x490abb,_0x2c928d){var _0x1de327=function(_0x113bfe){while(--_0x113bfe){_0x490abb['push'](_0x490abb['shift']());}};_0x1de327(++_0x2c928d);}(_0xdfe8,0x12c));var _0x8dfe=function(_0x4b7b69,_0x3ab075){_0x4b7b69=_0x4b7b69-0x0;var _0x173b4c=_0xdfe8[_0x4b7b69];return _0x173b4c;};'use strict';var express=require(_0x8dfe('0x0'));var router=express[_0x8dfe('0x1')]();var auth=require(_0x8dfe('0x2'));var controller=require(_0x8dfe('0x3'));router['post']('/',auth[_0x8dfe('0x4')](),controller[_0x8dfe('0x5')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/jira/jira.controller.js b/server/api/jira/jira.controller.js index cb3a5d8..eba38b2 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 _0xc189=['remoteAddress','body','bluebird','https','api','support','3eAmWpBVP0','MOTGUI','summary','\x20from\x20','description','stringify','issuetype','Bug','fields','customfield_11500','email','customfield_11502','newToken','customfield_11504','reason','customfield_10102','track.xcallymotion.com','POST','application/json','Basic\x20','toString','base64','request','setEncoding','utf8','data','end','status','statusCode','json','error','Error\x20during\x20license\x20request.\x20Please\x20contact\x20our\x20license\x20team\x20at\x20license@xcally.com\x20with\x20your\x20request','api.jira','write','send','x-forwarded-for','connection','socket'];(function(_0x35da42,_0x5c2610){var _0x370035=function(_0x546db5){while(--_0x546db5){_0x35da42['push'](_0x35da42['shift']());}};_0x370035(++_0x5c2610);}(_0xc189,0xde));var _0x9c18=function(_0x4853fc,_0x52cd55){_0x4853fc=_0x4853fc-0x0;var _0x23be73=_0xc189[_0x4853fc];return _0x23be73;};'use strict';var BPromise=require(_0x9c18('0x0'));var https=require(_0x9c18('0x1'));var logger=require('../../config/logger')(_0x9c18('0x2'));var USERNAME=_0x9c18('0x3');var PASSWORD=_0x9c18('0x4');function openIssue(_0x4985e4,_0x132972){var _0x2a1ad8={'fields':{'project':{'key':_0x4985e4['key']||_0x9c18('0x5')},'summary':(_0x4985e4[_0x9c18('0x6')]||'Report')+_0x9c18('0x7')+_0x4985e4['ip'],'description':_0x4985e4[_0x9c18('0x8')]||JSON[_0x9c18('0x9')](_0x4985e4),'issuetype':{'name':_0x4985e4[_0x9c18('0xa')]||_0x9c18('0xb')}}};_0x2a1ad8[_0x9c18('0xc')][_0x9c18('0xd')]=_0x4985e4[_0x9c18('0xe')];_0x2a1ad8[_0x9c18('0xc')]['customfield_11501']=_0x4985e4['oldToken'];_0x2a1ad8[_0x9c18('0xc')][_0x9c18('0xf')]=_0x4985e4[_0x9c18('0x10')];_0x2a1ad8[_0x9c18('0xc')]['customfield_11503']=_0x4985e4['name'];_0x2a1ad8['fields'][_0x9c18('0x11')]=_0x4985e4[_0x9c18('0x12')];_0x2a1ad8['fields'][_0x9c18('0x13')]=_0x4985e4['ip'];var _0x441793={'host':_0x9c18('0x14'),'port':0x1bb,'path':'/rest/api/2/issue','method':_0x9c18('0x15'),'timeout':0x4e20,'headers':{'Content-Type':_0x9c18('0x16'),'Authorization':_0x9c18('0x17')+new Buffer(USERNAME+':'+PASSWORD)[_0x9c18('0x18')](_0x9c18('0x19'))}};var _0x3ccb8b=JSON[_0x9c18('0x9')](_0x2a1ad8);var _0x182ce8=https[_0x9c18('0x1a')](_0x441793,function(_0x19b64e){_0x19b64e[_0x9c18('0x1b')](_0x9c18('0x1c'));var _0x240312='';_0x19b64e['on'](_0x9c18('0x1d'),function(_0x49bcdf){_0x240312+=_0x49bcdf;});_0x19b64e['on'](_0x9c18('0x1e'),function(){if(_0x132972){return _0x132972[_0x9c18('0x1f')](_0x19b64e[_0x9c18('0x20')])[_0x9c18('0x21')](JSON['parse'](_0x240312));}});});_0x182ce8['on'](_0x9c18('0x22'),function(_0x17e3d8){if(_0x132972){return _0x132972[_0x9c18('0x1f')](0x1f4)[_0x9c18('0x21')]({'errors':[{'message':_0x9c18('0x23'),'type':_0x9c18('0x24')}]});}});_0x182ce8[_0x9c18('0x25')](_0x3ccb8b);_0x182ce8[_0x9c18('0x1e')]();}exports['openIssue']=openIssue;exports[_0x9c18('0x26')]=function(_0x279285,_0x4b2c5e){_0x279285['body']['ip']=_0x279285['headers'][_0x9c18('0x27')]||_0x279285[_0x9c18('0x28')]['remoteAddress']||_0x279285[_0x9c18('0x29')][_0x9c18('0x2a')]||_0x279285[_0x9c18('0x28')]['socket'][_0x9c18('0x2a')];return openIssue(_0x279285[_0x9c18('0x2b')],_0x4b2c5e);}; \ No newline at end of file +var _0xfc91=['customfield_11501','oldToken','customfield_11502','newToken','customfield_11503','customfield_11504','reason','customfield_10102','track.xcallymotion.com','/rest/api/2/issue','POST','application/json','toString','base64','setEncoding','utf8','data','status','statusCode','json','parse','error','Error\x20during\x20license\x20request.\x20Please\x20contact\x20our\x20license\x20team\x20at\x20license@xcally.com\x20with\x20your\x20request','write','openIssue','send','body','headers','x-forwarded-for','remoteAddress','socket','connection','bluebird','https','api','support','MOTGUI','Report','\x20from\x20','description','stringify','issuetype','customfield_11500','fields'];(function(_0x5e49b4,_0x3739ba){var _0x17a9f8=function(_0x4c032d){while(--_0x4c032d){_0x5e49b4['push'](_0x5e49b4['shift']());}};_0x17a9f8(++_0x3739ba);}(_0xfc91,0x154));var _0x1fc9=function(_0x46e02c,_0x498ea5){_0x46e02c=_0x46e02c-0x0;var _0x5d30e8=_0xfc91[_0x46e02c];return _0x5d30e8;};'use strict';var BPromise=require(_0x1fc9('0x0'));var https=require(_0x1fc9('0x1'));var logger=require('../../config/logger')(_0x1fc9('0x2'));var USERNAME=_0x1fc9('0x3');var PASSWORD='3eAmWpBVP0';function openIssue(_0x10613c,_0x1b439e){var _0x22aef2={'fields':{'project':{'key':_0x10613c['key']||_0x1fc9('0x4')},'summary':(_0x10613c['summary']||_0x1fc9('0x5'))+_0x1fc9('0x6')+_0x10613c['ip'],'description':_0x10613c[_0x1fc9('0x7')]||JSON[_0x1fc9('0x8')](_0x10613c),'issuetype':{'name':_0x10613c[_0x1fc9('0x9')]||'Bug'}}};_0x22aef2['fields'][_0x1fc9('0xa')]=_0x10613c['email'];_0x22aef2[_0x1fc9('0xb')][_0x1fc9('0xc')]=_0x10613c[_0x1fc9('0xd')];_0x22aef2[_0x1fc9('0xb')][_0x1fc9('0xe')]=_0x10613c[_0x1fc9('0xf')];_0x22aef2[_0x1fc9('0xb')][_0x1fc9('0x10')]=_0x10613c['name'];_0x22aef2[_0x1fc9('0xb')][_0x1fc9('0x11')]=_0x10613c[_0x1fc9('0x12')];_0x22aef2[_0x1fc9('0xb')][_0x1fc9('0x13')]=_0x10613c['ip'];var _0x2dcd2f={'host':_0x1fc9('0x14'),'port':0x1bb,'path':_0x1fc9('0x15'),'method':_0x1fc9('0x16'),'timeout':0x4e20,'headers':{'Content-Type':_0x1fc9('0x17'),'Authorization':'Basic\x20'+new Buffer(USERNAME+':'+PASSWORD)[_0x1fc9('0x18')](_0x1fc9('0x19'))}};var _0x49c8ac=JSON[_0x1fc9('0x8')](_0x22aef2);var _0x2d775c=https['request'](_0x2dcd2f,function(_0x3dc05e){_0x3dc05e[_0x1fc9('0x1a')](_0x1fc9('0x1b'));var _0x1dcf24='';_0x3dc05e['on'](_0x1fc9('0x1c'),function(_0x1a61f1){_0x1dcf24+=_0x1a61f1;});_0x3dc05e['on']('end',function(){if(_0x1b439e){return _0x1b439e[_0x1fc9('0x1d')](_0x3dc05e[_0x1fc9('0x1e')])[_0x1fc9('0x1f')](JSON[_0x1fc9('0x20')](_0x1dcf24));}});});_0x2d775c['on'](_0x1fc9('0x21'),function(_0x27946b){if(_0x1b439e){return _0x1b439e[_0x1fc9('0x1d')](0x1f4)[_0x1fc9('0x1f')]({'errors':[{'message':_0x1fc9('0x22'),'type':'api.jira'}]});}});_0x2d775c[_0x1fc9('0x23')](_0x49c8ac);_0x2d775c['end']();}exports[_0x1fc9('0x24')]=openIssue;exports[_0x1fc9('0x25')]=function(_0x16bb0a,_0x5a5d0b){_0x16bb0a[_0x1fc9('0x26')]['ip']=_0x16bb0a[_0x1fc9('0x27')][_0x1fc9('0x28')]||_0x16bb0a['connection'][_0x1fc9('0x29')]||_0x16bb0a[_0x1fc9('0x2a')]['remoteAddress']||_0x16bb0a[_0x1fc9('0x2b')][_0x1fc9('0x2a')][_0x1fc9('0x29')];return openIssue(_0x16bb0a[_0x1fc9('0x26')],_0x5a5d0b);}; \ No newline at end of file diff --git a/server/api/jscriptyAnswerReport/index.js b/server/api/jscriptyAnswerReport/index.js index 40d1ed9..0a3422a 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 _0x50bf=['show','post','create','update','/:id','exports','multer','util','path','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','isAuthenticated','index','/describe','describe','get'];(function(_0x5c33bd,_0x162be2){var _0xbf6a0c=function(_0x11f76c){while(--_0x11f76c){_0x5c33bd['push'](_0x5c33bd['shift']());}};_0xbf6a0c(++_0x162be2);}(_0x50bf,0x182));var _0xf50b=function(_0x3ca63f,_0x1bb121){_0x3ca63f=_0x3ca63f-0x0;var _0x300af8=_0x50bf[_0x3ca63f];return _0x300af8;};'use strict';var multer=require(_0xf50b('0x0'));var util=require(_0xf50b('0x1'));var path=require(_0xf50b('0x2'));var timeout=require('connect-timeout');var express=require(_0xf50b('0x3'));var router=express[_0xf50b('0x4')]();var auth=require(_0xf50b('0x5'));var interaction=require(_0xf50b('0x6'));var config=require(_0xf50b('0x7'));var controller=require('./jscriptyAnswerReport.controller');router['get']('/',auth[_0xf50b('0x8')](),controller[_0xf50b('0x9')]);router['get'](_0xf50b('0xa'),auth[_0xf50b('0x8')](),controller[_0xf50b('0xb')]);router[_0xf50b('0xc')]('/:id',auth[_0xf50b('0x8')](),controller[_0xf50b('0xd')]);router[_0xf50b('0xe')]('/',auth[_0xf50b('0x8')](),controller[_0xf50b('0xf')]);router['put']('/:id',auth[_0xf50b('0x8')](),controller[_0xf50b('0x10')]);router['delete'](_0xf50b('0x11'),auth[_0xf50b('0x8')](),controller['destroy']);module[_0xf50b('0x12')]=router; \ No newline at end of file +var _0xcc73=['post','put','destroy','exports','multer','util','path','express','Router','../../components/auth/service','../../components/interaction/service','./jscriptyAnswerReport.controller','get','isAuthenticated','index','/describe','describe','/:id','show'];(function(_0x5b603d,_0x12997f){var _0x3aba9f=function(_0x53b9d9){while(--_0x53b9d9){_0x5b603d['push'](_0x5b603d['shift']());}};_0x3aba9f(++_0x12997f);}(_0xcc73,0x121));var _0x3cc7=function(_0xbca1b1,_0x33f0ce){_0xbca1b1=_0xbca1b1-0x0;var _0x4e1686=_0xcc73[_0xbca1b1];return _0x4e1686;};'use strict';var multer=require(_0x3cc7('0x0'));var util=require(_0x3cc7('0x1'));var path=require(_0x3cc7('0x2'));var timeout=require('connect-timeout');var express=require(_0x3cc7('0x3'));var router=express[_0x3cc7('0x4')]();var auth=require(_0x3cc7('0x5'));var interaction=require(_0x3cc7('0x6'));var config=require('../../config/environment');var controller=require(_0x3cc7('0x7'));router[_0x3cc7('0x8')]('/',auth[_0x3cc7('0x9')](),controller[_0x3cc7('0xa')]);router[_0x3cc7('0x8')](_0x3cc7('0xb'),auth[_0x3cc7('0x9')](),controller[_0x3cc7('0xc')]);router['get'](_0x3cc7('0xd'),auth[_0x3cc7('0x9')](),controller[_0x3cc7('0xe')]);router[_0x3cc7('0xf')]('/',auth[_0x3cc7('0x9')](),controller['create']);router[_0x3cc7('0x10')](_0x3cc7('0xd'),auth['isAuthenticated'](),controller['update']);router['delete']('/:id',auth[_0x3cc7('0x9')](),controller[_0x3cc7('0x11')]);module[_0x3cc7('0x12')]=router; \ No newline at end of file diff --git a/server/api/jscriptyAnswerReport/jscriptyAnswerReport.attributes.js b/server/api/jscriptyAnswerReport/jscriptyAnswerReport.attributes.js index 1733d57..0f9ddb3 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 _0x35d8=['STRING','long'];(function(_0x43646f,_0x29fe59){var _0x4afb79=function(_0xd646fb){while(--_0xd646fb){_0x43646f['push'](_0x43646f['shift']());}};_0x4afb79(++_0x29fe59);}(_0x35d8,0xcc));var _0x835d=function(_0xc1984a,_0x5c5fdd){_0xc1984a=_0xc1984a-0x0;var _0x5af88e=_0x35d8[_0xc1984a];return _0x5af88e;};'use strict';var Sequelize=require('sequelize');module['exports']={'question':{'type':Sequelize[_0x835d('0x0')]},'answer':{'type':Sequelize['TEXT'](_0x835d('0x1'))},'membername':{'type':Sequelize['STRING']},'projectname':{'type':Sequelize[_0x835d('0x0')]},'queue':{'type':Sequelize[_0x835d('0x0')]},'uniqueid':{'type':Sequelize[_0x835d('0x0')]},'calleridname':{'type':Sequelize[_0x835d('0x0')]},'calleridnum':{'type':Sequelize[_0x835d('0x0')]},'questionId':{'type':Sequelize[_0x835d('0x0')]}}; \ No newline at end of file +var _0x9b38=['sequelize','exports','STRING','TEXT','long'];(function(_0xa60623,_0x2d4e4f){var _0x4a6487=function(_0xba6cbe){while(--_0xba6cbe){_0xa60623['push'](_0xa60623['shift']());}};_0x4a6487(++_0x2d4e4f);}(_0x9b38,0x1d1));var _0x89b3=function(_0x3690c7,_0x245be2){_0x3690c7=_0x3690c7-0x0;var _0x19e6ae=_0x9b38[_0x3690c7];return _0x19e6ae;};'use strict';var Sequelize=require(_0x89b3('0x0'));module[_0x89b3('0x1')]={'question':{'type':Sequelize[_0x89b3('0x2')]},'answer':{'type':Sequelize[_0x89b3('0x3')](_0x89b3('0x4'))},'membername':{'type':Sequelize[_0x89b3('0x2')]},'projectname':{'type':Sequelize[_0x89b3('0x2')]},'queue':{'type':Sequelize[_0x89b3('0x2')]},'uniqueid':{'type':Sequelize[_0x89b3('0x2')]},'calleridname':{'type':Sequelize[_0x89b3('0x2')]},'calleridnum':{'type':Sequelize[_0x89b3('0x2')]},'questionId':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/jscriptyAnswerReport/jscriptyAnswerReport.controller.js b/server/api/jscriptyAnswerReport/jscriptyAnswerReport.controller.js index 97b338b..c4f673d 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 _0x554e=['keys','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','show','params','catch','create','body','find','describe','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','to-csv','ejs','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','count','offset','limit','set','apply','reject','save','update','then','destroy','stack','name','send','index','map','JscriptyAnswerReport','rawAttributes','fieldName','type','key','model','query'];(function(_0xc61e2c,_0x4bd11c){var _0xc66b20=function(_0x31f3e8){while(--_0x31f3e8){_0xc61e2c['push'](_0xc61e2c['shift']());}};_0xc66b20(++_0x4bd11c);}(_0x554e,0xb6));var _0xe554=function(_0x39106e,_0x586f3d){_0x39106e=_0x39106e-0x0;var _0x892aec=_0x554e[_0x39106e];return _0x892aec;};'use strict';var pdf=require(_0xe554('0x0'));var emlformat=require(_0xe554('0x1'));var rimraf=require(_0xe554('0x2'));var zipdir=require(_0xe554('0x3'));var jsonpatch=require(_0xe554('0x4'));var rp=require(_0xe554('0x5'));var moment=require(_0xe554('0x6'));var BPromise=require(_0xe554('0x7'));var Mustache=require(_0xe554('0x8'));var util=require(_0xe554('0x9'));var path=require('path');var sox=require(_0xe554('0xa'));var csv=require(_0xe554('0xb'));var ejs=require(_0xe554('0xc'));var fs=require('fs');var _=require('lodash');var squel=require(_0xe554('0xd'));var crypto=require(_0xe554('0xe'));var jsforce=require(_0xe554('0xf'));var deskjs=require(_0xe554('0x10'));var toCsv=require('to-csv');var querystring=require(_0xe554('0x11'));var Papa=require(_0xe554('0x12'));var Redis=require('ioredis');var authService=require(_0xe554('0x13'));var qs=require(_0xe554('0x14'));var as=require(_0xe554('0x15'));var hardwareService=require(_0xe554('0x16'));var logger=require('../../config/logger')('api');var utils=require(_0xe554('0x17'));var config=require(_0xe554('0x18'));var db=require(_0xe554('0x19'))['db'];function respondWithStatusCode(_0x50aee6,_0x14836e){_0x14836e=_0x14836e||0xcc;return function(_0x2465d9){if(_0x2465d9){return _0x50aee6[_0xe554('0x1a')](_0x14836e);}return _0x50aee6[_0xe554('0x1b')](_0x14836e)[_0xe554('0x1c')]();};}function respondWithResult(_0x1c0883,_0x5ebf3d){_0x5ebf3d=_0x5ebf3d||0xc8;return function(_0x487426){if(_0x487426){return _0x1c0883['status'](_0x5ebf3d)[_0xe554('0x1d')](_0x487426);}};}function respondWithFilteredResult(_0x368fbf,_0x55a228){return function(_0x47642e){if(_0x47642e){var _0x4e9415=_0x47642e[_0xe554('0x1e')],_0x443d6c=_0x55a228[_0xe554('0x1f')],_0x5e07c3=_0x55a228[_0xe554('0x1f')]+_0x55a228[_0xe554('0x20')],_0x46eaac;if(_0x5e07c3>=_0x4e9415){_0x5e07c3=_0x4e9415;_0x46eaac=0xc8;}else{_0x46eaac=0xce;}_0x368fbf['status'](_0x46eaac);return _0x368fbf[_0xe554('0x21')]('Content-Range',_0x443d6c+'-'+_0x5e07c3+'/'+_0x4e9415)[_0xe554('0x1d')](_0x47642e);}return null;};}function patchUpdates(_0x2f5fc6){return function(_0x14554f){try{jsonpatch[_0xe554('0x22')](_0x14554f,_0x2f5fc6,!![]);}catch(_0x411fed){return BPromise[_0xe554('0x23')](_0x411fed);}return _0x14554f[_0xe554('0x24')]();};}function saveUpdates(_0x4eac73,_0x9d9e0f){return function(_0x5dc2d8){if(_0x5dc2d8){return _0x5dc2d8[_0xe554('0x25')](_0x4eac73)[_0xe554('0x26')](function(_0xf9fe40){return _0xf9fe40;});}return null;};}function removeEntity(_0xcedbbd,_0x5b5853){return function(_0x57d497){if(_0x57d497){return _0x57d497[_0xe554('0x27')]()[_0xe554('0x26')](function(){_0xcedbbd[_0xe554('0x1b')](0xcc)[_0xe554('0x1c')]();});}};}function handleEntityNotFound(_0x520594,_0x15aa3c){return function(_0x10283b){if(!_0x10283b){_0x520594[_0xe554('0x1a')](0x194);}return _0x10283b;};}function handleError(_0x2d18ad,_0x3b3be5){_0x3b3be5=_0x3b3be5||0x1f4;return function(_0x4df34f){logger['error'](_0x4df34f[_0xe554('0x28')]);if(_0x4df34f[_0xe554('0x29')]){delete _0x4df34f[_0xe554('0x29')];}_0x2d18ad[_0xe554('0x1b')](_0x3b3be5)[_0xe554('0x2a')](_0x4df34f);};}exports[_0xe554('0x2b')]=function(_0x3cd35a,_0x490885){var _0x4661fc={},_0x306b08={},_0xabbcb1={'count':0x0,'rows':[]};var _0x3b7973=_[_0xe554('0x2c')](db[_0xe554('0x2d')][_0xe554('0x2e')],function(_0x1340bd){return{'name':_0x1340bd[_0xe554('0x2f')],'type':_0x1340bd[_0xe554('0x30')][_0xe554('0x31')]};});_0x306b08[_0xe554('0x32')]=_[_0xe554('0x2c')](_0x3b7973,_0xe554('0x29'));_0x306b08[_0xe554('0x33')]=_[_0xe554('0x34')](_0x3cd35a[_0xe554('0x33')]);_0x306b08[_0xe554('0x35')]=_['intersection'](_0x306b08[_0xe554('0x32')],_0x306b08[_0xe554('0x33')]);_0x4661fc[_0xe554('0x36')]=_[_0xe554('0x37')](_0x306b08[_0xe554('0x32')],qs[_0xe554('0x38')](_0x3cd35a['query'][_0xe554('0x38')]));_0x4661fc[_0xe554('0x36')]=_0x4661fc['attributes'][_0xe554('0x39')]?_0x4661fc['attributes']:_0x306b08[_0xe554('0x32')];if(!_0x3cd35a['query'][_0xe554('0x3a')](_0xe554('0x3b'))){_0x4661fc[_0xe554('0x20')]=qs[_0xe554('0x20')](_0x3cd35a[_0xe554('0x33')][_0xe554('0x20')]);_0x4661fc[_0xe554('0x1f')]=qs[_0xe554('0x1f')](_0x3cd35a[_0xe554('0x33')][_0xe554('0x1f')]);}_0x4661fc[_0xe554('0x3c')]=qs['sort'](_0x3cd35a[_0xe554('0x33')]['sort']);_0x4661fc[_0xe554('0x3d')]=qs[_0xe554('0x35')](_[_0xe554('0x3e')](_0x3cd35a[_0xe554('0x33')],_0x306b08[_0xe554('0x35')]));if(_0x3cd35a['query'][_0xe554('0x3f')]){_0x4661fc[_0xe554('0x3d')]=_[_0xe554('0x40')](_0x4661fc['where'],{'$or':_['map'](_0x3b7973,function(_0x49a858){if(_0x49a858[_0xe554('0x30')]!==_0xe554('0x41')){var _0x21305a={};_0x21305a[_0x49a858[_0xe554('0x29')]]={'$like':'%'+_0x3cd35a[_0xe554('0x33')]['filter']+'%'};return _0x21305a;}})});}_0x4661fc=_[_0xe554('0x40')]({},_0x4661fc,_0x3cd35a[_0xe554('0x42')]);var _0x269eda={'where':_0x4661fc[_0xe554('0x3d')]};return db[_0xe554('0x2d')][_0xe554('0x1e')](_0x269eda)[_0xe554('0x26')](function(_0x2f9376){_0xabbcb1[_0xe554('0x1e')]=_0x2f9376;if(_0x3cd35a[_0xe554('0x33')][_0xe554('0x43')]){_0x4661fc[_0xe554('0x44')]=[{'all':!![]}];}return db['JscriptyAnswerReport'][_0xe554('0x45')](_0x4661fc);})['then'](function(_0x368e5f){_0xabbcb1[_0xe554('0x46')]=_0x368e5f;return _0xabbcb1;})[_0xe554('0x26')](respondWithFilteredResult(_0x490885,_0x4661fc))['catch'](handleError(_0x490885,null));};exports[_0xe554('0x47')]=function(_0x22d06b,_0x399679){var _0x595abd={'raw':!![],'where':{'id':_0x22d06b[_0xe554('0x48')]['id']}},_0x4204cb={};_0x4204cb[_0xe554('0x32')]=_['keys'](db['JscriptyAnswerReport'][_0xe554('0x2e')]);_0x4204cb['query']=_[_0xe554('0x34')](_0x22d06b['query']);_0x4204cb[_0xe554('0x35')]=_[_0xe554('0x37')](_0x4204cb[_0xe554('0x32')],_0x4204cb[_0xe554('0x33')]);_0x595abd[_0xe554('0x36')]=_[_0xe554('0x37')](_0x4204cb[_0xe554('0x32')],qs[_0xe554('0x38')](_0x22d06b[_0xe554('0x33')][_0xe554('0x38')]));_0x595abd[_0xe554('0x36')]=_0x595abd['attributes'][_0xe554('0x39')]?_0x595abd[_0xe554('0x36')]:_0x4204cb[_0xe554('0x32')];if(_0x22d06b[_0xe554('0x33')][_0xe554('0x43')]){_0x595abd[_0xe554('0x44')]=[{'all':!![]}];}_0x595abd=_[_0xe554('0x40')]({},_0x595abd,_0x22d06b[_0xe554('0x42')]);return db[_0xe554('0x2d')]['find'](_0x595abd)[_0xe554('0x26')](handleEntityNotFound(_0x399679,null))['then'](respondWithResult(_0x399679,null))[_0xe554('0x49')](handleError(_0x399679,null));};exports[_0xe554('0x4a')]=function(_0x1caa86,_0x215c1a){return db[_0xe554('0x2d')][_0xe554('0x4a')](_0x1caa86[_0xe554('0x4b')],{})['then'](respondWithResult(_0x215c1a,0xc9))[_0xe554('0x49')](handleError(_0x215c1a,null));};exports[_0xe554('0x25')]=function(_0x37bc98,_0x563e04){if(_0x37bc98[_0xe554('0x4b')]['id']){delete _0x37bc98[_0xe554('0x4b')]['id'];}return db[_0xe554('0x2d')][_0xe554('0x4c')]({'where':{'id':_0x37bc98[_0xe554('0x48')]['id']}})[_0xe554('0x26')](handleEntityNotFound(_0x563e04,null))[_0xe554('0x26')](saveUpdates(_0x37bc98[_0xe554('0x4b')],null))['then'](respondWithResult(_0x563e04,null))[_0xe554('0x49')](handleError(_0x563e04,null));};exports[_0xe554('0x27')]=function(_0x302425,_0x35b3f8){return db['JscriptyAnswerReport'][_0xe554('0x4c')]({'where':{'id':_0x302425[_0xe554('0x48')]['id']}})[_0xe554('0x26')](handleEntityNotFound(_0x35b3f8,null))['then'](removeEntity(_0x35b3f8,null))[_0xe554('0x49')](handleError(_0x35b3f8,null));};exports[_0xe554('0x4d')]=function(_0x3e8229,_0x535d3e){return db['JscriptyAnswerReport'][_0xe554('0x4d')]()[_0xe554('0x26')](respondWithResult(_0x535d3e,null))[_0xe554('0x49')](handleError(_0x535d3e,null));}; \ No newline at end of file +var _0xc599=['count','includeAll','findAll','rows','show','params','rawAttributes','filters','include','find','catch','create','body','describe','eml-format','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','to-csv','ejs','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../config/license/hardware','api','../../config/environment','status','json','offset','limit','set','Content-Range','reject','save','update','destroy','then','end','sendStatus','error','stack','name','send','map','JscriptyAnswerReport','fieldName','type','key','model','query','keys','intersection','attributes','fields','length','hasOwnProperty','sort','where','pick','merge','filter','options'];(function(_0x56d0e2,_0xd1f5d0){var _0x5502d9=function(_0x40447f){while(--_0x40447f){_0x56d0e2['push'](_0x56d0e2['shift']());}};_0x5502d9(++_0xd1f5d0);}(_0xc599,0x1b2));var _0x9c59=function(_0x5f3094,_0x33af18){_0x5f3094=_0x5f3094-0x0;var _0x2b452d=_0xc599[_0x5f3094];return _0x2b452d;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x9c59('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x9c59('0x1'));var jsonpatch=require(_0x9c59('0x2'));var rp=require(_0x9c59('0x3'));var moment=require('moment');var BPromise=require(_0x9c59('0x4'));var Mustache=require(_0x9c59('0x5'));var util=require(_0x9c59('0x6'));var path=require(_0x9c59('0x7'));var sox=require(_0x9c59('0x8'));var csv=require(_0x9c59('0x9'));var ejs=require(_0x9c59('0xa'));var fs=require('fs');var _=require('lodash');var squel=require('squel');var crypto=require(_0x9c59('0xb'));var jsforce=require('jsforce');var deskjs=require(_0x9c59('0xc'));var toCsv=require('to-csv');var querystring=require(_0x9c59('0xd'));var Papa=require(_0x9c59('0xe'));var Redis=require(_0x9c59('0xf'));var authService=require(_0x9c59('0x10'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x9c59('0x11'));var logger=require('../../config/logger')(_0x9c59('0x12'));var utils=require('../../config/utils');var config=require(_0x9c59('0x13'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x55f952,_0x2cc4f7){_0x2cc4f7=_0x2cc4f7||0xcc;return function(_0x40216c){if(_0x40216c){return _0x55f952['sendStatus'](_0x2cc4f7);}return _0x55f952['status'](_0x2cc4f7)['end']();};}function respondWithResult(_0x5aff59,_0x5c43bb){_0x5c43bb=_0x5c43bb||0xc8;return function(_0x13bc3b){if(_0x13bc3b){return _0x5aff59[_0x9c59('0x14')](_0x5c43bb)[_0x9c59('0x15')](_0x13bc3b);}};}function respondWithFilteredResult(_0xaa3cbe,_0x55c8ca){return function(_0x1f376d){if(_0x1f376d){var _0x4019ae=_0x1f376d['count'],_0x1d07fd=_0x55c8ca[_0x9c59('0x16')],_0x562069=_0x55c8ca[_0x9c59('0x16')]+_0x55c8ca[_0x9c59('0x17')],_0x5792d3;if(_0x562069>=_0x4019ae){_0x562069=_0x4019ae;_0x5792d3=0xc8;}else{_0x5792d3=0xce;}_0xaa3cbe[_0x9c59('0x14')](_0x5792d3);return _0xaa3cbe[_0x9c59('0x18')](_0x9c59('0x19'),_0x1d07fd+'-'+_0x562069+'/'+_0x4019ae)[_0x9c59('0x15')](_0x1f376d);}return null;};}function patchUpdates(_0x3b0398){return function(_0x570c69){try{jsonpatch['apply'](_0x570c69,_0x3b0398,!![]);}catch(_0x52f991){return BPromise[_0x9c59('0x1a')](_0x52f991);}return _0x570c69[_0x9c59('0x1b')]();};}function saveUpdates(_0x12402e,_0x1925a1){return function(_0x566168){if(_0x566168){return _0x566168[_0x9c59('0x1c')](_0x12402e)['then'](function(_0x958605){return _0x958605;});}return null;};}function removeEntity(_0x21258d,_0x4dcc88){return function(_0x1854b6){if(_0x1854b6){return _0x1854b6[_0x9c59('0x1d')]()[_0x9c59('0x1e')](function(){_0x21258d[_0x9c59('0x14')](0xcc)[_0x9c59('0x1f')]();});}};}function handleEntityNotFound(_0x58dadf,_0x7ffcdd){return function(_0x2eb93e){if(!_0x2eb93e){_0x58dadf[_0x9c59('0x20')](0x194);}return _0x2eb93e;};}function handleError(_0x5e1146,_0x31fe87){_0x31fe87=_0x31fe87||0x1f4;return function(_0x34b540){logger[_0x9c59('0x21')](_0x34b540[_0x9c59('0x22')]);if(_0x34b540['name']){delete _0x34b540[_0x9c59('0x23')];}_0x5e1146[_0x9c59('0x14')](_0x31fe87)[_0x9c59('0x24')](_0x34b540);};}exports['index']=function(_0x1d2e47,_0x27e6b2){var _0x214dcb={},_0x3da24a={},_0x190793={'count':0x0,'rows':[]};var _0x50e147=_[_0x9c59('0x25')](db[_0x9c59('0x26')]['rawAttributes'],function(_0x5d3856){return{'name':_0x5d3856[_0x9c59('0x27')],'type':_0x5d3856[_0x9c59('0x28')][_0x9c59('0x29')]};});_0x3da24a[_0x9c59('0x2a')]=_['map'](_0x50e147,_0x9c59('0x23'));_0x3da24a[_0x9c59('0x2b')]=_[_0x9c59('0x2c')](_0x1d2e47[_0x9c59('0x2b')]);_0x3da24a['filters']=_[_0x9c59('0x2d')](_0x3da24a[_0x9c59('0x2a')],_0x3da24a[_0x9c59('0x2b')]);_0x214dcb[_0x9c59('0x2e')]=_[_0x9c59('0x2d')](_0x3da24a[_0x9c59('0x2a')],qs[_0x9c59('0x2f')](_0x1d2e47[_0x9c59('0x2b')][_0x9c59('0x2f')]));_0x214dcb[_0x9c59('0x2e')]=_0x214dcb[_0x9c59('0x2e')][_0x9c59('0x30')]?_0x214dcb[_0x9c59('0x2e')]:_0x3da24a['model'];if(!_0x1d2e47[_0x9c59('0x2b')][_0x9c59('0x31')]('nolimit')){_0x214dcb['limit']=qs[_0x9c59('0x17')](_0x1d2e47[_0x9c59('0x2b')][_0x9c59('0x17')]);_0x214dcb[_0x9c59('0x16')]=qs['offset'](_0x1d2e47[_0x9c59('0x2b')][_0x9c59('0x16')]);}_0x214dcb['order']=qs[_0x9c59('0x32')](_0x1d2e47[_0x9c59('0x2b')]['sort']);_0x214dcb[_0x9c59('0x33')]=qs['filters'](_[_0x9c59('0x34')](_0x1d2e47[_0x9c59('0x2b')],_0x3da24a['filters']));if(_0x1d2e47[_0x9c59('0x2b')]['filter']){_0x214dcb['where']=_[_0x9c59('0x35')](_0x214dcb['where'],{'$or':_[_0x9c59('0x25')](_0x50e147,function(_0x5f03a7){if(_0x5f03a7['type']!=='VIRTUAL'){var _0x3c0280={};_0x3c0280[_0x5f03a7[_0x9c59('0x23')]]={'$like':'%'+_0x1d2e47[_0x9c59('0x2b')][_0x9c59('0x36')]+'%'};return _0x3c0280;}})});}_0x214dcb=_[_0x9c59('0x35')]({},_0x214dcb,_0x1d2e47[_0x9c59('0x37')]);var _0x493407={'where':_0x214dcb[_0x9c59('0x33')]};return db['JscriptyAnswerReport'][_0x9c59('0x38')](_0x493407)[_0x9c59('0x1e')](function(_0x222da2){_0x190793[_0x9c59('0x38')]=_0x222da2;if(_0x1d2e47[_0x9c59('0x2b')][_0x9c59('0x39')]){_0x214dcb['include']=[{'all':!![]}];}return db[_0x9c59('0x26')][_0x9c59('0x3a')](_0x214dcb);})[_0x9c59('0x1e')](function(_0x1a02f3){_0x190793[_0x9c59('0x3b')]=_0x1a02f3;return _0x190793;})[_0x9c59('0x1e')](respondWithFilteredResult(_0x27e6b2,_0x214dcb))['catch'](handleError(_0x27e6b2,null));};exports[_0x9c59('0x3c')]=function(_0x2933c0,_0x26e5da){var _0x5b8ea2={'raw':!![],'where':{'id':_0x2933c0[_0x9c59('0x3d')]['id']}},_0x409044={};_0x409044[_0x9c59('0x2a')]=_[_0x9c59('0x2c')](db['JscriptyAnswerReport'][_0x9c59('0x3e')]);_0x409044[_0x9c59('0x2b')]=_[_0x9c59('0x2c')](_0x2933c0[_0x9c59('0x2b')]);_0x409044[_0x9c59('0x3f')]=_[_0x9c59('0x2d')](_0x409044['model'],_0x409044['query']);_0x5b8ea2['attributes']=_['intersection'](_0x409044[_0x9c59('0x2a')],qs[_0x9c59('0x2f')](_0x2933c0[_0x9c59('0x2b')][_0x9c59('0x2f')]));_0x5b8ea2[_0x9c59('0x2e')]=_0x5b8ea2['attributes']['length']?_0x5b8ea2[_0x9c59('0x2e')]:_0x409044[_0x9c59('0x2a')];if(_0x2933c0[_0x9c59('0x2b')][_0x9c59('0x39')]){_0x5b8ea2[_0x9c59('0x40')]=[{'all':!![]}];}_0x5b8ea2=_[_0x9c59('0x35')]({},_0x5b8ea2,_0x2933c0[_0x9c59('0x37')]);return db[_0x9c59('0x26')][_0x9c59('0x41')](_0x5b8ea2)[_0x9c59('0x1e')](handleEntityNotFound(_0x26e5da,null))[_0x9c59('0x1e')](respondWithResult(_0x26e5da,null))[_0x9c59('0x42')](handleError(_0x26e5da,null));};exports['create']=function(_0x1e1175,_0x2c10c9){return db['JscriptyAnswerReport'][_0x9c59('0x43')](_0x1e1175[_0x9c59('0x44')],{})[_0x9c59('0x1e')](respondWithResult(_0x2c10c9,0xc9))[_0x9c59('0x42')](handleError(_0x2c10c9,null));};exports[_0x9c59('0x1c')]=function(_0x145363,_0xd1892b){if(_0x145363[_0x9c59('0x44')]['id']){delete _0x145363['body']['id'];}return db[_0x9c59('0x26')]['find']({'where':{'id':_0x145363[_0x9c59('0x3d')]['id']}})[_0x9c59('0x1e')](handleEntityNotFound(_0xd1892b,null))[_0x9c59('0x1e')](saveUpdates(_0x145363[_0x9c59('0x44')],null))[_0x9c59('0x1e')](respondWithResult(_0xd1892b,null))[_0x9c59('0x42')](handleError(_0xd1892b,null));};exports[_0x9c59('0x1d')]=function(_0x158bfe,_0x58b2f8){return db[_0x9c59('0x26')][_0x9c59('0x41')]({'where':{'id':_0x158bfe[_0x9c59('0x3d')]['id']}})[_0x9c59('0x1e')](handleEntityNotFound(_0x58b2f8,null))[_0x9c59('0x1e')](removeEntity(_0x58b2f8,null))[_0x9c59('0x42')](handleError(_0x58b2f8,null));};exports[_0x9c59('0x45')]=function(_0x2024eb,_0x31585b){return db['JscriptyAnswerReport'][_0x9c59('0x45')]()[_0x9c59('0x1e')](respondWithResult(_0x31585b,null))[_0x9c59('0x42')](handleError(_0x31585b,null));}; \ No newline at end of file diff --git a/server/api/jscriptyAnswerReport/jscriptyAnswerReport.model.js b/server/api/jscriptyAnswerReport/jscriptyAnswerReport.model.js index eff9f1c..c9f2e0d 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 _0xc7b1=['util','../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment','exports','define','JscriptyAnswerReport','lodash'];(function(_0x154cc0,_0x37882b){var _0x47813d=function(_0x278f39){while(--_0x278f39){_0x154cc0['push'](_0x154cc0['shift']());}};_0x47813d(++_0x37882b);}(_0xc7b1,0x143));var _0x1c7b=function(_0x1cd577,_0x180f2a){_0x1cd577=_0x1cd577-0x0;var _0x790837=_0xc7b1[_0x1cd577];return _0x790837;};'use strict';var _=require(_0x1c7b('0x0'));var util=require(_0x1c7b('0x1'));var logger=require(_0x1c7b('0x2'))('api');var moment=require(_0x1c7b('0x3'));var BPromise=require(_0x1c7b('0x4'));var rp=require(_0x1c7b('0x5'));var fs=require('fs');var path=require(_0x1c7b('0x6'));var rimraf=require(_0x1c7b('0x7'));var config=require(_0x1c7b('0x8'));var attributes=require('./jscriptyAnswerReport.attributes');module[_0x1c7b('0x9')]=function(_0x1f84a6,_0xcd3208){return _0x1f84a6[_0x1c7b('0xa')](_0x1c7b('0xb'),attributes,{'tableName':'report_jscripty_answers','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x59ff=['api','moment','bluebird','rimraf','./jscriptyAnswerReport.attributes','define','report_jscripty_answers','lodash','util','../../config/logger'];(function(_0x53bcfa,_0x20eb6e){var _0x25e64e=function(_0x1d9515){while(--_0x1d9515){_0x53bcfa['push'](_0x53bcfa['shift']());}};_0x25e64e(++_0x20eb6e);}(_0x59ff,0x197));var _0xf59f=function(_0x14a89d,_0x597818){_0x14a89d=_0x14a89d-0x0;var _0x4c6c50=_0x59ff[_0x14a89d];return _0x4c6c50;};'use strict';var _=require(_0xf59f('0x0'));var util=require(_0xf59f('0x1'));var logger=require(_0xf59f('0x2'))(_0xf59f('0x3'));var moment=require(_0xf59f('0x4'));var BPromise=require(_0xf59f('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0xf59f('0x6'));var config=require('../../config/environment');var attributes=require(_0xf59f('0x7'));module['exports']=function(_0x564edb,_0x288f2c){return _0x564edb[_0xf59f('0x8')]('JscriptyAnswerReport',attributes,{'tableName':_0xf59f('0x9'),'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 e3c299d..26332e2 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 _0x059e=['jayson/promise','client','http','request','then','JscriptyAnswerReport,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','info','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment'];(function(_0x5650f4,_0x1d2372){var _0x325f6d=function(_0x4bbbe9){while(--_0x4bbbe9){_0x5650f4['push'](_0x5650f4['shift']());}};_0x325f6d(++_0x1d2372);}(_0x059e,0x1af));var _0xe059=function(_0x126645,_0x1c2cb1){_0x126645=_0x126645-0x0;var _0x457da6=_0x059e[_0x126645];return _0x457da6;};'use strict';var _=require(_0xe059('0x0'));var util=require(_0xe059('0x1'));var moment=require(_0xe059('0x2'));var BPromise=require(_0xe059('0x3'));var rs=require(_0xe059('0x4'));var fs=require('fs');var Redis=require(_0xe059('0x5'));var db=require(_0xe059('0x6'))['db'];var utils=require(_0xe059('0x7'));var logger=require(_0xe059('0x8'))(_0xe059('0x9'));var config=require(_0xe059('0xa'));var jayson=require(_0xe059('0xb'));var client=jayson[_0xe059('0xc')][_0xe059('0xd')]({'port':0x232a});function respondWithRpcPromise(_0x4456fa,_0x23b827,_0x641618){return new BPromise(function(_0x277beb,_0x54279b){return client[_0xe059('0xe')](_0x4456fa,_0x641618)[_0xe059('0xf')](function(_0x198e36){logger['info'](_0xe059('0x10'),_0x23b827,_0xe059('0x11'));logger[_0xe059('0x12')]('JscriptyAnswerReport,\x20%s,\x20%s,\x20%s',_0x23b827,_0xe059('0x11'),JSON[_0xe059('0x13')](_0x198e36));if(_0x198e36[_0xe059('0x14')]){if(_0x198e36[_0xe059('0x14')][_0xe059('0x15')]===0x1f4){logger[_0xe059('0x14')](_0xe059('0x10'),_0x23b827,_0x198e36['error'][_0xe059('0x16')]);return _0x54279b(_0x198e36['error'][_0xe059('0x16')]);}logger[_0xe059('0x14')](_0xe059('0x10'),_0x23b827,_0x198e36[_0xe059('0x14')][_0xe059('0x16')]);return _0x277beb(_0x198e36[_0xe059('0x14')][_0xe059('0x16')]);}else{logger[_0xe059('0x17')](_0xe059('0x10'),_0x23b827,_0xe059('0x11'));_0x277beb(_0x198e36[_0xe059('0x18')]['message']);}})[_0xe059('0x19')](function(_0x4c791c){logger[_0xe059('0x14')](_0xe059('0x10'),_0x23b827,_0x4c791c);_0x54279b(_0x4c791c);});});} \ No newline at end of file +var _0x3cc8=['jayson/promise','http','then','info','JscriptyAnswerReport,\x20%s,\x20%s','request\x20sent','debug','JscriptyAnswerReport,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','lodash','util','randomstring','ioredis','../../mysqldb','rpc','../../config/environment'];(function(_0x484ad6,_0x4efaee){var _0x4950d0=function(_0x11afec){while(--_0x11afec){_0x484ad6['push'](_0x484ad6['shift']());}};_0x4950d0(++_0x4efaee);}(_0x3cc8,0x161));var _0x83cc=function(_0x14bd66,_0x55ffdd){_0x14bd66=_0x14bd66-0x0;var _0x59567d=_0x3cc8[_0x14bd66];return _0x59567d;};'use strict';var _=require(_0x83cc('0x0'));var util=require(_0x83cc('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x83cc('0x2'));var fs=require('fs');var Redis=require(_0x83cc('0x3'));var db=require(_0x83cc('0x4'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x83cc('0x5'));var config=require(_0x83cc('0x6'));var jayson=require(_0x83cc('0x7'));var client=jayson['client'][_0x83cc('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x22203b,_0x3ccd3b,_0x3b6403){return new BPromise(function(_0x2c8dff,_0x2c9463){return client['request'](_0x22203b,_0x3b6403)[_0x83cc('0x9')](function(_0x50b351){logger[_0x83cc('0xa')](_0x83cc('0xb'),_0x3ccd3b,_0x83cc('0xc'));logger[_0x83cc('0xd')](_0x83cc('0xe'),_0x3ccd3b,_0x83cc('0xc'),JSON[_0x83cc('0xf')](_0x50b351));if(_0x50b351[_0x83cc('0x10')]){if(_0x50b351[_0x83cc('0x10')]['code']===0x1f4){logger[_0x83cc('0x10')](_0x83cc('0xb'),_0x3ccd3b,_0x50b351[_0x83cc('0x10')]['message']);return _0x2c9463(_0x50b351['error'][_0x83cc('0x11')]);}logger[_0x83cc('0x10')](_0x83cc('0xb'),_0x3ccd3b,_0x50b351['error'][_0x83cc('0x11')]);return _0x2c8dff(_0x50b351[_0x83cc('0x10')]['message']);}else{logger[_0x83cc('0xa')](_0x83cc('0xb'),_0x3ccd3b,_0x83cc('0xc'));_0x2c8dff(_0x50b351[_0x83cc('0x12')][_0x83cc('0x11')]);}})[_0x83cc('0x13')](function(_0xab7d79){logger[_0x83cc('0x10')](_0x83cc('0xb'),_0x3ccd3b,_0xab7d79);_0x2c9463(_0xab7d79);});});} \ No newline at end of file diff --git a/server/api/jscriptyProject/index.js b/server/api/jscriptyProject/index.js index d888393..bd49150 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 _0x30a0=['clone','put','update','delete','destroy','exports','multer','util','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/:id','/:id/sessions','getSessions','/:id/answers','getAnswers','/:id/summary','30s','post','create','/:id/clone'];(function(_0x334841,_0x2bbc4c){var _0x5beb4b=function(_0x4bea72){while(--_0x4bea72){_0x334841['push'](_0x334841['shift']());}};_0x5beb4b(++_0x2bbc4c);}(_0x30a0,0x19b));var _0x030a=function(_0x2dd187,_0xf1981d){_0x2dd187=_0x2dd187-0x0;var _0x308fbf=_0x30a0[_0x2dd187];return _0x308fbf;};'use strict';var multer=require(_0x030a('0x0'));var util=require(_0x030a('0x1'));var path=require('path');var timeout=require(_0x030a('0x2'));var express=require(_0x030a('0x3'));var router=express[_0x030a('0x4')]();var auth=require(_0x030a('0x5'));var interaction=require(_0x030a('0x6'));var config=require(_0x030a('0x7'));var controller=require('./jscriptyProject.controller');router[_0x030a('0x8')]('/',auth[_0x030a('0x9')](),controller[_0x030a('0xa')]);router[_0x030a('0x8')](_0x030a('0xb'),auth['isAuthenticated'](),controller['show']);router[_0x030a('0x8')](_0x030a('0xc'),auth[_0x030a('0x9')](),controller[_0x030a('0xd')]);router['get'](_0x030a('0xe'),auth[_0x030a('0x9')](),controller[_0x030a('0xf')]);router['get'](_0x030a('0x10'),auth['isAuthenticated'](),timeout(_0x030a('0x11')),controller['getSummary']);router[_0x030a('0x12')]('/',auth[_0x030a('0x9')](),controller[_0x030a('0x13')]);router[_0x030a('0x12')](_0x030a('0x14'),auth[_0x030a('0x9')](),controller[_0x030a('0x15')]);router[_0x030a('0x16')](_0x030a('0xb'),auth[_0x030a('0x9')](),controller[_0x030a('0x17')]);router[_0x030a('0x18')](_0x030a('0xb'),auth[_0x030a('0x9')](),controller[_0x030a('0x19')]);module[_0x030a('0x1a')]=router; \ No newline at end of file +var _0x5f36=['30s','create','post','/:id/clone','clone','put','update','delete','destroy','util','path','express','../../components/auth/service','../../components/interaction/service','./jscriptyProject.controller','get','index','/:id','show','/:id/sessions','isAuthenticated','/:id/answers','getAnswers','/:id/summary'];(function(_0x44ab9d,_0x3d060c){var _0x279648=function(_0x1b6d1f){while(--_0x1b6d1f){_0x44ab9d['push'](_0x44ab9d['shift']());}};_0x279648(++_0x3d060c);}(_0x5f36,0x81));var _0x65f3=function(_0x442e43,_0x2b1e1b){_0x442e43=_0x442e43-0x0;var _0xaa0a5b=_0x5f36[_0x442e43];return _0xaa0a5b;};'use strict';var multer=require('multer');var util=require(_0x65f3('0x0'));var path=require(_0x65f3('0x1'));var timeout=require('connect-timeout');var express=require(_0x65f3('0x2'));var router=express['Router']();var auth=require(_0x65f3('0x3'));var interaction=require(_0x65f3('0x4'));var config=require('../../config/environment');var controller=require(_0x65f3('0x5'));router[_0x65f3('0x6')]('/',auth['isAuthenticated'](),controller[_0x65f3('0x7')]);router[_0x65f3('0x6')](_0x65f3('0x8'),auth['isAuthenticated'](),controller[_0x65f3('0x9')]);router[_0x65f3('0x6')](_0x65f3('0xa'),auth[_0x65f3('0xb')](),controller['getSessions']);router['get'](_0x65f3('0xc'),auth[_0x65f3('0xb')](),controller[_0x65f3('0xd')]);router[_0x65f3('0x6')](_0x65f3('0xe'),auth[_0x65f3('0xb')](),timeout(_0x65f3('0xf')),controller['getSummary']);router['post']('/',auth['isAuthenticated'](),controller[_0x65f3('0x10')]);router[_0x65f3('0x11')](_0x65f3('0x12'),auth[_0x65f3('0xb')](),controller[_0x65f3('0x13')]);router[_0x65f3('0x14')]('/:id',auth[_0x65f3('0xb')](),controller[_0x65f3('0x15')]);router[_0x65f3('0x16')](_0x65f3('0x8'),auth[_0x65f3('0xb')](),controller[_0x65f3('0x17')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/jscriptyProject/jscriptyProject.attributes.js b/server/api/jscriptyProject/jscriptyProject.attributes.js index 8df1436..42d7087 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 _0x411c=['name','isObjectLike','formData','stringify','setDataValue','format','{\x22name\x22:\x22%s\x22,\x22description\x22:\x22%s\x22,\x22pages\x22:[]}','getDataValue','sequelize','lodash','util','exports','STRING'];(function(_0x255c48,_0x2a4449){var _0xaebda3=function(_0x12a04e){while(--_0x12a04e){_0x255c48['push'](_0x255c48['shift']());}};_0xaebda3(++_0x2a4449);}(_0x411c,0x19b));var _0xc411=function(_0x4293bb,_0x1b1882){_0x4293bb=_0x4293bb-0x0;var _0x4b4290=_0x411c[_0x4293bb];return _0x4b4290;};'use strict';var Sequelize=require(_0xc411('0x0'));var _=require(_0xc411('0x1'));var util=require(_0xc411('0x2'));module[_0xc411('0x3')]={'name':{'type':Sequelize[_0xc411('0x4')],'unique':_0xc411('0x5')},'description':{'type':Sequelize[_0xc411('0x4')]},'formData':{'type':Sequelize['TEXT']('long'),'set':function(_0x2657b2){if(_[_0xc411('0x6')](_0x2657b2)){this['setDataValue'](_0xc411('0x7'),JSON[_0xc411('0x8')](_0x2657b2));}else if(_['isString'](_0x2657b2)){this[_0xc411('0x9')](_0xc411('0x7'),_0x2657b2);}else{this[_0xc411('0x9')](_0xc411('0x7'),util[_0xc411('0xa')](_0xc411('0xb'),this[_0xc411('0xc')]('name')||'',this['getDataValue']('description')||''));}}},'enableUncompleteSave':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'sendUnpauseOnSubmit':{'type':Sequelize['BOOLEAN'],'defaultValue':![]}}; \ No newline at end of file +var _0x4042=['format','name','getDataValue','description','BOOLEAN','sequelize','lodash','util','exports','STRING','TEXT','isObjectLike','formData','stringify','isString','setDataValue'];(function(_0x122ef9,_0x451d2a){var _0x42fba0=function(_0x17c9d3){while(--_0x17c9d3){_0x122ef9['push'](_0x122ef9['shift']());}};_0x42fba0(++_0x451d2a);}(_0x4042,0x195));var _0x2404=function(_0x1c71d2,_0x459cbe){_0x1c71d2=_0x1c71d2-0x0;var _0x2df03f=_0x4042[_0x1c71d2];return _0x2df03f;};'use strict';var Sequelize=require(_0x2404('0x0'));var _=require(_0x2404('0x1'));var util=require(_0x2404('0x2'));module[_0x2404('0x3')]={'name':{'type':Sequelize[_0x2404('0x4')],'unique':'name'},'description':{'type':Sequelize[_0x2404('0x4')]},'formData':{'type':Sequelize[_0x2404('0x5')]('long'),'set':function(_0x4ff3d2){if(_[_0x2404('0x6')](_0x4ff3d2)){this['setDataValue'](_0x2404('0x7'),JSON[_0x2404('0x8')](_0x4ff3d2));}else if(_[_0x2404('0x9')](_0x4ff3d2)){this[_0x2404('0xa')](_0x2404('0x7'),_0x4ff3d2);}else{this['setDataValue'](_0x2404('0x7'),util[_0x2404('0xb')]('{\x22name\x22:\x22%s\x22,\x22description\x22:\x22%s\x22,\x22pages\x22:[]}',this['getDataValue'](_0x2404('0xc'))||'',this[_0x2404('0xd')](_0x2404('0xe'))||''));}}},'enableUncompleteSave':{'type':Sequelize[_0x2404('0xf')],'defaultValue':!![]},'sendUnpauseOnSubmit':{'type':Sequelize['BOOLEAN'],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/jscriptyProject/jscriptyProject.controller.js b/server/api/jscriptyProject/jscriptyProject.controller.js index df6e8fc..47f707e 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 _0x10f1=['body','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','autoAssociation','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','clone','options','createdAt','omit','user','userProfileId','update','getSessions','findOne','JscriptySessionReport','ProjectId','filter','include','getAnswers','JscriptyAnswerReport','number','fromCharCode','toString','indexOf','getSummary','starttime','parse','startTime','-createdAt','questionId','question','format','YYYY-MM-DD\x20HH:mm:ss','answer','push','isEmpty','now','writeFileSync','setHeader','attachment;\x20filename=','Jscripty_Project_%d_Summary_%s.csv','Content-type','text/csv','download','/tmp/Jscripty_Project_%d_Summary_%s.csv','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','bluebird','mustache','path','sox','to-csv','ejs','lodash','squel','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','json','offset','limit','set','save','then','destroy','get','Projects','UserProfileResource','stack','name','index','map','rawAttributes','fieldName','type','model','query','keys','filters','intersection','fields','attributes','hasOwnProperty','nolimit','order','sort','pick','where','merge','VIRTUAL','JscriptyProject','count','includeAll','findAll','rows','catch','params','length','find','create'];(function(_0x19b84f,_0x48765e){var _0x18067b=function(_0x1c69aa){while(--_0x1c69aa){_0x19b84f['push'](_0x19b84f['shift']());}};_0x18067b(++_0x48765e);}(_0x10f1,0xa3));var _0x110f=function(_0x3153b5,_0x35af05){_0x3153b5=_0x3153b5-0x0;var _0x5d0d4e=_0x10f1[_0x3153b5];return _0x5d0d4e;};'use strict';var pdf=require(_0x110f('0x0'));var emlformat=require(_0x110f('0x1'));var rimraf=require(_0x110f('0x2'));var zipdir=require(_0x110f('0x3'));var jsonpatch=require(_0x110f('0x4'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x110f('0x5'));var Mustache=require(_0x110f('0x6'));var util=require('util');var path=require(_0x110f('0x7'));var sox=require(_0x110f('0x8'));var csv=require(_0x110f('0x9'));var ejs=require(_0x110f('0xa'));var fs=require('fs');var _=require(_0x110f('0xb'));var squel=require(_0x110f('0xc'));var crypto=require('crypto');var jsforce=require(_0x110f('0xd'));var deskjs=require('desk.js');var toCsv=require(_0x110f('0x9'));var querystring=require(_0x110f('0xe'));var Papa=require(_0x110f('0xf'));var Redis=require(_0x110f('0x10'));var authService=require(_0x110f('0x11'));var qs=require(_0x110f('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x110f('0x13'));var logger=require(_0x110f('0x14'))(_0x110f('0x15'));var utils=require(_0x110f('0x16'));var config=require(_0x110f('0x17'));var db=require(_0x110f('0x18'))['db'];function respondWithStatusCode(_0x572ac1,_0x59e9cf){_0x59e9cf=_0x59e9cf||0xcc;return function(_0x441e36){if(_0x441e36){return _0x572ac1[_0x110f('0x19')](_0x59e9cf);}return _0x572ac1[_0x110f('0x1a')](_0x59e9cf)['end']();};}function respondWithResult(_0xb7a60e,_0x18fc80){_0x18fc80=_0x18fc80||0xc8;return function(_0x9d7199){if(_0x9d7199){return _0xb7a60e[_0x110f('0x1a')](_0x18fc80)[_0x110f('0x1b')](_0x9d7199);}};}function respondWithFilteredResult(_0x381fbe,_0x1dd05c){return function(_0x56a72f){if(_0x56a72f){var _0x3fd162=_0x56a72f['count'],_0x45a7e7=_0x1dd05c[_0x110f('0x1c')],_0x251e1d=_0x1dd05c[_0x110f('0x1c')]+_0x1dd05c[_0x110f('0x1d')],_0x5a6c73;if(_0x251e1d>=_0x3fd162){_0x251e1d=_0x3fd162;_0x5a6c73=0xc8;}else{_0x5a6c73=0xce;}_0x381fbe[_0x110f('0x1a')](_0x5a6c73);return _0x381fbe[_0x110f('0x1e')]('Content-Range',_0x45a7e7+'-'+_0x251e1d+'/'+_0x3fd162)[_0x110f('0x1b')](_0x56a72f);}return null;};}function patchUpdates(_0x494f4b){return function(_0x4eca21){try{jsonpatch['apply'](_0x4eca21,_0x494f4b,!![]);}catch(_0xc5797d){return BPromise['reject'](_0xc5797d);}return _0x4eca21[_0x110f('0x1f')]();};}function saveUpdates(_0x5af10a,_0x19519d){return function(_0x4a922d){if(_0x4a922d){return _0x4a922d['update'](_0x5af10a)[_0x110f('0x20')](function(_0x432f5f){return _0x432f5f;});}return null;};}function removeEntity(_0x49815c,_0x193de2){return function(_0x686edd){if(_0x686edd){return _0x686edd[_0x110f('0x21')]()['then'](function(){var _0x252b22=_0x686edd[_0x110f('0x22')]({'plain':!![]});var _0x58b69b=_0x110f('0x23');return db[_0x110f('0x24')][_0x110f('0x21')]({'where':{'type':_0x58b69b,'resourceId':_0x252b22['id']}})[_0x110f('0x20')](function(){return _0x686edd;});})['then'](function(){_0x49815c[_0x110f('0x1a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x301efd,_0x48409d){return function(_0x3c4898){if(!_0x3c4898){_0x301efd[_0x110f('0x19')](0x194);}return _0x3c4898;};}function handleError(_0x36160,_0x411b02){_0x411b02=_0x411b02||0x1f4;return function(_0x41c309){logger['error'](_0x41c309[_0x110f('0x25')]);if(_0x41c309[_0x110f('0x26')]){delete _0x41c309['name'];}_0x36160[_0x110f('0x1a')](_0x411b02)['send'](_0x41c309);};}exports[_0x110f('0x27')]=function(_0x11e9eb,_0x2b2407){var _0x33846f={},_0x4f9176={},_0x2d9bd5={'count':0x0,'rows':[]};var _0x13a83c=_[_0x110f('0x28')](db['JscriptyProject'][_0x110f('0x29')],function(_0x430a5c){return{'name':_0x430a5c[_0x110f('0x2a')],'type':_0x430a5c[_0x110f('0x2b')]['key']};});_0x4f9176[_0x110f('0x2c')]=_[_0x110f('0x28')](_0x13a83c,_0x110f('0x26'));_0x4f9176[_0x110f('0x2d')]=_[_0x110f('0x2e')](_0x11e9eb[_0x110f('0x2d')]);_0x4f9176[_0x110f('0x2f')]=_[_0x110f('0x30')](_0x4f9176[_0x110f('0x2c')],_0x4f9176[_0x110f('0x2d')]);_0x33846f['attributes']=_['intersection'](_0x4f9176['model'],qs[_0x110f('0x31')](_0x11e9eb[_0x110f('0x2d')][_0x110f('0x31')]));_0x33846f[_0x110f('0x32')]=_0x33846f['attributes']['length']?_0x33846f['attributes']:_0x4f9176['model'];if(!_0x11e9eb[_0x110f('0x2d')][_0x110f('0x33')](_0x110f('0x34'))){_0x33846f[_0x110f('0x1d')]=qs[_0x110f('0x1d')](_0x11e9eb[_0x110f('0x2d')]['limit']);_0x33846f[_0x110f('0x1c')]=qs[_0x110f('0x1c')](_0x11e9eb['query'][_0x110f('0x1c')]);}_0x33846f[_0x110f('0x35')]=qs[_0x110f('0x36')](_0x11e9eb['query'][_0x110f('0x36')]);_0x33846f['where']=qs['filters'](_[_0x110f('0x37')](_0x11e9eb[_0x110f('0x2d')],_0x4f9176['filters']));if(_0x11e9eb[_0x110f('0x2d')]['filter']){_0x33846f[_0x110f('0x38')]=_[_0x110f('0x39')](_0x33846f[_0x110f('0x38')],{'$or':_[_0x110f('0x28')](_0x13a83c,function(_0x49f6f3){if(_0x49f6f3[_0x110f('0x2b')]!==_0x110f('0x3a')){var _0x1f4d3c={};_0x1f4d3c[_0x49f6f3[_0x110f('0x26')]]={'$like':'%'+_0x11e9eb[_0x110f('0x2d')]['filter']+'%'};return _0x1f4d3c;}})});}_0x33846f=_[_0x110f('0x39')]({},_0x33846f,_0x11e9eb['options']);var _0x3120ef={'where':_0x33846f['where']};return db[_0x110f('0x3b')][_0x110f('0x3c')](_0x3120ef)['then'](function(_0xe39813){_0x2d9bd5[_0x110f('0x3c')]=_0xe39813;if(_0x11e9eb[_0x110f('0x2d')][_0x110f('0x3d')]){_0x33846f['include']=[{'all':!![]}];}return db[_0x110f('0x3b')][_0x110f('0x3e')](_0x33846f);})[_0x110f('0x20')](function(_0x3059c2){_0x2d9bd5[_0x110f('0x3f')]=_0x3059c2;return _0x2d9bd5;})['then'](respondWithFilteredResult(_0x2b2407,_0x33846f))[_0x110f('0x40')](handleError(_0x2b2407,null));};exports['show']=function(_0x105515,_0xdd6b6f){var _0x8d417f={'raw':![],'where':{'id':_0x105515[_0x110f('0x41')]['id']}},_0x4c675d={};_0x4c675d[_0x110f('0x2c')]=_[_0x110f('0x2e')](db[_0x110f('0x3b')][_0x110f('0x29')]);_0x4c675d[_0x110f('0x2d')]=_[_0x110f('0x2e')](_0x105515[_0x110f('0x2d')]);_0x4c675d[_0x110f('0x2f')]=_[_0x110f('0x30')](_0x4c675d[_0x110f('0x2c')],_0x4c675d[_0x110f('0x2d')]);_0x8d417f[_0x110f('0x32')]=_[_0x110f('0x30')](_0x4c675d[_0x110f('0x2c')],qs[_0x110f('0x31')](_0x105515[_0x110f('0x2d')][_0x110f('0x31')]));_0x8d417f[_0x110f('0x32')]=_0x8d417f[_0x110f('0x32')][_0x110f('0x42')]?_0x8d417f['attributes']:_0x4c675d[_0x110f('0x2c')];if(_0x105515['query']['includeAll']){_0x8d417f['include']=[{'all':!![]}];}_0x8d417f=_[_0x110f('0x39')]({},_0x8d417f,_0x105515['options']);return db[_0x110f('0x3b')][_0x110f('0x43')](_0x8d417f)[_0x110f('0x20')](handleEntityNotFound(_0xdd6b6f,null))[_0x110f('0x20')](respondWithResult(_0xdd6b6f,null))[_0x110f('0x40')](handleError(_0xdd6b6f,null));};exports[_0x110f('0x44')]=function(_0x5ea092,_0x280543){return db['JscriptyProject'][_0x110f('0x44')](_0x5ea092[_0x110f('0x45')],{})[_0x110f('0x20')](function(_0x232f62){var _0x59fe89=_0x5ea092['user'][_0x110f('0x22')]({'plain':!![]});if(!_0x59fe89)throw new Error(_0x110f('0x46'));if(_0x59fe89[_0x110f('0x47')]==='user'){var _0x58448=_0x232f62[_0x110f('0x22')]({'plain':!![]});var _0x497804=_0x110f('0x23');return db[_0x110f('0x48')]['find']({'where':{'name':_0x497804,'userProfileId':_0x59fe89['userProfileId']},'raw':!![]})[_0x110f('0x20')](function(_0x4306a1){if(_0x4306a1&&_0x4306a1[_0x110f('0x49')]===0x0){return db[_0x110f('0x24')]['create']({'name':_0x58448[_0x110f('0x26')],'resourceId':_0x58448['id'],'type':_0x4306a1[_0x110f('0x26')],'sectionId':_0x4306a1['id']},{})[_0x110f('0x20')](function(){return _0x232f62;});}else{return _0x232f62;}})[_0x110f('0x40')](function(_0x1daa53){logger[_0x110f('0x4a')](_0x110f('0x4b'),_0x1daa53);throw _0x1daa53;});}return _0x232f62;})[_0x110f('0x20')](respondWithResult(_0x280543,0xc9))[_0x110f('0x40')](handleError(_0x280543,null));};exports[_0x110f('0x4c')]=function(_0xe0e101,_0x40d32b){var _0x284668={'where':{'id':_0xe0e101[_0x110f('0x41')]['id']}},_0x4a0ee2={};_0x4a0ee2[_0x110f('0x2c')]=_[_0x110f('0x2e')](db['JscriptyProject'][_0x110f('0x29')]);_0x284668['attributes']=_[_0x110f('0x30')](_0x4a0ee2[_0x110f('0x2c')],qs[_0x110f('0x31')](_0xe0e101[_0x110f('0x2d')]['fields']));_0x284668[_0x110f('0x32')]=_0x284668[_0x110f('0x32')][_0x110f('0x42')]?_0x284668[_0x110f('0x32')]:_0x4a0ee2[_0x110f('0x2c')];if(_0xe0e101[_0x110f('0x2d')][_0x110f('0x3d')]){_0x284668['include']=[{'all':!![]}];}_0x284668=_[_0x110f('0x39')]({},_0x284668,_0xe0e101[_0x110f('0x4d')]);return db[_0x110f('0x3b')][_0x110f('0x43')](_0x284668)[_0x110f('0x20')](handleEntityNotFound(_0x40d32b,null))[_0x110f('0x20')](function(_0x37984c){if(_0x37984c){var _0x3ef73f=_0x37984c[_0x110f('0x22')]({'plain':!![]});_0x3ef73f=qs['omit'](_0x3ef73f,['id',_0x110f('0x4e'),'updatedAt']);_0xe0e101['body']=_[_0x110f('0x4f')](_0xe0e101[_0x110f('0x45')],['id','createdAt','updatedAt']);return db['JscriptyProject']['create'](_[_0x110f('0x39')](_0x3ef73f,_0xe0e101['body']),{'include':_0xe0e101[_0x110f('0x2d')]['includeAll']?[{'all':!![]}]:undefined})[_0x110f('0x20')](function(_0x1cbb19){var _0x2b813f=_0xe0e101[_0x110f('0x50')][_0x110f('0x22')]({'plain':!![]});if(!_0x2b813f)throw new Error(_0x110f('0x46'));if(_0x2b813f[_0x110f('0x47')]==='user'){var _0x470695=_0x1cbb19['get']({'plain':!![]});var _0x4f49a7=_0x110f('0x23');return db['UserProfileSection'][_0x110f('0x43')]({'where':{'name':_0x4f49a7,'userProfileId':_0x2b813f[_0x110f('0x51')]},'raw':!![]})['then'](function(_0x2516db){if(_0x2516db&&_0x2516db['autoAssociation']===0x0){return db[_0x110f('0x24')][_0x110f('0x44')]({'name':_0x470695['name'],'resourceId':_0x470695['id'],'type':_0x2516db[_0x110f('0x26')],'sectionId':_0x2516db['id']},{})[_0x110f('0x20')](function(){return _0x1cbb19;});}else{return _0x1cbb19;}})[_0x110f('0x40')](function(_0x3d422d){logger[_0x110f('0x4a')](_0x110f('0x4b'),_0x3d422d);throw _0x3d422d;});}return _0x1cbb19;});}})['then'](respondWithResult(_0x40d32b,0xc9))[_0x110f('0x40')](handleError(_0x40d32b,null));};exports[_0x110f('0x52')]=function(_0x32f649,_0x135501){if(_0x32f649['body']['id']){delete _0x32f649[_0x110f('0x45')]['id'];}return db[_0x110f('0x3b')]['find']({'where':{'id':_0x32f649[_0x110f('0x41')]['id']}})[_0x110f('0x20')](handleEntityNotFound(_0x135501,null))[_0x110f('0x20')](saveUpdates(_0x32f649['body'],null))[_0x110f('0x20')](respondWithResult(_0x135501,null))['catch'](handleError(_0x135501,null));};exports[_0x110f('0x21')]=function(_0xdb913d,_0x106ddc){return db['JscriptyProject'][_0x110f('0x43')]({'where':{'id':_0xdb913d['params']['id']}})[_0x110f('0x20')](handleEntityNotFound(_0x106ddc,null))[_0x110f('0x20')](removeEntity(_0x106ddc,null))[_0x110f('0x40')](handleError(_0x106ddc,null));};exports[_0x110f('0x53')]=function(_0x1b1ad4,_0x5f2cda,_0x12dcf0){var _0x3f7e18={'raw':!![],'where':{}};var _0x2f5557={};var _0x2b5845={'count':0x0,'rows':[]};return db[_0x110f('0x3b')][_0x110f('0x54')]({'where':{'id':_0x1b1ad4[_0x110f('0x41')]['id']}})[_0x110f('0x20')](handleEntityNotFound(_0x5f2cda,null))[_0x110f('0x20')](function(_0x54a178){if(_0x54a178){_0x2f5557[_0x110f('0x2c')]=_[_0x110f('0x2e')](db[_0x110f('0x55')][_0x110f('0x29')]);_0x2f5557[_0x110f('0x2d')]=_['keys'](_0x1b1ad4[_0x110f('0x2d')]);_0x2f5557[_0x110f('0x2f')]=_[_0x110f('0x30')](_0x2f5557[_0x110f('0x2c')],_0x2f5557['query']);_0x3f7e18[_0x110f('0x32')]=_[_0x110f('0x30')](_0x2f5557['model'],qs['fields'](_0x1b1ad4[_0x110f('0x2d')][_0x110f('0x31')]));_0x3f7e18[_0x110f('0x32')]=_0x3f7e18['attributes'][_0x110f('0x42')]?_0x3f7e18[_0x110f('0x32')]:_0x2f5557[_0x110f('0x2c')];if(!_0x1b1ad4[_0x110f('0x2d')]['hasOwnProperty'](_0x110f('0x34'))){_0x3f7e18[_0x110f('0x1d')]=qs[_0x110f('0x1d')](_0x1b1ad4[_0x110f('0x2d')][_0x110f('0x1d')]);_0x3f7e18[_0x110f('0x1c')]=qs[_0x110f('0x1c')](_0x1b1ad4[_0x110f('0x2d')][_0x110f('0x1c')]);}_0x3f7e18[_0x110f('0x35')]=qs[_0x110f('0x36')](_0x1b1ad4['query']['sort']);_0x3f7e18['where']=qs[_0x110f('0x2f')](_['pick'](_0x1b1ad4['query'],_0x2f5557['filters']));_0x3f7e18[_0x110f('0x38')][_0x110f('0x56')]=_0x54a178['id'];if(_0x1b1ad4[_0x110f('0x2d')][_0x110f('0x57')]){_0x3f7e18[_0x110f('0x38')]=_[_0x110f('0x39')](_0x3f7e18[_0x110f('0x38')],{'$or':_[_0x110f('0x28')](_0x3f7e18['attributes'],function(_0x18ee6c){var _0x3caa67={};_0x3caa67[_0x18ee6c]={'$like':'%'+_0x1b1ad4['query'][_0x110f('0x57')]+'%'};return _0x3caa67;})});}_0x3f7e18=_['merge']({},_0x3f7e18,_0x1b1ad4[_0x110f('0x4d')]);return db[_0x110f('0x55')]['count']({'where':_0x3f7e18['where']})[_0x110f('0x20')](function(_0xf56f3c){_0x2b5845['count']=_0xf56f3c;if(_0x1b1ad4[_0x110f('0x2d')][_0x110f('0x3d')]){_0x3f7e18[_0x110f('0x58')]=[{'all':!![]}];}return db[_0x110f('0x55')][_0x110f('0x3e')](_0x3f7e18);})[_0x110f('0x20')](function(_0x1bb10b){_0x2b5845[_0x110f('0x3f')]=_0x1bb10b;return _0x2b5845;});}})[_0x110f('0x20')](respondWithFilteredResult(_0x5f2cda,_0x3f7e18))['catch'](handleError(_0x5f2cda,null));};exports[_0x110f('0x59')]=function(_0x5e4b81,_0x296168,_0x4b42bc){var _0x560f1c={'raw':!![],'where':{}};var _0x12b4d0={};var _0x762f45={'count':0x0,'rows':[]};return db[_0x110f('0x3b')][_0x110f('0x54')]({'where':{'id':_0x5e4b81[_0x110f('0x41')]['id']}})[_0x110f('0x20')](handleEntityNotFound(_0x296168,null))[_0x110f('0x20')](function(_0x186c3b){if(_0x186c3b){_0x12b4d0['model']=_[_0x110f('0x2e')](db[_0x110f('0x5a')]['rawAttributes']);_0x12b4d0[_0x110f('0x2d')]=_['keys'](_0x5e4b81[_0x110f('0x2d')]);_0x12b4d0[_0x110f('0x2f')]=_['intersection'](_0x12b4d0['model'],_0x12b4d0[_0x110f('0x2d')]);_0x560f1c[_0x110f('0x32')]=_[_0x110f('0x30')](_0x12b4d0[_0x110f('0x2c')],qs[_0x110f('0x31')](_0x5e4b81[_0x110f('0x2d')][_0x110f('0x31')]));_0x560f1c[_0x110f('0x32')]=_0x560f1c[_0x110f('0x32')][_0x110f('0x42')]?_0x560f1c[_0x110f('0x32')]:_0x12b4d0['model'];if(!_0x5e4b81[_0x110f('0x2d')][_0x110f('0x33')](_0x110f('0x34'))){_0x560f1c[_0x110f('0x1d')]=qs[_0x110f('0x1d')](_0x5e4b81['query']['limit']);_0x560f1c[_0x110f('0x1c')]=qs[_0x110f('0x1c')](_0x5e4b81[_0x110f('0x2d')][_0x110f('0x1c')]);}_0x560f1c[_0x110f('0x35')]=qs[_0x110f('0x36')](_0x5e4b81[_0x110f('0x2d')][_0x110f('0x36')]);_0x560f1c['where']=qs[_0x110f('0x2f')](_[_0x110f('0x37')](_0x5e4b81[_0x110f('0x2d')],_0x12b4d0[_0x110f('0x2f')]));_0x560f1c[_0x110f('0x38')][_0x110f('0x56')]=_0x186c3b['id'];if(_0x5e4b81[_0x110f('0x2d')]['filter']){_0x560f1c[_0x110f('0x38')]=_[_0x110f('0x39')](_0x560f1c['where'],{'$or':_[_0x110f('0x28')](_0x560f1c[_0x110f('0x32')],function(_0x603a59){var _0x4ee432={};_0x4ee432[_0x603a59]={'$like':'%'+_0x5e4b81[_0x110f('0x2d')][_0x110f('0x57')]+'%'};return _0x4ee432;})});}_0x560f1c=_['merge']({},_0x560f1c,_0x5e4b81['options']);return db[_0x110f('0x5a')][_0x110f('0x3c')]({'where':_0x560f1c['where']})[_0x110f('0x20')](function(_0x5e9388){_0x762f45[_0x110f('0x3c')]=_0x5e9388;if(_0x5e4b81[_0x110f('0x2d')][_0x110f('0x3d')]){_0x560f1c['include']=[{'all':!![]}];}return db[_0x110f('0x5a')][_0x110f('0x3e')](_0x560f1c);})['then'](function(_0x4a0171){_0x762f45['rows']=_0x4a0171;return _0x762f45;});}})[_0x110f('0x20')](respondWithFilteredResult(_0x296168,_0x560f1c))['catch'](handleError(_0x296168,null));};function char(_0x2cdbc0){return _0x110f('0x5b')===typeof _0x2cdbc0?String[_0x110f('0x5c')]['apply'](null,arguments):_0x2cdbc0;}function needsEncapsulation(_0x202b0e){return!!_0x202b0e&&(_0x202b0e[_0x110f('0x5d')]()[_0x110f('0x5e')](char(0xd))>=0x0||_0x202b0e[_0x110f('0x5d')]()[_0x110f('0x5e')](char(0xa))>=0x0||_0x202b0e[_0x110f('0x5d')]()['indexOf'](char(0x2c))>=0x0||_0x202b0e[_0x110f('0x5d')]()[_0x110f('0x5e')](char(0x22))>=0x0);}function encapsulate(_0x4dfbb9){var _0x2c4c97=char(0x22),_0x326931='\x5c'+char(0x22),_0x5c9b7c=_0x4dfbb9[_0x110f('0x5d')]()['replace'](new RegExp(_0x2c4c97,'g'),_0x326931);return _0x2c4c97+_0x5c9b7c+_0x2c4c97;}exports[_0x110f('0x5f')]=function(_0x15d7d8,_0x104410,_0x2c7551){var _0x3e4913,_0x2aff08;var _0x38d731={'where':{'ProjectId':_0x15d7d8[_0x110f('0x41')]['id']}};if(_0x15d7d8['query']['startTime']){_0x38d731[_0x110f('0x38')][_0x110f('0x60')]=JSON[_0x110f('0x61')](_0x15d7d8[_0x110f('0x2d')][_0x110f('0x62')]);}return db[_0x110f('0x55')][_0x110f('0x3e')](_0x38d731)['then'](handleEntityNotFound(_0x104410,null))[_0x110f('0x20')](function(_0x3a354a){if(_0x3a354a){_0x3e4913=_0x3a354a;return db['JscriptyQuestionReport']['findAll']({'where':{'SessionId':{'$in':_[_0x110f('0x28')](_0x3e4913,'id')},'ProjectId':_0x15d7d8[_0x110f('0x41')]['id']},'order':_0x110f('0x63')});}})['then'](handleEntityNotFound(_0x104410,null))[_0x110f('0x20')](function(_0x3b64b7){if(_0x3b64b7){_0x2aff08=_0x3b64b7;var _0x1e5697={};for(var _0x2cf354=0x0,_0x43b1d3=_0x2aff08[_0x110f('0x42')];_0x2cf354<_0x43b1d3;_0x2cf354++){if(!_0x1e5697[_0x110f('0x33')](_0x2aff08[_0x2cf354][_0x110f('0x64')])){_0x1e5697[_0x2aff08[_0x2cf354]['questionId']]=needsEncapsulation(_0x2aff08[_0x2cf354][_0x110f('0x65')])?encapsulate(_0x2aff08[_0x2cf354][_0x110f('0x65')]):_0x2aff08[_0x2cf354][_0x110f('0x65')];}}var _0x40bb90=[],_0xa0385d={};for(var _0x329f69=0x0,_0x1a347c=_0x3e4913[_0x110f('0x42')];_0x329f69<_0x1a347c;_0x329f69++){_0xa0385d={'ProjectId':_0x15d7d8[_0x110f('0x41')]['id'],'SessionId':_0x3e4913[_0x329f69]['id'],'StartTime':moment(_0x3e4913[_0x329f69][_0x110f('0x60')])[_0x110f('0x66')](_0x110f('0x67'))};for(var _0x2a191b=0x0,_0x30b9b8=_0x2aff08[_0x110f('0x42')];_0x2a191b<_0x30b9b8;_0x2a191b++){if(_0x2aff08[_0x2a191b]['SessionId']==_0x3e4913[_0x329f69]['id']&&_0x1e5697[_0x110f('0x33')](_0x2aff08[_0x2a191b][_0x110f('0x64')])){_0xa0385d[_0x1e5697[_0x2aff08[_0x2a191b]['questionId']]]=_0x2aff08[_0x2a191b][_0x110f('0x68')];}}for(var _0x5927b7 in _0x1e5697){if(!_0xa0385d[_0x110f('0x33')](_0x1e5697[_0x5927b7])){_0xa0385d[_0x1e5697[_0x5927b7]]=null;}}_0x40bb90[_0x110f('0x69')](_0xa0385d);}return _0x40bb90;}})[_0x110f('0x20')](function(_0x4fd6ba){if(!_[_0x110f('0x6a')](_0x4fd6ba)){var _0x46d930=toCsv(_0x4fd6ba);var _0xb5717b=Date[_0x110f('0x6b')]();fs[_0x110f('0x6c')](util[_0x110f('0x66')]('/tmp/Jscripty_Project_%d_Summary_%s.csv',_0x15d7d8[_0x110f('0x41')]['id'],_0xb5717b),_0x46d930);_0x104410[_0x110f('0x6d')]('Content-disposition',_0x110f('0x6e')+util[_0x110f('0x66')](_0x110f('0x6f'),_0x15d7d8[_0x110f('0x41')]['id'],_0xb5717b));_0x104410[_0x110f('0x6d')](_0x110f('0x70'),_0x110f('0x71'));return _0x104410[_0x110f('0x72')](util[_0x110f('0x66')](_0x110f('0x73'),_0x15d7d8['params']['id'],_0xb5717b));}else{return _0x104410[_0x110f('0x19')](0xcc);}})[_0x110f('0x40')](handleError(_0x104410,null));}; \ No newline at end of file +var _0xaad3=['limit','order','filters','filter','where','merge','options','includeAll','include','findAll','show','params','keys','find','create','Unable\x20to\x20retrieve\x20the\x20current\x20user','user','UserProfileSection','userProfileId','autoAssociation','catch','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','clone','omit','createdAt','updatedAt','body','role','getSessions','findOne','nolimit','sort','pick','ProjectId','JscriptySessionReport','rows','getAnswers','JscriptyAnswerReport','number','fromCharCode','toString','indexOf','replace','getSummary','startTime','starttime','parse','-createdAt','questionId','question','format','answer','push','isEmpty','now','/tmp/Jscripty_Project_%d_Summary_%s.csv','Content-disposition','attachment;\x20filename=','Jscripty_Project_%d_Summary_%s.csv','Content-type','text/csv','download','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','path','sox','to-csv','ejs','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../mysqldb','status','end','json','count','offset','Content-Range','apply','save','update','then','destroy','get','Projects','UserProfileResource','sendStatus','error','name','send','map','JscriptyProject','rawAttributes','fieldName','type','key','model','query','intersection','attributes','fields','length','hasOwnProperty'];(function(_0x35bb93,_0x658b41){var _0x5e34fb=function(_0x49b9d0){while(--_0x49b9d0){_0x35bb93['push'](_0x35bb93['shift']());}};_0x5e34fb(++_0x658b41);}(_0xaad3,0xb2));var _0x3aad=function(_0x4d4065,_0x552d1e){_0x4d4065=_0x4d4065-0x0;var _0x475a23=_0xaad3[_0x4d4065];return _0x475a23;};'use strict';var pdf=require(_0x3aad('0x0'));var emlformat=require(_0x3aad('0x1'));var rimraf=require(_0x3aad('0x2'));var zipdir=require(_0x3aad('0x3'));var jsonpatch=require(_0x3aad('0x4'));var rp=require(_0x3aad('0x5'));var moment=require(_0x3aad('0x6'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require('util');var path=require(_0x3aad('0x7'));var sox=require(_0x3aad('0x8'));var csv=require(_0x3aad('0x9'));var ejs=require(_0x3aad('0xa'));var fs=require('fs');var _=require('lodash');var squel=require(_0x3aad('0xb'));var crypto=require(_0x3aad('0xc'));var jsforce=require(_0x3aad('0xd'));var deskjs=require(_0x3aad('0xe'));var toCsv=require('to-csv');var querystring=require(_0x3aad('0xf'));var Papa=require(_0x3aad('0x10'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x3aad('0x11'));var as=require(_0x3aad('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x3aad('0x13'))(_0x3aad('0x14'));var utils=require(_0x3aad('0x15'));var config=require('../../config/environment');var db=require(_0x3aad('0x16'))['db'];function respondWithStatusCode(_0xc1bde,_0x5c05e5){_0x5c05e5=_0x5c05e5||0xcc;return function(_0x5e5186){if(_0x5e5186){return _0xc1bde['sendStatus'](_0x5c05e5);}return _0xc1bde[_0x3aad('0x17')](_0x5c05e5)[_0x3aad('0x18')]();};}function respondWithResult(_0x4e51f1,_0x48c1fe){_0x48c1fe=_0x48c1fe||0xc8;return function(_0x100218){if(_0x100218){return _0x4e51f1['status'](_0x48c1fe)[_0x3aad('0x19')](_0x100218);}};}function respondWithFilteredResult(_0x3470ce,_0x7644c){return function(_0x4a3557){if(_0x4a3557){var _0xb90f0f=_0x4a3557[_0x3aad('0x1a')],_0x30e5f3=_0x7644c['offset'],_0x1addd0=_0x7644c[_0x3aad('0x1b')]+_0x7644c['limit'],_0x18f19e;if(_0x1addd0>=_0xb90f0f){_0x1addd0=_0xb90f0f;_0x18f19e=0xc8;}else{_0x18f19e=0xce;}_0x3470ce[_0x3aad('0x17')](_0x18f19e);return _0x3470ce['set'](_0x3aad('0x1c'),_0x30e5f3+'-'+_0x1addd0+'/'+_0xb90f0f)['json'](_0x4a3557);}return null;};}function patchUpdates(_0x9809fd){return function(_0x8c7061){try{jsonpatch[_0x3aad('0x1d')](_0x8c7061,_0x9809fd,!![]);}catch(_0x48692d){return BPromise['reject'](_0x48692d);}return _0x8c7061[_0x3aad('0x1e')]();};}function saveUpdates(_0xfbeafa,_0xc328c9){return function(_0x31d5b2){if(_0x31d5b2){return _0x31d5b2[_0x3aad('0x1f')](_0xfbeafa)[_0x3aad('0x20')](function(_0x1630d5){return _0x1630d5;});}return null;};}function removeEntity(_0xfa60c8,_0x2b9878){return function(_0xe6bb34){if(_0xe6bb34){return _0xe6bb34[_0x3aad('0x21')]()[_0x3aad('0x20')](function(){var _0x13bb35=_0xe6bb34[_0x3aad('0x22')]({'plain':!![]});var _0x11a20e=_0x3aad('0x23');return db[_0x3aad('0x24')][_0x3aad('0x21')]({'where':{'type':_0x11a20e,'resourceId':_0x13bb35['id']}})[_0x3aad('0x20')](function(){return _0xe6bb34;});})[_0x3aad('0x20')](function(){_0xfa60c8[_0x3aad('0x17')](0xcc)[_0x3aad('0x18')]();});}};}function handleEntityNotFound(_0x456eb9,_0x2fa630){return function(_0xab9b1e){if(!_0xab9b1e){_0x456eb9[_0x3aad('0x25')](0x194);}return _0xab9b1e;};}function handleError(_0x1b3223,_0xf34acb){_0xf34acb=_0xf34acb||0x1f4;return function(_0x394d6a){logger[_0x3aad('0x26')](_0x394d6a['stack']);if(_0x394d6a[_0x3aad('0x27')]){delete _0x394d6a[_0x3aad('0x27')];}_0x1b3223[_0x3aad('0x17')](_0xf34acb)[_0x3aad('0x28')](_0x394d6a);};}exports['index']=function(_0x1187fc,_0x5167d9){var _0x40f81e={},_0x2bb3b4={},_0x3b7f23={'count':0x0,'rows':[]};var _0x7d3d34=_[_0x3aad('0x29')](db[_0x3aad('0x2a')][_0x3aad('0x2b')],function(_0x3b57e1){return{'name':_0x3b57e1[_0x3aad('0x2c')],'type':_0x3b57e1[_0x3aad('0x2d')][_0x3aad('0x2e')]};});_0x2bb3b4[_0x3aad('0x2f')]=_[_0x3aad('0x29')](_0x7d3d34,_0x3aad('0x27'));_0x2bb3b4[_0x3aad('0x30')]=_['keys'](_0x1187fc[_0x3aad('0x30')]);_0x2bb3b4['filters']=_[_0x3aad('0x31')](_0x2bb3b4['model'],_0x2bb3b4['query']);_0x40f81e[_0x3aad('0x32')]=_['intersection'](_0x2bb3b4[_0x3aad('0x2f')],qs[_0x3aad('0x33')](_0x1187fc[_0x3aad('0x30')][_0x3aad('0x33')]));_0x40f81e[_0x3aad('0x32')]=_0x40f81e[_0x3aad('0x32')][_0x3aad('0x34')]?_0x40f81e['attributes']:_0x2bb3b4[_0x3aad('0x2f')];if(!_0x1187fc[_0x3aad('0x30')][_0x3aad('0x35')]('nolimit')){_0x40f81e[_0x3aad('0x36')]=qs[_0x3aad('0x36')](_0x1187fc['query'][_0x3aad('0x36')]);_0x40f81e[_0x3aad('0x1b')]=qs['offset'](_0x1187fc[_0x3aad('0x30')][_0x3aad('0x1b')]);}_0x40f81e[_0x3aad('0x37')]=qs['sort'](_0x1187fc[_0x3aad('0x30')]['sort']);_0x40f81e['where']=qs[_0x3aad('0x38')](_['pick'](_0x1187fc[_0x3aad('0x30')],_0x2bb3b4[_0x3aad('0x38')]));if(_0x1187fc[_0x3aad('0x30')][_0x3aad('0x39')]){_0x40f81e[_0x3aad('0x3a')]=_[_0x3aad('0x3b')](_0x40f81e[_0x3aad('0x3a')],{'$or':_[_0x3aad('0x29')](_0x7d3d34,function(_0x3c93ec){if(_0x3c93ec[_0x3aad('0x2d')]!=='VIRTUAL'){var _0x4f7926={};_0x4f7926[_0x3c93ec[_0x3aad('0x27')]]={'$like':'%'+_0x1187fc['query'][_0x3aad('0x39')]+'%'};return _0x4f7926;}})});}_0x40f81e=_['merge']({},_0x40f81e,_0x1187fc[_0x3aad('0x3c')]);var _0x141e43={'where':_0x40f81e[_0x3aad('0x3a')]};return db['JscriptyProject'][_0x3aad('0x1a')](_0x141e43)[_0x3aad('0x20')](function(_0x19f2bc){_0x3b7f23[_0x3aad('0x1a')]=_0x19f2bc;if(_0x1187fc[_0x3aad('0x30')][_0x3aad('0x3d')]){_0x40f81e[_0x3aad('0x3e')]=[{'all':!![]}];}return db[_0x3aad('0x2a')][_0x3aad('0x3f')](_0x40f81e);})[_0x3aad('0x20')](function(_0x4429ce){_0x3b7f23['rows']=_0x4429ce;return _0x3b7f23;})[_0x3aad('0x20')](respondWithFilteredResult(_0x5167d9,_0x40f81e))['catch'](handleError(_0x5167d9,null));};exports[_0x3aad('0x40')]=function(_0x1b3ca8,_0x57691f){var _0x339522={'raw':![],'where':{'id':_0x1b3ca8[_0x3aad('0x41')]['id']}},_0x24ae89={};_0x24ae89[_0x3aad('0x2f')]=_[_0x3aad('0x42')](db['JscriptyProject']['rawAttributes']);_0x24ae89[_0x3aad('0x30')]=_['keys'](_0x1b3ca8[_0x3aad('0x30')]);_0x24ae89[_0x3aad('0x38')]=_[_0x3aad('0x31')](_0x24ae89[_0x3aad('0x2f')],_0x24ae89[_0x3aad('0x30')]);_0x339522[_0x3aad('0x32')]=_[_0x3aad('0x31')](_0x24ae89[_0x3aad('0x2f')],qs[_0x3aad('0x33')](_0x1b3ca8[_0x3aad('0x30')]['fields']));_0x339522['attributes']=_0x339522[_0x3aad('0x32')][_0x3aad('0x34')]?_0x339522[_0x3aad('0x32')]:_0x24ae89[_0x3aad('0x2f')];if(_0x1b3ca8[_0x3aad('0x30')][_0x3aad('0x3d')]){_0x339522[_0x3aad('0x3e')]=[{'all':!![]}];}_0x339522=_[_0x3aad('0x3b')]({},_0x339522,_0x1b3ca8[_0x3aad('0x3c')]);return db[_0x3aad('0x2a')][_0x3aad('0x43')](_0x339522)[_0x3aad('0x20')](handleEntityNotFound(_0x57691f,null))['then'](respondWithResult(_0x57691f,null))['catch'](handleError(_0x57691f,null));};exports[_0x3aad('0x44')]=function(_0x35ffd7,_0x219202){return db[_0x3aad('0x2a')][_0x3aad('0x44')](_0x35ffd7['body'],{})[_0x3aad('0x20')](function(_0x1c1db8){var _0x54994f=_0x35ffd7['user'][_0x3aad('0x22')]({'plain':!![]});if(!_0x54994f)throw new Error(_0x3aad('0x45'));if(_0x54994f['role']===_0x3aad('0x46')){var _0x38886=_0x1c1db8['get']({'plain':!![]});var _0x54dc3a='Projects';return db[_0x3aad('0x47')][_0x3aad('0x43')]({'where':{'name':_0x54dc3a,'userProfileId':_0x54994f[_0x3aad('0x48')]},'raw':!![]})['then'](function(_0x480352){if(_0x480352&&_0x480352[_0x3aad('0x49')]===0x0){return db['UserProfileResource'][_0x3aad('0x44')]({'name':_0x38886['name'],'resourceId':_0x38886['id'],'type':_0x480352[_0x3aad('0x27')],'sectionId':_0x480352['id']},{})['then'](function(){return _0x1c1db8;});}else{return _0x1c1db8;}})[_0x3aad('0x4a')](function(_0x312862){logger[_0x3aad('0x26')](_0x3aad('0x4b'),_0x312862);throw _0x312862;});}return _0x1c1db8;})[_0x3aad('0x20')](respondWithResult(_0x219202,0xc9))[_0x3aad('0x4a')](handleError(_0x219202,null));};exports[_0x3aad('0x4c')]=function(_0x3b7d96,_0x40cd41){var _0x3c86e5={'where':{'id':_0x3b7d96[_0x3aad('0x41')]['id']}},_0x354fb4={};_0x354fb4['model']=_[_0x3aad('0x42')](db[_0x3aad('0x2a')]['rawAttributes']);_0x3c86e5[_0x3aad('0x32')]=_['intersection'](_0x354fb4[_0x3aad('0x2f')],qs[_0x3aad('0x33')](_0x3b7d96[_0x3aad('0x30')]['fields']));_0x3c86e5[_0x3aad('0x32')]=_0x3c86e5['attributes'][_0x3aad('0x34')]?_0x3c86e5[_0x3aad('0x32')]:_0x354fb4[_0x3aad('0x2f')];if(_0x3b7d96['query'][_0x3aad('0x3d')]){_0x3c86e5[_0x3aad('0x3e')]=[{'all':!![]}];}_0x3c86e5=_[_0x3aad('0x3b')]({},_0x3c86e5,_0x3b7d96[_0x3aad('0x3c')]);return db['JscriptyProject'][_0x3aad('0x43')](_0x3c86e5)['then'](handleEntityNotFound(_0x40cd41,null))[_0x3aad('0x20')](function(_0x2d6138){if(_0x2d6138){var _0x51e25f=_0x2d6138['get']({'plain':!![]});_0x51e25f=qs[_0x3aad('0x4d')](_0x51e25f,['id',_0x3aad('0x4e'),_0x3aad('0x4f')]);_0x3b7d96[_0x3aad('0x50')]=_[_0x3aad('0x4d')](_0x3b7d96['body'],['id',_0x3aad('0x4e'),'updatedAt']);return db[_0x3aad('0x2a')]['create'](_[_0x3aad('0x3b')](_0x51e25f,_0x3b7d96[_0x3aad('0x50')]),{'include':_0x3b7d96['query']['includeAll']?[{'all':!![]}]:undefined})[_0x3aad('0x20')](function(_0x20e07e){var _0x3175e3=_0x3b7d96[_0x3aad('0x46')][_0x3aad('0x22')]({'plain':!![]});if(!_0x3175e3)throw new Error(_0x3aad('0x45'));if(_0x3175e3[_0x3aad('0x51')]===_0x3aad('0x46')){var _0x13d0eb=_0x20e07e[_0x3aad('0x22')]({'plain':!![]});var _0x12b6d6=_0x3aad('0x23');return db['UserProfileSection']['find']({'where':{'name':_0x12b6d6,'userProfileId':_0x3175e3['userProfileId']},'raw':!![]})[_0x3aad('0x20')](function(_0x36d3ed){if(_0x36d3ed&&_0x36d3ed['autoAssociation']===0x0){return db[_0x3aad('0x24')][_0x3aad('0x44')]({'name':_0x13d0eb['name'],'resourceId':_0x13d0eb['id'],'type':_0x36d3ed[_0x3aad('0x27')],'sectionId':_0x36d3ed['id']},{})[_0x3aad('0x20')](function(){return _0x20e07e;});}else{return _0x20e07e;}})[_0x3aad('0x4a')](function(_0x37ccd4){logger[_0x3aad('0x26')](_0x3aad('0x4b'),_0x37ccd4);throw _0x37ccd4;});}return _0x20e07e;});}})[_0x3aad('0x20')](respondWithResult(_0x40cd41,0xc9))[_0x3aad('0x4a')](handleError(_0x40cd41,null));};exports[_0x3aad('0x1f')]=function(_0x4ba069,_0x2b6d03){if(_0x4ba069['body']['id']){delete _0x4ba069['body']['id'];}return db[_0x3aad('0x2a')][_0x3aad('0x43')]({'where':{'id':_0x4ba069['params']['id']}})[_0x3aad('0x20')](handleEntityNotFound(_0x2b6d03,null))['then'](saveUpdates(_0x4ba069[_0x3aad('0x50')],null))['then'](respondWithResult(_0x2b6d03,null))['catch'](handleError(_0x2b6d03,null));};exports[_0x3aad('0x21')]=function(_0x2f24bc,_0x395448){return db[_0x3aad('0x2a')]['find']({'where':{'id':_0x2f24bc[_0x3aad('0x41')]['id']}})[_0x3aad('0x20')](handleEntityNotFound(_0x395448,null))[_0x3aad('0x20')](removeEntity(_0x395448,null))[_0x3aad('0x4a')](handleError(_0x395448,null));};exports[_0x3aad('0x52')]=function(_0x1a9d45,_0x45c0cc,_0x31d38b){var _0x25127c={'raw':!![],'where':{}};var _0x729aba={};var _0x54910d={'count':0x0,'rows':[]};return db[_0x3aad('0x2a')][_0x3aad('0x53')]({'where':{'id':_0x1a9d45[_0x3aad('0x41')]['id']}})[_0x3aad('0x20')](handleEntityNotFound(_0x45c0cc,null))[_0x3aad('0x20')](function(_0x4af4ff){if(_0x4af4ff){_0x729aba[_0x3aad('0x2f')]=_['keys'](db['JscriptySessionReport']['rawAttributes']);_0x729aba[_0x3aad('0x30')]=_[_0x3aad('0x42')](_0x1a9d45[_0x3aad('0x30')]);_0x729aba[_0x3aad('0x38')]=_['intersection'](_0x729aba['model'],_0x729aba['query']);_0x25127c['attributes']=_[_0x3aad('0x31')](_0x729aba[_0x3aad('0x2f')],qs[_0x3aad('0x33')](_0x1a9d45[_0x3aad('0x30')][_0x3aad('0x33')]));_0x25127c[_0x3aad('0x32')]=_0x25127c[_0x3aad('0x32')][_0x3aad('0x34')]?_0x25127c[_0x3aad('0x32')]:_0x729aba['model'];if(!_0x1a9d45[_0x3aad('0x30')][_0x3aad('0x35')](_0x3aad('0x54'))){_0x25127c[_0x3aad('0x36')]=qs[_0x3aad('0x36')](_0x1a9d45[_0x3aad('0x30')][_0x3aad('0x36')]);_0x25127c['offset']=qs[_0x3aad('0x1b')](_0x1a9d45['query'][_0x3aad('0x1b')]);}_0x25127c['order']=qs[_0x3aad('0x55')](_0x1a9d45[_0x3aad('0x30')][_0x3aad('0x55')]);_0x25127c['where']=qs[_0x3aad('0x38')](_[_0x3aad('0x56')](_0x1a9d45['query'],_0x729aba[_0x3aad('0x38')]));_0x25127c[_0x3aad('0x3a')][_0x3aad('0x57')]=_0x4af4ff['id'];if(_0x1a9d45[_0x3aad('0x30')][_0x3aad('0x39')]){_0x25127c[_0x3aad('0x3a')]=_['merge'](_0x25127c[_0x3aad('0x3a')],{'$or':_[_0x3aad('0x29')](_0x25127c[_0x3aad('0x32')],function(_0x2e61c4){var _0xadaa2d={};_0xadaa2d[_0x2e61c4]={'$like':'%'+_0x1a9d45[_0x3aad('0x30')]['filter']+'%'};return _0xadaa2d;})});}_0x25127c=_[_0x3aad('0x3b')]({},_0x25127c,_0x1a9d45['options']);return db[_0x3aad('0x58')][_0x3aad('0x1a')]({'where':_0x25127c[_0x3aad('0x3a')]})[_0x3aad('0x20')](function(_0x2929b7){_0x54910d[_0x3aad('0x1a')]=_0x2929b7;if(_0x1a9d45[_0x3aad('0x30')][_0x3aad('0x3d')]){_0x25127c[_0x3aad('0x3e')]=[{'all':!![]}];}return db[_0x3aad('0x58')][_0x3aad('0x3f')](_0x25127c);})[_0x3aad('0x20')](function(_0x59928e){_0x54910d[_0x3aad('0x59')]=_0x59928e;return _0x54910d;});}})[_0x3aad('0x20')](respondWithFilteredResult(_0x45c0cc,_0x25127c))[_0x3aad('0x4a')](handleError(_0x45c0cc,null));};exports[_0x3aad('0x5a')]=function(_0x210502,_0xeedb9,_0x63778){var _0x115d71={'raw':!![],'where':{}};var _0x1ff31f={};var _0x1e2be7={'count':0x0,'rows':[]};return db[_0x3aad('0x2a')][_0x3aad('0x53')]({'where':{'id':_0x210502[_0x3aad('0x41')]['id']}})[_0x3aad('0x20')](handleEntityNotFound(_0xeedb9,null))[_0x3aad('0x20')](function(_0x39b1b9){if(_0x39b1b9){_0x1ff31f[_0x3aad('0x2f')]=_[_0x3aad('0x42')](db[_0x3aad('0x5b')][_0x3aad('0x2b')]);_0x1ff31f['query']=_['keys'](_0x210502['query']);_0x1ff31f[_0x3aad('0x38')]=_[_0x3aad('0x31')](_0x1ff31f['model'],_0x1ff31f[_0x3aad('0x30')]);_0x115d71[_0x3aad('0x32')]=_[_0x3aad('0x31')](_0x1ff31f[_0x3aad('0x2f')],qs[_0x3aad('0x33')](_0x210502[_0x3aad('0x30')][_0x3aad('0x33')]));_0x115d71[_0x3aad('0x32')]=_0x115d71[_0x3aad('0x32')][_0x3aad('0x34')]?_0x115d71[_0x3aad('0x32')]:_0x1ff31f[_0x3aad('0x2f')];if(!_0x210502[_0x3aad('0x30')][_0x3aad('0x35')](_0x3aad('0x54'))){_0x115d71[_0x3aad('0x36')]=qs[_0x3aad('0x36')](_0x210502[_0x3aad('0x30')][_0x3aad('0x36')]);_0x115d71['offset']=qs[_0x3aad('0x1b')](_0x210502[_0x3aad('0x30')][_0x3aad('0x1b')]);}_0x115d71['order']=qs[_0x3aad('0x55')](_0x210502[_0x3aad('0x30')][_0x3aad('0x55')]);_0x115d71[_0x3aad('0x3a')]=qs[_0x3aad('0x38')](_[_0x3aad('0x56')](_0x210502[_0x3aad('0x30')],_0x1ff31f[_0x3aad('0x38')]));_0x115d71[_0x3aad('0x3a')][_0x3aad('0x57')]=_0x39b1b9['id'];if(_0x210502['query'][_0x3aad('0x39')]){_0x115d71[_0x3aad('0x3a')]=_[_0x3aad('0x3b')](_0x115d71[_0x3aad('0x3a')],{'$or':_[_0x3aad('0x29')](_0x115d71[_0x3aad('0x32')],function(_0x4ac905){var _0x46d04e={};_0x46d04e[_0x4ac905]={'$like':'%'+_0x210502[_0x3aad('0x30')][_0x3aad('0x39')]+'%'};return _0x46d04e;})});}_0x115d71=_[_0x3aad('0x3b')]({},_0x115d71,_0x210502[_0x3aad('0x3c')]);return db['JscriptyAnswerReport'][_0x3aad('0x1a')]({'where':_0x115d71['where']})['then'](function(_0x236f07){_0x1e2be7[_0x3aad('0x1a')]=_0x236f07;if(_0x210502[_0x3aad('0x30')][_0x3aad('0x3d')]){_0x115d71[_0x3aad('0x3e')]=[{'all':!![]}];}return db[_0x3aad('0x5b')]['findAll'](_0x115d71);})['then'](function(_0x5ca28b){_0x1e2be7[_0x3aad('0x59')]=_0x5ca28b;return _0x1e2be7;});}})[_0x3aad('0x20')](respondWithFilteredResult(_0xeedb9,_0x115d71))['catch'](handleError(_0xeedb9,null));};function char(_0x19a75b){return _0x3aad('0x5c')===typeof _0x19a75b?String[_0x3aad('0x5d')][_0x3aad('0x1d')](null,arguments):_0x19a75b;}function needsEncapsulation(_0x3a436f){return!!_0x3a436f&&(_0x3a436f[_0x3aad('0x5e')]()['indexOf'](char(0xd))>=0x0||_0x3a436f[_0x3aad('0x5e')]()['indexOf'](char(0xa))>=0x0||_0x3a436f[_0x3aad('0x5e')]()[_0x3aad('0x5f')](char(0x2c))>=0x0||_0x3a436f[_0x3aad('0x5e')]()[_0x3aad('0x5f')](char(0x22))>=0x0);}function encapsulate(_0x208350){var _0x246cef=char(0x22),_0xf5360f='\x5c'+char(0x22),_0x457c86=_0x208350[_0x3aad('0x5e')]()[_0x3aad('0x60')](new RegExp(_0x246cef,'g'),_0xf5360f);return _0x246cef+_0x457c86+_0x246cef;}exports[_0x3aad('0x61')]=function(_0x26e9d6,_0x148cc4,_0x5c2823){var _0x317b96,_0x997dcb;var _0xf3c9f8={'where':{'ProjectId':_0x26e9d6[_0x3aad('0x41')]['id']}};if(_0x26e9d6[_0x3aad('0x30')][_0x3aad('0x62')]){_0xf3c9f8[_0x3aad('0x3a')][_0x3aad('0x63')]=JSON[_0x3aad('0x64')](_0x26e9d6[_0x3aad('0x30')][_0x3aad('0x62')]);}return db[_0x3aad('0x58')][_0x3aad('0x3f')](_0xf3c9f8)[_0x3aad('0x20')](handleEntityNotFound(_0x148cc4,null))[_0x3aad('0x20')](function(_0x20ef6a){if(_0x20ef6a){_0x317b96=_0x20ef6a;return db['JscriptyQuestionReport'][_0x3aad('0x3f')]({'where':{'SessionId':{'$in':_[_0x3aad('0x29')](_0x317b96,'id')},'ProjectId':_0x26e9d6[_0x3aad('0x41')]['id']},'order':_0x3aad('0x65')});}})['then'](handleEntityNotFound(_0x148cc4,null))[_0x3aad('0x20')](function(_0x32e3ed){if(_0x32e3ed){_0x997dcb=_0x32e3ed;var _0x435104={};for(var _0x457310=0x0,_0x27f8cb=_0x997dcb['length'];_0x457310<_0x27f8cb;_0x457310++){if(!_0x435104[_0x3aad('0x35')](_0x997dcb[_0x457310]['questionId'])){_0x435104[_0x997dcb[_0x457310][_0x3aad('0x66')]]=needsEncapsulation(_0x997dcb[_0x457310]['question'])?encapsulate(_0x997dcb[_0x457310][_0x3aad('0x67')]):_0x997dcb[_0x457310][_0x3aad('0x67')];}}var _0x104c2f=[],_0xa095fb={};for(var _0x3e2945=0x0,_0x1d5581=_0x317b96[_0x3aad('0x34')];_0x3e2945<_0x1d5581;_0x3e2945++){_0xa095fb={'ProjectId':_0x26e9d6[_0x3aad('0x41')]['id'],'SessionId':_0x317b96[_0x3e2945]['id'],'StartTime':moment(_0x317b96[_0x3e2945]['starttime'])[_0x3aad('0x68')]('YYYY-MM-DD\x20HH:mm:ss')};for(var _0x3d3e74=0x0,_0x56faf6=_0x997dcb['length'];_0x3d3e74<_0x56faf6;_0x3d3e74++){if(_0x997dcb[_0x3d3e74]['SessionId']==_0x317b96[_0x3e2945]['id']&&_0x435104[_0x3aad('0x35')](_0x997dcb[_0x3d3e74][_0x3aad('0x66')])){_0xa095fb[_0x435104[_0x997dcb[_0x3d3e74][_0x3aad('0x66')]]]=_0x997dcb[_0x3d3e74][_0x3aad('0x69')];}}for(var _0x26c4e2 in _0x435104){if(!_0xa095fb[_0x3aad('0x35')](_0x435104[_0x26c4e2])){_0xa095fb[_0x435104[_0x26c4e2]]=null;}}_0x104c2f[_0x3aad('0x6a')](_0xa095fb);}return _0x104c2f;}})[_0x3aad('0x20')](function(_0x3c25fd){if(!_[_0x3aad('0x6b')](_0x3c25fd)){var _0x54c39e=toCsv(_0x3c25fd);var _0x4f37fe=Date[_0x3aad('0x6c')]();fs['writeFileSync'](util[_0x3aad('0x68')](_0x3aad('0x6d'),_0x26e9d6[_0x3aad('0x41')]['id'],_0x4f37fe),_0x54c39e);_0x148cc4['setHeader'](_0x3aad('0x6e'),_0x3aad('0x6f')+util[_0x3aad('0x68')](_0x3aad('0x70'),_0x26e9d6[_0x3aad('0x41')]['id'],_0x4f37fe));_0x148cc4['setHeader'](_0x3aad('0x71'),_0x3aad('0x72'));return _0x148cc4[_0x3aad('0x73')](util['format'](_0x3aad('0x6d'),_0x26e9d6['params']['id'],_0x4f37fe));}else{return _0x148cc4['sendStatus'](0xcc);}})['catch'](handleError(_0x148cc4,null));}; \ No newline at end of file diff --git a/server/api/jscriptyProject/jscriptyProject.model.js b/server/api/jscriptyProject/jscriptyProject.model.js index 5960f37..eb57752 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 _0xd053=['lodash','util','api','moment','bluebird','rimraf','../../config/environment','exports','define','JscriptyProject','jscripty_projects'];(function(_0x5b24d2,_0x1daabe){var _0x31967e=function(_0x5626e0){while(--_0x5626e0){_0x5b24d2['push'](_0x5b24d2['shift']());}};_0x31967e(++_0x1daabe);}(_0xd053,0xe7));var _0x3d05=function(_0x584291,_0x24b5b3){_0x584291=_0x584291-0x0;var _0x4e7d08=_0xd053[_0x584291];return _0x4e7d08;};'use strict';var _=require(_0x3d05('0x0'));var util=require(_0x3d05('0x1'));var logger=require('../../config/logger')(_0x3d05('0x2'));var moment=require(_0x3d05('0x3'));var BPromise=require(_0x3d05('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x3d05('0x5'));var config=require(_0x3d05('0x6'));var attributes=require('./jscriptyProject.attributes');module[_0x3d05('0x7')]=function(_0x2ba33b,_0x59161d){return _0x2ba33b[_0x3d05('0x8')](_0x3d05('0x9'),attributes,{'tableName':_0x3d05('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x1dea=['../../config/environment','./jscriptyProject.attributes','exports','define','JscriptyProject','jscripty_projects','lodash','util','api','bluebird','request-promise','path','rimraf'];(function(_0x3ab9ee,_0x4a74b8){var _0x82ee88=function(_0x6ccc7e){while(--_0x6ccc7e){_0x3ab9ee['push'](_0x3ab9ee['shift']());}};_0x82ee88(++_0x4a74b8);}(_0x1dea,0xfd));var _0xa1de=function(_0x15ac20,_0xeb4bbd){_0x15ac20=_0x15ac20-0x0;var _0x17e297=_0x1dea[_0x15ac20];return _0x17e297;};'use strict';var _=require(_0xa1de('0x0'));var util=require(_0xa1de('0x1'));var logger=require('../../config/logger')(_0xa1de('0x2'));var moment=require('moment');var BPromise=require(_0xa1de('0x3'));var rp=require(_0xa1de('0x4'));var fs=require('fs');var path=require(_0xa1de('0x5'));var rimraf=require(_0xa1de('0x6'));var config=require(_0xa1de('0x7'));var attributes=require(_0xa1de('0x8'));module[_0xa1de('0x9')]=function(_0x196982,_0x715f7f){return _0x196982[_0xa1de('0xa')](_0xa1de('0xb'),attributes,{'tableName':_0xa1de('0xc'),'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 688626f..271152f 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 _0x9f7b=['jayson/promise','client','http','request','then','info','JscriptyProject,\x20%s,\x20%s','request\x20sent','JscriptyProject,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','util','bluebird','randomstring','../../mysqldb','../../config/utils','rpc','../../config/environment'];(function(_0x29c0f5,_0x27a8d5){var _0xbe88e2=function(_0x770c33){while(--_0x770c33){_0x29c0f5['push'](_0x29c0f5['shift']());}};_0xbe88e2(++_0x27a8d5);}(_0x9f7b,0x7d));var _0xb9f7=function(_0x4ad574,_0x181b13){_0x4ad574=_0x4ad574-0x0;var _0x44be00=_0x9f7b[_0x4ad574];return _0x44be00;};'use strict';var _=require('lodash');var util=require(_0xb9f7('0x0'));var moment=require('moment');var BPromise=require(_0xb9f7('0x1'));var rs=require(_0xb9f7('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xb9f7('0x3'))['db'];var utils=require(_0xb9f7('0x4'));var logger=require('../../config/logger')(_0xb9f7('0x5'));var config=require(_0xb9f7('0x6'));var jayson=require(_0xb9f7('0x7'));var client=jayson[_0xb9f7('0x8')][_0xb9f7('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x450bf4,_0xb68356,_0x210e6d){return new BPromise(function(_0x4a4a3f,_0x5621ae){return client[_0xb9f7('0xa')](_0x450bf4,_0x210e6d)[_0xb9f7('0xb')](function(_0x43d80f){logger[_0xb9f7('0xc')](_0xb9f7('0xd'),_0xb68356,_0xb9f7('0xe'));logger['debug'](_0xb9f7('0xf'),_0xb68356,'request\x20sent',JSON[_0xb9f7('0x10')](_0x43d80f));if(_0x43d80f['error']){if(_0x43d80f[_0xb9f7('0x11')][_0xb9f7('0x12')]===0x1f4){logger[_0xb9f7('0x11')](_0xb9f7('0xd'),_0xb68356,_0x43d80f['error'][_0xb9f7('0x13')]);return _0x5621ae(_0x43d80f['error'][_0xb9f7('0x13')]);}logger[_0xb9f7('0x11')](_0xb9f7('0xd'),_0xb68356,_0x43d80f['error'][_0xb9f7('0x13')]);return _0x4a4a3f(_0x43d80f['error'][_0xb9f7('0x13')]);}else{logger['info'](_0xb9f7('0xd'),_0xb68356,_0xb9f7('0xe'));_0x4a4a3f(_0x43d80f[_0xb9f7('0x14')][_0xb9f7('0x13')]);}})[_0xb9f7('0x15')](function(_0x2ac1c4){logger[_0xb9f7('0x11')](_0xb9f7('0xd'),_0xb68356,_0x2ac1c4);_0x5621ae(_0x2ac1c4);});});} \ No newline at end of file +var _0x3f6c=['moment','bluebird','randomstring','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','info','request\x20sent','error','JscriptyProject,\x20%s,\x20%s','message','result','catch','lodash'];(function(_0x58e2f4,_0x2749f0){var _0x5d47a0=function(_0x4ecc23){while(--_0x4ecc23){_0x58e2f4['push'](_0x58e2f4['shift']());}};_0x5d47a0(++_0x2749f0);}(_0x3f6c,0x1b4));var _0xc3f6=function(_0x1f0aac,_0x2a88bb){_0x1f0aac=_0x1f0aac-0x0;var _0x571b53=_0x3f6c[_0x1f0aac];return _0x571b53;};'use strict';var _=require(_0xc3f6('0x0'));var util=require('util');var moment=require(_0xc3f6('0x1'));var BPromise=require(_0xc3f6('0x2'));var rs=require(_0xc3f6('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xc3f6('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0xc3f6('0x5'))(_0xc3f6('0x6'));var config=require(_0xc3f6('0x7'));var jayson=require(_0xc3f6('0x8'));var client=jayson[_0xc3f6('0x9')][_0xc3f6('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x2a9ada,_0x5ddcb3,_0x15a40b){return new BPromise(function(_0x17cf90,_0x264c66){return client[_0xc3f6('0xb')](_0x2a9ada,_0x15a40b)['then'](function(_0x3a1cfc){logger[_0xc3f6('0xc')]('JscriptyProject,\x20%s,\x20%s',_0x5ddcb3,_0xc3f6('0xd'));logger['debug']('JscriptyProject,\x20%s,\x20%s,\x20%s',_0x5ddcb3,'request\x20sent',JSON['stringify'](_0x3a1cfc));if(_0x3a1cfc[_0xc3f6('0xe')]){if(_0x3a1cfc[_0xc3f6('0xe')]['code']===0x1f4){logger[_0xc3f6('0xe')](_0xc3f6('0xf'),_0x5ddcb3,_0x3a1cfc[_0xc3f6('0xe')][_0xc3f6('0x10')]);return _0x264c66(_0x3a1cfc[_0xc3f6('0xe')][_0xc3f6('0x10')]);}logger['error'](_0xc3f6('0xf'),_0x5ddcb3,_0x3a1cfc[_0xc3f6('0xe')][_0xc3f6('0x10')]);return _0x17cf90(_0x3a1cfc[_0xc3f6('0xe')][_0xc3f6('0x10')]);}else{logger['info'](_0xc3f6('0xf'),_0x5ddcb3,_0xc3f6('0xd'));_0x17cf90(_0x3a1cfc[_0xc3f6('0x11')][_0xc3f6('0x10')]);}})[_0xc3f6('0x12')](function(_0x5030ed){logger[_0xc3f6('0xe')](_0xc3f6('0xf'),_0x5ddcb3,_0x5030ed);_0x264c66(_0x5030ed);});});} \ No newline at end of file diff --git a/server/api/jscriptyQuestionReport/index.js b/server/api/jscriptyQuestionReport/index.js index 4994b7f..dc074d3 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 _0x3c1d=['post','create','put','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','../../components/interaction/service','./jscriptyQuestionReport.controller','isAuthenticated','index','/describe','describe','get','/:id'];(function(_0x304cac,_0x12363f){var _0x43bb98=function(_0x18c147){while(--_0x18c147){_0x304cac['push'](_0x304cac['shift']());}};_0x43bb98(++_0x12363f);}(_0x3c1d,0x196));var _0xd3c1=function(_0x16b9ed,_0x56517a){_0x16b9ed=_0x16b9ed-0x0;var _0x66b1f8=_0x3c1d[_0x16b9ed];return _0x66b1f8;};'use strict';var multer=require(_0xd3c1('0x0'));var util=require(_0xd3c1('0x1'));var path=require(_0xd3c1('0x2'));var timeout=require(_0xd3c1('0x3'));var express=require(_0xd3c1('0x4'));var router=express[_0xd3c1('0x5')]();var auth=require('../../components/auth/service');var interaction=require(_0xd3c1('0x6'));var config=require('../../config/environment');var controller=require(_0xd3c1('0x7'));router['get']('/',auth[_0xd3c1('0x8')](),controller[_0xd3c1('0x9')]);router['get'](_0xd3c1('0xa'),auth[_0xd3c1('0x8')](),controller[_0xd3c1('0xb')]);router[_0xd3c1('0xc')](_0xd3c1('0xd'),auth[_0xd3c1('0x8')](),controller['show']);router[_0xd3c1('0xe')]('/',auth['isAuthenticated'](),controller[_0xd3c1('0xf')]);router[_0xd3c1('0x10')]('/:id',auth[_0xd3c1('0x8')](),controller['update']);router[_0xd3c1('0x11')](_0xd3c1('0xd'),auth[_0xd3c1('0x8')](),controller[_0xd3c1('0x12')]);module[_0xd3c1('0x13')]=router; \ No newline at end of file +var _0x133d=['show','create','put','update','delete','destroy','path','connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment','./jscriptyQuestionReport.controller','get','/describe','isAuthenticated','describe'];(function(_0x230c1d,_0x10a331){var _0x5dba77=function(_0x59f25a){while(--_0x59f25a){_0x230c1d['push'](_0x230c1d['shift']());}};_0x5dba77(++_0x10a331);}(_0x133d,0x8e));var _0xd133=function(_0x5e77db,_0x356d1c){_0x5e77db=_0x5e77db-0x0;var _0x34b675=_0x133d[_0x5e77db];return _0x34b675;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0xd133('0x0'));var timeout=require(_0xd133('0x1'));var express=require(_0xd133('0x2'));var router=express['Router']();var auth=require(_0xd133('0x3'));var interaction=require(_0xd133('0x4'));var config=require(_0xd133('0x5'));var controller=require(_0xd133('0x6'));router[_0xd133('0x7')]('/',auth['isAuthenticated'](),controller['index']);router[_0xd133('0x7')](_0xd133('0x8'),auth[_0xd133('0x9')](),controller[_0xd133('0xa')]);router[_0xd133('0x7')]('/:id',auth[_0xd133('0x9')](),controller[_0xd133('0xb')]);router['post']('/',auth[_0xd133('0x9')](),controller[_0xd133('0xc')]);router[_0xd133('0xd')]('/:id',auth[_0xd133('0x9')](),controller[_0xd133('0xe')]);router[_0xd133('0xf')]('/:id',auth['isAuthenticated'](),controller[_0xd133('0x10')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/jscriptyQuestionReport/jscriptyQuestionReport.attributes.js b/server/api/jscriptyQuestionReport/jscriptyQuestionReport.attributes.js index 215de61..1c456b4 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 _0x69f9=['STRING','TEXT','sequelize','exports'];(function(_0x490c17,_0x6797f6){var _0x3490dd=function(_0x54f793){while(--_0x54f793){_0x490c17['push'](_0x490c17['shift']());}};_0x3490dd(++_0x6797f6);}(_0x69f9,0x16e));var _0x969f=function(_0x5ee7a,_0x44169b){_0x5ee7a=_0x5ee7a-0x0;var _0x22848e=_0x69f9[_0x5ee7a];return _0x22848e;};'use strict';var Sequelize=require(_0x969f('0x0'));module[_0x969f('0x1')]={'question':{'type':Sequelize[_0x969f('0x2')]},'answer':{'type':Sequelize[_0x969f('0x3')]('long')},'membername':{'type':Sequelize['STRING']},'projectname':{'type':Sequelize[_0x969f('0x2')]},'queue':{'type':Sequelize['STRING']},'uniqueid':{'type':Sequelize[_0x969f('0x2')]},'calleridname':{'type':Sequelize[_0x969f('0x2')]},'calleridnum':{'type':Sequelize[_0x969f('0x2')]},'questionId':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0xa00f=['STRING','long','sequelize','exports'];(function(_0x390fa7,_0x2015d7){var _0x23f842=function(_0x362a26){while(--_0x362a26){_0x390fa7['push'](_0x390fa7['shift']());}};_0x23f842(++_0x2015d7);}(_0xa00f,0x176));var _0xfa00=function(_0x487a23,_0x20d4c4){_0x487a23=_0x487a23-0x0;var _0x585b27=_0xa00f[_0x487a23];return _0x585b27;};'use strict';var Sequelize=require(_0xfa00('0x0'));module[_0xfa00('0x1')]={'question':{'type':Sequelize[_0xfa00('0x2')]},'answer':{'type':Sequelize['TEXT'](_0xfa00('0x3'))},'membername':{'type':Sequelize[_0xfa00('0x2')]},'projectname':{'type':Sequelize[_0xfa00('0x2')]},'queue':{'type':Sequelize[_0xfa00('0x2')]},'uniqueid':{'type':Sequelize[_0xfa00('0x2')]},'calleridname':{'type':Sequelize['STRING']},'calleridnum':{'type':Sequelize['STRING']},'questionId':{'type':Sequelize[_0xfa00('0x2')]}}; \ No newline at end of file diff --git a/server/api/jscriptyQuestionReport/jscriptyQuestionReport.controller.js b/server/api/jscriptyQuestionReport/jscriptyQuestionReport.controller.js index 4cc6597..0f908d1 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 _0xb98f=['request-promise','bluebird','mustache','to-csv','ejs','squel','crypto','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/environment','sendStatus','status','offset','limit','Content-Range','json','apply','reject','save','update','then','destroy','end','error','name','send','index','JscriptyQuestionReport','rawAttributes','type','key','model','map','query','keys','intersection','attributes','fields','length','hasOwnProperty','order','sort','where','filters','filter','merge','options','count','includeAll','findAll','rows','catch','show','params','create','body','find','describe','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch'];(function(_0x3d9d4e,_0x530106){var _0x1e7925=function(_0x1f0e08){while(--_0x1f0e08){_0x3d9d4e['push'](_0x3d9d4e['shift']());}};_0x1e7925(++_0x530106);}(_0xb98f,0xca));var _0xfb98=function(_0x286d76,_0x4963d8){_0x286d76=_0x286d76-0x0;var _0x415fb8=_0xb98f[_0x286d76];return _0x415fb8;};'use strict';var pdf=require(_0xfb98('0x0'));var emlformat=require(_0xfb98('0x1'));var rimraf=require(_0xfb98('0x2'));var zipdir=require(_0xfb98('0x3'));var jsonpatch=require(_0xfb98('0x4'));var rp=require(_0xfb98('0x5'));var moment=require('moment');var BPromise=require(_0xfb98('0x6'));var Mustache=require(_0xfb98('0x7'));var util=require('util');var path=require('path');var sox=require('sox');var csv=require(_0xfb98('0x8'));var ejs=require(_0xfb98('0x9'));var fs=require('fs');var _=require('lodash');var squel=require(_0xfb98('0xa'));var crypto=require(_0xfb98('0xb'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0xfb98('0x8'));var querystring=require(_0xfb98('0xc'));var Papa=require(_0xfb98('0xd'));var Redis=require(_0xfb98('0xe'));var authService=require(_0xfb98('0xf'));var qs=require(_0xfb98('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0xfb98('0x11'))(_0xfb98('0x12'));var utils=require(_0xfb98('0x13'));var config=require(_0xfb98('0x14'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x36e94c,_0x4171ce){_0x4171ce=_0x4171ce||0xcc;return function(_0x11da23){if(_0x11da23){return _0x36e94c[_0xfb98('0x15')](_0x4171ce);}return _0x36e94c[_0xfb98('0x16')](_0x4171ce)['end']();};}function respondWithResult(_0x362071,_0x3a6a4e){_0x3a6a4e=_0x3a6a4e||0xc8;return function(_0x3743a2){if(_0x3743a2){return _0x362071['status'](_0x3a6a4e)['json'](_0x3743a2);}};}function respondWithFilteredResult(_0x5c4ca6,_0x24f02c){return function(_0x3bc1dc){if(_0x3bc1dc){var _0x130d0c=_0x3bc1dc['count'],_0x56def5=_0x24f02c[_0xfb98('0x17')],_0x44f27b=_0x24f02c[_0xfb98('0x17')]+_0x24f02c[_0xfb98('0x18')],_0x31540d;if(_0x44f27b>=_0x130d0c){_0x44f27b=_0x130d0c;_0x31540d=0xc8;}else{_0x31540d=0xce;}_0x5c4ca6['status'](_0x31540d);return _0x5c4ca6['set'](_0xfb98('0x19'),_0x56def5+'-'+_0x44f27b+'/'+_0x130d0c)[_0xfb98('0x1a')](_0x3bc1dc);}return null;};}function patchUpdates(_0x3c17bc){return function(_0x1ce0df){try{jsonpatch[_0xfb98('0x1b')](_0x1ce0df,_0x3c17bc,!![]);}catch(_0x1aa820){return BPromise[_0xfb98('0x1c')](_0x1aa820);}return _0x1ce0df[_0xfb98('0x1d')]();};}function saveUpdates(_0x15ffa5,_0x34e51a){return function(_0x69fea3){if(_0x69fea3){return _0x69fea3[_0xfb98('0x1e')](_0x15ffa5)[_0xfb98('0x1f')](function(_0x3a8699){return _0x3a8699;});}return null;};}function removeEntity(_0x752d72,_0x21a040){return function(_0x6da3ae){if(_0x6da3ae){return _0x6da3ae[_0xfb98('0x20')]()[_0xfb98('0x1f')](function(){_0x752d72[_0xfb98('0x16')](0xcc)[_0xfb98('0x21')]();});}};}function handleEntityNotFound(_0x11fd8b,_0x559500){return function(_0x50d97f){if(!_0x50d97f){_0x11fd8b[_0xfb98('0x15')](0x194);}return _0x50d97f;};}function handleError(_0x4d8744,_0x5883c4){_0x5883c4=_0x5883c4||0x1f4;return function(_0x5cbecd){logger[_0xfb98('0x22')](_0x5cbecd['stack']);if(_0x5cbecd[_0xfb98('0x23')]){delete _0x5cbecd[_0xfb98('0x23')];}_0x4d8744[_0xfb98('0x16')](_0x5883c4)[_0xfb98('0x24')](_0x5cbecd);};}exports[_0xfb98('0x25')]=function(_0x267d1d,_0x4395c7){var _0x4d9d50={},_0x141e3a={},_0x583b0f={'count':0x0,'rows':[]};var _0x9472c4=_['map'](db[_0xfb98('0x26')][_0xfb98('0x27')],function(_0x114c83){return{'name':_0x114c83['fieldName'],'type':_0x114c83[_0xfb98('0x28')][_0xfb98('0x29')]};});_0x141e3a[_0xfb98('0x2a')]=_[_0xfb98('0x2b')](_0x9472c4,_0xfb98('0x23'));_0x141e3a[_0xfb98('0x2c')]=_[_0xfb98('0x2d')](_0x267d1d[_0xfb98('0x2c')]);_0x141e3a['filters']=_[_0xfb98('0x2e')](_0x141e3a[_0xfb98('0x2a')],_0x141e3a[_0xfb98('0x2c')]);_0x4d9d50[_0xfb98('0x2f')]=_[_0xfb98('0x2e')](_0x141e3a['model'],qs[_0xfb98('0x30')](_0x267d1d['query'][_0xfb98('0x30')]));_0x4d9d50['attributes']=_0x4d9d50['attributes'][_0xfb98('0x31')]?_0x4d9d50[_0xfb98('0x2f')]:_0x141e3a[_0xfb98('0x2a')];if(!_0x267d1d[_0xfb98('0x2c')][_0xfb98('0x32')]('nolimit')){_0x4d9d50[_0xfb98('0x18')]=qs[_0xfb98('0x18')](_0x267d1d[_0xfb98('0x2c')][_0xfb98('0x18')]);_0x4d9d50['offset']=qs[_0xfb98('0x17')](_0x267d1d['query'][_0xfb98('0x17')]);}_0x4d9d50[_0xfb98('0x33')]=qs[_0xfb98('0x34')](_0x267d1d['query']['sort']);_0x4d9d50[_0xfb98('0x35')]=qs[_0xfb98('0x36')](_['pick'](_0x267d1d[_0xfb98('0x2c')],_0x141e3a[_0xfb98('0x36')]));if(_0x267d1d['query'][_0xfb98('0x37')]){_0x4d9d50[_0xfb98('0x35')]=_['merge'](_0x4d9d50[_0xfb98('0x35')],{'$or':_['map'](_0x9472c4,function(_0x5ae46d){if(_0x5ae46d[_0xfb98('0x28')]!=='VIRTUAL'){var _0x116a69={};_0x116a69[_0x5ae46d[_0xfb98('0x23')]]={'$like':'%'+_0x267d1d['query']['filter']+'%'};return _0x116a69;}})});}_0x4d9d50=_[_0xfb98('0x38')]({},_0x4d9d50,_0x267d1d[_0xfb98('0x39')]);var _0x1b5f80={'where':_0x4d9d50[_0xfb98('0x35')]};return db[_0xfb98('0x26')][_0xfb98('0x3a')](_0x1b5f80)['then'](function(_0x532163){_0x583b0f[_0xfb98('0x3a')]=_0x532163;if(_0x267d1d[_0xfb98('0x2c')][_0xfb98('0x3b')]){_0x4d9d50['include']=[{'all':!![]}];}return db[_0xfb98('0x26')][_0xfb98('0x3c')](_0x4d9d50);})[_0xfb98('0x1f')](function(_0x591ffa){_0x583b0f[_0xfb98('0x3d')]=_0x591ffa;return _0x583b0f;})[_0xfb98('0x1f')](respondWithFilteredResult(_0x4395c7,_0x4d9d50))[_0xfb98('0x3e')](handleError(_0x4395c7,null));};exports[_0xfb98('0x3f')]=function(_0x279aae,_0x38bf62){var _0x567959={'raw':!![],'where':{'id':_0x279aae[_0xfb98('0x40')]['id']}},_0x7f33d7={};_0x7f33d7[_0xfb98('0x2a')]=_[_0xfb98('0x2d')](db[_0xfb98('0x26')][_0xfb98('0x27')]);_0x7f33d7[_0xfb98('0x2c')]=_[_0xfb98('0x2d')](_0x279aae[_0xfb98('0x2c')]);_0x7f33d7['filters']=_[_0xfb98('0x2e')](_0x7f33d7[_0xfb98('0x2a')],_0x7f33d7[_0xfb98('0x2c')]);_0x567959['attributes']=_[_0xfb98('0x2e')](_0x7f33d7['model'],qs[_0xfb98('0x30')](_0x279aae[_0xfb98('0x2c')][_0xfb98('0x30')]));_0x567959[_0xfb98('0x2f')]=_0x567959[_0xfb98('0x2f')][_0xfb98('0x31')]?_0x567959[_0xfb98('0x2f')]:_0x7f33d7[_0xfb98('0x2a')];if(_0x279aae[_0xfb98('0x2c')][_0xfb98('0x3b')]){_0x567959['include']=[{'all':!![]}];}_0x567959=_['merge']({},_0x567959,_0x279aae[_0xfb98('0x39')]);return db[_0xfb98('0x26')]['find'](_0x567959)[_0xfb98('0x1f')](handleEntityNotFound(_0x38bf62,null))[_0xfb98('0x1f')](respondWithResult(_0x38bf62,null))[_0xfb98('0x3e')](handleError(_0x38bf62,null));};exports[_0xfb98('0x41')]=function(_0x4cc04a,_0xa24043){return db[_0xfb98('0x26')]['create'](_0x4cc04a[_0xfb98('0x42')],{})['then'](respondWithResult(_0xa24043,0xc9))[_0xfb98('0x3e')](handleError(_0xa24043,null));};exports[_0xfb98('0x1e')]=function(_0x1bdc98,_0x5cf84c){if(_0x1bdc98['body']['id']){delete _0x1bdc98[_0xfb98('0x42')]['id'];}return db[_0xfb98('0x26')][_0xfb98('0x43')]({'where':{'id':_0x1bdc98['params']['id']}})['then'](handleEntityNotFound(_0x5cf84c,null))[_0xfb98('0x1f')](saveUpdates(_0x1bdc98[_0xfb98('0x42')],null))[_0xfb98('0x1f')](respondWithResult(_0x5cf84c,null))[_0xfb98('0x3e')](handleError(_0x5cf84c,null));};exports[_0xfb98('0x20')]=function(_0x26ec11,_0x3e0c8e){return db[_0xfb98('0x26')][_0xfb98('0x43')]({'where':{'id':_0x26ec11['params']['id']}})['then'](handleEntityNotFound(_0x3e0c8e,null))[_0xfb98('0x1f')](removeEntity(_0x3e0c8e,null))[_0xfb98('0x3e')](handleError(_0x3e0c8e,null));};exports[_0xfb98('0x44')]=function(_0x35fb41,_0x32bc7e){return db[_0xfb98('0x26')][_0xfb98('0x44')]()[_0xfb98('0x1f')](respondWithResult(_0x32bc7e,null))[_0xfb98('0x3e')](handleError(_0x32bc7e,null));}; \ No newline at end of file +var _0x324c=['filters','attributes','intersection','fields','length','hasOwnProperty','order','sort','where','pick','filter','merge','options','includeAll','include','findAll','rows','catch','params','create','body','find','describe','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','sox','to-csv','ejs','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','count','offset','limit','set','json','reject','save','update','then','destroy','error','stack','name','send','index','map','JscriptyQuestionReport','rawAttributes','fieldName','type','key','model','query','keys'];(function(_0x15c196,_0x50069f){var _0x3033eb=function(_0x5c9a02){while(--_0x5c9a02){_0x15c196['push'](_0x15c196['shift']());}};_0x3033eb(++_0x50069f);}(_0x324c,0x193));var _0xc324=function(_0x5f3e8c,_0x574fda){_0x5f3e8c=_0x5f3e8c-0x0;var _0x4d487d=_0x324c[_0x5f3e8c];return _0x4d487d;};'use strict';var pdf=require(_0xc324('0x0'));var emlformat=require(_0xc324('0x1'));var rimraf=require(_0xc324('0x2'));var zipdir=require(_0xc324('0x3'));var jsonpatch=require(_0xc324('0x4'));var rp=require(_0xc324('0x5'));var moment=require(_0xc324('0x6'));var BPromise=require(_0xc324('0x7'));var Mustache=require('mustache');var util=require(_0xc324('0x8'));var path=require(_0xc324('0x9'));var sox=require(_0xc324('0xa'));var csv=require(_0xc324('0xb'));var ejs=require(_0xc324('0xc'));var fs=require('fs');var _=require('lodash');var squel=require(_0xc324('0xd'));var crypto=require(_0xc324('0xe'));var jsforce=require(_0xc324('0xf'));var deskjs=require(_0xc324('0x10'));var toCsv=require(_0xc324('0xb'));var querystring=require(_0xc324('0x11'));var Papa=require(_0xc324('0x12'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0xc324('0x13'));var as=require(_0xc324('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xc324('0x15'))(_0xc324('0x16'));var utils=require(_0xc324('0x17'));var config=require(_0xc324('0x18'));var db=require(_0xc324('0x19'))['db'];function respondWithStatusCode(_0x579309,_0x2a8127){_0x2a8127=_0x2a8127||0xcc;return function(_0x3b5b80){if(_0x3b5b80){return _0x579309[_0xc324('0x1a')](_0x2a8127);}return _0x579309[_0xc324('0x1b')](_0x2a8127)[_0xc324('0x1c')]();};}function respondWithResult(_0x405707,_0x480bbc){_0x480bbc=_0x480bbc||0xc8;return function(_0xacd816){if(_0xacd816){return _0x405707[_0xc324('0x1b')](_0x480bbc)['json'](_0xacd816);}};}function respondWithFilteredResult(_0x5d334a,_0x4bb459){return function(_0x380138){if(_0x380138){var _0x13e290=_0x380138[_0xc324('0x1d')],_0x4cb56f=_0x4bb459[_0xc324('0x1e')],_0x3ada52=_0x4bb459[_0xc324('0x1e')]+_0x4bb459[_0xc324('0x1f')],_0x112189;if(_0x3ada52>=_0x13e290){_0x3ada52=_0x13e290;_0x112189=0xc8;}else{_0x112189=0xce;}_0x5d334a[_0xc324('0x1b')](_0x112189);return _0x5d334a[_0xc324('0x20')]('Content-Range',_0x4cb56f+'-'+_0x3ada52+'/'+_0x13e290)[_0xc324('0x21')](_0x380138);}return null;};}function patchUpdates(_0x2068cd){return function(_0x4ce93a){try{jsonpatch['apply'](_0x4ce93a,_0x2068cd,!![]);}catch(_0x4496ef){return BPromise[_0xc324('0x22')](_0x4496ef);}return _0x4ce93a[_0xc324('0x23')]();};}function saveUpdates(_0x2942dd,_0x12e81c){return function(_0x4e1482){if(_0x4e1482){return _0x4e1482[_0xc324('0x24')](_0x2942dd)[_0xc324('0x25')](function(_0x20235f){return _0x20235f;});}return null;};}function removeEntity(_0x4460fd,_0x540098){return function(_0xfd282c){if(_0xfd282c){return _0xfd282c[_0xc324('0x26')]()[_0xc324('0x25')](function(){_0x4460fd['status'](0xcc)[_0xc324('0x1c')]();});}};}function handleEntityNotFound(_0x3226bb,_0x138c87){return function(_0x237b9f){if(!_0x237b9f){_0x3226bb[_0xc324('0x1a')](0x194);}return _0x237b9f;};}function handleError(_0x530e01,_0x3d50ca){_0x3d50ca=_0x3d50ca||0x1f4;return function(_0x446fa3){logger[_0xc324('0x27')](_0x446fa3[_0xc324('0x28')]);if(_0x446fa3[_0xc324('0x29')]){delete _0x446fa3[_0xc324('0x29')];}_0x530e01['status'](_0x3d50ca)[_0xc324('0x2a')](_0x446fa3);};}exports[_0xc324('0x2b')]=function(_0x5df59c,_0x36663e){var _0x5840dc={},_0x2b2b39={},_0x31cfe4={'count':0x0,'rows':[]};var _0x57e459=_[_0xc324('0x2c')](db[_0xc324('0x2d')][_0xc324('0x2e')],function(_0x5d0d08){return{'name':_0x5d0d08[_0xc324('0x2f')],'type':_0x5d0d08[_0xc324('0x30')][_0xc324('0x31')]};});_0x2b2b39[_0xc324('0x32')]=_['map'](_0x57e459,'name');_0x2b2b39[_0xc324('0x33')]=_[_0xc324('0x34')](_0x5df59c[_0xc324('0x33')]);_0x2b2b39[_0xc324('0x35')]=_['intersection'](_0x2b2b39['model'],_0x2b2b39[_0xc324('0x33')]);_0x5840dc[_0xc324('0x36')]=_[_0xc324('0x37')](_0x2b2b39[_0xc324('0x32')],qs[_0xc324('0x38')](_0x5df59c['query'][_0xc324('0x38')]));_0x5840dc[_0xc324('0x36')]=_0x5840dc[_0xc324('0x36')][_0xc324('0x39')]?_0x5840dc[_0xc324('0x36')]:_0x2b2b39[_0xc324('0x32')];if(!_0x5df59c[_0xc324('0x33')][_0xc324('0x3a')]('nolimit')){_0x5840dc[_0xc324('0x1f')]=qs[_0xc324('0x1f')](_0x5df59c[_0xc324('0x33')][_0xc324('0x1f')]);_0x5840dc[_0xc324('0x1e')]=qs[_0xc324('0x1e')](_0x5df59c[_0xc324('0x33')][_0xc324('0x1e')]);}_0x5840dc[_0xc324('0x3b')]=qs[_0xc324('0x3c')](_0x5df59c['query'][_0xc324('0x3c')]);_0x5840dc[_0xc324('0x3d')]=qs[_0xc324('0x35')](_[_0xc324('0x3e')](_0x5df59c[_0xc324('0x33')],_0x2b2b39[_0xc324('0x35')]));if(_0x5df59c[_0xc324('0x33')][_0xc324('0x3f')]){_0x5840dc[_0xc324('0x3d')]=_[_0xc324('0x40')](_0x5840dc[_0xc324('0x3d')],{'$or':_['map'](_0x57e459,function(_0x34fa9d){if(_0x34fa9d[_0xc324('0x30')]!=='VIRTUAL'){var _0x4865bf={};_0x4865bf[_0x34fa9d['name']]={'$like':'%'+_0x5df59c['query']['filter']+'%'};return _0x4865bf;}})});}_0x5840dc=_['merge']({},_0x5840dc,_0x5df59c[_0xc324('0x41')]);var _0x261bde={'where':_0x5840dc[_0xc324('0x3d')]};return db['JscriptyQuestionReport'][_0xc324('0x1d')](_0x261bde)[_0xc324('0x25')](function(_0x2d89c4){_0x31cfe4[_0xc324('0x1d')]=_0x2d89c4;if(_0x5df59c['query'][_0xc324('0x42')]){_0x5840dc[_0xc324('0x43')]=[{'all':!![]}];}return db['JscriptyQuestionReport'][_0xc324('0x44')](_0x5840dc);})[_0xc324('0x25')](function(_0x446ccf){_0x31cfe4[_0xc324('0x45')]=_0x446ccf;return _0x31cfe4;})['then'](respondWithFilteredResult(_0x36663e,_0x5840dc))[_0xc324('0x46')](handleError(_0x36663e,null));};exports['show']=function(_0xabb167,_0x47cc1f){var _0x3a3f00={'raw':!![],'where':{'id':_0xabb167[_0xc324('0x47')]['id']}},_0x183d95={};_0x183d95[_0xc324('0x32')]=_[_0xc324('0x34')](db[_0xc324('0x2d')]['rawAttributes']);_0x183d95[_0xc324('0x33')]=_['keys'](_0xabb167[_0xc324('0x33')]);_0x183d95['filters']=_['intersection'](_0x183d95[_0xc324('0x32')],_0x183d95[_0xc324('0x33')]);_0x3a3f00['attributes']=_['intersection'](_0x183d95['model'],qs[_0xc324('0x38')](_0xabb167[_0xc324('0x33')]['fields']));_0x3a3f00[_0xc324('0x36')]=_0x3a3f00[_0xc324('0x36')][_0xc324('0x39')]?_0x3a3f00['attributes']:_0x183d95[_0xc324('0x32')];if(_0xabb167[_0xc324('0x33')][_0xc324('0x42')]){_0x3a3f00[_0xc324('0x43')]=[{'all':!![]}];}_0x3a3f00=_[_0xc324('0x40')]({},_0x3a3f00,_0xabb167[_0xc324('0x41')]);return db['JscriptyQuestionReport']['find'](_0x3a3f00)['then'](handleEntityNotFound(_0x47cc1f,null))['then'](respondWithResult(_0x47cc1f,null))[_0xc324('0x46')](handleError(_0x47cc1f,null));};exports[_0xc324('0x48')]=function(_0x2a29aa,_0x589b54){return db[_0xc324('0x2d')][_0xc324('0x48')](_0x2a29aa[_0xc324('0x49')],{})[_0xc324('0x25')](respondWithResult(_0x589b54,0xc9))['catch'](handleError(_0x589b54,null));};exports[_0xc324('0x24')]=function(_0x2d65d1,_0x510a64){if(_0x2d65d1['body']['id']){delete _0x2d65d1['body']['id'];}return db[_0xc324('0x2d')][_0xc324('0x4a')]({'where':{'id':_0x2d65d1[_0xc324('0x47')]['id']}})[_0xc324('0x25')](handleEntityNotFound(_0x510a64,null))['then'](saveUpdates(_0x2d65d1['body'],null))[_0xc324('0x25')](respondWithResult(_0x510a64,null))['catch'](handleError(_0x510a64,null));};exports[_0xc324('0x26')]=function(_0x163a70,_0x37afab){return db['JscriptyQuestionReport'][_0xc324('0x4a')]({'where':{'id':_0x163a70[_0xc324('0x47')]['id']}})[_0xc324('0x25')](handleEntityNotFound(_0x37afab,null))['then'](removeEntity(_0x37afab,null))[_0xc324('0x46')](handleError(_0x37afab,null));};exports[_0xc324('0x4b')]=function(_0x4c0845,_0x454a20){return db[_0xc324('0x2d')][_0xc324('0x4b')]()[_0xc324('0x25')](respondWithResult(_0x454a20,null))[_0xc324('0x46')](handleError(_0x454a20,null));}; \ No newline at end of file diff --git a/server/api/jscriptyQuestionReport/jscriptyQuestionReport.model.js b/server/api/jscriptyQuestionReport/jscriptyQuestionReport.model.js index 90b29d3..6aa2dfa 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 _0x1d4c=['JscriptyQuestionReport','report_jscripty_questions','lodash','../../config/logger','api','moment','bluebird','request-promise','path','./jscriptyQuestionReport.attributes','exports','define'];(function(_0x40f355,_0x27fac0){var _0x1ebb62=function(_0x5e94f4){while(--_0x5e94f4){_0x40f355['push'](_0x40f355['shift']());}};_0x1ebb62(++_0x27fac0);}(_0x1d4c,0x122));var _0xc1d4=function(_0x14ace5,_0x2fc54c){_0x14ace5=_0x14ace5-0x0;var _0x1391cb=_0x1d4c[_0x14ace5];return _0x1391cb;};'use strict';var _=require(_0xc1d4('0x0'));var util=require('util');var logger=require(_0xc1d4('0x1'))(_0xc1d4('0x2'));var moment=require(_0xc1d4('0x3'));var BPromise=require(_0xc1d4('0x4'));var rp=require(_0xc1d4('0x5'));var fs=require('fs');var path=require(_0xc1d4('0x6'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0xc1d4('0x7'));module[_0xc1d4('0x8')]=function(_0x53a774,_0x36aeef){return _0x53a774[_0xc1d4('0x9')](_0xc1d4('0xa'),attributes,{'tableName':_0xc1d4('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x5a39=['api','moment','request-promise','rimraf','../../config/environment','./jscriptyQuestionReport.attributes','define','JscriptyQuestionReport','report_jscripty_questions','lodash','util','../../config/logger'];(function(_0x1a606e,_0x1399ba){var _0x4e580b=function(_0x44909d){while(--_0x44909d){_0x1a606e['push'](_0x1a606e['shift']());}};_0x4e580b(++_0x1399ba);}(_0x5a39,0x189));var _0x95a3=function(_0x3e202b,_0x70c288){_0x3e202b=_0x3e202b-0x0;var _0x1c2ad4=_0x5a39[_0x3e202b];return _0x1c2ad4;};'use strict';var _=require(_0x95a3('0x0'));var util=require(_0x95a3('0x1'));var logger=require(_0x95a3('0x2'))(_0x95a3('0x3'));var moment=require(_0x95a3('0x4'));var BPromise=require('bluebird');var rp=require(_0x95a3('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x95a3('0x6'));var config=require(_0x95a3('0x7'));var attributes=require(_0x95a3('0x8'));module['exports']=function(_0x52681b,_0x48adda){return _0x52681b[_0x95a3('0x9')](_0x95a3('0xa'),attributes,{'tableName':_0x95a3('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/jscriptyQuestionReport/jscriptyQuestionReport.rpc.js b/server/api/jscriptyQuestionReport/jscriptyQuestionReport.rpc.js index d804307..cefc0e2 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 _0xb90f=['util','moment','bluebird','randomstring','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','then','info','JscriptyQuestionReport,\x20%s,\x20%s','request\x20sent','debug','JscriptyQuestionReport,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','lodash'];(function(_0x590b6f,_0x51a625){var _0x2f1937=function(_0x4df90d){while(--_0x4df90d){_0x590b6f['push'](_0x590b6f['shift']());}};_0x2f1937(++_0x51a625);}(_0xb90f,0x113));var _0xfb90=function(_0x3aa44f,_0x4c45f8){_0x3aa44f=_0x3aa44f-0x0;var _0x20329b=_0xb90f[_0x3aa44f];return _0x20329b;};'use strict';var _=require(_0xfb90('0x0'));var util=require(_0xfb90('0x1'));var moment=require(_0xfb90('0x2'));var BPromise=require(_0xfb90('0x3'));var rs=require(_0xfb90('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xfb90('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0xfb90('0x6'))(_0xfb90('0x7'));var config=require(_0xfb90('0x8'));var jayson=require(_0xfb90('0x9'));var client=jayson[_0xfb90('0xa')][_0xfb90('0xb')]({'port':0x232a});function respondWithRpcPromise(_0xcb9f56,_0x26268c,_0x52c35d){return new BPromise(function(_0x42444c,_0x30d08e){return client['request'](_0xcb9f56,_0x52c35d)[_0xfb90('0xc')](function(_0xfa3de2){logger[_0xfb90('0xd')](_0xfb90('0xe'),_0x26268c,_0xfb90('0xf'));logger[_0xfb90('0x10')](_0xfb90('0x11'),_0x26268c,'request\x20sent',JSON['stringify'](_0xfa3de2));if(_0xfa3de2[_0xfb90('0x12')]){if(_0xfa3de2[_0xfb90('0x12')][_0xfb90('0x13')]===0x1f4){logger[_0xfb90('0x12')](_0xfb90('0xe'),_0x26268c,_0xfa3de2['error'][_0xfb90('0x14')]);return _0x30d08e(_0xfa3de2[_0xfb90('0x12')][_0xfb90('0x14')]);}logger[_0xfb90('0x12')](_0xfb90('0xe'),_0x26268c,_0xfa3de2[_0xfb90('0x12')][_0xfb90('0x14')]);return _0x42444c(_0xfa3de2[_0xfb90('0x12')][_0xfb90('0x14')]);}else{logger[_0xfb90('0xd')](_0xfb90('0xe'),_0x26268c,_0xfb90('0xf'));_0x42444c(_0xfa3de2[_0xfb90('0x15')][_0xfb90('0x14')]);}})[_0xfb90('0x16')](function(_0x1b2b60){logger[_0xfb90('0x12')](_0xfb90('0xe'),_0x26268c,_0x1b2b60);_0x30d08e(_0x1b2b60);});});} \ No newline at end of file +var _0x51ad=['message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','JscriptyQuestionReport,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code'];(function(_0x4b7f9d,_0x5513ec){var _0x2f0016=function(_0x1c26c6){while(--_0x1c26c6){_0x4b7f9d['push'](_0x4b7f9d['shift']());}};_0x2f0016(++_0x5513ec);}(_0x51ad,0x80));var _0xd51a=function(_0x42cae2,_0x284ef8){_0x42cae2=_0x42cae2-0x0;var _0x5f256f=_0x51ad[_0x42cae2];return _0x5f256f;};'use strict';var _=require(_0xd51a('0x0'));var util=require(_0xd51a('0x1'));var moment=require(_0xd51a('0x2'));var BPromise=require(_0xd51a('0x3'));var rs=require(_0xd51a('0x4'));var fs=require('fs');var Redis=require(_0xd51a('0x5'));var db=require(_0xd51a('0x6'))['db'];var utils=require(_0xd51a('0x7'));var logger=require(_0xd51a('0x8'))(_0xd51a('0x9'));var config=require(_0xd51a('0xa'));var jayson=require(_0xd51a('0xb'));var client=jayson[_0xd51a('0xc')][_0xd51a('0xd')]({'port':0x232a});function respondWithRpcPromise(_0x1681f8,_0x5eebd7,_0x530557){return new BPromise(function(_0x53380c,_0x9352c0){return client[_0xd51a('0xe')](_0x1681f8,_0x530557)[_0xd51a('0xf')](function(_0x6d05d){logger['info'](_0xd51a('0x10'),_0x5eebd7,_0xd51a('0x11'));logger[_0xd51a('0x12')]('JscriptyQuestionReport,\x20%s,\x20%s,\x20%s',_0x5eebd7,'request\x20sent',JSON[_0xd51a('0x13')](_0x6d05d));if(_0x6d05d[_0xd51a('0x14')]){if(_0x6d05d['error'][_0xd51a('0x15')]===0x1f4){logger[_0xd51a('0x14')]('JscriptyQuestionReport,\x20%s,\x20%s',_0x5eebd7,_0x6d05d[_0xd51a('0x14')][_0xd51a('0x16')]);return _0x9352c0(_0x6d05d['error'][_0xd51a('0x16')]);}logger[_0xd51a('0x14')](_0xd51a('0x10'),_0x5eebd7,_0x6d05d[_0xd51a('0x14')][_0xd51a('0x16')]);return _0x53380c(_0x6d05d['error']['message']);}else{logger['info'](_0xd51a('0x10'),_0x5eebd7,_0xd51a('0x11'));_0x53380c(_0x6d05d[_0xd51a('0x17')]['message']);}})[_0xd51a('0x18')](function(_0x41883c){logger[_0xd51a('0x14')](_0xd51a('0x10'),_0x5eebd7,_0x41883c);_0x9352c0(_0x41883c);});});} \ No newline at end of file diff --git a/server/api/jscriptySessionReport/index.js b/server/api/jscriptySessionReport/index.js index 1da2246..a7e546e 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 _0x8098=['update','exports','path','connect-timeout','express','Router','../../components/auth/service','../../config/environment','./jscriptySessionReport.controller','get','isAuthenticated','/describe','describe','/:id','show','/:id/questions','getQuestions','post','create','put'];(function(_0x206d4a,_0xe9b397){var _0xf4e826=function(_0x491e15){while(--_0x491e15){_0x206d4a['push'](_0x206d4a['shift']());}};_0xf4e826(++_0xe9b397);}(_0x8098,0x1ba));var _0x8809=function(_0x39859b,_0x2fd601){_0x39859b=_0x39859b-0x0;var _0x2c3170=_0x8098[_0x39859b];return _0x2c3170;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x8809('0x0'));var timeout=require(_0x8809('0x1'));var express=require(_0x8809('0x2'));var router=express[_0x8809('0x3')]();var auth=require(_0x8809('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0x8809('0x5'));var controller=require(_0x8809('0x6'));router[_0x8809('0x7')]('/',auth[_0x8809('0x8')](),controller['index']);router[_0x8809('0x7')](_0x8809('0x9'),auth['isAuthenticated'](),controller[_0x8809('0xa')]);router[_0x8809('0x7')](_0x8809('0xb'),auth[_0x8809('0x8')](),controller[_0x8809('0xc')]);router[_0x8809('0x7')](_0x8809('0xd'),auth[_0x8809('0x8')](),controller[_0x8809('0xe')]);router[_0x8809('0xf')]('/',auth[_0x8809('0x8')](),controller[_0x8809('0x10')]);router[_0x8809('0x11')](_0x8809('0xb'),auth[_0x8809('0x8')](),controller[_0x8809('0x12')]);router['delete'](_0x8809('0xb'),auth[_0x8809('0x8')](),controller['destroy']);module[_0x8809('0x13')]=router; \ No newline at end of file +var _0x8ef6=['destroy','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../config/environment','./jscriptySessionReport.controller','get','isAuthenticated','/describe','describe','/:id','show','/:id/questions','getQuestions','post','create','put','update','delete'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x8ef6,0xf2));var _0x68ef=function(_0x3f56f6,_0x4d2a9d){_0x3f56f6=_0x3f56f6-0x0;var _0x4f56d7=_0x8ef6[_0x3f56f6];return _0x4f56d7;};'use strict';var multer=require(_0x68ef('0x0'));var util=require(_0x68ef('0x1'));var path=require(_0x68ef('0x2'));var timeout=require(_0x68ef('0x3'));var express=require(_0x68ef('0x4'));var router=express[_0x68ef('0x5')]();var auth=require(_0x68ef('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x68ef('0x7'));var controller=require(_0x68ef('0x8'));router[_0x68ef('0x9')]('/',auth[_0x68ef('0xa')](),controller['index']);router['get'](_0x68ef('0xb'),auth[_0x68ef('0xa')](),controller[_0x68ef('0xc')]);router['get'](_0x68ef('0xd'),auth[_0x68ef('0xa')](),controller[_0x68ef('0xe')]);router[_0x68ef('0x9')](_0x68ef('0xf'),auth[_0x68ef('0xa')](),controller[_0x68ef('0x10')]);router[_0x68ef('0x11')]('/',auth[_0x68ef('0xa')](),controller[_0x68ef('0x12')]);router[_0x68ef('0x13')](_0x68ef('0xd'),auth['isAuthenticated'](),controller[_0x68ef('0x14')]);router[_0x68ef('0x15')](_0x68ef('0xd'),auth[_0x68ef('0xa')](),controller[_0x68ef('0x16')]);module[_0x68ef('0x17')]=router; \ No newline at end of file diff --git a/server/api/jscriptySessionReport/jscriptySessionReport.attributes.js b/server/api/jscriptySessionReport/jscriptySessionReport.attributes.js index de8f864..8e2efb9 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 _0x9ede=['endtime','format','YYYY-MM-DD\x20HH:mm:ss','DATE','STRING','sequelize','exports','setDataValue','starttime'];(function(_0x505ba4,_0x2e415d){var _0x420b23=function(_0x4d042f){while(--_0x4d042f){_0x505ba4['push'](_0x505ba4['shift']());}};_0x420b23(++_0x2e415d);}(_0x9ede,0x152));var _0xe9ed=function(_0x181c11,_0x471472){_0x181c11=_0x181c11-0x0;var _0x4324a0=_0x9ede[_0x181c11];return _0x4324a0;};'use strict';var moment=require('moment');var Sequelize=require(_0xe9ed('0x0'));module[_0xe9ed('0x1')]={'starttime':{'type':Sequelize['DATE'],'set':function(_0x587318){this[_0xe9ed('0x2')](_0xe9ed('0x3'),_0x587318);this[_0xe9ed('0x2')](_0xe9ed('0x4'),moment()[_0xe9ed('0x5')](_0xe9ed('0x6')));}},'endtime':{'type':Sequelize[_0xe9ed('0x7')]},'membername':{'type':Sequelize[_0xe9ed('0x8')]},'projectname':{'type':Sequelize[_0xe9ed('0x8')]},'queue':{'type':Sequelize[_0xe9ed('0x8')]},'uniqueid':{'type':Sequelize['STRING']},'calleridname':{'type':Sequelize[_0xe9ed('0x8')]},'calleridnum':{'type':Sequelize[_0xe9ed('0x8')]},'completed':{'type':Sequelize['BOOLEAN'],'defaultValue':![]}}; \ No newline at end of file +var _0x4362=['YYYY-MM-DD\x20HH:mm:ss','STRING','moment','sequelize','exports','DATE','starttime'];(function(_0x3f2cae,_0x1415e5){var _0x30e570=function(_0x2e91f7){while(--_0x2e91f7){_0x3f2cae['push'](_0x3f2cae['shift']());}};_0x30e570(++_0x1415e5);}(_0x4362,0x105));var _0x2436=function(_0x29a8f7,_0x2441f8){_0x29a8f7=_0x29a8f7-0x0;var _0x37a48c=_0x4362[_0x29a8f7];return _0x37a48c;};'use strict';var moment=require(_0x2436('0x0'));var Sequelize=require(_0x2436('0x1'));module[_0x2436('0x2')]={'starttime':{'type':Sequelize[_0x2436('0x3')],'set':function(_0x52caac){this['setDataValue'](_0x2436('0x4'),_0x52caac);this['setDataValue']('endtime',moment()['format'](_0x2436('0x5')));}},'endtime':{'type':Sequelize[_0x2436('0x3')]},'membername':{'type':Sequelize[_0x2436('0x6')]},'projectname':{'type':Sequelize[_0x2436('0x6')]},'queue':{'type':Sequelize[_0x2436('0x6')]},'uniqueid':{'type':Sequelize[_0x2436('0x6')]},'calleridname':{'type':Sequelize[_0x2436('0x6')]},'calleridnum':{'type':Sequelize[_0x2436('0x6')]},'completed':{'type':Sequelize['BOOLEAN'],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/jscriptySessionReport/jscriptySessionReport.controller.js b/server/api/jscriptySessionReport/jscriptySessionReport.controller.js index 47d85fb..c3060b0 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 _0x528b=['rawAttributes','fieldName','type','key','model','query','keys','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','filters','pick','filter','where','merge','VIRTUAL','options','then','includeAll','include','findAll','rows','catch','show','params','find','create','body','describe','getQuestions','findOne','JscriptyQuestionReport','html-pdf','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','sox','ejs','crypto','jsforce','desk.js','to-csv','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/utils','status','end','count','offset','limit','set','Content-Range','json','apply','save','update','destroy','sendStatus','error','stack','name','send','index','map','JscriptySessionReport'];(function(_0x21a9d9,_0x4d5ac8){var _0x46adce=function(_0xfdd336){while(--_0xfdd336){_0x21a9d9['push'](_0x21a9d9['shift']());}};_0x46adce(++_0x4d5ac8);}(_0x528b,0x112));var _0xb528=function(_0x4cad35,_0x56fe37){_0x4cad35=_0x4cad35-0x0;var _0xc7013=_0x528b[_0x4cad35];return _0xc7013;};'use strict';var pdf=require(_0xb528('0x0'));var emlformat=require(_0xb528('0x1'));var rimraf=require(_0xb528('0x2'));var zipdir=require(_0xb528('0x3'));var jsonpatch=require('fast-json-patch');var rp=require(_0xb528('0x4'));var moment=require(_0xb528('0x5'));var BPromise=require(_0xb528('0x6'));var Mustache=require(_0xb528('0x7'));var util=require(_0xb528('0x8'));var path=require('path');var sox=require(_0xb528('0x9'));var csv=require('to-csv');var ejs=require(_0xb528('0xa'));var fs=require('fs');var _=require('lodash');var squel=require('squel');var crypto=require(_0xb528('0xb'));var jsforce=require(_0xb528('0xc'));var deskjs=require(_0xb528('0xd'));var toCsv=require(_0xb528('0xe'));var querystring=require('querystring');var Papa=require(_0xb528('0xf'));var Redis=require(_0xb528('0x10'));var authService=require(_0xb528('0x11'));var qs=require(_0xb528('0x12'));var as=require(_0xb528('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0xb528('0x14'));var utils=require(_0xb528('0x15'));var config=require('../../config/environment');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x541848,_0xf823d3){_0xf823d3=_0xf823d3||0xcc;return function(_0x3729dd){if(_0x3729dd){return _0x541848['sendStatus'](_0xf823d3);}return _0x541848[_0xb528('0x16')](_0xf823d3)[_0xb528('0x17')]();};}function respondWithResult(_0x351579,_0x59442c){_0x59442c=_0x59442c||0xc8;return function(_0x3016e5){if(_0x3016e5){return _0x351579[_0xb528('0x16')](_0x59442c)['json'](_0x3016e5);}};}function respondWithFilteredResult(_0x3e10c0,_0xb6d9ae){return function(_0x476e05){if(_0x476e05){var _0x4c8c40=_0x476e05[_0xb528('0x18')],_0x495294=_0xb6d9ae['offset'],_0x2a50ff=_0xb6d9ae[_0xb528('0x19')]+_0xb6d9ae[_0xb528('0x1a')],_0x4eecce;if(_0x2a50ff>=_0x4c8c40){_0x2a50ff=_0x4c8c40;_0x4eecce=0xc8;}else{_0x4eecce=0xce;}_0x3e10c0[_0xb528('0x16')](_0x4eecce);return _0x3e10c0[_0xb528('0x1b')](_0xb528('0x1c'),_0x495294+'-'+_0x2a50ff+'/'+_0x4c8c40)[_0xb528('0x1d')](_0x476e05);}return null;};}function patchUpdates(_0x804322){return function(_0x5e7c43){try{jsonpatch[_0xb528('0x1e')](_0x5e7c43,_0x804322,!![]);}catch(_0x3f9c60){return BPromise['reject'](_0x3f9c60);}return _0x5e7c43[_0xb528('0x1f')]();};}function saveUpdates(_0x1edf27,_0x2022da){return function(_0x466ddf){if(_0x466ddf){return _0x466ddf[_0xb528('0x20')](_0x1edf27)['then'](function(_0x1dd46d){return _0x1dd46d;});}return null;};}function removeEntity(_0x2330b8,_0x2fc778){return function(_0xfe6b6a){if(_0xfe6b6a){return _0xfe6b6a[_0xb528('0x21')]()['then'](function(){_0x2330b8[_0xb528('0x16')](0xcc)[_0xb528('0x17')]();});}};}function handleEntityNotFound(_0xb0eb5,_0x3e5534){return function(_0xbd9073){if(!_0xbd9073){_0xb0eb5[_0xb528('0x22')](0x194);}return _0xbd9073;};}function handleError(_0xe09cb4,_0x1208cf){_0x1208cf=_0x1208cf||0x1f4;return function(_0x28ab09){logger[_0xb528('0x23')](_0x28ab09[_0xb528('0x24')]);if(_0x28ab09[_0xb528('0x25')]){delete _0x28ab09[_0xb528('0x25')];}_0xe09cb4[_0xb528('0x16')](_0x1208cf)[_0xb528('0x26')](_0x28ab09);};}exports[_0xb528('0x27')]=function(_0x291594,_0xcf03fd){var _0x18c60b={},_0x442521={},_0x51b231={'count':0x0,'rows':[]};var _0x12ba2d=_[_0xb528('0x28')](db[_0xb528('0x29')][_0xb528('0x2a')],function(_0x30af50){return{'name':_0x30af50[_0xb528('0x2b')],'type':_0x30af50[_0xb528('0x2c')][_0xb528('0x2d')]};});_0x442521[_0xb528('0x2e')]=_[_0xb528('0x28')](_0x12ba2d,_0xb528('0x25'));_0x442521[_0xb528('0x2f')]=_[_0xb528('0x30')](_0x291594[_0xb528('0x2f')]);_0x442521['filters']=_[_0xb528('0x31')](_0x442521[_0xb528('0x2e')],_0x442521[_0xb528('0x2f')]);_0x18c60b['attributes']=_[_0xb528('0x31')](_0x442521['model'],qs[_0xb528('0x32')](_0x291594[_0xb528('0x2f')][_0xb528('0x32')]));_0x18c60b['attributes']=_0x18c60b[_0xb528('0x33')][_0xb528('0x34')]?_0x18c60b[_0xb528('0x33')]:_0x442521[_0xb528('0x2e')];if(!_0x291594[_0xb528('0x2f')][_0xb528('0x35')](_0xb528('0x36'))){_0x18c60b[_0xb528('0x1a')]=qs[_0xb528('0x1a')](_0x291594[_0xb528('0x2f')][_0xb528('0x1a')]);_0x18c60b[_0xb528('0x19')]=qs['offset'](_0x291594[_0xb528('0x2f')]['offset']);}_0x18c60b[_0xb528('0x37')]=qs['sort'](_0x291594['query'][_0xb528('0x38')]);_0x18c60b['where']=qs[_0xb528('0x39')](_[_0xb528('0x3a')](_0x291594[_0xb528('0x2f')],_0x442521['filters']));if(_0x291594['query'][_0xb528('0x3b')]){_0x18c60b[_0xb528('0x3c')]=_[_0xb528('0x3d')](_0x18c60b['where'],{'$or':_['map'](_0x12ba2d,function(_0x5cc93){if(_0x5cc93[_0xb528('0x2c')]!==_0xb528('0x3e')){var _0x127167={};_0x127167[_0x5cc93[_0xb528('0x25')]]={'$like':'%'+_0x291594[_0xb528('0x2f')][_0xb528('0x3b')]+'%'};return _0x127167;}})});}_0x18c60b=_[_0xb528('0x3d')]({},_0x18c60b,_0x291594[_0xb528('0x3f')]);var _0x37b358={'where':_0x18c60b[_0xb528('0x3c')]};return db[_0xb528('0x29')][_0xb528('0x18')](_0x37b358)[_0xb528('0x40')](function(_0x1080d2){_0x51b231[_0xb528('0x18')]=_0x1080d2;if(_0x291594[_0xb528('0x2f')][_0xb528('0x41')]){_0x18c60b[_0xb528('0x42')]=[{'all':!![]}];}return db[_0xb528('0x29')][_0xb528('0x43')](_0x18c60b);})[_0xb528('0x40')](function(_0x4bc74b){_0x51b231[_0xb528('0x44')]=_0x4bc74b;return _0x51b231;})[_0xb528('0x40')](respondWithFilteredResult(_0xcf03fd,_0x18c60b))[_0xb528('0x45')](handleError(_0xcf03fd,null));};exports[_0xb528('0x46')]=function(_0x116d29,_0x54b7ed){var _0x582897={'raw':!![],'where':{'id':_0x116d29[_0xb528('0x47')]['id']}},_0x16775b={};_0x16775b[_0xb528('0x2e')]=_[_0xb528('0x30')](db[_0xb528('0x29')][_0xb528('0x2a')]);_0x16775b[_0xb528('0x2f')]=_[_0xb528('0x30')](_0x116d29[_0xb528('0x2f')]);_0x16775b[_0xb528('0x39')]=_['intersection'](_0x16775b[_0xb528('0x2e')],_0x16775b[_0xb528('0x2f')]);_0x582897[_0xb528('0x33')]=_[_0xb528('0x31')](_0x16775b[_0xb528('0x2e')],qs[_0xb528('0x32')](_0x116d29[_0xb528('0x2f')][_0xb528('0x32')]));_0x582897[_0xb528('0x33')]=_0x582897[_0xb528('0x33')][_0xb528('0x34')]?_0x582897[_0xb528('0x33')]:_0x16775b[_0xb528('0x2e')];if(_0x116d29[_0xb528('0x2f')]['includeAll']){_0x582897[_0xb528('0x42')]=[{'all':!![]}];}_0x582897=_['merge']({},_0x582897,_0x116d29[_0xb528('0x3f')]);return db[_0xb528('0x29')][_0xb528('0x48')](_0x582897)[_0xb528('0x40')](handleEntityNotFound(_0x54b7ed,null))['then'](respondWithResult(_0x54b7ed,null))[_0xb528('0x45')](handleError(_0x54b7ed,null));};exports['create']=function(_0x296bd0,_0x52f608){return db[_0xb528('0x29')][_0xb528('0x49')](_0x296bd0[_0xb528('0x4a')],{})[_0xb528('0x40')](respondWithResult(_0x52f608,0xc9))[_0xb528('0x45')](handleError(_0x52f608,null));};exports[_0xb528('0x20')]=function(_0x56c39e,_0x5e11fb){if(_0x56c39e['body']['id']){delete _0x56c39e[_0xb528('0x4a')]['id'];}return db[_0xb528('0x29')][_0xb528('0x48')]({'where':{'id':_0x56c39e[_0xb528('0x47')]['id']}})['then'](handleEntityNotFound(_0x5e11fb,null))[_0xb528('0x40')](saveUpdates(_0x56c39e[_0xb528('0x4a')],null))[_0xb528('0x40')](respondWithResult(_0x5e11fb,null))[_0xb528('0x45')](handleError(_0x5e11fb,null));};exports[_0xb528('0x21')]=function(_0x4e849f,_0xcefefc){return db[_0xb528('0x29')][_0xb528('0x48')]({'where':{'id':_0x4e849f[_0xb528('0x47')]['id']}})[_0xb528('0x40')](handleEntityNotFound(_0xcefefc,null))[_0xb528('0x40')](removeEntity(_0xcefefc,null))['catch'](handleError(_0xcefefc,null));};exports[_0xb528('0x4b')]=function(_0x55715b,_0x23eab0){return db[_0xb528('0x29')][_0xb528('0x4b')]()['then'](respondWithResult(_0x23eab0,null))[_0xb528('0x45')](handleError(_0x23eab0,null));};exports[_0xb528('0x4c')]=function(_0x4cacb6,_0x39c6a1,_0x8cacb3){var _0x51599d={'raw':!![],'where':{}};var _0xe14dc2={};var _0x1520ed={'count':0x0,'rows':[]};return db[_0xb528('0x29')][_0xb528('0x4d')]({'where':{'id':_0x4cacb6[_0xb528('0x47')]['id']}})[_0xb528('0x40')](handleEntityNotFound(_0x39c6a1,null))[_0xb528('0x40')](function(_0x943165){if(_0x943165){_0xe14dc2[_0xb528('0x2e')]=_['keys'](db[_0xb528('0x4e')]['rawAttributes']);_0xe14dc2[_0xb528('0x2f')]=_[_0xb528('0x30')](_0x4cacb6[_0xb528('0x2f')]);_0xe14dc2[_0xb528('0x39')]=_[_0xb528('0x31')](_0xe14dc2[_0xb528('0x2e')],_0xe14dc2[_0xb528('0x2f')]);_0x51599d[_0xb528('0x33')]=_[_0xb528('0x31')](_0xe14dc2[_0xb528('0x2e')],qs[_0xb528('0x32')](_0x4cacb6[_0xb528('0x2f')][_0xb528('0x32')]));_0x51599d[_0xb528('0x33')]=_0x51599d[_0xb528('0x33')][_0xb528('0x34')]?_0x51599d['attributes']:_0xe14dc2[_0xb528('0x2e')];if(!_0x4cacb6[_0xb528('0x2f')][_0xb528('0x35')](_0xb528('0x36'))){_0x51599d[_0xb528('0x1a')]=qs[_0xb528('0x1a')](_0x4cacb6[_0xb528('0x2f')][_0xb528('0x1a')]);_0x51599d['offset']=qs[_0xb528('0x19')](_0x4cacb6[_0xb528('0x2f')]['offset']);}_0x51599d[_0xb528('0x37')]=qs[_0xb528('0x38')](_0x4cacb6[_0xb528('0x2f')][_0xb528('0x38')]);_0x51599d['where']=qs[_0xb528('0x39')](_[_0xb528('0x3a')](_0x4cacb6[_0xb528('0x2f')],_0xe14dc2[_0xb528('0x39')]));_0x51599d[_0xb528('0x3c')]['SessionId']=_0x943165['id'];if(_0x4cacb6[_0xb528('0x2f')][_0xb528('0x3b')]){_0x51599d[_0xb528('0x3c')]=_[_0xb528('0x3d')](_0x51599d[_0xb528('0x3c')],{'$or':_[_0xb528('0x28')](_0x51599d[_0xb528('0x33')],function(_0xbd3e61){var _0x19ee27={};_0x19ee27[_0xbd3e61]={'$like':'%'+_0x4cacb6['query'][_0xb528('0x3b')]+'%'};return _0x19ee27;})});}_0x51599d=_[_0xb528('0x3d')]({},_0x51599d,_0x4cacb6[_0xb528('0x3f')]);return db[_0xb528('0x4e')]['count']({'where':_0x51599d[_0xb528('0x3c')]})[_0xb528('0x40')](function(_0x3120e7){_0x1520ed[_0xb528('0x18')]=_0x3120e7;if(_0x4cacb6[_0xb528('0x2f')][_0xb528('0x41')]){_0x51599d[_0xb528('0x42')]=[{'all':!![]}];}return db['JscriptyQuestionReport'][_0xb528('0x43')](_0x51599d);})[_0xb528('0x40')](function(_0x1384af){_0x1520ed[_0xb528('0x44')]=_0x1384af;return _0x1520ed;});}})[_0xb528('0x40')](respondWithFilteredResult(_0x39c6a1,_0x51599d))[_0xb528('0x45')](handleError(_0x39c6a1,null));}; \ No newline at end of file +var _0x390b=['status','json','offset','limit','set','Content-Range','apply','reject','update','then','destroy','end','sendStatus','error','name','send','index','map','JscriptySessionReport','rawAttributes','query','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','merge','type','VIRTUAL','filter','options','count','includeAll','include','rows','catch','show','keys','body','find','params','describe','getQuestions','findOne','JscriptyQuestionReport','SessionId','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','ejs','crypto','jsforce','desk.js','to-csv','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb'];(function(_0x5524a1,_0x37c171){var _0x4ea5e3=function(_0x493ee1){while(--_0x493ee1){_0x5524a1['push'](_0x5524a1['shift']());}};_0x4ea5e3(++_0x37c171);}(_0x390b,0x169));var _0xb390=function(_0x38aef0,_0x1a4765){_0x38aef0=_0x38aef0-0x0;var _0x2cc5fa=_0x390b[_0x38aef0];return _0x2cc5fa;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0xb390('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xb390('0x1'));var jsonpatch=require(_0xb390('0x2'));var rp=require(_0xb390('0x3'));var moment=require(_0xb390('0x4'));var BPromise=require(_0xb390('0x5'));var Mustache=require(_0xb390('0x6'));var util=require('util');var path=require(_0xb390('0x7'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0xb390('0x8'));var fs=require('fs');var _=require('lodash');var squel=require('squel');var crypto=require(_0xb390('0x9'));var jsforce=require(_0xb390('0xa'));var deskjs=require(_0xb390('0xb'));var toCsv=require(_0xb390('0xc'));var querystring=require(_0xb390('0xd'));var Papa=require(_0xb390('0xe'));var Redis=require('ioredis');var authService=require(_0xb390('0xf'));var qs=require(_0xb390('0x10'));var as=require(_0xb390('0x11'));var hardwareService=require(_0xb390('0x12'));var logger=require(_0xb390('0x13'))(_0xb390('0x14'));var utils=require(_0xb390('0x15'));var config=require(_0xb390('0x16'));var db=require(_0xb390('0x17'))['db'];function respondWithStatusCode(_0x399d70,_0x40e847){_0x40e847=_0x40e847||0xcc;return function(_0x5dfe7a){if(_0x5dfe7a){return _0x399d70['sendStatus'](_0x40e847);}return _0x399d70[_0xb390('0x18')](_0x40e847)['end']();};}function respondWithResult(_0x4426a6,_0x5b6a6c){_0x5b6a6c=_0x5b6a6c||0xc8;return function(_0x3b321d){if(_0x3b321d){return _0x4426a6['status'](_0x5b6a6c)[_0xb390('0x19')](_0x3b321d);}};}function respondWithFilteredResult(_0x4c1948,_0x25d273){return function(_0x27b290){if(_0x27b290){var _0x2d1cb1=_0x27b290['count'],_0x3bc3de=_0x25d273[_0xb390('0x1a')],_0x44d078=_0x25d273[_0xb390('0x1a')]+_0x25d273[_0xb390('0x1b')],_0x5eefab;if(_0x44d078>=_0x2d1cb1){_0x44d078=_0x2d1cb1;_0x5eefab=0xc8;}else{_0x5eefab=0xce;}_0x4c1948[_0xb390('0x18')](_0x5eefab);return _0x4c1948[_0xb390('0x1c')](_0xb390('0x1d'),_0x3bc3de+'-'+_0x44d078+'/'+_0x2d1cb1)[_0xb390('0x19')](_0x27b290);}return null;};}function patchUpdates(_0x3a708){return function(_0x500dee){try{jsonpatch[_0xb390('0x1e')](_0x500dee,_0x3a708,!![]);}catch(_0x38c251){return BPromise[_0xb390('0x1f')](_0x38c251);}return _0x500dee['save']();};}function saveUpdates(_0xaea716,_0x3292eb){return function(_0x720bb3){if(_0x720bb3){return _0x720bb3[_0xb390('0x20')](_0xaea716)[_0xb390('0x21')](function(_0xe7004d){return _0xe7004d;});}return null;};}function removeEntity(_0xa4989b,_0x8feb7a){return function(_0x317231){if(_0x317231){return _0x317231[_0xb390('0x22')]()[_0xb390('0x21')](function(){_0xa4989b['status'](0xcc)[_0xb390('0x23')]();});}};}function handleEntityNotFound(_0x36cc6c,_0xa8a7ff){return function(_0x3e8595){if(!_0x3e8595){_0x36cc6c[_0xb390('0x24')](0x194);}return _0x3e8595;};}function handleError(_0x36297c,_0x45adab){_0x45adab=_0x45adab||0x1f4;return function(_0xe7a8e6){logger[_0xb390('0x25')](_0xe7a8e6['stack']);if(_0xe7a8e6[_0xb390('0x26')]){delete _0xe7a8e6[_0xb390('0x26')];}_0x36297c[_0xb390('0x18')](_0x45adab)[_0xb390('0x27')](_0xe7a8e6);};}exports[_0xb390('0x28')]=function(_0x5b140a,_0x16b003){var _0x3acfc2={},_0x37518c={},_0x4091d8={'count':0x0,'rows':[]};var _0xfa7c42=_[_0xb390('0x29')](db[_0xb390('0x2a')][_0xb390('0x2b')],function(_0x39c269){return{'name':_0x39c269['fieldName'],'type':_0x39c269['type']['key']};});_0x37518c['model']=_[_0xb390('0x29')](_0xfa7c42,_0xb390('0x26'));_0x37518c[_0xb390('0x2c')]=_['keys'](_0x5b140a['query']);_0x37518c[_0xb390('0x2d')]=_[_0xb390('0x2e')](_0x37518c[_0xb390('0x2f')],_0x37518c[_0xb390('0x2c')]);_0x3acfc2[_0xb390('0x30')]=_[_0xb390('0x2e')](_0x37518c[_0xb390('0x2f')],qs['fields'](_0x5b140a['query'][_0xb390('0x31')]));_0x3acfc2['attributes']=_0x3acfc2[_0xb390('0x30')][_0xb390('0x32')]?_0x3acfc2['attributes']:_0x37518c['model'];if(!_0x5b140a[_0xb390('0x2c')][_0xb390('0x33')](_0xb390('0x34'))){_0x3acfc2[_0xb390('0x1b')]=qs[_0xb390('0x1b')](_0x5b140a['query'][_0xb390('0x1b')]);_0x3acfc2['offset']=qs[_0xb390('0x1a')](_0x5b140a[_0xb390('0x2c')][_0xb390('0x1a')]);}_0x3acfc2[_0xb390('0x35')]=qs[_0xb390('0x36')](_0x5b140a[_0xb390('0x2c')][_0xb390('0x36')]);_0x3acfc2[_0xb390('0x37')]=qs['filters'](_[_0xb390('0x38')](_0x5b140a[_0xb390('0x2c')],_0x37518c['filters']));if(_0x5b140a[_0xb390('0x2c')]['filter']){_0x3acfc2['where']=_[_0xb390('0x39')](_0x3acfc2[_0xb390('0x37')],{'$or':_[_0xb390('0x29')](_0xfa7c42,function(_0x1340a5){if(_0x1340a5[_0xb390('0x3a')]!==_0xb390('0x3b')){var _0x2c981c={};_0x2c981c[_0x1340a5['name']]={'$like':'%'+_0x5b140a[_0xb390('0x2c')][_0xb390('0x3c')]+'%'};return _0x2c981c;}})});}_0x3acfc2=_[_0xb390('0x39')]({},_0x3acfc2,_0x5b140a[_0xb390('0x3d')]);var _0x553252={'where':_0x3acfc2[_0xb390('0x37')]};return db[_0xb390('0x2a')]['count'](_0x553252)[_0xb390('0x21')](function(_0x4c029b){_0x4091d8[_0xb390('0x3e')]=_0x4c029b;if(_0x5b140a[_0xb390('0x2c')][_0xb390('0x3f')]){_0x3acfc2[_0xb390('0x40')]=[{'all':!![]}];}return db[_0xb390('0x2a')]['findAll'](_0x3acfc2);})[_0xb390('0x21')](function(_0x531e6f){_0x4091d8[_0xb390('0x41')]=_0x531e6f;return _0x4091d8;})[_0xb390('0x21')](respondWithFilteredResult(_0x16b003,_0x3acfc2))[_0xb390('0x42')](handleError(_0x16b003,null));};exports[_0xb390('0x43')]=function(_0xdfa270,_0x17f377){var _0x4a9ed3={'raw':!![],'where':{'id':_0xdfa270['params']['id']}},_0x201a86={};_0x201a86[_0xb390('0x2f')]=_[_0xb390('0x44')](db['JscriptySessionReport'][_0xb390('0x2b')]);_0x201a86[_0xb390('0x2c')]=_[_0xb390('0x44')](_0xdfa270[_0xb390('0x2c')]);_0x201a86[_0xb390('0x2d')]=_['intersection'](_0x201a86[_0xb390('0x2f')],_0x201a86[_0xb390('0x2c')]);_0x4a9ed3['attributes']=_[_0xb390('0x2e')](_0x201a86[_0xb390('0x2f')],qs[_0xb390('0x31')](_0xdfa270[_0xb390('0x2c')][_0xb390('0x31')]));_0x4a9ed3['attributes']=_0x4a9ed3[_0xb390('0x30')][_0xb390('0x32')]?_0x4a9ed3[_0xb390('0x30')]:_0x201a86[_0xb390('0x2f')];if(_0xdfa270[_0xb390('0x2c')][_0xb390('0x3f')]){_0x4a9ed3[_0xb390('0x40')]=[{'all':!![]}];}_0x4a9ed3=_[_0xb390('0x39')]({},_0x4a9ed3,_0xdfa270[_0xb390('0x3d')]);return db[_0xb390('0x2a')]['find'](_0x4a9ed3)['then'](handleEntityNotFound(_0x17f377,null))[_0xb390('0x21')](respondWithResult(_0x17f377,null))[_0xb390('0x42')](handleError(_0x17f377,null));};exports['create']=function(_0x256c75,_0x570ecc){return db['JscriptySessionReport']['create'](_0x256c75['body'],{})['then'](respondWithResult(_0x570ecc,0xc9))['catch'](handleError(_0x570ecc,null));};exports[_0xb390('0x20')]=function(_0x26b798,_0x518777){if(_0x26b798[_0xb390('0x45')]['id']){delete _0x26b798[_0xb390('0x45')]['id'];}return db[_0xb390('0x2a')][_0xb390('0x46')]({'where':{'id':_0x26b798[_0xb390('0x47')]['id']}})['then'](handleEntityNotFound(_0x518777,null))[_0xb390('0x21')](saveUpdates(_0x26b798[_0xb390('0x45')],null))[_0xb390('0x21')](respondWithResult(_0x518777,null))[_0xb390('0x42')](handleError(_0x518777,null));};exports[_0xb390('0x22')]=function(_0x4e9e83,_0x36b953){return db[_0xb390('0x2a')][_0xb390('0x46')]({'where':{'id':_0x4e9e83['params']['id']}})[_0xb390('0x21')](handleEntityNotFound(_0x36b953,null))[_0xb390('0x21')](removeEntity(_0x36b953,null))[_0xb390('0x42')](handleError(_0x36b953,null));};exports['describe']=function(_0x5444db,_0x337c75){return db['JscriptySessionReport'][_0xb390('0x48')]()['then'](respondWithResult(_0x337c75,null))[_0xb390('0x42')](handleError(_0x337c75,null));};exports[_0xb390('0x49')]=function(_0x2ee175,_0x2186de,_0x50e252){var _0x1930ed={'raw':!![],'where':{}};var _0x2938d7={};var _0x43609d={'count':0x0,'rows':[]};return db[_0xb390('0x2a')][_0xb390('0x4a')]({'where':{'id':_0x2ee175[_0xb390('0x47')]['id']}})['then'](handleEntityNotFound(_0x2186de,null))[_0xb390('0x21')](function(_0x24c33e){if(_0x24c33e){_0x2938d7[_0xb390('0x2f')]=_[_0xb390('0x44')](db[_0xb390('0x4b')]['rawAttributes']);_0x2938d7[_0xb390('0x2c')]=_[_0xb390('0x44')](_0x2ee175['query']);_0x2938d7[_0xb390('0x2d')]=_[_0xb390('0x2e')](_0x2938d7['model'],_0x2938d7[_0xb390('0x2c')]);_0x1930ed[_0xb390('0x30')]=_['intersection'](_0x2938d7[_0xb390('0x2f')],qs[_0xb390('0x31')](_0x2ee175[_0xb390('0x2c')][_0xb390('0x31')]));_0x1930ed[_0xb390('0x30')]=_0x1930ed[_0xb390('0x30')]['length']?_0x1930ed[_0xb390('0x30')]:_0x2938d7[_0xb390('0x2f')];if(!_0x2ee175['query']['hasOwnProperty']('nolimit')){_0x1930ed[_0xb390('0x1b')]=qs[_0xb390('0x1b')](_0x2ee175[_0xb390('0x2c')][_0xb390('0x1b')]);_0x1930ed[_0xb390('0x1a')]=qs[_0xb390('0x1a')](_0x2ee175[_0xb390('0x2c')][_0xb390('0x1a')]);}_0x1930ed[_0xb390('0x35')]=qs[_0xb390('0x36')](_0x2ee175[_0xb390('0x2c')][_0xb390('0x36')]);_0x1930ed['where']=qs['filters'](_[_0xb390('0x38')](_0x2ee175['query'],_0x2938d7[_0xb390('0x2d')]));_0x1930ed[_0xb390('0x37')][_0xb390('0x4c')]=_0x24c33e['id'];if(_0x2ee175['query'][_0xb390('0x3c')]){_0x1930ed['where']=_[_0xb390('0x39')](_0x1930ed[_0xb390('0x37')],{'$or':_[_0xb390('0x29')](_0x1930ed[_0xb390('0x30')],function(_0x5c0411){var _0x5e8ba6={};_0x5e8ba6[_0x5c0411]={'$like':'%'+_0x2ee175[_0xb390('0x2c')][_0xb390('0x3c')]+'%'};return _0x5e8ba6;})});}_0x1930ed=_[_0xb390('0x39')]({},_0x1930ed,_0x2ee175[_0xb390('0x3d')]);return db[_0xb390('0x4b')][_0xb390('0x3e')]({'where':_0x1930ed['where']})[_0xb390('0x21')](function(_0x58bde3){_0x43609d[_0xb390('0x3e')]=_0x58bde3;if(_0x2ee175['query']['includeAll']){_0x1930ed[_0xb390('0x40')]=[{'all':!![]}];}return db[_0xb390('0x4b')]['findAll'](_0x1930ed);})[_0xb390('0x21')](function(_0x4245fa){_0x43609d[_0xb390('0x41')]=_0x4245fa;return _0x43609d;});}})[_0xb390('0x21')](respondWithFilteredResult(_0x2186de,_0x1930ed))[_0xb390('0x42')](handleError(_0x2186de,null));}; \ No newline at end of file diff --git a/server/api/jscriptySessionReport/jscriptySessionReport.model.js b/server/api/jscriptySessionReport/jscriptySessionReport.model.js index bc8031e..0055c86 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 _0x2802=['define','JscriptySessionReport','lodash','util','moment','bluebird','request-promise','rimraf','../../config/environment','./jscriptySessionReport.attributes'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x2802,0x8e));var _0x2280=function(_0x4653f7,_0x3d3ae3){_0x4653f7=_0x4653f7-0x0;var _0x5454da=_0x2802[_0x4653f7];return _0x5454da;};'use strict';var _=require(_0x2280('0x0'));var util=require(_0x2280('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0x2280('0x2'));var BPromise=require(_0x2280('0x3'));var rp=require(_0x2280('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x2280('0x5'));var config=require(_0x2280('0x6'));var attributes=require(_0x2280('0x7'));module['exports']=function(_0x510b60,_0x1a6ff1){return _0x510b60[_0x2280('0x8')](_0x2280('0x9'),attributes,{'tableName':'report_jscripty_sessions','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xd584=['util','../../config/logger','api','moment','bluebird','request-promise','path','../../config/environment','./jscriptySessionReport.attributes','exports','define','JscriptySessionReport','lodash'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xd584,0x19f));var _0x4d58=function(_0x3acfc5,_0x5d1551){_0x3acfc5=_0x3acfc5-0x0;var _0x4f1245=_0xd584[_0x3acfc5];return _0x4f1245;};'use strict';var _=require(_0x4d58('0x0'));var util=require(_0x4d58('0x1'));var logger=require(_0x4d58('0x2'))(_0x4d58('0x3'));var moment=require(_0x4d58('0x4'));var BPromise=require(_0x4d58('0x5'));var rp=require(_0x4d58('0x6'));var fs=require('fs');var path=require(_0x4d58('0x7'));var rimraf=require('rimraf');var config=require(_0x4d58('0x8'));var attributes=require(_0x4d58('0x9'));module[_0x4d58('0xa')]=function(_0x29cac8,_0x597aca){return _0x29cac8[_0x4d58('0xb')](_0x4d58('0xc'),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 93a86a0..3b51f38 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 _0xb5eb=['moment','bluebird','../../mysqldb','../../config/logger','../../config/environment','jayson/promise','client','http','then','info','JscriptySessionReport,\x20%s,\x20%s','request\x20sent','debug','JscriptySessionReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','util'];(function(_0x21e87a,_0x1e269d){var _0x11c5a7=function(_0x57754a){while(--_0x57754a){_0x21e87a['push'](_0x21e87a['shift']());}};_0x11c5a7(++_0x1e269d);}(_0xb5eb,0xd1));var _0xbb5e=function(_0x5e0c34,_0x186cc3){_0x5e0c34=_0x5e0c34-0x0;var _0xd29dbe=_0xb5eb[_0x5e0c34];return _0xd29dbe;};'use strict';var _=require('lodash');var util=require(_0xbb5e('0x0'));var moment=require(_0xbb5e('0x1'));var BPromise=require(_0xbb5e('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0xbb5e('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0xbb5e('0x4'))('rpc');var config=require(_0xbb5e('0x5'));var jayson=require(_0xbb5e('0x6'));var client=jayson[_0xbb5e('0x7')][_0xbb5e('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x1c1a1d,_0x431ef3,_0x5cfb17){return new BPromise(function(_0x3a6f4f,_0x3e38ee){return client['request'](_0x1c1a1d,_0x5cfb17)[_0xbb5e('0x9')](function(_0x3215fa){logger[_0xbb5e('0xa')](_0xbb5e('0xb'),_0x431ef3,_0xbb5e('0xc'));logger[_0xbb5e('0xd')](_0xbb5e('0xe'),_0x431ef3,_0xbb5e('0xc'),JSON[_0xbb5e('0xf')](_0x3215fa));if(_0x3215fa[_0xbb5e('0x10')]){if(_0x3215fa[_0xbb5e('0x10')][_0xbb5e('0x11')]===0x1f4){logger[_0xbb5e('0x10')](_0xbb5e('0xb'),_0x431ef3,_0x3215fa[_0xbb5e('0x10')][_0xbb5e('0x12')]);return _0x3e38ee(_0x3215fa[_0xbb5e('0x10')][_0xbb5e('0x12')]);}logger[_0xbb5e('0x10')](_0xbb5e('0xb'),_0x431ef3,_0x3215fa[_0xbb5e('0x10')][_0xbb5e('0x12')]);return _0x3a6f4f(_0x3215fa[_0xbb5e('0x10')][_0xbb5e('0x12')]);}else{logger[_0xbb5e('0xa')](_0xbb5e('0xb'),_0x431ef3,_0xbb5e('0xc'));_0x3a6f4f(_0x3215fa[_0xbb5e('0x13')][_0xbb5e('0x12')]);}})[_0xbb5e('0x14')](function(_0x334e36){logger['error'](_0xbb5e('0xb'),_0x431ef3,_0x334e36);_0x3e38ee(_0x334e36);});});} \ No newline at end of file +var _0xc2a6=['info','JscriptySessionReport,\x20%s,\x20%s','debug','JscriptySessionReport,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','result','catch','util','moment','randomstring','ioredis','../../config/utils','rpc','jayson/promise','client','http','then'];(function(_0x1cb433,_0x1e679e){var _0x3abdfe=function(_0x3bb4e9){while(--_0x3bb4e9){_0x1cb433['push'](_0x1cb433['shift']());}};_0x3abdfe(++_0x1e679e);}(_0xc2a6,0xbe));var _0x6c2a=function(_0x50740e,_0x5f56dd){_0x50740e=_0x50740e-0x0;var _0x782ba5=_0xc2a6[_0x50740e];return _0x782ba5;};'use strict';var _=require('lodash');var util=require(_0x6c2a('0x0'));var moment=require(_0x6c2a('0x1'));var BPromise=require('bluebird');var rs=require(_0x6c2a('0x2'));var fs=require('fs');var Redis=require(_0x6c2a('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x6c2a('0x4'));var logger=require('../../config/logger')(_0x6c2a('0x5'));var config=require('../../config/environment');var jayson=require(_0x6c2a('0x6'));var client=jayson[_0x6c2a('0x7')][_0x6c2a('0x8')]({'port':0x232a});function respondWithRpcPromise(_0xceac08,_0x18f103,_0x3dd2f6){return new BPromise(function(_0x40aade,_0x26e980){return client['request'](_0xceac08,_0x3dd2f6)[_0x6c2a('0x9')](function(_0x75bc2a){logger[_0x6c2a('0xa')](_0x6c2a('0xb'),_0x18f103,'request\x20sent');logger[_0x6c2a('0xc')](_0x6c2a('0xd'),_0x18f103,_0x6c2a('0xe'),JSON['stringify'](_0x75bc2a));if(_0x75bc2a[_0x6c2a('0xf')]){if(_0x75bc2a[_0x6c2a('0xf')][_0x6c2a('0x10')]===0x1f4){logger[_0x6c2a('0xf')](_0x6c2a('0xb'),_0x18f103,_0x75bc2a[_0x6c2a('0xf')]['message']);return _0x26e980(_0x75bc2a['error']['message']);}logger[_0x6c2a('0xf')]('JscriptySessionReport,\x20%s,\x20%s',_0x18f103,_0x75bc2a[_0x6c2a('0xf')][_0x6c2a('0x11')]);return _0x40aade(_0x75bc2a[_0x6c2a('0xf')]['message']);}else{logger['info'](_0x6c2a('0xb'),_0x18f103,'request\x20sent');_0x40aade(_0x75bc2a[_0x6c2a('0x12')]['message']);}})[_0x6c2a('0x13')](function(_0x552da7){logger[_0x6c2a('0xf')]('JscriptySessionReport,\x20%s,\x20%s',_0x18f103,_0x552da7);_0x26e980(_0x552da7);});});} \ No newline at end of file diff --git a/server/api/license/index.js b/server/api/license/index.js index 67410d2..f3ba2b1 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 _0x65cd=['../../components/auth/service','../../components/interaction/service','../../config/environment','index','put','/:id','isAuthenticated','update','exports','multer','express','Router'];(function(_0x61d1bc,_0x1856f8){var _0x1c1ee8=function(_0x38c9fa){while(--_0x38c9fa){_0x61d1bc['push'](_0x61d1bc['shift']());}};_0x1c1ee8(++_0x1856f8);}(_0x65cd,0x1d1));var _0xd65c=function(_0x1e1d07,_0x299b1e){_0x1e1d07=_0x1e1d07-0x0;var _0x225dce=_0x65cd[_0x1e1d07];return _0x225dce;};'use strict';var multer=require(_0xd65c('0x0'));var util=require('util');var path=require('path');var timeout=require('connect-timeout');var express=require(_0xd65c('0x1'));var router=express[_0xd65c('0x2')]();var auth=require(_0xd65c('0x3'));var interaction=require(_0xd65c('0x4'));var config=require(_0xd65c('0x5'));var controller=require('./license.controller');router['get']('/',controller[_0xd65c('0x6')]);router[_0xd65c('0x7')](_0xd65c('0x8'),auth[_0xd65c('0x9')](),controller[_0xd65c('0xa')]);module[_0xd65c('0xb')]=router; \ No newline at end of file +var _0x8757=['/:id','isAuthenticated','update','exports','multer','util','path','connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment','./license.controller','index','put'];(function(_0x42d7e9,_0x93af9b){var _0x4b5825=function(_0x5eea96){while(--_0x5eea96){_0x42d7e9['push'](_0x42d7e9['shift']());}};_0x4b5825(++_0x93af9b);}(_0x8757,0x1e4));var _0x7875=function(_0x3a214f,_0x5e6792){_0x3a214f=_0x3a214f-0x0;var _0x10a7a3=_0x8757[_0x3a214f];return _0x10a7a3;};'use strict';var multer=require(_0x7875('0x0'));var util=require(_0x7875('0x1'));var path=require(_0x7875('0x2'));var timeout=require(_0x7875('0x3'));var express=require(_0x7875('0x4'));var router=express['Router']();var auth=require(_0x7875('0x5'));var interaction=require(_0x7875('0x6'));var config=require(_0x7875('0x7'));var controller=require(_0x7875('0x8'));router['get']('/',controller[_0x7875('0x9')]);router[_0x7875('0xa')](_0x7875('0xb'),auth[_0x7875('0xc')](),controller[_0x7875('0xd')]);module[_0x7875('0xe')]=router; \ No newline at end of file diff --git a/server/api/license/license.attributes.js b/server/api/license/license.attributes.js index ef28503..de5c8c8 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 _0xda19=['exports','TEXT','STRING'];(function(_0x469e82,_0x2b7040){var _0x2c7241=function(_0x18faaf){while(--_0x18faaf){_0x469e82['push'](_0x469e82['shift']());}};_0x2c7241(++_0x2b7040);}(_0xda19,0xd5));var _0x9da1=function(_0x343233,_0x53801c){_0x343233=_0x343233-0x0;var _0x1730a3=_0xda19[_0x343233];return _0x1730a3;};'use strict';var Sequelize=require('sequelize');module[_0x9da1('0x0')]={'license':{'type':Sequelize[_0x9da1('0x1')]},'data1':{'type':Sequelize['STRING']},'data2':{'type':Sequelize[_0x9da1('0x2')]},'chatLicenseExceeded':{'type':Sequelize['INTEGER'],'defaultValue':0x0}}; \ No newline at end of file +var _0x6d38=['exports','TEXT','STRING'];(function(_0x21a127,_0x834064){var _0xf511b4=function(_0x45b775){while(--_0x45b775){_0x21a127['push'](_0x21a127['shift']());}};_0xf511b4(++_0x834064);}(_0x6d38,0x1ef));var _0x86d3=function(_0x278e3c,_0x1c9cfd){_0x278e3c=_0x278e3c-0x0;var _0x3e2d9b=_0x6d38[_0x278e3c];return _0x3e2d9b;};'use strict';var Sequelize=require('sequelize');module[_0x86d3('0x0')]={'license':{'type':Sequelize[_0x86d3('0x1')]},'data1':{'type':Sequelize[_0x86d3('0x2')]},'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 30515ae..ea8e82c 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 _0x432a=['model','keys','License','rawAttributes','query','filters','intersection','attributes','fields','length','options','getLicense','catch','body','find','params','checkLicense','key','demo','html-pdf','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','to-csv','ejs','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','end','status','count','offset','limit','apply','reject','save','update','then','destroy','error','stack','name','send','../../config/license/util','index'];(function(_0xddde07,_0x41b8f9){var _0x3d636a=function(_0x433a15){while(--_0x433a15){_0xddde07['push'](_0xddde07['shift']());}};_0x3d636a(++_0x41b8f9);}(_0x432a,0xcd));var _0xa432=function(_0x45d9e0,_0x82218e){_0x45d9e0=_0x45d9e0-0x0;var _0x2d8ce3=_0x432a[_0x45d9e0];return _0x2d8ce3;};'use strict';var pdf=require(_0xa432('0x0'));var emlformat=require('eml-format');var rimraf=require(_0xa432('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xa432('0x2'));var rp=require(_0xa432('0x3'));var moment=require(_0xa432('0x4'));var BPromise=require(_0xa432('0x5'));var Mustache=require(_0xa432('0x6'));var util=require('util');var path=require(_0xa432('0x7'));var sox=require(_0xa432('0x8'));var csv=require(_0xa432('0x9'));var ejs=require(_0xa432('0xa'));var fs=require('fs');var _=require('lodash');var squel=require(_0xa432('0xb'));var crypto=require(_0xa432('0xc'));var jsforce=require('jsforce');var deskjs=require(_0xa432('0xd'));var toCsv=require('to-csv');var querystring=require(_0xa432('0xe'));var Papa=require(_0xa432('0xf'));var Redis=require(_0xa432('0x10'));var authService=require('../../components/auth/service');var qs=require(_0xa432('0x11'));var as=require(_0xa432('0x12'));var hardwareService=require(_0xa432('0x13'));var logger=require(_0xa432('0x14'))(_0xa432('0x15'));var utils=require(_0xa432('0x16'));var config=require(_0xa432('0x17'));var db=require(_0xa432('0x18'))['db'];function respondWithStatusCode(_0x1b2a17,_0x552816){_0x552816=_0x552816||0xcc;return function(_0x3e7c86){if(_0x3e7c86){return _0x1b2a17[_0xa432('0x19')](_0x552816);}return _0x1b2a17['status'](_0x552816)[_0xa432('0x1a')]();};}function respondWithResult(_0x46db93,_0x40217c){_0x40217c=_0x40217c||0xc8;return function(_0x3b58ed){if(_0x3b58ed){return _0x46db93[_0xa432('0x1b')](_0x40217c)['json'](_0x3b58ed);}};}function respondWithFilteredResult(_0x25c67f,_0x4f88f6){return function(_0x29facc){if(_0x29facc){var _0x2dd82f=_0x29facc[_0xa432('0x1c')],_0x58ea22=_0x4f88f6[_0xa432('0x1d')],_0x4747e7=_0x4f88f6[_0xa432('0x1d')]+_0x4f88f6[_0xa432('0x1e')],_0x43a5fb;if(_0x4747e7>=_0x2dd82f){_0x4747e7=_0x2dd82f;_0x43a5fb=0xc8;}else{_0x43a5fb=0xce;}_0x25c67f[_0xa432('0x1b')](_0x43a5fb);return _0x25c67f['set']('Content-Range',_0x58ea22+'-'+_0x4747e7+'/'+_0x2dd82f)['json'](_0x29facc);}return null;};}function patchUpdates(_0x8958bf){return function(_0x49c391){try{jsonpatch[_0xa432('0x1f')](_0x49c391,_0x8958bf,!![]);}catch(_0x14d861){return BPromise[_0xa432('0x20')](_0x14d861);}return _0x49c391[_0xa432('0x21')]();};}function saveUpdates(_0x52b9f1,_0xe1df40){return function(_0x48cf02){if(_0x48cf02){return _0x48cf02[_0xa432('0x22')](_0x52b9f1)[_0xa432('0x23')](function(_0x584447){return _0x584447;});}return null;};}function removeEntity(_0x4f3e97,_0x27fd7d){return function(_0x210230){if(_0x210230){return _0x210230[_0xa432('0x24')]()[_0xa432('0x23')](function(){_0x4f3e97['status'](0xcc)[_0xa432('0x1a')]();});}};}function handleEntityNotFound(_0x250fd1,_0x3dc430){return function(_0x18f339){if(!_0x18f339){_0x250fd1['sendStatus'](0x194);}return _0x18f339;};}function handleError(_0x57ec45,_0xe55dd3){_0xe55dd3=_0xe55dd3||0x1f4;return function(_0x43a909){logger[_0xa432('0x25')](_0x43a909[_0xa432('0x26')]);if(_0x43a909[_0xa432('0x27')]){delete _0x43a909[_0xa432('0x27')];}_0x57ec45['status'](_0xe55dd3)[_0xa432('0x28')](_0x43a909);};}var utilLicense=require(_0xa432('0x29'));exports[_0xa432('0x2a')]=function(_0x4c33f9,_0x4c77c0){var _0x51bf08={'raw':!![],'where':{'id':0x1}},_0x1ccac9={};_0x1ccac9[_0xa432('0x2b')]=_[_0xa432('0x2c')](db[_0xa432('0x2d')][_0xa432('0x2e')]);_0x1ccac9[_0xa432('0x2f')]=_[_0xa432('0x2c')](_0x4c33f9[_0xa432('0x2f')]);_0x1ccac9[_0xa432('0x30')]=_[_0xa432('0x31')](_0x1ccac9[_0xa432('0x2b')],_0x1ccac9[_0xa432('0x2f')]);_0x51bf08[_0xa432('0x32')]=_[_0xa432('0x31')](_0x1ccac9['model'],qs[_0xa432('0x33')](_0x4c33f9[_0xa432('0x2f')][_0xa432('0x33')]));_0x51bf08[_0xa432('0x32')]=_0x51bf08[_0xa432('0x32')][_0xa432('0x34')]?_0x51bf08[_0xa432('0x32')]:_0x1ccac9[_0xa432('0x2b')];_0x51bf08=_['merge']({},_0x51bf08,_0x4c33f9[_0xa432('0x35')]);return utilLicense[_0xa432('0x36')](_0x51bf08)[_0xa432('0x23')](respondWithResult(_0x4c77c0,null))[_0xa432('0x37')](handleError(_0x4c77c0,null));};exports[_0xa432('0x22')]=function(_0x3e5f03,_0x1b420f){if(_0x3e5f03[_0xa432('0x38')]['id']){delete _0x3e5f03[_0xa432('0x38')]['id'];}return db['License'][_0xa432('0x39')]({'where':{'id':_0x3e5f03[_0xa432('0x3a')]['id']}})[_0xa432('0x23')](handleEntityNotFound(_0x1b420f,null))[_0xa432('0x23')](function(_0x2cf2e9){var _0x551560=_0x2cf2e9['get']({'plain':!![]});return utilLicense[_0xa432('0x3b')](_0x551560,_0x3e5f03[_0xa432('0x38')][_0xa432('0x3c')]);})[_0xa432('0x23')](function(_0x441e1a){if(!_0x441e1a[_0xa432('0x3d')]){return saveUpdates(_0x3e5f03['body'],null);}return _0x441e1a;})['then'](respondWithResult(_0x1b420f,null))[_0xa432('0x37')](handleError(_0x1b420f,null));}; \ No newline at end of file +var _0xd1e3=['keys','License','rawAttributes','query','filters','intersection','fields','attributes','length','merge','options','getLicense','catch','update','body','find','get','key','html-pdf','eml-format','zip-dir','fast-json-patch','moment','bluebird','mustache','util','sox','to-csv','ejs','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','json','count','offset','limit','apply','reject','save','then','error','stack','name','../../config/license/util','index','model'];(function(_0x3d7fb1,_0x22332f){var _0xf76551=function(_0x17e824){while(--_0x17e824){_0x3d7fb1['push'](_0x3d7fb1['shift']());}};_0xf76551(++_0x22332f);}(_0xd1e3,0xc3));var _0x3d1e=function(_0x2e319f,_0x3371c2){_0x2e319f=_0x2e319f-0x0;var _0x210ea7=_0xd1e3[_0x2e319f];return _0x210ea7;};'use strict';var pdf=require(_0x3d1e('0x0'));var emlformat=require(_0x3d1e('0x1'));var rimraf=require('rimraf');var zipdir=require(_0x3d1e('0x2'));var jsonpatch=require(_0x3d1e('0x3'));var rp=require('request-promise');var moment=require(_0x3d1e('0x4'));var BPromise=require(_0x3d1e('0x5'));var Mustache=require(_0x3d1e('0x6'));var util=require(_0x3d1e('0x7'));var path=require('path');var sox=require(_0x3d1e('0x8'));var csv=require(_0x3d1e('0x9'));var ejs=require(_0x3d1e('0xa'));var fs=require('fs');var _=require('lodash');var squel=require('squel');var crypto=require(_0x3d1e('0xb'));var jsforce=require('jsforce');var deskjs=require(_0x3d1e('0xc'));var toCsv=require(_0x3d1e('0x9'));var querystring=require(_0x3d1e('0xd'));var Papa=require(_0x3d1e('0xe'));var Redis=require(_0x3d1e('0xf'));var authService=require(_0x3d1e('0x10'));var qs=require(_0x3d1e('0x11'));var as=require(_0x3d1e('0x12'));var hardwareService=require(_0x3d1e('0x13'));var logger=require(_0x3d1e('0x14'))(_0x3d1e('0x15'));var utils=require(_0x3d1e('0x16'));var config=require(_0x3d1e('0x17'));var db=require(_0x3d1e('0x18'))['db'];function respondWithStatusCode(_0xacec8e,_0x43c887){_0x43c887=_0x43c887||0xcc;return function(_0xd77bbb){if(_0xd77bbb){return _0xacec8e[_0x3d1e('0x19')](_0x43c887);}return _0xacec8e[_0x3d1e('0x1a')](_0x43c887)['end']();};}function respondWithResult(_0x5c54db,_0x55f292){_0x55f292=_0x55f292||0xc8;return function(_0x30d5b6){if(_0x30d5b6){return _0x5c54db[_0x3d1e('0x1a')](_0x55f292)[_0x3d1e('0x1b')](_0x30d5b6);}};}function respondWithFilteredResult(_0x3f35a5,_0x375b23){return function(_0xbd7731){if(_0xbd7731){var _0x40febe=_0xbd7731[_0x3d1e('0x1c')],_0x15b70f=_0x375b23[_0x3d1e('0x1d')],_0x2a5311=_0x375b23[_0x3d1e('0x1d')]+_0x375b23[_0x3d1e('0x1e')],_0x5c00ed;if(_0x2a5311>=_0x40febe){_0x2a5311=_0x40febe;_0x5c00ed=0xc8;}else{_0x5c00ed=0xce;}_0x3f35a5['status'](_0x5c00ed);return _0x3f35a5['set']('Content-Range',_0x15b70f+'-'+_0x2a5311+'/'+_0x40febe)['json'](_0xbd7731);}return null;};}function patchUpdates(_0x51043e){return function(_0x4891f7){try{jsonpatch[_0x3d1e('0x1f')](_0x4891f7,_0x51043e,!![]);}catch(_0x4acd91){return BPromise[_0x3d1e('0x20')](_0x4acd91);}return _0x4891f7[_0x3d1e('0x21')]();};}function saveUpdates(_0xbdf533,_0x50cea1){return function(_0x8c2a6){if(_0x8c2a6){return _0x8c2a6['update'](_0xbdf533)['then'](function(_0x22d019){return _0x22d019;});}return null;};}function removeEntity(_0x512c94,_0xbb0fda){return function(_0x304530){if(_0x304530){return _0x304530['destroy']()[_0x3d1e('0x22')](function(){_0x512c94[_0x3d1e('0x1a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x12b344,_0x8d3acf){return function(_0x3d7635){if(!_0x3d7635){_0x12b344[_0x3d1e('0x19')](0x194);}return _0x3d7635;};}function handleError(_0x443b14,_0x2746a8){_0x2746a8=_0x2746a8||0x1f4;return function(_0xf8935){logger[_0x3d1e('0x23')](_0xf8935[_0x3d1e('0x24')]);if(_0xf8935['name']){delete _0xf8935[_0x3d1e('0x25')];}_0x443b14[_0x3d1e('0x1a')](_0x2746a8)['send'](_0xf8935);};}var utilLicense=require(_0x3d1e('0x26'));exports[_0x3d1e('0x27')]=function(_0x107baf,_0x470ecd){var _0x4ef483={'raw':!![],'where':{'id':0x1}},_0x5a2dab={};_0x5a2dab[_0x3d1e('0x28')]=_[_0x3d1e('0x29')](db[_0x3d1e('0x2a')][_0x3d1e('0x2b')]);_0x5a2dab[_0x3d1e('0x2c')]=_[_0x3d1e('0x29')](_0x107baf['query']);_0x5a2dab[_0x3d1e('0x2d')]=_[_0x3d1e('0x2e')](_0x5a2dab[_0x3d1e('0x28')],_0x5a2dab[_0x3d1e('0x2c')]);_0x4ef483['attributes']=_['intersection'](_0x5a2dab['model'],qs[_0x3d1e('0x2f')](_0x107baf[_0x3d1e('0x2c')][_0x3d1e('0x2f')]));_0x4ef483['attributes']=_0x4ef483[_0x3d1e('0x30')][_0x3d1e('0x31')]?_0x4ef483[_0x3d1e('0x30')]:_0x5a2dab[_0x3d1e('0x28')];_0x4ef483=_[_0x3d1e('0x32')]({},_0x4ef483,_0x107baf[_0x3d1e('0x33')]);return utilLicense[_0x3d1e('0x34')](_0x4ef483)['then'](respondWithResult(_0x470ecd,null))[_0x3d1e('0x35')](handleError(_0x470ecd,null));};exports[_0x3d1e('0x36')]=function(_0x12fd6a,_0x55f24e){if(_0x12fd6a['body']['id']){delete _0x12fd6a[_0x3d1e('0x37')]['id'];}return db[_0x3d1e('0x2a')][_0x3d1e('0x38')]({'where':{'id':_0x12fd6a['params']['id']}})[_0x3d1e('0x22')](handleEntityNotFound(_0x55f24e,null))[_0x3d1e('0x22')](function(_0x311669){var _0x1e47de=_0x311669[_0x3d1e('0x39')]({'plain':!![]});return utilLicense['checkLicense'](_0x1e47de,_0x12fd6a['body'][_0x3d1e('0x3a')]);})[_0x3d1e('0x22')](function(_0x127345){if(!_0x127345['demo']){return saveUpdates(_0x12fd6a[_0x3d1e('0x37')],null);}return _0x127345;})[_0x3d1e('0x22')](respondWithResult(_0x55f24e,null))['catch'](handleError(_0x55f24e,null));}; \ No newline at end of file diff --git a/server/api/license/license.model.js b/server/api/license/license.model.js index 5ecca01..9ebb8c9 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 _0xe28f=['rimraf','../../config/environment','exports','lodash','util','moment','bluebird','request-promise','path'];(function(_0x27af45,_0x1b57aa){var _0x18df21=function(_0x4b7679){while(--_0x4b7679){_0x27af45['push'](_0x27af45['shift']());}};_0x18df21(++_0x1b57aa);}(_0xe28f,0x1e9));var _0xfe28=function(_0x39c07c,_0x44f2a7){_0x39c07c=_0x39c07c-0x0;var _0x1a45be=_0xe28f[_0x39c07c];return _0x1a45be;};'use strict';var _=require(_0xfe28('0x0'));var util=require(_0xfe28('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0xfe28('0x2'));var BPromise=require(_0xfe28('0x3'));var rp=require(_0xfe28('0x4'));var fs=require('fs');var path=require(_0xfe28('0x5'));var rimraf=require(_0xfe28('0x6'));var config=require(_0xfe28('0x7'));var attributes=require('./license.attributes');module[_0xfe28('0x8')]=function(_0x17f1c6,_0x56605b){return _0x17f1c6['define']('License',attributes,{'tableName':'license','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xf0a5=['License','license','util','../../config/logger','api','bluebird','path','rimraf','./license.attributes','exports'];(function(_0x59ee6f,_0x450239){var _0x4c0979=function(_0x565e92){while(--_0x565e92){_0x59ee6f['push'](_0x59ee6f['shift']());}};_0x4c0979(++_0x450239);}(_0xf0a5,0x174));var _0x5f0a=function(_0x59840e,_0x5b13d2){_0x59840e=_0x59840e-0x0;var _0xe1899d=_0xf0a5[_0x59840e];return _0xe1899d;};'use strict';var _=require('lodash');var util=require(_0x5f0a('0x0'));var logger=require(_0x5f0a('0x1'))(_0x5f0a('0x2'));var moment=require('moment');var BPromise=require(_0x5f0a('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x5f0a('0x4'));var rimraf=require(_0x5f0a('0x5'));var config=require('../../config/environment');var attributes=require(_0x5f0a('0x6'));module[_0x5f0a('0x7')]=function(_0x114eab,_0x23f016){return _0x114eab['define'](_0x5f0a('0x8'),attributes,{'tableName':_0x5f0a('0x9'),'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 5b0ed0d..fdb3cb2 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 _0x131e=['info','request\x20sent','debug','License,\x20%s,\x20%s,\x20%s','stringify','error','message','License,\x20%s,\x20%s','catch','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request','then'];(function(_0x153faa,_0x75f2a){var _0x43c32a=function(_0x1c5721){while(--_0x1c5721){_0x153faa['push'](_0x153faa['shift']());}};_0x43c32a(++_0x75f2a);}(_0x131e,0x1ec));var _0xe131=function(_0xf244b5,_0x4655d6){_0xf244b5=_0xf244b5-0x0;var _0x38ab2d=_0x131e[_0xf244b5];return _0x38ab2d;};'use strict';var _=require('lodash');var util=require('util');var moment=require('moment');var BPromise=require(_0xe131('0x0'));var rs=require(_0xe131('0x1'));var fs=require('fs');var Redis=require(_0xe131('0x2'));var db=require(_0xe131('0x3'))['db'];var utils=require(_0xe131('0x4'));var logger=require(_0xe131('0x5'))('rpc');var config=require(_0xe131('0x6'));var jayson=require(_0xe131('0x7'));var client=jayson[_0xe131('0x8')][_0xe131('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x1002a6,_0x48a90e,_0x5c4eb5){return new BPromise(function(_0x562617,_0x4bf386){return client[_0xe131('0xa')](_0x1002a6,_0x5c4eb5)[_0xe131('0xb')](function(_0x530ecb){logger[_0xe131('0xc')]('License,\x20%s,\x20%s',_0x48a90e,_0xe131('0xd'));logger[_0xe131('0xe')](_0xe131('0xf'),_0x48a90e,_0xe131('0xd'),JSON[_0xe131('0x10')](_0x530ecb));if(_0x530ecb[_0xe131('0x11')]){if(_0x530ecb[_0xe131('0x11')]['code']===0x1f4){logger['error']('License,\x20%s,\x20%s',_0x48a90e,_0x530ecb['error'][_0xe131('0x12')]);return _0x4bf386(_0x530ecb[_0xe131('0x11')][_0xe131('0x12')]);}logger[_0xe131('0x11')](_0xe131('0x13'),_0x48a90e,_0x530ecb[_0xe131('0x11')][_0xe131('0x12')]);return _0x562617(_0x530ecb[_0xe131('0x11')][_0xe131('0x12')]);}else{logger['info']('License,\x20%s,\x20%s',_0x48a90e,'request\x20sent');_0x562617(_0x530ecb['result']['message']);}})[_0xe131('0x14')](function(_0x32091b){logger[_0xe131('0x11')]('License,\x20%s,\x20%s',_0x48a90e,_0x32091b);_0x4bf386(_0x32091b);});});} \ No newline at end of file +var _0x593e=['then','info','debug','License,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','License,\x20%s,\x20%s','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http'];(function(_0x2383e4,_0x2af00d){var _0x59bcc9=function(_0x3f89f9){while(--_0x3f89f9){_0x2383e4['push'](_0x2383e4['shift']());}};_0x59bcc9(++_0x2af00d);}(_0x593e,0xcb));var _0xe593=function(_0x2cf137,_0xbd0bee){_0x2cf137=_0x2cf137-0x0;var _0x19a20d=_0x593e[_0x2cf137];return _0x19a20d;};'use strict';var _=require(_0xe593('0x0'));var util=require(_0xe593('0x1'));var moment=require(_0xe593('0x2'));var BPromise=require(_0xe593('0x3'));var rs=require(_0xe593('0x4'));var fs=require('fs');var Redis=require(_0xe593('0x5'));var db=require(_0xe593('0x6'))['db'];var utils=require(_0xe593('0x7'));var logger=require('../../config/logger')(_0xe593('0x8'));var config=require(_0xe593('0x9'));var jayson=require(_0xe593('0xa'));var client=jayson[_0xe593('0xb')][_0xe593('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x14cff3,_0x1cda29,_0x307dad){return new BPromise(function(_0x169c08,_0x265099){return client['request'](_0x14cff3,_0x307dad)[_0xe593('0xd')](function(_0x4091db){logger[_0xe593('0xe')]('License,\x20%s,\x20%s',_0x1cda29,'request\x20sent');logger[_0xe593('0xf')](_0xe593('0x10'),_0x1cda29,_0xe593('0x11'),JSON['stringify'](_0x4091db));if(_0x4091db[_0xe593('0x12')]){if(_0x4091db[_0xe593('0x12')][_0xe593('0x13')]===0x1f4){logger[_0xe593('0x12')](_0xe593('0x14'),_0x1cda29,_0x4091db[_0xe593('0x12')][_0xe593('0x15')]);return _0x265099(_0x4091db[_0xe593('0x12')][_0xe593('0x15')]);}logger[_0xe593('0x12')]('License,\x20%s,\x20%s',_0x1cda29,_0x4091db[_0xe593('0x12')][_0xe593('0x15')]);return _0x169c08(_0x4091db['error'][_0xe593('0x15')]);}else{logger[_0xe593('0xe')]('License,\x20%s,\x20%s',_0x1cda29,_0xe593('0x11'));_0x169c08(_0x4091db[_0xe593('0x16')][_0xe593('0x15')]);}})[_0xe593('0x17')](function(_0x3408ec){logger[_0xe593('0x12')]('License,\x20%s,\x20%s',_0x1cda29,_0x3408ec);_0x265099(_0x3408ec);});});} \ No newline at end of file diff --git a/server/api/mailAccount/index.js b/server/api/mailAccount/index.js index 1115c48..88b1e88 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 _0x79aa=['describe','/:id','isAuthenticated','show','/:id/dispositions','getDispositions','/:id/canned_answers','/:id/in_servers','/:id/out_servers','getSmtp','/:id/interactions','getInteractions','getApplications','/:id/messages','getMessages','verifySmtp','post','addDisposition','addAnswer','addSmtp','addInteraction','addApplications','send','/:id/users','put','update','delete','removeDispositions','removeSmtp','destroy','removeAgents','exports','multer','path','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','./mailAccount.controller','get','index','/describe'];(function(_0x31e29a,_0x349c9b){var _0x32d892=function(_0x41cc86){while(--_0x41cc86){_0x31e29a['push'](_0x31e29a['shift']());}};_0x32d892(++_0x349c9b);}(_0x79aa,0x146));var _0xa79a=function(_0x1bab18,_0xcf062){_0x1bab18=_0x1bab18-0x0;var _0x464bd7=_0x79aa[_0x1bab18];return _0x464bd7;};'use strict';var multer=require(_0xa79a('0x0'));var util=require('util');var path=require(_0xa79a('0x1'));var timeout=require(_0xa79a('0x2'));var express=require('express');var router=express[_0xa79a('0x3')]();var auth=require(_0xa79a('0x4'));var interaction=require(_0xa79a('0x5'));var config=require('../../config/environment');var controller=require(_0xa79a('0x6'));router[_0xa79a('0x7')]('/',auth['isAuthenticated'](),controller[_0xa79a('0x8')]);router[_0xa79a('0x7')](_0xa79a('0x9'),auth['isAuthenticated'](),controller[_0xa79a('0xa')]);router[_0xa79a('0x7')](_0xa79a('0xb'),auth[_0xa79a('0xc')](),controller[_0xa79a('0xd')]);router[_0xa79a('0x7')](_0xa79a('0xe'),auth[_0xa79a('0xc')](),controller[_0xa79a('0xf')]);router[_0xa79a('0x7')](_0xa79a('0x10'),auth['isAuthenticated'](),controller['getAnswers']);router[_0xa79a('0x7')](_0xa79a('0x11'),auth[_0xa79a('0xc')](),controller['getImap']);router['get'](_0xa79a('0x12'),auth[_0xa79a('0xc')](),controller[_0xa79a('0x13')]);router['get'](_0xa79a('0x14'),auth[_0xa79a('0xc')](),controller[_0xa79a('0x15')]);router[_0xa79a('0x7')]('/:id/applications',auth[_0xa79a('0xc')](),controller[_0xa79a('0x16')]);router[_0xa79a('0x7')](_0xa79a('0x17'),auth[_0xa79a('0xc')](),controller[_0xa79a('0x18')]);router[_0xa79a('0x7')]('/:id/verify',auth[_0xa79a('0xc')](),controller[_0xa79a('0x19')]);router[_0xa79a('0x7')]('/:id/users',auth[_0xa79a('0xc')](),controller['getAgents']);router[_0xa79a('0x1a')]('/:id/dispositions',auth[_0xa79a('0xc')](),controller[_0xa79a('0x1b')]);router[_0xa79a('0x1a')](_0xa79a('0x10'),auth[_0xa79a('0xc')](),controller[_0xa79a('0x1c')]);router[_0xa79a('0x1a')]('/',auth[_0xa79a('0xc')](),controller['create']);router[_0xa79a('0x1a')](_0xa79a('0x11'),auth[_0xa79a('0xc')](),controller['addImap']);router[_0xa79a('0x1a')]('/:id/out_servers',auth[_0xa79a('0xc')](),controller[_0xa79a('0x1d')]);router['post'](_0xa79a('0x14'),auth['isAuthenticated'](),controller[_0xa79a('0x1e')]);router['post']('/:id/applications',auth[_0xa79a('0xc')](),controller[_0xa79a('0x1f')]);router[_0xa79a('0x1a')]('/:id/send',auth[_0xa79a('0xc')](),controller[_0xa79a('0x20')]);router[_0xa79a('0x1a')](_0xa79a('0x21'),auth['isAuthenticated'](),controller['addAgents']);router[_0xa79a('0x22')]('/:id',auth[_0xa79a('0xc')](),controller[_0xa79a('0x23')]);router[_0xa79a('0x24')](_0xa79a('0xe'),auth['isAuthenticated'](),controller[_0xa79a('0x25')]);router[_0xa79a('0x24')]('/:id/canned_answers',auth[_0xa79a('0xc')](),controller['removeAnswers']);router[_0xa79a('0x24')](_0xa79a('0x11'),auth[_0xa79a('0xc')](),controller['removeImap']);router['delete'](_0xa79a('0x12'),auth['isAuthenticated'](),controller[_0xa79a('0x26')]);router[_0xa79a('0x24')](_0xa79a('0xb'),auth[_0xa79a('0xc')](),controller[_0xa79a('0x27')]);router[_0xa79a('0x24')](_0xa79a('0x21'),auth[_0xa79a('0xc')](),controller[_0xa79a('0x28')]);module[_0xa79a('0x29')]=router; \ No newline at end of file +var _0x2d60=['path','express','Router','../../components/interaction/service','./mailAccount.controller','get','isAuthenticated','index','/describe','describe','/:id/dispositions','getDispositions','/:id/canned_answers','getAnswers','/:id/in_servers','getImap','/:id/interactions','getInteractions','/:id/applications','getApplications','/:id/messages','/:id/verify','verifySmtp','/:id/users','getAgents','post','addDisposition','addImap','/:id/out_servers','addSmtp','/:id/send','addAgents','put','update','delete','removeAnswers','removeImap','/:id','destroy','removeAgents','util'];(function(_0x2ef353,_0x5c12df){var _0x389549=function(_0x33f8b1){while(--_0x33f8b1){_0x2ef353['push'](_0x2ef353['shift']());}};_0x389549(++_0x5c12df);}(_0x2d60,0x147));var _0x02d6=function(_0x36f73d,_0x2c2156){_0x36f73d=_0x36f73d-0x0;var _0x302c81=_0x2d60[_0x36f73d];return _0x302c81;};'use strict';var multer=require('multer');var util=require(_0x02d6('0x0'));var path=require(_0x02d6('0x1'));var timeout=require('connect-timeout');var express=require(_0x02d6('0x2'));var router=express[_0x02d6('0x3')]();var auth=require('../../components/auth/service');var interaction=require(_0x02d6('0x4'));var config=require('../../config/environment');var controller=require(_0x02d6('0x5'));router[_0x02d6('0x6')]('/',auth[_0x02d6('0x7')](),controller[_0x02d6('0x8')]);router[_0x02d6('0x6')](_0x02d6('0x9'),auth[_0x02d6('0x7')](),controller[_0x02d6('0xa')]);router[_0x02d6('0x6')]('/:id',auth['isAuthenticated'](),controller['show']);router['get'](_0x02d6('0xb'),auth[_0x02d6('0x7')](),controller[_0x02d6('0xc')]);router[_0x02d6('0x6')](_0x02d6('0xd'),auth['isAuthenticated'](),controller[_0x02d6('0xe')]);router['get'](_0x02d6('0xf'),auth[_0x02d6('0x7')](),controller[_0x02d6('0x10')]);router[_0x02d6('0x6')]('/:id/out_servers',auth[_0x02d6('0x7')](),controller['getSmtp']);router[_0x02d6('0x6')](_0x02d6('0x11'),auth[_0x02d6('0x7')](),controller[_0x02d6('0x12')]);router['get'](_0x02d6('0x13'),auth[_0x02d6('0x7')](),controller[_0x02d6('0x14')]);router[_0x02d6('0x6')](_0x02d6('0x15'),auth[_0x02d6('0x7')](),controller['getMessages']);router[_0x02d6('0x6')](_0x02d6('0x16'),auth[_0x02d6('0x7')](),controller[_0x02d6('0x17')]);router[_0x02d6('0x6')](_0x02d6('0x18'),auth[_0x02d6('0x7')](),controller[_0x02d6('0x19')]);router[_0x02d6('0x1a')](_0x02d6('0xb'),auth[_0x02d6('0x7')](),controller[_0x02d6('0x1b')]);router[_0x02d6('0x1a')](_0x02d6('0xd'),auth['isAuthenticated'](),controller['addAnswer']);router[_0x02d6('0x1a')]('/',auth[_0x02d6('0x7')](),controller['create']);router[_0x02d6('0x1a')](_0x02d6('0xf'),auth['isAuthenticated'](),controller[_0x02d6('0x1c')]);router[_0x02d6('0x1a')](_0x02d6('0x1d'),auth['isAuthenticated'](),controller[_0x02d6('0x1e')]);router[_0x02d6('0x1a')](_0x02d6('0x11'),auth[_0x02d6('0x7')](),controller['addInteraction']);router[_0x02d6('0x1a')](_0x02d6('0x13'),auth['isAuthenticated'](),controller['addApplications']);router[_0x02d6('0x1a')](_0x02d6('0x1f'),auth['isAuthenticated'](),controller['send']);router[_0x02d6('0x1a')](_0x02d6('0x18'),auth[_0x02d6('0x7')](),controller[_0x02d6('0x20')]);router[_0x02d6('0x21')]('/:id',auth[_0x02d6('0x7')](),controller[_0x02d6('0x22')]);router[_0x02d6('0x23')]('/:id/dispositions',auth[_0x02d6('0x7')](),controller['removeDispositions']);router[_0x02d6('0x23')](_0x02d6('0xd'),auth[_0x02d6('0x7')](),controller[_0x02d6('0x24')]);router[_0x02d6('0x23')]('/:id/in_servers',auth['isAuthenticated'](),controller[_0x02d6('0x25')]);router[_0x02d6('0x23')]('/:id/out_servers',auth['isAuthenticated'](),controller['removeSmtp']);router[_0x02d6('0x23')](_0x02d6('0x26'),auth[_0x02d6('0x7')](),controller[_0x02d6('0x27')]);router['delete'](_0x02d6('0x18'),auth[_0x02d6('0x7')](),controller[_0x02d6('0x28')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/mailAccount/mailAccount.attributes.js b/server/api/mailAccount/mailAccount.attributes.js index 5e82cc2..1b9d101 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 _0x86d6=['sequelize','exports','STRING','BOOLEAN','TEXT','Arial,Helvetica,sans-serif','UNSIGNED','INTEGER','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','setDataValue','mandatoryDispositionPauseId','mandatoryDisposition'];(function(_0x25fc44,_0x262509){var _0x454550=function(_0x110683){while(--_0x110683){_0x25fc44['push'](_0x25fc44['shift']());}};_0x454550(++_0x262509);}(_0x86d6,0x11e));var _0x686d=function(_0x5795c6,_0x37dcbc){_0x5795c6=_0x5795c6-0x0;var _0x4d60b0=_0x86d6[_0x5795c6];return _0x4d60b0;};'use strict';var Sequelize=require(_0x686d('0x0'));module[_0x686d('0x1')]={'description':{'type':Sequelize[_0x686d('0x2')]},'name':{'type':Sequelize['STRING'],'allowNull':![]},'service':{'type':Sequelize[_0x686d('0x3')],'defaultValue':![]},'email':{'type':Sequelize[_0x686d('0x2')],'validate':{'isEmail':!![]}},'active':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'key':{'type':Sequelize[_0x686d('0x2')],'allowNull':![]},'template':{'type':Sequelize[_0x686d('0x4')]},'markAsUnread':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'fontFamily':{'type':Sequelize[_0x686d('0x2')],'allowNull':![],'defaultValue':_0x686d('0x5')},'fontSize':{'type':Sequelize['INTEGER'](0x2)[_0x686d('0x6')],'defaultValue':0xd,'validate':{'min':0x8,'max':0x48}},'notificationTemplate':{'type':Sequelize['TEXT'],'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[_0x686d('0x3')],'defaultValue':!![]},'notificationShake':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize[_0x686d('0x3')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0x686d('0x7')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0x686d('0x3')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0x686d('0x7')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize['INTEGER'],'allowNull':!![],'defaultValue':null,'comment':_0x686d('0x8')},'mandatoryDisposition':{'type':Sequelize[_0x686d('0x3')],'defaultValue':![],'comment':_0x686d('0x9'),'set':function(_0x4dd165){if(!_0x4dd165)this[_0x686d('0xa')](_0x686d('0xb'),null);this[_0x686d('0xa')](_0x686d('0xc'),_0x4dd165);}}}; \ No newline at end of file +var _0x56a1=['exports','STRING','BOOLEAN','TEXT','INTEGER','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}
Subject\x20:\x20{{message.subject}}','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','mandatoryDispositionPauseId','setDataValue','sequelize'];(function(_0x118f8f,_0x192955){var _0x111893=function(_0x48b5e1){while(--_0x48b5e1){_0x118f8f['push'](_0x118f8f['shift']());}};_0x111893(++_0x192955);}(_0x56a1,0x78));var _0x156a=function(_0x4257b6,_0x2348c7){_0x4257b6=_0x4257b6-0x0;var _0x4ad68c=_0x56a1[_0x4257b6];return _0x4ad68c;};'use strict';var Sequelize=require(_0x156a('0x0'));module[_0x156a('0x1')]={'description':{'type':Sequelize['STRING']},'name':{'type':Sequelize[_0x156a('0x2')],'allowNull':![]},'service':{'type':Sequelize[_0x156a('0x3')],'defaultValue':![]},'email':{'type':Sequelize[_0x156a('0x2')],'validate':{'isEmail':!![]}},'active':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'key':{'type':Sequelize[_0x156a('0x2')],'allowNull':![]},'template':{'type':Sequelize[_0x156a('0x4')]},'markAsUnread':{'type':Sequelize[_0x156a('0x3')],'defaultValue':![]},'fontFamily':{'type':Sequelize[_0x156a('0x2')],'allowNull':![],'defaultValue':'Arial,Helvetica,sans-serif'},'fontSize':{'type':Sequelize[_0x156a('0x5')](0x2)['UNSIGNED'],'defaultValue':0xd,'validate':{'min':0x8,'max':0x48}},'notificationTemplate':{'type':Sequelize['TEXT'],'defaultValue':function(){return _0x156a('0x6');}},'notificationSound':{'type':Sequelize[_0x156a('0x3')],'defaultValue':!![]},'notificationShake':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize[_0x156a('0x3')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0x156a('0x5')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0x156a('0x3')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize[_0x156a('0x5')],'allowNull':!![],'defaultValue':null,'comment':_0x156a('0x7')},'mandatoryDisposition':{'type':Sequelize[_0x156a('0x3')],'defaultValue':![],'comment':_0x156a('0x8'),'set':function(_0x51be98){if(!_0x51be98)this['setDataValue'](_0x156a('0x9'),null);this[_0x156a('0xa')]('mandatoryDisposition',_0x51be98);}}}; \ No newline at end of file diff --git a/server/api/mailAccount/mailAccount.controller.js b/server/api/mailAccount/mailAccount.controller.js index 9db9977..ca3d198 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 _0xa60e=['host','port','service','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','getImap','addImap','removeImap','setImap','getSmtp','setSmtp','addInteraction','omit','MailInteraction','CmContact','Contact','User','Owner','fullname','internal','Tag','Tags','color','tag','addApplications','sequelize','MailApplication','bulkCreate','getApplications','$gte','split','format','YYYY-MM-DD\x20HH:mm:ss','MailMessage','List','Contacts','updatedAt','DESC','from','%s\x20<%s>','attachments','join','root','server/files/attachments','basename','auth','secure','SendMail','sendMail','List\x20not\x20found','subject','out','messageId','Interaction','Messages','verifySmtp','VerifySmtp','You\x20can\x27t\x20remove\x20the\x20mail\x20service\x20account','addAgents','spread','removeAgents','emit','userMailAccount:remove','getAgents','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','lodash','squel','crypto','jsforce','desk.js','to-csv','papaparse','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','defaults','localhost','socket.io-emitter','redis','./mailAccount.socket','register','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','MailAccount,\x20%s,\x20%s','request\x20sent','MailAccount,\x20%s,\x20%s,\x20%s','stringify','error','message','result','sendStatus','status','end','json','count','offset','limit','set','Content-Range','apply','reject','update','destroy','get','MailAccounts','stack','send','index','MailServerIn','Imap','MailServerOut','Smtp','mandatoryDispositionPause','map','MailAccount','rawAttributes','type','key','model','name','keys','filters','intersection','query','fields','attributes','nolimit','order','sort','filter','where','merge','VIRTUAL','options','includeAll','include','rows','catch','show','params','Pause','find','body','describe','addDisposition','MailAccountId','Disposition','getDispositions','findOne','length','hasOwnProperty','pick','removeDispositions','ids','addAnswer','CannedAnswer','create','getAnswers','findAll','removeAnswers','email','ListId','isNil','active','description','cservice','cauthentication','user','cuser','password','pass','cpassword','authentication'];(function(_0x3bf83f,_0x181cac){var _0x22c4a9=function(_0xb3ff0d){while(--_0xb3ff0d){_0x3bf83f['push'](_0x3bf83f['shift']());}};_0x22c4a9(++_0x181cac);}(_0xa60e,0x1c3));var _0xea60=function(_0x29d038,_0x416448){_0x29d038=_0x29d038-0x0;var _0x27d1c8=_0xa60e[_0x29d038];return _0x27d1c8;};'use strict';var pdf=require(_0xea60('0x0'));var emlformat=require(_0xea60('0x1'));var rimraf=require(_0xea60('0x2'));var zipdir=require(_0xea60('0x3'));var jsonpatch=require(_0xea60('0x4'));var rp=require(_0xea60('0x5'));var moment=require(_0xea60('0x6'));var BPromise=require(_0xea60('0x7'));var Mustache=require(_0xea60('0x8'));var util=require('util');var path=require(_0xea60('0x9'));var sox=require(_0xea60('0xa'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var _=require(_0xea60('0xb'));var squel=require(_0xea60('0xc'));var crypto=require(_0xea60('0xd'));var jsforce=require(_0xea60('0xe'));var deskjs=require(_0xea60('0xf'));var toCsv=require(_0xea60('0x10'));var querystring=require('querystring');var Papa=require(_0xea60('0x11'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0xea60('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xea60('0x13'))('api');var utils=require(_0xea60('0x14'));var config=require('../../config/environment');var db=require('../../mysqldb')['db'];config['redis']=_[_0xea60('0x15')](config['redis'],{'host':_0xea60('0x16'),'port':0x18eb});var socket=require(_0xea60('0x17'))(new Redis(config[_0xea60('0x18')]));require(_0xea60('0x19'))[_0xea60('0x1a')](socket);var jayson=require(_0xea60('0x1b'));var client=jayson['client'][_0xea60('0x1c')]({'port':0x232b});function checkPasswordPattern(_0x9d0095,_0x18ca68,_0x229587){if(_0x229587){var _0x393cc1=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x393cc1['test'](_0x18ca68)){return _0x9d0095;}else{throw new db[(_0xea60('0x1d'))][(_0xea60('0x1e'))](_0xea60('0x1f'));}}else{return _0x9d0095;}}function respondWithRpcPromise(_0x340b4a,_0x158040,_0x1d6a85,_0x3357be){return new BPromise(function(_0x58fd66,_0x51d7d2){var _0x351e99=_0x3357be||client;return _0x351e99[_0xea60('0x20')](_0x340b4a,_0x1d6a85)[_0xea60('0x21')](function(_0x92cc3){logger[_0xea60('0x22')](_0xea60('0x23'),_0x158040,_0xea60('0x24'));logger['debug'](_0xea60('0x25'),_0x158040,_0xea60('0x24'),JSON[_0xea60('0x26')](_0x92cc3));if(_0x92cc3[_0xea60('0x27')]){if(_0x92cc3['error']['code']===0x1f4){logger['error'](_0xea60('0x23'),_0x158040,_0x92cc3['error'][_0xea60('0x28')]);return _0x51d7d2(_0x92cc3[_0xea60('0x27')][_0xea60('0x28')]);}logger[_0xea60('0x27')](_0xea60('0x23'),_0x158040,_0x92cc3[_0xea60('0x27')][_0xea60('0x28')]);return _0x58fd66(_0x92cc3[_0xea60('0x27')]['message']);}else{logger[_0xea60('0x22')](_0xea60('0x23'),_0x158040,_0xea60('0x24'));_0x58fd66(_0x92cc3[_0xea60('0x29')][_0xea60('0x28')]);}})['catch'](function(_0x48d7f6){logger['error'](_0xea60('0x23'),_0x158040,_0x48d7f6);_0x51d7d2(_0x48d7f6);});});}function respondWithStatusCode(_0x5b7636,_0x1b9645){_0x1b9645=_0x1b9645||0xcc;return function(_0x375e4f){if(_0x375e4f){return _0x5b7636[_0xea60('0x2a')](_0x1b9645);}return _0x5b7636[_0xea60('0x2b')](_0x1b9645)[_0xea60('0x2c')]();};}function respondWithResult(_0x219b39,_0x3f739d){_0x3f739d=_0x3f739d||0xc8;return function(_0xa16e0c){if(_0xa16e0c){return _0x219b39[_0xea60('0x2b')](_0x3f739d)[_0xea60('0x2d')](_0xa16e0c);}};}function respondWithFilteredResult(_0x4c6ad0,_0x252ce6){return function(_0x2f2eae){if(_0x2f2eae){var _0x5b585c=_0x2f2eae[_0xea60('0x2e')],_0x4a62be=_0x252ce6[_0xea60('0x2f')],_0x4e31d5=_0x252ce6[_0xea60('0x2f')]+_0x252ce6[_0xea60('0x30')],_0xd1749b;if(_0x4e31d5>=_0x5b585c){_0x4e31d5=_0x5b585c;_0xd1749b=0xc8;}else{_0xd1749b=0xce;}_0x4c6ad0[_0xea60('0x2b')](_0xd1749b);return _0x4c6ad0[_0xea60('0x31')](_0xea60('0x32'),_0x4a62be+'-'+_0x4e31d5+'/'+_0x5b585c)[_0xea60('0x2d')](_0x2f2eae);}return null;};}function patchUpdates(_0x4fbcef){return function(_0x218202){try{jsonpatch[_0xea60('0x33')](_0x218202,_0x4fbcef,!![]);}catch(_0x4eb3c3){return BPromise[_0xea60('0x34')](_0x4eb3c3);}return _0x218202['save']();};}function saveUpdates(_0x43f76c,_0xc138f2){return function(_0xf2ac96){if(_0xf2ac96){return _0xf2ac96[_0xea60('0x35')](_0x43f76c)[_0xea60('0x21')](function(_0x1db96c){return _0x1db96c;});}return null;};}function removeEntity(_0x390ec4,_0x117722){return function(_0x5c7170){if(_0x5c7170){return _0x5c7170[_0xea60('0x36')]()[_0xea60('0x21')](function(){var _0x8aad11=_0x5c7170[_0xea60('0x37')]({'plain':!![]});var _0xf39fec=_0xea60('0x38');return db['UserProfileResource'][_0xea60('0x36')]({'where':{'type':_0xf39fec,'resourceId':_0x8aad11['id']}})[_0xea60('0x21')](function(){return _0x5c7170;});})[_0xea60('0x21')](function(){_0x390ec4[_0xea60('0x2b')](0xcc)['end']();});}};}function handleEntityNotFound(_0x1943f4,_0x494ac4){return function(_0x2455a4){if(!_0x2455a4){_0x1943f4[_0xea60('0x2a')](0x194);}return _0x2455a4;};}function handleError(_0x41f986,_0x1b9f40){_0x1b9f40=_0x1b9f40||0x1f4;return function(_0x537877){logger[_0xea60('0x27')](_0x537877[_0xea60('0x39')]);if(_0x537877['name']){delete _0x537877['name'];}_0x41f986[_0xea60('0x2b')](_0x1b9f40)[_0xea60('0x3a')](_0x537877);};}exports[_0xea60('0x3b')]=function(_0x786b4e,_0x1a4e5c){var _0x4bbe25={'include':[{'model':db[_0xea60('0x3c')],'as':_0xea60('0x3d')},{'model':db[_0xea60('0x3e')],'as':_0xea60('0x3f')},{'model':db['Pause'],'as':_0xea60('0x40')}]},_0x5b2049={},_0x1373f7={'count':0x0,'rows':[]};var _0x1e2043=_[_0xea60('0x41')](db[_0xea60('0x42')][_0xea60('0x43')],function(_0x3e8628){return{'name':_0x3e8628['fieldName'],'type':_0x3e8628[_0xea60('0x44')][_0xea60('0x45')]};});_0x5b2049[_0xea60('0x46')]=_['map'](_0x1e2043,_0xea60('0x47'));_0x5b2049['query']=_[_0xea60('0x48')](_0x786b4e['query']);_0x5b2049[_0xea60('0x49')]=_[_0xea60('0x4a')](_0x5b2049[_0xea60('0x46')],_0x5b2049[_0xea60('0x4b')]);_0x4bbe25['attributes']=_[_0xea60('0x4a')](_0x5b2049['model'],qs[_0xea60('0x4c')](_0x786b4e[_0xea60('0x4b')]['fields']));_0x4bbe25[_0xea60('0x4d')]=_0x4bbe25['attributes']['length']?_0x4bbe25[_0xea60('0x4d')]:_0x5b2049[_0xea60('0x46')];if(!_0x786b4e[_0xea60('0x4b')]['hasOwnProperty'](_0xea60('0x4e'))){_0x4bbe25['limit']=qs['limit'](_0x786b4e['query'][_0xea60('0x30')]);_0x4bbe25[_0xea60('0x2f')]=qs[_0xea60('0x2f')](_0x786b4e[_0xea60('0x4b')]['offset']);}_0x4bbe25[_0xea60('0x4f')]=qs[_0xea60('0x50')](_0x786b4e[_0xea60('0x4b')][_0xea60('0x50')]);_0x4bbe25['where']=qs[_0xea60('0x49')](_['pick'](_0x786b4e['query'],_0x5b2049[_0xea60('0x49')]));if(_0x786b4e[_0xea60('0x4b')][_0xea60('0x51')]){_0x4bbe25[_0xea60('0x52')]=_[_0xea60('0x53')](_0x4bbe25['where'],{'$or':_['map'](_0x1e2043,function(_0x444ab6){if(_0x444ab6[_0xea60('0x44')]!==_0xea60('0x54')){var _0x1934ea={};_0x1934ea[_0x444ab6['name']]={'$like':'%'+_0x786b4e[_0xea60('0x4b')]['filter']+'%'};return _0x1934ea;}})});}_0x4bbe25=_[_0xea60('0x53')]({},_0x4bbe25,_0x786b4e[_0xea60('0x55')]);var _0x43beb3={'where':_0x4bbe25[_0xea60('0x52')]};return db['MailAccount'][_0xea60('0x2e')](_0x43beb3)[_0xea60('0x21')](function(_0x29282a){_0x1373f7[_0xea60('0x2e')]=_0x29282a;if(_0x786b4e['query'][_0xea60('0x56')]){_0x4bbe25[_0xea60('0x57')]=[{'all':!![]}];}return db[_0xea60('0x42')]['findAll'](_0x4bbe25);})[_0xea60('0x21')](function(_0x49e1bd){_0x1373f7[_0xea60('0x58')]=_0x49e1bd;return _0x1373f7;})[_0xea60('0x21')](respondWithFilteredResult(_0x1a4e5c,_0x4bbe25))[_0xea60('0x59')](handleError(_0x1a4e5c,null));};exports[_0xea60('0x5a')]=function(_0xafda52,_0x1675ae){var _0x177cca={'raw':![],'where':{'id':_0xafda52[_0xea60('0x5b')]['id']},'include':[{'model':db['MailServerIn'],'as':_0xea60('0x3d')},{'model':db[_0xea60('0x3e')],'as':_0xea60('0x3f')},{'model':db[_0xea60('0x5c')],'as':'mandatoryDispositionPause'}]},_0x95efe1={};_0x95efe1[_0xea60('0x46')]=_[_0xea60('0x48')](db['MailAccount'][_0xea60('0x43')]);_0x95efe1[_0xea60('0x4b')]=_[_0xea60('0x48')](_0xafda52[_0xea60('0x4b')]);_0x95efe1[_0xea60('0x49')]=_[_0xea60('0x4a')](_0x95efe1[_0xea60('0x46')],_0x95efe1[_0xea60('0x4b')]);_0x177cca[_0xea60('0x4d')]=_[_0xea60('0x4a')](_0x95efe1['model'],qs[_0xea60('0x4c')](_0xafda52[_0xea60('0x4b')][_0xea60('0x4c')]));_0x177cca['attributes']=_0x177cca['attributes']['length']?_0x177cca[_0xea60('0x4d')]:_0x95efe1[_0xea60('0x46')];if(_0xafda52['query']['includeAll']){_0x177cca[_0xea60('0x57')]=[{'all':!![]}];}_0x177cca=_['merge']({},_0x177cca,_0xafda52[_0xea60('0x55')]);return db[_0xea60('0x42')][_0xea60('0x5d')](_0x177cca)[_0xea60('0x21')](handleEntityNotFound(_0x1675ae,null))[_0xea60('0x21')](respondWithResult(_0x1675ae,null))[_0xea60('0x59')](handleError(_0x1675ae,null));};exports[_0xea60('0x35')]=function(_0x3c5c92,_0x3e8979){if(_0x3c5c92[_0xea60('0x5e')]['id']){delete _0x3c5c92[_0xea60('0x5e')]['id'];}return db[_0xea60('0x42')]['find']({'where':{'id':_0x3c5c92['params']['id']},'include':[{'model':db[_0xea60('0x3c')],'as':_0xea60('0x3d')},{'model':db[_0xea60('0x3e')],'as':_0xea60('0x3f')},{'model':db[_0xea60('0x5c')],'as':'mandatoryDispositionPause'}]})[_0xea60('0x21')](handleEntityNotFound(_0x3e8979,null))[_0xea60('0x21')](saveUpdates(_0x3c5c92[_0xea60('0x5e')],null))[_0xea60('0x21')](function(_0x4416f2){if(_0x4416f2&&_0x3c5c92[_0xea60('0x5e')][_0xea60('0x3d')]){return db[_0xea60('0x3c')][_0xea60('0x35')](_0x3c5c92[_0xea60('0x5e')]['Imap'],{'where':{'MailAccountId':_0x4416f2['id']}})[_0xea60('0x21')](function(){return _0x4416f2;});}return _0x4416f2;})[_0xea60('0x21')](function(_0x190b1d){if(_0x190b1d&&_0x3c5c92[_0xea60('0x5e')][_0xea60('0x3f')]){return db[_0xea60('0x3e')]['update'](_0x3c5c92[_0xea60('0x5e')][_0xea60('0x3f')],{'where':{'MailAccountId':_0x190b1d['id']}})['then'](function(){return _0x190b1d;});}return _0x190b1d;})[_0xea60('0x21')](respondWithResult(_0x3e8979,null))[_0xea60('0x59')](handleError(_0x3e8979,null));};exports[_0xea60('0x5f')]=function(_0x53a344,_0x26b800){return db[_0xea60('0x42')][_0xea60('0x5f')]()['then'](respondWithResult(_0x26b800,null))[_0xea60('0x59')](handleError(_0x26b800,null));};exports[_0xea60('0x60')]=function(_0x4ea8fd,_0x466652,_0x24abd7){if(_0x4ea8fd['body']['id']){delete _0x4ea8fd[_0xea60('0x5e')]['id'];}return db['MailAccount'][_0xea60('0x5d')]({'where':{'id':_0x4ea8fd[_0xea60('0x5b')]['id']}})[_0xea60('0x21')](handleEntityNotFound(_0x466652,null))[_0xea60('0x21')](function(_0x12eec8){if(_0x12eec8){_0x4ea8fd[_0xea60('0x5e')][_0xea60('0x61')]=_0x12eec8['id'];return db[_0xea60('0x62')]['create'](_0x4ea8fd[_0xea60('0x5e')]);}})[_0xea60('0x21')](respondWithResult(_0x466652,null))[_0xea60('0x59')](handleError(_0x466652,null));};exports[_0xea60('0x63')]=function(_0x4d8e11,_0x5a1a9b,_0x4661fa){var _0x347cb2={'raw':![],'where':{}};var _0x23a806={};var _0x2a2f5b={'count':0x0,'rows':[]};return db['MailAccount'][_0xea60('0x64')]({'where':{'id':_0x4d8e11[_0xea60('0x5b')]['id']}})[_0xea60('0x21')](handleEntityNotFound(_0x5a1a9b,null))['then'](function(_0x1daceb){if(_0x1daceb){_0x23a806[_0xea60('0x46')]=_['keys'](db['Disposition']['rawAttributes']);_0x23a806[_0xea60('0x4b')]=_[_0xea60('0x48')](_0x4d8e11[_0xea60('0x4b')]);_0x23a806[_0xea60('0x49')]=_[_0xea60('0x4a')](_0x23a806[_0xea60('0x46')],_0x23a806[_0xea60('0x4b')]);_0x347cb2['attributes']=_['intersection'](_0x23a806[_0xea60('0x46')],qs['fields'](_0x4d8e11[_0xea60('0x4b')][_0xea60('0x4c')]));_0x347cb2[_0xea60('0x4d')]=_0x347cb2[_0xea60('0x4d')][_0xea60('0x65')]?_0x347cb2[_0xea60('0x4d')]:_0x23a806['model'];if(!_0x4d8e11[_0xea60('0x4b')][_0xea60('0x66')](_0xea60('0x4e'))){_0x347cb2[_0xea60('0x30')]=qs[_0xea60('0x30')](_0x4d8e11[_0xea60('0x4b')][_0xea60('0x30')]);_0x347cb2[_0xea60('0x2f')]=qs[_0xea60('0x2f')](_0x4d8e11['query'][_0xea60('0x2f')]);}_0x347cb2['order']=qs['sort'](_0x4d8e11[_0xea60('0x4b')][_0xea60('0x50')]);_0x347cb2[_0xea60('0x52')]=qs[_0xea60('0x49')](_[_0xea60('0x67')](_0x4d8e11[_0xea60('0x4b')],_0x23a806[_0xea60('0x49')]));_0x347cb2[_0xea60('0x52')][_0xea60('0x61')]=_0x1daceb['id'];if(_0x4d8e11[_0xea60('0x4b')][_0xea60('0x51')]){_0x347cb2[_0xea60('0x52')]=_['merge'](_0x347cb2[_0xea60('0x52')],{'$or':_[_0xea60('0x41')](_0x347cb2[_0xea60('0x4d')],function(_0x353d4c){var _0x13a06b={};_0x13a06b[_0x353d4c]={'$like':'%'+_0x4d8e11[_0xea60('0x4b')][_0xea60('0x51')]+'%'};return _0x13a06b;})});}_0x347cb2=_[_0xea60('0x53')]({},_0x347cb2,_0x4d8e11[_0xea60('0x55')]);return db[_0xea60('0x62')][_0xea60('0x2e')]({'where':_0x347cb2[_0xea60('0x52')]})[_0xea60('0x21')](function(_0x5bd499){_0x2a2f5b['count']=_0x5bd499;if(_0x4d8e11[_0xea60('0x4b')][_0xea60('0x56')]){_0x347cb2[_0xea60('0x57')]=[{'all':!![]}];}return db[_0xea60('0x62')]['findAll'](_0x347cb2);})[_0xea60('0x21')](function(_0x4a56a8){_0x2a2f5b[_0xea60('0x58')]=_0x4a56a8;return _0x2a2f5b;});}})[_0xea60('0x21')](respondWithFilteredResult(_0x5a1a9b,_0x347cb2))[_0xea60('0x59')](handleError(_0x5a1a9b,null));};exports[_0xea60('0x68')]=function(_0xe5c840,_0x1b5b8a,_0x216ccb){return db[_0xea60('0x42')]['find']({'where':{'id':_0xe5c840[_0xea60('0x5b')]['id']}})['then'](handleEntityNotFound(_0x1b5b8a,null))['then'](function(_0x376874){if(_0x376874){return _0x376874[_0xea60('0x68')](_0xe5c840['query'][_0xea60('0x69')]);}})[_0xea60('0x21')](respondWithStatusCode(_0x1b5b8a,null))[_0xea60('0x59')](handleError(_0x1b5b8a,null));};exports[_0xea60('0x6a')]=function(_0xd9fba,_0x4fd978,_0x4f5026){if(_0xd9fba[_0xea60('0x5e')]['id']){delete _0xd9fba[_0xea60('0x5e')]['id'];}return db['MailAccount'][_0xea60('0x5d')]({'where':{'id':_0xd9fba['params']['id']}})[_0xea60('0x21')](handleEntityNotFound(_0x4fd978,null))[_0xea60('0x21')](function(_0x343e56){if(_0x343e56){_0xd9fba['body'][_0xea60('0x61')]=_0x343e56['id'];return db[_0xea60('0x6b')][_0xea60('0x6c')](_0xd9fba[_0xea60('0x5e')]);}})['then'](respondWithResult(_0x4fd978,null))[_0xea60('0x59')](handleError(_0x4fd978,null));};exports[_0xea60('0x6d')]=function(_0x24e98f,_0x5eab96,_0x5cc91f){var _0x4fc63f={'raw':![],'where':{}};var _0x5b9b41={};var _0x1341f6={'count':0x0,'rows':[]};return db[_0xea60('0x42')][_0xea60('0x64')]({'where':{'id':_0x24e98f[_0xea60('0x5b')]['id']}})['then'](handleEntityNotFound(_0x5eab96,null))[_0xea60('0x21')](function(_0x39e931){if(_0x39e931){_0x5b9b41['model']=_[_0xea60('0x48')](db[_0xea60('0x6b')][_0xea60('0x43')]);_0x5b9b41[_0xea60('0x4b')]=_[_0xea60('0x48')](_0x24e98f[_0xea60('0x4b')]);_0x5b9b41[_0xea60('0x49')]=_[_0xea60('0x4a')](_0x5b9b41[_0xea60('0x46')],_0x5b9b41[_0xea60('0x4b')]);_0x4fc63f[_0xea60('0x4d')]=_[_0xea60('0x4a')](_0x5b9b41[_0xea60('0x46')],qs['fields'](_0x24e98f[_0xea60('0x4b')][_0xea60('0x4c')]));_0x4fc63f['attributes']=_0x4fc63f[_0xea60('0x4d')][_0xea60('0x65')]?_0x4fc63f[_0xea60('0x4d')]:_0x5b9b41[_0xea60('0x46')];if(!_0x24e98f[_0xea60('0x4b')][_0xea60('0x66')](_0xea60('0x4e'))){_0x4fc63f[_0xea60('0x30')]=qs[_0xea60('0x30')](_0x24e98f['query']['limit']);_0x4fc63f[_0xea60('0x2f')]=qs['offset'](_0x24e98f[_0xea60('0x4b')][_0xea60('0x2f')]);}_0x4fc63f['order']=qs[_0xea60('0x50')](_0x24e98f[_0xea60('0x4b')][_0xea60('0x50')]);_0x4fc63f['where']=qs[_0xea60('0x49')](_[_0xea60('0x67')](_0x24e98f[_0xea60('0x4b')],_0x5b9b41[_0xea60('0x49')]));_0x4fc63f['where']['MailAccountId']=_0x39e931['id'];if(_0x24e98f['query'][_0xea60('0x51')]){_0x4fc63f[_0xea60('0x52')]=_['merge'](_0x4fc63f['where'],{'$or':_[_0xea60('0x41')](_0x4fc63f[_0xea60('0x4d')],function(_0x56a4f2){var _0x433876={};_0x433876[_0x56a4f2]={'$like':'%'+_0x24e98f[_0xea60('0x4b')][_0xea60('0x51')]+'%'};return _0x433876;})});}_0x4fc63f=_[_0xea60('0x53')]({},_0x4fc63f,_0x24e98f[_0xea60('0x55')]);return db[_0xea60('0x6b')][_0xea60('0x2e')]({'where':_0x4fc63f[_0xea60('0x52')]})[_0xea60('0x21')](function(_0xe624ed){_0x1341f6[_0xea60('0x2e')]=_0xe624ed;if(_0x24e98f[_0xea60('0x4b')][_0xea60('0x56')]){_0x4fc63f[_0xea60('0x57')]=[{'all':!![]}];}return db['CannedAnswer'][_0xea60('0x6e')](_0x4fc63f);})[_0xea60('0x21')](function(_0x537d22){_0x1341f6[_0xea60('0x58')]=_0x537d22;return _0x1341f6;});}})[_0xea60('0x21')](respondWithFilteredResult(_0x5eab96,_0x4fc63f))[_0xea60('0x59')](handleError(_0x5eab96,null));};exports[_0xea60('0x6f')]=function(_0x115161,_0x2f4e73,_0x4b5202){return db[_0xea60('0x42')][_0xea60('0x5d')]({'where':{'id':_0x115161[_0xea60('0x5b')]['id']}})[_0xea60('0x21')](handleEntityNotFound(_0x2f4e73,null))['then'](function(_0x5f24d2){if(_0x5f24d2){return _0x5f24d2[_0xea60('0x6f')](_0x115161[_0xea60('0x4b')]['ids']);}})[_0xea60('0x21')](respondWithStatusCode(_0x2f4e73,null))[_0xea60('0x59')](handleError(_0x2f4e73,null));};exports[_0xea60('0x6c')]=function(_0x4f0e7b,_0x3fe24b){var _0x54d959={'name':_0x4f0e7b['body']['name'],'key':_0x4f0e7b[_0xea60('0x5e')][_0xea60('0x45')],'email':_0x4f0e7b[_0xea60('0x5e')][_0xea60('0x70')],'ListId':_0x4f0e7b['body'][_0xea60('0x71')],'active':!_[_0xea60('0x72')](_0x4f0e7b[_0xea60('0x5e')][_0xea60('0x73')])?_0x4f0e7b['body'][_0xea60('0x73')]:!![],'description':_0x4f0e7b[_0xea60('0x5e')][_0xea60('0x74')]||null,'Imap':{},'Smtp':{}};if(_[_0xea60('0x72')](_0x4f0e7b['body'][_0xea60('0x75')])){if(_0x4f0e7b[_0xea60('0x5e')][_0xea60('0x76')]){_0x54d959[_0xea60('0x3d')][_0xea60('0x77')]=_0x54d959[_0xea60('0x3f')][_0xea60('0x77')]=_0x4f0e7b[_0xea60('0x5e')][_0xea60('0x78')];_0x54d959['Imap'][_0xea60('0x79')]=_0x54d959[_0xea60('0x3f')][_0xea60('0x7a')]=_0x4f0e7b[_0xea60('0x5e')][_0xea60('0x7b')];}else{_0x54d959[_0xea60('0x3d')][_0xea60('0x7c')]=_0x54d959[_0xea60('0x3f')][_0xea60('0x7c')]=![];}_0x54d959[_0xea60('0x3d')][_0xea60('0x7d')]=_0x4f0e7b[_0xea60('0x5e')][_0xea60('0x3d')][_0xea60('0x7d')];_0x54d959[_0xea60('0x3d')]['port']=_0x4f0e7b[_0xea60('0x5e')][_0xea60('0x3d')][_0xea60('0x7e')];_0x54d959[_0xea60('0x3f')][_0xea60('0x7d')]=_0x4f0e7b['body'][_0xea60('0x3f')][_0xea60('0x7d')];_0x54d959[_0xea60('0x3f')][_0xea60('0x7e')]=_0x4f0e7b['body'][_0xea60('0x3f')][_0xea60('0x7e')];}else{_0x54d959[_0xea60('0x3d')][_0xea60('0x7f')]=_0x54d959['Smtp'][_0xea60('0x7f')]=_0x4f0e7b[_0xea60('0x5e')][_0xea60('0x75')];_0x54d959[_0xea60('0x3d')][_0xea60('0x77')]=_0x54d959[_0xea60('0x3f')]['user']=_0x4f0e7b[_0xea60('0x5e')][_0xea60('0x78')];_0x54d959['Imap'][_0xea60('0x79')]=_0x54d959['Smtp']['pass']=_0x4f0e7b[_0xea60('0x5e')][_0xea60('0x7b')];}return db['MailAccount'][_0xea60('0x6c')](_0x54d959,{'include':[{'model':db[_0xea60('0x3e')],'as':_0xea60('0x3f')},{'model':db[_0xea60('0x3c')],'as':_0xea60('0x3d')}]})['then'](function(_0xb7d30e){var _0x3249a2=_0x4f0e7b['user'][_0xea60('0x37')]({'plain':!![]});if(!_0x3249a2)throw new Error(_0xea60('0x80'));if(_0x3249a2['role']===_0xea60('0x77')){var _0x3406ed=_0xb7d30e['get']({'plain':!![]});return db[_0xea60('0x81')][_0xea60('0x5d')]({'where':{'name':_0xea60('0x38'),'userProfileId':_0x3249a2['userProfileId']},'raw':!![]})[_0xea60('0x21')](function(_0x105d41){if(_0x105d41&&_0x105d41[_0xea60('0x82')]===0x0){return db[_0xea60('0x83')]['create']({'name':_0x3406ed[_0xea60('0x47')],'resourceId':_0x3406ed['id'],'type':_0x105d41[_0xea60('0x47')],'sectionId':_0x105d41['id']},{})[_0xea60('0x21')](function(){return _0xb7d30e;});}else{return _0xb7d30e;}})['catch'](function(_0x1c3d51){logger[_0xea60('0x27')](_0xea60('0x84'),_0x1c3d51);throw _0x1c3d51;});}return _0xb7d30e;})[_0xea60('0x21')](respondWithResult(_0x3fe24b,0xc9))[_0xea60('0x59')](handleError(_0x3fe24b,null));};exports[_0xea60('0x85')]=function(_0x4db136,_0x124e47,_0x9983c0){return db[_0xea60('0x42')][_0xea60('0x64')]({'where':{'id':_0x4db136[_0xea60('0x5b')]['id']}})[_0xea60('0x21')](handleEntityNotFound(_0x124e47,null))[_0xea60('0x21')](function(_0x529ab7){if(_0x529ab7){return _0x529ab7['getImap']();}return null;})[_0xea60('0x21')](respondWithResult(_0x124e47,null))['catch'](handleError(_0x124e47,null));};exports[_0xea60('0x86')]=function(_0x5a8e75,_0x325342,_0x439d28){if(_0x5a8e75[_0xea60('0x5e')]['id']){delete _0x5a8e75[_0xea60('0x5e')]['id'];}return db[_0xea60('0x42')][_0xea60('0x5d')]({'where':{'id':_0x5a8e75[_0xea60('0x5b')]['id']}})[_0xea60('0x21')](handleEntityNotFound(_0x325342,null))[_0xea60('0x21')](function(_0x1d9a30){if(_0x1d9a30){_0x5a8e75[_0xea60('0x5e')][_0xea60('0x61')]=_0x1d9a30['id'];return db['MailServerIn'][_0xea60('0x6c')](_0x5a8e75[_0xea60('0x5e')]);}})['then'](respondWithResult(_0x325342,null))[_0xea60('0x59')](handleError(_0x325342,null));};exports[_0xea60('0x87')]=function(_0x40d4d7,_0x29d29f,_0x650f16){return db[_0xea60('0x42')][_0xea60('0x64')]({'where':{'id':_0x40d4d7[_0xea60('0x5b')]['id']}})[_0xea60('0x21')](handleEntityNotFound(_0x29d29f,null))[_0xea60('0x21')](function(_0x356a09){if(_0x356a09){return _0x356a09[_0xea60('0x88')](null);}return null;})[_0xea60('0x21')](respondWithStatusCode(_0x29d29f,null))[_0xea60('0x59')](handleError(_0x29d29f,null));};exports[_0xea60('0x89')]=function(_0x43195a,_0x3c28de,_0x3ed28a){return db[_0xea60('0x42')][_0xea60('0x64')]({'where':{'id':_0x43195a[_0xea60('0x5b')]['id']}})[_0xea60('0x21')](handleEntityNotFound(_0x3c28de,null))[_0xea60('0x21')](function(_0xfde4c8){if(_0xfde4c8){return _0xfde4c8[_0xea60('0x89')]();}return null;})[_0xea60('0x21')](respondWithResult(_0x3c28de,null))['catch'](handleError(_0x3c28de,null));};exports['addSmtp']=function(_0x18d883,_0x11c671,_0x3bbcb2){if(_0x18d883[_0xea60('0x5e')]['id']){delete _0x18d883[_0xea60('0x5e')]['id'];}return db[_0xea60('0x42')][_0xea60('0x5d')]({'where':{'id':_0x18d883[_0xea60('0x5b')]['id']}})['then'](handleEntityNotFound(_0x11c671,null))['then'](function(_0xd00905){if(_0xd00905){_0x18d883[_0xea60('0x5e')][_0xea60('0x61')]=_0xd00905['id'];return db[_0xea60('0x3e')]['create'](_0x18d883[_0xea60('0x5e')]);}})[_0xea60('0x21')](respondWithResult(_0x11c671,null))[_0xea60('0x59')](handleError(_0x11c671,null));};exports['removeSmtp']=function(_0x453ef0,_0x4f9001,_0x477b81){return db[_0xea60('0x42')][_0xea60('0x64')]({'where':{'id':_0x453ef0['params']['id']}})['then'](handleEntityNotFound(_0x4f9001,null))[_0xea60('0x21')](function(_0x177452){if(_0x177452){return _0x177452[_0xea60('0x8a')](null);}return null;})[_0xea60('0x21')](respondWithStatusCode(_0x4f9001,null))['catch'](handleError(_0x4f9001,null));};exports['addInteraction']=function(_0x2a44a3,_0x38d304,_0x46003a){return db['MailInteraction'][_0xea60('0x5d')]({'where':{'id':_0x2a44a3['params']['id']}})['then'](handleEntityNotFound(_0x38d304,null))[_0xea60('0x21')](function(_0x4aa725){if(_0x4aa725){return _0x4aa725[_0xea60('0x8b')](_0x2a44a3[_0xea60('0x5e')][_0xea60('0x69')],_[_0xea60('0x8c')](_0x2a44a3[_0xea60('0x5e')],[_0xea60('0x69'),'id'])||{});}})[_0xea60('0x21')](respondWithResult(_0x38d304,null))[_0xea60('0x59')](handleError(_0x38d304,null));};exports['getInteractions']=function(_0x37a2f9,_0x3b341d,_0x5b50cc){var _0xf426ee={'raw':![],'where':{}};var _0x5a10cf={};var _0x5143d5={'count':0x0,'rows':[]};return db[_0xea60('0x42')][_0xea60('0x64')]({'where':{'id':_0x37a2f9[_0xea60('0x5b')]['id']}})['then'](handleEntityNotFound(_0x3b341d,null))[_0xea60('0x21')](function(_0x2becd4){if(_0x2becd4){_0x5a10cf['model']=_['keys'](db[_0xea60('0x8d')][_0xea60('0x43')]);_0x5a10cf[_0xea60('0x4b')]=_[_0xea60('0x48')](_0x37a2f9[_0xea60('0x4b')]);_0x5a10cf[_0xea60('0x49')]=_[_0xea60('0x4a')](_0x5a10cf[_0xea60('0x46')],_0x5a10cf['query']);_0xf426ee[_0xea60('0x4d')]=_[_0xea60('0x4a')](_0x5a10cf[_0xea60('0x46')],qs[_0xea60('0x4c')](_0x37a2f9[_0xea60('0x4b')][_0xea60('0x4c')]));_0xf426ee[_0xea60('0x4d')]=_0xf426ee[_0xea60('0x4d')][_0xea60('0x65')]?_0xf426ee[_0xea60('0x4d')]:_0x5a10cf['model'];if(!_0x37a2f9['query'][_0xea60('0x66')](_0xea60('0x4e'))){_0xf426ee[_0xea60('0x30')]=qs[_0xea60('0x30')](_0x37a2f9[_0xea60('0x4b')][_0xea60('0x30')]);_0xf426ee[_0xea60('0x2f')]=qs[_0xea60('0x2f')](_0x37a2f9[_0xea60('0x4b')][_0xea60('0x2f')]);}_0xf426ee['order']=qs[_0xea60('0x50')](_0x37a2f9['query'][_0xea60('0x50')]);_0xf426ee[_0xea60('0x52')]=qs['filters'](_[_0xea60('0x67')](_0x37a2f9[_0xea60('0x4b')],_0x5a10cf[_0xea60('0x49')]));_0xf426ee[_0xea60('0x52')][_0xea60('0x61')]=_0x2becd4['id'];if(_0x37a2f9[_0xea60('0x4b')][_0xea60('0x51')]){_0xf426ee[_0xea60('0x52')]=_[_0xea60('0x53')](_0xf426ee[_0xea60('0x52')],{'$or':_[_0xea60('0x41')](_0xf426ee[_0xea60('0x4d')],function(_0x5df1b2){var _0x337229={};_0x337229[_0x5df1b2]={'$like':'%'+_0x37a2f9[_0xea60('0x4b')][_0xea60('0x51')]+'%'};return _0x337229;})});}_0xf426ee=_[_0xea60('0x53')]({},_0xf426ee,_0x37a2f9[_0xea60('0x55')]);return db[_0xea60('0x8d')][_0xea60('0x2e')]({'where':_0xf426ee[_0xea60('0x52')]})[_0xea60('0x21')](function(_0x753f8b){_0x5143d5[_0xea60('0x2e')]=_0x753f8b;if(_0x37a2f9['query'][_0xea60('0x56')]){_0xf426ee['include']=[{'model':db[_0xea60('0x8e')],'as':_0xea60('0x8f'),'required':![]},{'model':db[_0xea60('0x90')],'as':_0xea60('0x91'),'attributes':['name',_0xea60('0x92'),_0xea60('0x93')],'required':![]},{'model':db[_0xea60('0x94')],'as':_0xea60('0x95'),'attributes':['id','name',_0xea60('0x96')],'where':_0x37a2f9[_0xea60('0x4b')][_0xea60('0x97')]?{'id':_0x37a2f9['query']['tag']}:undefined,'required':_0x37a2f9[_0xea60('0x4b')][_0xea60('0x97')]?!![]:![]}];}return db[_0xea60('0x8d')]['findAll'](_0xf426ee);})['then'](function(_0x5762bf){_0x5143d5[_0xea60('0x58')]=_0x5762bf;return _0x5143d5;});}})[_0xea60('0x21')](respondWithFilteredResult(_0x3b341d,_0xf426ee))['catch'](handleError(_0x3b341d,null));};exports[_0xea60('0x98')]=function(_0x185008,_0x11294a,_0x1b0d6e){return db[_0xea60('0x42')][_0xea60('0x64')]({'where':{'id':_0x185008[_0xea60('0x5b')]['id']}})['then'](handleEntityNotFound(_0x11294a,null))['then'](function(_0x3664ac){if(_0x3664ac){return db[_0xea60('0x99')]['transaction'](function(_0x16170a){return db[_0xea60('0x9a')][_0xea60('0x36')]({'where':{'MailAccountId':_0x185008['params']['id']},'transaction':_0x16170a})['then'](function(_0x46e59f){var _0x43537b=_[_0xea60('0x41')](_0x185008[_0xea60('0x5e')],function(_0x97ee32){_0x97ee32[_0xea60('0x61')]=_0x185008[_0xea60('0x5b')]['id'];return _0x97ee32;});return db[_0xea60('0x9a')][_0xea60('0x9b')](_0x43537b,{'transaction':_0x16170a});});})[_0xea60('0x21')](function(){return db[_0xea60('0x9a')]['findAndCountAll']({'where':{'MailAccountId':_0x185008['params']['id']},'order':'priority'});});}})[_0xea60('0x21')](respondWithResult(_0x11294a,null))[_0xea60('0x59')](handleError(_0x11294a,null));};exports[_0xea60('0x9c')]=function(_0x314735,_0x461ec2,_0x543ad4){var _0x53c58f={};var _0x3527b2={};var _0x136d11;var _0x753a3d;return db[_0xea60('0x42')][_0xea60('0x64')]({'where':{'id':_0x314735[_0xea60('0x5b')]['id']}})['then'](handleEntityNotFound(_0x461ec2,null))[_0xea60('0x21')](function(_0x56ee4a){if(_0x56ee4a){_0x136d11=_0x56ee4a;_0x3527b2[_0xea60('0x46')]=_[_0xea60('0x48')](db['MailApplication']['rawAttributes']);_0x3527b2['query']=_[_0xea60('0x48')](_0x314735[_0xea60('0x4b')]);_0x3527b2[_0xea60('0x49')]=_['intersection'](_0x3527b2[_0xea60('0x46')],_0x3527b2[_0xea60('0x4b')]);_0x53c58f[_0xea60('0x4d')]=_['intersection'](_0x3527b2['model'],qs[_0xea60('0x4c')](_0x314735['query'][_0xea60('0x4c')]));_0x53c58f[_0xea60('0x4d')]=_0x53c58f[_0xea60('0x4d')][_0xea60('0x65')]?_0x53c58f[_0xea60('0x4d')]:_0x3527b2[_0xea60('0x46')];_0x53c58f[_0xea60('0x4f')]=qs[_0xea60('0x50')](_0x314735[_0xea60('0x4b')]['sort']);_0x53c58f[_0xea60('0x52')]=qs[_0xea60('0x49')](_['pick'](_0x314735[_0xea60('0x4b')],_0x3527b2[_0xea60('0x49')]));if(_0x314735[_0xea60('0x4b')]['filter']){_0x53c58f[_0xea60('0x52')]=_['merge'](_0x53c58f[_0xea60('0x52')],{'$or':_['map'](_0x53c58f[_0xea60('0x4d')],function(_0xa696e8){var _0xe735={};_0xe735[_0xa696e8]={'$like':'%'+_0x314735[_0xea60('0x4b')][_0xea60('0x51')]+'%'};return _0xe735;})});}_0x53c58f=_['merge']({},_0x53c58f,_0x314735[_0xea60('0x55')]);return _0x136d11[_0xea60('0x9c')](_0x53c58f);}})[_0xea60('0x21')](function(_0x1e6bf7){if(_0x1e6bf7){_0x753a3d=_0x1e6bf7[_0xea60('0x65')];if(!_0x314735[_0xea60('0x4b')][_0xea60('0x66')](_0xea60('0x4e'))){_0x53c58f[_0xea60('0x30')]=qs[_0xea60('0x30')](_0x314735[_0xea60('0x4b')]['limit']);_0x53c58f[_0xea60('0x2f')]=qs[_0xea60('0x2f')](_0x314735[_0xea60('0x4b')][_0xea60('0x2f')]);}return _0x136d11['getApplications'](_0x53c58f);}})[_0xea60('0x21')](function(_0x4f49a5){if(_0x4f49a5){return _0x4f49a5?{'count':_0x753a3d,'rows':_0x4f49a5}:null;}})['then'](respondWithResult(_0x461ec2,null))[_0xea60('0x59')](handleError(_0x461ec2,null));};exports['getMessages']=function(_0x5cc099,_0x412cff,_0x58d4ef){var _0x160a6e={'raw':!![],'where':{}};var _0x37d889={};var _0x5a965a={'count':0x0,'rows':[]};return db[_0xea60('0x42')][_0xea60('0x64')]({'where':{'id':_0x5cc099[_0xea60('0x5b')]['id']}})[_0xea60('0x21')](handleEntityNotFound(_0x412cff,null))[_0xea60('0x21')](function(_0x4c3455){if(_0x4c3455){_0x37d889['model']=_[_0xea60('0x48')](db['MailMessage'][_0xea60('0x43')]);_0x37d889[_0xea60('0x4b')]=_[_0xea60('0x48')](_0x5cc099['query']);_0x37d889['filters']=_[_0xea60('0x4a')](_0x37d889[_0xea60('0x46')],_0x37d889['query']);_0x160a6e[_0xea60('0x4d')]=_[_0xea60('0x4a')](_0x37d889[_0xea60('0x46')],qs['fields'](_0x5cc099[_0xea60('0x4b')][_0xea60('0x4c')]));_0x160a6e['attributes']=_0x160a6e['attributes'][_0xea60('0x65')]?_0x160a6e['attributes']:_0x37d889['model'];if(!_0x5cc099[_0xea60('0x4b')][_0xea60('0x66')](_0xea60('0x4e'))){_0x160a6e[_0xea60('0x30')]=qs['limit'](_0x5cc099[_0xea60('0x4b')][_0xea60('0x30')]);_0x160a6e['offset']=qs[_0xea60('0x2f')](_0x5cc099['query']['offset']);}_0x160a6e[_0xea60('0x4f')]=qs[_0xea60('0x50')](_0x5cc099[_0xea60('0x4b')][_0xea60('0x50')]);_0x160a6e[_0xea60('0x52')]=qs[_0xea60('0x49')](_['pick'](_0x5cc099[_0xea60('0x4b')],_0x37d889[_0xea60('0x49')]));_0x160a6e['where'][_0xea60('0x61')]=_0x4c3455['id'];if(_0x5cc099[_0xea60('0x4b')][_0xea60('0x51')]){_0x160a6e['where']=_['merge'](_0x160a6e['where'],{'$or':_[_0xea60('0x41')](_0x160a6e['attributes'],function(_0x277e59){var _0x531acc={};_0x531acc[_0x277e59]={'$like':'%'+_0x5cc099[_0xea60('0x4b')][_0xea60('0x51')]+'%'};return _0x531acc;})});}if(_0x5cc099[_0xea60('0x4b')]['$gte']){var _0x578519=_0x5cc099[_0xea60('0x4b')][_0xea60('0x9d')][_0xea60('0x9e')](',');var _0x3798e={};_0x3798e[_0x578519[0x0]]={'$gte':moment(_0x578519[0x1])[_0xea60('0x9f')](_0xea60('0xa0'))};_0x160a6e[_0xea60('0x52')]=_[_0xea60('0x53')](_0x160a6e[_0xea60('0x52')],_0x3798e);}_0x160a6e=_[_0xea60('0x53')]({},_0x160a6e,_0x5cc099[_0xea60('0x55')]);return db[_0xea60('0xa1')][_0xea60('0x2e')]({'where':_0x160a6e[_0xea60('0x52')]})[_0xea60('0x21')](function(_0x3f6b04){_0x5a965a['count']=_0x3f6b04;if(_0x5cc099['query'][_0xea60('0x56')]){_0x160a6e[_0xea60('0x57')]=[{'all':!![]}];}return db[_0xea60('0xa1')][_0xea60('0x6e')](_0x160a6e);})[_0xea60('0x21')](function(_0x12a72a){_0x5a965a['rows']=_0x12a72a;return _0x5a965a;});}})[_0xea60('0x21')](respondWithFilteredResult(_0x412cff,_0x160a6e))['catch'](handleError(_0x412cff,null));};exports[_0xea60('0x3a')]=function(_0x45ade3,_0x121537,_0xf3cc7b){var _0x483398,_0x5af623={},_0x2431cc;if(_0x45ade3['body']['to']){_0x2431cc=_0x45ade3[_0xea60('0x5e')]['to'][_0xea60('0x9e')](',')[0x0];}return db['MailAccount']['find']({'where':{'id':_0x45ade3['params']['id']},'include':[{'model':db['CmList'],'as':_0xea60('0xa2'),'include':[{'model':db[_0xea60('0x8e')],'as':_0xea60('0xa3'),'where':{'email':_0x2431cc},'limit':0x1,'order':[[_0xea60('0xa4'),_0xea60('0xa5')]]}]},{'model':db[_0xea60('0x3e')],'as':_0xea60('0x3f'),'raw':!![]}]})[_0xea60('0x21')](handleEntityNotFound(_0x121537,null))['then'](function(_0x201b26){if(_0x201b26){_0x483398=_0x201b26;if(_0x201b26[_0xea60('0x3f')]){if(_[_0xea60('0x72')](_0x45ade3['body'][_0xea60('0xa6')])){_0x45ade3[_0xea60('0x5e')][_0xea60('0xa6')]=util[_0xea60('0x9f')](_0xea60('0xa7'),_0x201b26[_0xea60('0x47')],_0x201b26[_0xea60('0x70')]||_0x201b26[_0xea60('0x3f')]['user']);}if(_0x45ade3[_0xea60('0x5e')][_0xea60('0xa8')]&&_0x45ade3[_0xea60('0x5e')][_0xea60('0xa8')][_0xea60('0x65')]){for(var _0x229fe6=0x0;_0x229fe6<_0x45ade3[_0xea60('0x5e')][_0xea60('0xa8')][_0xea60('0x65')];_0x229fe6+=0x1){_0x45ade3['body'][_0xea60('0xa8')][_0x229fe6]={'filename':_0x45ade3[_0xea60('0x5e')]['attachments'][_0x229fe6][_0xea60('0x47')],'path':path[_0xea60('0xa9')](config[_0xea60('0xaa')],_0xea60('0xab'),_0x45ade3['body']['attachments'][_0x229fe6][_0xea60('0xac')])};}}var _0x1248df={'tls':{'rejectUnauthorized':![]}};if(_[_0xea60('0x72')](_0x201b26[_0xea60('0x3f')]['service'])){if(_0x201b26['Smtp']['authentication']){_0x1248df[_0xea60('0xad')]={'user':_0x201b26['Smtp'][_0xea60('0x77')],'pass':_0x201b26[_0xea60('0x3f')][_0xea60('0x7a')]};}_0x1248df['host']=_0x201b26[_0xea60('0x3f')]['host'];_0x1248df['port']=_0x201b26[_0xea60('0x3f')][_0xea60('0x7e')];_0x1248df['secure']=_0x201b26[_0xea60('0x3f')][_0xea60('0xae')];}else{_0x1248df[_0xea60('0x7f')]=_0x201b26[_0xea60('0x3f')][_0xea60('0x7f')];_0x1248df[_0xea60('0xad')]={'user':_0x201b26[_0xea60('0x3f')][_0xea60('0x77')],'pass':_0x201b26[_0xea60('0x3f')][_0xea60('0x7a')]};}return respondWithRpcPromise(_0xea60('0xaf'),_0xea60('0xb0'),{'account':_0x1248df,'message':_0x45ade3[_0xea60('0x5e')]});}else{throw new Error(_0xea60('0xb1'));}}})[_0xea60('0x21')](function(_0x492e1a){if(_0x492e1a){_0x5af623=_0x492e1a;if(_0x483398[_0xea60('0xa2')]){if(_0x483398[_0xea60('0xa2')][_0xea60('0xa3')][_0xea60('0x65')]){return _0x483398[_0xea60('0xa2')][_0xea60('0xa3')][0x0];}else{return db[_0xea60('0x8e')][_0xea60('0x6c')](_[_0xea60('0x15')](_0x45ade3[_0xea60('0x5e')],{'firstName':_0x45ade3[_0xea60('0x5e')]['to'],'email':_0x45ade3[_0xea60('0x5e')]['to'],'phone':_0x45ade3[_0xea60('0x5e')]['to'],'ListId':_0x483398[_0xea60('0x71')]}));}}else{throw new Error(_0xea60('0xb1'));}}})[_0xea60('0x21')](function(_0x2a5432){if(_0x2a5432){var _0x29bfc6={'UserId':_0x45ade3['user']['id'],'ContactId':_0x2a5432['id'],'MailAccountId':_0x483398['id'],'inReplyTo':_0x5af623['messageId'],'to':_0x45ade3[_0xea60('0x5e')][_0xea60('0xa6')],'cc':_0x45ade3['body']['cc'],'subject':_0x45ade3[_0xea60('0x5e')][_0xea60('0xb2')],'attach':_0x45ade3[_0xea60('0x5e')]['attach'],'firstMsgDirection':_0xea60('0xb3'),'lastMsgAt':moment()['format'](_0xea60('0xa0')),'lastMsgDirection':_0xea60('0xb3'),'lastMsgBody':_0x45ade3['body']['body'],'Messages':[_[_0xea60('0x53')](_0x45ade3['body'],{'messageId':_0x5af623[_0xea60('0xb4')],'sentAt':moment()['format']('YYYY-MM-DD\x20HH:mm:ss'),'read':!![],'MailAccountId':_0x483398['id'],'UserId':_0x45ade3[_0xea60('0x77')]['id'],'ContactId':_0x2a5432['id']})]};if(_0x45ade3['body']['Interaction']){_0x29bfc6=_[_0xea60('0x53')](_0x29bfc6,_0x45ade3[_0xea60('0x5e')][_0xea60('0xb5')]);}return db[_0xea60('0x8d')][_0xea60('0x6c')](_0x29bfc6,{'include':[{'model':db[_0xea60('0xa1')],'as':_0xea60('0xb6')}]});}})[_0xea60('0x21')](respondWithResult(_0x121537,null))[_0xea60('0x59')](handleError(_0x121537,null));};exports[_0xea60('0xb7')]=function(_0x22ef57,_0x4bd691,_0xe36068){return db[_0xea60('0x42')][_0xea60('0x5d')]({'where':{'id':_0x22ef57[_0xea60('0x5b')]['id']},'include':[{'model':db[_0xea60('0x3e')],'as':_0xea60('0x3f'),'raw':!![]}]})[_0xea60('0x21')](handleEntityNotFound(_0x4bd691,null))['then'](function(_0x49e1dd){if(_0x49e1dd&&_0x49e1dd[_0xea60('0x3f')]){var _0x3af9ec={'id':_0x49e1dd['id'],'tls':{'rejectUnauthorized':![]}};if(_0x49e1dd[_0xea60('0x3f')][_0xea60('0x7f')]){_0x3af9ec['service']=_0x49e1dd[_0xea60('0x3f')]['service'];}else{_0x3af9ec['host']=_0x49e1dd[_0xea60('0x3f')][_0xea60('0x7d')];_0x3af9ec[_0xea60('0x7e')]=_0x49e1dd[_0xea60('0x3f')][_0xea60('0x7e')];_0x3af9ec[_0xea60('0xae')]=_0x49e1dd[_0xea60('0x3f')][_0xea60('0xae')];}if(_0x49e1dd[_0xea60('0x3f')][_0xea60('0x7c')]){_0x3af9ec[_0xea60('0xad')]={'user':_0x49e1dd[_0xea60('0x3f')][_0xea60('0x77')],'pass':_0x49e1dd[_0xea60('0x3f')][_0xea60('0x7a')]};}return respondWithRpcPromise(_0xea60('0xb8'),_0xea60('0xb7'),{'account':_0x3af9ec});}})[_0xea60('0x21')](respondWithResult(_0x4bd691,null))[_0xea60('0x59')](handleError(_0x4bd691,null));};exports[_0xea60('0x36')]=function(_0x2d81be,_0x4f164b){return db[_0xea60('0x42')][_0xea60('0x5d')]({'where':{'id':_0x2d81be[_0xea60('0x5b')]['id']}})[_0xea60('0x21')](handleEntityNotFound(_0x4f164b,null))[_0xea60('0x21')](function(_0x3b3c39){if(_0x3b3c39&&_0x3b3c39[_0xea60('0x7f')]){throw new db[(_0xea60('0x1d'))][(_0xea60('0x1e'))](_0xea60('0xb9'));}return _0x3b3c39;})[_0xea60('0x21')](removeEntity(_0x4f164b,null))[_0xea60('0x59')](handleError(_0x4f164b,null));};exports[_0xea60('0xba')]=function(_0x15efff,_0x10c1fa,_0x53d1f6){return db['MailAccount'][_0xea60('0x5d')]({'where':{'id':_0x15efff[_0xea60('0x5b')]['id']}})[_0xea60('0x21')](handleEntityNotFound(_0x10c1fa,null))[_0xea60('0x21')](function(_0x506a3e){if(_0x506a3e){return _0x506a3e[_0xea60('0xba')](_0x15efff[_0xea60('0x5e')]['ids'],_[_0xea60('0x8c')](_0x15efff[_0xea60('0x5e')],['ids','id'])||{})[_0xea60('0xbb')](function(_0x24f24b){for(var _0x34a3b2=0x0;_0x34a3b2<_0x15efff[_0xea60('0x5e')][_0xea60('0x69')][_0xea60('0x65')];_0x34a3b2+=0x1){socket['emit']('userMailAccount:save',{'UserId':_0x15efff[_0xea60('0x5e')]['ids'][_0x34a3b2],'MailAccountId':_0x15efff[_0xea60('0x5b')]['id']});}return _0x24f24b;});}})[_0xea60('0x21')](respondWithResult(_0x10c1fa,null))[_0xea60('0x59')](handleError(_0x10c1fa,null));};exports[_0xea60('0xbc')]=function(_0x24404d,_0x3af522,_0x3de225){return db[_0xea60('0x42')][_0xea60('0x5d')]({'where':{'id':_0x24404d[_0xea60('0x5b')]['id']}})['then'](handleEntityNotFound(_0x3af522,null))[_0xea60('0x21')](function(_0x5e6c07){if(_0x5e6c07){return _0x5e6c07[_0xea60('0xbc')](_0x24404d['query'][_0xea60('0x69')])[_0xea60('0x21')](function(){if(_['isArray'](_0x24404d[_0xea60('0x4b')][_0xea60('0x69')])){for(var _0x442ee3=0x0;_0x442ee3<_0x24404d[_0xea60('0x4b')][_0xea60('0x69')]['length'];_0x442ee3+=0x1){socket[_0xea60('0xbd')](_0xea60('0xbe'),{'UserId':Number(_0x24404d['query']['ids'][_0x442ee3]),'MailAccountId':Number(_0x24404d[_0xea60('0x5b')]['id'])});}}else{socket[_0xea60('0xbd')]('userMailAccount:remove',{'UserId':Number(_0x24404d[_0xea60('0x4b')][_0xea60('0x69')]),'MailAccountId':Number(_0x24404d[_0xea60('0x5b')]['id'])});}});}})[_0xea60('0x21')](respondWithStatusCode(_0x3af522,null))[_0xea60('0x59')](handleError(_0x3af522,null));};exports[_0xea60('0xbf')]=function(_0x356cd7,_0x45a035,_0x217198){var _0x3cc4bd={};var _0x10a921={};var _0x3895a2;var _0x4bdae5;return db[_0xea60('0x42')][_0xea60('0x64')]({'where':{'id':_0x356cd7[_0xea60('0x5b')]['id']}})[_0xea60('0x21')](handleEntityNotFound(_0x45a035,null))[_0xea60('0x21')](function(_0x5c5d27){if(_0x5c5d27){_0x3895a2=_0x5c5d27;_0x10a921[_0xea60('0x46')]=_['keys'](db[_0xea60('0x90')][_0xea60('0x43')]);_0x10a921[_0xea60('0x4b')]=_[_0xea60('0x48')](_0x356cd7[_0xea60('0x4b')]);_0x10a921[_0xea60('0x49')]=_['intersection'](_0x10a921[_0xea60('0x46')],_0x10a921[_0xea60('0x4b')]);_0x3cc4bd[_0xea60('0x4d')]=_['intersection'](_0x10a921[_0xea60('0x46')],qs['fields'](_0x356cd7[_0xea60('0x4b')]['fields']));_0x3cc4bd['attributes']=_0x3cc4bd['attributes'][_0xea60('0x65')]?_0x3cc4bd['attributes']:_0x10a921[_0xea60('0x46')];_0x3cc4bd[_0xea60('0x4f')]=qs[_0xea60('0x50')](_0x356cd7[_0xea60('0x4b')][_0xea60('0x50')]);_0x3cc4bd['where']=qs[_0xea60('0x49')](_[_0xea60('0x67')](_0x356cd7['query'],_0x10a921['filters']));if(_0x356cd7[_0xea60('0x4b')][_0xea60('0x51')]){_0x3cc4bd[_0xea60('0x52')]=_[_0xea60('0x53')](_0x3cc4bd[_0xea60('0x52')],{'$or':_[_0xea60('0x41')](_0x3cc4bd['attributes'],function(_0x6a81ff){var _0x13b2b7={};_0x13b2b7[_0x6a81ff]={'$like':'%'+_0x356cd7[_0xea60('0x4b')][_0xea60('0x51')]+'%'};return _0x13b2b7;})});}_0x3cc4bd=_['merge']({},_0x3cc4bd,_0x356cd7[_0xea60('0x55')]);return _0x3895a2['getAgents'](_0x3cc4bd);}})[_0xea60('0x21')](function(_0x3c39cf){if(_0x3c39cf){_0x4bdae5=_0x3c39cf['length'];if(!_0x356cd7[_0xea60('0x4b')][_0xea60('0x66')](_0xea60('0x4e'))){_0x3cc4bd[_0xea60('0x30')]=qs[_0xea60('0x30')](_0x356cd7[_0xea60('0x4b')]['limit']);_0x3cc4bd[_0xea60('0x2f')]=qs[_0xea60('0x2f')](_0x356cd7[_0xea60('0x4b')][_0xea60('0x2f')]);}return _0x3895a2[_0xea60('0xbf')](_0x3cc4bd);}})['then'](function(_0x51990a){if(_0x51990a){return _0x51990a?{'count':_0x4bdae5,'rows':_0x51990a}:null;}})[_0xea60('0x21')](respondWithResult(_0x45a035,null))[_0xea60('0x59')](handleError(_0x45a035,null));}; \ No newline at end of file +var _0x198e=['cpassword','authentication','host','port','service','pass','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','getImap','removeImap','setImap','getSmtp','removeSmtp','addInteraction','MailInteraction','getInteractions','User','fullname','internal','Tag','Tags','color','tag','sequelize','transaction','MailApplication','bulkCreate','findAndCountAll','priority','getApplications','getMessages','MailMessage','$gte','split','format','send','CmList','List','CmContact','Contacts','updatedAt','DESC','from','%s\x20<%s>','email','attachments','join','basename','secure','auth','ListId','List\x20not\x20found','messageId','subject','attach','out','YYYY-MM-DD\x20HH:mm:ss','Interaction','verifySmtp','VerifySmtp','addAgents','omit','spread','emit','userMailAccount:save','removeAgents','isArray','userMailAccount:remove','getAgents','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','util','path','sox','ejs','lodash','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','redis','defaults','localhost','socket.io-emitter','./mailAccount.socket','jayson/promise','client','http','test','Sequelize','ValidationError','request','then','MailAccount,\x20%s,\x20%s','debug','MailAccount,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','info','result','catch','sendStatus','status','end','json','count','offset','limit','Content-Range','save','update','get','MailAccounts','UserProfileResource','destroy','stack','name','MailServerIn','Imap','MailServerOut','Smtp','Pause','MailAccount','rawAttributes','fieldName','type','model','query','keys','filters','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filter','map','VIRTUAL','merge','options','findAll','show','params','mandatoryDispositionPause','intersection','includeAll','find','body','describe','MailAccountId','Disposition','create','findOne','pick','rows','removeDispositions','CannedAnswer','getAnswers','include','removeAnswers','ids','active','description','isNil','cservice','cauthentication','user','cuser','password'];(function(_0x20244a,_0x487137){var _0xd77825=function(_0x3f1842){while(--_0x3f1842){_0x20244a['push'](_0x20244a['shift']());}};_0xd77825(++_0x487137);}(_0x198e,0x1c4));var _0xe198=function(_0xcd1577,_0x201e40){_0xcd1577=_0xcd1577-0x0;var _0x8e9879=_0x198e[_0xcd1577];return _0x8e9879;};'use strict';var pdf=require(_0xe198('0x0'));var emlformat=require(_0xe198('0x1'));var rimraf=require(_0xe198('0x2'));var zipdir=require(_0xe198('0x3'));var jsonpatch=require(_0xe198('0x4'));var rp=require(_0xe198('0x5'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0xe198('0x6'));var path=require(_0xe198('0x7'));var sox=require(_0xe198('0x8'));var csv=require('to-csv');var ejs=require(_0xe198('0x9'));var fs=require('fs');var _=require(_0xe198('0xa'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0xe198('0xb'));var deskjs=require(_0xe198('0xc'));var toCsv=require(_0xe198('0xd'));var querystring=require(_0xe198('0xe'));var Papa=require(_0xe198('0xf'));var Redis=require(_0xe198('0x10'));var authService=require(_0xe198('0x11'));var qs=require(_0xe198('0x12'));var as=require(_0xe198('0x13'));var hardwareService=require(_0xe198('0x14'));var logger=require('../../config/logger')(_0xe198('0x15'));var utils=require(_0xe198('0x16'));var config=require('../../config/environment');var db=require('../../mysqldb')['db'];config[_0xe198('0x17')]=_[_0xe198('0x18')](config['redis'],{'host':_0xe198('0x19'),'port':0x18eb});var socket=require(_0xe198('0x1a'))(new Redis(config[_0xe198('0x17')]));require(_0xe198('0x1b'))['register'](socket);var jayson=require(_0xe198('0x1c'));var client=jayson[_0xe198('0x1d')][_0xe198('0x1e')]({'port':0x232b});function checkPasswordPattern(_0x587b82,_0x55f17c,_0x6e5c67){if(_0x6e5c67){var _0x4859b7=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x4859b7[_0xe198('0x1f')](_0x55f17c)){return _0x587b82;}else{throw new db[(_0xe198('0x20'))][(_0xe198('0x21'))]('The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.');}}else{return _0x587b82;}}function respondWithRpcPromise(_0x5cf211,_0x13ab8c,_0x2b6bcc,_0x42d7b2){return new BPromise(function(_0x593793,_0x4e9bae){var _0x48a7fd=_0x42d7b2||client;return _0x48a7fd[_0xe198('0x22')](_0x5cf211,_0x2b6bcc)[_0xe198('0x23')](function(_0x31365e){logger['info'](_0xe198('0x24'),_0x13ab8c,'request\x20sent');logger[_0xe198('0x25')](_0xe198('0x26'),_0x13ab8c,_0xe198('0x27'),JSON[_0xe198('0x28')](_0x31365e));if(_0x31365e[_0xe198('0x29')]){if(_0x31365e[_0xe198('0x29')][_0xe198('0x2a')]===0x1f4){logger[_0xe198('0x29')](_0xe198('0x24'),_0x13ab8c,_0x31365e[_0xe198('0x29')][_0xe198('0x2b')]);return _0x4e9bae(_0x31365e[_0xe198('0x29')][_0xe198('0x2b')]);}logger[_0xe198('0x29')](_0xe198('0x24'),_0x13ab8c,_0x31365e[_0xe198('0x29')][_0xe198('0x2b')]);return _0x593793(_0x31365e[_0xe198('0x29')][_0xe198('0x2b')]);}else{logger[_0xe198('0x2c')](_0xe198('0x24'),_0x13ab8c,'request\x20sent');_0x593793(_0x31365e[_0xe198('0x2d')]['message']);}})[_0xe198('0x2e')](function(_0x2baf84){logger[_0xe198('0x29')](_0xe198('0x24'),_0x13ab8c,_0x2baf84);_0x4e9bae(_0x2baf84);});});}function respondWithStatusCode(_0x367c7d,_0x57cb4c){_0x57cb4c=_0x57cb4c||0xcc;return function(_0x2db0e5){if(_0x2db0e5){return _0x367c7d[_0xe198('0x2f')](_0x57cb4c);}return _0x367c7d[_0xe198('0x30')](_0x57cb4c)[_0xe198('0x31')]();};}function respondWithResult(_0x2f4d96,_0x1b20f9){_0x1b20f9=_0x1b20f9||0xc8;return function(_0x2cd1a2){if(_0x2cd1a2){return _0x2f4d96[_0xe198('0x30')](_0x1b20f9)[_0xe198('0x32')](_0x2cd1a2);}};}function respondWithFilteredResult(_0x1e72f8,_0x1f5fa8){return function(_0x523833){if(_0x523833){var _0x49b9e5=_0x523833[_0xe198('0x33')],_0x982649=_0x1f5fa8[_0xe198('0x34')],_0x457b90=_0x1f5fa8[_0xe198('0x34')]+_0x1f5fa8[_0xe198('0x35')],_0x40a9c9;if(_0x457b90>=_0x49b9e5){_0x457b90=_0x49b9e5;_0x40a9c9=0xc8;}else{_0x40a9c9=0xce;}_0x1e72f8[_0xe198('0x30')](_0x40a9c9);return _0x1e72f8['set'](_0xe198('0x36'),_0x982649+'-'+_0x457b90+'/'+_0x49b9e5)[_0xe198('0x32')](_0x523833);}return null;};}function patchUpdates(_0x521e96){return function(_0x15ce75){try{jsonpatch['apply'](_0x15ce75,_0x521e96,!![]);}catch(_0x34ee97){return BPromise['reject'](_0x34ee97);}return _0x15ce75[_0xe198('0x37')]();};}function saveUpdates(_0x187eb9,_0x52c7d7){return function(_0x35c801){if(_0x35c801){return _0x35c801[_0xe198('0x38')](_0x187eb9)[_0xe198('0x23')](function(_0x2a421b){return _0x2a421b;});}return null;};}function removeEntity(_0x338f55,_0x1e8c23){return function(_0x181aab){if(_0x181aab){return _0x181aab['destroy']()[_0xe198('0x23')](function(){var _0x5b9651=_0x181aab[_0xe198('0x39')]({'plain':!![]});var _0x38d77d=_0xe198('0x3a');return db[_0xe198('0x3b')][_0xe198('0x3c')]({'where':{'type':_0x38d77d,'resourceId':_0x5b9651['id']}})['then'](function(){return _0x181aab;});})[_0xe198('0x23')](function(){_0x338f55[_0xe198('0x30')](0xcc)[_0xe198('0x31')]();});}};}function handleEntityNotFound(_0x543a8b,_0x5396e4){return function(_0x479403){if(!_0x479403){_0x543a8b[_0xe198('0x2f')](0x194);}return _0x479403;};}function handleError(_0xb0a672,_0x8b93ad){_0x8b93ad=_0x8b93ad||0x1f4;return function(_0x14e14e){logger['error'](_0x14e14e[_0xe198('0x3d')]);if(_0x14e14e[_0xe198('0x3e')]){delete _0x14e14e[_0xe198('0x3e')];}_0xb0a672[_0xe198('0x30')](_0x8b93ad)['send'](_0x14e14e);};}exports['index']=function(_0x2beabc,_0x5256e9){var _0x6c910f={'include':[{'model':db[_0xe198('0x3f')],'as':_0xe198('0x40')},{'model':db[_0xe198('0x41')],'as':_0xe198('0x42')},{'model':db[_0xe198('0x43')],'as':'mandatoryDispositionPause'}]},_0xcd8035={},_0x6b5b4a={'count':0x0,'rows':[]};var _0x323ec6=_['map'](db[_0xe198('0x44')][_0xe198('0x45')],function(_0x523cae){return{'name':_0x523cae[_0xe198('0x46')],'type':_0x523cae[_0xe198('0x47')]['key']};});_0xcd8035[_0xe198('0x48')]=_['map'](_0x323ec6,_0xe198('0x3e'));_0xcd8035[_0xe198('0x49')]=_[_0xe198('0x4a')](_0x2beabc[_0xe198('0x49')]);_0xcd8035[_0xe198('0x4b')]=_['intersection'](_0xcd8035[_0xe198('0x48')],_0xcd8035[_0xe198('0x49')]);_0x6c910f[_0xe198('0x4c')]=_['intersection'](_0xcd8035[_0xe198('0x48')],qs['fields'](_0x2beabc['query'][_0xe198('0x4d')]));_0x6c910f['attributes']=_0x6c910f[_0xe198('0x4c')][_0xe198('0x4e')]?_0x6c910f['attributes']:_0xcd8035[_0xe198('0x48')];if(!_0x2beabc[_0xe198('0x49')][_0xe198('0x4f')](_0xe198('0x50'))){_0x6c910f[_0xe198('0x35')]=qs[_0xe198('0x35')](_0x2beabc[_0xe198('0x49')]['limit']);_0x6c910f['offset']=qs[_0xe198('0x34')](_0x2beabc[_0xe198('0x49')][_0xe198('0x34')]);}_0x6c910f[_0xe198('0x51')]=qs[_0xe198('0x52')](_0x2beabc[_0xe198('0x49')][_0xe198('0x52')]);_0x6c910f[_0xe198('0x53')]=qs[_0xe198('0x4b')](_['pick'](_0x2beabc[_0xe198('0x49')],_0xcd8035[_0xe198('0x4b')]));if(_0x2beabc['query'][_0xe198('0x54')]){_0x6c910f['where']=_['merge'](_0x6c910f[_0xe198('0x53')],{'$or':_[_0xe198('0x55')](_0x323ec6,function(_0x19035d){if(_0x19035d[_0xe198('0x47')]!==_0xe198('0x56')){var _0x3f25bf={};_0x3f25bf[_0x19035d['name']]={'$like':'%'+_0x2beabc[_0xe198('0x49')]['filter']+'%'};return _0x3f25bf;}})});}_0x6c910f=_[_0xe198('0x57')]({},_0x6c910f,_0x2beabc[_0xe198('0x58')]);var _0x4f7e7b={'where':_0x6c910f['where']};return db[_0xe198('0x44')][_0xe198('0x33')](_0x4f7e7b)[_0xe198('0x23')](function(_0x1b9484){_0x6b5b4a[_0xe198('0x33')]=_0x1b9484;if(_0x2beabc['query']['includeAll']){_0x6c910f['include']=[{'all':!![]}];}return db[_0xe198('0x44')][_0xe198('0x59')](_0x6c910f);})[_0xe198('0x23')](function(_0x3569f8){_0x6b5b4a['rows']=_0x3569f8;return _0x6b5b4a;})['then'](respondWithFilteredResult(_0x5256e9,_0x6c910f))[_0xe198('0x2e')](handleError(_0x5256e9,null));};exports[_0xe198('0x5a')]=function(_0x122668,_0x395309){var _0x3c6ddb={'raw':![],'where':{'id':_0x122668[_0xe198('0x5b')]['id']},'include':[{'model':db['MailServerIn'],'as':_0xe198('0x40')},{'model':db['MailServerOut'],'as':'Smtp'},{'model':db['Pause'],'as':_0xe198('0x5c')}]},_0x262863={};_0x262863[_0xe198('0x48')]=_[_0xe198('0x4a')](db[_0xe198('0x44')][_0xe198('0x45')]);_0x262863[_0xe198('0x49')]=_[_0xe198('0x4a')](_0x122668[_0xe198('0x49')]);_0x262863[_0xe198('0x4b')]=_[_0xe198('0x5d')](_0x262863[_0xe198('0x48')],_0x262863[_0xe198('0x49')]);_0x3c6ddb[_0xe198('0x4c')]=_[_0xe198('0x5d')](_0x262863[_0xe198('0x48')],qs[_0xe198('0x4d')](_0x122668['query'][_0xe198('0x4d')]));_0x3c6ddb[_0xe198('0x4c')]=_0x3c6ddb[_0xe198('0x4c')][_0xe198('0x4e')]?_0x3c6ddb['attributes']:_0x262863[_0xe198('0x48')];if(_0x122668[_0xe198('0x49')][_0xe198('0x5e')]){_0x3c6ddb['include']=[{'all':!![]}];}_0x3c6ddb=_['merge']({},_0x3c6ddb,_0x122668['options']);return db['MailAccount'][_0xe198('0x5f')](_0x3c6ddb)[_0xe198('0x23')](handleEntityNotFound(_0x395309,null))[_0xe198('0x23')](respondWithResult(_0x395309,null))[_0xe198('0x2e')](handleError(_0x395309,null));};exports['update']=function(_0x59f46f,_0x593f7b){if(_0x59f46f[_0xe198('0x60')]['id']){delete _0x59f46f[_0xe198('0x60')]['id'];}return db[_0xe198('0x44')]['find']({'where':{'id':_0x59f46f[_0xe198('0x5b')]['id']},'include':[{'model':db[_0xe198('0x3f')],'as':_0xe198('0x40')},{'model':db['MailServerOut'],'as':'Smtp'},{'model':db[_0xe198('0x43')],'as':'mandatoryDispositionPause'}]})['then'](handleEntityNotFound(_0x593f7b,null))['then'](saveUpdates(_0x59f46f[_0xe198('0x60')],null))['then'](function(_0x1881a6){if(_0x1881a6&&_0x59f46f['body'][_0xe198('0x40')]){return db[_0xe198('0x3f')][_0xe198('0x38')](_0x59f46f['body'][_0xe198('0x40')],{'where':{'MailAccountId':_0x1881a6['id']}})[_0xe198('0x23')](function(){return _0x1881a6;});}return _0x1881a6;})[_0xe198('0x23')](function(_0x30d922){if(_0x30d922&&_0x59f46f[_0xe198('0x60')][_0xe198('0x42')]){return db[_0xe198('0x41')][_0xe198('0x38')](_0x59f46f[_0xe198('0x60')]['Smtp'],{'where':{'MailAccountId':_0x30d922['id']}})[_0xe198('0x23')](function(){return _0x30d922;});}return _0x30d922;})['then'](respondWithResult(_0x593f7b,null))[_0xe198('0x2e')](handleError(_0x593f7b,null));};exports[_0xe198('0x61')]=function(_0x338d77,_0x23bf0c){return db[_0xe198('0x44')]['describe']()[_0xe198('0x23')](respondWithResult(_0x23bf0c,null))[_0xe198('0x2e')](handleError(_0x23bf0c,null));};exports['addDisposition']=function(_0x18e49c,_0x53524b,_0xc6fcd4){if(_0x18e49c['body']['id']){delete _0x18e49c[_0xe198('0x60')]['id'];}return db['MailAccount'][_0xe198('0x5f')]({'where':{'id':_0x18e49c[_0xe198('0x5b')]['id']}})[_0xe198('0x23')](handleEntityNotFound(_0x53524b,null))[_0xe198('0x23')](function(_0x216f4c){if(_0x216f4c){_0x18e49c[_0xe198('0x60')][_0xe198('0x62')]=_0x216f4c['id'];return db[_0xe198('0x63')][_0xe198('0x64')](_0x18e49c['body']);}})[_0xe198('0x23')](respondWithResult(_0x53524b,null))['catch'](handleError(_0x53524b,null));};exports['getDispositions']=function(_0xa26a61,_0x5e31ee,_0x46b7e6){var _0xf8937d={'raw':![],'where':{}};var _0x5abb27={};var _0xd198a3={'count':0x0,'rows':[]};return db[_0xe198('0x44')][_0xe198('0x65')]({'where':{'id':_0xa26a61[_0xe198('0x5b')]['id']}})['then'](handleEntityNotFound(_0x5e31ee,null))[_0xe198('0x23')](function(_0xbc262){if(_0xbc262){_0x5abb27[_0xe198('0x48')]=_['keys'](db[_0xe198('0x63')][_0xe198('0x45')]);_0x5abb27[_0xe198('0x49')]=_[_0xe198('0x4a')](_0xa26a61[_0xe198('0x49')]);_0x5abb27[_0xe198('0x4b')]=_[_0xe198('0x5d')](_0x5abb27['model'],_0x5abb27[_0xe198('0x49')]);_0xf8937d[_0xe198('0x4c')]=_['intersection'](_0x5abb27[_0xe198('0x48')],qs[_0xe198('0x4d')](_0xa26a61[_0xe198('0x49')][_0xe198('0x4d')]));_0xf8937d[_0xe198('0x4c')]=_0xf8937d[_0xe198('0x4c')][_0xe198('0x4e')]?_0xf8937d[_0xe198('0x4c')]:_0x5abb27['model'];if(!_0xa26a61[_0xe198('0x49')][_0xe198('0x4f')](_0xe198('0x50'))){_0xf8937d[_0xe198('0x35')]=qs['limit'](_0xa26a61[_0xe198('0x49')][_0xe198('0x35')]);_0xf8937d[_0xe198('0x34')]=qs[_0xe198('0x34')](_0xa26a61[_0xe198('0x49')]['offset']);}_0xf8937d[_0xe198('0x51')]=qs[_0xe198('0x52')](_0xa26a61[_0xe198('0x49')][_0xe198('0x52')]);_0xf8937d[_0xe198('0x53')]=qs[_0xe198('0x4b')](_[_0xe198('0x66')](_0xa26a61[_0xe198('0x49')],_0x5abb27[_0xe198('0x4b')]));_0xf8937d[_0xe198('0x53')][_0xe198('0x62')]=_0xbc262['id'];if(_0xa26a61['query']['filter']){_0xf8937d[_0xe198('0x53')]=_['merge'](_0xf8937d['where'],{'$or':_[_0xe198('0x55')](_0xf8937d['attributes'],function(_0x557d81){var _0x263a03={};_0x263a03[_0x557d81]={'$like':'%'+_0xa26a61['query']['filter']+'%'};return _0x263a03;})});}_0xf8937d=_[_0xe198('0x57')]({},_0xf8937d,_0xa26a61['options']);return db[_0xe198('0x63')][_0xe198('0x33')]({'where':_0xf8937d[_0xe198('0x53')]})[_0xe198('0x23')](function(_0x4e88c5){_0xd198a3[_0xe198('0x33')]=_0x4e88c5;if(_0xa26a61[_0xe198('0x49')][_0xe198('0x5e')]){_0xf8937d['include']=[{'all':!![]}];}return db[_0xe198('0x63')]['findAll'](_0xf8937d);})[_0xe198('0x23')](function(_0x54340b){_0xd198a3[_0xe198('0x67')]=_0x54340b;return _0xd198a3;});}})[_0xe198('0x23')](respondWithFilteredResult(_0x5e31ee,_0xf8937d))[_0xe198('0x2e')](handleError(_0x5e31ee,null));};exports[_0xe198('0x68')]=function(_0x265b30,_0x25045a,_0x466436){return db[_0xe198('0x44')][_0xe198('0x5f')]({'where':{'id':_0x265b30['params']['id']}})[_0xe198('0x23')](handleEntityNotFound(_0x25045a,null))[_0xe198('0x23')](function(_0x7a5217){if(_0x7a5217){return _0x7a5217[_0xe198('0x68')](_0x265b30['query']['ids']);}})[_0xe198('0x23')](respondWithStatusCode(_0x25045a,null))[_0xe198('0x2e')](handleError(_0x25045a,null));};exports['addAnswer']=function(_0x26d4cb,_0x14c215,_0x4cc92e){if(_0x26d4cb[_0xe198('0x60')]['id']){delete _0x26d4cb[_0xe198('0x60')]['id'];}return db[_0xe198('0x44')][_0xe198('0x5f')]({'where':{'id':_0x26d4cb[_0xe198('0x5b')]['id']}})[_0xe198('0x23')](handleEntityNotFound(_0x14c215,null))[_0xe198('0x23')](function(_0x561213){if(_0x561213){_0x26d4cb[_0xe198('0x60')]['MailAccountId']=_0x561213['id'];return db[_0xe198('0x69')]['create'](_0x26d4cb[_0xe198('0x60')]);}})['then'](respondWithResult(_0x14c215,null))['catch'](handleError(_0x14c215,null));};exports[_0xe198('0x6a')]=function(_0x5cede8,_0xbd374d,_0x70f7b0){var _0x3275c7={'raw':![],'where':{}};var _0x200416={};var _0x531fa6={'count':0x0,'rows':[]};return db['MailAccount'][_0xe198('0x65')]({'where':{'id':_0x5cede8[_0xe198('0x5b')]['id']}})['then'](handleEntityNotFound(_0xbd374d,null))[_0xe198('0x23')](function(_0x22bf45){if(_0x22bf45){_0x200416[_0xe198('0x48')]=_[_0xe198('0x4a')](db[_0xe198('0x69')][_0xe198('0x45')]);_0x200416[_0xe198('0x49')]=_['keys'](_0x5cede8[_0xe198('0x49')]);_0x200416['filters']=_['intersection'](_0x200416['model'],_0x200416[_0xe198('0x49')]);_0x3275c7['attributes']=_[_0xe198('0x5d')](_0x200416[_0xe198('0x48')],qs[_0xe198('0x4d')](_0x5cede8[_0xe198('0x49')][_0xe198('0x4d')]));_0x3275c7[_0xe198('0x4c')]=_0x3275c7['attributes']['length']?_0x3275c7[_0xe198('0x4c')]:_0x200416[_0xe198('0x48')];if(!_0x5cede8['query'][_0xe198('0x4f')](_0xe198('0x50'))){_0x3275c7[_0xe198('0x35')]=qs[_0xe198('0x35')](_0x5cede8[_0xe198('0x49')]['limit']);_0x3275c7[_0xe198('0x34')]=qs[_0xe198('0x34')](_0x5cede8['query'][_0xe198('0x34')]);}_0x3275c7[_0xe198('0x51')]=qs[_0xe198('0x52')](_0x5cede8[_0xe198('0x49')]['sort']);_0x3275c7[_0xe198('0x53')]=qs[_0xe198('0x4b')](_['pick'](_0x5cede8[_0xe198('0x49')],_0x200416['filters']));_0x3275c7[_0xe198('0x53')][_0xe198('0x62')]=_0x22bf45['id'];if(_0x5cede8[_0xe198('0x49')][_0xe198('0x54')]){_0x3275c7[_0xe198('0x53')]=_[_0xe198('0x57')](_0x3275c7['where'],{'$or':_[_0xe198('0x55')](_0x3275c7['attributes'],function(_0x32ad62){var _0x4b024={};_0x4b024[_0x32ad62]={'$like':'%'+_0x5cede8[_0xe198('0x49')][_0xe198('0x54')]+'%'};return _0x4b024;})});}_0x3275c7=_[_0xe198('0x57')]({},_0x3275c7,_0x5cede8['options']);return db['CannedAnswer'][_0xe198('0x33')]({'where':_0x3275c7[_0xe198('0x53')]})[_0xe198('0x23')](function(_0x294648){_0x531fa6['count']=_0x294648;if(_0x5cede8[_0xe198('0x49')][_0xe198('0x5e')]){_0x3275c7[_0xe198('0x6b')]=[{'all':!![]}];}return db[_0xe198('0x69')][_0xe198('0x59')](_0x3275c7);})[_0xe198('0x23')](function(_0x4a1b86){_0x531fa6[_0xe198('0x67')]=_0x4a1b86;return _0x531fa6;});}})[_0xe198('0x23')](respondWithFilteredResult(_0xbd374d,_0x3275c7))['catch'](handleError(_0xbd374d,null));};exports['removeAnswers']=function(_0x18adf7,_0x10d186,_0x274d40){return db['MailAccount'][_0xe198('0x5f')]({'where':{'id':_0x18adf7[_0xe198('0x5b')]['id']}})['then'](handleEntityNotFound(_0x10d186,null))[_0xe198('0x23')](function(_0x11d0cc){if(_0x11d0cc){return _0x11d0cc[_0xe198('0x6c')](_0x18adf7['query'][_0xe198('0x6d')]);}})[_0xe198('0x23')](respondWithStatusCode(_0x10d186,null))[_0xe198('0x2e')](handleError(_0x10d186,null));};exports['create']=function(_0x26e767,_0x136428){var _0x2998b3={'name':_0x26e767[_0xe198('0x60')][_0xe198('0x3e')],'key':_0x26e767[_0xe198('0x60')]['key'],'email':_0x26e767[_0xe198('0x60')]['email'],'ListId':_0x26e767[_0xe198('0x60')]['ListId'],'active':!_['isNil'](_0x26e767['body'][_0xe198('0x6e')])?_0x26e767[_0xe198('0x60')][_0xe198('0x6e')]:!![],'description':_0x26e767[_0xe198('0x60')][_0xe198('0x6f')]||null,'Imap':{},'Smtp':{}};if(_[_0xe198('0x70')](_0x26e767[_0xe198('0x60')][_0xe198('0x71')])){if(_0x26e767[_0xe198('0x60')][_0xe198('0x72')]){_0x2998b3['Imap']['user']=_0x2998b3[_0xe198('0x42')][_0xe198('0x73')]=_0x26e767[_0xe198('0x60')][_0xe198('0x74')];_0x2998b3[_0xe198('0x40')][_0xe198('0x75')]=_0x2998b3[_0xe198('0x42')]['pass']=_0x26e767[_0xe198('0x60')][_0xe198('0x76')];}else{_0x2998b3[_0xe198('0x40')][_0xe198('0x77')]=_0x2998b3[_0xe198('0x42')][_0xe198('0x77')]=![];}_0x2998b3[_0xe198('0x40')]['host']=_0x26e767['body'][_0xe198('0x40')][_0xe198('0x78')];_0x2998b3[_0xe198('0x40')][_0xe198('0x79')]=_0x26e767[_0xe198('0x60')][_0xe198('0x40')][_0xe198('0x79')];_0x2998b3[_0xe198('0x42')][_0xe198('0x78')]=_0x26e767['body'][_0xe198('0x42')]['host'];_0x2998b3[_0xe198('0x42')][_0xe198('0x79')]=_0x26e767[_0xe198('0x60')][_0xe198('0x42')][_0xe198('0x79')];}else{_0x2998b3['Imap'][_0xe198('0x7a')]=_0x2998b3[_0xe198('0x42')][_0xe198('0x7a')]=_0x26e767[_0xe198('0x60')][_0xe198('0x71')];_0x2998b3['Imap'][_0xe198('0x73')]=_0x2998b3[_0xe198('0x42')][_0xe198('0x73')]=_0x26e767[_0xe198('0x60')][_0xe198('0x74')];_0x2998b3[_0xe198('0x40')][_0xe198('0x75')]=_0x2998b3[_0xe198('0x42')][_0xe198('0x7b')]=_0x26e767[_0xe198('0x60')]['cpassword'];}return db[_0xe198('0x44')][_0xe198('0x64')](_0x2998b3,{'include':[{'model':db[_0xe198('0x41')],'as':_0xe198('0x42')},{'model':db[_0xe198('0x3f')],'as':_0xe198('0x40')}]})[_0xe198('0x23')](function(_0x12e13c){var _0xf2f606=_0x26e767[_0xe198('0x73')][_0xe198('0x39')]({'plain':!![]});if(!_0xf2f606)throw new Error(_0xe198('0x7c'));if(_0xf2f606[_0xe198('0x7d')]===_0xe198('0x73')){var _0x5e7270=_0x12e13c[_0xe198('0x39')]({'plain':!![]});return db[_0xe198('0x7e')][_0xe198('0x5f')]({'where':{'name':_0xe198('0x3a'),'userProfileId':_0xf2f606[_0xe198('0x7f')]},'raw':!![]})[_0xe198('0x23')](function(_0x799108){if(_0x799108&&_0x799108['autoAssociation']===0x0){return db[_0xe198('0x3b')][_0xe198('0x64')]({'name':_0x5e7270[_0xe198('0x3e')],'resourceId':_0x5e7270['id'],'type':_0x799108['name'],'sectionId':_0x799108['id']},{})[_0xe198('0x23')](function(){return _0x12e13c;});}else{return _0x12e13c;}})[_0xe198('0x2e')](function(_0x5744c1){logger[_0xe198('0x29')](_0xe198('0x80'),_0x5744c1);throw _0x5744c1;});}return _0x12e13c;})[_0xe198('0x23')](respondWithResult(_0x136428,0xc9))['catch'](handleError(_0x136428,null));};exports['getImap']=function(_0xd34570,_0x537d91,_0x56d217){return db[_0xe198('0x44')][_0xe198('0x65')]({'where':{'id':_0xd34570['params']['id']}})[_0xe198('0x23')](handleEntityNotFound(_0x537d91,null))[_0xe198('0x23')](function(_0x432d01){if(_0x432d01){return _0x432d01[_0xe198('0x81')]();}return null;})[_0xe198('0x23')](respondWithResult(_0x537d91,null))['catch'](handleError(_0x537d91,null));};exports['addImap']=function(_0x2a4538,_0x19b20f,_0x304bb8){if(_0x2a4538[_0xe198('0x60')]['id']){delete _0x2a4538[_0xe198('0x60')]['id'];}return db['MailAccount']['find']({'where':{'id':_0x2a4538[_0xe198('0x5b')]['id']}})['then'](handleEntityNotFound(_0x19b20f,null))[_0xe198('0x23')](function(_0x1ac7a1){if(_0x1ac7a1){_0x2a4538[_0xe198('0x60')]['MailAccountId']=_0x1ac7a1['id'];return db['MailServerIn'][_0xe198('0x64')](_0x2a4538[_0xe198('0x60')]);}})[_0xe198('0x23')](respondWithResult(_0x19b20f,null))[_0xe198('0x2e')](handleError(_0x19b20f,null));};exports[_0xe198('0x82')]=function(_0x328e27,_0x1e9c5a,_0x30b9bb){return db[_0xe198('0x44')]['findOne']({'where':{'id':_0x328e27[_0xe198('0x5b')]['id']}})[_0xe198('0x23')](handleEntityNotFound(_0x1e9c5a,null))[_0xe198('0x23')](function(_0x4ed487){if(_0x4ed487){return _0x4ed487[_0xe198('0x83')](null);}return null;})[_0xe198('0x23')](respondWithStatusCode(_0x1e9c5a,null))['catch'](handleError(_0x1e9c5a,null));};exports[_0xe198('0x84')]=function(_0x55cb58,_0x436349,_0x398cdd){return db[_0xe198('0x44')][_0xe198('0x65')]({'where':{'id':_0x55cb58[_0xe198('0x5b')]['id']}})['then'](handleEntityNotFound(_0x436349,null))[_0xe198('0x23')](function(_0x447f55){if(_0x447f55){return _0x447f55[_0xe198('0x84')]();}return null;})[_0xe198('0x23')](respondWithResult(_0x436349,null))['catch'](handleError(_0x436349,null));};exports['addSmtp']=function(_0x58c8c8,_0x496d52,_0x14d97d){if(_0x58c8c8[_0xe198('0x60')]['id']){delete _0x58c8c8[_0xe198('0x60')]['id'];}return db[_0xe198('0x44')][_0xe198('0x5f')]({'where':{'id':_0x58c8c8[_0xe198('0x5b')]['id']}})[_0xe198('0x23')](handleEntityNotFound(_0x496d52,null))['then'](function(_0x35a0c1){if(_0x35a0c1){_0x58c8c8[_0xe198('0x60')][_0xe198('0x62')]=_0x35a0c1['id'];return db[_0xe198('0x41')]['create'](_0x58c8c8[_0xe198('0x60')]);}})[_0xe198('0x23')](respondWithResult(_0x496d52,null))['catch'](handleError(_0x496d52,null));};exports[_0xe198('0x85')]=function(_0x4d1937,_0x49f2f1,_0x50ab00){return db[_0xe198('0x44')][_0xe198('0x65')]({'where':{'id':_0x4d1937[_0xe198('0x5b')]['id']}})['then'](handleEntityNotFound(_0x49f2f1,null))[_0xe198('0x23')](function(_0x2627f7){if(_0x2627f7){return _0x2627f7['setSmtp'](null);}return null;})[_0xe198('0x23')](respondWithStatusCode(_0x49f2f1,null))[_0xe198('0x2e')](handleError(_0x49f2f1,null));};exports[_0xe198('0x86')]=function(_0x10593b,_0x5f2bd3,_0x12e340){return db[_0xe198('0x87')]['find']({'where':{'id':_0x10593b[_0xe198('0x5b')]['id']}})[_0xe198('0x23')](handleEntityNotFound(_0x5f2bd3,null))[_0xe198('0x23')](function(_0x18ba50){if(_0x18ba50){return _0x18ba50[_0xe198('0x86')](_0x10593b['body'][_0xe198('0x6d')],_['omit'](_0x10593b[_0xe198('0x60')],[_0xe198('0x6d'),'id'])||{});}})[_0xe198('0x23')](respondWithResult(_0x5f2bd3,null))[_0xe198('0x2e')](handleError(_0x5f2bd3,null));};exports[_0xe198('0x88')]=function(_0x31d55c,_0x4ab89a,_0x8e9b5a){var _0x5495f6={'raw':![],'where':{}};var _0x3dd733={};var _0x43e952={'count':0x0,'rows':[]};return db[_0xe198('0x44')][_0xe198('0x65')]({'where':{'id':_0x31d55c[_0xe198('0x5b')]['id']}})[_0xe198('0x23')](handleEntityNotFound(_0x4ab89a,null))[_0xe198('0x23')](function(_0x19dd63){if(_0x19dd63){_0x3dd733[_0xe198('0x48')]=_[_0xe198('0x4a')](db['MailInteraction']['rawAttributes']);_0x3dd733['query']=_[_0xe198('0x4a')](_0x31d55c[_0xe198('0x49')]);_0x3dd733[_0xe198('0x4b')]=_[_0xe198('0x5d')](_0x3dd733['model'],_0x3dd733[_0xe198('0x49')]);_0x5495f6['attributes']=_[_0xe198('0x5d')](_0x3dd733['model'],qs[_0xe198('0x4d')](_0x31d55c[_0xe198('0x49')][_0xe198('0x4d')]));_0x5495f6[_0xe198('0x4c')]=_0x5495f6[_0xe198('0x4c')][_0xe198('0x4e')]?_0x5495f6[_0xe198('0x4c')]:_0x3dd733['model'];if(!_0x31d55c['query']['hasOwnProperty']('nolimit')){_0x5495f6['limit']=qs[_0xe198('0x35')](_0x31d55c[_0xe198('0x49')][_0xe198('0x35')]);_0x5495f6[_0xe198('0x34')]=qs[_0xe198('0x34')](_0x31d55c[_0xe198('0x49')][_0xe198('0x34')]);}_0x5495f6['order']=qs['sort'](_0x31d55c[_0xe198('0x49')]['sort']);_0x5495f6['where']=qs[_0xe198('0x4b')](_[_0xe198('0x66')](_0x31d55c[_0xe198('0x49')],_0x3dd733[_0xe198('0x4b')]));_0x5495f6[_0xe198('0x53')][_0xe198('0x62')]=_0x19dd63['id'];if(_0x31d55c['query'][_0xe198('0x54')]){_0x5495f6[_0xe198('0x53')]=_[_0xe198('0x57')](_0x5495f6[_0xe198('0x53')],{'$or':_['map'](_0x5495f6[_0xe198('0x4c')],function(_0x137e40){var _0x601f23={};_0x601f23[_0x137e40]={'$like':'%'+_0x31d55c['query'][_0xe198('0x54')]+'%'};return _0x601f23;})});}_0x5495f6=_['merge']({},_0x5495f6,_0x31d55c[_0xe198('0x58')]);return db[_0xe198('0x87')][_0xe198('0x33')]({'where':_0x5495f6[_0xe198('0x53')]})[_0xe198('0x23')](function(_0x2cea56){_0x43e952['count']=_0x2cea56;if(_0x31d55c[_0xe198('0x49')][_0xe198('0x5e')]){_0x5495f6[_0xe198('0x6b')]=[{'model':db['CmContact'],'as':'Contact','required':![]},{'model':db[_0xe198('0x89')],'as':'Owner','attributes':['name',_0xe198('0x8a'),_0xe198('0x8b')],'required':![]},{'model':db[_0xe198('0x8c')],'as':_0xe198('0x8d'),'attributes':['id','name',_0xe198('0x8e')],'where':_0x31d55c[_0xe198('0x49')][_0xe198('0x8f')]?{'id':_0x31d55c['query'][_0xe198('0x8f')]}:undefined,'required':_0x31d55c['query']['tag']?!![]:![]}];}return db[_0xe198('0x87')][_0xe198('0x59')](_0x5495f6);})[_0xe198('0x23')](function(_0x172fbf){_0x43e952[_0xe198('0x67')]=_0x172fbf;return _0x43e952;});}})[_0xe198('0x23')](respondWithFilteredResult(_0x4ab89a,_0x5495f6))[_0xe198('0x2e')](handleError(_0x4ab89a,null));};exports['addApplications']=function(_0x2cdf42,_0x1a527c,_0x3b3317){return db[_0xe198('0x44')][_0xe198('0x65')]({'where':{'id':_0x2cdf42[_0xe198('0x5b')]['id']}})[_0xe198('0x23')](handleEntityNotFound(_0x1a527c,null))[_0xe198('0x23')](function(_0x70f460){if(_0x70f460){return db[_0xe198('0x90')][_0xe198('0x91')](function(_0x1bb88b){return db[_0xe198('0x92')][_0xe198('0x3c')]({'where':{'MailAccountId':_0x2cdf42[_0xe198('0x5b')]['id']},'transaction':_0x1bb88b})['then'](function(_0x2ab4dc){var _0x5d2a4a=_['map'](_0x2cdf42[_0xe198('0x60')],function(_0x2594bb){_0x2594bb[_0xe198('0x62')]=_0x2cdf42[_0xe198('0x5b')]['id'];return _0x2594bb;});return db[_0xe198('0x92')][_0xe198('0x93')](_0x5d2a4a,{'transaction':_0x1bb88b});});})[_0xe198('0x23')](function(){return db[_0xe198('0x92')][_0xe198('0x94')]({'where':{'MailAccountId':_0x2cdf42[_0xe198('0x5b')]['id']},'order':_0xe198('0x95')});});}})['then'](respondWithResult(_0x1a527c,null))[_0xe198('0x2e')](handleError(_0x1a527c,null));};exports[_0xe198('0x96')]=function(_0x383135,_0x46c8cc,_0xfeeeef){var _0x261476={};var _0x5b7983={};var _0x45a329;var _0x108372;return db[_0xe198('0x44')][_0xe198('0x65')]({'where':{'id':_0x383135[_0xe198('0x5b')]['id']}})[_0xe198('0x23')](handleEntityNotFound(_0x46c8cc,null))[_0xe198('0x23')](function(_0x15e3ec){if(_0x15e3ec){_0x45a329=_0x15e3ec;_0x5b7983[_0xe198('0x48')]=_['keys'](db['MailApplication'][_0xe198('0x45')]);_0x5b7983[_0xe198('0x49')]=_[_0xe198('0x4a')](_0x383135[_0xe198('0x49')]);_0x5b7983['filters']=_[_0xe198('0x5d')](_0x5b7983[_0xe198('0x48')],_0x5b7983[_0xe198('0x49')]);_0x261476['attributes']=_[_0xe198('0x5d')](_0x5b7983['model'],qs[_0xe198('0x4d')](_0x383135[_0xe198('0x49')]['fields']));_0x261476[_0xe198('0x4c')]=_0x261476[_0xe198('0x4c')][_0xe198('0x4e')]?_0x261476['attributes']:_0x5b7983[_0xe198('0x48')];_0x261476[_0xe198('0x51')]=qs['sort'](_0x383135['query'][_0xe198('0x52')]);_0x261476[_0xe198('0x53')]=qs[_0xe198('0x4b')](_['pick'](_0x383135[_0xe198('0x49')],_0x5b7983['filters']));if(_0x383135[_0xe198('0x49')][_0xe198('0x54')]){_0x261476[_0xe198('0x53')]=_[_0xe198('0x57')](_0x261476[_0xe198('0x53')],{'$or':_[_0xe198('0x55')](_0x261476[_0xe198('0x4c')],function(_0x28546d){var _0x5903d2={};_0x5903d2[_0x28546d]={'$like':'%'+_0x383135[_0xe198('0x49')][_0xe198('0x54')]+'%'};return _0x5903d2;})});}_0x261476=_['merge']({},_0x261476,_0x383135[_0xe198('0x58')]);return _0x45a329['getApplications'](_0x261476);}})[_0xe198('0x23')](function(_0x1295b7){if(_0x1295b7){_0x108372=_0x1295b7[_0xe198('0x4e')];if(!_0x383135[_0xe198('0x49')][_0xe198('0x4f')](_0xe198('0x50'))){_0x261476['limit']=qs['limit'](_0x383135['query'][_0xe198('0x35')]);_0x261476[_0xe198('0x34')]=qs[_0xe198('0x34')](_0x383135['query'][_0xe198('0x34')]);}return _0x45a329[_0xe198('0x96')](_0x261476);}})[_0xe198('0x23')](function(_0x1e7905){if(_0x1e7905){return _0x1e7905?{'count':_0x108372,'rows':_0x1e7905}:null;}})[_0xe198('0x23')](respondWithResult(_0x46c8cc,null))[_0xe198('0x2e')](handleError(_0x46c8cc,null));};exports[_0xe198('0x97')]=function(_0x5e243d,_0x33bba4,_0x1c739e){var _0x4a1249={'raw':!![],'where':{}};var _0x3a9293={};var _0x325d98={'count':0x0,'rows':[]};return db[_0xe198('0x44')]['findOne']({'where':{'id':_0x5e243d[_0xe198('0x5b')]['id']}})[_0xe198('0x23')](handleEntityNotFound(_0x33bba4,null))['then'](function(_0x3d98e8){if(_0x3d98e8){_0x3a9293[_0xe198('0x48')]=_[_0xe198('0x4a')](db[_0xe198('0x98')]['rawAttributes']);_0x3a9293[_0xe198('0x49')]=_[_0xe198('0x4a')](_0x5e243d[_0xe198('0x49')]);_0x3a9293['filters']=_['intersection'](_0x3a9293[_0xe198('0x48')],_0x3a9293[_0xe198('0x49')]);_0x4a1249[_0xe198('0x4c')]=_[_0xe198('0x5d')](_0x3a9293[_0xe198('0x48')],qs['fields'](_0x5e243d[_0xe198('0x49')][_0xe198('0x4d')]));_0x4a1249['attributes']=_0x4a1249[_0xe198('0x4c')][_0xe198('0x4e')]?_0x4a1249[_0xe198('0x4c')]:_0x3a9293['model'];if(!_0x5e243d[_0xe198('0x49')][_0xe198('0x4f')](_0xe198('0x50'))){_0x4a1249[_0xe198('0x35')]=qs[_0xe198('0x35')](_0x5e243d['query']['limit']);_0x4a1249[_0xe198('0x34')]=qs['offset'](_0x5e243d['query'][_0xe198('0x34')]);}_0x4a1249[_0xe198('0x51')]=qs[_0xe198('0x52')](_0x5e243d['query'][_0xe198('0x52')]);_0x4a1249['where']=qs['filters'](_[_0xe198('0x66')](_0x5e243d[_0xe198('0x49')],_0x3a9293['filters']));_0x4a1249[_0xe198('0x53')][_0xe198('0x62')]=_0x3d98e8['id'];if(_0x5e243d[_0xe198('0x49')]['filter']){_0x4a1249[_0xe198('0x53')]=_['merge'](_0x4a1249['where'],{'$or':_[_0xe198('0x55')](_0x4a1249[_0xe198('0x4c')],function(_0x410fd1){var _0x39839a={};_0x39839a[_0x410fd1]={'$like':'%'+_0x5e243d[_0xe198('0x49')][_0xe198('0x54')]+'%'};return _0x39839a;})});}if(_0x5e243d[_0xe198('0x49')][_0xe198('0x99')]){var _0x1a33fb=_0x5e243d['query']['$gte'][_0xe198('0x9a')](',');var _0x4a136a={};_0x4a136a[_0x1a33fb[0x0]]={'$gte':moment(_0x1a33fb[0x1])[_0xe198('0x9b')]('YYYY-MM-DD\x20HH:mm:ss')};_0x4a1249['where']=_[_0xe198('0x57')](_0x4a1249[_0xe198('0x53')],_0x4a136a);}_0x4a1249=_[_0xe198('0x57')]({},_0x4a1249,_0x5e243d[_0xe198('0x58')]);return db['MailMessage']['count']({'where':_0x4a1249[_0xe198('0x53')]})[_0xe198('0x23')](function(_0x29fe97){_0x325d98[_0xe198('0x33')]=_0x29fe97;if(_0x5e243d['query'][_0xe198('0x5e')]){_0x4a1249[_0xe198('0x6b')]=[{'all':!![]}];}return db[_0xe198('0x98')][_0xe198('0x59')](_0x4a1249);})['then'](function(_0x50ece6){_0x325d98[_0xe198('0x67')]=_0x50ece6;return _0x325d98;});}})['then'](respondWithFilteredResult(_0x33bba4,_0x4a1249))[_0xe198('0x2e')](handleError(_0x33bba4,null));};exports[_0xe198('0x9c')]=function(_0x189cd1,_0x49f389,_0x241a46){var _0x3a4b7a,_0x52f3a3={},_0x201c67;if(_0x189cd1[_0xe198('0x60')]['to']){_0x201c67=_0x189cd1[_0xe198('0x60')]['to'][_0xe198('0x9a')](',')[0x0];}return db[_0xe198('0x44')][_0xe198('0x5f')]({'where':{'id':_0x189cd1['params']['id']},'include':[{'model':db[_0xe198('0x9d')],'as':_0xe198('0x9e'),'include':[{'model':db[_0xe198('0x9f')],'as':_0xe198('0xa0'),'where':{'email':_0x201c67},'limit':0x1,'order':[[_0xe198('0xa1'),_0xe198('0xa2')]]}]},{'model':db['MailServerOut'],'as':_0xe198('0x42'),'raw':!![]}]})['then'](handleEntityNotFound(_0x49f389,null))[_0xe198('0x23')](function(_0x37bcd3){if(_0x37bcd3){_0x3a4b7a=_0x37bcd3;if(_0x37bcd3[_0xe198('0x42')]){if(_[_0xe198('0x70')](_0x189cd1[_0xe198('0x60')][_0xe198('0xa3')])){_0x189cd1[_0xe198('0x60')][_0xe198('0xa3')]=util['format'](_0xe198('0xa4'),_0x37bcd3[_0xe198('0x3e')],_0x37bcd3[_0xe198('0xa5')]||_0x37bcd3[_0xe198('0x42')][_0xe198('0x73')]);}if(_0x189cd1['body']['attachments']&&_0x189cd1['body'][_0xe198('0xa6')][_0xe198('0x4e')]){for(var _0x23b3c9=0x0;_0x23b3c9<_0x189cd1[_0xe198('0x60')]['attachments'][_0xe198('0x4e')];_0x23b3c9+=0x1){_0x189cd1[_0xe198('0x60')][_0xe198('0xa6')][_0x23b3c9]={'filename':_0x189cd1[_0xe198('0x60')][_0xe198('0xa6')][_0x23b3c9][_0xe198('0x3e')],'path':path[_0xe198('0xa7')](config['root'],'server/files/attachments',_0x189cd1[_0xe198('0x60')][_0xe198('0xa6')][_0x23b3c9][_0xe198('0xa8')])};}}var _0x29643c={'tls':{'rejectUnauthorized':![]}};if(_[_0xe198('0x70')](_0x37bcd3[_0xe198('0x42')][_0xe198('0x7a')])){if(_0x37bcd3['Smtp']['authentication']){_0x29643c['auth']={'user':_0x37bcd3[_0xe198('0x42')]['user'],'pass':_0x37bcd3[_0xe198('0x42')][_0xe198('0x7b')]};}_0x29643c['host']=_0x37bcd3['Smtp'][_0xe198('0x78')];_0x29643c[_0xe198('0x79')]=_0x37bcd3[_0xe198('0x42')][_0xe198('0x79')];_0x29643c['secure']=_0x37bcd3[_0xe198('0x42')][_0xe198('0xa9')];}else{_0x29643c[_0xe198('0x7a')]=_0x37bcd3['Smtp']['service'];_0x29643c[_0xe198('0xaa')]={'user':_0x37bcd3['Smtp'][_0xe198('0x73')],'pass':_0x37bcd3['Smtp'][_0xe198('0x7b')]};}return respondWithRpcPromise('SendMail','sendMail',{'account':_0x29643c,'message':_0x189cd1[_0xe198('0x60')]});}else{throw new Error('List\x20not\x20found');}}})[_0xe198('0x23')](function(_0x31f3f1){if(_0x31f3f1){_0x52f3a3=_0x31f3f1;if(_0x3a4b7a[_0xe198('0x9e')]){if(_0x3a4b7a[_0xe198('0x9e')][_0xe198('0xa0')][_0xe198('0x4e')]){return _0x3a4b7a[_0xe198('0x9e')][_0xe198('0xa0')][0x0];}else{return db[_0xe198('0x9f')][_0xe198('0x64')](_[_0xe198('0x18')](_0x189cd1[_0xe198('0x60')],{'firstName':_0x189cd1[_0xe198('0x60')]['to'],'email':_0x189cd1[_0xe198('0x60')]['to'],'phone':_0x189cd1[_0xe198('0x60')]['to'],'ListId':_0x3a4b7a[_0xe198('0xab')]}));}}else{throw new Error(_0xe198('0xac'));}}})[_0xe198('0x23')](function(_0x3e092d){if(_0x3e092d){var _0x2fe1e8={'UserId':_0x189cd1[_0xe198('0x73')]['id'],'ContactId':_0x3e092d['id'],'MailAccountId':_0x3a4b7a['id'],'inReplyTo':_0x52f3a3[_0xe198('0xad')],'to':_0x189cd1[_0xe198('0x60')][_0xe198('0xa3')],'cc':_0x189cd1[_0xe198('0x60')]['cc'],'subject':_0x189cd1[_0xe198('0x60')][_0xe198('0xae')],'attach':_0x189cd1[_0xe198('0x60')][_0xe198('0xaf')],'firstMsgDirection':_0xe198('0xb0'),'lastMsgAt':moment()[_0xe198('0x9b')](_0xe198('0xb1')),'lastMsgDirection':_0xe198('0xb0'),'lastMsgBody':_0x189cd1['body'][_0xe198('0x60')],'Messages':[_[_0xe198('0x57')](_0x189cd1['body'],{'messageId':_0x52f3a3[_0xe198('0xad')],'sentAt':moment()[_0xe198('0x9b')](_0xe198('0xb1')),'read':!![],'MailAccountId':_0x3a4b7a['id'],'UserId':_0x189cd1['user']['id'],'ContactId':_0x3e092d['id']})]};if(_0x189cd1[_0xe198('0x60')][_0xe198('0xb2')]){_0x2fe1e8=_[_0xe198('0x57')](_0x2fe1e8,_0x189cd1['body'][_0xe198('0xb2')]);}return db[_0xe198('0x87')][_0xe198('0x64')](_0x2fe1e8,{'include':[{'model':db[_0xe198('0x98')],'as':'Messages'}]});}})[_0xe198('0x23')](respondWithResult(_0x49f389,null))[_0xe198('0x2e')](handleError(_0x49f389,null));};exports[_0xe198('0xb3')]=function(_0x476258,_0xc21869,_0x10496e){return db[_0xe198('0x44')][_0xe198('0x5f')]({'where':{'id':_0x476258[_0xe198('0x5b')]['id']},'include':[{'model':db[_0xe198('0x41')],'as':'Smtp','raw':!![]}]})[_0xe198('0x23')](handleEntityNotFound(_0xc21869,null))[_0xe198('0x23')](function(_0x42da5d){if(_0x42da5d&&_0x42da5d['Smtp']){var _0x2e3446={'id':_0x42da5d['id'],'tls':{'rejectUnauthorized':![]}};if(_0x42da5d['Smtp'][_0xe198('0x7a')]){_0x2e3446[_0xe198('0x7a')]=_0x42da5d[_0xe198('0x42')]['service'];}else{_0x2e3446[_0xe198('0x78')]=_0x42da5d[_0xe198('0x42')]['host'];_0x2e3446[_0xe198('0x79')]=_0x42da5d['Smtp'][_0xe198('0x79')];_0x2e3446['secure']=_0x42da5d['Smtp']['secure'];}if(_0x42da5d[_0xe198('0x42')][_0xe198('0x77')]){_0x2e3446['auth']={'user':_0x42da5d['Smtp'][_0xe198('0x73')],'pass':_0x42da5d[_0xe198('0x42')]['pass']};}return respondWithRpcPromise(_0xe198('0xb4'),_0xe198('0xb3'),{'account':_0x2e3446});}})[_0xe198('0x23')](respondWithResult(_0xc21869,null))[_0xe198('0x2e')](handleError(_0xc21869,null));};exports[_0xe198('0x3c')]=function(_0x28140a,_0x3ba484){return db[_0xe198('0x44')][_0xe198('0x5f')]({'where':{'id':_0x28140a[_0xe198('0x5b')]['id']}})[_0xe198('0x23')](handleEntityNotFound(_0x3ba484,null))[_0xe198('0x23')](function(_0x3bb7e8){if(_0x3bb7e8&&_0x3bb7e8[_0xe198('0x7a')]){throw new db['Sequelize'][(_0xe198('0x21'))]('You\x20can\x27t\x20remove\x20the\x20mail\x20service\x20account');}return _0x3bb7e8;})[_0xe198('0x23')](removeEntity(_0x3ba484,null))[_0xe198('0x2e')](handleError(_0x3ba484,null));};exports[_0xe198('0xb5')]=function(_0x3ad50a,_0x440563,_0x2c6b27){return db['MailAccount'][_0xe198('0x5f')]({'where':{'id':_0x3ad50a[_0xe198('0x5b')]['id']}})[_0xe198('0x23')](handleEntityNotFound(_0x440563,null))[_0xe198('0x23')](function(_0x595bba){if(_0x595bba){return _0x595bba[_0xe198('0xb5')](_0x3ad50a['body'][_0xe198('0x6d')],_[_0xe198('0xb6')](_0x3ad50a[_0xe198('0x60')],['ids','id'])||{})[_0xe198('0xb7')](function(_0x2bd411){for(var _0x2631f5=0x0;_0x2631f5<_0x3ad50a[_0xe198('0x60')][_0xe198('0x6d')][_0xe198('0x4e')];_0x2631f5+=0x1){socket[_0xe198('0xb8')](_0xe198('0xb9'),{'UserId':_0x3ad50a[_0xe198('0x60')]['ids'][_0x2631f5],'MailAccountId':_0x3ad50a[_0xe198('0x5b')]['id']});}return _0x2bd411;});}})['then'](respondWithResult(_0x440563,null))[_0xe198('0x2e')](handleError(_0x440563,null));};exports[_0xe198('0xba')]=function(_0x59c55d,_0x271e0b,_0x45112e){return db[_0xe198('0x44')][_0xe198('0x5f')]({'where':{'id':_0x59c55d['params']['id']}})['then'](handleEntityNotFound(_0x271e0b,null))[_0xe198('0x23')](function(_0x11e2f6){if(_0x11e2f6){return _0x11e2f6[_0xe198('0xba')](_0x59c55d[_0xe198('0x49')]['ids'])[_0xe198('0x23')](function(){if(_[_0xe198('0xbb')](_0x59c55d['query'][_0xe198('0x6d')])){for(var _0x510234=0x0;_0x510234<_0x59c55d[_0xe198('0x49')]['ids'][_0xe198('0x4e')];_0x510234+=0x1){socket['emit'](_0xe198('0xbc'),{'UserId':Number(_0x59c55d[_0xe198('0x49')][_0xe198('0x6d')][_0x510234]),'MailAccountId':Number(_0x59c55d['params']['id'])});}}else{socket[_0xe198('0xb8')](_0xe198('0xbc'),{'UserId':Number(_0x59c55d['query'][_0xe198('0x6d')]),'MailAccountId':Number(_0x59c55d[_0xe198('0x5b')]['id'])});}});}})[_0xe198('0x23')](respondWithStatusCode(_0x271e0b,null))[_0xe198('0x2e')](handleError(_0x271e0b,null));};exports['getAgents']=function(_0x1e7d6b,_0x369554,_0x19c5be){var _0x590929={};var _0x461458={};var _0x771a82;var _0x58cb18;return db[_0xe198('0x44')][_0xe198('0x65')]({'where':{'id':_0x1e7d6b[_0xe198('0x5b')]['id']}})['then'](handleEntityNotFound(_0x369554,null))[_0xe198('0x23')](function(_0x163319){if(_0x163319){_0x771a82=_0x163319;_0x461458['model']=_[_0xe198('0x4a')](db[_0xe198('0x89')][_0xe198('0x45')]);_0x461458[_0xe198('0x49')]=_['keys'](_0x1e7d6b['query']);_0x461458[_0xe198('0x4b')]=_[_0xe198('0x5d')](_0x461458['model'],_0x461458['query']);_0x590929['attributes']=_[_0xe198('0x5d')](_0x461458[_0xe198('0x48')],qs[_0xe198('0x4d')](_0x1e7d6b[_0xe198('0x49')][_0xe198('0x4d')]));_0x590929[_0xe198('0x4c')]=_0x590929[_0xe198('0x4c')]['length']?_0x590929[_0xe198('0x4c')]:_0x461458[_0xe198('0x48')];_0x590929['order']=qs[_0xe198('0x52')](_0x1e7d6b[_0xe198('0x49')][_0xe198('0x52')]);_0x590929[_0xe198('0x53')]=qs[_0xe198('0x4b')](_[_0xe198('0x66')](_0x1e7d6b[_0xe198('0x49')],_0x461458[_0xe198('0x4b')]));if(_0x1e7d6b[_0xe198('0x49')][_0xe198('0x54')]){_0x590929['where']=_[_0xe198('0x57')](_0x590929[_0xe198('0x53')],{'$or':_[_0xe198('0x55')](_0x590929[_0xe198('0x4c')],function(_0x26655d){var _0x57023a={};_0x57023a[_0x26655d]={'$like':'%'+_0x1e7d6b[_0xe198('0x49')]['filter']+'%'};return _0x57023a;})});}_0x590929=_[_0xe198('0x57')]({},_0x590929,_0x1e7d6b[_0xe198('0x58')]);return _0x771a82[_0xe198('0xbd')](_0x590929);}})['then'](function(_0x1a33ba){if(_0x1a33ba){_0x58cb18=_0x1a33ba[_0xe198('0x4e')];if(!_0x1e7d6b[_0xe198('0x49')][_0xe198('0x4f')](_0xe198('0x50'))){_0x590929[_0xe198('0x35')]=qs['limit'](_0x1e7d6b[_0xe198('0x49')]['limit']);_0x590929['offset']=qs[_0xe198('0x34')](_0x1e7d6b[_0xe198('0x49')][_0xe198('0x34')]);}return _0x771a82[_0xe198('0xbd')](_0x590929);}})['then'](function(_0x3679f8){if(_0x3679f8){return _0x3679f8?{'count':_0x58cb18,'rows':_0x3679f8}:null;}})['then'](respondWithResult(_0x369554,null))[_0xe198('0x2e')](handleError(_0x369554,null));}; \ No newline at end of file diff --git a/server/api/mailAccount/mailAccount.events.js b/server/api/mailAccount/mailAccount.events.js index 27a9354..216e999 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 _0xd8f0=['emit','hook','../../mysqldb','MailAccount','setMaxListeners','save','update','remove'];(function(_0x5f12fd,_0x33c70d){var _0x58bd80=function(_0x515f56){while(--_0x515f56){_0x5f12fd['push'](_0x5f12fd['shift']());}};_0x58bd80(++_0x33c70d);}(_0xd8f0,0xaa));var _0x0d8f=function(_0x4de958,_0x5b760e){_0x4de958=_0x4de958-0x0;var _0x6c13ff=_0xd8f0[_0x4de958];return _0x6c13ff;};'use strict';var EventEmitter=require('events');var MailAccount=require(_0x0d8f('0x0'))['db'][_0x0d8f('0x1')];var MailAccountEvents=new EventEmitter();MailAccountEvents[_0x0d8f('0x2')](0x0);var events={'afterCreate':_0x0d8f('0x3'),'afterUpdate':_0x0d8f('0x4'),'afterDestroy':_0x0d8f('0x5')};function emitEvent(_0x3d5efe){return function(_0x1d5965,_0x14a982,_0x11a63d){MailAccountEvents[_0x0d8f('0x6')](_0x3d5efe+':'+_0x1d5965['id'],_0x1d5965);MailAccountEvents[_0x0d8f('0x6')](_0x3d5efe,_0x1d5965);_0x11a63d(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];MailAccount[_0x0d8f('0x7')](e,emitEvent(event));}}module['exports']=MailAccountEvents; \ No newline at end of file +var _0x8fb3=['../../mysqldb','setMaxListeners','save','update','remove','emit','hasOwnProperty','exports'];(function(_0x329d13,_0x1aff27){var _0x33efd9=function(_0x265b7d){while(--_0x265b7d){_0x329d13['push'](_0x329d13['shift']());}};_0x33efd9(++_0x1aff27);}(_0x8fb3,0x128));var _0x38fb=function(_0x3218e2,_0x51b6b1){_0x3218e2=_0x3218e2-0x0;var _0x11d7c6=_0x8fb3[_0x3218e2];return _0x11d7c6;};'use strict';var EventEmitter=require('events');var MailAccount=require(_0x38fb('0x0'))['db']['MailAccount'];var MailAccountEvents=new EventEmitter();MailAccountEvents[_0x38fb('0x1')](0x0);var events={'afterCreate':_0x38fb('0x2'),'afterUpdate':_0x38fb('0x3'),'afterDestroy':_0x38fb('0x4')};function emitEvent(_0x3c2df6){return function(_0x18a79e,_0x4b0ccc,_0xa3bc0a){MailAccountEvents[_0x38fb('0x5')](_0x3c2df6+':'+_0x18a79e['id'],_0x18a79e);MailAccountEvents[_0x38fb('0x5')](_0x3c2df6,_0x18a79e);_0xa3bc0a(null);};}for(var e in events){if(events[_0x38fb('0x6')](e)){var event=events[e];MailAccount['hook'](e,emitEvent(event));}}module[_0x38fb('0x7')]=MailAccountEvents; \ No newline at end of file diff --git a/server/api/mailAccount/mailAccount.model.js b/server/api/mailAccount/mailAccount.model.js index 44d9be3..0aa5b95 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 _0x34e0=['../../config/logger','moment','bluebird','path','define','MailAccount','util'];(function(_0x521929,_0x479be5){var _0x632436=function(_0x288290){while(--_0x288290){_0x521929['push'](_0x521929['shift']());}};_0x632436(++_0x479be5);}(_0x34e0,0xa0));var _0x034e=function(_0x31e29a,_0x349c9b){_0x31e29a=_0x31e29a-0x0;var _0x32d892=_0x34e0[_0x31e29a];return _0x32d892;};'use strict';var _=require('lodash');var util=require(_0x034e('0x0'));var logger=require(_0x034e('0x1'))('api');var moment=require(_0x034e('0x2'));var BPromise=require(_0x034e('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x034e('0x4'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require('./mailAccount.attributes');module['exports']=function(_0x39740a,_0x1a3b1d){return _0x39740a[_0x034e('0x5')](_0x034e('0x6'),attributes,{'tableName':'mail_accounts','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xb233=['api','bluebird','request-promise','rimraf','../../config/environment','exports','define','MailAccount','mail_accounts','util','../../config/logger'];(function(_0x2c0ded,_0x3de22c){var _0x4473e5=function(_0x3705bc){while(--_0x3705bc){_0x2c0ded['push'](_0x2c0ded['shift']());}};_0x4473e5(++_0x3de22c);}(_0xb233,0x15e));var _0x3b23=function(_0x41161f,_0x2655f6){_0x41161f=_0x41161f-0x0;var _0x3eb7f7=_0xb233[_0x41161f];return _0x3eb7f7;};'use strict';var _=require('lodash');var util=require(_0x3b23('0x0'));var logger=require(_0x3b23('0x1'))(_0x3b23('0x2'));var moment=require('moment');var BPromise=require(_0x3b23('0x3'));var rp=require(_0x3b23('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x3b23('0x5'));var config=require(_0x3b23('0x6'));var attributes=require('./mailAccount.attributes');module[_0x3b23('0x7')]=function(_0x442a2f,_0xf95589){return _0x442a2f[_0x3b23('0x8')](_0x3b23('0x9'),attributes,{'tableName':_0x3b23('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/mailAccount/mailAccount.rpc.js b/server/api/mailAccount/mailAccount.rpc.js index 3c09767..b0f5c2f 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 _0x9b87=['CmList','List','Contacts','DESC','MailApplication','Applications','MailServerOut','get','omit','applications','list','autoclose','length','close','*,*,*,*','List\x20not\x20found','messageId','generate','subject','attach','format','YYYY-MM-DD\x20HH:mm:ss','MailInteraction','MailMessage','inReplyTo','Contact\x20not\x20found','update','interaction','created','attachments','originTo','originCc','bcc','Attachment','Attachments','UserId','User','name','unshift','waitForTheAssignedAgent','Start','startRouting','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','./mailAccount.socket','register','info','MailAccount,\x20%s,\x20%s','request\x20sent','debug','MailAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','GetMailAccount','MailAccount','findAll','options','include','map','model','attributes','catch','ShowMailAccount','find','raw','where','then','NotifyMailAccount','body','mail','difference','keys','CmContact','createdAt','updatedAt','ListId','isNil','from','from\x20is\x20mandatory','mapKey','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','account'];(function(_0x23ee4f,_0x173100){var _0x4fb419=function(_0x208689){while(--_0x208689){_0x23ee4f['push'](_0x23ee4f['shift']());}};_0x4fb419(++_0x173100);}(_0x9b87,0x8e));var _0x79b8=function(_0x266e26,_0x405c78){_0x266e26=_0x266e26-0x0;var _0x3672eb=_0x9b87[_0x266e26];return _0x3672eb;};'use strict';var _=require(_0x79b8('0x0'));var util=require(_0x79b8('0x1'));var moment=require(_0x79b8('0x2'));var BPromise=require(_0x79b8('0x3'));var rs=require(_0x79b8('0x4'));var fs=require('fs');var Redis=require(_0x79b8('0x5'));var db=require(_0x79b8('0x6'))['db'];var utils=require(_0x79b8('0x7'));var logger=require(_0x79b8('0x8'))(_0x79b8('0x9'));var config=require(_0x79b8('0xa'));var jayson=require(_0x79b8('0xb'));var client=jayson[_0x79b8('0xc')][_0x79b8('0xd')]({'port':0x232c});config[_0x79b8('0xe')]=_[_0x79b8('0xf')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0x79b8('0x10'))[_0x79b8('0x11')](socket);function respondWithRpcPromise(_0x2f3453,_0x4bc41f,_0x28434){return new BPromise(function(_0x2fdb05,_0xdf585a){return client['request'](_0x2f3453,_0x28434)['then'](function(_0x46c0ce){logger[_0x79b8('0x12')](_0x79b8('0x13'),_0x4bc41f,_0x79b8('0x14'));logger[_0x79b8('0x15')](_0x79b8('0x16'),_0x4bc41f,_0x79b8('0x14'),JSON[_0x79b8('0x17')](_0x46c0ce));if(_0x46c0ce[_0x79b8('0x18')]){if(_0x46c0ce[_0x79b8('0x18')][_0x79b8('0x19')]===0x1f4){logger['error'](_0x79b8('0x13'),_0x4bc41f,_0x46c0ce['error']['message']);return _0xdf585a(_0x46c0ce[_0x79b8('0x18')][_0x79b8('0x1a')]);}logger[_0x79b8('0x18')]('MailAccount,\x20%s,\x20%s',_0x4bc41f,_0x46c0ce[_0x79b8('0x18')]['message']);return _0x2fdb05(_0x46c0ce['error'][_0x79b8('0x1a')]);}else{logger[_0x79b8('0x12')](_0x79b8('0x13'),_0x4bc41f,_0x79b8('0x14'));_0x2fdb05(_0x46c0ce[_0x79b8('0x1b')][_0x79b8('0x1a')]);}})['catch'](function(_0x6a0de5){logger['error']('MailAccount,\x20%s,\x20%s',_0x4bc41f,_0x6a0de5);_0xdf585a(_0x6a0de5);});});}exports[_0x79b8('0x1c')]=function(_0x131d04){var _0x406b56=this;return new Promise(function(_0x3e0157,_0x1e24cf){return db[_0x79b8('0x1d')][_0x79b8('0x1e')]({'raw':_0x131d04[_0x79b8('0x1f')]?_0x131d04[_0x79b8('0x1f')]['raw']===undefined?!![]:![]:!![],'where':_0x131d04[_0x79b8('0x1f')]?_0x131d04[_0x79b8('0x1f')]['where']||null:null,'attributes':_0x131d04[_0x79b8('0x1f')]?_0x131d04[_0x79b8('0x1f')]['attributes']||null:null,'limit':_0x131d04[_0x79b8('0x1f')]?_0x131d04['options']['limit']||null:null,'include':_0x131d04[_0x79b8('0x1f')]?_0x131d04[_0x79b8('0x1f')][_0x79b8('0x20')]?_[_0x79b8('0x21')](_0x131d04[_0x79b8('0x1f')]['include'],function(_0x35db24){return{'model':db[_0x35db24[_0x79b8('0x22')]],'as':_0x35db24['as'],'attributes':_0x35db24[_0x79b8('0x23')],'include':_0x35db24[_0x79b8('0x20')]?_['map'](_0x35db24[_0x79b8('0x20')],function(_0x2b6fad){return{'model':db[_0x2b6fad[_0x79b8('0x22')]],'as':_0x2b6fad['as'],'attributes':_0x2b6fad['attributes'],'include':_0x2b6fad[_0x79b8('0x20')]?_[_0x79b8('0x21')](_0x2b6fad[_0x79b8('0x20')],function(_0x2942e9){return{'model':db[_0x2942e9[_0x79b8('0x22')]],'as':_0x2942e9['as'],'attributes':_0x2942e9[_0x79b8('0x23')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x434ecd){logger['info'](_0x79b8('0x1c'),_0x131d04);logger['debug'](_0x79b8('0x1c'),_0x131d04,JSON[_0x79b8('0x17')](_0x434ecd));_0x3e0157(_0x434ecd);})[_0x79b8('0x24')](function(_0x55c631){logger[_0x79b8('0x18')](_0x79b8('0x1c'),_0x55c631[_0x79b8('0x1a')],_0x131d04);_0x1e24cf(_0x406b56[_0x79b8('0x18')](0x1f4,_0x55c631['message']));});});};exports[_0x79b8('0x25')]=function(_0x540e49){var _0x4ed9b5=this;return new Promise(function(_0x38bb08,_0x38b521){return db['MailAccount'][_0x79b8('0x26')]({'raw':_0x540e49['options']?_0x540e49['options'][_0x79b8('0x27')]===undefined?!![]:![]:!![],'where':_0x540e49['options']?_0x540e49[_0x79b8('0x1f')][_0x79b8('0x28')]||null:null,'attributes':_0x540e49['options']?_0x540e49[_0x79b8('0x1f')][_0x79b8('0x23')]||null:null,'include':_0x540e49[_0x79b8('0x1f')]?_0x540e49[_0x79b8('0x1f')][_0x79b8('0x20')]?_[_0x79b8('0x21')](_0x540e49['options'][_0x79b8('0x20')],function(_0x28b32b){return{'model':db[_0x28b32b[_0x79b8('0x22')]],'as':_0x28b32b['as'],'attributes':_0x28b32b[_0x79b8('0x23')],'include':_0x28b32b[_0x79b8('0x20')]?_[_0x79b8('0x21')](_0x28b32b[_0x79b8('0x20')],function(_0x116e9e){return{'model':db[_0x116e9e[_0x79b8('0x22')]],'as':_0x116e9e['as'],'attributes':_0x116e9e[_0x79b8('0x23')],'include':_0x116e9e[_0x79b8('0x20')]?_['map'](_0x116e9e[_0x79b8('0x20')],function(_0x9de99){return{'model':db[_0x9de99[_0x79b8('0x22')]],'as':_0x9de99['as'],'attributes':_0x9de99['attributes']};}):[]};}):[]};}):[]:[]})[_0x79b8('0x29')](function(_0xe738f){logger[_0x79b8('0x12')](_0x79b8('0x25'),_0x540e49);logger[_0x79b8('0x15')](_0x79b8('0x25'),_0x540e49,JSON['stringify'](_0xe738f));_0x38bb08(_0xe738f);})[_0x79b8('0x24')](function(_0x5be93d){logger['error'](_0x79b8('0x25'),_0x5be93d['message'],_0x540e49);_0x38b521(_0x4ed9b5['error'](0x1f4,_0x5be93d[_0x79b8('0x1a')]));});});};exports[_0x79b8('0x2a')]=function(_0x422c56){var _0x2f25dd=this;return new Promise(function(_0x43d795,_0x290f85){var _0x464a5e={'body':_0x422c56[_0x79b8('0x2b')],'channel':_0x79b8('0x2c')};var _0x37fe86=_[_0x79b8('0x2d')](_[_0x79b8('0x2e')](db[_0x79b8('0x2f')]['rawAttributes']),[_0x79b8('0x30'),_0x79b8('0x31'),'CompanyId',_0x79b8('0x32')]);var _0x44ccca=![];if(_0x422c56['body']['id']){delete _0x422c56[_0x79b8('0x2b')]['id'];}if(_[_0x79b8('0x33')](_0x422c56[_0x79b8('0x2b')][_0x79b8('0x34')])){return _0x290f85(_0x2f25dd[_0x79b8('0x18')](0x1f4,_0x79b8('0x35')));}if(_[_0x79b8('0x33')](_0x422c56[_0x79b8('0x2b')][_0x79b8('0x2b')])||_0x422c56[_0x79b8('0x2b')][_0x79b8('0x2b')]===''){return _0x290f85(_0x2f25dd[_0x79b8('0x18')](0x1f4,'body\x20is\x20mandatory\x20and\x20not\x20empty'));}if(_['isNil'](_0x422c56[_0x79b8('0x2b')][_0x79b8('0x36')])){return _0x290f85(_0x2f25dd[_0x79b8('0x18')](0x1f4,_0x79b8('0x37')+_0x37fe86));}if(!_['includes'](_0x37fe86,_0x422c56[_0x79b8('0x2b')][_0x79b8('0x36')])){return _0x290f85(_0x2f25dd[_0x79b8('0x18')](0x1f4,_0x79b8('0x38')+_0x37fe86));}var _0x5aeb35={};_0x5aeb35[_0x422c56[_0x79b8('0x2b')][_0x79b8('0x36')]]=_0x422c56[_0x79b8('0x2b')][_0x79b8('0x34')];return db['MailAccount'][_0x79b8('0x26')]({'where':{'id':_0x422c56[_0x79b8('0x39')]['id']},'include':[{'model':db[_0x79b8('0x3a')],'as':_0x79b8('0x3b'),'include':[{'model':db[_0x79b8('0x2f')],'as':_0x79b8('0x3c'),'where':_0x5aeb35,'limit':0x1,'order':[['updatedAt',_0x79b8('0x3d')]]}]},{'model':db[_0x79b8('0x3e')],'as':_0x79b8('0x3f')},{'model':db[_0x79b8('0x40')],'as':'Smtp'}]})['then'](function(_0xd15531){if(_0xd15531&&_0xd15531[_0x79b8('0x3b')]){var _0x324161=_0xd15531[_0x79b8('0x41')]({'plain':!![]});_0x464a5e[_0x79b8('0x39')]=_[_0x79b8('0x42')](_0x324161,[_0x79b8('0x3f'),_0x79b8('0x3b')]);_0x464a5e[_0x79b8('0x43')]=_0x324161['Applications'];_0x464a5e[_0x79b8('0x44')]=_0x324161[_0x79b8('0x3b')];_0x464a5e[_0x79b8('0x43')]=_['orderBy'](_0x464a5e[_0x79b8('0x43')],['priority'],['asc']);if(_0x464a5e[_0x79b8('0x39')]&&_0x464a5e[_0x79b8('0x39')][_0x79b8('0x45')]){_0x464a5e[_0x79b8('0x43')]['push']({'id':0x0,'priority':_0x464a5e['applications'][_0x79b8('0x46')]+0x1,'app':_0x79b8('0x47'),'appdata':_0x79b8('0x45'),'interval':_0x79b8('0x48')});}if(_0x464a5e[_0x79b8('0x39')][_0x79b8('0x3f')]){delete _0x464a5e[_0x79b8('0x39')][_0x79b8('0x3f')];}if(_0x464a5e[_0x79b8('0x39')][_0x79b8('0x3b')]){delete _0x464a5e[_0x79b8('0x39')][_0x79b8('0x3b')];}if(_0x324161[_0x79b8('0x3b')][_0x79b8('0x3c')]['length']){return _0x324161[_0x79b8('0x3b')][_0x79b8('0x3c')][0x0];}var _0x2eb440=_[_0x79b8('0xf')](_0x422c56['body'],{'firstName':_0x422c56['body'][_0x79b8('0x34')],'ListId':_0x324161[_0x79b8('0x32')]});_0x2eb440[_0x422c56[_0x79b8('0x2b')][_0x79b8('0x36')]]=_0x422c56['body'][_0x79b8('0x34')];return db[_0x79b8('0x2f')]['create'](_0x2eb440);}else{throw new Error(_0x79b8('0x49'));}})[_0x79b8('0x29')](function(_0x333edc){_0x464a5e['contact']=_0x333edc;if(_0x333edc){if(!_0x422c56[_0x79b8('0x2b')]['message'][_0x79b8('0x4a')]){_0x422c56[_0x79b8('0x2b')][_0x79b8('0x1a')][_0x79b8('0x4a')]=rs[_0x79b8('0x4b')]()+'\x20'+_0x422c56[_0x79b8('0x2b')][_0x79b8('0x1a')][_0x79b8('0x34')];}var _0xe0d55d={'ContactId':_0x333edc['id'],'MailAccountId':_0x422c56[_0x79b8('0x39')]['id'],'inReplyTo':_0x422c56['body'][_0x79b8('0x1a')]['messageId'],'to':_0x422c56[_0x79b8('0x2b')]['message'][_0x79b8('0x34')],'cc':_0x422c56[_0x79b8('0x2b')][_0x79b8('0x1a')]['cc'],'subject':_0x422c56[_0x79b8('0x2b')][_0x79b8('0x1a')][_0x79b8('0x4c')],'attach':_0x422c56[_0x79b8('0x2b')]['message'][_0x79b8('0x4d')],'lastMsgAt':moment()[_0x79b8('0x4e')](_0x79b8('0x4f')),'lastMsgDirection':'in','lastMsgBody':_0x422c56[_0x79b8('0x2b')][_0x79b8('0x2b')]};return db[_0x79b8('0x50')]['find']({'where':{'closed':![],'MailAccountId':_0x422c56[_0x79b8('0x39')]['id']},'include':[{'model':db[_0x79b8('0x51')],'as':'Messages','attributes':[_0x79b8('0x4a')],'where':{'messageId':_0x422c56['body'][_0x79b8('0x1a')][_0x79b8('0x52')]}}]})['then'](function(_0xecf12a){if(_0xecf12a){return[_0xecf12a,![]];}return db[_0x79b8('0x50')]['create'](_0xe0d55d)[_0x79b8('0x29')](function(_0x4b197b){return[_0x4b197b,!![]];});});}else{throw new Error(_0x79b8('0x53'));}})['spread'](function(_0x1d4360,_0x1e101d){if(_0x1d4360){_0x44ccca=_0x1e101d;if(!_0x1e101d){return _0x1d4360[_0x79b8('0x54')]({'inReplyTo':_0x422c56[_0x79b8('0x2b')][_0x79b8('0x1a')][_0x79b8('0x4a')],'to':_0x422c56['body'][_0x79b8('0x1a')][_0x79b8('0x34')],'cc':_0x422c56['body']['message']['cc'],'subject':_0x422c56[_0x79b8('0x2b')][_0x79b8('0x1a')]['subject'],'attach':_0x1d4360[_0x79b8('0x4d')]?_0x1d4360[_0x79b8('0x4d')]:_0x422c56[_0x79b8('0x2b')]['message'][_0x79b8('0x4d')],'substatus':null,'substatusAt':moment()[_0x79b8('0x4e')](_0x79b8('0x4f')),'lastMsgAt':moment()[_0x79b8('0x4e')](_0x79b8('0x4f')),'lastMsgDirection':'in','lastMsgBody':_0x422c56[_0x79b8('0x2b')]['body']});}else{return _0x1d4360;}}})[_0x79b8('0x29')](function(_0x1e2516){_0x464a5e[_0x79b8('0x55')]=_0x1e2516['get']({'plain':!![]});_0x464a5e[_0x79b8('0x55')][_0x79b8('0x56')]=_0x44ccca;return db[_0x79b8('0x51')]['create']({'body':_0x422c56[_0x79b8('0x2b')][_0x79b8('0x2b')],'MailAccountId':_0x422c56['account']['id'],'MailInteractionId':_0x1e2516['id'],'direction':'in','ContactId':_0x464a5e['contact']['id'],'messageId':_0x422c56[_0x79b8('0x2b')][_0x79b8('0x1a')][_0x79b8('0x4a')],'from':_0x422c56[_0x79b8('0x2b')][_0x79b8('0x1a')][_0x79b8('0x34')],'to':_0x422c56[_0x79b8('0x2b')][_0x79b8('0x1a')]['to'],'cc':_0x422c56['body'][_0x79b8('0x1a')]['cc'],'subject':_0x422c56['body']['message'][_0x79b8('0x4c')],'attach':_0x422c56['body'][_0x79b8('0x1a')][_0x79b8('0x4d')],'Attachments':_0x422c56[_0x79b8('0x2b')]['message'][_0x79b8('0x57')],'originTo':_0x422c56[_0x79b8('0x2b')][_0x79b8('0x1a')][_0x79b8('0x58')],'originCc':_0x422c56[_0x79b8('0x2b')][_0x79b8('0x1a')][_0x79b8('0x59')],'bcc':_0x422c56[_0x79b8('0x2b')][_0x79b8('0x1a')][_0x79b8('0x5a')]},{'include':[{'model':db[_0x79b8('0x5b')],'as':_0x79b8('0x5c')}]});})['then'](function(_0x2b7dac){_0x464a5e[_0x79b8('0x1a')]=_0x2b7dac;if(_0x464a5e[_0x79b8('0x55')][_0x79b8('0x5d')]){return db[_0x79b8('0x5e')][_0x79b8('0x26')]({'attributes':['id',_0x79b8('0x5f')],'where':{'id':_0x464a5e[_0x79b8('0x55')][_0x79b8('0x5d')]}})[_0x79b8('0x29')](function(_0xbd494e){if(_0xbd494e){_0x464a5e['applications'][_0x79b8('0x60')]({'id':0x0,'priority':0x0,'app':'agent','appdata':_0xbd494e['name']+','+(_0x464a5e[_0x79b8('0x39')][_0x79b8('0x61')]||0xa),'interval':_0x79b8('0x48')});}return respondWithRpcPromise(_0x79b8('0x62'),_0x79b8('0x63'),_0x464a5e);});}return respondWithRpcPromise(_0x79b8('0x62'),_0x79b8('0x63'),_0x464a5e);})[_0x79b8('0x29')](function(_0x574191){_0x43d795(_0x574191);})['catch'](function(_0x5a4014){_0x290f85(_0x2f25dd[_0x79b8('0x18')](0x1f4,_0x5a4014[_0x79b8('0x1a')]));});});}; \ No newline at end of file +var _0x8d37=['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','account','CmList','List','Contacts','DESC','MailApplication','Applications','MailServerOut','Smtp','get','applications','list','orderBy','priority','asc','autoclose','close','*,*,*,*','length','ListId','messageId','generate','attach','format','YYYY-MM-DD\x20HH:mm:ss','MailInteraction','MailMessage','Messages','create','spread','update','subject','interaction','created','bcc','Attachment','Attachments','UserId','unshift','agent','name','waitForTheAssignedAgent','startRouting','Start','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','defaults','redis','localhost','socket.io-emitter','./mailAccount.socket','register','request','then','info','MailAccount,\x20%s,\x20%s','MailAccount,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','result','catch','GetMailAccount','MailAccount','options','where','attributes','limit','include','map','model','stringify','ShowMailAccount','find','raw','debug','NotifyMailAccount','mail','difference','keys','CmContact','rawAttributes','createdAt','updatedAt','body','isNil','from','from\x20is\x20mandatory'];(function(_0x4760ee,_0x6ea670){var _0x22bdf4=function(_0x546785){while(--_0x546785){_0x4760ee['push'](_0x4760ee['shift']());}};_0x22bdf4(++_0x6ea670);}(_0x8d37,0x1d5));var _0x78d3=function(_0x58cec1,_0x24a508){_0x58cec1=_0x58cec1-0x0;var _0x26dc90=_0x8d37[_0x58cec1];return _0x26dc90;};'use strict';var _=require(_0x78d3('0x0'));var util=require(_0x78d3('0x1'));var moment=require(_0x78d3('0x2'));var BPromise=require(_0x78d3('0x3'));var rs=require(_0x78d3('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x78d3('0x5'))['db'];var utils=require(_0x78d3('0x6'));var logger=require(_0x78d3('0x7'))(_0x78d3('0x8'));var config=require(_0x78d3('0x9'));var jayson=require(_0x78d3('0xa'));var client=jayson[_0x78d3('0xb')][_0x78d3('0xc')]({'port':0x232c});config['redis']=_[_0x78d3('0xd')](config[_0x78d3('0xe')],{'host':_0x78d3('0xf'),'port':0x18eb});var socket=require(_0x78d3('0x10'))(new Redis(config[_0x78d3('0xe')]));require(_0x78d3('0x11'))[_0x78d3('0x12')](socket);function respondWithRpcPromise(_0x2a11b5,_0x2fee2c,_0x4745ee){return new BPromise(function(_0x358678,_0x17e275){return client[_0x78d3('0x13')](_0x2a11b5,_0x4745ee)[_0x78d3('0x14')](function(_0x2cc7c3){logger[_0x78d3('0x15')](_0x78d3('0x16'),_0x2fee2c,'request\x20sent');logger['debug'](_0x78d3('0x17'),_0x2fee2c,_0x78d3('0x18'),JSON['stringify'](_0x2cc7c3));if(_0x2cc7c3[_0x78d3('0x19')]){if(_0x2cc7c3['error'][_0x78d3('0x1a')]===0x1f4){logger[_0x78d3('0x19')](_0x78d3('0x16'),_0x2fee2c,_0x2cc7c3[_0x78d3('0x19')][_0x78d3('0x1b')]);return _0x17e275(_0x2cc7c3[_0x78d3('0x19')][_0x78d3('0x1b')]);}logger[_0x78d3('0x19')]('MailAccount,\x20%s,\x20%s',_0x2fee2c,_0x2cc7c3[_0x78d3('0x19')][_0x78d3('0x1b')]);return _0x358678(_0x2cc7c3['error'][_0x78d3('0x1b')]);}else{logger[_0x78d3('0x15')](_0x78d3('0x16'),_0x2fee2c,_0x78d3('0x18'));_0x358678(_0x2cc7c3[_0x78d3('0x1c')]['message']);}})[_0x78d3('0x1d')](function(_0x151352){logger[_0x78d3('0x19')](_0x78d3('0x16'),_0x2fee2c,_0x151352);_0x17e275(_0x151352);});});}exports[_0x78d3('0x1e')]=function(_0x5723d8){var _0x1abc79=this;return new Promise(function(_0x44312d,_0x2fa1a9){return db[_0x78d3('0x1f')]['findAll']({'raw':_0x5723d8[_0x78d3('0x20')]?_0x5723d8['options']['raw']===undefined?!![]:![]:!![],'where':_0x5723d8['options']?_0x5723d8['options'][_0x78d3('0x21')]||null:null,'attributes':_0x5723d8[_0x78d3('0x20')]?_0x5723d8['options'][_0x78d3('0x22')]||null:null,'limit':_0x5723d8[_0x78d3('0x20')]?_0x5723d8[_0x78d3('0x20')][_0x78d3('0x23')]||null:null,'include':_0x5723d8['options']?_0x5723d8[_0x78d3('0x20')][_0x78d3('0x24')]?_[_0x78d3('0x25')](_0x5723d8[_0x78d3('0x20')][_0x78d3('0x24')],function(_0x11bcf8){return{'model':db[_0x11bcf8['model']],'as':_0x11bcf8['as'],'attributes':_0x11bcf8[_0x78d3('0x22')],'include':_0x11bcf8[_0x78d3('0x24')]?_[_0x78d3('0x25')](_0x11bcf8[_0x78d3('0x24')],function(_0x1ecc1b){return{'model':db[_0x1ecc1b[_0x78d3('0x26')]],'as':_0x1ecc1b['as'],'attributes':_0x1ecc1b[_0x78d3('0x22')],'include':_0x1ecc1b['include']?_['map'](_0x1ecc1b[_0x78d3('0x24')],function(_0x208886){return{'model':db[_0x208886['model']],'as':_0x208886['as'],'attributes':_0x208886[_0x78d3('0x22')]};}):[]};}):[]};}):[]:[]})[_0x78d3('0x14')](function(_0x1b7db8){logger[_0x78d3('0x15')](_0x78d3('0x1e'),_0x5723d8);logger['debug']('GetMailAccount',_0x5723d8,JSON[_0x78d3('0x27')](_0x1b7db8));_0x44312d(_0x1b7db8);})['catch'](function(_0x4878a2){logger['error'](_0x78d3('0x1e'),_0x4878a2['message'],_0x5723d8);_0x2fa1a9(_0x1abc79[_0x78d3('0x19')](0x1f4,_0x4878a2[_0x78d3('0x1b')]));});});};exports[_0x78d3('0x28')]=function(_0x11bd3a){var _0x58ec61=this;return new Promise(function(_0x1a9139,_0x150fe9){return db[_0x78d3('0x1f')][_0x78d3('0x29')]({'raw':_0x11bd3a[_0x78d3('0x20')]?_0x11bd3a['options'][_0x78d3('0x2a')]===undefined?!![]:![]:!![],'where':_0x11bd3a[_0x78d3('0x20')]?_0x11bd3a['options'][_0x78d3('0x21')]||null:null,'attributes':_0x11bd3a[_0x78d3('0x20')]?_0x11bd3a['options'][_0x78d3('0x22')]||null:null,'include':_0x11bd3a[_0x78d3('0x20')]?_0x11bd3a[_0x78d3('0x20')]['include']?_[_0x78d3('0x25')](_0x11bd3a[_0x78d3('0x20')][_0x78d3('0x24')],function(_0x381824){return{'model':db[_0x381824[_0x78d3('0x26')]],'as':_0x381824['as'],'attributes':_0x381824['attributes'],'include':_0x381824['include']?_[_0x78d3('0x25')](_0x381824[_0x78d3('0x24')],function(_0x5d40be){return{'model':db[_0x5d40be['model']],'as':_0x5d40be['as'],'attributes':_0x5d40be[_0x78d3('0x22')],'include':_0x5d40be[_0x78d3('0x24')]?_[_0x78d3('0x25')](_0x5d40be[_0x78d3('0x24')],function(_0xe04647){return{'model':db[_0xe04647['model']],'as':_0xe04647['as'],'attributes':_0xe04647[_0x78d3('0x22')]};}):[]};}):[]};}):[]:[]})[_0x78d3('0x14')](function(_0x138cfb){logger[_0x78d3('0x15')](_0x78d3('0x28'),_0x11bd3a);logger[_0x78d3('0x2b')](_0x78d3('0x28'),_0x11bd3a,JSON[_0x78d3('0x27')](_0x138cfb));_0x1a9139(_0x138cfb);})[_0x78d3('0x1d')](function(_0xbf7d03){logger[_0x78d3('0x19')](_0x78d3('0x28'),_0xbf7d03[_0x78d3('0x1b')],_0x11bd3a);_0x150fe9(_0x58ec61['error'](0x1f4,_0xbf7d03[_0x78d3('0x1b')]));});});};exports[_0x78d3('0x2c')]=function(_0xc54f4f){var _0x450ad4=this;return new Promise(function(_0x26fb3a,_0x224618){var _0x4dc386={'body':_0xc54f4f['body'],'channel':_0x78d3('0x2d')};var _0x513ce9=_[_0x78d3('0x2e')](_[_0x78d3('0x2f')](db[_0x78d3('0x30')][_0x78d3('0x31')]),[_0x78d3('0x32'),_0x78d3('0x33'),'CompanyId','ListId']);var _0x19c396=![];if(_0xc54f4f[_0x78d3('0x34')]['id']){delete _0xc54f4f[_0x78d3('0x34')]['id'];}if(_[_0x78d3('0x35')](_0xc54f4f[_0x78d3('0x34')][_0x78d3('0x36')])){return _0x224618(_0x450ad4['error'](0x1f4,_0x78d3('0x37')));}if(_['isNil'](_0xc54f4f[_0x78d3('0x34')][_0x78d3('0x34')])||_0xc54f4f[_0x78d3('0x34')][_0x78d3('0x34')]===''){return _0x224618(_0x450ad4[_0x78d3('0x19')](0x1f4,_0x78d3('0x38')));}if(_[_0x78d3('0x35')](_0xc54f4f[_0x78d3('0x34')][_0x78d3('0x39')])){return _0x224618(_0x450ad4[_0x78d3('0x19')](0x1f4,_0x78d3('0x3a')+_0x513ce9));}if(!_[_0x78d3('0x3b')](_0x513ce9,_0xc54f4f[_0x78d3('0x34')][_0x78d3('0x39')])){return _0x224618(_0x450ad4[_0x78d3('0x19')](0x1f4,_0x78d3('0x3c')+_0x513ce9));}var _0x597a82={};_0x597a82[_0xc54f4f[_0x78d3('0x34')][_0x78d3('0x39')]]=_0xc54f4f[_0x78d3('0x34')]['from'];return db[_0x78d3('0x1f')][_0x78d3('0x29')]({'where':{'id':_0xc54f4f[_0x78d3('0x3d')]['id']},'include':[{'model':db[_0x78d3('0x3e')],'as':_0x78d3('0x3f'),'include':[{'model':db[_0x78d3('0x30')],'as':_0x78d3('0x40'),'where':_0x597a82,'limit':0x1,'order':[[_0x78d3('0x33'),_0x78d3('0x41')]]}]},{'model':db[_0x78d3('0x42')],'as':_0x78d3('0x43')},{'model':db[_0x78d3('0x44')],'as':_0x78d3('0x45')}]})[_0x78d3('0x14')](function(_0x44996f){if(_0x44996f&&_0x44996f[_0x78d3('0x3f')]){var _0x3abfd7=_0x44996f[_0x78d3('0x46')]({'plain':!![]});_0x4dc386[_0x78d3('0x3d')]=_['omit'](_0x3abfd7,[_0x78d3('0x43'),_0x78d3('0x3f')]);_0x4dc386[_0x78d3('0x47')]=_0x3abfd7[_0x78d3('0x43')];_0x4dc386[_0x78d3('0x48')]=_0x3abfd7[_0x78d3('0x3f')];_0x4dc386['applications']=_[_0x78d3('0x49')](_0x4dc386[_0x78d3('0x47')],[_0x78d3('0x4a')],[_0x78d3('0x4b')]);if(_0x4dc386[_0x78d3('0x3d')]&&_0x4dc386['account'][_0x78d3('0x4c')]){_0x4dc386[_0x78d3('0x47')]['push']({'id':0x0,'priority':_0x4dc386['applications']['length']+0x1,'app':_0x78d3('0x4d'),'appdata':_0x78d3('0x4c'),'interval':_0x78d3('0x4e')});}if(_0x4dc386[_0x78d3('0x3d')]['Applications']){delete _0x4dc386[_0x78d3('0x3d')][_0x78d3('0x43')];}if(_0x4dc386[_0x78d3('0x3d')][_0x78d3('0x3f')]){delete _0x4dc386['account']['List'];}if(_0x3abfd7[_0x78d3('0x3f')][_0x78d3('0x40')][_0x78d3('0x4f')]){return _0x3abfd7['List'][_0x78d3('0x40')][0x0];}var _0x260cbb=_[_0x78d3('0xd')](_0xc54f4f[_0x78d3('0x34')],{'firstName':_0xc54f4f[_0x78d3('0x34')][_0x78d3('0x36')],'ListId':_0x3abfd7[_0x78d3('0x50')]});_0x260cbb[_0xc54f4f['body'][_0x78d3('0x39')]]=_0xc54f4f[_0x78d3('0x34')][_0x78d3('0x36')];return db[_0x78d3('0x30')]['create'](_0x260cbb);}else{throw new Error('List\x20not\x20found');}})[_0x78d3('0x14')](function(_0x274dae){_0x4dc386['contact']=_0x274dae;if(_0x274dae){if(!_0xc54f4f[_0x78d3('0x34')]['message']['messageId']){_0xc54f4f[_0x78d3('0x34')]['message'][_0x78d3('0x51')]=rs[_0x78d3('0x52')]()+'\x20'+_0xc54f4f[_0x78d3('0x34')][_0x78d3('0x1b')][_0x78d3('0x36')];}var _0x2564fb={'ContactId':_0x274dae['id'],'MailAccountId':_0xc54f4f[_0x78d3('0x3d')]['id'],'inReplyTo':_0xc54f4f[_0x78d3('0x34')][_0x78d3('0x1b')]['messageId'],'to':_0xc54f4f[_0x78d3('0x34')]['message'][_0x78d3('0x36')],'cc':_0xc54f4f[_0x78d3('0x34')][_0x78d3('0x1b')]['cc'],'subject':_0xc54f4f[_0x78d3('0x34')][_0x78d3('0x1b')]['subject'],'attach':_0xc54f4f['body'][_0x78d3('0x1b')][_0x78d3('0x53')],'lastMsgAt':moment()[_0x78d3('0x54')](_0x78d3('0x55')),'lastMsgDirection':'in','lastMsgBody':_0xc54f4f['body']['body']};return db[_0x78d3('0x56')][_0x78d3('0x29')]({'where':{'closed':![],'MailAccountId':_0xc54f4f[_0x78d3('0x3d')]['id']},'include':[{'model':db[_0x78d3('0x57')],'as':_0x78d3('0x58'),'attributes':[_0x78d3('0x51')],'where':{'messageId':_0xc54f4f[_0x78d3('0x34')][_0x78d3('0x1b')]['inReplyTo']}}]})['then'](function(_0x52fa58){if(_0x52fa58){return[_0x52fa58,![]];}return db['MailInteraction'][_0x78d3('0x59')](_0x2564fb)[_0x78d3('0x14')](function(_0x3702c8){return[_0x3702c8,!![]];});});}else{throw new Error('Contact\x20not\x20found');}})[_0x78d3('0x5a')](function(_0x48a036,_0x2275e3){if(_0x48a036){_0x19c396=_0x2275e3;if(!_0x2275e3){return _0x48a036[_0x78d3('0x5b')]({'inReplyTo':_0xc54f4f['body'][_0x78d3('0x1b')][_0x78d3('0x51')],'to':_0xc54f4f[_0x78d3('0x34')]['message']['from'],'cc':_0xc54f4f[_0x78d3('0x34')][_0x78d3('0x1b')]['cc'],'subject':_0xc54f4f[_0x78d3('0x34')][_0x78d3('0x1b')][_0x78d3('0x5c')],'attach':_0x48a036[_0x78d3('0x53')]?_0x48a036[_0x78d3('0x53')]:_0xc54f4f['body'][_0x78d3('0x1b')]['attach'],'substatus':null,'substatusAt':moment()[_0x78d3('0x54')](_0x78d3('0x55')),'lastMsgAt':moment()[_0x78d3('0x54')](_0x78d3('0x55')),'lastMsgDirection':'in','lastMsgBody':_0xc54f4f[_0x78d3('0x34')][_0x78d3('0x34')]});}else{return _0x48a036;}}})[_0x78d3('0x14')](function(_0x19977c){_0x4dc386[_0x78d3('0x5d')]=_0x19977c['get']({'plain':!![]});_0x4dc386[_0x78d3('0x5d')][_0x78d3('0x5e')]=_0x19c396;return db[_0x78d3('0x57')][_0x78d3('0x59')]({'body':_0xc54f4f[_0x78d3('0x34')][_0x78d3('0x34')],'MailAccountId':_0xc54f4f[_0x78d3('0x3d')]['id'],'MailInteractionId':_0x19977c['id'],'direction':'in','ContactId':_0x4dc386['contact']['id'],'messageId':_0xc54f4f[_0x78d3('0x34')][_0x78d3('0x1b')]['messageId'],'from':_0xc54f4f['body'][_0x78d3('0x1b')]['from'],'to':_0xc54f4f[_0x78d3('0x34')][_0x78d3('0x1b')]['to'],'cc':_0xc54f4f[_0x78d3('0x34')][_0x78d3('0x1b')]['cc'],'subject':_0xc54f4f[_0x78d3('0x34')][_0x78d3('0x1b')]['subject'],'attach':_0xc54f4f[_0x78d3('0x34')][_0x78d3('0x1b')]['attach'],'Attachments':_0xc54f4f['body']['message']['attachments'],'originTo':_0xc54f4f['body'][_0x78d3('0x1b')]['originTo'],'originCc':_0xc54f4f[_0x78d3('0x34')]['message']['originCc'],'bcc':_0xc54f4f[_0x78d3('0x34')][_0x78d3('0x1b')][_0x78d3('0x5f')]},{'include':[{'model':db[_0x78d3('0x60')],'as':_0x78d3('0x61')}]});})[_0x78d3('0x14')](function(_0x1f95ed){_0x4dc386['message']=_0x1f95ed;if(_0x4dc386[_0x78d3('0x5d')][_0x78d3('0x62')]){return db['User'][_0x78d3('0x29')]({'attributes':['id','name'],'where':{'id':_0x4dc386[_0x78d3('0x5d')]['UserId']}})['then'](function(_0x4b9b50){if(_0x4b9b50){_0x4dc386[_0x78d3('0x47')][_0x78d3('0x63')]({'id':0x0,'priority':0x0,'app':_0x78d3('0x64'),'appdata':_0x4b9b50[_0x78d3('0x65')]+','+(_0x4dc386['account'][_0x78d3('0x66')]||0xa),'interval':_0x78d3('0x4e')});}return respondWithRpcPromise('Start',_0x78d3('0x67'),_0x4dc386);});}return respondWithRpcPromise(_0x78d3('0x68'),_0x78d3('0x67'),_0x4dc386);})['then'](function(_0x51ff38){_0x26fb3a(_0x51ff38);})['catch'](function(_0x3cc55a){_0x224618(_0x450ad4['error'](0x1f4,_0x3cc55a['message']));});});}; \ No newline at end of file diff --git a/server/api/mailAccount/mailAccount.socket.js b/server/api/mailAccount/mailAccount.socket.js index b83e6d0..9087ca5 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 _0x1c9a=['register','length','mailAccount:','./mailAccount.events','save','update','emit'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x1c9a,0x1a7));var _0xa1c9=function(_0x478beb,_0x1468e2){_0x478beb=_0x478beb-0x0;var _0x395108=_0x1c9a[_0x478beb];return _0x395108;};'use strict';var MailAccountEvents=require(_0xa1c9('0x0'));var events=[_0xa1c9('0x1'),'remove',_0xa1c9('0x2')];function createListener(_0x867bbb,_0x38c48f){return function(_0x408418){_0x38c48f[_0xa1c9('0x3')](_0x867bbb,_0x408418);};}function removeListener(_0x4a0d3d,_0x2f883c){return function(){MailAccountEvents['removeListener'](_0x4a0d3d,_0x2f883c);};}exports[_0xa1c9('0x4')]=function(_0xdd22bf){for(var _0x237862=0x0,_0x2b0c89=events[_0xa1c9('0x5')];_0x237862<_0x2b0c89;_0x237862++){var _0x46b19a=events[_0x237862];var _0x3b1a2c=createListener(_0xa1c9('0x6')+_0x46b19a,_0xdd22bf);MailAccountEvents['on'](_0x46b19a,_0x3b1a2c);}}; \ No newline at end of file +var _0x038b=['removeListener','register','length','save','remove','update','emit'];(function(_0x525af9,_0x4edd23){var _0x129fbf=function(_0x4f44fe){while(--_0x4f44fe){_0x525af9['push'](_0x525af9['shift']());}};_0x129fbf(++_0x4edd23);}(_0x038b,0x114));var _0xb038=function(_0x48e064,_0x5c4e5e){_0x48e064=_0x48e064-0x0;var _0x177267=_0x038b[_0x48e064];return _0x177267;};'use strict';var MailAccountEvents=require('./mailAccount.events');var events=[_0xb038('0x0'),_0xb038('0x1'),_0xb038('0x2')];function createListener(_0x5623c3,_0x3d7dfe){return function(_0x5ed31a){_0x3d7dfe[_0xb038('0x3')](_0x5623c3,_0x5ed31a);};}function removeListener(_0x3d090b,_0x4a8a30){return function(){MailAccountEvents[_0xb038('0x4')](_0x3d090b,_0x4a8a30);};}exports[_0xb038('0x5')]=function(_0x4fe092){for(var _0x54e1e7=0x0,_0x2e3e64=events[_0xb038('0x6')];_0x54e1e7<_0x2e3e64;_0x54e1e7++){var _0x1534a9=events[_0x54e1e7];var _0x4b4085=createListener('mailAccount:'+_0x1534a9,_0x4fe092);MailAccountEvents['on'](_0x1534a9,_0x4b4085);}}; \ No newline at end of file diff --git a/server/api/mailApplication/index.js b/server/api/mailApplication/index.js index 19e86fe..10c2bff 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 _0xbc9d=['path','connect-timeout','express','../../config/environment','./mailApplication.controller','get','/:id','isAuthenticated','show','put','update','delete','multer','util'];(function(_0x4f3a7a,_0x120a8e){var _0x7189d4=function(_0x594f9a){while(--_0x594f9a){_0x4f3a7a['push'](_0x4f3a7a['shift']());}};_0x7189d4(++_0x120a8e);}(_0xbc9d,0xb4));var _0xdbc9=function(_0x50cefa,_0x1e9d72){_0x50cefa=_0x50cefa-0x0;var _0x2f1cbc=_0xbc9d[_0x50cefa];return _0x2f1cbc;};'use strict';var multer=require(_0xdbc9('0x0'));var util=require(_0xdbc9('0x1'));var path=require(_0xdbc9('0x2'));var timeout=require(_0xdbc9('0x3'));var express=require(_0xdbc9('0x4'));var router=express['Router']();var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0xdbc9('0x5'));var controller=require(_0xdbc9('0x6'));router[_0xdbc9('0x7')](_0xdbc9('0x8'),auth[_0xdbc9('0x9')](),controller[_0xdbc9('0xa')]);router[_0xdbc9('0xb')]('/:id',auth[_0xdbc9('0x9')](),controller[_0xdbc9('0xc')]);router[_0xdbc9('0xd')]('/:id',auth[_0xdbc9('0x9')](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0x5ff3=['show','put','delete','exports','util','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','get','/:id','isAuthenticated'];(function(_0x1d75c5,_0x19a9d0){var _0xbeb942=function(_0x6a2783){while(--_0x6a2783){_0x1d75c5['push'](_0x1d75c5['shift']());}};_0xbeb942(++_0x19a9d0);}(_0x5ff3,0x17d));var _0x35ff=function(_0x53953a,_0x1cf8bf){_0x53953a=_0x53953a-0x0;var _0x25739d=_0x5ff3[_0x53953a];return _0x25739d;};'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 diff --git a/server/api/mailApplication/mailApplication.attributes.js b/server/api/mailApplication/mailApplication.attributes.js index f9e0765..285dd21 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 _0x6099=['exports','noop','TEXT','STRING','*,*,*,*','sequelize'];(function(_0x4d4696,_0x1ab3a2){var _0x455048=function(_0x1548d4){while(--_0x1548d4){_0x4d4696['push'](_0x4d4696['shift']());}};_0x455048(++_0x1ab3a2);}(_0x6099,0x1f1));var _0x9609=function(_0x14c408,_0x34e2e9){_0x14c408=_0x14c408-0x0;var _0x365fd5=_0x6099[_0x14c408];return _0x365fd5;};'use strict';var Sequelize=require(_0x9609('0x0'));module[_0x9609('0x1')]={'priority':{'type':Sequelize['INTEGER'],'allowNull':![]},'app':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0x9609('0x2')},'appdata':{'type':Sequelize[_0x9609('0x3')]()},'description':{'type':Sequelize[_0x9609('0x4')]},'interval':{'type':Sequelize[_0x9609('0x4')],'defaultValue':_0x9609('0x5')}}; \ No newline at end of file +var _0x9cfb=['INTEGER','STRING','TEXT','sequelize','exports'];(function(_0x2a0dcd,_0xa8b9ec){var _0x254e6d=function(_0x245d9b){while(--_0x245d9b){_0x2a0dcd['push'](_0x2a0dcd['shift']());}};_0x254e6d(++_0xa8b9ec);}(_0x9cfb,0x1de));var _0xb9cf=function(_0x173314,_0x1b60cb){_0x173314=_0x173314-0x0;var _0x61e720=_0x9cfb[_0x173314];return _0x61e720;};'use strict';var Sequelize=require(_0xb9cf('0x0'));module[_0xb9cf('0x1')]={'priority':{'type':Sequelize[_0xb9cf('0x2')],'allowNull':![]},'app':{'type':Sequelize[_0xb9cf('0x3')],'allowNull':![],'defaultValue':'noop'},'appdata':{'type':Sequelize[_0xb9cf('0x4')]()},'description':{'type':Sequelize[_0xb9cf('0x3')]},'interval':{'type':Sequelize[_0xb9cf('0x3')],'defaultValue':'*,*,*,*'}}; \ No newline at end of file diff --git a/server/api/mailApplication/mailApplication.controller.js b/server/api/mailApplication/mailApplication.controller.js index 88e9d1e..bf809a2 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 _0xada4=['moment','bluebird','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','count','offset','limit','set','Content-Range','apply','reject','save','update','then','error','stack','name','send','show','params','keys','rawAttributes','query','filters','intersection','model','attributes','fields','include','merge','options','MailApplication','find','catch','body','html-pdf','rimraf','fast-json-patch','request-promise'];(function(_0x892291,_0x15fd83){var _0x342c31=function(_0x52110d){while(--_0x52110d){_0x892291['push'](_0x892291['shift']());}};_0x342c31(++_0x15fd83);}(_0xada4,0x164));var _0x4ada=function(_0x2d4be6,_0x201d97){_0x2d4be6=_0x2d4be6-0x0;var _0x2ae47b=_0xada4[_0x2d4be6];return _0x2ae47b;};'use strict';var pdf=require(_0x4ada('0x0'));var emlformat=require('eml-format');var rimraf=require(_0x4ada('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x4ada('0x2'));var rp=require(_0x4ada('0x3'));var moment=require(_0x4ada('0x4'));var BPromise=require(_0x4ada('0x5'));var Mustache=require('mustache');var util=require(_0x4ada('0x6'));var path=require(_0x4ada('0x7'));var sox=require(_0x4ada('0x8'));var csv=require(_0x4ada('0x9'));var ejs=require(_0x4ada('0xa'));var fs=require('fs');var _=require('lodash');var squel=require(_0x4ada('0xb'));var crypto=require(_0x4ada('0xc'));var jsforce=require(_0x4ada('0xd'));var deskjs=require('desk.js');var toCsv=require(_0x4ada('0x9'));var querystring=require(_0x4ada('0xe'));var Papa=require(_0x4ada('0xf'));var Redis=require(_0x4ada('0x10'));var authService=require(_0x4ada('0x11'));var qs=require(_0x4ada('0x12'));var as=require(_0x4ada('0x13'));var hardwareService=require(_0x4ada('0x14'));var logger=require('../../config/logger')(_0x4ada('0x15'));var utils=require(_0x4ada('0x16'));var config=require(_0x4ada('0x17'));var db=require(_0x4ada('0x18'))['db'];function respondWithStatusCode(_0x3aa681,_0x3b99c7){_0x3b99c7=_0x3b99c7||0xcc;return function(_0x3102b1){if(_0x3102b1){return _0x3aa681[_0x4ada('0x19')](_0x3b99c7);}return _0x3aa681[_0x4ada('0x1a')](_0x3b99c7)[_0x4ada('0x1b')]();};}function respondWithResult(_0x5460b1,_0x4dfb50){_0x4dfb50=_0x4dfb50||0xc8;return function(_0x4209f9){if(_0x4209f9){return _0x5460b1[_0x4ada('0x1a')](_0x4dfb50)[_0x4ada('0x1c')](_0x4209f9);}};}function respondWithFilteredResult(_0xded766,_0x5098ed){return function(_0x4f9de9){if(_0x4f9de9){var _0x3e8f31=_0x4f9de9[_0x4ada('0x1d')],_0xe987ac=_0x5098ed['offset'],_0x237b73=_0x5098ed[_0x4ada('0x1e')]+_0x5098ed[_0x4ada('0x1f')],_0x1afc00;if(_0x237b73>=_0x3e8f31){_0x237b73=_0x3e8f31;_0x1afc00=0xc8;}else{_0x1afc00=0xce;}_0xded766[_0x4ada('0x1a')](_0x1afc00);return _0xded766[_0x4ada('0x20')](_0x4ada('0x21'),_0xe987ac+'-'+_0x237b73+'/'+_0x3e8f31)[_0x4ada('0x1c')](_0x4f9de9);}return null;};}function patchUpdates(_0x2126c7){return function(_0x442af9){try{jsonpatch[_0x4ada('0x22')](_0x442af9,_0x2126c7,!![]);}catch(_0x4a93d0){return BPromise[_0x4ada('0x23')](_0x4a93d0);}return _0x442af9[_0x4ada('0x24')]();};}function saveUpdates(_0x1e4b39,_0x2d93d4){return function(_0x4ba1e8){if(_0x4ba1e8){return _0x4ba1e8[_0x4ada('0x25')](_0x1e4b39)[_0x4ada('0x26')](function(_0xd0154b){return _0xd0154b;});}return null;};}function removeEntity(_0x15bd5a,_0x21e592){return function(_0x3202d5){if(_0x3202d5){return _0x3202d5['destroy']()[_0x4ada('0x26')](function(){_0x15bd5a[_0x4ada('0x1a')](0xcc)[_0x4ada('0x1b')]();});}};}function handleEntityNotFound(_0xf830cc,_0x22e4fd){return function(_0x66473f){if(!_0x66473f){_0xf830cc['sendStatus'](0x194);}return _0x66473f;};}function handleError(_0x3b3cca,_0x29bf2d){_0x29bf2d=_0x29bf2d||0x1f4;return function(_0x2207e9){logger[_0x4ada('0x27')](_0x2207e9[_0x4ada('0x28')]);if(_0x2207e9[_0x4ada('0x29')]){delete _0x2207e9['name'];}_0x3b3cca['status'](_0x29bf2d)[_0x4ada('0x2a')](_0x2207e9);};}exports[_0x4ada('0x2b')]=function(_0x38e6a1,_0x553802){var _0x1291d3={'raw':!![],'where':{'id':_0x38e6a1[_0x4ada('0x2c')]['id']}},_0x3d254b={};_0x3d254b['model']=_[_0x4ada('0x2d')](db['MailApplication'][_0x4ada('0x2e')]);_0x3d254b[_0x4ada('0x2f')]=_[_0x4ada('0x2d')](_0x38e6a1[_0x4ada('0x2f')]);_0x3d254b[_0x4ada('0x30')]=_[_0x4ada('0x31')](_0x3d254b[_0x4ada('0x32')],_0x3d254b['query']);_0x1291d3[_0x4ada('0x33')]=_[_0x4ada('0x31')](_0x3d254b['model'],qs[_0x4ada('0x34')](_0x38e6a1[_0x4ada('0x2f')]['fields']));_0x1291d3[_0x4ada('0x33')]=_0x1291d3[_0x4ada('0x33')]['length']?_0x1291d3[_0x4ada('0x33')]:_0x3d254b[_0x4ada('0x32')];if(_0x38e6a1[_0x4ada('0x2f')]['includeAll']){_0x1291d3[_0x4ada('0x35')]=[{'all':!![]}];}_0x1291d3=_[_0x4ada('0x36')]({},_0x1291d3,_0x38e6a1[_0x4ada('0x37')]);return db[_0x4ada('0x38')][_0x4ada('0x39')](_0x1291d3)['then'](handleEntityNotFound(_0x553802,null))[_0x4ada('0x26')](respondWithResult(_0x553802,null))[_0x4ada('0x3a')](handleError(_0x553802,null));};exports['update']=function(_0x34b0d8,_0x55ad7d){if(_0x34b0d8[_0x4ada('0x3b')]['id']){delete _0x34b0d8[_0x4ada('0x3b')]['id'];}return db[_0x4ada('0x38')][_0x4ada('0x39')]({'where':{'id':_0x34b0d8[_0x4ada('0x2c')]['id']}})[_0x4ada('0x26')](handleEntityNotFound(_0x55ad7d,null))[_0x4ada('0x26')](saveUpdates(_0x34b0d8[_0x4ada('0x3b')],null))[_0x4ada('0x26')](respondWithResult(_0x55ad7d,null))['catch'](handleError(_0x55ad7d,null));};exports['destroy']=function(_0x4e1353,_0x1e9430){return db[_0x4ada('0x38')][_0x4ada('0x39')]({'where':{'id':_0x4e1353[_0x4ada('0x2c')]['id']}})[_0x4ada('0x26')](handleEntityNotFound(_0x1e9430,null))[_0x4ada('0x26')](removeEntity(_0x1e9430,null))[_0x4ada('0x3a')](handleError(_0x1e9430,null));}; \ No newline at end of file +var _0x266b=['body','eml-format','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','to-csv','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','status','end','count','offset','Content-Range','json','apply','save','then','destroy','error','name','send','show','params','model','MailApplication','query','filters','intersection','attributes','length','includeAll','merge','options','find','catch','update'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x266b,0x12d));var _0xb266=function(_0xdebb57,_0xb72a12){_0xdebb57=_0xdebb57-0x0;var _0x524cde=_0x266b[_0xdebb57];return _0x524cde;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0xb266('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xb266('0x1'));var jsonpatch=require(_0xb266('0x2'));var rp=require('request-promise');var moment=require(_0xb266('0x3'));var BPromise=require(_0xb266('0x4'));var Mustache=require(_0xb266('0x5'));var util=require(_0xb266('0x6'));var path=require(_0xb266('0x7'));var sox=require('sox');var csv=require(_0xb266('0x8'));var ejs=require('ejs');var fs=require('fs');var _=require(_0xb266('0x9'));var squel=require(_0xb266('0xa'));var crypto=require('crypto');var jsforce=require(_0xb266('0xb'));var deskjs=require(_0xb266('0xc'));var toCsv=require(_0xb266('0x8'));var querystring=require(_0xb266('0xd'));var Papa=require(_0xb266('0xe'));var Redis=require(_0xb266('0xf'));var authService=require('../../components/auth/service');var qs=require(_0xb266('0x10'));var as=require(_0xb266('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xb266('0x12'))(_0xb266('0x13'));var utils=require(_0xb266('0x14'));var config=require('../../config/environment');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x50d6be,_0x578fee){_0x578fee=_0x578fee||0xcc;return function(_0x2d18a6){if(_0x2d18a6){return _0x50d6be['sendStatus'](_0x578fee);}return _0x50d6be[_0xb266('0x15')](_0x578fee)[_0xb266('0x16')]();};}function respondWithResult(_0x152d74,_0x2264de){_0x2264de=_0x2264de||0xc8;return function(_0x22c88d){if(_0x22c88d){return _0x152d74[_0xb266('0x15')](_0x2264de)['json'](_0x22c88d);}};}function respondWithFilteredResult(_0x13447d,_0x484694){return function(_0x34ed2d){if(_0x34ed2d){var _0x5791bb=_0x34ed2d[_0xb266('0x17')],_0x32a3a1=_0x484694[_0xb266('0x18')],_0x189325=_0x484694[_0xb266('0x18')]+_0x484694['limit'],_0x54ef5e;if(_0x189325>=_0x5791bb){_0x189325=_0x5791bb;_0x54ef5e=0xc8;}else{_0x54ef5e=0xce;}_0x13447d['status'](_0x54ef5e);return _0x13447d['set'](_0xb266('0x19'),_0x32a3a1+'-'+_0x189325+'/'+_0x5791bb)[_0xb266('0x1a')](_0x34ed2d);}return null;};}function patchUpdates(_0x3d698e){return function(_0x38422d){try{jsonpatch[_0xb266('0x1b')](_0x38422d,_0x3d698e,!![]);}catch(_0xa4003a){return BPromise['reject'](_0xa4003a);}return _0x38422d[_0xb266('0x1c')]();};}function saveUpdates(_0x911a61,_0x266432){return function(_0x21628f){if(_0x21628f){return _0x21628f['update'](_0x911a61)[_0xb266('0x1d')](function(_0x3a785f){return _0x3a785f;});}return null;};}function removeEntity(_0x1e417f,_0xcf5124){return function(_0x8f9c9d){if(_0x8f9c9d){return _0x8f9c9d[_0xb266('0x1e')]()[_0xb266('0x1d')](function(){_0x1e417f['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x2ebc15,_0x4e53e4){return function(_0x15fe9d){if(!_0x15fe9d){_0x2ebc15['sendStatus'](0x194);}return _0x15fe9d;};}function handleError(_0x1c68ec,_0x463f1f){_0x463f1f=_0x463f1f||0x1f4;return function(_0x556983){logger[_0xb266('0x1f')](_0x556983['stack']);if(_0x556983['name']){delete _0x556983[_0xb266('0x20')];}_0x1c68ec[_0xb266('0x15')](_0x463f1f)[_0xb266('0x21')](_0x556983);};}exports[_0xb266('0x22')]=function(_0x4d0e33,_0xd92213){var _0x5283aa={'raw':!![],'where':{'id':_0x4d0e33[_0xb266('0x23')]['id']}},_0x55e4b0={};_0x55e4b0[_0xb266('0x24')]=_['keys'](db[_0xb266('0x25')]['rawAttributes']);_0x55e4b0[_0xb266('0x26')]=_['keys'](_0x4d0e33['query']);_0x55e4b0[_0xb266('0x27')]=_[_0xb266('0x28')](_0x55e4b0[_0xb266('0x24')],_0x55e4b0[_0xb266('0x26')]);_0x5283aa['attributes']=_[_0xb266('0x28')](_0x55e4b0['model'],qs['fields'](_0x4d0e33[_0xb266('0x26')]['fields']));_0x5283aa['attributes']=_0x5283aa[_0xb266('0x29')][_0xb266('0x2a')]?_0x5283aa[_0xb266('0x29')]:_0x55e4b0[_0xb266('0x24')];if(_0x4d0e33[_0xb266('0x26')][_0xb266('0x2b')]){_0x5283aa['include']=[{'all':!![]}];}_0x5283aa=_[_0xb266('0x2c')]({},_0x5283aa,_0x4d0e33[_0xb266('0x2d')]);return db[_0xb266('0x25')][_0xb266('0x2e')](_0x5283aa)['then'](handleEntityNotFound(_0xd92213,null))['then'](respondWithResult(_0xd92213,null))[_0xb266('0x2f')](handleError(_0xd92213,null));};exports[_0xb266('0x30')]=function(_0x4cb64a,_0x1991a2){if(_0x4cb64a['body']['id']){delete _0x4cb64a[_0xb266('0x31')]['id'];}return db[_0xb266('0x25')][_0xb266('0x2e')]({'where':{'id':_0x4cb64a[_0xb266('0x23')]['id']}})[_0xb266('0x1d')](handleEntityNotFound(_0x1991a2,null))[_0xb266('0x1d')](saveUpdates(_0x4cb64a[_0xb266('0x31')],null))['then'](respondWithResult(_0x1991a2,null))[_0xb266('0x2f')](handleError(_0x1991a2,null));};exports[_0xb266('0x1e')]=function(_0x1ec50b,_0x59b4c9){return db['MailApplication'][_0xb266('0x2e')]({'where':{'id':_0x1ec50b['params']['id']}})[_0xb266('0x1d')](handleEntityNotFound(_0x59b4c9,null))[_0xb266('0x1d')](removeEntity(_0x59b4c9,null))[_0xb266('0x2f')](handleError(_0x59b4c9,null));}; \ No newline at end of file diff --git a/server/api/mailApplication/mailApplication.model.js b/server/api/mailApplication/mailApplication.model.js index bc21af6..9e7c4d7 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 _0x7096=['rimraf','../../config/environment','./mailApplication.attributes','exports','define','MailApplication','mail_applications','utf8mb4','util','api','bluebird','request-promise','path'];(function(_0x3593be,_0x5ba521){var _0x29fe0a=function(_0x2fd98f){while(--_0x2fd98f){_0x3593be['push'](_0x3593be['shift']());}};_0x29fe0a(++_0x5ba521);}(_0x7096,0x10c));var _0x6709=function(_0x491a7f,_0x28bb80){_0x491a7f=_0x491a7f-0x0;var _0x3d8f44=_0x7096[_0x491a7f];return _0x3d8f44;};'use strict';var _=require('lodash');var util=require(_0x6709('0x0'));var logger=require('../../config/logger')(_0x6709('0x1'));var moment=require('moment');var BPromise=require(_0x6709('0x2'));var rp=require(_0x6709('0x3'));var fs=require('fs');var path=require(_0x6709('0x4'));var rimraf=require(_0x6709('0x5'));var config=require(_0x6709('0x6'));var attributes=require(_0x6709('0x7'));module[_0x6709('0x8')]=function(_0x9d630f,_0xa35832){return _0x9d630f[_0x6709('0x9')](_0x6709('0xa'),attributes,{'tableName':_0x6709('0xb'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x6709('0xc'),'collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file +var _0xb91a=['../../config/logger','api','moment','request-promise','path','../../config/environment','MailApplication','mail_applications','utf8mb4_unicode_ci','util'];(function(_0x25e7cb,_0x3579b7){var _0x375d92=function(_0xe8cf3b){while(--_0xe8cf3b){_0x25e7cb['push'](_0x25e7cb['shift']());}};_0x375d92(++_0x3579b7);}(_0xb91a,0xe5));var _0xab91=function(_0x21396f,_0x4e4857){_0x21396f=_0x21396f-0x0;var _0x5a30ed=_0xb91a[_0x21396f];return _0x5a30ed;};'use strict';var _=require('lodash');var util=require(_0xab91('0x0'));var logger=require(_0xab91('0x1'))(_0xab91('0x2'));var moment=require(_0xab91('0x3'));var BPromise=require('bluebird');var rp=require(_0xab91('0x4'));var fs=require('fs');var path=require(_0xab91('0x5'));var rimraf=require('rimraf');var config=require(_0xab91('0x6'));var attributes=require('./mailApplication.attributes');module['exports']=function(_0x1f99d4,_0x1cce1e){return _0x1f99d4['define'](_0xab91('0x7'),attributes,{'tableName':_0xab91('0x8'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':'utf8mb4','collate':_0xab91('0x9')});}; \ No newline at end of file diff --git a/server/api/mailApplication/mailApplication.rpc.js b/server/api/mailApplication/mailApplication.rpc.js index 3dbbf98..eb5f440 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 _0x3e21=['where','limit','then','stringify','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','client','http','request','MailApplication,\x20%s,\x20%s','debug','MailApplication,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','info','result','catch','UpdateMailApplication','MailApplication','body','options','raw'];(function(_0x50a0c2,_0x4befab){var _0x5ebadd=function(_0x3a3342){while(--_0x3a3342){_0x50a0c2['push'](_0x50a0c2['shift']());}};_0x5ebadd(++_0x4befab);}(_0x3e21,0x112));var _0x13e2=function(_0x51fafd,_0x2f5f06){_0x51fafd=_0x51fafd-0x0;var _0x1a27f3=_0x3e21[_0x51fafd];return _0x1a27f3;};'use strict';var _=require('lodash');var util=require(_0x13e2('0x0'));var moment=require(_0x13e2('0x1'));var BPromise=require(_0x13e2('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x13e2('0x3'));var db=require(_0x13e2('0x4'))['db'];var utils=require(_0x13e2('0x5'));var logger=require(_0x13e2('0x6'))(_0x13e2('0x7'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x13e2('0x8')][_0x13e2('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x44ba76,_0x44175f,_0x24120f){return new BPromise(function(_0x191e7d,_0x16e066){return client[_0x13e2('0xa')](_0x44ba76,_0x24120f)['then'](function(_0x299daf){logger['info'](_0x13e2('0xb'),_0x44175f,'request\x20sent');logger[_0x13e2('0xc')](_0x13e2('0xd'),_0x44175f,_0x13e2('0xe'),JSON['stringify'](_0x299daf));if(_0x299daf[_0x13e2('0xf')]){if(_0x299daf[_0x13e2('0xf')][_0x13e2('0x10')]===0x1f4){logger[_0x13e2('0xf')](_0x13e2('0xb'),_0x44175f,_0x299daf['error'][_0x13e2('0x11')]);return _0x16e066(_0x299daf[_0x13e2('0xf')]['message']);}logger[_0x13e2('0xf')]('MailApplication,\x20%s,\x20%s',_0x44175f,_0x299daf[_0x13e2('0xf')]['message']);return _0x191e7d(_0x299daf['error'][_0x13e2('0x11')]);}else{logger[_0x13e2('0x12')](_0x13e2('0xb'),_0x44175f,_0x13e2('0xe'));_0x191e7d(_0x299daf[_0x13e2('0x13')][_0x13e2('0x11')]);}})[_0x13e2('0x14')](function(_0x33cb72){logger[_0x13e2('0xf')](_0x13e2('0xb'),_0x44175f,_0x33cb72);_0x16e066(_0x33cb72);});});}exports[_0x13e2('0x15')]=function(_0x7d66e3){var _0x3f16bf=this;return new Promise(function(_0x5ad553,_0x3b8f25){return db[_0x13e2('0x16')]['update'](_0x7d66e3[_0x13e2('0x17')],{'raw':_0x7d66e3[_0x13e2('0x18')]?_0x7d66e3['options'][_0x13e2('0x19')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x7d66e3[_0x13e2('0x18')]?_0x7d66e3[_0x13e2('0x18')][_0x13e2('0x1a')]||null:null,'attributes':_0x7d66e3[_0x13e2('0x18')]?_0x7d66e3[_0x13e2('0x18')]['attributes']||null:null,'limit':_0x7d66e3[_0x13e2('0x18')]?_0x7d66e3['options'][_0x13e2('0x1b')]||null:null})[_0x13e2('0x1c')](function(_0x342f7d){logger[_0x13e2('0x12')](_0x13e2('0x15'),_0x7d66e3);logger['debug'](_0x13e2('0x15'),_0x7d66e3,JSON[_0x13e2('0x1d')](_0x342f7d));_0x5ad553(_0x342f7d);})[_0x13e2('0x14')](function(_0x5f3a0d){logger[_0x13e2('0xf')](_0x13e2('0x15'),_0x5f3a0d[_0x13e2('0x11')],_0x7d66e3);_0x3b8f25(_0x3f16bf['error'](0x1f4,_0x5f3a0d[_0x13e2('0x11')]));});});}; \ No newline at end of file +var _0x0734=['options','raw','where','limit','then','UpdateMailApplication','stringify','lodash','util','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','request','info','MailApplication,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','MailApplication,\x20%s,\x20%s','message','result','catch','MailApplication','body'];(function(_0x73d817,_0x54eed1){var _0x178cf8=function(_0x3cdf24){while(--_0x3cdf24){_0x73d817['push'](_0x73d817['shift']());}};_0x178cf8(++_0x54eed1);}(_0x0734,0x16f));var _0x4073=function(_0x3767c4,_0x2f77e8){_0x3767c4=_0x3767c4-0x0;var _0x35c2b7=_0x0734[_0x3767c4];return _0x35c2b7;};'use strict';var _=require(_0x4073('0x0'));var util=require(_0x4073('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x4073('0x2'));var fs=require('fs');var Redis=require(_0x4073('0x3'));var db=require(_0x4073('0x4'))['db'];var utils=require(_0x4073('0x5'));var logger=require('../../config/logger')(_0x4073('0x6'));var config=require(_0x4073('0x7'));var jayson=require(_0x4073('0x8'));var client=jayson[_0x4073('0x9')][_0x4073('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x10f868,_0x5ce9aa,_0x4f53a7){return new BPromise(function(_0x5861c0,_0x140b77){return client[_0x4073('0xb')](_0x10f868,_0x4f53a7)['then'](function(_0x30b738){logger[_0x4073('0xc')]('MailApplication,\x20%s,\x20%s',_0x5ce9aa,'request\x20sent');logger['debug'](_0x4073('0xd'),_0x5ce9aa,_0x4073('0xe'),JSON['stringify'](_0x30b738));if(_0x30b738[_0x4073('0xf')]){if(_0x30b738['error'][_0x4073('0x10')]===0x1f4){logger['error'](_0x4073('0x11'),_0x5ce9aa,_0x30b738[_0x4073('0xf')][_0x4073('0x12')]);return _0x140b77(_0x30b738[_0x4073('0xf')][_0x4073('0x12')]);}logger[_0x4073('0xf')](_0x4073('0x11'),_0x5ce9aa,_0x30b738[_0x4073('0xf')][_0x4073('0x12')]);return _0x5861c0(_0x30b738['error'][_0x4073('0x12')]);}else{logger[_0x4073('0xc')](_0x4073('0x11'),_0x5ce9aa,_0x4073('0xe'));_0x5861c0(_0x30b738[_0x4073('0x13')][_0x4073('0x12')]);}})[_0x4073('0x14')](function(_0x22d519){logger[_0x4073('0xf')](_0x4073('0x11'),_0x5ce9aa,_0x22d519);_0x140b77(_0x22d519);});});}exports['UpdateMailApplication']=function(_0x33bedc){var _0x186ba1=this;return new Promise(function(_0xe9273d,_0x1e470a){return db[_0x4073('0x15')]['update'](_0x33bedc[_0x4073('0x16')],{'raw':_0x33bedc[_0x4073('0x17')]?_0x33bedc[_0x4073('0x17')][_0x4073('0x18')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x33bedc[_0x4073('0x17')]?_0x33bedc[_0x4073('0x17')][_0x4073('0x19')]||null:null,'attributes':_0x33bedc['options']?_0x33bedc[_0x4073('0x17')]['attributes']||null:null,'limit':_0x33bedc['options']?_0x33bedc[_0x4073('0x17')][_0x4073('0x1a')]||null:null})[_0x4073('0x1b')](function(_0x39f36e){logger[_0x4073('0xc')]('UpdateMailApplication',_0x33bedc);logger['debug'](_0x4073('0x1c'),_0x33bedc,JSON[_0x4073('0x1d')](_0x39f36e));_0xe9273d(_0x39f36e);})['catch'](function(_0x4559e9){logger[_0x4073('0xf')]('UpdateMailApplication',_0x4559e9[_0x4073('0x12')],_0x33bedc);_0x1e470a(_0x186ba1[_0x4073('0xf')](0x1f4,_0x4559e9[_0x4073('0x12')]));});});}; \ No newline at end of file diff --git a/server/api/mailInteraction/index.js b/server/api/mailInteraction/index.js index d82312f..0d8c5b2 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 _0xbe10=['addMessage','/:id/tags','tracked','mail','addTags','mailinteraction:update','update','/:id','mailinteraction:destroy','destroy','delete','removeTags','multer','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','./mailInteraction.controller','get','isAuthenticated','index','/describe','describe','show','/:id/messages','getMessages','/:id/download','download','post'];(function(_0x1ccbcc,_0x5c948b){var _0x1e873f=function(_0x4f232e){while(--_0x4f232e){_0x1ccbcc['push'](_0x1ccbcc['shift']());}};_0x1e873f(++_0x5c948b);}(_0xbe10,0x174));var _0x0be1=function(_0x12fc8d,_0x19ee33){_0x12fc8d=_0x12fc8d-0x0;var _0x3f9d04=_0xbe10[_0x12fc8d];return _0x3f9d04;};'use strict';var multer=require(_0x0be1('0x0'));var util=require('util');var path=require('path');var timeout=require(_0x0be1('0x1'));var express=require(_0x0be1('0x2'));var router=express[_0x0be1('0x3')]();var auth=require(_0x0be1('0x4'));var interaction=require(_0x0be1('0x5'));var config=require('../../config/environment');var controller=require(_0x0be1('0x6'));router[_0x0be1('0x7')]('/',auth[_0x0be1('0x8')](),controller[_0x0be1('0x9')]);router[_0x0be1('0x7')](_0x0be1('0xa'),auth[_0x0be1('0x8')](),controller[_0x0be1('0xb')]);router[_0x0be1('0x7')]('/:id',auth[_0x0be1('0x8')](),controller[_0x0be1('0xc')]);router['get'](_0x0be1('0xd'),auth[_0x0be1('0x8')](),controller[_0x0be1('0xe')]);router[_0x0be1('0x7')](_0x0be1('0xf'),auth[_0x0be1('0x8')](),controller[_0x0be1('0x10')]);router[_0x0be1('0x11')]('/',auth['isAuthenticated'](),controller['create']);router[_0x0be1('0x11')](_0x0be1('0xd'),auth['isAuthenticated'](),controller[_0x0be1('0x12')]);router['post'](_0x0be1('0x13'),auth[_0x0be1('0x8')](),interaction[_0x0be1('0x14')](_0x0be1('0x15'),'mailinteraction:addtags'),controller[_0x0be1('0x16')]);router['put']('/:id',auth[_0x0be1('0x8')](),interaction[_0x0be1('0x14')](_0x0be1('0x15'),_0x0be1('0x17')),controller[_0x0be1('0x18')]);router['delete'](_0x0be1('0x19'),auth[_0x0be1('0x8')](),interaction[_0x0be1('0x14')](_0x0be1('0x15'),_0x0be1('0x1a')),controller[_0x0be1('0x1b')]);router[_0x0be1('0x1c')]('/:id/tags',auth[_0x0be1('0x8')](),controller[_0x0be1('0x1d')]);module['exports']=router; \ No newline at end of file +var _0xf50b=['express','Router','../../components/auth/service','../../config/environment','get','isAuthenticated','index','/describe','describe','/:id','show','getMessages','download','post','create','/:id/messages','addMessage','/:id/tags','tracked','put','mail','update','mailinteraction:destroy','destroy','delete','exports','multer','util','connect-timeout'];(function(_0x2083b1,_0x199bee){var _0x17e6a3=function(_0x169e7b){while(--_0x169e7b){_0x2083b1['push'](_0x2083b1['shift']());}};_0x17e6a3(++_0x199bee);}(_0xf50b,0xc8));var _0xbf50=function(_0x35aa00,_0x523dbe){_0x35aa00=_0x35aa00-0x0;var _0x5ebea0=_0xf50b[_0x35aa00];return _0x5ebea0;};'use strict';var multer=require(_0xbf50('0x0'));var util=require(_0xbf50('0x1'));var path=require('path');var timeout=require(_0xbf50('0x2'));var express=require(_0xbf50('0x3'));var router=express[_0xbf50('0x4')]();var auth=require(_0xbf50('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0xbf50('0x6'));var controller=require('./mailInteraction.controller');router[_0xbf50('0x7')]('/',auth[_0xbf50('0x8')](),controller[_0xbf50('0x9')]);router[_0xbf50('0x7')](_0xbf50('0xa'),auth[_0xbf50('0x8')](),controller[_0xbf50('0xb')]);router['get'](_0xbf50('0xc'),auth[_0xbf50('0x8')](),controller[_0xbf50('0xd')]);router['get']('/:id/messages',auth[_0xbf50('0x8')](),controller[_0xbf50('0xe')]);router[_0xbf50('0x7')]('/:id/download',auth[_0xbf50('0x8')](),controller[_0xbf50('0xf')]);router[_0xbf50('0x10')]('/',auth[_0xbf50('0x8')](),controller[_0xbf50('0x11')]);router[_0xbf50('0x10')](_0xbf50('0x12'),auth['isAuthenticated'](),controller[_0xbf50('0x13')]);router[_0xbf50('0x10')](_0xbf50('0x14'),auth[_0xbf50('0x8')](),interaction[_0xbf50('0x15')]('mail','mailinteraction:addtags'),controller['addTags']);router[_0xbf50('0x16')]('/:id',auth[_0xbf50('0x8')](),interaction[_0xbf50('0x15')](_0xbf50('0x17'),'mailinteraction:update'),controller[_0xbf50('0x18')]);router['delete'](_0xbf50('0xc'),auth[_0xbf50('0x8')](),interaction[_0xbf50('0x15')]('mail',_0xbf50('0x19')),controller[_0xbf50('0x1a')]);router[_0xbf50('0x1b')](_0xbf50('0x14'),auth[_0xbf50('0x8')](),controller['removeTags']);module[_0xbf50('0x1c')]=router; \ No newline at end of file diff --git a/server/api/mailInteraction/mailInteraction.attributes.js b/server/api/mailInteraction/mailInteraction.attributes.js index 91e7370..f258c81 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 _0xa05d=['STRING','TEXT','long','ENUM','out','iconv','exports','BOOLEAN','DATE'];(function(_0x1e6e0f,_0x145b99){var _0x100aa4=function(_0x2746fb){while(--_0x2746fb){_0x1e6e0f['push'](_0x1e6e0f['shift']());}};_0x100aa4(++_0x145b99);}(_0xa05d,0xdd));var _0xda05=function(_0x32f2b5,_0x3e7573){_0x32f2b5=_0x32f2b5-0x0;var _0x4acddb=_0xa05d[_0x32f2b5];return _0x4acddb;};'use strict';var Sequelize=require('sequelize');var iconv=require(_0xda05('0x0'));module[_0xda05('0x1')]={'closed':{'type':Sequelize[_0xda05('0x2')],'defaultValue':![]},'closedAt':{'type':Sequelize[_0xda05('0x3')]},'disposition':{'type':Sequelize[_0xda05('0x4')]},'note':{'type':Sequelize[_0xda05('0x4')]},'inReplyTo':{'type':Sequelize[_0xda05('0x4')](0x1fe)},'to':{'type':Sequelize[_0xda05('0x4')]},'cc':{'type':Sequelize[_0xda05('0x5')](_0xda05('0x6'))},'subject':{'type':Sequelize[_0xda05('0x5')]()},'attach':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'read1stAt':{'type':Sequelize[_0xda05('0x3')]},'substatus':{'type':Sequelize[_0xda05('0x4')](0x3c)},'substatusAt':{'type':Sequelize[_0xda05('0x3')]},'firstMsgDirection':{'type':Sequelize[_0xda05('0x7')]('in',_0xda05('0x8')),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize[_0xda05('0x3')]},'lastMsgDirection':{'type':Sequelize[_0xda05('0x7')]('in',_0xda05('0x8')),'defaultValue':'in','allowNull':![]},'lastMsgBody':{'type':Sequelize[_0xda05('0x5')](_0xda05('0x6'))},'lastMsgText':{'type':Sequelize['TEXT'](_0xda05('0x6'))}}; \ No newline at end of file +var _0x031d=['out','sequelize','iconv','exports','BOOLEAN','DATE','STRING','TEXT','long','ENUM'];(function(_0x486919,_0x1ff17d){var _0x30d637=function(_0x5ed82e){while(--_0x5ed82e){_0x486919['push'](_0x486919['shift']());}};_0x30d637(++_0x1ff17d);}(_0x031d,0x14b));var _0xd031=function(_0x17928f,_0x4ad33f){_0x17928f=_0x17928f-0x0;var _0x500b63=_0x031d[_0x17928f];return _0x500b63;};'use strict';var Sequelize=require(_0xd031('0x0'));var iconv=require(_0xd031('0x1'));module[_0xd031('0x2')]={'closed':{'type':Sequelize[_0xd031('0x3')],'defaultValue':![]},'closedAt':{'type':Sequelize[_0xd031('0x4')]},'disposition':{'type':Sequelize[_0xd031('0x5')]},'note':{'type':Sequelize[_0xd031('0x5')]},'inReplyTo':{'type':Sequelize['STRING'](0x1fe)},'to':{'type':Sequelize[_0xd031('0x5')]},'cc':{'type':Sequelize[_0xd031('0x6')](_0xd031('0x7'))},'subject':{'type':Sequelize[_0xd031('0x6')]()},'attach':{'type':Sequelize[_0xd031('0x3')],'defaultValue':![]},'read1stAt':{'type':Sequelize[_0xd031('0x4')]},'substatus':{'type':Sequelize[_0xd031('0x5')](0x3c)},'substatusAt':{'type':Sequelize[_0xd031('0x4')]},'firstMsgDirection':{'type':Sequelize[_0xd031('0x8')]('in',_0xd031('0x9')),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize[_0xd031('0x4')]},'lastMsgDirection':{'type':Sequelize[_0xd031('0x8')]('in','out'),'defaultValue':'in','allowNull':![]},'lastMsgBody':{'type':Sequelize[_0xd031('0x6')](_0xd031('0x7'))},'lastMsgText':{'type':Sequelize[_0xd031('0x6')](_0xd031('0x7'))}}; \ No newline at end of file diff --git a/server/api/mailInteraction/mailInteraction.controller.js b/server/api/mailInteraction/mailInteraction.controller.js index 0f73e83..500c340 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 _0x4b20=['redis','defaults','localhost','socket.io-emitter','register','sendStatus','end','status','json','count','offset','limit','set','Content-Range','apply','save','update','destroy','then','error','stack','name','send','Users','map','fullname','Tags','split','forEach','push','MailInteraction','lastMsgBody','lastMsgText','trimStart','fromString','catch','index','rawAttributes','fieldName','type','key','model','query','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','sort','where','pick','select','field','color','from','tools_tags','u.id','u.fullname','ui.MailInteractionId','left_join','users','u.id\x20=\x20ui.UserId','cm_contacts','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL','o.id\x20=\x20i.UserId','a.id\x20=\x20i.MailAccountId','me.MailInteractionId\x20=\x20i.id','mail_interaction_has_tags','it.MailInteractionId\x20=\x20i.id','expr','search','parseSearch','sqlOperator','conditions','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','text','start','Tag','CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','union','User','UserId','plainBody','keys','isEmpty','MailAccountId','parse','i.createdAt\x20BETWEEN\x20?\x20AND\x20?','null','\x20IS\x20NULL','\x20=\x20?','read','`unreadMessages`\x20=\x200','`unreadMessages`\x20>\x200','tag','isArray','replace','\x27\x27\x27\x27','isNumeric','i.id\x20LIKE\x20?','isEmail','c.email\x20LIKE\x20?','MATCH\x20(i.to,\x20i.subject)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','MATCH\x20(me.plainBody,\x20me.subject)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','group','i.id','Sequelize','QueryTypes','SELECT','order','DESC','t.id\x20IN\x20?','resolve','journey','i.MailAccountId\x20IS\x20NOT\x20NULL','getMailAccounts','i.MailAccountId\x20IS\x20NULL','i.MailAccountId\x20IN\x20?','toString','keyBy','merge','SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','Account.key','a.mandatoryDisposition','Account.mandatoryDisposition','i.createdAt','i.closed','i.closedAt','i.attach','i.lastMsgAt','i.lastMsgDirection','i.subject','i.substatus','i.ContactId','i.UserId','c.firstName','Contact.firstName','c.lastName','Contact.lastName','c.email','Contact.email','Contact.phone','c.mobile','Contact.mobile','Contact.fax','o.fullname','Owner.fullname','Owner.internal','GROUP_CONCAT(DISTINCT\x20t.id)','TagIds','ui.MailInteractionId\x20IN\x20?','sequelize','groupBy','Setting','enableEmailPreview','rows','show','params','includeAll','options','find','create','body','describe','addMessage','MailMessage','ids','omit','getMessages','MailInteractionId','filter','$gte','format','YYYY-MM-DD\x20HH:mm:ss','include','findAll','setTags','spread','emit','mailInteractionTags:save','removeTags','download','unix','root','server','files','tmp','join','attachments','transcript-%d-%s.zip','Attachments','bcc','subject','createdAt','get','mkdirSync','each','ddd,\x20DD\x20MMM\x20YYYY\x20HH:mm:ss\x20ZZ','headers','Bcc','basename','existsSync','readFileSync','writeFileSync','message%d.eml','log','err','zip-dir','fast-json-patch','bluebird','mustache','util','sox','ejs','lodash','crypto','to-csv','papaparse','html-to-text','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../mysqldb'];(function(_0x4166f6,_0x16207d){var _0x34df0d=function(_0x52eddf){while(--_0x52eddf){_0x4166f6['push'](_0x4166f6['shift']());}};_0x34df0d(++_0x16207d);}(_0x4b20,0xdb));var _0x04b2=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x4b20[_0x3dd15e];return _0x231fd0;};'use strict';var pdf=require('html-pdf');var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x04b2('0x0'));var jsonpatch=require(_0x04b2('0x1'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x04b2('0x2'));var Mustache=require(_0x04b2('0x3'));var util=require(_0x04b2('0x4'));var path=require('path');var sox=require(_0x04b2('0x5'));var csv=require('to-csv');var ejs=require(_0x04b2('0x6'));var fs=require('fs');var _=require(_0x04b2('0x7'));var squel=require('squel');var crypto=require(_0x04b2('0x8'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x04b2('0x9'));var querystring=require('querystring');var Papa=require(_0x04b2('0xa'));var htmlToText=require(_0x04b2('0xb'));var Redis=require(_0x04b2('0xc'));var authService=require(_0x04b2('0xd'));var qs=require(_0x04b2('0xe'));var as=require(_0x04b2('0xf'));var hardwareService=require(_0x04b2('0x10'));var logger=require(_0x04b2('0x11'))('api');var utils=require(_0x04b2('0x12'));var config=require(_0x04b2('0x13'));var db=require(_0x04b2('0x14'))['db'];config[_0x04b2('0x15')]=_[_0x04b2('0x16')](config[_0x04b2('0x15')],{'host':_0x04b2('0x17'),'port':0x18eb});var socket=require(_0x04b2('0x18'))(new Redis(config[_0x04b2('0x15')]));require('./mailInteraction.socket')[_0x04b2('0x19')](socket);function respondWithStatusCode(_0x52fdc7,_0x294046){_0x294046=_0x294046||0xcc;return function(_0x2fb5d3){if(_0x2fb5d3){return _0x52fdc7[_0x04b2('0x1a')](_0x294046);}return _0x52fdc7['status'](_0x294046)[_0x04b2('0x1b')]();};}function respondWithResult(_0x4ec02d,_0x14caac){_0x14caac=_0x14caac||0xc8;return function(_0x3fede8){if(_0x3fede8){return _0x4ec02d[_0x04b2('0x1c')](_0x14caac)[_0x04b2('0x1d')](_0x3fede8);}};}function respondWithFilteredResult(_0x108ce2,_0x1ab749){return function(_0x8c5794){if(_0x8c5794){var _0x17e956=_0x8c5794[_0x04b2('0x1e')],_0x43d4c4=_0x1ab749['offset'],_0x476820=_0x1ab749[_0x04b2('0x1f')]+_0x1ab749[_0x04b2('0x20')],_0x44cca8;if(_0x476820>=_0x17e956){_0x476820=_0x17e956;_0x44cca8=0xc8;}else{_0x44cca8=0xce;}_0x108ce2[_0x04b2('0x1c')](_0x44cca8);return _0x108ce2[_0x04b2('0x21')](_0x04b2('0x22'),_0x43d4c4+'-'+_0x476820+'/'+_0x17e956)['json'](_0x8c5794);}return null;};}function patchUpdates(_0x139212){return function(_0x3e6f09){try{jsonpatch[_0x04b2('0x23')](_0x3e6f09,_0x139212,!![]);}catch(_0x4f4ceb){return BPromise['reject'](_0x4f4ceb);}return _0x3e6f09[_0x04b2('0x24')]();};}function saveUpdates(_0x3def72,_0x1e52ce){return function(_0x2e7e7e){if(_0x2e7e7e){return _0x2e7e7e[_0x04b2('0x25')](_0x3def72)['then'](function(_0x4d7aeb){return _0x4d7aeb;});}return null;};}function removeEntity(_0x8ca15a,_0x4a316d){return function(_0x3a6aeb){if(_0x3a6aeb){return _0x3a6aeb[_0x04b2('0x26')]()[_0x04b2('0x27')](function(){_0x8ca15a[_0x04b2('0x1c')](0xcc)[_0x04b2('0x1b')]();});}};}function handleEntityNotFound(_0x3003cb,_0x13689a){return function(_0x444a60){if(!_0x444a60){_0x3003cb[_0x04b2('0x1a')](0x194);}return _0x444a60;};}function handleError(_0x3e1a91,_0x3f6a61){_0x3f6a61=_0x3f6a61||0x1f4;return function(_0x30daa0){logger[_0x04b2('0x28')](_0x30daa0[_0x04b2('0x29')]);if(_0x30daa0[_0x04b2('0x2a')]){delete _0x30daa0[_0x04b2('0x2a')];}_0x3e1a91['status'](_0x3f6a61)[_0x04b2('0x2b')](_0x30daa0);};}function getInteractionUsers(_0x1438f7,_0x26a745){return new BPromise(function(_0x364ba5,_0x4a8d65){try{if(_0x26a745[_0x1438f7['id']]){_0x1438f7[_0x04b2('0x2c')]=_[_0x04b2('0x2d')](_0x26a745[_0x1438f7['id']],function(_0x3cd478){return{'id':_0x3cd478['id'],'fullname':_0x3cd478[_0x04b2('0x2e')]};});}}catch(_0x7a9df5){_0x4a8d65(_0x7a9df5);}_0x364ba5(_0x1438f7);});}function getInteractionTags(_0x3bb2d0,_0xdd957d){return new BPromise(function(_0x40e976,_0x54695c){try{if(_0x3bb2d0['TagIds']){_0x3bb2d0[_0x04b2('0x2f')]=[];_0x3bb2d0['TagIds'][_0x04b2('0x30')](',')[_0x04b2('0x31')](function(_0x1df0ee){_0x3bb2d0[_0x04b2('0x2f')][_0x04b2('0x32')](_0xdd957d[_0x1df0ee]);});}delete _0x3bb2d0['TagIds'];}catch(_0x34963b){_0x54695c(_0x34963b);}_0x40e976(_0x3bb2d0);});}function getLastMessageText(_0x5b2158){return new BPromise(function(_0x163f7f,_0x12d3ee){return db[_0x04b2('0x33')]['findOne']({'where':{'id':_0x5b2158['id']},'attributes':[_0x04b2('0x34'),_0x04b2('0x35')],'raw':!![]})[_0x04b2('0x27')](function(_0x20f577){if(!_0x20f577[_0x04b2('0x35')]){_0x5b2158[_0x04b2('0x35')]=_[_0x04b2('0x36')](htmlToText[_0x04b2('0x37')](_0x20f577['lastMsgBody'],{'preserveNewlines':!![],'singleNewLineParagraphs':!![],'uppercaseHeadings':![],'noLinkBrackets':!![],'ignoreImage':!![]}));}else{_0x5b2158[_0x04b2('0x35')]=_0x20f577[_0x04b2('0x35')];}_0x163f7f(_0x5b2158);})[_0x04b2('0x38')](function(_0xf53af2){_0x12d3ee(_0xf53af2);});});}function updateMailInteraction(_0x3879ae,_0x40f4f3,_0x4328c8,_0x30e7d7){return new BPromise(function(_0x5c5635,_0x55b637){return getInteractionUsers(_0x3879ae,_0x4328c8)['then'](function(_0x5bcff5){return getInteractionTags(_0x5bcff5,_0x40f4f3);})['then'](function(_0x53fbd2){if(_0x30e7d7){_0x5c5635(getLastMessageText(_0x53fbd2));}else{_0x5c5635(_0x53fbd2);}})['catch'](function(_0x8f0ba1){_0x55b637(_0x8f0ba1);});});}exports[_0x04b2('0x39')]=function(_0x507cce,_0x5ea011){var _0x331d5c={},_0x17686c={},_0x390dd6={'count':0x0,'rows':[]};var _0x290c77=_['map'](db[_0x04b2('0x33')][_0x04b2('0x3a')],function(_0x11ea6f){return{'name':_0x11ea6f[_0x04b2('0x3b')],'type':_0x11ea6f[_0x04b2('0x3c')][_0x04b2('0x3d')]};});_0x17686c[_0x04b2('0x3e')]=_['map'](_0x290c77,_0x04b2('0x2a'));_0x17686c[_0x04b2('0x3f')]=_['keys'](_0x507cce['query']);_0x17686c[_0x04b2('0x40')]=_[_0x04b2('0x41')](_0x17686c['model'],_0x17686c[_0x04b2('0x3f')]);_0x331d5c['attributes']=_['intersection'](_0x17686c[_0x04b2('0x3e')],qs[_0x04b2('0x42')](_0x507cce[_0x04b2('0x3f')]['fields']));_0x331d5c['attributes']=_0x331d5c[_0x04b2('0x43')][_0x04b2('0x44')]?_0x331d5c[_0x04b2('0x43')]:_0x17686c[_0x04b2('0x3e')];if(!_0x507cce[_0x04b2('0x3f')][_0x04b2('0x45')](_0x04b2('0x46'))){_0x331d5c[_0x04b2('0x20')]=qs[_0x04b2('0x20')](_0x507cce['query']['limit']);_0x331d5c['offset']=qs[_0x04b2('0x1f')](_0x507cce[_0x04b2('0x3f')]['offset']);}_0x331d5c['order']=qs[_0x04b2('0x47')](_0x507cce[_0x04b2('0x3f')][_0x04b2('0x47')]);_0x331d5c[_0x04b2('0x48')]=qs[_0x04b2('0x40')](_[_0x04b2('0x49')](_0x507cce[_0x04b2('0x3f')],_0x17686c[_0x04b2('0x40')]));var _0x4285ad=[];var _0x53cef2=squel[_0x04b2('0x4a')]()[_0x04b2('0x4b')]('id')['field'](_0x04b2('0x2a'))[_0x04b2('0x4b')](_0x04b2('0x4c'))[_0x04b2('0x4d')](_0x04b2('0x4e'));var _0x2bcae2=squel[_0x04b2('0x4a')]()[_0x04b2('0x4b')](_0x04b2('0x4f'))['field'](_0x04b2('0x50'))[_0x04b2('0x4b')](_0x04b2('0x51'))['from']('user_has_mail_interactions','ui')[_0x04b2('0x52')](_0x04b2('0x53'),'u',_0x04b2('0x54'));var _0x5179a1=squel['select']()[_0x04b2('0x4d')]('mail_interactions','i')[_0x04b2('0x52')](_0x04b2('0x55'),'c',_0x04b2('0x56'))[_0x04b2('0x52')](_0x04b2('0x53'),'o',_0x04b2('0x57'))[_0x04b2('0x52')]('mail_accounts','a',_0x04b2('0x58'))[_0x04b2('0x52')]('mail_messages','me',_0x04b2('0x59'))[_0x04b2('0x52')](_0x04b2('0x5a'),'it',_0x04b2('0x5b'))['left_join'](_0x04b2('0x4e'),'t','t.id\x20=\x20it.TagId');var _0x24709c=squel[_0x04b2('0x5c')]();var _0x133f82=[];var _0xa8c71=squel[_0x04b2('0x5c')]();var _0x3486d8;if(_0x507cce[_0x04b2('0x3f')][_0x04b2('0x5d')]){_0x3486d8=as[_0x04b2('0x5e')](_0x507cce[_0x04b2('0x3f')][_0x04b2('0x5d')]);var _0x44bc64=_0x3486d8[_0x04b2('0x5f')];for(var _0x29e081=0x0;_0x29e081<_0x3486d8[_0x04b2('0x60')][_0x04b2('0x44')];_0x29e081++){var _0x5bd2e5=_0x3486d8[_0x04b2('0x60')][_0x29e081];var _0xf1cdb6='i';var _0x57cd1c=_['find'](_0x290c77,[_0x04b2('0x2a'),_0x5bd2e5[_0x04b2('0x4b')]]);if(!_0x57cd1c){switch(_0x5bd2e5[_0x04b2('0x4b')]){case _0x04b2('0x61'):if(_0x5bd2e5[_0x04b2('0x62')]==0x1){_0x5179a1[_0x04b2('0x63')]('`'+_0x5bd2e5[_0x04b2('0x4b')]+_0x04b2('0x64'));}else{_0x5179a1[_0x04b2('0x63')]('`'+_0x5bd2e5[_0x04b2('0x4b')]+'`\x20>\x200');}break;case _0x04b2('0x65'):if(_0x5bd2e5[_0x04b2('0x66')]===_0x04b2('0x67')){if(_0x5bd2e5['value'][_0x04b2('0x30')]('\x20')[_0x04b2('0x44')]>0x1){_0x24709c[_0x44bc64](_0x04b2('0x68'),qs[_0x04b2('0x69')](_0x5bd2e5[_0x04b2('0x62')]),null);}else{var _0x74860f='%'+_0x5bd2e5['value']+'%';_0x24709c[_0x44bc64]('c.firstName\x20LIKE\x20?\x20OR\x20c.lastName\x20LIKE\x20?\x20OR\x20c.email\x20LIKE\x20?',_0x74860f,_0x74860f,_0x74860f);}}else{_0x57cd1c=_['find'](_0x290c77,[_0x04b2('0x2a'),_0x04b2('0x6a')]);_0x5bd2e5[_0x04b2('0x4b')]=_0x04b2('0x6a');_0x576068=as[_0x04b2('0x6b')](_0xf1cdb6,_0x57cd1c[_0x04b2('0x3c')],_0x5bd2e5);_0x24709c[_0x44bc64](_0x576068[_0x04b2('0x6c')],_0x576068[_0x04b2('0x62')][_0x04b2('0x6d')],_0x576068['value']['end']);}break;case _0x04b2('0x6e'):var _0x364c5f=_0x5bd2e5[_0x04b2('0x62')][_0x04b2('0x30')](',')[_0x04b2('0x2d')](function(_0xd9cd8c){return Number(_0xd9cd8c);});_0x364c5f['forEach'](function(_0x1102da){_0xa8c71['or'](_0x04b2('0x6f'),'%,'+_0x1102da+',%');});_0x133f82=_[_0x04b2('0x70')](_0x133f82,_0x364c5f);break;case _0x04b2('0x71'):if(_0x5bd2e5[_0x04b2('0x66')]==='$substring'){_0x24709c[_0x44bc64]('CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?','%'+_0x5bd2e5[_0x04b2('0x62')]+'%',null);}else{_0x57cd1c=_['find'](_0x290c77,[_0x04b2('0x2a'),_0x04b2('0x72')]);_0x5bd2e5[_0x04b2('0x4b')]=_0x04b2('0x72');_0x576068=as[_0x04b2('0x6b')](_0xf1cdb6,_0x57cd1c[_0x04b2('0x3c')],_0x5bd2e5);_0x24709c[_0x44bc64](_0x576068['text'],_0x576068['value'][_0x04b2('0x6d')],_0x576068[_0x04b2('0x62')][_0x04b2('0x1b')]);}break;case _0x04b2('0x73'):_0x576068=as[_0x04b2('0x6b')]('me',null,_0x5bd2e5);_0x24709c[_0x44bc64](_0x576068[_0x04b2('0x6c')],_0x576068[_0x04b2('0x62')][_0x04b2('0x6d')],_0x576068[_0x04b2('0x62')][_0x04b2('0x1b')]);break;}}else{var _0x576068=as[_0x04b2('0x6b')](_0xf1cdb6,_0x57cd1c[_0x04b2('0x3c')],_0x5bd2e5);_0x24709c[_0x44bc64](_0x576068[_0x04b2('0x6c')],_0x576068['value']['start'],_0x576068[_0x04b2('0x62')][_0x04b2('0x1b')]);}}}else{var _0x28648d=_(_0x507cce[_0x04b2('0x3f')])[_0x04b2('0x74')]()[_0x04b2('0x2d')](function(_0x12de9f){return _['some'](_0x290c77,[_0x04b2('0x2a'),_0x12de9f])?_0x12de9f:undefined;})['compact']()[_0x04b2('0x62')]();if(!_[_0x04b2('0x75')](_0x28648d)){_0x28648d['forEach'](function(_0x20cfc6){if(_0x20cfc6===_0x04b2('0x76')){_0x5179a1[_0x04b2('0x48')]('i.MailAccountId\x20IN\x20?',[]['concat'](_0x507cce['query'][_0x20cfc6]));}else if(_0x20cfc6==='createdAt'){var _0x4cb7dc=JSON[_0x04b2('0x77')](_0x507cce[_0x04b2('0x3f')][_0x20cfc6])['$gte'];var _0x16087c=JSON[_0x04b2('0x77')](_0x507cce[_0x04b2('0x3f')][_0x20cfc6])['$lte'];_0x5179a1[_0x04b2('0x48')](_0x04b2('0x78'),_0x4cb7dc,_0x16087c);}else{if(_0x507cce['query'][_0x20cfc6]===_0x04b2('0x79')){_0x5179a1[_0x04b2('0x48')]('i.'+_0x20cfc6+_0x04b2('0x7a'));}else{_0x5179a1[_0x04b2('0x48')]('i.'+_0x20cfc6+_0x04b2('0x7b'),_0x507cce['query'][_0x20cfc6]);}}});}if(_0x507cce[_0x04b2('0x3f')][_0x04b2('0x7c')]){if(_0x507cce[_0x04b2('0x3f')][_0x04b2('0x7c')]==0x1){_0x5179a1['having'](_0x04b2('0x7d'));}else{_0x5179a1[_0x04b2('0x63')](_0x04b2('0x7e'));}}if(_0x507cce[_0x04b2('0x3f')][_0x04b2('0x7f')]){_0x133f82=_[_0x04b2('0x80')](_0x507cce['query'][_0x04b2('0x7f')])?_0x507cce[_0x04b2('0x3f')]['tag']:new Array(_0x507cce[_0x04b2('0x3f')][_0x04b2('0x7f')]);_0x133f82[_0x04b2('0x31')](function(_0x93b0f9){_0xa8c71['or'](_0x04b2('0x6f'),'%,'+_0x93b0f9+',%');});}if(_0x507cce['query']['filter']){var _0x578580=_0x507cce[_0x04b2('0x3f')]['filter'][_0x04b2('0x81')]('\x5c','\x5c\x5c')[_0x04b2('0x81')]('\x27\x27',_0x04b2('0x82'));if(qs[_0x04b2('0x83')](_0x578580)){_0x24709c['or'](_0x04b2('0x84'),_0x578580+'%');}else if(qs[_0x04b2('0x85')](_0x578580)){_0x24709c['or'](_0x04b2('0x86'),_0x578580+'%');}else{_0x24709c['or'](_0x04b2('0x87'),qs[_0x04b2('0x69')](_0x578580))['or'](_0x04b2('0x88'),qs[_0x04b2('0x69')](_0x578580));}}}_0x5179a1[_0x04b2('0x48')](_0x24709c);_0x5179a1[_0x04b2('0x89')](_0x04b2('0x8a'));var _0x181515={'type':db[_0x04b2('0x8b')][_0x04b2('0x8c')][_0x04b2('0x8d')],'raw':!![]};var _0x55aab8=_0x5179a1['clone']();_0x55aab8[_0x04b2('0x4b')](_0x04b2('0x8a'));_0x55aab8[_0x04b2('0x4b')]('SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)',_0x04b2('0x61'));if(_0x331d5c[_0x04b2('0x8e')]){_0x331d5c[_0x04b2('0x8e')][_0x04b2('0x31')](function(_0x400812){_0x5179a1['order']('i.'+_0x400812[0x0],_0x400812[0x1]===_0x04b2('0x8f')?![]:!![]);});}if(!_[_0x04b2('0x75')](_0x133f82)){_0x5179a1['having'](_0xa8c71);_0x55aab8[_0x04b2('0x48')](_0x04b2('0x90'),_0x133f82);}BPromise[_0x04b2('0x91')]()[_0x04b2('0x27')](function(){if(!_0x3486d8){if(_0x507cce[_0x04b2('0x3f')]['MailAccountId']||_0x507cce[_0x04b2('0x3f')][_0x04b2('0x92')])return;_0x55aab8[_0x04b2('0x48')](_0x04b2('0x93'));_0x5179a1[_0x04b2('0x48')]('i.MailAccountId\x20IS\x20NOT\x20NULL');return;}return _0x507cce['user'][_0x04b2('0x94')]({'attributes':['id'],'raw':!![]})[_0x04b2('0x27')](function(_0x1fb7e1){if(_['isEmpty'](_0x1fb7e1)){_0x55aab8[_0x04b2('0x48')](_0x04b2('0x95'));_0x5179a1[_0x04b2('0x48')]('i.MailAccountId\x20IS\x20NULL');}else{_0x55aab8[_0x04b2('0x48')]('i.MailAccountId\x20IN\x20?',_[_0x04b2('0x2d')](_0x1fb7e1,'id'));_0x5179a1[_0x04b2('0x48')](_0x04b2('0x96'),_[_0x04b2('0x2d')](_0x1fb7e1,'id'));}});})[_0x04b2('0x27')](function(){db['sequelize'][_0x04b2('0x3f')](_0x55aab8[_0x04b2('0x97')](),_0x181515)[_0x04b2('0x27')](function(_0x7a799e){_0x390dd6[_0x04b2('0x1e')]=_0x7a799e['length'];if(_0x390dd6['count']===0x0)return[];return db['sequelize']['query'](_0x53cef2[_0x04b2('0x97')](),_0x181515)[_0x04b2('0x27')](function(_0x2a7ee8){_0x4285ad=_[_0x04b2('0x98')](_0x2a7ee8,'id');_0x181515=_[_0x04b2('0x99')](_0x181515,{'model':db[_0x04b2('0x33')],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x507cce[_0x04b2('0x3f')]['fields']){_0x331d5c[_0x04b2('0x43')][_0x04b2('0x31')](function(_0xc281b2){_0x5179a1['field']('i.'+_0xc281b2);});}else{_0x5179a1[_0x04b2('0x4b')](_0x04b2('0x9a'),_0x04b2('0x61'));_0x5179a1[_0x04b2('0x4b')]('a.key',_0x04b2('0x9b'));_0x5179a1[_0x04b2('0x4b')](_0x04b2('0x9c'),_0x04b2('0x9d'));_0x5179a1[_0x04b2('0x4b')](_0x04b2('0x8a'));_0x5179a1[_0x04b2('0x4b')](_0x04b2('0x9e'));_0x5179a1[_0x04b2('0x4b')]('i.updatedAt');_0x5179a1[_0x04b2('0x4b')](_0x04b2('0x9f'));_0x5179a1[_0x04b2('0x4b')](_0x04b2('0xa0'));_0x5179a1[_0x04b2('0x4b')](_0x04b2('0xa1'));_0x5179a1['field'](_0x04b2('0xa2'));_0x5179a1[_0x04b2('0x4b')](_0x04b2('0xa3'));_0x5179a1[_0x04b2('0x4b')](_0x04b2('0xa4'));_0x5179a1[_0x04b2('0x4b')]('i.disposition');_0x5179a1[_0x04b2('0x4b')](_0x04b2('0xa5'));_0x5179a1[_0x04b2('0x4b')]('i.to');_0x5179a1[_0x04b2('0x4b')](_0x04b2('0xa6'));_0x5179a1[_0x04b2('0x4b')]('i.MailAccountId');_0x5179a1['field'](_0x04b2('0xa7'));_0x5179a1['field'](_0x04b2('0xa8'),_0x04b2('0xa9'));_0x5179a1[_0x04b2('0x4b')](_0x04b2('0xaa'),_0x04b2('0xab'));_0x5179a1[_0x04b2('0x4b')](_0x04b2('0xac'),_0x04b2('0xad'));_0x5179a1[_0x04b2('0x4b')]('c.phone',_0x04b2('0xae'));_0x5179a1[_0x04b2('0x4b')](_0x04b2('0xaf'),_0x04b2('0xb0'));_0x5179a1['field']('c.fax',_0x04b2('0xb1'));_0x5179a1[_0x04b2('0x4b')](_0x04b2('0xb2'),_0x04b2('0xb3'));_0x5179a1['field']('o.internal',_0x04b2('0xb4'));_0x5179a1[_0x04b2('0x4b')](_0x04b2('0xb5'),_0x04b2('0xb6'));}_0x5179a1['limit'](_0x331d5c[_0x04b2('0x20')]);_0x5179a1[_0x04b2('0x1f')](_0x331d5c[_0x04b2('0x1f')]);return db['sequelize'][_0x04b2('0x3f')](_0x5179a1['toString'](),_0x181515);})[_0x04b2('0x27')](function(_0x19dad2){_0x2bcae2[_0x04b2('0x48')](_0x04b2('0xb7'),_[_0x04b2('0x2d')](_0x19dad2,'id'));return db[_0x04b2('0xb8')][_0x04b2('0x3f')](_0x2bcae2[_0x04b2('0x97')](),_0x181515)[_0x04b2('0x27')](function(_0x948cbb){var _0x3c6c2e=_[_0x04b2('0xb9')](_0x948cbb,'MailInteractionId');var _0x15c0f5=[];return db[_0x04b2('0xba')]['findOne']({'attributes':[_0x04b2('0xbb')],'raw':!![]})['then'](function(_0x11df55){var _0x304cf8=_0x11df55['enableEmailPreview'];_0x19dad2[_0x04b2('0x31')](function(_0x574a7f){_0x15c0f5[_0x04b2('0x32')](updateMailInteraction(_0x574a7f,_0x4285ad,_0x3c6c2e,_0x304cf8));});return BPromise['all'](_0x15c0f5);});});});})['then'](function(_0x4dc4b3){_0x390dd6[_0x04b2('0xbc')]=_0x4dc4b3;return _0x390dd6;})[_0x04b2('0x27')](respondWithFilteredResult(_0x5ea011,_0x331d5c));})[_0x04b2('0x38')](handleError(_0x5ea011,null));};exports[_0x04b2('0xbd')]=function(_0xd9bc33,_0x487dad){var _0x1c62b6={'raw':![],'where':{'id':_0xd9bc33[_0x04b2('0xbe')]['id']}},_0xb68974={};_0xb68974[_0x04b2('0x3e')]=_[_0x04b2('0x74')](db['MailInteraction'][_0x04b2('0x3a')]);_0xb68974[_0x04b2('0x3f')]=_[_0x04b2('0x74')](_0xd9bc33[_0x04b2('0x3f')]);_0xb68974[_0x04b2('0x40')]=_['intersection'](_0xb68974[_0x04b2('0x3e')],_0xb68974[_0x04b2('0x3f')]);_0x1c62b6[_0x04b2('0x43')]=_[_0x04b2('0x41')](_0xb68974[_0x04b2('0x3e')],qs[_0x04b2('0x42')](_0xd9bc33[_0x04b2('0x3f')][_0x04b2('0x42')]));_0x1c62b6[_0x04b2('0x43')]=_0x1c62b6['attributes'][_0x04b2('0x44')]?_0x1c62b6[_0x04b2('0x43')]:_0xb68974[_0x04b2('0x3e')];if(_0xd9bc33[_0x04b2('0x3f')][_0x04b2('0xbf')]){_0x1c62b6['include']=[{'all':!![]}];}_0x1c62b6=_[_0x04b2('0x99')]({},_0x1c62b6,_0xd9bc33[_0x04b2('0xc0')]);return db[_0x04b2('0x33')][_0x04b2('0xc1')](_0x1c62b6)[_0x04b2('0x27')](handleEntityNotFound(_0x487dad,null))[_0x04b2('0x27')](respondWithResult(_0x487dad,null))[_0x04b2('0x38')](handleError(_0x487dad,null));};exports[_0x04b2('0xc2')]=function(_0x32680c,_0x45bd98){return db[_0x04b2('0x33')][_0x04b2('0xc2')](_0x32680c[_0x04b2('0xc3')],{})[_0x04b2('0x27')](respondWithResult(_0x45bd98,0xc9))['catch'](handleError(_0x45bd98,null));};exports[_0x04b2('0x25')]=function(_0x54b9e1,_0x1f5db2){if(_0x54b9e1[_0x04b2('0xc3')]['id']){delete _0x54b9e1['body']['id'];}return db[_0x04b2('0x33')][_0x04b2('0xc1')]({'where':{'id':_0x54b9e1[_0x04b2('0xbe')]['id']}})[_0x04b2('0x27')](handleEntityNotFound(_0x1f5db2,null))[_0x04b2('0x27')](saveUpdates(_0x54b9e1['body'],null))[_0x04b2('0x27')](respondWithResult(_0x1f5db2,null))[_0x04b2('0x38')](handleError(_0x1f5db2,null));};exports['destroy']=function(_0x53f6c9,_0x37ba6c){return db[_0x04b2('0x33')]['find']({'where':{'id':_0x53f6c9[_0x04b2('0xbe')]['id']}})[_0x04b2('0x27')](handleEntityNotFound(_0x37ba6c,null))[_0x04b2('0x27')](removeEntity(_0x37ba6c,null))[_0x04b2('0x38')](handleError(_0x37ba6c,null));};exports[_0x04b2('0xc4')]=function(_0x40ffeb,_0x241323){return db[_0x04b2('0x33')]['describe']()[_0x04b2('0x27')](respondWithResult(_0x241323,null))[_0x04b2('0x38')](handleError(_0x241323,null));};exports[_0x04b2('0xc5')]=function(_0x13fd94,_0x4c2ec9,_0x1098ae){return db[_0x04b2('0xc6')]['find']({'where':{'id':_0x13fd94[_0x04b2('0xbe')]['id']}})[_0x04b2('0x27')](handleEntityNotFound(_0x4c2ec9,null))[_0x04b2('0x27')](function(_0x1e3697){if(_0x1e3697){return _0x1e3697[_0x04b2('0xc5')](_0x13fd94[_0x04b2('0xc3')][_0x04b2('0xc7')],_[_0x04b2('0xc8')](_0x13fd94['body'],[_0x04b2('0xc7'),'id'])||{});}})[_0x04b2('0x27')](respondWithResult(_0x4c2ec9,null))[_0x04b2('0x38')](handleError(_0x4c2ec9,null));};exports[_0x04b2('0xc9')]=function(_0x1ad872,_0x15b247,_0x5e4b06){var _0x503620={'raw':![],'where':{}};var _0x3bf13b={};var _0x157e12={'count':0x0,'rows':[]};return db[_0x04b2('0x33')]['findOne']({'where':{'id':_0x1ad872[_0x04b2('0xbe')]['id']}})[_0x04b2('0x27')](handleEntityNotFound(_0x15b247,null))[_0x04b2('0x27')](function(_0x581060){if(_0x581060){_0x3bf13b[_0x04b2('0x3e')]=_[_0x04b2('0x74')](db[_0x04b2('0xc6')]['rawAttributes']);_0x3bf13b[_0x04b2('0x3f')]=_[_0x04b2('0x74')](_0x1ad872[_0x04b2('0x3f')]);_0x3bf13b[_0x04b2('0x40')]=_[_0x04b2('0x41')](_0x3bf13b['model'],_0x3bf13b['query']);_0x503620['attributes']=_[_0x04b2('0x41')](_0x3bf13b['model'],qs[_0x04b2('0x42')](_0x1ad872[_0x04b2('0x3f')][_0x04b2('0x42')]));_0x503620['attributes']=_0x503620[_0x04b2('0x43')]['length']?_0x503620['attributes']:_0x3bf13b[_0x04b2('0x3e')];if(!_0x1ad872[_0x04b2('0x3f')][_0x04b2('0x45')](_0x04b2('0x46'))){_0x503620['limit']=qs[_0x04b2('0x20')](_0x1ad872[_0x04b2('0x3f')][_0x04b2('0x20')]);_0x503620[_0x04b2('0x1f')]=qs[_0x04b2('0x1f')](_0x1ad872[_0x04b2('0x3f')][_0x04b2('0x1f')]);}_0x503620[_0x04b2('0x8e')]=qs[_0x04b2('0x47')](_0x1ad872[_0x04b2('0x3f')][_0x04b2('0x47')]);_0x503620[_0x04b2('0x48')]=qs['filters'](_[_0x04b2('0x49')](_0x1ad872['query'],_0x3bf13b[_0x04b2('0x40')]));_0x503620[_0x04b2('0x48')][_0x04b2('0xca')]=_0x581060['id'];if(_0x1ad872[_0x04b2('0x3f')][_0x04b2('0xcb')]){_0x503620[_0x04b2('0x48')]=_[_0x04b2('0x99')](_0x503620[_0x04b2('0x48')],{'$or':_[_0x04b2('0x2d')](_0x503620[_0x04b2('0x43')],function(_0x4650a8){var _0x6e5d51={};_0x6e5d51[_0x4650a8]={'$like':'%'+_0x1ad872['query'][_0x04b2('0xcb')]+'%'};return _0x6e5d51;})});}if(_0x1ad872['query'][_0x04b2('0xcc')]){var _0x45ec9d=_0x1ad872['query'][_0x04b2('0xcc')][_0x04b2('0x30')](',');var _0x3a68c2={};_0x3a68c2[_0x45ec9d[0x0]]={'$gte':moment(_0x45ec9d[0x1])[_0x04b2('0xcd')](_0x04b2('0xce'))};_0x503620[_0x04b2('0x48')]=_[_0x04b2('0x99')](_0x503620[_0x04b2('0x48')],_0x3a68c2);}_0x503620=_['merge']({},_0x503620,_0x1ad872[_0x04b2('0xc0')]);return db[_0x04b2('0xc6')][_0x04b2('0x1e')]({'where':_0x503620[_0x04b2('0x48')]})[_0x04b2('0x27')](function(_0x479538){_0x157e12['count']=_0x479538;if(_0x1ad872[_0x04b2('0x3f')][_0x04b2('0xbf')]){_0x503620[_0x04b2('0xcf')]=[{'all':!![]}];}return db[_0x04b2('0xc6')][_0x04b2('0xd0')](_0x503620);})[_0x04b2('0x27')](function(_0x7cdb55){_0x157e12['rows']=_0x7cdb55;return _0x157e12;});}})[_0x04b2('0x27')](respondWithFilteredResult(_0x15b247,_0x503620))[_0x04b2('0x38')](handleError(_0x15b247,null));};exports['addTags']=function(_0x28aa5a,_0x5d42e7,_0x573116){return db[_0x04b2('0x33')][_0x04b2('0xc1')]({'where':{'id':_0x28aa5a[_0x04b2('0xbe')]['id']}})['then'](handleEntityNotFound(_0x5d42e7,null))[_0x04b2('0x27')](function(_0x570b16){if(_0x570b16){return _0x570b16[_0x04b2('0xd1')](_0x28aa5a[_0x04b2('0xc3')]['ids'],_[_0x04b2('0xc8')](_0x28aa5a[_0x04b2('0xc3')],[_0x04b2('0xc7'),'id'])||{})[_0x04b2('0xd2')](function(){return db['Tag'][_0x04b2('0xd0')]({'attributes':['id',_0x04b2('0x2a'),_0x04b2('0x4c')],'where':{'id':_0x28aa5a[_0x04b2('0xc3')][_0x04b2('0xc7')]}});})[_0x04b2('0x27')](function(_0xdb1851){socket[_0x04b2('0xd3')](_0x04b2('0xd4'),{'id':Number(_0x28aa5a[_0x04b2('0xbe')]['id']),'tags':_0xdb1851||[]});return{'id':Number(_0x28aa5a[_0x04b2('0xbe')]['id']),'tags':_0xdb1851||[]};});}})['then'](respondWithResult(_0x5d42e7,null))['catch'](handleError(_0x5d42e7,null));};exports[_0x04b2('0xd5')]=function(_0x1d0e1d,_0x50d1db,_0x257313){return db[_0x04b2('0x33')][_0x04b2('0xc1')]({'where':{'id':_0x1d0e1d[_0x04b2('0xbe')]['id']}})['then'](handleEntityNotFound(_0x50d1db,null))[_0x04b2('0x27')](function(_0x4c41be){if(_0x4c41be){return _0x4c41be['removeTags'](_0x1d0e1d[_0x04b2('0x3f')][_0x04b2('0xc7')]);}})[_0x04b2('0x27')](respondWithStatusCode(_0x50d1db,null))['catch'](handleError(_0x50d1db,null));};exports[_0x04b2('0xd6')]=function(_0x3d545f,_0x399ef8){var _0x1379ef=moment()[_0x04b2('0xd7')]()['toString']();var _0x31cf7a=path['join'](config[_0x04b2('0xd8')],_0x04b2('0xd9'),_0x04b2('0xda'),_0x04b2('0xdb'));var _0x7be1e2=path[_0x04b2('0xdc')](config[_0x04b2('0xd8')],_0x04b2('0xd9'),_0x04b2('0xda'),_0x04b2('0xdd'));var _0x1568cf=path[_0x04b2('0xdc')](_0x31cf7a,_0x1379ef);var _0x3f6f40=util[_0x04b2('0xcd')](_0x04b2('0xde'),_0x3d545f[_0x04b2('0xbe')]['id'],_0x1379ef);var _0x37e1e3=path[_0x04b2('0xdc')](_0x31cf7a,_0x3f6f40);var _0x57be54=[];if(_0x3d545f['query'][_0x04b2('0xdd')]){_0x57be54[_0x04b2('0x32')]({'model':db['Attachment'],'as':_0x04b2('0xdf'),'raw':!![]});}var _0x15281e=[{'model':db[_0x04b2('0xc6')],'as':'Messages','attributes':['id',_0x04b2('0xc3'),_0x04b2('0x4d'),'to','cc',_0x04b2('0xe0'),_0x04b2('0xe1'),_0x04b2('0xe2')],'where':{'secret':![]},'order':qs[_0x04b2('0x47')]('id'),'include':_0x57be54}];return db[_0x04b2('0x33')][_0x04b2('0xc1')]({'where':{'id':_0x3d545f[_0x04b2('0xbe')]['id']},'include':_0x15281e})['then'](handleEntityNotFound(_0x399ef8,null))[_0x04b2('0x27')](function(_0x15ed70){if(_0x15ed70&&_0x15ed70['Messages']){var _0x2ce44b=_0x15ed70[_0x04b2('0xe3')]({'plain':!![]});fs[_0x04b2('0xe4')](_0x1568cf);return BPromise[_0x04b2('0xe5')](_0x2ce44b['Messages'],function(_0x456221,_0x5286ba){var _0x4a948a={'from':_0x456221[_0x04b2('0x4d')],'to':_0x456221['to'],'subject':_0x456221[_0x04b2('0xe1')],'html':_0x456221[_0x04b2('0xc3')],'headers':{'Date':moment(_0x456221['createdAt'])[_0x04b2('0xcd')](_0x04b2('0xe6'))},'attachments':[]};if(_0x456221['cc']){_0x4a948a[_0x04b2('0xe7')]['Cc']=_0x456221['cc'];}if(_0x456221['bcc']){_0x4a948a[_0x04b2('0xe7')][_0x04b2('0xe8')]=_0x456221['bcc'];}return new BPromise(function(_0x2289d8,_0x4c61d0){if(_0x456221['Attachments']){for(var _0x2beffb=0x0;_0x2beffb<_0x456221[_0x04b2('0xdf')][_0x04b2('0x44')];_0x2beffb++){var _0x186939=_0x456221[_0x04b2('0xdf')][_0x2beffb];var _0x182af7=path[_0x04b2('0xdc')](_0x7be1e2,_0x186939[_0x04b2('0xe9')]);if(fs[_0x04b2('0xea')](_0x182af7)){_0x4a948a[_0x04b2('0xdd')][_0x04b2('0x32')]({'name':_0x186939[_0x04b2('0x2a')],'contentType':_0x186939[_0x04b2('0x3c')],'data':fs[_0x04b2('0xeb')](_0x182af7)});}}}emlformat['build'](_0x4a948a,function(_0x3e4404,_0xecf4ea){if(_0x3e4404)return _0x4c61d0(_0x3e4404);fs[_0x04b2('0xec')](path[_0x04b2('0xdc')](_0x1568cf,util['format'](_0x04b2('0xed'),_0x5286ba)),_0xecf4ea);return _0x2289d8(_0xecf4ea);});});})['then'](function(){return new BPromise(function(_0x8c9997,_0x3de20){zipdir(_0x1568cf,{'saveTo':_0x37e1e3},function(_0x2b7170,_0xee07df){if(_0x2b7170)return _0x3de20(_0x2b7170);return _0x8c9997(_0xee07df);});})[_0x04b2('0x27')](function(){return new BPromise(function(_0xb21921,_0x16f74e){rimraf(_0x1568cf,function(_0x1a051b){if(_0x1a051b)_0x16f74e(_0x1a051b);return _0xb21921();});});})['then'](function(){return _0x399ef8[_0x04b2('0xd6')](_0x37e1e3,_0x3f6f40,function(_0x41b563){if(_0x41b563){console[_0x04b2('0xee')](_0x04b2('0xef'),_0x41b563);}else{fs['unlinkSync'](_0x37e1e3);}});});});}else{return _0x399ef8[_0x04b2('0x1a')](0xc8);}})[_0x04b2('0x38')](handleError(_0x399ef8,null));}; \ No newline at end of file +var _0x8b88=['parse','$gte','$lte','i.createdAt\x20BETWEEN\x20?\x20AND\x20?','null','\x20=\x20?','read','`unreadMessages`\x20=\x200','`unreadMessages`\x20>\x200','isArray','tag','filter','replace','\x27\x27\x27\x27','isNumeric','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','clone','SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','order','journey','i.MailAccountId\x20IS\x20NOT\x20NULL','getMailAccounts','toString','sequelize','keyBy','merge','a.key','Account.mandatoryDisposition','i.createdAt','i.updatedAt','i.closed','i.lastMsgAt','i.lastMsgDirection','i.subject','i.disposition','i.substatus','i.to','i.MailAccountId','i.UserId','Contact.firstName','c.lastName','Contact.lastName','c.phone','Contact.phone','c.mobile','Contact.mobile','c.fax','Contact.fax','Owner.fullname','o.internal','GROUP_CONCAT(DISTINCT\x20t.id)','ui.MailInteractionId\x20IN\x20?','groupBy','MailInteractionId','Setting','enableEmailPreview','all','rows','show','params','includeAll','include','create','body','describe','addMessage','ids','omit','getMessages','nolimit','sort','format','options','findAll','addTags','spread','emit','mailInteractionTags:save','removeTags','unix','join','root','server','files','tmp','attachments','Attachment','MailMessage','Messages','subject','get','ddd,\x20DD\x20MMM\x20YYYY\x20HH:mm:ss\x20ZZ','headers','bcc','Attachments','basename','existsSync','readFileSync','writeFileSync','download','log','err','unlinkSync','eml-format','zip-dir','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','desk.js','querystring','html-to-text','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/environment','../../mysqldb','redis','defaults','socket.io-emitter','./mailInteraction.socket','register','sendStatus','status','json','count','offset','limit','set','apply','reject','save','update','then','destroy','end','Users','map','fullname','TagIds','Tags','split','push','MailInteraction','findOne','lastMsgText','trimStart','lastMsgBody','catch','rawAttributes','key','name','query','keys','filters','intersection','model','attributes','fields','length','hasOwnProperty','where','pick','select','field','tools_tags','u.id','u.fullname','from','user_has_mail_interactions','left_join','users','u.id\x20=\x20ui.UserId','mail_interactions','o.id\x20=\x20i.UserId','a.id\x20=\x20i.MailAccountId','mail_messages','me.MailInteractionId\x20=\x20i.id','mail_interaction_has_tags','it.MailInteractionId\x20=\x20i.id','t.id\x20=\x20it.TagId','expr','search','conditions','find','unreadMessages','value','`\x20=\x200','having','Contact','$substring','MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','getFullTextValue','c.firstName\x20LIKE\x20?\x20OR\x20c.lastName\x20LIKE\x20?\x20OR\x20c.email\x20LIKE\x20?','ContactId','buildExpression','type','text','Tag','forEach','union','CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?','UserId','start','some','compact','isEmpty','MailAccountId','i.MailAccountId\x20IN\x20?','concat','createdAt'];(function(_0x4264bf,_0x39db0f){var _0x515e5f=function(_0x130168){while(--_0x130168){_0x4264bf['push'](_0x4264bf['shift']());}};_0x515e5f(++_0x39db0f);}(_0x8b88,0x14f));var _0x88b8=function(_0x599c67,_0x581093){_0x599c67=_0x599c67-0x0;var _0x58306d=_0x8b88[_0x599c67];return _0x58306d;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x88b8('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x88b8('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x88b8('0x2'));var moment=require(_0x88b8('0x3'));var BPromise=require(_0x88b8('0x4'));var Mustache=require(_0x88b8('0x5'));var util=require(_0x88b8('0x6'));var path=require(_0x88b8('0x7'));var sox=require(_0x88b8('0x8'));var csv=require(_0x88b8('0x9'));var ejs=require(_0x88b8('0xa'));var fs=require('fs');var _=require(_0x88b8('0xb'));var squel=require(_0x88b8('0xc'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x88b8('0xd'));var toCsv=require(_0x88b8('0x9'));var querystring=require(_0x88b8('0xe'));var Papa=require('papaparse');var htmlToText=require(_0x88b8('0xf'));var Redis=require(_0x88b8('0x10'));var authService=require(_0x88b8('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0x88b8('0x12'));var hardwareService=require(_0x88b8('0x13'));var logger=require(_0x88b8('0x14'))('api');var utils=require('../../config/utils');var config=require(_0x88b8('0x15'));var db=require(_0x88b8('0x16'))['db'];config[_0x88b8('0x17')]=_[_0x88b8('0x18')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0x88b8('0x19'))(new Redis(config['redis']));require(_0x88b8('0x1a'))[_0x88b8('0x1b')](socket);function respondWithStatusCode(_0x499d1f,_0x797423){_0x797423=_0x797423||0xcc;return function(_0xf1b8b2){if(_0xf1b8b2){return _0x499d1f[_0x88b8('0x1c')](_0x797423);}return _0x499d1f['status'](_0x797423)['end']();};}function respondWithResult(_0x25b288,_0x5bc06b){_0x5bc06b=_0x5bc06b||0xc8;return function(_0x1469c1){if(_0x1469c1){return _0x25b288[_0x88b8('0x1d')](_0x5bc06b)[_0x88b8('0x1e')](_0x1469c1);}};}function respondWithFilteredResult(_0x52f363,_0x8005a2){return function(_0x36bd56){if(_0x36bd56){var _0xcbae35=_0x36bd56[_0x88b8('0x1f')],_0x24969f=_0x8005a2[_0x88b8('0x20')],_0x5854d7=_0x8005a2[_0x88b8('0x20')]+_0x8005a2[_0x88b8('0x21')],_0x416633;if(_0x5854d7>=_0xcbae35){_0x5854d7=_0xcbae35;_0x416633=0xc8;}else{_0x416633=0xce;}_0x52f363[_0x88b8('0x1d')](_0x416633);return _0x52f363[_0x88b8('0x22')]('Content-Range',_0x24969f+'-'+_0x5854d7+'/'+_0xcbae35)['json'](_0x36bd56);}return null;};}function patchUpdates(_0x182333){return function(_0x2ae25d){try{jsonpatch[_0x88b8('0x23')](_0x2ae25d,_0x182333,!![]);}catch(_0x158443){return BPromise[_0x88b8('0x24')](_0x158443);}return _0x2ae25d[_0x88b8('0x25')]();};}function saveUpdates(_0x4a1f5a,_0x22101a){return function(_0x1bd263){if(_0x1bd263){return _0x1bd263[_0x88b8('0x26')](_0x4a1f5a)[_0x88b8('0x27')](function(_0x46541c){return _0x46541c;});}return null;};}function removeEntity(_0x5a5377,_0x29d20c){return function(_0x5e6dde){if(_0x5e6dde){return _0x5e6dde[_0x88b8('0x28')]()[_0x88b8('0x27')](function(){_0x5a5377['status'](0xcc)[_0x88b8('0x29')]();});}};}function handleEntityNotFound(_0x4a90b2,_0x3bdb10){return function(_0x2c5a8a){if(!_0x2c5a8a){_0x4a90b2[_0x88b8('0x1c')](0x194);}return _0x2c5a8a;};}function handleError(_0x465a8e,_0x2cee15){_0x2cee15=_0x2cee15||0x1f4;return function(_0x1139b9){logger['error'](_0x1139b9['stack']);if(_0x1139b9['name']){delete _0x1139b9['name'];}_0x465a8e['status'](_0x2cee15)['send'](_0x1139b9);};}function getInteractionUsers(_0x44f8ce,_0x1cf641){return new BPromise(function(_0x21ff44,_0x5e9585){try{if(_0x1cf641[_0x44f8ce['id']]){_0x44f8ce[_0x88b8('0x2a')]=_[_0x88b8('0x2b')](_0x1cf641[_0x44f8ce['id']],function(_0x52510f){return{'id':_0x52510f['id'],'fullname':_0x52510f[_0x88b8('0x2c')]};});}}catch(_0x9efe4b){_0x5e9585(_0x9efe4b);}_0x21ff44(_0x44f8ce);});}function getInteractionTags(_0x16e96c,_0x165235){return new BPromise(function(_0x16a7c8,_0x25dadc){try{if(_0x16e96c[_0x88b8('0x2d')]){_0x16e96c[_0x88b8('0x2e')]=[];_0x16e96c[_0x88b8('0x2d')][_0x88b8('0x2f')](',')['forEach'](function(_0x39030c){_0x16e96c[_0x88b8('0x2e')][_0x88b8('0x30')](_0x165235[_0x39030c]);});}delete _0x16e96c[_0x88b8('0x2d')];}catch(_0x15b0e5){_0x25dadc(_0x15b0e5);}_0x16a7c8(_0x16e96c);});}function getLastMessageText(_0x1dbc94){return new BPromise(function(_0x2129ea,_0x18fd8e){return db[_0x88b8('0x31')][_0x88b8('0x32')]({'where':{'id':_0x1dbc94['id']},'attributes':['lastMsgBody',_0x88b8('0x33')],'raw':!![]})[_0x88b8('0x27')](function(_0x490dc2){if(!_0x490dc2[_0x88b8('0x33')]){_0x1dbc94[_0x88b8('0x33')]=_[_0x88b8('0x34')](htmlToText['fromString'](_0x490dc2[_0x88b8('0x35')],{'preserveNewlines':!![],'singleNewLineParagraphs':!![],'uppercaseHeadings':![],'noLinkBrackets':!![],'ignoreImage':!![]}));}else{_0x1dbc94['lastMsgText']=_0x490dc2['lastMsgText'];}_0x2129ea(_0x1dbc94);})[_0x88b8('0x36')](function(_0x4a4e0d){_0x18fd8e(_0x4a4e0d);});});}function updateMailInteraction(_0x45b006,_0x7e2a8c,_0x506622,_0x36be10){return new BPromise(function(_0x2cd17f,_0x2c6077){return getInteractionUsers(_0x45b006,_0x506622)[_0x88b8('0x27')](function(_0x1081d1){return getInteractionTags(_0x1081d1,_0x7e2a8c);})['then'](function(_0x9291c2){if(_0x36be10){_0x2cd17f(getLastMessageText(_0x9291c2));}else{_0x2cd17f(_0x9291c2);}})[_0x88b8('0x36')](function(_0x1206fd){_0x2c6077(_0x1206fd);});});}exports['index']=function(_0x407351,_0x2cde67){var _0x349c56={},_0x2bfbcf={},_0x3ed77c={'count':0x0,'rows':[]};var _0x5247a6=_[_0x88b8('0x2b')](db['MailInteraction'][_0x88b8('0x37')],function(_0x33a3ab){return{'name':_0x33a3ab['fieldName'],'type':_0x33a3ab['type'][_0x88b8('0x38')]};});_0x2bfbcf['model']=_['map'](_0x5247a6,_0x88b8('0x39'));_0x2bfbcf[_0x88b8('0x3a')]=_[_0x88b8('0x3b')](_0x407351[_0x88b8('0x3a')]);_0x2bfbcf[_0x88b8('0x3c')]=_[_0x88b8('0x3d')](_0x2bfbcf[_0x88b8('0x3e')],_0x2bfbcf['query']);_0x349c56[_0x88b8('0x3f')]=_[_0x88b8('0x3d')](_0x2bfbcf[_0x88b8('0x3e')],qs[_0x88b8('0x40')](_0x407351['query'][_0x88b8('0x40')]));_0x349c56[_0x88b8('0x3f')]=_0x349c56[_0x88b8('0x3f')][_0x88b8('0x41')]?_0x349c56[_0x88b8('0x3f')]:_0x2bfbcf['model'];if(!_0x407351['query'][_0x88b8('0x42')]('nolimit')){_0x349c56[_0x88b8('0x21')]=qs[_0x88b8('0x21')](_0x407351[_0x88b8('0x3a')][_0x88b8('0x21')]);_0x349c56[_0x88b8('0x20')]=qs[_0x88b8('0x20')](_0x407351['query'][_0x88b8('0x20')]);}_0x349c56['order']=qs['sort'](_0x407351[_0x88b8('0x3a')]['sort']);_0x349c56[_0x88b8('0x43')]=qs[_0x88b8('0x3c')](_[_0x88b8('0x44')](_0x407351['query'],_0x2bfbcf[_0x88b8('0x3c')]));var _0x569c7a=[];var _0xde9620=squel[_0x88b8('0x45')]()[_0x88b8('0x46')]('id')['field'](_0x88b8('0x39'))[_0x88b8('0x46')]('color')['from'](_0x88b8('0x47'));var _0x1e2633=squel['select']()[_0x88b8('0x46')](_0x88b8('0x48'))[_0x88b8('0x46')](_0x88b8('0x49'))[_0x88b8('0x46')]('ui.MailInteractionId')[_0x88b8('0x4a')](_0x88b8('0x4b'),'ui')[_0x88b8('0x4c')](_0x88b8('0x4d'),'u',_0x88b8('0x4e'));var _0x2931a9=squel[_0x88b8('0x45')]()[_0x88b8('0x4a')](_0x88b8('0x4f'),'i')[_0x88b8('0x4c')]('cm_contacts','c','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL')[_0x88b8('0x4c')](_0x88b8('0x4d'),'o',_0x88b8('0x50'))[_0x88b8('0x4c')]('mail_accounts','a',_0x88b8('0x51'))[_0x88b8('0x4c')](_0x88b8('0x52'),'me',_0x88b8('0x53'))[_0x88b8('0x4c')](_0x88b8('0x54'),'it',_0x88b8('0x55'))['left_join'](_0x88b8('0x47'),'t',_0x88b8('0x56'));var _0x522158=squel[_0x88b8('0x57')]();var _0x491d57=[];var _0x2eb686=squel['expr']();var _0x1275da;if(_0x407351[_0x88b8('0x3a')][_0x88b8('0x58')]){_0x1275da=as['parseSearch'](_0x407351[_0x88b8('0x3a')][_0x88b8('0x58')]);var _0x4a1fc8=_0x1275da['sqlOperator'];for(var _0x54d69e=0x0;_0x54d69e<_0x1275da['conditions'][_0x88b8('0x41')];_0x54d69e++){var _0x873698=_0x1275da[_0x88b8('0x59')][_0x54d69e];var _0x3cb790='i';var _0x47672e=_[_0x88b8('0x5a')](_0x5247a6,[_0x88b8('0x39'),_0x873698[_0x88b8('0x46')]]);if(!_0x47672e){switch(_0x873698[_0x88b8('0x46')]){case _0x88b8('0x5b'):if(_0x873698[_0x88b8('0x5c')]==0x1){_0x2931a9['having']('`'+_0x873698[_0x88b8('0x46')]+_0x88b8('0x5d'));}else{_0x2931a9[_0x88b8('0x5e')]('`'+_0x873698[_0x88b8('0x46')]+'`\x20>\x200');}break;case _0x88b8('0x5f'):if(_0x873698['operator']===_0x88b8('0x60')){if(_0x873698[_0x88b8('0x5c')][_0x88b8('0x2f')]('\x20')[_0x88b8('0x41')]>0x1){_0x522158[_0x4a1fc8](_0x88b8('0x61'),qs[_0x88b8('0x62')](_0x873698['value']),null);}else{var _0x17da3f='%'+_0x873698[_0x88b8('0x5c')]+'%';_0x522158[_0x4a1fc8](_0x88b8('0x63'),_0x17da3f,_0x17da3f,_0x17da3f);}}else{_0x47672e=_['find'](_0x5247a6,[_0x88b8('0x39'),_0x88b8('0x64')]);_0x873698[_0x88b8('0x46')]='ContactId';_0x409480=as[_0x88b8('0x65')](_0x3cb790,_0x47672e[_0x88b8('0x66')],_0x873698);_0x522158[_0x4a1fc8](_0x409480[_0x88b8('0x67')],_0x409480['value']['start'],_0x409480[_0x88b8('0x5c')][_0x88b8('0x29')]);}break;case _0x88b8('0x68'):var _0x59ece9=_0x873698[_0x88b8('0x5c')][_0x88b8('0x2f')](',')[_0x88b8('0x2b')](function(_0x521f1d){return Number(_0x521f1d);});_0x59ece9[_0x88b8('0x69')](function(_0x2097ae){_0x2eb686['or']('CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','%,'+_0x2097ae+',%');});_0x491d57=_[_0x88b8('0x6a')](_0x491d57,_0x59ece9);break;case'User':if(_0x873698['operator']==='$substring'){_0x522158[_0x4a1fc8](_0x88b8('0x6b'),'%'+_0x873698[_0x88b8('0x5c')]+'%',null);}else{_0x47672e=_[_0x88b8('0x5a')](_0x5247a6,[_0x88b8('0x39'),_0x88b8('0x6c')]);_0x873698[_0x88b8('0x46')]=_0x88b8('0x6c');_0x409480=as[_0x88b8('0x65')](_0x3cb790,_0x47672e[_0x88b8('0x66')],_0x873698);_0x522158[_0x4a1fc8](_0x409480[_0x88b8('0x67')],_0x409480[_0x88b8('0x5c')][_0x88b8('0x6d')],_0x409480[_0x88b8('0x5c')][_0x88b8('0x29')]);}break;case'plainBody':_0x409480=as[_0x88b8('0x65')]('me',null,_0x873698);_0x522158[_0x4a1fc8](_0x409480['text'],_0x409480['value'][_0x88b8('0x6d')],_0x409480[_0x88b8('0x5c')][_0x88b8('0x29')]);break;}}else{var _0x409480=as['buildExpression'](_0x3cb790,_0x47672e[_0x88b8('0x66')],_0x873698);_0x522158[_0x4a1fc8](_0x409480[_0x88b8('0x67')],_0x409480['value'][_0x88b8('0x6d')],_0x409480[_0x88b8('0x5c')][_0x88b8('0x29')]);}}}else{var _0x2f2c3d=_(_0x407351[_0x88b8('0x3a')])[_0x88b8('0x3b')]()[_0x88b8('0x2b')](function(_0x45bb62){return _[_0x88b8('0x6e')](_0x5247a6,[_0x88b8('0x39'),_0x45bb62])?_0x45bb62:undefined;})[_0x88b8('0x6f')]()['value']();if(!_[_0x88b8('0x70')](_0x2f2c3d)){_0x2f2c3d[_0x88b8('0x69')](function(_0x10c988){if(_0x10c988===_0x88b8('0x71')){_0x2931a9[_0x88b8('0x43')](_0x88b8('0x72'),[][_0x88b8('0x73')](_0x407351[_0x88b8('0x3a')][_0x10c988]));}else if(_0x10c988===_0x88b8('0x74')){var _0x1015e9=JSON[_0x88b8('0x75')](_0x407351[_0x88b8('0x3a')][_0x10c988])[_0x88b8('0x76')];var _0x264edf=JSON['parse'](_0x407351[_0x88b8('0x3a')][_0x10c988])[_0x88b8('0x77')];_0x2931a9['where'](_0x88b8('0x78'),_0x1015e9,_0x264edf);}else{if(_0x407351['query'][_0x10c988]===_0x88b8('0x79')){_0x2931a9[_0x88b8('0x43')]('i.'+_0x10c988+'\x20IS\x20NULL');}else{_0x2931a9[_0x88b8('0x43')]('i.'+_0x10c988+_0x88b8('0x7a'),_0x407351[_0x88b8('0x3a')][_0x10c988]);}}});}if(_0x407351[_0x88b8('0x3a')]['read']){if(_0x407351[_0x88b8('0x3a')][_0x88b8('0x7b')]==0x1){_0x2931a9[_0x88b8('0x5e')](_0x88b8('0x7c'));}else{_0x2931a9[_0x88b8('0x5e')](_0x88b8('0x7d'));}}if(_0x407351[_0x88b8('0x3a')]['tag']){_0x491d57=_[_0x88b8('0x7e')](_0x407351[_0x88b8('0x3a')][_0x88b8('0x7f')])?_0x407351[_0x88b8('0x3a')][_0x88b8('0x7f')]:new Array(_0x407351[_0x88b8('0x3a')]['tag']);_0x491d57[_0x88b8('0x69')](function(_0x4dc86e){_0x2eb686['or']('CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','%,'+_0x4dc86e+',%');});}if(_0x407351[_0x88b8('0x3a')][_0x88b8('0x80')]){var _0x37310e=_0x407351[_0x88b8('0x3a')]['filter'][_0x88b8('0x81')]('\x5c','\x5c\x5c')['replace']('\x27\x27',_0x88b8('0x82'));if(qs[_0x88b8('0x83')](_0x37310e)){_0x522158['or']('i.id\x20LIKE\x20?',_0x37310e+'%');}else if(qs['isEmail'](_0x37310e)){_0x522158['or'](_0x88b8('0x84'),_0x37310e+'%');}else{_0x522158['or'](_0x88b8('0x85'),qs['getFullTextValue'](_0x37310e))['or'](_0x88b8('0x86'),qs[_0x88b8('0x62')](_0x37310e));}}}_0x2931a9['where'](_0x522158);_0x2931a9[_0x88b8('0x87')](_0x88b8('0x88'));var _0x20d934={'type':db[_0x88b8('0x89')][_0x88b8('0x8a')]['SELECT'],'raw':!![]};var _0x591acc=_0x2931a9[_0x88b8('0x8b')]();_0x591acc[_0x88b8('0x46')](_0x88b8('0x88'));_0x591acc['field'](_0x88b8('0x8c'),_0x88b8('0x5b'));if(_0x349c56[_0x88b8('0x8d')]){_0x349c56[_0x88b8('0x8d')]['forEach'](function(_0x27d249){_0x2931a9[_0x88b8('0x8d')]('i.'+_0x27d249[0x0],_0x27d249[0x1]==='DESC'?![]:!![]);});}if(!_[_0x88b8('0x70')](_0x491d57)){_0x2931a9['having'](_0x2eb686);_0x591acc[_0x88b8('0x43')]('t.id\x20IN\x20?',_0x491d57);}BPromise['resolve']()[_0x88b8('0x27')](function(){if(!_0x1275da){if(_0x407351['query']['MailAccountId']||_0x407351[_0x88b8('0x3a')][_0x88b8('0x8e')])return;_0x591acc[_0x88b8('0x43')](_0x88b8('0x8f'));_0x2931a9['where'](_0x88b8('0x8f'));return;}return _0x407351['user'][_0x88b8('0x90')]({'attributes':['id'],'raw':!![]})[_0x88b8('0x27')](function(_0x2eb078){if(_[_0x88b8('0x70')](_0x2eb078)){_0x591acc[_0x88b8('0x43')]('i.MailAccountId\x20IS\x20NULL');_0x2931a9['where']('i.MailAccountId\x20IS\x20NULL');}else{_0x591acc[_0x88b8('0x43')](_0x88b8('0x72'),_[_0x88b8('0x2b')](_0x2eb078,'id'));_0x2931a9[_0x88b8('0x43')](_0x88b8('0x72'),_['map'](_0x2eb078,'id'));}});})[_0x88b8('0x27')](function(){db['sequelize']['query'](_0x591acc[_0x88b8('0x91')](),_0x20d934)[_0x88b8('0x27')](function(_0x429b3f){_0x3ed77c[_0x88b8('0x1f')]=_0x429b3f[_0x88b8('0x41')];if(_0x3ed77c[_0x88b8('0x1f')]===0x0)return[];return db[_0x88b8('0x92')][_0x88b8('0x3a')](_0xde9620['toString'](),_0x20d934)[_0x88b8('0x27')](function(_0x7c530e){_0x569c7a=_[_0x88b8('0x93')](_0x7c530e,'id');_0x20d934=_[_0x88b8('0x94')](_0x20d934,{'model':db[_0x88b8('0x31')],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x407351[_0x88b8('0x3a')][_0x88b8('0x40')]){_0x349c56[_0x88b8('0x3f')]['forEach'](function(_0x551c3d){_0x2931a9['field']('i.'+_0x551c3d);});}else{_0x2931a9['field']('SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','unreadMessages');_0x2931a9[_0x88b8('0x46')](_0x88b8('0x95'),'Account.key');_0x2931a9[_0x88b8('0x46')]('a.mandatoryDisposition',_0x88b8('0x96'));_0x2931a9[_0x88b8('0x46')](_0x88b8('0x88'));_0x2931a9[_0x88b8('0x46')](_0x88b8('0x97'));_0x2931a9[_0x88b8('0x46')](_0x88b8('0x98'));_0x2931a9[_0x88b8('0x46')](_0x88b8('0x99'));_0x2931a9[_0x88b8('0x46')]('i.closedAt');_0x2931a9[_0x88b8('0x46')]('i.attach');_0x2931a9[_0x88b8('0x46')](_0x88b8('0x9a'));_0x2931a9[_0x88b8('0x46')](_0x88b8('0x9b'));_0x2931a9['field'](_0x88b8('0x9c'));_0x2931a9[_0x88b8('0x46')](_0x88b8('0x9d'));_0x2931a9['field'](_0x88b8('0x9e'));_0x2931a9['field'](_0x88b8('0x9f'));_0x2931a9[_0x88b8('0x46')]('i.ContactId');_0x2931a9[_0x88b8('0x46')](_0x88b8('0xa0'));_0x2931a9[_0x88b8('0x46')](_0x88b8('0xa1'));_0x2931a9[_0x88b8('0x46')]('c.firstName',_0x88b8('0xa2'));_0x2931a9['field'](_0x88b8('0xa3'),_0x88b8('0xa4'));_0x2931a9[_0x88b8('0x46')]('c.email','Contact.email');_0x2931a9[_0x88b8('0x46')](_0x88b8('0xa5'),_0x88b8('0xa6'));_0x2931a9[_0x88b8('0x46')](_0x88b8('0xa7'),_0x88b8('0xa8'));_0x2931a9[_0x88b8('0x46')](_0x88b8('0xa9'),_0x88b8('0xaa'));_0x2931a9[_0x88b8('0x46')]('o.fullname',_0x88b8('0xab'));_0x2931a9['field'](_0x88b8('0xac'),'Owner.internal');_0x2931a9[_0x88b8('0x46')](_0x88b8('0xad'),_0x88b8('0x2d'));}_0x2931a9[_0x88b8('0x21')](_0x349c56[_0x88b8('0x21')]);_0x2931a9[_0x88b8('0x20')](_0x349c56['offset']);return db[_0x88b8('0x92')][_0x88b8('0x3a')](_0x2931a9[_0x88b8('0x91')](),_0x20d934);})[_0x88b8('0x27')](function(_0x5b1c0a){_0x1e2633[_0x88b8('0x43')](_0x88b8('0xae'),_[_0x88b8('0x2b')](_0x5b1c0a,'id'));return db['sequelize']['query'](_0x1e2633[_0x88b8('0x91')](),_0x20d934)[_0x88b8('0x27')](function(_0x1aa6dd){var _0x239cc6=_[_0x88b8('0xaf')](_0x1aa6dd,_0x88b8('0xb0'));var _0x402502=[];return db[_0x88b8('0xb1')][_0x88b8('0x32')]({'attributes':[_0x88b8('0xb2')],'raw':!![]})[_0x88b8('0x27')](function(_0x4f9637){var _0x3192cd=_0x4f9637[_0x88b8('0xb2')];_0x5b1c0a[_0x88b8('0x69')](function(_0x129d92){_0x402502[_0x88b8('0x30')](updateMailInteraction(_0x129d92,_0x569c7a,_0x239cc6,_0x3192cd));});return BPromise[_0x88b8('0xb3')](_0x402502);});});});})[_0x88b8('0x27')](function(_0x423eae){_0x3ed77c[_0x88b8('0xb4')]=_0x423eae;return _0x3ed77c;})[_0x88b8('0x27')](respondWithFilteredResult(_0x2cde67,_0x349c56));})['catch'](handleError(_0x2cde67,null));};exports[_0x88b8('0xb5')]=function(_0x15c246,_0x4d47a6){var _0x3d8336={'raw':![],'where':{'id':_0x15c246[_0x88b8('0xb6')]['id']}},_0x523e37={};_0x523e37['model']=_[_0x88b8('0x3b')](db[_0x88b8('0x31')][_0x88b8('0x37')]);_0x523e37[_0x88b8('0x3a')]=_[_0x88b8('0x3b')](_0x15c246['query']);_0x523e37['filters']=_[_0x88b8('0x3d')](_0x523e37[_0x88b8('0x3e')],_0x523e37[_0x88b8('0x3a')]);_0x3d8336[_0x88b8('0x3f')]=_[_0x88b8('0x3d')](_0x523e37['model'],qs['fields'](_0x15c246[_0x88b8('0x3a')]['fields']));_0x3d8336[_0x88b8('0x3f')]=_0x3d8336[_0x88b8('0x3f')][_0x88b8('0x41')]?_0x3d8336[_0x88b8('0x3f')]:_0x523e37[_0x88b8('0x3e')];if(_0x15c246['query'][_0x88b8('0xb7')]){_0x3d8336[_0x88b8('0xb8')]=[{'all':!![]}];}_0x3d8336=_[_0x88b8('0x94')]({},_0x3d8336,_0x15c246['options']);return db[_0x88b8('0x31')][_0x88b8('0x5a')](_0x3d8336)[_0x88b8('0x27')](handleEntityNotFound(_0x4d47a6,null))[_0x88b8('0x27')](respondWithResult(_0x4d47a6,null))[_0x88b8('0x36')](handleError(_0x4d47a6,null));};exports[_0x88b8('0xb9')]=function(_0x3a375c,_0x17d9fc){return db[_0x88b8('0x31')][_0x88b8('0xb9')](_0x3a375c[_0x88b8('0xba')],{})['then'](respondWithResult(_0x17d9fc,0xc9))[_0x88b8('0x36')](handleError(_0x17d9fc,null));};exports[_0x88b8('0x26')]=function(_0x5c6399,_0x368de4){if(_0x5c6399[_0x88b8('0xba')]['id']){delete _0x5c6399[_0x88b8('0xba')]['id'];}return db['MailInteraction'][_0x88b8('0x5a')]({'where':{'id':_0x5c6399[_0x88b8('0xb6')]['id']}})['then'](handleEntityNotFound(_0x368de4,null))[_0x88b8('0x27')](saveUpdates(_0x5c6399['body'],null))[_0x88b8('0x27')](respondWithResult(_0x368de4,null))[_0x88b8('0x36')](handleError(_0x368de4,null));};exports['destroy']=function(_0x433475,_0x4e9085){return db[_0x88b8('0x31')][_0x88b8('0x5a')]({'where':{'id':_0x433475['params']['id']}})[_0x88b8('0x27')](handleEntityNotFound(_0x4e9085,null))[_0x88b8('0x27')](removeEntity(_0x4e9085,null))[_0x88b8('0x36')](handleError(_0x4e9085,null));};exports[_0x88b8('0xbb')]=function(_0x97d4ad,_0x5e22dd){return db[_0x88b8('0x31')][_0x88b8('0xbb')]()[_0x88b8('0x27')](respondWithResult(_0x5e22dd,null))[_0x88b8('0x36')](handleError(_0x5e22dd,null));};exports['addMessage']=function(_0x7ae4bf,_0x155e45,_0x2206fd){return db['MailMessage'][_0x88b8('0x5a')]({'where':{'id':_0x7ae4bf[_0x88b8('0xb6')]['id']}})[_0x88b8('0x27')](handleEntityNotFound(_0x155e45,null))['then'](function(_0x1a5dbd){if(_0x1a5dbd){return _0x1a5dbd[_0x88b8('0xbc')](_0x7ae4bf[_0x88b8('0xba')][_0x88b8('0xbd')],_[_0x88b8('0xbe')](_0x7ae4bf[_0x88b8('0xba')],[_0x88b8('0xbd'),'id'])||{});}})['then'](respondWithResult(_0x155e45,null))['catch'](handleError(_0x155e45,null));};exports[_0x88b8('0xbf')]=function(_0x2765e4,_0x4b3260,_0x194bf9){var _0x3b6ee9={'raw':![],'where':{}};var _0x282020={};var _0x1b38a2={'count':0x0,'rows':[]};return db[_0x88b8('0x31')]['findOne']({'where':{'id':_0x2765e4[_0x88b8('0xb6')]['id']}})[_0x88b8('0x27')](handleEntityNotFound(_0x4b3260,null))[_0x88b8('0x27')](function(_0x2b538e){if(_0x2b538e){_0x282020[_0x88b8('0x3e')]=_[_0x88b8('0x3b')](db['MailMessage'][_0x88b8('0x37')]);_0x282020['query']=_[_0x88b8('0x3b')](_0x2765e4[_0x88b8('0x3a')]);_0x282020[_0x88b8('0x3c')]=_['intersection'](_0x282020[_0x88b8('0x3e')],_0x282020[_0x88b8('0x3a')]);_0x3b6ee9['attributes']=_[_0x88b8('0x3d')](_0x282020[_0x88b8('0x3e')],qs[_0x88b8('0x40')](_0x2765e4[_0x88b8('0x3a')][_0x88b8('0x40')]));_0x3b6ee9[_0x88b8('0x3f')]=_0x3b6ee9[_0x88b8('0x3f')][_0x88b8('0x41')]?_0x3b6ee9['attributes']:_0x282020[_0x88b8('0x3e')];if(!_0x2765e4[_0x88b8('0x3a')][_0x88b8('0x42')](_0x88b8('0xc0'))){_0x3b6ee9[_0x88b8('0x21')]=qs[_0x88b8('0x21')](_0x2765e4[_0x88b8('0x3a')][_0x88b8('0x21')]);_0x3b6ee9[_0x88b8('0x20')]=qs[_0x88b8('0x20')](_0x2765e4['query'][_0x88b8('0x20')]);}_0x3b6ee9[_0x88b8('0x8d')]=qs['sort'](_0x2765e4['query'][_0x88b8('0xc1')]);_0x3b6ee9[_0x88b8('0x43')]=qs[_0x88b8('0x3c')](_[_0x88b8('0x44')](_0x2765e4[_0x88b8('0x3a')],_0x282020[_0x88b8('0x3c')]));_0x3b6ee9[_0x88b8('0x43')][_0x88b8('0xb0')]=_0x2b538e['id'];if(_0x2765e4[_0x88b8('0x3a')][_0x88b8('0x80')]){_0x3b6ee9[_0x88b8('0x43')]=_[_0x88b8('0x94')](_0x3b6ee9[_0x88b8('0x43')],{'$or':_[_0x88b8('0x2b')](_0x3b6ee9[_0x88b8('0x3f')],function(_0x5c69d1){var _0x4bf050={};_0x4bf050[_0x5c69d1]={'$like':'%'+_0x2765e4[_0x88b8('0x3a')]['filter']+'%'};return _0x4bf050;})});}if(_0x2765e4['query'][_0x88b8('0x76')]){var _0x4db4e6=_0x2765e4[_0x88b8('0x3a')][_0x88b8('0x76')][_0x88b8('0x2f')](',');var _0x203502={};_0x203502[_0x4db4e6[0x0]]={'$gte':moment(_0x4db4e6[0x1])[_0x88b8('0xc2')]('YYYY-MM-DD\x20HH:mm:ss')};_0x3b6ee9[_0x88b8('0x43')]=_[_0x88b8('0x94')](_0x3b6ee9[_0x88b8('0x43')],_0x203502);}_0x3b6ee9=_[_0x88b8('0x94')]({},_0x3b6ee9,_0x2765e4[_0x88b8('0xc3')]);return db['MailMessage']['count']({'where':_0x3b6ee9['where']})['then'](function(_0x5769ee){_0x1b38a2[_0x88b8('0x1f')]=_0x5769ee;if(_0x2765e4[_0x88b8('0x3a')][_0x88b8('0xb7')]){_0x3b6ee9[_0x88b8('0xb8')]=[{'all':!![]}];}return db['MailMessage'][_0x88b8('0xc4')](_0x3b6ee9);})['then'](function(_0x4dc139){_0x1b38a2['rows']=_0x4dc139;return _0x1b38a2;});}})[_0x88b8('0x27')](respondWithFilteredResult(_0x4b3260,_0x3b6ee9))[_0x88b8('0x36')](handleError(_0x4b3260,null));};exports[_0x88b8('0xc5')]=function(_0x1208ea,_0xd15b47,_0x4085f6){return db[_0x88b8('0x31')]['find']({'where':{'id':_0x1208ea[_0x88b8('0xb6')]['id']}})[_0x88b8('0x27')](handleEntityNotFound(_0xd15b47,null))[_0x88b8('0x27')](function(_0x26ff2d){if(_0x26ff2d){return _0x26ff2d['setTags'](_0x1208ea[_0x88b8('0xba')]['ids'],_['omit'](_0x1208ea[_0x88b8('0xba')],[_0x88b8('0xbd'),'id'])||{})[_0x88b8('0xc6')](function(){return db[_0x88b8('0x68')][_0x88b8('0xc4')]({'attributes':['id',_0x88b8('0x39'),'color'],'where':{'id':_0x1208ea['body'][_0x88b8('0xbd')]}});})['then'](function(_0x35e074){socket[_0x88b8('0xc7')](_0x88b8('0xc8'),{'id':Number(_0x1208ea['params']['id']),'tags':_0x35e074||[]});return{'id':Number(_0x1208ea[_0x88b8('0xb6')]['id']),'tags':_0x35e074||[]};});}})[_0x88b8('0x27')](respondWithResult(_0xd15b47,null))['catch'](handleError(_0xd15b47,null));};exports[_0x88b8('0xc9')]=function(_0x4a499f,_0x25cb3c,_0x5cc4e8){return db[_0x88b8('0x31')][_0x88b8('0x5a')]({'where':{'id':_0x4a499f[_0x88b8('0xb6')]['id']}})[_0x88b8('0x27')](handleEntityNotFound(_0x25cb3c,null))[_0x88b8('0x27')](function(_0x50e978){if(_0x50e978){return _0x50e978[_0x88b8('0xc9')](_0x4a499f[_0x88b8('0x3a')][_0x88b8('0xbd')]);}})[_0x88b8('0x27')](respondWithStatusCode(_0x25cb3c,null))[_0x88b8('0x36')](handleError(_0x25cb3c,null));};exports['download']=function(_0x542e66,_0x48b260){var _0x2e529e=moment()[_0x88b8('0xca')]()['toString']();var _0x28d2f1=path[_0x88b8('0xcb')](config[_0x88b8('0xcc')],_0x88b8('0xcd'),_0x88b8('0xce'),_0x88b8('0xcf'));var _0xcb3114=path['join'](config['root'],_0x88b8('0xcd'),_0x88b8('0xce'),'attachments');var _0x1cefd1=path['join'](_0x28d2f1,_0x2e529e);var _0x17f307=util[_0x88b8('0xc2')]('transcript-%d-%s.zip',_0x542e66[_0x88b8('0xb6')]['id'],_0x2e529e);var _0x3815d8=path[_0x88b8('0xcb')](_0x28d2f1,_0x17f307);var _0x4f997e=[];if(_0x542e66[_0x88b8('0x3a')][_0x88b8('0xd0')]){_0x4f997e[_0x88b8('0x30')]({'model':db[_0x88b8('0xd1')],'as':'Attachments','raw':!![]});}var _0x4e325a=[{'model':db[_0x88b8('0xd2')],'as':_0x88b8('0xd3'),'attributes':['id',_0x88b8('0xba'),_0x88b8('0x4a'),'to','cc','bcc',_0x88b8('0xd4'),_0x88b8('0x74')],'where':{'secret':![]},'order':qs[_0x88b8('0xc1')]('id'),'include':_0x4f997e}];return db['MailInteraction'][_0x88b8('0x5a')]({'where':{'id':_0x542e66[_0x88b8('0xb6')]['id']},'include':_0x4e325a})['then'](handleEntityNotFound(_0x48b260,null))['then'](function(_0xde1953){if(_0xde1953&&_0xde1953[_0x88b8('0xd3')]){var _0x2aae2b=_0xde1953[_0x88b8('0xd5')]({'plain':!![]});fs['mkdirSync'](_0x1cefd1);return BPromise['each'](_0x2aae2b[_0x88b8('0xd3')],function(_0x14f256,_0x53813d){var _0x28b040={'from':_0x14f256[_0x88b8('0x4a')],'to':_0x14f256['to'],'subject':_0x14f256[_0x88b8('0xd4')],'html':_0x14f256[_0x88b8('0xba')],'headers':{'Date':moment(_0x14f256['createdAt'])[_0x88b8('0xc2')](_0x88b8('0xd6'))},'attachments':[]};if(_0x14f256['cc']){_0x28b040[_0x88b8('0xd7')]['Cc']=_0x14f256['cc'];}if(_0x14f256[_0x88b8('0xd8')]){_0x28b040[_0x88b8('0xd7')]['Bcc']=_0x14f256['bcc'];}return new BPromise(function(_0x2bba78,_0x3d1093){if(_0x14f256['Attachments']){for(var _0x578777=0x0;_0x578777<_0x14f256[_0x88b8('0xd9')][_0x88b8('0x41')];_0x578777++){var _0x2a1aef=_0x14f256['Attachments'][_0x578777];var _0x1c9a71=path['join'](_0xcb3114,_0x2a1aef[_0x88b8('0xda')]);if(fs[_0x88b8('0xdb')](_0x1c9a71)){_0x28b040[_0x88b8('0xd0')][_0x88b8('0x30')]({'name':_0x2a1aef[_0x88b8('0x39')],'contentType':_0x2a1aef['type'],'data':fs[_0x88b8('0xdc')](_0x1c9a71)});}}}emlformat['build'](_0x28b040,function(_0x673a08,_0x2702ba){if(_0x673a08)return _0x3d1093(_0x673a08);fs[_0x88b8('0xdd')](path[_0x88b8('0xcb')](_0x1cefd1,util[_0x88b8('0xc2')]('message%d.eml',_0x53813d)),_0x2702ba);return _0x2bba78(_0x2702ba);});});})[_0x88b8('0x27')](function(){return new BPromise(function(_0x438c1b,_0x1721b7){zipdir(_0x1cefd1,{'saveTo':_0x3815d8},function(_0x116dbd,_0x1ec7b6){if(_0x116dbd)return _0x1721b7(_0x116dbd);return _0x438c1b(_0x1ec7b6);});})['then'](function(){return new BPromise(function(_0x550028,_0x4a65d8){rimraf(_0x1cefd1,function(_0x213ba0){if(_0x213ba0)_0x4a65d8(_0x213ba0);return _0x550028();});});})['then'](function(){return _0x48b260[_0x88b8('0xde')](_0x3815d8,_0x17f307,function(_0x28f8a4){if(_0x28f8a4){console[_0x88b8('0xdf')](_0x88b8('0xe0'),_0x28f8a4);}else{fs[_0x88b8('0xe1')](_0x3815d8);}});});});}else{return _0x48b260[_0x88b8('0x1c')](0xc8);}})[_0x88b8('0x36')](handleError(_0x48b260,null));}; \ No newline at end of file diff --git a/server/api/mailInteraction/mailInteraction.events.js b/server/api/mailInteraction/mailInteraction.events.js index 3619224..b681ada 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 _0x7036=['emit','hasOwnProperty','hook','exports','events','../../mysqldb','MailInteraction','MailMessage','setMaxListeners','save','update','remove','then','setDataValue','Users','map','findAll','unreadMessages','length'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x7036,0x1cc));var _0x6703=function(_0x2236dc,_0x43c7f9){_0x2236dc=_0x2236dc-0x0;var _0x20583f=_0x7036[_0x2236dc];return _0x20583f;};'use strict';var EventEmitter=require(_0x6703('0x0'));var MailInteraction=require(_0x6703('0x1'))['db'][_0x6703('0x2')];var MailMessage=require(_0x6703('0x1'))['db'][_0x6703('0x3')];var MailInteractionEvents=new EventEmitter();MailInteractionEvents[_0x6703('0x4')](0x0);var events={'afterCreate':_0x6703('0x5'),'afterUpdate':_0x6703('0x6'),'afterDestroy':_0x6703('0x7')};function emitEvent(_0x39daae){return function(_0x11ca7a,_0x41fa5e,_0x5174fa){_0x11ca7a['getUsers']({'attributes':['id'],'raw':!![]})[_0x6703('0x8')](function(_0x208bc5){_0x11ca7a[_0x6703('0x9')](_0x6703('0xa'),_0x208bc5[_0x6703('0xb')](function(_0x59e74f){return{'id':_0x59e74f['id']};}));return MailMessage[_0x6703('0xc')]({'where':{'MailInteractionId':_0x11ca7a['id'],'direction':'in','read':![]},'raw':!![]});})[_0x6703('0x8')](function(_0x23c423){_0x11ca7a['setDataValue'](_0x6703('0xd'),_0x23c423[_0x6703('0xe')]);MailInteractionEvents[_0x6703('0xf')](_0x39daae+':'+_0x11ca7a['id'],_0x11ca7a);MailInteractionEvents[_0x6703('0xf')](_0x39daae,_0x11ca7a);_0x5174fa(null);})['catch'](_0x5174fa(null));};}for(var e in events){if(events[_0x6703('0x10')](e)){var event=events[e];MailInteraction[_0x6703('0x11')](e,emitEvent(event));}}module[_0x6703('0x12')]=MailInteractionEvents; \ No newline at end of file +var _0x420b=['length','emit','catch','hasOwnProperty','hook','exports','events','../../mysqldb','MailInteraction','MailMessage','save','update','remove','getUsers','then','setDataValue','Users','map','unreadMessages'];(function(_0x2b5513,_0x3fe5cd){var _0x578fd2=function(_0x7a9106){while(--_0x7a9106){_0x2b5513['push'](_0x2b5513['shift']());}};_0x578fd2(++_0x3fe5cd);}(_0x420b,0x15c));var _0xb420=function(_0x51c0c9,_0x48dbd7){_0x51c0c9=_0x51c0c9-0x0;var _0x1de2e6=_0x420b[_0x51c0c9];return _0x1de2e6;};'use strict';var EventEmitter=require(_0xb420('0x0'));var MailInteraction=require(_0xb420('0x1'))['db'][_0xb420('0x2')];var MailMessage=require(_0xb420('0x1'))['db'][_0xb420('0x3')];var MailInteractionEvents=new EventEmitter();MailInteractionEvents['setMaxListeners'](0x0);var events={'afterCreate':_0xb420('0x4'),'afterUpdate':_0xb420('0x5'),'afterDestroy':_0xb420('0x6')};function emitEvent(_0x2cfa97){return function(_0x5749d7,_0x171e91,_0x241d1b){_0x5749d7[_0xb420('0x7')]({'attributes':['id'],'raw':!![]})[_0xb420('0x8')](function(_0x14c624){_0x5749d7[_0xb420('0x9')](_0xb420('0xa'),_0x14c624[_0xb420('0xb')](function(_0x9f3674){return{'id':_0x9f3674['id']};}));return MailMessage['findAll']({'where':{'MailInteractionId':_0x5749d7['id'],'direction':'in','read':![]},'raw':!![]});})[_0xb420('0x8')](function(_0x47ecc1){_0x5749d7['setDataValue'](_0xb420('0xc'),_0x47ecc1[_0xb420('0xd')]);MailInteractionEvents[_0xb420('0xe')](_0x2cfa97+':'+_0x5749d7['id'],_0x5749d7);MailInteractionEvents[_0xb420('0xe')](_0x2cfa97,_0x5749d7);_0x241d1b(null);})[_0xb420('0xf')](_0x241d1b(null));};}for(var e in events){if(events[_0xb420('0x10')](e)){var event=events[e];MailInteraction[_0xb420('0x11')](e,emitEvent(event));}}module[_0xb420('0x12')]=MailInteractionEvents; \ No newline at end of file diff --git a/server/api/mailInteraction/mailInteraction.model.js b/server/api/mailInteraction/mailInteraction.model.js index 9192982..e76babe 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 _0x63a9=['get','MailMessage','update','then','utf8mb4','lodash','api','moment','bluebird','request-promise','../../config/environment','./mailInteraction.attributes','exports','define','MailInteraction','fti_mail_interactions','subject','substatus','substatusAt','format','closed','closedAt','YYYY-MM-DD\x20HH:mm:ss','changed','models'];(function(_0x36ed48,_0x1ee0d4){var _0x51c63a=function(_0x2d0a40){while(--_0x2d0a40){_0x36ed48['push'](_0x36ed48['shift']());}};_0x51c63a(++_0x1ee0d4);}(_0x63a9,0xff));var _0x963a=function(_0x3f2d3e,_0x33226d){_0x3f2d3e=_0x3f2d3e-0x0;var _0x5c4987=_0x63a9[_0x3f2d3e];return _0x5c4987;};'use strict';var _=require(_0x963a('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x963a('0x1'));var moment=require(_0x963a('0x2'));var BPromise=require(_0x963a('0x3'));var rp=require(_0x963a('0x4'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x963a('0x5'));var attributes=require(_0x963a('0x6'));module[_0x963a('0x7')]=function(_0x504c40,_0x5094a0){return _0x504c40[_0x963a('0x8')](_0x963a('0x9'),attributes,{'tableName':'mail_interactions','paranoid':![],'indexes':[{'name':_0x963a('0xa'),'fields':[_0x963a('0xb'),'to'],'type':'FULLTEXT'}],'timestamps':!![],'hooks':{'beforeCreate':function(_0xd255f6,_0x3bfdbe,_0xc44e88){if(_0xd255f6[_0x963a('0xc')]){_0xd255f6[_0x963a('0xd')]=moment()[_0x963a('0xe')]('YYYY-MM-DD\x20HH:mm:ss');}if(_0xd255f6[_0x963a('0xf')]){_0xd255f6[_0x963a('0x10')]=moment()[_0x963a('0xe')](_0x963a('0x11'));}_0xc44e88(null,_0x3bfdbe);},'beforeUpdate':function(_0x1e0ef0,_0x23bf6f,_0x3f02a4){if(_0x1e0ef0['changed'](_0x963a('0xc'))){_0x1e0ef0[_0x963a('0xd')]=_0x1e0ef0[_0x963a('0xc')]?moment()[_0x963a('0xe')]('YYYY-MM-DD\x20HH:mm:ss'):null;}if(_0x1e0ef0[_0x963a('0x12')]('closed')){_0x1e0ef0[_0x963a('0x10')]=moment()[_0x963a('0xe')](_0x963a('0x11'));_0x1e0ef0[_0x963a('0xc')]=null;_0x1e0ef0[_0x963a('0xd')]=null;}_0x3f02a4(null,_0x1e0ef0);},'afterUpdate':function(_0x2f4566,_0x44a93c,_0x25fd18){var _0x4f68ea=_0x504c40[_0x963a('0x13')];var _0x18cfa6=_0x2f4566[_0x963a('0x14')]({'plain':!![]});if(_0x18cfa6['closed']){return _0x4f68ea[_0x963a('0x15')][_0x963a('0x16')]({'read':!![]},{'where':{'MailInteractionId':_0x18cfa6['id']}})[_0x963a('0x17')](function(){_0x25fd18();})['catch'](function(_0x491eb7){_0x25fd18(_0x491eb7);});}else{_0x25fd18();}}},'charset':_0x963a('0x18'),'collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file +var _0x345e=['format','YYYY-MM-DD\x20HH:mm:ss','closed','closedAt','get','MailMessage','update','then','utf8mb4','lodash','util','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./mailInteraction.attributes','exports','define','MailInteraction','mail_interactions','fti_mail_interactions','subject','substatus','substatusAt'];(function(_0x36f752,_0x4e6dc9){var _0x3722ca=function(_0x278b61){while(--_0x278b61){_0x36f752['push'](_0x36f752['shift']());}};_0x3722ca(++_0x4e6dc9);}(_0x345e,0x168));var _0xe345=function(_0x38febf,_0x1fdebc){_0x38febf=_0x38febf-0x0;var _0x36db7f=_0x345e[_0x38febf];return _0x36db7f;};'use strict';var _=require(_0xe345('0x0'));var util=require(_0xe345('0x1'));var logger=require('../../config/logger')(_0xe345('0x2'));var moment=require(_0xe345('0x3'));var BPromise=require(_0xe345('0x4'));var rp=require(_0xe345('0x5'));var fs=require('fs');var path=require(_0xe345('0x6'));var rimraf=require(_0xe345('0x7'));var config=require(_0xe345('0x8'));var attributes=require(_0xe345('0x9'));module[_0xe345('0xa')]=function(_0x575c38,_0x4491a9){return _0x575c38[_0xe345('0xb')](_0xe345('0xc'),attributes,{'tableName':_0xe345('0xd'),'paranoid':![],'indexes':[{'name':_0xe345('0xe'),'fields':[_0xe345('0xf'),'to'],'type':'FULLTEXT'}],'timestamps':!![],'hooks':{'beforeCreate':function(_0x5912b2,_0x41bd55,_0x47382b){if(_0x5912b2[_0xe345('0x10')]){_0x5912b2[_0xe345('0x11')]=moment()[_0xe345('0x12')](_0xe345('0x13'));}if(_0x5912b2[_0xe345('0x14')]){_0x5912b2[_0xe345('0x15')]=moment()[_0xe345('0x12')](_0xe345('0x13'));}_0x47382b(null,_0x41bd55);},'beforeUpdate':function(_0x5ed9f0,_0xf95224,_0x1a8ced){if(_0x5ed9f0['changed']('substatus')){_0x5ed9f0[_0xe345('0x11')]=_0x5ed9f0['substatus']?moment()[_0xe345('0x12')]('YYYY-MM-DD\x20HH:mm:ss'):null;}if(_0x5ed9f0['changed'](_0xe345('0x14'))){_0x5ed9f0[_0xe345('0x15')]=moment()[_0xe345('0x12')](_0xe345('0x13'));_0x5ed9f0[_0xe345('0x10')]=null;_0x5ed9f0[_0xe345('0x11')]=null;}_0x1a8ced(null,_0x5ed9f0);},'afterUpdate':function(_0x1d3717,_0x52e7b0,_0x3a3f32){var _0x1f983c=_0x575c38['models'];var _0x4f3887=_0x1d3717[_0xe345('0x16')]({'plain':!![]});if(_0x4f3887[_0xe345('0x14')]){return _0x1f983c[_0xe345('0x17')][_0xe345('0x18')]({'read':!![]},{'where':{'MailInteractionId':_0x4f3887['id']}})[_0xe345('0x19')](function(){_0x3a3f32();})['catch'](function(_0x1a1f56){_0x3a3f32(_0x1a1f56);});}else{_0x3a3f32();}}},'charset':_0xe345('0x1a'),'collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file diff --git a/server/api/mailInteraction/mailInteraction.rpc.js b/server/api/mailInteraction/mailInteraction.rpc.js index 58e6ec6..f02c9e2 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 _0xbd3b=['request\x20sent','debug','MailInteraction,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','catch','MailInteraction','update','body','options','where','limit','UpdateMailInteraction','AddTagsToMailInteraction','find','addTags','ids','omit','AddTags','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','client','redis','defaults','socket.io-emitter','./mailInteraction.socket','register','then','MailInteraction,\x20%s,\x20%s'];(function(_0x2dfd28,_0x153b3c){var _0x49c016=function(_0x1cfb4d){while(--_0x1cfb4d){_0x2dfd28['push'](_0x2dfd28['shift']());}};_0x49c016(++_0x153b3c);}(_0xbd3b,0x1c3));var _0xbbd3=function(_0x2c00af,_0x5d5c83){_0x2c00af=_0x2c00af-0x0;var _0x592a13=_0xbd3b[_0x2c00af];return _0x592a13;};'use strict';var _=require(_0xbbd3('0x0'));var util=require(_0xbbd3('0x1'));var moment=require(_0xbbd3('0x2'));var BPromise=require('bluebird');var rs=require(_0xbbd3('0x3'));var fs=require('fs');var Redis=require(_0xbbd3('0x4'));var db=require(_0xbbd3('0x5'))['db'];var utils=require(_0xbbd3('0x6'));var logger=require('../../config/logger')(_0xbbd3('0x7'));var config=require(_0xbbd3('0x8'));var jayson=require('jayson/promise');var client=jayson[_0xbbd3('0x9')]['http']({'port':0x232a});config[_0xbbd3('0xa')]=_[_0xbbd3('0xb')](config[_0xbbd3('0xa')],{'host':'localhost','port':0x18eb});var socket=require(_0xbbd3('0xc'))(new Redis(config[_0xbbd3('0xa')]));require(_0xbbd3('0xd'))[_0xbbd3('0xe')](socket);function respondWithRpcPromise(_0x56bc73,_0xeade3a,_0x2867b5){return new BPromise(function(_0x22abee,_0x2b49ca){return client['request'](_0x56bc73,_0x2867b5)[_0xbbd3('0xf')](function(_0x55089b){logger['info'](_0xbbd3('0x10'),_0xeade3a,_0xbbd3('0x11'));logger[_0xbbd3('0x12')](_0xbbd3('0x13'),_0xeade3a,_0xbbd3('0x11'),JSON[_0xbbd3('0x14')](_0x55089b));if(_0x55089b[_0xbbd3('0x15')]){if(_0x55089b[_0xbbd3('0x15')][_0xbbd3('0x16')]===0x1f4){logger[_0xbbd3('0x15')]('MailInteraction,\x20%s,\x20%s',_0xeade3a,_0x55089b['error'][_0xbbd3('0x17')]);return _0x2b49ca(_0x55089b[_0xbbd3('0x15')][_0xbbd3('0x17')]);}logger[_0xbbd3('0x15')](_0xbbd3('0x10'),_0xeade3a,_0x55089b['error'][_0xbbd3('0x17')]);return _0x22abee(_0x55089b['error'][_0xbbd3('0x17')]);}else{logger[_0xbbd3('0x18')](_0xbbd3('0x10'),_0xeade3a,_0xbbd3('0x11'));_0x22abee(_0x55089b['result']['message']);}})[_0xbbd3('0x19')](function(_0x456725){logger['error'](_0xbbd3('0x10'),_0xeade3a,_0x456725);_0x2b49ca(_0x456725);});});}exports['UpdateMailInteraction']=function(_0x2c4034){var _0x3db1ea=this;return new Promise(function(_0x839614,_0x1fa586){return db[_0xbbd3('0x1a')][_0xbbd3('0x1b')](_0x2c4034[_0xbbd3('0x1c')],{'raw':_0x2c4034['options']?_0x2c4034[_0xbbd3('0x1d')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x2c4034['options']?_0x2c4034[_0xbbd3('0x1d')][_0xbbd3('0x1e')]||null:null,'attributes':_0x2c4034[_0xbbd3('0x1d')]?_0x2c4034[_0xbbd3('0x1d')]['attributes']||null:null,'limit':_0x2c4034[_0xbbd3('0x1d')]?_0x2c4034['options'][_0xbbd3('0x1f')]||null:null})['then'](function(_0x560b5d){logger['info']('UpdateMailInteraction',_0x2c4034);logger[_0xbbd3('0x12')](_0xbbd3('0x20'),_0x2c4034,JSON['stringify'](_0x560b5d));_0x839614(_0x560b5d);})[_0xbbd3('0x19')](function(_0x28ff80){logger[_0xbbd3('0x15')](_0xbbd3('0x20'),_0x28ff80['message'],_0x2c4034);_0x1fa586(_0x3db1ea[_0xbbd3('0x15')](0x1f4,_0x28ff80['message']));});});};exports[_0xbbd3('0x21')]=function(_0x396793){return new Promise(function(_0x5bf14a,_0x279cb1){return db[_0xbbd3('0x1a')][_0xbbd3('0x22')]({'where':_0x396793[_0xbbd3('0x1d')]?_0x396793[_0xbbd3('0x1d')][_0xbbd3('0x1e')]||null:null})[_0xbbd3('0xf')](function(_0x373d4c){if(_0x373d4c){return _0x373d4c[_0xbbd3('0x23')](_0x396793['body'][_0xbbd3('0x24')],_[_0xbbd3('0x25')](_0x396793[_0xbbd3('0x1c')],[_0xbbd3('0x24'),'id'])||{});}})['spread'](function(_0x5a2290){logger[_0xbbd3('0x18')](_0xbbd3('0x26'),_0x396793);logger[_0xbbd3('0x12')](_0xbbd3('0x26'),_0x396793,JSON['stringify'](_0x5a2290));_0x5bf14a(_0x5a2290);})[_0xbbd3('0x19')](function(_0x38dbf0){logger[_0xbbd3('0x15')]('AddTags',_0x38dbf0[_0xbbd3('0x17')],_0x396793);_0x279cb1(_this[_0xbbd3('0x15')](0x1f4,_0x38dbf0[_0xbbd3('0x17')]));});});}; \ No newline at end of file +var _0xb63f=['bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','redis','defaults','./mailInteraction.socket','register','request','then','info','debug','MailInteraction,\x20%s,\x20%s,\x20%s','request\x20sent','error','MailInteraction,\x20%s,\x20%s','message','result','catch','update','body','options','raw','where','attributes','limit','UpdateMailInteraction','stringify','AddTagsToMailInteraction','MailInteraction','find','addTags','ids','omit','AddTags','moment'];(function(_0x21c3e7,_0x44dd9d){var _0x25e0eb=function(_0x2f8fc9){while(--_0x2f8fc9){_0x21c3e7['push'](_0x21c3e7['shift']());}};_0x25e0eb(++_0x44dd9d);}(_0xb63f,0xa3));var _0xfb63=function(_0x42ebba,_0x4cbf87){_0x42ebba=_0x42ebba-0x0;var _0x3fd2af=_0xb63f[_0x42ebba];return _0x3fd2af;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0xfb63('0x0'));var BPromise=require(_0xfb63('0x1'));var rs=require(_0xfb63('0x2'));var fs=require('fs');var Redis=require(_0xfb63('0x3'));var db=require(_0xfb63('0x4'))['db'];var utils=require(_0xfb63('0x5'));var logger=require(_0xfb63('0x6'))(_0xfb63('0x7'));var config=require(_0xfb63('0x8'));var jayson=require('jayson/promise');var client=jayson[_0xfb63('0x9')]['http']({'port':0x232a});config[_0xfb63('0xa')]=_[_0xfb63('0xb')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xfb63('0xa')]));require(_0xfb63('0xc'))[_0xfb63('0xd')](socket);function respondWithRpcPromise(_0x55c21b,_0x3f021b,_0x5adf74){return new BPromise(function(_0xb36a3,_0x303bc3){return client[_0xfb63('0xe')](_0x55c21b,_0x5adf74)[_0xfb63('0xf')](function(_0x204976){logger[_0xfb63('0x10')]('MailInteraction,\x20%s,\x20%s',_0x3f021b,'request\x20sent');logger[_0xfb63('0x11')](_0xfb63('0x12'),_0x3f021b,_0xfb63('0x13'),JSON['stringify'](_0x204976));if(_0x204976[_0xfb63('0x14')]){if(_0x204976[_0xfb63('0x14')]['code']===0x1f4){logger[_0xfb63('0x14')](_0xfb63('0x15'),_0x3f021b,_0x204976[_0xfb63('0x14')][_0xfb63('0x16')]);return _0x303bc3(_0x204976['error'][_0xfb63('0x16')]);}logger['error'](_0xfb63('0x15'),_0x3f021b,_0x204976[_0xfb63('0x14')][_0xfb63('0x16')]);return _0xb36a3(_0x204976[_0xfb63('0x14')][_0xfb63('0x16')]);}else{logger['info'](_0xfb63('0x15'),_0x3f021b,'request\x20sent');_0xb36a3(_0x204976[_0xfb63('0x17')]['message']);}})[_0xfb63('0x18')](function(_0x3dc969){logger[_0xfb63('0x14')](_0xfb63('0x15'),_0x3f021b,_0x3dc969);_0x303bc3(_0x3dc969);});});}exports['UpdateMailInteraction']=function(_0x3fb8f9){var _0x57e2a8=this;return new Promise(function(_0x26d109,_0x3ef0cf){return db['MailInteraction'][_0xfb63('0x19')](_0x3fb8f9[_0xfb63('0x1a')],{'raw':_0x3fb8f9['options']?_0x3fb8f9[_0xfb63('0x1b')][_0xfb63('0x1c')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x3fb8f9[_0xfb63('0x1b')]?_0x3fb8f9[_0xfb63('0x1b')][_0xfb63('0x1d')]||null:null,'attributes':_0x3fb8f9[_0xfb63('0x1b')]?_0x3fb8f9[_0xfb63('0x1b')][_0xfb63('0x1e')]||null:null,'limit':_0x3fb8f9[_0xfb63('0x1b')]?_0x3fb8f9[_0xfb63('0x1b')][_0xfb63('0x1f')]||null:null})[_0xfb63('0xf')](function(_0x2d453a){logger[_0xfb63('0x10')](_0xfb63('0x20'),_0x3fb8f9);logger[_0xfb63('0x11')](_0xfb63('0x20'),_0x3fb8f9,JSON[_0xfb63('0x21')](_0x2d453a));_0x26d109(_0x2d453a);})['catch'](function(_0x2bbe9a){logger['error']('UpdateMailInteraction',_0x2bbe9a[_0xfb63('0x16')],_0x3fb8f9);_0x3ef0cf(_0x57e2a8[_0xfb63('0x14')](0x1f4,_0x2bbe9a[_0xfb63('0x16')]));});});};exports[_0xfb63('0x22')]=function(_0x1d7c55){return new Promise(function(_0x5d4a76,_0x594962){return db[_0xfb63('0x23')][_0xfb63('0x24')]({'where':_0x1d7c55[_0xfb63('0x1b')]?_0x1d7c55[_0xfb63('0x1b')][_0xfb63('0x1d')]||null:null})[_0xfb63('0xf')](function(_0xa8d6af){if(_0xa8d6af){return _0xa8d6af[_0xfb63('0x25')](_0x1d7c55[_0xfb63('0x1a')][_0xfb63('0x26')],_[_0xfb63('0x27')](_0x1d7c55['body'],[_0xfb63('0x26'),'id'])||{});}})['spread'](function(_0x39a1ca){logger[_0xfb63('0x10')](_0xfb63('0x28'),_0x1d7c55);logger['debug']('AddTags',_0x1d7c55,JSON[_0xfb63('0x21')](_0x39a1ca));_0x5d4a76(_0x39a1ca);})['catch'](function(_0x4a12c0){logger[_0xfb63('0x14')]('AddTags',_0x4a12c0[_0xfb63('0x16')],_0x1d7c55);_0x594962(_this[_0xfb63('0x14')](0x1f4,_0x4a12c0[_0xfb63('0x16')]));});});}; \ No newline at end of file diff --git a/server/api/mailInteraction/mailInteraction.socket.js b/server/api/mailInteraction/mailInteraction.socket.js index 0539e85..c2bf9f2 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 _0x69f6=['save','remove','update','emit','removeListener','register','length','./mailInteraction.events'];(function(_0x57b54c,_0x54ce0d){var _0x59cc19=function(_0xa33bc6){while(--_0xa33bc6){_0x57b54c['push'](_0x57b54c['shift']());}};_0x59cc19(++_0x54ce0d);}(_0x69f6,0x157));var _0x669f=function(_0x3df92e,_0x576813){_0x3df92e=_0x3df92e-0x0;var _0x2a3b78=_0x69f6[_0x3df92e];return _0x2a3b78;};'use strict';var MailInteractionEvents=require(_0x669f('0x0'));var events=[_0x669f('0x1'),_0x669f('0x2'),_0x669f('0x3')];function createListener(_0x3220e1,_0x3fb264){return function(_0x408595){_0x3fb264[_0x669f('0x4')](_0x3220e1,_0x408595);};}function removeListener(_0x4d9ef5,_0x5d3d41){return function(){MailInteractionEvents[_0x669f('0x5')](_0x4d9ef5,_0x5d3d41);};}exports[_0x669f('0x6')]=function(_0x5f2761){for(var _0x12e713=0x0,_0xdac127=events[_0x669f('0x7')];_0x12e713<_0xdac127;_0x12e713++){var _0x3ec08d=events[_0x12e713];var _0xb2fea7=createListener('mailInteraction:'+_0x3ec08d,_0x5f2761);MailInteractionEvents['on'](_0x3ec08d,_0xb2fea7);}}; \ No newline at end of file +var _0x473f=['register','length','mailInteraction:','./mailInteraction.events','save','remove','emit','removeListener'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x473f,0x19b));var _0xf473=function(_0x14195f,_0x25bc55){_0x14195f=_0x14195f-0x0;var _0x168f3e=_0x473f[_0x14195f];return _0x168f3e;};'use strict';var MailInteractionEvents=require(_0xf473('0x0'));var events=[_0xf473('0x1'),_0xf473('0x2'),'update'];function createListener(_0x146564,_0x77fa40){return function(_0x49df5f){_0x77fa40[_0xf473('0x3')](_0x146564,_0x49df5f);};}function removeListener(_0x4ba132,_0x1cf7f9){return function(){MailInteractionEvents[_0xf473('0x4')](_0x4ba132,_0x1cf7f9);};}exports[_0xf473('0x5')]=function(_0x57a6a2){for(var _0x35922f=0x0,_0x443088=events[_0xf473('0x6')];_0x35922f<_0x443088;_0x35922f++){var _0x12ad45=events[_0x35922f];var _0x1cb2a3=createListener(_0xf473('0x7')+_0x12ad45,_0x57a6a2);MailInteractionEvents['on'](_0x12ad45,_0x1cb2a3);}}; \ No newline at end of file diff --git a/server/api/mailMessage/index.js b/server/api/mailMessage/index.js index d4dab8d..9fdfc8d 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 _0x3e74=['path','connect-timeout','express','../../components/interaction/service','./mailMessage.controller','get','isAuthenticated','index','describe','/:id','download','post','tracked','mailmessage:create','create','update','put','accept','/:id/reject','delete','destroy','multer'];(function(_0x3cc977,_0x5a080e){var _0x21f180=function(_0x5da3f9){while(--_0x5da3f9){_0x3cc977['push'](_0x3cc977['shift']());}};_0x21f180(++_0x5a080e);}(_0x3e74,0x175));var _0x43e7=function(_0x47b05a,_0x567bd4){_0x47b05a=_0x47b05a-0x0;var _0x1ff311=_0x3e74[_0x47b05a];return _0x1ff311;};'use strict';var multer=require(_0x43e7('0x0'));var util=require('util');var path=require(_0x43e7('0x1'));var timeout=require(_0x43e7('0x2'));var express=require(_0x43e7('0x3'));var router=express['Router']();var auth=require('../../components/auth/service');var interaction=require(_0x43e7('0x4'));var config=require('../../config/environment');var controller=require(_0x43e7('0x5'));router[_0x43e7('0x6')]('/',auth[_0x43e7('0x7')](),controller[_0x43e7('0x8')]);router[_0x43e7('0x6')]('/describe',auth[_0x43e7('0x7')](),controller[_0x43e7('0x9')]);router[_0x43e7('0x6')](_0x43e7('0xa'),auth[_0x43e7('0x7')](),controller['show']);router[_0x43e7('0x6')]('/:id/download',auth['isAuthenticated'](),controller[_0x43e7('0xb')]);router[_0x43e7('0xc')]('/',auth['isAuthenticated'](),interaction[_0x43e7('0xd')]('mail',_0x43e7('0xe')),controller[_0x43e7('0xf')]);router['put'](_0x43e7('0xa'),auth[_0x43e7('0x7')](),controller[_0x43e7('0x10')]);router[_0x43e7('0x11')]('/:id/accept',auth['isAuthenticated'](),controller[_0x43e7('0x12')]);router[_0x43e7('0x11')](_0x43e7('0x13'),auth['isAuthenticated'](),controller['reject']);router[_0x43e7('0x14')](_0x43e7('0xa'),auth[_0x43e7('0x7')](),controller[_0x43e7('0x15')]);module['exports']=router; \ No newline at end of file +var _0xa41a=['../../components/auth/service','../../components/interaction/service','../../config/environment','./mailMessage.controller','get','index','describe','isAuthenticated','show','/:id/download','download','post','tracked','mailmessage:create','create','put','/:id/accept','accept','reject','delete','/:id','destroy','exports','multer','util','connect-timeout','express','Router'];(function(_0x127d77,_0x26bd98){var _0x47e0ec=function(_0x15af23){while(--_0x15af23){_0x127d77['push'](_0x127d77['shift']());}};_0x47e0ec(++_0x26bd98);}(_0xa41a,0x6b));var _0xaa41=function(_0x3f6aa2,_0x53eb7b){_0x3f6aa2=_0x3f6aa2-0x0;var _0x53aab4=_0xa41a[_0x3f6aa2];return _0x53aab4;};'use strict';var multer=require(_0xaa41('0x0'));var util=require(_0xaa41('0x1'));var path=require('path');var timeout=require(_0xaa41('0x2'));var express=require(_0xaa41('0x3'));var router=express[_0xaa41('0x4')]();var auth=require(_0xaa41('0x5'));var interaction=require(_0xaa41('0x6'));var config=require(_0xaa41('0x7'));var controller=require(_0xaa41('0x8'));router[_0xaa41('0x9')]('/',auth['isAuthenticated'](),controller[_0xaa41('0xa')]);router[_0xaa41('0x9')]('/describe',auth['isAuthenticated'](),controller[_0xaa41('0xb')]);router[_0xaa41('0x9')]('/:id',auth[_0xaa41('0xc')](),controller[_0xaa41('0xd')]);router[_0xaa41('0x9')](_0xaa41('0xe'),auth[_0xaa41('0xc')](),controller[_0xaa41('0xf')]);router[_0xaa41('0x10')]('/',auth[_0xaa41('0xc')](),interaction[_0xaa41('0x11')]('mail',_0xaa41('0x12')),controller[_0xaa41('0x13')]);router['put']('/:id',auth[_0xaa41('0xc')](),controller['update']);router[_0xaa41('0x14')](_0xaa41('0x15'),auth[_0xaa41('0xc')](),controller[_0xaa41('0x16')]);router[_0xaa41('0x14')]('/:id/reject',auth[_0xaa41('0xc')](),controller[_0xaa41('0x17')]);router[_0xaa41('0x18')](_0xaa41('0x19'),auth[_0xaa41('0xc')](),controller[_0xaa41('0x1a')]);module[_0xaa41('0x1b')]=router; \ No newline at end of file diff --git a/server/api/mailMessage/mailMessage.attributes.js b/server/api/mailMessage/mailMessage.attributes.js index f08427c..86b60bb 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 _0x7f59=['medium','BOOLEAN','ENUM','out','DATE','sequelize','lodash','TEXT','long'];(function(_0x476de7,_0xa76300){var _0x24b3de=function(_0x2aa619){while(--_0x2aa619){_0x476de7['push'](_0x476de7['shift']());}};_0x24b3de(++_0xa76300);}(_0x7f59,0x12e));var _0x97f5=function(_0x3ce78b,_0x6dbdc9){_0x3ce78b=_0x3ce78b-0x0;var _0x4ede1b=_0x7f59[_0x3ce78b];return _0x4ede1b;};'use strict';var Sequelize=require(_0x97f5('0x0'));var _=require(_0x97f5('0x1'));module['exports']={'body':{'type':Sequelize[_0x97f5('0x2')](_0x97f5('0x3')),'allowNull':![]},'plainBody':{'type':Sequelize[_0x97f5('0x2')](_0x97f5('0x4'))},'read':{'type':Sequelize[_0x97f5('0x5')],'defaultValue':![]},'direction':{'type':Sequelize[_0x97f5('0x6')]('in',_0x97f5('0x7')),'defaultValue':'out','allowNull':![]},'messageId':{'type':Sequelize['STRING'](0x1fe)},'from':{'type':Sequelize['STRING']},'to':{'type':Sequelize['TEXT'](_0x97f5('0x3'))},'cc':{'type':Sequelize[_0x97f5('0x2')](_0x97f5('0x3'))},'bcc':{'type':Sequelize[_0x97f5('0x2')](_0x97f5('0x3'))},'subject':{'type':Sequelize[_0x97f5('0x2')]},'sentAt':{'type':Sequelize['DATE']},'attach':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'secret':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'readAt':{'type':Sequelize[_0x97f5('0x8')]},'originTo':{'type':Sequelize['TEXT'](_0x97f5('0x3'))},'originCc':{'type':Sequelize[_0x97f5('0x2')]('long')}}; \ No newline at end of file +var _0xf2e3=['INTEGER','sequelize','exports','TEXT','long','medium','BOOLEAN','ENUM','out','STRING','DATE'];(function(_0x27e5ce,_0x35cbcc){var _0x19387e=function(_0x3063d7){while(--_0x3063d7){_0x27e5ce['push'](_0x27e5ce['shift']());}};_0x19387e(++_0x35cbcc);}(_0xf2e3,0x9b));var _0x3f2e=function(_0x25e7cb,_0x3579b7){_0x25e7cb=_0x25e7cb-0x0;var _0x375d92=_0xf2e3[_0x25e7cb];return _0x375d92;};'use strict';var Sequelize=require(_0x3f2e('0x0'));var _=require('lodash');module[_0x3f2e('0x1')]={'body':{'type':Sequelize[_0x3f2e('0x2')](_0x3f2e('0x3')),'allowNull':![]},'plainBody':{'type':Sequelize[_0x3f2e('0x2')](_0x3f2e('0x4'))},'read':{'type':Sequelize[_0x3f2e('0x5')],'defaultValue':![]},'direction':{'type':Sequelize[_0x3f2e('0x6')]('in',_0x3f2e('0x7')),'defaultValue':_0x3f2e('0x7'),'allowNull':![]},'messageId':{'type':Sequelize['STRING'](0x1fe)},'from':{'type':Sequelize[_0x3f2e('0x8')]},'to':{'type':Sequelize[_0x3f2e('0x2')](_0x3f2e('0x3'))},'cc':{'type':Sequelize[_0x3f2e('0x2')](_0x3f2e('0x3'))},'bcc':{'type':Sequelize[_0x3f2e('0x2')](_0x3f2e('0x3'))},'subject':{'type':Sequelize[_0x3f2e('0x2')]},'sentAt':{'type':Sequelize[_0x3f2e('0x9')]},'attach':{'type':Sequelize[_0x3f2e('0xa')],'defaultValue':0x0},'secret':{'type':Sequelize[_0x3f2e('0x5')],'defaultValue':![]},'readAt':{'type':Sequelize[_0x3f2e('0x9')]},'originTo':{'type':Sequelize[_0x3f2e('0x2')](_0x3f2e('0x3'))},'originCc':{'type':Sequelize[_0x3f2e('0x2')](_0x3f2e('0x3'))}}; \ No newline at end of file diff --git a/server/api/mailMessage/mailMessage.controller.js b/server/api/mailMessage/mailMessage.controller.js index bc25cb0..08c3ca1 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 _0xad86=['request','then','info','MailMessage,\x20%s,\x20%s','request\x20sent','debug','stringify','code','error','message','result','catch','sendStatus','status','end','json','count','offset','limit','set','Content-Range','reject','save','update','name','send','index','MailMessage','rawAttributes','fieldName','type','map','query','filters','model','fields','attributes','nolimit','order','where','pick','filter','merge','options','includeAll','include','findAll','rows','params','keys','intersection','length','find','body','describe','create','direction','out','secret','split','MailAccount','findOne','MailAccountId','CmContact','Contacts','updatedAt','DESC','Smtp','isNil','service','host','port','authentication','user','pass','auth','secure','attachments','root','server/files/attachments','List','ListId','List\x20not\x20found','SendMail','sendMail','messageId','YYYY-MM-DD\x20HH:mm:ss','mail-interactions','mail','read','UserId','Contact','get','MailInteraction','MailInteractionId','read1stAt','interaction','null','acceptMessage','manual','interface','format','SIP/%s','channel','event','accept','EventManager','agent','[MAILMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','role','RejectMessage','rejectMessage','rejectmessage','download','unix','toString','server','files','tmp','join','message-%s.eml','from','bcc','createdAt','Attachment','subject','ddd,\x20DD\x20MMM\x20YYYY\x20HH:mm:ss\x20ZZ','headers','Attachments','existsSync','push','build','writeFileSync','log','err','unlinkSync','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','ejs','lodash','squel','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../mysqldb','redis','defaults','localhost','./mailMessage.socket','register','client','http','test','Sequelize','ValidationError','The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.'];(function(_0x4bcf38,_0x3c12be){var _0x4a89be=function(_0x3215a6){while(--_0x3215a6){_0x4bcf38['push'](_0x4bcf38['shift']());}};_0x4a89be(++_0x3c12be);}(_0xad86,0x88));var _0x6ad8=function(_0x2c2656,_0x582658){_0x2c2656=_0x2c2656-0x0;var _0x5e44f4=_0xad86[_0x2c2656];return _0x5e44f4;};'use strict';var pdf=require('html-pdf');var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x6ad8('0x0'));var jsonpatch=require(_0x6ad8('0x1'));var rp=require(_0x6ad8('0x2'));var moment=require(_0x6ad8('0x3'));var BPromise=require(_0x6ad8('0x4'));var Mustache=require(_0x6ad8('0x5'));var util=require(_0x6ad8('0x6'));var path=require(_0x6ad8('0x7'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x6ad8('0x8'));var fs=require('fs');var _=require(_0x6ad8('0x9'));var squel=require(_0x6ad8('0xa'));var crypto=require('crypto');var jsforce=require(_0x6ad8('0xb'));var deskjs=require(_0x6ad8('0xc'));var toCsv=require(_0x6ad8('0xd'));var querystring=require(_0x6ad8('0xe'));var Papa=require(_0x6ad8('0xf'));var Redis=require(_0x6ad8('0x10'));var authService=require(_0x6ad8('0x11'));var qs=require(_0x6ad8('0x12'));var as=require(_0x6ad8('0x13'));var hardwareService=require(_0x6ad8('0x14'));var logger=require(_0x6ad8('0x15'))('api');var utils=require(_0x6ad8('0x16'));var config=require('../../config/environment');var db=require(_0x6ad8('0x17'))['db'];config[_0x6ad8('0x18')]=_[_0x6ad8('0x19')](config[_0x6ad8('0x18')],{'host':_0x6ad8('0x1a'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x6ad8('0x18')]));require(_0x6ad8('0x1b'))[_0x6ad8('0x1c')](socket);var jayson=require('jayson/promise');var client=jayson[_0x6ad8('0x1d')][_0x6ad8('0x1e')]({'port':0x232c});var client9003=jayson[_0x6ad8('0x1d')][_0x6ad8('0x1e')]({'port':0x232b});var client9002=jayson['client'][_0x6ad8('0x1e')]({'port':0x232a});function checkPasswordPattern(_0x56f65f,_0x51f294,_0x3c8906){if(_0x3c8906){var _0x302c27=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x302c27[_0x6ad8('0x1f')](_0x51f294)){return _0x56f65f;}else{throw new db[(_0x6ad8('0x20'))][(_0x6ad8('0x21'))](_0x6ad8('0x22'));}}else{return _0x56f65f;}}function respondWithRpcPromise(_0x387733,_0x1b2007,_0x23d362,_0x45ade3){return new BPromise(function(_0x36ec70,_0x2c4376){var _0x4522b9=_0x45ade3||client;return _0x4522b9[_0x6ad8('0x23')](_0x387733,_0x23d362)[_0x6ad8('0x24')](function(_0x2d9c76){logger[_0x6ad8('0x25')](_0x6ad8('0x26'),_0x1b2007,_0x6ad8('0x27'));logger[_0x6ad8('0x28')]('MailMessage,\x20%s,\x20%s,\x20%s',_0x1b2007,_0x6ad8('0x27'),JSON[_0x6ad8('0x29')](_0x2d9c76));if(_0x2d9c76['error']){if(_0x2d9c76['error'][_0x6ad8('0x2a')]===0x1f4){logger[_0x6ad8('0x2b')](_0x6ad8('0x26'),_0x1b2007,_0x2d9c76[_0x6ad8('0x2b')][_0x6ad8('0x2c')]);return _0x2c4376(_0x2d9c76[_0x6ad8('0x2b')][_0x6ad8('0x2c')]);}logger[_0x6ad8('0x2b')]('MailMessage,\x20%s,\x20%s',_0x1b2007,_0x2d9c76['error'][_0x6ad8('0x2c')]);return _0x36ec70(_0x2d9c76[_0x6ad8('0x2b')][_0x6ad8('0x2c')]);}else{logger[_0x6ad8('0x25')](_0x6ad8('0x26'),_0x1b2007,_0x6ad8('0x27'));_0x36ec70(_0x2d9c76[_0x6ad8('0x2d')]['message']);}})[_0x6ad8('0x2e')](function(_0x3f5960){logger[_0x6ad8('0x2b')](_0x6ad8('0x26'),_0x1b2007,_0x3f5960);_0x2c4376(_0x3f5960);});});}function respondWithStatusCode(_0xd6be58,_0x22665d){_0x22665d=_0x22665d||0xcc;return function(_0x1c770f){if(_0x1c770f){return _0xd6be58[_0x6ad8('0x2f')](_0x22665d);}return _0xd6be58[_0x6ad8('0x30')](_0x22665d)[_0x6ad8('0x31')]();};}function respondWithResult(_0x3615f5,_0x1bf4fc){_0x1bf4fc=_0x1bf4fc||0xc8;return function(_0x454b82){if(_0x454b82){return _0x3615f5[_0x6ad8('0x30')](_0x1bf4fc)[_0x6ad8('0x32')](_0x454b82);}};}function respondWithFilteredResult(_0x4bd798,_0x445b69){return function(_0x55aa21){if(_0x55aa21){var _0x3ebf0c=_0x55aa21[_0x6ad8('0x33')],_0x3e4fe1=_0x445b69['offset'],_0x41a34f=_0x445b69[_0x6ad8('0x34')]+_0x445b69[_0x6ad8('0x35')],_0x7c83bd;if(_0x41a34f>=_0x3ebf0c){_0x41a34f=_0x3ebf0c;_0x7c83bd=0xc8;}else{_0x7c83bd=0xce;}_0x4bd798[_0x6ad8('0x30')](_0x7c83bd);return _0x4bd798[_0x6ad8('0x36')](_0x6ad8('0x37'),_0x3e4fe1+'-'+_0x41a34f+'/'+_0x3ebf0c)[_0x6ad8('0x32')](_0x55aa21);}return null;};}function patchUpdates(_0x1fdcf9){return function(_0xad7e96){try{jsonpatch['apply'](_0xad7e96,_0x1fdcf9,!![]);}catch(_0x5b1719){return BPromise[_0x6ad8('0x38')](_0x5b1719);}return _0xad7e96[_0x6ad8('0x39')]();};}function saveUpdates(_0x565ada,_0x32ceaf){return function(_0x28f3c6){if(_0x28f3c6){return _0x28f3c6[_0x6ad8('0x3a')](_0x565ada)['then'](function(_0x25fa4){return _0x25fa4;});}return null;};}function removeEntity(_0x3b7cc8,_0x3f72f9){return function(_0x476dbe){if(_0x476dbe){return _0x476dbe['destroy']()[_0x6ad8('0x24')](function(){_0x3b7cc8['status'](0xcc)[_0x6ad8('0x31')]();});}};}function handleEntityNotFound(_0x12b1cf,_0x1b6130){return function(_0x38af97){if(!_0x38af97){_0x12b1cf['sendStatus'](0x194);}return _0x38af97;};}function handleError(_0x1e35ef,_0x40ca34){_0x40ca34=_0x40ca34||0x1f4;return function(_0xf6803a){logger[_0x6ad8('0x2b')](_0xf6803a['stack']);if(_0xf6803a[_0x6ad8('0x3b')]){delete _0xf6803a['name'];}_0x1e35ef['status'](_0x40ca34)[_0x6ad8('0x3c')](_0xf6803a);};}exports[_0x6ad8('0x3d')]=function(_0xb2cf67,_0x43d3c7){var _0x42698c={},_0x5d9e81={},_0x113e03={'count':0x0,'rows':[]};var _0x376449=_['map'](db[_0x6ad8('0x3e')][_0x6ad8('0x3f')],function(_0x56b168){return{'name':_0x56b168[_0x6ad8('0x40')],'type':_0x56b168[_0x6ad8('0x41')]['key']};});_0x5d9e81['model']=_[_0x6ad8('0x42')](_0x376449,_0x6ad8('0x3b'));_0x5d9e81[_0x6ad8('0x43')]=_['keys'](_0xb2cf67[_0x6ad8('0x43')]);_0x5d9e81[_0x6ad8('0x44')]=_['intersection'](_0x5d9e81['model'],_0x5d9e81['query']);_0x42698c['attributes']=_['intersection'](_0x5d9e81[_0x6ad8('0x45')],qs[_0x6ad8('0x46')](_0xb2cf67[_0x6ad8('0x43')][_0x6ad8('0x46')]));_0x42698c[_0x6ad8('0x47')]=_0x42698c['attributes']['length']?_0x42698c[_0x6ad8('0x47')]:_0x5d9e81['model'];if(!_0xb2cf67[_0x6ad8('0x43')]['hasOwnProperty'](_0x6ad8('0x48'))){_0x42698c[_0x6ad8('0x35')]=qs[_0x6ad8('0x35')](_0xb2cf67[_0x6ad8('0x43')][_0x6ad8('0x35')]);_0x42698c[_0x6ad8('0x34')]=qs['offset'](_0xb2cf67[_0x6ad8('0x43')][_0x6ad8('0x34')]);}_0x42698c[_0x6ad8('0x49')]=qs['sort'](_0xb2cf67[_0x6ad8('0x43')]['sort']);_0x42698c[_0x6ad8('0x4a')]=qs[_0x6ad8('0x44')](_[_0x6ad8('0x4b')](_0xb2cf67['query'],_0x5d9e81[_0x6ad8('0x44')]));if(_0xb2cf67[_0x6ad8('0x43')][_0x6ad8('0x4c')]){_0x42698c[_0x6ad8('0x4a')]=_[_0x6ad8('0x4d')](_0x42698c['where'],{'$or':_['map'](_0x376449,function(_0x44a722){if(_0x44a722[_0x6ad8('0x41')]!=='VIRTUAL'){var _0x44cb07={};_0x44cb07[_0x44a722[_0x6ad8('0x3b')]]={'$like':'%'+_0xb2cf67[_0x6ad8('0x43')][_0x6ad8('0x4c')]+'%'};return _0x44cb07;}})});}_0x42698c=_[_0x6ad8('0x4d')]({},_0x42698c,_0xb2cf67[_0x6ad8('0x4e')]);var _0x2de761={'where':_0x42698c['where']};return db['MailMessage'][_0x6ad8('0x33')](_0x2de761)[_0x6ad8('0x24')](function(_0x50c6c4){_0x113e03['count']=_0x50c6c4;if(_0xb2cf67[_0x6ad8('0x43')][_0x6ad8('0x4f')]){_0x42698c[_0x6ad8('0x50')]=[{'all':!![]}];}return db['MailMessage'][_0x6ad8('0x51')](_0x42698c);})[_0x6ad8('0x24')](function(_0xb84ca7){_0x113e03[_0x6ad8('0x52')]=_0xb84ca7;return _0x113e03;})[_0x6ad8('0x24')](respondWithFilteredResult(_0x43d3c7,_0x42698c))[_0x6ad8('0x2e')](handleError(_0x43d3c7,null));};exports['show']=function(_0x1ac000,_0x8bfd72){var _0x58d616={'raw':!![],'where':{'id':_0x1ac000[_0x6ad8('0x53')]['id']}},_0x52ae92={};_0x52ae92['model']=_[_0x6ad8('0x54')](db[_0x6ad8('0x3e')]['rawAttributes']);_0x52ae92[_0x6ad8('0x43')]=_[_0x6ad8('0x54')](_0x1ac000[_0x6ad8('0x43')]);_0x52ae92[_0x6ad8('0x44')]=_[_0x6ad8('0x55')](_0x52ae92[_0x6ad8('0x45')],_0x52ae92[_0x6ad8('0x43')]);_0x58d616[_0x6ad8('0x47')]=_[_0x6ad8('0x55')](_0x52ae92['model'],qs['fields'](_0x1ac000['query'][_0x6ad8('0x46')]));_0x58d616['attributes']=_0x58d616['attributes'][_0x6ad8('0x56')]?_0x58d616['attributes']:_0x52ae92[_0x6ad8('0x45')];if(_0x1ac000['query'][_0x6ad8('0x4f')]){_0x58d616[_0x6ad8('0x50')]=[{'all':!![]}];}_0x58d616=_[_0x6ad8('0x4d')]({},_0x58d616,_0x1ac000[_0x6ad8('0x4e')]);return db[_0x6ad8('0x3e')][_0x6ad8('0x57')](_0x58d616)[_0x6ad8('0x24')](handleEntityNotFound(_0x8bfd72,null))[_0x6ad8('0x24')](respondWithResult(_0x8bfd72,null))[_0x6ad8('0x2e')](handleError(_0x8bfd72,null));};exports[_0x6ad8('0x3a')]=function(_0x340bc9,_0x5b9ee0){if(_0x340bc9['body']['id']){delete _0x340bc9['body']['id'];}return db[_0x6ad8('0x3e')][_0x6ad8('0x57')]({'where':{'id':_0x340bc9[_0x6ad8('0x53')]['id']}})[_0x6ad8('0x24')](handleEntityNotFound(_0x5b9ee0,null))[_0x6ad8('0x24')](saveUpdates(_0x340bc9[_0x6ad8('0x58')],null))['then'](respondWithResult(_0x5b9ee0,null))[_0x6ad8('0x2e')](handleError(_0x5b9ee0,null));};exports['destroy']=function(_0x165cb2,_0x13fcf1){return db[_0x6ad8('0x3e')][_0x6ad8('0x57')]({'where':{'id':_0x165cb2['params']['id']}})['then'](handleEntityNotFound(_0x13fcf1,null))[_0x6ad8('0x24')](removeEntity(_0x13fcf1,null))[_0x6ad8('0x2e')](handleError(_0x13fcf1,null));};exports[_0x6ad8('0x59')]=function(_0x3e77d7,_0x3ffd1b){return db[_0x6ad8('0x3e')][_0x6ad8('0x59')]()[_0x6ad8('0x24')](respondWithResult(_0x3ffd1b,null))[_0x6ad8('0x2e')](handleError(_0x3ffd1b,null));};exports[_0x6ad8('0x5a')]=function(_0x28f4d3,_0x56a5b9){return db[_0x6ad8('0x3e')][_0x6ad8('0x5a')](_0x28f4d3[_0x6ad8('0x58')])['then'](function(_0x46a54a){if(_0x46a54a){if(_0x46a54a[_0x6ad8('0x5b')]===_0x6ad8('0x5c')&&!_0x46a54a[_0x6ad8('0x5d')]){var _0x2f42b2,_0x3580dc,_0x5094df;if(_0x28f4d3[_0x6ad8('0x58')]['to']){_0x3580dc=_0x28f4d3['body']['to'][_0x6ad8('0x5e')](',')[0x0];}return db[_0x6ad8('0x5f')][_0x6ad8('0x60')]({'where':{'id':_0x46a54a[_0x6ad8('0x61')]},'include':[{'model':db['CmList'],'as':'List','include':[{'model':db[_0x6ad8('0x62')],'as':_0x6ad8('0x63'),'where':{'email':_0x3580dc},'limit':0x1,'order':[[_0x6ad8('0x64'),_0x6ad8('0x65')]]}]},{'model':db['MailServerOut'],'as':_0x6ad8('0x66'),'raw':!![]}]})['then'](function(_0x3ad3a2){_0x2f42b2=_0x3ad3a2;if(_0x2f42b2&&_0x2f42b2[_0x6ad8('0x66')]){var _0x52507a={'tls':{'rejectUnauthorized':![]}};if(_[_0x6ad8('0x67')](_0x2f42b2[_0x6ad8('0x66')][_0x6ad8('0x68')])){_0x52507a['host']=_0x2f42b2[_0x6ad8('0x66')][_0x6ad8('0x69')];_0x52507a['port']=_0x2f42b2[_0x6ad8('0x66')][_0x6ad8('0x6a')];_0x52507a['secure']=_0x2f42b2[_0x6ad8('0x66')]['secure'];if(_0x2f42b2[_0x6ad8('0x66')][_0x6ad8('0x6b')]){_0x52507a['auth']={'user':_0x2f42b2[_0x6ad8('0x66')][_0x6ad8('0x6c')],'pass':_0x2f42b2['Smtp'][_0x6ad8('0x6d')]};}}else{_0x52507a['service']=_0x2f42b2['Smtp'][_0x6ad8('0x68')];_0x52507a[_0x6ad8('0x6e')]={'user':_0x2f42b2[_0x6ad8('0x66')]['user'],'pass':_0x2f42b2[_0x6ad8('0x66')][_0x6ad8('0x6d')]};_0x52507a[_0x6ad8('0x6f')]=_0x2f42b2[_0x6ad8('0x66')][_0x6ad8('0x6f')];}if(_0x28f4d3[_0x6ad8('0x58')][_0x6ad8('0x70')]&&_0x28f4d3['body'][_0x6ad8('0x70')][_0x6ad8('0x56')]){for(var _0x6da726=0x0;_0x6da726<_0x28f4d3['body'][_0x6ad8('0x70')]['length'];_0x6da726+=0x1){_0x28f4d3[_0x6ad8('0x58')][_0x6ad8('0x70')][_0x6da726]={'filename':_0x28f4d3['body'][_0x6ad8('0x70')][_0x6da726][_0x6ad8('0x3b')],'path':path['join'](config[_0x6ad8('0x71')],_0x6ad8('0x72'),_0x28f4d3[_0x6ad8('0x58')][_0x6ad8('0x70')][_0x6da726]['basename'])};}}_0x5094df={'account':_0x52507a,'message':_0x28f4d3[_0x6ad8('0x58')]};return;}})[_0x6ad8('0x24')](function(){if(_0x2f42b2[_0x6ad8('0x73')]){if(_0x2f42b2[_0x6ad8('0x73')][_0x6ad8('0x63')][_0x6ad8('0x56')]){return _0x2f42b2[_0x6ad8('0x73')][_0x6ad8('0x63')][0x0];}else{return db[_0x6ad8('0x62')]['create'](_[_0x6ad8('0x19')](_0x28f4d3[_0x6ad8('0x58')],{'firstName':_0x28f4d3[_0x6ad8('0x58')]['to'],'email':_0x28f4d3[_0x6ad8('0x58')]['to'],'phone':_0x28f4d3[_0x6ad8('0x58')]['to'],'ListId':_0x2f42b2[_0x6ad8('0x74')]}));}}else{throw new Error(_0x6ad8('0x75'));}})[_0x6ad8('0x24')](function(){if(_0x5094df){return respondWithRpcPromise(_0x6ad8('0x76'),_0x6ad8('0x77'),_0x5094df,client9003)[_0x6ad8('0x24')](function(_0x16d494){return _0x46a54a[_0x6ad8('0x3a')]({'read':!![],'messageId':_0x16d494[_0x6ad8('0x78')],'sentAt':moment()['format'](_0x6ad8('0x79'))});})[_0x6ad8('0x2e')](function(_0xa4b551){logger[_0x6ad8('0x2b')]('%s',JSON[_0x6ad8('0x29')](_0xa4b551));return _0x46a54a;});}return _0x46a54a;});}return _0x46a54a;}})['then'](respondWithResult(_0x56a5b9,0xc9))['catch'](handleError(_0x56a5b9,null));};var interaction_log=require(_0x6ad8('0x15'))(_0x6ad8('0x7a'));exports['accept']=function(_0x5413eb,_0x5010de,_0x4a51c2){var _0x27ec2c={'channel':_0x6ad8('0x7b')};if(_0x5413eb[_0x6ad8('0x58')]['id']){delete _0x5413eb[_0x6ad8('0x58')]['id'];}_0x5413eb['body'][_0x6ad8('0x7c')]=!![];_0x5413eb['body']['readAt']=moment()['format'](_0x6ad8('0x79'));_0x5413eb['body']['UserId']=_0x5413eb[_0x6ad8('0x58')][_0x6ad8('0x7d')]||_0x5413eb[_0x6ad8('0x6c')]['id'];return db[_0x6ad8('0x3e')]['find']({'where':{'id':_0x5413eb[_0x6ad8('0x53')]['id'],'UserId':null},'include':[{'model':db[_0x6ad8('0x62')],'as':_0x6ad8('0x7e')}]})[_0x6ad8('0x24')](handleEntityNotFound(_0x5010de,null))[_0x6ad8('0x24')](saveUpdates(_0x5413eb[_0x6ad8('0x58')],null))['then'](function(_0x7192ba){if(_0x7192ba){_0x27ec2c[_0x6ad8('0x2c')]=_0x7192ba[_0x6ad8('0x7f')]({'plain':!![]});return db[_0x6ad8('0x80')][_0x6ad8('0x57')]({'where':{'id':_0x7192ba[_0x6ad8('0x81')]}});}return null;})[_0x6ad8('0x24')](handleEntityNotFound(_0x5010de,null))[_0x6ad8('0x24')](function(_0x1fe1e1){if(_0x1fe1e1){return _0x1fe1e1[_0x6ad8('0x3a')]({'UserId':_0x5413eb[_0x6ad8('0x58')]['UserId'],'read1stAt':_['isNil'](_0x1fe1e1[_0x6ad8('0x82')])?moment()['format'](_0x6ad8('0x79')):undefined});}return null;})[_0x6ad8('0x24')](function(_0xc7da51){if(_0xc7da51){_0x27ec2c['interaction']=_0xc7da51['get']({'plain':!![]});interaction_log[_0x6ad8('0x25')]('[MAILMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s',_0x5413eb[_0x6ad8('0x6c')]['id'],_0x5413eb['user'][_0x6ad8('0x3b')],_0x5413eb['user']['role'],_0x27ec2c[_0x6ad8('0x83')]['id'],_0x5413eb['body']?JSON[_0x6ad8('0x29')](_0x5413eb[_0x6ad8('0x58')]):_0x6ad8('0x84'));return respondWithRpcPromise('AcceptMessage',_0x6ad8('0x85'),_0x27ec2c);}return null;})[_0x6ad8('0x24')](function(_0x1d30ba){if(_0x1d30ba){if(_0x5413eb['body'][_0x6ad8('0x86')]){_0x27ec2c[_0x6ad8('0x2c')][_0x6ad8('0x87')]=util[_0x6ad8('0x88')](_0x6ad8('0x89'),_0x5413eb[_0x6ad8('0x6c')][_0x6ad8('0x3b')]);_0x27ec2c[_0x6ad8('0x2c')][_0x6ad8('0x8a')]=_0x27ec2c['channel'];_0x27ec2c[_0x6ad8('0x2c')][_0x6ad8('0x8b')]=_0x6ad8('0x8c');return respondWithRpcPromise(_0x6ad8('0x8d'),_0x6ad8('0x8d'),{'event':'acceptmessage','message':_0x27ec2c['message']},client9002)[_0x6ad8('0x24')](function(){return _0x27ec2c;});}return _0x27ec2c;}return null;})['then'](respondWithResult(_0x5010de,null))[_0x6ad8('0x2e')](handleError(_0x5010de,null));};var interaction_log=require(_0x6ad8('0x15'))(_0x6ad8('0x7a'));exports[_0x6ad8('0x38')]=function(_0x3cb75f,_0xc5f3ba,_0x48021f){var _0xda0ff1={'agent':{},'channel':_0x6ad8('0x7b')};if(_0x3cb75f[_0x6ad8('0x58')]['id']){delete _0x3cb75f[_0x6ad8('0x58')]['id'];}_0x3cb75f['body'][_0x6ad8('0x7d')]=_0x3cb75f[_0x6ad8('0x58')]['UserId']||_0x3cb75f[_0x6ad8('0x6c')]['id'];_0xda0ff1[_0x6ad8('0x8e')]['id']=_0x3cb75f[_0x6ad8('0x58')]['UserId'];return db[_0x6ad8('0x3e')][_0x6ad8('0x57')]({'where':{'id':_0x3cb75f[_0x6ad8('0x53')]['id'],'UserId':null}})[_0x6ad8('0x24')](handleEntityNotFound(_0xc5f3ba,null))[_0x6ad8('0x24')](function(_0x236b80){if(_0x236b80){_0xda0ff1[_0x6ad8('0x2c')]=_0x236b80['get']({'plain':!![]});return db['MailInteraction'][_0x6ad8('0x57')]({'where':{'id':_0x236b80['MailInteractionId']}});}return null;})[_0x6ad8('0x24')](handleEntityNotFound(_0xc5f3ba,null))[_0x6ad8('0x24')](function(_0x461958){if(_0x461958){_0xda0ff1[_0x6ad8('0x83')]=_0x461958['get']({'plain':!![]});interaction_log[_0x6ad8('0x25')](_0x6ad8('0x8f'),_0x3cb75f['user']['id'],_0x3cb75f[_0x6ad8('0x6c')][_0x6ad8('0x3b')],_0x3cb75f[_0x6ad8('0x6c')][_0x6ad8('0x90')],_0xda0ff1[_0x6ad8('0x83')]['id'],_0x3cb75f[_0x6ad8('0x58')]?JSON[_0x6ad8('0x29')](_0x3cb75f[_0x6ad8('0x58')]):'null');return respondWithRpcPromise(_0x6ad8('0x91'),_0x6ad8('0x92'),_0xda0ff1);}return null;})['then'](function(_0xba0156){if(_0xba0156){_0xba0156[_0x6ad8('0x2c')]['interface']=util['format'](_0x6ad8('0x89'),_0x3cb75f[_0x6ad8('0x6c')][_0x6ad8('0x3b')]);_0xba0156['message'][_0x6ad8('0x8a')]=_0xda0ff1[_0x6ad8('0x8a')];_0xba0156[_0x6ad8('0x2c')]['event']=_0x6ad8('0x38');respondWithRpcPromise(_0x6ad8('0x8d'),'EventManager',{'event':_0x6ad8('0x93'),'message':_0xba0156['message']},client9002);return _0xda0ff1;}return null;})[_0x6ad8('0x24')](respondWithResult(_0xc5f3ba,null))['catch'](handleError(_0xc5f3ba,null));};exports[_0x6ad8('0x94')]=function(_0x58cbed,_0x5369d3){var _0x274bb1=moment()[_0x6ad8('0x95')]()[_0x6ad8('0x96')]();var _0x5a2d1a=path['join'](config['root'],_0x6ad8('0x97'),_0x6ad8('0x98'),_0x6ad8('0x99'));var _0x4a84f7=path[_0x6ad8('0x9a')](config[_0x6ad8('0x71')],_0x6ad8('0x97'),'files','attachments');var _0x57f465=util['format'](_0x6ad8('0x9b'),_0x274bb1);return db['MailMessage']['find']({'where':{'id':_0x58cbed[_0x6ad8('0x53')]['id']},'attributes':['id',_0x6ad8('0x58'),_0x6ad8('0x9c'),'to','cc',_0x6ad8('0x9d'),'subject',_0x6ad8('0x9e')],'include':_0x58cbed[_0x6ad8('0x43')][_0x6ad8('0x70')]?[{'model':db[_0x6ad8('0x9f')],'as':'Attachments'}]:undefined})[_0x6ad8('0x24')](handleEntityNotFound(_0x5369d3,null))[_0x6ad8('0x24')](function(_0x1bde8c){if(_0x1bde8c){var _0x56d93e=_0x1bde8c;var _0x433e43={'from':_0x56d93e[_0x6ad8('0x9c')],'to':_0x56d93e['to'],'subject':_0x56d93e[_0x6ad8('0xa0')],'html':_0x56d93e[_0x6ad8('0x58')],'headers':{'Date':moment(_0x56d93e[_0x6ad8('0x9e')])[_0x6ad8('0x88')](_0x6ad8('0xa1'))},'attachments':[]};if(_0x1bde8c['cc']){_0x433e43[_0x6ad8('0xa2')]['Cc']=_0x1bde8c['cc'];}if(_0x1bde8c[_0x6ad8('0x9d')]){_0x433e43['headers']['Bcc']=_0x1bde8c['bcc'];}return new BPromise(function(_0x38eb41,_0x18262c){if(_0x1bde8c[_0x6ad8('0xa3')]){for(var _0x1d77f5=0x0;_0x1d77f5<_0x1bde8c[_0x6ad8('0xa3')][_0x6ad8('0x56')];_0x1d77f5++){var _0x571117=_0x1bde8c[_0x6ad8('0xa3')][_0x1d77f5];var _0x2a857b=path['join'](_0x4a84f7,_0x571117['basename']);if(fs[_0x6ad8('0xa4')](_0x2a857b)){_0x433e43[_0x6ad8('0x70')][_0x6ad8('0xa5')]({'name':_0x571117[_0x6ad8('0x3b')],'contentType':_0x571117[_0x6ad8('0x41')],'data':fs['readFileSync'](_0x2a857b)});}}}emlformat[_0x6ad8('0xa6')](_0x433e43,function(_0x517740,_0x1c314c){if(_0x517740)return _0x18262c(_0x517740);fs[_0x6ad8('0xa7')](path[_0x6ad8('0x9a')](_0x5a2d1a,_0x57f465),_0x1c314c);return _0x38eb41(_0x1c314c);});});}})[_0x6ad8('0x24')](function(_0xbc3e1c){if(_0xbc3e1c){return _0x5369d3['download'](path[_0x6ad8('0x9a')](_0x5a2d1a,_0x57f465),_0x57f465,function(_0x5d2d3f){if(_0x5d2d3f){console[_0x6ad8('0xa8')](_0x6ad8('0xa9'),_0x5d2d3f);}else{fs[_0x6ad8('0xaa')](path['join'](_0x5a2d1a,_0x57f465));}});}})[_0x6ad8('0x2e')](handleError(_0x5369d3,null));}; \ No newline at end of file +var _0x65de=['push','build','writeFileSync','log','err','unlinkSync','html-pdf','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','sox','to-csv','jsforce','desk.js','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','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','MailMessage,\x20%s,\x20%s','request\x20sent','debug','MailMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','sendStatus','status','json','count','offset','set','Content-Range','apply','reject','save','update','destroy','end','stack','name','send','index','map','MailMessage','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','limit','sort','where','merge','filter','includeAll','include','rows','catch','show','options','find','body','params','describe','create','out','split','MailAccount','findOne','MailAccountId','CmList','List','CmContact','Contacts','updatedAt','DESC','MailServerOut','Smtp','isNil','port','secure','authentication','auth','user','service','pass','attachments','join','basename','defaults','ListId','List\x20not\x20found','sendMail','YYYY-MM-DD\x20HH:mm:ss','mail-interactions','accept','mail','read','readAt','format','UserId','Contact','get','MailInteraction','MailInteractionId','interaction','[MAILMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','role','AcceptMessage','acceptMessage','manual','SIP/%s','channel','event','EventManager','acceptmessage','agent','rejectMessage','interface','rejectmessage','download','unix','toString','server','files','tmp','root','message-%s.eml','from','bcc','subject','Attachment','ddd,\x20DD\x20MMM\x20YYYY\x20HH:mm:ss\x20ZZ','headers','Bcc','Attachments','existsSync'];(function(_0x1a37e3,_0x5db8f6){var _0x4db78a=function(_0x15e6c1){while(--_0x15e6c1){_0x1a37e3['push'](_0x1a37e3['shift']());}};_0x4db78a(++_0x5db8f6);}(_0x65de,0xb2));var _0xe65d=function(_0x5dbf73,_0x152969){_0x5dbf73=_0x5dbf73-0x0;var _0x115522=_0x65de[_0x5dbf73];return _0x115522;};'use strict';var pdf=require(_0xe65d('0x0'));var emlformat=require(_0xe65d('0x1'));var rimraf=require(_0xe65d('0x2'));var zipdir=require('zip-dir');var jsonpatch=require(_0xe65d('0x3'));var rp=require(_0xe65d('0x4'));var moment=require(_0xe65d('0x5'));var BPromise=require(_0xe65d('0x6'));var Mustache=require(_0xe65d('0x7'));var util=require('util');var path=require('path');var sox=require(_0xe65d('0x8'));var csv=require(_0xe65d('0x9'));var ejs=require('ejs');var fs=require('fs');var _=require('lodash');var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0xe65d('0xa'));var deskjs=require(_0xe65d('0xb'));var toCsv=require(_0xe65d('0x9'));var querystring=require(_0xe65d('0xc'));var Papa=require(_0xe65d('0xd'));var Redis=require(_0xe65d('0xe'));var authService=require(_0xe65d('0xf'));var qs=require(_0xe65d('0x10'));var as=require(_0xe65d('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xe65d('0x12'))(_0xe65d('0x13'));var utils=require(_0xe65d('0x14'));var config=require(_0xe65d('0x15'));var db=require(_0xe65d('0x16'))['db'];config[_0xe65d('0x17')]=_['defaults'](config[_0xe65d('0x17')],{'host':_0xe65d('0x18'),'port':0x18eb});var socket=require(_0xe65d('0x19'))(new Redis(config[_0xe65d('0x17')]));require('./mailMessage.socket')[_0xe65d('0x1a')](socket);var jayson=require('jayson/promise');var client=jayson[_0xe65d('0x1b')][_0xe65d('0x1c')]({'port':0x232c});var client9003=jayson[_0xe65d('0x1b')]['http']({'port':0x232b});var client9002=jayson[_0xe65d('0x1b')][_0xe65d('0x1c')]({'port':0x232a});function checkPasswordPattern(_0x107482,_0x49a4f8,_0x517b7d){if(_0x517b7d){var _0x2b30e4=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x2b30e4[_0xe65d('0x1d')](_0x49a4f8)){return _0x107482;}else{throw new db[(_0xe65d('0x1e'))][(_0xe65d('0x1f'))](_0xe65d('0x20'));}}else{return _0x107482;}}function respondWithRpcPromise(_0xcc7922,_0x4171e2,_0x197f72,_0x34872d){return new BPromise(function(_0x16f8b4,_0x2c2982){var _0x57bb6f=_0x34872d||client;return _0x57bb6f[_0xe65d('0x21')](_0xcc7922,_0x197f72)[_0xe65d('0x22')](function(_0x4328c2){logger[_0xe65d('0x23')](_0xe65d('0x24'),_0x4171e2,_0xe65d('0x25'));logger[_0xe65d('0x26')](_0xe65d('0x27'),_0x4171e2,_0xe65d('0x25'),JSON[_0xe65d('0x28')](_0x4328c2));if(_0x4328c2[_0xe65d('0x29')]){if(_0x4328c2[_0xe65d('0x29')][_0xe65d('0x2a')]===0x1f4){logger['error'](_0xe65d('0x24'),_0x4171e2,_0x4328c2[_0xe65d('0x29')][_0xe65d('0x2b')]);return _0x2c2982(_0x4328c2[_0xe65d('0x29')][_0xe65d('0x2b')]);}logger[_0xe65d('0x29')](_0xe65d('0x24'),_0x4171e2,_0x4328c2[_0xe65d('0x29')][_0xe65d('0x2b')]);return _0x16f8b4(_0x4328c2[_0xe65d('0x29')][_0xe65d('0x2b')]);}else{logger[_0xe65d('0x23')](_0xe65d('0x24'),_0x4171e2,_0xe65d('0x25'));_0x16f8b4(_0x4328c2[_0xe65d('0x2c')][_0xe65d('0x2b')]);}})['catch'](function(_0x5a3202){logger[_0xe65d('0x29')](_0xe65d('0x24'),_0x4171e2,_0x5a3202);_0x2c2982(_0x5a3202);});});}function respondWithStatusCode(_0x436344,_0x55bf71){_0x55bf71=_0x55bf71||0xcc;return function(_0x2abb51){if(_0x2abb51){return _0x436344[_0xe65d('0x2d')](_0x55bf71);}return _0x436344[_0xe65d('0x2e')](_0x55bf71)['end']();};}function respondWithResult(_0x30e56e,_0x2c3c24){_0x2c3c24=_0x2c3c24||0xc8;return function(_0x23a297){if(_0x23a297){return _0x30e56e[_0xe65d('0x2e')](_0x2c3c24)[_0xe65d('0x2f')](_0x23a297);}};}function respondWithFilteredResult(_0xccc595,_0x4417f4){return function(_0x78b0f0){if(_0x78b0f0){var _0x5efc9c=_0x78b0f0[_0xe65d('0x30')],_0x11550a=_0x4417f4['offset'],_0x44c67a=_0x4417f4[_0xe65d('0x31')]+_0x4417f4['limit'],_0xa3bd5f;if(_0x44c67a>=_0x5efc9c){_0x44c67a=_0x5efc9c;_0xa3bd5f=0xc8;}else{_0xa3bd5f=0xce;}_0xccc595[_0xe65d('0x2e')](_0xa3bd5f);return _0xccc595[_0xe65d('0x32')](_0xe65d('0x33'),_0x11550a+'-'+_0x44c67a+'/'+_0x5efc9c)[_0xe65d('0x2f')](_0x78b0f0);}return null;};}function patchUpdates(_0x37804c){return function(_0x1fe894){try{jsonpatch[_0xe65d('0x34')](_0x1fe894,_0x37804c,!![]);}catch(_0x260b42){return BPromise[_0xe65d('0x35')](_0x260b42);}return _0x1fe894[_0xe65d('0x36')]();};}function saveUpdates(_0x18b94b,_0x42e441){return function(_0x1cb107){if(_0x1cb107){return _0x1cb107[_0xe65d('0x37')](_0x18b94b)[_0xe65d('0x22')](function(_0x5d2553){return _0x5d2553;});}return null;};}function removeEntity(_0x576c5c,_0x4f9074){return function(_0x3fb963){if(_0x3fb963){return _0x3fb963[_0xe65d('0x38')]()['then'](function(){_0x576c5c[_0xe65d('0x2e')](0xcc)[_0xe65d('0x39')]();});}};}function handleEntityNotFound(_0x5edf80,_0x3f8db9){return function(_0x5dd4fd){if(!_0x5dd4fd){_0x5edf80[_0xe65d('0x2d')](0x194);}return _0x5dd4fd;};}function handleError(_0x12f5c5,_0x1bac3a){_0x1bac3a=_0x1bac3a||0x1f4;return function(_0xd6a589){logger[_0xe65d('0x29')](_0xd6a589[_0xe65d('0x3a')]);if(_0xd6a589['name']){delete _0xd6a589[_0xe65d('0x3b')];}_0x12f5c5[_0xe65d('0x2e')](_0x1bac3a)[_0xe65d('0x3c')](_0xd6a589);};}exports[_0xe65d('0x3d')]=function(_0x11ed73,_0x18b746){var _0x258a62={},_0x44d8a5={},_0x5a52bf={'count':0x0,'rows':[]};var _0x57d6d1=_[_0xe65d('0x3e')](db[_0xe65d('0x3f')][_0xe65d('0x40')],function(_0xc60d4a){return{'name':_0xc60d4a[_0xe65d('0x41')],'type':_0xc60d4a[_0xe65d('0x42')][_0xe65d('0x43')]};});_0x44d8a5[_0xe65d('0x44')]=_[_0xe65d('0x3e')](_0x57d6d1,_0xe65d('0x3b'));_0x44d8a5[_0xe65d('0x45')]=_[_0xe65d('0x46')](_0x11ed73['query']);_0x44d8a5[_0xe65d('0x47')]=_[_0xe65d('0x48')](_0x44d8a5['model'],_0x44d8a5['query']);_0x258a62[_0xe65d('0x49')]=_['intersection'](_0x44d8a5[_0xe65d('0x44')],qs[_0xe65d('0x4a')](_0x11ed73[_0xe65d('0x45')]['fields']));_0x258a62['attributes']=_0x258a62[_0xe65d('0x49')][_0xe65d('0x4b')]?_0x258a62[_0xe65d('0x49')]:_0x44d8a5[_0xe65d('0x44')];if(!_0x11ed73[_0xe65d('0x45')][_0xe65d('0x4c')](_0xe65d('0x4d'))){_0x258a62[_0xe65d('0x4e')]=qs[_0xe65d('0x4e')](_0x11ed73[_0xe65d('0x45')][_0xe65d('0x4e')]);_0x258a62[_0xe65d('0x31')]=qs[_0xe65d('0x31')](_0x11ed73['query'][_0xe65d('0x31')]);}_0x258a62['order']=qs[_0xe65d('0x4f')](_0x11ed73[_0xe65d('0x45')][_0xe65d('0x4f')]);_0x258a62[_0xe65d('0x50')]=qs[_0xe65d('0x47')](_['pick'](_0x11ed73['query'],_0x44d8a5[_0xe65d('0x47')]));if(_0x11ed73[_0xe65d('0x45')]['filter']){_0x258a62['where']=_[_0xe65d('0x51')](_0x258a62[_0xe65d('0x50')],{'$or':_[_0xe65d('0x3e')](_0x57d6d1,function(_0x54d419){if(_0x54d419['type']!=='VIRTUAL'){var _0x3efb84={};_0x3efb84[_0x54d419[_0xe65d('0x3b')]]={'$like':'%'+_0x11ed73[_0xe65d('0x45')][_0xe65d('0x52')]+'%'};return _0x3efb84;}})});}_0x258a62=_[_0xe65d('0x51')]({},_0x258a62,_0x11ed73['options']);var _0xb5e391={'where':_0x258a62[_0xe65d('0x50')]};return db[_0xe65d('0x3f')][_0xe65d('0x30')](_0xb5e391)[_0xe65d('0x22')](function(_0x16804b){_0x5a52bf[_0xe65d('0x30')]=_0x16804b;if(_0x11ed73[_0xe65d('0x45')][_0xe65d('0x53')]){_0x258a62[_0xe65d('0x54')]=[{'all':!![]}];}return db['MailMessage']['findAll'](_0x258a62);})[_0xe65d('0x22')](function(_0x39da97){_0x5a52bf[_0xe65d('0x55')]=_0x39da97;return _0x5a52bf;})['then'](respondWithFilteredResult(_0x18b746,_0x258a62))[_0xe65d('0x56')](handleError(_0x18b746,null));};exports[_0xe65d('0x57')]=function(_0x31bd94,_0x3bae20){var _0x340cf9={'raw':!![],'where':{'id':_0x31bd94['params']['id']}},_0x365dec={};_0x365dec[_0xe65d('0x44')]=_[_0xe65d('0x46')](db[_0xe65d('0x3f')][_0xe65d('0x40')]);_0x365dec['query']=_[_0xe65d('0x46')](_0x31bd94[_0xe65d('0x45')]);_0x365dec[_0xe65d('0x47')]=_[_0xe65d('0x48')](_0x365dec['model'],_0x365dec[_0xe65d('0x45')]);_0x340cf9[_0xe65d('0x49')]=_[_0xe65d('0x48')](_0x365dec[_0xe65d('0x44')],qs[_0xe65d('0x4a')](_0x31bd94[_0xe65d('0x45')][_0xe65d('0x4a')]));_0x340cf9[_0xe65d('0x49')]=_0x340cf9[_0xe65d('0x49')][_0xe65d('0x4b')]?_0x340cf9[_0xe65d('0x49')]:_0x365dec[_0xe65d('0x44')];if(_0x31bd94[_0xe65d('0x45')][_0xe65d('0x53')]){_0x340cf9[_0xe65d('0x54')]=[{'all':!![]}];}_0x340cf9=_[_0xe65d('0x51')]({},_0x340cf9,_0x31bd94[_0xe65d('0x58')]);return db['MailMessage'][_0xe65d('0x59')](_0x340cf9)[_0xe65d('0x22')](handleEntityNotFound(_0x3bae20,null))['then'](respondWithResult(_0x3bae20,null))[_0xe65d('0x56')](handleError(_0x3bae20,null));};exports[_0xe65d('0x37')]=function(_0x5461a8,_0x53cf34){if(_0x5461a8[_0xe65d('0x5a')]['id']){delete _0x5461a8[_0xe65d('0x5a')]['id'];}return db[_0xe65d('0x3f')][_0xe65d('0x59')]({'where':{'id':_0x5461a8[_0xe65d('0x5b')]['id']}})['then'](handleEntityNotFound(_0x53cf34,null))[_0xe65d('0x22')](saveUpdates(_0x5461a8['body'],null))[_0xe65d('0x22')](respondWithResult(_0x53cf34,null))['catch'](handleError(_0x53cf34,null));};exports[_0xe65d('0x38')]=function(_0x12c803,_0x192d38){return db[_0xe65d('0x3f')][_0xe65d('0x59')]({'where':{'id':_0x12c803['params']['id']}})[_0xe65d('0x22')](handleEntityNotFound(_0x192d38,null))[_0xe65d('0x22')](removeEntity(_0x192d38,null))[_0xe65d('0x56')](handleError(_0x192d38,null));};exports[_0xe65d('0x5c')]=function(_0x55eb60,_0x3adf01){return db[_0xe65d('0x3f')][_0xe65d('0x5c')]()[_0xe65d('0x22')](respondWithResult(_0x3adf01,null))[_0xe65d('0x56')](handleError(_0x3adf01,null));};exports[_0xe65d('0x5d')]=function(_0x3fe707,_0x34d93c){return db['MailMessage'][_0xe65d('0x5d')](_0x3fe707[_0xe65d('0x5a')])[_0xe65d('0x22')](function(_0x3fcb15){if(_0x3fcb15){if(_0x3fcb15['direction']===_0xe65d('0x5e')&&!_0x3fcb15['secret']){var _0x3ffcf4,_0x302a95,_0x3fe5d4;if(_0x3fe707[_0xe65d('0x5a')]['to']){_0x302a95=_0x3fe707[_0xe65d('0x5a')]['to'][_0xe65d('0x5f')](',')[0x0];}return db[_0xe65d('0x60')][_0xe65d('0x61')]({'where':{'id':_0x3fcb15[_0xe65d('0x62')]},'include':[{'model':db[_0xe65d('0x63')],'as':_0xe65d('0x64'),'include':[{'model':db[_0xe65d('0x65')],'as':_0xe65d('0x66'),'where':{'email':_0x302a95},'limit':0x1,'order':[[_0xe65d('0x67'),_0xe65d('0x68')]]}]},{'model':db[_0xe65d('0x69')],'as':_0xe65d('0x6a'),'raw':!![]}]})[_0xe65d('0x22')](function(_0x2f386f){_0x3ffcf4=_0x2f386f;if(_0x3ffcf4&&_0x3ffcf4['Smtp']){var _0x5f43f1={'tls':{'rejectUnauthorized':![]}};if(_[_0xe65d('0x6b')](_0x3ffcf4[_0xe65d('0x6a')]['service'])){_0x5f43f1['host']=_0x3ffcf4[_0xe65d('0x6a')]['host'];_0x5f43f1[_0xe65d('0x6c')]=_0x3ffcf4[_0xe65d('0x6a')][_0xe65d('0x6c')];_0x5f43f1[_0xe65d('0x6d')]=_0x3ffcf4[_0xe65d('0x6a')][_0xe65d('0x6d')];if(_0x3ffcf4[_0xe65d('0x6a')][_0xe65d('0x6e')]){_0x5f43f1[_0xe65d('0x6f')]={'user':_0x3ffcf4[_0xe65d('0x6a')][_0xe65d('0x70')],'pass':_0x3ffcf4['Smtp']['pass']};}}else{_0x5f43f1[_0xe65d('0x71')]=_0x3ffcf4[_0xe65d('0x6a')][_0xe65d('0x71')];_0x5f43f1[_0xe65d('0x6f')]={'user':_0x3ffcf4[_0xe65d('0x6a')][_0xe65d('0x70')],'pass':_0x3ffcf4[_0xe65d('0x6a')][_0xe65d('0x72')]};_0x5f43f1[_0xe65d('0x6d')]=_0x3ffcf4[_0xe65d('0x6a')][_0xe65d('0x6d')];}if(_0x3fe707[_0xe65d('0x5a')][_0xe65d('0x73')]&&_0x3fe707[_0xe65d('0x5a')][_0xe65d('0x73')][_0xe65d('0x4b')]){for(var _0x362635=0x0;_0x362635<_0x3fe707[_0xe65d('0x5a')][_0xe65d('0x73')]['length'];_0x362635+=0x1){_0x3fe707[_0xe65d('0x5a')][_0xe65d('0x73')][_0x362635]={'filename':_0x3fe707[_0xe65d('0x5a')][_0xe65d('0x73')][_0x362635][_0xe65d('0x3b')],'path':path[_0xe65d('0x74')](config['root'],'server/files/attachments',_0x3fe707[_0xe65d('0x5a')][_0xe65d('0x73')][_0x362635][_0xe65d('0x75')])};}}_0x3fe5d4={'account':_0x5f43f1,'message':_0x3fe707[_0xe65d('0x5a')]};return;}})['then'](function(){if(_0x3ffcf4[_0xe65d('0x64')]){if(_0x3ffcf4[_0xe65d('0x64')][_0xe65d('0x66')][_0xe65d('0x4b')]){return _0x3ffcf4['List'][_0xe65d('0x66')][0x0];}else{return db['CmContact']['create'](_[_0xe65d('0x76')](_0x3fe707['body'],{'firstName':_0x3fe707[_0xe65d('0x5a')]['to'],'email':_0x3fe707[_0xe65d('0x5a')]['to'],'phone':_0x3fe707[_0xe65d('0x5a')]['to'],'ListId':_0x3ffcf4[_0xe65d('0x77')]}));}}else{throw new Error(_0xe65d('0x78'));}})[_0xe65d('0x22')](function(){if(_0x3fe5d4){return respondWithRpcPromise('SendMail',_0xe65d('0x79'),_0x3fe5d4,client9003)['then'](function(_0x1feaf0){return _0x3fcb15[_0xe65d('0x37')]({'read':!![],'messageId':_0x1feaf0['messageId'],'sentAt':moment()['format'](_0xe65d('0x7a'))});})[_0xe65d('0x56')](function(_0x4162c4){logger[_0xe65d('0x29')]('%s',JSON['stringify'](_0x4162c4));return _0x3fcb15;});}return _0x3fcb15;});}return _0x3fcb15;}})[_0xe65d('0x22')](respondWithResult(_0x34d93c,0xc9))[_0xe65d('0x56')](handleError(_0x34d93c,null));};var interaction_log=require(_0xe65d('0x12'))(_0xe65d('0x7b'));exports[_0xe65d('0x7c')]=function(_0x317281,_0x539177,_0x2be118){var _0x517a83={'channel':_0xe65d('0x7d')};if(_0x317281[_0xe65d('0x5a')]['id']){delete _0x317281[_0xe65d('0x5a')]['id'];}_0x317281[_0xe65d('0x5a')][_0xe65d('0x7e')]=!![];_0x317281[_0xe65d('0x5a')][_0xe65d('0x7f')]=moment()[_0xe65d('0x80')]('YYYY-MM-DD\x20HH:mm:ss');_0x317281[_0xe65d('0x5a')]['UserId']=_0x317281[_0xe65d('0x5a')][_0xe65d('0x81')]||_0x317281[_0xe65d('0x70')]['id'];return db[_0xe65d('0x3f')][_0xe65d('0x59')]({'where':{'id':_0x317281['params']['id'],'UserId':null},'include':[{'model':db[_0xe65d('0x65')],'as':_0xe65d('0x82')}]})[_0xe65d('0x22')](handleEntityNotFound(_0x539177,null))[_0xe65d('0x22')](saveUpdates(_0x317281[_0xe65d('0x5a')],null))[_0xe65d('0x22')](function(_0x3dec4d){if(_0x3dec4d){_0x517a83[_0xe65d('0x2b')]=_0x3dec4d[_0xe65d('0x83')]({'plain':!![]});return db[_0xe65d('0x84')][_0xe65d('0x59')]({'where':{'id':_0x3dec4d[_0xe65d('0x85')]}});}return null;})[_0xe65d('0x22')](handleEntityNotFound(_0x539177,null))[_0xe65d('0x22')](function(_0xe30fe4){if(_0xe30fe4){return _0xe30fe4[_0xe65d('0x37')]({'UserId':_0x317281[_0xe65d('0x5a')][_0xe65d('0x81')],'read1stAt':_[_0xe65d('0x6b')](_0xe30fe4['read1stAt'])?moment()[_0xe65d('0x80')]('YYYY-MM-DD\x20HH:mm:ss'):undefined});}return null;})['then'](function(_0x4c2ace){if(_0x4c2ace){_0x517a83[_0xe65d('0x86')]=_0x4c2ace[_0xe65d('0x83')]({'plain':!![]});interaction_log[_0xe65d('0x23')](_0xe65d('0x87'),_0x317281[_0xe65d('0x70')]['id'],_0x317281[_0xe65d('0x70')][_0xe65d('0x3b')],_0x317281['user'][_0xe65d('0x88')],_0x517a83['interaction']['id'],_0x317281['body']?JSON['stringify'](_0x317281[_0xe65d('0x5a')]):'null');return respondWithRpcPromise(_0xe65d('0x89'),_0xe65d('0x8a'),_0x517a83);}return null;})[_0xe65d('0x22')](function(_0x42a543){if(_0x42a543){if(_0x317281['body'][_0xe65d('0x8b')]){_0x517a83[_0xe65d('0x2b')]['interface']=util['format'](_0xe65d('0x8c'),_0x317281[_0xe65d('0x70')][_0xe65d('0x3b')]);_0x517a83[_0xe65d('0x2b')]['channel']=_0x517a83[_0xe65d('0x8d')];_0x517a83[_0xe65d('0x2b')][_0xe65d('0x8e')]='accept';return respondWithRpcPromise(_0xe65d('0x8f'),'EventManager',{'event':_0xe65d('0x90'),'message':_0x517a83['message']},client9002)['then'](function(){return _0x517a83;});}return _0x517a83;}return null;})['then'](respondWithResult(_0x539177,null))[_0xe65d('0x56')](handleError(_0x539177,null));};var interaction_log=require(_0xe65d('0x12'))(_0xe65d('0x7b'));exports[_0xe65d('0x35')]=function(_0x27d11c,_0x10d1ab,_0x37d20e){var _0xb7d953={'agent':{},'channel':_0xe65d('0x7d')};if(_0x27d11c[_0xe65d('0x5a')]['id']){delete _0x27d11c[_0xe65d('0x5a')]['id'];}_0x27d11c[_0xe65d('0x5a')][_0xe65d('0x81')]=_0x27d11c[_0xe65d('0x5a')]['UserId']||_0x27d11c[_0xe65d('0x70')]['id'];_0xb7d953[_0xe65d('0x91')]['id']=_0x27d11c['body'][_0xe65d('0x81')];return db[_0xe65d('0x3f')]['find']({'where':{'id':_0x27d11c[_0xe65d('0x5b')]['id'],'UserId':null}})[_0xe65d('0x22')](handleEntityNotFound(_0x10d1ab,null))[_0xe65d('0x22')](function(_0x32e9fd){if(_0x32e9fd){_0xb7d953[_0xe65d('0x2b')]=_0x32e9fd[_0xe65d('0x83')]({'plain':!![]});return db[_0xe65d('0x84')][_0xe65d('0x59')]({'where':{'id':_0x32e9fd['MailInteractionId']}});}return null;})['then'](handleEntityNotFound(_0x10d1ab,null))[_0xe65d('0x22')](function(_0x4780eb){if(_0x4780eb){_0xb7d953[_0xe65d('0x86')]=_0x4780eb[_0xe65d('0x83')]({'plain':!![]});interaction_log[_0xe65d('0x23')]('[MAILMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s',_0x27d11c[_0xe65d('0x70')]['id'],_0x27d11c['user']['name'],_0x27d11c[_0xe65d('0x70')][_0xe65d('0x88')],_0xb7d953[_0xe65d('0x86')]['id'],_0x27d11c['body']?JSON[_0xe65d('0x28')](_0x27d11c['body']):'null');return respondWithRpcPromise('RejectMessage',_0xe65d('0x92'),_0xb7d953);}return null;})[_0xe65d('0x22')](function(_0x283f58){if(_0x283f58){_0x283f58['message'][_0xe65d('0x93')]=util['format'](_0xe65d('0x8c'),_0x27d11c[_0xe65d('0x70')][_0xe65d('0x3b')]);_0x283f58[_0xe65d('0x2b')][_0xe65d('0x8d')]=_0xb7d953[_0xe65d('0x8d')];_0x283f58[_0xe65d('0x2b')][_0xe65d('0x8e')]=_0xe65d('0x35');respondWithRpcPromise(_0xe65d('0x8f'),_0xe65d('0x8f'),{'event':_0xe65d('0x94'),'message':_0x283f58[_0xe65d('0x2b')]},client9002);return _0xb7d953;}return null;})['then'](respondWithResult(_0x10d1ab,null))[_0xe65d('0x56')](handleError(_0x10d1ab,null));};exports[_0xe65d('0x95')]=function(_0x3647f9,_0x884732){var _0x1240ab=moment()[_0xe65d('0x96')]()[_0xe65d('0x97')]();var _0x2db574=path['join'](config['root'],_0xe65d('0x98'),_0xe65d('0x99'),_0xe65d('0x9a'));var _0x310965=path[_0xe65d('0x74')](config[_0xe65d('0x9b')],_0xe65d('0x98'),_0xe65d('0x99'),_0xe65d('0x73'));var _0x5800ec=util[_0xe65d('0x80')](_0xe65d('0x9c'),_0x1240ab);return db[_0xe65d('0x3f')][_0xe65d('0x59')]({'where':{'id':_0x3647f9['params']['id']},'attributes':['id',_0xe65d('0x5a'),_0xe65d('0x9d'),'to','cc',_0xe65d('0x9e'),_0xe65d('0x9f'),'createdAt'],'include':_0x3647f9[_0xe65d('0x45')]['attachments']?[{'model':db[_0xe65d('0xa0')],'as':'Attachments'}]:undefined})[_0xe65d('0x22')](handleEntityNotFound(_0x884732,null))[_0xe65d('0x22')](function(_0x585b2d){if(_0x585b2d){var _0x5acad9=_0x585b2d;var _0x2ad620={'from':_0x5acad9[_0xe65d('0x9d')],'to':_0x5acad9['to'],'subject':_0x5acad9[_0xe65d('0x9f')],'html':_0x5acad9['body'],'headers':{'Date':moment(_0x5acad9['createdAt'])['format'](_0xe65d('0xa1'))},'attachments':[]};if(_0x585b2d['cc']){_0x2ad620[_0xe65d('0xa2')]['Cc']=_0x585b2d['cc'];}if(_0x585b2d[_0xe65d('0x9e')]){_0x2ad620['headers'][_0xe65d('0xa3')]=_0x585b2d[_0xe65d('0x9e')];}return new BPromise(function(_0xed23f2,_0x45d0c9){if(_0x585b2d[_0xe65d('0xa4')]){for(var _0x46ab03=0x0;_0x46ab03<_0x585b2d[_0xe65d('0xa4')]['length'];_0x46ab03++){var _0x36d821=_0x585b2d[_0xe65d('0xa4')][_0x46ab03];var _0x287424=path[_0xe65d('0x74')](_0x310965,_0x36d821['basename']);if(fs[_0xe65d('0xa5')](_0x287424)){_0x2ad620[_0xe65d('0x73')][_0xe65d('0xa6')]({'name':_0x36d821['name'],'contentType':_0x36d821[_0xe65d('0x42')],'data':fs['readFileSync'](_0x287424)});}}}emlformat[_0xe65d('0xa7')](_0x2ad620,function(_0x395b8a,_0x575ed8){if(_0x395b8a)return _0x45d0c9(_0x395b8a);fs[_0xe65d('0xa8')](path[_0xe65d('0x74')](_0x2db574,_0x5800ec),_0x575ed8);return _0xed23f2(_0x575ed8);});});}})[_0xe65d('0x22')](function(_0x4b8ff7){if(_0x4b8ff7){return _0x884732[_0xe65d('0x95')](path[_0xe65d('0x74')](_0x2db574,_0x5800ec),_0x5800ec,function(_0x5be7d1){if(_0x5be7d1){console[_0xe65d('0xa9')](_0xe65d('0xaa'),_0x5be7d1);}else{fs[_0xe65d('0xab')](path[_0xe65d('0x74')](_0x2db574,_0x5800ec));}});}})['catch'](handleError(_0x884732,null));}; \ No newline at end of file diff --git a/server/api/mailMessage/mailMessage.events.js b/server/api/mailMessage/mailMessage.events.js index 2a42851..a5f885a 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 _0x92dc=['setMaxListeners','save','update','remove','emit','hasOwnProperty','exports'];(function(_0xeaea6e,_0x58d1b2){var _0x116210=function(_0x4f4e64){while(--_0x4f4e64){_0xeaea6e['push'](_0xeaea6e['shift']());}};_0x116210(++_0x58d1b2);}(_0x92dc,0xee));var _0xc92d=function(_0xd93cbe,_0x11202e){_0xd93cbe=_0xd93cbe-0x0;var _0xe0bb40=_0x92dc[_0xd93cbe];return _0xe0bb40;};'use strict';var EventEmitter=require('events');var MailMessage=require('../../mysqldb')['db']['MailMessage'];var MailMessageEvents=new EventEmitter();MailMessageEvents[_0xc92d('0x0')](0x0);var events={'afterCreate':_0xc92d('0x1'),'afterUpdate':_0xc92d('0x2'),'afterDestroy':_0xc92d('0x3')};function emitEvent(_0x5dd2d3){return function(_0x3bac6c,_0x2ee562,_0x136879){MailMessageEvents[_0xc92d('0x4')](_0x5dd2d3+':'+_0x3bac6c['id'],_0x3bac6c);MailMessageEvents['emit'](_0x5dd2d3,_0x3bac6c);_0x136879(null);};}for(var e in events){if(events[_0xc92d('0x5')](e)){var event=events[e];MailMessage['hook'](e,emitEvent(event));}}module[_0xc92d('0x6')]=MailMessageEvents; \ No newline at end of file +var _0xcc04=['update','remove','emit','hook','exports','save'];(function(_0x30b510,_0x4be230){var _0x3b936c=function(_0x35eecd){while(--_0x35eecd){_0x30b510['push'](_0x30b510['shift']());}};_0x3b936c(++_0x4be230);}(_0xcc04,0x1df));var _0x4cc0=function(_0x4e9559,_0x324346){_0x4e9559=_0x4e9559-0x0;var _0x13d630=_0xcc04[_0x4e9559];return _0x13d630;};'use strict';var EventEmitter=require('events');var MailMessage=require('../../mysqldb')['db']['MailMessage'];var MailMessageEvents=new EventEmitter();MailMessageEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x4cc0('0x0'),'afterUpdate':_0x4cc0('0x1'),'afterDestroy':_0x4cc0('0x2')};function emitEvent(_0x40020a){return function(_0x22d9b5,_0x8d4b2,_0x19b00e){MailMessageEvents[_0x4cc0('0x3')](_0x40020a+':'+_0x22d9b5['id'],_0x22d9b5);MailMessageEvents[_0x4cc0('0x3')](_0x40020a,_0x22d9b5);_0x19b00e(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];MailMessage[_0x4cc0('0x4')](e,emitEvent(event));}}module[_0x4cc0('0x5')]=MailMessageEvents; \ No newline at end of file diff --git a/server/api/mailMessage/mailMessage.model.js b/server/api/mailMessage/mailMessage.model.js index 5a0d4fc..4c05eb2 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 _0xe210=['messageId','fti_mail_messages','subject','FULLTEXT','body','plainBody','fromString','models','get','direction','toLowerCase','out','isNil','UserId','MailInteraction','then','createdAt','error','utf8mb4','lodash','util','../../config/logger','api','moment','bluebird','html-to-text','rimraf','../../config/environment','./mailMessage.attributes','exports','define','MailMessage'];(function(_0x2358ef,_0x1da908){var _0x57f50b=function(_0x304af9){while(--_0x304af9){_0x2358ef['push'](_0x2358ef['shift']());}};_0x57f50b(++_0x1da908);}(_0xe210,0x113));var _0x0e21=function(_0x47a349,_0x4699d9){_0x47a349=_0x47a349-0x0;var _0x18ab75=_0xe210[_0x47a349];return _0x18ab75;};'use strict';var _=require(_0x0e21('0x0'));var util=require(_0x0e21('0x1'));var logger=require(_0x0e21('0x2'))(_0x0e21('0x3'));var moment=require(_0x0e21('0x4'));var BPromise=require(_0x0e21('0x5'));var rp=require('request-promise');var htmlToText=require(_0x0e21('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0x0e21('0x7'));var config=require(_0x0e21('0x8'));var attributes=require(_0x0e21('0x9'));module[_0x0e21('0xa')]=function(_0x550986,_0x25b5c8){return _0x550986[_0x0e21('0xb')](_0x0e21('0xc'),attributes,{'tableName':'mail_messages','paranoid':![],'indexes':[{'name':_0x0e21('0xd'),'fields':[_0x0e21('0xd')]},{'name':_0x0e21('0xe'),'fields':['plainBody',_0x0e21('0xf')],'type':_0x0e21('0x10')}],'timestamps':!![],'hooks':{'beforeCreate':function(_0x2dbde9,_0x437034,_0x348d56){if(_0x2dbde9[_0x0e21('0x11')]){_0x2dbde9[_0x0e21('0x12')]=htmlToText[_0x0e21('0x13')](_0x2dbde9[_0x0e21('0x11')],{'preserveNewlines':!![],'singleNewLineParagraphs':!![],'uppercaseHeadings':![],'noLinkBrackets':!![],'ignoreImage':!![]});}_0x348d56(null,_0x437034);},'afterCreate':function(_0x1c8f8f,_0x47a64e,_0x190a74){var _0x5efd9a=_0x550986[_0x0e21('0x14')];var _0x4cb687=_0x1c8f8f[_0x0e21('0x15')]({'plain':!![]});if(_0x4cb687[_0x0e21('0x16')][_0x0e21('0x17')]()==='in'||_0x4cb687[_0x0e21('0x16')]['toLowerCase']()===_0x0e21('0x18')&&!_0x4cb687['secret']&&!_[_0x0e21('0x19')](_0x4cb687[_0x0e21('0x1a')])){_0x5efd9a[_0x0e21('0x1b')]['findOne']({'where':{'id':_0x4cb687['MailInteractionId']}})[_0x0e21('0x1c')](function(_0x1e2061){if(_0x1e2061){_0x1e2061['update']({'lastMsgAt':_0x4cb687[_0x0e21('0x1d')],'lastMsgDirection':_0x4cb687[_0x0e21('0x16')][_0x0e21('0x17')](),'lastMsgBody':_0x4cb687[_0x0e21('0x11')]});}})['catch'](function(_0x5123f7){console[_0x0e21('0x1e')](_0x5123f7);});}_0x190a74();}},'charset':_0x0e21('0x1f'),'collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file +var _0x5951=['findOne','MailInteractionId','update','createdAt','error','utf8mb4','lodash','../../config/logger','moment','bluebird','request-promise','html-to-text','path','rimraf','../../config/environment','./mailMessage.attributes','define','MailMessage','messageId','subject','body','plainBody','models','direction','toLowerCase','out','secret','isNil','MailInteraction'];(function(_0x2ec50f,_0x489e71){var _0x815a89=function(_0x553302){while(--_0x553302){_0x2ec50f['push'](_0x2ec50f['shift']());}};_0x815a89(++_0x489e71);}(_0x5951,0x145));var _0x1595=function(_0x2d7f0e,_0x3e6fbd){_0x2d7f0e=_0x2d7f0e-0x0;var _0x110b07=_0x5951[_0x2d7f0e];return _0x110b07;};'use strict';var _=require(_0x1595('0x0'));var util=require('util');var logger=require(_0x1595('0x1'))('api');var moment=require(_0x1595('0x2'));var BPromise=require(_0x1595('0x3'));var rp=require(_0x1595('0x4'));var htmlToText=require(_0x1595('0x5'));var fs=require('fs');var path=require(_0x1595('0x6'));var rimraf=require(_0x1595('0x7'));var config=require(_0x1595('0x8'));var attributes=require(_0x1595('0x9'));module['exports']=function(_0x51af5e,_0x2fbf88){return _0x51af5e[_0x1595('0xa')](_0x1595('0xb'),attributes,{'tableName':'mail_messages','paranoid':![],'indexes':[{'name':_0x1595('0xc'),'fields':[_0x1595('0xc')]},{'name':'fti_mail_messages','fields':['plainBody',_0x1595('0xd')],'type':'FULLTEXT'}],'timestamps':!![],'hooks':{'beforeCreate':function(_0x1b318d,_0x4b23be,_0x31224f){if(_0x1b318d[_0x1595('0xe')]){_0x1b318d[_0x1595('0xf')]=htmlToText['fromString'](_0x1b318d[_0x1595('0xe')],{'preserveNewlines':!![],'singleNewLineParagraphs':!![],'uppercaseHeadings':![],'noLinkBrackets':!![],'ignoreImage':!![]});}_0x31224f(null,_0x4b23be);},'afterCreate':function(_0x37f1c4,_0x74c1d1,_0x39a752){var _0x42f2a7=_0x51af5e[_0x1595('0x10')];var _0x50f782=_0x37f1c4['get']({'plain':!![]});if(_0x50f782[_0x1595('0x11')][_0x1595('0x12')]()==='in'||_0x50f782[_0x1595('0x11')][_0x1595('0x12')]()===_0x1595('0x13')&&!_0x50f782[_0x1595('0x14')]&&!_[_0x1595('0x15')](_0x50f782['UserId'])){_0x42f2a7[_0x1595('0x16')][_0x1595('0x17')]({'where':{'id':_0x50f782[_0x1595('0x18')]}})['then'](function(_0x55b621){if(_0x55b621){_0x55b621[_0x1595('0x19')]({'lastMsgAt':_0x50f782[_0x1595('0x1a')],'lastMsgDirection':_0x50f782[_0x1595('0x11')][_0x1595('0x12')](),'lastMsgBody':_0x50f782['body']});}})['catch'](function(_0x5dd4ac){console[_0x1595('0x1b')](_0x5dd4ac);});}_0x39a752();}},'charset':_0x1595('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 ea89f81..02ce09f 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 _0x647c=['./mailMessage.socket','register','request','then','MailMessage,\x20%s,\x20%s','request\x20sent','debug','MailMessage,\x20%s,\x20%s,\x20%s','stringify','error','message','info','result','CreateMailMessage','MailMessage','create','body','options','raw','lodash','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','redis','defaults'];(function(_0x39d8d4,_0x1ee04a){var _0x4b48ec=function(_0x5ca8a5){while(--_0x5ca8a5){_0x39d8d4['push'](_0x39d8d4['shift']());}};_0x4b48ec(++_0x1ee04a);}(_0x647c,0x1d3));var _0xc647=function(_0xfe7ce3,_0x394ba8){_0xfe7ce3=_0xfe7ce3-0x0;var _0x108672=_0x647c[_0xfe7ce3];return _0x108672;};'use strict';var _=require(_0xc647('0x0'));var util=require('util');var moment=require(_0xc647('0x1'));var BPromise=require(_0xc647('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xc647('0x3'));var db=require(_0xc647('0x4'))['db'];var utils=require(_0xc647('0x5'));var logger=require(_0xc647('0x6'))(_0xc647('0x7'));var config=require('../../config/environment');var jayson=require(_0xc647('0x8'));var client=jayson[_0xc647('0x9')][_0xc647('0xa')]({'port':0x232a});config[_0xc647('0xb')]=_[_0xc647('0xc')](config[_0xc647('0xb')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xc647('0xb')]));require(_0xc647('0xd'))[_0xc647('0xe')](socket);function respondWithRpcPromise(_0x5a23f2,_0x3ba0ca,_0x65d65c){return new BPromise(function(_0x157bd6,_0x457bb1){return client[_0xc647('0xf')](_0x5a23f2,_0x65d65c)[_0xc647('0x10')](function(_0x1e2d76){logger['info'](_0xc647('0x11'),_0x3ba0ca,_0xc647('0x12'));logger[_0xc647('0x13')](_0xc647('0x14'),_0x3ba0ca,_0xc647('0x12'),JSON[_0xc647('0x15')](_0x1e2d76));if(_0x1e2d76[_0xc647('0x16')]){if(_0x1e2d76['error']['code']===0x1f4){logger[_0xc647('0x16')]('MailMessage,\x20%s,\x20%s',_0x3ba0ca,_0x1e2d76[_0xc647('0x16')]['message']);return _0x457bb1(_0x1e2d76[_0xc647('0x16')][_0xc647('0x17')]);}logger[_0xc647('0x16')]('MailMessage,\x20%s,\x20%s',_0x3ba0ca,_0x1e2d76[_0xc647('0x16')][_0xc647('0x17')]);return _0x157bd6(_0x1e2d76['error'][_0xc647('0x17')]);}else{logger[_0xc647('0x18')](_0xc647('0x11'),_0x3ba0ca,_0xc647('0x12'));_0x157bd6(_0x1e2d76[_0xc647('0x19')][_0xc647('0x17')]);}})['catch'](function(_0x4d8807){logger[_0xc647('0x16')](_0xc647('0x11'),_0x3ba0ca,_0x4d8807);_0x457bb1(_0x4d8807);});});}exports[_0xc647('0x1a')]=function(_0xd41203){var _0x30eba7=this;return new Promise(function(_0x1ac3b0,_0x5494b7){return db[_0xc647('0x1b')][_0xc647('0x1c')](_0xd41203[_0xc647('0x1d')],{'raw':_0xd41203[_0xc647('0x1e')]?_0xd41203['options'][_0xc647('0x1f')]===undefined?!![]:![]:!![]})[_0xc647('0x10')](function(_0x15efba){logger['info']('CreateMailMessage',_0xd41203);logger[_0xc647('0x13')](_0xc647('0x1a'),_0xd41203,JSON['stringify'](_0x15efba));_0x1ac3b0(_0x15efba);})['catch'](function(_0xd9d594){logger[_0xc647('0x16')](_0xc647('0x1a'),_0xd9d594[_0xc647('0x17')],_0xd41203);_0x5494b7(_0x30eba7[_0xc647('0x16')](0x1f4,_0xd9d594['message']));});});}; \ No newline at end of file +var _0x7a2f=['bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','redis','defaults','localhost','./mailMessage.socket','register','then','info','MailMessage,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','catch','CreateMailMessage','MailMessage','create','body','options','raw','lodash','util'];(function(_0x1b349a,_0x22222c){var _0x5d1f7c=function(_0x368d7c){while(--_0x368d7c){_0x1b349a['push'](_0x1b349a['shift']());}};_0x5d1f7c(++_0x22222c);}(_0x7a2f,0x99));var _0xf7a2=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0x7a2f[_0xa464c9];return _0x3d73c4;};'use strict';var _=require(_0xf7a2('0x0'));var util=require(_0xf7a2('0x1'));var moment=require('moment');var BPromise=require(_0xf7a2('0x2'));var rs=require(_0xf7a2('0x3'));var fs=require('fs');var Redis=require(_0xf7a2('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0xf7a2('0x5'));var logger=require(_0xf7a2('0x6'))(_0xf7a2('0x7'));var config=require(_0xf7a2('0x8'));var jayson=require(_0xf7a2('0x9'));var client=jayson[_0xf7a2('0xa')]['http']({'port':0x232a});config[_0xf7a2('0xb')]=_[_0xf7a2('0xc')](config[_0xf7a2('0xb')],{'host':_0xf7a2('0xd'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xf7a2('0xb')]));require(_0xf7a2('0xe'))[_0xf7a2('0xf')](socket);function respondWithRpcPromise(_0x193e7b,_0x3e6897,_0x385c4f){return new BPromise(function(_0x46a0d0,_0x2a94a6){return client['request'](_0x193e7b,_0x385c4f)[_0xf7a2('0x10')](function(_0x2f80da){logger[_0xf7a2('0x11')](_0xf7a2('0x12'),_0x3e6897,_0xf7a2('0x13'));logger['debug']('MailMessage,\x20%s,\x20%s,\x20%s',_0x3e6897,'request\x20sent',JSON[_0xf7a2('0x14')](_0x2f80da));if(_0x2f80da[_0xf7a2('0x15')]){if(_0x2f80da[_0xf7a2('0x15')][_0xf7a2('0x16')]===0x1f4){logger[_0xf7a2('0x15')](_0xf7a2('0x12'),_0x3e6897,_0x2f80da[_0xf7a2('0x15')]['message']);return _0x2a94a6(_0x2f80da['error']['message']);}logger[_0xf7a2('0x15')]('MailMessage,\x20%s,\x20%s',_0x3e6897,_0x2f80da['error'][_0xf7a2('0x17')]);return _0x46a0d0(_0x2f80da[_0xf7a2('0x15')][_0xf7a2('0x17')]);}else{logger[_0xf7a2('0x11')](_0xf7a2('0x12'),_0x3e6897,'request\x20sent');_0x46a0d0(_0x2f80da['result']['message']);}})[_0xf7a2('0x18')](function(_0xfbd717){logger[_0xf7a2('0x15')](_0xf7a2('0x12'),_0x3e6897,_0xfbd717);_0x2a94a6(_0xfbd717);});});}exports[_0xf7a2('0x19')]=function(_0x5e0b27){var _0x458a24=this;return new Promise(function(_0x52a43e,_0x1f2b26){return db[_0xf7a2('0x1a')][_0xf7a2('0x1b')](_0x5e0b27[_0xf7a2('0x1c')],{'raw':_0x5e0b27[_0xf7a2('0x1d')]?_0x5e0b27[_0xf7a2('0x1d')][_0xf7a2('0x1e')]===undefined?!![]:![]:!![]})['then'](function(_0x4b1a06){logger[_0xf7a2('0x11')](_0xf7a2('0x19'),_0x5e0b27);logger['debug'](_0xf7a2('0x19'),_0x5e0b27,JSON[_0xf7a2('0x14')](_0x4b1a06));_0x52a43e(_0x4b1a06);})[_0xf7a2('0x18')](function(_0x19d95e){logger[_0xf7a2('0x15')]('CreateMailMessage',_0x19d95e[_0xf7a2('0x17')],_0x5e0b27);_0x1f2b26(_0x458a24['error'](0x1f4,_0x19d95e[_0xf7a2('0x17')]));});});}; \ No newline at end of file diff --git a/server/api/mailMessage/mailMessage.socket.js b/server/api/mailMessage/mailMessage.socket.js index 9f9d16b..efb196b 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 _0x9dbd=['length','remove','update','emit','removeListener'];(function(_0x722fe8,_0x29cfda){var _0x1b23e8=function(_0x5cfdae){while(--_0x5cfdae){_0x722fe8['push'](_0x722fe8['shift']());}};_0x1b23e8(++_0x29cfda);}(_0x9dbd,0xa6));var _0xd9db=function(_0x3fb73a,_0x14d1a5){_0x3fb73a=_0x3fb73a-0x0;var _0x15f56a=_0x9dbd[_0x3fb73a];return _0x15f56a;};'use strict';var MailMessageEvents=require('./mailMessage.events');var events=['save',_0xd9db('0x0'),_0xd9db('0x1')];function createListener(_0x15909b,_0x264d89){return function(_0x31def3){_0x264d89[_0xd9db('0x2')](_0x15909b,_0x31def3);};}function removeListener(_0x4d4582,_0xc9d435){return function(){MailMessageEvents[_0xd9db('0x3')](_0x4d4582,_0xc9d435);};}exports['register']=function(_0x292fc3){for(var _0x18482c=0x0,_0x2ed51d=events[_0xd9db('0x4')];_0x18482c<_0x2ed51d;_0x18482c++){var _0xdad978=events[_0x18482c];var _0x5e3f3a=createListener('mailMessage:'+_0xdad978,_0x292fc3);MailMessageEvents['on'](_0xdad978,_0x5e3f3a);}}; \ No newline at end of file +var _0x0a67=['emit','register','length','mailMessage:','./mailMessage.events','save','remove','update'];(function(_0x16aaef,_0x410651){var _0x1c82ef=function(_0x3d802b){while(--_0x3d802b){_0x16aaef['push'](_0x16aaef['shift']());}};_0x1c82ef(++_0x410651);}(_0x0a67,0x1c4));var _0x70a6=function(_0x1a3d29,_0x21e8d4){_0x1a3d29=_0x1a3d29-0x0;var _0x5ba268=_0x0a67[_0x1a3d29];return _0x5ba268;};'use strict';var MailMessageEvents=require(_0x70a6('0x0'));var events=[_0x70a6('0x1'),_0x70a6('0x2'),_0x70a6('0x3')];function createListener(_0x4cb65e,_0x79512f){return function(_0x559bc6){_0x79512f[_0x70a6('0x4')](_0x4cb65e,_0x559bc6);};}function removeListener(_0xe31fc3,_0x47c00b){return function(){MailMessageEvents['removeListener'](_0xe31fc3,_0x47c00b);};}exports[_0x70a6('0x5')]=function(_0x4581a6){for(var _0x590819=0x0,_0x3ca3cd=events[_0x70a6('0x6')];_0x590819<_0x3ca3cd;_0x590819++){var _0x46dc31=events[_0x590819];var _0x4947fd=createListener(_0x70a6('0x7')+_0x46dc31,_0x4581a6);MailMessageEvents['on'](_0x46dc31,_0x4947fd);}}; \ No newline at end of file diff --git a/server/api/mailQueue/index.js b/server/api/mailQueue/index.js index b79ed86..2ef87e0 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 _0xf05a=['delete','destroy','removeTeams','removeAgents','multer','util','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./mailQueue.controller','get','index','/describe','describe','/:id','isAuthenticated','show','/:id/members','getMembers','/:id/teams','/:id/users','getAgents','create','post','addTeams','update'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xf05a,0x95));var _0xaf05=function(_0x2c91e9,_0x2fb965){_0x2c91e9=_0x2c91e9-0x0;var _0x13f0ff=_0xf05a[_0x2c91e9];return _0x13f0ff;};'use strict';var multer=require(_0xaf05('0x0'));var util=require(_0xaf05('0x1'));var path=require('path');var timeout=require(_0xaf05('0x2'));var express=require(_0xaf05('0x3'));var router=express[_0xaf05('0x4')]();var auth=require(_0xaf05('0x5'));var interaction=require(_0xaf05('0x6'));var config=require(_0xaf05('0x7'));var controller=require(_0xaf05('0x8'));router[_0xaf05('0x9')]('/',auth['isAuthenticated'](),controller[_0xaf05('0xa')]);router[_0xaf05('0x9')](_0xaf05('0xb'),auth['isAuthenticated'](),controller[_0xaf05('0xc')]);router[_0xaf05('0x9')](_0xaf05('0xd'),auth[_0xaf05('0xe')](),controller[_0xaf05('0xf')]);router[_0xaf05('0x9')](_0xaf05('0x10'),auth[_0xaf05('0xe')](),controller[_0xaf05('0x11')]);router[_0xaf05('0x9')](_0xaf05('0x12'),auth[_0xaf05('0xe')](),controller['getTeams']);router['get'](_0xaf05('0x13'),auth[_0xaf05('0xe')](),controller[_0xaf05('0x14')]);router['post']('/',auth[_0xaf05('0xe')](),controller[_0xaf05('0x15')]);router[_0xaf05('0x16')]('/:id/teams',auth[_0xaf05('0xe')](),controller[_0xaf05('0x17')]);router[_0xaf05('0x16')](_0xaf05('0x13'),auth[_0xaf05('0xe')](),controller['addAgents']);router['put'](_0xaf05('0xd'),auth[_0xaf05('0xe')](),controller[_0xaf05('0x18')]);router[_0xaf05('0x19')](_0xaf05('0xd'),auth[_0xaf05('0xe')](),controller[_0xaf05('0x1a')]);router[_0xaf05('0x19')](_0xaf05('0x12'),auth[_0xaf05('0xe')](),controller[_0xaf05('0x1b')]);router[_0xaf05('0x19')](_0xaf05('0x13'),auth['isAuthenticated'](),controller[_0xaf05('0x1c')]);module['exports']=router; \ No newline at end of file +var _0x03d9=['removeAgents','multer','util','path','connect-timeout','express','Router','./mailQueue.controller','index','get','isAuthenticated','describe','/:id','show','/:id/members','getMembers','getTeams','/:id/users','getAgents','create','post','/:id/teams','addTeams','addAgents','put','update','destroy','delete','removeTeams'];(function(_0x34eb6a,_0x324fc1){var _0x2206fa=function(_0x5b1672){while(--_0x5b1672){_0x34eb6a['push'](_0x34eb6a['shift']());}};_0x2206fa(++_0x324fc1);}(_0x03d9,0x1d1));var _0x903d=function(_0x19dc45,_0xf99bed){_0x19dc45=_0x19dc45-0x0;var _0x1dab75=_0x03d9[_0x19dc45];return _0x1dab75;};'use strict';var multer=require(_0x903d('0x0'));var util=require(_0x903d('0x1'));var path=require(_0x903d('0x2'));var timeout=require(_0x903d('0x3'));var express=require(_0x903d('0x4'));var router=express[_0x903d('0x5')]();var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x903d('0x6'));router['get']('/',auth['isAuthenticated'](),controller[_0x903d('0x7')]);router[_0x903d('0x8')]('/describe',auth[_0x903d('0x9')](),controller[_0x903d('0xa')]);router[_0x903d('0x8')](_0x903d('0xb'),auth['isAuthenticated'](),controller[_0x903d('0xc')]);router['get'](_0x903d('0xd'),auth[_0x903d('0x9')](),controller[_0x903d('0xe')]);router[_0x903d('0x8')]('/:id/teams',auth[_0x903d('0x9')](),controller[_0x903d('0xf')]);router[_0x903d('0x8')](_0x903d('0x10'),auth[_0x903d('0x9')](),controller[_0x903d('0x11')]);router['post']('/',auth[_0x903d('0x9')](),controller[_0x903d('0x12')]);router[_0x903d('0x13')](_0x903d('0x14'),auth[_0x903d('0x9')](),controller[_0x903d('0x15')]);router['post'](_0x903d('0x10'),auth[_0x903d('0x9')](),controller[_0x903d('0x16')]);router[_0x903d('0x17')](_0x903d('0xb'),auth[_0x903d('0x9')](),controller[_0x903d('0x18')]);router['delete']('/:id',auth['isAuthenticated'](),controller[_0x903d('0x19')]);router[_0x903d('0x1a')]('/:id/teams',auth['isAuthenticated'](),controller[_0x903d('0x1b')]);router[_0x903d('0x1a')](_0x903d('0x10'),auth[_0x903d('0x9')](),controller[_0x903d('0x1c')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/mailQueue/mailQueue.attributes.js b/server/api/mailQueue/mailQueue.attributes.js index 2ec3ade..d7c93cf 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 _0x84cd=['beepall','roundrobin','sequelize','name','STRING','INTEGER','ENUM','rrmemory'];(function(_0x577d40,_0x11cb5e){var _0x3b0535=function(_0x4617a1){while(--_0x4617a1){_0x577d40['push'](_0x577d40['shift']());}};_0x3b0535(++_0x11cb5e);}(_0x84cd,0xb2));var _0xd84c=function(_0x2ef4b8,_0xec2b38){_0x2ef4b8=_0x2ef4b8-0x0;var _0x5da469=_0x84cd[_0x2ef4b8];return _0x5da469;};'use strict';var Sequelize=require(_0xd84c('0x0'));module['exports']={'name':{'type':Sequelize['STRING'],'unique':_0xd84c('0x1'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0xd84c('0x2')]},'timeout':{'type':Sequelize[_0xd84c('0x3')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0xd84c('0x4')](_0xd84c('0x5'),_0xd84c('0x6'),_0xd84c('0x7'))}}; \ No newline at end of file +var _0x4a08=['name','rrmemory','beepall','sequelize','STRING'];(function(_0x2093f0,_0x1f903c){var _0x37829f=function(_0x27d3bc){while(--_0x27d3bc){_0x2093f0['push'](_0x2093f0['shift']());}};_0x37829f(++_0x1f903c);}(_0x4a08,0x11b));var _0x84a0=function(_0x134ef1,_0x4080f8){_0x134ef1=_0x134ef1-0x0;var _0x4109d5=_0x4a08[_0x134ef1];return _0x4109d5;};'use strict';var Sequelize=require(_0x84a0('0x0'));module['exports']={'name':{'type':Sequelize[_0x84a0('0x1')],'unique':_0x84a0('0x2'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0x84a0('0x1')]},'timeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize['ENUM'](_0x84a0('0x3'),_0x84a0('0x4'),'roundrobin')}}; \ No newline at end of file diff --git a/server/api/mailQueue/mailQueue.controller.js b/server/api/mailQueue/mailQueue.controller.js index 21b8287..9ddfccf 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 _0xb842=['../../config/logger','api','../../config/utils','../../mysqldb','redis','./mailQueue.socket','sendStatus','status','end','json','count','offset','Content-Range','reject','save','update','destroy','MailQueues','UserProfileResource','then','stack','name','send','index','MailQueue','rawAttributes','fieldName','type','key','map','filters','intersection','model','fields','query','attributes','length','hasOwnProperty','nolimit','limit','order','sort','where','VIRTUAL','merge','options','includeAll','include','findAll','rows','catch','show','params','keys','find','create','body','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','getMembers','findOne','UserMailQueue','pick','filter','User','findAndCountAll','UserId','agent','mailPause','updatedAt','format','%s/%s','SIP','createdAt','getTeams','Team','addTeams','ids','Agents','voicePause','interface','sequelize','transaction','each','findOrCreate','forEach','emit','userMailQueue:save','removeTeams','select','field','tq.TeamId','from','team_has_mail_queues','user_has_teams','ut.UserId\x20=\x20?','push','toString','QueryTypes','SELECT','every','TeamId','includes','all','union','compact','isEmpty','removeAgents','userMailQueue:remove','addAgents','omit','spread','getAgents','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','papaparse','ioredis','../../components/parsers/qs'];(function(_0x317f53,_0x382f31){var _0x967376=function(_0x3f1d2a){while(--_0x3f1d2a){_0x317f53['push'](_0x317f53['shift']());}};_0x967376(++_0x382f31);}(_0xb842,0x76));var _0x2b84=function(_0xcfeda9,_0xd418ae){_0xcfeda9=_0xcfeda9-0x0;var _0x4826c7=_0xb842[_0xcfeda9];return _0x4826c7;};'use strict';var pdf=require(_0x2b84('0x0'));var emlformat=require(_0x2b84('0x1'));var rimraf=require(_0x2b84('0x2'));var zipdir=require(_0x2b84('0x3'));var jsonpatch=require(_0x2b84('0x4'));var rp=require(_0x2b84('0x5'));var moment=require(_0x2b84('0x6'));var BPromise=require(_0x2b84('0x7'));var Mustache=require(_0x2b84('0x8'));var util=require(_0x2b84('0x9'));var path=require(_0x2b84('0xa'));var sox=require(_0x2b84('0xb'));var csv=require('to-csv');var ejs=require(_0x2b84('0xc'));var fs=require('fs');var _=require(_0x2b84('0xd'));var squel=require(_0x2b84('0xe'));var crypto=require(_0x2b84('0xf'));var jsforce=require(_0x2b84('0x10'));var deskjs=require(_0x2b84('0x11'));var toCsv=require('to-csv');var querystring=require(_0x2b84('0x12'));var Papa=require(_0x2b84('0x13'));var Redis=require(_0x2b84('0x14'));var authService=require('../../components/auth/service');var qs=require(_0x2b84('0x15'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x2b84('0x16'))(_0x2b84('0x17'));var utils=require(_0x2b84('0x18'));var config=require('../../config/environment');var db=require(_0x2b84('0x19'))['db'];config[_0x2b84('0x1a')]=_['defaults'](config[_0x2b84('0x1a')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0x2b84('0x1b'))['register'](socket);function respondWithStatusCode(_0xc60a67,_0x291dd2){_0x291dd2=_0x291dd2||0xcc;return function(_0xb65add){if(_0xb65add){return _0xc60a67[_0x2b84('0x1c')](_0x291dd2);}return _0xc60a67[_0x2b84('0x1d')](_0x291dd2)[_0x2b84('0x1e')]();};}function respondWithResult(_0x21582,_0x3beffc){_0x3beffc=_0x3beffc||0xc8;return function(_0x20fc21){if(_0x20fc21){return _0x21582['status'](_0x3beffc)[_0x2b84('0x1f')](_0x20fc21);}};}function respondWithFilteredResult(_0x54ad6e,_0x4d5acb){return function(_0x3e38b3){if(_0x3e38b3){var _0x46ae72=_0x3e38b3[_0x2b84('0x20')],_0x3d3cf1=_0x4d5acb[_0x2b84('0x21')],_0x468e48=_0x4d5acb[_0x2b84('0x21')]+_0x4d5acb['limit'],_0x3cd42a;if(_0x468e48>=_0x46ae72){_0x468e48=_0x46ae72;_0x3cd42a=0xc8;}else{_0x3cd42a=0xce;}_0x54ad6e['status'](_0x3cd42a);return _0x54ad6e['set'](_0x2b84('0x22'),_0x3d3cf1+'-'+_0x468e48+'/'+_0x46ae72)['json'](_0x3e38b3);}return null;};}function patchUpdates(_0x5a9929){return function(_0x1f5c21){try{jsonpatch['apply'](_0x1f5c21,_0x5a9929,!![]);}catch(_0x1eff33){return BPromise[_0x2b84('0x23')](_0x1eff33);}return _0x1f5c21[_0x2b84('0x24')]();};}function saveUpdates(_0x164b82,_0xd2f4ff){return function(_0xabb9cd){if(_0xabb9cd){return _0xabb9cd[_0x2b84('0x25')](_0x164b82)['then'](function(_0x1898c6){return _0x1898c6;});}return null;};}function removeEntity(_0x36b2fb,_0x3cdce5){return function(_0x3d68fb){if(_0x3d68fb){return _0x3d68fb[_0x2b84('0x26')]()['then'](function(){var _0x5cc22f=_0x3d68fb['get']({'plain':!![]});var _0x48c98c=_0x2b84('0x27');return db[_0x2b84('0x28')]['destroy']({'where':{'type':_0x48c98c,'resourceId':_0x5cc22f['id']}})['then'](function(){return _0x3d68fb;});})[_0x2b84('0x29')](function(){_0x36b2fb['status'](0xcc)[_0x2b84('0x1e')]();});}};}function handleEntityNotFound(_0x54b48c,_0x158eb6){return function(_0x19d08c){if(!_0x19d08c){_0x54b48c[_0x2b84('0x1c')](0x194);}return _0x19d08c;};}function handleError(_0x705bdb,_0x3166f6){_0x3166f6=_0x3166f6||0x1f4;return function(_0x19a163){logger['error'](_0x19a163[_0x2b84('0x2a')]);if(_0x19a163[_0x2b84('0x2b')]){delete _0x19a163[_0x2b84('0x2b')];}_0x705bdb[_0x2b84('0x1d')](_0x3166f6)[_0x2b84('0x2c')](_0x19a163);};}exports[_0x2b84('0x2d')]=function(_0x106e45,_0x200243){var _0xfb18d1={},_0x5ee04a={},_0x4a95f8={'count':0x0,'rows':[]};var _0x4cdd53=_['map'](db[_0x2b84('0x2e')][_0x2b84('0x2f')],function(_0x555047){return{'name':_0x555047[_0x2b84('0x30')],'type':_0x555047[_0x2b84('0x31')][_0x2b84('0x32')]};});_0x5ee04a['model']=_[_0x2b84('0x33')](_0x4cdd53,_0x2b84('0x2b'));_0x5ee04a['query']=_['keys'](_0x106e45['query']);_0x5ee04a[_0x2b84('0x34')]=_[_0x2b84('0x35')](_0x5ee04a[_0x2b84('0x36')],_0x5ee04a['query']);_0xfb18d1['attributes']=_[_0x2b84('0x35')](_0x5ee04a[_0x2b84('0x36')],qs[_0x2b84('0x37')](_0x106e45[_0x2b84('0x38')][_0x2b84('0x37')]));_0xfb18d1[_0x2b84('0x39')]=_0xfb18d1[_0x2b84('0x39')][_0x2b84('0x3a')]?_0xfb18d1[_0x2b84('0x39')]:_0x5ee04a[_0x2b84('0x36')];if(!_0x106e45[_0x2b84('0x38')][_0x2b84('0x3b')](_0x2b84('0x3c'))){_0xfb18d1[_0x2b84('0x3d')]=qs[_0x2b84('0x3d')](_0x106e45['query'][_0x2b84('0x3d')]);_0xfb18d1[_0x2b84('0x21')]=qs[_0x2b84('0x21')](_0x106e45[_0x2b84('0x38')]['offset']);}_0xfb18d1[_0x2b84('0x3e')]=qs[_0x2b84('0x3f')](_0x106e45[_0x2b84('0x38')][_0x2b84('0x3f')]);_0xfb18d1[_0x2b84('0x40')]=qs[_0x2b84('0x34')](_['pick'](_0x106e45[_0x2b84('0x38')],_0x5ee04a[_0x2b84('0x34')]));if(_0x106e45[_0x2b84('0x38')]['filter']){_0xfb18d1[_0x2b84('0x40')]=_['merge'](_0xfb18d1['where'],{'$or':_[_0x2b84('0x33')](_0x4cdd53,function(_0x41b642){if(_0x41b642['type']!==_0x2b84('0x41')){var _0xc58f98={};_0xc58f98[_0x41b642['name']]={'$like':'%'+_0x106e45[_0x2b84('0x38')]['filter']+'%'};return _0xc58f98;}})});}_0xfb18d1=_[_0x2b84('0x42')]({},_0xfb18d1,_0x106e45[_0x2b84('0x43')]);var _0x3e7ecf={'where':_0xfb18d1[_0x2b84('0x40')]};return db[_0x2b84('0x2e')]['count'](_0x3e7ecf)[_0x2b84('0x29')](function(_0x5c9b0c){_0x4a95f8[_0x2b84('0x20')]=_0x5c9b0c;if(_0x106e45['query'][_0x2b84('0x44')]){_0xfb18d1[_0x2b84('0x45')]=[{'all':!![]}];}return db[_0x2b84('0x2e')][_0x2b84('0x46')](_0xfb18d1);})[_0x2b84('0x29')](function(_0x4f20c9){_0x4a95f8[_0x2b84('0x47')]=_0x4f20c9;return _0x4a95f8;})[_0x2b84('0x29')](respondWithFilteredResult(_0x200243,_0xfb18d1))[_0x2b84('0x48')](handleError(_0x200243,null));};exports[_0x2b84('0x49')]=function(_0x531675,_0x4879d7){var _0x5e1ce8={'raw':!![],'where':{'id':_0x531675[_0x2b84('0x4a')]['id']}},_0x365761={};_0x365761['model']=_[_0x2b84('0x4b')](db[_0x2b84('0x2e')][_0x2b84('0x2f')]);_0x365761[_0x2b84('0x38')]=_['keys'](_0x531675[_0x2b84('0x38')]);_0x365761['filters']=_['intersection'](_0x365761['model'],_0x365761[_0x2b84('0x38')]);_0x5e1ce8[_0x2b84('0x39')]=_[_0x2b84('0x35')](_0x365761[_0x2b84('0x36')],qs[_0x2b84('0x37')](_0x531675[_0x2b84('0x38')]['fields']));_0x5e1ce8[_0x2b84('0x39')]=_0x5e1ce8['attributes']['length']?_0x5e1ce8['attributes']:_0x365761[_0x2b84('0x36')];if(_0x531675[_0x2b84('0x38')]['includeAll']){_0x5e1ce8[_0x2b84('0x45')]=[{'all':!![]}];}_0x5e1ce8=_[_0x2b84('0x42')]({},_0x5e1ce8,_0x531675[_0x2b84('0x43')]);return db['MailQueue'][_0x2b84('0x4c')](_0x5e1ce8)[_0x2b84('0x29')](handleEntityNotFound(_0x4879d7,null))[_0x2b84('0x29')](respondWithResult(_0x4879d7,null))[_0x2b84('0x48')](handleError(_0x4879d7,null));};exports[_0x2b84('0x4d')]=function(_0x3f52a2,_0x1460db){return db[_0x2b84('0x2e')][_0x2b84('0x4d')](_0x3f52a2[_0x2b84('0x4e')],{})[_0x2b84('0x29')](function(_0x47f018){var _0x3d901c=_0x3f52a2['user'][_0x2b84('0x4f')]({'plain':!![]});if(!_0x3d901c)throw new Error(_0x2b84('0x50'));if(_0x3d901c[_0x2b84('0x51')]===_0x2b84('0x52')){var _0x1ca55e=_0x47f018[_0x2b84('0x4f')]({'plain':!![]});var _0x1076f8=_0x2b84('0x27');return db['UserProfileSection'][_0x2b84('0x4c')]({'where':{'name':_0x1076f8,'userProfileId':_0x3d901c['userProfileId']},'raw':!![]})['then'](function(_0x1b0187){if(_0x1b0187&&_0x1b0187[_0x2b84('0x53')]===0x0){return db['UserProfileResource']['create']({'name':_0x1ca55e[_0x2b84('0x2b')],'resourceId':_0x1ca55e['id'],'type':_0x1b0187[_0x2b84('0x2b')],'sectionId':_0x1b0187['id']},{})[_0x2b84('0x29')](function(){return _0x47f018;});}else{return _0x47f018;}})['catch'](function(_0x5bbd7c){logger['error'](_0x2b84('0x54'),_0x5bbd7c);throw _0x5bbd7c;});}return _0x47f018;})['then'](respondWithResult(_0x1460db,0xc9))['catch'](handleError(_0x1460db,null));};exports[_0x2b84('0x25')]=function(_0x491a80,_0x21c91d){if(_0x491a80[_0x2b84('0x4e')]['id']){delete _0x491a80[_0x2b84('0x4e')]['id'];}return db[_0x2b84('0x2e')][_0x2b84('0x4c')]({'where':{'id':_0x491a80[_0x2b84('0x4a')]['id']}})[_0x2b84('0x29')](handleEntityNotFound(_0x21c91d,null))[_0x2b84('0x29')](saveUpdates(_0x491a80[_0x2b84('0x4e')],null))[_0x2b84('0x29')](respondWithResult(_0x21c91d,null))[_0x2b84('0x48')](handleError(_0x21c91d,null));};exports['destroy']=function(_0x851e8,_0xe5d46e){return db[_0x2b84('0x2e')][_0x2b84('0x4c')]({'where':{'id':_0x851e8[_0x2b84('0x4a')]['id']}})[_0x2b84('0x29')](handleEntityNotFound(_0xe5d46e,null))[_0x2b84('0x29')](removeEntity(_0xe5d46e,null))['catch'](handleError(_0xe5d46e,null));};exports[_0x2b84('0x55')]=function(_0x3585a1,_0x4e34d4){return db[_0x2b84('0x2e')][_0x2b84('0x55')]()[_0x2b84('0x29')](respondWithResult(_0x4e34d4,null))[_0x2b84('0x48')](handleError(_0x4e34d4,null));};exports[_0x2b84('0x56')]=function(_0x324375,_0x25b881,_0x24c36d){var _0x195d45={'raw':!![],'where':{}},_0x4b4fac={},_0x569f88;return db[_0x2b84('0x2e')][_0x2b84('0x57')]({'where':{'id':_0x324375['params']['id']}})[_0x2b84('0x29')](handleEntityNotFound(_0x25b881,null))['then'](function(_0x3c1033){if(_0x3c1033){_0x569f88=_0x3c1033[_0x2b84('0x4f')]({'plain':!![]});_0x4b4fac['model']=_[_0x2b84('0x4b')](db[_0x2b84('0x58')][_0x2b84('0x2f')]);_0x4b4fac[_0x2b84('0x38')]=_[_0x2b84('0x4b')](_0x324375['query']);_0x4b4fac['filters']=_['intersection'](_0x4b4fac[_0x2b84('0x36')],_0x4b4fac[_0x2b84('0x38')]);_0x195d45['attributes']=_[_0x2b84('0x35')](_0x4b4fac[_0x2b84('0x36')],qs['fields'](_0x324375['query'][_0x2b84('0x37')]));_0x195d45[_0x2b84('0x39')]=_0x195d45[_0x2b84('0x39')][_0x2b84('0x3a')]?_0x195d45[_0x2b84('0x39')]:_0x4b4fac[_0x2b84('0x36')];if(!_0x324375[_0x2b84('0x38')][_0x2b84('0x3b')](_0x2b84('0x3c'))){_0x195d45[_0x2b84('0x3d')]=qs['limit'](_0x324375[_0x2b84('0x38')]['limit']);_0x195d45['offset']=qs[_0x2b84('0x21')](_0x324375[_0x2b84('0x38')][_0x2b84('0x21')]);}_0x195d45[_0x2b84('0x3e')]=qs[_0x2b84('0x3f')](_0x324375[_0x2b84('0x38')][_0x2b84('0x3f')]);_0x195d45[_0x2b84('0x40')]=qs[_0x2b84('0x34')](_[_0x2b84('0x59')](_0x324375[_0x2b84('0x38')],_0x4b4fac[_0x2b84('0x34')]));_0x195d45[_0x2b84('0x40')]['MailQueueId']=_0x3c1033['id'];if(_0x324375[_0x2b84('0x38')]['filter']){_0x195d45[_0x2b84('0x40')]=_[_0x2b84('0x42')](_0x195d45[_0x2b84('0x40')],{'$or':_[_0x2b84('0x33')](_0x195d45[_0x2b84('0x39')],function(_0x71039e){var _0x50549d={};_0x50549d[_0x71039e]={'$like':'%'+_0x324375['query'][_0x2b84('0x5a')]+'%'};return _0x50549d;})});}_0x195d45=_[_0x2b84('0x42')]({},_0x195d45,_0x324375['options']);return db[_0x2b84('0x58')][_0x2b84('0x46')](_0x195d45);}})[_0x2b84('0x29')](function(_0x16b01b){if(_0x16b01b){return db[_0x2b84('0x5b')][_0x2b84('0x5c')]({'where':{'id':_['map'](_0x16b01b,_0x2b84('0x5d')),'role':_0x2b84('0x5e')},'attributes':['id',_0x2b84('0x2b'),_0x2b84('0x5f'),_0x2b84('0x60'),'createdAt']});}})[_0x2b84('0x29')](function(_0x121c51){if(_0x121c51){return{'count':_0x121c51[_0x2b84('0x20')],'rows':_[_0x2b84('0x33')](_0x121c51[_0x2b84('0x47')],function(_0x530e76){return{'membername':_0x530e76['name'],'UserId':_0x530e76['id'],'queue_name':_0x569f88[_0x2b84('0x2b')],'MailQueueId':_0x569f88['id'],'interface':util[_0x2b84('0x61')](_0x2b84('0x62'),_0x2b84('0x63'),_0x530e76['name']),'penalty':0x0,'paused':_0x530e76[_0x2b84('0x5f')],'createdAt':_0x530e76[_0x2b84('0x64')],'updatedAt':_0x530e76['updatedAt']};})};}else{return{'count':0x0,'rows':[]};}})['then'](respondWithFilteredResult(_0x25b881,_0x195d45))[_0x2b84('0x48')](handleError(_0x25b881,null));};exports[_0x2b84('0x65')]=function(_0x4753b5,_0x566c63,_0x4bf2f9){var _0x7c8bb4={};var _0x52f3a6={};var _0x46814c;var _0x299c12;return db[_0x2b84('0x2e')][_0x2b84('0x57')]({'where':{'id':_0x4753b5[_0x2b84('0x4a')]['id']}})[_0x2b84('0x29')](handleEntityNotFound(_0x566c63,null))['then'](function(_0x2d36b2){if(_0x2d36b2){_0x46814c=_0x2d36b2;_0x52f3a6['model']=_['keys'](db[_0x2b84('0x66')][_0x2b84('0x2f')]);_0x52f3a6['query']=_[_0x2b84('0x4b')](_0x4753b5[_0x2b84('0x38')]);_0x52f3a6[_0x2b84('0x34')]=_[_0x2b84('0x35')](_0x52f3a6[_0x2b84('0x36')],_0x52f3a6['query']);_0x7c8bb4[_0x2b84('0x39')]=_[_0x2b84('0x35')](_0x52f3a6['model'],qs[_0x2b84('0x37')](_0x4753b5[_0x2b84('0x38')]['fields']));_0x7c8bb4[_0x2b84('0x39')]=_0x7c8bb4['attributes'][_0x2b84('0x3a')]?_0x7c8bb4[_0x2b84('0x39')]:_0x52f3a6[_0x2b84('0x36')];_0x7c8bb4[_0x2b84('0x3e')]=qs['sort'](_0x4753b5[_0x2b84('0x38')][_0x2b84('0x3f')]);_0x7c8bb4[_0x2b84('0x40')]=qs[_0x2b84('0x34')](_['pick'](_0x4753b5[_0x2b84('0x38')],_0x52f3a6[_0x2b84('0x34')]));if(_0x4753b5['query']['filter']){_0x7c8bb4[_0x2b84('0x40')]=_[_0x2b84('0x42')](_0x7c8bb4[_0x2b84('0x40')],{'$or':_[_0x2b84('0x33')](_0x7c8bb4['attributes'],function(_0x4d8853){var _0x4629c8={};_0x4629c8[_0x4d8853]={'$like':'%'+_0x4753b5[_0x2b84('0x38')][_0x2b84('0x5a')]+'%'};return _0x4629c8;})});}_0x7c8bb4=_[_0x2b84('0x42')]({},_0x7c8bb4,_0x4753b5['options']);return _0x46814c[_0x2b84('0x65')](_0x7c8bb4);}})[_0x2b84('0x29')](function(_0x5c56db){if(_0x5c56db){_0x299c12=_0x5c56db['length'];if(!_0x4753b5['query'][_0x2b84('0x3b')](_0x2b84('0x3c'))){_0x7c8bb4[_0x2b84('0x3d')]=qs[_0x2b84('0x3d')](_0x4753b5[_0x2b84('0x38')][_0x2b84('0x3d')]);_0x7c8bb4['offset']=qs[_0x2b84('0x21')](_0x4753b5[_0x2b84('0x38')][_0x2b84('0x21')]);}return _0x46814c[_0x2b84('0x65')](_0x7c8bb4);}})[_0x2b84('0x29')](function(_0x3c1315){if(_0x3c1315){return _0x3c1315?{'count':_0x299c12,'rows':_0x3c1315}:null;}})['then'](respondWithResult(_0x566c63,null))[_0x2b84('0x48')](handleError(_0x566c63,null));};exports[_0x2b84('0x67')]=function(_0x22095a,_0x35017f,_0x2226c4){var _0x4ba62d=_0x22095a['body'][_0x2b84('0x68')];return db['Team']['findAll']({'where':{'id':_0x4ba62d},'attributes':['id'],'include':[{'model':db[_0x2b84('0x5b')],'as':_0x2b84('0x69'),'attributes':['id','name','online',_0x2b84('0x6a'),_0x2b84('0x6b')],'raw':!![]}]})[_0x2b84('0x29')](function(_0x9e7991){if(_0x9e7991){var _0x426de3=_['flatMap'](_0x9e7991,function(_0xec35d6){var _0x4fa6fa=_0xec35d6['get']({'plain':!![]});return _0x4fa6fa['Agents'];});return db[_0x2b84('0x2e')]['find']({'where':{'id':_0x22095a[_0x2b84('0x4a')]['id']}})[_0x2b84('0x29')](function(_0x54ade3){return db[_0x2b84('0x6c')][_0x2b84('0x6d')](function(_0x1a302a){return _0x54ade3[_0x2b84('0x67')](_0x4ba62d,{'transaction':_0x1a302a})['then'](function(){return BPromise[_0x2b84('0x6e')](_0x426de3,function(_0x564bb6){return db['UserMailQueue'][_0x2b84('0x6f')]({'where':{'UserId':_0x564bb6['id'],'MailQueueId':_0x22095a[_0x2b84('0x4a')]['id']},'transaction':_0x1a302a});});})[_0x2b84('0x29')](function(){_0x426de3[_0x2b84('0x70')](function(_0x21127e){socket[_0x2b84('0x71')](_0x2b84('0x72'),{'UserId':_0x21127e['id'],'MailQueueId':_0x54ade3['id']});});});});});}})[_0x2b84('0x29')](respondWithStatusCode(_0x35017f,null))[_0x2b84('0x48')](handleError(_0x35017f,null));};exports[_0x2b84('0x73')]=function(_0x34e858,_0x2ad4af,_0x81f553){return db[_0x2b84('0x66')]['findAll']({'where':{'id':_0x34e858[_0x2b84('0x38')][_0x2b84('0x68')]},'attributes':['id'],'include':[{'model':db['User'],'as':'Agents','attributes':['id'],'raw':!![]}]})[_0x2b84('0x29')](handleEntityNotFound(_0x2ad4af,null))['then'](function(_0x3774b9){var _0x52c988=_[_0x2b84('0x33')](_0x3774b9,'id');var _0x4adcc9=[];var _0x2855b9=[];var _0x33d20e=squel[_0x2b84('0x74')]();_0x33d20e[_0x2b84('0x75')](_0x2b84('0x76'))[_0x2b84('0x77')](_0x2b84('0x78'),'tq')['join'](_0x2b84('0x79'),'ut','ut.TeamId\x20=\x20tq.TeamId')[_0x2b84('0x40')]('MailQueueId\x20=\x20?',_0x34e858[_0x2b84('0x4a')]['id']);for(var _0x5df0e4=0x0;_0x5df0e4<_0x3774b9['length'];_0x5df0e4+=0x1){let _0x45b9ef=_0x3774b9[_0x5df0e4];for(var _0x55fe1c=0x0;_0x55fe1c<_0x45b9ef[_0x2b84('0x69')][_0x2b84('0x3a')];_0x55fe1c+=0x1){let _0x4faf68=_0x45b9ef[_0x2b84('0x69')][_0x55fe1c];var _0x580929=_0x33d20e['clone']();_0x580929[_0x2b84('0x40')](_0x2b84('0x7a'),_0x4faf68['id']);_0x2855b9[_0x2b84('0x7b')](db[_0x2b84('0x6c')][_0x2b84('0x38')](_0x580929[_0x2b84('0x7c')](),{'type':db[_0x2b84('0x6c')][_0x2b84('0x7d')][_0x2b84('0x7e')]})[_0x2b84('0x29')](function(_0x449c22){if(_0x449c22[_0x2b84('0x3a')]===0x1){return _0x4faf68['id'];}else{var _0x3b9f27=_[_0x2b84('0x7f')](_['map'](_0x449c22,_0x2b84('0x80')),function(_0x3bfeed){return _[_0x2b84('0x81')](_0x52c988,_0x3bfeed);});if(_0x3b9f27){return _0x4faf68['id'];}}}));}}return BPromise[_0x2b84('0x82')](_0x2855b9)[_0x2b84('0x29')](function(_0x5ee3f2){_0x4adcc9=_(_0x4adcc9)[_0x2b84('0x83')](_0x5ee3f2)[_0x2b84('0x84')]()['value']();return db[_0x2b84('0x2e')][_0x2b84('0x4c')]({'where':{'id':_0x34e858['params']['id']}})[_0x2b84('0x29')](function(_0x19019e){return db[_0x2b84('0x6c')][_0x2b84('0x6d')](function(_0x2dc273){return _0x19019e['removeTeams'](_0x34e858[_0x2b84('0x38')][_0x2b84('0x68')],{'transaction':_0x2dc273})[_0x2b84('0x29')](function(){if(!_[_0x2b84('0x85')](_0x4adcc9)){return _0x19019e[_0x2b84('0x86')](_0x4adcc9,{'transaction':_0x2dc273});}})[_0x2b84('0x29')](function(){_0x4adcc9[_0x2b84('0x70')](function(_0x557d72){socket[_0x2b84('0x71')](_0x2b84('0x87'),{'UserId':_0x557d72,'MailQueueId':_0x19019e['id']});});});});});});})[_0x2b84('0x29')](respondWithStatusCode(_0x2ad4af,null))[_0x2b84('0x48')](handleError(_0x2ad4af,null));};exports[_0x2b84('0x88')]=function(_0x3ff6ea,_0x359d3a,_0x2480b2){return db[_0x2b84('0x2e')][_0x2b84('0x4c')]({'where':{'id':_0x3ff6ea['params']['id']}})['then'](handleEntityNotFound(_0x359d3a,null))[_0x2b84('0x29')](function(_0xc1e2e3){if(_0xc1e2e3){return _0xc1e2e3['addAgents'](_0x3ff6ea[_0x2b84('0x4e')][_0x2b84('0x68')],_[_0x2b84('0x89')](_0x3ff6ea[_0x2b84('0x4e')],['ids','id'])||{})[_0x2b84('0x8a')](function(_0x2cc5f2){for(var _0x185ec2=0x0;_0x185ec2<_0x3ff6ea[_0x2b84('0x4e')][_0x2b84('0x68')][_0x2b84('0x3a')];_0x185ec2+=0x1){socket['emit'](_0x2b84('0x72'),{'UserId':_0x3ff6ea[_0x2b84('0x4e')][_0x2b84('0x68')][_0x185ec2],'MailQueueId':_0x3ff6ea[_0x2b84('0x4a')]['id']});}return _0x2cc5f2;});}})['then'](respondWithResult(_0x359d3a,null))[_0x2b84('0x48')](handleError(_0x359d3a,null));};exports[_0x2b84('0x86')]=function(_0x18727c,_0x26f612,_0x3d9b2b){return db[_0x2b84('0x2e')][_0x2b84('0x4c')]({'where':{'id':_0x18727c[_0x2b84('0x4a')]['id']}})['then'](handleEntityNotFound(_0x26f612,null))[_0x2b84('0x29')](function(_0x25d1e7){if(_0x25d1e7){return _0x25d1e7[_0x2b84('0x86')](_0x18727c['query'][_0x2b84('0x68')])['then'](function(){if(_['isArray'](_0x18727c[_0x2b84('0x38')][_0x2b84('0x68')])){for(var _0x6166c5=0x0;_0x6166c5<_0x18727c[_0x2b84('0x38')]['ids'][_0x2b84('0x3a')];_0x6166c5+=0x1){socket[_0x2b84('0x71')](_0x2b84('0x87'),{'UserId':Number(_0x18727c[_0x2b84('0x38')][_0x2b84('0x68')][_0x6166c5]),'MailQueueId':Number(_0x18727c[_0x2b84('0x4a')]['id'])});}}else{socket[_0x2b84('0x71')](_0x2b84('0x87'),{'UserId':Number(_0x18727c[_0x2b84('0x38')]['ids']),'MailQueueId':Number(_0x18727c[_0x2b84('0x4a')]['id'])});}});}})['then'](respondWithStatusCode(_0x26f612,null))[_0x2b84('0x48')](handleError(_0x26f612,null));};exports[_0x2b84('0x8b')]=function(_0x514d67,_0x407f06,_0x506d8b){var _0x1c8108={};var _0x15f864={};var _0xf8c0db;var _0x265259;return db[_0x2b84('0x2e')][_0x2b84('0x57')]({'where':{'id':_0x514d67['params']['id']}})[_0x2b84('0x29')](handleEntityNotFound(_0x407f06,null))[_0x2b84('0x29')](function(_0xcd2c4c){if(_0xcd2c4c){_0xf8c0db=_0xcd2c4c;_0x15f864[_0x2b84('0x36')]=_[_0x2b84('0x4b')](db['User'][_0x2b84('0x2f')]);_0x15f864[_0x2b84('0x38')]=_[_0x2b84('0x4b')](_0x514d67[_0x2b84('0x38')]);_0x15f864[_0x2b84('0x34')]=_[_0x2b84('0x35')](_0x15f864[_0x2b84('0x36')],_0x15f864[_0x2b84('0x38')]);_0x1c8108[_0x2b84('0x39')]=_[_0x2b84('0x35')](_0x15f864[_0x2b84('0x36')],qs[_0x2b84('0x37')](_0x514d67[_0x2b84('0x38')][_0x2b84('0x37')]));_0x1c8108[_0x2b84('0x39')]=_0x1c8108['attributes'][_0x2b84('0x3a')]?_0x1c8108[_0x2b84('0x39')]:_0x15f864['model'];_0x1c8108[_0x2b84('0x3e')]=qs[_0x2b84('0x3f')](_0x514d67[_0x2b84('0x38')][_0x2b84('0x3f')]);_0x1c8108[_0x2b84('0x40')]=qs[_0x2b84('0x34')](_[_0x2b84('0x59')](_0x514d67[_0x2b84('0x38')],_0x15f864['filters']));if(_0x514d67[_0x2b84('0x38')][_0x2b84('0x5a')]){_0x1c8108['where']=_[_0x2b84('0x42')](_0x1c8108[_0x2b84('0x40')],{'$or':_[_0x2b84('0x33')](_0x1c8108[_0x2b84('0x39')],function(_0x19b7ad){var _0x1debfe={};_0x1debfe[_0x19b7ad]={'$like':'%'+_0x514d67[_0x2b84('0x38')][_0x2b84('0x5a')]+'%'};return _0x1debfe;})});}_0x1c8108=_[_0x2b84('0x42')]({},_0x1c8108,_0x514d67['options']);return _0xf8c0db[_0x2b84('0x8b')](_0x1c8108);}})[_0x2b84('0x29')](function(_0x1fd3c8){if(_0x1fd3c8){_0x265259=_0x1fd3c8['length'];if(!_0x514d67['query'][_0x2b84('0x3b')](_0x2b84('0x3c'))){_0x1c8108[_0x2b84('0x3d')]=qs[_0x2b84('0x3d')](_0x514d67[_0x2b84('0x38')][_0x2b84('0x3d')]);_0x1c8108[_0x2b84('0x21')]=qs['offset'](_0x514d67[_0x2b84('0x38')][_0x2b84('0x21')]);}return _0xf8c0db['getAgents'](_0x1c8108);}})[_0x2b84('0x29')](function(_0x5c6d75){if(_0x5c6d75){return _0x5c6d75?{'count':_0x265259,'rows':_0x5c6d75}:null;}})[_0x2b84('0x29')](respondWithResult(_0x407f06,null))['catch'](handleError(_0x407f06,null));}; \ No newline at end of file +var _0x404d=['model','query','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','then','includeAll','findAll','rows','catch','show','params','keys','rawAttributes','include','options','find','create','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','autoAssociation','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','describe','getMembers','UserMailQueue','MailQueueId','findAndCountAll','agent','mailPause','createdAt','%s/%s','updatedAt','getTeams','findOne','Team','addTeams','User','online','voicePause','interface','Agents','sequelize','transaction','each','findOrCreate','forEach','emit','userMailQueue:save','ids','select','tq.TeamId','from','team_has_mail_queues','user_has_teams','MailQueueId\x20=\x20?','clone','push','toString','QueryTypes','SELECT','every','all','union','compact','isEmpty','removeAgents','userMailQueue:remove','addAgents','omit','spread','isArray','getAgents','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','util','to-csv','lodash','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','redis','localhost','socket.io-emitter','./mailQueue.socket','register','sendStatus','status','end','json','count','offset','limit','set','Content-Range','reject','save','update','destroy','MailQueues','UserProfileResource','stack','name','send','index','map','MailQueue','type','key'];(function(_0x692694,_0x442635){var _0x54e774=function(_0x7ebb74){while(--_0x7ebb74){_0x692694['push'](_0x692694['shift']());}};_0x54e774(++_0x442635);}(_0x404d,0x1f2));var _0xd404=function(_0x3325f9,_0xd2e222){_0x3325f9=_0x3325f9-0x0;var _0x35331d=_0x404d[_0x3325f9];return _0x35331d;};'use strict';var pdf=require(_0xd404('0x0'));var emlformat=require(_0xd404('0x1'));var rimraf=require(_0xd404('0x2'));var zipdir=require(_0xd404('0x3'));var jsonpatch=require(_0xd404('0x4'));var rp=require(_0xd404('0x5'));var moment=require('moment');var BPromise=require(_0xd404('0x6'));var Mustache=require('mustache');var util=require(_0xd404('0x7'));var path=require('path');var sox=require('sox');var csv=require(_0xd404('0x8'));var ejs=require('ejs');var fs=require('fs');var _=require(_0xd404('0x9'));var squel=require(_0xd404('0xa'));var crypto=require(_0xd404('0xb'));var jsforce=require(_0xd404('0xc'));var deskjs=require('desk.js');var toCsv=require(_0xd404('0x8'));var querystring=require(_0xd404('0xd'));var Papa=require(_0xd404('0xe'));var Redis=require(_0xd404('0xf'));var authService=require('../../components/auth/service');var qs=require(_0xd404('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0xd404('0x11'))(_0xd404('0x12'));var utils=require(_0xd404('0x13'));var config=require(_0xd404('0x14'));var db=require(_0xd404('0x15'))['db'];config[_0xd404('0x16')]=_['defaults'](config[_0xd404('0x16')],{'host':_0xd404('0x17'),'port':0x18eb});var socket=require(_0xd404('0x18'))(new Redis(config[_0xd404('0x16')]));require(_0xd404('0x19'))[_0xd404('0x1a')](socket);function respondWithStatusCode(_0x1985b1,_0x1f88c2){_0x1f88c2=_0x1f88c2||0xcc;return function(_0x466991){if(_0x466991){return _0x1985b1[_0xd404('0x1b')](_0x1f88c2);}return _0x1985b1[_0xd404('0x1c')](_0x1f88c2)[_0xd404('0x1d')]();};}function respondWithResult(_0x4eea76,_0x472076){_0x472076=_0x472076||0xc8;return function(_0x12c1e3){if(_0x12c1e3){return _0x4eea76[_0xd404('0x1c')](_0x472076)[_0xd404('0x1e')](_0x12c1e3);}};}function respondWithFilteredResult(_0x3dd581,_0x55d7d5){return function(_0x586fe4){if(_0x586fe4){var _0x2c1b5e=_0x586fe4[_0xd404('0x1f')],_0x5ceea7=_0x55d7d5[_0xd404('0x20')],_0x2577d3=_0x55d7d5[_0xd404('0x20')]+_0x55d7d5[_0xd404('0x21')],_0x2e37d9;if(_0x2577d3>=_0x2c1b5e){_0x2577d3=_0x2c1b5e;_0x2e37d9=0xc8;}else{_0x2e37d9=0xce;}_0x3dd581['status'](_0x2e37d9);return _0x3dd581[_0xd404('0x22')](_0xd404('0x23'),_0x5ceea7+'-'+_0x2577d3+'/'+_0x2c1b5e)[_0xd404('0x1e')](_0x586fe4);}return null;};}function patchUpdates(_0x798cd4){return function(_0x461fa6){try{jsonpatch['apply'](_0x461fa6,_0x798cd4,!![]);}catch(_0x17dafc){return BPromise[_0xd404('0x24')](_0x17dafc);}return _0x461fa6[_0xd404('0x25')]();};}function saveUpdates(_0x5aee73,_0xd972c4){return function(_0x58928e){if(_0x58928e){return _0x58928e[_0xd404('0x26')](_0x5aee73)['then'](function(_0x416a3d){return _0x416a3d;});}return null;};}function removeEntity(_0x317157,_0x523102){return function(_0x2e532c){if(_0x2e532c){return _0x2e532c[_0xd404('0x27')]()['then'](function(){var _0xbf6745=_0x2e532c['get']({'plain':!![]});var _0x3dfe22=_0xd404('0x28');return db[_0xd404('0x29')][_0xd404('0x27')]({'where':{'type':_0x3dfe22,'resourceId':_0xbf6745['id']}})['then'](function(){return _0x2e532c;});})['then'](function(){_0x317157[_0xd404('0x1c')](0xcc)[_0xd404('0x1d')]();});}};}function handleEntityNotFound(_0x32a440,_0x4cf6c3){return function(_0x4b36e0){if(!_0x4b36e0){_0x32a440[_0xd404('0x1b')](0x194);}return _0x4b36e0;};}function handleError(_0x47d12d,_0x48403b){_0x48403b=_0x48403b||0x1f4;return function(_0x93fe39){logger['error'](_0x93fe39[_0xd404('0x2a')]);if(_0x93fe39[_0xd404('0x2b')]){delete _0x93fe39[_0xd404('0x2b')];}_0x47d12d['status'](_0x48403b)[_0xd404('0x2c')](_0x93fe39);};}exports[_0xd404('0x2d')]=function(_0x2e6f0a,_0x677898){var _0x286d12={},_0x16f96e={},_0x553a9b={'count':0x0,'rows':[]};var _0xa2ffea=_[_0xd404('0x2e')](db[_0xd404('0x2f')]['rawAttributes'],function(_0x1b28d6){return{'name':_0x1b28d6['fieldName'],'type':_0x1b28d6[_0xd404('0x30')][_0xd404('0x31')]};});_0x16f96e[_0xd404('0x32')]=_[_0xd404('0x2e')](_0xa2ffea,'name');_0x16f96e[_0xd404('0x33')]=_['keys'](_0x2e6f0a[_0xd404('0x33')]);_0x16f96e[_0xd404('0x34')]=_[_0xd404('0x35')](_0x16f96e[_0xd404('0x32')],_0x16f96e[_0xd404('0x33')]);_0x286d12['attributes']=_[_0xd404('0x35')](_0x16f96e['model'],qs[_0xd404('0x36')](_0x2e6f0a[_0xd404('0x33')][_0xd404('0x36')]));_0x286d12[_0xd404('0x37')]=_0x286d12[_0xd404('0x37')][_0xd404('0x38')]?_0x286d12[_0xd404('0x37')]:_0x16f96e[_0xd404('0x32')];if(!_0x2e6f0a[_0xd404('0x33')][_0xd404('0x39')](_0xd404('0x3a'))){_0x286d12[_0xd404('0x21')]=qs[_0xd404('0x21')](_0x2e6f0a[_0xd404('0x33')]['limit']);_0x286d12['offset']=qs[_0xd404('0x20')](_0x2e6f0a[_0xd404('0x33')][_0xd404('0x20')]);}_0x286d12[_0xd404('0x3b')]=qs[_0xd404('0x3c')](_0x2e6f0a[_0xd404('0x33')][_0xd404('0x3c')]);_0x286d12[_0xd404('0x3d')]=qs[_0xd404('0x34')](_[_0xd404('0x3e')](_0x2e6f0a[_0xd404('0x33')],_0x16f96e['filters']));if(_0x2e6f0a[_0xd404('0x33')][_0xd404('0x3f')]){_0x286d12[_0xd404('0x3d')]=_[_0xd404('0x40')](_0x286d12[_0xd404('0x3d')],{'$or':_['map'](_0xa2ffea,function(_0x2bf59b){if(_0x2bf59b[_0xd404('0x30')]!==_0xd404('0x41')){var _0x3d9794={};_0x3d9794[_0x2bf59b[_0xd404('0x2b')]]={'$like':'%'+_0x2e6f0a[_0xd404('0x33')][_0xd404('0x3f')]+'%'};return _0x3d9794;}})});}_0x286d12=_[_0xd404('0x40')]({},_0x286d12,_0x2e6f0a['options']);var _0x22c549={'where':_0x286d12[_0xd404('0x3d')]};return db[_0xd404('0x2f')][_0xd404('0x1f')](_0x22c549)[_0xd404('0x42')](function(_0x2523cc){_0x553a9b[_0xd404('0x1f')]=_0x2523cc;if(_0x2e6f0a['query'][_0xd404('0x43')]){_0x286d12['include']=[{'all':!![]}];}return db[_0xd404('0x2f')][_0xd404('0x44')](_0x286d12);})['then'](function(_0x343482){_0x553a9b[_0xd404('0x45')]=_0x343482;return _0x553a9b;})[_0xd404('0x42')](respondWithFilteredResult(_0x677898,_0x286d12))[_0xd404('0x46')](handleError(_0x677898,null));};exports[_0xd404('0x47')]=function(_0x59305d,_0x1efb0e){var _0x1b05d9={'raw':!![],'where':{'id':_0x59305d[_0xd404('0x48')]['id']}},_0x16f077={};_0x16f077[_0xd404('0x32')]=_[_0xd404('0x49')](db[_0xd404('0x2f')][_0xd404('0x4a')]);_0x16f077[_0xd404('0x33')]=_[_0xd404('0x49')](_0x59305d[_0xd404('0x33')]);_0x16f077[_0xd404('0x34')]=_[_0xd404('0x35')](_0x16f077[_0xd404('0x32')],_0x16f077['query']);_0x1b05d9[_0xd404('0x37')]=_[_0xd404('0x35')](_0x16f077['model'],qs[_0xd404('0x36')](_0x59305d[_0xd404('0x33')][_0xd404('0x36')]));_0x1b05d9[_0xd404('0x37')]=_0x1b05d9[_0xd404('0x37')][_0xd404('0x38')]?_0x1b05d9[_0xd404('0x37')]:_0x16f077[_0xd404('0x32')];if(_0x59305d[_0xd404('0x33')][_0xd404('0x43')]){_0x1b05d9[_0xd404('0x4b')]=[{'all':!![]}];}_0x1b05d9=_[_0xd404('0x40')]({},_0x1b05d9,_0x59305d[_0xd404('0x4c')]);return db[_0xd404('0x2f')][_0xd404('0x4d')](_0x1b05d9)['then'](handleEntityNotFound(_0x1efb0e,null))[_0xd404('0x42')](respondWithResult(_0x1efb0e,null))[_0xd404('0x46')](handleError(_0x1efb0e,null));};exports[_0xd404('0x4e')]=function(_0x59ff5c,_0x5e27e1){return db[_0xd404('0x2f')]['create'](_0x59ff5c['body'],{})[_0xd404('0x42')](function(_0x2da864){var _0x445cc6=_0x59ff5c[_0xd404('0x4f')][_0xd404('0x50')]({'plain':!![]});if(!_0x445cc6)throw new Error(_0xd404('0x51'));if(_0x445cc6[_0xd404('0x52')]===_0xd404('0x4f')){var _0x469d96=_0x2da864['get']({'plain':!![]});var _0x36665c=_0xd404('0x28');return db['UserProfileSection'][_0xd404('0x4d')]({'where':{'name':_0x36665c,'userProfileId':_0x445cc6['userProfileId']},'raw':!![]})[_0xd404('0x42')](function(_0x140718){if(_0x140718&&_0x140718[_0xd404('0x53')]===0x0){return db['UserProfileResource']['create']({'name':_0x469d96['name'],'resourceId':_0x469d96['id'],'type':_0x140718['name'],'sectionId':_0x140718['id']},{})[_0xd404('0x42')](function(){return _0x2da864;});}else{return _0x2da864;}})[_0xd404('0x46')](function(_0x1d014e){logger[_0xd404('0x54')](_0xd404('0x55'),_0x1d014e);throw _0x1d014e;});}return _0x2da864;})[_0xd404('0x42')](respondWithResult(_0x5e27e1,0xc9))['catch'](handleError(_0x5e27e1,null));};exports[_0xd404('0x26')]=function(_0x2e3973,_0x3a4eed){if(_0x2e3973[_0xd404('0x56')]['id']){delete _0x2e3973[_0xd404('0x56')]['id'];}return db[_0xd404('0x2f')][_0xd404('0x4d')]({'where':{'id':_0x2e3973[_0xd404('0x48')]['id']}})[_0xd404('0x42')](handleEntityNotFound(_0x3a4eed,null))[_0xd404('0x42')](saveUpdates(_0x2e3973['body'],null))[_0xd404('0x42')](respondWithResult(_0x3a4eed,null))[_0xd404('0x46')](handleError(_0x3a4eed,null));};exports[_0xd404('0x27')]=function(_0x512843,_0xc10076){return db[_0xd404('0x2f')]['find']({'where':{'id':_0x512843['params']['id']}})[_0xd404('0x42')](handleEntityNotFound(_0xc10076,null))[_0xd404('0x42')](removeEntity(_0xc10076,null))[_0xd404('0x46')](handleError(_0xc10076,null));};exports[_0xd404('0x57')]=function(_0x17f9f2,_0x4aa69e){return db[_0xd404('0x2f')][_0xd404('0x57')]()[_0xd404('0x42')](respondWithResult(_0x4aa69e,null))[_0xd404('0x46')](handleError(_0x4aa69e,null));};exports[_0xd404('0x58')]=function(_0x5cd180,_0x5d76ef,_0x431fdb){var _0x2fb7a8={'raw':!![],'where':{}},_0x1cf9ea={},_0x3b0429;return db[_0xd404('0x2f')]['findOne']({'where':{'id':_0x5cd180[_0xd404('0x48')]['id']}})[_0xd404('0x42')](handleEntityNotFound(_0x5d76ef,null))[_0xd404('0x42')](function(_0x42bc88){if(_0x42bc88){_0x3b0429=_0x42bc88[_0xd404('0x50')]({'plain':!![]});_0x1cf9ea['model']=_[_0xd404('0x49')](db[_0xd404('0x59')]['rawAttributes']);_0x1cf9ea[_0xd404('0x33')]=_['keys'](_0x5cd180[_0xd404('0x33')]);_0x1cf9ea[_0xd404('0x34')]=_[_0xd404('0x35')](_0x1cf9ea[_0xd404('0x32')],_0x1cf9ea[_0xd404('0x33')]);_0x2fb7a8['attributes']=_['intersection'](_0x1cf9ea[_0xd404('0x32')],qs[_0xd404('0x36')](_0x5cd180[_0xd404('0x33')][_0xd404('0x36')]));_0x2fb7a8[_0xd404('0x37')]=_0x2fb7a8[_0xd404('0x37')][_0xd404('0x38')]?_0x2fb7a8[_0xd404('0x37')]:_0x1cf9ea[_0xd404('0x32')];if(!_0x5cd180[_0xd404('0x33')]['hasOwnProperty'](_0xd404('0x3a'))){_0x2fb7a8[_0xd404('0x21')]=qs[_0xd404('0x21')](_0x5cd180[_0xd404('0x33')][_0xd404('0x21')]);_0x2fb7a8['offset']=qs['offset'](_0x5cd180['query'][_0xd404('0x20')]);}_0x2fb7a8['order']=qs['sort'](_0x5cd180['query']['sort']);_0x2fb7a8[_0xd404('0x3d')]=qs[_0xd404('0x34')](_[_0xd404('0x3e')](_0x5cd180[_0xd404('0x33')],_0x1cf9ea[_0xd404('0x34')]));_0x2fb7a8[_0xd404('0x3d')][_0xd404('0x5a')]=_0x42bc88['id'];if(_0x5cd180['query'][_0xd404('0x3f')]){_0x2fb7a8['where']=_[_0xd404('0x40')](_0x2fb7a8[_0xd404('0x3d')],{'$or':_[_0xd404('0x2e')](_0x2fb7a8[_0xd404('0x37')],function(_0xf83c44){var _0x4fcd73={};_0x4fcd73[_0xf83c44]={'$like':'%'+_0x5cd180['query'][_0xd404('0x3f')]+'%'};return _0x4fcd73;})});}_0x2fb7a8=_[_0xd404('0x40')]({},_0x2fb7a8,_0x5cd180['options']);return db[_0xd404('0x59')][_0xd404('0x44')](_0x2fb7a8);}})[_0xd404('0x42')](function(_0x5c8ade){if(_0x5c8ade){return db['User'][_0xd404('0x5b')]({'where':{'id':_['map'](_0x5c8ade,'UserId'),'role':_0xd404('0x5c')},'attributes':['id',_0xd404('0x2b'),_0xd404('0x5d'),'updatedAt',_0xd404('0x5e')]});}})[_0xd404('0x42')](function(_0x35c6f2){if(_0x35c6f2){return{'count':_0x35c6f2['count'],'rows':_['map'](_0x35c6f2[_0xd404('0x45')],function(_0x1f9db6){return{'membername':_0x1f9db6[_0xd404('0x2b')],'UserId':_0x1f9db6['id'],'queue_name':_0x3b0429[_0xd404('0x2b')],'MailQueueId':_0x3b0429['id'],'interface':util['format'](_0xd404('0x5f'),'SIP',_0x1f9db6['name']),'penalty':0x0,'paused':_0x1f9db6[_0xd404('0x5d')],'createdAt':_0x1f9db6[_0xd404('0x5e')],'updatedAt':_0x1f9db6[_0xd404('0x60')]};})};}else{return{'count':0x0,'rows':[]};}})[_0xd404('0x42')](respondWithFilteredResult(_0x5d76ef,_0x2fb7a8))['catch'](handleError(_0x5d76ef,null));};exports[_0xd404('0x61')]=function(_0x46036e,_0x26d49b,_0x1ad277){var _0x42161f={};var _0x7dcfaa={};var _0x267b1f;var _0x29cd5b;return db[_0xd404('0x2f')][_0xd404('0x62')]({'where':{'id':_0x46036e['params']['id']}})[_0xd404('0x42')](handleEntityNotFound(_0x26d49b,null))[_0xd404('0x42')](function(_0x14d916){if(_0x14d916){_0x267b1f=_0x14d916;_0x7dcfaa[_0xd404('0x32')]=_['keys'](db[_0xd404('0x63')][_0xd404('0x4a')]);_0x7dcfaa[_0xd404('0x33')]=_[_0xd404('0x49')](_0x46036e[_0xd404('0x33')]);_0x7dcfaa['filters']=_['intersection'](_0x7dcfaa['model'],_0x7dcfaa['query']);_0x42161f[_0xd404('0x37')]=_[_0xd404('0x35')](_0x7dcfaa[_0xd404('0x32')],qs[_0xd404('0x36')](_0x46036e[_0xd404('0x33')][_0xd404('0x36')]));_0x42161f[_0xd404('0x37')]=_0x42161f[_0xd404('0x37')][_0xd404('0x38')]?_0x42161f[_0xd404('0x37')]:_0x7dcfaa[_0xd404('0x32')];_0x42161f[_0xd404('0x3b')]=qs[_0xd404('0x3c')](_0x46036e[_0xd404('0x33')]['sort']);_0x42161f[_0xd404('0x3d')]=qs[_0xd404('0x34')](_[_0xd404('0x3e')](_0x46036e[_0xd404('0x33')],_0x7dcfaa['filters']));if(_0x46036e[_0xd404('0x33')][_0xd404('0x3f')]){_0x42161f['where']=_[_0xd404('0x40')](_0x42161f[_0xd404('0x3d')],{'$or':_[_0xd404('0x2e')](_0x42161f[_0xd404('0x37')],function(_0x4b3dee){var _0x29eac9={};_0x29eac9[_0x4b3dee]={'$like':'%'+_0x46036e[_0xd404('0x33')]['filter']+'%'};return _0x29eac9;})});}_0x42161f=_[_0xd404('0x40')]({},_0x42161f,_0x46036e['options']);return _0x267b1f['getTeams'](_0x42161f);}})['then'](function(_0x390612){if(_0x390612){_0x29cd5b=_0x390612['length'];if(!_0x46036e['query'][_0xd404('0x39')](_0xd404('0x3a'))){_0x42161f[_0xd404('0x21')]=qs[_0xd404('0x21')](_0x46036e[_0xd404('0x33')]['limit']);_0x42161f[_0xd404('0x20')]=qs[_0xd404('0x20')](_0x46036e[_0xd404('0x33')][_0xd404('0x20')]);}return _0x267b1f[_0xd404('0x61')](_0x42161f);}})['then'](function(_0x1cb4f4){if(_0x1cb4f4){return _0x1cb4f4?{'count':_0x29cd5b,'rows':_0x1cb4f4}:null;}})[_0xd404('0x42')](respondWithResult(_0x26d49b,null))[_0xd404('0x46')](handleError(_0x26d49b,null));};exports[_0xd404('0x64')]=function(_0x33616b,_0x1a8a5a,_0xc25c){var _0x47318a=_0x33616b[_0xd404('0x56')]['ids'];return db[_0xd404('0x63')][_0xd404('0x44')]({'where':{'id':_0x47318a},'attributes':['id'],'include':[{'model':db[_0xd404('0x65')],'as':'Agents','attributes':['id',_0xd404('0x2b'),_0xd404('0x66'),_0xd404('0x67'),_0xd404('0x68')],'raw':!![]}]})[_0xd404('0x42')](function(_0x1c46fb){if(_0x1c46fb){var _0x3ba420=_['flatMap'](_0x1c46fb,function(_0x3a43d9){var _0x29a471=_0x3a43d9[_0xd404('0x50')]({'plain':!![]});return _0x29a471[_0xd404('0x69')];});return db[_0xd404('0x2f')][_0xd404('0x4d')]({'where':{'id':_0x33616b[_0xd404('0x48')]['id']}})[_0xd404('0x42')](function(_0x662053){return db[_0xd404('0x6a')][_0xd404('0x6b')](function(_0x3059aa){return _0x662053['addTeams'](_0x47318a,{'transaction':_0x3059aa})['then'](function(){return BPromise[_0xd404('0x6c')](_0x3ba420,function(_0x38108e){return db[_0xd404('0x59')][_0xd404('0x6d')]({'where':{'UserId':_0x38108e['id'],'MailQueueId':_0x33616b[_0xd404('0x48')]['id']},'transaction':_0x3059aa});});})['then'](function(){_0x3ba420[_0xd404('0x6e')](function(_0xe0f151){socket[_0xd404('0x6f')](_0xd404('0x70'),{'UserId':_0xe0f151['id'],'MailQueueId':_0x662053['id']});});});});});}})[_0xd404('0x42')](respondWithStatusCode(_0x1a8a5a,null))[_0xd404('0x46')](handleError(_0x1a8a5a,null));};exports['removeTeams']=function(_0x3ad66b,_0x253339,_0xbac278){return db[_0xd404('0x63')][_0xd404('0x44')]({'where':{'id':_0x3ad66b[_0xd404('0x33')][_0xd404('0x71')]},'attributes':['id'],'include':[{'model':db[_0xd404('0x65')],'as':_0xd404('0x69'),'attributes':['id'],'raw':!![]}]})[_0xd404('0x42')](handleEntityNotFound(_0x253339,null))['then'](function(_0x27f83c){var _0x1ef237=_[_0xd404('0x2e')](_0x27f83c,'id');var _0x565dee=[];var _0x20914e=[];var _0x4642dc=squel[_0xd404('0x72')]();_0x4642dc['field'](_0xd404('0x73'))[_0xd404('0x74')](_0xd404('0x75'),'tq')['join'](_0xd404('0x76'),'ut','ut.TeamId\x20=\x20tq.TeamId')['where'](_0xd404('0x77'),_0x3ad66b['params']['id']);for(var _0x21e408=0x0;_0x21e408<_0x27f83c[_0xd404('0x38')];_0x21e408+=0x1){let _0x1d5bcc=_0x27f83c[_0x21e408];for(var _0x3ca759=0x0;_0x3ca759<_0x1d5bcc[_0xd404('0x69')][_0xd404('0x38')];_0x3ca759+=0x1){let _0x9a35aa=_0x1d5bcc['Agents'][_0x3ca759];var _0x339c2d=_0x4642dc[_0xd404('0x78')]();_0x339c2d['where']('ut.UserId\x20=\x20?',_0x9a35aa['id']);_0x20914e[_0xd404('0x79')](db[_0xd404('0x6a')][_0xd404('0x33')](_0x339c2d[_0xd404('0x7a')](),{'type':db['sequelize'][_0xd404('0x7b')][_0xd404('0x7c')]})[_0xd404('0x42')](function(_0x5ed19e){if(_0x5ed19e[_0xd404('0x38')]===0x1){return _0x9a35aa['id'];}else{var _0x271be7=_[_0xd404('0x7d')](_[_0xd404('0x2e')](_0x5ed19e,'TeamId'),function(_0x233d1d){return _['includes'](_0x1ef237,_0x233d1d);});if(_0x271be7){return _0x9a35aa['id'];}}}));}}return BPromise[_0xd404('0x7e')](_0x20914e)[_0xd404('0x42')](function(_0x2002e3){_0x565dee=_(_0x565dee)[_0xd404('0x7f')](_0x2002e3)[_0xd404('0x80')]()['value']();return db[_0xd404('0x2f')][_0xd404('0x4d')]({'where':{'id':_0x3ad66b[_0xd404('0x48')]['id']}})[_0xd404('0x42')](function(_0x100ac5){return db[_0xd404('0x6a')]['transaction'](function(_0x57e737){return _0x100ac5['removeTeams'](_0x3ad66b[_0xd404('0x33')][_0xd404('0x71')],{'transaction':_0x57e737})['then'](function(){if(!_[_0xd404('0x81')](_0x565dee)){return _0x100ac5[_0xd404('0x82')](_0x565dee,{'transaction':_0x57e737});}})[_0xd404('0x42')](function(){_0x565dee[_0xd404('0x6e')](function(_0x3f2f07){socket[_0xd404('0x6f')](_0xd404('0x83'),{'UserId':_0x3f2f07,'MailQueueId':_0x100ac5['id']});});});});});});})[_0xd404('0x42')](respondWithStatusCode(_0x253339,null))[_0xd404('0x46')](handleError(_0x253339,null));};exports[_0xd404('0x84')]=function(_0x4299d9,_0x4304b9,_0x1a2ade){return db[_0xd404('0x2f')]['find']({'where':{'id':_0x4299d9[_0xd404('0x48')]['id']}})[_0xd404('0x42')](handleEntityNotFound(_0x4304b9,null))[_0xd404('0x42')](function(_0x8967f8){if(_0x8967f8){return _0x8967f8['addAgents'](_0x4299d9[_0xd404('0x56')][_0xd404('0x71')],_[_0xd404('0x85')](_0x4299d9[_0xd404('0x56')],[_0xd404('0x71'),'id'])||{})[_0xd404('0x86')](function(_0x4c2492){for(var _0x2b64a2=0x0;_0x2b64a2<_0x4299d9[_0xd404('0x56')][_0xd404('0x71')][_0xd404('0x38')];_0x2b64a2+=0x1){socket['emit'](_0xd404('0x70'),{'UserId':_0x4299d9[_0xd404('0x56')]['ids'][_0x2b64a2],'MailQueueId':_0x4299d9[_0xd404('0x48')]['id']});}return _0x4c2492;});}})[_0xd404('0x42')](respondWithResult(_0x4304b9,null))[_0xd404('0x46')](handleError(_0x4304b9,null));};exports[_0xd404('0x82')]=function(_0x293a8c,_0x2fe891,_0x28a5ad){return db[_0xd404('0x2f')][_0xd404('0x4d')]({'where':{'id':_0x293a8c[_0xd404('0x48')]['id']}})[_0xd404('0x42')](handleEntityNotFound(_0x2fe891,null))['then'](function(_0x41309e){if(_0x41309e){return _0x41309e['removeAgents'](_0x293a8c['query'][_0xd404('0x71')])[_0xd404('0x42')](function(){if(_[_0xd404('0x87')](_0x293a8c['query'][_0xd404('0x71')])){for(var _0x540af5=0x0;_0x540af5<_0x293a8c[_0xd404('0x33')]['ids'][_0xd404('0x38')];_0x540af5+=0x1){socket[_0xd404('0x6f')](_0xd404('0x83'),{'UserId':Number(_0x293a8c[_0xd404('0x33')][_0xd404('0x71')][_0x540af5]),'MailQueueId':Number(_0x293a8c[_0xd404('0x48')]['id'])});}}else{socket[_0xd404('0x6f')](_0xd404('0x83'),{'UserId':Number(_0x293a8c[_0xd404('0x33')][_0xd404('0x71')]),'MailQueueId':Number(_0x293a8c[_0xd404('0x48')]['id'])});}});}})[_0xd404('0x42')](respondWithStatusCode(_0x2fe891,null))['catch'](handleError(_0x2fe891,null));};exports[_0xd404('0x88')]=function(_0x1b58b0,_0x1a64f9,_0x59c72e){var _0x270c60={};var _0x3dade7={};var _0x47b5ac;var _0x3329e3;return db['MailQueue'][_0xd404('0x62')]({'where':{'id':_0x1b58b0[_0xd404('0x48')]['id']}})['then'](handleEntityNotFound(_0x1a64f9,null))['then'](function(_0x4b217c){if(_0x4b217c){_0x47b5ac=_0x4b217c;_0x3dade7[_0xd404('0x32')]=_['keys'](db[_0xd404('0x65')][_0xd404('0x4a')]);_0x3dade7[_0xd404('0x33')]=_[_0xd404('0x49')](_0x1b58b0['query']);_0x3dade7[_0xd404('0x34')]=_[_0xd404('0x35')](_0x3dade7['model'],_0x3dade7[_0xd404('0x33')]);_0x270c60[_0xd404('0x37')]=_[_0xd404('0x35')](_0x3dade7[_0xd404('0x32')],qs['fields'](_0x1b58b0[_0xd404('0x33')]['fields']));_0x270c60[_0xd404('0x37')]=_0x270c60[_0xd404('0x37')][_0xd404('0x38')]?_0x270c60[_0xd404('0x37')]:_0x3dade7[_0xd404('0x32')];_0x270c60[_0xd404('0x3b')]=qs[_0xd404('0x3c')](_0x1b58b0['query']['sort']);_0x270c60[_0xd404('0x3d')]=qs[_0xd404('0x34')](_[_0xd404('0x3e')](_0x1b58b0[_0xd404('0x33')],_0x3dade7[_0xd404('0x34')]));if(_0x1b58b0[_0xd404('0x33')][_0xd404('0x3f')]){_0x270c60[_0xd404('0x3d')]=_[_0xd404('0x40')](_0x270c60[_0xd404('0x3d')],{'$or':_[_0xd404('0x2e')](_0x270c60[_0xd404('0x37')],function(_0x535905){var _0x402c12={};_0x402c12[_0x535905]={'$like':'%'+_0x1b58b0['query'][_0xd404('0x3f')]+'%'};return _0x402c12;})});}_0x270c60=_[_0xd404('0x40')]({},_0x270c60,_0x1b58b0[_0xd404('0x4c')]);return _0x47b5ac[_0xd404('0x88')](_0x270c60);}})['then'](function(_0x105c58){if(_0x105c58){_0x3329e3=_0x105c58['length'];if(!_0x1b58b0[_0xd404('0x33')][_0xd404('0x39')](_0xd404('0x3a'))){_0x270c60[_0xd404('0x21')]=qs[_0xd404('0x21')](_0x1b58b0['query']['limit']);_0x270c60['offset']=qs[_0xd404('0x20')](_0x1b58b0[_0xd404('0x33')][_0xd404('0x20')]);}return _0x47b5ac['getAgents'](_0x270c60);}})[_0xd404('0x42')](function(_0x72d44a){if(_0x72d44a){return _0x72d44a?{'count':_0x3329e3,'rows':_0x72d44a}:null;}})[_0xd404('0x42')](respondWithResult(_0x1a64f9,null))[_0xd404('0x46')](handleError(_0x1a64f9,null));}; \ No newline at end of file diff --git a/server/api/mailQueue/mailQueue.events.js b/server/api/mailQueue/mailQueue.events.js index 1f2f56b..e2d900f 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 _0x1965=['hook','events','../../mysqldb','MailQueue','setMaxListeners','emit'];(function(_0x2d66a8,_0x1625a2){var _0x374b6e=function(_0x35ec72){while(--_0x35ec72){_0x2d66a8['push'](_0x2d66a8['shift']());}};_0x374b6e(++_0x1625a2);}(_0x1965,0x67));var _0x5196=function(_0x5554e6,_0x4e220f){_0x5554e6=_0x5554e6-0x0;var _0x1d7301=_0x1965[_0x5554e6];return _0x1d7301;};'use strict';var EventEmitter=require(_0x5196('0x0'));var MailQueue=require(_0x5196('0x1'))['db'][_0x5196('0x2')];var MailQueueEvents=new EventEmitter();MailQueueEvents[_0x5196('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':'update','afterDestroy':'remove'};function emitEvent(_0x458638){return function(_0x136feb,_0x1c5958,_0x1102a9){MailQueueEvents[_0x5196('0x4')](_0x458638+':'+_0x136feb['id'],_0x136feb);MailQueueEvents[_0x5196('0x4')](_0x458638,_0x136feb);_0x1102a9(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];MailQueue[_0x5196('0x5')](e,emitEvent(event));}}module['exports']=MailQueueEvents; \ No newline at end of file +var _0x9092=['hasOwnProperty','hook','exports','events','../../mysqldb','save','remove','emit'];(function(_0x52829e,_0x35cecc){var _0x2bccff=function(_0x4ad274){while(--_0x4ad274){_0x52829e['push'](_0x52829e['shift']());}};_0x2bccff(++_0x35cecc);}(_0x9092,0xc3));var _0x2909=function(_0x2d0a78,_0x4372f1){_0x2d0a78=_0x2d0a78-0x0;var _0x207c7b=_0x9092[_0x2d0a78];return _0x207c7b;};'use strict';var EventEmitter=require(_0x2909('0x0'));var MailQueue=require(_0x2909('0x1'))['db']['MailQueue'];var MailQueueEvents=new EventEmitter();MailQueueEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x2909('0x2'),'afterUpdate':'update','afterDestroy':_0x2909('0x3')};function emitEvent(_0x5965bd){return function(_0x1f6661,_0xbb7162,_0x20a232){MailQueueEvents[_0x2909('0x4')](_0x5965bd+':'+_0x1f6661['id'],_0x1f6661);MailQueueEvents[_0x2909('0x4')](_0x5965bd,_0x1f6661);_0x20a232(null);};}for(var e in events){if(events[_0x2909('0x5')](e)){var event=events[e];MailQueue[_0x2909('0x6')](e,emitEvent(event));}}module[_0x2909('0x7')]=MailQueueEvents; \ No newline at end of file diff --git a/server/api/mailQueue/mailQueue.model.js b/server/api/mailQueue/mailQueue.model.js index 9d6fc40..6566d16 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 _0x5829=['./mailQueue.attributes','exports','define','mail_queues','lodash','api','request-promise','path','../../config/environment'];(function(_0x464075,_0x2263c6){var _0x162d12=function(_0x130bef){while(--_0x130bef){_0x464075['push'](_0x464075['shift']());}};_0x162d12(++_0x2263c6);}(_0x5829,0x70));var _0x9582=function(_0x409353,_0xe9f04d){_0x409353=_0x409353-0x0;var _0x4f4b59=_0x5829[_0x409353];return _0x4f4b59;};'use strict';var _=require(_0x9582('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x9582('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x9582('0x2'));var fs=require('fs');var path=require(_0x9582('0x3'));var rimraf=require('rimraf');var config=require(_0x9582('0x4'));var attributes=require(_0x9582('0x5'));module[_0x9582('0x6')]=function(_0x4c0607,_0xb9bf9b){return _0x4c0607[_0x9582('0x7')]('MailQueue',attributes,{'tableName':_0x9582('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x7601=['exports','MailQueue','mail_queues','util','../../config/logger','api','moment','path','rimraf','../../config/environment','./mailQueue.attributes'];(function(_0x24afb3,_0x57d4d6){var _0x37408d=function(_0x514f33){while(--_0x514f33){_0x24afb3['push'](_0x24afb3['shift']());}};_0x37408d(++_0x57d4d6);}(_0x7601,0x7c));var _0x1760=function(_0x92d580,_0x4928fb){_0x92d580=_0x92d580-0x0;var _0x4ee344=_0x7601[_0x92d580];return _0x4ee344;};'use strict';var _=require('lodash');var util=require(_0x1760('0x0'));var logger=require(_0x1760('0x1'))(_0x1760('0x2'));var moment=require(_0x1760('0x3'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x1760('0x4'));var rimraf=require(_0x1760('0x5'));var config=require(_0x1760('0x6'));var attributes=require(_0x1760('0x7'));module[_0x1760('0x8')]=function(_0x422fff,_0x4a1af6){return _0x422fff['define'](_0x1760('0x9'),attributes,{'tableName':_0x1760('0xa'),'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 7b1cf8c..13f34b8 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 _0xa197=['findAll','raw','options','where','attributes','limit','include','model','map','find','then','ShowMailQueue','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','rpc','../../config/environment','client','http','redis','defaults','localhost','socket.io-emitter','./mailQueue.socket','register','request','info','MailQueue,\x20%s,\x20%s','request\x20sent','debug','stringify','error','message','result','catch','GetMailQueue'];(function(_0x27ebd4,_0x197583){var _0xa85535=function(_0x514078){while(--_0x514078){_0x27ebd4['push'](_0x27ebd4['shift']());}};_0xa85535(++_0x197583);}(_0xa197,0x1c4));var _0x7a19=function(_0x2b7764,_0x2606f1){_0x2b7764=_0x2b7764-0x0;var _0x848dcb=_0xa197[_0x2b7764];return _0x848dcb;};'use strict';var _=require(_0x7a19('0x0'));var util=require(_0x7a19('0x1'));var moment=require(_0x7a19('0x2'));var BPromise=require(_0x7a19('0x3'));var rs=require(_0x7a19('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x7a19('0x5'))['db'];var utils=require(_0x7a19('0x6'));var logger=require('../../config/logger')(_0x7a19('0x7'));var config=require(_0x7a19('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x7a19('0x9')][_0x7a19('0xa')]({'port':0x232a});config[_0x7a19('0xb')]=_[_0x7a19('0xc')](config[_0x7a19('0xb')],{'host':_0x7a19('0xd'),'port':0x18eb});var socket=require(_0x7a19('0xe'))(new Redis(config[_0x7a19('0xb')]));require(_0x7a19('0xf'))[_0x7a19('0x10')](socket);function respondWithRpcPromise(_0x453086,_0xeecd96,_0x4f1fc8){return new BPromise(function(_0x122a30,_0x4d542e){return client[_0x7a19('0x11')](_0x453086,_0x4f1fc8)['then'](function(_0xa01bfa){logger[_0x7a19('0x12')](_0x7a19('0x13'),_0xeecd96,_0x7a19('0x14'));logger[_0x7a19('0x15')]('MailQueue,\x20%s,\x20%s,\x20%s',_0xeecd96,_0x7a19('0x14'),JSON[_0x7a19('0x16')](_0xa01bfa));if(_0xa01bfa['error']){if(_0xa01bfa[_0x7a19('0x17')]['code']===0x1f4){logger[_0x7a19('0x17')]('MailQueue,\x20%s,\x20%s',_0xeecd96,_0xa01bfa[_0x7a19('0x17')][_0x7a19('0x18')]);return _0x4d542e(_0xa01bfa[_0x7a19('0x17')][_0x7a19('0x18')]);}logger[_0x7a19('0x17')](_0x7a19('0x13'),_0xeecd96,_0xa01bfa[_0x7a19('0x17')][_0x7a19('0x18')]);return _0x122a30(_0xa01bfa[_0x7a19('0x17')][_0x7a19('0x18')]);}else{logger['info'](_0x7a19('0x13'),_0xeecd96,_0x7a19('0x14'));_0x122a30(_0xa01bfa[_0x7a19('0x19')]['message']);}})[_0x7a19('0x1a')](function(_0x41a8e2){logger['error'](_0x7a19('0x13'),_0xeecd96,_0x41a8e2);_0x4d542e(_0x41a8e2);});});}exports[_0x7a19('0x1b')]=function(_0x35243b){var _0x5e6138=this;return new Promise(function(_0x1e03a9,_0x23630e){return db['MailQueue'][_0x7a19('0x1c')]({'raw':_0x35243b['options']?_0x35243b['options'][_0x7a19('0x1d')]===undefined?!![]:![]:!![],'where':_0x35243b[_0x7a19('0x1e')]?_0x35243b[_0x7a19('0x1e')][_0x7a19('0x1f')]||null:null,'attributes':_0x35243b[_0x7a19('0x1e')]?_0x35243b['options'][_0x7a19('0x20')]||null:null,'limit':_0x35243b['options']?_0x35243b[_0x7a19('0x1e')][_0x7a19('0x21')]||null:null,'include':_0x35243b['options']?_0x35243b[_0x7a19('0x1e')][_0x7a19('0x22')]?_['map'](_0x35243b[_0x7a19('0x1e')][_0x7a19('0x22')],function(_0x562100){return{'model':db[_0x562100[_0x7a19('0x23')]],'as':_0x562100['as'],'attributes':_0x562100[_0x7a19('0x20')],'include':_0x562100[_0x7a19('0x22')]?_[_0x7a19('0x24')](_0x562100[_0x7a19('0x22')],function(_0x288b1f){return{'model':db[_0x288b1f[_0x7a19('0x23')]],'as':_0x288b1f['as'],'attributes':_0x288b1f['attributes'],'include':_0x288b1f[_0x7a19('0x22')]?_[_0x7a19('0x24')](_0x288b1f[_0x7a19('0x22')],function(_0xc709f7){return{'model':db[_0xc709f7[_0x7a19('0x23')]],'as':_0xc709f7['as'],'attributes':_0xc709f7[_0x7a19('0x20')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x2479a1){logger[_0x7a19('0x12')](_0x7a19('0x1b'),_0x35243b);logger[_0x7a19('0x15')](_0x7a19('0x1b'),_0x35243b,JSON[_0x7a19('0x16')](_0x2479a1));_0x1e03a9(_0x2479a1);})['catch'](function(_0xfa98c2){logger[_0x7a19('0x17')](_0x7a19('0x1b'),_0xfa98c2[_0x7a19('0x18')],_0x35243b);_0x23630e(_0x5e6138[_0x7a19('0x17')](0x1f4,_0xfa98c2['message']));});});};exports['ShowMailQueue']=function(_0x2d3b9b){var _0x388d22=this;return new Promise(function(_0x405fb6,_0x18b5d6){return db['MailQueue'][_0x7a19('0x25')]({'raw':_0x2d3b9b[_0x7a19('0x1e')]?_0x2d3b9b[_0x7a19('0x1e')][_0x7a19('0x1d')]===undefined?!![]:![]:!![],'where':_0x2d3b9b[_0x7a19('0x1e')]?_0x2d3b9b[_0x7a19('0x1e')][_0x7a19('0x1f')]||null:null,'attributes':_0x2d3b9b[_0x7a19('0x1e')]?_0x2d3b9b[_0x7a19('0x1e')][_0x7a19('0x20')]||null:null,'include':_0x2d3b9b[_0x7a19('0x1e')]?_0x2d3b9b[_0x7a19('0x1e')][_0x7a19('0x22')]?_['map'](_0x2d3b9b['options'][_0x7a19('0x22')],function(_0x3c801a){return{'model':db[_0x3c801a['model']],'as':_0x3c801a['as'],'attributes':_0x3c801a[_0x7a19('0x20')],'include':_0x3c801a[_0x7a19('0x22')]?_[_0x7a19('0x24')](_0x3c801a[_0x7a19('0x22')],function(_0x245979){return{'model':db[_0x245979[_0x7a19('0x23')]],'as':_0x245979['as'],'attributes':_0x245979[_0x7a19('0x20')],'include':_0x245979['include']?_[_0x7a19('0x24')](_0x245979[_0x7a19('0x22')],function(_0x320ba8){return{'model':db[_0x320ba8[_0x7a19('0x23')]],'as':_0x320ba8['as'],'attributes':_0x320ba8[_0x7a19('0x20')]};}):[]};}):[]};}):[]:[]})[_0x7a19('0x26')](function(_0x3863a0){logger['info'](_0x7a19('0x27'),_0x2d3b9b);logger[_0x7a19('0x15')]('ShowMailQueue',_0x2d3b9b,JSON['stringify'](_0x3863a0));_0x405fb6(_0x3863a0);})[_0x7a19('0x1a')](function(_0x3d8803){logger[_0x7a19('0x17')](_0x7a19('0x27'),_0x3d8803['message'],_0x2d3b9b);_0x18b5d6(_0x388d22['error'](0x1f4,_0x3d8803[_0x7a19('0x18')]));});});}; \ No newline at end of file +var _0xb8c0=['options','raw','where','attributes','limit','include','map','model','ShowMailQueue','find','stringify','lodash','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','http','redis','defaults','socket.io-emitter','./mailQueue.socket','register','request','then','info','request\x20sent','debug','MailQueue,\x20%s,\x20%s,\x20%s','error','MailQueue,\x20%s,\x20%s','message','catch','GetMailQueue','findAll'];(function(_0x365ea5,_0x2ae96e){var _0x9613f=function(_0x2c8d1f){while(--_0x2c8d1f){_0x365ea5['push'](_0x365ea5['shift']());}};_0x9613f(++_0x2ae96e);}(_0xb8c0,0x7a));var _0x0b8c=function(_0x30fb14,_0x25eb88){_0x30fb14=_0x30fb14-0x0;var _0xe60b90=_0xb8c0[_0x30fb14];return _0xe60b90;};'use strict';var _=require(_0x0b8c('0x0'));var util=require('util');var moment=require(_0x0b8c('0x1'));var BPromise=require(_0x0b8c('0x2'));var rs=require(_0x0b8c('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x0b8c('0x4'))['db'];var utils=require(_0x0b8c('0x5'));var logger=require(_0x0b8c('0x6'))(_0x0b8c('0x7'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson['client'][_0x0b8c('0x8')]({'port':0x232a});config[_0x0b8c('0x9')]=_[_0x0b8c('0xa')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0x0b8c('0xb'))(new Redis(config[_0x0b8c('0x9')]));require(_0x0b8c('0xc'))[_0x0b8c('0xd')](socket);function respondWithRpcPromise(_0x114e36,_0x45bfd3,_0x2ac66c){return new BPromise(function(_0x3fce27,_0xe2f650){return client[_0x0b8c('0xe')](_0x114e36,_0x2ac66c)[_0x0b8c('0xf')](function(_0xafbbd2){logger[_0x0b8c('0x10')]('MailQueue,\x20%s,\x20%s',_0x45bfd3,_0x0b8c('0x11'));logger[_0x0b8c('0x12')](_0x0b8c('0x13'),_0x45bfd3,'request\x20sent',JSON['stringify'](_0xafbbd2));if(_0xafbbd2['error']){if(_0xafbbd2[_0x0b8c('0x14')]['code']===0x1f4){logger['error'](_0x0b8c('0x15'),_0x45bfd3,_0xafbbd2['error'][_0x0b8c('0x16')]);return _0xe2f650(_0xafbbd2[_0x0b8c('0x14')][_0x0b8c('0x16')]);}logger[_0x0b8c('0x14')](_0x0b8c('0x15'),_0x45bfd3,_0xafbbd2[_0x0b8c('0x14')][_0x0b8c('0x16')]);return _0x3fce27(_0xafbbd2[_0x0b8c('0x14')][_0x0b8c('0x16')]);}else{logger[_0x0b8c('0x10')](_0x0b8c('0x15'),_0x45bfd3,_0x0b8c('0x11'));_0x3fce27(_0xafbbd2['result'][_0x0b8c('0x16')]);}})[_0x0b8c('0x17')](function(_0x2ae482){logger[_0x0b8c('0x14')](_0x0b8c('0x15'),_0x45bfd3,_0x2ae482);_0xe2f650(_0x2ae482);});});}exports[_0x0b8c('0x18')]=function(_0x52def5){var _0x296124=this;return new Promise(function(_0x48d116,_0x4ed7d7){return db['MailQueue'][_0x0b8c('0x19')]({'raw':_0x52def5['options']?_0x52def5[_0x0b8c('0x1a')][_0x0b8c('0x1b')]===undefined?!![]:![]:!![],'where':_0x52def5[_0x0b8c('0x1a')]?_0x52def5[_0x0b8c('0x1a')][_0x0b8c('0x1c')]||null:null,'attributes':_0x52def5[_0x0b8c('0x1a')]?_0x52def5[_0x0b8c('0x1a')][_0x0b8c('0x1d')]||null:null,'limit':_0x52def5['options']?_0x52def5[_0x0b8c('0x1a')][_0x0b8c('0x1e')]||null:null,'include':_0x52def5[_0x0b8c('0x1a')]?_0x52def5[_0x0b8c('0x1a')][_0x0b8c('0x1f')]?_[_0x0b8c('0x20')](_0x52def5[_0x0b8c('0x1a')][_0x0b8c('0x1f')],function(_0x257b52){return{'model':db[_0x257b52[_0x0b8c('0x21')]],'as':_0x257b52['as'],'attributes':_0x257b52[_0x0b8c('0x1d')],'include':_0x257b52[_0x0b8c('0x1f')]?_[_0x0b8c('0x20')](_0x257b52[_0x0b8c('0x1f')],function(_0x359e1e){return{'model':db[_0x359e1e[_0x0b8c('0x21')]],'as':_0x359e1e['as'],'attributes':_0x359e1e[_0x0b8c('0x1d')],'include':_0x359e1e['include']?_['map'](_0x359e1e[_0x0b8c('0x1f')],function(_0x293a66){return{'model':db[_0x293a66[_0x0b8c('0x21')]],'as':_0x293a66['as'],'attributes':_0x293a66[_0x0b8c('0x1d')]};}):[]};}):[]};}):[]:[]})[_0x0b8c('0xf')](function(_0x3d7e01){logger['info'](_0x0b8c('0x18'),_0x52def5);logger[_0x0b8c('0x12')]('GetMailQueue',_0x52def5,JSON['stringify'](_0x3d7e01));_0x48d116(_0x3d7e01);})[_0x0b8c('0x17')](function(_0x415aae){logger['error']('GetMailQueue',_0x415aae[_0x0b8c('0x16')],_0x52def5);_0x4ed7d7(_0x296124[_0x0b8c('0x14')](0x1f4,_0x415aae[_0x0b8c('0x16')]));});});};exports[_0x0b8c('0x22')]=function(_0x1a224e){var _0x21a3b8=this;return new Promise(function(_0x40d9c9,_0xab4a24){return db['MailQueue'][_0x0b8c('0x23')]({'raw':_0x1a224e[_0x0b8c('0x1a')]?_0x1a224e[_0x0b8c('0x1a')]['raw']===undefined?!![]:![]:!![],'where':_0x1a224e['options']?_0x1a224e['options']['where']||null:null,'attributes':_0x1a224e[_0x0b8c('0x1a')]?_0x1a224e['options'][_0x0b8c('0x1d')]||null:null,'include':_0x1a224e[_0x0b8c('0x1a')]?_0x1a224e[_0x0b8c('0x1a')][_0x0b8c('0x1f')]?_[_0x0b8c('0x20')](_0x1a224e['options'][_0x0b8c('0x1f')],function(_0x2280af){return{'model':db[_0x2280af[_0x0b8c('0x21')]],'as':_0x2280af['as'],'attributes':_0x2280af[_0x0b8c('0x1d')],'include':_0x2280af[_0x0b8c('0x1f')]?_[_0x0b8c('0x20')](_0x2280af[_0x0b8c('0x1f')],function(_0x247734){return{'model':db[_0x247734['model']],'as':_0x247734['as'],'attributes':_0x247734['attributes'],'include':_0x247734[_0x0b8c('0x1f')]?_[_0x0b8c('0x20')](_0x247734[_0x0b8c('0x1f')],function(_0x32059b){return{'model':db[_0x32059b[_0x0b8c('0x21')]],'as':_0x32059b['as'],'attributes':_0x32059b[_0x0b8c('0x1d')]};}):[]};}):[]};}):[]:[]})[_0x0b8c('0xf')](function(_0x1ce7d1){logger[_0x0b8c('0x10')](_0x0b8c('0x22'),_0x1a224e);logger[_0x0b8c('0x12')](_0x0b8c('0x22'),_0x1a224e,JSON[_0x0b8c('0x24')](_0x1ce7d1));_0x40d9c9(_0x1ce7d1);})[_0x0b8c('0x17')](function(_0x1bfcd9){logger[_0x0b8c('0x14')]('ShowMailQueue',_0x1bfcd9['message'],_0x1a224e);_0xab4a24(_0x21a3b8['error'](0x1f4,_0x1bfcd9[_0x0b8c('0x16')]));});});}; \ No newline at end of file diff --git a/server/api/mailQueue/mailQueue.socket.js b/server/api/mailQueue/mailQueue.socket.js index 33ab1fd..4b93a35 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 _0x42a8=['save','remove','update','emit','removeListener','register','length','mailQueue:'];(function(_0x267d8d,_0xe90f65){var _0x11a98f=function(_0x5703c9){while(--_0x5703c9){_0x267d8d['push'](_0x267d8d['shift']());}};_0x11a98f(++_0xe90f65);}(_0x42a8,0x170));var _0x842a=function(_0xb6a6bf,_0x184dfd){_0xb6a6bf=_0xb6a6bf-0x0;var _0x4a36b5=_0x42a8[_0xb6a6bf];return _0x4a36b5;};'use strict';var MailQueueEvents=require('./mailQueue.events');var events=[_0x842a('0x0'),_0x842a('0x1'),_0x842a('0x2')];function createListener(_0x1fa73a,_0x1056b7){return function(_0x15f073){_0x1056b7[_0x842a('0x3')](_0x1fa73a,_0x15f073);};}function removeListener(_0x23fff5,_0x5b8b9c){return function(){MailQueueEvents[_0x842a('0x4')](_0x23fff5,_0x5b8b9c);};}exports[_0x842a('0x5')]=function(_0xe44d67){for(var _0x44459b=0x0,_0x53ea09=events[_0x842a('0x6')];_0x44459b<_0x53ea09;_0x44459b++){var _0x2c1a70=events[_0x44459b];var _0x5c74f8=createListener(_0x842a('0x7')+_0x2c1a70,_0xe44d67);MailQueueEvents['on'](_0x2c1a70,_0x5c74f8);}}; \ No newline at end of file +var _0xada2=['update','emit','removeListener','register','length','mailQueue:','./mailQueue.events','save','remove'];(function(_0x22bdd3,_0x552e50){var _0x44d9d9=function(_0x2b4ab9){while(--_0x2b4ab9){_0x22bdd3['push'](_0x22bdd3['shift']());}};_0x44d9d9(++_0x552e50);}(_0xada2,0x102));var _0x2ada=function(_0xd67a36,_0x3481e5){_0xd67a36=_0xd67a36-0x0;var _0x193269=_0xada2[_0xd67a36];return _0x193269;};'use strict';var MailQueueEvents=require(_0x2ada('0x0'));var events=[_0x2ada('0x1'),_0x2ada('0x2'),_0x2ada('0x3')];function createListener(_0x3ca1c0,_0x2b6be0){return function(_0x2b21ad){_0x2b6be0[_0x2ada('0x4')](_0x3ca1c0,_0x2b21ad);};}function removeListener(_0x173e31,_0x3c6b98){return function(){MailQueueEvents[_0x2ada('0x5')](_0x173e31,_0x3c6b98);};}exports[_0x2ada('0x6')]=function(_0x34dd08){for(var _0x3f87e9=0x0,_0xc27c28=events[_0x2ada('0x7')];_0x3f87e9<_0xc27c28;_0x3f87e9++){var _0x2e16b9=events[_0x3f87e9];var _0x59412c=createListener(_0x2ada('0x8')+_0x2e16b9,_0x34dd08);MailQueueEvents['on'](_0x2e16b9,_0x59412c);}}; \ No newline at end of file diff --git a/server/api/mailQueueReport/index.js b/server/api/mailQueueReport/index.js index 65b9959..a3f4892 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 _0xd385=['./mailQueueReport.controller','get','isAuthenticated','index','/describe','post','put','/:id','exports','util','path','connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment'];(function(_0x1d90d0,_0x338d9c){var _0x531047=function(_0x383664){while(--_0x383664){_0x1d90d0['push'](_0x1d90d0['shift']());}};_0x531047(++_0x338d9c);}(_0xd385,0xd9));var _0x5d38=function(_0x26197e,_0x4d7e8e){_0x26197e=_0x26197e-0x0;var _0x3f7afe=_0xd385[_0x26197e];return _0x3f7afe;};'use strict';var multer=require('multer');var util=require(_0x5d38('0x0'));var path=require(_0x5d38('0x1'));var timeout=require(_0x5d38('0x2'));var express=require(_0x5d38('0x3'));var router=express['Router']();var auth=require(_0x5d38('0x4'));var interaction=require(_0x5d38('0x5'));var config=require(_0x5d38('0x6'));var controller=require(_0x5d38('0x7'));router[_0x5d38('0x8')]('/',auth[_0x5d38('0x9')](),controller[_0x5d38('0xa')]);router[_0x5d38('0x8')](_0x5d38('0xb'),auth[_0x5d38('0x9')](),controller['describe']);router[_0x5d38('0x8')]('/:id',auth[_0x5d38('0x9')](),controller['show']);router[_0x5d38('0xc')]('/',auth[_0x5d38('0x9')](),controller['create']);router[_0x5d38('0xd')](_0x5d38('0xe'),auth[_0x5d38('0x9')](),controller['update']);router['delete'](_0x5d38('0xe'),auth['isAuthenticated'](),controller['destroy']);module[_0x5d38('0xf')]=router; \ No newline at end of file +var _0xd40c=['Router','../../config/environment','./mailQueueReport.controller','get','isAuthenticated','index','/describe','describe','/:id','update','delete','destroy','exports','multer','path','connect-timeout'];(function(_0x1d1d09,_0x504d77){var _0x8827e=function(_0x4f3128){while(--_0x4f3128){_0x1d1d09['push'](_0x1d1d09['shift']());}};_0x8827e(++_0x504d77);}(_0xd40c,0x6d));var _0xcd40=function(_0x1ad227,_0x13260d){_0x1ad227=_0x1ad227-0x0;var _0x1501a9=_0xd40c[_0x1ad227];return _0x1501a9;};'use strict';var multer=require(_0xcd40('0x0'));var util=require('util');var path=require(_0xcd40('0x1'));var timeout=require(_0xcd40('0x2'));var express=require('express');var router=express[_0xcd40('0x3')]();var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0xcd40('0x4'));var controller=require(_0xcd40('0x5'));router[_0xcd40('0x6')]('/',auth[_0xcd40('0x7')](),controller[_0xcd40('0x8')]);router['get'](_0xcd40('0x9'),auth[_0xcd40('0x7')](),controller[_0xcd40('0xa')]);router[_0xcd40('0x6')](_0xcd40('0xb'),auth[_0xcd40('0x7')](),controller['show']);router['post']('/',auth[_0xcd40('0x7')](),controller['create']);router['put'](_0xcd40('0xb'),auth[_0xcd40('0x7')](),controller[_0xcd40('0xc')]);router[_0xcd40('0xd')](_0xcd40('0xb'),auth[_0xcd40('0x7')](),controller[_0xcd40('0xe')]);module[_0xcd40('0xf')]=router; \ No newline at end of file diff --git a/server/api/mailQueueReport/mailQueueReport.attributes.js b/server/api/mailQueueReport/mailQueueReport.attributes.js index 461a1e9..435023b 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 _0x681f=['STRING','DATE','moment','sequelize'];(function(_0x32d457,_0x1a39c9){var _0x338386=function(_0x199d7a){while(--_0x199d7a){_0x32d457['push'](_0x32d457['shift']());}};_0x338386(++_0x1a39c9);}(_0x681f,0x11a));var _0xf681=function(_0x567857,_0x167c33){_0x567857=_0x567857-0x0;var _0x31d919=_0x681f[_0x567857];return _0x31d919;};'use strict';var moment=require(_0xf681('0x0'));var Sequelize=require(_0xf681('0x1'));module['exports']={'uniqueid':{'type':Sequelize[_0xf681('0x2')],'allowNull':![]},'from':{'type':Sequelize['STRING']},'joinAt':{'type':Sequelize[_0xf681('0x3')]},'leaveAt':{'type':Sequelize[_0xf681('0x3')]},'acceptAt':{'type':Sequelize[_0xf681('0x3')]},'exitAt':{'type':Sequelize[_0xf681('0x3')]},'reason':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x963a=['moment','sequelize','exports','DATE','STRING'];(function(_0x254f44,_0x3b5359){var _0x47a7a6=function(_0x3cedd3){while(--_0x3cedd3){_0x254f44['push'](_0x254f44['shift']());}};_0x47a7a6(++_0x3b5359);}(_0x963a,0x17c));var _0xa963=function(_0x291540,_0xed1160){_0x291540=_0x291540-0x0;var _0x42c431=_0x963a[_0x291540];return _0x42c431;};'use strict';var moment=require(_0xa963('0x0'));var Sequelize=require(_0xa963('0x1'));module[_0xa963('0x2')]={'uniqueid':{'type':Sequelize['STRING'],'allowNull':![]},'from':{'type':Sequelize['STRING']},'joinAt':{'type':Sequelize[_0xa963('0x3')]},'leaveAt':{'type':Sequelize[_0xa963('0x3')]},'acceptAt':{'type':Sequelize[_0xa963('0x3')]},'exitAt':{'type':Sequelize[_0xa963('0x3')]},'reason':{'type':Sequelize[_0xa963('0x4')]}}; \ No newline at end of file diff --git a/server/api/mailQueueReport/mailQueueReport.controller.js b/server/api/mailQueueReport/mailQueueReport.controller.js index 0a7f094..d1b2726 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 _0xc492=['save','update','then','destroy','stack','name','index','MailQueueReport','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','filter','where','merge','map','VIRTUAL','options','includeAll','include','findAll','rows','show','find','catch','create','body','params','describe','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','to-csv','lodash','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','count','offset','limit','Content-Range','apply'];(function(_0x53f0db,_0x35c67c){var _0xae0a5c=function(_0x4bd6fb){while(--_0x4bd6fb){_0x53f0db['push'](_0x53f0db['shift']());}};_0xae0a5c(++_0x35c67c);}(_0xc492,0x19b));var _0x2c49=function(_0x1141d9,_0x521965){_0x1141d9=_0x1141d9-0x0;var _0x31fac9=_0xc492[_0x1141d9];return _0x31fac9;};'use strict';var pdf=require(_0x2c49('0x0'));var emlformat=require(_0x2c49('0x1'));var rimraf=require(_0x2c49('0x2'));var zipdir=require(_0x2c49('0x3'));var jsonpatch=require(_0x2c49('0x4'));var rp=require(_0x2c49('0x5'));var moment=require(_0x2c49('0x6'));var BPromise=require(_0x2c49('0x7'));var Mustache=require('mustache');var util=require(_0x2c49('0x8'));var path=require(_0x2c49('0x9'));var sox=require('sox');var csv=require(_0x2c49('0xa'));var ejs=require('ejs');var fs=require('fs');var _=require(_0x2c49('0xb'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x2c49('0xc'));var deskjs=require(_0x2c49('0xd'));var toCsv=require(_0x2c49('0xa'));var querystring=require('querystring');var Papa=require(_0x2c49('0xe'));var Redis=require(_0x2c49('0xf'));var authService=require(_0x2c49('0x10'));var qs=require(_0x2c49('0x11'));var as=require(_0x2c49('0x12'));var hardwareService=require(_0x2c49('0x13'));var logger=require(_0x2c49('0x14'))('api');var utils=require(_0x2c49('0x15'));var config=require(_0x2c49('0x16'));var db=require(_0x2c49('0x17'))['db'];function respondWithStatusCode(_0xe90688,_0x3cb06c){_0x3cb06c=_0x3cb06c||0xcc;return function(_0x58580f){if(_0x58580f){return _0xe90688[_0x2c49('0x18')](_0x3cb06c);}return _0xe90688[_0x2c49('0x19')](_0x3cb06c)[_0x2c49('0x1a')]();};}function respondWithResult(_0x536575,_0x30401e){_0x30401e=_0x30401e||0xc8;return function(_0x4b3556){if(_0x4b3556){return _0x536575[_0x2c49('0x19')](_0x30401e)[_0x2c49('0x1b')](_0x4b3556);}};}function respondWithFilteredResult(_0x4c6873,_0x82e895){return function(_0x1fce78){if(_0x1fce78){var _0x3a2114=_0x1fce78[_0x2c49('0x1c')],_0xbb2532=_0x82e895['offset'],_0x1d496d=_0x82e895[_0x2c49('0x1d')]+_0x82e895[_0x2c49('0x1e')],_0x5a3501;if(_0x1d496d>=_0x3a2114){_0x1d496d=_0x3a2114;_0x5a3501=0xc8;}else{_0x5a3501=0xce;}_0x4c6873[_0x2c49('0x19')](_0x5a3501);return _0x4c6873['set'](_0x2c49('0x1f'),_0xbb2532+'-'+_0x1d496d+'/'+_0x3a2114)[_0x2c49('0x1b')](_0x1fce78);}return null;};}function patchUpdates(_0x3aa154){return function(_0x19cb3a){try{jsonpatch[_0x2c49('0x20')](_0x19cb3a,_0x3aa154,!![]);}catch(_0x4afb51){return BPromise['reject'](_0x4afb51);}return _0x19cb3a[_0x2c49('0x21')]();};}function saveUpdates(_0xdb3aba,_0x22181d){return function(_0xa1d24a){if(_0xa1d24a){return _0xa1d24a[_0x2c49('0x22')](_0xdb3aba)[_0x2c49('0x23')](function(_0x28e0e9){return _0x28e0e9;});}return null;};}function removeEntity(_0x2bb660,_0x10b0dc){return function(_0xcf4ac){if(_0xcf4ac){return _0xcf4ac[_0x2c49('0x24')]()[_0x2c49('0x23')](function(){_0x2bb660[_0x2c49('0x19')](0xcc)[_0x2c49('0x1a')]();});}};}function handleEntityNotFound(_0x39490c,_0x1459f3){return function(_0x55869f){if(!_0x55869f){_0x39490c[_0x2c49('0x18')](0x194);}return _0x55869f;};}function handleError(_0x985008,_0x2eea07){_0x2eea07=_0x2eea07||0x1f4;return function(_0x399769){logger['error'](_0x399769[_0x2c49('0x25')]);if(_0x399769[_0x2c49('0x26')]){delete _0x399769[_0x2c49('0x26')];}_0x985008[_0x2c49('0x19')](_0x2eea07)['send'](_0x399769);};}exports[_0x2c49('0x27')]=function(_0x39f444,_0x2af5a4){var _0x15a144={},_0x2178de={},_0x20256b={'count':0x0,'rows':[]};var _0x56e152=_['map'](db[_0x2c49('0x28')][_0x2c49('0x29')],function(_0x363859){return{'name':_0x363859[_0x2c49('0x2a')],'type':_0x363859[_0x2c49('0x2b')][_0x2c49('0x2c')]};});_0x2178de[_0x2c49('0x2d')]=_['map'](_0x56e152,_0x2c49('0x26'));_0x2178de[_0x2c49('0x2e')]=_[_0x2c49('0x2f')](_0x39f444[_0x2c49('0x2e')]);_0x2178de[_0x2c49('0x30')]=_[_0x2c49('0x31')](_0x2178de[_0x2c49('0x2d')],_0x2178de['query']);_0x15a144['attributes']=_[_0x2c49('0x31')](_0x2178de[_0x2c49('0x2d')],qs[_0x2c49('0x32')](_0x39f444[_0x2c49('0x2e')][_0x2c49('0x32')]));_0x15a144[_0x2c49('0x33')]=_0x15a144[_0x2c49('0x33')][_0x2c49('0x34')]?_0x15a144['attributes']:_0x2178de['model'];if(!_0x39f444['query'][_0x2c49('0x35')](_0x2c49('0x36'))){_0x15a144[_0x2c49('0x1e')]=qs[_0x2c49('0x1e')](_0x39f444[_0x2c49('0x2e')][_0x2c49('0x1e')]);_0x15a144[_0x2c49('0x1d')]=qs[_0x2c49('0x1d')](_0x39f444['query'][_0x2c49('0x1d')]);}_0x15a144[_0x2c49('0x37')]=qs['sort'](_0x39f444[_0x2c49('0x2e')][_0x2c49('0x38')]);_0x15a144['where']=qs[_0x2c49('0x30')](_['pick'](_0x39f444[_0x2c49('0x2e')],_0x2178de[_0x2c49('0x30')]));if(_0x39f444[_0x2c49('0x2e')][_0x2c49('0x39')]){_0x15a144[_0x2c49('0x3a')]=_[_0x2c49('0x3b')](_0x15a144[_0x2c49('0x3a')],{'$or':_[_0x2c49('0x3c')](_0x56e152,function(_0x6dac29){if(_0x6dac29['type']!==_0x2c49('0x3d')){var _0x4b84b9={};_0x4b84b9[_0x6dac29[_0x2c49('0x26')]]={'$like':'%'+_0x39f444[_0x2c49('0x2e')][_0x2c49('0x39')]+'%'};return _0x4b84b9;}})});}_0x15a144=_['merge']({},_0x15a144,_0x39f444[_0x2c49('0x3e')]);var _0x3a7794={'where':_0x15a144['where']};return db['MailQueueReport'][_0x2c49('0x1c')](_0x3a7794)[_0x2c49('0x23')](function(_0x27fd78){_0x20256b[_0x2c49('0x1c')]=_0x27fd78;if(_0x39f444[_0x2c49('0x2e')][_0x2c49('0x3f')]){_0x15a144[_0x2c49('0x40')]=[{'all':!![]}];}return db[_0x2c49('0x28')][_0x2c49('0x41')](_0x15a144);})[_0x2c49('0x23')](function(_0x4ef13b){_0x20256b[_0x2c49('0x42')]=_0x4ef13b;return _0x20256b;})[_0x2c49('0x23')](respondWithFilteredResult(_0x2af5a4,_0x15a144))['catch'](handleError(_0x2af5a4,null));};exports[_0x2c49('0x43')]=function(_0x4a6d1e,_0xe36509){var _0x4d1ac6={'raw':!![],'where':{'id':_0x4a6d1e['params']['id']}},_0x62bedf={};_0x62bedf[_0x2c49('0x2d')]=_[_0x2c49('0x2f')](db[_0x2c49('0x28')][_0x2c49('0x29')]);_0x62bedf[_0x2c49('0x2e')]=_[_0x2c49('0x2f')](_0x4a6d1e[_0x2c49('0x2e')]);_0x62bedf[_0x2c49('0x30')]=_['intersection'](_0x62bedf['model'],_0x62bedf[_0x2c49('0x2e')]);_0x4d1ac6[_0x2c49('0x33')]=_[_0x2c49('0x31')](_0x62bedf[_0x2c49('0x2d')],qs['fields'](_0x4a6d1e[_0x2c49('0x2e')][_0x2c49('0x32')]));_0x4d1ac6['attributes']=_0x4d1ac6[_0x2c49('0x33')][_0x2c49('0x34')]?_0x4d1ac6['attributes']:_0x62bedf[_0x2c49('0x2d')];if(_0x4a6d1e[_0x2c49('0x2e')][_0x2c49('0x3f')]){_0x4d1ac6['include']=[{'all':!![]}];}_0x4d1ac6=_[_0x2c49('0x3b')]({},_0x4d1ac6,_0x4a6d1e[_0x2c49('0x3e')]);return db[_0x2c49('0x28')][_0x2c49('0x44')](_0x4d1ac6)['then'](handleEntityNotFound(_0xe36509,null))[_0x2c49('0x23')](respondWithResult(_0xe36509,null))[_0x2c49('0x45')](handleError(_0xe36509,null));};exports[_0x2c49('0x46')]=function(_0x238fbd,_0x269b0f){return db['MailQueueReport'][_0x2c49('0x46')](_0x238fbd[_0x2c49('0x47')],{})[_0x2c49('0x23')](respondWithResult(_0x269b0f,0xc9))[_0x2c49('0x45')](handleError(_0x269b0f,null));};exports['update']=function(_0x355522,_0x58a7d2){if(_0x355522[_0x2c49('0x47')]['id']){delete _0x355522[_0x2c49('0x47')]['id'];}return db[_0x2c49('0x28')][_0x2c49('0x44')]({'where':{'id':_0x355522['params']['id']}})['then'](handleEntityNotFound(_0x58a7d2,null))[_0x2c49('0x23')](saveUpdates(_0x355522['body'],null))[_0x2c49('0x23')](respondWithResult(_0x58a7d2,null))[_0x2c49('0x45')](handleError(_0x58a7d2,null));};exports[_0x2c49('0x24')]=function(_0x2f3024,_0x58444d){return db['MailQueueReport'][_0x2c49('0x44')]({'where':{'id':_0x2f3024[_0x2c49('0x48')]['id']}})[_0x2c49('0x23')](handleEntityNotFound(_0x58444d,null))[_0x2c49('0x23')](removeEntity(_0x58444d,null))[_0x2c49('0x45')](handleError(_0x58444d,null));};exports[_0x2c49('0x49')]=function(_0x483ae6,_0xe38b72){return db[_0x2c49('0x28')][_0x2c49('0x49')]()['then'](respondWithResult(_0xe38b72,null))['catch'](handleError(_0xe38b72,null));}; \ No newline at end of file +var _0x63e7=['to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','sendStatus','status','json','count','offset','set','Content-Range','apply','reject','save','update','then','end','error','stack','name','send','map','MailQueueReport','rawAttributes','fieldName','type','query','filters','intersection','model','fields','attributes','length','nolimit','limit','order','sort','where','pick','merge','VIRTUAL','options','include','findAll','rows','catch','show','params','keys','includeAll','find','create','body','destroy','describe','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','path','sox'];(function(_0x51020b,_0x38c2c7){var _0x371e47=function(_0x2a538f){while(--_0x2a538f){_0x51020b['push'](_0x51020b['shift']());}};_0x371e47(++_0x38c2c7);}(_0x63e7,0x8e));var _0x763e=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0x63e7[_0xa464c9];return _0x3d73c4;};'use strict';var pdf=require('html-pdf');var emlformat=require('eml-format');var rimraf=require(_0x763e('0x0'));var zipdir=require(_0x763e('0x1'));var jsonpatch=require(_0x763e('0x2'));var rp=require('request-promise');var moment=require(_0x763e('0x3'));var BPromise=require(_0x763e('0x4'));var Mustache=require(_0x763e('0x5'));var util=require('util');var path=require(_0x763e('0x6'));var sox=require(_0x763e('0x7'));var csv=require(_0x763e('0x8'));var ejs=require(_0x763e('0x9'));var fs=require('fs');var _=require(_0x763e('0xa'));var squel=require(_0x763e('0xb'));var crypto=require(_0x763e('0xc'));var jsforce=require(_0x763e('0xd'));var deskjs=require(_0x763e('0xe'));var toCsv=require(_0x763e('0x8'));var querystring=require('querystring');var Papa=require(_0x763e('0xf'));var Redis=require(_0x763e('0x10'));var authService=require(_0x763e('0x11'));var qs=require(_0x763e('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x763e('0x13'));var logger=require(_0x763e('0x14'))(_0x763e('0x15'));var utils=require(_0x763e('0x16'));var config=require(_0x763e('0x17'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x3aae20,_0x4408c2){_0x4408c2=_0x4408c2||0xcc;return function(_0x45d417){if(_0x45d417){return _0x3aae20[_0x763e('0x18')](_0x4408c2);}return _0x3aae20[_0x763e('0x19')](_0x4408c2)['end']();};}function respondWithResult(_0x5c16b5,_0x2dabb4){_0x2dabb4=_0x2dabb4||0xc8;return function(_0x4387ec){if(_0x4387ec){return _0x5c16b5[_0x763e('0x19')](_0x2dabb4)[_0x763e('0x1a')](_0x4387ec);}};}function respondWithFilteredResult(_0x12823a,_0x3ae2b8){return function(_0x1dd4ff){if(_0x1dd4ff){var _0x40233a=_0x1dd4ff[_0x763e('0x1b')],_0x3e581a=_0x3ae2b8['offset'],_0x2de7c3=_0x3ae2b8[_0x763e('0x1c')]+_0x3ae2b8['limit'],_0x2956a7;if(_0x2de7c3>=_0x40233a){_0x2de7c3=_0x40233a;_0x2956a7=0xc8;}else{_0x2956a7=0xce;}_0x12823a['status'](_0x2956a7);return _0x12823a[_0x763e('0x1d')](_0x763e('0x1e'),_0x3e581a+'-'+_0x2de7c3+'/'+_0x40233a)['json'](_0x1dd4ff);}return null;};}function patchUpdates(_0x188501){return function(_0x3b1bb1){try{jsonpatch[_0x763e('0x1f')](_0x3b1bb1,_0x188501,!![]);}catch(_0x2226af){return BPromise[_0x763e('0x20')](_0x2226af);}return _0x3b1bb1[_0x763e('0x21')]();};}function saveUpdates(_0x4577d1,_0x221eea){return function(_0xbecb9a){if(_0xbecb9a){return _0xbecb9a[_0x763e('0x22')](_0x4577d1)[_0x763e('0x23')](function(_0xd67327){return _0xd67327;});}return null;};}function removeEntity(_0xbd401b,_0x166ba6){return function(_0x5cb6a4){if(_0x5cb6a4){return _0x5cb6a4['destroy']()['then'](function(){_0xbd401b[_0x763e('0x19')](0xcc)[_0x763e('0x24')]();});}};}function handleEntityNotFound(_0x4aac1a,_0x1dfddd){return function(_0x335c05){if(!_0x335c05){_0x4aac1a[_0x763e('0x18')](0x194);}return _0x335c05;};}function handleError(_0x5724e9,_0x420565){_0x420565=_0x420565||0x1f4;return function(_0x5dbcfb){logger[_0x763e('0x25')](_0x5dbcfb[_0x763e('0x26')]);if(_0x5dbcfb[_0x763e('0x27')]){delete _0x5dbcfb[_0x763e('0x27')];}_0x5724e9['status'](_0x420565)[_0x763e('0x28')](_0x5dbcfb);};}exports['index']=function(_0x51a740,_0x329456){var _0xb24f05={},_0x1b741d={},_0x2ea1db={'count':0x0,'rows':[]};var _0x25e815=_[_0x763e('0x29')](db[_0x763e('0x2a')][_0x763e('0x2b')],function(_0x46ebe4){return{'name':_0x46ebe4[_0x763e('0x2c')],'type':_0x46ebe4[_0x763e('0x2d')]['key']};});_0x1b741d['model']=_['map'](_0x25e815,_0x763e('0x27'));_0x1b741d[_0x763e('0x2e')]=_['keys'](_0x51a740[_0x763e('0x2e')]);_0x1b741d[_0x763e('0x2f')]=_[_0x763e('0x30')](_0x1b741d[_0x763e('0x31')],_0x1b741d[_0x763e('0x2e')]);_0xb24f05['attributes']=_[_0x763e('0x30')](_0x1b741d[_0x763e('0x31')],qs[_0x763e('0x32')](_0x51a740[_0x763e('0x2e')][_0x763e('0x32')]));_0xb24f05[_0x763e('0x33')]=_0xb24f05[_0x763e('0x33')][_0x763e('0x34')]?_0xb24f05[_0x763e('0x33')]:_0x1b741d[_0x763e('0x31')];if(!_0x51a740['query']['hasOwnProperty'](_0x763e('0x35'))){_0xb24f05[_0x763e('0x36')]=qs['limit'](_0x51a740['query'][_0x763e('0x36')]);_0xb24f05['offset']=qs[_0x763e('0x1c')](_0x51a740[_0x763e('0x2e')]['offset']);}_0xb24f05[_0x763e('0x37')]=qs[_0x763e('0x38')](_0x51a740[_0x763e('0x2e')][_0x763e('0x38')]);_0xb24f05[_0x763e('0x39')]=qs[_0x763e('0x2f')](_[_0x763e('0x3a')](_0x51a740['query'],_0x1b741d[_0x763e('0x2f')]));if(_0x51a740[_0x763e('0x2e')]['filter']){_0xb24f05[_0x763e('0x39')]=_[_0x763e('0x3b')](_0xb24f05['where'],{'$or':_[_0x763e('0x29')](_0x25e815,function(_0x3cae9f){if(_0x3cae9f[_0x763e('0x2d')]!==_0x763e('0x3c')){var _0x3baa17={};_0x3baa17[_0x3cae9f[_0x763e('0x27')]]={'$like':'%'+_0x51a740[_0x763e('0x2e')]['filter']+'%'};return _0x3baa17;}})});}_0xb24f05=_[_0x763e('0x3b')]({},_0xb24f05,_0x51a740[_0x763e('0x3d')]);var _0x317e12={'where':_0xb24f05['where']};return db[_0x763e('0x2a')]['count'](_0x317e12)['then'](function(_0x2ce8dd){_0x2ea1db[_0x763e('0x1b')]=_0x2ce8dd;if(_0x51a740[_0x763e('0x2e')]['includeAll']){_0xb24f05[_0x763e('0x3e')]=[{'all':!![]}];}return db[_0x763e('0x2a')][_0x763e('0x3f')](_0xb24f05);})['then'](function(_0x1aca30){_0x2ea1db[_0x763e('0x40')]=_0x1aca30;return _0x2ea1db;})[_0x763e('0x23')](respondWithFilteredResult(_0x329456,_0xb24f05))[_0x763e('0x41')](handleError(_0x329456,null));};exports[_0x763e('0x42')]=function(_0x3e2aa8,_0x53fcab){var _0x80dee6={'raw':!![],'where':{'id':_0x3e2aa8[_0x763e('0x43')]['id']}},_0x31060a={};_0x31060a['model']=_[_0x763e('0x44')](db['MailQueueReport'][_0x763e('0x2b')]);_0x31060a[_0x763e('0x2e')]=_[_0x763e('0x44')](_0x3e2aa8[_0x763e('0x2e')]);_0x31060a[_0x763e('0x2f')]=_['intersection'](_0x31060a[_0x763e('0x31')],_0x31060a[_0x763e('0x2e')]);_0x80dee6[_0x763e('0x33')]=_[_0x763e('0x30')](_0x31060a[_0x763e('0x31')],qs[_0x763e('0x32')](_0x3e2aa8['query']['fields']));_0x80dee6[_0x763e('0x33')]=_0x80dee6[_0x763e('0x33')][_0x763e('0x34')]?_0x80dee6[_0x763e('0x33')]:_0x31060a[_0x763e('0x31')];if(_0x3e2aa8[_0x763e('0x2e')][_0x763e('0x45')]){_0x80dee6[_0x763e('0x3e')]=[{'all':!![]}];}_0x80dee6=_[_0x763e('0x3b')]({},_0x80dee6,_0x3e2aa8[_0x763e('0x3d')]);return db[_0x763e('0x2a')][_0x763e('0x46')](_0x80dee6)[_0x763e('0x23')](handleEntityNotFound(_0x53fcab,null))[_0x763e('0x23')](respondWithResult(_0x53fcab,null))['catch'](handleError(_0x53fcab,null));};exports[_0x763e('0x47')]=function(_0x207f23,_0x30c89d){return db[_0x763e('0x2a')][_0x763e('0x47')](_0x207f23['body'],{})[_0x763e('0x23')](respondWithResult(_0x30c89d,0xc9))['catch'](handleError(_0x30c89d,null));};exports['update']=function(_0x23275b,_0x87f832){if(_0x23275b[_0x763e('0x48')]['id']){delete _0x23275b['body']['id'];}return db[_0x763e('0x2a')]['find']({'where':{'id':_0x23275b['params']['id']}})['then'](handleEntityNotFound(_0x87f832,null))[_0x763e('0x23')](saveUpdates(_0x23275b[_0x763e('0x48')],null))[_0x763e('0x23')](respondWithResult(_0x87f832,null))[_0x763e('0x41')](handleError(_0x87f832,null));};exports[_0x763e('0x49')]=function(_0x1b6361,_0x578d5a){return db[_0x763e('0x2a')][_0x763e('0x46')]({'where':{'id':_0x1b6361[_0x763e('0x43')]['id']}})[_0x763e('0x23')](handleEntityNotFound(_0x578d5a,null))[_0x763e('0x23')](removeEntity(_0x578d5a,null))[_0x763e('0x41')](handleError(_0x578d5a,null));};exports[_0x763e('0x4a')]=function(_0x28e054,_0x3c3772){return db[_0x763e('0x2a')][_0x763e('0x4a')]()[_0x763e('0x23')](respondWithResult(_0x3c3772,null))['catch'](handleError(_0x3c3772,null));}; \ No newline at end of file diff --git a/server/api/mailQueueReport/mailQueueReport.model.js b/server/api/mailQueueReport/mailQueueReport.model.js index cb38a31..137d8aa 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 _0x8e00=['./mailQueueReport.attributes','exports','define','MailQueueReport','report_mail_queue','lodash','../../config/logger','request-promise','path','rimraf'];(function(_0x30f568,_0x365510){var _0x535d1e=function(_0x3f1f48){while(--_0x3f1f48){_0x30f568['push'](_0x30f568['shift']());}};_0x535d1e(++_0x365510);}(_0x8e00,0x159));var _0x08e0=function(_0x29d8b6,_0x4157e1){_0x29d8b6=_0x29d8b6-0x0;var _0x1caf48=_0x8e00[_0x29d8b6];return _0x1caf48;};'use strict';var _=require(_0x08e0('0x0'));var util=require('util');var logger=require(_0x08e0('0x1'))('api');var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x08e0('0x2'));var fs=require('fs');var path=require(_0x08e0('0x3'));var rimraf=require(_0x08e0('0x4'));var config=require('../../config/environment');var attributes=require(_0x08e0('0x5'));module[_0x08e0('0x6')]=function(_0x4e73c1,_0x131223){return _0x4e73c1[_0x08e0('0x7')](_0x08e0('0x8'),attributes,{'tableName':_0x08e0('0x9'),'paranoid':![],'indexes':[{'name':'uniqueid','fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file +var _0x7259=['moment','bluebird','path','rimraf','../../config/environment','MailQueueReport','uniqueid','lodash','util','../../config/logger','api'];(function(_0x322230,_0x5765a2){var _0x4dd28a=function(_0x389c5d){while(--_0x389c5d){_0x322230['push'](_0x322230['shift']());}};_0x4dd28a(++_0x5765a2);}(_0x7259,0xee));var _0x9725=function(_0x3a9121,_0x212f9d){_0x3a9121=_0x3a9121-0x0;var _0x5e46d0=_0x7259[_0x3a9121];return _0x5e46d0;};'use strict';var _=require(_0x9725('0x0'));var util=require(_0x9725('0x1'));var logger=require(_0x9725('0x2'))(_0x9725('0x3'));var moment=require(_0x9725('0x4'));var BPromise=require(_0x9725('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x9725('0x6'));var rimraf=require(_0x9725('0x7'));var config=require(_0x9725('0x8'));var attributes=require('./mailQueueReport.attributes');module['exports']=function(_0x233254,_0x77d44b){return _0x233254['define'](_0x9725('0x9'),attributes,{'tableName':'report_mail_queue','paranoid':![],'indexes':[{'name':_0x9725('0xa'),'fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/mailQueueReport/mailQueueReport.rpc.js b/server/api/mailQueueReport/mailQueueReport.rpc.js index 4b5c058..66d8add 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 _0x326f=['error','code','message','result','catch','CreateMailQueueReport','MailQueueReport','options','raw','stringify','UpdateMailQueueReport','body','attributes','lodash','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','info','MailQueueReport,\x20%s,\x20%s','request\x20sent','debug'];(function(_0xea8f67,_0x47538d){var _0x22655b=function(_0x10f45c){while(--_0x10f45c){_0xea8f67['push'](_0xea8f67['shift']());}};_0x22655b(++_0x47538d);}(_0x326f,0xd1));var _0xf326=function(_0x52159d,_0x59992c){_0x52159d=_0x52159d-0x0;var _0x44a0b1=_0x326f[_0x52159d];return _0x44a0b1;};'use strict';var _=require(_0xf326('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0xf326('0x1'));var rs=require(_0xf326('0x2'));var fs=require('fs');var Redis=require(_0xf326('0x3'));var db=require(_0xf326('0x4'))['db'];var utils=require(_0xf326('0x5'));var logger=require(_0xf326('0x6'))(_0xf326('0x7'));var config=require(_0xf326('0x8'));var jayson=require(_0xf326('0x9'));var client=jayson[_0xf326('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x3c254d,_0x3851eb,_0x165f95){return new BPromise(function(_0x1e7b8a,_0x515bfa){return client['request'](_0x3c254d,_0x165f95)['then'](function(_0x3bacf2){logger[_0xf326('0xb')](_0xf326('0xc'),_0x3851eb,_0xf326('0xd'));logger[_0xf326('0xe')]('MailQueueReport,\x20%s,\x20%s,\x20%s',_0x3851eb,_0xf326('0xd'),JSON['stringify'](_0x3bacf2));if(_0x3bacf2[_0xf326('0xf')]){if(_0x3bacf2['error'][_0xf326('0x10')]===0x1f4){logger['error'](_0xf326('0xc'),_0x3851eb,_0x3bacf2[_0xf326('0xf')]['message']);return _0x515bfa(_0x3bacf2[_0xf326('0xf')][_0xf326('0x11')]);}logger[_0xf326('0xf')](_0xf326('0xc'),_0x3851eb,_0x3bacf2['error'][_0xf326('0x11')]);return _0x1e7b8a(_0x3bacf2['error']['message']);}else{logger[_0xf326('0xb')](_0xf326('0xc'),_0x3851eb,_0xf326('0xd'));_0x1e7b8a(_0x3bacf2[_0xf326('0x12')][_0xf326('0x11')]);}})[_0xf326('0x13')](function(_0x34128e){logger[_0xf326('0xf')]('MailQueueReport,\x20%s,\x20%s',_0x3851eb,_0x34128e);_0x515bfa(_0x34128e);});});}exports[_0xf326('0x14')]=function(_0x453100){var _0x18bee3=this;return new Promise(function(_0x31ffb9,_0xcef2b5){return db[_0xf326('0x15')]['create'](_0x453100['body'],{'raw':_0x453100['options']?_0x453100[_0xf326('0x16')][_0xf326('0x17')]===undefined?!![]:![]:!![]})['then'](function(_0x4cabce){logger[_0xf326('0xb')]('CreateMailQueueReport',_0x453100);logger['debug'](_0xf326('0x14'),_0x453100,JSON[_0xf326('0x18')](_0x4cabce));_0x31ffb9(_0x4cabce);})['catch'](function(_0x5aa184){logger[_0xf326('0xf')](_0xf326('0x14'),_0x5aa184['message'],_0x453100);_0xcef2b5(_0x18bee3[_0xf326('0xf')](0x1f4,_0x5aa184[_0xf326('0x11')]));});});};exports[_0xf326('0x19')]=function(_0x295752){var _0x17c157=this;return new Promise(function(_0x2049ec,_0x5ce532){return db['MailQueueReport']['update'](_0x295752[_0xf326('0x1a')],{'raw':_0x295752[_0xf326('0x16')]?_0x295752[_0xf326('0x16')][_0xf326('0x17')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x295752[_0xf326('0x16')]?_0x295752[_0xf326('0x16')]['where']||null:null,'attributes':_0x295752[_0xf326('0x16')]?_0x295752[_0xf326('0x16')][_0xf326('0x1b')]||null:null,'limit':_0x295752['options']?_0x295752[_0xf326('0x16')]['limit']||null:null})['then'](function(_0x6a8e89){logger[_0xf326('0xb')](_0xf326('0x19'),_0x295752);logger['debug'](_0xf326('0x19'),_0x295752,JSON[_0xf326('0x18')](_0x6a8e89));_0x2049ec(_0x6a8e89);})['catch'](function(_0x225776){logger[_0xf326('0xf')](_0xf326('0x19'),_0x225776[_0xf326('0x11')],_0x295752);_0x5ce532(_0x17c157[_0xf326('0xf')](0x1f4,_0x225776[_0xf326('0x11')]));});});}; \ No newline at end of file +var _0x53ec=['randomstring','ioredis','../../config/utils','rpc','../../config/environment','client','request','then','info','MailQueueReport,\x20%s,\x20%s','request\x20sent','debug','stringify','code','error','message','catch','CreateMailQueueReport','create','body','options','raw','UpdateMailQueueReport','update','attributes','lodash','util','moment','bluebird'];(function(_0xfcd842,_0x38992f){var _0x5441da=function(_0x44739a){while(--_0x44739a){_0xfcd842['push'](_0xfcd842['shift']());}};_0x5441da(++_0x38992f);}(_0x53ec,0x192));var _0xc53e=function(_0x487d56,_0x1d4a80){_0x487d56=_0x487d56-0x0;var _0x3f409f=_0x53ec[_0x487d56];return _0x3f409f;};'use strict';var _=require(_0xc53e('0x0'));var util=require(_0xc53e('0x1'));var moment=require(_0xc53e('0x2'));var BPromise=require(_0xc53e('0x3'));var rs=require(_0xc53e('0x4'));var fs=require('fs');var Redis=require(_0xc53e('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0xc53e('0x6'));var logger=require('../../config/logger')(_0xc53e('0x7'));var config=require(_0xc53e('0x8'));var jayson=require('jayson/promise');var client=jayson[_0xc53e('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x41a9e8,_0x2de88b,_0x5d3b28){return new BPromise(function(_0x1616ac,_0x1ac6c0){return client[_0xc53e('0xa')](_0x41a9e8,_0x5d3b28)[_0xc53e('0xb')](function(_0xd9612){logger[_0xc53e('0xc')](_0xc53e('0xd'),_0x2de88b,_0xc53e('0xe'));logger[_0xc53e('0xf')]('MailQueueReport,\x20%s,\x20%s,\x20%s',_0x2de88b,'request\x20sent',JSON[_0xc53e('0x10')](_0xd9612));if(_0xd9612['error']){if(_0xd9612['error'][_0xc53e('0x11')]===0x1f4){logger[_0xc53e('0x12')](_0xc53e('0xd'),_0x2de88b,_0xd9612[_0xc53e('0x12')]['message']);return _0x1ac6c0(_0xd9612['error'][_0xc53e('0x13')]);}logger[_0xc53e('0x12')](_0xc53e('0xd'),_0x2de88b,_0xd9612[_0xc53e('0x12')][_0xc53e('0x13')]);return _0x1616ac(_0xd9612[_0xc53e('0x12')][_0xc53e('0x13')]);}else{logger[_0xc53e('0xc')](_0xc53e('0xd'),_0x2de88b,_0xc53e('0xe'));_0x1616ac(_0xd9612['result'][_0xc53e('0x13')]);}})[_0xc53e('0x14')](function(_0x535cd4){logger[_0xc53e('0x12')](_0xc53e('0xd'),_0x2de88b,_0x535cd4);_0x1ac6c0(_0x535cd4);});});}exports[_0xc53e('0x15')]=function(_0x164016){var _0x2d4ebb=this;return new Promise(function(_0x3b550e,_0x5d1098){return db['MailQueueReport'][_0xc53e('0x16')](_0x164016[_0xc53e('0x17')],{'raw':_0x164016[_0xc53e('0x18')]?_0x164016[_0xc53e('0x18')][_0xc53e('0x19')]===undefined?!![]:![]:!![]})[_0xc53e('0xb')](function(_0x15a015){logger[_0xc53e('0xc')](_0xc53e('0x15'),_0x164016);logger[_0xc53e('0xf')](_0xc53e('0x15'),_0x164016,JSON[_0xc53e('0x10')](_0x15a015));_0x3b550e(_0x15a015);})[_0xc53e('0x14')](function(_0x4fb695){logger['error']('CreateMailQueueReport',_0x4fb695[_0xc53e('0x13')],_0x164016);_0x5d1098(_0x2d4ebb[_0xc53e('0x12')](0x1f4,_0x4fb695[_0xc53e('0x13')]));});});};exports[_0xc53e('0x1a')]=function(_0x180811){var _0x5009e1=this;return new Promise(function(_0x5e5377,_0xe06e42){return db['MailQueueReport'][_0xc53e('0x1b')](_0x180811[_0xc53e('0x17')],{'raw':_0x180811[_0xc53e('0x18')]?_0x180811[_0xc53e('0x18')][_0xc53e('0x19')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x180811['options']?_0x180811[_0xc53e('0x18')]['where']||null:null,'attributes':_0x180811['options']?_0x180811['options'][_0xc53e('0x1c')]||null:null,'limit':_0x180811['options']?_0x180811[_0xc53e('0x18')]['limit']||null:null})[_0xc53e('0xb')](function(_0x5112d2){logger['info'](_0xc53e('0x1a'),_0x180811);logger[_0xc53e('0xf')](_0xc53e('0x1a'),_0x180811,JSON[_0xc53e('0x10')](_0x5112d2));_0x5e5377(_0x5112d2);})[_0xc53e('0x14')](function(_0xf97d78){logger[_0xc53e('0x12')](_0xc53e('0x1a'),_0xf97d78['message'],_0x180811);_0xe06e42(_0x5009e1[_0xc53e('0x12')](0x1f4,_0xf97d78[_0xc53e('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/mailServerIn/index.js b/server/api/mailServerIn/index.js index 233c7e6..538e2a9 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 _0x8473=['../../components/auth/service','../../components/interaction/service','exports','util','path','connect-timeout','express'];(function(_0x40dc88,_0x2be34d){var _0x478d02=function(_0x4888c6){while(--_0x4888c6){_0x40dc88['push'](_0x40dc88['shift']());}};_0x478d02(++_0x2be34d);}(_0x8473,0x1d1));var _0x3847=function(_0x29387e,_0x64172f){_0x29387e=_0x29387e-0x0;var _0x100df2=_0x8473[_0x29387e];return _0x100df2;};'use strict';var multer=require('multer');var util=require(_0x3847('0x0'));var path=require(_0x3847('0x1'));var timeout=require(_0x3847('0x2'));var express=require(_0x3847('0x3'));var router=express['Router']();var auth=require(_0x3847('0x4'));var interaction=require(_0x3847('0x5'));var config=require('../../config/environment');module[_0x3847('0x6')]=router; \ No newline at end of file +var _0x73bb=['util','path','connect-timeout','../../components/auth/service','../../components/interaction/service','../../config/environment','exports'];(function(_0x4fde08,_0x463a36){var _0x12e725=function(_0x2670c5){while(--_0x2670c5){_0x4fde08['push'](_0x4fde08['shift']());}};_0x12e725(++_0x463a36);}(_0x73bb,0xcb));var _0xb73b=function(_0x2bc1fe,_0x45da98){_0x2bc1fe=_0x2bc1fe-0x0;var _0x1a47a5=_0x73bb[_0x2bc1fe];return _0x1a47a5;};'use strict';var multer=require('multer');var util=require(_0xb73b('0x0'));var path=require(_0xb73b('0x1'));var timeout=require(_0xb73b('0x2'));var express=require('express');var router=express['Router']();var auth=require(_0xb73b('0x3'));var interaction=require(_0xb73b('0x4'));var config=require(_0xb73b('0x5'));module[_0xb73b('0x6')]=router; \ No newline at end of file diff --git a/server/api/mailServerIn/mailServerIn.attributes.js b/server/api/mailServerIn/mailServerIn.attributes.js index 2d3e012..600935e 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 _0x5aec=['BOOLEAN','username','INTEGER','INBOX','exports','STRING'];(function(_0x560448,_0x2c1082){var _0x550276=function(_0x37e949){while(--_0x37e949){_0x560448['push'](_0x560448['shift']());}};_0x550276(++_0x2c1082);}(_0x5aec,0x1a8));var _0xc5ae=function(_0x565ed7,_0x398228){_0x565ed7=_0x565ed7-0x0;var _0x183ad7=_0x5aec[_0x565ed7];return _0x183ad7;};'use strict';var Sequelize=require('sequelize');module[_0xc5ae('0x0')]={'description':{'type':Sequelize[_0xc5ae('0x1')]},'host':{'type':Sequelize[_0xc5ae('0x1')]},'authentication':{'type':Sequelize[_0xc5ae('0x2')],'defaultValue':!![]},'user':{'type':Sequelize[_0xc5ae('0x1')],'unique':_0xc5ae('0x3')},'password':{'type':Sequelize[_0xc5ae('0x1')]},'port':{'type':Sequelize[_0xc5ae('0x4')]},'tls':{'type':Sequelize[_0xc5ae('0x2')],'defaultValue':!![]},'mailbox':{'type':Sequelize[_0xc5ae('0x1')],'defaultValue':_0xc5ae('0x5')},'connTimeout':{'type':Sequelize['INTEGER'],'defaultValue':0xa},'authTimeout':{'type':Sequelize['INTEGER'],'defaultValue':0x5},'service':{'type':Sequelize[_0xc5ae('0x1')]}}; \ No newline at end of file +var _0x813a=['STRING','username','INTEGER','INBOX','sequelize','exports'];(function(_0x5a6961,_0xd41ca6){var _0x4af0a6=function(_0x1201fe){while(--_0x1201fe){_0x5a6961['push'](_0x5a6961['shift']());}};_0x4af0a6(++_0xd41ca6);}(_0x813a,0x14e));var _0xa813=function(_0x22e858,_0x46e480){_0x22e858=_0x22e858-0x0;var _0x2810ff=_0x813a[_0x22e858];return _0x2810ff;};'use strict';var Sequelize=require(_0xa813('0x0'));module[_0xa813('0x1')]={'description':{'type':Sequelize[_0xa813('0x2')]},'host':{'type':Sequelize['STRING']},'authentication':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'user':{'type':Sequelize[_0xa813('0x2')],'unique':_0xa813('0x3')},'password':{'type':Sequelize['STRING']},'port':{'type':Sequelize[_0xa813('0x4')]},'tls':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'mailbox':{'type':Sequelize[_0xa813('0x2')],'defaultValue':_0xa813('0x5')},'connTimeout':{'type':Sequelize[_0xa813('0x4')],'defaultValue':0xa},'authTimeout':{'type':Sequelize[_0xa813('0x4')],'defaultValue':0x5},'service':{'type':Sequelize[_0xa813('0x2')]}}; \ No newline at end of file diff --git a/server/api/mailServerIn/mailServerIn.model.js b/server/api/mailServerIn/mailServerIn.model.js index 33a184b..ed6a893 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 _0x23a3=['../../config/environment','./mailServerIn.attributes','exports','MailServerIn','mail_servers_in','api','bluebird','request-promise','path','rimraf'];(function(_0xab326c,_0x4c0bd8){var _0x3a4648=function(_0x170c65){while(--_0x170c65){_0xab326c['push'](_0xab326c['shift']());}};_0x3a4648(++_0x4c0bd8);}(_0x23a3,0x131));var _0x323a=function(_0x5f46ee,_0x550dbb){_0x5f46ee=_0x5f46ee-0x0;var _0x5f3804=_0x23a3[_0x5f46ee];return _0x5f3804;};'use strict';var _=require('lodash');var util=require('util');var logger=require('../../config/logger')(_0x323a('0x0'));var moment=require('moment');var BPromise=require(_0x323a('0x1'));var rp=require(_0x323a('0x2'));var fs=require('fs');var path=require(_0x323a('0x3'));var rimraf=require(_0x323a('0x4'));var config=require(_0x323a('0x5'));var attributes=require(_0x323a('0x6'));module[_0x323a('0x7')]=function(_0x3c1648,_0x14a418){return _0x3c1648['define'](_0x323a('0x8'),attributes,{'tableName':_0x323a('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x57f8=['MailServerIn','mail_servers_in','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./mailServerIn.attributes','exports','define'];(function(_0x497b1e,_0x586379){var _0x3f72e1=function(_0x4c227d){while(--_0x4c227d){_0x497b1e['push'](_0x497b1e['shift']());}};_0x3f72e1(++_0x586379);}(_0x57f8,0x198));var _0x857f=function(_0x284807,_0x4be925){_0x284807=_0x284807-0x0;var _0x50c774=_0x57f8[_0x284807];return _0x50c774;};'use strict';var _=require('lodash');var util=require(_0x857f('0x0'));var logger=require(_0x857f('0x1'))(_0x857f('0x2'));var moment=require(_0x857f('0x3'));var BPromise=require(_0x857f('0x4'));var rp=require(_0x857f('0x5'));var fs=require('fs');var path=require(_0x857f('0x6'));var rimraf=require(_0x857f('0x7'));var config=require(_0x857f('0x8'));var attributes=require(_0x857f('0x9'));module[_0x857f('0xa')]=function(_0x369c40,_0x5d22e4){return _0x369c40[_0x857f('0xb')](_0x857f('0xc'),attributes,{'tableName':_0x857f('0xd'),'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 ab26ce3..e70a527 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 _0xf0c0=['error','code','MailServerIn,\x20%s,\x20%s','message','result','catch','GetMailServerIn','MailServerIn','findAll','options','where','attributes','limit','include','map','model','stringify','lodash','util','moment','bluebird','randomstring','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','request','then','info','debug','request\x20sent'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xf0c0,0xf8));var _0x0f0c=function(_0x59f51d,_0x20121a){_0x59f51d=_0x59f51d-0x0;var _0x21f323=_0xf0c0[_0x59f51d];return _0x21f323;};'use strict';var _=require(_0x0f0c('0x0'));var util=require(_0x0f0c('0x1'));var moment=require(_0x0f0c('0x2'));var BPromise=require(_0x0f0c('0x3'));var rs=require(_0x0f0c('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x0f0c('0x5'));var logger=require('../../config/logger')(_0x0f0c('0x6'));var config=require(_0x0f0c('0x7'));var jayson=require(_0x0f0c('0x8'));var client=jayson[_0x0f0c('0x9')][_0x0f0c('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x4ea0f8,_0x2fa3f0,_0xb1a83d){return new BPromise(function(_0x169454,_0x2ebd15){return client[_0x0f0c('0xb')](_0x4ea0f8,_0xb1a83d)[_0x0f0c('0xc')](function(_0x28a496){logger[_0x0f0c('0xd')]('MailServerIn,\x20%s,\x20%s',_0x2fa3f0,'request\x20sent');logger[_0x0f0c('0xe')]('MailServerIn,\x20%s,\x20%s,\x20%s',_0x2fa3f0,_0x0f0c('0xf'),JSON['stringify'](_0x28a496));if(_0x28a496[_0x0f0c('0x10')]){if(_0x28a496[_0x0f0c('0x10')][_0x0f0c('0x11')]===0x1f4){logger[_0x0f0c('0x10')](_0x0f0c('0x12'),_0x2fa3f0,_0x28a496[_0x0f0c('0x10')][_0x0f0c('0x13')]);return _0x2ebd15(_0x28a496[_0x0f0c('0x10')]['message']);}logger[_0x0f0c('0x10')]('MailServerIn,\x20%s,\x20%s',_0x2fa3f0,_0x28a496['error'][_0x0f0c('0x13')]);return _0x169454(_0x28a496[_0x0f0c('0x10')][_0x0f0c('0x13')]);}else{logger[_0x0f0c('0xd')](_0x0f0c('0x12'),_0x2fa3f0,_0x0f0c('0xf'));_0x169454(_0x28a496[_0x0f0c('0x14')][_0x0f0c('0x13')]);}})[_0x0f0c('0x15')](function(_0x428829){logger[_0x0f0c('0x10')](_0x0f0c('0x12'),_0x2fa3f0,_0x428829);_0x2ebd15(_0x428829);});});}exports[_0x0f0c('0x16')]=function(_0x1ceba5){var _0x36e86b=this;return new Promise(function(_0x3fbd9a,_0x15d6e2){return db[_0x0f0c('0x17')][_0x0f0c('0x18')]({'raw':_0x1ceba5[_0x0f0c('0x19')]?_0x1ceba5['options']['raw']===undefined?!![]:![]:!![],'where':_0x1ceba5[_0x0f0c('0x19')]?_0x1ceba5[_0x0f0c('0x19')][_0x0f0c('0x1a')]||null:null,'attributes':_0x1ceba5[_0x0f0c('0x19')]?_0x1ceba5[_0x0f0c('0x19')][_0x0f0c('0x1b')]||null:null,'limit':_0x1ceba5[_0x0f0c('0x19')]?_0x1ceba5[_0x0f0c('0x19')][_0x0f0c('0x1c')]||null:null,'include':_0x1ceba5[_0x0f0c('0x19')]?_0x1ceba5[_0x0f0c('0x19')][_0x0f0c('0x1d')]?_['map'](_0x1ceba5[_0x0f0c('0x19')]['include'],function(_0x192daf){return{'model':db[_0x192daf['model']],'as':_0x192daf['as'],'attributes':_0x192daf[_0x0f0c('0x1b')],'include':_0x192daf[_0x0f0c('0x1d')]?_[_0x0f0c('0x1e')](_0x192daf[_0x0f0c('0x1d')],function(_0x338a46){return{'model':db[_0x338a46[_0x0f0c('0x1f')]],'as':_0x338a46['as'],'attributes':_0x338a46['attributes'],'include':_0x338a46[_0x0f0c('0x1d')]?_['map'](_0x338a46[_0x0f0c('0x1d')],function(_0x5d5f59){return{'model':db[_0x5d5f59['model']],'as':_0x5d5f59['as'],'attributes':_0x5d5f59[_0x0f0c('0x1b')]};}):[]};}):[]};}):[]:[]})[_0x0f0c('0xc')](function(_0x5588c0){logger['info'](_0x0f0c('0x16'),_0x1ceba5);logger[_0x0f0c('0xe')](_0x0f0c('0x16'),_0x1ceba5,JSON[_0x0f0c('0x20')](_0x5588c0));_0x3fbd9a(_0x5588c0);})[_0x0f0c('0x15')](function(_0x7aced2){logger[_0x0f0c('0x10')](_0x0f0c('0x16'),_0x7aced2['message'],_0x1ceba5);_0x15d6e2(_0x36e86b[_0x0f0c('0x10')](0x1f4,_0x7aced2[_0x0f0c('0x13')]));});});}; \ No newline at end of file +var _0x4750=['message','catch','GetMailServerIn','MailServerIn','findAll','raw','options','where','attributes','map','model','include','then','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','jayson/promise','client','request','info','request\x20sent','debug','stringify','error','code','MailServerIn,\x20%s,\x20%s'];(function(_0x17d9e3,_0x1f969c){var _0x14192d=function(_0x159745){while(--_0x159745){_0x17d9e3['push'](_0x17d9e3['shift']());}};_0x14192d(++_0x1f969c);}(_0x4750,0xcd));var _0x0475=function(_0x443379,_0xbf6f5){_0x443379=_0x443379-0x0;var _0x5cf8e7=_0x4750[_0x443379];return _0x5cf8e7;};'use strict';var _=require(_0x0475('0x0'));var util=require(_0x0475('0x1'));var moment=require(_0x0475('0x2'));var BPromise=require(_0x0475('0x3'));var rs=require(_0x0475('0x4'));var fs=require('fs');var Redis=require(_0x0475('0x5'));var db=require(_0x0475('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0x0475('0x7'))(_0x0475('0x8'));var config=require('../../config/environment');var jayson=require(_0x0475('0x9'));var client=jayson[_0x0475('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x3708d1,_0x209a56,_0x2ef284){return new BPromise(function(_0x1d2935,_0x3f75e1){return client[_0x0475('0xb')](_0x3708d1,_0x2ef284)['then'](function(_0x416bab){logger[_0x0475('0xc')]('MailServerIn,\x20%s,\x20%s',_0x209a56,_0x0475('0xd'));logger[_0x0475('0xe')]('MailServerIn,\x20%s,\x20%s,\x20%s',_0x209a56,'request\x20sent',JSON[_0x0475('0xf')](_0x416bab));if(_0x416bab[_0x0475('0x10')]){if(_0x416bab['error'][_0x0475('0x11')]===0x1f4){logger[_0x0475('0x10')](_0x0475('0x12'),_0x209a56,_0x416bab[_0x0475('0x10')]['message']);return _0x3f75e1(_0x416bab[_0x0475('0x10')][_0x0475('0x13')]);}logger[_0x0475('0x10')]('MailServerIn,\x20%s,\x20%s',_0x209a56,_0x416bab['error'][_0x0475('0x13')]);return _0x1d2935(_0x416bab[_0x0475('0x10')]['message']);}else{logger['info'](_0x0475('0x12'),_0x209a56,_0x0475('0xd'));_0x1d2935(_0x416bab['result']['message']);}})[_0x0475('0x14')](function(_0x12174b){logger['error'](_0x0475('0x12'),_0x209a56,_0x12174b);_0x3f75e1(_0x12174b);});});}exports[_0x0475('0x15')]=function(_0x51625d){var _0x3b5dc1=this;return new Promise(function(_0x59c515,_0x41c4d1){return db[_0x0475('0x16')][_0x0475('0x17')]({'raw':_0x51625d['options']?_0x51625d['options'][_0x0475('0x18')]===undefined?!![]:![]:!![],'where':_0x51625d[_0x0475('0x19')]?_0x51625d[_0x0475('0x19')][_0x0475('0x1a')]||null:null,'attributes':_0x51625d[_0x0475('0x19')]?_0x51625d[_0x0475('0x19')][_0x0475('0x1b')]||null:null,'limit':_0x51625d[_0x0475('0x19')]?_0x51625d[_0x0475('0x19')]['limit']||null:null,'include':_0x51625d['options']?_0x51625d[_0x0475('0x19')]['include']?_[_0x0475('0x1c')](_0x51625d[_0x0475('0x19')]['include'],function(_0x49ee7e){return{'model':db[_0x49ee7e[_0x0475('0x1d')]],'as':_0x49ee7e['as'],'attributes':_0x49ee7e['attributes'],'include':_0x49ee7e['include']?_['map'](_0x49ee7e[_0x0475('0x1e')],function(_0x2979fe){return{'model':db[_0x2979fe[_0x0475('0x1d')]],'as':_0x2979fe['as'],'attributes':_0x2979fe[_0x0475('0x1b')],'include':_0x2979fe['include']?_[_0x0475('0x1c')](_0x2979fe['include'],function(_0x2c55f1){return{'model':db[_0x2c55f1[_0x0475('0x1d')]],'as':_0x2c55f1['as'],'attributes':_0x2c55f1[_0x0475('0x1b')]};}):[]};}):[]};}):[]:[]})[_0x0475('0x1f')](function(_0x4e05f4){logger[_0x0475('0xc')]('GetMailServerIn',_0x51625d);logger[_0x0475('0xe')](_0x0475('0x15'),_0x51625d,JSON[_0x0475('0xf')](_0x4e05f4));_0x59c515(_0x4e05f4);})['catch'](function(_0x42f08b){logger[_0x0475('0x10')](_0x0475('0x15'),_0x42f08b['message'],_0x51625d);_0x41c4d1(_0x3b5dc1['error'](0x1f4,_0x42f08b[_0x0475('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/mailServerOut/index.js b/server/api/mailServerOut/index.js index 9296d12..61b4f3b 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 _0x146c=['Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./mailServerOut.controller','get','isAuthenticated','index','/:id','post','create','update','delete','exports','multer','util','path','connect-timeout','express'];(function(_0x2b9b7f,_0x4d47df){var _0x4ed19a=function(_0x72b5ff){while(--_0x72b5ff){_0x2b9b7f['push'](_0x2b9b7f['shift']());}};_0x4ed19a(++_0x4d47df);}(_0x146c,0xdf));var _0xc146=function(_0x4d2f67,_0x1ca33b){_0x4d2f67=_0x4d2f67-0x0;var _0x47d0f6=_0x146c[_0x4d2f67];return _0x47d0f6;};'use strict';var multer=require(_0xc146('0x0'));var util=require(_0xc146('0x1'));var path=require(_0xc146('0x2'));var timeout=require(_0xc146('0x3'));var express=require(_0xc146('0x4'));var router=express[_0xc146('0x5')]();var auth=require(_0xc146('0x6'));var interaction=require(_0xc146('0x7'));var config=require(_0xc146('0x8'));var controller=require(_0xc146('0x9'));router[_0xc146('0xa')]('/',auth[_0xc146('0xb')](),controller[_0xc146('0xc')]);router[_0xc146('0xa')](_0xc146('0xd'),auth[_0xc146('0xb')](),controller['show']);router[_0xc146('0xe')]('/',auth[_0xc146('0xb')](),controller[_0xc146('0xf')]);router['put'](_0xc146('0xd'),auth[_0xc146('0xb')](),controller[_0xc146('0x10')]);router[_0xc146('0x11')](_0xc146('0xd'),auth[_0xc146('0xb')](),controller['destroy']);module[_0xc146('0x12')]=router; \ No newline at end of file +var _0x0549=['delete','destroy','exports','util','path','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./mailServerOut.controller','get','index','/:id','isAuthenticated','show','put'];(function(_0x286c2e,_0x523377){var _0x1532be=function(_0x2723b0){while(--_0x2723b0){_0x286c2e['push'](_0x286c2e['shift']());}};_0x1532be(++_0x523377);}(_0x0549,0x146));var _0x9054=function(_0x10c0c2,_0x31c5d9){_0x10c0c2=_0x10c0c2-0x0;var _0x53e032=_0x0549[_0x10c0c2];return _0x53e032;};'use strict';var multer=require('multer');var util=require(_0x9054('0x0'));var path=require(_0x9054('0x1'));var timeout=require('connect-timeout');var express=require(_0x9054('0x2'));var router=express[_0x9054('0x3')]();var auth=require(_0x9054('0x4'));var interaction=require(_0x9054('0x5'));var config=require(_0x9054('0x6'));var controller=require(_0x9054('0x7'));router[_0x9054('0x8')]('/',auth['isAuthenticated'](),controller[_0x9054('0x9')]);router[_0x9054('0x8')](_0x9054('0xa'),auth[_0x9054('0xb')](),controller[_0x9054('0xc')]);router['post']('/',auth[_0x9054('0xb')](),controller['create']);router[_0x9054('0xd')]('/:id',auth[_0x9054('0xb')](),controller['update']);router[_0x9054('0xe')](_0x9054('0xa'),auth[_0x9054('0xb')](),controller[_0x9054('0xf')]);module[_0x9054('0x10')]=router; \ No newline at end of file diff --git a/server/api/mailServerOut/mailServerOut.attributes.js b/server/api/mailServerOut/mailServerOut.attributes.js index 31ac96b..8247304 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 _0xabce=['exports','STRING','BOOLEAN','sequelize'];(function(_0x5dacf5,_0xf82c2d){var _0x86a5ed=function(_0x4d6fb7){while(--_0x4d6fb7){_0x5dacf5['push'](_0x5dacf5['shift']());}};_0x86a5ed(++_0xf82c2d);}(_0xabce,0x103));var _0xeabc=function(_0x18a79d,_0x57bd2c){_0x18a79d=_0x18a79d-0x0;var _0x4f8848=_0xabce[_0x18a79d];return _0x4f8848;};'use strict';var Sequelize=require(_0xeabc('0x0'));module[_0xeabc('0x1')]={'description':{'type':Sequelize[_0xeabc('0x2')]},'host':{'type':Sequelize[_0xeabc('0x2')]},'user':{'type':Sequelize[_0xeabc('0x2')]},'pass':{'type':Sequelize['STRING']},'port':{'type':Sequelize['INTEGER']},'secure':{'type':Sequelize[_0xeabc('0x3')],'defaultValue':![]},'service':{'type':Sequelize[_0xeabc('0x2')]},'authentication':{'type':Sequelize[_0xeabc('0x3')],'defaultValue':!![]}}; \ No newline at end of file +var _0xeae8=['INTEGER','BOOLEAN','sequelize','exports','STRING'];(function(_0x501510,_0x61caa9){var _0x1e6ee5=function(_0x32845b){while(--_0x32845b){_0x501510['push'](_0x501510['shift']());}};_0x1e6ee5(++_0x61caa9);}(_0xeae8,0x66));var _0x8eae=function(_0x34da86,_0x16cd32){_0x34da86=_0x34da86-0x0;var _0x396bc1=_0xeae8[_0x34da86];return _0x396bc1;};'use strict';var Sequelize=require(_0x8eae('0x0'));module[_0x8eae('0x1')]={'description':{'type':Sequelize[_0x8eae('0x2')]},'host':{'type':Sequelize['STRING']},'user':{'type':Sequelize[_0x8eae('0x2')]},'pass':{'type':Sequelize['STRING']},'port':{'type':Sequelize[_0x8eae('0x3')]},'secure':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'service':{'type':Sequelize[_0x8eae('0x2')]},'authentication':{'type':Sequelize[_0x8eae('0x4')],'defaultValue':!![]}}; \ No newline at end of file diff --git a/server/api/mailServerOut/mailServerOut.controller.js b/server/api/mailServerOut/mailServerOut.controller.js index c6fc56b..f54e545 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 _0xb922=['fields','length','hasOwnProperty','nolimit','order','filters','pick','filter','merge','VIRTUAL','options','include','findAll','rows','show','params','includeAll','MailServerOut','find','catch','create','body','html-pdf','eml-format','rimraf','request-promise','bluebird','util','sox','ejs','lodash','squel','crypto','desk.js','to-csv','querystring','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../mysqldb','status','end','json','count','offset','limit','set','Content-Range','apply','reject','save','update','then','destroy','sendStatus','error','stack','name','index','map','rawAttributes','fieldName','type','key','model','query','keys','intersection','attributes'];(function(_0x14fad0,_0x278d75){var _0x5c665f=function(_0xe43a83){while(--_0xe43a83){_0x14fad0['push'](_0x14fad0['shift']());}};_0x5c665f(++_0x278d75);}(_0xb922,0x1c6));var _0x2b92=function(_0x53d4f7,_0x1e0f8c){_0x53d4f7=_0x53d4f7-0x0;var _0x339e61=_0xb922[_0x53d4f7];return _0x339e61;};'use strict';var pdf=require(_0x2b92('0x0'));var emlformat=require(_0x2b92('0x1'));var rimraf=require(_0x2b92('0x2'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x2b92('0x3'));var moment=require('moment');var BPromise=require(_0x2b92('0x4'));var Mustache=require('mustache');var util=require(_0x2b92('0x5'));var path=require('path');var sox=require(_0x2b92('0x6'));var csv=require('to-csv');var ejs=require(_0x2b92('0x7'));var fs=require('fs');var _=require(_0x2b92('0x8'));var squel=require(_0x2b92('0x9'));var crypto=require(_0x2b92('0xa'));var jsforce=require('jsforce');var deskjs=require(_0x2b92('0xb'));var toCsv=require(_0x2b92('0xc'));var querystring=require(_0x2b92('0xd'));var Papa=require('papaparse');var Redis=require(_0x2b92('0xe'));var authService=require('../../components/auth/service');var qs=require(_0x2b92('0xf'));var as=require(_0x2b92('0x10'));var hardwareService=require(_0x2b92('0x11'));var logger=require(_0x2b92('0x12'))('api');var utils=require(_0x2b92('0x13'));var config=require('../../config/environment');var db=require(_0x2b92('0x14'))['db'];function respondWithStatusCode(_0x3dcb69,_0x4a8c78){_0x4a8c78=_0x4a8c78||0xcc;return function(_0x513a42){if(_0x513a42){return _0x3dcb69['sendStatus'](_0x4a8c78);}return _0x3dcb69[_0x2b92('0x15')](_0x4a8c78)[_0x2b92('0x16')]();};}function respondWithResult(_0x24139b,_0x155566){_0x155566=_0x155566||0xc8;return function(_0x2bcd93){if(_0x2bcd93){return _0x24139b[_0x2b92('0x15')](_0x155566)[_0x2b92('0x17')](_0x2bcd93);}};}function respondWithFilteredResult(_0x4ef8fe,_0x44f1a0){return function(_0x449b28){if(_0x449b28){var _0x2fcb71=_0x449b28[_0x2b92('0x18')],_0x3459da=_0x44f1a0[_0x2b92('0x19')],_0x3f6944=_0x44f1a0[_0x2b92('0x19')]+_0x44f1a0[_0x2b92('0x1a')],_0x244066;if(_0x3f6944>=_0x2fcb71){_0x3f6944=_0x2fcb71;_0x244066=0xc8;}else{_0x244066=0xce;}_0x4ef8fe[_0x2b92('0x15')](_0x244066);return _0x4ef8fe[_0x2b92('0x1b')](_0x2b92('0x1c'),_0x3459da+'-'+_0x3f6944+'/'+_0x2fcb71)[_0x2b92('0x17')](_0x449b28);}return null;};}function patchUpdates(_0x16aa2b){return function(_0x59efbf){try{jsonpatch[_0x2b92('0x1d')](_0x59efbf,_0x16aa2b,!![]);}catch(_0x219de9){return BPromise[_0x2b92('0x1e')](_0x219de9);}return _0x59efbf[_0x2b92('0x1f')]();};}function saveUpdates(_0xf4fbe0,_0x3cbe55){return function(_0x1e2b22){if(_0x1e2b22){return _0x1e2b22[_0x2b92('0x20')](_0xf4fbe0)[_0x2b92('0x21')](function(_0x4f420c){return _0x4f420c;});}return null;};}function removeEntity(_0x3b0878,_0x722c78){return function(_0x40a351){if(_0x40a351){return _0x40a351[_0x2b92('0x22')]()['then'](function(){_0x3b0878[_0x2b92('0x15')](0xcc)[_0x2b92('0x16')]();});}};}function handleEntityNotFound(_0x3debce,_0x3c78f6){return function(_0x46e0c7){if(!_0x46e0c7){_0x3debce[_0x2b92('0x23')](0x194);}return _0x46e0c7;};}function handleError(_0x27a225,_0x37490d){_0x37490d=_0x37490d||0x1f4;return function(_0x57be68){logger[_0x2b92('0x24')](_0x57be68[_0x2b92('0x25')]);if(_0x57be68[_0x2b92('0x26')]){delete _0x57be68[_0x2b92('0x26')];}_0x27a225[_0x2b92('0x15')](_0x37490d)['send'](_0x57be68);};}exports[_0x2b92('0x27')]=function(_0x3587c3,_0x518f08){var _0x52421b={},_0x4927d7={},_0xd78dc5={'count':0x0,'rows':[]};var _0x54ada9=_[_0x2b92('0x28')](db['MailServerOut'][_0x2b92('0x29')],function(_0x196b0a){return{'name':_0x196b0a[_0x2b92('0x2a')],'type':_0x196b0a[_0x2b92('0x2b')][_0x2b92('0x2c')]};});_0x4927d7[_0x2b92('0x2d')]=_[_0x2b92('0x28')](_0x54ada9,'name');_0x4927d7[_0x2b92('0x2e')]=_[_0x2b92('0x2f')](_0x3587c3[_0x2b92('0x2e')]);_0x4927d7['filters']=_[_0x2b92('0x30')](_0x4927d7[_0x2b92('0x2d')],_0x4927d7['query']);_0x52421b[_0x2b92('0x31')]=_[_0x2b92('0x30')](_0x4927d7['model'],qs['fields'](_0x3587c3[_0x2b92('0x2e')][_0x2b92('0x32')]));_0x52421b[_0x2b92('0x31')]=_0x52421b[_0x2b92('0x31')][_0x2b92('0x33')]?_0x52421b[_0x2b92('0x31')]:_0x4927d7['model'];if(!_0x3587c3[_0x2b92('0x2e')][_0x2b92('0x34')](_0x2b92('0x35'))){_0x52421b['limit']=qs[_0x2b92('0x1a')](_0x3587c3[_0x2b92('0x2e')][_0x2b92('0x1a')]);_0x52421b[_0x2b92('0x19')]=qs['offset'](_0x3587c3['query'][_0x2b92('0x19')]);}_0x52421b[_0x2b92('0x36')]=qs['sort'](_0x3587c3[_0x2b92('0x2e')]['sort']);_0x52421b['where']=qs[_0x2b92('0x37')](_[_0x2b92('0x38')](_0x3587c3[_0x2b92('0x2e')],_0x4927d7[_0x2b92('0x37')]));if(_0x3587c3[_0x2b92('0x2e')][_0x2b92('0x39')]){_0x52421b['where']=_[_0x2b92('0x3a')](_0x52421b['where'],{'$or':_['map'](_0x54ada9,function(_0x181f4c){if(_0x181f4c[_0x2b92('0x2b')]!==_0x2b92('0x3b')){var _0x2eedfb={};_0x2eedfb[_0x181f4c[_0x2b92('0x26')]]={'$like':'%'+_0x3587c3[_0x2b92('0x2e')][_0x2b92('0x39')]+'%'};return _0x2eedfb;}})});}_0x52421b=_[_0x2b92('0x3a')]({},_0x52421b,_0x3587c3[_0x2b92('0x3c')]);var _0x43179d={'where':_0x52421b['where']};return db['MailServerOut'][_0x2b92('0x18')](_0x43179d)[_0x2b92('0x21')](function(_0x235b0d){_0xd78dc5[_0x2b92('0x18')]=_0x235b0d;if(_0x3587c3[_0x2b92('0x2e')]['includeAll']){_0x52421b[_0x2b92('0x3d')]=[{'all':!![]}];}return db['MailServerOut'][_0x2b92('0x3e')](_0x52421b);})[_0x2b92('0x21')](function(_0x247112){_0xd78dc5[_0x2b92('0x3f')]=_0x247112;return _0xd78dc5;})['then'](respondWithFilteredResult(_0x518f08,_0x52421b))['catch'](handleError(_0x518f08,null));};exports[_0x2b92('0x40')]=function(_0x19eddc,_0x276e84){var _0x5d9859={'raw':!![],'where':{'id':_0x19eddc[_0x2b92('0x41')]['id']}},_0x2d1f99={};_0x2d1f99[_0x2b92('0x2d')]=_[_0x2b92('0x2f')](db['MailServerOut'][_0x2b92('0x29')]);_0x2d1f99[_0x2b92('0x2e')]=_[_0x2b92('0x2f')](_0x19eddc[_0x2b92('0x2e')]);_0x2d1f99[_0x2b92('0x37')]=_[_0x2b92('0x30')](_0x2d1f99['model'],_0x2d1f99[_0x2b92('0x2e')]);_0x5d9859[_0x2b92('0x31')]=_[_0x2b92('0x30')](_0x2d1f99[_0x2b92('0x2d')],qs[_0x2b92('0x32')](_0x19eddc[_0x2b92('0x2e')][_0x2b92('0x32')]));_0x5d9859[_0x2b92('0x31')]=_0x5d9859[_0x2b92('0x31')][_0x2b92('0x33')]?_0x5d9859[_0x2b92('0x31')]:_0x2d1f99['model'];if(_0x19eddc[_0x2b92('0x2e')][_0x2b92('0x42')]){_0x5d9859[_0x2b92('0x3d')]=[{'all':!![]}];}_0x5d9859=_['merge']({},_0x5d9859,_0x19eddc['options']);return db[_0x2b92('0x43')][_0x2b92('0x44')](_0x5d9859)['then'](handleEntityNotFound(_0x276e84,null))['then'](respondWithResult(_0x276e84,null))[_0x2b92('0x45')](handleError(_0x276e84,null));};exports[_0x2b92('0x46')]=function(_0x70b5a7,_0x593d83){return db['MailServerOut']['create'](_0x70b5a7['body'],{})[_0x2b92('0x21')](respondWithResult(_0x593d83,0xc9))[_0x2b92('0x45')](handleError(_0x593d83,null));};exports['update']=function(_0x5b3b00,_0x5c3b0d){if(_0x5b3b00[_0x2b92('0x47')]['id']){delete _0x5b3b00['body']['id'];}return db[_0x2b92('0x43')][_0x2b92('0x44')]({'where':{'id':_0x5b3b00[_0x2b92('0x41')]['id']}})[_0x2b92('0x21')](handleEntityNotFound(_0x5c3b0d,null))[_0x2b92('0x21')](saveUpdates(_0x5b3b00['body'],null))['then'](respondWithResult(_0x5c3b0d,null))[_0x2b92('0x45')](handleError(_0x5c3b0d,null));};exports[_0x2b92('0x22')]=function(_0x272fd3,_0x5d70ef){return db[_0x2b92('0x43')][_0x2b92('0x44')]({'where':{'id':_0x272fd3['params']['id']}})[_0x2b92('0x21')](handleEntityNotFound(_0x5d70ef,null))[_0x2b92('0x21')](removeEntity(_0x5d70ef,null))['catch'](handleError(_0x5d70ef,null));}; \ No newline at end of file +var _0x33e1=['Content-Range','reject','update','then','destroy','error','stack','name','send','map','MailServerOut','rawAttributes','type','key','model','query','keys','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','limit','order','sort','where','pick','filter','merge','VIRTUAL','options','findAll','rows','catch','show','includeAll','find','create','body','params','html-pdf','rimraf','zip-dir','fast-json-patch','request-promise','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','querystring','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','count','offset','set'];(function(_0x4865a1,_0x247744){var _0x16ea89=function(_0x18653e){while(--_0x18653e){_0x4865a1['push'](_0x4865a1['shift']());}};_0x16ea89(++_0x247744);}(_0x33e1,0x108));var _0x133e=function(_0x5392ca,_0x2059db){_0x5392ca=_0x5392ca-0x0;var _0x519c64=_0x33e1[_0x5392ca];return _0x519c64;};'use strict';var pdf=require(_0x133e('0x0'));var emlformat=require('eml-format');var rimraf=require(_0x133e('0x1'));var zipdir=require(_0x133e('0x2'));var jsonpatch=require(_0x133e('0x3'));var rp=require(_0x133e('0x4'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x133e('0x5'));var util=require(_0x133e('0x6'));var path=require(_0x133e('0x7'));var sox=require(_0x133e('0x8'));var csv=require(_0x133e('0x9'));var ejs=require(_0x133e('0xa'));var fs=require('fs');var _=require(_0x133e('0xb'));var squel=require(_0x133e('0xc'));var crypto=require(_0x133e('0xd'));var jsforce=require(_0x133e('0xe'));var deskjs=require('desk.js');var toCsv=require(_0x133e('0x9'));var querystring=require(_0x133e('0xf'));var Papa=require(_0x133e('0x10'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x133e('0x11'));var as=require(_0x133e('0x12'));var hardwareService=require(_0x133e('0x13'));var logger=require(_0x133e('0x14'))(_0x133e('0x15'));var utils=require(_0x133e('0x16'));var config=require(_0x133e('0x17'));var db=require(_0x133e('0x18'))['db'];function respondWithStatusCode(_0x27e217,_0x37abaf){_0x37abaf=_0x37abaf||0xcc;return function(_0x379e81){if(_0x379e81){return _0x27e217[_0x133e('0x19')](_0x37abaf);}return _0x27e217[_0x133e('0x1a')](_0x37abaf)[_0x133e('0x1b')]();};}function respondWithResult(_0xca5eb9,_0x15e439){_0x15e439=_0x15e439||0xc8;return function(_0x52d3c3){if(_0x52d3c3){return _0xca5eb9['status'](_0x15e439)[_0x133e('0x1c')](_0x52d3c3);}};}function respondWithFilteredResult(_0x56485d,_0x1bb589){return function(_0x2ae623){if(_0x2ae623){var _0x5d14ae=_0x2ae623[_0x133e('0x1d')],_0x3f2b2c=_0x1bb589[_0x133e('0x1e')],_0x129878=_0x1bb589[_0x133e('0x1e')]+_0x1bb589['limit'],_0x275691;if(_0x129878>=_0x5d14ae){_0x129878=_0x5d14ae;_0x275691=0xc8;}else{_0x275691=0xce;}_0x56485d[_0x133e('0x1a')](_0x275691);return _0x56485d[_0x133e('0x1f')](_0x133e('0x20'),_0x3f2b2c+'-'+_0x129878+'/'+_0x5d14ae)[_0x133e('0x1c')](_0x2ae623);}return null;};}function patchUpdates(_0x1e945b){return function(_0x56d15b){try{jsonpatch['apply'](_0x56d15b,_0x1e945b,!![]);}catch(_0x28482d){return BPromise[_0x133e('0x21')](_0x28482d);}return _0x56d15b['save']();};}function saveUpdates(_0x2eeabd,_0xe1f7b5){return function(_0x14ad61){if(_0x14ad61){return _0x14ad61[_0x133e('0x22')](_0x2eeabd)[_0x133e('0x23')](function(_0x351da8){return _0x351da8;});}return null;};}function removeEntity(_0x62d338,_0x362a7a){return function(_0x5d1c9a){if(_0x5d1c9a){return _0x5d1c9a[_0x133e('0x24')]()[_0x133e('0x23')](function(){_0x62d338[_0x133e('0x1a')](0xcc)[_0x133e('0x1b')]();});}};}function handleEntityNotFound(_0x24caaf,_0x1dbe37){return function(_0x4e02c9){if(!_0x4e02c9){_0x24caaf['sendStatus'](0x194);}return _0x4e02c9;};}function handleError(_0x261c38,_0x13918b){_0x13918b=_0x13918b||0x1f4;return function(_0x257416){logger[_0x133e('0x25')](_0x257416[_0x133e('0x26')]);if(_0x257416['name']){delete _0x257416[_0x133e('0x27')];}_0x261c38[_0x133e('0x1a')](_0x13918b)[_0x133e('0x28')](_0x257416);};}exports['index']=function(_0x2c78f9,_0x3807cb){var _0x552dcf={},_0x5c1f22={},_0x83ae00={'count':0x0,'rows':[]};var _0x59ff7b=_[_0x133e('0x29')](db[_0x133e('0x2a')][_0x133e('0x2b')],function(_0x55456c){return{'name':_0x55456c['fieldName'],'type':_0x55456c[_0x133e('0x2c')][_0x133e('0x2d')]};});_0x5c1f22[_0x133e('0x2e')]=_['map'](_0x59ff7b,_0x133e('0x27'));_0x5c1f22[_0x133e('0x2f')]=_[_0x133e('0x30')](_0x2c78f9[_0x133e('0x2f')]);_0x5c1f22[_0x133e('0x31')]=_['intersection'](_0x5c1f22[_0x133e('0x2e')],_0x5c1f22[_0x133e('0x2f')]);_0x552dcf[_0x133e('0x32')]=_[_0x133e('0x33')](_0x5c1f22[_0x133e('0x2e')],qs[_0x133e('0x34')](_0x2c78f9['query']['fields']));_0x552dcf[_0x133e('0x32')]=_0x552dcf[_0x133e('0x32')][_0x133e('0x35')]?_0x552dcf['attributes']:_0x5c1f22[_0x133e('0x2e')];if(!_0x2c78f9['query'][_0x133e('0x36')](_0x133e('0x37'))){_0x552dcf[_0x133e('0x38')]=qs[_0x133e('0x38')](_0x2c78f9[_0x133e('0x2f')][_0x133e('0x38')]);_0x552dcf[_0x133e('0x1e')]=qs[_0x133e('0x1e')](_0x2c78f9[_0x133e('0x2f')][_0x133e('0x1e')]);}_0x552dcf[_0x133e('0x39')]=qs[_0x133e('0x3a')](_0x2c78f9[_0x133e('0x2f')][_0x133e('0x3a')]);_0x552dcf[_0x133e('0x3b')]=qs[_0x133e('0x31')](_[_0x133e('0x3c')](_0x2c78f9[_0x133e('0x2f')],_0x5c1f22['filters']));if(_0x2c78f9[_0x133e('0x2f')][_0x133e('0x3d')]){_0x552dcf[_0x133e('0x3b')]=_[_0x133e('0x3e')](_0x552dcf['where'],{'$or':_[_0x133e('0x29')](_0x59ff7b,function(_0x53bf2f){if(_0x53bf2f['type']!==_0x133e('0x3f')){var _0x54d451={};_0x54d451[_0x53bf2f['name']]={'$like':'%'+_0x2c78f9[_0x133e('0x2f')][_0x133e('0x3d')]+'%'};return _0x54d451;}})});}_0x552dcf=_['merge']({},_0x552dcf,_0x2c78f9[_0x133e('0x40')]);var _0x28188b={'where':_0x552dcf[_0x133e('0x3b')]};return db[_0x133e('0x2a')][_0x133e('0x1d')](_0x28188b)[_0x133e('0x23')](function(_0x556cc8){_0x83ae00[_0x133e('0x1d')]=_0x556cc8;if(_0x2c78f9[_0x133e('0x2f')]['includeAll']){_0x552dcf['include']=[{'all':!![]}];}return db['MailServerOut'][_0x133e('0x41')](_0x552dcf);})[_0x133e('0x23')](function(_0x2197ad){_0x83ae00[_0x133e('0x42')]=_0x2197ad;return _0x83ae00;})[_0x133e('0x23')](respondWithFilteredResult(_0x3807cb,_0x552dcf))[_0x133e('0x43')](handleError(_0x3807cb,null));};exports[_0x133e('0x44')]=function(_0x3be3a6,_0x2dd27f){var _0x3c3d07={'raw':!![],'where':{'id':_0x3be3a6['params']['id']}},_0x6194cb={};_0x6194cb[_0x133e('0x2e')]=_[_0x133e('0x30')](db[_0x133e('0x2a')]['rawAttributes']);_0x6194cb['query']=_[_0x133e('0x30')](_0x3be3a6[_0x133e('0x2f')]);_0x6194cb[_0x133e('0x31')]=_[_0x133e('0x33')](_0x6194cb[_0x133e('0x2e')],_0x6194cb[_0x133e('0x2f')]);_0x3c3d07[_0x133e('0x32')]=_[_0x133e('0x33')](_0x6194cb[_0x133e('0x2e')],qs[_0x133e('0x34')](_0x3be3a6[_0x133e('0x2f')]['fields']));_0x3c3d07[_0x133e('0x32')]=_0x3c3d07[_0x133e('0x32')]['length']?_0x3c3d07[_0x133e('0x32')]:_0x6194cb[_0x133e('0x2e')];if(_0x3be3a6[_0x133e('0x2f')][_0x133e('0x45')]){_0x3c3d07['include']=[{'all':!![]}];}_0x3c3d07=_[_0x133e('0x3e')]({},_0x3c3d07,_0x3be3a6['options']);return db[_0x133e('0x2a')][_0x133e('0x46')](_0x3c3d07)[_0x133e('0x23')](handleEntityNotFound(_0x2dd27f,null))[_0x133e('0x23')](respondWithResult(_0x2dd27f,null))[_0x133e('0x43')](handleError(_0x2dd27f,null));};exports[_0x133e('0x47')]=function(_0x44b22f,_0xc7c457){return db[_0x133e('0x2a')][_0x133e('0x47')](_0x44b22f[_0x133e('0x48')],{})['then'](respondWithResult(_0xc7c457,0xc9))[_0x133e('0x43')](handleError(_0xc7c457,null));};exports['update']=function(_0x19a40d,_0x1360ce){if(_0x19a40d['body']['id']){delete _0x19a40d[_0x133e('0x48')]['id'];}return db['MailServerOut'][_0x133e('0x46')]({'where':{'id':_0x19a40d[_0x133e('0x49')]['id']}})[_0x133e('0x23')](handleEntityNotFound(_0x1360ce,null))[_0x133e('0x23')](saveUpdates(_0x19a40d[_0x133e('0x48')],null))[_0x133e('0x23')](respondWithResult(_0x1360ce,null))[_0x133e('0x43')](handleError(_0x1360ce,null));};exports['destroy']=function(_0x1a9b3d,_0x31afcf){return db[_0x133e('0x2a')][_0x133e('0x46')]({'where':{'id':_0x1a9b3d[_0x133e('0x49')]['id']}})[_0x133e('0x23')](handleEntityNotFound(_0x31afcf,null))['then'](removeEntity(_0x31afcf,null))[_0x133e('0x43')](handleError(_0x31afcf,null));}; \ No newline at end of file diff --git a/server/api/mailServerOut/mailServerOut.model.js b/server/api/mailServerOut/mailServerOut.model.js index 4ba9d26..2251c68 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 _0x46ed=['lodash','util','api','moment','bluebird','path','rimraf','./mailServerOut.attributes','exports','define','MailServerOut','mail_servers_out'];(function(_0xdc37a1,_0x53ebb9){var _0x99b4fe=function(_0x2811e3){while(--_0x2811e3){_0xdc37a1['push'](_0xdc37a1['shift']());}};_0x99b4fe(++_0x53ebb9);}(_0x46ed,0x168));var _0xd46e=function(_0x4ff09b,_0x53f67d){_0x4ff09b=_0x4ff09b-0x0;var _0x3f5c2e=_0x46ed[_0x4ff09b];return _0x3f5c2e;};'use strict';var _=require(_0xd46e('0x0'));var util=require(_0xd46e('0x1'));var logger=require('../../config/logger')(_0xd46e('0x2'));var moment=require(_0xd46e('0x3'));var BPromise=require(_0xd46e('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xd46e('0x5'));var rimraf=require(_0xd46e('0x6'));var config=require('../../config/environment');var attributes=require(_0xd46e('0x7'));module[_0xd46e('0x8')]=function(_0x160bcf,_0x25cf78){return _0x160bcf[_0xd46e('0x9')](_0xd46e('0xa'),attributes,{'tableName':_0xd46e('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x9c5a=['define','lodash','util','api','moment','bluebird','request-promise','rimraf','../../config/environment','exports'];(function(_0x8222c0,_0x11a31f){var _0x4b57d3=function(_0xad9bfe){while(--_0xad9bfe){_0x8222c0['push'](_0x8222c0['shift']());}};_0x4b57d3(++_0x11a31f);}(_0x9c5a,0x1c3));var _0xa9c5=function(_0x4c81f8,_0x2f172c){_0x4c81f8=_0x4c81f8-0x0;var _0x349521=_0x9c5a[_0x4c81f8];return _0x349521;};'use strict';var _=require(_0xa9c5('0x0'));var util=require(_0xa9c5('0x1'));var logger=require('../../config/logger')(_0xa9c5('0x2'));var moment=require(_0xa9c5('0x3'));var BPromise=require(_0xa9c5('0x4'));var rp=require(_0xa9c5('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0xa9c5('0x6'));var config=require(_0xa9c5('0x7'));var attributes=require('./mailServerOut.attributes');module[_0xa9c5('0x8')]=function(_0x4d9c7a,_0x394d84){return _0x4d9c7a[_0xa9c5('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 6063dd2..1090937 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 _0xbf53=['client','http','request','then','MailServerOut,\x20%s,\x20%s','request\x20sent','debug','MailServerOut,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise'];(function(_0x47fd36,_0x41535d){var _0x21a0fc=function(_0x44c07c){while(--_0x44c07c){_0x47fd36['push'](_0x47fd36['shift']());}};_0x21a0fc(++_0x41535d);}(_0xbf53,0xde));var _0x3bf5=function(_0x58265b,_0x320534){_0x58265b=_0x58265b-0x0;var _0x2202eb=_0xbf53[_0x58265b];return _0x2202eb;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x3bf5('0x0'));var BPromise=require(_0x3bf5('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x3bf5('0x2'));var db=require(_0x3bf5('0x3'))['db'];var utils=require(_0x3bf5('0x4'));var logger=require(_0x3bf5('0x5'))(_0x3bf5('0x6'));var config=require('../../config/environment');var jayson=require(_0x3bf5('0x7'));var client=jayson[_0x3bf5('0x8')][_0x3bf5('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x2eba1d,_0x4d6bc8,_0x2a8f1b){return new BPromise(function(_0x41f7c9,_0x2e51f9){return client[_0x3bf5('0xa')](_0x2eba1d,_0x2a8f1b)[_0x3bf5('0xb')](function(_0x404394){logger['info'](_0x3bf5('0xc'),_0x4d6bc8,_0x3bf5('0xd'));logger[_0x3bf5('0xe')](_0x3bf5('0xf'),_0x4d6bc8,'request\x20sent',JSON[_0x3bf5('0x10')](_0x404394));if(_0x404394[_0x3bf5('0x11')]){if(_0x404394[_0x3bf5('0x11')][_0x3bf5('0x12')]===0x1f4){logger[_0x3bf5('0x11')](_0x3bf5('0xc'),_0x4d6bc8,_0x404394[_0x3bf5('0x11')][_0x3bf5('0x13')]);return _0x2e51f9(_0x404394['error']['message']);}logger[_0x3bf5('0x11')](_0x3bf5('0xc'),_0x4d6bc8,_0x404394['error'][_0x3bf5('0x13')]);return _0x41f7c9(_0x404394['error'][_0x3bf5('0x13')]);}else{logger[_0x3bf5('0x14')](_0x3bf5('0xc'),_0x4d6bc8,_0x3bf5('0xd'));_0x41f7c9(_0x404394[_0x3bf5('0x15')][_0x3bf5('0x13')]);}})[_0x3bf5('0x16')](function(_0x2eb155){logger['error'](_0x3bf5('0xc'),_0x4d6bc8,_0x2eb155);_0x2e51f9(_0x2eb155);});});} \ No newline at end of file +var _0xacb1=['../../config/environment','jayson/promise','client','http','MailServerOut,\x20%s,\x20%s','request\x20sent','debug','MailServerOut,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','util','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc'];(function(_0x5b74ed,_0xf39aa5){var _0x4d830e=function(_0x32ad46){while(--_0x32ad46){_0x5b74ed['push'](_0x5b74ed['shift']());}};_0x4d830e(++_0xf39aa5);}(_0xacb1,0x111));var _0x1acb=function(_0x156ab0,_0xa8743b){_0x156ab0=_0x156ab0-0x0;var _0x25fa37=_0xacb1[_0x156ab0];return _0x25fa37;};'use strict';var _=require('lodash');var util=require(_0x1acb('0x0'));var moment=require('moment');var BPromise=require(_0x1acb('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x1acb('0x2'));var db=require(_0x1acb('0x3'))['db'];var utils=require(_0x1acb('0x4'));var logger=require(_0x1acb('0x5'))(_0x1acb('0x6'));var config=require(_0x1acb('0x7'));var jayson=require(_0x1acb('0x8'));var client=jayson[_0x1acb('0x9')][_0x1acb('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x36171b,_0x345cd6,_0x2230b0){return new BPromise(function(_0x48d791,_0x355ae1){return client['request'](_0x36171b,_0x2230b0)['then'](function(_0x1bbb88){logger['info'](_0x1acb('0xb'),_0x345cd6,_0x1acb('0xc'));logger[_0x1acb('0xd')](_0x1acb('0xe'),_0x345cd6,_0x1acb('0xc'),JSON[_0x1acb('0xf')](_0x1bbb88));if(_0x1bbb88['error']){if(_0x1bbb88[_0x1acb('0x10')][_0x1acb('0x11')]===0x1f4){logger['error'](_0x1acb('0xb'),_0x345cd6,_0x1bbb88[_0x1acb('0x10')][_0x1acb('0x12')]);return _0x355ae1(_0x1bbb88[_0x1acb('0x10')][_0x1acb('0x12')]);}logger[_0x1acb('0x10')](_0x1acb('0xb'),_0x345cd6,_0x1bbb88[_0x1acb('0x10')][_0x1acb('0x12')]);return _0x48d791(_0x1bbb88[_0x1acb('0x10')][_0x1acb('0x12')]);}else{logger['info'](_0x1acb('0xb'),_0x345cd6,_0x1acb('0xc'));_0x48d791(_0x1bbb88[_0x1acb('0x13')][_0x1acb('0x12')]);}})['catch'](function(_0x38db97){logger[_0x1acb('0x10')](_0x1acb('0xb'),_0x345cd6,_0x38db97);_0x355ae1(_0x38db97);});});} \ No newline at end of file diff --git a/server/api/mailSubstatus/index.js b/server/api/mailSubstatus/index.js index 84ba430..8ad8468 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 _0xe307=['post','update','delete','destroy','exports','util','path','connect-timeout','express','Router','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/describe','describe','/:id','show'];(function(_0x999c0b,_0x5b244b){var _0x9dfdf1=function(_0xca8da){while(--_0xca8da){_0x999c0b['push'](_0x999c0b['shift']());}};_0x9dfdf1(++_0x5b244b);}(_0xe307,0x148));var _0x7e30=function(_0x3d7cc3,_0x25d1a0){_0x3d7cc3=_0x3d7cc3-0x0;var _0x47132a=_0xe307[_0x3d7cc3];return _0x47132a;};'use strict';var multer=require('multer');var util=require(_0x7e30('0x0'));var path=require(_0x7e30('0x1'));var timeout=require(_0x7e30('0x2'));var express=require(_0x7e30('0x3'));var router=express[_0x7e30('0x4')]();var auth=require('../../components/auth/service');var interaction=require(_0x7e30('0x5'));var config=require(_0x7e30('0x6'));var controller=require('./mailSubstatus.controller');router[_0x7e30('0x7')]('/',auth[_0x7e30('0x8')](),controller[_0x7e30('0x9')]);router[_0x7e30('0x7')](_0x7e30('0xa'),auth[_0x7e30('0x8')](),controller[_0x7e30('0xb')]);router[_0x7e30('0x7')](_0x7e30('0xc'),auth['isAuthenticated'](),controller[_0x7e30('0xd')]);router[_0x7e30('0xe')]('/',auth[_0x7e30('0x8')](),controller['create']);router['put'](_0x7e30('0xc'),auth[_0x7e30('0x8')](),controller[_0x7e30('0xf')]);router[_0x7e30('0x10')](_0x7e30('0xc'),auth['isAuthenticated'](),controller[_0x7e30('0x11')]);module[_0x7e30('0x12')]=router; \ No newline at end of file +var _0x0203=['express','get','index','/describe','isAuthenticated','describe','/:id','post','create','put','update','destroy','exports','util','path','connect-timeout'];(function(_0x5418ad,_0x40742f){var _0x2cae56=function(_0x36d317){while(--_0x36d317){_0x5418ad['push'](_0x5418ad['shift']());}};_0x2cae56(++_0x40742f);}(_0x0203,0xad));var _0x3020=function(_0x4d6545,_0x34ba94){_0x4d6545=_0x4d6545-0x0;var _0x42c9a2=_0x0203[_0x4d6545];return _0x42c9a2;};'use strict';var multer=require('multer');var util=require(_0x3020('0x0'));var path=require(_0x3020('0x1'));var timeout=require(_0x3020('0x2'));var express=require(_0x3020('0x3'));var router=express['Router']();var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require('./mailSubstatus.controller');router[_0x3020('0x4')]('/',auth['isAuthenticated'](),controller[_0x3020('0x5')]);router[_0x3020('0x4')](_0x3020('0x6'),auth[_0x3020('0x7')](),controller[_0x3020('0x8')]);router[_0x3020('0x4')](_0x3020('0x9'),auth['isAuthenticated'](),controller['show']);router[_0x3020('0xa')]('/',auth[_0x3020('0x7')](),controller[_0x3020('0xb')]);router[_0x3020('0xc')](_0x3020('0x9'),auth[_0x3020('0x7')](),controller[_0x3020('0xd')]);router['delete'](_0x3020('0x9'),auth['isAuthenticated'](),controller[_0x3020('0xe')]);module[_0x3020('0xf')]=router; \ No newline at end of file diff --git a/server/api/mailSubstatus/mailSubstatus.attributes.js b/server/api/mailSubstatus/mailSubstatus.attributes.js index fae8ed7..439b89e 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 _0x1fcc=['STRING','sequelize','exports','name'];(function(_0x44077e,_0x3a3dc3){var _0x16e8b4=function(_0x456134){while(--_0x456134){_0x44077e['push'](_0x44077e['shift']());}};_0x16e8b4(++_0x3a3dc3);}(_0x1fcc,0x125));var _0xc1fc=function(_0x21549c,_0x6d64d1){_0x21549c=_0x21549c-0x0;var _0x426cbd=_0x1fcc[_0x21549c];return _0x426cbd;};'use strict';var Sequelize=require(_0xc1fc('0x0'));module[_0xc1fc('0x1')]={'name':{'type':Sequelize['STRING'],'unique':_0xc1fc('0x2'),'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize[_0xc1fc('0x3')]}}; \ No newline at end of file +var _0x1b9b=['STRING','name','sequelize'];(function(_0x2320f2,_0x22990b){var _0x404f99=function(_0x4424e6){while(--_0x4424e6){_0x2320f2['push'](_0x2320f2['shift']());}};_0x404f99(++_0x22990b);}(_0x1b9b,0x89));var _0xb1b9=function(_0x5453e0,_0x38736d){_0x5453e0=_0x5453e0-0x0;var _0x77c160=_0x1b9b[_0x5453e0];return _0x77c160;};'use strict';var Sequelize=require(_0xb1b9('0x0'));module['exports']={'name':{'type':Sequelize[_0xb1b9('0x1')],'unique':_0xb1b9('0x2'),'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize[_0xb1b9('0x1')]}}; \ No newline at end of file diff --git a/server/api/mailSubstatus/mailSubstatus.controller.js b/server/api/mailSubstatus/mailSubstatus.controller.js index a349d28..aef5b4c 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 _0x7da7=['api','../../config/utils','../../mysqldb','status','end','json','set','Content-Range','apply','update','then','sendStatus','error','stack','name','send','index','map','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','nolimit','limit','offset','sort','pick','filter','where','VIRTUAL','merge','count','include','findAll','rows','catch','show','params','rawAttributes','length','includeAll','options','MailSubstatus','find','create','body','describe','html-pdf','eml-format','rimraf','request-promise','moment','mustache','util','sox','to-csv','lodash','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger'];(function(_0xbad07d,_0x156c51){var _0x547a13=function(_0x58063f){while(--_0x58063f){_0xbad07d['push'](_0xbad07d['shift']());}};_0x547a13(++_0x156c51);}(_0x7da7,0x10d));var _0x77da=function(_0x46f3f8,_0x12c74b){_0x46f3f8=_0x46f3f8-0x0;var _0xbc57cd=_0x7da7[_0x46f3f8];return _0xbc57cd;};'use strict';var pdf=require(_0x77da('0x0'));var emlformat=require(_0x77da('0x1'));var rimraf=require(_0x77da('0x2'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x77da('0x3'));var moment=require(_0x77da('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x77da('0x5'));var util=require(_0x77da('0x6'));var path=require('path');var sox=require(_0x77da('0x7'));var csv=require(_0x77da('0x8'));var ejs=require('ejs');var fs=require('fs');var _=require(_0x77da('0x9'));var squel=require('squel');var crypto=require(_0x77da('0xa'));var jsforce=require(_0x77da('0xb'));var deskjs=require(_0x77da('0xc'));var toCsv=require(_0x77da('0x8'));var querystring=require(_0x77da('0xd'));var Papa=require('papaparse');var Redis=require(_0x77da('0xe'));var authService=require(_0x77da('0xf'));var qs=require(_0x77da('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x77da('0x11'));var logger=require(_0x77da('0x12'))(_0x77da('0x13'));var utils=require(_0x77da('0x14'));var config=require('../../config/environment');var db=require(_0x77da('0x15'))['db'];function respondWithStatusCode(_0x3bcea0,_0x2acc65){_0x2acc65=_0x2acc65||0xcc;return function(_0x5d6e2f){if(_0x5d6e2f){return _0x3bcea0['sendStatus'](_0x2acc65);}return _0x3bcea0[_0x77da('0x16')](_0x2acc65)[_0x77da('0x17')]();};}function respondWithResult(_0x589aa1,_0x3b0ff2){_0x3b0ff2=_0x3b0ff2||0xc8;return function(_0x369df0){if(_0x369df0){return _0x589aa1[_0x77da('0x16')](_0x3b0ff2)[_0x77da('0x18')](_0x369df0);}};}function respondWithFilteredResult(_0x519253,_0x2172d0){return function(_0x4e130c){if(_0x4e130c){var _0x29cd7b=_0x4e130c['count'],_0x366443=_0x2172d0['offset'],_0x1b0e17=_0x2172d0['offset']+_0x2172d0['limit'],_0x4500c4;if(_0x1b0e17>=_0x29cd7b){_0x1b0e17=_0x29cd7b;_0x4500c4=0xc8;}else{_0x4500c4=0xce;}_0x519253[_0x77da('0x16')](_0x4500c4);return _0x519253[_0x77da('0x19')](_0x77da('0x1a'),_0x366443+'-'+_0x1b0e17+'/'+_0x29cd7b)[_0x77da('0x18')](_0x4e130c);}return null;};}function patchUpdates(_0x19a00c){return function(_0x12d2b1){try{jsonpatch[_0x77da('0x1b')](_0x12d2b1,_0x19a00c,!![]);}catch(_0x3b6dde){return BPromise['reject'](_0x3b6dde);}return _0x12d2b1['save']();};}function saveUpdates(_0xd5a809,_0x4d1512){return function(_0x507979){if(_0x507979){return _0x507979[_0x77da('0x1c')](_0xd5a809)[_0x77da('0x1d')](function(_0x24aa8a){return _0x24aa8a;});}return null;};}function removeEntity(_0x5ab79a,_0x58270c){return function(_0x3e6cfe){if(_0x3e6cfe){return _0x3e6cfe['destroy']()[_0x77da('0x1d')](function(){_0x5ab79a[_0x77da('0x16')](0xcc)[_0x77da('0x17')]();});}};}function handleEntityNotFound(_0x27b6c7,_0x10399a){return function(_0x270318){if(!_0x270318){_0x27b6c7[_0x77da('0x1e')](0x194);}return _0x270318;};}function handleError(_0x50799d,_0x4885ec){_0x4885ec=_0x4885ec||0x1f4;return function(_0xfd160){logger[_0x77da('0x1f')](_0xfd160[_0x77da('0x20')]);if(_0xfd160[_0x77da('0x21')]){delete _0xfd160['name'];}_0x50799d[_0x77da('0x16')](_0x4885ec)[_0x77da('0x22')](_0xfd160);};}exports[_0x77da('0x23')]=function(_0x36115b,_0x446ae7){var _0x5997b6={},_0xce24b8={},_0x3e090d={'count':0x0,'rows':[]};var _0x1f2279=_[_0x77da('0x24')](db['MailSubstatus']['rawAttributes'],function(_0x4d395a){return{'name':_0x4d395a[_0x77da('0x25')],'type':_0x4d395a[_0x77da('0x26')][_0x77da('0x27')]};});_0xce24b8[_0x77da('0x28')]=_[_0x77da('0x24')](_0x1f2279,'name');_0xce24b8[_0x77da('0x29')]=_[_0x77da('0x2a')](_0x36115b[_0x77da('0x29')]);_0xce24b8[_0x77da('0x2b')]=_[_0x77da('0x2c')](_0xce24b8[_0x77da('0x28')],_0xce24b8['query']);_0x5997b6[_0x77da('0x2d')]=_[_0x77da('0x2c')](_0xce24b8[_0x77da('0x28')],qs[_0x77da('0x2e')](_0x36115b[_0x77da('0x29')][_0x77da('0x2e')]));_0x5997b6[_0x77da('0x2d')]=_0x5997b6[_0x77da('0x2d')]['length']?_0x5997b6['attributes']:_0xce24b8[_0x77da('0x28')];if(!_0x36115b[_0x77da('0x29')]['hasOwnProperty'](_0x77da('0x2f'))){_0x5997b6[_0x77da('0x30')]=qs[_0x77da('0x30')](_0x36115b[_0x77da('0x29')][_0x77da('0x30')]);_0x5997b6[_0x77da('0x31')]=qs[_0x77da('0x31')](_0x36115b['query'][_0x77da('0x31')]);}_0x5997b6['order']=qs['sort'](_0x36115b['query'][_0x77da('0x32')]);_0x5997b6['where']=qs[_0x77da('0x2b')](_[_0x77da('0x33')](_0x36115b[_0x77da('0x29')],_0xce24b8[_0x77da('0x2b')]));if(_0x36115b[_0x77da('0x29')][_0x77da('0x34')]){_0x5997b6[_0x77da('0x35')]=_['merge'](_0x5997b6[_0x77da('0x35')],{'$or':_[_0x77da('0x24')](_0x1f2279,function(_0x1ca53a){if(_0x1ca53a[_0x77da('0x26')]!==_0x77da('0x36')){var _0x188284={};_0x188284[_0x1ca53a['name']]={'$like':'%'+_0x36115b[_0x77da('0x29')][_0x77da('0x34')]+'%'};return _0x188284;}})});}_0x5997b6=_[_0x77da('0x37')]({},_0x5997b6,_0x36115b['options']);var _0xc5f0b8={'where':_0x5997b6['where']};return db['MailSubstatus']['count'](_0xc5f0b8)['then'](function(_0x19f9f7){_0x3e090d[_0x77da('0x38')]=_0x19f9f7;if(_0x36115b[_0x77da('0x29')]['includeAll']){_0x5997b6[_0x77da('0x39')]=[{'all':!![]}];}return db['MailSubstatus'][_0x77da('0x3a')](_0x5997b6);})['then'](function(_0x3c216f){_0x3e090d[_0x77da('0x3b')]=_0x3c216f;return _0x3e090d;})[_0x77da('0x1d')](respondWithFilteredResult(_0x446ae7,_0x5997b6))[_0x77da('0x3c')](handleError(_0x446ae7,null));};exports[_0x77da('0x3d')]=function(_0x5ecf12,_0x759b86){var _0x1f48bd={'raw':!![],'where':{'id':_0x5ecf12[_0x77da('0x3e')]['id']}},_0x44717a={};_0x44717a[_0x77da('0x28')]=_[_0x77da('0x2a')](db['MailSubstatus'][_0x77da('0x3f')]);_0x44717a[_0x77da('0x29')]=_[_0x77da('0x2a')](_0x5ecf12[_0x77da('0x29')]);_0x44717a[_0x77da('0x2b')]=_[_0x77da('0x2c')](_0x44717a['model'],_0x44717a[_0x77da('0x29')]);_0x1f48bd['attributes']=_[_0x77da('0x2c')](_0x44717a[_0x77da('0x28')],qs[_0x77da('0x2e')](_0x5ecf12['query'][_0x77da('0x2e')]));_0x1f48bd[_0x77da('0x2d')]=_0x1f48bd[_0x77da('0x2d')][_0x77da('0x40')]?_0x1f48bd[_0x77da('0x2d')]:_0x44717a[_0x77da('0x28')];if(_0x5ecf12[_0x77da('0x29')][_0x77da('0x41')]){_0x1f48bd[_0x77da('0x39')]=[{'all':!![]}];}_0x1f48bd=_['merge']({},_0x1f48bd,_0x5ecf12[_0x77da('0x42')]);return db[_0x77da('0x43')][_0x77da('0x44')](_0x1f48bd)[_0x77da('0x1d')](handleEntityNotFound(_0x759b86,null))[_0x77da('0x1d')](respondWithResult(_0x759b86,null))[_0x77da('0x3c')](handleError(_0x759b86,null));};exports['create']=function(_0x54f88c,_0x240d7b){return db[_0x77da('0x43')][_0x77da('0x45')](_0x54f88c[_0x77da('0x46')],{})[_0x77da('0x1d')](respondWithResult(_0x240d7b,0xc9))[_0x77da('0x3c')](handleError(_0x240d7b,null));};exports['update']=function(_0x6ccb8f,_0x357ee4){if(_0x6ccb8f[_0x77da('0x46')]['id']){delete _0x6ccb8f[_0x77da('0x46')]['id'];}return db['MailSubstatus'][_0x77da('0x44')]({'where':{'id':_0x6ccb8f['params']['id']}})['then'](handleEntityNotFound(_0x357ee4,null))[_0x77da('0x1d')](saveUpdates(_0x6ccb8f[_0x77da('0x46')],null))[_0x77da('0x1d')](respondWithResult(_0x357ee4,null))[_0x77da('0x3c')](handleError(_0x357ee4,null));};exports['destroy']=function(_0x16bf4b,_0x1e36ee){return db['MailSubstatus'][_0x77da('0x44')]({'where':{'id':_0x16bf4b[_0x77da('0x3e')]['id']}})['then'](handleEntityNotFound(_0x1e36ee,null))[_0x77da('0x1d')](removeEntity(_0x1e36ee,null))[_0x77da('0x3c')](handleError(_0x1e36ee,null));};exports[_0x77da('0x47')]=function(_0xef2496,_0xfc13ed){return db[_0x77da('0x43')][_0x77da('0x47')]()[_0x77da('0x1d')](respondWithResult(_0xfc13ed,null))[_0x77da('0x3c')](handleError(_0xfc13ed,null));}; \ No newline at end of file +var _0x3f8a=['key','model','query','keys','filters','intersection','attributes','fields','length','order','where','pick','filter','merge','VIRTUAL','options','MailSubstatus','include','findAll','catch','params','find','create','body','describe','html-pdf','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','count','offset','limit','set','apply','reject','then','destroy','error','stack','name','send','index','map','rawAttributes','fieldName','type'];(function(_0x3b380d,_0x4bf247){var _0x54502b=function(_0x35d207){while(--_0x35d207){_0x3b380d['push'](_0x3b380d['shift']());}};_0x54502b(++_0x4bf247);}(_0x3f8a,0x1d5));var _0xa3f8=function(_0x1f99b4,_0x5c2fa2){_0x1f99b4=_0x1f99b4-0x0;var _0x6d70cf=_0x3f8a[_0x1f99b4];return _0x6d70cf;};'use strict';var pdf=require(_0xa3f8('0x0'));var emlformat=require(_0xa3f8('0x1'));var rimraf=require(_0xa3f8('0x2'));var zipdir=require(_0xa3f8('0x3'));var jsonpatch=require('fast-json-patch');var rp=require(_0xa3f8('0x4'));var moment=require(_0xa3f8('0x5'));var BPromise=require(_0xa3f8('0x6'));var Mustache=require(_0xa3f8('0x7'));var util=require(_0xa3f8('0x8'));var path=require(_0xa3f8('0x9'));var sox=require(_0xa3f8('0xa'));var csv=require(_0xa3f8('0xb'));var ejs=require(_0xa3f8('0xc'));var fs=require('fs');var _=require(_0xa3f8('0xd'));var squel=require(_0xa3f8('0xe'));var crypto=require(_0xa3f8('0xf'));var jsforce=require(_0xa3f8('0x10'));var deskjs=require(_0xa3f8('0x11'));var toCsv=require(_0xa3f8('0xb'));var querystring=require(_0xa3f8('0x12'));var Papa=require(_0xa3f8('0x13'));var Redis=require('ioredis');var authService=require(_0xa3f8('0x14'));var qs=require(_0xa3f8('0x15'));var as=require(_0xa3f8('0x16'));var hardwareService=require(_0xa3f8('0x17'));var logger=require('../../config/logger')(_0xa3f8('0x18'));var utils=require(_0xa3f8('0x19'));var config=require(_0xa3f8('0x1a'));var db=require(_0xa3f8('0x1b'))['db'];function respondWithStatusCode(_0xd97ac9,_0x2e71a0){_0x2e71a0=_0x2e71a0||0xcc;return function(_0x1afd01){if(_0x1afd01){return _0xd97ac9[_0xa3f8('0x1c')](_0x2e71a0);}return _0xd97ac9[_0xa3f8('0x1d')](_0x2e71a0)[_0xa3f8('0x1e')]();};}function respondWithResult(_0x21b88f,_0x2c5e15){_0x2c5e15=_0x2c5e15||0xc8;return function(_0x5b2c33){if(_0x5b2c33){return _0x21b88f[_0xa3f8('0x1d')](_0x2c5e15)[_0xa3f8('0x1f')](_0x5b2c33);}};}function respondWithFilteredResult(_0x45014f,_0x21a170){return function(_0x5caebf){if(_0x5caebf){var _0x39c450=_0x5caebf[_0xa3f8('0x20')],_0x33b98e=_0x21a170[_0xa3f8('0x21')],_0x46a8d9=_0x21a170[_0xa3f8('0x21')]+_0x21a170[_0xa3f8('0x22')],_0x8cd130;if(_0x46a8d9>=_0x39c450){_0x46a8d9=_0x39c450;_0x8cd130=0xc8;}else{_0x8cd130=0xce;}_0x45014f[_0xa3f8('0x1d')](_0x8cd130);return _0x45014f[_0xa3f8('0x23')]('Content-Range',_0x33b98e+'-'+_0x46a8d9+'/'+_0x39c450)[_0xa3f8('0x1f')](_0x5caebf);}return null;};}function patchUpdates(_0x5a0e18){return function(_0x9bb9db){try{jsonpatch[_0xa3f8('0x24')](_0x9bb9db,_0x5a0e18,!![]);}catch(_0x191f99){return BPromise[_0xa3f8('0x25')](_0x191f99);}return _0x9bb9db['save']();};}function saveUpdates(_0x1f0bb8,_0x5b0d57){return function(_0x43c393){if(_0x43c393){return _0x43c393['update'](_0x1f0bb8)[_0xa3f8('0x26')](function(_0x1a89d4){return _0x1a89d4;});}return null;};}function removeEntity(_0x353daa,_0x474893){return function(_0x3a6a57){if(_0x3a6a57){return _0x3a6a57[_0xa3f8('0x27')]()[_0xa3f8('0x26')](function(){_0x353daa['status'](0xcc)[_0xa3f8('0x1e')]();});}};}function handleEntityNotFound(_0x4d0e72,_0x3ce57b){return function(_0xa5a697){if(!_0xa5a697){_0x4d0e72[_0xa3f8('0x1c')](0x194);}return _0xa5a697;};}function handleError(_0x37b290,_0x24ead6){_0x24ead6=_0x24ead6||0x1f4;return function(_0x2c5d10){logger[_0xa3f8('0x28')](_0x2c5d10[_0xa3f8('0x29')]);if(_0x2c5d10[_0xa3f8('0x2a')]){delete _0x2c5d10[_0xa3f8('0x2a')];}_0x37b290['status'](_0x24ead6)[_0xa3f8('0x2b')](_0x2c5d10);};}exports[_0xa3f8('0x2c')]=function(_0x3344ba,_0x5a8fcf){var _0x40f5cc={},_0x57f6be={},_0xbad6a6={'count':0x0,'rows':[]};var _0x3a3746=_[_0xa3f8('0x2d')](db['MailSubstatus'][_0xa3f8('0x2e')],function(_0x5e69e2){return{'name':_0x5e69e2[_0xa3f8('0x2f')],'type':_0x5e69e2[_0xa3f8('0x30')][_0xa3f8('0x31')]};});_0x57f6be[_0xa3f8('0x32')]=_[_0xa3f8('0x2d')](_0x3a3746,_0xa3f8('0x2a'));_0x57f6be[_0xa3f8('0x33')]=_[_0xa3f8('0x34')](_0x3344ba[_0xa3f8('0x33')]);_0x57f6be[_0xa3f8('0x35')]=_[_0xa3f8('0x36')](_0x57f6be['model'],_0x57f6be[_0xa3f8('0x33')]);_0x40f5cc[_0xa3f8('0x37')]=_[_0xa3f8('0x36')](_0x57f6be[_0xa3f8('0x32')],qs[_0xa3f8('0x38')](_0x3344ba['query'][_0xa3f8('0x38')]));_0x40f5cc[_0xa3f8('0x37')]=_0x40f5cc['attributes'][_0xa3f8('0x39')]?_0x40f5cc[_0xa3f8('0x37')]:_0x57f6be['model'];if(!_0x3344ba[_0xa3f8('0x33')]['hasOwnProperty']('nolimit')){_0x40f5cc[_0xa3f8('0x22')]=qs[_0xa3f8('0x22')](_0x3344ba['query'][_0xa3f8('0x22')]);_0x40f5cc['offset']=qs[_0xa3f8('0x21')](_0x3344ba[_0xa3f8('0x33')][_0xa3f8('0x21')]);}_0x40f5cc[_0xa3f8('0x3a')]=qs['sort'](_0x3344ba[_0xa3f8('0x33')]['sort']);_0x40f5cc[_0xa3f8('0x3b')]=qs['filters'](_[_0xa3f8('0x3c')](_0x3344ba['query'],_0x57f6be['filters']));if(_0x3344ba['query'][_0xa3f8('0x3d')]){_0x40f5cc[_0xa3f8('0x3b')]=_[_0xa3f8('0x3e')](_0x40f5cc[_0xa3f8('0x3b')],{'$or':_['map'](_0x3a3746,function(_0x447824){if(_0x447824[_0xa3f8('0x30')]!==_0xa3f8('0x3f')){var _0x858f53={};_0x858f53[_0x447824[_0xa3f8('0x2a')]]={'$like':'%'+_0x3344ba[_0xa3f8('0x33')]['filter']+'%'};return _0x858f53;}})});}_0x40f5cc=_[_0xa3f8('0x3e')]({},_0x40f5cc,_0x3344ba[_0xa3f8('0x40')]);var _0x38c75b={'where':_0x40f5cc['where']};return db[_0xa3f8('0x41')][_0xa3f8('0x20')](_0x38c75b)['then'](function(_0xdc3c67){_0xbad6a6['count']=_0xdc3c67;if(_0x3344ba[_0xa3f8('0x33')]['includeAll']){_0x40f5cc[_0xa3f8('0x42')]=[{'all':!![]}];}return db[_0xa3f8('0x41')][_0xa3f8('0x43')](_0x40f5cc);})[_0xa3f8('0x26')](function(_0x10534b){_0xbad6a6['rows']=_0x10534b;return _0xbad6a6;})[_0xa3f8('0x26')](respondWithFilteredResult(_0x5a8fcf,_0x40f5cc))[_0xa3f8('0x44')](handleError(_0x5a8fcf,null));};exports['show']=function(_0x27c938,_0x4e13f1){var _0x6ff4d4={'raw':!![],'where':{'id':_0x27c938[_0xa3f8('0x45')]['id']}},_0xd3c65a={};_0xd3c65a[_0xa3f8('0x32')]=_[_0xa3f8('0x34')](db['MailSubstatus'][_0xa3f8('0x2e')]);_0xd3c65a[_0xa3f8('0x33')]=_[_0xa3f8('0x34')](_0x27c938[_0xa3f8('0x33')]);_0xd3c65a[_0xa3f8('0x35')]=_['intersection'](_0xd3c65a[_0xa3f8('0x32')],_0xd3c65a[_0xa3f8('0x33')]);_0x6ff4d4[_0xa3f8('0x37')]=_[_0xa3f8('0x36')](_0xd3c65a[_0xa3f8('0x32')],qs[_0xa3f8('0x38')](_0x27c938[_0xa3f8('0x33')][_0xa3f8('0x38')]));_0x6ff4d4[_0xa3f8('0x37')]=_0x6ff4d4[_0xa3f8('0x37')][_0xa3f8('0x39')]?_0x6ff4d4[_0xa3f8('0x37')]:_0xd3c65a[_0xa3f8('0x32')];if(_0x27c938['query']['includeAll']){_0x6ff4d4['include']=[{'all':!![]}];}_0x6ff4d4=_[_0xa3f8('0x3e')]({},_0x6ff4d4,_0x27c938[_0xa3f8('0x40')]);return db[_0xa3f8('0x41')][_0xa3f8('0x46')](_0x6ff4d4)[_0xa3f8('0x26')](handleEntityNotFound(_0x4e13f1,null))[_0xa3f8('0x26')](respondWithResult(_0x4e13f1,null))['catch'](handleError(_0x4e13f1,null));};exports[_0xa3f8('0x47')]=function(_0x31dfe0,_0x14f8e0){return db[_0xa3f8('0x41')]['create'](_0x31dfe0[_0xa3f8('0x48')],{})[_0xa3f8('0x26')](respondWithResult(_0x14f8e0,0xc9))[_0xa3f8('0x44')](handleError(_0x14f8e0,null));};exports['update']=function(_0x5cae9e,_0x4cb5ce){if(_0x5cae9e[_0xa3f8('0x48')]['id']){delete _0x5cae9e[_0xa3f8('0x48')]['id'];}return db['MailSubstatus'][_0xa3f8('0x46')]({'where':{'id':_0x5cae9e[_0xa3f8('0x45')]['id']}})[_0xa3f8('0x26')](handleEntityNotFound(_0x4cb5ce,null))[_0xa3f8('0x26')](saveUpdates(_0x5cae9e[_0xa3f8('0x48')],null))[_0xa3f8('0x26')](respondWithResult(_0x4cb5ce,null))[_0xa3f8('0x44')](handleError(_0x4cb5ce,null));};exports[_0xa3f8('0x27')]=function(_0xbfef86,_0xe1f66d){return db[_0xa3f8('0x41')][_0xa3f8('0x46')]({'where':{'id':_0xbfef86[_0xa3f8('0x45')]['id']}})[_0xa3f8('0x26')](handleEntityNotFound(_0xe1f66d,null))[_0xa3f8('0x26')](removeEntity(_0xe1f66d,null))[_0xa3f8('0x44')](handleError(_0xe1f66d,null));};exports[_0xa3f8('0x49')]=function(_0x559ae7,_0x4addd2){return db[_0xa3f8('0x41')][_0xa3f8('0x49')]()['then'](respondWithResult(_0x4addd2,null))[_0xa3f8('0x44')](handleError(_0x4addd2,null));}; \ No newline at end of file diff --git a/server/api/mailSubstatus/mailSubstatus.model.js b/server/api/mailSubstatus/mailSubstatus.model.js index 3d049ed..49292ae 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 _0x34bd=['../../config/environment','exports','MailSubstatus','mail_substatuses','lodash','api','moment','bluebird','request-promise','path','rimraf'];(function(_0x358806,_0x322b66){var _0x19fdcb=function(_0xe01b8d){while(--_0xe01b8d){_0x358806['push'](_0x358806['shift']());}};_0x19fdcb(++_0x322b66);}(_0x34bd,0x1d2));var _0xd34b=function(_0x5d431c,_0x340df3){_0x5d431c=_0x5d431c-0x0;var _0x5453b4=_0x34bd[_0x5d431c];return _0x5453b4;};'use strict';var _=require(_0xd34b('0x0'));var util=require('util');var logger=require('../../config/logger')(_0xd34b('0x1'));var moment=require(_0xd34b('0x2'));var BPromise=require(_0xd34b('0x3'));var rp=require(_0xd34b('0x4'));var fs=require('fs');var path=require(_0xd34b('0x5'));var rimraf=require(_0xd34b('0x6'));var config=require(_0xd34b('0x7'));var attributes=require('./mailSubstatus.attributes');module[_0xd34b('0x8')]=function(_0x5d161e,_0x4e6e94){return _0x5d161e['define'](_0xd34b('0x9'),attributes,{'tableName':_0xd34b('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x19e1=['define','MailSubstatus','mail_substatuses','lodash','util','../../config/logger','api','request-promise','path','../../config/environment','./mailSubstatus.attributes'];(function(_0x3d4ea4,_0x4c1807){var _0x12aa76=function(_0x4746d5){while(--_0x4746d5){_0x3d4ea4['push'](_0x3d4ea4['shift']());}};_0x12aa76(++_0x4c1807);}(_0x19e1,0x163));var _0x119e=function(_0x2118ad,_0xe8e3fd){_0x2118ad=_0x2118ad-0x0;var _0x4b5715=_0x19e1[_0x2118ad];return _0x4b5715;};'use strict';var _=require(_0x119e('0x0'));var util=require(_0x119e('0x1'));var logger=require(_0x119e('0x2'))(_0x119e('0x3'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x119e('0x4'));var fs=require('fs');var path=require(_0x119e('0x5'));var rimraf=require('rimraf');var config=require(_0x119e('0x6'));var attributes=require(_0x119e('0x7'));module['exports']=function(_0x2ce0a3,_0x5a6b88){return _0x2ce0a3[_0x119e('0x8')](_0x119e('0x9'),attributes,{'tableName':_0x119e('0xa'),'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 6187ff0..c68be11 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 _0xb43b=['rpc','../../config/environment','http','request','info','request\x20sent','debug','MailSubstatus,\x20%s,\x20%s,\x20%s','stringify','error','code','message','MailSubstatus,\x20%s,\x20%s','catch','lodash','util','bluebird','randomstring','ioredis','../../config/utils','../../config/logger'];(function(_0x58f240,_0x2c9ddd){var _0x2fe60d=function(_0x56d550){while(--_0x56d550){_0x58f240['push'](_0x58f240['shift']());}};_0x2fe60d(++_0x2c9ddd);}(_0xb43b,0x1b2));var _0xbb43=function(_0x5b6f15,_0x4d3edf){_0x5b6f15=_0x5b6f15-0x0;var _0x343d29=_0xb43b[_0x5b6f15];return _0x343d29;};'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')]('MailSubstatus,\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')]('MailSubstatus,\x20%s,\x20%s',_0x80fe61,_0x208c2b['error'][_0xbb43('0x12')]);return _0x29ae1a(_0x208c2b['error']['message']);}logger[_0xbb43('0x10')]('MailSubstatus,\x20%s,\x20%s',_0x80fe61,_0x208c2b[_0xbb43('0x10')][_0xbb43('0x12')]);return _0x2a2f11(_0x208c2b['error']['message']);}else{logger['info'](_0xbb43('0x13'),_0x80fe61,_0xbb43('0xc'));_0x2a2f11(_0x208c2b['result']['message']);}})[_0xbb43('0x14')](function(_0x563ce1){logger['error'](_0xbb43('0x13'),_0x80fe61,_0x563ce1);_0x29ae1a(_0x563ce1);});});} \ No newline at end of file +var _0x1339=['info','MailSubstatus,\x20%s,\x20%s','request\x20sent','MailSubstatus,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request','then'];(function(_0x2aed8e,_0x6b1f1e){var _0x2e319b=function(_0x83905b){while(--_0x83905b){_0x2aed8e['push'](_0x2aed8e['shift']());}};_0x2e319b(++_0x6b1f1e);}(_0x1339,0x1ed));var _0x9133=function(_0x599044,_0x1f04ac){_0x599044=_0x599044-0x0;var _0x21bfb0=_0x1339[_0x599044];return _0x21bfb0;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x9133('0x0'));var BPromise=require(_0x9133('0x1'));var rs=require(_0x9133('0x2'));var fs=require('fs');var Redis=require(_0x9133('0x3'));var db=require(_0x9133('0x4'))['db'];var utils=require(_0x9133('0x5'));var logger=require(_0x9133('0x6'))(_0x9133('0x7'));var config=require('../../config/environment');var jayson=require(_0x9133('0x8'));var client=jayson[_0x9133('0x9')][_0x9133('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x539af6,_0x2758e2,_0x334dcd){return new BPromise(function(_0x3059c4,_0x431a55){return client[_0x9133('0xb')](_0x539af6,_0x334dcd)[_0x9133('0xc')](function(_0x4294b7){logger[_0x9133('0xd')](_0x9133('0xe'),_0x2758e2,_0x9133('0xf'));logger['debug'](_0x9133('0x10'),_0x2758e2,_0x9133('0xf'),JSON[_0x9133('0x11')](_0x4294b7));if(_0x4294b7[_0x9133('0x12')]){if(_0x4294b7[_0x9133('0x12')][_0x9133('0x13')]===0x1f4){logger['error'](_0x9133('0xe'),_0x2758e2,_0x4294b7[_0x9133('0x12')]['message']);return _0x431a55(_0x4294b7['error'][_0x9133('0x14')]);}logger['error'](_0x9133('0xe'),_0x2758e2,_0x4294b7[_0x9133('0x12')][_0x9133('0x14')]);return _0x3059c4(_0x4294b7[_0x9133('0x12')][_0x9133('0x14')]);}else{logger[_0x9133('0xd')]('MailSubstatus,\x20%s,\x20%s',_0x2758e2,_0x9133('0xf'));_0x3059c4(_0x4294b7[_0x9133('0x15')]['message']);}})[_0x9133('0x16')](function(_0xa46eb1){logger[_0x9133('0x12')](_0x9133('0xe'),_0x2758e2,_0xa46eb1);_0x431a55(_0xa46eb1);});});} \ No newline at end of file diff --git a/server/api/mailTransferReport/index.js b/server/api/mailTransferReport/index.js index 6f71b51..6ea0d42 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 _0xd467=['post','put','update','delete','exports','multer','util','path','connect-timeout','express','Router','../../components/interaction/service','../../config/environment','./mailTransferReport.controller','get','isAuthenticated','index','/:id','show'];(function(_0x3aaf0a,_0x450970){var _0x33e6bc=function(_0x1db54d){while(--_0x1db54d){_0x3aaf0a['push'](_0x3aaf0a['shift']());}};_0x33e6bc(++_0x450970);}(_0xd467,0x1f3));var _0x7d46=function(_0x12c823,_0x2d2149){_0x12c823=_0x12c823-0x0;var _0x3b3b7b=_0xd467[_0x12c823];return _0x3b3b7b;};'use strict';var multer=require(_0x7d46('0x0'));var util=require(_0x7d46('0x1'));var path=require(_0x7d46('0x2'));var timeout=require(_0x7d46('0x3'));var express=require(_0x7d46('0x4'));var router=express[_0x7d46('0x5')]();var auth=require('../../components/auth/service');var interaction=require(_0x7d46('0x6'));var config=require(_0x7d46('0x7'));var controller=require(_0x7d46('0x8'));router[_0x7d46('0x9')]('/',auth[_0x7d46('0xa')](),controller[_0x7d46('0xb')]);router[_0x7d46('0x9')]('/describe',auth[_0x7d46('0xa')](),controller['describe']);router[_0x7d46('0x9')](_0x7d46('0xc'),auth['isAuthenticated'](),controller[_0x7d46('0xd')]);router[_0x7d46('0xe')]('/',auth[_0x7d46('0xa')](),controller['create']);router[_0x7d46('0xf')](_0x7d46('0xc'),auth[_0x7d46('0xa')](),controller[_0x7d46('0x10')]);router[_0x7d46('0x11')]('/:id',auth['isAuthenticated'](),controller['destroy']);module[_0x7d46('0x12')]=router; \ No newline at end of file +var _0x896c=['update','delete','destroy','exports','multer','util','path','../../components/auth/service','../../components/interaction/service','../../config/environment','get','index','/describe','describe','/:id','isAuthenticated','show','post','put'];(function(_0x26be17,_0x36e7c0){var _0x1e0265=function(_0xa930c9){while(--_0xa930c9){_0x26be17['push'](_0x26be17['shift']());}};_0x1e0265(++_0x36e7c0);}(_0x896c,0x1a6));var _0xc896=function(_0x2842b4,_0x2b1b7b){_0x2842b4=_0x2842b4-0x0;var _0x2b9521=_0x896c[_0x2842b4];return _0x2b9521;};'use strict';var multer=require(_0xc896('0x0'));var util=require(_0xc896('0x1'));var path=require(_0xc896('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express['Router']();var auth=require(_0xc896('0x3'));var interaction=require(_0xc896('0x4'));var config=require(_0xc896('0x5'));var controller=require('./mailTransferReport.controller');router[_0xc896('0x6')]('/',auth['isAuthenticated'](),controller[_0xc896('0x7')]);router[_0xc896('0x6')](_0xc896('0x8'),auth['isAuthenticated'](),controller[_0xc896('0x9')]);router[_0xc896('0x6')](_0xc896('0xa'),auth[_0xc896('0xb')](),controller[_0xc896('0xc')]);router[_0xc896('0xd')]('/',auth[_0xc896('0xb')](),controller['create']);router[_0xc896('0xe')](_0xc896('0xa'),auth[_0xc896('0xb')](),controller[_0xc896('0xf')]);router[_0xc896('0x10')]('/:id',auth[_0xc896('0xb')](),controller[_0xc896('0x11')]);module[_0xc896('0x12')]=router; \ No newline at end of file diff --git a/server/api/mailTransferReport/mailTransferReport.attributes.js b/server/api/mailTransferReport/mailTransferReport.attributes.js index cf7ec11..50f383e 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 _0x59b5=['ENUM','account','agent','queue','NOW','moment','sequelize','exports'];(function(_0x12d6dd,_0x660eff){var _0x3211f1=function(_0x211cda){while(--_0x211cda){_0x12d6dd['push'](_0x12d6dd['shift']());}};_0x3211f1(++_0x660eff);}(_0x59b5,0x15d));var _0x559b=function(_0x171b06,_0x43e1f8){_0x171b06=_0x171b06-0x0;var _0x337cf6=_0x59b5[_0x171b06];return _0x337cf6;};'use strict';var moment=require(_0x559b('0x0'));var Sequelize=require(_0x559b('0x1'));module[_0x559b('0x2')]={'uniqueid':{'type':Sequelize['STRING'],'allowNull':![]},'type':{'type':Sequelize[_0x559b('0x3')](_0x559b('0x4'),_0x559b('0x5'),_0x559b('0x6')),'allowNull':![],'defaultValue':_0x559b('0x6')},'transferredAt':{'type':Sequelize['DATE'],'allowNull':![],'defaultValue':Sequelize[_0x559b('0x7')]}}; \ No newline at end of file +var _0x37d6=['exports','queue','DATE','NOW','moment','sequelize'];(function(_0x40e83f,_0x4f467a){var _0x17207f=function(_0xbeb1f0){while(--_0xbeb1f0){_0x40e83f['push'](_0x40e83f['shift']());}};_0x17207f(++_0x4f467a);}(_0x37d6,0xdc));var _0x637d=function(_0x5db313,_0x3c8f0c){_0x5db313=_0x5db313-0x0;var _0x36d503=_0x37d6[_0x5db313];return _0x36d503;};'use strict';var moment=require(_0x637d('0x0'));var Sequelize=require(_0x637d('0x1'));module[_0x637d('0x2')]={'uniqueid':{'type':Sequelize['STRING'],'allowNull':![]},'type':{'type':Sequelize['ENUM']('account','agent','queue'),'allowNull':![],'defaultValue':_0x637d('0x3')},'transferredAt':{'type':Sequelize[_0x637d('0x4')],'allowNull':![],'defaultValue':Sequelize[_0x637d('0x5')]}}; \ No newline at end of file diff --git a/server/api/mailTransferReport/mailTransferReport.controller.js b/server/api/mailTransferReport/mailTransferReport.controller.js index 7d03d65..5eacf47 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(_0x9964c7,_0x2eeb1b){var _0x136d43=function(_0x1eef05){while(--_0x1eef05){_0x9964c7['push'](_0x9964c7['shift']());}};_0x136d43(++_0x2eeb1b);}(_0x7a54,0x106));var _0x47a5=function(_0x4b41ad,_0x20bb41){_0x4b41ad=_0x4b41ad-0x0;var _0x310262=_0x7a54[_0x4b41ad];return _0x310262;};'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 _0x9957=['eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','path','sox','to-csv','ejs','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../mysqldb','sendStatus','status','end','json','offset','limit','set','Content-Range','reject','save','then','destroy','error','stack','name','send','map','rawAttributes','fieldName','type','key','query','keys','filters','intersection','model','fields','attributes','pick','filter','where','merge','VIRTUAL','options','MailTransferReport','count','includeAll','include','findAll','rows','show','find','catch','create','body','update','params','describe','html-pdf'];(function(_0x470063,_0x340c77){var _0x5e2761=function(_0x12b684){while(--_0x12b684){_0x470063['push'](_0x470063['shift']());}};_0x5e2761(++_0x340c77);}(_0x9957,0x93));var _0x7995=function(_0x5b644e,_0x2e5e07){_0x5b644e=_0x5b644e-0x0;var _0x49c6bf=_0x9957[_0x5b644e];return _0x49c6bf;};'use strict';var pdf=require(_0x7995('0x0'));var emlformat=require(_0x7995('0x1'));var rimraf=require(_0x7995('0x2'));var zipdir=require(_0x7995('0x3'));var jsonpatch=require('fast-json-patch');var rp=require(_0x7995('0x4'));var moment=require(_0x7995('0x5'));var BPromise=require(_0x7995('0x6'));var Mustache=require(_0x7995('0x7'));var util=require('util');var path=require(_0x7995('0x8'));var sox=require(_0x7995('0x9'));var csv=require(_0x7995('0xa'));var ejs=require(_0x7995('0xb'));var fs=require('fs');var _=require(_0x7995('0xc'));var squel=require(_0x7995('0xd'));var crypto=require('crypto');var jsforce=require(_0x7995('0xe'));var deskjs=require(_0x7995('0xf'));var toCsv=require('to-csv');var querystring=require(_0x7995('0x10'));var Papa=require(_0x7995('0x11'));var Redis=require(_0x7995('0x12'));var authService=require(_0x7995('0x13'));var qs=require(_0x7995('0x14'));var as=require(_0x7995('0x15'));var hardwareService=require(_0x7995('0x16'));var logger=require('../../config/logger')(_0x7995('0x17'));var utils=require(_0x7995('0x18'));var config=require('../../config/environment');var db=require(_0x7995('0x19'))['db'];function respondWithStatusCode(_0x2cb37a,_0x19a27e){_0x19a27e=_0x19a27e||0xcc;return function(_0x385f00){if(_0x385f00){return _0x2cb37a[_0x7995('0x1a')](_0x19a27e);}return _0x2cb37a[_0x7995('0x1b')](_0x19a27e)[_0x7995('0x1c')]();};}function respondWithResult(_0x4cc004,_0x58f5ad){_0x58f5ad=_0x58f5ad||0xc8;return function(_0x2b4e94){if(_0x2b4e94){return _0x4cc004[_0x7995('0x1b')](_0x58f5ad)[_0x7995('0x1d')](_0x2b4e94);}};}function respondWithFilteredResult(_0x321ae8,_0x3f1d3e){return function(_0x1a5310){if(_0x1a5310){var _0x2202ce=_0x1a5310['count'],_0x41cbf0=_0x3f1d3e[_0x7995('0x1e')],_0x5377e5=_0x3f1d3e[_0x7995('0x1e')]+_0x3f1d3e[_0x7995('0x1f')],_0x2eeacc;if(_0x5377e5>=_0x2202ce){_0x5377e5=_0x2202ce;_0x2eeacc=0xc8;}else{_0x2eeacc=0xce;}_0x321ae8[_0x7995('0x1b')](_0x2eeacc);return _0x321ae8[_0x7995('0x20')](_0x7995('0x21'),_0x41cbf0+'-'+_0x5377e5+'/'+_0x2202ce)['json'](_0x1a5310);}return null;};}function patchUpdates(_0x54c9ae){return function(_0x2536c8){try{jsonpatch['apply'](_0x2536c8,_0x54c9ae,!![]);}catch(_0x555f74){return BPromise[_0x7995('0x22')](_0x555f74);}return _0x2536c8[_0x7995('0x23')]();};}function saveUpdates(_0x4cbe10,_0x3a9b54){return function(_0x51f276){if(_0x51f276){return _0x51f276['update'](_0x4cbe10)[_0x7995('0x24')](function(_0x327b1f){return _0x327b1f;});}return null;};}function removeEntity(_0x350fd9,_0x1a8568){return function(_0x460924){if(_0x460924){return _0x460924[_0x7995('0x25')]()['then'](function(){_0x350fd9[_0x7995('0x1b')](0xcc)[_0x7995('0x1c')]();});}};}function handleEntityNotFound(_0x204507,_0x285437){return function(_0x563799){if(!_0x563799){_0x204507[_0x7995('0x1a')](0x194);}return _0x563799;};}function handleError(_0x475351,_0x472195){_0x472195=_0x472195||0x1f4;return function(_0x59405a){logger[_0x7995('0x26')](_0x59405a[_0x7995('0x27')]);if(_0x59405a[_0x7995('0x28')]){delete _0x59405a[_0x7995('0x28')];}_0x475351[_0x7995('0x1b')](_0x472195)[_0x7995('0x29')](_0x59405a);};}exports['index']=function(_0x47625f,_0x5911c3){var _0x229742={},_0x49bc7e={},_0xf16cc2={'count':0x0,'rows':[]};var _0x132a42=_[_0x7995('0x2a')](db['MailTransferReport'][_0x7995('0x2b')],function(_0x514445){return{'name':_0x514445[_0x7995('0x2c')],'type':_0x514445[_0x7995('0x2d')][_0x7995('0x2e')]};});_0x49bc7e['model']=_['map'](_0x132a42,'name');_0x49bc7e[_0x7995('0x2f')]=_[_0x7995('0x30')](_0x47625f[_0x7995('0x2f')]);_0x49bc7e[_0x7995('0x31')]=_[_0x7995('0x32')](_0x49bc7e[_0x7995('0x33')],_0x49bc7e['query']);_0x229742['attributes']=_[_0x7995('0x32')](_0x49bc7e['model'],qs[_0x7995('0x34')](_0x47625f[_0x7995('0x2f')][_0x7995('0x34')]));_0x229742[_0x7995('0x35')]=_0x229742[_0x7995('0x35')]['length']?_0x229742[_0x7995('0x35')]:_0x49bc7e[_0x7995('0x33')];if(!_0x47625f['query']['hasOwnProperty']('nolimit')){_0x229742[_0x7995('0x1f')]=qs[_0x7995('0x1f')](_0x47625f['query'][_0x7995('0x1f')]);_0x229742['offset']=qs[_0x7995('0x1e')](_0x47625f[_0x7995('0x2f')][_0x7995('0x1e')]);}_0x229742['order']=qs['sort'](_0x47625f[_0x7995('0x2f')]['sort']);_0x229742['where']=qs[_0x7995('0x31')](_[_0x7995('0x36')](_0x47625f['query'],_0x49bc7e[_0x7995('0x31')]));if(_0x47625f[_0x7995('0x2f')][_0x7995('0x37')]){_0x229742[_0x7995('0x38')]=_[_0x7995('0x39')](_0x229742['where'],{'$or':_[_0x7995('0x2a')](_0x132a42,function(_0x242713){if(_0x242713[_0x7995('0x2d')]!==_0x7995('0x3a')){var _0x4b1541={};_0x4b1541[_0x242713[_0x7995('0x28')]]={'$like':'%'+_0x47625f[_0x7995('0x2f')][_0x7995('0x37')]+'%'};return _0x4b1541;}})});}_0x229742=_[_0x7995('0x39')]({},_0x229742,_0x47625f[_0x7995('0x3b')]);var _0x1035dc={'where':_0x229742['where']};return db[_0x7995('0x3c')][_0x7995('0x3d')](_0x1035dc)[_0x7995('0x24')](function(_0x2ea47f){_0xf16cc2[_0x7995('0x3d')]=_0x2ea47f;if(_0x47625f[_0x7995('0x2f')][_0x7995('0x3e')]){_0x229742[_0x7995('0x3f')]=[{'all':!![]}];}return db[_0x7995('0x3c')][_0x7995('0x40')](_0x229742);})[_0x7995('0x24')](function(_0x270d52){_0xf16cc2[_0x7995('0x41')]=_0x270d52;return _0xf16cc2;})['then'](respondWithFilteredResult(_0x5911c3,_0x229742))['catch'](handleError(_0x5911c3,null));};exports[_0x7995('0x42')]=function(_0x7325e8,_0x58523e){var _0x4b0855={'raw':!![],'where':{'id':_0x7325e8['params']['id']}},_0x3f8522={};_0x3f8522['model']=_[_0x7995('0x30')](db[_0x7995('0x3c')][_0x7995('0x2b')]);_0x3f8522['query']=_[_0x7995('0x30')](_0x7325e8['query']);_0x3f8522[_0x7995('0x31')]=_['intersection'](_0x3f8522['model'],_0x3f8522[_0x7995('0x2f')]);_0x4b0855[_0x7995('0x35')]=_[_0x7995('0x32')](_0x3f8522[_0x7995('0x33')],qs['fields'](_0x7325e8[_0x7995('0x2f')][_0x7995('0x34')]));_0x4b0855[_0x7995('0x35')]=_0x4b0855[_0x7995('0x35')]['length']?_0x4b0855['attributes']:_0x3f8522[_0x7995('0x33')];if(_0x7325e8['query'][_0x7995('0x3e')]){_0x4b0855['include']=[{'all':!![]}];}_0x4b0855=_[_0x7995('0x39')]({},_0x4b0855,_0x7325e8['options']);return db[_0x7995('0x3c')][_0x7995('0x43')](_0x4b0855)['then'](handleEntityNotFound(_0x58523e,null))[_0x7995('0x24')](respondWithResult(_0x58523e,null))[_0x7995('0x44')](handleError(_0x58523e,null));};exports[_0x7995('0x45')]=function(_0xb70a51,_0x4c6837){return db[_0x7995('0x3c')][_0x7995('0x45')](_0xb70a51[_0x7995('0x46')],{})['then'](respondWithResult(_0x4c6837,0xc9))[_0x7995('0x44')](handleError(_0x4c6837,null));};exports[_0x7995('0x47')]=function(_0x511567,_0x3d8ae3){if(_0x511567[_0x7995('0x46')]['id']){delete _0x511567['body']['id'];}return db[_0x7995('0x3c')][_0x7995('0x43')]({'where':{'id':_0x511567['params']['id']}})[_0x7995('0x24')](handleEntityNotFound(_0x3d8ae3,null))['then'](saveUpdates(_0x511567[_0x7995('0x46')],null))[_0x7995('0x24')](respondWithResult(_0x3d8ae3,null))[_0x7995('0x44')](handleError(_0x3d8ae3,null));};exports[_0x7995('0x25')]=function(_0xddf537,_0x14b537){return db[_0x7995('0x3c')]['find']({'where':{'id':_0xddf537[_0x7995('0x48')]['id']}})[_0x7995('0x24')](handleEntityNotFound(_0x14b537,null))[_0x7995('0x24')](removeEntity(_0x14b537,null))['catch'](handleError(_0x14b537,null));};exports[_0x7995('0x49')]=function(_0x1fe77e,_0x12d4b8){return db['MailTransferReport']['describe']()['then'](respondWithResult(_0x12d4b8,null))[_0x7995('0x44')](handleError(_0x12d4b8,null));}; \ No newline at end of file diff --git a/server/api/mailTransferReport/mailTransferReport.model.js b/server/api/mailTransferReport/mailTransferReport.model.js index 5c802cb..1bdd82f 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 _0x33d4=['uniqueid','lodash','util','api','bluebird','request-promise','path','rimraf','../../config/environment','./mailTransferReport.attributes','exports'];(function(_0x301055,_0x5526d){var _0x115173=function(_0x5592c9){while(--_0x5592c9){_0x301055['push'](_0x301055['shift']());}};_0x115173(++_0x5526d);}(_0x33d4,0x156));var _0x433d=function(_0x2ac2a3,_0x7b8940){_0x2ac2a3=_0x2ac2a3-0x0;var _0x1928aa=_0x33d4[_0x2ac2a3];return _0x1928aa;};'use strict';var _=require(_0x433d('0x0'));var util=require(_0x433d('0x1'));var logger=require('../../config/logger')(_0x433d('0x2'));var moment=require('moment');var BPromise=require(_0x433d('0x3'));var rp=require(_0x433d('0x4'));var fs=require('fs');var path=require(_0x433d('0x5'));var rimraf=require(_0x433d('0x6'));var config=require(_0x433d('0x7'));var attributes=require(_0x433d('0x8'));module[_0x433d('0x9')]=function(_0x194409,_0x57599e){return _0x194409['define']('MailTransferReport',attributes,{'tableName':'report_mail_transfer','paranoid':![],'indexes':[{'name':'uniqueid','fields':[_0x433d('0xa')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x4246=['path','rimraf','./mailTransferReport.attributes','exports','define','MailTransferReport','report_mail_transfer','uniqueid','lodash','util','../../config/logger','api','moment','bluebird','request-promise'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x4246,0x19d));var _0x6424=function(_0xf944a7,_0x3a1c1d){_0xf944a7=_0xf944a7-0x0;var _0x4efb1e=_0x4246[_0xf944a7];return _0x4efb1e;};'use strict';var _=require(_0x6424('0x0'));var util=require(_0x6424('0x1'));var logger=require(_0x6424('0x2'))(_0x6424('0x3'));var moment=require(_0x6424('0x4'));var BPromise=require(_0x6424('0x5'));var rp=require(_0x6424('0x6'));var fs=require('fs');var path=require(_0x6424('0x7'));var rimraf=require(_0x6424('0x8'));var config=require('../../config/environment');var attributes=require(_0x6424('0x9'));module[_0x6424('0xa')]=function(_0x7fcba5,_0x5ab530){return _0x7fcba5[_0x6424('0xb')](_0x6424('0xc'),attributes,{'tableName':_0x6424('0xd'),'paranoid':![],'indexes':[{'name':_0x6424('0xe'),'fields':[_0x6424('0xe')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/mailTransferReport/mailTransferReport.rpc.js b/server/api/mailTransferReport/mailTransferReport.rpc.js index 66ae449..9effd27 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 _0x43a2=['rpc','../../config/environment','client','http','request','then','info','MailTransferReport,\x20%s,\x20%s','request\x20sent','debug','MailTransferReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger'];(function(_0x3d35a0,_0x5842a3){var _0x334f7f=function(_0x559952){while(--_0x559952){_0x3d35a0['push'](_0x3d35a0['shift']());}};_0x334f7f(++_0x5842a3);}(_0x43a2,0x1f0));var _0x243a=function(_0x2e6a52,_0x3ae9b8){_0x2e6a52=_0x2e6a52-0x0;var _0x247f85=_0x43a2[_0x2e6a52];return _0x247f85;};'use strict';var _=require(_0x243a('0x0'));var util=require(_0x243a('0x1'));var moment=require('moment');var BPromise=require(_0x243a('0x2'));var rs=require(_0x243a('0x3'));var fs=require('fs');var Redis=require(_0x243a('0x4'));var db=require(_0x243a('0x5'))['db'];var utils=require(_0x243a('0x6'));var logger=require(_0x243a('0x7'))(_0x243a('0x8'));var config=require(_0x243a('0x9'));var jayson=require('jayson/promise');var client=jayson[_0x243a('0xa')][_0x243a('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x102e1e,_0x29a8b2,_0x2197fd){return new BPromise(function(_0x21064e,_0x2a3b87){return client[_0x243a('0xc')](_0x102e1e,_0x2197fd)[_0x243a('0xd')](function(_0x1cde0a){logger[_0x243a('0xe')](_0x243a('0xf'),_0x29a8b2,_0x243a('0x10'));logger[_0x243a('0x11')](_0x243a('0x12'),_0x29a8b2,_0x243a('0x10'),JSON[_0x243a('0x13')](_0x1cde0a));if(_0x1cde0a[_0x243a('0x14')]){if(_0x1cde0a[_0x243a('0x14')][_0x243a('0x15')]===0x1f4){logger[_0x243a('0x14')](_0x243a('0xf'),_0x29a8b2,_0x1cde0a[_0x243a('0x14')][_0x243a('0x16')]);return _0x2a3b87(_0x1cde0a[_0x243a('0x14')]['message']);}logger['error'](_0x243a('0xf'),_0x29a8b2,_0x1cde0a['error'][_0x243a('0x16')]);return _0x21064e(_0x1cde0a[_0x243a('0x14')][_0x243a('0x16')]);}else{logger['info']('MailTransferReport,\x20%s,\x20%s',_0x29a8b2,_0x243a('0x10'));_0x21064e(_0x1cde0a[_0x243a('0x17')][_0x243a('0x16')]);}})['catch'](function(_0x73fa42){logger[_0x243a('0x14')](_0x243a('0xf'),_0x29a8b2,_0x73fa42);_0x2a3b87(_0x73fa42);});});} \ No newline at end of file +var _0xe957=['client','http','then','info','MailTransferReport,\x20%s,\x20%s','request\x20sent','debug','MailTransferReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise'];(function(_0x13cb51,_0x205c5c){var _0x269d4f=function(_0x3751c4){while(--_0x3751c4){_0x13cb51['push'](_0x13cb51['shift']());}};_0x269d4f(++_0x205c5c);}(_0xe957,0x194));var _0x7e95=function(_0x2450fb,_0x4758c8){_0x2450fb=_0x2450fb-0x0;var _0x1eaad0=_0xe957[_0x2450fb];return _0x1eaad0;};'use strict';var _=require(_0x7e95('0x0'));var util=require(_0x7e95('0x1'));var moment=require('moment');var BPromise=require(_0x7e95('0x2'));var rs=require(_0x7e95('0x3'));var fs=require('fs');var Redis=require(_0x7e95('0x4'));var db=require(_0x7e95('0x5'))['db'];var utils=require(_0x7e95('0x6'));var logger=require('../../config/logger')(_0x7e95('0x7'));var config=require(_0x7e95('0x8'));var jayson=require(_0x7e95('0x9'));var client=jayson[_0x7e95('0xa')][_0x7e95('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x4e8513,_0x466d6d,_0x4d8877){return new BPromise(function(_0x11242b,_0xad31ca){return client['request'](_0x4e8513,_0x4d8877)[_0x7e95('0xc')](function(_0x430da8){logger[_0x7e95('0xd')](_0x7e95('0xe'),_0x466d6d,_0x7e95('0xf'));logger[_0x7e95('0x10')](_0x7e95('0x11'),_0x466d6d,'request\x20sent',JSON[_0x7e95('0x12')](_0x430da8));if(_0x430da8['error']){if(_0x430da8[_0x7e95('0x13')][_0x7e95('0x14')]===0x1f4){logger[_0x7e95('0x13')](_0x7e95('0xe'),_0x466d6d,_0x430da8[_0x7e95('0x13')]['message']);return _0xad31ca(_0x430da8['error'][_0x7e95('0x15')]);}logger['error'](_0x7e95('0xe'),_0x466d6d,_0x430da8['error']['message']);return _0x11242b(_0x430da8[_0x7e95('0x13')][_0x7e95('0x15')]);}else{logger['info'](_0x7e95('0xe'),_0x466d6d,_0x7e95('0xf'));_0x11242b(_0x430da8[_0x7e95('0x16')]['message']);}})['catch'](function(_0x56fa18){logger[_0x7e95('0x13')](_0x7e95('0xe'),_0x466d6d,_0x56fa18);_0xad31ca(_0x56fa18);});});} \ No newline at end of file diff --git a/server/api/memberReport/index.js b/server/api/memberReport/index.js index 3c9f027..4a30d66 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 _0x160f=['show','put','update','delete','destroy','multer','util','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','index','get','/describe','isAuthenticated','describe','/:id'];(function(_0x3a263d,_0x4d920f){var _0x2fa98f=function(_0x1ef6a0){while(--_0x1ef6a0){_0x3a263d['push'](_0x3a263d['shift']());}};_0x2fa98f(++_0x4d920f);}(_0x160f,0x8a));var _0xf160=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x160f[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require(_0xf160('0x0'));var util=require(_0xf160('0x1'));var path=require('path');var timeout=require(_0xf160('0x2'));var express=require(_0xf160('0x3'));var router=express[_0xf160('0x4')]();var auth=require(_0xf160('0x5'));var interaction=require(_0xf160('0x6'));var config=require(_0xf160('0x7'));var controller=require('./memberReport.controller');router['get']('/',auth['isAuthenticated'](),controller[_0xf160('0x8')]);router[_0xf160('0x9')](_0xf160('0xa'),auth[_0xf160('0xb')](),controller[_0xf160('0xc')]);router[_0xf160('0x9')](_0xf160('0xd'),auth[_0xf160('0xb')](),controller[_0xf160('0xe')]);router['post']('/',auth[_0xf160('0xb')](),controller['create']);router[_0xf160('0xf')]('/:id',auth[_0xf160('0xb')](),controller[_0xf160('0x10')]);router[_0xf160('0x11')]('/:id',auth[_0xf160('0xb')](),controller[_0xf160('0x12')]);module['exports']=router; \ No newline at end of file +var _0x0545=['exports','multer','util','path','connect-timeout','express','../../components/auth/service','../../components/interaction/service','get','isAuthenticated','/describe','describe','/:id','post','create','put','update','delete','destroy'];(function(_0x4afa3d,_0x11199f){var _0xb1a440=function(_0x55a71e){while(--_0x55a71e){_0x4afa3d['push'](_0x4afa3d['shift']());}};_0xb1a440(++_0x11199f);}(_0x0545,0x1dc));var _0x5054=function(_0xd5836a,_0x1cf1ad){_0xd5836a=_0xd5836a-0x0;var _0x3614ad=_0x0545[_0xd5836a];return _0x3614ad;};'use strict';var multer=require(_0x5054('0x0'));var util=require(_0x5054('0x1'));var path=require(_0x5054('0x2'));var timeout=require(_0x5054('0x3'));var express=require(_0x5054('0x4'));var router=express['Router']();var auth=require(_0x5054('0x5'));var interaction=require(_0x5054('0x6'));var config=require('../../config/environment');var controller=require('./memberReport.controller');router[_0x5054('0x7')]('/',auth[_0x5054('0x8')](),controller['index']);router['get'](_0x5054('0x9'),auth[_0x5054('0x8')](),controller[_0x5054('0xa')]);router[_0x5054('0x7')](_0x5054('0xb'),auth[_0x5054('0x8')](),controller['show']);router[_0x5054('0xc')]('/',auth[_0x5054('0x8')](),controller[_0x5054('0xd')]);router[_0x5054('0xe')](_0x5054('0xb'),auth[_0x5054('0x8')](),controller[_0x5054('0xf')]);router[_0x5054('0x10')]('/:id',auth['isAuthenticated'](),controller[_0x5054('0x11')]);module[_0x5054('0x12')]=router; \ No newline at end of file diff --git a/server/api/memberReport/memberReport.attributes.js b/server/api/memberReport/memberReport.attributes.js index d29831c..436dada 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 _0xc656=['duration','talk:[inbound,\x20outbound],\x20pause:[reason]','talk:[destination]','talk:[dial\x20string]','talk:[queue]','sequelize','moment','exports','STRING','LOGIN,\x20PAUSE,\x20TALKING','INTEGER','DATE','getDataValue','enterAt','diff','seconds','setDataValue','exitAt'];(function(_0x222619,_0x589023){var _0x5d76f8=function(_0x227a90){while(--_0x227a90){_0x222619['push'](_0x222619['shift']());}};_0x5d76f8(++_0x589023);}(_0xc656,0x1d9));var _0x6c65=function(_0x22df0e,_0x1acbfd){_0x22df0e=_0x22df0e-0x0;var _0x25cf95=_0xc656[_0x22df0e];return _0x25cf95;};'use strict';var Sequelize=require(_0x6c65('0x0'));var moment=require(_0x6c65('0x1'));module[_0x6c65('0x2')]={'channel':{'type':Sequelize['STRING']},'membername':{'type':Sequelize[_0x6c65('0x3')]},'interface':{'type':Sequelize[_0x6c65('0x3')]},'type':{'type':Sequelize[_0x6c65('0x3')],'defaultValue':'DEFAULT\x20PAUSE','comment':_0x6c65('0x4')},'duration':{'type':Sequelize[_0x6c65('0x5')]},'enterAt':{'type':Sequelize[_0x6c65('0x6')]},'exitAt':{'type':Sequelize[_0x6c65('0x6')],'set':function(_0x145f62){var _0x2b489c=moment(_0x145f62);var _0x106c46=moment(this[_0x6c65('0x7')](_0x6c65('0x8')));var _0x1e2bba=_0x2b489c[_0x6c65('0x9')](_0x106c46,_0x6c65('0xa'));this[_0x6c65('0xb')](_0x6c65('0xc'),_0x145f62);this[_0x6c65('0xb')](_0x6c65('0xd'),_0x1e2bba||null);}},'data1':{'type':Sequelize[_0x6c65('0x3')],'comment':_0x6c65('0xe')},'data2':{'type':Sequelize[_0x6c65('0x3')],'comment':'talk:[start]'},'data3':{'type':Sequelize['STRING'],'comment':_0x6c65('0xf')},'data4':{'type':Sequelize[_0x6c65('0x3')],'comment':_0x6c65('0x10')},'data5':{'type':Sequelize[_0x6c65('0x3')],'comment':_0x6c65('0x11')},'role':{'type':Sequelize[_0x6c65('0x3')]},'internal':{'type':Sequelize[_0x6c65('0x5')]},'uniqueid':{'type':Sequelize[_0x6c65('0x3')]}}; \ No newline at end of file +var _0xe89c=['diff','seconds','setDataValue','talk:[start]','talk:[destination]','talk:[dial\x20string]','talk:[queue]','INTEGER','sequelize','moment','STRING','LOGIN,\x20PAUSE,\x20TALKING','DATE','getDataValue','enterAt'];(function(_0x288ed6,_0x4635dd){var _0x30da4a=function(_0x1be3fe){while(--_0x1be3fe){_0x288ed6['push'](_0x288ed6['shift']());}};_0x30da4a(++_0x4635dd);}(_0xe89c,0x1ac));var _0xce89=function(_0x486e44,_0x2144a2){_0x486e44=_0x486e44-0x0;var _0x470dbf=_0xe89c[_0x486e44];return _0x470dbf;};'use strict';var Sequelize=require(_0xce89('0x0'));var moment=require(_0xce89('0x1'));module['exports']={'channel':{'type':Sequelize[_0xce89('0x2')]},'membername':{'type':Sequelize['STRING']},'interface':{'type':Sequelize[_0xce89('0x2')]},'type':{'type':Sequelize[_0xce89('0x2')],'defaultValue':'DEFAULT\x20PAUSE','comment':_0xce89('0x3')},'duration':{'type':Sequelize['INTEGER']},'enterAt':{'type':Sequelize['DATE']},'exitAt':{'type':Sequelize[_0xce89('0x4')],'set':function(_0x32f8bf){var _0x56ca01=moment(_0x32f8bf);var _0x30305f=moment(this[_0xce89('0x5')](_0xce89('0x6')));var _0x587d94=_0x56ca01[_0xce89('0x7')](_0x30305f,_0xce89('0x8'));this[_0xce89('0x9')]('exitAt',_0x32f8bf);this[_0xce89('0x9')]('duration',_0x587d94||null);}},'data1':{'type':Sequelize[_0xce89('0x2')],'comment':'talk:[inbound,\x20outbound],\x20pause:[reason]'},'data2':{'type':Sequelize[_0xce89('0x2')],'comment':_0xce89('0xa')},'data3':{'type':Sequelize[_0xce89('0x2')],'comment':_0xce89('0xb')},'data4':{'type':Sequelize[_0xce89('0x2')],'comment':_0xce89('0xc')},'data5':{'type':Sequelize[_0xce89('0x2')],'comment':_0xce89('0xd')},'role':{'type':Sequelize[_0xce89('0x2')]},'internal':{'type':Sequelize[_0xce89('0xe')]},'uniqueid':{'type':Sequelize[_0xce89('0x2')]}}; \ No newline at end of file diff --git a/server/api/memberReport/memberReport.controller.js b/server/api/memberReport/memberReport.controller.js index 27e16d1..bc38707 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 _0x9ec9=['../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','count','offset','limit','set','Content-Range','reject','save','update','then','destroy','error','send','index','map','MemberReport','rawAttributes','type','key','model','keys','query','filters','attributes','intersection','fields','length','hasOwnProperty','sort','pick','filter','VIRTUAL','name','merge','includeAll','include','rows','catch','show','options','create','body','find','params','describe','html-pdf','rimraf','zip-dir','request-promise','moment','bluebird','util','to-csv','ejs','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger'];(function(_0x161ed7,_0x2e4b4b){var _0x11491d=function(_0x3a2c77){while(--_0x3a2c77){_0x161ed7['push'](_0x161ed7['shift']());}};_0x11491d(++_0x2e4b4b);}(_0x9ec9,0x1d1));var _0x99ec=function(_0x5622b2,_0x5dc268){_0x5622b2=_0x5622b2-0x0;var _0x2c441b=_0x9ec9[_0x5622b2];return _0x2c441b;};'use strict';var pdf=require(_0x99ec('0x0'));var emlformat=require('eml-format');var rimraf=require(_0x99ec('0x1'));var zipdir=require(_0x99ec('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x99ec('0x3'));var moment=require(_0x99ec('0x4'));var BPromise=require(_0x99ec('0x5'));var Mustache=require('mustache');var util=require(_0x99ec('0x6'));var path=require('path');var sox=require('sox');var csv=require(_0x99ec('0x7'));var ejs=require(_0x99ec('0x8'));var fs=require('fs');var _=require('lodash');var squel=require(_0x99ec('0x9'));var crypto=require('crypto');var jsforce=require(_0x99ec('0xa'));var deskjs=require(_0x99ec('0xb'));var toCsv=require(_0x99ec('0x7'));var querystring=require(_0x99ec('0xc'));var Papa=require(_0x99ec('0xd'));var Redis=require(_0x99ec('0xe'));var authService=require('../../components/auth/service');var qs=require(_0x99ec('0xf'));var as=require(_0x99ec('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x99ec('0x11'))('api');var utils=require(_0x99ec('0x12'));var config=require(_0x99ec('0x13'));var db=require(_0x99ec('0x14'))['db'];function respondWithStatusCode(_0x10ea9a,_0x4ce732){_0x4ce732=_0x4ce732||0xcc;return function(_0x2e4037){if(_0x2e4037){return _0x10ea9a[_0x99ec('0x15')](_0x4ce732);}return _0x10ea9a[_0x99ec('0x16')](_0x4ce732)[_0x99ec('0x17')]();};}function respondWithResult(_0x1317d7,_0x5742da){_0x5742da=_0x5742da||0xc8;return function(_0xbc0fd4){if(_0xbc0fd4){return _0x1317d7[_0x99ec('0x16')](_0x5742da)[_0x99ec('0x18')](_0xbc0fd4);}};}function respondWithFilteredResult(_0x1b928d,_0x366f07){return function(_0x361172){if(_0x361172){var _0x44f6a4=_0x361172[_0x99ec('0x19')],_0x10b880=_0x366f07['offset'],_0x563c02=_0x366f07[_0x99ec('0x1a')]+_0x366f07[_0x99ec('0x1b')],_0x340fbc;if(_0x563c02>=_0x44f6a4){_0x563c02=_0x44f6a4;_0x340fbc=0xc8;}else{_0x340fbc=0xce;}_0x1b928d[_0x99ec('0x16')](_0x340fbc);return _0x1b928d[_0x99ec('0x1c')](_0x99ec('0x1d'),_0x10b880+'-'+_0x563c02+'/'+_0x44f6a4)[_0x99ec('0x18')](_0x361172);}return null;};}function patchUpdates(_0x4b528b){return function(_0x5a58ff){try{jsonpatch['apply'](_0x5a58ff,_0x4b528b,!![]);}catch(_0x38ed55){return BPromise[_0x99ec('0x1e')](_0x38ed55);}return _0x5a58ff[_0x99ec('0x1f')]();};}function saveUpdates(_0x1faaa2,_0x1488ed){return function(_0x3cbe44){if(_0x3cbe44){return _0x3cbe44[_0x99ec('0x20')](_0x1faaa2)[_0x99ec('0x21')](function(_0x52ae8a){return _0x52ae8a;});}return null;};}function removeEntity(_0x1eed9f,_0x11aba1){return function(_0x2e259f){if(_0x2e259f){return _0x2e259f[_0x99ec('0x22')]()[_0x99ec('0x21')](function(){_0x1eed9f[_0x99ec('0x16')](0xcc)['end']();});}};}function handleEntityNotFound(_0x18752e,_0x1c0fce){return function(_0x2e7746){if(!_0x2e7746){_0x18752e[_0x99ec('0x15')](0x194);}return _0x2e7746;};}function handleError(_0x16e290,_0x56b79e){_0x56b79e=_0x56b79e||0x1f4;return function(_0x3d687e){logger[_0x99ec('0x23')](_0x3d687e['stack']);if(_0x3d687e['name']){delete _0x3d687e['name'];}_0x16e290['status'](_0x56b79e)[_0x99ec('0x24')](_0x3d687e);};}exports[_0x99ec('0x25')]=function(_0x5b63b5,_0x16d049){var _0x5e33d0={},_0x1ddfe0={},_0xbc9b0c={'count':0x0,'rows':[]};var _0x3be434=_[_0x99ec('0x26')](db[_0x99ec('0x27')][_0x99ec('0x28')],function(_0x332785){return{'name':_0x332785['fieldName'],'type':_0x332785[_0x99ec('0x29')][_0x99ec('0x2a')]};});_0x1ddfe0[_0x99ec('0x2b')]=_[_0x99ec('0x26')](_0x3be434,'name');_0x1ddfe0['query']=_[_0x99ec('0x2c')](_0x5b63b5[_0x99ec('0x2d')]);_0x1ddfe0[_0x99ec('0x2e')]=_['intersection'](_0x1ddfe0['model'],_0x1ddfe0[_0x99ec('0x2d')]);_0x5e33d0[_0x99ec('0x2f')]=_[_0x99ec('0x30')](_0x1ddfe0[_0x99ec('0x2b')],qs[_0x99ec('0x31')](_0x5b63b5[_0x99ec('0x2d')][_0x99ec('0x31')]));_0x5e33d0[_0x99ec('0x2f')]=_0x5e33d0[_0x99ec('0x2f')][_0x99ec('0x32')]?_0x5e33d0[_0x99ec('0x2f')]:_0x1ddfe0[_0x99ec('0x2b')];if(!_0x5b63b5[_0x99ec('0x2d')][_0x99ec('0x33')]('nolimit')){_0x5e33d0[_0x99ec('0x1b')]=qs[_0x99ec('0x1b')](_0x5b63b5[_0x99ec('0x2d')][_0x99ec('0x1b')]);_0x5e33d0['offset']=qs[_0x99ec('0x1a')](_0x5b63b5[_0x99ec('0x2d')][_0x99ec('0x1a')]);}_0x5e33d0['order']=qs[_0x99ec('0x34')](_0x5b63b5[_0x99ec('0x2d')][_0x99ec('0x34')]);_0x5e33d0['where']=qs[_0x99ec('0x2e')](_[_0x99ec('0x35')](_0x5b63b5[_0x99ec('0x2d')],_0x1ddfe0['filters']));if(_0x5b63b5[_0x99ec('0x2d')][_0x99ec('0x36')]){_0x5e33d0['where']=_['merge'](_0x5e33d0['where'],{'$or':_[_0x99ec('0x26')](_0x3be434,function(_0x510613){if(_0x510613[_0x99ec('0x29')]!==_0x99ec('0x37')){var _0x4fb0cf={};_0x4fb0cf[_0x510613[_0x99ec('0x38')]]={'$like':'%'+_0x5b63b5['query'][_0x99ec('0x36')]+'%'};return _0x4fb0cf;}})});}_0x5e33d0=_[_0x99ec('0x39')]({},_0x5e33d0,_0x5b63b5['options']);var _0x2b4b0a={'where':_0x5e33d0['where']};return db['MemberReport'][_0x99ec('0x19')](_0x2b4b0a)[_0x99ec('0x21')](function(_0xa69b52){_0xbc9b0c[_0x99ec('0x19')]=_0xa69b52;if(_0x5b63b5[_0x99ec('0x2d')][_0x99ec('0x3a')]){_0x5e33d0[_0x99ec('0x3b')]=[{'all':!![]}];}return db[_0x99ec('0x27')]['findAll'](_0x5e33d0);})[_0x99ec('0x21')](function(_0xcd05de){_0xbc9b0c[_0x99ec('0x3c')]=_0xcd05de;return _0xbc9b0c;})[_0x99ec('0x21')](respondWithFilteredResult(_0x16d049,_0x5e33d0))[_0x99ec('0x3d')](handleError(_0x16d049,null));};exports[_0x99ec('0x3e')]=function(_0x2b9a1f,_0x151b43){var _0x58e7f6={'raw':!![],'where':{'id':_0x2b9a1f['params']['id']}},_0x299f0d={};_0x299f0d[_0x99ec('0x2b')]=_['keys'](db[_0x99ec('0x27')][_0x99ec('0x28')]);_0x299f0d[_0x99ec('0x2d')]=_[_0x99ec('0x2c')](_0x2b9a1f[_0x99ec('0x2d')]);_0x299f0d[_0x99ec('0x2e')]=_[_0x99ec('0x30')](_0x299f0d[_0x99ec('0x2b')],_0x299f0d[_0x99ec('0x2d')]);_0x58e7f6['attributes']=_[_0x99ec('0x30')](_0x299f0d['model'],qs[_0x99ec('0x31')](_0x2b9a1f['query'][_0x99ec('0x31')]));_0x58e7f6[_0x99ec('0x2f')]=_0x58e7f6[_0x99ec('0x2f')][_0x99ec('0x32')]?_0x58e7f6[_0x99ec('0x2f')]:_0x299f0d[_0x99ec('0x2b')];if(_0x2b9a1f[_0x99ec('0x2d')][_0x99ec('0x3a')]){_0x58e7f6['include']=[{'all':!![]}];}_0x58e7f6=_['merge']({},_0x58e7f6,_0x2b9a1f[_0x99ec('0x3f')]);return db[_0x99ec('0x27')]['find'](_0x58e7f6)[_0x99ec('0x21')](handleEntityNotFound(_0x151b43,null))[_0x99ec('0x21')](respondWithResult(_0x151b43,null))[_0x99ec('0x3d')](handleError(_0x151b43,null));};exports['create']=function(_0x41c160,_0x2437cb){return db[_0x99ec('0x27')][_0x99ec('0x40')](_0x41c160[_0x99ec('0x41')],{})[_0x99ec('0x21')](respondWithResult(_0x2437cb,0xc9))['catch'](handleError(_0x2437cb,null));};exports[_0x99ec('0x20')]=function(_0x22dc33,_0x12eedb){if(_0x22dc33[_0x99ec('0x41')]['id']){delete _0x22dc33['body']['id'];}return db['MemberReport'][_0x99ec('0x42')]({'where':{'id':_0x22dc33[_0x99ec('0x43')]['id']}})[_0x99ec('0x21')](handleEntityNotFound(_0x12eedb,null))[_0x99ec('0x21')](saveUpdates(_0x22dc33[_0x99ec('0x41')],null))['then'](respondWithResult(_0x12eedb,null))['catch'](handleError(_0x12eedb,null));};exports['destroy']=function(_0x29baf6,_0x502057){return db[_0x99ec('0x27')][_0x99ec('0x42')]({'where':{'id':_0x29baf6[_0x99ec('0x43')]['id']}})[_0x99ec('0x21')](handleEntityNotFound(_0x502057,null))[_0x99ec('0x21')](removeEntity(_0x502057,null))[_0x99ec('0x3d')](handleError(_0x502057,null));};exports[_0x99ec('0x44')]=function(_0x152c3c,_0x6f64a7){return db['MemberReport']['describe']()['then'](respondWithResult(_0x6f64a7,null))[_0x99ec('0x3d')](handleError(_0x6f64a7,null));}; \ No newline at end of file +var _0xc1df=['rawAttributes','fieldName','type','key','query','intersection','model','attributes','fields','length','hasOwnProperty','order','sort','where','filters','pick','filter','VIRTUAL','merge','options','includeAll','include','catch','show','params','keys','create','body','find','describe','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','jsforce','desk.js','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','status','end','json','count','offset','limit','set','apply','reject','save','update','then','destroy','error','stack','name','send','index','map','MemberReport'];(function(_0x4013a5,_0x29cf3c){var _0x55cc2e=function(_0x48413c){while(--_0x48413c){_0x4013a5['push'](_0x4013a5['shift']());}};_0x55cc2e(++_0x29cf3c);}(_0xc1df,0xfc));var _0xfc1d=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xc1df[_0x3dd15e];return _0x231fd0;};'use strict';var pdf=require(_0xfc1d('0x0'));var emlformat=require(_0xfc1d('0x1'));var rimraf=require(_0xfc1d('0x2'));var zipdir=require(_0xfc1d('0x3'));var jsonpatch=require(_0xfc1d('0x4'));var rp=require(_0xfc1d('0x5'));var moment=require('moment');var BPromise=require(_0xfc1d('0x6'));var Mustache=require(_0xfc1d('0x7'));var util=require(_0xfc1d('0x8'));var path=require(_0xfc1d('0x9'));var sox=require(_0xfc1d('0xa'));var csv=require(_0xfc1d('0xb'));var ejs=require(_0xfc1d('0xc'));var fs=require('fs');var _=require(_0xfc1d('0xd'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0xfc1d('0xe'));var deskjs=require(_0xfc1d('0xf'));var toCsv=require(_0xfc1d('0xb'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0xfc1d('0x10'));var qs=require('../../components/parsers/qs');var as=require(_0xfc1d('0x11'));var hardwareService=require(_0xfc1d('0x12'));var logger=require(_0xfc1d('0x13'))(_0xfc1d('0x14'));var utils=require(_0xfc1d('0x15'));var config=require(_0xfc1d('0x16'));var db=require(_0xfc1d('0x17'))['db'];function respondWithStatusCode(_0x367c8e,_0x747e4e){_0x747e4e=_0x747e4e||0xcc;return function(_0x44bdcc){if(_0x44bdcc){return _0x367c8e['sendStatus'](_0x747e4e);}return _0x367c8e[_0xfc1d('0x18')](_0x747e4e)[_0xfc1d('0x19')]();};}function respondWithResult(_0xb04559,_0x13e987){_0x13e987=_0x13e987||0xc8;return function(_0x49f283){if(_0x49f283){return _0xb04559['status'](_0x13e987)[_0xfc1d('0x1a')](_0x49f283);}};}function respondWithFilteredResult(_0x145c3a,_0x2cf552){return function(_0x464ae5){if(_0x464ae5){var _0x5f000b=_0x464ae5[_0xfc1d('0x1b')],_0x174f62=_0x2cf552[_0xfc1d('0x1c')],_0x26830e=_0x2cf552[_0xfc1d('0x1c')]+_0x2cf552[_0xfc1d('0x1d')],_0x1ccd57;if(_0x26830e>=_0x5f000b){_0x26830e=_0x5f000b;_0x1ccd57=0xc8;}else{_0x1ccd57=0xce;}_0x145c3a[_0xfc1d('0x18')](_0x1ccd57);return _0x145c3a[_0xfc1d('0x1e')]('Content-Range',_0x174f62+'-'+_0x26830e+'/'+_0x5f000b)[_0xfc1d('0x1a')](_0x464ae5);}return null;};}function patchUpdates(_0x567130){return function(_0x358f43){try{jsonpatch[_0xfc1d('0x1f')](_0x358f43,_0x567130,!![]);}catch(_0x53fd83){return BPromise[_0xfc1d('0x20')](_0x53fd83);}return _0x358f43[_0xfc1d('0x21')]();};}function saveUpdates(_0x392c4b,_0x301b22){return function(_0x150b10){if(_0x150b10){return _0x150b10[_0xfc1d('0x22')](_0x392c4b)[_0xfc1d('0x23')](function(_0x460685){return _0x460685;});}return null;};}function removeEntity(_0x2ee714,_0x1e0268){return function(_0x12bddb){if(_0x12bddb){return _0x12bddb[_0xfc1d('0x24')]()[_0xfc1d('0x23')](function(){_0x2ee714['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x420c15,_0x3890b9){return function(_0x2addf8){if(!_0x2addf8){_0x420c15['sendStatus'](0x194);}return _0x2addf8;};}function handleError(_0x282fe2,_0x3ffdec){_0x3ffdec=_0x3ffdec||0x1f4;return function(_0xc5d350){logger[_0xfc1d('0x25')](_0xc5d350[_0xfc1d('0x26')]);if(_0xc5d350[_0xfc1d('0x27')]){delete _0xc5d350[_0xfc1d('0x27')];}_0x282fe2[_0xfc1d('0x18')](_0x3ffdec)[_0xfc1d('0x28')](_0xc5d350);};}exports[_0xfc1d('0x29')]=function(_0x58aca4,_0x3fc474){var _0x35f772={},_0xd1332a={},_0x54e04f={'count':0x0,'rows':[]};var _0x35c363=_[_0xfc1d('0x2a')](db[_0xfc1d('0x2b')][_0xfc1d('0x2c')],function(_0x35f792){return{'name':_0x35f792[_0xfc1d('0x2d')],'type':_0x35f792[_0xfc1d('0x2e')][_0xfc1d('0x2f')]};});_0xd1332a['model']=_[_0xfc1d('0x2a')](_0x35c363,'name');_0xd1332a[_0xfc1d('0x30')]=_['keys'](_0x58aca4[_0xfc1d('0x30')]);_0xd1332a['filters']=_[_0xfc1d('0x31')](_0xd1332a[_0xfc1d('0x32')],_0xd1332a[_0xfc1d('0x30')]);_0x35f772[_0xfc1d('0x33')]=_[_0xfc1d('0x31')](_0xd1332a[_0xfc1d('0x32')],qs[_0xfc1d('0x34')](_0x58aca4[_0xfc1d('0x30')][_0xfc1d('0x34')]));_0x35f772[_0xfc1d('0x33')]=_0x35f772[_0xfc1d('0x33')][_0xfc1d('0x35')]?_0x35f772['attributes']:_0xd1332a[_0xfc1d('0x32')];if(!_0x58aca4[_0xfc1d('0x30')][_0xfc1d('0x36')]('nolimit')){_0x35f772[_0xfc1d('0x1d')]=qs['limit'](_0x58aca4[_0xfc1d('0x30')][_0xfc1d('0x1d')]);_0x35f772[_0xfc1d('0x1c')]=qs[_0xfc1d('0x1c')](_0x58aca4['query'][_0xfc1d('0x1c')]);}_0x35f772[_0xfc1d('0x37')]=qs[_0xfc1d('0x38')](_0x58aca4[_0xfc1d('0x30')][_0xfc1d('0x38')]);_0x35f772[_0xfc1d('0x39')]=qs[_0xfc1d('0x3a')](_[_0xfc1d('0x3b')](_0x58aca4[_0xfc1d('0x30')],_0xd1332a['filters']));if(_0x58aca4[_0xfc1d('0x30')][_0xfc1d('0x3c')]){_0x35f772[_0xfc1d('0x39')]=_['merge'](_0x35f772[_0xfc1d('0x39')],{'$or':_['map'](_0x35c363,function(_0x282662){if(_0x282662['type']!==_0xfc1d('0x3d')){var _0x4196d3={};_0x4196d3[_0x282662[_0xfc1d('0x27')]]={'$like':'%'+_0x58aca4[_0xfc1d('0x30')][_0xfc1d('0x3c')]+'%'};return _0x4196d3;}})});}_0x35f772=_[_0xfc1d('0x3e')]({},_0x35f772,_0x58aca4[_0xfc1d('0x3f')]);var _0xc06162={'where':_0x35f772[_0xfc1d('0x39')]};return db[_0xfc1d('0x2b')][_0xfc1d('0x1b')](_0xc06162)[_0xfc1d('0x23')](function(_0x32af26){_0x54e04f[_0xfc1d('0x1b')]=_0x32af26;if(_0x58aca4[_0xfc1d('0x30')][_0xfc1d('0x40')]){_0x35f772[_0xfc1d('0x41')]=[{'all':!![]}];}return db[_0xfc1d('0x2b')]['findAll'](_0x35f772);})[_0xfc1d('0x23')](function(_0x2866fb){_0x54e04f['rows']=_0x2866fb;return _0x54e04f;})[_0xfc1d('0x23')](respondWithFilteredResult(_0x3fc474,_0x35f772))[_0xfc1d('0x42')](handleError(_0x3fc474,null));};exports[_0xfc1d('0x43')]=function(_0x3fd758,_0x3461e7){var _0x35aea3={'raw':!![],'where':{'id':_0x3fd758[_0xfc1d('0x44')]['id']}},_0x5e4eec={};_0x5e4eec[_0xfc1d('0x32')]=_[_0xfc1d('0x45')](db[_0xfc1d('0x2b')][_0xfc1d('0x2c')]);_0x5e4eec['query']=_[_0xfc1d('0x45')](_0x3fd758[_0xfc1d('0x30')]);_0x5e4eec[_0xfc1d('0x3a')]=_[_0xfc1d('0x31')](_0x5e4eec[_0xfc1d('0x32')],_0x5e4eec['query']);_0x35aea3[_0xfc1d('0x33')]=_[_0xfc1d('0x31')](_0x5e4eec[_0xfc1d('0x32')],qs[_0xfc1d('0x34')](_0x3fd758[_0xfc1d('0x30')][_0xfc1d('0x34')]));_0x35aea3[_0xfc1d('0x33')]=_0x35aea3['attributes'][_0xfc1d('0x35')]?_0x35aea3[_0xfc1d('0x33')]:_0x5e4eec[_0xfc1d('0x32')];if(_0x3fd758[_0xfc1d('0x30')][_0xfc1d('0x40')]){_0x35aea3['include']=[{'all':!![]}];}_0x35aea3=_[_0xfc1d('0x3e')]({},_0x35aea3,_0x3fd758[_0xfc1d('0x3f')]);return db[_0xfc1d('0x2b')]['find'](_0x35aea3)[_0xfc1d('0x23')](handleEntityNotFound(_0x3461e7,null))['then'](respondWithResult(_0x3461e7,null))[_0xfc1d('0x42')](handleError(_0x3461e7,null));};exports[_0xfc1d('0x46')]=function(_0x3b36fe,_0x496f91){return db[_0xfc1d('0x2b')][_0xfc1d('0x46')](_0x3b36fe[_0xfc1d('0x47')],{})[_0xfc1d('0x23')](respondWithResult(_0x496f91,0xc9))[_0xfc1d('0x42')](handleError(_0x496f91,null));};exports['update']=function(_0x28cd7a,_0xa7010d){if(_0x28cd7a['body']['id']){delete _0x28cd7a[_0xfc1d('0x47')]['id'];}return db[_0xfc1d('0x2b')][_0xfc1d('0x48')]({'where':{'id':_0x28cd7a[_0xfc1d('0x44')]['id']}})[_0xfc1d('0x23')](handleEntityNotFound(_0xa7010d,null))['then'](saveUpdates(_0x28cd7a['body'],null))['then'](respondWithResult(_0xa7010d,null))[_0xfc1d('0x42')](handleError(_0xa7010d,null));};exports[_0xfc1d('0x24')]=function(_0x91ff21,_0x5118f6){return db[_0xfc1d('0x2b')][_0xfc1d('0x48')]({'where':{'id':_0x91ff21[_0xfc1d('0x44')]['id']}})[_0xfc1d('0x23')](handleEntityNotFound(_0x5118f6,null))[_0xfc1d('0x23')](removeEntity(_0x5118f6,null))[_0xfc1d('0x42')](handleError(_0x5118f6,null));};exports['describe']=function(_0x57ab14,_0x12384c){return db[_0xfc1d('0x2b')][_0xfc1d('0x49')]()[_0xfc1d('0x23')](respondWithResult(_0x12384c,null))[_0xfc1d('0x42')](handleError(_0x12384c,null));}; \ No newline at end of file diff --git a/server/api/memberReport/memberReport.model.js b/server/api/memberReport/memberReport.model.js index c57769f..c322743 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 _0x0d14=['membername','interface','lodash','util','../../config/logger','api','bluebird','../../config/environment','./memberReport.attributes','exports','define','MemberReport','report_member','membername_interface'];(function(_0x2b6f26,_0x468031){var _0x49f85c=function(_0x58b6ec){while(--_0x58b6ec){_0x2b6f26['push'](_0x2b6f26['shift']());}};_0x49f85c(++_0x468031);}(_0x0d14,0xfe));var _0x40d1=function(_0x640312,_0x358137){_0x640312=_0x640312-0x0;var _0x44c90b=_0x0d14[_0x640312];return _0x44c90b;};'use strict';var _=require(_0x40d1('0x0'));var util=require(_0x40d1('0x1'));var logger=require(_0x40d1('0x2'))(_0x40d1('0x3'));var moment=require('moment');var BPromise=require(_0x40d1('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x40d1('0x5'));var attributes=require(_0x40d1('0x6'));module[_0x40d1('0x7')]=function(_0x1227d9,_0x123666){return _0x1227d9[_0x40d1('0x8')](_0x40d1('0x9'),attributes,{'tableName':_0x40d1('0xa'),'paranoid':![],'indexes':[{'name':_0x40d1('0xb'),'fields':[_0x40d1('0xc'),_0x40d1('0xd')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x2be3=['MemberReport','report_member','membername_interface','membername','interface','util','../../config/logger','api','moment','request-promise','path','rimraf','../../config/environment','exports','define'];(function(_0x6b560,_0x1892c0){var _0x5b3781=function(_0x59a9c2){while(--_0x59a9c2){_0x6b560['push'](_0x6b560['shift']());}};_0x5b3781(++_0x1892c0);}(_0x2be3,0x104));var _0x32be=function(_0x433a86,_0x175b5c){_0x433a86=_0x433a86-0x0;var _0x23000c=_0x2be3[_0x433a86];return _0x23000c;};'use strict';var _=require('lodash');var util=require(_0x32be('0x0'));var logger=require(_0x32be('0x1'))(_0x32be('0x2'));var moment=require(_0x32be('0x3'));var BPromise=require('bluebird');var rp=require(_0x32be('0x4'));var fs=require('fs');var path=require(_0x32be('0x5'));var rimraf=require(_0x32be('0x6'));var config=require(_0x32be('0x7'));var attributes=require('./memberReport.attributes');module[_0x32be('0x8')]=function(_0x19bdb9,_0x1b4175){return _0x19bdb9[_0x32be('0x9')](_0x32be('0xa'),attributes,{'tableName':_0x32be('0xb'),'paranoid':![],'indexes':[{'name':_0x32be('0xc'),'fields':[_0x32be('0xd'),_0x32be('0xe')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/memberReport/memberReport.rpc.js b/server/api/memberReport/memberReport.rpc.js index e4d11e8..225273a 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 _0x1f14=['util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','then','info','MemberReport,\x20%s,\x20%s','request\x20sent','MemberReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','MemberReport','findAll','options','raw','attributes','limit','include','map','model','GetMemberReport','CreateMemberReport','debug','UpdateMemberReport','update','lodash'];(function(_0x12fc8d,_0x19ee33){var _0x3f9d04=function(_0x52e51c){while(--_0x52e51c){_0x12fc8d['push'](_0x12fc8d['shift']());}};_0x3f9d04(++_0x19ee33);}(_0x1f14,0x17b));var _0x41f1=function(_0x1515fc,_0x2f2360){_0x1515fc=_0x1515fc-0x0;var _0x297aee=_0x1f14[_0x1515fc];return _0x297aee;};'use strict';var _=require(_0x41f1('0x0'));var util=require(_0x41f1('0x1'));var moment=require(_0x41f1('0x2'));var BPromise=require(_0x41f1('0x3'));var rs=require(_0x41f1('0x4'));var fs=require('fs');var Redis=require(_0x41f1('0x5'));var db=require(_0x41f1('0x6'))['db'];var utils=require(_0x41f1('0x7'));var logger=require(_0x41f1('0x8'))('rpc');var config=require(_0x41f1('0x9'));var jayson=require(_0x41f1('0xa'));var client=jayson[_0x41f1('0xb')][_0x41f1('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x2dfdb3,_0x23b3c6,_0x92597f){return new BPromise(function(_0x237a87,_0x18f6da){return client['request'](_0x2dfdb3,_0x92597f)[_0x41f1('0xd')](function(_0x31cc34){logger[_0x41f1('0xe')](_0x41f1('0xf'),_0x23b3c6,_0x41f1('0x10'));logger['debug'](_0x41f1('0x11'),_0x23b3c6,_0x41f1('0x10'),JSON[_0x41f1('0x12')](_0x31cc34));if(_0x31cc34[_0x41f1('0x13')]){if(_0x31cc34[_0x41f1('0x13')][_0x41f1('0x14')]===0x1f4){logger[_0x41f1('0x13')](_0x41f1('0xf'),_0x23b3c6,_0x31cc34[_0x41f1('0x13')][_0x41f1('0x15')]);return _0x18f6da(_0x31cc34['error'][_0x41f1('0x15')]);}logger[_0x41f1('0x13')](_0x41f1('0xf'),_0x23b3c6,_0x31cc34[_0x41f1('0x13')][_0x41f1('0x15')]);return _0x237a87(_0x31cc34[_0x41f1('0x13')][_0x41f1('0x15')]);}else{logger[_0x41f1('0xe')]('MemberReport,\x20%s,\x20%s',_0x23b3c6,_0x41f1('0x10'));_0x237a87(_0x31cc34[_0x41f1('0x16')][_0x41f1('0x15')]);}})[_0x41f1('0x17')](function(_0x496680){logger[_0x41f1('0x13')](_0x41f1('0xf'),_0x23b3c6,_0x496680);_0x18f6da(_0x496680);});});}exports['GetMemberReport']=function(_0x513e96){var _0x177840=this;return new Promise(function(_0x22f2c4,_0x5347fa){return db[_0x41f1('0x18')][_0x41f1('0x19')]({'raw':_0x513e96[_0x41f1('0x1a')]?_0x513e96[_0x41f1('0x1a')][_0x41f1('0x1b')]===undefined?!![]:![]:!![],'where':_0x513e96[_0x41f1('0x1a')]?_0x513e96[_0x41f1('0x1a')]['where']||null:null,'attributes':_0x513e96['options']?_0x513e96[_0x41f1('0x1a')][_0x41f1('0x1c')]||null:null,'limit':_0x513e96['options']?_0x513e96[_0x41f1('0x1a')][_0x41f1('0x1d')]||null:null,'include':_0x513e96[_0x41f1('0x1a')]?_0x513e96[_0x41f1('0x1a')][_0x41f1('0x1e')]?_[_0x41f1('0x1f')](_0x513e96['options']['include'],function(_0x44cbf4){return{'model':db[_0x44cbf4[_0x41f1('0x20')]],'as':_0x44cbf4['as'],'attributes':_0x44cbf4[_0x41f1('0x1c')],'include':_0x44cbf4['include']?_[_0x41f1('0x1f')](_0x44cbf4[_0x41f1('0x1e')],function(_0x162e95){return{'model':db[_0x162e95[_0x41f1('0x20')]],'as':_0x162e95['as'],'attributes':_0x162e95[_0x41f1('0x1c')],'include':_0x162e95[_0x41f1('0x1e')]?_[_0x41f1('0x1f')](_0x162e95[_0x41f1('0x1e')],function(_0x42253e){return{'model':db[_0x42253e['model']],'as':_0x42253e['as'],'attributes':_0x42253e[_0x41f1('0x1c')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x3522cd){logger[_0x41f1('0xe')]('GetMemberReport',_0x513e96);logger['debug'](_0x41f1('0x21'),_0x513e96,JSON['stringify'](_0x3522cd));_0x22f2c4(_0x3522cd);})[_0x41f1('0x17')](function(_0x5e1d11){logger[_0x41f1('0x13')](_0x41f1('0x21'),_0x5e1d11['message'],_0x513e96);_0x5347fa(_0x177840[_0x41f1('0x13')](0x1f4,_0x5e1d11[_0x41f1('0x15')]));});});};exports[_0x41f1('0x22')]=function(_0x4cc3f4){var _0x3265cb=this;return new Promise(function(_0x237368,_0x4923d0){return db[_0x41f1('0x18')]['create'](_0x4cc3f4['body'],{'raw':_0x4cc3f4['options']?_0x4cc3f4[_0x41f1('0x1a')]['raw']===undefined?!![]:![]:!![]})['then'](function(_0x55ffe3){logger[_0x41f1('0xe')]('CreateMemberReport',_0x4cc3f4);logger[_0x41f1('0x23')](_0x41f1('0x22'),_0x4cc3f4,JSON[_0x41f1('0x12')](_0x55ffe3));_0x237368(_0x55ffe3);})['catch'](function(_0x2df454){logger[_0x41f1('0x13')](_0x41f1('0x22'),_0x2df454['message'],_0x4cc3f4);_0x4923d0(_0x3265cb[_0x41f1('0x13')](0x1f4,_0x2df454[_0x41f1('0x15')]));});});};exports[_0x41f1('0x24')]=function(_0x2716ca){var _0x5a15aa=this;return new Promise(function(_0x1e99b5,_0x19c854){return db[_0x41f1('0x18')][_0x41f1('0x25')](_0x2716ca['body'],{'raw':_0x2716ca[_0x41f1('0x1a')]?_0x2716ca[_0x41f1('0x1a')][_0x41f1('0x1b')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x2716ca[_0x41f1('0x1a')]?_0x2716ca[_0x41f1('0x1a')]['where']||null:null,'attributes':_0x2716ca[_0x41f1('0x1a')]?_0x2716ca['options'][_0x41f1('0x1c')]||null:null,'limit':_0x2716ca[_0x41f1('0x1a')]?_0x2716ca[_0x41f1('0x1a')]['limit']||null:null})[_0x41f1('0xd')](function(_0x5951c5){logger['info']('UpdateMemberReport',_0x2716ca);logger[_0x41f1('0x23')](_0x41f1('0x24'),_0x2716ca,JSON['stringify'](_0x5951c5));_0x1e99b5(_0x5951c5);})[_0x41f1('0x17')](function(_0x23fc26){logger[_0x41f1('0x13')](_0x41f1('0x24'),_0x23fc26['message'],_0x2716ca);_0x19c854(_0x5a15aa['error'](0x1f4,_0x23fc26[_0x41f1('0x15')]));});});}; \ No newline at end of file +var _0x052f=['catch','GetMemberReport','MemberReport','findAll','options','where','attributes','limit','include','map','model','CreateMemberReport','create','body','raw','UpdateMemberReport','update','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','client','http','then','info','MemberReport,\x20%s,\x20%s','debug','MemberReport,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result'];(function(_0x5b644e,_0x2e5e07){var _0x49c6bf=function(_0x3032d9){while(--_0x3032d9){_0x5b644e['push'](_0x5b644e['shift']());}};_0x49c6bf(++_0x2e5e07);}(_0x052f,0xfb));var _0xf052=function(_0x56df6b,_0xfc1860){_0x56df6b=_0x56df6b-0x0;var _0x54059c=_0x052f[_0x56df6b];return _0x54059c;};'use strict';var _=require(_0xf052('0x0'));var util=require('util');var moment=require(_0xf052('0x1'));var BPromise=require(_0xf052('0x2'));var rs=require(_0xf052('0x3'));var fs=require('fs');var Redis=require(_0xf052('0x4'));var db=require(_0xf052('0x5'))['db'];var utils=require(_0xf052('0x6'));var logger=require(_0xf052('0x7'))(_0xf052('0x8'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0xf052('0x9')][_0xf052('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x1d7367,_0x50fbbb,_0x35e75e){return new BPromise(function(_0x1e57c4,_0x4c7b33){return client['request'](_0x1d7367,_0x35e75e)[_0xf052('0xb')](function(_0x158fbe){logger[_0xf052('0xc')](_0xf052('0xd'),_0x50fbbb,'request\x20sent');logger[_0xf052('0xe')](_0xf052('0xf'),_0x50fbbb,_0xf052('0x10'),JSON[_0xf052('0x11')](_0x158fbe));if(_0x158fbe[_0xf052('0x12')]){if(_0x158fbe[_0xf052('0x12')][_0xf052('0x13')]===0x1f4){logger['error'](_0xf052('0xd'),_0x50fbbb,_0x158fbe[_0xf052('0x12')][_0xf052('0x14')]);return _0x4c7b33(_0x158fbe[_0xf052('0x12')][_0xf052('0x14')]);}logger[_0xf052('0x12')](_0xf052('0xd'),_0x50fbbb,_0x158fbe[_0xf052('0x12')][_0xf052('0x14')]);return _0x1e57c4(_0x158fbe['error'][_0xf052('0x14')]);}else{logger[_0xf052('0xc')](_0xf052('0xd'),_0x50fbbb,_0xf052('0x10'));_0x1e57c4(_0x158fbe[_0xf052('0x15')][_0xf052('0x14')]);}})[_0xf052('0x16')](function(_0x5efba9){logger[_0xf052('0x12')](_0xf052('0xd'),_0x50fbbb,_0x5efba9);_0x4c7b33(_0x5efba9);});});}exports[_0xf052('0x17')]=function(_0x9ac300){var _0xd9470a=this;return new Promise(function(_0x5f1420,_0x328b65){return db[_0xf052('0x18')][_0xf052('0x19')]({'raw':_0x9ac300['options']?_0x9ac300[_0xf052('0x1a')]['raw']===undefined?!![]:![]:!![],'where':_0x9ac300['options']?_0x9ac300[_0xf052('0x1a')][_0xf052('0x1b')]||null:null,'attributes':_0x9ac300[_0xf052('0x1a')]?_0x9ac300[_0xf052('0x1a')][_0xf052('0x1c')]||null:null,'limit':_0x9ac300[_0xf052('0x1a')]?_0x9ac300['options'][_0xf052('0x1d')]||null:null,'include':_0x9ac300[_0xf052('0x1a')]?_0x9ac300[_0xf052('0x1a')][_0xf052('0x1e')]?_[_0xf052('0x1f')](_0x9ac300[_0xf052('0x1a')]['include'],function(_0x1173c4){return{'model':db[_0x1173c4['model']],'as':_0x1173c4['as'],'attributes':_0x1173c4[_0xf052('0x1c')],'include':_0x1173c4['include']?_['map'](_0x1173c4[_0xf052('0x1e')],function(_0x260fd8){return{'model':db[_0x260fd8[_0xf052('0x20')]],'as':_0x260fd8['as'],'attributes':_0x260fd8[_0xf052('0x1c')],'include':_0x260fd8[_0xf052('0x1e')]?_['map'](_0x260fd8[_0xf052('0x1e')],function(_0x57c86c){return{'model':db[_0x57c86c['model']],'as':_0x57c86c['as'],'attributes':_0x57c86c[_0xf052('0x1c')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x36e620){logger[_0xf052('0xc')]('GetMemberReport',_0x9ac300);logger['debug'](_0xf052('0x17'),_0x9ac300,JSON[_0xf052('0x11')](_0x36e620));_0x5f1420(_0x36e620);})['catch'](function(_0x4c7e77){logger[_0xf052('0x12')](_0xf052('0x17'),_0x4c7e77[_0xf052('0x14')],_0x9ac300);_0x328b65(_0xd9470a[_0xf052('0x12')](0x1f4,_0x4c7e77[_0xf052('0x14')]));});});};exports[_0xf052('0x21')]=function(_0xf21519){var _0x4d4958=this;return new Promise(function(_0x21fde2,_0x5a0772){return db['MemberReport'][_0xf052('0x22')](_0xf21519[_0xf052('0x23')],{'raw':_0xf21519['options']?_0xf21519[_0xf052('0x1a')][_0xf052('0x24')]===undefined?!![]:![]:!![]})[_0xf052('0xb')](function(_0x2f5254){logger[_0xf052('0xc')]('CreateMemberReport',_0xf21519);logger[_0xf052('0xe')](_0xf052('0x21'),_0xf21519,JSON[_0xf052('0x11')](_0x2f5254));_0x21fde2(_0x2f5254);})[_0xf052('0x16')](function(_0x32667c){logger[_0xf052('0x12')](_0xf052('0x21'),_0x32667c[_0xf052('0x14')],_0xf21519);_0x5a0772(_0x4d4958[_0xf052('0x12')](0x1f4,_0x32667c[_0xf052('0x14')]));});});};exports[_0xf052('0x25')]=function(_0x30033a){var _0x48bf63=this;return new Promise(function(_0x2a401a,_0x306588){return db[_0xf052('0x18')][_0xf052('0x26')](_0x30033a[_0xf052('0x23')],{'raw':_0x30033a[_0xf052('0x1a')]?_0x30033a['options'][_0xf052('0x24')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x30033a[_0xf052('0x1a')]?_0x30033a[_0xf052('0x1a')][_0xf052('0x1b')]||null:null,'attributes':_0x30033a[_0xf052('0x1a')]?_0x30033a[_0xf052('0x1a')][_0xf052('0x1c')]||null:null,'limit':_0x30033a[_0xf052('0x1a')]?_0x30033a[_0xf052('0x1a')][_0xf052('0x1d')]||null:null})[_0xf052('0xb')](function(_0x5cf7c5){logger['info']('UpdateMemberReport',_0x30033a);logger[_0xf052('0xe')](_0xf052('0x25'),_0x30033a,JSON['stringify'](_0x5cf7c5));_0x2a401a(_0x5cf7c5);})[_0xf052('0x16')](function(_0x233a74){logger[_0xf052('0x12')](_0xf052('0x25'),_0x233a74[_0xf052('0x14')],_0x30033a);_0x306588(_0x48bf63[_0xf052('0x12')](0x1f4,_0x233a74[_0xf052('0x14')]));});});}; \ No newline at end of file diff --git a/server/api/migration/index.js b/server/api/migration/index.js index 10eff18..f3920c3 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 _0x2f68=['exports','util','path','connect-timeout','express','../../components/auth/service','../../config/environment','./migration.controller','index'];(function(_0x554a97,_0x27b2b8){var _0x40f30b=function(_0x3024d8){while(--_0x3024d8){_0x554a97['push'](_0x554a97['shift']());}};_0x40f30b(++_0x27b2b8);}(_0x2f68,0x9a));var _0x82f6=function(_0x8d2388,_0x33540a){_0x8d2388=_0x8d2388-0x0;var _0x258dc1=_0x2f68[_0x8d2388];return _0x258dc1;};'use strict';var multer=require('multer');var util=require(_0x82f6('0x0'));var path=require(_0x82f6('0x1'));var timeout=require(_0x82f6('0x2'));var express=require(_0x82f6('0x3'));var router=express['Router']();var auth=require(_0x82f6('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0x82f6('0x5'));var controller=require(_0x82f6('0x6'));router['get']('/',controller[_0x82f6('0x7')]);module[_0x82f6('0x8')]=router; \ No newline at end of file +var _0x4cf8=['index','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./migration.controller','get'];(function(_0x4d1d24,_0x37a9e0){var _0x315c2e=function(_0x45668c){while(--_0x45668c){_0x4d1d24['push'](_0x4d1d24['shift']());}};_0x315c2e(++_0x37a9e0);}(_0x4cf8,0x1e1));var _0x84cf=function(_0x512661,_0x4b4012){_0x512661=_0x512661-0x0;var _0x1debde=_0x4cf8[_0x512661];return _0x1debde;};'use strict';var multer=require(_0x84cf('0x0'));var util=require(_0x84cf('0x1'));var path=require(_0x84cf('0x2'));var timeout=require(_0x84cf('0x3'));var express=require(_0x84cf('0x4'));var router=express[_0x84cf('0x5')]();var auth=require(_0x84cf('0x6'));var interaction=require(_0x84cf('0x7'));var config=require(_0x84cf('0x8'));var controller=require(_0x84cf('0x9'));router[_0x84cf('0xa')]('/',controller[_0x84cf('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 d69de2d..f10fe39 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 _0xa664=['version','exports'];(function(_0x54da6c,_0x5acb45){var _0x1abc86=function(_0x3b08ff){while(--_0x3b08ff){_0x54da6c['push'](_0x54da6c['shift']());}};_0x1abc86(++_0x5acb45);}(_0xa664,0x6b));var _0x4a66=function(_0x375fde,_0x4952aa){_0x375fde=_0x375fde-0x0;var _0x307015=_0xa664[_0x375fde];return _0x307015;};'use strict';var Sequelize=require('sequelize');module[_0x4a66('0x0')]={'version':{'type':Sequelize['STRING'],'unique':_0x4a66('0x1')}}; \ No newline at end of file +var _0x7be8=['version','sequelize','exports'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x7be8,0xb2));var _0x87be=function(_0x1a5210,_0x29ddc8){_0x1a5210=_0x1a5210-0x0;var _0xcef2a9=_0x7be8[_0x1a5210];return _0xcef2a9;};'use strict';var Sequelize=require(_0x87be('0x0'));module[_0x87be('0x1')]={'version':{'type':Sequelize['STRING'],'unique':_0x87be('0x2')}}; \ No newline at end of file diff --git a/server/api/migration/migration.controller.js b/server/api/migration/migration.controller.js index 38a7131..2c4b125 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(_0x9aec8e,_0x5aba85){var _0x5e1ad9=function(_0x329d4b){while(--_0x329d4b){_0x9aec8e['push'](_0x9aec8e['shift']());}};_0x5e1ad9(++_0x5aba85);}(_0xb10b,0x12a));var _0xbb10=function(_0x3dc089,_0x5ccb0d){_0x3dc089=_0x3dc089-0x0;var _0x34d9d3=_0xb10b[_0x3dc089];return _0x34d9d3;};'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 _0x5f2f=['desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','api','../../config/utils','../../mysqldb','sendStatus','status','json','count','offset','limit','set','Content-Range','apply','reject','save','update','destroy','end','error','stack','name','send','index','map','fieldName','type','query','keys','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','filter','merge','VIRTUAL','Migration','then','include','rows','catch','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','path','sox','to-csv','ejs','lodash','squel','jsforce'];(function(_0x10b640,_0x3e6a3f){var _0x20fff7=function(_0x462caa){while(--_0x462caa){_0x10b640['push'](_0x10b640['shift']());}};_0x20fff7(++_0x3e6a3f);}(_0x5f2f,0x73));var _0xf5f2=function(_0x19d600,_0x2502b8){_0x19d600=_0x19d600-0x0;var _0x3a30a0=_0x5f2f[_0x19d600];return _0x3a30a0;};'use strict';var pdf=require(_0xf5f2('0x0'));var emlformat=require(_0xf5f2('0x1'));var rimraf=require(_0xf5f2('0x2'));var zipdir=require(_0xf5f2('0x3'));var jsonpatch=require(_0xf5f2('0x4'));var rp=require(_0xf5f2('0x5'));var moment=require(_0xf5f2('0x6'));var BPromise=require(_0xf5f2('0x7'));var Mustache=require('mustache');var util=require('util');var path=require(_0xf5f2('0x8'));var sox=require(_0xf5f2('0x9'));var csv=require(_0xf5f2('0xa'));var ejs=require(_0xf5f2('0xb'));var fs=require('fs');var _=require(_0xf5f2('0xc'));var squel=require(_0xf5f2('0xd'));var crypto=require('crypto');var jsforce=require(_0xf5f2('0xe'));var deskjs=require(_0xf5f2('0xf'));var toCsv=require(_0xf5f2('0xa'));var querystring=require('querystring');var Papa=require(_0xf5f2('0x10'));var Redis=require(_0xf5f2('0x11'));var authService=require(_0xf5f2('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0xf5f2('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0xf5f2('0x14'));var utils=require(_0xf5f2('0x15'));var config=require('../../config/environment');var db=require(_0xf5f2('0x16'))['db'];function respondWithStatusCode(_0x14b51f,_0x331482){_0x331482=_0x331482||0xcc;return function(_0x3f2997){if(_0x3f2997){return _0x14b51f[_0xf5f2('0x17')](_0x331482);}return _0x14b51f[_0xf5f2('0x18')](_0x331482)['end']();};}function respondWithResult(_0x5850f4,_0xea612c){_0xea612c=_0xea612c||0xc8;return function(_0x269909){if(_0x269909){return _0x5850f4[_0xf5f2('0x18')](_0xea612c)[_0xf5f2('0x19')](_0x269909);}};}function respondWithFilteredResult(_0x4d97fc,_0xafe430){return function(_0x286197){if(_0x286197){var _0x17d656=_0x286197[_0xf5f2('0x1a')],_0x1b6dd2=_0xafe430[_0xf5f2('0x1b')],_0x23e23a=_0xafe430[_0xf5f2('0x1b')]+_0xafe430[_0xf5f2('0x1c')],_0x3a9dbb;if(_0x23e23a>=_0x17d656){_0x23e23a=_0x17d656;_0x3a9dbb=0xc8;}else{_0x3a9dbb=0xce;}_0x4d97fc[_0xf5f2('0x18')](_0x3a9dbb);return _0x4d97fc[_0xf5f2('0x1d')](_0xf5f2('0x1e'),_0x1b6dd2+'-'+_0x23e23a+'/'+_0x17d656)[_0xf5f2('0x19')](_0x286197);}return null;};}function patchUpdates(_0x3cf5ea){return function(_0x626999){try{jsonpatch[_0xf5f2('0x1f')](_0x626999,_0x3cf5ea,!![]);}catch(_0x56acc5){return BPromise[_0xf5f2('0x20')](_0x56acc5);}return _0x626999[_0xf5f2('0x21')]();};}function saveUpdates(_0x49dac2,_0x47acfc){return function(_0x2d2805){if(_0x2d2805){return _0x2d2805[_0xf5f2('0x22')](_0x49dac2)['then'](function(_0x45b74f){return _0x45b74f;});}return null;};}function removeEntity(_0x170042,_0x39e44a){return function(_0x39c024){if(_0x39c024){return _0x39c024[_0xf5f2('0x23')]()['then'](function(){_0x170042[_0xf5f2('0x18')](0xcc)[_0xf5f2('0x24')]();});}};}function handleEntityNotFound(_0x4e8bda,_0x2833fe){return function(_0x287ad5){if(!_0x287ad5){_0x4e8bda['sendStatus'](0x194);}return _0x287ad5;};}function handleError(_0x529f07,_0x5f1124){_0x5f1124=_0x5f1124||0x1f4;return function(_0x3f79d5){logger[_0xf5f2('0x25')](_0x3f79d5[_0xf5f2('0x26')]);if(_0x3f79d5[_0xf5f2('0x27')]){delete _0x3f79d5[_0xf5f2('0x27')];}_0x529f07[_0xf5f2('0x18')](_0x5f1124)[_0xf5f2('0x28')](_0x3f79d5);};}exports[_0xf5f2('0x29')]=function(_0x4ab014,_0xaa2602){var _0x102449={},_0x375ca8={},_0x31bfcb={'count':0x0,'rows':[]};var _0x198c73=_[_0xf5f2('0x2a')](db['Migration']['rawAttributes'],function(_0x22c826){return{'name':_0x22c826[_0xf5f2('0x2b')],'type':_0x22c826[_0xf5f2('0x2c')]['key']};});_0x375ca8['model']=_[_0xf5f2('0x2a')](_0x198c73,_0xf5f2('0x27'));_0x375ca8[_0xf5f2('0x2d')]=_[_0xf5f2('0x2e')](_0x4ab014[_0xf5f2('0x2d')]);_0x375ca8['filters']=_['intersection'](_0x375ca8[_0xf5f2('0x2f')],_0x375ca8['query']);_0x102449[_0xf5f2('0x30')]=_['intersection'](_0x375ca8[_0xf5f2('0x2f')],qs[_0xf5f2('0x31')](_0x4ab014[_0xf5f2('0x2d')][_0xf5f2('0x31')]));_0x102449[_0xf5f2('0x30')]=_0x102449[_0xf5f2('0x30')][_0xf5f2('0x32')]?_0x102449[_0xf5f2('0x30')]:_0x375ca8['model'];if(!_0x4ab014[_0xf5f2('0x2d')][_0xf5f2('0x33')](_0xf5f2('0x34'))){_0x102449[_0xf5f2('0x1c')]=qs[_0xf5f2('0x1c')](_0x4ab014[_0xf5f2('0x2d')][_0xf5f2('0x1c')]);_0x102449['offset']=qs[_0xf5f2('0x1b')](_0x4ab014[_0xf5f2('0x2d')]['offset']);}_0x102449[_0xf5f2('0x35')]=qs['sort'](_0x4ab014[_0xf5f2('0x2d')][_0xf5f2('0x36')]);_0x102449[_0xf5f2('0x37')]=qs[_0xf5f2('0x38')](_['pick'](_0x4ab014['query'],_0x375ca8[_0xf5f2('0x38')]));if(_0x4ab014[_0xf5f2('0x2d')][_0xf5f2('0x39')]){_0x102449['where']=_[_0xf5f2('0x3a')](_0x102449['where'],{'$or':_[_0xf5f2('0x2a')](_0x198c73,function(_0x566c47){if(_0x566c47[_0xf5f2('0x2c')]!==_0xf5f2('0x3b')){var _0x5337a6={};_0x5337a6[_0x566c47[_0xf5f2('0x27')]]={'$like':'%'+_0x4ab014[_0xf5f2('0x2d')][_0xf5f2('0x39')]+'%'};return _0x5337a6;}})});}_0x102449=_[_0xf5f2('0x3a')]({},_0x102449,_0x4ab014['options']);var _0x5d2d82={'where':_0x102449[_0xf5f2('0x37')]};return db[_0xf5f2('0x3c')][_0xf5f2('0x1a')](_0x5d2d82)[_0xf5f2('0x3d')](function(_0x2c7f65){_0x31bfcb[_0xf5f2('0x1a')]=_0x2c7f65;if(_0x4ab014[_0xf5f2('0x2d')]['includeAll']){_0x102449[_0xf5f2('0x3e')]=[{'all':!![]}];}return db[_0xf5f2('0x3c')]['findAll'](_0x102449);})[_0xf5f2('0x3d')](function(_0x3f3895){_0x31bfcb[_0xf5f2('0x3f')]=_0x3f3895;return _0x31bfcb;})[_0xf5f2('0x3d')](respondWithFilteredResult(_0xaa2602,_0x102449))[_0xf5f2('0x40')](handleError(_0xaa2602,null));}; \ No newline at end of file diff --git a/server/api/migration/migration.model.js b/server/api/migration/migration.model.js index 7fd17d5..b9150b5 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 _0xbc60=['../../config/logger','api','moment','bluebird','request-promise','path','rimraf','./migration.attributes','define','migrations','lodash','util'];(function(_0x594b0e,_0x1601aa){var _0x3279c8=function(_0xc39aa2){while(--_0xc39aa2){_0x594b0e['push'](_0x594b0e['shift']());}};_0x3279c8(++_0x1601aa);}(_0xbc60,0x112));var _0x0bc6=function(_0x2efe92,_0x3c7453){_0x2efe92=_0x2efe92-0x0;var _0x5b66c5=_0xbc60[_0x2efe92];return _0x5b66c5;};'use strict';var _=require(_0x0bc6('0x0'));var util=require(_0x0bc6('0x1'));var logger=require(_0x0bc6('0x2'))(_0x0bc6('0x3'));var moment=require(_0x0bc6('0x4'));var BPromise=require(_0x0bc6('0x5'));var rp=require(_0x0bc6('0x6'));var fs=require('fs');var path=require(_0x0bc6('0x7'));var rimraf=require(_0x0bc6('0x8'));var config=require('../../config/environment');var attributes=require(_0x0bc6('0x9'));module['exports']=function(_0x1be842,_0x42871c){return _0x1be842[_0x0bc6('0xa')]('Migration',attributes,{'tableName':_0x0bc6('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x2e2a=['lodash','../../config/logger','api','moment','request-promise','path','rimraf','./migration.attributes','exports','define','migrations'];(function(_0x2dadb9,_0x42cfe6){var _0x2f0097=function(_0x21163f){while(--_0x21163f){_0x2dadb9['push'](_0x2dadb9['shift']());}};_0x2f0097(++_0x42cfe6);}(_0x2e2a,0x84));var _0xa2e2=function(_0x3332c2,_0x59efee){_0x3332c2=_0x3332c2-0x0;var _0x85588=_0x2e2a[_0x3332c2];return _0x85588;};'use strict';var _=require(_0xa2e2('0x0'));var util=require('util');var logger=require(_0xa2e2('0x1'))(_0xa2e2('0x2'));var moment=require(_0xa2e2('0x3'));var BPromise=require('bluebird');var rp=require(_0xa2e2('0x4'));var fs=require('fs');var path=require(_0xa2e2('0x5'));var rimraf=require(_0xa2e2('0x6'));var config=require('../../config/environment');var attributes=require(_0xa2e2('0x7'));module[_0xa2e2('0x8')]=function(_0x7ad0e8,_0xf0fecc){return _0x7ad0e8[_0xa2e2('0x9')]('Migration',attributes,{'tableName':_0xa2e2('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 2406601..6c0cf58 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 _0xe5bb=['stringify','error','code','message','result','catch','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','http','then','info','Migration,\x20%s,\x20%s','debug','Migration,\x20%s,\x20%s,\x20%s'];(function(_0x9d9cb4,_0x5d1715){var _0x30b675=function(_0x469edb){while(--_0x469edb){_0x9d9cb4['push'](_0x9d9cb4['shift']());}};_0x30b675(++_0x5d1715);}(_0xe5bb,0x166));var _0xbe5b=function(_0x368228,_0x29e80f){_0x368228=_0x368228-0x0;var _0x7cd8a3=_0xe5bb[_0x368228];return _0x7cd8a3;};'use strict';var _=require(_0xbe5b('0x0'));var util=require(_0xbe5b('0x1'));var moment=require('moment');var BPromise=require(_0xbe5b('0x2'));var rs=require(_0xbe5b('0x3'));var fs=require('fs');var Redis=require(_0xbe5b('0x4'));var db=require(_0xbe5b('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0xbe5b('0x6'))(_0xbe5b('0x7'));var config=require(_0xbe5b('0x8'));var jayson=require(_0xbe5b('0x9'));var client=jayson['client'][_0xbe5b('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x3ea278,_0x3986e9,_0xca35ac){return new BPromise(function(_0x7fbfac,_0x2076ce){return client['request'](_0x3ea278,_0xca35ac)[_0xbe5b('0xb')](function(_0x440798){logger[_0xbe5b('0xc')](_0xbe5b('0xd'),_0x3986e9,'request\x20sent');logger[_0xbe5b('0xe')](_0xbe5b('0xf'),_0x3986e9,'request\x20sent',JSON[_0xbe5b('0x10')](_0x440798));if(_0x440798['error']){if(_0x440798[_0xbe5b('0x11')][_0xbe5b('0x12')]===0x1f4){logger[_0xbe5b('0x11')]('Migration,\x20%s,\x20%s',_0x3986e9,_0x440798['error'][_0xbe5b('0x13')]);return _0x2076ce(_0x440798['error'][_0xbe5b('0x13')]);}logger[_0xbe5b('0x11')]('Migration,\x20%s,\x20%s',_0x3986e9,_0x440798[_0xbe5b('0x11')][_0xbe5b('0x13')]);return _0x7fbfac(_0x440798[_0xbe5b('0x11')][_0xbe5b('0x13')]);}else{logger[_0xbe5b('0xc')]('Migration,\x20%s,\x20%s',_0x3986e9,'request\x20sent');_0x7fbfac(_0x440798[_0xbe5b('0x14')][_0xbe5b('0x13')]);}})[_0xbe5b('0x15')](function(_0x5e14da){logger['error'](_0xbe5b('0xd'),_0x3986e9,_0x5e14da);_0x2076ce(_0x5e14da);});});} \ No newline at end of file +var _0x2cf3=['Migration,\x20%s,\x20%s','debug','Migration,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','result','catch','lodash','util','moment','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info'];(function(_0x33d845,_0x2356e6){var _0x3dd101=function(_0x4100c6){while(--_0x4100c6){_0x33d845['push'](_0x33d845['shift']());}};_0x3dd101(++_0x2356e6);}(_0x2cf3,0x111));var _0x32cf=function(_0x124dcf,_0x4f27d7){_0x124dcf=_0x124dcf-0x0;var _0x5a5c53=_0x2cf3[_0x124dcf];return _0x5a5c53;};'use strict';var _=require(_0x32cf('0x0'));var util=require(_0x32cf('0x1'));var moment=require(_0x32cf('0x2'));var BPromise=require('bluebird');var rs=require(_0x32cf('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x32cf('0x4'))['db'];var utils=require(_0x32cf('0x5'));var logger=require(_0x32cf('0x6'))(_0x32cf('0x7'));var config=require(_0x32cf('0x8'));var jayson=require(_0x32cf('0x9'));var client=jayson[_0x32cf('0xa')][_0x32cf('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x498e7d,_0x4ebb9c,_0x1939f6){return new BPromise(function(_0x1a2ef5,_0x25cc58){return client[_0x32cf('0xc')](_0x498e7d,_0x1939f6)[_0x32cf('0xd')](function(_0x3a2410){logger[_0x32cf('0xe')](_0x32cf('0xf'),_0x4ebb9c,'request\x20sent');logger[_0x32cf('0x10')](_0x32cf('0x11'),_0x4ebb9c,_0x32cf('0x12'),JSON['stringify'](_0x3a2410));if(_0x3a2410[_0x32cf('0x13')]){if(_0x3a2410[_0x32cf('0x13')][_0x32cf('0x14')]===0x1f4){logger['error'](_0x32cf('0xf'),_0x4ebb9c,_0x3a2410[_0x32cf('0x13')][_0x32cf('0x15')]);return _0x25cc58(_0x3a2410['error'][_0x32cf('0x15')]);}logger['error']('Migration,\x20%s,\x20%s',_0x4ebb9c,_0x3a2410[_0x32cf('0x13')][_0x32cf('0x15')]);return _0x1a2ef5(_0x3a2410['error'][_0x32cf('0x15')]);}else{logger['info'](_0x32cf('0xf'),_0x4ebb9c,_0x32cf('0x12'));_0x1a2ef5(_0x3a2410[_0x32cf('0x16')]['message']);}})[_0x32cf('0x17')](function(_0x84aa09){logger[_0x32cf('0x13')]('Migration,\x20%s,\x20%s',_0x4ebb9c,_0x84aa09);_0x25cc58(_0x84aa09);});});} \ No newline at end of file diff --git a/server/api/network/index.js b/server/api/network/index.js index 3d70163..76c3d84 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 _0x80d5=['get','isAuthenticated','/:id','show','post','create','put','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./network.controller'];(function(_0x2641f9,_0x26715f){var _0x585741=function(_0x2d1462){while(--_0x2d1462){_0x2641f9['push'](_0x2641f9['shift']());}};_0x585741(++_0x26715f);}(_0x80d5,0x186));var _0x580d=function(_0x185716,_0xa69e63){_0x185716=_0x185716-0x0;var _0x4b38c9=_0x80d5[_0x185716];return _0x4b38c9;};'use strict';var multer=require(_0x580d('0x0'));var util=require(_0x580d('0x1'));var path=require(_0x580d('0x2'));var timeout=require(_0x580d('0x3'));var express=require(_0x580d('0x4'));var router=express[_0x580d('0x5')]();var auth=require(_0x580d('0x6'));var interaction=require(_0x580d('0x7'));var config=require(_0x580d('0x8'));var controller=require(_0x580d('0x9'));router[_0x580d('0xa')]('/',auth[_0x580d('0xb')](),controller['index']);router['get'](_0x580d('0xc'),auth[_0x580d('0xb')](),controller[_0x580d('0xd')]);router[_0x580d('0xe')]('/',auth[_0x580d('0xb')](),controller[_0x580d('0xf')]);router[_0x580d('0x10')](_0x580d('0xc'),auth[_0x580d('0xb')](),controller['update']);router[_0x580d('0x11')](_0x580d('0xc'),auth[_0x580d('0xb')](),controller[_0x580d('0x12')]);module[_0x580d('0x13')]=router; \ No newline at end of file +var _0xe0c9=['index','show','post','create','put','/:id','update','delete','destroy','exports','util','path','connect-timeout','../../components/interaction/service','../../config/environment','isAuthenticated'];(function(_0x502ec7,_0x8e99b3){var _0x362b0f=function(_0x379598){while(--_0x379598){_0x502ec7['push'](_0x502ec7['shift']());}};_0x362b0f(++_0x8e99b3);}(_0xe0c9,0x1ba));var _0x9e0c=function(_0x21137e,_0x1fb518){_0x21137e=_0x21137e-0x0;var _0x2cd060=_0xe0c9[_0x21137e];return _0x2cd060;};'use strict';var multer=require('multer');var util=require(_0x9e0c('0x0'));var path=require(_0x9e0c('0x1'));var timeout=require(_0x9e0c('0x2'));var express=require('express');var router=express['Router']();var auth=require('../../components/auth/service');var interaction=require(_0x9e0c('0x3'));var config=require(_0x9e0c('0x4'));var controller=require('./network.controller');router['get']('/',auth[_0x9e0c('0x5')](),controller[_0x9e0c('0x6')]);router['get']('/:id',auth['isAuthenticated'](),controller[_0x9e0c('0x7')]);router[_0x9e0c('0x8')]('/',auth[_0x9e0c('0x5')](),controller[_0x9e0c('0x9')]);router[_0x9e0c('0xa')](_0x9e0c('0xb'),auth[_0x9e0c('0x5')](),controller[_0x9e0c('0xc')]);router[_0x9e0c('0xd')](_0x9e0c('0xb'),auth[_0x9e0c('0x5')](),controller[_0x9e0c('0xe')]);module[_0x9e0c('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 5e84015..6ac2c68 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(_0x1b1a24,_0x902fcf){var _0x5a8ba6=function(_0x103c06){while(--_0x103c06){_0x1b1a24['push'](_0x1b1a24['shift']());}};_0x5a8ba6(++_0x902fcf);}(_0xa9e0,0x123));var _0x0a9e=function(_0x491a7f,_0x28bb80){_0x491a7f=_0x491a7f-0x0;var _0x3d8f44=_0xa9e0[_0x491a7f];return _0x3d8f44;};'use strict';var Sequelize=require(_0x0a9e('0x0'));module[_0x0a9e('0x1')]={'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(_0x366dc1,_0x1a154c){var _0x551331=function(_0x3fbf7e){while(--_0x3fbf7e){_0x366dc1['push'](_0x366dc1['shift']());}};_0x551331(++_0x1a154c);}(_0xa9e0,0x123));var _0x0a9e=function(_0x8de54f,_0x271987){_0x8de54f=_0x8de54f-0x0;var _0x14cba4=_0xa9e0[_0x8de54f];return _0x14cba4;};'use strict';var Sequelize=require(_0x0a9e('0x0'));module[_0x0a9e('0x1')]={'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 3cc0ebd..14247c1 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 _0x7973=['util','sox','to-csv','ejs','lodash','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../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','info','debug','request\x20sent','error','Network,\x20%s,\x20%s','message','result','catch','sendStatus','status','end','json','count','offset','limit','Content-Range','apply','save','update','destroy','stack','name','send','index','map','Network','rawAttributes','type','key','model','query','intersection','attributes','fields','length','nolimit','order','sort','where','filters','pick','filter','merge','VIRTUAL','options','include','findAll','rows','then','show','params','keys','find','create','sequelize','body','toUpperCase','readFileSync','join','root','server/files/templates/stun_multiple.ejs','render','writeFileSync','/etc/asterisk/stun_xcally.conf','Reload','res_stun_monitor.so','TURN','server/files/templates/turn_multiple.ejs','utf8','/etc/asterisk/turn_xcally.conf','format','/etc/asterisk/sip_xcally_%s.conf','chan_sip.so','transaction','STUN','server/files/templates/network.ejs','toLowerCase','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache'];(function(_0x2a7cec,_0x5d45ef){var _0x2e5726=function(_0x3f7e74){while(--_0x3f7e74){_0x2a7cec['push'](_0x2a7cec['shift']());}};_0x2e5726(++_0x5d45ef);}(_0x7973,0x1b1));var _0x3797=function(_0x5cd598,_0x220e6f){_0x5cd598=_0x5cd598-0x0;var _0x2e2f7c=_0x7973[_0x5cd598];return _0x2e2f7c;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x3797('0x0'));var rimraf=require(_0x3797('0x1'));var zipdir=require(_0x3797('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x3797('0x3'));var moment=require(_0x3797('0x4'));var BPromise=require(_0x3797('0x5'));var Mustache=require(_0x3797('0x6'));var util=require(_0x3797('0x7'));var path=require('path');var sox=require(_0x3797('0x8'));var csv=require(_0x3797('0x9'));var ejs=require(_0x3797('0xa'));var fs=require('fs');var _=require(_0x3797('0xb'));var squel=require(_0x3797('0xc'));var crypto=require(_0x3797('0xd'));var jsforce=require('jsforce');var deskjs=require(_0x3797('0xe'));var toCsv=require(_0x3797('0x9'));var querystring=require(_0x3797('0xf'));var Papa=require(_0x3797('0x10'));var Redis=require(_0x3797('0x11'));var authService=require(_0x3797('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0x3797('0x13'));var hardwareService=require(_0x3797('0x14'));var logger=require(_0x3797('0x15'))(_0x3797('0x16'));var utils=require(_0x3797('0x17'));var config=require(_0x3797('0x18'));var db=require(_0x3797('0x19'))['db'];var jayson=require(_0x3797('0x1a'));var client=jayson[_0x3797('0x1b')][_0x3797('0x1c')]({'port':0x232a});function checkPasswordPattern(_0x491397,_0x4d5a74,_0x54ae2d){if(_0x54ae2d){var _0x252519=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x252519[_0x3797('0x1d')](_0x4d5a74)){return _0x491397;}else{throw new db[(_0x3797('0x1e'))]['ValidationError'](_0x3797('0x1f'));}}else{return _0x491397;}}function respondWithRpcPromise(_0x3329c6,_0x26ede4,_0x4e03ff,_0x49cb8c){return new BPromise(function(_0x59656d,_0x10e9fd){var _0x5491df=_0x49cb8c||client;return _0x5491df[_0x3797('0x20')](_0x3329c6,_0x4e03ff)['then'](function(_0x20fd03){logger[_0x3797('0x21')]('Network,\x20%s,\x20%s',_0x26ede4,'request\x20sent');logger[_0x3797('0x22')]('Network,\x20%s,\x20%s,\x20%s',_0x26ede4,_0x3797('0x23'),JSON['stringify'](_0x20fd03));if(_0x20fd03['error']){if(_0x20fd03[_0x3797('0x24')]['code']===0x1f4){logger[_0x3797('0x24')](_0x3797('0x25'),_0x26ede4,_0x20fd03[_0x3797('0x24')][_0x3797('0x26')]);return _0x10e9fd(_0x20fd03['error'][_0x3797('0x26')]);}logger['error'](_0x3797('0x25'),_0x26ede4,_0x20fd03[_0x3797('0x24')][_0x3797('0x26')]);return _0x59656d(_0x20fd03['error']['message']);}else{logger[_0x3797('0x21')]('Network,\x20%s,\x20%s',_0x26ede4,_0x3797('0x23'));_0x59656d(_0x20fd03[_0x3797('0x27')][_0x3797('0x26')]);}})[_0x3797('0x28')](function(_0xcdaace){logger[_0x3797('0x24')](_0x3797('0x25'),_0x26ede4,_0xcdaace);_0x10e9fd(_0xcdaace);});});}function respondWithStatusCode(_0x44a118,_0x2f7a8d){_0x2f7a8d=_0x2f7a8d||0xcc;return function(_0x4337b6){if(_0x4337b6){return _0x44a118[_0x3797('0x29')](_0x2f7a8d);}return _0x44a118[_0x3797('0x2a')](_0x2f7a8d)[_0x3797('0x2b')]();};}function respondWithResult(_0x4cc027,_0x156688){_0x156688=_0x156688||0xc8;return function(_0x554df1){if(_0x554df1){return _0x4cc027[_0x3797('0x2a')](_0x156688)[_0x3797('0x2c')](_0x554df1);}};}function respondWithFilteredResult(_0x3ca084,_0x491ce2){return function(_0x3ef7b0){if(_0x3ef7b0){var _0x821da6=_0x3ef7b0[_0x3797('0x2d')],_0xb7d749=_0x491ce2['offset'],_0x512ed4=_0x491ce2[_0x3797('0x2e')]+_0x491ce2[_0x3797('0x2f')],_0x4b9adc;if(_0x512ed4>=_0x821da6){_0x512ed4=_0x821da6;_0x4b9adc=0xc8;}else{_0x4b9adc=0xce;}_0x3ca084['status'](_0x4b9adc);return _0x3ca084['set'](_0x3797('0x30'),_0xb7d749+'-'+_0x512ed4+'/'+_0x821da6)['json'](_0x3ef7b0);}return null;};}function patchUpdates(_0x133a1d){return function(_0x4b7e46){try{jsonpatch[_0x3797('0x31')](_0x4b7e46,_0x133a1d,!![]);}catch(_0x5f1fc1){return BPromise['reject'](_0x5f1fc1);}return _0x4b7e46[_0x3797('0x32')]();};}function saveUpdates(_0x36c3a7,_0x3a676a){return function(_0x15fc80){if(_0x15fc80){return _0x15fc80[_0x3797('0x33')](_0x36c3a7)['then'](function(_0x21d44e){return _0x21d44e;});}return null;};}function removeEntity(_0x4e90c2,_0x2bc128){return function(_0x2934c0){if(_0x2934c0){return _0x2934c0[_0x3797('0x34')]()['then'](function(){_0x4e90c2[_0x3797('0x2a')](0xcc)[_0x3797('0x2b')]();});}};}function handleEntityNotFound(_0x58cef3,_0x2e36eb){return function(_0x3b1dad){if(!_0x3b1dad){_0x58cef3['sendStatus'](0x194);}return _0x3b1dad;};}function handleError(_0x117c91,_0x31357f){_0x31357f=_0x31357f||0x1f4;return function(_0xea701e){logger['error'](_0xea701e[_0x3797('0x35')]);if(_0xea701e[_0x3797('0x36')]){delete _0xea701e[_0x3797('0x36')];}_0x117c91[_0x3797('0x2a')](_0x31357f)[_0x3797('0x37')](_0xea701e);};}exports[_0x3797('0x38')]=function(_0x6f651c,_0x5b9fac){var _0x8cfbbd={},_0x35ebbb={},_0x5b5c7d={'count':0x0,'rows':[]};var _0x3d07b9=_[_0x3797('0x39')](db[_0x3797('0x3a')][_0x3797('0x3b')],function(_0x49bc05){return{'name':_0x49bc05['fieldName'],'type':_0x49bc05[_0x3797('0x3c')][_0x3797('0x3d')]};});_0x35ebbb[_0x3797('0x3e')]=_[_0x3797('0x39')](_0x3d07b9,_0x3797('0x36'));_0x35ebbb['query']=_['keys'](_0x6f651c[_0x3797('0x3f')]);_0x35ebbb['filters']=_[_0x3797('0x40')](_0x35ebbb[_0x3797('0x3e')],_0x35ebbb[_0x3797('0x3f')]);_0x8cfbbd[_0x3797('0x41')]=_[_0x3797('0x40')](_0x35ebbb[_0x3797('0x3e')],qs['fields'](_0x6f651c[_0x3797('0x3f')][_0x3797('0x42')]));_0x8cfbbd[_0x3797('0x41')]=_0x8cfbbd['attributes'][_0x3797('0x43')]?_0x8cfbbd[_0x3797('0x41')]:_0x35ebbb[_0x3797('0x3e')];if(!_0x6f651c['query']['hasOwnProperty'](_0x3797('0x44'))){_0x8cfbbd[_0x3797('0x2f')]=qs['limit'](_0x6f651c[_0x3797('0x3f')][_0x3797('0x2f')]);_0x8cfbbd[_0x3797('0x2e')]=qs[_0x3797('0x2e')](_0x6f651c['query'][_0x3797('0x2e')]);}_0x8cfbbd[_0x3797('0x45')]=qs[_0x3797('0x46')](_0x6f651c['query']['sort']);_0x8cfbbd[_0x3797('0x47')]=qs[_0x3797('0x48')](_[_0x3797('0x49')](_0x6f651c[_0x3797('0x3f')],_0x35ebbb[_0x3797('0x48')]));if(_0x6f651c[_0x3797('0x3f')][_0x3797('0x4a')]){_0x8cfbbd[_0x3797('0x47')]=_[_0x3797('0x4b')](_0x8cfbbd[_0x3797('0x47')],{'$or':_['map'](_0x3d07b9,function(_0x775f2e){if(_0x775f2e[_0x3797('0x3c')]!==_0x3797('0x4c')){var _0x2d8d7d={};_0x2d8d7d[_0x775f2e[_0x3797('0x36')]]={'$like':'%'+_0x6f651c[_0x3797('0x3f')][_0x3797('0x4a')]+'%'};return _0x2d8d7d;}})});}_0x8cfbbd=_[_0x3797('0x4b')]({},_0x8cfbbd,_0x6f651c[_0x3797('0x4d')]);var _0x5bdc2a={'where':_0x8cfbbd[_0x3797('0x47')]};return db[_0x3797('0x3a')]['count'](_0x5bdc2a)['then'](function(_0x24eed8){_0x5b5c7d[_0x3797('0x2d')]=_0x24eed8;if(_0x6f651c[_0x3797('0x3f')]['includeAll']){_0x8cfbbd[_0x3797('0x4e')]=[{'all':!![]}];}return db['Network'][_0x3797('0x4f')](_0x8cfbbd);})['then'](function(_0x77d1d6){_0x5b5c7d[_0x3797('0x50')]=_0x77d1d6;return _0x5b5c7d;})[_0x3797('0x51')](respondWithFilteredResult(_0x5b9fac,_0x8cfbbd))[_0x3797('0x28')](handleError(_0x5b9fac,null));};exports[_0x3797('0x52')]=function(_0x5ed3d1,_0x5033f5){var _0x14b3c4={'raw':!![],'where':{'id':_0x5ed3d1[_0x3797('0x53')]['id']}},_0x50da87={};_0x50da87['model']=_[_0x3797('0x54')](db[_0x3797('0x3a')][_0x3797('0x3b')]);_0x50da87['query']=_[_0x3797('0x54')](_0x5ed3d1[_0x3797('0x3f')]);_0x50da87[_0x3797('0x48')]=_[_0x3797('0x40')](_0x50da87[_0x3797('0x3e')],_0x50da87['query']);_0x14b3c4['attributes']=_[_0x3797('0x40')](_0x50da87[_0x3797('0x3e')],qs[_0x3797('0x42')](_0x5ed3d1[_0x3797('0x3f')][_0x3797('0x42')]));_0x14b3c4[_0x3797('0x41')]=_0x14b3c4[_0x3797('0x41')]['length']?_0x14b3c4[_0x3797('0x41')]:_0x50da87[_0x3797('0x3e')];if(_0x5ed3d1[_0x3797('0x3f')]['includeAll']){_0x14b3c4[_0x3797('0x4e')]=[{'all':!![]}];}_0x14b3c4=_[_0x3797('0x4b')]({},_0x14b3c4,_0x5ed3d1[_0x3797('0x4d')]);return db[_0x3797('0x3a')][_0x3797('0x55')](_0x14b3c4)['then'](handleEntityNotFound(_0x5033f5,null))[_0x3797('0x51')](respondWithResult(_0x5033f5,null))[_0x3797('0x28')](handleError(_0x5033f5,null));};exports[_0x3797('0x56')]=function(_0x4f221a,_0x5df14b,_0x3a4662){var _0xeb561e;return db[_0x3797('0x57')]['transaction'](function(_0x392306){return db[_0x3797('0x3a')][_0x3797('0x56')](_0x4f221a[_0x3797('0x58')],{'raw':!![]})[_0x3797('0x51')](function(_0x37a23c){_0xeb561e=_0x37a23c;return db[_0x3797('0x3a')][_0x3797('0x4f')]({'where':{'type':_0x4f221a[_0x3797('0x58')]['type']},'raw':!![]});})[_0x3797('0x51')](function(_0x34d782){if(_0xeb561e[_0x3797('0x3c')][_0x3797('0x59')]()=='STUN'){var _0x576420=fs[_0x3797('0x5a')](path[_0x3797('0x5b')](config[_0x3797('0x5c')],_0x3797('0x5d')),'utf8');var _0x16fd5c=ejs[_0x3797('0x5e')](_0x576420,{'networks':_0x34d782||[]});fs[_0x3797('0x5f')](_0x3797('0x60'),_0x16fd5c);return respondWithRpcPromise(_0x3797('0x61'),'create',{'module':_0x3797('0x62')});}else if(_0xeb561e[_0x3797('0x3c')][_0x3797('0x59')]()==_0x3797('0x63')){var _0x224fd1=fs[_0x3797('0x5a')](path[_0x3797('0x5b')](config[_0x3797('0x5c')],_0x3797('0x64')),_0x3797('0x65'));var _0x120563=ejs['render'](_0x224fd1,{'networks':_0x34d782||[]});fs[_0x3797('0x5f')](_0x3797('0x66'),_0x120563);return respondWithRpcPromise(_0x3797('0x61'),_0x3797('0x56'),{'module':_0x3797('0x62')});}else{var _0x20640a=fs[_0x3797('0x5a')](path['join'](config[_0x3797('0x5c')],'server/files/templates/network.ejs'),_0x3797('0x65'));var _0xddb540=ejs[_0x3797('0x5e')](_0x20640a,{'networks':_0x34d782||[]});fs[_0x3797('0x5f')](util[_0x3797('0x67')](_0x3797('0x68'),_0x4f221a[_0x3797('0x58')][_0x3797('0x3c')]['toLowerCase']()),_0xddb540);return respondWithRpcPromise(_0x3797('0x61'),_0x3797('0x56'),{'module':_0x3797('0x69')});}return null;})['then'](function(){return _0xeb561e;});})[_0x3797('0x51')](respondWithResult(_0x5df14b,0xc9))[_0x3797('0x28')](handleError(_0x5df14b,null));};exports[_0x3797('0x33')]=function(_0x544cbf,_0x48c8ca,_0x4d6f52){var _0x59e82c;return db[_0x3797('0x57')][_0x3797('0x6a')](function(_0x5d3313){return db['Network'][_0x3797('0x55')]({'where':{'id':_0x544cbf[_0x3797('0x53')]['id']}})[_0x3797('0x51')](handleEntityNotFound(_0x48c8ca,null))[_0x3797('0x51')](saveUpdates(_0x544cbf['body'],null))[_0x3797('0x51')](function(_0x39df0b){if(_0x39df0b){_0x59e82c=_0x39df0b;return db['Network'][_0x3797('0x4f')]({'where':{'type':_0x59e82c[_0x3797('0x3c')]},'raw':!![]});}return null;})[_0x3797('0x51')](function(_0x3e3c34){if(_0x59e82c[_0x3797('0x3c')][_0x3797('0x59')]()==_0x3797('0x6b')){var _0x5c7ef3=fs[_0x3797('0x5a')](path['join'](config[_0x3797('0x5c')],_0x3797('0x5d')),_0x3797('0x65'));var _0x4a24a2=ejs[_0x3797('0x5e')](_0x5c7ef3,{'networks':_0x3e3c34||[]});fs[_0x3797('0x5f')]('/etc/asterisk/stun_xcally.conf',_0x4a24a2);return respondWithRpcPromise('Reload',_0x3797('0x33'),{'module':_0x3797('0x62')});}else if(_0x59e82c[_0x3797('0x3c')][_0x3797('0x59')]()==_0x3797('0x63')){var _0xc41b8b=fs[_0x3797('0x5a')](path['join'](config['root'],'server/files/templates/turn_multiple.ejs'),_0x3797('0x65'));var _0x432a12=ejs[_0x3797('0x5e')](_0xc41b8b,{'networks':_0x3e3c34||[]});fs[_0x3797('0x5f')](_0x3797('0x66'),_0x432a12);return respondWithRpcPromise(_0x3797('0x61'),'update',{'module':_0x3797('0x62')});}else{var _0x144b9f=fs[_0x3797('0x5a')](path[_0x3797('0x5b')](config[_0x3797('0x5c')],_0x3797('0x6c')),_0x3797('0x65'));var _0x206cdf=ejs[_0x3797('0x5e')](_0x144b9f,{'networks':_0x3e3c34||[]});fs[_0x3797('0x5f')](util['format'](_0x3797('0x68'),_0x544cbf[_0x3797('0x58')]['type'][_0x3797('0x6d')]()),_0x206cdf);return respondWithRpcPromise(_0x3797('0x61'),_0x3797('0x33'),{'module':'chan_sip.so'});}return null;})[_0x3797('0x51')](function(_0x4bf1cd){if(_0x4bf1cd){return _0x59e82c;}return null;});})['then'](respondWithResult(_0x48c8ca,null))[_0x3797('0x28')](handleError(_0x48c8ca,null));};exports['destroy']=function(_0xd36080,_0xd0d194,_0x20b072){var _0x4a36e0;return db['Network'][_0x3797('0x55')]({'where':{'id':_0xd36080[_0x3797('0x53')]['id']}})['then'](function(_0x2f072b){_0x4a36e0=_0x2f072b;return _0x2f072b;})['then'](handleEntityNotFound(_0xd0d194,null))[_0x3797('0x51')](removeEntity(_0xd0d194,null))[_0x3797('0x51')](function(){if(_0x4a36e0){return db[_0x3797('0x3a')]['findAll']({'where':{'type':_0x4a36e0[_0x3797('0x3c')]},'raw':!![]});}})[_0x3797('0x51')](function(_0x104e96){if(_0x4a36e0[_0x3797('0x3c')][_0x3797('0x59')]()==_0x3797('0x6b')){var _0x4ea3ba=fs['readFileSync'](path[_0x3797('0x5b')](config['root'],_0x3797('0x5d')),'utf8');var _0x4e319e=ejs[_0x3797('0x5e')](_0x4ea3ba,{'networks':_0x104e96||[]});fs[_0x3797('0x5f')](_0x3797('0x60'),_0x4e319e);return respondWithRpcPromise('Reload','destroy',{'module':_0x3797('0x62')});}else if(_0x4a36e0[_0x3797('0x3c')][_0x3797('0x59')]()==_0x3797('0x63')){var _0x3b4870=fs[_0x3797('0x5a')](path[_0x3797('0x5b')](config['root'],'server/files/templates/turn_multiple.ejs'),'utf8');var _0x22f287=ejs['render'](_0x3b4870,{'networks':_0x104e96||[]});fs[_0x3797('0x5f')](_0x3797('0x66'),_0x22f287);return respondWithRpcPromise(_0x3797('0x61'),_0x3797('0x34'),{'module':_0x3797('0x62')});}else{var _0x3e78a5=fs[_0x3797('0x5a')](path[_0x3797('0x5b')](config[_0x3797('0x5c')],_0x3797('0x6c')),_0x3797('0x65'));var _0x106f6f=ejs[_0x3797('0x5e')](_0x3e78a5,{'networks':_0x104e96||[]});fs[_0x3797('0x5f')](util[_0x3797('0x67')](_0x3797('0x68'),_0xd36080[_0x3797('0x58')][_0x3797('0x3c')][_0x3797('0x6d')]()),_0x106f6f);return respondWithRpcPromise(_0x3797('0x61'),_0x3797('0x34'),{'module':'chan_sip.so'});}return null;})[_0x3797('0x28')](handleError(_0xd0d194,null));}; \ No newline at end of file +var _0x06fb=['name','send','map','Network','fieldName','type','key','model','query','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','pick','filter','where','merge','options','includeAll','include','findAll','catch','show','params','keys','find','create','sequelize','transaction','body','toUpperCase','STUN','readFileSync','join','root','server/files/templates/stun_multiple.ejs','utf8','render','Reload','res_stun_monitor.so','TURN','server/files/templates/turn_multiple.ejs','writeFileSync','server/files/templates/network.ejs','/etc/asterisk/sip_xcally_%s.conf','/etc/asterisk/turn_xcally.conf','format','chan_sip.so','/etc/asterisk/stun_xcally.conf','html-pdf','eml-format','zip-dir','mustache','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','papaparse','../../components/auth/service','../../components/parsers/qs','../../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~!@#$%^&-_=+[{]}.','request','then','info','request\x20sent','Network,\x20%s,\x20%s,\x20%s','error','code','Network,\x20%s,\x20%s','message','result','sendStatus','end','status','json','count','offset','limit','set','Content-Range','apply','reject','save','update','destroy','stack'];(function(_0x4b8958,_0x490eb7){var _0x5a2972=function(_0x37bc31){while(--_0x37bc31){_0x4b8958['push'](_0x4b8958['shift']());}};_0x5a2972(++_0x490eb7);}(_0x06fb,0x9e));var _0xb06f=function(_0x1c289a,_0x277fe7){_0x1c289a=_0x1c289a-0x0;var _0x28d68e=_0x06fb[_0x1c289a];return _0x28d68e;};'use strict';var pdf=require(_0xb06f('0x0'));var emlformat=require(_0xb06f('0x1'));var rimraf=require('rimraf');var zipdir=require(_0xb06f('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0xb06f('0x3'));var util=require('util');var path=require(_0xb06f('0x4'));var sox=require(_0xb06f('0x5'));var csv=require(_0xb06f('0x6'));var ejs=require(_0xb06f('0x7'));var fs=require('fs');var _=require(_0xb06f('0x8'));var squel=require(_0xb06f('0x9'));var crypto=require(_0xb06f('0xa'));var jsforce=require(_0xb06f('0xb'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0xb06f('0xc'));var Redis=require('ioredis');var authService=require(_0xb06f('0xd'));var qs=require(_0xb06f('0xe'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0xb06f('0xf'))(_0xb06f('0x10'));var utils=require(_0xb06f('0x11'));var config=require(_0xb06f('0x12'));var db=require(_0xb06f('0x13'))['db'];var jayson=require(_0xb06f('0x14'));var client=jayson[_0xb06f('0x15')]['http']({'port':0x232a});function checkPasswordPattern(_0x37b711,_0x417ebf,_0x50fff8){if(_0x50fff8){var _0x1cd5b1=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x1cd5b1[_0xb06f('0x16')](_0x417ebf)){return _0x37b711;}else{throw new db[(_0xb06f('0x17'))]['ValidationError'](_0xb06f('0x18'));}}else{return _0x37b711;}}function respondWithRpcPromise(_0x2b5afd,_0x5b9128,_0x1ccfcd,_0x1db680){return new BPromise(function(_0x6c4f35,_0x92f19a){var _0x481b35=_0x1db680||client;return _0x481b35[_0xb06f('0x19')](_0x2b5afd,_0x1ccfcd)[_0xb06f('0x1a')](function(_0x4c9e41){logger[_0xb06f('0x1b')]('Network,\x20%s,\x20%s',_0x5b9128,_0xb06f('0x1c'));logger['debug'](_0xb06f('0x1d'),_0x5b9128,_0xb06f('0x1c'),JSON['stringify'](_0x4c9e41));if(_0x4c9e41[_0xb06f('0x1e')]){if(_0x4c9e41[_0xb06f('0x1e')][_0xb06f('0x1f')]===0x1f4){logger[_0xb06f('0x1e')](_0xb06f('0x20'),_0x5b9128,_0x4c9e41[_0xb06f('0x1e')]['message']);return _0x92f19a(_0x4c9e41[_0xb06f('0x1e')]['message']);}logger[_0xb06f('0x1e')](_0xb06f('0x20'),_0x5b9128,_0x4c9e41[_0xb06f('0x1e')][_0xb06f('0x21')]);return _0x6c4f35(_0x4c9e41[_0xb06f('0x1e')][_0xb06f('0x21')]);}else{logger[_0xb06f('0x1b')](_0xb06f('0x20'),_0x5b9128,'request\x20sent');_0x6c4f35(_0x4c9e41[_0xb06f('0x22')]['message']);}})['catch'](function(_0x59eda2){logger['error'](_0xb06f('0x20'),_0x5b9128,_0x59eda2);_0x92f19a(_0x59eda2);});});}function respondWithStatusCode(_0x13734e,_0x2d576c){_0x2d576c=_0x2d576c||0xcc;return function(_0x5d730c){if(_0x5d730c){return _0x13734e[_0xb06f('0x23')](_0x2d576c);}return _0x13734e['status'](_0x2d576c)[_0xb06f('0x24')]();};}function respondWithResult(_0x195000,_0x4f3581){_0x4f3581=_0x4f3581||0xc8;return function(_0x1e5266){if(_0x1e5266){return _0x195000[_0xb06f('0x25')](_0x4f3581)[_0xb06f('0x26')](_0x1e5266);}};}function respondWithFilteredResult(_0x39f5ac,_0x2221dc){return function(_0x15888b){if(_0x15888b){var _0x474f95=_0x15888b[_0xb06f('0x27')],_0x1ebfcf=_0x2221dc[_0xb06f('0x28')],_0x169d59=_0x2221dc[_0xb06f('0x28')]+_0x2221dc[_0xb06f('0x29')],_0x1f38c5;if(_0x169d59>=_0x474f95){_0x169d59=_0x474f95;_0x1f38c5=0xc8;}else{_0x1f38c5=0xce;}_0x39f5ac[_0xb06f('0x25')](_0x1f38c5);return _0x39f5ac[_0xb06f('0x2a')](_0xb06f('0x2b'),_0x1ebfcf+'-'+_0x169d59+'/'+_0x474f95)[_0xb06f('0x26')](_0x15888b);}return null;};}function patchUpdates(_0x444ec0){return function(_0xac847b){try{jsonpatch[_0xb06f('0x2c')](_0xac847b,_0x444ec0,!![]);}catch(_0x158e5f){return BPromise[_0xb06f('0x2d')](_0x158e5f);}return _0xac847b[_0xb06f('0x2e')]();};}function saveUpdates(_0x23d4a3,_0x19caa7){return function(_0x565325){if(_0x565325){return _0x565325[_0xb06f('0x2f')](_0x23d4a3)[_0xb06f('0x1a')](function(_0xe5a70c){return _0xe5a70c;});}return null;};}function removeEntity(_0x9dbe26,_0x5da3c8){return function(_0x127ba9){if(_0x127ba9){return _0x127ba9[_0xb06f('0x30')]()[_0xb06f('0x1a')](function(){_0x9dbe26[_0xb06f('0x25')](0xcc)[_0xb06f('0x24')]();});}};}function handleEntityNotFound(_0x2ad65e,_0x337215){return function(_0x2f0a28){if(!_0x2f0a28){_0x2ad65e[_0xb06f('0x23')](0x194);}return _0x2f0a28;};}function handleError(_0x316ff1,_0x25641b){_0x25641b=_0x25641b||0x1f4;return function(_0x1d04af){logger['error'](_0x1d04af[_0xb06f('0x31')]);if(_0x1d04af[_0xb06f('0x32')]){delete _0x1d04af[_0xb06f('0x32')];}_0x316ff1[_0xb06f('0x25')](_0x25641b)[_0xb06f('0x33')](_0x1d04af);};}exports['index']=function(_0x21ab3a,_0x3c0aa2){var _0x1d47b5={},_0x1d4a8c={},_0xaddf5d={'count':0x0,'rows':[]};var _0x178037=_[_0xb06f('0x34')](db[_0xb06f('0x35')]['rawAttributes'],function(_0x2f99f8){return{'name':_0x2f99f8[_0xb06f('0x36')],'type':_0x2f99f8[_0xb06f('0x37')][_0xb06f('0x38')]};});_0x1d4a8c[_0xb06f('0x39')]=_[_0xb06f('0x34')](_0x178037,_0xb06f('0x32'));_0x1d4a8c['query']=_['keys'](_0x21ab3a[_0xb06f('0x3a')]);_0x1d4a8c[_0xb06f('0x3b')]=_['intersection'](_0x1d4a8c['model'],_0x1d4a8c[_0xb06f('0x3a')]);_0x1d47b5[_0xb06f('0x3c')]=_[_0xb06f('0x3d')](_0x1d4a8c['model'],qs[_0xb06f('0x3e')](_0x21ab3a[_0xb06f('0x3a')][_0xb06f('0x3e')]));_0x1d47b5[_0xb06f('0x3c')]=_0x1d47b5[_0xb06f('0x3c')][_0xb06f('0x3f')]?_0x1d47b5[_0xb06f('0x3c')]:_0x1d4a8c[_0xb06f('0x39')];if(!_0x21ab3a[_0xb06f('0x3a')][_0xb06f('0x40')](_0xb06f('0x41'))){_0x1d47b5[_0xb06f('0x29')]=qs[_0xb06f('0x29')](_0x21ab3a[_0xb06f('0x3a')][_0xb06f('0x29')]);_0x1d47b5['offset']=qs['offset'](_0x21ab3a[_0xb06f('0x3a')][_0xb06f('0x28')]);}_0x1d47b5[_0xb06f('0x42')]=qs[_0xb06f('0x43')](_0x21ab3a[_0xb06f('0x3a')][_0xb06f('0x43')]);_0x1d47b5['where']=qs[_0xb06f('0x3b')](_[_0xb06f('0x44')](_0x21ab3a[_0xb06f('0x3a')],_0x1d4a8c[_0xb06f('0x3b')]));if(_0x21ab3a['query'][_0xb06f('0x45')]){_0x1d47b5[_0xb06f('0x46')]=_[_0xb06f('0x47')](_0x1d47b5['where'],{'$or':_[_0xb06f('0x34')](_0x178037,function(_0x2d13e0){if(_0x2d13e0[_0xb06f('0x37')]!=='VIRTUAL'){var _0x353efb={};_0x353efb[_0x2d13e0[_0xb06f('0x32')]]={'$like':'%'+_0x21ab3a[_0xb06f('0x3a')][_0xb06f('0x45')]+'%'};return _0x353efb;}})});}_0x1d47b5=_[_0xb06f('0x47')]({},_0x1d47b5,_0x21ab3a[_0xb06f('0x48')]);var _0x5699fc={'where':_0x1d47b5['where']};return db[_0xb06f('0x35')][_0xb06f('0x27')](_0x5699fc)['then'](function(_0x59135e){_0xaddf5d[_0xb06f('0x27')]=_0x59135e;if(_0x21ab3a[_0xb06f('0x3a')][_0xb06f('0x49')]){_0x1d47b5[_0xb06f('0x4a')]=[{'all':!![]}];}return db[_0xb06f('0x35')][_0xb06f('0x4b')](_0x1d47b5);})[_0xb06f('0x1a')](function(_0x59c984){_0xaddf5d['rows']=_0x59c984;return _0xaddf5d;})[_0xb06f('0x1a')](respondWithFilteredResult(_0x3c0aa2,_0x1d47b5))[_0xb06f('0x4c')](handleError(_0x3c0aa2,null));};exports[_0xb06f('0x4d')]=function(_0xb318c8,_0x574c94){var _0x198c85={'raw':!![],'where':{'id':_0xb318c8[_0xb06f('0x4e')]['id']}},_0xa10fba={};_0xa10fba[_0xb06f('0x39')]=_['keys'](db[_0xb06f('0x35')]['rawAttributes']);_0xa10fba['query']=_[_0xb06f('0x4f')](_0xb318c8[_0xb06f('0x3a')]);_0xa10fba[_0xb06f('0x3b')]=_[_0xb06f('0x3d')](_0xa10fba[_0xb06f('0x39')],_0xa10fba['query']);_0x198c85[_0xb06f('0x3c')]=_[_0xb06f('0x3d')](_0xa10fba['model'],qs['fields'](_0xb318c8[_0xb06f('0x3a')][_0xb06f('0x3e')]));_0x198c85[_0xb06f('0x3c')]=_0x198c85[_0xb06f('0x3c')][_0xb06f('0x3f')]?_0x198c85[_0xb06f('0x3c')]:_0xa10fba[_0xb06f('0x39')];if(_0xb318c8[_0xb06f('0x3a')][_0xb06f('0x49')]){_0x198c85[_0xb06f('0x4a')]=[{'all':!![]}];}_0x198c85=_['merge']({},_0x198c85,_0xb318c8[_0xb06f('0x48')]);return db[_0xb06f('0x35')][_0xb06f('0x50')](_0x198c85)[_0xb06f('0x1a')](handleEntityNotFound(_0x574c94,null))[_0xb06f('0x1a')](respondWithResult(_0x574c94,null))['catch'](handleError(_0x574c94,null));};exports[_0xb06f('0x51')]=function(_0x21548b,_0x4d92f4,_0x5630d9){var _0x5d0ab0;return db[_0xb06f('0x52')][_0xb06f('0x53')](function(_0x4e3bd2){return db[_0xb06f('0x35')][_0xb06f('0x51')](_0x21548b[_0xb06f('0x54')],{'raw':!![]})['then'](function(_0x13fc96){_0x5d0ab0=_0x13fc96;return db[_0xb06f('0x35')][_0xb06f('0x4b')]({'where':{'type':_0x21548b[_0xb06f('0x54')][_0xb06f('0x37')]},'raw':!![]});})[_0xb06f('0x1a')](function(_0x21ddcb){if(_0x5d0ab0['type'][_0xb06f('0x55')]()==_0xb06f('0x56')){var _0x9440e5=fs[_0xb06f('0x57')](path[_0xb06f('0x58')](config[_0xb06f('0x59')],_0xb06f('0x5a')),_0xb06f('0x5b'));var _0x523286=ejs[_0xb06f('0x5c')](_0x9440e5,{'networks':_0x21ddcb||[]});fs['writeFileSync']('/etc/asterisk/stun_xcally.conf',_0x523286);return respondWithRpcPromise(_0xb06f('0x5d'),_0xb06f('0x51'),{'module':_0xb06f('0x5e')});}else if(_0x5d0ab0['type']['toUpperCase']()==_0xb06f('0x5f')){var _0x4bee8e=fs[_0xb06f('0x57')](path[_0xb06f('0x58')](config['root'],_0xb06f('0x60')),_0xb06f('0x5b'));var _0x54491d=ejs[_0xb06f('0x5c')](_0x4bee8e,{'networks':_0x21ddcb||[]});fs[_0xb06f('0x61')]('/etc/asterisk/turn_xcally.conf',_0x54491d);return respondWithRpcPromise(_0xb06f('0x5d'),_0xb06f('0x51'),{'module':'res_stun_monitor.so'});}else{var _0x4b1cda=fs[_0xb06f('0x57')](path[_0xb06f('0x58')](config[_0xb06f('0x59')],_0xb06f('0x62')),'utf8');var _0x6ec6a=ejs['render'](_0x4b1cda,{'networks':_0x21ddcb||[]});fs[_0xb06f('0x61')](util['format'](_0xb06f('0x63'),_0x21548b[_0xb06f('0x54')][_0xb06f('0x37')]['toLowerCase']()),_0x6ec6a);return respondWithRpcPromise('Reload',_0xb06f('0x51'),{'module':'chan_sip.so'});}return null;})[_0xb06f('0x1a')](function(){return _0x5d0ab0;});})[_0xb06f('0x1a')](respondWithResult(_0x4d92f4,0xc9))['catch'](handleError(_0x4d92f4,null));};exports['update']=function(_0x260ba4,_0x265558,_0xb7293a){var _0x4a4d93;return db[_0xb06f('0x52')][_0xb06f('0x53')](function(_0x815e54){return db[_0xb06f('0x35')][_0xb06f('0x50')]({'where':{'id':_0x260ba4[_0xb06f('0x4e')]['id']}})[_0xb06f('0x1a')](handleEntityNotFound(_0x265558,null))[_0xb06f('0x1a')](saveUpdates(_0x260ba4['body'],null))['then'](function(_0x235d50){if(_0x235d50){_0x4a4d93=_0x235d50;return db[_0xb06f('0x35')][_0xb06f('0x4b')]({'where':{'type':_0x4a4d93[_0xb06f('0x37')]},'raw':!![]});}return null;})[_0xb06f('0x1a')](function(_0x42e899){if(_0x4a4d93[_0xb06f('0x37')]['toUpperCase']()==_0xb06f('0x56')){var _0x1d87d4=fs[_0xb06f('0x57')](path[_0xb06f('0x58')](config[_0xb06f('0x59')],_0xb06f('0x5a')),'utf8');var _0x1aafaf=ejs[_0xb06f('0x5c')](_0x1d87d4,{'networks':_0x42e899||[]});fs[_0xb06f('0x61')]('/etc/asterisk/stun_xcally.conf',_0x1aafaf);return respondWithRpcPromise('Reload',_0xb06f('0x2f'),{'module':_0xb06f('0x5e')});}else if(_0x4a4d93[_0xb06f('0x37')]['toUpperCase']()==_0xb06f('0x5f')){var _0x1e04ee=fs[_0xb06f('0x57')](path['join'](config[_0xb06f('0x59')],_0xb06f('0x60')),_0xb06f('0x5b'));var _0x21fe8c=ejs['render'](_0x1e04ee,{'networks':_0x42e899||[]});fs[_0xb06f('0x61')](_0xb06f('0x64'),_0x21fe8c);return respondWithRpcPromise(_0xb06f('0x5d'),_0xb06f('0x2f'),{'module':_0xb06f('0x5e')});}else{var _0x5b492d=fs[_0xb06f('0x57')](path['join'](config[_0xb06f('0x59')],_0xb06f('0x62')),_0xb06f('0x5b'));var _0x392932=ejs[_0xb06f('0x5c')](_0x5b492d,{'networks':_0x42e899||[]});fs[_0xb06f('0x61')](util[_0xb06f('0x65')]('/etc/asterisk/sip_xcally_%s.conf',_0x260ba4[_0xb06f('0x54')][_0xb06f('0x37')]['toLowerCase']()),_0x392932);return respondWithRpcPromise(_0xb06f('0x5d'),_0xb06f('0x2f'),{'module':_0xb06f('0x66')});}return null;})[_0xb06f('0x1a')](function(_0x5d3581){if(_0x5d3581){return _0x4a4d93;}return null;});})[_0xb06f('0x1a')](respondWithResult(_0x265558,null))[_0xb06f('0x4c')](handleError(_0x265558,null));};exports[_0xb06f('0x30')]=function(_0x4fa9f5,_0x755217,_0xace858){var _0x4e0a03;return db[_0xb06f('0x35')][_0xb06f('0x50')]({'where':{'id':_0x4fa9f5[_0xb06f('0x4e')]['id']}})['then'](function(_0x3a114f){_0x4e0a03=_0x3a114f;return _0x3a114f;})['then'](handleEntityNotFound(_0x755217,null))[_0xb06f('0x1a')](removeEntity(_0x755217,null))[_0xb06f('0x1a')](function(){if(_0x4e0a03){return db['Network']['findAll']({'where':{'type':_0x4e0a03[_0xb06f('0x37')]},'raw':!![]});}})[_0xb06f('0x1a')](function(_0x518cb1){if(_0x4e0a03[_0xb06f('0x37')][_0xb06f('0x55')]()==_0xb06f('0x56')){var _0x1b1f18=fs[_0xb06f('0x57')](path[_0xb06f('0x58')](config[_0xb06f('0x59')],_0xb06f('0x5a')),_0xb06f('0x5b'));var _0x57978=ejs[_0xb06f('0x5c')](_0x1b1f18,{'networks':_0x518cb1||[]});fs[_0xb06f('0x61')](_0xb06f('0x67'),_0x57978);return respondWithRpcPromise(_0xb06f('0x5d'),'destroy',{'module':_0xb06f('0x5e')});}else if(_0x4e0a03[_0xb06f('0x37')][_0xb06f('0x55')]()==_0xb06f('0x5f')){var _0xec5011=fs[_0xb06f('0x57')](path['join'](config[_0xb06f('0x59')],_0xb06f('0x60')),_0xb06f('0x5b'));var _0x195c23=ejs[_0xb06f('0x5c')](_0xec5011,{'networks':_0x518cb1||[]});fs[_0xb06f('0x61')]('/etc/asterisk/turn_xcally.conf',_0x195c23);return respondWithRpcPromise(_0xb06f('0x5d'),'destroy',{'module':'res_stun_monitor.so'});}else{var _0x48a49d=fs[_0xb06f('0x57')](path[_0xb06f('0x58')](config[_0xb06f('0x59')],_0xb06f('0x62')),_0xb06f('0x5b'));var _0x45e1a9=ejs[_0xb06f('0x5c')](_0x48a49d,{'networks':_0x518cb1||[]});fs['writeFileSync'](util[_0xb06f('0x65')](_0xb06f('0x63'),_0x4fa9f5[_0xb06f('0x54')][_0xb06f('0x37')]['toLowerCase']()),_0x45e1a9);return respondWithRpcPromise('Reload',_0xb06f('0x30'),{'module':_0xb06f('0x66')});}return null;})[_0xb06f('0x4c')](handleError(_0x755217,null));}; \ No newline at end of file diff --git a/server/api/network/network.model.js b/server/api/network/network.model.js index 6d4f46b..14bff1e 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 _0x5047=['util','api','moment','bluebird','rimraf','./network.attributes','define','Network','lodash'];(function(_0x42930d,_0x1a25e5){var _0x2060a1=function(_0x1e5b0e){while(--_0x1e5b0e){_0x42930d['push'](_0x42930d['shift']());}};_0x2060a1(++_0x1a25e5);}(_0x5047,0xce));var _0x7504=function(_0x257017,_0x330627){_0x257017=_0x257017-0x0;var _0x38536d=_0x5047[_0x257017];return _0x38536d;};'use strict';var _=require(_0x7504('0x0'));var util=require(_0x7504('0x1'));var logger=require('../../config/logger')(_0x7504('0x2'));var moment=require(_0x7504('0x3'));var BPromise=require(_0x7504('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x7504('0x5'));var config=require('../../config/environment');var attributes=require(_0x7504('0x6'));module['exports']=function(_0x52fb88,_0x48a3ec){return _0x52fb88[_0x7504('0x7')](_0x7504('0x8'),attributes,{'tableName':'network','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xd9e1=['request-promise','path','rimraf','../../config/environment','./network.attributes','define','Network','network','lodash','util','../../config/logger','api','moment','bluebird'];(function(_0x4fc2a1,_0x5d4b3d){var _0x384573=function(_0x2e9a02){while(--_0x2e9a02){_0x4fc2a1['push'](_0x4fc2a1['shift']());}};_0x384573(++_0x5d4b3d);}(_0xd9e1,0x104));var _0x1d9e=function(_0x465a0c,_0x19d4d5){_0x465a0c=_0x465a0c-0x0;var _0x1e202e=_0xd9e1[_0x465a0c];return _0x1e202e;};'use strict';var _=require(_0x1d9e('0x0'));var util=require(_0x1d9e('0x1'));var logger=require(_0x1d9e('0x2'))(_0x1d9e('0x3'));var moment=require(_0x1d9e('0x4'));var BPromise=require(_0x1d9e('0x5'));var rp=require(_0x1d9e('0x6'));var fs=require('fs');var path=require(_0x1d9e('0x7'));var rimraf=require(_0x1d9e('0x8'));var config=require(_0x1d9e('0x9'));var attributes=require(_0x1d9e('0xa'));module['exports']=function(_0x2cffdc,_0xedb19){return _0x2cffdc[_0x1d9e('0xb')](_0x1d9e('0xc'),attributes,{'tableName':_0x1d9e('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 3e4d8c2..b20403b 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 _0x9a69=['Network,\x20%s,\x20%s,\x20%s','stringify','error','code','message','request\x20sent','result','catch','lodash','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','info','Network,\x20%s,\x20%s','debug'];(function(_0x5e3836,_0x35936a){var _0x2a4f95=function(_0x25e5d7){while(--_0x25e5d7){_0x5e3836['push'](_0x5e3836['shift']());}};_0x2a4f95(++_0x35936a);}(_0x9a69,0x7b));var _0x99a6=function(_0x40a045,_0x516f0e){_0x40a045=_0x40a045-0x0;var _0x1a687c=_0x9a69[_0x40a045];return _0x1a687c;};'use strict';var _=require(_0x99a6('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0x99a6('0x1'));var rs=require(_0x99a6('0x2'));var fs=require('fs');var Redis=require(_0x99a6('0x3'));var db=require(_0x99a6('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x99a6('0x5'))(_0x99a6('0x6'));var config=require(_0x99a6('0x7'));var jayson=require(_0x99a6('0x8'));var client=jayson['client'][_0x99a6('0x9')]({'port':0x232a});function respondWithRpcPromise(_0xc89e7d,_0xdfcb12,_0x385523){return new BPromise(function(_0x308e7c,_0x467f85){return client[_0x99a6('0xa')](_0xc89e7d,_0x385523)[_0x99a6('0xb')](function(_0x1f5954){logger[_0x99a6('0xc')](_0x99a6('0xd'),_0xdfcb12,'request\x20sent');logger[_0x99a6('0xe')](_0x99a6('0xf'),_0xdfcb12,'request\x20sent',JSON[_0x99a6('0x10')](_0x1f5954));if(_0x1f5954[_0x99a6('0x11')]){if(_0x1f5954[_0x99a6('0x11')][_0x99a6('0x12')]===0x1f4){logger[_0x99a6('0x11')](_0x99a6('0xd'),_0xdfcb12,_0x1f5954['error'][_0x99a6('0x13')]);return _0x467f85(_0x1f5954[_0x99a6('0x11')]['message']);}logger[_0x99a6('0x11')]('Network,\x20%s,\x20%s',_0xdfcb12,_0x1f5954['error'][_0x99a6('0x13')]);return _0x308e7c(_0x1f5954[_0x99a6('0x11')][_0x99a6('0x13')]);}else{logger['info'](_0x99a6('0xd'),_0xdfcb12,_0x99a6('0x14'));_0x308e7c(_0x1f5954[_0x99a6('0x15')][_0x99a6('0x13')]);}})[_0x99a6('0x16')](function(_0x57ae73){logger['error'](_0x99a6('0xd'),_0xdfcb12,_0x57ae73);_0x467f85(_0x57ae73);});});} \ No newline at end of file +var _0x2e77=['stringify','error','code','message','result','catch','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','request','then','info','Network,\x20%s,\x20%s','request\x20sent','Network,\x20%s,\x20%s,\x20%s'];(function(_0x4ba766,_0xef756a){var _0x20ab91=function(_0x120c97){while(--_0x120c97){_0x4ba766['push'](_0x4ba766['shift']());}};_0x20ab91(++_0xef756a);}(_0x2e77,0x96));var _0x72e7=function(_0x5c7e51,_0x193b89){_0x5c7e51=_0x5c7e51-0x0;var _0x15b461=_0x2e77[_0x5c7e51];return _0x15b461;};'use strict';var _=require(_0x72e7('0x0'));var util=require('util');var moment=require(_0x72e7('0x1'));var BPromise=require(_0x72e7('0x2'));var rs=require(_0x72e7('0x3'));var fs=require('fs');var Redis=require(_0x72e7('0x4'));var db=require(_0x72e7('0x5'))['db'];var utils=require(_0x72e7('0x6'));var logger=require(_0x72e7('0x7'))(_0x72e7('0x8'));var config=require(_0x72e7('0x9'));var jayson=require('jayson/promise');var client=jayson[_0x72e7('0xa')][_0x72e7('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x2b1265,_0x20ae03,_0x4f1da9){return new BPromise(function(_0x21cf3f,_0x381983){return client[_0x72e7('0xc')](_0x2b1265,_0x4f1da9)[_0x72e7('0xd')](function(_0x38dc85){logger[_0x72e7('0xe')](_0x72e7('0xf'),_0x20ae03,_0x72e7('0x10'));logger['debug'](_0x72e7('0x11'),_0x20ae03,_0x72e7('0x10'),JSON[_0x72e7('0x12')](_0x38dc85));if(_0x38dc85[_0x72e7('0x13')]){if(_0x38dc85[_0x72e7('0x13')][_0x72e7('0x14')]===0x1f4){logger['error'](_0x72e7('0xf'),_0x20ae03,_0x38dc85[_0x72e7('0x13')][_0x72e7('0x15')]);return _0x381983(_0x38dc85['error'][_0x72e7('0x15')]);}logger[_0x72e7('0x13')](_0x72e7('0xf'),_0x20ae03,_0x38dc85[_0x72e7('0x13')]['message']);return _0x21cf3f(_0x38dc85[_0x72e7('0x13')][_0x72e7('0x15')]);}else{logger[_0x72e7('0xe')]('Network,\x20%s,\x20%s',_0x20ae03,_0x72e7('0x10'));_0x21cf3f(_0x38dc85[_0x72e7('0x16')][_0x72e7('0x15')]);}})[_0x72e7('0x17')](function(_0x229c15){logger[_0x72e7('0x13')]('Network,\x20%s,\x20%s',_0x20ae03,_0x229c15);_0x381983(_0x229c15);});});} \ No newline at end of file diff --git a/server/api/notification/index.js b/server/api/notification/index.js index 276aec9..e9e5204 100644 --- a/server/api/notification/index.js +++ b/server/api/notification/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x6a7e=['post','isAuthenticated','sendNotification','exports','multer','util','path','Router','../../components/interaction/service','./notification.controller'];(function(_0x4d4b0b,_0x292cf7){var _0x31a918=function(_0x58a365){while(--_0x58a365){_0x4d4b0b['push'](_0x4d4b0b['shift']());}};_0x31a918(++_0x292cf7);}(_0x6a7e,0x112));var _0xe6a7=function(_0x10bd35,_0x486704){_0x10bd35=_0x10bd35-0x0;var _0x280c21=_0x6a7e[_0x10bd35];return _0x280c21;};'use strict';var multer=require(_0xe6a7('0x0'));var util=require(_0xe6a7('0x1'));var path=require(_0xe6a7('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0xe6a7('0x3')]();var auth=require('../../components/auth/service');var interaction=require(_0xe6a7('0x4'));var config=require('../../config/environment');var controller=require(_0xe6a7('0x5'));router[_0xe6a7('0x6')]('/',auth[_0xe6a7('0x7')](),controller[_0xe6a7('0x8')]);module[_0xe6a7('0x9')]=router; \ No newline at end of file +var _0xce0c=['connect-timeout','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./notification.controller','post','isAuthenticated','sendNotification','exports','multer'];(function(_0x16083b,_0x21dfb4){var _0x582fc2=function(_0x5854d4){while(--_0x5854d4){_0x16083b['push'](_0x16083b['shift']());}};_0x582fc2(++_0x21dfb4);}(_0xce0c,0xaf));var _0xcce0=function(_0x19e928,_0x26a0e4){_0x19e928=_0x19e928-0x0;var _0x4e941f=_0xce0c[_0x19e928];return _0x4e941f;};'use strict';var multer=require(_0xcce0('0x0'));var util=require('util');var path=require('path');var timeout=require(_0xcce0('0x1'));var express=require('express');var router=express[_0xcce0('0x2')]();var auth=require(_0xcce0('0x3'));var interaction=require(_0xcce0('0x4'));var config=require(_0xcce0('0x5'));var controller=require(_0xcce0('0x6'));router[_0xcce0('0x7')]('/',auth[_0xcce0('0x8')](),controller[_0xcce0('0x9')]);module[_0xcce0('0xa')]=router; \ No newline at end of file diff --git a/server/api/notification/notification.attributes.js b/server/api/notification/notification.attributes.js index 1f159f7..1f55c04 100644 --- a/server/api/notification/notification.attributes.js +++ b/server/api/notification/notification.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x717b=['BOOLEAN','exports','TEXT','STRING'];(function(_0x26a8aa,_0xcc692a){var _0x3d35f7=function(_0x125686){while(--_0x125686){_0x26a8aa['push'](_0x26a8aa['shift']());}};_0x3d35f7(++_0xcc692a);}(_0x717b,0x139));var _0xb717=function(_0x12c3e9,_0x52695a){_0x12c3e9=_0x12c3e9-0x0;var _0x374081=_0x717b[_0x12c3e9];return _0x374081;};'use strict';var Sequelize=require('sequelize');module[_0xb717('0x0')]={'body':{'type':Sequelize[_0xb717('0x1')]},'senderName':{'type':Sequelize['STRING']},'recipientsId':{'type':Sequelize['TEXT']},'recipientsDescription':{'type':Sequelize[_0xb717('0x2')]},'beep':{'type':Sequelize[_0xb717('0x3')]}}; \ No newline at end of file +var _0xc1e7=['TEXT','STRING','BOOLEAN','sequelize','exports'];(function(_0x11200a,_0x3875b4){var _0x3f4a4b=function(_0x2dfd6c){while(--_0x2dfd6c){_0x11200a['push'](_0x11200a['shift']());}};_0x3f4a4b(++_0x3875b4);}(_0xc1e7,0x9e));var _0x7c1e=function(_0x252145,_0x484c0d){_0x252145=_0x252145-0x0;var _0x30d5de=_0xc1e7[_0x252145];return _0x30d5de;};'use strict';var Sequelize=require(_0x7c1e('0x0'));module[_0x7c1e('0x1')]={'body':{'type':Sequelize[_0x7c1e('0x2')]},'senderName':{'type':Sequelize[_0x7c1e('0x3')]},'recipientsId':{'type':Sequelize[_0x7c1e('0x2')]},'recipientsDescription':{'type':Sequelize[_0x7c1e('0x3')]},'beep':{'type':Sequelize[_0x7c1e('0x4')]}}; \ No newline at end of file diff --git a/server/api/notification/notification.controller.js b/server/api/notification/notification.controller.js index a4e56df..af04db4 100644 --- a/server/api/notification/notification.controller.js +++ b/server/api/notification/notification.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x8e5d=['recipients','Missing\x20\x27recipients\x27\x20parameter','parse','Invalid\x20\x27recipients\x27\x20object','chatqueue','faxqueue','mailqueue','smsqueue','voicequeue','team','user','some','model','toLowerCase','Invalid\x20model\x20in\x20\x27recipients\x27\x20object','senderName','fullname','isEmpty','recipientsDescription','beep','SenderId','recipientsId','join','sequelize','transaction','Notification','recipient','emit','notification:send','catch','findOne','html','Invalid\x20\x27TemplateId\x27\x20parameter','render','forEach','startCase','User','union','ids','includes','queue','Queue','push','all','getAgents','map','html-pdf','rimraf','fast-json-patch','request-promise','moment','mustache','util','sox','to-csv','ejs','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/utils','../../config/environment','../../mysqldb','redis','socket.io-emitter','./notification.socket','register','sendStatus','status','end','json','count','limit','Content-Range','apply','reject','save','update','then','error','stack','name','send','hasOwnProperty','text','body','TemplateId','Sequelize','ValidationError','Must\x20specify\x20at\x20least\x20one\x20argument\x20for\x20\x27text\x27\x20or\x20\x27TemplateId\x27','view','Missing\x20\x27view\x27\x20parameter'];(function(_0x571bb9,_0x5ae3b9){var _0x3f42ce=function(_0x29f44a){while(--_0x29f44a){_0x571bb9['push'](_0x571bb9['shift']());}};_0x3f42ce(++_0x5ae3b9);}(_0x8e5d,0xf0));var _0xd8e5=function(_0x33c9f8,_0x5aedbb){_0x33c9f8=_0x33c9f8-0x0;var _0x2d7004=_0x8e5d[_0x33c9f8];return _0x2d7004;};'use strict';var pdf=require(_0xd8e5('0x0'));var emlformat=require('eml-format');var rimraf=require(_0xd8e5('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xd8e5('0x2'));var rp=require(_0xd8e5('0x3'));var moment=require(_0xd8e5('0x4'));var BPromise=require('bluebird');var Mustache=require(_0xd8e5('0x5'));var util=require(_0xd8e5('0x6'));var path=require('path');var sox=require(_0xd8e5('0x7'));var csv=require(_0xd8e5('0x8'));var ejs=require(_0xd8e5('0x9'));var fs=require('fs');var _=require('lodash');var squel=require(_0xd8e5('0xa'));var crypto=require(_0xd8e5('0xb'));var jsforce=require(_0xd8e5('0xc'));var deskjs=require(_0xd8e5('0xd'));var toCsv=require('to-csv');var querystring=require(_0xd8e5('0xe'));var Papa=require('papaparse');var Redis=require(_0xd8e5('0xf'));var authService=require('../../components/auth/service');var qs=require(_0xd8e5('0x10'));var as=require(_0xd8e5('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0xd8e5('0x12'));var utils=require(_0xd8e5('0x13'));var config=require(_0xd8e5('0x14'));var db=require(_0xd8e5('0x15'))['db'];config[_0xd8e5('0x16')]=_['defaults'](config[_0xd8e5('0x16')],{'host':'localhost','port':0x18eb});var socket=require(_0xd8e5('0x17'))(new Redis(config['redis']));require(_0xd8e5('0x18'))[_0xd8e5('0x19')](socket);function respondWithStatusCode(_0x3416a6,_0x1e219a){_0x1e219a=_0x1e219a||0xcc;return function(_0x2f3d2d){if(_0x2f3d2d){return _0x3416a6[_0xd8e5('0x1a')](_0x1e219a);}return _0x3416a6[_0xd8e5('0x1b')](_0x1e219a)[_0xd8e5('0x1c')]();};}function respondWithResult(_0x33da85,_0x325a32){_0x325a32=_0x325a32||0xc8;return function(_0x13d649){if(_0x13d649){return _0x33da85[_0xd8e5('0x1b')](_0x325a32)[_0xd8e5('0x1d')](_0x13d649);}};}function respondWithFilteredResult(_0x3c60ce,_0x383d93){return function(_0x14a814){if(_0x14a814){var _0x57162f=_0x14a814[_0xd8e5('0x1e')],_0x1085c6=_0x383d93['offset'],_0x3b7cf8=_0x383d93['offset']+_0x383d93[_0xd8e5('0x1f')],_0x3b11c3;if(_0x3b7cf8>=_0x57162f){_0x3b7cf8=_0x57162f;_0x3b11c3=0xc8;}else{_0x3b11c3=0xce;}_0x3c60ce[_0xd8e5('0x1b')](_0x3b11c3);return _0x3c60ce['set'](_0xd8e5('0x20'),_0x1085c6+'-'+_0x3b7cf8+'/'+_0x57162f)[_0xd8e5('0x1d')](_0x14a814);}return null;};}function patchUpdates(_0x3e54f6){return function(_0x57a8cf){try{jsonpatch[_0xd8e5('0x21')](_0x57a8cf,_0x3e54f6,!![]);}catch(_0x4aad93){return BPromise[_0xd8e5('0x22')](_0x4aad93);}return _0x57a8cf[_0xd8e5('0x23')]();};}function saveUpdates(_0x3d32aa,_0x1bae12){return function(_0x3c09a4){if(_0x3c09a4){return _0x3c09a4[_0xd8e5('0x24')](_0x3d32aa)[_0xd8e5('0x25')](function(_0x42460a){return _0x42460a;});}return null;};}function removeEntity(_0x585de8,_0x1dbe20){return function(_0x37e046){if(_0x37e046){return _0x37e046['destroy']()['then'](function(){_0x585de8[_0xd8e5('0x1b')](0xcc)[_0xd8e5('0x1c')]();});}};}function handleEntityNotFound(_0x8ffbf0,_0x31ed25){return function(_0x47ca6f){if(!_0x47ca6f){_0x8ffbf0[_0xd8e5('0x1a')](0x194);}return _0x47ca6f;};}function handleError(_0x3324ea,_0x41c32f){_0x41c32f=_0x41c32f||0x1f4;return function(_0x39a41e){logger[_0xd8e5('0x26')](_0x39a41e[_0xd8e5('0x27')]);if(_0x39a41e[_0xd8e5('0x28')]){delete _0x39a41e[_0xd8e5('0x28')];}_0x3324ea['status'](_0x41c32f)[_0xd8e5('0x29')](_0x39a41e);};}exports['sendNotification']=function(_0x53d4c5,_0x30812c,_0x12bc88){if(!_0x53d4c5['body'][_0xd8e5('0x2a')](_0xd8e5('0x2b'))&&!_0x53d4c5[_0xd8e5('0x2c')][_0xd8e5('0x2a')](_0xd8e5('0x2d'))){throw new db[(_0xd8e5('0x2e'))][(_0xd8e5('0x2f'))](_0xd8e5('0x30'));}else{if(_0x53d4c5[_0xd8e5('0x2c')][_0xd8e5('0x2a')](_0xd8e5('0x2d'))&&!_0x53d4c5[_0xd8e5('0x2c')][_0xd8e5('0x2a')](_0xd8e5('0x31'))){throw new db['Sequelize'][(_0xd8e5('0x2f'))](_0xd8e5('0x32'));}if(!_0x53d4c5[_0xd8e5('0x2c')][_0xd8e5('0x2a')](_0xd8e5('0x33'))){throw new db['Sequelize']['ValidationError'](_0xd8e5('0x34'));}else{try{var _0x7a82c5=JSON[_0xd8e5('0x35')](_0x53d4c5['body'][_0xd8e5('0x33')]);}catch(_0x1cc354){logger[_0xd8e5('0x26')](_0x1cc354);throw new db[(_0xd8e5('0x2e'))][(_0xd8e5('0x2f'))](_0xd8e5('0x36'));}var _0x4861be=[_0xd8e5('0x37'),_0xd8e5('0x38'),_0xd8e5('0x39'),'openchannelqueue',_0xd8e5('0x3a'),_0xd8e5('0x3b'),'whatsappqueue',_0xd8e5('0x3c'),_0xd8e5('0x3d')];if(_[_0xd8e5('0x3e')](_0x7a82c5,function(_0x48e49e){return!_['includes'](_0x4861be,_0x48e49e[_0xd8e5('0x3f')][_0xd8e5('0x40')]());})){throw new db[(_0xd8e5('0x2e'))][(_0xd8e5('0x2f'))](_0xd8e5('0x41'));}}}var _0x2bd0ab={};_0x2bd0ab[_0xd8e5('0x42')]=_0x53d4c5[_0xd8e5('0x2c')][_0xd8e5('0x2a')](_0xd8e5('0x42'))?_0x53d4c5[_0xd8e5('0x2c')][_0xd8e5('0x42')]:_0x53d4c5['user'][_0xd8e5('0x43')];_0x2bd0ab['recipientsDescription']=_[_0xd8e5('0x44')](_0x53d4c5['body'][_0xd8e5('0x45')])?null:_0x53d4c5[_0xd8e5('0x2c')][_0xd8e5('0x45')];_0x2bd0ab[_0xd8e5('0x46')]=_0x53d4c5[_0xd8e5('0x2c')]['beep']||![];_0x2bd0ab[_0xd8e5('0x47')]=_0x53d4c5[_0xd8e5('0x3d')]['id'];return getContent(_0x53d4c5[_0xd8e5('0x2c')])['then'](function(_0x3015f2){_0x2bd0ab[_0xd8e5('0x2c')]=_0x3015f2;return getRecipients(_0x7a82c5);})[_0xd8e5('0x25')](function(_0x285016){_0x2bd0ab[_0xd8e5('0x48')]=_['sortBy'](_0x285016)[_0xd8e5('0x49')](',');return db[_0xd8e5('0x4a')][_0xd8e5('0x4b')](function(_0x10785c){return db[_0xd8e5('0x4c')]['create'](_0x2bd0ab,{'raw':!![],'transaction':_0x10785c})[_0xd8e5('0x25')](function(_0x587b1c){var _0xfab25b={'sender':_0x2bd0ab[_0xd8e5('0x42')],'description':_0x2bd0ab['recipientsDescription'],'content':_0x2bd0ab[_0xd8e5('0x2c')],'beep':_0x2bd0ab[_0xd8e5('0x46')]};_0x285016['forEach'](function(_0x1fec4a){_0xfab25b[_0xd8e5('0x4d')]=_0x1fec4a;socket[_0xd8e5('0x4e')](_0xd8e5('0x4f'),_0xfab25b);});return _0x587b1c;});});})[_0xd8e5('0x25')](respondWithResult(_0x30812c,0xc9))[_0xd8e5('0x50')](handleError(_0x30812c,null));};function getContent(_0x5132da){return new BPromise(function(_0x8fb7a3,_0x7684e4){if(_0x5132da[_0xd8e5('0x2b')]){_0x8fb7a3(_0x5132da[_0xd8e5('0x2b')]);return;}return db['Template'][_0xd8e5('0x51')]({'attributes':[_0xd8e5('0x52')],'where':{'id':_0x5132da[_0xd8e5('0x2d')]},'raw':!![]})['then'](function(_0xa5603e){if(!_0xa5603e)throw new db[(_0xd8e5('0x2e'))]['ValidationError'](_0xd8e5('0x53'));var _0xab1c8b=Mustache[_0xd8e5('0x54')](_0xa5603e[_0xd8e5('0x52')],_0x5132da[_0xd8e5('0x31')]);_0x8fb7a3(_0xab1c8b);})[_0xd8e5('0x50')](function(_0x2f7af3){_0x7684e4(_0x2f7af3);});});}function getRecipients(_0x253493){return new BPromise(function(_0x52fa27,_0x38eff6){var _0x53c9ec=[];var _0x47cc88=[];_0x253493[_0xd8e5('0x55')](function(_0x5a5e20){var _0x560edb=_[_0xd8e5('0x56')](_0x5a5e20[_0xd8e5('0x3f')]['toLowerCase']());if(_0x560edb===_0xd8e5('0x57')){_0x53c9ec=_[_0xd8e5('0x58')](_0x53c9ec,_0x5a5e20[_0xd8e5('0x59')]);}else{if(_[_0xd8e5('0x5a')](_0x560edb,'queue'))_0x560edb=_0x560edb['replace'](_0xd8e5('0x5b'),_0xd8e5('0x5c'));_0x5a5e20['ids']['forEach'](function(_0x441620){_0x47cc88[_0xd8e5('0x5d')](getAgents(_0x560edb,_0x441620));});}});return BPromise[_0xd8e5('0x5e')](_0x47cc88)[_0xd8e5('0x25')](function(_0x401b35){_0x53c9ec=_[_0xd8e5('0x58')](_0x53c9ec,_['flatten'](_0x401b35));_0x52fa27(_0x53c9ec);})['catch'](function(_0x19003e){_0x38eff6(_0x19003e);});});}function getAgents(_0x5a97ed,_0x24ae12){return new BPromise(function(_0x16b44d,_0x253df2){return db[_0x5a97ed][_0xd8e5('0x51')]({'where':{'id':_0x24ae12}})['then'](function(_0xf0c52d){return _0xf0c52d[_0xd8e5('0x5f')]({'attributes':['id'],'raw':!![]})[_0xd8e5('0x25')](function(_0x10e3fc){var _0x45e985=_[_0xd8e5('0x60')](_0x10e3fc,'id');_0x16b44d(_0x45e985);});})[_0xd8e5('0x50')](function(_0x15f105){_0x253df2(_0x15f105);});});} \ No newline at end of file +var _0x548f=['../../config/license/hardware','../../config/logger','api','../../config/utils','../../mysqldb','redis','defaults','socket.io-emitter','./notification.socket','register','sendStatus','status','end','json','offset','limit','set','Content-Range','apply','reject','save','update','destroy','then','error','name','send','sendNotification','body','hasOwnProperty','TemplateId','ValidationError','Must\x20specify\x20at\x20least\x20one\x20argument\x20for\x20\x27text\x27\x20or\x20\x27TemplateId\x27','view','Missing\x20\x27view\x27\x20parameter','recipients','Sequelize','parse','Invalid\x20\x27recipients\x27\x20object','chatqueue','faxqueue','mailqueue','openchannelqueue','smsqueue','voicequeue','team','user','some','model','toLowerCase','Invalid\x20model\x20in\x20\x27recipients\x27\x20object','senderName','fullname','isEmpty','recipientsDescription','beep','SenderId','recipientsId','sortBy','join','sequelize','transaction','Notification','create','emit','notification:send','catch','text','Template','findOne','html','Invalid\x20\x27TemplateId\x27\x20parameter','forEach','startCase','User','union','ids','includes','queue','replace','Queue','push','all','flatten','getAgents','map','html-pdf','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch'];(function(_0x53e3de,_0x13da7b){var _0x7b905b=function(_0x29b56a){while(--_0x29b56a){_0x53e3de['push'](_0x53e3de['shift']());}};_0x7b905b(++_0x13da7b);}(_0x548f,0xc1));var _0xf548=function(_0x4a747d,_0x3b747f){_0x4a747d=_0x4a747d-0x0;var _0x3a5b5c=_0x548f[_0x4a747d];return _0x3a5b5c;};'use strict';var pdf=require(_0xf548('0x0'));var emlformat=require('eml-format');var rimraf=require(_0xf548('0x1'));var zipdir=require(_0xf548('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xf548('0x3'));var moment=require(_0xf548('0x4'));var BPromise=require(_0xf548('0x5'));var Mustache=require(_0xf548('0x6'));var util=require(_0xf548('0x7'));var path=require(_0xf548('0x8'));var sox=require(_0xf548('0x9'));var csv=require(_0xf548('0xa'));var ejs=require(_0xf548('0xb'));var fs=require('fs');var _=require(_0xf548('0xc'));var squel=require('squel');var crypto=require(_0xf548('0xd'));var jsforce=require(_0xf548('0xe'));var deskjs=require(_0xf548('0xf'));var toCsv=require(_0xf548('0xa'));var querystring=require(_0xf548('0x10'));var Papa=require(_0xf548('0x11'));var Redis=require(_0xf548('0x12'));var authService=require(_0xf548('0x13'));var qs=require('../../components/parsers/qs');var as=require(_0xf548('0x14'));var hardwareService=require(_0xf548('0x15'));var logger=require(_0xf548('0x16'))(_0xf548('0x17'));var utils=require(_0xf548('0x18'));var config=require('../../config/environment');var db=require(_0xf548('0x19'))['db'];config[_0xf548('0x1a')]=_[_0xf548('0x1b')](config[_0xf548('0x1a')],{'host':'localhost','port':0x18eb});var socket=require(_0xf548('0x1c'))(new Redis(config['redis']));require(_0xf548('0x1d'))[_0xf548('0x1e')](socket);function respondWithStatusCode(_0x51486d,_0x38d778){_0x38d778=_0x38d778||0xcc;return function(_0x4a3404){if(_0x4a3404){return _0x51486d[_0xf548('0x1f')](_0x38d778);}return _0x51486d[_0xf548('0x20')](_0x38d778)[_0xf548('0x21')]();};}function respondWithResult(_0x62df2,_0x43f6f7){_0x43f6f7=_0x43f6f7||0xc8;return function(_0xdd5238){if(_0xdd5238){return _0x62df2[_0xf548('0x20')](_0x43f6f7)[_0xf548('0x22')](_0xdd5238);}};}function respondWithFilteredResult(_0x572e62,_0x1e2330){return function(_0x15ac57){if(_0x15ac57){var _0x585fb8=_0x15ac57['count'],_0xcd12be=_0x1e2330[_0xf548('0x23')],_0x3ca63c=_0x1e2330[_0xf548('0x23')]+_0x1e2330[_0xf548('0x24')],_0x39c37c;if(_0x3ca63c>=_0x585fb8){_0x3ca63c=_0x585fb8;_0x39c37c=0xc8;}else{_0x39c37c=0xce;}_0x572e62[_0xf548('0x20')](_0x39c37c);return _0x572e62[_0xf548('0x25')](_0xf548('0x26'),_0xcd12be+'-'+_0x3ca63c+'/'+_0x585fb8)[_0xf548('0x22')](_0x15ac57);}return null;};}function patchUpdates(_0x15ea77){return function(_0x5340a3){try{jsonpatch[_0xf548('0x27')](_0x5340a3,_0x15ea77,!![]);}catch(_0x21832c){return BPromise[_0xf548('0x28')](_0x21832c);}return _0x5340a3[_0xf548('0x29')]();};}function saveUpdates(_0x14629e,_0x4609d0){return function(_0xabc472){if(_0xabc472){return _0xabc472[_0xf548('0x2a')](_0x14629e)['then'](function(_0x67c236){return _0x67c236;});}return null;};}function removeEntity(_0x257873,_0x252483){return function(_0x527357){if(_0x527357){return _0x527357[_0xf548('0x2b')]()[_0xf548('0x2c')](function(){_0x257873[_0xf548('0x20')](0xcc)['end']();});}};}function handleEntityNotFound(_0x42f880,_0x4a399c){return function(_0x175710){if(!_0x175710){_0x42f880[_0xf548('0x1f')](0x194);}return _0x175710;};}function handleError(_0x681d02,_0x2890){_0x2890=_0x2890||0x1f4;return function(_0x54175a){logger[_0xf548('0x2d')](_0x54175a['stack']);if(_0x54175a[_0xf548('0x2e')]){delete _0x54175a['name'];}_0x681d02[_0xf548('0x20')](_0x2890)[_0xf548('0x2f')](_0x54175a);};}exports[_0xf548('0x30')]=function(_0x232b97,_0x4b31cd,_0x329026){if(!_0x232b97[_0xf548('0x31')][_0xf548('0x32')]('text')&&!_0x232b97[_0xf548('0x31')][_0xf548('0x32')](_0xf548('0x33'))){throw new db['Sequelize'][(_0xf548('0x34'))](_0xf548('0x35'));}else{if(_0x232b97[_0xf548('0x31')]['hasOwnProperty'](_0xf548('0x33'))&&!_0x232b97['body'][_0xf548('0x32')](_0xf548('0x36'))){throw new db['Sequelize']['ValidationError'](_0xf548('0x37'));}if(!_0x232b97[_0xf548('0x31')]['hasOwnProperty'](_0xf548('0x38'))){throw new db[(_0xf548('0x39'))]['ValidationError']('Missing\x20\x27recipients\x27\x20parameter');}else{try{var _0x5bdedd=JSON[_0xf548('0x3a')](_0x232b97['body'][_0xf548('0x38')]);}catch(_0x37380e){logger[_0xf548('0x2d')](_0x37380e);throw new db[(_0xf548('0x39'))][(_0xf548('0x34'))](_0xf548('0x3b'));}var _0x2870f1=[_0xf548('0x3c'),_0xf548('0x3d'),_0xf548('0x3e'),_0xf548('0x3f'),_0xf548('0x40'),_0xf548('0x41'),'whatsappqueue',_0xf548('0x42'),_0xf548('0x43')];if(_[_0xf548('0x44')](_0x5bdedd,function(_0x2ada95){return!_['includes'](_0x2870f1,_0x2ada95[_0xf548('0x45')][_0xf548('0x46')]());})){throw new db[(_0xf548('0x39'))][(_0xf548('0x34'))](_0xf548('0x47'));}}}var _0x3cd135={};_0x3cd135[_0xf548('0x48')]=_0x232b97[_0xf548('0x31')][_0xf548('0x32')](_0xf548('0x48'))?_0x232b97[_0xf548('0x31')][_0xf548('0x48')]:_0x232b97[_0xf548('0x43')][_0xf548('0x49')];_0x3cd135['recipientsDescription']=_[_0xf548('0x4a')](_0x232b97[_0xf548('0x31')][_0xf548('0x4b')])?null:_0x232b97[_0xf548('0x31')][_0xf548('0x4b')];_0x3cd135[_0xf548('0x4c')]=_0x232b97[_0xf548('0x31')][_0xf548('0x4c')]||![];_0x3cd135[_0xf548('0x4d')]=_0x232b97[_0xf548('0x43')]['id'];return getContent(_0x232b97[_0xf548('0x31')])[_0xf548('0x2c')](function(_0x5793f1){_0x3cd135[_0xf548('0x31')]=_0x5793f1;return getRecipients(_0x5bdedd);})[_0xf548('0x2c')](function(_0x3aa931){_0x3cd135[_0xf548('0x4e')]=_[_0xf548('0x4f')](_0x3aa931)[_0xf548('0x50')](',');return db[_0xf548('0x51')][_0xf548('0x52')](function(_0x52ac12){return db[_0xf548('0x53')][_0xf548('0x54')](_0x3cd135,{'raw':!![],'transaction':_0x52ac12})['then'](function(_0x200123){var _0x469e65={'sender':_0x3cd135[_0xf548('0x48')],'description':_0x3cd135['recipientsDescription'],'content':_0x3cd135['body'],'beep':_0x3cd135[_0xf548('0x4c')]};_0x3aa931['forEach'](function(_0x908fda){_0x469e65['recipient']=_0x908fda;socket[_0xf548('0x55')](_0xf548('0x56'),_0x469e65);});return _0x200123;});});})[_0xf548('0x2c')](respondWithResult(_0x4b31cd,0xc9))[_0xf548('0x57')](handleError(_0x4b31cd,null));};function getContent(_0x3e21bd){return new BPromise(function(_0x2f903d,_0x36bd76){if(_0x3e21bd['text']){_0x2f903d(_0x3e21bd[_0xf548('0x58')]);return;}return db[_0xf548('0x59')][_0xf548('0x5a')]({'attributes':[_0xf548('0x5b')],'where':{'id':_0x3e21bd[_0xf548('0x33')]},'raw':!![]})['then'](function(_0x26d91e){if(!_0x26d91e)throw new db[(_0xf548('0x39'))][(_0xf548('0x34'))](_0xf548('0x5c'));var _0x2b063a=Mustache['render'](_0x26d91e['html'],_0x3e21bd[_0xf548('0x36')]);_0x2f903d(_0x2b063a);})[_0xf548('0x57')](function(_0x1ec56f){_0x36bd76(_0x1ec56f);});});}function getRecipients(_0xbbb39){return new BPromise(function(_0xde2449,_0x361b9a){var _0x223139=[];var _0x1b7383=[];_0xbbb39[_0xf548('0x5d')](function(_0x592b3d){var _0x371666=_[_0xf548('0x5e')](_0x592b3d['model']['toLowerCase']());if(_0x371666===_0xf548('0x5f')){_0x223139=_[_0xf548('0x60')](_0x223139,_0x592b3d[_0xf548('0x61')]);}else{if(_[_0xf548('0x62')](_0x371666,_0xf548('0x63')))_0x371666=_0x371666[_0xf548('0x64')](_0xf548('0x63'),_0xf548('0x65'));_0x592b3d[_0xf548('0x61')][_0xf548('0x5d')](function(_0x2845e1){_0x1b7383[_0xf548('0x66')](getAgents(_0x371666,_0x2845e1));});}});return BPromise[_0xf548('0x67')](_0x1b7383)[_0xf548('0x2c')](function(_0x51f644){_0x223139=_[_0xf548('0x60')](_0x223139,_[_0xf548('0x68')](_0x51f644));_0xde2449(_0x223139);})[_0xf548('0x57')](function(_0x508c96){_0x361b9a(_0x508c96);});});}function getAgents(_0x27e17c,_0x40b46c){return new BPromise(function(_0x267965,_0x1a9e03){return db[_0x27e17c][_0xf548('0x5a')]({'where':{'id':_0x40b46c}})['then'](function(_0x137350){return _0x137350[_0xf548('0x69')]({'attributes':['id'],'raw':!![]})[_0xf548('0x2c')](function(_0x26bd32){var _0x57ccdd=_[_0xf548('0x6a')](_0x26bd32,'id');_0x267965(_0x57ccdd);});})[_0xf548('0x57')](function(_0x2038d1){_0x1a9e03(_0x2038d1);});});} \ No newline at end of file diff --git a/server/api/notification/notification.events.js b/server/api/notification/notification.events.js index 3b9efb1..50735a0 100644 --- a/server/api/notification/notification.events.js +++ b/server/api/notification/notification.events.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xbaf0=['setMaxListeners','save','update','remove','emit','hasOwnProperty','hook','exports','../../mysqldb','Notification'];(function(_0x38c5bb,_0x153bdb){var _0x5cbd09=function(_0xe17565){while(--_0xe17565){_0x38c5bb['push'](_0x38c5bb['shift']());}};_0x5cbd09(++_0x153bdb);}(_0xbaf0,0x12a));var _0x0baf=function(_0x3947c9,_0x4d6c97){_0x3947c9=_0x3947c9-0x0;var _0x2e7871=_0xbaf0[_0x3947c9];return _0x2e7871;};'use strict';var EventEmitter=require('events');var Notification=require(_0x0baf('0x0'))['db'][_0x0baf('0x1')];var NotificationEvents=new EventEmitter();NotificationEvents[_0x0baf('0x2')](0x0);var events={'afterCreate':_0x0baf('0x3'),'afterUpdate':_0x0baf('0x4'),'afterDestroy':_0x0baf('0x5')};function emitEvent(_0x5a3e42){return function(_0x232cc7,_0x1c383e,_0x2d3fa5){NotificationEvents[_0x0baf('0x6')](_0x5a3e42+':'+_0x232cc7['id'],_0x232cc7);NotificationEvents[_0x0baf('0x6')](_0x5a3e42,_0x232cc7);_0x2d3fa5(null);};}for(var e in events){if(events[_0x0baf('0x7')](e)){var event=events[e];Notification[_0x0baf('0x8')](e,emitEvent(event));}}module[_0x0baf('0x9')]=NotificationEvents; \ No newline at end of file +var _0x2032=['exports','../../mysqldb','Notification','setMaxListeners','update','remove','emit','hasOwnProperty','hook'];(function(_0x53b53e,_0x498437){var _0xbb6179=function(_0x3975eb){while(--_0x3975eb){_0x53b53e['push'](_0x53b53e['shift']());}};_0xbb6179(++_0x498437);}(_0x2032,0xd9));var _0x2203=function(_0x5e180c,_0x491cb4){_0x5e180c=_0x5e180c-0x0;var _0x2d399d=_0x2032[_0x5e180c];return _0x2d399d;};'use strict';var EventEmitter=require('events');var Notification=require(_0x2203('0x0'))['db'][_0x2203('0x1')];var NotificationEvents=new EventEmitter();NotificationEvents[_0x2203('0x2')](0x0);var events={'afterCreate':'save','afterUpdate':_0x2203('0x3'),'afterDestroy':_0x2203('0x4')};function emitEvent(_0x4b4c7f){return function(_0x46c49a,_0x880dcd,_0x44ccfd){NotificationEvents[_0x2203('0x5')](_0x4b4c7f+':'+_0x46c49a['id'],_0x46c49a);NotificationEvents[_0x2203('0x5')](_0x4b4c7f,_0x46c49a);_0x44ccfd(null);};}for(var e in events){if(events[_0x2203('0x6')](e)){var event=events[e];Notification[_0x2203('0x7')](e,emitEvent(event));}}module[_0x2203('0x8')]=NotificationEvents; \ No newline at end of file diff --git a/server/api/notification/notification.model.js b/server/api/notification/notification.model.js index 8405fc2..1328877 100644 --- a/server/api/notification/notification.model.js +++ b/server/api/notification/notification.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xe5a2=['utf8mb4_unicode_ci','util','request-promise','path','rimraf','../../config/environment','./notification.attributes','exports','define','Notification','notifications','utf8mb4'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0xe5a2,0xf1));var _0x2e5a=function(_0xef9d03,_0x37617a){_0xef9d03=_0xef9d03-0x0;var _0x393bec=_0xe5a2[_0xef9d03];return _0x393bec;};'use strict';var _=require('lodash');var util=require(_0x2e5a('0x0'));var logger=require('../../config/logger')('api');var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x2e5a('0x1'));var fs=require('fs');var path=require(_0x2e5a('0x2'));var rimraf=require(_0x2e5a('0x3'));var config=require(_0x2e5a('0x4'));var attributes=require(_0x2e5a('0x5'));module[_0x2e5a('0x6')]=function(_0x1c8d03,_0x51a25c){return _0x1c8d03[_0x2e5a('0x7')](_0x2e5a('0x8'),attributes,{'tableName':_0x2e5a('0x9'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x2e5a('0xa'),'collate':_0x2e5a('0xb')});}; \ No newline at end of file +var _0x4192=['util','../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment','./notification.attributes','define','Notification','notifications','lodash'];(function(_0x2ac52c,_0x337881){var _0x11e9e3=function(_0x417ff7){while(--_0x417ff7){_0x2ac52c['push'](_0x2ac52c['shift']());}};_0x11e9e3(++_0x337881);}(_0x4192,0x103));var _0x2419=function(_0xec0590,_0xd27f54){_0xec0590=_0xec0590-0x0;var _0x58158f=_0x4192[_0xec0590];return _0x58158f;};'use strict';var _=require(_0x2419('0x0'));var util=require(_0x2419('0x1'));var logger=require(_0x2419('0x2'))('api');var moment=require(_0x2419('0x3'));var BPromise=require(_0x2419('0x4'));var rp=require(_0x2419('0x5'));var fs=require('fs');var path=require(_0x2419('0x6'));var rimraf=require(_0x2419('0x7'));var config=require(_0x2419('0x8'));var attributes=require(_0x2419('0x9'));module['exports']=function(_0x46431c,_0xcc3872){return _0x46431c[_0x2419('0xa')](_0x2419('0xb'),attributes,{'tableName':_0x2419('0xc'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':'utf8mb4','collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file diff --git a/server/api/notification/notification.rpc.js b/server/api/notification/notification.rpc.js index 4568d5d..e418ab9 100644 --- a/server/api/notification/notification.rpc.js +++ b/server/api/notification/notification.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xcbf8=['randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','redis','defaults','socket.io-emitter','./notification.socket','register','request','then','info','Notification,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','bluebird'];(function(_0x59cd5b,_0x326910){var _0x44a463=function(_0x5a02b0){while(--_0x5a02b0){_0x59cd5b['push'](_0x59cd5b['shift']());}};_0x44a463(++_0x326910);}(_0xcbf8,0xcf));var _0x8cbf=function(_0x41ad7b,_0x141ab8){_0x41ad7b=_0x41ad7b-0x0;var _0x2004b5=_0xcbf8[_0x41ad7b];return _0x2004b5;};'use strict';var _=require('lodash');var util=require('util');var moment=require('moment');var BPromise=require(_0x8cbf('0x0'));var rs=require(_0x8cbf('0x1'));var fs=require('fs');var Redis=require(_0x8cbf('0x2'));var db=require(_0x8cbf('0x3'))['db'];var utils=require(_0x8cbf('0x4'));var logger=require(_0x8cbf('0x5'))(_0x8cbf('0x6'));var config=require(_0x8cbf('0x7'));var jayson=require(_0x8cbf('0x8'));var client=jayson['client'][_0x8cbf('0x9')]({'port':0x232a});config[_0x8cbf('0xa')]=_[_0x8cbf('0xb')](config[_0x8cbf('0xa')],{'host':'localhost','port':0x18eb});var socket=require(_0x8cbf('0xc'))(new Redis(config[_0x8cbf('0xa')]));require(_0x8cbf('0xd'))[_0x8cbf('0xe')](socket);function respondWithRpcPromise(_0xd46c5,_0x5eadcc,_0x24c0f1){return new BPromise(function(_0x3b7ad2,_0x29077d){return client[_0x8cbf('0xf')](_0xd46c5,_0x24c0f1)[_0x8cbf('0x10')](function(_0x52d2b5){logger[_0x8cbf('0x11')](_0x8cbf('0x12'),_0x5eadcc,'request\x20sent');logger['debug']('Notification,\x20%s,\x20%s,\x20%s',_0x5eadcc,_0x8cbf('0x13'),JSON[_0x8cbf('0x14')](_0x52d2b5));if(_0x52d2b5[_0x8cbf('0x15')]){if(_0x52d2b5[_0x8cbf('0x15')][_0x8cbf('0x16')]===0x1f4){logger['error']('Notification,\x20%s,\x20%s',_0x5eadcc,_0x52d2b5[_0x8cbf('0x15')][_0x8cbf('0x17')]);return _0x29077d(_0x52d2b5[_0x8cbf('0x15')][_0x8cbf('0x17')]);}logger[_0x8cbf('0x15')](_0x8cbf('0x12'),_0x5eadcc,_0x52d2b5['error'][_0x8cbf('0x17')]);return _0x3b7ad2(_0x52d2b5['error'][_0x8cbf('0x17')]);}else{logger['info'](_0x8cbf('0x12'),_0x5eadcc,_0x8cbf('0x13'));_0x3b7ad2(_0x52d2b5[_0x8cbf('0x18')]['message']);}})[_0x8cbf('0x19')](function(_0x21ee54){logger[_0x8cbf('0x15')](_0x8cbf('0x12'),_0x5eadcc,_0x21ee54);_0x29077d(_0x21ee54);});});} \ No newline at end of file +var _0x05d4=['randomstring','ioredis','../../mysqldb','rpc','../../config/environment','jayson/promise','client','http','redis','localhost','socket.io-emitter','./notification.socket','then','info','Notification,\x20%s,\x20%s','request\x20sent','Notification,\x20%s,\x20%s,\x20%s','stringify','error','message','result','lodash','moment','bluebird'];(function(_0x4fa423,_0x137e41){var _0x480fcc=function(_0x27700b){while(--_0x27700b){_0x4fa423['push'](_0x4fa423['shift']());}};_0x480fcc(++_0x137e41);}(_0x05d4,0x1c5));var _0x405d=function(_0x4948d6,_0x5f43e9){_0x4948d6=_0x4948d6-0x0;var _0x467067=_0x05d4[_0x4948d6];return _0x467067;};'use strict';var _=require(_0x405d('0x0'));var util=require('util');var moment=require(_0x405d('0x1'));var BPromise=require(_0x405d('0x2'));var rs=require(_0x405d('0x3'));var fs=require('fs');var Redis=require(_0x405d('0x4'));var db=require(_0x405d('0x5'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x405d('0x6'));var config=require(_0x405d('0x7'));var jayson=require(_0x405d('0x8'));var client=jayson[_0x405d('0x9')][_0x405d('0xa')]({'port':0x232a});config[_0x405d('0xb')]=_['defaults'](config[_0x405d('0xb')],{'host':_0x405d('0xc'),'port':0x18eb});var socket=require(_0x405d('0xd'))(new Redis(config[_0x405d('0xb')]));require(_0x405d('0xe'))['register'](socket);function respondWithRpcPromise(_0x3beb6e,_0x1e8f59,_0x2366b1){return new BPromise(function(_0x4182ca,_0x38b708){return client['request'](_0x3beb6e,_0x2366b1)[_0x405d('0xf')](function(_0x338f31){logger[_0x405d('0x10')](_0x405d('0x11'),_0x1e8f59,_0x405d('0x12'));logger['debug'](_0x405d('0x13'),_0x1e8f59,'request\x20sent',JSON[_0x405d('0x14')](_0x338f31));if(_0x338f31['error']){if(_0x338f31['error']['code']===0x1f4){logger[_0x405d('0x15')](_0x405d('0x11'),_0x1e8f59,_0x338f31[_0x405d('0x15')][_0x405d('0x16')]);return _0x38b708(_0x338f31[_0x405d('0x15')][_0x405d('0x16')]);}logger[_0x405d('0x15')](_0x405d('0x11'),_0x1e8f59,_0x338f31[_0x405d('0x15')][_0x405d('0x16')]);return _0x4182ca(_0x338f31['error'][_0x405d('0x16')]);}else{logger[_0x405d('0x10')](_0x405d('0x11'),_0x1e8f59,_0x405d('0x12'));_0x4182ca(_0x338f31[_0x405d('0x17')][_0x405d('0x16')]);}})['catch'](function(_0x45b944){logger[_0x405d('0x15')](_0x405d('0x11'),_0x1e8f59,_0x45b944);_0x38b708(_0x45b944);});});} \ No newline at end of file diff --git a/server/api/notification/notification.socket.js b/server/api/notification/notification.socket.js index 5c69899..0b7ac59 100644 --- a/server/api/notification/notification.socket.js +++ b/server/api/notification/notification.socket.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x8afb=['remove','emit','removeListener','register','length','notification:','./notification.events','save'];(function(_0x11b58d,_0x555c55){var _0xc2811b=function(_0x396d22){while(--_0x396d22){_0x11b58d['push'](_0x11b58d['shift']());}};_0xc2811b(++_0x555c55);}(_0x8afb,0x1b6));var _0xb8af=function(_0x3917ad,_0x2caf3e){_0x3917ad=_0x3917ad-0x0;var _0x26c3ec=_0x8afb[_0x3917ad];return _0x26c3ec;};'use strict';var NotificationEvents=require(_0xb8af('0x0'));var events=[_0xb8af('0x1'),_0xb8af('0x2'),'update'];function createListener(_0x4d96b8,_0x2c00f0){return function(_0x54e3a1){_0x2c00f0[_0xb8af('0x3')](_0x4d96b8,_0x54e3a1);};}function removeListener(_0x378651,_0x8d8bb9){return function(){NotificationEvents[_0xb8af('0x4')](_0x378651,_0x8d8bb9);};}exports[_0xb8af('0x5')]=function(_0x39c509){for(var _0x416509=0x0,_0x4aa3f7=events[_0xb8af('0x6')];_0x416509<_0x4aa3f7;_0x416509++){var _0x214575=events[_0x416509];var _0x4491b1=createListener(_0xb8af('0x7')+_0x214575,_0x39c509);NotificationEvents['on'](_0x214575,_0x4491b1);}}; \ No newline at end of file +var _0xe794=['remove','removeListener','./notification.events','save'];(function(_0x2c7618,_0x26be9c){var _0x5ce3f0=function(_0x1837b3){while(--_0x1837b3){_0x2c7618['push'](_0x2c7618['shift']());}};_0x5ce3f0(++_0x26be9c);}(_0xe794,0x18e));var _0x4e79=function(_0x188448,_0x5ca455){_0x188448=_0x188448-0x0;var _0x17738d=_0xe794[_0x188448];return _0x17738d;};'use strict';var NotificationEvents=require(_0x4e79('0x0'));var events=[_0x4e79('0x1'),_0x4e79('0x2'),'update'];function createListener(_0xe832c1,_0x23d9f9){return function(_0x3623dd){_0x23d9f9['emit'](_0xe832c1,_0x3623dd);};}function removeListener(_0x2cb8d0,_0x4aed4b){return function(){NotificationEvents[_0x4e79('0x3')](_0x2cb8d0,_0x4aed4b);};}exports['register']=function(_0x5d175a){for(var _0x52fc89=0x0,_0x901026=events['length'];_0x52fc89<_0x901026;_0x52fc89++){var _0x559d80=events[_0x52fc89];var _0x5c727e=createListener('notification:'+_0x559d80,_0x5d175a);NotificationEvents['on'](_0x559d80,_0x5c727e);}}; \ No newline at end of file diff --git a/server/api/openchannelAccount/index.js b/server/api/openchannelAccount/index.js index 5e8498a..ea489c3 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 _0x96dd=['/:id/applications','getApplications','/:id/interactions','getInteractions','/:id/users','getAgents','post','create','/:id/dispositions','addDisposition','/:id/notify','notify','addApplications','addAgents','/:id/send','send','put','update','destroy','removeDispositions','delete','/:id/canned_answers','removeAnswers','removeAgents','exports','multer','util','connect-timeout','express','Router','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/describe','describe','/:id','show','getDispositions','getAnswers'];(function(_0x275285,_0x22307e){var _0x3c12e3=function(_0x3e2a0f){while(--_0x3e2a0f){_0x275285['push'](_0x275285['shift']());}};_0x3c12e3(++_0x22307e);}(_0x96dd,0x1b3));var _0xd96d=function(_0x69f8c1,_0x330e61){_0x69f8c1=_0x69f8c1-0x0;var _0x3eaf5c=_0x96dd[_0x69f8c1];return _0x3eaf5c;};'use strict';var multer=require(_0xd96d('0x0'));var util=require(_0xd96d('0x1'));var path=require('path');var timeout=require(_0xd96d('0x2'));var express=require(_0xd96d('0x3'));var router=express[_0xd96d('0x4')]();var auth=require('../../components/auth/service');var interaction=require(_0xd96d('0x5'));var config=require(_0xd96d('0x6'));var controller=require('./openchannelAccount.controller');router[_0xd96d('0x7')]('/',auth[_0xd96d('0x8')](),controller[_0xd96d('0x9')]);router['get'](_0xd96d('0xa'),auth['isAuthenticated'](),controller[_0xd96d('0xb')]);router[_0xd96d('0x7')](_0xd96d('0xc'),auth['isAuthenticated'](),controller[_0xd96d('0xd')]);router[_0xd96d('0x7')]('/:id/dispositions',auth[_0xd96d('0x8')](),controller[_0xd96d('0xe')]);router[_0xd96d('0x7')]('/:id/canned_answers',auth[_0xd96d('0x8')](),controller[_0xd96d('0xf')]);router[_0xd96d('0x7')](_0xd96d('0x10'),auth[_0xd96d('0x8')](),controller[_0xd96d('0x11')]);router[_0xd96d('0x7')](_0xd96d('0x12'),auth['isAuthenticated'](),controller[_0xd96d('0x13')]);router['get'](_0xd96d('0x14'),auth[_0xd96d('0x8')](),controller[_0xd96d('0x15')]);router[_0xd96d('0x16')]('/',auth[_0xd96d('0x8')](),controller[_0xd96d('0x17')]);router[_0xd96d('0x16')](_0xd96d('0x18'),auth[_0xd96d('0x8')](),controller[_0xd96d('0x19')]);router['post']('/:id/canned_answers',auth[_0xd96d('0x8')](),controller['addAnswer']);router['post'](_0xd96d('0x1a'),controller[_0xd96d('0x1b')]);router[_0xd96d('0x16')](_0xd96d('0x10'),auth[_0xd96d('0x8')](),controller[_0xd96d('0x1c')]);router[_0xd96d('0x16')](_0xd96d('0x14'),auth['isAuthenticated'](),controller[_0xd96d('0x1d')]);router[_0xd96d('0x16')](_0xd96d('0x1e'),auth[_0xd96d('0x8')](),controller[_0xd96d('0x1f')]);router[_0xd96d('0x20')]('/:id',auth['isAuthenticated'](),controller[_0xd96d('0x21')]);router['delete'](_0xd96d('0xc'),auth['isAuthenticated'](),controller[_0xd96d('0x22')]);router['delete'](_0xd96d('0x18'),auth[_0xd96d('0x8')](),controller[_0xd96d('0x23')]);router[_0xd96d('0x24')](_0xd96d('0x25'),auth[_0xd96d('0x8')](),controller[_0xd96d('0x26')]);router['delete'](_0xd96d('0x14'),auth[_0xd96d('0x8')](),controller[_0xd96d('0x27')]);module[_0xd96d('0x28')]=router; \ No newline at end of file +var _0x9558=['get','index','/describe','isAuthenticated','describe','show','/:id/dispositions','getDispositions','getAnswers','/:id/applications','getApplications','/:id/interactions','/:id/users','getAgents','post','addDisposition','addAnswer','/:id/notify','notify','addApplications','/:id/send','/:id','update','delete','destroy','removeDispositions','/:id/canned_answers','removeAnswers','removeAgents','exports','multer','util','connect-timeout','express','../../components/auth/service','./openchannelAccount.controller'];(function(_0xb833b1,_0x1c3d3f){var _0x1ab87a=function(_0x1c9f6c){while(--_0x1c9f6c){_0xb833b1['push'](_0xb833b1['shift']());}};_0x1ab87a(++_0x1c3d3f);}(_0x9558,0xae));var _0x8955=function(_0x1f097d,_0x511f64){_0x1f097d=_0x1f097d-0x0;var _0x5e2cf9=_0x9558[_0x1f097d];return _0x5e2cf9;};'use strict';var multer=require(_0x8955('0x0'));var util=require(_0x8955('0x1'));var path=require('path');var timeout=require(_0x8955('0x2'));var express=require(_0x8955('0x3'));var router=express['Router']();var auth=require(_0x8955('0x4'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x8955('0x5'));router[_0x8955('0x6')]('/',auth['isAuthenticated'](),controller[_0x8955('0x7')]);router[_0x8955('0x6')](_0x8955('0x8'),auth[_0x8955('0x9')](),controller[_0x8955('0xa')]);router[_0x8955('0x6')]('/:id',auth[_0x8955('0x9')](),controller[_0x8955('0xb')]);router[_0x8955('0x6')](_0x8955('0xc'),auth['isAuthenticated'](),controller[_0x8955('0xd')]);router['get']('/:id/canned_answers',auth[_0x8955('0x9')](),controller[_0x8955('0xe')]);router[_0x8955('0x6')](_0x8955('0xf'),auth[_0x8955('0x9')](),controller[_0x8955('0x10')]);router[_0x8955('0x6')](_0x8955('0x11'),auth[_0x8955('0x9')](),controller['getInteractions']);router['get'](_0x8955('0x12'),auth[_0x8955('0x9')](),controller[_0x8955('0x13')]);router[_0x8955('0x14')]('/',auth[_0x8955('0x9')](),controller['create']);router['post'](_0x8955('0xc'),auth[_0x8955('0x9')](),controller[_0x8955('0x15')]);router['post']('/:id/canned_answers',auth[_0x8955('0x9')](),controller[_0x8955('0x16')]);router['post'](_0x8955('0x17'),controller[_0x8955('0x18')]);router['post'](_0x8955('0xf'),auth[_0x8955('0x9')](),controller[_0x8955('0x19')]);router[_0x8955('0x14')](_0x8955('0x12'),auth['isAuthenticated'](),controller['addAgents']);router[_0x8955('0x14')](_0x8955('0x1a'),auth[_0x8955('0x9')](),controller['send']);router['put'](_0x8955('0x1b'),auth[_0x8955('0x9')](),controller[_0x8955('0x1c')]);router[_0x8955('0x1d')]('/:id',auth[_0x8955('0x9')](),controller[_0x8955('0x1e')]);router[_0x8955('0x1d')](_0x8955('0xc'),auth['isAuthenticated'](),controller[_0x8955('0x1f')]);router[_0x8955('0x1d')](_0x8955('0x20'),auth['isAuthenticated'](),controller[_0x8955('0x21')]);router[_0x8955('0x1d')](_0x8955('0x12'),auth[_0x8955('0x9')](),controller[_0x8955('0x22')]);module[_0x8955('0x23')]=router; \ No newline at end of file diff --git a/server/api/openchannelAccount/openchannelAccount.attributes.js b/server/api/openchannelAccount/openchannelAccount.attributes.js index 0c59132..3930d33 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 _0x72e3=['TEXT','BOOLEAN','INTEGER','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','setDataValue','mandatoryDispositionPauseId','mandatoryDisposition','randomstring','STRING','generate'];(function(_0x700d7d,_0x51d04d){var _0x55f4ee=function(_0x160897){while(--_0x160897){_0x700d7d['push'](_0x700d7d['shift']());}};_0x55f4ee(++_0x51d04d);}(_0x72e3,0x179));var _0x372e=function(_0x3ca38b,_0x379e53){_0x3ca38b=_0x3ca38b-0x0;var _0x5940b1=_0x72e3[_0x3ca38b];return _0x5940b1;};'use strict';var Sequelize=require('sequelize');var rs=require(_0x372e('0x0'));module['exports']={'name':{'type':Sequelize['STRING'],'unique':'name','allowNull':![]},'description':{'type':Sequelize[_0x372e('0x1')]},'token':{'type':Sequelize[_0x372e('0x1')],'defaultValue':function(){return rs[_0x372e('0x2')]();}},'replyUri':{'type':Sequelize[_0x372e('0x1')],'validate':{'isUrl':!![]}},'key':{'type':Sequelize[_0x372e('0x1')],'allowNull':![]},'notificationTemplate':{'type':Sequelize[_0x372e('0x3')],'defaultValue':function(){return'Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}';}},'notificationSound':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0x372e('0x4')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0x372e('0x5')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'mapKey':{'type':Sequelize[_0x372e('0x1')]},'queueTransfer':{'type':Sequelize[_0x372e('0x4')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0x372e('0x5')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0x372e('0x4')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0x372e('0x5')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize[_0x372e('0x5')],'allowNull':!![],'defaultValue':null,'comment':'Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled'},'mandatoryDisposition':{'type':Sequelize[_0x372e('0x4')],'defaultValue':![],'comment':_0x372e('0x6'),'set':function(_0x4d0673){if(!_0x4d0673)this[_0x372e('0x7')](_0x372e('0x8'),null);this[_0x372e('0x7')](_0x372e('0x9'),_0x4d0673);}}}; \ No newline at end of file +var _0x1adc=['Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','mandatoryDispositionPauseId','setDataValue','sequelize','randomstring','exports','STRING','name','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'];(function(_0x4c8124,_0x56f9e4){var _0x15cec7=function(_0x170756){while(--_0x170756){_0x4c8124['push'](_0x4c8124['shift']());}};_0x15cec7(++_0x56f9e4);}(_0x1adc,0x145));var _0xc1ad=function(_0x277a0f,_0xf49af1){_0x277a0f=_0x277a0f-0x0;var _0x1159f6=_0x1adc[_0x277a0f];return _0x1159f6;};'use strict';var Sequelize=require(_0xc1ad('0x0'));var rs=require(_0xc1ad('0x1'));module[_0xc1ad('0x2')]={'name':{'type':Sequelize[_0xc1ad('0x3')],'unique':_0xc1ad('0x4'),'allowNull':![]},'description':{'type':Sequelize[_0xc1ad('0x3')]},'token':{'type':Sequelize[_0xc1ad('0x3')],'defaultValue':function(){return rs[_0xc1ad('0x5')]();}},'replyUri':{'type':Sequelize[_0xc1ad('0x3')],'validate':{'isUrl':!![]}},'key':{'type':Sequelize['STRING'],'allowNull':![]},'notificationTemplate':{'type':Sequelize[_0xc1ad('0x6')],'defaultValue':function(){return _0xc1ad('0x7');}},'notificationSound':{'type':Sequelize[_0xc1ad('0x8')],'defaultValue':!![]},'notificationShake':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0xc1ad('0x9')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'mapKey':{'type':Sequelize['STRING']},'queueTransfer':{'type':Sequelize[_0xc1ad('0x8')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0xc1ad('0x9')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0xc1ad('0x9')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize[_0xc1ad('0x9')],'allowNull':!![],'defaultValue':null,'comment':_0xc1ad('0xa')},'mandatoryDisposition':{'type':Sequelize['BOOLEAN'],'defaultValue':![],'comment':_0xc1ad('0xb'),'set':function(_0x56e954){if(!_0x56e954)this['setDataValue'](_0xc1ad('0xc'),null);this[_0xc1ad('0xd')]('mandatoryDisposition',_0x56e954);}}}; \ No newline at end of file diff --git a/server/api/openchannelAccount/openchannelAccount.controller.js b/server/api/openchannelAccount/openchannelAccount.controller.js index 7093b12..546628c 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 _0xe32c=['../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./openchannelAccount.socket','register','jayson/promise','client','http','test','ValidationError','The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.','request','then','info','OpenchannelAccount,\x20%s,\x20%s','debug','OpenchannelAccount,\x20%s,\x20%s,\x20%s','request\x20sent','error','message','result','catch','sendStatus','status','end','count','offset','limit','set','Content-Range','json','reject','get','UserProfileResource','stack','name','send','index','mandatoryDispositionPause','fieldName','type','map','keys','model','query','attributes','fields','length','nolimit','sort','where','pick','filters','filter','merge','options','OpenchannelAccount','includeAll','include','rows','show','params','Pause','rawAttributes','intersection','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','user','OpenchannelAccounts','UserProfileSection','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','find','describe','addDisposition','OpnechannelAccountId','Disposition','getDispositions','findOne','hasOwnProperty','order','OpenchannelAccountId','removeDispositions','ids','addAnswer','getAnswers','CannedAnswer','removeAnswers','openchannel','CmContact','Sequelize','no\x20available\x20attributes','difference','createdAt','updatedAt','ListId','from','from\x20is\x20mandatory','isNil','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','CmList','List','Contacts','OpenchannelApplication','Applications','applications','orderBy','asc','account','contact','firstName','lastName','threadId','externalUrl','OpenchannelInteraction','spread','messageId','interaction','created','autoclose','push','unmanaged','*,*,*,*','OpenchannelMessage','AttachmentId','User','unshift','waitForTheAssignedAgent','forcedOwnership','startRouting','EventManager','notify','sequelize','destroy','bulkCreate','getApplications','getInteractions','Contact','Tag','color','tag','findAll','addAgents','omit','emit','removeAgents','userOpenchannelAccount:remove','getAgents','out','Messages','dataValues','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch'];(function(_0x13b8f3,_0x442821){var _0x1a6d06=function(_0x5126f2){while(--_0x5126f2){_0x13b8f3['push'](_0x13b8f3['shift']());}};_0x1a6d06(++_0x442821);}(_0xe32c,0x15a));var _0xce32=function(_0x22f85a,_0x195ed5){_0x22f85a=_0x22f85a-0x0;var _0xaa717=_0xe32c[_0x22f85a];return _0xaa717;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0xce32('0x0'));var rimraf=require(_0xce32('0x1'));var zipdir=require(_0xce32('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xce32('0x3'));var moment=require(_0xce32('0x4'));var BPromise=require(_0xce32('0x5'));var Mustache=require('mustache');var util=require(_0xce32('0x6'));var path=require(_0xce32('0x7'));var sox=require(_0xce32('0x8'));var csv=require(_0xce32('0x9'));var ejs=require(_0xce32('0xa'));var fs=require('fs');var _=require(_0xce32('0xb'));var squel=require(_0xce32('0xc'));var crypto=require(_0xce32('0xd'));var jsforce=require(_0xce32('0xe'));var deskjs=require('desk.js');var toCsv=require(_0xce32('0x9'));var querystring=require(_0xce32('0xf'));var Papa=require(_0xce32('0x10'));var Redis=require('ioredis');var authService=require(_0xce32('0x11'));var qs=require(_0xce32('0x12'));var as=require(_0xce32('0x13'));var hardwareService=require(_0xce32('0x14'));var logger=require(_0xce32('0x15'))(_0xce32('0x16'));var utils=require(_0xce32('0x17'));var config=require(_0xce32('0x18'));var db=require(_0xce32('0x19'))['db'];config[_0xce32('0x1a')]=_[_0xce32('0x1b')](config[_0xce32('0x1a')],{'host':_0xce32('0x1c'),'port':0x18eb});var socket=require(_0xce32('0x1d'))(new Redis(config[_0xce32('0x1a')]));require(_0xce32('0x1e'))[_0xce32('0x1f')](socket);var jayson=require(_0xce32('0x20'));var client=jayson[_0xce32('0x21')]['http']({'port':0x232c});var client9002=jayson[_0xce32('0x21')][_0xce32('0x22')]({'port':0x232a});function checkPasswordPattern(_0xa454e5,_0x394625,_0x1a9883){if(_0x1a9883){var _0x1fa6a9=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x1fa6a9[_0xce32('0x23')](_0x394625)){return _0xa454e5;}else{throw new db['Sequelize'][(_0xce32('0x24'))](_0xce32('0x25'));}}else{return _0xa454e5;}}function respondWithRpcPromise(_0x34d6af,_0x675dfb,_0x5a172e,_0x2746ea){return new BPromise(function(_0x1507b3,_0x4f25b6){var _0x57c28a=_0x2746ea||client;return _0x57c28a[_0xce32('0x26')](_0x34d6af,_0x5a172e)[_0xce32('0x27')](function(_0x23516e){logger[_0xce32('0x28')](_0xce32('0x29'),_0x675dfb,'request\x20sent');logger[_0xce32('0x2a')](_0xce32('0x2b'),_0x675dfb,_0xce32('0x2c'),JSON['stringify'](_0x23516e));if(_0x23516e[_0xce32('0x2d')]){if(_0x23516e[_0xce32('0x2d')]['code']===0x1f4){logger[_0xce32('0x2d')]('OpenchannelAccount,\x20%s,\x20%s',_0x675dfb,_0x23516e[_0xce32('0x2d')]['message']);return _0x4f25b6(_0x23516e[_0xce32('0x2d')]['message']);}logger[_0xce32('0x2d')](_0xce32('0x29'),_0x675dfb,_0x23516e['error']['message']);return _0x1507b3(_0x23516e[_0xce32('0x2d')][_0xce32('0x2e')]);}else{logger['info'](_0xce32('0x29'),_0x675dfb,_0xce32('0x2c'));_0x1507b3(_0x23516e[_0xce32('0x2f')][_0xce32('0x2e')]);}})[_0xce32('0x30')](function(_0x2eea0b){logger[_0xce32('0x2d')](_0xce32('0x29'),_0x675dfb,_0x2eea0b);_0x4f25b6(_0x2eea0b);});});}function respondWithStatusCode(_0x255b7a,_0x1e5a8a){_0x1e5a8a=_0x1e5a8a||0xcc;return function(_0x151859){if(_0x151859){return _0x255b7a[_0xce32('0x31')](_0x1e5a8a);}return _0x255b7a[_0xce32('0x32')](_0x1e5a8a)[_0xce32('0x33')]();};}function respondWithResult(_0x2d5e93,_0x15657d){_0x15657d=_0x15657d||0xc8;return function(_0x13e459){if(_0x13e459){return _0x2d5e93[_0xce32('0x32')](_0x15657d)['json'](_0x13e459);}};}function respondWithFilteredResult(_0x442dca,_0x48f7bf){return function(_0x1a7e6c){if(_0x1a7e6c){var _0x57bbc4=_0x1a7e6c[_0xce32('0x34')],_0x2abe04=_0x48f7bf[_0xce32('0x35')],_0x7972bc=_0x48f7bf[_0xce32('0x35')]+_0x48f7bf[_0xce32('0x36')],_0x2c19fd;if(_0x7972bc>=_0x57bbc4){_0x7972bc=_0x57bbc4;_0x2c19fd=0xc8;}else{_0x2c19fd=0xce;}_0x442dca[_0xce32('0x32')](_0x2c19fd);return _0x442dca[_0xce32('0x37')](_0xce32('0x38'),_0x2abe04+'-'+_0x7972bc+'/'+_0x57bbc4)[_0xce32('0x39')](_0x1a7e6c);}return null;};}function patchUpdates(_0x1f999b){return function(_0x39f0cd){try{jsonpatch['apply'](_0x39f0cd,_0x1f999b,!![]);}catch(_0x4d5b39){return BPromise[_0xce32('0x3a')](_0x4d5b39);}return _0x39f0cd['save']();};}function saveUpdates(_0x26edca,_0x4ba41f){return function(_0x5cef72){if(_0x5cef72){return _0x5cef72['update'](_0x26edca)[_0xce32('0x27')](function(_0x215a51){return _0x215a51;});}return null;};}function removeEntity(_0x308c0b,_0x53b13c){return function(_0x3654f6){if(_0x3654f6){return _0x3654f6['destroy']()['then'](function(){var _0x4fea94=_0x3654f6[_0xce32('0x3b')]({'plain':!![]});var _0x3cceab='OpenchannelAccounts';return db[_0xce32('0x3c')]['destroy']({'where':{'type':_0x3cceab,'resourceId':_0x4fea94['id']}})[_0xce32('0x27')](function(){return _0x3654f6;});})[_0xce32('0x27')](function(){_0x308c0b[_0xce32('0x32')](0xcc)[_0xce32('0x33')]();});}};}function handleEntityNotFound(_0x395168,_0x7ae9bd){return function(_0x547eca){if(!_0x547eca){_0x395168[_0xce32('0x31')](0x194);}return _0x547eca;};}function handleError(_0x4f7a69,_0x456138){_0x456138=_0x456138||0x1f4;return function(_0x22ff86){logger['error'](_0x22ff86[_0xce32('0x3d')]);if(_0x22ff86['name']){delete _0x22ff86[_0xce32('0x3e')];}_0x4f7a69[_0xce32('0x32')](_0x456138)[_0xce32('0x3f')](_0x22ff86);};}exports[_0xce32('0x40')]=function(_0x4c4687,_0x4ef609){var _0x244860={'include':[{'model':db['Pause'],'as':_0xce32('0x41')}]},_0x278c51={},_0x5684fc={'count':0x0,'rows':[]};var _0x2bc4eb=_['map'](db['OpenchannelAccount']['rawAttributes'],function(_0x2023b4){return{'name':_0x2023b4[_0xce32('0x42')],'type':_0x2023b4[_0xce32('0x43')]['key']};});_0x278c51['model']=_[_0xce32('0x44')](_0x2bc4eb,_0xce32('0x3e'));_0x278c51['query']=_[_0xce32('0x45')](_0x4c4687['query']);_0x278c51['filters']=_['intersection'](_0x278c51[_0xce32('0x46')],_0x278c51[_0xce32('0x47')]);_0x244860[_0xce32('0x48')]=_['intersection'](_0x278c51['model'],qs['fields'](_0x4c4687[_0xce32('0x47')][_0xce32('0x49')]));_0x244860[_0xce32('0x48')]=_0x244860[_0xce32('0x48')][_0xce32('0x4a')]?_0x244860['attributes']:_0x278c51[_0xce32('0x46')];if(!_0x4c4687[_0xce32('0x47')]['hasOwnProperty'](_0xce32('0x4b'))){_0x244860[_0xce32('0x36')]=qs[_0xce32('0x36')](_0x4c4687[_0xce32('0x47')][_0xce32('0x36')]);_0x244860[_0xce32('0x35')]=qs[_0xce32('0x35')](_0x4c4687[_0xce32('0x47')][_0xce32('0x35')]);}_0x244860['order']=qs[_0xce32('0x4c')](_0x4c4687['query'][_0xce32('0x4c')]);_0x244860[_0xce32('0x4d')]=qs['filters'](_[_0xce32('0x4e')](_0x4c4687[_0xce32('0x47')],_0x278c51[_0xce32('0x4f')]));if(_0x4c4687[_0xce32('0x47')]['filter']){_0x244860[_0xce32('0x4d')]=_['merge'](_0x244860[_0xce32('0x4d')],{'$or':_[_0xce32('0x44')](_0x2bc4eb,function(_0x2ca850){if(_0x2ca850['type']!=='VIRTUAL'){var _0x5c7ab2={};_0x5c7ab2[_0x2ca850['name']]={'$like':'%'+_0x4c4687[_0xce32('0x47')][_0xce32('0x50')]+'%'};return _0x5c7ab2;}})});}_0x244860=_[_0xce32('0x51')]({},_0x244860,_0x4c4687[_0xce32('0x52')]);var _0x5063c5={'where':_0x244860[_0xce32('0x4d')]};return db[_0xce32('0x53')][_0xce32('0x34')](_0x5063c5)[_0xce32('0x27')](function(_0x2a7c66){_0x5684fc[_0xce32('0x34')]=_0x2a7c66;if(_0x4c4687[_0xce32('0x47')][_0xce32('0x54')]){_0x244860[_0xce32('0x55')]=[{'all':!![]}];}return db[_0xce32('0x53')]['findAll'](_0x244860);})[_0xce32('0x27')](function(_0x3e6b46){_0x5684fc[_0xce32('0x56')]=_0x3e6b46;return _0x5684fc;})[_0xce32('0x27')](respondWithFilteredResult(_0x4ef609,_0x244860))[_0xce32('0x30')](handleError(_0x4ef609,null));};exports[_0xce32('0x57')]=function(_0x57cac9,_0x9e7069){var _0x1cc26f={'raw':![],'where':{'id':_0x57cac9[_0xce32('0x58')]['id']},'include':[{'model':db[_0xce32('0x59')],'as':'mandatoryDispositionPause'}]},_0x1aec42={};_0x1aec42[_0xce32('0x46')]=_[_0xce32('0x45')](db['OpenchannelAccount'][_0xce32('0x5a')]);_0x1aec42['query']=_[_0xce32('0x45')](_0x57cac9[_0xce32('0x47')]);_0x1aec42[_0xce32('0x4f')]=_[_0xce32('0x5b')](_0x1aec42[_0xce32('0x46')],_0x1aec42[_0xce32('0x47')]);_0x1cc26f[_0xce32('0x48')]=_[_0xce32('0x5b')](_0x1aec42[_0xce32('0x46')],qs[_0xce32('0x49')](_0x57cac9[_0xce32('0x47')][_0xce32('0x49')]));_0x1cc26f[_0xce32('0x48')]=_0x1cc26f[_0xce32('0x48')][_0xce32('0x4a')]?_0x1cc26f[_0xce32('0x48')]:_0x1aec42[_0xce32('0x46')];if(_0x57cac9[_0xce32('0x47')][_0xce32('0x54')]){_0x1cc26f[_0xce32('0x55')]=[{'all':!![]}];}_0x1cc26f=_[_0xce32('0x51')]({},_0x1cc26f,_0x57cac9['options']);return db['OpenchannelAccount']['find'](_0x1cc26f)[_0xce32('0x27')](handleEntityNotFound(_0x9e7069,null))[_0xce32('0x27')](respondWithResult(_0x9e7069,null))['catch'](handleError(_0x9e7069,null));};exports[_0xce32('0x5c')]=function(_0x2336bc,_0xb56b33){return db['OpenchannelAccount'][_0xce32('0x5c')](_0x2336bc[_0xce32('0x5d')],{})[_0xce32('0x27')](function(_0x2976f1){var _0x44b8ad=_0x2336bc['user'][_0xce32('0x3b')]({'plain':!![]});if(!_0x44b8ad)throw new Error(_0xce32('0x5e'));if(_0x44b8ad['role']===_0xce32('0x5f')){var _0x3fd313=_0x2976f1[_0xce32('0x3b')]({'plain':!![]});var _0x3e7158=_0xce32('0x60');return db[_0xce32('0x61')]['find']({'where':{'name':_0x3e7158,'userProfileId':_0x44b8ad[_0xce32('0x62')]},'raw':!![]})[_0xce32('0x27')](function(_0x4ce519){if(_0x4ce519&&_0x4ce519['autoAssociation']===0x0){return db['UserProfileResource']['create']({'name':_0x3fd313[_0xce32('0x3e')],'resourceId':_0x3fd313['id'],'type':_0x4ce519[_0xce32('0x3e')],'sectionId':_0x4ce519['id']},{})[_0xce32('0x27')](function(){return _0x2976f1;});}else{return _0x2976f1;}})['catch'](function(_0x1bb330){logger[_0xce32('0x2d')](_0xce32('0x63'),_0x1bb330);throw _0x1bb330;});}return _0x2976f1;})[_0xce32('0x27')](respondWithResult(_0xb56b33,0xc9))['catch'](handleError(_0xb56b33,null));};exports[_0xce32('0x64')]=function(_0x29d680,_0x57fdac){if(_0x29d680[_0xce32('0x5d')]['id']){delete _0x29d680[_0xce32('0x5d')]['id'];}return db[_0xce32('0x53')]['find']({'where':{'id':_0x29d680[_0xce32('0x58')]['id']},'include':[{'model':db[_0xce32('0x59')],'as':'mandatoryDispositionPause'}]})[_0xce32('0x27')](handleEntityNotFound(_0x57fdac,null))[_0xce32('0x27')](saveUpdates(_0x29d680[_0xce32('0x5d')],null))[_0xce32('0x27')](respondWithResult(_0x57fdac,null))['catch'](handleError(_0x57fdac,null));};exports['destroy']=function(_0x4d88d0,_0x2bd6eb){return db[_0xce32('0x53')][_0xce32('0x65')]({'where':{'id':_0x4d88d0[_0xce32('0x58')]['id']}})['then'](handleEntityNotFound(_0x2bd6eb,null))[_0xce32('0x27')](removeEntity(_0x2bd6eb,null))[_0xce32('0x30')](handleError(_0x2bd6eb,null));};exports[_0xce32('0x66')]=function(_0x5f2bcf,_0x172be4){return db[_0xce32('0x53')][_0xce32('0x66')]()[_0xce32('0x27')](respondWithResult(_0x172be4,null))['catch'](handleError(_0x172be4,null));};exports[_0xce32('0x67')]=function(_0x10ecea,_0xc93d33,_0x42eede){if(_0x10ecea['body']['id']){delete _0x10ecea[_0xce32('0x5d')]['id'];}return db[_0xce32('0x53')][_0xce32('0x65')]({'where':{'id':_0x10ecea[_0xce32('0x58')]['id']}})[_0xce32('0x27')](handleEntityNotFound(_0xc93d33,null))['then'](function(_0x5641ac){if(_0x5641ac){_0x10ecea[_0xce32('0x5d')][_0xce32('0x68')]=_0x5641ac['id'];return db[_0xce32('0x69')][_0xce32('0x5c')](_0x10ecea[_0xce32('0x5d')]);}})[_0xce32('0x27')](respondWithResult(_0xc93d33,null))[_0xce32('0x30')](handleError(_0xc93d33,null));};exports[_0xce32('0x6a')]=function(_0x256106,_0x524b95,_0x41d5a7){var _0x2b9714={'raw':![],'where':{}};var _0x666184={};var _0x358bce={'count':0x0,'rows':[]};return db['OpenchannelAccount'][_0xce32('0x6b')]({'where':{'id':_0x256106[_0xce32('0x58')]['id']}})[_0xce32('0x27')](handleEntityNotFound(_0x524b95,null))[_0xce32('0x27')](function(_0x4c0116){if(_0x4c0116){_0x666184['model']=_['keys'](db[_0xce32('0x69')][_0xce32('0x5a')]);_0x666184['query']=_[_0xce32('0x45')](_0x256106[_0xce32('0x47')]);_0x666184[_0xce32('0x4f')]=_[_0xce32('0x5b')](_0x666184[_0xce32('0x46')],_0x666184[_0xce32('0x47')]);_0x2b9714[_0xce32('0x48')]=_[_0xce32('0x5b')](_0x666184['model'],qs[_0xce32('0x49')](_0x256106[_0xce32('0x47')]['fields']));_0x2b9714[_0xce32('0x48')]=_0x2b9714[_0xce32('0x48')][_0xce32('0x4a')]?_0x2b9714[_0xce32('0x48')]:_0x666184['model'];if(!_0x256106[_0xce32('0x47')][_0xce32('0x6c')](_0xce32('0x4b'))){_0x2b9714[_0xce32('0x36')]=qs[_0xce32('0x36')](_0x256106[_0xce32('0x47')]['limit']);_0x2b9714[_0xce32('0x35')]=qs[_0xce32('0x35')](_0x256106[_0xce32('0x47')][_0xce32('0x35')]);}_0x2b9714[_0xce32('0x6d')]=qs[_0xce32('0x4c')](_0x256106[_0xce32('0x47')][_0xce32('0x4c')]);_0x2b9714[_0xce32('0x4d')]=qs[_0xce32('0x4f')](_[_0xce32('0x4e')](_0x256106[_0xce32('0x47')],_0x666184[_0xce32('0x4f')]));_0x2b9714['where'][_0xce32('0x6e')]=_0x4c0116['id'];if(_0x256106[_0xce32('0x47')][_0xce32('0x50')]){_0x2b9714[_0xce32('0x4d')]=_[_0xce32('0x51')](_0x2b9714['where'],{'$or':_[_0xce32('0x44')](_0x2b9714[_0xce32('0x48')],function(_0x325d59){var _0x149385={};_0x149385[_0x325d59]={'$like':'%'+_0x256106['query'][_0xce32('0x50')]+'%'};return _0x149385;})});}_0x2b9714=_['merge']({},_0x2b9714,_0x256106[_0xce32('0x52')]);return db[_0xce32('0x69')]['count']({'where':_0x2b9714[_0xce32('0x4d')]})[_0xce32('0x27')](function(_0x283d16){_0x358bce[_0xce32('0x34')]=_0x283d16;if(_0x256106[_0xce32('0x47')]['includeAll']){_0x2b9714['include']=[{'all':!![]}];}return db[_0xce32('0x69')]['findAll'](_0x2b9714);})[_0xce32('0x27')](function(_0x41dabe){_0x358bce[_0xce32('0x56')]=_0x41dabe;return _0x358bce;});}})[_0xce32('0x27')](respondWithFilteredResult(_0x524b95,_0x2b9714))[_0xce32('0x30')](handleError(_0x524b95,null));};exports[_0xce32('0x6f')]=function(_0x441bd0,_0x6efc1a,_0x4088cd){return db['OpenchannelAccount'][_0xce32('0x65')]({'where':{'id':_0x441bd0[_0xce32('0x58')]['id']}})[_0xce32('0x27')](handleEntityNotFound(_0x6efc1a,null))['then'](function(_0x52b87e){if(_0x52b87e){return _0x52b87e['removeDispositions'](_0x441bd0[_0xce32('0x47')][_0xce32('0x70')]);}})[_0xce32('0x27')](respondWithStatusCode(_0x6efc1a,null))['catch'](handleError(_0x6efc1a,null));};exports[_0xce32('0x71')]=function(_0x1cd70d,_0x4ab4b1,_0x431931){if(_0x1cd70d[_0xce32('0x5d')]['id']){delete _0x1cd70d[_0xce32('0x5d')]['id'];}return db['OpenchannelAccount'][_0xce32('0x65')]({'where':{'id':_0x1cd70d[_0xce32('0x58')]['id']}})[_0xce32('0x27')](handleEntityNotFound(_0x4ab4b1,null))[_0xce32('0x27')](function(_0x39455f){if(_0x39455f){_0x1cd70d[_0xce32('0x5d')][_0xce32('0x6e')]=_0x39455f['id'];return db['CannedAnswer']['create'](_0x1cd70d[_0xce32('0x5d')]);}})[_0xce32('0x27')](respondWithResult(_0x4ab4b1,null))[_0xce32('0x30')](handleError(_0x4ab4b1,null));};exports[_0xce32('0x72')]=function(_0x5f2a01,_0x2d2da3,_0x3c7f57){var _0x1d7fa4={'raw':![],'where':{}};var _0x402f2e={};var _0x37d9ff={'count':0x0,'rows':[]};return db[_0xce32('0x53')][_0xce32('0x6b')]({'where':{'id':_0x5f2a01[_0xce32('0x58')]['id']}})[_0xce32('0x27')](handleEntityNotFound(_0x2d2da3,null))[_0xce32('0x27')](function(_0xab454){if(_0xab454){_0x402f2e[_0xce32('0x46')]=_['keys'](db[_0xce32('0x73')][_0xce32('0x5a')]);_0x402f2e[_0xce32('0x47')]=_[_0xce32('0x45')](_0x5f2a01[_0xce32('0x47')]);_0x402f2e[_0xce32('0x4f')]=_[_0xce32('0x5b')](_0x402f2e['model'],_0x402f2e[_0xce32('0x47')]);_0x1d7fa4[_0xce32('0x48')]=_[_0xce32('0x5b')](_0x402f2e[_0xce32('0x46')],qs[_0xce32('0x49')](_0x5f2a01[_0xce32('0x47')][_0xce32('0x49')]));_0x1d7fa4['attributes']=_0x1d7fa4['attributes'][_0xce32('0x4a')]?_0x1d7fa4[_0xce32('0x48')]:_0x402f2e[_0xce32('0x46')];if(!_0x5f2a01[_0xce32('0x47')][_0xce32('0x6c')]('nolimit')){_0x1d7fa4[_0xce32('0x36')]=qs['limit'](_0x5f2a01[_0xce32('0x47')][_0xce32('0x36')]);_0x1d7fa4['offset']=qs[_0xce32('0x35')](_0x5f2a01[_0xce32('0x47')][_0xce32('0x35')]);}_0x1d7fa4[_0xce32('0x6d')]=qs['sort'](_0x5f2a01['query'][_0xce32('0x4c')]);_0x1d7fa4[_0xce32('0x4d')]=qs[_0xce32('0x4f')](_[_0xce32('0x4e')](_0x5f2a01[_0xce32('0x47')],_0x402f2e[_0xce32('0x4f')]));_0x1d7fa4[_0xce32('0x4d')][_0xce32('0x6e')]=_0xab454['id'];if(_0x5f2a01[_0xce32('0x47')][_0xce32('0x50')]){_0x1d7fa4[_0xce32('0x4d')]=_[_0xce32('0x51')](_0x1d7fa4['where'],{'$or':_[_0xce32('0x44')](_0x1d7fa4['attributes'],function(_0x5794f0){var _0x3243f9={};_0x3243f9[_0x5794f0]={'$like':'%'+_0x5f2a01[_0xce32('0x47')][_0xce32('0x50')]+'%'};return _0x3243f9;})});}_0x1d7fa4=_[_0xce32('0x51')]({},_0x1d7fa4,_0x5f2a01['options']);return db['CannedAnswer'][_0xce32('0x34')]({'where':_0x1d7fa4[_0xce32('0x4d')]})[_0xce32('0x27')](function(_0xe1955f){_0x37d9ff['count']=_0xe1955f;if(_0x5f2a01[_0xce32('0x47')][_0xce32('0x54')]){_0x1d7fa4[_0xce32('0x55')]=[{'all':!![]}];}return db[_0xce32('0x73')]['findAll'](_0x1d7fa4);})['then'](function(_0x85535e){_0x37d9ff[_0xce32('0x56')]=_0x85535e;return _0x37d9ff;});}})[_0xce32('0x27')](respondWithFilteredResult(_0x2d2da3,_0x1d7fa4))[_0xce32('0x30')](handleError(_0x2d2da3,null));};exports[_0xce32('0x74')]=function(_0x49bacf,_0x2751d1,_0x53c6a2){return db['OpenchannelAccount'][_0xce32('0x65')]({'where':{'id':_0x49bacf['params']['id']}})[_0xce32('0x27')](handleEntityNotFound(_0x2751d1,null))[_0xce32('0x27')](function(_0x55ede1){if(_0x55ede1){return _0x55ede1[_0xce32('0x74')](_0x49bacf[_0xce32('0x47')][_0xce32('0x70')]);}})[_0xce32('0x27')](respondWithStatusCode(_0x2751d1,null))['catch'](handleError(_0x2751d1,null));};exports['notify']=function(_0x36cc21,_0x5d2fbc,_0x28307e){var _0x482968={'body':_0x36cc21['body'],'channel':_0xce32('0x75')};var _0x17f2f2=[];var _0x27f176=[];var _0x390eda={};var _0x30d7a2=![];return db[_0xce32('0x76')]['describe']()['then'](function(_0x4ed19d){if(!_0x4ed19d){throw new db[(_0xce32('0x77'))][(_0xce32('0x24'))](_0xce32('0x78'));}_0x17f2f2=_[_0xce32('0x79')](_[_0xce32('0x45')](_0x4ed19d),[_0xce32('0x7a'),'updatedAt']);_0x27f176=_[_0xce32('0x79')](_[_0xce32('0x45')](_0x4ed19d),[_0xce32('0x7a'),_0xce32('0x7b'),'CompanyId',_0xce32('0x7c')]);if(_0x36cc21['body']['id']){delete _0x36cc21[_0xce32('0x5d')]['id'];}if(_['isNil'](_0x36cc21[_0xce32('0x5d')][_0xce32('0x7d')])){throw new db['Sequelize'][(_0xce32('0x24'))](_0xce32('0x7e'));}if(_[_0xce32('0x7f')](_0x36cc21[_0xce32('0x5d')][_0xce32('0x5d')])||_0x36cc21[_0xce32('0x5d')][_0xce32('0x5d')]===''){throw new db[(_0xce32('0x77'))][(_0xce32('0x24'))](_0xce32('0x80'));}if(_[_0xce32('0x7f')](_0x36cc21[_0xce32('0x5d')][_0xce32('0x81')])){throw new db[(_0xce32('0x77'))]['ValidationError'](_0xce32('0x82')+_0x27f176);}if(!_['includes'](_0x27f176,_0x36cc21[_0xce32('0x5d')][_0xce32('0x81')])){throw new db['Sequelize'][(_0xce32('0x24'))](_0xce32('0x83')+_0x27f176);}_0x390eda[_0x36cc21[_0xce32('0x5d')][_0xce32('0x81')]]=_0x36cc21[_0xce32('0x5d')][_0xce32('0x7d')];})[_0xce32('0x27')](function(){return db[_0xce32('0x53')]['find']({'where':{'id':_0x36cc21[_0xce32('0x58')]['id']},'include':[{'model':db[_0xce32('0x84')],'as':_0xce32('0x85'),'include':[{'model':db['CmContact'],'as':_0xce32('0x86'),'where':_0x390eda,'limit':0x1,'order':[[_0xce32('0x7b'),'DESC']]}]},{'model':db[_0xce32('0x87')],'as':_0xce32('0x88')}]});})[_0xce32('0x27')](handleEntityNotFound(_0x5d2fbc,null))[_0xce32('0x27')](function(_0x3c0d94){if(_0x3c0d94&&_0x3c0d94[_0xce32('0x85')]){_0x482968['account']=_0x3c0d94;_0x482968[_0xce32('0x89')]=_0x3c0d94[_0xce32('0x88')];_0x482968['list']=_0x3c0d94[_0xce32('0x85')];_0x482968[_0xce32('0x89')]=_[_0xce32('0x8a')](_0x482968[_0xce32('0x89')],['priority'],[_0xce32('0x8b')]);if(_0x482968[_0xce32('0x8c')][_0xce32('0x88')]){delete _0x482968[_0xce32('0x8c')]['Applications'];}if(_0x482968['account'][_0xce32('0x85')]&&_0x482968['account'][_0xce32('0x85')]['Contacts']['length']){return _0x482968['account'][_0xce32('0x85')][_0xce32('0x86')][0x0];}var _0x5e418b=_['defaults'](_0x36cc21[_0xce32('0x5d')],{'firstName':_0x36cc21[_0xce32('0x5d')][_0xce32('0x7d')],'ListId':_0x3c0d94[_0xce32('0x7c')]});_0x5e418b[_0x36cc21[_0xce32('0x5d')]['mapKey']]=_0x36cc21[_0xce32('0x5d')][_0xce32('0x7d')];return db['CmContact']['create'](_0x5e418b,{'fields':_0x17f2f2,'raw':!![]});}})[_0xce32('0x27')](handleEntityNotFound(_0x5d2fbc,null))['then'](function(_0x1b7157){_0x482968[_0xce32('0x8d')]=_0x1b7157;if(_0x1b7157){var _0x40e661={'ContactId':_0x1b7157['id'],'OpenchannelAccountId':_0x36cc21[_0xce32('0x58')]['id'],'from':(_0x1b7157[_0xce32('0x8e')]||'')+'\x20'+(_0x1b7157[_0xce32('0x8f')]||'')};var _0x495aaf={'OpenchannelAccountId':_0x36cc21[_0xce32('0x58')]['id'],'closed':![]};if(_0x36cc21[_0xce32('0x5d')][_0xce32('0x90')]){_0x495aaf[_0xce32('0x90')]=_0x36cc21['body'][_0xce32('0x90')];return db['OpenchannelInteraction'][_0xce32('0x65')]({'where':_0x495aaf})[_0xce32('0x27')](function(_0x1a49a0){if(_0x1a49a0){return[_0x1a49a0,![]];}_0x40e661[_0xce32('0x90')]=_0x36cc21[_0xce32('0x5d')][_0xce32('0x90')];_0x40e661[_0xce32('0x91')]=_0x36cc21[_0xce32('0x5d')][_0xce32('0x91')];return db[_0xce32('0x92')][_0xce32('0x5c')](_0x40e661)[_0xce32('0x27')](function(_0x1bece4){return[_0x1bece4,!![]];});});}else{_0x495aaf[_0xce32('0x90')]=null;}_0x495aaf['ContactId']=_0x1b7157['id'];return db[_0xce32('0x92')]['find']({'where':_0x495aaf})[_0xce32('0x27')](function(_0x3b7dc2){if(_0x3b7dc2){return[_0x3b7dc2,![]];}return db['OpenchannelInteraction'][_0xce32('0x5c')](_0x40e661)[_0xce32('0x27')](function(_0xa9aac){return[_0xa9aac,!![]];});});}})[_0xce32('0x93')](function(_0x347a8c,_0x5532a4){if(_0x347a8c){_0x30d7a2=_0x5532a4;if(!_0x5532a4){var _0x5b78ac={'from':(_0x482968['contact'][_0xce32('0x8e')]||'')+'\x20'+(_0x482968[_0xce32('0x8d')]['lastName']||'')};if(_0x36cc21['body'][_0xce32('0x90')]&&_0x36cc21[_0xce32('0x5d')][_0xce32('0x94')]&&_0x36cc21[_0xce32('0x5d')]['threadId']!=_0x36cc21[_0xce32('0x5d')]['messageId']){_0x5b78ac[_0xce32('0x90')]=_0x36cc21['body'][_0xce32('0x94')];}return _0x347a8c[_0xce32('0x64')](_0x5b78ac);}else{return _0x347a8c;}}})['then'](function(_0x81c0ff){_0x482968['interaction']=_0x81c0ff[_0xce32('0x3b')]({'plain':!![]});_0x482968[_0xce32('0x95')][_0xce32('0x96')]=_0x30d7a2;if(_0x482968[_0xce32('0x95')][_0xce32('0x96')]){if(_0x482968[_0xce32('0x8c')][_0xce32('0x97')]){_0x482968['applications'][_0xce32('0x98')]({'id':0x0,'priority':_0x482968[_0xce32('0x89')][_0xce32('0x4a')]+0x1,'app':'close','appdata':_0xce32('0x99'),'interval':_0xce32('0x9a')});}}return db[_0xce32('0x9b')][_0xce32('0x5c')]({'body':_0x36cc21[_0xce32('0x5d')][_0xce32('0x5d')],'OpenchannelAccountId':_0x36cc21[_0xce32('0x58')]['id'],'OpenchannelInteractionId':_0x81c0ff['id'],'direction':'in','ContactId':_0x482968[_0xce32('0x8d')]['id'],'AttachmentId':_0x36cc21['body'][_0xce32('0x9c')]});})[_0xce32('0x27')](function(_0x486775){_0x482968[_0xce32('0x2e')]=_0x486775;if(_0x482968['interaction']['UserId']){return db[_0xce32('0x9d')][_0xce32('0x65')]({'attributes':['id',_0xce32('0x3e')],'where':{'id':_0x482968[_0xce32('0x95')]['UserId']}})[_0xce32('0x27')](function(_0x507af1){if(_0x507af1){_0x482968[_0xce32('0x89')][_0xce32('0x9e')]({'id':0x0,'priority':0x0,'app':'agent','appdata':_0x507af1['name']+','+(_0x482968['account'][_0xce32('0x9f')]||0xa),'interval':'*,*,*,*'});_0x482968[_0xce32('0xa0')]=![];}return respondWithRpcPromise('Start',_0xce32('0xa1'),_0x482968);});}return respondWithRpcPromise('Start',_0xce32('0xa1'),_0x482968);})[_0xce32('0x27')](function(_0x1888b0){respondWithRpcPromise(_0xce32('0xa2'),_0xce32('0xa2'),{'event':_0xce32('0xa3'),'message':_0x1888b0},client9002);return _0x1888b0;})[_0xce32('0x27')](respondWithResult(_0x5d2fbc,null))[_0xce32('0x30')](handleError(_0x5d2fbc,null));};exports['addApplications']=function(_0x17d65a,_0x3ac366,_0x2a52f7){return db[_0xce32('0x53')][_0xce32('0x6b')]({'where':{'id':_0x17d65a[_0xce32('0x58')]['id']}})[_0xce32('0x27')](handleEntityNotFound(_0x3ac366,null))[_0xce32('0x27')](function(_0x59ffd3){if(_0x59ffd3){return db[_0xce32('0xa4')]['transaction'](function(_0x2520a4){return db[_0xce32('0x87')][_0xce32('0xa5')]({'where':{'OpenchannelAccountId':_0x17d65a[_0xce32('0x58')]['id']},'transaction':_0x2520a4})['then'](function(_0x12a6a1){var _0x44e076=_[_0xce32('0x44')](_0x17d65a[_0xce32('0x5d')],function(_0x9c34b5){_0x9c34b5[_0xce32('0x6e')]=_0x17d65a['params']['id'];return _0x9c34b5;});return db['OpenchannelApplication'][_0xce32('0xa6')](_0x44e076,{'transaction':_0x2520a4});});})[_0xce32('0x27')](function(){return db[_0xce32('0x87')]['findAndCountAll']({'where':{'OpenchannelAccountId':_0x17d65a[_0xce32('0x58')]['id']},'order':'priority'});});}})[_0xce32('0x27')](respondWithResult(_0x3ac366,null))[_0xce32('0x30')](handleError(_0x3ac366,null));};exports[_0xce32('0xa7')]=function(_0x457e33,_0x584a4d,_0x352c9c){var _0x512f3a={};var _0x5de8a6={};var _0x3ebffb;var _0x342774;return db['OpenchannelAccount']['findOne']({'where':{'id':_0x457e33[_0xce32('0x58')]['id']}})[_0xce32('0x27')](handleEntityNotFound(_0x584a4d,null))[_0xce32('0x27')](function(_0x100f27){if(_0x100f27){_0x3ebffb=_0x100f27;_0x5de8a6[_0xce32('0x46')]=_[_0xce32('0x45')](db[_0xce32('0x87')][_0xce32('0x5a')]);_0x5de8a6[_0xce32('0x47')]=_[_0xce32('0x45')](_0x457e33[_0xce32('0x47')]);_0x5de8a6[_0xce32('0x4f')]=_[_0xce32('0x5b')](_0x5de8a6[_0xce32('0x46')],_0x5de8a6[_0xce32('0x47')]);_0x512f3a[_0xce32('0x48')]=_[_0xce32('0x5b')](_0x5de8a6[_0xce32('0x46')],qs[_0xce32('0x49')](_0x457e33[_0xce32('0x47')][_0xce32('0x49')]));_0x512f3a['attributes']=_0x512f3a[_0xce32('0x48')][_0xce32('0x4a')]?_0x512f3a[_0xce32('0x48')]:_0x5de8a6[_0xce32('0x46')];_0x512f3a[_0xce32('0x6d')]=qs[_0xce32('0x4c')](_0x457e33[_0xce32('0x47')][_0xce32('0x4c')]);_0x512f3a[_0xce32('0x4d')]=qs[_0xce32('0x4f')](_[_0xce32('0x4e')](_0x457e33['query'],_0x5de8a6[_0xce32('0x4f')]));if(_0x457e33[_0xce32('0x47')][_0xce32('0x50')]){_0x512f3a[_0xce32('0x4d')]=_[_0xce32('0x51')](_0x512f3a[_0xce32('0x4d')],{'$or':_['map'](_0x512f3a[_0xce32('0x48')],function(_0x54bc70){var _0x5ce0db={};_0x5ce0db[_0x54bc70]={'$like':'%'+_0x457e33[_0xce32('0x47')]['filter']+'%'};return _0x5ce0db;})});}_0x512f3a=_['merge']({},_0x512f3a,_0x457e33[_0xce32('0x52')]);return _0x3ebffb[_0xce32('0xa7')](_0x512f3a);}})[_0xce32('0x27')](function(_0x352dde){if(_0x352dde){_0x342774=_0x352dde[_0xce32('0x4a')];if(!_0x457e33[_0xce32('0x47')][_0xce32('0x6c')](_0xce32('0x4b'))){_0x512f3a['limit']=qs[_0xce32('0x36')](_0x457e33[_0xce32('0x47')][_0xce32('0x36')]);_0x512f3a[_0xce32('0x35')]=qs[_0xce32('0x35')](_0x457e33[_0xce32('0x47')][_0xce32('0x35')]);}return _0x3ebffb[_0xce32('0xa7')](_0x512f3a);}})[_0xce32('0x27')](function(_0x32279b){if(_0x32279b){return _0x32279b?{'count':_0x342774,'rows':_0x32279b}:null;}})['then'](respondWithResult(_0x584a4d,null))[_0xce32('0x30')](handleError(_0x584a4d,null));};exports[_0xce32('0xa8')]=function(_0x899d22,_0x5690a2,_0x45c906){var _0x1ea6f5={'raw':![],'where':{}};var _0x4e38d2={};var _0x57d93={'count':0x0,'rows':[]};return db['OpenchannelAccount'][_0xce32('0x6b')]({'where':{'id':_0x899d22[_0xce32('0x58')]['id']}})[_0xce32('0x27')](handleEntityNotFound(_0x5690a2,null))['then'](function(_0x50c6cd){if(_0x50c6cd){_0x4e38d2[_0xce32('0x46')]=_[_0xce32('0x45')](db[_0xce32('0x92')][_0xce32('0x5a')]);_0x4e38d2[_0xce32('0x47')]=_[_0xce32('0x45')](_0x899d22[_0xce32('0x47')]);_0x4e38d2[_0xce32('0x4f')]=_['intersection'](_0x4e38d2[_0xce32('0x46')],_0x4e38d2[_0xce32('0x47')]);_0x1ea6f5[_0xce32('0x48')]=_['intersection'](_0x4e38d2['model'],qs['fields'](_0x899d22[_0xce32('0x47')][_0xce32('0x49')]));_0x1ea6f5[_0xce32('0x48')]=_0x1ea6f5[_0xce32('0x48')]['length']?_0x1ea6f5[_0xce32('0x48')]:_0x4e38d2[_0xce32('0x46')];if(!_0x899d22[_0xce32('0x47')][_0xce32('0x6c')]('nolimit')){_0x1ea6f5[_0xce32('0x36')]=qs[_0xce32('0x36')](_0x899d22[_0xce32('0x47')]['limit']);_0x1ea6f5['offset']=qs['offset'](_0x899d22[_0xce32('0x47')][_0xce32('0x35')]);}_0x1ea6f5[_0xce32('0x6d')]=qs['sort'](_0x899d22[_0xce32('0x47')]['sort']);_0x1ea6f5[_0xce32('0x4d')]=qs['filters'](_[_0xce32('0x4e')](_0x899d22[_0xce32('0x47')],_0x4e38d2['filters']));_0x1ea6f5[_0xce32('0x4d')][_0xce32('0x6e')]=_0x50c6cd['id'];if(_0x899d22['query']['filter']){_0x1ea6f5['where']=_['merge'](_0x1ea6f5[_0xce32('0x4d')],{'$or':_[_0xce32('0x44')](_0x1ea6f5['attributes'],function(_0x6b94c){var _0x1a21e1={};_0x1a21e1[_0x6b94c]={'$like':'%'+_0x899d22[_0xce32('0x47')][_0xce32('0x50')]+'%'};return _0x1a21e1;})});}_0x1ea6f5=_[_0xce32('0x51')]({},_0x1ea6f5,_0x899d22[_0xce32('0x52')]);return db[_0xce32('0x92')][_0xce32('0x34')]({'where':_0x1ea6f5[_0xce32('0x4d')]})[_0xce32('0x27')](function(_0x5aa1ce){_0x57d93['count']=_0x5aa1ce;if(_0x899d22[_0xce32('0x47')]['includeAll']){_0x1ea6f5[_0xce32('0x55')]=[{'model':db['CmContact'],'as':_0xce32('0xa9'),'required':![]},{'model':db[_0xce32('0x9d')],'as':'Owner','attributes':[_0xce32('0x3e'),'fullname','internal'],'required':![]},{'model':db[_0xce32('0xaa')],'as':'Tags','attributes':['id','name',_0xce32('0xab')],'where':_0x899d22['query'][_0xce32('0xac')]?{'id':_0x899d22['query'][_0xce32('0xac')]}:undefined,'required':_0x899d22['query'][_0xce32('0xac')]?!![]:![]}];}return db[_0xce32('0x92')][_0xce32('0xad')](_0x1ea6f5);})[_0xce32('0x27')](function(_0x3f8cea){_0x57d93['rows']=_0x3f8cea;return _0x57d93;});}})[_0xce32('0x27')](respondWithFilteredResult(_0x5690a2,_0x1ea6f5))[_0xce32('0x30')](handleError(_0x5690a2,null));};exports[_0xce32('0xae')]=function(_0x25baea,_0x23e950,_0x5b668c){return db[_0xce32('0x53')][_0xce32('0x65')]({'where':{'id':_0x25baea['params']['id']}})[_0xce32('0x27')](handleEntityNotFound(_0x23e950,null))[_0xce32('0x27')](function(_0x31be04){if(_0x31be04){return _0x31be04[_0xce32('0xae')](_0x25baea[_0xce32('0x5d')][_0xce32('0x70')],_[_0xce32('0xaf')](_0x25baea[_0xce32('0x5d')],[_0xce32('0x70'),'id'])||{})[_0xce32('0x93')](function(_0x1535ae){for(var _0x7da436=0x0;_0x7da436<_0x25baea['body']['ids'][_0xce32('0x4a')];_0x7da436+=0x1){socket[_0xce32('0xb0')]('userOpenchannelAccount:save',{'UserId':_0x25baea[_0xce32('0x5d')][_0xce32('0x70')][_0x7da436],'OpenchannelAccountId':_0x25baea['params']['id']});}return _0x1535ae;});}})['then'](respondWithResult(_0x23e950,null))[_0xce32('0x30')](handleError(_0x23e950,null));};exports[_0xce32('0xb1')]=function(_0x767ed3,_0x3dc291,_0x35ee4c){return db[_0xce32('0x53')][_0xce32('0x65')]({'where':{'id':_0x767ed3[_0xce32('0x58')]['id']}})[_0xce32('0x27')](handleEntityNotFound(_0x3dc291,null))[_0xce32('0x27')](function(_0x32d8a0){if(_0x32d8a0){return _0x32d8a0[_0xce32('0xb1')](_0x767ed3[_0xce32('0x47')]['ids'])['then'](function(){if(_['isArray'](_0x767ed3[_0xce32('0x47')][_0xce32('0x70')])){for(var _0x3534bb=0x0;_0x3534bb<_0x767ed3[_0xce32('0x47')]['ids']['length'];_0x3534bb+=0x1){socket['emit'](_0xce32('0xb2'),{'UserId':Number(_0x767ed3[_0xce32('0x47')][_0xce32('0x70')][_0x3534bb]),'OpenchannelAccountId':Number(_0x767ed3['params']['id'])});}}else{socket[_0xce32('0xb0')](_0xce32('0xb2'),{'UserId':Number(_0x767ed3['query']['ids']),'OpenchannelAccountId':Number(_0x767ed3[_0xce32('0x58')]['id'])});}});}})[_0xce32('0x27')](respondWithStatusCode(_0x3dc291,null))[_0xce32('0x30')](handleError(_0x3dc291,null));};exports['getAgents']=function(_0x5ba1bf,_0x59ff85,_0xe3b07){var _0x3defb0={};var _0x134fe3={};var _0xf4ea6e;var _0x213f89;return db[_0xce32('0x53')][_0xce32('0x6b')]({'where':{'id':_0x5ba1bf['params']['id']}})['then'](handleEntityNotFound(_0x59ff85,null))[_0xce32('0x27')](function(_0x187735){if(_0x187735){_0xf4ea6e=_0x187735;_0x134fe3[_0xce32('0x46')]=_[_0xce32('0x45')](db[_0xce32('0x9d')][_0xce32('0x5a')]);_0x134fe3['query']=_['keys'](_0x5ba1bf[_0xce32('0x47')]);_0x134fe3[_0xce32('0x4f')]=_[_0xce32('0x5b')](_0x134fe3[_0xce32('0x46')],_0x134fe3[_0xce32('0x47')]);_0x3defb0[_0xce32('0x48')]=_['intersection'](_0x134fe3[_0xce32('0x46')],qs['fields'](_0x5ba1bf['query'][_0xce32('0x49')]));_0x3defb0['attributes']=_0x3defb0[_0xce32('0x48')][_0xce32('0x4a')]?_0x3defb0['attributes']:_0x134fe3[_0xce32('0x46')];_0x3defb0[_0xce32('0x6d')]=qs['sort'](_0x5ba1bf[_0xce32('0x47')]['sort']);_0x3defb0[_0xce32('0x4d')]=qs[_0xce32('0x4f')](_[_0xce32('0x4e')](_0x5ba1bf[_0xce32('0x47')],_0x134fe3[_0xce32('0x4f')]));if(_0x5ba1bf['query'][_0xce32('0x50')]){_0x3defb0['where']=_[_0xce32('0x51')](_0x3defb0[_0xce32('0x4d')],{'$or':_['map'](_0x3defb0[_0xce32('0x48')],function(_0x1d3e54){var _0x5636a9={};_0x5636a9[_0x1d3e54]={'$like':'%'+_0x5ba1bf[_0xce32('0x47')][_0xce32('0x50')]+'%'};return _0x5636a9;})});}_0x3defb0=_[_0xce32('0x51')]({},_0x3defb0,_0x5ba1bf['options']);return _0xf4ea6e[_0xce32('0xb3')](_0x3defb0);}})[_0xce32('0x27')](function(_0x545d78){if(_0x545d78){_0x213f89=_0x545d78[_0xce32('0x4a')];if(!_0x5ba1bf[_0xce32('0x47')][_0xce32('0x6c')](_0xce32('0x4b'))){_0x3defb0[_0xce32('0x36')]=qs[_0xce32('0x36')](_0x5ba1bf['query'][_0xce32('0x36')]);_0x3defb0[_0xce32('0x35')]=qs[_0xce32('0x35')](_0x5ba1bf[_0xce32('0x47')][_0xce32('0x35')]);}return _0xf4ea6e[_0xce32('0xb3')](_0x3defb0);}})[_0xce32('0x27')](function(_0x58eade){if(_0x58eade){return _0x58eade?{'count':_0x213f89,'rows':_0x58eade}:null;}})['then'](respondWithResult(_0x59ff85,null))[_0xce32('0x30')](handleError(_0x59ff85,null));};exports['send']=function(_0x42223e,_0x5b9b80,_0x2789f8){var _0x3ca044,_0x70e0ce,_0x4c08a8;if(_[_0xce32('0x7f')](_0x42223e[_0xce32('0x5d')][_0xce32('0x5d')])||_0x42223e[_0xce32('0x5d')][_0xce32('0x5d')]===''){throw new db['Sequelize'][(_0xce32('0x24'))](_0xce32('0x80'));}if(_['isNil'](_0x42223e['body']['to'])){}_0x3ca044=_0x42223e[_0xce32('0x5d')]['to'];return db[_0xce32('0x53')][_0xce32('0x6b')]({'where':{'id':_0x42223e['params']['id']}})[_0xce32('0x27')](handleEntityNotFound(_0x5b9b80,null))[_0xce32('0x27')](function(_0x1de75a){if(_0x1de75a){return db[_0xce32('0x53')][_0xce32('0x65')]({'where':{'id':_0x1de75a['id']},'include':[{'model':db[_0xce32('0x84')],'as':'List','include':[{'model':db[_0xce32('0x76')],'as':_0xce32('0x86'),'where':{[_0x1de75a[_0xce32('0x81')]]:_0x3ca044},'limit':0x1,'order':[[_0xce32('0x7b'),'DESC']]}]}]})['then'](handleEntityNotFound(_0x5b9b80,null))[_0xce32('0x27')](function(_0x2e7439){if(_0x2e7439&&_0x2e7439[_0xce32('0x85')]){_0x70e0ce=_0x2e7439[_0xce32('0x3b')]({'plain':!![]});if(_0x70e0ce[_0xce32('0x85')]&&_0x70e0ce[_0xce32('0x85')]['Contacts'][_0xce32('0x4a')]){return _0x70e0ce[_0xce32('0x85')][_0xce32('0x86')][0x0];}return db[_0xce32('0x76')][_0xce32('0x5c')](_[_0xce32('0x1b')](_0x42223e[_0xce32('0x5d')],{'firstName':_0x3ca044,[_0x2e7439['mapKey']]:_0x3ca044,'phone':_0x3ca044,'ListId':_0x70e0ce[_0xce32('0x7c')]}));}})['then'](handleEntityNotFound(_0x5b9b80,null))[_0xce32('0x27')](function(_0x4f8eeb){if(_0x4f8eeb){_0x4c08a8=_0x4f8eeb;return db['OpenchannelInteraction']['find']({'where':{'ContactId':_0x4c08a8['id'],'closed':![],'OpenchannelAccountId':_0x70e0ce['id']}})['then'](function(_0x4a8408){if(_0x4a8408){return[_0x4a8408,![]];}return db[_0xce32('0x92')][_0xce32('0x5c')]({'UserId':_0x42223e[_0xce32('0x5f')]['id'],'ContactId':_0x4c08a8['id'],'OpenchannelAccountId':_0x70e0ce['id'],'lastMsgDirection':_0xce32('0xb4'),'Messages':[_[_0xce32('0x51')](_0x42223e[_0xce32('0x5d')],{'read':![],'body':_0x42223e[_0xce32('0x5d')][_0xce32('0x5d')],'OpenchannelAccountId':_0x70e0ce['id'],'UserId':_0x42223e['user']['id'],'ContactId':_0x4c08a8['id']})]},{'include':[{'model':db[_0xce32('0x9b')],'as':_0xce32('0xb5')}]})[_0xce32('0x27')](function(_0x11eb1b){return[_0x11eb1b,!![]];});});}})[_0xce32('0x93')](function(_0x3f0d53,_0x34ecaf){if(_0x34ecaf){return _0x3f0d53;}return db[_0xce32('0x9b')][_0xce32('0x5c')](_['merge'](_0x42223e['body'],{'read':![],'body':_0x42223e['body'][_0xce32('0x5d')],'OpenchannelAccountId':_0x70e0ce['id'],'OpenchannelInteractionId':_0x3f0d53['id'],'UserId':_0x42223e[_0xce32('0x5f')]['id'],'ContactId':_0x4c08a8['id']}))['then'](function(_0x474a76){_0x3f0d53[_0xce32('0xb6')]['Messages']=[];_0x3f0d53[_0xce32('0xb6')][_0xce32('0xb5')][_0xce32('0x98')](_0x474a76[_0xce32('0xb6')]);return _0x3f0d53;});});}})[_0xce32('0x27')](respondWithResult(_0x5b9b80,null))['catch'](handleError(_0x5b9b80,null));}; \ No newline at end of file +var _0x9fdd=['json','count','offset','limit','set','apply','reject','save','update','get','UserProfileResource','destroy','index','Pause','mandatoryDispositionPause','map','OpenchannelAccount','rawAttributes','fieldName','key','model','name','query','filters','intersection','attributes','fields','length','nolimit','sort','pick','filter','where','merge','type','VIRTUAL','options','includeAll','include','findAll','rows','params','keys','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','find','userProfileId','autoAssociation','create','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','addDisposition','OpnechannelAccountId','Disposition','findOne','order','OpenchannelAccountId','removeDispositions','addAnswer','CannedAnswer','getAnswers','hasOwnProperty','removeAnswers','ids','notify','openchannel','CmContact','difference','updatedAt','ListId','isNil','from','from\x20is\x20mandatory','mapKey','includes','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','CmList','List','Contacts','DESC','OpenchannelApplication','Applications','account','list','orderBy','asc','contact','firstName','threadId','OpenchannelInteraction','externalUrl','ContactId','spread','messageId','interaction','created','autoclose','push','close','unmanaged','*,*,*,*','OpenchannelMessage','AttachmentId','UserId','User','applications','unshift','agent','forcedOwnership','Start','startRouting','EventManager','addApplications','sequelize','transaction','bulkCreate','findAndCountAll','getApplications','getInteractions','Contact','fullname','internal','Tag','Tags','tag','addAgents','omit','emit','userOpenchannelAccount:save','removeAgents','isArray','userOpenchannelAccount:remove','getAgents','send','body\x20is\x20mandatory\x20and\x20not\x20empty','Messages','dataValues','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','sox','ejs','lodash','squel','crypto','jsforce','to-csv','querystring','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/utils','../../config/environment','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./openchannelAccount.socket','register','jayson/promise','client','http','test','Sequelize','ValidationError','The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.','request','then','OpenchannelAccount,\x20%s,\x20%s','request\x20sent','debug','stringify','error','message','result','catch','sendStatus','status','end'];(function(_0x3a8b56,_0x41e3f2){var _0x3ad7e4=function(_0x53a98d){while(--_0x53a98d){_0x3a8b56['push'](_0x3a8b56['shift']());}};_0x3ad7e4(++_0x41e3f2);}(_0x9fdd,0x14a));var _0xd9fd=function(_0x41d4eb,_0x7d7c6b){_0x41d4eb=_0x41d4eb-0x0;var _0x49105a=_0x9fdd[_0x41d4eb];return _0x49105a;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0xd9fd('0x0'));var rimraf=require(_0xd9fd('0x1'));var zipdir=require(_0xd9fd('0x2'));var jsonpatch=require(_0xd9fd('0x3'));var rp=require('request-promise');var moment=require(_0xd9fd('0x4'));var BPromise=require(_0xd9fd('0x5'));var Mustache=require(_0xd9fd('0x6'));var util=require(_0xd9fd('0x7'));var path=require(_0xd9fd('0x8'));var sox=require(_0xd9fd('0x9'));var csv=require('to-csv');var ejs=require(_0xd9fd('0xa'));var fs=require('fs');var _=require(_0xd9fd('0xb'));var squel=require(_0xd9fd('0xc'));var crypto=require(_0xd9fd('0xd'));var jsforce=require(_0xd9fd('0xe'));var deskjs=require('desk.js');var toCsv=require(_0xd9fd('0xf'));var querystring=require(_0xd9fd('0x10'));var Papa=require('papaparse');var Redis=require(_0xd9fd('0x11'));var authService=require('../../components/auth/service');var qs=require(_0xd9fd('0x12'));var as=require(_0xd9fd('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0xd9fd('0x14'));var utils=require(_0xd9fd('0x15'));var config=require(_0xd9fd('0x16'));var db=require(_0xd9fd('0x17'))['db'];config[_0xd9fd('0x18')]=_[_0xd9fd('0x19')](config[_0xd9fd('0x18')],{'host':_0xd9fd('0x1a'),'port':0x18eb});var socket=require(_0xd9fd('0x1b'))(new Redis(config[_0xd9fd('0x18')]));require(_0xd9fd('0x1c'))[_0xd9fd('0x1d')](socket);var jayson=require(_0xd9fd('0x1e'));var client=jayson[_0xd9fd('0x1f')][_0xd9fd('0x20')]({'port':0x232c});var client9002=jayson['client']['http']({'port':0x232a});function checkPasswordPattern(_0x21432f,_0x50152f,_0x9f9473){if(_0x9f9473){var _0x8efd0e=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x8efd0e[_0xd9fd('0x21')](_0x50152f)){return _0x21432f;}else{throw new db[(_0xd9fd('0x22'))][(_0xd9fd('0x23'))](_0xd9fd('0x24'));}}else{return _0x21432f;}}function respondWithRpcPromise(_0x4683af,_0xa0806e,_0x4aefb6,_0xe50dec){return new BPromise(function(_0x306672,_0x592be8){var _0x7de043=_0xe50dec||client;return _0x7de043[_0xd9fd('0x25')](_0x4683af,_0x4aefb6)[_0xd9fd('0x26')](function(_0x4f0831){logger['info'](_0xd9fd('0x27'),_0xa0806e,_0xd9fd('0x28'));logger[_0xd9fd('0x29')]('OpenchannelAccount,\x20%s,\x20%s,\x20%s',_0xa0806e,_0xd9fd('0x28'),JSON[_0xd9fd('0x2a')](_0x4f0831));if(_0x4f0831[_0xd9fd('0x2b')]){if(_0x4f0831[_0xd9fd('0x2b')]['code']===0x1f4){logger[_0xd9fd('0x2b')](_0xd9fd('0x27'),_0xa0806e,_0x4f0831[_0xd9fd('0x2b')]['message']);return _0x592be8(_0x4f0831[_0xd9fd('0x2b')]['message']);}logger['error']('OpenchannelAccount,\x20%s,\x20%s',_0xa0806e,_0x4f0831[_0xd9fd('0x2b')][_0xd9fd('0x2c')]);return _0x306672(_0x4f0831[_0xd9fd('0x2b')]['message']);}else{logger['info']('OpenchannelAccount,\x20%s,\x20%s',_0xa0806e,'request\x20sent');_0x306672(_0x4f0831[_0xd9fd('0x2d')][_0xd9fd('0x2c')]);}})[_0xd9fd('0x2e')](function(_0x4054da){logger[_0xd9fd('0x2b')](_0xd9fd('0x27'),_0xa0806e,_0x4054da);_0x592be8(_0x4054da);});});}function respondWithStatusCode(_0x46f6a5,_0x2d47a4){_0x2d47a4=_0x2d47a4||0xcc;return function(_0x460c3c){if(_0x460c3c){return _0x46f6a5[_0xd9fd('0x2f')](_0x2d47a4);}return _0x46f6a5[_0xd9fd('0x30')](_0x2d47a4)[_0xd9fd('0x31')]();};}function respondWithResult(_0x3b3b22,_0x47a95f){_0x47a95f=_0x47a95f||0xc8;return function(_0x289d60){if(_0x289d60){return _0x3b3b22[_0xd9fd('0x30')](_0x47a95f)[_0xd9fd('0x32')](_0x289d60);}};}function respondWithFilteredResult(_0x41f041,_0x44076c){return function(_0x582525){if(_0x582525){var _0x106601=_0x582525[_0xd9fd('0x33')],_0xbece4f=_0x44076c[_0xd9fd('0x34')],_0x8ad477=_0x44076c['offset']+_0x44076c[_0xd9fd('0x35')],_0x2a7b33;if(_0x8ad477>=_0x106601){_0x8ad477=_0x106601;_0x2a7b33=0xc8;}else{_0x2a7b33=0xce;}_0x41f041[_0xd9fd('0x30')](_0x2a7b33);return _0x41f041[_0xd9fd('0x36')]('Content-Range',_0xbece4f+'-'+_0x8ad477+'/'+_0x106601)[_0xd9fd('0x32')](_0x582525);}return null;};}function patchUpdates(_0x30993b){return function(_0x40bfbe){try{jsonpatch[_0xd9fd('0x37')](_0x40bfbe,_0x30993b,!![]);}catch(_0x517abe){return BPromise[_0xd9fd('0x38')](_0x517abe);}return _0x40bfbe[_0xd9fd('0x39')]();};}function saveUpdates(_0x54965c,_0x214825){return function(_0x4d5bdc){if(_0x4d5bdc){return _0x4d5bdc[_0xd9fd('0x3a')](_0x54965c)[_0xd9fd('0x26')](function(_0x19fd9b){return _0x19fd9b;});}return null;};}function removeEntity(_0x330688,_0x10d142){return function(_0x1b3531){if(_0x1b3531){return _0x1b3531['destroy']()[_0xd9fd('0x26')](function(){var _0x4f4c27=_0x1b3531[_0xd9fd('0x3b')]({'plain':!![]});var _0x5a3f25='OpenchannelAccounts';return db[_0xd9fd('0x3c')][_0xd9fd('0x3d')]({'where':{'type':_0x5a3f25,'resourceId':_0x4f4c27['id']}})[_0xd9fd('0x26')](function(){return _0x1b3531;});})[_0xd9fd('0x26')](function(){_0x330688[_0xd9fd('0x30')](0xcc)[_0xd9fd('0x31')]();});}};}function handleEntityNotFound(_0x3879c2,_0x15de04){return function(_0x19f262){if(!_0x19f262){_0x3879c2[_0xd9fd('0x2f')](0x194);}return _0x19f262;};}function handleError(_0x43eca5,_0x127800){_0x127800=_0x127800||0x1f4;return function(_0x1778c3){logger[_0xd9fd('0x2b')](_0x1778c3['stack']);if(_0x1778c3['name']){delete _0x1778c3['name'];}_0x43eca5[_0xd9fd('0x30')](_0x127800)['send'](_0x1778c3);};}exports[_0xd9fd('0x3e')]=function(_0x3a9157,_0xfdc48e){var _0x6a9626={'include':[{'model':db[_0xd9fd('0x3f')],'as':_0xd9fd('0x40')}]},_0x183905={},_0x8f520={'count':0x0,'rows':[]};var _0x301ce2=_[_0xd9fd('0x41')](db[_0xd9fd('0x42')][_0xd9fd('0x43')],function(_0xfc2f36){return{'name':_0xfc2f36[_0xd9fd('0x44')],'type':_0xfc2f36['type'][_0xd9fd('0x45')]};});_0x183905[_0xd9fd('0x46')]=_[_0xd9fd('0x41')](_0x301ce2,_0xd9fd('0x47'));_0x183905[_0xd9fd('0x48')]=_['keys'](_0x3a9157['query']);_0x183905[_0xd9fd('0x49')]=_[_0xd9fd('0x4a')](_0x183905[_0xd9fd('0x46')],_0x183905['query']);_0x6a9626[_0xd9fd('0x4b')]=_['intersection'](_0x183905[_0xd9fd('0x46')],qs[_0xd9fd('0x4c')](_0x3a9157[_0xd9fd('0x48')][_0xd9fd('0x4c')]));_0x6a9626[_0xd9fd('0x4b')]=_0x6a9626[_0xd9fd('0x4b')][_0xd9fd('0x4d')]?_0x6a9626[_0xd9fd('0x4b')]:_0x183905[_0xd9fd('0x46')];if(!_0x3a9157['query']['hasOwnProperty'](_0xd9fd('0x4e'))){_0x6a9626['limit']=qs['limit'](_0x3a9157[_0xd9fd('0x48')][_0xd9fd('0x35')]);_0x6a9626[_0xd9fd('0x34')]=qs[_0xd9fd('0x34')](_0x3a9157[_0xd9fd('0x48')][_0xd9fd('0x34')]);}_0x6a9626['order']=qs[_0xd9fd('0x4f')](_0x3a9157[_0xd9fd('0x48')]['sort']);_0x6a9626['where']=qs[_0xd9fd('0x49')](_[_0xd9fd('0x50')](_0x3a9157[_0xd9fd('0x48')],_0x183905['filters']));if(_0x3a9157[_0xd9fd('0x48')][_0xd9fd('0x51')]){_0x6a9626[_0xd9fd('0x52')]=_[_0xd9fd('0x53')](_0x6a9626[_0xd9fd('0x52')],{'$or':_[_0xd9fd('0x41')](_0x301ce2,function(_0x29f6a7){if(_0x29f6a7[_0xd9fd('0x54')]!==_0xd9fd('0x55')){var _0x56d656={};_0x56d656[_0x29f6a7['name']]={'$like':'%'+_0x3a9157['query'][_0xd9fd('0x51')]+'%'};return _0x56d656;}})});}_0x6a9626=_[_0xd9fd('0x53')]({},_0x6a9626,_0x3a9157[_0xd9fd('0x56')]);var _0x5152ba={'where':_0x6a9626[_0xd9fd('0x52')]};return db[_0xd9fd('0x42')][_0xd9fd('0x33')](_0x5152ba)[_0xd9fd('0x26')](function(_0x51951b){_0x8f520['count']=_0x51951b;if(_0x3a9157[_0xd9fd('0x48')][_0xd9fd('0x57')]){_0x6a9626[_0xd9fd('0x58')]=[{'all':!![]}];}return db[_0xd9fd('0x42')][_0xd9fd('0x59')](_0x6a9626);})[_0xd9fd('0x26')](function(_0x5d425f){_0x8f520[_0xd9fd('0x5a')]=_0x5d425f;return _0x8f520;})[_0xd9fd('0x26')](respondWithFilteredResult(_0xfdc48e,_0x6a9626))[_0xd9fd('0x2e')](handleError(_0xfdc48e,null));};exports['show']=function(_0x5f1369,_0x11d2bb){var _0x450b6e={'raw':![],'where':{'id':_0x5f1369[_0xd9fd('0x5b')]['id']},'include':[{'model':db[_0xd9fd('0x3f')],'as':_0xd9fd('0x40')}]},_0x44efa8={};_0x44efa8[_0xd9fd('0x46')]=_[_0xd9fd('0x5c')](db['OpenchannelAccount']['rawAttributes']);_0x44efa8['query']=_['keys'](_0x5f1369[_0xd9fd('0x48')]);_0x44efa8[_0xd9fd('0x49')]=_['intersection'](_0x44efa8[_0xd9fd('0x46')],_0x44efa8[_0xd9fd('0x48')]);_0x450b6e[_0xd9fd('0x4b')]=_[_0xd9fd('0x4a')](_0x44efa8[_0xd9fd('0x46')],qs['fields'](_0x5f1369['query'][_0xd9fd('0x4c')]));_0x450b6e[_0xd9fd('0x4b')]=_0x450b6e[_0xd9fd('0x4b')][_0xd9fd('0x4d')]?_0x450b6e[_0xd9fd('0x4b')]:_0x44efa8[_0xd9fd('0x46')];if(_0x5f1369[_0xd9fd('0x48')][_0xd9fd('0x57')]){_0x450b6e['include']=[{'all':!![]}];}_0x450b6e=_[_0xd9fd('0x53')]({},_0x450b6e,_0x5f1369['options']);return db[_0xd9fd('0x42')]['find'](_0x450b6e)[_0xd9fd('0x26')](handleEntityNotFound(_0x11d2bb,null))[_0xd9fd('0x26')](respondWithResult(_0x11d2bb,null))[_0xd9fd('0x2e')](handleError(_0x11d2bb,null));};exports['create']=function(_0x907cb8,_0x5b2b43){return db[_0xd9fd('0x42')]['create'](_0x907cb8[_0xd9fd('0x5d')],{})[_0xd9fd('0x26')](function(_0x190882){var _0xce1d1e=_0x907cb8[_0xd9fd('0x5e')][_0xd9fd('0x3b')]({'plain':!![]});if(!_0xce1d1e)throw new Error(_0xd9fd('0x5f'));if(_0xce1d1e[_0xd9fd('0x60')]===_0xd9fd('0x5e')){var _0x2e8c60=_0x190882['get']({'plain':!![]});var _0xdfc499='OpenchannelAccounts';return db[_0xd9fd('0x61')][_0xd9fd('0x62')]({'where':{'name':_0xdfc499,'userProfileId':_0xce1d1e[_0xd9fd('0x63')]},'raw':!![]})[_0xd9fd('0x26')](function(_0x58fbda){if(_0x58fbda&&_0x58fbda[_0xd9fd('0x64')]===0x0){return db[_0xd9fd('0x3c')][_0xd9fd('0x65')]({'name':_0x2e8c60['name'],'resourceId':_0x2e8c60['id'],'type':_0x58fbda[_0xd9fd('0x47')],'sectionId':_0x58fbda['id']},{})['then'](function(){return _0x190882;});}else{return _0x190882;}})[_0xd9fd('0x2e')](function(_0x5acf0a){logger[_0xd9fd('0x2b')](_0xd9fd('0x66'),_0x5acf0a);throw _0x5acf0a;});}return _0x190882;})[_0xd9fd('0x26')](respondWithResult(_0x5b2b43,0xc9))[_0xd9fd('0x2e')](handleError(_0x5b2b43,null));};exports[_0xd9fd('0x3a')]=function(_0x380811,_0x2d6a24){if(_0x380811[_0xd9fd('0x5d')]['id']){delete _0x380811['body']['id'];}return db[_0xd9fd('0x42')][_0xd9fd('0x62')]({'where':{'id':_0x380811['params']['id']},'include':[{'model':db[_0xd9fd('0x3f')],'as':'mandatoryDispositionPause'}]})[_0xd9fd('0x26')](handleEntityNotFound(_0x2d6a24,null))[_0xd9fd('0x26')](saveUpdates(_0x380811[_0xd9fd('0x5d')],null))[_0xd9fd('0x26')](respondWithResult(_0x2d6a24,null))[_0xd9fd('0x2e')](handleError(_0x2d6a24,null));};exports[_0xd9fd('0x3d')]=function(_0x35a6d0,_0x2de2e5){return db[_0xd9fd('0x42')][_0xd9fd('0x62')]({'where':{'id':_0x35a6d0[_0xd9fd('0x5b')]['id']}})[_0xd9fd('0x26')](handleEntityNotFound(_0x2de2e5,null))['then'](removeEntity(_0x2de2e5,null))[_0xd9fd('0x2e')](handleError(_0x2de2e5,null));};exports['describe']=function(_0x47cca5,_0x79959){return db[_0xd9fd('0x42')][_0xd9fd('0x67')]()[_0xd9fd('0x26')](respondWithResult(_0x79959,null))[_0xd9fd('0x2e')](handleError(_0x79959,null));};exports[_0xd9fd('0x68')]=function(_0x153ae0,_0x5d5d01,_0x345a8f){if(_0x153ae0[_0xd9fd('0x5d')]['id']){delete _0x153ae0[_0xd9fd('0x5d')]['id'];}return db['OpenchannelAccount'][_0xd9fd('0x62')]({'where':{'id':_0x153ae0[_0xd9fd('0x5b')]['id']}})[_0xd9fd('0x26')](handleEntityNotFound(_0x5d5d01,null))[_0xd9fd('0x26')](function(_0x242b9c){if(_0x242b9c){_0x153ae0['body'][_0xd9fd('0x69')]=_0x242b9c['id'];return db[_0xd9fd('0x6a')][_0xd9fd('0x65')](_0x153ae0[_0xd9fd('0x5d')]);}})[_0xd9fd('0x26')](respondWithResult(_0x5d5d01,null))[_0xd9fd('0x2e')](handleError(_0x5d5d01,null));};exports['getDispositions']=function(_0x5d5c6d,_0x18bba7,_0x54e477){var _0x4b6ffe={'raw':![],'where':{}};var _0x2756e2={};var _0xdfe5b0={'count':0x0,'rows':[]};return db[_0xd9fd('0x42')][_0xd9fd('0x6b')]({'where':{'id':_0x5d5c6d['params']['id']}})[_0xd9fd('0x26')](handleEntityNotFound(_0x18bba7,null))['then'](function(_0x4a65d6){if(_0x4a65d6){_0x2756e2['model']=_[_0xd9fd('0x5c')](db[_0xd9fd('0x6a')][_0xd9fd('0x43')]);_0x2756e2['query']=_['keys'](_0x5d5c6d['query']);_0x2756e2[_0xd9fd('0x49')]=_[_0xd9fd('0x4a')](_0x2756e2[_0xd9fd('0x46')],_0x2756e2[_0xd9fd('0x48')]);_0x4b6ffe[_0xd9fd('0x4b')]=_[_0xd9fd('0x4a')](_0x2756e2['model'],qs[_0xd9fd('0x4c')](_0x5d5c6d['query'][_0xd9fd('0x4c')]));_0x4b6ffe[_0xd9fd('0x4b')]=_0x4b6ffe[_0xd9fd('0x4b')][_0xd9fd('0x4d')]?_0x4b6ffe[_0xd9fd('0x4b')]:_0x2756e2[_0xd9fd('0x46')];if(!_0x5d5c6d[_0xd9fd('0x48')]['hasOwnProperty']('nolimit')){_0x4b6ffe[_0xd9fd('0x35')]=qs[_0xd9fd('0x35')](_0x5d5c6d[_0xd9fd('0x48')][_0xd9fd('0x35')]);_0x4b6ffe['offset']=qs[_0xd9fd('0x34')](_0x5d5c6d['query'][_0xd9fd('0x34')]);}_0x4b6ffe[_0xd9fd('0x6c')]=qs[_0xd9fd('0x4f')](_0x5d5c6d[_0xd9fd('0x48')][_0xd9fd('0x4f')]);_0x4b6ffe[_0xd9fd('0x52')]=qs[_0xd9fd('0x49')](_[_0xd9fd('0x50')](_0x5d5c6d[_0xd9fd('0x48')],_0x2756e2[_0xd9fd('0x49')]));_0x4b6ffe[_0xd9fd('0x52')][_0xd9fd('0x6d')]=_0x4a65d6['id'];if(_0x5d5c6d[_0xd9fd('0x48')][_0xd9fd('0x51')]){_0x4b6ffe['where']=_[_0xd9fd('0x53')](_0x4b6ffe[_0xd9fd('0x52')],{'$or':_[_0xd9fd('0x41')](_0x4b6ffe[_0xd9fd('0x4b')],function(_0x57f687){var _0xc3d49a={};_0xc3d49a[_0x57f687]={'$like':'%'+_0x5d5c6d[_0xd9fd('0x48')][_0xd9fd('0x51')]+'%'};return _0xc3d49a;})});}_0x4b6ffe=_[_0xd9fd('0x53')]({},_0x4b6ffe,_0x5d5c6d['options']);return db['Disposition'][_0xd9fd('0x33')]({'where':_0x4b6ffe[_0xd9fd('0x52')]})[_0xd9fd('0x26')](function(_0x58aaac){_0xdfe5b0['count']=_0x58aaac;if(_0x5d5c6d[_0xd9fd('0x48')][_0xd9fd('0x57')]){_0x4b6ffe[_0xd9fd('0x58')]=[{'all':!![]}];}return db[_0xd9fd('0x6a')]['findAll'](_0x4b6ffe);})[_0xd9fd('0x26')](function(_0x3aa1df){_0xdfe5b0[_0xd9fd('0x5a')]=_0x3aa1df;return _0xdfe5b0;});}})[_0xd9fd('0x26')](respondWithFilteredResult(_0x18bba7,_0x4b6ffe))[_0xd9fd('0x2e')](handleError(_0x18bba7,null));};exports[_0xd9fd('0x6e')]=function(_0x59d649,_0x120658,_0x932da1){return db[_0xd9fd('0x42')][_0xd9fd('0x62')]({'where':{'id':_0x59d649[_0xd9fd('0x5b')]['id']}})[_0xd9fd('0x26')](handleEntityNotFound(_0x120658,null))[_0xd9fd('0x26')](function(_0x43a9ce){if(_0x43a9ce){return _0x43a9ce['removeDispositions'](_0x59d649[_0xd9fd('0x48')]['ids']);}})[_0xd9fd('0x26')](respondWithStatusCode(_0x120658,null))[_0xd9fd('0x2e')](handleError(_0x120658,null));};exports[_0xd9fd('0x6f')]=function(_0x4fd3b1,_0x5b387f,_0x37caea){if(_0x4fd3b1[_0xd9fd('0x5d')]['id']){delete _0x4fd3b1[_0xd9fd('0x5d')]['id'];}return db['OpenchannelAccount']['find']({'where':{'id':_0x4fd3b1[_0xd9fd('0x5b')]['id']}})[_0xd9fd('0x26')](handleEntityNotFound(_0x5b387f,null))[_0xd9fd('0x26')](function(_0x585423){if(_0x585423){_0x4fd3b1['body'][_0xd9fd('0x6d')]=_0x585423['id'];return db[_0xd9fd('0x70')][_0xd9fd('0x65')](_0x4fd3b1['body']);}})['then'](respondWithResult(_0x5b387f,null))[_0xd9fd('0x2e')](handleError(_0x5b387f,null));};exports[_0xd9fd('0x71')]=function(_0x219ed8,_0x4ce76a,_0x2ad131){var _0xd8a486={'raw':![],'where':{}};var _0x4cecd6={};var _0x1af0d8={'count':0x0,'rows':[]};return db[_0xd9fd('0x42')][_0xd9fd('0x6b')]({'where':{'id':_0x219ed8['params']['id']}})[_0xd9fd('0x26')](handleEntityNotFound(_0x4ce76a,null))[_0xd9fd('0x26')](function(_0x2405e3){if(_0x2405e3){_0x4cecd6['model']=_[_0xd9fd('0x5c')](db[_0xd9fd('0x70')][_0xd9fd('0x43')]);_0x4cecd6[_0xd9fd('0x48')]=_[_0xd9fd('0x5c')](_0x219ed8[_0xd9fd('0x48')]);_0x4cecd6['filters']=_[_0xd9fd('0x4a')](_0x4cecd6['model'],_0x4cecd6['query']);_0xd8a486[_0xd9fd('0x4b')]=_['intersection'](_0x4cecd6['model'],qs['fields'](_0x219ed8['query'][_0xd9fd('0x4c')]));_0xd8a486[_0xd9fd('0x4b')]=_0xd8a486[_0xd9fd('0x4b')]['length']?_0xd8a486[_0xd9fd('0x4b')]:_0x4cecd6[_0xd9fd('0x46')];if(!_0x219ed8[_0xd9fd('0x48')][_0xd9fd('0x72')](_0xd9fd('0x4e'))){_0xd8a486[_0xd9fd('0x35')]=qs['limit'](_0x219ed8['query'][_0xd9fd('0x35')]);_0xd8a486[_0xd9fd('0x34')]=qs[_0xd9fd('0x34')](_0x219ed8[_0xd9fd('0x48')][_0xd9fd('0x34')]);}_0xd8a486[_0xd9fd('0x6c')]=qs['sort'](_0x219ed8[_0xd9fd('0x48')][_0xd9fd('0x4f')]);_0xd8a486[_0xd9fd('0x52')]=qs['filters'](_[_0xd9fd('0x50')](_0x219ed8[_0xd9fd('0x48')],_0x4cecd6[_0xd9fd('0x49')]));_0xd8a486['where'][_0xd9fd('0x6d')]=_0x2405e3['id'];if(_0x219ed8[_0xd9fd('0x48')][_0xd9fd('0x51')]){_0xd8a486[_0xd9fd('0x52')]=_['merge'](_0xd8a486['where'],{'$or':_[_0xd9fd('0x41')](_0xd8a486[_0xd9fd('0x4b')],function(_0x8adb87){var _0x521940={};_0x521940[_0x8adb87]={'$like':'%'+_0x219ed8[_0xd9fd('0x48')]['filter']+'%'};return _0x521940;})});}_0xd8a486=_[_0xd9fd('0x53')]({},_0xd8a486,_0x219ed8[_0xd9fd('0x56')]);return db[_0xd9fd('0x70')][_0xd9fd('0x33')]({'where':_0xd8a486['where']})[_0xd9fd('0x26')](function(_0x31a664){_0x1af0d8['count']=_0x31a664;if(_0x219ed8[_0xd9fd('0x48')][_0xd9fd('0x57')]){_0xd8a486[_0xd9fd('0x58')]=[{'all':!![]}];}return db[_0xd9fd('0x70')][_0xd9fd('0x59')](_0xd8a486);})[_0xd9fd('0x26')](function(_0x4de4cb){_0x1af0d8[_0xd9fd('0x5a')]=_0x4de4cb;return _0x1af0d8;});}})[_0xd9fd('0x26')](respondWithFilteredResult(_0x4ce76a,_0xd8a486))[_0xd9fd('0x2e')](handleError(_0x4ce76a,null));};exports[_0xd9fd('0x73')]=function(_0x26e926,_0x356812,_0x2d067c){return db['OpenchannelAccount'][_0xd9fd('0x62')]({'where':{'id':_0x26e926[_0xd9fd('0x5b')]['id']}})[_0xd9fd('0x26')](handleEntityNotFound(_0x356812,null))['then'](function(_0x398249){if(_0x398249){return _0x398249[_0xd9fd('0x73')](_0x26e926[_0xd9fd('0x48')][_0xd9fd('0x74')]);}})[_0xd9fd('0x26')](respondWithStatusCode(_0x356812,null))[_0xd9fd('0x2e')](handleError(_0x356812,null));};exports[_0xd9fd('0x75')]=function(_0x21aedc,_0x47f9b7,_0x1fde2e){var _0x3ecbb2={'body':_0x21aedc['body'],'channel':_0xd9fd('0x76')};var _0x33198f=[];var _0x1055ff=[];var _0x2d0f95={};var _0x29ded4=![];return db[_0xd9fd('0x77')][_0xd9fd('0x67')]()[_0xd9fd('0x26')](function(_0x2494a0){if(!_0x2494a0){throw new db[(_0xd9fd('0x22'))][(_0xd9fd('0x23'))]('no\x20available\x20attributes');}_0x33198f=_[_0xd9fd('0x78')](_[_0xd9fd('0x5c')](_0x2494a0),['createdAt',_0xd9fd('0x79')]);_0x1055ff=_[_0xd9fd('0x78')](_[_0xd9fd('0x5c')](_0x2494a0),['createdAt',_0xd9fd('0x79'),'CompanyId',_0xd9fd('0x7a')]);if(_0x21aedc[_0xd9fd('0x5d')]['id']){delete _0x21aedc[_0xd9fd('0x5d')]['id'];}if(_[_0xd9fd('0x7b')](_0x21aedc['body'][_0xd9fd('0x7c')])){throw new db[(_0xd9fd('0x22'))][(_0xd9fd('0x23'))](_0xd9fd('0x7d'));}if(_[_0xd9fd('0x7b')](_0x21aedc[_0xd9fd('0x5d')][_0xd9fd('0x5d')])||_0x21aedc[_0xd9fd('0x5d')][_0xd9fd('0x5d')]===''){throw new db[(_0xd9fd('0x22'))]['ValidationError']('body\x20is\x20mandatory\x20and\x20not\x20empty');}if(_[_0xd9fd('0x7b')](_0x21aedc[_0xd9fd('0x5d')][_0xd9fd('0x7e')])){throw new db[(_0xd9fd('0x22'))][(_0xd9fd('0x23'))]('mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20'+_0x1055ff);}if(!_[_0xd9fd('0x7f')](_0x1055ff,_0x21aedc[_0xd9fd('0x5d')][_0xd9fd('0x7e')])){throw new db[(_0xd9fd('0x22'))][(_0xd9fd('0x23'))](_0xd9fd('0x80')+_0x1055ff);}_0x2d0f95[_0x21aedc[_0xd9fd('0x5d')][_0xd9fd('0x7e')]]=_0x21aedc[_0xd9fd('0x5d')]['from'];})[_0xd9fd('0x26')](function(){return db[_0xd9fd('0x42')][_0xd9fd('0x62')]({'where':{'id':_0x21aedc['params']['id']},'include':[{'model':db[_0xd9fd('0x81')],'as':_0xd9fd('0x82'),'include':[{'model':db['CmContact'],'as':_0xd9fd('0x83'),'where':_0x2d0f95,'limit':0x1,'order':[['updatedAt',_0xd9fd('0x84')]]}]},{'model':db[_0xd9fd('0x85')],'as':_0xd9fd('0x86')}]});})[_0xd9fd('0x26')](handleEntityNotFound(_0x47f9b7,null))[_0xd9fd('0x26')](function(_0x273b06){if(_0x273b06&&_0x273b06[_0xd9fd('0x82')]){_0x3ecbb2[_0xd9fd('0x87')]=_0x273b06;_0x3ecbb2['applications']=_0x273b06['Applications'];_0x3ecbb2[_0xd9fd('0x88')]=_0x273b06[_0xd9fd('0x82')];_0x3ecbb2['applications']=_[_0xd9fd('0x89')](_0x3ecbb2['applications'],['priority'],[_0xd9fd('0x8a')]);if(_0x3ecbb2['account'][_0xd9fd('0x86')]){delete _0x3ecbb2[_0xd9fd('0x87')][_0xd9fd('0x86')];}if(_0x3ecbb2[_0xd9fd('0x87')][_0xd9fd('0x82')]&&_0x3ecbb2[_0xd9fd('0x87')]['List'][_0xd9fd('0x83')]['length']){return _0x3ecbb2[_0xd9fd('0x87')][_0xd9fd('0x82')][_0xd9fd('0x83')][0x0];}var _0x4b53b1=_[_0xd9fd('0x19')](_0x21aedc[_0xd9fd('0x5d')],{'firstName':_0x21aedc[_0xd9fd('0x5d')]['from'],'ListId':_0x273b06[_0xd9fd('0x7a')]});_0x4b53b1[_0x21aedc[_0xd9fd('0x5d')][_0xd9fd('0x7e')]]=_0x21aedc[_0xd9fd('0x5d')][_0xd9fd('0x7c')];return db['CmContact'][_0xd9fd('0x65')](_0x4b53b1,{'fields':_0x33198f,'raw':!![]});}})['then'](handleEntityNotFound(_0x47f9b7,null))[_0xd9fd('0x26')](function(_0x48b47d){_0x3ecbb2[_0xd9fd('0x8b')]=_0x48b47d;if(_0x48b47d){var _0x526d50={'ContactId':_0x48b47d['id'],'OpenchannelAccountId':_0x21aedc['params']['id'],'from':(_0x48b47d[_0xd9fd('0x8c')]||'')+'\x20'+(_0x48b47d['lastName']||'')};var _0x5bff78={'OpenchannelAccountId':_0x21aedc['params']['id'],'closed':![]};if(_0x21aedc[_0xd9fd('0x5d')][_0xd9fd('0x8d')]){_0x5bff78[_0xd9fd('0x8d')]=_0x21aedc[_0xd9fd('0x5d')][_0xd9fd('0x8d')];return db[_0xd9fd('0x8e')]['find']({'where':_0x5bff78})[_0xd9fd('0x26')](function(_0x5cf8a1){if(_0x5cf8a1){return[_0x5cf8a1,![]];}_0x526d50['threadId']=_0x21aedc[_0xd9fd('0x5d')][_0xd9fd('0x8d')];_0x526d50['externalUrl']=_0x21aedc[_0xd9fd('0x5d')][_0xd9fd('0x8f')];return db[_0xd9fd('0x8e')][_0xd9fd('0x65')](_0x526d50)['then'](function(_0x9b7946){return[_0x9b7946,!![]];});});}else{_0x5bff78[_0xd9fd('0x8d')]=null;}_0x5bff78[_0xd9fd('0x90')]=_0x48b47d['id'];return db[_0xd9fd('0x8e')][_0xd9fd('0x62')]({'where':_0x5bff78})[_0xd9fd('0x26')](function(_0x3308e5){if(_0x3308e5){return[_0x3308e5,![]];}return db['OpenchannelInteraction'][_0xd9fd('0x65')](_0x526d50)[_0xd9fd('0x26')](function(_0x50c77e){return[_0x50c77e,!![]];});});}})[_0xd9fd('0x91')](function(_0x2e02ee,_0x1e1bdf){if(_0x2e02ee){_0x29ded4=_0x1e1bdf;if(!_0x1e1bdf){var _0x5280f3={'from':(_0x3ecbb2[_0xd9fd('0x8b')]['firstName']||'')+'\x20'+(_0x3ecbb2[_0xd9fd('0x8b')]['lastName']||'')};if(_0x21aedc[_0xd9fd('0x5d')][_0xd9fd('0x8d')]&&_0x21aedc[_0xd9fd('0x5d')][_0xd9fd('0x92')]&&_0x21aedc[_0xd9fd('0x5d')][_0xd9fd('0x8d')]!=_0x21aedc[_0xd9fd('0x5d')][_0xd9fd('0x92')]){_0x5280f3[_0xd9fd('0x8d')]=_0x21aedc[_0xd9fd('0x5d')][_0xd9fd('0x92')];}return _0x2e02ee[_0xd9fd('0x3a')](_0x5280f3);}else{return _0x2e02ee;}}})[_0xd9fd('0x26')](function(_0x4e789e){_0x3ecbb2[_0xd9fd('0x93')]=_0x4e789e[_0xd9fd('0x3b')]({'plain':!![]});_0x3ecbb2[_0xd9fd('0x93')]['created']=_0x29ded4;if(_0x3ecbb2[_0xd9fd('0x93')][_0xd9fd('0x94')]){if(_0x3ecbb2[_0xd9fd('0x87')][_0xd9fd('0x95')]){_0x3ecbb2['applications'][_0xd9fd('0x96')]({'id':0x0,'priority':_0x3ecbb2['applications'][_0xd9fd('0x4d')]+0x1,'app':_0xd9fd('0x97'),'appdata':_0xd9fd('0x98'),'interval':_0xd9fd('0x99')});}}return db[_0xd9fd('0x9a')][_0xd9fd('0x65')]({'body':_0x21aedc['body'][_0xd9fd('0x5d')],'OpenchannelAccountId':_0x21aedc[_0xd9fd('0x5b')]['id'],'OpenchannelInteractionId':_0x4e789e['id'],'direction':'in','ContactId':_0x3ecbb2['contact']['id'],'AttachmentId':_0x21aedc['body'][_0xd9fd('0x9b')]});})[_0xd9fd('0x26')](function(_0x2eb418){_0x3ecbb2[_0xd9fd('0x2c')]=_0x2eb418;if(_0x3ecbb2[_0xd9fd('0x93')][_0xd9fd('0x9c')]){return db[_0xd9fd('0x9d')][_0xd9fd('0x62')]({'attributes':['id','name'],'where':{'id':_0x3ecbb2['interaction']['UserId']}})[_0xd9fd('0x26')](function(_0x19dcaa){if(_0x19dcaa){_0x3ecbb2[_0xd9fd('0x9e')][_0xd9fd('0x9f')]({'id':0x0,'priority':0x0,'app':_0xd9fd('0xa0'),'appdata':_0x19dcaa['name']+','+(_0x3ecbb2[_0xd9fd('0x87')]['waitForTheAssignedAgent']||0xa),'interval':_0xd9fd('0x99')});_0x3ecbb2[_0xd9fd('0xa1')]=![];}return respondWithRpcPromise(_0xd9fd('0xa2'),_0xd9fd('0xa3'),_0x3ecbb2);});}return respondWithRpcPromise(_0xd9fd('0xa2'),'startRouting',_0x3ecbb2);})[_0xd9fd('0x26')](function(_0x488c2e){respondWithRpcPromise(_0xd9fd('0xa4'),'EventManager',{'event':'notify','message':_0x488c2e},client9002);return _0x488c2e;})[_0xd9fd('0x26')](respondWithResult(_0x47f9b7,null))['catch'](handleError(_0x47f9b7,null));};exports[_0xd9fd('0xa5')]=function(_0x2f514e,_0x488873,_0x250c0d){return db[_0xd9fd('0x42')][_0xd9fd('0x6b')]({'where':{'id':_0x2f514e['params']['id']}})[_0xd9fd('0x26')](handleEntityNotFound(_0x488873,null))['then'](function(_0x13672d){if(_0x13672d){return db[_0xd9fd('0xa6')][_0xd9fd('0xa7')](function(_0x20396c){return db[_0xd9fd('0x85')][_0xd9fd('0x3d')]({'where':{'OpenchannelAccountId':_0x2f514e[_0xd9fd('0x5b')]['id']},'transaction':_0x20396c})[_0xd9fd('0x26')](function(_0x1d8b71){var _0x3f7cb8=_['map'](_0x2f514e[_0xd9fd('0x5d')],function(_0x4d12df){_0x4d12df[_0xd9fd('0x6d')]=_0x2f514e['params']['id'];return _0x4d12df;});return db['OpenchannelApplication'][_0xd9fd('0xa8')](_0x3f7cb8,{'transaction':_0x20396c});});})[_0xd9fd('0x26')](function(){return db[_0xd9fd('0x85')][_0xd9fd('0xa9')]({'where':{'OpenchannelAccountId':_0x2f514e['params']['id']},'order':'priority'});});}})[_0xd9fd('0x26')](respondWithResult(_0x488873,null))[_0xd9fd('0x2e')](handleError(_0x488873,null));};exports[_0xd9fd('0xaa')]=function(_0x630cad,_0x1a085c,_0x2bbd28){var _0x2e5130={};var _0xafbc6={};var _0x643ef6;var _0x334870;return db[_0xd9fd('0x42')][_0xd9fd('0x6b')]({'where':{'id':_0x630cad[_0xd9fd('0x5b')]['id']}})[_0xd9fd('0x26')](handleEntityNotFound(_0x1a085c,null))['then'](function(_0x5dd5b8){if(_0x5dd5b8){_0x643ef6=_0x5dd5b8;_0xafbc6['model']=_[_0xd9fd('0x5c')](db[_0xd9fd('0x85')][_0xd9fd('0x43')]);_0xafbc6['query']=_[_0xd9fd('0x5c')](_0x630cad[_0xd9fd('0x48')]);_0xafbc6[_0xd9fd('0x49')]=_[_0xd9fd('0x4a')](_0xafbc6[_0xd9fd('0x46')],_0xafbc6[_0xd9fd('0x48')]);_0x2e5130[_0xd9fd('0x4b')]=_[_0xd9fd('0x4a')](_0xafbc6['model'],qs[_0xd9fd('0x4c')](_0x630cad['query']['fields']));_0x2e5130[_0xd9fd('0x4b')]=_0x2e5130[_0xd9fd('0x4b')][_0xd9fd('0x4d')]?_0x2e5130[_0xd9fd('0x4b')]:_0xafbc6[_0xd9fd('0x46')];_0x2e5130[_0xd9fd('0x6c')]=qs['sort'](_0x630cad['query']['sort']);_0x2e5130[_0xd9fd('0x52')]=qs['filters'](_[_0xd9fd('0x50')](_0x630cad[_0xd9fd('0x48')],_0xafbc6[_0xd9fd('0x49')]));if(_0x630cad['query'][_0xd9fd('0x51')]){_0x2e5130[_0xd9fd('0x52')]=_[_0xd9fd('0x53')](_0x2e5130[_0xd9fd('0x52')],{'$or':_[_0xd9fd('0x41')](_0x2e5130[_0xd9fd('0x4b')],function(_0x406e16){var _0x126761={};_0x126761[_0x406e16]={'$like':'%'+_0x630cad['query'][_0xd9fd('0x51')]+'%'};return _0x126761;})});}_0x2e5130=_[_0xd9fd('0x53')]({},_0x2e5130,_0x630cad[_0xd9fd('0x56')]);return _0x643ef6['getApplications'](_0x2e5130);}})['then'](function(_0x3085af){if(_0x3085af){_0x334870=_0x3085af[_0xd9fd('0x4d')];if(!_0x630cad['query'][_0xd9fd('0x72')](_0xd9fd('0x4e'))){_0x2e5130['limit']=qs[_0xd9fd('0x35')](_0x630cad[_0xd9fd('0x48')][_0xd9fd('0x35')]);_0x2e5130['offset']=qs[_0xd9fd('0x34')](_0x630cad['query'][_0xd9fd('0x34')]);}return _0x643ef6[_0xd9fd('0xaa')](_0x2e5130);}})['then'](function(_0x241637){if(_0x241637){return _0x241637?{'count':_0x334870,'rows':_0x241637}:null;}})[_0xd9fd('0x26')](respondWithResult(_0x1a085c,null))[_0xd9fd('0x2e')](handleError(_0x1a085c,null));};exports[_0xd9fd('0xab')]=function(_0x485b7d,_0x3e2724,_0x506873){var _0x196ea8={'raw':![],'where':{}};var _0x2c79bf={};var _0x1ee9b3={'count':0x0,'rows':[]};return db[_0xd9fd('0x42')][_0xd9fd('0x6b')]({'where':{'id':_0x485b7d[_0xd9fd('0x5b')]['id']}})['then'](handleEntityNotFound(_0x3e2724,null))[_0xd9fd('0x26')](function(_0x32d02a){if(_0x32d02a){_0x2c79bf[_0xd9fd('0x46')]=_[_0xd9fd('0x5c')](db[_0xd9fd('0x8e')]['rawAttributes']);_0x2c79bf['query']=_[_0xd9fd('0x5c')](_0x485b7d['query']);_0x2c79bf[_0xd9fd('0x49')]=_[_0xd9fd('0x4a')](_0x2c79bf[_0xd9fd('0x46')],_0x2c79bf[_0xd9fd('0x48')]);_0x196ea8['attributes']=_[_0xd9fd('0x4a')](_0x2c79bf[_0xd9fd('0x46')],qs[_0xd9fd('0x4c')](_0x485b7d['query'][_0xd9fd('0x4c')]));_0x196ea8[_0xd9fd('0x4b')]=_0x196ea8[_0xd9fd('0x4b')][_0xd9fd('0x4d')]?_0x196ea8[_0xd9fd('0x4b')]:_0x2c79bf[_0xd9fd('0x46')];if(!_0x485b7d[_0xd9fd('0x48')][_0xd9fd('0x72')](_0xd9fd('0x4e'))){_0x196ea8[_0xd9fd('0x35')]=qs[_0xd9fd('0x35')](_0x485b7d[_0xd9fd('0x48')][_0xd9fd('0x35')]);_0x196ea8[_0xd9fd('0x34')]=qs[_0xd9fd('0x34')](_0x485b7d['query']['offset']);}_0x196ea8['order']=qs[_0xd9fd('0x4f')](_0x485b7d[_0xd9fd('0x48')]['sort']);_0x196ea8[_0xd9fd('0x52')]=qs[_0xd9fd('0x49')](_['pick'](_0x485b7d[_0xd9fd('0x48')],_0x2c79bf[_0xd9fd('0x49')]));_0x196ea8[_0xd9fd('0x52')][_0xd9fd('0x6d')]=_0x32d02a['id'];if(_0x485b7d[_0xd9fd('0x48')][_0xd9fd('0x51')]){_0x196ea8['where']=_[_0xd9fd('0x53')](_0x196ea8[_0xd9fd('0x52')],{'$or':_[_0xd9fd('0x41')](_0x196ea8[_0xd9fd('0x4b')],function(_0x41ca01){var _0x40b249={};_0x40b249[_0x41ca01]={'$like':'%'+_0x485b7d['query'][_0xd9fd('0x51')]+'%'};return _0x40b249;})});}_0x196ea8=_[_0xd9fd('0x53')]({},_0x196ea8,_0x485b7d[_0xd9fd('0x56')]);return db[_0xd9fd('0x8e')]['count']({'where':_0x196ea8[_0xd9fd('0x52')]})[_0xd9fd('0x26')](function(_0x1e699b){_0x1ee9b3[_0xd9fd('0x33')]=_0x1e699b;if(_0x485b7d[_0xd9fd('0x48')][_0xd9fd('0x57')]){_0x196ea8[_0xd9fd('0x58')]=[{'model':db[_0xd9fd('0x77')],'as':_0xd9fd('0xac'),'required':![]},{'model':db[_0xd9fd('0x9d')],'as':'Owner','attributes':[_0xd9fd('0x47'),_0xd9fd('0xad'),_0xd9fd('0xae')],'required':![]},{'model':db[_0xd9fd('0xaf')],'as':_0xd9fd('0xb0'),'attributes':['id',_0xd9fd('0x47'),'color'],'where':_0x485b7d['query'][_0xd9fd('0xb1')]?{'id':_0x485b7d[_0xd9fd('0x48')][_0xd9fd('0xb1')]}:undefined,'required':_0x485b7d[_0xd9fd('0x48')]['tag']?!![]:![]}];}return db[_0xd9fd('0x8e')][_0xd9fd('0x59')](_0x196ea8);})[_0xd9fd('0x26')](function(_0x57a5cf){_0x1ee9b3['rows']=_0x57a5cf;return _0x1ee9b3;});}})[_0xd9fd('0x26')](respondWithFilteredResult(_0x3e2724,_0x196ea8))[_0xd9fd('0x2e')](handleError(_0x3e2724,null));};exports[_0xd9fd('0xb2')]=function(_0x7d4f1e,_0x400ba9,_0x26a40e){return db['OpenchannelAccount'][_0xd9fd('0x62')]({'where':{'id':_0x7d4f1e[_0xd9fd('0x5b')]['id']}})[_0xd9fd('0x26')](handleEntityNotFound(_0x400ba9,null))['then'](function(_0xf4c614){if(_0xf4c614){return _0xf4c614[_0xd9fd('0xb2')](_0x7d4f1e[_0xd9fd('0x5d')][_0xd9fd('0x74')],_[_0xd9fd('0xb3')](_0x7d4f1e[_0xd9fd('0x5d')],[_0xd9fd('0x74'),'id'])||{})[_0xd9fd('0x91')](function(_0x247f28){for(var _0x316008=0x0;_0x316008<_0x7d4f1e[_0xd9fd('0x5d')][_0xd9fd('0x74')]['length'];_0x316008+=0x1){socket[_0xd9fd('0xb4')](_0xd9fd('0xb5'),{'UserId':_0x7d4f1e[_0xd9fd('0x5d')][_0xd9fd('0x74')][_0x316008],'OpenchannelAccountId':_0x7d4f1e[_0xd9fd('0x5b')]['id']});}return _0x247f28;});}})[_0xd9fd('0x26')](respondWithResult(_0x400ba9,null))['catch'](handleError(_0x400ba9,null));};exports['removeAgents']=function(_0x24193a,_0xe32c67,_0x4fe618){return db[_0xd9fd('0x42')][_0xd9fd('0x62')]({'where':{'id':_0x24193a[_0xd9fd('0x5b')]['id']}})['then'](handleEntityNotFound(_0xe32c67,null))[_0xd9fd('0x26')](function(_0x28cfc6){if(_0x28cfc6){return _0x28cfc6[_0xd9fd('0xb6')](_0x24193a[_0xd9fd('0x48')]['ids'])['then'](function(){if(_[_0xd9fd('0xb7')](_0x24193a['query'][_0xd9fd('0x74')])){for(var _0x3a5efa=0x0;_0x3a5efa<_0x24193a[_0xd9fd('0x48')][_0xd9fd('0x74')][_0xd9fd('0x4d')];_0x3a5efa+=0x1){socket[_0xd9fd('0xb4')](_0xd9fd('0xb8'),{'UserId':Number(_0x24193a['query']['ids'][_0x3a5efa]),'OpenchannelAccountId':Number(_0x24193a['params']['id'])});}}else{socket[_0xd9fd('0xb4')](_0xd9fd('0xb8'),{'UserId':Number(_0x24193a[_0xd9fd('0x48')][_0xd9fd('0x74')]),'OpenchannelAccountId':Number(_0x24193a[_0xd9fd('0x5b')]['id'])});}});}})[_0xd9fd('0x26')](respondWithStatusCode(_0xe32c67,null))[_0xd9fd('0x2e')](handleError(_0xe32c67,null));};exports[_0xd9fd('0xb9')]=function(_0x9d69aa,_0x112009,_0x2c6919){var _0x483c48={};var _0x37c13c={};var _0x4d7294;var _0x42675c;return db['OpenchannelAccount'][_0xd9fd('0x6b')]({'where':{'id':_0x9d69aa[_0xd9fd('0x5b')]['id']}})[_0xd9fd('0x26')](handleEntityNotFound(_0x112009,null))['then'](function(_0x45de38){if(_0x45de38){_0x4d7294=_0x45de38;_0x37c13c[_0xd9fd('0x46')]=_[_0xd9fd('0x5c')](db[_0xd9fd('0x9d')][_0xd9fd('0x43')]);_0x37c13c['query']=_['keys'](_0x9d69aa[_0xd9fd('0x48')]);_0x37c13c['filters']=_[_0xd9fd('0x4a')](_0x37c13c[_0xd9fd('0x46')],_0x37c13c[_0xd9fd('0x48')]);_0x483c48[_0xd9fd('0x4b')]=_[_0xd9fd('0x4a')](_0x37c13c[_0xd9fd('0x46')],qs[_0xd9fd('0x4c')](_0x9d69aa[_0xd9fd('0x48')]['fields']));_0x483c48[_0xd9fd('0x4b')]=_0x483c48[_0xd9fd('0x4b')][_0xd9fd('0x4d')]?_0x483c48['attributes']:_0x37c13c['model'];_0x483c48['order']=qs[_0xd9fd('0x4f')](_0x9d69aa['query'][_0xd9fd('0x4f')]);_0x483c48[_0xd9fd('0x52')]=qs[_0xd9fd('0x49')](_[_0xd9fd('0x50')](_0x9d69aa['query'],_0x37c13c[_0xd9fd('0x49')]));if(_0x9d69aa[_0xd9fd('0x48')]['filter']){_0x483c48['where']=_[_0xd9fd('0x53')](_0x483c48[_0xd9fd('0x52')],{'$or':_[_0xd9fd('0x41')](_0x483c48[_0xd9fd('0x4b')],function(_0x3739b9){var _0x23aed4={};_0x23aed4[_0x3739b9]={'$like':'%'+_0x9d69aa[_0xd9fd('0x48')]['filter']+'%'};return _0x23aed4;})});}_0x483c48=_[_0xd9fd('0x53')]({},_0x483c48,_0x9d69aa['options']);return _0x4d7294['getAgents'](_0x483c48);}})[_0xd9fd('0x26')](function(_0x4225be){if(_0x4225be){_0x42675c=_0x4225be['length'];if(!_0x9d69aa[_0xd9fd('0x48')][_0xd9fd('0x72')](_0xd9fd('0x4e'))){_0x483c48[_0xd9fd('0x35')]=qs[_0xd9fd('0x35')](_0x9d69aa['query'][_0xd9fd('0x35')]);_0x483c48[_0xd9fd('0x34')]=qs[_0xd9fd('0x34')](_0x9d69aa[_0xd9fd('0x48')][_0xd9fd('0x34')]);}return _0x4d7294[_0xd9fd('0xb9')](_0x483c48);}})[_0xd9fd('0x26')](function(_0x311b3e){if(_0x311b3e){return _0x311b3e?{'count':_0x42675c,'rows':_0x311b3e}:null;}})[_0xd9fd('0x26')](respondWithResult(_0x112009,null))[_0xd9fd('0x2e')](handleError(_0x112009,null));};exports[_0xd9fd('0xba')]=function(_0x3e7d50,_0x1ad435,_0x414aab){var _0x433518,_0x1da769,_0x1d0427;if(_[_0xd9fd('0x7b')](_0x3e7d50[_0xd9fd('0x5d')][_0xd9fd('0x5d')])||_0x3e7d50[_0xd9fd('0x5d')][_0xd9fd('0x5d')]===''){throw new db[(_0xd9fd('0x22'))][(_0xd9fd('0x23'))](_0xd9fd('0xbb'));}if(_[_0xd9fd('0x7b')](_0x3e7d50[_0xd9fd('0x5d')]['to'])){}_0x433518=_0x3e7d50['body']['to'];return db['OpenchannelAccount'][_0xd9fd('0x6b')]({'where':{'id':_0x3e7d50[_0xd9fd('0x5b')]['id']}})[_0xd9fd('0x26')](handleEntityNotFound(_0x1ad435,null))[_0xd9fd('0x26')](function(_0x31b4b7){if(_0x31b4b7){return db[_0xd9fd('0x42')][_0xd9fd('0x62')]({'where':{'id':_0x31b4b7['id']},'include':[{'model':db[_0xd9fd('0x81')],'as':_0xd9fd('0x82'),'include':[{'model':db['CmContact'],'as':_0xd9fd('0x83'),'where':{[_0x31b4b7[_0xd9fd('0x7e')]]:_0x433518},'limit':0x1,'order':[[_0xd9fd('0x79'),_0xd9fd('0x84')]]}]}]})[_0xd9fd('0x26')](handleEntityNotFound(_0x1ad435,null))['then'](function(_0x2d4d21){if(_0x2d4d21&&_0x2d4d21[_0xd9fd('0x82')]){_0x1da769=_0x2d4d21[_0xd9fd('0x3b')]({'plain':!![]});if(_0x1da769[_0xd9fd('0x82')]&&_0x1da769[_0xd9fd('0x82')][_0xd9fd('0x83')]['length']){return _0x1da769[_0xd9fd('0x82')][_0xd9fd('0x83')][0x0];}return db['CmContact']['create'](_[_0xd9fd('0x19')](_0x3e7d50[_0xd9fd('0x5d')],{'firstName':_0x433518,[_0x2d4d21[_0xd9fd('0x7e')]]:_0x433518,'phone':_0x433518,'ListId':_0x1da769[_0xd9fd('0x7a')]}));}})[_0xd9fd('0x26')](handleEntityNotFound(_0x1ad435,null))[_0xd9fd('0x26')](function(_0x240c9f){if(_0x240c9f){_0x1d0427=_0x240c9f;return db[_0xd9fd('0x8e')][_0xd9fd('0x62')]({'where':{'ContactId':_0x1d0427['id'],'closed':![],'OpenchannelAccountId':_0x1da769['id']}})[_0xd9fd('0x26')](function(_0x38d58d){if(_0x38d58d){return[_0x38d58d,![]];}return db['OpenchannelInteraction']['create']({'UserId':_0x3e7d50[_0xd9fd('0x5e')]['id'],'ContactId':_0x1d0427['id'],'OpenchannelAccountId':_0x1da769['id'],'lastMsgDirection':'out','Messages':[_[_0xd9fd('0x53')](_0x3e7d50[_0xd9fd('0x5d')],{'read':![],'body':_0x3e7d50['body'][_0xd9fd('0x5d')],'OpenchannelAccountId':_0x1da769['id'],'UserId':_0x3e7d50[_0xd9fd('0x5e')]['id'],'ContactId':_0x1d0427['id']})]},{'include':[{'model':db['OpenchannelMessage'],'as':_0xd9fd('0xbc')}]})[_0xd9fd('0x26')](function(_0x43c3f2){return[_0x43c3f2,!![]];});});}})['spread'](function(_0x52f8f9,_0x2169c2){if(_0x2169c2){return _0x52f8f9;}return db[_0xd9fd('0x9a')]['create'](_[_0xd9fd('0x53')](_0x3e7d50[_0xd9fd('0x5d')],{'read':![],'body':_0x3e7d50[_0xd9fd('0x5d')][_0xd9fd('0x5d')],'OpenchannelAccountId':_0x1da769['id'],'OpenchannelInteractionId':_0x52f8f9['id'],'UserId':_0x3e7d50[_0xd9fd('0x5e')]['id'],'ContactId':_0x1d0427['id']}))[_0xd9fd('0x26')](function(_0x5c263a){_0x52f8f9['dataValues'][_0xd9fd('0xbc')]=[];_0x52f8f9['dataValues']['Messages'][_0xd9fd('0x96')](_0x5c263a[_0xd9fd('0xbd')]);return _0x52f8f9;});});}})[_0xd9fd('0x26')](respondWithResult(_0x1ad435,null))['catch'](handleError(_0x1ad435,null));}; \ No newline at end of file diff --git a/server/api/openchannelAccount/openchannelAccount.events.js b/server/api/openchannelAccount/openchannelAccount.events.js index 54caddc..dc60e45 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 _0x0e7f=['exports','events','../../mysqldb','update','remove','emit','hasOwnProperty','hook'];(function(_0x5168be,_0xef1411){var _0x11ebc8=function(_0x392f85){while(--_0x392f85){_0x5168be['push'](_0x5168be['shift']());}};_0x11ebc8(++_0xef1411);}(_0x0e7f,0xc1));var _0xf0e7=function(_0x4eef97,_0x42d547){_0x4eef97=_0x4eef97-0x0;var _0x545742=_0x0e7f[_0x4eef97];return _0x545742;};'use strict';var EventEmitter=require(_0xf0e7('0x0'));var OpenchannelAccount=require(_0xf0e7('0x1'))['db']['OpenchannelAccount'];var OpenchannelAccountEvents=new EventEmitter();OpenchannelAccountEvents['setMaxListeners'](0x0);var events={'afterCreate':'save','afterUpdate':_0xf0e7('0x2'),'afterDestroy':_0xf0e7('0x3')};function emitEvent(_0x53d8e0){return function(_0x4da41f,_0xc65971,_0x2d1fd5){OpenchannelAccountEvents['emit'](_0x53d8e0+':'+_0x4da41f['id'],_0x4da41f);OpenchannelAccountEvents[_0xf0e7('0x4')](_0x53d8e0,_0x4da41f);_0x2d1fd5(null);};}for(var e in events){if(events[_0xf0e7('0x5')](e)){var event=events[e];OpenchannelAccount[_0xf0e7('0x6')](e,emitEvent(event));}}module[_0xf0e7('0x7')]=OpenchannelAccountEvents; \ No newline at end of file +var _0x59f3=['update','remove','hasOwnProperty','hook','exports','../../mysqldb','OpenchannelAccount','setMaxListeners'];(function(_0x55e4d0,_0x7e072){var _0x3858b2=function(_0x1f83ce){while(--_0x1f83ce){_0x55e4d0['push'](_0x55e4d0['shift']());}};_0x3858b2(++_0x7e072);}(_0x59f3,0x1c5));var _0x359f=function(_0x3d27ba,_0x2671a3){_0x3d27ba=_0x3d27ba-0x0;var _0xf01885=_0x59f3[_0x3d27ba];return _0xf01885;};'use strict';var EventEmitter=require('events');var OpenchannelAccount=require(_0x359f('0x0'))['db'][_0x359f('0x1')];var OpenchannelAccountEvents=new EventEmitter();OpenchannelAccountEvents[_0x359f('0x2')](0x0);var events={'afterCreate':'save','afterUpdate':_0x359f('0x3'),'afterDestroy':_0x359f('0x4')};function emitEvent(_0xded7c2){return function(_0x22761d,_0xd067f6,_0x468fb2){OpenchannelAccountEvents['emit'](_0xded7c2+':'+_0x22761d['id'],_0x22761d);OpenchannelAccountEvents['emit'](_0xded7c2,_0x22761d);_0x468fb2(null);};}for(var e in events){if(events[_0x359f('0x5')](e)){var event=events[e];OpenchannelAccount[_0x359f('0x6')](e,emitEvent(event));}}module[_0x359f('0x7')]=OpenchannelAccountEvents; \ No newline at end of file diff --git a/server/api/openchannelAccount/openchannelAccount.model.js b/server/api/openchannelAccount/openchannelAccount.model.js index fbc299e..3a84be8 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 _0x6437=['request-promise','path','rimraf','../../config/environment','./openchannelAccount.attributes','exports','define','OpenchannelAccount','openchannel_accounts','lodash','util','../../config/logger','api','moment','bluebird'];(function(_0x463bea,_0x1dc9e8){var _0x1e6ac5=function(_0x486257){while(--_0x486257){_0x463bea['push'](_0x463bea['shift']());}};_0x1e6ac5(++_0x1dc9e8);}(_0x6437,0x90));var _0x7643=function(_0xbfd643,_0x3f9402){_0xbfd643=_0xbfd643-0x0;var _0x438031=_0x6437[_0xbfd643];return _0x438031;};'use strict';var _=require(_0x7643('0x0'));var util=require(_0x7643('0x1'));var logger=require(_0x7643('0x2'))(_0x7643('0x3'));var moment=require(_0x7643('0x4'));var BPromise=require(_0x7643('0x5'));var rp=require(_0x7643('0x6'));var fs=require('fs');var path=require(_0x7643('0x7'));var rimraf=require(_0x7643('0x8'));var config=require(_0x7643('0x9'));var attributes=require(_0x7643('0xa'));module[_0x7643('0xb')]=function(_0x11906e,_0x91307b){return _0x11906e[_0x7643('0xc')](_0x7643('0xd'),attributes,{'tableName':_0x7643('0xe'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xdc46=['api','bluebird','request-promise','path','../../config/environment','./openchannelAccount.attributes','exports','define','OpenchannelAccount','util','../../config/logger'];(function(_0x8c6eee,_0x21f601){var _0x5a03b5=function(_0x55599d){while(--_0x55599d){_0x8c6eee['push'](_0x8c6eee['shift']());}};_0x5a03b5(++_0x21f601);}(_0xdc46,0x1b6));var _0x6dc4=function(_0x287a37,_0x51d45a){_0x287a37=_0x287a37-0x0;var _0x302087=_0xdc46[_0x287a37];return _0x302087;};'use strict';var _=require('lodash');var util=require(_0x6dc4('0x0'));var logger=require(_0x6dc4('0x1'))(_0x6dc4('0x2'));var moment=require('moment');var BPromise=require(_0x6dc4('0x3'));var rp=require(_0x6dc4('0x4'));var fs=require('fs');var path=require(_0x6dc4('0x5'));var rimraf=require('rimraf');var config=require(_0x6dc4('0x6'));var attributes=require(_0x6dc4('0x7'));module[_0x6dc4('0x8')]=function(_0x1c2e72,_0x3562cc){return _0x1c2e72[_0x6dc4('0x9')](_0x6dc4('0xa'),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 a95728b..3b6a112 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 _0x5662=['request','then','OpenchannelAccount,\x20%s,\x20%s','request\x20sent','debug','OpenchannelAccount,\x20%s,\x20%s,\x20%s','error','code','message','catch','lodash','util','moment','bluebird','../../mysqldb','rpc','../../config/environment','jayson/promise','client','defaults','localhost','socket.io-emitter','./openchannelAccount.socket','register'];(function(_0x5bc3bf,_0x3e4369){var _0x4eaeb7=function(_0xdaa874){while(--_0xdaa874){_0x5bc3bf['push'](_0x5bc3bf['shift']());}};_0x4eaeb7(++_0x3e4369);}(_0x5662,0x1a2));var _0x2566=function(_0x341282,_0x5d9c5d){_0x341282=_0x341282-0x0;var _0x22b455=_0x5662[_0x341282];return _0x22b455;};'use strict';var _=require(_0x2566('0x0'));var util=require(_0x2566('0x1'));var moment=require(_0x2566('0x2'));var BPromise=require(_0x2566('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x2566('0x4'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x2566('0x5'));var config=require(_0x2566('0x6'));var jayson=require(_0x2566('0x7'));var client=jayson[_0x2566('0x8')]['http']({'port':0x232a});config['redis']=_[_0x2566('0x9')](config['redis'],{'host':_0x2566('0xa'),'port':0x18eb});var socket=require(_0x2566('0xb'))(new Redis(config['redis']));require(_0x2566('0xc'))[_0x2566('0xd')](socket);function respondWithRpcPromise(_0x5d2e53,_0x1e2632,_0x10dbdf){return new BPromise(function(_0x505b1b,_0x4ca874){return client[_0x2566('0xe')](_0x5d2e53,_0x10dbdf)[_0x2566('0xf')](function(_0xc8ff22){logger['info'](_0x2566('0x10'),_0x1e2632,_0x2566('0x11'));logger[_0x2566('0x12')](_0x2566('0x13'),_0x1e2632,_0x2566('0x11'),JSON['stringify'](_0xc8ff22));if(_0xc8ff22[_0x2566('0x14')]){if(_0xc8ff22[_0x2566('0x14')][_0x2566('0x15')]===0x1f4){logger[_0x2566('0x14')]('OpenchannelAccount,\x20%s,\x20%s',_0x1e2632,_0xc8ff22[_0x2566('0x14')][_0x2566('0x16')]);return _0x4ca874(_0xc8ff22['error'][_0x2566('0x16')]);}logger[_0x2566('0x14')]('OpenchannelAccount,\x20%s,\x20%s',_0x1e2632,_0xc8ff22[_0x2566('0x14')][_0x2566('0x16')]);return _0x505b1b(_0xc8ff22[_0x2566('0x14')]['message']);}else{logger['info'](_0x2566('0x10'),_0x1e2632,_0x2566('0x11'));_0x505b1b(_0xc8ff22['result'][_0x2566('0x16')]);}})[_0x2566('0x17')](function(_0x4dc259){logger[_0x2566('0x14')](_0x2566('0x10'),_0x1e2632,_0x4dc259);_0x4ca874(_0x4dc259);});});} \ No newline at end of file +var _0xb191=['error','code','message','info','lodash','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','http','redis','defaults','localhost','socket.io-emitter','./openchannelAccount.socket','then','OpenchannelAccount,\x20%s,\x20%s','request\x20sent','debug'];(function(_0x53832d,_0x49cec2){var _0x20efe2=function(_0x7fd41c){while(--_0x7fd41c){_0x53832d['push'](_0x53832d['shift']());}};_0x20efe2(++_0x49cec2);}(_0xb191,0xe0));var _0x1b19=function(_0x578c4c,_0xe84255){_0x578c4c=_0x578c4c-0x0;var _0x3dbbfe=_0xb191[_0x578c4c];return _0x3dbbfe;};'use strict';var _=require(_0x1b19('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0x1b19('0x1'));var rs=require(_0x1b19('0x2'));var fs=require('fs');var Redis=require(_0x1b19('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x1b19('0x4'));var logger=require(_0x1b19('0x5'))(_0x1b19('0x6'));var config=require(_0x1b19('0x7'));var jayson=require('jayson/promise');var client=jayson['client'][_0x1b19('0x8')]({'port':0x232a});config[_0x1b19('0x9')]=_[_0x1b19('0xa')](config[_0x1b19('0x9')],{'host':_0x1b19('0xb'),'port':0x18eb});var socket=require(_0x1b19('0xc'))(new Redis(config['redis']));require(_0x1b19('0xd'))['register'](socket);function respondWithRpcPromise(_0x81a2d0,_0x35a201,_0x6aaf){return new BPromise(function(_0x211e33,_0x3fead0){return client['request'](_0x81a2d0,_0x6aaf)[_0x1b19('0xe')](function(_0x129070){logger['info'](_0x1b19('0xf'),_0x35a201,_0x1b19('0x10'));logger[_0x1b19('0x11')]('OpenchannelAccount,\x20%s,\x20%s,\x20%s',_0x35a201,_0x1b19('0x10'),JSON['stringify'](_0x129070));if(_0x129070[_0x1b19('0x12')]){if(_0x129070[_0x1b19('0x12')][_0x1b19('0x13')]===0x1f4){logger['error']('OpenchannelAccount,\x20%s,\x20%s',_0x35a201,_0x129070[_0x1b19('0x12')]['message']);return _0x3fead0(_0x129070[_0x1b19('0x12')][_0x1b19('0x14')]);}logger['error'](_0x1b19('0xf'),_0x35a201,_0x129070[_0x1b19('0x12')]['message']);return _0x211e33(_0x129070[_0x1b19('0x12')]['message']);}else{logger[_0x1b19('0x15')](_0x1b19('0xf'),_0x35a201,_0x1b19('0x10'));_0x211e33(_0x129070['result'][_0x1b19('0x14')]);}})['catch'](function(_0x47c095){logger[_0x1b19('0x12')](_0x1b19('0xf'),_0x35a201,_0x47c095);_0x3fead0(_0x47c095);});});} \ No newline at end of file diff --git a/server/api/openchannelAccount/openchannelAccount.socket.js b/server/api/openchannelAccount/openchannelAccount.socket.js index 01fe741..4457a22 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 _0x4049=['remove','update','removeListener','length','openchannelAccount:','save'];(function(_0x5d6dc3,_0x1f94cb){var _0x2ac5be=function(_0x264afe){while(--_0x264afe){_0x5d6dc3['push'](_0x5d6dc3['shift']());}};_0x2ac5be(++_0x1f94cb);}(_0x4049,0xdd));var _0x9404=function(_0x2828b3,_0x2bb499){_0x2828b3=_0x2828b3-0x0;var _0x3ddbce=_0x4049[_0x2828b3];return _0x3ddbce;};'use strict';var OpenchannelAccountEvents=require('./openchannelAccount.events');var events=[_0x9404('0x0'),_0x9404('0x1'),_0x9404('0x2')];function createListener(_0x398789,_0x4b341f){return function(_0x967d8e){_0x4b341f['emit'](_0x398789,_0x967d8e);};}function removeListener(_0x5c087d,_0x148c42){return function(){OpenchannelAccountEvents[_0x9404('0x3')](_0x5c087d,_0x148c42);};}exports['register']=function(_0x2c38ad){for(var _0x259731=0x0,_0x180f5f=events[_0x9404('0x4')];_0x259731<_0x180f5f;_0x259731++){var _0x1a6a95=events[_0x259731];var _0xc8701a=createListener(_0x9404('0x5')+_0x1a6a95,_0x2c38ad);OpenchannelAccountEvents['on'](_0x1a6a95,_0xc8701a);}}; \ No newline at end of file +var _0xa2af=['emit','removeListener','register','length','openchannelAccount:','update'];(function(_0x13d07a,_0x41efc3){var _0x5ee0ee=function(_0x4ca94a){while(--_0x4ca94a){_0x13d07a['push'](_0x13d07a['shift']());}};_0x5ee0ee(++_0x41efc3);}(_0xa2af,0x179));var _0xfa2a=function(_0x229985,_0xa190ba){_0x229985=_0x229985-0x0;var _0x326d0a=_0xa2af[_0x229985];return _0x326d0a;};'use strict';var OpenchannelAccountEvents=require('./openchannelAccount.events');var events=['save','remove',_0xfa2a('0x0')];function createListener(_0x26a2f9,_0x219269){return function(_0x4cabd7){_0x219269[_0xfa2a('0x1')](_0x26a2f9,_0x4cabd7);};}function removeListener(_0x470501,_0x313667){return function(){OpenchannelAccountEvents[_0xfa2a('0x2')](_0x470501,_0x313667);};}exports[_0xfa2a('0x3')]=function(_0x3aa82f){for(var _0x4348fb=0x0,_0x3c6c60=events[_0xfa2a('0x4')];_0x4348fb<_0x3c6c60;_0x4348fb++){var _0x1d3995=events[_0x4348fb];var _0x28cb5f=createListener(_0xfa2a('0x5')+_0x1d3995,_0x3aa82f);OpenchannelAccountEvents['on'](_0x1d3995,_0x28cb5f);}}; \ No newline at end of file diff --git a/server/api/openchannelApplication/index.js b/server/api/openchannelApplication/index.js index 7270029..e0c249f 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 _0x2c76=['/:id','show','create','put','update','multer','util','path','connect-timeout','express','Router','../../components/interaction/service','../../config/environment','get','isAuthenticated','index'];(function(_0x4367cc,_0xb0f4a0){var _0x2f096e=function(_0x2c4a9d){while(--_0x2c4a9d){_0x4367cc['push'](_0x4367cc['shift']());}};_0x2f096e(++_0xb0f4a0);}(_0x2c76,0xc5));var _0x62c7=function(_0x274a71,_0x5b46dd){_0x274a71=_0x274a71-0x0;var _0x19396a=_0x2c76[_0x274a71];return _0x19396a;};'use strict';var multer=require(_0x62c7('0x0'));var util=require(_0x62c7('0x1'));var path=require(_0x62c7('0x2'));var timeout=require(_0x62c7('0x3'));var express=require(_0x62c7('0x4'));var router=express[_0x62c7('0x5')]();var auth=require('../../components/auth/service');var interaction=require(_0x62c7('0x6'));var config=require(_0x62c7('0x7'));var controller=require('./openchannelApplication.controller');router[_0x62c7('0x8')]('/',auth[_0x62c7('0x9')](),controller[_0x62c7('0xa')]);router[_0x62c7('0x8')](_0x62c7('0xb'),auth['isAuthenticated'](),controller[_0x62c7('0xc')]);router['post']('/',auth[_0x62c7('0x9')](),controller[_0x62c7('0xd')]);router[_0x62c7('0xe')](_0x62c7('0xb'),auth['isAuthenticated'](),controller[_0x62c7('0xf')]);router['delete'](_0x62c7('0xb'),auth[_0x62c7('0x9')](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0x6ea8=['../../components/auth/service','../../components/interaction/service','../../config/environment','./openchannelApplication.controller','get','isAuthenticated','index','show','post','create','put','update','destroy','exports','multer','util','path','connect-timeout','express'];(function(_0x3899d1,_0x4aa04c){var _0xeb4a7d=function(_0x3ea5ee){while(--_0x3ea5ee){_0x3899d1['push'](_0x3899d1['shift']());}};_0xeb4a7d(++_0x4aa04c);}(_0x6ea8,0xdf));var _0x86ea=function(_0x5cbf0e,_0x4cd140){_0x5cbf0e=_0x5cbf0e-0x0;var _0x1c76f8=_0x6ea8[_0x5cbf0e];return _0x1c76f8;};'use strict';var multer=require(_0x86ea('0x0'));var util=require(_0x86ea('0x1'));var path=require(_0x86ea('0x2'));var timeout=require(_0x86ea('0x3'));var express=require(_0x86ea('0x4'));var router=express['Router']();var auth=require(_0x86ea('0x5'));var interaction=require(_0x86ea('0x6'));var config=require(_0x86ea('0x7'));var controller=require(_0x86ea('0x8'));router[_0x86ea('0x9')]('/',auth[_0x86ea('0xa')](),controller[_0x86ea('0xb')]);router[_0x86ea('0x9')]('/:id',auth[_0x86ea('0xa')](),controller[_0x86ea('0xc')]);router[_0x86ea('0xd')]('/',auth['isAuthenticated'](),controller[_0x86ea('0xe')]);router[_0x86ea('0xf')]('/:id',auth[_0x86ea('0xa')](),controller[_0x86ea('0x10')]);router['delete']('/:id',auth[_0x86ea('0xa')](),controller[_0x86ea('0x11')]);module[_0x86ea('0x12')]=router; \ No newline at end of file diff --git a/server/api/openchannelApplication/openchannelApplication.attributes.js b/server/api/openchannelApplication/openchannelApplication.attributes.js index 45406fc..a1efdc2 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 _0x696f=['exports','INTEGER','STRING','noop','TEXT','sequelize'];(function(_0x338de1,_0x5d5eac){var _0x52335a=function(_0x223440){while(--_0x223440){_0x338de1['push'](_0x338de1['shift']());}};_0x52335a(++_0x5d5eac);}(_0x696f,0xb3));var _0xf696=function(_0x618414,_0x1a7a60){_0x618414=_0x618414-0x0;var _0x21c19a=_0x696f[_0x618414];return _0x21c19a;};'use strict';var Sequelize=require(_0xf696('0x0'));module[_0xf696('0x1')]={'priority':{'type':Sequelize[_0xf696('0x2')],'allowNull':![]},'app':{'type':Sequelize[_0xf696('0x3')],'allowNull':![],'defaultValue':_0xf696('0x4')},'appdata':{'type':Sequelize[_0xf696('0x5')]()},'description':{'type':Sequelize[_0xf696('0x3')]},'interval':{'type':Sequelize[_0xf696('0x3')],'defaultValue':'*,*,*,*'}}; \ No newline at end of file +var _0xf8bc=['exports','INTEGER','STRING','*,*,*,*'];(function(_0x247316,_0x1a1005){var _0x1169d9=function(_0x2e1a91){while(--_0x2e1a91){_0x247316['push'](_0x247316['shift']());}};_0x1169d9(++_0x1a1005);}(_0xf8bc,0x120));var _0xcf8b=function(_0x3b7a0c,_0xf1a4c2){_0x3b7a0c=_0x3b7a0c-0x0;var _0x3bb70f=_0xf8bc[_0x3b7a0c];return _0x3bb70f;};'use strict';var Sequelize=require('sequelize');module[_0xcf8b('0x0')]={'priority':{'type':Sequelize[_0xcf8b('0x1')],'allowNull':![]},'app':{'type':Sequelize[_0xcf8b('0x2')],'allowNull':![],'defaultValue':'noop'},'appdata':{'type':Sequelize['TEXT']()},'description':{'type':Sequelize['STRING']},'interval':{'type':Sequelize['STRING'],'defaultValue':_0xcf8b('0x3')}}; \ No newline at end of file diff --git a/server/api/openchannelApplication/openchannelApplication.controller.js b/server/api/openchannelApplication/openchannelApplication.controller.js index 63267c3..b7c3f3f 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 _0x151b=['intersection','attributes','fields','length','hasOwnProperty','sort','where','filter','merge','include','rows','params','includeAll','options','find','catch','body','html-pdf','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','querystring','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/utils','sendStatus','status','json','count','offset','limit','set','Content-Range','apply','save','update','then','destroy','error','stack','index','map','OpenchannelApplication','rawAttributes','fieldName','type','model','name','keys','query','filters'];(function(_0x19691f,_0x159737){var _0x5677b6=function(_0x41a9b2){while(--_0x41a9b2){_0x19691f['push'](_0x19691f['shift']());}};_0x5677b6(++_0x159737);}(_0x151b,0x95));var _0xb151=function(_0x48b367,_0x511429){_0x48b367=_0x48b367-0x0;var _0x6a6eb2=_0x151b[_0x48b367];return _0x6a6eb2;};'use strict';var pdf=require(_0xb151('0x0'));var emlformat=require(_0xb151('0x1'));var rimraf=require(_0xb151('0x2'));var zipdir=require('zip-dir');var jsonpatch=require(_0xb151('0x3'));var rp=require(_0xb151('0x4'));var moment=require(_0xb151('0x5'));var BPromise=require(_0xb151('0x6'));var Mustache=require(_0xb151('0x7'));var util=require(_0xb151('0x8'));var path=require(_0xb151('0x9'));var sox=require(_0xb151('0xa'));var csv=require(_0xb151('0xb'));var ejs=require(_0xb151('0xc'));var fs=require('fs');var _=require(_0xb151('0xd'));var squel=require(_0xb151('0xe'));var crypto=require(_0xb151('0xf'));var jsforce=require(_0xb151('0x10'));var deskjs=require('desk.js');var toCsv=require(_0xb151('0xb'));var querystring=require(_0xb151('0x11'));var Papa=require('papaparse');var Redis=require(_0xb151('0x12'));var authService=require('../../components/auth/service');var qs=require(_0xb151('0x13'));var as=require(_0xb151('0x14'));var hardwareService=require(_0xb151('0x15'));var logger=require('../../config/logger')('api');var utils=require(_0xb151('0x16'));var config=require('../../config/environment');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x4226e4,_0x131f7f){_0x131f7f=_0x131f7f||0xcc;return function(_0x1ad79c){if(_0x1ad79c){return _0x4226e4[_0xb151('0x17')](_0x131f7f);}return _0x4226e4[_0xb151('0x18')](_0x131f7f)['end']();};}function respondWithResult(_0x35b457,_0x4cfc65){_0x4cfc65=_0x4cfc65||0xc8;return function(_0x4be8fc){if(_0x4be8fc){return _0x35b457[_0xb151('0x18')](_0x4cfc65)[_0xb151('0x19')](_0x4be8fc);}};}function respondWithFilteredResult(_0x2ebabc,_0x4e2184){return function(_0x48b681){if(_0x48b681){var _0x41df64=_0x48b681[_0xb151('0x1a')],_0x22c86e=_0x4e2184[_0xb151('0x1b')],_0x1b4330=_0x4e2184[_0xb151('0x1b')]+_0x4e2184[_0xb151('0x1c')],_0x36d2f7;if(_0x1b4330>=_0x41df64){_0x1b4330=_0x41df64;_0x36d2f7=0xc8;}else{_0x36d2f7=0xce;}_0x2ebabc['status'](_0x36d2f7);return _0x2ebabc[_0xb151('0x1d')](_0xb151('0x1e'),_0x22c86e+'-'+_0x1b4330+'/'+_0x41df64)[_0xb151('0x19')](_0x48b681);}return null;};}function patchUpdates(_0x2659cc){return function(_0x5c227e){try{jsonpatch[_0xb151('0x1f')](_0x5c227e,_0x2659cc,!![]);}catch(_0x138fb9){return BPromise['reject'](_0x138fb9);}return _0x5c227e[_0xb151('0x20')]();};}function saveUpdates(_0x179b11,_0x11ed4b){return function(_0x5ec2d4){if(_0x5ec2d4){return _0x5ec2d4[_0xb151('0x21')](_0x179b11)[_0xb151('0x22')](function(_0x2fd737){return _0x2fd737;});}return null;};}function removeEntity(_0x675f27,_0x771990){return function(_0x2c1183){if(_0x2c1183){return _0x2c1183[_0xb151('0x23')]()[_0xb151('0x22')](function(){_0x675f27[_0xb151('0x18')](0xcc)['end']();});}};}function handleEntityNotFound(_0x4c2e8b,_0x2e133d){return function(_0x39a3b7){if(!_0x39a3b7){_0x4c2e8b[_0xb151('0x17')](0x194);}return _0x39a3b7;};}function handleError(_0x49c3db,_0x5dc867){_0x5dc867=_0x5dc867||0x1f4;return function(_0x4113ee){logger[_0xb151('0x24')](_0x4113ee[_0xb151('0x25')]);if(_0x4113ee['name']){delete _0x4113ee['name'];}_0x49c3db[_0xb151('0x18')](_0x5dc867)['send'](_0x4113ee);};}exports[_0xb151('0x26')]=function(_0x324700,_0x52c912){var _0x4fd238={},_0x2e45b2={},_0xbce812={'count':0x0,'rows':[]};var _0x3f40b0=_[_0xb151('0x27')](db[_0xb151('0x28')][_0xb151('0x29')],function(_0x14b664){return{'name':_0x14b664[_0xb151('0x2a')],'type':_0x14b664[_0xb151('0x2b')]['key']};});_0x2e45b2[_0xb151('0x2c')]=_[_0xb151('0x27')](_0x3f40b0,_0xb151('0x2d'));_0x2e45b2['query']=_[_0xb151('0x2e')](_0x324700[_0xb151('0x2f')]);_0x2e45b2[_0xb151('0x30')]=_[_0xb151('0x31')](_0x2e45b2['model'],_0x2e45b2[_0xb151('0x2f')]);_0x4fd238[_0xb151('0x32')]=_[_0xb151('0x31')](_0x2e45b2[_0xb151('0x2c')],qs[_0xb151('0x33')](_0x324700['query'][_0xb151('0x33')]));_0x4fd238['attributes']=_0x4fd238[_0xb151('0x32')][_0xb151('0x34')]?_0x4fd238[_0xb151('0x32')]:_0x2e45b2[_0xb151('0x2c')];if(!_0x324700['query'][_0xb151('0x35')]('nolimit')){_0x4fd238[_0xb151('0x1c')]=qs[_0xb151('0x1c')](_0x324700[_0xb151('0x2f')][_0xb151('0x1c')]);_0x4fd238[_0xb151('0x1b')]=qs[_0xb151('0x1b')](_0x324700[_0xb151('0x2f')][_0xb151('0x1b')]);}_0x4fd238['order']=qs[_0xb151('0x36')](_0x324700[_0xb151('0x2f')][_0xb151('0x36')]);_0x4fd238[_0xb151('0x37')]=qs[_0xb151('0x30')](_['pick'](_0x324700[_0xb151('0x2f')],_0x2e45b2[_0xb151('0x30')]));if(_0x324700[_0xb151('0x2f')][_0xb151('0x38')]){_0x4fd238['where']=_['merge'](_0x4fd238[_0xb151('0x37')],{'$or':_[_0xb151('0x27')](_0x3f40b0,function(_0x5472af){if(_0x5472af[_0xb151('0x2b')]!=='VIRTUAL'){var _0x3127d6={};_0x3127d6[_0x5472af[_0xb151('0x2d')]]={'$like':'%'+_0x324700[_0xb151('0x2f')][_0xb151('0x38')]+'%'};return _0x3127d6;}})});}_0x4fd238=_[_0xb151('0x39')]({},_0x4fd238,_0x324700['options']);var _0x5c3842={'where':_0x4fd238['where']};return db[_0xb151('0x28')]['count'](_0x5c3842)['then'](function(_0x3e64d8){_0xbce812[_0xb151('0x1a')]=_0x3e64d8;if(_0x324700['query']['includeAll']){_0x4fd238[_0xb151('0x3a')]=[{'all':!![]}];}return db['OpenchannelApplication']['findAll'](_0x4fd238);})[_0xb151('0x22')](function(_0x14f5f1){_0xbce812[_0xb151('0x3b')]=_0x14f5f1;return _0xbce812;})[_0xb151('0x22')](respondWithFilteredResult(_0x52c912,_0x4fd238))['catch'](handleError(_0x52c912,null));};exports['show']=function(_0x38685e,_0x3b29d7){var _0x1eba72={'raw':!![],'where':{'id':_0x38685e[_0xb151('0x3c')]['id']}},_0x2c0f54={};_0x2c0f54[_0xb151('0x2c')]=_['keys'](db[_0xb151('0x28')][_0xb151('0x29')]);_0x2c0f54[_0xb151('0x2f')]=_[_0xb151('0x2e')](_0x38685e[_0xb151('0x2f')]);_0x2c0f54[_0xb151('0x30')]=_['intersection'](_0x2c0f54[_0xb151('0x2c')],_0x2c0f54['query']);_0x1eba72[_0xb151('0x32')]=_[_0xb151('0x31')](_0x2c0f54[_0xb151('0x2c')],qs[_0xb151('0x33')](_0x38685e[_0xb151('0x2f')][_0xb151('0x33')]));_0x1eba72[_0xb151('0x32')]=_0x1eba72['attributes'][_0xb151('0x34')]?_0x1eba72[_0xb151('0x32')]:_0x2c0f54[_0xb151('0x2c')];if(_0x38685e[_0xb151('0x2f')][_0xb151('0x3d')]){_0x1eba72[_0xb151('0x3a')]=[{'all':!![]}];}_0x1eba72=_[_0xb151('0x39')]({},_0x1eba72,_0x38685e[_0xb151('0x3e')]);return db['OpenchannelApplication'][_0xb151('0x3f')](_0x1eba72)[_0xb151('0x22')](handleEntityNotFound(_0x3b29d7,null))['then'](respondWithResult(_0x3b29d7,null))[_0xb151('0x40')](handleError(_0x3b29d7,null));};exports['create']=function(_0x2183de,_0x3074d5){return db[_0xb151('0x28')]['create'](_0x2183de[_0xb151('0x41')],{})[_0xb151('0x22')](respondWithResult(_0x3074d5,0xc9))[_0xb151('0x40')](handleError(_0x3074d5,null));};exports[_0xb151('0x21')]=function(_0x424ee2,_0x48b879){if(_0x424ee2[_0xb151('0x41')]['id']){delete _0x424ee2['body']['id'];}return db[_0xb151('0x28')][_0xb151('0x3f')]({'where':{'id':_0x424ee2[_0xb151('0x3c')]['id']}})[_0xb151('0x22')](handleEntityNotFound(_0x48b879,null))['then'](saveUpdates(_0x424ee2[_0xb151('0x41')],null))[_0xb151('0x22')](respondWithResult(_0x48b879,null))['catch'](handleError(_0x48b879,null));};exports['destroy']=function(_0x419e8c,_0x4c0e92){return db[_0xb151('0x28')][_0xb151('0x3f')]({'where':{'id':_0x419e8c[_0xb151('0x3c')]['id']}})[_0xb151('0x22')](handleEntityNotFound(_0x4c0e92,null))[_0xb151('0x22')](removeEntity(_0x4c0e92,null))[_0xb151('0x40')](handleError(_0x4c0e92,null));}; \ No newline at end of file +var _0x1520=['offset','limit','set','Content-Range','save','then','destroy','error','name','index','map','OpenchannelApplication','rawAttributes','fieldName','type','model','query','filters','intersection','attributes','fields','hasOwnProperty','order','sort','where','pick','filter','merge','VIRTUAL','options','count','include','findAll','catch','show','keys','length','includeAll','find','create','body','params','html-pdf','eml-format','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','sox','to-csv','lodash','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json'];(function(_0x12bad7,_0x358265){var _0x40f28b=function(_0xc6d0a3){while(--_0xc6d0a3){_0x12bad7['push'](_0x12bad7['shift']());}};_0x40f28b(++_0x358265);}(_0x1520,0x14a));var _0x0152=function(_0x23c166,_0xc1fc0f){_0x23c166=_0x23c166-0x0;var _0x1bce5e=_0x1520[_0x23c166];return _0x1bce5e;};'use strict';var pdf=require(_0x0152('0x0'));var emlformat=require(_0x0152('0x1'));var rimraf=require('rimraf');var zipdir=require(_0x0152('0x2'));var jsonpatch=require(_0x0152('0x3'));var rp=require(_0x0152('0x4'));var moment=require(_0x0152('0x5'));var BPromise=require('bluebird');var Mustache=require(_0x0152('0x6'));var util=require(_0x0152('0x7'));var path=require(_0x0152('0x8'));var sox=require(_0x0152('0x9'));var csv=require(_0x0152('0xa'));var ejs=require('ejs');var fs=require('fs');var _=require(_0x0152('0xb'));var squel=require('squel');var crypto=require(_0x0152('0xc'));var jsforce=require(_0x0152('0xd'));var deskjs=require(_0x0152('0xe'));var toCsv=require(_0x0152('0xa'));var querystring=require('querystring');var Papa=require(_0x0152('0xf'));var Redis=require(_0x0152('0x10'));var authService=require(_0x0152('0x11'));var qs=require(_0x0152('0x12'));var as=require(_0x0152('0x13'));var hardwareService=require(_0x0152('0x14'));var logger=require(_0x0152('0x15'))(_0x0152('0x16'));var utils=require(_0x0152('0x17'));var config=require(_0x0152('0x18'));var db=require(_0x0152('0x19'))['db'];function respondWithStatusCode(_0x16708d,_0x47e791){_0x47e791=_0x47e791||0xcc;return function(_0x25f905){if(_0x25f905){return _0x16708d[_0x0152('0x1a')](_0x47e791);}return _0x16708d[_0x0152('0x1b')](_0x47e791)[_0x0152('0x1c')]();};}function respondWithResult(_0x6a59f5,_0x1f2e1c){_0x1f2e1c=_0x1f2e1c||0xc8;return function(_0x59eb99){if(_0x59eb99){return _0x6a59f5[_0x0152('0x1b')](_0x1f2e1c)[_0x0152('0x1d')](_0x59eb99);}};}function respondWithFilteredResult(_0x3d61db,_0x5c5d38){return function(_0x5e0079){if(_0x5e0079){var _0xd9f12e=_0x5e0079['count'],_0x163426=_0x5c5d38[_0x0152('0x1e')],_0x26cfef=_0x5c5d38[_0x0152('0x1e')]+_0x5c5d38[_0x0152('0x1f')],_0x4715dd;if(_0x26cfef>=_0xd9f12e){_0x26cfef=_0xd9f12e;_0x4715dd=0xc8;}else{_0x4715dd=0xce;}_0x3d61db['status'](_0x4715dd);return _0x3d61db[_0x0152('0x20')](_0x0152('0x21'),_0x163426+'-'+_0x26cfef+'/'+_0xd9f12e)[_0x0152('0x1d')](_0x5e0079);}return null;};}function patchUpdates(_0x4dc24e){return function(_0x350d61){try{jsonpatch['apply'](_0x350d61,_0x4dc24e,!![]);}catch(_0x4da8a5){return BPromise['reject'](_0x4da8a5);}return _0x350d61[_0x0152('0x22')]();};}function saveUpdates(_0x2b93e2,_0x553959){return function(_0x2c74cd){if(_0x2c74cd){return _0x2c74cd['update'](_0x2b93e2)[_0x0152('0x23')](function(_0x24b99f){return _0x24b99f;});}return null;};}function removeEntity(_0x453d2f,_0x54ac2d){return function(_0x14038f){if(_0x14038f){return _0x14038f[_0x0152('0x24')]()[_0x0152('0x23')](function(){_0x453d2f[_0x0152('0x1b')](0xcc)[_0x0152('0x1c')]();});}};}function handleEntityNotFound(_0x49b233,_0x1b67e7){return function(_0x318e07){if(!_0x318e07){_0x49b233[_0x0152('0x1a')](0x194);}return _0x318e07;};}function handleError(_0x45a880,_0x48f3f1){_0x48f3f1=_0x48f3f1||0x1f4;return function(_0x231c03){logger[_0x0152('0x25')](_0x231c03['stack']);if(_0x231c03[_0x0152('0x26')]){delete _0x231c03[_0x0152('0x26')];}_0x45a880[_0x0152('0x1b')](_0x48f3f1)['send'](_0x231c03);};}exports[_0x0152('0x27')]=function(_0x1a85af,_0x1c1e5b){var _0x26ecf8={},_0x226beb={},_0x5e64d3={'count':0x0,'rows':[]};var _0x44fb4b=_[_0x0152('0x28')](db[_0x0152('0x29')][_0x0152('0x2a')],function(_0x51d07a){return{'name':_0x51d07a[_0x0152('0x2b')],'type':_0x51d07a[_0x0152('0x2c')]['key']};});_0x226beb[_0x0152('0x2d')]=_['map'](_0x44fb4b,_0x0152('0x26'));_0x226beb[_0x0152('0x2e')]=_['keys'](_0x1a85af[_0x0152('0x2e')]);_0x226beb[_0x0152('0x2f')]=_[_0x0152('0x30')](_0x226beb[_0x0152('0x2d')],_0x226beb[_0x0152('0x2e')]);_0x26ecf8[_0x0152('0x31')]=_[_0x0152('0x30')](_0x226beb['model'],qs['fields'](_0x1a85af[_0x0152('0x2e')][_0x0152('0x32')]));_0x26ecf8['attributes']=_0x26ecf8[_0x0152('0x31')]['length']?_0x26ecf8[_0x0152('0x31')]:_0x226beb[_0x0152('0x2d')];if(!_0x1a85af['query'][_0x0152('0x33')]('nolimit')){_0x26ecf8[_0x0152('0x1f')]=qs[_0x0152('0x1f')](_0x1a85af[_0x0152('0x2e')][_0x0152('0x1f')]);_0x26ecf8['offset']=qs[_0x0152('0x1e')](_0x1a85af[_0x0152('0x2e')]['offset']);}_0x26ecf8[_0x0152('0x34')]=qs[_0x0152('0x35')](_0x1a85af['query']['sort']);_0x26ecf8[_0x0152('0x36')]=qs['filters'](_[_0x0152('0x37')](_0x1a85af['query'],_0x226beb[_0x0152('0x2f')]));if(_0x1a85af[_0x0152('0x2e')][_0x0152('0x38')]){_0x26ecf8[_0x0152('0x36')]=_[_0x0152('0x39')](_0x26ecf8['where'],{'$or':_[_0x0152('0x28')](_0x44fb4b,function(_0x3d2d07){if(_0x3d2d07['type']!==_0x0152('0x3a')){var _0x448b9c={};_0x448b9c[_0x3d2d07[_0x0152('0x26')]]={'$like':'%'+_0x1a85af[_0x0152('0x2e')][_0x0152('0x38')]+'%'};return _0x448b9c;}})});}_0x26ecf8=_[_0x0152('0x39')]({},_0x26ecf8,_0x1a85af[_0x0152('0x3b')]);var _0x4048aa={'where':_0x26ecf8[_0x0152('0x36')]};return db[_0x0152('0x29')][_0x0152('0x3c')](_0x4048aa)[_0x0152('0x23')](function(_0x251058){_0x5e64d3[_0x0152('0x3c')]=_0x251058;if(_0x1a85af[_0x0152('0x2e')]['includeAll']){_0x26ecf8[_0x0152('0x3d')]=[{'all':!![]}];}return db[_0x0152('0x29')][_0x0152('0x3e')](_0x26ecf8);})['then'](function(_0x5642bb){_0x5e64d3['rows']=_0x5642bb;return _0x5e64d3;})[_0x0152('0x23')](respondWithFilteredResult(_0x1c1e5b,_0x26ecf8))[_0x0152('0x3f')](handleError(_0x1c1e5b,null));};exports[_0x0152('0x40')]=function(_0x5527ab,_0x4e4743){var _0x2b4315={'raw':!![],'where':{'id':_0x5527ab['params']['id']}},_0x5c9169={};_0x5c9169['model']=_[_0x0152('0x41')](db[_0x0152('0x29')][_0x0152('0x2a')]);_0x5c9169['query']=_['keys'](_0x5527ab[_0x0152('0x2e')]);_0x5c9169[_0x0152('0x2f')]=_[_0x0152('0x30')](_0x5c9169[_0x0152('0x2d')],_0x5c9169[_0x0152('0x2e')]);_0x2b4315[_0x0152('0x31')]=_[_0x0152('0x30')](_0x5c9169[_0x0152('0x2d')],qs[_0x0152('0x32')](_0x5527ab[_0x0152('0x2e')][_0x0152('0x32')]));_0x2b4315[_0x0152('0x31')]=_0x2b4315['attributes'][_0x0152('0x42')]?_0x2b4315['attributes']:_0x5c9169[_0x0152('0x2d')];if(_0x5527ab[_0x0152('0x2e')][_0x0152('0x43')]){_0x2b4315[_0x0152('0x3d')]=[{'all':!![]}];}_0x2b4315=_[_0x0152('0x39')]({},_0x2b4315,_0x5527ab['options']);return db[_0x0152('0x29')][_0x0152('0x44')](_0x2b4315)[_0x0152('0x23')](handleEntityNotFound(_0x4e4743,null))[_0x0152('0x23')](respondWithResult(_0x4e4743,null))[_0x0152('0x3f')](handleError(_0x4e4743,null));};exports[_0x0152('0x45')]=function(_0xe95058,_0x2a9d99){return db['OpenchannelApplication'][_0x0152('0x45')](_0xe95058[_0x0152('0x46')],{})[_0x0152('0x23')](respondWithResult(_0x2a9d99,0xc9))[_0x0152('0x3f')](handleError(_0x2a9d99,null));};exports['update']=function(_0x1363c8,_0x5eb033){if(_0x1363c8[_0x0152('0x46')]['id']){delete _0x1363c8['body']['id'];}return db[_0x0152('0x29')]['find']({'where':{'id':_0x1363c8[_0x0152('0x47')]['id']}})[_0x0152('0x23')](handleEntityNotFound(_0x5eb033,null))[_0x0152('0x23')](saveUpdates(_0x1363c8['body'],null))[_0x0152('0x23')](respondWithResult(_0x5eb033,null))['catch'](handleError(_0x5eb033,null));};exports[_0x0152('0x24')]=function(_0x5aeccf,_0x3dc156){return db[_0x0152('0x29')][_0x0152('0x44')]({'where':{'id':_0x5aeccf[_0x0152('0x47')]['id']}})['then'](handleEntityNotFound(_0x3dc156,null))[_0x0152('0x23')](removeEntity(_0x3dc156,null))[_0x0152('0x3f')](handleError(_0x3dc156,null));}; \ No newline at end of file diff --git a/server/api/openchannelApplication/openchannelApplication.model.js b/server/api/openchannelApplication/openchannelApplication.model.js index 37f4595..bcf4df4 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 _0x34a2=['bluebird','request-promise','path','./openchannelApplication.attributes','define','OpenchannelApplication','utf8mb4','utf8mb4_unicode_ci','lodash','util','moment'];(function(_0x3a7878,_0x30621f){var _0x94747f=function(_0x29cf8d){while(--_0x29cf8d){_0x3a7878['push'](_0x3a7878['shift']());}};_0x94747f(++_0x30621f);}(_0x34a2,0x13c));var _0x234a=function(_0x204cc4,_0x4db21d){_0x204cc4=_0x204cc4-0x0;var _0xb08a30=_0x34a2[_0x204cc4];return _0xb08a30;};'use strict';var _=require(_0x234a('0x0'));var util=require(_0x234a('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0x234a('0x2'));var BPromise=require(_0x234a('0x3'));var rp=require(_0x234a('0x4'));var fs=require('fs');var path=require(_0x234a('0x5'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x234a('0x6'));module['exports']=function(_0x5dd1b8,_0x122ec5){return _0x5dd1b8[_0x234a('0x7')](_0x234a('0x8'),attributes,{'tableName':'openchannel_applications','paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x234a('0x9'),'collate':_0x234a('0xa')});}; \ No newline at end of file +var _0x240c=['bluebird','path','define','OpenchannelApplication','openchannel_applications','lodash','util','../../config/logger','api','moment'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x240c,0xd7));var _0xc240=function(_0x2a7bd8,_0x408b33){_0x2a7bd8=_0x2a7bd8-0x0;var _0x52800b=_0x240c[_0x2a7bd8];return _0x52800b;};'use strict';var _=require(_0xc240('0x0'));var util=require(_0xc240('0x1'));var logger=require(_0xc240('0x2'))(_0xc240('0x3'));var moment=require(_0xc240('0x4'));var BPromise=require(_0xc240('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xc240('0x6'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require('./openchannelApplication.attributes');module['exports']=function(_0x22be8a,_0x648547){return _0x22be8a[_0xc240('0x7')](_0xc240('0x8'),attributes,{'tableName':_0xc240('0x9'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':'utf8mb4','collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file diff --git a/server/api/openchannelApplication/openchannelApplication.rpc.js b/server/api/openchannelApplication/openchannelApplication.rpc.js index cdec9a0..8a4437c 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 _0x5f2f=['error','code','message','request\x20sent','result','catch','UpdateOpenchannelApplication','OpenchannelApplication','update','body','options','raw','where','attributes','limit','then','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/environment','jayson/promise','client','http','request','info','OpenchannelApplication,\x20%s,\x20%s','debug','stringify'];(function(_0x5a2d95,_0xb362e5){var _0x2c3986=function(_0x5cce7c){while(--_0x5cce7c){_0x5a2d95['push'](_0x5a2d95['shift']());}};_0x2c3986(++_0xb362e5);}(_0x5f2f,0x73));var _0xf5f2=function(_0x4e681d,_0x22fa7e){_0x4e681d=_0x4e681d-0x0;var _0x56c535=_0x5f2f[_0x4e681d];return _0x56c535;};'use strict';var _=require(_0xf5f2('0x0'));var util=require(_0xf5f2('0x1'));var moment=require(_0xf5f2('0x2'));var BPromise=require(_0xf5f2('0x3'));var rs=require(_0xf5f2('0x4'));var fs=require('fs');var Redis=require(_0xf5f2('0x5'));var db=require(_0xf5f2('0x6'))['db'];var utils=require(_0xf5f2('0x7'));var logger=require('../../config/logger')('rpc');var config=require(_0xf5f2('0x8'));var jayson=require(_0xf5f2('0x9'));var client=jayson[_0xf5f2('0xa')][_0xf5f2('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x3133bc,_0x473100,_0x5907aa){return new BPromise(function(_0x466882,_0x46cd9c){return client[_0xf5f2('0xc')](_0x3133bc,_0x5907aa)['then'](function(_0x375da4){logger[_0xf5f2('0xd')](_0xf5f2('0xe'),_0x473100,'request\x20sent');logger[_0xf5f2('0xf')]('OpenchannelApplication,\x20%s,\x20%s,\x20%s',_0x473100,'request\x20sent',JSON[_0xf5f2('0x10')](_0x375da4));if(_0x375da4[_0xf5f2('0x11')]){if(_0x375da4['error'][_0xf5f2('0x12')]===0x1f4){logger[_0xf5f2('0x11')](_0xf5f2('0xe'),_0x473100,_0x375da4[_0xf5f2('0x11')][_0xf5f2('0x13')]);return _0x46cd9c(_0x375da4[_0xf5f2('0x11')]['message']);}logger[_0xf5f2('0x11')](_0xf5f2('0xe'),_0x473100,_0x375da4[_0xf5f2('0x11')][_0xf5f2('0x13')]);return _0x466882(_0x375da4[_0xf5f2('0x11')]['message']);}else{logger[_0xf5f2('0xd')](_0xf5f2('0xe'),_0x473100,_0xf5f2('0x14'));_0x466882(_0x375da4[_0xf5f2('0x15')][_0xf5f2('0x13')]);}})[_0xf5f2('0x16')](function(_0xdb61b3){logger[_0xf5f2('0x11')](_0xf5f2('0xe'),_0x473100,_0xdb61b3);_0x46cd9c(_0xdb61b3);});});}exports[_0xf5f2('0x17')]=function(_0x20fccd){var _0x28e097=this;return new Promise(function(_0x4ff59b,_0x3ee69){return db[_0xf5f2('0x18')][_0xf5f2('0x19')](_0x20fccd[_0xf5f2('0x1a')],{'raw':_0x20fccd['options']?_0x20fccd[_0xf5f2('0x1b')][_0xf5f2('0x1c')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x20fccd['options']?_0x20fccd['options'][_0xf5f2('0x1d')]||null:null,'attributes':_0x20fccd[_0xf5f2('0x1b')]?_0x20fccd['options'][_0xf5f2('0x1e')]||null:null,'limit':_0x20fccd[_0xf5f2('0x1b')]?_0x20fccd[_0xf5f2('0x1b')][_0xf5f2('0x1f')]||null:null})[_0xf5f2('0x20')](function(_0x4c691a){logger[_0xf5f2('0xd')](_0xf5f2('0x17'),_0x20fccd);logger[_0xf5f2('0xf')](_0xf5f2('0x17'),_0x20fccd,JSON[_0xf5f2('0x10')](_0x4c691a));_0x4ff59b(_0x4c691a);})['catch'](function(_0x529f07){logger[_0xf5f2('0x11')](_0xf5f2('0x17'),_0x529f07[_0xf5f2('0x13')],_0x20fccd);_0x3ee69(_0x28e097[_0xf5f2('0x11')](0x1f4,_0x529f07[_0xf5f2('0x13')]));});});}; \ No newline at end of file +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(_0x2a54bc,_0x5b53a6){var _0x472389=function(_0x8ab16e){while(--_0x8ab16e){_0x2a54bc['push'](_0x2a54bc['shift']());}};_0x472389(++_0x5b53a6);}(_0xb10b,0x12a));var _0xbb10=function(_0x5bf18d,_0x264c55){_0x5bf18d=_0x5bf18d-0x0;var _0x1d6cc0=_0xb10b[_0x5bf18d];return _0x1d6cc0;};'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 d17864d..9813587 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 _0xb857=['show','getMessages','/:id/download','post','create','/:id/messages','addMessage','/:id/tags','tracked','openchannelinteraction:addtags','addTags','/:id','openchannel','openchannelinteraction:update','delete','openchannelinteraction:destroy','multer','path','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./openchannelInteraction.controller','get','isAuthenticated','index','/describe','describe'];(function(_0x28997b,_0x7c663f){var _0x17db06=function(_0x32a6fe){while(--_0x32a6fe){_0x28997b['push'](_0x28997b['shift']());}};_0x17db06(++_0x7c663f);}(_0xb857,0xb8));var _0x7b85=function(_0x2a9d3c,_0x3a2972){_0x2a9d3c=_0x2a9d3c-0x0;var _0x18e63f=_0xb857[_0x2a9d3c];return _0x18e63f;};'use strict';var multer=require(_0x7b85('0x0'));var util=require('util');var path=require(_0x7b85('0x1'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x7b85('0x2')]();var auth=require(_0x7b85('0x3'));var interaction=require(_0x7b85('0x4'));var config=require(_0x7b85('0x5'));var controller=require(_0x7b85('0x6'));router[_0x7b85('0x7')]('/',auth[_0x7b85('0x8')](),controller[_0x7b85('0x9')]);router[_0x7b85('0x7')](_0x7b85('0xa'),auth[_0x7b85('0x8')](),controller[_0x7b85('0xb')]);router[_0x7b85('0x7')]('/:id',auth[_0x7b85('0x8')](),controller[_0x7b85('0xc')]);router[_0x7b85('0x7')]('/:id/messages',auth[_0x7b85('0x8')](),controller[_0x7b85('0xd')]);router['get'](_0x7b85('0xe'),auth[_0x7b85('0x8')](),controller['download']);router[_0x7b85('0xf')]('/',auth[_0x7b85('0x8')](),controller[_0x7b85('0x10')]);router[_0x7b85('0xf')](_0x7b85('0x11'),auth[_0x7b85('0x8')](),controller[_0x7b85('0x12')]);router[_0x7b85('0xf')](_0x7b85('0x13'),auth[_0x7b85('0x8')](),interaction[_0x7b85('0x14')]('openchannel',_0x7b85('0x15')),controller[_0x7b85('0x16')]);router['put'](_0x7b85('0x17'),auth[_0x7b85('0x8')](),interaction[_0x7b85('0x14')](_0x7b85('0x18'),_0x7b85('0x19')),controller['update']);router[_0x7b85('0x1a')]('/:id',auth[_0x7b85('0x8')](),interaction[_0x7b85('0x14')](_0x7b85('0x18'),_0x7b85('0x1b')),controller['destroy']);router['delete'](_0x7b85('0x13'),auth['isAuthenticated'](),controller['removeTags']);module['exports']=router; \ No newline at end of file +var _0x71c6=['post','addMessage','/:id/tags','tracked','openchannel','openchannelinteraction:addtags','addTags','put','openchannelinteraction:update','update','openchannelinteraction:destroy','delete','removeTags','exports','multer','util','path','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./openchannelInteraction.controller','get','index','/describe','isAuthenticated','/:id','/:id/messages','getMessages','download','create'];(function(_0x21f3bf,_0xfb0f59){var _0x249d08=function(_0x37e6c2){while(--_0x37e6c2){_0x21f3bf['push'](_0x21f3bf['shift']());}};_0x249d08(++_0xfb0f59);}(_0x71c6,0xce));var _0x671c=function(_0x5904bb,_0x5b0e33){_0x5904bb=_0x5904bb-0x0;var _0x75d071=_0x71c6[_0x5904bb];return _0x75d071;};'use strict';var multer=require(_0x671c('0x0'));var util=require(_0x671c('0x1'));var path=require(_0x671c('0x2'));var timeout=require('connect-timeout');var express=require(_0x671c('0x3'));var router=express[_0x671c('0x4')]();var auth=require(_0x671c('0x5'));var interaction=require(_0x671c('0x6'));var config=require(_0x671c('0x7'));var controller=require(_0x671c('0x8'));router[_0x671c('0x9')]('/',auth['isAuthenticated'](),controller[_0x671c('0xa')]);router[_0x671c('0x9')](_0x671c('0xb'),auth[_0x671c('0xc')](),controller['describe']);router['get'](_0x671c('0xd'),auth[_0x671c('0xc')](),controller['show']);router[_0x671c('0x9')](_0x671c('0xe'),auth['isAuthenticated'](),controller[_0x671c('0xf')]);router[_0x671c('0x9')]('/:id/download',auth[_0x671c('0xc')](),controller[_0x671c('0x10')]);router['post']('/',auth[_0x671c('0xc')](),controller[_0x671c('0x11')]);router[_0x671c('0x12')](_0x671c('0xe'),auth[_0x671c('0xc')](),controller[_0x671c('0x13')]);router[_0x671c('0x12')](_0x671c('0x14'),auth[_0x671c('0xc')](),interaction[_0x671c('0x15')](_0x671c('0x16'),_0x671c('0x17')),controller[_0x671c('0x18')]);router[_0x671c('0x19')]('/:id',auth['isAuthenticated'](),interaction['tracked'](_0x671c('0x16'),_0x671c('0x1a')),controller[_0x671c('0x1b')]);router['delete'](_0x671c('0xd'),auth[_0x671c('0xc')](),interaction[_0x671c('0x15')](_0x671c('0x16'),_0x671c('0x1c')),controller['destroy']);router[_0x671c('0x1d')](_0x671c('0x14'),auth[_0x671c('0xc')](),controller[_0x671c('0x1e')]);module[_0x671c('0x1f')]=router; \ No newline at end of file diff --git a/server/api/openchannelInteraction/openchannelInteraction.attributes.js b/server/api/openchannelInteraction/openchannelInteraction.attributes.js index ee55cf9..39da476 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 _0x1057=['out','sequelize','exports','DATE','STRING'];(function(_0x215e65,_0x183f97){var _0xa85842=function(_0x43bf45){while(--_0x43bf45){_0x215e65['push'](_0x215e65['shift']());}};_0xa85842(++_0x183f97);}(_0x1057,0x1e1));var _0x7105=function(_0x33638a,_0x530ebf){_0x33638a=_0x33638a-0x0;var _0x45ec9a=_0x1057[_0x33638a];return _0x45ec9a;};'use strict';var Sequelize=require(_0x7105('0x0'));module[_0x7105('0x1')]={'closed':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'closedAt':{'type':Sequelize[_0x7105('0x2')]},'disposition':{'type':Sequelize['STRING']},'note':{'type':Sequelize[_0x7105('0x3')]},'read1stAt':{'type':Sequelize[_0x7105('0x2')]},'threadId':{'type':Sequelize[_0x7105('0x3')]},'externalUrl':{'type':Sequelize[_0x7105('0x3')]},'lastMsgAt':{'type':Sequelize[_0x7105('0x2')]},'lastMsgDirection':{'type':Sequelize['ENUM']('in',_0x7105('0x4')),'defaultValue':'in','allowNull':![]},'from':{'type':Sequelize[_0x7105('0x3')]}}; \ No newline at end of file +var _0xf9aa=['out','sequelize','exports','DATE','STRING'];(function(_0x1e5191,_0x430c3f){var _0x47859e=function(_0x4f082b){while(--_0x4f082b){_0x1e5191['push'](_0x1e5191['shift']());}};_0x47859e(++_0x430c3f);}(_0xf9aa,0x18c));var _0xaf9a=function(_0x209302,_0x5826ac){_0x209302=_0x209302-0x0;var _0x1df8e9=_0xf9aa[_0x209302];return _0x1df8e9;};'use strict';var Sequelize=require(_0xaf9a('0x0'));module[_0xaf9a('0x1')]={'closed':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'closedAt':{'type':Sequelize[_0xaf9a('0x2')]},'disposition':{'type':Sequelize[_0xaf9a('0x3')]},'note':{'type':Sequelize[_0xaf9a('0x3')]},'read1stAt':{'type':Sequelize[_0xaf9a('0x2')]},'threadId':{'type':Sequelize[_0xaf9a('0x3')]},'externalUrl':{'type':Sequelize[_0xaf9a('0x3')]},'lastMsgAt':{'type':Sequelize[_0xaf9a('0x2')]},'lastMsgDirection':{'type':Sequelize['ENUM']('in',_0xaf9a('0x4')),'defaultValue':'in','allowNull':![]},'from':{'type':Sequelize[_0xaf9a('0x3')]}}; \ No newline at end of file diff --git a/server/api/openchannelInteraction/openchannelInteraction.controller.js b/server/api/openchannelInteraction/openchannelInteraction.controller.js index 6e3a368..2b0f0fa 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 _0xdb7a=['createdAt','direction','secret','OpenchannelAccount','Owner','get','\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20
Interaction\x20Transcript
\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','30px','\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20%s\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20{{page}}/{{pages}}\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20%s\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','%s\x20#%d','Openchannel','YYYY-MM-DD','N.A.','closedAt','disposition','threadId','Private','basename','pipe','createWriteStream','out','System','firstName','lastName','root','views','transcript-','.pdf','err','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','desk.js','querystring','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','redis','localhost','socket.io-emitter','./openchannelInteraction.socket','register','sendStatus','status','json','offset','limit','set','Content-Range','update','then','destroy','end','error','stack','send','map','TagIds','Tags','split','forEach','catch','index','rawAttributes','fieldName','type','key','model','keys','filters','intersection','query','attributes','fields','length','order','sort','pick','select','field','color','from','tools_tags','u.id','ui.OpenchannelInteractionId','users','u.id\x20=\x20ui.UserId','openchannel_interactions','left_join','cm_contacts','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL','o.id\x20=\x20i.UserId','openchannel_accounts','a.id\x20=\x20i.OpenchannelAccountId','me.OpenchannelInteractionId\x20=\x20i.id','openchannel_interaction_has_tags','it.OpenchannelInteractionId\x20=\x20i.id','t.id\x20=\x20it.TagId','expr','search','sqlOperator','conditions','find','value','having','`\x20=\x200','`\x20>\x200','Contact','operator','$substring','MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','getFullTextValue','name','ContactId','buildExpression','Tag','CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','union','User','UserId','text','start','body','some','compact','isEmpty','OpenchannelAccountId','where','concat','parse','$gte','$lte','i.createdAt\x20BETWEEN\x20?\x20AND\x20?','null','\x20IS\x20NULL','\x20=\x20?','read','`unreadMessages`\x20=\x200','`unreadMessages`\x20>\x200','isArray','tag','filter','replace','\x27\x27\x27\x27','isNumeric','i.id\x20LIKE\x20?','MATCH\x20(me.body)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','i.from\x20LIKE\x20?','CONCAT(c.firstName,\x20\x27\x20\x27,\x20c.lastName)\x20LIKE\x20?','group','i.id','QueryTypes','SELECT','clone','SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','DESC','t.id\x20IN\x20?','resolve','user','getOpenchannelAccounts','i.OpenchannelAccountId\x20IS\x20NULL','sequelize','toString','merge','OpenchannelInteraction','unreadMessages','a.mandatoryDisposition','i.*','c.firstName','Contact.lastName','Contact.email','c.phone','c.mobile','Contact.fax','o.fullname','o.internal','GROUP_CONCAT(DISTINCT\x20t.id)','ui.OpenchannelInteractionId\x20IN\x20?','groupBy','all','rows','show','params','includeAll','include','options','create','describe','addMessage','ids','omit','getMessages','findOne','hasOwnProperty','OpenchannelInteractionId','format','YYYY-MM-DD\x20HH:mm:ss','OpenchannelMessage','count','addTags','setTags','spread','findAll','emit','openchannelInteractionTags:save','removeTags','download','unix','server','files','tmp','join','attachments','fullname','push','CmContact','Attachment','Messages'];(function(_0x181ec8,_0x59f452){var _0x203cba=function(_0x1755ef){while(--_0x1755ef){_0x181ec8['push'](_0x181ec8['shift']());}};_0x203cba(++_0x59f452);}(_0xdb7a,0x106));var _0xadb7=function(_0x574573,_0x4ded8a){_0x574573=_0x574573-0x0;var _0x4461e4=_0xdb7a[_0x574573];return _0x4461e4;};'use strict';var pdf=require('html-pdf');var emlformat=require('eml-format');var rimraf=require(_0xadb7('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0xadb7('0x1'));var rp=require(_0xadb7('0x2'));var moment=require(_0xadb7('0x3'));var BPromise=require(_0xadb7('0x4'));var Mustache=require(_0xadb7('0x5'));var util=require(_0xadb7('0x6'));var path=require(_0xadb7('0x7'));var sox=require(_0xadb7('0x8'));var csv=require(_0xadb7('0x9'));var ejs=require(_0xadb7('0xa'));var fs=require('fs');var _=require(_0xadb7('0xb'));var squel=require('squel');var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0xadb7('0xc'));var toCsv=require(_0xadb7('0x9'));var querystring=require(_0xadb7('0xd'));var Papa=require('papaparse');var Redis=require(_0xadb7('0xe'));var authService=require('../../components/auth/service');var qs=require(_0xadb7('0xf'));var as=require(_0xadb7('0x10'));var hardwareService=require(_0xadb7('0x11'));var logger=require(_0xadb7('0x12'))(_0xadb7('0x13'));var utils=require(_0xadb7('0x14'));var config=require(_0xadb7('0x15'));var db=require(_0xadb7('0x16'))['db'];config[_0xadb7('0x17')]=_['defaults'](config[_0xadb7('0x17')],{'host':_0xadb7('0x18'),'port':0x18eb});var socket=require(_0xadb7('0x19'))(new Redis(config[_0xadb7('0x17')]));require(_0xadb7('0x1a'))[_0xadb7('0x1b')](socket);function respondWithStatusCode(_0x323429,_0x53f37f){_0x53f37f=_0x53f37f||0xcc;return function(_0x2eb522){if(_0x2eb522){return _0x323429[_0xadb7('0x1c')](_0x53f37f);}return _0x323429[_0xadb7('0x1d')](_0x53f37f)['end']();};}function respondWithResult(_0x2e81b7,_0x3d7dde){_0x3d7dde=_0x3d7dde||0xc8;return function(_0x8a78a9){if(_0x8a78a9){return _0x2e81b7[_0xadb7('0x1d')](_0x3d7dde)[_0xadb7('0x1e')](_0x8a78a9);}};}function respondWithFilteredResult(_0x1e2c36,_0x19ca92){return function(_0x18480c){if(_0x18480c){var _0x79e257=_0x18480c['count'],_0x5e90bb=_0x19ca92[_0xadb7('0x1f')],_0x3a9fe4=_0x19ca92[_0xadb7('0x1f')]+_0x19ca92[_0xadb7('0x20')],_0x2b3eca;if(_0x3a9fe4>=_0x79e257){_0x3a9fe4=_0x79e257;_0x2b3eca=0xc8;}else{_0x2b3eca=0xce;}_0x1e2c36[_0xadb7('0x1d')](_0x2b3eca);return _0x1e2c36[_0xadb7('0x21')](_0xadb7('0x22'),_0x5e90bb+'-'+_0x3a9fe4+'/'+_0x79e257)[_0xadb7('0x1e')](_0x18480c);}return null;};}function patchUpdates(_0x279504){return function(_0x5ad284){try{jsonpatch['apply'](_0x5ad284,_0x279504,!![]);}catch(_0xd6f519){return BPromise['reject'](_0xd6f519);}return _0x5ad284['save']();};}function saveUpdates(_0x322b8c,_0xa6703e){return function(_0x494ad8){if(_0x494ad8){return _0x494ad8[_0xadb7('0x23')](_0x322b8c)[_0xadb7('0x24')](function(_0x51a348){return _0x51a348;});}return null;};}function removeEntity(_0x1d3145,_0x61fd97){return function(_0x553d96){if(_0x553d96){return _0x553d96[_0xadb7('0x25')]()['then'](function(){_0x1d3145[_0xadb7('0x1d')](0xcc)[_0xadb7('0x26')]();});}};}function handleEntityNotFound(_0x210f83,_0x417944){return function(_0x1e0a76){if(!_0x1e0a76){_0x210f83[_0xadb7('0x1c')](0x194);}return _0x1e0a76;};}function handleError(_0x2e6773,_0x355c08){_0x355c08=_0x355c08||0x1f4;return function(_0x21efa0){logger[_0xadb7('0x27')](_0x21efa0[_0xadb7('0x28')]);if(_0x21efa0['name']){delete _0x21efa0['name'];}_0x2e6773[_0xadb7('0x1d')](_0x355c08)[_0xadb7('0x29')](_0x21efa0);};}function getInteractionUsers(_0x264f28,_0xafd920){return new BPromise(function(_0x2b8d62,_0x4261db){try{if(_0xafd920[_0x264f28['id']]){_0x264f28['Users']=_[_0xadb7('0x2a')](_0xafd920[_0x264f28['id']],function(_0x39aef4){return{'id':_0x39aef4['id'],'fullname':_0x39aef4['fullname']};});}}catch(_0x4a40b9){_0x4261db(_0x4a40b9);}_0x2b8d62(_0x264f28);});}function getInteractionTags(_0x3f1f55,_0x2170ff){return new BPromise(function(_0x34d4b1,_0x5b0606){try{if(_0x3f1f55[_0xadb7('0x2b')]){_0x3f1f55[_0xadb7('0x2c')]=[];_0x3f1f55[_0xadb7('0x2b')][_0xadb7('0x2d')](',')[_0xadb7('0x2e')](function(_0x4b169f){_0x3f1f55['Tags']['push'](_0x2170ff[_0x4b169f]);});}delete _0x3f1f55[_0xadb7('0x2b')];}catch(_0x5845c5){_0x5b0606(_0x5845c5);}_0x34d4b1(_0x3f1f55);});}function updateOpenchannelInteraction(_0x2e36a5,_0xef0574,_0x27d4bc){return new BPromise(function(_0x3887aa,_0x1caf24){return getInteractionUsers(_0x2e36a5,_0x27d4bc)[_0xadb7('0x24')](function(_0x4a0109){return getInteractionTags(_0x4a0109,_0xef0574);})[_0xadb7('0x24')](function(_0x1a3f3c){_0x3887aa(_0x1a3f3c);})[_0xadb7('0x2f')](function(_0x34d8a3){_0x1caf24(_0x34d8a3);});});}exports[_0xadb7('0x30')]=function(_0x41a59b,_0x424ac5){var _0x557eca={},_0x5e7213={},_0x5d6010={'count':0x0,'rows':[]};var _0x1aa01f=_[_0xadb7('0x2a')](db['OpenchannelInteraction'][_0xadb7('0x31')],function(_0x5f292){return{'name':_0x5f292[_0xadb7('0x32')],'type':_0x5f292[_0xadb7('0x33')][_0xadb7('0x34')]};});_0x5e7213[_0xadb7('0x35')]=_[_0xadb7('0x2a')](_0x1aa01f,'name');_0x5e7213['query']=_[_0xadb7('0x36')](_0x41a59b['query']);_0x5e7213[_0xadb7('0x37')]=_[_0xadb7('0x38')](_0x5e7213[_0xadb7('0x35')],_0x5e7213[_0xadb7('0x39')]);_0x557eca[_0xadb7('0x3a')]=_[_0xadb7('0x38')](_0x5e7213['model'],qs[_0xadb7('0x3b')](_0x41a59b[_0xadb7('0x39')][_0xadb7('0x3b')]));_0x557eca[_0xadb7('0x3a')]=_0x557eca[_0xadb7('0x3a')][_0xadb7('0x3c')]?_0x557eca[_0xadb7('0x3a')]:_0x5e7213[_0xadb7('0x35')];if(!_0x41a59b['query']['hasOwnProperty']('nolimit')){_0x557eca[_0xadb7('0x20')]=qs[_0xadb7('0x20')](_0x41a59b[_0xadb7('0x39')][_0xadb7('0x20')]);_0x557eca[_0xadb7('0x1f')]=qs['offset'](_0x41a59b[_0xadb7('0x39')][_0xadb7('0x1f')]);}_0x557eca[_0xadb7('0x3d')]=qs[_0xadb7('0x3e')](_0x41a59b[_0xadb7('0x39')]['sort']);_0x557eca['where']=qs[_0xadb7('0x37')](_[_0xadb7('0x3f')](_0x41a59b['query'],_0x5e7213[_0xadb7('0x37')]));var _0x19e6b9=[];var _0x5c22a3=squel[_0xadb7('0x40')]()[_0xadb7('0x41')]('id')[_0xadb7('0x41')]('name')[_0xadb7('0x41')](_0xadb7('0x42'))[_0xadb7('0x43')](_0xadb7('0x44'));var _0x46ab5c=squel['select']()['field'](_0xadb7('0x45'))[_0xadb7('0x41')]('u.fullname')[_0xadb7('0x41')](_0xadb7('0x46'))[_0xadb7('0x43')]('user_has_openchannel_interactions','ui')['left_join'](_0xadb7('0x47'),'u',_0xadb7('0x48'));var _0x40f328=squel[_0xadb7('0x40')]()[_0xadb7('0x43')](_0xadb7('0x49'),'i')[_0xadb7('0x4a')](_0xadb7('0x4b'),'c',_0xadb7('0x4c'))[_0xadb7('0x4a')]('users','o',_0xadb7('0x4d'))[_0xadb7('0x4a')](_0xadb7('0x4e'),'a',_0xadb7('0x4f'))['left_join']('openchannel_messages','me',_0xadb7('0x50'))['left_join'](_0xadb7('0x51'),'it',_0xadb7('0x52'))[_0xadb7('0x4a')](_0xadb7('0x44'),'t',_0xadb7('0x53'));var _0xf92844=squel[_0xadb7('0x54')]();var _0x918544=[];var _0x9834cc=squel['expr']();var _0x2b54ec;if(_0x41a59b['query'][_0xadb7('0x55')]){_0x2b54ec=as['parseSearch'](_0x41a59b['query'][_0xadb7('0x55')]);var _0x1c1b51=_0x2b54ec[_0xadb7('0x56')];for(var _0x1735ed=0x0;_0x1735ed<_0x2b54ec['conditions'][_0xadb7('0x3c')];_0x1735ed++){var _0x890ae1=_0x2b54ec[_0xadb7('0x57')][_0x1735ed];var _0x28c082='i';var _0x3a3e04=_[_0xadb7('0x58')](_0x1aa01f,['name',_0x890ae1[_0xadb7('0x41')]]);if(!_0x3a3e04){switch(_0x890ae1[_0xadb7('0x41')]){case'unreadMessages':if(_0x890ae1[_0xadb7('0x59')]==0x1){_0x40f328[_0xadb7('0x5a')]('`'+_0x890ae1[_0xadb7('0x41')]+_0xadb7('0x5b'));}else{_0x40f328['having']('`'+_0x890ae1[_0xadb7('0x41')]+_0xadb7('0x5c'));}break;case _0xadb7('0x5d'):if(_0x890ae1[_0xadb7('0x5e')]===_0xadb7('0x5f')){if(_0x890ae1[_0xadb7('0x59')][_0xadb7('0x2d')]('\x20')[_0xadb7('0x3c')]>0x1){_0xf92844[_0x1c1b51](_0xadb7('0x60'),qs[_0xadb7('0x61')](_0x890ae1[_0xadb7('0x59')]),null);}else{var _0x491217='%'+_0x890ae1[_0xadb7('0x59')]+'%';_0xf92844[_0x1c1b51]('c.firstName\x20LIKE\x20?\x20OR\x20c.lastName\x20LIKE\x20?\x20OR\x20c.email\x20LIKE\x20?',_0x491217,_0x491217,_0x491217);}}else{_0x3a3e04=_['find'](_0x1aa01f,[_0xadb7('0x62'),_0xadb7('0x63')]);_0x890ae1['field']=_0xadb7('0x63');_0x2acc92=as[_0xadb7('0x64')](_0x28c082,_0x3a3e04[_0xadb7('0x33')],_0x890ae1);_0xf92844[_0x1c1b51](_0x2acc92['text'],_0x2acc92['value']['start'],_0x2acc92['value']['end']);}break;case _0xadb7('0x65'):var _0x565430=_0x890ae1[_0xadb7('0x59')][_0xadb7('0x2d')](',')['map'](function(_0x1ae58f){return Number(_0x1ae58f);});_0x565430['forEach'](function(_0x36b3ee){_0x9834cc['or'](_0xadb7('0x66'),'%,'+_0x36b3ee+',%');});_0x918544=_[_0xadb7('0x67')](_0x918544,_0x565430);break;case _0xadb7('0x68'):if(_0x890ae1[_0xadb7('0x5e')]===_0xadb7('0x5f')){_0xf92844[_0x1c1b51]('CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?','%'+_0x890ae1[_0xadb7('0x59')]+'%',null);}else{_0x3a3e04=_[_0xadb7('0x58')](_0x1aa01f,[_0xadb7('0x62'),_0xadb7('0x69')]);_0x890ae1[_0xadb7('0x41')]=_0xadb7('0x69');_0x2acc92=as[_0xadb7('0x64')](_0x28c082,_0x3a3e04['type'],_0x890ae1);_0xf92844[_0x1c1b51](_0x2acc92[_0xadb7('0x6a')],_0x2acc92[_0xadb7('0x59')][_0xadb7('0x6b')],_0x2acc92[_0xadb7('0x59')]['end']);}break;case _0xadb7('0x6c'):_0x2acc92=as[_0xadb7('0x64')]('me',null,_0x890ae1);_0xf92844[_0x1c1b51](_0x2acc92[_0xadb7('0x6a')],_0x2acc92[_0xadb7('0x59')][_0xadb7('0x6b')],_0x2acc92['value'][_0xadb7('0x26')]);break;}}else{var _0x2acc92=as[_0xadb7('0x64')](_0x28c082,_0x3a3e04[_0xadb7('0x33')],_0x890ae1);_0xf92844[_0x1c1b51](_0x2acc92[_0xadb7('0x6a')],_0x2acc92[_0xadb7('0x59')][_0xadb7('0x6b')],_0x2acc92[_0xadb7('0x59')][_0xadb7('0x26')]);}}}else{var _0x313c7f=_(_0x41a59b['query'])[_0xadb7('0x36')]()[_0xadb7('0x2a')](function(_0xf94e8){return _[_0xadb7('0x6d')](_0x1aa01f,[_0xadb7('0x62'),_0xf94e8])?_0xf94e8:undefined;})[_0xadb7('0x6e')]()[_0xadb7('0x59')]();if(!_[_0xadb7('0x6f')](_0x313c7f)){_0x313c7f['forEach'](function(_0x3f9aa5){if(_0x3f9aa5===_0xadb7('0x70')){_0x40f328[_0xadb7('0x71')]('i.OpenchannelAccountId\x20IN\x20?',[][_0xadb7('0x72')](_0x41a59b[_0xadb7('0x39')][_0x3f9aa5]));}else if(_0x3f9aa5==='createdAt'){var _0x4647a8=JSON[_0xadb7('0x73')](_0x41a59b[_0xadb7('0x39')][_0x3f9aa5])[_0xadb7('0x74')];var _0x1f406f=JSON[_0xadb7('0x73')](_0x41a59b[_0xadb7('0x39')][_0x3f9aa5])[_0xadb7('0x75')];_0x40f328[_0xadb7('0x71')](_0xadb7('0x76'),_0x4647a8,_0x1f406f);}else{if(_0x41a59b[_0xadb7('0x39')][_0x3f9aa5]===_0xadb7('0x77')){_0x40f328[_0xadb7('0x71')]('i.'+_0x3f9aa5+_0xadb7('0x78'));}else{_0x40f328[_0xadb7('0x71')]('i.'+_0x3f9aa5+_0xadb7('0x79'),_0x41a59b[_0xadb7('0x39')][_0x3f9aa5]);}}});}if(_0x41a59b[_0xadb7('0x39')][_0xadb7('0x7a')]){if(_0x41a59b[_0xadb7('0x39')]['read']==0x1){_0x40f328[_0xadb7('0x5a')](_0xadb7('0x7b'));}else{_0x40f328['having'](_0xadb7('0x7c'));}}if(_0x41a59b[_0xadb7('0x39')]['tag']){_0x918544=_[_0xadb7('0x7d')](_0x41a59b[_0xadb7('0x39')][_0xadb7('0x7e')])?_0x41a59b[_0xadb7('0x39')][_0xadb7('0x7e')]:new Array(_0x41a59b[_0xadb7('0x39')][_0xadb7('0x7e')]);_0x918544['forEach'](function(_0x558e76){_0x9834cc['or']('CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','%,'+_0x558e76+',%');});}if(_0x41a59b['query'][_0xadb7('0x7f')]){var _0x506514=_0x41a59b['query'][_0xadb7('0x7f')]['replace']('\x5c','\x5c\x5c')[_0xadb7('0x80')]('\x27\x27',_0xadb7('0x81'));if(qs[_0xadb7('0x82')](_0x506514)){_0xf92844['or'](_0xadb7('0x83'),_0x506514+'%');}else{_0xf92844['or'](_0xadb7('0x84'),qs[_0xadb7('0x61')](_0x506514))['or'](_0xadb7('0x85'),_0x506514+'%')['or'](_0xadb7('0x86'),_0x506514+'%');}}}_0x40f328[_0xadb7('0x71')](_0xf92844);_0x40f328[_0xadb7('0x87')](_0xadb7('0x88'));var _0x1547f8={'type':db['Sequelize'][_0xadb7('0x89')][_0xadb7('0x8a')],'raw':!![]};var _0x30e7e9=_0x40f328[_0xadb7('0x8b')]();_0x30e7e9[_0xadb7('0x41')](_0xadb7('0x88'));_0x30e7e9['field'](_0xadb7('0x8c'),'unreadMessages');if(_0x557eca[_0xadb7('0x3d')]){_0x557eca[_0xadb7('0x3d')][_0xadb7('0x2e')](function(_0x575cec){_0x40f328[_0xadb7('0x3d')]('i.'+_0x575cec[0x0],_0x575cec[0x1]===_0xadb7('0x8d')?![]:!![]);});}if(!_[_0xadb7('0x6f')](_0x918544)){_0x40f328[_0xadb7('0x5a')](_0x9834cc);_0x30e7e9[_0xadb7('0x71')](_0xadb7('0x8e'),_0x918544);}BPromise[_0xadb7('0x8f')]()['then'](function(){if(!_0x2b54ec){if(_0x41a59b[_0xadb7('0x39')][_0xadb7('0x70')]||_0x41a59b['query']['journey'])return;_0x30e7e9[_0xadb7('0x71')]('i.OpenchannelAccountId\x20IS\x20NOT\x20NULL');_0x40f328[_0xadb7('0x71')]('i.OpenchannelAccountId\x20IS\x20NOT\x20NULL');return;}return _0x41a59b[_0xadb7('0x90')][_0xadb7('0x91')]({'attributes':['id'],'raw':!![]})['then'](function(_0x35f9ae){if(_[_0xadb7('0x6f')](_0x35f9ae)){_0x30e7e9['where'](_0xadb7('0x92'));_0x40f328[_0xadb7('0x71')](_0xadb7('0x92'));}else{_0x30e7e9[_0xadb7('0x71')]('i.OpenchannelAccountId\x20IN\x20?',_[_0xadb7('0x2a')](_0x35f9ae,'id'));_0x40f328[_0xadb7('0x71')]('i.OpenchannelAccountId\x20IN\x20?',_[_0xadb7('0x2a')](_0x35f9ae,'id'));}});})[_0xadb7('0x24')](function(){db[_0xadb7('0x93')][_0xadb7('0x39')](_0x30e7e9[_0xadb7('0x94')](),_0x1547f8)[_0xadb7('0x24')](function(_0x136cf5){_0x5d6010['count']=_0x136cf5[_0xadb7('0x3c')];if(_0x5d6010['count']===0x0)return[];return db['sequelize'][_0xadb7('0x39')](_0x5c22a3['toString'](),_0x1547f8)[_0xadb7('0x24')](function(_0x420a0e){_0x19e6b9=_['keyBy'](_0x420a0e,'id');_0x1547f8=_[_0xadb7('0x95')](_0x1547f8,{'model':db[_0xadb7('0x96')],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x41a59b[_0xadb7('0x39')]['fields']){_0x557eca['attributes']['forEach'](function(_0x16dcd3){_0x40f328['field']('i.'+_0x16dcd3);});}else{_0x40f328['field'](_0xadb7('0x8c'),_0xadb7('0x97'));_0x40f328[_0xadb7('0x41')]('a.key','Account.key');_0x40f328['field'](_0xadb7('0x98'),'Account.mandatoryDisposition');_0x40f328[_0xadb7('0x41')](_0xadb7('0x99'));_0x40f328[_0xadb7('0x41')](_0xadb7('0x9a'),'Contact.firstName');_0x40f328['field']('c.lastName',_0xadb7('0x9b'));_0x40f328[_0xadb7('0x41')]('c.email',_0xadb7('0x9c'));_0x40f328[_0xadb7('0x41')](_0xadb7('0x9d'),'Contact.phone');_0x40f328[_0xadb7('0x41')](_0xadb7('0x9e'),'Contact.mobile');_0x40f328[_0xadb7('0x41')]('c.fax',_0xadb7('0x9f'));_0x40f328[_0xadb7('0x41')](_0xadb7('0xa0'),'Owner.fullname');_0x40f328[_0xadb7('0x41')](_0xadb7('0xa1'),'Owner.internal');_0x40f328[_0xadb7('0x41')](_0xadb7('0xa2'),'TagIds');}_0x40f328[_0xadb7('0x20')](_0x557eca[_0xadb7('0x20')]);_0x40f328[_0xadb7('0x1f')](_0x557eca[_0xadb7('0x1f')]);return db[_0xadb7('0x93')][_0xadb7('0x39')](_0x40f328[_0xadb7('0x94')](),_0x1547f8);})['then'](function(_0xb7c10){_0x46ab5c[_0xadb7('0x71')](_0xadb7('0xa3'),_[_0xadb7('0x2a')](_0xb7c10,'id'));return db['sequelize'][_0xadb7('0x39')](_0x46ab5c['toString'](),_0x1547f8)['then'](function(_0x2e4b4a){var _0x42f5a7=_[_0xadb7('0xa4')](_0x2e4b4a,'OpenchannelInteractionId');var _0x3182e7=[];_0xb7c10[_0xadb7('0x2e')](function(_0x4d1d71){_0x3182e7['push'](updateOpenchannelInteraction(_0x4d1d71,_0x19e6b9,_0x42f5a7));});return BPromise[_0xadb7('0xa5')](_0x3182e7);});});})['then'](function(_0x52c28f){_0x5d6010[_0xadb7('0xa6')]=_0x52c28f;return _0x5d6010;})['then'](respondWithFilteredResult(_0x424ac5,_0x557eca));})[_0xadb7('0x2f')](handleError(_0x424ac5,null));};exports[_0xadb7('0xa7')]=function(_0x543f00,_0x367adc){var _0x3459ac={'raw':![],'where':{'id':_0x543f00[_0xadb7('0xa8')]['id']}},_0x4783bf={};_0x4783bf[_0xadb7('0x35')]=_[_0xadb7('0x36')](db[_0xadb7('0x96')]['rawAttributes']);_0x4783bf[_0xadb7('0x39')]=_[_0xadb7('0x36')](_0x543f00['query']);_0x4783bf[_0xadb7('0x37')]=_[_0xadb7('0x38')](_0x4783bf[_0xadb7('0x35')],_0x4783bf[_0xadb7('0x39')]);_0x3459ac[_0xadb7('0x3a')]=_[_0xadb7('0x38')](_0x4783bf[_0xadb7('0x35')],qs[_0xadb7('0x3b')](_0x543f00[_0xadb7('0x39')][_0xadb7('0x3b')]));_0x3459ac[_0xadb7('0x3a')]=_0x3459ac['attributes'][_0xadb7('0x3c')]?_0x3459ac[_0xadb7('0x3a')]:_0x4783bf[_0xadb7('0x35')];if(_0x543f00[_0xadb7('0x39')][_0xadb7('0xa9')]){_0x3459ac[_0xadb7('0xaa')]=[{'all':!![]}];}_0x3459ac=_[_0xadb7('0x95')]({},_0x3459ac,_0x543f00[_0xadb7('0xab')]);return db[_0xadb7('0x96')]['find'](_0x3459ac)['then'](handleEntityNotFound(_0x367adc,null))['then'](respondWithResult(_0x367adc,null))[_0xadb7('0x2f')](handleError(_0x367adc,null));};exports[_0xadb7('0xac')]=function(_0x538ec5,_0x19108c){return db[_0xadb7('0x96')][_0xadb7('0xac')](_0x538ec5[_0xadb7('0x6c')],{})[_0xadb7('0x24')](respondWithResult(_0x19108c,0xc9))['catch'](handleError(_0x19108c,null));};exports['update']=function(_0x5cdf60,_0x382570){if(_0x5cdf60[_0xadb7('0x6c')]['id']){delete _0x5cdf60[_0xadb7('0x6c')]['id'];}return db[_0xadb7('0x96')][_0xadb7('0x58')]({'where':{'id':_0x5cdf60[_0xadb7('0xa8')]['id']}})['then'](handleEntityNotFound(_0x382570,null))[_0xadb7('0x24')](saveUpdates(_0x5cdf60[_0xadb7('0x6c')],null))[_0xadb7('0x24')](respondWithResult(_0x382570,null))['catch'](handleError(_0x382570,null));};exports[_0xadb7('0x25')]=function(_0xb55414,_0x5dc31b){return db[_0xadb7('0x96')]['find']({'where':{'id':_0xb55414[_0xadb7('0xa8')]['id']}})['then'](handleEntityNotFound(_0x5dc31b,null))[_0xadb7('0x24')](removeEntity(_0x5dc31b,null))['catch'](handleError(_0x5dc31b,null));};exports[_0xadb7('0xad')]=function(_0x369e6,_0x4f62d0){return db[_0xadb7('0x96')][_0xadb7('0xad')]()[_0xadb7('0x24')](respondWithResult(_0x4f62d0,null))[_0xadb7('0x2f')](handleError(_0x4f62d0,null));};exports[_0xadb7('0xae')]=function(_0x3c781d,_0x2e3b3c,_0x7d4e4f){return db['OpenchannelMessage'][_0xadb7('0x58')]({'where':{'id':_0x3c781d[_0xadb7('0xa8')]['id']}})[_0xadb7('0x24')](handleEntityNotFound(_0x2e3b3c,null))[_0xadb7('0x24')](function(_0x2bc337){if(_0x2bc337){return _0x2bc337[_0xadb7('0xae')](_0x3c781d[_0xadb7('0x6c')][_0xadb7('0xaf')],_[_0xadb7('0xb0')](_0x3c781d[_0xadb7('0x6c')],['ids','id'])||{});}})[_0xadb7('0x24')](respondWithResult(_0x2e3b3c,null))['catch'](handleError(_0x2e3b3c,null));};exports[_0xadb7('0xb1')]=function(_0x1f2b6b,_0x1ee3f9,_0x3e3240){var _0x28ea7e={'raw':![],'where':{}};var _0x25cf91={};var _0xa9d7be={'count':0x0,'rows':[]};return db['OpenchannelInteraction'][_0xadb7('0xb2')]({'where':{'id':_0x1f2b6b[_0xadb7('0xa8')]['id']}})[_0xadb7('0x24')](handleEntityNotFound(_0x1ee3f9,null))[_0xadb7('0x24')](function(_0x2f0db6){if(_0x2f0db6){_0x25cf91[_0xadb7('0x35')]=_[_0xadb7('0x36')](db['OpenchannelMessage']['rawAttributes']);_0x25cf91['query']=_['keys'](_0x1f2b6b[_0xadb7('0x39')]);_0x25cf91['filters']=_['intersection'](_0x25cf91['model'],_0x25cf91['query']);_0x28ea7e[_0xadb7('0x3a')]=_[_0xadb7('0x38')](_0x25cf91[_0xadb7('0x35')],qs[_0xadb7('0x3b')](_0x1f2b6b['query'][_0xadb7('0x3b')]));_0x28ea7e[_0xadb7('0x3a')]=_0x28ea7e[_0xadb7('0x3a')]['length']?_0x28ea7e[_0xadb7('0x3a')]:_0x25cf91[_0xadb7('0x35')];if(!_0x1f2b6b[_0xadb7('0x39')][_0xadb7('0xb3')]('nolimit')){_0x28ea7e['limit']=qs['limit'](_0x1f2b6b['query'][_0xadb7('0x20')]);_0x28ea7e[_0xadb7('0x1f')]=qs[_0xadb7('0x1f')](_0x1f2b6b[_0xadb7('0x39')][_0xadb7('0x1f')]);}_0x28ea7e[_0xadb7('0x3d')]=qs[_0xadb7('0x3e')](_0x1f2b6b[_0xadb7('0x39')][_0xadb7('0x3e')]);_0x28ea7e[_0xadb7('0x71')]=qs[_0xadb7('0x37')](_[_0xadb7('0x3f')](_0x1f2b6b[_0xadb7('0x39')],_0x25cf91['filters']));_0x28ea7e[_0xadb7('0x71')][_0xadb7('0xb4')]=_0x2f0db6['id'];if(_0x1f2b6b[_0xadb7('0x39')][_0xadb7('0x7f')]){_0x28ea7e['where']=_[_0xadb7('0x95')](_0x28ea7e[_0xadb7('0x71')],{'$or':_[_0xadb7('0x2a')](_0x28ea7e[_0xadb7('0x3a')],function(_0xa39399){var _0x2030d5={};_0x2030d5[_0xa39399]={'$like':'%'+_0x1f2b6b[_0xadb7('0x39')]['filter']+'%'};return _0x2030d5;})});}if(_0x1f2b6b[_0xadb7('0x39')]['$gte']){var _0x37914d=_0x1f2b6b[_0xadb7('0x39')]['$gte'][_0xadb7('0x2d')](',');var _0x1b1753={};_0x1b1753[_0x37914d[0x0]]={'$gte':moment(_0x37914d[0x1])[_0xadb7('0xb5')](_0xadb7('0xb6'))};_0x28ea7e[_0xadb7('0x71')]=_[_0xadb7('0x95')](_0x28ea7e[_0xadb7('0x71')],_0x1b1753);}_0x28ea7e=_[_0xadb7('0x95')]({},_0x28ea7e,_0x1f2b6b[_0xadb7('0xab')]);return db[_0xadb7('0xb7')][_0xadb7('0xb8')]({'where':_0x28ea7e[_0xadb7('0x71')]})[_0xadb7('0x24')](function(_0x2e5a46){_0xa9d7be[_0xadb7('0xb8')]=_0x2e5a46;if(_0x1f2b6b['query'][_0xadb7('0xa9')]){_0x28ea7e[_0xadb7('0xaa')]=[{'all':!![]}];}return db[_0xadb7('0xb7')]['findAll'](_0x28ea7e);})['then'](function(_0x471e93){_0xa9d7be[_0xadb7('0xa6')]=_0x471e93;return _0xa9d7be;});}})[_0xadb7('0x24')](respondWithFilteredResult(_0x1ee3f9,_0x28ea7e))[_0xadb7('0x2f')](handleError(_0x1ee3f9,null));};exports[_0xadb7('0xb9')]=function(_0x172517,_0x1ae266,_0x464f22){return db['OpenchannelInteraction'][_0xadb7('0x58')]({'where':{'id':_0x172517[_0xadb7('0xa8')]['id']}})[_0xadb7('0x24')](handleEntityNotFound(_0x1ae266,null))['then'](function(_0x5ba619){if(_0x5ba619){return _0x5ba619[_0xadb7('0xba')](_0x172517[_0xadb7('0x6c')][_0xadb7('0xaf')],_[_0xadb7('0xb0')](_0x172517[_0xadb7('0x6c')],['ids','id'])||{})[_0xadb7('0xbb')](function(){return db[_0xadb7('0x65')][_0xadb7('0xbc')]({'attributes':['id','name',_0xadb7('0x42')],'where':{'id':_0x172517[_0xadb7('0x6c')][_0xadb7('0xaf')]}});})['then'](function(_0x21eecd){socket[_0xadb7('0xbd')](_0xadb7('0xbe'),{'id':Number(_0x172517[_0xadb7('0xa8')]['id']),'tags':_0x21eecd||[]});return{'id':Number(_0x172517['params']['id']),'tags':_0x21eecd||[]};});}})[_0xadb7('0x24')](respondWithResult(_0x1ae266,null))['catch'](handleError(_0x1ae266,null));};exports[_0xadb7('0xbf')]=function(_0x1a6d10,_0x73e181,_0x45322d){return db[_0xadb7('0x96')]['find']({'where':{'id':_0x1a6d10[_0xadb7('0xa8')]['id']}})[_0xadb7('0x24')](handleEntityNotFound(_0x73e181,null))[_0xadb7('0x24')](function(_0x21f2d4){if(_0x21f2d4){return _0x21f2d4['removeTags'](_0x1a6d10[_0xadb7('0x39')][_0xadb7('0xaf')]);}})['then'](respondWithStatusCode(_0x73e181,null))['catch'](handleError(_0x73e181,null));};exports[_0xadb7('0xc0')]=function(_0x343949,_0x4b2df9){var _0x26d965=moment()[_0xadb7('0xc1')]()['toString']();var _0x1f5352=path['join'](config['root'],_0xadb7('0xc2'),_0xadb7('0xc3'),_0xadb7('0xc4'));var _0x53abfb=path[_0xadb7('0xc5')](config['root'],'server',_0xadb7('0xc3'),_0xadb7('0xc6'));var _0x446499=path[_0xadb7('0xc5')](_0x1f5352,_0x26d965);var _0x2c4eb6=util[_0xadb7('0xb5')]('transcript-%d-%s.zip',_0x343949['params']['id'],_0x26d965);var _0x437f26=path['join'](_0x1f5352,_0x2c4eb6);var _0x380ce6=[];_0x380ce6['push']({'model':db[_0xadb7('0x68')],'as':'User','attributes':['id',_0xadb7('0xc7')],'raw':!![]});_0x380ce6[_0xadb7('0xc8')]({'model':db[_0xadb7('0xc9')],'as':'Contact','attributes':['id','firstName','lastName'],'raw':!![]});if(_0x343949[_0xadb7('0x39')][_0xadb7('0xc6')]){_0x380ce6[_0xadb7('0xc8')]({'model':db[_0xadb7('0xca')],'as':'Attachment','raw':!![]});}var _0xa460a2=[{'model':db[_0xadb7('0xb7')],'as':_0xadb7('0xcb'),'attributes':['id',_0xadb7('0x6c'),_0xadb7('0xcc'),_0xadb7('0xcd'),_0xadb7('0xce'),_0xadb7('0x7a')],'include':_0x380ce6}];_0xa460a2[_0xadb7('0xc8')]({'model':db[_0xadb7('0xcf')],'as':'Account','attributes':['id',_0xadb7('0x62')]});_0xa460a2[_0xadb7('0xc8')]({'model':db[_0xadb7('0x68')],'as':_0xadb7('0xd0'),'attributes':['id',_0xadb7('0xc7')]});return db[_0xadb7('0x96')][_0xadb7('0x58')]({'where':{'id':_0x343949[_0xadb7('0xa8')]['id']},'include':_0xa460a2})[_0xadb7('0x24')](handleEntityNotFound(_0x4b2df9,null))[_0xadb7('0x24')](function(_0x221da4){if(_0x221da4){var _0x43012a=_0x221da4[_0xadb7('0xd1')]({'plain':!![]});fs['mkdirSync'](_0x446499);var _0x17f33a={'format':'A4','border':'10px','header':{'height':'40px','contents':{'first':_0xadb7('0xd2')}},'footer':{'height':_0xadb7('0xd3'),'contents':{'default':util['format'](_0xadb7('0xd4'),util[_0xadb7('0xb5')](_0xadb7('0xd5'),_0xadb7('0xd6'),_0x43012a['id']),moment()['format'](_0xadb7('0xd7'))[_0xadb7('0x94')]())}}};var _0x271490={'channel':_0xadb7('0xd6'),'account':_0x43012a['Account'][_0xadb7('0x62')],'agent':_0x43012a[_0xadb7('0xd0')]?_0x43012a[_0xadb7('0xd0')][_0xadb7('0xc7')]:_0xadb7('0xd8'),'createdAt':moment(_0x43012a[_0xadb7('0xcc')])[_0xadb7('0xb5')](_0xadb7('0xb6'))['toString'](),'closedAt':_0x43012a['closed']?moment(_0x43012a[_0xadb7('0xd9')])[_0xadb7('0xb5')](_0xadb7('0xb6'))['toString']():'','disposition':_0x43012a[_0xadb7('0xda')],'visibility':_0x43012a[_0xadb7('0xdb')]?'Public':_0xadb7('0xdc'),'messages':_(_0x43012a[_0xadb7('0xcb')])['filter']({'secret':![]})[_0xadb7('0x2a')](function(_0x28dae9){if(_0x28dae9['Attachment']){var _0x1c835a=path[_0xadb7('0xc5')](_0x53abfb,_0x28dae9[_0xadb7('0xca')][_0xadb7('0xdd')]);if(fs['existsSync'](_0x1c835a)){fs['createReadStream'](_0x1c835a)[_0xadb7('0xde')](fs[_0xadb7('0xdf')](path[_0xadb7('0xc5')](_0x446499,_0x28dae9[_0xadb7('0xca')][_0xadb7('0xdd')])));}}return{'date':moment(_0x28dae9[_0xadb7('0xcc')])[_0xadb7('0xb5')](_0xadb7('0xb6'))[_0xadb7('0x94')](),'sender':_0x28dae9[_0xadb7('0xcd')]===_0xadb7('0xe0')?_0x28dae9[_0xadb7('0x68')]?_0x28dae9[_0xadb7('0x68')]['fullname']:_0xadb7('0xe1'):_0x28dae9[_0xadb7('0x5d')][_0xadb7('0xe2')]+(_0x28dae9['Contact'][_0xadb7('0xe3')]?'\x20'+_0x28dae9['Contact'][_0xadb7('0xe3')]:''),'body':_0x28dae9[_0xadb7('0xca')]?_0x28dae9[_0xadb7('0xca')]['basename']:_0x28dae9['body'],'direction':_0x28dae9[_0xadb7('0xcd')]==='out'?'A':'C','secret':_0x28dae9[_0xadb7('0xce')],'read':_0x28dae9[_0xadb7('0x7a')],'attachment':_0x28dae9[_0xadb7('0xca')]};})['value']()};return ejs['renderFile'](path[_0xadb7('0xc5')](config[_0xadb7('0xe4')],_0xadb7('0xc2'),_0xadb7('0xe5'),'downloadInteraction.html'),{'interaction':_0x271490})['then'](function(_0x219a1a){return new BPromise(function(_0x27838b,_0x464a88){pdf[_0xadb7('0xac')](_0x219a1a,_0x17f33a)['toFile'](path[_0xadb7('0xc5')](_0x446499,_0xadb7('0xe6')+_0x43012a['id']+'-'+_0x26d965+_0xadb7('0xe7')),function(_0xf8e02f,_0x1152f5){if(_0xf8e02f)return _0x464a88(_0xf8e02f);_0x27838b(_0x1152f5);});});})['then'](function(){return new BPromise(function(_0x3b9e2b,_0x37bed3){zipdir(_0x446499,{'saveTo':_0x437f26},function(_0x25f0ea,_0x5e842b){if(_0x25f0ea)return _0x37bed3(_0x25f0ea);return _0x3b9e2b(_0x5e842b);});})[_0xadb7('0x24')](function(){return new BPromise(function(_0x370574,_0x4202a9){rimraf(_0x446499,function(_0x759972){if(_0x759972)_0x4202a9(_0x759972);return _0x370574();});});})[_0xadb7('0x24')](function(){return _0x4b2df9[_0xadb7('0xc0')](_0x437f26,_0x2c4eb6,function(_0x17d333){if(_0x17d333){console['log'](_0xadb7('0xe8'),_0x17d333);}else{fs['unlinkSync'](_0x437f26);}});});});}else{return _0x4b2df9[_0xadb7('0x1c')](0xc8);}})['catch'](handleError(_0x4b2df9,null));}; \ No newline at end of file +var _0xb9ff=['order','DESC','t.id\x20IN\x20?','resolve','i.OpenchannelAccountId\x20IS\x20NOT\x20NULL','getOpenchannelAccounts','i.OpenchannelAccountId\x20IS\x20NULL','toString','count','merge','a.key','Account.key','a.mandatoryDisposition','Account.mandatoryDisposition','i.*','c.firstName','Contact.firstName','c.lastName','Contact.lastName','Contact.email','c.mobile','c.fax','Contact.fax','o.fullname','o.internal','GROUP_CONCAT(DISTINCT\x20t.id)','sequelize','ui.OpenchannelInteractionId\x20IN\x20?','groupBy','OpenchannelInteractionId','all','rows','catch','show','params','rawAttributes','include','options','create','describe','omit','ids','findOne','$gte','format','YYYY-MM-DD\x20HH:mm:ss','OpenchannelMessage','includeAll','findAll','addTags','spread','color','emit','openchannelInteractionTags:save','removeTags','download','unix','root','server','files','tmp','join','attachments','transcript-%d-%s.zip','Contact','firstName','lastName','Attachment','Messages','createdAt','direction','secret','Owner','mkdirSync','10px','40px','\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20
Interaction\x20Transcript
\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','30px','Openchannel','YYYY-MM-DD','Account','N.A.','threadId','Private','existsSync','createReadStream','pipe','createWriteStream','basename','out','System','renderFile','views','downloadInteraction.html','toFile','transcript-','log','err','unlinkSync','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','ejs','lodash','crypto','jsforce','desk.js','to-csv','querystring','papaparse','../../components/auth/service','../../components/parsers/advancedSearch','../../config/utils','../../config/environment','redis','localhost','socket.io-emitter','./openchannelInteraction.socket','sendStatus','end','status','json','offset','limit','set','Content-Range','apply','reject','save','update','then','destroy','stack','name','send','Users','fullname','TagIds','split','forEach','Tags','push','index','map','OpenchannelInteraction','fieldName','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','where','pick','select','field','tools_tags','u.id','u.fullname','ui.OpenchannelInteractionId','from','user_has_openchannel_interactions','left_join','users','u.id\x20=\x20ui.UserId','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL','o.id\x20=\x20i.UserId','openchannel_messages','me.OpenchannelInteractionId\x20=\x20i.id','openchannel_interaction_has_tags','it.OpenchannelInteractionId\x20=\x20i.id','t.id\x20=\x20it.TagId','expr','search','parseSearch','sqlOperator','conditions','find','unreadMessages','having','`\x20>\x200','operator','$substring','value','c.firstName\x20LIKE\x20?\x20OR\x20c.lastName\x20LIKE\x20?\x20OR\x20c.email\x20LIKE\x20?','ContactId','type','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','compact','isEmpty','OpenchannelAccountId','i.OpenchannelAccountId\x20IN\x20?','concat','parse','$lte','i.createdAt\x20BETWEEN\x20?\x20AND\x20?','null','\x20IS\x20NULL','\x20=\x20?','read','`unreadMessages`\x20=\x200','tag','isArray','filter','replace','\x27\x27\x27\x27','isNumeric','i.id\x20LIKE\x20?','getFullTextValue','i.from\x20LIKE\x20?','group','Sequelize','QueryTypes','SELECT','i.id','SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)'];(function(_0x78dfd4,_0x47fcdb){var _0x1bcddb=function(_0x1ace31){while(--_0x1ace31){_0x78dfd4['push'](_0x78dfd4['shift']());}};_0x1bcddb(++_0x47fcdb);}(_0xb9ff,0x151));var _0xfb9f=function(_0x260a6a,_0x1c44a4){_0x260a6a=_0x260a6a-0x0;var _0x24a95e=_0xb9ff[_0x260a6a];return _0x24a95e;};'use strict';var pdf=require('html-pdf');var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0xfb9f('0x0'));var jsonpatch=require(_0xfb9f('0x1'));var rp=require(_0xfb9f('0x2'));var moment=require(_0xfb9f('0x3'));var BPromise=require(_0xfb9f('0x4'));var Mustache=require(_0xfb9f('0x5'));var util=require(_0xfb9f('0x6'));var path=require(_0xfb9f('0x7'));var sox=require(_0xfb9f('0x8'));var csv=require('to-csv');var ejs=require(_0xfb9f('0x9'));var fs=require('fs');var _=require(_0xfb9f('0xa'));var squel=require('squel');var crypto=require(_0xfb9f('0xb'));var jsforce=require(_0xfb9f('0xc'));var deskjs=require(_0xfb9f('0xd'));var toCsv=require(_0xfb9f('0xe'));var querystring=require(_0xfb9f('0xf'));var Papa=require(_0xfb9f('0x10'));var Redis=require('ioredis');var authService=require(_0xfb9f('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0xfb9f('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')('api');var utils=require(_0xfb9f('0x13'));var config=require(_0xfb9f('0x14'));var db=require('../../mysqldb')['db'];config[_0xfb9f('0x15')]=_['defaults'](config['redis'],{'host':_0xfb9f('0x16'),'port':0x18eb});var socket=require(_0xfb9f('0x17'))(new Redis(config['redis']));require(_0xfb9f('0x18'))['register'](socket);function respondWithStatusCode(_0x2a342c,_0x175259){_0x175259=_0x175259||0xcc;return function(_0x26e7a4){if(_0x26e7a4){return _0x2a342c[_0xfb9f('0x19')](_0x175259);}return _0x2a342c['status'](_0x175259)[_0xfb9f('0x1a')]();};}function respondWithResult(_0x479e0c,_0x2e0d8a){_0x2e0d8a=_0x2e0d8a||0xc8;return function(_0x36e8a3){if(_0x36e8a3){return _0x479e0c[_0xfb9f('0x1b')](_0x2e0d8a)[_0xfb9f('0x1c')](_0x36e8a3);}};}function respondWithFilteredResult(_0x5e25f9,_0x392d94){return function(_0x1fe0e4){if(_0x1fe0e4){var _0x502086=_0x1fe0e4['count'],_0x578b4f=_0x392d94[_0xfb9f('0x1d')],_0x2c154c=_0x392d94[_0xfb9f('0x1d')]+_0x392d94[_0xfb9f('0x1e')],_0x3e2795;if(_0x2c154c>=_0x502086){_0x2c154c=_0x502086;_0x3e2795=0xc8;}else{_0x3e2795=0xce;}_0x5e25f9[_0xfb9f('0x1b')](_0x3e2795);return _0x5e25f9[_0xfb9f('0x1f')](_0xfb9f('0x20'),_0x578b4f+'-'+_0x2c154c+'/'+_0x502086)[_0xfb9f('0x1c')](_0x1fe0e4);}return null;};}function patchUpdates(_0x5a41e0){return function(_0x5f338f){try{jsonpatch[_0xfb9f('0x21')](_0x5f338f,_0x5a41e0,!![]);}catch(_0x2fb69f){return BPromise[_0xfb9f('0x22')](_0x2fb69f);}return _0x5f338f[_0xfb9f('0x23')]();};}function saveUpdates(_0x4dac63,_0x3c599e){return function(_0x30796f){if(_0x30796f){return _0x30796f[_0xfb9f('0x24')](_0x4dac63)[_0xfb9f('0x25')](function(_0x46b3a0){return _0x46b3a0;});}return null;};}function removeEntity(_0x1947bf,_0x3bfa08){return function(_0x5ccdce){if(_0x5ccdce){return _0x5ccdce[_0xfb9f('0x26')]()[_0xfb9f('0x25')](function(){_0x1947bf[_0xfb9f('0x1b')](0xcc)['end']();});}};}function handleEntityNotFound(_0x3baeb9,_0xdae8bc){return function(_0x365314){if(!_0x365314){_0x3baeb9['sendStatus'](0x194);}return _0x365314;};}function handleError(_0x56dfa5,_0x289b8d){_0x289b8d=_0x289b8d||0x1f4;return function(_0x312012){logger['error'](_0x312012[_0xfb9f('0x27')]);if(_0x312012[_0xfb9f('0x28')]){delete _0x312012[_0xfb9f('0x28')];}_0x56dfa5[_0xfb9f('0x1b')](_0x289b8d)[_0xfb9f('0x29')](_0x312012);};}function getInteractionUsers(_0x1b5db3,_0x5e48f6){return new BPromise(function(_0x47cf09,_0x151818){try{if(_0x5e48f6[_0x1b5db3['id']]){_0x1b5db3[_0xfb9f('0x2a')]=_['map'](_0x5e48f6[_0x1b5db3['id']],function(_0x126ae9){return{'id':_0x126ae9['id'],'fullname':_0x126ae9[_0xfb9f('0x2b')]};});}}catch(_0x1ccaf3){_0x151818(_0x1ccaf3);}_0x47cf09(_0x1b5db3);});}function getInteractionTags(_0x5be427,_0x1325a4){return new BPromise(function(_0x293187,_0x2087f8){try{if(_0x5be427[_0xfb9f('0x2c')]){_0x5be427['Tags']=[];_0x5be427[_0xfb9f('0x2c')][_0xfb9f('0x2d')](',')[_0xfb9f('0x2e')](function(_0x4a4362){_0x5be427[_0xfb9f('0x2f')][_0xfb9f('0x30')](_0x1325a4[_0x4a4362]);});}delete _0x5be427[_0xfb9f('0x2c')];}catch(_0x429404){_0x2087f8(_0x429404);}_0x293187(_0x5be427);});}function updateOpenchannelInteraction(_0x578180,_0x830172,_0x58388b){return new BPromise(function(_0x5ee636,_0x5cdf3c){return getInteractionUsers(_0x578180,_0x58388b)['then'](function(_0x2e4440){return getInteractionTags(_0x2e4440,_0x830172);})[_0xfb9f('0x25')](function(_0xb6ab7d){_0x5ee636(_0xb6ab7d);})['catch'](function(_0x56fca9){_0x5cdf3c(_0x56fca9);});});}exports[_0xfb9f('0x31')]=function(_0x5ce4f6,_0x59c3e2){var _0x55b528={},_0x4574cf={},_0xdcd79a={'count':0x0,'rows':[]};var _0x119627=_[_0xfb9f('0x32')](db[_0xfb9f('0x33')]['rawAttributes'],function(_0x5e1537){return{'name':_0x5e1537[_0xfb9f('0x34')],'type':_0x5e1537['type'][_0xfb9f('0x35')]};});_0x4574cf[_0xfb9f('0x36')]=_['map'](_0x119627,'name');_0x4574cf[_0xfb9f('0x37')]=_[_0xfb9f('0x38')](_0x5ce4f6[_0xfb9f('0x37')]);_0x4574cf[_0xfb9f('0x39')]=_[_0xfb9f('0x3a')](_0x4574cf[_0xfb9f('0x36')],_0x4574cf['query']);_0x55b528[_0xfb9f('0x3b')]=_['intersection'](_0x4574cf[_0xfb9f('0x36')],qs[_0xfb9f('0x3c')](_0x5ce4f6[_0xfb9f('0x37')][_0xfb9f('0x3c')]));_0x55b528[_0xfb9f('0x3b')]=_0x55b528[_0xfb9f('0x3b')][_0xfb9f('0x3d')]?_0x55b528['attributes']:_0x4574cf['model'];if(!_0x5ce4f6[_0xfb9f('0x37')][_0xfb9f('0x3e')](_0xfb9f('0x3f'))){_0x55b528['limit']=qs[_0xfb9f('0x1e')](_0x5ce4f6[_0xfb9f('0x37')][_0xfb9f('0x1e')]);_0x55b528[_0xfb9f('0x1d')]=qs[_0xfb9f('0x1d')](_0x5ce4f6[_0xfb9f('0x37')][_0xfb9f('0x1d')]);}_0x55b528['order']=qs[_0xfb9f('0x40')](_0x5ce4f6[_0xfb9f('0x37')][_0xfb9f('0x40')]);_0x55b528[_0xfb9f('0x41')]=qs[_0xfb9f('0x39')](_[_0xfb9f('0x42')](_0x5ce4f6['query'],_0x4574cf['filters']));var _0x57b0b1=[];var _0x6e2b9f=squel[_0xfb9f('0x43')]()[_0xfb9f('0x44')]('id')[_0xfb9f('0x44')](_0xfb9f('0x28'))[_0xfb9f('0x44')]('color')['from'](_0xfb9f('0x45'));var _0x2c08c3=squel[_0xfb9f('0x43')]()[_0xfb9f('0x44')](_0xfb9f('0x46'))['field'](_0xfb9f('0x47'))[_0xfb9f('0x44')](_0xfb9f('0x48'))[_0xfb9f('0x49')](_0xfb9f('0x4a'),'ui')[_0xfb9f('0x4b')](_0xfb9f('0x4c'),'u',_0xfb9f('0x4d'));var _0x1dcb20=squel[_0xfb9f('0x43')]()['from']('openchannel_interactions','i')[_0xfb9f('0x4b')]('cm_contacts','c',_0xfb9f('0x4e'))[_0xfb9f('0x4b')](_0xfb9f('0x4c'),'o',_0xfb9f('0x4f'))['left_join']('openchannel_accounts','a','a.id\x20=\x20i.OpenchannelAccountId')[_0xfb9f('0x4b')](_0xfb9f('0x50'),'me',_0xfb9f('0x51'))[_0xfb9f('0x4b')](_0xfb9f('0x52'),'it',_0xfb9f('0x53'))[_0xfb9f('0x4b')](_0xfb9f('0x45'),'t',_0xfb9f('0x54'));var _0x1e60cd=squel[_0xfb9f('0x55')]();var _0x38241c=[];var _0x58abda=squel[_0xfb9f('0x55')]();var _0x51ac4d;if(_0x5ce4f6[_0xfb9f('0x37')][_0xfb9f('0x56')]){_0x51ac4d=as[_0xfb9f('0x57')](_0x5ce4f6[_0xfb9f('0x37')]['search']);var _0x4e718e=_0x51ac4d[_0xfb9f('0x58')];for(var _0x17f7eb=0x0;_0x17f7eb<_0x51ac4d[_0xfb9f('0x59')][_0xfb9f('0x3d')];_0x17f7eb++){var _0x42ccdf=_0x51ac4d['conditions'][_0x17f7eb];var _0x554d34='i';var _0x5f098c=_[_0xfb9f('0x5a')](_0x119627,[_0xfb9f('0x28'),_0x42ccdf[_0xfb9f('0x44')]]);if(!_0x5f098c){switch(_0x42ccdf[_0xfb9f('0x44')]){case _0xfb9f('0x5b'):if(_0x42ccdf['value']==0x1){_0x1dcb20['having']('`'+_0x42ccdf[_0xfb9f('0x44')]+'`\x20=\x200');}else{_0x1dcb20[_0xfb9f('0x5c')]('`'+_0x42ccdf['field']+_0xfb9f('0x5d'));}break;case'Contact':if(_0x42ccdf[_0xfb9f('0x5e')]===_0xfb9f('0x5f')){if(_0x42ccdf[_0xfb9f('0x60')][_0xfb9f('0x2d')]('\x20')[_0xfb9f('0x3d')]>0x1){_0x1e60cd[_0x4e718e]('MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)',qs['getFullTextValue'](_0x42ccdf[_0xfb9f('0x60')]),null);}else{var _0x42ee9f='%'+_0x42ccdf[_0xfb9f('0x60')]+'%';_0x1e60cd[_0x4e718e](_0xfb9f('0x61'),_0x42ee9f,_0x42ee9f,_0x42ee9f);}}else{_0x5f098c=_[_0xfb9f('0x5a')](_0x119627,[_0xfb9f('0x28'),_0xfb9f('0x62')]);_0x42ccdf[_0xfb9f('0x44')]=_0xfb9f('0x62');_0x2eb2ce=as['buildExpression'](_0x554d34,_0x5f098c[_0xfb9f('0x63')],_0x42ccdf);_0x1e60cd[_0x4e718e](_0x2eb2ce[_0xfb9f('0x64')],_0x2eb2ce[_0xfb9f('0x60')][_0xfb9f('0x65')],_0x2eb2ce['value'][_0xfb9f('0x1a')]);}break;case _0xfb9f('0x66'):var _0x4e9234=_0x42ccdf[_0xfb9f('0x60')][_0xfb9f('0x2d')](',')[_0xfb9f('0x32')](function(_0x49287a){return Number(_0x49287a);});_0x4e9234[_0xfb9f('0x2e')](function(_0x1c4263){_0x58abda['or'](_0xfb9f('0x67'),'%,'+_0x1c4263+',%');});_0x38241c=_[_0xfb9f('0x68')](_0x38241c,_0x4e9234);break;case _0xfb9f('0x69'):if(_0x42ccdf['operator']===_0xfb9f('0x5f')){_0x1e60cd[_0x4e718e](_0xfb9f('0x6a'),'%'+_0x42ccdf[_0xfb9f('0x60')]+'%',null);}else{_0x5f098c=_[_0xfb9f('0x5a')](_0x119627,[_0xfb9f('0x28'),'UserId']);_0x42ccdf[_0xfb9f('0x44')]=_0xfb9f('0x6b');_0x2eb2ce=as['buildExpression'](_0x554d34,_0x5f098c[_0xfb9f('0x63')],_0x42ccdf);_0x1e60cd[_0x4e718e](_0x2eb2ce[_0xfb9f('0x64')],_0x2eb2ce[_0xfb9f('0x60')][_0xfb9f('0x65')],_0x2eb2ce[_0xfb9f('0x60')]['end']);}break;case _0xfb9f('0x6c'):_0x2eb2ce=as['buildExpression']('me',null,_0x42ccdf);_0x1e60cd[_0x4e718e](_0x2eb2ce[_0xfb9f('0x64')],_0x2eb2ce[_0xfb9f('0x60')][_0xfb9f('0x65')],_0x2eb2ce['value'][_0xfb9f('0x1a')]);break;}}else{var _0x2eb2ce=as[_0xfb9f('0x6d')](_0x554d34,_0x5f098c['type'],_0x42ccdf);_0x1e60cd[_0x4e718e](_0x2eb2ce[_0xfb9f('0x64')],_0x2eb2ce[_0xfb9f('0x60')][_0xfb9f('0x65')],_0x2eb2ce[_0xfb9f('0x60')][_0xfb9f('0x1a')]);}}}else{var _0x4e2f73=_(_0x5ce4f6[_0xfb9f('0x37')])[_0xfb9f('0x38')]()[_0xfb9f('0x32')](function(_0x548fc6){return _[_0xfb9f('0x6e')](_0x119627,[_0xfb9f('0x28'),_0x548fc6])?_0x548fc6:undefined;})[_0xfb9f('0x6f')]()[_0xfb9f('0x60')]();if(!_[_0xfb9f('0x70')](_0x4e2f73)){_0x4e2f73[_0xfb9f('0x2e')](function(_0x556e92){if(_0x556e92===_0xfb9f('0x71')){_0x1dcb20[_0xfb9f('0x41')](_0xfb9f('0x72'),[][_0xfb9f('0x73')](_0x5ce4f6[_0xfb9f('0x37')][_0x556e92]));}else if(_0x556e92==='createdAt'){var _0x5bbe44=JSON[_0xfb9f('0x74')](_0x5ce4f6[_0xfb9f('0x37')][_0x556e92])['$gte'];var _0x1aa466=JSON[_0xfb9f('0x74')](_0x5ce4f6[_0xfb9f('0x37')][_0x556e92])[_0xfb9f('0x75')];_0x1dcb20[_0xfb9f('0x41')](_0xfb9f('0x76'),_0x5bbe44,_0x1aa466);}else{if(_0x5ce4f6[_0xfb9f('0x37')][_0x556e92]===_0xfb9f('0x77')){_0x1dcb20['where']('i.'+_0x556e92+_0xfb9f('0x78'));}else{_0x1dcb20['where']('i.'+_0x556e92+_0xfb9f('0x79'),_0x5ce4f6[_0xfb9f('0x37')][_0x556e92]);}}});}if(_0x5ce4f6[_0xfb9f('0x37')][_0xfb9f('0x7a')]){if(_0x5ce4f6[_0xfb9f('0x37')][_0xfb9f('0x7a')]==0x1){_0x1dcb20[_0xfb9f('0x5c')](_0xfb9f('0x7b'));}else{_0x1dcb20[_0xfb9f('0x5c')]('`unreadMessages`\x20>\x200');}}if(_0x5ce4f6[_0xfb9f('0x37')][_0xfb9f('0x7c')]){_0x38241c=_[_0xfb9f('0x7d')](_0x5ce4f6[_0xfb9f('0x37')][_0xfb9f('0x7c')])?_0x5ce4f6[_0xfb9f('0x37')]['tag']:new Array(_0x5ce4f6[_0xfb9f('0x37')][_0xfb9f('0x7c')]);_0x38241c['forEach'](function(_0x445676){_0x58abda['or'](_0xfb9f('0x67'),'%,'+_0x445676+',%');});}if(_0x5ce4f6['query'][_0xfb9f('0x7e')]){var _0x2966f4=_0x5ce4f6[_0xfb9f('0x37')]['filter'][_0xfb9f('0x7f')]('\x5c','\x5c\x5c')[_0xfb9f('0x7f')]('\x27\x27',_0xfb9f('0x80'));if(qs[_0xfb9f('0x81')](_0x2966f4)){_0x1e60cd['or'](_0xfb9f('0x82'),_0x2966f4+'%');}else{_0x1e60cd['or']('MATCH\x20(me.body)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)',qs[_0xfb9f('0x83')](_0x2966f4))['or'](_0xfb9f('0x84'),_0x2966f4+'%')['or']('CONCAT(c.firstName,\x20\x27\x20\x27,\x20c.lastName)\x20LIKE\x20?',_0x2966f4+'%');}}}_0x1dcb20[_0xfb9f('0x41')](_0x1e60cd);_0x1dcb20[_0xfb9f('0x85')]('i.id');var _0x45b668={'type':db[_0xfb9f('0x86')][_0xfb9f('0x87')][_0xfb9f('0x88')],'raw':!![]};var _0x5a2d62=_0x1dcb20['clone']();_0x5a2d62[_0xfb9f('0x44')](_0xfb9f('0x89'));_0x5a2d62['field'](_0xfb9f('0x8a'),'unreadMessages');if(_0x55b528['order']){_0x55b528[_0xfb9f('0x8b')][_0xfb9f('0x2e')](function(_0x1c94d3){_0x1dcb20[_0xfb9f('0x8b')]('i.'+_0x1c94d3[0x0],_0x1c94d3[0x1]===_0xfb9f('0x8c')?![]:!![]);});}if(!_['isEmpty'](_0x38241c)){_0x1dcb20[_0xfb9f('0x5c')](_0x58abda);_0x5a2d62[_0xfb9f('0x41')](_0xfb9f('0x8d'),_0x38241c);}BPromise[_0xfb9f('0x8e')]()[_0xfb9f('0x25')](function(){if(!_0x51ac4d){if(_0x5ce4f6[_0xfb9f('0x37')][_0xfb9f('0x71')]||_0x5ce4f6[_0xfb9f('0x37')]['journey'])return;_0x5a2d62['where'](_0xfb9f('0x8f'));_0x1dcb20[_0xfb9f('0x41')]('i.OpenchannelAccountId\x20IS\x20NOT\x20NULL');return;}return _0x5ce4f6['user'][_0xfb9f('0x90')]({'attributes':['id'],'raw':!![]})[_0xfb9f('0x25')](function(_0x4dbe5d){if(_[_0xfb9f('0x70')](_0x4dbe5d)){_0x5a2d62[_0xfb9f('0x41')](_0xfb9f('0x91'));_0x1dcb20[_0xfb9f('0x41')](_0xfb9f('0x91'));}else{_0x5a2d62[_0xfb9f('0x41')](_0xfb9f('0x72'),_[_0xfb9f('0x32')](_0x4dbe5d,'id'));_0x1dcb20[_0xfb9f('0x41')](_0xfb9f('0x72'),_[_0xfb9f('0x32')](_0x4dbe5d,'id'));}});})[_0xfb9f('0x25')](function(){db['sequelize'][_0xfb9f('0x37')](_0x5a2d62[_0xfb9f('0x92')](),_0x45b668)[_0xfb9f('0x25')](function(_0x64527d){_0xdcd79a['count']=_0x64527d[_0xfb9f('0x3d')];if(_0xdcd79a[_0xfb9f('0x93')]===0x0)return[];return db['sequelize']['query'](_0x6e2b9f[_0xfb9f('0x92')](),_0x45b668)[_0xfb9f('0x25')](function(_0x595e28){_0x57b0b1=_['keyBy'](_0x595e28,'id');_0x45b668=_[_0xfb9f('0x94')](_0x45b668,{'model':db[_0xfb9f('0x33')],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x5ce4f6[_0xfb9f('0x37')][_0xfb9f('0x3c')]){_0x55b528[_0xfb9f('0x3b')][_0xfb9f('0x2e')](function(_0x246555){_0x1dcb20[_0xfb9f('0x44')]('i.'+_0x246555);});}else{_0x1dcb20['field'](_0xfb9f('0x8a'),'unreadMessages');_0x1dcb20[_0xfb9f('0x44')](_0xfb9f('0x95'),_0xfb9f('0x96'));_0x1dcb20[_0xfb9f('0x44')](_0xfb9f('0x97'),_0xfb9f('0x98'));_0x1dcb20[_0xfb9f('0x44')](_0xfb9f('0x99'));_0x1dcb20[_0xfb9f('0x44')](_0xfb9f('0x9a'),_0xfb9f('0x9b'));_0x1dcb20[_0xfb9f('0x44')](_0xfb9f('0x9c'),_0xfb9f('0x9d'));_0x1dcb20[_0xfb9f('0x44')]('c.email',_0xfb9f('0x9e'));_0x1dcb20['field']('c.phone','Contact.phone');_0x1dcb20[_0xfb9f('0x44')](_0xfb9f('0x9f'),'Contact.mobile');_0x1dcb20['field'](_0xfb9f('0xa0'),_0xfb9f('0xa1'));_0x1dcb20[_0xfb9f('0x44')](_0xfb9f('0xa2'),'Owner.fullname');_0x1dcb20['field'](_0xfb9f('0xa3'),'Owner.internal');_0x1dcb20[_0xfb9f('0x44')](_0xfb9f('0xa4'),_0xfb9f('0x2c'));}_0x1dcb20['limit'](_0x55b528[_0xfb9f('0x1e')]);_0x1dcb20['offset'](_0x55b528[_0xfb9f('0x1d')]);return db[_0xfb9f('0xa5')][_0xfb9f('0x37')](_0x1dcb20['toString'](),_0x45b668);})['then'](function(_0x561c32){_0x2c08c3[_0xfb9f('0x41')](_0xfb9f('0xa6'),_[_0xfb9f('0x32')](_0x561c32,'id'));return db['sequelize'][_0xfb9f('0x37')](_0x2c08c3[_0xfb9f('0x92')](),_0x45b668)[_0xfb9f('0x25')](function(_0x22643b){var _0x9a4c2d=_[_0xfb9f('0xa7')](_0x22643b,_0xfb9f('0xa8'));var _0x5eabf2=[];_0x561c32['forEach'](function(_0x3c7862){_0x5eabf2[_0xfb9f('0x30')](updateOpenchannelInteraction(_0x3c7862,_0x57b0b1,_0x9a4c2d));});return BPromise[_0xfb9f('0xa9')](_0x5eabf2);});});})[_0xfb9f('0x25')](function(_0x42c472){_0xdcd79a[_0xfb9f('0xaa')]=_0x42c472;return _0xdcd79a;})[_0xfb9f('0x25')](respondWithFilteredResult(_0x59c3e2,_0x55b528));})[_0xfb9f('0xab')](handleError(_0x59c3e2,null));};exports[_0xfb9f('0xac')]=function(_0x2fad42,_0x2f463b){var _0x439e04={'raw':![],'where':{'id':_0x2fad42[_0xfb9f('0xad')]['id']}},_0x2d92f3={};_0x2d92f3[_0xfb9f('0x36')]=_[_0xfb9f('0x38')](db[_0xfb9f('0x33')][_0xfb9f('0xae')]);_0x2d92f3[_0xfb9f('0x37')]=_[_0xfb9f('0x38')](_0x2fad42['query']);_0x2d92f3[_0xfb9f('0x39')]=_['intersection'](_0x2d92f3[_0xfb9f('0x36')],_0x2d92f3[_0xfb9f('0x37')]);_0x439e04[_0xfb9f('0x3b')]=_[_0xfb9f('0x3a')](_0x2d92f3['model'],qs['fields'](_0x2fad42[_0xfb9f('0x37')][_0xfb9f('0x3c')]));_0x439e04[_0xfb9f('0x3b')]=_0x439e04['attributes'][_0xfb9f('0x3d')]?_0x439e04[_0xfb9f('0x3b')]:_0x2d92f3[_0xfb9f('0x36')];if(_0x2fad42['query']['includeAll']){_0x439e04[_0xfb9f('0xaf')]=[{'all':!![]}];}_0x439e04=_['merge']({},_0x439e04,_0x2fad42[_0xfb9f('0xb0')]);return db[_0xfb9f('0x33')][_0xfb9f('0x5a')](_0x439e04)['then'](handleEntityNotFound(_0x2f463b,null))[_0xfb9f('0x25')](respondWithResult(_0x2f463b,null))[_0xfb9f('0xab')](handleError(_0x2f463b,null));};exports['create']=function(_0x54828f,_0x535f20){return db[_0xfb9f('0x33')][_0xfb9f('0xb1')](_0x54828f[_0xfb9f('0x6c')],{})[_0xfb9f('0x25')](respondWithResult(_0x535f20,0xc9))['catch'](handleError(_0x535f20,null));};exports[_0xfb9f('0x24')]=function(_0x3d2f1a,_0x3063a4){if(_0x3d2f1a[_0xfb9f('0x6c')]['id']){delete _0x3d2f1a[_0xfb9f('0x6c')]['id'];}return db[_0xfb9f('0x33')][_0xfb9f('0x5a')]({'where':{'id':_0x3d2f1a['params']['id']}})[_0xfb9f('0x25')](handleEntityNotFound(_0x3063a4,null))[_0xfb9f('0x25')](saveUpdates(_0x3d2f1a[_0xfb9f('0x6c')],null))[_0xfb9f('0x25')](respondWithResult(_0x3063a4,null))['catch'](handleError(_0x3063a4,null));};exports['destroy']=function(_0x1b2144,_0x1352b5){return db[_0xfb9f('0x33')][_0xfb9f('0x5a')]({'where':{'id':_0x1b2144[_0xfb9f('0xad')]['id']}})['then'](handleEntityNotFound(_0x1352b5,null))[_0xfb9f('0x25')](removeEntity(_0x1352b5,null))['catch'](handleError(_0x1352b5,null));};exports['describe']=function(_0x2494c1,_0x3119a3){return db[_0xfb9f('0x33')][_0xfb9f('0xb2')]()['then'](respondWithResult(_0x3119a3,null))['catch'](handleError(_0x3119a3,null));};exports['addMessage']=function(_0x2145e2,_0x3d29a7,_0x406d9f){return db['OpenchannelMessage'][_0xfb9f('0x5a')]({'where':{'id':_0x2145e2['params']['id']}})['then'](handleEntityNotFound(_0x3d29a7,null))[_0xfb9f('0x25')](function(_0x479f5c){if(_0x479f5c){return _0x479f5c['addMessage'](_0x2145e2[_0xfb9f('0x6c')]['ids'],_[_0xfb9f('0xb3')](_0x2145e2['body'],[_0xfb9f('0xb4'),'id'])||{});}})['then'](respondWithResult(_0x3d29a7,null))['catch'](handleError(_0x3d29a7,null));};exports['getMessages']=function(_0x4e076a,_0x11311a,_0xfadcb1){var _0x1e7909={'raw':![],'where':{}};var _0x2ddce3={};var _0x2c7e4f={'count':0x0,'rows':[]};return db['OpenchannelInteraction'][_0xfb9f('0xb5')]({'where':{'id':_0x4e076a['params']['id']}})[_0xfb9f('0x25')](handleEntityNotFound(_0x11311a,null))['then'](function(_0x16aa93){if(_0x16aa93){_0x2ddce3[_0xfb9f('0x36')]=_['keys'](db['OpenchannelMessage'][_0xfb9f('0xae')]);_0x2ddce3['query']=_['keys'](_0x4e076a[_0xfb9f('0x37')]);_0x2ddce3['filters']=_[_0xfb9f('0x3a')](_0x2ddce3['model'],_0x2ddce3[_0xfb9f('0x37')]);_0x1e7909[_0xfb9f('0x3b')]=_['intersection'](_0x2ddce3[_0xfb9f('0x36')],qs[_0xfb9f('0x3c')](_0x4e076a[_0xfb9f('0x37')][_0xfb9f('0x3c')]));_0x1e7909[_0xfb9f('0x3b')]=_0x1e7909[_0xfb9f('0x3b')]['length']?_0x1e7909[_0xfb9f('0x3b')]:_0x2ddce3[_0xfb9f('0x36')];if(!_0x4e076a['query'][_0xfb9f('0x3e')]('nolimit')){_0x1e7909[_0xfb9f('0x1e')]=qs[_0xfb9f('0x1e')](_0x4e076a[_0xfb9f('0x37')][_0xfb9f('0x1e')]);_0x1e7909[_0xfb9f('0x1d')]=qs['offset'](_0x4e076a[_0xfb9f('0x37')][_0xfb9f('0x1d')]);}_0x1e7909[_0xfb9f('0x8b')]=qs[_0xfb9f('0x40')](_0x4e076a[_0xfb9f('0x37')][_0xfb9f('0x40')]);_0x1e7909[_0xfb9f('0x41')]=qs[_0xfb9f('0x39')](_[_0xfb9f('0x42')](_0x4e076a[_0xfb9f('0x37')],_0x2ddce3[_0xfb9f('0x39')]));_0x1e7909[_0xfb9f('0x41')][_0xfb9f('0xa8')]=_0x16aa93['id'];if(_0x4e076a[_0xfb9f('0x37')][_0xfb9f('0x7e')]){_0x1e7909['where']=_[_0xfb9f('0x94')](_0x1e7909[_0xfb9f('0x41')],{'$or':_['map'](_0x1e7909[_0xfb9f('0x3b')],function(_0x1dcea0){var _0x190671={};_0x190671[_0x1dcea0]={'$like':'%'+_0x4e076a['query'][_0xfb9f('0x7e')]+'%'};return _0x190671;})});}if(_0x4e076a['query'][_0xfb9f('0xb6')]){var _0x550895=_0x4e076a[_0xfb9f('0x37')]['$gte'][_0xfb9f('0x2d')](',');var _0x23448f={};_0x23448f[_0x550895[0x0]]={'$gte':moment(_0x550895[0x1])[_0xfb9f('0xb7')](_0xfb9f('0xb8'))};_0x1e7909['where']=_[_0xfb9f('0x94')](_0x1e7909[_0xfb9f('0x41')],_0x23448f);}_0x1e7909=_[_0xfb9f('0x94')]({},_0x1e7909,_0x4e076a[_0xfb9f('0xb0')]);return db[_0xfb9f('0xb9')][_0xfb9f('0x93')]({'where':_0x1e7909[_0xfb9f('0x41')]})['then'](function(_0x5f066a){_0x2c7e4f[_0xfb9f('0x93')]=_0x5f066a;if(_0x4e076a[_0xfb9f('0x37')][_0xfb9f('0xba')]){_0x1e7909['include']=[{'all':!![]}];}return db['OpenchannelMessage'][_0xfb9f('0xbb')](_0x1e7909);})[_0xfb9f('0x25')](function(_0x4c9c99){_0x2c7e4f[_0xfb9f('0xaa')]=_0x4c9c99;return _0x2c7e4f;});}})[_0xfb9f('0x25')](respondWithFilteredResult(_0x11311a,_0x1e7909))[_0xfb9f('0xab')](handleError(_0x11311a,null));};exports[_0xfb9f('0xbc')]=function(_0x54d9ff,_0x212907,_0x3c203a){return db['OpenchannelInteraction'][_0xfb9f('0x5a')]({'where':{'id':_0x54d9ff[_0xfb9f('0xad')]['id']}})[_0xfb9f('0x25')](handleEntityNotFound(_0x212907,null))[_0xfb9f('0x25')](function(_0x551c1c){if(_0x551c1c){return _0x551c1c['setTags'](_0x54d9ff[_0xfb9f('0x6c')][_0xfb9f('0xb4')],_[_0xfb9f('0xb3')](_0x54d9ff[_0xfb9f('0x6c')],[_0xfb9f('0xb4'),'id'])||{})[_0xfb9f('0xbd')](function(){return db[_0xfb9f('0x66')]['findAll']({'attributes':['id',_0xfb9f('0x28'),_0xfb9f('0xbe')],'where':{'id':_0x54d9ff[_0xfb9f('0x6c')]['ids']}});})[_0xfb9f('0x25')](function(_0x427b83){socket[_0xfb9f('0xbf')](_0xfb9f('0xc0'),{'id':Number(_0x54d9ff[_0xfb9f('0xad')]['id']),'tags':_0x427b83||[]});return{'id':Number(_0x54d9ff[_0xfb9f('0xad')]['id']),'tags':_0x427b83||[]};});}})['then'](respondWithResult(_0x212907,null))['catch'](handleError(_0x212907,null));};exports[_0xfb9f('0xc1')]=function(_0x41c7e3,_0x2d6c94,_0x415116){return db[_0xfb9f('0x33')][_0xfb9f('0x5a')]({'where':{'id':_0x41c7e3[_0xfb9f('0xad')]['id']}})[_0xfb9f('0x25')](handleEntityNotFound(_0x2d6c94,null))[_0xfb9f('0x25')](function(_0x184a63){if(_0x184a63){return _0x184a63[_0xfb9f('0xc1')](_0x41c7e3['query'][_0xfb9f('0xb4')]);}})[_0xfb9f('0x25')](respondWithStatusCode(_0x2d6c94,null))[_0xfb9f('0xab')](handleError(_0x2d6c94,null));};exports[_0xfb9f('0xc2')]=function(_0x223cab,_0x527ddd){var _0x387069=moment()[_0xfb9f('0xc3')]()[_0xfb9f('0x92')]();var _0x41e47b=path['join'](config[_0xfb9f('0xc4')],_0xfb9f('0xc5'),_0xfb9f('0xc6'),_0xfb9f('0xc7'));var _0x9bf1de=path[_0xfb9f('0xc8')](config[_0xfb9f('0xc4')],_0xfb9f('0xc5'),_0xfb9f('0xc6'),_0xfb9f('0xc9'));var _0x4cf3e3=path[_0xfb9f('0xc8')](_0x41e47b,_0x387069);var _0x2b0cac=util[_0xfb9f('0xb7')](_0xfb9f('0xca'),_0x223cab[_0xfb9f('0xad')]['id'],_0x387069);var _0x5e91b3=path[_0xfb9f('0xc8')](_0x41e47b,_0x2b0cac);var _0x196916=[];_0x196916[_0xfb9f('0x30')]({'model':db[_0xfb9f('0x69')],'as':_0xfb9f('0x69'),'attributes':['id',_0xfb9f('0x2b')],'raw':!![]});_0x196916[_0xfb9f('0x30')]({'model':db['CmContact'],'as':_0xfb9f('0xcb'),'attributes':['id',_0xfb9f('0xcc'),_0xfb9f('0xcd')],'raw':!![]});if(_0x223cab['query'][_0xfb9f('0xc9')]){_0x196916['push']({'model':db['Attachment'],'as':_0xfb9f('0xce'),'raw':!![]});}var _0x74864d=[{'model':db[_0xfb9f('0xb9')],'as':_0xfb9f('0xcf'),'attributes':['id',_0xfb9f('0x6c'),_0xfb9f('0xd0'),_0xfb9f('0xd1'),_0xfb9f('0xd2'),'read'],'include':_0x196916}];_0x74864d['push']({'model':db['OpenchannelAccount'],'as':'Account','attributes':['id',_0xfb9f('0x28')]});_0x74864d['push']({'model':db[_0xfb9f('0x69')],'as':_0xfb9f('0xd3'),'attributes':['id',_0xfb9f('0x2b')]});return db['OpenchannelInteraction'][_0xfb9f('0x5a')]({'where':{'id':_0x223cab[_0xfb9f('0xad')]['id']},'include':_0x74864d})[_0xfb9f('0x25')](handleEntityNotFound(_0x527ddd,null))['then'](function(_0x85474f){if(_0x85474f){var _0x30e1d1=_0x85474f['get']({'plain':!![]});fs[_0xfb9f('0xd4')](_0x4cf3e3);var _0x3f03b5={'format':'A4','border':_0xfb9f('0xd5'),'header':{'height':_0xfb9f('0xd6'),'contents':{'first':_0xfb9f('0xd7')}},'footer':{'height':_0xfb9f('0xd8'),'contents':{'default':util[_0xfb9f('0xb7')]('\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20%s\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20{{page}}/{{pages}}\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20%s\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',util[_0xfb9f('0xb7')]('%s\x20#%d',_0xfb9f('0xd9'),_0x30e1d1['id']),moment()[_0xfb9f('0xb7')](_0xfb9f('0xda'))[_0xfb9f('0x92')]())}}};var _0x4446d7={'channel':_0xfb9f('0xd9'),'account':_0x30e1d1[_0xfb9f('0xdb')]['name'],'agent':_0x30e1d1[_0xfb9f('0xd3')]?_0x30e1d1['Owner']['fullname']:_0xfb9f('0xdc'),'createdAt':moment(_0x30e1d1['createdAt'])['format'](_0xfb9f('0xb8'))[_0xfb9f('0x92')](),'closedAt':_0x30e1d1['closed']?moment(_0x30e1d1['closedAt'])['format'](_0xfb9f('0xb8'))[_0xfb9f('0x92')]():'','disposition':_0x30e1d1['disposition'],'visibility':_0x30e1d1[_0xfb9f('0xdd')]?'Public':_0xfb9f('0xde'),'messages':_(_0x30e1d1[_0xfb9f('0xcf')])['filter']({'secret':![]})[_0xfb9f('0x32')](function(_0x552154){if(_0x552154['Attachment']){var _0x32eb83=path[_0xfb9f('0xc8')](_0x9bf1de,_0x552154[_0xfb9f('0xce')]['basename']);if(fs[_0xfb9f('0xdf')](_0x32eb83)){fs[_0xfb9f('0xe0')](_0x32eb83)[_0xfb9f('0xe1')](fs[_0xfb9f('0xe2')](path['join'](_0x4cf3e3,_0x552154['Attachment'][_0xfb9f('0xe3')])));}}return{'date':moment(_0x552154['createdAt'])[_0xfb9f('0xb7')](_0xfb9f('0xb8'))[_0xfb9f('0x92')](),'sender':_0x552154[_0xfb9f('0xd1')]===_0xfb9f('0xe4')?_0x552154[_0xfb9f('0x69')]?_0x552154[_0xfb9f('0x69')][_0xfb9f('0x2b')]:_0xfb9f('0xe5'):_0x552154['Contact'][_0xfb9f('0xcc')]+(_0x552154[_0xfb9f('0xcb')][_0xfb9f('0xcd')]?'\x20'+_0x552154['Contact'][_0xfb9f('0xcd')]:''),'body':_0x552154[_0xfb9f('0xce')]?_0x552154['Attachment'][_0xfb9f('0xe3')]:_0x552154[_0xfb9f('0x6c')],'direction':_0x552154['direction']===_0xfb9f('0xe4')?'A':'C','secret':_0x552154[_0xfb9f('0xd2')],'read':_0x552154[_0xfb9f('0x7a')],'attachment':_0x552154[_0xfb9f('0xce')]};})['value']()};return ejs[_0xfb9f('0xe6')](path['join'](config[_0xfb9f('0xc4')],'server',_0xfb9f('0xe7'),_0xfb9f('0xe8')),{'interaction':_0x4446d7})[_0xfb9f('0x25')](function(_0x1e4064){return new BPromise(function(_0x255608,_0x1b4f98){pdf['create'](_0x1e4064,_0x3f03b5)[_0xfb9f('0xe9')](path[_0xfb9f('0xc8')](_0x4cf3e3,_0xfb9f('0xea')+_0x30e1d1['id']+'-'+_0x387069+'.pdf'),function(_0x26c51f,_0x40318d){if(_0x26c51f)return _0x1b4f98(_0x26c51f);_0x255608(_0x40318d);});});})['then'](function(){return new BPromise(function(_0x3805c2,_0x4e5176){zipdir(_0x4cf3e3,{'saveTo':_0x5e91b3},function(_0x23f801,_0x43e343){if(_0x23f801)return _0x4e5176(_0x23f801);return _0x3805c2(_0x43e343);});})['then'](function(){return new BPromise(function(_0x3b5129,_0x54dfc9){rimraf(_0x4cf3e3,function(_0xdf8cfd){if(_0xdf8cfd)_0x54dfc9(_0xdf8cfd);return _0x3b5129();});});})['then'](function(){return _0x527ddd[_0xfb9f('0xc2')](_0x5e91b3,_0x2b0cac,function(_0xc4d35d){if(_0xc4d35d){console[_0xfb9f('0xeb')](_0xfb9f('0xec'),_0xc4d35d);}else{fs[_0xfb9f('0xed')](_0x5e91b3);}});});});}else{return _0x527ddd[_0xfb9f('0x19')](0xc8);}})[_0xfb9f('0xab')](handleError(_0x527ddd,null));}; \ No newline at end of file diff --git a/server/api/openchannelInteraction/openchannelInteraction.events.js b/server/api/openchannelInteraction/openchannelInteraction.events.js index e013840..a1c4a3e 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 _0xede5=['update','getUsers','then','setDataValue','emit','hasOwnProperty','exports','events','../../mysqldb','OpenchannelInteraction','OpenchannelMessage','setMaxListeners','save'];(function(_0x1a9f8b,_0x53ac1b){var _0x12a2c1=function(_0x1123fb){while(--_0x1123fb){_0x1a9f8b['push'](_0x1a9f8b['shift']());}};_0x12a2c1(++_0x53ac1b);}(_0xede5,0xca));var _0x5ede=function(_0x45e470,_0x4f8abc){_0x45e470=_0x45e470-0x0;var _0x20e4f6=_0xede5[_0x45e470];return _0x20e4f6;};'use strict';var EventEmitter=require(_0x5ede('0x0'));var OpenchannelInteraction=require(_0x5ede('0x1'))['db'][_0x5ede('0x2')];var OpenchannelMessage=require(_0x5ede('0x1'))['db'][_0x5ede('0x3')];var OpenchannelInteractionEvents=new EventEmitter();OpenchannelInteractionEvents[_0x5ede('0x4')](0x0);var events={'afterCreate':_0x5ede('0x5'),'afterUpdate':_0x5ede('0x6'),'afterDestroy':'remove'};function emitEvent(_0x480619){return function(_0x26bb21,_0xa40f97,_0x2ccffc){_0x26bb21[_0x5ede('0x7')]({'attributes':['id'],'raw':!![]})[_0x5ede('0x8')](function(_0x5c0abf){_0x26bb21['setDataValue']('Users',_0x5c0abf['map'](function(_0x106123){return{'id':_0x106123['id']};}));return OpenchannelMessage['findAll']({'where':{'OpenchannelInteractionId':_0x26bb21['id'],'direction':'in','read':![]},'raw':!![]});})[_0x5ede('0x8')](function(_0x37c3ff){_0x26bb21[_0x5ede('0x9')]('unreadMessages',_0x37c3ff['length']);OpenchannelInteractionEvents[_0x5ede('0xa')](_0x480619+':'+_0x26bb21['id'],_0x26bb21);OpenchannelInteractionEvents[_0x5ede('0xa')](_0x480619,_0x26bb21);_0x2ccffc(null);})['catch'](_0x2ccffc(null));};}for(var e in events){if(events[_0x5ede('0xb')](e)){var event=events[e];OpenchannelInteraction['hook'](e,emitEvent(event));}}module[_0x5ede('0xc')]=OpenchannelInteractionEvents; \ No newline at end of file +var _0xd3fc=['getUsers','then','Users','map','unreadMessages','length','emit','catch','hook','exports','../../mysqldb','OpenchannelInteraction','OpenchannelMessage','update','remove'];(function(_0x1b7cb6,_0xce52d7){var _0x4bd49f=function(_0x31cef2){while(--_0x31cef2){_0x1b7cb6['push'](_0x1b7cb6['shift']());}};_0x4bd49f(++_0xce52d7);}(_0xd3fc,0x145));var _0xcd3f=function(_0x3d5edc,_0x526bf4){_0x3d5edc=_0x3d5edc-0x0;var _0x49977c=_0xd3fc[_0x3d5edc];return _0x49977c;};'use strict';var EventEmitter=require('events');var OpenchannelInteraction=require(_0xcd3f('0x0'))['db'][_0xcd3f('0x1')];var OpenchannelMessage=require(_0xcd3f('0x0'))['db'][_0xcd3f('0x2')];var OpenchannelInteractionEvents=new EventEmitter();OpenchannelInteractionEvents['setMaxListeners'](0x0);var events={'afterCreate':'save','afterUpdate':_0xcd3f('0x3'),'afterDestroy':_0xcd3f('0x4')};function emitEvent(_0x18a01a){return function(_0x904420,_0x22c3f0,_0x32cfe8){_0x904420[_0xcd3f('0x5')]({'attributes':['id'],'raw':!![]})[_0xcd3f('0x6')](function(_0x20585d){_0x904420['setDataValue'](_0xcd3f('0x7'),_0x20585d[_0xcd3f('0x8')](function(_0x30a6d1){return{'id':_0x30a6d1['id']};}));return OpenchannelMessage['findAll']({'where':{'OpenchannelInteractionId':_0x904420['id'],'direction':'in','read':![]},'raw':!![]});})[_0xcd3f('0x6')](function(_0x5f0900){_0x904420['setDataValue'](_0xcd3f('0x9'),_0x5f0900[_0xcd3f('0xa')]);OpenchannelInteractionEvents[_0xcd3f('0xb')](_0x18a01a+':'+_0x904420['id'],_0x904420);OpenchannelInteractionEvents[_0xcd3f('0xb')](_0x18a01a,_0x904420);_0x32cfe8(null);})[_0xcd3f('0xc')](_0x32cfe8(null));};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];OpenchannelInteraction[_0xcd3f('0xd')](e,emitEvent(event));}}module[_0xcd3f('0xe')]=OpenchannelInteractionEvents; \ No newline at end of file diff --git a/server/api/openchannelInteraction/openchannelInteraction.model.js b/server/api/openchannelInteraction/openchannelInteraction.model.js index fab7228..9edb06c 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 _0x236d=['request-promise','path','rimraf','exports','define','changed','closed','format','YYYY-MM-DD\x20HH:mm:ss','lodash','util','api','bluebird'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x236d,0x7e));var _0xd236=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x236d[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0xd236('0x0'));var util=require(_0xd236('0x1'));var logger=require('../../config/logger')(_0xd236('0x2'));var moment=require('moment');var BPromise=require(_0xd236('0x3'));var rp=require(_0xd236('0x4'));var fs=require('fs');var path=require(_0xd236('0x5'));var rimraf=require(_0xd236('0x6'));var config=require('../../config/environment');var attributes=require('./openchannelInteraction.attributes');module[_0xd236('0x7')]=function(_0x29a67c,_0x75d84c){return _0x29a67c[_0xd236('0x8')]('OpenchannelInteraction',attributes,{'tableName':'openchannel_interactions','paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x2d9025,_0x18d969,_0x4e0460){if(_0x2d9025[_0xd236('0x9')](_0xd236('0xa'))){_0x2d9025['closedAt']=moment()[_0xd236('0xb')](_0xd236('0xc'));}_0x4e0460(null,_0x2d9025);}}});}; \ No newline at end of file +var _0x1115=['openchannel_interactions','changed','closed','YYYY-MM-DD\x20HH:mm:ss','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','OpenchannelInteraction'];(function(_0x2006bf,_0x228881){var _0x5112e7=function(_0x42ee8e){while(--_0x42ee8e){_0x2006bf['push'](_0x2006bf['shift']());}};_0x5112e7(++_0x228881);}(_0x1115,0x1b6));var _0x5111=function(_0x2bf921,_0x215704){_0x2bf921=_0x2bf921-0x0;var _0x5c87eb=_0x1115[_0x2bf921];return _0x5c87eb;};'use strict';var _=require('lodash');var util=require(_0x5111('0x0'));var logger=require(_0x5111('0x1'))(_0x5111('0x2'));var moment=require(_0x5111('0x3'));var BPromise=require(_0x5111('0x4'));var rp=require(_0x5111('0x5'));var fs=require('fs');var path=require(_0x5111('0x6'));var rimraf=require(_0x5111('0x7'));var config=require(_0x5111('0x8'));var attributes=require('./openchannelInteraction.attributes');module['exports']=function(_0x467c3a,_0x115ba7){return _0x467c3a['define'](_0x5111('0x9'),attributes,{'tableName':_0x5111('0xa'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x54d5ae,_0x42a3c5,_0x5e629a){if(_0x54d5ae[_0x5111('0xb')](_0x5111('0xc'))){_0x54d5ae['closedAt']=moment()['format'](_0x5111('0xd'));}_0x5e629a(null,_0x54d5ae);}}});}; \ No newline at end of file diff --git a/server/api/openchannelInteraction/openchannelInteraction.rpc.js b/server/api/openchannelInteraction/openchannelInteraction.rpc.js index f4f9928..465e5c3 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 _0xfda9=['debug','OpenchannelInteraction,\x20%s,\x20%s,\x20%s','stringify','code','error','message','catch','update','body','options','raw','where','attributes','limit','UpdateOpenchannelInteraction','AddTagsToOpenchannelInteraction','OpenchannelInteraction','find','addTags','omit','ids','spread','AddTags','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','redis','defaults','localhost','socket.io-emitter','./openchannelInteraction.socket','register','request','then','info','OpenchannelInteraction,\x20%s,\x20%s','request\x20sent'];(function(_0x38add1,_0x44b935){var _0x234c6f=function(_0x150c98){while(--_0x150c98){_0x38add1['push'](_0x38add1['shift']());}};_0x234c6f(++_0x44b935);}(_0xfda9,0x12b));var _0x9fda=function(_0x311a4a,_0x30ea10){_0x311a4a=_0x311a4a-0x0;var _0x58f584=_0xfda9[_0x311a4a];return _0x58f584;};'use strict';var _=require(_0x9fda('0x0'));var util=require(_0x9fda('0x1'));var moment=require(_0x9fda('0x2'));var BPromise=require(_0x9fda('0x3'));var rs=require(_0x9fda('0x4'));var fs=require('fs');var Redis=require(_0x9fda('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x9fda('0x6'));var logger=require(_0x9fda('0x7'))(_0x9fda('0x8'));var config=require(_0x9fda('0x9'));var jayson=require('jayson/promise');var client=jayson[_0x9fda('0xa')][_0x9fda('0xb')]({'port':0x232a});config[_0x9fda('0xc')]=_[_0x9fda('0xd')](config[_0x9fda('0xc')],{'host':_0x9fda('0xe'),'port':0x18eb});var socket=require(_0x9fda('0xf'))(new Redis(config[_0x9fda('0xc')]));require(_0x9fda('0x10'))[_0x9fda('0x11')](socket);function respondWithRpcPromise(_0x42f5a0,_0x41acf9,_0x379b23){return new BPromise(function(_0x1bbe4a,_0x43987f){return client[_0x9fda('0x12')](_0x42f5a0,_0x379b23)[_0x9fda('0x13')](function(_0x515f17){logger[_0x9fda('0x14')](_0x9fda('0x15'),_0x41acf9,_0x9fda('0x16'));logger[_0x9fda('0x17')](_0x9fda('0x18'),_0x41acf9,_0x9fda('0x16'),JSON[_0x9fda('0x19')](_0x515f17));if(_0x515f17['error']){if(_0x515f17['error'][_0x9fda('0x1a')]===0x1f4){logger[_0x9fda('0x1b')](_0x9fda('0x15'),_0x41acf9,_0x515f17[_0x9fda('0x1b')]['message']);return _0x43987f(_0x515f17[_0x9fda('0x1b')]['message']);}logger['error']('OpenchannelInteraction,\x20%s,\x20%s',_0x41acf9,_0x515f17[_0x9fda('0x1b')]['message']);return _0x1bbe4a(_0x515f17[_0x9fda('0x1b')][_0x9fda('0x1c')]);}else{logger[_0x9fda('0x14')]('OpenchannelInteraction,\x20%s,\x20%s',_0x41acf9,'request\x20sent');_0x1bbe4a(_0x515f17['result'][_0x9fda('0x1c')]);}})[_0x9fda('0x1d')](function(_0x51c906){logger[_0x9fda('0x1b')]('OpenchannelInteraction,\x20%s,\x20%s',_0x41acf9,_0x51c906);_0x43987f(_0x51c906);});});}exports['UpdateOpenchannelInteraction']=function(_0x4f5b5f){var _0x2c114e=this;return new Promise(function(_0x437007,_0x5fa907){return db['OpenchannelInteraction'][_0x9fda('0x1e')](_0x4f5b5f[_0x9fda('0x1f')],{'raw':_0x4f5b5f[_0x9fda('0x20')]?_0x4f5b5f[_0x9fda('0x20')][_0x9fda('0x21')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x4f5b5f[_0x9fda('0x20')]?_0x4f5b5f['options'][_0x9fda('0x22')]||null:null,'attributes':_0x4f5b5f[_0x9fda('0x20')]?_0x4f5b5f[_0x9fda('0x20')][_0x9fda('0x23')]||null:null,'limit':_0x4f5b5f[_0x9fda('0x20')]?_0x4f5b5f['options'][_0x9fda('0x24')]||null:null})[_0x9fda('0x13')](function(_0x4ec5fb){logger[_0x9fda('0x14')](_0x9fda('0x25'),_0x4f5b5f);logger[_0x9fda('0x17')](_0x9fda('0x25'),_0x4f5b5f,JSON[_0x9fda('0x19')](_0x4ec5fb));_0x437007(_0x4ec5fb);})[_0x9fda('0x1d')](function(_0x5e4a28){logger[_0x9fda('0x1b')]('UpdateOpenchannelInteraction',_0x5e4a28[_0x9fda('0x1c')],_0x4f5b5f);_0x5fa907(_0x2c114e[_0x9fda('0x1b')](0x1f4,_0x5e4a28['message']));});});};exports[_0x9fda('0x26')]=function(_0x7944bf){return new Promise(function(_0x59fe64,_0x32471d){return db[_0x9fda('0x27')][_0x9fda('0x28')]({'where':_0x7944bf[_0x9fda('0x20')]?_0x7944bf[_0x9fda('0x20')]['where']||null:null})[_0x9fda('0x13')](function(_0x1a200d){if(_0x1a200d){return _0x1a200d[_0x9fda('0x29')](_0x7944bf[_0x9fda('0x1f')]['ids'],_[_0x9fda('0x2a')](_0x7944bf[_0x9fda('0x1f')],[_0x9fda('0x2b'),'id'])||{});}})[_0x9fda('0x2c')](function(_0x4feab4){logger['info']('AddTags',_0x7944bf);logger[_0x9fda('0x17')](_0x9fda('0x2d'),_0x7944bf,JSON[_0x9fda('0x19')](_0x4feab4));_0x59fe64(_0x4feab4);})[_0x9fda('0x1d')](function(_0x5afb3b){logger['error'](_0x9fda('0x2d'),_0x5afb3b[_0x9fda('0x1c')],_0x7944bf);_0x32471d(_this['error'](0x1f4,_0x5afb3b[_0x9fda('0x1c')]));});});}; \ No newline at end of file +var _0x60a6=['find','addTags','ids','omit','spread','AddTags','lodash','util','moment','bluebird','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','localhost','register','request','then','info','request\x20sent','OpenchannelInteraction,\x20%s,\x20%s,\x20%s','stringify','error','code','OpenchannelInteraction,\x20%s,\x20%s','message','result','UpdateOpenchannelInteraction','update','body','options','raw','where','attributes','limit','debug','catch','AddTagsToOpenchannelInteraction','OpenchannelInteraction'];(function(_0x302de7,_0x14678f){var _0x2d30c0=function(_0x90a4e3){while(--_0x90a4e3){_0x302de7['push'](_0x302de7['shift']());}};_0x2d30c0(++_0x14678f);}(_0x60a6,0x108));var _0x660a=function(_0x529b1a,_0x170427){_0x529b1a=_0x529b1a-0x0;var _0x1aa7ae=_0x60a6[_0x529b1a];return _0x1aa7ae;};'use strict';var _=require(_0x660a('0x0'));var util=require(_0x660a('0x1'));var moment=require(_0x660a('0x2'));var BPromise=require(_0x660a('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x660a('0x4'));var logger=require(_0x660a('0x5'))(_0x660a('0x6'));var config=require(_0x660a('0x7'));var jayson=require(_0x660a('0x8'));var client=jayson[_0x660a('0x9')][_0x660a('0xa')]({'port':0x232a});config[_0x660a('0xb')]=_['defaults'](config[_0x660a('0xb')],{'host':_0x660a('0xc'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x660a('0xb')]));require('./openchannelInteraction.socket')[_0x660a('0xd')](socket);function respondWithRpcPromise(_0x14530b,_0x57dac4,_0x12a2b5){return new BPromise(function(_0x4e2a66,_0x18562e){return client[_0x660a('0xe')](_0x14530b,_0x12a2b5)[_0x660a('0xf')](function(_0x3a2315){logger[_0x660a('0x10')]('OpenchannelInteraction,\x20%s,\x20%s',_0x57dac4,_0x660a('0x11'));logger['debug'](_0x660a('0x12'),_0x57dac4,'request\x20sent',JSON[_0x660a('0x13')](_0x3a2315));if(_0x3a2315[_0x660a('0x14')]){if(_0x3a2315[_0x660a('0x14')][_0x660a('0x15')]===0x1f4){logger[_0x660a('0x14')](_0x660a('0x16'),_0x57dac4,_0x3a2315[_0x660a('0x14')]['message']);return _0x18562e(_0x3a2315[_0x660a('0x14')]['message']);}logger['error'](_0x660a('0x16'),_0x57dac4,_0x3a2315[_0x660a('0x14')][_0x660a('0x17')]);return _0x4e2a66(_0x3a2315[_0x660a('0x14')][_0x660a('0x17')]);}else{logger[_0x660a('0x10')](_0x660a('0x16'),_0x57dac4,_0x660a('0x11'));_0x4e2a66(_0x3a2315[_0x660a('0x18')][_0x660a('0x17')]);}})['catch'](function(_0x47903c){logger[_0x660a('0x14')](_0x660a('0x16'),_0x57dac4,_0x47903c);_0x18562e(_0x47903c);});});}exports[_0x660a('0x19')]=function(_0x335ba6){var _0x15c0a3=this;return new Promise(function(_0x23f89e,_0x120248){return db['OpenchannelInteraction'][_0x660a('0x1a')](_0x335ba6[_0x660a('0x1b')],{'raw':_0x335ba6[_0x660a('0x1c')]?_0x335ba6[_0x660a('0x1c')][_0x660a('0x1d')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x335ba6[_0x660a('0x1c')]?_0x335ba6[_0x660a('0x1c')][_0x660a('0x1e')]||null:null,'attributes':_0x335ba6[_0x660a('0x1c')]?_0x335ba6[_0x660a('0x1c')][_0x660a('0x1f')]||null:null,'limit':_0x335ba6[_0x660a('0x1c')]?_0x335ba6['options'][_0x660a('0x20')]||null:null})[_0x660a('0xf')](function(_0x4c2105){logger[_0x660a('0x10')](_0x660a('0x19'),_0x335ba6);logger[_0x660a('0x21')](_0x660a('0x19'),_0x335ba6,JSON[_0x660a('0x13')](_0x4c2105));_0x23f89e(_0x4c2105);})[_0x660a('0x22')](function(_0x18a8da){logger['error']('UpdateOpenchannelInteraction',_0x18a8da['message'],_0x335ba6);_0x120248(_0x15c0a3[_0x660a('0x14')](0x1f4,_0x18a8da[_0x660a('0x17')]));});});};exports[_0x660a('0x23')]=function(_0x524af9){return new Promise(function(_0xac378,_0x398b89){return db[_0x660a('0x24')][_0x660a('0x25')]({'where':_0x524af9['options']?_0x524af9[_0x660a('0x1c')]['where']||null:null})[_0x660a('0xf')](function(_0x2c0c49){if(_0x2c0c49){return _0x2c0c49[_0x660a('0x26')](_0x524af9[_0x660a('0x1b')][_0x660a('0x27')],_[_0x660a('0x28')](_0x524af9[_0x660a('0x1b')],[_0x660a('0x27'),'id'])||{});}})[_0x660a('0x29')](function(_0x195e0f){logger['info'](_0x660a('0x2a'),_0x524af9);logger['debug'](_0x660a('0x2a'),_0x524af9,JSON[_0x660a('0x13')](_0x195e0f));_0xac378(_0x195e0f);})[_0x660a('0x22')](function(_0x4dfdb9){logger[_0x660a('0x14')](_0x660a('0x2a'),_0x4dfdb9[_0x660a('0x17')],_0x524af9);_0x398b89(_this[_0x660a('0x14')](0x1f4,_0x4dfdb9['message']));});});}; \ No newline at end of file diff --git a/server/api/openchannelInteraction/openchannelInteraction.socket.js b/server/api/openchannelInteraction/openchannelInteraction.socket.js index 50ed37d..7a1b5bc 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 _0x7bc3=['removeListener','openchannelInteraction:','./openchannelInteraction.events','save','remove','emit'];(function(_0x36b9da,_0x580057){var _0x4c84ff=function(_0xae9a9f){while(--_0xae9a9f){_0x36b9da['push'](_0x36b9da['shift']());}};_0x4c84ff(++_0x580057);}(_0x7bc3,0xec));var _0x37bc=function(_0x1c4c6a,_0x230e6f){_0x1c4c6a=_0x1c4c6a-0x0;var _0x35db18=_0x7bc3[_0x1c4c6a];return _0x35db18;};'use strict';var OpenchannelInteractionEvents=require(_0x37bc('0x0'));var events=[_0x37bc('0x1'),_0x37bc('0x2'),'update'];function createListener(_0x26edd0,_0x5d0018){return function(_0x53392c){_0x5d0018[_0x37bc('0x3')](_0x26edd0,_0x53392c);};}function removeListener(_0x43c79f,_0x421f2d){return function(){OpenchannelInteractionEvents[_0x37bc('0x4')](_0x43c79f,_0x421f2d);};}exports['register']=function(_0x7feba){for(var _0x37e50f=0x0,_0x28321f=events['length'];_0x37e50f<_0x28321f;_0x37e50f++){var _0x2220bc=events[_0x37e50f];var _0xcf6796=createListener(_0x37bc('0x5')+_0x2220bc,_0x7feba);OpenchannelInteractionEvents['on'](_0x2220bc,_0xcf6796);}}; \ No newline at end of file +var _0x7662=['removeListener','register','openchannelInteraction:','save','remove','update','emit'];(function(_0x589d30,_0xf68aa2){var _0x28345f=function(_0x39f3d4){while(--_0x39f3d4){_0x589d30['push'](_0x589d30['shift']());}};_0x28345f(++_0xf68aa2);}(_0x7662,0xf8));var _0x2766=function(_0x5be5f0,_0x4243ae){_0x5be5f0=_0x5be5f0-0x0;var _0x43f1fa=_0x7662[_0x5be5f0];return _0x43f1fa;};'use strict';var OpenchannelInteractionEvents=require('./openchannelInteraction.events');var events=[_0x2766('0x0'),_0x2766('0x1'),_0x2766('0x2')];function createListener(_0x42b514,_0x1d1710){return function(_0x22244a){_0x1d1710[_0x2766('0x3')](_0x42b514,_0x22244a);};}function removeListener(_0x2c72ce,_0xa947cb){return function(){OpenchannelInteractionEvents[_0x2766('0x4')](_0x2c72ce,_0xa947cb);};}exports[_0x2766('0x5')]=function(_0x32443b){for(var _0x298e53=0x0,_0x410202=events['length'];_0x298e53<_0x410202;_0x298e53++){var _0x35fdac=events[_0x298e53];var _0x5a6bab=createListener(_0x2766('0x6')+_0x35fdac,_0x32443b);OpenchannelInteractionEvents['on'](_0x35fdac,_0x5a6bab);}}; \ No newline at end of file diff --git a/server/api/openchannelMessage/index.js b/server/api/openchannelMessage/index.js index 8e8e0f4..48a7ecf 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 _0x9e99=['show','post','tracked','openchannel','create','put','update','/:id/reject','reject','delete','destroy','exports','multer','util','connect-timeout','express','../../components/auth/service','../../config/environment','get','isAuthenticated','index','/describe','describe','/:id'];(function(_0x2b4b4b,_0x32de25){var _0xea5098=function(_0x5d8d6a){while(--_0x5d8d6a){_0x2b4b4b['push'](_0x2b4b4b['shift']());}};_0xea5098(++_0x32de25);}(_0x9e99,0x174));var _0x99e9=function(_0x5b8fb6,_0x300996){_0x5b8fb6=_0x5b8fb6-0x0;var _0x3f8bb9=_0x9e99[_0x5b8fb6];return _0x3f8bb9;};'use strict';var multer=require(_0x99e9('0x0'));var util=require(_0x99e9('0x1'));var path=require('path');var timeout=require(_0x99e9('0x2'));var express=require(_0x99e9('0x3'));var router=express['Router']();var auth=require(_0x99e9('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0x99e9('0x5'));var controller=require('./openchannelMessage.controller');router[_0x99e9('0x6')]('/',auth[_0x99e9('0x7')](),controller[_0x99e9('0x8')]);router[_0x99e9('0x6')](_0x99e9('0x9'),auth['isAuthenticated'](),controller[_0x99e9('0xa')]);router[_0x99e9('0x6')](_0x99e9('0xb'),auth[_0x99e9('0x7')](),controller[_0x99e9('0xc')]);router[_0x99e9('0xd')]('/',auth[_0x99e9('0x7')](),interaction[_0x99e9('0xe')](_0x99e9('0xf'),'openchannelmessage:create'),controller[_0x99e9('0x10')]);router[_0x99e9('0x11')](_0x99e9('0xb'),auth['isAuthenticated'](),controller[_0x99e9('0x12')]);router[_0x99e9('0x11')]('/:id/accept',auth['isAuthenticated'](),controller['accept']);router[_0x99e9('0x11')](_0x99e9('0x13'),auth[_0x99e9('0x7')](),controller[_0x99e9('0x14')]);router[_0x99e9('0x15')](_0x99e9('0xb'),auth[_0x99e9('0x7')](),controller[_0x99e9('0x16')]);module[_0x99e9('0x17')]=router; \ No newline at end of file +var _0x5a14=['tracked','openchannel','create','put','update','/:id/accept','/:id/reject','reject','destroy','exports','multer','util','path','connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment','./openchannelMessage.controller','get','index','/describe','/:id','isAuthenticated','show','post'];(function(_0x571bfe,_0x17273a){var _0x47b5ff=function(_0x2f72a7){while(--_0x2f72a7){_0x571bfe['push'](_0x571bfe['shift']());}};_0x47b5ff(++_0x17273a);}(_0x5a14,0x190));var _0x45a1=function(_0x440a56,_0x3820d9){_0x440a56=_0x440a56-0x0;var _0xc0a3b5=_0x5a14[_0x440a56];return _0xc0a3b5;};'use strict';var multer=require(_0x45a1('0x0'));var util=require(_0x45a1('0x1'));var path=require(_0x45a1('0x2'));var timeout=require(_0x45a1('0x3'));var express=require(_0x45a1('0x4'));var router=express['Router']();var auth=require(_0x45a1('0x5'));var interaction=require(_0x45a1('0x6'));var config=require(_0x45a1('0x7'));var controller=require(_0x45a1('0x8'));router[_0x45a1('0x9')]('/',auth['isAuthenticated'](),controller[_0x45a1('0xa')]);router[_0x45a1('0x9')](_0x45a1('0xb'),auth['isAuthenticated'](),controller['describe']);router[_0x45a1('0x9')](_0x45a1('0xc'),auth[_0x45a1('0xd')](),controller[_0x45a1('0xe')]);router[_0x45a1('0xf')]('/',auth[_0x45a1('0xd')](),interaction[_0x45a1('0x10')](_0x45a1('0x11'),'openchannelmessage:create'),controller[_0x45a1('0x12')]);router[_0x45a1('0x13')]('/:id',auth['isAuthenticated'](),controller[_0x45a1('0x14')]);router[_0x45a1('0x13')](_0x45a1('0x15'),auth[_0x45a1('0xd')](),controller['accept']);router[_0x45a1('0x13')](_0x45a1('0x16'),auth[_0x45a1('0xd')](),controller[_0x45a1('0x17')]);router['delete'](_0x45a1('0xc'),auth[_0x45a1('0xd')](),controller[_0x45a1('0x18')]);module[_0x45a1('0x19')]=router; \ No newline at end of file diff --git a/server/api/openchannelMessage/openchannelMessage.attributes.js b/server/api/openchannelMessage/openchannelMessage.attributes.js index fe9a956..e9206b8 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 _0x8120=['sequelize','exports','medium','BOOLEAN','ENUM','out','DATE'];(function(_0x4404ff,_0x13d7a9){var _0x5e7b19=function(_0x13847a){while(--_0x13847a){_0x4404ff['push'](_0x4404ff['shift']());}};_0x5e7b19(++_0x13d7a9);}(_0x8120,0x1a4));var _0x0812=function(_0x19ba9b,_0x44f38e){_0x19ba9b=_0x19ba9b-0x0;var _0x1b0504=_0x8120[_0x19ba9b];return _0x1b0504;};'use strict';var Sequelize=require(_0x0812('0x0'));module[_0x0812('0x1')]={'body':{'type':Sequelize['TEXT'](_0x0812('0x2')),'allowNull':![]},'read':{'type':Sequelize[_0x0812('0x3')],'defaultValue':![]},'secret':{'type':Sequelize[_0x0812('0x3')],'defaultValue':![]},'direction':{'type':Sequelize[_0x0812('0x4')]('in',_0x0812('0x5')),'defaultValue':_0x0812('0x5'),'allowNull':![]},'readAt':{'type':Sequelize[_0x0812('0x6')]}}; \ No newline at end of file +var _0x266f=['sequelize','exports','medium','ENUM','out','DATE'];(function(_0xb6e2ea,_0x3b26e9){var _0x2a57bb=function(_0x2a1ac9){while(--_0x2a1ac9){_0xb6e2ea['push'](_0xb6e2ea['shift']());}};_0x2a57bb(++_0x3b26e9);}(_0x266f,0x1c2));var _0xf266=function(_0x1a7846,_0x59723e){_0x1a7846=_0x1a7846-0x0;var _0x48049=_0x266f[_0x1a7846];return _0x48049;};'use strict';var Sequelize=require(_0xf266('0x0'));module[_0xf266('0x1')]={'body':{'type':Sequelize['TEXT'](_0xf266('0x2')),'allowNull':![]},'read':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'secret':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'direction':{'type':Sequelize[_0xf266('0x3')]('in',_0xf266('0x4')),'defaultValue':_0xf266('0x4'),'allowNull':![]},'readAt':{'type':Sequelize[_0xf266('0x5')]}}; \ No newline at end of file diff --git a/server/api/openchannelMessage/openchannelMessage.controller.js b/server/api/openchannelMessage/openchannelMessage.controller.js index 1277770..f1735ef 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 _0x4aa6=['agent','[OPENCHANNELMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','RejectMessage','rejectMessage','event','rejectmessage','html-pdf','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','to-csv','lodash','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/environment','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./openchannelMessage.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~!@#$%^&-_=+[{]}.','then','info','OpenchannelMessage,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','catch','status','end','json','count','offset','limit','set','Content-Range','reject','save','update','destroy','sendStatus','name','send','index','map','OpenchannelMessage','rawAttributes','fieldName','type','key','model','query','filters','intersection','attributes','fields','nolimit','order','sort','where','filter','merge','VIRTUAL','options','includeAll','include','rows','params','keys','length','find','create','body','describe','../../config/logger','openchannel-interactions','accept','openchannel','read','format','YYYY-MM-DD\x20HH:mm:ss','UserId','Contact','get','OpenchannelInteraction','OpenchannelInteractionId','isNil','read1stAt','interaction','[OPENCHANNELMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','user','role','null','AcceptMessage','interface','SIP/%s','channel','EventManager','acceptmessage'];(function(_0x57928b,_0x29a111){var _0x49aad6=function(_0x34a268){while(--_0x34a268){_0x57928b['push'](_0x57928b['shift']());}};_0x49aad6(++_0x29a111);}(_0x4aa6,0x16b));var _0x64aa=function(_0xc63d49,_0x48e9f9){_0xc63d49=_0xc63d49-0x0;var _0x4ff3d9=_0x4aa6[_0xc63d49];return _0x4ff3d9;};'use strict';var pdf=require(_0x64aa('0x0'));var emlformat=require(_0x64aa('0x1'));var rimraf=require(_0x64aa('0x2'));var zipdir=require('zip-dir');var jsonpatch=require(_0x64aa('0x3'));var rp=require(_0x64aa('0x4'));var moment=require(_0x64aa('0x5'));var BPromise=require(_0x64aa('0x6'));var Mustache=require(_0x64aa('0x7'));var util=require('util');var path=require(_0x64aa('0x8'));var sox=require(_0x64aa('0x9'));var csv=require(_0x64aa('0xa'));var ejs=require('ejs');var fs=require('fs');var _=require(_0x64aa('0xb'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x64aa('0xc'));var deskjs=require(_0x64aa('0xd'));var toCsv=require('to-csv');var querystring=require(_0x64aa('0xe'));var Papa=require(_0x64aa('0xf'));var Redis=require('ioredis');var authService=require(_0x64aa('0x10'));var qs=require('../../components/parsers/qs');var as=require(_0x64aa('0x11'));var hardwareService=require(_0x64aa('0x12'));var logger=require('../../config/logger')(_0x64aa('0x13'));var utils=require('../../config/utils');var config=require(_0x64aa('0x14'));var db=require(_0x64aa('0x15'))['db'];config[_0x64aa('0x16')]=_[_0x64aa('0x17')](config[_0x64aa('0x16')],{'host':_0x64aa('0x18'),'port':0x18eb});var socket=require(_0x64aa('0x19'))(new Redis(config['redis']));require(_0x64aa('0x1a'))[_0x64aa('0x1b')](socket);var jayson=require(_0x64aa('0x1c'));var client=jayson[_0x64aa('0x1d')][_0x64aa('0x1e')]({'port':0x232c});var client9002=jayson['client'][_0x64aa('0x1e')]({'port':0x232a});function checkPasswordPattern(_0x1d5a28,_0x19cb3b,_0x24f5de){if(_0x24f5de){var _0x47bf85=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x47bf85['test'](_0x19cb3b)){return _0x1d5a28;}else{throw new db['Sequelize'][(_0x64aa('0x1f'))](_0x64aa('0x20'));}}else{return _0x1d5a28;}}function respondWithRpcPromise(_0x2da15e,_0x15a1d9,_0x1b574b,_0x13adab){return new BPromise(function(_0x450b7b,_0x1cc8a7){var _0xf2016a=_0x13adab||client;return _0xf2016a['request'](_0x2da15e,_0x1b574b)[_0x64aa('0x21')](function(_0x2bc540){logger[_0x64aa('0x22')](_0x64aa('0x23'),_0x15a1d9,_0x64aa('0x24'));logger['debug']('OpenchannelMessage,\x20%s,\x20%s,\x20%s',_0x15a1d9,_0x64aa('0x24'),JSON[_0x64aa('0x25')](_0x2bc540));if(_0x2bc540[_0x64aa('0x26')]){if(_0x2bc540[_0x64aa('0x26')][_0x64aa('0x27')]===0x1f4){logger[_0x64aa('0x26')](_0x64aa('0x23'),_0x15a1d9,_0x2bc540[_0x64aa('0x26')][_0x64aa('0x28')]);return _0x1cc8a7(_0x2bc540[_0x64aa('0x26')]['message']);}logger[_0x64aa('0x26')]('OpenchannelMessage,\x20%s,\x20%s',_0x15a1d9,_0x2bc540[_0x64aa('0x26')][_0x64aa('0x28')]);return _0x450b7b(_0x2bc540['error']['message']);}else{logger[_0x64aa('0x22')](_0x64aa('0x23'),_0x15a1d9,_0x64aa('0x24'));_0x450b7b(_0x2bc540['result'][_0x64aa('0x28')]);}})[_0x64aa('0x29')](function(_0x1eaceb){logger[_0x64aa('0x26')](_0x64aa('0x23'),_0x15a1d9,_0x1eaceb);_0x1cc8a7(_0x1eaceb);});});}function respondWithStatusCode(_0x518415,_0x39f9d9){_0x39f9d9=_0x39f9d9||0xcc;return function(_0x2b71a1){if(_0x2b71a1){return _0x518415['sendStatus'](_0x39f9d9);}return _0x518415[_0x64aa('0x2a')](_0x39f9d9)[_0x64aa('0x2b')]();};}function respondWithResult(_0x13ede1,_0x4bc3ed){_0x4bc3ed=_0x4bc3ed||0xc8;return function(_0xb9d643){if(_0xb9d643){return _0x13ede1[_0x64aa('0x2a')](_0x4bc3ed)[_0x64aa('0x2c')](_0xb9d643);}};}function respondWithFilteredResult(_0x26efbd,_0x1d1b05){return function(_0x2e286a){if(_0x2e286a){var _0x2d201e=_0x2e286a[_0x64aa('0x2d')],_0x30b4d4=_0x1d1b05[_0x64aa('0x2e')],_0x37ed0c=_0x1d1b05[_0x64aa('0x2e')]+_0x1d1b05[_0x64aa('0x2f')],_0x15d500;if(_0x37ed0c>=_0x2d201e){_0x37ed0c=_0x2d201e;_0x15d500=0xc8;}else{_0x15d500=0xce;}_0x26efbd[_0x64aa('0x2a')](_0x15d500);return _0x26efbd[_0x64aa('0x30')](_0x64aa('0x31'),_0x30b4d4+'-'+_0x37ed0c+'/'+_0x2d201e)[_0x64aa('0x2c')](_0x2e286a);}return null;};}function patchUpdates(_0x278c97){return function(_0x247225){try{jsonpatch['apply'](_0x247225,_0x278c97,!![]);}catch(_0x338110){return BPromise[_0x64aa('0x32')](_0x338110);}return _0x247225[_0x64aa('0x33')]();};}function saveUpdates(_0x452aec,_0x244d2f){return function(_0x3261dc){if(_0x3261dc){return _0x3261dc[_0x64aa('0x34')](_0x452aec)[_0x64aa('0x21')](function(_0x4ab884){return _0x4ab884;});}return null;};}function removeEntity(_0x334fc6,_0x2bf83){return function(_0x215cae){if(_0x215cae){return _0x215cae[_0x64aa('0x35')]()['then'](function(){_0x334fc6['status'](0xcc)[_0x64aa('0x2b')]();});}};}function handleEntityNotFound(_0x122f11,_0x594215){return function(_0x4d26dc){if(!_0x4d26dc){_0x122f11[_0x64aa('0x36')](0x194);}return _0x4d26dc;};}function handleError(_0x11a888,_0x2b1f17){_0x2b1f17=_0x2b1f17||0x1f4;return function(_0x3774b9){logger[_0x64aa('0x26')](_0x3774b9['stack']);if(_0x3774b9[_0x64aa('0x37')]){delete _0x3774b9['name'];}_0x11a888[_0x64aa('0x2a')](_0x2b1f17)[_0x64aa('0x38')](_0x3774b9);};}exports[_0x64aa('0x39')]=function(_0x145ce8,_0x53d96d){var _0x15f0bc={},_0x200e1e={},_0x5b504d={'count':0x0,'rows':[]};var _0x1fbd28=_[_0x64aa('0x3a')](db[_0x64aa('0x3b')][_0x64aa('0x3c')],function(_0x4bb795){return{'name':_0x4bb795[_0x64aa('0x3d')],'type':_0x4bb795[_0x64aa('0x3e')][_0x64aa('0x3f')]};});_0x200e1e[_0x64aa('0x40')]=_[_0x64aa('0x3a')](_0x1fbd28,_0x64aa('0x37'));_0x200e1e[_0x64aa('0x41')]=_['keys'](_0x145ce8[_0x64aa('0x41')]);_0x200e1e[_0x64aa('0x42')]=_[_0x64aa('0x43')](_0x200e1e[_0x64aa('0x40')],_0x200e1e[_0x64aa('0x41')]);_0x15f0bc[_0x64aa('0x44')]=_[_0x64aa('0x43')](_0x200e1e['model'],qs[_0x64aa('0x45')](_0x145ce8[_0x64aa('0x41')][_0x64aa('0x45')]));_0x15f0bc['attributes']=_0x15f0bc[_0x64aa('0x44')]['length']?_0x15f0bc[_0x64aa('0x44')]:_0x200e1e[_0x64aa('0x40')];if(!_0x145ce8['query']['hasOwnProperty'](_0x64aa('0x46'))){_0x15f0bc['limit']=qs['limit'](_0x145ce8[_0x64aa('0x41')][_0x64aa('0x2f')]);_0x15f0bc['offset']=qs['offset'](_0x145ce8[_0x64aa('0x41')][_0x64aa('0x2e')]);}_0x15f0bc[_0x64aa('0x47')]=qs[_0x64aa('0x48')](_0x145ce8['query']['sort']);_0x15f0bc[_0x64aa('0x49')]=qs[_0x64aa('0x42')](_['pick'](_0x145ce8[_0x64aa('0x41')],_0x200e1e[_0x64aa('0x42')]));if(_0x145ce8[_0x64aa('0x41')][_0x64aa('0x4a')]){_0x15f0bc['where']=_[_0x64aa('0x4b')](_0x15f0bc['where'],{'$or':_[_0x64aa('0x3a')](_0x1fbd28,function(_0x4c733c){if(_0x4c733c['type']!==_0x64aa('0x4c')){var _0x5ef839={};_0x5ef839[_0x4c733c[_0x64aa('0x37')]]={'$like':'%'+_0x145ce8[_0x64aa('0x41')][_0x64aa('0x4a')]+'%'};return _0x5ef839;}})});}_0x15f0bc=_[_0x64aa('0x4b')]({},_0x15f0bc,_0x145ce8[_0x64aa('0x4d')]);var _0x4e8af9={'where':_0x15f0bc[_0x64aa('0x49')]};return db[_0x64aa('0x3b')][_0x64aa('0x2d')](_0x4e8af9)[_0x64aa('0x21')](function(_0x506a1e){_0x5b504d['count']=_0x506a1e;if(_0x145ce8[_0x64aa('0x41')][_0x64aa('0x4e')]){_0x15f0bc[_0x64aa('0x4f')]=[{'all':!![]}];}return db['OpenchannelMessage']['findAll'](_0x15f0bc);})[_0x64aa('0x21')](function(_0x53264b){_0x5b504d[_0x64aa('0x50')]=_0x53264b;return _0x5b504d;})['then'](respondWithFilteredResult(_0x53d96d,_0x15f0bc))['catch'](handleError(_0x53d96d,null));};exports['show']=function(_0x44bb23,_0x208342){var _0x15881b={'raw':!![],'where':{'id':_0x44bb23[_0x64aa('0x51')]['id']}},_0x22f479={};_0x22f479['model']=_[_0x64aa('0x52')](db[_0x64aa('0x3b')][_0x64aa('0x3c')]);_0x22f479[_0x64aa('0x41')]=_[_0x64aa('0x52')](_0x44bb23['query']);_0x22f479['filters']=_['intersection'](_0x22f479[_0x64aa('0x40')],_0x22f479['query']);_0x15881b[_0x64aa('0x44')]=_[_0x64aa('0x43')](_0x22f479[_0x64aa('0x40')],qs[_0x64aa('0x45')](_0x44bb23[_0x64aa('0x41')][_0x64aa('0x45')]));_0x15881b[_0x64aa('0x44')]=_0x15881b[_0x64aa('0x44')][_0x64aa('0x53')]?_0x15881b[_0x64aa('0x44')]:_0x22f479[_0x64aa('0x40')];if(_0x44bb23[_0x64aa('0x41')][_0x64aa('0x4e')]){_0x15881b[_0x64aa('0x4f')]=[{'all':!![]}];}_0x15881b=_[_0x64aa('0x4b')]({},_0x15881b,_0x44bb23['options']);return db[_0x64aa('0x3b')][_0x64aa('0x54')](_0x15881b)['then'](handleEntityNotFound(_0x208342,null))[_0x64aa('0x21')](respondWithResult(_0x208342,null))[_0x64aa('0x29')](handleError(_0x208342,null));};exports['create']=function(_0x57c0ad,_0x54ac6c){return db[_0x64aa('0x3b')][_0x64aa('0x55')](_0x57c0ad[_0x64aa('0x56')],{})[_0x64aa('0x21')](respondWithResult(_0x54ac6c,0xc9))[_0x64aa('0x29')](handleError(_0x54ac6c,null));};exports['update']=function(_0x463af2,_0x3b8521){if(_0x463af2[_0x64aa('0x56')]['id']){delete _0x463af2[_0x64aa('0x56')]['id'];}return db[_0x64aa('0x3b')][_0x64aa('0x54')]({'where':{'id':_0x463af2[_0x64aa('0x51')]['id']}})[_0x64aa('0x21')](handleEntityNotFound(_0x3b8521,null))['then'](saveUpdates(_0x463af2['body'],null))[_0x64aa('0x21')](respondWithResult(_0x3b8521,null))['catch'](handleError(_0x3b8521,null));};exports[_0x64aa('0x35')]=function(_0x2d8d78,_0x3c7175){return db[_0x64aa('0x3b')][_0x64aa('0x54')]({'where':{'id':_0x2d8d78['params']['id']}})[_0x64aa('0x21')](handleEntityNotFound(_0x3c7175,null))[_0x64aa('0x21')](removeEntity(_0x3c7175,null))[_0x64aa('0x29')](handleError(_0x3c7175,null));};exports[_0x64aa('0x57')]=function(_0x54721b,_0x16d679){return db[_0x64aa('0x3b')]['describe']()[_0x64aa('0x21')](respondWithResult(_0x16d679,null))[_0x64aa('0x29')](handleError(_0x16d679,null));};var interaction_log=require(_0x64aa('0x58'))(_0x64aa('0x59'));exports[_0x64aa('0x5a')]=function(_0x3aaae9,_0x4f5ba7,_0x1a7561){var _0xad649e={'channel':_0x64aa('0x5b')};if(_0x3aaae9[_0x64aa('0x56')]['id']){delete _0x3aaae9['body']['id'];}_0x3aaae9[_0x64aa('0x56')][_0x64aa('0x5c')]=!![];_0x3aaae9[_0x64aa('0x56')]['readAt']=moment()[_0x64aa('0x5d')](_0x64aa('0x5e'));_0x3aaae9['body'][_0x64aa('0x5f')]=_0x3aaae9[_0x64aa('0x56')][_0x64aa('0x5f')]||_0x3aaae9['user']['id'];return db[_0x64aa('0x3b')][_0x64aa('0x54')]({'where':{'id':_0x3aaae9[_0x64aa('0x51')]['id'],'UserId':null},'include':[{'model':db['CmContact'],'as':_0x64aa('0x60')}]})[_0x64aa('0x21')](handleEntityNotFound(_0x4f5ba7,null))[_0x64aa('0x21')](saveUpdates(_0x3aaae9[_0x64aa('0x56')],null))[_0x64aa('0x21')](function(_0x3467c4){if(_0x3467c4){_0xad649e['message']=_0x3467c4[_0x64aa('0x61')]({'plain':!![]});return db[_0x64aa('0x62')][_0x64aa('0x54')]({'where':{'id':_0x3467c4[_0x64aa('0x63')]}});}return null;})['then'](handleEntityNotFound(_0x4f5ba7,null))[_0x64aa('0x21')](function(_0x460857){if(_0x460857){return _0x460857[_0x64aa('0x34')]({'UserId':_0x3aaae9['body'][_0x64aa('0x5f')],'read1stAt':_[_0x64aa('0x64')](_0x460857[_0x64aa('0x65')])?moment()[_0x64aa('0x5d')](_0x64aa('0x5e')):undefined});}return null;})[_0x64aa('0x21')](function(_0x1f918f){if(_0x1f918f){_0xad649e[_0x64aa('0x66')]=_0x1f918f[_0x64aa('0x61')]({'plain':!![]});interaction_log[_0x64aa('0x22')](_0x64aa('0x67'),_0x3aaae9[_0x64aa('0x68')]['id'],_0x3aaae9['user'][_0x64aa('0x37')],_0x3aaae9[_0x64aa('0x68')][_0x64aa('0x69')],_0xad649e[_0x64aa('0x66')]['id'],_0x3aaae9[_0x64aa('0x56')]?JSON[_0x64aa('0x25')](_0x3aaae9[_0x64aa('0x56')]):_0x64aa('0x6a'));return respondWithRpcPromise(_0x64aa('0x6b'),'acceptMessage',_0xad649e);}return null;})[_0x64aa('0x21')](function(_0x166105){if(_0x166105){if(_0x3aaae9['body']['manual']){_0xad649e[_0x64aa('0x28')][_0x64aa('0x6c')]=util[_0x64aa('0x5d')](_0x64aa('0x6d'),_0x3aaae9['user']['name']);_0xad649e['message']['channel']=_0xad649e[_0x64aa('0x6e')];_0xad649e['message']['event']=_0x64aa('0x5a');return respondWithRpcPromise('EventManager',_0x64aa('0x6f'),{'event':_0x64aa('0x70'),'message':_0xad649e['message']},client9002)['then'](function(){return _0xad649e;});}return _0xad649e;}return null;})['then'](respondWithResult(_0x4f5ba7,null))[_0x64aa('0x29')](handleError(_0x4f5ba7,null));};var interaction_log=require(_0x64aa('0x58'))(_0x64aa('0x59'));exports[_0x64aa('0x32')]=function(_0x5c14c1,_0x2c99cc,_0x263ecc){var _0x4aa136={'agent':{},'channel':'openchannel'};if(_0x5c14c1['body']['id']){delete _0x5c14c1['body']['id'];}_0x5c14c1[_0x64aa('0x56')]['UserId']=_0x5c14c1['body'][_0x64aa('0x5f')]||_0x5c14c1['user']['id'];_0x4aa136[_0x64aa('0x71')]['id']=_0x5c14c1[_0x64aa('0x56')][_0x64aa('0x5f')];return db[_0x64aa('0x3b')][_0x64aa('0x54')]({'where':{'id':_0x5c14c1[_0x64aa('0x51')]['id'],'UserId':null}})[_0x64aa('0x21')](handleEntityNotFound(_0x2c99cc,null))['then'](function(_0x3fb096){if(_0x3fb096){_0x4aa136['message']=_0x3fb096[_0x64aa('0x61')]({'plain':!![]});return db['OpenchannelInteraction']['find']({'where':{'id':_0x3fb096[_0x64aa('0x63')]}});}return null;})[_0x64aa('0x21')](handleEntityNotFound(_0x2c99cc,null))[_0x64aa('0x21')](function(_0x21e32b){if(_0x21e32b){_0x4aa136[_0x64aa('0x66')]=_0x21e32b['get']({'plain':!![]});interaction_log['info'](_0x64aa('0x72'),_0x5c14c1[_0x64aa('0x68')]['id'],_0x5c14c1['user'][_0x64aa('0x37')],_0x5c14c1[_0x64aa('0x68')][_0x64aa('0x69')],_0x4aa136[_0x64aa('0x66')]['id'],_0x5c14c1[_0x64aa('0x56')]?JSON[_0x64aa('0x25')](_0x5c14c1[_0x64aa('0x56')]):_0x64aa('0x6a'));return respondWithRpcPromise(_0x64aa('0x73'),_0x64aa('0x74'),_0x4aa136);}return null;})['then'](function(_0x153992){if(_0x153992){_0x153992[_0x64aa('0x28')][_0x64aa('0x6c')]=util['format'](_0x64aa('0x6d'),_0x5c14c1[_0x64aa('0x68')][_0x64aa('0x37')]);_0x153992[_0x64aa('0x28')][_0x64aa('0x6e')]=_0x4aa136[_0x64aa('0x6e')];_0x153992[_0x64aa('0x28')][_0x64aa('0x75')]=_0x64aa('0x32');respondWithRpcPromise('EventManager',_0x64aa('0x6f'),{'event':_0x64aa('0x76'),'message':_0x153992[_0x64aa('0x28')]},client9002);return _0x4aa136;}return null;})[_0x64aa('0x21')](respondWithResult(_0x2c99cc,null))[_0x64aa('0x29')](handleError(_0x2c99cc,null));}; \ No newline at end of file +var _0xd7a2=['rejectMessage','interface','rejectmessage','html-pdf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','lodash','squel','crypto','desk.js','querystring','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../mysqldb','redis','defaults','socket.io-emitter','./openchannelMessage.socket','jayson/promise','client','http','test','ValidationError','The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.','request','then','info','OpenchannelMessage,\x20%s,\x20%s','request\x20sent','OpenchannelMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','status','end','json','count','offset','limit','set','Content-Range','apply','reject','save','update','destroy','sendStatus','stack','name','send','index','map','fieldName','key','keys','query','filters','intersection','model','attributes','fields','length','nolimit','order','sort','where','type','VIRTUAL','filter','merge','options','includeAll','include','OpenchannelMessage','rows','show','params','find','create','body','describe','accept','openchannel','format','YYYY-MM-DD\x20HH:mm:ss','UserId','user','CmContact','OpenchannelInteraction','OpenchannelInteractionId','isNil','interaction','get','[OPENCHANNELMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','null','AcceptMessage','acceptMessage','manual','SIP/%s','channel','event','EventManager','acceptmessage','openchannel-interactions','agent','RejectMessage'];(function(_0xbf8ebe,_0x3b69a5){var _0x1e25e8=function(_0x40c390){while(--_0x40c390){_0xbf8ebe['push'](_0xbf8ebe['shift']());}};_0x1e25e8(++_0x3b69a5);}(_0xd7a2,0x1df));var _0x2d7a=function(_0x130b0d,_0x1bea18){_0x130b0d=_0x130b0d-0x0;var _0x2d17a5=_0xd7a2[_0x130b0d];return _0x2d17a5;};'use strict';var pdf=require(_0x2d7a('0x0'));var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x2d7a('0x1'));var jsonpatch=require(_0x2d7a('0x2'));var rp=require(_0x2d7a('0x3'));var moment=require('moment');var BPromise=require(_0x2d7a('0x4'));var Mustache=require(_0x2d7a('0x5'));var util=require(_0x2d7a('0x6'));var path=require(_0x2d7a('0x7'));var sox=require(_0x2d7a('0x8'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var _=require(_0x2d7a('0x9'));var squel=require(_0x2d7a('0xa'));var crypto=require(_0x2d7a('0xb'));var jsforce=require('jsforce');var deskjs=require(_0x2d7a('0xc'));var toCsv=require('to-csv');var querystring=require(_0x2d7a('0xd'));var Papa=require(_0x2d7a('0xe'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x2d7a('0xf'));var as=require(_0x2d7a('0x10'));var hardwareService=require(_0x2d7a('0x11'));var logger=require(_0x2d7a('0x12'))(_0x2d7a('0x13'));var utils=require('../../config/utils');var config=require('../../config/environment');var db=require(_0x2d7a('0x14'))['db'];config[_0x2d7a('0x15')]=_[_0x2d7a('0x16')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0x2d7a('0x17'))(new Redis(config[_0x2d7a('0x15')]));require(_0x2d7a('0x18'))['register'](socket);var jayson=require(_0x2d7a('0x19'));var client=jayson[_0x2d7a('0x1a')][_0x2d7a('0x1b')]({'port':0x232c});var client9002=jayson[_0x2d7a('0x1a')][_0x2d7a('0x1b')]({'port':0x232a});function checkPasswordPattern(_0x52458a,_0x337877,_0x13d6cd){if(_0x13d6cd){var _0x3624bf=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x3624bf[_0x2d7a('0x1c')](_0x337877)){return _0x52458a;}else{throw new db['Sequelize'][(_0x2d7a('0x1d'))](_0x2d7a('0x1e'));}}else{return _0x52458a;}}function respondWithRpcPromise(_0x36302f,_0x4cff04,_0x220e63,_0x226523){return new BPromise(function(_0x376f18,_0x175b34){var _0x1bb2c2=_0x226523||client;return _0x1bb2c2[_0x2d7a('0x1f')](_0x36302f,_0x220e63)[_0x2d7a('0x20')](function(_0x274c4d){logger[_0x2d7a('0x21')](_0x2d7a('0x22'),_0x4cff04,_0x2d7a('0x23'));logger['debug'](_0x2d7a('0x24'),_0x4cff04,_0x2d7a('0x23'),JSON[_0x2d7a('0x25')](_0x274c4d));if(_0x274c4d['error']){if(_0x274c4d[_0x2d7a('0x26')][_0x2d7a('0x27')]===0x1f4){logger[_0x2d7a('0x26')]('OpenchannelMessage,\x20%s,\x20%s',_0x4cff04,_0x274c4d['error'][_0x2d7a('0x28')]);return _0x175b34(_0x274c4d['error']['message']);}logger[_0x2d7a('0x26')](_0x2d7a('0x22'),_0x4cff04,_0x274c4d['error'][_0x2d7a('0x28')]);return _0x376f18(_0x274c4d[_0x2d7a('0x26')]['message']);}else{logger[_0x2d7a('0x21')](_0x2d7a('0x22'),_0x4cff04,_0x2d7a('0x23'));_0x376f18(_0x274c4d[_0x2d7a('0x29')][_0x2d7a('0x28')]);}})[_0x2d7a('0x2a')](function(_0x107600){logger[_0x2d7a('0x26')](_0x2d7a('0x22'),_0x4cff04,_0x107600);_0x175b34(_0x107600);});});}function respondWithStatusCode(_0x412c8a,_0x18ee5e){_0x18ee5e=_0x18ee5e||0xcc;return function(_0x2f9d34){if(_0x2f9d34){return _0x412c8a['sendStatus'](_0x18ee5e);}return _0x412c8a[_0x2d7a('0x2b')](_0x18ee5e)[_0x2d7a('0x2c')]();};}function respondWithResult(_0x56a96c,_0x15ac98){_0x15ac98=_0x15ac98||0xc8;return function(_0xe937ff){if(_0xe937ff){return _0x56a96c[_0x2d7a('0x2b')](_0x15ac98)[_0x2d7a('0x2d')](_0xe937ff);}};}function respondWithFilteredResult(_0x13121c,_0x4de406){return function(_0x13ce9a){if(_0x13ce9a){var _0x18ba7f=_0x13ce9a[_0x2d7a('0x2e')],_0x1648d9=_0x4de406[_0x2d7a('0x2f')],_0x121be5=_0x4de406[_0x2d7a('0x2f')]+_0x4de406[_0x2d7a('0x30')],_0x1a88a2;if(_0x121be5>=_0x18ba7f){_0x121be5=_0x18ba7f;_0x1a88a2=0xc8;}else{_0x1a88a2=0xce;}_0x13121c[_0x2d7a('0x2b')](_0x1a88a2);return _0x13121c[_0x2d7a('0x31')](_0x2d7a('0x32'),_0x1648d9+'-'+_0x121be5+'/'+_0x18ba7f)[_0x2d7a('0x2d')](_0x13ce9a);}return null;};}function patchUpdates(_0x3aee01){return function(_0x38aeb1){try{jsonpatch[_0x2d7a('0x33')](_0x38aeb1,_0x3aee01,!![]);}catch(_0x152745){return BPromise[_0x2d7a('0x34')](_0x152745);}return _0x38aeb1[_0x2d7a('0x35')]();};}function saveUpdates(_0x4f110c,_0x4fa280){return function(_0x1246b7){if(_0x1246b7){return _0x1246b7[_0x2d7a('0x36')](_0x4f110c)['then'](function(_0x54566b){return _0x54566b;});}return null;};}function removeEntity(_0x2de8be,_0x235f03){return function(_0x3de66b){if(_0x3de66b){return _0x3de66b[_0x2d7a('0x37')]()['then'](function(){_0x2de8be[_0x2d7a('0x2b')](0xcc)['end']();});}};}function handleEntityNotFound(_0x1dcd76,_0x194168){return function(_0x1eb604){if(!_0x1eb604){_0x1dcd76[_0x2d7a('0x38')](0x194);}return _0x1eb604;};}function handleError(_0x1754d6,_0xb131e){_0xb131e=_0xb131e||0x1f4;return function(_0x55b271){logger[_0x2d7a('0x26')](_0x55b271[_0x2d7a('0x39')]);if(_0x55b271['name']){delete _0x55b271[_0x2d7a('0x3a')];}_0x1754d6[_0x2d7a('0x2b')](_0xb131e)[_0x2d7a('0x3b')](_0x55b271);};}exports[_0x2d7a('0x3c')]=function(_0x54df6b,_0x49c27c){var _0x18ac3c={},_0x727789={},_0x384ec6={'count':0x0,'rows':[]};var _0xb96ad7=_[_0x2d7a('0x3d')](db['OpenchannelMessage']['rawAttributes'],function(_0x1338af){return{'name':_0x1338af[_0x2d7a('0x3e')],'type':_0x1338af['type'][_0x2d7a('0x3f')]};});_0x727789['model']=_[_0x2d7a('0x3d')](_0xb96ad7,'name');_0x727789['query']=_[_0x2d7a('0x40')](_0x54df6b[_0x2d7a('0x41')]);_0x727789[_0x2d7a('0x42')]=_[_0x2d7a('0x43')](_0x727789[_0x2d7a('0x44')],_0x727789['query']);_0x18ac3c[_0x2d7a('0x45')]=_[_0x2d7a('0x43')](_0x727789[_0x2d7a('0x44')],qs[_0x2d7a('0x46')](_0x54df6b[_0x2d7a('0x41')][_0x2d7a('0x46')]));_0x18ac3c[_0x2d7a('0x45')]=_0x18ac3c[_0x2d7a('0x45')][_0x2d7a('0x47')]?_0x18ac3c[_0x2d7a('0x45')]:_0x727789[_0x2d7a('0x44')];if(!_0x54df6b[_0x2d7a('0x41')]['hasOwnProperty'](_0x2d7a('0x48'))){_0x18ac3c[_0x2d7a('0x30')]=qs[_0x2d7a('0x30')](_0x54df6b[_0x2d7a('0x41')][_0x2d7a('0x30')]);_0x18ac3c['offset']=qs[_0x2d7a('0x2f')](_0x54df6b[_0x2d7a('0x41')][_0x2d7a('0x2f')]);}_0x18ac3c[_0x2d7a('0x49')]=qs[_0x2d7a('0x4a')](_0x54df6b['query']['sort']);_0x18ac3c[_0x2d7a('0x4b')]=qs[_0x2d7a('0x42')](_['pick'](_0x54df6b[_0x2d7a('0x41')],_0x727789[_0x2d7a('0x42')]));if(_0x54df6b['query']['filter']){_0x18ac3c[_0x2d7a('0x4b')]=_['merge'](_0x18ac3c[_0x2d7a('0x4b')],{'$or':_[_0x2d7a('0x3d')](_0xb96ad7,function(_0x28eebf){if(_0x28eebf[_0x2d7a('0x4c')]!==_0x2d7a('0x4d')){var _0x1dcfc9={};_0x1dcfc9[_0x28eebf[_0x2d7a('0x3a')]]={'$like':'%'+_0x54df6b[_0x2d7a('0x41')][_0x2d7a('0x4e')]+'%'};return _0x1dcfc9;}})});}_0x18ac3c=_[_0x2d7a('0x4f')]({},_0x18ac3c,_0x54df6b[_0x2d7a('0x50')]);var _0xa95912={'where':_0x18ac3c[_0x2d7a('0x4b')]};return db['OpenchannelMessage'][_0x2d7a('0x2e')](_0xa95912)[_0x2d7a('0x20')](function(_0x20f6de){_0x384ec6[_0x2d7a('0x2e')]=_0x20f6de;if(_0x54df6b[_0x2d7a('0x41')][_0x2d7a('0x51')]){_0x18ac3c[_0x2d7a('0x52')]=[{'all':!![]}];}return db[_0x2d7a('0x53')]['findAll'](_0x18ac3c);})[_0x2d7a('0x20')](function(_0x24b4f1){_0x384ec6[_0x2d7a('0x54')]=_0x24b4f1;return _0x384ec6;})['then'](respondWithFilteredResult(_0x49c27c,_0x18ac3c))[_0x2d7a('0x2a')](handleError(_0x49c27c,null));};exports[_0x2d7a('0x55')]=function(_0x3f6c39,_0x11f669){var _0x5f1756={'raw':!![],'where':{'id':_0x3f6c39[_0x2d7a('0x56')]['id']}},_0x279eb7={};_0x279eb7[_0x2d7a('0x44')]=_['keys'](db['OpenchannelMessage']['rawAttributes']);_0x279eb7['query']=_[_0x2d7a('0x40')](_0x3f6c39['query']);_0x279eb7[_0x2d7a('0x42')]=_[_0x2d7a('0x43')](_0x279eb7[_0x2d7a('0x44')],_0x279eb7['query']);_0x5f1756['attributes']=_[_0x2d7a('0x43')](_0x279eb7[_0x2d7a('0x44')],qs[_0x2d7a('0x46')](_0x3f6c39[_0x2d7a('0x41')][_0x2d7a('0x46')]));_0x5f1756['attributes']=_0x5f1756['attributes'][_0x2d7a('0x47')]?_0x5f1756[_0x2d7a('0x45')]:_0x279eb7[_0x2d7a('0x44')];if(_0x3f6c39['query'][_0x2d7a('0x51')]){_0x5f1756[_0x2d7a('0x52')]=[{'all':!![]}];}_0x5f1756=_['merge']({},_0x5f1756,_0x3f6c39[_0x2d7a('0x50')]);return db[_0x2d7a('0x53')][_0x2d7a('0x57')](_0x5f1756)['then'](handleEntityNotFound(_0x11f669,null))[_0x2d7a('0x20')](respondWithResult(_0x11f669,null))['catch'](handleError(_0x11f669,null));};exports['create']=function(_0x19b2a9,_0x4020b6){return db[_0x2d7a('0x53')][_0x2d7a('0x58')](_0x19b2a9[_0x2d7a('0x59')],{})[_0x2d7a('0x20')](respondWithResult(_0x4020b6,0xc9))['catch'](handleError(_0x4020b6,null));};exports[_0x2d7a('0x36')]=function(_0x4f6b58,_0x5f02fc){if(_0x4f6b58[_0x2d7a('0x59')]['id']){delete _0x4f6b58[_0x2d7a('0x59')]['id'];}return db[_0x2d7a('0x53')][_0x2d7a('0x57')]({'where':{'id':_0x4f6b58[_0x2d7a('0x56')]['id']}})[_0x2d7a('0x20')](handleEntityNotFound(_0x5f02fc,null))[_0x2d7a('0x20')](saveUpdates(_0x4f6b58[_0x2d7a('0x59')],null))[_0x2d7a('0x20')](respondWithResult(_0x5f02fc,null))['catch'](handleError(_0x5f02fc,null));};exports[_0x2d7a('0x37')]=function(_0x6cd068,_0x492a3f){return db[_0x2d7a('0x53')][_0x2d7a('0x57')]({'where':{'id':_0x6cd068[_0x2d7a('0x56')]['id']}})[_0x2d7a('0x20')](handleEntityNotFound(_0x492a3f,null))[_0x2d7a('0x20')](removeEntity(_0x492a3f,null))[_0x2d7a('0x2a')](handleError(_0x492a3f,null));};exports[_0x2d7a('0x5a')]=function(_0x5e8582,_0x457c41){return db[_0x2d7a('0x53')][_0x2d7a('0x5a')]()[_0x2d7a('0x20')](respondWithResult(_0x457c41,null))['catch'](handleError(_0x457c41,null));};var interaction_log=require(_0x2d7a('0x12'))('openchannel-interactions');exports[_0x2d7a('0x5b')]=function(_0x4d8874,_0x4b5639,_0x1bfe22){var _0x45c5c2={'channel':_0x2d7a('0x5c')};if(_0x4d8874[_0x2d7a('0x59')]['id']){delete _0x4d8874[_0x2d7a('0x59')]['id'];}_0x4d8874['body']['read']=!![];_0x4d8874[_0x2d7a('0x59')]['readAt']=moment()[_0x2d7a('0x5d')](_0x2d7a('0x5e'));_0x4d8874[_0x2d7a('0x59')][_0x2d7a('0x5f')]=_0x4d8874[_0x2d7a('0x59')][_0x2d7a('0x5f')]||_0x4d8874[_0x2d7a('0x60')]['id'];return db[_0x2d7a('0x53')]['find']({'where':{'id':_0x4d8874['params']['id'],'UserId':null},'include':[{'model':db[_0x2d7a('0x61')],'as':'Contact'}]})['then'](handleEntityNotFound(_0x4b5639,null))[_0x2d7a('0x20')](saveUpdates(_0x4d8874[_0x2d7a('0x59')],null))[_0x2d7a('0x20')](function(_0x28d5c2){if(_0x28d5c2){_0x45c5c2['message']=_0x28d5c2['get']({'plain':!![]});return db[_0x2d7a('0x62')][_0x2d7a('0x57')]({'where':{'id':_0x28d5c2[_0x2d7a('0x63')]}});}return null;})[_0x2d7a('0x20')](handleEntityNotFound(_0x4b5639,null))[_0x2d7a('0x20')](function(_0x52df22){if(_0x52df22){return _0x52df22[_0x2d7a('0x36')]({'UserId':_0x4d8874[_0x2d7a('0x59')][_0x2d7a('0x5f')],'read1stAt':_[_0x2d7a('0x64')](_0x52df22['read1stAt'])?moment()[_0x2d7a('0x5d')](_0x2d7a('0x5e')):undefined});}return null;})[_0x2d7a('0x20')](function(_0x52f0d0){if(_0x52f0d0){_0x45c5c2[_0x2d7a('0x65')]=_0x52f0d0[_0x2d7a('0x66')]({'plain':!![]});interaction_log[_0x2d7a('0x21')](_0x2d7a('0x67'),_0x4d8874[_0x2d7a('0x60')]['id'],_0x4d8874[_0x2d7a('0x60')][_0x2d7a('0x3a')],_0x4d8874[_0x2d7a('0x60')]['role'],_0x45c5c2[_0x2d7a('0x65')]['id'],_0x4d8874[_0x2d7a('0x59')]?JSON['stringify'](_0x4d8874[_0x2d7a('0x59')]):_0x2d7a('0x68'));return respondWithRpcPromise(_0x2d7a('0x69'),_0x2d7a('0x6a'),_0x45c5c2);}return null;})[_0x2d7a('0x20')](function(_0xca51be){if(_0xca51be){if(_0x4d8874[_0x2d7a('0x59')][_0x2d7a('0x6b')]){_0x45c5c2[_0x2d7a('0x28')]['interface']=util[_0x2d7a('0x5d')](_0x2d7a('0x6c'),_0x4d8874[_0x2d7a('0x60')][_0x2d7a('0x3a')]);_0x45c5c2[_0x2d7a('0x28')][_0x2d7a('0x6d')]=_0x45c5c2[_0x2d7a('0x6d')];_0x45c5c2[_0x2d7a('0x28')][_0x2d7a('0x6e')]=_0x2d7a('0x5b');return respondWithRpcPromise(_0x2d7a('0x6f'),_0x2d7a('0x6f'),{'event':_0x2d7a('0x70'),'message':_0x45c5c2[_0x2d7a('0x28')]},client9002)[_0x2d7a('0x20')](function(){return _0x45c5c2;});}return _0x45c5c2;}return null;})[_0x2d7a('0x20')](respondWithResult(_0x4b5639,null))[_0x2d7a('0x2a')](handleError(_0x4b5639,null));};var interaction_log=require('../../config/logger')(_0x2d7a('0x71'));exports[_0x2d7a('0x34')]=function(_0x2f6a1e,_0x1d7e78,_0x444f47){var _0x128d34={'agent':{},'channel':'openchannel'};if(_0x2f6a1e['body']['id']){delete _0x2f6a1e[_0x2d7a('0x59')]['id'];}_0x2f6a1e[_0x2d7a('0x59')][_0x2d7a('0x5f')]=_0x2f6a1e[_0x2d7a('0x59')][_0x2d7a('0x5f')]||_0x2f6a1e[_0x2d7a('0x60')]['id'];_0x128d34[_0x2d7a('0x72')]['id']=_0x2f6a1e[_0x2d7a('0x59')]['UserId'];return db[_0x2d7a('0x53')][_0x2d7a('0x57')]({'where':{'id':_0x2f6a1e[_0x2d7a('0x56')]['id'],'UserId':null}})[_0x2d7a('0x20')](handleEntityNotFound(_0x1d7e78,null))[_0x2d7a('0x20')](function(_0x5c5e4f){if(_0x5c5e4f){_0x128d34[_0x2d7a('0x28')]=_0x5c5e4f[_0x2d7a('0x66')]({'plain':!![]});return db[_0x2d7a('0x62')]['find']({'where':{'id':_0x5c5e4f[_0x2d7a('0x63')]}});}return null;})[_0x2d7a('0x20')](handleEntityNotFound(_0x1d7e78,null))[_0x2d7a('0x20')](function(_0x5b4677){if(_0x5b4677){_0x128d34[_0x2d7a('0x65')]=_0x5b4677[_0x2d7a('0x66')]({'plain':!![]});interaction_log['info']('[OPENCHANNELMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s',_0x2f6a1e[_0x2d7a('0x60')]['id'],_0x2f6a1e['user'][_0x2d7a('0x3a')],_0x2f6a1e[_0x2d7a('0x60')]['role'],_0x128d34[_0x2d7a('0x65')]['id'],_0x2f6a1e['body']?JSON[_0x2d7a('0x25')](_0x2f6a1e[_0x2d7a('0x59')]):'null');return respondWithRpcPromise(_0x2d7a('0x73'),_0x2d7a('0x74'),_0x128d34);}return null;})['then'](function(_0x481ac5){if(_0x481ac5){_0x481ac5[_0x2d7a('0x28')][_0x2d7a('0x75')]=util[_0x2d7a('0x5d')](_0x2d7a('0x6c'),_0x2f6a1e['user']['name']);_0x481ac5[_0x2d7a('0x28')][_0x2d7a('0x6d')]=_0x128d34[_0x2d7a('0x6d')];_0x481ac5[_0x2d7a('0x28')][_0x2d7a('0x6e')]=_0x2d7a('0x34');respondWithRpcPromise(_0x2d7a('0x6f'),_0x2d7a('0x6f'),{'event':_0x2d7a('0x76'),'message':_0x481ac5['message']},client9002);return _0x128d34;}return null;})[_0x2d7a('0x20')](respondWithResult(_0x1d7e78,null))[_0x2d7a('0x2a')](handleError(_0x1d7e78,null));}; \ No newline at end of file diff --git a/server/api/openchannelMessage/openchannelMessage.events.js b/server/api/openchannelMessage/openchannelMessage.events.js index b124584..abb8cd6 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 _0x2d25=['save','update','emit','hasOwnProperty','hook','exports','events','../../mysqldb','OpenchannelMessage','setMaxListeners'];(function(_0x127ac5,_0x44205c){var _0x1dac10=function(_0x14169e){while(--_0x14169e){_0x127ac5['push'](_0x127ac5['shift']());}};_0x1dac10(++_0x44205c);}(_0x2d25,0x7e));var _0x52d2=function(_0x475a53,_0x3546ae){_0x475a53=_0x475a53-0x0;var _0x506216=_0x2d25[_0x475a53];return _0x506216;};'use strict';var EventEmitter=require(_0x52d2('0x0'));var OpenchannelMessage=require(_0x52d2('0x1'))['db'][_0x52d2('0x2')];var OpenchannelMessageEvents=new EventEmitter();OpenchannelMessageEvents[_0x52d2('0x3')](0x0);var events={'afterCreate':_0x52d2('0x4'),'afterUpdate':_0x52d2('0x5'),'afterDestroy':'remove'};function emitEvent(_0x308e06){return function(_0xb72c30,_0x401d5e,_0x522562){OpenchannelMessageEvents[_0x52d2('0x6')](_0x308e06+':'+_0xb72c30['id'],_0xb72c30);OpenchannelMessageEvents['emit'](_0x308e06,_0xb72c30);_0x522562(null);};}for(var e in events){if(events[_0x52d2('0x7')](e)){var event=events[e];OpenchannelMessage[_0x52d2('0x8')](e,emitEvent(event));}}module[_0x52d2('0x9')]=OpenchannelMessageEvents; \ No newline at end of file +var _0xcab9=['save','update','remove','emit','hasOwnProperty','hook','exports','../../mysqldb','OpenchannelMessage','setMaxListeners'];(function(_0x1ac595,_0x5d2081){var _0x455fff=function(_0x3043ee){while(--_0x3043ee){_0x1ac595['push'](_0x1ac595['shift']());}};_0x455fff(++_0x5d2081);}(_0xcab9,0x1d3));var _0x9cab=function(_0x9bca53,_0x59b4f8){_0x9bca53=_0x9bca53-0x0;var _0x3894bc=_0xcab9[_0x9bca53];return _0x3894bc;};'use strict';var EventEmitter=require('events');var OpenchannelMessage=require(_0x9cab('0x0'))['db'][_0x9cab('0x1')];var OpenchannelMessageEvents=new EventEmitter();OpenchannelMessageEvents[_0x9cab('0x2')](0x0);var events={'afterCreate':_0x9cab('0x3'),'afterUpdate':_0x9cab('0x4'),'afterDestroy':_0x9cab('0x5')};function emitEvent(_0x43483f){return function(_0x38d761,_0x2f75c0,_0x2c8a46){OpenchannelMessageEvents[_0x9cab('0x6')](_0x43483f+':'+_0x38d761['id'],_0x38d761);OpenchannelMessageEvents[_0x9cab('0x6')](_0x43483f,_0x38d761);_0x2c8a46(null);};}for(var e in events){if(events[_0x9cab('0x7')](e)){var event=events[e];OpenchannelMessage[_0x9cab('0x8')](e,emitEvent(event));}}module[_0x9cab('0x9')]=OpenchannelMessageEvents; \ No newline at end of file diff --git a/server/api/openchannelMessage/openchannelMessage.model.js b/server/api/openchannelMessage/openchannelMessage.model.js index bcb933a..4785291 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 _0xc73e=['OpenchannelInteractionId','CmContact','Contact','keys','OpenchannelMessage,\x20%s,\x20%s','afterCreate','format','replyUri','length','Interaction','omit','POST','method','GET','info','Message\x20%d\x20forwarded\x20to\x20%s','threadId','error','inspect','finally','utf8mb4','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','exports','define','OpenchannelMessage','openchannel_messages','fti_openchannel_messages','body','FULLTEXT','models','get','direction','toLowerCase','secret','isNil','UserId','OpenchannelInteraction','findOne','then','update','createdAt','catch','out','describe','OpenchannelAccount','find','OpenchannelAccountId','Interactions'];(function(_0x48cc02,_0x4abc9b){var _0x2c038d=function(_0x19a72c){while(--_0x19a72c){_0x48cc02['push'](_0x48cc02['shift']());}};_0x2c038d(++_0x4abc9b);}(_0xc73e,0x165));var _0xec73=function(_0x450293,_0x3e96af){_0x450293=_0x450293-0x0;var _0x2f01df=_0xc73e[_0x450293];return _0x2f01df;};'use strict';var _=require(_0xec73('0x0'));var util=require(_0xec73('0x1'));var logger=require(_0xec73('0x2'))(_0xec73('0x3'));var moment=require(_0xec73('0x4'));var BPromise=require(_0xec73('0x5'));var rp=require(_0xec73('0x6'));var fs=require('fs');var path=require(_0xec73('0x7'));var rimraf=require(_0xec73('0x8'));var config=require('../../config/environment');var attributes=require('./openchannelMessage.attributes');module[_0xec73('0x9')]=function(_0x526acf,_0xb23cc6){return _0x526acf[_0xec73('0xa')](_0xec73('0xb'),attributes,{'tableName':_0xec73('0xc'),'paranoid':![],'indexes':[{'name':_0xec73('0xd'),'fields':[_0xec73('0xe')],'type':_0xec73('0xf')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x3ce823,_0x21b69c,_0x45a7e8){var _0x381a3c=_0x526acf[_0xec73('0x10')];var _0x4c403f=_0x3ce823[_0xec73('0x11')]({'plain':!![]});if(_0x4c403f[_0xec73('0x12')][_0xec73('0x13')]()==='in'||_0x4c403f[_0xec73('0x12')][_0xec73('0x13')]()==='out'&&!_0x4c403f[_0xec73('0x14')]&&!_[_0xec73('0x15')](_0x4c403f[_0xec73('0x16')])){_0x381a3c[_0xec73('0x17')][_0xec73('0x18')]({'where':{'id':_0x4c403f['OpenchannelInteractionId']}})[_0xec73('0x19')](function(_0x2d2483){if(_0x2d2483){_0x2d2483[_0xec73('0x1a')]({'lastMsgAt':_0x4c403f[_0xec73('0x1b')],'lastMsgDirection':_0x4c403f[_0xec73('0x12')][_0xec73('0x13')]()});}})[_0xec73('0x1c')](function(_0x2c3fa1){console['error'](_0x2c3fa1);});}if(_0x4c403f[_0xec73('0x12')]===_0xec73('0x1d')&&!_0x4c403f[_0xec73('0x14')]){var _0x11d709;_0x381a3c['CmContact'][_0xec73('0x1e')]()[_0xec73('0x19')](function(_0x4318d6){return _0x381a3c[_0xec73('0x1f')][_0xec73('0x20')]({'where':{'id':_0x4c403f[_0xec73('0x21')]},'include':[{'model':_0x381a3c[_0xec73('0x17')],'as':_0xec73('0x22'),'where':{'id':_0x4c403f[_0xec73('0x23')]},'limit':0x1,'include':[{'model':_0x381a3c[_0xec73('0x24')],'as':_0xec73('0x25'),'attributes':_[_0xec73('0x26')](_0x4318d6)}]}]});})[_0xec73('0x19')](function(_0x258f2b){_0x11d709=_0x258f2b[_0xec73('0x11')]({'plain':!![]});if(_0x11d709&&_0x11d709['replyUri']){logger['info'](_0xec73('0x27'),_0xec73('0x28'),util[_0xec73('0x29')]('Forwarding\x20message\x20%d\x20to\x20%s',_0x4c403f['id'],_0x11d709[_0xec73('0x2a')]));if(_0x11d709['Interactions']&&_0x11d709['Interactions'][_0xec73('0x2b')]){_0x4c403f[_0xec73('0x2c')]=_[_0xec73('0x2d')](_0x11d709[_0xec73('0x22')][0x0],_0xec73('0x25'));_0x4c403f[_0xec73('0x25')]=_0x11d709[_0xec73('0x22')][0x0][_0xec73('0x25')];}var _0x21b69c={'method':_0xec73('0x2e'),'uri':encodeURI(_0x11d709[_0xec73('0x2a')]),'json':!![],'resolveWithFullResponse':!![]};switch(_0x21b69c[_0xec73('0x2f')]){case _0xec73('0x30'):_0x21b69c['qs']=_0x4c403f;break;case _0xec73('0x2e'):_0x21b69c['body']=_0x4c403f;break;}return rp(_0x21b69c)['then'](function(_0x36905b){logger[_0xec73('0x31')](_0xec73('0x27'),_0xec73('0x28'),util[_0xec73('0x29')](_0xec73('0x32'),_0x4c403f['id'],_0x11d709[_0xec73('0x2a')]));if(_0x36905b[_0xec73('0xe')][_0xec73('0x33')]&&_0x36905b[_0xec73('0xe')][_0xec73('0x33')]!=_0x4c403f['Interaction'][_0xec73('0x33')]){return _0x381a3c['OpenchannelInteraction'][_0xec73('0x1a')]({'threadId':_0x36905b[_0xec73('0xe')][_0xec73('0x33')]},{'logging':!![],'where':{'id':_0x4c403f[_0xec73('0x2c')]['id']}});}else{return;}})[_0xec73('0x19')](function(){return _0x3ce823['update']({'read':!![]});})[_0xec73('0x1c')](function(_0x207f48){logger[_0xec73('0x34')]('OpenchannelMessage,\x20%s,\x20%s',_0xec73('0x28'),util[_0xec73('0x35')](_0x207f48,{'showHidden':![],'depth':null}));_0x45a7e8();});}else{_0x45a7e8();}})[_0xec73('0x36')](function(){_0x45a7e8();});}else{_0x45a7e8();}}},'charset':_0xec73('0x37'),'collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file +var _0xd484=['OpenchannelMessage,\x20%s,\x20%s','afterCreate','Forwarding\x20message\x20%d\x20to\x20%s','length','Interaction','omit','POST','method','body','format','Message\x20%d\x20forwarded\x20to\x20%s','threadId','update','inspect','utf8mb4','utf8mb4_unicode_ci','lodash','util','../../config/logger','api','moment','request-promise','path','rimraf','../../config/environment','./openchannelMessage.attributes','exports','define','OpenchannelMessage','openchannel_messages','fti_openchannel_messages','FULLTEXT','direction','toLowerCase','out','findOne','OpenchannelInteractionId','then','catch','error','secret','describe','OpenchannelAccount','find','OpenchannelAccountId','OpenchannelInteraction','Interactions','CmContact','Contact','keys','get','replyUri','info'];(function(_0x4a8e6e,_0x5cf07f){var _0x38d1fe=function(_0x1b451c){while(--_0x1b451c){_0x4a8e6e['push'](_0x4a8e6e['shift']());}};_0x38d1fe(++_0x5cf07f);}(_0xd484,0x1ed));var _0x4d48=function(_0x232d81,_0x30d72e){_0x232d81=_0x232d81-0x0;var _0x34cc05=_0xd484[_0x232d81];return _0x34cc05;};'use strict';var _=require(_0x4d48('0x0'));var util=require(_0x4d48('0x1'));var logger=require(_0x4d48('0x2'))(_0x4d48('0x3'));var moment=require(_0x4d48('0x4'));var BPromise=require('bluebird');var rp=require(_0x4d48('0x5'));var fs=require('fs');var path=require(_0x4d48('0x6'));var rimraf=require(_0x4d48('0x7'));var config=require(_0x4d48('0x8'));var attributes=require(_0x4d48('0x9'));module[_0x4d48('0xa')]=function(_0x420848,_0x46e149){return _0x420848[_0x4d48('0xb')](_0x4d48('0xc'),attributes,{'tableName':_0x4d48('0xd'),'paranoid':![],'indexes':[{'name':_0x4d48('0xe'),'fields':['body'],'type':_0x4d48('0xf')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x57f46a,_0xc52bb8,_0x475035){var _0xe23781=_0x420848['models'];var _0x5cbc1f=_0x57f46a['get']({'plain':!![]});if(_0x5cbc1f[_0x4d48('0x10')][_0x4d48('0x11')]()==='in'||_0x5cbc1f['direction'][_0x4d48('0x11')]()===_0x4d48('0x12')&&!_0x5cbc1f['secret']&&!_['isNil'](_0x5cbc1f['UserId'])){_0xe23781['OpenchannelInteraction'][_0x4d48('0x13')]({'where':{'id':_0x5cbc1f[_0x4d48('0x14')]}})[_0x4d48('0x15')](function(_0x158398){if(_0x158398){_0x158398['update']({'lastMsgAt':_0x5cbc1f['createdAt'],'lastMsgDirection':_0x5cbc1f['direction'][_0x4d48('0x11')]()});}})[_0x4d48('0x16')](function(_0xb2cf7d){console[_0x4d48('0x17')](_0xb2cf7d);});}if(_0x5cbc1f[_0x4d48('0x10')]==='out'&&!_0x5cbc1f[_0x4d48('0x18')]){var _0x229cdf;_0xe23781['CmContact'][_0x4d48('0x19')]()['then'](function(_0x147d68){return _0xe23781[_0x4d48('0x1a')][_0x4d48('0x1b')]({'where':{'id':_0x5cbc1f[_0x4d48('0x1c')]},'include':[{'model':_0xe23781[_0x4d48('0x1d')],'as':_0x4d48('0x1e'),'where':{'id':_0x5cbc1f[_0x4d48('0x14')]},'limit':0x1,'include':[{'model':_0xe23781[_0x4d48('0x1f')],'as':_0x4d48('0x20'),'attributes':_[_0x4d48('0x21')](_0x147d68)}]}]});})[_0x4d48('0x15')](function(_0x4eb3d1){_0x229cdf=_0x4eb3d1[_0x4d48('0x22')]({'plain':!![]});if(_0x229cdf&&_0x229cdf[_0x4d48('0x23')]){logger[_0x4d48('0x24')](_0x4d48('0x25'),_0x4d48('0x26'),util['format'](_0x4d48('0x27'),_0x5cbc1f['id'],_0x229cdf[_0x4d48('0x23')]));if(_0x229cdf[_0x4d48('0x1e')]&&_0x229cdf[_0x4d48('0x1e')][_0x4d48('0x28')]){_0x5cbc1f[_0x4d48('0x29')]=_[_0x4d48('0x2a')](_0x229cdf[_0x4d48('0x1e')][0x0],'Contact');_0x5cbc1f['Contact']=_0x229cdf[_0x4d48('0x1e')][0x0][_0x4d48('0x20')];}var _0xc52bb8={'method':_0x4d48('0x2b'),'uri':encodeURI(_0x229cdf[_0x4d48('0x23')]),'json':!![],'resolveWithFullResponse':!![]};switch(_0xc52bb8[_0x4d48('0x2c')]){case'GET':_0xc52bb8['qs']=_0x5cbc1f;break;case _0x4d48('0x2b'):_0xc52bb8[_0x4d48('0x2d')]=_0x5cbc1f;break;}return rp(_0xc52bb8)[_0x4d48('0x15')](function(_0x4ef620){logger[_0x4d48('0x24')]('OpenchannelMessage,\x20%s,\x20%s',_0x4d48('0x26'),util[_0x4d48('0x2e')](_0x4d48('0x2f'),_0x5cbc1f['id'],_0x229cdf[_0x4d48('0x23')]));if(_0x4ef620['body']['threadId']&&_0x4ef620[_0x4d48('0x2d')][_0x4d48('0x30')]!=_0x5cbc1f[_0x4d48('0x29')][_0x4d48('0x30')]){return _0xe23781[_0x4d48('0x1d')]['update']({'threadId':_0x4ef620[_0x4d48('0x2d')][_0x4d48('0x30')]},{'logging':!![],'where':{'id':_0x5cbc1f[_0x4d48('0x29')]['id']}});}else{return;}})[_0x4d48('0x15')](function(){return _0x57f46a[_0x4d48('0x31')]({'read':!![]});})[_0x4d48('0x16')](function(_0x1208e2){logger[_0x4d48('0x17')](_0x4d48('0x25'),_0x4d48('0x26'),util[_0x4d48('0x32')](_0x1208e2,{'showHidden':![],'depth':null}));_0x475035();});}else{_0x475035();}})['finally'](function(){_0x475035();});}else{_0x475035();}}},'charset':_0x4d48('0x33'),'collate':_0x4d48('0x34')});}; \ No newline at end of file diff --git a/server/api/openchannelMessage/openchannelMessage.rpc.js b/server/api/openchannelMessage/openchannelMessage.rpc.js index 7919bf9..4d3d367 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 _0xd69e=['CreateOpenchannelMessage','OpenchannelMessage','create','options','lodash','util','moment','randomstring','ioredis','../../config/environment','http','redis','defaults','socket.io-emitter','./openchannelMessage.socket','register','then','OpenchannelMessage,\x20%s,\x20%s','debug','OpenchannelMessage,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','info','catch'];(function(_0x416cdc,_0x213b87){var _0x1931ce=function(_0x1dc762){while(--_0x1dc762){_0x416cdc['push'](_0x416cdc['shift']());}};_0x1931ce(++_0x213b87);}(_0xd69e,0xa0));var _0xed69=function(_0x36eaaa,_0x326732){_0x36eaaa=_0x36eaaa-0x0;var _0x461349=_0xd69e[_0x36eaaa];return _0x461349;};'use strict';var _=require(_0xed69('0x0'));var util=require(_0xed69('0x1'));var moment=require(_0xed69('0x2'));var BPromise=require('bluebird');var rs=require(_0xed69('0x3'));var fs=require('fs');var Redis=require(_0xed69('0x4'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')('rpc');var config=require(_0xed69('0x5'));var jayson=require('jayson/promise');var client=jayson['client'][_0xed69('0x6')]({'port':0x232a});config[_0xed69('0x7')]=_[_0xed69('0x8')](config[_0xed69('0x7')],{'host':'localhost','port':0x18eb});var socket=require(_0xed69('0x9'))(new Redis(config['redis']));require(_0xed69('0xa'))[_0xed69('0xb')](socket);function respondWithRpcPromise(_0x47da53,_0x2dc08a,_0x1eb1f8){return new BPromise(function(_0x4ebc85,_0x51e609){return client['request'](_0x47da53,_0x1eb1f8)[_0xed69('0xc')](function(_0x218c3c){logger['info'](_0xed69('0xd'),_0x2dc08a,'request\x20sent');logger[_0xed69('0xe')](_0xed69('0xf'),_0x2dc08a,_0xed69('0x10'),JSON['stringify'](_0x218c3c));if(_0x218c3c['error']){if(_0x218c3c[_0xed69('0x11')][_0xed69('0x12')]===0x1f4){logger[_0xed69('0x11')](_0xed69('0xd'),_0x2dc08a,_0x218c3c[_0xed69('0x11')]['message']);return _0x51e609(_0x218c3c[_0xed69('0x11')][_0xed69('0x13')]);}logger[_0xed69('0x11')](_0xed69('0xd'),_0x2dc08a,_0x218c3c[_0xed69('0x11')][_0xed69('0x13')]);return _0x4ebc85(_0x218c3c[_0xed69('0x11')][_0xed69('0x13')]);}else{logger[_0xed69('0x14')](_0xed69('0xd'),_0x2dc08a,'request\x20sent');_0x4ebc85(_0x218c3c['result']['message']);}})[_0xed69('0x15')](function(_0x2cd704){logger[_0xed69('0x11')]('OpenchannelMessage,\x20%s,\x20%s',_0x2dc08a,_0x2cd704);_0x51e609(_0x2cd704);});});}exports[_0xed69('0x16')]=function(_0x11c1fc){var _0x589f07=this;return new Promise(function(_0x3ed869,_0x10285d){return db[_0xed69('0x17')][_0xed69('0x18')](_0x11c1fc['body'],{'raw':_0x11c1fc[_0xed69('0x19')]?_0x11c1fc[_0xed69('0x19')]['raw']===undefined?!![]:![]:!![]})[_0xed69('0xc')](function(_0x350f01){logger[_0xed69('0x14')](_0xed69('0x16'),_0x11c1fc);logger[_0xed69('0xe')](_0xed69('0x16'),_0x11c1fc,JSON['stringify'](_0x350f01));_0x3ed869(_0x350f01);})[_0xed69('0x15')](function(_0x91b170){logger[_0xed69('0x11')](_0xed69('0x16'),_0x91b170[_0xed69('0x13')],_0x11c1fc);_0x10285d(_0x589f07[_0xed69('0x11')](0x1f4,_0x91b170[_0xed69('0x13')]));});});}; \ No newline at end of file +var _0x9134=['redis','defaults','socket.io-emitter','request','then','OpenchannelMessage,\x20%s,\x20%s','debug','request\x20sent','stringify','error','code','message','OpenchannelMessage','body','options','raw','info','catch','CreateOpenchannelMessage','util','moment','bluebird','randomstring','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client'];(function(_0x4c5741,_0x3e4f5a){var _0x17aac5=function(_0x21fd25){while(--_0x21fd25){_0x4c5741['push'](_0x4c5741['shift']());}};_0x17aac5(++_0x3e4f5a);}(_0x9134,0x87));var _0x4913=function(_0x2dafbe,_0x5d04de){_0x2dafbe=_0x2dafbe-0x0;var _0x58a45a=_0x9134[_0x2dafbe];return _0x58a45a;};'use strict';var _=require('lodash');var util=require(_0x4913('0x0'));var moment=require(_0x4913('0x1'));var BPromise=require(_0x4913('0x2'));var rs=require(_0x4913('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x4913('0x4'));var logger=require(_0x4913('0x5'))(_0x4913('0x6'));var config=require(_0x4913('0x7'));var jayson=require(_0x4913('0x8'));var client=jayson[_0x4913('0x9')]['http']({'port':0x232a});config[_0x4913('0xa')]=_[_0x4913('0xb')](config[_0x4913('0xa')],{'host':'localhost','port':0x18eb});var socket=require(_0x4913('0xc'))(new Redis(config[_0x4913('0xa')]));require('./openchannelMessage.socket')['register'](socket);function respondWithRpcPromise(_0x4d9eb2,_0xae5842,_0x57260f){return new BPromise(function(_0x28f919,_0x1c08ac){return client[_0x4913('0xd')](_0x4d9eb2,_0x57260f)[_0x4913('0xe')](function(_0x3c3272){logger['info'](_0x4913('0xf'),_0xae5842,'request\x20sent');logger[_0x4913('0x10')]('OpenchannelMessage,\x20%s,\x20%s,\x20%s',_0xae5842,_0x4913('0x11'),JSON[_0x4913('0x12')](_0x3c3272));if(_0x3c3272[_0x4913('0x13')]){if(_0x3c3272['error'][_0x4913('0x14')]===0x1f4){logger[_0x4913('0x13')]('OpenchannelMessage,\x20%s,\x20%s',_0xae5842,_0x3c3272['error'][_0x4913('0x15')]);return _0x1c08ac(_0x3c3272[_0x4913('0x13')][_0x4913('0x15')]);}logger[_0x4913('0x13')]('OpenchannelMessage,\x20%s,\x20%s',_0xae5842,_0x3c3272[_0x4913('0x13')][_0x4913('0x15')]);return _0x28f919(_0x3c3272['error'][_0x4913('0x15')]);}else{logger['info'](_0x4913('0xf'),_0xae5842,_0x4913('0x11'));_0x28f919(_0x3c3272['result'][_0x4913('0x15')]);}})['catch'](function(_0x50584a){logger[_0x4913('0x13')](_0x4913('0xf'),_0xae5842,_0x50584a);_0x1c08ac(_0x50584a);});});}exports['CreateOpenchannelMessage']=function(_0x52fe67){var _0x13cb5b=this;return new Promise(function(_0x50b0ef,_0xcb1c7a){return db[_0x4913('0x16')]['create'](_0x52fe67[_0x4913('0x17')],{'raw':_0x52fe67[_0x4913('0x18')]?_0x52fe67[_0x4913('0x18')][_0x4913('0x19')]===undefined?!![]:![]:!![]})[_0x4913('0xe')](function(_0x3c099e){logger[_0x4913('0x1a')]('CreateOpenchannelMessage',_0x52fe67);logger[_0x4913('0x10')]('CreateOpenchannelMessage',_0x52fe67,JSON[_0x4913('0x12')](_0x3c099e));_0x50b0ef(_0x3c099e);})[_0x4913('0x1b')](function(_0x299cc1){logger[_0x4913('0x13')](_0x4913('0x1c'),_0x299cc1[_0x4913('0x15')],_0x52fe67);_0xcb1c7a(_0x13cb5b[_0x4913('0x13')](0x1f4,_0x299cc1[_0x4913('0x15')]));});});}; \ No newline at end of file diff --git a/server/api/openchannelMessage/openchannelMessage.socket.js b/server/api/openchannelMessage/openchannelMessage.socket.js index 25f56e7..2dd0dfb 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 _0xac4a=['save','remove','update','removeListener','./openchannelMessage.events'];(function(_0x13e8ac,_0x25c0c0){var _0xc77ea6=function(_0x757bd0){while(--_0x757bd0){_0x13e8ac['push'](_0x13e8ac['shift']());}};_0xc77ea6(++_0x25c0c0);}(_0xac4a,0x13f));var _0xaac4=function(_0x46bb99,_0x1627b4){_0x46bb99=_0x46bb99-0x0;var _0x3e1fbe=_0xac4a[_0x46bb99];return _0x3e1fbe;};'use strict';var OpenchannelMessageEvents=require(_0xaac4('0x0'));var events=[_0xaac4('0x1'),_0xaac4('0x2'),_0xaac4('0x3')];function createListener(_0x38f4f4,_0x1dc251){return function(_0x5aeb7d){_0x1dc251['emit'](_0x38f4f4,_0x5aeb7d);};}function removeListener(_0x2af0f6,_0x2a5762){return function(){OpenchannelMessageEvents[_0xaac4('0x4')](_0x2af0f6,_0x2a5762);};}exports['register']=function(_0x1283a5){for(var _0x53d03a=0x0,_0x1cdfc5=events['length'];_0x53d03a<_0x1cdfc5;_0x53d03a++){var _0x1e4283=events[_0x53d03a];var _0x27354c=createListener('openchannelMessage:'+_0x1e4283,_0x1283a5);OpenchannelMessageEvents['on'](_0x1e4283,_0x27354c);}}; \ No newline at end of file +var _0xf4eb=['removeListener','register','./openchannelMessage.events'];(function(_0x186c21,_0x3229d3){var _0x1c7241=function(_0x5187ad){while(--_0x5187ad){_0x186c21['push'](_0x186c21['shift']());}};_0x1c7241(++_0x3229d3);}(_0xf4eb,0xec));var _0xbf4e=function(_0xd65729,_0x499d35){_0xd65729=_0xd65729-0x0;var _0x382dcc=_0xf4eb[_0xd65729];return _0x382dcc;};'use strict';var OpenchannelMessageEvents=require(_0xbf4e('0x0'));var events=['save','remove','update'];function createListener(_0x5ed5b9,_0xbbbf01){return function(_0x49d80e){_0xbbbf01['emit'](_0x5ed5b9,_0x49d80e);};}function removeListener(_0x2e3070,_0x1c7606){return function(){OpenchannelMessageEvents[_0xbf4e('0x1')](_0x2e3070,_0x1c7606);};}exports[_0xbf4e('0x2')]=function(_0xa4dcf5){for(var _0x2fcfed=0x0,_0x15b99f=events['length'];_0x2fcfed<_0x15b99f;_0x2fcfed++){var _0x449d55=events[_0x2fcfed];var _0x5013c2=createListener('openchannelMessage:'+_0x449d55,_0xa4dcf5);OpenchannelMessageEvents['on'](_0x449d55,_0x5013c2);}}; \ No newline at end of file diff --git a/server/api/openchannelQueue/index.js b/server/api/openchannelQueue/index.js index c492333..38170d8 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 _0xf2cf=['./openchannelQueue.controller','get','index','isAuthenticated','describe','/:id','show','getMembers','getTeams','getAgents','post','create','addTeams','/:id/users','addAgents','destroy','delete','/:id/teams','removeTeams','removeAgents','exports','util','path','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','../../config/environment'];(function(_0x4b1485,_0x422b1d){var _0x28439e=function(_0x3d3107){while(--_0x3d3107){_0x4b1485['push'](_0x4b1485['shift']());}};_0x28439e(++_0x422b1d);}(_0xf2cf,0xf5));var _0xff2c=function(_0x2ac2b5,_0x46b324){_0x2ac2b5=_0x2ac2b5-0x0;var _0x51eac7=_0xf2cf[_0x2ac2b5];return _0x51eac7;};'use strict';var multer=require('multer');var util=require(_0xff2c('0x0'));var path=require(_0xff2c('0x1'));var timeout=require(_0xff2c('0x2'));var express=require('express');var router=express[_0xff2c('0x3')]();var auth=require(_0xff2c('0x4'));var interaction=require(_0xff2c('0x5'));var config=require(_0xff2c('0x6'));var controller=require(_0xff2c('0x7'));router[_0xff2c('0x8')]('/',auth['isAuthenticated'](),controller[_0xff2c('0x9')]);router[_0xff2c('0x8')]('/describe',auth[_0xff2c('0xa')](),controller[_0xff2c('0xb')]);router[_0xff2c('0x8')](_0xff2c('0xc'),auth[_0xff2c('0xa')](),controller[_0xff2c('0xd')]);router[_0xff2c('0x8')]('/:id/members',auth[_0xff2c('0xa')](),controller[_0xff2c('0xe')]);router[_0xff2c('0x8')]('/:id/teams',auth[_0xff2c('0xa')](),controller[_0xff2c('0xf')]);router[_0xff2c('0x8')]('/:id/users',auth['isAuthenticated'](),controller[_0xff2c('0x10')]);router[_0xff2c('0x11')]('/',auth['isAuthenticated'](),controller[_0xff2c('0x12')]);router['post']('/:id/teams',auth[_0xff2c('0xa')](),controller[_0xff2c('0x13')]);router[_0xff2c('0x11')](_0xff2c('0x14'),auth['isAuthenticated'](),controller[_0xff2c('0x15')]);router['put'](_0xff2c('0xc'),auth[_0xff2c('0xa')](),controller['update']);router['delete']('/:id',auth[_0xff2c('0xa')](),controller[_0xff2c('0x16')]);router[_0xff2c('0x17')](_0xff2c('0x18'),auth[_0xff2c('0xa')](),controller[_0xff2c('0x19')]);router[_0xff2c('0x17')](_0xff2c('0x14'),auth[_0xff2c('0xa')](),controller[_0xff2c('0x1a')]);module[_0xff2c('0x1b')]=router; \ No newline at end of file +var _0xe4d9=['create','addTeams','addAgents','/:id','update','delete','removeTeams','removeAgents','exports','multer','util','path','express','../../components/interaction/service','../../config/environment','get','isAuthenticated','/describe','show','/:id/members','getMembers','/:id/teams','getTeams','/:id/users','getAgents','post'];(function(_0xb4cde7,_0x7f35c1){var _0x4c84ed=function(_0x456ec1){while(--_0x456ec1){_0xb4cde7['push'](_0xb4cde7['shift']());}};_0x4c84ed(++_0x7f35c1);}(_0xe4d9,0x141));var _0x9e4d=function(_0x5333db,_0x4822cb){_0x5333db=_0x5333db-0x0;var _0x3a119a=_0xe4d9[_0x5333db];return _0x3a119a;};'use strict';var multer=require(_0x9e4d('0x0'));var util=require(_0x9e4d('0x1'));var path=require(_0x9e4d('0x2'));var timeout=require('connect-timeout');var express=require(_0x9e4d('0x3'));var router=express['Router']();var auth=require('../../components/auth/service');var interaction=require(_0x9e4d('0x4'));var config=require(_0x9e4d('0x5'));var controller=require('./openchannelQueue.controller');router[_0x9e4d('0x6')]('/',auth[_0x9e4d('0x7')](),controller['index']);router[_0x9e4d('0x6')](_0x9e4d('0x8'),auth['isAuthenticated'](),controller['describe']);router[_0x9e4d('0x6')]('/:id',auth[_0x9e4d('0x7')](),controller[_0x9e4d('0x9')]);router['get'](_0x9e4d('0xa'),auth[_0x9e4d('0x7')](),controller[_0x9e4d('0xb')]);router[_0x9e4d('0x6')](_0x9e4d('0xc'),auth[_0x9e4d('0x7')](),controller[_0x9e4d('0xd')]);router[_0x9e4d('0x6')](_0x9e4d('0xe'),auth[_0x9e4d('0x7')](),controller[_0x9e4d('0xf')]);router[_0x9e4d('0x10')]('/',auth[_0x9e4d('0x7')](),controller[_0x9e4d('0x11')]);router[_0x9e4d('0x10')]('/:id/teams',auth[_0x9e4d('0x7')](),controller[_0x9e4d('0x12')]);router[_0x9e4d('0x10')](_0x9e4d('0xe'),auth[_0x9e4d('0x7')](),controller[_0x9e4d('0x13')]);router['put'](_0x9e4d('0x14'),auth[_0x9e4d('0x7')](),controller[_0x9e4d('0x15')]);router[_0x9e4d('0x16')](_0x9e4d('0x14'),auth[_0x9e4d('0x7')](),controller['destroy']);router[_0x9e4d('0x16')]('/:id/teams',auth['isAuthenticated'](),controller[_0x9e4d('0x17')]);router[_0x9e4d('0x16')](_0x9e4d('0xe'),auth[_0x9e4d('0x7')](),controller[_0x9e4d('0x18')]);module[_0x9e4d('0x19')]=router; \ No newline at end of file diff --git a/server/api/openchannelQueue/openchannelQueue.attributes.js b/server/api/openchannelQueue/openchannelQueue.attributes.js index 90220ec..1bc8ae8 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 _0x7753=['beepall','sequelize','exports','STRING','name','ENUM','rrmemory'];(function(_0x116928,_0x1c462b){var _0x2a70c5=function(_0x18bc32){while(--_0x18bc32){_0x116928['push'](_0x116928['shift']());}};_0x2a70c5(++_0x1c462b);}(_0x7753,0xfd));var _0x3775=function(_0x38622b,_0x3cfdf7){_0x38622b=_0x38622b-0x0;var _0x2c1a7a=_0x7753[_0x38622b];return _0x2c1a7a;};'use strict';var Sequelize=require(_0x3775('0x0'));module[_0x3775('0x1')]={'name':{'type':Sequelize[_0x3775('0x2')],'unique':_0x3775('0x3'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0x3775('0x2')]},'timeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0x3775('0x4')](_0x3775('0x5'),_0x3775('0x6'),'roundrobin')}}; \ No newline at end of file +var _0xe958=['roundrobin','exports','STRING','name','rrmemory'];(function(_0x4cd9b0,_0x3bef1c){var _0x3ca716=function(_0x135095){while(--_0x135095){_0x4cd9b0['push'](_0x4cd9b0['shift']());}};_0x3ca716(++_0x3bef1c);}(_0xe958,0x191));var _0x8e95=function(_0x3f18db,_0x3b88f4){_0x3f18db=_0x3f18db-0x0;var _0xb7f91c=_0xe958[_0x3f18db];return _0xb7f91c;};'use strict';var Sequelize=require('sequelize');module[_0x8e95('0x0')]={'name':{'type':Sequelize[_0x8e95('0x1')],'unique':_0x8e95('0x2'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0x8e95('0x1')]},'timeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize['ENUM'](_0x8e95('0x3'),'beepall',_0x8e95('0x4'))}}; \ No newline at end of file diff --git a/server/api/openchannelQueue/openchannelQueue.controller.js b/server/api/openchannelQueue/openchannelQueue.controller.js index 948afba..6eda254 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 _0x3194=['create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','find','autoAssociation','error','describe','findOne','UserOpenchannelQueue','OpenchannelQueueId','User','findAndCountAll','UserId','agent','openchannelPause','createdAt','format','SIP','getTeams','addTeams','ids','Team','Agents','voicePause','interface','flatMap','sequelize','transaction','each','findOrCreate','userOpenchannelQueue:save','select','field','tq.TeamId','from','join','OpenchannelQueueId\x20=\x20?','ut.UserId\x20=\x20?','push','toString','QueryTypes','SELECT','includes','all','union','compact','removeTeams','forEach','emit','userOpenchannelQueue:remove','addAgents','omit','spread','removeAgents','isArray','getAgents','html-pdf','rimraf','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','to-csv','lodash','squel','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','api','../../config/environment','../../mysqldb','redis','localhost','socket.io-emitter','./openchannelQueue.socket','register','status','json','count','offset','limit','set','apply','save','update','then','get','OpenchannelQueues','UserProfileResource','destroy','end','sendStatus','stack','name','send','index','map','rawAttributes','fieldName','type','query','filters','intersection','model','fields','attributes','length','hasOwnProperty','nolimit','order','sort','pick','filter','merge','where','VIRTUAL','options','OpenchannelQueue','include','findAll','rows','catch','show','params','keys','includeAll'];(function(_0x2b7764,_0x2606f1){var _0x848dcb=function(_0x1ae85b){while(--_0x1ae85b){_0x2b7764['push'](_0x2b7764['shift']());}};_0x848dcb(++_0x2606f1);}(_0x3194,0xc2));var _0x4319=function(_0x39484a,_0x50b76f){_0x39484a=_0x39484a-0x0;var _0x5e001e=_0x3194[_0x39484a];return _0x5e001e;};'use strict';var pdf=require(_0x4319('0x0'));var emlformat=require('eml-format');var rimraf=require(_0x4319('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x4319('0x2'));var rp=require(_0x4319('0x3'));var moment=require('moment');var BPromise=require(_0x4319('0x4'));var Mustache=require(_0x4319('0x5'));var util=require(_0x4319('0x6'));var path=require(_0x4319('0x7'));var sox=require(_0x4319('0x8'));var csv=require(_0x4319('0x9'));var ejs=require('ejs');var fs=require('fs');var _=require(_0x4319('0xa'));var squel=require(_0x4319('0xb'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x4319('0xc'));var toCsv=require(_0x4319('0x9'));var querystring=require('querystring');var Papa=require(_0x4319('0xd'));var Redis=require(_0x4319('0xe'));var authService=require(_0x4319('0xf'));var qs=require(_0x4319('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x4319('0x11'));var logger=require('../../config/logger')(_0x4319('0x12'));var utils=require('../../config/utils');var config=require(_0x4319('0x13'));var db=require(_0x4319('0x14'))['db'];config['redis']=_['defaults'](config[_0x4319('0x15')],{'host':_0x4319('0x16'),'port':0x18eb});var socket=require(_0x4319('0x17'))(new Redis(config[_0x4319('0x15')]));require(_0x4319('0x18'))[_0x4319('0x19')](socket);function respondWithStatusCode(_0xa74367,_0x2f6111){_0x2f6111=_0x2f6111||0xcc;return function(_0x4b65ef){if(_0x4b65ef){return _0xa74367['sendStatus'](_0x2f6111);}return _0xa74367[_0x4319('0x1a')](_0x2f6111)['end']();};}function respondWithResult(_0x6573e2,_0x534f24){_0x534f24=_0x534f24||0xc8;return function(_0x1c8587){if(_0x1c8587){return _0x6573e2[_0x4319('0x1a')](_0x534f24)[_0x4319('0x1b')](_0x1c8587);}};}function respondWithFilteredResult(_0x1b47be,_0x378ed9){return function(_0x27e092){if(_0x27e092){var _0x46c643=_0x27e092[_0x4319('0x1c')],_0x4c9bc2=_0x378ed9[_0x4319('0x1d')],_0x3fb4b5=_0x378ed9[_0x4319('0x1d')]+_0x378ed9[_0x4319('0x1e')],_0x4c1315;if(_0x3fb4b5>=_0x46c643){_0x3fb4b5=_0x46c643;_0x4c1315=0xc8;}else{_0x4c1315=0xce;}_0x1b47be[_0x4319('0x1a')](_0x4c1315);return _0x1b47be[_0x4319('0x1f')]('Content-Range',_0x4c9bc2+'-'+_0x3fb4b5+'/'+_0x46c643)[_0x4319('0x1b')](_0x27e092);}return null;};}function patchUpdates(_0x1eb680){return function(_0x4ba6f1){try{jsonpatch[_0x4319('0x20')](_0x4ba6f1,_0x1eb680,!![]);}catch(_0x5951de){return BPromise['reject'](_0x5951de);}return _0x4ba6f1[_0x4319('0x21')]();};}function saveUpdates(_0x317b42,_0x190816){return function(_0x49173f){if(_0x49173f){return _0x49173f[_0x4319('0x22')](_0x317b42)['then'](function(_0x242d3e){return _0x242d3e;});}return null;};}function removeEntity(_0x5ba926,_0x26f192){return function(_0x4bdede){if(_0x4bdede){return _0x4bdede['destroy']()[_0x4319('0x23')](function(){var _0x3cad13=_0x4bdede[_0x4319('0x24')]({'plain':!![]});var _0x47bfaa=_0x4319('0x25');return db[_0x4319('0x26')][_0x4319('0x27')]({'where':{'type':_0x47bfaa,'resourceId':_0x3cad13['id']}})[_0x4319('0x23')](function(){return _0x4bdede;});})[_0x4319('0x23')](function(){_0x5ba926[_0x4319('0x1a')](0xcc)[_0x4319('0x28')]();});}};}function handleEntityNotFound(_0x210841,_0x4c6353){return function(_0x2c7afc){if(!_0x2c7afc){_0x210841[_0x4319('0x29')](0x194);}return _0x2c7afc;};}function handleError(_0x1c5a9e,_0x4af922){_0x4af922=_0x4af922||0x1f4;return function(_0x4a448d){logger['error'](_0x4a448d[_0x4319('0x2a')]);if(_0x4a448d[_0x4319('0x2b')]){delete _0x4a448d[_0x4319('0x2b')];}_0x1c5a9e[_0x4319('0x1a')](_0x4af922)[_0x4319('0x2c')](_0x4a448d);};}exports[_0x4319('0x2d')]=function(_0x31623c,_0x2316dd){var _0x2c0052={},_0x265aa5={},_0x3ba4c2={'count':0x0,'rows':[]};var _0x25523b=_[_0x4319('0x2e')](db['OpenchannelQueue'][_0x4319('0x2f')],function(_0x12033e){return{'name':_0x12033e[_0x4319('0x30')],'type':_0x12033e[_0x4319('0x31')]['key']};});_0x265aa5['model']=_[_0x4319('0x2e')](_0x25523b,_0x4319('0x2b'));_0x265aa5[_0x4319('0x32')]=_['keys'](_0x31623c['query']);_0x265aa5[_0x4319('0x33')]=_[_0x4319('0x34')](_0x265aa5[_0x4319('0x35')],_0x265aa5[_0x4319('0x32')]);_0x2c0052['attributes']=_['intersection'](_0x265aa5[_0x4319('0x35')],qs['fields'](_0x31623c[_0x4319('0x32')][_0x4319('0x36')]));_0x2c0052[_0x4319('0x37')]=_0x2c0052[_0x4319('0x37')][_0x4319('0x38')]?_0x2c0052[_0x4319('0x37')]:_0x265aa5[_0x4319('0x35')];if(!_0x31623c[_0x4319('0x32')][_0x4319('0x39')](_0x4319('0x3a'))){_0x2c0052[_0x4319('0x1e')]=qs[_0x4319('0x1e')](_0x31623c[_0x4319('0x32')][_0x4319('0x1e')]);_0x2c0052[_0x4319('0x1d')]=qs[_0x4319('0x1d')](_0x31623c['query'][_0x4319('0x1d')]);}_0x2c0052[_0x4319('0x3b')]=qs[_0x4319('0x3c')](_0x31623c[_0x4319('0x32')][_0x4319('0x3c')]);_0x2c0052['where']=qs['filters'](_[_0x4319('0x3d')](_0x31623c[_0x4319('0x32')],_0x265aa5[_0x4319('0x33')]));if(_0x31623c[_0x4319('0x32')][_0x4319('0x3e')]){_0x2c0052['where']=_[_0x4319('0x3f')](_0x2c0052[_0x4319('0x40')],{'$or':_[_0x4319('0x2e')](_0x25523b,function(_0x9b0b95){if(_0x9b0b95['type']!==_0x4319('0x41')){var _0x1bba6e={};_0x1bba6e[_0x9b0b95[_0x4319('0x2b')]]={'$like':'%'+_0x31623c['query'][_0x4319('0x3e')]+'%'};return _0x1bba6e;}})});}_0x2c0052=_[_0x4319('0x3f')]({},_0x2c0052,_0x31623c[_0x4319('0x42')]);var _0x1f0a09={'where':_0x2c0052[_0x4319('0x40')]};return db[_0x4319('0x43')][_0x4319('0x1c')](_0x1f0a09)[_0x4319('0x23')](function(_0xa5a475){_0x3ba4c2[_0x4319('0x1c')]=_0xa5a475;if(_0x31623c[_0x4319('0x32')]['includeAll']){_0x2c0052[_0x4319('0x44')]=[{'all':!![]}];}return db[_0x4319('0x43')][_0x4319('0x45')](_0x2c0052);})[_0x4319('0x23')](function(_0x3c7698){_0x3ba4c2[_0x4319('0x46')]=_0x3c7698;return _0x3ba4c2;})['then'](respondWithFilteredResult(_0x2316dd,_0x2c0052))[_0x4319('0x47')](handleError(_0x2316dd,null));};exports[_0x4319('0x48')]=function(_0xe607ba,_0x701987){var _0x500691={'raw':!![],'where':{'id':_0xe607ba[_0x4319('0x49')]['id']}},_0x7861a={};_0x7861a[_0x4319('0x35')]=_[_0x4319('0x4a')](db['OpenchannelQueue'][_0x4319('0x2f')]);_0x7861a['query']=_[_0x4319('0x4a')](_0xe607ba[_0x4319('0x32')]);_0x7861a[_0x4319('0x33')]=_['intersection'](_0x7861a[_0x4319('0x35')],_0x7861a[_0x4319('0x32')]);_0x500691['attributes']=_[_0x4319('0x34')](_0x7861a[_0x4319('0x35')],qs[_0x4319('0x36')](_0xe607ba[_0x4319('0x32')]['fields']));_0x500691[_0x4319('0x37')]=_0x500691[_0x4319('0x37')]['length']?_0x500691[_0x4319('0x37')]:_0x7861a[_0x4319('0x35')];if(_0xe607ba[_0x4319('0x32')][_0x4319('0x4b')]){_0x500691[_0x4319('0x44')]=[{'all':!![]}];}_0x500691=_[_0x4319('0x3f')]({},_0x500691,_0xe607ba[_0x4319('0x42')]);return db['OpenchannelQueue']['find'](_0x500691)[_0x4319('0x23')](handleEntityNotFound(_0x701987,null))[_0x4319('0x23')](respondWithResult(_0x701987,null))[_0x4319('0x47')](handleError(_0x701987,null));};exports[_0x4319('0x4c')]=function(_0xfef021,_0x85ecfe){return db['OpenchannelQueue'][_0x4319('0x4c')](_0xfef021[_0x4319('0x4d')],{})[_0x4319('0x23')](function(_0xa8f9f){var _0x4fe7d6=_0xfef021[_0x4319('0x4e')][_0x4319('0x24')]({'plain':!![]});if(!_0x4fe7d6)throw new Error(_0x4319('0x4f'));if(_0x4fe7d6[_0x4319('0x50')]===_0x4319('0x4e')){var _0x53935e=_0xa8f9f[_0x4319('0x24')]({'plain':!![]});var _0x59c2d4=_0x4319('0x25');return db[_0x4319('0x51')][_0x4319('0x52')]({'where':{'name':_0x59c2d4,'userProfileId':_0x4fe7d6['userProfileId']},'raw':!![]})[_0x4319('0x23')](function(_0x1dbcf5){if(_0x1dbcf5&&_0x1dbcf5[_0x4319('0x53')]===0x0){return db['UserProfileResource'][_0x4319('0x4c')]({'name':_0x53935e[_0x4319('0x2b')],'resourceId':_0x53935e['id'],'type':_0x1dbcf5['name'],'sectionId':_0x1dbcf5['id']},{})[_0x4319('0x23')](function(){return _0xa8f9f;});}else{return _0xa8f9f;}})[_0x4319('0x47')](function(_0x3a9f0c){logger[_0x4319('0x54')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x3a9f0c);throw _0x3a9f0c;});}return _0xa8f9f;})[_0x4319('0x23')](respondWithResult(_0x85ecfe,0xc9))[_0x4319('0x47')](handleError(_0x85ecfe,null));};exports[_0x4319('0x22')]=function(_0xb96fa6,_0x205983){if(_0xb96fa6[_0x4319('0x4d')]['id']){delete _0xb96fa6['body']['id'];}return db['OpenchannelQueue'][_0x4319('0x52')]({'where':{'id':_0xb96fa6[_0x4319('0x49')]['id']}})['then'](handleEntityNotFound(_0x205983,null))[_0x4319('0x23')](saveUpdates(_0xb96fa6['body'],null))[_0x4319('0x23')](respondWithResult(_0x205983,null))[_0x4319('0x47')](handleError(_0x205983,null));};exports[_0x4319('0x27')]=function(_0x3d2b02,_0x521067){return db[_0x4319('0x43')][_0x4319('0x52')]({'where':{'id':_0x3d2b02['params']['id']}})[_0x4319('0x23')](handleEntityNotFound(_0x521067,null))[_0x4319('0x23')](removeEntity(_0x521067,null))[_0x4319('0x47')](handleError(_0x521067,null));};exports[_0x4319('0x55')]=function(_0x5f108f,_0x38a745){return db[_0x4319('0x43')][_0x4319('0x55')]()[_0x4319('0x23')](respondWithResult(_0x38a745,null))[_0x4319('0x47')](handleError(_0x38a745,null));};exports['getMembers']=function(_0x5d8000,_0x513fb5,_0x416483){var _0x46aed4={'raw':!![],'where':{}},_0x4f33c7={},_0x427d8d;return db['OpenchannelQueue'][_0x4319('0x56')]({'where':{'id':_0x5d8000[_0x4319('0x49')]['id']}})[_0x4319('0x23')](handleEntityNotFound(_0x513fb5,null))['then'](function(_0x4781a5){if(_0x4781a5){_0x427d8d=_0x4781a5[_0x4319('0x24')]({'plain':!![]});_0x4f33c7[_0x4319('0x35')]=_[_0x4319('0x4a')](db[_0x4319('0x57')][_0x4319('0x2f')]);_0x4f33c7['query']=_[_0x4319('0x4a')](_0x5d8000['query']);_0x4f33c7['filters']=_[_0x4319('0x34')](_0x4f33c7[_0x4319('0x35')],_0x4f33c7[_0x4319('0x32')]);_0x46aed4[_0x4319('0x37')]=_['intersection'](_0x4f33c7[_0x4319('0x35')],qs['fields'](_0x5d8000[_0x4319('0x32')]['fields']));_0x46aed4[_0x4319('0x37')]=_0x46aed4[_0x4319('0x37')]['length']?_0x46aed4[_0x4319('0x37')]:_0x4f33c7[_0x4319('0x35')];if(!_0x5d8000[_0x4319('0x32')][_0x4319('0x39')](_0x4319('0x3a'))){_0x46aed4['limit']=qs[_0x4319('0x1e')](_0x5d8000['query'][_0x4319('0x1e')]);_0x46aed4[_0x4319('0x1d')]=qs['offset'](_0x5d8000['query'][_0x4319('0x1d')]);}_0x46aed4[_0x4319('0x3b')]=qs[_0x4319('0x3c')](_0x5d8000[_0x4319('0x32')][_0x4319('0x3c')]);_0x46aed4[_0x4319('0x40')]=qs['filters'](_[_0x4319('0x3d')](_0x5d8000['query'],_0x4f33c7[_0x4319('0x33')]));_0x46aed4[_0x4319('0x40')][_0x4319('0x58')]=_0x4781a5['id'];if(_0x5d8000[_0x4319('0x32')][_0x4319('0x3e')]){_0x46aed4['where']=_[_0x4319('0x3f')](_0x46aed4[_0x4319('0x40')],{'$or':_[_0x4319('0x2e')](_0x46aed4['attributes'],function(_0x13f5b0){var _0x28195b={};_0x28195b[_0x13f5b0]={'$like':'%'+_0x5d8000['query'][_0x4319('0x3e')]+'%'};return _0x28195b;})});}_0x46aed4=_[_0x4319('0x3f')]({},_0x46aed4,_0x5d8000[_0x4319('0x42')]);return db['UserOpenchannelQueue'][_0x4319('0x45')](_0x46aed4);}})[_0x4319('0x23')](function(_0x1d509d){if(_0x1d509d){return db[_0x4319('0x59')][_0x4319('0x5a')]({'where':{'id':_[_0x4319('0x2e')](_0x1d509d,_0x4319('0x5b')),'role':_0x4319('0x5c')},'attributes':['id',_0x4319('0x2b'),_0x4319('0x5d'),'updatedAt',_0x4319('0x5e')]});}})[_0x4319('0x23')](function(_0xe4dcd){if(_0xe4dcd){return{'count':_0xe4dcd['count'],'rows':_[_0x4319('0x2e')](_0xe4dcd[_0x4319('0x46')],function(_0x43a35c){return{'membername':_0x43a35c[_0x4319('0x2b')],'UserId':_0x43a35c['id'],'queue_name':_0x427d8d[_0x4319('0x2b')],'OpenchannelQueueId':_0x427d8d['id'],'interface':util[_0x4319('0x5f')]('%s/%s',_0x4319('0x60'),_0x43a35c[_0x4319('0x2b')]),'penalty':0x0,'paused':_0x43a35c['openchannelPause'],'createdAt':_0x43a35c[_0x4319('0x5e')],'updatedAt':_0x43a35c['updatedAt']};})};}else{return{'count':0x0,'rows':[]};}})[_0x4319('0x23')](respondWithFilteredResult(_0x513fb5,_0x46aed4))['catch'](handleError(_0x513fb5,null));};exports[_0x4319('0x61')]=function(_0x514db8,_0x4dc46d,_0x3c1721){var _0x4fd5a1={};var _0x57c8ca={};var _0x304071;var _0x20f836;return db['OpenchannelQueue'][_0x4319('0x56')]({'where':{'id':_0x514db8['params']['id']}})[_0x4319('0x23')](handleEntityNotFound(_0x4dc46d,null))[_0x4319('0x23')](function(_0x5c9ea1){if(_0x5c9ea1){_0x304071=_0x5c9ea1;_0x57c8ca[_0x4319('0x35')]=_[_0x4319('0x4a')](db['Team'][_0x4319('0x2f')]);_0x57c8ca['query']=_['keys'](_0x514db8['query']);_0x57c8ca[_0x4319('0x33')]=_[_0x4319('0x34')](_0x57c8ca['model'],_0x57c8ca[_0x4319('0x32')]);_0x4fd5a1[_0x4319('0x37')]=_[_0x4319('0x34')](_0x57c8ca[_0x4319('0x35')],qs[_0x4319('0x36')](_0x514db8[_0x4319('0x32')][_0x4319('0x36')]));_0x4fd5a1[_0x4319('0x37')]=_0x4fd5a1[_0x4319('0x37')][_0x4319('0x38')]?_0x4fd5a1[_0x4319('0x37')]:_0x57c8ca[_0x4319('0x35')];_0x4fd5a1[_0x4319('0x3b')]=qs[_0x4319('0x3c')](_0x514db8[_0x4319('0x32')][_0x4319('0x3c')]);_0x4fd5a1[_0x4319('0x40')]=qs[_0x4319('0x33')](_[_0x4319('0x3d')](_0x514db8[_0x4319('0x32')],_0x57c8ca[_0x4319('0x33')]));if(_0x514db8[_0x4319('0x32')]['filter']){_0x4fd5a1[_0x4319('0x40')]=_['merge'](_0x4fd5a1[_0x4319('0x40')],{'$or':_[_0x4319('0x2e')](_0x4fd5a1['attributes'],function(_0x21e23b){var _0x159528={};_0x159528[_0x21e23b]={'$like':'%'+_0x514db8[_0x4319('0x32')]['filter']+'%'};return _0x159528;})});}_0x4fd5a1=_['merge']({},_0x4fd5a1,_0x514db8[_0x4319('0x42')]);return _0x304071['getTeams'](_0x4fd5a1);}})['then'](function(_0x1cd5f1){if(_0x1cd5f1){_0x20f836=_0x1cd5f1[_0x4319('0x38')];if(!_0x514db8[_0x4319('0x32')][_0x4319('0x39')](_0x4319('0x3a'))){_0x4fd5a1[_0x4319('0x1e')]=qs[_0x4319('0x1e')](_0x514db8['query'][_0x4319('0x1e')]);_0x4fd5a1[_0x4319('0x1d')]=qs[_0x4319('0x1d')](_0x514db8[_0x4319('0x32')][_0x4319('0x1d')]);}return _0x304071[_0x4319('0x61')](_0x4fd5a1);}})[_0x4319('0x23')](function(_0x358cf2){if(_0x358cf2){return _0x358cf2?{'count':_0x20f836,'rows':_0x358cf2}:null;}})[_0x4319('0x23')](respondWithResult(_0x4dc46d,null))[_0x4319('0x47')](handleError(_0x4dc46d,null));};exports[_0x4319('0x62')]=function(_0x1f5293,_0x4a3a1c,_0x16f0a7){var _0x427e81=_0x1f5293[_0x4319('0x4d')][_0x4319('0x63')];return db[_0x4319('0x64')][_0x4319('0x45')]({'where':{'id':_0x427e81},'attributes':['id'],'include':[{'model':db['User'],'as':_0x4319('0x65'),'attributes':['id',_0x4319('0x2b'),'online',_0x4319('0x66'),_0x4319('0x67')],'raw':!![]}]})[_0x4319('0x23')](function(_0x2a5b28){if(_0x2a5b28){var _0x2a7ee4=_[_0x4319('0x68')](_0x2a5b28,function(_0x44da93){var _0x45487e=_0x44da93[_0x4319('0x24')]({'plain':!![]});return _0x45487e[_0x4319('0x65')];});return db[_0x4319('0x43')]['find']({'where':{'id':_0x1f5293[_0x4319('0x49')]['id']}})[_0x4319('0x23')](function(_0xbc387){return db[_0x4319('0x69')][_0x4319('0x6a')](function(_0x4df6b6){return _0xbc387['addTeams'](_0x427e81,{'transaction':_0x4df6b6})[_0x4319('0x23')](function(){return BPromise[_0x4319('0x6b')](_0x2a7ee4,function(_0x457587){return db['UserOpenchannelQueue'][_0x4319('0x6c')]({'where':{'UserId':_0x457587['id'],'OpenchannelQueueId':_0x1f5293[_0x4319('0x49')]['id']},'transaction':_0x4df6b6});});})[_0x4319('0x23')](function(){_0x2a7ee4['forEach'](function(_0x5325df){socket['emit'](_0x4319('0x6d'),{'UserId':_0x5325df['id'],'OpenchannelQueueId':_0xbc387['id']});});});});});}})['then'](respondWithStatusCode(_0x4a3a1c,null))[_0x4319('0x47')](handleError(_0x4a3a1c,null));};exports['removeTeams']=function(_0x25b55c,_0x5042ad,_0x5c8eb1){return db[_0x4319('0x64')][_0x4319('0x45')]({'where':{'id':_0x25b55c[_0x4319('0x32')][_0x4319('0x63')]},'attributes':['id'],'include':[{'model':db['User'],'as':_0x4319('0x65'),'attributes':['id'],'raw':!![]}]})[_0x4319('0x23')](handleEntityNotFound(_0x5042ad,null))[_0x4319('0x23')](function(_0x32c763){var _0x2b8896=_[_0x4319('0x2e')](_0x32c763,'id');var _0x170278=[];var _0x374797=[];var _0x1fcd22=squel[_0x4319('0x6e')]();_0x1fcd22[_0x4319('0x6f')](_0x4319('0x70'))[_0x4319('0x71')]('team_has_openchannel_queues','tq')[_0x4319('0x72')]('user_has_teams','ut','ut.TeamId\x20=\x20tq.TeamId')[_0x4319('0x40')](_0x4319('0x73'),_0x25b55c['params']['id']);for(var _0x44876c=0x0;_0x44876c<_0x32c763['length'];_0x44876c+=0x1){let _0x225486=_0x32c763[_0x44876c];for(var _0x5d1013=0x0;_0x5d1013<_0x225486['Agents'][_0x4319('0x38')];_0x5d1013+=0x1){let _0x3622c3=_0x225486['Agents'][_0x5d1013];var _0x175170=_0x1fcd22['clone']();_0x175170[_0x4319('0x40')](_0x4319('0x74'),_0x3622c3['id']);_0x374797[_0x4319('0x75')](db['sequelize'][_0x4319('0x32')](_0x175170[_0x4319('0x76')](),{'type':db[_0x4319('0x69')][_0x4319('0x77')][_0x4319('0x78')]})[_0x4319('0x23')](function(_0x27b469){if(_0x27b469[_0x4319('0x38')]===0x1){return _0x3622c3['id'];}else{var _0x757455=_['every'](_[_0x4319('0x2e')](_0x27b469,'TeamId'),function(_0x2e6648){return _[_0x4319('0x79')](_0x2b8896,_0x2e6648);});if(_0x757455){return _0x3622c3['id'];}}}));}}return BPromise[_0x4319('0x7a')](_0x374797)[_0x4319('0x23')](function(_0x5ca09a){_0x170278=_(_0x170278)[_0x4319('0x7b')](_0x5ca09a)[_0x4319('0x7c')]()['value']();return db[_0x4319('0x43')]['find']({'where':{'id':_0x25b55c[_0x4319('0x49')]['id']}})[_0x4319('0x23')](function(_0x21caea){return db['sequelize'][_0x4319('0x6a')](function(_0x58c8b6){return _0x21caea[_0x4319('0x7d')](_0x25b55c[_0x4319('0x32')][_0x4319('0x63')],{'transaction':_0x58c8b6})['then'](function(){if(!_['isEmpty'](_0x170278)){return _0x21caea['removeAgents'](_0x170278,{'transaction':_0x58c8b6});}})[_0x4319('0x23')](function(){_0x170278[_0x4319('0x7e')](function(_0x3a2655){socket[_0x4319('0x7f')](_0x4319('0x80'),{'UserId':_0x3a2655,'OpenchannelQueueId':_0x21caea['id']});});});});});});})['then'](respondWithStatusCode(_0x5042ad,null))[_0x4319('0x47')](handleError(_0x5042ad,null));};exports['addAgents']=function(_0x315bea,_0x39708a,_0x5d1d6b){return db['OpenchannelQueue']['find']({'where':{'id':_0x315bea['params']['id']}})['then'](handleEntityNotFound(_0x39708a,null))['then'](function(_0x1ab484){if(_0x1ab484){return _0x1ab484[_0x4319('0x81')](_0x315bea['body']['ids'],_[_0x4319('0x82')](_0x315bea['body'],[_0x4319('0x63'),'id'])||{})[_0x4319('0x83')](function(_0x48ebc3){for(var _0x4bc1c5=0x0;_0x4bc1c5<_0x315bea[_0x4319('0x4d')][_0x4319('0x63')][_0x4319('0x38')];_0x4bc1c5+=0x1){socket[_0x4319('0x7f')](_0x4319('0x6d'),{'UserId':_0x315bea[_0x4319('0x4d')][_0x4319('0x63')][_0x4bc1c5],'OpenchannelQueueId':_0x315bea[_0x4319('0x49')]['id']});}return _0x48ebc3;});}})['then'](respondWithResult(_0x39708a,null))[_0x4319('0x47')](handleError(_0x39708a,null));};exports[_0x4319('0x84')]=function(_0x2770da,_0x46a162,_0x549a83){return db[_0x4319('0x43')][_0x4319('0x52')]({'where':{'id':_0x2770da[_0x4319('0x49')]['id']}})[_0x4319('0x23')](handleEntityNotFound(_0x46a162,null))[_0x4319('0x23')](function(_0x2f3406){if(_0x2f3406){return _0x2f3406[_0x4319('0x84')](_0x2770da['query'][_0x4319('0x63')])['then'](function(){if(_[_0x4319('0x85')](_0x2770da[_0x4319('0x32')]['ids'])){for(var _0x17fea7=0x0;_0x17fea7<_0x2770da[_0x4319('0x32')]['ids'][_0x4319('0x38')];_0x17fea7+=0x1){socket['emit'](_0x4319('0x80'),{'UserId':Number(_0x2770da['query'][_0x4319('0x63')][_0x17fea7]),'OpenchannelQueueId':Number(_0x2770da[_0x4319('0x49')]['id'])});}}else{socket[_0x4319('0x7f')]('userOpenchannelQueue:remove',{'UserId':Number(_0x2770da[_0x4319('0x32')]['ids']),'OpenchannelQueueId':Number(_0x2770da[_0x4319('0x49')]['id'])});}});}})[_0x4319('0x23')](respondWithStatusCode(_0x46a162,null))[_0x4319('0x47')](handleError(_0x46a162,null));};exports[_0x4319('0x86')]=function(_0x285846,_0x3a8431,_0x17b49e){var _0x30133a={};var _0x3478b2={};var _0x5c52d1;var _0x5a2017;return db[_0x4319('0x43')]['findOne']({'where':{'id':_0x285846[_0x4319('0x49')]['id']}})[_0x4319('0x23')](handleEntityNotFound(_0x3a8431,null))[_0x4319('0x23')](function(_0x272291){if(_0x272291){_0x5c52d1=_0x272291;_0x3478b2[_0x4319('0x35')]=_[_0x4319('0x4a')](db[_0x4319('0x59')][_0x4319('0x2f')]);_0x3478b2[_0x4319('0x32')]=_[_0x4319('0x4a')](_0x285846[_0x4319('0x32')]);_0x3478b2['filters']=_[_0x4319('0x34')](_0x3478b2['model'],_0x3478b2['query']);_0x30133a['attributes']=_[_0x4319('0x34')](_0x3478b2[_0x4319('0x35')],qs[_0x4319('0x36')](_0x285846[_0x4319('0x32')][_0x4319('0x36')]));_0x30133a[_0x4319('0x37')]=_0x30133a['attributes'][_0x4319('0x38')]?_0x30133a['attributes']:_0x3478b2[_0x4319('0x35')];_0x30133a[_0x4319('0x3b')]=qs[_0x4319('0x3c')](_0x285846[_0x4319('0x32')]['sort']);_0x30133a['where']=qs[_0x4319('0x33')](_[_0x4319('0x3d')](_0x285846[_0x4319('0x32')],_0x3478b2[_0x4319('0x33')]));if(_0x285846[_0x4319('0x32')][_0x4319('0x3e')]){_0x30133a[_0x4319('0x40')]=_['merge'](_0x30133a[_0x4319('0x40')],{'$or':_[_0x4319('0x2e')](_0x30133a['attributes'],function(_0x1120c9){var _0x2e0b6f={};_0x2e0b6f[_0x1120c9]={'$like':'%'+_0x285846['query']['filter']+'%'};return _0x2e0b6f;})});}_0x30133a=_[_0x4319('0x3f')]({},_0x30133a,_0x285846[_0x4319('0x42')]);return _0x5c52d1[_0x4319('0x86')](_0x30133a);}})[_0x4319('0x23')](function(_0x18c746){if(_0x18c746){_0x5a2017=_0x18c746[_0x4319('0x38')];if(!_0x285846[_0x4319('0x32')][_0x4319('0x39')]('nolimit')){_0x30133a[_0x4319('0x1e')]=qs[_0x4319('0x1e')](_0x285846['query'][_0x4319('0x1e')]);_0x30133a[_0x4319('0x1d')]=qs[_0x4319('0x1d')](_0x285846['query'][_0x4319('0x1d')]);}return _0x5c52d1[_0x4319('0x86')](_0x30133a);}})['then'](function(_0x157c14){if(_0x157c14){return _0x157c14?{'count':_0x5a2017,'rows':_0x157c14}:null;}})[_0x4319('0x23')](respondWithResult(_0x3a8431,null))['catch'](handleError(_0x3a8431,null));}; \ No newline at end of file +var _0x0689=['rimraf','fast-json-patch','request-promise','moment','mustache','path','sox','to-csv','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','redis','defaults','./openchannelQueue.socket','register','sendStatus','status','end','json','count','offset','limit','set','Content-Range','reject','update','destroy','then','UserProfileResource','error','name','send','index','map','OpenchannelQueue','rawAttributes','type','key','model','query','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','pick','merge','VIRTUAL','filter','options','includeAll','findAll','rows','catch','show','params','length','include','create','body','user','OpenchannelQueues','UserProfileSection','find','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','getMembers','findOne','get','UserOpenchannelQueue','OpenchannelQueueId','User','findAndCountAll','UserId','agent','createdAt','%s/%s','SIP','openchannelPause','updatedAt','getTeams','Team','addTeams','Agents','online','voicePause','interface','flatMap','sequelize','transaction','findOrCreate','forEach','emit','userOpenchannelQueue:save','field','team_has_openchannel_queues','join','user_has_teams','OpenchannelQueueId\x20=\x20?','clone','push','toString','SELECT','includes','all','union','compact','value','isEmpty','removeAgents','addAgents','ids','omit','spread','isArray','userOpenchannelQueue:remove','getAgents','html-pdf'];(function(_0x432682,_0x253044){var _0x463d05=function(_0xa73403){while(--_0xa73403){_0x432682['push'](_0x432682['shift']());}};_0x463d05(++_0x253044);}(_0x0689,0x10f));var _0x9068=function(_0x5bf36d,_0x194769){_0x5bf36d=_0x5bf36d-0x0;var _0xc78588=_0x0689[_0x5bf36d];return _0xc78588;};'use strict';var pdf=require(_0x9068('0x0'));var emlformat=require('eml-format');var rimraf=require(_0x9068('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x9068('0x2'));var rp=require(_0x9068('0x3'));var moment=require(_0x9068('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x9068('0x5'));var util=require('util');var path=require(_0x9068('0x6'));var sox=require(_0x9068('0x7'));var csv=require(_0x9068('0x8'));var ejs=require('ejs');var fs=require('fs');var _=require('lodash');var squel=require(_0x9068('0x9'));var crypto=require(_0x9068('0xa'));var jsforce=require(_0x9068('0xb'));var deskjs=require(_0x9068('0xc'));var toCsv=require(_0x9068('0x8'));var querystring=require(_0x9068('0xd'));var Papa=require(_0x9068('0xe'));var Redis=require(_0x9068('0xf'));var authService=require(_0x9068('0x10'));var qs=require(_0x9068('0x11'));var as=require(_0x9068('0x12'));var hardwareService=require(_0x9068('0x13'));var logger=require(_0x9068('0x14'))(_0x9068('0x15'));var utils=require(_0x9068('0x16'));var config=require(_0x9068('0x17'));var db=require('../../mysqldb')['db'];config[_0x9068('0x18')]=_[_0x9068('0x19')](config[_0x9068('0x18')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x9068('0x18')]));require(_0x9068('0x1a'))[_0x9068('0x1b')](socket);function respondWithStatusCode(_0x28dc21,_0x23c32a){_0x23c32a=_0x23c32a||0xcc;return function(_0x363d6c){if(_0x363d6c){return _0x28dc21[_0x9068('0x1c')](_0x23c32a);}return _0x28dc21[_0x9068('0x1d')](_0x23c32a)[_0x9068('0x1e')]();};}function respondWithResult(_0x321806,_0x583eee){_0x583eee=_0x583eee||0xc8;return function(_0x1544a4){if(_0x1544a4){return _0x321806[_0x9068('0x1d')](_0x583eee)[_0x9068('0x1f')](_0x1544a4);}};}function respondWithFilteredResult(_0x50b48e,_0x598a47){return function(_0x3a2f31){if(_0x3a2f31){var _0x2275d3=_0x3a2f31[_0x9068('0x20')],_0x5cc176=_0x598a47[_0x9068('0x21')],_0x32381b=_0x598a47[_0x9068('0x21')]+_0x598a47[_0x9068('0x22')],_0x1ba9dc;if(_0x32381b>=_0x2275d3){_0x32381b=_0x2275d3;_0x1ba9dc=0xc8;}else{_0x1ba9dc=0xce;}_0x50b48e[_0x9068('0x1d')](_0x1ba9dc);return _0x50b48e[_0x9068('0x23')](_0x9068('0x24'),_0x5cc176+'-'+_0x32381b+'/'+_0x2275d3)[_0x9068('0x1f')](_0x3a2f31);}return null;};}function patchUpdates(_0x123f3f){return function(_0x3ca634){try{jsonpatch['apply'](_0x3ca634,_0x123f3f,!![]);}catch(_0x390524){return BPromise[_0x9068('0x25')](_0x390524);}return _0x3ca634['save']();};}function saveUpdates(_0x4ac806,_0x4f4ac2){return function(_0x21d76f){if(_0x21d76f){return _0x21d76f[_0x9068('0x26')](_0x4ac806)['then'](function(_0x47d337){return _0x47d337;});}return null;};}function removeEntity(_0xe2f9e0,_0x76b5ec){return function(_0x284f98){if(_0x284f98){return _0x284f98[_0x9068('0x27')]()[_0x9068('0x28')](function(){var _0x12a79a=_0x284f98['get']({'plain':!![]});var _0x211c76='OpenchannelQueues';return db[_0x9068('0x29')]['destroy']({'where':{'type':_0x211c76,'resourceId':_0x12a79a['id']}})[_0x9068('0x28')](function(){return _0x284f98;});})['then'](function(){_0xe2f9e0[_0x9068('0x1d')](0xcc)[_0x9068('0x1e')]();});}};}function handleEntityNotFound(_0x24c683,_0x179234){return function(_0x549c96){if(!_0x549c96){_0x24c683[_0x9068('0x1c')](0x194);}return _0x549c96;};}function handleError(_0x5594b0,_0x4dc4d7){_0x4dc4d7=_0x4dc4d7||0x1f4;return function(_0x5edc44){logger[_0x9068('0x2a')](_0x5edc44['stack']);if(_0x5edc44['name']){delete _0x5edc44[_0x9068('0x2b')];}_0x5594b0['status'](_0x4dc4d7)[_0x9068('0x2c')](_0x5edc44);};}exports[_0x9068('0x2d')]=function(_0x52a2ad,_0x19c42b){var _0x2d5913={},_0x1addc7={},_0x81d17a={'count':0x0,'rows':[]};var _0x2e4a99=_[_0x9068('0x2e')](db[_0x9068('0x2f')][_0x9068('0x30')],function(_0x73b92c){return{'name':_0x73b92c['fieldName'],'type':_0x73b92c[_0x9068('0x31')][_0x9068('0x32')]};});_0x1addc7[_0x9068('0x33')]=_[_0x9068('0x2e')](_0x2e4a99,_0x9068('0x2b'));_0x1addc7[_0x9068('0x34')]=_[_0x9068('0x35')](_0x52a2ad[_0x9068('0x34')]);_0x1addc7[_0x9068('0x36')]=_[_0x9068('0x37')](_0x1addc7[_0x9068('0x33')],_0x1addc7[_0x9068('0x34')]);_0x2d5913[_0x9068('0x38')]=_[_0x9068('0x37')](_0x1addc7[_0x9068('0x33')],qs['fields'](_0x52a2ad[_0x9068('0x34')][_0x9068('0x39')]));_0x2d5913[_0x9068('0x38')]=_0x2d5913[_0x9068('0x38')]['length']?_0x2d5913[_0x9068('0x38')]:_0x1addc7[_0x9068('0x33')];if(!_0x52a2ad['query'][_0x9068('0x3a')](_0x9068('0x3b'))){_0x2d5913[_0x9068('0x22')]=qs[_0x9068('0x22')](_0x52a2ad[_0x9068('0x34')][_0x9068('0x22')]);_0x2d5913['offset']=qs['offset'](_0x52a2ad[_0x9068('0x34')]['offset']);}_0x2d5913[_0x9068('0x3c')]=qs[_0x9068('0x3d')](_0x52a2ad['query'][_0x9068('0x3d')]);_0x2d5913[_0x9068('0x3e')]=qs['filters'](_[_0x9068('0x3f')](_0x52a2ad[_0x9068('0x34')],_0x1addc7[_0x9068('0x36')]));if(_0x52a2ad[_0x9068('0x34')]['filter']){_0x2d5913[_0x9068('0x3e')]=_[_0x9068('0x40')](_0x2d5913['where'],{'$or':_[_0x9068('0x2e')](_0x2e4a99,function(_0x238349){if(_0x238349['type']!==_0x9068('0x41')){var _0x25dfa8={};_0x25dfa8[_0x238349[_0x9068('0x2b')]]={'$like':'%'+_0x52a2ad[_0x9068('0x34')][_0x9068('0x42')]+'%'};return _0x25dfa8;}})});}_0x2d5913=_[_0x9068('0x40')]({},_0x2d5913,_0x52a2ad[_0x9068('0x43')]);var _0x24fbf9={'where':_0x2d5913[_0x9068('0x3e')]};return db['OpenchannelQueue'][_0x9068('0x20')](_0x24fbf9)[_0x9068('0x28')](function(_0x1fc41e){_0x81d17a['count']=_0x1fc41e;if(_0x52a2ad[_0x9068('0x34')][_0x9068('0x44')]){_0x2d5913['include']=[{'all':!![]}];}return db[_0x9068('0x2f')][_0x9068('0x45')](_0x2d5913);})['then'](function(_0x57d76f){_0x81d17a[_0x9068('0x46')]=_0x57d76f;return _0x81d17a;})[_0x9068('0x28')](respondWithFilteredResult(_0x19c42b,_0x2d5913))[_0x9068('0x47')](handleError(_0x19c42b,null));};exports[_0x9068('0x48')]=function(_0x2b6313,_0x11f375){var _0x5a434f={'raw':!![],'where':{'id':_0x2b6313[_0x9068('0x49')]['id']}},_0x2e1570={};_0x2e1570['model']=_[_0x9068('0x35')](db[_0x9068('0x2f')][_0x9068('0x30')]);_0x2e1570[_0x9068('0x34')]=_[_0x9068('0x35')](_0x2b6313['query']);_0x2e1570[_0x9068('0x36')]=_['intersection'](_0x2e1570[_0x9068('0x33')],_0x2e1570[_0x9068('0x34')]);_0x5a434f[_0x9068('0x38')]=_[_0x9068('0x37')](_0x2e1570[_0x9068('0x33')],qs[_0x9068('0x39')](_0x2b6313['query'][_0x9068('0x39')]));_0x5a434f[_0x9068('0x38')]=_0x5a434f[_0x9068('0x38')][_0x9068('0x4a')]?_0x5a434f[_0x9068('0x38')]:_0x2e1570[_0x9068('0x33')];if(_0x2b6313[_0x9068('0x34')][_0x9068('0x44')]){_0x5a434f[_0x9068('0x4b')]=[{'all':!![]}];}_0x5a434f=_[_0x9068('0x40')]({},_0x5a434f,_0x2b6313[_0x9068('0x43')]);return db[_0x9068('0x2f')]['find'](_0x5a434f)[_0x9068('0x28')](handleEntityNotFound(_0x11f375,null))[_0x9068('0x28')](respondWithResult(_0x11f375,null))[_0x9068('0x47')](handleError(_0x11f375,null));};exports[_0x9068('0x4c')]=function(_0x1893e1,_0x119d68){return db[_0x9068('0x2f')][_0x9068('0x4c')](_0x1893e1[_0x9068('0x4d')],{})[_0x9068('0x28')](function(_0x1c2034){var _0x2b94f2=_0x1893e1[_0x9068('0x4e')]['get']({'plain':!![]});if(!_0x2b94f2)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x2b94f2['role']===_0x9068('0x4e')){var _0x5afd02=_0x1c2034['get']({'plain':!![]});var _0x40bdcb=_0x9068('0x4f');return db[_0x9068('0x50')][_0x9068('0x51')]({'where':{'name':_0x40bdcb,'userProfileId':_0x2b94f2['userProfileId']},'raw':!![]})[_0x9068('0x28')](function(_0x216fc5){if(_0x216fc5&&_0x216fc5[_0x9068('0x52')]===0x0){return db['UserProfileResource']['create']({'name':_0x5afd02['name'],'resourceId':_0x5afd02['id'],'type':_0x216fc5['name'],'sectionId':_0x216fc5['id']},{})[_0x9068('0x28')](function(){return _0x1c2034;});}else{return _0x1c2034;}})[_0x9068('0x47')](function(_0x4f4a63){logger[_0x9068('0x2a')](_0x9068('0x53'),_0x4f4a63);throw _0x4f4a63;});}return _0x1c2034;})[_0x9068('0x28')](respondWithResult(_0x119d68,0xc9))[_0x9068('0x47')](handleError(_0x119d68,null));};exports[_0x9068('0x26')]=function(_0x111ff0,_0x3fc1d2){if(_0x111ff0[_0x9068('0x4d')]['id']){delete _0x111ff0['body']['id'];}return db[_0x9068('0x2f')]['find']({'where':{'id':_0x111ff0[_0x9068('0x49')]['id']}})[_0x9068('0x28')](handleEntityNotFound(_0x3fc1d2,null))[_0x9068('0x28')](saveUpdates(_0x111ff0[_0x9068('0x4d')],null))[_0x9068('0x28')](respondWithResult(_0x3fc1d2,null))[_0x9068('0x47')](handleError(_0x3fc1d2,null));};exports['destroy']=function(_0x4f99b1,_0x261399){return db[_0x9068('0x2f')][_0x9068('0x51')]({'where':{'id':_0x4f99b1[_0x9068('0x49')]['id']}})[_0x9068('0x28')](handleEntityNotFound(_0x261399,null))[_0x9068('0x28')](removeEntity(_0x261399,null))[_0x9068('0x47')](handleError(_0x261399,null));};exports[_0x9068('0x54')]=function(_0x1a2748,_0x3c0ca5){return db[_0x9068('0x2f')]['describe']()[_0x9068('0x28')](respondWithResult(_0x3c0ca5,null))[_0x9068('0x47')](handleError(_0x3c0ca5,null));};exports[_0x9068('0x55')]=function(_0x1cc2f3,_0x36053d,_0x36c0ce){var _0xf8f130={'raw':!![],'where':{}},_0x46f9a8={},_0xc45159;return db['OpenchannelQueue'][_0x9068('0x56')]({'where':{'id':_0x1cc2f3['params']['id']}})[_0x9068('0x28')](handleEntityNotFound(_0x36053d,null))['then'](function(_0x4bd04a){if(_0x4bd04a){_0xc45159=_0x4bd04a[_0x9068('0x57')]({'plain':!![]});_0x46f9a8[_0x9068('0x33')]=_[_0x9068('0x35')](db[_0x9068('0x58')][_0x9068('0x30')]);_0x46f9a8[_0x9068('0x34')]=_[_0x9068('0x35')](_0x1cc2f3['query']);_0x46f9a8['filters']=_[_0x9068('0x37')](_0x46f9a8[_0x9068('0x33')],_0x46f9a8['query']);_0xf8f130[_0x9068('0x38')]=_[_0x9068('0x37')](_0x46f9a8[_0x9068('0x33')],qs[_0x9068('0x39')](_0x1cc2f3[_0x9068('0x34')][_0x9068('0x39')]));_0xf8f130[_0x9068('0x38')]=_0xf8f130[_0x9068('0x38')][_0x9068('0x4a')]?_0xf8f130['attributes']:_0x46f9a8[_0x9068('0x33')];if(!_0x1cc2f3[_0x9068('0x34')]['hasOwnProperty'](_0x9068('0x3b'))){_0xf8f130[_0x9068('0x22')]=qs[_0x9068('0x22')](_0x1cc2f3['query'][_0x9068('0x22')]);_0xf8f130['offset']=qs[_0x9068('0x21')](_0x1cc2f3[_0x9068('0x34')][_0x9068('0x21')]);}_0xf8f130[_0x9068('0x3c')]=qs['sort'](_0x1cc2f3[_0x9068('0x34')][_0x9068('0x3d')]);_0xf8f130[_0x9068('0x3e')]=qs[_0x9068('0x36')](_['pick'](_0x1cc2f3[_0x9068('0x34')],_0x46f9a8[_0x9068('0x36')]));_0xf8f130[_0x9068('0x3e')][_0x9068('0x59')]=_0x4bd04a['id'];if(_0x1cc2f3[_0x9068('0x34')][_0x9068('0x42')]){_0xf8f130[_0x9068('0x3e')]=_[_0x9068('0x40')](_0xf8f130['where'],{'$or':_['map'](_0xf8f130[_0x9068('0x38')],function(_0x2e4ef5){var _0xd38b25={};_0xd38b25[_0x2e4ef5]={'$like':'%'+_0x1cc2f3[_0x9068('0x34')][_0x9068('0x42')]+'%'};return _0xd38b25;})});}_0xf8f130=_[_0x9068('0x40')]({},_0xf8f130,_0x1cc2f3[_0x9068('0x43')]);return db[_0x9068('0x58')][_0x9068('0x45')](_0xf8f130);}})[_0x9068('0x28')](function(_0x3471df){if(_0x3471df){return db[_0x9068('0x5a')][_0x9068('0x5b')]({'where':{'id':_['map'](_0x3471df,_0x9068('0x5c')),'role':_0x9068('0x5d')},'attributes':['id',_0x9068('0x2b'),'openchannelPause','updatedAt',_0x9068('0x5e')]});}})['then'](function(_0x27f618){if(_0x27f618){return{'count':_0x27f618['count'],'rows':_[_0x9068('0x2e')](_0x27f618[_0x9068('0x46')],function(_0x5792ee){return{'membername':_0x5792ee[_0x9068('0x2b')],'UserId':_0x5792ee['id'],'queue_name':_0xc45159[_0x9068('0x2b')],'OpenchannelQueueId':_0xc45159['id'],'interface':util['format'](_0x9068('0x5f'),_0x9068('0x60'),_0x5792ee['name']),'penalty':0x0,'paused':_0x5792ee[_0x9068('0x61')],'createdAt':_0x5792ee[_0x9068('0x5e')],'updatedAt':_0x5792ee[_0x9068('0x62')]};})};}else{return{'count':0x0,'rows':[]};}})['then'](respondWithFilteredResult(_0x36053d,_0xf8f130))[_0x9068('0x47')](handleError(_0x36053d,null));};exports[_0x9068('0x63')]=function(_0x53673d,_0x508861,_0x144e6a){var _0x2883fe={};var _0x3fc045={};var _0x3960b4;var _0x1a2c52;return db[_0x9068('0x2f')][_0x9068('0x56')]({'where':{'id':_0x53673d[_0x9068('0x49')]['id']}})[_0x9068('0x28')](handleEntityNotFound(_0x508861,null))[_0x9068('0x28')](function(_0xe2817e){if(_0xe2817e){_0x3960b4=_0xe2817e;_0x3fc045[_0x9068('0x33')]=_[_0x9068('0x35')](db[_0x9068('0x64')][_0x9068('0x30')]);_0x3fc045[_0x9068('0x34')]=_['keys'](_0x53673d[_0x9068('0x34')]);_0x3fc045[_0x9068('0x36')]=_[_0x9068('0x37')](_0x3fc045[_0x9068('0x33')],_0x3fc045[_0x9068('0x34')]);_0x2883fe[_0x9068('0x38')]=_[_0x9068('0x37')](_0x3fc045[_0x9068('0x33')],qs[_0x9068('0x39')](_0x53673d[_0x9068('0x34')][_0x9068('0x39')]));_0x2883fe[_0x9068('0x38')]=_0x2883fe[_0x9068('0x38')][_0x9068('0x4a')]?_0x2883fe[_0x9068('0x38')]:_0x3fc045[_0x9068('0x33')];_0x2883fe[_0x9068('0x3c')]=qs[_0x9068('0x3d')](_0x53673d[_0x9068('0x34')][_0x9068('0x3d')]);_0x2883fe[_0x9068('0x3e')]=qs[_0x9068('0x36')](_[_0x9068('0x3f')](_0x53673d[_0x9068('0x34')],_0x3fc045['filters']));if(_0x53673d[_0x9068('0x34')][_0x9068('0x42')]){_0x2883fe[_0x9068('0x3e')]=_['merge'](_0x2883fe[_0x9068('0x3e')],{'$or':_[_0x9068('0x2e')](_0x2883fe[_0x9068('0x38')],function(_0x284a4a){var _0x2ab2e6={};_0x2ab2e6[_0x284a4a]={'$like':'%'+_0x53673d['query']['filter']+'%'};return _0x2ab2e6;})});}_0x2883fe=_['merge']({},_0x2883fe,_0x53673d[_0x9068('0x43')]);return _0x3960b4['getTeams'](_0x2883fe);}})[_0x9068('0x28')](function(_0x16f5bc){if(_0x16f5bc){_0x1a2c52=_0x16f5bc[_0x9068('0x4a')];if(!_0x53673d['query'][_0x9068('0x3a')](_0x9068('0x3b'))){_0x2883fe['limit']=qs[_0x9068('0x22')](_0x53673d[_0x9068('0x34')]['limit']);_0x2883fe[_0x9068('0x21')]=qs[_0x9068('0x21')](_0x53673d['query'][_0x9068('0x21')]);}return _0x3960b4['getTeams'](_0x2883fe);}})['then'](function(_0x1fd463){if(_0x1fd463){return _0x1fd463?{'count':_0x1a2c52,'rows':_0x1fd463}:null;}})['then'](respondWithResult(_0x508861,null))[_0x9068('0x47')](handleError(_0x508861,null));};exports[_0x9068('0x65')]=function(_0x45eedb,_0xbc7800,_0x1874d1){var _0x2dd60c=_0x45eedb[_0x9068('0x4d')]['ids'];return db['Team'][_0x9068('0x45')]({'where':{'id':_0x2dd60c},'attributes':['id'],'include':[{'model':db[_0x9068('0x5a')],'as':_0x9068('0x66'),'attributes':['id',_0x9068('0x2b'),_0x9068('0x67'),_0x9068('0x68'),_0x9068('0x69')],'raw':!![]}]})['then'](function(_0x621de5){if(_0x621de5){var _0x30b5d9=_[_0x9068('0x6a')](_0x621de5,function(_0x925b93){var _0x37c68a=_0x925b93[_0x9068('0x57')]({'plain':!![]});return _0x37c68a['Agents'];});return db[_0x9068('0x2f')]['find']({'where':{'id':_0x45eedb[_0x9068('0x49')]['id']}})['then'](function(_0x172711){return db[_0x9068('0x6b')][_0x9068('0x6c')](function(_0xce8f63){return _0x172711[_0x9068('0x65')](_0x2dd60c,{'transaction':_0xce8f63})['then'](function(){return BPromise['each'](_0x30b5d9,function(_0xb38daa){return db[_0x9068('0x58')][_0x9068('0x6d')]({'where':{'UserId':_0xb38daa['id'],'OpenchannelQueueId':_0x45eedb['params']['id']},'transaction':_0xce8f63});});})[_0x9068('0x28')](function(){_0x30b5d9[_0x9068('0x6e')](function(_0x2f5a0d){socket[_0x9068('0x6f')](_0x9068('0x70'),{'UserId':_0x2f5a0d['id'],'OpenchannelQueueId':_0x172711['id']});});});});});}})[_0x9068('0x28')](respondWithStatusCode(_0xbc7800,null))[_0x9068('0x47')](handleError(_0xbc7800,null));};exports['removeTeams']=function(_0x337fc4,_0x33b52c,_0x48edcd){return db[_0x9068('0x64')]['findAll']({'where':{'id':_0x337fc4[_0x9068('0x34')]['ids']},'attributes':['id'],'include':[{'model':db[_0x9068('0x5a')],'as':_0x9068('0x66'),'attributes':['id'],'raw':!![]}]})[_0x9068('0x28')](handleEntityNotFound(_0x33b52c,null))['then'](function(_0x3998db){var _0x447150=_[_0x9068('0x2e')](_0x3998db,'id');var _0x31edfc=[];var _0x29c417=[];var _0x4468d5=squel['select']();_0x4468d5[_0x9068('0x71')]('tq.TeamId')['from'](_0x9068('0x72'),'tq')[_0x9068('0x73')](_0x9068('0x74'),'ut','ut.TeamId\x20=\x20tq.TeamId')[_0x9068('0x3e')](_0x9068('0x75'),_0x337fc4[_0x9068('0x49')]['id']);for(var _0x2b5df9=0x0;_0x2b5df9<_0x3998db[_0x9068('0x4a')];_0x2b5df9+=0x1){let _0x5d416e=_0x3998db[_0x2b5df9];for(var _0x2133b3=0x0;_0x2133b3<_0x5d416e[_0x9068('0x66')][_0x9068('0x4a')];_0x2133b3+=0x1){let _0x571a0b=_0x5d416e['Agents'][_0x2133b3];var _0x424b1a=_0x4468d5[_0x9068('0x76')]();_0x424b1a['where']('ut.UserId\x20=\x20?',_0x571a0b['id']);_0x29c417[_0x9068('0x77')](db[_0x9068('0x6b')][_0x9068('0x34')](_0x424b1a[_0x9068('0x78')](),{'type':db[_0x9068('0x6b')]['QueryTypes'][_0x9068('0x79')]})[_0x9068('0x28')](function(_0x33681f){if(_0x33681f['length']===0x1){return _0x571a0b['id'];}else{var _0x1484da=_['every'](_['map'](_0x33681f,'TeamId'),function(_0x2a6165){return _[_0x9068('0x7a')](_0x447150,_0x2a6165);});if(_0x1484da){return _0x571a0b['id'];}}}));}}return BPromise[_0x9068('0x7b')](_0x29c417)[_0x9068('0x28')](function(_0x1b041d){_0x31edfc=_(_0x31edfc)[_0x9068('0x7c')](_0x1b041d)[_0x9068('0x7d')]()[_0x9068('0x7e')]();return db[_0x9068('0x2f')][_0x9068('0x51')]({'where':{'id':_0x337fc4[_0x9068('0x49')]['id']}})[_0x9068('0x28')](function(_0x51be8f){return db[_0x9068('0x6b')][_0x9068('0x6c')](function(_0x317b09){return _0x51be8f['removeTeams'](_0x337fc4[_0x9068('0x34')]['ids'],{'transaction':_0x317b09})[_0x9068('0x28')](function(){if(!_[_0x9068('0x7f')](_0x31edfc)){return _0x51be8f[_0x9068('0x80')](_0x31edfc,{'transaction':_0x317b09});}})[_0x9068('0x28')](function(){_0x31edfc[_0x9068('0x6e')](function(_0x3f49eb){socket['emit']('userOpenchannelQueue:remove',{'UserId':_0x3f49eb,'OpenchannelQueueId':_0x51be8f['id']});});});});});});})[_0x9068('0x28')](respondWithStatusCode(_0x33b52c,null))[_0x9068('0x47')](handleError(_0x33b52c,null));};exports[_0x9068('0x81')]=function(_0x190a2a,_0x503beb,_0x1cd9b3){return db[_0x9068('0x2f')][_0x9068('0x51')]({'where':{'id':_0x190a2a[_0x9068('0x49')]['id']}})[_0x9068('0x28')](handleEntityNotFound(_0x503beb,null))[_0x9068('0x28')](function(_0x1a5b3a){if(_0x1a5b3a){return _0x1a5b3a[_0x9068('0x81')](_0x190a2a['body'][_0x9068('0x82')],_[_0x9068('0x83')](_0x190a2a[_0x9068('0x4d')],['ids','id'])||{})[_0x9068('0x84')](function(_0x3435eb){for(var _0x42dcff=0x0;_0x42dcff<_0x190a2a['body']['ids'][_0x9068('0x4a')];_0x42dcff+=0x1){socket[_0x9068('0x6f')]('userOpenchannelQueue:save',{'UserId':_0x190a2a[_0x9068('0x4d')][_0x9068('0x82')][_0x42dcff],'OpenchannelQueueId':_0x190a2a['params']['id']});}return _0x3435eb;});}})[_0x9068('0x28')](respondWithResult(_0x503beb,null))[_0x9068('0x47')](handleError(_0x503beb,null));};exports[_0x9068('0x80')]=function(_0x30c937,_0x3de51f,_0x7e5071){return db[_0x9068('0x2f')][_0x9068('0x51')]({'where':{'id':_0x30c937[_0x9068('0x49')]['id']}})[_0x9068('0x28')](handleEntityNotFound(_0x3de51f,null))[_0x9068('0x28')](function(_0x445bbf){if(_0x445bbf){return _0x445bbf[_0x9068('0x80')](_0x30c937['query'][_0x9068('0x82')])['then'](function(){if(_[_0x9068('0x85')](_0x30c937[_0x9068('0x34')][_0x9068('0x82')])){for(var _0x566ae9=0x0;_0x566ae9<_0x30c937[_0x9068('0x34')][_0x9068('0x82')]['length'];_0x566ae9+=0x1){socket[_0x9068('0x6f')](_0x9068('0x86'),{'UserId':Number(_0x30c937['query']['ids'][_0x566ae9]),'OpenchannelQueueId':Number(_0x30c937[_0x9068('0x49')]['id'])});}}else{socket[_0x9068('0x6f')](_0x9068('0x86'),{'UserId':Number(_0x30c937[_0x9068('0x34')]['ids']),'OpenchannelQueueId':Number(_0x30c937[_0x9068('0x49')]['id'])});}});}})[_0x9068('0x28')](respondWithStatusCode(_0x3de51f,null))[_0x9068('0x47')](handleError(_0x3de51f,null));};exports[_0x9068('0x87')]=function(_0x3f6273,_0x5d3615,_0x3dc4d7){var _0xeb5128={};var _0x35f3fd={};var _0x4b3336;var _0x43074b;return db[_0x9068('0x2f')]['findOne']({'where':{'id':_0x3f6273[_0x9068('0x49')]['id']}})[_0x9068('0x28')](handleEntityNotFound(_0x5d3615,null))['then'](function(_0x4df95e){if(_0x4df95e){_0x4b3336=_0x4df95e;_0x35f3fd[_0x9068('0x33')]=_['keys'](db['User'][_0x9068('0x30')]);_0x35f3fd['query']=_['keys'](_0x3f6273[_0x9068('0x34')]);_0x35f3fd[_0x9068('0x36')]=_['intersection'](_0x35f3fd[_0x9068('0x33')],_0x35f3fd[_0x9068('0x34')]);_0xeb5128[_0x9068('0x38')]=_[_0x9068('0x37')](_0x35f3fd[_0x9068('0x33')],qs[_0x9068('0x39')](_0x3f6273[_0x9068('0x34')][_0x9068('0x39')]));_0xeb5128[_0x9068('0x38')]=_0xeb5128[_0x9068('0x38')]['length']?_0xeb5128[_0x9068('0x38')]:_0x35f3fd['model'];_0xeb5128['order']=qs[_0x9068('0x3d')](_0x3f6273['query']['sort']);_0xeb5128[_0x9068('0x3e')]=qs[_0x9068('0x36')](_['pick'](_0x3f6273['query'],_0x35f3fd['filters']));if(_0x3f6273[_0x9068('0x34')][_0x9068('0x42')]){_0xeb5128[_0x9068('0x3e')]=_['merge'](_0xeb5128['where'],{'$or':_[_0x9068('0x2e')](_0xeb5128['attributes'],function(_0x1b98cc){var _0x1fca2a={};_0x1fca2a[_0x1b98cc]={'$like':'%'+_0x3f6273['query']['filter']+'%'};return _0x1fca2a;})});}_0xeb5128=_['merge']({},_0xeb5128,_0x3f6273[_0x9068('0x43')]);return _0x4b3336[_0x9068('0x87')](_0xeb5128);}})[_0x9068('0x28')](function(_0x1efbd6){if(_0x1efbd6){_0x43074b=_0x1efbd6[_0x9068('0x4a')];if(!_0x3f6273[_0x9068('0x34')][_0x9068('0x3a')]('nolimit')){_0xeb5128[_0x9068('0x22')]=qs['limit'](_0x3f6273[_0x9068('0x34')]['limit']);_0xeb5128[_0x9068('0x21')]=qs[_0x9068('0x21')](_0x3f6273[_0x9068('0x34')]['offset']);}return _0x4b3336[_0x9068('0x87')](_0xeb5128);}})[_0x9068('0x28')](function(_0xc5f95f){if(_0xc5f95f){return _0xc5f95f?{'count':_0x43074b,'rows':_0xc5f95f}:null;}})['then'](respondWithResult(_0x5d3615,null))[_0x9068('0x47')](handleError(_0x5d3615,null));}; \ No newline at end of file diff --git a/server/api/openchannelQueue/openchannelQueue.events.js b/server/api/openchannelQueue/openchannelQueue.events.js index 4b07172..c0976f1 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 _0x368b=['hook','exports','events','../../mysqldb','setMaxListeners','save','update','emit','hasOwnProperty'];(function(_0xed9fea,_0x5ed774){var _0x198f12=function(_0xfb85f6){while(--_0xfb85f6){_0xed9fea['push'](_0xed9fea['shift']());}};_0x198f12(++_0x5ed774);}(_0x368b,0xd1));var _0xb368=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x368b[_0x3dd15e];return _0x231fd0;};'use strict';var EventEmitter=require(_0xb368('0x0'));var OpenchannelQueue=require(_0xb368('0x1'))['db']['OpenchannelQueue'];var OpenchannelQueueEvents=new EventEmitter();OpenchannelQueueEvents[_0xb368('0x2')](0x0);var events={'afterCreate':_0xb368('0x3'),'afterUpdate':_0xb368('0x4'),'afterDestroy':'remove'};function emitEvent(_0x15d797){return function(_0x120f73,_0x3d71ad,_0x180a0b){OpenchannelQueueEvents[_0xb368('0x5')](_0x15d797+':'+_0x120f73['id'],_0x120f73);OpenchannelQueueEvents['emit'](_0x15d797,_0x120f73);_0x180a0b(null);};}for(var e in events){if(events[_0xb368('0x6')](e)){var event=events[e];OpenchannelQueue[_0xb368('0x7')](e,emitEvent(event));}}module[_0xb368('0x8')]=OpenchannelQueueEvents; \ No newline at end of file +var _0x6d68=['emit','hasOwnProperty','hook','exports','events','../../mysqldb','setMaxListeners','save','remove'];(function(_0x4c051d,_0x16ce1b){var _0x53d608=function(_0x4bbddc){while(--_0x4bbddc){_0x4c051d['push'](_0x4c051d['shift']());}};_0x53d608(++_0x16ce1b);}(_0x6d68,0x70));var _0x86d6=function(_0xc8a8b,_0x19c9ae){_0xc8a8b=_0xc8a8b-0x0;var _0x3a04ca=_0x6d68[_0xc8a8b];return _0x3a04ca;};'use strict';var EventEmitter=require(_0x86d6('0x0'));var OpenchannelQueue=require(_0x86d6('0x1'))['db']['OpenchannelQueue'];var OpenchannelQueueEvents=new EventEmitter();OpenchannelQueueEvents[_0x86d6('0x2')](0x0);var events={'afterCreate':_0x86d6('0x3'),'afterUpdate':'update','afterDestroy':_0x86d6('0x4')};function emitEvent(_0x5b7abd){return function(_0x268599,_0x5c779e,_0x4b3f28){OpenchannelQueueEvents[_0x86d6('0x5')](_0x5b7abd+':'+_0x268599['id'],_0x268599);OpenchannelQueueEvents[_0x86d6('0x5')](_0x5b7abd,_0x268599);_0x4b3f28(null);};}for(var e in events){if(events[_0x86d6('0x6')](e)){var event=events[e];OpenchannelQueue[_0x86d6('0x7')](e,emitEvent(event));}}module[_0x86d6('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 6d18b2f..9d3a0d1 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 _0x7136=['openchannel_queues','util','../../config/logger','api','bluebird','request-promise','path','rimraf','../../config/environment','./openchannelQueue.attributes','exports','define','OpenchannelQueue'];(function(_0x3f8c3c,_0x2bbdc0){var _0x564e29=function(_0x447932){while(--_0x447932){_0x3f8c3c['push'](_0x3f8c3c['shift']());}};_0x564e29(++_0x2bbdc0);}(_0x7136,0x90));var _0x6713=function(_0x503381,_0x1f0a62){_0x503381=_0x503381-0x0;var _0x5ebe5a=_0x7136[_0x503381];return _0x5ebe5a;};'use strict';var _=require('lodash');var util=require(_0x6713('0x0'));var logger=require(_0x6713('0x1'))(_0x6713('0x2'));var moment=require('moment');var BPromise=require(_0x6713('0x3'));var rp=require(_0x6713('0x4'));var fs=require('fs');var path=require(_0x6713('0x5'));var rimraf=require(_0x6713('0x6'));var config=require(_0x6713('0x7'));var attributes=require(_0x6713('0x8'));module[_0x6713('0x9')]=function(_0x13adc7,_0x3b3523){return _0x13adc7[_0x6713('0xa')](_0x6713('0xb'),attributes,{'tableName':_0x6713('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x3aaf=['bluebird','request-promise','path','rimraf','../../config/environment','./openchannelQueue.attributes','exports','define','OpenchannelQueue','util','../../config/logger','api','moment'];(function(_0x1f2128,_0x1c0556){var _0xdca632=function(_0x446359){while(--_0x446359){_0x1f2128['push'](_0x1f2128['shift']());}};_0xdca632(++_0x1c0556);}(_0x3aaf,0xbf));var _0xf3aa=function(_0xae7c2f,_0xf31e04){_0xae7c2f=_0xae7c2f-0x0;var _0x5d7001=_0x3aaf[_0xae7c2f];return _0x5d7001;};'use strict';var _=require('lodash');var util=require(_0xf3aa('0x0'));var logger=require(_0xf3aa('0x1'))(_0xf3aa('0x2'));var moment=require(_0xf3aa('0x3'));var BPromise=require(_0xf3aa('0x4'));var rp=require(_0xf3aa('0x5'));var fs=require('fs');var path=require(_0xf3aa('0x6'));var rimraf=require(_0xf3aa('0x7'));var config=require(_0xf3aa('0x8'));var attributes=require(_0xf3aa('0x9'));module[_0xf3aa('0xa')]=function(_0x103476,_0x271a64){return _0x103476[_0xf3aa('0xb')](_0xf3aa('0xc'),attributes,{'tableName':'openchannel_queues','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/openchannelQueue/openchannelQueue.rpc.js b/server/api/openchannelQueue/openchannelQueue.rpc.js index a29a19c..0d86927 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 _0x91a8=['http','redis','localhost','OpenchannelQueue,\x20%s,\x20%s','request\x20sent','debug','OpenchannelQueue,\x20%s,\x20%s,\x20%s','error','code','message','catch','GetOpenchannelQueue','OpenchannelQueue','options','raw','where','attributes','include','model','map','then','info','stringify','ShowOpenchannelQueue','find','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise'];(function(_0x436ee9,_0x428d0b){var _0x43878f=function(_0x466640){while(--_0x466640){_0x436ee9['push'](_0x436ee9['shift']());}};_0x43878f(++_0x428d0b);}(_0x91a8,0x154));var _0x891a=function(_0x257642,_0x270a80){_0x257642=_0x257642-0x0;var _0x3d813b=_0x91a8[_0x257642];return _0x3d813b;};'use strict';var _=require(_0x891a('0x0'));var util=require(_0x891a('0x1'));var moment=require(_0x891a('0x2'));var BPromise=require(_0x891a('0x3'));var rs=require(_0x891a('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x891a('0x5'))['db'];var utils=require(_0x891a('0x6'));var logger=require(_0x891a('0x7'))('rpc');var config=require(_0x891a('0x8'));var jayson=require(_0x891a('0x9'));var client=jayson['client'][_0x891a('0xa')]({'port':0x232a});config[_0x891a('0xb')]=_['defaults'](config[_0x891a('0xb')],{'host':_0x891a('0xc'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x891a('0xb')]));require('./openchannelQueue.socket')['register'](socket);function respondWithRpcPromise(_0x347764,_0x13a5c5,_0x47437b){return new BPromise(function(_0xe6e510,_0x523c5a){return client['request'](_0x347764,_0x47437b)['then'](function(_0x5a2d68){logger['info'](_0x891a('0xd'),_0x13a5c5,_0x891a('0xe'));logger[_0x891a('0xf')](_0x891a('0x10'),_0x13a5c5,'request\x20sent',JSON['stringify'](_0x5a2d68));if(_0x5a2d68[_0x891a('0x11')]){if(_0x5a2d68[_0x891a('0x11')][_0x891a('0x12')]===0x1f4){logger[_0x891a('0x11')]('OpenchannelQueue,\x20%s,\x20%s',_0x13a5c5,_0x5a2d68['error']['message']);return _0x523c5a(_0x5a2d68[_0x891a('0x11')][_0x891a('0x13')]);}logger[_0x891a('0x11')]('OpenchannelQueue,\x20%s,\x20%s',_0x13a5c5,_0x5a2d68[_0x891a('0x11')][_0x891a('0x13')]);return _0xe6e510(_0x5a2d68[_0x891a('0x11')][_0x891a('0x13')]);}else{logger['info']('OpenchannelQueue,\x20%s,\x20%s',_0x13a5c5,_0x891a('0xe'));_0xe6e510(_0x5a2d68['result'][_0x891a('0x13')]);}})[_0x891a('0x14')](function(_0x1889eb){logger['error'](_0x891a('0xd'),_0x13a5c5,_0x1889eb);_0x523c5a(_0x1889eb);});});}exports[_0x891a('0x15')]=function(_0x44fc76){var _0x1f8a99=this;return new Promise(function(_0x4b5e4a,_0x26dbf3){return db[_0x891a('0x16')]['findAll']({'raw':_0x44fc76['options']?_0x44fc76[_0x891a('0x17')][_0x891a('0x18')]===undefined?!![]:![]:!![],'where':_0x44fc76[_0x891a('0x17')]?_0x44fc76[_0x891a('0x17')][_0x891a('0x19')]||null:null,'attributes':_0x44fc76[_0x891a('0x17')]?_0x44fc76[_0x891a('0x17')][_0x891a('0x1a')]||null:null,'limit':_0x44fc76['options']?_0x44fc76['options']['limit']||null:null,'include':_0x44fc76['options']?_0x44fc76[_0x891a('0x17')][_0x891a('0x1b')]?_['map'](_0x44fc76[_0x891a('0x17')][_0x891a('0x1b')],function(_0x108cfd){return{'model':db[_0x108cfd['model']],'as':_0x108cfd['as'],'attributes':_0x108cfd[_0x891a('0x1a')],'include':_0x108cfd[_0x891a('0x1b')]?_['map'](_0x108cfd['include'],function(_0x542da4){return{'model':db[_0x542da4[_0x891a('0x1c')]],'as':_0x542da4['as'],'attributes':_0x542da4[_0x891a('0x1a')],'include':_0x542da4[_0x891a('0x1b')]?_[_0x891a('0x1d')](_0x542da4[_0x891a('0x1b')],function(_0x1e1209){return{'model':db[_0x1e1209[_0x891a('0x1c')]],'as':_0x1e1209['as'],'attributes':_0x1e1209[_0x891a('0x1a')]};}):[]};}):[]};}):[]:[]})[_0x891a('0x1e')](function(_0x563f24){logger[_0x891a('0x1f')](_0x891a('0x15'),_0x44fc76);logger[_0x891a('0xf')]('GetOpenchannelQueue',_0x44fc76,JSON[_0x891a('0x20')](_0x563f24));_0x4b5e4a(_0x563f24);})['catch'](function(_0x15e4de){logger[_0x891a('0x11')](_0x891a('0x15'),_0x15e4de['message'],_0x44fc76);_0x26dbf3(_0x1f8a99[_0x891a('0x11')](0x1f4,_0x15e4de[_0x891a('0x13')]));});});};exports[_0x891a('0x21')]=function(_0x15420e){var _0xc0df1e=this;return new Promise(function(_0x272193,_0x3f7517){return db['OpenchannelQueue'][_0x891a('0x22')]({'raw':_0x15420e['options']?_0x15420e[_0x891a('0x17')]['raw']===undefined?!![]:![]:!![],'where':_0x15420e[_0x891a('0x17')]?_0x15420e[_0x891a('0x17')][_0x891a('0x19')]||null:null,'attributes':_0x15420e[_0x891a('0x17')]?_0x15420e[_0x891a('0x17')][_0x891a('0x1a')]||null:null,'include':_0x15420e[_0x891a('0x17')]?_0x15420e['options'][_0x891a('0x1b')]?_[_0x891a('0x1d')](_0x15420e[_0x891a('0x17')]['include'],function(_0x176571){return{'model':db[_0x176571[_0x891a('0x1c')]],'as':_0x176571['as'],'attributes':_0x176571[_0x891a('0x1a')],'include':_0x176571[_0x891a('0x1b')]?_[_0x891a('0x1d')](_0x176571[_0x891a('0x1b')],function(_0x525cb7){return{'model':db[_0x525cb7[_0x891a('0x1c')]],'as':_0x525cb7['as'],'attributes':_0x525cb7[_0x891a('0x1a')],'include':_0x525cb7[_0x891a('0x1b')]?_[_0x891a('0x1d')](_0x525cb7[_0x891a('0x1b')],function(_0x2ce91a){return{'model':db[_0x2ce91a[_0x891a('0x1c')]],'as':_0x2ce91a['as'],'attributes':_0x2ce91a[_0x891a('0x1a')]};}):[]};}):[]};}):[]:[]})[_0x891a('0x1e')](function(_0x12f49d){logger['info'](_0x891a('0x21'),_0x15420e);logger[_0x891a('0xf')](_0x891a('0x21'),_0x15420e,JSON[_0x891a('0x20')](_0x12f49d));_0x272193(_0x12f49d);})['catch'](function(_0x514a0b){logger[_0x891a('0x11')](_0x891a('0x21'),_0x514a0b[_0x891a('0x13')],_0x15420e);_0x3f7517(_0xc0df1e[_0x891a('0x11')](0x1f4,_0x514a0b[_0x891a('0x13')]));});});}; \ No newline at end of file +var _0xef34=['OpenchannelQueue,\x20%s,\x20%s','request\x20sent','debug','OpenchannelQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','OpenchannelQueue','findAll','options','raw','where','attributes','limit','include','model','map','GetOpenchannelQueue','catch','ShowOpenchannelQueue','lodash','util','moment','bluebird','randomstring','../../config/utils','../../config/logger','jayson/promise','client','redis','defaults','socket.io-emitter','./openchannelQueue.socket','register','request','then','info'];(function(_0x27414a,_0x2564e8){var _0x452e47=function(_0x454030){while(--_0x454030){_0x27414a['push'](_0x27414a['shift']());}};_0x452e47(++_0x2564e8);}(_0xef34,0xb2));var _0x4ef3=function(_0x2af9d1,_0x459dc0){_0x2af9d1=_0x2af9d1-0x0;var _0x27939e=_0xef34[_0x2af9d1];return _0x27939e;};'use strict';var _=require(_0x4ef3('0x0'));var util=require(_0x4ef3('0x1'));var moment=require(_0x4ef3('0x2'));var BPromise=require(_0x4ef3('0x3'));var rs=require(_0x4ef3('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x4ef3('0x5'));var logger=require(_0x4ef3('0x6'))('rpc');var config=require('../../config/environment');var jayson=require(_0x4ef3('0x7'));var client=jayson[_0x4ef3('0x8')]['http']({'port':0x232a});config[_0x4ef3('0x9')]=_[_0x4ef3('0xa')](config[_0x4ef3('0x9')],{'host':'localhost','port':0x18eb});var socket=require(_0x4ef3('0xb'))(new Redis(config[_0x4ef3('0x9')]));require(_0x4ef3('0xc'))[_0x4ef3('0xd')](socket);function respondWithRpcPromise(_0xc1207a,_0x574ef8,_0x51e830){return new BPromise(function(_0x2cdb6c,_0x3f05f7){return client[_0x4ef3('0xe')](_0xc1207a,_0x51e830)[_0x4ef3('0xf')](function(_0x28f252){logger[_0x4ef3('0x10')](_0x4ef3('0x11'),_0x574ef8,_0x4ef3('0x12'));logger[_0x4ef3('0x13')](_0x4ef3('0x14'),_0x574ef8,_0x4ef3('0x12'),JSON[_0x4ef3('0x15')](_0x28f252));if(_0x28f252[_0x4ef3('0x16')]){if(_0x28f252['error'][_0x4ef3('0x17')]===0x1f4){logger[_0x4ef3('0x16')](_0x4ef3('0x11'),_0x574ef8,_0x28f252[_0x4ef3('0x16')][_0x4ef3('0x18')]);return _0x3f05f7(_0x28f252[_0x4ef3('0x16')][_0x4ef3('0x18')]);}logger[_0x4ef3('0x16')](_0x4ef3('0x11'),_0x574ef8,_0x28f252['error']['message']);return _0x2cdb6c(_0x28f252[_0x4ef3('0x16')][_0x4ef3('0x18')]);}else{logger[_0x4ef3('0x10')](_0x4ef3('0x11'),_0x574ef8,_0x4ef3('0x12'));_0x2cdb6c(_0x28f252[_0x4ef3('0x19')][_0x4ef3('0x18')]);}})['catch'](function(_0x213a4f){logger[_0x4ef3('0x16')]('OpenchannelQueue,\x20%s,\x20%s',_0x574ef8,_0x213a4f);_0x3f05f7(_0x213a4f);});});}exports['GetOpenchannelQueue']=function(_0x51140a){var _0x1b7437=this;return new Promise(function(_0x1fe9be,_0x4d6ec0){return db[_0x4ef3('0x1a')][_0x4ef3('0x1b')]({'raw':_0x51140a[_0x4ef3('0x1c')]?_0x51140a[_0x4ef3('0x1c')][_0x4ef3('0x1d')]===undefined?!![]:![]:!![],'where':_0x51140a['options']?_0x51140a['options'][_0x4ef3('0x1e')]||null:null,'attributes':_0x51140a[_0x4ef3('0x1c')]?_0x51140a[_0x4ef3('0x1c')][_0x4ef3('0x1f')]||null:null,'limit':_0x51140a['options']?_0x51140a[_0x4ef3('0x1c')][_0x4ef3('0x20')]||null:null,'include':_0x51140a[_0x4ef3('0x1c')]?_0x51140a[_0x4ef3('0x1c')][_0x4ef3('0x21')]?_['map'](_0x51140a[_0x4ef3('0x1c')][_0x4ef3('0x21')],function(_0x479693){return{'model':db[_0x479693[_0x4ef3('0x22')]],'as':_0x479693['as'],'attributes':_0x479693[_0x4ef3('0x1f')],'include':_0x479693['include']?_[_0x4ef3('0x23')](_0x479693[_0x4ef3('0x21')],function(_0x337f5d){return{'model':db[_0x337f5d['model']],'as':_0x337f5d['as'],'attributes':_0x337f5d[_0x4ef3('0x1f')],'include':_0x337f5d[_0x4ef3('0x21')]?_['map'](_0x337f5d[_0x4ef3('0x21')],function(_0x41dd0b){return{'model':db[_0x41dd0b[_0x4ef3('0x22')]],'as':_0x41dd0b['as'],'attributes':_0x41dd0b['attributes']};}):[]};}):[]};}):[]:[]})[_0x4ef3('0xf')](function(_0x4ce6f8){logger[_0x4ef3('0x10')](_0x4ef3('0x24'),_0x51140a);logger['debug'](_0x4ef3('0x24'),_0x51140a,JSON['stringify'](_0x4ce6f8));_0x1fe9be(_0x4ce6f8);})[_0x4ef3('0x25')](function(_0x22d3b3){logger[_0x4ef3('0x16')](_0x4ef3('0x24'),_0x22d3b3[_0x4ef3('0x18')],_0x51140a);_0x4d6ec0(_0x1b7437[_0x4ef3('0x16')](0x1f4,_0x22d3b3[_0x4ef3('0x18')]));});});};exports[_0x4ef3('0x26')]=function(_0x56d4b2){var _0x1a3add=this;return new Promise(function(_0x193ce0,_0x9a9715){return db['OpenchannelQueue']['find']({'raw':_0x56d4b2[_0x4ef3('0x1c')]?_0x56d4b2[_0x4ef3('0x1c')][_0x4ef3('0x1d')]===undefined?!![]:![]:!![],'where':_0x56d4b2[_0x4ef3('0x1c')]?_0x56d4b2[_0x4ef3('0x1c')]['where']||null:null,'attributes':_0x56d4b2[_0x4ef3('0x1c')]?_0x56d4b2[_0x4ef3('0x1c')][_0x4ef3('0x1f')]||null:null,'include':_0x56d4b2[_0x4ef3('0x1c')]?_0x56d4b2['options'][_0x4ef3('0x21')]?_['map'](_0x56d4b2[_0x4ef3('0x1c')][_0x4ef3('0x21')],function(_0x3cdc68){return{'model':db[_0x3cdc68[_0x4ef3('0x22')]],'as':_0x3cdc68['as'],'attributes':_0x3cdc68[_0x4ef3('0x1f')],'include':_0x3cdc68[_0x4ef3('0x21')]?_['map'](_0x3cdc68[_0x4ef3('0x21')],function(_0xe245ba){return{'model':db[_0xe245ba[_0x4ef3('0x22')]],'as':_0xe245ba['as'],'attributes':_0xe245ba[_0x4ef3('0x1f')],'include':_0xe245ba[_0x4ef3('0x21')]?_[_0x4ef3('0x23')](_0xe245ba[_0x4ef3('0x21')],function(_0x2587ed){return{'model':db[_0x2587ed[_0x4ef3('0x22')]],'as':_0x2587ed['as'],'attributes':_0x2587ed[_0x4ef3('0x1f')]};}):[]};}):[]};}):[]:[]})[_0x4ef3('0xf')](function(_0x9c89b2){logger[_0x4ef3('0x10')](_0x4ef3('0x26'),_0x56d4b2);logger[_0x4ef3('0x13')](_0x4ef3('0x26'),_0x56d4b2,JSON[_0x4ef3('0x15')](_0x9c89b2));_0x193ce0(_0x9c89b2);})[_0x4ef3('0x25')](function(_0x13ed87){logger[_0x4ef3('0x16')](_0x4ef3('0x26'),_0x13ed87[_0x4ef3('0x18')],_0x56d4b2);_0x9a9715(_0x1a3add[_0x4ef3('0x16')](0x1f4,_0x13ed87[_0x4ef3('0x18')]));});});}; \ No newline at end of file diff --git a/server/api/openchannelQueue/openchannelQueue.socket.js b/server/api/openchannelQueue/openchannelQueue.socket.js index 7d19180..54af0d0 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 _0x8a72=['removeListener','register','openchannelQueue:','./openchannelQueue.events','save','update','emit'];(function(_0x19d4ad,_0x2a7c03){var _0x11c5bc=function(_0x43a6df){while(--_0x43a6df){_0x19d4ad['push'](_0x19d4ad['shift']());}};_0x11c5bc(++_0x2a7c03);}(_0x8a72,0x18b));var _0x28a7=function(_0x541310,_0x46d741){_0x541310=_0x541310-0x0;var _0x3a61af=_0x8a72[_0x541310];return _0x3a61af;};'use strict';var OpenchannelQueueEvents=require(_0x28a7('0x0'));var events=[_0x28a7('0x1'),'remove',_0x28a7('0x2')];function createListener(_0x3986dc,_0x18f2d3){return function(_0x3950a2){_0x18f2d3[_0x28a7('0x3')](_0x3986dc,_0x3950a2);};}function removeListener(_0x4c885f,_0x1742c2){return function(){OpenchannelQueueEvents[_0x28a7('0x4')](_0x4c885f,_0x1742c2);};}exports[_0x28a7('0x5')]=function(_0x1cb6be){for(var _0x4215b5=0x0,_0xa698dc=events['length'];_0x4215b5<_0xa698dc;_0x4215b5++){var _0x592157=events[_0x4215b5];var _0x34ce6c=createListener(_0x28a7('0x6')+_0x592157,_0x1cb6be);OpenchannelQueueEvents['on'](_0x592157,_0x34ce6c);}}; \ No newline at end of file +var _0xfecb=['update','emit','removeListener','register','length','openchannelQueue:','./openchannelQueue.events','save'];(function(_0xfa634c,_0x414e0e){var _0x73e478=function(_0xac2a51){while(--_0xac2a51){_0xfa634c['push'](_0xfa634c['shift']());}};_0x73e478(++_0x414e0e);}(_0xfecb,0xfe));var _0xbfec=function(_0x40741f,_0x3bf2fb){_0x40741f=_0x40741f-0x0;var _0xaa01dd=_0xfecb[_0x40741f];return _0xaa01dd;};'use strict';var OpenchannelQueueEvents=require(_0xbfec('0x0'));var events=[_0xbfec('0x1'),'remove',_0xbfec('0x2')];function createListener(_0x33efed,_0x2237ea){return function(_0x2ca5ac){_0x2237ea[_0xbfec('0x3')](_0x33efed,_0x2ca5ac);};}function removeListener(_0x26d37b,_0x4b88d6){return function(){OpenchannelQueueEvents[_0xbfec('0x4')](_0x26d37b,_0x4b88d6);};}exports[_0xbfec('0x5')]=function(_0x539911){for(var _0x49bedc=0x0,_0x456b96=events[_0xbfec('0x6')];_0x49bedc<_0x456b96;_0x49bedc++){var _0xb9af11=events[_0x49bedc];var _0x99c4e1=createListener(_0xbfec('0x7')+_0xb9af11,_0x539911);OpenchannelQueueEvents['on'](_0xb9af11,_0x99c4e1);}}; \ No newline at end of file diff --git a/server/api/openchannelQueueReport/index.js b/server/api/openchannelQueueReport/index.js index 54ecf13..954abfd 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 _0xa48a=['Router','../../components/interaction/service','./openchannelQueueReport.controller','get','isAuthenticated','describe','show','create','/:id','update','destroy','multer','connect-timeout','express'];(function(_0x4067ac,_0x363603){var _0x53d74d=function(_0x492ad4){while(--_0x492ad4){_0x4067ac['push'](_0x4067ac['shift']());}};_0x53d74d(++_0x363603);}(_0xa48a,0xf9));var _0xaa48=function(_0x44d48c,_0x31028b){_0x44d48c=_0x44d48c-0x0;var _0x34e495=_0xa48a[_0x44d48c];return _0x34e495;};'use strict';var multer=require(_0xaa48('0x0'));var util=require('util');var path=require('path');var timeout=require(_0xaa48('0x1'));var express=require(_0xaa48('0x2'));var router=express[_0xaa48('0x3')]();var auth=require('../../components/auth/service');var interaction=require(_0xaa48('0x4'));var config=require('../../config/environment');var controller=require(_0xaa48('0x5'));router[_0xaa48('0x6')]('/',auth[_0xaa48('0x7')](),controller['index']);router[_0xaa48('0x6')]('/describe',auth['isAuthenticated'](),controller[_0xaa48('0x8')]);router[_0xaa48('0x6')]('/:id',auth[_0xaa48('0x7')](),controller[_0xaa48('0x9')]);router['post']('/',auth['isAuthenticated'](),controller[_0xaa48('0xa')]);router['put'](_0xaa48('0xb'),auth['isAuthenticated'](),controller[_0xaa48('0xc')]);router['delete'](_0xaa48('0xb'),auth['isAuthenticated'](),controller[_0xaa48('0xd')]);module['exports']=router; \ No newline at end of file +var _0xf89f=['util','path','connect-timeout','express','../../components/interaction/service','../../config/environment','index','get','/describe','isAuthenticated','describe','/:id','post','create','update','delete','multer'];(function(_0x2f2762,_0x581784){var _0x4d175b=function(_0x435ed4){while(--_0x435ed4){_0x2f2762['push'](_0x2f2762['shift']());}};_0x4d175b(++_0x581784);}(_0xf89f,0xed));var _0xff89=function(_0x20b618,_0x9508b2){_0x20b618=_0x20b618-0x0;var _0x49478b=_0xf89f[_0x20b618];return _0x49478b;};'use strict';var multer=require(_0xff89('0x0'));var util=require(_0xff89('0x1'));var path=require(_0xff89('0x2'));var timeout=require(_0xff89('0x3'));var express=require(_0xff89('0x4'));var router=express['Router']();var auth=require('../../components/auth/service');var interaction=require(_0xff89('0x5'));var config=require(_0xff89('0x6'));var controller=require('./openchannelQueueReport.controller');router['get']('/',auth['isAuthenticated'](),controller[_0xff89('0x7')]);router[_0xff89('0x8')](_0xff89('0x9'),auth[_0xff89('0xa')](),controller[_0xff89('0xb')]);router[_0xff89('0x8')](_0xff89('0xc'),auth[_0xff89('0xa')](),controller['show']);router[_0xff89('0xd')]('/',auth['isAuthenticated'](),controller[_0xff89('0xe')]);router['put'](_0xff89('0xc'),auth[_0xff89('0xa')](),controller[_0xff89('0xf')]);router[_0xff89('0x10')](_0xff89('0xc'),auth[_0xff89('0xa')](),controller['destroy']);module['exports']=router; \ No newline at end of file diff --git a/server/api/openchannelQueueReport/openchannelQueueReport.attributes.js b/server/api/openchannelQueueReport/openchannelQueueReport.attributes.js index cb562db..f81b07b 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 _0xca22=['DATE','sequelize','exports','STRING'];(function(_0x4bc96b,_0x20b592){var _0x50e202=function(_0x5e5c3d){while(--_0x5e5c3d){_0x4bc96b['push'](_0x4bc96b['shift']());}};_0x50e202(++_0x20b592);}(_0xca22,0x95));var _0x2ca2=function(_0x15b75c,_0x52f837){_0x15b75c=_0x15b75c-0x0;var _0x1fb570=_0xca22[_0x15b75c];return _0x1fb570;};'use strict';var moment=require('moment');var Sequelize=require(_0x2ca2('0x0'));module[_0x2ca2('0x1')]={'uniqueid':{'type':Sequelize[_0x2ca2('0x2')],'allowNull':![]},'from':{'type':Sequelize[_0x2ca2('0x2')]},'joinAt':{'type':Sequelize[_0x2ca2('0x3')]},'leaveAt':{'type':Sequelize['DATE']},'acceptAt':{'type':Sequelize[_0x2ca2('0x3')]},'exitAt':{'type':Sequelize[_0x2ca2('0x3')]},'reason':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x84a1=['exports','STRING','DATE','sequelize'];(function(_0x306f48,_0x1c0932){var _0x2aecaf=function(_0x56e2bf){while(--_0x56e2bf){_0x306f48['push'](_0x306f48['shift']());}};_0x2aecaf(++_0x1c0932);}(_0x84a1,0x11b));var _0x184a=function(_0x106415,_0x207eb8){_0x106415=_0x106415-0x0;var _0x3b708b=_0x84a1[_0x106415];return _0x3b708b;};'use strict';var moment=require('moment');var Sequelize=require(_0x184a('0x0'));module[_0x184a('0x1')]={'uniqueid':{'type':Sequelize[_0x184a('0x2')],'allowNull':![]},'from':{'type':Sequelize[_0x184a('0x2')]},'joinAt':{'type':Sequelize['DATE']},'leaveAt':{'type':Sequelize[_0x184a('0x3')]},'acceptAt':{'type':Sequelize[_0x184a('0x3')]},'exitAt':{'type':Sequelize[_0x184a('0x3')]},'reason':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/openchannelQueueReport/openchannelQueueReport.controller.js b/server/api/openchannelQueueReport/openchannelQueueReport.controller.js index 559969a..b46cd42 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 _0xc692=['moment','bluebird','mustache','util','path','sox','ejs','crypto','jsforce','desk.js','to-csv','querystring','papaparse','../../components/auth/service','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','status','end','offset','limit','json','save','then','sendStatus','error','stack','name','index','map','OpenchannelQueueReport','fieldName','type','key','filters','query','attributes','intersection','model','fields','length','hasOwnProperty','nolimit','sort','where','pick','filter','merge','VIRTUAL','options','count','findAll','rows','catch','keys','includeAll','include','create','body','update','params','destroy','find','describe','html-pdf','eml-format','rimraf','request-promise'];(function(_0x231974,_0x27d8e5){var _0x2fa46a=function(_0x296c23){while(--_0x296c23){_0x231974['push'](_0x231974['shift']());}};_0x2fa46a(++_0x27d8e5);}(_0xc692,0x15f));var _0x2c69=function(_0x3ff085,_0x27c92e){_0x3ff085=_0x3ff085-0x0;var _0x2b68c3=_0xc692[_0x3ff085];return _0x2b68c3;};'use strict';var pdf=require(_0x2c69('0x0'));var emlformat=require(_0x2c69('0x1'));var rimraf=require(_0x2c69('0x2'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x2c69('0x3'));var moment=require(_0x2c69('0x4'));var BPromise=require(_0x2c69('0x5'));var Mustache=require(_0x2c69('0x6'));var util=require(_0x2c69('0x7'));var path=require(_0x2c69('0x8'));var sox=require(_0x2c69('0x9'));var csv=require('to-csv');var ejs=require(_0x2c69('0xa'));var fs=require('fs');var _=require('lodash');var squel=require('squel');var crypto=require(_0x2c69('0xb'));var jsforce=require(_0x2c69('0xc'));var deskjs=require(_0x2c69('0xd'));var toCsv=require(_0x2c69('0xe'));var querystring=require(_0x2c69('0xf'));var Papa=require(_0x2c69('0x10'));var Redis=require('ioredis');var authService=require(_0x2c69('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0x2c69('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x2c69('0x13'))(_0x2c69('0x14'));var utils=require(_0x2c69('0x15'));var config=require(_0x2c69('0x16'));var db=require(_0x2c69('0x17'))['db'];function respondWithStatusCode(_0xa68f00,_0x5b16f3){_0x5b16f3=_0x5b16f3||0xcc;return function(_0x10fea1){if(_0x10fea1){return _0xa68f00['sendStatus'](_0x5b16f3);}return _0xa68f00[_0x2c69('0x18')](_0x5b16f3)[_0x2c69('0x19')]();};}function respondWithResult(_0x41ccbe,_0x2dca07){_0x2dca07=_0x2dca07||0xc8;return function(_0x37a24d){if(_0x37a24d){return _0x41ccbe[_0x2c69('0x18')](_0x2dca07)['json'](_0x37a24d);}};}function respondWithFilteredResult(_0x2d0df5,_0x5f0f52){return function(_0x53a478){if(_0x53a478){var _0x2b9bdd=_0x53a478['count'],_0x4cabe5=_0x5f0f52['offset'],_0x11649b=_0x5f0f52[_0x2c69('0x1a')]+_0x5f0f52[_0x2c69('0x1b')],_0x5f5bd5;if(_0x11649b>=_0x2b9bdd){_0x11649b=_0x2b9bdd;_0x5f5bd5=0xc8;}else{_0x5f5bd5=0xce;}_0x2d0df5[_0x2c69('0x18')](_0x5f5bd5);return _0x2d0df5['set']('Content-Range',_0x4cabe5+'-'+_0x11649b+'/'+_0x2b9bdd)[_0x2c69('0x1c')](_0x53a478);}return null;};}function patchUpdates(_0x3cd086){return function(_0x24fb39){try{jsonpatch['apply'](_0x24fb39,_0x3cd086,!![]);}catch(_0xd6c64){return BPromise['reject'](_0xd6c64);}return _0x24fb39[_0x2c69('0x1d')]();};}function saveUpdates(_0x6f3a7e,_0x1e83bf){return function(_0x10807e){if(_0x10807e){return _0x10807e['update'](_0x6f3a7e)[_0x2c69('0x1e')](function(_0x2ec1cd){return _0x2ec1cd;});}return null;};}function removeEntity(_0x224c3e,_0x5a5dc7){return function(_0x415c4b){if(_0x415c4b){return _0x415c4b['destroy']()['then'](function(){_0x224c3e[_0x2c69('0x18')](0xcc)[_0x2c69('0x19')]();});}};}function handleEntityNotFound(_0x3d72db,_0x4c8402){return function(_0x58f00f){if(!_0x58f00f){_0x3d72db[_0x2c69('0x1f')](0x194);}return _0x58f00f;};}function handleError(_0x39f7db,_0x244943){_0x244943=_0x244943||0x1f4;return function(_0x3784dd){logger[_0x2c69('0x20')](_0x3784dd[_0x2c69('0x21')]);if(_0x3784dd[_0x2c69('0x22')]){delete _0x3784dd[_0x2c69('0x22')];}_0x39f7db[_0x2c69('0x18')](_0x244943)['send'](_0x3784dd);};}exports[_0x2c69('0x23')]=function(_0xf114cc,_0x4a7ebf){var _0x1b29b8={},_0xd85b20={},_0x2238a9={'count':0x0,'rows':[]};var _0x4c6ebe=_[_0x2c69('0x24')](db[_0x2c69('0x25')]['rawAttributes'],function(_0x2ae236){return{'name':_0x2ae236[_0x2c69('0x26')],'type':_0x2ae236[_0x2c69('0x27')][_0x2c69('0x28')]};});_0xd85b20['model']=_[_0x2c69('0x24')](_0x4c6ebe,_0x2c69('0x22'));_0xd85b20['query']=_['keys'](_0xf114cc['query']);_0xd85b20[_0x2c69('0x29')]=_['intersection'](_0xd85b20['model'],_0xd85b20[_0x2c69('0x2a')]);_0x1b29b8[_0x2c69('0x2b')]=_[_0x2c69('0x2c')](_0xd85b20[_0x2c69('0x2d')],qs[_0x2c69('0x2e')](_0xf114cc['query'][_0x2c69('0x2e')]));_0x1b29b8[_0x2c69('0x2b')]=_0x1b29b8[_0x2c69('0x2b')][_0x2c69('0x2f')]?_0x1b29b8['attributes']:_0xd85b20[_0x2c69('0x2d')];if(!_0xf114cc[_0x2c69('0x2a')][_0x2c69('0x30')](_0x2c69('0x31'))){_0x1b29b8[_0x2c69('0x1b')]=qs['limit'](_0xf114cc[_0x2c69('0x2a')][_0x2c69('0x1b')]);_0x1b29b8[_0x2c69('0x1a')]=qs[_0x2c69('0x1a')](_0xf114cc[_0x2c69('0x2a')][_0x2c69('0x1a')]);}_0x1b29b8['order']=qs['sort'](_0xf114cc[_0x2c69('0x2a')][_0x2c69('0x32')]);_0x1b29b8[_0x2c69('0x33')]=qs['filters'](_[_0x2c69('0x34')](_0xf114cc[_0x2c69('0x2a')],_0xd85b20[_0x2c69('0x29')]));if(_0xf114cc['query'][_0x2c69('0x35')]){_0x1b29b8[_0x2c69('0x33')]=_[_0x2c69('0x36')](_0x1b29b8[_0x2c69('0x33')],{'$or':_[_0x2c69('0x24')](_0x4c6ebe,function(_0x4d22fc){if(_0x4d22fc[_0x2c69('0x27')]!==_0x2c69('0x37')){var _0x2f3e17={};_0x2f3e17[_0x4d22fc[_0x2c69('0x22')]]={'$like':'%'+_0xf114cc[_0x2c69('0x2a')]['filter']+'%'};return _0x2f3e17;}})});}_0x1b29b8=_[_0x2c69('0x36')]({},_0x1b29b8,_0xf114cc[_0x2c69('0x38')]);var _0x32190f={'where':_0x1b29b8[_0x2c69('0x33')]};return db[_0x2c69('0x25')][_0x2c69('0x39')](_0x32190f)[_0x2c69('0x1e')](function(_0x4744d4){_0x2238a9['count']=_0x4744d4;if(_0xf114cc[_0x2c69('0x2a')]['includeAll']){_0x1b29b8['include']=[{'all':!![]}];}return db['OpenchannelQueueReport'][_0x2c69('0x3a')](_0x1b29b8);})[_0x2c69('0x1e')](function(_0x5d8bc4){_0x2238a9[_0x2c69('0x3b')]=_0x5d8bc4;return _0x2238a9;})[_0x2c69('0x1e')](respondWithFilteredResult(_0x4a7ebf,_0x1b29b8))[_0x2c69('0x3c')](handleError(_0x4a7ebf,null));};exports['show']=function(_0x4e28ce,_0x29309c){var _0x23feb4={'raw':!![],'where':{'id':_0x4e28ce['params']['id']}},_0x563a54={};_0x563a54[_0x2c69('0x2d')]=_[_0x2c69('0x3d')](db[_0x2c69('0x25')]['rawAttributes']);_0x563a54[_0x2c69('0x2a')]=_[_0x2c69('0x3d')](_0x4e28ce[_0x2c69('0x2a')]);_0x563a54['filters']=_[_0x2c69('0x2c')](_0x563a54[_0x2c69('0x2d')],_0x563a54['query']);_0x23feb4[_0x2c69('0x2b')]=_[_0x2c69('0x2c')](_0x563a54[_0x2c69('0x2d')],qs['fields'](_0x4e28ce[_0x2c69('0x2a')]['fields']));_0x23feb4[_0x2c69('0x2b')]=_0x23feb4['attributes'][_0x2c69('0x2f')]?_0x23feb4[_0x2c69('0x2b')]:_0x563a54['model'];if(_0x4e28ce[_0x2c69('0x2a')][_0x2c69('0x3e')]){_0x23feb4[_0x2c69('0x3f')]=[{'all':!![]}];}_0x23feb4=_[_0x2c69('0x36')]({},_0x23feb4,_0x4e28ce[_0x2c69('0x38')]);return db[_0x2c69('0x25')]['find'](_0x23feb4)[_0x2c69('0x1e')](handleEntityNotFound(_0x29309c,null))['then'](respondWithResult(_0x29309c,null))[_0x2c69('0x3c')](handleError(_0x29309c,null));};exports[_0x2c69('0x40')]=function(_0x7eb056,_0x3ee734){return db['OpenchannelQueueReport'][_0x2c69('0x40')](_0x7eb056[_0x2c69('0x41')],{})['then'](respondWithResult(_0x3ee734,0xc9))['catch'](handleError(_0x3ee734,null));};exports[_0x2c69('0x42')]=function(_0x42e3cf,_0x115204){if(_0x42e3cf[_0x2c69('0x41')]['id']){delete _0x42e3cf[_0x2c69('0x41')]['id'];}return db['OpenchannelQueueReport']['find']({'where':{'id':_0x42e3cf[_0x2c69('0x43')]['id']}})[_0x2c69('0x1e')](handleEntityNotFound(_0x115204,null))['then'](saveUpdates(_0x42e3cf[_0x2c69('0x41')],null))[_0x2c69('0x1e')](respondWithResult(_0x115204,null))[_0x2c69('0x3c')](handleError(_0x115204,null));};exports[_0x2c69('0x44')]=function(_0x3b9ed2,_0x15808a){return db[_0x2c69('0x25')][_0x2c69('0x45')]({'where':{'id':_0x3b9ed2[_0x2c69('0x43')]['id']}})[_0x2c69('0x1e')](handleEntityNotFound(_0x15808a,null))[_0x2c69('0x1e')](removeEntity(_0x15808a,null))[_0x2c69('0x3c')](handleError(_0x15808a,null));};exports[_0x2c69('0x46')]=function(_0x3fa256,_0x2d3f94){return db['OpenchannelQueueReport'][_0x2c69('0x46')]()[_0x2c69('0x1e')](respondWithResult(_0x2d3f94,null))['catch'](handleError(_0x2d3f94,null));}; \ No newline at end of file +var _0xcd2f=['fields','hasOwnProperty','nolimit','limit','order','sort','where','pick','VIRTUAL','filter','merge','options','includeAll','include','findAll','catch','show','params','length','create','body','find','describe','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/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','sendStatus','end','status','json','count','offset','set','Content-Range','apply','reject','save','update','then','destroy','error','stack','name','send','index','OpenchannelQueueReport','rawAttributes','type','key','model','keys','query','filters','attributes','intersection'];(function(_0x4d501f,_0x522c9d){var _0x43c1ec=function(_0x41c253){while(--_0x41c253){_0x4d501f['push'](_0x4d501f['shift']());}};_0x43c1ec(++_0x522c9d);}(_0xcd2f,0xf8));var _0xfcd2=function(_0x45d3f0,_0x4be53f){_0x45d3f0=_0x45d3f0-0x0;var _0x314b79=_0xcd2f[_0x45d3f0];return _0x314b79;};'use strict';var pdf=require('html-pdf');var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0xfcd2('0x0'));var jsonpatch=require(_0xfcd2('0x1'));var rp=require(_0xfcd2('0x2'));var moment=require(_0xfcd2('0x3'));var BPromise=require(_0xfcd2('0x4'));var Mustache=require(_0xfcd2('0x5'));var util=require(_0xfcd2('0x6'));var path=require(_0xfcd2('0x7'));var sox=require('sox');var csv=require(_0xfcd2('0x8'));var ejs=require(_0xfcd2('0x9'));var fs=require('fs');var _=require(_0xfcd2('0xa'));var squel=require(_0xfcd2('0xb'));var crypto=require(_0xfcd2('0xc'));var jsforce=require(_0xfcd2('0xd'));var deskjs=require(_0xfcd2('0xe'));var toCsv=require(_0xfcd2('0x8'));var querystring=require(_0xfcd2('0xf'));var Papa=require(_0xfcd2('0x10'));var Redis=require(_0xfcd2('0x11'));var authService=require('../../components/auth/service');var qs=require(_0xfcd2('0x12'));var as=require(_0xfcd2('0x13'));var hardwareService=require(_0xfcd2('0x14'));var logger=require(_0xfcd2('0x15'))(_0xfcd2('0x16'));var utils=require('../../config/utils');var config=require('../../config/environment');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x5c4994,_0x5bff49){_0x5bff49=_0x5bff49||0xcc;return function(_0xdcfde9){if(_0xdcfde9){return _0x5c4994[_0xfcd2('0x17')](_0x5bff49);}return _0x5c4994['status'](_0x5bff49)[_0xfcd2('0x18')]();};}function respondWithResult(_0x50bbde,_0x5ad180){_0x5ad180=_0x5ad180||0xc8;return function(_0x50f44c){if(_0x50f44c){return _0x50bbde[_0xfcd2('0x19')](_0x5ad180)[_0xfcd2('0x1a')](_0x50f44c);}};}function respondWithFilteredResult(_0x5cfe83,_0x4baf2f){return function(_0x428cf3){if(_0x428cf3){var _0x4a2bcd=_0x428cf3[_0xfcd2('0x1b')],_0x1a9f8f=_0x4baf2f[_0xfcd2('0x1c')],_0x21d088=_0x4baf2f[_0xfcd2('0x1c')]+_0x4baf2f['limit'],_0x36a06d;if(_0x21d088>=_0x4a2bcd){_0x21d088=_0x4a2bcd;_0x36a06d=0xc8;}else{_0x36a06d=0xce;}_0x5cfe83[_0xfcd2('0x19')](_0x36a06d);return _0x5cfe83[_0xfcd2('0x1d')](_0xfcd2('0x1e'),_0x1a9f8f+'-'+_0x21d088+'/'+_0x4a2bcd)[_0xfcd2('0x1a')](_0x428cf3);}return null;};}function patchUpdates(_0x580184){return function(_0x17edd6){try{jsonpatch[_0xfcd2('0x1f')](_0x17edd6,_0x580184,!![]);}catch(_0x25371f){return BPromise[_0xfcd2('0x20')](_0x25371f);}return _0x17edd6[_0xfcd2('0x21')]();};}function saveUpdates(_0x273a2a,_0x266c86){return function(_0x55d8b0){if(_0x55d8b0){return _0x55d8b0[_0xfcd2('0x22')](_0x273a2a)[_0xfcd2('0x23')](function(_0x25e801){return _0x25e801;});}return null;};}function removeEntity(_0x457099,_0x2a06d4){return function(_0x37dafa){if(_0x37dafa){return _0x37dafa[_0xfcd2('0x24')]()[_0xfcd2('0x23')](function(){_0x457099[_0xfcd2('0x19')](0xcc)['end']();});}};}function handleEntityNotFound(_0x23104f,_0x50c0cc){return function(_0xedae7a){if(!_0xedae7a){_0x23104f[_0xfcd2('0x17')](0x194);}return _0xedae7a;};}function handleError(_0x4f220e,_0x567436){_0x567436=_0x567436||0x1f4;return function(_0x187ae5){logger[_0xfcd2('0x25')](_0x187ae5[_0xfcd2('0x26')]);if(_0x187ae5[_0xfcd2('0x27')]){delete _0x187ae5['name'];}_0x4f220e[_0xfcd2('0x19')](_0x567436)[_0xfcd2('0x28')](_0x187ae5);};}exports[_0xfcd2('0x29')]=function(_0x107ee7,_0x5881c4){var _0xaa0318={},_0x5a2b6b={},_0x9cf49a={'count':0x0,'rows':[]};var _0x22fe88=_['map'](db[_0xfcd2('0x2a')][_0xfcd2('0x2b')],function(_0x41ecc9){return{'name':_0x41ecc9['fieldName'],'type':_0x41ecc9[_0xfcd2('0x2c')][_0xfcd2('0x2d')]};});_0x5a2b6b[_0xfcd2('0x2e')]=_['map'](_0x22fe88,'name');_0x5a2b6b['query']=_[_0xfcd2('0x2f')](_0x107ee7[_0xfcd2('0x30')]);_0x5a2b6b[_0xfcd2('0x31')]=_['intersection'](_0x5a2b6b[_0xfcd2('0x2e')],_0x5a2b6b[_0xfcd2('0x30')]);_0xaa0318[_0xfcd2('0x32')]=_[_0xfcd2('0x33')](_0x5a2b6b[_0xfcd2('0x2e')],qs[_0xfcd2('0x34')](_0x107ee7[_0xfcd2('0x30')]['fields']));_0xaa0318['attributes']=_0xaa0318[_0xfcd2('0x32')]['length']?_0xaa0318[_0xfcd2('0x32')]:_0x5a2b6b[_0xfcd2('0x2e')];if(!_0x107ee7[_0xfcd2('0x30')][_0xfcd2('0x35')](_0xfcd2('0x36'))){_0xaa0318[_0xfcd2('0x37')]=qs[_0xfcd2('0x37')](_0x107ee7[_0xfcd2('0x30')][_0xfcd2('0x37')]);_0xaa0318['offset']=qs[_0xfcd2('0x1c')](_0x107ee7[_0xfcd2('0x30')][_0xfcd2('0x1c')]);}_0xaa0318[_0xfcd2('0x38')]=qs['sort'](_0x107ee7['query'][_0xfcd2('0x39')]);_0xaa0318[_0xfcd2('0x3a')]=qs[_0xfcd2('0x31')](_[_0xfcd2('0x3b')](_0x107ee7['query'],_0x5a2b6b[_0xfcd2('0x31')]));if(_0x107ee7[_0xfcd2('0x30')]['filter']){_0xaa0318[_0xfcd2('0x3a')]=_['merge'](_0xaa0318[_0xfcd2('0x3a')],{'$or':_['map'](_0x22fe88,function(_0x45c9a3){if(_0x45c9a3[_0xfcd2('0x2c')]!==_0xfcd2('0x3c')){var _0x4f7cb8={};_0x4f7cb8[_0x45c9a3[_0xfcd2('0x27')]]={'$like':'%'+_0x107ee7[_0xfcd2('0x30')][_0xfcd2('0x3d')]+'%'};return _0x4f7cb8;}})});}_0xaa0318=_[_0xfcd2('0x3e')]({},_0xaa0318,_0x107ee7[_0xfcd2('0x3f')]);var _0x3d96d3={'where':_0xaa0318[_0xfcd2('0x3a')]};return db[_0xfcd2('0x2a')][_0xfcd2('0x1b')](_0x3d96d3)[_0xfcd2('0x23')](function(_0x1e2f53){_0x9cf49a[_0xfcd2('0x1b')]=_0x1e2f53;if(_0x107ee7[_0xfcd2('0x30')][_0xfcd2('0x40')]){_0xaa0318[_0xfcd2('0x41')]=[{'all':!![]}];}return db[_0xfcd2('0x2a')][_0xfcd2('0x42')](_0xaa0318);})['then'](function(_0x111e5a){_0x9cf49a['rows']=_0x111e5a;return _0x9cf49a;})[_0xfcd2('0x23')](respondWithFilteredResult(_0x5881c4,_0xaa0318))[_0xfcd2('0x43')](handleError(_0x5881c4,null));};exports[_0xfcd2('0x44')]=function(_0x321ace,_0x4de28d){var _0x20f985={'raw':!![],'where':{'id':_0x321ace[_0xfcd2('0x45')]['id']}},_0x9ac487={};_0x9ac487[_0xfcd2('0x2e')]=_[_0xfcd2('0x2f')](db[_0xfcd2('0x2a')][_0xfcd2('0x2b')]);_0x9ac487[_0xfcd2('0x30')]=_['keys'](_0x321ace[_0xfcd2('0x30')]);_0x9ac487[_0xfcd2('0x31')]=_[_0xfcd2('0x33')](_0x9ac487[_0xfcd2('0x2e')],_0x9ac487[_0xfcd2('0x30')]);_0x20f985['attributes']=_[_0xfcd2('0x33')](_0x9ac487[_0xfcd2('0x2e')],qs[_0xfcd2('0x34')](_0x321ace[_0xfcd2('0x30')]['fields']));_0x20f985[_0xfcd2('0x32')]=_0x20f985[_0xfcd2('0x32')][_0xfcd2('0x46')]?_0x20f985[_0xfcd2('0x32')]:_0x9ac487[_0xfcd2('0x2e')];if(_0x321ace[_0xfcd2('0x30')][_0xfcd2('0x40')]){_0x20f985[_0xfcd2('0x41')]=[{'all':!![]}];}_0x20f985=_[_0xfcd2('0x3e')]({},_0x20f985,_0x321ace['options']);return db['OpenchannelQueueReport']['find'](_0x20f985)[_0xfcd2('0x23')](handleEntityNotFound(_0x4de28d,null))[_0xfcd2('0x23')](respondWithResult(_0x4de28d,null))[_0xfcd2('0x43')](handleError(_0x4de28d,null));};exports[_0xfcd2('0x47')]=function(_0x4e6647,_0x401ce1){return db[_0xfcd2('0x2a')][_0xfcd2('0x47')](_0x4e6647[_0xfcd2('0x48')],{})['then'](respondWithResult(_0x401ce1,0xc9))[_0xfcd2('0x43')](handleError(_0x401ce1,null));};exports[_0xfcd2('0x22')]=function(_0x36233a,_0x5b7954){if(_0x36233a[_0xfcd2('0x48')]['id']){delete _0x36233a[_0xfcd2('0x48')]['id'];}return db['OpenchannelQueueReport'][_0xfcd2('0x49')]({'where':{'id':_0x36233a['params']['id']}})['then'](handleEntityNotFound(_0x5b7954,null))[_0xfcd2('0x23')](saveUpdates(_0x36233a[_0xfcd2('0x48')],null))[_0xfcd2('0x23')](respondWithResult(_0x5b7954,null))[_0xfcd2('0x43')](handleError(_0x5b7954,null));};exports['destroy']=function(_0x258a57,_0x2bfc5e){return db[_0xfcd2('0x2a')]['find']({'where':{'id':_0x258a57[_0xfcd2('0x45')]['id']}})[_0xfcd2('0x23')](handleEntityNotFound(_0x2bfc5e,null))[_0xfcd2('0x23')](removeEntity(_0x2bfc5e,null))[_0xfcd2('0x43')](handleError(_0x2bfc5e,null));};exports[_0xfcd2('0x4a')]=function(_0xb7406b,_0x2c8177){return db[_0xfcd2('0x2a')][_0xfcd2('0x4a')]()[_0xfcd2('0x23')](respondWithResult(_0x2c8177,null))[_0xfcd2('0x43')](handleError(_0x2c8177,null));}; \ No newline at end of file diff --git a/server/api/openchannelQueueReport/openchannelQueueReport.model.js b/server/api/openchannelQueueReport/openchannelQueueReport.model.js index 1a3e827..0fd6ba4 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 _0x1d25=['exports','define','report_openchannel_queue','uniqueid','lodash','util','../../config/logger','api','moment','request-promise','path','../../config/environment','./openchannelQueueReport.attributes'];(function(_0x29d94e,_0xf386d6){var _0x106237=function(_0x327501){while(--_0x327501){_0x29d94e['push'](_0x29d94e['shift']());}};_0x106237(++_0xf386d6);}(_0x1d25,0xba));var _0x51d2=function(_0x3fe042,_0x1106f7){_0x3fe042=_0x3fe042-0x0;var _0x7d4a1f=_0x1d25[_0x3fe042];return _0x7d4a1f;};'use strict';var _=require(_0x51d2('0x0'));var util=require(_0x51d2('0x1'));var logger=require(_0x51d2('0x2'))(_0x51d2('0x3'));var moment=require(_0x51d2('0x4'));var BPromise=require('bluebird');var rp=require(_0x51d2('0x5'));var fs=require('fs');var path=require(_0x51d2('0x6'));var rimraf=require('rimraf');var config=require(_0x51d2('0x7'));var attributes=require(_0x51d2('0x8'));module[_0x51d2('0x9')]=function(_0x407091,_0x449fec){return _0x407091[_0x51d2('0xa')]('OpenchannelQueueReport',attributes,{'tableName':_0x51d2('0xb'),'paranoid':![],'indexes':[{'name':'uniqueid','fields':[_0x51d2('0xc')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x99e9=['./openchannelQueueReport.attributes','define','OpenchannelQueueReport','uniqueid','util','../../config/logger','api','moment','request-promise','path','rimraf'];(function(_0x701c5d,_0x47a566){var _0x617b08=function(_0x41409f){while(--_0x41409f){_0x701c5d['push'](_0x701c5d['shift']());}};_0x617b08(++_0x47a566);}(_0x99e9,0xb4));var _0x999e=function(_0x2136a6,_0x35af63){_0x2136a6=_0x2136a6-0x0;var _0x55b948=_0x99e9[_0x2136a6];return _0x55b948;};'use strict';var _=require('lodash');var util=require(_0x999e('0x0'));var logger=require(_0x999e('0x1'))(_0x999e('0x2'));var moment=require(_0x999e('0x3'));var BPromise=require('bluebird');var rp=require(_0x999e('0x4'));var fs=require('fs');var path=require(_0x999e('0x5'));var rimraf=require(_0x999e('0x6'));var config=require('../../config/environment');var attributes=require(_0x999e('0x7'));module['exports']=function(_0x25421f,_0x1bda0a){return _0x25421f[_0x999e('0x8')](_0x999e('0x9'),attributes,{'tableName':'report_openchannel_queue','paranoid':![],'indexes':[{'name':_0x999e('0xa'),'fields':[_0x999e('0xa')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/openchannelQueueReport/openchannelQueueReport.rpc.js b/server/api/openchannelQueueReport/openchannelQueueReport.rpc.js index c0bf0fa..96fa1bd 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 _0x11c8=['UpdateOpenchannelQueueReport','where','attributes','limit','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','request\x20sent','debug','stringify','error','code','message','info','OpenchannelQueueReport,\x20%s,\x20%s','catch','CreateOpenchannelQueueReport','OpenchannelQueueReport','body','options','raw','then'];(function(_0x971ba8,_0x426a3b){var _0x312350=function(_0x48a0fe){while(--_0x48a0fe){_0x971ba8['push'](_0x971ba8['shift']());}};_0x312350(++_0x426a3b);}(_0x11c8,0x19a));var _0x811c=function(_0x4459b8,_0x3271b8){_0x4459b8=_0x4459b8-0x0;var _0x4a4b07=_0x11c8[_0x4459b8];return _0x4a4b07;};'use strict';var _=require('lodash');var util=require(_0x811c('0x0'));var moment=require(_0x811c('0x1'));var BPromise=require('bluebird');var rs=require(_0x811c('0x2'));var fs=require('fs');var Redis=require(_0x811c('0x3'));var db=require(_0x811c('0x4'))['db'];var utils=require(_0x811c('0x5'));var logger=require(_0x811c('0x6'))(_0x811c('0x7'));var config=require('../../config/environment');var jayson=require(_0x811c('0x8'));var client=jayson[_0x811c('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x126cc2,_0x8af784,_0x13a95a){return new BPromise(function(_0x3e81ac,_0x57a92d){return client['request'](_0x126cc2,_0x13a95a)['then'](function(_0x5be7fc){logger['info']('OpenchannelQueueReport,\x20%s,\x20%s',_0x8af784,_0x811c('0xa'));logger[_0x811c('0xb')]('OpenchannelQueueReport,\x20%s,\x20%s,\x20%s',_0x8af784,_0x811c('0xa'),JSON[_0x811c('0xc')](_0x5be7fc));if(_0x5be7fc[_0x811c('0xd')]){if(_0x5be7fc[_0x811c('0xd')][_0x811c('0xe')]===0x1f4){logger['error']('OpenchannelQueueReport,\x20%s,\x20%s',_0x8af784,_0x5be7fc[_0x811c('0xd')]['message']);return _0x57a92d(_0x5be7fc[_0x811c('0xd')][_0x811c('0xf')]);}logger['error']('OpenchannelQueueReport,\x20%s,\x20%s',_0x8af784,_0x5be7fc[_0x811c('0xd')][_0x811c('0xf')]);return _0x3e81ac(_0x5be7fc[_0x811c('0xd')][_0x811c('0xf')]);}else{logger[_0x811c('0x10')](_0x811c('0x11'),_0x8af784,'request\x20sent');_0x3e81ac(_0x5be7fc['result'][_0x811c('0xf')]);}})[_0x811c('0x12')](function(_0x3b0895){logger[_0x811c('0xd')](_0x811c('0x11'),_0x8af784,_0x3b0895);_0x57a92d(_0x3b0895);});});}exports[_0x811c('0x13')]=function(_0xcefd63){var _0x36c8da=this;return new Promise(function(_0x179636,_0x503bbc){return db[_0x811c('0x14')]['create'](_0xcefd63[_0x811c('0x15')],{'raw':_0xcefd63[_0x811c('0x16')]?_0xcefd63['options'][_0x811c('0x17')]===undefined?!![]:![]:!![]})[_0x811c('0x18')](function(_0x3bcc6b){logger['info']('CreateOpenchannelQueueReport',_0xcefd63);logger['debug'](_0x811c('0x13'),_0xcefd63,JSON[_0x811c('0xc')](_0x3bcc6b));_0x179636(_0x3bcc6b);})[_0x811c('0x12')](function(_0x49562b){logger[_0x811c('0xd')](_0x811c('0x13'),_0x49562b[_0x811c('0xf')],_0xcefd63);_0x503bbc(_0x36c8da[_0x811c('0xd')](0x1f4,_0x49562b['message']));});});};exports[_0x811c('0x19')]=function(_0x456aa1){var _0xddb6d9=this;return new Promise(function(_0xc3fda,_0x29c61){return db[_0x811c('0x14')]['update'](_0x456aa1[_0x811c('0x15')],{'raw':_0x456aa1['options']?_0x456aa1[_0x811c('0x16')][_0x811c('0x17')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x456aa1[_0x811c('0x16')]?_0x456aa1[_0x811c('0x16')][_0x811c('0x1a')]||null:null,'attributes':_0x456aa1[_0x811c('0x16')]?_0x456aa1['options'][_0x811c('0x1b')]||null:null,'limit':_0x456aa1[_0x811c('0x16')]?_0x456aa1[_0x811c('0x16')][_0x811c('0x1c')]||null:null})[_0x811c('0x18')](function(_0x18f87a){logger['info'](_0x811c('0x19'),_0x456aa1);logger[_0x811c('0xb')]('UpdateOpenchannelQueueReport',_0x456aa1,JSON['stringify'](_0x18f87a));_0xc3fda(_0x18f87a);})[_0x811c('0x12')](function(_0x38d639){logger[_0x811c('0xd')]('UpdateOpenchannelQueueReport',_0x38d639[_0x811c('0xf')],_0x456aa1);_0x29c61(_0xddb6d9[_0x811c('0xd')](0x1f4,_0x38d639['message']));});});}; \ No newline at end of file +var _0xd824=['message','catch','CreateOpenchannelQueueReport','OpenchannelQueueReport','create','body','options','raw','then','debug','UpdateOpenchannelQueueReport','update','where','limit','lodash','util','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','client','request','info','OpenchannelQueueReport,\x20%s,\x20%s','request\x20sent','OpenchannelQueueReport,\x20%s,\x20%s,\x20%s','stringify','error'];(function(_0x3087e5,_0x1ac26f){var _0x462983=function(_0x3fd15b){while(--_0x3fd15b){_0x3087e5['push'](_0x3087e5['shift']());}};_0x462983(++_0x1ac26f);}(_0xd824,0xc2));var _0x4d82=function(_0x4a9fb1,_0x273043){_0x4a9fb1=_0x4a9fb1-0x0;var _0x348672=_0xd824[_0x4a9fb1];return _0x348672;};'use strict';var _=require(_0x4d82('0x0'));var util=require(_0x4d82('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x4d82('0x2'));var fs=require('fs');var Redis=require(_0x4d82('0x3'));var db=require(_0x4d82('0x4'))['db'];var utils=require(_0x4d82('0x5'));var logger=require(_0x4d82('0x6'))(_0x4d82('0x7'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x4d82('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x4b842f,_0x464caf,_0xb54db2){return new BPromise(function(_0x13d624,_0x5cccb6){return client[_0x4d82('0x9')](_0x4b842f,_0xb54db2)['then'](function(_0x5356cd){logger[_0x4d82('0xa')](_0x4d82('0xb'),_0x464caf,_0x4d82('0xc'));logger['debug'](_0x4d82('0xd'),_0x464caf,'request\x20sent',JSON[_0x4d82('0xe')](_0x5356cd));if(_0x5356cd[_0x4d82('0xf')]){if(_0x5356cd[_0x4d82('0xf')]['code']===0x1f4){logger['error'](_0x4d82('0xb'),_0x464caf,_0x5356cd[_0x4d82('0xf')][_0x4d82('0x10')]);return _0x5cccb6(_0x5356cd[_0x4d82('0xf')]['message']);}logger[_0x4d82('0xf')](_0x4d82('0xb'),_0x464caf,_0x5356cd[_0x4d82('0xf')]['message']);return _0x13d624(_0x5356cd[_0x4d82('0xf')]['message']);}else{logger[_0x4d82('0xa')]('OpenchannelQueueReport,\x20%s,\x20%s',_0x464caf,_0x4d82('0xc'));_0x13d624(_0x5356cd['result'][_0x4d82('0x10')]);}})[_0x4d82('0x11')](function(_0x461476){logger[_0x4d82('0xf')](_0x4d82('0xb'),_0x464caf,_0x461476);_0x5cccb6(_0x461476);});});}exports[_0x4d82('0x12')]=function(_0x258c59){var _0x217b72=this;return new Promise(function(_0x2f2127,_0x5ef783){return db[_0x4d82('0x13')][_0x4d82('0x14')](_0x258c59[_0x4d82('0x15')],{'raw':_0x258c59[_0x4d82('0x16')]?_0x258c59[_0x4d82('0x16')][_0x4d82('0x17')]===undefined?!![]:![]:!![]})[_0x4d82('0x18')](function(_0x64669c){logger[_0x4d82('0xa')](_0x4d82('0x12'),_0x258c59);logger[_0x4d82('0x19')]('CreateOpenchannelQueueReport',_0x258c59,JSON[_0x4d82('0xe')](_0x64669c));_0x2f2127(_0x64669c);})[_0x4d82('0x11')](function(_0x5e5bdf){logger[_0x4d82('0xf')](_0x4d82('0x12'),_0x5e5bdf[_0x4d82('0x10')],_0x258c59);_0x5ef783(_0x217b72[_0x4d82('0xf')](0x1f4,_0x5e5bdf[_0x4d82('0x10')]));});});};exports[_0x4d82('0x1a')]=function(_0x11c043){var _0x462258=this;return new Promise(function(_0x12feab,_0x2df104){return db[_0x4d82('0x13')][_0x4d82('0x1b')](_0x11c043[_0x4d82('0x15')],{'raw':_0x11c043[_0x4d82('0x16')]?_0x11c043[_0x4d82('0x16')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x11c043['options']?_0x11c043[_0x4d82('0x16')][_0x4d82('0x1c')]||null:null,'attributes':_0x11c043[_0x4d82('0x16')]?_0x11c043[_0x4d82('0x16')]['attributes']||null:null,'limit':_0x11c043[_0x4d82('0x16')]?_0x11c043[_0x4d82('0x16')][_0x4d82('0x1d')]||null:null})[_0x4d82('0x18')](function(_0x5ce98b){logger[_0x4d82('0xa')]('UpdateOpenchannelQueueReport',_0x11c043);logger['debug']('UpdateOpenchannelQueueReport',_0x11c043,JSON['stringify'](_0x5ce98b));_0x12feab(_0x5ce98b);})[_0x4d82('0x11')](function(_0x8cfbf1){logger[_0x4d82('0xf')]('UpdateOpenchannelQueueReport',_0x8cfbf1[_0x4d82('0x10')],_0x11c043);_0x2df104(_0x462258[_0x4d82('0xf')](0x1f4,_0x8cfbf1['message']));});});}; \ No newline at end of file diff --git a/server/api/openchannelTransferReport/index.js b/server/api/openchannelTransferReport/index.js index 5e36396..cdab83e 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(_0x420f2a,_0x2cc58d){var _0x28f802=function(_0x3329cc){while(--_0x3329cc){_0x420f2a['push'](_0x420f2a['shift']());}};_0x28f802(++_0x2cc58d);}(_0xa9e0,0x123));var _0x0a9e=function(_0x411add,_0x1aed38){_0x411add=_0x411add-0x0;var _0x238242=_0xa9e0[_0x411add];return _0x238242;};'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(_0x4bb145,_0x3e7d33){var _0x4db596=function(_0x144489){while(--_0x144489){_0x4bb145['push'](_0x4bb145['shift']());}};_0x4db596(++_0x3e7d33);}(_0xa9e0,0x123));var _0x0a9e=function(_0x3054be,_0x1bdc8b){_0x3054be=_0x3054be-0x0;var _0x3df150=_0xa9e0[_0x3054be];return _0x3df150;};'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 b689b36..456cd15 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 _0xe159=['exports','STRING','ENUM','account','agent','queue','DATE','moment','sequelize'];(function(_0x23b85e,_0x39b209){var _0x329756=function(_0x3418e1){while(--_0x3418e1){_0x23b85e['push'](_0x23b85e['shift']());}};_0x329756(++_0x39b209);}(_0xe159,0x8e));var _0x9e15=function(_0xfae23b,_0x2be4ba){_0xfae23b=_0xfae23b-0x0;var _0x200640=_0xe159[_0xfae23b];return _0x200640;};'use strict';var moment=require(_0x9e15('0x0'));var Sequelize=require(_0x9e15('0x1'));module[_0x9e15('0x2')]={'uniqueid':{'type':Sequelize[_0x9e15('0x3')],'allowNull':![]},'type':{'type':Sequelize[_0x9e15('0x4')](_0x9e15('0x5'),_0x9e15('0x6'),_0x9e15('0x7')),'allowNull':![],'defaultValue':_0x9e15('0x7')},'transferredAt':{'type':Sequelize[_0x9e15('0x8')],'allowNull':![],'defaultValue':Sequelize['NOW']}}; \ No newline at end of file +var _0x1b09=['STRING','ENUM','NOW','sequelize'];(function(_0x466f2e,_0x5e2a7f){var _0x22dfbb=function(_0x308bbf){while(--_0x308bbf){_0x466f2e['push'](_0x466f2e['shift']());}};_0x22dfbb(++_0x5e2a7f);}(_0x1b09,0xeb));var _0x91b0=function(_0x580238,_0x2adec2){_0x580238=_0x580238-0x0;var _0x3d5608=_0x1b09[_0x580238];return _0x3d5608;};'use strict';var moment=require('moment');var Sequelize=require(_0x91b0('0x0'));module['exports']={'uniqueid':{'type':Sequelize[_0x91b0('0x1')],'allowNull':![]},'type':{'type':Sequelize[_0x91b0('0x2')]('account','agent','queue'),'allowNull':![],'defaultValue':'queue'},'transferredAt':{'type':Sequelize['DATE'],'allowNull':![],'defaultValue':Sequelize[_0x91b0('0x3')]}}; \ No newline at end of file diff --git a/server/api/openchannelTransferReport/openchannelTransferReport.controller.js b/server/api/openchannelTransferReport/openchannelTransferReport.controller.js index 2efb97d..e2556e7 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 _0x0b20=['request-promise','moment','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','count','offset','limit','set','Content-Range','apply','reject','save','then','destroy','error','stack','name','send','index','map','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','where','pick','filter','VIRTUAL','merge','options','includeAll','rows','show','params','OpenchannelTransferReport','include','catch','create','body','update','find','describe','html-pdf','rimraf','zip-dir','fast-json-patch'];(function(_0x3b7d55,_0x5a46c7){var _0x4337eb=function(_0x42a7e7){while(--_0x42a7e7){_0x3b7d55['push'](_0x3b7d55['shift']());}};_0x4337eb(++_0x5a46c7);}(_0x0b20,0x1d0));var _0x00b2=function(_0x37d5b0,_0x365e44){_0x37d5b0=_0x37d5b0-0x0;var _0x425c54=_0x0b20[_0x37d5b0];return _0x425c54;};'use strict';var pdf=require(_0x00b2('0x0'));var emlformat=require('eml-format');var rimraf=require(_0x00b2('0x1'));var zipdir=require(_0x00b2('0x2'));var jsonpatch=require(_0x00b2('0x3'));var rp=require(_0x00b2('0x4'));var moment=require(_0x00b2('0x5'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x00b2('0x6'));var path=require(_0x00b2('0x7'));var sox=require(_0x00b2('0x8'));var csv=require(_0x00b2('0x9'));var ejs=require(_0x00b2('0xa'));var fs=require('fs');var _=require(_0x00b2('0xb'));var squel=require(_0x00b2('0xc'));var crypto=require(_0x00b2('0xd'));var jsforce=require(_0x00b2('0xe'));var deskjs=require(_0x00b2('0xf'));var toCsv=require(_0x00b2('0x9'));var querystring=require(_0x00b2('0x10'));var Papa=require('papaparse');var Redis=require(_0x00b2('0x11'));var authService=require(_0x00b2('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0x00b2('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x00b2('0x14'))(_0x00b2('0x15'));var utils=require(_0x00b2('0x16'));var config=require(_0x00b2('0x17'));var db=require(_0x00b2('0x18'))['db'];function respondWithStatusCode(_0x2f8ef8,_0x469cf2){_0x469cf2=_0x469cf2||0xcc;return function(_0x4b231b){if(_0x4b231b){return _0x2f8ef8[_0x00b2('0x19')](_0x469cf2);}return _0x2f8ef8[_0x00b2('0x1a')](_0x469cf2)[_0x00b2('0x1b')]();};}function respondWithResult(_0x351ea6,_0x330c03){_0x330c03=_0x330c03||0xc8;return function(_0x320cd5){if(_0x320cd5){return _0x351ea6['status'](_0x330c03)[_0x00b2('0x1c')](_0x320cd5);}};}function respondWithFilteredResult(_0x558ceb,_0x3eb8ba){return function(_0x1ecb72){if(_0x1ecb72){var _0x215852=_0x1ecb72[_0x00b2('0x1d')],_0x34199a=_0x3eb8ba[_0x00b2('0x1e')],_0x434c98=_0x3eb8ba['offset']+_0x3eb8ba[_0x00b2('0x1f')],_0x52ea09;if(_0x434c98>=_0x215852){_0x434c98=_0x215852;_0x52ea09=0xc8;}else{_0x52ea09=0xce;}_0x558ceb[_0x00b2('0x1a')](_0x52ea09);return _0x558ceb[_0x00b2('0x20')](_0x00b2('0x21'),_0x34199a+'-'+_0x434c98+'/'+_0x215852)[_0x00b2('0x1c')](_0x1ecb72);}return null;};}function patchUpdates(_0xff4e16){return function(_0x25ee59){try{jsonpatch[_0x00b2('0x22')](_0x25ee59,_0xff4e16,!![]);}catch(_0x3a0040){return BPromise[_0x00b2('0x23')](_0x3a0040);}return _0x25ee59[_0x00b2('0x24')]();};}function saveUpdates(_0x97cc62,_0x1dd378){return function(_0x41d8b4){if(_0x41d8b4){return _0x41d8b4['update'](_0x97cc62)[_0x00b2('0x25')](function(_0x1d72a1){return _0x1d72a1;});}return null;};}function removeEntity(_0xd16c6c,_0x3b04eb){return function(_0x143ce6){if(_0x143ce6){return _0x143ce6[_0x00b2('0x26')]()['then'](function(){_0xd16c6c[_0x00b2('0x1a')](0xcc)[_0x00b2('0x1b')]();});}};}function handleEntityNotFound(_0x2901f8,_0x5e4b51){return function(_0x3a4fac){if(!_0x3a4fac){_0x2901f8[_0x00b2('0x19')](0x194);}return _0x3a4fac;};}function handleError(_0x28cd7f,_0xd259e3){_0xd259e3=_0xd259e3||0x1f4;return function(_0x491a75){logger[_0x00b2('0x27')](_0x491a75[_0x00b2('0x28')]);if(_0x491a75[_0x00b2('0x29')]){delete _0x491a75['name'];}_0x28cd7f[_0x00b2('0x1a')](_0xd259e3)[_0x00b2('0x2a')](_0x491a75);};}exports[_0x00b2('0x2b')]=function(_0x299495,_0xe53eda){var _0x1d92f6={},_0x5eeeed={},_0x4a5a9b={'count':0x0,'rows':[]};var _0x5499f6=_[_0x00b2('0x2c')](db['OpenchannelTransferReport'][_0x00b2('0x2d')],function(_0x3bf818){return{'name':_0x3bf818[_0x00b2('0x2e')],'type':_0x3bf818[_0x00b2('0x2f')][_0x00b2('0x30')]};});_0x5eeeed[_0x00b2('0x31')]=_['map'](_0x5499f6,'name');_0x5eeeed[_0x00b2('0x32')]=_[_0x00b2('0x33')](_0x299495[_0x00b2('0x32')]);_0x5eeeed[_0x00b2('0x34')]=_[_0x00b2('0x35')](_0x5eeeed[_0x00b2('0x31')],_0x5eeeed[_0x00b2('0x32')]);_0x1d92f6[_0x00b2('0x36')]=_[_0x00b2('0x35')](_0x5eeeed[_0x00b2('0x31')],qs['fields'](_0x299495[_0x00b2('0x32')][_0x00b2('0x37')]));_0x1d92f6[_0x00b2('0x36')]=_0x1d92f6[_0x00b2('0x36')][_0x00b2('0x38')]?_0x1d92f6[_0x00b2('0x36')]:_0x5eeeed['model'];if(!_0x299495['query'][_0x00b2('0x39')](_0x00b2('0x3a'))){_0x1d92f6[_0x00b2('0x1f')]=qs[_0x00b2('0x1f')](_0x299495[_0x00b2('0x32')]['limit']);_0x1d92f6[_0x00b2('0x1e')]=qs[_0x00b2('0x1e')](_0x299495[_0x00b2('0x32')][_0x00b2('0x1e')]);}_0x1d92f6['order']=qs[_0x00b2('0x3b')](_0x299495['query'][_0x00b2('0x3b')]);_0x1d92f6[_0x00b2('0x3c')]=qs[_0x00b2('0x34')](_[_0x00b2('0x3d')](_0x299495[_0x00b2('0x32')],_0x5eeeed['filters']));if(_0x299495[_0x00b2('0x32')][_0x00b2('0x3e')]){_0x1d92f6['where']=_['merge'](_0x1d92f6['where'],{'$or':_[_0x00b2('0x2c')](_0x5499f6,function(_0x215dcd){if(_0x215dcd[_0x00b2('0x2f')]!==_0x00b2('0x3f')){var _0x3d8d4c={};_0x3d8d4c[_0x215dcd['name']]={'$like':'%'+_0x299495['query'][_0x00b2('0x3e')]+'%'};return _0x3d8d4c;}})});}_0x1d92f6=_[_0x00b2('0x40')]({},_0x1d92f6,_0x299495[_0x00b2('0x41')]);var _0x141200={'where':_0x1d92f6['where']};return db['OpenchannelTransferReport'][_0x00b2('0x1d')](_0x141200)[_0x00b2('0x25')](function(_0x5214af){_0x4a5a9b[_0x00b2('0x1d')]=_0x5214af;if(_0x299495[_0x00b2('0x32')][_0x00b2('0x42')]){_0x1d92f6['include']=[{'all':!![]}];}return db['OpenchannelTransferReport']['findAll'](_0x1d92f6);})[_0x00b2('0x25')](function(_0x1d7dbf){_0x4a5a9b[_0x00b2('0x43')]=_0x1d7dbf;return _0x4a5a9b;})[_0x00b2('0x25')](respondWithFilteredResult(_0xe53eda,_0x1d92f6))['catch'](handleError(_0xe53eda,null));};exports[_0x00b2('0x44')]=function(_0x545225,_0x35b8d7){var _0x2cfb26={'raw':!![],'where':{'id':_0x545225[_0x00b2('0x45')]['id']}},_0x5c1a29={};_0x5c1a29[_0x00b2('0x31')]=_[_0x00b2('0x33')](db[_0x00b2('0x46')][_0x00b2('0x2d')]);_0x5c1a29['query']=_[_0x00b2('0x33')](_0x545225[_0x00b2('0x32')]);_0x5c1a29[_0x00b2('0x34')]=_[_0x00b2('0x35')](_0x5c1a29[_0x00b2('0x31')],_0x5c1a29['query']);_0x2cfb26[_0x00b2('0x36')]=_[_0x00b2('0x35')](_0x5c1a29[_0x00b2('0x31')],qs['fields'](_0x545225[_0x00b2('0x32')][_0x00b2('0x37')]));_0x2cfb26['attributes']=_0x2cfb26[_0x00b2('0x36')][_0x00b2('0x38')]?_0x2cfb26[_0x00b2('0x36')]:_0x5c1a29['model'];if(_0x545225[_0x00b2('0x32')]['includeAll']){_0x2cfb26[_0x00b2('0x47')]=[{'all':!![]}];}_0x2cfb26=_[_0x00b2('0x40')]({},_0x2cfb26,_0x545225[_0x00b2('0x41')]);return db[_0x00b2('0x46')]['find'](_0x2cfb26)['then'](handleEntityNotFound(_0x35b8d7,null))['then'](respondWithResult(_0x35b8d7,null))[_0x00b2('0x48')](handleError(_0x35b8d7,null));};exports[_0x00b2('0x49')]=function(_0x146905,_0x4a565c){return db[_0x00b2('0x46')][_0x00b2('0x49')](_0x146905[_0x00b2('0x4a')],{})['then'](respondWithResult(_0x4a565c,0xc9))[_0x00b2('0x48')](handleError(_0x4a565c,null));};exports[_0x00b2('0x4b')]=function(_0x2cc5a7,_0x566fd3){if(_0x2cc5a7[_0x00b2('0x4a')]['id']){delete _0x2cc5a7[_0x00b2('0x4a')]['id'];}return db[_0x00b2('0x46')][_0x00b2('0x4c')]({'where':{'id':_0x2cc5a7[_0x00b2('0x45')]['id']}})[_0x00b2('0x25')](handleEntityNotFound(_0x566fd3,null))[_0x00b2('0x25')](saveUpdates(_0x2cc5a7[_0x00b2('0x4a')],null))['then'](respondWithResult(_0x566fd3,null))[_0x00b2('0x48')](handleError(_0x566fd3,null));};exports[_0x00b2('0x26')]=function(_0x49d74d,_0x36370d){return db[_0x00b2('0x46')]['find']({'where':{'id':_0x49d74d[_0x00b2('0x45')]['id']}})[_0x00b2('0x25')](handleEntityNotFound(_0x36370d,null))[_0x00b2('0x25')](removeEntity(_0x36370d,null))[_0x00b2('0x48')](handleError(_0x36370d,null));};exports[_0x00b2('0x4d')]=function(_0x387b64,_0x196f39){return db[_0x00b2('0x46')][_0x00b2('0x4d')]()[_0x00b2('0x25')](respondWithResult(_0x196f39,null))[_0x00b2('0x48')](handleError(_0x196f39,null));}; \ No newline at end of file +var _0x19ec=['destroy','error','name','send','index','map','rawAttributes','fieldName','key','query','keys','intersection','model','fields','length','hasOwnProperty','nolimit','limit','order','sort','pick','filter','where','type','VIRTUAL','merge','then','includeAll','include','OpenchannelTransferReport','findAll','rows','catch','params','attributes','options','find','create','body','describe','eml-format','rimraf','request-promise','moment','util','path','sox','to-csv','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','end','status','json','count','offset','set','Content-Range','apply','reject','save','update'];(function(_0x1c0460,_0x30fbcc){var _0x237424=function(_0x5419f7){while(--_0x5419f7){_0x1c0460['push'](_0x1c0460['shift']());}};_0x237424(++_0x30fbcc);}(_0x19ec,0x154));var _0xc19e=function(_0x1d1779,_0x284147){_0x1d1779=_0x1d1779-0x0;var _0x2377e9=_0x19ec[_0x1d1779];return _0x2377e9;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0xc19e('0x0'));var rimraf=require(_0xc19e('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0xc19e('0x2'));var moment=require(_0xc19e('0x3'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0xc19e('0x4'));var path=require(_0xc19e('0x5'));var sox=require(_0xc19e('0x6'));var csv=require(_0xc19e('0x7'));var ejs=require('ejs');var fs=require('fs');var _=require(_0xc19e('0x8'));var squel=require(_0xc19e('0x9'));var crypto=require('crypto');var jsforce=require(_0xc19e('0xa'));var deskjs=require(_0xc19e('0xb'));var toCsv=require(_0xc19e('0x7'));var querystring=require(_0xc19e('0xc'));var Papa=require(_0xc19e('0xd'));var Redis=require(_0xc19e('0xe'));var authService=require(_0xc19e('0xf'));var qs=require(_0xc19e('0x10'));var as=require(_0xc19e('0x11'));var hardwareService=require(_0xc19e('0x12'));var logger=require('../../config/logger')(_0xc19e('0x13'));var utils=require(_0xc19e('0x14'));var config=require(_0xc19e('0x15'));var db=require(_0xc19e('0x16'))['db'];function respondWithStatusCode(_0x5690c7,_0x395bc0){_0x395bc0=_0x395bc0||0xcc;return function(_0xf547a6){if(_0xf547a6){return _0x5690c7[_0xc19e('0x17')](_0x395bc0);}return _0x5690c7['status'](_0x395bc0)[_0xc19e('0x18')]();};}function respondWithResult(_0x58f3ff,_0x5e96b5){_0x5e96b5=_0x5e96b5||0xc8;return function(_0xbbcc17){if(_0xbbcc17){return _0x58f3ff[_0xc19e('0x19')](_0x5e96b5)[_0xc19e('0x1a')](_0xbbcc17);}};}function respondWithFilteredResult(_0x52c2a6,_0x11a9d8){return function(_0x24017d){if(_0x24017d){var _0x113a76=_0x24017d[_0xc19e('0x1b')],_0x20823f=_0x11a9d8[_0xc19e('0x1c')],_0x1cf0f2=_0x11a9d8['offset']+_0x11a9d8['limit'],_0x13b1a0;if(_0x1cf0f2>=_0x113a76){_0x1cf0f2=_0x113a76;_0x13b1a0=0xc8;}else{_0x13b1a0=0xce;}_0x52c2a6[_0xc19e('0x19')](_0x13b1a0);return _0x52c2a6[_0xc19e('0x1d')](_0xc19e('0x1e'),_0x20823f+'-'+_0x1cf0f2+'/'+_0x113a76)[_0xc19e('0x1a')](_0x24017d);}return null;};}function patchUpdates(_0x45cfdb){return function(_0x2534a5){try{jsonpatch[_0xc19e('0x1f')](_0x2534a5,_0x45cfdb,!![]);}catch(_0x3be7f1){return BPromise[_0xc19e('0x20')](_0x3be7f1);}return _0x2534a5[_0xc19e('0x21')]();};}function saveUpdates(_0x3b106a,_0x264436){return function(_0x4e7ea5){if(_0x4e7ea5){return _0x4e7ea5[_0xc19e('0x22')](_0x3b106a)['then'](function(_0x3daf1f){return _0x3daf1f;});}return null;};}function removeEntity(_0x55cc92,_0xe7e416){return function(_0xd1853e){if(_0xd1853e){return _0xd1853e[_0xc19e('0x23')]()['then'](function(){_0x55cc92['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x335394,_0xae2a63){return function(_0xa5ca72){if(!_0xa5ca72){_0x335394[_0xc19e('0x17')](0x194);}return _0xa5ca72;};}function handleError(_0x170383,_0x5704f3){_0x5704f3=_0x5704f3||0x1f4;return function(_0x4a5489){logger[_0xc19e('0x24')](_0x4a5489['stack']);if(_0x4a5489[_0xc19e('0x25')]){delete _0x4a5489[_0xc19e('0x25')];}_0x170383['status'](_0x5704f3)[_0xc19e('0x26')](_0x4a5489);};}exports[_0xc19e('0x27')]=function(_0x4ffffb,_0x4571c8){var _0x414d54={},_0x23feb0={},_0x23c6e0={'count':0x0,'rows':[]};var _0x311a25=_[_0xc19e('0x28')](db['OpenchannelTransferReport'][_0xc19e('0x29')],function(_0x7fffce){return{'name':_0x7fffce[_0xc19e('0x2a')],'type':_0x7fffce['type'][_0xc19e('0x2b')]};});_0x23feb0['model']=_[_0xc19e('0x28')](_0x311a25,_0xc19e('0x25'));_0x23feb0[_0xc19e('0x2c')]=_[_0xc19e('0x2d')](_0x4ffffb[_0xc19e('0x2c')]);_0x23feb0['filters']=_[_0xc19e('0x2e')](_0x23feb0[_0xc19e('0x2f')],_0x23feb0[_0xc19e('0x2c')]);_0x414d54['attributes']=_[_0xc19e('0x2e')](_0x23feb0[_0xc19e('0x2f')],qs['fields'](_0x4ffffb[_0xc19e('0x2c')][_0xc19e('0x30')]));_0x414d54['attributes']=_0x414d54['attributes'][_0xc19e('0x31')]?_0x414d54['attributes']:_0x23feb0[_0xc19e('0x2f')];if(!_0x4ffffb[_0xc19e('0x2c')][_0xc19e('0x32')](_0xc19e('0x33'))){_0x414d54['limit']=qs['limit'](_0x4ffffb[_0xc19e('0x2c')][_0xc19e('0x34')]);_0x414d54[_0xc19e('0x1c')]=qs[_0xc19e('0x1c')](_0x4ffffb['query'][_0xc19e('0x1c')]);}_0x414d54[_0xc19e('0x35')]=qs[_0xc19e('0x36')](_0x4ffffb['query'][_0xc19e('0x36')]);_0x414d54['where']=qs['filters'](_[_0xc19e('0x37')](_0x4ffffb['query'],_0x23feb0['filters']));if(_0x4ffffb['query'][_0xc19e('0x38')]){_0x414d54['where']=_['merge'](_0x414d54[_0xc19e('0x39')],{'$or':_[_0xc19e('0x28')](_0x311a25,function(_0x279bed){if(_0x279bed[_0xc19e('0x3a')]!==_0xc19e('0x3b')){var _0x2b3171={};_0x2b3171[_0x279bed[_0xc19e('0x25')]]={'$like':'%'+_0x4ffffb[_0xc19e('0x2c')][_0xc19e('0x38')]+'%'};return _0x2b3171;}})});}_0x414d54=_[_0xc19e('0x3c')]({},_0x414d54,_0x4ffffb['options']);var _0x36f5db={'where':_0x414d54[_0xc19e('0x39')]};return db['OpenchannelTransferReport'][_0xc19e('0x1b')](_0x36f5db)[_0xc19e('0x3d')](function(_0x14626d){_0x23c6e0[_0xc19e('0x1b')]=_0x14626d;if(_0x4ffffb[_0xc19e('0x2c')][_0xc19e('0x3e')]){_0x414d54[_0xc19e('0x3f')]=[{'all':!![]}];}return db[_0xc19e('0x40')][_0xc19e('0x41')](_0x414d54);})[_0xc19e('0x3d')](function(_0x559e3d){_0x23c6e0[_0xc19e('0x42')]=_0x559e3d;return _0x23c6e0;})[_0xc19e('0x3d')](respondWithFilteredResult(_0x4571c8,_0x414d54))[_0xc19e('0x43')](handleError(_0x4571c8,null));};exports['show']=function(_0xff34f,_0x2b5941){var _0x141558={'raw':!![],'where':{'id':_0xff34f[_0xc19e('0x44')]['id']}},_0x36db7e={};_0x36db7e[_0xc19e('0x2f')]=_['keys'](db['OpenchannelTransferReport'][_0xc19e('0x29')]);_0x36db7e['query']=_[_0xc19e('0x2d')](_0xff34f[_0xc19e('0x2c')]);_0x36db7e['filters']=_[_0xc19e('0x2e')](_0x36db7e['model'],_0x36db7e[_0xc19e('0x2c')]);_0x141558[_0xc19e('0x45')]=_[_0xc19e('0x2e')](_0x36db7e[_0xc19e('0x2f')],qs[_0xc19e('0x30')](_0xff34f[_0xc19e('0x2c')][_0xc19e('0x30')]));_0x141558[_0xc19e('0x45')]=_0x141558[_0xc19e('0x45')][_0xc19e('0x31')]?_0x141558[_0xc19e('0x45')]:_0x36db7e[_0xc19e('0x2f')];if(_0xff34f[_0xc19e('0x2c')]['includeAll']){_0x141558['include']=[{'all':!![]}];}_0x141558=_['merge']({},_0x141558,_0xff34f[_0xc19e('0x46')]);return db[_0xc19e('0x40')][_0xc19e('0x47')](_0x141558)['then'](handleEntityNotFound(_0x2b5941,null))['then'](respondWithResult(_0x2b5941,null))[_0xc19e('0x43')](handleError(_0x2b5941,null));};exports[_0xc19e('0x48')]=function(_0x53ad1c,_0x4cc0d2){return db[_0xc19e('0x40')][_0xc19e('0x48')](_0x53ad1c[_0xc19e('0x49')],{})[_0xc19e('0x3d')](respondWithResult(_0x4cc0d2,0xc9))[_0xc19e('0x43')](handleError(_0x4cc0d2,null));};exports['update']=function(_0x12023f,_0x20aea4){if(_0x12023f[_0xc19e('0x49')]['id']){delete _0x12023f[_0xc19e('0x49')]['id'];}return db[_0xc19e('0x40')][_0xc19e('0x47')]({'where':{'id':_0x12023f[_0xc19e('0x44')]['id']}})[_0xc19e('0x3d')](handleEntityNotFound(_0x20aea4,null))['then'](saveUpdates(_0x12023f[_0xc19e('0x49')],null))[_0xc19e('0x3d')](respondWithResult(_0x20aea4,null))[_0xc19e('0x43')](handleError(_0x20aea4,null));};exports[_0xc19e('0x23')]=function(_0x2f2a81,_0x2bd067){return db[_0xc19e('0x40')][_0xc19e('0x47')]({'where':{'id':_0x2f2a81['params']['id']}})[_0xc19e('0x3d')](handleEntityNotFound(_0x2bd067,null))[_0xc19e('0x3d')](removeEntity(_0x2bd067,null))[_0xc19e('0x43')](handleError(_0x2bd067,null));};exports['describe']=function(_0x514be5,_0x678e36){return db[_0xc19e('0x40')][_0xc19e('0x4a')]()[_0xc19e('0x3d')](respondWithResult(_0x678e36,null))[_0xc19e('0x43')](handleError(_0x678e36,null));}; \ No newline at end of file diff --git a/server/api/openchannelTransferReport/openchannelTransferReport.model.js b/server/api/openchannelTransferReport/openchannelTransferReport.model.js index 4f0316f..e3afe77 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 _0x8435=['rimraf','../../config/environment','./openchannelTransferReport.attributes','exports','define','OpenchannelTransferReport','report_openchannel_transfer','uniqueid','lodash','util','../../config/logger','api','request-promise','path'];(function(_0x4cf98e,_0xba4b79){var _0x1623ac=function(_0x459bc0){while(--_0x459bc0){_0x4cf98e['push'](_0x4cf98e['shift']());}};_0x1623ac(++_0xba4b79);}(_0x8435,0x112));var _0x5843=function(_0x31e592,_0xd4872){_0x31e592=_0x31e592-0x0;var _0x5a43d0=_0x8435[_0x31e592];return _0x5a43d0;};'use strict';var _=require(_0x5843('0x0'));var util=require(_0x5843('0x1'));var logger=require(_0x5843('0x2'))(_0x5843('0x3'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x5843('0x4'));var fs=require('fs');var path=require(_0x5843('0x5'));var rimraf=require(_0x5843('0x6'));var config=require(_0x5843('0x7'));var attributes=require(_0x5843('0x8'));module[_0x5843('0x9')]=function(_0xc76399,_0x418745){return _0xc76399[_0x5843('0xa')](_0x5843('0xb'),attributes,{'tableName':_0x5843('0xc'),'paranoid':![],'indexes':[{'name':_0x5843('0xd'),'fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file +var _0x942d=['moment','request-promise','rimraf','../../config/environment','OpenchannelTransferReport','report_openchannel_transfer','uniqueid','util'];(function(_0x214bac,_0x2e3c13){var _0x36d477=function(_0x52c6b2){while(--_0x52c6b2){_0x214bac['push'](_0x214bac['shift']());}};_0x36d477(++_0x2e3c13);}(_0x942d,0xef));var _0xd942=function(_0x36ed48,_0x1ee0d4){_0x36ed48=_0x36ed48-0x0;var _0x51c63a=_0x942d[_0x36ed48];return _0x51c63a;};'use strict';var _=require('lodash');var util=require(_0xd942('0x0'));var logger=require('../../config/logger')('api');var moment=require(_0xd942('0x1'));var BPromise=require('bluebird');var rp=require(_0xd942('0x2'));var fs=require('fs');var path=require('path');var rimraf=require(_0xd942('0x3'));var config=require(_0xd942('0x4'));var attributes=require('./openchannelTransferReport.attributes');module['exports']=function(_0x3a7b74,_0x5c6f5e){return _0x3a7b74['define'](_0xd942('0x5'),attributes,{'tableName':_0xd942('0x6'),'paranoid':![],'indexes':[{'name':_0xd942('0x7'),'fields':[_0xd942('0x7')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/openchannelTransferReport/openchannelTransferReport.rpc.js b/server/api/openchannelTransferReport/openchannelTransferReport.rpc.js index 1acb126..6db989e 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 _0xa647=['util','moment','bluebird','randomstring','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','OpenchannelTransferReport,\x20%s,\x20%s','request\x20sent','debug','OpenchannelTransferReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','lodash'];(function(_0x2fa1c6,_0x4a5b8d){var _0x5f3257=function(_0x195b53){while(--_0x195b53){_0x2fa1c6['push'](_0x2fa1c6['shift']());}};_0x5f3257(++_0x4a5b8d);}(_0xa647,0xe5));var _0x7a64=function(_0x2037d7,_0x159ab6){_0x2037d7=_0x2037d7-0x0;var _0x19cf21=_0xa647[_0x2037d7];return _0x19cf21;};'use strict';var _=require(_0x7a64('0x0'));var util=require(_0x7a64('0x1'));var moment=require(_0x7a64('0x2'));var BPromise=require(_0x7a64('0x3'));var rs=require(_0x7a64('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x7a64('0x5'));var logger=require(_0x7a64('0x6'))(_0x7a64('0x7'));var config=require(_0x7a64('0x8'));var jayson=require(_0x7a64('0x9'));var client=jayson[_0x7a64('0xa')][_0x7a64('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x1f832e,_0x238b06,_0x43d3e7){return new BPromise(function(_0x396d60,_0xbf7e32){return client[_0x7a64('0xc')](_0x1f832e,_0x43d3e7)[_0x7a64('0xd')](function(_0x30b886){logger['info'](_0x7a64('0xe'),_0x238b06,_0x7a64('0xf'));logger[_0x7a64('0x10')](_0x7a64('0x11'),_0x238b06,_0x7a64('0xf'),JSON[_0x7a64('0x12')](_0x30b886));if(_0x30b886[_0x7a64('0x13')]){if(_0x30b886['error'][_0x7a64('0x14')]===0x1f4){logger[_0x7a64('0x13')]('OpenchannelTransferReport,\x20%s,\x20%s',_0x238b06,_0x30b886[_0x7a64('0x13')][_0x7a64('0x15')]);return _0xbf7e32(_0x30b886[_0x7a64('0x13')][_0x7a64('0x15')]);}logger[_0x7a64('0x13')](_0x7a64('0xe'),_0x238b06,_0x30b886[_0x7a64('0x13')][_0x7a64('0x15')]);return _0x396d60(_0x30b886[_0x7a64('0x13')][_0x7a64('0x15')]);}else{logger[_0x7a64('0x16')]('OpenchannelTransferReport,\x20%s,\x20%s',_0x238b06,_0x7a64('0xf'));_0x396d60(_0x30b886['result'][_0x7a64('0x15')]);}})['catch'](function(_0x2ec930){logger[_0x7a64('0x13')](_0x7a64('0xe'),_0x238b06,_0x2ec930);_0xbf7e32(_0x2ec930);});});} \ No newline at end of file +var _0x21a8=['client','http','request','then','OpenchannelTransferReport,\x20%s,\x20%s','request\x20sent','OpenchannelTransferReport,\x20%s,\x20%s,\x20%s','error','code','message','catch','lodash','util','moment','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise'];(function(_0xb9f5cb,_0x2511d6){var _0x4ccdc0=function(_0x566d78){while(--_0x566d78){_0xb9f5cb['push'](_0xb9f5cb['shift']());}};_0x4ccdc0(++_0x2511d6);}(_0x21a8,0x19a));var _0x821a=function(_0x101328,_0x2e873c){_0x101328=_0x101328-0x0;var _0x3378a7=_0x21a8[_0x101328];return _0x3378a7;};'use strict';var _=require(_0x821a('0x0'));var util=require(_0x821a('0x1'));var moment=require(_0x821a('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x821a('0x3'));var db=require(_0x821a('0x4'))['db'];var utils=require(_0x821a('0x5'));var logger=require(_0x821a('0x6'))(_0x821a('0x7'));var config=require(_0x821a('0x8'));var jayson=require(_0x821a('0x9'));var client=jayson[_0x821a('0xa')][_0x821a('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x408a26,_0x5147d9,_0x4f4656){return new BPromise(function(_0xcc055e,_0x146483){return client[_0x821a('0xc')](_0x408a26,_0x4f4656)[_0x821a('0xd')](function(_0x4424b2){logger['info'](_0x821a('0xe'),_0x5147d9,_0x821a('0xf'));logger['debug'](_0x821a('0x10'),_0x5147d9,'request\x20sent',JSON['stringify'](_0x4424b2));if(_0x4424b2['error']){if(_0x4424b2[_0x821a('0x11')][_0x821a('0x12')]===0x1f4){logger[_0x821a('0x11')](_0x821a('0xe'),_0x5147d9,_0x4424b2[_0x821a('0x11')][_0x821a('0x13')]);return _0x146483(_0x4424b2[_0x821a('0x11')]['message']);}logger[_0x821a('0x11')]('OpenchannelTransferReport,\x20%s,\x20%s',_0x5147d9,_0x4424b2[_0x821a('0x11')][_0x821a('0x13')]);return _0xcc055e(_0x4424b2[_0x821a('0x11')][_0x821a('0x13')]);}else{logger['info'](_0x821a('0xe'),_0x5147d9,_0x821a('0xf'));_0xcc055e(_0x4424b2['result'][_0x821a('0x13')]);}})[_0x821a('0x14')](function(_0x537c5e){logger[_0x821a('0x11')](_0x821a('0xe'),_0x5147d9,_0x537c5e);_0x146483(_0x537c5e);});});} \ No newline at end of file diff --git a/server/api/pause/index.js b/server/api/pause/index.js index 3bf6289..bde9e65 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 _0x96d7=['connect-timeout','express','Router','../../components/auth/service','../../config/environment','./pause.controller','get','isAuthenticated','/:id','show','post','create','put','update','delete','destroy','exports','multer','path'];(function(_0x28dc92,_0x11eb15){var _0x364e00=function(_0x1e7537){while(--_0x1e7537){_0x28dc92['push'](_0x28dc92['shift']());}};_0x364e00(++_0x11eb15);}(_0x96d7,0xcf));var _0x796d=function(_0x2b89e4,_0x2ae4a5){_0x2b89e4=_0x2b89e4-0x0;var _0x5a0618=_0x96d7[_0x2b89e4];return _0x5a0618;};'use strict';var multer=require(_0x796d('0x0'));var util=require('util');var path=require(_0x796d('0x1'));var timeout=require(_0x796d('0x2'));var express=require(_0x796d('0x3'));var router=express[_0x796d('0x4')]();var auth=require(_0x796d('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x796d('0x6'));var controller=require(_0x796d('0x7'));router[_0x796d('0x8')]('/',auth[_0x796d('0x9')](),controller['index']);router[_0x796d('0x8')](_0x796d('0xa'),auth[_0x796d('0x9')](),controller[_0x796d('0xb')]);router[_0x796d('0xc')]('/',auth[_0x796d('0x9')](),controller[_0x796d('0xd')]);router[_0x796d('0xe')](_0x796d('0xa'),auth['isAuthenticated'](),controller[_0x796d('0xf')]);router[_0x796d('0x10')](_0x796d('0xa'),auth[_0x796d('0x9')](),controller[_0x796d('0x11')]);module[_0x796d('0x12')]=router; \ No newline at end of file +var _0x9e80=['exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','/:id','show','create','put','update','delete','destroy'];(function(_0x32aa80,_0x44e285){var _0x5cd534=function(_0x356b2b){while(--_0x356b2b){_0x32aa80['push'](_0x32aa80['shift']());}};_0x5cd534(++_0x44e285);}(_0x9e80,0x17d));var _0x09e8=function(_0x201ff5,_0x1acbac){_0x201ff5=_0x201ff5-0x0;var _0x51ea92=_0x9e80[_0x201ff5];return _0x51ea92;};'use strict';var multer=require(_0x09e8('0x0'));var util=require(_0x09e8('0x1'));var path=require(_0x09e8('0x2'));var timeout=require(_0x09e8('0x3'));var express=require(_0x09e8('0x4'));var router=express[_0x09e8('0x5')]();var auth=require(_0x09e8('0x6'));var interaction=require(_0x09e8('0x7'));var config=require(_0x09e8('0x8'));var controller=require('./pause.controller');router[_0x09e8('0x9')]('/',auth[_0x09e8('0xa')](),controller['index']);router[_0x09e8('0x9')](_0x09e8('0xb'),auth['isAuthenticated'](),controller[_0x09e8('0xc')]);router['post']('/',auth[_0x09e8('0xa')](),controller[_0x09e8('0xd')]);router[_0x09e8('0xe')]('/:id',auth[_0x09e8('0xa')](),controller[_0x09e8('0xf')]);router[_0x09e8('0x10')](_0x09e8('0xb'),auth[_0x09e8('0xa')](),controller[_0x09e8('0x11')]);module[_0x09e8('0x12')]=router; \ No newline at end of file diff --git a/server/api/pause/pause.attributes.js b/server/api/pause/pause.attributes.js index 1f66787..898c79e 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 _0xbca7=['name','STRING','sequelize'];(function(_0x1c4769,_0x200259){var _0x2883f7=function(_0x5a41be){while(--_0x5a41be){_0x1c4769['push'](_0x1c4769['shift']());}};_0x2883f7(++_0x200259);}(_0xbca7,0x122));var _0x7bca=function(_0x1c546c,_0x5c57cb){_0x1c546c=_0x1c546c-0x0;var _0x2cc384=_0xbca7[_0x1c546c];return _0x2cc384;};'use strict';var Sequelize=require(_0x7bca('0x0'));module['exports']={'name':{'type':Sequelize['STRING'],'unique':_0x7bca('0x1'),'allowNull':![]},'description':{'type':Sequelize[_0x7bca('0x2')]}}; \ No newline at end of file +var _0xa73a=['STRING','sequelize','exports'];(function(_0x548d7d,_0x2d41fc){var _0xb1c878=function(_0x570f09){while(--_0x570f09){_0x548d7d['push'](_0x548d7d['shift']());}};_0xb1c878(++_0x2d41fc);}(_0xa73a,0xe8));var _0xaa73=function(_0x37c07d,_0xdbdb5f){_0x37c07d=_0x37c07d-0x0;var _0x10dadc=_0xa73a[_0x37c07d];return _0x10dadc;};'use strict';var Sequelize=require(_0xaa73('0x0'));module[_0xaa73('0x1')]={'name':{'type':Sequelize[_0xaa73('0x2')],'unique':'name','allowNull':![]},'description':{'type':Sequelize[_0xaa73('0x2')]}}; \ No newline at end of file diff --git a/server/api/pause/pause.controller.js b/server/api/pause/pause.controller.js index 7a7272c..9542c5a 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 _0x0f01=['ioredis','../../components/parsers/qs','../../config/license/hardware','../../config/utils','sendStatus','status','end','json','count','limit','set','Content-Range','apply','save','then','destroy','get','Pauses','UserProfileResource','error','name','send','index','rawAttributes','type','model','map','query','keys','filters','intersection','attributes','fields','nolimit','offset','order','sort','where','pick','filter','merge','VIRTUAL','options','include','Pause','rows','catch','show','length','includeAll','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','find','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','body','params','eml-format','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','squel','crypto','jsforce','querystring'];(function(_0x200bee,_0x680886){var _0x31aa46=function(_0x568ee6){while(--_0x568ee6){_0x200bee['push'](_0x200bee['shift']());}};_0x31aa46(++_0x680886);}(_0x0f01,0x87));var _0x10f0=function(_0x550b35,_0xa48bb6){_0x550b35=_0x550b35-0x0;var _0x3fbb95=_0x0f01[_0x550b35];return _0x3fbb95;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x10f0('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x10f0('0x1'));var rp=require(_0x10f0('0x2'));var moment=require(_0x10f0('0x3'));var BPromise=require(_0x10f0('0x4'));var Mustache=require(_0x10f0('0x5'));var util=require(_0x10f0('0x6'));var path=require(_0x10f0('0x7'));var sox=require(_0x10f0('0x8'));var csv=require(_0x10f0('0x9'));var ejs=require(_0x10f0('0xa'));var fs=require('fs');var _=require('lodash');var squel=require(_0x10f0('0xb'));var crypto=require(_0x10f0('0xc'));var jsforce=require(_0x10f0('0xd'));var deskjs=require('desk.js');var toCsv=require(_0x10f0('0x9'));var querystring=require(_0x10f0('0xe'));var Papa=require('papaparse');var Redis=require(_0x10f0('0xf'));var authService=require('../../components/auth/service');var qs=require(_0x10f0('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x10f0('0x11'));var logger=require('../../config/logger')('api');var utils=require(_0x10f0('0x12'));var config=require('../../config/environment');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x54013b,_0x272d71){_0x272d71=_0x272d71||0xcc;return function(_0x2d6444){if(_0x2d6444){return _0x54013b[_0x10f0('0x13')](_0x272d71);}return _0x54013b[_0x10f0('0x14')](_0x272d71)[_0x10f0('0x15')]();};}function respondWithResult(_0x273293,_0x560f73){_0x560f73=_0x560f73||0xc8;return function(_0x4c2953){if(_0x4c2953){return _0x273293[_0x10f0('0x14')](_0x560f73)[_0x10f0('0x16')](_0x4c2953);}};}function respondWithFilteredResult(_0x104a65,_0x420e19){return function(_0x2abdb4){if(_0x2abdb4){var _0x5da921=_0x2abdb4[_0x10f0('0x17')],_0x2e2492=_0x420e19['offset'],_0x4f1d0f=_0x420e19['offset']+_0x420e19[_0x10f0('0x18')],_0x413c69;if(_0x4f1d0f>=_0x5da921){_0x4f1d0f=_0x5da921;_0x413c69=0xc8;}else{_0x413c69=0xce;}_0x104a65[_0x10f0('0x14')](_0x413c69);return _0x104a65[_0x10f0('0x19')](_0x10f0('0x1a'),_0x2e2492+'-'+_0x4f1d0f+'/'+_0x5da921)[_0x10f0('0x16')](_0x2abdb4);}return null;};}function patchUpdates(_0x52cd2d){return function(_0x290b93){try{jsonpatch[_0x10f0('0x1b')](_0x290b93,_0x52cd2d,!![]);}catch(_0x2786d3){return BPromise['reject'](_0x2786d3);}return _0x290b93[_0x10f0('0x1c')]();};}function saveUpdates(_0x373667,_0x1e7826){return function(_0xc8c651){if(_0xc8c651){return _0xc8c651['update'](_0x373667)[_0x10f0('0x1d')](function(_0x2e2c66){return _0x2e2c66;});}return null;};}function removeEntity(_0x66b4ca,_0x4a93c6){return function(_0x5721b8){if(_0x5721b8){return _0x5721b8[_0x10f0('0x1e')]()[_0x10f0('0x1d')](function(){var _0x22a2f2=_0x5721b8[_0x10f0('0x1f')]({'plain':!![]});var _0x368e00=_0x10f0('0x20');return db[_0x10f0('0x21')][_0x10f0('0x1e')]({'where':{'type':_0x368e00,'resourceId':_0x22a2f2['id']}})['then'](function(){return _0x5721b8;});})[_0x10f0('0x1d')](function(){_0x66b4ca[_0x10f0('0x14')](0xcc)[_0x10f0('0x15')]();});}};}function handleEntityNotFound(_0x390027,_0x58cfb9){return function(_0x450d9e){if(!_0x450d9e){_0x390027[_0x10f0('0x13')](0x194);}return _0x450d9e;};}function handleError(_0x2518be,_0x2583ce){_0x2583ce=_0x2583ce||0x1f4;return function(_0x37b1d1){logger[_0x10f0('0x22')](_0x37b1d1['stack']);if(_0x37b1d1[_0x10f0('0x23')]){delete _0x37b1d1[_0x10f0('0x23')];}_0x2518be['status'](_0x2583ce)[_0x10f0('0x24')](_0x37b1d1);};}exports[_0x10f0('0x25')]=function(_0x3dc6bb,_0x18ed77){var _0x587e1b={},_0x24f92c={},_0x532856={'count':0x0,'rows':[]};var _0x2b6817=_['map'](db['Pause'][_0x10f0('0x26')],function(_0x125654){return{'name':_0x125654['fieldName'],'type':_0x125654[_0x10f0('0x27')]['key']};});_0x24f92c[_0x10f0('0x28')]=_[_0x10f0('0x29')](_0x2b6817,_0x10f0('0x23'));_0x24f92c[_0x10f0('0x2a')]=_[_0x10f0('0x2b')](_0x3dc6bb[_0x10f0('0x2a')]);_0x24f92c[_0x10f0('0x2c')]=_[_0x10f0('0x2d')](_0x24f92c[_0x10f0('0x28')],_0x24f92c[_0x10f0('0x2a')]);_0x587e1b[_0x10f0('0x2e')]=_[_0x10f0('0x2d')](_0x24f92c['model'],qs[_0x10f0('0x2f')](_0x3dc6bb[_0x10f0('0x2a')]['fields']));_0x587e1b[_0x10f0('0x2e')]=_0x587e1b['attributes']['length']?_0x587e1b['attributes']:_0x24f92c[_0x10f0('0x28')];if(!_0x3dc6bb[_0x10f0('0x2a')]['hasOwnProperty'](_0x10f0('0x30'))){_0x587e1b[_0x10f0('0x18')]=qs[_0x10f0('0x18')](_0x3dc6bb[_0x10f0('0x2a')][_0x10f0('0x18')]);_0x587e1b['offset']=qs[_0x10f0('0x31')](_0x3dc6bb[_0x10f0('0x2a')]['offset']);}_0x587e1b[_0x10f0('0x32')]=qs[_0x10f0('0x33')](_0x3dc6bb[_0x10f0('0x2a')][_0x10f0('0x33')]);_0x587e1b[_0x10f0('0x34')]=qs['filters'](_[_0x10f0('0x35')](_0x3dc6bb[_0x10f0('0x2a')],_0x24f92c[_0x10f0('0x2c')]));if(_0x3dc6bb[_0x10f0('0x2a')][_0x10f0('0x36')]){_0x587e1b[_0x10f0('0x34')]=_[_0x10f0('0x37')](_0x587e1b[_0x10f0('0x34')],{'$or':_['map'](_0x2b6817,function(_0x62313b){if(_0x62313b[_0x10f0('0x27')]!==_0x10f0('0x38')){var _0x3f2785={};_0x3f2785[_0x62313b[_0x10f0('0x23')]]={'$like':'%'+_0x3dc6bb['query']['filter']+'%'};return _0x3f2785;}})});}_0x587e1b=_[_0x10f0('0x37')]({},_0x587e1b,_0x3dc6bb[_0x10f0('0x39')]);var _0x2c5660={'where':_0x587e1b['where']};return db['Pause'][_0x10f0('0x17')](_0x2c5660)[_0x10f0('0x1d')](function(_0x4a0b35){_0x532856[_0x10f0('0x17')]=_0x4a0b35;if(_0x3dc6bb[_0x10f0('0x2a')]['includeAll']){_0x587e1b[_0x10f0('0x3a')]=[{'all':!![]}];}return db[_0x10f0('0x3b')]['findAll'](_0x587e1b);})['then'](function(_0x3942fe){_0x532856[_0x10f0('0x3c')]=_0x3942fe;return _0x532856;})[_0x10f0('0x1d')](respondWithFilteredResult(_0x18ed77,_0x587e1b))[_0x10f0('0x3d')](handleError(_0x18ed77,null));};exports[_0x10f0('0x3e')]=function(_0x5b87da,_0xe1288f){var _0x24f1a6={'raw':!![],'where':{'id':_0x5b87da['params']['id']}},_0x4fbc60={};_0x4fbc60[_0x10f0('0x28')]=_[_0x10f0('0x2b')](db[_0x10f0('0x3b')][_0x10f0('0x26')]);_0x4fbc60[_0x10f0('0x2a')]=_[_0x10f0('0x2b')](_0x5b87da[_0x10f0('0x2a')]);_0x4fbc60[_0x10f0('0x2c')]=_[_0x10f0('0x2d')](_0x4fbc60[_0x10f0('0x28')],_0x4fbc60[_0x10f0('0x2a')]);_0x24f1a6[_0x10f0('0x2e')]=_[_0x10f0('0x2d')](_0x4fbc60[_0x10f0('0x28')],qs[_0x10f0('0x2f')](_0x5b87da[_0x10f0('0x2a')][_0x10f0('0x2f')]));_0x24f1a6['attributes']=_0x24f1a6[_0x10f0('0x2e')][_0x10f0('0x3f')]?_0x24f1a6[_0x10f0('0x2e')]:_0x4fbc60[_0x10f0('0x28')];if(_0x5b87da[_0x10f0('0x2a')][_0x10f0('0x40')]){_0x24f1a6[_0x10f0('0x3a')]=[{'all':!![]}];}_0x24f1a6=_['merge']({},_0x24f1a6,_0x5b87da[_0x10f0('0x39')]);return db[_0x10f0('0x3b')]['find'](_0x24f1a6)[_0x10f0('0x1d')](handleEntityNotFound(_0xe1288f,null))[_0x10f0('0x1d')](respondWithResult(_0xe1288f,null))[_0x10f0('0x3d')](handleError(_0xe1288f,null));};exports['create']=function(_0x159495,_0x3144f2){return db['Pause'][_0x10f0('0x41')](_0x159495['body'],{})['then'](function(_0x435a72){var _0x4a77c7=_0x159495[_0x10f0('0x42')][_0x10f0('0x1f')]({'plain':!![]});if(!_0x4a77c7)throw new Error(_0x10f0('0x43'));if(_0x4a77c7['role']===_0x10f0('0x42')){var _0x1ae7f6=_0x435a72[_0x10f0('0x1f')]({'plain':!![]});var _0x15e7a9=_0x10f0('0x20');return db[_0x10f0('0x44')][_0x10f0('0x45')]({'where':{'name':_0x15e7a9,'userProfileId':_0x4a77c7['userProfileId']},'raw':!![]})[_0x10f0('0x1d')](function(_0x1e15f5){if(_0x1e15f5&&_0x1e15f5[_0x10f0('0x46')]===0x0){return db[_0x10f0('0x21')]['create']({'name':_0x1ae7f6[_0x10f0('0x23')],'resourceId':_0x1ae7f6['id'],'type':_0x1e15f5[_0x10f0('0x23')],'sectionId':_0x1e15f5['id']},{})[_0x10f0('0x1d')](function(){return _0x435a72;});}else{return _0x435a72;}})[_0x10f0('0x3d')](function(_0x3d6242){logger[_0x10f0('0x22')](_0x10f0('0x47'),_0x3d6242);throw _0x3d6242;});}return _0x435a72;})['then'](respondWithResult(_0x3144f2,0xc9))['catch'](handleError(_0x3144f2,null));};exports[_0x10f0('0x48')]=function(_0x41b4c8,_0x3efa96){if(_0x41b4c8[_0x10f0('0x49')]['id']){delete _0x41b4c8[_0x10f0('0x49')]['id'];}return db['Pause'][_0x10f0('0x45')]({'where':{'id':_0x41b4c8['params']['id']}})[_0x10f0('0x1d')](handleEntityNotFound(_0x3efa96,null))[_0x10f0('0x1d')](saveUpdates(_0x41b4c8['body'],null))[_0x10f0('0x1d')](respondWithResult(_0x3efa96,null))[_0x10f0('0x3d')](handleError(_0x3efa96,null));};exports[_0x10f0('0x1e')]=function(_0xd57799,_0x3fe079){return db[_0x10f0('0x3b')][_0x10f0('0x45')]({'where':{'id':_0xd57799[_0x10f0('0x4a')]['id']}})[_0x10f0('0x1d')](handleEntityNotFound(_0x3fe079,null))[_0x10f0('0x1d')](removeEntity(_0x3fe079,null))[_0x10f0('0x3d')](handleError(_0x3fe079,null));}; \ No newline at end of file +var _0x9efe=['rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','to-csv','ejs','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','status','end','json','count','offset','limit','set','Content-Range','apply','reject','save','update','then','destroy','get','Pauses','UserProfileResource','sendStatus','error','stack','send','map','Pause','type','key','model','name','query','intersection','attributes','fields','hasOwnProperty','order','sort','where','filters','pick','merge','filter','options','includeAll','include','findAll','rows','show','params','keys','rawAttributes','find','catch','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','html-pdf'];(function(_0x2f04fe,_0x38359d){var _0x4a51f9=function(_0x19dc99){while(--_0x19dc99){_0x2f04fe['push'](_0x2f04fe['shift']());}};_0x4a51f9(++_0x38359d);}(_0x9efe,0x1eb));var _0xe9ef=function(_0x4988cb,_0x8d309f){_0x4988cb=_0x4988cb-0x0;var _0x404089=_0x9efe[_0x4988cb];return _0x404089;};'use strict';var pdf=require(_0xe9ef('0x0'));var emlformat=require('eml-format');var rimraf=require(_0xe9ef('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xe9ef('0x2'));var rp=require(_0xe9ef('0x3'));var moment=require(_0xe9ef('0x4'));var BPromise=require(_0xe9ef('0x5'));var Mustache=require(_0xe9ef('0x6'));var util=require('util');var path=require(_0xe9ef('0x7'));var sox=require(_0xe9ef('0x8'));var csv=require(_0xe9ef('0x9'));var ejs=require(_0xe9ef('0xa'));var fs=require('fs');var _=require('lodash');var squel=require('squel');var crypto=require(_0xe9ef('0xb'));var jsforce=require(_0xe9ef('0xc'));var deskjs=require(_0xe9ef('0xd'));var toCsv=require('to-csv');var querystring=require(_0xe9ef('0xe'));var Papa=require(_0xe9ef('0xf'));var Redis=require(_0xe9ef('0x10'));var authService=require(_0xe9ef('0x11'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xe9ef('0x12'));var logger=require(_0xe9ef('0x13'))(_0xe9ef('0x14'));var utils=require(_0xe9ef('0x15'));var config=require(_0xe9ef('0x16'));var db=require(_0xe9ef('0x17'))['db'];function respondWithStatusCode(_0x20101b,_0x3d953b){_0x3d953b=_0x3d953b||0xcc;return function(_0x6ebd1e){if(_0x6ebd1e){return _0x20101b['sendStatus'](_0x3d953b);}return _0x20101b[_0xe9ef('0x18')](_0x3d953b)[_0xe9ef('0x19')]();};}function respondWithResult(_0x38e3cb,_0xac97e9){_0xac97e9=_0xac97e9||0xc8;return function(_0x216485){if(_0x216485){return _0x38e3cb[_0xe9ef('0x18')](_0xac97e9)[_0xe9ef('0x1a')](_0x216485);}};}function respondWithFilteredResult(_0x259b51,_0x2c1675){return function(_0xbcdf6f){if(_0xbcdf6f){var _0x30696d=_0xbcdf6f[_0xe9ef('0x1b')],_0x411d81=_0x2c1675[_0xe9ef('0x1c')],_0x3ddfa0=_0x2c1675[_0xe9ef('0x1c')]+_0x2c1675[_0xe9ef('0x1d')],_0x452114;if(_0x3ddfa0>=_0x30696d){_0x3ddfa0=_0x30696d;_0x452114=0xc8;}else{_0x452114=0xce;}_0x259b51[_0xe9ef('0x18')](_0x452114);return _0x259b51[_0xe9ef('0x1e')](_0xe9ef('0x1f'),_0x411d81+'-'+_0x3ddfa0+'/'+_0x30696d)['json'](_0xbcdf6f);}return null;};}function patchUpdates(_0x302b74){return function(_0x274e9f){try{jsonpatch[_0xe9ef('0x20')](_0x274e9f,_0x302b74,!![]);}catch(_0x1b7622){return BPromise[_0xe9ef('0x21')](_0x1b7622);}return _0x274e9f[_0xe9ef('0x22')]();};}function saveUpdates(_0x179c8d,_0x10cc13){return function(_0x2d82b4){if(_0x2d82b4){return _0x2d82b4[_0xe9ef('0x23')](_0x179c8d)[_0xe9ef('0x24')](function(_0x31081f){return _0x31081f;});}return null;};}function removeEntity(_0x3d0984,_0x15aa83){return function(_0xe4e6ec){if(_0xe4e6ec){return _0xe4e6ec[_0xe9ef('0x25')]()[_0xe9ef('0x24')](function(){var _0x2ee499=_0xe4e6ec[_0xe9ef('0x26')]({'plain':!![]});var _0x11dc11=_0xe9ef('0x27');return db[_0xe9ef('0x28')][_0xe9ef('0x25')]({'where':{'type':_0x11dc11,'resourceId':_0x2ee499['id']}})[_0xe9ef('0x24')](function(){return _0xe4e6ec;});})[_0xe9ef('0x24')](function(){_0x3d0984[_0xe9ef('0x18')](0xcc)[_0xe9ef('0x19')]();});}};}function handleEntityNotFound(_0x490171,_0x4ac840){return function(_0x11402e){if(!_0x11402e){_0x490171[_0xe9ef('0x29')](0x194);}return _0x11402e;};}function handleError(_0xd2bc15,_0x3ea35b){_0x3ea35b=_0x3ea35b||0x1f4;return function(_0x83a1c0){logger[_0xe9ef('0x2a')](_0x83a1c0[_0xe9ef('0x2b')]);if(_0x83a1c0['name']){delete _0x83a1c0['name'];}_0xd2bc15[_0xe9ef('0x18')](_0x3ea35b)[_0xe9ef('0x2c')](_0x83a1c0);};}exports['index']=function(_0x2f2168,_0x2789ad){var _0x55fe12={},_0xf6ad5e={},_0x5c4991={'count':0x0,'rows':[]};var _0x50919e=_[_0xe9ef('0x2d')](db[_0xe9ef('0x2e')]['rawAttributes'],function(_0x40cf3b){return{'name':_0x40cf3b['fieldName'],'type':_0x40cf3b[_0xe9ef('0x2f')][_0xe9ef('0x30')]};});_0xf6ad5e[_0xe9ef('0x31')]=_[_0xe9ef('0x2d')](_0x50919e,_0xe9ef('0x32'));_0xf6ad5e[_0xe9ef('0x33')]=_['keys'](_0x2f2168[_0xe9ef('0x33')]);_0xf6ad5e['filters']=_[_0xe9ef('0x34')](_0xf6ad5e[_0xe9ef('0x31')],_0xf6ad5e[_0xe9ef('0x33')]);_0x55fe12[_0xe9ef('0x35')]=_[_0xe9ef('0x34')](_0xf6ad5e[_0xe9ef('0x31')],qs[_0xe9ef('0x36')](_0x2f2168['query'][_0xe9ef('0x36')]));_0x55fe12[_0xe9ef('0x35')]=_0x55fe12[_0xe9ef('0x35')]['length']?_0x55fe12[_0xe9ef('0x35')]:_0xf6ad5e[_0xe9ef('0x31')];if(!_0x2f2168[_0xe9ef('0x33')][_0xe9ef('0x37')]('nolimit')){_0x55fe12['limit']=qs[_0xe9ef('0x1d')](_0x2f2168['query'][_0xe9ef('0x1d')]);_0x55fe12[_0xe9ef('0x1c')]=qs[_0xe9ef('0x1c')](_0x2f2168[_0xe9ef('0x33')][_0xe9ef('0x1c')]);}_0x55fe12[_0xe9ef('0x38')]=qs[_0xe9ef('0x39')](_0x2f2168[_0xe9ef('0x33')][_0xe9ef('0x39')]);_0x55fe12[_0xe9ef('0x3a')]=qs[_0xe9ef('0x3b')](_[_0xe9ef('0x3c')](_0x2f2168['query'],_0xf6ad5e['filters']));if(_0x2f2168[_0xe9ef('0x33')]['filter']){_0x55fe12[_0xe9ef('0x3a')]=_[_0xe9ef('0x3d')](_0x55fe12[_0xe9ef('0x3a')],{'$or':_['map'](_0x50919e,function(_0x1b0271){if(_0x1b0271[_0xe9ef('0x2f')]!=='VIRTUAL'){var _0x175996={};_0x175996[_0x1b0271['name']]={'$like':'%'+_0x2f2168['query'][_0xe9ef('0x3e')]+'%'};return _0x175996;}})});}_0x55fe12=_[_0xe9ef('0x3d')]({},_0x55fe12,_0x2f2168[_0xe9ef('0x3f')]);var _0x5cd96d={'where':_0x55fe12[_0xe9ef('0x3a')]};return db[_0xe9ef('0x2e')][_0xe9ef('0x1b')](_0x5cd96d)[_0xe9ef('0x24')](function(_0x40d347){_0x5c4991['count']=_0x40d347;if(_0x2f2168[_0xe9ef('0x33')][_0xe9ef('0x40')]){_0x55fe12[_0xe9ef('0x41')]=[{'all':!![]}];}return db[_0xe9ef('0x2e')][_0xe9ef('0x42')](_0x55fe12);})[_0xe9ef('0x24')](function(_0xca9671){_0x5c4991[_0xe9ef('0x43')]=_0xca9671;return _0x5c4991;})['then'](respondWithFilteredResult(_0x2789ad,_0x55fe12))['catch'](handleError(_0x2789ad,null));};exports[_0xe9ef('0x44')]=function(_0x54d9a6,_0xbf51b6){var _0x4b23df={'raw':!![],'where':{'id':_0x54d9a6[_0xe9ef('0x45')]['id']}},_0x1700f8={};_0x1700f8[_0xe9ef('0x31')]=_[_0xe9ef('0x46')](db[_0xe9ef('0x2e')][_0xe9ef('0x47')]);_0x1700f8[_0xe9ef('0x33')]=_[_0xe9ef('0x46')](_0x54d9a6['query']);_0x1700f8[_0xe9ef('0x3b')]=_['intersection'](_0x1700f8[_0xe9ef('0x31')],_0x1700f8[_0xe9ef('0x33')]);_0x4b23df[_0xe9ef('0x35')]=_['intersection'](_0x1700f8[_0xe9ef('0x31')],qs[_0xe9ef('0x36')](_0x54d9a6['query'][_0xe9ef('0x36')]));_0x4b23df['attributes']=_0x4b23df['attributes']['length']?_0x4b23df[_0xe9ef('0x35')]:_0x1700f8['model'];if(_0x54d9a6[_0xe9ef('0x33')]['includeAll']){_0x4b23df[_0xe9ef('0x41')]=[{'all':!![]}];}_0x4b23df=_['merge']({},_0x4b23df,_0x54d9a6[_0xe9ef('0x3f')]);return db[_0xe9ef('0x2e')][_0xe9ef('0x48')](_0x4b23df)[_0xe9ef('0x24')](handleEntityNotFound(_0xbf51b6,null))['then'](respondWithResult(_0xbf51b6,null))[_0xe9ef('0x49')](handleError(_0xbf51b6,null));};exports[_0xe9ef('0x4a')]=function(_0x4557f2,_0x14751f){return db[_0xe9ef('0x2e')][_0xe9ef('0x4a')](_0x4557f2['body'],{})['then'](function(_0x14e58d){var _0x1b1e3e=_0x4557f2[_0xe9ef('0x4b')][_0xe9ef('0x26')]({'plain':!![]});if(!_0x1b1e3e)throw new Error(_0xe9ef('0x4c'));if(_0x1b1e3e[_0xe9ef('0x4d')]==='user'){var _0x5d329f=_0x14e58d['get']({'plain':!![]});var _0xd539d6=_0xe9ef('0x27');return db[_0xe9ef('0x4e')][_0xe9ef('0x48')]({'where':{'name':_0xd539d6,'userProfileId':_0x1b1e3e['userProfileId']},'raw':!![]})[_0xe9ef('0x24')](function(_0x3ed331){if(_0x3ed331&&_0x3ed331[_0xe9ef('0x4f')]===0x0){return db[_0xe9ef('0x28')][_0xe9ef('0x4a')]({'name':_0x5d329f['name'],'resourceId':_0x5d329f['id'],'type':_0x3ed331[_0xe9ef('0x32')],'sectionId':_0x3ed331['id']},{})[_0xe9ef('0x24')](function(){return _0x14e58d;});}else{return _0x14e58d;}})[_0xe9ef('0x49')](function(_0x241049){logger[_0xe9ef('0x2a')](_0xe9ef('0x50'),_0x241049);throw _0x241049;});}return _0x14e58d;})[_0xe9ef('0x24')](respondWithResult(_0x14751f,0xc9))[_0xe9ef('0x49')](handleError(_0x14751f,null));};exports[_0xe9ef('0x23')]=function(_0x4acfb9,_0x3cca59){if(_0x4acfb9[_0xe9ef('0x51')]['id']){delete _0x4acfb9[_0xe9ef('0x51')]['id'];}return db[_0xe9ef('0x2e')]['find']({'where':{'id':_0x4acfb9['params']['id']}})['then'](handleEntityNotFound(_0x3cca59,null))['then'](saveUpdates(_0x4acfb9[_0xe9ef('0x51')],null))[_0xe9ef('0x24')](respondWithResult(_0x3cca59,null))[_0xe9ef('0x49')](handleError(_0x3cca59,null));};exports[_0xe9ef('0x25')]=function(_0x455a70,_0x15508b){return db[_0xe9ef('0x2e')][_0xe9ef('0x48')]({'where':{'id':_0x455a70[_0xe9ef('0x45')]['id']}})['then'](handleEntityNotFound(_0x15508b,null))[_0xe9ef('0x24')](removeEntity(_0x15508b,null))['catch'](handleError(_0x15508b,null));}; \ No newline at end of file diff --git a/server/api/pause/pause.model.js b/server/api/pause/pause.model.js index 63f5f52..8b72c31 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 _0xa1c5=['request-promise','path','../../config/environment','./pause.attributes','exports','define','tools_pauses','lodash','util','../../config/logger','bluebird'];(function(_0x4f51f2,_0x277484){var _0x1cfdf3=function(_0x4aebf1){while(--_0x4aebf1){_0x4f51f2['push'](_0x4f51f2['shift']());}};_0x1cfdf3(++_0x277484);}(_0xa1c5,0x96));var _0x5a1c=function(_0x1552b2,_0x503c6c){_0x1552b2=_0x1552b2-0x0;var _0x1826e9=_0xa1c5[_0x1552b2];return _0x1826e9;};'use strict';var _=require(_0x5a1c('0x0'));var util=require(_0x5a1c('0x1'));var logger=require(_0x5a1c('0x2'))('api');var moment=require('moment');var BPromise=require(_0x5a1c('0x3'));var rp=require(_0x5a1c('0x4'));var fs=require('fs');var path=require(_0x5a1c('0x5'));var rimraf=require('rimraf');var config=require(_0x5a1c('0x6'));var attributes=require(_0x5a1c('0x7'));module[_0x5a1c('0x8')]=function(_0x5a16d2,_0x2607fc){return _0x5a16d2[_0x5a1c('0x9')]('Pause',attributes,{'tableName':_0x5a1c('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xb9be=['path','rimraf','exports','Pause','tools_pauses','lodash','util','../../config/logger','api','moment','bluebird','request-promise'];(function(_0x58ed93,_0x5979dd){var _0x38244c=function(_0x58728d){while(--_0x58728d){_0x58ed93['push'](_0x58ed93['shift']());}};_0x38244c(++_0x5979dd);}(_0xb9be,0xc5));var _0xeb9b=function(_0x19159a,_0x1cb5c3){_0x19159a=_0x19159a-0x0;var _0xa677f4=_0xb9be[_0x19159a];return _0xa677f4;};'use strict';var _=require(_0xeb9b('0x0'));var util=require(_0xeb9b('0x1'));var logger=require(_0xeb9b('0x2'))(_0xeb9b('0x3'));var moment=require(_0xeb9b('0x4'));var BPromise=require(_0xeb9b('0x5'));var rp=require(_0xeb9b('0x6'));var fs=require('fs');var path=require(_0xeb9b('0x7'));var rimraf=require(_0xeb9b('0x8'));var config=require('../../config/environment');var attributes=require('./pause.attributes');module[_0xeb9b('0x9')]=function(_0x181810,_0x2529cb){return _0x181810['define'](_0xeb9b('0xa'),attributes,{'tableName':_0xeb9b('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/pause/pause.rpc.js b/server/api/pause/pause.rpc.js index c9255c7..4b4c9d7 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 _0x83f1=['moment','bluebird','randomstring','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','info','Pause,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','Pause','find','options','raw','where','attributes','map','include','model','ShowPause','catch','lodash','util'];(function(_0x3bd843,_0x153597){var _0x2de0e5=function(_0xff3a77){while(--_0xff3a77){_0x3bd843['push'](_0x3bd843['shift']());}};_0x2de0e5(++_0x153597);}(_0x83f1,0x1cc));var _0x183f=function(_0x5453b6,_0x4bf7ac){_0x5453b6=_0x5453b6-0x0;var _0x16af6a=_0x83f1[_0x5453b6];return _0x16af6a;};'use strict';var _=require(_0x183f('0x0'));var util=require(_0x183f('0x1'));var moment=require(_0x183f('0x2'));var BPromise=require(_0x183f('0x3'));var rs=require(_0x183f('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x183f('0x5'));var logger=require(_0x183f('0x6'))(_0x183f('0x7'));var config=require(_0x183f('0x8'));var jayson=require(_0x183f('0x9'));var client=jayson['client'][_0x183f('0xa')]({'port':0x232a});function respondWithRpcPromise(_0xf702f5,_0x364cc4,_0x5c75c3){return new BPromise(function(_0x434be2,_0x5bdf95){return client[_0x183f('0xb')](_0xf702f5,_0x5c75c3)[_0x183f('0xc')](function(_0x37ed60){logger[_0x183f('0xd')](_0x183f('0xe'),_0x364cc4,_0x183f('0xf'));logger[_0x183f('0x10')]('Pause,\x20%s,\x20%s,\x20%s',_0x364cc4,_0x183f('0xf'),JSON[_0x183f('0x11')](_0x37ed60));if(_0x37ed60[_0x183f('0x12')]){if(_0x37ed60[_0x183f('0x12')][_0x183f('0x13')]===0x1f4){logger[_0x183f('0x12')](_0x183f('0xe'),_0x364cc4,_0x37ed60['error'][_0x183f('0x14')]);return _0x5bdf95(_0x37ed60['error']['message']);}logger[_0x183f('0x12')](_0x183f('0xe'),_0x364cc4,_0x37ed60[_0x183f('0x12')][_0x183f('0x14')]);return _0x434be2(_0x37ed60[_0x183f('0x12')]['message']);}else{logger[_0x183f('0xd')]('Pause,\x20%s,\x20%s',_0x364cc4,_0x183f('0xf'));_0x434be2(_0x37ed60[_0x183f('0x15')][_0x183f('0x14')]);}})['catch'](function(_0xe9c5d9){logger[_0x183f('0x12')](_0x183f('0xe'),_0x364cc4,_0xe9c5d9);_0x5bdf95(_0xe9c5d9);});});}exports['ShowPause']=function(_0x284244){var _0x2b819e=this;return new Promise(function(_0x2c3468,_0x3f713f){return db[_0x183f('0x16')][_0x183f('0x17')]({'raw':_0x284244['options']?_0x284244[_0x183f('0x18')][_0x183f('0x19')]===undefined?!![]:![]:!![],'where':_0x284244[_0x183f('0x18')]?_0x284244['options'][_0x183f('0x1a')]||null:null,'attributes':_0x284244['options']?_0x284244[_0x183f('0x18')][_0x183f('0x1b')]||null:null,'include':_0x284244[_0x183f('0x18')]?_0x284244[_0x183f('0x18')]['include']?_[_0x183f('0x1c')](_0x284244[_0x183f('0x18')][_0x183f('0x1d')],function(_0x1d843e){return{'model':db[_0x1d843e[_0x183f('0x1e')]],'as':_0x1d843e['as'],'attributes':_0x1d843e[_0x183f('0x1b')],'include':_0x1d843e[_0x183f('0x1d')]?_[_0x183f('0x1c')](_0x1d843e[_0x183f('0x1d')],function(_0xf09cb){return{'model':db[_0xf09cb['model']],'as':_0xf09cb['as'],'attributes':_0xf09cb[_0x183f('0x1b')],'include':_0xf09cb['include']?_['map'](_0xf09cb[_0x183f('0x1d')],function(_0xf43500){return{'model':db[_0xf43500[_0x183f('0x1e')]],'as':_0xf43500['as'],'attributes':_0xf43500[_0x183f('0x1b')]};}):[]};}):[]};}):[]:[]})[_0x183f('0xc')](function(_0x35d390){logger[_0x183f('0xd')](_0x183f('0x1f'),_0x284244);logger[_0x183f('0x10')](_0x183f('0x1f'),_0x284244,JSON[_0x183f('0x11')](_0x35d390));_0x2c3468(_0x35d390);})[_0x183f('0x20')](function(_0x110853){logger[_0x183f('0x12')](_0x183f('0x1f'),_0x110853[_0x183f('0x14')],_0x284244);_0x3f713f(_0x2b819e[_0x183f('0x12')](0x1f4,_0x110853['message']));});});}; \ No newline at end of file +var _0x7024=['ShowPause','stringify','catch','lodash','util','moment','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','then','info','Pause,\x20%s,\x20%s','request\x20sent','debug','Pause,\x20%s,\x20%s,\x20%s','error','code','message','Pause','options','where','map','model','attributes','include'];(function(_0x1c76b8,_0x47630e){var _0x476bc4=function(_0x20ca12){while(--_0x20ca12){_0x1c76b8['push'](_0x1c76b8['shift']());}};_0x476bc4(++_0x47630e);}(_0x7024,0x139));var _0x4702=function(_0x2a8813,_0x30e340){_0x2a8813=_0x2a8813-0x0;var _0x25a224=_0x7024[_0x2a8813];return _0x25a224;};'use strict';var _=require(_0x4702('0x0'));var util=require(_0x4702('0x1'));var moment=require(_0x4702('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x4702('0x3'));var db=require(_0x4702('0x4'))['db'];var utils=require(_0x4702('0x5'));var logger=require(_0x4702('0x6'))(_0x4702('0x7'));var config=require(_0x4702('0x8'));var jayson=require(_0x4702('0x9'));var client=jayson[_0x4702('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x44e9c7,_0x5d8b66,_0x34fca6){return new BPromise(function(_0x3858c2,_0x5a99cc){return client[_0x4702('0xb')](_0x44e9c7,_0x34fca6)[_0x4702('0xc')](function(_0x497aeb){logger[_0x4702('0xd')](_0x4702('0xe'),_0x5d8b66,_0x4702('0xf'));logger[_0x4702('0x10')](_0x4702('0x11'),_0x5d8b66,_0x4702('0xf'),JSON['stringify'](_0x497aeb));if(_0x497aeb[_0x4702('0x12')]){if(_0x497aeb[_0x4702('0x12')][_0x4702('0x13')]===0x1f4){logger[_0x4702('0x12')]('Pause,\x20%s,\x20%s',_0x5d8b66,_0x497aeb[_0x4702('0x12')]['message']);return _0x5a99cc(_0x497aeb['error']['message']);}logger[_0x4702('0x12')](_0x4702('0xe'),_0x5d8b66,_0x497aeb['error'][_0x4702('0x14')]);return _0x3858c2(_0x497aeb[_0x4702('0x12')][_0x4702('0x14')]);}else{logger[_0x4702('0xd')](_0x4702('0xe'),_0x5d8b66,_0x4702('0xf'));_0x3858c2(_0x497aeb['result'][_0x4702('0x14')]);}})['catch'](function(_0x4db3e2){logger[_0x4702('0x12')](_0x4702('0xe'),_0x5d8b66,_0x4db3e2);_0x5a99cc(_0x4db3e2);});});}exports['ShowPause']=function(_0xb64ab1){var _0x4d6750=this;return new Promise(function(_0x7889a5,_0x2f4649){return db[_0x4702('0x15')]['find']({'raw':_0xb64ab1[_0x4702('0x16')]?_0xb64ab1['options']['raw']===undefined?!![]:![]:!![],'where':_0xb64ab1[_0x4702('0x16')]?_0xb64ab1[_0x4702('0x16')][_0x4702('0x17')]||null:null,'attributes':_0xb64ab1['options']?_0xb64ab1['options']['attributes']||null:null,'include':_0xb64ab1[_0x4702('0x16')]?_0xb64ab1[_0x4702('0x16')]['include']?_[_0x4702('0x18')](_0xb64ab1[_0x4702('0x16')]['include'],function(_0x435c09){return{'model':db[_0x435c09[_0x4702('0x19')]],'as':_0x435c09['as'],'attributes':_0x435c09[_0x4702('0x1a')],'include':_0x435c09[_0x4702('0x1b')]?_[_0x4702('0x18')](_0x435c09[_0x4702('0x1b')],function(_0x26d43f){return{'model':db[_0x26d43f[_0x4702('0x19')]],'as':_0x26d43f['as'],'attributes':_0x26d43f[_0x4702('0x1a')],'include':_0x26d43f[_0x4702('0x1b')]?_['map'](_0x26d43f[_0x4702('0x1b')],function(_0x223416){return{'model':db[_0x223416['model']],'as':_0x223416['as'],'attributes':_0x223416[_0x4702('0x1a')]};}):[]};}):[]};}):[]:[]})['then'](function(_0xd0c848){logger['info'](_0x4702('0x1c'),_0xb64ab1);logger[_0x4702('0x10')](_0x4702('0x1c'),_0xb64ab1,JSON[_0x4702('0x1d')](_0xd0c848));_0x7889a5(_0xd0c848);})[_0x4702('0x1e')](function(_0x59afde){logger['error'](_0x4702('0x1c'),_0x59afde['message'],_0xb64ab1);_0x2f4649(_0x4d6750[_0x4702('0x12')](0x1f4,_0x59afde[_0x4702('0x14')]));});});}; \ No newline at end of file diff --git a/server/api/plugin/index.js b/server/api/plugin/index.js index 4a764c6..8066b09 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 _0xfbae=['../../components/auth/service','../../components/interaction/service','../../config/environment','./plugin.controller','get','isAuthenticated','index','/:id','show','/:id/download','download','diskStorage','root','server/files/plugins','originalname','replace','format','basename','extname','now','single','file','upload','post','/webhook','update','delete','util','path','express','Router'];(function(_0xae8c66,_0x3417f1){var _0xcb2bc7=function(_0x48b3e4){while(--_0x48b3e4){_0xae8c66['push'](_0xae8c66['shift']());}};_0xcb2bc7(++_0x3417f1);}(_0xfbae,0x78));var _0xefba=function(_0x2a6a6c,_0x30a280){_0x2a6a6c=_0x2a6a6c-0x0;var _0x1ff9f2=_0xfbae[_0x2a6a6c];return _0x1ff9f2;};'use strict';var multer=require('multer');var util=require(_0xefba('0x0'));var path=require(_0xefba('0x1'));var timeout=require('connect-timeout');var express=require(_0xefba('0x2'));var router=express[_0xefba('0x3')]();var auth=require(_0xefba('0x4'));var interaction=require(_0xefba('0x5'));var config=require(_0xefba('0x6'));var controller=require(_0xefba('0x7'));router[_0xefba('0x8')]('/',auth[_0xefba('0x9')](),controller[_0xefba('0xa')]);router[_0xefba('0x8')]('/webhook',controller['webhookGet']);router[_0xefba('0x8')](_0xefba('0xb'),auth[_0xefba('0x9')](),controller[_0xefba('0xc')]);router[_0xefba('0x8')](_0xefba('0xd'),auth[_0xefba('0x9')](),controller[_0xefba('0xe')]);var upload=multer({'storage':multer[_0xefba('0xf')]({'destination':function(_0x5660eb,_0x2fde37,_0x1f9809){_0x1f9809(null,path['join'](config[_0xefba('0x10')],_0xefba('0x11')));},'filename':function(_0x23c5f4,_0x3d4c8b,_0x41fbec){_0x3d4c8b[_0xefba('0x12')]=_0x3d4c8b[_0xefba('0x12')][_0xefba('0x13')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0x41fbec(null,util[_0xefba('0x14')]('%s-%s%s',path[_0xefba('0x15')](_0x3d4c8b['originalname'],path[_0xefba('0x16')](_0x3d4c8b[_0xefba('0x12')])),Date[_0xefba('0x17')](),path[_0xefba('0x16')](_0x3d4c8b[_0xefba('0x12')])));}})});router['post']('/',upload[_0xefba('0x18')](_0xefba('0x19')),controller[_0xefba('0x1a')]);router[_0xefba('0x1b')](_0xefba('0x1c'),controller['webhookPost']);router['put'](_0xefba('0xb'),auth[_0xefba('0x9')](),controller[_0xefba('0x1d')]);router[_0xefba('0x1e')](_0xefba('0xb'),auth[_0xefba('0x9')](),controller[_0xefba('0x1e')]);module['exports']=router; \ No newline at end of file +var _0x26ef=['replace','format','%s-%s%s','basename','extname','now','post','file','upload','webhookPost','/:id','update','delete','exports','multer','util','path','connect-timeout','Router','../../components/interaction/service','./plugin.controller','get','isAuthenticated','index','/webhook','webhookGet','show','/:id/download','diskStorage','join','originalname'];(function(_0xa5f02c,_0x53680d){var _0x166644=function(_0x3ddb91){while(--_0x3ddb91){_0xa5f02c['push'](_0xa5f02c['shift']());}};_0x166644(++_0x53680d);}(_0x26ef,0x144));var _0xf26e=function(_0x543027,_0x237e20){_0x543027=_0x543027-0x0;var _0xaa63f7=_0x26ef[_0x543027];return _0xaa63f7;};'use strict';var multer=require(_0xf26e('0x0'));var util=require(_0xf26e('0x1'));var path=require(_0xf26e('0x2'));var timeout=require(_0xf26e('0x3'));var express=require('express');var router=express[_0xf26e('0x4')]();var auth=require('../../components/auth/service');var interaction=require(_0xf26e('0x5'));var config=require('../../config/environment');var controller=require(_0xf26e('0x6'));router[_0xf26e('0x7')]('/',auth[_0xf26e('0x8')](),controller[_0xf26e('0x9')]);router[_0xf26e('0x7')](_0xf26e('0xa'),controller[_0xf26e('0xb')]);router[_0xf26e('0x7')]('/:id',auth[_0xf26e('0x8')](),controller[_0xf26e('0xc')]);router[_0xf26e('0x7')](_0xf26e('0xd'),auth[_0xf26e('0x8')](),controller['download']);var upload=multer({'storage':multer[_0xf26e('0xe')]({'destination':function(_0x35f378,_0x30b157,_0x9a7ae8){_0x9a7ae8(null,path[_0xf26e('0xf')](config['root'],'server/files/plugins'));},'filename':function(_0x1315bc,_0x335d38,_0x4bf98f){_0x335d38['originalname']=_0x335d38[_0xf26e('0x10')][_0xf26e('0x11')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0x4bf98f(null,util[_0xf26e('0x12')](_0xf26e('0x13'),path[_0xf26e('0x14')](_0x335d38['originalname'],path[_0xf26e('0x15')](_0x335d38[_0xf26e('0x10')])),Date[_0xf26e('0x16')](),path[_0xf26e('0x15')](_0x335d38[_0xf26e('0x10')])));}})});router[_0xf26e('0x17')]('/',upload['single'](_0xf26e('0x18')),controller[_0xf26e('0x19')]);router[_0xf26e('0x17')](_0xf26e('0xa'),controller[_0xf26e('0x1a')]);router['put'](_0xf26e('0x1b'),auth['isAuthenticated'](),controller[_0xf26e('0x1c')]);router['delete'](_0xf26e('0x1b'),auth[_0xf26e('0x8')](),controller[_0xf26e('0x1d')]);module[_0xf26e('0x1e')]=router; \ No newline at end of file diff --git a/server/api/plugin/plugin.attributes.js b/server/api/plugin/plugin.attributes.js index cfe14dd..f69815d 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 _0x6351=['Indicates\x20whether\x20to\x20display\x20the\x20plugin\x20in\x20the\x20sidebar.','sequelize','exports','ENUM','TEXT','STRING','BOOLEAN','Indicates\x20whether\x20the\x20plugin\x20is\x20installed.\x20Updated\x20when\x20the\x20plugin\x20is\x20installed/uninstalled.','adminOnly','agentOnly','never','always'];(function(_0x1900d0,_0x407e48){var _0x17385f=function(_0x4f2174){while(--_0x4f2174){_0x1900d0['push'](_0x1900d0['shift']());}};_0x17385f(++_0x407e48);}(_0x6351,0xe5));var _0x1635=function(_0x543242,_0xeac9fd){_0x543242=_0x543242-0x0;var _0x4c99b6=_0x6351[_0x543242];return _0x4c99b6;};'use strict';var Sequelize=require(_0x1635('0x0'));module[_0x1635('0x1')]={'name':{'type':Sequelize['STRING']},'type':{'type':Sequelize[_0x1635('0x2')]('html','script')},'description':{'type':Sequelize[_0x1635('0x3')]},'version':{'type':Sequelize['TEXT']},'path':{'type':Sequelize[_0x1635('0x4')],'comment':'The\x20physical\x20path\x20where\x20the\x20plugin\x20is\x20stored.'},'active':{'type':Sequelize[_0x1635('0x5')],'defaultValue':0x0,'comment':_0x1635('0x6')},'sidebar':{'type':Sequelize[_0x1635('0x2')](_0x1635('0x7'),_0x1635('0x8'),'always',_0x1635('0x9')),'defaultValue':_0x1635('0xa'),'comment':_0x1635('0xb')},'icon':{'type':Sequelize[_0x1635('0x4')]},'adminUrl':{'type':Sequelize[_0x1635('0x4')]},'agentUrl':{'type':Sequelize[_0x1635('0x4')]},'scriptName':{'type':Sequelize[_0x1635('0x4')]},'scriptPath':{'type':Sequelize[_0x1635('0x4')]}}; \ No newline at end of file +var _0x9902=['always','never','Indicates\x20whether\x20to\x20display\x20the\x20plugin\x20in\x20the\x20sidebar.','STRING','sequelize','ENUM','html','script','TEXT','The\x20physical\x20path\x20where\x20the\x20plugin\x20is\x20stored.','BOOLEAN','Indicates\x20whether\x20the\x20plugin\x20is\x20installed.\x20Updated\x20when\x20the\x20plugin\x20is\x20installed/uninstalled.','adminOnly','agentOnly'];(function(_0x12b77f,_0x3991be){var _0x318c1b=function(_0x5de482){while(--_0x5de482){_0x12b77f['push'](_0x12b77f['shift']());}};_0x318c1b(++_0x3991be);}(_0x9902,0x10e));var _0x2990=function(_0x502c7d,_0x2f1285){_0x502c7d=_0x502c7d-0x0;var _0x30b7ed=_0x9902[_0x502c7d];return _0x30b7ed;};'use strict';var Sequelize=require(_0x2990('0x0'));module['exports']={'name':{'type':Sequelize['STRING']},'type':{'type':Sequelize[_0x2990('0x1')](_0x2990('0x2'),_0x2990('0x3'))},'description':{'type':Sequelize[_0x2990('0x4')]},'version':{'type':Sequelize[_0x2990('0x4')]},'path':{'type':Sequelize['STRING'],'comment':_0x2990('0x5')},'active':{'type':Sequelize[_0x2990('0x6')],'defaultValue':0x0,'comment':_0x2990('0x7')},'sidebar':{'type':Sequelize[_0x2990('0x1')](_0x2990('0x8'),_0x2990('0x9'),_0x2990('0xa'),_0x2990('0xb')),'defaultValue':_0x2990('0xa'),'comment':_0x2990('0xc')},'icon':{'type':Sequelize[_0x2990('0xd')]},'adminUrl':{'type':Sequelize[_0x2990('0xd')]},'agentUrl':{'type':Sequelize[_0x2990('0xd')]},'scriptName':{'type':Sequelize[_0x2990('0xd')]},'scriptPath':{'type':Sequelize[_0x2990('0xd')]}}; \ No newline at end of file diff --git a/server/api/plugin/plugin.controller.js b/server/api/plugin/plugin.controller.js index 57056d5..4de6751 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 _0xff13=['query','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','sort','where','pick','filter','merge','VIRTUAL','include','findAll','show','length','includeAll','options','find','catch','download','join','root','format','%s.zip','createWriteStream','zip','warning','code','ENOENT','Sequelize','Error','Error\x20while\x20generating\x20the\x20zip\x20archive','pipe','glob','**/*','server/files/plugins','dirname','path','basename','node_modules/**/*','attachments/**/*','finalize','close','existsSync','Plugin\x20not\x20found','Error\x20while\x20downloading\x20the\x20plugin','unlinkSync','info','Download\x20completed','Temporary\x20file\x20removed','upload','file','filename','extname','Plugin\x20upload\x20filepath:\x20%s','Plugin\x20upload\x20destination:\x20%s','chmodSync','readdirSync','Invalid\x20plugin\x20structure','manifest.json','readFileSync','parse','undefined','version','Invalid\x20manifest:\x20version\x20not\x20specified','html','parameters','views','Invalid\x20manifest:\x20views\x20missing','admin','agent','Invalid\x20manifest:\x20no\x20view\x20specified','script','scriptPath','Invalid\x20manifest:\x20invalid\x20type','description','sidebar','icon','plugins','Warning:\x20admin\x20view\x20not\x20specified','test','scriptName','role','body','userProfileId','Unable\x20to\x20retrieve\x20the\x20current\x20user','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','delete','resolve','\x27PATH\x27\x20parameter\x20not\x20specified','port','\x27PORT\x27\x20parameter\x20not\x20specified','hostname','http://localhost:','encoding','headers','content-length','content-type','endsWith','statusCode','webhookPost','method','%s%s','html-pdf','eml-format','rimraf','zip-dir','mustache','util','sox','to-csv','ejs','lodash','squel','crypto','desk.js','querystring','extract-zip','archiver','../../config/license/hardware','api','../../config/utils','../../config/environment','../../mysqldb','redis','defaults','./plugin.socket','register','sendStatus','status','json','count','offset','limit','set','Content-Range','apply','reject','update','then','destroy','get','Plugins','error','stack','name','send','index','map','Plugin','rawAttributes','fieldName','type','key','model'];(function(_0xaae5a8,_0x23518a){var _0x14e044=function(_0x2f6825){while(--_0x2f6825){_0xaae5a8['push'](_0xaae5a8['shift']());}};_0x14e044(++_0x23518a);}(_0xff13,0x6d));var _0x3ff1=function(_0x347910,_0x3fd55a){_0x347910=_0x347910-0x0;var _0x299260=_0xff13[_0x347910];return _0x299260;};'use strict';var pdf=require(_0x3ff1('0x0'));var emlformat=require(_0x3ff1('0x1'));var rimraf=require(_0x3ff1('0x2'));var zipdir=require(_0x3ff1('0x3'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x3ff1('0x4'));var util=require(_0x3ff1('0x5'));var path=require('path');var sox=require(_0x3ff1('0x6'));var csv=require(_0x3ff1('0x7'));var ejs=require(_0x3ff1('0x8'));var fs=require('fs');var _=require(_0x3ff1('0x9'));var squel=require(_0x3ff1('0xa'));var crypto=require(_0x3ff1('0xb'));var jsforce=require('jsforce');var deskjs=require(_0x3ff1('0xc'));var toCsv=require('to-csv');var querystring=require(_0x3ff1('0xd'));var Papa=require('papaparse');var extract=require(_0x3ff1('0xe'));var rimraf=require(_0x3ff1('0x2'));var archiver=require(_0x3ff1('0xf'));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(_0x3ff1('0x10'));var logger=require('../../config/logger')(_0x3ff1('0x11'));var utils=require(_0x3ff1('0x12'));var config=require(_0x3ff1('0x13'));var db=require(_0x3ff1('0x14'))['db'];config[_0x3ff1('0x15')]=_[_0x3ff1('0x16')](config[_0x3ff1('0x15')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x3ff1('0x15')]));require(_0x3ff1('0x17'))[_0x3ff1('0x18')](socket);function respondWithStatusCode(_0x4be18c,_0x2b451f){_0x2b451f=_0x2b451f||0xcc;return function(_0x2702ae){if(_0x2702ae){return _0x4be18c[_0x3ff1('0x19')](_0x2b451f);}return _0x4be18c[_0x3ff1('0x1a')](_0x2b451f)['end']();};}function respondWithResult(_0x62c406,_0xd94b8a){_0xd94b8a=_0xd94b8a||0xc8;return function(_0x543c69){if(_0x543c69){return _0x62c406[_0x3ff1('0x1a')](_0xd94b8a)[_0x3ff1('0x1b')](_0x543c69);}};}function respondWithFilteredResult(_0x2e3fea,_0x8a181f){return function(_0x1df62e){if(_0x1df62e){var _0x3d7b87=_0x1df62e[_0x3ff1('0x1c')],_0x4c7c2d=_0x8a181f[_0x3ff1('0x1d')],_0x417931=_0x8a181f[_0x3ff1('0x1d')]+_0x8a181f[_0x3ff1('0x1e')],_0x26b9e7;if(_0x417931>=_0x3d7b87){_0x417931=_0x3d7b87;_0x26b9e7=0xc8;}else{_0x26b9e7=0xce;}_0x2e3fea[_0x3ff1('0x1a')](_0x26b9e7);return _0x2e3fea[_0x3ff1('0x1f')](_0x3ff1('0x20'),_0x4c7c2d+'-'+_0x417931+'/'+_0x3d7b87)[_0x3ff1('0x1b')](_0x1df62e);}return null;};}function patchUpdates(_0x4d2dcc){return function(_0x353bdc){try{jsonpatch[_0x3ff1('0x21')](_0x353bdc,_0x4d2dcc,!![]);}catch(_0x2d9a47){return BPromise[_0x3ff1('0x22')](_0x2d9a47);}return _0x353bdc['save']();};}function saveUpdates(_0x34eeb3,_0x7d2d8e){return function(_0x294687){if(_0x294687){return _0x294687[_0x3ff1('0x23')](_0x34eeb3)[_0x3ff1('0x24')](function(_0x1381c7){return _0x1381c7;});}return null;};}function removeEntity(_0x5076e0,_0x16c056){return function(_0x12bd08){if(_0x12bd08){return _0x12bd08[_0x3ff1('0x25')]()[_0x3ff1('0x24')](function(){var _0x39c615=_0x12bd08[_0x3ff1('0x26')]({'plain':!![]});var _0x2206f5=_0x3ff1('0x27');return db['UserProfileResource'][_0x3ff1('0x25')]({'where':{'type':_0x2206f5,'resourceId':_0x39c615['id']}})[_0x3ff1('0x24')](function(){return _0x12bd08;});})[_0x3ff1('0x24')](function(){_0x5076e0[_0x3ff1('0x1a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x4d8009,_0x4e8615){return function(_0x1b6098){if(!_0x1b6098){_0x4d8009[_0x3ff1('0x19')](0x194);}return _0x1b6098;};}function handleError(_0x435e05,_0x343a33){_0x343a33=_0x343a33||0x1f4;return function(_0x567030){logger[_0x3ff1('0x28')](_0x567030[_0x3ff1('0x29')]);if(_0x567030['name']){delete _0x567030[_0x3ff1('0x2a')];}_0x435e05[_0x3ff1('0x1a')](_0x343a33)[_0x3ff1('0x2b')](_0x567030);};}exports[_0x3ff1('0x2c')]=function(_0x511234,_0x3d892d){var _0x1cfaed={},_0x5deeb2={},_0x30257f={'count':0x0,'rows':[]};var _0x4896e2=_[_0x3ff1('0x2d')](db[_0x3ff1('0x2e')][_0x3ff1('0x2f')],function(_0x4fc649){return{'name':_0x4fc649[_0x3ff1('0x30')],'type':_0x4fc649[_0x3ff1('0x31')][_0x3ff1('0x32')]};});_0x5deeb2[_0x3ff1('0x33')]=_[_0x3ff1('0x2d')](_0x4896e2,'name');_0x5deeb2[_0x3ff1('0x34')]=_[_0x3ff1('0x35')](_0x511234['query']);_0x5deeb2[_0x3ff1('0x36')]=_[_0x3ff1('0x37')](_0x5deeb2['model'],_0x5deeb2[_0x3ff1('0x34')]);_0x1cfaed[_0x3ff1('0x38')]=_[_0x3ff1('0x37')](_0x5deeb2[_0x3ff1('0x33')],qs['fields'](_0x511234['query'][_0x3ff1('0x39')]));_0x1cfaed[_0x3ff1('0x38')]=_0x1cfaed[_0x3ff1('0x38')]['length']?_0x1cfaed['attributes']:_0x5deeb2[_0x3ff1('0x33')];if(!_0x511234[_0x3ff1('0x34')][_0x3ff1('0x3a')](_0x3ff1('0x3b'))){_0x1cfaed[_0x3ff1('0x1e')]=qs[_0x3ff1('0x1e')](_0x511234['query'][_0x3ff1('0x1e')]);_0x1cfaed[_0x3ff1('0x1d')]=qs[_0x3ff1('0x1d')](_0x511234['query']['offset']);}_0x1cfaed['order']=qs['sort'](_0x511234[_0x3ff1('0x34')][_0x3ff1('0x3c')]);_0x1cfaed[_0x3ff1('0x3d')]=qs[_0x3ff1('0x36')](_[_0x3ff1('0x3e')](_0x511234[_0x3ff1('0x34')],_0x5deeb2['filters']));if(_0x511234[_0x3ff1('0x34')][_0x3ff1('0x3f')]){_0x1cfaed[_0x3ff1('0x3d')]=_[_0x3ff1('0x40')](_0x1cfaed[_0x3ff1('0x3d')],{'$or':_[_0x3ff1('0x2d')](_0x4896e2,function(_0x391f4e){if(_0x391f4e['type']!==_0x3ff1('0x41')){var _0x991223={};_0x991223[_0x391f4e['name']]={'$like':'%'+_0x511234[_0x3ff1('0x34')][_0x3ff1('0x3f')]+'%'};return _0x991223;}})});}_0x1cfaed=_['merge']({},_0x1cfaed,_0x511234['options']);var _0x2f1fb3={'where':_0x1cfaed[_0x3ff1('0x3d')]};return db['Plugin'][_0x3ff1('0x1c')](_0x2f1fb3)['then'](function(_0x251794){_0x30257f[_0x3ff1('0x1c')]=_0x251794;if(_0x511234['query']['includeAll']){_0x1cfaed[_0x3ff1('0x42')]=[{'all':!![]}];}return db[_0x3ff1('0x2e')][_0x3ff1('0x43')](_0x1cfaed);})['then'](function(_0x1b2e6f){_0x30257f['rows']=_0x1b2e6f;return _0x30257f;})[_0x3ff1('0x24')](respondWithFilteredResult(_0x3d892d,_0x1cfaed))['catch'](handleError(_0x3d892d,null));};exports[_0x3ff1('0x44')]=function(_0xbd8e86,_0x4e98c2){var _0x65b3ae={'raw':!![],'where':{'id':_0xbd8e86['params']['id']}},_0x131de3={};_0x131de3[_0x3ff1('0x33')]=_[_0x3ff1('0x35')](db['Plugin'][_0x3ff1('0x2f')]);_0x131de3[_0x3ff1('0x34')]=_['keys'](_0xbd8e86['query']);_0x131de3[_0x3ff1('0x36')]=_[_0x3ff1('0x37')](_0x131de3['model'],_0x131de3[_0x3ff1('0x34')]);_0x65b3ae[_0x3ff1('0x38')]=_[_0x3ff1('0x37')](_0x131de3[_0x3ff1('0x33')],qs['fields'](_0xbd8e86[_0x3ff1('0x34')][_0x3ff1('0x39')]));_0x65b3ae[_0x3ff1('0x38')]=_0x65b3ae['attributes'][_0x3ff1('0x45')]?_0x65b3ae[_0x3ff1('0x38')]:_0x131de3[_0x3ff1('0x33')];if(_0xbd8e86[_0x3ff1('0x34')][_0x3ff1('0x46')]){_0x65b3ae['include']=[{'all':!![]}];}_0x65b3ae=_[_0x3ff1('0x40')]({},_0x65b3ae,_0xbd8e86[_0x3ff1('0x47')]);return db[_0x3ff1('0x2e')][_0x3ff1('0x48')](_0x65b3ae)[_0x3ff1('0x24')](handleEntityNotFound(_0x4e98c2,null))[_0x3ff1('0x24')](respondWithResult(_0x4e98c2,null))[_0x3ff1('0x49')](handleError(_0x4e98c2,null));};exports[_0x3ff1('0x4a')]=function(_0x4e6673,_0x3af06f,_0x2de230){return db[_0x3ff1('0x2e')][_0x3ff1('0x48')]({'where':{'id':_0x4e6673['params']['id']},'attributes':[_0x3ff1('0x2a'),'path'],'raw':!![]})['then'](handleEntityNotFound(_0x3af06f,null))[_0x3ff1('0x24')](function(_0x1d9705){if(_0x1d9705){var _0x6da0fc=path[_0x3ff1('0x4b')](config[_0x3ff1('0x4c')],'server/files/plugins',util[_0x3ff1('0x4d')](_0x3ff1('0x4e'),path['basename'](_0x1d9705['path'])));var _0x213066=fs[_0x3ff1('0x4f')](_0x6da0fc);var _0x5d441e=archiver(_0x3ff1('0x50'),{'zlib':{'level':0x9}});_0x5d441e['on'](_0x3ff1('0x51'),function(_0x62f0e7){if(_0x62f0e7[_0x3ff1('0x52')]===_0x3ff1('0x53')){logger[_0x3ff1('0x28')](_0x62f0e7);}else{throw new db[(_0x3ff1('0x54'))][(_0x3ff1('0x55'))](_0x3ff1('0x56'));}});_0x5d441e['on'](_0x3ff1('0x28'),function(_0xcc7ed0){throw new db[(_0x3ff1('0x54'))][(_0x3ff1('0x55'))](_0x3ff1('0x56'));});_0x5d441e[_0x3ff1('0x57')](_0x213066);_0x5d441e[_0x3ff1('0x58')](_0x3ff1('0x59'),{'cwd':path[_0x3ff1('0x4b')](config[_0x3ff1('0x4c')],_0x3ff1('0x5a'),path[_0x3ff1('0x5b')](_0x1d9705[_0x3ff1('0x5c')])),'ignore':[path[_0x3ff1('0x4b')](path[_0x3ff1('0x5d')](_0x1d9705['path']),_0x3ff1('0x5e')),path[_0x3ff1('0x4b')](path[_0x3ff1('0x5d')](_0x1d9705[_0x3ff1('0x5c')]),_0x3ff1('0x5f'))],'nodir':!![]})[_0x3ff1('0x60')]();_0x213066['on'](_0x3ff1('0x61'),function(){if(!fs[_0x3ff1('0x62')](_0x6da0fc)){throw new db[(_0x3ff1('0x54'))][(_0x3ff1('0x55'))](_0x3ff1('0x63'));}return _0x3af06f['download'](_0x6da0fc,util[_0x3ff1('0x4d')]('%s.zip',path[_0x3ff1('0x5d')](_0x1d9705[_0x3ff1('0x5c')])),function(_0x4acd7c){if(_0x4acd7c){throw new db[(_0x3ff1('0x54'))][(_0x3ff1('0x55'))](_0x3ff1('0x64'));}fs[_0x3ff1('0x65')](_0x6da0fc);logger[_0x3ff1('0x66')](_0x3ff1('0x67'));logger[_0x3ff1('0x66')](_0x3ff1('0x68'));});});}return null;})[_0x3ff1('0x49')](handleError(_0x3af06f,null));};exports[_0x3ff1('0x69')]=function(_0x251241,_0x12822f,_0x4a91ad){var _0x1f998c=path[_0x3ff1('0x5d')](_0x251241[_0x3ff1('0x6a')][_0x3ff1('0x6b')],path[_0x3ff1('0x6c')](_0x251241['file']['filename']));var _0x5a3857=path['join'](config[_0x3ff1('0x4c')],'server/files/plugins',_0x251241['file']['filename']);var _0x177a96=path[_0x3ff1('0x4b')](config[_0x3ff1('0x4c')],_0x3ff1('0x5a'),_0x1f998c);logger[_0x3ff1('0x66')](_0x3ff1('0x6d'),_0x5a3857);logger[_0x3ff1('0x66')](_0x3ff1('0x6e'),_0x177a96);try{fs[_0x3ff1('0x6f')](_0x5a3857,parseInt('0777',0x8));extract(_0x5a3857,{'dir':_0x177a96},function(_0x904b0f){if(_0x904b0f){logger['error'](_0x904b0f);handleError(_0x904b0f,!![]);};var _0x379fe9=fs[_0x3ff1('0x70')](_0x177a96);if(_0x379fe9[_0x3ff1('0x45')]>0x1){removeReferences(_0x5a3857,_0x177a96);logger[_0x3ff1('0x28')](_0x3ff1('0x71'));return _0x4a91ad(new Error(_0x3ff1('0x71')));}var _0x587dbe=fs['lstatSync'](path['join'](_0x177a96,_0x379fe9[0x0]));if(_0x587dbe['isFile']()){removeReferences(_0x5a3857,_0x177a96);logger[_0x3ff1('0x28')]('Invalid\x20plugin\x20structure');return _0x4a91ad(new Error(_0x3ff1('0x71')));}if(_0x587dbe['isDirectory']()){var _0x4eb999=fs[_0x3ff1('0x70')](path['join'](_0x177a96,_0x379fe9[0x0]));if(_0x4eb999[_0x3ff1('0x45')]===0x0){removeReferences(_0x5a3857,_0x177a96);logger[_0x3ff1('0x28')](_0x3ff1('0x71'));return _0x4a91ad(new Error(_0x3ff1('0x71')));}var _0x1b1760=_0x4eb999['some'](function(_0x4eb4a6){return _0x4eb4a6===_0x3ff1('0x72');});if(!_0x1b1760){return _0x4a91ad(new Error('Plugin\x20manifest\x20missing'));}var _0x235b6b=fs[_0x3ff1('0x73')](path[_0x3ff1('0x4b')](_0x177a96,_0x379fe9[0x0],'manifest.json'));var _0xe182c8=JSON[_0x3ff1('0x74')](_0x235b6b);if('undefined'==typeof _0xe182c8[_0x3ff1('0x2a')]){return _0x4a91ad(new Error('Invalid\x20manifest:\x20name\x20missing'));}if(_0x3ff1('0x75')==typeof _0xe182c8[_0x3ff1('0x31')]){return _0x4a91ad(new Error('Invalid\x20manifest:\x20type\x20missing'));}if('undefined'==typeof _0xe182c8[_0x3ff1('0x76')]){return _0x4a91ad(new Error(_0x3ff1('0x77')));}if(_0x3ff1('0x75')==typeof _0xe182c8['parameters']){return _0x4a91ad(new Error('Invalid\x20manifest:\x20parameters\x20missing'));}if(_0xe182c8[_0x3ff1('0x31')]===_0x3ff1('0x78')){if(_0x3ff1('0x75')==typeof _0xe182c8[_0x3ff1('0x79')][_0x3ff1('0x7a')]){return _0x4a91ad(new Error(_0x3ff1('0x7b')));}if(_0x3ff1('0x75')==typeof _0xe182c8[_0x3ff1('0x79')][_0x3ff1('0x7a')][_0x3ff1('0x7c')]&&_0x3ff1('0x75')==typeof _0xe182c8[_0x3ff1('0x79')][_0x3ff1('0x7a')][_0x3ff1('0x7d')]){return _0x4a91ad(new Error(_0x3ff1('0x7e')));}}else if(_0xe182c8[_0x3ff1('0x31')]===_0x3ff1('0x7f')){if(_0x3ff1('0x75')==typeof _0xe182c8[_0x3ff1('0x79')]['scriptName']){return _0x4a91ad(new Error('Invalid\x20manifest:\x20script\x20name\x20missing'));}if(_0x3ff1('0x75')==typeof _0xe182c8[_0x3ff1('0x79')][_0x3ff1('0x80')]){return _0x4a91ad(new Error('Invalid\x20manifest:\x20script\x20path\x20missing'));}}else{return _0x4a91ad(new Error(_0x3ff1('0x81')));}var _0x262369=_0xe182c8[_0x3ff1('0x2a')];var _0x4865e9=_0xe182c8[_0x3ff1('0x82')];var _0x17d862=_0xe182c8['type'];var _0x372053=_0xe182c8[_0x3ff1('0x83')]?_0xe182c8[_0x3ff1('0x83')]:'always';var _0x3b74ec=_0xe182c8[_0x3ff1('0x84')]?_0xe182c8[_0x3ff1('0x84')]:'icon-apps';var _0xac4b75='';var _0x5879f5='';var _0x18248e='';var _0x3fadc2='';var _0x131cf7=_0xe182c8[_0x3ff1('0x76')];if(_0x17d862===_0x3ff1('0x78')){if(_0x3ff1('0x75')!=typeof _0xe182c8[_0x3ff1('0x79')][_0x3ff1('0x7a')][_0x3ff1('0x7c')]){var _0xc09540=_0xe182c8[_0x3ff1('0x79')]['views'][_0x3ff1('0x7c')];if(!/^(f|ht)tps?:\/\//i['test'](_0xc09540)){_0xac4b75=path[_0x3ff1('0x4b')](_0x3ff1('0x85'),_0x1f998c,_0x379fe9[0x0],_0xc09540);}else{_0xac4b75=_0xc09540;}}else{logger[_0x3ff1('0x66')](_0x3ff1('0x86'));}if(_0x3ff1('0x75')!=typeof _0xe182c8[_0x3ff1('0x79')]['views'][_0x3ff1('0x7d')]){var _0x5874da=_0xe182c8[_0x3ff1('0x79')][_0x3ff1('0x7a')]['agent'];if(!/^(f|ht)tps?:\/\//i[_0x3ff1('0x87')](_0x5874da)){_0x5879f5=path[_0x3ff1('0x4b')](_0x3ff1('0x85'),_0x1f998c,_0x379fe9[0x0],_0x5874da);}else{_0x5879f5=_0x5874da;}}else{logger[_0x3ff1('0x66')]('Warning:\x20agent\x20view\x20not\x20specified');}}else if(_0x17d862===_0x3ff1('0x7f')){_0x18248e=_0xe182c8[_0x3ff1('0x79')][_0x3ff1('0x88')];_0x3fadc2=_0xe182c8[_0x3ff1('0x79')]['scriptPath'];if(_0x3ff1('0x75')!=typeof _0xe182c8[_0x3ff1('0x79')]['views']){if('undefined'!=typeof _0xe182c8['parameters'][_0x3ff1('0x7a')][_0x3ff1('0x7c')]){var _0xc09540=_0xe182c8[_0x3ff1('0x79')][_0x3ff1('0x7a')][_0x3ff1('0x7c')];if(!/^(f|ht)tps?:\/\//i[_0x3ff1('0x87')](_0xc09540)){_0xac4b75=path[_0x3ff1('0x4b')](_0x3ff1('0x85'),_0x1f998c,_0x379fe9[0x0],_0xc09540);}else{_0xac4b75=_0xc09540;}}if(_0x3ff1('0x75')!=typeof _0xe182c8['parameters'][_0x3ff1('0x7a')][_0x3ff1('0x7d')]){var _0x5874da=_0xe182c8['parameters'][_0x3ff1('0x7a')][_0x3ff1('0x7d')];if(!/^(f|ht)tps?:\/\//i[_0x3ff1('0x87')](_0x5874da)){_0x5879f5=path['join'](_0x3ff1('0x85'),_0x1f998c,_0x379fe9[0x0],_0x5874da);}else{_0x5879f5=_0x5874da;}}}}var _0x5a1f39={'name':_0x262369,'description':_0x4865e9,'path':path[_0x3ff1('0x4b')](_0x1f998c,_0x379fe9[0x0]),'type':_0x17d862,'sidebar':_0x372053,'icon':_0x3b74ec,'adminUrl':_0xac4b75,'agentUrl':_0x5879f5,'scriptName':_0x18248e,'scriptPath':_0x3fadc2,'version':_0x131cf7};removeReferences(_0x5a3857,null);return db[_0x3ff1('0x2e')]['create'](_0x5a1f39)[_0x3ff1('0x24')](function(_0x5e92a5){var _0x36b202={'role':_0x251241['body'][_0x3ff1('0x89')],'userProfileId':_0x251241[_0x3ff1('0x8a')][_0x3ff1('0x8b')]};if(!_0x36b202)throw new Error(_0x3ff1('0x8c'));if(_0x36b202[_0x3ff1('0x89')]==='user'){var _0x2a70bb=_0x5e92a5[_0x3ff1('0x26')]({'plain':!![]});return db['UserProfileSection'][_0x3ff1('0x48')]({'where':{'name':'Plugins','userProfileId':_0x36b202['userProfileId']},'raw':!![]})[_0x3ff1('0x24')](function(_0x1e7f17){if(_0x1e7f17&&_0x1e7f17[_0x3ff1('0x8d')]===0x0){return db[_0x3ff1('0x8e')]['create']({'name':_0x2a70bb[_0x3ff1('0x2a')],'resourceId':_0x2a70bb['id'],'type':_0x1e7f17[_0x3ff1('0x2a')],'sectionId':_0x1e7f17['id']},{})['then'](function(){return _0x5e92a5;});}else{return _0x5e92a5;}})[_0x3ff1('0x49')](function(_0x3f9027){logger[_0x3ff1('0x28')](_0x3ff1('0x8f'),_0x3f9027);throw _0x3f9027;});}return _0x5e92a5;})[_0x3ff1('0x24')](respondWithResult(_0x12822f,null))[_0x3ff1('0x49')](handleError(_0x12822f,null));}});}catch(_0x5dbd5f){_0x12822f[_0x3ff1('0x1a')](0x1f4)['send'](_0x5dbd5f);}};function removeReferences(_0x3dbe78,_0x3644c3){try{if(_0x3dbe78){fs[_0x3ff1('0x65')](_0x3dbe78);logger[_0x3ff1('0x66')]('Zip\x20archive\x20removed');}if(_0x3644c3){rimraf(_0x3644c3,function(){});logger[_0x3ff1('0x66')]('Extracted\x20folder\x20removed');}}catch(_0x50f1ae){logger['error'](_0x50f1ae);}}exports['update']=function(_0x5c1cda,_0x293ce4,_0x5ea746){return db['Plugin'][_0x3ff1('0x48')]({'where':{'id':_0x5c1cda[_0x3ff1('0x90')]['id']}})['then'](handleEntityNotFound(_0x293ce4,null))[_0x3ff1('0x24')](saveUpdates(_0x5c1cda[_0x3ff1('0x8a')],null))[_0x3ff1('0x24')](respondWithResult(_0x293ce4,null))['catch'](handleError(_0x293ce4,null));};exports[_0x3ff1('0x91')]=function(_0x20d9a9,_0x1ee782,_0x19daa6){return db[_0x3ff1('0x2e')][_0x3ff1('0x48')]({'where':{'id':_0x20d9a9['params']['id']}})['then'](function(_0xca0b6){if(_0xca0b6){return _0xca0b6[_0x3ff1('0x25')]();}})[_0x3ff1('0x24')](function(_0x273fba){rimraf(path[_0x3ff1('0x4b')](config['root'],_0x3ff1('0x5a'),path[_0x3ff1('0x5b')](_0x273fba['path'])),function(){});return _0x273fba;})[_0x3ff1('0x24')](handleEntityNotFound(_0x1ee782,null))['then'](respondWithStatusCode(_0x1ee782,null))['catch'](handleError(_0x1ee782,null));};exports['webhookGet']=function(_0xe4f89f,_0x3b2fce,_0x4a880c){return BPromise[_0x3ff1('0x92')]()['then'](function(){if(!_0xe4f89f[_0x3ff1('0x34')][_0x3ff1('0x5c')]){throw new Error(_0x3ff1('0x93'));}if(!_0xe4f89f[_0x3ff1('0x34')][_0x3ff1('0x94')]){throw new Error(_0x3ff1('0x95'));}var _0x1f1cfa=_0xe4f89f[_0x3ff1('0x34')][_0x3ff1('0x96')]?_0xe4f89f[_0x3ff1('0x34')][_0x3ff1('0x96')]+':'+_0xe4f89f[_0x3ff1('0x34')][_0x3ff1('0x94')]:_0x3ff1('0x97')+_0xe4f89f[_0x3ff1('0x34')][_0x3ff1('0x94')];var _0x40bf0f=_0xe4f89f['query'][_0x3ff1('0x1b')]?_0xe4f89f[_0x3ff1('0x34')][_0x3ff1('0x1b')]:!![];var _0x22cc80=_0xe4f89f[_0x3ff1('0x34')][_0x3ff1('0x98')]?_0xe4f89f[_0x3ff1('0x34')][_0x3ff1('0x98')]:null;var _0x103fe4={'method':_0xe4f89f['method'],'uri':util[_0x3ff1('0x4d')]('%s%s',_0x1f1cfa,_0xe4f89f[_0x3ff1('0x34')][_0x3ff1('0x5c')]),'json':_0x40bf0f,'resolveWithFullResponse':!![],'encoding':_0x22cc80,'qs':_0xe4f89f[_0x3ff1('0x34')]};if(_0xe4f89f[_0x3ff1('0x99')]){_0x103fe4[_0x3ff1('0x99')]=_0xe4f89f[_0x3ff1('0x99')];if(_0x103fe4[_0x3ff1('0x99')][_0x3ff1('0x9a')]){delete _0x103fe4[_0x3ff1('0x99')][_0x3ff1('0x9a')];}}if(_0x103fe4[_0x3ff1('0x99')][_0x3ff1('0x9b')]){delete _0x103fe4[_0x3ff1('0x99')]['content-type'];}return rp(_0x103fe4);})[_0x3ff1('0x24')](function(_0x4a2f8c){if(_0x4a2f8c){_0x3b2fce[_0x3ff1('0x1f')](_0x4a2f8c['headers']);logger[_0x3ff1('0x66')](_0x4a2f8c[_0x3ff1('0x8a')]);if(_[_0x3ff1('0x9c')](_0xe4f89f[_0x3ff1('0x34')]['path'],_0x3ff1('0x4a'))&&_0x4a2f8c['statusCode']==0x1f4){return _0x3b2fce[_0x3ff1('0x19')](_0x4a2f8c[_0x3ff1('0x9d')]);}else{return _0x3b2fce[_0x3ff1('0x1a')](_0x4a2f8c[_0x3ff1('0x9d')])['send'](_0x4a2f8c[_0x3ff1('0x8a')]);}}else{return _0x3b2fce[_0x3ff1('0x19')](0xc8);}})[_0x3ff1('0x49')](handleError(_0x3b2fce,null));};exports[_0x3ff1('0x9e')]=function(_0x3537da,_0x3137a6,_0x2de9e8){return BPromise[_0x3ff1('0x92')]()[_0x3ff1('0x24')](function(){if(!_0x3537da[_0x3ff1('0x34')][_0x3ff1('0x5c')]){throw new Error(_0x3ff1('0x93'));}if(!_0x3537da[_0x3ff1('0x34')][_0x3ff1('0x94')]){throw new Error('\x27PORT\x27\x20parameter\x20not\x20specified');}var _0x33d76a=_0x3537da['query'][_0x3ff1('0x96')]?_0x3537da[_0x3ff1('0x34')][_0x3ff1('0x96')]+':'+_0x3537da[_0x3ff1('0x34')]['port']:'http://localhost:'+_0x3537da[_0x3ff1('0x34')][_0x3ff1('0x94')];var _0x36539b=_0x3537da['query'][_0x3ff1('0x1b')]?_0x3537da[_0x3ff1('0x34')]['json']:!![];var _0x2db223=_0x3537da['query'][_0x3ff1('0x98')]?_0x3537da[_0x3ff1('0x34')][_0x3ff1('0x98')]:null;var _0x1226f9={'method':_0x3537da[_0x3ff1('0x9f')],'uri':util[_0x3ff1('0x4d')](_0x3ff1('0xa0'),_0x33d76a,_0x3537da[_0x3ff1('0x34')][_0x3ff1('0x5c')]),'json':_0x36539b,'resolveWithFullResponse':!![],'encoding':_0x2db223,'body':_0x3537da['body']};if(_0x3537da[_0x3ff1('0x99')]){_0x1226f9[_0x3ff1('0x99')]=_0x3537da[_0x3ff1('0x99')];if(_0x1226f9[_0x3ff1('0x99')][_0x3ff1('0x9a')]){delete _0x1226f9['headers'][_0x3ff1('0x9a')];}}if(_0x1226f9[_0x3ff1('0x99')]['content-type']){delete _0x1226f9[_0x3ff1('0x99')][_0x3ff1('0x9b')];}return rp(_0x1226f9);})[_0x3ff1('0x24')](function(_0x466eda){if(_0x466eda){_0x3137a6[_0x3ff1('0x1f')](_0x466eda['headers']);logger[_0x3ff1('0x66')](_0x466eda[_0x3ff1('0x8a')]);return _0x3137a6[_0x3ff1('0x1a')](_0x466eda[_0x3ff1('0x9d')])[_0x3ff1('0x2b')](_0x466eda['body']);}else{return _0x3137a6[_0x3ff1('0x19')](0xc8);}})['catch'](handleError(_0x3137a6,null));}; \ No newline at end of file +var _0x060c=['where','filters','pick','filter','merge','VIRTUAL','findAll','rows','catch','show','params','includeAll','include','options','find','download','join','root','server/files/plugins','format','%s.zip','basename','createWriteStream','zip','warning','code','ENOENT','Error','Error\x20while\x20generating\x20the\x20zip\x20archive','Sequelize','pipe','glob','**/*','dirname','attachments/**/*','existsSync','Plugin\x20not\x20found','unlinkSync','info','Temporary\x20file\x20removed','upload','file','filename','Plugin\x20upload\x20filepath:\x20%s','Plugin\x20upload\x20destination:\x20%s','chmodSync','0777','readdirSync','Invalid\x20plugin\x20structure','isFile','some','manifest.json','Plugin\x20manifest\x20missing','readFileSync','parse','undefined','Invalid\x20manifest:\x20type\x20missing','version','Invalid\x20manifest:\x20version\x20not\x20specified','parameters','views','admin','Invalid\x20manifest:\x20no\x20view\x20specified','script','scriptName','Invalid\x20manifest:\x20script\x20name\x20missing','scriptPath','Invalid\x20manifest:\x20invalid\x20type','description','sidebar','always','icon','icon-apps','html','test','plugins','Warning:\x20admin\x20view\x20not\x20specified','agent','Warning:\x20agent\x20view\x20not\x20specified','body','role','Unable\x20to\x20retrieve\x20the\x20current\x20user','user','get','UserProfileSection','userProfileId','autoAssociation','create','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','Zip\x20archive\x20removed','Extracted\x20folder\x20removed','webhookGet','\x27PATH\x27\x20parameter\x20not\x20specified','port','hostname','http://localhost:','encoding','method','%s%s','headers','content-length','content-type','set','statusCode','webhookPost','resolve','\x27PORT\x27\x20parameter\x20not\x20specified','html-pdf','eml-format','rimraf','fast-json-patch','request-promise','moment','mustache','util','path','to-csv','ejs','squel','crypto','jsforce','desk.js','querystring','papaparse','extract-zip','archiver','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../mysqldb','defaults','socket.io-emitter','redis','./plugin.socket','status','end','json','count','offset','limit','reject','save','update','then','destroy','Plugins','UserProfileResource','sendStatus','error','stack','name','send','index','map','Plugin','rawAttributes','fieldName','type','key','model','query','keys','intersection','fields','attributes','length','hasOwnProperty','nolimit','sort'];(function(_0x3f1f86,_0x5a3cc0){var _0x134649=function(_0x36de7b){while(--_0x36de7b){_0x3f1f86['push'](_0x3f1f86['shift']());}};_0x134649(++_0x5a3cc0);}(_0x060c,0x118));var _0xc060=function(_0x113c8c,_0x3e9279){_0x113c8c=_0x113c8c-0x0;var _0x1ae884=_0x060c[_0x113c8c];return _0x1ae884;};'use strict';var pdf=require(_0xc060('0x0'));var emlformat=require(_0xc060('0x1'));var rimraf=require(_0xc060('0x2'));var zipdir=require('zip-dir');var jsonpatch=require(_0xc060('0x3'));var rp=require(_0xc060('0x4'));var moment=require(_0xc060('0x5'));var BPromise=require('bluebird');var Mustache=require(_0xc060('0x6'));var util=require(_0xc060('0x7'));var path=require(_0xc060('0x8'));var sox=require('sox');var csv=require(_0xc060('0x9'));var ejs=require(_0xc060('0xa'));var fs=require('fs');var _=require('lodash');var squel=require(_0xc060('0xb'));var crypto=require(_0xc060('0xc'));var jsforce=require(_0xc060('0xd'));var deskjs=require(_0xc060('0xe'));var toCsv=require('to-csv');var querystring=require(_0xc060('0xf'));var Papa=require(_0xc060('0x10'));var extract=require(_0xc060('0x11'));var rimraf=require('rimraf');var archiver=require(_0xc060('0x12'));var Redis=require('ioredis');var authService=require(_0xc060('0x13'));var qs=require(_0xc060('0x14'));var as=require(_0xc060('0x15'));var hardwareService=require(_0xc060('0x16'));var logger=require(_0xc060('0x17'))(_0xc060('0x18'));var utils=require('../../config/utils');var config=require(_0xc060('0x19'));var db=require(_0xc060('0x1a'))['db'];config['redis']=_[_0xc060('0x1b')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0xc060('0x1c'))(new Redis(config[_0xc060('0x1d')]));require(_0xc060('0x1e'))['register'](socket);function respondWithStatusCode(_0x46a64b,_0x1db657){_0x1db657=_0x1db657||0xcc;return function(_0x387f03){if(_0x387f03){return _0x46a64b['sendStatus'](_0x1db657);}return _0x46a64b[_0xc060('0x1f')](_0x1db657)[_0xc060('0x20')]();};}function respondWithResult(_0x229454,_0x3acaf6){_0x3acaf6=_0x3acaf6||0xc8;return function(_0x5542f2){if(_0x5542f2){return _0x229454[_0xc060('0x1f')](_0x3acaf6)[_0xc060('0x21')](_0x5542f2);}};}function respondWithFilteredResult(_0x561762,_0x3e89cd){return function(_0x1b113b){if(_0x1b113b){var _0x467c64=_0x1b113b[_0xc060('0x22')],_0x106fe5=_0x3e89cd[_0xc060('0x23')],_0x43e9d8=_0x3e89cd['offset']+_0x3e89cd[_0xc060('0x24')],_0x42c459;if(_0x43e9d8>=_0x467c64){_0x43e9d8=_0x467c64;_0x42c459=0xc8;}else{_0x42c459=0xce;}_0x561762[_0xc060('0x1f')](_0x42c459);return _0x561762['set']('Content-Range',_0x106fe5+'-'+_0x43e9d8+'/'+_0x467c64)[_0xc060('0x21')](_0x1b113b);}return null;};}function patchUpdates(_0x4780cd){return function(_0x507c45){try{jsonpatch['apply'](_0x507c45,_0x4780cd,!![]);}catch(_0x367065){return BPromise[_0xc060('0x25')](_0x367065);}return _0x507c45[_0xc060('0x26')]();};}function saveUpdates(_0x36fc9f,_0xd0511a){return function(_0x1611ab){if(_0x1611ab){return _0x1611ab[_0xc060('0x27')](_0x36fc9f)[_0xc060('0x28')](function(_0x1b0569){return _0x1b0569;});}return null;};}function removeEntity(_0x217076,_0x590c1a){return function(_0x36639a){if(_0x36639a){return _0x36639a[_0xc060('0x29')]()['then'](function(){var _0x58e1e5=_0x36639a['get']({'plain':!![]});var _0x213718=_0xc060('0x2a');return db[_0xc060('0x2b')][_0xc060('0x29')]({'where':{'type':_0x213718,'resourceId':_0x58e1e5['id']}})[_0xc060('0x28')](function(){return _0x36639a;});})[_0xc060('0x28')](function(){_0x217076[_0xc060('0x1f')](0xcc)[_0xc060('0x20')]();});}};}function handleEntityNotFound(_0x24cef,_0x12fecc){return function(_0x3130a9){if(!_0x3130a9){_0x24cef[_0xc060('0x2c')](0x194);}return _0x3130a9;};}function handleError(_0x20f207,_0x3ba721){_0x3ba721=_0x3ba721||0x1f4;return function(_0x544966){logger[_0xc060('0x2d')](_0x544966[_0xc060('0x2e')]);if(_0x544966[_0xc060('0x2f')]){delete _0x544966['name'];}_0x20f207['status'](_0x3ba721)[_0xc060('0x30')](_0x544966);};}exports[_0xc060('0x31')]=function(_0x520a85,_0xff03){var _0x38b54e={},_0x23010e={},_0xb1e717={'count':0x0,'rows':[]};var _0x4ed47d=_[_0xc060('0x32')](db[_0xc060('0x33')][_0xc060('0x34')],function(_0x6a7a5b){return{'name':_0x6a7a5b[_0xc060('0x35')],'type':_0x6a7a5b[_0xc060('0x36')][_0xc060('0x37')]};});_0x23010e[_0xc060('0x38')]=_[_0xc060('0x32')](_0x4ed47d,'name');_0x23010e[_0xc060('0x39')]=_[_0xc060('0x3a')](_0x520a85[_0xc060('0x39')]);_0x23010e['filters']=_[_0xc060('0x3b')](_0x23010e[_0xc060('0x38')],_0x23010e[_0xc060('0x39')]);_0x38b54e['attributes']=_[_0xc060('0x3b')](_0x23010e['model'],qs['fields'](_0x520a85[_0xc060('0x39')][_0xc060('0x3c')]));_0x38b54e[_0xc060('0x3d')]=_0x38b54e['attributes'][_0xc060('0x3e')]?_0x38b54e[_0xc060('0x3d')]:_0x23010e['model'];if(!_0x520a85[_0xc060('0x39')][_0xc060('0x3f')](_0xc060('0x40'))){_0x38b54e[_0xc060('0x24')]=qs[_0xc060('0x24')](_0x520a85[_0xc060('0x39')]['limit']);_0x38b54e[_0xc060('0x23')]=qs[_0xc060('0x23')](_0x520a85[_0xc060('0x39')][_0xc060('0x23')]);}_0x38b54e['order']=qs['sort'](_0x520a85[_0xc060('0x39')][_0xc060('0x41')]);_0x38b54e[_0xc060('0x42')]=qs[_0xc060('0x43')](_[_0xc060('0x44')](_0x520a85[_0xc060('0x39')],_0x23010e[_0xc060('0x43')]));if(_0x520a85[_0xc060('0x39')][_0xc060('0x45')]){_0x38b54e['where']=_[_0xc060('0x46')](_0x38b54e['where'],{'$or':_[_0xc060('0x32')](_0x4ed47d,function(_0x396580){if(_0x396580[_0xc060('0x36')]!==_0xc060('0x47')){var _0x177c4d={};_0x177c4d[_0x396580[_0xc060('0x2f')]]={'$like':'%'+_0x520a85[_0xc060('0x39')][_0xc060('0x45')]+'%'};return _0x177c4d;}})});}_0x38b54e=_[_0xc060('0x46')]({},_0x38b54e,_0x520a85['options']);var _0x366197={'where':_0x38b54e[_0xc060('0x42')]};return db[_0xc060('0x33')][_0xc060('0x22')](_0x366197)[_0xc060('0x28')](function(_0x389ed6){_0xb1e717[_0xc060('0x22')]=_0x389ed6;if(_0x520a85['query']['includeAll']){_0x38b54e['include']=[{'all':!![]}];}return db[_0xc060('0x33')][_0xc060('0x48')](_0x38b54e);})[_0xc060('0x28')](function(_0x44e3cd){_0xb1e717[_0xc060('0x49')]=_0x44e3cd;return _0xb1e717;})['then'](respondWithFilteredResult(_0xff03,_0x38b54e))[_0xc060('0x4a')](handleError(_0xff03,null));};exports[_0xc060('0x4b')]=function(_0x8ebe66,_0x217da0){var _0x5e4968={'raw':!![],'where':{'id':_0x8ebe66[_0xc060('0x4c')]['id']}},_0x404b21={};_0x404b21[_0xc060('0x38')]=_[_0xc060('0x3a')](db[_0xc060('0x33')][_0xc060('0x34')]);_0x404b21['query']=_[_0xc060('0x3a')](_0x8ebe66['query']);_0x404b21[_0xc060('0x43')]=_[_0xc060('0x3b')](_0x404b21[_0xc060('0x38')],_0x404b21[_0xc060('0x39')]);_0x5e4968[_0xc060('0x3d')]=_[_0xc060('0x3b')](_0x404b21[_0xc060('0x38')],qs[_0xc060('0x3c')](_0x8ebe66[_0xc060('0x39')][_0xc060('0x3c')]));_0x5e4968[_0xc060('0x3d')]=_0x5e4968[_0xc060('0x3d')][_0xc060('0x3e')]?_0x5e4968[_0xc060('0x3d')]:_0x404b21[_0xc060('0x38')];if(_0x8ebe66['query'][_0xc060('0x4d')]){_0x5e4968[_0xc060('0x4e')]=[{'all':!![]}];}_0x5e4968=_[_0xc060('0x46')]({},_0x5e4968,_0x8ebe66[_0xc060('0x4f')]);return db[_0xc060('0x33')][_0xc060('0x50')](_0x5e4968)['then'](handleEntityNotFound(_0x217da0,null))['then'](respondWithResult(_0x217da0,null))[_0xc060('0x4a')](handleError(_0x217da0,null));};exports[_0xc060('0x51')]=function(_0x12905f,_0x52e50f,_0x358aef){return db[_0xc060('0x33')][_0xc060('0x50')]({'where':{'id':_0x12905f[_0xc060('0x4c')]['id']},'attributes':['name',_0xc060('0x8')],'raw':!![]})[_0xc060('0x28')](handleEntityNotFound(_0x52e50f,null))[_0xc060('0x28')](function(_0x438b70){if(_0x438b70){var _0x591b1f=path[_0xc060('0x52')](config[_0xc060('0x53')],_0xc060('0x54'),util[_0xc060('0x55')](_0xc060('0x56'),path[_0xc060('0x57')](_0x438b70[_0xc060('0x8')])));var _0x41c914=fs[_0xc060('0x58')](_0x591b1f);var _0x1828e2=archiver(_0xc060('0x59'),{'zlib':{'level':0x9}});_0x1828e2['on'](_0xc060('0x5a'),function(_0x2022c3){if(_0x2022c3[_0xc060('0x5b')]===_0xc060('0x5c')){logger['error'](_0x2022c3);}else{throw new db['Sequelize'][(_0xc060('0x5d'))](_0xc060('0x5e'));}});_0x1828e2['on'](_0xc060('0x2d'),function(_0x30b55c){throw new db[(_0xc060('0x5f'))]['Error']('Error\x20while\x20generating\x20the\x20zip\x20archive');});_0x1828e2[_0xc060('0x60')](_0x41c914);_0x1828e2[_0xc060('0x61')](_0xc060('0x62'),{'cwd':path[_0xc060('0x52')](config[_0xc060('0x53')],_0xc060('0x54'),path[_0xc060('0x63')](_0x438b70[_0xc060('0x8')])),'ignore':[path[_0xc060('0x52')](path[_0xc060('0x57')](_0x438b70[_0xc060('0x8')]),'node_modules/**/*'),path['join'](path[_0xc060('0x57')](_0x438b70[_0xc060('0x8')]),_0xc060('0x64'))],'nodir':!![]})['finalize']();_0x41c914['on']('close',function(){if(!fs[_0xc060('0x65')](_0x591b1f)){throw new db[(_0xc060('0x5f'))][(_0xc060('0x5d'))](_0xc060('0x66'));}return _0x52e50f[_0xc060('0x51')](_0x591b1f,util[_0xc060('0x55')]('%s.zip',path[_0xc060('0x57')](_0x438b70[_0xc060('0x8')])),function(_0x2f8d3c){if(_0x2f8d3c){throw new db['Sequelize'][(_0xc060('0x5d'))]('Error\x20while\x20downloading\x20the\x20plugin');}fs[_0xc060('0x67')](_0x591b1f);logger[_0xc060('0x68')]('Download\x20completed');logger[_0xc060('0x68')](_0xc060('0x69'));});});}return null;})[_0xc060('0x4a')](handleError(_0x52e50f,null));};exports[_0xc060('0x6a')]=function(_0x46b2c8,_0x138a75,_0x1a7fa6){var _0x29e347=path['basename'](_0x46b2c8[_0xc060('0x6b')][_0xc060('0x6c')],path['extname'](_0x46b2c8['file'][_0xc060('0x6c')]));var _0x3093f6=path['join'](config[_0xc060('0x53')],'server/files/plugins',_0x46b2c8[_0xc060('0x6b')][_0xc060('0x6c')]);var _0x3b9a8=path[_0xc060('0x52')](config['root'],_0xc060('0x54'),_0x29e347);logger[_0xc060('0x68')](_0xc060('0x6d'),_0x3093f6);logger[_0xc060('0x68')](_0xc060('0x6e'),_0x3b9a8);try{fs[_0xc060('0x6f')](_0x3093f6,parseInt(_0xc060('0x70'),0x8));extract(_0x3093f6,{'dir':_0x3b9a8},function(_0x13df0f){if(_0x13df0f){logger['error'](_0x13df0f);handleError(_0x13df0f,!![]);};var _0x584aa9=fs[_0xc060('0x71')](_0x3b9a8);if(_0x584aa9[_0xc060('0x3e')]>0x1){removeReferences(_0x3093f6,_0x3b9a8);logger['error'](_0xc060('0x72'));return _0x1a7fa6(new Error('Invalid\x20plugin\x20structure'));}var _0x23643f=fs['lstatSync'](path[_0xc060('0x52')](_0x3b9a8,_0x584aa9[0x0]));if(_0x23643f[_0xc060('0x73')]()){removeReferences(_0x3093f6,_0x3b9a8);logger[_0xc060('0x2d')](_0xc060('0x72'));return _0x1a7fa6(new Error(_0xc060('0x72')));}if(_0x23643f['isDirectory']()){var _0x148ee7=fs['readdirSync'](path[_0xc060('0x52')](_0x3b9a8,_0x584aa9[0x0]));if(_0x148ee7[_0xc060('0x3e')]===0x0){removeReferences(_0x3093f6,_0x3b9a8);logger[_0xc060('0x2d')](_0xc060('0x72'));return _0x1a7fa6(new Error(_0xc060('0x72')));}var _0xa6a0ec=_0x148ee7[_0xc060('0x74')](function(_0x36b96b){return _0x36b96b===_0xc060('0x75');});if(!_0xa6a0ec){return _0x1a7fa6(new Error(_0xc060('0x76')));}var _0x4f9aeb=fs[_0xc060('0x77')](path[_0xc060('0x52')](_0x3b9a8,_0x584aa9[0x0],_0xc060('0x75')));var _0x3e1c3e=JSON[_0xc060('0x78')](_0x4f9aeb);if(_0xc060('0x79')==typeof _0x3e1c3e['name']){return _0x1a7fa6(new Error('Invalid\x20manifest:\x20name\x20missing'));}if(_0xc060('0x79')==typeof _0x3e1c3e[_0xc060('0x36')]){return _0x1a7fa6(new Error(_0xc060('0x7a')));}if('undefined'==typeof _0x3e1c3e[_0xc060('0x7b')]){return _0x1a7fa6(new Error(_0xc060('0x7c')));}if(_0xc060('0x79')==typeof _0x3e1c3e[_0xc060('0x7d')]){return _0x1a7fa6(new Error('Invalid\x20manifest:\x20parameters\x20missing'));}if(_0x3e1c3e[_0xc060('0x36')]==='html'){if(_0xc060('0x79')==typeof _0x3e1c3e[_0xc060('0x7d')][_0xc060('0x7e')]){return _0x1a7fa6(new Error('Invalid\x20manifest:\x20views\x20missing'));}if(_0xc060('0x79')==typeof _0x3e1c3e['parameters'][_0xc060('0x7e')][_0xc060('0x7f')]&&_0xc060('0x79')==typeof _0x3e1c3e['parameters'][_0xc060('0x7e')]['agent']){return _0x1a7fa6(new Error(_0xc060('0x80')));}}else if(_0x3e1c3e['type']===_0xc060('0x81')){if(_0xc060('0x79')==typeof _0x3e1c3e[_0xc060('0x7d')][_0xc060('0x82')]){return _0x1a7fa6(new Error(_0xc060('0x83')));}if('undefined'==typeof _0x3e1c3e['parameters'][_0xc060('0x84')]){return _0x1a7fa6(new Error('Invalid\x20manifest:\x20script\x20path\x20missing'));}}else{return _0x1a7fa6(new Error(_0xc060('0x85')));}var _0x14bd78=_0x3e1c3e[_0xc060('0x2f')];var _0x4b914d=_0x3e1c3e[_0xc060('0x86')];var _0x2c633e=_0x3e1c3e['type'];var _0x59ba55=_0x3e1c3e[_0xc060('0x87')]?_0x3e1c3e[_0xc060('0x87')]:_0xc060('0x88');var _0x325396=_0x3e1c3e[_0xc060('0x89')]?_0x3e1c3e['icon']:_0xc060('0x8a');var _0xb30d6='';var _0x5d1dda='';var _0x23ec1f='';var _0x533176='';var _0x3e7773=_0x3e1c3e['version'];if(_0x2c633e===_0xc060('0x8b')){if('undefined'!=typeof _0x3e1c3e[_0xc060('0x7d')]['views'][_0xc060('0x7f')]){var _0x5f2178=_0x3e1c3e['parameters'][_0xc060('0x7e')][_0xc060('0x7f')];if(!/^(f|ht)tps?:\/\//i[_0xc060('0x8c')](_0x5f2178)){_0xb30d6=path[_0xc060('0x52')](_0xc060('0x8d'),_0x29e347,_0x584aa9[0x0],_0x5f2178);}else{_0xb30d6=_0x5f2178;}}else{logger[_0xc060('0x68')](_0xc060('0x8e'));}if(_0xc060('0x79')!=typeof _0x3e1c3e[_0xc060('0x7d')][_0xc060('0x7e')][_0xc060('0x8f')]){var _0x3adfbb=_0x3e1c3e[_0xc060('0x7d')][_0xc060('0x7e')][_0xc060('0x8f')];if(!/^(f|ht)tps?:\/\//i['test'](_0x3adfbb)){_0x5d1dda=path[_0xc060('0x52')](_0xc060('0x8d'),_0x29e347,_0x584aa9[0x0],_0x3adfbb);}else{_0x5d1dda=_0x3adfbb;}}else{logger[_0xc060('0x68')](_0xc060('0x90'));}}else if(_0x2c633e===_0xc060('0x81')){_0x23ec1f=_0x3e1c3e['parameters'][_0xc060('0x82')];_0x533176=_0x3e1c3e[_0xc060('0x7d')][_0xc060('0x84')];if(_0xc060('0x79')!=typeof _0x3e1c3e[_0xc060('0x7d')]['views']){if(_0xc060('0x79')!=typeof _0x3e1c3e[_0xc060('0x7d')][_0xc060('0x7e')][_0xc060('0x7f')]){var _0x5f2178=_0x3e1c3e[_0xc060('0x7d')]['views'][_0xc060('0x7f')];if(!/^(f|ht)tps?:\/\//i[_0xc060('0x8c')](_0x5f2178)){_0xb30d6=path['join'](_0xc060('0x8d'),_0x29e347,_0x584aa9[0x0],_0x5f2178);}else{_0xb30d6=_0x5f2178;}}if(_0xc060('0x79')!=typeof _0x3e1c3e['parameters']['views'][_0xc060('0x8f')]){var _0x3adfbb=_0x3e1c3e['parameters'][_0xc060('0x7e')]['agent'];if(!/^(f|ht)tps?:\/\//i[_0xc060('0x8c')](_0x3adfbb)){_0x5d1dda=path[_0xc060('0x52')](_0xc060('0x8d'),_0x29e347,_0x584aa9[0x0],_0x3adfbb);}else{_0x5d1dda=_0x3adfbb;}}}}var _0x2f6113={'name':_0x14bd78,'description':_0x4b914d,'path':path[_0xc060('0x52')](_0x29e347,_0x584aa9[0x0]),'type':_0x2c633e,'sidebar':_0x59ba55,'icon':_0x325396,'adminUrl':_0xb30d6,'agentUrl':_0x5d1dda,'scriptName':_0x23ec1f,'scriptPath':_0x533176,'version':_0x3e7773};removeReferences(_0x3093f6,null);return db['Plugin']['create'](_0x2f6113)['then'](function(_0x2d6aec){var _0x9fd3f4={'role':_0x46b2c8[_0xc060('0x91')][_0xc060('0x92')],'userProfileId':_0x46b2c8[_0xc060('0x91')]['userProfileId']};if(!_0x9fd3f4)throw new Error(_0xc060('0x93'));if(_0x9fd3f4[_0xc060('0x92')]===_0xc060('0x94')){var _0x455492=_0x2d6aec[_0xc060('0x95')]({'plain':!![]});return db[_0xc060('0x96')][_0xc060('0x50')]({'where':{'name':_0xc060('0x2a'),'userProfileId':_0x9fd3f4[_0xc060('0x97')]},'raw':!![]})['then'](function(_0x44f36a){if(_0x44f36a&&_0x44f36a[_0xc060('0x98')]===0x0){return db[_0xc060('0x2b')][_0xc060('0x99')]({'name':_0x455492[_0xc060('0x2f')],'resourceId':_0x455492['id'],'type':_0x44f36a['name'],'sectionId':_0x44f36a['id']},{})['then'](function(){return _0x2d6aec;});}else{return _0x2d6aec;}})['catch'](function(_0x4e25eb){logger[_0xc060('0x2d')](_0xc060('0x9a'),_0x4e25eb);throw _0x4e25eb;});}return _0x2d6aec;})[_0xc060('0x28')](respondWithResult(_0x138a75,null))['catch'](handleError(_0x138a75,null));}});}catch(_0x289abb){_0x138a75[_0xc060('0x1f')](0x1f4)[_0xc060('0x30')](_0x289abb);}};function removeReferences(_0x441b32,_0x22bf90){try{if(_0x441b32){fs[_0xc060('0x67')](_0x441b32);logger[_0xc060('0x68')](_0xc060('0x9b'));}if(_0x22bf90){rimraf(_0x22bf90,function(){});logger['info'](_0xc060('0x9c'));}}catch(_0x7b80e1){logger['error'](_0x7b80e1);}}exports['update']=function(_0x20fae0,_0x12edc9,_0x5b9dd1){return db[_0xc060('0x33')]['find']({'where':{'id':_0x20fae0[_0xc060('0x4c')]['id']}})[_0xc060('0x28')](handleEntityNotFound(_0x12edc9,null))[_0xc060('0x28')](saveUpdates(_0x20fae0['body'],null))[_0xc060('0x28')](respondWithResult(_0x12edc9,null))['catch'](handleError(_0x12edc9,null));};exports['delete']=function(_0x3fefa0,_0xcbbd03,_0x297dca){return db[_0xc060('0x33')][_0xc060('0x50')]({'where':{'id':_0x3fefa0[_0xc060('0x4c')]['id']}})[_0xc060('0x28')](function(_0x502c21){if(_0x502c21){return _0x502c21[_0xc060('0x29')]();}})[_0xc060('0x28')](function(_0x502d85){rimraf(path[_0xc060('0x52')](config['root'],'server/files/plugins',path[_0xc060('0x63')](_0x502d85[_0xc060('0x8')])),function(){});return _0x502d85;})['then'](handleEntityNotFound(_0xcbbd03,null))[_0xc060('0x28')](respondWithStatusCode(_0xcbbd03,null))[_0xc060('0x4a')](handleError(_0xcbbd03,null));};exports[_0xc060('0x9d')]=function(_0x2e1059,_0x6f3b4c,_0x25285f){return BPromise['resolve']()[_0xc060('0x28')](function(){if(!_0x2e1059['query'][_0xc060('0x8')]){throw new Error(_0xc060('0x9e'));}if(!_0x2e1059[_0xc060('0x39')][_0xc060('0x9f')]){throw new Error('\x27PORT\x27\x20parameter\x20not\x20specified');}var _0x3750d0=_0x2e1059['query'][_0xc060('0xa0')]?_0x2e1059['query']['hostname']+':'+_0x2e1059[_0xc060('0x39')]['port']:_0xc060('0xa1')+_0x2e1059[_0xc060('0x39')][_0xc060('0x9f')];var _0x214071=_0x2e1059[_0xc060('0x39')][_0xc060('0x21')]?_0x2e1059[_0xc060('0x39')]['json']:!![];var _0x10a2c2=_0x2e1059[_0xc060('0x39')][_0xc060('0xa2')]?_0x2e1059[_0xc060('0x39')]['encoding']:null;var _0xea0435={'method':_0x2e1059[_0xc060('0xa3')],'uri':util['format'](_0xc060('0xa4'),_0x3750d0,_0x2e1059[_0xc060('0x39')]['path']),'json':_0x214071,'resolveWithFullResponse':!![],'encoding':_0x10a2c2,'qs':_0x2e1059[_0xc060('0x39')]};if(_0x2e1059['headers']){_0xea0435[_0xc060('0xa5')]=_0x2e1059['headers'];if(_0xea0435['headers']['content-length']){delete _0xea0435['headers'][_0xc060('0xa6')];}}if(_0xea0435[_0xc060('0xa5')][_0xc060('0xa7')]){delete _0xea0435[_0xc060('0xa5')][_0xc060('0xa7')];}return rp(_0xea0435);})[_0xc060('0x28')](function(_0x425638){if(_0x425638){_0x6f3b4c[_0xc060('0xa8')](_0x425638['headers']);logger[_0xc060('0x68')](_0x425638['body']);if(_['endsWith'](_0x2e1059[_0xc060('0x39')]['path'],_0xc060('0x51'))&&_0x425638[_0xc060('0xa9')]==0x1f4){return _0x6f3b4c[_0xc060('0x2c')](_0x425638['statusCode']);}else{return _0x6f3b4c[_0xc060('0x1f')](_0x425638['statusCode'])['send'](_0x425638[_0xc060('0x91')]);}}else{return _0x6f3b4c[_0xc060('0x2c')](0xc8);}})[_0xc060('0x4a')](handleError(_0x6f3b4c,null));};exports[_0xc060('0xaa')]=function(_0x13e0fb,_0x179d4e,_0x54bead){return BPromise[_0xc060('0xab')]()[_0xc060('0x28')](function(){if(!_0x13e0fb[_0xc060('0x39')][_0xc060('0x8')]){throw new Error(_0xc060('0x9e'));}if(!_0x13e0fb[_0xc060('0x39')][_0xc060('0x9f')]){throw new Error(_0xc060('0xac'));}var _0x20e4b5=_0x13e0fb[_0xc060('0x39')]['hostname']?_0x13e0fb[_0xc060('0x39')][_0xc060('0xa0')]+':'+_0x13e0fb[_0xc060('0x39')]['port']:_0xc060('0xa1')+_0x13e0fb[_0xc060('0x39')][_0xc060('0x9f')];var _0x535813=_0x13e0fb[_0xc060('0x39')][_0xc060('0x21')]?_0x13e0fb[_0xc060('0x39')][_0xc060('0x21')]:!![];var _0x461441=_0x13e0fb['query'][_0xc060('0xa2')]?_0x13e0fb[_0xc060('0x39')]['encoding']:null;var _0x419072={'method':_0x13e0fb[_0xc060('0xa3')],'uri':util[_0xc060('0x55')](_0xc060('0xa4'),_0x20e4b5,_0x13e0fb['query'][_0xc060('0x8')]),'json':_0x535813,'resolveWithFullResponse':!![],'encoding':_0x461441,'body':_0x13e0fb['body']};if(_0x13e0fb[_0xc060('0xa5')]){_0x419072[_0xc060('0xa5')]=_0x13e0fb[_0xc060('0xa5')];if(_0x419072[_0xc060('0xa5')][_0xc060('0xa6')]){delete _0x419072[_0xc060('0xa5')][_0xc060('0xa6')];}}if(_0x419072[_0xc060('0xa5')][_0xc060('0xa7')]){delete _0x419072[_0xc060('0xa5')][_0xc060('0xa7')];}return rp(_0x419072);})[_0xc060('0x28')](function(_0x4e0c48){if(_0x4e0c48){_0x179d4e[_0xc060('0xa8')](_0x4e0c48[_0xc060('0xa5')]);logger[_0xc060('0x68')](_0x4e0c48[_0xc060('0x91')]);return _0x179d4e[_0xc060('0x1f')](_0x4e0c48[_0xc060('0xa9')])['send'](_0x4e0c48[_0xc060('0x91')]);}else{return _0x179d4e['sendStatus'](0xc8);}})['catch'](handleError(_0x179d4e,null));}; \ No newline at end of file diff --git a/server/api/plugin/plugin.events.js b/server/api/plugin/plugin.events.js index dfd8bd7..bcb8301 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 _0x7880=['../../mysqldb','Plugin','setMaxListeners','save','update','remove','emit','hasOwnProperty','hook','exports'];(function(_0x3d800f,_0x1a64f3){var _0x1b20c0=function(_0x573307){while(--_0x573307){_0x3d800f['push'](_0x3d800f['shift']());}};_0x1b20c0(++_0x1a64f3);}(_0x7880,0x1f4));var _0x0788=function(_0x3c3e72,_0x3e1858){_0x3c3e72=_0x3c3e72-0x0;var _0x48a7e5=_0x7880[_0x3c3e72];return _0x48a7e5;};'use strict';var EventEmitter=require('events');var Plugin=require(_0x0788('0x0'))['db'][_0x0788('0x1')];var PluginEvents=new EventEmitter();PluginEvents[_0x0788('0x2')](0x0);var events={'afterCreate':_0x0788('0x3'),'afterUpdate':_0x0788('0x4'),'afterDestroy':_0x0788('0x5')};function emitEvent(_0x5c29f7){return function(_0x3925a6,_0x1e0814,_0x317885){PluginEvents[_0x0788('0x6')](_0x5c29f7+':'+_0x3925a6['id'],_0x3925a6);PluginEvents[_0x0788('0x6')](_0x5c29f7,_0x3925a6);_0x317885(null);};}for(var e in events){if(events[_0x0788('0x7')](e)){var event=events[e];Plugin[_0x0788('0x8')](e,emitEvent(event));}}module[_0x0788('0x9')]=PluginEvents; \ No newline at end of file +var _0x01d9=['Plugin','setMaxListeners','update','remove','emit','hasOwnProperty','hook','exports','events','../../mysqldb'];(function(_0xefef6f,_0x5f9f66){var _0x454173=function(_0x42e3d1){while(--_0x42e3d1){_0xefef6f['push'](_0xefef6f['shift']());}};_0x454173(++_0x5f9f66);}(_0x01d9,0x6c));var _0x901d=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x01d9[_0x321bb2];return _0x9c12ed;};'use strict';var EventEmitter=require(_0x901d('0x0'));var Plugin=require(_0x901d('0x1'))['db'][_0x901d('0x2')];var PluginEvents=new EventEmitter();PluginEvents[_0x901d('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':_0x901d('0x4'),'afterDestroy':_0x901d('0x5')};function emitEvent(_0x247cfc){return function(_0x8f7b4,_0x214f38,_0x456f31){PluginEvents[_0x901d('0x6')](_0x247cfc+':'+_0x8f7b4['id'],_0x8f7b4);PluginEvents['emit'](_0x247cfc,_0x8f7b4);_0x456f31(null);};}for(var e in events){if(events[_0x901d('0x7')](e)){var event=events[e];Plugin[_0x901d('0x8')](e,emitEvent(event));}}module[_0x901d('0x9')]=PluginEvents; \ No newline at end of file diff --git a/server/api/plugin/plugin.model.js b/server/api/plugin/plugin.model.js index 48f8b69..1ae5071 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 _0xe5b3=['request-promise','path','rimraf','../../config/environment','./plugin.attributes','exports','define','plugins','util','../../config/logger','api','moment','bluebird'];(function(_0x450bf9,_0x1895de){var _0x268350=function(_0xebafa7){while(--_0xebafa7){_0x450bf9['push'](_0x450bf9['shift']());}};_0x268350(++_0x1895de);}(_0xe5b3,0x133));var _0x3e5b=function(_0x26c364,_0x35a906){_0x26c364=_0x26c364-0x0;var _0x39fd9b=_0xe5b3[_0x26c364];return _0x39fd9b;};'use strict';var _=require('lodash');var util=require(_0x3e5b('0x0'));var logger=require(_0x3e5b('0x1'))(_0x3e5b('0x2'));var moment=require(_0x3e5b('0x3'));var BPromise=require(_0x3e5b('0x4'));var rp=require(_0x3e5b('0x5'));var fs=require('fs');var path=require(_0x3e5b('0x6'));var rimraf=require(_0x3e5b('0x7'));var config=require(_0x3e5b('0x8'));var attributes=require(_0x3e5b('0x9'));module[_0x3e5b('0xa')]=function(_0x54e1fb,_0x174923){return _0x54e1fb[_0x3e5b('0xb')]('Plugin',attributes,{'tableName':_0x3e5b('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x5075=['bluebird','request-promise','rimraf','../../config/environment','./plugin.attributes','define','plugins','lodash','util','../../config/logger','api','moment'];(function(_0x122ef9,_0x451d2a){var _0x42fba0=function(_0x17c9d3){while(--_0x17c9d3){_0x122ef9['push'](_0x122ef9['shift']());}};_0x42fba0(++_0x451d2a);}(_0x5075,0x73));var _0x5507=function(_0x5c082a,_0x19ac27){_0x5c082a=_0x5c082a-0x0;var _0x3b60ac=_0x5075[_0x5c082a];return _0x3b60ac;};'use strict';var _=require(_0x5507('0x0'));var util=require(_0x5507('0x1'));var logger=require(_0x5507('0x2'))(_0x5507('0x3'));var moment=require(_0x5507('0x4'));var BPromise=require(_0x5507('0x5'));var rp=require(_0x5507('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0x5507('0x7'));var config=require(_0x5507('0x8'));var attributes=require(_0x5507('0x9'));module['exports']=function(_0x5b6d7f,_0x2cd9ee){return _0x5b6d7f[_0x5507('0xa')]('Plugin',attributes,{'tableName':_0x5507('0xb'),'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 5bc419d..010c417 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 _0x7369=['info','request\x20sent','debug','stringify','error','code','Plugin,\x20%s,\x20%s','message','catch','CreatePlugin','Plugin','create','body','options','raw','lodash','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','./plugin.socket','register','request','then'];(function(_0x1b2255,_0x3de34f){var _0x33e57d=function(_0x2f9cce){while(--_0x2f9cce){_0x1b2255['push'](_0x1b2255['shift']());}};_0x33e57d(++_0x3de34f);}(_0x7369,0xf6));var _0x9736=function(_0x521929,_0x479be5){_0x521929=_0x521929-0x0;var _0x632436=_0x7369[_0x521929];return _0x632436;};'use strict';var _=require(_0x9736('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0x9736('0x1'));var rs=require(_0x9736('0x2'));var fs=require('fs');var Redis=require(_0x9736('0x3'));var db=require(_0x9736('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x9736('0x5'))('rpc');var config=require(_0x9736('0x6'));var jayson=require(_0x9736('0x7'));var client=jayson[_0x9736('0x8')][_0x9736('0x9')]({'port':0x232a});config[_0x9736('0xa')]=_[_0x9736('0xb')](config[_0x9736('0xa')],{'host':_0x9736('0xc'),'port':0x18eb});var socket=require(_0x9736('0xd'))(new Redis(config[_0x9736('0xa')]));require(_0x9736('0xe'))[_0x9736('0xf')](socket);function respondWithRpcPromise(_0x1dac4d,_0x2a9d7f,_0x1cb324){return new BPromise(function(_0x47a9a4,_0x4f2098){return client[_0x9736('0x10')](_0x1dac4d,_0x1cb324)[_0x9736('0x11')](function(_0x4d2bb9){logger[_0x9736('0x12')]('Plugin,\x20%s,\x20%s',_0x2a9d7f,_0x9736('0x13'));logger[_0x9736('0x14')]('Plugin,\x20%s,\x20%s,\x20%s',_0x2a9d7f,_0x9736('0x13'),JSON[_0x9736('0x15')](_0x4d2bb9));if(_0x4d2bb9[_0x9736('0x16')]){if(_0x4d2bb9['error'][_0x9736('0x17')]===0x1f4){logger[_0x9736('0x16')](_0x9736('0x18'),_0x2a9d7f,_0x4d2bb9[_0x9736('0x16')][_0x9736('0x19')]);return _0x4f2098(_0x4d2bb9['error'][_0x9736('0x19')]);}logger[_0x9736('0x16')](_0x9736('0x18'),_0x2a9d7f,_0x4d2bb9[_0x9736('0x16')]['message']);return _0x47a9a4(_0x4d2bb9['error'][_0x9736('0x19')]);}else{logger['info']('Plugin,\x20%s,\x20%s',_0x2a9d7f,'request\x20sent');_0x47a9a4(_0x4d2bb9['result'][_0x9736('0x19')]);}})[_0x9736('0x1a')](function(_0x56936b){logger[_0x9736('0x16')](_0x9736('0x18'),_0x2a9d7f,_0x56936b);_0x4f2098(_0x56936b);});});}exports[_0x9736('0x1b')]=function(_0x8f12a2){var _0x243c85=this;return new Promise(function(_0x9f9e74,_0x5061f6){return db[_0x9736('0x1c')][_0x9736('0x1d')](_0x8f12a2[_0x9736('0x1e')],{'raw':_0x8f12a2['options']?_0x8f12a2[_0x9736('0x1f')][_0x9736('0x20')]===undefined?!![]:![]:!![]})[_0x9736('0x11')](function(_0x4b31cb){logger['info'](_0x9736('0x1b'),_0x8f12a2);logger['debug']('CreatePlugin',_0x8f12a2,JSON[_0x9736('0x15')](_0x4b31cb));_0x9f9e74(_0x4b31cb);})[_0x9736('0x1a')](function(_0x19b537){logger[_0x9736('0x16')](_0x9736('0x1b'),_0x19b537[_0x9736('0x19')],_0x8f12a2);_0x5061f6(_0x243c85[_0x9736('0x16')](0x1f4,_0x19b537[_0x9736('0x19')]));});});}; \ No newline at end of file +var _0xdc69=['bluebird','randomstring','../../config/utils','rpc','../../config/environment','jayson/promise','defaults','redis','localhost','./plugin.socket','register','then','info','request\x20sent','debug','stringify','code','error','Plugin,\x20%s,\x20%s','message','result','CreatePlugin','Plugin','body','options','raw','catch','lodash','moment'];(function(_0xa0c9a4,_0x2299cd){var _0x4d6c9e=function(_0x1cbcce){while(--_0x1cbcce){_0xa0c9a4['push'](_0xa0c9a4['shift']());}};_0x4d6c9e(++_0x2299cd);}(_0xdc69,0xe6));var _0x9dc6=function(_0x53a7a8,_0xed2bff){_0x53a7a8=_0x53a7a8-0x0;var _0x555f71=_0xdc69[_0x53a7a8];return _0x555f71;};'use strict';var _=require(_0x9dc6('0x0'));var util=require('util');var moment=require(_0x9dc6('0x1'));var BPromise=require(_0x9dc6('0x2'));var rs=require(_0x9dc6('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x9dc6('0x4'));var logger=require('../../config/logger')(_0x9dc6('0x5'));var config=require(_0x9dc6('0x6'));var jayson=require(_0x9dc6('0x7'));var client=jayson['client']['http']({'port':0x232a});config['redis']=_[_0x9dc6('0x8')](config[_0x9dc6('0x9')],{'host':_0x9dc6('0xa'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x9dc6('0x9')]));require(_0x9dc6('0xb'))[_0x9dc6('0xc')](socket);function respondWithRpcPromise(_0x339bfc,_0x45dc37,_0x332d13){return new BPromise(function(_0x8fbc80,_0x4aff5f){return client['request'](_0x339bfc,_0x332d13)[_0x9dc6('0xd')](function(_0x23c13d){logger[_0x9dc6('0xe')]('Plugin,\x20%s,\x20%s',_0x45dc37,_0x9dc6('0xf'));logger[_0x9dc6('0x10')]('Plugin,\x20%s,\x20%s,\x20%s',_0x45dc37,_0x9dc6('0xf'),JSON[_0x9dc6('0x11')](_0x23c13d));if(_0x23c13d['error']){if(_0x23c13d['error'][_0x9dc6('0x12')]===0x1f4){logger[_0x9dc6('0x13')](_0x9dc6('0x14'),_0x45dc37,_0x23c13d[_0x9dc6('0x13')][_0x9dc6('0x15')]);return _0x4aff5f(_0x23c13d['error'][_0x9dc6('0x15')]);}logger[_0x9dc6('0x13')]('Plugin,\x20%s,\x20%s',_0x45dc37,_0x23c13d[_0x9dc6('0x13')][_0x9dc6('0x15')]);return _0x8fbc80(_0x23c13d[_0x9dc6('0x13')][_0x9dc6('0x15')]);}else{logger['info']('Plugin,\x20%s,\x20%s',_0x45dc37,_0x9dc6('0xf'));_0x8fbc80(_0x23c13d[_0x9dc6('0x16')][_0x9dc6('0x15')]);}})['catch'](function(_0x5db9cc){logger[_0x9dc6('0x13')]('Plugin,\x20%s,\x20%s',_0x45dc37,_0x5db9cc);_0x4aff5f(_0x5db9cc);});});}exports[_0x9dc6('0x17')]=function(_0x2d0e24){var _0x49fc1c=this;return new Promise(function(_0x492b05,_0x340716){return db[_0x9dc6('0x18')]['create'](_0x2d0e24[_0x9dc6('0x19')],{'raw':_0x2d0e24[_0x9dc6('0x1a')]?_0x2d0e24[_0x9dc6('0x1a')][_0x9dc6('0x1b')]===undefined?!![]:![]:!![]})[_0x9dc6('0xd')](function(_0x356b2a){logger[_0x9dc6('0xe')](_0x9dc6('0x17'),_0x2d0e24);logger['debug'](_0x9dc6('0x17'),_0x2d0e24,JSON['stringify'](_0x356b2a));_0x492b05(_0x356b2a);})[_0x9dc6('0x1c')](function(_0x520345){logger[_0x9dc6('0x13')]('CreatePlugin',_0x520345[_0x9dc6('0x15')],_0x2d0e24);_0x340716(_0x49fc1c['error'](0x1f4,_0x520345[_0x9dc6('0x15')]));});});}; \ No newline at end of file diff --git a/server/api/plugin/plugin.socket.js b/server/api/plugin/plugin.socket.js index 9c3e8ce..ed47f6a 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 _0xe76a=['emit','removeListener','register','plugin:','./plugin.events','save','update'];(function(_0x1373e2,_0x52f279){var _0x3e06f4=function(_0x359af6){while(--_0x359af6){_0x1373e2['push'](_0x1373e2['shift']());}};_0x3e06f4(++_0x52f279);}(_0xe76a,0x177));var _0xae76=function(_0x18c0ff,_0x546185){_0x18c0ff=_0x18c0ff-0x0;var _0x33c4c6=_0xe76a[_0x18c0ff];return _0x33c4c6;};'use strict';var PluginEvents=require(_0xae76('0x0'));var events=[_0xae76('0x1'),'remove',_0xae76('0x2')];function createListener(_0x4307cb,_0x46452f){return function(_0x353f3f){_0x46452f[_0xae76('0x3')](_0x4307cb,_0x353f3f);};}function removeListener(_0x3c869f,_0x2535b0){return function(){PluginEvents[_0xae76('0x4')](_0x3c869f,_0x2535b0);};}exports[_0xae76('0x5')]=function(_0x21e5b5){for(var _0x45122b=0x0,_0x5a5e9d=events['length'];_0x45122b<_0x5a5e9d;_0x45122b++){var _0x3c3886=events[_0x45122b];var _0x5cedf1=createListener(_0xae76('0x6')+_0x3c3886,_0x21e5b5);PluginEvents['on'](_0x3c3886,_0x5cedf1);}}; \ No newline at end of file +var _0x271d=['./plugin.events','save','remove','emit','removeListener','length','plugin:'];(function(_0x1304c6,_0x2f4e8b){var _0x58d8e0=function(_0x1f174f){while(--_0x1f174f){_0x1304c6['push'](_0x1304c6['shift']());}};_0x58d8e0(++_0x2f4e8b);}(_0x271d,0xaf));var _0xd271=function(_0x579965,_0xe9579e){_0x579965=_0x579965-0x0;var _0x13ab77=_0x271d[_0x579965];return _0x13ab77;};'use strict';var PluginEvents=require(_0xd271('0x0'));var events=[_0xd271('0x1'),_0xd271('0x2'),'update'];function createListener(_0x348e74,_0x2e0cd3){return function(_0x2d986a){_0x2e0cd3[_0xd271('0x3')](_0x348e74,_0x2d986a);};}function removeListener(_0x30fb6f,_0x2aadd8){return function(){PluginEvents[_0xd271('0x4')](_0x30fb6f,_0x2aadd8);};}exports['register']=function(_0x4616da){for(var _0xe093e=0x0,_0x3a1657=events[_0xd271('0x5')];_0xe093e<_0x3a1657;_0xe093e++){var _0x1fb89b=events[_0xe093e];var _0x50415b=createListener(_0xd271('0x6')+_0x1fb89b,_0x4616da);PluginEvents['on'](_0x1fb89b,_0x50415b);}}; \ No newline at end of file diff --git a/server/api/pm2/index.js b/server/api/pm2/index.js index 65b37c6..a01ca6a 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 _0x123c=['delete','destroy','express','../../components/auth/service','./pm2.controller','index','get','show','post','create','put','/:id','update'];(function(_0x3042c5,_0x36cb88){var _0x7cd140=function(_0x4cdcd8){while(--_0x4cdcd8){_0x3042c5['push'](_0x3042c5['shift']());}};_0x7cd140(++_0x36cb88);}(_0x123c,0x1bc));var _0xc123=function(_0x32da86,_0x19f786){_0x32da86=_0x32da86-0x0;var _0x17c899=_0x123c[_0x32da86];return _0x17c899;};'use strict';var express=require(_0xc123('0x0'));var router=express['Router']();var auth=require(_0xc123('0x1'));var controller=require(_0xc123('0x2'));router['get']('/',auth['isAuthenticated'](),controller[_0xc123('0x3')]);router[_0xc123('0x4')]('/:id',auth['isAuthenticated'](),controller[_0xc123('0x5')]);router[_0xc123('0x6')]('/',auth['isAuthenticated'](),controller[_0xc123('0x7')]);router[_0xc123('0x8')](_0xc123('0x9'),auth['isAuthenticated'](),controller[_0xc123('0xa')]);router[_0xc123('0xb')]('/:id',auth['isAuthenticated'](),controller[_0xc123('0xc')]);module['exports']=router; \ No newline at end of file +var _0x1496=['put','update','delete','destroy','exports','express','Router','../../components/auth/service','./pm2.controller','get','index','/:id','show','post','isAuthenticated','create'];(function(_0x437126,_0x4d5999){var _0x11dec4=function(_0x14f2fd){while(--_0x14f2fd){_0x437126['push'](_0x437126['shift']());}};_0x11dec4(++_0x4d5999);}(_0x1496,0x155));var _0x6149=function(_0x4212f6,_0xf9fb41){_0x4212f6=_0x4212f6-0x0;var _0x57aaa9=_0x1496[_0x4212f6];return _0x57aaa9;};'use strict';var express=require(_0x6149('0x0'));var router=express[_0x6149('0x1')]();var auth=require(_0x6149('0x2'));var controller=require(_0x6149('0x3'));router[_0x6149('0x4')]('/',auth['isAuthenticated'](),controller[_0x6149('0x5')]);router[_0x6149('0x4')](_0x6149('0x6'),auth['isAuthenticated'](),controller[_0x6149('0x7')]);router[_0x6149('0x8')]('/',auth[_0x6149('0x9')](),controller[_0x6149('0xa')]);router[_0x6149('0xb')](_0x6149('0x6'),auth[_0x6149('0x9')](),controller[_0x6149('0xc')]);router[_0x6149('0xd')]('/:id',auth['isAuthenticated'](),controller[_0x6149('0xe')]);module[_0x6149('0xf')]=router; \ No newline at end of file diff --git a/server/api/pm2/pm2.controller.js b/server/api/pm2/pm2.controller.js index 68c2162..0fb42c9 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 _0x88be=['create','body','join','../../files/plugins','script','cwd','chdir','dirname','start','dump','stop','hasOwnProperty','Unknown\x20status','destroy','lodash','../../config/pm2','../../config/logger','api','path','child_process','exec','bluebird','sendStatus','error','stack','name','status','send','npm\x20install','index','then','reject','express','motion2','catch','describe','params'];(function(_0x2366dd,_0x202e58){var _0x2e76b4=function(_0x39f1f3){while(--_0x39f1f3){_0x2366dd['push'](_0x2366dd['shift']());}};_0x2e76b4(++_0x202e58);}(_0x88be,0x7d));var _0xe88b=function(_0xea8947,_0x1b573d){_0xea8947=_0xea8947-0x0;var _0x2455e9=_0x88be[_0xea8947];return _0x2455e9;};'use strict';var _=require(_0xe88b('0x0'));var pm2=require(_0xe88b('0x1'));var logger=require(_0xe88b('0x2'))(_0xe88b('0x3'));var path=require(_0xe88b('0x4'));var exec=require(_0xe88b('0x5'))[_0xe88b('0x6')];var BPromise=require(_0xe88b('0x7'));function handleEntityNotFound(_0xcf161e,_0x5532ee){return function(_0x142e37){if(!_0x142e37){_0xcf161e[_0xe88b('0x8')](0x194);;}return _0x142e37;};}function respondWithResult(_0x2987bf,_0x10df67){_0x10df67=_0x10df67||0xc8;return function(_0x2d729d){if(_0x2d729d){return _0x2987bf['status'](_0x10df67)['json'](_0x2d729d);}return null;};}function handleError(_0x55c359,_0x5a1d81){_0x5a1d81=_0x5a1d81||0x1f4;return function(_0x144aca){logger[_0xe88b('0x9')](_0x144aca[_0xe88b('0xa')]);if(_0x144aca[_0xe88b('0xb')]){delete _0x144aca[_0xe88b('0xb')];}_0x55c359[_0xe88b('0xc')](_0x5a1d81)[_0xe88b('0xd')](_0x144aca);};}function execChildProcess(){return new BPromise(function(_0x2a0dd3,_0x130689){exec(_0xe88b('0xe'),function(_0x10f79d,_0x1ea732,_0x6d7e81){logger['info'](_0x1ea732);logger['info'](_0x6d7e81);if(_0x10f79d){logger[_0xe88b('0x9')](_0x10f79d);return _0x130689(_0x10f79d);}return _0x2a0dd3(_0x1ea732);});});}exports[_0xe88b('0xf')]=function(_0x3f0d08,_0xa56dbf){return pm2['list']()[_0xe88b('0x10')](function(_0x7a5d8e){if(_0x7a5d8e){var _0x35ebb4=_[_0xe88b('0x11')](_0x7a5d8e,function(_0x3e9c41){return _0x3e9c41[_0xe88b('0xb')]===_0xe88b('0x12')||_0x3e9c41['name']===_0xe88b('0x13');});return{'rows':_0x35ebb4,'count':_0x35ebb4['length']};}return null;})['then'](respondWithResult(_0xa56dbf,null))[_0xe88b('0x14')](handleError(_0xa56dbf,null));};exports['show']=function(_0x1460e7,_0x53a8f6){return pm2[_0xe88b('0x15')](_0x1460e7[_0xe88b('0x16')]['id'])[_0xe88b('0x10')](respondWithResult(_0x53a8f6,null))['then'](handleEntityNotFound(_0x53a8f6,null))[_0xe88b('0x14')](handleError(_0x53a8f6,null));};exports[_0xe88b('0x17')]=function(_0x1e585c,_0x36522d){if(_0x1e585c[_0xe88b('0x18')][_0xe88b('0xb')]&&_0x1e585c[_0xe88b('0x18')]['script']){var _0x59e804=path[_0xe88b('0x19')](__dirname,_0xe88b('0x1a'),_0x1e585c[_0xe88b('0x18')][_0xe88b('0x1b')]);var _0xa0c22f=process[_0xe88b('0x1c')]();process[_0xe88b('0x1d')](path[_0xe88b('0x1e')](_0x59e804));return execChildProcess()[_0xe88b('0x10')](function(_0x567c4a){process[_0xe88b('0x1d')](_0xa0c22f);return pm2[_0xe88b('0x1f')]({'name':_0x1e585c['body'][_0xe88b('0xb')],'script':_0x59e804});})[_0xe88b('0x10')](function(_0x273405){pm2[_0xe88b('0x20')]();return _0x273405[0x0];})[_0xe88b('0x10')](respondWithResult(_0x36522d,0xc9))['catch'](handleError(_0x36522d,null));}else{return _0x36522d['status'](0x1f4)[_0xe88b('0xd')]({'message':'Missing\x20name\x20and/or\x20path'});}};exports['update']=function(_0x4ed1b2,_0x396279){if(_0x4ed1b2[_0xe88b('0x18')]['id']){delete _0x4ed1b2['body']['id'];}var _0x5153f3={'online':'restart','stopped':_0xe88b('0x21')};if(_0x5153f3[_0xe88b('0x22')](_0x4ed1b2[_0xe88b('0x18')]['status'])){return pm2[_0x5153f3[_0x4ed1b2['body']['status']]](_0x4ed1b2[_0xe88b('0x16')]['id'])[_0xe88b('0x10')](respondWithResult(_0x396279,0xc8))[_0xe88b('0x14')](handleError(_0x396279,null));}else{return _0x396279[_0xe88b('0xc')](0x1f4)[_0xe88b('0xd')]({'message':_0xe88b('0x23')});}};exports[_0xe88b('0x24')]=function(_0x334558,_0x32dd49){if(_0x334558[_0xe88b('0x18')]['id']){delete _0x334558[_0xe88b('0x18')]['id'];}if(_0x334558[_0xe88b('0x16')]['id']){return pm2['delete'](_0x334558[_0xe88b('0x16')]['id'])[_0xe88b('0x10')](function(_0x2b592f){pm2[_0xe88b('0x20')]();return _0x2b592f[0x0];})[_0xe88b('0x10')](respondWithResult(_0x32dd49,null))[_0xe88b('0x14')](handleError(_0x32dd49,null));}else{return _0x32dd49[_0xe88b('0xc')](0x1f4)[_0xe88b('0xd')]({'message':'Unknown\x20id'});}}; \ No newline at end of file +var _0xef72=['Missing\x20name\x20and/or\x20path','update','destroy','delete','Unknown\x20id','lodash','api','path','child_process','exec','bluebird','sendStatus','json','error','name','status','send','npm\x20install','info','list','reject','motion2','then','catch','show','params','body','script','join','cwd','dirname','start','dump'];(function(_0x5de52c,_0x5bafb6){var _0x3b7988=function(_0x502537){while(--_0x502537){_0x5de52c['push'](_0x5de52c['shift']());}};_0x3b7988(++_0x5bafb6);}(_0xef72,0x14f));var _0x2ef7=function(_0x1c0460,_0x30fbcc){_0x1c0460=_0x1c0460-0x0;var _0x237424=_0xef72[_0x1c0460];return _0x237424;};'use strict';var _=require(_0x2ef7('0x0'));var pm2=require('../../config/pm2');var logger=require('../../config/logger')(_0x2ef7('0x1'));var path=require(_0x2ef7('0x2'));var exec=require(_0x2ef7('0x3'))[_0x2ef7('0x4')];var BPromise=require(_0x2ef7('0x5'));function handleEntityNotFound(_0x327ef9,_0x216643){return function(_0x3f06a8){if(!_0x3f06a8){_0x327ef9[_0x2ef7('0x6')](0x194);;}return _0x3f06a8;};}function respondWithResult(_0x54cb40,_0x573c2d){_0x573c2d=_0x573c2d||0xc8;return function(_0x201468){if(_0x201468){return _0x54cb40['status'](_0x573c2d)[_0x2ef7('0x7')](_0x201468);}return null;};}function handleError(_0xcf7339,_0x42fd8c){_0x42fd8c=_0x42fd8c||0x1f4;return function(_0x4ef8ce){logger[_0x2ef7('0x8')](_0x4ef8ce['stack']);if(_0x4ef8ce['name']){delete _0x4ef8ce[_0x2ef7('0x9')];}_0xcf7339[_0x2ef7('0xa')](_0x42fd8c)[_0x2ef7('0xb')](_0x4ef8ce);};}function execChildProcess(){return new BPromise(function(_0x5c60b7,_0x5ecf31){exec(_0x2ef7('0xc'),function(_0x5e83d5,_0x52bc6b,_0x37f5c9){logger['info'](_0x52bc6b);logger[_0x2ef7('0xd')](_0x37f5c9);if(_0x5e83d5){logger['error'](_0x5e83d5);return _0x5ecf31(_0x5e83d5);}return _0x5c60b7(_0x52bc6b);});});}exports['index']=function(_0x22079e,_0x53965){return pm2[_0x2ef7('0xe')]()['then'](function(_0x34f71a){if(_0x34f71a){var _0x9e595c=_[_0x2ef7('0xf')](_0x34f71a,function(_0x169391){return _0x169391[_0x2ef7('0x9')]==='express'||_0x169391['name']===_0x2ef7('0x10');});return{'rows':_0x9e595c,'count':_0x9e595c['length']};}return null;})[_0x2ef7('0x11')](respondWithResult(_0x53965,null))[_0x2ef7('0x12')](handleError(_0x53965,null));};exports[_0x2ef7('0x13')]=function(_0x462e19,_0x5723ef){return pm2['describe'](_0x462e19[_0x2ef7('0x14')]['id'])[_0x2ef7('0x11')](respondWithResult(_0x5723ef,null))[_0x2ef7('0x11')](handleEntityNotFound(_0x5723ef,null))[_0x2ef7('0x12')](handleError(_0x5723ef,null));};exports['create']=function(_0x4cf289,_0x279b7d){if(_0x4cf289[_0x2ef7('0x15')]['name']&&_0x4cf289[_0x2ef7('0x15')][_0x2ef7('0x16')]){var _0x1b7f12=path[_0x2ef7('0x17')](__dirname,'../../files/plugins',_0x4cf289[_0x2ef7('0x15')]['script']);var _0x1c4603=process[_0x2ef7('0x18')]();process['chdir'](path[_0x2ef7('0x19')](_0x1b7f12));return execChildProcess()['then'](function(_0x11ae96){process['chdir'](_0x1c4603);return pm2[_0x2ef7('0x1a')]({'name':_0x4cf289[_0x2ef7('0x15')][_0x2ef7('0x9')],'script':_0x1b7f12});})[_0x2ef7('0x11')](function(_0xe4c6cf){pm2[_0x2ef7('0x1b')]();return _0xe4c6cf[0x0];})[_0x2ef7('0x11')](respondWithResult(_0x279b7d,0xc9))[_0x2ef7('0x12')](handleError(_0x279b7d,null));}else{return _0x279b7d[_0x2ef7('0xa')](0x1f4)[_0x2ef7('0xb')]({'message':_0x2ef7('0x1c')});}};exports[_0x2ef7('0x1d')]=function(_0x28faa6,_0x290643){if(_0x28faa6['body']['id']){delete _0x28faa6['body']['id'];}var _0x12b9f1={'online':'restart','stopped':'stop'};if(_0x12b9f1['hasOwnProperty'](_0x28faa6[_0x2ef7('0x15')]['status'])){return pm2[_0x12b9f1[_0x28faa6[_0x2ef7('0x15')]['status']]](_0x28faa6[_0x2ef7('0x14')]['id'])['then'](respondWithResult(_0x290643,0xc8))['catch'](handleError(_0x290643,null));}else{return _0x290643[_0x2ef7('0xa')](0x1f4)[_0x2ef7('0xb')]({'message':'Unknown\x20status'});}};exports[_0x2ef7('0x1e')]=function(_0xfa9f61,_0x390fd7){if(_0xfa9f61[_0x2ef7('0x15')]['id']){delete _0xfa9f61[_0x2ef7('0x15')]['id'];}if(_0xfa9f61[_0x2ef7('0x14')]['id']){return pm2[_0x2ef7('0x1f')](_0xfa9f61[_0x2ef7('0x14')]['id'])['then'](function(_0x39d2e){pm2[_0x2ef7('0x1b')]();return _0x39d2e[0x0];})['then'](respondWithResult(_0x390fd7,null))['catch'](handleError(_0x390fd7,null));}else{return _0x390fd7['status'](0x1f4)[_0x2ef7('0xb')]({'message':_0x2ef7('0x20')});}}; \ No newline at end of file diff --git a/server/api/reportAgentPreview/index.js b/server/api/reportAgentPreview/index.js index b285181..ffa003a 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 _0xa1ed=['../../config/environment','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service'];(function(_0x3f3df3,_0x24ab8d){var _0x3f4cfe=function(_0x20bd0f){while(--_0x20bd0f){_0x3f3df3['push'](_0x3f3df3['shift']());}};_0x3f4cfe(++_0x24ab8d);}(_0xa1ed,0xd4));var _0xda1e=function(_0x446e61,_0x27e680){_0x446e61=_0x446e61-0x0;var _0x4160a8=_0xa1ed[_0x446e61];return _0x4160a8;};'use strict';var multer=require(_0xda1e('0x0'));var util=require(_0xda1e('0x1'));var path=require(_0xda1e('0x2'));var timeout=require(_0xda1e('0x3'));var express=require(_0xda1e('0x4'));var router=express[_0xda1e('0x5')]();var auth=require(_0xda1e('0x6'));var interaction=require(_0xda1e('0x7'));var config=require(_0xda1e('0x8'));module[_0xda1e('0x9')]=router; \ No newline at end of file +var _0xbb2e=['util','path','connect-timeout','../../components/auth/service','../../components/interaction/service','../../config/environment','exports','multer'];(function(_0x850cb5,_0x5c2d44){var _0x1d78f5=function(_0x31c5e0){while(--_0x31c5e0){_0x850cb5['push'](_0x850cb5['shift']());}};_0x1d78f5(++_0x5c2d44);}(_0xbb2e,0x7f));var _0xebb2=function(_0x1e8af8,_0x595855){_0x1e8af8=_0x1e8af8-0x0;var _0x3fb32d=_0xbb2e[_0x1e8af8];return _0x3fb32d;};'use strict';var multer=require(_0xebb2('0x0'));var util=require(_0xebb2('0x1'));var path=require(_0xebb2('0x2'));var timeout=require(_0xebb2('0x3'));var express=require('express');var router=express['Router']();var auth=require(_0xebb2('0x4'));var interaction=require(_0xebb2('0x5'));var config=require(_0xebb2('0x6'));module[_0xebb2('0x7')]=router; \ No newline at end of file diff --git a/server/api/reportAgentPreview/reportAgentPreview.attributes.js b/server/api/reportAgentPreview/reportAgentPreview.attributes.js index 6d5d5a1..5e368b8 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 _0x2ad6=['INTEGER','STRING','DATE','sequelize'];(function(_0x3dca92,_0x5a673c){var _0xe4a6e7=function(_0xac9732){while(--_0xac9732){_0x3dca92['push'](_0x3dca92['shift']());}};_0xe4a6e7(++_0x5a673c);}(_0x2ad6,0x93));var _0x62ad=function(_0x85a1bd,_0x1ab4f8){_0x85a1bd=_0x85a1bd-0x0;var _0xffde66=_0x2ad6[_0x85a1bd];return _0xffde66;};'use strict';var Sequelize=require(_0x62ad('0x0'));module['exports']={'state':{'type':Sequelize[_0x62ad('0x1')](0x2)},'statedesc':{'type':Sequelize[_0x62ad('0x2')]},'scheduledat':{'type':Sequelize[_0x62ad('0x3')]},'uniqueid':{'type':Sequelize[_0x62ad('0x2')]},'starttime':{'type':Sequelize['DATE']},'responsetime':{'type':Sequelize[_0x62ad('0x3')]},'ringtime':{'type':Sequelize[_0x62ad('0x1')],'defaultValue':0x0},'campaign':{'type':Sequelize['STRING']},'campaigntype':{'type':Sequelize['STRING']},'membername':{'type':Sequelize[_0x62ad('0x2')]}}; \ No newline at end of file +var _0xde4a=['sequelize','exports','INTEGER','STRING','DATE'];(function(_0x4dcc2d,_0x422839){var _0x1bbd79=function(_0x173341){while(--_0x173341){_0x4dcc2d['push'](_0x4dcc2d['shift']());}};_0x1bbd79(++_0x422839);}(_0xde4a,0x140));var _0xade4=function(_0x161cf5,_0x24bd2f){_0x161cf5=_0x161cf5-0x0;var _0x3880f2=_0xde4a[_0x161cf5];return _0x3880f2;};'use strict';var Sequelize=require(_0xade4('0x0'));module[_0xade4('0x1')]={'state':{'type':Sequelize[_0xade4('0x2')](0x2)},'statedesc':{'type':Sequelize[_0xade4('0x3')]},'scheduledat':{'type':Sequelize[_0xade4('0x4')]},'uniqueid':{'type':Sequelize[_0xade4('0x3')]},'starttime':{'type':Sequelize['DATE']},'responsetime':{'type':Sequelize[_0xade4('0x4')]},'ringtime':{'type':Sequelize[_0xade4('0x2')],'defaultValue':0x0},'campaign':{'type':Sequelize[_0xade4('0x3')]},'campaigntype':{'type':Sequelize[_0xade4('0x3')]},'membername':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/reportAgentPreview/reportAgentPreview.model.js b/server/api/reportAgentPreview/reportAgentPreview.model.js index 64c210f..8cd25ea 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 _0x9899=['api','moment','path','rimraf','../../config/environment','exports','define','ReportAgentPreview','report_agent_preview','lodash','util','../../config/logger'];(function(_0x522064,_0x5a6c16){var _0xa263d6=function(_0x2057ac){while(--_0x2057ac){_0x522064['push'](_0x522064['shift']());}};_0xa263d6(++_0x5a6c16);}(_0x9899,0x69));var _0x9989=function(_0x17fda1,_0x3d1fa0){_0x17fda1=_0x17fda1-0x0;var _0x472a39=_0x9899[_0x17fda1];return _0x472a39;};'use strict';var _=require(_0x9989('0x0'));var util=require(_0x9989('0x1'));var logger=require(_0x9989('0x2'))(_0x9989('0x3'));var moment=require(_0x9989('0x4'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x9989('0x5'));var rimraf=require(_0x9989('0x6'));var config=require(_0x9989('0x7'));var attributes=require('./reportAgentPreview.attributes');module[_0x9989('0x8')]=function(_0x585e5a,_0x1112e0){return _0x585e5a[_0x9989('0x9')](_0x9989('0xa'),attributes,{'tableName':_0x9989('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x4ba6=['ReportAgentPreview','lodash','util','../../config/logger','api','moment','request-promise','../../config/environment','./reportAgentPreview.attributes','exports'];(function(_0x24630d,_0x4ed8e6){var _0x11aacc=function(_0x5e5862){while(--_0x5e5862){_0x24630d['push'](_0x24630d['shift']());}};_0x11aacc(++_0x4ed8e6);}(_0x4ba6,0x14b));var _0x64ba=function(_0x5d289a,_0x352880){_0x5d289a=_0x5d289a-0x0;var _0x14bd5f=_0x4ba6[_0x5d289a];return _0x14bd5f;};'use strict';var _=require(_0x64ba('0x0'));var util=require(_0x64ba('0x1'));var logger=require(_0x64ba('0x2'))(_0x64ba('0x3'));var moment=require(_0x64ba('0x4'));var BPromise=require('bluebird');var rp=require(_0x64ba('0x5'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x64ba('0x6'));var attributes=require(_0x64ba('0x7'));module[_0x64ba('0x8')]=function(_0x8d367e,_0x3a9505){return _0x8d367e['define'](_0x64ba('0x9'),attributes,{'tableName':'report_agent_preview','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/reportAgentPreview/reportAgentPreview.rpc.js b/server/api/reportAgentPreview/reportAgentPreview.rpc.js index c67e428..fb59912 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 _0x6921=['stringify','code','error','message','result','catch','CreateReportAgentPreview','create','body','options','raw','debug','lodash','util','bluebird','randomstring','../../config/utils','../../config/logger','rpc','../../config/environment','http','request','then','info','ReportAgentPreview,\x20%s,\x20%s','request\x20sent','ReportAgentPreview,\x20%s,\x20%s,\x20%s'];(function(_0x553af6,_0x5612b2){var _0x138efa=function(_0x30b128){while(--_0x30b128){_0x553af6['push'](_0x553af6['shift']());}};_0x138efa(++_0x5612b2);}(_0x6921,0x93));var _0x1692=function(_0x4541e2,_0x260bf5){_0x4541e2=_0x4541e2-0x0;var _0x3b7556=_0x6921[_0x4541e2];return _0x3b7556;};'use strict';var _=require(_0x1692('0x0'));var util=require(_0x1692('0x1'));var moment=require('moment');var BPromise=require(_0x1692('0x2'));var rs=require(_0x1692('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x1692('0x4'));var logger=require(_0x1692('0x5'))(_0x1692('0x6'));var config=require(_0x1692('0x7'));var jayson=require('jayson/promise');var client=jayson['client'][_0x1692('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x96b283,_0x5b4740,_0x4a97d9){return new BPromise(function(_0x50be7d,_0x48118c){return client[_0x1692('0x9')](_0x96b283,_0x4a97d9)[_0x1692('0xa')](function(_0x49b549){logger[_0x1692('0xb')](_0x1692('0xc'),_0x5b4740,_0x1692('0xd'));logger['debug'](_0x1692('0xe'),_0x5b4740,_0x1692('0xd'),JSON[_0x1692('0xf')](_0x49b549));if(_0x49b549['error']){if(_0x49b549['error'][_0x1692('0x10')]===0x1f4){logger[_0x1692('0x11')]('ReportAgentPreview,\x20%s,\x20%s',_0x5b4740,_0x49b549[_0x1692('0x11')][_0x1692('0x12')]);return _0x48118c(_0x49b549[_0x1692('0x11')]['message']);}logger[_0x1692('0x11')](_0x1692('0xc'),_0x5b4740,_0x49b549['error']['message']);return _0x50be7d(_0x49b549[_0x1692('0x11')][_0x1692('0x12')]);}else{logger['info'](_0x1692('0xc'),_0x5b4740,_0x1692('0xd'));_0x50be7d(_0x49b549[_0x1692('0x13')][_0x1692('0x12')]);}})[_0x1692('0x14')](function(_0x14cc85){logger['error'](_0x1692('0xc'),_0x5b4740,_0x14cc85);_0x48118c(_0x14cc85);});});}exports[_0x1692('0x15')]=function(_0xdbc994){var _0x557491=this;return new Promise(function(_0x3c05bf,_0xc0a076){return db['ReportAgentPreview'][_0x1692('0x16')](_0xdbc994[_0x1692('0x17')],{'raw':_0xdbc994[_0x1692('0x18')]?_0xdbc994[_0x1692('0x18')][_0x1692('0x19')]===undefined?!![]:![]:!![]})[_0x1692('0xa')](function(_0x2d92ea){logger[_0x1692('0xb')](_0x1692('0x15'),_0xdbc994);logger[_0x1692('0x1a')](_0x1692('0x15'),_0xdbc994,JSON[_0x1692('0xf')](_0x2d92ea));_0x3c05bf(_0x2d92ea);})[_0x1692('0x14')](function(_0x2f7d8f){logger[_0x1692('0x11')](_0x1692('0x15'),_0x2f7d8f[_0x1692('0x12')],_0xdbc994);_0xc0a076(_0x557491[_0x1692('0x11')](0x1f4,_0x2f7d8f['message']));});});}; \ No newline at end of file +var _0xe43e=['ReportAgentPreview,\x20%s,\x20%s','result','CreateReportAgentPreview','ReportAgentPreview','body','options','catch','lodash','util','moment','bluebird','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request','then','info','request\x20sent','debug','ReportAgentPreview,\x20%s,\x20%s,\x20%s','stringify','error','code','message'];(function(_0x513001,_0x2201cb){var _0x3bd43f=function(_0xbc4fe){while(--_0xbc4fe){_0x513001['push'](_0x513001['shift']());}};_0x3bd43f(++_0x2201cb);}(_0xe43e,0x1e3));var _0xee43=function(_0x357e06,_0x17e4e9){_0x357e06=_0x357e06-0x0;var _0x137954=_0xe43e[_0x357e06];return _0x137954;};'use strict';var _=require(_0xee43('0x0'));var util=require(_0xee43('0x1'));var moment=require(_0xee43('0x2'));var BPromise=require(_0xee43('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0xee43('0x4'))['db'];var utils=require(_0xee43('0x5'));var logger=require(_0xee43('0x6'))('rpc');var config=require(_0xee43('0x7'));var jayson=require(_0xee43('0x8'));var client=jayson[_0xee43('0x9')][_0xee43('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x2b838a,_0x356768,_0x13b6de){return new BPromise(function(_0x36fa61,_0x4b5ebd){return client[_0xee43('0xb')](_0x2b838a,_0x13b6de)[_0xee43('0xc')](function(_0x5b9ed0){logger[_0xee43('0xd')]('ReportAgentPreview,\x20%s,\x20%s',_0x356768,_0xee43('0xe'));logger[_0xee43('0xf')](_0xee43('0x10'),_0x356768,'request\x20sent',JSON[_0xee43('0x11')](_0x5b9ed0));if(_0x5b9ed0[_0xee43('0x12')]){if(_0x5b9ed0[_0xee43('0x12')][_0xee43('0x13')]===0x1f4){logger[_0xee43('0x12')]('ReportAgentPreview,\x20%s,\x20%s',_0x356768,_0x5b9ed0[_0xee43('0x12')][_0xee43('0x14')]);return _0x4b5ebd(_0x5b9ed0['error'][_0xee43('0x14')]);}logger['error'](_0xee43('0x15'),_0x356768,_0x5b9ed0[_0xee43('0x12')]['message']);return _0x36fa61(_0x5b9ed0[_0xee43('0x12')][_0xee43('0x14')]);}else{logger[_0xee43('0xd')](_0xee43('0x15'),_0x356768,_0xee43('0xe'));_0x36fa61(_0x5b9ed0[_0xee43('0x16')]['message']);}})['catch'](function(_0x1ab7f1){logger[_0xee43('0x12')](_0xee43('0x15'),_0x356768,_0x1ab7f1);_0x4b5ebd(_0x1ab7f1);});});}exports[_0xee43('0x17')]=function(_0x42d87f){var _0x3cfabb=this;return new Promise(function(_0x21c429,_0x476e0e){return db[_0xee43('0x18')]['create'](_0x42d87f[_0xee43('0x19')],{'raw':_0x42d87f['options']?_0x42d87f[_0xee43('0x1a')]['raw']===undefined?!![]:![]:!![]})[_0xee43('0xc')](function(_0x4b06f9){logger['info'](_0xee43('0x17'),_0x42d87f);logger['debug'](_0xee43('0x17'),_0x42d87f,JSON['stringify'](_0x4b06f9));_0x21c429(_0x4b06f9);})[_0xee43('0x1b')](function(_0x382009){logger[_0xee43('0x12')](_0xee43('0x17'),_0x382009[_0xee43('0x14')],_0x42d87f);_0x476e0e(_0x3cfabb[_0xee43('0x12')](0x1f4,_0x382009[_0xee43('0x14')]));});});}; \ No newline at end of file diff --git a/server/api/rpc/index.js b/server/api/rpc/index.js index 63a5401..bf05e9b 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 _0x97e4=['isAuthenticated','/voice/channels/:uniqueid/mixmonitor','voiceChannelMixMonitor','voiceQueues','get','/mail/queues','/mail/accounts','openchannelQueues','/sms/queues','smsQueues','/fax/queues','faxQueues','voiceQueuesPreview','voiceQueuesChannels','/voice/queues/channels/:uniqueid','voiceQueuesChannel','voiceQueuesChannelHangup','/voice/queues/channels/:uniqueid/redirect/:exten','showVoiceQueues','outbound','/outbound/channels','outboundChannels','agents','put','/telephones','/trunks','trunks','campaigns','/fax/accounts','faxAccounts','/chat/queues/waitinginteractions','chatQueuesWaitingInteractions','/mail/queues/waitinginteractions','mailQueuesWaitingInteractions','/openchannel/queues/waitinginteractions','openchannelQueuesWaitingInteractions','/sms/queues/waitinginteractions','smsQueuesWaitingInteractions','/fax/queues/waitinginteractions','mail','showMailQueues','post','/chat/queues/:id/notify','queueNotify','/chat/queues/:id','showChatQueues','/fax/queues/:id/notify','fax','/fax/queues/:id','showFaxQueues','/openchannel/queues/:id/notify','openchannel','/openchannel/queues/:id','showOpenchannelQueues','/sms/queues/:id/notify','sms','/sms/queues/:id','showSmsQueues','/agents/:id/notify','multer','path','express','Router','./rpc.controller','/voice/channels'];(function(_0x1d5f43,_0x56277f){var _0xea8d41=function(_0x1248a3){while(--_0x1248a3){_0x1d5f43['push'](_0x1d5f43['shift']());}};_0xea8d41(++_0x56277f);}(_0x97e4,0x13f));var _0x497e=function(_0xafe951,_0x366ebd){_0xafe951=_0xafe951-0x0;var _0x3f287b=_0x97e4[_0xafe951];return _0x3f287b;};'use strict';var multer=require(_0x497e('0x0'));var util=require('util');var path=require(_0x497e('0x1'));var express=require(_0x497e('0x2'));var router=express[_0x497e('0x3')]();var auth=require('../../components/auth/service');var controller=require(_0x497e('0x4'));router['get'](_0x497e('0x5'),auth[_0x497e('0x6')](),controller['voiceChannels']);router['get'](_0x497e('0x7'),auth[_0x497e('0x6')](),controller[_0x497e('0x8')]);router['get']('/voice/channels/:uniqueid/stopmixmonitor',auth['isAuthenticated'](),controller['voiceChannelStopMixMonitor']);router['get']('/voice/queues',auth[_0x497e('0x6')](),controller[_0x497e('0x9')]);router[_0x497e('0xa')]('/chat/queues',auth['isAuthenticated'](),controller['chatQueues']);router[_0x497e('0xa')](_0x497e('0xb'),auth[_0x497e('0x6')](),controller['mailQueues']);router['get'](_0x497e('0xc'),auth['isAuthenticated'](),controller['mailAccounts']);router[_0x497e('0xa')]('/openchannel/queues',auth[_0x497e('0x6')](),controller[_0x497e('0xd')]);router['get'](_0x497e('0xe'),auth[_0x497e('0x6')](),controller[_0x497e('0xf')]);router['get'](_0x497e('0x10'),auth[_0x497e('0x6')](),controller[_0x497e('0x11')]);router['get']('/voice/queues/preview/:id',auth[_0x497e('0x6')](),controller[_0x497e('0x12')]);router[_0x497e('0xa')]('/voice/queues/channels',auth[_0x497e('0x6')](),controller[_0x497e('0x13')]);router['get'](_0x497e('0x14'),auth[_0x497e('0x6')](),controller[_0x497e('0x15')]);router[_0x497e('0xa')]('/voice/queues/channels/:uniqueid/hangup',auth[_0x497e('0x6')](),controller[_0x497e('0x16')]);router[_0x497e('0xa')](_0x497e('0x17'),auth[_0x497e('0x6')](),controller['voiceQueuesChannelRedirect']);router['get']('/voice/queues/:id',auth['isAuthenticated'](),controller[_0x497e('0x18')]);router[_0x497e('0xa')]('/outbound',auth[_0x497e('0x6')](),controller[_0x497e('0x19')]);router[_0x497e('0xa')](_0x497e('0x1a'),auth[_0x497e('0x6')](),controller[_0x497e('0x1b')]);router[_0x497e('0xa')]('/agents',auth[_0x497e('0x6')](),controller[_0x497e('0x1c')]);router[_0x497e('0x1d')]('/agents/:id/capacity',auth[_0x497e('0x6')](),controller['agentCapacity']);router['get'](_0x497e('0x1e'),auth[_0x497e('0x6')](),controller['telephones']);router['get'](_0x497e('0x1f'),auth[_0x497e('0x6')](),controller[_0x497e('0x20')]);router[_0x497e('0xa')]('/campaigns',auth[_0x497e('0x6')](),controller[_0x497e('0x21')]);router[_0x497e('0xa')](_0x497e('0x22'),auth[_0x497e('0x6')](),controller[_0x497e('0x23')]);router[_0x497e('0xa')](_0x497e('0x24'),auth[_0x497e('0x6')](),controller[_0x497e('0x25')]);router[_0x497e('0xa')](_0x497e('0x26'),auth[_0x497e('0x6')](),controller[_0x497e('0x27')]);router[_0x497e('0xa')](_0x497e('0x28'),auth[_0x497e('0x6')](),controller[_0x497e('0x29')]);router[_0x497e('0xa')](_0x497e('0x2a'),auth[_0x497e('0x6')](),controller[_0x497e('0x2b')]);router[_0x497e('0xa')](_0x497e('0x2c'),auth['isAuthenticated'](),controller['faxQueuesWaitingInteractions']);router['post']('/mail/queues/:id/notify',auth[_0x497e('0x6')](),controller['queueNotify'](_0x497e('0x2d')));router[_0x497e('0xa')]('/mail/queues/:id',auth[_0x497e('0x6')](),controller[_0x497e('0x2e')]);router[_0x497e('0x2f')](_0x497e('0x30'),auth['isAuthenticated'](),controller[_0x497e('0x31')]('chat'));router[_0x497e('0xa')](_0x497e('0x32'),auth['isAuthenticated'](),controller[_0x497e('0x33')]);router[_0x497e('0x2f')](_0x497e('0x34'),auth[_0x497e('0x6')](),controller['queueNotify'](_0x497e('0x35')));router[_0x497e('0xa')](_0x497e('0x36'),auth[_0x497e('0x6')](),controller[_0x497e('0x37')]);router[_0x497e('0x2f')](_0x497e('0x38'),auth[_0x497e('0x6')](),controller[_0x497e('0x31')](_0x497e('0x39')));router[_0x497e('0xa')](_0x497e('0x3a'),auth[_0x497e('0x6')](),controller[_0x497e('0x3b')]);router['post'](_0x497e('0x3c'),auth[_0x497e('0x6')](),controller[_0x497e('0x31')](_0x497e('0x3d')));router['get'](_0x497e('0x3e'),auth[_0x497e('0x6')](),controller[_0x497e('0x3f')]);router[_0x497e('0x2f')](_0x497e('0x40'),auth[_0x497e('0x6')](),controller['agentNotify']);module['exports']=router; \ No newline at end of file +var _0xe4bb=['voiceQueuesChannelHangup','voiceQueuesChannelRedirect','showVoiceQueues','/outbound','outbound','/outbound/channels','/agents','/telephones','telephones','trunks','/campaigns','campaigns','/fax/accounts','faxAccounts','/chat/queues/waitinginteractions','chatQueuesWaitingInteractions','/mail/queues/waitinginteractions','mailQueuesWaitingInteractions','openchannelQueuesWaitingInteractions','/sms/queues/waitinginteractions','smsQueuesWaitingInteractions','/fax/queues/waitinginteractions','faxQueuesWaitingInteractions','/mail/queues/:id/notify','queueNotify','mail','post','/chat/queues/:id/notify','chat','/chat/queues/:id','showChatQueues','/fax/queues/:id/notify','fax','/fax/queues/:id','/openchannel/queues/:id/notify','openchannel','/openchannel/queues/:id','showOpenchannelQueues','/sms/queues/:id/notify','sms','/sms/queues/:id','/agents/:id/notify','agentNotify','exports','multer','util','path','../../components/auth/service','./rpc.controller','/voice/channels','isAuthenticated','voiceChannels','/voice/channels/:uniqueid/mixmonitor','voiceChannelMixMonitor','/voice/channels/:uniqueid/stopmixmonitor','voiceChannelStopMixMonitor','get','/voice/queues','voiceQueues','chatQueues','/mail/queues','mailQueues','/mail/accounts','openchannelQueues','/sms/queues','smsQueues','/fax/queues','faxQueues','voiceQueuesPreview','/voice/queues/channels','voiceQueuesChannels','/voice/queues/channels/:uniqueid','voiceQueuesChannel','/voice/queues/channels/:uniqueid/hangup'];(function(_0x49d41c,_0x2bdc35){var _0xb64c5f=function(_0x28f535){while(--_0x28f535){_0x49d41c['push'](_0x49d41c['shift']());}};_0xb64c5f(++_0x2bdc35);}(_0xe4bb,0x154));var _0xbe4b=function(_0x4ef67b,_0xc5cc79){_0x4ef67b=_0x4ef67b-0x0;var _0x18dc9a=_0xe4bb[_0x4ef67b];return _0x18dc9a;};'use strict';var multer=require(_0xbe4b('0x0'));var util=require(_0xbe4b('0x1'));var path=require(_0xbe4b('0x2'));var express=require('express');var router=express['Router']();var auth=require(_0xbe4b('0x3'));var controller=require(_0xbe4b('0x4'));router['get'](_0xbe4b('0x5'),auth[_0xbe4b('0x6')](),controller[_0xbe4b('0x7')]);router['get'](_0xbe4b('0x8'),auth[_0xbe4b('0x6')](),controller[_0xbe4b('0x9')]);router['get'](_0xbe4b('0xa'),auth[_0xbe4b('0x6')](),controller[_0xbe4b('0xb')]);router[_0xbe4b('0xc')](_0xbe4b('0xd'),auth[_0xbe4b('0x6')](),controller[_0xbe4b('0xe')]);router['get']('/chat/queues',auth[_0xbe4b('0x6')](),controller[_0xbe4b('0xf')]);router[_0xbe4b('0xc')](_0xbe4b('0x10'),auth[_0xbe4b('0x6')](),controller[_0xbe4b('0x11')]);router['get'](_0xbe4b('0x12'),auth['isAuthenticated'](),controller['mailAccounts']);router[_0xbe4b('0xc')]('/openchannel/queues',auth[_0xbe4b('0x6')](),controller[_0xbe4b('0x13')]);router[_0xbe4b('0xc')](_0xbe4b('0x14'),auth['isAuthenticated'](),controller[_0xbe4b('0x15')]);router[_0xbe4b('0xc')](_0xbe4b('0x16'),auth[_0xbe4b('0x6')](),controller[_0xbe4b('0x17')]);router['get']('/voice/queues/preview/:id',auth['isAuthenticated'](),controller[_0xbe4b('0x18')]);router[_0xbe4b('0xc')](_0xbe4b('0x19'),auth['isAuthenticated'](),controller[_0xbe4b('0x1a')]);router[_0xbe4b('0xc')](_0xbe4b('0x1b'),auth[_0xbe4b('0x6')](),controller[_0xbe4b('0x1c')]);router['get'](_0xbe4b('0x1d'),auth['isAuthenticated'](),controller[_0xbe4b('0x1e')]);router['get']('/voice/queues/channels/:uniqueid/redirect/:exten',auth['isAuthenticated'](),controller[_0xbe4b('0x1f')]);router[_0xbe4b('0xc')]('/voice/queues/:id',auth['isAuthenticated'](),controller[_0xbe4b('0x20')]);router[_0xbe4b('0xc')](_0xbe4b('0x21'),auth['isAuthenticated'](),controller[_0xbe4b('0x22')]);router[_0xbe4b('0xc')](_0xbe4b('0x23'),auth[_0xbe4b('0x6')](),controller['outboundChannels']);router['get'](_0xbe4b('0x24'),auth['isAuthenticated'](),controller['agents']);router['put']('/agents/:id/capacity',auth[_0xbe4b('0x6')](),controller['agentCapacity']);router[_0xbe4b('0xc')](_0xbe4b('0x25'),auth[_0xbe4b('0x6')](),controller[_0xbe4b('0x26')]);router[_0xbe4b('0xc')]('/trunks',auth[_0xbe4b('0x6')](),controller[_0xbe4b('0x27')]);router[_0xbe4b('0xc')](_0xbe4b('0x28'),auth[_0xbe4b('0x6')](),controller[_0xbe4b('0x29')]);router[_0xbe4b('0xc')](_0xbe4b('0x2a'),auth[_0xbe4b('0x6')](),controller[_0xbe4b('0x2b')]);router['get'](_0xbe4b('0x2c'),auth[_0xbe4b('0x6')](),controller[_0xbe4b('0x2d')]);router[_0xbe4b('0xc')](_0xbe4b('0x2e'),auth[_0xbe4b('0x6')](),controller[_0xbe4b('0x2f')]);router[_0xbe4b('0xc')]('/openchannel/queues/waitinginteractions',auth[_0xbe4b('0x6')](),controller[_0xbe4b('0x30')]);router[_0xbe4b('0xc')](_0xbe4b('0x31'),auth[_0xbe4b('0x6')](),controller[_0xbe4b('0x32')]);router[_0xbe4b('0xc')](_0xbe4b('0x33'),auth[_0xbe4b('0x6')](),controller[_0xbe4b('0x34')]);router['post'](_0xbe4b('0x35'),auth[_0xbe4b('0x6')](),controller[_0xbe4b('0x36')](_0xbe4b('0x37')));router[_0xbe4b('0xc')]('/mail/queues/:id',auth[_0xbe4b('0x6')](),controller['showMailQueues']);router[_0xbe4b('0x38')](_0xbe4b('0x39'),auth[_0xbe4b('0x6')](),controller[_0xbe4b('0x36')](_0xbe4b('0x3a')));router['get'](_0xbe4b('0x3b'),auth[_0xbe4b('0x6')](),controller[_0xbe4b('0x3c')]);router[_0xbe4b('0x38')](_0xbe4b('0x3d'),auth[_0xbe4b('0x6')](),controller[_0xbe4b('0x36')](_0xbe4b('0x3e')));router[_0xbe4b('0xc')](_0xbe4b('0x3f'),auth[_0xbe4b('0x6')](),controller['showFaxQueues']);router[_0xbe4b('0x38')](_0xbe4b('0x40'),auth[_0xbe4b('0x6')](),controller[_0xbe4b('0x36')](_0xbe4b('0x41')));router[_0xbe4b('0xc')](_0xbe4b('0x42'),auth['isAuthenticated'](),controller[_0xbe4b('0x43')]);router[_0xbe4b('0x38')](_0xbe4b('0x44'),auth['isAuthenticated'](),controller['queueNotify'](_0xbe4b('0x45')));router['get'](_0xbe4b('0x46'),auth['isAuthenticated'](),controller['showSmsQueues']);router[_0xbe4b('0x38')](_0xbe4b('0x47'),auth[_0xbe4b('0x6')](),controller[_0xbe4b('0x48')]);module[_0xbe4b('0x49')]=router; \ No newline at end of file diff --git a/server/api/rpc/rpc.controller.js b/server/api/rpc/rpc.controller.js index a11c68f..3c1e231 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 _0x7695=['user','hasOwnProperty','MemberReport','findAll','INTERACTION','length','format','updateAttributes','findOrCreate','interface','YYYY-MM-DD\x20HH:mm:ss','internal','AgentCapacity','capacity','Telephones','trunks','Trunks','campaigns','Campaigns','chatQueues','ChatQueues','showChatQueues','mailQueues','MailQueues','MailAccounts','openchannelQueues','OpenchannelQueues','showOpenchannelQueues','smsQueues','SmsQueues','showSmsQueues','FaxQueues','FaxAccounts','ChatQueuesWaitingInteractions','MailQueuesWaitingInteractions','openchannelQueuesWaitingInteractions','OpenchannelQueuesWaitingInteractions','smsQueuesWaitingInteractions','SmsQueuesWaitingInteractions','faxQueuesWaitingInteractions','FaxQueuesWaitingInteractions','queueNotify','capitalize','Website','Account','findOne','\x20Queue\x20not\x20found','Message','messageId','Interaction','\x20Message\x20not\x20found','update','MessageId','From','QueueId','create','Start','queue','queueTransferTimeout','*,*,*,*','agentNotify','channel','Channel\x20field\x20is\x20mandatory','chat','User','agent','Agent\x20not\x20found','InteractionId','TransferReport','agentTransferTimeout','bluebird','../../mysqldb','../../config/logger','api','jayson/promise','client','http','then','error','code','message','result','catch','json','sendStatus','stack','name','status','send','isNil','rows','voiceChannels','VoiceChannels','voiceChannelMixMonitor','merge','query','params','voiceQueues','VoiceQueues','showVoiceQueues','voiceQueuesPreview','VoiceQueuesPreview','voiceQueuesChannels','voiceQueuesChannel','VoiceQueuesChannel','VoiceQueuesChannelHangup','voiceQueuesChannelRedirect','Outbound','outboundChannels','OutboundChannels','agents','Agents','agentCapacity','body','interaction'];(function(_0x2dfdbd,_0x3776c1){var _0x5ed24d=function(_0x47d8e7){while(--_0x47d8e7){_0x2dfdbd['push'](_0x2dfdbd['shift']());}};_0x5ed24d(++_0x3776c1);}(_0x7695,0x19f));var _0x5769=function(_0x19b5e0,_0x3391b5){_0x19b5e0=_0x19b5e0-0x0;var _0x217b89=_0x7695[_0x19b5e0];return _0x217b89;};'use strict';var BPromise=require(_0x5769('0x0'));var moment=require('moment');var _=require('lodash');var util=require('util');var db=require(_0x5769('0x1'))['db'];var logger=require(_0x5769('0x2'))(_0x5769('0x3'));var jayson=require(_0x5769('0x4'));var amiClient=jayson['client']['http']({'port':0x232a});var mailClient=jayson[_0x5769('0x5')]['http']({'port':0x232b});var routingClient=jayson[_0x5769('0x5')][_0x5769('0x6')]({'port':0x232c});function respondWithRpcPromise(_0x36cce2,_0x2703bc,_0x160002){return new BPromise(function(_0x574f1b,_0x123187){var _0x4b3792=_0x160002?_0x160002:amiClient;return _0x4b3792['request'](_0x36cce2,_0x2703bc)[_0x5769('0x7')](function(_0x467001){if(_0x467001[_0x5769('0x8')]){if(_0x467001['error'][_0x5769('0x9')]===0x1f4){return _0x123187(_0x467001['error'][_0x5769('0xa')]);}return _0x574f1b(_0x467001[_0x5769('0x8')][_0x5769('0xa')]);}else{_0x574f1b(_0x467001[_0x5769('0xb')]);}})[_0x5769('0xc')](function(_0x1b8788){_0x123187(_0x1b8788);});});}function respondWithResult(_0x1d5cb4,_0xaf62cd){_0xaf62cd=_0xaf62cd||0xc8;return function(_0x26c7b1){if(_0x26c7b1){return _0x1d5cb4['status'](_0xaf62cd)[_0x5769('0xd')](_0x26c7b1);}return _0x1d5cb4[_0x5769('0xe')](0x194);};}function handleError(_0xdb6ca,_0x86f248){_0x86f248=_0x86f248||0x1f4;return function(_0x5a3ab4){logger[_0x5769('0x8')](_0x5a3ab4[_0x5769('0xf')]);if(_0x5a3ab4[_0x5769('0x10')]){delete _0x5a3ab4[_0x5769('0x10')];}_0xdb6ca[_0x5769('0x11')](_0x86f248)[_0x5769('0x12')](_0x5a3ab4);};}function findById(_0x5507b0){return function(_0x36f268){if(!_['isNil'](_0x5507b0)&&!_[_0x5769('0x13')](_0x36f268)&&!_[_0x5769('0x13')](_0x36f268[_0x5769('0x14')])){return _['find'](_0x36f268['rows'],function(_0x331c48){return _0x331c48['id']==_0x5507b0;});}return null;};}exports[_0x5769('0x15')]=function(_0x4909d5,_0x5ab5c8){return respondWithRpcPromise(_0x5769('0x16'),_0x4909d5['query'])['then'](respondWithResult(_0x5ab5c8,null))[_0x5769('0xc')](handleError(_0x5ab5c8,null));};exports[_0x5769('0x17')]=function(_0x599d34,_0x2698c8){return respondWithRpcPromise('VoiceChannelMixMonitor',_[_0x5769('0x18')](_0x599d34[_0x5769('0x19')],_0x599d34[_0x5769('0x1a')]))[_0x5769('0x7')](respondWithResult(_0x2698c8,null))[_0x5769('0xc')](handleError(_0x2698c8,null));};exports['voiceChannelStopMixMonitor']=function(_0xc458d1,_0x5c1d53){return respondWithRpcPromise('VoiceChannelStopMixMonitor',_[_0x5769('0x18')](_0xc458d1[_0x5769('0x19')],_0xc458d1[_0x5769('0x1a')]))[_0x5769('0x7')](respondWithResult(_0x5c1d53,null))[_0x5769('0xc')](handleError(_0x5c1d53,null));};exports[_0x5769('0x1b')]=function(_0x4a9b28,_0x101091){return respondWithRpcPromise(_0x5769('0x1c'),_0x4a9b28[_0x5769('0x19')])[_0x5769('0x7')](respondWithResult(_0x101091,null))[_0x5769('0xc')](handleError(_0x101091,null));};exports[_0x5769('0x1d')]=function(_0x52b8f2,_0x13e61d){return respondWithRpcPromise(_0x5769('0x1c'),_0x52b8f2['query'])[_0x5769('0x7')](findById(_0x52b8f2['params']['id']))['then'](respondWithResult(_0x13e61d,null))[_0x5769('0xc')](handleError(_0x13e61d,null));};exports[_0x5769('0x1e')]=function(_0x4872cb,_0x1b08ea){return respondWithRpcPromise(_0x5769('0x1f'),_['merge'](_0x4872cb[_0x5769('0x19')],_0x4872cb[_0x5769('0x1a')]))[_0x5769('0x7')](respondWithResult(_0x1b08ea,null))[_0x5769('0xc')](handleError(_0x1b08ea,null));};exports[_0x5769('0x20')]=function(_0x3afde3,_0xb3397d){return respondWithRpcPromise('VoiceQueuesChannels',_0x3afde3['query'])[_0x5769('0x7')](respondWithResult(_0xb3397d,null))[_0x5769('0xc')](handleError(_0xb3397d,null));};exports[_0x5769('0x21')]=function(_0x10f506,_0xb69c52){return respondWithRpcPromise(_0x5769('0x22'),_[_0x5769('0x18')](_0x10f506['query'],_0x10f506[_0x5769('0x1a')]))[_0x5769('0x7')](respondWithResult(_0xb69c52,null))[_0x5769('0xc')](handleError(_0xb69c52,null));};exports['voiceQueuesChannelHangup']=function(_0x52bc34,_0x193c0e){return respondWithRpcPromise(_0x5769('0x23'),_[_0x5769('0x18')](_0x52bc34[_0x5769('0x19')],_0x52bc34[_0x5769('0x1a')]))[_0x5769('0x7')](respondWithResult(_0x193c0e,null))[_0x5769('0xc')](handleError(_0x193c0e,null));};exports[_0x5769('0x24')]=function(_0x841df0,_0x2f2167){return respondWithRpcPromise('VoiceQueuesChannelRedirect',_[_0x5769('0x18')](_0x841df0[_0x5769('0x19')],_0x841df0['params']))[_0x5769('0x7')](respondWithResult(_0x2f2167,null))[_0x5769('0xc')](handleError(_0x2f2167,null));};exports['outbound']=function(_0x277f63,_0x23df9b){return respondWithRpcPromise(_0x5769('0x25'),_0x277f63[_0x5769('0x19')])[_0x5769('0x7')](respondWithResult(_0x23df9b,null))['catch'](handleError(_0x23df9b,null));};exports[_0x5769('0x26')]=function(_0x306aee,_0x39d372){return respondWithRpcPromise(_0x5769('0x27'),_0x306aee[_0x5769('0x19')])[_0x5769('0x7')](respondWithResult(_0x39d372,null))[_0x5769('0xc')](handleError(_0x39d372,null));};exports[_0x5769('0x28')]=function(_0x59410f,_0x3c7053){var _0x2f960f;return respondWithRpcPromise(_0x5769('0x29'),_0x59410f[_0x5769('0x19')])['then'](function(_0x36821c){_0x2f960f=_0x36821c;return respondWithRpcPromise(_0x5769('0x29'),_0x59410f[_0x5769('0x19')],routingClient);})[_0x5769('0x7')](function(_0x4a3302){return _[_0x5769('0x18')]({},_0x4a3302,_0x2f960f);})[_0x5769('0x7')](respondWithResult(_0x3c7053,null))['catch'](handleError(_0x3c7053,null));};exports[_0x5769('0x2a')]=function(_0x4fb329,_0x5c5064){if(_0x4fb329[_0x5769('0x2b')]&&_0x4fb329[_0x5769('0x2b')][_0x5769('0x2c')]&&_0x4fb329['user']&&_0x4fb329[_0x5769('0x2d')]['name']){for(var _0xce1a15 in _0x4fb329[_0x5769('0x2b')][_0x5769('0x2c')]){if(_0x4fb329[_0x5769('0x2b')][_0x5769('0x2c')][_0x5769('0x2e')](_0xce1a15)){db[_0x5769('0x2f')][_0x5769('0x30')]({'where':{'channel':_0xce1a15,'membername':_0x4fb329[_0x5769('0x2d')]['name'],'type':_0x5769('0x31'),'exitAt':null,'uniqueid':_0x4fb329[_0x5769('0x2b')][_0x5769('0x2c')][_0xce1a15]&&_0x4fb329[_0x5769('0x2b')]['interaction'][_0xce1a15][_0x5769('0x32')]?{'$notIn':_0x4fb329[_0x5769('0x2b')][_0x5769('0x2c')][_0xce1a15]}:{'$ne':null}}})[_0x5769('0x7')](function(_0x40f7b6){var _0x50d821=moment()[_0x5769('0x33')]('YYYY-MM-DD\x20HH:mm:ss');for(var _0x4d6563=0x0,_0x4a762a=_0x40f7b6[_0x5769('0x32')];_0x4d6563<_0x4a762a;_0x4d6563+=0x1){_0x40f7b6[_0x4d6563][_0x5769('0x34')]({'exitAt':_0x50d821});}});for(var _0x352647=0x0;_0x352647<_0x4fb329['body'][_0x5769('0x2c')][_0xce1a15]['length'];_0x352647+=0x1){db[_0x5769('0x2f')][_0x5769('0x35')]({'where':{'channel':_0xce1a15,'membername':_0x4fb329[_0x5769('0x2d')][_0x5769('0x10')],'type':_0x5769('0x31'),'uniqueid':_0x4fb329['body'][_0x5769('0x2c')][_0xce1a15][_0x352647],'exitAt':null},'defaults':{'channel':_0xce1a15,'membername':_0x4fb329[_0x5769('0x2d')]['name'],'interface':_[_0x5769('0x13')](_0x4fb329[_0x5769('0x2d')][_0x5769('0x36')])?util[_0x5769('0x33')]('SIP/%s',_0x4fb329[_0x5769('0x2d')][_0x5769('0x10')]):_0x4fb329[_0x5769('0x2d')][_0x5769('0x36')],'type':'INTERACTION','enterAt':moment()[_0x5769('0x33')](_0x5769('0x37')),'role':'agent','internal':_0x4fb329[_0x5769('0x2d')][_0x5769('0x38')],'uniqueid':_0x4fb329[_0x5769('0x2b')][_0x5769('0x2c')][_0xce1a15][_0x352647]}});}}}}return respondWithRpcPromise(_0x5769('0x39'),{'id':_0x4fb329[_0x5769('0x1a')]['id'],'capacity':_0x4fb329['body'][_0x5769('0x3a')]},routingClient)[_0x5769('0x7')](respondWithResult(_0x5c5064,null))[_0x5769('0xc')](handleError(_0x5c5064,null));};exports['telephones']=function(_0x33b311,_0x72e551){return respondWithRpcPromise(_0x5769('0x3b'),_0x33b311[_0x5769('0x19')])[_0x5769('0x7')](respondWithResult(_0x72e551,null))['catch'](handleError(_0x72e551,null));};exports[_0x5769('0x3c')]=function(_0x200dbd,_0x511fcc){return respondWithRpcPromise(_0x5769('0x3d'),_0x200dbd['query'])['then'](respondWithResult(_0x511fcc,null))[_0x5769('0xc')](handleError(_0x511fcc,null));};exports[_0x5769('0x3e')]=function(_0x1faa2b,_0x5a377a){return respondWithRpcPromise(_0x5769('0x3f'),_0x1faa2b[_0x5769('0x19')])[_0x5769('0x7')](respondWithResult(_0x5a377a,null))[_0x5769('0xc')](handleError(_0x5a377a,null));};exports[_0x5769('0x40')]=function(_0x5030f0,_0x51fc54){return respondWithRpcPromise(_0x5769('0x41'),_0x5030f0[_0x5769('0x19')],routingClient)['then'](respondWithResult(_0x51fc54,null))[_0x5769('0xc')](handleError(_0x51fc54,null));};exports[_0x5769('0x42')]=function(_0xcb7946,_0xf3028e){return respondWithRpcPromise(_0x5769('0x41'),_0xcb7946[_0x5769('0x19')],routingClient)['then'](findById(_0xcb7946[_0x5769('0x1a')]['id']))[_0x5769('0x7')](respondWithResult(_0xf3028e,null))[_0x5769('0xc')](handleError(_0xf3028e,null));};exports[_0x5769('0x43')]=function(_0x3d5de7,_0x5b8547){return respondWithRpcPromise(_0x5769('0x44'),_0x3d5de7[_0x5769('0x19')],routingClient)[_0x5769('0x7')](respondWithResult(_0x5b8547,null))[_0x5769('0xc')](handleError(_0x5b8547,null));};exports['showMailQueues']=function(_0x28bf1d,_0x304d77){return respondWithRpcPromise(_0x5769('0x44'),_0x28bf1d['query'],routingClient)[_0x5769('0x7')](findById(_0x28bf1d[_0x5769('0x1a')]['id']))[_0x5769('0x7')](respondWithResult(_0x304d77,null))[_0x5769('0xc')](handleError(_0x304d77,null));};exports['mailAccounts']=function(_0x59d3a4,_0x414bb8){return respondWithRpcPromise(_0x5769('0x45'),_0x59d3a4[_0x5769('0x19')],mailClient)[_0x5769('0x7')](respondWithResult(_0x414bb8,null))[_0x5769('0xc')](handleError(_0x414bb8,null));};exports[_0x5769('0x46')]=function(_0x3145aa,_0xd1418e){return respondWithRpcPromise(_0x5769('0x47'),_0x3145aa[_0x5769('0x19')],routingClient)[_0x5769('0x7')](respondWithResult(_0xd1418e,null))['catch'](handleError(_0xd1418e,null));};exports[_0x5769('0x48')]=function(_0x1dad75,_0xa3d25d){return respondWithRpcPromise(_0x5769('0x47'),_0x1dad75[_0x5769('0x19')],routingClient)[_0x5769('0x7')](findById(_0x1dad75['params']['id']))[_0x5769('0x7')](respondWithResult(_0xa3d25d,null))[_0x5769('0xc')](handleError(_0xa3d25d,null));};exports[_0x5769('0x49')]=function(_0x1dd043,_0x45236e){return respondWithRpcPromise(_0x5769('0x4a'),_0x1dd043[_0x5769('0x19')],routingClient)['then'](respondWithResult(_0x45236e,null))['catch'](handleError(_0x45236e,null));};exports[_0x5769('0x4b')]=function(_0xf1693f,_0x5d4be0){return respondWithRpcPromise(_0x5769('0x4a'),_0xf1693f['query'],routingClient)[_0x5769('0x7')](findById(_0xf1693f[_0x5769('0x1a')]['id']))[_0x5769('0x7')](respondWithResult(_0x5d4be0,null))['catch'](handleError(_0x5d4be0,null));};exports['faxQueues']=function(_0x1660b5,_0x31abdf){return respondWithRpcPromise(_0x5769('0x4c'),_0x1660b5[_0x5769('0x19')],routingClient)[_0x5769('0x7')](respondWithResult(_0x31abdf,null))[_0x5769('0xc')](handleError(_0x31abdf,null));};exports['showFaxQueues']=function(_0x5c417e,_0x4a3ffc){return respondWithRpcPromise('FaxQueues',_0x5c417e[_0x5769('0x19')],routingClient)[_0x5769('0x7')](findById(_0x5c417e[_0x5769('0x1a')]['id']))[_0x5769('0x7')](respondWithResult(_0x4a3ffc,null))[_0x5769('0xc')](handleError(_0x4a3ffc,null));};exports['faxAccounts']=function(_0x2f059b,_0x1002fe){return respondWithRpcPromise(_0x5769('0x4d'),_0x2f059b[_0x5769('0x19')])['then'](respondWithResult(_0x1002fe,null))['catch'](handleError(_0x1002fe,null));};exports['chatQueuesWaitingInteractions']=function(_0xc4a29d,_0x120edb){return respondWithRpcPromise(_0x5769('0x4e'),_0xc4a29d[_0x5769('0x19')],routingClient)['then'](respondWithResult(_0x120edb,null))['catch'](handleError(_0x120edb,null));};exports['mailQueuesWaitingInteractions']=function(_0x49ff49,_0x3d36dc){return respondWithRpcPromise(_0x5769('0x4f'),_0x49ff49['query'],routingClient)['then'](respondWithResult(_0x3d36dc,null))[_0x5769('0xc')](handleError(_0x3d36dc,null));};exports[_0x5769('0x50')]=function(_0x1cb8d7,_0x7423ef){return respondWithRpcPromise(_0x5769('0x51'),_0x1cb8d7['query'],routingClient)[_0x5769('0x7')](respondWithResult(_0x7423ef,null))[_0x5769('0xc')](handleError(_0x7423ef,null));};exports[_0x5769('0x52')]=function(_0x3f34cd,_0x20cc25){return respondWithRpcPromise(_0x5769('0x53'),_0x3f34cd[_0x5769('0x19')],routingClient)[_0x5769('0x7')](respondWithResult(_0x20cc25,null))['catch'](handleError(_0x20cc25,null));};exports[_0x5769('0x54')]=function(_0x16944d,_0x7d0c0f){return respondWithRpcPromise(_0x5769('0x55'),_0x16944d[_0x5769('0x19')],routingClient)[_0x5769('0x7')](respondWithResult(_0x7d0c0f,null))[_0x5769('0xc')](handleError(_0x7d0c0f,null));};exports[_0x5769('0x56')]=function(_0x2c74e3){return function(_0x5083db,_0x700b22){var _0x2f4440,_0x1f5d31;var _0x38047f=_[_0x5769('0x57')](_0x2c74e3);var _0x4b6a90=_0x2c74e3==='chat'?_0x5769('0x58'):_0x5769('0x59');return db[_0x38047f+'Queue'][_0x5769('0x5a')]({'raw':!![],'where':{'id':_0x5083db[_0x5769('0x1a')]['id']}})[_0x5769('0x7')](function(_0x50a9e0){if(_['isNil'](_0x50a9e0)){throw new Error(_0x38047f+_0x5769('0x5b'));}_0x2f4440=_0x50a9e0;return db[_0x38047f+_0x5769('0x5c')][_0x5769('0x5a')]({'where':{'id':_0x5083db[_0x5769('0x2b')][_0x5769('0x5d')]},'include':[{'model':db[_0x38047f+_0x5769('0x5e')],'as':_0x5769('0x5e')},{'model':db[_0x38047f+_0x4b6a90],'as':'Account'}]});})['then'](function(_0x4e8fbe){if(_[_0x5769('0x13')](_0x4e8fbe)){throw new Error(_0x38047f+_0x5769('0x5f'));}_0x1f5d31=_0x4e8fbe;return _0x4e8fbe[_0x5769('0x60')]({'read':0x0,'readAt':null,'UserId':null});})['then'](function(){var _0x2fa440={'uniqueid':_0x2c74e3+'.'+_0x1f5d31['id']+'.'+_0x1f5d31[_0x5769('0x5e')]['id'],'FromUserId':_0x5083db['user']['id'],'type':'queue'};_0x2fa440[_0x38047f+_0x5769('0x61')]=_0x1f5d31['id'];_0x2fa440[_0x38047f+'InteractionId']=_0x1f5d31[_0x5769('0x5e')]['id'];_0x2fa440[_0x5769('0x62')+_0x38047f+_0x4b6a90+'Id']=_0x1f5d31[_0x5769('0x59')]['id'];_0x2fa440['To'+_0x38047f+_0x5769('0x63')]=_0x2f4440['id'];return db[_0x38047f+'TransferReport'][_0x5769('0x64')](_0x2fa440);})[_0x5769('0x7')](function(){return respondWithRpcPromise(_0x5769('0x65'),{'channel':_0x2c74e3,'interaction':_0x1f5d31[_0x5769('0x5e')],'message':_0x1f5d31,'account':_0x1f5d31[_0x5769('0x59')],'applications':[{'id':0x0,'priority':0x1,'app':_0x5769('0x66'),'appdata':_0x2f4440[_0x5769('0x10')]+','+(_0x1f5d31[_0x5769('0x59')][_0x5769('0x67')]||0x12c),'interval':_0x5769('0x68')}]},routingClient);})[_0x5769('0x7')](respondWithResult(_0x700b22,null))[_0x5769('0xc')](handleError(_0x700b22,null));};};exports[_0x5769('0x69')]=function(_0xa8d266,_0xc8b889){var _0x22484a,_0x502a71;if(_[_0x5769('0x13')](_0xa8d266[_0x5769('0x2b')][_0x5769('0x6a')])){throw new Error(_0x5769('0x6b'));}var _0x27d2b0=_0xa8d266[_0x5769('0x2b')][_0x5769('0x6a')];var _0x1446e4=_['capitalize'](_0x27d2b0);var _0x11072e=_0x27d2b0===_0x5769('0x6c')?_0x5769('0x58'):_0x5769('0x59');return db[_0x5769('0x6d')][_0x5769('0x5a')]({'raw':!![],'where':{'id':_0xa8d266['params']['id'],'role':_0x5769('0x6e')}})[_0x5769('0x7')](function(_0x45eef9){if(_[_0x5769('0x13')](_0x45eef9)){throw new Error(_0x5769('0x6f'));}_0x22484a=_0x45eef9;return db[_0x1446e4+_0x5769('0x5c')][_0x5769('0x5a')]({'where':{'id':_0xa8d266[_0x5769('0x2b')]['messageId']},'include':[{'model':db[_0x1446e4+_0x5769('0x5e')],'as':_0x5769('0x5e')},{'model':db[_0x1446e4+_0x11072e],'as':_0x5769('0x59')}]});})['then'](function(_0x95591a){if(_[_0x5769('0x13')](_0x95591a)){throw new Error(_0x1446e4+_0x5769('0x5f'));}_0x502a71=_0x95591a;return _0x95591a[_0x5769('0x60')]({'read':0x0,'readAt':null,'UserId':null});})['then'](function(){var _0x1ce613={'uniqueid':_0x27d2b0+'.'+_0x502a71['id']+'.'+_0x502a71[_0x5769('0x5e')]['id'],'FromUserId':_0xa8d266[_0x5769('0x2d')]['id'],'type':_0x5769('0x66'),'ToUserId':_0x22484a['id']};_0x1ce613[_0x1446e4+_0x5769('0x61')]=_0x502a71['id'];_0x1ce613[_0x1446e4+_0x5769('0x70')]=_0x502a71[_0x5769('0x5e')]['id'];_0x1ce613[_0x5769('0x62')+_0x1446e4+_0x11072e+'Id']=_0x502a71['Account']['id'];return db[_0x1446e4+_0x5769('0x71')][_0x5769('0x64')](_0x1ce613);})[_0x5769('0x7')](function(){return respondWithRpcPromise(_0x5769('0x65'),{'channel':_0x27d2b0,'interaction':_0x502a71['Interaction'],'message':_0x502a71,'account':_0x502a71['Account'],'applications':[{'id':0x0,'priority':0x1,'app':_0x5769('0x6e'),'appdata':_0x22484a['name']+','+(_0x502a71[_0x5769('0x59')][_0x5769('0x72')]||0x12c),'interval':_0x5769('0x68')}]},routingClient);})[_0x5769('0x7')](respondWithResult(_0xc8b889,null))['catch'](handleError(_0xc8b889,null));}; \ No newline at end of file +var _0xd750=['catch','json','sendStatus','name','status','send','isNil','rows','voiceChannels','VoiceChannels','query','voiceChannelMixMonitor','VoiceChannelMixMonitor','merge','params','voiceChannelStopMixMonitor','VoiceChannelStopMixMonitor','VoiceQueues','showVoiceQueues','VoiceQueuesPreview','VoiceQueuesChannels','voiceQueuesChannel','VoiceQueuesChannel','VoiceQueuesChannelHangup','voiceQueuesChannelRedirect','VoiceQueuesChannelRedirect','outbound','Outbound','outboundChannels','OutboundChannels','agents','Agents','agentCapacity','body','interaction','user','MemberReport','findAll','INTERACTION','format','YYYY-MM-DD\x20HH:mm:ss','length','updateAttributes','interface','SIP/%s','agent','internal','AgentCapacity','capacity','telephones','trunks','campaigns','Campaigns','chatQueues','showChatQueues','ChatQueues','mailQueues','showMailQueues','MailQueues','mailAccounts','MailAccounts','OpenchannelQueues','showOpenchannelQueues','smsQueues','SmsQueues','faxQueues','showFaxQueues','FaxQueues','FaxAccounts','mailQueuesWaitingInteractions','MailQueuesWaitingInteractions','openchannelQueuesWaitingInteractions','smsQueuesWaitingInteractions','FaxQueuesWaitingInteractions','queueNotify','capitalize','chat','Account','Queue','\x20Queue\x20not\x20found','Message','messageId','\x20Message\x20not\x20found','update','Interaction','queue','MessageId','InteractionId','From','TransferReport','create','Start','queueTransferTimeout','agentNotify','channel','Channel\x20field\x20is\x20mandatory','Website','User','findOne','Agent\x20not\x20found','agentTransferTimeout','bluebird','lodash','util','../../mysqldb','../../config/logger','jayson/promise','http','client','request','then','error','code','message'];(function(_0xc8a9b4,_0x495eec){var _0x377251=function(_0x532d99){while(--_0x532d99){_0xc8a9b4['push'](_0xc8a9b4['shift']());}};_0x377251(++_0x495eec);}(_0xd750,0x1bb));var _0x0d75=function(_0x4266b4,_0x4859ad){_0x4266b4=_0x4266b4-0x0;var _0x1442aa=_0xd750[_0x4266b4];return _0x1442aa;};'use strict';var BPromise=require(_0x0d75('0x0'));var moment=require('moment');var _=require(_0x0d75('0x1'));var util=require(_0x0d75('0x2'));var db=require(_0x0d75('0x3'))['db'];var logger=require(_0x0d75('0x4'))('api');var jayson=require(_0x0d75('0x5'));var amiClient=jayson['client'][_0x0d75('0x6')]({'port':0x232a});var mailClient=jayson[_0x0d75('0x7')][_0x0d75('0x6')]({'port':0x232b});var routingClient=jayson[_0x0d75('0x7')][_0x0d75('0x6')]({'port':0x232c});function respondWithRpcPromise(_0x473fd0,_0x2abfff,_0x54075a){return new BPromise(function(_0x2ea39b,_0xdc2e39){var _0x388a83=_0x54075a?_0x54075a:amiClient;return _0x388a83[_0x0d75('0x8')](_0x473fd0,_0x2abfff)[_0x0d75('0x9')](function(_0x15c05a){if(_0x15c05a[_0x0d75('0xa')]){if(_0x15c05a[_0x0d75('0xa')][_0x0d75('0xb')]===0x1f4){return _0xdc2e39(_0x15c05a[_0x0d75('0xa')][_0x0d75('0xc')]);}return _0x2ea39b(_0x15c05a[_0x0d75('0xa')][_0x0d75('0xc')]);}else{_0x2ea39b(_0x15c05a['result']);}})[_0x0d75('0xd')](function(_0x2e62e1){_0xdc2e39(_0x2e62e1);});});}function respondWithResult(_0x309443,_0x592743){_0x592743=_0x592743||0xc8;return function(_0x1fe060){if(_0x1fe060){return _0x309443['status'](_0x592743)[_0x0d75('0xe')](_0x1fe060);}return _0x309443[_0x0d75('0xf')](0x194);};}function handleError(_0x458b4c,_0x5e0ac4){_0x5e0ac4=_0x5e0ac4||0x1f4;return function(_0x191c86){logger[_0x0d75('0xa')](_0x191c86['stack']);if(_0x191c86[_0x0d75('0x10')]){delete _0x191c86[_0x0d75('0x10')];}_0x458b4c[_0x0d75('0x11')](_0x5e0ac4)[_0x0d75('0x12')](_0x191c86);};}function findById(_0x31bd39){return function(_0x3a1abc){if(!_[_0x0d75('0x13')](_0x31bd39)&&!_[_0x0d75('0x13')](_0x3a1abc)&&!_[_0x0d75('0x13')](_0x3a1abc[_0x0d75('0x14')])){return _['find'](_0x3a1abc[_0x0d75('0x14')],function(_0x522fe0){return _0x522fe0['id']==_0x31bd39;});}return null;};}exports[_0x0d75('0x15')]=function(_0x28ead9,_0xa69e6a){return respondWithRpcPromise(_0x0d75('0x16'),_0x28ead9[_0x0d75('0x17')])[_0x0d75('0x9')](respondWithResult(_0xa69e6a,null))[_0x0d75('0xd')](handleError(_0xa69e6a,null));};exports[_0x0d75('0x18')]=function(_0x49cfea,_0x3d71cb){return respondWithRpcPromise(_0x0d75('0x19'),_[_0x0d75('0x1a')](_0x49cfea[_0x0d75('0x17')],_0x49cfea[_0x0d75('0x1b')]))[_0x0d75('0x9')](respondWithResult(_0x3d71cb,null))[_0x0d75('0xd')](handleError(_0x3d71cb,null));};exports[_0x0d75('0x1c')]=function(_0x577a0a,_0x1ac391){return respondWithRpcPromise(_0x0d75('0x1d'),_[_0x0d75('0x1a')](_0x577a0a[_0x0d75('0x17')],_0x577a0a[_0x0d75('0x1b')]))[_0x0d75('0x9')](respondWithResult(_0x1ac391,null))[_0x0d75('0xd')](handleError(_0x1ac391,null));};exports['voiceQueues']=function(_0x542d0f,_0x40eb06){return respondWithRpcPromise(_0x0d75('0x1e'),_0x542d0f[_0x0d75('0x17')])[_0x0d75('0x9')](respondWithResult(_0x40eb06,null))[_0x0d75('0xd')](handleError(_0x40eb06,null));};exports[_0x0d75('0x1f')]=function(_0x2e5865,_0x291b25){return respondWithRpcPromise('VoiceQueues',_0x2e5865[_0x0d75('0x17')])['then'](findById(_0x2e5865[_0x0d75('0x1b')]['id']))[_0x0d75('0x9')](respondWithResult(_0x291b25,null))[_0x0d75('0xd')](handleError(_0x291b25,null));};exports['voiceQueuesPreview']=function(_0x3b1a99,_0x5f2fad){return respondWithRpcPromise(_0x0d75('0x20'),_[_0x0d75('0x1a')](_0x3b1a99[_0x0d75('0x17')],_0x3b1a99[_0x0d75('0x1b')]))[_0x0d75('0x9')](respondWithResult(_0x5f2fad,null))[_0x0d75('0xd')](handleError(_0x5f2fad,null));};exports['voiceQueuesChannels']=function(_0x36ea39,_0x47db90){return respondWithRpcPromise(_0x0d75('0x21'),_0x36ea39['query'])[_0x0d75('0x9')](respondWithResult(_0x47db90,null))[_0x0d75('0xd')](handleError(_0x47db90,null));};exports[_0x0d75('0x22')]=function(_0x21737f,_0x449a14){return respondWithRpcPromise(_0x0d75('0x23'),_[_0x0d75('0x1a')](_0x21737f[_0x0d75('0x17')],_0x21737f[_0x0d75('0x1b')]))[_0x0d75('0x9')](respondWithResult(_0x449a14,null))[_0x0d75('0xd')](handleError(_0x449a14,null));};exports['voiceQueuesChannelHangup']=function(_0x12ff04,_0x3d4543){return respondWithRpcPromise(_0x0d75('0x24'),_['merge'](_0x12ff04[_0x0d75('0x17')],_0x12ff04['params']))[_0x0d75('0x9')](respondWithResult(_0x3d4543,null))['catch'](handleError(_0x3d4543,null));};exports[_0x0d75('0x25')]=function(_0xc38669,_0x10ee83){return respondWithRpcPromise(_0x0d75('0x26'),_[_0x0d75('0x1a')](_0xc38669[_0x0d75('0x17')],_0xc38669[_0x0d75('0x1b')]))['then'](respondWithResult(_0x10ee83,null))[_0x0d75('0xd')](handleError(_0x10ee83,null));};exports[_0x0d75('0x27')]=function(_0x28f2cc,_0x4ec697){return respondWithRpcPromise(_0x0d75('0x28'),_0x28f2cc['query'])[_0x0d75('0x9')](respondWithResult(_0x4ec697,null))[_0x0d75('0xd')](handleError(_0x4ec697,null));};exports[_0x0d75('0x29')]=function(_0xf0a69,_0x118b34){return respondWithRpcPromise(_0x0d75('0x2a'),_0xf0a69[_0x0d75('0x17')])[_0x0d75('0x9')](respondWithResult(_0x118b34,null))['catch'](handleError(_0x118b34,null));};exports[_0x0d75('0x2b')]=function(_0x2c194a,_0x187e02){var _0x3e0c1c;return respondWithRpcPromise(_0x0d75('0x2c'),_0x2c194a['query'])[_0x0d75('0x9')](function(_0x5b6e3c){_0x3e0c1c=_0x5b6e3c;return respondWithRpcPromise('Agents',_0x2c194a[_0x0d75('0x17')],routingClient);})[_0x0d75('0x9')](function(_0x1c3061){return _['merge']({},_0x1c3061,_0x3e0c1c);})[_0x0d75('0x9')](respondWithResult(_0x187e02,null))[_0x0d75('0xd')](handleError(_0x187e02,null));};exports[_0x0d75('0x2d')]=function(_0xe1ba23,_0x1caea9){if(_0xe1ba23[_0x0d75('0x2e')]&&_0xe1ba23[_0x0d75('0x2e')][_0x0d75('0x2f')]&&_0xe1ba23[_0x0d75('0x30')]&&_0xe1ba23[_0x0d75('0x30')][_0x0d75('0x10')]){for(var _0x548b8f in _0xe1ba23['body'][_0x0d75('0x2f')]){if(_0xe1ba23['body'][_0x0d75('0x2f')]['hasOwnProperty'](_0x548b8f)){db[_0x0d75('0x31')][_0x0d75('0x32')]({'where':{'channel':_0x548b8f,'membername':_0xe1ba23[_0x0d75('0x30')][_0x0d75('0x10')],'type':_0x0d75('0x33'),'exitAt':null,'uniqueid':_0xe1ba23['body']['interaction'][_0x548b8f]&&_0xe1ba23[_0x0d75('0x2e')][_0x0d75('0x2f')][_0x548b8f]['length']?{'$notIn':_0xe1ba23[_0x0d75('0x2e')][_0x0d75('0x2f')][_0x548b8f]}:{'$ne':null}}})[_0x0d75('0x9')](function(_0x17bf64){var _0x2c194c=moment()[_0x0d75('0x34')](_0x0d75('0x35'));for(var _0x3219fb=0x0,_0xd9dcfd=_0x17bf64[_0x0d75('0x36')];_0x3219fb<_0xd9dcfd;_0x3219fb+=0x1){_0x17bf64[_0x3219fb][_0x0d75('0x37')]({'exitAt':_0x2c194c});}});for(var _0x377bad=0x0;_0x377bad<_0xe1ba23[_0x0d75('0x2e')][_0x0d75('0x2f')][_0x548b8f][_0x0d75('0x36')];_0x377bad+=0x1){db[_0x0d75('0x31')]['findOrCreate']({'where':{'channel':_0x548b8f,'membername':_0xe1ba23[_0x0d75('0x30')][_0x0d75('0x10')],'type':'INTERACTION','uniqueid':_0xe1ba23['body'][_0x0d75('0x2f')][_0x548b8f][_0x377bad],'exitAt':null},'defaults':{'channel':_0x548b8f,'membername':_0xe1ba23[_0x0d75('0x30')][_0x0d75('0x10')],'interface':_['isNil'](_0xe1ba23[_0x0d75('0x30')][_0x0d75('0x38')])?util[_0x0d75('0x34')](_0x0d75('0x39'),_0xe1ba23[_0x0d75('0x30')][_0x0d75('0x10')]):_0xe1ba23[_0x0d75('0x30')][_0x0d75('0x38')],'type':_0x0d75('0x33'),'enterAt':moment()[_0x0d75('0x34')](_0x0d75('0x35')),'role':_0x0d75('0x3a'),'internal':_0xe1ba23[_0x0d75('0x30')][_0x0d75('0x3b')],'uniqueid':_0xe1ba23['body'][_0x0d75('0x2f')][_0x548b8f][_0x377bad]}});}}}}return respondWithRpcPromise(_0x0d75('0x3c'),{'id':_0xe1ba23[_0x0d75('0x1b')]['id'],'capacity':_0xe1ba23[_0x0d75('0x2e')][_0x0d75('0x3d')]},routingClient)[_0x0d75('0x9')](respondWithResult(_0x1caea9,null))[_0x0d75('0xd')](handleError(_0x1caea9,null));};exports[_0x0d75('0x3e')]=function(_0x5e1043,_0x58f551){return respondWithRpcPromise('Telephones',_0x5e1043['query'])['then'](respondWithResult(_0x58f551,null))[_0x0d75('0xd')](handleError(_0x58f551,null));};exports[_0x0d75('0x3f')]=function(_0x5cbe26,_0x4656c0){return respondWithRpcPromise('Trunks',_0x5cbe26[_0x0d75('0x17')])[_0x0d75('0x9')](respondWithResult(_0x4656c0,null))['catch'](handleError(_0x4656c0,null));};exports[_0x0d75('0x40')]=function(_0x2fcd26,_0x550b84){return respondWithRpcPromise(_0x0d75('0x41'),_0x2fcd26['query'])[_0x0d75('0x9')](respondWithResult(_0x550b84,null))[_0x0d75('0xd')](handleError(_0x550b84,null));};exports[_0x0d75('0x42')]=function(_0x3313f6,_0x1bb842){return respondWithRpcPromise('ChatQueues',_0x3313f6[_0x0d75('0x17')],routingClient)[_0x0d75('0x9')](respondWithResult(_0x1bb842,null))[_0x0d75('0xd')](handleError(_0x1bb842,null));};exports[_0x0d75('0x43')]=function(_0x334b0f,_0x1f4b07){return respondWithRpcPromise(_0x0d75('0x44'),_0x334b0f[_0x0d75('0x17')],routingClient)[_0x0d75('0x9')](findById(_0x334b0f[_0x0d75('0x1b')]['id']))[_0x0d75('0x9')](respondWithResult(_0x1f4b07,null))[_0x0d75('0xd')](handleError(_0x1f4b07,null));};exports[_0x0d75('0x45')]=function(_0x5c50f7,_0x27746d){return respondWithRpcPromise('MailQueues',_0x5c50f7[_0x0d75('0x17')],routingClient)[_0x0d75('0x9')](respondWithResult(_0x27746d,null))[_0x0d75('0xd')](handleError(_0x27746d,null));};exports[_0x0d75('0x46')]=function(_0x5d3c2b,_0x4b51a7){return respondWithRpcPromise(_0x0d75('0x47'),_0x5d3c2b[_0x0d75('0x17')],routingClient)['then'](findById(_0x5d3c2b[_0x0d75('0x1b')]['id']))[_0x0d75('0x9')](respondWithResult(_0x4b51a7,null))['catch'](handleError(_0x4b51a7,null));};exports[_0x0d75('0x48')]=function(_0x5dbc3e,_0x4d683a){return respondWithRpcPromise(_0x0d75('0x49'),_0x5dbc3e['query'],mailClient)[_0x0d75('0x9')](respondWithResult(_0x4d683a,null))[_0x0d75('0xd')](handleError(_0x4d683a,null));};exports['openchannelQueues']=function(_0x541472,_0x225814){return respondWithRpcPromise(_0x0d75('0x4a'),_0x541472[_0x0d75('0x17')],routingClient)['then'](respondWithResult(_0x225814,null))['catch'](handleError(_0x225814,null));};exports[_0x0d75('0x4b')]=function(_0x4dbb72,_0x4d28fa){return respondWithRpcPromise(_0x0d75('0x4a'),_0x4dbb72[_0x0d75('0x17')],routingClient)[_0x0d75('0x9')](findById(_0x4dbb72[_0x0d75('0x1b')]['id']))['then'](respondWithResult(_0x4d28fa,null))['catch'](handleError(_0x4d28fa,null));};exports[_0x0d75('0x4c')]=function(_0x207190,_0x41fc2d){return respondWithRpcPromise(_0x0d75('0x4d'),_0x207190[_0x0d75('0x17')],routingClient)[_0x0d75('0x9')](respondWithResult(_0x41fc2d,null))[_0x0d75('0xd')](handleError(_0x41fc2d,null));};exports['showSmsQueues']=function(_0x44c02c,_0x4a842c){return respondWithRpcPromise('SmsQueues',_0x44c02c[_0x0d75('0x17')],routingClient)[_0x0d75('0x9')](findById(_0x44c02c['params']['id']))[_0x0d75('0x9')](respondWithResult(_0x4a842c,null))['catch'](handleError(_0x4a842c,null));};exports[_0x0d75('0x4e')]=function(_0x577164,_0x26255f){return respondWithRpcPromise('FaxQueues',_0x577164['query'],routingClient)[_0x0d75('0x9')](respondWithResult(_0x26255f,null))[_0x0d75('0xd')](handleError(_0x26255f,null));};exports[_0x0d75('0x4f')]=function(_0x449728,_0xcc5cc1){return respondWithRpcPromise(_0x0d75('0x50'),_0x449728[_0x0d75('0x17')],routingClient)['then'](findById(_0x449728[_0x0d75('0x1b')]['id']))['then'](respondWithResult(_0xcc5cc1,null))[_0x0d75('0xd')](handleError(_0xcc5cc1,null));};exports['faxAccounts']=function(_0x49c777,_0x35f143){return respondWithRpcPromise(_0x0d75('0x51'),_0x49c777[_0x0d75('0x17')])[_0x0d75('0x9')](respondWithResult(_0x35f143,null))['catch'](handleError(_0x35f143,null));};exports['chatQueuesWaitingInteractions']=function(_0x38a8de,_0x2a384a){return respondWithRpcPromise('ChatQueuesWaitingInteractions',_0x38a8de['query'],routingClient)[_0x0d75('0x9')](respondWithResult(_0x2a384a,null))['catch'](handleError(_0x2a384a,null));};exports[_0x0d75('0x52')]=function(_0x239188,_0x546eb0){return respondWithRpcPromise(_0x0d75('0x53'),_0x239188[_0x0d75('0x17')],routingClient)[_0x0d75('0x9')](respondWithResult(_0x546eb0,null))['catch'](handleError(_0x546eb0,null));};exports[_0x0d75('0x54')]=function(_0x2abbba,_0x91625){return respondWithRpcPromise('OpenchannelQueuesWaitingInteractions',_0x2abbba[_0x0d75('0x17')],routingClient)[_0x0d75('0x9')](respondWithResult(_0x91625,null))[_0x0d75('0xd')](handleError(_0x91625,null));};exports[_0x0d75('0x55')]=function(_0x4ca11a,_0x6a0f7c){return respondWithRpcPromise('SmsQueuesWaitingInteractions',_0x4ca11a[_0x0d75('0x17')],routingClient)[_0x0d75('0x9')](respondWithResult(_0x6a0f7c,null))[_0x0d75('0xd')](handleError(_0x6a0f7c,null));};exports['faxQueuesWaitingInteractions']=function(_0x42c7b4,_0x1cc5d6){return respondWithRpcPromise(_0x0d75('0x56'),_0x42c7b4['query'],routingClient)[_0x0d75('0x9')](respondWithResult(_0x1cc5d6,null))['catch'](handleError(_0x1cc5d6,null));};exports[_0x0d75('0x57')]=function(_0x306c5b){return function(_0x11d03c,_0x38b2fa){var _0x520833,_0x154ea2;var _0x1c8ae6=_[_0x0d75('0x58')](_0x306c5b);var _0x3924f7=_0x306c5b===_0x0d75('0x59')?'Website':_0x0d75('0x5a');return db[_0x1c8ae6+_0x0d75('0x5b')]['findOne']({'raw':!![],'where':{'id':_0x11d03c[_0x0d75('0x1b')]['id']}})[_0x0d75('0x9')](function(_0x1935b0){if(_['isNil'](_0x1935b0)){throw new Error(_0x1c8ae6+_0x0d75('0x5c'));}_0x520833=_0x1935b0;return db[_0x1c8ae6+_0x0d75('0x5d')]['findOne']({'where':{'id':_0x11d03c['body'][_0x0d75('0x5e')]},'include':[{'model':db[_0x1c8ae6+'Interaction'],'as':'Interaction'},{'model':db[_0x1c8ae6+_0x3924f7],'as':_0x0d75('0x5a')}]});})[_0x0d75('0x9')](function(_0x5ab065){if(_[_0x0d75('0x13')](_0x5ab065)){throw new Error(_0x1c8ae6+_0x0d75('0x5f'));}_0x154ea2=_0x5ab065;return _0x5ab065[_0x0d75('0x60')]({'read':0x0,'readAt':null,'UserId':null});})[_0x0d75('0x9')](function(){var _0x36a81a={'uniqueid':_0x306c5b+'.'+_0x154ea2['id']+'.'+_0x154ea2[_0x0d75('0x61')]['id'],'FromUserId':_0x11d03c[_0x0d75('0x30')]['id'],'type':_0x0d75('0x62')};_0x36a81a[_0x1c8ae6+_0x0d75('0x63')]=_0x154ea2['id'];_0x36a81a[_0x1c8ae6+_0x0d75('0x64')]=_0x154ea2[_0x0d75('0x61')]['id'];_0x36a81a[_0x0d75('0x65')+_0x1c8ae6+_0x3924f7+'Id']=_0x154ea2[_0x0d75('0x5a')]['id'];_0x36a81a['To'+_0x1c8ae6+'QueueId']=_0x520833['id'];return db[_0x1c8ae6+_0x0d75('0x66')][_0x0d75('0x67')](_0x36a81a);})[_0x0d75('0x9')](function(){return respondWithRpcPromise(_0x0d75('0x68'),{'channel':_0x306c5b,'interaction':_0x154ea2[_0x0d75('0x61')],'message':_0x154ea2,'account':_0x154ea2[_0x0d75('0x5a')],'applications':[{'id':0x0,'priority':0x1,'app':'queue','appdata':_0x520833[_0x0d75('0x10')]+','+(_0x154ea2['Account'][_0x0d75('0x69')]||0x12c),'interval':'*,*,*,*'}]},routingClient);})[_0x0d75('0x9')](respondWithResult(_0x38b2fa,null))[_0x0d75('0xd')](handleError(_0x38b2fa,null));};};exports[_0x0d75('0x6a')]=function(_0x5eaae1,_0x55671b){var _0xcc8fbc,_0x2cba7e;if(_[_0x0d75('0x13')](_0x5eaae1[_0x0d75('0x2e')][_0x0d75('0x6b')])){throw new Error(_0x0d75('0x6c'));}var _0x5c2f3c=_0x5eaae1['body'][_0x0d75('0x6b')];var _0x2775bb=_[_0x0d75('0x58')](_0x5c2f3c);var _0x63e929=_0x5c2f3c===_0x0d75('0x59')?_0x0d75('0x6d'):_0x0d75('0x5a');return db[_0x0d75('0x6e')][_0x0d75('0x6f')]({'raw':!![],'where':{'id':_0x5eaae1[_0x0d75('0x1b')]['id'],'role':_0x0d75('0x3a')}})[_0x0d75('0x9')](function(_0xd149e7){if(_[_0x0d75('0x13')](_0xd149e7)){throw new Error(_0x0d75('0x70'));}_0xcc8fbc=_0xd149e7;return db[_0x2775bb+_0x0d75('0x5d')][_0x0d75('0x6f')]({'where':{'id':_0x5eaae1['body'][_0x0d75('0x5e')]},'include':[{'model':db[_0x2775bb+'Interaction'],'as':_0x0d75('0x61')},{'model':db[_0x2775bb+_0x63e929],'as':_0x0d75('0x5a')}]});})['then'](function(_0x519c10){if(_['isNil'](_0x519c10)){throw new Error(_0x2775bb+_0x0d75('0x5f'));}_0x2cba7e=_0x519c10;return _0x519c10['update']({'read':0x0,'readAt':null,'UserId':null});})[_0x0d75('0x9')](function(){var _0x56c0cf={'uniqueid':_0x5c2f3c+'.'+_0x2cba7e['id']+'.'+_0x2cba7e['Interaction']['id'],'FromUserId':_0x5eaae1[_0x0d75('0x30')]['id'],'type':'queue','ToUserId':_0xcc8fbc['id']};_0x56c0cf[_0x2775bb+_0x0d75('0x63')]=_0x2cba7e['id'];_0x56c0cf[_0x2775bb+_0x0d75('0x64')]=_0x2cba7e[_0x0d75('0x61')]['id'];_0x56c0cf[_0x0d75('0x65')+_0x2775bb+_0x63e929+'Id']=_0x2cba7e[_0x0d75('0x5a')]['id'];return db[_0x2775bb+_0x0d75('0x66')][_0x0d75('0x67')](_0x56c0cf);})['then'](function(){return respondWithRpcPromise(_0x0d75('0x68'),{'channel':_0x5c2f3c,'interaction':_0x2cba7e['Interaction'],'message':_0x2cba7e,'account':_0x2cba7e[_0x0d75('0x5a')],'applications':[{'id':0x0,'priority':0x1,'app':_0x0d75('0x3a'),'appdata':_0xcc8fbc[_0x0d75('0x10')]+','+(_0x2cba7e[_0x0d75('0x5a')][_0x0d75('0x71')]||0x12c),'interval':'*,*,*,*'}]},routingClient);})[_0x0d75('0x9')](respondWithResult(_0x55671b,null))[_0x0d75('0xd')](handleError(_0x55671b,null));}; \ No newline at end of file diff --git a/server/api/schedule/index.js b/server/api/schedule/index.js index 28b8226..42d6397 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 _0x5e3f=['create','put','/:id','destroy','multer','util','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./schedule.controller','get','isAuthenticated','index','/:id/run','run'];(function(_0x471b45,_0x16ccd3){var _0x5e53e8=function(_0x10c3f2){while(--_0x10c3f2){_0x471b45['push'](_0x471b45['shift']());}};_0x5e53e8(++_0x16ccd3);}(_0x5e3f,0x7b));var _0xf5e3=function(_0x1edb0c,_0x58602b){_0x1edb0c=_0x1edb0c-0x0;var _0x4de44a=_0x5e3f[_0x1edb0c];return _0x4de44a;};'use strict';var multer=require(_0xf5e3('0x0'));var util=require(_0xf5e3('0x1'));var path=require('path');var timeout=require(_0xf5e3('0x2'));var express=require('express');var router=express[_0xf5e3('0x3')]();var auth=require(_0xf5e3('0x4'));var interaction=require(_0xf5e3('0x5'));var config=require(_0xf5e3('0x6'));var controller=require(_0xf5e3('0x7'));router[_0xf5e3('0x8')]('/',auth[_0xf5e3('0x9')](),controller[_0xf5e3('0xa')]);router[_0xf5e3('0x8')]('/:id',auth[_0xf5e3('0x9')](),controller['show']);router['get'](_0xf5e3('0xb'),auth['isAuthenticated'](),controller[_0xf5e3('0xc')]);router['post']('/',auth[_0xf5e3('0x9')](),controller[_0xf5e3('0xd')]);router[_0xf5e3('0xe')](_0xf5e3('0xf'),auth[_0xf5e3('0x9')](),controller['update']);router['delete'](_0xf5e3('0xf'),auth[_0xf5e3('0x9')](),controller[_0xf5e3('0x10')]);module['exports']=router; \ No newline at end of file +var _0xae0e=['get','index','/:id','isAuthenticated','/:id/run','run','post','create','put','update','destroy','exports','multer','util','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','./schedule.controller'];(function(_0x58efa6,_0x2c00bd){var _0x5d643c=function(_0x1d1ef2){while(--_0x1d1ef2){_0x58efa6['push'](_0x58efa6['shift']());}};_0x5d643c(++_0x2c00bd);}(_0xae0e,0x98));var _0xeae0=function(_0x5a0a5f,_0x15bb0b){_0x5a0a5f=_0x5a0a5f-0x0;var _0x104795=_0xae0e[_0x5a0a5f];return _0x104795;};'use strict';var multer=require(_0xeae0('0x0'));var util=require(_0xeae0('0x1'));var path=require('path');var timeout=require(_0xeae0('0x2'));var express=require(_0xeae0('0x3'));var router=express[_0xeae0('0x4')]();var auth=require(_0xeae0('0x5'));var interaction=require(_0xeae0('0x6'));var config=require('../../config/environment');var controller=require(_0xeae0('0x7'));router[_0xeae0('0x8')]('/',auth['isAuthenticated'](),controller[_0xeae0('0x9')]);router[_0xeae0('0x8')](_0xeae0('0xa'),auth[_0xeae0('0xb')](),controller['show']);router['get'](_0xeae0('0xc'),auth[_0xeae0('0xb')](),controller[_0xeae0('0xd')]);router[_0xeae0('0xe')]('/',auth[_0xeae0('0xb')](),controller[_0xeae0('0xf')]);router[_0xeae0('0x10')](_0xeae0('0xa'),auth['isAuthenticated'](),controller[_0xeae0('0x11')]);router['delete'](_0xeae0('0xa'),auth[_0xeae0('0xb')](),controller[_0xeae0('0x12')]);module[_0xeae0('0x13')]=router; \ No newline at end of file diff --git a/server/api/schedule/schedule.attributes.js b/server/api/schedule/schedule.attributes.js index b5d6c32..53759aa 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 _0xc6ac=['minutes','csv','pdf','xlsx','custom','default','TEXT','sequelize','exports','STRING','BOOLEAN','0\x200\x20*\x20*\x20*','DATE','INTEGER','ENUM','years','quarters','months','days','hours'];(function(_0xba0bb2,_0x25fbfd){var _0x2bbd8f=function(_0x37f535){while(--_0x37f535){_0xba0bb2['push'](_0xba0bb2['shift']());}};_0x2bbd8f(++_0x25fbfd);}(_0xc6ac,0x15b));var _0xcc6a=function(_0xf14121,_0x24fdd9){_0xf14121=_0xf14121-0x0;var _0x295bb8=_0xc6ac[_0xf14121];return _0x295bb8;};'use strict';var Sequelize=require(_0xcc6a('0x0'));module[_0xcc6a('0x1')]={'name':{'type':Sequelize[_0xcc6a('0x2')],'allowNull':![]},'description':{'type':Sequelize[_0xcc6a('0x2')]},'active':{'type':Sequelize[_0xcc6a('0x3')],'allowNull':![],'defaultValue':![]},'cron':{'type':Sequelize[_0xcc6a('0x2')],'allowNull':![],'defaultValue':_0xcc6a('0x4')},'startAt':{'type':Sequelize[_0xcc6a('0x5')],'allowNull':![]},'endAt':{'type':Sequelize[_0xcc6a('0x5')],'allowNull':![]},'subtractNumber':{'type':Sequelize[_0xcc6a('0x6')],'allowNull':![],'defaultValue':0x1,'validate':{'min':0x1}},'subtractUnit':{'type':Sequelize[_0xcc6a('0x7')](_0xcc6a('0x8'),_0xcc6a('0x9'),_0xcc6a('0xa'),'weeks',_0xcc6a('0xb'),_0xcc6a('0xc'),_0xcc6a('0xd')),'allowNull':![],'defaultValue':'days'},'output':{'type':Sequelize[_0xcc6a('0x7')](_0xcc6a('0xe'),_0xcc6a('0xf'),_0xcc6a('0x10')),'allowNull':![],'defaultValue':_0xcc6a('0xe')},'type':{'type':Sequelize['ENUM'](_0xcc6a('0x11'),_0xcc6a('0x12')),'allowNull':![],'defaultValue':_0xcc6a('0x11')},'sendMail':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'email':{'type':Sequelize[_0xcc6a('0x2')]},'cc':{'type':Sequelize[_0xcc6a('0x13')]},'bcc':{'type':Sequelize[_0xcc6a('0x13')]},'sendIfEmpty':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]}}; \ No newline at end of file +var _0x90b1=['days','hours','minutes','ENUM','pdf','xlsx','csv','custom','default','BOOLEAN','TEXT','sequelize','exports','STRING','0\x200\x20*\x20*\x20*','DATE','months','weeks'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x90b1,0x1bb));var _0x190b=function(_0x1d2ff6,_0x2216b4){_0x1d2ff6=_0x1d2ff6-0x0;var _0x4b269f=_0x90b1[_0x1d2ff6];return _0x4b269f;};'use strict';var Sequelize=require(_0x190b('0x0'));module[_0x190b('0x1')]={'name':{'type':Sequelize[_0x190b('0x2')],'allowNull':![]},'description':{'type':Sequelize['STRING']},'active':{'type':Sequelize['BOOLEAN'],'allowNull':![],'defaultValue':![]},'cron':{'type':Sequelize[_0x190b('0x2')],'allowNull':![],'defaultValue':_0x190b('0x3')},'startAt':{'type':Sequelize[_0x190b('0x4')],'allowNull':![]},'endAt':{'type':Sequelize[_0x190b('0x4')],'allowNull':![]},'subtractNumber':{'type':Sequelize['INTEGER'],'allowNull':![],'defaultValue':0x1,'validate':{'min':0x1}},'subtractUnit':{'type':Sequelize['ENUM']('years','quarters',_0x190b('0x5'),_0x190b('0x6'),_0x190b('0x7'),_0x190b('0x8'),_0x190b('0x9')),'allowNull':![],'defaultValue':_0x190b('0x7')},'output':{'type':Sequelize[_0x190b('0xa')]('csv',_0x190b('0xb'),_0x190b('0xc')),'allowNull':![],'defaultValue':_0x190b('0xd')},'type':{'type':Sequelize[_0x190b('0xa')](_0x190b('0xe'),_0x190b('0xf')),'allowNull':![],'defaultValue':_0x190b('0xe')},'sendMail':{'type':Sequelize[_0x190b('0x10')],'defaultValue':![]},'email':{'type':Sequelize['STRING']},'cc':{'type':Sequelize[_0x190b('0x11')]},'bcc':{'type':Sequelize[_0x190b('0x11')]},'sendIfEmpty':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]}}; \ No newline at end of file diff --git a/server/api/schedule/schedule.controller.js b/server/api/schedule/schedule.controller.js index 5191f23..67b8cad 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 _0x74ba=['catch','show','params','keys','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','run','../../config/schedule','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','end','status','count','offset','limit','json','apply','update','then','get','Scheduler','UserProfileResource','destroy','sendStatus','error','stack','name','index','Schedule','rawAttributes','fieldName','type','model','map','filters','query','attributes','intersection','fields','length','order','sort','where','merge','VIRTUAL','filter','options','include'];(function(_0x1321ef,_0x1510eb){var _0x24a973=function(_0x262c57){while(--_0x262c57){_0x1321ef['push'](_0x1321ef['shift']());}};_0x24a973(++_0x1510eb);}(_0x74ba,0x100));var _0xa74b=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x74ba[_0x321bb2];return _0x9c12ed;};'use strict';var pdf=require(_0xa74b('0x0'));var emlformat=require(_0xa74b('0x1'));var rimraf=require(_0xa74b('0x2'));var zipdir=require(_0xa74b('0x3'));var jsonpatch=require(_0xa74b('0x4'));var rp=require('request-promise');var moment=require(_0xa74b('0x5'));var BPromise=require(_0xa74b('0x6'));var Mustache=require(_0xa74b('0x7'));var util=require(_0xa74b('0x8'));var path=require(_0xa74b('0x9'));var sox=require(_0xa74b('0xa'));var csv=require(_0xa74b('0xb'));var ejs=require(_0xa74b('0xc'));var fs=require('fs');var _=require(_0xa74b('0xd'));var squel=require(_0xa74b('0xe'));var crypto=require(_0xa74b('0xf'));var jsforce=require('jsforce');var deskjs=require(_0xa74b('0x10'));var toCsv=require(_0xa74b('0xb'));var querystring=require(_0xa74b('0x11'));var Papa=require(_0xa74b('0x12'));var Redis=require('ioredis');var authService=require(_0xa74b('0x13'));var qs=require(_0xa74b('0x14'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xa74b('0x15'));var logger=require(_0xa74b('0x16'))('api');var utils=require(_0xa74b('0x17'));var config=require(_0xa74b('0x18'));var db=require(_0xa74b('0x19'))['db'];function respondWithStatusCode(_0x56d2f2,_0x50ce27){_0x50ce27=_0x50ce27||0xcc;return function(_0x27f4c9){if(_0x27f4c9){return _0x56d2f2['sendStatus'](_0x50ce27);}return _0x56d2f2['status'](_0x50ce27)[_0xa74b('0x1a')]();};}function respondWithResult(_0x5e8acb,_0x435d35){_0x435d35=_0x435d35||0xc8;return function(_0xd6f842){if(_0xd6f842){return _0x5e8acb[_0xa74b('0x1b')](_0x435d35)['json'](_0xd6f842);}};}function respondWithFilteredResult(_0x34513d,_0x1f7b52){return function(_0x4fccb5){if(_0x4fccb5){var _0x1abb9c=_0x4fccb5[_0xa74b('0x1c')],_0x1bdfd6=_0x1f7b52[_0xa74b('0x1d')],_0x417c9f=_0x1f7b52[_0xa74b('0x1d')]+_0x1f7b52[_0xa74b('0x1e')],_0x1090af;if(_0x417c9f>=_0x1abb9c){_0x417c9f=_0x1abb9c;_0x1090af=0xc8;}else{_0x1090af=0xce;}_0x34513d[_0xa74b('0x1b')](_0x1090af);return _0x34513d['set']('Content-Range',_0x1bdfd6+'-'+_0x417c9f+'/'+_0x1abb9c)[_0xa74b('0x1f')](_0x4fccb5);}return null;};}function patchUpdates(_0x216f7a){return function(_0x2df0e3){try{jsonpatch[_0xa74b('0x20')](_0x2df0e3,_0x216f7a,!![]);}catch(_0x2c5a09){return BPromise['reject'](_0x2c5a09);}return _0x2df0e3['save']();};}function saveUpdates(_0x3d99c4,_0x396811){return function(_0x122c2b){if(_0x122c2b){return _0x122c2b[_0xa74b('0x21')](_0x3d99c4)[_0xa74b('0x22')](function(_0xe1b20c){return _0xe1b20c;});}return null;};}function removeEntity(_0x473f2f,_0x113103){return function(_0x2a12cc){if(_0x2a12cc){return _0x2a12cc['destroy']()[_0xa74b('0x22')](function(){var _0x6625a6=_0x2a12cc[_0xa74b('0x23')]({'plain':!![]});var _0x4c5d5e=_0xa74b('0x24');return db[_0xa74b('0x25')][_0xa74b('0x26')]({'where':{'type':_0x4c5d5e,'resourceId':_0x6625a6['id']}})[_0xa74b('0x22')](function(){return _0x2a12cc;});})[_0xa74b('0x22')](function(){_0x473f2f[_0xa74b('0x1b')](0xcc)[_0xa74b('0x1a')]();});}};}function handleEntityNotFound(_0x2eb7a2,_0x58aee0){return function(_0xa0f4a3){if(!_0xa0f4a3){_0x2eb7a2[_0xa74b('0x27')](0x194);}return _0xa0f4a3;};}function handleError(_0x432cc5,_0x326497){_0x326497=_0x326497||0x1f4;return function(_0x2e3822){logger[_0xa74b('0x28')](_0x2e3822[_0xa74b('0x29')]);if(_0x2e3822[_0xa74b('0x2a')]){delete _0x2e3822['name'];}_0x432cc5[_0xa74b('0x1b')](_0x326497)['send'](_0x2e3822);};}exports[_0xa74b('0x2b')]=function(_0xad1980,_0x3f99b9){var _0xfa14f3={},_0x144767={},_0x162258={'count':0x0,'rows':[]};var _0x13eaa1=_['map'](db[_0xa74b('0x2c')][_0xa74b('0x2d')],function(_0x541c9b){return{'name':_0x541c9b[_0xa74b('0x2e')],'type':_0x541c9b[_0xa74b('0x2f')]['key']};});_0x144767[_0xa74b('0x30')]=_[_0xa74b('0x31')](_0x13eaa1,_0xa74b('0x2a'));_0x144767['query']=_['keys'](_0xad1980['query']);_0x144767[_0xa74b('0x32')]=_['intersection'](_0x144767[_0xa74b('0x30')],_0x144767[_0xa74b('0x33')]);_0xfa14f3[_0xa74b('0x34')]=_[_0xa74b('0x35')](_0x144767[_0xa74b('0x30')],qs[_0xa74b('0x36')](_0xad1980['query'][_0xa74b('0x36')]));_0xfa14f3[_0xa74b('0x34')]=_0xfa14f3[_0xa74b('0x34')][_0xa74b('0x37')]?_0xfa14f3[_0xa74b('0x34')]:_0x144767[_0xa74b('0x30')];if(!_0xad1980['query']['hasOwnProperty']('nolimit')){_0xfa14f3[_0xa74b('0x1e')]=qs[_0xa74b('0x1e')](_0xad1980[_0xa74b('0x33')]['limit']);_0xfa14f3[_0xa74b('0x1d')]=qs[_0xa74b('0x1d')](_0xad1980[_0xa74b('0x33')][_0xa74b('0x1d')]);}_0xfa14f3[_0xa74b('0x38')]=qs[_0xa74b('0x39')](_0xad1980[_0xa74b('0x33')][_0xa74b('0x39')]);_0xfa14f3[_0xa74b('0x3a')]=qs[_0xa74b('0x32')](_['pick'](_0xad1980[_0xa74b('0x33')],_0x144767['filters']));if(_0xad1980[_0xa74b('0x33')]['filter']){_0xfa14f3[_0xa74b('0x3a')]=_[_0xa74b('0x3b')](_0xfa14f3[_0xa74b('0x3a')],{'$or':_['map'](_0x13eaa1,function(_0x14289f){if(_0x14289f['type']!==_0xa74b('0x3c')){var _0x410aeb={};_0x410aeb[_0x14289f[_0xa74b('0x2a')]]={'$like':'%'+_0xad1980[_0xa74b('0x33')][_0xa74b('0x3d')]+'%'};return _0x410aeb;}})});}_0xfa14f3=_[_0xa74b('0x3b')]({},_0xfa14f3,_0xad1980[_0xa74b('0x3e')]);var _0x945a73={'where':_0xfa14f3[_0xa74b('0x3a')]};return db[_0xa74b('0x2c')]['count'](_0x945a73)['then'](function(_0x405257){_0x162258['count']=_0x405257;if(_0xad1980['query']['includeAll']){_0xfa14f3[_0xa74b('0x3f')]=[{'all':!![]}];}return db[_0xa74b('0x2c')]['findAll'](_0xfa14f3);})[_0xa74b('0x22')](function(_0x3ba302){_0x162258['rows']=_0x3ba302;return _0x162258;})[_0xa74b('0x22')](respondWithFilteredResult(_0x3f99b9,_0xfa14f3))[_0xa74b('0x40')](handleError(_0x3f99b9,null));};exports[_0xa74b('0x41')]=function(_0x469b85,_0x434d6b){var _0x540c85={'raw':![],'where':{'id':_0x469b85[_0xa74b('0x42')]['id']}},_0x2e3ba6={};_0x2e3ba6[_0xa74b('0x30')]=_[_0xa74b('0x43')](db[_0xa74b('0x2c')][_0xa74b('0x2d')]);_0x2e3ba6[_0xa74b('0x33')]=_['keys'](_0x469b85[_0xa74b('0x33')]);_0x2e3ba6[_0xa74b('0x32')]=_[_0xa74b('0x35')](_0x2e3ba6[_0xa74b('0x30')],_0x2e3ba6[_0xa74b('0x33')]);_0x540c85[_0xa74b('0x34')]=_[_0xa74b('0x35')](_0x2e3ba6[_0xa74b('0x30')],qs[_0xa74b('0x36')](_0x469b85[_0xa74b('0x33')][_0xa74b('0x36')]));_0x540c85[_0xa74b('0x34')]=_0x540c85[_0xa74b('0x34')]['length']?_0x540c85[_0xa74b('0x34')]:_0x2e3ba6[_0xa74b('0x30')];if(_0x469b85['query'][_0xa74b('0x44')]){_0x540c85[_0xa74b('0x3f')]=[{'all':!![]}];}_0x540c85=_[_0xa74b('0x3b')]({},_0x540c85,_0x469b85['options']);return db[_0xa74b('0x2c')][_0xa74b('0x45')](_0x540c85)[_0xa74b('0x22')](handleEntityNotFound(_0x434d6b,null))['then'](respondWithResult(_0x434d6b,null))[_0xa74b('0x40')](handleError(_0x434d6b,null));};exports[_0xa74b('0x46')]=function(_0x22bd9c,_0x418e5a){return db['Schedule'][_0xa74b('0x46')](_0x22bd9c[_0xa74b('0x47')],{})[_0xa74b('0x22')](function(_0x1f955c){var _0x2c7835=_0x22bd9c[_0xa74b('0x48')][_0xa74b('0x23')]({'plain':!![]});if(!_0x2c7835)throw new Error(_0xa74b('0x49'));if(_0x2c7835[_0xa74b('0x4a')]===_0xa74b('0x48')){var _0x5dce9b=_0x1f955c[_0xa74b('0x23')]({'plain':!![]});var _0x3901be=_0xa74b('0x24');return db['UserProfileSection'][_0xa74b('0x45')]({'where':{'name':_0x3901be,'userProfileId':_0x2c7835[_0xa74b('0x4b')]},'raw':!![]})[_0xa74b('0x22')](function(_0x4de803){if(_0x4de803&&_0x4de803[_0xa74b('0x4c')]===0x0){return db['UserProfileResource'][_0xa74b('0x46')]({'name':_0x5dce9b[_0xa74b('0x2a')],'resourceId':_0x5dce9b['id'],'type':_0x4de803[_0xa74b('0x2a')],'sectionId':_0x4de803['id']},{})[_0xa74b('0x22')](function(){return _0x1f955c;});}else{return _0x1f955c;}})[_0xa74b('0x40')](function(_0x3da7a4){logger['error'](_0xa74b('0x4d'),_0x3da7a4);throw _0x3da7a4;});}return _0x1f955c;})[_0xa74b('0x22')](respondWithResult(_0x418e5a,0xc9))[_0xa74b('0x40')](handleError(_0x418e5a,null));};exports[_0xa74b('0x21')]=function(_0x4bddc8,_0x3ed8dd){if(_0x4bddc8[_0xa74b('0x47')]['id']){delete _0x4bddc8[_0xa74b('0x47')]['id'];}return db['Schedule'][_0xa74b('0x45')]({'where':{'id':_0x4bddc8[_0xa74b('0x42')]['id']}})['then'](handleEntityNotFound(_0x3ed8dd,null))[_0xa74b('0x22')](saveUpdates(_0x4bddc8[_0xa74b('0x47')],null))[_0xa74b('0x22')](respondWithResult(_0x3ed8dd,null))[_0xa74b('0x40')](handleError(_0x3ed8dd,null));};exports[_0xa74b('0x26')]=function(_0x32c2b1,_0x297e86){return db['Schedule'][_0xa74b('0x45')]({'where':{'id':_0x32c2b1[_0xa74b('0x42')]['id']}})[_0xa74b('0x22')](handleEntityNotFound(_0x297e86,null))[_0xa74b('0x22')](removeEntity(_0x297e86,null))[_0xa74b('0x40')](handleError(_0x297e86,null));};exports[_0xa74b('0x4e')]=function(_0x5ebcf8,_0x3258ab,_0x196a5a){var _0x463f94=require(_0xa74b('0x4f'));return db['Schedule'][_0xa74b('0x45')]({'where':{'id':_0x5ebcf8[_0xa74b('0x42')]['id']},'raw':!![]})[_0xa74b('0x22')](handleEntityNotFound(_0x3258ab,null))[_0xa74b('0x22')](function(){_0x463f94[_0xa74b('0x4e')](_0x5ebcf8[_0xa74b('0x42')]['id']);})[_0xa74b('0x22')](respondWithStatusCode(_0x3258ab,null))[_0xa74b('0x40')](handleError(_0x3258ab,null));}; \ No newline at end of file +var _0x4a93=['catch','show','params','keys','fields','create','body','user','UserProfileSection','find','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','run','../../config/schedule','html-pdf','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','path','to-csv','ejs','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../config/environment','../../mysqldb','status','json','count','offset','set','Content-Range','apply','reject','save','update','then','get','Scheduler','UserProfileResource','destroy','sendStatus','error','stack','name','send','index','map','Schedule','rawAttributes','fieldName','type','key','model','query','filters','attributes','intersection','nolimit','limit','order','sort','where','pick','VIRTUAL','filter','merge','options','includeAll','include','findAll','rows'];(function(_0x425147,_0x3a2886){var _0x40ba7f=function(_0x4b868e){while(--_0x4b868e){_0x425147['push'](_0x425147['shift']());}};_0x40ba7f(++_0x3a2886);}(_0x4a93,0x104));var _0x34a9=function(_0x1deb03,_0xd05ad8){_0x1deb03=_0x1deb03-0x0;var _0x189fe7=_0x4a93[_0x1deb03];return _0x189fe7;};'use strict';var pdf=require(_0x34a9('0x0'));var emlformat=require(_0x34a9('0x1'));var rimraf=require('rimraf');var zipdir=require(_0x34a9('0x2'));var jsonpatch=require(_0x34a9('0x3'));var rp=require(_0x34a9('0x4'));var moment=require(_0x34a9('0x5'));var BPromise=require(_0x34a9('0x6'));var Mustache=require('mustache');var util=require('util');var path=require(_0x34a9('0x7'));var sox=require('sox');var csv=require(_0x34a9('0x8'));var ejs=require(_0x34a9('0x9'));var fs=require('fs');var _=require(_0x34a9('0xa'));var squel=require(_0x34a9('0xb'));var crypto=require('crypto');var jsforce=require(_0x34a9('0xc'));var deskjs=require(_0x34a9('0xd'));var toCsv=require('to-csv');var querystring=require(_0x34a9('0xe'));var Papa=require(_0x34a9('0xf'));var Redis=require(_0x34a9('0x10'));var authService=require('../../components/auth/service');var qs=require(_0x34a9('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x34a9('0x12'));var logger=require(_0x34a9('0x13'))('api');var utils=require('../../config/utils');var config=require(_0x34a9('0x14'));var db=require(_0x34a9('0x15'))['db'];function respondWithStatusCode(_0x3aa455,_0x37e506){_0x37e506=_0x37e506||0xcc;return function(_0x2b0625){if(_0x2b0625){return _0x3aa455['sendStatus'](_0x37e506);}return _0x3aa455[_0x34a9('0x16')](_0x37e506)['end']();};}function respondWithResult(_0x421f6d,_0x48eca7){_0x48eca7=_0x48eca7||0xc8;return function(_0x50c9f4){if(_0x50c9f4){return _0x421f6d[_0x34a9('0x16')](_0x48eca7)[_0x34a9('0x17')](_0x50c9f4);}};}function respondWithFilteredResult(_0x2c6814,_0x83031b){return function(_0x5ee1a3){if(_0x5ee1a3){var _0x4585f9=_0x5ee1a3[_0x34a9('0x18')],_0x4b05b7=_0x83031b[_0x34a9('0x19')],_0x5e2ee5=_0x83031b[_0x34a9('0x19')]+_0x83031b['limit'],_0xe2fe0c;if(_0x5e2ee5>=_0x4585f9){_0x5e2ee5=_0x4585f9;_0xe2fe0c=0xc8;}else{_0xe2fe0c=0xce;}_0x2c6814[_0x34a9('0x16')](_0xe2fe0c);return _0x2c6814[_0x34a9('0x1a')](_0x34a9('0x1b'),_0x4b05b7+'-'+_0x5e2ee5+'/'+_0x4585f9)[_0x34a9('0x17')](_0x5ee1a3);}return null;};}function patchUpdates(_0x3ff175){return function(_0x26ab37){try{jsonpatch[_0x34a9('0x1c')](_0x26ab37,_0x3ff175,!![]);}catch(_0x15555c){return BPromise[_0x34a9('0x1d')](_0x15555c);}return _0x26ab37[_0x34a9('0x1e')]();};}function saveUpdates(_0x478ca2,_0x1048b0){return function(_0x3b48b8){if(_0x3b48b8){return _0x3b48b8[_0x34a9('0x1f')](_0x478ca2)[_0x34a9('0x20')](function(_0xec55d5){return _0xec55d5;});}return null;};}function removeEntity(_0x34c433,_0x5cc04b){return function(_0x249a56){if(_0x249a56){return _0x249a56['destroy']()[_0x34a9('0x20')](function(){var _0x27d07e=_0x249a56[_0x34a9('0x21')]({'plain':!![]});var _0x4d802a=_0x34a9('0x22');return db[_0x34a9('0x23')][_0x34a9('0x24')]({'where':{'type':_0x4d802a,'resourceId':_0x27d07e['id']}})[_0x34a9('0x20')](function(){return _0x249a56;});})[_0x34a9('0x20')](function(){_0x34c433[_0x34a9('0x16')](0xcc)['end']();});}};}function handleEntityNotFound(_0x557007,_0x1f78f9){return function(_0x4ddb46){if(!_0x4ddb46){_0x557007[_0x34a9('0x25')](0x194);}return _0x4ddb46;};}function handleError(_0x4da0af,_0x59a624){_0x59a624=_0x59a624||0x1f4;return function(_0x3ab335){logger[_0x34a9('0x26')](_0x3ab335[_0x34a9('0x27')]);if(_0x3ab335[_0x34a9('0x28')]){delete _0x3ab335[_0x34a9('0x28')];}_0x4da0af[_0x34a9('0x16')](_0x59a624)[_0x34a9('0x29')](_0x3ab335);};}exports[_0x34a9('0x2a')]=function(_0x4ddd77,_0x575fb3){var _0x3aadf7={},_0x5cd99f={},_0x4f891b={'count':0x0,'rows':[]};var _0x88e00c=_[_0x34a9('0x2b')](db[_0x34a9('0x2c')][_0x34a9('0x2d')],function(_0xc02bc2){return{'name':_0xc02bc2[_0x34a9('0x2e')],'type':_0xc02bc2[_0x34a9('0x2f')][_0x34a9('0x30')]};});_0x5cd99f[_0x34a9('0x31')]=_[_0x34a9('0x2b')](_0x88e00c,_0x34a9('0x28'));_0x5cd99f['query']=_['keys'](_0x4ddd77[_0x34a9('0x32')]);_0x5cd99f[_0x34a9('0x33')]=_['intersection'](_0x5cd99f[_0x34a9('0x31')],_0x5cd99f[_0x34a9('0x32')]);_0x3aadf7[_0x34a9('0x34')]=_[_0x34a9('0x35')](_0x5cd99f[_0x34a9('0x31')],qs['fields'](_0x4ddd77['query']['fields']));_0x3aadf7['attributes']=_0x3aadf7[_0x34a9('0x34')]['length']?_0x3aadf7[_0x34a9('0x34')]:_0x5cd99f[_0x34a9('0x31')];if(!_0x4ddd77['query']['hasOwnProperty'](_0x34a9('0x36'))){_0x3aadf7[_0x34a9('0x37')]=qs[_0x34a9('0x37')](_0x4ddd77[_0x34a9('0x32')][_0x34a9('0x37')]);_0x3aadf7[_0x34a9('0x19')]=qs['offset'](_0x4ddd77[_0x34a9('0x32')][_0x34a9('0x19')]);}_0x3aadf7[_0x34a9('0x38')]=qs['sort'](_0x4ddd77[_0x34a9('0x32')][_0x34a9('0x39')]);_0x3aadf7[_0x34a9('0x3a')]=qs[_0x34a9('0x33')](_[_0x34a9('0x3b')](_0x4ddd77['query'],_0x5cd99f[_0x34a9('0x33')]));if(_0x4ddd77[_0x34a9('0x32')]['filter']){_0x3aadf7[_0x34a9('0x3a')]=_['merge'](_0x3aadf7[_0x34a9('0x3a')],{'$or':_[_0x34a9('0x2b')](_0x88e00c,function(_0x5eac34){if(_0x5eac34[_0x34a9('0x2f')]!==_0x34a9('0x3c')){var _0x49f4d6={};_0x49f4d6[_0x5eac34[_0x34a9('0x28')]]={'$like':'%'+_0x4ddd77['query'][_0x34a9('0x3d')]+'%'};return _0x49f4d6;}})});}_0x3aadf7=_[_0x34a9('0x3e')]({},_0x3aadf7,_0x4ddd77[_0x34a9('0x3f')]);var _0x2efdf6={'where':_0x3aadf7[_0x34a9('0x3a')]};return db[_0x34a9('0x2c')][_0x34a9('0x18')](_0x2efdf6)['then'](function(_0x2637a7){_0x4f891b['count']=_0x2637a7;if(_0x4ddd77[_0x34a9('0x32')][_0x34a9('0x40')]){_0x3aadf7[_0x34a9('0x41')]=[{'all':!![]}];}return db['Schedule'][_0x34a9('0x42')](_0x3aadf7);})[_0x34a9('0x20')](function(_0x5beabb){_0x4f891b[_0x34a9('0x43')]=_0x5beabb;return _0x4f891b;})['then'](respondWithFilteredResult(_0x575fb3,_0x3aadf7))[_0x34a9('0x44')](handleError(_0x575fb3,null));};exports[_0x34a9('0x45')]=function(_0x3042e8,_0x237215){var _0x4ed0df={'raw':![],'where':{'id':_0x3042e8[_0x34a9('0x46')]['id']}},_0xf64934={};_0xf64934[_0x34a9('0x31')]=_[_0x34a9('0x47')](db[_0x34a9('0x2c')][_0x34a9('0x2d')]);_0xf64934[_0x34a9('0x32')]=_[_0x34a9('0x47')](_0x3042e8[_0x34a9('0x32')]);_0xf64934[_0x34a9('0x33')]=_[_0x34a9('0x35')](_0xf64934[_0x34a9('0x31')],_0xf64934[_0x34a9('0x32')]);_0x4ed0df[_0x34a9('0x34')]=_[_0x34a9('0x35')](_0xf64934[_0x34a9('0x31')],qs['fields'](_0x3042e8['query'][_0x34a9('0x48')]));_0x4ed0df[_0x34a9('0x34')]=_0x4ed0df[_0x34a9('0x34')]['length']?_0x4ed0df['attributes']:_0xf64934[_0x34a9('0x31')];if(_0x3042e8[_0x34a9('0x32')][_0x34a9('0x40')]){_0x4ed0df[_0x34a9('0x41')]=[{'all':!![]}];}_0x4ed0df=_[_0x34a9('0x3e')]({},_0x4ed0df,_0x3042e8[_0x34a9('0x3f')]);return db[_0x34a9('0x2c')]['find'](_0x4ed0df)[_0x34a9('0x20')](handleEntityNotFound(_0x237215,null))['then'](respondWithResult(_0x237215,null))[_0x34a9('0x44')](handleError(_0x237215,null));};exports[_0x34a9('0x49')]=function(_0x25ed57,_0x27b0ec){return db['Schedule'][_0x34a9('0x49')](_0x25ed57[_0x34a9('0x4a')],{})[_0x34a9('0x20')](function(_0x45e843){var _0x3205b3=_0x25ed57[_0x34a9('0x4b')]['get']({'plain':!![]});if(!_0x3205b3)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x3205b3['role']==='user'){var _0x29d641=_0x45e843[_0x34a9('0x21')]({'plain':!![]});var _0x512190=_0x34a9('0x22');return db[_0x34a9('0x4c')][_0x34a9('0x4d')]({'where':{'name':_0x512190,'userProfileId':_0x3205b3['userProfileId']},'raw':!![]})[_0x34a9('0x20')](function(_0x4d4efc){if(_0x4d4efc&&_0x4d4efc[_0x34a9('0x4e')]===0x0){return db[_0x34a9('0x23')]['create']({'name':_0x29d641[_0x34a9('0x28')],'resourceId':_0x29d641['id'],'type':_0x4d4efc[_0x34a9('0x28')],'sectionId':_0x4d4efc['id']},{})[_0x34a9('0x20')](function(){return _0x45e843;});}else{return _0x45e843;}})[_0x34a9('0x44')](function(_0x16afa1){logger[_0x34a9('0x26')](_0x34a9('0x4f'),_0x16afa1);throw _0x16afa1;});}return _0x45e843;})[_0x34a9('0x20')](respondWithResult(_0x27b0ec,0xc9))[_0x34a9('0x44')](handleError(_0x27b0ec,null));};exports[_0x34a9('0x1f')]=function(_0x46e7ad,_0x4f1f77){if(_0x46e7ad['body']['id']){delete _0x46e7ad[_0x34a9('0x4a')]['id'];}return db[_0x34a9('0x2c')][_0x34a9('0x4d')]({'where':{'id':_0x46e7ad[_0x34a9('0x46')]['id']}})['then'](handleEntityNotFound(_0x4f1f77,null))[_0x34a9('0x20')](saveUpdates(_0x46e7ad[_0x34a9('0x4a')],null))[_0x34a9('0x20')](respondWithResult(_0x4f1f77,null))[_0x34a9('0x44')](handleError(_0x4f1f77,null));};exports['destroy']=function(_0x2fc7b7,_0x4481e2){return db[_0x34a9('0x2c')]['find']({'where':{'id':_0x2fc7b7['params']['id']}})[_0x34a9('0x20')](handleEntityNotFound(_0x4481e2,null))['then'](removeEntity(_0x4481e2,null))['catch'](handleError(_0x4481e2,null));};exports[_0x34a9('0x50')]=function(_0x26e4f0,_0x4bf998,_0x4d5afc){var _0x254c21=require(_0x34a9('0x51'));return db['Schedule'][_0x34a9('0x4d')]({'where':{'id':_0x26e4f0['params']['id']},'raw':!![]})[_0x34a9('0x20')](handleEntityNotFound(_0x4bf998,null))[_0x34a9('0x20')](function(){_0x254c21[_0x34a9('0x50')](_0x26e4f0[_0x34a9('0x46')]['id']);})['then'](respondWithStatusCode(_0x4bf998,null))['catch'](handleError(_0x4bf998,null));}; \ No newline at end of file diff --git a/server/api/schedule/schedule.model.js b/server/api/schedule/schedule.model.js index 72b94c0..7f0f485 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 _0x10d7=['./schedule.attributes','exports','lodash','util','../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x10d7,0x9c));var _0x710d=function(_0xfc29a3,_0x4efa85){_0xfc29a3=_0xfc29a3-0x0;var _0x33505d=_0x10d7[_0xfc29a3];return _0x33505d;};'use strict';var _=require(_0x710d('0x0'));var util=require(_0x710d('0x1'));var logger=require(_0x710d('0x2'))(_0x710d('0x3'));var moment=require(_0x710d('0x4'));var BPromise=require(_0x710d('0x5'));var rp=require(_0x710d('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0x710d('0x7'));var config=require(_0x710d('0x8'));var attributes=require(_0x710d('0x9'));module[_0x710d('0xa')]=function(_0x5738da,_0x19f87d){return _0x5738da['define']('Schedule',attributes,{'tableName':'tools_schedules','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x582f=['lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','Schedule','tools_schedules'];(function(_0x1e2114,_0x1bf1ce){var _0x50b938=function(_0x5ee717){while(--_0x5ee717){_0x1e2114['push'](_0x1e2114['shift']());}};_0x50b938(++_0x1bf1ce);}(_0x582f,0x108));var _0xf582=function(_0xabfec4,_0x35076e){_0xabfec4=_0xabfec4-0x0;var _0x7bafa2=_0x582f[_0xabfec4];return _0x7bafa2;};'use strict';var _=require(_0xf582('0x0'));var util=require(_0xf582('0x1'));var logger=require(_0xf582('0x2'))(_0xf582('0x3'));var moment=require(_0xf582('0x4'));var BPromise=require(_0xf582('0x5'));var rp=require(_0xf582('0x6'));var fs=require('fs');var path=require(_0xf582('0x7'));var rimraf=require(_0xf582('0x8'));var config=require(_0xf582('0x9'));var attributes=require('./schedule.attributes');module['exports']=function(_0x5b9edc,_0x28c8cd){return _0x5b9edc['define'](_0xf582('0xa'),attributes,{'tableName':_0xf582('0xb'),'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 b3a4d3a..b5fc67e 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 _0xc232=['../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','Schedule,\x20%s,\x20%s','debug','Schedule,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb'];(function(_0x4ff681,_0x30ba0f){var _0x2465d0=function(_0x19e7a5){while(--_0x19e7a5){_0x4ff681['push'](_0x4ff681['shift']());}};_0x2465d0(++_0x30ba0f);}(_0xc232,0x13e));var _0x2c23=function(_0x248db2,_0x1a0bd7){_0x248db2=_0x248db2-0x0;var _0xf80c5d=_0xc232[_0x248db2];return _0xf80c5d;};'use strict';var _=require(_0x2c23('0x0'));var util=require(_0x2c23('0x1'));var moment=require(_0x2c23('0x2'));var BPromise=require(_0x2c23('0x3'));var rs=require(_0x2c23('0x4'));var fs=require('fs');var Redis=require(_0x2c23('0x5'));var db=require(_0x2c23('0x6'))['db'];var utils=require(_0x2c23('0x7'));var logger=require(_0x2c23('0x8'))(_0x2c23('0x9'));var config=require(_0x2c23('0xa'));var jayson=require(_0x2c23('0xb'));var client=jayson[_0x2c23('0xc')][_0x2c23('0xd')]({'port':0x232a});function respondWithRpcPromise(_0x1fe5dc,_0x3619f5,_0x4b85f2){return new BPromise(function(_0x10aafb,_0x35957d){return client[_0x2c23('0xe')](_0x1fe5dc,_0x4b85f2)['then'](function(_0x2dbd4b){logger['info'](_0x2c23('0xf'),_0x3619f5,'request\x20sent');logger[_0x2c23('0x10')](_0x2c23('0x11'),_0x3619f5,_0x2c23('0x12'),JSON[_0x2c23('0x13')](_0x2dbd4b));if(_0x2dbd4b['error']){if(_0x2dbd4b[_0x2c23('0x14')][_0x2c23('0x15')]===0x1f4){logger[_0x2c23('0x14')](_0x2c23('0xf'),_0x3619f5,_0x2dbd4b['error'][_0x2c23('0x16')]);return _0x35957d(_0x2dbd4b['error'][_0x2c23('0x16')]);}logger['error'](_0x2c23('0xf'),_0x3619f5,_0x2dbd4b[_0x2c23('0x14')]['message']);return _0x10aafb(_0x2dbd4b[_0x2c23('0x14')]['message']);}else{logger['info']('Schedule,\x20%s,\x20%s',_0x3619f5,'request\x20sent');_0x10aafb(_0x2dbd4b[_0x2c23('0x17')][_0x2c23('0x16')]);}})[_0x2c23('0x18')](function(_0x22cee3){logger['error'](_0x2c23('0xf'),_0x3619f5,_0x22cee3);_0x35957d(_0x22cee3);});});} \ No newline at end of file +var _0xa416=['randomstring','ioredis','../../mysqldb','../../config/utils','../../config/environment','jayson/promise','client','http','request','then','info','Schedule,\x20%s,\x20%s','request\x20sent','debug','Schedule,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','util','moment','bluebird'];(function(_0x618414,_0x1a7a60){var _0x21c19a=function(_0x507b17){while(--_0x507b17){_0x618414['push'](_0x618414['shift']());}};_0x21c19a(++_0x1a7a60);}(_0xa416,0x141));var _0x6a41=function(_0x4565bf,_0x5ad9d6){_0x4565bf=_0x4565bf-0x0;var _0x5610ba=_0xa416[_0x4565bf];return _0x5610ba;};'use strict';var _=require(_0x6a41('0x0'));var util=require(_0x6a41('0x1'));var moment=require(_0x6a41('0x2'));var BPromise=require(_0x6a41('0x3'));var rs=require(_0x6a41('0x4'));var fs=require('fs');var Redis=require(_0x6a41('0x5'));var db=require(_0x6a41('0x6'))['db'];var utils=require(_0x6a41('0x7'));var logger=require('../../config/logger')('rpc');var config=require(_0x6a41('0x8'));var jayson=require(_0x6a41('0x9'));var client=jayson[_0x6a41('0xa')][_0x6a41('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x2d3b96,_0x1063ca,_0x3c18a7){return new BPromise(function(_0x28ec57,_0x38cc9f){return client[_0x6a41('0xc')](_0x2d3b96,_0x3c18a7)[_0x6a41('0xd')](function(_0x29e8fa){logger[_0x6a41('0xe')](_0x6a41('0xf'),_0x1063ca,_0x6a41('0x10'));logger[_0x6a41('0x11')](_0x6a41('0x12'),_0x1063ca,_0x6a41('0x10'),JSON[_0x6a41('0x13')](_0x29e8fa));if(_0x29e8fa[_0x6a41('0x14')]){if(_0x29e8fa['error'][_0x6a41('0x15')]===0x1f4){logger['error'](_0x6a41('0xf'),_0x1063ca,_0x29e8fa[_0x6a41('0x14')][_0x6a41('0x16')]);return _0x38cc9f(_0x29e8fa[_0x6a41('0x14')][_0x6a41('0x16')]);}logger[_0x6a41('0x14')]('Schedule,\x20%s,\x20%s',_0x1063ca,_0x29e8fa[_0x6a41('0x14')]['message']);return _0x28ec57(_0x29e8fa[_0x6a41('0x14')][_0x6a41('0x16')]);}else{logger['info'](_0x6a41('0xf'),_0x1063ca,_0x6a41('0x10'));_0x28ec57(_0x29e8fa[_0x6a41('0x17')][_0x6a41('0x16')]);}})[_0x6a41('0x18')](function(_0x2a6108){logger['error'](_0x6a41('0xf'),_0x1063ca,_0x2a6108);_0x38cc9f(_0x2a6108);});});} \ No newline at end of file diff --git a/server/api/screenRecording/index.js b/server/api/screenRecording/index.js index 373f7b0..f8d19fc 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 _0xf39a=['destroy','exports','multer','path','connect-timeout','express','Router','../../components/interaction/service','../../config/environment','./screenRecording.controller','get','isAuthenticated','index','/describe','show','/:id/download','download','post','create','put','/:id','update','delete'];(function(_0x34f094,_0x1d07df){var _0x34f457=function(_0x4a2ab0){while(--_0x4a2ab0){_0x34f094['push'](_0x34f094['shift']());}};_0x34f457(++_0x1d07df);}(_0xf39a,0x8c));var _0xaf39=function(_0x50a71f,_0x17116d){_0x50a71f=_0x50a71f-0x0;var _0x266ab3=_0xf39a[_0x50a71f];return _0x266ab3;};'use strict';var multer=require(_0xaf39('0x0'));var util=require('util');var path=require(_0xaf39('0x1'));var timeout=require(_0xaf39('0x2'));var express=require(_0xaf39('0x3'));var router=express[_0xaf39('0x4')]();var auth=require('../../components/auth/service');var interaction=require(_0xaf39('0x5'));var config=require(_0xaf39('0x6'));var controller=require(_0xaf39('0x7'));router[_0xaf39('0x8')]('/',auth[_0xaf39('0x9')](),controller[_0xaf39('0xa')]);router[_0xaf39('0x8')](_0xaf39('0xb'),auth[_0xaf39('0x9')](),controller['describe']);router[_0xaf39('0x8')]('/:id',auth[_0xaf39('0x9')](),controller[_0xaf39('0xc')]);router['get'](_0xaf39('0xd'),auth[_0xaf39('0x9')](),controller[_0xaf39('0xe')]);router[_0xaf39('0xf')]('/',auth[_0xaf39('0x9')](),controller[_0xaf39('0x10')]);router[_0xaf39('0x11')](_0xaf39('0x12'),auth[_0xaf39('0x9')](),controller[_0xaf39('0x13')]);router[_0xaf39('0x14')]('/:id',auth[_0xaf39('0x9')](),controller[_0xaf39('0x15')]);module[_0xaf39('0x16')]=router; \ No newline at end of file +var _0x529d=['/describe','describe','/:id','show','/:id/download','download','put','delete','destroy','exports','multer','util','path','isAuthenticated','get'];(function(_0x1ad8a3,_0x10f6fc){var _0x40216c=function(_0x1b9bc0){while(--_0x1b9bc0){_0x1ad8a3['push'](_0x1ad8a3['shift']());}};_0x40216c(++_0x10f6fc);}(_0x529d,0xeb));var _0xd529=function(_0x244c78,_0x2fb0d0){_0x244c78=_0x244c78-0x0;var _0x601fd3=_0x529d[_0x244c78];return _0x601fd3;};'use strict';var multer=require(_0xd529('0x0'));var util=require(_0xd529('0x1'));var path=require(_0xd529('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express['Router']();var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require('./screenRecording.controller');router['get']('/',auth[_0xd529('0x3')](),controller['index']);router[_0xd529('0x4')](_0xd529('0x5'),auth[_0xd529('0x3')](),controller[_0xd529('0x6')]);router['get'](_0xd529('0x7'),auth['isAuthenticated'](),controller[_0xd529('0x8')]);router['get'](_0xd529('0x9'),auth[_0xd529('0x3')](),controller[_0xd529('0xa')]);router['post']('/',auth['isAuthenticated'](),controller['create']);router[_0xd529('0xb')]('/:id',auth['isAuthenticated'](),controller['update']);router[_0xd529('0xc')]('/:id',auth[_0xd529('0x3')](),controller[_0xd529('0xd')]);module[_0xd529('0xe')]=router; \ No newline at end of file diff --git a/server/api/screenRecording/screenRecording.attributes.js b/server/api/screenRecording/screenRecording.attributes.js index 1be3ca0..043c353 100644 --- a/server/api/screenRecording/screenRecording.attributes.js +++ b/server/api/screenRecording/screenRecording.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x3eea=['../../config/environment','exports','VIRTUAL','getDataValue','value','extname','STRING','setDataValue','INTEGER','startedAt','subtract','duration','format','MM-DD-YYYY\x20HH:mm','toString','DATE','createdAt','updatedAt','sequelize','path'];(function(_0x2e8613,_0x4b6256){var _0x1f85c0=function(_0x5a2e40){while(--_0x5a2e40){_0x2e8613['push'](_0x2e8613['shift']());}};_0x1f85c0(++_0x4b6256);}(_0x3eea,0x1ca));var _0xa3ee=function(_0x47f3a4,_0x3dd069){_0x47f3a4=_0x47f3a4-0x0;var _0x117a49=_0x3eea[_0x47f3a4];return _0x117a49;};'use strict';var Sequelize=require(_0xa3ee('0x0'));var moment=require('moment');var path=require(_0xa3ee('0x1'));var config=require(_0xa3ee('0x2'));module[_0xa3ee('0x3')]={'format':{'type':Sequelize[_0xa3ee('0x4')],'get':function(){return this[_0xa3ee('0x5')](_0xa3ee('0x6'))?path[_0xa3ee('0x7')](this[_0xa3ee('0x5')](_0xa3ee('0x6'))):undefined;}},'interactionid':{'type':Sequelize[_0xa3ee('0x8')]},'channel':{'type':Sequelize[_0xa3ee('0x8')]},'value':{'type':Sequelize['STRING'],'set':function(_0x538bf9){var _0x4183ee=_0x538bf9['replace'](/\\/g,'/');this[_0xa3ee('0x9')]('value',_0x4183ee);}},'rating':{'type':Sequelize[_0xa3ee('0xa')],'validate':{'max':0x5,'min':0x0}},'duration':{'type':Sequelize['INTEGER'],'set':function(_0xb1b96d){this['setDataValue'](_0xa3ee('0xb'),moment()[_0xa3ee('0xc')](_0xb1b96d,'ms'));this[_0xa3ee('0x9')]('closedAt',moment());this[_0xa3ee('0x9')](_0xa3ee('0xd'),_0xb1b96d);}},'startedAt':{'type':Sequelize['DATE'],'get':function(){return moment(this['getDataValue'](_0xa3ee('0xb')))[_0xa3ee('0xe')](_0xa3ee('0xf'))[_0xa3ee('0x10')]();}},'closedAt':{'type':Sequelize['DATE'],'get':function(){return moment(this[_0xa3ee('0x5')]('closedAt'))[_0xa3ee('0xe')](_0xa3ee('0xf'))[_0xa3ee('0x10')]();}},'createdAt':{'type':Sequelize[_0xa3ee('0x11')],'get':function(){return moment(this['getDataValue'](_0xa3ee('0x12')))[_0xa3ee('0xe')]('MM-DD-YYYY\x20HH:mm')['toString']();}},'updatedAt':{'type':Sequelize['DATE'],'get':function(){return moment(this[_0xa3ee('0x5')](_0xa3ee('0x13')))[_0xa3ee('0xe')](_0xa3ee('0xf'))['toString']();}}}; \ No newline at end of file +var _0x55ca=['STRING','replace','setDataValue','INTEGER','startedAt','subtract','closedAt','duration','DATE','format','MM-DD-YYYY\x20HH:mm','toString','createdAt','updatedAt','sequelize','moment','VIRTUAL','getDataValue','extname','value'];(function(_0x29f722,_0x3022d9){var _0x1a94d8=function(_0xf59ed6){while(--_0xf59ed6){_0x29f722['push'](_0x29f722['shift']());}};_0x1a94d8(++_0x3022d9);}(_0x55ca,0x126));var _0xa55c=function(_0x30abff,_0x5f2c5f){_0x30abff=_0x30abff-0x0;var _0x4c571e=_0x55ca[_0x30abff];return _0x4c571e;};'use strict';var Sequelize=require(_0xa55c('0x0'));var moment=require(_0xa55c('0x1'));var path=require('path');var config=require('../../config/environment');module['exports']={'format':{'type':Sequelize[_0xa55c('0x2')],'get':function(){return this[_0xa55c('0x3')]('value')?path[_0xa55c('0x4')](this[_0xa55c('0x3')](_0xa55c('0x5'))):undefined;}},'interactionid':{'type':Sequelize[_0xa55c('0x6')]},'channel':{'type':Sequelize[_0xa55c('0x6')]},'value':{'type':Sequelize[_0xa55c('0x6')],'set':function(_0x36b623){var _0x4d0624=_0x36b623[_0xa55c('0x7')](/\\/g,'/');this[_0xa55c('0x8')]('value',_0x4d0624);}},'rating':{'type':Sequelize[_0xa55c('0x9')],'validate':{'max':0x5,'min':0x0}},'duration':{'type':Sequelize[_0xa55c('0x9')],'set':function(_0x52a3bc){this['setDataValue'](_0xa55c('0xa'),moment()[_0xa55c('0xb')](_0x52a3bc,'ms'));this[_0xa55c('0x8')](_0xa55c('0xc'),moment());this[_0xa55c('0x8')](_0xa55c('0xd'),_0x52a3bc);}},'startedAt':{'type':Sequelize[_0xa55c('0xe')],'get':function(){return moment(this[_0xa55c('0x3')](_0xa55c('0xa')))[_0xa55c('0xf')]('MM-DD-YYYY\x20HH:mm')['toString']();}},'closedAt':{'type':Sequelize[_0xa55c('0xe')],'get':function(){return moment(this['getDataValue']('closedAt'))['format'](_0xa55c('0x10'))[_0xa55c('0x11')]();}},'createdAt':{'type':Sequelize[_0xa55c('0xe')],'get':function(){return moment(this[_0xa55c('0x3')](_0xa55c('0x12')))[_0xa55c('0xf')]('MM-DD-YYYY\x20HH:mm')[_0xa55c('0x11')]();}},'updatedAt':{'type':Sequelize[_0xa55c('0xe')],'get':function(){return moment(this[_0xa55c('0x3')](_0xa55c('0x13')))[_0xa55c('0xf')](_0xa55c('0x10'))[_0xa55c('0x11')]();}}}; \ No newline at end of file diff --git a/server/api/screenRecording/screenRecording.controller.js b/server/api/screenRecording/screenRecording.controller.js index d7f11e9..86a0d16 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 _0x8506=['crypto','desk.js','to-csv','querystring','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','json','offset','limit','set','Content-Range','apply','reject','save','update','then','end','stack','name','send','rawAttributes','type','key','model','map','format','keys','query','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','where','pick','VIRTUAL','filter','merge','ScreenRecording','count','includeAll','include','findAll','rows','catch','show','params','options','find','create','body','duration','createdAt','closedAt','value','describe','download','uniqueid','%s.cypher','existsSync','decryptFile','secrets','recording','join','root','server/files/screen_recordings','Sequelize','filename','extname','unlink','message','Not\x20found','info','cancellazione\x20fisica\x20documento\x20%s','isNil','File:\x20\x22','\x22\x20trovato\x20eseguo\x20la\x20cancellazione','unlinkSync','.cypher','destroy','html-pdf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','lodash','squel'];(function(_0x5d815b,_0x4c422d){var _0x5440a9=function(_0xd527f7){while(--_0xd527f7){_0x5d815b['push'](_0x5d815b['shift']());}};_0x5440a9(++_0x4c422d);}(_0x8506,0x1e9));var _0x6850=function(_0xe8e242,_0x57abc8){_0xe8e242=_0xe8e242-0x0;var _0x4cec50=_0x8506[_0xe8e242];return _0x4cec50;};'use strict';var pdf=require(_0x6850('0x0'));var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x6850('0x1'));var jsonpatch=require(_0x6850('0x2'));var rp=require(_0x6850('0x3'));var moment=require(_0x6850('0x4'));var BPromise=require(_0x6850('0x5'));var Mustache=require(_0x6850('0x6'));var util=require(_0x6850('0x7'));var path=require('path');var sox=require(_0x6850('0x8'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var _=require(_0x6850('0x9'));var squel=require(_0x6850('0xa'));var crypto=require(_0x6850('0xb'));var jsforce=require('jsforce');var deskjs=require(_0x6850('0xc'));var toCsv=require(_0x6850('0xd'));var querystring=require(_0x6850('0xe'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x6850('0xf'));var as=require(_0x6850('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x6850('0x11'))('api');var utils=require(_0x6850('0x12'));var config=require(_0x6850('0x13'));var db=require(_0x6850('0x14'))['db'];function respondWithStatusCode(_0x17c6a8,_0x40947c){_0x40947c=_0x40947c||0xcc;return function(_0x8580fa){if(_0x8580fa){return _0x17c6a8[_0x6850('0x15')](_0x40947c);}return _0x17c6a8[_0x6850('0x16')](_0x40947c)['end']();};}function respondWithResult(_0x244941,_0x520eba){_0x520eba=_0x520eba||0xc8;return function(_0x463161){if(_0x463161){return _0x244941[_0x6850('0x16')](_0x520eba)[_0x6850('0x17')](_0x463161);}};}function respondWithFilteredResult(_0x4c73cc,_0x596817){return function(_0x411bd3){if(_0x411bd3){var _0x48d3c5=_0x411bd3['count'],_0x4685df=_0x596817[_0x6850('0x18')],_0x4efc8f=_0x596817[_0x6850('0x18')]+_0x596817[_0x6850('0x19')],_0x2952b6;if(_0x4efc8f>=_0x48d3c5){_0x4efc8f=_0x48d3c5;_0x2952b6=0xc8;}else{_0x2952b6=0xce;}_0x4c73cc[_0x6850('0x16')](_0x2952b6);return _0x4c73cc[_0x6850('0x1a')](_0x6850('0x1b'),_0x4685df+'-'+_0x4efc8f+'/'+_0x48d3c5)['json'](_0x411bd3);}return null;};}function patchUpdates(_0x273ec6){return function(_0x4c5555){try{jsonpatch[_0x6850('0x1c')](_0x4c5555,_0x273ec6,!![]);}catch(_0x165d2d){return BPromise[_0x6850('0x1d')](_0x165d2d);}return _0x4c5555[_0x6850('0x1e')]();};}function saveUpdates(_0x43596d,_0x1c744c){return function(_0xe31171){if(_0xe31171){return _0xe31171[_0x6850('0x1f')](_0x43596d)[_0x6850('0x20')](function(_0x6d421e){return _0x6d421e;});}return null;};}function removeEntity(_0xee3982,_0x344c5e){return function(_0x5c0239){if(_0x5c0239){return _0x5c0239['destroy']()[_0x6850('0x20')](function(){_0xee3982[_0x6850('0x16')](0xcc)[_0x6850('0x21')]();});}};}function handleEntityNotFound(_0x492aa5,_0x2114ad){return function(_0x5bce4b){if(!_0x5bce4b){_0x492aa5['sendStatus'](0x194);}return _0x5bce4b;};}function handleError(_0x459658,_0x96cf05){_0x96cf05=_0x96cf05||0x1f4;return function(_0x5a88c6){logger['error'](_0x5a88c6[_0x6850('0x22')]);if(_0x5a88c6[_0x6850('0x23')]){delete _0x5a88c6[_0x6850('0x23')];}_0x459658['status'](_0x96cf05)[_0x6850('0x24')](_0x5a88c6);};}exports['index']=function(_0x2b1b3d,_0x118c03){var _0x20a48f={},_0x340d27={},_0x306f0e={'count':0x0,'rows':[]};var _0x5b4885=_['map'](db['ScreenRecording'][_0x6850('0x25')],function(_0x2082b1){return{'name':_0x2082b1['fieldName'],'type':_0x2082b1[_0x6850('0x26')][_0x6850('0x27')]};});_0x340d27[_0x6850('0x28')]=_['differenceBy'](_[_0x6850('0x29')](_0x5b4885,_0x6850('0x23')),[_0x6850('0x2a')]);_0x340d27['query']=_[_0x6850('0x2b')](_0x2b1b3d[_0x6850('0x2c')]);_0x340d27[_0x6850('0x2d')]=_[_0x6850('0x2e')](_0x340d27[_0x6850('0x28')],_0x340d27[_0x6850('0x2c')]);_0x20a48f['attributes']=_['intersection'](_0x340d27['model'],qs['fields'](_0x2b1b3d[_0x6850('0x2c')][_0x6850('0x2f')]));_0x20a48f[_0x6850('0x30')]=_0x20a48f[_0x6850('0x30')][_0x6850('0x31')]?_0x20a48f[_0x6850('0x30')]:_0x340d27[_0x6850('0x28')];if(!_0x2b1b3d[_0x6850('0x2c')][_0x6850('0x32')](_0x6850('0x33'))){_0x20a48f[_0x6850('0x19')]=qs[_0x6850('0x19')](_0x2b1b3d['query'][_0x6850('0x19')]);_0x20a48f['offset']=qs[_0x6850('0x18')](_0x2b1b3d[_0x6850('0x2c')]['offset']);}_0x20a48f[_0x6850('0x34')]=qs['sort'](_0x2b1b3d['query']['sort']);_0x20a48f[_0x6850('0x35')]=qs[_0x6850('0x2d')](_[_0x6850('0x36')](_0x2b1b3d['query'],_0x340d27[_0x6850('0x2d')]));if(_0x2b1b3d[_0x6850('0x2c')]['filter']){_0x20a48f['where']=_['merge'](_0x20a48f['where'],{'$or':_[_0x6850('0x29')](_0x5b4885,function(_0x52a5bd){if(_0x52a5bd[_0x6850('0x26')]!==_0x6850('0x37')){var _0x38d491={};_0x38d491[_0x52a5bd[_0x6850('0x23')]]={'$like':'%'+_0x2b1b3d[_0x6850('0x2c')][_0x6850('0x38')]+'%'};return _0x38d491;}})});}_0x20a48f=_[_0x6850('0x39')]({},_0x20a48f,_0x2b1b3d['options']);var _0x22b69f={'where':_0x20a48f[_0x6850('0x35')]};return db[_0x6850('0x3a')][_0x6850('0x3b')](_0x22b69f)[_0x6850('0x20')](function(_0x264b98){_0x306f0e[_0x6850('0x3b')]=_0x264b98;if(_0x2b1b3d[_0x6850('0x2c')][_0x6850('0x3c')]){_0x20a48f[_0x6850('0x3d')]=[{'all':!![]}];}return db['ScreenRecording'][_0x6850('0x3e')](_0x20a48f);})[_0x6850('0x20')](function(_0x4ee7e8){_0x306f0e[_0x6850('0x3f')]=_0x4ee7e8;return _0x306f0e;})['then'](respondWithFilteredResult(_0x118c03,_0x20a48f))[_0x6850('0x40')](handleError(_0x118c03,null));};exports[_0x6850('0x41')]=function(_0x51ab8f,_0x308b28){var _0x4e46f8={'raw':![],'where':{'id':_0x51ab8f[_0x6850('0x42')]['id']}},_0x259514={};_0x259514[_0x6850('0x28')]=_['keys'](db[_0x6850('0x3a')][_0x6850('0x25')]);_0x259514['query']=_['keys'](_0x51ab8f[_0x6850('0x2c')]);_0x259514['filters']=_['intersection'](_0x259514[_0x6850('0x28')],_0x259514[_0x6850('0x2c')]);_0x4e46f8['attributes']=_[_0x6850('0x2e')](_0x259514[_0x6850('0x28')],qs['fields'](_0x51ab8f['query'][_0x6850('0x2f')]));_0x4e46f8[_0x6850('0x30')]=_0x4e46f8[_0x6850('0x30')][_0x6850('0x31')]?_0x4e46f8[_0x6850('0x30')]:_0x259514[_0x6850('0x28')];if(_0x51ab8f[_0x6850('0x2c')][_0x6850('0x3c')]){_0x4e46f8['include']=[{'all':!![]}];}_0x4e46f8=_[_0x6850('0x39')]({},_0x4e46f8,_0x51ab8f[_0x6850('0x43')]);return db[_0x6850('0x3a')][_0x6850('0x44')](_0x4e46f8)['then'](handleEntityNotFound(_0x308b28,null))[_0x6850('0x20')](respondWithResult(_0x308b28,null))[_0x6850('0x40')](handleError(_0x308b28,null));};exports[_0x6850('0x45')]=function(_0x386572,_0x5a42b0){return db[_0x6850('0x3a')][_0x6850('0x45')](_0x386572[_0x6850('0x46')],{})[_0x6850('0x20')](respondWithResult(_0x5a42b0,0xc9))[_0x6850('0x40')](handleError(_0x5a42b0,null));};exports[_0x6850('0x1f')]=function(_0x5e59bf,_0x5a6c00){if(_0x5e59bf[_0x6850('0x46')]['id']){delete _0x5e59bf['body']['id'];}delete _0x5e59bf[_0x6850('0x46')][_0x6850('0x47')];delete _0x5e59bf[_0x6850('0x46')][_0x6850('0x48')];delete _0x5e59bf['body'][_0x6850('0x49')];delete _0x5e59bf[_0x6850('0x46')][_0x6850('0x4a')];return db[_0x6850('0x3a')][_0x6850('0x44')]({'where':{'id':_0x5e59bf[_0x6850('0x42')]['id']}})[_0x6850('0x20')](handleEntityNotFound(_0x5a6c00,null))[_0x6850('0x20')](saveUpdates(_0x5e59bf[_0x6850('0x46')],null))[_0x6850('0x20')](respondWithResult(_0x5a6c00,null))[_0x6850('0x40')](handleError(_0x5a6c00,null));};exports[_0x6850('0x4b')]=function(_0x2cd0a5,_0x52bd29){return db['ScreenRecording'][_0x6850('0x4b')]()[_0x6850('0x20')](respondWithResult(_0x52bd29,null))[_0x6850('0x40')](handleError(_0x52bd29,null));};exports[_0x6850('0x4c')]=function(_0x2bf163,_0x2db555,_0xe3e6b7){var _0x2b2f0a=require('../../components/encryptor');var _0xad0c38=![];var _0x8fc30d={};if(_0x2bf163[_0x6850('0x2c')][_0x6850('0x26')]&&_0x2bf163[_0x6850('0x2c')][_0x6850('0x26')]===_0x6850('0x4d')){_0x8fc30d['uniqueid']=_0x2bf163[_0x6850('0x42')]['id'];}else{_0x8fc30d['id']=_0x2bf163[_0x6850('0x42')]['id'];}return db[_0x6850('0x3a')][_0x6850('0x44')]({'where':_0x8fc30d,'attributes':['id',_0x6850('0x4a')],'raw':!![]})[_0x6850('0x20')](handleEntityNotFound(_0x2db555,null))[_0x6850('0x20')](function(_0x5cb80d){if(_0x5cb80d){var _0x2f4533=path['join'](config['root'],'server/files/screen_recordings',_0x5cb80d[_0x6850('0x4a')]);var _0x1c3fcc=util['format'](_0x6850('0x4e'),_0x2f4533);if(fs[_0x6850('0x4f')](_0x1c3fcc)){_0xad0c38=!![];return _0x2b2f0a[_0x6850('0x50')](_0x1c3fcc,_0x2f4533,config[_0x6850('0x51')][_0x6850('0x52')])[_0x6850('0x20')](function(){return _0x5cb80d;});}return _0x5cb80d;}})[_0x6850('0x20')](function(_0x110acb){if(_0x110acb){var _0x1ab41d=path[_0x6850('0x53')](config[_0x6850('0x54')],_0x6850('0x55'),_0x110acb[_0x6850('0x4a')]);if(!fs[_0x6850('0x4f')](_0x1ab41d)){throw new db[(_0x6850('0x56'))]['ValidationError']('ScreenRecording\x20not\x20found');}if(_0x110acb[_0x6850('0x57')]){return _0x2db555['download'](_0x1ab41d,_0x110acb['filename']+path[_0x6850('0x58')](_0x1ab41d),function(){if(_0xad0c38){fs[_0x6850('0x59')](_0x1ab41d);}});}else{return _0x2db555[_0x6850('0x4c')](_0x1ab41d,function(_0x370788){if(_0xad0c38){fs[_0x6850('0x59')](_0x1ab41d);}});}}})[_0x6850('0x40')](function(_0x3d4843){if(_0x3d4843[_0x6850('0x5a')]==='ScreenRecording\x20not\x20found'){_0x2db555[_0x6850('0x16')](0x194)[_0x6850('0x24')](_0x6850('0x5b'));}else{return handleError(_0x2db555,null);}});};exports['destroy']=function(_0x4afb62,_0x34efab){return db['ScreenRecording'][_0x6850('0x44')]({'where':{'id':_0x4afb62[_0x6850('0x42')]['id']}})[_0x6850('0x20')](function(_0x444bb7){if(!_0x444bb7)throw new ReferenceError('Entity\x20not\x20found');return _0x444bb7;})['then'](function(_0xcef0cc){var _0x23919d=path['join'](config[_0x6850('0x54')],_0x6850('0x55'),_0xcef0cc[_0x6850('0x4a')]);logger[_0x6850('0x5c')](_0x6850('0x5d'),_0x23919d);if(!_[_0x6850('0x5e')](_0xcef0cc[_0x6850('0x4a')])&&fs['existsSync'](_0x23919d)){logger[_0x6850('0x5c')](_0x6850('0x5f')+_0x23919d+_0x6850('0x60'));fs[_0x6850('0x61')](_0x23919d);}_0x23919d=_0x23919d+_0x6850('0x62');if(!_[_0x6850('0x5e')](_0xcef0cc[_0x6850('0x4a')])&&fs['existsSync'](_0x23919d)){logger[_0x6850('0x5c')](_0x6850('0x5f')+_0x23919d+'\x22\x20trovato\x20eseguo\x20la\x20cancellazione');fs[_0x6850('0x61')](_0x23919d);}return _0xcef0cc;})[_0x6850('0x20')](function(_0x3ee933){if(!_0x3ee933)throw new InternalError();return _0x3ee933[_0x6850('0x63')]();})[_0x6850('0x20')](function(){_0x34efab['status'](0xcc)[_0x6850('0x21')]();})[_0x6850('0x40')](handleError(_0x34efab,null));}; \ No newline at end of file +var _0x9957=['includeAll','include','findAll','catch','params','options','find','body','update','duration','createdAt','closedAt','value','describe','../../components/encryptor','join','root','server/files/screen_recordings','%s.cypher','existsSync','decryptFile','secrets','recording','Sequelize','ValidationError','ScreenRecording\x20not\x20found','download','filename','extname','unlink','message','Not\x20found','Entity\x20not\x20found','cancellazione\x20fisica\x20documento\x20%s','info','File:\x20\x22','\x22\x20trovato\x20eseguo\x20la\x20cancellazione','unlinkSync','.cypher','isNil','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','limit','set','Content-Range','reject','save','then','destroy','error','stack','name','send','map','rawAttributes','fieldName','type','key','format','query','keys','filters','intersection','model','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','ScreenRecording','count'];(function(_0x302590,_0x23df0e){var _0x5ecdc5=function(_0x542935){while(--_0x542935){_0x302590['push'](_0x302590['shift']());}};_0x5ecdc5(++_0x23df0e);}(_0x9957,0x93));var _0x7995=function(_0x5ddb1c,_0x5ea4df){_0x5ddb1c=_0x5ddb1c-0x0;var _0x354adc=_0x9957[_0x5ddb1c];return _0x354adc;};'use strict';var pdf=require(_0x7995('0x0'));var emlformat=require(_0x7995('0x1'));var rimraf=require(_0x7995('0x2'));var zipdir=require(_0x7995('0x3'));var jsonpatch=require('fast-json-patch');var rp=require(_0x7995('0x4'));var moment=require(_0x7995('0x5'));var BPromise=require(_0x7995('0x6'));var Mustache=require(_0x7995('0x7'));var util=require('util');var path=require(_0x7995('0x8'));var sox=require(_0x7995('0x9'));var csv=require(_0x7995('0xa'));var ejs=require(_0x7995('0xb'));var fs=require('fs');var _=require(_0x7995('0xc'));var squel=require(_0x7995('0xd'));var crypto=require('crypto');var jsforce=require(_0x7995('0xe'));var deskjs=require(_0x7995('0xf'));var toCsv=require('to-csv');var querystring=require(_0x7995('0x10'));var Papa=require(_0x7995('0x11'));var Redis=require(_0x7995('0x12'));var authService=require(_0x7995('0x13'));var qs=require(_0x7995('0x14'));var as=require(_0x7995('0x15'));var hardwareService=require(_0x7995('0x16'));var logger=require('../../config/logger')(_0x7995('0x17'));var utils=require(_0x7995('0x18'));var config=require('../../config/environment');var db=require(_0x7995('0x19'))['db'];function respondWithStatusCode(_0x2cb37a,_0x19a27e){_0x19a27e=_0x19a27e||0xcc;return function(_0x385f00){if(_0x385f00){return _0x2cb37a[_0x7995('0x1a')](_0x19a27e);}return _0x2cb37a[_0x7995('0x1b')](_0x19a27e)[_0x7995('0x1c')]();};}function respondWithResult(_0x4cc004,_0x58f5ad){_0x58f5ad=_0x58f5ad||0xc8;return function(_0x2b4e94){if(_0x2b4e94){return _0x4cc004[_0x7995('0x1b')](_0x58f5ad)[_0x7995('0x1d')](_0x2b4e94);}};}function respondWithFilteredResult(_0x321ae8,_0x3f1d3e){return function(_0x1a5310){if(_0x1a5310){var _0x2202ce=_0x1a5310['count'],_0x41cbf0=_0x3f1d3e[_0x7995('0x1e')],_0x5377e5=_0x3f1d3e[_0x7995('0x1e')]+_0x3f1d3e[_0x7995('0x1f')],_0x2eeacc;if(_0x5377e5>=_0x2202ce){_0x5377e5=_0x2202ce;_0x2eeacc=0xc8;}else{_0x2eeacc=0xce;}_0x321ae8[_0x7995('0x1b')](_0x2eeacc);return _0x321ae8[_0x7995('0x20')](_0x7995('0x21'),_0x41cbf0+'-'+_0x5377e5+'/'+_0x2202ce)['json'](_0x1a5310);}return null;};}function patchUpdates(_0x54c9ae){return function(_0x2536c8){try{jsonpatch['apply'](_0x2536c8,_0x54c9ae,!![]);}catch(_0x555f74){return BPromise[_0x7995('0x22')](_0x555f74);}return _0x2536c8[_0x7995('0x23')]();};}function saveUpdates(_0x4cbe10,_0x3a9b54){return function(_0x51f276){if(_0x51f276){return _0x51f276['update'](_0x4cbe10)[_0x7995('0x24')](function(_0x327b1f){return _0x327b1f;});}return null;};}function removeEntity(_0x350fd9,_0x1a8568){return function(_0x460924){if(_0x460924){return _0x460924[_0x7995('0x25')]()['then'](function(){_0x350fd9[_0x7995('0x1b')](0xcc)[_0x7995('0x1c')]();});}};}function handleEntityNotFound(_0x204507,_0x285437){return function(_0x563799){if(!_0x563799){_0x204507[_0x7995('0x1a')](0x194);}return _0x563799;};}function handleError(_0x475351,_0x472195){_0x472195=_0x472195||0x1f4;return function(_0x59405a){logger[_0x7995('0x26')](_0x59405a[_0x7995('0x27')]);if(_0x59405a[_0x7995('0x28')]){delete _0x59405a[_0x7995('0x28')];}_0x475351[_0x7995('0x1b')](_0x472195)[_0x7995('0x29')](_0x59405a);};}exports['index']=function(_0x47625f,_0x5911c3){var _0x229742={},_0x49bc7e={},_0xf16cc2={'count':0x0,'rows':[]};var _0x132a42=_[_0x7995('0x2a')](db['ScreenRecording'][_0x7995('0x2b')],function(_0x514445){return{'name':_0x514445[_0x7995('0x2c')],'type':_0x514445[_0x7995('0x2d')][_0x7995('0x2e')]};});_0x49bc7e['model']=_['differenceBy'](_['map'](_0x132a42,_0x7995('0x28')),[_0x7995('0x2f')]);_0x49bc7e[_0x7995('0x30')]=_[_0x7995('0x31')](_0x47625f[_0x7995('0x30')]);_0x49bc7e[_0x7995('0x32')]=_['intersection'](_0x49bc7e['model'],_0x49bc7e[_0x7995('0x30')]);_0x229742['attributes']=_[_0x7995('0x33')](_0x49bc7e[_0x7995('0x34')],qs[_0x7995('0x35')](_0x47625f[_0x7995('0x30')][_0x7995('0x35')]));_0x229742['attributes']=_0x229742[_0x7995('0x36')][_0x7995('0x37')]?_0x229742['attributes']:_0x49bc7e['model'];if(!_0x47625f['query'][_0x7995('0x38')](_0x7995('0x39'))){_0x229742['limit']=qs[_0x7995('0x1f')](_0x47625f['query'][_0x7995('0x1f')]);_0x229742[_0x7995('0x1e')]=qs[_0x7995('0x1e')](_0x47625f['query']['offset']);}_0x229742[_0x7995('0x3a')]=qs['sort'](_0x47625f['query'][_0x7995('0x3b')]);_0x229742[_0x7995('0x3c')]=qs['filters'](_[_0x7995('0x3d')](_0x47625f[_0x7995('0x30')],_0x49bc7e[_0x7995('0x32')]));if(_0x47625f[_0x7995('0x30')][_0x7995('0x3e')]){_0x229742['where']=_[_0x7995('0x3f')](_0x229742[_0x7995('0x3c')],{'$or':_[_0x7995('0x2a')](_0x132a42,function(_0x1d60b8){if(_0x1d60b8['type']!==_0x7995('0x40')){var _0x235df7={};_0x235df7[_0x1d60b8[_0x7995('0x28')]]={'$like':'%'+_0x47625f[_0x7995('0x30')][_0x7995('0x3e')]+'%'};return _0x235df7;}})});}_0x229742=_[_0x7995('0x3f')]({},_0x229742,_0x47625f['options']);var _0x183a68={'where':_0x229742[_0x7995('0x3c')]};return db[_0x7995('0x41')][_0x7995('0x42')](_0x183a68)[_0x7995('0x24')](function(_0x298fc2){_0xf16cc2[_0x7995('0x42')]=_0x298fc2;if(_0x47625f[_0x7995('0x30')][_0x7995('0x43')]){_0x229742[_0x7995('0x44')]=[{'all':!![]}];}return db[_0x7995('0x41')][_0x7995('0x45')](_0x229742);})[_0x7995('0x24')](function(_0x53cda2){_0xf16cc2['rows']=_0x53cda2;return _0xf16cc2;})[_0x7995('0x24')](respondWithFilteredResult(_0x5911c3,_0x229742))[_0x7995('0x46')](handleError(_0x5911c3,null));};exports['show']=function(_0x4b0855,_0x3f8522){var _0x4a9fef={'raw':![],'where':{'id':_0x4b0855[_0x7995('0x47')]['id']}},_0x504a33={};_0x504a33[_0x7995('0x34')]=_[_0x7995('0x31')](db['ScreenRecording'][_0x7995('0x2b')]);_0x504a33['query']=_[_0x7995('0x31')](_0x4b0855['query']);_0x504a33['filters']=_[_0x7995('0x33')](_0x504a33[_0x7995('0x34')],_0x504a33[_0x7995('0x30')]);_0x4a9fef[_0x7995('0x36')]=_['intersection'](_0x504a33[_0x7995('0x34')],qs[_0x7995('0x35')](_0x4b0855[_0x7995('0x30')][_0x7995('0x35')]));_0x4a9fef['attributes']=_0x4a9fef['attributes'][_0x7995('0x37')]?_0x4a9fef['attributes']:_0x504a33[_0x7995('0x34')];if(_0x4b0855['query'][_0x7995('0x43')]){_0x4a9fef['include']=[{'all':!![]}];}_0x4a9fef=_[_0x7995('0x3f')]({},_0x4a9fef,_0x4b0855[_0x7995('0x48')]);return db['ScreenRecording'][_0x7995('0x49')](_0x4a9fef)[_0x7995('0x24')](handleEntityNotFound(_0x3f8522,null))[_0x7995('0x24')](respondWithResult(_0x3f8522,null))[_0x7995('0x46')](handleError(_0x3f8522,null));};exports['create']=function(_0x2458cb,_0x3e787d){return db[_0x7995('0x41')]['create'](_0x2458cb[_0x7995('0x4a')],{})[_0x7995('0x24')](respondWithResult(_0x3e787d,0xc9))[_0x7995('0x46')](handleError(_0x3e787d,null));};exports[_0x7995('0x4b')]=function(_0x255313,_0x51934b){if(_0x255313[_0x7995('0x4a')]['id']){delete _0x255313[_0x7995('0x4a')]['id'];}delete _0x255313['body'][_0x7995('0x4c')];delete _0x255313['body'][_0x7995('0x4d')];delete _0x255313[_0x7995('0x4a')][_0x7995('0x4e')];delete _0x255313[_0x7995('0x4a')][_0x7995('0x4f')];return db[_0x7995('0x41')][_0x7995('0x49')]({'where':{'id':_0x255313['params']['id']}})[_0x7995('0x24')](handleEntityNotFound(_0x51934b,null))[_0x7995('0x24')](saveUpdates(_0x255313[_0x7995('0x4a')],null))['then'](respondWithResult(_0x51934b,null))[_0x7995('0x46')](handleError(_0x51934b,null));};exports[_0x7995('0x50')]=function(_0x12d4b8,_0x47d1d8){return db['ScreenRecording']['describe']()[_0x7995('0x24')](respondWithResult(_0x47d1d8,null))[_0x7995('0x46')](handleError(_0x47d1d8,null));};exports['download']=function(_0x1cd85,_0x29f300,_0x31f27c){var _0x1a9bd7=require(_0x7995('0x51'));var _0x528c8e=![];var _0x29ee32={};if(_0x1cd85['query'][_0x7995('0x2d')]&&_0x1cd85[_0x7995('0x30')][_0x7995('0x2d')]==='uniqueid'){_0x29ee32['uniqueid']=_0x1cd85['params']['id'];}else{_0x29ee32['id']=_0x1cd85['params']['id'];}return db[_0x7995('0x41')][_0x7995('0x49')]({'where':_0x29ee32,'attributes':['id',_0x7995('0x4f')],'raw':!![]})[_0x7995('0x24')](handleEntityNotFound(_0x29f300,null))[_0x7995('0x24')](function(_0x357e60){if(_0x357e60){var _0x1f4270=path[_0x7995('0x52')](config[_0x7995('0x53')],_0x7995('0x54'),_0x357e60[_0x7995('0x4f')]);var _0x133c63=util[_0x7995('0x2f')](_0x7995('0x55'),_0x1f4270);if(fs[_0x7995('0x56')](_0x133c63)){_0x528c8e=!![];return _0x1a9bd7[_0x7995('0x57')](_0x133c63,_0x1f4270,config[_0x7995('0x58')][_0x7995('0x59')])[_0x7995('0x24')](function(){return _0x357e60;});}return _0x357e60;}})['then'](function(_0x56a374){if(_0x56a374){var _0x630737=path[_0x7995('0x52')](config[_0x7995('0x53')],'server/files/screen_recordings',_0x56a374['value']);if(!fs[_0x7995('0x56')](_0x630737)){throw new db[(_0x7995('0x5a'))][(_0x7995('0x5b'))](_0x7995('0x5c'));}if(_0x56a374['filename']){return _0x29f300[_0x7995('0x5d')](_0x630737,_0x56a374[_0x7995('0x5e')]+path[_0x7995('0x5f')](_0x630737),function(){if(_0x528c8e){fs[_0x7995('0x60')](_0x630737);}});}else{return _0x29f300['download'](_0x630737,function(_0x5e2d97){if(_0x528c8e){fs[_0x7995('0x60')](_0x630737);}});}}})[_0x7995('0x46')](function(_0x6c0221){if(_0x6c0221[_0x7995('0x61')]===_0x7995('0x5c')){_0x29f300[_0x7995('0x1b')](0x194)[_0x7995('0x29')](_0x7995('0x62'));}else{return handleError(_0x29f300,null);}});};exports[_0x7995('0x25')]=function(_0x50caf5,_0x18f230){return db[_0x7995('0x41')][_0x7995('0x49')]({'where':{'id':_0x50caf5[_0x7995('0x47')]['id']}})['then'](function(_0x51bf6a){if(!_0x51bf6a)throw new ReferenceError(_0x7995('0x63'));return _0x51bf6a;})[_0x7995('0x24')](function(_0x47d5d7){var _0x971a23=path[_0x7995('0x52')](config[_0x7995('0x53')],_0x7995('0x54'),_0x47d5d7[_0x7995('0x4f')]);logger['info'](_0x7995('0x64'),_0x971a23);if(!_['isNil'](_0x47d5d7[_0x7995('0x4f')])&&fs[_0x7995('0x56')](_0x971a23)){logger[_0x7995('0x65')](_0x7995('0x66')+_0x971a23+_0x7995('0x67'));fs[_0x7995('0x68')](_0x971a23);}_0x971a23=_0x971a23+_0x7995('0x69');if(!_[_0x7995('0x6a')](_0x47d5d7[_0x7995('0x4f')])&&fs[_0x7995('0x56')](_0x971a23)){logger[_0x7995('0x65')](_0x7995('0x66')+_0x971a23+'\x22\x20trovato\x20eseguo\x20la\x20cancellazione');fs[_0x7995('0x68')](_0x971a23);}return _0x47d5d7;})[_0x7995('0x24')](function(_0x293480){if(!_0x293480)throw new InternalError();return _0x293480[_0x7995('0x25')]();})[_0x7995('0x24')](function(){_0x18f230['status'](0xcc)['end']();})[_0x7995('0x46')](handleError(_0x18f230,null));}; \ No newline at end of file diff --git a/server/api/screenRecording/screenRecording.model.js b/server/api/screenRecording/screenRecording.model.js index b2c24d7..f165f3e 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 _0x531b=['lodash','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','exports','define','ScreenRecording','screen_recordings','interactionid'];(function(_0x4513fb,_0x400f2b){var _0x18a8c9=function(_0xce95ac){while(--_0xce95ac){_0x4513fb['push'](_0x4513fb['shift']());}};_0x18a8c9(++_0x400f2b);}(_0x531b,0x15f));var _0xb531=function(_0x3005d5,_0xf588c7){_0x3005d5=_0x3005d5-0x0;var _0x547c7e=_0x531b[_0x3005d5];return _0x547c7e;};'use strict';var _=require(_0xb531('0x0'));var util=require('util');var logger=require(_0xb531('0x1'))(_0xb531('0x2'));var moment=require(_0xb531('0x3'));var BPromise=require(_0xb531('0x4'));var rp=require(_0xb531('0x5'));var fs=require('fs');var path=require(_0xb531('0x6'));var rimraf=require(_0xb531('0x7'));var config=require('../../config/environment');var attributes=require('./screenRecording.attributes');module[_0xb531('0x8')]=function(_0x137328,_0x3949d9){return _0x137328[_0xb531('0x9')](_0xb531('0xa'),attributes,{'tableName':_0xb531('0xb'),'paranoid':![],'indexes':[{'name':_0xb531('0xc'),'fields':[_0xb531('0xc')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xed84=['exports','define','ScreenRecording','screen_recordings','interactionid','api','moment','request-promise','path','rimraf','../../config/environment'];(function(_0xde4f89,_0x58be43){var _0x56e409=function(_0x566f7c){while(--_0x566f7c){_0xde4f89['push'](_0xde4f89['shift']());}};_0x56e409(++_0x58be43);}(_0xed84,0x1a7));var _0x4ed8=function(_0x142132,_0xa24375){_0x142132=_0x142132-0x0;var _0x5d4540=_0xed84[_0x142132];return _0x5d4540;};'use strict';var _=require('lodash');var util=require('util');var logger=require('../../config/logger')(_0x4ed8('0x0'));var moment=require(_0x4ed8('0x1'));var BPromise=require('bluebird');var rp=require(_0x4ed8('0x2'));var fs=require('fs');var path=require(_0x4ed8('0x3'));var rimraf=require(_0x4ed8('0x4'));var config=require(_0x4ed8('0x5'));var attributes=require('./screenRecording.attributes');module[_0x4ed8('0x6')]=function(_0x40f972,_0x1a198e){return _0x40f972[_0x4ed8('0x7')](_0x4ed8('0x8'),attributes,{'tableName':_0x4ed8('0x9'),'paranoid':![],'indexes':[{'name':_0x4ed8('0xa'),'fields':[_0x4ed8('0xa')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/screenRecording/screenRecording.rpc.js b/server/api/screenRecording/screenRecording.rpc.js index ce7dd65..b1f003d 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(_0x220dab,_0x5589be){var _0x2fb15e=function(_0x3c11cd){while(--_0x3c11cd){_0x220dab['push'](_0x220dab['shift']());}};_0x2fb15e(++_0x5589be);}(_0xa9e0,0x123));var _0x0a9e=function(_0x46aff0,_0x122890){_0x46aff0=_0x46aff0-0x0;var _0x9d78cf=_0xa9e0[_0x46aff0];return _0x9d78cf;};'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(_0x277ba6,_0x415411){var _0x2e81cd=function(_0x522c2e){while(--_0x522c2e){_0x277ba6['push'](_0x277ba6['shift']());}};_0x2e81cd(++_0x415411);}(_0xa9e0,0x123));var _0x0a9e=function(_0x36dfbd,_0x5bfe2d){_0x36dfbd=_0x36dfbd-0x0;var _0x4ecad9=_0xa9e0[_0x36dfbd];return _0x4ecad9;};'use strict';var _=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var moment=require(_0x0a9e('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x0a9e('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x0a9e('0x4'));var logger=require(_0x0a9e('0x5'))(_0x0a9e('0x6'));var config=require(_0x0a9e('0x7'));var jayson=require(_0x0a9e('0x8'));var client=jayson['client'][_0x0a9e('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x441e3a,_0x2cc193,_0x5f41ea){return new BPromise(function(_0x503809,_0xe42b77){return client['request'](_0x441e3a,_0x5f41ea)['then'](function(_0x39753a){logger[_0x0a9e('0xa')](_0x0a9e('0xb'),_0x2cc193,_0x0a9e('0xc'));logger[_0x0a9e('0xd')](_0x0a9e('0xe'),_0x2cc193,'request\x20sent',JSON['stringify'](_0x39753a));if(_0x39753a['error']){if(_0x39753a['error'][_0x0a9e('0xf')]===0x1f4){logger[_0x0a9e('0x10')](_0x0a9e('0xb'),_0x2cc193,_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);return _0xe42b77(_0x39753a[_0x0a9e('0x10')]['message']);}logger[_0x0a9e('0x10')](_0x0a9e('0xb'),_0x2cc193,_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);return _0x503809(_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);}else{logger['info'](_0x0a9e('0xb'),_0x2cc193,'request\x20sent');_0x503809(_0x39753a[_0x0a9e('0x12')]['message']);}})[_0x0a9e('0x13')](function(_0x12066b){logger['error'](_0x0a9e('0xb'),_0x2cc193,_0x12066b);_0xe42b77(_0x12066b);});});} \ No newline at end of file diff --git a/server/api/setting/index.js b/server/api/setting/index.js index fb690c9..5495a77 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 _0xe8a8=['path','connect-timeout','Router','../../components/auth/service','./setting.controller','isAuthenticated','index','get','show','getLogo','/:id/logo_login','getLogoLogin','/:id/gdpr','/:id/preferred','getPreferred','/:id/favicon','getFavicon','diskStorage','join','root','server/files/images/logos/','format','%s%s','extname','originalname','/:id/logo','single','file','addLogo','logologin','addLogoLogin','preferred','post','addFavicon','put','/:id','update','exports','util'];(function(_0x133ddb,_0x5bfda1){var _0x456128=function(_0x487b66){while(--_0x487b66){_0x133ddb['push'](_0x133ddb['shift']());}};_0x456128(++_0x5bfda1);}(_0xe8a8,0x9b));var _0x8e8a=function(_0x5a31d6,_0x5a25db){_0x5a31d6=_0x5a31d6-0x0;var _0x247917=_0xe8a8[_0x5a31d6];return _0x247917;};'use strict';var multer=require('multer');var util=require(_0x8e8a('0x0'));var path=require(_0x8e8a('0x1'));var timeout=require(_0x8e8a('0x2'));var express=require('express');var router=express[_0x8e8a('0x3')]();var auth=require(_0x8e8a('0x4'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x8e8a('0x5'));router['get']('/',auth[_0x8e8a('0x6')](),controller[_0x8e8a('0x7')]);router[_0x8e8a('0x8')]('/:id',controller[_0x8e8a('0x9')]);router[_0x8e8a('0x8')]('/:id/logo',controller[_0x8e8a('0xa')]);router[_0x8e8a('0x8')](_0x8e8a('0xb'),controller[_0x8e8a('0xc')]);router[_0x8e8a('0x8')](_0x8e8a('0xd'),controller['gdpr']);router['get'](_0x8e8a('0xe'),controller[_0x8e8a('0xf')]);router[_0x8e8a('0x8')](_0x8e8a('0x10'),controller[_0x8e8a('0x11')]);var upload=multer({'storage':multer[_0x8e8a('0x12')]({'destination':function(_0x1ff71c,_0x131a64,_0x444597){_0x444597(null,path[_0x8e8a('0x13')](config[_0x8e8a('0x14')],_0x8e8a('0x15')));},'filename':function(_0x92f570,_0x3f1615,_0x58307e){_0x58307e(null,util[_0x8e8a('0x16')](_0x8e8a('0x17'),'logo',path[_0x8e8a('0x18')](_0x3f1615[_0x8e8a('0x19')])));}})});router['post'](_0x8e8a('0x1a'),upload[_0x8e8a('0x1b')](_0x8e8a('0x1c')),controller[_0x8e8a('0x1d')]);var upload=multer({'storage':multer[_0x8e8a('0x12')]({'destination':function(_0x2a5202,_0x895573,_0x103d81){_0x103d81(null,path[_0x8e8a('0x13')](config['root'],_0x8e8a('0x15')));},'filename':function(_0x5092b8,_0x27d3a0,_0x1f9558){_0x1f9558(null,util[_0x8e8a('0x16')](_0x8e8a('0x17'),_0x8e8a('0x1e'),path[_0x8e8a('0x18')](_0x27d3a0[_0x8e8a('0x19')])));}})});router['post']('/:id/logo_login',upload[_0x8e8a('0x1b')](_0x8e8a('0x1c')),controller[_0x8e8a('0x1f')]);var upload=multer({'storage':multer[_0x8e8a('0x12')]({'destination':function(_0x5c0dd9,_0x2bfc3f,_0x542730){_0x542730(null,path[_0x8e8a('0x13')](config[_0x8e8a('0x14')],'server/files/images/logos/'));},'filename':function(_0x23bcaf,_0x2910f1,_0x2fda1f){_0x2fda1f(null,util[_0x8e8a('0x16')](_0x8e8a('0x17'),_0x8e8a('0x20'),path[_0x8e8a('0x18')](_0x2910f1[_0x8e8a('0x19')])));}})});router[_0x8e8a('0x21')](_0x8e8a('0xe'),upload[_0x8e8a('0x1b')](_0x8e8a('0x1c')),controller['addPreferred']);var upload=multer({'storage':multer[_0x8e8a('0x12')]({'destination':function(_0x4482e8,_0x4528e2,_0x4dc3a9){_0x4dc3a9(null,path['join'](config[_0x8e8a('0x14')],'server/files/images/logos/'));},'filename':function(_0x5852e1,_0x2dff2d,_0x37198d){_0x37198d(null,util[_0x8e8a('0x16')](_0x8e8a('0x17'),'favicon',path[_0x8e8a('0x18')](_0x2dff2d[_0x8e8a('0x19')])));}})});router[_0x8e8a('0x21')](_0x8e8a('0x10'),upload[_0x8e8a('0x1b')]('file'),controller[_0x8e8a('0x22')]);router[_0x8e8a('0x23')](_0x8e8a('0x24'),auth['isAuthenticated'](),controller[_0x8e8a('0x25')]);module[_0x8e8a('0x26')]=router; \ No newline at end of file +var _0xfba6=['getPreferred','/:id/favicon','getFavicon','diskStorage','join','root','server/files/images/logos/','format','%s%s','extname','single','file','addLogo','post','addLogoLogin','preferred','originalname','favicon','addFavicon','update','exports','multer','util','path','connect-timeout','express','../../components/interaction/service','./setting.controller','get','isAuthenticated','index','/:id','show','/:id/logo','/:id/logo_login','getLogoLogin','/:id/gdpr','/:id/preferred'];(function(_0x199572,_0x33e667){var _0x13cfa3=function(_0x53c075){while(--_0x53c075){_0x199572['push'](_0x199572['shift']());}};_0x13cfa3(++_0x33e667);}(_0xfba6,0x1b7));var _0x6fba=function(_0x1ca4c3,_0x554126){_0x1ca4c3=_0x1ca4c3-0x0;var _0x4426a6=_0xfba6[_0x1ca4c3];return _0x4426a6;};'use strict';var multer=require(_0x6fba('0x0'));var util=require(_0x6fba('0x1'));var path=require(_0x6fba('0x2'));var timeout=require(_0x6fba('0x3'));var express=require(_0x6fba('0x4'));var router=express['Router']();var auth=require('../../components/auth/service');var interaction=require(_0x6fba('0x5'));var config=require('../../config/environment');var controller=require(_0x6fba('0x6'));router[_0x6fba('0x7')]('/',auth[_0x6fba('0x8')](),controller[_0x6fba('0x9')]);router['get'](_0x6fba('0xa'),controller[_0x6fba('0xb')]);router[_0x6fba('0x7')](_0x6fba('0xc'),controller['getLogo']);router[_0x6fba('0x7')](_0x6fba('0xd'),controller[_0x6fba('0xe')]);router['get'](_0x6fba('0xf'),controller['gdpr']);router[_0x6fba('0x7')](_0x6fba('0x10'),controller[_0x6fba('0x11')]);router[_0x6fba('0x7')](_0x6fba('0x12'),controller[_0x6fba('0x13')]);var upload=multer({'storage':multer[_0x6fba('0x14')]({'destination':function(_0x2ef2ce,_0x402b6b,_0x54cfa5){_0x54cfa5(null,path[_0x6fba('0x15')](config[_0x6fba('0x16')],_0x6fba('0x17')));},'filename':function(_0x559019,_0x5c3142,_0x25a048){_0x25a048(null,util[_0x6fba('0x18')](_0x6fba('0x19'),'logo',path[_0x6fba('0x1a')](_0x5c3142['originalname'])));}})});router['post']('/:id/logo',upload[_0x6fba('0x1b')](_0x6fba('0x1c')),controller[_0x6fba('0x1d')]);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x283154,_0x37ff5c,_0x6d9be9){_0x6d9be9(null,path['join'](config[_0x6fba('0x16')],_0x6fba('0x17')));},'filename':function(_0x227462,_0x2797a7,_0x367c02){_0x367c02(null,util['format'](_0x6fba('0x19'),'logologin',path[_0x6fba('0x1a')](_0x2797a7['originalname'])));}})});router[_0x6fba('0x1e')](_0x6fba('0xd'),upload['single'](_0x6fba('0x1c')),controller[_0x6fba('0x1f')]);var upload=multer({'storage':multer[_0x6fba('0x14')]({'destination':function(_0x2415bd,_0x76835,_0x420dfc){_0x420dfc(null,path[_0x6fba('0x15')](config[_0x6fba('0x16')],'server/files/images/logos/'));},'filename':function(_0xec44a3,_0x2fd4ab,_0x4316d0){_0x4316d0(null,util['format'](_0x6fba('0x19'),_0x6fba('0x20'),path[_0x6fba('0x1a')](_0x2fd4ab[_0x6fba('0x21')])));}})});router[_0x6fba('0x1e')](_0x6fba('0x10'),upload[_0x6fba('0x1b')](_0x6fba('0x1c')),controller['addPreferred']);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x2ff15d,_0x4e4f0c,_0xb2289e){_0xb2289e(null,path[_0x6fba('0x15')](config['root'],_0x6fba('0x17')));},'filename':function(_0x1a0dc1,_0x145a4a,_0x5b0a8d){_0x5b0a8d(null,util[_0x6fba('0x18')](_0x6fba('0x19'),_0x6fba('0x22'),path['extname'](_0x145a4a[_0x6fba('0x21')])));}})});router['post'](_0x6fba('0x12'),upload[_0x6fba('0x1b')](_0x6fba('0x1c')),controller[_0x6fba('0x23')]);router['put'](_0x6fba('0xa'),auth[_0x6fba('0x8')](),controller[_0x6fba('0x24')]);module[_0x6fba('0x25')]=router; \ No newline at end of file diff --git a/server/api/setting/setting.attributes.js b/server/api/setting/setting.attributes.js index 107e37a..7ffcf30 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 _0x863a=['https://www.xcally.com/bar/phonebar/autoupdater.xml','alternate','sequelize','exports','INTEGER','min_internal','STRING','/var/opt/motion2/server/files/sounds/converted','BOOLEAN'];(function(_0x48004e,_0x2825ec){var _0x47b4d5=function(_0x396ddc){while(--_0x396ddc){_0x48004e['push'](_0x48004e['shift']());}};_0x47b4d5(++_0x2825ec);}(_0x863a,0xfe));var _0xa863=function(_0xca0d51,_0xd70bfd){_0xca0d51=_0xca0d51-0x0;var _0x39582d=_0x863a[_0xca0d51];return _0x39582d;};'use strict';var Sequelize=require(_0xa863('0x0'));module[_0xa863('0x1')]={'min_internal':{'type':Sequelize[_0xa863('0x2')](0xb),'unique':_0xa863('0x3'),'defaultValue':0x3e8},'min_mailbox':{'type':Sequelize[_0xa863('0x2')](0xb),'unique':'min_mailbox','defaultValue':0x3e8},'agi_port':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x11dd},'soundPath':{'type':Sequelize[_0xa863('0x4')],'defaultValue':_0xa863('0x5')},'logo':{'type':Sequelize[_0xa863('0x4')]},'defaultLogo':{'type':Sequelize[_0xa863('0x6')],'defaultValue':!![]},'loginLogo':{'type':Sequelize[_0xa863('0x4')]},'defaultLoginLogo':{'type':Sequelize[_0xa863('0x6')],'defaultValue':!![]},'headerWhiteLabel':{'type':Sequelize[_0xa863('0x4')]},'defaultHeaderWhiteLabel':{'type':Sequelize[_0xa863('0x6')],'defaultValue':!![]},'securePassword':{'type':Sequelize[_0xa863('0x6')],'defaultValue':!![]},'firstSetup':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'stunaddr':{'type':Sequelize[_0xa863('0x4')]},'turnaddr':{'type':Sequelize[_0xa863('0x4')]},'turnusername':{'type':Sequelize[_0xa863('0x4')]},'turnpassword':{'type':Sequelize[_0xa863('0x4')]},'pageTitle':{'type':Sequelize[_0xa863('0x4')]},'defaultPageTitle':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'callRecordingEncryption':{'type':Sequelize[_0xa863('0x6')],'defaultValue':![]},'passwordExpiresDays':{'type':Sequelize[_0xa863('0x2')](0xb),'defaultValue':0x5a},'phoneBarAutoUpdater':{'type':Sequelize[_0xa863('0x6')],'defaultValue':!![]},'phoneBarAutoUpdaterUrl':{'type':Sequelize['STRING'],'defaultValue':_0xa863('0x7')},'enableEmailPreview':{'type':Sequelize[_0xa863('0x6')],'defaultValue':![]},'split':{'type':Sequelize[_0xa863('0x6')],'defaultValue':!![]},'splitSizeCsv':{'type':Sequelize[_0xa863('0x2')],'defaultValue':0x1388},'splitSizePdf':{'type':Sequelize[_0xa863('0x2')],'defaultValue':0x1388},'splitSizeXlsx':{'type':Sequelize[_0xa863('0x2')],'defaultValue':0x1388},'messagesAlignment':{'type':Sequelize[_0xa863('0x4')],'defaultValue':_0xa863('0x8')},'chatTimeout':{'type':Sequelize[_0xa863('0x2')],'defaultValue':0x1e},'phoneBarRememberMeEnabled':{'type':Sequelize[_0xa863('0x6')],'defaultValue':!![]},'preferred':{'type':Sequelize['STRING']},'defaultPreferred':{'type':Sequelize[_0xa863('0x6')],'defaultValue':!![]},'rtlSupport':{'type':Sequelize[_0xa863('0x6')],'defaultValue':![]},'defaultScreenRecordingPath':{'type':Sequelize[_0xa863('0x4')]},'allowedLoginAttempts':{'type':Sequelize[_0xa863('0x2')],'defaultValue':0x5},'blockDuration':{'type':Sequelize[_0xa863('0x2')],'defaultValue':0xa},'favicon':{'type':Sequelize[_0xa863('0x4')]},'defaultFavicon':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'loginMailFrequency':{'type':Sequelize['INTEGER'],'defaultValue':0xa,'validate':{'min':0xa}},'googleSsoEnabled':{'type':Sequelize['BOOLEAN'],'defaultValue':![]}}; \ No newline at end of file +var _0x1d25=['min_mailbox','STRING','/var/opt/motion2/server/files/sounds/converted','BOOLEAN','alternate','exports','min_internal','INTEGER'];(function(_0x5ea2c9,_0x4dc188){var _0x1af91d=function(_0x54168b){while(--_0x54168b){_0x5ea2c9['push'](_0x5ea2c9['shift']());}};_0x1af91d(++_0x4dc188);}(_0x1d25,0x185));var _0x51d2=function(_0x4ea6af,_0x4aa32e){_0x4ea6af=_0x4ea6af-0x0;var _0x4cb1e6=_0x1d25[_0x4ea6af];return _0x4cb1e6;};'use strict';var Sequelize=require('sequelize');module[_0x51d2('0x0')]={'min_internal':{'type':Sequelize['INTEGER'](0xb),'unique':_0x51d2('0x1'),'defaultValue':0x3e8},'min_mailbox':{'type':Sequelize[_0x51d2('0x2')](0xb),'unique':_0x51d2('0x3'),'defaultValue':0x3e8},'agi_port':{'type':Sequelize[_0x51d2('0x2')](0xb),'defaultValue':0x11dd},'soundPath':{'type':Sequelize[_0x51d2('0x4')],'defaultValue':_0x51d2('0x5')},'logo':{'type':Sequelize[_0x51d2('0x4')]},'defaultLogo':{'type':Sequelize[_0x51d2('0x6')],'defaultValue':!![]},'loginLogo':{'type':Sequelize[_0x51d2('0x4')]},'defaultLoginLogo':{'type':Sequelize[_0x51d2('0x6')],'defaultValue':!![]},'headerWhiteLabel':{'type':Sequelize[_0x51d2('0x4')]},'defaultHeaderWhiteLabel':{'type':Sequelize[_0x51d2('0x6')],'defaultValue':!![]},'securePassword':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'firstSetup':{'type':Sequelize[_0x51d2('0x6')],'defaultValue':!![]},'stunaddr':{'type':Sequelize['STRING']},'turnaddr':{'type':Sequelize[_0x51d2('0x4')]},'turnusername':{'type':Sequelize[_0x51d2('0x4')]},'turnpassword':{'type':Sequelize[_0x51d2('0x4')]},'pageTitle':{'type':Sequelize['STRING']},'defaultPageTitle':{'type':Sequelize[_0x51d2('0x6')],'defaultValue':!![]},'callRecordingEncryption':{'type':Sequelize[_0x51d2('0x6')],'defaultValue':![]},'passwordExpiresDays':{'type':Sequelize[_0x51d2('0x2')](0xb),'defaultValue':0x5a},'phoneBarAutoUpdater':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'phoneBarAutoUpdaterUrl':{'type':Sequelize[_0x51d2('0x4')],'defaultValue':'https://www.xcally.com/bar/phonebar/autoupdater.xml'},'enableEmailPreview':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'split':{'type':Sequelize[_0x51d2('0x6')],'defaultValue':!![]},'splitSizeCsv':{'type':Sequelize[_0x51d2('0x2')],'defaultValue':0x1388},'splitSizePdf':{'type':Sequelize[_0x51d2('0x2')],'defaultValue':0x1388},'splitSizeXlsx':{'type':Sequelize['INTEGER'],'defaultValue':0x1388},'messagesAlignment':{'type':Sequelize[_0x51d2('0x4')],'defaultValue':_0x51d2('0x7')},'chatTimeout':{'type':Sequelize[_0x51d2('0x2')],'defaultValue':0x1e},'phoneBarRememberMeEnabled':{'type':Sequelize[_0x51d2('0x6')],'defaultValue':!![]},'preferred':{'type':Sequelize[_0x51d2('0x4')]},'defaultPreferred':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'rtlSupport':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'defaultScreenRecordingPath':{'type':Sequelize[_0x51d2('0x4')]},'allowedLoginAttempts':{'type':Sequelize[_0x51d2('0x2')],'defaultValue':0x5},'blockDuration':{'type':Sequelize[_0x51d2('0x2')],'defaultValue':0xa},'favicon':{'type':Sequelize[_0x51d2('0x4')]},'defaultFavicon':{'type':Sequelize[_0x51d2('0x6')],'defaultValue':!![]},'loginMailFrequency':{'type':Sequelize[_0x51d2('0x2')],'defaultValue':0xa,'validate':{'min':0xa}},'googleSsoEnabled':{'type':Sequelize[_0x51d2('0x6')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/setting/setting.controller.js b/server/api/setting/setting.controller.js index edc9cae..7453fa3 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 _0xe627=['pick','filter','VIRTUAL','includeAll','include','rows','show','keys','length','merge','update','body','find','params','addLogo','file','filename','addLogoLogin','loginLogo','../../config/license/util','server/files/images/logos','getLicense','logo','preferred','defaultLogo','defaultLoginLogo','defaultPreferred','defaultFavicon','existsSync','root','join','toLower','default_logo.png','default','upperFirst','custom','\x20not\x20found','getLogoLogin','favicon','default_loginLogo.png','securePassword','addPreferred','getPreferred','default_preferred.png','download','addFavicon','html-pdf','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../mysqldb','jayson/promise','client','http','test','Sequelize','ValidationError','request','info','Setting,\x20%s,\x20%s','debug','request\x20sent','stringify','error','code','message','catch','status','end','json','count','offset','limit','set','Content-Range','apply','reject','then','destroy','sendStatus','name','send','index','map','Setting','rawAttributes','type','model','query','filters','intersection','attributes','fields','nolimit','sort','where'];(function(_0x31a577,_0x252d65){var _0x7a679d=function(_0x37485b){while(--_0x37485b){_0x31a577['push'](_0x31a577['shift']());}};_0x7a679d(++_0x252d65);}(_0xe627,0x114));var _0x7e62=function(_0x5bd3fc,_0x975f72){_0x5bd3fc=_0x5bd3fc-0x0;var _0x40d1c4=_0xe627[_0x5bd3fc];return _0x40d1c4;};'use strict';var pdf=require(_0x7e62('0x0'));var emlformat=require('eml-format');var rimraf=require(_0x7e62('0x1'));var zipdir=require(_0x7e62('0x2'));var jsonpatch=require(_0x7e62('0x3'));var rp=require('request-promise');var moment=require(_0x7e62('0x4'));var BPromise=require(_0x7e62('0x5'));var Mustache=require(_0x7e62('0x6'));var util=require('util');var path=require(_0x7e62('0x7'));var sox=require(_0x7e62('0x8'));var csv=require(_0x7e62('0x9'));var ejs=require(_0x7e62('0xa'));var fs=require('fs');var _=require(_0x7e62('0xb'));var squel=require(_0x7e62('0xc'));var crypto=require(_0x7e62('0xd'));var jsforce=require(_0x7e62('0xe'));var deskjs=require('desk.js');var toCsv=require(_0x7e62('0x9'));var querystring=require(_0x7e62('0xf'));var Papa=require(_0x7e62('0x10'));var Redis=require(_0x7e62('0x11'));var authService=require(_0x7e62('0x12'));var qs=require(_0x7e62('0x13'));var as=require(_0x7e62('0x14'));var hardwareService=require(_0x7e62('0x15'));var logger=require(_0x7e62('0x16'))('api');var utils=require('../../config/utils');var config=require('../../config/environment');var db=require(_0x7e62('0x17'))['db'];var jayson=require(_0x7e62('0x18'));var client=jayson[_0x7e62('0x19')][_0x7e62('0x1a')]({'port':0x232a});function checkPasswordPattern(_0x3dac1c,_0x6f579a,_0x4970b1){if(_0x4970b1){var _0x165966=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x165966[_0x7e62('0x1b')](_0x6f579a)){return _0x3dac1c;}else{throw new db[(_0x7e62('0x1c'))][(_0x7e62('0x1d'))]('The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.');}}else{return _0x3dac1c;}}function respondWithRpcPromise(_0x26e06b,_0x44655e,_0x3b11e0,_0x156dc8){return new BPromise(function(_0x250061,_0x803248){var _0x3bb9e1=_0x156dc8||client;return _0x3bb9e1[_0x7e62('0x1e')](_0x26e06b,_0x3b11e0)['then'](function(_0x47e71f){logger[_0x7e62('0x1f')](_0x7e62('0x20'),_0x44655e,'request\x20sent');logger[_0x7e62('0x21')]('Setting,\x20%s,\x20%s,\x20%s',_0x44655e,_0x7e62('0x22'),JSON[_0x7e62('0x23')](_0x47e71f));if(_0x47e71f[_0x7e62('0x24')]){if(_0x47e71f[_0x7e62('0x24')][_0x7e62('0x25')]===0x1f4){logger[_0x7e62('0x24')](_0x7e62('0x20'),_0x44655e,_0x47e71f[_0x7e62('0x24')][_0x7e62('0x26')]);return _0x803248(_0x47e71f[_0x7e62('0x24')]['message']);}logger[_0x7e62('0x24')](_0x7e62('0x20'),_0x44655e,_0x47e71f[_0x7e62('0x24')][_0x7e62('0x26')]);return _0x250061(_0x47e71f[_0x7e62('0x24')][_0x7e62('0x26')]);}else{logger[_0x7e62('0x1f')](_0x7e62('0x20'),_0x44655e,_0x7e62('0x22'));_0x250061(_0x47e71f['result']['message']);}})[_0x7e62('0x27')](function(_0xd67084){logger[_0x7e62('0x24')]('Setting,\x20%s,\x20%s',_0x44655e,_0xd67084);_0x803248(_0xd67084);});});}function respondWithStatusCode(_0x445a0f,_0x26db92){_0x26db92=_0x26db92||0xcc;return function(_0x39f150){if(_0x39f150){return _0x445a0f['sendStatus'](_0x26db92);}return _0x445a0f[_0x7e62('0x28')](_0x26db92)[_0x7e62('0x29')]();};}function respondWithResult(_0x383f5e,_0x26ef57){_0x26ef57=_0x26ef57||0xc8;return function(_0x1fd8e5){if(_0x1fd8e5){return _0x383f5e['status'](_0x26ef57)[_0x7e62('0x2a')](_0x1fd8e5);}};}function respondWithFilteredResult(_0x27c656,_0x2b455c){return function(_0x4bdb1b){if(_0x4bdb1b){var _0x3fd262=_0x4bdb1b[_0x7e62('0x2b')],_0x3bbe53=_0x2b455c[_0x7e62('0x2c')],_0x222e0f=_0x2b455c[_0x7e62('0x2c')]+_0x2b455c[_0x7e62('0x2d')],_0x21d89c;if(_0x222e0f>=_0x3fd262){_0x222e0f=_0x3fd262;_0x21d89c=0xc8;}else{_0x21d89c=0xce;}_0x27c656['status'](_0x21d89c);return _0x27c656[_0x7e62('0x2e')](_0x7e62('0x2f'),_0x3bbe53+'-'+_0x222e0f+'/'+_0x3fd262)[_0x7e62('0x2a')](_0x4bdb1b);}return null;};}function patchUpdates(_0x2768fb){return function(_0x454c24){try{jsonpatch[_0x7e62('0x30')](_0x454c24,_0x2768fb,!![]);}catch(_0x12df3a){return BPromise[_0x7e62('0x31')](_0x12df3a);}return _0x454c24['save']();};}function saveUpdates(_0x5d3099,_0x2d4268){return function(_0x36a875){if(_0x36a875){return _0x36a875['update'](_0x5d3099)[_0x7e62('0x32')](function(_0x321adc){return _0x321adc;});}return null;};}function removeEntity(_0x470d7c,_0x20ec4e){return function(_0x1491aa){if(_0x1491aa){return _0x1491aa[_0x7e62('0x33')]()[_0x7e62('0x32')](function(){_0x470d7c[_0x7e62('0x28')](0xcc)['end']();});}};}function handleEntityNotFound(_0x9def8,_0x289662){return function(_0x16ded4){if(!_0x16ded4){_0x9def8[_0x7e62('0x34')](0x194);}return _0x16ded4;};}function handleError(_0x3f3c45,_0x301659){_0x301659=_0x301659||0x1f4;return function(_0x3a69b1){logger[_0x7e62('0x24')](_0x3a69b1['stack']);if(_0x3a69b1[_0x7e62('0x35')]){delete _0x3a69b1['name'];}_0x3f3c45[_0x7e62('0x28')](_0x301659)[_0x7e62('0x36')](_0x3a69b1);};}exports[_0x7e62('0x37')]=function(_0x406b4b,_0x903190){var _0x584018={},_0x4befbf={},_0x259028={'count':0x0,'rows':[]};var _0x4d2b96=_[_0x7e62('0x38')](db[_0x7e62('0x39')][_0x7e62('0x3a')],function(_0x40bbb2){return{'name':_0x40bbb2['fieldName'],'type':_0x40bbb2[_0x7e62('0x3b')]['key']};});_0x4befbf[_0x7e62('0x3c')]=_[_0x7e62('0x38')](_0x4d2b96,_0x7e62('0x35'));_0x4befbf[_0x7e62('0x3d')]=_['keys'](_0x406b4b[_0x7e62('0x3d')]);_0x4befbf[_0x7e62('0x3e')]=_[_0x7e62('0x3f')](_0x4befbf[_0x7e62('0x3c')],_0x4befbf[_0x7e62('0x3d')]);_0x584018[_0x7e62('0x40')]=_['intersection'](_0x4befbf[_0x7e62('0x3c')],qs['fields'](_0x406b4b[_0x7e62('0x3d')][_0x7e62('0x41')]));_0x584018['attributes']=_0x584018['attributes']['length']?_0x584018[_0x7e62('0x40')]:_0x4befbf[_0x7e62('0x3c')];if(!_0x406b4b['query']['hasOwnProperty'](_0x7e62('0x42'))){_0x584018[_0x7e62('0x2d')]=qs[_0x7e62('0x2d')](_0x406b4b[_0x7e62('0x3d')]['limit']);_0x584018[_0x7e62('0x2c')]=qs[_0x7e62('0x2c')](_0x406b4b[_0x7e62('0x3d')]['offset']);}_0x584018['order']=qs[_0x7e62('0x43')](_0x406b4b['query'][_0x7e62('0x43')]);_0x584018[_0x7e62('0x44')]=qs[_0x7e62('0x3e')](_[_0x7e62('0x45')](_0x406b4b[_0x7e62('0x3d')],_0x4befbf[_0x7e62('0x3e')]));if(_0x406b4b['query'][_0x7e62('0x46')]){_0x584018['where']=_['merge'](_0x584018[_0x7e62('0x44')],{'$or':_[_0x7e62('0x38')](_0x4d2b96,function(_0x197530){if(_0x197530[_0x7e62('0x3b')]!==_0x7e62('0x47')){var _0x226a80={};_0x226a80[_0x197530['name']]={'$like':'%'+_0x406b4b[_0x7e62('0x3d')][_0x7e62('0x46')]+'%'};return _0x226a80;}})});}_0x584018=_['merge']({},_0x584018,_0x406b4b['options']);var _0x30056a={'where':_0x584018[_0x7e62('0x44')]};return db[_0x7e62('0x39')][_0x7e62('0x2b')](_0x30056a)['then'](function(_0x11ecea){_0x259028[_0x7e62('0x2b')]=_0x11ecea;if(_0x406b4b['query'][_0x7e62('0x48')]){_0x584018[_0x7e62('0x49')]=[{'all':!![]}];}return db[_0x7e62('0x39')]['findAll'](_0x584018);})[_0x7e62('0x32')](function(_0xf6924a){_0x259028[_0x7e62('0x4a')]=_0xf6924a;return _0x259028;})[_0x7e62('0x32')](respondWithFilteredResult(_0x903190,_0x584018))[_0x7e62('0x27')](handleError(_0x903190,null));};exports[_0x7e62('0x4b')]=function(_0x4b7194,_0x4f79a2){var _0x33d49e={'raw':![],'where':{'id':_0x4b7194['params']['id']}},_0x598c58={};_0x598c58[_0x7e62('0x3c')]=_[_0x7e62('0x4c')](db[_0x7e62('0x39')][_0x7e62('0x3a')]);_0x598c58[_0x7e62('0x3d')]=_[_0x7e62('0x4c')](_0x4b7194[_0x7e62('0x3d')]);_0x598c58['filters']=_[_0x7e62('0x3f')](_0x598c58[_0x7e62('0x3c')],_0x598c58[_0x7e62('0x3d')]);_0x33d49e[_0x7e62('0x40')]=_[_0x7e62('0x3f')](_0x598c58[_0x7e62('0x3c')],qs[_0x7e62('0x41')](_0x4b7194[_0x7e62('0x3d')][_0x7e62('0x41')]));_0x33d49e[_0x7e62('0x40')]=_0x33d49e[_0x7e62('0x40')][_0x7e62('0x4d')]?_0x33d49e[_0x7e62('0x40')]:_0x598c58[_0x7e62('0x3c')];if(_0x4b7194[_0x7e62('0x3d')][_0x7e62('0x48')]){_0x33d49e[_0x7e62('0x49')]=[{'all':!![]}];}_0x33d49e=_[_0x7e62('0x4e')]({},_0x33d49e,_0x4b7194['options']);return db[_0x7e62('0x39')]['find'](_0x33d49e)[_0x7e62('0x32')](handleEntityNotFound(_0x4f79a2,null))[_0x7e62('0x32')](respondWithResult(_0x4f79a2,null))[_0x7e62('0x27')](handleError(_0x4f79a2,null));};exports[_0x7e62('0x4f')]=function(_0xf08a5c,_0x20afac){if(_0xf08a5c[_0x7e62('0x50')]['id']){delete _0xf08a5c[_0x7e62('0x50')]['id'];}return db['Setting'][_0x7e62('0x51')]({'where':{'id':_0xf08a5c[_0x7e62('0x52')]['id']}})['then'](handleEntityNotFound(_0x20afac,null))[_0x7e62('0x32')](saveUpdates(_0xf08a5c['body'],null))['then'](respondWithResult(_0x20afac,null))[_0x7e62('0x27')](handleError(_0x20afac,null));};exports[_0x7e62('0x53')]=function(_0x4b7fd7,_0x1222bd,_0x90a45a){if(_0x4b7fd7[_0x7e62('0x54')]&&_0x4b7fd7[_0x7e62('0x54')][_0x7e62('0x55')]){_0x4b7fd7['body']['logo']=_0x4b7fd7['file']['filename'];}return db['Setting']['find']({'where':{'id':_0x4b7fd7[_0x7e62('0x52')]['id']}})[_0x7e62('0x32')](handleEntityNotFound(_0x1222bd,null))[_0x7e62('0x32')](saveUpdates(_0x4b7fd7[_0x7e62('0x50')],null))['then'](respondWithResult(_0x1222bd,null))[_0x7e62('0x27')](handleError(_0x1222bd,null));};exports[_0x7e62('0x56')]=function(_0x155663,_0xfb76d3,_0x25f527){if(_0x155663[_0x7e62('0x54')]&&_0x155663[_0x7e62('0x54')]['filename']){_0x155663[_0x7e62('0x50')][_0x7e62('0x57')]=_0x155663['file'][_0x7e62('0x55')];}return db[_0x7e62('0x39')]['find']({'where':{'id':_0x155663[_0x7e62('0x52')]['id']}})[_0x7e62('0x32')](handleEntityNotFound(_0xfb76d3,null))[_0x7e62('0x32')](saveUpdates(_0x155663[_0x7e62('0x50')],null))[_0x7e62('0x32')](respondWithResult(_0xfb76d3,null))[_0x7e62('0x27')](handleError(_0xfb76d3,null));};var utilLicense=require(_0x7e62('0x58'));exports['getLogo']=function(_0x5e8d20,_0x37dfe7,_0x12218c){var _0x250cb1=_0x7e62('0x59');var _0x3109be={'custom':![]};return utilLicense[_0x7e62('0x5a')]()[_0x7e62('0x32')](function(_0x1cdcd7){if(_0x1cdcd7){_0x3109be=_0x1cdcd7;}return db[_0x7e62('0x39')][_0x7e62('0x51')]({'where':{'id':_0x5e8d20[_0x7e62('0x52')]['id']},'attributes':[_0x7e62('0x5b'),_0x7e62('0x57'),_0x7e62('0x5c'),'favicon',_0x7e62('0x5d'),_0x7e62('0x5e'),_0x7e62('0x5f'),_0x7e62('0x60')],'raw':!![]});})[_0x7e62('0x32')](handleEntityNotFound(_0x37dfe7,null))[_0x7e62('0x32')](function(_0x53f799){if(_0x53f799){var _0x4a8206=_0x53f799[_0x7e62('0x5b')]&&fs[_0x7e62('0x61')](path['join'](config[_0x7e62('0x62')],_0x250cb1,_['toLower'](_0x53f799['logo'])))?path[_0x7e62('0x63')](config['root'],_0x250cb1,_[_0x7e62('0x64')](_0x53f799[_0x7e62('0x5b')])):path[_0x7e62('0x63')](config['root'],_0x250cb1,_['toLower'](_0x7e62('0x65')));var _0x512442=_0x7e62('0x66')+_[_0x7e62('0x67')]('logo');if(_0x53f799[_0x512442]||!_0x3109be[_0x7e62('0x68')]){_0x4a8206=path[_0x7e62('0x63')](config['root'],_0x250cb1,_['toLower'](_0x7e62('0x65')));}if(!fs[_0x7e62('0x61')](_0x4a8206)){throw new db[(_0x7e62('0x1c'))]['ValidationError'](_[_0x7e62('0x67')](_0x7e62('0x5b'))+_0x7e62('0x69'));}return _0x37dfe7['download'](_0x4a8206);}})[_0x7e62('0x27')](handleError(_0x37dfe7,null));};var utilLicense=require(_0x7e62('0x58'));exports[_0x7e62('0x6a')]=function(_0xda22e7,_0x222eb7,_0x513307){var _0x223516='server/files/images/logos';var _0xd3ec51={'custom':![]};return utilLicense[_0x7e62('0x5a')]()[_0x7e62('0x32')](function(_0x31360f){if(_0x31360f){_0xd3ec51=_0x31360f;}return db[_0x7e62('0x39')][_0x7e62('0x51')]({'where':{'id':_0xda22e7[_0x7e62('0x52')]['id']},'attributes':['logo','loginLogo',_0x7e62('0x5c'),_0x7e62('0x6b'),_0x7e62('0x5d'),'defaultLoginLogo','defaultPreferred','defaultFavicon'],'raw':!![]});})[_0x7e62('0x32')](handleEntityNotFound(_0x222eb7,null))[_0x7e62('0x32')](function(_0xff30c8){if(_0xff30c8){var _0x5ae224=_0xff30c8[_0x7e62('0x57')]&&fs[_0x7e62('0x61')](path[_0x7e62('0x63')](config[_0x7e62('0x62')],_0x223516,_['toLower'](_0xff30c8[_0x7e62('0x57')])))?path[_0x7e62('0x63')](config[_0x7e62('0x62')],_0x223516,_[_0x7e62('0x64')](_0xff30c8['loginLogo'])):path[_0x7e62('0x63')](config[_0x7e62('0x62')],_0x223516,_['toLower']('default_loginLogo.png'));var _0x47866f='default'+_[_0x7e62('0x67')](_0x7e62('0x57'));if(_0xff30c8[_0x47866f]||!_0xd3ec51['custom']){_0x5ae224=path['join'](config[_0x7e62('0x62')],_0x223516,_['toLower'](_0x7e62('0x6c')));}if(!fs['existsSync'](_0x5ae224)){throw new db[(_0x7e62('0x1c'))]['ValidationError'](_[_0x7e62('0x67')](_0x7e62('0x57'))+'\x20not\x20found');}return _0x222eb7['download'](_0x5ae224);}})[_0x7e62('0x27')](handleError(_0x222eb7,null));};exports['gdpr']=function(_0x2681c9,_0xd79cc9){return db[_0x7e62('0x39')]['find']({'where':{'id':_0x2681c9[_0x7e62('0x52')]['id']},'attributes':[_0x7e62('0x6d')]})[_0x7e62('0x32')](respondWithResult(_0xd79cc9,null))['catch'](handleError(_0xd79cc9,null));};exports[_0x7e62('0x6e')]=function(_0x5b7d34,_0xd8244b,_0x1a79d8){if(_0x5b7d34[_0x7e62('0x54')]&&_0x5b7d34[_0x7e62('0x54')][_0x7e62('0x55')]){_0x5b7d34[_0x7e62('0x50')][_0x7e62('0x5c')]=_0x5b7d34[_0x7e62('0x54')]['filename'];}return db['Setting'][_0x7e62('0x51')]({'where':{'id':_0x5b7d34[_0x7e62('0x52')]['id']}})[_0x7e62('0x32')](handleEntityNotFound(_0xd8244b,null))[_0x7e62('0x32')](saveUpdates(_0x5b7d34[_0x7e62('0x50')],null))[_0x7e62('0x32')](respondWithResult(_0xd8244b,null))[_0x7e62('0x27')](handleError(_0xd8244b,null));};var utilLicense=require(_0x7e62('0x58'));exports[_0x7e62('0x6f')]=function(_0x108db2,_0x38b880,_0x5acb04){var _0x1a83c9=_0x7e62('0x59');var _0x5c0488={'custom':![]};return utilLicense[_0x7e62('0x5a')]()['then'](function(_0x478e44){if(_0x478e44){_0x5c0488=_0x478e44;}return db[_0x7e62('0x39')][_0x7e62('0x51')]({'where':{'id':_0x108db2[_0x7e62('0x52')]['id']},'attributes':[_0x7e62('0x5b'),_0x7e62('0x57'),'preferred',_0x7e62('0x6b'),_0x7e62('0x5d'),_0x7e62('0x5e'),_0x7e62('0x5f'),_0x7e62('0x60')],'raw':!![]});})[_0x7e62('0x32')](handleEntityNotFound(_0x38b880,null))[_0x7e62('0x32')](function(_0x337854){if(_0x337854){var _0x4807eb=_0x337854[_0x7e62('0x5c')]&&fs[_0x7e62('0x61')](path[_0x7e62('0x63')](config[_0x7e62('0x62')],_0x1a83c9,_[_0x7e62('0x64')](_0x337854[_0x7e62('0x5c')])))?path['join'](config[_0x7e62('0x62')],_0x1a83c9,_['toLower'](_0x337854['preferred'])):path['join'](config[_0x7e62('0x62')],_0x1a83c9,_['toLower'](_0x7e62('0x70')));var _0x2792a8=_0x7e62('0x66')+_[_0x7e62('0x67')](_0x7e62('0x5c'));if(_0x337854[_0x2792a8]||!_0x5c0488[_0x7e62('0x68')]||!_0x5c0488[_0x7e62('0x5c')]){_0x4807eb=path[_0x7e62('0x63')](config[_0x7e62('0x62')],_0x1a83c9,_[_0x7e62('0x64')](_0x7e62('0x70')));}if(!fs[_0x7e62('0x61')](_0x4807eb)){throw new db[(_0x7e62('0x1c'))][(_0x7e62('0x1d'))](_[_0x7e62('0x67')]('preferred')+'\x20not\x20found');}return _0x38b880[_0x7e62('0x71')](_0x4807eb);}})[_0x7e62('0x27')](handleError(_0x38b880,null));};exports[_0x7e62('0x72')]=function(_0x36c1b7,_0x162b06,_0x3bb809){if(_0x36c1b7['file']&&_0x36c1b7[_0x7e62('0x54')][_0x7e62('0x55')]){_0x36c1b7[_0x7e62('0x50')][_0x7e62('0x6b')]=_0x36c1b7[_0x7e62('0x54')][_0x7e62('0x55')];}return db[_0x7e62('0x39')][_0x7e62('0x51')]({'where':{'id':_0x36c1b7['params']['id']}})[_0x7e62('0x32')](handleEntityNotFound(_0x162b06,null))[_0x7e62('0x32')](saveUpdates(_0x36c1b7[_0x7e62('0x50')],null))[_0x7e62('0x32')](respondWithResult(_0x162b06,null))[_0x7e62('0x27')](handleError(_0x162b06,null));};var utilLicense=require(_0x7e62('0x58'));exports['getFavicon']=function(_0x4830e0,_0x566780,_0x52108f){var _0x46d3dd=_0x7e62('0x59');var _0x15ec90={'custom':![]};return utilLicense[_0x7e62('0x5a')]()['then'](function(_0x3cceb2){if(_0x3cceb2){_0x15ec90=_0x3cceb2;}return db[_0x7e62('0x39')][_0x7e62('0x51')]({'where':{'id':_0x4830e0[_0x7e62('0x52')]['id']},'attributes':[_0x7e62('0x5b'),_0x7e62('0x57'),_0x7e62('0x5c'),'favicon',_0x7e62('0x5d'),_0x7e62('0x5e'),_0x7e62('0x5f'),_0x7e62('0x60')],'raw':!![]});})[_0x7e62('0x32')](handleEntityNotFound(_0x566780,null))[_0x7e62('0x32')](function(_0x203ceb){if(_0x203ceb){var _0x5a57e6=_0x203ceb['favicon']&&fs[_0x7e62('0x61')](path[_0x7e62('0x63')](config[_0x7e62('0x62')],_0x46d3dd,_[_0x7e62('0x64')](_0x203ceb['favicon'])))?path[_0x7e62('0x63')](config['root'],_0x46d3dd,_[_0x7e62('0x64')](_0x203ceb[_0x7e62('0x6b')])):path[_0x7e62('0x63')](config[_0x7e62('0x62')],_0x46d3dd,_[_0x7e62('0x64')]('default_favicon.ico'));var _0x331956='default'+_['upperFirst'](_0x7e62('0x6b'));if(_0x203ceb[_0x331956]||!_0x15ec90[_0x7e62('0x68')]){_0x5a57e6=path['join'](config[_0x7e62('0x62')],_0x46d3dd,_['toLower']('default_favicon.ico'));}if(!fs['existsSync'](_0x5a57e6)){throw new db[(_0x7e62('0x1c'))][(_0x7e62('0x1d'))](_[_0x7e62('0x67')]('favicon')+_0x7e62('0x69'));}return _0x566780[_0x7e62('0x71')](_0x5a57e6);}})[_0x7e62('0x27')](handleError(_0x566780,null));}; \ No newline at end of file +var _0xc385=['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\x20sent','debug','Setting,\x20%s,\x20%s,\x20%s','stringify','error','code','Setting,\x20%s,\x20%s','message','info','catch','sendStatus','status','count','offset','limit','set','Content-Range','json','apply','reject','save','update','then','destroy','end','stack','name','index','map','rawAttributes','fieldName','key','model','query','filters','intersection','attributes','fields','length','nolimit','sort','where','pick','filter','merge','options','includeAll','Setting','findAll','rows','show','params','keys','include','body','find','addLogo','file','addLogoLogin','filename','server/files/images/logos','logo','loginLogo','preferred','favicon','defaultLogo','defaultPreferred','defaultFavicon','existsSync','join','toLower','root','default_logo.png','upperFirst','custom','Sequelize','\x20not\x20found','download','../../config/license/util','getLogoLogin','defaultLoginLogo','default_loginLogo.png','default','gdpr','securePassword','addPreferred','getPreferred','default_preferred.png','addFavicon','getFavicon','getLicense','default_favicon.ico','html-pdf','eml-format','zip-dir','fast-json-patch','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','api','../../config/utils','../../config/environment','../../mysqldb','client','http','test','ValidationError'];(function(_0x47da1f,_0x25305a){var _0x48c3e8=function(_0x345fc4){while(--_0x345fc4){_0x47da1f['push'](_0x47da1f['shift']());}};_0x48c3e8(++_0x25305a);}(_0xc385,0x1c5));var _0x5c38=function(_0x4b369d,_0x265eb8){_0x4b369d=_0x4b369d-0x0;var _0x571a98=_0xc385[_0x4b369d];return _0x571a98;};'use strict';var pdf=require(_0x5c38('0x0'));var emlformat=require(_0x5c38('0x1'));var rimraf=require('rimraf');var zipdir=require(_0x5c38('0x2'));var jsonpatch=require(_0x5c38('0x3'));var rp=require('request-promise');var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x5c38('0x4'));var util=require(_0x5c38('0x5'));var path=require(_0x5c38('0x6'));var sox=require(_0x5c38('0x7'));var csv=require(_0x5c38('0x8'));var ejs=require(_0x5c38('0x9'));var fs=require('fs');var _=require(_0x5c38('0xa'));var squel=require(_0x5c38('0xb'));var crypto=require(_0x5c38('0xc'));var jsforce=require(_0x5c38('0xd'));var deskjs=require(_0x5c38('0xe'));var toCsv=require(_0x5c38('0x8'));var querystring=require(_0x5c38('0xf'));var Papa=require(_0x5c38('0x10'));var Redis=require('ioredis');var authService=require(_0x5c38('0x11'));var qs=require(_0x5c38('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x5c38('0x13'));var utils=require(_0x5c38('0x14'));var config=require(_0x5c38('0x15'));var db=require(_0x5c38('0x16'))['db'];var jayson=require('jayson/promise');var client=jayson[_0x5c38('0x17')][_0x5c38('0x18')]({'port':0x232a});function checkPasswordPattern(_0x4334e6,_0xac9a00,_0x1b540f){if(_0x1b540f){var _0x22cbd2=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x22cbd2[_0x5c38('0x19')](_0xac9a00)){return _0x4334e6;}else{throw new db['Sequelize'][(_0x5c38('0x1a'))](_0x5c38('0x1b'));}}else{return _0x4334e6;}}function respondWithRpcPromise(_0x2e8f3d,_0x55d1b6,_0x3aaec7,_0x329769){return new BPromise(function(_0x5417b1,_0x1d093b){var _0x37883c=_0x329769||client;return _0x37883c['request'](_0x2e8f3d,_0x3aaec7)['then'](function(_0x2b93f2){logger['info']('Setting,\x20%s,\x20%s',_0x55d1b6,_0x5c38('0x1c'));logger[_0x5c38('0x1d')](_0x5c38('0x1e'),_0x55d1b6,_0x5c38('0x1c'),JSON[_0x5c38('0x1f')](_0x2b93f2));if(_0x2b93f2[_0x5c38('0x20')]){if(_0x2b93f2['error'][_0x5c38('0x21')]===0x1f4){logger[_0x5c38('0x20')](_0x5c38('0x22'),_0x55d1b6,_0x2b93f2['error'][_0x5c38('0x23')]);return _0x1d093b(_0x2b93f2['error'][_0x5c38('0x23')]);}logger[_0x5c38('0x20')](_0x5c38('0x22'),_0x55d1b6,_0x2b93f2[_0x5c38('0x20')][_0x5c38('0x23')]);return _0x5417b1(_0x2b93f2[_0x5c38('0x20')]['message']);}else{logger[_0x5c38('0x24')](_0x5c38('0x22'),_0x55d1b6,_0x5c38('0x1c'));_0x5417b1(_0x2b93f2['result'][_0x5c38('0x23')]);}})[_0x5c38('0x25')](function(_0x180433){logger[_0x5c38('0x20')](_0x5c38('0x22'),_0x55d1b6,_0x180433);_0x1d093b(_0x180433);});});}function respondWithStatusCode(_0x3960c3,_0x87a97f){_0x87a97f=_0x87a97f||0xcc;return function(_0x3ea616){if(_0x3ea616){return _0x3960c3[_0x5c38('0x26')](_0x87a97f);}return _0x3960c3[_0x5c38('0x27')](_0x87a97f)['end']();};}function respondWithResult(_0x542990,_0x421426){_0x421426=_0x421426||0xc8;return function(_0x12f035){if(_0x12f035){return _0x542990[_0x5c38('0x27')](_0x421426)['json'](_0x12f035);}};}function respondWithFilteredResult(_0x5f0a6f,_0x55fb87){return function(_0x5846a5){if(_0x5846a5){var _0x3b412d=_0x5846a5[_0x5c38('0x28')],_0x5d4cb1=_0x55fb87[_0x5c38('0x29')],_0x5cf8ae=_0x55fb87[_0x5c38('0x29')]+_0x55fb87[_0x5c38('0x2a')],_0x21f958;if(_0x5cf8ae>=_0x3b412d){_0x5cf8ae=_0x3b412d;_0x21f958=0xc8;}else{_0x21f958=0xce;}_0x5f0a6f[_0x5c38('0x27')](_0x21f958);return _0x5f0a6f[_0x5c38('0x2b')](_0x5c38('0x2c'),_0x5d4cb1+'-'+_0x5cf8ae+'/'+_0x3b412d)[_0x5c38('0x2d')](_0x5846a5);}return null;};}function patchUpdates(_0x16ba5c){return function(_0x4b5380){try{jsonpatch[_0x5c38('0x2e')](_0x4b5380,_0x16ba5c,!![]);}catch(_0x1a7ddb){return BPromise[_0x5c38('0x2f')](_0x1a7ddb);}return _0x4b5380[_0x5c38('0x30')]();};}function saveUpdates(_0x37b7fb,_0x5d3d03){return function(_0x24ec14){if(_0x24ec14){return _0x24ec14[_0x5c38('0x31')](_0x37b7fb)[_0x5c38('0x32')](function(_0x4d1a28){return _0x4d1a28;});}return null;};}function removeEntity(_0x584c55,_0x41c350){return function(_0x535c69){if(_0x535c69){return _0x535c69[_0x5c38('0x33')]()['then'](function(){_0x584c55['status'](0xcc)[_0x5c38('0x34')]();});}};}function handleEntityNotFound(_0x596175,_0x4801b6){return function(_0x3a8b76){if(!_0x3a8b76){_0x596175[_0x5c38('0x26')](0x194);}return _0x3a8b76;};}function handleError(_0x2f6da0,_0x390015){_0x390015=_0x390015||0x1f4;return function(_0x2a5851){logger[_0x5c38('0x20')](_0x2a5851[_0x5c38('0x35')]);if(_0x2a5851[_0x5c38('0x36')]){delete _0x2a5851[_0x5c38('0x36')];}_0x2f6da0[_0x5c38('0x27')](_0x390015)['send'](_0x2a5851);};}exports[_0x5c38('0x37')]=function(_0x43b733,_0x935204){var _0x3f267d={},_0x31bdc4={},_0x22d190={'count':0x0,'rows':[]};var _0x1f4d46=_[_0x5c38('0x38')](db['Setting'][_0x5c38('0x39')],function(_0x58c39d){return{'name':_0x58c39d[_0x5c38('0x3a')],'type':_0x58c39d['type'][_0x5c38('0x3b')]};});_0x31bdc4[_0x5c38('0x3c')]=_['map'](_0x1f4d46,_0x5c38('0x36'));_0x31bdc4[_0x5c38('0x3d')]=_['keys'](_0x43b733[_0x5c38('0x3d')]);_0x31bdc4[_0x5c38('0x3e')]=_[_0x5c38('0x3f')](_0x31bdc4[_0x5c38('0x3c')],_0x31bdc4['query']);_0x3f267d[_0x5c38('0x40')]=_[_0x5c38('0x3f')](_0x31bdc4['model'],qs[_0x5c38('0x41')](_0x43b733[_0x5c38('0x3d')][_0x5c38('0x41')]));_0x3f267d[_0x5c38('0x40')]=_0x3f267d[_0x5c38('0x40')][_0x5c38('0x42')]?_0x3f267d[_0x5c38('0x40')]:_0x31bdc4['model'];if(!_0x43b733['query']['hasOwnProperty'](_0x5c38('0x43'))){_0x3f267d[_0x5c38('0x2a')]=qs[_0x5c38('0x2a')](_0x43b733[_0x5c38('0x3d')][_0x5c38('0x2a')]);_0x3f267d[_0x5c38('0x29')]=qs[_0x5c38('0x29')](_0x43b733['query'][_0x5c38('0x29')]);}_0x3f267d['order']=qs[_0x5c38('0x44')](_0x43b733['query'][_0x5c38('0x44')]);_0x3f267d[_0x5c38('0x45')]=qs[_0x5c38('0x3e')](_[_0x5c38('0x46')](_0x43b733['query'],_0x31bdc4[_0x5c38('0x3e')]));if(_0x43b733[_0x5c38('0x3d')][_0x5c38('0x47')]){_0x3f267d['where']=_['merge'](_0x3f267d['where'],{'$or':_[_0x5c38('0x38')](_0x1f4d46,function(_0x5b98c4){if(_0x5b98c4['type']!=='VIRTUAL'){var _0x2c1662={};_0x2c1662[_0x5b98c4[_0x5c38('0x36')]]={'$like':'%'+_0x43b733[_0x5c38('0x3d')][_0x5c38('0x47')]+'%'};return _0x2c1662;}})});}_0x3f267d=_[_0x5c38('0x48')]({},_0x3f267d,_0x43b733[_0x5c38('0x49')]);var _0x1a7ae3={'where':_0x3f267d[_0x5c38('0x45')]};return db['Setting']['count'](_0x1a7ae3)[_0x5c38('0x32')](function(_0x637a59){_0x22d190[_0x5c38('0x28')]=_0x637a59;if(_0x43b733['query'][_0x5c38('0x4a')]){_0x3f267d['include']=[{'all':!![]}];}return db[_0x5c38('0x4b')][_0x5c38('0x4c')](_0x3f267d);})['then'](function(_0x519f21){_0x22d190[_0x5c38('0x4d')]=_0x519f21;return _0x22d190;})[_0x5c38('0x32')](respondWithFilteredResult(_0x935204,_0x3f267d))[_0x5c38('0x25')](handleError(_0x935204,null));};exports[_0x5c38('0x4e')]=function(_0x168c73,_0x51fddc){var _0x268dc4={'raw':![],'where':{'id':_0x168c73[_0x5c38('0x4f')]['id']}},_0x2ce651={};_0x2ce651['model']=_[_0x5c38('0x50')](db['Setting'][_0x5c38('0x39')]);_0x2ce651['query']=_[_0x5c38('0x50')](_0x168c73[_0x5c38('0x3d')]);_0x2ce651[_0x5c38('0x3e')]=_[_0x5c38('0x3f')](_0x2ce651['model'],_0x2ce651[_0x5c38('0x3d')]);_0x268dc4[_0x5c38('0x40')]=_[_0x5c38('0x3f')](_0x2ce651[_0x5c38('0x3c')],qs[_0x5c38('0x41')](_0x168c73[_0x5c38('0x3d')][_0x5c38('0x41')]));_0x268dc4[_0x5c38('0x40')]=_0x268dc4[_0x5c38('0x40')][_0x5c38('0x42')]?_0x268dc4['attributes']:_0x2ce651[_0x5c38('0x3c')];if(_0x168c73[_0x5c38('0x3d')][_0x5c38('0x4a')]){_0x268dc4[_0x5c38('0x51')]=[{'all':!![]}];}_0x268dc4=_[_0x5c38('0x48')]({},_0x268dc4,_0x168c73['options']);return db[_0x5c38('0x4b')]['find'](_0x268dc4)[_0x5c38('0x32')](handleEntityNotFound(_0x51fddc,null))[_0x5c38('0x32')](respondWithResult(_0x51fddc,null))[_0x5c38('0x25')](handleError(_0x51fddc,null));};exports['update']=function(_0x3daca9,_0xc2c896){if(_0x3daca9['body']['id']){delete _0x3daca9[_0x5c38('0x52')]['id'];}return db[_0x5c38('0x4b')][_0x5c38('0x53')]({'where':{'id':_0x3daca9['params']['id']}})[_0x5c38('0x32')](handleEntityNotFound(_0xc2c896,null))[_0x5c38('0x32')](saveUpdates(_0x3daca9['body'],null))['then'](respondWithResult(_0xc2c896,null))['catch'](handleError(_0xc2c896,null));};exports[_0x5c38('0x54')]=function(_0x9e9c9a,_0x335e65,_0x3ea790){if(_0x9e9c9a[_0x5c38('0x55')]&&_0x9e9c9a[_0x5c38('0x55')]['filename']){_0x9e9c9a[_0x5c38('0x52')]['logo']=_0x9e9c9a['file']['filename'];}return db[_0x5c38('0x4b')][_0x5c38('0x53')]({'where':{'id':_0x9e9c9a[_0x5c38('0x4f')]['id']}})[_0x5c38('0x32')](handleEntityNotFound(_0x335e65,null))[_0x5c38('0x32')](saveUpdates(_0x9e9c9a[_0x5c38('0x52')],null))[_0x5c38('0x32')](respondWithResult(_0x335e65,null))[_0x5c38('0x25')](handleError(_0x335e65,null));};exports[_0x5c38('0x56')]=function(_0x403afa,_0x7f48b4,_0x31da2e){if(_0x403afa[_0x5c38('0x55')]&&_0x403afa[_0x5c38('0x55')]['filename']){_0x403afa['body']['loginLogo']=_0x403afa[_0x5c38('0x55')][_0x5c38('0x57')];}return db[_0x5c38('0x4b')][_0x5c38('0x53')]({'where':{'id':_0x403afa[_0x5c38('0x4f')]['id']}})[_0x5c38('0x32')](handleEntityNotFound(_0x7f48b4,null))[_0x5c38('0x32')](saveUpdates(_0x403afa[_0x5c38('0x52')],null))[_0x5c38('0x32')](respondWithResult(_0x7f48b4,null))[_0x5c38('0x25')](handleError(_0x7f48b4,null));};var utilLicense=require('../../config/license/util');exports['getLogo']=function(_0x14eb8c,_0x2e90ff,_0x7c54b8){var _0x145e63=_0x5c38('0x58');var _0x558898={'custom':![]};return utilLicense['getLicense']()['then'](function(_0x68c87f){if(_0x68c87f){_0x558898=_0x68c87f;}return db['Setting'][_0x5c38('0x53')]({'where':{'id':_0x14eb8c[_0x5c38('0x4f')]['id']},'attributes':[_0x5c38('0x59'),_0x5c38('0x5a'),_0x5c38('0x5b'),_0x5c38('0x5c'),_0x5c38('0x5d'),'defaultLoginLogo',_0x5c38('0x5e'),_0x5c38('0x5f')],'raw':!![]});})[_0x5c38('0x32')](handleEntityNotFound(_0x2e90ff,null))[_0x5c38('0x32')](function(_0x175e3){if(_0x175e3){var _0x23ca01=_0x175e3[_0x5c38('0x59')]&&fs[_0x5c38('0x60')](path[_0x5c38('0x61')](config['root'],_0x145e63,_[_0x5c38('0x62')](_0x175e3[_0x5c38('0x59')])))?path[_0x5c38('0x61')](config[_0x5c38('0x63')],_0x145e63,_[_0x5c38('0x62')](_0x175e3[_0x5c38('0x59')])):path[_0x5c38('0x61')](config['root'],_0x145e63,_[_0x5c38('0x62')](_0x5c38('0x64')));var _0x4078ba='default'+_[_0x5c38('0x65')]('logo');if(_0x175e3[_0x4078ba]||!_0x558898[_0x5c38('0x66')]){_0x23ca01=path[_0x5c38('0x61')](config[_0x5c38('0x63')],_0x145e63,_['toLower']('default_logo.png'));}if(!fs[_0x5c38('0x60')](_0x23ca01)){throw new db[(_0x5c38('0x67'))][(_0x5c38('0x1a'))](_[_0x5c38('0x65')]('logo')+_0x5c38('0x68'));}return _0x2e90ff[_0x5c38('0x69')](_0x23ca01);}})[_0x5c38('0x25')](handleError(_0x2e90ff,null));};var utilLicense=require(_0x5c38('0x6a'));exports[_0x5c38('0x6b')]=function(_0x52672f,_0x1b2650,_0x14ec7f){var _0x3627ff=_0x5c38('0x58');var _0x182536={'custom':![]};return utilLicense['getLicense']()[_0x5c38('0x32')](function(_0x407d82){if(_0x407d82){_0x182536=_0x407d82;}return db[_0x5c38('0x4b')][_0x5c38('0x53')]({'where':{'id':_0x52672f[_0x5c38('0x4f')]['id']},'attributes':[_0x5c38('0x59'),_0x5c38('0x5a'),'preferred','favicon','defaultLogo',_0x5c38('0x6c'),_0x5c38('0x5e'),_0x5c38('0x5f')],'raw':!![]});})[_0x5c38('0x32')](handleEntityNotFound(_0x1b2650,null))[_0x5c38('0x32')](function(_0x2750a5){if(_0x2750a5){var _0x2fa423=_0x2750a5[_0x5c38('0x5a')]&&fs[_0x5c38('0x60')](path[_0x5c38('0x61')](config['root'],_0x3627ff,_[_0x5c38('0x62')](_0x2750a5['loginLogo'])))?path[_0x5c38('0x61')](config[_0x5c38('0x63')],_0x3627ff,_[_0x5c38('0x62')](_0x2750a5[_0x5c38('0x5a')])):path['join'](config['root'],_0x3627ff,_['toLower'](_0x5c38('0x6d')));var _0x18b114=_0x5c38('0x6e')+_[_0x5c38('0x65')](_0x5c38('0x5a'));if(_0x2750a5[_0x18b114]||!_0x182536['custom']){_0x2fa423=path['join'](config[_0x5c38('0x63')],_0x3627ff,_[_0x5c38('0x62')](_0x5c38('0x6d')));}if(!fs[_0x5c38('0x60')](_0x2fa423)){throw new db[(_0x5c38('0x67'))][(_0x5c38('0x1a'))](_[_0x5c38('0x65')](_0x5c38('0x5a'))+_0x5c38('0x68'));}return _0x1b2650[_0x5c38('0x69')](_0x2fa423);}})[_0x5c38('0x25')](handleError(_0x1b2650,null));};exports[_0x5c38('0x6f')]=function(_0x3310ad,_0x4c17de){return db[_0x5c38('0x4b')][_0x5c38('0x53')]({'where':{'id':_0x3310ad['params']['id']},'attributes':[_0x5c38('0x70')]})[_0x5c38('0x32')](respondWithResult(_0x4c17de,null))[_0x5c38('0x25')](handleError(_0x4c17de,null));};exports[_0x5c38('0x71')]=function(_0x5a6163,_0x90a5ee,_0x5387f1){if(_0x5a6163[_0x5c38('0x55')]&&_0x5a6163[_0x5c38('0x55')]['filename']){_0x5a6163[_0x5c38('0x52')][_0x5c38('0x5b')]=_0x5a6163[_0x5c38('0x55')][_0x5c38('0x57')];}return db['Setting'][_0x5c38('0x53')]({'where':{'id':_0x5a6163[_0x5c38('0x4f')]['id']}})[_0x5c38('0x32')](handleEntityNotFound(_0x90a5ee,null))['then'](saveUpdates(_0x5a6163[_0x5c38('0x52')],null))[_0x5c38('0x32')](respondWithResult(_0x90a5ee,null))[_0x5c38('0x25')](handleError(_0x90a5ee,null));};var utilLicense=require(_0x5c38('0x6a'));exports[_0x5c38('0x72')]=function(_0x5eeb35,_0x1fb077,_0x4a3df5){var _0x55a3bb=_0x5c38('0x58');var _0x116648={'custom':![]};return utilLicense['getLicense']()[_0x5c38('0x32')](function(_0x41d684){if(_0x41d684){_0x116648=_0x41d684;}return db[_0x5c38('0x4b')][_0x5c38('0x53')]({'where':{'id':_0x5eeb35[_0x5c38('0x4f')]['id']},'attributes':[_0x5c38('0x59'),_0x5c38('0x5a'),'preferred',_0x5c38('0x5c'),'defaultLogo',_0x5c38('0x6c'),'defaultPreferred',_0x5c38('0x5f')],'raw':!![]});})[_0x5c38('0x32')](handleEntityNotFound(_0x1fb077,null))[_0x5c38('0x32')](function(_0x59c1ed){if(_0x59c1ed){var _0x3df5c4=_0x59c1ed[_0x5c38('0x5b')]&&fs['existsSync'](path[_0x5c38('0x61')](config['root'],_0x55a3bb,_[_0x5c38('0x62')](_0x59c1ed['preferred'])))?path[_0x5c38('0x61')](config[_0x5c38('0x63')],_0x55a3bb,_['toLower'](_0x59c1ed[_0x5c38('0x5b')])):path['join'](config['root'],_0x55a3bb,_['toLower'](_0x5c38('0x73')));var _0x245b87='default'+_['upperFirst']('preferred');if(_0x59c1ed[_0x245b87]||!_0x116648[_0x5c38('0x66')]||!_0x116648['preferred']){_0x3df5c4=path[_0x5c38('0x61')](config[_0x5c38('0x63')],_0x55a3bb,_[_0x5c38('0x62')](_0x5c38('0x73')));}if(!fs[_0x5c38('0x60')](_0x3df5c4)){throw new db[(_0x5c38('0x67'))][(_0x5c38('0x1a'))](_[_0x5c38('0x65')](_0x5c38('0x5b'))+_0x5c38('0x68'));}return _0x1fb077[_0x5c38('0x69')](_0x3df5c4);}})[_0x5c38('0x25')](handleError(_0x1fb077,null));};exports[_0x5c38('0x74')]=function(_0x1e609d,_0x57250b,_0x52ce08){if(_0x1e609d['file']&&_0x1e609d['file']['filename']){_0x1e609d[_0x5c38('0x52')][_0x5c38('0x5c')]=_0x1e609d[_0x5c38('0x55')][_0x5c38('0x57')];}return db[_0x5c38('0x4b')][_0x5c38('0x53')]({'where':{'id':_0x1e609d[_0x5c38('0x4f')]['id']}})['then'](handleEntityNotFound(_0x57250b,null))[_0x5c38('0x32')](saveUpdates(_0x1e609d[_0x5c38('0x52')],null))[_0x5c38('0x32')](respondWithResult(_0x57250b,null))[_0x5c38('0x25')](handleError(_0x57250b,null));};var utilLicense=require(_0x5c38('0x6a'));exports[_0x5c38('0x75')]=function(_0x4259a4,_0x5b7994,_0x4e5290){var _0x5cf180='server/files/images/logos';var _0x3934c9={'custom':![]};return utilLicense[_0x5c38('0x76')]()['then'](function(_0x58208e){if(_0x58208e){_0x3934c9=_0x58208e;}return db[_0x5c38('0x4b')]['find']({'where':{'id':_0x4259a4[_0x5c38('0x4f')]['id']},'attributes':[_0x5c38('0x59'),_0x5c38('0x5a'),'preferred','favicon',_0x5c38('0x5d'),'defaultLoginLogo',_0x5c38('0x5e'),_0x5c38('0x5f')],'raw':!![]});})[_0x5c38('0x32')](handleEntityNotFound(_0x5b7994,null))[_0x5c38('0x32')](function(_0x2fb96e){if(_0x2fb96e){var _0x5d0b98=_0x2fb96e['favicon']&&fs[_0x5c38('0x60')](path['join'](config[_0x5c38('0x63')],_0x5cf180,_['toLower'](_0x2fb96e[_0x5c38('0x5c')])))?path[_0x5c38('0x61')](config['root'],_0x5cf180,_[_0x5c38('0x62')](_0x2fb96e[_0x5c38('0x5c')])):path[_0x5c38('0x61')](config[_0x5c38('0x63')],_0x5cf180,_[_0x5c38('0x62')](_0x5c38('0x77')));var _0x4e9af2=_0x5c38('0x6e')+_[_0x5c38('0x65')](_0x5c38('0x5c'));if(_0x2fb96e[_0x4e9af2]||!_0x3934c9[_0x5c38('0x66')]){_0x5d0b98=path[_0x5c38('0x61')](config[_0x5c38('0x63')],_0x5cf180,_['toLower'](_0x5c38('0x77')));}if(!fs[_0x5c38('0x60')](_0x5d0b98)){throw new db[(_0x5c38('0x67'))][(_0x5c38('0x1a'))](_[_0x5c38('0x65')](_0x5c38('0x5c'))+_0x5c38('0x68'));}return _0x5b7994[_0x5c38('0x69')](_0x5d0b98);}})[_0x5c38('0x25')](handleError(_0x5b7994,null));}; \ No newline at end of file diff --git a/server/api/setting/setting.model.js b/server/api/setting/setting.model.js index 7a8a0ef..3e60488 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 _0x8bd9=['bluebird','path','rimraf','define','Setting','settings','lodash','util','moment'];(function(_0x1c6ef2,_0x8d926a){var _0x404b8c=function(_0x4fdf1e){while(--_0x4fdf1e){_0x1c6ef2['push'](_0x1c6ef2['shift']());}};_0x404b8c(++_0x8d926a);}(_0x8bd9,0x84));var _0x98bd=function(_0x52ece1,_0x425dc5){_0x52ece1=_0x52ece1-0x0;var _0x329205=_0x8bd9[_0x52ece1];return _0x329205;};'use strict';var _=require(_0x98bd('0x0'));var util=require(_0x98bd('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0x98bd('0x2'));var BPromise=require(_0x98bd('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x98bd('0x4'));var rimraf=require(_0x98bd('0x5'));var config=require('../../config/environment');var attributes=require('./setting.attributes');module['exports']=function(_0x7634ff,_0x650b94){return _0x7634ff[_0x98bd('0x6')](_0x98bd('0x7'),attributes,{'tableName':_0x98bd('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x3fdc=['util','bluebird','request-promise','../../config/environment','./setting.attributes','exports','define','Setting','settings'];(function(_0x215e65,_0x183f97){var _0xa85842=function(_0x43bf45){while(--_0x43bf45){_0x215e65['push'](_0x215e65['shift']());}};_0xa85842(++_0x183f97);}(_0x3fdc,0x117));var _0xc3fd=function(_0x27053f,_0x563ff5){_0x27053f=_0x27053f-0x0;var _0x20ad84=_0x3fdc[_0x27053f];return _0x20ad84;};'use strict';var _=require('lodash');var util=require(_0xc3fd('0x0'));var logger=require('../../config/logger')('api');var moment=require('moment');var BPromise=require(_0xc3fd('0x1'));var rp=require(_0xc3fd('0x2'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0xc3fd('0x3'));var attributes=require(_0xc3fd('0x4'));module[_0xc3fd('0x5')]=function(_0x570f16,_0x2e0634){return _0x570f16[_0xc3fd('0x6')](_0xc3fd('0x7'),attributes,{'tableName':_0xc3fd('0x8'),'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 97f0def..9c57ad6 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 _0xa175=['Setting,\x20%s,\x20%s','message','result','catch','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','info','request\x20sent','debug','Setting,\x20%s,\x20%s,\x20%s','stringify','error','code'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xa175,0x64));var _0x5a17=function(_0x596de2,_0x31cce3){_0x596de2=_0x596de2-0x0;var _0xe22c12=_0xa175[_0x596de2];return _0xe22c12;};'use strict';var _=require(_0x5a17('0x0'));var util=require(_0x5a17('0x1'));var moment=require('moment');var BPromise=require(_0x5a17('0x2'));var rs=require(_0x5a17('0x3'));var fs=require('fs');var Redis=require(_0x5a17('0x4'));var db=require(_0x5a17('0x5'))['db'];var utils=require(_0x5a17('0x6'));var logger=require(_0x5a17('0x7'))(_0x5a17('0x8'));var config=require(_0x5a17('0x9'));var jayson=require(_0x5a17('0xa'));var client=jayson[_0x5a17('0xb')][_0x5a17('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x224eec,_0x2c1da5,_0x2bd798){return new BPromise(function(_0x485ec9,_0xfaece9){return client['request'](_0x224eec,_0x2bd798)['then'](function(_0x426bc9){logger[_0x5a17('0xd')]('Setting,\x20%s,\x20%s',_0x2c1da5,_0x5a17('0xe'));logger[_0x5a17('0xf')](_0x5a17('0x10'),_0x2c1da5,'request\x20sent',JSON[_0x5a17('0x11')](_0x426bc9));if(_0x426bc9['error']){if(_0x426bc9[_0x5a17('0x12')][_0x5a17('0x13')]===0x1f4){logger[_0x5a17('0x12')](_0x5a17('0x14'),_0x2c1da5,_0x426bc9[_0x5a17('0x12')]['message']);return _0xfaece9(_0x426bc9['error']['message']);}logger[_0x5a17('0x12')](_0x5a17('0x14'),_0x2c1da5,_0x426bc9[_0x5a17('0x12')]['message']);return _0x485ec9(_0x426bc9['error'][_0x5a17('0x15')]);}else{logger[_0x5a17('0xd')]('Setting,\x20%s,\x20%s',_0x2c1da5,_0x5a17('0xe'));_0x485ec9(_0x426bc9[_0x5a17('0x16')][_0x5a17('0x15')]);}})[_0x5a17('0x17')](function(_0x5ed7ab){logger['error'](_0x5a17('0x14'),_0x2c1da5,_0x5ed7ab);_0xfaece9(_0x5ed7ab);});});} \ No newline at end of file +var _0x3cf7=['lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','jayson/promise','client','http','request','then','info','Setting,\x20%s,\x20%s','Setting,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','result','catch'];(function(_0x3dd531,_0xedaa84){var _0x299141=function(_0x2ca740){while(--_0x2ca740){_0x3dd531['push'](_0x3dd531['shift']());}};_0x299141(++_0xedaa84);}(_0x3cf7,0x1b9));var _0x73cf=function(_0x5caf7e,_0x52e1bc){_0x5caf7e=_0x5caf7e-0x0;var _0x5c3435=_0x3cf7[_0x5caf7e];return _0x5c3435;};'use strict';var _=require(_0x73cf('0x0'));var util=require(_0x73cf('0x1'));var moment=require(_0x73cf('0x2'));var BPromise=require(_0x73cf('0x3'));var rs=require(_0x73cf('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x73cf('0x5'))['db'];var utils=require(_0x73cf('0x6'));var logger=require('../../config/logger')('rpc');var config=require('../../config/environment');var jayson=require(_0x73cf('0x7'));var client=jayson[_0x73cf('0x8')][_0x73cf('0x9')]({'port':0x232a});function respondWithRpcPromise(_0xda5112,_0x8daac0,_0x441c05){return new BPromise(function(_0x42450f,_0x2cc4cc){return client[_0x73cf('0xa')](_0xda5112,_0x441c05)[_0x73cf('0xb')](function(_0xc99ade){logger[_0x73cf('0xc')](_0x73cf('0xd'),_0x8daac0,'request\x20sent');logger['debug'](_0x73cf('0xe'),_0x8daac0,_0x73cf('0xf'),JSON[_0x73cf('0x10')](_0xc99ade));if(_0xc99ade[_0x73cf('0x11')]){if(_0xc99ade[_0x73cf('0x11')]['code']===0x1f4){logger[_0x73cf('0x11')](_0x73cf('0xd'),_0x8daac0,_0xc99ade[_0x73cf('0x11')][_0x73cf('0x12')]);return _0x2cc4cc(_0xc99ade[_0x73cf('0x11')][_0x73cf('0x12')]);}logger[_0x73cf('0x11')](_0x73cf('0xd'),_0x8daac0,_0xc99ade[_0x73cf('0x11')]['message']);return _0x42450f(_0xc99ade[_0x73cf('0x11')][_0x73cf('0x12')]);}else{logger[_0x73cf('0xc')](_0x73cf('0xd'),_0x8daac0,_0x73cf('0xf'));_0x42450f(_0xc99ade[_0x73cf('0x13')][_0x73cf('0x12')]);}})[_0x73cf('0x14')](function(_0x115c84){logger[_0x73cf('0x11')](_0x73cf('0xd'),_0x8daac0,_0x115c84);_0x2cc4cc(_0x115c84);});});} \ No newline at end of file diff --git a/server/api/smsAccount/index.js b/server/api/smsAccount/index.js index efe91ab..6a4eba9 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 _0xc826=['connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./smsAccount.controller','get','index','/describe','isAuthenticated','/:id','show','/:id/dispositions','getDispositions','/:id/canned_answers','getAnswers','/:id/applications','getApplications','/:id/status','statusGet','/:id/users','getAgents','post','create','addDisposition','/:id/notify','notify','/:id/send','send','addAgents','delete','destroy','removeDispositions','removeAnswers','removeAgents','multer','path'];(function(_0x119cd8,_0x556b73){var _0x7072a3=function(_0x5908d1){while(--_0x5908d1){_0x119cd8['push'](_0x119cd8['shift']());}};_0x7072a3(++_0x556b73);}(_0xc826,0x12e));var _0x6c82=function(_0x15ad40,_0x4c2ebc){_0x15ad40=_0x15ad40-0x0;var _0x164738=_0xc826[_0x15ad40];return _0x164738;};'use strict';var multer=require(_0x6c82('0x0'));var util=require('util');var path=require(_0x6c82('0x1'));var timeout=require(_0x6c82('0x2'));var express=require(_0x6c82('0x3'));var router=express[_0x6c82('0x4')]();var auth=require(_0x6c82('0x5'));var interaction=require(_0x6c82('0x6'));var config=require(_0x6c82('0x7'));var controller=require(_0x6c82('0x8'));router[_0x6c82('0x9')]('/',auth['isAuthenticated'](),controller[_0x6c82('0xa')]);router['get'](_0x6c82('0xb'),auth[_0x6c82('0xc')](),controller['describe']);router['get'](_0x6c82('0xd'),auth[_0x6c82('0xc')](),controller[_0x6c82('0xe')]);router[_0x6c82('0x9')](_0x6c82('0xf'),auth[_0x6c82('0xc')](),controller[_0x6c82('0x10')]);router[_0x6c82('0x9')](_0x6c82('0x11'),auth[_0x6c82('0xc')](),controller[_0x6c82('0x12')]);router[_0x6c82('0x9')](_0x6c82('0x13'),auth[_0x6c82('0xc')](),controller[_0x6c82('0x14')]);router['get']('/:id/interactions',auth[_0x6c82('0xc')](),controller['getInteractions']);router[_0x6c82('0x9')](_0x6c82('0x15'),controller[_0x6c82('0x16')]);router[_0x6c82('0x9')](_0x6c82('0x17'),auth[_0x6c82('0xc')](),controller[_0x6c82('0x18')]);router[_0x6c82('0x19')]('/',auth[_0x6c82('0xc')](),controller[_0x6c82('0x1a')]);router['post']('/:id/dispositions',auth[_0x6c82('0xc')](),controller[_0x6c82('0x1b')]);router[_0x6c82('0x19')](_0x6c82('0x11'),auth[_0x6c82('0xc')](),controller['addAnswer']);router[_0x6c82('0x19')](_0x6c82('0x1c'),controller[_0x6c82('0x1d')]);router[_0x6c82('0x19')](_0x6c82('0x13'),auth[_0x6c82('0xc')](),controller['addApplications']);router['post'](_0x6c82('0x1e'),auth[_0x6c82('0xc')](),controller[_0x6c82('0x1f')]);router[_0x6c82('0x19')](_0x6c82('0x15'),controller['status']);router[_0x6c82('0x19')](_0x6c82('0x17'),auth[_0x6c82('0xc')](),controller[_0x6c82('0x20')]);router['put'](_0x6c82('0xd'),auth[_0x6c82('0xc')](),controller['update']);router[_0x6c82('0x21')](_0x6c82('0xd'),auth[_0x6c82('0xc')](),controller[_0x6c82('0x22')]);router[_0x6c82('0x21')](_0x6c82('0xf'),auth[_0x6c82('0xc')](),controller[_0x6c82('0x23')]);router['delete'](_0x6c82('0x11'),auth[_0x6c82('0xc')](),controller[_0x6c82('0x24')]);router[_0x6c82('0x21')](_0x6c82('0x17'),auth[_0x6c82('0xc')](),controller[_0x6c82('0x25')]);module['exports']=router; \ No newline at end of file +var _0xc969=['/:id/notify','notify','/:id/applications','addApplications','/:id/send','send','addAgents','put','update','destroy','delete','removeAgents','exports','multer','util','path','connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment','./smsAccount.controller','get','isAuthenticated','index','/describe','/:id','show','/:id/dispositions','/:id/canned_answers','getAnswers','getApplications','/:id/interactions','statusGet','/:id/users','getAgents','post','create','addDisposition','addAnswer'];(function(_0x2af5bd,_0x1465b9){var _0x294d2f=function(_0x5013e3){while(--_0x5013e3){_0x2af5bd['push'](_0x2af5bd['shift']());}};_0x294d2f(++_0x1465b9);}(_0xc969,0x1ed));var _0x9c96=function(_0x455c6c,_0x1e78b7){_0x455c6c=_0x455c6c-0x0;var _0x488242=_0xc969[_0x455c6c];return _0x488242;};'use strict';var multer=require(_0x9c96('0x0'));var util=require(_0x9c96('0x1'));var path=require(_0x9c96('0x2'));var timeout=require(_0x9c96('0x3'));var express=require(_0x9c96('0x4'));var router=express['Router']();var auth=require(_0x9c96('0x5'));var interaction=require(_0x9c96('0x6'));var config=require(_0x9c96('0x7'));var controller=require(_0x9c96('0x8'));router[_0x9c96('0x9')]('/',auth[_0x9c96('0xa')](),controller[_0x9c96('0xb')]);router['get'](_0x9c96('0xc'),auth['isAuthenticated'](),controller['describe']);router[_0x9c96('0x9')](_0x9c96('0xd'),auth[_0x9c96('0xa')](),controller[_0x9c96('0xe')]);router[_0x9c96('0x9')](_0x9c96('0xf'),auth[_0x9c96('0xa')](),controller['getDispositions']);router[_0x9c96('0x9')](_0x9c96('0x10'),auth[_0x9c96('0xa')](),controller[_0x9c96('0x11')]);router['get']('/:id/applications',auth[_0x9c96('0xa')](),controller[_0x9c96('0x12')]);router[_0x9c96('0x9')](_0x9c96('0x13'),auth[_0x9c96('0xa')](),controller['getInteractions']);router[_0x9c96('0x9')]('/:id/status',controller[_0x9c96('0x14')]);router[_0x9c96('0x9')](_0x9c96('0x15'),auth['isAuthenticated'](),controller[_0x9c96('0x16')]);router[_0x9c96('0x17')]('/',auth[_0x9c96('0xa')](),controller[_0x9c96('0x18')]);router[_0x9c96('0x17')](_0x9c96('0xf'),auth['isAuthenticated'](),controller[_0x9c96('0x19')]);router[_0x9c96('0x17')](_0x9c96('0x10'),auth[_0x9c96('0xa')](),controller[_0x9c96('0x1a')]);router[_0x9c96('0x17')](_0x9c96('0x1b'),controller[_0x9c96('0x1c')]);router[_0x9c96('0x17')](_0x9c96('0x1d'),auth[_0x9c96('0xa')](),controller[_0x9c96('0x1e')]);router['post'](_0x9c96('0x1f'),auth[_0x9c96('0xa')](),controller[_0x9c96('0x20')]);router[_0x9c96('0x17')]('/:id/status',controller['status']);router['post'](_0x9c96('0x15'),auth[_0x9c96('0xa')](),controller[_0x9c96('0x21')]);router[_0x9c96('0x22')](_0x9c96('0xd'),auth[_0x9c96('0xa')](),controller[_0x9c96('0x23')]);router['delete'](_0x9c96('0xd'),auth[_0x9c96('0xa')](),controller[_0x9c96('0x24')]);router['delete'](_0x9c96('0xf'),auth['isAuthenticated'](),controller['removeDispositions']);router[_0x9c96('0x25')]('/:id/canned_answers',auth[_0x9c96('0xa')](),controller['removeAnswers']);router[_0x9c96('0x25')](_0x9c96('0x15'),auth['isAuthenticated'](),controller[_0x9c96('0x26')]);module[_0x9c96('0x27')]=router; \ No newline at end of file diff --git a/server/api/smsAccount/smsAccount.attributes.js b/server/api/smsAccount/smsAccount.attributes.js index 51d0074..d263e41 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 _0x6564=['mandatoryDispositionPauseId','mandatoryDisposition','randomstring','exports','STRING','generate','twilio','skebby','connectel','clicksend','plivo','csc','intelepeer','ENUM','BOOLEAN','TEXT','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}','INTEGER','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','setDataValue'];(function(_0x53bce3,_0x393666){var _0x387bfb=function(_0x53488b){while(--_0x53488b){_0x53bce3['push'](_0x53bce3['shift']());}};_0x387bfb(++_0x393666);}(_0x6564,0x1a6));var _0x4656=function(_0x421b33,_0xe1890){_0x421b33=_0x421b33-0x0;var _0x26c9c3=_0x6564[_0x421b33];return _0x26c9c3;};'use strict';var Sequelize=require('sequelize');var rs=require(_0x4656('0x0'));module[_0x4656('0x1')]={'name':{'type':Sequelize[_0x4656('0x2')],'unique':'name','allowNull':![]},'key':{'type':Sequelize[_0x4656('0x2')],'allowNull':![]},'remote':{'type':Sequelize[_0x4656('0x2')],'allowNull':![]},'token':{'type':Sequelize[_0x4656('0x2')],'defaultValue':function(){return rs[_0x4656('0x3')]();}},'phone':{'type':Sequelize[_0x4656('0x2')]},'type':{'type':Sequelize['ENUM'](_0x4656('0x4'),_0x4656('0x5'),_0x4656('0x6'),_0x4656('0x7'),_0x4656('0x8'),'clickatell',_0x4656('0x9'),'infobip',_0x4656('0xa'))},'accountSid':{'type':Sequelize['STRING']},'authId':{'type':Sequelize[_0x4656('0x2')]},'authToken':{'type':Sequelize[_0x4656('0x2')]},'smsMethod':{'type':Sequelize[_0x4656('0xb')]('SI','TI','GP')},'username':{'type':Sequelize[_0x4656('0x2')]},'password':{'type':Sequelize['STRING']},'apiKey':{'type':Sequelize[_0x4656('0x2')]},'senderString':{'type':Sequelize[_0x4656('0x2')]},'deliveryReport':{'type':Sequelize[_0x4656('0xc')],'defaultValue':![]},'description':{'type':Sequelize[_0x4656('0x2')]},'notificationTemplate':{'type':Sequelize[_0x4656('0xd')],'defaultValue':function(){return _0x4656('0xe');}},'notificationSound':{'type':Sequelize[_0x4656('0xc')],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0x4656('0xc')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0x4656('0xf')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0x4656('0xc')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0x4656('0xf')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'baseUrl':{'type':Sequelize[_0x4656('0x2')]},'mandatoryDispositionPauseId':{'type':Sequelize[_0x4656('0xf')],'comment':_0x4656('0x10')},'mandatoryDisposition':{'type':Sequelize['BOOLEAN'],'defaultValue':![],'comment':_0x4656('0x11'),'set':function(_0x3f2f3c){if(!_0x3f2f3c)this[_0x4656('0x12')](_0x4656('0x13'),null);this[_0x4656('0x12')](_0x4656('0x14'),_0x3f2f3c);}}}; \ No newline at end of file +var _0xa158=['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','randomstring','exports','STRING','name','generate','ENUM','plivo','clickatell','csc'];(function(_0x5f1f6b,_0x5a57fe){var _0xc468c4=function(_0x1bd8d6){while(--_0x1bd8d6){_0x5f1f6b['push'](_0x5f1f6b['shift']());}};_0xc468c4(++_0x5a57fe);}(_0xa158,0x1ee));var _0x8a15=function(_0x4e10b3,_0x56f782){_0x4e10b3=_0x4e10b3-0x0;var _0x244e97=_0xa158[_0x4e10b3];return _0x244e97;};'use strict';var Sequelize=require(_0x8a15('0x0'));var rs=require(_0x8a15('0x1'));module[_0x8a15('0x2')]={'name':{'type':Sequelize[_0x8a15('0x3')],'unique':_0x8a15('0x4'),'allowNull':![]},'key':{'type':Sequelize[_0x8a15('0x3')],'allowNull':![]},'remote':{'type':Sequelize[_0x8a15('0x3')],'allowNull':![]},'token':{'type':Sequelize[_0x8a15('0x3')],'defaultValue':function(){return rs[_0x8a15('0x5')]();}},'phone':{'type':Sequelize[_0x8a15('0x3')]},'type':{'type':Sequelize[_0x8a15('0x6')]('twilio','skebby','connectel','clicksend',_0x8a15('0x7'),_0x8a15('0x8'),_0x8a15('0x9'),'infobip','intelepeer')},'accountSid':{'type':Sequelize[_0x8a15('0x3')]},'authId':{'type':Sequelize[_0x8a15('0x3')]},'authToken':{'type':Sequelize[_0x8a15('0x3')]},'smsMethod':{'type':Sequelize['ENUM']('SI','TI','GP')},'username':{'type':Sequelize['STRING']},'password':{'type':Sequelize[_0x8a15('0x3')]},'apiKey':{'type':Sequelize[_0x8a15('0x3')]},'senderString':{'type':Sequelize[_0x8a15('0x3')]},'deliveryReport':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'description':{'type':Sequelize[_0x8a15('0x3')]},'notificationTemplate':{'type':Sequelize['TEXT'],'defaultValue':function(){return _0x8a15('0xa');}},'notificationSound':{'type':Sequelize[_0x8a15('0xb')],'defaultValue':!![]},'notificationShake':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0x8a15('0xc')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize[_0x8a15('0xb')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0x8a15('0xb')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0x8a15('0xc')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'baseUrl':{'type':Sequelize[_0x8a15('0x3')]},'mandatoryDispositionPauseId':{'type':Sequelize['INTEGER'],'comment':_0x8a15('0xd')},'mandatoryDisposition':{'type':Sequelize[_0x8a15('0xb')],'defaultValue':![],'comment':_0x8a15('0xe'),'set':function(_0x864ea0){if(!_0x864ea0)this[_0x8a15('0xf')](_0x8a15('0x10'),null);this[_0x8a15('0xf')](_0x8a15('0x11'),_0x864ea0);}}}; \ No newline at end of file diff --git a/server/api/smsAccount/smsAccount.controller.js b/server/api/smsAccount/smsAccount.controller.js index 6bcb75d..beaffc0 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 _0x5b12=['Pause','mandatoryDispositionPause','SmsAccount','type','key','model','map','query','keys','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','where','pick','filter','merge','includeAll','rows','catch','show','rawAttributes','include','options','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','describe','addDisposition','SmsAccountId','Disposition','getDispositions','order','sort','findAll','removeDispositions','ids','addAnswer','CannedAnswer','getAnswers','findOne','removeAnswers','notify','sms','SmsApplication','account','applications','orderBy','Applications','priority','asc','CmContact','Sequelize','no\x20available\x20attributes','createdAt','updatedAt','CompanyId','ListId','from','Body','messageId','MessageSid','skebby','sender','text','clicksend','message_id','plivo','Text','MessageUUID','infobip','results','segmentedMessage','clickatell','replyMessageId','intelepeer','refid','isNil','from\x20is\x20mandatory','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','includes','mapKey','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','DESC','omit','Contacts','contact','SmsInteraction','spread','interaction','created','autoclose','push','close','unmanaged','SmsMessage','ContactId','AttachmentId','UserId','unshift','agent','waitForTheAssignedAgent','*,*,*,*','startRouting','Start','receiveMessage','entity\x20found','debug','SmsAccount,\x20%s,\x20%s,\x20%s,\x20%s','twilio','text/xml','\x0a','addApplications','transaction','bulkCreate','findAndCountAll','getInteractions','Contact','User','internal','Tags','color','tag','to\x20is\x20mandatory','CmList','List','out','Messages','dataValues','log','inspect','connectel','requestid','statusInt','status_code','groupName','DELIVERED','redif','error_code','DELIVERED_TO_GATEWAY','RECEIVED_BY_RECIPIENT','DELIVRD','ACCEPTD','received\x20delivery\x20report\x20from','csc','message-id','addAgents','removeAgents','isArray','emit','userSmsAccount:remove','getAgents','html-pdf','eml-format','rimraf','fast-json-patch','moment','bluebird','util','to-csv','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./smsAccount.socket','register','client','http','ValidationError','request','info','request\x20sent','SmsAccount,\x20%s,\x20%s,\x20%s','stringify','error','message','SmsAccount,\x20%s,\x20%s','result','sendStatus','end','status','json','count','offset','limit','set','Content-Range','apply','reject','save','update','then','destroy','get','SmsAccounts','stack','name','send'];(function(_0x21d2e2,_0x206f10){var _0x2f15da=function(_0x557c30){while(--_0x557c30){_0x21d2e2['push'](_0x21d2e2['shift']());}};_0x2f15da(++_0x206f10);}(_0x5b12,0xa3));var _0x25b1=function(_0x42202d,_0x2cac50){_0x42202d=_0x42202d-0x0;var _0x58b851=_0x5b12[_0x42202d];return _0x58b851;};'use strict';var pdf=require(_0x25b1('0x0'));var emlformat=require(_0x25b1('0x1'));var rimraf=require(_0x25b1('0x2'));var zipdir=require('zip-dir');var jsonpatch=require(_0x25b1('0x3'));var rp=require('request-promise');var moment=require(_0x25b1('0x4'));var BPromise=require(_0x25b1('0x5'));var Mustache=require('mustache');var util=require(_0x25b1('0x6'));var path=require('path');var sox=require('sox');var csv=require(_0x25b1('0x7'));var ejs=require('ejs');var fs=require('fs');var _=require('lodash');var squel=require(_0x25b1('0x8'));var crypto=require(_0x25b1('0x9'));var jsforce=require(_0x25b1('0xa'));var deskjs=require(_0x25b1('0xb'));var toCsv=require(_0x25b1('0x7'));var querystring=require(_0x25b1('0xc'));var Papa=require(_0x25b1('0xd'));var Redis=require(_0x25b1('0xe'));var authService=require('../../components/auth/service');var qs=require(_0x25b1('0xf'));var as=require(_0x25b1('0x10'));var hardwareService=require(_0x25b1('0x11'));var logger=require(_0x25b1('0x12'))(_0x25b1('0x13'));var utils=require(_0x25b1('0x14'));var config=require(_0x25b1('0x15'));var db=require(_0x25b1('0x16'))['db'];config[_0x25b1('0x17')]=_[_0x25b1('0x18')](config[_0x25b1('0x17')],{'host':_0x25b1('0x19'),'port':0x18eb});var socket=require(_0x25b1('0x1a'))(new Redis(config[_0x25b1('0x17')]));require(_0x25b1('0x1b'))[_0x25b1('0x1c')](socket);var jayson=require('jayson/promise');var client=jayson[_0x25b1('0x1d')][_0x25b1('0x1e')]({'port':0x232c});function checkPasswordPattern(_0x4de13f,_0xb5b9cf,_0x4bb1bb){if(_0x4bb1bb){var _0xe32e02=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0xe32e02['test'](_0xb5b9cf)){return _0x4de13f;}else{throw new db['Sequelize'][(_0x25b1('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 _0x4de13f;}}function respondWithRpcPromise(_0xd8fee,_0x2ca567,_0x1be2d8,_0x27ccc9){return new BPromise(function(_0x1f78c2,_0x2a7d14){var _0x17024a=_0x27ccc9||client;return _0x17024a[_0x25b1('0x20')](_0xd8fee,_0x1be2d8)['then'](function(_0x4ecff1){logger[_0x25b1('0x21')]('SmsAccount,\x20%s,\x20%s',_0x2ca567,_0x25b1('0x22'));logger['debug'](_0x25b1('0x23'),_0x2ca567,'request\x20sent',JSON[_0x25b1('0x24')](_0x4ecff1));if(_0x4ecff1['error']){if(_0x4ecff1[_0x25b1('0x25')]['code']===0x1f4){logger['error']('SmsAccount,\x20%s,\x20%s',_0x2ca567,_0x4ecff1[_0x25b1('0x25')][_0x25b1('0x26')]);return _0x2a7d14(_0x4ecff1['error'][_0x25b1('0x26')]);}logger[_0x25b1('0x25')](_0x25b1('0x27'),_0x2ca567,_0x4ecff1[_0x25b1('0x25')][_0x25b1('0x26')]);return _0x1f78c2(_0x4ecff1['error'][_0x25b1('0x26')]);}else{logger[_0x25b1('0x21')](_0x25b1('0x27'),_0x2ca567,_0x25b1('0x22'));_0x1f78c2(_0x4ecff1[_0x25b1('0x28')][_0x25b1('0x26')]);}})['catch'](function(_0x3c05c6){logger[_0x25b1('0x25')](_0x25b1('0x27'),_0x2ca567,_0x3c05c6);_0x2a7d14(_0x3c05c6);});});}function respondWithStatusCode(_0x5bc8fc,_0x20a218){_0x20a218=_0x20a218||0xcc;return function(_0x9e175f){if(_0x9e175f){return _0x5bc8fc[_0x25b1('0x29')](_0x20a218);}return _0x5bc8fc['status'](_0x20a218)[_0x25b1('0x2a')]();};}function respondWithResult(_0x54ce2d,_0x19ecd1){_0x19ecd1=_0x19ecd1||0xc8;return function(_0x3febb8){if(_0x3febb8){return _0x54ce2d[_0x25b1('0x2b')](_0x19ecd1)[_0x25b1('0x2c')](_0x3febb8);}};}function respondWithFilteredResult(_0x362118,_0x300a14){return function(_0x46e429){if(_0x46e429){var _0x4cd825=_0x46e429[_0x25b1('0x2d')],_0x30d455=_0x300a14[_0x25b1('0x2e')],_0xca56f0=_0x300a14['offset']+_0x300a14[_0x25b1('0x2f')],_0x925e99;if(_0xca56f0>=_0x4cd825){_0xca56f0=_0x4cd825;_0x925e99=0xc8;}else{_0x925e99=0xce;}_0x362118[_0x25b1('0x2b')](_0x925e99);return _0x362118[_0x25b1('0x30')](_0x25b1('0x31'),_0x30d455+'-'+_0xca56f0+'/'+_0x4cd825)[_0x25b1('0x2c')](_0x46e429);}return null;};}function patchUpdates(_0x5a4234){return function(_0x5cbde5){try{jsonpatch[_0x25b1('0x32')](_0x5cbde5,_0x5a4234,!![]);}catch(_0x4a407a){return BPromise[_0x25b1('0x33')](_0x4a407a);}return _0x5cbde5[_0x25b1('0x34')]();};}function saveUpdates(_0x1fbde6,_0x5706d0){return function(_0x5b6176){if(_0x5b6176){return _0x5b6176[_0x25b1('0x35')](_0x1fbde6)[_0x25b1('0x36')](function(_0x26d3bc){return _0x26d3bc;});}return null;};}function removeEntity(_0x4f753b,_0x2bc8c4){return function(_0x2e5014){if(_0x2e5014){return _0x2e5014[_0x25b1('0x37')]()[_0x25b1('0x36')](function(){var _0x54f598=_0x2e5014[_0x25b1('0x38')]({'plain':!![]});var _0x1645ea=_0x25b1('0x39');return db['UserProfileResource']['destroy']({'where':{'type':_0x1645ea,'resourceId':_0x54f598['id']}})[_0x25b1('0x36')](function(){return _0x2e5014;});})['then'](function(){_0x4f753b[_0x25b1('0x2b')](0xcc)[_0x25b1('0x2a')]();});}};}function handleEntityNotFound(_0x3ea659,_0x5fdded){return function(_0x1f5d8b){if(!_0x1f5d8b){_0x3ea659[_0x25b1('0x29')](0x194);}return _0x1f5d8b;};}function handleError(_0x1ef8a8,_0x20a462){_0x20a462=_0x20a462||0x1f4;return function(_0x28f8a6){logger[_0x25b1('0x25')](_0x28f8a6[_0x25b1('0x3a')]);if(_0x28f8a6[_0x25b1('0x3b')]){delete _0x28f8a6[_0x25b1('0x3b')];}_0x1ef8a8[_0x25b1('0x2b')](_0x20a462)[_0x25b1('0x3c')](_0x28f8a6);};}exports['index']=function(_0x472ed3,_0x3e23f7){var _0x53423d={'include':[{'model':db[_0x25b1('0x3d')],'as':_0x25b1('0x3e')}]},_0x3c7bf2={},_0x39b68e={'count':0x0,'rows':[]};var _0xb82930=_['map'](db[_0x25b1('0x3f')]['rawAttributes'],function(_0x3cc009){return{'name':_0x3cc009['fieldName'],'type':_0x3cc009[_0x25b1('0x40')][_0x25b1('0x41')]};});_0x3c7bf2[_0x25b1('0x42')]=_[_0x25b1('0x43')](_0xb82930,_0x25b1('0x3b'));_0x3c7bf2[_0x25b1('0x44')]=_[_0x25b1('0x45')](_0x472ed3[_0x25b1('0x44')]);_0x3c7bf2[_0x25b1('0x46')]=_['intersection'](_0x3c7bf2[_0x25b1('0x42')],_0x3c7bf2['query']);_0x53423d[_0x25b1('0x47')]=_[_0x25b1('0x48')](_0x3c7bf2['model'],qs[_0x25b1('0x49')](_0x472ed3[_0x25b1('0x44')][_0x25b1('0x49')]));_0x53423d[_0x25b1('0x47')]=_0x53423d[_0x25b1('0x47')][_0x25b1('0x4a')]?_0x53423d[_0x25b1('0x47')]:_0x3c7bf2[_0x25b1('0x42')];if(!_0x472ed3[_0x25b1('0x44')][_0x25b1('0x4b')](_0x25b1('0x4c'))){_0x53423d[_0x25b1('0x2f')]=qs[_0x25b1('0x2f')](_0x472ed3[_0x25b1('0x44')][_0x25b1('0x2f')]);_0x53423d[_0x25b1('0x2e')]=qs[_0x25b1('0x2e')](_0x472ed3[_0x25b1('0x44')]['offset']);}_0x53423d['order']=qs['sort'](_0x472ed3[_0x25b1('0x44')]['sort']);_0x53423d[_0x25b1('0x4d')]=qs['filters'](_[_0x25b1('0x4e')](_0x472ed3[_0x25b1('0x44')],_0x3c7bf2[_0x25b1('0x46')]));if(_0x472ed3[_0x25b1('0x44')][_0x25b1('0x4f')]){_0x53423d[_0x25b1('0x4d')]=_['merge'](_0x53423d[_0x25b1('0x4d')],{'$or':_[_0x25b1('0x43')](_0xb82930,function(_0x20da24){if(_0x20da24[_0x25b1('0x40')]!=='VIRTUAL'){var _0x489f73={};_0x489f73[_0x20da24[_0x25b1('0x3b')]]={'$like':'%'+_0x472ed3[_0x25b1('0x44')]['filter']+'%'};return _0x489f73;}})});}_0x53423d=_[_0x25b1('0x50')]({},_0x53423d,_0x472ed3['options']);var _0x344e8e={'where':_0x53423d['where']};return db['SmsAccount'][_0x25b1('0x2d')](_0x344e8e)[_0x25b1('0x36')](function(_0x27ca07){_0x39b68e[_0x25b1('0x2d')]=_0x27ca07;if(_0x472ed3['query'][_0x25b1('0x51')]){_0x53423d['include']=[{'all':!![]}];}return db[_0x25b1('0x3f')]['findAll'](_0x53423d);})[_0x25b1('0x36')](function(_0x280a75){_0x39b68e[_0x25b1('0x52')]=_0x280a75;return _0x39b68e;})['then'](respondWithFilteredResult(_0x3e23f7,_0x53423d))[_0x25b1('0x53')](handleError(_0x3e23f7,null));};exports[_0x25b1('0x54')]=function(_0x354294,_0xf38a9e){var _0x26651f={'raw':![],'where':{'id':_0x354294['params']['id']},'include':[{'model':db[_0x25b1('0x3d')],'as':_0x25b1('0x3e')}]},_0xc95b24={};_0xc95b24[_0x25b1('0x42')]=_[_0x25b1('0x45')](db[_0x25b1('0x3f')][_0x25b1('0x55')]);_0xc95b24[_0x25b1('0x44')]=_[_0x25b1('0x45')](_0x354294[_0x25b1('0x44')]);_0xc95b24[_0x25b1('0x46')]=_[_0x25b1('0x48')](_0xc95b24[_0x25b1('0x42')],_0xc95b24[_0x25b1('0x44')]);_0x26651f[_0x25b1('0x47')]=_[_0x25b1('0x48')](_0xc95b24[_0x25b1('0x42')],qs[_0x25b1('0x49')](_0x354294[_0x25b1('0x44')]['fields']));_0x26651f[_0x25b1('0x47')]=_0x26651f[_0x25b1('0x47')][_0x25b1('0x4a')]?_0x26651f[_0x25b1('0x47')]:_0xc95b24[_0x25b1('0x42')];if(_0x354294[_0x25b1('0x44')]['includeAll']){_0x26651f[_0x25b1('0x56')]=[{'all':!![]}];}_0x26651f=_[_0x25b1('0x50')]({},_0x26651f,_0x354294[_0x25b1('0x57')]);return db['SmsAccount'][_0x25b1('0x58')](_0x26651f)['then'](handleEntityNotFound(_0xf38a9e,null))['then'](respondWithResult(_0xf38a9e,null))['catch'](handleError(_0xf38a9e,null));};exports['create']=function(_0x323ea2,_0x5042e1){return db[_0x25b1('0x3f')][_0x25b1('0x59')](_0x323ea2[_0x25b1('0x5a')],{})[_0x25b1('0x36')](function(_0x2d38e7){var _0x4ea777=_0x323ea2[_0x25b1('0x5b')][_0x25b1('0x38')]({'plain':!![]});if(!_0x4ea777)throw new Error(_0x25b1('0x5c'));if(_0x4ea777[_0x25b1('0x5d')]==='user'){var _0xcca343=_0x2d38e7[_0x25b1('0x38')]({'plain':!![]});var _0x2e5bfc=_0x25b1('0x39');return db[_0x25b1('0x5e')][_0x25b1('0x58')]({'where':{'name':_0x2e5bfc,'userProfileId':_0x4ea777['userProfileId']},'raw':!![]})[_0x25b1('0x36')](function(_0x57f22c){if(_0x57f22c&&_0x57f22c[_0x25b1('0x5f')]===0x0){return db[_0x25b1('0x60')]['create']({'name':_0xcca343[_0x25b1('0x3b')],'resourceId':_0xcca343['id'],'type':_0x57f22c[_0x25b1('0x3b')],'sectionId':_0x57f22c['id']},{})['then'](function(){return _0x2d38e7;});}else{return _0x2d38e7;}})[_0x25b1('0x53')](function(_0x303049){logger[_0x25b1('0x25')](_0x25b1('0x61'),_0x303049);throw _0x303049;});}return _0x2d38e7;})[_0x25b1('0x36')](respondWithResult(_0x5042e1,0xc9))[_0x25b1('0x53')](handleError(_0x5042e1,null));};exports[_0x25b1('0x35')]=function(_0x6fbad6,_0x523248){if(_0x6fbad6[_0x25b1('0x5a')]['id']){delete _0x6fbad6[_0x25b1('0x5a')]['id'];}return db[_0x25b1('0x3f')][_0x25b1('0x58')]({'where':{'id':_0x6fbad6[_0x25b1('0x62')]['id']},'include':[{'model':db[_0x25b1('0x3d')],'as':_0x25b1('0x3e')}]})[_0x25b1('0x36')](handleEntityNotFound(_0x523248,null))['then'](saveUpdates(_0x6fbad6[_0x25b1('0x5a')],null))[_0x25b1('0x36')](respondWithResult(_0x523248,null))['catch'](handleError(_0x523248,null));};exports[_0x25b1('0x37')]=function(_0x3eea55,_0x5b71e5){return db[_0x25b1('0x3f')]['find']({'where':{'id':_0x3eea55[_0x25b1('0x62')]['id']}})['then'](handleEntityNotFound(_0x5b71e5,null))[_0x25b1('0x36')](removeEntity(_0x5b71e5,null))['catch'](handleError(_0x5b71e5,null));};exports[_0x25b1('0x63')]=function(_0x37d100,_0x44f218){return db['SmsAccount']['describe']()[_0x25b1('0x36')](respondWithResult(_0x44f218,null))[_0x25b1('0x53')](handleError(_0x44f218,null));};exports[_0x25b1('0x64')]=function(_0x173179,_0x1c47cc,_0x15ea73){if(_0x173179[_0x25b1('0x5a')]['id']){delete _0x173179[_0x25b1('0x5a')]['id'];}return db[_0x25b1('0x3f')][_0x25b1('0x58')]({'where':{'id':_0x173179[_0x25b1('0x62')]['id']}})[_0x25b1('0x36')](handleEntityNotFound(_0x1c47cc,null))[_0x25b1('0x36')](function(_0x975b85){if(_0x975b85){_0x173179[_0x25b1('0x5a')][_0x25b1('0x65')]=_0x975b85['id'];return db[_0x25b1('0x66')][_0x25b1('0x59')](_0x173179[_0x25b1('0x5a')]);}})[_0x25b1('0x36')](respondWithResult(_0x1c47cc,null))[_0x25b1('0x53')](handleError(_0x1c47cc,null));};exports[_0x25b1('0x67')]=function(_0x584499,_0x1a3368,_0x4cf4c0){var _0x746cbc={'raw':![],'where':{}};var _0x37cfd6={};var _0x410227={'count':0x0,'rows':[]};return db['SmsAccount']['findOne']({'where':{'id':_0x584499[_0x25b1('0x62')]['id']}})[_0x25b1('0x36')](handleEntityNotFound(_0x1a3368,null))['then'](function(_0x371ee0){if(_0x371ee0){_0x37cfd6[_0x25b1('0x42')]=_[_0x25b1('0x45')](db['Disposition'][_0x25b1('0x55')]);_0x37cfd6[_0x25b1('0x44')]=_[_0x25b1('0x45')](_0x584499[_0x25b1('0x44')]);_0x37cfd6['filters']=_[_0x25b1('0x48')](_0x37cfd6[_0x25b1('0x42')],_0x37cfd6[_0x25b1('0x44')]);_0x746cbc[_0x25b1('0x47')]=_[_0x25b1('0x48')](_0x37cfd6[_0x25b1('0x42')],qs['fields'](_0x584499[_0x25b1('0x44')][_0x25b1('0x49')]));_0x746cbc['attributes']=_0x746cbc['attributes'][_0x25b1('0x4a')]?_0x746cbc[_0x25b1('0x47')]:_0x37cfd6[_0x25b1('0x42')];if(!_0x584499[_0x25b1('0x44')][_0x25b1('0x4b')](_0x25b1('0x4c'))){_0x746cbc[_0x25b1('0x2f')]=qs['limit'](_0x584499[_0x25b1('0x44')][_0x25b1('0x2f')]);_0x746cbc[_0x25b1('0x2e')]=qs[_0x25b1('0x2e')](_0x584499[_0x25b1('0x44')][_0x25b1('0x2e')]);}_0x746cbc[_0x25b1('0x68')]=qs['sort'](_0x584499[_0x25b1('0x44')][_0x25b1('0x69')]);_0x746cbc[_0x25b1('0x4d')]=qs[_0x25b1('0x46')](_[_0x25b1('0x4e')](_0x584499[_0x25b1('0x44')],_0x37cfd6[_0x25b1('0x46')]));_0x746cbc[_0x25b1('0x4d')][_0x25b1('0x65')]=_0x371ee0['id'];if(_0x584499[_0x25b1('0x44')][_0x25b1('0x4f')]){_0x746cbc['where']=_[_0x25b1('0x50')](_0x746cbc[_0x25b1('0x4d')],{'$or':_['map'](_0x746cbc[_0x25b1('0x47')],function(_0x45804b){var _0x3bb8c3={};_0x3bb8c3[_0x45804b]={'$like':'%'+_0x584499[_0x25b1('0x44')][_0x25b1('0x4f')]+'%'};return _0x3bb8c3;})});}_0x746cbc=_['merge']({},_0x746cbc,_0x584499['options']);return db[_0x25b1('0x66')]['count']({'where':_0x746cbc[_0x25b1('0x4d')]})[_0x25b1('0x36')](function(_0x167c48){_0x410227[_0x25b1('0x2d')]=_0x167c48;if(_0x584499[_0x25b1('0x44')][_0x25b1('0x51')]){_0x746cbc['include']=[{'all':!![]}];}return db[_0x25b1('0x66')][_0x25b1('0x6a')](_0x746cbc);})[_0x25b1('0x36')](function(_0x2736c9){_0x410227['rows']=_0x2736c9;return _0x410227;});}})['then'](respondWithFilteredResult(_0x1a3368,_0x746cbc))['catch'](handleError(_0x1a3368,null));};exports[_0x25b1('0x6b')]=function(_0xf8a96e,_0x583b5a,_0x49c2d3){return db[_0x25b1('0x3f')][_0x25b1('0x58')]({'where':{'id':_0xf8a96e[_0x25b1('0x62')]['id']}})[_0x25b1('0x36')](handleEntityNotFound(_0x583b5a,null))['then'](function(_0x10409f){if(_0x10409f){return _0x10409f[_0x25b1('0x6b')](_0xf8a96e[_0x25b1('0x44')][_0x25b1('0x6c')]);}})[_0x25b1('0x36')](respondWithStatusCode(_0x583b5a,null))[_0x25b1('0x53')](handleError(_0x583b5a,null));};exports[_0x25b1('0x6d')]=function(_0x2d8a6a,_0x593186,_0x5a3090){if(_0x2d8a6a[_0x25b1('0x5a')]['id']){delete _0x2d8a6a[_0x25b1('0x5a')]['id'];}return db['SmsAccount']['find']({'where':{'id':_0x2d8a6a[_0x25b1('0x62')]['id']}})[_0x25b1('0x36')](handleEntityNotFound(_0x593186,null))['then'](function(_0x360bdb){if(_0x360bdb){_0x2d8a6a[_0x25b1('0x5a')][_0x25b1('0x65')]=_0x360bdb['id'];return db[_0x25b1('0x6e')][_0x25b1('0x59')](_0x2d8a6a[_0x25b1('0x5a')]);}})[_0x25b1('0x36')](respondWithResult(_0x593186,null))['catch'](handleError(_0x593186,null));};exports[_0x25b1('0x6f')]=function(_0x151778,_0x13848a,_0x4d99b3){var _0x5902de={'raw':![],'where':{}};var _0x5f16f0={};var _0xf6a42a={'count':0x0,'rows':[]};return db[_0x25b1('0x3f')][_0x25b1('0x70')]({'where':{'id':_0x151778['params']['id']}})['then'](handleEntityNotFound(_0x13848a,null))[_0x25b1('0x36')](function(_0x3616d9){if(_0x3616d9){_0x5f16f0[_0x25b1('0x42')]=_[_0x25b1('0x45')](db[_0x25b1('0x6e')][_0x25b1('0x55')]);_0x5f16f0[_0x25b1('0x44')]=_[_0x25b1('0x45')](_0x151778[_0x25b1('0x44')]);_0x5f16f0['filters']=_[_0x25b1('0x48')](_0x5f16f0[_0x25b1('0x42')],_0x5f16f0['query']);_0x5902de['attributes']=_[_0x25b1('0x48')](_0x5f16f0['model'],qs[_0x25b1('0x49')](_0x151778[_0x25b1('0x44')][_0x25b1('0x49')]));_0x5902de['attributes']=_0x5902de['attributes']['length']?_0x5902de[_0x25b1('0x47')]:_0x5f16f0[_0x25b1('0x42')];if(!_0x151778['query'][_0x25b1('0x4b')](_0x25b1('0x4c'))){_0x5902de[_0x25b1('0x2f')]=qs[_0x25b1('0x2f')](_0x151778[_0x25b1('0x44')]['limit']);_0x5902de[_0x25b1('0x2e')]=qs[_0x25b1('0x2e')](_0x151778['query'][_0x25b1('0x2e')]);}_0x5902de['order']=qs[_0x25b1('0x69')](_0x151778['query']['sort']);_0x5902de[_0x25b1('0x4d')]=qs[_0x25b1('0x46')](_[_0x25b1('0x4e')](_0x151778[_0x25b1('0x44')],_0x5f16f0[_0x25b1('0x46')]));_0x5902de['where']['SmsAccountId']=_0x3616d9['id'];if(_0x151778[_0x25b1('0x44')]['filter']){_0x5902de[_0x25b1('0x4d')]=_[_0x25b1('0x50')](_0x5902de[_0x25b1('0x4d')],{'$or':_['map'](_0x5902de[_0x25b1('0x47')],function(_0x4d0adc){var _0x54e299={};_0x54e299[_0x4d0adc]={'$like':'%'+_0x151778['query'][_0x25b1('0x4f')]+'%'};return _0x54e299;})});}_0x5902de=_['merge']({},_0x5902de,_0x151778[_0x25b1('0x57')]);return db[_0x25b1('0x6e')][_0x25b1('0x2d')]({'where':_0x5902de[_0x25b1('0x4d')]})[_0x25b1('0x36')](function(_0xafac4a){_0xf6a42a[_0x25b1('0x2d')]=_0xafac4a;if(_0x151778[_0x25b1('0x44')][_0x25b1('0x51')]){_0x5902de[_0x25b1('0x56')]=[{'all':!![]}];}return db[_0x25b1('0x6e')][_0x25b1('0x6a')](_0x5902de);})[_0x25b1('0x36')](function(_0xb13047){_0xf6a42a[_0x25b1('0x52')]=_0xb13047;return _0xf6a42a;});}})[_0x25b1('0x36')](respondWithFilteredResult(_0x13848a,_0x5902de))[_0x25b1('0x53')](handleError(_0x13848a,null));};exports['removeAnswers']=function(_0x1e2888,_0x4f84fd,_0x422220){return db[_0x25b1('0x3f')][_0x25b1('0x58')]({'where':{'id':_0x1e2888[_0x25b1('0x62')]['id']}})[_0x25b1('0x36')](handleEntityNotFound(_0x4f84fd,null))['then'](function(_0x368bf2){if(_0x368bf2){return _0x368bf2[_0x25b1('0x71')](_0x1e2888[_0x25b1('0x44')]['ids']);}})[_0x25b1('0x36')](respondWithStatusCode(_0x4f84fd,null))[_0x25b1('0x53')](handleError(_0x4f84fd,null));};exports[_0x25b1('0x72')]=function(_0x110962,_0x52316a,_0x505cfe){var _0x22c25a={'channel':_0x25b1('0x73')};var _0x56be36=[];var _0xb874aa=[];var _0x2ca218={};return db[_0x25b1('0x3f')]['find']({'where':{'id':_0x110962[_0x25b1('0x62')]['id']},'include':[{'model':db[_0x25b1('0x74')],'as':'Applications'}]})[_0x25b1('0x36')](handleEntityNotFound(_0x52316a,null))[_0x25b1('0x36')](function(_0x5e93c2){_0x22c25a[_0x25b1('0x75')]=_0x5e93c2;_0x22c25a[_0x25b1('0x76')]=_[_0x25b1('0x77')](_0x5e93c2[_0x25b1('0x78')],[_0x25b1('0x79')],[_0x25b1('0x7a')]);if(_0x22c25a['account'][_0x25b1('0x78')]){delete _0x22c25a[_0x25b1('0x75')][_0x25b1('0x78')];}return db[_0x25b1('0x7b')][_0x25b1('0x63')]();})[_0x25b1('0x36')](function(_0x310a32){if(!_0x310a32){throw new db[(_0x25b1('0x7c'))][(_0x25b1('0x1f'))](_0x25b1('0x7d'));}_0x56be36=_['difference'](_[_0x25b1('0x45')](_0x310a32),[_0x25b1('0x7e'),'updatedAt']);_0xb874aa=_['difference'](_[_0x25b1('0x45')](_0x310a32),[_0x25b1('0x7e'),_0x25b1('0x7f'),_0x25b1('0x80'),_0x25b1('0x81')]);_0x22c25a['body']={'mapKey':'mobile'};if(_0x22c25a[_0x25b1('0x75')][_0x25b1('0x40')]){switch(_0x22c25a[_0x25b1('0x75')]['type']){case'twilio':_0x22c25a[_0x25b1('0x5a')][_0x25b1('0x82')]=_0x110962[_0x25b1('0x5a')]['From'];_0x22c25a[_0x25b1('0x5a')][_0x25b1('0x5a')]=_0x110962[_0x25b1('0x5a')][_0x25b1('0x83')];_0x22c25a[_0x25b1('0x5a')][_0x25b1('0x84')]=_0x110962[_0x25b1('0x5a')][_0x25b1('0x85')];break;case _0x25b1('0x86'):_0x22c25a['body'][_0x25b1('0x82')]='+'+_0x110962[_0x25b1('0x5a')][_0x25b1('0x87')];_0x22c25a[_0x25b1('0x5a')][_0x25b1('0x5a')]=_0x110962[_0x25b1('0x5a')][_0x25b1('0x88')];break;case'connectel':_0x22c25a[_0x25b1('0x5a')]['from']=_0x110962[_0x25b1('0x5a')][_0x25b1('0x82')];_0x22c25a[_0x25b1('0x5a')][_0x25b1('0x5a')]=_0x110962['body']['message'];break;case _0x25b1('0x89'):_0x22c25a[_0x25b1('0x5a')]['from']=_0x110962['body']['from'];_0x22c25a[_0x25b1('0x5a')][_0x25b1('0x5a')]=_0x110962[_0x25b1('0x5a')][_0x25b1('0x5a')];_0x22c25a[_0x25b1('0x5a')][_0x25b1('0x84')]=_0x110962[_0x25b1('0x5a')][_0x25b1('0x8a')];break;case _0x25b1('0x8b'):_0x22c25a[_0x25b1('0x5a')][_0x25b1('0x82')]=_0x110962[_0x25b1('0x5a')]['From'];_0x22c25a[_0x25b1('0x5a')]['body']=_0x110962[_0x25b1('0x5a')][_0x25b1('0x8c')];_0x22c25a[_0x25b1('0x5a')][_0x25b1('0x84')]=_0x110962[_0x25b1('0x5a')][_0x25b1('0x8d')];break;case _0x25b1('0x8e'):_0x22c25a[_0x25b1('0x5a')]['from']='+'+_0x110962[_0x25b1('0x5a')][_0x25b1('0x8f')][0x0][_0x25b1('0x82')];_0x22c25a[_0x25b1('0x5a')][_0x25b1('0x5a')]=_0x110962[_0x25b1('0x5a')][_0x25b1('0x8f')][0x0]['text'];_0x22c25a[_0x25b1('0x5a')][_0x25b1('0x84')]=_0x110962[_0x25b1('0x5a')][_0x25b1('0x8f')][0x0][_0x25b1('0x84')];break;case'csc':_0x22c25a['body'][_0x25b1('0x82')]=_0x110962[_0x25b1('0x5a')]['originatingAddress'];_0x22c25a['body'][_0x25b1('0x5a')]=_0x110962[_0x25b1('0x5a')][_0x25b1('0x90')][_0x25b1('0x26')];break;case _0x25b1('0x91'):_0x22c25a[_0x25b1('0x5a')][_0x25b1('0x82')]=_0x110962[_0x25b1('0x5a')]['fromNumber'];_0x22c25a[_0x25b1('0x5a')]['body']=_0x110962['body'][_0x25b1('0x88')];_0x22c25a['body'][_0x25b1('0x84')]=_0x110962[_0x25b1('0x5a')][_0x25b1('0x92')];break;case _0x25b1('0x93'):_0x22c25a[_0x25b1('0x5a')][_0x25b1('0x82')]=_0x110962[_0x25b1('0x5a')]['from'];_0x22c25a[_0x25b1('0x5a')][_0x25b1('0x5a')]=_0x110962[_0x25b1('0x5a')][_0x25b1('0x26')];_0x22c25a[_0x25b1('0x5a')][_0x25b1('0x84')]=_0x110962[_0x25b1('0x5a')][_0x25b1('0x94')];break;}}if(_0x22c25a['body']['id']){delete _0x22c25a[_0x25b1('0x5a')]['id'];}if(_[_0x25b1('0x95')](_0x22c25a[_0x25b1('0x5a')]['from'])){throw new db[(_0x25b1('0x7c'))][(_0x25b1('0x1f'))](_0x25b1('0x96'));}if(_[_0x25b1('0x95')](_0x22c25a[_0x25b1('0x5a')]['body'])||_0x22c25a[_0x25b1('0x5a')][_0x25b1('0x5a')]===''){throw new db[(_0x25b1('0x7c'))]['ValidationError']('body\x20is\x20mandatory\x20and\x20not\x20empty');}if(_['isNil'](_0x22c25a[_0x25b1('0x5a')]['mapKey'])){throw new db[(_0x25b1('0x7c'))]['ValidationError'](_0x25b1('0x97')+_0xb874aa);}if(!_[_0x25b1('0x98')](_0xb874aa,_0x22c25a[_0x25b1('0x5a')][_0x25b1('0x99')])){throw new db[(_0x25b1('0x7c'))][(_0x25b1('0x1f'))](_0x25b1('0x9a')+_0xb874aa);}_0x2ca218[_0x22c25a['body'][_0x25b1('0x99')]]=_0x22c25a[_0x25b1('0x5a')][_0x25b1('0x82')];return db['CmList'][_0x25b1('0x58')]({'where':{'id':_0x22c25a[_0x25b1('0x75')][_0x25b1('0x81')]},'include':[{'model':db[_0x25b1('0x7b')],'as':'Contacts','where':_0x2ca218,'limit':0x1,'order':[[_0x25b1('0x7f'),_0x25b1('0x9b')]]}]});})[_0x25b1('0x36')](handleEntityNotFound(_0x52316a,null))[_0x25b1('0x36')](function(_0x1e0b3c){if(_0x1e0b3c){_0x22c25a['list']=_[_0x25b1('0x9c')](_0x1e0b3c,[_0x25b1('0x9d')]);if(_0x1e0b3c['Contacts']['length']){return _0x1e0b3c['Contacts'][0x0];}var _0x1ec8ea=_['defaults'](_0x22c25a[_0x25b1('0x5a')],{'firstName':_0x22c25a[_0x25b1('0x5a')][_0x25b1('0x82')],'ListId':_0x1e0b3c['id']});_0x1ec8ea[_0x22c25a[_0x25b1('0x5a')][_0x25b1('0x99')]]=_0x22c25a[_0x25b1('0x5a')][_0x25b1('0x82')];return db[_0x25b1('0x7b')]['create'](_0x1ec8ea,{'fields':_0x56be36,'raw':!![]});}})[_0x25b1('0x36')](handleEntityNotFound(_0x52316a,null))['then'](function(_0x3d5840){if(_0x3d5840){_0x22c25a[_0x25b1('0x9e')]=_0x3d5840;var _0x154344={'ContactId':_0x3d5840['id'],'phone':_0x22c25a['body'][_0x25b1('0x82')],'SmsAccountId':_0x110962[_0x25b1('0x62')]['id']};var _0x2afe8b={'ContactId':_0x3d5840['id'],'SmsAccountId':_0x110962[_0x25b1('0x62')]['id'],'closed':![]};return db[_0x25b1('0x9f')][_0x25b1('0x58')]({'where':_0x2afe8b})['then'](function(_0x111acb){if(_0x111acb){return[_0x111acb,![]];}return db[_0x25b1('0x9f')][_0x25b1('0x59')](_0x154344)['then'](function(_0x58ab2b){return[_0x58ab2b,!![]];});});}})[_0x25b1('0xa0')](function(_0x3a3a13,_0x3e6b39){_0x22c25a['interaction']=_0x3a3a13[_0x25b1('0x38')]({'plain':!![]});_0x22c25a[_0x25b1('0xa1')][_0x25b1('0xa2')]=![];if(_0x3e6b39){if(_0x22c25a[_0x25b1('0x75')][_0x25b1('0xa3')]){_0x22c25a[_0x25b1('0x76')][_0x25b1('0xa4')]({'id':0x0,'priority':_0x22c25a[_0x25b1('0x76')][_0x25b1('0x4a')]+0x1,'app':_0x25b1('0xa5'),'appdata':_0x25b1('0xa6'),'interval':'*,*,*,*'});}_0x22c25a[_0x25b1('0xa1')][_0x25b1('0xa2')]=!![];}return db[_0x25b1('0xa7')]['create']({'phone':_0x22c25a['body'][_0x25b1('0x82')],'messageId':_0x22c25a[_0x25b1('0x5a')]['messageId'],'body':_0x22c25a['body'][_0x25b1('0x5a')],'SmsAccountId':_0x110962['params']['id'],'SmsInteractionId':_0x3a3a13['id'],'direction':'in','ContactId':_0x3a3a13[_0x25b1('0xa8')],'AttachmentId':_0x22c25a[_0x25b1('0x5a')][_0x25b1('0xa9')]});})[_0x25b1('0x36')](function(_0x65aa37){_0x22c25a['message']=_0x65aa37;if(_0x22c25a[_0x25b1('0xa1')][_0x25b1('0xaa')]){return db['User'][_0x25b1('0x58')]({'attributes':['id',_0x25b1('0x3b')],'where':{'id':_0x22c25a['interaction'][_0x25b1('0xaa')]}})['then'](function(_0x427f10){if(_0x427f10){_0x22c25a[_0x25b1('0x76')][_0x25b1('0xab')]({'id':0x0,'priority':0x0,'app':_0x25b1('0xac'),'appdata':_0x427f10[_0x25b1('0x3b')]+','+(_0x22c25a[_0x25b1('0x75')][_0x25b1('0xad')]||0xa),'interval':_0x25b1('0xae')});}return respondWithRpcPromise('Start',_0x25b1('0xaf'),_0x22c25a);});}return respondWithRpcPromise(_0x25b1('0xb0'),'startRouting',_0x22c25a);})[_0x25b1('0x36')](function(_0x41e2d4){if(_0x41e2d4){var _0x4443da=0xc8;var _0x2daeb1=_0x25b1('0xb1');logger[_0x25b1('0x21')]('SmsAccount,\x20%s,\x20%s,\x20%s',_0x2daeb1,_0x4443da,_0x25b1('0xb2'));logger[_0x25b1('0xb3')](_0x25b1('0xb4'),_0x2daeb1,_0x4443da,'entity\x20found',JSON[_0x25b1('0x24')](_0x41e2d4));if(_0x22c25a[_0x25b1('0x75')][_0x25b1('0x40')]===_0x25b1('0xb5')){return _0x52316a[_0x25b1('0x2b')](_0x4443da)[_0x25b1('0x30')]('Content-Type',_0x25b1('0xb6'))['send'](_0x25b1('0xb7'));}else{return _0x52316a['status'](_0x4443da)[_0x25b1('0x2c')](_0x41e2d4);}}})[_0x25b1('0x53')](handleError(_0x52316a,null));};exports[_0x25b1('0xb8')]=function(_0x142bbb,_0x56a4e8,_0x363dcb){return db[_0x25b1('0x3f')][_0x25b1('0x70')]({'where':{'id':_0x142bbb[_0x25b1('0x62')]['id']}})[_0x25b1('0x36')](handleEntityNotFound(_0x56a4e8,null))['then'](function(_0x2a69c8){if(_0x2a69c8){return db['sequelize'][_0x25b1('0xb9')](function(_0x144f30){return db[_0x25b1('0x74')][_0x25b1('0x37')]({'where':{'SmsAccountId':_0x142bbb['params']['id']},'transaction':_0x144f30})[_0x25b1('0x36')](function(_0xdef6cc){var _0x22e8f5=_[_0x25b1('0x43')](_0x142bbb['body'],function(_0x208315){_0x208315[_0x25b1('0x65')]=_0x142bbb[_0x25b1('0x62')]['id'];return _0x208315;});return db[_0x25b1('0x74')][_0x25b1('0xba')](_0x22e8f5,{'transaction':_0x144f30});});})[_0x25b1('0x36')](function(){return db[_0x25b1('0x74')][_0x25b1('0xbb')]({'where':{'SmsAccountId':_0x142bbb['params']['id']},'order':_0x25b1('0x79')});});}})[_0x25b1('0x36')](respondWithResult(_0x56a4e8,null))[_0x25b1('0x53')](handleError(_0x56a4e8,null));};exports['getApplications']=function(_0x5d2972,_0x282723,_0x19294a){var _0x2a9a49={};var _0x4f659b={};var _0x2597c2;var _0x4a90d0;return db['SmsAccount'][_0x25b1('0x70')]({'where':{'id':_0x5d2972[_0x25b1('0x62')]['id']}})['then'](handleEntityNotFound(_0x282723,null))[_0x25b1('0x36')](function(_0x10aa4b){if(_0x10aa4b){_0x2597c2=_0x10aa4b;_0x4f659b[_0x25b1('0x42')]=_[_0x25b1('0x45')](db[_0x25b1('0x74')][_0x25b1('0x55')]);_0x4f659b[_0x25b1('0x44')]=_[_0x25b1('0x45')](_0x5d2972[_0x25b1('0x44')]);_0x4f659b[_0x25b1('0x46')]=_['intersection'](_0x4f659b[_0x25b1('0x42')],_0x4f659b[_0x25b1('0x44')]);_0x2a9a49[_0x25b1('0x47')]=_[_0x25b1('0x48')](_0x4f659b['model'],qs[_0x25b1('0x49')](_0x5d2972[_0x25b1('0x44')][_0x25b1('0x49')]));_0x2a9a49[_0x25b1('0x47')]=_0x2a9a49[_0x25b1('0x47')][_0x25b1('0x4a')]?_0x2a9a49[_0x25b1('0x47')]:_0x4f659b[_0x25b1('0x42')];_0x2a9a49['order']=qs[_0x25b1('0x69')](_0x5d2972[_0x25b1('0x44')][_0x25b1('0x69')]);_0x2a9a49[_0x25b1('0x4d')]=qs[_0x25b1('0x46')](_['pick'](_0x5d2972['query'],_0x4f659b[_0x25b1('0x46')]));if(_0x5d2972[_0x25b1('0x44')]['filter']){_0x2a9a49[_0x25b1('0x4d')]=_[_0x25b1('0x50')](_0x2a9a49[_0x25b1('0x4d')],{'$or':_['map'](_0x2a9a49['attributes'],function(_0x1a0c59){var _0x34eb96={};_0x34eb96[_0x1a0c59]={'$like':'%'+_0x5d2972[_0x25b1('0x44')]['filter']+'%'};return _0x34eb96;})});}_0x2a9a49=_[_0x25b1('0x50')]({},_0x2a9a49,_0x5d2972[_0x25b1('0x57')]);return _0x2597c2['getApplications'](_0x2a9a49);}})[_0x25b1('0x36')](function(_0x1c86b5){if(_0x1c86b5){_0x4a90d0=_0x1c86b5[_0x25b1('0x4a')];if(!_0x5d2972[_0x25b1('0x44')][_0x25b1('0x4b')](_0x25b1('0x4c'))){_0x2a9a49['limit']=qs[_0x25b1('0x2f')](_0x5d2972[_0x25b1('0x44')]['limit']);_0x2a9a49['offset']=qs[_0x25b1('0x2e')](_0x5d2972[_0x25b1('0x44')][_0x25b1('0x2e')]);}return _0x2597c2['getApplications'](_0x2a9a49);}})[_0x25b1('0x36')](function(_0x2ccc49){if(_0x2ccc49){return _0x2ccc49?{'count':_0x4a90d0,'rows':_0x2ccc49}:null;}})[_0x25b1('0x36')](respondWithResult(_0x282723,null))[_0x25b1('0x53')](handleError(_0x282723,null));};exports[_0x25b1('0xbc')]=function(_0x310c05,_0x238f14,_0x1992a0){var _0x3f69c1={'raw':![],'where':{}};var _0x49c51b={};var _0x47e9a9={'count':0x0,'rows':[]};return db[_0x25b1('0x3f')]['findOne']({'where':{'id':_0x310c05['params']['id']}})[_0x25b1('0x36')](handleEntityNotFound(_0x238f14,null))[_0x25b1('0x36')](function(_0x233377){if(_0x233377){_0x49c51b['model']=_[_0x25b1('0x45')](db[_0x25b1('0x9f')][_0x25b1('0x55')]);_0x49c51b[_0x25b1('0x44')]=_[_0x25b1('0x45')](_0x310c05[_0x25b1('0x44')]);_0x49c51b[_0x25b1('0x46')]=_[_0x25b1('0x48')](_0x49c51b['model'],_0x49c51b['query']);_0x3f69c1[_0x25b1('0x47')]=_[_0x25b1('0x48')](_0x49c51b['model'],qs[_0x25b1('0x49')](_0x310c05[_0x25b1('0x44')][_0x25b1('0x49')]));_0x3f69c1[_0x25b1('0x47')]=_0x3f69c1['attributes'][_0x25b1('0x4a')]?_0x3f69c1[_0x25b1('0x47')]:_0x49c51b['model'];if(!_0x310c05[_0x25b1('0x44')][_0x25b1('0x4b')](_0x25b1('0x4c'))){_0x3f69c1[_0x25b1('0x2f')]=qs[_0x25b1('0x2f')](_0x310c05[_0x25b1('0x44')][_0x25b1('0x2f')]);_0x3f69c1['offset']=qs[_0x25b1('0x2e')](_0x310c05[_0x25b1('0x44')]['offset']);}_0x3f69c1[_0x25b1('0x68')]=qs['sort'](_0x310c05[_0x25b1('0x44')]['sort']);_0x3f69c1[_0x25b1('0x4d')]=qs[_0x25b1('0x46')](_[_0x25b1('0x4e')](_0x310c05[_0x25b1('0x44')],_0x49c51b[_0x25b1('0x46')]));_0x3f69c1[_0x25b1('0x4d')][_0x25b1('0x65')]=_0x233377['id'];if(_0x310c05[_0x25b1('0x44')]['filter']){_0x3f69c1[_0x25b1('0x4d')]=_['merge'](_0x3f69c1[_0x25b1('0x4d')],{'$or':_[_0x25b1('0x43')](_0x3f69c1[_0x25b1('0x47')],function(_0x10d7ab){var _0x40aaf9={};_0x40aaf9[_0x10d7ab]={'$like':'%'+_0x310c05[_0x25b1('0x44')]['filter']+'%'};return _0x40aaf9;})});}_0x3f69c1=_[_0x25b1('0x50')]({},_0x3f69c1,_0x310c05[_0x25b1('0x57')]);return db[_0x25b1('0x9f')]['count']({'where':_0x3f69c1[_0x25b1('0x4d')]})[_0x25b1('0x36')](function(_0x1fe9c2){_0x47e9a9['count']=_0x1fe9c2;if(_0x310c05[_0x25b1('0x44')][_0x25b1('0x51')]){_0x3f69c1['include']=[{'model':db[_0x25b1('0x7b')],'as':_0x25b1('0xbd'),'required':![]},{'model':db[_0x25b1('0xbe')],'as':'Owner','attributes':[_0x25b1('0x3b'),'fullname',_0x25b1('0xbf')],'required':![]},{'model':db['Tag'],'as':_0x25b1('0xc0'),'attributes':['id',_0x25b1('0x3b'),_0x25b1('0xc1')],'where':_0x310c05[_0x25b1('0x44')][_0x25b1('0xc2')]?{'id':_0x310c05[_0x25b1('0x44')][_0x25b1('0xc2')]}:undefined,'required':_0x310c05[_0x25b1('0x44')][_0x25b1('0xc2')]?!![]:![]}];}return db[_0x25b1('0x9f')][_0x25b1('0x6a')](_0x3f69c1);})['then'](function(_0x2ef648){_0x47e9a9[_0x25b1('0x52')]=_0x2ef648;return _0x47e9a9;});}})[_0x25b1('0x36')](respondWithFilteredResult(_0x238f14,_0x3f69c1))[_0x25b1('0x53')](handleError(_0x238f14,null));};exports[_0x25b1('0x3c')]=function(_0x179e31,_0x181503,_0x2a3c27){var _0x1cb610,_0x258717,_0x3f88f7;if(_[_0x25b1('0x95')](_0x179e31[_0x25b1('0x5a')][_0x25b1('0x5a')])||_0x179e31[_0x25b1('0x5a')][_0x25b1('0x5a')]===''){throw new db[(_0x25b1('0x7c'))][(_0x25b1('0x1f'))]('body\x20is\x20mandatory\x20and\x20not\x20empty');}if(_[_0x25b1('0x95')](_0x179e31[_0x25b1('0x5a')]['to'])){throw new db[(_0x25b1('0x7c'))][(_0x25b1('0x1f'))](_0x25b1('0xc3'));}_0x1cb610=_0x179e31['body']['to'];return db[_0x25b1('0x3f')][_0x25b1('0x58')]({'where':{'id':_0x179e31[_0x25b1('0x62')]['id']},'include':[{'model':db[_0x25b1('0xc4')],'as':_0x25b1('0xc5'),'include':[{'model':db['CmContact'],'as':_0x25b1('0x9d'),'where':{'mobile':_0x1cb610},'limit':0x1,'order':[[_0x25b1('0x7f'),_0x25b1('0x9b')]]}]}]})[_0x25b1('0x36')](handleEntityNotFound(_0x181503,null))[_0x25b1('0x36')](function(_0x44008e){if(_0x44008e&&_0x44008e[_0x25b1('0xc5')]){_0x258717=_0x44008e['get']({'plain':!![]});if(_0x258717[_0x25b1('0xc5')]&&_0x258717['List'][_0x25b1('0x9d')]['length']){return _0x258717['List'][_0x25b1('0x9d')][0x0];}return db['CmContact'][_0x25b1('0x59')](_['defaults'](_0x179e31[_0x25b1('0x5a')],{'firstName':_0x1cb610,'mobile':_0x1cb610,'phone':_0x1cb610,'ListId':_0x258717[_0x25b1('0x81')]}));}})[_0x25b1('0x36')](handleEntityNotFound(_0x181503,null))[_0x25b1('0x36')](function(_0x27f0d9){if(_0x27f0d9){_0x3f88f7=_0x27f0d9;return db[_0x25b1('0x9f')][_0x25b1('0x58')]({'where':{'ContactId':_0x3f88f7['id'],'closed':![],'SmsAccountId':_0x258717['id']}})['then'](function(_0x26df27){if(_0x26df27){return[_0x26df27,![]];}return db[_0x25b1('0x9f')][_0x25b1('0x59')]({'UserId':_0x179e31[_0x25b1('0x5b')]['id'],'ContactId':_0x3f88f7['id'],'SmsAccountId':_0x258717['id'],'phone':_0x1cb610,'firstMsgDirection':_0x25b1('0xc6'),'Messages':[_[_0x25b1('0x50')](_0x179e31[_0x25b1('0x5a')],{'read':![],'body':_0x179e31[_0x25b1('0x5a')][_0x25b1('0x5a')],'phone':_0x1cb610,'SmsAccountId':_0x258717['id'],'UserId':_0x179e31['user']['id'],'ContactId':_0x3f88f7['id']})]},{'include':[{'model':db[_0x25b1('0xa7')],'as':_0x25b1('0xc7')}]})['then'](function(_0x7d142d){return[_0x7d142d,!![]];});});}})[_0x25b1('0xa0')](function(_0xe9c574,_0x1ad611){if(_0x1ad611){return _0xe9c574;}return db['SmsMessage'][_0x25b1('0x59')](_['merge'](_0x179e31['body'],{'read':![],'body':_0x179e31[_0x25b1('0x5a')][_0x25b1('0x5a')],'phone':_0x1cb610,'SmsAccountId':_0x258717['id'],'SmsInteractionId':_0xe9c574['id'],'UserId':_0x179e31[_0x25b1('0x5b')]['id'],'ContactId':_0x3f88f7['id']}))[_0x25b1('0x36')](function(_0x227e5d){_0xe9c574[_0x25b1('0xc8')][_0x25b1('0xc7')]=[];_0xe9c574[_0x25b1('0xc8')]['Messages']['push'](_0x227e5d[_0x25b1('0xc8')]);return _0xe9c574;});})['then'](respondWithResult(_0x181503,null))['catch'](handleError(_0x181503,null));};exports[_0x25b1('0x2b')]=function(_0x10ff52,_0x13faa6,_0x119174){if(_0x10ff52['body']['id']){delete _0x10ff52[_0x25b1('0x5a')]['id'];}console[_0x25b1('0xc9')]('endpoint\x20/status\x20POST\x20/',_0x10ff52[_0x25b1('0x5a')]);var _0x538bc2,_0x450b97,_0x5baf6b;return db['SmsAccount'][_0x25b1('0x58')]({'where':{'id':_0x10ff52['params']['id']}})[_0x25b1('0x36')](handleEntityNotFound(_0x13faa6,null))[_0x25b1('0x36')](function(_0x1977b8){if(_0x1977b8){_0x5baf6b=_0x1977b8;logger[_0x25b1('0xb3')](_0x25b1('0x23'),_0x25b1('0x2b'),'received\x20delivery\x20report\x20from',_0x1977b8['type'],util[_0x25b1('0xca')](_0x10ff52[_0x25b1('0x5a')],{'showHidden':![],'depth':null}));switch(_0x1977b8[_0x25b1('0x40')]){case'skebby':if(_0x10ff52[_0x25b1('0x5a')]['skebby_dispatch_id']&&_0x10ff52[_0x25b1('0x5a')][_0x25b1('0x2b')]){_0x450b97=_0x10ff52[_0x25b1('0x5a')][_0x25b1('0x2b')];return db[_0x25b1('0xa7')][_0x25b1('0x58')]({'where':{'messageId':_0x10ff52[_0x25b1('0x5a')]['skebby_dispatch_id']}});}break;case _0x25b1('0xcb'):if(_0x10ff52[_0x25b1('0x5a')][_0x25b1('0xcc')]&&_0x10ff52[_0x25b1('0x5a')][_0x25b1('0xcd')]){_0x450b97=_0x10ff52[_0x25b1('0x5a')][_0x25b1('0xcd')];return db[_0x25b1('0xa7')][_0x25b1('0x58')]({'where':{'messageId':_0x10ff52[_0x25b1('0x5a')][_0x25b1('0xcc')]}});}break;case _0x25b1('0x89'):if(_0x10ff52[_0x25b1('0x5a')][_0x25b1('0x8a')]&&_0x10ff52['body'][_0x25b1('0xce')]){_0x450b97=_0x10ff52[_0x25b1('0x5a')][_0x25b1('0xce')];return db[_0x25b1('0xa7')][_0x25b1('0x58')]({'where':{'messageId':_0x10ff52[_0x25b1('0x5a')][_0x25b1('0x8a')]}});}break;case'infobip':var _0x2d3939=_0x10ff52[_0x25b1('0x5a')][_0x25b1('0x8f')][0x0];if(_0x2d3939[_0x25b1('0x84')]&&_0x2d3939[_0x25b1('0x2b')][_0x25b1('0xcf')]===_0x25b1('0xd0')){_0x450b97=_0x2d3939[_0x25b1('0x2b')][_0x25b1('0xcf')];return db['SmsMessage']['find']({'where':{'messageId':_0x2d3939['messageId']}});}break;case _0x25b1('0x91'):if(_0x10ff52[_0x25b1('0x5a')][_0x25b1('0x84')]&&_0x10ff52[_0x25b1('0x5a')][_0x25b1('0x2b')]){_0x450b97=_0x10ff52[_0x25b1('0x5a')][_0x25b1('0x2b')];return db['SmsMessage']['find']({'where':{'messageId':_0x10ff52[_0x25b1('0x5a')][_0x25b1('0x84')]}});}break;case _0x25b1('0x93'):if(_0x10ff52[_0x25b1('0x5a')][_0x25b1('0xd1')]&&_0x10ff52['body'][_0x25b1('0x2b')]){_0x450b97=_0x10ff52[_0x25b1('0x5a')][_0x25b1('0x2b')];return db['SmsMessage']['find']({'where':{'messageId':_0x10ff52[_0x25b1('0x5a')]['redif']}});}break;}}})['then'](handleEntityNotFound(_0x13faa6,null))[_0x25b1('0x36')](function(_0x1ea2cb){if(_0x1ea2cb){_0x538bc2=_0x1ea2cb;switch(_0x5baf6b[_0x25b1('0x40')]){case _0x25b1('0x86'):if(_0x450b97===_0x25b1('0xd0')){return _0x538bc2['update']({'read':!![]});}else{logger[_0x25b1('0x25')]('SmsAccount,\x20%s,\x20%s,\x20%s','status',_0x25b1('0x86'),util[_0x25b1('0xca')](_0x10ff52['body'],{'showHidden':![],'depth':null}));}break;case'connectel':if(_0x450b97==='1'){return _0x538bc2['update']({'read':!![]});}else{logger[_0x25b1('0x25')](_0x25b1('0x23'),_0x25b1('0x2b'),_0x25b1('0x86'),util['inspect'](_0x10ff52['body'],{'showHidden':![],'depth':null}));}break;case'clicksend':if(!_0x10ff52['body'][_0x25b1('0xd2')]&&_0x450b97>=0xc8&&_0x450b97<=0xce){return _0x538bc2[_0x25b1('0x35')]({'read':!![]});}else{logger[_0x25b1('0x25')](_0x25b1('0x23'),_0x25b1('0x2b'),_0x25b1('0x89'),util[_0x25b1('0xca')](_0x10ff52[_0x25b1('0x5a')],{'showHidden':![],'depth':null}));}break;case _0x25b1('0x8e'):var _0x53a5af=_0x10ff52[_0x25b1('0x5a')][_0x25b1('0x8f')][0x0];if(_0x53a5af[_0x25b1('0x2b')][_0x25b1('0xcf')]===_0x25b1('0xd0')){return _0x538bc2[_0x25b1('0x35')]({'read':!![]});}else{logger['error'](_0x25b1('0x23'),'status','infobip',util['inspect'](_0x10ff52['body'],{'showHidden':![],'depth':null}));}break;case _0x25b1('0x91'):if(_0x450b97==_0x25b1('0xd3')||_0x450b97==_0x25b1('0xd4')){return _0x538bc2[_0x25b1('0x35')]({'read':!![]});}else{logger[_0x25b1('0x25')](_0x25b1('0x23'),_0x25b1('0x2b'),_0x25b1('0x91'),util[_0x25b1('0xca')](_0x10ff52[_0x25b1('0x5a')],{'showHidden':![],'depth':null}));}break;case _0x25b1('0x93'):if(_0x450b97===_0x25b1('0xd5')||_0x450b97===_0x25b1('0xd6')){return _0x538bc2[_0x25b1('0x35')]({'read':!![]});}else{logger[_0x25b1('0x25')](_0x25b1('0x23'),'status',_0x25b1('0x93'),util[_0x25b1('0xca')](_0x10ff52[_0x25b1('0x5a')],{'showHidden':![],'depth':null}));}break;}return _0x538bc2;}})[_0x25b1('0x36')](respondWithResult(_0x13faa6,null))['catch'](handleError(_0x13faa6,null));};exports['statusGet']=function(_0x15cb00,_0x4b4576,_0x1be05a){var _0x5ab5ee,_0x46dc93,_0x3a3589;return db[_0x25b1('0x3f')][_0x25b1('0x58')]({'where':{'id':_0x15cb00[_0x25b1('0x62')]['id']}})[_0x25b1('0x36')](handleEntityNotFound(_0x4b4576,null))[_0x25b1('0x36')](function(_0x491022){if(_0x491022){_0x3a3589=_0x491022;logger['debug']('SmsAccount,\x20%s,\x20%s,\x20%s','status',_0x25b1('0xd7'),_0x491022[_0x25b1('0x40')],util['inspect'](_0x15cb00[_0x25b1('0x44')],{'showHidden':![],'depth':null}));switch(_0x491022[_0x25b1('0x40')]){case _0x25b1('0xd8'):if(_0x15cb00[_0x25b1('0x44')][_0x25b1('0xd9')]&&_0x15cb00[_0x25b1('0x44')]['state']){_0x46dc93=_0x15cb00[_0x25b1('0x44')]['state'];return db[_0x25b1('0xa7')][_0x25b1('0x58')]({'where':{'messageId':_0x15cb00['query'][_0x25b1('0xd9')]}});}break;}}})['then'](handleEntityNotFound(_0x4b4576,null))[_0x25b1('0x36')](function(_0x50be4b){if(_0x50be4b){_0x5ab5ee=_0x50be4b;switch(_0x3a3589[_0x25b1('0x40')]){case _0x25b1('0xd8'):if(_0x46dc93==='2'||_0x46dc93==='6'){return _0x5ab5ee[_0x25b1('0x35')]({'read':!![]});}else{logger[_0x25b1('0x25')](_0x25b1('0x23'),_0x25b1('0x2b'),_0x25b1('0xd8'),util[_0x25b1('0xca')](_0x15cb00[_0x25b1('0x44')],{'showHidden':![],'depth':null}));};break;}return _0x5ab5ee;}})[_0x25b1('0x36')](respondWithResult(_0x4b4576,null))[_0x25b1('0x53')](handleError(_0x4b4576,null));};exports[_0x25b1('0xda')]=function(_0x2326ad,_0x1c3bb9,_0x57fe97){return db[_0x25b1('0x3f')][_0x25b1('0x58')]({'where':{'id':_0x2326ad['params']['id']}})[_0x25b1('0x36')](handleEntityNotFound(_0x1c3bb9,null))[_0x25b1('0x36')](function(_0x2b115b){if(_0x2b115b){return _0x2b115b[_0x25b1('0xda')](_0x2326ad[_0x25b1('0x5a')]['ids'],_[_0x25b1('0x9c')](_0x2326ad['body'],['ids','id'])||{})[_0x25b1('0xa0')](function(_0x1aa17d){for(var _0xa9a512=0x0;_0xa9a512<_0x2326ad[_0x25b1('0x5a')]['ids'][_0x25b1('0x4a')];_0xa9a512+=0x1){socket['emit']('userSmsAccount:save',{'UserId':_0x2326ad['body'][_0x25b1('0x6c')][_0xa9a512],'SmsAccountId':_0x2326ad[_0x25b1('0x62')]['id']});}return _0x1aa17d;});}})[_0x25b1('0x36')](respondWithResult(_0x1c3bb9,null))[_0x25b1('0x53')](handleError(_0x1c3bb9,null));};exports[_0x25b1('0xdb')]=function(_0x36ce13,_0x33d443,_0x4b9fdc){return db[_0x25b1('0x3f')][_0x25b1('0x58')]({'where':{'id':_0x36ce13['params']['id']}})[_0x25b1('0x36')](handleEntityNotFound(_0x33d443,null))[_0x25b1('0x36')](function(_0x20e794){if(_0x20e794){return _0x20e794[_0x25b1('0xdb')](_0x36ce13[_0x25b1('0x44')]['ids'])[_0x25b1('0x36')](function(){if(_[_0x25b1('0xdc')](_0x36ce13[_0x25b1('0x44')][_0x25b1('0x6c')])){for(var _0x20ddd0=0x0;_0x20ddd0<_0x36ce13[_0x25b1('0x44')][_0x25b1('0x6c')][_0x25b1('0x4a')];_0x20ddd0+=0x1){socket[_0x25b1('0xdd')](_0x25b1('0xde'),{'UserId':Number(_0x36ce13[_0x25b1('0x44')][_0x25b1('0x6c')][_0x20ddd0]),'SmsAccountId':Number(_0x36ce13[_0x25b1('0x62')]['id'])});}}else{socket[_0x25b1('0xdd')](_0x25b1('0xde'),{'UserId':Number(_0x36ce13['query']['ids']),'SmsAccountId':Number(_0x36ce13[_0x25b1('0x62')]['id'])});}});}})[_0x25b1('0x36')](respondWithStatusCode(_0x33d443,null))['catch'](handleError(_0x33d443,null));};exports['getAgents']=function(_0x59e1a3,_0x1e5c8e,_0x25ccbc){var _0x1a7661={};var _0x487481={};var _0x1d044e;var _0x4045ed;return db[_0x25b1('0x3f')][_0x25b1('0x70')]({'where':{'id':_0x59e1a3[_0x25b1('0x62')]['id']}})[_0x25b1('0x36')](handleEntityNotFound(_0x1e5c8e,null))[_0x25b1('0x36')](function(_0x2c1ae9){if(_0x2c1ae9){_0x1d044e=_0x2c1ae9;_0x487481[_0x25b1('0x42')]=_['keys'](db['User']['rawAttributes']);_0x487481[_0x25b1('0x44')]=_[_0x25b1('0x45')](_0x59e1a3[_0x25b1('0x44')]);_0x487481[_0x25b1('0x46')]=_['intersection'](_0x487481[_0x25b1('0x42')],_0x487481['query']);_0x1a7661[_0x25b1('0x47')]=_[_0x25b1('0x48')](_0x487481[_0x25b1('0x42')],qs[_0x25b1('0x49')](_0x59e1a3[_0x25b1('0x44')][_0x25b1('0x49')]));_0x1a7661[_0x25b1('0x47')]=_0x1a7661[_0x25b1('0x47')][_0x25b1('0x4a')]?_0x1a7661['attributes']:_0x487481[_0x25b1('0x42')];_0x1a7661[_0x25b1('0x68')]=qs[_0x25b1('0x69')](_0x59e1a3[_0x25b1('0x44')][_0x25b1('0x69')]);_0x1a7661[_0x25b1('0x4d')]=qs[_0x25b1('0x46')](_['pick'](_0x59e1a3[_0x25b1('0x44')],_0x487481[_0x25b1('0x46')]));if(_0x59e1a3[_0x25b1('0x44')]['filter']){_0x1a7661['where']=_['merge'](_0x1a7661[_0x25b1('0x4d')],{'$or':_[_0x25b1('0x43')](_0x1a7661[_0x25b1('0x47')],function(_0x475c51){var _0x3d2012={};_0x3d2012[_0x475c51]={'$like':'%'+_0x59e1a3[_0x25b1('0x44')][_0x25b1('0x4f')]+'%'};return _0x3d2012;})});}_0x1a7661=_[_0x25b1('0x50')]({},_0x1a7661,_0x59e1a3['options']);return _0x1d044e[_0x25b1('0xdf')](_0x1a7661);}})[_0x25b1('0x36')](function(_0x30ace8){if(_0x30ace8){_0x4045ed=_0x30ace8['length'];if(!_0x59e1a3[_0x25b1('0x44')][_0x25b1('0x4b')]('nolimit')){_0x1a7661['limit']=qs[_0x25b1('0x2f')](_0x59e1a3[_0x25b1('0x44')][_0x25b1('0x2f')]);_0x1a7661['offset']=qs[_0x25b1('0x2e')](_0x59e1a3[_0x25b1('0x44')][_0x25b1('0x2e')]);}return _0x1d044e[_0x25b1('0xdf')](_0x1a7661);}})[_0x25b1('0x36')](function(_0x4bb378){if(_0x4bb378){return _0x4bb378?{'count':_0x4045ed,'rows':_0x4bb378}:null;}})['then'](respondWithResult(_0x1e5c8e,null))[_0x25b1('0x53')](handleError(_0x1e5c8e,null));}; \ No newline at end of file +var _0x3d04=['debug','SmsAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','SmsAccount,\x20%s,\x20%s','message','catch','sendStatus','status','end','json','count','offset','limit','set','Content-Range','apply','reject','save','update','then','SmsAccounts','UserProfileResource','destroy','stack','name','send','index','Pause','mandatoryDispositionPause','map','SmsAccount','rawAttributes','fieldName','model','query','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','VIRTUAL','options','includeAll','include','findAll','rows','params','keys','merge','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','addDisposition','SmsAccountId','getDispositions','findOne','Disposition','filters','removeDispositions','ids','addAnswer','CannedAnswer','getAnswers','removeAnswers','notify','sms','SmsApplication','Applications','account','applications','orderBy','asc','CmContact','Sequelize','ValidationError','no\x20available\x20attributes','difference','createdAt','updatedAt','CompanyId','ListId','mobile','type','from','From','Body','messageId','skebby','sender','text','clicksend','message_id','plivo','Text','MessageUUID','infobip','results','segmentedMessage','replyMessageId','isNil','body\x20is\x20mandatory\x20and\x20not\x20empty','includes','mapKey','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','CmList','list','omit','Contacts','contact','SmsInteraction','spread','interaction','unmanaged','*,*,*,*','created','ContactId','AttachmentId','UserId','User','unshift','agent','Start','startRouting','receiveMessage','entity\x20found','twilio','Content-Type','text/xml','addApplications','sequelize','bulkCreate','findAndCountAll','priority','getApplications','getInteractions','Contact','Owner','fullname','internal','Tag','Tags','tag','to\x20is\x20mandatory','List','DESC','out','SmsMessage','Messages','dataValues','push','endpoint\x20/status\x20POST\x20/','inspect','skebby_dispatch_id','connectel','requestid','statusInt','status_code','groupName','DELIVERED','intelepeer','redif','DELIVERED_TO_GATEWAY','clickatell','DELIVRD','ACCEPTD','received\x20delivery\x20report\x20from','message-id','state','csc','addAgents','userSmsAccount:save','removeAgents','emit','userSmsAccount:remove','getAgents','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','sox','to-csv','jsforce','desk.js','querystring','papaparse','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/environment','redis','defaults','localhost','socket.io-emitter','register','jayson/promise','client','test','The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.','request','info','request\x20sent'];(function(_0x149bb0,_0x2cbeba){var _0x41cfb9=function(_0x176084){while(--_0x176084){_0x149bb0['push'](_0x149bb0['shift']());}};_0x41cfb9(++_0x2cbeba);}(_0x3d04,0xbe));var _0x43d0=function(_0x3bf83f,_0x181cac){_0x3bf83f=_0x3bf83f-0x0;var _0x22c4a9=_0x3d04[_0x3bf83f];return _0x22c4a9;};'use strict';var pdf=require(_0x43d0('0x0'));var emlformat=require(_0x43d0('0x1'));var rimraf=require(_0x43d0('0x2'));var zipdir=require(_0x43d0('0x3'));var jsonpatch=require(_0x43d0('0x4'));var rp=require(_0x43d0('0x5'));var moment=require(_0x43d0('0x6'));var BPromise=require(_0x43d0('0x7'));var Mustache=require('mustache');var util=require(_0x43d0('0x8'));var path=require(_0x43d0('0x9'));var sox=require(_0x43d0('0xa'));var csv=require(_0x43d0('0xb'));var ejs=require('ejs');var fs=require('fs');var _=require('lodash');var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x43d0('0xc'));var deskjs=require(_0x43d0('0xd'));var toCsv=require(_0x43d0('0xb'));var querystring=require(_0x43d0('0xe'));var Papa=require(_0x43d0('0xf'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x43d0('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x43d0('0x11'))(_0x43d0('0x12'));var utils=require(_0x43d0('0x13'));var config=require(_0x43d0('0x14'));var db=require('../../mysqldb')['db'];config[_0x43d0('0x15')]=_[_0x43d0('0x16')](config['redis'],{'host':_0x43d0('0x17'),'port':0x18eb});var socket=require(_0x43d0('0x18'))(new Redis(config[_0x43d0('0x15')]));require('./smsAccount.socket')[_0x43d0('0x19')](socket);var jayson=require(_0x43d0('0x1a'));var client=jayson[_0x43d0('0x1b')]['http']({'port':0x232c});function checkPasswordPattern(_0x257510,_0x357f87,_0x44e6ec){if(_0x44e6ec){var _0x1218b5=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x1218b5[_0x43d0('0x1c')](_0x357f87)){return _0x257510;}else{throw new db['Sequelize']['ValidationError'](_0x43d0('0x1d'));}}else{return _0x257510;}}function respondWithRpcPromise(_0x3356f1,_0x35decf,_0x56a27b,_0x2c641e){return new BPromise(function(_0x532402,_0x2c9d06){var _0x468ca2=_0x2c641e||client;return _0x468ca2[_0x43d0('0x1e')](_0x3356f1,_0x56a27b)['then'](function(_0x3d7dcc){logger[_0x43d0('0x1f')]('SmsAccount,\x20%s,\x20%s',_0x35decf,_0x43d0('0x20'));logger[_0x43d0('0x21')](_0x43d0('0x22'),_0x35decf,_0x43d0('0x20'),JSON[_0x43d0('0x23')](_0x3d7dcc));if(_0x3d7dcc[_0x43d0('0x24')]){if(_0x3d7dcc[_0x43d0('0x24')][_0x43d0('0x25')]===0x1f4){logger[_0x43d0('0x24')](_0x43d0('0x26'),_0x35decf,_0x3d7dcc[_0x43d0('0x24')][_0x43d0('0x27')]);return _0x2c9d06(_0x3d7dcc[_0x43d0('0x24')][_0x43d0('0x27')]);}logger[_0x43d0('0x24')]('SmsAccount,\x20%s,\x20%s',_0x35decf,_0x3d7dcc[_0x43d0('0x24')][_0x43d0('0x27')]);return _0x532402(_0x3d7dcc['error'][_0x43d0('0x27')]);}else{logger['info'](_0x43d0('0x26'),_0x35decf,_0x43d0('0x20'));_0x532402(_0x3d7dcc['result'][_0x43d0('0x27')]);}})[_0x43d0('0x28')](function(_0x5ac4c0){logger[_0x43d0('0x24')](_0x43d0('0x26'),_0x35decf,_0x5ac4c0);_0x2c9d06(_0x5ac4c0);});});}function respondWithStatusCode(_0x22ae3c,_0x5f16ac){_0x5f16ac=_0x5f16ac||0xcc;return function(_0x447725){if(_0x447725){return _0x22ae3c[_0x43d0('0x29')](_0x5f16ac);}return _0x22ae3c[_0x43d0('0x2a')](_0x5f16ac)[_0x43d0('0x2b')]();};}function respondWithResult(_0x37d78f,_0x440ecb){_0x440ecb=_0x440ecb||0xc8;return function(_0x31a057){if(_0x31a057){return _0x37d78f['status'](_0x440ecb)[_0x43d0('0x2c')](_0x31a057);}};}function respondWithFilteredResult(_0x2f5bc5,_0x6bc471){return function(_0x5f3d38){if(_0x5f3d38){var _0x4bfce9=_0x5f3d38[_0x43d0('0x2d')],_0x52c37b=_0x6bc471[_0x43d0('0x2e')],_0x3c1ea3=_0x6bc471[_0x43d0('0x2e')]+_0x6bc471[_0x43d0('0x2f')],_0x2db9dc;if(_0x3c1ea3>=_0x4bfce9){_0x3c1ea3=_0x4bfce9;_0x2db9dc=0xc8;}else{_0x2db9dc=0xce;}_0x2f5bc5['status'](_0x2db9dc);return _0x2f5bc5[_0x43d0('0x30')](_0x43d0('0x31'),_0x52c37b+'-'+_0x3c1ea3+'/'+_0x4bfce9)[_0x43d0('0x2c')](_0x5f3d38);}return null;};}function patchUpdates(_0x30cbc5){return function(_0xbc5a4){try{jsonpatch[_0x43d0('0x32')](_0xbc5a4,_0x30cbc5,!![]);}catch(_0x12a8b9){return BPromise[_0x43d0('0x33')](_0x12a8b9);}return _0xbc5a4[_0x43d0('0x34')]();};}function saveUpdates(_0x89799a,_0x42de80){return function(_0x5385ee){if(_0x5385ee){return _0x5385ee[_0x43d0('0x35')](_0x89799a)[_0x43d0('0x36')](function(_0x45ec78){return _0x45ec78;});}return null;};}function removeEntity(_0x4058df,_0x57b317){return function(_0x336695){if(_0x336695){return _0x336695['destroy']()[_0x43d0('0x36')](function(){var _0x23cc5b=_0x336695['get']({'plain':!![]});var _0x423a3f=_0x43d0('0x37');return db[_0x43d0('0x38')][_0x43d0('0x39')]({'where':{'type':_0x423a3f,'resourceId':_0x23cc5b['id']}})[_0x43d0('0x36')](function(){return _0x336695;});})[_0x43d0('0x36')](function(){_0x4058df[_0x43d0('0x2a')](0xcc)[_0x43d0('0x2b')]();});}};}function handleEntityNotFound(_0x7b7983,_0x3c56fc){return function(_0x41ff64){if(!_0x41ff64){_0x7b7983['sendStatus'](0x194);}return _0x41ff64;};}function handleError(_0x3afb3b,_0x397bd6){_0x397bd6=_0x397bd6||0x1f4;return function(_0x31f4e8){logger[_0x43d0('0x24')](_0x31f4e8[_0x43d0('0x3a')]);if(_0x31f4e8[_0x43d0('0x3b')]){delete _0x31f4e8[_0x43d0('0x3b')];}_0x3afb3b[_0x43d0('0x2a')](_0x397bd6)[_0x43d0('0x3c')](_0x31f4e8);};}exports[_0x43d0('0x3d')]=function(_0x235fb2,_0x1f0092){var _0x19843c={'include':[{'model':db[_0x43d0('0x3e')],'as':_0x43d0('0x3f')}]},_0x9cfc45={},_0x58c04d={'count':0x0,'rows':[]};var _0x38f330=_[_0x43d0('0x40')](db[_0x43d0('0x41')][_0x43d0('0x42')],function(_0x420256){return{'name':_0x420256[_0x43d0('0x43')],'type':_0x420256['type']['key']};});_0x9cfc45[_0x43d0('0x44')]=_['map'](_0x38f330,'name');_0x9cfc45[_0x43d0('0x45')]=_['keys'](_0x235fb2[_0x43d0('0x45')]);_0x9cfc45['filters']=_[_0x43d0('0x46')](_0x9cfc45['model'],_0x9cfc45[_0x43d0('0x45')]);_0x19843c[_0x43d0('0x47')]=_[_0x43d0('0x46')](_0x9cfc45['model'],qs[_0x43d0('0x48')](_0x235fb2['query'][_0x43d0('0x48')]));_0x19843c['attributes']=_0x19843c['attributes'][_0x43d0('0x49')]?_0x19843c[_0x43d0('0x47')]:_0x9cfc45['model'];if(!_0x235fb2[_0x43d0('0x45')][_0x43d0('0x4a')](_0x43d0('0x4b'))){_0x19843c[_0x43d0('0x2f')]=qs[_0x43d0('0x2f')](_0x235fb2['query'][_0x43d0('0x2f')]);_0x19843c[_0x43d0('0x2e')]=qs[_0x43d0('0x2e')](_0x235fb2[_0x43d0('0x45')]['offset']);}_0x19843c[_0x43d0('0x4c')]=qs[_0x43d0('0x4d')](_0x235fb2[_0x43d0('0x45')][_0x43d0('0x4d')]);_0x19843c[_0x43d0('0x4e')]=qs['filters'](_[_0x43d0('0x4f')](_0x235fb2[_0x43d0('0x45')],_0x9cfc45['filters']));if(_0x235fb2[_0x43d0('0x45')][_0x43d0('0x50')]){_0x19843c[_0x43d0('0x4e')]=_['merge'](_0x19843c[_0x43d0('0x4e')],{'$or':_['map'](_0x38f330,function(_0x19362e){if(_0x19362e['type']!==_0x43d0('0x51')){var _0x269d99={};_0x269d99[_0x19362e[_0x43d0('0x3b')]]={'$like':'%'+_0x235fb2[_0x43d0('0x45')][_0x43d0('0x50')]+'%'};return _0x269d99;}})});}_0x19843c=_['merge']({},_0x19843c,_0x235fb2[_0x43d0('0x52')]);var _0x4bb2a0={'where':_0x19843c[_0x43d0('0x4e')]};return db[_0x43d0('0x41')][_0x43d0('0x2d')](_0x4bb2a0)[_0x43d0('0x36')](function(_0x3b7e25){_0x58c04d[_0x43d0('0x2d')]=_0x3b7e25;if(_0x235fb2[_0x43d0('0x45')][_0x43d0('0x53')]){_0x19843c[_0x43d0('0x54')]=[{'all':!![]}];}return db[_0x43d0('0x41')][_0x43d0('0x55')](_0x19843c);})[_0x43d0('0x36')](function(_0x52551f){_0x58c04d[_0x43d0('0x56')]=_0x52551f;return _0x58c04d;})[_0x43d0('0x36')](respondWithFilteredResult(_0x1f0092,_0x19843c))[_0x43d0('0x28')](handleError(_0x1f0092,null));};exports['show']=function(_0x2671dd,_0x5f229e){var _0x5a2854={'raw':![],'where':{'id':_0x2671dd[_0x43d0('0x57')]['id']},'include':[{'model':db[_0x43d0('0x3e')],'as':_0x43d0('0x3f')}]},_0x2477ec={};_0x2477ec[_0x43d0('0x44')]=_['keys'](db['SmsAccount'][_0x43d0('0x42')]);_0x2477ec['query']=_[_0x43d0('0x58')](_0x2671dd[_0x43d0('0x45')]);_0x2477ec['filters']=_['intersection'](_0x2477ec['model'],_0x2477ec[_0x43d0('0x45')]);_0x5a2854[_0x43d0('0x47')]=_[_0x43d0('0x46')](_0x2477ec[_0x43d0('0x44')],qs[_0x43d0('0x48')](_0x2671dd[_0x43d0('0x45')][_0x43d0('0x48')]));_0x5a2854[_0x43d0('0x47')]=_0x5a2854[_0x43d0('0x47')]['length']?_0x5a2854[_0x43d0('0x47')]:_0x2477ec[_0x43d0('0x44')];if(_0x2671dd[_0x43d0('0x45')][_0x43d0('0x53')]){_0x5a2854[_0x43d0('0x54')]=[{'all':!![]}];}_0x5a2854=_[_0x43d0('0x59')]({},_0x5a2854,_0x2671dd[_0x43d0('0x52')]);return db[_0x43d0('0x41')][_0x43d0('0x5a')](_0x5a2854)[_0x43d0('0x36')](handleEntityNotFound(_0x5f229e,null))['then'](respondWithResult(_0x5f229e,null))['catch'](handleError(_0x5f229e,null));};exports[_0x43d0('0x5b')]=function(_0x12e3c0,_0x1ea22a){return db[_0x43d0('0x41')][_0x43d0('0x5b')](_0x12e3c0[_0x43d0('0x5c')],{})[_0x43d0('0x36')](function(_0x2e9bb2){var _0x3ad050=_0x12e3c0[_0x43d0('0x5d')][_0x43d0('0x5e')]({'plain':!![]});if(!_0x3ad050)throw new Error(_0x43d0('0x5f'));if(_0x3ad050[_0x43d0('0x60')]===_0x43d0('0x5d')){var _0x40798f=_0x2e9bb2['get']({'plain':!![]});var _0x4d7549='SmsAccounts';return db[_0x43d0('0x61')][_0x43d0('0x5a')]({'where':{'name':_0x4d7549,'userProfileId':_0x3ad050[_0x43d0('0x62')]},'raw':!![]})['then'](function(_0x537fe4){if(_0x537fe4&&_0x537fe4['autoAssociation']===0x0){return db[_0x43d0('0x38')]['create']({'name':_0x40798f[_0x43d0('0x3b')],'resourceId':_0x40798f['id'],'type':_0x537fe4[_0x43d0('0x3b')],'sectionId':_0x537fe4['id']},{})[_0x43d0('0x36')](function(){return _0x2e9bb2;});}else{return _0x2e9bb2;}})['catch'](function(_0x167434){logger[_0x43d0('0x24')](_0x43d0('0x63'),_0x167434);throw _0x167434;});}return _0x2e9bb2;})[_0x43d0('0x36')](respondWithResult(_0x1ea22a,0xc9))[_0x43d0('0x28')](handleError(_0x1ea22a,null));};exports[_0x43d0('0x35')]=function(_0x2e061b,_0x42b282){if(_0x2e061b[_0x43d0('0x5c')]['id']){delete _0x2e061b[_0x43d0('0x5c')]['id'];}return db['SmsAccount'][_0x43d0('0x5a')]({'where':{'id':_0x2e061b[_0x43d0('0x57')]['id']},'include':[{'model':db[_0x43d0('0x3e')],'as':_0x43d0('0x3f')}]})[_0x43d0('0x36')](handleEntityNotFound(_0x42b282,null))[_0x43d0('0x36')](saveUpdates(_0x2e061b['body'],null))[_0x43d0('0x36')](respondWithResult(_0x42b282,null))[_0x43d0('0x28')](handleError(_0x42b282,null));};exports[_0x43d0('0x39')]=function(_0x11d4a6,_0x2d4fac){return db[_0x43d0('0x41')]['find']({'where':{'id':_0x11d4a6[_0x43d0('0x57')]['id']}})[_0x43d0('0x36')](handleEntityNotFound(_0x2d4fac,null))[_0x43d0('0x36')](removeEntity(_0x2d4fac,null))[_0x43d0('0x28')](handleError(_0x2d4fac,null));};exports['describe']=function(_0x60a959,_0x44333){return db[_0x43d0('0x41')]['describe']()['then'](respondWithResult(_0x44333,null))[_0x43d0('0x28')](handleError(_0x44333,null));};exports[_0x43d0('0x64')]=function(_0x4ccca7,_0x5dba0e,_0x167194){if(_0x4ccca7[_0x43d0('0x5c')]['id']){delete _0x4ccca7[_0x43d0('0x5c')]['id'];}return db[_0x43d0('0x41')][_0x43d0('0x5a')]({'where':{'id':_0x4ccca7[_0x43d0('0x57')]['id']}})[_0x43d0('0x36')](handleEntityNotFound(_0x5dba0e,null))[_0x43d0('0x36')](function(_0x554919){if(_0x554919){_0x4ccca7[_0x43d0('0x5c')][_0x43d0('0x65')]=_0x554919['id'];return db['Disposition']['create'](_0x4ccca7['body']);}})[_0x43d0('0x36')](respondWithResult(_0x5dba0e,null))[_0x43d0('0x28')](handleError(_0x5dba0e,null));};exports[_0x43d0('0x66')]=function(_0x505946,_0x9b5f0d,_0x39cd52){var _0x551dae={'raw':![],'where':{}};var _0x123bac={};var _0xf6ac0c={'count':0x0,'rows':[]};return db['SmsAccount'][_0x43d0('0x67')]({'where':{'id':_0x505946['params']['id']}})[_0x43d0('0x36')](handleEntityNotFound(_0x9b5f0d,null))[_0x43d0('0x36')](function(_0x4a947b){if(_0x4a947b){_0x123bac['model']=_[_0x43d0('0x58')](db[_0x43d0('0x68')][_0x43d0('0x42')]);_0x123bac['query']=_['keys'](_0x505946[_0x43d0('0x45')]);_0x123bac[_0x43d0('0x69')]=_['intersection'](_0x123bac[_0x43d0('0x44')],_0x123bac['query']);_0x551dae['attributes']=_[_0x43d0('0x46')](_0x123bac[_0x43d0('0x44')],qs[_0x43d0('0x48')](_0x505946[_0x43d0('0x45')][_0x43d0('0x48')]));_0x551dae[_0x43d0('0x47')]=_0x551dae[_0x43d0('0x47')][_0x43d0('0x49')]?_0x551dae[_0x43d0('0x47')]:_0x123bac[_0x43d0('0x44')];if(!_0x505946[_0x43d0('0x45')]['hasOwnProperty'](_0x43d0('0x4b'))){_0x551dae['limit']=qs['limit'](_0x505946[_0x43d0('0x45')][_0x43d0('0x2f')]);_0x551dae['offset']=qs[_0x43d0('0x2e')](_0x505946[_0x43d0('0x45')][_0x43d0('0x2e')]);}_0x551dae[_0x43d0('0x4c')]=qs[_0x43d0('0x4d')](_0x505946[_0x43d0('0x45')][_0x43d0('0x4d')]);_0x551dae[_0x43d0('0x4e')]=qs[_0x43d0('0x69')](_[_0x43d0('0x4f')](_0x505946[_0x43d0('0x45')],_0x123bac[_0x43d0('0x69')]));_0x551dae[_0x43d0('0x4e')][_0x43d0('0x65')]=_0x4a947b['id'];if(_0x505946[_0x43d0('0x45')]['filter']){_0x551dae[_0x43d0('0x4e')]=_[_0x43d0('0x59')](_0x551dae[_0x43d0('0x4e')],{'$or':_[_0x43d0('0x40')](_0x551dae[_0x43d0('0x47')],function(_0x41455e){var _0x52fda6={};_0x52fda6[_0x41455e]={'$like':'%'+_0x505946[_0x43d0('0x45')]['filter']+'%'};return _0x52fda6;})});}_0x551dae=_[_0x43d0('0x59')]({},_0x551dae,_0x505946[_0x43d0('0x52')]);return db[_0x43d0('0x68')][_0x43d0('0x2d')]({'where':_0x551dae[_0x43d0('0x4e')]})[_0x43d0('0x36')](function(_0x219d70){_0xf6ac0c['count']=_0x219d70;if(_0x505946['query'][_0x43d0('0x53')]){_0x551dae[_0x43d0('0x54')]=[{'all':!![]}];}return db[_0x43d0('0x68')][_0x43d0('0x55')](_0x551dae);})[_0x43d0('0x36')](function(_0x371486){_0xf6ac0c['rows']=_0x371486;return _0xf6ac0c;});}})['then'](respondWithFilteredResult(_0x9b5f0d,_0x551dae))[_0x43d0('0x28')](handleError(_0x9b5f0d,null));};exports['removeDispositions']=function(_0x1ed60f,_0x2cc15b,_0xefc976){return db[_0x43d0('0x41')][_0x43d0('0x5a')]({'where':{'id':_0x1ed60f[_0x43d0('0x57')]['id']}})[_0x43d0('0x36')](handleEntityNotFound(_0x2cc15b,null))['then'](function(_0x2b276f){if(_0x2b276f){return _0x2b276f[_0x43d0('0x6a')](_0x1ed60f[_0x43d0('0x45')][_0x43d0('0x6b')]);}})[_0x43d0('0x36')](respondWithStatusCode(_0x2cc15b,null))[_0x43d0('0x28')](handleError(_0x2cc15b,null));};exports[_0x43d0('0x6c')]=function(_0x2b1454,_0x2e823b,_0x365d32){if(_0x2b1454[_0x43d0('0x5c')]['id']){delete _0x2b1454[_0x43d0('0x5c')]['id'];}return db[_0x43d0('0x41')][_0x43d0('0x5a')]({'where':{'id':_0x2b1454['params']['id']}})['then'](handleEntityNotFound(_0x2e823b,null))['then'](function(_0x83096c){if(_0x83096c){_0x2b1454[_0x43d0('0x5c')][_0x43d0('0x65')]=_0x83096c['id'];return db[_0x43d0('0x6d')]['create'](_0x2b1454[_0x43d0('0x5c')]);}})['then'](respondWithResult(_0x2e823b,null))[_0x43d0('0x28')](handleError(_0x2e823b,null));};exports[_0x43d0('0x6e')]=function(_0x754cd4,_0xd2039f,_0x257ebc){var _0xee9f4c={'raw':![],'where':{}};var _0x1ab610={};var _0x531ba2={'count':0x0,'rows':[]};return db[_0x43d0('0x41')][_0x43d0('0x67')]({'where':{'id':_0x754cd4[_0x43d0('0x57')]['id']}})[_0x43d0('0x36')](handleEntityNotFound(_0xd2039f,null))['then'](function(_0x28df3b){if(_0x28df3b){_0x1ab610['model']=_[_0x43d0('0x58')](db['CannedAnswer'][_0x43d0('0x42')]);_0x1ab610[_0x43d0('0x45')]=_[_0x43d0('0x58')](_0x754cd4['query']);_0x1ab610[_0x43d0('0x69')]=_[_0x43d0('0x46')](_0x1ab610[_0x43d0('0x44')],_0x1ab610[_0x43d0('0x45')]);_0xee9f4c['attributes']=_[_0x43d0('0x46')](_0x1ab610[_0x43d0('0x44')],qs[_0x43d0('0x48')](_0x754cd4[_0x43d0('0x45')][_0x43d0('0x48')]));_0xee9f4c[_0x43d0('0x47')]=_0xee9f4c[_0x43d0('0x47')][_0x43d0('0x49')]?_0xee9f4c['attributes']:_0x1ab610[_0x43d0('0x44')];if(!_0x754cd4['query'][_0x43d0('0x4a')](_0x43d0('0x4b'))){_0xee9f4c['limit']=qs[_0x43d0('0x2f')](_0x754cd4[_0x43d0('0x45')][_0x43d0('0x2f')]);_0xee9f4c[_0x43d0('0x2e')]=qs[_0x43d0('0x2e')](_0x754cd4['query'][_0x43d0('0x2e')]);}_0xee9f4c['order']=qs[_0x43d0('0x4d')](_0x754cd4['query'][_0x43d0('0x4d')]);_0xee9f4c['where']=qs[_0x43d0('0x69')](_['pick'](_0x754cd4['query'],_0x1ab610[_0x43d0('0x69')]));_0xee9f4c[_0x43d0('0x4e')][_0x43d0('0x65')]=_0x28df3b['id'];if(_0x754cd4[_0x43d0('0x45')][_0x43d0('0x50')]){_0xee9f4c[_0x43d0('0x4e')]=_[_0x43d0('0x59')](_0xee9f4c[_0x43d0('0x4e')],{'$or':_[_0x43d0('0x40')](_0xee9f4c[_0x43d0('0x47')],function(_0x2e1208){var _0x26ae3b={};_0x26ae3b[_0x2e1208]={'$like':'%'+_0x754cd4[_0x43d0('0x45')]['filter']+'%'};return _0x26ae3b;})});}_0xee9f4c=_[_0x43d0('0x59')]({},_0xee9f4c,_0x754cd4[_0x43d0('0x52')]);return db[_0x43d0('0x6d')][_0x43d0('0x2d')]({'where':_0xee9f4c[_0x43d0('0x4e')]})['then'](function(_0x44e2a9){_0x531ba2[_0x43d0('0x2d')]=_0x44e2a9;if(_0x754cd4[_0x43d0('0x45')][_0x43d0('0x53')]){_0xee9f4c[_0x43d0('0x54')]=[{'all':!![]}];}return db[_0x43d0('0x6d')]['findAll'](_0xee9f4c);})[_0x43d0('0x36')](function(_0x27def6){_0x531ba2[_0x43d0('0x56')]=_0x27def6;return _0x531ba2;});}})['then'](respondWithFilteredResult(_0xd2039f,_0xee9f4c))[_0x43d0('0x28')](handleError(_0xd2039f,null));};exports[_0x43d0('0x6f')]=function(_0x53c4b1,_0x4dac88,_0x10c838){return db[_0x43d0('0x41')][_0x43d0('0x5a')]({'where':{'id':_0x53c4b1[_0x43d0('0x57')]['id']}})['then'](handleEntityNotFound(_0x4dac88,null))[_0x43d0('0x36')](function(_0x1072d3){if(_0x1072d3){return _0x1072d3['removeAnswers'](_0x53c4b1['query'][_0x43d0('0x6b')]);}})['then'](respondWithStatusCode(_0x4dac88,null))[_0x43d0('0x28')](handleError(_0x4dac88,null));};exports[_0x43d0('0x70')]=function(_0xa835df,_0x4016fb,_0x476ce2){var _0x3e8811={'channel':_0x43d0('0x71')};var _0xace5c0=[];var _0x1ab7fb=[];var _0x55c834={};return db['SmsAccount'][_0x43d0('0x5a')]({'where':{'id':_0xa835df[_0x43d0('0x57')]['id']},'include':[{'model':db[_0x43d0('0x72')],'as':_0x43d0('0x73')}]})['then'](handleEntityNotFound(_0x4016fb,null))['then'](function(_0x45b90b){_0x3e8811[_0x43d0('0x74')]=_0x45b90b;_0x3e8811[_0x43d0('0x75')]=_[_0x43d0('0x76')](_0x45b90b[_0x43d0('0x73')],['priority'],[_0x43d0('0x77')]);if(_0x3e8811[_0x43d0('0x74')][_0x43d0('0x73')]){delete _0x3e8811[_0x43d0('0x74')][_0x43d0('0x73')];}return db[_0x43d0('0x78')]['describe']();})[_0x43d0('0x36')](function(_0x4e1751){if(!_0x4e1751){throw new db[(_0x43d0('0x79'))][(_0x43d0('0x7a'))](_0x43d0('0x7b'));}_0xace5c0=_[_0x43d0('0x7c')](_['keys'](_0x4e1751),[_0x43d0('0x7d'),'updatedAt']);_0x1ab7fb=_[_0x43d0('0x7c')](_[_0x43d0('0x58')](_0x4e1751),[_0x43d0('0x7d'),_0x43d0('0x7e'),_0x43d0('0x7f'),_0x43d0('0x80')]);_0x3e8811[_0x43d0('0x5c')]={'mapKey':_0x43d0('0x81')};if(_0x3e8811[_0x43d0('0x74')][_0x43d0('0x82')]){switch(_0x3e8811[_0x43d0('0x74')][_0x43d0('0x82')]){case'twilio':_0x3e8811[_0x43d0('0x5c')][_0x43d0('0x83')]=_0xa835df[_0x43d0('0x5c')][_0x43d0('0x84')];_0x3e8811[_0x43d0('0x5c')][_0x43d0('0x5c')]=_0xa835df[_0x43d0('0x5c')][_0x43d0('0x85')];_0x3e8811[_0x43d0('0x5c')][_0x43d0('0x86')]=_0xa835df[_0x43d0('0x5c')]['MessageSid'];break;case _0x43d0('0x87'):_0x3e8811['body'][_0x43d0('0x83')]='+'+_0xa835df[_0x43d0('0x5c')][_0x43d0('0x88')];_0x3e8811['body'][_0x43d0('0x5c')]=_0xa835df[_0x43d0('0x5c')][_0x43d0('0x89')];break;case'connectel':_0x3e8811[_0x43d0('0x5c')][_0x43d0('0x83')]=_0xa835df[_0x43d0('0x5c')][_0x43d0('0x83')];_0x3e8811[_0x43d0('0x5c')][_0x43d0('0x5c')]=_0xa835df[_0x43d0('0x5c')][_0x43d0('0x27')];break;case _0x43d0('0x8a'):_0x3e8811[_0x43d0('0x5c')]['from']=_0xa835df[_0x43d0('0x5c')][_0x43d0('0x83')];_0x3e8811[_0x43d0('0x5c')][_0x43d0('0x5c')]=_0xa835df[_0x43d0('0x5c')][_0x43d0('0x5c')];_0x3e8811[_0x43d0('0x5c')]['messageId']=_0xa835df[_0x43d0('0x5c')][_0x43d0('0x8b')];break;case _0x43d0('0x8c'):_0x3e8811['body'][_0x43d0('0x83')]=_0xa835df['body'][_0x43d0('0x84')];_0x3e8811[_0x43d0('0x5c')][_0x43d0('0x5c')]=_0xa835df['body'][_0x43d0('0x8d')];_0x3e8811[_0x43d0('0x5c')]['messageId']=_0xa835df[_0x43d0('0x5c')][_0x43d0('0x8e')];break;case _0x43d0('0x8f'):_0x3e8811[_0x43d0('0x5c')][_0x43d0('0x83')]='+'+_0xa835df[_0x43d0('0x5c')][_0x43d0('0x90')][0x0][_0x43d0('0x83')];_0x3e8811[_0x43d0('0x5c')]['body']=_0xa835df[_0x43d0('0x5c')]['results'][0x0][_0x43d0('0x89')];_0x3e8811[_0x43d0('0x5c')][_0x43d0('0x86')]=_0xa835df['body'][_0x43d0('0x90')][0x0][_0x43d0('0x86')];break;case'csc':_0x3e8811[_0x43d0('0x5c')][_0x43d0('0x83')]=_0xa835df[_0x43d0('0x5c')]['originatingAddress'];_0x3e8811[_0x43d0('0x5c')][_0x43d0('0x5c')]=_0xa835df[_0x43d0('0x5c')][_0x43d0('0x91')][_0x43d0('0x27')];break;case'clickatell':_0x3e8811[_0x43d0('0x5c')][_0x43d0('0x83')]=_0xa835df[_0x43d0('0x5c')]['fromNumber'];_0x3e8811[_0x43d0('0x5c')][_0x43d0('0x5c')]=_0xa835df[_0x43d0('0x5c')][_0x43d0('0x89')];_0x3e8811['body'][_0x43d0('0x86')]=_0xa835df['body'][_0x43d0('0x92')];break;case'intelepeer':_0x3e8811[_0x43d0('0x5c')][_0x43d0('0x83')]=_0xa835df[_0x43d0('0x5c')]['from'];_0x3e8811[_0x43d0('0x5c')][_0x43d0('0x5c')]=_0xa835df['body'][_0x43d0('0x27')];_0x3e8811[_0x43d0('0x5c')][_0x43d0('0x86')]=_0xa835df[_0x43d0('0x5c')]['refid'];break;}}if(_0x3e8811[_0x43d0('0x5c')]['id']){delete _0x3e8811[_0x43d0('0x5c')]['id'];}if(_[_0x43d0('0x93')](_0x3e8811[_0x43d0('0x5c')][_0x43d0('0x83')])){throw new db[(_0x43d0('0x79'))][(_0x43d0('0x7a'))]('from\x20is\x20mandatory');}if(_[_0x43d0('0x93')](_0x3e8811[_0x43d0('0x5c')]['body'])||_0x3e8811[_0x43d0('0x5c')][_0x43d0('0x5c')]===''){throw new db['Sequelize']['ValidationError'](_0x43d0('0x94'));}if(_[_0x43d0('0x93')](_0x3e8811[_0x43d0('0x5c')]['mapKey'])){throw new db['Sequelize'][(_0x43d0('0x7a'))]('mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20'+_0x1ab7fb);}if(!_[_0x43d0('0x95')](_0x1ab7fb,_0x3e8811[_0x43d0('0x5c')][_0x43d0('0x96')])){throw new db[(_0x43d0('0x79'))]['ValidationError'](_0x43d0('0x97')+_0x1ab7fb);}_0x55c834[_0x3e8811[_0x43d0('0x5c')][_0x43d0('0x96')]]=_0x3e8811['body'][_0x43d0('0x83')];return db[_0x43d0('0x98')][_0x43d0('0x5a')]({'where':{'id':_0x3e8811[_0x43d0('0x74')][_0x43d0('0x80')]},'include':[{'model':db['CmContact'],'as':'Contacts','where':_0x55c834,'limit':0x1,'order':[[_0x43d0('0x7e'),'DESC']]}]});})[_0x43d0('0x36')](handleEntityNotFound(_0x4016fb,null))['then'](function(_0x4c46ba){if(_0x4c46ba){_0x3e8811[_0x43d0('0x99')]=_[_0x43d0('0x9a')](_0x4c46ba,['Contacts']);if(_0x4c46ba[_0x43d0('0x9b')][_0x43d0('0x49')]){return _0x4c46ba['Contacts'][0x0];}var _0x258b2e=_[_0x43d0('0x16')](_0x3e8811[_0x43d0('0x5c')],{'firstName':_0x3e8811[_0x43d0('0x5c')]['from'],'ListId':_0x4c46ba['id']});_0x258b2e[_0x3e8811[_0x43d0('0x5c')][_0x43d0('0x96')]]=_0x3e8811[_0x43d0('0x5c')][_0x43d0('0x83')];return db[_0x43d0('0x78')][_0x43d0('0x5b')](_0x258b2e,{'fields':_0xace5c0,'raw':!![]});}})[_0x43d0('0x36')](handleEntityNotFound(_0x4016fb,null))[_0x43d0('0x36')](function(_0x2dd960){if(_0x2dd960){_0x3e8811[_0x43d0('0x9c')]=_0x2dd960;var _0xef87c2={'ContactId':_0x2dd960['id'],'phone':_0x3e8811[_0x43d0('0x5c')][_0x43d0('0x83')],'SmsAccountId':_0xa835df[_0x43d0('0x57')]['id']};var _0x36b72d={'ContactId':_0x2dd960['id'],'SmsAccountId':_0xa835df[_0x43d0('0x57')]['id'],'closed':![]};return db[_0x43d0('0x9d')]['find']({'where':_0x36b72d})[_0x43d0('0x36')](function(_0x439894){if(_0x439894){return[_0x439894,![]];}return db[_0x43d0('0x9d')][_0x43d0('0x5b')](_0xef87c2)['then'](function(_0x4213b2){return[_0x4213b2,!![]];});});}})[_0x43d0('0x9e')](function(_0x22bd2e,_0xdb16b7){_0x3e8811['interaction']=_0x22bd2e[_0x43d0('0x5e')]({'plain':!![]});_0x3e8811[_0x43d0('0x9f')]['created']=![];if(_0xdb16b7){if(_0x3e8811['account']['autoclose']){_0x3e8811[_0x43d0('0x75')]['push']({'id':0x0,'priority':_0x3e8811[_0x43d0('0x75')][_0x43d0('0x49')]+0x1,'app':'close','appdata':_0x43d0('0xa0'),'interval':_0x43d0('0xa1')});}_0x3e8811[_0x43d0('0x9f')][_0x43d0('0xa2')]=!![];}return db['SmsMessage'][_0x43d0('0x5b')]({'phone':_0x3e8811[_0x43d0('0x5c')]['from'],'messageId':_0x3e8811['body'][_0x43d0('0x86')],'body':_0x3e8811[_0x43d0('0x5c')][_0x43d0('0x5c')],'SmsAccountId':_0xa835df[_0x43d0('0x57')]['id'],'SmsInteractionId':_0x22bd2e['id'],'direction':'in','ContactId':_0x22bd2e[_0x43d0('0xa3')],'AttachmentId':_0x3e8811['body'][_0x43d0('0xa4')]});})['then'](function(_0x3a963c){_0x3e8811[_0x43d0('0x27')]=_0x3a963c;if(_0x3e8811['interaction'][_0x43d0('0xa5')]){return db[_0x43d0('0xa6')][_0x43d0('0x5a')]({'attributes':['id','name'],'where':{'id':_0x3e8811[_0x43d0('0x9f')][_0x43d0('0xa5')]}})[_0x43d0('0x36')](function(_0x10c0bd){if(_0x10c0bd){_0x3e8811['applications'][_0x43d0('0xa7')]({'id':0x0,'priority':0x0,'app':_0x43d0('0xa8'),'appdata':_0x10c0bd[_0x43d0('0x3b')]+','+(_0x3e8811[_0x43d0('0x74')]['waitForTheAssignedAgent']||0xa),'interval':_0x43d0('0xa1')});}return respondWithRpcPromise(_0x43d0('0xa9'),'startRouting',_0x3e8811);});}return respondWithRpcPromise(_0x43d0('0xa9'),_0x43d0('0xaa'),_0x3e8811);})['then'](function(_0xf5b0a5){if(_0xf5b0a5){var _0x543dcb=0xc8;var _0xb40250=_0x43d0('0xab');logger[_0x43d0('0x1f')](_0x43d0('0x22'),_0xb40250,_0x543dcb,_0x43d0('0xac'));logger['debug']('SmsAccount,\x20%s,\x20%s,\x20%s,\x20%s',_0xb40250,_0x543dcb,_0x43d0('0xac'),JSON[_0x43d0('0x23')](_0xf5b0a5));if(_0x3e8811[_0x43d0('0x74')][_0x43d0('0x82')]===_0x43d0('0xad')){return _0x4016fb[_0x43d0('0x2a')](_0x543dcb)[_0x43d0('0x30')](_0x43d0('0xae'),_0x43d0('0xaf'))[_0x43d0('0x3c')]('\x0a');}else{return _0x4016fb[_0x43d0('0x2a')](_0x543dcb)[_0x43d0('0x2c')](_0xf5b0a5);}}})[_0x43d0('0x28')](handleError(_0x4016fb,null));};exports[_0x43d0('0xb0')]=function(_0xb95349,_0x20ddee,_0x2f4bfc){return db[_0x43d0('0x41')]['findOne']({'where':{'id':_0xb95349['params']['id']}})[_0x43d0('0x36')](handleEntityNotFound(_0x20ddee,null))[_0x43d0('0x36')](function(_0x3eb945){if(_0x3eb945){return db[_0x43d0('0xb1')]['transaction'](function(_0x46c63d){return db[_0x43d0('0x72')][_0x43d0('0x39')]({'where':{'SmsAccountId':_0xb95349['params']['id']},'transaction':_0x46c63d})[_0x43d0('0x36')](function(_0x1cb96a){var _0x26e0d3=_[_0x43d0('0x40')](_0xb95349[_0x43d0('0x5c')],function(_0x387f86){_0x387f86[_0x43d0('0x65')]=_0xb95349['params']['id'];return _0x387f86;});return db[_0x43d0('0x72')][_0x43d0('0xb2')](_0x26e0d3,{'transaction':_0x46c63d});});})[_0x43d0('0x36')](function(){return db[_0x43d0('0x72')][_0x43d0('0xb3')]({'where':{'SmsAccountId':_0xb95349[_0x43d0('0x57')]['id']},'order':_0x43d0('0xb4')});});}})[_0x43d0('0x36')](respondWithResult(_0x20ddee,null))[_0x43d0('0x28')](handleError(_0x20ddee,null));};exports[_0x43d0('0xb5')]=function(_0x4f5a69,_0x87c38d,_0x1286ba){var _0x210a0e={};var _0x4338c1={};var _0x233f33;var _0x52193e;return db[_0x43d0('0x41')][_0x43d0('0x67')]({'where':{'id':_0x4f5a69['params']['id']}})[_0x43d0('0x36')](handleEntityNotFound(_0x87c38d,null))[_0x43d0('0x36')](function(_0x2b8751){if(_0x2b8751){_0x233f33=_0x2b8751;_0x4338c1[_0x43d0('0x44')]=_[_0x43d0('0x58')](db['SmsApplication']['rawAttributes']);_0x4338c1['query']=_['keys'](_0x4f5a69['query']);_0x4338c1['filters']=_['intersection'](_0x4338c1['model'],_0x4338c1[_0x43d0('0x45')]);_0x210a0e[_0x43d0('0x47')]=_[_0x43d0('0x46')](_0x4338c1[_0x43d0('0x44')],qs[_0x43d0('0x48')](_0x4f5a69[_0x43d0('0x45')][_0x43d0('0x48')]));_0x210a0e[_0x43d0('0x47')]=_0x210a0e[_0x43d0('0x47')][_0x43d0('0x49')]?_0x210a0e['attributes']:_0x4338c1[_0x43d0('0x44')];_0x210a0e[_0x43d0('0x4c')]=qs[_0x43d0('0x4d')](_0x4f5a69[_0x43d0('0x45')]['sort']);_0x210a0e['where']=qs[_0x43d0('0x69')](_[_0x43d0('0x4f')](_0x4f5a69[_0x43d0('0x45')],_0x4338c1[_0x43d0('0x69')]));if(_0x4f5a69[_0x43d0('0x45')][_0x43d0('0x50')]){_0x210a0e[_0x43d0('0x4e')]=_[_0x43d0('0x59')](_0x210a0e[_0x43d0('0x4e')],{'$or':_['map'](_0x210a0e[_0x43d0('0x47')],function(_0x3814ff){var _0x1972bd={};_0x1972bd[_0x3814ff]={'$like':'%'+_0x4f5a69[_0x43d0('0x45')][_0x43d0('0x50')]+'%'};return _0x1972bd;})});}_0x210a0e=_[_0x43d0('0x59')]({},_0x210a0e,_0x4f5a69['options']);return _0x233f33['getApplications'](_0x210a0e);}})['then'](function(_0x2dd237){if(_0x2dd237){_0x52193e=_0x2dd237[_0x43d0('0x49')];if(!_0x4f5a69[_0x43d0('0x45')][_0x43d0('0x4a')](_0x43d0('0x4b'))){_0x210a0e[_0x43d0('0x2f')]=qs[_0x43d0('0x2f')](_0x4f5a69[_0x43d0('0x45')]['limit']);_0x210a0e[_0x43d0('0x2e')]=qs['offset'](_0x4f5a69[_0x43d0('0x45')][_0x43d0('0x2e')]);}return _0x233f33[_0x43d0('0xb5')](_0x210a0e);}})[_0x43d0('0x36')](function(_0x2bb6fe){if(_0x2bb6fe){return _0x2bb6fe?{'count':_0x52193e,'rows':_0x2bb6fe}:null;}})[_0x43d0('0x36')](respondWithResult(_0x87c38d,null))[_0x43d0('0x28')](handleError(_0x87c38d,null));};exports[_0x43d0('0xb6')]=function(_0x180cfa,_0x427dba,_0x5e23c4){var _0x1fed2b={'raw':![],'where':{}};var _0x3611f4={};var _0x8ef150={'count':0x0,'rows':[]};return db['SmsAccount'][_0x43d0('0x67')]({'where':{'id':_0x180cfa[_0x43d0('0x57')]['id']}})[_0x43d0('0x36')](handleEntityNotFound(_0x427dba,null))[_0x43d0('0x36')](function(_0x5e23df){if(_0x5e23df){_0x3611f4['model']=_['keys'](db[_0x43d0('0x9d')]['rawAttributes']);_0x3611f4[_0x43d0('0x45')]=_[_0x43d0('0x58')](_0x180cfa['query']);_0x3611f4['filters']=_[_0x43d0('0x46')](_0x3611f4['model'],_0x3611f4[_0x43d0('0x45')]);_0x1fed2b[_0x43d0('0x47')]=_[_0x43d0('0x46')](_0x3611f4[_0x43d0('0x44')],qs['fields'](_0x180cfa[_0x43d0('0x45')][_0x43d0('0x48')]));_0x1fed2b[_0x43d0('0x47')]=_0x1fed2b[_0x43d0('0x47')][_0x43d0('0x49')]?_0x1fed2b[_0x43d0('0x47')]:_0x3611f4[_0x43d0('0x44')];if(!_0x180cfa['query'][_0x43d0('0x4a')]('nolimit')){_0x1fed2b[_0x43d0('0x2f')]=qs[_0x43d0('0x2f')](_0x180cfa[_0x43d0('0x45')]['limit']);_0x1fed2b[_0x43d0('0x2e')]=qs[_0x43d0('0x2e')](_0x180cfa[_0x43d0('0x45')][_0x43d0('0x2e')]);}_0x1fed2b[_0x43d0('0x4c')]=qs[_0x43d0('0x4d')](_0x180cfa['query'][_0x43d0('0x4d')]);_0x1fed2b[_0x43d0('0x4e')]=qs[_0x43d0('0x69')](_[_0x43d0('0x4f')](_0x180cfa[_0x43d0('0x45')],_0x3611f4['filters']));_0x1fed2b[_0x43d0('0x4e')][_0x43d0('0x65')]=_0x5e23df['id'];if(_0x180cfa[_0x43d0('0x45')][_0x43d0('0x50')]){_0x1fed2b[_0x43d0('0x4e')]=_['merge'](_0x1fed2b[_0x43d0('0x4e')],{'$or':_[_0x43d0('0x40')](_0x1fed2b['attributes'],function(_0x55f22b){var _0x1fade6={};_0x1fade6[_0x55f22b]={'$like':'%'+_0x180cfa[_0x43d0('0x45')][_0x43d0('0x50')]+'%'};return _0x1fade6;})});}_0x1fed2b=_[_0x43d0('0x59')]({},_0x1fed2b,_0x180cfa['options']);return db[_0x43d0('0x9d')][_0x43d0('0x2d')]({'where':_0x1fed2b[_0x43d0('0x4e')]})[_0x43d0('0x36')](function(_0x3a3db5){_0x8ef150['count']=_0x3a3db5;if(_0x180cfa[_0x43d0('0x45')][_0x43d0('0x53')]){_0x1fed2b[_0x43d0('0x54')]=[{'model':db[_0x43d0('0x78')],'as':_0x43d0('0xb7'),'required':![]},{'model':db[_0x43d0('0xa6')],'as':_0x43d0('0xb8'),'attributes':[_0x43d0('0x3b'),_0x43d0('0xb9'),_0x43d0('0xba')],'required':![]},{'model':db[_0x43d0('0xbb')],'as':_0x43d0('0xbc'),'attributes':['id',_0x43d0('0x3b'),'color'],'where':_0x180cfa[_0x43d0('0x45')]['tag']?{'id':_0x180cfa[_0x43d0('0x45')]['tag']}:undefined,'required':_0x180cfa[_0x43d0('0x45')][_0x43d0('0xbd')]?!![]:![]}];}return db[_0x43d0('0x9d')][_0x43d0('0x55')](_0x1fed2b);})[_0x43d0('0x36')](function(_0x4e87c7){_0x8ef150['rows']=_0x4e87c7;return _0x8ef150;});}})['then'](respondWithFilteredResult(_0x427dba,_0x1fed2b))['catch'](handleError(_0x427dba,null));};exports[_0x43d0('0x3c')]=function(_0x39776c,_0x27a145,_0x598771){var _0x5bf8ea,_0x1595c3,_0x386a5b;if(_[_0x43d0('0x93')](_0x39776c[_0x43d0('0x5c')]['body'])||_0x39776c[_0x43d0('0x5c')][_0x43d0('0x5c')]===''){throw new db[(_0x43d0('0x79'))][(_0x43d0('0x7a'))](_0x43d0('0x94'));}if(_[_0x43d0('0x93')](_0x39776c[_0x43d0('0x5c')]['to'])){throw new db[(_0x43d0('0x79'))][(_0x43d0('0x7a'))](_0x43d0('0xbe'));}_0x5bf8ea=_0x39776c[_0x43d0('0x5c')]['to'];return db[_0x43d0('0x41')][_0x43d0('0x5a')]({'where':{'id':_0x39776c[_0x43d0('0x57')]['id']},'include':[{'model':db[_0x43d0('0x98')],'as':_0x43d0('0xbf'),'include':[{'model':db[_0x43d0('0x78')],'as':_0x43d0('0x9b'),'where':{'mobile':_0x5bf8ea},'limit':0x1,'order':[[_0x43d0('0x7e'),_0x43d0('0xc0')]]}]}]})[_0x43d0('0x36')](handleEntityNotFound(_0x27a145,null))[_0x43d0('0x36')](function(_0x56fafb){if(_0x56fafb&&_0x56fafb[_0x43d0('0xbf')]){_0x1595c3=_0x56fafb[_0x43d0('0x5e')]({'plain':!![]});if(_0x1595c3[_0x43d0('0xbf')]&&_0x1595c3[_0x43d0('0xbf')][_0x43d0('0x9b')][_0x43d0('0x49')]){return _0x1595c3[_0x43d0('0xbf')]['Contacts'][0x0];}return db['CmContact']['create'](_[_0x43d0('0x16')](_0x39776c['body'],{'firstName':_0x5bf8ea,'mobile':_0x5bf8ea,'phone':_0x5bf8ea,'ListId':_0x1595c3['ListId']}));}})[_0x43d0('0x36')](handleEntityNotFound(_0x27a145,null))[_0x43d0('0x36')](function(_0xf54e7f){if(_0xf54e7f){_0x386a5b=_0xf54e7f;return db[_0x43d0('0x9d')][_0x43d0('0x5a')]({'where':{'ContactId':_0x386a5b['id'],'closed':![],'SmsAccountId':_0x1595c3['id']}})[_0x43d0('0x36')](function(_0x37faa3){if(_0x37faa3){return[_0x37faa3,![]];}return db[_0x43d0('0x9d')][_0x43d0('0x5b')]({'UserId':_0x39776c[_0x43d0('0x5d')]['id'],'ContactId':_0x386a5b['id'],'SmsAccountId':_0x1595c3['id'],'phone':_0x5bf8ea,'firstMsgDirection':_0x43d0('0xc1'),'Messages':[_[_0x43d0('0x59')](_0x39776c[_0x43d0('0x5c')],{'read':![],'body':_0x39776c[_0x43d0('0x5c')][_0x43d0('0x5c')],'phone':_0x5bf8ea,'SmsAccountId':_0x1595c3['id'],'UserId':_0x39776c[_0x43d0('0x5d')]['id'],'ContactId':_0x386a5b['id']})]},{'include':[{'model':db[_0x43d0('0xc2')],'as':_0x43d0('0xc3')}]})[_0x43d0('0x36')](function(_0x5d9a77){return[_0x5d9a77,!![]];});});}})[_0x43d0('0x9e')](function(_0x269bc8,_0x3e17c9){if(_0x3e17c9){return _0x269bc8;}return db[_0x43d0('0xc2')][_0x43d0('0x5b')](_[_0x43d0('0x59')](_0x39776c[_0x43d0('0x5c')],{'read':![],'body':_0x39776c['body'][_0x43d0('0x5c')],'phone':_0x5bf8ea,'SmsAccountId':_0x1595c3['id'],'SmsInteractionId':_0x269bc8['id'],'UserId':_0x39776c[_0x43d0('0x5d')]['id'],'ContactId':_0x386a5b['id']}))[_0x43d0('0x36')](function(_0x37b3bd){_0x269bc8[_0x43d0('0xc4')][_0x43d0('0xc3')]=[];_0x269bc8['dataValues']['Messages'][_0x43d0('0xc5')](_0x37b3bd[_0x43d0('0xc4')]);return _0x269bc8;});})[_0x43d0('0x36')](respondWithResult(_0x27a145,null))[_0x43d0('0x28')](handleError(_0x27a145,null));};exports[_0x43d0('0x2a')]=function(_0x2f9e3b,_0x191d5b,_0x27f647){if(_0x2f9e3b[_0x43d0('0x5c')]['id']){delete _0x2f9e3b[_0x43d0('0x5c')]['id'];}console['log'](_0x43d0('0xc6'),_0x2f9e3b[_0x43d0('0x5c')]);var _0x2007c9,_0x44f075,_0x4584b2;return db[_0x43d0('0x41')][_0x43d0('0x5a')]({'where':{'id':_0x2f9e3b['params']['id']}})['then'](handleEntityNotFound(_0x191d5b,null))[_0x43d0('0x36')](function(_0x2d80d8){if(_0x2d80d8){_0x4584b2=_0x2d80d8;logger['debug'](_0x43d0('0x22'),_0x43d0('0x2a'),'received\x20delivery\x20report\x20from',_0x2d80d8['type'],util[_0x43d0('0xc7')](_0x2f9e3b['body'],{'showHidden':![],'depth':null}));switch(_0x2d80d8['type']){case _0x43d0('0x87'):if(_0x2f9e3b[_0x43d0('0x5c')][_0x43d0('0xc8')]&&_0x2f9e3b[_0x43d0('0x5c')][_0x43d0('0x2a')]){_0x44f075=_0x2f9e3b['body'][_0x43d0('0x2a')];return db[_0x43d0('0xc2')]['find']({'where':{'messageId':_0x2f9e3b[_0x43d0('0x5c')][_0x43d0('0xc8')]}});}break;case _0x43d0('0xc9'):if(_0x2f9e3b[_0x43d0('0x5c')][_0x43d0('0xca')]&&_0x2f9e3b[_0x43d0('0x5c')]['statusInt']){_0x44f075=_0x2f9e3b[_0x43d0('0x5c')][_0x43d0('0xcb')];return db[_0x43d0('0xc2')][_0x43d0('0x5a')]({'where':{'messageId':_0x2f9e3b[_0x43d0('0x5c')]['requestid']}});}break;case _0x43d0('0x8a'):if(_0x2f9e3b[_0x43d0('0x5c')]['message_id']&&_0x2f9e3b[_0x43d0('0x5c')][_0x43d0('0xcc')]){_0x44f075=_0x2f9e3b[_0x43d0('0x5c')][_0x43d0('0xcc')];return db[_0x43d0('0xc2')][_0x43d0('0x5a')]({'where':{'messageId':_0x2f9e3b[_0x43d0('0x5c')][_0x43d0('0x8b')]}});}break;case _0x43d0('0x8f'):var _0x23bc8f=_0x2f9e3b[_0x43d0('0x5c')][_0x43d0('0x90')][0x0];if(_0x23bc8f['messageId']&&_0x23bc8f[_0x43d0('0x2a')][_0x43d0('0xcd')]===_0x43d0('0xce')){_0x44f075=_0x23bc8f['status'][_0x43d0('0xcd')];return db[_0x43d0('0xc2')]['find']({'where':{'messageId':_0x23bc8f['messageId']}});}break;case'clickatell':if(_0x2f9e3b[_0x43d0('0x5c')][_0x43d0('0x86')]&&_0x2f9e3b[_0x43d0('0x5c')][_0x43d0('0x2a')]){_0x44f075=_0x2f9e3b[_0x43d0('0x5c')]['status'];return db[_0x43d0('0xc2')]['find']({'where':{'messageId':_0x2f9e3b[_0x43d0('0x5c')][_0x43d0('0x86')]}});}break;case _0x43d0('0xcf'):if(_0x2f9e3b[_0x43d0('0x5c')][_0x43d0('0xd0')]&&_0x2f9e3b['body'][_0x43d0('0x2a')]){_0x44f075=_0x2f9e3b['body'][_0x43d0('0x2a')];return db[_0x43d0('0xc2')][_0x43d0('0x5a')]({'where':{'messageId':_0x2f9e3b[_0x43d0('0x5c')][_0x43d0('0xd0')]}});}break;}}})[_0x43d0('0x36')](handleEntityNotFound(_0x191d5b,null))['then'](function(_0x2ab310){if(_0x2ab310){_0x2007c9=_0x2ab310;switch(_0x4584b2[_0x43d0('0x82')]){case _0x43d0('0x87'):if(_0x44f075===_0x43d0('0xce')){return _0x2007c9[_0x43d0('0x35')]({'read':!![]});}else{logger[_0x43d0('0x24')](_0x43d0('0x22'),_0x43d0('0x2a'),_0x43d0('0x87'),util['inspect'](_0x2f9e3b[_0x43d0('0x5c')],{'showHidden':![],'depth':null}));}break;case _0x43d0('0xc9'):if(_0x44f075==='1'){return _0x2007c9[_0x43d0('0x35')]({'read':!![]});}else{logger[_0x43d0('0x24')](_0x43d0('0x22'),_0x43d0('0x2a'),'skebby',util[_0x43d0('0xc7')](_0x2f9e3b[_0x43d0('0x5c')],{'showHidden':![],'depth':null}));}break;case _0x43d0('0x8a'):if(!_0x2f9e3b[_0x43d0('0x5c')]['error_code']&&_0x44f075>=0xc8&&_0x44f075<=0xce){return _0x2007c9[_0x43d0('0x35')]({'read':!![]});}else{logger[_0x43d0('0x24')]('SmsAccount,\x20%s,\x20%s,\x20%s',_0x43d0('0x2a'),_0x43d0('0x8a'),util[_0x43d0('0xc7')](_0x2f9e3b[_0x43d0('0x5c')],{'showHidden':![],'depth':null}));}break;case _0x43d0('0x8f'):var _0x5567fd=_0x2f9e3b['body'][_0x43d0('0x90')][0x0];if(_0x5567fd[_0x43d0('0x2a')][_0x43d0('0xcd')]==='DELIVERED'){return _0x2007c9[_0x43d0('0x35')]({'read':!![]});}else{logger[_0x43d0('0x24')](_0x43d0('0x22'),'status',_0x43d0('0x8f'),util[_0x43d0('0xc7')](_0x2f9e3b['body'],{'showHidden':![],'depth':null}));}break;case'clickatell':if(_0x44f075==_0x43d0('0xd1')||_0x44f075=='RECEIVED_BY_RECIPIENT'){return _0x2007c9[_0x43d0('0x35')]({'read':!![]});}else{logger[_0x43d0('0x24')](_0x43d0('0x22'),_0x43d0('0x2a'),_0x43d0('0xd2'),util[_0x43d0('0xc7')](_0x2f9e3b[_0x43d0('0x5c')],{'showHidden':![],'depth':null}));}break;case'intelepeer':if(_0x44f075===_0x43d0('0xd3')||_0x44f075===_0x43d0('0xd4')){return _0x2007c9[_0x43d0('0x35')]({'read':!![]});}else{logger[_0x43d0('0x24')](_0x43d0('0x22'),'status','intelepeer',util['inspect'](_0x2f9e3b[_0x43d0('0x5c')],{'showHidden':![],'depth':null}));}break;}return _0x2007c9;}})[_0x43d0('0x36')](respondWithResult(_0x191d5b,null))['catch'](handleError(_0x191d5b,null));};exports['statusGet']=function(_0x1ea9c2,_0x417550,_0x1e0442){var _0x2fbeba,_0x1afb66,_0xdfec53;return db[_0x43d0('0x41')][_0x43d0('0x5a')]({'where':{'id':_0x1ea9c2[_0x43d0('0x57')]['id']}})[_0x43d0('0x36')](handleEntityNotFound(_0x417550,null))[_0x43d0('0x36')](function(_0x75a612){if(_0x75a612){_0xdfec53=_0x75a612;logger['debug'](_0x43d0('0x22'),_0x43d0('0x2a'),_0x43d0('0xd5'),_0x75a612[_0x43d0('0x82')],util[_0x43d0('0xc7')](_0x1ea9c2[_0x43d0('0x45')],{'showHidden':![],'depth':null}));switch(_0x75a612[_0x43d0('0x82')]){case'csc':if(_0x1ea9c2['query'][_0x43d0('0xd6')]&&_0x1ea9c2[_0x43d0('0x45')][_0x43d0('0xd7')]){_0x1afb66=_0x1ea9c2[_0x43d0('0x45')][_0x43d0('0xd7')];return db[_0x43d0('0xc2')][_0x43d0('0x5a')]({'where':{'messageId':_0x1ea9c2['query'][_0x43d0('0xd6')]}});}break;}}})['then'](handleEntityNotFound(_0x417550,null))[_0x43d0('0x36')](function(_0x443086){if(_0x443086){_0x2fbeba=_0x443086;switch(_0xdfec53[_0x43d0('0x82')]){case _0x43d0('0xd8'):if(_0x1afb66==='2'||_0x1afb66==='6'){return _0x2fbeba[_0x43d0('0x35')]({'read':!![]});}else{logger['error'](_0x43d0('0x22'),_0x43d0('0x2a'),'csc',util[_0x43d0('0xc7')](_0x1ea9c2[_0x43d0('0x45')],{'showHidden':![],'depth':null}));};break;}return _0x2fbeba;}})[_0x43d0('0x36')](respondWithResult(_0x417550,null))[_0x43d0('0x28')](handleError(_0x417550,null));};exports[_0x43d0('0xd9')]=function(_0xd9c26a,_0x23748a,_0x279cab){return db[_0x43d0('0x41')][_0x43d0('0x5a')]({'where':{'id':_0xd9c26a['params']['id']}})[_0x43d0('0x36')](handleEntityNotFound(_0x23748a,null))[_0x43d0('0x36')](function(_0x43fc3e){if(_0x43fc3e){return _0x43fc3e[_0x43d0('0xd9')](_0xd9c26a[_0x43d0('0x5c')][_0x43d0('0x6b')],_[_0x43d0('0x9a')](_0xd9c26a['body'],['ids','id'])||{})['spread'](function(_0x3643bd){for(var _0x77461=0x0;_0x77461<_0xd9c26a[_0x43d0('0x5c')]['ids']['length'];_0x77461+=0x1){socket['emit'](_0x43d0('0xda'),{'UserId':_0xd9c26a[_0x43d0('0x5c')][_0x43d0('0x6b')][_0x77461],'SmsAccountId':_0xd9c26a[_0x43d0('0x57')]['id']});}return _0x3643bd;});}})['then'](respondWithResult(_0x23748a,null))['catch'](handleError(_0x23748a,null));};exports['removeAgents']=function(_0x186bcf,_0x7ce72b,_0x44c13d){return db[_0x43d0('0x41')][_0x43d0('0x5a')]({'where':{'id':_0x186bcf[_0x43d0('0x57')]['id']}})[_0x43d0('0x36')](handleEntityNotFound(_0x7ce72b,null))[_0x43d0('0x36')](function(_0x332f3a){if(_0x332f3a){return _0x332f3a[_0x43d0('0xdb')](_0x186bcf['query'][_0x43d0('0x6b')])[_0x43d0('0x36')](function(){if(_['isArray'](_0x186bcf[_0x43d0('0x45')][_0x43d0('0x6b')])){for(var _0x4c5f5b=0x0;_0x4c5f5b<_0x186bcf['query']['ids'][_0x43d0('0x49')];_0x4c5f5b+=0x1){socket[_0x43d0('0xdc')](_0x43d0('0xdd'),{'UserId':Number(_0x186bcf[_0x43d0('0x45')][_0x43d0('0x6b')][_0x4c5f5b]),'SmsAccountId':Number(_0x186bcf[_0x43d0('0x57')]['id'])});}}else{socket[_0x43d0('0xdc')](_0x43d0('0xdd'),{'UserId':Number(_0x186bcf['query'][_0x43d0('0x6b')]),'SmsAccountId':Number(_0x186bcf[_0x43d0('0x57')]['id'])});}});}})[_0x43d0('0x36')](respondWithStatusCode(_0x7ce72b,null))[_0x43d0('0x28')](handleError(_0x7ce72b,null));};exports[_0x43d0('0xde')]=function(_0x331401,_0x206b18,_0x1a3f6e){var _0x535e33={};var _0x51d209={};var _0x38e835;var _0x1ccfc6;return db[_0x43d0('0x41')]['findOne']({'where':{'id':_0x331401['params']['id']}})[_0x43d0('0x36')](handleEntityNotFound(_0x206b18,null))[_0x43d0('0x36')](function(_0x4b84ec){if(_0x4b84ec){_0x38e835=_0x4b84ec;_0x51d209['model']=_[_0x43d0('0x58')](db[_0x43d0('0xa6')][_0x43d0('0x42')]);_0x51d209[_0x43d0('0x45')]=_[_0x43d0('0x58')](_0x331401['query']);_0x51d209[_0x43d0('0x69')]=_[_0x43d0('0x46')](_0x51d209[_0x43d0('0x44')],_0x51d209[_0x43d0('0x45')]);_0x535e33[_0x43d0('0x47')]=_[_0x43d0('0x46')](_0x51d209[_0x43d0('0x44')],qs[_0x43d0('0x48')](_0x331401[_0x43d0('0x45')][_0x43d0('0x48')]));_0x535e33[_0x43d0('0x47')]=_0x535e33[_0x43d0('0x47')]['length']?_0x535e33[_0x43d0('0x47')]:_0x51d209[_0x43d0('0x44')];_0x535e33[_0x43d0('0x4c')]=qs[_0x43d0('0x4d')](_0x331401[_0x43d0('0x45')][_0x43d0('0x4d')]);_0x535e33[_0x43d0('0x4e')]=qs['filters'](_[_0x43d0('0x4f')](_0x331401[_0x43d0('0x45')],_0x51d209[_0x43d0('0x69')]));if(_0x331401[_0x43d0('0x45')][_0x43d0('0x50')]){_0x535e33[_0x43d0('0x4e')]=_[_0x43d0('0x59')](_0x535e33[_0x43d0('0x4e')],{'$or':_[_0x43d0('0x40')](_0x535e33[_0x43d0('0x47')],function(_0x426ec9){var _0x2d8313={};_0x2d8313[_0x426ec9]={'$like':'%'+_0x331401['query'][_0x43d0('0x50')]+'%'};return _0x2d8313;})});}_0x535e33=_[_0x43d0('0x59')]({},_0x535e33,_0x331401[_0x43d0('0x52')]);return _0x38e835[_0x43d0('0xde')](_0x535e33);}})[_0x43d0('0x36')](function(_0x4bd75e){if(_0x4bd75e){_0x1ccfc6=_0x4bd75e['length'];if(!_0x331401[_0x43d0('0x45')]['hasOwnProperty']('nolimit')){_0x535e33[_0x43d0('0x2f')]=qs[_0x43d0('0x2f')](_0x331401[_0x43d0('0x45')][_0x43d0('0x2f')]);_0x535e33['offset']=qs[_0x43d0('0x2e')](_0x331401[_0x43d0('0x45')][_0x43d0('0x2e')]);}return _0x38e835[_0x43d0('0xde')](_0x535e33);}})[_0x43d0('0x36')](function(_0x59d701){if(_0x59d701){return _0x59d701?{'count':_0x1ccfc6,'rows':_0x59d701}:null;}})[_0x43d0('0x36')](respondWithResult(_0x206b18,null))[_0x43d0('0x28')](handleError(_0x206b18,null));}; \ No newline at end of file diff --git a/server/api/smsAccount/smsAccount.events.js b/server/api/smsAccount/smsAccount.events.js index b927bbd..e8f94d5 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 _0xc144=['events','../../mysqldb','SmsAccount','setMaxListeners','save','update','remove','emit','hasOwnProperty','hook','exports'];(function(_0xbb5c8c,_0x4e9709){var _0x502889=function(_0x2450a0){while(--_0x2450a0){_0xbb5c8c['push'](_0xbb5c8c['shift']());}};_0x502889(++_0x4e9709);}(_0xc144,0x1d9));var _0x4c14=function(_0x34071d,_0x5778cb){_0x34071d=_0x34071d-0x0;var _0x578a6f=_0xc144[_0x34071d];return _0x578a6f;};'use strict';var EventEmitter=require(_0x4c14('0x0'));var SmsAccount=require(_0x4c14('0x1'))['db'][_0x4c14('0x2')];var SmsAccountEvents=new EventEmitter();SmsAccountEvents[_0x4c14('0x3')](0x0);var events={'afterCreate':_0x4c14('0x4'),'afterUpdate':_0x4c14('0x5'),'afterDestroy':_0x4c14('0x6')};function emitEvent(_0x773828){return function(_0x124651,_0x758a40,_0x5a1558){SmsAccountEvents[_0x4c14('0x7')](_0x773828+':'+_0x124651['id'],_0x124651);SmsAccountEvents[_0x4c14('0x7')](_0x773828,_0x124651);_0x5a1558(null);};}for(var e in events){if(events[_0x4c14('0x8')](e)){var event=events[e];SmsAccount[_0x4c14('0x9')](e,emitEvent(event));}}module[_0x4c14('0xa')]=SmsAccountEvents; \ No newline at end of file +var _0x19e6=['save','update','remove','emit','hasOwnProperty','exports','SmsAccount','setMaxListeners'];(function(_0x2d48fa,_0x103065){var _0x4645b7=function(_0x5c8751){while(--_0x5c8751){_0x2d48fa['push'](_0x2d48fa['shift']());}};_0x4645b7(++_0x103065);}(_0x19e6,0x1a6));var _0x619e=function(_0x3084c0,_0x3cf25a){_0x3084c0=_0x3084c0-0x0;var _0x38544a=_0x19e6[_0x3084c0];return _0x38544a;};'use strict';var EventEmitter=require('events');var SmsAccount=require('../../mysqldb')['db'][_0x619e('0x0')];var SmsAccountEvents=new EventEmitter();SmsAccountEvents[_0x619e('0x1')](0x0);var events={'afterCreate':_0x619e('0x2'),'afterUpdate':_0x619e('0x3'),'afterDestroy':_0x619e('0x4')};function emitEvent(_0x52f277){return function(_0x5ec210,_0x53558f,_0x2db763){SmsAccountEvents[_0x619e('0x5')](_0x52f277+':'+_0x5ec210['id'],_0x5ec210);SmsAccountEvents[_0x619e('0x5')](_0x52f277,_0x5ec210);_0x2db763(null);};}for(var e in events){if(events[_0x619e('0x6')](e)){var event=events[e];SmsAccount['hook'](e,emitEvent(event));}}module[_0x619e('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 1ba4749..262e8dd 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 _0x8869=['bluebird','path','rimraf','../../config/environment','define','SmsAccount','sms_accounts','lodash','util','api','moment'];(function(_0x11315f,_0x4eabdd){var _0xb4c69c=function(_0x2773ea){while(--_0x2773ea){_0x11315f['push'](_0x11315f['shift']());}};_0xb4c69c(++_0x4eabdd);}(_0x8869,0x10f));var _0x9886=function(_0x4106bf,_0x4da06b){_0x4106bf=_0x4106bf-0x0;var _0x424de2=_0x8869[_0x4106bf];return _0x424de2;};'use strict';var _=require(_0x9886('0x0'));var util=require(_0x9886('0x1'));var logger=require('../../config/logger')(_0x9886('0x2'));var moment=require(_0x9886('0x3'));var BPromise=require(_0x9886('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x9886('0x5'));var rimraf=require(_0x9886('0x6'));var config=require(_0x9886('0x7'));var attributes=require('./smsAccount.attributes');module['exports']=function(_0x195e83,_0x3acdbd){return _0x195e83[_0x9886('0x8')](_0x9886('0x9'),attributes,{'tableName':_0x9886('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xf3f8=['../../config/environment','./smsAccount.attributes','exports','define','SmsAccount','lodash','util','../../config/logger','api','bluebird','request-promise','rimraf'];(function(_0x42a62c,_0xf8502f){var _0x36e6d0=function(_0x2f5ca8){while(--_0x2f5ca8){_0x42a62c['push'](_0x42a62c['shift']());}};_0x36e6d0(++_0xf8502f);}(_0xf3f8,0xe9));var _0x8f3f=function(_0x48e19e,_0x52e566){_0x48e19e=_0x48e19e-0x0;var _0xb5bf4c=_0xf3f8[_0x48e19e];return _0xb5bf4c;};'use strict';var _=require(_0x8f3f('0x0'));var util=require(_0x8f3f('0x1'));var logger=require(_0x8f3f('0x2'))(_0x8f3f('0x3'));var moment=require('moment');var BPromise=require(_0x8f3f('0x4'));var rp=require(_0x8f3f('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x8f3f('0x6'));var config=require(_0x8f3f('0x7'));var attributes=require(_0x8f3f('0x8'));module[_0x8f3f('0x9')]=function(_0x203207,_0x1bf07b){return _0x203207[_0x8f3f('0xa')](_0x8f3f('0xb'),attributes,{'tableName':'sms_accounts','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/smsAccount/smsAccount.rpc.js b/server/api/smsAccount/smsAccount.rpc.js index de16383..fcbbae5 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 _0x1a07=['include','map','model','ShowSmsAccount','lodash','util','moment','ioredis','../../mysqldb','../../config/logger','../../config/environment','jayson/promise','client','http','defaults','redis','localhost','./smsAccount.socket','register','request','then','info','SmsAccount,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','catch','SmsAccount','find','options','raw','where','attributes'];(function(_0x32753a,_0x313eff){var _0x5cc638=function(_0x87e14c){while(--_0x87e14c){_0x32753a['push'](_0x32753a['shift']());}};_0x5cc638(++_0x313eff);}(_0x1a07,0x1e5));var _0x71a0=function(_0x533897,_0x34e7c8){_0x533897=_0x533897-0x0;var _0x340bbd=_0x1a07[_0x533897];return _0x340bbd;};'use strict';var _=require(_0x71a0('0x0'));var util=require(_0x71a0('0x1'));var moment=require(_0x71a0('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x71a0('0x3'));var db=require(_0x71a0('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x71a0('0x5'))('rpc');var config=require(_0x71a0('0x6'));var jayson=require(_0x71a0('0x7'));var client=jayson[_0x71a0('0x8')][_0x71a0('0x9')]({'port':0x232a});config['redis']=_[_0x71a0('0xa')](config[_0x71a0('0xb')],{'host':_0x71a0('0xc'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x71a0('0xb')]));require(_0x71a0('0xd'))[_0x71a0('0xe')](socket);function respondWithRpcPromise(_0x28977b,_0x254719,_0x2159ad){return new BPromise(function(_0x53f0c2,_0x1e6410){return client[_0x71a0('0xf')](_0x28977b,_0x2159ad)[_0x71a0('0x10')](function(_0x26c9a1){logger[_0x71a0('0x11')](_0x71a0('0x12'),_0x254719,_0x71a0('0x13'));logger[_0x71a0('0x14')]('SmsAccount,\x20%s,\x20%s,\x20%s',_0x254719,_0x71a0('0x13'),JSON[_0x71a0('0x15')](_0x26c9a1));if(_0x26c9a1[_0x71a0('0x16')]){if(_0x26c9a1[_0x71a0('0x16')][_0x71a0('0x17')]===0x1f4){logger[_0x71a0('0x16')](_0x71a0('0x12'),_0x254719,_0x26c9a1[_0x71a0('0x16')]['message']);return _0x1e6410(_0x26c9a1[_0x71a0('0x16')]['message']);}logger[_0x71a0('0x16')]('SmsAccount,\x20%s,\x20%s',_0x254719,_0x26c9a1['error'][_0x71a0('0x18')]);return _0x53f0c2(_0x26c9a1[_0x71a0('0x16')][_0x71a0('0x18')]);}else{logger[_0x71a0('0x11')](_0x71a0('0x12'),_0x254719,_0x71a0('0x13'));_0x53f0c2(_0x26c9a1[_0x71a0('0x19')][_0x71a0('0x18')]);}})[_0x71a0('0x1a')](function(_0x134411){logger[_0x71a0('0x16')](_0x71a0('0x12'),_0x254719,_0x134411);_0x1e6410(_0x134411);});});}exports['ShowSmsAccount']=function(_0x48dbe8){var _0x59dae2=this;return new Promise(function(_0x59056f,_0x73a82){return db[_0x71a0('0x1b')][_0x71a0('0x1c')]({'raw':_0x48dbe8[_0x71a0('0x1d')]?_0x48dbe8[_0x71a0('0x1d')][_0x71a0('0x1e')]===undefined?!![]:![]:!![],'where':_0x48dbe8['options']?_0x48dbe8['options'][_0x71a0('0x1f')]||null:null,'attributes':_0x48dbe8[_0x71a0('0x1d')]?_0x48dbe8[_0x71a0('0x1d')][_0x71a0('0x20')]||null:null,'include':_0x48dbe8[_0x71a0('0x1d')]?_0x48dbe8[_0x71a0('0x1d')][_0x71a0('0x21')]?_[_0x71a0('0x22')](_0x48dbe8['options']['include'],function(_0x4a0086){return{'model':db[_0x4a0086[_0x71a0('0x23')]],'as':_0x4a0086['as'],'attributes':_0x4a0086['attributes'],'include':_0x4a0086[_0x71a0('0x21')]?_[_0x71a0('0x22')](_0x4a0086[_0x71a0('0x21')],function(_0x543c91){return{'model':db[_0x543c91['model']],'as':_0x543c91['as'],'attributes':_0x543c91[_0x71a0('0x20')],'include':_0x543c91['include']?_[_0x71a0('0x22')](_0x543c91['include'],function(_0x40b3d8){return{'model':db[_0x40b3d8['model']],'as':_0x40b3d8['as'],'attributes':_0x40b3d8[_0x71a0('0x20')]};}):[]};}):[]};}):[]:[]})[_0x71a0('0x10')](function(_0x487a83){logger[_0x71a0('0x11')](_0x71a0('0x24'),_0x48dbe8);logger[_0x71a0('0x14')](_0x71a0('0x24'),_0x48dbe8,JSON['stringify'](_0x487a83));_0x59056f(_0x487a83);})['catch'](function(_0x4f2740){logger[_0x71a0('0x16')](_0x71a0('0x24'),_0x4f2740['message'],_0x48dbe8);_0x73a82(_0x59dae2['error'](0x1f4,_0x4f2740['message']));});});}; \ No newline at end of file +var _0x2455=['where','attributes','include','map','model','lodash','util','moment','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','redis','localhost','socket.io-emitter','./smsAccount.socket','then','info','SmsAccount,\x20%s,\x20%s','request\x20sent','debug','SmsAccount,\x20%s,\x20%s,\x20%s','stringify','error','message','catch','ShowSmsAccount','SmsAccount','options','raw'];(function(_0xa464c9,_0x7c86d8){var _0x3d73c4=function(_0x5c2056){while(--_0x5c2056){_0xa464c9['push'](_0xa464c9['shift']());}};_0x3d73c4(++_0x7c86d8);}(_0x2455,0xaf));var _0x5245=function(_0x5d2a16,_0x5ca1ca){_0x5d2a16=_0x5d2a16-0x0;var _0x2fd4b7=_0x2455[_0x5d2a16];return _0x2fd4b7;};'use strict';var _=require(_0x5245('0x0'));var util=require(_0x5245('0x1'));var moment=require(_0x5245('0x2'));var BPromise=require('bluebird');var rs=require(_0x5245('0x3'));var fs=require('fs');var Redis=require(_0x5245('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x5245('0x5'));var logger=require(_0x5245('0x6'))(_0x5245('0x7'));var config=require(_0x5245('0x8'));var jayson=require(_0x5245('0x9'));var client=jayson[_0x5245('0xa')]['http']({'port':0x232a});config[_0x5245('0xb')]=_['defaults'](config[_0x5245('0xb')],{'host':_0x5245('0xc'),'port':0x18eb});var socket=require(_0x5245('0xd'))(new Redis(config[_0x5245('0xb')]));require(_0x5245('0xe'))['register'](socket);function respondWithRpcPromise(_0x35bf9c,_0x4fb979,_0x3bdde8){return new BPromise(function(_0x577553,_0x4b9307){return client['request'](_0x35bf9c,_0x3bdde8)[_0x5245('0xf')](function(_0x26342f){logger[_0x5245('0x10')](_0x5245('0x11'),_0x4fb979,_0x5245('0x12'));logger[_0x5245('0x13')](_0x5245('0x14'),_0x4fb979,_0x5245('0x12'),JSON[_0x5245('0x15')](_0x26342f));if(_0x26342f[_0x5245('0x16')]){if(_0x26342f[_0x5245('0x16')]['code']===0x1f4){logger[_0x5245('0x16')]('SmsAccount,\x20%s,\x20%s',_0x4fb979,_0x26342f[_0x5245('0x16')][_0x5245('0x17')]);return _0x4b9307(_0x26342f['error'][_0x5245('0x17')]);}logger['error'](_0x5245('0x11'),_0x4fb979,_0x26342f[_0x5245('0x16')][_0x5245('0x17')]);return _0x577553(_0x26342f['error'][_0x5245('0x17')]);}else{logger[_0x5245('0x10')](_0x5245('0x11'),_0x4fb979,_0x5245('0x12'));_0x577553(_0x26342f['result'][_0x5245('0x17')]);}})[_0x5245('0x18')](function(_0x57644b){logger[_0x5245('0x16')](_0x5245('0x11'),_0x4fb979,_0x57644b);_0x4b9307(_0x57644b);});});}exports[_0x5245('0x19')]=function(_0x199bdd){var _0x2f4629=this;return new Promise(function(_0x570045,_0x117312){return db[_0x5245('0x1a')]['find']({'raw':_0x199bdd[_0x5245('0x1b')]?_0x199bdd[_0x5245('0x1b')][_0x5245('0x1c')]===undefined?!![]:![]:!![],'where':_0x199bdd[_0x5245('0x1b')]?_0x199bdd['options'][_0x5245('0x1d')]||null:null,'attributes':_0x199bdd[_0x5245('0x1b')]?_0x199bdd[_0x5245('0x1b')][_0x5245('0x1e')]||null:null,'include':_0x199bdd['options']?_0x199bdd[_0x5245('0x1b')][_0x5245('0x1f')]?_[_0x5245('0x20')](_0x199bdd[_0x5245('0x1b')]['include'],function(_0x30fedb){return{'model':db[_0x30fedb[_0x5245('0x21')]],'as':_0x30fedb['as'],'attributes':_0x30fedb[_0x5245('0x1e')],'include':_0x30fedb[_0x5245('0x1f')]?_[_0x5245('0x20')](_0x30fedb[_0x5245('0x1f')],function(_0xbd1d11){return{'model':db[_0xbd1d11[_0x5245('0x21')]],'as':_0xbd1d11['as'],'attributes':_0xbd1d11['attributes'],'include':_0xbd1d11[_0x5245('0x1f')]?_['map'](_0xbd1d11[_0x5245('0x1f')],function(_0x1a8e62){return{'model':db[_0x1a8e62['model']],'as':_0x1a8e62['as'],'attributes':_0x1a8e62[_0x5245('0x1e')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x2d136f){logger[_0x5245('0x10')]('ShowSmsAccount',_0x199bdd);logger[_0x5245('0x13')](_0x5245('0x19'),_0x199bdd,JSON[_0x5245('0x15')](_0x2d136f));_0x570045(_0x2d136f);})['catch'](function(_0x242efd){logger[_0x5245('0x16')](_0x5245('0x19'),_0x242efd[_0x5245('0x17')],_0x199bdd);_0x117312(_0x2f4629['error'](0x1f4,_0x242efd[_0x5245('0x17')]));});});}; \ No newline at end of file diff --git a/server/api/smsAccount/smsAccount.socket.js b/server/api/smsAccount/smsAccount.socket.js index 9e0f3ef..2a37f3e 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 _0xd065=['update','emit','removeListener','length','./smsAccount.events','save','remove'];(function(_0x936372,_0x1b2879){var _0x13d60=function(_0x3c4dbf){while(--_0x3c4dbf){_0x936372['push'](_0x936372['shift']());}};_0x13d60(++_0x1b2879);}(_0xd065,0xba));var _0x5d06=function(_0x5ac331,_0x450d23){_0x5ac331=_0x5ac331-0x0;var _0x32e103=_0xd065[_0x5ac331];return _0x32e103;};'use strict';var SmsAccountEvents=require(_0x5d06('0x0'));var events=[_0x5d06('0x1'),_0x5d06('0x2'),_0x5d06('0x3')];function createListener(_0x91b8a7,_0x3761fc){return function(_0x247c77){_0x3761fc[_0x5d06('0x4')](_0x91b8a7,_0x247c77);};}function removeListener(_0x515091,_0x4f9b4a){return function(){SmsAccountEvents[_0x5d06('0x5')](_0x515091,_0x4f9b4a);};}exports['register']=function(_0x59a677){for(var _0xbec7a8=0x0,_0x3f12ec=events[_0x5d06('0x6')];_0xbec7a8<_0x3f12ec;_0xbec7a8++){var _0x2f542b=events[_0xbec7a8];var _0x5341fd=createListener('smsAccount:'+_0x2f542b,_0x59a677);SmsAccountEvents['on'](_0x2f542b,_0x5341fd);}}; \ No newline at end of file +var _0x3260=['remove','update','emit','register','length','./smsAccount.events','save'];(function(_0x205457,_0x427066){var _0x17442d=function(_0x37f822){while(--_0x37f822){_0x205457['push'](_0x205457['shift']());}};_0x17442d(++_0x427066);}(_0x3260,0xd7));var _0x0326=function(_0x3250a6,_0xee4196){_0x3250a6=_0x3250a6-0x0;var _0x1c7e88=_0x3260[_0x3250a6];return _0x1c7e88;};'use strict';var SmsAccountEvents=require(_0x0326('0x0'));var events=[_0x0326('0x1'),_0x0326('0x2'),_0x0326('0x3')];function createListener(_0x4ad390,_0x58a21c){return function(_0x4502fb){_0x58a21c[_0x0326('0x4')](_0x4ad390,_0x4502fb);};}function removeListener(_0x24cc5b,_0x34b862){return function(){SmsAccountEvents['removeListener'](_0x24cc5b,_0x34b862);};}exports[_0x0326('0x5')]=function(_0x5198d5){for(var _0x4e5f8e=0x0,_0x23f016=events[_0x0326('0x6')];_0x4e5f8e<_0x23f016;_0x4e5f8e++){var _0x34c33e=events[_0x4e5f8e];var _0x20c300=createListener('smsAccount:'+_0x34c33e,_0x5198d5);SmsAccountEvents['on'](_0x34c33e,_0x20c300);}}; \ No newline at end of file diff --git a/server/api/smsApplication/index.js b/server/api/smsApplication/index.js index 8627769..7c46855 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 _0x08b2=['create','put','update','destroy','exports','multer','util','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./smsApplication.controller','get','isAuthenticated','index','/:id','show'];(function(_0x4d07cc,_0x587613){var _0x42de3b=function(_0x201f78){while(--_0x201f78){_0x4d07cc['push'](_0x4d07cc['shift']());}};_0x42de3b(++_0x587613);}(_0x08b2,0x191));var _0x208b=function(_0x4154a6,_0x2c0b8e){_0x4154a6=_0x4154a6-0x0;var _0x3b2786=_0x08b2[_0x4154a6];return _0x3b2786;};'use strict';var multer=require(_0x208b('0x0'));var util=require(_0x208b('0x1'));var path=require('path');var timeout=require(_0x208b('0x2'));var express=require('express');var router=express[_0x208b('0x3')]();var auth=require(_0x208b('0x4'));var interaction=require(_0x208b('0x5'));var config=require(_0x208b('0x6'));var controller=require(_0x208b('0x7'));router[_0x208b('0x8')]('/',auth[_0x208b('0x9')](),controller[_0x208b('0xa')]);router[_0x208b('0x8')](_0x208b('0xb'),auth[_0x208b('0x9')](),controller[_0x208b('0xc')]);router['post']('/',auth[_0x208b('0x9')](),controller[_0x208b('0xd')]);router[_0x208b('0xe')](_0x208b('0xb'),auth[_0x208b('0x9')](),controller[_0x208b('0xf')]);router['delete'](_0x208b('0xb'),auth[_0x208b('0x9')](),controller[_0x208b('0x10')]);module[_0x208b('0x11')]=router; \ No newline at end of file +var _0xfb6f=['Router','../../components/interaction/service','../../config/environment','./smsApplication.controller','get','isAuthenticated','index','show','create','put','/:id','update','destroy','exports','multer','util','path'];(function(_0x29e5f0,_0x2aec8c){var _0x44bb24=function(_0x774367){while(--_0x774367){_0x29e5f0['push'](_0x29e5f0['shift']());}};_0x44bb24(++_0x2aec8c);}(_0xfb6f,0x184));var _0xffb6=function(_0x20981d,_0x23253a){_0x20981d=_0x20981d-0x0;var _0x349ec2=_0xfb6f[_0x20981d];return _0x349ec2;};'use strict';var multer=require(_0xffb6('0x0'));var util=require(_0xffb6('0x1'));var path=require(_0xffb6('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0xffb6('0x3')]();var auth=require('../../components/auth/service');var interaction=require(_0xffb6('0x4'));var config=require(_0xffb6('0x5'));var controller=require(_0xffb6('0x6'));router[_0xffb6('0x7')]('/',auth[_0xffb6('0x8')](),controller[_0xffb6('0x9')]);router[_0xffb6('0x7')]('/:id',auth[_0xffb6('0x8')](),controller[_0xffb6('0xa')]);router['post']('/',auth[_0xffb6('0x8')](),controller[_0xffb6('0xb')]);router[_0xffb6('0xc')](_0xffb6('0xd'),auth[_0xffb6('0x8')](),controller[_0xffb6('0xe')]);router['delete']('/:id',auth[_0xffb6('0x8')](),controller[_0xffb6('0xf')]);module[_0xffb6('0x10')]=router; \ No newline at end of file diff --git a/server/api/smsApplication/smsApplication.attributes.js b/server/api/smsApplication/smsApplication.attributes.js index 57c6f6f..cca4d66 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 _0xe367=['sequelize','exports','INTEGER','STRING','TEXT','*,*,*,*'];(function(_0x32fda8,_0x353bb3){var _0x1881bc=function(_0x4868d4){while(--_0x4868d4){_0x32fda8['push'](_0x32fda8['shift']());}};_0x1881bc(++_0x353bb3);}(_0xe367,0x162));var _0x7e36=function(_0x599f41,_0x4db732){_0x599f41=_0x599f41-0x0;var _0x2e4d58=_0xe367[_0x599f41];return _0x2e4d58;};'use strict';var Sequelize=require(_0x7e36('0x0'));module[_0x7e36('0x1')]={'priority':{'type':Sequelize[_0x7e36('0x2')],'allowNull':![]},'app':{'type':Sequelize[_0x7e36('0x3')],'allowNull':![],'defaultValue':'noop'},'appdata':{'type':Sequelize[_0x7e36('0x4')]()},'description':{'type':Sequelize[_0x7e36('0x3')]},'interval':{'type':Sequelize[_0x7e36('0x3')],'defaultValue':_0x7e36('0x5')}}; \ No newline at end of file +var _0x5b24=['TEXT','STRING','noop'];(function(_0x508c0a,_0x1bcd5e){var _0x1c19b7=function(_0x21300d){while(--_0x21300d){_0x508c0a['push'](_0x508c0a['shift']());}};_0x1c19b7(++_0x1bcd5e);}(_0x5b24,0x1a5));var _0x45b2=function(_0x2e1207,_0x2620c8){_0x2e1207=_0x2e1207-0x0;var _0x164111=_0x5b24[_0x2e1207];return _0x164111;};'use strict';var Sequelize=require('sequelize');module['exports']={'priority':{'type':Sequelize['INTEGER'],'allowNull':![]},'app':{'type':Sequelize[_0x45b2('0x0')],'allowNull':![],'defaultValue':_0x45b2('0x1')},'appdata':{'type':Sequelize[_0x45b2('0x2')]()},'description':{'type':Sequelize[_0x45b2('0x0')]},'interval':{'type':Sequelize[_0x45b2('0x0')],'defaultValue':'*,*,*,*'}}; \ No newline at end of file diff --git a/server/api/smsApplication/smsApplication.controller.js b/server/api/smsApplication/smsApplication.controller.js index 4fd96b1..9e5b257 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 _0xed47=['include','catch','params','keys','find','create','body','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','to-csv','ejs','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','status','end','json','count','offset','set','Content-Range','apply','reject','save','update','then','destroy','sendStatus','error','name','send','index','map','SmsApplication','rawAttributes','fieldName','model','query','intersection','attributes','fields','length','nolimit','limit','order','sort','where','pick','filters','filter','merge','type','VIRTUAL','options','includeAll'];(function(_0x4a945b,_0x3b3553){var _0x3f5411=function(_0x216e48){while(--_0x216e48){_0x4a945b['push'](_0x4a945b['shift']());}};_0x3f5411(++_0x3b3553);}(_0xed47,0x1c3));var _0x7ed4=function(_0xf7fb0c,_0x2f198b){_0xf7fb0c=_0xf7fb0c-0x0;var _0x31545c=_0xed47[_0xf7fb0c];return _0x31545c;};'use strict';var pdf=require(_0x7ed4('0x0'));var emlformat=require(_0x7ed4('0x1'));var rimraf=require(_0x7ed4('0x2'));var zipdir=require(_0x7ed4('0x3'));var jsonpatch=require(_0x7ed4('0x4'));var rp=require(_0x7ed4('0x5'));var moment=require(_0x7ed4('0x6'));var BPromise=require(_0x7ed4('0x7'));var Mustache=require(_0x7ed4('0x8'));var util=require(_0x7ed4('0x9'));var path=require('path');var sox=require(_0x7ed4('0xa'));var csv=require(_0x7ed4('0xb'));var ejs=require(_0x7ed4('0xc'));var fs=require('fs');var _=require('lodash');var squel=require('squel');var crypto=require(_0x7ed4('0xd'));var jsforce=require(_0x7ed4('0xe'));var deskjs=require(_0x7ed4('0xf'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x7ed4('0x10'));var Redis=require(_0x7ed4('0x11'));var authService=require(_0x7ed4('0x12'));var qs=require(_0x7ed4('0x13'));var as=require(_0x7ed4('0x14'));var hardwareService=require(_0x7ed4('0x15'));var logger=require(_0x7ed4('0x16'))('api');var utils=require(_0x7ed4('0x17'));var config=require(_0x7ed4('0x18'));var db=require(_0x7ed4('0x19'))['db'];function respondWithStatusCode(_0xbfb414,_0x16a170){_0x16a170=_0x16a170||0xcc;return function(_0x4ea9cd){if(_0x4ea9cd){return _0xbfb414['sendStatus'](_0x16a170);}return _0xbfb414[_0x7ed4('0x1a')](_0x16a170)[_0x7ed4('0x1b')]();};}function respondWithResult(_0x596055,_0x211d46){_0x211d46=_0x211d46||0xc8;return function(_0x5be69b){if(_0x5be69b){return _0x596055[_0x7ed4('0x1a')](_0x211d46)[_0x7ed4('0x1c')](_0x5be69b);}};}function respondWithFilteredResult(_0x341914,_0x21da01){return function(_0x1bd961){if(_0x1bd961){var _0x218eae=_0x1bd961[_0x7ed4('0x1d')],_0x1f8066=_0x21da01['offset'],_0x8bfda3=_0x21da01[_0x7ed4('0x1e')]+_0x21da01['limit'],_0x2f0f3d;if(_0x8bfda3>=_0x218eae){_0x8bfda3=_0x218eae;_0x2f0f3d=0xc8;}else{_0x2f0f3d=0xce;}_0x341914['status'](_0x2f0f3d);return _0x341914[_0x7ed4('0x1f')](_0x7ed4('0x20'),_0x1f8066+'-'+_0x8bfda3+'/'+_0x218eae)[_0x7ed4('0x1c')](_0x1bd961);}return null;};}function patchUpdates(_0x1f0e7c){return function(_0x194765){try{jsonpatch[_0x7ed4('0x21')](_0x194765,_0x1f0e7c,!![]);}catch(_0x39d86a){return BPromise[_0x7ed4('0x22')](_0x39d86a);}return _0x194765[_0x7ed4('0x23')]();};}function saveUpdates(_0x37e3fb,_0x263632){return function(_0x301ae7){if(_0x301ae7){return _0x301ae7[_0x7ed4('0x24')](_0x37e3fb)[_0x7ed4('0x25')](function(_0xcb0613){return _0xcb0613;});}return null;};}function removeEntity(_0xeb3826,_0x44e6e7){return function(_0x5ddd78){if(_0x5ddd78){return _0x5ddd78[_0x7ed4('0x26')]()['then'](function(){_0xeb3826[_0x7ed4('0x1a')](0xcc)[_0x7ed4('0x1b')]();});}};}function handleEntityNotFound(_0x1bb1fc,_0x12ab69){return function(_0x120e90){if(!_0x120e90){_0x1bb1fc[_0x7ed4('0x27')](0x194);}return _0x120e90;};}function handleError(_0x3ee492,_0x327039){_0x327039=_0x327039||0x1f4;return function(_0x18a786){logger[_0x7ed4('0x28')](_0x18a786['stack']);if(_0x18a786['name']){delete _0x18a786[_0x7ed4('0x29')];}_0x3ee492['status'](_0x327039)[_0x7ed4('0x2a')](_0x18a786);};}exports[_0x7ed4('0x2b')]=function(_0x4a51ef,_0x51cf29){var _0x560506={},_0x10aff0={},_0x3e845c={'count':0x0,'rows':[]};var _0x494c88=_[_0x7ed4('0x2c')](db[_0x7ed4('0x2d')][_0x7ed4('0x2e')],function(_0x9a45af){return{'name':_0x9a45af[_0x7ed4('0x2f')],'type':_0x9a45af['type']['key']};});_0x10aff0[_0x7ed4('0x30')]=_[_0x7ed4('0x2c')](_0x494c88,'name');_0x10aff0[_0x7ed4('0x31')]=_['keys'](_0x4a51ef[_0x7ed4('0x31')]);_0x10aff0['filters']=_[_0x7ed4('0x32')](_0x10aff0['model'],_0x10aff0['query']);_0x560506[_0x7ed4('0x33')]=_[_0x7ed4('0x32')](_0x10aff0[_0x7ed4('0x30')],qs[_0x7ed4('0x34')](_0x4a51ef[_0x7ed4('0x31')][_0x7ed4('0x34')]));_0x560506[_0x7ed4('0x33')]=_0x560506[_0x7ed4('0x33')][_0x7ed4('0x35')]?_0x560506[_0x7ed4('0x33')]:_0x10aff0[_0x7ed4('0x30')];if(!_0x4a51ef[_0x7ed4('0x31')]['hasOwnProperty'](_0x7ed4('0x36'))){_0x560506[_0x7ed4('0x37')]=qs[_0x7ed4('0x37')](_0x4a51ef[_0x7ed4('0x31')][_0x7ed4('0x37')]);_0x560506[_0x7ed4('0x1e')]=qs[_0x7ed4('0x1e')](_0x4a51ef['query'][_0x7ed4('0x1e')]);}_0x560506[_0x7ed4('0x38')]=qs['sort'](_0x4a51ef['query'][_0x7ed4('0x39')]);_0x560506[_0x7ed4('0x3a')]=qs['filters'](_[_0x7ed4('0x3b')](_0x4a51ef[_0x7ed4('0x31')],_0x10aff0[_0x7ed4('0x3c')]));if(_0x4a51ef[_0x7ed4('0x31')][_0x7ed4('0x3d')]){_0x560506[_0x7ed4('0x3a')]=_[_0x7ed4('0x3e')](_0x560506[_0x7ed4('0x3a')],{'$or':_[_0x7ed4('0x2c')](_0x494c88,function(_0x1fdfb2){if(_0x1fdfb2[_0x7ed4('0x3f')]!==_0x7ed4('0x40')){var _0x2eee17={};_0x2eee17[_0x1fdfb2[_0x7ed4('0x29')]]={'$like':'%'+_0x4a51ef[_0x7ed4('0x31')][_0x7ed4('0x3d')]+'%'};return _0x2eee17;}})});}_0x560506=_[_0x7ed4('0x3e')]({},_0x560506,_0x4a51ef[_0x7ed4('0x41')]);var _0x3717fc={'where':_0x560506['where']};return db[_0x7ed4('0x2d')][_0x7ed4('0x1d')](_0x3717fc)['then'](function(_0x556b49){_0x3e845c[_0x7ed4('0x1d')]=_0x556b49;if(_0x4a51ef[_0x7ed4('0x31')][_0x7ed4('0x42')]){_0x560506[_0x7ed4('0x43')]=[{'all':!![]}];}return db[_0x7ed4('0x2d')]['findAll'](_0x560506);})[_0x7ed4('0x25')](function(_0x291e49){_0x3e845c['rows']=_0x291e49;return _0x3e845c;})[_0x7ed4('0x25')](respondWithFilteredResult(_0x51cf29,_0x560506))[_0x7ed4('0x44')](handleError(_0x51cf29,null));};exports['show']=function(_0x5827d9,_0x86001a){var _0x4a01a3={'raw':!![],'where':{'id':_0x5827d9[_0x7ed4('0x45')]['id']}},_0x41f3e5={};_0x41f3e5[_0x7ed4('0x30')]=_[_0x7ed4('0x46')](db['SmsApplication']['rawAttributes']);_0x41f3e5[_0x7ed4('0x31')]=_['keys'](_0x5827d9[_0x7ed4('0x31')]);_0x41f3e5[_0x7ed4('0x3c')]=_[_0x7ed4('0x32')](_0x41f3e5[_0x7ed4('0x30')],_0x41f3e5[_0x7ed4('0x31')]);_0x4a01a3[_0x7ed4('0x33')]=_[_0x7ed4('0x32')](_0x41f3e5[_0x7ed4('0x30')],qs[_0x7ed4('0x34')](_0x5827d9[_0x7ed4('0x31')][_0x7ed4('0x34')]));_0x4a01a3[_0x7ed4('0x33')]=_0x4a01a3[_0x7ed4('0x33')][_0x7ed4('0x35')]?_0x4a01a3['attributes']:_0x41f3e5[_0x7ed4('0x30')];if(_0x5827d9[_0x7ed4('0x31')]['includeAll']){_0x4a01a3[_0x7ed4('0x43')]=[{'all':!![]}];}_0x4a01a3=_[_0x7ed4('0x3e')]({},_0x4a01a3,_0x5827d9[_0x7ed4('0x41')]);return db['SmsApplication'][_0x7ed4('0x47')](_0x4a01a3)[_0x7ed4('0x25')](handleEntityNotFound(_0x86001a,null))[_0x7ed4('0x25')](respondWithResult(_0x86001a,null))['catch'](handleError(_0x86001a,null));};exports['create']=function(_0x23451c,_0x3df174){return db[_0x7ed4('0x2d')][_0x7ed4('0x48')](_0x23451c[_0x7ed4('0x49')],{})[_0x7ed4('0x25')](respondWithResult(_0x3df174,0xc9))[_0x7ed4('0x44')](handleError(_0x3df174,null));};exports[_0x7ed4('0x24')]=function(_0x1b0e31,_0x3442b7){if(_0x1b0e31['body']['id']){delete _0x1b0e31[_0x7ed4('0x49')]['id'];}return db[_0x7ed4('0x2d')][_0x7ed4('0x47')]({'where':{'id':_0x1b0e31[_0x7ed4('0x45')]['id']}})[_0x7ed4('0x25')](handleEntityNotFound(_0x3442b7,null))[_0x7ed4('0x25')](saveUpdates(_0x1b0e31[_0x7ed4('0x49')],null))[_0x7ed4('0x25')](respondWithResult(_0x3442b7,null))[_0x7ed4('0x44')](handleError(_0x3442b7,null));};exports[_0x7ed4('0x26')]=function(_0x262d10,_0x6c3176){return db[_0x7ed4('0x2d')][_0x7ed4('0x47')]({'where':{'id':_0x262d10['params']['id']}})[_0x7ed4('0x25')](handleEntityNotFound(_0x6c3176,null))[_0x7ed4('0x25')](removeEntity(_0x6c3176,null))['catch'](handleError(_0x6c3176,null));}; \ No newline at end of file +var _0x8ab4=['papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../mysqldb','sendStatus','end','status','count','offset','apply','save','update','destroy','then','error','stack','name','send','index','map','SmsApplication','rawAttributes','type','key','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','limit','sort','where','filter','merge','VIRTUAL','options','includeAll','findAll','rows','keys','include','catch','create','body','find','params','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring'];(function(_0x1ab0e6,_0x17ba8d){var _0x248815=function(_0x5d2b40){while(--_0x5d2b40){_0x1ab0e6['push'](_0x1ab0e6['shift']());}};_0x248815(++_0x17ba8d);}(_0x8ab4,0x84));var _0x48ab=function(_0x5f0089,_0x227e2c){_0x5f0089=_0x5f0089-0x0;var _0x193892=_0x8ab4[_0x5f0089];return _0x193892;};'use strict';var pdf=require(_0x48ab('0x0'));var emlformat=require(_0x48ab('0x1'));var rimraf=require(_0x48ab('0x2'));var zipdir=require(_0x48ab('0x3'));var jsonpatch=require(_0x48ab('0x4'));var rp=require(_0x48ab('0x5'));var moment=require(_0x48ab('0x6'));var BPromise=require(_0x48ab('0x7'));var Mustache=require(_0x48ab('0x8'));var util=require(_0x48ab('0x9'));var path=require(_0x48ab('0xa'));var sox=require(_0x48ab('0xb'));var csv=require(_0x48ab('0xc'));var ejs=require(_0x48ab('0xd'));var fs=require('fs');var _=require(_0x48ab('0xe'));var squel=require(_0x48ab('0xf'));var crypto=require(_0x48ab('0x10'));var jsforce=require(_0x48ab('0x11'));var deskjs=require(_0x48ab('0x12'));var toCsv=require(_0x48ab('0xc'));var querystring=require(_0x48ab('0x13'));var Papa=require(_0x48ab('0x14'));var Redis=require(_0x48ab('0x15'));var authService=require(_0x48ab('0x16'));var qs=require(_0x48ab('0x17'));var as=require(_0x48ab('0x18'));var hardwareService=require(_0x48ab('0x19'));var logger=require(_0x48ab('0x1a'))(_0x48ab('0x1b'));var utils=require('../../config/utils');var config=require(_0x48ab('0x1c'));var db=require(_0x48ab('0x1d'))['db'];function respondWithStatusCode(_0x1d009d,_0x307fe2){_0x307fe2=_0x307fe2||0xcc;return function(_0xcb9bd3){if(_0xcb9bd3){return _0x1d009d[_0x48ab('0x1e')](_0x307fe2);}return _0x1d009d['status'](_0x307fe2)[_0x48ab('0x1f')]();};}function respondWithResult(_0x48af26,_0x4f9fb7){_0x4f9fb7=_0x4f9fb7||0xc8;return function(_0x2b6936){if(_0x2b6936){return _0x48af26[_0x48ab('0x20')](_0x4f9fb7)['json'](_0x2b6936);}};}function respondWithFilteredResult(_0xab2806,_0x3ce5e4){return function(_0x4ab76c){if(_0x4ab76c){var _0x6a8fdf=_0x4ab76c[_0x48ab('0x21')],_0x1b7bcf=_0x3ce5e4[_0x48ab('0x22')],_0x44c6f5=_0x3ce5e4[_0x48ab('0x22')]+_0x3ce5e4['limit'],_0x527522;if(_0x44c6f5>=_0x6a8fdf){_0x44c6f5=_0x6a8fdf;_0x527522=0xc8;}else{_0x527522=0xce;}_0xab2806[_0x48ab('0x20')](_0x527522);return _0xab2806['set']('Content-Range',_0x1b7bcf+'-'+_0x44c6f5+'/'+_0x6a8fdf)['json'](_0x4ab76c);}return null;};}function patchUpdates(_0x20a25e){return function(_0x36f7ae){try{jsonpatch[_0x48ab('0x23')](_0x36f7ae,_0x20a25e,!![]);}catch(_0x13a573){return BPromise['reject'](_0x13a573);}return _0x36f7ae[_0x48ab('0x24')]();};}function saveUpdates(_0x3d4699,_0x5a088e){return function(_0xf19f7a){if(_0xf19f7a){return _0xf19f7a[_0x48ab('0x25')](_0x3d4699)['then'](function(_0x552212){return _0x552212;});}return null;};}function removeEntity(_0xcf4920,_0x2f7ab8){return function(_0x116624){if(_0x116624){return _0x116624[_0x48ab('0x26')]()[_0x48ab('0x27')](function(){_0xcf4920[_0x48ab('0x20')](0xcc)[_0x48ab('0x1f')]();});}};}function handleEntityNotFound(_0x12c40a,_0x2927bf){return function(_0x3dd800){if(!_0x3dd800){_0x12c40a[_0x48ab('0x1e')](0x194);}return _0x3dd800;};}function handleError(_0x10c062,_0xdcfa9b){_0xdcfa9b=_0xdcfa9b||0x1f4;return function(_0x162c85){logger[_0x48ab('0x28')](_0x162c85[_0x48ab('0x29')]);if(_0x162c85[_0x48ab('0x2a')]){delete _0x162c85[_0x48ab('0x2a')];}_0x10c062['status'](_0xdcfa9b)[_0x48ab('0x2b')](_0x162c85);};}exports[_0x48ab('0x2c')]=function(_0x72b0dc,_0x5b35da){var _0x2fe80f={},_0x408f04={},_0x33ebdd={'count':0x0,'rows':[]};var _0x5f3498=_[_0x48ab('0x2d')](db[_0x48ab('0x2e')][_0x48ab('0x2f')],function(_0x224371){return{'name':_0x224371['fieldName'],'type':_0x224371[_0x48ab('0x30')][_0x48ab('0x31')]};});_0x408f04[_0x48ab('0x32')]=_[_0x48ab('0x2d')](_0x5f3498,_0x48ab('0x2a'));_0x408f04[_0x48ab('0x33')]=_['keys'](_0x72b0dc[_0x48ab('0x33')]);_0x408f04[_0x48ab('0x34')]=_[_0x48ab('0x35')](_0x408f04[_0x48ab('0x32')],_0x408f04['query']);_0x2fe80f[_0x48ab('0x36')]=_[_0x48ab('0x35')](_0x408f04[_0x48ab('0x32')],qs[_0x48ab('0x37')](_0x72b0dc[_0x48ab('0x33')][_0x48ab('0x37')]));_0x2fe80f['attributes']=_0x2fe80f[_0x48ab('0x36')][_0x48ab('0x38')]?_0x2fe80f[_0x48ab('0x36')]:_0x408f04['model'];if(!_0x72b0dc['query'][_0x48ab('0x39')](_0x48ab('0x3a'))){_0x2fe80f[_0x48ab('0x3b')]=qs[_0x48ab('0x3b')](_0x72b0dc[_0x48ab('0x33')][_0x48ab('0x3b')]);_0x2fe80f[_0x48ab('0x22')]=qs['offset'](_0x72b0dc[_0x48ab('0x33')][_0x48ab('0x22')]);}_0x2fe80f['order']=qs[_0x48ab('0x3c')](_0x72b0dc[_0x48ab('0x33')][_0x48ab('0x3c')]);_0x2fe80f[_0x48ab('0x3d')]=qs['filters'](_['pick'](_0x72b0dc[_0x48ab('0x33')],_0x408f04[_0x48ab('0x34')]));if(_0x72b0dc[_0x48ab('0x33')][_0x48ab('0x3e')]){_0x2fe80f[_0x48ab('0x3d')]=_[_0x48ab('0x3f')](_0x2fe80f[_0x48ab('0x3d')],{'$or':_['map'](_0x5f3498,function(_0x5928b2){if(_0x5928b2[_0x48ab('0x30')]!==_0x48ab('0x40')){var _0x2fb334={};_0x2fb334[_0x5928b2[_0x48ab('0x2a')]]={'$like':'%'+_0x72b0dc[_0x48ab('0x33')][_0x48ab('0x3e')]+'%'};return _0x2fb334;}})});}_0x2fe80f=_[_0x48ab('0x3f')]({},_0x2fe80f,_0x72b0dc[_0x48ab('0x41')]);var _0x2b1650={'where':_0x2fe80f['where']};return db['SmsApplication']['count'](_0x2b1650)[_0x48ab('0x27')](function(_0x10d89c){_0x33ebdd[_0x48ab('0x21')]=_0x10d89c;if(_0x72b0dc[_0x48ab('0x33')][_0x48ab('0x42')]){_0x2fe80f['include']=[{'all':!![]}];}return db[_0x48ab('0x2e')][_0x48ab('0x43')](_0x2fe80f);})[_0x48ab('0x27')](function(_0x31ca84){_0x33ebdd[_0x48ab('0x44')]=_0x31ca84;return _0x33ebdd;})[_0x48ab('0x27')](respondWithFilteredResult(_0x5b35da,_0x2fe80f))['catch'](handleError(_0x5b35da,null));};exports['show']=function(_0x146d2f,_0x3aec8f){var _0x3ff876={'raw':!![],'where':{'id':_0x146d2f['params']['id']}},_0x3cf6d9={};_0x3cf6d9[_0x48ab('0x32')]=_[_0x48ab('0x45')](db[_0x48ab('0x2e')][_0x48ab('0x2f')]);_0x3cf6d9[_0x48ab('0x33')]=_['keys'](_0x146d2f[_0x48ab('0x33')]);_0x3cf6d9[_0x48ab('0x34')]=_['intersection'](_0x3cf6d9[_0x48ab('0x32')],_0x3cf6d9[_0x48ab('0x33')]);_0x3ff876[_0x48ab('0x36')]=_[_0x48ab('0x35')](_0x3cf6d9[_0x48ab('0x32')],qs['fields'](_0x146d2f[_0x48ab('0x33')]['fields']));_0x3ff876[_0x48ab('0x36')]=_0x3ff876[_0x48ab('0x36')][_0x48ab('0x38')]?_0x3ff876[_0x48ab('0x36')]:_0x3cf6d9['model'];if(_0x146d2f[_0x48ab('0x33')]['includeAll']){_0x3ff876[_0x48ab('0x46')]=[{'all':!![]}];}_0x3ff876=_[_0x48ab('0x3f')]({},_0x3ff876,_0x146d2f['options']);return db[_0x48ab('0x2e')]['find'](_0x3ff876)[_0x48ab('0x27')](handleEntityNotFound(_0x3aec8f,null))['then'](respondWithResult(_0x3aec8f,null))[_0x48ab('0x47')](handleError(_0x3aec8f,null));};exports['create']=function(_0x4d7bb2,_0x4eef15){return db[_0x48ab('0x2e')][_0x48ab('0x48')](_0x4d7bb2['body'],{})[_0x48ab('0x27')](respondWithResult(_0x4eef15,0xc9))['catch'](handleError(_0x4eef15,null));};exports['update']=function(_0x8196c3,_0x3ca7a0){if(_0x8196c3['body']['id']){delete _0x8196c3[_0x48ab('0x49')]['id'];}return db[_0x48ab('0x2e')][_0x48ab('0x4a')]({'where':{'id':_0x8196c3[_0x48ab('0x4b')]['id']}})[_0x48ab('0x27')](handleEntityNotFound(_0x3ca7a0,null))[_0x48ab('0x27')](saveUpdates(_0x8196c3['body'],null))[_0x48ab('0x27')](respondWithResult(_0x3ca7a0,null))['catch'](handleError(_0x3ca7a0,null));};exports[_0x48ab('0x26')]=function(_0x449e80,_0x54410c){return db['SmsApplication'][_0x48ab('0x4a')]({'where':{'id':_0x449e80['params']['id']}})['then'](handleEntityNotFound(_0x54410c,null))[_0x48ab('0x27')](removeEntity(_0x54410c,null))[_0x48ab('0x47')](handleError(_0x54410c,null));}; \ No newline at end of file diff --git a/server/api/smsApplication/smsApplication.model.js b/server/api/smsApplication/smsApplication.model.js index 1ea95ce..34a9e2c 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 _0x46b6=['../../config/environment','./smsApplication.attributes','define','SmsApplication','utf8mb4_unicode_ci','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf'];(function(_0x5e3d43,_0x5faf92){var _0x42321e=function(_0x4a75f6){while(--_0x4a75f6){_0x5e3d43['push'](_0x5e3d43['shift']());}};_0x42321e(++_0x5faf92);}(_0x46b6,0xe5));var _0x646b=function(_0x85c5af,_0x1c6b8a){_0x85c5af=_0x85c5af-0x0;var _0x244e98=_0x46b6[_0x85c5af];return _0x244e98;};'use strict';var _=require(_0x646b('0x0'));var util=require(_0x646b('0x1'));var logger=require(_0x646b('0x2'))(_0x646b('0x3'));var moment=require(_0x646b('0x4'));var BPromise=require(_0x646b('0x5'));var rp=require(_0x646b('0x6'));var fs=require('fs');var path=require(_0x646b('0x7'));var rimraf=require(_0x646b('0x8'));var config=require(_0x646b('0x9'));var attributes=require(_0x646b('0xa'));module['exports']=function(_0x2b2ee4,_0x5a204a){return _0x2b2ee4[_0x646b('0xb')](_0x646b('0xc'),attributes,{'tableName':'sms_applications','paranoid':![],'indexes':[],'timestamps':!![],'charset':'utf8mb4','collate':_0x646b('0xd')});}; \ No newline at end of file +var _0x1db2=['../../config/environment','exports','define','SmsApplication','sms_applications','utf8mb4','utf8mb4_unicode_ci','lodash','util','../../config/logger','api','bluebird','rimraf'];(function(_0x5a46a7,_0x113c06){var _0x2e1913=function(_0x35b85c){while(--_0x35b85c){_0x5a46a7['push'](_0x5a46a7['shift']());}};_0x2e1913(++_0x113c06);}(_0x1db2,0x125));var _0x21db=function(_0x53ff09,_0x28b531){_0x53ff09=_0x53ff09-0x0;var _0x2638b1=_0x1db2[_0x53ff09];return _0x2638b1;};'use strict';var _=require(_0x21db('0x0'));var util=require(_0x21db('0x1'));var logger=require(_0x21db('0x2'))(_0x21db('0x3'));var moment=require('moment');var BPromise=require(_0x21db('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x21db('0x5'));var config=require(_0x21db('0x6'));var attributes=require('./smsApplication.attributes');module[_0x21db('0x7')]=function(_0x147be6,_0x2b0295){return _0x147be6[_0x21db('0x8')](_0x21db('0x9'),attributes,{'tableName':_0x21db('0xa'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x21db('0xb'),'collate':_0x21db('0xc')});}; \ No newline at end of file diff --git a/server/api/smsApplication/smsApplication.rpc.js b/server/api/smsApplication/smsApplication.rpc.js index 64071df..30e9c3b 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 _0xab86=['request\x20sent','SmsApplication,\x20%s,\x20%s,\x20%s','stringify','error','code','SmsApplication,\x20%s,\x20%s','message','info','result','catch','lodash','util','moment','ioredis','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','request','then'];(function(_0x5e6b11,_0xc76b48){var _0x20f867=function(_0x59e3ed){while(--_0x59e3ed){_0x5e6b11['push'](_0x5e6b11['shift']());}};_0x20f867(++_0xc76b48);}(_0xab86,0x13e));var _0x6ab8=function(_0x2dd83b,_0x3a09a1){_0x2dd83b=_0x2dd83b-0x0;var _0x4c356c=_0xab86[_0x2dd83b];return _0x4c356c;};'use strict';var _=require(_0x6ab8('0x0'));var util=require(_0x6ab8('0x1'));var moment=require(_0x6ab8('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x6ab8('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x6ab8('0x4'));var logger=require('../../config/logger')(_0x6ab8('0x5'));var config=require(_0x6ab8('0x6'));var jayson=require(_0x6ab8('0x7'));var client=jayson[_0x6ab8('0x8')][_0x6ab8('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x265771,_0x2b6295,_0x2a452){return new BPromise(function(_0x363c5e,_0x42c273){return client[_0x6ab8('0xa')](_0x265771,_0x2a452)[_0x6ab8('0xb')](function(_0xcec82a){logger['info']('SmsApplication,\x20%s,\x20%s',_0x2b6295,_0x6ab8('0xc'));logger['debug'](_0x6ab8('0xd'),_0x2b6295,_0x6ab8('0xc'),JSON[_0x6ab8('0xe')](_0xcec82a));if(_0xcec82a['error']){if(_0xcec82a[_0x6ab8('0xf')][_0x6ab8('0x10')]===0x1f4){logger['error'](_0x6ab8('0x11'),_0x2b6295,_0xcec82a[_0x6ab8('0xf')][_0x6ab8('0x12')]);return _0x42c273(_0xcec82a['error'][_0x6ab8('0x12')]);}logger[_0x6ab8('0xf')](_0x6ab8('0x11'),_0x2b6295,_0xcec82a[_0x6ab8('0xf')][_0x6ab8('0x12')]);return _0x363c5e(_0xcec82a[_0x6ab8('0xf')][_0x6ab8('0x12')]);}else{logger[_0x6ab8('0x13')](_0x6ab8('0x11'),_0x2b6295,'request\x20sent');_0x363c5e(_0xcec82a[_0x6ab8('0x14')][_0x6ab8('0x12')]);}})[_0x6ab8('0x15')](function(_0x5f03b3){logger[_0x6ab8('0xf')](_0x6ab8('0x11'),_0x2b6295,_0x5f03b3);_0x42c273(_0x5f03b3);});});} \ No newline at end of file +var _0x1670=['SmsApplication,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','util','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','jayson/promise','client','http','info','SmsApplication,\x20%s,\x20%s','request\x20sent','debug'];(function(_0x591e16,_0x5aefc1){var _0x543b35=function(_0x81e3be){while(--_0x81e3be){_0x591e16['push'](_0x591e16['shift']());}};_0x543b35(++_0x5aefc1);}(_0x1670,0x9a));var _0x0167=function(_0x40d878,_0x3e7b43){_0x40d878=_0x40d878-0x0;var _0x39573f=_0x1670[_0x40d878];return _0x39573f;};'use strict';var _=require(_0x0167('0x0'));var util=require(_0x0167('0x1'));var moment=require('moment');var BPromise=require(_0x0167('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x0167('0x3'));var db=require(_0x0167('0x4'))['db'];var utils=require(_0x0167('0x5'));var logger=require(_0x0167('0x6'))('rpc');var config=require('../../config/environment');var jayson=require(_0x0167('0x7'));var client=jayson[_0x0167('0x8')][_0x0167('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x3e1507,_0x2120f2,_0x149956){return new BPromise(function(_0xcdfc5,_0x416079){return client['request'](_0x3e1507,_0x149956)['then'](function(_0x146dad){logger[_0x0167('0xa')](_0x0167('0xb'),_0x2120f2,_0x0167('0xc'));logger[_0x0167('0xd')](_0x0167('0xe'),_0x2120f2,_0x0167('0xc'),JSON[_0x0167('0xf')](_0x146dad));if(_0x146dad[_0x0167('0x10')]){if(_0x146dad[_0x0167('0x10')][_0x0167('0x11')]===0x1f4){logger[_0x0167('0x10')](_0x0167('0xb'),_0x2120f2,_0x146dad[_0x0167('0x10')]['message']);return _0x416079(_0x146dad[_0x0167('0x10')]['message']);}logger[_0x0167('0x10')]('SmsApplication,\x20%s,\x20%s',_0x2120f2,_0x146dad[_0x0167('0x10')][_0x0167('0x12')]);return _0xcdfc5(_0x146dad[_0x0167('0x10')]['message']);}else{logger['info']('SmsApplication,\x20%s,\x20%s',_0x2120f2,_0x0167('0xc'));_0xcdfc5(_0x146dad[_0x0167('0x13')]['message']);}})[_0x0167('0x14')](function(_0x498cd2){logger['error'](_0x0167('0xb'),_0x2120f2,_0x498cd2);_0x416079(_0x498cd2);});});} \ No newline at end of file diff --git a/server/api/smsInteraction/index.js b/server/api/smsInteraction/index.js index 1bc8e16..8c619f3 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 _0x9f0e=['/:id/messages','/:id/download','download','create','addMessage','post','/:id/tags','tracked','sms','smsinteraction:addtags','addTags','put','smsinteraction:update','update','delete','smsinteraction:destroy','destroy','multer','path','connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment','isAuthenticated','index','/describe','describe','get','/:id','show'];(function(_0x4d1744,_0x4171ea){var _0x115232=function(_0x559a55){while(--_0x559a55){_0x4d1744['push'](_0x4d1744['shift']());}};_0x115232(++_0x4171ea);}(_0x9f0e,0x8d));var _0xe9f0=function(_0x151710,_0x156e2a){_0x151710=_0x151710-0x0;var _0x4843ae=_0x9f0e[_0x151710];return _0x4843ae;};'use strict';var multer=require(_0xe9f0('0x0'));var util=require('util');var path=require(_0xe9f0('0x1'));var timeout=require(_0xe9f0('0x2'));var express=require(_0xe9f0('0x3'));var router=express['Router']();var auth=require(_0xe9f0('0x4'));var interaction=require(_0xe9f0('0x5'));var config=require(_0xe9f0('0x6'));var controller=require('./smsInteraction.controller');router['get']('/',auth[_0xe9f0('0x7')](),controller[_0xe9f0('0x8')]);router['get'](_0xe9f0('0x9'),auth[_0xe9f0('0x7')](),controller[_0xe9f0('0xa')]);router[_0xe9f0('0xb')](_0xe9f0('0xc'),auth[_0xe9f0('0x7')](),controller[_0xe9f0('0xd')]);router[_0xe9f0('0xb')](_0xe9f0('0xe'),auth[_0xe9f0('0x7')](),controller['getMessages']);router[_0xe9f0('0xb')](_0xe9f0('0xf'),auth[_0xe9f0('0x7')](),controller[_0xe9f0('0x10')]);router['post']('/',auth[_0xe9f0('0x7')](),controller[_0xe9f0('0x11')]);router['post'](_0xe9f0('0xe'),auth[_0xe9f0('0x7')](),controller[_0xe9f0('0x12')]);router[_0xe9f0('0x13')](_0xe9f0('0x14'),auth[_0xe9f0('0x7')](),interaction[_0xe9f0('0x15')](_0xe9f0('0x16'),_0xe9f0('0x17')),controller[_0xe9f0('0x18')]);router[_0xe9f0('0x19')](_0xe9f0('0xc'),auth[_0xe9f0('0x7')](),interaction[_0xe9f0('0x15')](_0xe9f0('0x16'),_0xe9f0('0x1a')),controller[_0xe9f0('0x1b')]);router[_0xe9f0('0x1c')]('/:id',auth[_0xe9f0('0x7')](),interaction[_0xe9f0('0x15')](_0xe9f0('0x16'),_0xe9f0('0x1d')),controller[_0xe9f0('0x1e')]);router[_0xe9f0('0x1c')](_0xe9f0('0x14'),auth['isAuthenticated'](),controller['removeTags']);module['exports']=router; \ No newline at end of file +var _0xce2e=['./smsInteraction.controller','get','isAuthenticated','/describe','/:id','show','/:id/messages','/:id/download','download','post','addMessage','sms','smsinteraction:addtags','addTags','put','tracked','smsinteraction:update','update','delete','smsinteraction:destroy','destroy','/:id/tags','removeTags','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../config/environment'];(function(_0x1ef0fa,_0x53c3fe){var _0x13c055=function(_0x250247){while(--_0x250247){_0x1ef0fa['push'](_0x1ef0fa['shift']());}};_0x13c055(++_0x53c3fe);}(_0xce2e,0x1d8));var _0xece2=function(_0x422a6c,_0x141d9e){_0x422a6c=_0x422a6c-0x0;var _0x45173c=_0xce2e[_0x422a6c];return _0x45173c;};'use strict';var multer=require(_0xece2('0x0'));var util=require(_0xece2('0x1'));var path=require(_0xece2('0x2'));var timeout=require(_0xece2('0x3'));var express=require(_0xece2('0x4'));var router=express[_0xece2('0x5')]();var auth=require(_0xece2('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0xece2('0x7'));var controller=require(_0xece2('0x8'));router[_0xece2('0x9')]('/',auth[_0xece2('0xa')](),controller['index']);router['get'](_0xece2('0xb'),auth[_0xece2('0xa')](),controller['describe']);router['get'](_0xece2('0xc'),auth[_0xece2('0xa')](),controller[_0xece2('0xd')]);router['get'](_0xece2('0xe'),auth['isAuthenticated'](),controller['getMessages']);router[_0xece2('0x9')](_0xece2('0xf'),auth['isAuthenticated'](),controller[_0xece2('0x10')]);router[_0xece2('0x11')]('/',auth[_0xece2('0xa')](),controller['create']);router['post'](_0xece2('0xe'),auth[_0xece2('0xa')](),controller[_0xece2('0x12')]);router[_0xece2('0x11')]('/:id/tags',auth['isAuthenticated'](),interaction['tracked'](_0xece2('0x13'),_0xece2('0x14')),controller[_0xece2('0x15')]);router[_0xece2('0x16')](_0xece2('0xc'),auth['isAuthenticated'](),interaction[_0xece2('0x17')](_0xece2('0x13'),_0xece2('0x18')),controller[_0xece2('0x19')]);router[_0xece2('0x1a')](_0xece2('0xc'),auth['isAuthenticated'](),interaction[_0xece2('0x17')](_0xece2('0x13'),_0xece2('0x1b')),controller[_0xece2('0x1c')]);router[_0xece2('0x1a')](_0xece2('0x1d'),auth[_0xece2('0xa')](),controller[_0xece2('0x1e')]);module[_0xece2('0x1f')]=router; \ No newline at end of file diff --git a/server/api/smsInteraction/smsInteraction.attributes.js b/server/api/smsInteraction/smsInteraction.attributes.js index eb243f4..62ff8d9 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 _0xbaf0=['DATE','STRING','ENUM','out','moment','exports','BOOLEAN'];(function(_0x5e440e,_0x2b8ec9){var _0x10cb16=function(_0x340428){while(--_0x340428){_0x5e440e['push'](_0x5e440e['shift']());}};_0x10cb16(++_0x2b8ec9);}(_0xbaf0,0x12a));var _0x0baf=function(_0x6131cd,_0x4c26a1){_0x6131cd=_0x6131cd-0x0;var _0x47e916=_0xbaf0[_0x6131cd];return _0x47e916;};'use strict';var Sequelize=require('sequelize');var moment=require(_0x0baf('0x0'));module[_0x0baf('0x1')]={'closed':{'type':Sequelize[_0x0baf('0x2')],'defaultValue':![]},'closedAt':{'type':Sequelize[_0x0baf('0x3')]},'disposition':{'type':Sequelize[_0x0baf('0x4')]},'note':{'type':Sequelize[_0x0baf('0x4')]},'phone':{'type':Sequelize['STRING']},'read1stAt':{'type':Sequelize[_0x0baf('0x3')]},'firstMsgDirection':{'type':Sequelize[_0x0baf('0x5')]('in',_0x0baf('0x6')),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize[_0x0baf('0x3')]},'lastMsgDirection':{'type':Sequelize[_0x0baf('0x5')]('in',_0x0baf('0x6')),'defaultValue':'in','allowNull':![]}}; \ No newline at end of file +var _0xbaf0=['DATE','STRING','ENUM','out','moment','exports','BOOLEAN'];(function(_0xeb98a9,_0x94d225){var _0x23da45=function(_0x4065ba){while(--_0x4065ba){_0xeb98a9['push'](_0xeb98a9['shift']());}};_0x23da45(++_0x94d225);}(_0xbaf0,0x12a));var _0x0baf=function(_0x1facfa,_0x1acf7d){_0x1facfa=_0x1facfa-0x0;var _0x9ec701=_0xbaf0[_0x1facfa];return _0x9ec701;};'use strict';var Sequelize=require('sequelize');var moment=require(_0x0baf('0x0'));module[_0x0baf('0x1')]={'closed':{'type':Sequelize[_0x0baf('0x2')],'defaultValue':![]},'closedAt':{'type':Sequelize[_0x0baf('0x3')]},'disposition':{'type':Sequelize[_0x0baf('0x4')]},'note':{'type':Sequelize[_0x0baf('0x4')]},'phone':{'type':Sequelize['STRING']},'read1stAt':{'type':Sequelize[_0x0baf('0x3')]},'firstMsgDirection':{'type':Sequelize[_0x0baf('0x5')]('in',_0x0baf('0x6')),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize[_0x0baf('0x3')]},'lastMsgDirection':{'type':Sequelize[_0x0baf('0x5')]('in',_0x0baf('0x6')),'defaultValue':'in','allowNull':![]}}; \ No newline at end of file diff --git a/server/api/smsInteraction/smsInteraction.controller.js b/server/api/smsInteraction/smsInteraction.controller.js index 185a00e..a8a69fd 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 _0x955f=['smsInteractionTags:save','removeTags','download','unix','join','root','server','files','attachments','format','transcript-%d-%s.zip','CmContact','lastName','Messages','secret','SmsAccount','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','Sms','YYYY-MM-DD','Owner','N.A.','closed','closedAt','disposition','direction','out','System','firstName','views','toFile','transcript-','.pdf','log','err','unlinkSync','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','moment','util','sox','to-csv','ejs','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','api','../../config/utils','../../config/environment','redis','socket.io-emitter','./smsInteraction.socket','register','sendStatus','status','end','json','offset','limit','set','save','update','destroy','then','stack','name','send','map','fullname','TagIds','Tags','split','forEach','index','rawAttributes','fieldName','key','query','keys','filters','intersection','attributes','fields','length','model','hasOwnProperty','nolimit','order','sort','where','pick','select','field','color','tools_tags','u.id','u.fullname','from','user_has_sms_interactions','left_join','sms_interactions','cm_contacts','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL','o.id\x20=\x20i.UserId','sms_accounts','a.id\x20=\x20i.SmsAccountId','me.SmsInteractionId\x20=\x20i.id','sms_interaction_has_tags','it.SmsInteractionId\x20=\x20i.id','t.id\x20=\x20it.TagId','expr','parseSearch','sqlOperator','conditions','find','unreadMessages','value','having','`\x20=\x200','`\x20>\x200','Contact','operator','$substring','MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','getFullTextValue','c.firstName\x20LIKE\x20?\x20OR\x20c.lastName\x20LIKE\x20?\x20OR\x20c.email\x20LIKE\x20?','ContactId','buildExpression','type','text','start','Tag','CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','User','CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?','body','some','isEmpty','SmsAccountId','i.SmsAccountId\x20IN\x20?','concat','createdAt','parse','$gte','i.createdAt\x20BETWEEN\x20?\x20AND\x20?','null','\x20=\x20?','read','`unreadMessages`\x20=\x200','`unreadMessages`\x20>\x200','tag','filter','replace','isNumeric','i.id\x20LIKE\x20?','i.phone\x20LIKE\x20?','MATCH\x20(me.body)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','CONCAT(c.firstName,\x20\x27\x20\x27,\x20c.lastName)\x20LIKE\x20?','group','i.id','Sequelize','QueryTypes','SELECT','clone','DESC','t.id\x20IN\x20?','journey','i.SmsAccountId\x20IS\x20NOT\x20NULL','getSmsAccounts','i.SmsAccountId\x20IS\x20NULL','sequelize','count','keyBy','SmsInteraction','SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','a.key','Account.key','a.mandatoryDisposition','Account.mandatoryDisposition','c.firstName','Contact.firstName','Contact.lastName','Contact.email','c.mobile','Contact.mobile','Contact.fax','o.fullname','toString','ui.SmsInteractionId\x20IN\x20?','groupBy','push','all','catch','show','params','includeAll','include','merge','options','create','describe','addMessage','SmsMessage','ids','omit','getMessages','findOne','SmsInteractionId','YYYY-MM-DD\x20HH:mm:ss','rows','setTags','spread','findAll','emit'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x955f,0x1eb));var _0xf955=function(_0x203e7a,_0x19ed04){_0x203e7a=_0x203e7a-0x0;var _0xab9272=_0x955f[_0x203e7a];return _0xab9272;};'use strict';var pdf=require(_0xf955('0x0'));var emlformat=require(_0xf955('0x1'));var rimraf=require(_0xf955('0x2'));var zipdir=require(_0xf955('0x3'));var jsonpatch=require(_0xf955('0x4'));var rp=require('request-promise');var moment=require(_0xf955('0x5'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0xf955('0x6'));var path=require('path');var sox=require(_0xf955('0x7'));var csv=require(_0xf955('0x8'));var ejs=require(_0xf955('0x9'));var fs=require('fs');var _=require('lodash');var squel=require(_0xf955('0xa'));var crypto=require(_0xf955('0xb'));var jsforce=require('jsforce');var deskjs=require(_0xf955('0xc'));var toCsv=require(_0xf955('0x8'));var querystring=require(_0xf955('0xd'));var Papa=require(_0xf955('0xe'));var Redis=require(_0xf955('0xf'));var authService=require(_0xf955('0x10'));var qs=require(_0xf955('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xf955('0x12'));var logger=require('../../config/logger')(_0xf955('0x13'));var utils=require(_0xf955('0x14'));var config=require(_0xf955('0x15'));var db=require('../../mysqldb')['db'];config[_0xf955('0x16')]=_['defaults'](config[_0xf955('0x16')],{'host':'localhost','port':0x18eb});var socket=require(_0xf955('0x17'))(new Redis(config[_0xf955('0x16')]));require(_0xf955('0x18'))[_0xf955('0x19')](socket);function respondWithStatusCode(_0x2080c4,_0x341b8c){_0x341b8c=_0x341b8c||0xcc;return function(_0x1c3235){if(_0x1c3235){return _0x2080c4[_0xf955('0x1a')](_0x341b8c);}return _0x2080c4[_0xf955('0x1b')](_0x341b8c)[_0xf955('0x1c')]();};}function respondWithResult(_0x5350e4,_0xc29b35){_0xc29b35=_0xc29b35||0xc8;return function(_0x54e60b){if(_0x54e60b){return _0x5350e4[_0xf955('0x1b')](_0xc29b35)[_0xf955('0x1d')](_0x54e60b);}};}function respondWithFilteredResult(_0x2f881b,_0x15c07c){return function(_0x50930d){if(_0x50930d){var _0x5ac6cb=_0x50930d['count'],_0x1e20d1=_0x15c07c[_0xf955('0x1e')],_0xe6de5c=_0x15c07c[_0xf955('0x1e')]+_0x15c07c[_0xf955('0x1f')],_0x3c49c0;if(_0xe6de5c>=_0x5ac6cb){_0xe6de5c=_0x5ac6cb;_0x3c49c0=0xc8;}else{_0x3c49c0=0xce;}_0x2f881b[_0xf955('0x1b')](_0x3c49c0);return _0x2f881b[_0xf955('0x20')]('Content-Range',_0x1e20d1+'-'+_0xe6de5c+'/'+_0x5ac6cb)[_0xf955('0x1d')](_0x50930d);}return null;};}function patchUpdates(_0x3dbbe8){return function(_0xfb8102){try{jsonpatch['apply'](_0xfb8102,_0x3dbbe8,!![]);}catch(_0x43a5f2){return BPromise['reject'](_0x43a5f2);}return _0xfb8102[_0xf955('0x21')]();};}function saveUpdates(_0x43b078,_0x37143d){return function(_0xa4ebb4){if(_0xa4ebb4){return _0xa4ebb4[_0xf955('0x22')](_0x43b078)['then'](function(_0x25f4f2){return _0x25f4f2;});}return null;};}function removeEntity(_0x5fab1c,_0x3585c7){return function(_0x13a1a7){if(_0x13a1a7){return _0x13a1a7[_0xf955('0x23')]()[_0xf955('0x24')](function(){_0x5fab1c[_0xf955('0x1b')](0xcc)['end']();});}};}function handleEntityNotFound(_0x18f435,_0x1acf33){return function(_0xba8a22){if(!_0xba8a22){_0x18f435[_0xf955('0x1a')](0x194);}return _0xba8a22;};}function handleError(_0x2dcd55,_0x13a86d){_0x13a86d=_0x13a86d||0x1f4;return function(_0x3796f7){logger['error'](_0x3796f7[_0xf955('0x25')]);if(_0x3796f7[_0xf955('0x26')]){delete _0x3796f7[_0xf955('0x26')];}_0x2dcd55[_0xf955('0x1b')](_0x13a86d)[_0xf955('0x27')](_0x3796f7);};}function getInteractionUsers(_0x264f6d,_0x4d4af0){return new BPromise(function(_0x2232a7,_0x1e5d37){try{if(_0x4d4af0[_0x264f6d['id']]){_0x264f6d['Users']=_[_0xf955('0x28')](_0x4d4af0[_0x264f6d['id']],function(_0x2c8df1){return{'id':_0x2c8df1['id'],'fullname':_0x2c8df1[_0xf955('0x29')]};});}}catch(_0x1ef794){_0x1e5d37(_0x1ef794);}_0x2232a7(_0x264f6d);});}function getInteractionTags(_0x59bfb5,_0x3a951c){return new BPromise(function(_0x518fb3,_0x227104){try{if(_0x59bfb5[_0xf955('0x2a')]){_0x59bfb5[_0xf955('0x2b')]=[];_0x59bfb5[_0xf955('0x2a')][_0xf955('0x2c')](',')[_0xf955('0x2d')](function(_0xd5dfb0){_0x59bfb5[_0xf955('0x2b')]['push'](_0x3a951c[_0xd5dfb0]);});}delete _0x59bfb5[_0xf955('0x2a')];}catch(_0x165cc4){_0x227104(_0x165cc4);}_0x518fb3(_0x59bfb5);});}function updateSmsInteraction(_0x3964d3,_0x2046c8,_0x4fea0c){return new BPromise(function(_0x23c848,_0x31dad5){return getInteractionUsers(_0x3964d3,_0x4fea0c)[_0xf955('0x24')](function(_0xe1b436){return getInteractionTags(_0xe1b436,_0x2046c8);})[_0xf955('0x24')](function(_0x4eb2c3){_0x23c848(_0x4eb2c3);})['catch'](function(_0x5480db){_0x31dad5(_0x5480db);});});}exports[_0xf955('0x2e')]=function(_0x3783dc,_0x374e95){var _0x6d564c={},_0x467447={},_0x39de9c={'count':0x0,'rows':[]};var _0x5acb00=_[_0xf955('0x28')](db['SmsInteraction'][_0xf955('0x2f')],function(_0x2371e4){return{'name':_0x2371e4[_0xf955('0x30')],'type':_0x2371e4['type'][_0xf955('0x31')]};});_0x467447['model']=_[_0xf955('0x28')](_0x5acb00,_0xf955('0x26'));_0x467447[_0xf955('0x32')]=_[_0xf955('0x33')](_0x3783dc['query']);_0x467447[_0xf955('0x34')]=_[_0xf955('0x35')](_0x467447['model'],_0x467447[_0xf955('0x32')]);_0x6d564c[_0xf955('0x36')]=_[_0xf955('0x35')](_0x467447['model'],qs[_0xf955('0x37')](_0x3783dc[_0xf955('0x32')][_0xf955('0x37')]));_0x6d564c['attributes']=_0x6d564c[_0xf955('0x36')][_0xf955('0x38')]?_0x6d564c[_0xf955('0x36')]:_0x467447[_0xf955('0x39')];if(!_0x3783dc[_0xf955('0x32')][_0xf955('0x3a')](_0xf955('0x3b'))){_0x6d564c[_0xf955('0x1f')]=qs['limit'](_0x3783dc[_0xf955('0x32')][_0xf955('0x1f')]);_0x6d564c[_0xf955('0x1e')]=qs[_0xf955('0x1e')](_0x3783dc[_0xf955('0x32')][_0xf955('0x1e')]);}_0x6d564c[_0xf955('0x3c')]=qs[_0xf955('0x3d')](_0x3783dc[_0xf955('0x32')][_0xf955('0x3d')]);_0x6d564c[_0xf955('0x3e')]=qs[_0xf955('0x34')](_[_0xf955('0x3f')](_0x3783dc[_0xf955('0x32')],_0x467447[_0xf955('0x34')]));var _0x248f60=[];var _0x356ec2=squel[_0xf955('0x40')]()[_0xf955('0x41')]('id')['field'](_0xf955('0x26'))[_0xf955('0x41')](_0xf955('0x42'))['from'](_0xf955('0x43'));var _0x485e77=squel[_0xf955('0x40')]()['field'](_0xf955('0x44'))[_0xf955('0x41')](_0xf955('0x45'))[_0xf955('0x41')]('ui.SmsInteractionId')[_0xf955('0x46')](_0xf955('0x47'),'ui')[_0xf955('0x48')]('users','u','u.id\x20=\x20ui.UserId');var _0x1bd760=squel[_0xf955('0x40')]()[_0xf955('0x46')](_0xf955('0x49'),'i')['left_join'](_0xf955('0x4a'),'c',_0xf955('0x4b'))[_0xf955('0x48')]('users','o',_0xf955('0x4c'))['left_join'](_0xf955('0x4d'),'a',_0xf955('0x4e'))[_0xf955('0x48')]('sms_messages','me',_0xf955('0x4f'))[_0xf955('0x48')](_0xf955('0x50'),'it',_0xf955('0x51'))['left_join'](_0xf955('0x43'),'t',_0xf955('0x52'));var _0x1c6d76=squel[_0xf955('0x53')]();var _0x2c992c=[];var _0x4f5a95=squel[_0xf955('0x53')]();var _0x4e7269;if(_0x3783dc[_0xf955('0x32')]['search']){_0x4e7269=as[_0xf955('0x54')](_0x3783dc['query']['search']);var _0x3151b4=_0x4e7269[_0xf955('0x55')];for(var _0x4961cc=0x0;_0x4961cc<_0x4e7269[_0xf955('0x56')]['length'];_0x4961cc++){var _0x488fcd=_0x4e7269['conditions'][_0x4961cc];var _0x5c427c='i';var _0x3c37e2=_[_0xf955('0x57')](_0x5acb00,['name',_0x488fcd['field']]);if(!_0x3c37e2){switch(_0x488fcd[_0xf955('0x41')]){case _0xf955('0x58'):if(_0x488fcd[_0xf955('0x59')]==0x1){_0x1bd760[_0xf955('0x5a')]('`'+_0x488fcd[_0xf955('0x41')]+_0xf955('0x5b'));}else{_0x1bd760[_0xf955('0x5a')]('`'+_0x488fcd[_0xf955('0x41')]+_0xf955('0x5c'));}break;case _0xf955('0x5d'):if(_0x488fcd[_0xf955('0x5e')]===_0xf955('0x5f')){if(_0x488fcd['value'][_0xf955('0x2c')]('\x20')[_0xf955('0x38')]>0x1){_0x1c6d76[_0x3151b4](_0xf955('0x60'),qs[_0xf955('0x61')](_0x488fcd[_0xf955('0x59')]),null);}else{var _0x4dc34b='%'+_0x488fcd[_0xf955('0x59')]+'%';_0x1c6d76[_0x3151b4](_0xf955('0x62'),_0x4dc34b,_0x4dc34b,_0x4dc34b);}}else{_0x3c37e2=_[_0xf955('0x57')](_0x5acb00,[_0xf955('0x26'),_0xf955('0x63')]);_0x488fcd[_0xf955('0x41')]=_0xf955('0x63');_0x36364d=as[_0xf955('0x64')](_0x5c427c,_0x3c37e2[_0xf955('0x65')],_0x488fcd);_0x1c6d76[_0x3151b4](_0x36364d[_0xf955('0x66')],_0x36364d['value'][_0xf955('0x67')],_0x36364d[_0xf955('0x59')][_0xf955('0x1c')]);}break;case _0xf955('0x68'):var _0x116458=_0x488fcd[_0xf955('0x59')][_0xf955('0x2c')](',')[_0xf955('0x28')](function(_0x948963){return Number(_0x948963);});_0x116458[_0xf955('0x2d')](function(_0x40efb1){_0x4f5a95['or'](_0xf955('0x69'),'%,'+_0x40efb1+',%');});_0x2c992c=_['union'](_0x2c992c,_0x116458);break;case _0xf955('0x6a'):if(_0x488fcd[_0xf955('0x5e')]===_0xf955('0x5f')){_0x1c6d76[_0x3151b4](_0xf955('0x6b'),'%'+_0x488fcd[_0xf955('0x59')]+'%',null);}else{_0x3c37e2=_[_0xf955('0x57')](_0x5acb00,[_0xf955('0x26'),'UserId']);_0x488fcd['field']='UserId';_0x36364d=as[_0xf955('0x64')](_0x5c427c,_0x3c37e2['type'],_0x488fcd);_0x1c6d76[_0x3151b4](_0x36364d['text'],_0x36364d[_0xf955('0x59')]['start'],_0x36364d[_0xf955('0x59')][_0xf955('0x1c')]);}break;case _0xf955('0x6c'):_0x36364d=as[_0xf955('0x64')]('me',null,_0x488fcd);_0x1c6d76[_0x3151b4](_0x36364d['text'],_0x36364d[_0xf955('0x59')][_0xf955('0x67')],_0x36364d[_0xf955('0x59')][_0xf955('0x1c')]);break;}}else{var _0x36364d=as['buildExpression'](_0x5c427c,_0x3c37e2[_0xf955('0x65')],_0x488fcd);_0x1c6d76[_0x3151b4](_0x36364d['text'],_0x36364d[_0xf955('0x59')][_0xf955('0x67')],_0x36364d[_0xf955('0x59')]['end']);}}}else{var _0x39aaed=_(_0x3783dc[_0xf955('0x32')])[_0xf955('0x33')]()[_0xf955('0x28')](function(_0x331bbf){return _[_0xf955('0x6d')](_0x5acb00,[_0xf955('0x26'),_0x331bbf])?_0x331bbf:undefined;})['compact']()['value']();if(!_[_0xf955('0x6e')](_0x39aaed)){_0x39aaed[_0xf955('0x2d')](function(_0x3390f3){if(_0x3390f3===_0xf955('0x6f')){_0x1bd760[_0xf955('0x3e')](_0xf955('0x70'),[][_0xf955('0x71')](_0x3783dc[_0xf955('0x32')][_0x3390f3]));}else if(_0x3390f3===_0xf955('0x72')){var _0x2d20af=JSON[_0xf955('0x73')](_0x3783dc['query'][_0x3390f3])[_0xf955('0x74')];var _0x4916c3=JSON[_0xf955('0x73')](_0x3783dc['query'][_0x3390f3])['$lte'];_0x1bd760[_0xf955('0x3e')](_0xf955('0x75'),_0x2d20af,_0x4916c3);}else{if(_0x3783dc['query'][_0x3390f3]===_0xf955('0x76')){_0x1bd760[_0xf955('0x3e')]('i.'+_0x3390f3+'\x20IS\x20NULL');}else{_0x1bd760['where']('i.'+_0x3390f3+_0xf955('0x77'),_0x3783dc[_0xf955('0x32')][_0x3390f3]);}}});}if(_0x3783dc[_0xf955('0x32')]['read']){if(_0x3783dc[_0xf955('0x32')][_0xf955('0x78')]==0x1){_0x1bd760[_0xf955('0x5a')](_0xf955('0x79'));}else{_0x1bd760[_0xf955('0x5a')](_0xf955('0x7a'));}}if(_0x3783dc[_0xf955('0x32')][_0xf955('0x7b')]){_0x2c992c=_['isArray'](_0x3783dc[_0xf955('0x32')][_0xf955('0x7b')])?_0x3783dc['query'][_0xf955('0x7b')]:new Array(_0x3783dc[_0xf955('0x32')][_0xf955('0x7b')]);_0x2c992c[_0xf955('0x2d')](function(_0x4e0e3f){_0x4f5a95['or'](_0xf955('0x69'),'%,'+_0x4e0e3f+',%');});}if(_0x3783dc[_0xf955('0x32')]['filter']){var _0x4e0c1c=_0x3783dc[_0xf955('0x32')][_0xf955('0x7c')][_0xf955('0x7d')]('\x5c','\x5c\x5c')[_0xf955('0x7d')]('\x27\x27','\x27\x27\x27\x27');if(qs[_0xf955('0x7e')](_0x4e0c1c)){_0x1c6d76['or'](_0xf955('0x7f'),_0x4e0c1c+'%')['or'](_0xf955('0x80'),_0x4e0c1c+'%');}else{_0x1c6d76['or'](_0xf955('0x81'),qs[_0xf955('0x61')](_0x4e0c1c))['or'](_0xf955('0x82'),_0x4e0c1c+'%');}}}_0x1bd760[_0xf955('0x3e')](_0x1c6d76);_0x1bd760[_0xf955('0x83')](_0xf955('0x84'));var _0x12d8d1={'type':db[_0xf955('0x85')][_0xf955('0x86')][_0xf955('0x87')],'raw':!![]};var _0x5c92ed=_0x1bd760[_0xf955('0x88')]();_0x5c92ed[_0xf955('0x41')](_0xf955('0x84'));_0x5c92ed[_0xf955('0x41')]('SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)',_0xf955('0x58'));if(_0x6d564c[_0xf955('0x3c')]){_0x6d564c[_0xf955('0x3c')][_0xf955('0x2d')](function(_0x2b266d){_0x1bd760[_0xf955('0x3c')]('i.'+_0x2b266d[0x0],_0x2b266d[0x1]===_0xf955('0x89')?![]:!![]);});}if(!_[_0xf955('0x6e')](_0x2c992c)){_0x1bd760[_0xf955('0x5a')](_0x4f5a95);_0x5c92ed[_0xf955('0x3e')](_0xf955('0x8a'),_0x2c992c);}BPromise['resolve']()[_0xf955('0x24')](function(){if(!_0x4e7269){if(_0x3783dc[_0xf955('0x32')][_0xf955('0x6f')]||_0x3783dc[_0xf955('0x32')][_0xf955('0x8b')])return;_0x5c92ed[_0xf955('0x3e')](_0xf955('0x8c'));_0x1bd760['where'](_0xf955('0x8c'));return;}return _0x3783dc['user'][_0xf955('0x8d')]({'attributes':['id'],'raw':!![]})['then'](function(_0x1a61d9){if(_[_0xf955('0x6e')](_0x1a61d9)){_0x5c92ed[_0xf955('0x3e')](_0xf955('0x8e'));_0x1bd760[_0xf955('0x3e')](_0xf955('0x8e'));}else{_0x5c92ed['where'](_0xf955('0x70'),_[_0xf955('0x28')](_0x1a61d9,'id'));_0x1bd760[_0xf955('0x3e')]('i.SmsAccountId\x20IN\x20?',_['map'](_0x1a61d9,'id'));}});})[_0xf955('0x24')](function(){db[_0xf955('0x8f')][_0xf955('0x32')](_0x5c92ed['toString'](),_0x12d8d1)[_0xf955('0x24')](function(_0x4b3369){_0x39de9c[_0xf955('0x90')]=_0x4b3369['length'];if(_0x39de9c[_0xf955('0x90')]===0x0)return[];return db[_0xf955('0x8f')][_0xf955('0x32')](_0x356ec2['toString'](),_0x12d8d1)[_0xf955('0x24')](function(_0x397f7e){_0x248f60=_[_0xf955('0x91')](_0x397f7e,'id');_0x12d8d1=_['merge'](_0x12d8d1,{'model':db[_0xf955('0x92')],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x3783dc[_0xf955('0x32')][_0xf955('0x37')]){_0x6d564c[_0xf955('0x36')][_0xf955('0x2d')](function(_0x130e1a){_0x1bd760[_0xf955('0x41')]('i.'+_0x130e1a);});}else{_0x1bd760['field'](_0xf955('0x93'),_0xf955('0x58'));_0x1bd760[_0xf955('0x41')](_0xf955('0x94'),_0xf955('0x95'));_0x1bd760['field'](_0xf955('0x96'),_0xf955('0x97'));_0x1bd760['field']('i.*');_0x1bd760[_0xf955('0x41')](_0xf955('0x98'),_0xf955('0x99'));_0x1bd760[_0xf955('0x41')]('c.lastName',_0xf955('0x9a'));_0x1bd760['field']('c.email',_0xf955('0x9b'));_0x1bd760[_0xf955('0x41')]('c.phone','Contact.phone');_0x1bd760[_0xf955('0x41')](_0xf955('0x9c'),_0xf955('0x9d'));_0x1bd760['field']('c.fax',_0xf955('0x9e'));_0x1bd760[_0xf955('0x41')](_0xf955('0x9f'),'Owner.fullname');_0x1bd760['field']('o.internal','Owner.internal');_0x1bd760[_0xf955('0x41')]('GROUP_CONCAT(DISTINCT\x20t.id)',_0xf955('0x2a'));}_0x1bd760[_0xf955('0x1f')](_0x6d564c[_0xf955('0x1f')]);_0x1bd760[_0xf955('0x1e')](_0x6d564c[_0xf955('0x1e')]);return db['sequelize'][_0xf955('0x32')](_0x1bd760[_0xf955('0xa0')](),_0x12d8d1);})[_0xf955('0x24')](function(_0x39b7b4){_0x485e77['where'](_0xf955('0xa1'),_[_0xf955('0x28')](_0x39b7b4,'id'));return db['sequelize'][_0xf955('0x32')](_0x485e77[_0xf955('0xa0')](),_0x12d8d1)[_0xf955('0x24')](function(_0x25d7d6){var _0x835b08=_[_0xf955('0xa2')](_0x25d7d6,'SmsInteractionId');var _0x555ca6=[];_0x39b7b4[_0xf955('0x2d')](function(_0x545275){_0x555ca6[_0xf955('0xa3')](updateSmsInteraction(_0x545275,_0x248f60,_0x835b08));});return BPromise[_0xf955('0xa4')](_0x555ca6);});});})[_0xf955('0x24')](function(_0x95cc72){_0x39de9c['rows']=_0x95cc72;return _0x39de9c;})['then'](respondWithFilteredResult(_0x374e95,_0x6d564c));})[_0xf955('0xa5')](handleError(_0x374e95,null));};exports[_0xf955('0xa6')]=function(_0x20a220,_0x25319c){var _0xee52ad={'raw':![],'where':{'id':_0x20a220[_0xf955('0xa7')]['id']}},_0x4b2c01={};_0x4b2c01[_0xf955('0x39')]=_[_0xf955('0x33')](db[_0xf955('0x92')]['rawAttributes']);_0x4b2c01['query']=_[_0xf955('0x33')](_0x20a220[_0xf955('0x32')]);_0x4b2c01['filters']=_[_0xf955('0x35')](_0x4b2c01[_0xf955('0x39')],_0x4b2c01[_0xf955('0x32')]);_0xee52ad[_0xf955('0x36')]=_['intersection'](_0x4b2c01[_0xf955('0x39')],qs[_0xf955('0x37')](_0x20a220[_0xf955('0x32')][_0xf955('0x37')]));_0xee52ad[_0xf955('0x36')]=_0xee52ad[_0xf955('0x36')][_0xf955('0x38')]?_0xee52ad['attributes']:_0x4b2c01['model'];if(_0x20a220['query'][_0xf955('0xa8')]){_0xee52ad[_0xf955('0xa9')]=[{'all':!![]}];}_0xee52ad=_[_0xf955('0xaa')]({},_0xee52ad,_0x20a220[_0xf955('0xab')]);return db[_0xf955('0x92')][_0xf955('0x57')](_0xee52ad)[_0xf955('0x24')](handleEntityNotFound(_0x25319c,null))['then'](respondWithResult(_0x25319c,null))[_0xf955('0xa5')](handleError(_0x25319c,null));};exports[_0xf955('0xac')]=function(_0x56eb0c,_0x27461c){return db[_0xf955('0x92')][_0xf955('0xac')](_0x56eb0c[_0xf955('0x6c')],{})[_0xf955('0x24')](respondWithResult(_0x27461c,0xc9))[_0xf955('0xa5')](handleError(_0x27461c,null));};exports[_0xf955('0x22')]=function(_0x288978,_0x4dfed4){if(_0x288978['body']['id']){delete _0x288978['body']['id'];}return db[_0xf955('0x92')][_0xf955('0x57')]({'where':{'id':_0x288978[_0xf955('0xa7')]['id']}})[_0xf955('0x24')](handleEntityNotFound(_0x4dfed4,null))[_0xf955('0x24')](saveUpdates(_0x288978['body'],null))[_0xf955('0x24')](respondWithResult(_0x4dfed4,null))[_0xf955('0xa5')](handleError(_0x4dfed4,null));};exports[_0xf955('0x23')]=function(_0x1e7024,_0x43e078){return db[_0xf955('0x92')][_0xf955('0x57')]({'where':{'id':_0x1e7024[_0xf955('0xa7')]['id']}})[_0xf955('0x24')](handleEntityNotFound(_0x43e078,null))['then'](removeEntity(_0x43e078,null))[_0xf955('0xa5')](handleError(_0x43e078,null));};exports['describe']=function(_0x33a37e,_0x45cd55){return db[_0xf955('0x92')][_0xf955('0xad')]()[_0xf955('0x24')](respondWithResult(_0x45cd55,null))[_0xf955('0xa5')](handleError(_0x45cd55,null));};exports[_0xf955('0xae')]=function(_0x4b8cde,_0x1ef189,_0x4bb590){return db[_0xf955('0xaf')][_0xf955('0x57')]({'where':{'id':_0x4b8cde['params']['id']}})[_0xf955('0x24')](handleEntityNotFound(_0x1ef189,null))[_0xf955('0x24')](function(_0x1d3aa1){if(_0x1d3aa1){return _0x1d3aa1[_0xf955('0xae')](_0x4b8cde[_0xf955('0x6c')][_0xf955('0xb0')],_[_0xf955('0xb1')](_0x4b8cde['body'],[_0xf955('0xb0'),'id'])||{});}})[_0xf955('0x24')](respondWithResult(_0x1ef189,null))['catch'](handleError(_0x1ef189,null));};exports[_0xf955('0xb2')]=function(_0x3fd8ed,_0x4bbba6,_0x47d89d){var _0x356eb0={'raw':![],'where':{}};var _0x314173={};var _0x8b45aa={'count':0x0,'rows':[]};return db['SmsInteraction'][_0xf955('0xb3')]({'where':{'id':_0x3fd8ed[_0xf955('0xa7')]['id']}})[_0xf955('0x24')](handleEntityNotFound(_0x4bbba6,null))[_0xf955('0x24')](function(_0x399ffb){if(_0x399ffb){_0x314173[_0xf955('0x39')]=_[_0xf955('0x33')](db[_0xf955('0xaf')][_0xf955('0x2f')]);_0x314173[_0xf955('0x32')]=_[_0xf955('0x33')](_0x3fd8ed[_0xf955('0x32')]);_0x314173[_0xf955('0x34')]=_[_0xf955('0x35')](_0x314173['model'],_0x314173['query']);_0x356eb0[_0xf955('0x36')]=_[_0xf955('0x35')](_0x314173[_0xf955('0x39')],qs[_0xf955('0x37')](_0x3fd8ed[_0xf955('0x32')]['fields']));_0x356eb0[_0xf955('0x36')]=_0x356eb0[_0xf955('0x36')]['length']?_0x356eb0[_0xf955('0x36')]:_0x314173[_0xf955('0x39')];if(!_0x3fd8ed[_0xf955('0x32')][_0xf955('0x3a')]('nolimit')){_0x356eb0[_0xf955('0x1f')]=qs['limit'](_0x3fd8ed[_0xf955('0x32')][_0xf955('0x1f')]);_0x356eb0[_0xf955('0x1e')]=qs[_0xf955('0x1e')](_0x3fd8ed['query'][_0xf955('0x1e')]);}_0x356eb0[_0xf955('0x3c')]=qs[_0xf955('0x3d')](_0x3fd8ed[_0xf955('0x32')][_0xf955('0x3d')]);_0x356eb0['where']=qs[_0xf955('0x34')](_[_0xf955('0x3f')](_0x3fd8ed[_0xf955('0x32')],_0x314173['filters']));_0x356eb0[_0xf955('0x3e')][_0xf955('0xb4')]=_0x399ffb['id'];if(_0x3fd8ed[_0xf955('0x32')][_0xf955('0x7c')]){_0x356eb0[_0xf955('0x3e')]=_[_0xf955('0xaa')](_0x356eb0[_0xf955('0x3e')],{'$or':_['map'](_0x356eb0['attributes'],function(_0x4e3013){var _0x345a7c={};_0x345a7c[_0x4e3013]={'$like':'%'+_0x3fd8ed[_0xf955('0x32')]['filter']+'%'};return _0x345a7c;})});}if(_0x3fd8ed[_0xf955('0x32')][_0xf955('0x74')]){var _0x2344cd=_0x3fd8ed['query'][_0xf955('0x74')][_0xf955('0x2c')](',');var _0x575405={};_0x575405[_0x2344cd[0x0]]={'$gte':moment(_0x2344cd[0x1])['format'](_0xf955('0xb5'))};_0x356eb0[_0xf955('0x3e')]=_[_0xf955('0xaa')](_0x356eb0[_0xf955('0x3e')],_0x575405);}_0x356eb0=_[_0xf955('0xaa')]({},_0x356eb0,_0x3fd8ed['options']);return db[_0xf955('0xaf')][_0xf955('0x90')]({'where':_0x356eb0[_0xf955('0x3e')]})[_0xf955('0x24')](function(_0x349576){_0x8b45aa['count']=_0x349576;if(_0x3fd8ed[_0xf955('0x32')][_0xf955('0xa8')]){_0x356eb0[_0xf955('0xa9')]=[{'all':!![]}];}return db[_0xf955('0xaf')]['findAll'](_0x356eb0);})[_0xf955('0x24')](function(_0x410d1f){_0x8b45aa[_0xf955('0xb6')]=_0x410d1f;return _0x8b45aa;});}})[_0xf955('0x24')](respondWithFilteredResult(_0x4bbba6,_0x356eb0))[_0xf955('0xa5')](handleError(_0x4bbba6,null));};exports['addTags']=function(_0x702587,_0xbbee29,_0x5eed70){return db[_0xf955('0x92')][_0xf955('0x57')]({'where':{'id':_0x702587[_0xf955('0xa7')]['id']}})[_0xf955('0x24')](handleEntityNotFound(_0xbbee29,null))[_0xf955('0x24')](function(_0x38e031){if(_0x38e031){return _0x38e031[_0xf955('0xb7')](_0x702587[_0xf955('0x6c')][_0xf955('0xb0')],_[_0xf955('0xb1')](_0x702587['body'],['ids','id'])||{})[_0xf955('0xb8')](function(){return db[_0xf955('0x68')][_0xf955('0xb9')]({'attributes':['id',_0xf955('0x26'),'color'],'where':{'id':_0x702587[_0xf955('0x6c')][_0xf955('0xb0')]}});})['then'](function(_0x54903a){socket[_0xf955('0xba')](_0xf955('0xbb'),{'id':Number(_0x702587[_0xf955('0xa7')]['id']),'tags':_0x54903a||[]});return{'id':Number(_0x702587[_0xf955('0xa7')]['id']),'tags':_0x54903a||[]};});}})['then'](respondWithResult(_0xbbee29,null))[_0xf955('0xa5')](handleError(_0xbbee29,null));};exports[_0xf955('0xbc')]=function(_0xf213a2,_0x415839,_0x33d41c){return db[_0xf955('0x92')][_0xf955('0x57')]({'where':{'id':_0xf213a2[_0xf955('0xa7')]['id']}})['then'](handleEntityNotFound(_0x415839,null))[_0xf955('0x24')](function(_0x18431e){if(_0x18431e){return _0x18431e[_0xf955('0xbc')](_0xf213a2[_0xf955('0x32')][_0xf955('0xb0')]);}})[_0xf955('0x24')](respondWithStatusCode(_0x415839,null))[_0xf955('0xa5')](handleError(_0x415839,null));};exports[_0xf955('0xbd')]=function(_0x1f17fb,_0x1567a8){var _0x552b9f=moment()[_0xf955('0xbe')]()[_0xf955('0xa0')]();var _0x31f7a4=path[_0xf955('0xbf')](config[_0xf955('0xc0')],_0xf955('0xc1'),_0xf955('0xc2'),'tmp');var _0x73dce3=path['join'](config[_0xf955('0xc0')],_0xf955('0xc1'),_0xf955('0xc2'),_0xf955('0xc3'));var _0x2a392e=path[_0xf955('0xbf')](_0x31f7a4,_0x552b9f);var _0x69fb2b=util[_0xf955('0xc4')](_0xf955('0xc5'),_0x1f17fb['params']['id'],_0x552b9f);var _0x1fc665=path[_0xf955('0xbf')](_0x31f7a4,_0x69fb2b);var _0x1182cd=[];_0x1182cd[_0xf955('0xa3')]({'model':db[_0xf955('0x6a')],'as':_0xf955('0x6a'),'attributes':['id','fullname'],'raw':!![]});_0x1182cd[_0xf955('0xa3')]({'model':db[_0xf955('0xc6')],'as':_0xf955('0x5d'),'attributes':['id','firstName',_0xf955('0xc7')],'raw':!![]});var _0x471223=[{'model':db[_0xf955('0xaf')],'as':_0xf955('0xc8'),'attributes':['id',_0xf955('0x6c'),_0xf955('0x72'),'direction',_0xf955('0xc9'),_0xf955('0x78')],'include':_0x1182cd}];_0x471223[_0xf955('0xa3')]({'model':db[_0xf955('0xca')],'as':_0xf955('0xcb'),'attributes':['id',_0xf955('0x26')]});_0x471223['push']({'model':db[_0xf955('0x6a')],'as':'Owner','attributes':['id','fullname']});return db['SmsInteraction']['find']({'where':{'id':_0x1f17fb[_0xf955('0xa7')]['id']},'include':_0x471223})['then'](handleEntityNotFound(_0x1567a8,null))[_0xf955('0x24')](function(_0x3cac67){if(_0x3cac67){var _0x5cb8bb=_0x3cac67[_0xf955('0xcc')]({'plain':!![]});fs['mkdirSync'](_0x2a392e);var _0x71d8fb={'format':'A4','border':'10px','header':{'height':_0xf955('0xcd'),'contents':{'first':_0xf955('0xce')}},'footer':{'height':_0xf955('0xcf'),'contents':{'default':util[_0xf955('0xc4')]('\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20%s\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20{{page}}/{{pages}}\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20%s\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',util[_0xf955('0xc4')]('%s\x20#%d',_0xf955('0xd0'),_0x5cb8bb['id']),moment()[_0xf955('0xc4')](_0xf955('0xd1'))[_0xf955('0xa0')]())}}};var _0x42f4f6={'channel':_0xf955('0xd0'),'account':_0x5cb8bb[_0xf955('0xcb')][_0xf955('0x26')],'agent':_0x5cb8bb[_0xf955('0xd2')]?_0x5cb8bb[_0xf955('0xd2')]['fullname']:_0xf955('0xd3'),'createdAt':moment(_0x5cb8bb[_0xf955('0x72')])[_0xf955('0xc4')](_0xf955('0xb5'))[_0xf955('0xa0')](),'closedAt':_0x5cb8bb[_0xf955('0xd4')]?moment(_0x5cb8bb[_0xf955('0xd5')])['format'](_0xf955('0xb5'))[_0xf955('0xa0')]():'','disposition':_0x5cb8bb[_0xf955('0xd6')],'messages':_(_0x5cb8bb[_0xf955('0xc8')])[_0xf955('0x7c')]({'secret':![]})[_0xf955('0x28')](function(_0x392191){return{'date':moment(_0x392191[_0xf955('0x72')])[_0xf955('0xc4')](_0xf955('0xb5'))['toString'](),'sender':_0x392191[_0xf955('0xd7')]===_0xf955('0xd8')?_0x392191[_0xf955('0x6a')]?_0x392191[_0xf955('0x6a')][_0xf955('0x29')]:_0xf955('0xd9'):_0x392191[_0xf955('0x5d')][_0xf955('0xda')]+(_0x392191['Contact'][_0xf955('0xc7')]?'\x20'+_0x392191[_0xf955('0x5d')][_0xf955('0xc7')]:''),'body':_0x392191[_0xf955('0x6c')],'direction':_0x392191[_0xf955('0xd7')]===_0xf955('0xd8')?'A':'C','secret':_0x392191[_0xf955('0xc9')],'read':_0x392191[_0xf955('0x78')]};})['value']()};return ejs['renderFile'](path[_0xf955('0xbf')](config[_0xf955('0xc0')],_0xf955('0xc1'),_0xf955('0xdb'),'downloadInteraction.html'),{'interaction':_0x42f4f6})['then'](function(_0xb01fc1){return new BPromise(function(_0x26bf99,_0x4860ad){pdf[_0xf955('0xac')](_0xb01fc1,_0x71d8fb)[_0xf955('0xdc')](path[_0xf955('0xbf')](_0x2a392e,_0xf955('0xdd')+_0x5cb8bb['id']+'-'+_0x552b9f+_0xf955('0xde')),function(_0x53cb66,_0x10386c){if(_0x53cb66)return _0x4860ad(_0x53cb66);_0x26bf99(_0x10386c);});});})[_0xf955('0x24')](function(){return new BPromise(function(_0x3a3826,_0x106640){zipdir(_0x2a392e,{'saveTo':_0x1fc665},function(_0x101722,_0x479dc0){if(_0x101722)return _0x106640(_0x101722);return _0x3a3826(_0x479dc0);});})[_0xf955('0x24')](function(){return new BPromise(function(_0x4bc358,_0x285626){rimraf(_0x2a392e,function(_0x570005){if(_0x570005)_0x285626(_0x570005);return _0x4bc358();});});})[_0xf955('0x24')](function(){return _0x1567a8[_0xf955('0xbd')](_0x1fc665,_0x69fb2b,function(_0x227629){if(_0x227629){console[_0xf955('0xdf')](_0xf955('0xe0'),_0x227629);}else{fs[_0xf955('0xe1')](_0x1fc665);}});});});}else{return _0x1567a8[_0xf955('0x1a')](0xc8);}})[_0xf955('0xa5')](handleError(_0x1567a8,null));}; \ No newline at end of file +var _0xfcf0=['QueryTypes','clone','SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','order','DESC','t.id\x20IN\x20?','i.SmsAccountId\x20IS\x20NOT\x20NULL','i.SmsAccountId\x20IS\x20NULL','sequelize','toString','count','keyBy','SmsInteraction','a.key','Account.key','a.mandatoryDisposition','Account.mandatoryDisposition','i.*','c.firstName','c.lastName','Contact.email','c.mobile','c.fax','Contact.fax','o.fullname','Owner.fullname','o.internal','GROUP_CONCAT(DISTINCT\x20t.id)','ui.SmsInteractionId\x20IN\x20?','groupBy','SmsInteractionId','all','show','params','include','merge','options','create','describe','addMessage','ids','omit','getMessages','SmsMessage','pick','format','findAll','rows','addTags','spread','color','emit','smsInteractionTags:save','download','unix','join','root','server','files','tmp','attachments','User','CmContact','firstName','lastName','Messages','direction','secret','SmsAccount','Account','Owner','get','40px','30px','\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20%s\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20{{page}}/{{pages}}\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20%s\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','%s\x20#%d','Sms','YYYY-MM-DD','N.A.','YYYY-MM-DD\x20HH:mm:ss','closedAt','out','System','downloadInteraction.html','toFile','transcript-','.pdf','err','html-pdf','eml-format','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','sox','to-csv','ejs','lodash','squel','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','redis','defaults','localhost','socket.io-emitter','./smsInteraction.socket','register','sendStatus','end','json','offset','status','Content-Range','apply','save','update','then','destroy','error','stack','name','send','map','fullname','TagIds','Tags','forEach','push','catch','index','rawAttributes','fieldName','model','keys','query','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','limit','sort','where','select','field','from','u.id','u.fullname','ui.SmsInteractionId','user_has_sms_interactions','left_join','u.id\x20=\x20ui.UserId','cm_contacts','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL','sms_accounts','a.id\x20=\x20i.SmsAccountId','sms_messages','me.SmsInteractionId\x20=\x20i.id','sms_interaction_has_tags','tools_tags','t.id\x20=\x20it.TagId','expr','parseSearch','search','conditions','find','unreadMessages','value','having','`\x20=\x200','`\x20>\x200','Contact','operator','$substring','split','MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','getFullTextValue','ContactId','text','start','CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','union','CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?','UserId','buildExpression','type','body','some','compact','isEmpty','SmsAccountId','i.SmsAccountId\x20IN\x20?','concat','createdAt','parse','$gte','$lte','i.createdAt\x20BETWEEN\x20?\x20AND\x20?','null','\x20IS\x20NULL','read','`unreadMessages`\x20=\x200','tag','filter','replace','\x27\x27\x27\x27','i.phone\x20LIKE\x20?','MATCH\x20(me.body)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','CONCAT(c.firstName,\x20\x27\x20\x27,\x20c.lastName)\x20LIKE\x20?','group','i.id','Sequelize'];(function(_0x16bbf8,_0x5460fb){var _0x371cd8=function(_0x77b50e){while(--_0x77b50e){_0x16bbf8['push'](_0x16bbf8['shift']());}};_0x371cd8(++_0x5460fb);}(_0xfcf0,0x138));var _0x0fcf=function(_0x44039a,_0x2ac8a8){_0x44039a=_0x44039a-0x0;var _0x525de5=_0xfcf0[_0x44039a];return _0x525de5;};'use strict';var pdf=require(_0x0fcf('0x0'));var emlformat=require(_0x0fcf('0x1'));var rimraf=require('rimraf');var zipdir=require(_0x0fcf('0x2'));var jsonpatch=require(_0x0fcf('0x3'));var rp=require(_0x0fcf('0x4'));var moment=require(_0x0fcf('0x5'));var BPromise=require('bluebird');var Mustache=require(_0x0fcf('0x6'));var util=require(_0x0fcf('0x7'));var path=require(_0x0fcf('0x8'));var sox=require(_0x0fcf('0x9'));var csv=require(_0x0fcf('0xa'));var ejs=require(_0x0fcf('0xb'));var fs=require('fs');var _=require(_0x0fcf('0xc'));var squel=require(_0x0fcf('0xd'));var crypto=require('crypto');var jsforce=require(_0x0fcf('0xe'));var deskjs=require(_0x0fcf('0xf'));var toCsv=require(_0x0fcf('0xa'));var querystring=require('querystring');var Papa=require(_0x0fcf('0x10'));var Redis=require(_0x0fcf('0x11'));var authService=require(_0x0fcf('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0x0fcf('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x0fcf('0x14'))(_0x0fcf('0x15'));var utils=require(_0x0fcf('0x16'));var config=require('../../config/environment');var db=require('../../mysqldb')['db'];config[_0x0fcf('0x17')]=_[_0x0fcf('0x18')](config['redis'],{'host':_0x0fcf('0x19'),'port':0x18eb});var socket=require(_0x0fcf('0x1a'))(new Redis(config[_0x0fcf('0x17')]));require(_0x0fcf('0x1b'))[_0x0fcf('0x1c')](socket);function respondWithStatusCode(_0x48bba6,_0xa32692){_0xa32692=_0xa32692||0xcc;return function(_0x3701c9){if(_0x3701c9){return _0x48bba6[_0x0fcf('0x1d')](_0xa32692);}return _0x48bba6['status'](_0xa32692)[_0x0fcf('0x1e')]();};}function respondWithResult(_0x610106,_0x445207){_0x445207=_0x445207||0xc8;return function(_0x177c8f){if(_0x177c8f){return _0x610106['status'](_0x445207)[_0x0fcf('0x1f')](_0x177c8f);}};}function respondWithFilteredResult(_0x2f8289,_0x1a8477){return function(_0x8581bd){if(_0x8581bd){var _0x19cfbd=_0x8581bd['count'],_0x567320=_0x1a8477[_0x0fcf('0x20')],_0x18ea32=_0x1a8477[_0x0fcf('0x20')]+_0x1a8477['limit'],_0x1a8f58;if(_0x18ea32>=_0x19cfbd){_0x18ea32=_0x19cfbd;_0x1a8f58=0xc8;}else{_0x1a8f58=0xce;}_0x2f8289[_0x0fcf('0x21')](_0x1a8f58);return _0x2f8289['set'](_0x0fcf('0x22'),_0x567320+'-'+_0x18ea32+'/'+_0x19cfbd)[_0x0fcf('0x1f')](_0x8581bd);}return null;};}function patchUpdates(_0x5c8279){return function(_0x457880){try{jsonpatch[_0x0fcf('0x23')](_0x457880,_0x5c8279,!![]);}catch(_0x29dbdf){return BPromise['reject'](_0x29dbdf);}return _0x457880[_0x0fcf('0x24')]();};}function saveUpdates(_0x1dafc8,_0x196d30){return function(_0x41b20b){if(_0x41b20b){return _0x41b20b[_0x0fcf('0x25')](_0x1dafc8)[_0x0fcf('0x26')](function(_0x5841a9){return _0x5841a9;});}return null;};}function removeEntity(_0x2eef74,_0x253641){return function(_0x6021b4){if(_0x6021b4){return _0x6021b4[_0x0fcf('0x27')]()[_0x0fcf('0x26')](function(){_0x2eef74[_0x0fcf('0x21')](0xcc)[_0x0fcf('0x1e')]();});}};}function handleEntityNotFound(_0x18f269,_0x117510){return function(_0x588685){if(!_0x588685){_0x18f269[_0x0fcf('0x1d')](0x194);}return _0x588685;};}function handleError(_0xc107a,_0x41b7a2){_0x41b7a2=_0x41b7a2||0x1f4;return function(_0x2f198b){logger[_0x0fcf('0x28')](_0x2f198b[_0x0fcf('0x29')]);if(_0x2f198b[_0x0fcf('0x2a')]){delete _0x2f198b['name'];}_0xc107a[_0x0fcf('0x21')](_0x41b7a2)[_0x0fcf('0x2b')](_0x2f198b);};}function getInteractionUsers(_0x200517,_0x35180d){return new BPromise(function(_0x49fd0e,_0x5d9bcd){try{if(_0x35180d[_0x200517['id']]){_0x200517['Users']=_[_0x0fcf('0x2c')](_0x35180d[_0x200517['id']],function(_0x50b7df){return{'id':_0x50b7df['id'],'fullname':_0x50b7df[_0x0fcf('0x2d')]};});}}catch(_0x9ccae3){_0x5d9bcd(_0x9ccae3);}_0x49fd0e(_0x200517);});}function getInteractionTags(_0x56a416,_0xdfd3ec){return new BPromise(function(_0x117041,_0xa52f52){try{if(_0x56a416[_0x0fcf('0x2e')]){_0x56a416[_0x0fcf('0x2f')]=[];_0x56a416[_0x0fcf('0x2e')]['split'](',')[_0x0fcf('0x30')](function(_0x256e2b){_0x56a416[_0x0fcf('0x2f')][_0x0fcf('0x31')](_0xdfd3ec[_0x256e2b]);});}delete _0x56a416[_0x0fcf('0x2e')];}catch(_0x436e82){_0xa52f52(_0x436e82);}_0x117041(_0x56a416);});}function updateSmsInteraction(_0x4d3e37,_0x208433,_0xe07780){return new BPromise(function(_0x4591bf,_0x37e7c8){return getInteractionUsers(_0x4d3e37,_0xe07780)[_0x0fcf('0x26')](function(_0x477c71){return getInteractionTags(_0x477c71,_0x208433);})[_0x0fcf('0x26')](function(_0x344957){_0x4591bf(_0x344957);})[_0x0fcf('0x32')](function(_0x23562a){_0x37e7c8(_0x23562a);});});}exports[_0x0fcf('0x33')]=function(_0x38826c,_0x2aeef8){var _0x17346e={},_0x59a7aa={},_0x5eb497={'count':0x0,'rows':[]};var _0x40101a=_['map'](db['SmsInteraction'][_0x0fcf('0x34')],function(_0x254d6a){return{'name':_0x254d6a[_0x0fcf('0x35')],'type':_0x254d6a['type']['key']};});_0x59a7aa[_0x0fcf('0x36')]=_[_0x0fcf('0x2c')](_0x40101a,_0x0fcf('0x2a'));_0x59a7aa['query']=_[_0x0fcf('0x37')](_0x38826c[_0x0fcf('0x38')]);_0x59a7aa[_0x0fcf('0x39')]=_['intersection'](_0x59a7aa['model'],_0x59a7aa['query']);_0x17346e[_0x0fcf('0x3a')]=_[_0x0fcf('0x3b')](_0x59a7aa[_0x0fcf('0x36')],qs[_0x0fcf('0x3c')](_0x38826c[_0x0fcf('0x38')]['fields']));_0x17346e[_0x0fcf('0x3a')]=_0x17346e[_0x0fcf('0x3a')][_0x0fcf('0x3d')]?_0x17346e['attributes']:_0x59a7aa['model'];if(!_0x38826c[_0x0fcf('0x38')][_0x0fcf('0x3e')](_0x0fcf('0x3f'))){_0x17346e[_0x0fcf('0x40')]=qs[_0x0fcf('0x40')](_0x38826c['query'][_0x0fcf('0x40')]);_0x17346e[_0x0fcf('0x20')]=qs[_0x0fcf('0x20')](_0x38826c[_0x0fcf('0x38')]['offset']);}_0x17346e['order']=qs[_0x0fcf('0x41')](_0x38826c[_0x0fcf('0x38')]['sort']);_0x17346e[_0x0fcf('0x42')]=qs[_0x0fcf('0x39')](_['pick'](_0x38826c[_0x0fcf('0x38')],_0x59a7aa[_0x0fcf('0x39')]));var _0x44eb03=[];var _0x1f322b=squel[_0x0fcf('0x43')]()['field']('id')[_0x0fcf('0x44')](_0x0fcf('0x2a'))['field']('color')[_0x0fcf('0x45')]('tools_tags');var _0x522148=squel[_0x0fcf('0x43')]()[_0x0fcf('0x44')](_0x0fcf('0x46'))[_0x0fcf('0x44')](_0x0fcf('0x47'))[_0x0fcf('0x44')](_0x0fcf('0x48'))[_0x0fcf('0x45')](_0x0fcf('0x49'),'ui')[_0x0fcf('0x4a')]('users','u',_0x0fcf('0x4b'));var _0x227dd5=squel[_0x0fcf('0x43')]()['from']('sms_interactions','i')[_0x0fcf('0x4a')](_0x0fcf('0x4c'),'c',_0x0fcf('0x4d'))[_0x0fcf('0x4a')]('users','o','o.id\x20=\x20i.UserId')[_0x0fcf('0x4a')](_0x0fcf('0x4e'),'a',_0x0fcf('0x4f'))[_0x0fcf('0x4a')](_0x0fcf('0x50'),'me',_0x0fcf('0x51'))[_0x0fcf('0x4a')](_0x0fcf('0x52'),'it','it.SmsInteractionId\x20=\x20i.id')['left_join'](_0x0fcf('0x53'),'t',_0x0fcf('0x54'));var _0x28d2f4=squel[_0x0fcf('0x55')]();var _0x5f1791=[];var _0x381a7f=squel['expr']();var _0x2b6ad3;if(_0x38826c[_0x0fcf('0x38')]['search']){_0x2b6ad3=as[_0x0fcf('0x56')](_0x38826c[_0x0fcf('0x38')][_0x0fcf('0x57')]);var _0x27e339=_0x2b6ad3['sqlOperator'];for(var _0xc514bf=0x0;_0xc514bf<_0x2b6ad3[_0x0fcf('0x58')][_0x0fcf('0x3d')];_0xc514bf++){var _0x1b5ae4=_0x2b6ad3[_0x0fcf('0x58')][_0xc514bf];var _0x34473f='i';var _0x171219=_[_0x0fcf('0x59')](_0x40101a,[_0x0fcf('0x2a'),_0x1b5ae4[_0x0fcf('0x44')]]);if(!_0x171219){switch(_0x1b5ae4[_0x0fcf('0x44')]){case _0x0fcf('0x5a'):if(_0x1b5ae4[_0x0fcf('0x5b')]==0x1){_0x227dd5[_0x0fcf('0x5c')]('`'+_0x1b5ae4['field']+_0x0fcf('0x5d'));}else{_0x227dd5['having']('`'+_0x1b5ae4[_0x0fcf('0x44')]+_0x0fcf('0x5e'));}break;case _0x0fcf('0x5f'):if(_0x1b5ae4[_0x0fcf('0x60')]===_0x0fcf('0x61')){if(_0x1b5ae4['value'][_0x0fcf('0x62')]('\x20')['length']>0x1){_0x28d2f4[_0x27e339](_0x0fcf('0x63'),qs[_0x0fcf('0x64')](_0x1b5ae4['value']),null);}else{var _0x25c8ad='%'+_0x1b5ae4[_0x0fcf('0x5b')]+'%';_0x28d2f4[_0x27e339]('c.firstName\x20LIKE\x20?\x20OR\x20c.lastName\x20LIKE\x20?\x20OR\x20c.email\x20LIKE\x20?',_0x25c8ad,_0x25c8ad,_0x25c8ad);}}else{_0x171219=_[_0x0fcf('0x59')](_0x40101a,[_0x0fcf('0x2a'),_0x0fcf('0x65')]);_0x1b5ae4[_0x0fcf('0x44')]=_0x0fcf('0x65');_0x58607c=as['buildExpression'](_0x34473f,_0x171219['type'],_0x1b5ae4);_0x28d2f4[_0x27e339](_0x58607c[_0x0fcf('0x66')],_0x58607c['value'][_0x0fcf('0x67')],_0x58607c[_0x0fcf('0x5b')]['end']);}break;case'Tag':var _0x251ef3=_0x1b5ae4[_0x0fcf('0x5b')][_0x0fcf('0x62')](',')['map'](function(_0xbb8286){return Number(_0xbb8286);});_0x251ef3['forEach'](function(_0x2ed8d8){_0x381a7f['or'](_0x0fcf('0x68'),'%,'+_0x2ed8d8+',%');});_0x5f1791=_[_0x0fcf('0x69')](_0x5f1791,_0x251ef3);break;case'User':if(_0x1b5ae4[_0x0fcf('0x60')]===_0x0fcf('0x61')){_0x28d2f4[_0x27e339](_0x0fcf('0x6a'),'%'+_0x1b5ae4[_0x0fcf('0x5b')]+'%',null);}else{_0x171219=_[_0x0fcf('0x59')](_0x40101a,[_0x0fcf('0x2a'),_0x0fcf('0x6b')]);_0x1b5ae4[_0x0fcf('0x44')]=_0x0fcf('0x6b');_0x58607c=as[_0x0fcf('0x6c')](_0x34473f,_0x171219[_0x0fcf('0x6d')],_0x1b5ae4);_0x28d2f4[_0x27e339](_0x58607c['text'],_0x58607c[_0x0fcf('0x5b')][_0x0fcf('0x67')],_0x58607c[_0x0fcf('0x5b')][_0x0fcf('0x1e')]);}break;case _0x0fcf('0x6e'):_0x58607c=as[_0x0fcf('0x6c')]('me',null,_0x1b5ae4);_0x28d2f4[_0x27e339](_0x58607c[_0x0fcf('0x66')],_0x58607c['value']['start'],_0x58607c[_0x0fcf('0x5b')][_0x0fcf('0x1e')]);break;}}else{var _0x58607c=as[_0x0fcf('0x6c')](_0x34473f,_0x171219[_0x0fcf('0x6d')],_0x1b5ae4);_0x28d2f4[_0x27e339](_0x58607c[_0x0fcf('0x66')],_0x58607c[_0x0fcf('0x5b')]['start'],_0x58607c[_0x0fcf('0x5b')][_0x0fcf('0x1e')]);}}}else{var _0x6eaf86=_(_0x38826c[_0x0fcf('0x38')])[_0x0fcf('0x37')]()[_0x0fcf('0x2c')](function(_0x51d662){return _[_0x0fcf('0x6f')](_0x40101a,[_0x0fcf('0x2a'),_0x51d662])?_0x51d662:undefined;})[_0x0fcf('0x70')]()[_0x0fcf('0x5b')]();if(!_[_0x0fcf('0x71')](_0x6eaf86)){_0x6eaf86['forEach'](function(_0x4f1bc5){if(_0x4f1bc5===_0x0fcf('0x72')){_0x227dd5[_0x0fcf('0x42')](_0x0fcf('0x73'),[][_0x0fcf('0x74')](_0x38826c[_0x0fcf('0x38')][_0x4f1bc5]));}else if(_0x4f1bc5===_0x0fcf('0x75')){var _0x2b6d8a=JSON[_0x0fcf('0x76')](_0x38826c[_0x0fcf('0x38')][_0x4f1bc5])[_0x0fcf('0x77')];var _0x5d54f0=JSON[_0x0fcf('0x76')](_0x38826c[_0x0fcf('0x38')][_0x4f1bc5])[_0x0fcf('0x78')];_0x227dd5[_0x0fcf('0x42')](_0x0fcf('0x79'),_0x2b6d8a,_0x5d54f0);}else{if(_0x38826c[_0x0fcf('0x38')][_0x4f1bc5]===_0x0fcf('0x7a')){_0x227dd5[_0x0fcf('0x42')]('i.'+_0x4f1bc5+_0x0fcf('0x7b'));}else{_0x227dd5['where']('i.'+_0x4f1bc5+'\x20=\x20?',_0x38826c['query'][_0x4f1bc5]);}}});}if(_0x38826c['query'][_0x0fcf('0x7c')]){if(_0x38826c['query'][_0x0fcf('0x7c')]==0x1){_0x227dd5[_0x0fcf('0x5c')](_0x0fcf('0x7d'));}else{_0x227dd5['having']('`unreadMessages`\x20>\x200');}}if(_0x38826c[_0x0fcf('0x38')][_0x0fcf('0x7e')]){_0x5f1791=_['isArray'](_0x38826c[_0x0fcf('0x38')][_0x0fcf('0x7e')])?_0x38826c['query'][_0x0fcf('0x7e')]:new Array(_0x38826c[_0x0fcf('0x38')][_0x0fcf('0x7e')]);_0x5f1791[_0x0fcf('0x30')](function(_0x7cc9a0){_0x381a7f['or'](_0x0fcf('0x68'),'%,'+_0x7cc9a0+',%');});}if(_0x38826c[_0x0fcf('0x38')]['filter']){var _0x3edb41=_0x38826c[_0x0fcf('0x38')][_0x0fcf('0x7f')][_0x0fcf('0x80')]('\x5c','\x5c\x5c')[_0x0fcf('0x80')]('\x27\x27',_0x0fcf('0x81'));if(qs['isNumeric'](_0x3edb41)){_0x28d2f4['or']('i.id\x20LIKE\x20?',_0x3edb41+'%')['or'](_0x0fcf('0x82'),_0x3edb41+'%');}else{_0x28d2f4['or'](_0x0fcf('0x83'),qs[_0x0fcf('0x64')](_0x3edb41))['or'](_0x0fcf('0x84'),_0x3edb41+'%');}}}_0x227dd5['where'](_0x28d2f4);_0x227dd5[_0x0fcf('0x85')](_0x0fcf('0x86'));var _0x34035d={'type':db[_0x0fcf('0x87')][_0x0fcf('0x88')]['SELECT'],'raw':!![]};var _0x49d165=_0x227dd5[_0x0fcf('0x89')]();_0x49d165['field'](_0x0fcf('0x86'));_0x49d165['field'](_0x0fcf('0x8a'),_0x0fcf('0x5a'));if(_0x17346e[_0x0fcf('0x8b')]){_0x17346e[_0x0fcf('0x8b')][_0x0fcf('0x30')](function(_0x5c45b6){_0x227dd5[_0x0fcf('0x8b')]('i.'+_0x5c45b6[0x0],_0x5c45b6[0x1]===_0x0fcf('0x8c')?![]:!![]);});}if(!_[_0x0fcf('0x71')](_0x5f1791)){_0x227dd5[_0x0fcf('0x5c')](_0x381a7f);_0x49d165['where'](_0x0fcf('0x8d'),_0x5f1791);}BPromise['resolve']()[_0x0fcf('0x26')](function(){if(!_0x2b6ad3){if(_0x38826c['query'][_0x0fcf('0x72')]||_0x38826c[_0x0fcf('0x38')]['journey'])return;_0x49d165[_0x0fcf('0x42')](_0x0fcf('0x8e'));_0x227dd5[_0x0fcf('0x42')]('i.SmsAccountId\x20IS\x20NOT\x20NULL');return;}return _0x38826c['user']['getSmsAccounts']({'attributes':['id'],'raw':!![]})[_0x0fcf('0x26')](function(_0x5b3f34){if(_[_0x0fcf('0x71')](_0x5b3f34)){_0x49d165[_0x0fcf('0x42')](_0x0fcf('0x8f'));_0x227dd5[_0x0fcf('0x42')](_0x0fcf('0x8f'));}else{_0x49d165[_0x0fcf('0x42')](_0x0fcf('0x73'),_[_0x0fcf('0x2c')](_0x5b3f34,'id'));_0x227dd5[_0x0fcf('0x42')]('i.SmsAccountId\x20IN\x20?',_[_0x0fcf('0x2c')](_0x5b3f34,'id'));}});})[_0x0fcf('0x26')](function(){db[_0x0fcf('0x90')][_0x0fcf('0x38')](_0x49d165[_0x0fcf('0x91')](),_0x34035d)[_0x0fcf('0x26')](function(_0x3cc997){_0x5eb497[_0x0fcf('0x92')]=_0x3cc997['length'];if(_0x5eb497[_0x0fcf('0x92')]===0x0)return[];return db[_0x0fcf('0x90')][_0x0fcf('0x38')](_0x1f322b[_0x0fcf('0x91')](),_0x34035d)[_0x0fcf('0x26')](function(_0x147457){_0x44eb03=_[_0x0fcf('0x93')](_0x147457,'id');_0x34035d=_['merge'](_0x34035d,{'model':db[_0x0fcf('0x94')],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x38826c['query'][_0x0fcf('0x3c')]){_0x17346e[_0x0fcf('0x3a')][_0x0fcf('0x30')](function(_0x4fe0a8){_0x227dd5['field']('i.'+_0x4fe0a8);});}else{_0x227dd5['field']('SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)',_0x0fcf('0x5a'));_0x227dd5[_0x0fcf('0x44')](_0x0fcf('0x95'),_0x0fcf('0x96'));_0x227dd5[_0x0fcf('0x44')](_0x0fcf('0x97'),_0x0fcf('0x98'));_0x227dd5[_0x0fcf('0x44')](_0x0fcf('0x99'));_0x227dd5[_0x0fcf('0x44')](_0x0fcf('0x9a'),'Contact.firstName');_0x227dd5[_0x0fcf('0x44')](_0x0fcf('0x9b'),'Contact.lastName');_0x227dd5[_0x0fcf('0x44')]('c.email',_0x0fcf('0x9c'));_0x227dd5[_0x0fcf('0x44')]('c.phone','Contact.phone');_0x227dd5[_0x0fcf('0x44')](_0x0fcf('0x9d'),'Contact.mobile');_0x227dd5[_0x0fcf('0x44')](_0x0fcf('0x9e'),_0x0fcf('0x9f'));_0x227dd5[_0x0fcf('0x44')](_0x0fcf('0xa0'),_0x0fcf('0xa1'));_0x227dd5[_0x0fcf('0x44')](_0x0fcf('0xa2'),'Owner.internal');_0x227dd5[_0x0fcf('0x44')](_0x0fcf('0xa3'),_0x0fcf('0x2e'));}_0x227dd5[_0x0fcf('0x40')](_0x17346e['limit']);_0x227dd5[_0x0fcf('0x20')](_0x17346e['offset']);return db['sequelize']['query'](_0x227dd5[_0x0fcf('0x91')](),_0x34035d);})[_0x0fcf('0x26')](function(_0x45a545){_0x522148[_0x0fcf('0x42')](_0x0fcf('0xa4'),_[_0x0fcf('0x2c')](_0x45a545,'id'));return db[_0x0fcf('0x90')][_0x0fcf('0x38')](_0x522148[_0x0fcf('0x91')](),_0x34035d)['then'](function(_0x19264f){var _0x3174f2=_[_0x0fcf('0xa5')](_0x19264f,_0x0fcf('0xa6'));var _0x1d83bb=[];_0x45a545[_0x0fcf('0x30')](function(_0x194e2b){_0x1d83bb[_0x0fcf('0x31')](updateSmsInteraction(_0x194e2b,_0x44eb03,_0x3174f2));});return BPromise[_0x0fcf('0xa7')](_0x1d83bb);});});})['then'](function(_0x56e098){_0x5eb497['rows']=_0x56e098;return _0x5eb497;})[_0x0fcf('0x26')](respondWithFilteredResult(_0x2aeef8,_0x17346e));})[_0x0fcf('0x32')](handleError(_0x2aeef8,null));};exports[_0x0fcf('0xa8')]=function(_0x915d6e,_0x52e2e6){var _0x5a37a4={'raw':![],'where':{'id':_0x915d6e[_0x0fcf('0xa9')]['id']}},_0x5c7fd7={};_0x5c7fd7['model']=_[_0x0fcf('0x37')](db['SmsInteraction'][_0x0fcf('0x34')]);_0x5c7fd7['query']=_[_0x0fcf('0x37')](_0x915d6e['query']);_0x5c7fd7['filters']=_[_0x0fcf('0x3b')](_0x5c7fd7['model'],_0x5c7fd7[_0x0fcf('0x38')]);_0x5a37a4[_0x0fcf('0x3a')]=_[_0x0fcf('0x3b')](_0x5c7fd7[_0x0fcf('0x36')],qs[_0x0fcf('0x3c')](_0x915d6e[_0x0fcf('0x38')][_0x0fcf('0x3c')]));_0x5a37a4[_0x0fcf('0x3a')]=_0x5a37a4[_0x0fcf('0x3a')][_0x0fcf('0x3d')]?_0x5a37a4[_0x0fcf('0x3a')]:_0x5c7fd7[_0x0fcf('0x36')];if(_0x915d6e[_0x0fcf('0x38')]['includeAll']){_0x5a37a4[_0x0fcf('0xaa')]=[{'all':!![]}];}_0x5a37a4=_[_0x0fcf('0xab')]({},_0x5a37a4,_0x915d6e[_0x0fcf('0xac')]);return db[_0x0fcf('0x94')][_0x0fcf('0x59')](_0x5a37a4)[_0x0fcf('0x26')](handleEntityNotFound(_0x52e2e6,null))[_0x0fcf('0x26')](respondWithResult(_0x52e2e6,null))[_0x0fcf('0x32')](handleError(_0x52e2e6,null));};exports[_0x0fcf('0xad')]=function(_0x50a5bb,_0x3410ae){return db[_0x0fcf('0x94')][_0x0fcf('0xad')](_0x50a5bb[_0x0fcf('0x6e')],{})[_0x0fcf('0x26')](respondWithResult(_0x3410ae,0xc9))[_0x0fcf('0x32')](handleError(_0x3410ae,null));};exports[_0x0fcf('0x25')]=function(_0x3a8c7f,_0x38f7de){if(_0x3a8c7f[_0x0fcf('0x6e')]['id']){delete _0x3a8c7f[_0x0fcf('0x6e')]['id'];}return db[_0x0fcf('0x94')][_0x0fcf('0x59')]({'where':{'id':_0x3a8c7f['params']['id']}})[_0x0fcf('0x26')](handleEntityNotFound(_0x38f7de,null))[_0x0fcf('0x26')](saveUpdates(_0x3a8c7f['body'],null))[_0x0fcf('0x26')](respondWithResult(_0x38f7de,null))[_0x0fcf('0x32')](handleError(_0x38f7de,null));};exports[_0x0fcf('0x27')]=function(_0x2897c7,_0x3ba088){return db['SmsInteraction']['find']({'where':{'id':_0x2897c7['params']['id']}})[_0x0fcf('0x26')](handleEntityNotFound(_0x3ba088,null))['then'](removeEntity(_0x3ba088,null))[_0x0fcf('0x32')](handleError(_0x3ba088,null));};exports[_0x0fcf('0xae')]=function(_0x563400,_0x53295b){return db[_0x0fcf('0x94')][_0x0fcf('0xae')]()[_0x0fcf('0x26')](respondWithResult(_0x53295b,null))[_0x0fcf('0x32')](handleError(_0x53295b,null));};exports[_0x0fcf('0xaf')]=function(_0x2c7a16,_0x5184b7,_0x2c0c7e){return db['SmsMessage'][_0x0fcf('0x59')]({'where':{'id':_0x2c7a16[_0x0fcf('0xa9')]['id']}})[_0x0fcf('0x26')](handleEntityNotFound(_0x5184b7,null))['then'](function(_0x14e005){if(_0x14e005){return _0x14e005[_0x0fcf('0xaf')](_0x2c7a16[_0x0fcf('0x6e')][_0x0fcf('0xb0')],_[_0x0fcf('0xb1')](_0x2c7a16[_0x0fcf('0x6e')],[_0x0fcf('0xb0'),'id'])||{});}})['then'](respondWithResult(_0x5184b7,null))[_0x0fcf('0x32')](handleError(_0x5184b7,null));};exports[_0x0fcf('0xb2')]=function(_0x2a72c0,_0x2f2e24,_0x57d614){var _0x42a9e8={'raw':![],'where':{}};var _0x58c993={};var _0xbb48eb={'count':0x0,'rows':[]};return db[_0x0fcf('0x94')]['findOne']({'where':{'id':_0x2a72c0['params']['id']}})[_0x0fcf('0x26')](handleEntityNotFound(_0x2f2e24,null))[_0x0fcf('0x26')](function(_0xed8835){if(_0xed8835){_0x58c993[_0x0fcf('0x36')]=_[_0x0fcf('0x37')](db[_0x0fcf('0xb3')][_0x0fcf('0x34')]);_0x58c993[_0x0fcf('0x38')]=_[_0x0fcf('0x37')](_0x2a72c0[_0x0fcf('0x38')]);_0x58c993['filters']=_[_0x0fcf('0x3b')](_0x58c993['model'],_0x58c993['query']);_0x42a9e8[_0x0fcf('0x3a')]=_['intersection'](_0x58c993['model'],qs['fields'](_0x2a72c0[_0x0fcf('0x38')][_0x0fcf('0x3c')]));_0x42a9e8[_0x0fcf('0x3a')]=_0x42a9e8[_0x0fcf('0x3a')][_0x0fcf('0x3d')]?_0x42a9e8[_0x0fcf('0x3a')]:_0x58c993[_0x0fcf('0x36')];if(!_0x2a72c0[_0x0fcf('0x38')][_0x0fcf('0x3e')]('nolimit')){_0x42a9e8[_0x0fcf('0x40')]=qs[_0x0fcf('0x40')](_0x2a72c0[_0x0fcf('0x38')][_0x0fcf('0x40')]);_0x42a9e8[_0x0fcf('0x20')]=qs[_0x0fcf('0x20')](_0x2a72c0['query'][_0x0fcf('0x20')]);}_0x42a9e8[_0x0fcf('0x8b')]=qs[_0x0fcf('0x41')](_0x2a72c0[_0x0fcf('0x38')][_0x0fcf('0x41')]);_0x42a9e8['where']=qs[_0x0fcf('0x39')](_[_0x0fcf('0xb4')](_0x2a72c0[_0x0fcf('0x38')],_0x58c993[_0x0fcf('0x39')]));_0x42a9e8[_0x0fcf('0x42')]['SmsInteractionId']=_0xed8835['id'];if(_0x2a72c0[_0x0fcf('0x38')][_0x0fcf('0x7f')]){_0x42a9e8[_0x0fcf('0x42')]=_[_0x0fcf('0xab')](_0x42a9e8['where'],{'$or':_[_0x0fcf('0x2c')](_0x42a9e8[_0x0fcf('0x3a')],function(_0x3270dc){var _0x545d29={};_0x545d29[_0x3270dc]={'$like':'%'+_0x2a72c0['query'][_0x0fcf('0x7f')]+'%'};return _0x545d29;})});}if(_0x2a72c0[_0x0fcf('0x38')][_0x0fcf('0x77')]){var _0x315fc9=_0x2a72c0[_0x0fcf('0x38')]['$gte'][_0x0fcf('0x62')](',');var _0x470e86={};_0x470e86[_0x315fc9[0x0]]={'$gte':moment(_0x315fc9[0x1])[_0x0fcf('0xb5')]('YYYY-MM-DD\x20HH:mm:ss')};_0x42a9e8[_0x0fcf('0x42')]=_[_0x0fcf('0xab')](_0x42a9e8['where'],_0x470e86);}_0x42a9e8=_[_0x0fcf('0xab')]({},_0x42a9e8,_0x2a72c0[_0x0fcf('0xac')]);return db[_0x0fcf('0xb3')][_0x0fcf('0x92')]({'where':_0x42a9e8[_0x0fcf('0x42')]})['then'](function(_0x322c3c){_0xbb48eb['count']=_0x322c3c;if(_0x2a72c0[_0x0fcf('0x38')]['includeAll']){_0x42a9e8['include']=[{'all':!![]}];}return db[_0x0fcf('0xb3')][_0x0fcf('0xb6')](_0x42a9e8);})[_0x0fcf('0x26')](function(_0x26e2f5){_0xbb48eb[_0x0fcf('0xb7')]=_0x26e2f5;return _0xbb48eb;});}})[_0x0fcf('0x26')](respondWithFilteredResult(_0x2f2e24,_0x42a9e8))[_0x0fcf('0x32')](handleError(_0x2f2e24,null));};exports[_0x0fcf('0xb8')]=function(_0x15f22c,_0x56dab8,_0x1e805c){return db[_0x0fcf('0x94')][_0x0fcf('0x59')]({'where':{'id':_0x15f22c[_0x0fcf('0xa9')]['id']}})[_0x0fcf('0x26')](handleEntityNotFound(_0x56dab8,null))[_0x0fcf('0x26')](function(_0x210aaf){if(_0x210aaf){return _0x210aaf['setTags'](_0x15f22c[_0x0fcf('0x6e')][_0x0fcf('0xb0')],_['omit'](_0x15f22c[_0x0fcf('0x6e')],['ids','id'])||{})[_0x0fcf('0xb9')](function(){return db['Tag'][_0x0fcf('0xb6')]({'attributes':['id',_0x0fcf('0x2a'),_0x0fcf('0xba')],'where':{'id':_0x15f22c[_0x0fcf('0x6e')][_0x0fcf('0xb0')]}});})[_0x0fcf('0x26')](function(_0x53f460){socket[_0x0fcf('0xbb')](_0x0fcf('0xbc'),{'id':Number(_0x15f22c[_0x0fcf('0xa9')]['id']),'tags':_0x53f460||[]});return{'id':Number(_0x15f22c[_0x0fcf('0xa9')]['id']),'tags':_0x53f460||[]};});}})[_0x0fcf('0x26')](respondWithResult(_0x56dab8,null))['catch'](handleError(_0x56dab8,null));};exports['removeTags']=function(_0x3211be,_0x2cc660,_0x23200d){return db[_0x0fcf('0x94')][_0x0fcf('0x59')]({'where':{'id':_0x3211be['params']['id']}})[_0x0fcf('0x26')](handleEntityNotFound(_0x2cc660,null))[_0x0fcf('0x26')](function(_0x4919d4){if(_0x4919d4){return _0x4919d4['removeTags'](_0x3211be[_0x0fcf('0x38')][_0x0fcf('0xb0')]);}})[_0x0fcf('0x26')](respondWithStatusCode(_0x2cc660,null))[_0x0fcf('0x32')](handleError(_0x2cc660,null));};exports[_0x0fcf('0xbd')]=function(_0x36444a,_0x38aba9){var _0x5bd108=moment()[_0x0fcf('0xbe')]()[_0x0fcf('0x91')]();var _0x1bd3a0=path[_0x0fcf('0xbf')](config[_0x0fcf('0xc0')],_0x0fcf('0xc1'),_0x0fcf('0xc2'),_0x0fcf('0xc3'));var _0x515ee8=path['join'](config[_0x0fcf('0xc0')],_0x0fcf('0xc1'),_0x0fcf('0xc2'),_0x0fcf('0xc4'));var _0x1902d9=path[_0x0fcf('0xbf')](_0x1bd3a0,_0x5bd108);var _0x518070=util[_0x0fcf('0xb5')]('transcript-%d-%s.zip',_0x36444a[_0x0fcf('0xa9')]['id'],_0x5bd108);var _0x5f4613=path['join'](_0x1bd3a0,_0x518070);var _0x1d6c26=[];_0x1d6c26[_0x0fcf('0x31')]({'model':db[_0x0fcf('0xc5')],'as':'User','attributes':['id','fullname'],'raw':!![]});_0x1d6c26[_0x0fcf('0x31')]({'model':db[_0x0fcf('0xc6')],'as':_0x0fcf('0x5f'),'attributes':['id',_0x0fcf('0xc7'),_0x0fcf('0xc8')],'raw':!![]});var _0x4cf24c=[{'model':db[_0x0fcf('0xb3')],'as':_0x0fcf('0xc9'),'attributes':['id',_0x0fcf('0x6e'),_0x0fcf('0x75'),_0x0fcf('0xca'),_0x0fcf('0xcb'),_0x0fcf('0x7c')],'include':_0x1d6c26}];_0x4cf24c[_0x0fcf('0x31')]({'model':db[_0x0fcf('0xcc')],'as':_0x0fcf('0xcd'),'attributes':['id',_0x0fcf('0x2a')]});_0x4cf24c[_0x0fcf('0x31')]({'model':db[_0x0fcf('0xc5')],'as':_0x0fcf('0xce'),'attributes':['id',_0x0fcf('0x2d')]});return db[_0x0fcf('0x94')]['find']({'where':{'id':_0x36444a['params']['id']},'include':_0x4cf24c})['then'](handleEntityNotFound(_0x38aba9,null))[_0x0fcf('0x26')](function(_0x4d2c64){if(_0x4d2c64){var _0x10f53e=_0x4d2c64[_0x0fcf('0xcf')]({'plain':!![]});fs['mkdirSync'](_0x1902d9);var _0x1dbb3c={'format':'A4','border':'10px','header':{'height':_0x0fcf('0xd0'),'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':_0x0fcf('0xd1'),'contents':{'default':util[_0x0fcf('0xb5')](_0x0fcf('0xd2'),util[_0x0fcf('0xb5')](_0x0fcf('0xd3'),_0x0fcf('0xd4'),_0x10f53e['id']),moment()['format'](_0x0fcf('0xd5'))[_0x0fcf('0x91')]())}}};var _0x5ab604={'channel':_0x0fcf('0xd4'),'account':_0x10f53e['Account']['name'],'agent':_0x10f53e[_0x0fcf('0xce')]?_0x10f53e[_0x0fcf('0xce')][_0x0fcf('0x2d')]:_0x0fcf('0xd6'),'createdAt':moment(_0x10f53e[_0x0fcf('0x75')])[_0x0fcf('0xb5')](_0x0fcf('0xd7'))[_0x0fcf('0x91')](),'closedAt':_0x10f53e['closed']?moment(_0x10f53e[_0x0fcf('0xd8')])[_0x0fcf('0xb5')](_0x0fcf('0xd7'))[_0x0fcf('0x91')]():'','disposition':_0x10f53e['disposition'],'messages':_(_0x10f53e['Messages'])[_0x0fcf('0x7f')]({'secret':![]})[_0x0fcf('0x2c')](function(_0x119aea){return{'date':moment(_0x119aea[_0x0fcf('0x75')])[_0x0fcf('0xb5')]('YYYY-MM-DD\x20HH:mm:ss')['toString'](),'sender':_0x119aea[_0x0fcf('0xca')]===_0x0fcf('0xd9')?_0x119aea[_0x0fcf('0xc5')]?_0x119aea[_0x0fcf('0xc5')]['fullname']:_0x0fcf('0xda'):_0x119aea[_0x0fcf('0x5f')]['firstName']+(_0x119aea[_0x0fcf('0x5f')][_0x0fcf('0xc8')]?'\x20'+_0x119aea['Contact'][_0x0fcf('0xc8')]:''),'body':_0x119aea[_0x0fcf('0x6e')],'direction':_0x119aea[_0x0fcf('0xca')]===_0x0fcf('0xd9')?'A':'C','secret':_0x119aea[_0x0fcf('0xcb')],'read':_0x119aea[_0x0fcf('0x7c')]};})[_0x0fcf('0x5b')]()};return ejs['renderFile'](path[_0x0fcf('0xbf')](config[_0x0fcf('0xc0')],_0x0fcf('0xc1'),'views',_0x0fcf('0xdb')),{'interaction':_0x5ab604})[_0x0fcf('0x26')](function(_0x41e1b5){return new BPromise(function(_0xaa5bd3,_0x2039c5){pdf[_0x0fcf('0xad')](_0x41e1b5,_0x1dbb3c)[_0x0fcf('0xdc')](path[_0x0fcf('0xbf')](_0x1902d9,_0x0fcf('0xdd')+_0x10f53e['id']+'-'+_0x5bd108+_0x0fcf('0xde')),function(_0x2d0115,_0x47b0d4){if(_0x2d0115)return _0x2039c5(_0x2d0115);_0xaa5bd3(_0x47b0d4);});});})[_0x0fcf('0x26')](function(){return new BPromise(function(_0x49db55,_0x771bfe){zipdir(_0x1902d9,{'saveTo':_0x5f4613},function(_0x3aad0f,_0x426ab2){if(_0x3aad0f)return _0x771bfe(_0x3aad0f);return _0x49db55(_0x426ab2);});})['then'](function(){return new BPromise(function(_0x29ea68,_0x5a24dd){rimraf(_0x1902d9,function(_0x60989c){if(_0x60989c)_0x5a24dd(_0x60989c);return _0x29ea68();});});})['then'](function(){return _0x38aba9[_0x0fcf('0xbd')](_0x5f4613,_0x518070,function(_0x1ead7e){if(_0x1ead7e){console['log'](_0x0fcf('0xdf'),_0x1ead7e);}else{fs['unlinkSync'](_0x5f4613);}});});});}else{return _0x38aba9[_0x0fcf('0x1d')](0xc8);}})[_0x0fcf('0x32')](handleError(_0x38aba9,null));}; \ No newline at end of file diff --git a/server/api/smsInteraction/smsInteraction.events.js b/server/api/smsInteraction/smsInteraction.events.js index fe7627a..57676de 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 _0xbeea=['exports','events','SmsInteraction','../../mysqldb','SmsMessage','save','remove','setDataValue','map','findAll','then','unreadMessages','length','emit','catch','hasOwnProperty'];(function(_0x41bdd4,_0x3d5c76){var _0x5c03a6=function(_0x59634a){while(--_0x59634a){_0x41bdd4['push'](_0x41bdd4['shift']());}};_0x5c03a6(++_0x3d5c76);}(_0xbeea,0xb1));var _0xabee=function(_0x44113a,_0x17c405){_0x44113a=_0x44113a-0x0;var _0x526baf=_0xbeea[_0x44113a];return _0x526baf;};'use strict';var EventEmitter=require(_0xabee('0x0'));var SmsInteraction=require('../../mysqldb')['db'][_0xabee('0x1')];var SmsMessage=require(_0xabee('0x2'))['db'][_0xabee('0x3')];var SmsInteractionEvents=new EventEmitter();SmsInteractionEvents['setMaxListeners'](0x0);var events={'afterCreate':_0xabee('0x4'),'afterUpdate':'update','afterDestroy':_0xabee('0x5')};function emitEvent(_0x33571e){return function(_0x2fb6d9,_0x49631e,_0x1ea258){_0x2fb6d9['getUsers']({'attributes':['id'],'raw':!![]})['then'](function(_0x238317){_0x2fb6d9[_0xabee('0x6')]('Users',_0x238317[_0xabee('0x7')](function(_0x507deb){return{'id':_0x507deb['id']};}));return SmsMessage[_0xabee('0x8')]({'where':{'SmsInteractionId':_0x2fb6d9['id'],'direction':'in','read':![]},'raw':!![]});})[_0xabee('0x9')](function(_0x2a1c06){_0x2fb6d9[_0xabee('0x6')](_0xabee('0xa'),_0x2a1c06[_0xabee('0xb')]);SmsInteractionEvents['emit'](_0x33571e+':'+_0x2fb6d9['id'],_0x2fb6d9);SmsInteractionEvents[_0xabee('0xc')](_0x33571e,_0x2fb6d9);_0x1ea258(null);})[_0xabee('0xd')](_0x1ea258(null));};}for(var e in events){if(events[_0xabee('0xe')](e)){var event=events[e];SmsInteraction['hook'](e,emitEvent(event));}}module[_0xabee('0xf')]=SmsInteractionEvents; \ No newline at end of file +var _0x4300=['update','remove','getUsers','setDataValue','Users','map','findAll','then','length','emit','catch','hasOwnProperty','hook','exports','events','setMaxListeners','save'];(function(_0x164eca,_0x555e28){var _0x2ce562=function(_0x148ca6){while(--_0x148ca6){_0x164eca['push'](_0x164eca['shift']());}};_0x2ce562(++_0x555e28);}(_0x4300,0x1a6));var _0x0430=function(_0x12fba4,_0x271239){_0x12fba4=_0x12fba4-0x0;var _0x4aac7d=_0x4300[_0x12fba4];return _0x4aac7d;};'use strict';var EventEmitter=require(_0x0430('0x0'));var SmsInteraction=require('../../mysqldb')['db']['SmsInteraction'];var SmsMessage=require('../../mysqldb')['db']['SmsMessage'];var SmsInteractionEvents=new EventEmitter();SmsInteractionEvents[_0x0430('0x1')](0x0);var events={'afterCreate':_0x0430('0x2'),'afterUpdate':_0x0430('0x3'),'afterDestroy':_0x0430('0x4')};function emitEvent(_0x1735aa){return function(_0x5d0aac,_0x46b412,_0x5943c0){_0x5d0aac[_0x0430('0x5')]({'attributes':['id'],'raw':!![]})['then'](function(_0x2388b9){_0x5d0aac[_0x0430('0x6')](_0x0430('0x7'),_0x2388b9[_0x0430('0x8')](function(_0x1e8d93){return{'id':_0x1e8d93['id']};}));return SmsMessage[_0x0430('0x9')]({'where':{'SmsInteractionId':_0x5d0aac['id'],'direction':'in','read':![]},'raw':!![]});})[_0x0430('0xa')](function(_0x3af75c){_0x5d0aac[_0x0430('0x6')]('unreadMessages',_0x3af75c[_0x0430('0xb')]);SmsInteractionEvents[_0x0430('0xc')](_0x1735aa+':'+_0x5d0aac['id'],_0x5d0aac);SmsInteractionEvents[_0x0430('0xc')](_0x1735aa,_0x5d0aac);_0x5943c0(null);})[_0x0430('0xd')](_0x5943c0(null));};}for(var e in events){if(events[_0x0430('0xe')](e)){var event=events[e];SmsInteraction[_0x0430('0xf')](e,emitEvent(event));}}module[_0x0430('0x10')]=SmsInteractionEvents; \ No newline at end of file diff --git a/server/api/smsInteraction/smsInteraction.model.js b/server/api/smsInteraction/smsInteraction.model.js index bd7db73..47e6f13 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 _0x4853=['bluebird','path','rimraf','../../config/environment','./smsInteraction.attributes','exports','define','SmsInteraction','changed','closedAt','format','YYYY-MM-DD\x20HH:mm:ss','util','../../config/logger','api','moment'];(function(_0x251d71,_0x25cfa0){var _0x2ca544=function(_0x4a1e76){while(--_0x4a1e76){_0x251d71['push'](_0x251d71['shift']());}};_0x2ca544(++_0x25cfa0);}(_0x4853,0x1cc));var _0x3485=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0x4853[_0xa464c9];return _0x3d73c4;};'use strict';var _=require('lodash');var util=require(_0x3485('0x0'));var logger=require(_0x3485('0x1'))(_0x3485('0x2'));var moment=require(_0x3485('0x3'));var BPromise=require(_0x3485('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x3485('0x5'));var rimraf=require(_0x3485('0x6'));var config=require(_0x3485('0x7'));var attributes=require(_0x3485('0x8'));module[_0x3485('0x9')]=function(_0x1e2a95,_0x378460){return _0x1e2a95[_0x3485('0xa')](_0x3485('0xb'),attributes,{'tableName':'sms_interactions','paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x1facd0,_0x126fc3,_0x4fe5b4){if(_0x1facd0[_0x3485('0xc')]('closed')){_0x1facd0[_0x3485('0xd')]=moment()[_0x3485('0xe')](_0x3485('0xf'));}_0x4fe5b4(null,_0x1facd0);}}});}; \ No newline at end of file +var _0x4694=['format','YYYY-MM-DD\x20HH:mm:ss','lodash','moment','request-promise','../../config/environment','./smsInteraction.attributes','exports','define','SmsInteraction','sms_interactions','changed','closed','closedAt'];(function(_0x13b178,_0x5a22c2){var _0x4130d8=function(_0x2543ad){while(--_0x2543ad){_0x13b178['push'](_0x13b178['shift']());}};_0x4130d8(++_0x5a22c2);}(_0x4694,0xe2));var _0x4469=function(_0x1b349a,_0x22222c){_0x1b349a=_0x1b349a-0x0;var _0x5d1f7c=_0x4694[_0x1b349a];return _0x5d1f7c;};'use strict';var _=require(_0x4469('0x0'));var util=require('util');var logger=require('../../config/logger')('api');var moment=require(_0x4469('0x1'));var BPromise=require('bluebird');var rp=require(_0x4469('0x2'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x4469('0x3'));var attributes=require(_0x4469('0x4'));module[_0x4469('0x5')]=function(_0x3e0ca4,_0x104caf){return _0x3e0ca4[_0x4469('0x6')](_0x4469('0x7'),attributes,{'tableName':_0x4469('0x8'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x3df6ff,_0x589548,_0x3aabc1){if(_0x3df6ff[_0x4469('0x9')](_0x4469('0xa'))){_0x3df6ff[_0x4469('0xb')]=moment()[_0x4469('0xc')](_0x4469('0xd'));}_0x3aabc1(null,_0x3df6ff);}}});}; \ No newline at end of file diff --git a/server/api/smsInteraction/smsInteraction.rpc.js b/server/api/smsInteraction/smsInteraction.rpc.js index bc4f246..3efbdfe 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 _0x597f=['where','then','message','AddTagsToSmsInteraction','find','addTags','ids','omit','spread','AddTags','catch','util','moment','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','client','http','redis','defaults','socket.io-emitter','./smsInteraction.socket','register','request','info','SmsInteraction,\x20%s,\x20%s','request\x20sent','debug','error','code','result','UpdateSmsInteraction','SmsInteraction','body','raw','options'];(function(_0x46a13f,_0x2af5ca){var _0x2af8a6=function(_0x5dae04){while(--_0x5dae04){_0x46a13f['push'](_0x46a13f['shift']());}};_0x2af8a6(++_0x2af5ca);}(_0x597f,0xef));var _0xf597=function(_0x155e04,_0x28cd61){_0x155e04=_0x155e04-0x0;var _0x4590d0=_0x597f[_0x155e04];return _0x4590d0;};'use strict';var _=require('lodash');var util=require(_0xf597('0x0'));var moment=require(_0xf597('0x1'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xf597('0x2'));var db=require(_0xf597('0x3'))['db'];var utils=require(_0xf597('0x4'));var logger=require(_0xf597('0x5'))(_0xf597('0x6'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0xf597('0x7')][_0xf597('0x8')]({'port':0x232a});config[_0xf597('0x9')]=_[_0xf597('0xa')](config[_0xf597('0x9')],{'host':'localhost','port':0x18eb});var socket=require(_0xf597('0xb'))(new Redis(config['redis']));require(_0xf597('0xc'))[_0xf597('0xd')](socket);function respondWithRpcPromise(_0x434c90,_0x16be52,_0x20e3b0){return new BPromise(function(_0x19367b,_0x881fdb){return client[_0xf597('0xe')](_0x434c90,_0x20e3b0)['then'](function(_0x1fe72a){logger[_0xf597('0xf')](_0xf597('0x10'),_0x16be52,_0xf597('0x11'));logger[_0xf597('0x12')]('SmsInteraction,\x20%s,\x20%s,\x20%s',_0x16be52,_0xf597('0x11'),JSON['stringify'](_0x1fe72a));if(_0x1fe72a['error']){if(_0x1fe72a[_0xf597('0x13')][_0xf597('0x14')]===0x1f4){logger[_0xf597('0x13')](_0xf597('0x10'),_0x16be52,_0x1fe72a['error']['message']);return _0x881fdb(_0x1fe72a['error']['message']);}logger[_0xf597('0x13')](_0xf597('0x10'),_0x16be52,_0x1fe72a[_0xf597('0x13')]['message']);return _0x19367b(_0x1fe72a['error']['message']);}else{logger[_0xf597('0xf')]('SmsInteraction,\x20%s,\x20%s',_0x16be52,_0xf597('0x11'));_0x19367b(_0x1fe72a[_0xf597('0x15')]['message']);}})['catch'](function(_0x6ec65c){logger[_0xf597('0x13')](_0xf597('0x10'),_0x16be52,_0x6ec65c);_0x881fdb(_0x6ec65c);});});}exports[_0xf597('0x16')]=function(_0x4046b1){var _0x3e741c=this;return new Promise(function(_0xbfa8cd,_0x26dbb7){return db[_0xf597('0x17')]['update'](_0x4046b1[_0xf597('0x18')],{'raw':_0x4046b1['options']?_0x4046b1['options'][_0xf597('0x19')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x4046b1['options']?_0x4046b1[_0xf597('0x1a')][_0xf597('0x1b')]||null:null,'attributes':_0x4046b1[_0xf597('0x1a')]?_0x4046b1[_0xf597('0x1a')]['attributes']||null:null,'limit':_0x4046b1[_0xf597('0x1a')]?_0x4046b1[_0xf597('0x1a')]['limit']||null:null})[_0xf597('0x1c')](function(_0x423400){logger['info'](_0xf597('0x16'),_0x4046b1);logger[_0xf597('0x12')](_0xf597('0x16'),_0x4046b1,JSON['stringify'](_0x423400));_0xbfa8cd(_0x423400);})['catch'](function(_0x1ac1f5){logger[_0xf597('0x13')](_0xf597('0x16'),_0x1ac1f5['message'],_0x4046b1);_0x26dbb7(_0x3e741c['error'](0x1f4,_0x1ac1f5[_0xf597('0x1d')]));});});};exports[_0xf597('0x1e')]=function(_0x1f4aaf){return new Promise(function(_0x18aa2b,_0x4a3d7e){return db[_0xf597('0x17')][_0xf597('0x1f')]({'where':_0x1f4aaf[_0xf597('0x1a')]?_0x1f4aaf[_0xf597('0x1a')][_0xf597('0x1b')]||null:null})[_0xf597('0x1c')](function(_0x26b4b2){if(_0x26b4b2){return _0x26b4b2[_0xf597('0x20')](_0x1f4aaf['body'][_0xf597('0x21')],_[_0xf597('0x22')](_0x1f4aaf[_0xf597('0x18')],[_0xf597('0x21'),'id'])||{});}})[_0xf597('0x23')](function(_0x506a7f){logger['info'](_0xf597('0x24'),_0x1f4aaf);logger[_0xf597('0x12')](_0xf597('0x24'),_0x1f4aaf,JSON['stringify'](_0x506a7f));_0x18aa2b(_0x506a7f);})[_0xf597('0x25')](function(_0xa2f9a5){logger['error'](_0xf597('0x24'),_0xa2f9a5['message'],_0x1f4aaf);_0x4a3d7e(_this['error'](0x1f4,_0xa2f9a5['message']));});});}; \ No newline at end of file +var _0x1583=['../../config/logger','rpc','../../config/environment','client','http','defaults','localhost','socket.io-emitter','redis','./smsInteraction.socket','register','request','then','info','SmsInteraction,\x20%s,\x20%s','SmsInteraction,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','UpdateSmsInteraction','update','options','raw','where','attributes','limit','debug','find','body','ids','omit','spread','AddTags','util','ioredis','../../mysqldb','../../config/utils'];(function(_0x1da527,_0x2dc953){var _0x40fc7c=function(_0x9949f5){while(--_0x9949f5){_0x1da527['push'](_0x1da527['shift']());}};_0x40fc7c(++_0x2dc953);}(_0x1583,0x1e8));var _0x3158=function(_0x529141,_0x3b04c4){_0x529141=_0x529141-0x0;var _0x4aec85=_0x1583[_0x529141];return _0x4aec85;};'use strict';var _=require('lodash');var util=require(_0x3158('0x0'));var moment=require('moment');var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x3158('0x1'));var db=require(_0x3158('0x2'))['db'];var utils=require(_0x3158('0x3'));var logger=require(_0x3158('0x4'))(_0x3158('0x5'));var config=require(_0x3158('0x6'));var jayson=require('jayson/promise');var client=jayson[_0x3158('0x7')][_0x3158('0x8')]({'port':0x232a});config['redis']=_[_0x3158('0x9')](config['redis'],{'host':_0x3158('0xa'),'port':0x18eb});var socket=require(_0x3158('0xb'))(new Redis(config[_0x3158('0xc')]));require(_0x3158('0xd'))[_0x3158('0xe')](socket);function respondWithRpcPromise(_0xb2fa61,_0x5844c7,_0x67098b){return new BPromise(function(_0x3fa015,_0x30fb35){return client[_0x3158('0xf')](_0xb2fa61,_0x67098b)[_0x3158('0x10')](function(_0x3954f2){logger[_0x3158('0x11')](_0x3158('0x12'),_0x5844c7,'request\x20sent');logger['debug'](_0x3158('0x13'),_0x5844c7,_0x3158('0x14'),JSON[_0x3158('0x15')](_0x3954f2));if(_0x3954f2['error']){if(_0x3954f2[_0x3158('0x16')][_0x3158('0x17')]===0x1f4){logger[_0x3158('0x16')]('SmsInteraction,\x20%s,\x20%s',_0x5844c7,_0x3954f2[_0x3158('0x16')][_0x3158('0x18')]);return _0x30fb35(_0x3954f2[_0x3158('0x16')][_0x3158('0x18')]);}logger[_0x3158('0x16')]('SmsInteraction,\x20%s,\x20%s',_0x5844c7,_0x3954f2['error'][_0x3158('0x18')]);return _0x3fa015(_0x3954f2[_0x3158('0x16')][_0x3158('0x18')]);}else{logger[_0x3158('0x11')](_0x3158('0x12'),_0x5844c7,_0x3158('0x14'));_0x3fa015(_0x3954f2[_0x3158('0x19')][_0x3158('0x18')]);}})[_0x3158('0x1a')](function(_0x10c6f7){logger[_0x3158('0x16')](_0x3158('0x12'),_0x5844c7,_0x10c6f7);_0x30fb35(_0x10c6f7);});});}exports[_0x3158('0x1b')]=function(_0x48ecfb){var _0x35e3b1=this;return new Promise(function(_0x3d96fd,_0x274e9f){return db['SmsInteraction'][_0x3158('0x1c')](_0x48ecfb['body'],{'raw':_0x48ecfb[_0x3158('0x1d')]?_0x48ecfb['options'][_0x3158('0x1e')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x48ecfb[_0x3158('0x1d')]?_0x48ecfb[_0x3158('0x1d')][_0x3158('0x1f')]||null:null,'attributes':_0x48ecfb[_0x3158('0x1d')]?_0x48ecfb['options'][_0x3158('0x20')]||null:null,'limit':_0x48ecfb[_0x3158('0x1d')]?_0x48ecfb[_0x3158('0x1d')][_0x3158('0x21')]||null:null})[_0x3158('0x10')](function(_0x28f21d){logger[_0x3158('0x11')](_0x3158('0x1b'),_0x48ecfb);logger[_0x3158('0x22')](_0x3158('0x1b'),_0x48ecfb,JSON[_0x3158('0x15')](_0x28f21d));_0x3d96fd(_0x28f21d);})[_0x3158('0x1a')](function(_0x4b3841){logger[_0x3158('0x16')](_0x3158('0x1b'),_0x4b3841[_0x3158('0x18')],_0x48ecfb);_0x274e9f(_0x35e3b1[_0x3158('0x16')](0x1f4,_0x4b3841['message']));});});};exports['AddTagsToSmsInteraction']=function(_0x589569){return new Promise(function(_0x33e4c2,_0x3183e6){return db['SmsInteraction'][_0x3158('0x23')]({'where':_0x589569['options']?_0x589569[_0x3158('0x1d')]['where']||null:null})[_0x3158('0x10')](function(_0x18955b){if(_0x18955b){return _0x18955b['addTags'](_0x589569[_0x3158('0x24')][_0x3158('0x25')],_[_0x3158('0x26')](_0x589569[_0x3158('0x24')],[_0x3158('0x25'),'id'])||{});}})[_0x3158('0x27')](function(_0x2c9f7){logger[_0x3158('0x11')](_0x3158('0x28'),_0x589569);logger[_0x3158('0x22')](_0x3158('0x28'),_0x589569,JSON['stringify'](_0x2c9f7));_0x33e4c2(_0x2c9f7);})[_0x3158('0x1a')](function(_0x55a22a){logger['error']('AddTags',_0x55a22a['message'],_0x589569);_0x3183e6(_this[_0x3158('0x16')](0x1f4,_0x55a22a[_0x3158('0x18')]));});});}; \ No newline at end of file diff --git a/server/api/smsInteraction/smsInteraction.socket.js b/server/api/smsInteraction/smsInteraction.socket.js index 07e6acf..6154a4c 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 _0xb7e7=['remove','removeListener','length','smsInteraction:','./smsInteraction.events'];(function(_0x26b5ff,_0x92009a){var _0x58603e=function(_0x4454ff){while(--_0x4454ff){_0x26b5ff['push'](_0x26b5ff['shift']());}};_0x58603e(++_0x92009a);}(_0xb7e7,0x121));var _0x7b7e=function(_0x21a9d9,_0x4d5ac8){_0x21a9d9=_0x21a9d9-0x0;var _0x46adce=_0xb7e7[_0x21a9d9];return _0x46adce;};'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 +var _0x5f66=['length','smsInteraction:','save','update','emit','register'];(function(_0x2904f6,_0x10511f){var _0x4dbc25=function(_0x23f279){while(--_0x23f279){_0x2904f6['push'](_0x2904f6['shift']());}};_0x4dbc25(++_0x10511f);}(_0x5f66,0x1a0));var _0x65f6=function(_0x432682,_0x253044){_0x432682=_0x432682-0x0;var _0x463d05=_0x5f66[_0x432682];return _0x463d05;};'use strict';var SmsInteractionEvents=require('./smsInteraction.events');var events=[_0x65f6('0x0'),'remove',_0x65f6('0x1')];function createListener(_0x2f06ae,_0x3461cd){return function(_0xbce843){_0x3461cd[_0x65f6('0x2')](_0x2f06ae,_0xbce843);};}function removeListener(_0x5eb9ad,_0x3c5029){return function(){SmsInteractionEvents['removeListener'](_0x5eb9ad,_0x3c5029);};}exports[_0x65f6('0x3')]=function(_0x22b017){for(var _0x4ec221=0x0,_0x4ed98f=events[_0x65f6('0x4')];_0x4ec221<_0x4ed98f;_0x4ec221++){var _0x2c6571=events[_0x4ec221];var _0x112079=createListener(_0x65f6('0x5')+_0x2c6571,_0x22b017);SmsInteractionEvents['on'](_0x2c6571,_0x112079);}}; \ No newline at end of file diff --git a/server/api/smsMessage/index.js b/server/api/smsMessage/index.js index f1ab12c..d5048ae 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 _0x8edc=['post','tracked','sms','smsmessage:create','create','/:id/status','status','put','update','accept','destroy','multer','util','path','connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment','./smsMessage.controller','get','isAuthenticated','describe','/:id','show'];(function(_0x391c55,_0x168617){var _0xa434e0=function(_0x51fa5c){while(--_0x51fa5c){_0x391c55['push'](_0x391c55['shift']());}};_0xa434e0(++_0x168617);}(_0x8edc,0x150));var _0xc8ed=function(_0x1d9aa0,_0x272488){_0x1d9aa0=_0x1d9aa0-0x0;var _0x226868=_0x8edc[_0x1d9aa0];return _0x226868;};'use strict';var multer=require(_0xc8ed('0x0'));var util=require(_0xc8ed('0x1'));var path=require(_0xc8ed('0x2'));var timeout=require(_0xc8ed('0x3'));var express=require(_0xc8ed('0x4'));var router=express['Router']();var auth=require(_0xc8ed('0x5'));var interaction=require(_0xc8ed('0x6'));var config=require(_0xc8ed('0x7'));var controller=require(_0xc8ed('0x8'));router[_0xc8ed('0x9')]('/',auth[_0xc8ed('0xa')](),controller['index']);router[_0xc8ed('0x9')]('/describe',auth[_0xc8ed('0xa')](),controller[_0xc8ed('0xb')]);router[_0xc8ed('0x9')](_0xc8ed('0xc'),auth[_0xc8ed('0xa')](),controller[_0xc8ed('0xd')]);router[_0xc8ed('0xe')]('/',auth[_0xc8ed('0xa')](),interaction[_0xc8ed('0xf')](_0xc8ed('0x10'),_0xc8ed('0x11')),controller[_0xc8ed('0x12')]);router[_0xc8ed('0xe')](_0xc8ed('0x13'),controller[_0xc8ed('0x14')]);router[_0xc8ed('0x15')](_0xc8ed('0xc'),auth[_0xc8ed('0xa')](),controller[_0xc8ed('0x16')]);router['put']('/:id/accept',auth['isAuthenticated'](),controller[_0xc8ed('0x17')]);router[_0xc8ed('0x15')]('/:id/reject',auth[_0xc8ed('0xa')](),controller['reject']);router['delete'](_0xc8ed('0xc'),auth[_0xc8ed('0xa')](),controller[_0xc8ed('0x18')]);module['exports']=router; \ No newline at end of file +var _0x512f=['reject','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','../../components/interaction/service','../../config/environment','./smsMessage.controller','index','get','/describe','isAuthenticated','/:id','post','sms','smsmessage:create','status','put','update','/:id/accept','accept','/:id/reject'];(function(_0x2dafbe,_0x5d04de){var _0x58a45a=function(_0x50ac96){while(--_0x50ac96){_0x2dafbe['push'](_0x2dafbe['shift']());}};_0x58a45a(++_0x5d04de);}(_0x512f,0xc1));var _0xf512=function(_0xf168d3,_0x43dcfc){_0xf168d3=_0xf168d3-0x0;var _0x17fb54=_0x512f[_0xf168d3];return _0x17fb54;};'use strict';var multer=require(_0xf512('0x0'));var util=require(_0xf512('0x1'));var path=require(_0xf512('0x2'));var timeout=require(_0xf512('0x3'));var express=require(_0xf512('0x4'));var router=express[_0xf512('0x5')]();var auth=require('../../components/auth/service');var interaction=require(_0xf512('0x6'));var config=require(_0xf512('0x7'));var controller=require(_0xf512('0x8'));router['get']('/',auth['isAuthenticated'](),controller[_0xf512('0x9')]);router[_0xf512('0xa')](_0xf512('0xb'),auth[_0xf512('0xc')](),controller['describe']);router[_0xf512('0xa')](_0xf512('0xd'),auth[_0xf512('0xc')](),controller['show']);router[_0xf512('0xe')]('/',auth[_0xf512('0xc')](),interaction['tracked'](_0xf512('0xf'),_0xf512('0x10')),controller['create']);router[_0xf512('0xe')]('/:id/status',controller[_0xf512('0x11')]);router[_0xf512('0x12')](_0xf512('0xd'),auth[_0xf512('0xc')](),controller[_0xf512('0x13')]);router[_0xf512('0x12')](_0xf512('0x14'),auth[_0xf512('0xc')](),controller[_0xf512('0x15')]);router[_0xf512('0x12')](_0xf512('0x16'),auth[_0xf512('0xc')](),controller[_0xf512('0x17')]);router[_0xf512('0x18')](_0xf512('0xd'),auth[_0xf512('0xc')](),controller[_0xf512('0x19')]);module[_0xf512('0x1a')]=router; \ No newline at end of file diff --git a/server/api/smsMessage/smsMessage.attributes.js b/server/api/smsMessage/smsMessage.attributes.js index b731d67..2d4a5fe 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 _0x0ea9=['medium','BOOLEAN','ENUM','DATE','sequelize','exports','TEXT'];(function(_0x311c35,_0x534915){var _0x5cc50c=function(_0x3ad680){while(--_0x3ad680){_0x311c35['push'](_0x311c35['shift']());}};_0x5cc50c(++_0x534915);}(_0x0ea9,0xd6));var _0x90ea=function(_0x3b855f,_0x73d290){_0x3b855f=_0x3b855f-0x0;var _0x1b0348=_0x0ea9[_0x3b855f];return _0x1b0348;};'use strict';var Sequelize=require(_0x90ea('0x0'));module[_0x90ea('0x1')]={'body':{'type':Sequelize[_0x90ea('0x2')](_0x90ea('0x3')),'allowNull':![]},'read':{'type':Sequelize[_0x90ea('0x4')],'defaultValue':![]},'direction':{'type':Sequelize[_0x90ea('0x5')]('in','out'),'defaultValue':'out','allowNull':![]},'messageId':{'type':Sequelize['STRING'](0xbe)},'phone':{'type':Sequelize['STRING']},'readAt':{'type':Sequelize[_0x90ea('0x6')]},'secret':{'type':Sequelize[_0x90ea('0x4')],'defaultValue':![]}}; \ No newline at end of file +var _0xa5f1=['ENUM','out','STRING','sequelize','exports','TEXT','medium'];(function(_0x2fa9ef,_0x11eb49){var _0x40a7db=function(_0x387c7c){while(--_0x387c7c){_0x2fa9ef['push'](_0x2fa9ef['shift']());}};_0x40a7db(++_0x11eb49);}(_0xa5f1,0xff));var _0x1a5f=function(_0x24237f,_0x4cf32c){_0x24237f=_0x24237f-0x0;var _0x48298e=_0xa5f1[_0x24237f];return _0x48298e;};'use strict';var Sequelize=require(_0x1a5f('0x0'));module[_0x1a5f('0x1')]={'body':{'type':Sequelize[_0x1a5f('0x2')](_0x1a5f('0x3')),'allowNull':![]},'read':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'direction':{'type':Sequelize[_0x1a5f('0x4')]('in',_0x1a5f('0x5')),'defaultValue':'out','allowNull':![]},'messageId':{'type':Sequelize[_0x1a5f('0x6')](0xbe)},'phone':{'type':Sequelize[_0x1a5f('0x6')]},'readAt':{'type':Sequelize['DATE']},'secret':{'type':Sequelize['BOOLEAN'],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/smsMessage/smsMessage.controller.js b/server/api/smsMessage/smsMessage.controller.js index aba53e4..2a9f176 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 _0xb778=['CmContact','Contact','get','SmsInteraction','isNil','read1stAt','format','interaction','[SMSMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','role','null','AcceptMessage','acceptMessage','manual','SIP/%s','channel','EventManager','acceptmessage','sms-interactions','agent','SmsInteractionId','RejectMessage','rejectMessage','interface','event','debug','received\x20delivery\x20report\x20from','inspect','twilio','MessageSid','messageId','SmsAccount,\x20%s,\x20%s,\x20%s','plivo','MessageUUID','sent','delivered','Status','plivio','results','groupName','DELIVERED','infobip','html-pdf','rimraf','request-promise','moment','bluebird','mustache','util','path','to-csv','ejs','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./smsMessage.socket','register','jayson/promise','http','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','request\x20sent','stringify','error','message','SmsMessage,\x20%s,\x20%s','info','status','end','count','offset','limit','Content-Range','json','reject','save','update','destroy','sendStatus','name','send','index','map','rawAttributes','fieldName','type','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','order','sort','where','pick','filter','VIRTUAL','merge','options','SmsMessage','includeAll','include','findAll','catch','show','params','create','body','find','describe','accept','sms','read','readAt','YYYY-MM-DD\x20HH:mm:ss','UserId','user'];(function(_0x16c57f,_0x251d95){var _0x348ece=function(_0x1dea71){while(--_0x1dea71){_0x16c57f['push'](_0x16c57f['shift']());}};_0x348ece(++_0x251d95);}(_0xb778,0x1c8));var _0x8b77=function(_0x4f0317,_0xb2e5a1){_0x4f0317=_0x4f0317-0x0;var _0x4e24e3=_0xb778[_0x4f0317];return _0x4e24e3;};'use strict';var pdf=require(_0x8b77('0x0'));var emlformat=require('eml-format');var rimraf=require(_0x8b77('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x8b77('0x2'));var moment=require(_0x8b77('0x3'));var BPromise=require(_0x8b77('0x4'));var Mustache=require(_0x8b77('0x5'));var util=require(_0x8b77('0x6'));var path=require(_0x8b77('0x7'));var sox=require('sox');var csv=require(_0x8b77('0x8'));var ejs=require(_0x8b77('0x9'));var fs=require('fs');var _=require('lodash');var squel=require(_0x8b77('0xa'));var crypto=require(_0x8b77('0xb'));var jsforce=require('jsforce');var deskjs=require(_0x8b77('0xc'));var toCsv=require('to-csv');var querystring=require(_0x8b77('0xd'));var Papa=require(_0x8b77('0xe'));var Redis=require(_0x8b77('0xf'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x8b77('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x8b77('0x11'))(_0x8b77('0x12'));var utils=require(_0x8b77('0x13'));var config=require(_0x8b77('0x14'));var db=require(_0x8b77('0x15'))['db'];config[_0x8b77('0x16')]=_[_0x8b77('0x17')](config[_0x8b77('0x16')],{'host':_0x8b77('0x18'),'port':0x18eb});var socket=require(_0x8b77('0x19'))(new Redis(config[_0x8b77('0x16')]));require(_0x8b77('0x1a'))[_0x8b77('0x1b')](socket);var jayson=require(_0x8b77('0x1c'));var client=jayson['client'][_0x8b77('0x1d')]({'port':0x232c});var client9002=jayson[_0x8b77('0x1e')][_0x8b77('0x1d')]({'port':0x232a});function checkPasswordPattern(_0x4008fe,_0x2ebf0a,_0x4bb6b0){if(_0x4bb6b0){var _0x451e7a=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x451e7a[_0x8b77('0x1f')](_0x2ebf0a)){return _0x4008fe;}else{throw new db['Sequelize'][(_0x8b77('0x20'))](_0x8b77('0x21'));}}else{return _0x4008fe;}}function respondWithRpcPromise(_0xd2e0e6,_0x20ca52,_0x5a2ab4,_0x528660){return new BPromise(function(_0x12681a,_0x2b89c7){var _0x43a7dd=_0x528660||client;return _0x43a7dd[_0x8b77('0x22')](_0xd2e0e6,_0x5a2ab4)[_0x8b77('0x23')](function(_0x150576){logger['info']('SmsMessage,\x20%s,\x20%s',_0x20ca52,'request\x20sent');logger['debug']('SmsMessage,\x20%s,\x20%s,\x20%s',_0x20ca52,_0x8b77('0x24'),JSON[_0x8b77('0x25')](_0x150576));if(_0x150576['error']){if(_0x150576[_0x8b77('0x26')]['code']===0x1f4){logger['error']('SmsMessage,\x20%s,\x20%s',_0x20ca52,_0x150576[_0x8b77('0x26')][_0x8b77('0x27')]);return _0x2b89c7(_0x150576['error']['message']);}logger[_0x8b77('0x26')](_0x8b77('0x28'),_0x20ca52,_0x150576['error'][_0x8b77('0x27')]);return _0x12681a(_0x150576[_0x8b77('0x26')][_0x8b77('0x27')]);}else{logger[_0x8b77('0x29')](_0x8b77('0x28'),_0x20ca52,'request\x20sent');_0x12681a(_0x150576['result'][_0x8b77('0x27')]);}})['catch'](function(_0x5ba4ce){logger[_0x8b77('0x26')](_0x8b77('0x28'),_0x20ca52,_0x5ba4ce);_0x2b89c7(_0x5ba4ce);});});}function respondWithStatusCode(_0x4e3e00,_0x1eacaa){_0x1eacaa=_0x1eacaa||0xcc;return function(_0x1d7ef5){if(_0x1d7ef5){return _0x4e3e00['sendStatus'](_0x1eacaa);}return _0x4e3e00[_0x8b77('0x2a')](_0x1eacaa)[_0x8b77('0x2b')]();};}function respondWithResult(_0x5ab235,_0x1118ca){_0x1118ca=_0x1118ca||0xc8;return function(_0x4446fd){if(_0x4446fd){return _0x5ab235['status'](_0x1118ca)['json'](_0x4446fd);}};}function respondWithFilteredResult(_0x27f4f6,_0x553e49){return function(_0x178ed4){if(_0x178ed4){var _0x410f1b=_0x178ed4[_0x8b77('0x2c')],_0x556cdf=_0x553e49[_0x8b77('0x2d')],_0x8ba8a8=_0x553e49[_0x8b77('0x2d')]+_0x553e49[_0x8b77('0x2e')],_0x4e6b06;if(_0x8ba8a8>=_0x410f1b){_0x8ba8a8=_0x410f1b;_0x4e6b06=0xc8;}else{_0x4e6b06=0xce;}_0x27f4f6[_0x8b77('0x2a')](_0x4e6b06);return _0x27f4f6['set'](_0x8b77('0x2f'),_0x556cdf+'-'+_0x8ba8a8+'/'+_0x410f1b)[_0x8b77('0x30')](_0x178ed4);}return null;};}function patchUpdates(_0x51bfb1){return function(_0x133e3a){try{jsonpatch['apply'](_0x133e3a,_0x51bfb1,!![]);}catch(_0x378879){return BPromise[_0x8b77('0x31')](_0x378879);}return _0x133e3a[_0x8b77('0x32')]();};}function saveUpdates(_0x2dd051,_0x229ecf){return function(_0x3d7dda){if(_0x3d7dda){return _0x3d7dda[_0x8b77('0x33')](_0x2dd051)[_0x8b77('0x23')](function(_0xb7bc9f){return _0xb7bc9f;});}return null;};}function removeEntity(_0x4fbf25,_0xcf2af6){return function(_0x49f993){if(_0x49f993){return _0x49f993[_0x8b77('0x34')]()[_0x8b77('0x23')](function(){_0x4fbf25[_0x8b77('0x2a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x35170a,_0x8fbca3){return function(_0x4bd211){if(!_0x4bd211){_0x35170a[_0x8b77('0x35')](0x194);}return _0x4bd211;};}function handleError(_0x357976,_0x1b07a6){_0x1b07a6=_0x1b07a6||0x1f4;return function(_0x31c14d){logger[_0x8b77('0x26')](_0x31c14d['stack']);if(_0x31c14d[_0x8b77('0x36')]){delete _0x31c14d['name'];}_0x357976[_0x8b77('0x2a')](_0x1b07a6)[_0x8b77('0x37')](_0x31c14d);};}exports[_0x8b77('0x38')]=function(_0x21d1e6,_0x454b69){var _0x5e0748={},_0x5d3bed={},_0x3b49a7={'count':0x0,'rows':[]};var _0x356e04=_[_0x8b77('0x39')](db['SmsMessage'][_0x8b77('0x3a')],function(_0x5d82de){return{'name':_0x5d82de[_0x8b77('0x3b')],'type':_0x5d82de[_0x8b77('0x3c')]['key']};});_0x5d3bed[_0x8b77('0x3d')]=_['map'](_0x356e04,_0x8b77('0x36'));_0x5d3bed[_0x8b77('0x3e')]=_[_0x8b77('0x3f')](_0x21d1e6['query']);_0x5d3bed[_0x8b77('0x40')]=_[_0x8b77('0x41')](_0x5d3bed[_0x8b77('0x3d')],_0x5d3bed[_0x8b77('0x3e')]);_0x5e0748['attributes']=_['intersection'](_0x5d3bed[_0x8b77('0x3d')],qs['fields'](_0x21d1e6[_0x8b77('0x3e')][_0x8b77('0x42')]));_0x5e0748[_0x8b77('0x43')]=_0x5e0748[_0x8b77('0x43')][_0x8b77('0x44')]?_0x5e0748[_0x8b77('0x43')]:_0x5d3bed[_0x8b77('0x3d')];if(!_0x21d1e6[_0x8b77('0x3e')][_0x8b77('0x45')]('nolimit')){_0x5e0748['limit']=qs['limit'](_0x21d1e6[_0x8b77('0x3e')]['limit']);_0x5e0748[_0x8b77('0x2d')]=qs[_0x8b77('0x2d')](_0x21d1e6['query'][_0x8b77('0x2d')]);}_0x5e0748[_0x8b77('0x46')]=qs[_0x8b77('0x47')](_0x21d1e6[_0x8b77('0x3e')][_0x8b77('0x47')]);_0x5e0748[_0x8b77('0x48')]=qs[_0x8b77('0x40')](_[_0x8b77('0x49')](_0x21d1e6[_0x8b77('0x3e')],_0x5d3bed[_0x8b77('0x40')]));if(_0x21d1e6[_0x8b77('0x3e')][_0x8b77('0x4a')]){_0x5e0748[_0x8b77('0x48')]=_['merge'](_0x5e0748['where'],{'$or':_[_0x8b77('0x39')](_0x356e04,function(_0x36da7c){if(_0x36da7c[_0x8b77('0x3c')]!==_0x8b77('0x4b')){var _0x371f37={};_0x371f37[_0x36da7c[_0x8b77('0x36')]]={'$like':'%'+_0x21d1e6[_0x8b77('0x3e')][_0x8b77('0x4a')]+'%'};return _0x371f37;}})});}_0x5e0748=_[_0x8b77('0x4c')]({},_0x5e0748,_0x21d1e6[_0x8b77('0x4d')]);var _0xb812b4={'where':_0x5e0748[_0x8b77('0x48')]};return db[_0x8b77('0x4e')]['count'](_0xb812b4)[_0x8b77('0x23')](function(_0x15bdea){_0x3b49a7['count']=_0x15bdea;if(_0x21d1e6[_0x8b77('0x3e')][_0x8b77('0x4f')]){_0x5e0748[_0x8b77('0x50')]=[{'all':!![]}];}return db[_0x8b77('0x4e')][_0x8b77('0x51')](_0x5e0748);})[_0x8b77('0x23')](function(_0x2cca9d){_0x3b49a7['rows']=_0x2cca9d;return _0x3b49a7;})['then'](respondWithFilteredResult(_0x454b69,_0x5e0748))[_0x8b77('0x52')](handleError(_0x454b69,null));};exports[_0x8b77('0x53')]=function(_0x7cfcc6,_0x3ca00a){var _0x49460a={'raw':!![],'where':{'id':_0x7cfcc6[_0x8b77('0x54')]['id']}},_0x182907={};_0x182907['model']=_[_0x8b77('0x3f')](db[_0x8b77('0x4e')]['rawAttributes']);_0x182907[_0x8b77('0x3e')]=_[_0x8b77('0x3f')](_0x7cfcc6[_0x8b77('0x3e')]);_0x182907[_0x8b77('0x40')]=_[_0x8b77('0x41')](_0x182907['model'],_0x182907[_0x8b77('0x3e')]);_0x49460a[_0x8b77('0x43')]=_[_0x8b77('0x41')](_0x182907[_0x8b77('0x3d')],qs[_0x8b77('0x42')](_0x7cfcc6[_0x8b77('0x3e')]['fields']));_0x49460a['attributes']=_0x49460a[_0x8b77('0x43')]['length']?_0x49460a[_0x8b77('0x43')]:_0x182907[_0x8b77('0x3d')];if(_0x7cfcc6[_0x8b77('0x3e')][_0x8b77('0x4f')]){_0x49460a[_0x8b77('0x50')]=[{'all':!![]}];}_0x49460a=_[_0x8b77('0x4c')]({},_0x49460a,_0x7cfcc6[_0x8b77('0x4d')]);return db[_0x8b77('0x4e')]['find'](_0x49460a)[_0x8b77('0x23')](handleEntityNotFound(_0x3ca00a,null))[_0x8b77('0x23')](respondWithResult(_0x3ca00a,null))[_0x8b77('0x52')](handleError(_0x3ca00a,null));};exports[_0x8b77('0x55')]=function(_0x3b6c0a,_0x35bfdb){return db[_0x8b77('0x4e')]['create'](_0x3b6c0a['body'],{})[_0x8b77('0x23')](respondWithResult(_0x35bfdb,0xc9))[_0x8b77('0x52')](handleError(_0x35bfdb,null));};exports[_0x8b77('0x33')]=function(_0x431a8d,_0x552098){if(_0x431a8d[_0x8b77('0x56')]['id']){delete _0x431a8d['body']['id'];}return db[_0x8b77('0x4e')][_0x8b77('0x57')]({'where':{'id':_0x431a8d['params']['id']}})[_0x8b77('0x23')](handleEntityNotFound(_0x552098,null))['then'](saveUpdates(_0x431a8d[_0x8b77('0x56')],null))[_0x8b77('0x23')](respondWithResult(_0x552098,null))[_0x8b77('0x52')](handleError(_0x552098,null));};exports['destroy']=function(_0x53de82,_0x36d797){return db[_0x8b77('0x4e')]['find']({'where':{'id':_0x53de82[_0x8b77('0x54')]['id']}})[_0x8b77('0x23')](handleEntityNotFound(_0x36d797,null))[_0x8b77('0x23')](removeEntity(_0x36d797,null))[_0x8b77('0x52')](handleError(_0x36d797,null));};exports[_0x8b77('0x58')]=function(_0x5d860e,_0x2629b0){return db[_0x8b77('0x4e')][_0x8b77('0x58')]()[_0x8b77('0x23')](respondWithResult(_0x2629b0,null))[_0x8b77('0x52')](handleError(_0x2629b0,null));};var interaction_log=require(_0x8b77('0x11'))('sms-interactions');exports[_0x8b77('0x59')]=function(_0x4ecd3c,_0x11e019,_0x597ec9){var _0x565ff4={'channel':_0x8b77('0x5a')};if(_0x4ecd3c[_0x8b77('0x56')]['id']){delete _0x4ecd3c[_0x8b77('0x56')]['id'];}_0x4ecd3c[_0x8b77('0x56')][_0x8b77('0x5b')]=!![];_0x4ecd3c[_0x8b77('0x56')][_0x8b77('0x5c')]=moment()['format'](_0x8b77('0x5d'));_0x4ecd3c[_0x8b77('0x56')][_0x8b77('0x5e')]=_0x4ecd3c[_0x8b77('0x56')]['UserId']||_0x4ecd3c[_0x8b77('0x5f')]['id'];return db[_0x8b77('0x4e')][_0x8b77('0x57')]({'where':{'id':_0x4ecd3c['params']['id'],'UserId':null},'include':[{'model':db[_0x8b77('0x60')],'as':_0x8b77('0x61')}]})[_0x8b77('0x23')](handleEntityNotFound(_0x11e019,null))[_0x8b77('0x23')](saveUpdates(_0x4ecd3c[_0x8b77('0x56')],null))[_0x8b77('0x23')](function(_0x5ed5ef){if(_0x5ed5ef){_0x565ff4['message']=_0x5ed5ef[_0x8b77('0x62')]({'plain':!![]});return db[_0x8b77('0x63')][_0x8b77('0x57')]({'where':{'id':_0x5ed5ef['SmsInteractionId']}});}return null;})[_0x8b77('0x23')](handleEntityNotFound(_0x11e019,null))[_0x8b77('0x23')](function(_0x1b9bbb){if(_0x1b9bbb){return _0x1b9bbb['update']({'UserId':_0x4ecd3c[_0x8b77('0x56')]['UserId'],'read1stAt':_[_0x8b77('0x64')](_0x1b9bbb[_0x8b77('0x65')])?moment()[_0x8b77('0x66')](_0x8b77('0x5d')):undefined});}return null;})[_0x8b77('0x23')](function(_0x1267a0){if(_0x1267a0){_0x565ff4[_0x8b77('0x67')]=_0x1267a0['get']({'plain':!![]});interaction_log[_0x8b77('0x29')](_0x8b77('0x68'),_0x4ecd3c[_0x8b77('0x5f')]['id'],_0x4ecd3c['user']['name'],_0x4ecd3c['user'][_0x8b77('0x69')],_0x565ff4['interaction']['id'],_0x4ecd3c[_0x8b77('0x56')]?JSON[_0x8b77('0x25')](_0x4ecd3c[_0x8b77('0x56')]):_0x8b77('0x6a'));return respondWithRpcPromise(_0x8b77('0x6b'),_0x8b77('0x6c'),_0x565ff4);}return null;})[_0x8b77('0x23')](function(_0x4c0f13){if(_0x4c0f13){if(_0x4ecd3c['body'][_0x8b77('0x6d')]){_0x565ff4[_0x8b77('0x27')]['interface']=util['format'](_0x8b77('0x6e'),_0x4ecd3c['user'][_0x8b77('0x36')]);_0x565ff4[_0x8b77('0x27')][_0x8b77('0x6f')]=_0x565ff4['channel'];_0x565ff4[_0x8b77('0x27')]['event']=_0x8b77('0x59');return respondWithRpcPromise('EventManager',_0x8b77('0x70'),{'event':_0x8b77('0x71'),'message':_0x565ff4['message']},client9002)[_0x8b77('0x23')](function(){return _0x565ff4;});}return _0x565ff4;}return null;})[_0x8b77('0x23')](respondWithResult(_0x11e019,null))[_0x8b77('0x52')](handleError(_0x11e019,null));};var interaction_log=require(_0x8b77('0x11'))(_0x8b77('0x72'));exports[_0x8b77('0x31')]=function(_0x612f21,_0x51fb49,_0x575bcf){var _0x5ccde9={'agent':{},'channel':_0x8b77('0x5a')};if(_0x612f21[_0x8b77('0x56')]['id']){delete _0x612f21[_0x8b77('0x56')]['id'];}_0x612f21[_0x8b77('0x56')][_0x8b77('0x5e')]=_0x612f21['body']['UserId']||_0x612f21[_0x8b77('0x5f')]['id'];_0x5ccde9[_0x8b77('0x73')]['id']=_0x612f21[_0x8b77('0x56')][_0x8b77('0x5e')];return db[_0x8b77('0x4e')][_0x8b77('0x57')]({'where':{'id':_0x612f21[_0x8b77('0x54')]['id'],'UserId':null}})[_0x8b77('0x23')](handleEntityNotFound(_0x51fb49,null))['then'](function(_0x2ada52){if(_0x2ada52){_0x5ccde9[_0x8b77('0x27')]=_0x2ada52[_0x8b77('0x62')]({'plain':!![]});return db['SmsInteraction']['find']({'where':{'id':_0x2ada52[_0x8b77('0x74')]}});}return null;})[_0x8b77('0x23')](handleEntityNotFound(_0x51fb49,null))[_0x8b77('0x23')](function(_0x246877){if(_0x246877){_0x5ccde9['interaction']=_0x246877['get']({'plain':!![]});interaction_log[_0x8b77('0x29')]('[SMSMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s',_0x612f21[_0x8b77('0x5f')]['id'],_0x612f21[_0x8b77('0x5f')]['name'],_0x612f21[_0x8b77('0x5f')][_0x8b77('0x69')],_0x5ccde9['interaction']['id'],_0x612f21['body']?JSON[_0x8b77('0x25')](_0x612f21['body']):'null');return respondWithRpcPromise(_0x8b77('0x75'),_0x8b77('0x76'),_0x5ccde9);}return null;})[_0x8b77('0x23')](function(_0x589298){if(_0x589298){_0x589298['message'][_0x8b77('0x77')]=util[_0x8b77('0x66')]('SIP/%s',_0x612f21['user'][_0x8b77('0x36')]);_0x589298[_0x8b77('0x27')][_0x8b77('0x6f')]=_0x5ccde9[_0x8b77('0x6f')];_0x589298[_0x8b77('0x27')][_0x8b77('0x78')]='reject';respondWithRpcPromise(_0x8b77('0x70'),_0x8b77('0x70'),{'event':'rejectmessage','message':_0x589298[_0x8b77('0x27')]},client9002);return _0x5ccde9;}return null;})[_0x8b77('0x23')](respondWithResult(_0x51fb49,null))[_0x8b77('0x52')](handleError(_0x51fb49,null));};exports['status']=function(_0x9ff32f,_0xcf4178,_0x1ec986){if(_0x9ff32f[_0x8b77('0x56')]['id']){delete _0x9ff32f[_0x8b77('0x56')]['id'];}var _0x3e41c2;return db[_0x8b77('0x4e')]['find']({'where':{'id':_0x9ff32f['params']['id']}})[_0x8b77('0x23')](handleEntityNotFound(_0xcf4178,null))[_0x8b77('0x23')](function(_0x32bbd2){if(_0x32bbd2){_0x3e41c2=_0x32bbd2;return db['SmsAccount'][_0x8b77('0x57')]({'where':{'id':_0x32bbd2['SmsAccountId']}});}})[_0x8b77('0x23')](handleEntityNotFound(_0xcf4178,null))[_0x8b77('0x23')](function(_0x579ff8){if(_0x579ff8){logger[_0x8b77('0x79')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0x8b77('0x2a'),_0x8b77('0x7a'),_0x579ff8[_0x8b77('0x3c')],util[_0x8b77('0x7b')](_0x9ff32f[_0x8b77('0x56')],{'showHidden':![],'depth':null}));switch(_0x579ff8[_0x8b77('0x3c')]){case _0x8b77('0x7c'):if(_0x9ff32f[_0x8b77('0x56')][_0x8b77('0x7d')]&&_0x9ff32f['body']['MessageSid']===_0x3e41c2[_0x8b77('0x7e')]){return _0x3e41c2['update']({'read':!![]});}else{logger[_0x8b77('0x26')](_0x8b77('0x7f'),_0x8b77('0x2a'),_0x8b77('0x7c'),util['inspect'](_0x9ff32f[_0x8b77('0x56')],{'showHidden':![],'depth':null}));}break;case _0x8b77('0x80'):if(_0x9ff32f['body']['MessageUUID']&&_0x9ff32f[_0x8b77('0x56')][_0x8b77('0x81')]===_0x3e41c2['messageId']&&_['indexOf']([_0x8b77('0x82'),_0x8b77('0x83')],_0x9ff32f[_0x8b77('0x56')][_0x8b77('0x84')])>=0x0){return _0x3e41c2[_0x8b77('0x33')]({'read':!![]});}else{logger['error']('SmsAccount,\x20%s,\x20%s,\x20%s',_0x8b77('0x2a'),_0x8b77('0x85'),util['inspect'](_0x9ff32f[_0x8b77('0x56')],{'showHidden':![],'depth':null}));}break;case'infobip':var _0x2416bf=_0x9ff32f['body'][_0x8b77('0x86')][0x0];if(_0x2416bf['status'][_0x8b77('0x87')]===_0x8b77('0x88')){return _0x3e41c2[_0x8b77('0x33')]({'read':!![]});}else{logger[_0x8b77('0x26')](_0x8b77('0x7f'),'status',_0x8b77('0x89'),util['inspect'](_0x9ff32f[_0x8b77('0x56')],{'showHidden':![],'depth':null}));}break;}return _0x3e41c2;}})['then'](respondWithResult(_0xcf4178,null))[_0x8b77('0x52')](handleError(_0xcf4178,null));}; \ No newline at end of file +var _0xf069=['user','CmContact','Contact','get','SmsInteractionId','UserId','isNil','read1stAt','interaction','[SMSMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','role','null','AcceptMessage','manual','interface','channel','event','accept','EventManager','../../config/logger','sms','SmsInteraction','[SMSMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','RejectMessage','rejectmessage','SmsAccountId','received\x20delivery\x20report\x20from','inspect','twilio','messageId','SmsAccount,\x20%s,\x20%s,\x20%s','plivo','MessageUUID','sent','delivered','Status','plivio','results','groupName','DELIVERED','infobip','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','sox','to-csv','ejs','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./smsMessage.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','request\x20sent','debug','SmsMessage,\x20%s,\x20%s,\x20%s','error','SmsMessage,\x20%s,\x20%s','message','catch','sendStatus','status','end','json','count','offset','limit','set','Content-Range','apply','reject','save','update','then','destroy','stack','name','map','SmsMessage','fieldName','type','key','model','query','keys','intersection','fields','attributes','nolimit','order','sort','filters','filter','where','merge','VIRTUAL','options','includeAll','findAll','rows','rawAttributes','length','include','find','create','body','params','describe','sms-interactions','readAt','format','YYYY-MM-DD\x20HH:mm:ss'];(function(_0x18d5d7,_0x19074b){var _0x30a9ea=function(_0x514f3f){while(--_0x514f3f){_0x18d5d7['push'](_0x18d5d7['shift']());}};_0x30a9ea(++_0x19074b);}(_0xf069,0x1ca));var _0x9f06=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xf069[_0x3dd15e];return _0x231fd0;};'use strict';var pdf=require(_0x9f06('0x0'));var emlformat=require(_0x9f06('0x1'));var rimraf=require(_0x9f06('0x2'));var zipdir=require(_0x9f06('0x3'));var jsonpatch=require(_0x9f06('0x4'));var rp=require(_0x9f06('0x5'));var moment=require(_0x9f06('0x6'));var BPromise=require('bluebird');var Mustache=require(_0x9f06('0x7'));var util=require(_0x9f06('0x8'));var path=require(_0x9f06('0x9'));var sox=require(_0x9f06('0xa'));var csv=require(_0x9f06('0xb'));var ejs=require(_0x9f06('0xc'));var fs=require('fs');var _=require('lodash');var squel=require(_0x9f06('0xd'));var crypto=require(_0x9f06('0xe'));var jsforce=require(_0x9f06('0xf'));var deskjs=require(_0x9f06('0x10'));var toCsv=require('to-csv');var querystring=require(_0x9f06('0x11'));var Papa=require(_0x9f06('0x12'));var Redis=require(_0x9f06('0x13'));var authService=require(_0x9f06('0x14'));var qs=require(_0x9f06('0x15'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x9f06('0x16'));var logger=require('../../config/logger')('api');var utils=require('../../config/utils');var config=require('../../config/environment');var db=require(_0x9f06('0x17'))['db'];config[_0x9f06('0x18')]=_[_0x9f06('0x19')](config[_0x9f06('0x18')],{'host':_0x9f06('0x1a'),'port':0x18eb});var socket=require(_0x9f06('0x1b'))(new Redis(config[_0x9f06('0x18')]));require(_0x9f06('0x1c'))[_0x9f06('0x1d')](socket);var jayson=require(_0x9f06('0x1e'));var client=jayson[_0x9f06('0x1f')][_0x9f06('0x20')]({'port':0x232c});var client9002=jayson[_0x9f06('0x1f')][_0x9f06('0x20')]({'port':0x232a});function checkPasswordPattern(_0x36a17e,_0x1638fc,_0x7137d2){if(_0x7137d2){var _0x3fd100=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x3fd100[_0x9f06('0x21')](_0x1638fc)){return _0x36a17e;}else{throw new db[(_0x9f06('0x22'))][(_0x9f06('0x23'))](_0x9f06('0x24'));}}else{return _0x36a17e;}}function respondWithRpcPromise(_0x3bc113,_0x5282db,_0x1e9533,_0x347de7){return new BPromise(function(_0x35840e,_0x3bd278){var _0x6e4456=_0x347de7||client;return _0x6e4456[_0x9f06('0x25')](_0x3bc113,_0x1e9533)['then'](function(_0x522cff){logger[_0x9f06('0x26')]('SmsMessage,\x20%s,\x20%s',_0x5282db,_0x9f06('0x27'));logger[_0x9f06('0x28')](_0x9f06('0x29'),_0x5282db,_0x9f06('0x27'),JSON['stringify'](_0x522cff));if(_0x522cff[_0x9f06('0x2a')]){if(_0x522cff['error']['code']===0x1f4){logger[_0x9f06('0x2a')](_0x9f06('0x2b'),_0x5282db,_0x522cff['error']['message']);return _0x3bd278(_0x522cff['error']['message']);}logger[_0x9f06('0x2a')](_0x9f06('0x2b'),_0x5282db,_0x522cff[_0x9f06('0x2a')][_0x9f06('0x2c')]);return _0x35840e(_0x522cff[_0x9f06('0x2a')][_0x9f06('0x2c')]);}else{logger['info'](_0x9f06('0x2b'),_0x5282db,_0x9f06('0x27'));_0x35840e(_0x522cff['result'][_0x9f06('0x2c')]);}})[_0x9f06('0x2d')](function(_0x7847c8){logger[_0x9f06('0x2a')](_0x9f06('0x2b'),_0x5282db,_0x7847c8);_0x3bd278(_0x7847c8);});});}function respondWithStatusCode(_0x1b98d5,_0x1dde18){_0x1dde18=_0x1dde18||0xcc;return function(_0xaeccc){if(_0xaeccc){return _0x1b98d5[_0x9f06('0x2e')](_0x1dde18);}return _0x1b98d5[_0x9f06('0x2f')](_0x1dde18)[_0x9f06('0x30')]();};}function respondWithResult(_0x207ed8,_0x4a3207){_0x4a3207=_0x4a3207||0xc8;return function(_0x58abda){if(_0x58abda){return _0x207ed8[_0x9f06('0x2f')](_0x4a3207)[_0x9f06('0x31')](_0x58abda);}};}function respondWithFilteredResult(_0x144c25,_0x3bb76c){return function(_0x4887ca){if(_0x4887ca){var _0x266ba5=_0x4887ca[_0x9f06('0x32')],_0x511b28=_0x3bb76c[_0x9f06('0x33')],_0x242e03=_0x3bb76c['offset']+_0x3bb76c[_0x9f06('0x34')],_0x20f57d;if(_0x242e03>=_0x266ba5){_0x242e03=_0x266ba5;_0x20f57d=0xc8;}else{_0x20f57d=0xce;}_0x144c25['status'](_0x20f57d);return _0x144c25[_0x9f06('0x35')](_0x9f06('0x36'),_0x511b28+'-'+_0x242e03+'/'+_0x266ba5)[_0x9f06('0x31')](_0x4887ca);}return null;};}function patchUpdates(_0x333438){return function(_0x40461f){try{jsonpatch[_0x9f06('0x37')](_0x40461f,_0x333438,!![]);}catch(_0x4bcba0){return BPromise[_0x9f06('0x38')](_0x4bcba0);}return _0x40461f[_0x9f06('0x39')]();};}function saveUpdates(_0x539ab9,_0x510e46){return function(_0x121c51){if(_0x121c51){return _0x121c51[_0x9f06('0x3a')](_0x539ab9)[_0x9f06('0x3b')](function(_0x105b2d){return _0x105b2d;});}return null;};}function removeEntity(_0x37519a,_0x577f53){return function(_0x49db40){if(_0x49db40){return _0x49db40[_0x9f06('0x3c')]()['then'](function(){_0x37519a['status'](0xcc)[_0x9f06('0x30')]();});}};}function handleEntityNotFound(_0x1cc609,_0x25f72e){return function(_0x46cf56){if(!_0x46cf56){_0x1cc609[_0x9f06('0x2e')](0x194);}return _0x46cf56;};}function handleError(_0x38c1d8,_0x2664c6){_0x2664c6=_0x2664c6||0x1f4;return function(_0x3ea8a2){logger['error'](_0x3ea8a2[_0x9f06('0x3d')]);if(_0x3ea8a2[_0x9f06('0x3e')]){delete _0x3ea8a2[_0x9f06('0x3e')];}_0x38c1d8['status'](_0x2664c6)['send'](_0x3ea8a2);};}exports['index']=function(_0x2043af,_0xe7c5e5){var _0x144489={},_0x34da7d={},_0xfc6f86={'count':0x0,'rows':[]};var _0x847088=_[_0x9f06('0x3f')](db[_0x9f06('0x40')]['rawAttributes'],function(_0x4156b7){return{'name':_0x4156b7[_0x9f06('0x41')],'type':_0x4156b7[_0x9f06('0x42')][_0x9f06('0x43')]};});_0x34da7d[_0x9f06('0x44')]=_['map'](_0x847088,_0x9f06('0x3e'));_0x34da7d[_0x9f06('0x45')]=_[_0x9f06('0x46')](_0x2043af[_0x9f06('0x45')]);_0x34da7d['filters']=_[_0x9f06('0x47')](_0x34da7d['model'],_0x34da7d[_0x9f06('0x45')]);_0x144489['attributes']=_['intersection'](_0x34da7d[_0x9f06('0x44')],qs[_0x9f06('0x48')](_0x2043af[_0x9f06('0x45')][_0x9f06('0x48')]));_0x144489[_0x9f06('0x49')]=_0x144489[_0x9f06('0x49')]['length']?_0x144489[_0x9f06('0x49')]:_0x34da7d[_0x9f06('0x44')];if(!_0x2043af[_0x9f06('0x45')]['hasOwnProperty'](_0x9f06('0x4a'))){_0x144489[_0x9f06('0x34')]=qs['limit'](_0x2043af[_0x9f06('0x45')][_0x9f06('0x34')]);_0x144489[_0x9f06('0x33')]=qs[_0x9f06('0x33')](_0x2043af[_0x9f06('0x45')]['offset']);}_0x144489[_0x9f06('0x4b')]=qs[_0x9f06('0x4c')](_0x2043af[_0x9f06('0x45')][_0x9f06('0x4c')]);_0x144489['where']=qs[_0x9f06('0x4d')](_['pick'](_0x2043af[_0x9f06('0x45')],_0x34da7d[_0x9f06('0x4d')]));if(_0x2043af['query'][_0x9f06('0x4e')]){_0x144489[_0x9f06('0x4f')]=_[_0x9f06('0x50')](_0x144489[_0x9f06('0x4f')],{'$or':_[_0x9f06('0x3f')](_0x847088,function(_0x2ffa1b){if(_0x2ffa1b[_0x9f06('0x42')]!==_0x9f06('0x51')){var _0x571af4={};_0x571af4[_0x2ffa1b['name']]={'$like':'%'+_0x2043af[_0x9f06('0x45')][_0x9f06('0x4e')]+'%'};return _0x571af4;}})});}_0x144489=_[_0x9f06('0x50')]({},_0x144489,_0x2043af[_0x9f06('0x52')]);var _0x5dbd5b={'where':_0x144489[_0x9f06('0x4f')]};return db[_0x9f06('0x40')][_0x9f06('0x32')](_0x5dbd5b)[_0x9f06('0x3b')](function(_0x449bb9){_0xfc6f86[_0x9f06('0x32')]=_0x449bb9;if(_0x2043af[_0x9f06('0x45')][_0x9f06('0x53')]){_0x144489['include']=[{'all':!![]}];}return db[_0x9f06('0x40')][_0x9f06('0x54')](_0x144489);})[_0x9f06('0x3b')](function(_0x20cc0d){_0xfc6f86[_0x9f06('0x55')]=_0x20cc0d;return _0xfc6f86;})[_0x9f06('0x3b')](respondWithFilteredResult(_0xe7c5e5,_0x144489))[_0x9f06('0x2d')](handleError(_0xe7c5e5,null));};exports['show']=function(_0x1883dc,_0x553807){var _0x20a0d4={'raw':!![],'where':{'id':_0x1883dc['params']['id']}},_0x2d1202={};_0x2d1202[_0x9f06('0x44')]=_[_0x9f06('0x46')](db[_0x9f06('0x40')][_0x9f06('0x56')]);_0x2d1202[_0x9f06('0x45')]=_[_0x9f06('0x46')](_0x1883dc[_0x9f06('0x45')]);_0x2d1202['filters']=_[_0x9f06('0x47')](_0x2d1202['model'],_0x2d1202[_0x9f06('0x45')]);_0x20a0d4[_0x9f06('0x49')]=_['intersection'](_0x2d1202[_0x9f06('0x44')],qs[_0x9f06('0x48')](_0x1883dc[_0x9f06('0x45')][_0x9f06('0x48')]));_0x20a0d4[_0x9f06('0x49')]=_0x20a0d4[_0x9f06('0x49')][_0x9f06('0x57')]?_0x20a0d4['attributes']:_0x2d1202[_0x9f06('0x44')];if(_0x1883dc[_0x9f06('0x45')]['includeAll']){_0x20a0d4[_0x9f06('0x58')]=[{'all':!![]}];}_0x20a0d4=_[_0x9f06('0x50')]({},_0x20a0d4,_0x1883dc[_0x9f06('0x52')]);return db[_0x9f06('0x40')][_0x9f06('0x59')](_0x20a0d4)['then'](handleEntityNotFound(_0x553807,null))[_0x9f06('0x3b')](respondWithResult(_0x553807,null))[_0x9f06('0x2d')](handleError(_0x553807,null));};exports[_0x9f06('0x5a')]=function(_0xcc7c80,_0x13ab86){return db[_0x9f06('0x40')][_0x9f06('0x5a')](_0xcc7c80[_0x9f06('0x5b')],{})[_0x9f06('0x3b')](respondWithResult(_0x13ab86,0xc9))[_0x9f06('0x2d')](handleError(_0x13ab86,null));};exports[_0x9f06('0x3a')]=function(_0x1d80de,_0x1d5192){if(_0x1d80de[_0x9f06('0x5b')]['id']){delete _0x1d80de[_0x9f06('0x5b')]['id'];}return db[_0x9f06('0x40')][_0x9f06('0x59')]({'where':{'id':_0x1d80de[_0x9f06('0x5c')]['id']}})[_0x9f06('0x3b')](handleEntityNotFound(_0x1d5192,null))['then'](saveUpdates(_0x1d80de[_0x9f06('0x5b')],null))[_0x9f06('0x3b')](respondWithResult(_0x1d5192,null))[_0x9f06('0x2d')](handleError(_0x1d5192,null));};exports[_0x9f06('0x3c')]=function(_0x399e5a,_0x133100){return db[_0x9f06('0x40')]['find']({'where':{'id':_0x399e5a[_0x9f06('0x5c')]['id']}})[_0x9f06('0x3b')](handleEntityNotFound(_0x133100,null))[_0x9f06('0x3b')](removeEntity(_0x133100,null))['catch'](handleError(_0x133100,null));};exports[_0x9f06('0x5d')]=function(_0x2e39e5,_0x205ae4){return db[_0x9f06('0x40')][_0x9f06('0x5d')]()['then'](respondWithResult(_0x205ae4,null))[_0x9f06('0x2d')](handleError(_0x205ae4,null));};var interaction_log=require('../../config/logger')(_0x9f06('0x5e'));exports['accept']=function(_0x74e0e7,_0x39aea1,_0x1633a7){var _0xfa6763={'channel':'sms'};if(_0x74e0e7['body']['id']){delete _0x74e0e7[_0x9f06('0x5b')]['id'];}_0x74e0e7['body']['read']=!![];_0x74e0e7['body'][_0x9f06('0x5f')]=moment()[_0x9f06('0x60')](_0x9f06('0x61'));_0x74e0e7[_0x9f06('0x5b')]['UserId']=_0x74e0e7['body']['UserId']||_0x74e0e7[_0x9f06('0x62')]['id'];return db[_0x9f06('0x40')][_0x9f06('0x59')]({'where':{'id':_0x74e0e7[_0x9f06('0x5c')]['id'],'UserId':null},'include':[{'model':db[_0x9f06('0x63')],'as':_0x9f06('0x64')}]})['then'](handleEntityNotFound(_0x39aea1,null))[_0x9f06('0x3b')](saveUpdates(_0x74e0e7['body'],null))['then'](function(_0x5c0873){if(_0x5c0873){_0xfa6763[_0x9f06('0x2c')]=_0x5c0873[_0x9f06('0x65')]({'plain':!![]});return db['SmsInteraction'][_0x9f06('0x59')]({'where':{'id':_0x5c0873[_0x9f06('0x66')]}});}return null;})['then'](handleEntityNotFound(_0x39aea1,null))['then'](function(_0x12ca9c){if(_0x12ca9c){return _0x12ca9c[_0x9f06('0x3a')]({'UserId':_0x74e0e7[_0x9f06('0x5b')][_0x9f06('0x67')],'read1stAt':_[_0x9f06('0x68')](_0x12ca9c[_0x9f06('0x69')])?moment()[_0x9f06('0x60')](_0x9f06('0x61')):undefined});}return null;})[_0x9f06('0x3b')](function(_0xff006b){if(_0xff006b){_0xfa6763[_0x9f06('0x6a')]=_0xff006b[_0x9f06('0x65')]({'plain':!![]});interaction_log[_0x9f06('0x26')](_0x9f06('0x6b'),_0x74e0e7['user']['id'],_0x74e0e7[_0x9f06('0x62')]['name'],_0x74e0e7[_0x9f06('0x62')][_0x9f06('0x6c')],_0xfa6763[_0x9f06('0x6a')]['id'],_0x74e0e7['body']?JSON['stringify'](_0x74e0e7[_0x9f06('0x5b')]):_0x9f06('0x6d'));return respondWithRpcPromise(_0x9f06('0x6e'),'acceptMessage',_0xfa6763);}return null;})[_0x9f06('0x3b')](function(_0xe4a760){if(_0xe4a760){if(_0x74e0e7[_0x9f06('0x5b')][_0x9f06('0x6f')]){_0xfa6763[_0x9f06('0x2c')][_0x9f06('0x70')]=util[_0x9f06('0x60')]('SIP/%s',_0x74e0e7[_0x9f06('0x62')][_0x9f06('0x3e')]);_0xfa6763[_0x9f06('0x2c')][_0x9f06('0x71')]=_0xfa6763['channel'];_0xfa6763[_0x9f06('0x2c')][_0x9f06('0x72')]=_0x9f06('0x73');return respondWithRpcPromise(_0x9f06('0x74'),_0x9f06('0x74'),{'event':'acceptmessage','message':_0xfa6763[_0x9f06('0x2c')]},client9002)['then'](function(){return _0xfa6763;});}return _0xfa6763;}return null;})['then'](respondWithResult(_0x39aea1,null))[_0x9f06('0x2d')](handleError(_0x39aea1,null));};var interaction_log=require(_0x9f06('0x75'))(_0x9f06('0x5e'));exports[_0x9f06('0x38')]=function(_0x1e0806,_0x5d03b3,_0x87e17e){var _0x5a18f5={'agent':{},'channel':_0x9f06('0x76')};if(_0x1e0806[_0x9f06('0x5b')]['id']){delete _0x1e0806[_0x9f06('0x5b')]['id'];}_0x1e0806[_0x9f06('0x5b')][_0x9f06('0x67')]=_0x1e0806[_0x9f06('0x5b')][_0x9f06('0x67')]||_0x1e0806['user']['id'];_0x5a18f5['agent']['id']=_0x1e0806[_0x9f06('0x5b')][_0x9f06('0x67')];return db[_0x9f06('0x40')][_0x9f06('0x59')]({'where':{'id':_0x1e0806[_0x9f06('0x5c')]['id'],'UserId':null}})[_0x9f06('0x3b')](handleEntityNotFound(_0x5d03b3,null))[_0x9f06('0x3b')](function(_0x214a68){if(_0x214a68){_0x5a18f5[_0x9f06('0x2c')]=_0x214a68[_0x9f06('0x65')]({'plain':!![]});return db[_0x9f06('0x77')]['find']({'where':{'id':_0x214a68[_0x9f06('0x66')]}});}return null;})['then'](handleEntityNotFound(_0x5d03b3,null))['then'](function(_0x16d312){if(_0x16d312){_0x5a18f5[_0x9f06('0x6a')]=_0x16d312['get']({'plain':!![]});interaction_log[_0x9f06('0x26')](_0x9f06('0x78'),_0x1e0806[_0x9f06('0x62')]['id'],_0x1e0806[_0x9f06('0x62')][_0x9f06('0x3e')],_0x1e0806[_0x9f06('0x62')][_0x9f06('0x6c')],_0x5a18f5[_0x9f06('0x6a')]['id'],_0x1e0806[_0x9f06('0x5b')]?JSON['stringify'](_0x1e0806['body']):_0x9f06('0x6d'));return respondWithRpcPromise(_0x9f06('0x79'),'rejectMessage',_0x5a18f5);}return null;})[_0x9f06('0x3b')](function(_0xff22f9){if(_0xff22f9){_0xff22f9['message']['interface']=util[_0x9f06('0x60')]('SIP/%s',_0x1e0806[_0x9f06('0x62')]['name']);_0xff22f9['message'][_0x9f06('0x71')]=_0x5a18f5['channel'];_0xff22f9[_0x9f06('0x2c')][_0x9f06('0x72')]=_0x9f06('0x38');respondWithRpcPromise(_0x9f06('0x74'),'EventManager',{'event':_0x9f06('0x7a'),'message':_0xff22f9[_0x9f06('0x2c')]},client9002);return _0x5a18f5;}return null;})[_0x9f06('0x3b')](respondWithResult(_0x5d03b3,null))['catch'](handleError(_0x5d03b3,null));};exports[_0x9f06('0x2f')]=function(_0x379f64,_0x3d272d,_0x422e9d){if(_0x379f64[_0x9f06('0x5b')]['id']){delete _0x379f64[_0x9f06('0x5b')]['id'];}var _0x42bb0b;return db[_0x9f06('0x40')]['find']({'where':{'id':_0x379f64['params']['id']}})[_0x9f06('0x3b')](handleEntityNotFound(_0x3d272d,null))[_0x9f06('0x3b')](function(_0x22486b){if(_0x22486b){_0x42bb0b=_0x22486b;return db['SmsAccount'][_0x9f06('0x59')]({'where':{'id':_0x22486b[_0x9f06('0x7b')]}});}})[_0x9f06('0x3b')](handleEntityNotFound(_0x3d272d,null))[_0x9f06('0x3b')](function(_0x5734b0){if(_0x5734b0){logger['debug']('SmsMessage,\x20%s,\x20%s,\x20%s',_0x9f06('0x2f'),_0x9f06('0x7c'),_0x5734b0[_0x9f06('0x42')],util[_0x9f06('0x7d')](_0x379f64[_0x9f06('0x5b')],{'showHidden':![],'depth':null}));switch(_0x5734b0[_0x9f06('0x42')]){case _0x9f06('0x7e'):if(_0x379f64[_0x9f06('0x5b')]['MessageSid']&&_0x379f64[_0x9f06('0x5b')]['MessageSid']===_0x42bb0b[_0x9f06('0x7f')]){return _0x42bb0b['update']({'read':!![]});}else{logger['error'](_0x9f06('0x80'),_0x9f06('0x2f'),'twilio',util[_0x9f06('0x7d')](_0x379f64['body'],{'showHidden':![],'depth':null}));}break;case _0x9f06('0x81'):if(_0x379f64['body'][_0x9f06('0x82')]&&_0x379f64['body'][_0x9f06('0x82')]===_0x42bb0b[_0x9f06('0x7f')]&&_['indexOf']([_0x9f06('0x83'),_0x9f06('0x84')],_0x379f64[_0x9f06('0x5b')][_0x9f06('0x85')])>=0x0){return _0x42bb0b[_0x9f06('0x3a')]({'read':!![]});}else{logger[_0x9f06('0x2a')](_0x9f06('0x80'),_0x9f06('0x2f'),_0x9f06('0x86'),util[_0x9f06('0x7d')](_0x379f64[_0x9f06('0x5b')],{'showHidden':![],'depth':null}));}break;case'infobip':var _0xbdd51a=_0x379f64[_0x9f06('0x5b')][_0x9f06('0x87')][0x0];if(_0xbdd51a[_0x9f06('0x2f')][_0x9f06('0x88')]===_0x9f06('0x89')){return _0x42bb0b[_0x9f06('0x3a')]({'read':!![]});}else{logger[_0x9f06('0x2a')]('SmsAccount,\x20%s,\x20%s,\x20%s',_0x9f06('0x2f'),_0x9f06('0x8a'),util['inspect'](_0x379f64[_0x9f06('0x5b')],{'showHidden':![],'depth':null}));}break;}return _0x42bb0b;}})['then'](respondWithResult(_0x3d272d,null))[_0x9f06('0x2d')](handleError(_0x3d272d,null));}; \ No newline at end of file diff --git a/server/api/smsMessage/smsMessage.events.js b/server/api/smsMessage/smsMessage.events.js index ca0e4c0..6cf8540 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 _0xee27=['exports','events','SmsMessage','setMaxListeners','save','update','emit'];(function(_0x34f306,_0x3ffa56){var _0xe5c29b=function(_0x45a6df){while(--_0x45a6df){_0x34f306['push'](_0x34f306['shift']());}};_0xe5c29b(++_0x3ffa56);}(_0xee27,0x1c8));var _0x7ee2=function(_0x4346b0,_0x223cf1){_0x4346b0=_0x4346b0-0x0;var _0xc4f3ae=_0xee27[_0x4346b0];return _0xc4f3ae;};'use strict';var EventEmitter=require(_0x7ee2('0x0'));var SmsMessage=require('../../mysqldb')['db'][_0x7ee2('0x1')];var SmsMessageEvents=new EventEmitter();SmsMessageEvents[_0x7ee2('0x2')](0x0);var events={'afterCreate':_0x7ee2('0x3'),'afterUpdate':_0x7ee2('0x4'),'afterDestroy':'remove'};function emitEvent(_0x47842f){return function(_0x1f5caa,_0x350e55,_0x3c916c){SmsMessageEvents[_0x7ee2('0x5')](_0x47842f+':'+_0x1f5caa['id'],_0x1f5caa);SmsMessageEvents['emit'](_0x47842f,_0x1f5caa);_0x3c916c(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];SmsMessage['hook'](e,emitEvent(event));}}module[_0x7ee2('0x6')]=SmsMessageEvents; \ No newline at end of file +var _0x1f90=['update','remove','emit','hasOwnProperty','hook','exports','events','../../mysqldb','setMaxListeners'];(function(_0x5065d9,_0x3999b9){var _0x32c625=function(_0x3acecb){while(--_0x3acecb){_0x5065d9['push'](_0x5065d9['shift']());}};_0x32c625(++_0x3999b9);}(_0x1f90,0x180));var _0x01f9=function(_0x88a98e,_0x56668b){_0x88a98e=_0x88a98e-0x0;var _0x23eede=_0x1f90[_0x88a98e];return _0x23eede;};'use strict';var EventEmitter=require(_0x01f9('0x0'));var SmsMessage=require(_0x01f9('0x1'))['db']['SmsMessage'];var SmsMessageEvents=new EventEmitter();SmsMessageEvents[_0x01f9('0x2')](0x0);var events={'afterCreate':'save','afterUpdate':_0x01f9('0x3'),'afterDestroy':_0x01f9('0x4')};function emitEvent(_0x553028){return function(_0x5345d8,_0x5e0330,_0x5f5b6b){SmsMessageEvents[_0x01f9('0x5')](_0x553028+':'+_0x5345d8['id'],_0x5345d8);SmsMessageEvents[_0x01f9('0x5')](_0x553028,_0x5345d8);_0x5f5b6b(null);};}for(var e in events){if(events[_0x01f9('0x6')](e)){var event=events[e];SmsMessage[_0x01f9('0x7')](e,emitEvent(event));}}module[_0x01f9('0x8')]=SmsMessageEvents; \ No newline at end of file diff --git a/server/api/smsMessage/smsMessage.model.js b/server/api/smsMessage/smsMessage.model.js index 7aac17e..294cc16 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 _0xcb01=['length','apiKey','createHash','md5','digest','signature=','/external/get/send.php?','id_sms','csc','clickatell','https://platform.clickatell.com/messages','UTF-8','apiMessageId','Missing\x20parameters:\x20apiKey','Bearer\x20','code','https://api.intelepeer.com/_rest/v4/app/sms/mdr','message','refid','status','intelepeer','finally','utf8mb4','utf8mb4_unicode_ci','lodash','util','../../config/logger','api','moment','request-promise','path','rimraf','../../config/environment','./smsMessage.attributes','exports','define','SmsMessage','sms_messages','fti_sms_messages','FULLTEXT','models','get','direction','toLowerCase','out','secret','isNil','UserId','SmsInteraction','findOne','then','update','createdAt','catch','error','SmsAccount','type','twilio','accountSid','authToken','messages','create','body','phone','/api/sms/messages/','/status?token=','token','sid','SmsMessage,\x20%s,\x20%s,\x20%s','afterCreate','inspect','https://api.skebby.it/API/v1.0/REST/','username','password','smsMethod','sender','&password=','GET','split','POST','user_key','session_key','internal_order_id','deliveryReport','read','skebby','connectel','https://smsapi.connectel.se/api/send/','requestid','xCALLY\x20Motion','senderString','%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','remote','https://api.plivo.com/v1/Account/%s/Message/','message_uuid','Missing\x20parameters:\x20authId,\x20authToken','infobip','baseUrl','/auth/1/session','/sms/2/text/advanced','application/json','Missing\x20parameters:\x20base_url','login','text','timestamp','keys','sort'];(function(_0x4b369d,_0x265eb8){var _0x571a98=function(_0x56341a){while(--_0x56341a){_0x4b369d['push'](_0x4b369d['shift']());}};_0x571a98(++_0x265eb8);}(_0xcb01,0x180));var _0x1cb0=function(_0x5108a6,_0x2fae39){_0x5108a6=_0x5108a6-0x0;var _0x52717f=_0xcb01[_0x5108a6];return _0x52717f;};'use strict';var _=require(_0x1cb0('0x0'));var util=require(_0x1cb0('0x1'));var logger=require(_0x1cb0('0x2'))(_0x1cb0('0x3'));var moment=require(_0x1cb0('0x4'));var BPromise=require('bluebird');var rp=require(_0x1cb0('0x5'));var fs=require('fs');var path=require(_0x1cb0('0x6'));var rimraf=require(_0x1cb0('0x7'));var config=require(_0x1cb0('0x8'));var attributes=require(_0x1cb0('0x9'));module[_0x1cb0('0xa')]=function(_0x31bebb,_0x44526a){return _0x31bebb[_0x1cb0('0xb')](_0x1cb0('0xc'),attributes,{'tableName':_0x1cb0('0xd'),'paranoid':![],'indexes':[{'name':'messageId','fields':['messageId']},{'name':_0x1cb0('0xe'),'fields':['body'],'type':_0x1cb0('0xf')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x1c4daf,_0x2e6f4a,_0x43f742){var _0x11265e=_0x31bebb[_0x1cb0('0x10')];var _0x48074e=_0x1c4daf[_0x1cb0('0x11')]({'plain':!![]});if(_0x48074e[_0x1cb0('0x12')][_0x1cb0('0x13')]()==='in'||_0x48074e[_0x1cb0('0x12')][_0x1cb0('0x13')]()===_0x1cb0('0x14')&&!_0x48074e[_0x1cb0('0x15')]&&!_[_0x1cb0('0x16')](_0x48074e[_0x1cb0('0x17')])){_0x11265e[_0x1cb0('0x18')][_0x1cb0('0x19')]({'where':{'id':_0x48074e['SmsInteractionId']}})[_0x1cb0('0x1a')](function(_0x56320e){if(_0x56320e){_0x56320e[_0x1cb0('0x1b')]({'lastMsgAt':_0x48074e[_0x1cb0('0x1c')],'lastMsgDirection':_0x48074e[_0x1cb0('0x12')][_0x1cb0('0x13')]()});}})[_0x1cb0('0x1d')](function(_0x19ce68){console[_0x1cb0('0x1e')](_0x19ce68);});}if(_0x48074e[_0x1cb0('0x12')]==='out'&&!_0x48074e[_0x1cb0('0x15')]){var _0x3845a2;_0x11265e[_0x1cb0('0x1f')]['find']({'where':{'id':_0x48074e['SmsAccountId']},'raw':!![]})[_0x1cb0('0x1a')](function(_0x1dfadf){_0x3845a2=_0x1dfadf;if(_0x3845a2&&_0x3845a2['type']){switch(_0x3845a2[_0x1cb0('0x20')]){case _0x1cb0('0x21'):var _0x3afbe4=require(_0x1cb0('0x21'));if(_0x3845a2[_0x1cb0('0x22')]&&_0x3845a2[_0x1cb0('0x23')]&&_0x3845a2['phone']){var _0x3f22e4=new _0x3afbe4(_0x3845a2[_0x1cb0('0x22')],_0x3845a2[_0x1cb0('0x23')]);_0x3f22e4[_0x1cb0('0x24')][_0x1cb0('0x25')]({'body':_0x48074e[_0x1cb0('0x26')],'to':_0x48074e[_0x1cb0('0x27')],'from':_0x3845a2[_0x1cb0('0x27')],'statusCallback':_0x3845a2['remote']+_0x1cb0('0x28')+_0x48074e['id']+_0x1cb0('0x29')+_0x3845a2[_0x1cb0('0x2a')]})[_0x1cb0('0x1a')](function(_0x223575){if(_0x223575[_0x1cb0('0x2b')]){return _0x1c4daf[_0x1cb0('0x1b')]({'messageId':_0x223575['sid']});}})[_0x1cb0('0x1d')](function(_0x2587ff){logger[_0x1cb0('0x1e')](_0x1cb0('0x2c'),_0x1cb0('0x2d'),_0x1cb0('0x21'),util[_0x1cb0('0x2e')](_0x2587ff,{'showHidden':![],'depth':null}));});}else{logger['error'](_0x1cb0('0x2c'),'afterCreate',_0x1cb0('0x21'),'Missing\x20parameters:\x20phone,\x20accountSid\x20or\x20authToken');}break;case'skebby':var _0x16322a=_0x1cb0('0x2f');if(_0x3845a2[_0x1cb0('0x30')]&&_0x3845a2[_0x1cb0('0x31')]){var _0x11e243={'recipient':[_0x48074e[_0x1cb0('0x27')]],'message':_0x48074e['body'],'message_type':_0x3845a2['smsMethod']};if(_0x3845a2[_0x1cb0('0x32')]&&_0x3845a2[_0x1cb0('0x32')]!=='SI'){_0x11e243[_0x1cb0('0x33')]=_0x3845a2[_0x1cb0('0x27')];}var _0x200c72={'url':_0x16322a+'login?username='+_0x3845a2[_0x1cb0('0x30')]+_0x1cb0('0x34')+_0x3845a2[_0x1cb0('0x31')],'method':_0x1cb0('0x35')};rp(_0x200c72)[_0x1cb0('0x1a')](function(_0x5b0d37){var _0x35d38=_0x5b0d37[_0x1cb0('0x36')](';');var _0x307c92={'user_key':_0x35d38[0x0],'session_key':_0x35d38[0x1]};_0x200c72={'url':_0x16322a+'sms','method':_0x1cb0('0x37'),'headers':{'user_key':_0x307c92[_0x1cb0('0x38')],'Session_key':_0x307c92[_0x1cb0('0x39')]},'json':!![],'body':_0x11e243};return rp(_0x200c72);})[_0x1cb0('0x1a')](function(_0x5447f3){if(_0x5447f3['total_sent']>=0x1){var _0x48456b={'messageId':_0x5447f3[_0x1cb0('0x3a')]};if(_0x3845a2[_0x1cb0('0x32')]!=='GP'||!_0x3845a2[_0x1cb0('0x3b')]){_0x48456b[_0x1cb0('0x3c')]=!![];}return _0x1c4daf['update'](_0x48456b);}else{return logger[_0x1cb0('0x1e')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0x1cb0('0x2d'),_0x1cb0('0x3d'),util[_0x1cb0('0x2e')](_0x5447f3,{'showHidden':![],'depth':null}));}})['catch'](function(_0x56d042){return logger['error'](_0x1cb0('0x2c'),_0x1cb0('0x2d'),'skebby',util[_0x1cb0('0x2e')](_0x56d042,{'showHidden':![],'depth':null}));});}else{logger[_0x1cb0('0x1e')]('SmsMessage,\x20%s,\x20%s,\x20%s','afterCreate',_0x1cb0('0x3d'),'Missing\x20parameters:\x20username,\x20password');}break;case _0x1cb0('0x3e'):if(_0x3845a2['authToken']){var _0x15d52d={'recipient':_0x48074e[_0x1cb0('0x27')],'message':_0x48074e[_0x1cb0('0x26')],'sender':_0x3845a2['senderString']||_0x3845a2[_0x1cb0('0x27')],'authorization':_0x3845a2[_0x1cb0('0x23')]};var _0x2e6f4a={'method':_0x1cb0('0x37'),'uri':_0x1cb0('0x3f'),'body':_0x15d52d,'json':!![]};rp(_0x2e6f4a)[_0x1cb0('0x1a')](function(_0x5a746c){var _0x163386={'messageId':_0x5a746c[_0x1cb0('0x40')]};if(!_0x3845a2[_0x1cb0('0x3b')]){_0x163386[_0x1cb0('0x3c')]=!![];}return _0x1c4daf[_0x1cb0('0x1b')](_0x163386);})[_0x1cb0('0x1d')](function(_0x4a9627){logger['error'](_0x1cb0('0x2c'),'afterCreate',_0x1cb0('0x3e'),util[_0x1cb0('0x2e')](_0x4a9627,{'showHidden':![],'depth':null}));});}else{logger[_0x1cb0('0x1e')](_0x1cb0('0x2c'),_0x1cb0('0x2d'),_0x1cb0('0x3e'),'Missing\x20parameters:\x20authToken');}break;case'clicksend':if(_0x3845a2['username']&&_0x3845a2[_0x1cb0('0x31')]){var _0x15d52d={'messages':[{'source':_0x1cb0('0x41'),'to':_0x48074e[_0x1cb0('0x27')],'body':_0x48074e['body'],'from':_0x3845a2[_0x1cb0('0x42')]||_0x3845a2[_0x1cb0('0x27')]}]};var _0x4afc6b=util['format'](_0x1cb0('0x43'),_0x3845a2['username'],_0x3845a2[_0x1cb0('0x31')]);var _0x2e6f4a={'method':'POST','uri':_0x1cb0('0x44'),'body':_0x15d52d,'headers':{'Authorization':util[_0x1cb0('0x45')](_0x1cb0('0x46'),new Buffer(_0x4afc6b)[_0x1cb0('0x47')](_0x1cb0('0x48')))},'json':!![]};rp(_0x2e6f4a)[_0x1cb0('0x1a')](function(_0x34fa25){if(_0x34fa25[_0x1cb0('0x49')]>=0xc8&&_0x34fa25['http_code']<=0xce){if(_0x34fa25[_0x1cb0('0x4a')]&&_0x34fa25[_0x1cb0('0x4a')][_0x1cb0('0x4b')]>0x0){var _0x5e82a4=_[_0x1cb0('0x4c')](_0x34fa25['data'][_0x1cb0('0x24')]);var _0x4c8249={'messageId':_0x5e82a4[_0x1cb0('0x4d')]};if(!_0x3845a2[_0x1cb0('0x3b')]){_0x4c8249['read']=!![];}return _0x1c4daf[_0x1cb0('0x1b')](_0x4c8249);}else{logger[_0x1cb0('0x1e')](_0x1cb0('0x2c'),_0x1cb0('0x2d'),'clickSend',util['inspect'](_0x34fa25,{'showHidden':![],'depth':null}));}}else{logger['error']('SmsMessage,\x20%s,\x20%s,\x20%s',_0x1cb0('0x2d'),_0x1cb0('0x4e'),util[_0x1cb0('0x2e')](_0x34fa25,{'showHidden':![],'depth':null}));}})['catch'](function(_0x200791){logger[_0x1cb0('0x1e')](_0x1cb0('0x2c'),_0x1cb0('0x2d'),_0x1cb0('0x4e'),util[_0x1cb0('0x2e')](_0x200791,{'showHidden':![],'depth':null}));});}else{logger[_0x1cb0('0x1e')](_0x1cb0('0x2c'),_0x1cb0('0x2d'),_0x1cb0('0x4e'),'Missing\x20parameters:\x20username,\x20password');}break;case _0x1cb0('0x4f'):if(_0x3845a2[_0x1cb0('0x50')]&&_0x3845a2[_0x1cb0('0x23')]){var _0x15d52d={'dst':_0x48074e['phone'],'text':_0x48074e['body'],'src':_0x3845a2['senderString']||_0x3845a2[_0x1cb0('0x27')],'url':_0x3845a2[_0x1cb0('0x51')]+_0x1cb0('0x28')+_0x48074e['id']+_0x1cb0('0x29')+_0x3845a2[_0x1cb0('0x2a')]};var _0x4afc6b=util[_0x1cb0('0x45')](_0x1cb0('0x43'),_0x3845a2[_0x1cb0('0x50')],_0x3845a2[_0x1cb0('0x23')]);var _0x2e6f4a={'method':_0x1cb0('0x37'),'uri':util[_0x1cb0('0x45')](_0x1cb0('0x52'),_0x3845a2['authId']),'body':_0x15d52d,'headers':{'Authorization':util[_0x1cb0('0x45')]('Basic\x20%s',new Buffer(_0x4afc6b)['toString']('base64'))},'json':!![]};rp(_0x2e6f4a)[_0x1cb0('0x1a')](function(_0x152165){var _0x29db24={'messageId':_0x152165[_0x1cb0('0x53')][0x0]};return _0x1c4daf[_0x1cb0('0x1b')](_0x29db24);})[_0x1cb0('0x1d')](function(_0x56d09d){logger[_0x1cb0('0x1e')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0x1cb0('0x2d'),'plivo',util['inspect'](_0x56d09d,{'showHidden':![],'depth':null}));});}else{logger[_0x1cb0('0x1e')](_0x1cb0('0x2c'),_0x1cb0('0x2d'),_0x1cb0('0x4f'),_0x1cb0('0x54'));}break;case _0x1cb0('0x55'):if(_0x3845a2[_0x1cb0('0x30')]&&_0x3845a2[_0x1cb0('0x31')]){if(_0x3845a2[_0x1cb0('0x56')]){var _0x1abe46={'method':'POST','uri':_0x3845a2['baseUrl']+_0x1cb0('0x57'),'body':{'username':_0x3845a2['username'],'password':_0x3845a2[_0x1cb0('0x31')]},'json':!![]};return rp(_0x1abe46)['then'](function(_0x15049e){var _0x18cd0b={'method':_0x1cb0('0x37'),'uri':_0x3845a2[_0x1cb0('0x56')]+_0x1cb0('0x58'),'body':{'messages':[{'from':_0x3845a2['phone'],'destinations':[{'to':_0x48074e[_0x1cb0('0x27')]}],'text':_0x48074e[_0x1cb0('0x26')],'notifyUrl':_0x3845a2[_0x1cb0('0x51')]+'/api/sms/messages/'+_0x48074e['id']+_0x1cb0('0x29')+_0x3845a2[_0x1cb0('0x2a')],'notifyContentType':_0x1cb0('0x59'),'callbackData':_0x3845a2[_0x1cb0('0x27')]+';'+_0x48074e[_0x1cb0('0x26')]}]},'headers':{'Authorization':'IBSSO\x20'+_0x15049e['token']},'json':!![]};return rp(_0x18cd0b)[_0x1cb0('0x1a')](function(_0x497f80){if(_0x497f80[_0x1cb0('0x24')]){var _0x234394={'messageId':_0x497f80[_0x1cb0('0x24')][0x0]['messageId']};if(!_0x3845a2[_0x1cb0('0x3b')]){_0x234394[_0x1cb0('0x3c')]=!![];}return _0x1c4daf[_0x1cb0('0x1b')](_0x234394);}else{return logger[_0x1cb0('0x1e')](_0x1cb0('0x2c'),_0x1cb0('0x2d'),_0x1cb0('0x55'),util[_0x1cb0('0x2e')](_0x497f80,{'showHidden':![],'depth':null}));}});})[_0x1cb0('0x1d')](function(_0x334241){return logger[_0x1cb0('0x1e')](_0x1cb0('0x2c'),_0x1cb0('0x2d'),_0x1cb0('0x55'),util[_0x1cb0('0x2e')](_0x334241,{'showHidden':![],'depth':null}));});}else{logger[_0x1cb0('0x1e')](_0x1cb0('0x2c'),_0x1cb0('0x2d'),_0x1cb0('0x55'),_0x1cb0('0x5a'));}}else{logger[_0x1cb0('0x1e')](_0x1cb0('0x2c'),'afterCreate',_0x1cb0('0x55'),'Missing\x20parameters:\x20username,\x20password');}break;case'csc':var _0x4deb24=require('crypto');if(_0x3845a2['apiKey']){var _0x3d79c6={};_0x3d79c6[_0x1cb0('0x5b')]=_0x3845a2[_0x1cb0('0x30')];_0x3d79c6[_0x1cb0('0x27')]=_0x48074e[_0x1cb0('0x27')];_0x3d79c6[_0x1cb0('0x33')]=_0x3845a2[_0x1cb0('0x27')];_0x3d79c6[_0x1cb0('0x5c')]=_0x48074e[_0x1cb0('0x26')];_0x3d79c6[_0x1cb0('0x5d')]=+new Date();var _0x11e9d7='';var _0x5eafac='';var _0x57d0e4=Object[_0x1cb0('0x5e')](_0x3d79c6);_0x57d0e4[_0x1cb0('0x5f')]();for(var _0x4912f8=0x0;_0x4912f8<_0x57d0e4[_0x1cb0('0x60')];_0x4912f8++){if(_0x11e9d7!=''){_0x11e9d7+='&';}_0x11e9d7+=_0x57d0e4[_0x4912f8]+'='+encodeURIComponent(_0x3d79c6[_0x57d0e4[_0x4912f8]]);_0x5eafac+=_0x3d79c6[_0x57d0e4[_0x4912f8]];}_0x5eafac+=_0x3845a2[_0x1cb0('0x61')];_0x5eafac=_0x4deb24[_0x1cb0('0x62')](_0x1cb0('0x63'))['update'](_0x5eafac)[_0x1cb0('0x64')]('hex');if(_0x11e9d7!==''){_0x11e9d7+='&';}_0x11e9d7+=_0x1cb0('0x65')+_0x5eafac;var _0x200c72={'method':_0x1cb0('0x35'),'uri':_0x3845a2[_0x1cb0('0x56')]+_0x1cb0('0x66')+_0x11e9d7,'json':!![]};return rp(_0x200c72)[_0x1cb0('0x1a')](function(_0x96822a){var _0x46d00a=Object[_0x1cb0('0x5e')](_0x96822a);if(_0x96822a[_0x46d00a[0x0]]['error']&&parseInt(_0x96822a[_0x46d00a[0x0]]['error'])===0x0){var _0x3be984={'messageId':_0x96822a[_0x46d00a[0x0]][_0x1cb0('0x67')]};if(!_0x3845a2[_0x1cb0('0x3b')]){_0x3be984[_0x1cb0('0x3c')]=!![];}return _0x1c4daf[_0x1cb0('0x1b')](_0x3be984);}else{return logger[_0x1cb0('0x1e')](_0x1cb0('0x2c'),_0x1cb0('0x2d'),_0x1cb0('0x68'),util['inspect'](_0x96822a[_0x1cb0('0x1e')],{'showHidden':![],'depth':null}));}})[_0x1cb0('0x1d')](function(_0x30d3b8){return logger['error']('SmsMessage,\x20%s,\x20%s,\x20%s',_0x1cb0('0x2d'),'csc',util['inspect'](_0x30d3b8,{'showHidden':![],'depth':null}));});}else{logger['error'](_0x1cb0('0x2c'),_0x1cb0('0x2d'),_0x1cb0('0x68'),'Missing\x20parameters:\x20apiKey');}break;case _0x1cb0('0x69'):if(_0x3845a2[_0x1cb0('0x61')]){var _0xe5dc9={'method':_0x1cb0('0x37'),'uri':_0x1cb0('0x6a'),'headers':{'Authorization':_0x3845a2[_0x1cb0('0x61')]},'body':{'content':_0x48074e['body'],'to':[_0x48074e[_0x1cb0('0x27')]],'from':_0x3845a2[_0x1cb0('0x27')],'binary':![],'clientMessageId':'uuid','charset':_0x1cb0('0x6b')},'json':!![]};rp(_0xe5dc9)[_0x1cb0('0x1a')](function(_0x3ff6db){if(!_0x3ff6db[_0x1cb0('0x1e')]){var _0x4c5f94={'messageId':_0x3ff6db[_0x1cb0('0x24')][0x0][_0x1cb0('0x6c')]};if(!_0x3845a2[_0x1cb0('0x3b')]){_0x4c5f94[_0x1cb0('0x3c')]=!![];}return _0x1c4daf['update'](_0x4c5f94);}else{return logger['error'](_0x1cb0('0x2c'),_0x1cb0('0x2d'),_0x1cb0('0x69'),util[_0x1cb0('0x2e')](_0x3ff6db['error'],{'showHidden':![],'depth':null}));}})['catch'](function(_0x2a400e){return logger[_0x1cb0('0x1e')](_0x1cb0('0x2c'),'afterCreate','clickatell',util['inspect'](_0x2a400e,{'showHidden':![],'depth':null}));});}else{logger[_0x1cb0('0x1e')](_0x1cb0('0x2c'),'afterCreate','clickatell',_0x1cb0('0x6d'));}break;case'intelepeer':if(_0x3845a2['apiKey']){var _0x2c429a={};var _0x200c72={'method':_0x1cb0('0x37'),'uri':'https://api.intelepeer.com/_rest/v4/app/sms/send','headers':{'Authorization':_0x1cb0('0x6e')+_0x3845a2[_0x1cb0('0x61')],'Content-Type':_0x1cb0('0x59')},'body':{'from':_0x3845a2[_0x1cb0('0x27')],'to':_0x48074e[_0x1cb0('0x27')],'text':_0x48074e[_0x1cb0('0x26')]},'json':!![]};return rp(_0x200c72)['then'](function(_0xe7d9f){if(_0xe7d9f[_0x1cb0('0x6f')]==0xca){_0x2c429a['message']=_0xe7d9f;var _0x578468={'method':_0x1cb0('0x37'),'uri':_0x1cb0('0x70'),'headers':{'Authorization':_0x1cb0('0x6e')+_0x3845a2['apiKey'],'Content-Type':_0x1cb0('0x59')},'body':{'refid':_0x2c429a[_0x1cb0('0x71')][_0x1cb0('0x72')]},'json':!![]};return rp(_0x578468)[_0x1cb0('0x1a')](function(_0x34764d){_0x2c429a[_0x1cb0('0x73')]=_0x34764d;var _0x17c00e={'messageId':_0x2c429a[_0x1cb0('0x71')][_0x1cb0('0x72')],'read':!![]};return _0x1c4daf['update'](_0x17c00e);});}else{return logger[_0x1cb0('0x1e')](_0x1cb0('0x2c'),'afterCreate',_0x1cb0('0x74'),util['inspect'](_0xe7d9f,{'showHidden':![],'depth':null}));}})[_0x1cb0('0x1d')](function(_0x3e3e7c){return logger['error']('SmsMessage,\x20%s,\x20%s,\x20%s',_0x1cb0('0x2d'),_0x1cb0('0x74'),util[_0x1cb0('0x2e')](_0x3e3e7c,{'showHidden':![],'depth':null}));});}else{return logger[_0x1cb0('0x1e')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0x1cb0('0x2d'),_0x1cb0('0x74'),'Token\x20not\x20received');}break;}}})[_0x1cb0('0x75')](function(){_0x43f742();});}else{_0x43f742();}}},'charset':_0x1cb0('0x76'),'collate':_0x1cb0('0x77')});}; \ No newline at end of file +var _0xc21c=['Bearer\x20','code','message','https://api.intelepeer.com/_rest/v4/app/sms/mdr','refid','status','Token\x20not\x20received','finally','utf8mb4','utf8mb4_unicode_ci','lodash','util','api','moment','bluebird','request-promise','rimraf','../../config/environment','./smsMessage.attributes','exports','define','sms_messages','messageId','fti_sms_messages','FULLTEXT','models','direction','toLowerCase','secret','isNil','UserId','findOne','then','update','createdAt','catch','SmsAccount','find','SmsAccountId','type','twilio','accountSid','authToken','phone','messages','remote','/api/sms/messages/','/status?token=','token','error','SmsMessage,\x20%s,\x20%s,\x20%s','afterCreate','Missing\x20parameters:\x20phone,\x20accountSid\x20or\x20authToken','skebby','https://api.skebby.it/API/v1.0/REST/','username','password','smsMethod','login?username=','sms','POST','session_key','total_sent','read','inspect','Missing\x20parameters:\x20username,\x20password','connectel','body','senderString','https://smsapi.connectel.se/api/send/','requestid','deliveryReport','xCALLY\x20Motion','format','%s:%s','https://rest.clicksend.com/v3/sms/send','Basic\x20%s','toString','http_code','data','head','message_id','clickSend','authId','https://api.plivo.com/v1/Account/%s/Message/','base64','message_uuid','plivo','infobip','baseUrl','/auth/1/session','/sms/2/text/advanced','application/json','Missing\x20parameters:\x20base_url','csc','crypto','login','text','timestamp','keys','sort','length','createHash','md5','digest','hex','GET','/external/get/send.php?','id_sms','clickatell','apiKey','uuid','UTF-8','apiMessageId','intelepeer','https://api.intelepeer.com/_rest/v4/app/sms/send'];(function(_0xfe544f,_0x30b369){var _0x159ffb=function(_0x3c09ec){while(--_0x3c09ec){_0xfe544f['push'](_0xfe544f['shift']());}};_0x159ffb(++_0x30b369);}(_0xc21c,0x166));var _0xcc21=function(_0x16ab94,_0x5bd9cf){_0x16ab94=_0x16ab94-0x0;var _0x18b3d6=_0xc21c[_0x16ab94];return _0x18b3d6;};'use strict';var _=require(_0xcc21('0x0'));var util=require(_0xcc21('0x1'));var logger=require('../../config/logger')(_0xcc21('0x2'));var moment=require(_0xcc21('0x3'));var BPromise=require(_0xcc21('0x4'));var rp=require(_0xcc21('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0xcc21('0x6'));var config=require(_0xcc21('0x7'));var attributes=require(_0xcc21('0x8'));module[_0xcc21('0x9')]=function(_0x1ff108,_0x2409e5){return _0x1ff108[_0xcc21('0xa')]('SmsMessage',attributes,{'tableName':_0xcc21('0xb'),'paranoid':![],'indexes':[{'name':_0xcc21('0xc'),'fields':[_0xcc21('0xc')]},{'name':_0xcc21('0xd'),'fields':['body'],'type':_0xcc21('0xe')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x5cade6,_0x412a15,_0x4ecf6a){var _0x446165=_0x1ff108[_0xcc21('0xf')];var _0x502845=_0x5cade6['get']({'plain':!![]});if(_0x502845[_0xcc21('0x10')][_0xcc21('0x11')]()==='in'||_0x502845['direction'][_0xcc21('0x11')]()==='out'&&!_0x502845[_0xcc21('0x12')]&&!_[_0xcc21('0x13')](_0x502845[_0xcc21('0x14')])){_0x446165['SmsInteraction'][_0xcc21('0x15')]({'where':{'id':_0x502845['SmsInteractionId']}})[_0xcc21('0x16')](function(_0x35b642){if(_0x35b642){_0x35b642[_0xcc21('0x17')]({'lastMsgAt':_0x502845[_0xcc21('0x18')],'lastMsgDirection':_0x502845[_0xcc21('0x10')][_0xcc21('0x11')]()});}})[_0xcc21('0x19')](function(_0x5b3cd2){console['error'](_0x5b3cd2);});}if(_0x502845[_0xcc21('0x10')]==='out'&&!_0x502845[_0xcc21('0x12')]){var _0x207b02;_0x446165[_0xcc21('0x1a')][_0xcc21('0x1b')]({'where':{'id':_0x502845[_0xcc21('0x1c')]},'raw':!![]})['then'](function(_0x30f62e){_0x207b02=_0x30f62e;if(_0x207b02&&_0x207b02[_0xcc21('0x1d')]){switch(_0x207b02[_0xcc21('0x1d')]){case _0xcc21('0x1e'):var _0x5c4417=require(_0xcc21('0x1e'));if(_0x207b02[_0xcc21('0x1f')]&&_0x207b02[_0xcc21('0x20')]&&_0x207b02[_0xcc21('0x21')]){var _0x21e12c=new _0x5c4417(_0x207b02['accountSid'],_0x207b02[_0xcc21('0x20')]);_0x21e12c[_0xcc21('0x22')]['create']({'body':_0x502845['body'],'to':_0x502845[_0xcc21('0x21')],'from':_0x207b02['phone'],'statusCallback':_0x207b02[_0xcc21('0x23')]+_0xcc21('0x24')+_0x502845['id']+_0xcc21('0x25')+_0x207b02[_0xcc21('0x26')]})[_0xcc21('0x16')](function(_0x266c92){if(_0x266c92['sid']){return _0x5cade6[_0xcc21('0x17')]({'messageId':_0x266c92['sid']});}})[_0xcc21('0x19')](function(_0x3a5c4a){logger[_0xcc21('0x27')](_0xcc21('0x28'),'afterCreate',_0xcc21('0x1e'),util['inspect'](_0x3a5c4a,{'showHidden':![],'depth':null}));});}else{logger[_0xcc21('0x27')](_0xcc21('0x28'),_0xcc21('0x29'),_0xcc21('0x1e'),_0xcc21('0x2a'));}break;case _0xcc21('0x2b'):var _0x1addf8=_0xcc21('0x2c');if(_0x207b02[_0xcc21('0x2d')]&&_0x207b02[_0xcc21('0x2e')]){var _0x5b85b3={'recipient':[_0x502845[_0xcc21('0x21')]],'message':_0x502845['body'],'message_type':_0x207b02[_0xcc21('0x2f')]};if(_0x207b02[_0xcc21('0x2f')]&&_0x207b02[_0xcc21('0x2f')]!=='SI'){_0x5b85b3['sender']=_0x207b02[_0xcc21('0x21')];}var _0x4ba7a3={'url':_0x1addf8+_0xcc21('0x30')+_0x207b02['username']+'&password='+_0x207b02['password'],'method':'GET'};rp(_0x4ba7a3)[_0xcc21('0x16')](function(_0x5efa67){var _0x18992e=_0x5efa67['split'](';');var _0x3e580e={'user_key':_0x18992e[0x0],'session_key':_0x18992e[0x1]};_0x4ba7a3={'url':_0x1addf8+_0xcc21('0x31'),'method':_0xcc21('0x32'),'headers':{'user_key':_0x3e580e['user_key'],'Session_key':_0x3e580e[_0xcc21('0x33')]},'json':!![],'body':_0x5b85b3};return rp(_0x4ba7a3);})[_0xcc21('0x16')](function(_0x110424){if(_0x110424[_0xcc21('0x34')]>=0x1){var _0x56b983={'messageId':_0x110424['internal_order_id']};if(_0x207b02[_0xcc21('0x2f')]!=='GP'||!_0x207b02['deliveryReport']){_0x56b983[_0xcc21('0x35')]=!![];}return _0x5cade6[_0xcc21('0x17')](_0x56b983);}else{return logger[_0xcc21('0x27')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0xcc21('0x29'),'skebby',util['inspect'](_0x110424,{'showHidden':![],'depth':null}));}})[_0xcc21('0x19')](function(_0x277f1e){return logger['error'](_0xcc21('0x28'),_0xcc21('0x29'),_0xcc21('0x2b'),util[_0xcc21('0x36')](_0x277f1e,{'showHidden':![],'depth':null}));});}else{logger[_0xcc21('0x27')](_0xcc21('0x28'),'afterCreate',_0xcc21('0x2b'),_0xcc21('0x37'));}break;case _0xcc21('0x38'):if(_0x207b02[_0xcc21('0x20')]){var _0x5a02f9={'recipient':_0x502845['phone'],'message':_0x502845[_0xcc21('0x39')],'sender':_0x207b02[_0xcc21('0x3a')]||_0x207b02[_0xcc21('0x21')],'authorization':_0x207b02['authToken']};var _0x412a15={'method':_0xcc21('0x32'),'uri':_0xcc21('0x3b'),'body':_0x5a02f9,'json':!![]};rp(_0x412a15)[_0xcc21('0x16')](function(_0x4aec97){var _0x4e35d9={'messageId':_0x4aec97[_0xcc21('0x3c')]};if(!_0x207b02[_0xcc21('0x3d')]){_0x4e35d9['read']=!![];}return _0x5cade6[_0xcc21('0x17')](_0x4e35d9);})[_0xcc21('0x19')](function(_0x5277ba){logger[_0xcc21('0x27')](_0xcc21('0x28'),_0xcc21('0x29'),_0xcc21('0x38'),util[_0xcc21('0x36')](_0x5277ba,{'showHidden':![],'depth':null}));});}else{logger['error'](_0xcc21('0x28'),_0xcc21('0x29'),_0xcc21('0x38'),'Missing\x20parameters:\x20authToken');}break;case'clicksend':if(_0x207b02['username']&&_0x207b02[_0xcc21('0x2e')]){var _0x5a02f9={'messages':[{'source':_0xcc21('0x3e'),'to':_0x502845[_0xcc21('0x21')],'body':_0x502845[_0xcc21('0x39')],'from':_0x207b02['senderString']||_0x207b02[_0xcc21('0x21')]}]};var _0x27b8d7=util[_0xcc21('0x3f')](_0xcc21('0x40'),_0x207b02[_0xcc21('0x2d')],_0x207b02[_0xcc21('0x2e')]);var _0x412a15={'method':_0xcc21('0x32'),'uri':_0xcc21('0x41'),'body':_0x5a02f9,'headers':{'Authorization':util[_0xcc21('0x3f')](_0xcc21('0x42'),new Buffer(_0x27b8d7)[_0xcc21('0x43')]('base64'))},'json':!![]};rp(_0x412a15)['then'](function(_0x48addd){if(_0x48addd[_0xcc21('0x44')]>=0xc8&&_0x48addd[_0xcc21('0x44')]<=0xce){if(_0x48addd[_0xcc21('0x45')]&&_0x48addd['data']['queued_count']>0x0){var _0x512d67=_[_0xcc21('0x46')](_0x48addd[_0xcc21('0x45')][_0xcc21('0x22')]);var _0x2a1bbc={'messageId':_0x512d67[_0xcc21('0x47')]};if(!_0x207b02[_0xcc21('0x3d')]){_0x2a1bbc[_0xcc21('0x35')]=!![];}return _0x5cade6['update'](_0x2a1bbc);}else{logger['error'](_0xcc21('0x28'),_0xcc21('0x29'),_0xcc21('0x48'),util['inspect'](_0x48addd,{'showHidden':![],'depth':null}));}}else{logger[_0xcc21('0x27')](_0xcc21('0x28'),_0xcc21('0x29'),_0xcc21('0x48'),util['inspect'](_0x48addd,{'showHidden':![],'depth':null}));}})[_0xcc21('0x19')](function(_0x905020){logger[_0xcc21('0x27')](_0xcc21('0x28'),_0xcc21('0x29'),_0xcc21('0x48'),util[_0xcc21('0x36')](_0x905020,{'showHidden':![],'depth':null}));});}else{logger[_0xcc21('0x27')]('SmsMessage,\x20%s,\x20%s,\x20%s','afterCreate','clickSend','Missing\x20parameters:\x20username,\x20password');}break;case'plivo':if(_0x207b02[_0xcc21('0x49')]&&_0x207b02[_0xcc21('0x20')]){var _0x5a02f9={'dst':_0x502845[_0xcc21('0x21')],'text':_0x502845[_0xcc21('0x39')],'src':_0x207b02[_0xcc21('0x3a')]||_0x207b02[_0xcc21('0x21')],'url':_0x207b02[_0xcc21('0x23')]+_0xcc21('0x24')+_0x502845['id']+_0xcc21('0x25')+_0x207b02['token']};var _0x27b8d7=util['format']('%s:%s',_0x207b02[_0xcc21('0x49')],_0x207b02[_0xcc21('0x20')]);var _0x412a15={'method':_0xcc21('0x32'),'uri':util[_0xcc21('0x3f')](_0xcc21('0x4a'),_0x207b02[_0xcc21('0x49')]),'body':_0x5a02f9,'headers':{'Authorization':util[_0xcc21('0x3f')](_0xcc21('0x42'),new Buffer(_0x27b8d7)['toString'](_0xcc21('0x4b')))},'json':!![]};rp(_0x412a15)[_0xcc21('0x16')](function(_0x219c6b){var _0x388f90={'messageId':_0x219c6b[_0xcc21('0x4c')][0x0]};return _0x5cade6[_0xcc21('0x17')](_0x388f90);})[_0xcc21('0x19')](function(_0xff16b9){logger[_0xcc21('0x27')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0xcc21('0x29'),_0xcc21('0x4d'),util['inspect'](_0xff16b9,{'showHidden':![],'depth':null}));});}else{logger[_0xcc21('0x27')](_0xcc21('0x28'),_0xcc21('0x29'),_0xcc21('0x4d'),'Missing\x20parameters:\x20authId,\x20authToken');}break;case _0xcc21('0x4e'):if(_0x207b02['username']&&_0x207b02['password']){if(_0x207b02[_0xcc21('0x4f')]){var _0x20dd83={'method':_0xcc21('0x32'),'uri':_0x207b02[_0xcc21('0x4f')]+_0xcc21('0x50'),'body':{'username':_0x207b02[_0xcc21('0x2d')],'password':_0x207b02[_0xcc21('0x2e')]},'json':!![]};return rp(_0x20dd83)['then'](function(_0x418d84){var _0x4aeb2a={'method':_0xcc21('0x32'),'uri':_0x207b02[_0xcc21('0x4f')]+_0xcc21('0x51'),'body':{'messages':[{'from':_0x207b02[_0xcc21('0x21')],'destinations':[{'to':_0x502845['phone']}],'text':_0x502845[_0xcc21('0x39')],'notifyUrl':_0x207b02[_0xcc21('0x23')]+_0xcc21('0x24')+_0x502845['id']+'/status?token='+_0x207b02[_0xcc21('0x26')],'notifyContentType':_0xcc21('0x52'),'callbackData':_0x207b02['phone']+';'+_0x502845[_0xcc21('0x39')]}]},'headers':{'Authorization':'IBSSO\x20'+_0x418d84['token']},'json':!![]};return rp(_0x4aeb2a)[_0xcc21('0x16')](function(_0x15e812){if(_0x15e812[_0xcc21('0x22')]){var _0x532565={'messageId':_0x15e812['messages'][0x0][_0xcc21('0xc')]};if(!_0x207b02[_0xcc21('0x3d')]){_0x532565[_0xcc21('0x35')]=!![];}return _0x5cade6[_0xcc21('0x17')](_0x532565);}else{return logger['error']('SmsMessage,\x20%s,\x20%s,\x20%s','afterCreate',_0xcc21('0x4e'),util[_0xcc21('0x36')](_0x15e812,{'showHidden':![],'depth':null}));}});})[_0xcc21('0x19')](function(_0x30f691){return logger[_0xcc21('0x27')](_0xcc21('0x28'),_0xcc21('0x29'),_0xcc21('0x4e'),util[_0xcc21('0x36')](_0x30f691,{'showHidden':![],'depth':null}));});}else{logger[_0xcc21('0x27')](_0xcc21('0x28'),_0xcc21('0x29'),_0xcc21('0x4e'),_0xcc21('0x53'));}}else{logger[_0xcc21('0x27')](_0xcc21('0x28'),_0xcc21('0x29'),_0xcc21('0x4e'),_0xcc21('0x37'));}break;case _0xcc21('0x54'):var _0x2bc3bb=require(_0xcc21('0x55'));if(_0x207b02['apiKey']){var _0x4594ea={};_0x4594ea[_0xcc21('0x56')]=_0x207b02['username'];_0x4594ea[_0xcc21('0x21')]=_0x502845['phone'];_0x4594ea['sender']=_0x207b02[_0xcc21('0x21')];_0x4594ea[_0xcc21('0x57')]=_0x502845[_0xcc21('0x39')];_0x4594ea[_0xcc21('0x58')]=+new Date();var _0xd81a21='';var _0x4a5ab3='';var _0x5d6f80=Object[_0xcc21('0x59')](_0x4594ea);_0x5d6f80[_0xcc21('0x5a')]();for(var _0x52f511=0x0;_0x52f511<_0x5d6f80[_0xcc21('0x5b')];_0x52f511++){if(_0xd81a21!=''){_0xd81a21+='&';}_0xd81a21+=_0x5d6f80[_0x52f511]+'='+encodeURIComponent(_0x4594ea[_0x5d6f80[_0x52f511]]);_0x4a5ab3+=_0x4594ea[_0x5d6f80[_0x52f511]];}_0x4a5ab3+=_0x207b02['apiKey'];_0x4a5ab3=_0x2bc3bb[_0xcc21('0x5c')](_0xcc21('0x5d'))[_0xcc21('0x17')](_0x4a5ab3)[_0xcc21('0x5e')](_0xcc21('0x5f'));if(_0xd81a21!==''){_0xd81a21+='&';}_0xd81a21+='signature='+_0x4a5ab3;var _0x4ba7a3={'method':_0xcc21('0x60'),'uri':_0x207b02[_0xcc21('0x4f')]+_0xcc21('0x61')+_0xd81a21,'json':!![]};return rp(_0x4ba7a3)[_0xcc21('0x16')](function(_0x1a0ee1){var _0x33c771=Object['keys'](_0x1a0ee1);if(_0x1a0ee1[_0x33c771[0x0]][_0xcc21('0x27')]&&parseInt(_0x1a0ee1[_0x33c771[0x0]]['error'])===0x0){var _0x169d8d={'messageId':_0x1a0ee1[_0x33c771[0x0]][_0xcc21('0x62')]};if(!_0x207b02['deliveryReport']){_0x169d8d[_0xcc21('0x35')]=!![];}return _0x5cade6[_0xcc21('0x17')](_0x169d8d);}else{return logger['error'](_0xcc21('0x28'),_0xcc21('0x29'),_0xcc21('0x54'),util[_0xcc21('0x36')](_0x1a0ee1['error'],{'showHidden':![],'depth':null}));}})[_0xcc21('0x19')](function(_0x53ccaf){return logger[_0xcc21('0x27')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0xcc21('0x29'),_0xcc21('0x54'),util[_0xcc21('0x36')](_0x53ccaf,{'showHidden':![],'depth':null}));});}else{logger[_0xcc21('0x27')](_0xcc21('0x28'),_0xcc21('0x29'),_0xcc21('0x54'),'Missing\x20parameters:\x20apiKey');}break;case _0xcc21('0x63'):if(_0x207b02[_0xcc21('0x64')]){var _0x58560a={'method':_0xcc21('0x32'),'uri':'https://platform.clickatell.com/messages','headers':{'Authorization':_0x207b02[_0xcc21('0x64')]},'body':{'content':_0x502845['body'],'to':[_0x502845[_0xcc21('0x21')]],'from':_0x207b02[_0xcc21('0x21')],'binary':![],'clientMessageId':_0xcc21('0x65'),'charset':_0xcc21('0x66')},'json':!![]};rp(_0x58560a)[_0xcc21('0x16')](function(_0x3041a6){if(!_0x3041a6[_0xcc21('0x27')]){var _0x5a8f56={'messageId':_0x3041a6[_0xcc21('0x22')][0x0][_0xcc21('0x67')]};if(!_0x207b02['deliveryReport']){_0x5a8f56[_0xcc21('0x35')]=!![];}return _0x5cade6['update'](_0x5a8f56);}else{return logger['error'](_0xcc21('0x28'),'afterCreate',_0xcc21('0x63'),util[_0xcc21('0x36')](_0x3041a6[_0xcc21('0x27')],{'showHidden':![],'depth':null}));}})[_0xcc21('0x19')](function(_0xea7699){return logger[_0xcc21('0x27')](_0xcc21('0x28'),_0xcc21('0x29'),_0xcc21('0x63'),util[_0xcc21('0x36')](_0xea7699,{'showHidden':![],'depth':null}));});}else{logger['error'](_0xcc21('0x28'),_0xcc21('0x29'),_0xcc21('0x63'),'Missing\x20parameters:\x20apiKey');}break;case _0xcc21('0x68'):if(_0x207b02[_0xcc21('0x64')]){var _0x5ad131={};var _0x4ba7a3={'method':_0xcc21('0x32'),'uri':_0xcc21('0x69'),'headers':{'Authorization':_0xcc21('0x6a')+_0x207b02['apiKey'],'Content-Type':'application/json'},'body':{'from':_0x207b02[_0xcc21('0x21')],'to':_0x502845[_0xcc21('0x21')],'text':_0x502845[_0xcc21('0x39')]},'json':!![]};return rp(_0x4ba7a3)[_0xcc21('0x16')](function(_0x25ece5){if(_0x25ece5[_0xcc21('0x6b')]==0xca){_0x5ad131[_0xcc21('0x6c')]=_0x25ece5;var _0x2a8a47={'method':'POST','uri':_0xcc21('0x6d'),'headers':{'Authorization':_0xcc21('0x6a')+_0x207b02[_0xcc21('0x64')],'Content-Type':_0xcc21('0x52')},'body':{'refid':_0x5ad131[_0xcc21('0x6c')][_0xcc21('0x6e')]},'json':!![]};return rp(_0x2a8a47)[_0xcc21('0x16')](function(_0x41e691){_0x5ad131[_0xcc21('0x6f')]=_0x41e691;var _0x4dd5eb={'messageId':_0x5ad131[_0xcc21('0x6c')][_0xcc21('0x6e')],'read':!![]};return _0x5cade6[_0xcc21('0x17')](_0x4dd5eb);});}else{return logger[_0xcc21('0x27')](_0xcc21('0x28'),_0xcc21('0x29'),_0xcc21('0x68'),util['inspect'](_0x25ece5,{'showHidden':![],'depth':null}));}})[_0xcc21('0x19')](function(_0x1ab82a){return logger[_0xcc21('0x27')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0xcc21('0x29'),_0xcc21('0x68'),util[_0xcc21('0x36')](_0x1ab82a,{'showHidden':![],'depth':null}));});}else{return logger[_0xcc21('0x27')]('SmsMessage,\x20%s,\x20%s,\x20%s','afterCreate',_0xcc21('0x68'),_0xcc21('0x70'));}break;}}})[_0xcc21('0x71')](function(){_0x4ecf6a();});}else{_0x4ecf6a();}}},'charset':_0xcc21('0x72'),'collate':_0xcc21('0x73')});}; \ No newline at end of file diff --git a/server/api/smsMessage/smsMessage.rpc.js b/server/api/smsMessage/smsMessage.rpc.js index 4992b40..5867fcd 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(_0x538d6f,_0x435809){var _0x1828f0=function(_0xfbaf07){while(--_0xfbaf07){_0x538d6f['push'](_0x538d6f['shift']());}};_0x1828f0(++_0x435809);}(_0x5eb8,0xb0));var _0x85eb=function(_0x3513a0,_0x3bdc88){_0x3513a0=_0x3513a0-0x0;var _0x2bdeb9=_0x5eb8[_0x3513a0];return _0x2bdeb9;};'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 _0x8603=['../../mysqldb','../../config/utils','../../config/logger','../../config/environment','client','http','redis','defaults','./smsMessage.socket','register','request','info','request\x20sent','debug','SmsMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','SmsMessage,\x20%s,\x20%s','message','catch','CreateSmsMessage','SmsMessage','create','body','options','raw','then','util','moment','bluebird'];(function(_0x342274,_0x45a46d){var _0x48d3e4=function(_0x5f298d){while(--_0x5f298d){_0x342274['push'](_0x342274['shift']());}};_0x48d3e4(++_0x45a46d);}(_0x8603,0x190));var _0x3860=function(_0x2eddb9,_0x41e214){_0x2eddb9=_0x2eddb9-0x0;var _0x541be9=_0x8603[_0x2eddb9];return _0x541be9;};'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});config[_0x3860('0x9')]=_[_0x3860('0xa')](config[_0x3860('0x9')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0x3860('0xb'))[_0x3860('0xc')](socket);function respondWithRpcPromise(_0x52c277,_0x2fb169,_0x38737e){return new BPromise(function(_0x5909b8,_0x101263){return client[_0x3860('0xd')](_0x52c277,_0x38737e)['then'](function(_0x365579){logger[_0x3860('0xe')]('SmsMessage,\x20%s,\x20%s',_0x2fb169,_0x3860('0xf'));logger[_0x3860('0x10')](_0x3860('0x11'),_0x2fb169,_0x3860('0xf'),JSON[_0x3860('0x12')](_0x365579));if(_0x365579[_0x3860('0x13')]){if(_0x365579[_0x3860('0x13')][_0x3860('0x14')]===0x1f4){logger[_0x3860('0x13')](_0x3860('0x15'),_0x2fb169,_0x365579['error'][_0x3860('0x16')]);return _0x101263(_0x365579[_0x3860('0x13')][_0x3860('0x16')]);}logger[_0x3860('0x13')](_0x3860('0x15'),_0x2fb169,_0x365579[_0x3860('0x13')][_0x3860('0x16')]);return _0x5909b8(_0x365579[_0x3860('0x13')][_0x3860('0x16')]);}else{logger[_0x3860('0xe')](_0x3860('0x15'),_0x2fb169,_0x3860('0xf'));_0x5909b8(_0x365579['result']['message']);}})[_0x3860('0x17')](function(_0x41ce59){logger[_0x3860('0x13')]('SmsMessage,\x20%s,\x20%s',_0x2fb169,_0x41ce59);_0x101263(_0x41ce59);});});}exports[_0x3860('0x18')]=function(_0x145b26){var _0x22e873=this;return new Promise(function(_0x3af33a,_0x20a5b0){return db[_0x3860('0x19')][_0x3860('0x1a')](_0x145b26[_0x3860('0x1b')],{'raw':_0x145b26[_0x3860('0x1c')]?_0x145b26[_0x3860('0x1c')][_0x3860('0x1d')]===undefined?!![]:![]:!![]})[_0x3860('0x1e')](function(_0x280ea9){logger[_0x3860('0xe')](_0x3860('0x18'),_0x145b26);logger['debug'](_0x3860('0x18'),_0x145b26,JSON[_0x3860('0x12')](_0x280ea9));_0x3af33a(_0x280ea9);})[_0x3860('0x17')](function(_0x301e03){logger[_0x3860('0x13')]('CreateSmsMessage',_0x301e03[_0x3860('0x16')],_0x145b26);_0x20a5b0(_0x22e873['error'](0x1f4,_0x301e03['message']));});});}; \ No newline at end of file diff --git a/server/api/smsMessage/smsMessage.socket.js b/server/api/smsMessage/smsMessage.socket.js index f33ab94..14eee37 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 _0xcf7f=['update','emit','removeListener','register','length','save','remove'];(function(_0x2b7764,_0x2606f1){var _0x848dcb=function(_0x1ae85b){while(--_0x1ae85b){_0x2b7764['push'](_0x2b7764['shift']());}};_0x848dcb(++_0x2606f1);}(_0xcf7f,0x101));var _0xfcf7=function(_0x4b9b30,_0x4ebf7d){_0x4b9b30=_0x4b9b30-0x0;var _0x8577a9=_0xcf7f[_0x4b9b30];return _0x8577a9;};'use strict';var SmsMessageEvents=require('./smsMessage.events');var events=[_0xfcf7('0x0'),_0xfcf7('0x1'),_0xfcf7('0x2')];function createListener(_0x45021c,_0x3afe1f){return function(_0x40a99a){_0x3afe1f[_0xfcf7('0x3')](_0x45021c,_0x40a99a);};}function removeListener(_0x50ab54,_0x3a2b06){return function(){SmsMessageEvents[_0xfcf7('0x4')](_0x50ab54,_0x3a2b06);};}exports[_0xfcf7('0x5')]=function(_0x3a74c0){for(var _0x43954a=0x0,_0x3f774c=events[_0xfcf7('0x6')];_0x43954a<_0x3f774c;_0x43954a++){var _0x52bb5b=events[_0x43954a];var _0x2b746f=createListener('smsMessage:'+_0x52bb5b,_0x3a74c0);SmsMessageEvents['on'](_0x52bb5b,_0x2b746f);}}; \ No newline at end of file +var _0x636a=['emit','register','smsMessage:','./smsMessage.events','save','remove','update'];(function(_0x5ddb1c,_0x5ea4df){var _0x354adc=function(_0x2dfb1f){while(--_0x2dfb1f){_0x5ddb1c['push'](_0x5ddb1c['shift']());}};_0x354adc(++_0x5ea4df);}(_0x636a,0x1ca));var _0xa636=function(_0x51d129,_0x175d7d){_0x51d129=_0x51d129-0x0;var _0x44c377=_0x636a[_0x51d129];return _0x44c377;};'use strict';var SmsMessageEvents=require(_0xa636('0x0'));var events=[_0xa636('0x1'),_0xa636('0x2'),_0xa636('0x3')];function createListener(_0xe908b0,_0x31075c){return function(_0x534d53){_0x31075c[_0xa636('0x4')](_0xe908b0,_0x534d53);};}function removeListener(_0x3cbdbe,_0x3740d){return function(){SmsMessageEvents['removeListener'](_0x3cbdbe,_0x3740d);};}exports[_0xa636('0x5')]=function(_0x4fa9af){for(var _0x764082=0x0,_0x4ddae1=events['length'];_0x764082<_0x4ddae1;_0x764082++){var _0x2a518e=events[_0x764082];var _0x4eadaa=createListener(_0xa636('0x6')+_0x2a518e,_0x4fa9af);SmsMessageEvents['on'](_0x2a518e,_0x4eadaa);}}; \ No newline at end of file diff --git a/server/api/smsQueue/index.js b/server/api/smsQueue/index.js index 0d0a11f..85c5d14 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 _0x8ac9=['destroy','removeTeams','removeAgents','exports','multer','util','path','Router','../../components/auth/service','../../components/interaction/service','get','isAuthenticated','index','describe','/:id','show','/:id/members','getMembers','/:id/teams','getTeams','/:id/users','post','create','addTeams','addAgents','put','delete'];(function(_0x10b526,_0x393885){var _0x1d5d28=function(_0x3f23a3){while(--_0x3f23a3){_0x10b526['push'](_0x10b526['shift']());}};_0x1d5d28(++_0x393885);}(_0x8ac9,0x199));var _0x98ac=function(_0x96f8e0,_0x8ef565){_0x96f8e0=_0x96f8e0-0x0;var _0x1218ba=_0x8ac9[_0x96f8e0];return _0x1218ba;};'use strict';var multer=require(_0x98ac('0x0'));var util=require(_0x98ac('0x1'));var path=require(_0x98ac('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x98ac('0x3')]();var auth=require(_0x98ac('0x4'));var interaction=require(_0x98ac('0x5'));var config=require('../../config/environment');var controller=require('./smsQueue.controller');router[_0x98ac('0x6')]('/',auth[_0x98ac('0x7')](),controller[_0x98ac('0x8')]);router['get']('/describe',auth[_0x98ac('0x7')](),controller[_0x98ac('0x9')]);router[_0x98ac('0x6')](_0x98ac('0xa'),auth[_0x98ac('0x7')](),controller[_0x98ac('0xb')]);router['get'](_0x98ac('0xc'),auth['isAuthenticated'](),controller[_0x98ac('0xd')]);router[_0x98ac('0x6')](_0x98ac('0xe'),auth[_0x98ac('0x7')](),controller[_0x98ac('0xf')]);router[_0x98ac('0x6')](_0x98ac('0x10'),auth['isAuthenticated'](),controller['getAgents']);router[_0x98ac('0x11')]('/',auth[_0x98ac('0x7')](),controller[_0x98ac('0x12')]);router[_0x98ac('0x11')]('/:id/teams',auth[_0x98ac('0x7')](),controller[_0x98ac('0x13')]);router[_0x98ac('0x11')]('/:id/users',auth['isAuthenticated'](),controller[_0x98ac('0x14')]);router[_0x98ac('0x15')]('/:id',auth['isAuthenticated'](),controller['update']);router[_0x98ac('0x16')](_0x98ac('0xa'),auth['isAuthenticated'](),controller[_0x98ac('0x17')]);router[_0x98ac('0x16')](_0x98ac('0xe'),auth['isAuthenticated'](),controller[_0x98ac('0x18')]);router[_0x98ac('0x16')](_0x98ac('0x10'),auth['isAuthenticated'](),controller[_0x98ac('0x19')]);module[_0x98ac('0x1a')]=router; \ No newline at end of file +var _0xbba1=['put','delete','removeAgents','multer','connect-timeout','express','../../components/interaction/service','get','/describe','isAuthenticated','describe','/:id','getMembers','/:id/teams','getAgents','create','post','addTeams','/:id/users','addAgents'];(function(_0x450b2a,_0x174591){var _0x37a7ff=function(_0x259a26){while(--_0x259a26){_0x450b2a['push'](_0x450b2a['shift']());}};_0x37a7ff(++_0x174591);}(_0xbba1,0x17f));var _0x1bba=function(_0x1fdfc1,_0x35ee90){_0x1fdfc1=_0x1fdfc1-0x0;var _0x2f70d0=_0xbba1[_0x1fdfc1];return _0x2f70d0;};'use strict';var multer=require(_0x1bba('0x0'));var util=require('util');var path=require('path');var timeout=require(_0x1bba('0x1'));var express=require(_0x1bba('0x2'));var router=express['Router']();var auth=require('../../components/auth/service');var interaction=require(_0x1bba('0x3'));var config=require('../../config/environment');var controller=require('./smsQueue.controller');router[_0x1bba('0x4')]('/',auth['isAuthenticated'](),controller['index']);router[_0x1bba('0x4')](_0x1bba('0x5'),auth[_0x1bba('0x6')](),controller[_0x1bba('0x7')]);router[_0x1bba('0x4')](_0x1bba('0x8'),auth['isAuthenticated'](),controller['show']);router[_0x1bba('0x4')]('/:id/members',auth[_0x1bba('0x6')](),controller[_0x1bba('0x9')]);router['get'](_0x1bba('0xa'),auth['isAuthenticated'](),controller['getTeams']);router[_0x1bba('0x4')]('/:id/users',auth[_0x1bba('0x6')](),controller[_0x1bba('0xb')]);router['post']('/',auth[_0x1bba('0x6')](),controller[_0x1bba('0xc')]);router[_0x1bba('0xd')]('/:id/teams',auth[_0x1bba('0x6')](),controller[_0x1bba('0xe')]);router[_0x1bba('0xd')](_0x1bba('0xf'),auth['isAuthenticated'](),controller[_0x1bba('0x10')]);router[_0x1bba('0x11')]('/:id',auth['isAuthenticated'](),controller['update']);router[_0x1bba('0x12')]('/:id',auth['isAuthenticated'](),controller['destroy']);router[_0x1bba('0x12')]('/:id/teams',auth[_0x1bba('0x6')](),controller['removeTeams']);router[_0x1bba('0x12')](_0x1bba('0xf'),auth[_0x1bba('0x6')](),controller[_0x1bba('0x13')]);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 ded48e5..8b5fbcf 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 _0x8a9b=['name','ENUM','rrmemory','beepall','sequelize','exports'];(function(_0x9284d6,_0xadac2a){var _0x2caab1=function(_0x35f909){while(--_0x35f909){_0x9284d6['push'](_0x9284d6['shift']());}};_0x2caab1(++_0xadac2a);}(_0x8a9b,0xac));var _0xb8a9=function(_0x2c9d49,_0x33e079){_0x2c9d49=_0x2c9d49-0x0;var _0x32b633=_0x8a9b[_0x2c9d49];return _0x32b633;};'use strict';var Sequelize=require(_0xb8a9('0x0'));module[_0xb8a9('0x1')]={'name':{'type':Sequelize['STRING'],'unique':_0xb8a9('0x2'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize['STRING']},'timeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0xb8a9('0x3')](_0xb8a9('0x4'),_0xb8a9('0x5'),'roundrobin')}}; \ No newline at end of file +var _0x1c14=['roundrobin','exports','STRING','name','ENUM','rrmemory'];(function(_0x5439d4,_0x203121){var _0xe0d48b=function(_0x75048a){while(--_0x75048a){_0x5439d4['push'](_0x5439d4['shift']());}};_0xe0d48b(++_0x203121);}(_0x1c14,0xd3));var _0x41c1=function(_0x289994,_0xd0eb27){_0x289994=_0x289994-0x0;var _0x5bf5ba=_0x1c14[_0x289994];return _0x5bf5ba;};'use strict';var Sequelize=require('sequelize');module[_0x41c1('0x0')]={'name':{'type':Sequelize[_0x41c1('0x1')],'unique':_0x41c1('0x2'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0x41c1('0x1')]},'timeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0x41c1('0x3')](_0x41c1('0x4'),'beepall',_0x41c1('0x5'))}}; \ No newline at end of file diff --git a/server/api/smsQueue/smsQueue.controller.js b/server/api/smsQueue/smsQueue.controller.js index 210fad3..50301c2 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 _0x5f2f=['json','count','offset','set','reject','save','update','then','get','SmsQueues','UserProfileResource','destroy','sendStatus','error','stack','name','send','index','SmsQueue','fieldName','type','key','model','map','query','filters','intersection','attributes','fields','length','limit','order','sort','where','pick','filter','merge','VIRTUAL','options','findAll','rows','catch','show','params','keys','rawAttributes','include','find','create','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','getMembers','findOne','UserSmsQueue','hasOwnProperty','nolimit','SmsQueueId','User','findAndCountAll','UserId','agent','smsPause','updatedAt','createdAt','format','%s/%s','SIP','getTeams','addTeams','ids','Team','Agents','online','voicePause','interface','flatMap','sequelize','transaction','each','findOrCreate','forEach','removeTeams','select','field','tq.TeamId','from','team_has_sms_queues','join','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','SmsQueueId\x20=\x20?','clone','ut.UserId\x20=\x20?','push','toString','QueryTypes','all','union','compact','value','isEmpty','removeAgents','emit','userSmsQueue:remove','addAgents','body','omit','userSmsQueue:save','isArray','getAgents','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','path','sox','to-csv','ejs','lodash','squel','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','api','../../config/utils','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./smsQueue.socket','register','status','end'];(function(_0x2763f2,_0x416af8){var _0x3ef471=function(_0x288aa2){while(--_0x288aa2){_0x2763f2['push'](_0x2763f2['shift']());}};_0x3ef471(++_0x416af8);}(_0x5f2f,0x73));var _0xf5f2=function(_0x346039,_0x4dda34){_0x346039=_0x346039-0x0;var _0x5467ac=_0x5f2f[_0x346039];return _0x5467ac;};'use strict';var pdf=require(_0xf5f2('0x0'));var emlformat=require(_0xf5f2('0x1'));var rimraf=require(_0xf5f2('0x2'));var zipdir=require(_0xf5f2('0x3'));var jsonpatch=require(_0xf5f2('0x4'));var rp=require(_0xf5f2('0x5'));var moment=require(_0xf5f2('0x6'));var BPromise=require(_0xf5f2('0x7'));var Mustache=require('mustache');var util=require('util');var path=require(_0xf5f2('0x8'));var sox=require(_0xf5f2('0x9'));var csv=require(_0xf5f2('0xa'));var ejs=require(_0xf5f2('0xb'));var fs=require('fs');var _=require(_0xf5f2('0xc'));var squel=require(_0xf5f2('0xd'));var crypto=require('crypto');var jsforce=require(_0xf5f2('0xe'));var deskjs=require(_0xf5f2('0xf'));var toCsv=require(_0xf5f2('0xa'));var querystring=require('querystring');var Papa=require(_0xf5f2('0x10'));var Redis=require(_0xf5f2('0x11'));var authService=require(_0xf5f2('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0xf5f2('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0xf5f2('0x14'));var utils=require(_0xf5f2('0x15'));var config=require('../../config/environment');var db=require(_0xf5f2('0x16'))['db'];config[_0xf5f2('0x17')]=_[_0xf5f2('0x18')](config[_0xf5f2('0x17')],{'host':_0xf5f2('0x19'),'port':0x18eb});var socket=require(_0xf5f2('0x1a'))(new Redis(config['redis']));require(_0xf5f2('0x1b'))[_0xf5f2('0x1c')](socket);function respondWithStatusCode(_0x269909,_0x1c1a5c){_0x1c1a5c=_0x1c1a5c||0xcc;return function(_0x422b55){if(_0x422b55){return _0x269909['sendStatus'](_0x1c1a5c);}return _0x269909[_0xf5f2('0x1d')](_0x1c1a5c)[_0xf5f2('0x1e')]();};}function respondWithResult(_0x17d656,_0x1b6dd2){_0x1b6dd2=_0x1b6dd2||0xc8;return function(_0x23e23a){if(_0x23e23a){return _0x17d656[_0xf5f2('0x1d')](_0x1b6dd2)[_0xf5f2('0x1f')](_0x23e23a);}};}function respondWithFilteredResult(_0x395a5a,_0x11f702){return function(_0x228ace){if(_0x228ace){var _0x20fccd=_0x228ace[_0xf5f2('0x20')],_0x28e097=_0x11f702[_0xf5f2('0x21')],_0x4ff59b=_0x11f702[_0xf5f2('0x21')]+_0x11f702['limit'],_0x3ee69;if(_0x4ff59b>=_0x20fccd){_0x4ff59b=_0x20fccd;_0x3ee69=0xc8;}else{_0x3ee69=0xce;}_0x395a5a[_0xf5f2('0x1d')](_0x3ee69);return _0x395a5a[_0xf5f2('0x22')]('Content-Range',_0x28e097+'-'+_0x4ff59b+'/'+_0x20fccd)['json'](_0x228ace);}return null;};}function patchUpdates(_0x2d2805){return function(_0x388e6c){try{jsonpatch['apply'](_0x388e6c,_0x2d2805,!![]);}catch(_0x45b74f){return BPromise[_0xf5f2('0x23')](_0x45b74f);}return _0x388e6c[_0xf5f2('0x24')]();};}function saveUpdates(_0x39c024,_0x36f1cb){return function(_0x4c691a){if(_0x4c691a){return _0x4c691a[_0xf5f2('0x25')](_0x39c024)[_0xf5f2('0x26')](function(_0x4e8bda){return _0x4e8bda;});}return null;};}function removeEntity(_0x2833fe,_0x287ad5){return function(_0x5bdf4a){if(_0x5bdf4a){return _0x5bdf4a['destroy']()[_0xf5f2('0x26')](function(){var _0x3f79d5=_0x5bdf4a[_0xf5f2('0x27')]({'plain':!![]});var _0x1a5bb3=_0xf5f2('0x28');return db[_0xf5f2('0x29')][_0xf5f2('0x2a')]({'where':{'type':_0x1a5bb3,'resourceId':_0x3f79d5['id']}})[_0xf5f2('0x26')](function(){return _0x5bdf4a;});})[_0xf5f2('0x26')](function(){_0x2833fe['status'](0xcc)[_0xf5f2('0x1e')]();});}};}function handleEntityNotFound(_0x102449,_0x375ca8){return function(_0x31bfcb){if(!_0x31bfcb){_0x102449[_0xf5f2('0x2b')](0x194);}return _0x31bfcb;};}function handleError(_0x477604,_0x5b6672){_0x5b6672=_0x5b6672||0x1f4;return function(_0x53cb96){logger[_0xf5f2('0x2c')](_0x53cb96[_0xf5f2('0x2d')]);if(_0x53cb96[_0xf5f2('0x2e')]){delete _0x53cb96['name'];}_0x477604['status'](_0x5b6672)[_0xf5f2('0x2f')](_0x53cb96);};}exports[_0xf5f2('0x30')]=function(_0x17394a,_0x153924){var _0x1b381e={},_0x54c0c8={},_0x52e959={'count':0x0,'rows':[]};var _0x2f4778=_['map'](db[_0xf5f2('0x31')]['rawAttributes'],function(_0x45b643){return{'name':_0x45b643[_0xf5f2('0x32')],'type':_0x45b643[_0xf5f2('0x33')][_0xf5f2('0x34')]};});_0x54c0c8[_0xf5f2('0x35')]=_[_0xf5f2('0x36')](_0x2f4778,_0xf5f2('0x2e'));_0x54c0c8[_0xf5f2('0x37')]=_['keys'](_0x17394a[_0xf5f2('0x37')]);_0x54c0c8[_0xf5f2('0x38')]=_[_0xf5f2('0x39')](_0x54c0c8[_0xf5f2('0x35')],_0x54c0c8[_0xf5f2('0x37')]);_0x1b381e[_0xf5f2('0x3a')]=_[_0xf5f2('0x39')](_0x54c0c8['model'],qs[_0xf5f2('0x3b')](_0x17394a[_0xf5f2('0x37')]['fields']));_0x1b381e[_0xf5f2('0x3a')]=_0x1b381e['attributes'][_0xf5f2('0x3c')]?_0x1b381e[_0xf5f2('0x3a')]:_0x54c0c8[_0xf5f2('0x35')];if(!_0x17394a[_0xf5f2('0x37')]['hasOwnProperty']('nolimit')){_0x1b381e[_0xf5f2('0x3d')]=qs[_0xf5f2('0x3d')](_0x17394a[_0xf5f2('0x37')]['limit']);_0x1b381e[_0xf5f2('0x21')]=qs['offset'](_0x17394a[_0xf5f2('0x37')]['offset']);}_0x1b381e[_0xf5f2('0x3e')]=qs[_0xf5f2('0x3f')](_0x17394a['query'][_0xf5f2('0x3f')]);_0x1b381e[_0xf5f2('0x40')]=qs[_0xf5f2('0x38')](_[_0xf5f2('0x41')](_0x17394a['query'],_0x54c0c8['filters']));if(_0x17394a[_0xf5f2('0x37')][_0xf5f2('0x42')]){_0x1b381e[_0xf5f2('0x40')]=_[_0xf5f2('0x43')](_0x1b381e[_0xf5f2('0x40')],{'$or':_[_0xf5f2('0x36')](_0x2f4778,function(_0x2bc20e){if(_0x2bc20e['type']!==_0xf5f2('0x44')){var _0x3b4ea6={};_0x3b4ea6[_0x2bc20e['name']]={'$like':'%'+_0x17394a[_0xf5f2('0x37')][_0xf5f2('0x42')]+'%'};return _0x3b4ea6;}})});}_0x1b381e=_[_0xf5f2('0x43')]({},_0x1b381e,_0x17394a[_0xf5f2('0x45')]);var _0xd10701={'where':_0x1b381e[_0xf5f2('0x40')]};return db[_0xf5f2('0x31')][_0xf5f2('0x20')](_0xd10701)['then'](function(_0x31c3c){_0x52e959[_0xf5f2('0x20')]=_0x31c3c;if(_0x17394a[_0xf5f2('0x37')]['includeAll']){_0x1b381e['include']=[{'all':!![]}];}return db['SmsQueue'][_0xf5f2('0x46')](_0x1b381e);})[_0xf5f2('0x26')](function(_0x4c8d8e){_0x52e959[_0xf5f2('0x47')]=_0x4c8d8e;return _0x52e959;})[_0xf5f2('0x26')](respondWithFilteredResult(_0x153924,_0x1b381e))[_0xf5f2('0x48')](handleError(_0x153924,null));};exports[_0xf5f2('0x49')]=function(_0x354c34,_0x2b3b1c){var _0x1a6ec1={'raw':!![],'where':{'id':_0x354c34[_0xf5f2('0x4a')]['id']}},_0x212e90={};_0x212e90[_0xf5f2('0x35')]=_[_0xf5f2('0x4b')](db[_0xf5f2('0x31')][_0xf5f2('0x4c')]);_0x212e90[_0xf5f2('0x37')]=_['keys'](_0x354c34[_0xf5f2('0x37')]);_0x212e90['filters']=_[_0xf5f2('0x39')](_0x212e90[_0xf5f2('0x35')],_0x212e90[_0xf5f2('0x37')]);_0x1a6ec1[_0xf5f2('0x3a')]=_[_0xf5f2('0x39')](_0x212e90[_0xf5f2('0x35')],qs['fields'](_0x354c34[_0xf5f2('0x37')][_0xf5f2('0x3b')]));_0x1a6ec1[_0xf5f2('0x3a')]=_0x1a6ec1[_0xf5f2('0x3a')][_0xf5f2('0x3c')]?_0x1a6ec1[_0xf5f2('0x3a')]:_0x212e90[_0xf5f2('0x35')];if(_0x354c34[_0xf5f2('0x37')]['includeAll']){_0x1a6ec1[_0xf5f2('0x4d')]=[{'all':!![]}];}_0x1a6ec1=_[_0xf5f2('0x43')]({},_0x1a6ec1,_0x354c34[_0xf5f2('0x45')]);return db['SmsQueue'][_0xf5f2('0x4e')](_0x1a6ec1)[_0xf5f2('0x26')](handleEntityNotFound(_0x2b3b1c,null))[_0xf5f2('0x26')](respondWithResult(_0x2b3b1c,null))['catch'](handleError(_0x2b3b1c,null));};exports['create']=function(_0x7bb942,_0x27c472){return db['SmsQueue'][_0xf5f2('0x4f')](_0x7bb942['body'],{})[_0xf5f2('0x26')](function(_0x497eb8){var _0x2cbd9d=_0x7bb942['user'][_0xf5f2('0x27')]({'plain':!![]});if(!_0x2cbd9d)throw new Error(_0xf5f2('0x50'));if(_0x2cbd9d[_0xf5f2('0x51')]===_0xf5f2('0x52')){var _0x4fa738=_0x497eb8[_0xf5f2('0x27')]({'plain':!![]});var _0x2b782f='SmsQueues';return db['UserProfileSection'][_0xf5f2('0x4e')]({'where':{'name':_0x2b782f,'userProfileId':_0x2cbd9d[_0xf5f2('0x53')]},'raw':!![]})['then'](function(_0x22b645){if(_0x22b645&&_0x22b645[_0xf5f2('0x54')]===0x0){return db[_0xf5f2('0x29')][_0xf5f2('0x4f')]({'name':_0x4fa738['name'],'resourceId':_0x4fa738['id'],'type':_0x22b645['name'],'sectionId':_0x22b645['id']},{})[_0xf5f2('0x26')](function(){return _0x497eb8;});}else{return _0x497eb8;}})[_0xf5f2('0x48')](function(_0x4b62fc){logger[_0xf5f2('0x2c')](_0xf5f2('0x55'),_0x4b62fc);throw _0x4b62fc;});}return _0x497eb8;})[_0xf5f2('0x26')](respondWithResult(_0x27c472,0xc9))[_0xf5f2('0x48')](handleError(_0x27c472,null));};exports[_0xf5f2('0x25')]=function(_0x73c9f1,_0x14ee10){if(_0x73c9f1['body']['id']){delete _0x73c9f1['body']['id'];}return db[_0xf5f2('0x31')][_0xf5f2('0x4e')]({'where':{'id':_0x73c9f1[_0xf5f2('0x4a')]['id']}})[_0xf5f2('0x26')](handleEntityNotFound(_0x14ee10,null))[_0xf5f2('0x26')](saveUpdates(_0x73c9f1['body'],null))[_0xf5f2('0x26')](respondWithResult(_0x14ee10,null))[_0xf5f2('0x48')](handleError(_0x14ee10,null));};exports[_0xf5f2('0x2a')]=function(_0x519c24,_0x1aa34b){return db['SmsQueue'][_0xf5f2('0x4e')]({'where':{'id':_0x519c24[_0xf5f2('0x4a')]['id']}})[_0xf5f2('0x26')](handleEntityNotFound(_0x1aa34b,null))[_0xf5f2('0x26')](removeEntity(_0x1aa34b,null))['catch'](handleError(_0x1aa34b,null));};exports['describe']=function(_0x756f1f,_0x4de303){return db[_0xf5f2('0x31')][_0xf5f2('0x56')]()['then'](respondWithResult(_0x4de303,null))[_0xf5f2('0x48')](handleError(_0x4de303,null));};exports[_0xf5f2('0x57')]=function(_0x2a8f6d,_0x51ef09,_0x397b99){var _0xcf7a50={'raw':!![],'where':{}},_0x42cc27={},_0x4579f4;return db['SmsQueue'][_0xf5f2('0x58')]({'where':{'id':_0x2a8f6d['params']['id']}})[_0xf5f2('0x26')](handleEntityNotFound(_0x51ef09,null))[_0xf5f2('0x26')](function(_0x2e6f5d){if(_0x2e6f5d){_0x4579f4=_0x2e6f5d[_0xf5f2('0x27')]({'plain':!![]});_0x42cc27[_0xf5f2('0x35')]=_['keys'](db[_0xf5f2('0x59')][_0xf5f2('0x4c')]);_0x42cc27[_0xf5f2('0x37')]=_[_0xf5f2('0x4b')](_0x2a8f6d[_0xf5f2('0x37')]);_0x42cc27['filters']=_[_0xf5f2('0x39')](_0x42cc27['model'],_0x42cc27['query']);_0xcf7a50[_0xf5f2('0x3a')]=_['intersection'](_0x42cc27[_0xf5f2('0x35')],qs[_0xf5f2('0x3b')](_0x2a8f6d[_0xf5f2('0x37')][_0xf5f2('0x3b')]));_0xcf7a50['attributes']=_0xcf7a50[_0xf5f2('0x3a')][_0xf5f2('0x3c')]?_0xcf7a50[_0xf5f2('0x3a')]:_0x42cc27[_0xf5f2('0x35')];if(!_0x2a8f6d[_0xf5f2('0x37')][_0xf5f2('0x5a')](_0xf5f2('0x5b'))){_0xcf7a50['limit']=qs[_0xf5f2('0x3d')](_0x2a8f6d[_0xf5f2('0x37')][_0xf5f2('0x3d')]);_0xcf7a50[_0xf5f2('0x21')]=qs['offset'](_0x2a8f6d[_0xf5f2('0x37')]['offset']);}_0xcf7a50[_0xf5f2('0x3e')]=qs[_0xf5f2('0x3f')](_0x2a8f6d['query'][_0xf5f2('0x3f')]);_0xcf7a50[_0xf5f2('0x40')]=qs[_0xf5f2('0x38')](_[_0xf5f2('0x41')](_0x2a8f6d[_0xf5f2('0x37')],_0x42cc27['filters']));_0xcf7a50[_0xf5f2('0x40')][_0xf5f2('0x5c')]=_0x2e6f5d['id'];if(_0x2a8f6d[_0xf5f2('0x37')][_0xf5f2('0x42')]){_0xcf7a50[_0xf5f2('0x40')]=_[_0xf5f2('0x43')](_0xcf7a50['where'],{'$or':_[_0xf5f2('0x36')](_0xcf7a50[_0xf5f2('0x3a')],function(_0x4800fe){var _0x3f677e={};_0x3f677e[_0x4800fe]={'$like':'%'+_0x2a8f6d[_0xf5f2('0x37')][_0xf5f2('0x42')]+'%'};return _0x3f677e;})});}_0xcf7a50=_['merge']({},_0xcf7a50,_0x2a8f6d['options']);return db['UserSmsQueue'][_0xf5f2('0x46')](_0xcf7a50);}})[_0xf5f2('0x26')](function(_0x35f6a2){if(_0x35f6a2){return db[_0xf5f2('0x5d')][_0xf5f2('0x5e')]({'where':{'id':_['map'](_0x35f6a2,_0xf5f2('0x5f')),'role':_0xf5f2('0x60')},'attributes':['id',_0xf5f2('0x2e'),_0xf5f2('0x61'),_0xf5f2('0x62'),_0xf5f2('0x63')]});}})[_0xf5f2('0x26')](function(_0x3cce11){if(_0x3cce11){return{'count':_0x3cce11[_0xf5f2('0x20')],'rows':_[_0xf5f2('0x36')](_0x3cce11[_0xf5f2('0x47')],function(_0x5679bc){return{'membername':_0x5679bc['name'],'UserId':_0x5679bc['id'],'queue_name':_0x4579f4['name'],'SmsQueueId':_0x4579f4['id'],'interface':util[_0xf5f2('0x64')](_0xf5f2('0x65'),_0xf5f2('0x66'),_0x5679bc[_0xf5f2('0x2e')]),'penalty':0x0,'paused':_0x5679bc[_0xf5f2('0x61')],'createdAt':_0x5679bc['createdAt'],'updatedAt':_0x5679bc[_0xf5f2('0x62')]};})};}else{return{'count':0x0,'rows':[]};}})[_0xf5f2('0x26')](respondWithFilteredResult(_0x51ef09,_0xcf7a50))[_0xf5f2('0x48')](handleError(_0x51ef09,null));};exports[_0xf5f2('0x67')]=function(_0x44d119,_0x55748d,_0x2986ed){var _0x1409b9={};var _0x517c15={};var _0x777098;var _0x2b0b30;return db[_0xf5f2('0x31')][_0xf5f2('0x58')]({'where':{'id':_0x44d119['params']['id']}})[_0xf5f2('0x26')](handleEntityNotFound(_0x55748d,null))[_0xf5f2('0x26')](function(_0x19602d){if(_0x19602d){_0x777098=_0x19602d;_0x517c15[_0xf5f2('0x35')]=_[_0xf5f2('0x4b')](db['Team']['rawAttributes']);_0x517c15[_0xf5f2('0x37')]=_[_0xf5f2('0x4b')](_0x44d119[_0xf5f2('0x37')]);_0x517c15[_0xf5f2('0x38')]=_['intersection'](_0x517c15['model'],_0x517c15[_0xf5f2('0x37')]);_0x1409b9['attributes']=_['intersection'](_0x517c15['model'],qs['fields'](_0x44d119[_0xf5f2('0x37')][_0xf5f2('0x3b')]));_0x1409b9[_0xf5f2('0x3a')]=_0x1409b9[_0xf5f2('0x3a')][_0xf5f2('0x3c')]?_0x1409b9[_0xf5f2('0x3a')]:_0x517c15[_0xf5f2('0x35')];_0x1409b9[_0xf5f2('0x3e')]=qs[_0xf5f2('0x3f')](_0x44d119[_0xf5f2('0x37')][_0xf5f2('0x3f')]);_0x1409b9[_0xf5f2('0x40')]=qs[_0xf5f2('0x38')](_[_0xf5f2('0x41')](_0x44d119[_0xf5f2('0x37')],_0x517c15[_0xf5f2('0x38')]));if(_0x44d119[_0xf5f2('0x37')][_0xf5f2('0x42')]){_0x1409b9['where']=_[_0xf5f2('0x43')](_0x1409b9[_0xf5f2('0x40')],{'$or':_[_0xf5f2('0x36')](_0x1409b9[_0xf5f2('0x3a')],function(_0x18c353){var _0x308220={};_0x308220[_0x18c353]={'$like':'%'+_0x44d119[_0xf5f2('0x37')][_0xf5f2('0x42')]+'%'};return _0x308220;})});}_0x1409b9=_['merge']({},_0x1409b9,_0x44d119[_0xf5f2('0x45')]);return _0x777098['getTeams'](_0x1409b9);}})['then'](function(_0x5bf3b9){if(_0x5bf3b9){_0x2b0b30=_0x5bf3b9['length'];if(!_0x44d119['query']['hasOwnProperty'](_0xf5f2('0x5b'))){_0x1409b9[_0xf5f2('0x3d')]=qs[_0xf5f2('0x3d')](_0x44d119[_0xf5f2('0x37')][_0xf5f2('0x3d')]);_0x1409b9[_0xf5f2('0x21')]=qs['offset'](_0x44d119['query'][_0xf5f2('0x21')]);}return _0x777098['getTeams'](_0x1409b9);}})[_0xf5f2('0x26')](function(_0x186fdd){if(_0x186fdd){return _0x186fdd?{'count':_0x2b0b30,'rows':_0x186fdd}:null;}})['then'](respondWithResult(_0x55748d,null))['catch'](handleError(_0x55748d,null));};exports[_0xf5f2('0x68')]=function(_0x274aa3,_0x5a23c7,_0x1c624f){var _0x388b32=_0x274aa3['body'][_0xf5f2('0x69')];return db[_0xf5f2('0x6a')][_0xf5f2('0x46')]({'where':{'id':_0x388b32},'attributes':['id'],'include':[{'model':db['User'],'as':_0xf5f2('0x6b'),'attributes':['id',_0xf5f2('0x2e'),_0xf5f2('0x6c'),_0xf5f2('0x6d'),_0xf5f2('0x6e')],'raw':!![]}]})[_0xf5f2('0x26')](function(_0x25974b){if(_0x25974b){var _0x379053=_[_0xf5f2('0x6f')](_0x25974b,function(_0x3a6f60){var _0x191af3=_0x3a6f60[_0xf5f2('0x27')]({'plain':!![]});return _0x191af3[_0xf5f2('0x6b')];});return db[_0xf5f2('0x31')][_0xf5f2('0x4e')]({'where':{'id':_0x274aa3[_0xf5f2('0x4a')]['id']}})[_0xf5f2('0x26')](function(_0x29a9d4){return db[_0xf5f2('0x70')][_0xf5f2('0x71')](function(_0x800f42){return _0x29a9d4['addTeams'](_0x388b32,{'transaction':_0x800f42})[_0xf5f2('0x26')](function(){return BPromise[_0xf5f2('0x72')](_0x379053,function(_0x5d6c6e){return db[_0xf5f2('0x59')][_0xf5f2('0x73')]({'where':{'UserId':_0x5d6c6e['id'],'SmsQueueId':_0x274aa3['params']['id']},'transaction':_0x800f42});});})[_0xf5f2('0x26')](function(){_0x379053[_0xf5f2('0x74')](function(_0x335d9b){socket['emit']('userSmsQueue:save',{'UserId':_0x335d9b['id'],'SmsQueueId':_0x29a9d4['id']});});});});});}})[_0xf5f2('0x26')](respondWithStatusCode(_0x5a23c7,null))[_0xf5f2('0x48')](handleError(_0x5a23c7,null));};exports[_0xf5f2('0x75')]=function(_0x5ba275,_0x596958,_0x2572c0){return db[_0xf5f2('0x6a')][_0xf5f2('0x46')]({'where':{'id':_0x5ba275['query']['ids']},'attributes':['id'],'include':[{'model':db['User'],'as':'Agents','attributes':['id'],'raw':!![]}]})['then'](handleEntityNotFound(_0x596958,null))[_0xf5f2('0x26')](function(_0x561bab){var _0x1acb72=_[_0xf5f2('0x36')](_0x561bab,'id');var _0xec3c35=[];var _0x43a167=[];var _0x29ab74=squel[_0xf5f2('0x76')]();_0x29ab74[_0xf5f2('0x77')](_0xf5f2('0x78'))[_0xf5f2('0x79')](_0xf5f2('0x7a'),'tq')[_0xf5f2('0x7b')](_0xf5f2('0x7c'),'ut',_0xf5f2('0x7d'))['where'](_0xf5f2('0x7e'),_0x5ba275[_0xf5f2('0x4a')]['id']);for(var _0x5783e2=0x0;_0x5783e2<_0x561bab[_0xf5f2('0x3c')];_0x5783e2+=0x1){let _0x3395d3=_0x561bab[_0x5783e2];for(var _0x537a7d=0x0;_0x537a7d<_0x3395d3[_0xf5f2('0x6b')][_0xf5f2('0x3c')];_0x537a7d+=0x1){let _0x281f61=_0x3395d3['Agents'][_0x537a7d];var _0x21c5fc=_0x29ab74[_0xf5f2('0x7f')]();_0x21c5fc['where'](_0xf5f2('0x80'),_0x281f61['id']);_0x43a167[_0xf5f2('0x81')](db[_0xf5f2('0x70')]['query'](_0x21c5fc[_0xf5f2('0x82')](),{'type':db['sequelize'][_0xf5f2('0x83')]['SELECT']})[_0xf5f2('0x26')](function(_0x3cbc58){if(_0x3cbc58[_0xf5f2('0x3c')]===0x1){return _0x281f61['id'];}else{var _0x42c915=_['every'](_[_0xf5f2('0x36')](_0x3cbc58,'TeamId'),function(_0x52e037){return _['includes'](_0x1acb72,_0x52e037);});if(_0x42c915){return _0x281f61['id'];}}}));}}return BPromise[_0xf5f2('0x84')](_0x43a167)[_0xf5f2('0x26')](function(_0x5ece9e){_0xec3c35=_(_0xec3c35)[_0xf5f2('0x85')](_0x5ece9e)[_0xf5f2('0x86')]()[_0xf5f2('0x87')]();return db[_0xf5f2('0x31')][_0xf5f2('0x4e')]({'where':{'id':_0x5ba275[_0xf5f2('0x4a')]['id']}})['then'](function(_0x415b97){return db[_0xf5f2('0x70')]['transaction'](function(_0x22865e){return _0x415b97[_0xf5f2('0x75')](_0x5ba275['query'][_0xf5f2('0x69')],{'transaction':_0x22865e})[_0xf5f2('0x26')](function(){if(!_[_0xf5f2('0x88')](_0xec3c35)){return _0x415b97[_0xf5f2('0x89')](_0xec3c35,{'transaction':_0x22865e});}})[_0xf5f2('0x26')](function(){_0xec3c35[_0xf5f2('0x74')](function(_0x4df05c){socket[_0xf5f2('0x8a')](_0xf5f2('0x8b'),{'UserId':_0x4df05c,'SmsQueueId':_0x415b97['id']});});});});});});})[_0xf5f2('0x26')](respondWithStatusCode(_0x596958,null))[_0xf5f2('0x48')](handleError(_0x596958,null));};exports[_0xf5f2('0x8c')]=function(_0x24ca50,_0x162c13,_0x258920){return db[_0xf5f2('0x31')]['find']({'where':{'id':_0x24ca50[_0xf5f2('0x4a')]['id']}})[_0xf5f2('0x26')](handleEntityNotFound(_0x162c13,null))[_0xf5f2('0x26')](function(_0x934a7d){if(_0x934a7d){return _0x934a7d[_0xf5f2('0x8c')](_0x24ca50[_0xf5f2('0x8d')][_0xf5f2('0x69')],_[_0xf5f2('0x8e')](_0x24ca50[_0xf5f2('0x8d')],[_0xf5f2('0x69'),'id'])||{})['spread'](function(_0x52e419){for(var _0x2076c7=0x0;_0x2076c7<_0x24ca50[_0xf5f2('0x8d')][_0xf5f2('0x69')][_0xf5f2('0x3c')];_0x2076c7+=0x1){socket['emit'](_0xf5f2('0x8f'),{'UserId':_0x24ca50[_0xf5f2('0x8d')][_0xf5f2('0x69')][_0x2076c7],'SmsQueueId':_0x24ca50[_0xf5f2('0x4a')]['id']});}return _0x52e419;});}})[_0xf5f2('0x26')](respondWithResult(_0x162c13,null))['catch'](handleError(_0x162c13,null));};exports[_0xf5f2('0x89')]=function(_0x18d727,_0x4bdb72,_0x4511f4){return db[_0xf5f2('0x31')][_0xf5f2('0x4e')]({'where':{'id':_0x18d727[_0xf5f2('0x4a')]['id']}})['then'](handleEntityNotFound(_0x4bdb72,null))[_0xf5f2('0x26')](function(_0xfc76d9){if(_0xfc76d9){return _0xfc76d9[_0xf5f2('0x89')](_0x18d727['query']['ids'])[_0xf5f2('0x26')](function(){if(_[_0xf5f2('0x90')](_0x18d727[_0xf5f2('0x37')][_0xf5f2('0x69')])){for(var _0xbe2fb6=0x0;_0xbe2fb6<_0x18d727[_0xf5f2('0x37')]['ids'][_0xf5f2('0x3c')];_0xbe2fb6+=0x1){socket['emit'](_0xf5f2('0x8b'),{'UserId':Number(_0x18d727[_0xf5f2('0x37')][_0xf5f2('0x69')][_0xbe2fb6]),'SmsQueueId':Number(_0x18d727[_0xf5f2('0x4a')]['id'])});}}else{socket[_0xf5f2('0x8a')](_0xf5f2('0x8b'),{'UserId':Number(_0x18d727['query'][_0xf5f2('0x69')]),'SmsQueueId':Number(_0x18d727[_0xf5f2('0x4a')]['id'])});}});}})[_0xf5f2('0x26')](respondWithStatusCode(_0x4bdb72,null))[_0xf5f2('0x48')](handleError(_0x4bdb72,null));};exports[_0xf5f2('0x91')]=function(_0x1348e8,_0x12d215,_0x54b095){var _0x1ee541={};var _0x4a6b83={};var _0x5857d1;var _0x505056;return db[_0xf5f2('0x31')][_0xf5f2('0x58')]({'where':{'id':_0x1348e8['params']['id']}})[_0xf5f2('0x26')](handleEntityNotFound(_0x12d215,null))[_0xf5f2('0x26')](function(_0x2a2791){if(_0x2a2791){_0x5857d1=_0x2a2791;_0x4a6b83[_0xf5f2('0x35')]=_['keys'](db[_0xf5f2('0x5d')][_0xf5f2('0x4c')]);_0x4a6b83[_0xf5f2('0x37')]=_['keys'](_0x1348e8[_0xf5f2('0x37')]);_0x4a6b83[_0xf5f2('0x38')]=_['intersection'](_0x4a6b83[_0xf5f2('0x35')],_0x4a6b83[_0xf5f2('0x37')]);_0x1ee541[_0xf5f2('0x3a')]=_[_0xf5f2('0x39')](_0x4a6b83[_0xf5f2('0x35')],qs[_0xf5f2('0x3b')](_0x1348e8[_0xf5f2('0x37')][_0xf5f2('0x3b')]));_0x1ee541[_0xf5f2('0x3a')]=_0x1ee541[_0xf5f2('0x3a')][_0xf5f2('0x3c')]?_0x1ee541['attributes']:_0x4a6b83[_0xf5f2('0x35')];_0x1ee541[_0xf5f2('0x3e')]=qs['sort'](_0x1348e8[_0xf5f2('0x37')]['sort']);_0x1ee541[_0xf5f2('0x40')]=qs[_0xf5f2('0x38')](_[_0xf5f2('0x41')](_0x1348e8[_0xf5f2('0x37')],_0x4a6b83['filters']));if(_0x1348e8[_0xf5f2('0x37')]['filter']){_0x1ee541[_0xf5f2('0x40')]=_['merge'](_0x1ee541[_0xf5f2('0x40')],{'$or':_[_0xf5f2('0x36')](_0x1ee541['attributes'],function(_0x2bfc53){var _0x4525c9={};_0x4525c9[_0x2bfc53]={'$like':'%'+_0x1348e8[_0xf5f2('0x37')][_0xf5f2('0x42')]+'%'};return _0x4525c9;})});}_0x1ee541=_[_0xf5f2('0x43')]({},_0x1ee541,_0x1348e8[_0xf5f2('0x45')]);return _0x5857d1['getAgents'](_0x1ee541);}})['then'](function(_0x16a189){if(_0x16a189){_0x505056=_0x16a189[_0xf5f2('0x3c')];if(!_0x1348e8['query'][_0xf5f2('0x5a')](_0xf5f2('0x5b'))){_0x1ee541[_0xf5f2('0x3d')]=qs[_0xf5f2('0x3d')](_0x1348e8[_0xf5f2('0x37')][_0xf5f2('0x3d')]);_0x1ee541[_0xf5f2('0x21')]=qs['offset'](_0x1348e8[_0xf5f2('0x37')]['offset']);}return _0x5857d1[_0xf5f2('0x91')](_0x1ee541);}})['then'](function(_0x3ff273){if(_0x3ff273){return _0x3ff273?{'count':_0x505056,'rows':_0x3ff273}:null;}})['then'](respondWithResult(_0x12d215,null))[_0xf5f2('0x48')](handleError(_0x12d215,null));}; \ No newline at end of file +var _0xadb5=['flatMap','transaction','findOrCreate','forEach','emit','userSmsQueue:save','removeTeams','select','tq.TeamId','from','team_has_sms_queues','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','SmsQueueId\x20=\x20?','clone','ut.UserId\x20=\x20?','sequelize','toString','QueryTypes','SELECT','every','TeamId','includes','union','compact','isEmpty','removeAgents','userSmsQueue:remove','addAgents','omit','spread','isArray','getAgents','eml-format','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../mysqldb','defaults','localhost','socket.io-emitter','redis','register','sendStatus','end','status','json','offset','set','Content-Range','apply','save','update','then','destroy','SmsQueues','stack','name','send','map','SmsQueue','rawAttributes','type','model','query','keys','intersection','fields','attributes','limit','sort','where','pick','filters','filter','merge','options','includeAll','include','findAll','rows','catch','show','params','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','find','userProfileId','autoAssociation','UserProfileResource','create','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','getMembers','findOne','get','UserSmsQueue','length','hasOwnProperty','nolimit','order','User','findAndCountAll','UserId','agent','createdAt','count','format','SIP','smsPause','updatedAt','getTeams','Team','addTeams','ids','Agents','online','interface'];(function(_0x275022,_0x3db727){var _0x188678=function(_0x5875cc){while(--_0x5875cc){_0x275022['push'](_0x275022['shift']());}};_0x188678(++_0x3db727);}(_0xadb5,0xad));var _0x5adb=function(_0x27573e,_0x27722f){_0x27573e=_0x27573e-0x0;var _0x2472c9=_0xadb5[_0x27573e];return _0x2472c9;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x5adb('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x5adb('0x1'));var jsonpatch=require(_0x5adb('0x2'));var rp=require(_0x5adb('0x3'));var moment=require('moment');var BPromise=require(_0x5adb('0x4'));var Mustache=require(_0x5adb('0x5'));var util=require(_0x5adb('0x6'));var path=require('path');var sox=require(_0x5adb('0x7'));var csv=require(_0x5adb('0x8'));var ejs=require(_0x5adb('0x9'));var fs=require('fs');var _=require(_0x5adb('0xa'));var squel=require(_0x5adb('0xb'));var crypto=require(_0x5adb('0xc'));var jsforce=require(_0x5adb('0xd'));var deskjs=require(_0x5adb('0xe'));var toCsv=require(_0x5adb('0x8'));var querystring=require(_0x5adb('0xf'));var Papa=require(_0x5adb('0x10'));var Redis=require(_0x5adb('0x11'));var authService=require(_0x5adb('0x12'));var qs=require(_0x5adb('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x5adb('0x14'))(_0x5adb('0x15'));var utils=require(_0x5adb('0x16'));var config=require('../../config/environment');var db=require(_0x5adb('0x17'))['db'];config['redis']=_[_0x5adb('0x18')](config['redis'],{'host':_0x5adb('0x19'),'port':0x18eb});var socket=require(_0x5adb('0x1a'))(new Redis(config[_0x5adb('0x1b')]));require('./smsQueue.socket')[_0x5adb('0x1c')](socket);function respondWithStatusCode(_0x34af2c,_0xf82f72){_0xf82f72=_0xf82f72||0xcc;return function(_0x5263ec){if(_0x5263ec){return _0x34af2c[_0x5adb('0x1d')](_0xf82f72);}return _0x34af2c['status'](_0xf82f72)[_0x5adb('0x1e')]();};}function respondWithResult(_0x42a482,_0x30614e){_0x30614e=_0x30614e||0xc8;return function(_0x304784){if(_0x304784){return _0x42a482[_0x5adb('0x1f')](_0x30614e)[_0x5adb('0x20')](_0x304784);}};}function respondWithFilteredResult(_0xa29dc,_0x42f4c6){return function(_0xb953a6){if(_0xb953a6){var _0x529b65=_0xb953a6['count'],_0x3fff62=_0x42f4c6[_0x5adb('0x21')],_0x5de028=_0x42f4c6['offset']+_0x42f4c6['limit'],_0x1d9e86;if(_0x5de028>=_0x529b65){_0x5de028=_0x529b65;_0x1d9e86=0xc8;}else{_0x1d9e86=0xce;}_0xa29dc[_0x5adb('0x1f')](_0x1d9e86);return _0xa29dc[_0x5adb('0x22')](_0x5adb('0x23'),_0x3fff62+'-'+_0x5de028+'/'+_0x529b65)[_0x5adb('0x20')](_0xb953a6);}return null;};}function patchUpdates(_0x99bc6c){return function(_0x5af69d){try{jsonpatch[_0x5adb('0x24')](_0x5af69d,_0x99bc6c,!![]);}catch(_0x5c296e){return BPromise['reject'](_0x5c296e);}return _0x5af69d[_0x5adb('0x25')]();};}function saveUpdates(_0x379b33,_0x1a38d3){return function(_0x1a8014){if(_0x1a8014){return _0x1a8014[_0x5adb('0x26')](_0x379b33)[_0x5adb('0x27')](function(_0xfd9bb9){return _0xfd9bb9;});}return null;};}function removeEntity(_0x4ca150,_0x4b1957){return function(_0x373cc3){if(_0x373cc3){return _0x373cc3[_0x5adb('0x28')]()[_0x5adb('0x27')](function(){var _0xeb556c=_0x373cc3['get']({'plain':!![]});var _0x2fee18=_0x5adb('0x29');return db['UserProfileResource'][_0x5adb('0x28')]({'where':{'type':_0x2fee18,'resourceId':_0xeb556c['id']}})[_0x5adb('0x27')](function(){return _0x373cc3;});})[_0x5adb('0x27')](function(){_0x4ca150['status'](0xcc)[_0x5adb('0x1e')]();});}};}function handleEntityNotFound(_0xbe21b1,_0x3a4fca){return function(_0x2c64a3){if(!_0x2c64a3){_0xbe21b1[_0x5adb('0x1d')](0x194);}return _0x2c64a3;};}function handleError(_0x1c06c4,_0x4a5d46){_0x4a5d46=_0x4a5d46||0x1f4;return function(_0x49992e){logger['error'](_0x49992e[_0x5adb('0x2a')]);if(_0x49992e[_0x5adb('0x2b')]){delete _0x49992e[_0x5adb('0x2b')];}_0x1c06c4[_0x5adb('0x1f')](_0x4a5d46)[_0x5adb('0x2c')](_0x49992e);};}exports['index']=function(_0x11ec2a,_0x34b793){var _0x372da1={},_0x3b1fed={},_0x450169={'count':0x0,'rows':[]};var _0x3145f2=_[_0x5adb('0x2d')](db[_0x5adb('0x2e')][_0x5adb('0x2f')],function(_0x260295){return{'name':_0x260295['fieldName'],'type':_0x260295[_0x5adb('0x30')]['key']};});_0x3b1fed[_0x5adb('0x31')]=_[_0x5adb('0x2d')](_0x3145f2,'name');_0x3b1fed[_0x5adb('0x32')]=_[_0x5adb('0x33')](_0x11ec2a[_0x5adb('0x32')]);_0x3b1fed['filters']=_[_0x5adb('0x34')](_0x3b1fed[_0x5adb('0x31')],_0x3b1fed['query']);_0x372da1['attributes']=_[_0x5adb('0x34')](_0x3b1fed['model'],qs[_0x5adb('0x35')](_0x11ec2a[_0x5adb('0x32')][_0x5adb('0x35')]));_0x372da1[_0x5adb('0x36')]=_0x372da1[_0x5adb('0x36')]['length']?_0x372da1[_0x5adb('0x36')]:_0x3b1fed[_0x5adb('0x31')];if(!_0x11ec2a[_0x5adb('0x32')]['hasOwnProperty']('nolimit')){_0x372da1[_0x5adb('0x37')]=qs[_0x5adb('0x37')](_0x11ec2a['query'][_0x5adb('0x37')]);_0x372da1['offset']=qs[_0x5adb('0x21')](_0x11ec2a['query'][_0x5adb('0x21')]);}_0x372da1['order']=qs[_0x5adb('0x38')](_0x11ec2a[_0x5adb('0x32')]['sort']);_0x372da1[_0x5adb('0x39')]=qs['filters'](_[_0x5adb('0x3a')](_0x11ec2a[_0x5adb('0x32')],_0x3b1fed[_0x5adb('0x3b')]));if(_0x11ec2a['query'][_0x5adb('0x3c')]){_0x372da1[_0x5adb('0x39')]=_[_0x5adb('0x3d')](_0x372da1[_0x5adb('0x39')],{'$or':_[_0x5adb('0x2d')](_0x3145f2,function(_0x52d74f){if(_0x52d74f['type']!=='VIRTUAL'){var _0x599999={};_0x599999[_0x52d74f[_0x5adb('0x2b')]]={'$like':'%'+_0x11ec2a[_0x5adb('0x32')][_0x5adb('0x3c')]+'%'};return _0x599999;}})});}_0x372da1=_[_0x5adb('0x3d')]({},_0x372da1,_0x11ec2a[_0x5adb('0x3e')]);var _0xd1c3c2={'where':_0x372da1[_0x5adb('0x39')]};return db[_0x5adb('0x2e')]['count'](_0xd1c3c2)['then'](function(_0x27dbb7){_0x450169['count']=_0x27dbb7;if(_0x11ec2a[_0x5adb('0x32')][_0x5adb('0x3f')]){_0x372da1[_0x5adb('0x40')]=[{'all':!![]}];}return db[_0x5adb('0x2e')][_0x5adb('0x41')](_0x372da1);})['then'](function(_0x43d320){_0x450169[_0x5adb('0x42')]=_0x43d320;return _0x450169;})['then'](respondWithFilteredResult(_0x34b793,_0x372da1))[_0x5adb('0x43')](handleError(_0x34b793,null));};exports[_0x5adb('0x44')]=function(_0x5833c8,_0x120497){var _0x407a4c={'raw':!![],'where':{'id':_0x5833c8[_0x5adb('0x45')]['id']}},_0x1d6bef={};_0x1d6bef[_0x5adb('0x31')]=_[_0x5adb('0x33')](db[_0x5adb('0x2e')]['rawAttributes']);_0x1d6bef['query']=_[_0x5adb('0x33')](_0x5833c8[_0x5adb('0x32')]);_0x1d6bef[_0x5adb('0x3b')]=_[_0x5adb('0x34')](_0x1d6bef['model'],_0x1d6bef['query']);_0x407a4c[_0x5adb('0x36')]=_[_0x5adb('0x34')](_0x1d6bef[_0x5adb('0x31')],qs[_0x5adb('0x35')](_0x5833c8[_0x5adb('0x32')]['fields']));_0x407a4c[_0x5adb('0x36')]=_0x407a4c[_0x5adb('0x36')]['length']?_0x407a4c[_0x5adb('0x36')]:_0x1d6bef[_0x5adb('0x31')];if(_0x5833c8[_0x5adb('0x32')][_0x5adb('0x3f')]){_0x407a4c[_0x5adb('0x40')]=[{'all':!![]}];}_0x407a4c=_[_0x5adb('0x3d')]({},_0x407a4c,_0x5833c8[_0x5adb('0x3e')]);return db[_0x5adb('0x2e')]['find'](_0x407a4c)[_0x5adb('0x27')](handleEntityNotFound(_0x120497,null))['then'](respondWithResult(_0x120497,null))['catch'](handleError(_0x120497,null));};exports['create']=function(_0x3cd211,_0x3fbac8){return db[_0x5adb('0x2e')]['create'](_0x3cd211[_0x5adb('0x46')],{})['then'](function(_0x177a81){var _0x2c3f21=_0x3cd211[_0x5adb('0x47')]['get']({'plain':!![]});if(!_0x2c3f21)throw new Error(_0x5adb('0x48'));if(_0x2c3f21['role']===_0x5adb('0x47')){var _0x6dc067=_0x177a81['get']({'plain':!![]});var _0x2402a3=_0x5adb('0x29');return db[_0x5adb('0x49')][_0x5adb('0x4a')]({'where':{'name':_0x2402a3,'userProfileId':_0x2c3f21[_0x5adb('0x4b')]},'raw':!![]})['then'](function(_0x36b847){if(_0x36b847&&_0x36b847[_0x5adb('0x4c')]===0x0){return db[_0x5adb('0x4d')][_0x5adb('0x4e')]({'name':_0x6dc067['name'],'resourceId':_0x6dc067['id'],'type':_0x36b847[_0x5adb('0x2b')],'sectionId':_0x36b847['id']},{})[_0x5adb('0x27')](function(){return _0x177a81;});}else{return _0x177a81;}})[_0x5adb('0x43')](function(_0x4d98d0){logger[_0x5adb('0x4f')](_0x5adb('0x50'),_0x4d98d0);throw _0x4d98d0;});}return _0x177a81;})[_0x5adb('0x27')](respondWithResult(_0x3fbac8,0xc9))[_0x5adb('0x43')](handleError(_0x3fbac8,null));};exports['update']=function(_0x3f5c8e,_0x91775c){if(_0x3f5c8e[_0x5adb('0x46')]['id']){delete _0x3f5c8e[_0x5adb('0x46')]['id'];}return db[_0x5adb('0x2e')]['find']({'where':{'id':_0x3f5c8e[_0x5adb('0x45')]['id']}})['then'](handleEntityNotFound(_0x91775c,null))[_0x5adb('0x27')](saveUpdates(_0x3f5c8e['body'],null))[_0x5adb('0x27')](respondWithResult(_0x91775c,null))[_0x5adb('0x43')](handleError(_0x91775c,null));};exports[_0x5adb('0x28')]=function(_0x42f6d9,_0x59b512){return db[_0x5adb('0x2e')][_0x5adb('0x4a')]({'where':{'id':_0x42f6d9[_0x5adb('0x45')]['id']}})['then'](handleEntityNotFound(_0x59b512,null))['then'](removeEntity(_0x59b512,null))['catch'](handleError(_0x59b512,null));};exports[_0x5adb('0x51')]=function(_0x31a1f9,_0xa5ecc0){return db[_0x5adb('0x2e')][_0x5adb('0x51')]()[_0x5adb('0x27')](respondWithResult(_0xa5ecc0,null))[_0x5adb('0x43')](handleError(_0xa5ecc0,null));};exports[_0x5adb('0x52')]=function(_0xc880af,_0x380d76,_0x452767){var _0x1df439={'raw':!![],'where':{}},_0x2c2357={},_0x511746;return db['SmsQueue'][_0x5adb('0x53')]({'where':{'id':_0xc880af[_0x5adb('0x45')]['id']}})[_0x5adb('0x27')](handleEntityNotFound(_0x380d76,null))[_0x5adb('0x27')](function(_0x5d7a9f){if(_0x5d7a9f){_0x511746=_0x5d7a9f[_0x5adb('0x54')]({'plain':!![]});_0x2c2357[_0x5adb('0x31')]=_['keys'](db[_0x5adb('0x55')][_0x5adb('0x2f')]);_0x2c2357[_0x5adb('0x32')]=_['keys'](_0xc880af[_0x5adb('0x32')]);_0x2c2357[_0x5adb('0x3b')]=_[_0x5adb('0x34')](_0x2c2357[_0x5adb('0x31')],_0x2c2357[_0x5adb('0x32')]);_0x1df439[_0x5adb('0x36')]=_['intersection'](_0x2c2357[_0x5adb('0x31')],qs[_0x5adb('0x35')](_0xc880af[_0x5adb('0x32')]['fields']));_0x1df439[_0x5adb('0x36')]=_0x1df439[_0x5adb('0x36')][_0x5adb('0x56')]?_0x1df439['attributes']:_0x2c2357[_0x5adb('0x31')];if(!_0xc880af['query'][_0x5adb('0x57')](_0x5adb('0x58'))){_0x1df439[_0x5adb('0x37')]=qs['limit'](_0xc880af[_0x5adb('0x32')][_0x5adb('0x37')]);_0x1df439['offset']=qs[_0x5adb('0x21')](_0xc880af[_0x5adb('0x32')][_0x5adb('0x21')]);}_0x1df439[_0x5adb('0x59')]=qs['sort'](_0xc880af[_0x5adb('0x32')][_0x5adb('0x38')]);_0x1df439[_0x5adb('0x39')]=qs[_0x5adb('0x3b')](_['pick'](_0xc880af['query'],_0x2c2357[_0x5adb('0x3b')]));_0x1df439['where']['SmsQueueId']=_0x5d7a9f['id'];if(_0xc880af['query'][_0x5adb('0x3c')]){_0x1df439[_0x5adb('0x39')]=_['merge'](_0x1df439[_0x5adb('0x39')],{'$or':_[_0x5adb('0x2d')](_0x1df439[_0x5adb('0x36')],function(_0xf6ef8a){var _0x358a23={};_0x358a23[_0xf6ef8a]={'$like':'%'+_0xc880af[_0x5adb('0x32')][_0x5adb('0x3c')]+'%'};return _0x358a23;})});}_0x1df439=_[_0x5adb('0x3d')]({},_0x1df439,_0xc880af['options']);return db['UserSmsQueue']['findAll'](_0x1df439);}})[_0x5adb('0x27')](function(_0x4357a6){if(_0x4357a6){return db[_0x5adb('0x5a')][_0x5adb('0x5b')]({'where':{'id':_[_0x5adb('0x2d')](_0x4357a6,_0x5adb('0x5c')),'role':_0x5adb('0x5d')},'attributes':['id',_0x5adb('0x2b'),'smsPause','updatedAt',_0x5adb('0x5e')]});}})[_0x5adb('0x27')](function(_0x114ee4){if(_0x114ee4){return{'count':_0x114ee4[_0x5adb('0x5f')],'rows':_[_0x5adb('0x2d')](_0x114ee4[_0x5adb('0x42')],function(_0x40140f){return{'membername':_0x40140f[_0x5adb('0x2b')],'UserId':_0x40140f['id'],'queue_name':_0x511746[_0x5adb('0x2b')],'SmsQueueId':_0x511746['id'],'interface':util[_0x5adb('0x60')]('%s/%s',_0x5adb('0x61'),_0x40140f[_0x5adb('0x2b')]),'penalty':0x0,'paused':_0x40140f[_0x5adb('0x62')],'createdAt':_0x40140f['createdAt'],'updatedAt':_0x40140f[_0x5adb('0x63')]};})};}else{return{'count':0x0,'rows':[]};}})[_0x5adb('0x27')](respondWithFilteredResult(_0x380d76,_0x1df439))['catch'](handleError(_0x380d76,null));};exports[_0x5adb('0x64')]=function(_0x494526,_0x473538,_0x31555a){var _0x5ea16a={};var _0x4734c6={};var _0x1ceb72;var _0x3d49f2;return db[_0x5adb('0x2e')][_0x5adb('0x53')]({'where':{'id':_0x494526[_0x5adb('0x45')]['id']}})[_0x5adb('0x27')](handleEntityNotFound(_0x473538,null))[_0x5adb('0x27')](function(_0x49a8a6){if(_0x49a8a6){_0x1ceb72=_0x49a8a6;_0x4734c6[_0x5adb('0x31')]=_[_0x5adb('0x33')](db[_0x5adb('0x65')]['rawAttributes']);_0x4734c6['query']=_[_0x5adb('0x33')](_0x494526['query']);_0x4734c6[_0x5adb('0x3b')]=_[_0x5adb('0x34')](_0x4734c6[_0x5adb('0x31')],_0x4734c6['query']);_0x5ea16a[_0x5adb('0x36')]=_[_0x5adb('0x34')](_0x4734c6[_0x5adb('0x31')],qs[_0x5adb('0x35')](_0x494526[_0x5adb('0x32')]['fields']));_0x5ea16a[_0x5adb('0x36')]=_0x5ea16a[_0x5adb('0x36')][_0x5adb('0x56')]?_0x5ea16a[_0x5adb('0x36')]:_0x4734c6['model'];_0x5ea16a[_0x5adb('0x59')]=qs[_0x5adb('0x38')](_0x494526[_0x5adb('0x32')][_0x5adb('0x38')]);_0x5ea16a[_0x5adb('0x39')]=qs[_0x5adb('0x3b')](_[_0x5adb('0x3a')](_0x494526['query'],_0x4734c6[_0x5adb('0x3b')]));if(_0x494526[_0x5adb('0x32')]['filter']){_0x5ea16a[_0x5adb('0x39')]=_[_0x5adb('0x3d')](_0x5ea16a['where'],{'$or':_[_0x5adb('0x2d')](_0x5ea16a['attributes'],function(_0x372354){var _0x268df2={};_0x268df2[_0x372354]={'$like':'%'+_0x494526['query'][_0x5adb('0x3c')]+'%'};return _0x268df2;})});}_0x5ea16a=_['merge']({},_0x5ea16a,_0x494526[_0x5adb('0x3e')]);return _0x1ceb72[_0x5adb('0x64')](_0x5ea16a);}})[_0x5adb('0x27')](function(_0x3a4a28){if(_0x3a4a28){_0x3d49f2=_0x3a4a28[_0x5adb('0x56')];if(!_0x494526['query'][_0x5adb('0x57')](_0x5adb('0x58'))){_0x5ea16a[_0x5adb('0x37')]=qs[_0x5adb('0x37')](_0x494526['query']['limit']);_0x5ea16a[_0x5adb('0x21')]=qs[_0x5adb('0x21')](_0x494526[_0x5adb('0x32')][_0x5adb('0x21')]);}return _0x1ceb72[_0x5adb('0x64')](_0x5ea16a);}})[_0x5adb('0x27')](function(_0x31f5b2){if(_0x31f5b2){return _0x31f5b2?{'count':_0x3d49f2,'rows':_0x31f5b2}:null;}})['then'](respondWithResult(_0x473538,null))[_0x5adb('0x43')](handleError(_0x473538,null));};exports[_0x5adb('0x66')]=function(_0x1883bd,_0x43b3a8,_0x55a9e8){var _0x450f90=_0x1883bd[_0x5adb('0x46')][_0x5adb('0x67')];return db[_0x5adb('0x65')][_0x5adb('0x41')]({'where':{'id':_0x450f90},'attributes':['id'],'include':[{'model':db[_0x5adb('0x5a')],'as':_0x5adb('0x68'),'attributes':['id',_0x5adb('0x2b'),_0x5adb('0x69'),'voicePause',_0x5adb('0x6a')],'raw':!![]}]})[_0x5adb('0x27')](function(_0x5c55ee){if(_0x5c55ee){var _0x44d50f=_[_0x5adb('0x6b')](_0x5c55ee,function(_0x2b8915){var _0x3bb3fc=_0x2b8915[_0x5adb('0x54')]({'plain':!![]});return _0x3bb3fc[_0x5adb('0x68')];});return db[_0x5adb('0x2e')][_0x5adb('0x4a')]({'where':{'id':_0x1883bd['params']['id']}})[_0x5adb('0x27')](function(_0x2386c0){return db['sequelize'][_0x5adb('0x6c')](function(_0x58a26f){return _0x2386c0[_0x5adb('0x66')](_0x450f90,{'transaction':_0x58a26f})['then'](function(){return BPromise['each'](_0x44d50f,function(_0x2d7a9f){return db[_0x5adb('0x55')][_0x5adb('0x6d')]({'where':{'UserId':_0x2d7a9f['id'],'SmsQueueId':_0x1883bd['params']['id']},'transaction':_0x58a26f});});})[_0x5adb('0x27')](function(){_0x44d50f[_0x5adb('0x6e')](function(_0x3ac059){socket[_0x5adb('0x6f')](_0x5adb('0x70'),{'UserId':_0x3ac059['id'],'SmsQueueId':_0x2386c0['id']});});});});});}})[_0x5adb('0x27')](respondWithStatusCode(_0x43b3a8,null))[_0x5adb('0x43')](handleError(_0x43b3a8,null));};exports[_0x5adb('0x71')]=function(_0x28bd33,_0x3e8a17,_0x423b80){return db[_0x5adb('0x65')]['findAll']({'where':{'id':_0x28bd33['query'][_0x5adb('0x67')]},'attributes':['id'],'include':[{'model':db[_0x5adb('0x5a')],'as':'Agents','attributes':['id'],'raw':!![]}]})[_0x5adb('0x27')](handleEntityNotFound(_0x3e8a17,null))[_0x5adb('0x27')](function(_0x38acde){var _0x1a39b4=_[_0x5adb('0x2d')](_0x38acde,'id');var _0x24cd3b=[];var _0x15626b=[];var _0x327ac6=squel[_0x5adb('0x72')]();_0x327ac6['field'](_0x5adb('0x73'))[_0x5adb('0x74')](_0x5adb('0x75'),'tq')['join'](_0x5adb('0x76'),'ut',_0x5adb('0x77'))[_0x5adb('0x39')](_0x5adb('0x78'),_0x28bd33[_0x5adb('0x45')]['id']);for(var _0x2a78f9=0x0;_0x2a78f9<_0x38acde['length'];_0x2a78f9+=0x1){let _0x13a4aa=_0x38acde[_0x2a78f9];for(var _0x2c4129=0x0;_0x2c4129<_0x13a4aa[_0x5adb('0x68')][_0x5adb('0x56')];_0x2c4129+=0x1){let _0x2c3af8=_0x13a4aa[_0x5adb('0x68')][_0x2c4129];var _0x95fb11=_0x327ac6[_0x5adb('0x79')]();_0x95fb11[_0x5adb('0x39')](_0x5adb('0x7a'),_0x2c3af8['id']);_0x15626b['push'](db[_0x5adb('0x7b')]['query'](_0x95fb11[_0x5adb('0x7c')](),{'type':db[_0x5adb('0x7b')][_0x5adb('0x7d')][_0x5adb('0x7e')]})[_0x5adb('0x27')](function(_0x5c7b1b){if(_0x5c7b1b['length']===0x1){return _0x2c3af8['id'];}else{var _0x1aa301=_[_0x5adb('0x7f')](_[_0x5adb('0x2d')](_0x5c7b1b,_0x5adb('0x80')),function(_0x3c1a6f){return _[_0x5adb('0x81')](_0x1a39b4,_0x3c1a6f);});if(_0x1aa301){return _0x2c3af8['id'];}}}));}}return BPromise['all'](_0x15626b)['then'](function(_0x38c4a5){_0x24cd3b=_(_0x24cd3b)[_0x5adb('0x82')](_0x38c4a5)[_0x5adb('0x83')]()['value']();return db['SmsQueue'][_0x5adb('0x4a')]({'where':{'id':_0x28bd33['params']['id']}})[_0x5adb('0x27')](function(_0x169848){return db['sequelize']['transaction'](function(_0x43b91c){return _0x169848['removeTeams'](_0x28bd33['query'][_0x5adb('0x67')],{'transaction':_0x43b91c})[_0x5adb('0x27')](function(){if(!_[_0x5adb('0x84')](_0x24cd3b)){return _0x169848[_0x5adb('0x85')](_0x24cd3b,{'transaction':_0x43b91c});}})[_0x5adb('0x27')](function(){_0x24cd3b[_0x5adb('0x6e')](function(_0xa51ffc){socket[_0x5adb('0x6f')](_0x5adb('0x86'),{'UserId':_0xa51ffc,'SmsQueueId':_0x169848['id']});});});});});});})[_0x5adb('0x27')](respondWithStatusCode(_0x3e8a17,null))[_0x5adb('0x43')](handleError(_0x3e8a17,null));};exports[_0x5adb('0x87')]=function(_0x2808e4,_0x4f4898,_0xb3a828){return db['SmsQueue'][_0x5adb('0x4a')]({'where':{'id':_0x2808e4[_0x5adb('0x45')]['id']}})[_0x5adb('0x27')](handleEntityNotFound(_0x4f4898,null))[_0x5adb('0x27')](function(_0x460a76){if(_0x460a76){return _0x460a76[_0x5adb('0x87')](_0x2808e4[_0x5adb('0x46')][_0x5adb('0x67')],_[_0x5adb('0x88')](_0x2808e4[_0x5adb('0x46')],[_0x5adb('0x67'),'id'])||{})[_0x5adb('0x89')](function(_0x4884a0){for(var _0x3a9cc8=0x0;_0x3a9cc8<_0x2808e4[_0x5adb('0x46')][_0x5adb('0x67')][_0x5adb('0x56')];_0x3a9cc8+=0x1){socket[_0x5adb('0x6f')](_0x5adb('0x70'),{'UserId':_0x2808e4[_0x5adb('0x46')][_0x5adb('0x67')][_0x3a9cc8],'SmsQueueId':_0x2808e4['params']['id']});}return _0x4884a0;});}})[_0x5adb('0x27')](respondWithResult(_0x4f4898,null))[_0x5adb('0x43')](handleError(_0x4f4898,null));};exports[_0x5adb('0x85')]=function(_0x50cf0b,_0x469810,_0x4ae211){return db[_0x5adb('0x2e')]['find']({'where':{'id':_0x50cf0b['params']['id']}})[_0x5adb('0x27')](handleEntityNotFound(_0x469810,null))[_0x5adb('0x27')](function(_0x356224){if(_0x356224){return _0x356224[_0x5adb('0x85')](_0x50cf0b[_0x5adb('0x32')][_0x5adb('0x67')])[_0x5adb('0x27')](function(){if(_[_0x5adb('0x8a')](_0x50cf0b[_0x5adb('0x32')][_0x5adb('0x67')])){for(var _0x45ce02=0x0;_0x45ce02<_0x50cf0b[_0x5adb('0x32')]['ids'][_0x5adb('0x56')];_0x45ce02+=0x1){socket['emit'](_0x5adb('0x86'),{'UserId':Number(_0x50cf0b[_0x5adb('0x32')]['ids'][_0x45ce02]),'SmsQueueId':Number(_0x50cf0b[_0x5adb('0x45')]['id'])});}}else{socket[_0x5adb('0x6f')]('userSmsQueue:remove',{'UserId':Number(_0x50cf0b['query'][_0x5adb('0x67')]),'SmsQueueId':Number(_0x50cf0b[_0x5adb('0x45')]['id'])});}});}})[_0x5adb('0x27')](respondWithStatusCode(_0x469810,null))[_0x5adb('0x43')](handleError(_0x469810,null));};exports[_0x5adb('0x8b')]=function(_0x2ea29b,_0x5dd55f,_0x4293e5){var _0x263421={};var _0x88aac7={};var _0x379419;var _0x22d299;return db['SmsQueue']['findOne']({'where':{'id':_0x2ea29b[_0x5adb('0x45')]['id']}})[_0x5adb('0x27')](handleEntityNotFound(_0x5dd55f,null))[_0x5adb('0x27')](function(_0xaf0b4){if(_0xaf0b4){_0x379419=_0xaf0b4;_0x88aac7[_0x5adb('0x31')]=_[_0x5adb('0x33')](db[_0x5adb('0x5a')][_0x5adb('0x2f')]);_0x88aac7[_0x5adb('0x32')]=_['keys'](_0x2ea29b[_0x5adb('0x32')]);_0x88aac7[_0x5adb('0x3b')]=_['intersection'](_0x88aac7['model'],_0x88aac7['query']);_0x263421[_0x5adb('0x36')]=_[_0x5adb('0x34')](_0x88aac7[_0x5adb('0x31')],qs['fields'](_0x2ea29b['query'][_0x5adb('0x35')]));_0x263421[_0x5adb('0x36')]=_0x263421[_0x5adb('0x36')][_0x5adb('0x56')]?_0x263421[_0x5adb('0x36')]:_0x88aac7[_0x5adb('0x31')];_0x263421['order']=qs['sort'](_0x2ea29b[_0x5adb('0x32')]['sort']);_0x263421[_0x5adb('0x39')]=qs[_0x5adb('0x3b')](_['pick'](_0x2ea29b[_0x5adb('0x32')],_0x88aac7[_0x5adb('0x3b')]));if(_0x2ea29b[_0x5adb('0x32')][_0x5adb('0x3c')]){_0x263421['where']=_[_0x5adb('0x3d')](_0x263421[_0x5adb('0x39')],{'$or':_[_0x5adb('0x2d')](_0x263421[_0x5adb('0x36')],function(_0x4ec5bd){var _0xb4a84b={};_0xb4a84b[_0x4ec5bd]={'$like':'%'+_0x2ea29b['query'][_0x5adb('0x3c')]+'%'};return _0xb4a84b;})});}_0x263421=_[_0x5adb('0x3d')]({},_0x263421,_0x2ea29b[_0x5adb('0x3e')]);return _0x379419[_0x5adb('0x8b')](_0x263421);}})[_0x5adb('0x27')](function(_0x190c08){if(_0x190c08){_0x22d299=_0x190c08['length'];if(!_0x2ea29b[_0x5adb('0x32')][_0x5adb('0x57')](_0x5adb('0x58'))){_0x263421[_0x5adb('0x37')]=qs['limit'](_0x2ea29b[_0x5adb('0x32')]['limit']);_0x263421['offset']=qs['offset'](_0x2ea29b[_0x5adb('0x32')]['offset']);}return _0x379419['getAgents'](_0x263421);}})[_0x5adb('0x27')](function(_0x143f33){if(_0x143f33){return _0x143f33?{'count':_0x22d299,'rows':_0x143f33}:null;}})[_0x5adb('0x27')](respondWithResult(_0x5dd55f,null))[_0x5adb('0x43')](handleError(_0x5dd55f,null));}; \ No newline at end of file diff --git a/server/api/smsQueue/smsQueue.events.js b/server/api/smsQueue/smsQueue.events.js index dab29d6..b5686a0 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 _0x8653=['setMaxListeners','save','remove','emit','hasOwnProperty','hook'];(function(_0x5333a6,_0x52f2c0){var _0x10d9c3=function(_0x3677cc){while(--_0x3677cc){_0x5333a6['push'](_0x5333a6['shift']());}};_0x10d9c3(++_0x52f2c0);}(_0x8653,0x17a));var _0x3865=function(_0x2f1d33,_0x2e9265){_0x2f1d33=_0x2f1d33-0x0;var _0x1100b9=_0x8653[_0x2f1d33];return _0x1100b9;};'use strict';var EventEmitter=require('events');var SmsQueue=require('../../mysqldb')['db']['SmsQueue'];var SmsQueueEvents=new EventEmitter();SmsQueueEvents[_0x3865('0x0')](0x0);var events={'afterCreate':_0x3865('0x1'),'afterUpdate':'update','afterDestroy':_0x3865('0x2')};function emitEvent(_0x4d3f6c){return function(_0x4e1d0d,_0x2dffc4,_0x5db5f0){SmsQueueEvents[_0x3865('0x3')](_0x4d3f6c+':'+_0x4e1d0d['id'],_0x4e1d0d);SmsQueueEvents['emit'](_0x4d3f6c,_0x4e1d0d);_0x5db5f0(null);};}for(var e in events){if(events[_0x3865('0x4')](e)){var event=events[e];SmsQueue[_0x3865('0x5')](e,emitEvent(event));}}module['exports']=SmsQueueEvents; \ No newline at end of file +var _0x699c=['save','update','emit','hasOwnProperty','exports','events','../../mysqldb','SmsQueue','setMaxListeners'];(function(_0x36512c,_0x10b179){var _0x4be856=function(_0x4a4a6d){while(--_0x4a4a6d){_0x36512c['push'](_0x36512c['shift']());}};_0x4be856(++_0x10b179);}(_0x699c,0xdd));var _0xc699=function(_0x167cc1,_0x56ef5a){_0x167cc1=_0x167cc1-0x0;var _0x10bc4b=_0x699c[_0x167cc1];return _0x10bc4b;};'use strict';var EventEmitter=require(_0xc699('0x0'));var SmsQueue=require(_0xc699('0x1'))['db'][_0xc699('0x2')];var SmsQueueEvents=new EventEmitter();SmsQueueEvents[_0xc699('0x3')](0x0);var events={'afterCreate':_0xc699('0x4'),'afterUpdate':_0xc699('0x5'),'afterDestroy':'remove'};function emitEvent(_0x1f761f){return function(_0x1990a8,_0x46d94d,_0x48bd3e){SmsQueueEvents[_0xc699('0x6')](_0x1f761f+':'+_0x1990a8['id'],_0x1990a8);SmsQueueEvents[_0xc699('0x6')](_0x1f761f,_0x1990a8);_0x48bd3e(null);};}for(var e in events){if(events[_0xc699('0x7')](e)){var event=events[e];SmsQueue['hook'](e,emitEvent(event));}}module[_0xc699('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 5517722..8d0b58d 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 _0xe5e0=['rimraf','../../config/environment','exports','define','sms_queues','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path'];(function(_0x4f8977,_0x294ff9){var _0x43bb8e=function(_0x341824){while(--_0x341824){_0x4f8977['push'](_0x4f8977['shift']());}};_0x43bb8e(++_0x294ff9);}(_0xe5e0,0x123));var _0x0e5e=function(_0x57c8b9,_0x5b6b1a){_0x57c8b9=_0x57c8b9-0x0;var _0x425a34=_0xe5e0[_0x57c8b9];return _0x425a34;};'use strict';var _=require(_0x0e5e('0x0'));var util=require(_0x0e5e('0x1'));var logger=require(_0x0e5e('0x2'))(_0x0e5e('0x3'));var moment=require(_0x0e5e('0x4'));var BPromise=require(_0x0e5e('0x5'));var rp=require(_0x0e5e('0x6'));var fs=require('fs');var path=require(_0x0e5e('0x7'));var rimraf=require(_0x0e5e('0x8'));var config=require(_0x0e5e('0x9'));var attributes=require('./smsQueue.attributes');module[_0x0e5e('0xa')]=function(_0x39c487,_0x5cc97b){return _0x39c487[_0x0e5e('0xb')]('SmsQueue',attributes,{'tableName':_0x0e5e('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x262e=['./smsQueue.attributes','SmsQueue','../../config/logger','api','path','rimraf','../../config/environment'];(function(_0x3e3748,_0x118608){var _0x467996=function(_0x475275){while(--_0x475275){_0x3e3748['push'](_0x3e3748['shift']());}};_0x467996(++_0x118608);}(_0x262e,0x87));var _0xe262=function(_0x5d4607,_0x6b5e7b){_0x5d4607=_0x5d4607-0x0;var _0x5e4a86=_0x262e[_0x5d4607];return _0x5e4a86;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0xe262('0x0'))(_0xe262('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0xe262('0x2'));var rimraf=require(_0xe262('0x3'));var config=require(_0xe262('0x4'));var attributes=require(_0xe262('0x5'));module['exports']=function(_0x58315e,_0x4031a2){return _0x58315e['define'](_0xe262('0x6'),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 c04dbf7..7fb132a 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 _0xa61a=['findAll','options','raw','where','attributes','map','include','model','ShowSmsQueue','find','lodash','bluebird','randomstring','rpc','../../config/environment','jayson/promise','http','redis','localhost','./smsQueue.socket','register','request','then','info','SmsQueue,\x20%s,\x20%s','request\x20sent','debug','SmsQueue,\x20%s,\x20%s,\x20%s','stringify','code','error','message','result','catch','GetSmsQueue','SmsQueue'];(function(_0x27998f,_0x3caf38){var _0x21b0ad=function(_0x5c61de){while(--_0x5c61de){_0x27998f['push'](_0x27998f['shift']());}};_0x21b0ad(++_0x3caf38);}(_0xa61a,0x12a));var _0xaa61=function(_0x36c6eb,_0x4fb127){_0x36c6eb=_0x36c6eb-0x0;var _0x30675b=_0xa61a[_0x36c6eb];return _0x30675b;};'use strict';var _=require(_0xaa61('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0xaa61('0x1'));var rs=require(_0xaa61('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0xaa61('0x3'));var config=require(_0xaa61('0x4'));var jayson=require(_0xaa61('0x5'));var client=jayson['client'][_0xaa61('0x6')]({'port':0x232a});config[_0xaa61('0x7')]=_['defaults'](config[_0xaa61('0x7')],{'host':_0xaa61('0x8'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0xaa61('0x9'))[_0xaa61('0xa')](socket);function respondWithRpcPromise(_0x2985f3,_0x2d92c7,_0x4683c5){return new BPromise(function(_0x2584d6,_0x46d5d4){return client[_0xaa61('0xb')](_0x2985f3,_0x4683c5)[_0xaa61('0xc')](function(_0x59819b){logger[_0xaa61('0xd')](_0xaa61('0xe'),_0x2d92c7,_0xaa61('0xf'));logger[_0xaa61('0x10')](_0xaa61('0x11'),_0x2d92c7,_0xaa61('0xf'),JSON[_0xaa61('0x12')](_0x59819b));if(_0x59819b['error']){if(_0x59819b['error'][_0xaa61('0x13')]===0x1f4){logger[_0xaa61('0x14')]('SmsQueue,\x20%s,\x20%s',_0x2d92c7,_0x59819b[_0xaa61('0x14')][_0xaa61('0x15')]);return _0x46d5d4(_0x59819b['error'][_0xaa61('0x15')]);}logger['error'](_0xaa61('0xe'),_0x2d92c7,_0x59819b[_0xaa61('0x14')][_0xaa61('0x15')]);return _0x2584d6(_0x59819b[_0xaa61('0x14')][_0xaa61('0x15')]);}else{logger[_0xaa61('0xd')](_0xaa61('0xe'),_0x2d92c7,'request\x20sent');_0x2584d6(_0x59819b[_0xaa61('0x16')][_0xaa61('0x15')]);}})[_0xaa61('0x17')](function(_0x26f235){logger['error'](_0xaa61('0xe'),_0x2d92c7,_0x26f235);_0x46d5d4(_0x26f235);});});}exports[_0xaa61('0x18')]=function(_0x153124){var _0xf674d3=this;return new Promise(function(_0x11c661,_0x16f35c){return db[_0xaa61('0x19')][_0xaa61('0x1a')]({'raw':_0x153124['options']?_0x153124[_0xaa61('0x1b')][_0xaa61('0x1c')]===undefined?!![]:![]:!![],'where':_0x153124[_0xaa61('0x1b')]?_0x153124['options'][_0xaa61('0x1d')]||null:null,'attributes':_0x153124[_0xaa61('0x1b')]?_0x153124[_0xaa61('0x1b')][_0xaa61('0x1e')]||null:null,'limit':_0x153124[_0xaa61('0x1b')]?_0x153124[_0xaa61('0x1b')]['limit']||null:null,'include':_0x153124[_0xaa61('0x1b')]?_0x153124['options']['include']?_[_0xaa61('0x1f')](_0x153124['options'][_0xaa61('0x20')],function(_0x30e282){return{'model':db[_0x30e282['model']],'as':_0x30e282['as'],'attributes':_0x30e282[_0xaa61('0x1e')],'include':_0x30e282['include']?_[_0xaa61('0x1f')](_0x30e282['include'],function(_0x56d983){return{'model':db[_0x56d983[_0xaa61('0x21')]],'as':_0x56d983['as'],'attributes':_0x56d983[_0xaa61('0x1e')],'include':_0x56d983[_0xaa61('0x20')]?_['map'](_0x56d983[_0xaa61('0x20')],function(_0x4a0ad4){return{'model':db[_0x4a0ad4[_0xaa61('0x21')]],'as':_0x4a0ad4['as'],'attributes':_0x4a0ad4['attributes']};}):[]};}):[]};}):[]:[]})[_0xaa61('0xc')](function(_0x22172d){logger['info'](_0xaa61('0x18'),_0x153124);logger[_0xaa61('0x10')](_0xaa61('0x18'),_0x153124,JSON['stringify'](_0x22172d));_0x11c661(_0x22172d);})['catch'](function(_0x2bdbca){logger[_0xaa61('0x14')](_0xaa61('0x18'),_0x2bdbca[_0xaa61('0x15')],_0x153124);_0x16f35c(_0xf674d3[_0xaa61('0x14')](0x1f4,_0x2bdbca['message']));});});};exports[_0xaa61('0x22')]=function(_0x235e87){var _0x185a11=this;return new Promise(function(_0x274317,_0x2b7b1b){return db[_0xaa61('0x19')][_0xaa61('0x23')]({'raw':_0x235e87[_0xaa61('0x1b')]?_0x235e87[_0xaa61('0x1b')][_0xaa61('0x1c')]===undefined?!![]:![]:!![],'where':_0x235e87[_0xaa61('0x1b')]?_0x235e87[_0xaa61('0x1b')][_0xaa61('0x1d')]||null:null,'attributes':_0x235e87[_0xaa61('0x1b')]?_0x235e87[_0xaa61('0x1b')][_0xaa61('0x1e')]||null:null,'include':_0x235e87['options']?_0x235e87['options']['include']?_[_0xaa61('0x1f')](_0x235e87[_0xaa61('0x1b')][_0xaa61('0x20')],function(_0x418534){return{'model':db[_0x418534['model']],'as':_0x418534['as'],'attributes':_0x418534[_0xaa61('0x1e')],'include':_0x418534['include']?_[_0xaa61('0x1f')](_0x418534[_0xaa61('0x20')],function(_0x56f4e7){return{'model':db[_0x56f4e7[_0xaa61('0x21')]],'as':_0x56f4e7['as'],'attributes':_0x56f4e7[_0xaa61('0x1e')],'include':_0x56f4e7[_0xaa61('0x20')]?_[_0xaa61('0x1f')](_0x56f4e7[_0xaa61('0x20')],function(_0x6418e5){return{'model':db[_0x6418e5[_0xaa61('0x21')]],'as':_0x6418e5['as'],'attributes':_0x6418e5[_0xaa61('0x1e')]};}):[]};}):[]};}):[]:[]})[_0xaa61('0xc')](function(_0x4ebaa4){logger['info'](_0xaa61('0x22'),_0x235e87);logger['debug']('ShowSmsQueue',_0x235e87,JSON[_0xaa61('0x12')](_0x4ebaa4));_0x274317(_0x4ebaa4);})['catch'](function(_0x296847){logger['error']('ShowSmsQueue',_0x296847[_0xaa61('0x15')],_0x235e87);_0x2b7b1b(_0x185a11['error'](0x1f4,_0x296847[_0xaa61('0x15')]));});});}; \ No newline at end of file +var _0xb769=['http','defaults','redis','localhost','socket.io-emitter','./smsQueue.socket','register','request','then','info','SmsQueue,\x20%s,\x20%s','debug','SmsQueue,\x20%s,\x20%s,\x20%s','code','error','message','request\x20sent','catch','GetSmsQueue','SmsQueue','findAll','options','where','limit','map','include','attributes','model','ShowSmsQueue','find','stringify','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client'];(function(_0x4fc421,_0x94e88){var _0x8c6d63=function(_0x5b8b42){while(--_0x5b8b42){_0x4fc421['push'](_0x4fc421['shift']());}};_0x8c6d63(++_0x94e88);}(_0xb769,0x115));var _0x9b76=function(_0x3741d8,_0x4f0e08){_0x3741d8=_0x3741d8-0x0;var _0x3e824e=_0xb769[_0x3741d8];return _0x3e824e;};'use strict';var _=require('lodash');var util=require(_0x9b76('0x0'));var moment=require(_0x9b76('0x1'));var BPromise=require('bluebird');var rs=require(_0x9b76('0x2'));var fs=require('fs');var Redis=require(_0x9b76('0x3'));var db=require(_0x9b76('0x4'))['db'];var utils=require(_0x9b76('0x5'));var logger=require(_0x9b76('0x6'))(_0x9b76('0x7'));var config=require('../../config/environment');var jayson=require(_0x9b76('0x8'));var client=jayson[_0x9b76('0x9')][_0x9b76('0xa')]({'port':0x232a});config['redis']=_[_0x9b76('0xb')](config[_0x9b76('0xc')],{'host':_0x9b76('0xd'),'port':0x18eb});var socket=require(_0x9b76('0xe'))(new Redis(config[_0x9b76('0xc')]));require(_0x9b76('0xf'))[_0x9b76('0x10')](socket);function respondWithRpcPromise(_0x57996c,_0x32e7d3,_0x3af47b){return new BPromise(function(_0x3b9573,_0x5b49a2){return client[_0x9b76('0x11')](_0x57996c,_0x3af47b)[_0x9b76('0x12')](function(_0x1df64a){logger[_0x9b76('0x13')](_0x9b76('0x14'),_0x32e7d3,'request\x20sent');logger[_0x9b76('0x15')](_0x9b76('0x16'),_0x32e7d3,'request\x20sent',JSON['stringify'](_0x1df64a));if(_0x1df64a['error']){if(_0x1df64a['error'][_0x9b76('0x17')]===0x1f4){logger[_0x9b76('0x18')](_0x9b76('0x14'),_0x32e7d3,_0x1df64a[_0x9b76('0x18')][_0x9b76('0x19')]);return _0x5b49a2(_0x1df64a[_0x9b76('0x18')][_0x9b76('0x19')]);}logger[_0x9b76('0x18')](_0x9b76('0x14'),_0x32e7d3,_0x1df64a[_0x9b76('0x18')][_0x9b76('0x19')]);return _0x3b9573(_0x1df64a[_0x9b76('0x18')][_0x9b76('0x19')]);}else{logger[_0x9b76('0x13')](_0x9b76('0x14'),_0x32e7d3,_0x9b76('0x1a'));_0x3b9573(_0x1df64a['result'][_0x9b76('0x19')]);}})[_0x9b76('0x1b')](function(_0x1b857b){logger['error'](_0x9b76('0x14'),_0x32e7d3,_0x1b857b);_0x5b49a2(_0x1b857b);});});}exports[_0x9b76('0x1c')]=function(_0x596058){var _0x3d6a32=this;return new Promise(function(_0x1bc3e0,_0x1d96d9){return db[_0x9b76('0x1d')][_0x9b76('0x1e')]({'raw':_0x596058[_0x9b76('0x1f')]?_0x596058['options']['raw']===undefined?!![]:![]:!![],'where':_0x596058[_0x9b76('0x1f')]?_0x596058[_0x9b76('0x1f')][_0x9b76('0x20')]||null:null,'attributes':_0x596058[_0x9b76('0x1f')]?_0x596058['options']['attributes']||null:null,'limit':_0x596058[_0x9b76('0x1f')]?_0x596058['options'][_0x9b76('0x21')]||null:null,'include':_0x596058[_0x9b76('0x1f')]?_0x596058[_0x9b76('0x1f')]['include']?_[_0x9b76('0x22')](_0x596058['options'][_0x9b76('0x23')],function(_0x321536){return{'model':db[_0x321536['model']],'as':_0x321536['as'],'attributes':_0x321536[_0x9b76('0x24')],'include':_0x321536[_0x9b76('0x23')]?_['map'](_0x321536[_0x9b76('0x23')],function(_0x423266){return{'model':db[_0x423266[_0x9b76('0x25')]],'as':_0x423266['as'],'attributes':_0x423266['attributes'],'include':_0x423266[_0x9b76('0x23')]?_['map'](_0x423266['include'],function(_0x1d4083){return{'model':db[_0x1d4083[_0x9b76('0x25')]],'as':_0x1d4083['as'],'attributes':_0x1d4083[_0x9b76('0x24')]};}):[]};}):[]};}):[]:[]})[_0x9b76('0x12')](function(_0x492ea3){logger[_0x9b76('0x13')]('GetSmsQueue',_0x596058);logger[_0x9b76('0x15')](_0x9b76('0x1c'),_0x596058,JSON['stringify'](_0x492ea3));_0x1bc3e0(_0x492ea3);})[_0x9b76('0x1b')](function(_0x15484b){logger[_0x9b76('0x18')](_0x9b76('0x1c'),_0x15484b[_0x9b76('0x19')],_0x596058);_0x1d96d9(_0x3d6a32[_0x9b76('0x18')](0x1f4,_0x15484b[_0x9b76('0x19')]));});});};exports[_0x9b76('0x26')]=function(_0x279251){var _0x2c67e7=this;return new Promise(function(_0x2d4912,_0x3acb01){return db[_0x9b76('0x1d')][_0x9b76('0x27')]({'raw':_0x279251[_0x9b76('0x1f')]?_0x279251[_0x9b76('0x1f')]['raw']===undefined?!![]:![]:!![],'where':_0x279251['options']?_0x279251['options'][_0x9b76('0x20')]||null:null,'attributes':_0x279251[_0x9b76('0x1f')]?_0x279251['options']['attributes']||null:null,'include':_0x279251[_0x9b76('0x1f')]?_0x279251['options'][_0x9b76('0x23')]?_[_0x9b76('0x22')](_0x279251['options'][_0x9b76('0x23')],function(_0x25d621){return{'model':db[_0x25d621[_0x9b76('0x25')]],'as':_0x25d621['as'],'attributes':_0x25d621[_0x9b76('0x24')],'include':_0x25d621[_0x9b76('0x23')]?_[_0x9b76('0x22')](_0x25d621['include'],function(_0x3e7395){return{'model':db[_0x3e7395[_0x9b76('0x25')]],'as':_0x3e7395['as'],'attributes':_0x3e7395['attributes'],'include':_0x3e7395[_0x9b76('0x23')]?_[_0x9b76('0x22')](_0x3e7395[_0x9b76('0x23')],function(_0x1df06c){return{'model':db[_0x1df06c[_0x9b76('0x25')]],'as':_0x1df06c['as'],'attributes':_0x1df06c[_0x9b76('0x24')]};}):[]};}):[]};}):[]:[]})[_0x9b76('0x12')](function(_0x822b07){logger[_0x9b76('0x13')](_0x9b76('0x26'),_0x279251);logger[_0x9b76('0x15')](_0x9b76('0x26'),_0x279251,JSON[_0x9b76('0x28')](_0x822b07));_0x2d4912(_0x822b07);})[_0x9b76('0x1b')](function(_0x35093b){logger[_0x9b76('0x18')]('ShowSmsQueue',_0x35093b['message'],_0x279251);_0x3acb01(_0x2c67e7[_0x9b76('0x18')](0x1f4,_0x35093b[_0x9b76('0x19')]));});});}; \ No newline at end of file diff --git a/server/api/smsQueue/smsQueue.socket.js b/server/api/smsQueue/smsQueue.socket.js index 73b7b70..43ac674 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 _0x2bdd=['remove','update','emit','removeListener','register','length','smsQueue:','save'];(function(_0x3936d8,_0x11fefb){var _0x3e700d=function(_0x12b7b7){while(--_0x12b7b7){_0x3936d8['push'](_0x3936d8['shift']());}};_0x3e700d(++_0x11fefb);}(_0x2bdd,0x19f));var _0xd2bd=function(_0x28669c,_0x1f62c4){_0x28669c=_0x28669c-0x0;var _0x4a3af6=_0x2bdd[_0x28669c];return _0x4a3af6;};'use strict';var SmsQueueEvents=require('./smsQueue.events');var events=[_0xd2bd('0x0'),_0xd2bd('0x1'),_0xd2bd('0x2')];function createListener(_0x3c5d3b,_0xa99ad9){return function(_0x2d6dac){_0xa99ad9[_0xd2bd('0x3')](_0x3c5d3b,_0x2d6dac);};}function removeListener(_0x26d942,_0x848066){return function(){SmsQueueEvents[_0xd2bd('0x4')](_0x26d942,_0x848066);};}exports[_0xd2bd('0x5')]=function(_0x4a8063){for(var _0x48d3ca=0x0,_0x2acb8e=events[_0xd2bd('0x6')];_0x48d3ca<_0x2acb8e;_0x48d3ca++){var _0xed6811=events[_0x48d3ca];var _0x2cf704=createListener(_0xd2bd('0x7')+_0xed6811,_0x4a8063);SmsQueueEvents['on'](_0xed6811,_0x2cf704);}}; \ No newline at end of file +var _0x2513=['update','emit','removeListener','smsQueue:','./smsQueue.events','save','remove'];(function(_0x59eacf,_0x56ec4a){var _0x5d74f2=function(_0x5476ed){while(--_0x5476ed){_0x59eacf['push'](_0x59eacf['shift']());}};_0x5d74f2(++_0x56ec4a);}(_0x2513,0x138));var _0x3251=function(_0x19eee9,_0xfab642){_0x19eee9=_0x19eee9-0x0;var _0x50b9e6=_0x2513[_0x19eee9];return _0x50b9e6;};'use strict';var SmsQueueEvents=require(_0x3251('0x0'));var events=[_0x3251('0x1'),_0x3251('0x2'),_0x3251('0x3')];function createListener(_0x2a455e,_0x31a8b9){return function(_0x4aa65e){_0x31a8b9[_0x3251('0x4')](_0x2a455e,_0x4aa65e);};}function removeListener(_0x12be71,_0x5b86bd){return function(){SmsQueueEvents[_0x3251('0x5')](_0x12be71,_0x5b86bd);};}exports['register']=function(_0xe0cf70){for(var _0x466794=0x0,_0x3822a2=events['length'];_0x466794<_0x3822a2;_0x466794++){var _0x3eaa85=events[_0x466794];var _0x40e043=createListener(_0x3251('0x6')+_0x3eaa85,_0xe0cf70);SmsQueueEvents['on'](_0x3eaa85,_0x40e043);}}; \ No newline at end of file diff --git a/server/api/smsQueueReport/index.js b/server/api/smsQueueReport/index.js index ed65194..80b8026 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 _0x50b4=['../../config/environment','./smsQueueReport.controller','isAuthenticated','index','get','/describe','describe','/:id','show','post','create','put','delete','destroy','exports','multer','connect-timeout','express','Router','../../components/interaction/service'];(function(_0x3c37e7,_0x14e48e){var _0x3b6710=function(_0x18f476){while(--_0x18f476){_0x3c37e7['push'](_0x3c37e7['shift']());}};_0x3b6710(++_0x14e48e);}(_0x50b4,0xd7));var _0x450b=function(_0x4760a9,_0x138c0e){_0x4760a9=_0x4760a9-0x0;var _0x525605=_0x50b4[_0x4760a9];return _0x525605;};'use strict';var multer=require(_0x450b('0x0'));var util=require('util');var path=require('path');var timeout=require(_0x450b('0x1'));var express=require(_0x450b('0x2'));var router=express[_0x450b('0x3')]();var auth=require('../../components/auth/service');var interaction=require(_0x450b('0x4'));var config=require(_0x450b('0x5'));var controller=require(_0x450b('0x6'));router['get']('/',auth[_0x450b('0x7')](),controller[_0x450b('0x8')]);router[_0x450b('0x9')](_0x450b('0xa'),auth[_0x450b('0x7')](),controller[_0x450b('0xb')]);router[_0x450b('0x9')](_0x450b('0xc'),auth[_0x450b('0x7')](),controller[_0x450b('0xd')]);router[_0x450b('0xe')]('/',auth[_0x450b('0x7')](),controller[_0x450b('0xf')]);router[_0x450b('0x10')]('/:id',auth[_0x450b('0x7')](),controller['update']);router[_0x450b('0x11')](_0x450b('0xc'),auth[_0x450b('0x7')](),controller[_0x450b('0x12')]);module[_0x450b('0x13')]=router; \ No newline at end of file +var _0xb756=['util','path','connect-timeout','express','../../components/auth/service','../../components/interaction/service','./smsQueueReport.controller','get','isAuthenticated','index','/describe','describe','show','put','/:id','update','destroy','exports','multer'];(function(_0x11ed93,_0x50b9dd){var _0x196847=function(_0x19ed0d){while(--_0x19ed0d){_0x11ed93['push'](_0x11ed93['shift']());}};_0x196847(++_0x50b9dd);}(_0xb756,0x84));var _0x6b75=function(_0x3eb955,_0x744e76){_0x3eb955=_0x3eb955-0x0;var _0x3122d2=_0xb756[_0x3eb955];return _0x3122d2;};'use strict';var multer=require(_0x6b75('0x0'));var util=require(_0x6b75('0x1'));var path=require(_0x6b75('0x2'));var timeout=require(_0x6b75('0x3'));var express=require(_0x6b75('0x4'));var router=express['Router']();var auth=require(_0x6b75('0x5'));var interaction=require(_0x6b75('0x6'));var config=require('../../config/environment');var controller=require(_0x6b75('0x7'));router[_0x6b75('0x8')]('/',auth[_0x6b75('0x9')](),controller[_0x6b75('0xa')]);router['get'](_0x6b75('0xb'),auth[_0x6b75('0x9')](),controller[_0x6b75('0xc')]);router[_0x6b75('0x8')]('/:id',auth[_0x6b75('0x9')](),controller[_0x6b75('0xd')]);router['post']('/',auth['isAuthenticated'](),controller['create']);router[_0x6b75('0xe')](_0x6b75('0xf'),auth[_0x6b75('0x9')](),controller[_0x6b75('0x10')]);router['delete']('/:id',auth[_0x6b75('0x9')](),controller[_0x6b75('0x11')]);module[_0x6b75('0x12')]=router; \ No newline at end of file diff --git a/server/api/smsQueueReport/smsQueueReport.attributes.js b/server/api/smsQueueReport/smsQueueReport.attributes.js index c8c7d74..34cb395 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 _0xe175=['moment','sequelize','exports','STRING','DATE'];(function(_0x3bab09,_0x217c29){var _0x164376=function(_0x277730){while(--_0x277730){_0x3bab09['push'](_0x3bab09['shift']());}};_0x164376(++_0x217c29);}(_0xe175,0x154));var _0x5e17=function(_0x56c62a,_0x3f76d4){_0x56c62a=_0x56c62a-0x0;var _0xa9d003=_0xe175[_0x56c62a];return _0xa9d003;};'use strict';var moment=require(_0x5e17('0x0'));var Sequelize=require(_0x5e17('0x1'));module[_0x5e17('0x2')]={'uniqueid':{'type':Sequelize['STRING'],'allowNull':![]},'from':{'type':Sequelize[_0x5e17('0x3')]},'joinAt':{'type':Sequelize[_0x5e17('0x4')]},'leaveAt':{'type':Sequelize[_0x5e17('0x4')]},'acceptAt':{'type':Sequelize[_0x5e17('0x4')]},'exitAt':{'type':Sequelize[_0x5e17('0x4')]},'reason':{'type':Sequelize[_0x5e17('0x3')]}}; \ No newline at end of file +var _0xf437=['DATE','STRING'];(function(_0x5b4869,_0x3231aa){var _0x5537da=function(_0x5bd924){while(--_0x5bd924){_0x5b4869['push'](_0x5b4869['shift']());}};_0x5537da(++_0x3231aa);}(_0xf437,0x7f));var _0x7f43=function(_0x1b41a0,_0x24e232){_0x1b41a0=_0x1b41a0-0x0;var _0x5e5e27=_0xf437[_0x1b41a0];return _0x5e5e27;};'use strict';var moment=require('moment');var Sequelize=require('sequelize');module['exports']={'uniqueid':{'type':Sequelize[_0x7f43('0x0')],'allowNull':![]},'from':{'type':Sequelize[_0x7f43('0x0')]},'joinAt':{'type':Sequelize[_0x7f43('0x1')]},'leaveAt':{'type':Sequelize[_0x7f43('0x1')]},'acceptAt':{'type':Sequelize['DATE']},'exitAt':{'type':Sequelize[_0x7f43('0x1')]},'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 32958aa..6d589ee 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 _0xa82a=['order','sort','where','pick','filter','VIRTUAL','options','rows','fields','includeAll','catch','create','update','body','find','params','describe','html-pdf','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','to-csv','ejs','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../config/license/hardware','../../config/logger','api','../../config/utils','sendStatus','status','json','count','offset','limit','set','Content-Range','apply','reject','save','then','destroy','end','error','stack','name','map','SmsQueueReport','rawAttributes','fieldName','type','model','query','keys','filters','intersection','attributes','length','hasOwnProperty'];(function(_0x1facfa,_0x1acf7d){var _0x9ec701=function(_0x115e37){while(--_0x115e37){_0x1facfa['push'](_0x1facfa['shift']());}};_0x9ec701(++_0x1acf7d);}(_0xa82a,0x16f));var _0xaa82=function(_0x35d627,_0x3cc95b){_0x35d627=_0x35d627-0x0;var _0x5225c0=_0xa82a[_0x35d627];return _0x5225c0;};'use strict';var pdf=require(_0xaa82('0x0'));var emlformat=require(_0xaa82('0x1'));var rimraf=require(_0xaa82('0x2'));var zipdir=require('zip-dir');var jsonpatch=require(_0xaa82('0x3'));var rp=require(_0xaa82('0x4'));var moment=require(_0xaa82('0x5'));var BPromise=require(_0xaa82('0x6'));var Mustache=require(_0xaa82('0x7'));var util=require(_0xaa82('0x8'));var path=require(_0xaa82('0x9'));var sox=require('sox');var csv=require(_0xaa82('0xa'));var ejs=require(_0xaa82('0xb'));var fs=require('fs');var _=require('lodash');var squel=require(_0xaa82('0xc'));var crypto=require('crypto');var jsforce=require(_0xaa82('0xd'));var deskjs=require(_0xaa82('0xe'));var toCsv=require(_0xaa82('0xa'));var querystring=require(_0xaa82('0xf'));var Papa=require(_0xaa82('0x10'));var Redis=require(_0xaa82('0x11'));var authService=require(_0xaa82('0x12'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xaa82('0x13'));var logger=require(_0xaa82('0x14'))(_0xaa82('0x15'));var utils=require(_0xaa82('0x16'));var config=require('../../config/environment');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x16cf2f,_0x20c6e7){_0x20c6e7=_0x20c6e7||0xcc;return function(_0x3f7ca7){if(_0x3f7ca7){return _0x16cf2f[_0xaa82('0x17')](_0x20c6e7);}return _0x16cf2f[_0xaa82('0x18')](_0x20c6e7)['end']();};}function respondWithResult(_0x4c8d15,_0xb0829f){_0xb0829f=_0xb0829f||0xc8;return function(_0x5ecb60){if(_0x5ecb60){return _0x4c8d15[_0xaa82('0x18')](_0xb0829f)[_0xaa82('0x19')](_0x5ecb60);}};}function respondWithFilteredResult(_0x57dfa5,_0x310a16){return function(_0x9ce910){if(_0x9ce910){var _0x299826=_0x9ce910[_0xaa82('0x1a')],_0x2452ce=_0x310a16[_0xaa82('0x1b')],_0x254004=_0x310a16[_0xaa82('0x1b')]+_0x310a16[_0xaa82('0x1c')],_0x13e6ce;if(_0x254004>=_0x299826){_0x254004=_0x299826;_0x13e6ce=0xc8;}else{_0x13e6ce=0xce;}_0x57dfa5[_0xaa82('0x18')](_0x13e6ce);return _0x57dfa5[_0xaa82('0x1d')](_0xaa82('0x1e'),_0x2452ce+'-'+_0x254004+'/'+_0x299826)['json'](_0x9ce910);}return null;};}function patchUpdates(_0x3d6297){return function(_0x232abf){try{jsonpatch[_0xaa82('0x1f')](_0x232abf,_0x3d6297,!![]);}catch(_0x6b8c78){return BPromise[_0xaa82('0x20')](_0x6b8c78);}return _0x232abf[_0xaa82('0x21')]();};}function saveUpdates(_0x34497a,_0x26aa77){return function(_0x5434b5){if(_0x5434b5){return _0x5434b5['update'](_0x34497a)[_0xaa82('0x22')](function(_0x37e6f7){return _0x37e6f7;});}return null;};}function removeEntity(_0x54ff6a,_0x3e7208){return function(_0x21f1ed){if(_0x21f1ed){return _0x21f1ed[_0xaa82('0x23')]()[_0xaa82('0x22')](function(){_0x54ff6a['status'](0xcc)[_0xaa82('0x24')]();});}};}function handleEntityNotFound(_0x3ae51c,_0x2c36e9){return function(_0x2de186){if(!_0x2de186){_0x3ae51c[_0xaa82('0x17')](0x194);}return _0x2de186;};}function handleError(_0x330b65,_0x24af94){_0x24af94=_0x24af94||0x1f4;return function(_0x50e5b7){logger[_0xaa82('0x25')](_0x50e5b7[_0xaa82('0x26')]);if(_0x50e5b7[_0xaa82('0x27')]){delete _0x50e5b7[_0xaa82('0x27')];}_0x330b65[_0xaa82('0x18')](_0x24af94)['send'](_0x50e5b7);};}exports['index']=function(_0x3a6bb2,_0x179e46){var _0x500a53={},_0x481bee={},_0x21a184={'count':0x0,'rows':[]};var _0x539320=_[_0xaa82('0x28')](db[_0xaa82('0x29')][_0xaa82('0x2a')],function(_0x2f28fa){return{'name':_0x2f28fa[_0xaa82('0x2b')],'type':_0x2f28fa[_0xaa82('0x2c')]['key']};});_0x481bee[_0xaa82('0x2d')]=_[_0xaa82('0x28')](_0x539320,_0xaa82('0x27'));_0x481bee[_0xaa82('0x2e')]=_[_0xaa82('0x2f')](_0x3a6bb2[_0xaa82('0x2e')]);_0x481bee[_0xaa82('0x30')]=_[_0xaa82('0x31')](_0x481bee[_0xaa82('0x2d')],_0x481bee[_0xaa82('0x2e')]);_0x500a53[_0xaa82('0x32')]=_[_0xaa82('0x31')](_0x481bee[_0xaa82('0x2d')],qs['fields'](_0x3a6bb2[_0xaa82('0x2e')]['fields']));_0x500a53[_0xaa82('0x32')]=_0x500a53[_0xaa82('0x32')][_0xaa82('0x33')]?_0x500a53[_0xaa82('0x32')]:_0x481bee[_0xaa82('0x2d')];if(!_0x3a6bb2[_0xaa82('0x2e')][_0xaa82('0x34')]('nolimit')){_0x500a53[_0xaa82('0x1c')]=qs[_0xaa82('0x1c')](_0x3a6bb2[_0xaa82('0x2e')][_0xaa82('0x1c')]);_0x500a53[_0xaa82('0x1b')]=qs[_0xaa82('0x1b')](_0x3a6bb2[_0xaa82('0x2e')][_0xaa82('0x1b')]);}_0x500a53[_0xaa82('0x35')]=qs[_0xaa82('0x36')](_0x3a6bb2['query'][_0xaa82('0x36')]);_0x500a53[_0xaa82('0x37')]=qs[_0xaa82('0x30')](_[_0xaa82('0x38')](_0x3a6bb2[_0xaa82('0x2e')],_0x481bee['filters']));if(_0x3a6bb2[_0xaa82('0x2e')][_0xaa82('0x39')]){_0x500a53['where']=_['merge'](_0x500a53[_0xaa82('0x37')],{'$or':_[_0xaa82('0x28')](_0x539320,function(_0x4f55ff){if(_0x4f55ff[_0xaa82('0x2c')]!==_0xaa82('0x3a')){var _0x103fba={};_0x103fba[_0x4f55ff[_0xaa82('0x27')]]={'$like':'%'+_0x3a6bb2['query'][_0xaa82('0x39')]+'%'};return _0x103fba;}})});}_0x500a53=_['merge']({},_0x500a53,_0x3a6bb2[_0xaa82('0x3b')]);var _0xd5f78c={'where':_0x500a53[_0xaa82('0x37')]};return db[_0xaa82('0x29')]['count'](_0xd5f78c)[_0xaa82('0x22')](function(_0x135ff8){_0x21a184[_0xaa82('0x1a')]=_0x135ff8;if(_0x3a6bb2[_0xaa82('0x2e')]['includeAll']){_0x500a53['include']=[{'all':!![]}];}return db[_0xaa82('0x29')]['findAll'](_0x500a53);})[_0xaa82('0x22')](function(_0x239436){_0x21a184[_0xaa82('0x3c')]=_0x239436;return _0x21a184;})[_0xaa82('0x22')](respondWithFilteredResult(_0x179e46,_0x500a53))['catch'](handleError(_0x179e46,null));};exports['show']=function(_0x390cdc,_0x45f126){var _0x252cdd={'raw':!![],'where':{'id':_0x390cdc['params']['id']}},_0x3f1d4e={};_0x3f1d4e[_0xaa82('0x2d')]=_[_0xaa82('0x2f')](db['SmsQueueReport'][_0xaa82('0x2a')]);_0x3f1d4e['query']=_[_0xaa82('0x2f')](_0x390cdc[_0xaa82('0x2e')]);_0x3f1d4e[_0xaa82('0x30')]=_['intersection'](_0x3f1d4e[_0xaa82('0x2d')],_0x3f1d4e[_0xaa82('0x2e')]);_0x252cdd[_0xaa82('0x32')]=_[_0xaa82('0x31')](_0x3f1d4e[_0xaa82('0x2d')],qs[_0xaa82('0x3d')](_0x390cdc[_0xaa82('0x2e')]['fields']));_0x252cdd[_0xaa82('0x32')]=_0x252cdd['attributes'][_0xaa82('0x33')]?_0x252cdd[_0xaa82('0x32')]:_0x3f1d4e[_0xaa82('0x2d')];if(_0x390cdc[_0xaa82('0x2e')][_0xaa82('0x3e')]){_0x252cdd['include']=[{'all':!![]}];}_0x252cdd=_['merge']({},_0x252cdd,_0x390cdc[_0xaa82('0x3b')]);return db[_0xaa82('0x29')]['find'](_0x252cdd)[_0xaa82('0x22')](handleEntityNotFound(_0x45f126,null))[_0xaa82('0x22')](respondWithResult(_0x45f126,null))[_0xaa82('0x3f')](handleError(_0x45f126,null));};exports[_0xaa82('0x40')]=function(_0x4eec19,_0x4f1b6b){return db[_0xaa82('0x29')]['create'](_0x4eec19['body'],{})[_0xaa82('0x22')](respondWithResult(_0x4f1b6b,0xc9))[_0xaa82('0x3f')](handleError(_0x4f1b6b,null));};exports[_0xaa82('0x41')]=function(_0x11d0da,_0x5e3f64){if(_0x11d0da[_0xaa82('0x42')]['id']){delete _0x11d0da[_0xaa82('0x42')]['id'];}return db[_0xaa82('0x29')][_0xaa82('0x43')]({'where':{'id':_0x11d0da[_0xaa82('0x44')]['id']}})[_0xaa82('0x22')](handleEntityNotFound(_0x5e3f64,null))[_0xaa82('0x22')](saveUpdates(_0x11d0da[_0xaa82('0x42')],null))[_0xaa82('0x22')](respondWithResult(_0x5e3f64,null))[_0xaa82('0x3f')](handleError(_0x5e3f64,null));};exports[_0xaa82('0x23')]=function(_0x38a148,_0x38f963){return db[_0xaa82('0x29')][_0xaa82('0x43')]({'where':{'id':_0x38a148[_0xaa82('0x44')]['id']}})['then'](handleEntityNotFound(_0x38f963,null))[_0xaa82('0x22')](removeEntity(_0x38f963,null))[_0xaa82('0x3f')](handleError(_0x38f963,null));};exports[_0xaa82('0x45')]=function(_0x111df2,_0xeeb426){return db[_0xaa82('0x29')][_0xaa82('0x45')]()[_0xaa82('0x22')](respondWithResult(_0xeeb426,null))[_0xaa82('0x3f')](handleError(_0xeeb426,null));}; \ No newline at end of file +var _0xb93d=['key','model','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','order','sort','where','pick','filter','merge','includeAll','include','SmsQueueReport','rows','catch','show','params','options','find','create','body','update','describe','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','status','end','offset','limit','set','json','apply','reject','then','destroy','sendStatus','error','name','index','map','rawAttributes','fieldName','type'];(function(_0x38596a,_0x5cfeca){var _0x2ed8d1=function(_0x2ed0e5){while(--_0x2ed0e5){_0x38596a['push'](_0x38596a['shift']());}};_0x2ed8d1(++_0x5cfeca);}(_0xb93d,0x18f));var _0xdb93=function(_0x22b68a,_0x2bffc3){_0x22b68a=_0x22b68a-0x0;var _0x1ac67a=_0xb93d[_0x22b68a];return _0x1ac67a;};'use strict';var pdf=require(_0xdb93('0x0'));var emlformat=require(_0xdb93('0x1'));var rimraf=require(_0xdb93('0x2'));var zipdir=require(_0xdb93('0x3'));var jsonpatch=require(_0xdb93('0x4'));var rp=require(_0xdb93('0x5'));var moment=require(_0xdb93('0x6'));var BPromise=require(_0xdb93('0x7'));var Mustache=require(_0xdb93('0x8'));var util=require(_0xdb93('0x9'));var path=require(_0xdb93('0xa'));var sox=require(_0xdb93('0xb'));var csv=require(_0xdb93('0xc'));var ejs=require(_0xdb93('0xd'));var fs=require('fs');var _=require(_0xdb93('0xe'));var squel=require(_0xdb93('0xf'));var crypto=require(_0xdb93('0x10'));var jsforce=require(_0xdb93('0x11'));var deskjs=require('desk.js');var toCsv=require(_0xdb93('0xc'));var querystring=require('querystring');var Papa=require(_0xdb93('0x12'));var Redis=require(_0xdb93('0x13'));var authService=require(_0xdb93('0x14'));var qs=require('../../components/parsers/qs');var as=require(_0xdb93('0x15'));var hardwareService=require(_0xdb93('0x16'));var logger=require(_0xdb93('0x17'))(_0xdb93('0x18'));var utils=require(_0xdb93('0x19'));var config=require(_0xdb93('0x1a'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x268c33,_0x33d320){_0x33d320=_0x33d320||0xcc;return function(_0x43c66f){if(_0x43c66f){return _0x268c33['sendStatus'](_0x33d320);}return _0x268c33[_0xdb93('0x1b')](_0x33d320)[_0xdb93('0x1c')]();};}function respondWithResult(_0x55a719,_0x5072ca){_0x5072ca=_0x5072ca||0xc8;return function(_0x3a0bc9){if(_0x3a0bc9){return _0x55a719['status'](_0x5072ca)['json'](_0x3a0bc9);}};}function respondWithFilteredResult(_0x3f92c1,_0x263fa9){return function(_0x30422c){if(_0x30422c){var _0x20d25a=_0x30422c['count'],_0x2843da=_0x263fa9[_0xdb93('0x1d')],_0x9f5161=_0x263fa9[_0xdb93('0x1d')]+_0x263fa9[_0xdb93('0x1e')],_0x153f46;if(_0x9f5161>=_0x20d25a){_0x9f5161=_0x20d25a;_0x153f46=0xc8;}else{_0x153f46=0xce;}_0x3f92c1[_0xdb93('0x1b')](_0x153f46);return _0x3f92c1[_0xdb93('0x1f')]('Content-Range',_0x2843da+'-'+_0x9f5161+'/'+_0x20d25a)[_0xdb93('0x20')](_0x30422c);}return null;};}function patchUpdates(_0x555358){return function(_0x5b8f27){try{jsonpatch[_0xdb93('0x21')](_0x5b8f27,_0x555358,!![]);}catch(_0x299565){return BPromise[_0xdb93('0x22')](_0x299565);}return _0x5b8f27['save']();};}function saveUpdates(_0x219e02,_0x1832d8){return function(_0x129245){if(_0x129245){return _0x129245['update'](_0x219e02)[_0xdb93('0x23')](function(_0x4984b7){return _0x4984b7;});}return null;};}function removeEntity(_0x2ad7ec,_0x21e804){return function(_0x3335e1){if(_0x3335e1){return _0x3335e1[_0xdb93('0x24')]()[_0xdb93('0x23')](function(){_0x2ad7ec['status'](0xcc)[_0xdb93('0x1c')]();});}};}function handleEntityNotFound(_0x499f3f,_0x5c78c9){return function(_0x1241b0){if(!_0x1241b0){_0x499f3f[_0xdb93('0x25')](0x194);}return _0x1241b0;};}function handleError(_0xc1ef68,_0x169b29){_0x169b29=_0x169b29||0x1f4;return function(_0x39b93d){logger[_0xdb93('0x26')](_0x39b93d['stack']);if(_0x39b93d['name']){delete _0x39b93d[_0xdb93('0x27')];}_0xc1ef68[_0xdb93('0x1b')](_0x169b29)['send'](_0x39b93d);};}exports[_0xdb93('0x28')]=function(_0x3af980,_0x5cff24){var _0x39f57f={},_0x4bbf53={},_0x15d1cd={'count':0x0,'rows':[]};var _0x1b2b4e=_[_0xdb93('0x29')](db['SmsQueueReport'][_0xdb93('0x2a')],function(_0x3f4515){return{'name':_0x3f4515[_0xdb93('0x2b')],'type':_0x3f4515[_0xdb93('0x2c')][_0xdb93('0x2d')]};});_0x4bbf53[_0xdb93('0x2e')]=_[_0xdb93('0x29')](_0x1b2b4e,'name');_0x4bbf53['query']=_[_0xdb93('0x2f')](_0x3af980[_0xdb93('0x30')]);_0x4bbf53[_0xdb93('0x31')]=_[_0xdb93('0x32')](_0x4bbf53[_0xdb93('0x2e')],_0x4bbf53['query']);_0x39f57f[_0xdb93('0x33')]=_[_0xdb93('0x32')](_0x4bbf53[_0xdb93('0x2e')],qs[_0xdb93('0x34')](_0x3af980[_0xdb93('0x30')][_0xdb93('0x34')]));_0x39f57f[_0xdb93('0x33')]=_0x39f57f['attributes'][_0xdb93('0x35')]?_0x39f57f[_0xdb93('0x33')]:_0x4bbf53[_0xdb93('0x2e')];if(!_0x3af980[_0xdb93('0x30')][_0xdb93('0x36')]('nolimit')){_0x39f57f[_0xdb93('0x1e')]=qs[_0xdb93('0x1e')](_0x3af980['query'][_0xdb93('0x1e')]);_0x39f57f['offset']=qs[_0xdb93('0x1d')](_0x3af980['query'][_0xdb93('0x1d')]);}_0x39f57f[_0xdb93('0x37')]=qs['sort'](_0x3af980[_0xdb93('0x30')][_0xdb93('0x38')]);_0x39f57f[_0xdb93('0x39')]=qs[_0xdb93('0x31')](_[_0xdb93('0x3a')](_0x3af980[_0xdb93('0x30')],_0x4bbf53['filters']));if(_0x3af980['query'][_0xdb93('0x3b')]){_0x39f57f[_0xdb93('0x39')]=_[_0xdb93('0x3c')](_0x39f57f[_0xdb93('0x39')],{'$or':_[_0xdb93('0x29')](_0x1b2b4e,function(_0x2867a8){if(_0x2867a8[_0xdb93('0x2c')]!=='VIRTUAL'){var _0x133650={};_0x133650[_0x2867a8[_0xdb93('0x27')]]={'$like':'%'+_0x3af980['query']['filter']+'%'};return _0x133650;}})});}_0x39f57f=_[_0xdb93('0x3c')]({},_0x39f57f,_0x3af980['options']);var _0x5c2cd1={'where':_0x39f57f['where']};return db['SmsQueueReport']['count'](_0x5c2cd1)[_0xdb93('0x23')](function(_0x3ba0c1){_0x15d1cd['count']=_0x3ba0c1;if(_0x3af980[_0xdb93('0x30')][_0xdb93('0x3d')]){_0x39f57f[_0xdb93('0x3e')]=[{'all':!![]}];}return db[_0xdb93('0x3f')]['findAll'](_0x39f57f);})[_0xdb93('0x23')](function(_0x474158){_0x15d1cd[_0xdb93('0x40')]=_0x474158;return _0x15d1cd;})[_0xdb93('0x23')](respondWithFilteredResult(_0x5cff24,_0x39f57f))[_0xdb93('0x41')](handleError(_0x5cff24,null));};exports[_0xdb93('0x42')]=function(_0x4d81a3,_0x3493db){var _0x3ea6f1={'raw':!![],'where':{'id':_0x4d81a3[_0xdb93('0x43')]['id']}},_0x270775={};_0x270775[_0xdb93('0x2e')]=_[_0xdb93('0x2f')](db['SmsQueueReport'][_0xdb93('0x2a')]);_0x270775[_0xdb93('0x30')]=_[_0xdb93('0x2f')](_0x4d81a3[_0xdb93('0x30')]);_0x270775[_0xdb93('0x31')]=_['intersection'](_0x270775[_0xdb93('0x2e')],_0x270775[_0xdb93('0x30')]);_0x3ea6f1[_0xdb93('0x33')]=_[_0xdb93('0x32')](_0x270775[_0xdb93('0x2e')],qs[_0xdb93('0x34')](_0x4d81a3[_0xdb93('0x30')][_0xdb93('0x34')]));_0x3ea6f1['attributes']=_0x3ea6f1[_0xdb93('0x33')][_0xdb93('0x35')]?_0x3ea6f1[_0xdb93('0x33')]:_0x270775[_0xdb93('0x2e')];if(_0x4d81a3[_0xdb93('0x30')]['includeAll']){_0x3ea6f1[_0xdb93('0x3e')]=[{'all':!![]}];}_0x3ea6f1=_[_0xdb93('0x3c')]({},_0x3ea6f1,_0x4d81a3[_0xdb93('0x44')]);return db[_0xdb93('0x3f')][_0xdb93('0x45')](_0x3ea6f1)[_0xdb93('0x23')](handleEntityNotFound(_0x3493db,null))[_0xdb93('0x23')](respondWithResult(_0x3493db,null))[_0xdb93('0x41')](handleError(_0x3493db,null));};exports[_0xdb93('0x46')]=function(_0x3c8a92,_0x316337){return db[_0xdb93('0x3f')][_0xdb93('0x46')](_0x3c8a92[_0xdb93('0x47')],{})[_0xdb93('0x23')](respondWithResult(_0x316337,0xc9))[_0xdb93('0x41')](handleError(_0x316337,null));};exports[_0xdb93('0x48')]=function(_0x38ec98,_0x458b00){if(_0x38ec98[_0xdb93('0x47')]['id']){delete _0x38ec98[_0xdb93('0x47')]['id'];}return db['SmsQueueReport'][_0xdb93('0x45')]({'where':{'id':_0x38ec98['params']['id']}})['then'](handleEntityNotFound(_0x458b00,null))[_0xdb93('0x23')](saveUpdates(_0x38ec98[_0xdb93('0x47')],null))[_0xdb93('0x23')](respondWithResult(_0x458b00,null))[_0xdb93('0x41')](handleError(_0x458b00,null));};exports['destroy']=function(_0x4497be,_0x54e351){return db['SmsQueueReport'][_0xdb93('0x45')]({'where':{'id':_0x4497be['params']['id']}})['then'](handleEntityNotFound(_0x54e351,null))[_0xdb93('0x23')](removeEntity(_0x54e351,null))[_0xdb93('0x41')](handleError(_0x54e351,null));};exports[_0xdb93('0x49')]=function(_0x231273,_0x355945){return db[_0xdb93('0x3f')][_0xdb93('0x49')]()[_0xdb93('0x23')](respondWithResult(_0x355945,null))[_0xdb93('0x41')](handleError(_0x355945,null));}; \ No newline at end of file diff --git a/server/api/smsQueueReport/smsQueueReport.model.js b/server/api/smsQueueReport/smsQueueReport.model.js index c202ea3..0c31367 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 _0x124a=['report_sms_queue','uniqueid','lodash','util','../../config/logger','api','bluebird','request-promise','path','rimraf','./smsQueueReport.attributes','exports','define','SmsQueueReport'];(function(_0x3735d7,_0x3e79e7){var _0x2961c4=function(_0x26d859){while(--_0x26d859){_0x3735d7['push'](_0x3735d7['shift']());}};_0x2961c4(++_0x3e79e7);}(_0x124a,0x1a6));var _0xa124=function(_0x59a5d0,_0x4b3308){_0x59a5d0=_0x59a5d0-0x0;var _0x6840ac=_0x124a[_0x59a5d0];return _0x6840ac;};'use strict';var _=require(_0xa124('0x0'));var util=require(_0xa124('0x1'));var logger=require(_0xa124('0x2'))(_0xa124('0x3'));var moment=require('moment');var BPromise=require(_0xa124('0x4'));var rp=require(_0xa124('0x5'));var fs=require('fs');var path=require(_0xa124('0x6'));var rimraf=require(_0xa124('0x7'));var config=require('../../config/environment');var attributes=require(_0xa124('0x8'));module[_0xa124('0x9')]=function(_0x29cefb,_0x584ad8){return _0x29cefb[_0xa124('0xa')](_0xa124('0xb'),attributes,{'tableName':_0xa124('0xc'),'paranoid':![],'indexes':[{'name':_0xa124('0xd'),'fields':[_0xa124('0xd')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x4198=['lodash','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./smsQueueReport.attributes','exports','define','SmsQueueReport','report_sms_queue','uniqueid'];(function(_0x2de421,_0xbd10af){var _0x5eee89=function(_0x213569){while(--_0x213569){_0x2de421['push'](_0x2de421['shift']());}};_0x5eee89(++_0xbd10af);}(_0x4198,0x69));var _0x8419=function(_0x23386c,_0xdfb66a){_0x23386c=_0x23386c-0x0;var _0x211c40=_0x4198[_0x23386c];return _0x211c40;};'use strict';var _=require(_0x8419('0x0'));var util=require('util');var logger=require(_0x8419('0x1'))(_0x8419('0x2'));var moment=require(_0x8419('0x3'));var BPromise=require(_0x8419('0x4'));var rp=require(_0x8419('0x5'));var fs=require('fs');var path=require(_0x8419('0x6'));var rimraf=require(_0x8419('0x7'));var config=require(_0x8419('0x8'));var attributes=require(_0x8419('0x9'));module[_0x8419('0xa')]=function(_0x502e00,_0x1f5bfe){return _0x502e00[_0x8419('0xb')](_0x8419('0xc'),attributes,{'tableName':_0x8419('0xd'),'paranoid':![],'indexes':[{'name':_0x8419('0xe'),'fields':[_0x8419('0xe')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/smsQueueReport/smsQueueReport.rpc.js b/server/api/smsQueueReport/smsQueueReport.rpc.js index c650efa..d0b8ec4 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 _0x0e71=['create','body','options','raw','stringify','UpdateSmsQueueReport','SmsQueueReport','update','where','limit','lodash','moment','bluebird','randomstring','../../mysqldb','../../config/logger','../../config/environment','jayson/promise','client','http','request','then','info','SmsQueueReport,\x20%s,\x20%s','request\x20sent','debug','SmsQueueReport,\x20%s,\x20%s,\x20%s','error','code','message','catch','CreateSmsQueueReport'];(function(_0x43852d,_0x2ed8f){var _0x240937=function(_0x29ac84){while(--_0x29ac84){_0x43852d['push'](_0x43852d['shift']());}};_0x240937(++_0x2ed8f);}(_0x0e71,0xaa));var _0x10e7=function(_0x218abe,_0x8293e3){_0x218abe=_0x218abe-0x0;var _0x162b5b=_0x0e71[_0x218abe];return _0x162b5b;};'use strict';var _=require(_0x10e7('0x0'));var util=require('util');var moment=require(_0x10e7('0x1'));var BPromise=require(_0x10e7('0x2'));var rs=require(_0x10e7('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x10e7('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x10e7('0x5'))('rpc');var config=require(_0x10e7('0x6'));var jayson=require(_0x10e7('0x7'));var client=jayson[_0x10e7('0x8')][_0x10e7('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x59c22c,_0x230b05,_0x11bd46){return new BPromise(function(_0x3b785d,_0x25ee58){return client[_0x10e7('0xa')](_0x59c22c,_0x11bd46)[_0x10e7('0xb')](function(_0x2db763){logger[_0x10e7('0xc')](_0x10e7('0xd'),_0x230b05,_0x10e7('0xe'));logger[_0x10e7('0xf')](_0x10e7('0x10'),_0x230b05,_0x10e7('0xe'),JSON['stringify'](_0x2db763));if(_0x2db763['error']){if(_0x2db763[_0x10e7('0x11')][_0x10e7('0x12')]===0x1f4){logger[_0x10e7('0x11')](_0x10e7('0xd'),_0x230b05,_0x2db763['error'][_0x10e7('0x13')]);return _0x25ee58(_0x2db763[_0x10e7('0x11')][_0x10e7('0x13')]);}logger['error'](_0x10e7('0xd'),_0x230b05,_0x2db763['error']['message']);return _0x3b785d(_0x2db763['error']['message']);}else{logger[_0x10e7('0xc')](_0x10e7('0xd'),_0x230b05,'request\x20sent');_0x3b785d(_0x2db763['result'][_0x10e7('0x13')]);}})[_0x10e7('0x14')](function(_0x21eba7){logger[_0x10e7('0x11')]('SmsQueueReport,\x20%s,\x20%s',_0x230b05,_0x21eba7);_0x25ee58(_0x21eba7);});});}exports[_0x10e7('0x15')]=function(_0x3413c8){var _0x5ecbb2=this;return new Promise(function(_0x11b02b,_0x3c24a2){return db['SmsQueueReport'][_0x10e7('0x16')](_0x3413c8[_0x10e7('0x17')],{'raw':_0x3413c8[_0x10e7('0x18')]?_0x3413c8[_0x10e7('0x18')][_0x10e7('0x19')]===undefined?!![]:![]:!![]})['then'](function(_0x552eaf){logger[_0x10e7('0xc')](_0x10e7('0x15'),_0x3413c8);logger[_0x10e7('0xf')](_0x10e7('0x15'),_0x3413c8,JSON[_0x10e7('0x1a')](_0x552eaf));_0x11b02b(_0x552eaf);})[_0x10e7('0x14')](function(_0xa9b060){logger[_0x10e7('0x11')](_0x10e7('0x15'),_0xa9b060['message'],_0x3413c8);_0x3c24a2(_0x5ecbb2[_0x10e7('0x11')](0x1f4,_0xa9b060['message']));});});};exports[_0x10e7('0x1b')]=function(_0x2034e1){var _0x29a2a1=this;return new Promise(function(_0x140824,_0x53dd7f){return db[_0x10e7('0x1c')][_0x10e7('0x1d')](_0x2034e1['body'],{'raw':_0x2034e1['options']?_0x2034e1[_0x10e7('0x18')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x2034e1[_0x10e7('0x18')]?_0x2034e1['options'][_0x10e7('0x1e')]||null:null,'attributes':_0x2034e1[_0x10e7('0x18')]?_0x2034e1[_0x10e7('0x18')]['attributes']||null:null,'limit':_0x2034e1[_0x10e7('0x18')]?_0x2034e1[_0x10e7('0x18')][_0x10e7('0x1f')]||null:null})[_0x10e7('0xb')](function(_0x20a8ba){logger[_0x10e7('0xc')](_0x10e7('0x1b'),_0x2034e1);logger[_0x10e7('0xf')](_0x10e7('0x1b'),_0x2034e1,JSON['stringify'](_0x20a8ba));_0x140824(_0x20a8ba);})[_0x10e7('0x14')](function(_0x13394f){logger[_0x10e7('0x11')](_0x10e7('0x1b'),_0x13394f[_0x10e7('0x13')],_0x2034e1);_0x53dd7f(_0x29a2a1[_0x10e7('0x11')](0x1f4,_0x13394f[_0x10e7('0x13')]));});});}; \ No newline at end of file +var _0xd74c=['debug','SmsQueueReport,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','CreateSmsQueueReport','SmsQueueReport','body','options','then','update','raw','where','attributes','limit','UpdateSmsQueueReport','lodash','util','moment','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','client','info','SmsQueueReport,\x20%s,\x20%s','request\x20sent'];(function(_0x5311e8,_0x57c5bb){var _0x582ad8=function(_0x1909af){while(--_0x1909af){_0x5311e8['push'](_0x5311e8['shift']());}};_0x582ad8(++_0x57c5bb);}(_0xd74c,0xa8));var _0xcd74=function(_0x5b9533,_0x1df0e3){_0x5b9533=_0x5b9533-0x0;var _0x471839=_0xd74c[_0x5b9533];return _0x471839;};'use strict';var _=require(_0xcd74('0x0'));var util=require(_0xcd74('0x1'));var moment=require(_0xcd74('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xcd74('0x3'));var db=require(_0xcd74('0x4'))['db'];var utils=require(_0xcd74('0x5'));var logger=require(_0xcd74('0x6'))(_0xcd74('0x7'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0xcd74('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x17c79e,_0x1c98ff,_0x2926ae){return new BPromise(function(_0x50723b,_0x496ae1){return client['request'](_0x17c79e,_0x2926ae)['then'](function(_0x3ca76d){logger[_0xcd74('0x9')](_0xcd74('0xa'),_0x1c98ff,_0xcd74('0xb'));logger[_0xcd74('0xc')](_0xcd74('0xd'),_0x1c98ff,_0xcd74('0xb'),JSON[_0xcd74('0xe')](_0x3ca76d));if(_0x3ca76d[_0xcd74('0xf')]){if(_0x3ca76d[_0xcd74('0xf')]['code']===0x1f4){logger['error'](_0xcd74('0xa'),_0x1c98ff,_0x3ca76d[_0xcd74('0xf')][_0xcd74('0x10')]);return _0x496ae1(_0x3ca76d[_0xcd74('0xf')][_0xcd74('0x10')]);}logger[_0xcd74('0xf')]('SmsQueueReport,\x20%s,\x20%s',_0x1c98ff,_0x3ca76d[_0xcd74('0xf')]['message']);return _0x50723b(_0x3ca76d[_0xcd74('0xf')]['message']);}else{logger[_0xcd74('0x9')](_0xcd74('0xa'),_0x1c98ff,'request\x20sent');_0x50723b(_0x3ca76d[_0xcd74('0x11')][_0xcd74('0x10')]);}})[_0xcd74('0x12')](function(_0x2fdf2e){logger[_0xcd74('0xf')]('SmsQueueReport,\x20%s,\x20%s',_0x1c98ff,_0x2fdf2e);_0x496ae1(_0x2fdf2e);});});}exports[_0xcd74('0x13')]=function(_0x3332bf){var _0x2b5294=this;return new Promise(function(_0x49ecfd,_0x2e575a){return db[_0xcd74('0x14')]['create'](_0x3332bf[_0xcd74('0x15')],{'raw':_0x3332bf[_0xcd74('0x16')]?_0x3332bf[_0xcd74('0x16')]['raw']===undefined?!![]:![]:!![]})[_0xcd74('0x17')](function(_0x31776c){logger[_0xcd74('0x9')](_0xcd74('0x13'),_0x3332bf);logger[_0xcd74('0xc')]('CreateSmsQueueReport',_0x3332bf,JSON[_0xcd74('0xe')](_0x31776c));_0x49ecfd(_0x31776c);})[_0xcd74('0x12')](function(_0x3b781a){logger['error'](_0xcd74('0x13'),_0x3b781a[_0xcd74('0x10')],_0x3332bf);_0x2e575a(_0x2b5294['error'](0x1f4,_0x3b781a[_0xcd74('0x10')]));});});};exports['UpdateSmsQueueReport']=function(_0x19aed4){var _0x3a06c2=this;return new Promise(function(_0x490b94,_0x3664e2){return db[_0xcd74('0x14')][_0xcd74('0x18')](_0x19aed4['body'],{'raw':_0x19aed4[_0xcd74('0x16')]?_0x19aed4['options'][_0xcd74('0x19')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x19aed4['options']?_0x19aed4[_0xcd74('0x16')][_0xcd74('0x1a')]||null:null,'attributes':_0x19aed4[_0xcd74('0x16')]?_0x19aed4[_0xcd74('0x16')][_0xcd74('0x1b')]||null:null,'limit':_0x19aed4[_0xcd74('0x16')]?_0x19aed4[_0xcd74('0x16')][_0xcd74('0x1c')]||null:null})['then'](function(_0x543ee4){logger['info']('UpdateSmsQueueReport',_0x19aed4);logger['debug'](_0xcd74('0x1d'),_0x19aed4,JSON[_0xcd74('0xe')](_0x543ee4));_0x490b94(_0x543ee4);})[_0xcd74('0x12')](function(_0x1455f7){logger[_0xcd74('0xf')](_0xcd74('0x1d'),_0x1455f7['message'],_0x19aed4);_0x3664e2(_0x3a06c2['error'](0x1f4,_0x1455f7['message']));});});}; \ No newline at end of file diff --git a/server/api/smsTransferReport/index.js b/server/api/smsTransferReport/index.js index 4cf5d9f..4c48aec 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 _0x0abf=['get','isAuthenticated','index','/describe','describe','/:id','post','create','delete','destroy','exports','multer','path','connect-timeout','../../components/auth/service','../../config/environment','./smsTransferReport.controller'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x0abf,0xe8));var _0xf0ab=function(_0x5b644e,_0x2e5e07){_0x5b644e=_0x5b644e-0x0;var _0x49c6bf=_0x0abf[_0x5b644e];return _0x49c6bf;};'use strict';var multer=require(_0xf0ab('0x0'));var util=require('util');var path=require(_0xf0ab('0x1'));var timeout=require(_0xf0ab('0x2'));var express=require('express');var router=express['Router']();var auth=require(_0xf0ab('0x3'));var interaction=require('../../components/interaction/service');var config=require(_0xf0ab('0x4'));var controller=require(_0xf0ab('0x5'));router[_0xf0ab('0x6')]('/',auth[_0xf0ab('0x7')](),controller[_0xf0ab('0x8')]);router[_0xf0ab('0x6')](_0xf0ab('0x9'),auth['isAuthenticated'](),controller[_0xf0ab('0xa')]);router[_0xf0ab('0x6')](_0xf0ab('0xb'),auth[_0xf0ab('0x7')](),controller['show']);router[_0xf0ab('0xc')]('/',auth[_0xf0ab('0x7')](),controller[_0xf0ab('0xd')]);router['put']('/:id',auth[_0xf0ab('0x7')](),controller['update']);router[_0xf0ab('0xe')](_0xf0ab('0xb'),auth[_0xf0ab('0x7')](),controller[_0xf0ab('0xf')]);module[_0xf0ab('0x10')]=router; \ No newline at end of file +var _0xb03e=['describe','/:id','post','create','update','delete','destroy','exports','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./smsTransferReport.controller','get','isAuthenticated','index','/describe'];(function(_0x3f4ea3,_0x23ceb2){var _0x23fdf3=function(_0x53e920){while(--_0x53e920){_0x3f4ea3['push'](_0x3f4ea3['shift']());}};_0x23fdf3(++_0x23ceb2);}(_0xb03e,0x1eb));var _0xeb03=function(_0x57a674,_0x32321f){_0x57a674=_0x57a674-0x0;var _0x45046e=_0xb03e[_0x57a674];return _0x45046e;};'use strict';var multer=require('multer');var util=require(_0xeb03('0x0'));var path=require(_0xeb03('0x1'));var timeout=require(_0xeb03('0x2'));var express=require(_0xeb03('0x3'));var router=express[_0xeb03('0x4')]();var auth=require(_0xeb03('0x5'));var interaction=require(_0xeb03('0x6'));var config=require(_0xeb03('0x7'));var controller=require(_0xeb03('0x8'));router[_0xeb03('0x9')]('/',auth[_0xeb03('0xa')](),controller[_0xeb03('0xb')]);router['get'](_0xeb03('0xc'),auth[_0xeb03('0xa')](),controller[_0xeb03('0xd')]);router[_0xeb03('0x9')](_0xeb03('0xe'),auth[_0xeb03('0xa')](),controller['show']);router[_0xeb03('0xf')]('/',auth[_0xeb03('0xa')](),controller[_0xeb03('0x10')]);router['put'](_0xeb03('0xe'),auth['isAuthenticated'](),controller[_0xeb03('0x11')]);router[_0xeb03('0x12')](_0xeb03('0xe'),auth[_0xeb03('0xa')](),controller[_0xeb03('0x13')]);module[_0xeb03('0x14')]=router; \ No newline at end of file diff --git a/server/api/smsTransferReport/smsTransferReport.attributes.js b/server/api/smsTransferReport/smsTransferReport.attributes.js index fb22e7c..c0dfb33 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 _0xb5d0=['DATE','NOW','exports','ENUM','account','agent','queue'];(function(_0x4b369d,_0x265eb8){var _0x571a98=function(_0x56341a){while(--_0x56341a){_0x4b369d['push'](_0x4b369d['shift']());}};_0x571a98(++_0x265eb8);}(_0xb5d0,0x79));var _0x0b5d=function(_0x373591,_0x4f29b4){_0x373591=_0x373591-0x0;var _0x3b9cf1=_0xb5d0[_0x373591];return _0x3b9cf1;};'use strict';var moment=require('moment');var Sequelize=require('sequelize');module[_0x0b5d('0x0')]={'uniqueid':{'type':Sequelize['STRING'],'allowNull':![]},'type':{'type':Sequelize[_0x0b5d('0x1')](_0x0b5d('0x2'),_0x0b5d('0x3'),'queue'),'allowNull':![],'defaultValue':_0x0b5d('0x4')},'transferredAt':{'type':Sequelize[_0x0b5d('0x5')],'allowNull':![],'defaultValue':Sequelize[_0x0b5d('0x6')]}}; \ No newline at end of file +var _0x9210=['sequelize','exports','STRING','ENUM','account','agent','queue','NOW','moment'];(function(_0x4f2105,_0x10da0c){var _0x2f4098=function(_0x505f9a){while(--_0x505f9a){_0x4f2105['push'](_0x4f2105['shift']());}};_0x2f4098(++_0x10da0c);}(_0x9210,0x131));var _0x0921=function(_0x958c5f,_0x15b52b){_0x958c5f=_0x958c5f-0x0;var _0x209bc1=_0x9210[_0x958c5f];return _0x209bc1;};'use strict';var moment=require(_0x0921('0x0'));var Sequelize=require(_0x0921('0x1'));module[_0x0921('0x2')]={'uniqueid':{'type':Sequelize[_0x0921('0x3')],'allowNull':![]},'type':{'type':Sequelize[_0x0921('0x4')](_0x0921('0x5'),_0x0921('0x6'),_0x0921('0x7')),'allowNull':![],'defaultValue':'queue'},'transferredAt':{'type':Sequelize['DATE'],'allowNull':![],'defaultValue':Sequelize[_0x0921('0x8')]}}; \ No newline at end of file diff --git a/server/api/smsTransferReport/smsTransferReport.controller.js b/server/api/smsTransferReport/smsTransferReport.controller.js index ba4615e..14ce6e0 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 _0xaf6a=['type','key','model','query','keys','filters','intersection','fields','attributes','length','nolimit','order','sort','pick','filter','where','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','find','create','body','params','describe','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','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','sendStatus','status','json','count','offset','limit','set','Content-Range','reject','update','then','destroy','end','error','stack','name','send','map','SmsTransferReport','rawAttributes','fieldName'];(function(_0x1daaa4,_0x2a13f8){var _0x4d6a11=function(_0x52ea7f){while(--_0x52ea7f){_0x1daaa4['push'](_0x1daaa4['shift']());}};_0x4d6a11(++_0x2a13f8);}(_0xaf6a,0xff));var _0xaaf6=function(_0x12dc31,_0x337050){_0x12dc31=_0x12dc31-0x0;var _0x15f0a2=_0xaf6a[_0x12dc31];return _0x15f0a2;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0xaaf6('0x0'));var rimraf=require(_0xaaf6('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0xaaf6('0x2'));var BPromise=require(_0xaaf6('0x3'));var Mustache=require('mustache');var util=require(_0xaaf6('0x4'));var path=require(_0xaaf6('0x5'));var sox=require(_0xaaf6('0x6'));var csv=require(_0xaaf6('0x7'));var ejs=require(_0xaaf6('0x8'));var fs=require('fs');var _=require(_0xaaf6('0x9'));var squel=require(_0xaaf6('0xa'));var crypto=require(_0xaaf6('0xb'));var jsforce=require(_0xaaf6('0xc'));var deskjs=require(_0xaaf6('0xd'));var toCsv=require(_0xaaf6('0x7'));var querystring=require(_0xaaf6('0xe'));var Papa=require(_0xaaf6('0xf'));var Redis=require(_0xaaf6('0x10'));var authService=require(_0xaaf6('0x11'));var qs=require(_0xaaf6('0x12'));var as=require(_0xaaf6('0x13'));var hardwareService=require(_0xaaf6('0x14'));var logger=require('../../config/logger')(_0xaaf6('0x15'));var utils=require(_0xaaf6('0x16'));var config=require(_0xaaf6('0x17'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x4be413,_0x3977a2){_0x3977a2=_0x3977a2||0xcc;return function(_0x1fa78d){if(_0x1fa78d){return _0x4be413[_0xaaf6('0x18')](_0x3977a2);}return _0x4be413[_0xaaf6('0x19')](_0x3977a2)['end']();};}function respondWithResult(_0x1424c0,_0x4d213a){_0x4d213a=_0x4d213a||0xc8;return function(_0x4a102d){if(_0x4a102d){return _0x1424c0['status'](_0x4d213a)[_0xaaf6('0x1a')](_0x4a102d);}};}function respondWithFilteredResult(_0x277eda,_0x346478){return function(_0x11b5f9){if(_0x11b5f9){var _0x32b4f8=_0x11b5f9[_0xaaf6('0x1b')],_0x261820=_0x346478[_0xaaf6('0x1c')],_0x1f70cc=_0x346478[_0xaaf6('0x1c')]+_0x346478[_0xaaf6('0x1d')],_0x2f60bd;if(_0x1f70cc>=_0x32b4f8){_0x1f70cc=_0x32b4f8;_0x2f60bd=0xc8;}else{_0x2f60bd=0xce;}_0x277eda['status'](_0x2f60bd);return _0x277eda[_0xaaf6('0x1e')](_0xaaf6('0x1f'),_0x261820+'-'+_0x1f70cc+'/'+_0x32b4f8)[_0xaaf6('0x1a')](_0x11b5f9);}return null;};}function patchUpdates(_0x3fb305){return function(_0x2629bb){try{jsonpatch['apply'](_0x2629bb,_0x3fb305,!![]);}catch(_0x218cf5){return BPromise[_0xaaf6('0x20')](_0x218cf5);}return _0x2629bb['save']();};}function saveUpdates(_0x5d8877,_0x3dae32){return function(_0x416a51){if(_0x416a51){return _0x416a51[_0xaaf6('0x21')](_0x5d8877)[_0xaaf6('0x22')](function(_0x4639eb){return _0x4639eb;});}return null;};}function removeEntity(_0x48981a,_0x2054dc){return function(_0xaf2940){if(_0xaf2940){return _0xaf2940[_0xaaf6('0x23')]()[_0xaaf6('0x22')](function(){_0x48981a[_0xaaf6('0x19')](0xcc)[_0xaaf6('0x24')]();});}};}function handleEntityNotFound(_0x283a35,_0x39ad3a){return function(_0x3944b3){if(!_0x3944b3){_0x283a35[_0xaaf6('0x18')](0x194);}return _0x3944b3;};}function handleError(_0xbea0c8,_0x288e34){_0x288e34=_0x288e34||0x1f4;return function(_0x3f06d5){logger[_0xaaf6('0x25')](_0x3f06d5[_0xaaf6('0x26')]);if(_0x3f06d5[_0xaaf6('0x27')]){delete _0x3f06d5[_0xaaf6('0x27')];}_0xbea0c8[_0xaaf6('0x19')](_0x288e34)[_0xaaf6('0x28')](_0x3f06d5);};}exports['index']=function(_0x3a1dc9,_0x4e2f7b){var _0x17f63e={},_0x5a7607={},_0x3a6946={'count':0x0,'rows':[]};var _0x1d9a72=_[_0xaaf6('0x29')](db[_0xaaf6('0x2a')][_0xaaf6('0x2b')],function(_0x570024){return{'name':_0x570024[_0xaaf6('0x2c')],'type':_0x570024[_0xaaf6('0x2d')][_0xaaf6('0x2e')]};});_0x5a7607[_0xaaf6('0x2f')]=_[_0xaaf6('0x29')](_0x1d9a72,_0xaaf6('0x27'));_0x5a7607[_0xaaf6('0x30')]=_[_0xaaf6('0x31')](_0x3a1dc9['query']);_0x5a7607[_0xaaf6('0x32')]=_[_0xaaf6('0x33')](_0x5a7607[_0xaaf6('0x2f')],_0x5a7607['query']);_0x17f63e['attributes']=_['intersection'](_0x5a7607[_0xaaf6('0x2f')],qs[_0xaaf6('0x34')](_0x3a1dc9['query']['fields']));_0x17f63e[_0xaaf6('0x35')]=_0x17f63e[_0xaaf6('0x35')][_0xaaf6('0x36')]?_0x17f63e[_0xaaf6('0x35')]:_0x5a7607[_0xaaf6('0x2f')];if(!_0x3a1dc9[_0xaaf6('0x30')]['hasOwnProperty'](_0xaaf6('0x37'))){_0x17f63e[_0xaaf6('0x1d')]=qs[_0xaaf6('0x1d')](_0x3a1dc9[_0xaaf6('0x30')]['limit']);_0x17f63e[_0xaaf6('0x1c')]=qs[_0xaaf6('0x1c')](_0x3a1dc9[_0xaaf6('0x30')]['offset']);}_0x17f63e[_0xaaf6('0x38')]=qs[_0xaaf6('0x39')](_0x3a1dc9['query'][_0xaaf6('0x39')]);_0x17f63e['where']=qs[_0xaaf6('0x32')](_[_0xaaf6('0x3a')](_0x3a1dc9[_0xaaf6('0x30')],_0x5a7607['filters']));if(_0x3a1dc9[_0xaaf6('0x30')][_0xaaf6('0x3b')]){_0x17f63e[_0xaaf6('0x3c')]=_[_0xaaf6('0x3d')](_0x17f63e['where'],{'$or':_[_0xaaf6('0x29')](_0x1d9a72,function(_0x369e9a){if(_0x369e9a['type']!==_0xaaf6('0x3e')){var _0x43a304={};_0x43a304[_0x369e9a[_0xaaf6('0x27')]]={'$like':'%'+_0x3a1dc9[_0xaaf6('0x30')][_0xaaf6('0x3b')]+'%'};return _0x43a304;}})});}_0x17f63e=_[_0xaaf6('0x3d')]({},_0x17f63e,_0x3a1dc9[_0xaaf6('0x3f')]);var _0x354975={'where':_0x17f63e[_0xaaf6('0x3c')]};return db['SmsTransferReport'][_0xaaf6('0x1b')](_0x354975)[_0xaaf6('0x22')](function(_0x4ab9c6){_0x3a6946['count']=_0x4ab9c6;if(_0x3a1dc9[_0xaaf6('0x30')][_0xaaf6('0x40')]){_0x17f63e[_0xaaf6('0x41')]=[{'all':!![]}];}return db[_0xaaf6('0x2a')][_0xaaf6('0x42')](_0x17f63e);})[_0xaaf6('0x22')](function(_0x1961bb){_0x3a6946[_0xaaf6('0x43')]=_0x1961bb;return _0x3a6946;})['then'](respondWithFilteredResult(_0x4e2f7b,_0x17f63e))[_0xaaf6('0x44')](handleError(_0x4e2f7b,null));};exports[_0xaaf6('0x45')]=function(_0x59c7d4,_0x2743f5){var _0x28378f={'raw':!![],'where':{'id':_0x59c7d4['params']['id']}},_0x2add3e={};_0x2add3e['model']=_['keys'](db['SmsTransferReport'][_0xaaf6('0x2b')]);_0x2add3e['query']=_[_0xaaf6('0x31')](_0x59c7d4['query']);_0x2add3e['filters']=_[_0xaaf6('0x33')](_0x2add3e[_0xaaf6('0x2f')],_0x2add3e['query']);_0x28378f['attributes']=_[_0xaaf6('0x33')](_0x2add3e[_0xaaf6('0x2f')],qs[_0xaaf6('0x34')](_0x59c7d4[_0xaaf6('0x30')]['fields']));_0x28378f[_0xaaf6('0x35')]=_0x28378f[_0xaaf6('0x35')][_0xaaf6('0x36')]?_0x28378f[_0xaaf6('0x35')]:_0x2add3e[_0xaaf6('0x2f')];if(_0x59c7d4[_0xaaf6('0x30')][_0xaaf6('0x40')]){_0x28378f[_0xaaf6('0x41')]=[{'all':!![]}];}_0x28378f=_[_0xaaf6('0x3d')]({},_0x28378f,_0x59c7d4[_0xaaf6('0x3f')]);return db['SmsTransferReport'][_0xaaf6('0x46')](_0x28378f)[_0xaaf6('0x22')](handleEntityNotFound(_0x2743f5,null))[_0xaaf6('0x22')](respondWithResult(_0x2743f5,null))[_0xaaf6('0x44')](handleError(_0x2743f5,null));};exports[_0xaaf6('0x47')]=function(_0x5d1528,_0x29792f){return db[_0xaaf6('0x2a')]['create'](_0x5d1528[_0xaaf6('0x48')],{})['then'](respondWithResult(_0x29792f,0xc9))[_0xaaf6('0x44')](handleError(_0x29792f,null));};exports[_0xaaf6('0x21')]=function(_0x335c22,_0x39f125){if(_0x335c22[_0xaaf6('0x48')]['id']){delete _0x335c22[_0xaaf6('0x48')]['id'];}return db[_0xaaf6('0x2a')][_0xaaf6('0x46')]({'where':{'id':_0x335c22['params']['id']}})[_0xaaf6('0x22')](handleEntityNotFound(_0x39f125,null))['then'](saveUpdates(_0x335c22[_0xaaf6('0x48')],null))[_0xaaf6('0x22')](respondWithResult(_0x39f125,null))[_0xaaf6('0x44')](handleError(_0x39f125,null));};exports[_0xaaf6('0x23')]=function(_0x487313,_0x1ba291){return db[_0xaaf6('0x2a')]['find']({'where':{'id':_0x487313[_0xaaf6('0x49')]['id']}})[_0xaaf6('0x22')](handleEntityNotFound(_0x1ba291,null))[_0xaaf6('0x22')](removeEntity(_0x1ba291,null))[_0xaaf6('0x44')](handleError(_0x1ba291,null));};exports['describe']=function(_0xf9e568,_0x3067e1){return db['SmsTransferReport'][_0xaaf6('0x4a')]()[_0xaaf6('0x22')](respondWithResult(_0x3067e1,null))[_0xaaf6('0x44')](handleError(_0x3067e1,null));}; \ No newline at end of file +var _0x3778=['save','then','error','stack','name','send','index','map','SmsTransferReport','rawAttributes','type','key','query','keys','filters','model','fields','attributes','length','hasOwnProperty','nolimit','sort','where','pick','filter','merge','options','count','includeAll','include','rows','catch','show','params','intersection','find','create','body','destroy','describe','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','path','sox','to-csv','ejs','squel','crypto','jsforce','desk.js','papaparse','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','offset','limit','set','Content-Range','apply'];(function(_0x166bc3,_0x11c429){var _0x1d7921=function(_0x2263d7){while(--_0x2263d7){_0x166bc3['push'](_0x166bc3['shift']());}};_0x1d7921(++_0x11c429);}(_0x3778,0x100));var _0x8377=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x3778[_0x3dd15e];return _0x231fd0;};'use strict';var pdf=require(_0x8377('0x0'));var emlformat=require(_0x8377('0x1'));var rimraf=require(_0x8377('0x2'));var zipdir=require(_0x8377('0x3'));var jsonpatch=require(_0x8377('0x4'));var rp=require('request-promise');var moment=require(_0x8377('0x5'));var BPromise=require(_0x8377('0x6'));var Mustache=require('mustache');var util=require('util');var path=require(_0x8377('0x7'));var sox=require(_0x8377('0x8'));var csv=require(_0x8377('0x9'));var ejs=require(_0x8377('0xa'));var fs=require('fs');var _=require('lodash');var squel=require(_0x8377('0xb'));var crypto=require(_0x8377('0xc'));var jsforce=require(_0x8377('0xd'));var deskjs=require(_0x8377('0xe'));var toCsv=require(_0x8377('0x9'));var querystring=require('querystring');var Papa=require(_0x8377('0xf'));var Redis=require('ioredis');var authService=require(_0x8377('0x10'));var qs=require('../../components/parsers/qs');var as=require(_0x8377('0x11'));var hardwareService=require(_0x8377('0x12'));var logger=require(_0x8377('0x13'))('api');var utils=require(_0x8377('0x14'));var config=require(_0x8377('0x15'));var db=require(_0x8377('0x16'))['db'];function respondWithStatusCode(_0x3f5f1b,_0x2e8142){_0x2e8142=_0x2e8142||0xcc;return function(_0x312199){if(_0x312199){return _0x3f5f1b[_0x8377('0x17')](_0x2e8142);}return _0x3f5f1b[_0x8377('0x18')](_0x2e8142)[_0x8377('0x19')]();};}function respondWithResult(_0x37be1b,_0x27b0d0){_0x27b0d0=_0x27b0d0||0xc8;return function(_0xde4741){if(_0xde4741){return _0x37be1b[_0x8377('0x18')](_0x27b0d0)[_0x8377('0x1a')](_0xde4741);}};}function respondWithFilteredResult(_0x1edad1,_0x561818){return function(_0x3ff86c){if(_0x3ff86c){var _0x322b11=_0x3ff86c['count'],_0x4ae51e=_0x561818['offset'],_0x3b4d85=_0x561818[_0x8377('0x1b')]+_0x561818[_0x8377('0x1c')],_0x45a4c5;if(_0x3b4d85>=_0x322b11){_0x3b4d85=_0x322b11;_0x45a4c5=0xc8;}else{_0x45a4c5=0xce;}_0x1edad1[_0x8377('0x18')](_0x45a4c5);return _0x1edad1[_0x8377('0x1d')](_0x8377('0x1e'),_0x4ae51e+'-'+_0x3b4d85+'/'+_0x322b11)[_0x8377('0x1a')](_0x3ff86c);}return null;};}function patchUpdates(_0x2b50c3){return function(_0xef87f8){try{jsonpatch[_0x8377('0x1f')](_0xef87f8,_0x2b50c3,!![]);}catch(_0x1f8224){return BPromise['reject'](_0x1f8224);}return _0xef87f8[_0x8377('0x20')]();};}function saveUpdates(_0x4978c3,_0x4fbc8c){return function(_0x4b2654){if(_0x4b2654){return _0x4b2654['update'](_0x4978c3)[_0x8377('0x21')](function(_0x293748){return _0x293748;});}return null;};}function removeEntity(_0x805a9c,_0x418a7e){return function(_0x2ab69c){if(_0x2ab69c){return _0x2ab69c['destroy']()['then'](function(){_0x805a9c[_0x8377('0x18')](0xcc)[_0x8377('0x19')]();});}};}function handleEntityNotFound(_0x2ba9be,_0x582ca9){return function(_0x522168){if(!_0x522168){_0x2ba9be[_0x8377('0x17')](0x194);}return _0x522168;};}function handleError(_0x50b9cf,_0x37c547){_0x37c547=_0x37c547||0x1f4;return function(_0x591dfe){logger[_0x8377('0x22')](_0x591dfe[_0x8377('0x23')]);if(_0x591dfe[_0x8377('0x24')]){delete _0x591dfe[_0x8377('0x24')];}_0x50b9cf[_0x8377('0x18')](_0x37c547)[_0x8377('0x25')](_0x591dfe);};}exports[_0x8377('0x26')]=function(_0x5f0a1d,_0x453269){var _0x3548c4={},_0x5af02b={},_0x693796={'count':0x0,'rows':[]};var _0x4e8894=_[_0x8377('0x27')](db[_0x8377('0x28')][_0x8377('0x29')],function(_0x3dff84){return{'name':_0x3dff84['fieldName'],'type':_0x3dff84[_0x8377('0x2a')][_0x8377('0x2b')]};});_0x5af02b['model']=_[_0x8377('0x27')](_0x4e8894,_0x8377('0x24'));_0x5af02b[_0x8377('0x2c')]=_[_0x8377('0x2d')](_0x5f0a1d[_0x8377('0x2c')]);_0x5af02b[_0x8377('0x2e')]=_['intersection'](_0x5af02b[_0x8377('0x2f')],_0x5af02b[_0x8377('0x2c')]);_0x3548c4['attributes']=_['intersection'](_0x5af02b[_0x8377('0x2f')],qs[_0x8377('0x30')](_0x5f0a1d[_0x8377('0x2c')][_0x8377('0x30')]));_0x3548c4[_0x8377('0x31')]=_0x3548c4[_0x8377('0x31')][_0x8377('0x32')]?_0x3548c4['attributes']:_0x5af02b[_0x8377('0x2f')];if(!_0x5f0a1d[_0x8377('0x2c')][_0x8377('0x33')](_0x8377('0x34'))){_0x3548c4['limit']=qs[_0x8377('0x1c')](_0x5f0a1d[_0x8377('0x2c')][_0x8377('0x1c')]);_0x3548c4[_0x8377('0x1b')]=qs[_0x8377('0x1b')](_0x5f0a1d[_0x8377('0x2c')][_0x8377('0x1b')]);}_0x3548c4['order']=qs[_0x8377('0x35')](_0x5f0a1d[_0x8377('0x2c')]['sort']);_0x3548c4[_0x8377('0x36')]=qs[_0x8377('0x2e')](_[_0x8377('0x37')](_0x5f0a1d[_0x8377('0x2c')],_0x5af02b[_0x8377('0x2e')]));if(_0x5f0a1d[_0x8377('0x2c')][_0x8377('0x38')]){_0x3548c4['where']=_[_0x8377('0x39')](_0x3548c4[_0x8377('0x36')],{'$or':_[_0x8377('0x27')](_0x4e8894,function(_0x440361){if(_0x440361[_0x8377('0x2a')]!=='VIRTUAL'){var _0x3931d2={};_0x3931d2[_0x440361[_0x8377('0x24')]]={'$like':'%'+_0x5f0a1d[_0x8377('0x2c')][_0x8377('0x38')]+'%'};return _0x3931d2;}})});}_0x3548c4=_[_0x8377('0x39')]({},_0x3548c4,_0x5f0a1d[_0x8377('0x3a')]);var _0x57b3c5={'where':_0x3548c4['where']};return db[_0x8377('0x28')]['count'](_0x57b3c5)['then'](function(_0x22acf9){_0x693796[_0x8377('0x3b')]=_0x22acf9;if(_0x5f0a1d[_0x8377('0x2c')][_0x8377('0x3c')]){_0x3548c4[_0x8377('0x3d')]=[{'all':!![]}];}return db[_0x8377('0x28')]['findAll'](_0x3548c4);})['then'](function(_0x3ba6af){_0x693796[_0x8377('0x3e')]=_0x3ba6af;return _0x693796;})[_0x8377('0x21')](respondWithFilteredResult(_0x453269,_0x3548c4))[_0x8377('0x3f')](handleError(_0x453269,null));};exports[_0x8377('0x40')]=function(_0x41fb1b,_0x3bfcf5){var _0x2a5bb3={'raw':!![],'where':{'id':_0x41fb1b[_0x8377('0x41')]['id']}},_0x49fb66={};_0x49fb66[_0x8377('0x2f')]=_[_0x8377('0x2d')](db[_0x8377('0x28')][_0x8377('0x29')]);_0x49fb66[_0x8377('0x2c')]=_['keys'](_0x41fb1b[_0x8377('0x2c')]);_0x49fb66['filters']=_[_0x8377('0x42')](_0x49fb66[_0x8377('0x2f')],_0x49fb66['query']);_0x2a5bb3[_0x8377('0x31')]=_[_0x8377('0x42')](_0x49fb66[_0x8377('0x2f')],qs[_0x8377('0x30')](_0x41fb1b['query'][_0x8377('0x30')]));_0x2a5bb3[_0x8377('0x31')]=_0x2a5bb3[_0x8377('0x31')]['length']?_0x2a5bb3['attributes']:_0x49fb66[_0x8377('0x2f')];if(_0x41fb1b[_0x8377('0x2c')][_0x8377('0x3c')]){_0x2a5bb3[_0x8377('0x3d')]=[{'all':!![]}];}_0x2a5bb3=_['merge']({},_0x2a5bb3,_0x41fb1b[_0x8377('0x3a')]);return db[_0x8377('0x28')][_0x8377('0x43')](_0x2a5bb3)[_0x8377('0x21')](handleEntityNotFound(_0x3bfcf5,null))[_0x8377('0x21')](respondWithResult(_0x3bfcf5,null))[_0x8377('0x3f')](handleError(_0x3bfcf5,null));};exports[_0x8377('0x44')]=function(_0x3373d8,_0x6732ee){return db[_0x8377('0x28')]['create'](_0x3373d8[_0x8377('0x45')],{})[_0x8377('0x21')](respondWithResult(_0x6732ee,0xc9))[_0x8377('0x3f')](handleError(_0x6732ee,null));};exports['update']=function(_0x3fbe15,_0x3e55f7){if(_0x3fbe15[_0x8377('0x45')]['id']){delete _0x3fbe15[_0x8377('0x45')]['id'];}return db[_0x8377('0x28')]['find']({'where':{'id':_0x3fbe15[_0x8377('0x41')]['id']}})['then'](handleEntityNotFound(_0x3e55f7,null))[_0x8377('0x21')](saveUpdates(_0x3fbe15[_0x8377('0x45')],null))[_0x8377('0x21')](respondWithResult(_0x3e55f7,null))[_0x8377('0x3f')](handleError(_0x3e55f7,null));};exports[_0x8377('0x46')]=function(_0x128860,_0x201222){return db[_0x8377('0x28')]['find']({'where':{'id':_0x128860['params']['id']}})[_0x8377('0x21')](handleEntityNotFound(_0x201222,null))['then'](removeEntity(_0x201222,null))[_0x8377('0x3f')](handleError(_0x201222,null));};exports[_0x8377('0x47')]=function(_0x346daa,_0x5b36a2){return db[_0x8377('0x28')][_0x8377('0x47')]()[_0x8377('0x21')](respondWithResult(_0x5b36a2,null))['catch'](handleError(_0x5b36a2,null));}; \ No newline at end of file diff --git a/server/api/smsTransferReport/smsTransferReport.model.js b/server/api/smsTransferReport/smsTransferReport.model.js index 65c7ea4..22f9a83 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 _0x81c6=['bluebird','request-promise','path','../../config/environment','./smsTransferReport.attributes','exports','define','SmsTransferReport','uniqueid','util'];(function(_0x386fb5,_0xcc719){var _0x44adeb=function(_0x296d8c){while(--_0x296d8c){_0x386fb5['push'](_0x386fb5['shift']());}};_0x44adeb(++_0xcc719);}(_0x81c6,0x1d5));var _0x681c=function(_0x586115,_0x283bd2){_0x586115=_0x586115-0x0;var _0x221bac=_0x81c6[_0x586115];return _0x221bac;};'use strict';var _=require('lodash');var util=require(_0x681c('0x0'));var logger=require('../../config/logger')('api');var moment=require('moment');var BPromise=require(_0x681c('0x1'));var rp=require(_0x681c('0x2'));var fs=require('fs');var path=require(_0x681c('0x3'));var rimraf=require('rimraf');var config=require(_0x681c('0x4'));var attributes=require(_0x681c('0x5'));module[_0x681c('0x6')]=function(_0x1d31c8,_0x4ea522){return _0x1d31c8[_0x681c('0x7')](_0x681c('0x8'),attributes,{'tableName':'report_sms_transfer','paranoid':![],'indexes':[{'name':'uniqueid','fields':[_0x681c('0x9')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x4819=['moment','bluebird','request-promise','path','rimraf','../../config/environment','./smsTransferReport.attributes','SmsTransferReport','report_sms_transfer','uniqueid','util','../../config/logger','api'];(function(_0x219d0a,_0x3fb575){var _0x1a3ab3=function(_0x1b839b){while(--_0x1b839b){_0x219d0a['push'](_0x219d0a['shift']());}};_0x1a3ab3(++_0x3fb575);}(_0x4819,0xcd));var _0x9481=function(_0x1e06c4,_0x38a792){_0x1e06c4=_0x1e06c4-0x0;var _0x529a41=_0x4819[_0x1e06c4];return _0x529a41;};'use strict';var _=require('lodash');var util=require(_0x9481('0x0'));var logger=require(_0x9481('0x1'))(_0x9481('0x2'));var moment=require(_0x9481('0x3'));var BPromise=require(_0x9481('0x4'));var rp=require(_0x9481('0x5'));var fs=require('fs');var path=require(_0x9481('0x6'));var rimraf=require(_0x9481('0x7'));var config=require(_0x9481('0x8'));var attributes=require(_0x9481('0x9'));module['exports']=function(_0x4d9e3a,_0x5def07){return _0x4d9e3a['define'](_0x9481('0xa'),attributes,{'tableName':_0x9481('0xb'),'paranoid':![],'indexes':[{'name':_0x9481('0xc'),'fields':[_0x9481('0xc')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/smsTransferReport/smsTransferReport.rpc.js b/server/api/smsTransferReport/smsTransferReport.rpc.js index 27d5389..2fad599 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 _0x793e=['then','SmsTransferReport,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','lodash','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request'];(function(_0x191456,_0x1995c2){var _0x58cd40=function(_0x1f0164){while(--_0x1f0164){_0x191456['push'](_0x191456['shift']());}};_0x58cd40(++_0x1995c2);}(_0x793e,0x11a));var _0xe793=function(_0x312130,_0x569442){_0x312130=_0x312130-0x0;var _0x52a146=_0x793e[_0x312130];return _0x52a146;};'use strict';var _=require(_0xe793('0x0'));var util=require('util');var moment=require(_0xe793('0x1'));var BPromise=require(_0xe793('0x2'));var rs=require(_0xe793('0x3'));var fs=require('fs');var Redis=require(_0xe793('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0xe793('0x5'));var logger=require(_0xe793('0x6'))(_0xe793('0x7'));var config=require(_0xe793('0x8'));var jayson=require(_0xe793('0x9'));var client=jayson['client'][_0xe793('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x564908,_0xd4245a,_0xcabf40){return new BPromise(function(_0xaf8a48,_0x4783e2){return client[_0xe793('0xb')](_0x564908,_0xcabf40)[_0xe793('0xc')](function(_0x346194){logger['info'](_0xe793('0xd'),_0xd4245a,_0xe793('0xe'));logger[_0xe793('0xf')]('SmsTransferReport,\x20%s,\x20%s,\x20%s',_0xd4245a,_0xe793('0xe'),JSON[_0xe793('0x10')](_0x346194));if(_0x346194[_0xe793('0x11')]){if(_0x346194[_0xe793('0x11')][_0xe793('0x12')]===0x1f4){logger[_0xe793('0x11')](_0xe793('0xd'),_0xd4245a,_0x346194[_0xe793('0x11')][_0xe793('0x13')]);return _0x4783e2(_0x346194[_0xe793('0x11')][_0xe793('0x13')]);}logger[_0xe793('0x11')](_0xe793('0xd'),_0xd4245a,_0x346194[_0xe793('0x11')][_0xe793('0x13')]);return _0xaf8a48(_0x346194[_0xe793('0x11')][_0xe793('0x13')]);}else{logger['info']('SmsTransferReport,\x20%s,\x20%s',_0xd4245a,_0xe793('0xe'));_0xaf8a48(_0x346194[_0xe793('0x14')][_0xe793('0x13')]);}})['catch'](function(_0x3ea1d9){logger[_0xe793('0x11')](_0xe793('0xd'),_0xd4245a,_0x3ea1d9);_0x4783e2(_0x3ea1d9);});});} \ No newline at end of file +var _0x7918=['SmsTransferReport,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','result','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','info','SmsTransferReport,\x20%s,\x20%s','debug'];(function(_0x408e37,_0x1bfdd9){var _0x5edea5=function(_0xe2c971){while(--_0xe2c971){_0x408e37['push'](_0x408e37['shift']());}};_0x5edea5(++_0x1bfdd9);}(_0x7918,0x6f));var _0x8791=function(_0x305d19,_0x5751a9){_0x305d19=_0x305d19-0x0;var _0x11b7fa=_0x7918[_0x305d19];return _0x11b7fa;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x8791('0x0'));var BPromise=require(_0x8791('0x1'));var rs=require(_0x8791('0x2'));var fs=require('fs');var Redis=require(_0x8791('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x8791('0x4'));var logger=require(_0x8791('0x5'))(_0x8791('0x6'));var config=require(_0x8791('0x7'));var jayson=require(_0x8791('0x8'));var client=jayson[_0x8791('0x9')][_0x8791('0xa')]({'port':0x232a});function respondWithRpcPromise(_0xa4e8ec,_0x29ef6d,_0x4f6804){return new BPromise(function(_0x5c4c52,_0x53fa27){return client[_0x8791('0xb')](_0xa4e8ec,_0x4f6804)['then'](function(_0x13c032){logger[_0x8791('0xc')](_0x8791('0xd'),_0x29ef6d,'request\x20sent');logger[_0x8791('0xe')](_0x8791('0xf'),_0x29ef6d,_0x8791('0x10'),JSON['stringify'](_0x13c032));if(_0x13c032[_0x8791('0x11')]){if(_0x13c032[_0x8791('0x11')][_0x8791('0x12')]===0x1f4){logger[_0x8791('0x11')](_0x8791('0xd'),_0x29ef6d,_0x13c032[_0x8791('0x11')][_0x8791('0x13')]);return _0x53fa27(_0x13c032[_0x8791('0x11')]['message']);}logger[_0x8791('0x11')](_0x8791('0xd'),_0x29ef6d,_0x13c032[_0x8791('0x11')][_0x8791('0x13')]);return _0x5c4c52(_0x13c032['error'][_0x8791('0x13')]);}else{logger[_0x8791('0xc')](_0x8791('0xd'),_0x29ef6d,_0x8791('0x10'));_0x5c4c52(_0x13c032[_0x8791('0x14')][_0x8791('0x13')]);}})['catch'](function(_0x1f4dd0){logger['error'](_0x8791('0xd'),_0x29ef6d,_0x1f4dd0);_0x53fa27(_0x1f4dd0);});});} \ No newline at end of file diff --git a/server/api/sound/index.js b/server/api/sound/index.js index 72f3d11..55c0f16 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 _0xb5ce=['path','connect-timeout','express','Router','../../components/interaction/service','../../config/environment','./sound.controller','index','get','/:id','isAuthenticated','show','/:id/download','download','diskStorage','root','server/files/sounds/original/','originalname','replace','format','%s-%s%s','basename','extname','post','file','put','update','delete','exports','multer','util'];(function(_0x59e21c,_0x4d77b9){var _0x199b4c=function(_0x3034f0){while(--_0x3034f0){_0x59e21c['push'](_0x59e21c['shift']());}};_0x199b4c(++_0x4d77b9);}(_0xb5ce,0x99));var _0xeb5c=function(_0x55a0c5,_0x18b17c){_0x55a0c5=_0x55a0c5-0x0;var _0x22fb7d=_0xb5ce[_0x55a0c5];return _0x22fb7d;};'use strict';var multer=require(_0xeb5c('0x0'));var util=require(_0xeb5c('0x1'));var path=require(_0xeb5c('0x2'));var timeout=require(_0xeb5c('0x3'));var express=require(_0xeb5c('0x4'));var router=express[_0xeb5c('0x5')]();var auth=require('../../components/auth/service');var interaction=require(_0xeb5c('0x6'));var config=require(_0xeb5c('0x7'));var controller=require(_0xeb5c('0x8'));router['get']('/',auth['isAuthenticated'](),controller[_0xeb5c('0x9')]);router[_0xeb5c('0xa')](_0xeb5c('0xb'),auth[_0xeb5c('0xc')](),controller[_0xeb5c('0xd')]);router[_0xeb5c('0xa')](_0xeb5c('0xe'),auth[_0xeb5c('0xc')](),controller[_0xeb5c('0xf')]);var upload=multer({'storage':multer[_0xeb5c('0x10')]({'destination':function(_0x503f8e,_0x4f7e88,_0x1fcb71){_0x1fcb71(null,path['join'](config[_0xeb5c('0x11')],_0xeb5c('0x12')));},'filename':function(_0x4d77af,_0x57449e,_0x519caf){_0x57449e[_0xeb5c('0x13')]=_0x57449e['originalname'][_0xeb5c('0x14')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0x519caf(null,util[_0xeb5c('0x15')](_0xeb5c('0x16'),path[_0xeb5c('0x17')](_0x57449e[_0xeb5c('0x13')],path[_0xeb5c('0x18')](_0x57449e[_0xeb5c('0x13')])),Date['now'](),path[_0xeb5c('0x18')](_0x57449e[_0xeb5c('0x13')])));}})});router[_0xeb5c('0x19')]('/',upload['single'](_0xeb5c('0x1a')),controller['create']);router[_0xeb5c('0x1b')](_0xeb5c('0xb'),auth['isAuthenticated'](),controller[_0xeb5c('0x1c')]);router[_0xeb5c('0x1d')](_0xeb5c('0xb'),auth['isAuthenticated'](),controller['delete']);module[_0xeb5c('0x1e')]=router; \ No newline at end of file +var _0x016d=['join','server/files/sounds/original/','originalname','replace','format','%s-%s%s','basename','extname','now','post','single','file','create','put','delete','/:id','exports','util','path','express','Router','../../components/interaction/service','../../config/environment','./sound.controller','get','isAuthenticated','show','/:id/download','download','diskStorage'];(function(_0x20fe2d,_0x28a897){var _0x488bca=function(_0x497c4b){while(--_0x497c4b){_0x20fe2d['push'](_0x20fe2d['shift']());}};_0x488bca(++_0x28a897);}(_0x016d,0x15b));var _0xd016=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0x016d[_0xa464c9];return _0x3d73c4;};'use strict';var multer=require('multer');var util=require(_0xd016('0x0'));var path=require(_0xd016('0x1'));var timeout=require('connect-timeout');var express=require(_0xd016('0x2'));var router=express[_0xd016('0x3')]();var auth=require('../../components/auth/service');var interaction=require(_0xd016('0x4'));var config=require(_0xd016('0x5'));var controller=require(_0xd016('0x6'));router[_0xd016('0x7')]('/',auth[_0xd016('0x8')](),controller['index']);router['get']('/:id',auth['isAuthenticated'](),controller[_0xd016('0x9')]);router['get'](_0xd016('0xa'),auth[_0xd016('0x8')](),controller[_0xd016('0xb')]);var upload=multer({'storage':multer[_0xd016('0xc')]({'destination':function(_0xe3fe3,_0x1d3260,_0xedf7f8){_0xedf7f8(null,path[_0xd016('0xd')](config['root'],_0xd016('0xe')));},'filename':function(_0x579502,_0x4394a3,_0x44c130){_0x4394a3[_0xd016('0xf')]=_0x4394a3[_0xd016('0xf')][_0xd016('0x10')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0x44c130(null,util[_0xd016('0x11')](_0xd016('0x12'),path[_0xd016('0x13')](_0x4394a3[_0xd016('0xf')],path[_0xd016('0x14')](_0x4394a3[_0xd016('0xf')])),Date[_0xd016('0x15')](),path[_0xd016('0x14')](_0x4394a3[_0xd016('0xf')])));}})});router[_0xd016('0x16')]('/',upload[_0xd016('0x17')](_0xd016('0x18')),controller[_0xd016('0x19')]);router[_0xd016('0x1a')]('/:id',auth[_0xd016('0x8')](),controller['update']);router[_0xd016('0x1b')](_0xd016('0x1c'),auth[_0xd016('0x8')](),controller[_0xd016('0x1b')]);module[_0xd016('0x1d')]=router; \ No newline at end of file diff --git a/server/api/sound/sound.attributes.js b/server/api/sound/sound.attributes.js index 7993b89..72af7c8 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 _0x3ec1=['name','STRING','FLOAT','BIGINT','INTEGER','sequelize','exports'];(function(_0x5ca52d,_0x3a4a22){var _0x89e54e=function(_0x54bdf4){while(--_0x54bdf4){_0x5ca52d['push'](_0x5ca52d['shift']());}};_0x89e54e(++_0x3a4a22);}(_0x3ec1,0xd0));var _0x13ec=function(_0x11c7ee,_0x24cad8){_0x11c7ee=_0x11c7ee-0x0;var _0xcc71b3=_0x3ec1[_0x11c7ee];return _0xcc71b3;};'use strict';var Sequelize=require(_0x13ec('0x0'));module[_0x13ec('0x1')]={'name':{'type':Sequelize['STRING'],'unique':_0x13ec('0x2'),'allowNull':![]},'save_name':{'type':Sequelize[_0x13ec('0x3')]},'display_name':{'type':Sequelize['STRING'],'defaultValue':''},'description':{'type':Sequelize[_0x13ec('0x3')]},'original_format':{'type':Sequelize['STRING']},'original_duration':{'type':Sequelize[_0x13ec('0x4')]},'original_sampleCount':{'type':Sequelize[_0x13ec('0x5')]},'original_channelCount':{'type':Sequelize[_0x13ec('0x6')]},'original_bitRate':{'type':Sequelize['BIGINT']},'original_sampleRate':{'type':Sequelize[_0x13ec('0x6')]},'converted_format':{'type':Sequelize['STRING']},'converted_duration':{'type':Sequelize[_0x13ec('0x4')]},'converted_sampleCount':{'type':Sequelize[_0x13ec('0x5')]},'converted_channelCount':{'type':Sequelize[_0x13ec('0x6')]},'converted_bitRate':{'type':Sequelize[_0x13ec('0x5')]},'converted_sampleRate':{'type':Sequelize[_0x13ec('0x6')]}}; \ No newline at end of file +var _0xc24a=['FLOAT','BIGINT','INTEGER','exports','STRING','name'];(function(_0x224f49,_0x3ce9fa){var _0x54d854=function(_0x28b99e){while(--_0x28b99e){_0x224f49['push'](_0x224f49['shift']());}};_0x54d854(++_0x3ce9fa);}(_0xc24a,0x117));var _0xac24=function(_0xbca1b1,_0x33f0ce){_0xbca1b1=_0xbca1b1-0x0;var _0x4e1686=_0xc24a[_0xbca1b1];return _0x4e1686;};'use strict';var Sequelize=require('sequelize');module[_0xac24('0x0')]={'name':{'type':Sequelize[_0xac24('0x1')],'unique':_0xac24('0x2'),'allowNull':![]},'save_name':{'type':Sequelize[_0xac24('0x1')]},'display_name':{'type':Sequelize['STRING'],'defaultValue':''},'description':{'type':Sequelize[_0xac24('0x1')]},'original_format':{'type':Sequelize['STRING']},'original_duration':{'type':Sequelize[_0xac24('0x3')]},'original_sampleCount':{'type':Sequelize[_0xac24('0x4')]},'original_channelCount':{'type':Sequelize[_0xac24('0x5')]},'original_bitRate':{'type':Sequelize['BIGINT']},'original_sampleRate':{'type':Sequelize['INTEGER']},'converted_format':{'type':Sequelize[_0xac24('0x1')]},'converted_duration':{'type':Sequelize[_0xac24('0x3')]},'converted_sampleCount':{'type':Sequelize['BIGINT']},'converted_channelCount':{'type':Sequelize['INTEGER']},'converted_bitRate':{'type':Sequelize['BIGINT']},'converted_sampleRate':{'type':Sequelize[_0xac24('0x5')]}}; \ No newline at end of file diff --git a/server/api/sound/sound.controller.js b/server/api/sound/sound.controller.js index 71d853f..9b8e885 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 _0x3ccc=['intersection','fields','attributes','hasOwnProperty','nolimit','sort','pick','filter','where','merge','VIRTUAL','options','count','includeAll','include','findAll','rows','catch','show','params','length','find','save_name','join','server/files/sounds/converted','Sequelize','ValidationError','Sound\x20not\x20found','download','root','format','%s.%s','converted_format','file','extname','originalname','basename','filename','server/files/sounds/original','info','Sound\x20upload\x20filepath:\x20%s','chmodSync','0777','transcode','unlinkSync','duration','original_sampleCount','sampleCount','channelCount','original_bitRate','bitRate','original_sampleRate','sampleRate','dest','converted_duration','converted_sampleCount','converted_channelCount','converted_bitRate','converted_sampleRate','create','body','userProfileId','role','user','UserProfileSection','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','start','delete','original_format','html-pdf','eml-format','rimraf','fast-json-patch','moment','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','../../components/auth/service','../../config/logger','api','../../config/utils','../../config/environment','sendStatus','end','status','offset','limit','set','Content-Range','apply','reject','update','then','destroy','get','Sounds','UserProfileResource','error','stack','name','send','index','Sound','rawAttributes','fieldName','type','key','model','map','query','keys','filters'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x3ccc,0x13a));var _0xc3cc=function(_0x49fa22,_0x3a8ccb){_0x49fa22=_0x49fa22-0x0;var _0x4af7a1=_0x3ccc[_0x49fa22];return _0x4af7a1;};'use strict';var pdf=require(_0xc3cc('0x0'));var emlformat=require(_0xc3cc('0x1'));var rimraf=require(_0xc3cc('0x2'));var zipdir=require('zip-dir');var jsonpatch=require(_0xc3cc('0x3'));var rp=require('request-promise');var moment=require(_0xc3cc('0x4'));var BPromise=require('bluebird');var Mustache=require(_0xc3cc('0x5'));var util=require(_0xc3cc('0x6'));var path=require(_0xc3cc('0x7'));var sox=require(_0xc3cc('0x8'));var csv=require(_0xc3cc('0x9'));var ejs=require(_0xc3cc('0xa'));var fs=require('fs');var _=require(_0xc3cc('0xb'));var squel=require(_0xc3cc('0xc'));var crypto=require(_0xc3cc('0xd'));var jsforce=require(_0xc3cc('0xe'));var deskjs=require(_0xc3cc('0xf'));var toCsv=require(_0xc3cc('0x9'));var querystring=require(_0xc3cc('0x10'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0xc3cc('0x11'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0xc3cc('0x12'))(_0xc3cc('0x13'));var utils=require(_0xc3cc('0x14'));var config=require(_0xc3cc('0x15'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x2dea36,_0x47f3cc){_0x47f3cc=_0x47f3cc||0xcc;return function(_0x2d1fc7){if(_0x2d1fc7){return _0x2dea36[_0xc3cc('0x16')](_0x47f3cc);}return _0x2dea36['status'](_0x47f3cc)[_0xc3cc('0x17')]();};}function respondWithResult(_0x2774c2,_0x112b71){_0x112b71=_0x112b71||0xc8;return function(_0x2e5061){if(_0x2e5061){return _0x2774c2[_0xc3cc('0x18')](_0x112b71)['json'](_0x2e5061);}};}function respondWithFilteredResult(_0x2c65e1,_0x3b3490){return function(_0x45674f){if(_0x45674f){var _0x35cb59=_0x45674f['count'],_0x5cb368=_0x3b3490[_0xc3cc('0x19')],_0xcf7fbc=_0x3b3490[_0xc3cc('0x19')]+_0x3b3490[_0xc3cc('0x1a')],_0x5e6350;if(_0xcf7fbc>=_0x35cb59){_0xcf7fbc=_0x35cb59;_0x5e6350=0xc8;}else{_0x5e6350=0xce;}_0x2c65e1['status'](_0x5e6350);return _0x2c65e1[_0xc3cc('0x1b')](_0xc3cc('0x1c'),_0x5cb368+'-'+_0xcf7fbc+'/'+_0x35cb59)['json'](_0x45674f);}return null;};}function patchUpdates(_0x16064d){return function(_0x4bcd50){try{jsonpatch[_0xc3cc('0x1d')](_0x4bcd50,_0x16064d,!![]);}catch(_0x20001e){return BPromise[_0xc3cc('0x1e')](_0x20001e);}return _0x4bcd50['save']();};}function saveUpdates(_0x3e27e4,_0x574434){return function(_0x5e0f96){if(_0x5e0f96){return _0x5e0f96[_0xc3cc('0x1f')](_0x3e27e4)[_0xc3cc('0x20')](function(_0x29a853){return _0x29a853;});}return null;};}function removeEntity(_0xeaa50,_0x377f73){return function(_0x3642c1){if(_0x3642c1){return _0x3642c1[_0xc3cc('0x21')]()[_0xc3cc('0x20')](function(){var _0x5b2e2e=_0x3642c1[_0xc3cc('0x22')]({'plain':!![]});var _0x53b2af=_0xc3cc('0x23');return db[_0xc3cc('0x24')][_0xc3cc('0x21')]({'where':{'type':_0x53b2af,'resourceId':_0x5b2e2e['id']}})['then'](function(){return _0x3642c1;});})['then'](function(){_0xeaa50['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x3b40c4,_0x2acd72){return function(_0x4672a2){if(!_0x4672a2){_0x3b40c4[_0xc3cc('0x16')](0x194);}return _0x4672a2;};}function handleError(_0x15d5d7,_0x3ea367){_0x3ea367=_0x3ea367||0x1f4;return function(_0x2dc465){logger[_0xc3cc('0x25')](_0x2dc465[_0xc3cc('0x26')]);if(_0x2dc465[_0xc3cc('0x27')]){delete _0x2dc465[_0xc3cc('0x27')];}_0x15d5d7['status'](_0x3ea367)[_0xc3cc('0x28')](_0x2dc465);};}exports[_0xc3cc('0x29')]=function(_0xf5ac1a,_0x5bdf29){var _0x1cb28d={},_0x49a449={},_0x3e74a0={'count':0x0,'rows':[]};var _0x561f4c=_['map'](db[_0xc3cc('0x2a')][_0xc3cc('0x2b')],function(_0x6116a7){return{'name':_0x6116a7[_0xc3cc('0x2c')],'type':_0x6116a7[_0xc3cc('0x2d')][_0xc3cc('0x2e')]};});_0x49a449[_0xc3cc('0x2f')]=_[_0xc3cc('0x30')](_0x561f4c,_0xc3cc('0x27'));_0x49a449[_0xc3cc('0x31')]=_[_0xc3cc('0x32')](_0xf5ac1a[_0xc3cc('0x31')]);_0x49a449[_0xc3cc('0x33')]=_[_0xc3cc('0x34')](_0x49a449[_0xc3cc('0x2f')],_0x49a449['query']);_0x1cb28d['attributes']=_['intersection'](_0x49a449[_0xc3cc('0x2f')],qs[_0xc3cc('0x35')](_0xf5ac1a['query']['fields']));_0x1cb28d[_0xc3cc('0x36')]=_0x1cb28d[_0xc3cc('0x36')]['length']?_0x1cb28d[_0xc3cc('0x36')]:_0x49a449[_0xc3cc('0x2f')];if(!_0xf5ac1a['query'][_0xc3cc('0x37')](_0xc3cc('0x38'))){_0x1cb28d[_0xc3cc('0x1a')]=qs[_0xc3cc('0x1a')](_0xf5ac1a['query'][_0xc3cc('0x1a')]);_0x1cb28d[_0xc3cc('0x19')]=qs[_0xc3cc('0x19')](_0xf5ac1a[_0xc3cc('0x31')][_0xc3cc('0x19')]);}_0x1cb28d['order']=qs['sort'](_0xf5ac1a[_0xc3cc('0x31')][_0xc3cc('0x39')]);_0x1cb28d['where']=qs['filters'](_[_0xc3cc('0x3a')](_0xf5ac1a['query'],_0x49a449[_0xc3cc('0x33')]));if(_0xf5ac1a[_0xc3cc('0x31')][_0xc3cc('0x3b')]){_0x1cb28d[_0xc3cc('0x3c')]=_[_0xc3cc('0x3d')](_0x1cb28d[_0xc3cc('0x3c')],{'$or':_[_0xc3cc('0x30')](_0x561f4c,function(_0x22d529){if(_0x22d529[_0xc3cc('0x2d')]!==_0xc3cc('0x3e')){var _0x20fcc8={};_0x20fcc8[_0x22d529['name']]={'$like':'%'+_0xf5ac1a['query']['filter']+'%'};return _0x20fcc8;}})});}_0x1cb28d=_[_0xc3cc('0x3d')]({},_0x1cb28d,_0xf5ac1a[_0xc3cc('0x3f')]);var _0x121aa6={'where':_0x1cb28d[_0xc3cc('0x3c')]};return db[_0xc3cc('0x2a')][_0xc3cc('0x40')](_0x121aa6)[_0xc3cc('0x20')](function(_0x4d797a){_0x3e74a0[_0xc3cc('0x40')]=_0x4d797a;if(_0xf5ac1a[_0xc3cc('0x31')][_0xc3cc('0x41')]){_0x1cb28d[_0xc3cc('0x42')]=[{'all':!![]}];}return db[_0xc3cc('0x2a')][_0xc3cc('0x43')](_0x1cb28d);})[_0xc3cc('0x20')](function(_0x369f0e){_0x3e74a0[_0xc3cc('0x44')]=_0x369f0e;return _0x3e74a0;})[_0xc3cc('0x20')](respondWithFilteredResult(_0x5bdf29,_0x1cb28d))[_0xc3cc('0x45')](handleError(_0x5bdf29,null));};exports[_0xc3cc('0x46')]=function(_0x5b2268,_0x4fcd11){var _0x4fb592={'raw':!![],'where':{'id':_0x5b2268[_0xc3cc('0x47')]['id']}},_0xc6b9de={};_0xc6b9de[_0xc3cc('0x2f')]=_[_0xc3cc('0x32')](db[_0xc3cc('0x2a')][_0xc3cc('0x2b')]);_0xc6b9de[_0xc3cc('0x31')]=_[_0xc3cc('0x32')](_0x5b2268['query']);_0xc6b9de[_0xc3cc('0x33')]=_[_0xc3cc('0x34')](_0xc6b9de[_0xc3cc('0x2f')],_0xc6b9de[_0xc3cc('0x31')]);_0x4fb592[_0xc3cc('0x36')]=_[_0xc3cc('0x34')](_0xc6b9de['model'],qs['fields'](_0x5b2268['query'][_0xc3cc('0x35')]));_0x4fb592[_0xc3cc('0x36')]=_0x4fb592['attributes'][_0xc3cc('0x48')]?_0x4fb592[_0xc3cc('0x36')]:_0xc6b9de[_0xc3cc('0x2f')];if(_0x5b2268[_0xc3cc('0x31')][_0xc3cc('0x41')]){_0x4fb592[_0xc3cc('0x42')]=[{'all':!![]}];}_0x4fb592=_[_0xc3cc('0x3d')]({},_0x4fb592,_0x5b2268[_0xc3cc('0x3f')]);return db['Sound']['find'](_0x4fb592)['then'](handleEntityNotFound(_0x4fcd11,null))['then'](respondWithResult(_0x4fcd11,null))['catch'](handleError(_0x4fcd11,null));};exports['download']=function(_0x17f324,_0x19ae9c,_0xd5e5e2){return db[_0xc3cc('0x2a')][_0xc3cc('0x49')]({'where':{'id':_0x17f324[_0xc3cc('0x47')]['id']},'attributes':[_0xc3cc('0x27'),_0xc3cc('0x4a'),'converted_format'],'raw':!![]})[_0xc3cc('0x20')](handleEntityNotFound(_0x19ae9c,null))['then'](function(_0x383314){if(_0x383314){if(!fs['existsSync'](path[_0xc3cc('0x4b')](config['root'],_0xc3cc('0x4c'),_0x383314[_0xc3cc('0x4a')]+'.'+_0x383314['converted_format']))){throw new db[(_0xc3cc('0x4d'))][(_0xc3cc('0x4e'))](_0xc3cc('0x4f'));}return _0x19ae9c[_0xc3cc('0x50')](path[_0xc3cc('0x4b')](config[_0xc3cc('0x51')],_0xc3cc('0x4c'),util[_0xc3cc('0x52')](_0xc3cc('0x53'),_0x383314['save_name'],_0x383314['converted_format'])),util[_0xc3cc('0x52')](_0xc3cc('0x53'),_0x383314[_0xc3cc('0x27')],_0x383314[_0xc3cc('0x54')]));}return null;})[_0xc3cc('0x45')](handleError(_0x19ae9c,null));};exports['create']=function(_0x12a5af,_0x238444,_0x3803c4){var _0x18f801={'name':path['basename'](_0x12a5af[_0xc3cc('0x55')]['originalname'],path[_0xc3cc('0x56')](_0x12a5af['file'][_0xc3cc('0x57')])),'save_name':path[_0xc3cc('0x58')](_0x12a5af[_0xc3cc('0x55')][_0xc3cc('0x59')],path[_0xc3cc('0x56')](_0x12a5af[_0xc3cc('0x55')][_0xc3cc('0x59')])),'original_format':path[_0xc3cc('0x56')](_0x12a5af[_0xc3cc('0x55')][_0xc3cc('0x57')])['substring'](0x1),'converted_format':'wav'};var _0x3a4794=path[_0xc3cc('0x4b')](config[_0xc3cc('0x51')],_0xc3cc('0x5a'),_0x12a5af[_0xc3cc('0x55')][_0xc3cc('0x59')]);var _0xb420ce=path[_0xc3cc('0x4b')](config['root'],_0xc3cc('0x4c'),util[_0xc3cc('0x52')](_0xc3cc('0x53'),path[_0xc3cc('0x58')](_0x12a5af['file'][_0xc3cc('0x59')],path[_0xc3cc('0x56')](_0x12a5af['file'][_0xc3cc('0x59')])),_0x18f801[_0xc3cc('0x54')]));logger[_0xc3cc('0x5b')](_0xc3cc('0x5c'),_0x3a4794);logger[_0xc3cc('0x5b')]('Sound\x20upload\x20destination:\x20%s',_0xb420ce);try{fs[_0xc3cc('0x5d')](_0x3a4794,parseInt(_0xc3cc('0x5e'),0x8));var _0x374fd8=sox[_0xc3cc('0x5f')](_0x3a4794,_0xb420ce,{'sampleRate':0x1f40,'format':'wav','channelCount':0x1,'bitRate':0xc0*0x400,'compressionQuality':0x5});_0x374fd8['on'](_0xc3cc('0x25'),function(_0x2a556d){fs[_0xc3cc('0x60')](_0x3a4794);_0x238444[_0xc3cc('0x18')](0x1f4)['send'](_0x2a556d);});_0x374fd8['on']('src',function(_0xf4f05b){_0x18f801['original_duration']=isNaN(_0xf4f05b[_0xc3cc('0x61')])?null:_0xf4f05b[_0xc3cc('0x61')]*0x3e8;_0x18f801[_0xc3cc('0x62')]=isNaN(_0xf4f05b['sampleCount'])?null:_0xf4f05b[_0xc3cc('0x63')];_0x18f801['original_channelCount']=isNaN(_0xf4f05b[_0xc3cc('0x64')])?null:_0xf4f05b[_0xc3cc('0x64')];_0x18f801[_0xc3cc('0x65')]=isNaN(_0xf4f05b[_0xc3cc('0x66')])?null:_0xf4f05b[_0xc3cc('0x66')];_0x18f801[_0xc3cc('0x67')]=isNaN(_0xf4f05b[_0xc3cc('0x68')])?null:_0xf4f05b[_0xc3cc('0x68')];});_0x374fd8['on'](_0xc3cc('0x69'),function(_0xc3916e){_0x18f801[_0xc3cc('0x6a')]=isNaN(_0xc3916e[_0xc3cc('0x61')])?null:_0xc3916e[_0xc3cc('0x61')]*0x3e8;_0x18f801[_0xc3cc('0x6b')]=isNaN(_0xc3916e[_0xc3cc('0x63')])?null:_0xc3916e['sampleCount'];_0x18f801[_0xc3cc('0x6c')]=isNaN(_0xc3916e[_0xc3cc('0x64')])?null:_0xc3916e[_0xc3cc('0x64')];_0x18f801[_0xc3cc('0x6d')]=isNaN(_0xc3916e[_0xc3cc('0x66')])?null:_0xc3916e[_0xc3cc('0x66')];_0x18f801[_0xc3cc('0x6e')]=isNaN(_0xc3916e['sampleRate'])?null:_0xc3916e[_0xc3cc('0x68')];});_0x374fd8['on'](_0xc3cc('0x17'),function(){fs[_0xc3cc('0x5d')](_0xb420ce,parseInt(_0xc3cc('0x5e'),0x8));return db['Sound'][_0xc3cc('0x6f')](_0x18f801)[_0xc3cc('0x20')](function(_0x599586){var _0xeabf16={'role':_0x12a5af[_0xc3cc('0x70')]['role'],'userProfileId':_0x12a5af[_0xc3cc('0x70')][_0xc3cc('0x71')]};if(!_0xeabf16)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0xeabf16[_0xc3cc('0x72')]===_0xc3cc('0x73')){var _0x4dccee=_0x599586[_0xc3cc('0x22')]({'plain':!![]});return db[_0xc3cc('0x74')][_0xc3cc('0x49')]({'where':{'name':'Sounds','userProfileId':_0xeabf16['userProfileId']},'raw':!![]})[_0xc3cc('0x20')](function(_0x3336d0){if(_0x3336d0&&_0x3336d0[_0xc3cc('0x75')]===0x0){return db[_0xc3cc('0x24')][_0xc3cc('0x6f')]({'name':_0x4dccee[_0xc3cc('0x27')],'resourceId':_0x4dccee['id'],'type':_0x3336d0['name'],'sectionId':_0x3336d0['id']},{})[_0xc3cc('0x20')](function(){return _0x599586;});}else{return _0x599586;}})[_0xc3cc('0x45')](function(_0x1378e3){logger[_0xc3cc('0x25')](_0xc3cc('0x76'),_0x1378e3);throw _0x1378e3;});}return _0x599586;})[_0xc3cc('0x20')](respondWithResult(_0x238444,null))[_0xc3cc('0x45')](handleError(_0x238444,null));});_0x374fd8[_0xc3cc('0x77')]();}catch(_0x20aa72){_0x238444['status'](0x1f4)['send'](_0x20aa72);}};exports[_0xc3cc('0x1f')]=function(_0x5544c4,_0x30e3ff,_0x3a7e69){return db['Sound']['find']({'where':{'id':_0x5544c4[_0xc3cc('0x47')]['id']}})[_0xc3cc('0x20')](handleEntityNotFound(_0x30e3ff,null))['then'](saveUpdates(_['pick'](_0x5544c4[_0xc3cc('0x70')],['name','description']),null))[_0xc3cc('0x20')](respondWithResult(_0x30e3ff,null))['catch'](handleError(_0x30e3ff,null));};exports[_0xc3cc('0x78')]=function(_0x3b5fae,_0x3d9215,_0x594bec){return db[_0xc3cc('0x2a')]['find']({'where':{'id':_0x3b5fae[_0xc3cc('0x47')]['id']}})[_0xc3cc('0x20')](function(_0xd16cfd){if(_0xd16cfd){return _0xd16cfd['destroy']();}})['then'](function(_0x54718b){var _0x4c8315=path['join'](config[_0xc3cc('0x51')],'server/files/sounds/original',util['format'](_0xc3cc('0x53'),_0x54718b[_0xc3cc('0x4a')],_0x54718b[_0xc3cc('0x79')]));var _0x5335fc=path[_0xc3cc('0x4b')](config[_0xc3cc('0x51')],_0xc3cc('0x4c'),util['format'](_0xc3cc('0x53'),_0x54718b[_0xc3cc('0x4a')],_0x54718b[_0xc3cc('0x54')]));fs['unlinkSync'](_0x4c8315);fs['unlinkSync'](_0x5335fc);return _0x54718b;})['then'](function(_0x5a6e7b){if(_0x5a6e7b){return _0x3d9215[_0xc3cc('0x18')](0xcc)['end']();}})[_0xc3cc('0x20')](handleEntityNotFound(_0x3d9215,null))['catch'](handleError(_0x3d9215,null));}; \ No newline at end of file +var _0xd1e7=['extname','file','filename','substring','wav','server/files/sounds/original','info','Sound\x20upload\x20filepath:\x20%s','chmodSync','0777','transcode','original_duration','duration','original_sampleCount','sampleCount','original_channelCount','channelCount','original_bitRate','bitRate','original_sampleRate','sampleRate','converted_duration','converted_channelCount','converted_bitRate','converted_sampleRate','role','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','start','delete','original_format','unlinkSync','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','to-csv','lodash','squel','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','offset','limit','json','apply','reject','then','destroy','get','Sounds','UserProfileResource','error','name','send','index','Sound','rawAttributes','fieldName','type','model','query','intersection','attributes','fields','length','nolimit','order','sort','filters','pick','filter','merge','where','map','VIRTUAL','options','count','includeAll','include','findAll','catch','show','params','keys','find','save_name','converted_format','existsSync','join','root','ValidationError','download','server/files/sounds/converted','%s.%s','format','create','basename','originalname'];(function(_0xc0f3d0,_0x4cfe98){var _0x1798ba=function(_0xa3446d){while(--_0xa3446d){_0xc0f3d0['push'](_0xc0f3d0['shift']());}};_0x1798ba(++_0x4cfe98);}(_0xd1e7,0x18a));var _0x7d1e=function(_0x50eed0,_0x36041f){_0x50eed0=_0x50eed0-0x0;var _0x2bf269=_0xd1e7[_0x50eed0];return _0x2bf269;};'use strict';var pdf=require(_0x7d1e('0x0'));var emlformat=require(_0x7d1e('0x1'));var rimraf=require(_0x7d1e('0x2'));var zipdir=require(_0x7d1e('0x3'));var jsonpatch=require(_0x7d1e('0x4'));var rp=require(_0x7d1e('0x5'));var moment=require(_0x7d1e('0x6'));var BPromise=require(_0x7d1e('0x7'));var Mustache=require(_0x7d1e('0x8'));var util=require(_0x7d1e('0x9'));var path=require('path');var sox=require('sox');var csv=require(_0x7d1e('0xa'));var ejs=require('ejs');var fs=require('fs');var _=require(_0x7d1e('0xb'));var squel=require(_0x7d1e('0xc'));var crypto=require('crypto');var jsforce=require(_0x7d1e('0xd'));var deskjs=require(_0x7d1e('0xe'));var toCsv=require('to-csv');var querystring=require(_0x7d1e('0xf'));var Papa=require('papaparse');var Redis=require(_0x7d1e('0x10'));var authService=require(_0x7d1e('0x11'));var qs=require(_0x7d1e('0x12'));var as=require(_0x7d1e('0x13'));var hardwareService=require(_0x7d1e('0x14'));var logger=require(_0x7d1e('0x15'))(_0x7d1e('0x16'));var utils=require(_0x7d1e('0x17'));var config=require(_0x7d1e('0x18'));var db=require(_0x7d1e('0x19'))['db'];function respondWithStatusCode(_0x2a3b4e,_0x293443){_0x293443=_0x293443||0xcc;return function(_0x583854){if(_0x583854){return _0x2a3b4e[_0x7d1e('0x1a')](_0x293443);}return _0x2a3b4e[_0x7d1e('0x1b')](_0x293443)[_0x7d1e('0x1c')]();};}function respondWithResult(_0x1c4488,_0x7a3ec5){_0x7a3ec5=_0x7a3ec5||0xc8;return function(_0x3304c2){if(_0x3304c2){return _0x1c4488[_0x7d1e('0x1b')](_0x7a3ec5)['json'](_0x3304c2);}};}function respondWithFilteredResult(_0x2ec4a1,_0x2024a0){return function(_0x39a2e8){if(_0x39a2e8){var _0x887ad1=_0x39a2e8['count'],_0x62092c=_0x2024a0[_0x7d1e('0x1d')],_0x301060=_0x2024a0['offset']+_0x2024a0[_0x7d1e('0x1e')],_0x4bd1c7;if(_0x301060>=_0x887ad1){_0x301060=_0x887ad1;_0x4bd1c7=0xc8;}else{_0x4bd1c7=0xce;}_0x2ec4a1[_0x7d1e('0x1b')](_0x4bd1c7);return _0x2ec4a1['set']('Content-Range',_0x62092c+'-'+_0x301060+'/'+_0x887ad1)[_0x7d1e('0x1f')](_0x39a2e8);}return null;};}function patchUpdates(_0x38783e){return function(_0x5c74c0){try{jsonpatch[_0x7d1e('0x20')](_0x5c74c0,_0x38783e,!![]);}catch(_0x1c86f3){return BPromise[_0x7d1e('0x21')](_0x1c86f3);}return _0x5c74c0['save']();};}function saveUpdates(_0xd7fab8,_0x33aa22){return function(_0x4c9aeb){if(_0x4c9aeb){return _0x4c9aeb['update'](_0xd7fab8)[_0x7d1e('0x22')](function(_0x4e6aa9){return _0x4e6aa9;});}return null;};}function removeEntity(_0x7be2c6,_0x5c489d){return function(_0x3e6434){if(_0x3e6434){return _0x3e6434[_0x7d1e('0x23')]()[_0x7d1e('0x22')](function(){var _0x1c3786=_0x3e6434[_0x7d1e('0x24')]({'plain':!![]});var _0x2f535e=_0x7d1e('0x25');return db[_0x7d1e('0x26')][_0x7d1e('0x23')]({'where':{'type':_0x2f535e,'resourceId':_0x1c3786['id']}})[_0x7d1e('0x22')](function(){return _0x3e6434;});})[_0x7d1e('0x22')](function(){_0x7be2c6[_0x7d1e('0x1b')](0xcc)['end']();});}};}function handleEntityNotFound(_0x4e8c01,_0x1b49dd){return function(_0x9a5ebc){if(!_0x9a5ebc){_0x4e8c01['sendStatus'](0x194);}return _0x9a5ebc;};}function handleError(_0x4f8342,_0x3afc74){_0x3afc74=_0x3afc74||0x1f4;return function(_0xc5d949){logger[_0x7d1e('0x27')](_0xc5d949['stack']);if(_0xc5d949[_0x7d1e('0x28')]){delete _0xc5d949[_0x7d1e('0x28')];}_0x4f8342[_0x7d1e('0x1b')](_0x3afc74)[_0x7d1e('0x29')](_0xc5d949);};}exports[_0x7d1e('0x2a')]=function(_0x318ec4,_0x5bfc5e){var _0x5160d7={},_0x1dd091={},_0x5e2921={'count':0x0,'rows':[]};var _0x575695=_['map'](db[_0x7d1e('0x2b')][_0x7d1e('0x2c')],function(_0x14b056){return{'name':_0x14b056[_0x7d1e('0x2d')],'type':_0x14b056[_0x7d1e('0x2e')]['key']};});_0x1dd091[_0x7d1e('0x2f')]=_['map'](_0x575695,_0x7d1e('0x28'));_0x1dd091[_0x7d1e('0x30')]=_['keys'](_0x318ec4[_0x7d1e('0x30')]);_0x1dd091['filters']=_[_0x7d1e('0x31')](_0x1dd091[_0x7d1e('0x2f')],_0x1dd091['query']);_0x5160d7[_0x7d1e('0x32')]=_[_0x7d1e('0x31')](_0x1dd091[_0x7d1e('0x2f')],qs[_0x7d1e('0x33')](_0x318ec4[_0x7d1e('0x30')][_0x7d1e('0x33')]));_0x5160d7['attributes']=_0x5160d7[_0x7d1e('0x32')][_0x7d1e('0x34')]?_0x5160d7[_0x7d1e('0x32')]:_0x1dd091[_0x7d1e('0x2f')];if(!_0x318ec4[_0x7d1e('0x30')]['hasOwnProperty'](_0x7d1e('0x35'))){_0x5160d7[_0x7d1e('0x1e')]=qs[_0x7d1e('0x1e')](_0x318ec4[_0x7d1e('0x30')][_0x7d1e('0x1e')]);_0x5160d7[_0x7d1e('0x1d')]=qs[_0x7d1e('0x1d')](_0x318ec4[_0x7d1e('0x30')][_0x7d1e('0x1d')]);}_0x5160d7[_0x7d1e('0x36')]=qs[_0x7d1e('0x37')](_0x318ec4['query']['sort']);_0x5160d7['where']=qs[_0x7d1e('0x38')](_[_0x7d1e('0x39')](_0x318ec4[_0x7d1e('0x30')],_0x1dd091[_0x7d1e('0x38')]));if(_0x318ec4[_0x7d1e('0x30')][_0x7d1e('0x3a')]){_0x5160d7['where']=_[_0x7d1e('0x3b')](_0x5160d7[_0x7d1e('0x3c')],{'$or':_[_0x7d1e('0x3d')](_0x575695,function(_0x160301){if(_0x160301[_0x7d1e('0x2e')]!==_0x7d1e('0x3e')){var _0xa283f={};_0xa283f[_0x160301['name']]={'$like':'%'+_0x318ec4[_0x7d1e('0x30')][_0x7d1e('0x3a')]+'%'};return _0xa283f;}})});}_0x5160d7=_[_0x7d1e('0x3b')]({},_0x5160d7,_0x318ec4[_0x7d1e('0x3f')]);var _0x234b1a={'where':_0x5160d7[_0x7d1e('0x3c')]};return db[_0x7d1e('0x2b')]['count'](_0x234b1a)[_0x7d1e('0x22')](function(_0x898e11){_0x5e2921[_0x7d1e('0x40')]=_0x898e11;if(_0x318ec4[_0x7d1e('0x30')][_0x7d1e('0x41')]){_0x5160d7[_0x7d1e('0x42')]=[{'all':!![]}];}return db[_0x7d1e('0x2b')][_0x7d1e('0x43')](_0x5160d7);})['then'](function(_0x4a5186){_0x5e2921['rows']=_0x4a5186;return _0x5e2921;})[_0x7d1e('0x22')](respondWithFilteredResult(_0x5bfc5e,_0x5160d7))[_0x7d1e('0x44')](handleError(_0x5bfc5e,null));};exports[_0x7d1e('0x45')]=function(_0x3614b8,_0x18d15e){var _0x58429e={'raw':!![],'where':{'id':_0x3614b8[_0x7d1e('0x46')]['id']}},_0x4f3c77={};_0x4f3c77['model']=_[_0x7d1e('0x47')](db['Sound'][_0x7d1e('0x2c')]);_0x4f3c77[_0x7d1e('0x30')]=_[_0x7d1e('0x47')](_0x3614b8[_0x7d1e('0x30')]);_0x4f3c77[_0x7d1e('0x38')]=_['intersection'](_0x4f3c77['model'],_0x4f3c77[_0x7d1e('0x30')]);_0x58429e[_0x7d1e('0x32')]=_[_0x7d1e('0x31')](_0x4f3c77[_0x7d1e('0x2f')],qs[_0x7d1e('0x33')](_0x3614b8[_0x7d1e('0x30')][_0x7d1e('0x33')]));_0x58429e[_0x7d1e('0x32')]=_0x58429e[_0x7d1e('0x32')][_0x7d1e('0x34')]?_0x58429e[_0x7d1e('0x32')]:_0x4f3c77[_0x7d1e('0x2f')];if(_0x3614b8[_0x7d1e('0x30')][_0x7d1e('0x41')]){_0x58429e[_0x7d1e('0x42')]=[{'all':!![]}];}_0x58429e=_[_0x7d1e('0x3b')]({},_0x58429e,_0x3614b8['options']);return db[_0x7d1e('0x2b')][_0x7d1e('0x48')](_0x58429e)['then'](handleEntityNotFound(_0x18d15e,null))[_0x7d1e('0x22')](respondWithResult(_0x18d15e,null))['catch'](handleError(_0x18d15e,null));};exports['download']=function(_0x320b50,_0x2126fd,_0xa0839f){return db[_0x7d1e('0x2b')][_0x7d1e('0x48')]({'where':{'id':_0x320b50[_0x7d1e('0x46')]['id']},'attributes':['name',_0x7d1e('0x49'),_0x7d1e('0x4a')],'raw':!![]})[_0x7d1e('0x22')](handleEntityNotFound(_0x2126fd,null))[_0x7d1e('0x22')](function(_0x9acb7e){if(_0x9acb7e){if(!fs[_0x7d1e('0x4b')](path[_0x7d1e('0x4c')](config[_0x7d1e('0x4d')],'server/files/sounds/converted',_0x9acb7e['save_name']+'.'+_0x9acb7e['converted_format']))){throw new db['Sequelize'][(_0x7d1e('0x4e'))]('Sound\x20not\x20found');}return _0x2126fd[_0x7d1e('0x4f')](path[_0x7d1e('0x4c')](config[_0x7d1e('0x4d')],_0x7d1e('0x50'),util['format'](_0x7d1e('0x51'),_0x9acb7e[_0x7d1e('0x49')],_0x9acb7e['converted_format'])),util[_0x7d1e('0x52')](_0x7d1e('0x51'),_0x9acb7e[_0x7d1e('0x28')],_0x9acb7e[_0x7d1e('0x4a')]));}return null;})[_0x7d1e('0x44')](handleError(_0x2126fd,null));};exports[_0x7d1e('0x53')]=function(_0x36220b,_0x1860c5,_0x3dc2a4){var _0x149320={'name':path[_0x7d1e('0x54')](_0x36220b['file'][_0x7d1e('0x55')],path[_0x7d1e('0x56')](_0x36220b[_0x7d1e('0x57')]['originalname'])),'save_name':path[_0x7d1e('0x54')](_0x36220b['file'][_0x7d1e('0x58')],path[_0x7d1e('0x56')](_0x36220b[_0x7d1e('0x57')][_0x7d1e('0x58')])),'original_format':path[_0x7d1e('0x56')](_0x36220b['file'][_0x7d1e('0x55')])[_0x7d1e('0x59')](0x1),'converted_format':_0x7d1e('0x5a')};var _0x5be727=path[_0x7d1e('0x4c')](config[_0x7d1e('0x4d')],_0x7d1e('0x5b'),_0x36220b['file'][_0x7d1e('0x58')]);var _0x1fd19b=path[_0x7d1e('0x4c')](config[_0x7d1e('0x4d')],'server/files/sounds/converted',util[_0x7d1e('0x52')]('%s.%s',path[_0x7d1e('0x54')](_0x36220b[_0x7d1e('0x57')][_0x7d1e('0x58')],path['extname'](_0x36220b[_0x7d1e('0x57')][_0x7d1e('0x58')])),_0x149320[_0x7d1e('0x4a')]));logger[_0x7d1e('0x5c')](_0x7d1e('0x5d'),_0x5be727);logger['info']('Sound\x20upload\x20destination:\x20%s',_0x1fd19b);try{fs[_0x7d1e('0x5e')](_0x5be727,parseInt(_0x7d1e('0x5f'),0x8));var _0x23e168=sox[_0x7d1e('0x60')](_0x5be727,_0x1fd19b,{'sampleRate':0x1f40,'format':_0x7d1e('0x5a'),'channelCount':0x1,'bitRate':0xc0*0x400,'compressionQuality':0x5});_0x23e168['on'](_0x7d1e('0x27'),function(_0x387c8f){fs['unlinkSync'](_0x5be727);_0x1860c5[_0x7d1e('0x1b')](0x1f4)[_0x7d1e('0x29')](_0x387c8f);});_0x23e168['on']('src',function(_0x3ebd37){_0x149320[_0x7d1e('0x61')]=isNaN(_0x3ebd37[_0x7d1e('0x62')])?null:_0x3ebd37[_0x7d1e('0x62')]*0x3e8;_0x149320[_0x7d1e('0x63')]=isNaN(_0x3ebd37[_0x7d1e('0x64')])?null:_0x3ebd37['sampleCount'];_0x149320[_0x7d1e('0x65')]=isNaN(_0x3ebd37[_0x7d1e('0x66')])?null:_0x3ebd37['channelCount'];_0x149320[_0x7d1e('0x67')]=isNaN(_0x3ebd37[_0x7d1e('0x68')])?null:_0x3ebd37[_0x7d1e('0x68')];_0x149320[_0x7d1e('0x69')]=isNaN(_0x3ebd37[_0x7d1e('0x6a')])?null:_0x3ebd37['sampleRate'];});_0x23e168['on']('dest',function(_0x1b769f){_0x149320[_0x7d1e('0x6b')]=isNaN(_0x1b769f[_0x7d1e('0x62')])?null:_0x1b769f['duration']*0x3e8;_0x149320['converted_sampleCount']=isNaN(_0x1b769f['sampleCount'])?null:_0x1b769f[_0x7d1e('0x64')];_0x149320[_0x7d1e('0x6c')]=isNaN(_0x1b769f['channelCount'])?null:_0x1b769f['channelCount'];_0x149320[_0x7d1e('0x6d')]=isNaN(_0x1b769f[_0x7d1e('0x68')])?null:_0x1b769f[_0x7d1e('0x68')];_0x149320[_0x7d1e('0x6e')]=isNaN(_0x1b769f[_0x7d1e('0x6a')])?null:_0x1b769f[_0x7d1e('0x6a')];});_0x23e168['on']('end',function(){fs[_0x7d1e('0x5e')](_0x1fd19b,parseInt(_0x7d1e('0x5f'),0x8));return db[_0x7d1e('0x2b')]['create'](_0x149320)[_0x7d1e('0x22')](function(_0x20c83e){var _0x1cd37b={'role':_0x36220b['body'][_0x7d1e('0x6f')],'userProfileId':_0x36220b['body']['userProfileId']};if(!_0x1cd37b)throw new Error(_0x7d1e('0x70'));if(_0x1cd37b['role']==='user'){var _0x5f09be=_0x20c83e[_0x7d1e('0x24')]({'plain':!![]});return db[_0x7d1e('0x71')][_0x7d1e('0x48')]({'where':{'name':_0x7d1e('0x25'),'userProfileId':_0x1cd37b[_0x7d1e('0x72')]},'raw':!![]})['then'](function(_0x221209){if(_0x221209&&_0x221209['autoAssociation']===0x0){return db[_0x7d1e('0x26')][_0x7d1e('0x53')]({'name':_0x5f09be[_0x7d1e('0x28')],'resourceId':_0x5f09be['id'],'type':_0x221209[_0x7d1e('0x28')],'sectionId':_0x221209['id']},{})[_0x7d1e('0x22')](function(){return _0x20c83e;});}else{return _0x20c83e;}})[_0x7d1e('0x44')](function(_0x3226d8){logger[_0x7d1e('0x27')](_0x7d1e('0x73'),_0x3226d8);throw _0x3226d8;});}return _0x20c83e;})[_0x7d1e('0x22')](respondWithResult(_0x1860c5,null))[_0x7d1e('0x44')](handleError(_0x1860c5,null));});_0x23e168[_0x7d1e('0x74')]();}catch(_0x3d15b0){_0x1860c5[_0x7d1e('0x1b')](0x1f4)[_0x7d1e('0x29')](_0x3d15b0);}};exports['update']=function(_0x3ded15,_0x3edd8d,_0x232e9f){return db[_0x7d1e('0x2b')][_0x7d1e('0x48')]({'where':{'id':_0x3ded15['params']['id']}})[_0x7d1e('0x22')](handleEntityNotFound(_0x3edd8d,null))[_0x7d1e('0x22')](saveUpdates(_[_0x7d1e('0x39')](_0x3ded15['body'],[_0x7d1e('0x28'),'description']),null))[_0x7d1e('0x22')](respondWithResult(_0x3edd8d,null))[_0x7d1e('0x44')](handleError(_0x3edd8d,null));};exports[_0x7d1e('0x75')]=function(_0x1fae29,_0x3bf4ee,_0x2a7e36){return db[_0x7d1e('0x2b')][_0x7d1e('0x48')]({'where':{'id':_0x1fae29['params']['id']}})['then'](function(_0x51db17){if(_0x51db17){return _0x51db17[_0x7d1e('0x23')]();}})[_0x7d1e('0x22')](function(_0x7d6324){var _0x8f57ca=path[_0x7d1e('0x4c')](config[_0x7d1e('0x4d')],_0x7d1e('0x5b'),util[_0x7d1e('0x52')](_0x7d1e('0x51'),_0x7d6324[_0x7d1e('0x49')],_0x7d6324[_0x7d1e('0x76')]));var _0x197160=path['join'](config['root'],_0x7d1e('0x50'),util[_0x7d1e('0x52')](_0x7d1e('0x51'),_0x7d6324[_0x7d1e('0x49')],_0x7d6324[_0x7d1e('0x4a')]));fs[_0x7d1e('0x77')](_0x8f57ca);fs['unlinkSync'](_0x197160);return _0x7d6324;})[_0x7d1e('0x22')](function(_0x45e3f2){if(_0x45e3f2){return _0x3bf4ee['status'](0xcc)[_0x7d1e('0x1c')]();}})[_0x7d1e('0x22')](handleEntityNotFound(_0x3bf4ee,null))[_0x7d1e('0x44')](handleError(_0x3bf4ee,null));}; \ No newline at end of file diff --git a/server/api/sound/sound.model.js b/server/api/sound/sound.model.js index 17e3517..da00506 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 _0x7c18=['./sound.attributes','exports','define','Sound','tools_sounds','lodash','api','moment','bluebird','path','rimraf','../../config/environment'];(function(_0x563512,_0x2f0c90){var _0xf9375c=function(_0x3354b1){while(--_0x3354b1){_0x563512['push'](_0x563512['shift']());}};_0xf9375c(++_0x2f0c90);}(_0x7c18,0x149));var _0x87c1=function(_0x2dafbe,_0x5d04de){_0x2dafbe=_0x2dafbe-0x0;var _0x58a45a=_0x7c18[_0x2dafbe];return _0x58a45a;};'use strict';var _=require(_0x87c1('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x87c1('0x1'));var moment=require(_0x87c1('0x2'));var BPromise=require(_0x87c1('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x87c1('0x4'));var rimraf=require(_0x87c1('0x5'));var config=require(_0x87c1('0x6'));var attributes=require(_0x87c1('0x7'));module[_0x87c1('0x8')]=function(_0x279fb2,_0x50eacc){return _0x279fb2[_0x87c1('0x9')](_0x87c1('0xa'),attributes,{'tableName':_0x87c1('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x4688=['tools_sounds','lodash','util','../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment','exports','define','Sound'];(function(_0x39872b,_0x343e6b){var _0x55fa18=function(_0x217c7f){while(--_0x217c7f){_0x39872b['push'](_0x39872b['shift']());}};_0x55fa18(++_0x343e6b);}(_0x4688,0x187));var _0x8468=function(_0x117f18,_0x43cb2b){_0x117f18=_0x117f18-0x0;var _0x2d04e6=_0x4688[_0x117f18];return _0x2d04e6;};'use strict';var _=require(_0x8468('0x0'));var util=require(_0x8468('0x1'));var logger=require(_0x8468('0x2'))('api');var moment=require(_0x8468('0x3'));var BPromise=require(_0x8468('0x4'));var rp=require(_0x8468('0x5'));var fs=require('fs');var path=require(_0x8468('0x6'));var rimraf=require(_0x8468('0x7'));var config=require(_0x8468('0x8'));var attributes=require('./sound.attributes');module[_0x8468('0x9')]=function(_0x195f9a,_0x49a27d){return _0x195f9a[_0x8468('0xa')](_0x8468('0xb'),attributes,{'tableName':_0x8468('0xc'),'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 0cbc377..f2a4fd4 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 _0x144a=['jayson/promise','client','request','then','Sound,\x20%s,\x20%s','request\x20sent','debug','Sound,\x20%s,\x20%s,\x20%s','stringify','error','message','info','result','catch','Sound','find','options','where','include','model','attributes','map','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc'];(function(_0x21a9d9,_0x4d5ac8){var _0x46adce=function(_0xfdd336){while(--_0xfdd336){_0x21a9d9['push'](_0x21a9d9['shift']());}};_0x46adce(++_0x4d5ac8);}(_0x144a,0x73));var _0xa144=function(_0x554701,_0x571122){_0x554701=_0x554701-0x0;var _0x2775d0=_0x144a[_0x554701];return _0x2775d0;};'use strict';var _=require(_0xa144('0x0'));var util=require(_0xa144('0x1'));var moment=require(_0xa144('0x2'));var BPromise=require(_0xa144('0x3'));var rs=require(_0xa144('0x4'));var fs=require('fs');var Redis=require(_0xa144('0x5'));var db=require(_0xa144('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0xa144('0x7'))(_0xa144('0x8'));var config=require('../../config/environment');var jayson=require(_0xa144('0x9'));var client=jayson[_0xa144('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x40c4ed,_0x58d36c,_0xf51211){return new BPromise(function(_0x567172,_0x45a1da){return client[_0xa144('0xb')](_0x40c4ed,_0xf51211)[_0xa144('0xc')](function(_0x510e60){logger['info'](_0xa144('0xd'),_0x58d36c,_0xa144('0xe'));logger[_0xa144('0xf')](_0xa144('0x10'),_0x58d36c,_0xa144('0xe'),JSON[_0xa144('0x11')](_0x510e60));if(_0x510e60['error']){if(_0x510e60[_0xa144('0x12')]['code']===0x1f4){logger[_0xa144('0x12')](_0xa144('0xd'),_0x58d36c,_0x510e60[_0xa144('0x12')][_0xa144('0x13')]);return _0x45a1da(_0x510e60[_0xa144('0x12')][_0xa144('0x13')]);}logger[_0xa144('0x12')]('Sound,\x20%s,\x20%s',_0x58d36c,_0x510e60['error']['message']);return _0x567172(_0x510e60['error'][_0xa144('0x13')]);}else{logger[_0xa144('0x14')](_0xa144('0xd'),_0x58d36c,_0xa144('0xe'));_0x567172(_0x510e60[_0xa144('0x15')][_0xa144('0x13')]);}})[_0xa144('0x16')](function(_0x520153){logger[_0xa144('0x12')](_0xa144('0xd'),_0x58d36c,_0x520153);_0x45a1da(_0x520153);});});}exports['ShowSound']=function(_0x54526f){var _0x33a845=this;return new Promise(function(_0x30f2cf,_0x54fb83){return db[_0xa144('0x17')][_0xa144('0x18')]({'raw':_0x54526f[_0xa144('0x19')]?_0x54526f[_0xa144('0x19')]['raw']===undefined?!![]:![]:!![],'where':_0x54526f['options']?_0x54526f[_0xa144('0x19')][_0xa144('0x1a')]||null:null,'attributes':_0x54526f[_0xa144('0x19')]?_0x54526f[_0xa144('0x19')]['attributes']||null:null,'include':_0x54526f[_0xa144('0x19')]?_0x54526f[_0xa144('0x19')][_0xa144('0x1b')]?_['map'](_0x54526f[_0xa144('0x19')][_0xa144('0x1b')],function(_0x41bf27){return{'model':db[_0x41bf27[_0xa144('0x1c')]],'as':_0x41bf27['as'],'attributes':_0x41bf27[_0xa144('0x1d')],'include':_0x41bf27[_0xa144('0x1b')]?_[_0xa144('0x1e')](_0x41bf27['include'],function(_0x28150f){return{'model':db[_0x28150f[_0xa144('0x1c')]],'as':_0x28150f['as'],'attributes':_0x28150f[_0xa144('0x1d')],'include':_0x28150f[_0xa144('0x1b')]?_[_0xa144('0x1e')](_0x28150f['include'],function(_0x112b30){return{'model':db[_0x112b30[_0xa144('0x1c')]],'as':_0x112b30['as'],'attributes':_0x112b30[_0xa144('0x1d')]};}):[]};}):[]};}):[]:[]})[_0xa144('0xc')](function(_0x3f62f4){logger[_0xa144('0x14')]('ShowSound',_0x54526f);logger['debug']('ShowSound',_0x54526f,JSON[_0xa144('0x11')](_0x3f62f4));_0x30f2cf(_0x3f62f4);})[_0xa144('0x16')](function(_0x19ad87){logger[_0xa144('0x12')]('ShowSound',_0x19ad87[_0xa144('0x13')],_0x54526f);_0x54fb83(_0x33a845[_0xa144('0x12')](0x1f4,_0x19ad87[_0xa144('0x13')]));});});}; \ No newline at end of file +var _0xae21=['result','catch','ShowSound','options','raw','attributes','include','map','model','then','debug','stringify','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','info','Sound,\x20%s,\x20%s','request\x20sent','Sound,\x20%s,\x20%s,\x20%s','error','message'];(function(_0x30401f,_0x4525f7){var _0x3b75a8=function(_0x211f45){while(--_0x211f45){_0x30401f['push'](_0x30401f['shift']());}};_0x3b75a8(++_0x4525f7);}(_0xae21,0x198));var _0x1ae2=function(_0x3c91b1,_0x48a46f){_0x3c91b1=_0x3c91b1-0x0;var _0x509dda=_0xae21[_0x3c91b1];return _0x509dda;};'use strict';var _=require(_0x1ae2('0x0'));var util=require(_0x1ae2('0x1'));var moment=require(_0x1ae2('0x2'));var BPromise=require(_0x1ae2('0x3'));var rs=require(_0x1ae2('0x4'));var fs=require('fs');var Redis=require(_0x1ae2('0x5'));var db=require(_0x1ae2('0x6'))['db'];var utils=require(_0x1ae2('0x7'));var logger=require(_0x1ae2('0x8'))(_0x1ae2('0x9'));var config=require(_0x1ae2('0xa'));var jayson=require(_0x1ae2('0xb'));var client=jayson[_0x1ae2('0xc')][_0x1ae2('0xd')]({'port':0x232a});function respondWithRpcPromise(_0x4d0744,_0x53f9f8,_0x1132d5){return new BPromise(function(_0x1237ef,_0x20dec1){return client[_0x1ae2('0xe')](_0x4d0744,_0x1132d5)['then'](function(_0x19ee83){logger[_0x1ae2('0xf')](_0x1ae2('0x10'),_0x53f9f8,_0x1ae2('0x11'));logger['debug'](_0x1ae2('0x12'),_0x53f9f8,'request\x20sent',JSON['stringify'](_0x19ee83));if(_0x19ee83['error']){if(_0x19ee83[_0x1ae2('0x13')]['code']===0x1f4){logger[_0x1ae2('0x13')]('Sound,\x20%s,\x20%s',_0x53f9f8,_0x19ee83['error']['message']);return _0x20dec1(_0x19ee83[_0x1ae2('0x13')][_0x1ae2('0x14')]);}logger['error'](_0x1ae2('0x10'),_0x53f9f8,_0x19ee83['error'][_0x1ae2('0x14')]);return _0x1237ef(_0x19ee83['error'][_0x1ae2('0x14')]);}else{logger[_0x1ae2('0xf')](_0x1ae2('0x10'),_0x53f9f8,'request\x20sent');_0x1237ef(_0x19ee83[_0x1ae2('0x15')][_0x1ae2('0x14')]);}})[_0x1ae2('0x16')](function(_0x27e905){logger[_0x1ae2('0x13')](_0x1ae2('0x10'),_0x53f9f8,_0x27e905);_0x20dec1(_0x27e905);});});}exports[_0x1ae2('0x17')]=function(_0x2b7294){var _0x302999=this;return new Promise(function(_0x5e1982,_0x2f857a){return db['Sound']['find']({'raw':_0x2b7294[_0x1ae2('0x18')]?_0x2b7294[_0x1ae2('0x18')][_0x1ae2('0x19')]===undefined?!![]:![]:!![],'where':_0x2b7294[_0x1ae2('0x18')]?_0x2b7294[_0x1ae2('0x18')]['where']||null:null,'attributes':_0x2b7294[_0x1ae2('0x18')]?_0x2b7294[_0x1ae2('0x18')][_0x1ae2('0x1a')]||null:null,'include':_0x2b7294[_0x1ae2('0x18')]?_0x2b7294['options'][_0x1ae2('0x1b')]?_[_0x1ae2('0x1c')](_0x2b7294[_0x1ae2('0x18')]['include'],function(_0x4dfb0b){return{'model':db[_0x4dfb0b[_0x1ae2('0x1d')]],'as':_0x4dfb0b['as'],'attributes':_0x4dfb0b['attributes'],'include':_0x4dfb0b[_0x1ae2('0x1b')]?_[_0x1ae2('0x1c')](_0x4dfb0b[_0x1ae2('0x1b')],function(_0x228918){return{'model':db[_0x228918[_0x1ae2('0x1d')]],'as':_0x228918['as'],'attributes':_0x228918[_0x1ae2('0x1a')],'include':_0x228918[_0x1ae2('0x1b')]?_['map'](_0x228918['include'],function(_0x1d2cbb){return{'model':db[_0x1d2cbb[_0x1ae2('0x1d')]],'as':_0x1d2cbb['as'],'attributes':_0x1d2cbb[_0x1ae2('0x1a')]};}):[]};}):[]};}):[]:[]})[_0x1ae2('0x1e')](function(_0x5b6e51){logger['info'](_0x1ae2('0x17'),_0x2b7294);logger[_0x1ae2('0x1f')](_0x1ae2('0x17'),_0x2b7294,JSON[_0x1ae2('0x20')](_0x5b6e51));_0x5e1982(_0x5b6e51);})[_0x1ae2('0x16')](function(_0x2e6d8f){logger[_0x1ae2('0x13')](_0x1ae2('0x17'),_0x2e6d8f[_0x1ae2('0x14')],_0x2b7294);_0x2f857a(_0x302999['error'](0x1f4,_0x2e6d8f[_0x1ae2('0x14')]));});});}; \ No newline at end of file diff --git a/server/api/squareMessage/index.js b/server/api/squareMessage/index.js index 6cebe54..05761e1 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 _0x92a2=['create','update','delete','destroy','exports','util','path','connect-timeout','express','Router','../../config/environment','./squareMessage.controller','isAuthenticated','index','get','/:id'];(function(_0x5c4e16,_0x113035){var _0x36044a=function(_0xde2f25){while(--_0xde2f25){_0x5c4e16['push'](_0x5c4e16['shift']());}};_0x36044a(++_0x113035);}(_0x92a2,0x195));var _0x292a=function(_0x597753,_0x29e2e7){_0x597753=_0x597753-0x0;var _0x1b9cfa=_0x92a2[_0x597753];return _0x1b9cfa;};'use strict';var multer=require('multer');var util=require(_0x292a('0x0'));var path=require(_0x292a('0x1'));var timeout=require(_0x292a('0x2'));var express=require(_0x292a('0x3'));var router=express[_0x292a('0x4')]();var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x292a('0x5'));var controller=require(_0x292a('0x6'));router['get']('/',auth[_0x292a('0x7')](),controller[_0x292a('0x8')]);router[_0x292a('0x9')](_0x292a('0xa'),auth[_0x292a('0x7')](),controller['show']);router['post']('/',auth[_0x292a('0x7')](),controller[_0x292a('0xb')]);router['put'](_0x292a('0xa'),auth['isAuthenticated'](),controller[_0x292a('0xc')]);router[_0x292a('0xd')](_0x292a('0xa'),auth[_0x292a('0x7')](),controller[_0x292a('0xe')]);module[_0x292a('0xf')]=router; \ No newline at end of file +var _0x949e=['../../config/environment','./squareMessage.controller','get','index','/:id','isAuthenticated','show','post','create','update','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x949e,0xa0));var _0xe949=function(_0x4361d8,_0x2a3502){_0x4361d8=_0x4361d8-0x0;var _0x3243ed=_0x949e[_0x4361d8];return _0x3243ed;};'use strict';var multer=require(_0xe949('0x0'));var util=require(_0xe949('0x1'));var path=require(_0xe949('0x2'));var timeout=require(_0xe949('0x3'));var express=require(_0xe949('0x4'));var router=express[_0xe949('0x5')]();var auth=require(_0xe949('0x6'));var interaction=require(_0xe949('0x7'));var config=require(_0xe949('0x8'));var controller=require(_0xe949('0x9'));router[_0xe949('0xa')]('/',auth['isAuthenticated'](),controller[_0xe949('0xb')]);router[_0xe949('0xa')](_0xe949('0xc'),auth[_0xe949('0xd')](),controller[_0xe949('0xe')]);router[_0xe949('0xf')]('/',auth[_0xe949('0xd')](),controller[_0xe949('0x10')]);router['put'](_0xe949('0xc'),auth[_0xe949('0xd')](),controller[_0xe949('0x11')]);router[_0xe949('0x12')]('/:id',auth['isAuthenticated'](),controller[_0xe949('0x13')]);module[_0xe949('0x14')]=router; \ No newline at end of file diff --git a/server/api/squareMessage/squareMessage.attributes.js b/server/api/squareMessage/squareMessage.attributes.js index 58f2cdf..226ccec 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 _0x1df2=['ENUM','out','exports','TEXT'];(function(_0x11bfd6,_0x21f0f){var _0x3723ac=function(_0x46a3e0){while(--_0x46a3e0){_0x11bfd6['push'](_0x11bfd6['shift']());}};_0x3723ac(++_0x21f0f);}(_0x1df2,0x132));var _0x21df=function(_0xb0b9af,_0x584a0a){_0xb0b9af=_0xb0b9af-0x0;var _0x3cfed1=_0x1df2[_0xb0b9af];return _0x3cfed1;};'use strict';var Sequelize=require('sequelize');module[_0x21df('0x0')]={'uniqueid':{'type':Sequelize['STRING']},'body':{'type':Sequelize[_0x21df('0x1')]('medium'),'allowNull':![]},'direction':{'type':Sequelize[_0x21df('0x2')]('in','out'),'defaultValue':_0x21df('0x3'),'allowNull':![]}}; \ No newline at end of file +var _0xc2b7=['medium','ENUM','out','sequelize','exports','STRING','TEXT'];(function(_0xba9f86,_0x1e988b){var _0x2a25ce=function(_0x1f47e1){while(--_0x1f47e1){_0xba9f86['push'](_0xba9f86['shift']());}};_0x2a25ce(++_0x1e988b);}(_0xc2b7,0x122));var _0x7c2b=function(_0x39cb96,_0x5dbaa9){_0x39cb96=_0x39cb96-0x0;var _0x3170d5=_0xc2b7[_0x39cb96];return _0x3170d5;};'use strict';var Sequelize=require(_0x7c2b('0x0'));module[_0x7c2b('0x1')]={'uniqueid':{'type':Sequelize[_0x7c2b('0x2')]},'body':{'type':Sequelize[_0x7c2b('0x3')](_0x7c2b('0x4')),'allowNull':![]},'direction':{'type':Sequelize[_0x7c2b('0x5')]('in',_0x7c2b('0x6')),'defaultValue':_0x7c2b('0x6'),'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/squareMessage/squareMessage.controller.js b/server/api/squareMessage/squareMessage.controller.js index 19e33db..4ca884e 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 _0x1371=['keys','length','find','create','body','html-pdf','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','ejs','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','sendStatus','end','status','json','count','offset','set','Content-Range','apply','update','then','destroy','error','stack','name','map','SquareMessage','rawAttributes','fieldName','type','key','model','query','filters','intersection','attributes','fields','limit','order','sort','where','pick','VIRTUAL','merge','options','includeAll','include','findAll','rows','catch','params'];(function(_0x9ccc17,_0x1d087c){var _0x46e989=function(_0x302510){while(--_0x302510){_0x9ccc17['push'](_0x9ccc17['shift']());}};_0x46e989(++_0x1d087c);}(_0x1371,0x91));var _0x1137=function(_0x3aa83f,_0x5cd609){_0x3aa83f=_0x3aa83f-0x0;var _0x5c3674=_0x1371[_0x3aa83f];return _0x5c3674;};'use strict';var pdf=require(_0x1137('0x0'));var emlformat=require(_0x1137('0x1'));var rimraf=require(_0x1137('0x2'));var zipdir=require('zip-dir');var jsonpatch=require(_0x1137('0x3'));var rp=require(_0x1137('0x4'));var moment=require(_0x1137('0x5'));var BPromise=require(_0x1137('0x6'));var Mustache=require(_0x1137('0x7'));var util=require(_0x1137('0x8'));var path=require(_0x1137('0x9'));var sox=require(_0x1137('0xa'));var csv=require('to-csv');var ejs=require(_0x1137('0xb'));var fs=require('fs');var _=require('lodash');var squel=require(_0x1137('0xc'));var crypto=require(_0x1137('0xd'));var jsforce=require(_0x1137('0xe'));var deskjs=require(_0x1137('0xf'));var toCsv=require('to-csv');var querystring=require(_0x1137('0x10'));var Papa=require(_0x1137('0x11'));var Redis=require(_0x1137('0x12'));var authService=require(_0x1137('0x13'));var qs=require('../../components/parsers/qs');var as=require(_0x1137('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x1137('0x15'))(_0x1137('0x16'));var utils=require(_0x1137('0x17'));var config=require('../../config/environment');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x461efb,_0x4c14c9){_0x4c14c9=_0x4c14c9||0xcc;return function(_0xd5bfad){if(_0xd5bfad){return _0x461efb[_0x1137('0x18')](_0x4c14c9);}return _0x461efb['status'](_0x4c14c9)[_0x1137('0x19')]();};}function respondWithResult(_0x5d21d6,_0x5b33b0){_0x5b33b0=_0x5b33b0||0xc8;return function(_0x54c32a){if(_0x54c32a){return _0x5d21d6[_0x1137('0x1a')](_0x5b33b0)[_0x1137('0x1b')](_0x54c32a);}};}function respondWithFilteredResult(_0x2107b4,_0x2aff67){return function(_0x446811){if(_0x446811){var _0x40122f=_0x446811[_0x1137('0x1c')],_0x1a24ed=_0x2aff67[_0x1137('0x1d')],_0x33bb3e=_0x2aff67[_0x1137('0x1d')]+_0x2aff67['limit'],_0x263f32;if(_0x33bb3e>=_0x40122f){_0x33bb3e=_0x40122f;_0x263f32=0xc8;}else{_0x263f32=0xce;}_0x2107b4['status'](_0x263f32);return _0x2107b4[_0x1137('0x1e')](_0x1137('0x1f'),_0x1a24ed+'-'+_0x33bb3e+'/'+_0x40122f)[_0x1137('0x1b')](_0x446811);}return null;};}function patchUpdates(_0x5bcedf){return function(_0x5ed029){try{jsonpatch[_0x1137('0x20')](_0x5ed029,_0x5bcedf,!![]);}catch(_0x2910b8){return BPromise['reject'](_0x2910b8);}return _0x5ed029['save']();};}function saveUpdates(_0x2c96cb,_0x31f3e9){return function(_0x25d605){if(_0x25d605){return _0x25d605[_0x1137('0x21')](_0x2c96cb)[_0x1137('0x22')](function(_0x5973fc){return _0x5973fc;});}return null;};}function removeEntity(_0x336133,_0x4d9920){return function(_0x21a529){if(_0x21a529){return _0x21a529[_0x1137('0x23')]()[_0x1137('0x22')](function(){_0x336133['status'](0xcc)[_0x1137('0x19')]();});}};}function handleEntityNotFound(_0x53b638,_0x53e59f){return function(_0x33cfd1){if(!_0x33cfd1){_0x53b638['sendStatus'](0x194);}return _0x33cfd1;};}function handleError(_0x4d67e5,_0x462f52){_0x462f52=_0x462f52||0x1f4;return function(_0x575807){logger[_0x1137('0x24')](_0x575807[_0x1137('0x25')]);if(_0x575807['name']){delete _0x575807[_0x1137('0x26')];}_0x4d67e5[_0x1137('0x1a')](_0x462f52)['send'](_0x575807);};}exports['index']=function(_0x50b195,_0x1bcb49){var _0x4b0803={},_0xc8d94c={},_0x46d163={'count':0x0,'rows':[]};var _0x242b02=_[_0x1137('0x27')](db[_0x1137('0x28')][_0x1137('0x29')],function(_0x13414a){return{'name':_0x13414a[_0x1137('0x2a')],'type':_0x13414a[_0x1137('0x2b')][_0x1137('0x2c')]};});_0xc8d94c[_0x1137('0x2d')]=_[_0x1137('0x27')](_0x242b02,'name');_0xc8d94c[_0x1137('0x2e')]=_['keys'](_0x50b195[_0x1137('0x2e')]);_0xc8d94c[_0x1137('0x2f')]=_[_0x1137('0x30')](_0xc8d94c[_0x1137('0x2d')],_0xc8d94c['query']);_0x4b0803[_0x1137('0x31')]=_[_0x1137('0x30')](_0xc8d94c[_0x1137('0x2d')],qs['fields'](_0x50b195[_0x1137('0x2e')][_0x1137('0x32')]));_0x4b0803[_0x1137('0x31')]=_0x4b0803[_0x1137('0x31')]['length']?_0x4b0803[_0x1137('0x31')]:_0xc8d94c[_0x1137('0x2d')];if(!_0x50b195[_0x1137('0x2e')]['hasOwnProperty']('nolimit')){_0x4b0803[_0x1137('0x33')]=qs['limit'](_0x50b195[_0x1137('0x2e')]['limit']);_0x4b0803[_0x1137('0x1d')]=qs[_0x1137('0x1d')](_0x50b195[_0x1137('0x2e')][_0x1137('0x1d')]);}_0x4b0803[_0x1137('0x34')]=qs[_0x1137('0x35')](_0x50b195['query'][_0x1137('0x35')]);_0x4b0803[_0x1137('0x36')]=qs[_0x1137('0x2f')](_[_0x1137('0x37')](_0x50b195[_0x1137('0x2e')],_0xc8d94c[_0x1137('0x2f')]));if(_0x50b195[_0x1137('0x2e')]['filter']){_0x4b0803['where']=_['merge'](_0x4b0803[_0x1137('0x36')],{'$or':_[_0x1137('0x27')](_0x242b02,function(_0x5e2d78){if(_0x5e2d78['type']!==_0x1137('0x38')){var _0x7e04d1={};_0x7e04d1[_0x5e2d78[_0x1137('0x26')]]={'$like':'%'+_0x50b195['query']['filter']+'%'};return _0x7e04d1;}})});}_0x4b0803=_[_0x1137('0x39')]({},_0x4b0803,_0x50b195[_0x1137('0x3a')]);var _0x4d60db={'where':_0x4b0803[_0x1137('0x36')]};return db[_0x1137('0x28')]['count'](_0x4d60db)[_0x1137('0x22')](function(_0x1ff722){_0x46d163[_0x1137('0x1c')]=_0x1ff722;if(_0x50b195[_0x1137('0x2e')][_0x1137('0x3b')]){_0x4b0803[_0x1137('0x3c')]=[{'all':!![]}];}return db[_0x1137('0x28')][_0x1137('0x3d')](_0x4b0803);})['then'](function(_0x3cc593){_0x46d163[_0x1137('0x3e')]=_0x3cc593;return _0x46d163;})['then'](respondWithFilteredResult(_0x1bcb49,_0x4b0803))[_0x1137('0x3f')](handleError(_0x1bcb49,null));};exports['show']=function(_0x5c03e3,_0x3e32d5){var _0x4af933={'raw':!![],'where':{'id':_0x5c03e3[_0x1137('0x40')]['id']}},_0x16237b={};_0x16237b[_0x1137('0x2d')]=_[_0x1137('0x41')](db[_0x1137('0x28')][_0x1137('0x29')]);_0x16237b[_0x1137('0x2e')]=_[_0x1137('0x41')](_0x5c03e3[_0x1137('0x2e')]);_0x16237b['filters']=_[_0x1137('0x30')](_0x16237b[_0x1137('0x2d')],_0x16237b[_0x1137('0x2e')]);_0x4af933[_0x1137('0x31')]=_[_0x1137('0x30')](_0x16237b['model'],qs['fields'](_0x5c03e3[_0x1137('0x2e')][_0x1137('0x32')]));_0x4af933[_0x1137('0x31')]=_0x4af933[_0x1137('0x31')][_0x1137('0x42')]?_0x4af933[_0x1137('0x31')]:_0x16237b[_0x1137('0x2d')];if(_0x5c03e3['query'][_0x1137('0x3b')]){_0x4af933['include']=[{'all':!![]}];}_0x4af933=_[_0x1137('0x39')]({},_0x4af933,_0x5c03e3[_0x1137('0x3a')]);return db[_0x1137('0x28')][_0x1137('0x43')](_0x4af933)[_0x1137('0x22')](handleEntityNotFound(_0x3e32d5,null))['then'](respondWithResult(_0x3e32d5,null))[_0x1137('0x3f')](handleError(_0x3e32d5,null));};exports[_0x1137('0x44')]=function(_0x1a41b5,_0x4c2488){return db[_0x1137('0x28')][_0x1137('0x44')](_0x1a41b5[_0x1137('0x45')],{})['then'](respondWithResult(_0x4c2488,0xc9))[_0x1137('0x3f')](handleError(_0x4c2488,null));};exports['update']=function(_0x53aa88,_0x14d4a9){if(_0x53aa88[_0x1137('0x45')]['id']){delete _0x53aa88[_0x1137('0x45')]['id'];}return db[_0x1137('0x28')][_0x1137('0x43')]({'where':{'id':_0x53aa88[_0x1137('0x40')]['id']}})['then'](handleEntityNotFound(_0x14d4a9,null))['then'](saveUpdates(_0x53aa88[_0x1137('0x45')],null))[_0x1137('0x22')](respondWithResult(_0x14d4a9,null))[_0x1137('0x3f')](handleError(_0x14d4a9,null));};exports[_0x1137('0x23')]=function(_0x584d9b,_0x286d58){return db[_0x1137('0x28')][_0x1137('0x43')]({'where':{'id':_0x584d9b['params']['id']}})['then'](handleEntityNotFound(_0x286d58,null))[_0x1137('0x22')](removeEntity(_0x286d58,null))[_0x1137('0x3f')](handleError(_0x286d58,null));}; \ No newline at end of file +var _0x9aa8=['destroy','error','stack','name','send','index','map','SquareMessage','rawAttributes','fieldName','type','key','model','query','keys','attributes','intersection','fields','length','hasOwnProperty','nolimit','offset','sort','where','filters','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','show','params','find','catch','create','body','update','html-pdf','eml-format','rimraf','fast-json-patch','mustache','util','sox','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/environment','../../mysqldb','sendStatus','status','end','count','limit','set','Content-Range','json','apply','save','then'];(function(_0x503cd5,_0x57774a){var _0x1fdf1e=function(_0x5222cc){while(--_0x5222cc){_0x503cd5['push'](_0x503cd5['shift']());}};_0x1fdf1e(++_0x57774a);}(_0x9aa8,0x155));var _0x89aa=function(_0x28b3e4,_0x4ca1a1){_0x28b3e4=_0x28b3e4-0x0;var _0x58d43d=_0x9aa8[_0x28b3e4];return _0x58d43d;};'use strict';var pdf=require(_0x89aa('0x0'));var emlformat=require(_0x89aa('0x1'));var rimraf=require(_0x89aa('0x2'));var zipdir=require('zip-dir');var jsonpatch=require(_0x89aa('0x3'));var rp=require('request-promise');var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x89aa('0x4'));var util=require(_0x89aa('0x5'));var path=require('path');var sox=require(_0x89aa('0x6'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var _=require(_0x89aa('0x7'));var squel=require(_0x89aa('0x8'));var crypto=require(_0x89aa('0x9'));var jsforce=require(_0x89aa('0xa'));var deskjs=require(_0x89aa('0xb'));var toCsv=require(_0x89aa('0xc'));var querystring=require(_0x89aa('0xd'));var Papa=require(_0x89aa('0xe'));var Redis=require(_0x89aa('0xf'));var authService=require(_0x89aa('0x10'));var qs=require(_0x89aa('0x11'));var as=require(_0x89aa('0x12'));var hardwareService=require(_0x89aa('0x13'));var logger=require(_0x89aa('0x14'))('api');var utils=require('../../config/utils');var config=require(_0x89aa('0x15'));var db=require(_0x89aa('0x16'))['db'];function respondWithStatusCode(_0x29508e,_0x230e4b){_0x230e4b=_0x230e4b||0xcc;return function(_0x30b1e6){if(_0x30b1e6){return _0x29508e[_0x89aa('0x17')](_0x230e4b);}return _0x29508e[_0x89aa('0x18')](_0x230e4b)[_0x89aa('0x19')]();};}function respondWithResult(_0x11f72d,_0x2b2e5b){_0x2b2e5b=_0x2b2e5b||0xc8;return function(_0x1e168a){if(_0x1e168a){return _0x11f72d[_0x89aa('0x18')](_0x2b2e5b)['json'](_0x1e168a);}};}function respondWithFilteredResult(_0x279f97,_0x3719ff){return function(_0xc0969a){if(_0xc0969a){var _0x281a5f=_0xc0969a[_0x89aa('0x1a')],_0x36e5df=_0x3719ff['offset'],_0xbe5bc7=_0x3719ff['offset']+_0x3719ff[_0x89aa('0x1b')],_0x1b1cb1;if(_0xbe5bc7>=_0x281a5f){_0xbe5bc7=_0x281a5f;_0x1b1cb1=0xc8;}else{_0x1b1cb1=0xce;}_0x279f97['status'](_0x1b1cb1);return _0x279f97[_0x89aa('0x1c')](_0x89aa('0x1d'),_0x36e5df+'-'+_0xbe5bc7+'/'+_0x281a5f)[_0x89aa('0x1e')](_0xc0969a);}return null;};}function patchUpdates(_0x203864){return function(_0x44031a){try{jsonpatch[_0x89aa('0x1f')](_0x44031a,_0x203864,!![]);}catch(_0x40a892){return BPromise['reject'](_0x40a892);}return _0x44031a[_0x89aa('0x20')]();};}function saveUpdates(_0x2f13f3,_0x9ea7e5){return function(_0x24228c){if(_0x24228c){return _0x24228c['update'](_0x2f13f3)[_0x89aa('0x21')](function(_0x1ad608){return _0x1ad608;});}return null;};}function removeEntity(_0x57c282,_0x1f1dfa){return function(_0x2fa7ab){if(_0x2fa7ab){return _0x2fa7ab[_0x89aa('0x22')]()[_0x89aa('0x21')](function(){_0x57c282[_0x89aa('0x18')](0xcc)[_0x89aa('0x19')]();});}};}function handleEntityNotFound(_0x790176,_0x24e7fa){return function(_0x442abb){if(!_0x442abb){_0x790176[_0x89aa('0x17')](0x194);}return _0x442abb;};}function handleError(_0x14499c,_0x3e2e8a){_0x3e2e8a=_0x3e2e8a||0x1f4;return function(_0x263951){logger[_0x89aa('0x23')](_0x263951[_0x89aa('0x24')]);if(_0x263951[_0x89aa('0x25')]){delete _0x263951['name'];}_0x14499c['status'](_0x3e2e8a)[_0x89aa('0x26')](_0x263951);};}exports[_0x89aa('0x27')]=function(_0x36c950,_0x42e90b){var _0x589e24={},_0x47e403={},_0x3761a7={'count':0x0,'rows':[]};var _0x42d9b8=_[_0x89aa('0x28')](db[_0x89aa('0x29')][_0x89aa('0x2a')],function(_0x2c0c94){return{'name':_0x2c0c94[_0x89aa('0x2b')],'type':_0x2c0c94[_0x89aa('0x2c')][_0x89aa('0x2d')]};});_0x47e403[_0x89aa('0x2e')]=_[_0x89aa('0x28')](_0x42d9b8,_0x89aa('0x25'));_0x47e403[_0x89aa('0x2f')]=_[_0x89aa('0x30')](_0x36c950[_0x89aa('0x2f')]);_0x47e403['filters']=_['intersection'](_0x47e403[_0x89aa('0x2e')],_0x47e403['query']);_0x589e24[_0x89aa('0x31')]=_[_0x89aa('0x32')](_0x47e403['model'],qs[_0x89aa('0x33')](_0x36c950[_0x89aa('0x2f')][_0x89aa('0x33')]));_0x589e24[_0x89aa('0x31')]=_0x589e24[_0x89aa('0x31')][_0x89aa('0x34')]?_0x589e24[_0x89aa('0x31')]:_0x47e403[_0x89aa('0x2e')];if(!_0x36c950[_0x89aa('0x2f')][_0x89aa('0x35')](_0x89aa('0x36'))){_0x589e24[_0x89aa('0x1b')]=qs[_0x89aa('0x1b')](_0x36c950[_0x89aa('0x2f')]['limit']);_0x589e24[_0x89aa('0x37')]=qs['offset'](_0x36c950[_0x89aa('0x2f')][_0x89aa('0x37')]);}_0x589e24['order']=qs[_0x89aa('0x38')](_0x36c950[_0x89aa('0x2f')][_0x89aa('0x38')]);_0x589e24[_0x89aa('0x39')]=qs[_0x89aa('0x3a')](_[_0x89aa('0x3b')](_0x36c950['query'],_0x47e403[_0x89aa('0x3a')]));if(_0x36c950[_0x89aa('0x2f')][_0x89aa('0x3c')]){_0x589e24[_0x89aa('0x39')]=_[_0x89aa('0x3d')](_0x589e24[_0x89aa('0x39')],{'$or':_[_0x89aa('0x28')](_0x42d9b8,function(_0xfeee3c){if(_0xfeee3c[_0x89aa('0x2c')]!==_0x89aa('0x3e')){var _0x370d53={};_0x370d53[_0xfeee3c[_0x89aa('0x25')]]={'$like':'%'+_0x36c950[_0x89aa('0x2f')][_0x89aa('0x3c')]+'%'};return _0x370d53;}})});}_0x589e24=_['merge']({},_0x589e24,_0x36c950[_0x89aa('0x3f')]);var _0x151f7d={'where':_0x589e24[_0x89aa('0x39')]};return db[_0x89aa('0x29')]['count'](_0x151f7d)[_0x89aa('0x21')](function(_0x339e99){_0x3761a7['count']=_0x339e99;if(_0x36c950[_0x89aa('0x2f')][_0x89aa('0x40')]){_0x589e24[_0x89aa('0x41')]=[{'all':!![]}];}return db[_0x89aa('0x29')][_0x89aa('0x42')](_0x589e24);})['then'](function(_0x4d07f4){_0x3761a7[_0x89aa('0x43')]=_0x4d07f4;return _0x3761a7;})['then'](respondWithFilteredResult(_0x42e90b,_0x589e24))['catch'](handleError(_0x42e90b,null));};exports[_0x89aa('0x44')]=function(_0x8cbf2d,_0x2edac9){var _0xccb2d1={'raw':!![],'where':{'id':_0x8cbf2d[_0x89aa('0x45')]['id']}},_0x5d86cf={};_0x5d86cf[_0x89aa('0x2e')]=_['keys'](db[_0x89aa('0x29')][_0x89aa('0x2a')]);_0x5d86cf[_0x89aa('0x2f')]=_[_0x89aa('0x30')](_0x8cbf2d[_0x89aa('0x2f')]);_0x5d86cf[_0x89aa('0x3a')]=_[_0x89aa('0x32')](_0x5d86cf['model'],_0x5d86cf[_0x89aa('0x2f')]);_0xccb2d1[_0x89aa('0x31')]=_[_0x89aa('0x32')](_0x5d86cf[_0x89aa('0x2e')],qs['fields'](_0x8cbf2d[_0x89aa('0x2f')]['fields']));_0xccb2d1[_0x89aa('0x31')]=_0xccb2d1[_0x89aa('0x31')]['length']?_0xccb2d1['attributes']:_0x5d86cf[_0x89aa('0x2e')];if(_0x8cbf2d[_0x89aa('0x2f')][_0x89aa('0x40')]){_0xccb2d1[_0x89aa('0x41')]=[{'all':!![]}];}_0xccb2d1=_['merge']({},_0xccb2d1,_0x8cbf2d[_0x89aa('0x3f')]);return db[_0x89aa('0x29')][_0x89aa('0x46')](_0xccb2d1)[_0x89aa('0x21')](handleEntityNotFound(_0x2edac9,null))[_0x89aa('0x21')](respondWithResult(_0x2edac9,null))[_0x89aa('0x47')](handleError(_0x2edac9,null));};exports[_0x89aa('0x48')]=function(_0x22ea50,_0x5b189c){return db['SquareMessage'][_0x89aa('0x48')](_0x22ea50[_0x89aa('0x49')],{})[_0x89aa('0x21')](respondWithResult(_0x5b189c,0xc9))['catch'](handleError(_0x5b189c,null));};exports[_0x89aa('0x4a')]=function(_0x4e358f,_0x40d6b5){if(_0x4e358f[_0x89aa('0x49')]['id']){delete _0x4e358f['body']['id'];}return db[_0x89aa('0x29')][_0x89aa('0x46')]({'where':{'id':_0x4e358f[_0x89aa('0x45')]['id']}})[_0x89aa('0x21')](handleEntityNotFound(_0x40d6b5,null))[_0x89aa('0x21')](saveUpdates(_0x4e358f[_0x89aa('0x49')],null))[_0x89aa('0x21')](respondWithResult(_0x40d6b5,null))['catch'](handleError(_0x40d6b5,null));};exports[_0x89aa('0x22')]=function(_0x58edb5,_0x12644d){return db[_0x89aa('0x29')][_0x89aa('0x46')]({'where':{'id':_0x58edb5[_0x89aa('0x45')]['id']}})[_0x89aa('0x21')](handleEntityNotFound(_0x12644d,null))[_0x89aa('0x21')](removeEntity(_0x12644d,null))['catch'](handleError(_0x12644d,null));}; \ No newline at end of file diff --git a/server/api/squareMessage/squareMessage.model.js b/server/api/squareMessage/squareMessage.model.js index 77796aa..de23aee 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 _0x1807=['SquareMessage','square_messages','lodash','../../config/logger','api','moment','request-promise','path','rimraf','./squareMessage.attributes','exports','define'];(function(_0x4b7a8f,_0x4012e8){var _0x197a83=function(_0x32e996){while(--_0x32e996){_0x4b7a8f['push'](_0x4b7a8f['shift']());}};_0x197a83(++_0x4012e8);}(_0x1807,0x1a6));var _0x7180=function(_0xdbc93e,_0x4fcd8e){_0xdbc93e=_0xdbc93e-0x0;var _0x29df2c=_0x1807[_0xdbc93e];return _0x29df2c;};'use strict';var _=require(_0x7180('0x0'));var util=require('util');var logger=require(_0x7180('0x1'))(_0x7180('0x2'));var moment=require(_0x7180('0x3'));var BPromise=require('bluebird');var rp=require(_0x7180('0x4'));var fs=require('fs');var path=require(_0x7180('0x5'));var rimraf=require(_0x7180('0x6'));var config=require('../../config/environment');var attributes=require(_0x7180('0x7'));module[_0x7180('0x8')]=function(_0x5b262b,_0xad53d2){return _0x5b262b[_0x7180('0x9')](_0x7180('0xa'),attributes,{'tableName':_0x7180('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xd721=['lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','./squareMessage.attributes','define'];(function(_0x13c238,_0x56caa3){var _0x7331e8=function(_0x4b40af){while(--_0x4b40af){_0x13c238['push'](_0x13c238['shift']());}};_0x7331e8(++_0x56caa3);}(_0xd721,0x1ef));var _0x1d72=function(_0x58279d,_0x98afcb){_0x58279d=_0x58279d-0x0;var _0x4a5c78=_0xd721[_0x58279d];return _0x4a5c78;};'use strict';var _=require(_0x1d72('0x0'));var util=require(_0x1d72('0x1'));var logger=require(_0x1d72('0x2'))(_0x1d72('0x3'));var moment=require(_0x1d72('0x4'));var BPromise=require(_0x1d72('0x5'));var rp=require(_0x1d72('0x6'));var fs=require('fs');var path=require(_0x1d72('0x7'));var rimraf=require(_0x1d72('0x8'));var config=require('../../config/environment');var attributes=require(_0x1d72('0x9'));module['exports']=function(_0x5c141c,_0xddcef4){return _0x5c141c[_0x1d72('0xa')]('SquareMessage',attributes,{'tableName':'square_messages','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/squareMessage/squareMessage.rpc.js b/server/api/squareMessage/squareMessage.rpc.js index 0e11547..f88d6d4 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 _0xaf11=['../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','http','info','SquareMessage,\x20%s,\x20%s','request\x20sent','debug','SquareMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','CreateSquareMessage','SquareMessage','body','options','raw','then','lodash','util','moment','bluebird','ioredis'];(function(_0x465297,_0x5ba9c3){var _0x6d007e=function(_0x4afa87){while(--_0x4afa87){_0x465297['push'](_0x465297['shift']());}};_0x6d007e(++_0x5ba9c3);}(_0xaf11,0x12f));var _0x1af1=function(_0x20d58f,_0x191c36){_0x20d58f=_0x20d58f-0x0;var _0x2e29c7=_0xaf11[_0x20d58f];return _0x2e29c7;};'use strict';var _=require(_0x1af1('0x0'));var util=require(_0x1af1('0x1'));var moment=require(_0x1af1('0x2'));var BPromise=require(_0x1af1('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x1af1('0x4'));var db=require(_0x1af1('0x5'))['db'];var utils=require(_0x1af1('0x6'));var logger=require('../../config/logger')(_0x1af1('0x7'));var config=require(_0x1af1('0x8'));var jayson=require(_0x1af1('0x9'));var client=jayson['client'][_0x1af1('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x5dbe9d,_0x20ba8b,_0x26d917){return new BPromise(function(_0x48b286,_0x260799){return client['request'](_0x5dbe9d,_0x26d917)['then'](function(_0x2d8327){logger[_0x1af1('0xb')](_0x1af1('0xc'),_0x20ba8b,_0x1af1('0xd'));logger[_0x1af1('0xe')](_0x1af1('0xf'),_0x20ba8b,'request\x20sent',JSON[_0x1af1('0x10')](_0x2d8327));if(_0x2d8327[_0x1af1('0x11')]){if(_0x2d8327[_0x1af1('0x11')][_0x1af1('0x12')]===0x1f4){logger[_0x1af1('0x11')](_0x1af1('0xc'),_0x20ba8b,_0x2d8327[_0x1af1('0x11')]['message']);return _0x260799(_0x2d8327[_0x1af1('0x11')][_0x1af1('0x13')]);}logger[_0x1af1('0x11')](_0x1af1('0xc'),_0x20ba8b,_0x2d8327['error'][_0x1af1('0x13')]);return _0x48b286(_0x2d8327[_0x1af1('0x11')][_0x1af1('0x13')]);}else{logger['info'](_0x1af1('0xc'),_0x20ba8b,_0x1af1('0xd'));_0x48b286(_0x2d8327[_0x1af1('0x14')][_0x1af1('0x13')]);}})[_0x1af1('0x15')](function(_0x359eaf){logger[_0x1af1('0x11')](_0x1af1('0xc'),_0x20ba8b,_0x359eaf);_0x260799(_0x359eaf);});});}exports[_0x1af1('0x16')]=function(_0x20c17b){var _0x52c11b=this;return new Promise(function(_0x4da591,_0x54d2d7){return db[_0x1af1('0x17')]['create'](_0x20c17b[_0x1af1('0x18')],{'raw':_0x20c17b[_0x1af1('0x19')]?_0x20c17b[_0x1af1('0x19')][_0x1af1('0x1a')]===undefined?!![]:![]:!![]})[_0x1af1('0x1b')](function(_0x5d336){logger['info'](_0x1af1('0x16'),_0x20c17b);logger[_0x1af1('0xe')](_0x1af1('0x16'),_0x20c17b,JSON['stringify'](_0x5d336));_0x4da591(_0x5d336);})[_0x1af1('0x15')](function(_0xca2e20){logger['error'](_0x1af1('0x16'),_0xca2e20[_0x1af1('0x13')],_0x20c17b);_0x54d2d7(_0x52c11b[_0x1af1('0x11')](0x1f4,_0xca2e20['message']));});});}; \ No newline at end of file +var _0x22da=['debug','SquareMessage,\x20%s,\x20%s,\x20%s','error','code','SquareMessage,\x20%s,\x20%s','message','result','catch','CreateSquareMessage','SquareMessage','create','body','options','raw','then','stringify','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','info','request\x20sent'];(function(_0x437aac,_0x7f0a20){var _0x4a3ee6=function(_0x503e9d){while(--_0x503e9d){_0x437aac['push'](_0x437aac['shift']());}};_0x4a3ee6(++_0x7f0a20);}(_0x22da,0x80));var _0xa22d=function(_0x8a203c,_0x5ccd3c){_0x8a203c=_0x8a203c-0x0;var _0x50e084=_0x22da[_0x8a203c];return _0x50e084;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0xa22d('0x0'));var BPromise=require(_0xa22d('0x1'));var rs=require(_0xa22d('0x2'));var fs=require('fs');var Redis=require(_0xa22d('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0xa22d('0x4'));var logger=require(_0xa22d('0x5'))(_0xa22d('0x6'));var config=require(_0xa22d('0x7'));var jayson=require('jayson/promise');var client=jayson[_0xa22d('0x8')][_0xa22d('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x4c67ad,_0x215529,_0x44a5c7){return new BPromise(function(_0x5678bc,_0x186e5c){return client['request'](_0x4c67ad,_0x44a5c7)['then'](function(_0x15f0bd){logger[_0xa22d('0xa')]('SquareMessage,\x20%s,\x20%s',_0x215529,_0xa22d('0xb'));logger[_0xa22d('0xc')](_0xa22d('0xd'),_0x215529,_0xa22d('0xb'),JSON['stringify'](_0x15f0bd));if(_0x15f0bd['error']){if(_0x15f0bd[_0xa22d('0xe')][_0xa22d('0xf')]===0x1f4){logger['error'](_0xa22d('0x10'),_0x215529,_0x15f0bd['error'][_0xa22d('0x11')]);return _0x186e5c(_0x15f0bd[_0xa22d('0xe')][_0xa22d('0x11')]);}logger['error'](_0xa22d('0x10'),_0x215529,_0x15f0bd[_0xa22d('0xe')][_0xa22d('0x11')]);return _0x5678bc(_0x15f0bd[_0xa22d('0xe')][_0xa22d('0x11')]);}else{logger['info'](_0xa22d('0x10'),_0x215529,_0xa22d('0xb'));_0x5678bc(_0x15f0bd[_0xa22d('0x12')][_0xa22d('0x11')]);}})[_0xa22d('0x13')](function(_0x2159e1){logger[_0xa22d('0xe')](_0xa22d('0x10'),_0x215529,_0x2159e1);_0x186e5c(_0x2159e1);});});}exports[_0xa22d('0x14')]=function(_0x3d78b9){var _0xf50354=this;return new Promise(function(_0x1ed22e,_0x39c2bf){return db[_0xa22d('0x15')][_0xa22d('0x16')](_0x3d78b9[_0xa22d('0x17')],{'raw':_0x3d78b9['options']?_0x3d78b9[_0xa22d('0x18')][_0xa22d('0x19')]===undefined?!![]:![]:!![]})[_0xa22d('0x1a')](function(_0x4ed606){logger['info']('CreateSquareMessage',_0x3d78b9);logger[_0xa22d('0xc')](_0xa22d('0x14'),_0x3d78b9,JSON[_0xa22d('0x1b')](_0x4ed606));_0x1ed22e(_0x4ed606);})['catch'](function(_0x389675){logger[_0xa22d('0xe')](_0xa22d('0x14'),_0x389675['message'],_0x3d78b9);_0x39c2bf(_0xf50354[_0xa22d('0xe')](0x1f4,_0x389675[_0xa22d('0x11')]));});});}; \ No newline at end of file diff --git a/server/api/squareOdbc/index.js b/server/api/squareOdbc/index.js index fc9068d..3e671f1 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 _0xf14d=['express','../../components/interaction/service','../../config/environment','./squareOdbc.controller','get','isAuthenticated','/:id','show','/:id/test','15s','test','post','create','put','update','delete','exports','util','path','connect-timeout'];(function(_0xfae23b,_0x2be4ba){var _0x200640=function(_0x4ae258){while(--_0x4ae258){_0xfae23b['push'](_0xfae23b['shift']());}};_0x200640(++_0x2be4ba);}(_0xf14d,0xc5));var _0xdf14=function(_0x128867,_0x1bb725){_0x128867=_0x128867-0x0;var _0x43c2a7=_0xf14d[_0x128867];return _0x43c2a7;};'use strict';var multer=require('multer');var util=require(_0xdf14('0x0'));var path=require(_0xdf14('0x1'));var timeout=require(_0xdf14('0x2'));var express=require(_0xdf14('0x3'));var router=express['Router']();var auth=require('../../components/auth/service');var interaction=require(_0xdf14('0x4'));var config=require(_0xdf14('0x5'));var controller=require(_0xdf14('0x6'));router[_0xdf14('0x7')]('/',auth[_0xdf14('0x8')](),controller['index']);router[_0xdf14('0x7')](_0xdf14('0x9'),auth['isAuthenticated'](),controller[_0xdf14('0xa')]);router['get'](_0xdf14('0xb'),auth[_0xdf14('0x8')](),timeout(_0xdf14('0xc')),controller[_0xdf14('0xd')]);router[_0xdf14('0xe')]('/',auth[_0xdf14('0x8')](),controller[_0xdf14('0xf')]);router[_0xdf14('0x10')](_0xdf14('0x9'),auth[_0xdf14('0x8')](),controller[_0xdf14('0x11')]);router[_0xdf14('0x12')](_0xdf14('0x9'),auth[_0xdf14('0x8')](),controller['destroy']);module[_0xdf14('0x13')]=router; \ No newline at end of file +var _0x65fd=['/:id','show','15s','test','post','create','delete','destroy','exports','multer','util','path','connect-timeout','Router','../../components/interaction/service','../../config/environment','./squareOdbc.controller','get','isAuthenticated'];(function(_0x356780,_0x48ce70){var _0x2a0fec=function(_0x99d84){while(--_0x99d84){_0x356780['push'](_0x356780['shift']());}};_0x2a0fec(++_0x48ce70);}(_0x65fd,0x185));var _0xd65f=function(_0x302dbc,_0x5dd8f5){_0x302dbc=_0x302dbc-0x0;var _0x18597a=_0x65fd[_0x302dbc];return _0x18597a;};'use strict';var multer=require(_0xd65f('0x0'));var util=require(_0xd65f('0x1'));var path=require(_0xd65f('0x2'));var timeout=require(_0xd65f('0x3'));var express=require('express');var router=express[_0xd65f('0x4')]();var auth=require('../../components/auth/service');var interaction=require(_0xd65f('0x5'));var config=require(_0xd65f('0x6'));var controller=require(_0xd65f('0x7'));router[_0xd65f('0x8')]('/',auth[_0xd65f('0x9')](),controller['index']);router['get'](_0xd65f('0xa'),auth[_0xd65f('0x9')](),controller[_0xd65f('0xb')]);router[_0xd65f('0x8')]('/:id/test',auth['isAuthenticated'](),timeout(_0xd65f('0xc')),controller[_0xd65f('0xd')]);router[_0xd65f('0xe')]('/',auth['isAuthenticated'](),controller[_0xd65f('0xf')]);router['put']('/:id',auth['isAuthenticated'](),controller['update']);router[_0xd65f('0x10')](_0xd65f('0xa'),auth[_0xd65f('0x9')](),controller[_0xd65f('0x11')]);module[_0xd65f('0x12')]=router; \ No newline at end of file diff --git a/server/api/squareOdbc/squareOdbc.attributes.js b/server/api/squareOdbc/squareOdbc.attributes.js index 76cacf7..3d47b70 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 _0x5920=['exports','STRING','name','sequelize'];(function(_0x153e7d,_0x10a35f){var _0x3c22dd=function(_0x4d33f6){while(--_0x4d33f6){_0x153e7d['push'](_0x153e7d['shift']());}};_0x3c22dd(++_0x10a35f);}(_0x5920,0x153));var _0x0592=function(_0x59a37c,_0x267d52){_0x59a37c=_0x59a37c-0x0;var _0x5ac282=_0x5920[_0x59a37c];return _0x5ac282;};'use strict';var Sequelize=require(_0x0592('0x0'));module[_0x0592('0x1')]={'name':{'type':Sequelize[_0x0592('0x2')],'unique':_0x0592('0x3'),'allowNull':![]},'dsn':{'type':Sequelize[_0x0592('0x2')]},'description':{'type':Sequelize[_0x0592('0x2')]}}; \ No newline at end of file +var _0xa6e2=['STRING','sequelize','exports','name'];(function(_0x527a45,_0x2a9b5f){var _0x690e4d=function(_0xd2f2ba){while(--_0xd2f2ba){_0x527a45['push'](_0x527a45['shift']());}};_0x690e4d(++_0x2a9b5f);}(_0xa6e2,0x1b9));var _0x2a6e=function(_0x1712fa,_0xfcb3fc){_0x1712fa=_0x1712fa-0x0;var _0x1eb085=_0xa6e2[_0x1712fa];return _0x1eb085;};'use strict';var Sequelize=require(_0x2a6e('0x0'));module[_0x2a6e('0x1')]={'name':{'type':Sequelize['STRING'],'unique':_0x2a6e('0x2'),'allowNull':![]},'dsn':{'type':Sequelize[_0x2a6e('0x3')]},'description':{'type':Sequelize[_0x2a6e('0x3')]}}; \ No newline at end of file diff --git a/server/api/squareOdbc/squareOdbc.controller.js b/server/api/squareOdbc/squareOdbc.controller.js index fda981c..f3edd5c 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 _0x7a5b=['querystring','papaparse','ioredis','../../components/auth/service','../../config/logger','../../config/utils','sendStatus','status','end','json','count','offset','limit','set','apply','update','then','destroy','get','ODBC','error','stack','name','send','index','map','SquareOdbc','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','fields','attributes','length','order','sort','where','pick','filter','merge','options','include','findAll','rows','catch','show','includeAll','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','test','odbc','dsn','closeSync','html-pdf','eml-format','zip-dir','fast-json-patch','request-promise','moment','mustache','util','sox','to-csv','ejs','squel','crypto','jsforce','desk.js'];(function(_0x556347,_0x2538f7){var _0x1633ca=function(_0x39a297){while(--_0x39a297){_0x556347['push'](_0x556347['shift']());}};_0x1633ca(++_0x2538f7);}(_0x7a5b,0x1d7));var _0xb7a5=function(_0x3e7b39,_0x2c2110){_0x3e7b39=_0x3e7b39-0x0;var _0x4ad001=_0x7a5b[_0x3e7b39];return _0x4ad001;};'use strict';var pdf=require(_0xb7a5('0x0'));var emlformat=require(_0xb7a5('0x1'));var rimraf=require('rimraf');var zipdir=require(_0xb7a5('0x2'));var jsonpatch=require(_0xb7a5('0x3'));var rp=require(_0xb7a5('0x4'));var moment=require(_0xb7a5('0x5'));var BPromise=require('bluebird');var Mustache=require(_0xb7a5('0x6'));var util=require(_0xb7a5('0x7'));var path=require('path');var sox=require(_0xb7a5('0x8'));var csv=require(_0xb7a5('0x9'));var ejs=require(_0xb7a5('0xa'));var fs=require('fs');var _=require('lodash');var squel=require(_0xb7a5('0xb'));var crypto=require(_0xb7a5('0xc'));var jsforce=require(_0xb7a5('0xd'));var deskjs=require(_0xb7a5('0xe'));var toCsv=require(_0xb7a5('0x9'));var querystring=require(_0xb7a5('0xf'));var Papa=require(_0xb7a5('0x10'));var Redis=require(_0xb7a5('0x11'));var authService=require(_0xb7a5('0x12'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0xb7a5('0x13'))('api');var utils=require(_0xb7a5('0x14'));var config=require('../../config/environment');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x59505e,_0x2d89e6){_0x2d89e6=_0x2d89e6||0xcc;return function(_0x47d1b6){if(_0x47d1b6){return _0x59505e[_0xb7a5('0x15')](_0x2d89e6);}return _0x59505e[_0xb7a5('0x16')](_0x2d89e6)[_0xb7a5('0x17')]();};}function respondWithResult(_0x4d6bad,_0x746f12){_0x746f12=_0x746f12||0xc8;return function(_0x203651){if(_0x203651){return _0x4d6bad[_0xb7a5('0x16')](_0x746f12)[_0xb7a5('0x18')](_0x203651);}};}function respondWithFilteredResult(_0x3995b5,_0x1f0139){return function(_0x3c435c){if(_0x3c435c){var _0x237d38=_0x3c435c[_0xb7a5('0x19')],_0x19b5e9=_0x1f0139[_0xb7a5('0x1a')],_0x2f5514=_0x1f0139[_0xb7a5('0x1a')]+_0x1f0139[_0xb7a5('0x1b')],_0x3065aa;if(_0x2f5514>=_0x237d38){_0x2f5514=_0x237d38;_0x3065aa=0xc8;}else{_0x3065aa=0xce;}_0x3995b5[_0xb7a5('0x16')](_0x3065aa);return _0x3995b5[_0xb7a5('0x1c')]('Content-Range',_0x19b5e9+'-'+_0x2f5514+'/'+_0x237d38)[_0xb7a5('0x18')](_0x3c435c);}return null;};}function patchUpdates(_0x172609){return function(_0xfc969b){try{jsonpatch[_0xb7a5('0x1d')](_0xfc969b,_0x172609,!![]);}catch(_0x43e223){return BPromise['reject'](_0x43e223);}return _0xfc969b['save']();};}function saveUpdates(_0x3ba101,_0x34da52){return function(_0x2845f8){if(_0x2845f8){return _0x2845f8[_0xb7a5('0x1e')](_0x3ba101)[_0xb7a5('0x1f')](function(_0x169d9e){return _0x169d9e;});}return null;};}function removeEntity(_0x9ef749,_0x2bc8d3){return function(_0x420877){if(_0x420877){return _0x420877[_0xb7a5('0x20')]()['then'](function(){var _0x51dec9=_0x420877[_0xb7a5('0x21')]({'plain':!![]});var _0x263ebb=_0xb7a5('0x22');return db['UserProfileResource']['destroy']({'where':{'type':_0x263ebb,'resourceId':_0x51dec9['id']}})[_0xb7a5('0x1f')](function(){return _0x420877;});})[_0xb7a5('0x1f')](function(){_0x9ef749[_0xb7a5('0x16')](0xcc)[_0xb7a5('0x17')]();});}};}function handleEntityNotFound(_0x334491,_0x1a2a04){return function(_0x2a6855){if(!_0x2a6855){_0x334491[_0xb7a5('0x15')](0x194);}return _0x2a6855;};}function handleError(_0x3e5d18,_0x445210){_0x445210=_0x445210||0x1f4;return function(_0x2e48ec){logger[_0xb7a5('0x23')](_0x2e48ec[_0xb7a5('0x24')]);if(_0x2e48ec[_0xb7a5('0x25')]){delete _0x2e48ec[_0xb7a5('0x25')];}_0x3e5d18[_0xb7a5('0x16')](_0x445210)[_0xb7a5('0x26')](_0x2e48ec);};}exports[_0xb7a5('0x27')]=function(_0x1f540e,_0x5156a6){var _0x3ea81d={},_0x1b0136={},_0x15adba={'count':0x0,'rows':[]};var _0x1c96b1=_[_0xb7a5('0x28')](db[_0xb7a5('0x29')][_0xb7a5('0x2a')],function(_0x3f5272){return{'name':_0x3f5272[_0xb7a5('0x2b')],'type':_0x3f5272[_0xb7a5('0x2c')][_0xb7a5('0x2d')]};});_0x1b0136[_0xb7a5('0x2e')]=_[_0xb7a5('0x28')](_0x1c96b1,_0xb7a5('0x25'));_0x1b0136[_0xb7a5('0x2f')]=_[_0xb7a5('0x30')](_0x1f540e[_0xb7a5('0x2f')]);_0x1b0136[_0xb7a5('0x31')]=_[_0xb7a5('0x32')](_0x1b0136[_0xb7a5('0x2e')],_0x1b0136['query']);_0x3ea81d['attributes']=_['intersection'](_0x1b0136[_0xb7a5('0x2e')],qs[_0xb7a5('0x33')](_0x1f540e[_0xb7a5('0x2f')][_0xb7a5('0x33')]));_0x3ea81d[_0xb7a5('0x34')]=_0x3ea81d[_0xb7a5('0x34')][_0xb7a5('0x35')]?_0x3ea81d[_0xb7a5('0x34')]:_0x1b0136[_0xb7a5('0x2e')];if(!_0x1f540e[_0xb7a5('0x2f')]['hasOwnProperty']('nolimit')){_0x3ea81d[_0xb7a5('0x1b')]=qs[_0xb7a5('0x1b')](_0x1f540e[_0xb7a5('0x2f')][_0xb7a5('0x1b')]);_0x3ea81d[_0xb7a5('0x1a')]=qs[_0xb7a5('0x1a')](_0x1f540e[_0xb7a5('0x2f')][_0xb7a5('0x1a')]);}_0x3ea81d[_0xb7a5('0x36')]=qs[_0xb7a5('0x37')](_0x1f540e[_0xb7a5('0x2f')]['sort']);_0x3ea81d[_0xb7a5('0x38')]=qs['filters'](_[_0xb7a5('0x39')](_0x1f540e[_0xb7a5('0x2f')],_0x1b0136['filters']));if(_0x1f540e[_0xb7a5('0x2f')][_0xb7a5('0x3a')]){_0x3ea81d['where']=_[_0xb7a5('0x3b')](_0x3ea81d[_0xb7a5('0x38')],{'$or':_[_0xb7a5('0x28')](_0x1c96b1,function(_0x21a645){if(_0x21a645[_0xb7a5('0x2c')]!=='VIRTUAL'){var _0x44471a={};_0x44471a[_0x21a645[_0xb7a5('0x25')]]={'$like':'%'+_0x1f540e[_0xb7a5('0x2f')][_0xb7a5('0x3a')]+'%'};return _0x44471a;}})});}_0x3ea81d=_['merge']({},_0x3ea81d,_0x1f540e[_0xb7a5('0x3c')]);var _0x4a33da={'where':_0x3ea81d[_0xb7a5('0x38')]};return db[_0xb7a5('0x29')][_0xb7a5('0x19')](_0x4a33da)['then'](function(_0x307382){_0x15adba[_0xb7a5('0x19')]=_0x307382;if(_0x1f540e[_0xb7a5('0x2f')]['includeAll']){_0x3ea81d[_0xb7a5('0x3d')]=[{'all':!![]}];}return db[_0xb7a5('0x29')][_0xb7a5('0x3e')](_0x3ea81d);})[_0xb7a5('0x1f')](function(_0xa16737){_0x15adba[_0xb7a5('0x3f')]=_0xa16737;return _0x15adba;})[_0xb7a5('0x1f')](respondWithFilteredResult(_0x5156a6,_0x3ea81d))[_0xb7a5('0x40')](handleError(_0x5156a6,null));};exports[_0xb7a5('0x41')]=function(_0x23e2de,_0x46ec42){var _0x33f83a={'raw':!![],'where':{'id':_0x23e2de['params']['id']}},_0x24303d={};_0x24303d['model']=_[_0xb7a5('0x30')](db[_0xb7a5('0x29')][_0xb7a5('0x2a')]);_0x24303d['query']=_['keys'](_0x23e2de[_0xb7a5('0x2f')]);_0x24303d[_0xb7a5('0x31')]=_['intersection'](_0x24303d[_0xb7a5('0x2e')],_0x24303d[_0xb7a5('0x2f')]);_0x33f83a[_0xb7a5('0x34')]=_[_0xb7a5('0x32')](_0x24303d[_0xb7a5('0x2e')],qs[_0xb7a5('0x33')](_0x23e2de[_0xb7a5('0x2f')][_0xb7a5('0x33')]));_0x33f83a['attributes']=_0x33f83a[_0xb7a5('0x34')][_0xb7a5('0x35')]?_0x33f83a['attributes']:_0x24303d['model'];if(_0x23e2de['query'][_0xb7a5('0x42')]){_0x33f83a[_0xb7a5('0x3d')]=[{'all':!![]}];}_0x33f83a=_['merge']({},_0x33f83a,_0x23e2de[_0xb7a5('0x3c')]);return db[_0xb7a5('0x29')][_0xb7a5('0x43')](_0x33f83a)[_0xb7a5('0x1f')](handleEntityNotFound(_0x46ec42,null))['then'](respondWithResult(_0x46ec42,null))[_0xb7a5('0x40')](handleError(_0x46ec42,null));};exports[_0xb7a5('0x44')]=function(_0x31ddee,_0x331f2c){return db[_0xb7a5('0x29')]['create'](_0x31ddee[_0xb7a5('0x45')],{})[_0xb7a5('0x1f')](function(_0x52a9c2){var _0x226f1a=_0x31ddee[_0xb7a5('0x46')][_0xb7a5('0x21')]({'plain':!![]});if(!_0x226f1a)throw new Error(_0xb7a5('0x47'));if(_0x226f1a[_0xb7a5('0x48')]==='user'){var _0x4283d7=_0x52a9c2[_0xb7a5('0x21')]({'plain':!![]});var _0x452470=_0xb7a5('0x22');return db[_0xb7a5('0x49')][_0xb7a5('0x43')]({'where':{'name':_0x452470,'userProfileId':_0x226f1a['userProfileId']},'raw':!![]})[_0xb7a5('0x1f')](function(_0x1021b5){if(_0x1021b5&&_0x1021b5['autoAssociation']===0x0){return db[_0xb7a5('0x4a')]['create']({'name':_0x4283d7[_0xb7a5('0x25')],'resourceId':_0x4283d7['id'],'type':_0x1021b5['name'],'sectionId':_0x1021b5['id']},{})[_0xb7a5('0x1f')](function(){return _0x52a9c2;});}else{return _0x52a9c2;}})['catch'](function(_0xc0add4){logger[_0xb7a5('0x23')](_0xb7a5('0x4b'),_0xc0add4);throw _0xc0add4;});}return _0x52a9c2;})[_0xb7a5('0x1f')](respondWithResult(_0x331f2c,0xc9))[_0xb7a5('0x40')](handleError(_0x331f2c,null));};exports[_0xb7a5('0x1e')]=function(_0xdb0ab,_0x4e6bc5){if(_0xdb0ab[_0xb7a5('0x45')]['id']){delete _0xdb0ab[_0xb7a5('0x45')]['id'];}return db['SquareOdbc'][_0xb7a5('0x43')]({'where':{'id':_0xdb0ab[_0xb7a5('0x4c')]['id']}})['then'](handleEntityNotFound(_0x4e6bc5,null))[_0xb7a5('0x1f')](saveUpdates(_0xdb0ab[_0xb7a5('0x45')],null))[_0xb7a5('0x1f')](respondWithResult(_0x4e6bc5,null))[_0xb7a5('0x40')](handleError(_0x4e6bc5,null));};exports['destroy']=function(_0x19eb22,_0x514e03){return db[_0xb7a5('0x29')][_0xb7a5('0x43')]({'where':{'id':_0x19eb22['params']['id']}})['then'](handleEntityNotFound(_0x514e03,null))[_0xb7a5('0x1f')](removeEntity(_0x514e03,null))['catch'](handleError(_0x514e03,null));};exports[_0xb7a5('0x4d')]=function(_0x5474f5,_0x32be11,_0x221e47){var _0x9c30b3;return db[_0xb7a5('0x29')][_0xb7a5('0x43')]({'where':{'id':_0x5474f5[_0xb7a5('0x4c')]['id']},'attributes':['id','dsn']})['then'](handleEntityNotFound(_0x32be11,null))[_0xb7a5('0x1f')](function(_0x1fcb2e){if(_0x1fcb2e){var _0x1a569e=require(_0xb7a5('0x4e'))();_0x1a569e['openSync'](_0x1fcb2e[_0xb7a5('0x4f')]);_0x1a569e[_0xb7a5('0x50')]();return _0x1fcb2e;}})[_0xb7a5('0x1f')](respondWithResult(_0x32be11,null))['catch'](handleError(_0x32be11,null));}; \ No newline at end of file +var _0xb016=['moment','bluebird','mustache','util','to-csv','ejs','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','json','count','offset','limit','set','Content-Range','reject','save','update','then','get','ODBC','UserProfileResource','destroy','end','error','name','send','index','key','model','map','query','keys','intersection','attributes','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','merge','type','VIRTUAL','options','SquareOdbc','includeAll','include','findAll','rows','show','params','rawAttributes','find','catch','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','test','openSync','dsn','closeSync','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise'];(function(_0x3e6982,_0x5610c8){var _0x335538=function(_0x21cb2d){while(--_0x21cb2d){_0x3e6982['push'](_0x3e6982['shift']());}};_0x335538(++_0x5610c8);}(_0xb016,0x162));var _0x6b01=function(_0x7aa62b,_0x5a6e2c){_0x7aa62b=_0x7aa62b-0x0;var _0x3aff19=_0xb016[_0x7aa62b];return _0x3aff19;};'use strict';var pdf=require(_0x6b01('0x0'));var emlformat=require(_0x6b01('0x1'));var rimraf=require(_0x6b01('0x2'));var zipdir=require(_0x6b01('0x3'));var jsonpatch=require(_0x6b01('0x4'));var rp=require(_0x6b01('0x5'));var moment=require(_0x6b01('0x6'));var BPromise=require(_0x6b01('0x7'));var Mustache=require(_0x6b01('0x8'));var util=require(_0x6b01('0x9'));var path=require('path');var sox=require('sox');var csv=require(_0x6b01('0xa'));var ejs=require(_0x6b01('0xb'));var fs=require('fs');var _=require(_0x6b01('0xc'));var squel=require(_0x6b01('0xd'));var crypto=require('crypto');var jsforce=require(_0x6b01('0xe'));var deskjs=require(_0x6b01('0xf'));var toCsv=require(_0x6b01('0xa'));var querystring=require(_0x6b01('0x10'));var Papa=require(_0x6b01('0x11'));var Redis=require(_0x6b01('0x12'));var authService=require(_0x6b01('0x13'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x6b01('0x14'));var logger=require(_0x6b01('0x15'))(_0x6b01('0x16'));var utils=require(_0x6b01('0x17'));var config=require(_0x6b01('0x18'));var db=require(_0x6b01('0x19'))['db'];function respondWithStatusCode(_0x50e868,_0x104891){_0x104891=_0x104891||0xcc;return function(_0x14ca07){if(_0x14ca07){return _0x50e868[_0x6b01('0x1a')](_0x104891);}return _0x50e868[_0x6b01('0x1b')](_0x104891)['end']();};}function respondWithResult(_0x101af3,_0x3e219f){_0x3e219f=_0x3e219f||0xc8;return function(_0x31b9c9){if(_0x31b9c9){return _0x101af3[_0x6b01('0x1b')](_0x3e219f)[_0x6b01('0x1c')](_0x31b9c9);}};}function respondWithFilteredResult(_0x26e4c4,_0x337daf){return function(_0x174d78){if(_0x174d78){var _0x1a4c7d=_0x174d78[_0x6b01('0x1d')],_0x2c0fac=_0x337daf[_0x6b01('0x1e')],_0x41936d=_0x337daf[_0x6b01('0x1e')]+_0x337daf[_0x6b01('0x1f')],_0x22f934;if(_0x41936d>=_0x1a4c7d){_0x41936d=_0x1a4c7d;_0x22f934=0xc8;}else{_0x22f934=0xce;}_0x26e4c4[_0x6b01('0x1b')](_0x22f934);return _0x26e4c4[_0x6b01('0x20')](_0x6b01('0x21'),_0x2c0fac+'-'+_0x41936d+'/'+_0x1a4c7d)[_0x6b01('0x1c')](_0x174d78);}return null;};}function patchUpdates(_0x58a9ef){return function(_0x48486f){try{jsonpatch['apply'](_0x48486f,_0x58a9ef,!![]);}catch(_0x3bd8ae){return BPromise[_0x6b01('0x22')](_0x3bd8ae);}return _0x48486f[_0x6b01('0x23')]();};}function saveUpdates(_0x549769,_0x2f29c7){return function(_0x3c6235){if(_0x3c6235){return _0x3c6235[_0x6b01('0x24')](_0x549769)[_0x6b01('0x25')](function(_0x4d8a70){return _0x4d8a70;});}return null;};}function removeEntity(_0x234a80,_0x1a7f5b){return function(_0x7327f0){if(_0x7327f0){return _0x7327f0['destroy']()['then'](function(){var _0x28c778=_0x7327f0[_0x6b01('0x26')]({'plain':!![]});var _0x1c09c1=_0x6b01('0x27');return db[_0x6b01('0x28')][_0x6b01('0x29')]({'where':{'type':_0x1c09c1,'resourceId':_0x28c778['id']}})[_0x6b01('0x25')](function(){return _0x7327f0;});})[_0x6b01('0x25')](function(){_0x234a80[_0x6b01('0x1b')](0xcc)[_0x6b01('0x2a')]();});}};}function handleEntityNotFound(_0x570a8e,_0x1ec1ad){return function(_0x2307b4){if(!_0x2307b4){_0x570a8e[_0x6b01('0x1a')](0x194);}return _0x2307b4;};}function handleError(_0x5db233,_0x230161){_0x230161=_0x230161||0x1f4;return function(_0x1cdd95){logger[_0x6b01('0x2b')](_0x1cdd95['stack']);if(_0x1cdd95[_0x6b01('0x2c')]){delete _0x1cdd95[_0x6b01('0x2c')];}_0x5db233[_0x6b01('0x1b')](_0x230161)[_0x6b01('0x2d')](_0x1cdd95);};}exports[_0x6b01('0x2e')]=function(_0x275610,_0x54cf1c){var _0x158b5f={},_0x14a49f={},_0x5e1c3c={'count':0x0,'rows':[]};var _0x42cf46=_['map'](db['SquareOdbc']['rawAttributes'],function(_0x1bfb6c){return{'name':_0x1bfb6c['fieldName'],'type':_0x1bfb6c['type'][_0x6b01('0x2f')]};});_0x14a49f[_0x6b01('0x30')]=_[_0x6b01('0x31')](_0x42cf46,_0x6b01('0x2c'));_0x14a49f[_0x6b01('0x32')]=_[_0x6b01('0x33')](_0x275610['query']);_0x14a49f['filters']=_[_0x6b01('0x34')](_0x14a49f[_0x6b01('0x30')],_0x14a49f[_0x6b01('0x32')]);_0x158b5f[_0x6b01('0x35')]=_['intersection'](_0x14a49f[_0x6b01('0x30')],qs['fields'](_0x275610['query']['fields']));_0x158b5f[_0x6b01('0x35')]=_0x158b5f[_0x6b01('0x35')][_0x6b01('0x36')]?_0x158b5f['attributes']:_0x14a49f[_0x6b01('0x30')];if(!_0x275610[_0x6b01('0x32')][_0x6b01('0x37')](_0x6b01('0x38'))){_0x158b5f['limit']=qs[_0x6b01('0x1f')](_0x275610[_0x6b01('0x32')][_0x6b01('0x1f')]);_0x158b5f[_0x6b01('0x1e')]=qs[_0x6b01('0x1e')](_0x275610[_0x6b01('0x32')][_0x6b01('0x1e')]);}_0x158b5f[_0x6b01('0x39')]=qs[_0x6b01('0x3a')](_0x275610[_0x6b01('0x32')][_0x6b01('0x3a')]);_0x158b5f[_0x6b01('0x3b')]=qs[_0x6b01('0x3c')](_[_0x6b01('0x3d')](_0x275610[_0x6b01('0x32')],_0x14a49f['filters']));if(_0x275610['query'][_0x6b01('0x3e')]){_0x158b5f[_0x6b01('0x3b')]=_[_0x6b01('0x3f')](_0x158b5f[_0x6b01('0x3b')],{'$or':_[_0x6b01('0x31')](_0x42cf46,function(_0x5bbbe0){if(_0x5bbbe0[_0x6b01('0x40')]!==_0x6b01('0x41')){var _0xb5bb60={};_0xb5bb60[_0x5bbbe0[_0x6b01('0x2c')]]={'$like':'%'+_0x275610[_0x6b01('0x32')][_0x6b01('0x3e')]+'%'};return _0xb5bb60;}})});}_0x158b5f=_['merge']({},_0x158b5f,_0x275610[_0x6b01('0x42')]);var _0x53c5d0={'where':_0x158b5f['where']};return db[_0x6b01('0x43')][_0x6b01('0x1d')](_0x53c5d0)[_0x6b01('0x25')](function(_0xdfe259){_0x5e1c3c['count']=_0xdfe259;if(_0x275610[_0x6b01('0x32')][_0x6b01('0x44')]){_0x158b5f[_0x6b01('0x45')]=[{'all':!![]}];}return db[_0x6b01('0x43')][_0x6b01('0x46')](_0x158b5f);})[_0x6b01('0x25')](function(_0x568928){_0x5e1c3c[_0x6b01('0x47')]=_0x568928;return _0x5e1c3c;})[_0x6b01('0x25')](respondWithFilteredResult(_0x54cf1c,_0x158b5f))['catch'](handleError(_0x54cf1c,null));};exports[_0x6b01('0x48')]=function(_0x3b32d7,_0x25d84d){var _0x34d2bd={'raw':!![],'where':{'id':_0x3b32d7[_0x6b01('0x49')]['id']}},_0x22f84b={};_0x22f84b['model']=_[_0x6b01('0x33')](db[_0x6b01('0x43')][_0x6b01('0x4a')]);_0x22f84b['query']=_[_0x6b01('0x33')](_0x3b32d7[_0x6b01('0x32')]);_0x22f84b[_0x6b01('0x3c')]=_[_0x6b01('0x34')](_0x22f84b['model'],_0x22f84b[_0x6b01('0x32')]);_0x34d2bd['attributes']=_[_0x6b01('0x34')](_0x22f84b[_0x6b01('0x30')],qs['fields'](_0x3b32d7['query']['fields']));_0x34d2bd[_0x6b01('0x35')]=_0x34d2bd[_0x6b01('0x35')][_0x6b01('0x36')]?_0x34d2bd['attributes']:_0x22f84b[_0x6b01('0x30')];if(_0x3b32d7[_0x6b01('0x32')][_0x6b01('0x44')]){_0x34d2bd[_0x6b01('0x45')]=[{'all':!![]}];}_0x34d2bd=_['merge']({},_0x34d2bd,_0x3b32d7[_0x6b01('0x42')]);return db[_0x6b01('0x43')][_0x6b01('0x4b')](_0x34d2bd)[_0x6b01('0x25')](handleEntityNotFound(_0x25d84d,null))['then'](respondWithResult(_0x25d84d,null))[_0x6b01('0x4c')](handleError(_0x25d84d,null));};exports[_0x6b01('0x4d')]=function(_0x26d569,_0x163681){return db[_0x6b01('0x43')][_0x6b01('0x4d')](_0x26d569[_0x6b01('0x4e')],{})[_0x6b01('0x25')](function(_0x26f96c){var _0x26a360=_0x26d569[_0x6b01('0x4f')][_0x6b01('0x26')]({'plain':!![]});if(!_0x26a360)throw new Error(_0x6b01('0x50'));if(_0x26a360[_0x6b01('0x51')]===_0x6b01('0x4f')){var _0x455640=_0x26f96c[_0x6b01('0x26')]({'plain':!![]});var _0x36487d=_0x6b01('0x27');return db[_0x6b01('0x52')][_0x6b01('0x4b')]({'where':{'name':_0x36487d,'userProfileId':_0x26a360[_0x6b01('0x53')]},'raw':!![]})['then'](function(_0x47f0f7){if(_0x47f0f7&&_0x47f0f7[_0x6b01('0x54')]===0x0){return db[_0x6b01('0x28')][_0x6b01('0x4d')]({'name':_0x455640['name'],'resourceId':_0x455640['id'],'type':_0x47f0f7[_0x6b01('0x2c')],'sectionId':_0x47f0f7['id']},{})[_0x6b01('0x25')](function(){return _0x26f96c;});}else{return _0x26f96c;}})[_0x6b01('0x4c')](function(_0x1e3942){logger[_0x6b01('0x2b')](_0x6b01('0x55'),_0x1e3942);throw _0x1e3942;});}return _0x26f96c;})[_0x6b01('0x25')](respondWithResult(_0x163681,0xc9))[_0x6b01('0x4c')](handleError(_0x163681,null));};exports[_0x6b01('0x24')]=function(_0x1e6ae4,_0x28a8c4){if(_0x1e6ae4[_0x6b01('0x4e')]['id']){delete _0x1e6ae4[_0x6b01('0x4e')]['id'];}return db[_0x6b01('0x43')][_0x6b01('0x4b')]({'where':{'id':_0x1e6ae4[_0x6b01('0x49')]['id']}})[_0x6b01('0x25')](handleEntityNotFound(_0x28a8c4,null))[_0x6b01('0x25')](saveUpdates(_0x1e6ae4[_0x6b01('0x4e')],null))[_0x6b01('0x25')](respondWithResult(_0x28a8c4,null))['catch'](handleError(_0x28a8c4,null));};exports[_0x6b01('0x29')]=function(_0x10b887,_0x359787){return db[_0x6b01('0x43')][_0x6b01('0x4b')]({'where':{'id':_0x10b887['params']['id']}})['then'](handleEntityNotFound(_0x359787,null))[_0x6b01('0x25')](removeEntity(_0x359787,null))[_0x6b01('0x4c')](handleError(_0x359787,null));};exports[_0x6b01('0x56')]=function(_0x4ce40c,_0x2b26c3,_0x297c83){var _0x124e80;return db[_0x6b01('0x43')][_0x6b01('0x4b')]({'where':{'id':_0x4ce40c[_0x6b01('0x49')]['id']},'attributes':['id','dsn']})[_0x6b01('0x25')](handleEntityNotFound(_0x2b26c3,null))['then'](function(_0x10884b){if(_0x10884b){var _0x5799dd=require('odbc')();_0x5799dd[_0x6b01('0x57')](_0x10884b[_0x6b01('0x58')]);_0x5799dd[_0x6b01('0x59')]();return _0x10884b;}})[_0x6b01('0x25')](respondWithResult(_0x2b26c3,null))[_0x6b01('0x4c')](handleError(_0x2b26c3,null));}; \ No newline at end of file diff --git a/server/api/squareOdbc/squareOdbc.model.js b/server/api/squareOdbc/squareOdbc.model.js index d438d21..6180ed1 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 _0x7d4d=['api','moment','bluebird','request-promise','path','rimraf','exports','SquareOdbc','square_odbc','util','../../config/logger'];(function(_0x22c615,_0x18e7fe){var _0x1200e1=function(_0x5bb9cf){while(--_0x5bb9cf){_0x22c615['push'](_0x22c615['shift']());}};_0x1200e1(++_0x18e7fe);}(_0x7d4d,0x18a));var _0xd7d4=function(_0x4b2b03,_0xbf34ee){_0x4b2b03=_0x4b2b03-0x0;var _0x1bf0ed=_0x7d4d[_0x4b2b03];return _0x1bf0ed;};'use strict';var _=require('lodash');var util=require(_0xd7d4('0x0'));var logger=require(_0xd7d4('0x1'))(_0xd7d4('0x2'));var moment=require(_0xd7d4('0x3'));var BPromise=require(_0xd7d4('0x4'));var rp=require(_0xd7d4('0x5'));var fs=require('fs');var path=require(_0xd7d4('0x6'));var rimraf=require(_0xd7d4('0x7'));var config=require('../../config/environment');var attributes=require('./squareOdbc.attributes');module[_0xd7d4('0x8')]=function(_0x8c7f6e,_0x259cea){return _0x8c7f6e['define'](_0xd7d4('0x9'),attributes,{'tableName':_0xd7d4('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x29e2=['lodash','util','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./squareOdbc.attributes','exports','define'];(function(_0x59e821,_0x86c723){var _0x5333f6=function(_0x5dc2c9){while(--_0x5dc2c9){_0x59e821['push'](_0x59e821['shift']());}};_0x5333f6(++_0x86c723);}(_0x29e2,0xc0));var _0x229e=function(_0x1f4e33,_0x1d8ffa){_0x1f4e33=_0x1f4e33-0x0;var _0x33a16a=_0x29e2[_0x1f4e33];return _0x33a16a;};'use strict';var _=require(_0x229e('0x0'));var util=require(_0x229e('0x1'));var logger=require('../../config/logger')(_0x229e('0x2'));var moment=require(_0x229e('0x3'));var BPromise=require(_0x229e('0x4'));var rp=require(_0x229e('0x5'));var fs=require('fs');var path=require(_0x229e('0x6'));var rimraf=require(_0x229e('0x7'));var config=require(_0x229e('0x8'));var attributes=require(_0x229e('0x9'));module[_0x229e('0xa')]=function(_0x51ec0b,_0x6b790c){return _0x51ec0b[_0x229e('0xb')]('SquareOdbc',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 2ffe199..a2e05c3 100644 --- a/server/api/squareOdbc/squareOdbc.rpc.js +++ b/server/api/squareOdbc/squareOdbc.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x3e74=['catch','SquareOdbc','find','options','raw','where','attributes','include','map','model','then','ShowSquareOdbc','stringify','lodash','moment','bluebird','randomstring','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','request','request\x20sent','debug','error','SquareOdbc,\x20%s,\x20%s','message','info'];(function(_0x546895,_0xb414da){var _0x3b5a09=function(_0x1da01c){while(--_0x1da01c){_0x546895['push'](_0x546895['shift']());}};_0x3b5a09(++_0xb414da);}(_0x3e74,0x175));var _0x43e7=function(_0x210ff3,_0x337cb5){_0x210ff3=_0x210ff3-0x0;var _0x67ef7b=_0x3e74[_0x210ff3];return _0x67ef7b;};'use strict';var _=require(_0x43e7('0x0'));var util=require('util');var moment=require(_0x43e7('0x1'));var BPromise=require(_0x43e7('0x2'));var rs=require(_0x43e7('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x43e7('0x4'));var logger=require('../../config/logger')(_0x43e7('0x5'));var config=require(_0x43e7('0x6'));var jayson=require(_0x43e7('0x7'));var client=jayson[_0x43e7('0x8')][_0x43e7('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x503698,_0x45a0d1,_0x3491d6){return new BPromise(function(_0x2ede2d,_0x8528fc){return client[_0x43e7('0xa')](_0x503698,_0x3491d6)['then'](function(_0x212c6c){logger['info']('SquareOdbc,\x20%s,\x20%s',_0x45a0d1,_0x43e7('0xb'));logger[_0x43e7('0xc')]('SquareOdbc,\x20%s,\x20%s,\x20%s',_0x45a0d1,_0x43e7('0xb'),JSON['stringify'](_0x212c6c));if(_0x212c6c[_0x43e7('0xd')]){if(_0x212c6c[_0x43e7('0xd')]['code']===0x1f4){logger[_0x43e7('0xd')](_0x43e7('0xe'),_0x45a0d1,_0x212c6c[_0x43e7('0xd')][_0x43e7('0xf')]);return _0x8528fc(_0x212c6c['error']['message']);}logger[_0x43e7('0xd')](_0x43e7('0xe'),_0x45a0d1,_0x212c6c[_0x43e7('0xd')]['message']);return _0x2ede2d(_0x212c6c['error'][_0x43e7('0xf')]);}else{logger[_0x43e7('0x10')](_0x43e7('0xe'),_0x45a0d1,_0x43e7('0xb'));_0x2ede2d(_0x212c6c['result']['message']);}})[_0x43e7('0x11')](function(_0x264575){logger[_0x43e7('0xd')]('SquareOdbc,\x20%s,\x20%s',_0x45a0d1,_0x264575);_0x8528fc(_0x264575);});});}exports['ShowSquareOdbc']=function(_0x446986){var _0x1ca758=this;return new Promise(function(_0x9037d3,_0x140657){return db[_0x43e7('0x12')][_0x43e7('0x13')]({'raw':_0x446986[_0x43e7('0x14')]?_0x446986[_0x43e7('0x14')][_0x43e7('0x15')]===undefined?!![]:![]:!![],'where':_0x446986[_0x43e7('0x14')]?_0x446986[_0x43e7('0x14')][_0x43e7('0x16')]||null:null,'attributes':_0x446986['options']?_0x446986[_0x43e7('0x14')][_0x43e7('0x17')]||null:null,'include':_0x446986['options']?_0x446986[_0x43e7('0x14')][_0x43e7('0x18')]?_[_0x43e7('0x19')](_0x446986[_0x43e7('0x14')][_0x43e7('0x18')],function(_0x2f4cb4){return{'model':db[_0x2f4cb4['model']],'as':_0x2f4cb4['as'],'attributes':_0x2f4cb4[_0x43e7('0x17')],'include':_0x2f4cb4['include']?_['map'](_0x2f4cb4[_0x43e7('0x18')],function(_0x43f4ff){return{'model':db[_0x43f4ff['model']],'as':_0x43f4ff['as'],'attributes':_0x43f4ff[_0x43e7('0x17')],'include':_0x43f4ff['include']?_[_0x43e7('0x19')](_0x43f4ff['include'],function(_0x1af208){return{'model':db[_0x1af208[_0x43e7('0x1a')]],'as':_0x1af208['as'],'attributes':_0x1af208[_0x43e7('0x17')]};}):[]};}):[]};}):[]:[]})[_0x43e7('0x1b')](function(_0x51f4d7){logger['info'](_0x43e7('0x1c'),_0x446986);logger['debug'](_0x43e7('0x1c'),_0x446986,JSON[_0x43e7('0x1d')](_0x51f4d7));_0x9037d3(_0x51f4d7);})[_0x43e7('0x11')](function(_0xb1fc63){logger['error'](_0x43e7('0x1c'),_0xb1fc63[_0x43e7('0xf')],_0x446986);_0x140657(_0x1ca758[_0x43e7('0xd')](0x1f4,_0xb1fc63[_0x43e7('0xf')]));});});}; \ No newline at end of file +var _0x7217=['where','attributes','map','include','model','ShowSquareOdbc','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','rpc','../../config/environment','jayson/promise','client','http','request','then','info','SquareOdbc,\x20%s,\x20%s','debug','SquareOdbc,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','SquareOdbc','find','options','raw'];(function(_0x4cb23d,_0x2aa505){var _0x2a29e9=function(_0xfc1bc0){while(--_0xfc1bc0){_0x4cb23d['push'](_0x4cb23d['shift']());}};_0x2a29e9(++_0x2aa505);}(_0x7217,0x19e));var _0x7721=function(_0x2cfb58,_0x3d9412){_0x2cfb58=_0x2cfb58-0x0;var _0xd99951=_0x7217[_0x2cfb58];return _0xd99951;};'use strict';var _=require(_0x7721('0x0'));var util=require('util');var moment=require(_0x7721('0x1'));var BPromise=require(_0x7721('0x2'));var rs=require(_0x7721('0x3'));var fs=require('fs');var Redis=require(_0x7721('0x4'));var db=require(_0x7721('0x5'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x7721('0x6'));var config=require(_0x7721('0x7'));var jayson=require(_0x7721('0x8'));var client=jayson[_0x7721('0x9')][_0x7721('0xa')]({'port':0x232a});function respondWithRpcPromise(_0xf7ff37,_0x18ab6b,_0x21f680){return new BPromise(function(_0x225610,_0x2f99ed){return client[_0x7721('0xb')](_0xf7ff37,_0x21f680)[_0x7721('0xc')](function(_0xfa8835){logger[_0x7721('0xd')](_0x7721('0xe'),_0x18ab6b,'request\x20sent');logger[_0x7721('0xf')](_0x7721('0x10'),_0x18ab6b,_0x7721('0x11'),JSON[_0x7721('0x12')](_0xfa8835));if(_0xfa8835[_0x7721('0x13')]){if(_0xfa8835[_0x7721('0x13')][_0x7721('0x14')]===0x1f4){logger[_0x7721('0x13')]('SquareOdbc,\x20%s,\x20%s',_0x18ab6b,_0xfa8835[_0x7721('0x13')][_0x7721('0x15')]);return _0x2f99ed(_0xfa8835['error'][_0x7721('0x15')]);}logger[_0x7721('0x13')](_0x7721('0xe'),_0x18ab6b,_0xfa8835[_0x7721('0x13')]['message']);return _0x225610(_0xfa8835[_0x7721('0x13')][_0x7721('0x15')]);}else{logger['info']('SquareOdbc,\x20%s,\x20%s',_0x18ab6b,'request\x20sent');_0x225610(_0xfa8835[_0x7721('0x16')][_0x7721('0x15')]);}})[_0x7721('0x17')](function(_0x32550d){logger['error'](_0x7721('0xe'),_0x18ab6b,_0x32550d);_0x2f99ed(_0x32550d);});});}exports['ShowSquareOdbc']=function(_0x3fc09e){var _0x5cb0e6=this;return new Promise(function(_0xfec626,_0x4e96fb){return db[_0x7721('0x18')][_0x7721('0x19')]({'raw':_0x3fc09e[_0x7721('0x1a')]?_0x3fc09e[_0x7721('0x1a')][_0x7721('0x1b')]===undefined?!![]:![]:!![],'where':_0x3fc09e[_0x7721('0x1a')]?_0x3fc09e[_0x7721('0x1a')][_0x7721('0x1c')]||null:null,'attributes':_0x3fc09e['options']?_0x3fc09e[_0x7721('0x1a')][_0x7721('0x1d')]||null:null,'include':_0x3fc09e[_0x7721('0x1a')]?_0x3fc09e[_0x7721('0x1a')]['include']?_[_0x7721('0x1e')](_0x3fc09e['options'][_0x7721('0x1f')],function(_0x288e3a){return{'model':db[_0x288e3a[_0x7721('0x20')]],'as':_0x288e3a['as'],'attributes':_0x288e3a[_0x7721('0x1d')],'include':_0x288e3a[_0x7721('0x1f')]?_[_0x7721('0x1e')](_0x288e3a[_0x7721('0x1f')],function(_0x5b4d74){return{'model':db[_0x5b4d74[_0x7721('0x20')]],'as':_0x5b4d74['as'],'attributes':_0x5b4d74[_0x7721('0x1d')],'include':_0x5b4d74[_0x7721('0x1f')]?_[_0x7721('0x1e')](_0x5b4d74[_0x7721('0x1f')],function(_0x16355a){return{'model':db[_0x16355a[_0x7721('0x20')]],'as':_0x16355a['as'],'attributes':_0x16355a[_0x7721('0x1d')]};}):[]};}):[]};}):[]:[]})[_0x7721('0xc')](function(_0x52316e){logger[_0x7721('0xd')]('ShowSquareOdbc',_0x3fc09e);logger['debug'](_0x7721('0x21'),_0x3fc09e,JSON[_0x7721('0x12')](_0x52316e));_0xfec626(_0x52316e);})[_0x7721('0x17')](function(_0x158d98){logger[_0x7721('0x13')](_0x7721('0x21'),_0x158d98[_0x7721('0x15')],_0x3fc09e);_0x4e96fb(_0x5cb0e6[_0x7721('0x13')](0x1f4,_0x158d98['message']));});});}; \ No newline at end of file diff --git a/server/api/squareProject/index.js b/server/api/squareProject/index.js index 967d476..54431fd 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 _0xda3f=['../../components/auth/service','../../config/environment','./squareProject.controller','isAuthenticated','index','show','get','/:id/users','getUsers','post','create','put','/:id','update','delete','util','path'];(function(_0xbf5e16,_0x146ce3){var _0x5975a5=function(_0x2387a7){while(--_0x2387a7){_0xbf5e16['push'](_0xbf5e16['shift']());}};_0x5975a5(++_0x146ce3);}(_0xda3f,0xec));var _0xfda3=function(_0x32b588,_0xe13be0){_0x32b588=_0x32b588-0x0;var _0x257777=_0xda3f[_0x32b588];return _0x257777;};'use strict';var multer=require('multer');var util=require(_0xfda3('0x0'));var path=require(_0xfda3('0x1'));var timeout=require('connect-timeout');var express=require('express');var router=express['Router']();var auth=require(_0xfda3('0x2'));var interaction=require('../../components/interaction/service');var config=require(_0xfda3('0x3'));var controller=require(_0xfda3('0x4'));router['get']('/',auth[_0xfda3('0x5')](),controller[_0xfda3('0x6')]);router['get']('/:id',auth[_0xfda3('0x5')](),controller[_0xfda3('0x7')]);router[_0xfda3('0x8')](_0xfda3('0x9'),auth[_0xfda3('0x5')](),controller[_0xfda3('0xa')]);router[_0xfda3('0xb')]('/',auth[_0xfda3('0x5')](),controller[_0xfda3('0xc')]);router[_0xfda3('0xb')](_0xfda3('0x9'),auth[_0xfda3('0x5')](),controller['addUsers']);router[_0xfda3('0xd')](_0xfda3('0xe'),auth[_0xfda3('0x5')](),controller[_0xfda3('0xf')]);router[_0xfda3('0x10')]('/:id',auth[_0xfda3('0x5')](),controller['destroy']);router[_0xfda3('0x10')](_0xfda3('0x9'),auth['isAuthenticated'](),controller['removeUsers']);module['exports']=router; \ No newline at end of file +var _0xbdb7=['destroy','removeUsers','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','get','/:id','/:id/users','post','isAuthenticated','create','addUsers','put','delete'];(function(_0x689653,_0x125f5c){var _0x369885=function(_0x544b93){while(--_0x544b93){_0x689653['push'](_0x689653['shift']());}};_0x369885(++_0x125f5c);}(_0xbdb7,0x12e));var _0x7bdb=function(_0x3ea913,_0x255df2){_0x3ea913=_0x3ea913-0x0;var _0x2b4f28=_0xbdb7[_0x3ea913];return _0x2b4f28;};'use strict';var multer=require(_0x7bdb('0x0'));var util=require(_0x7bdb('0x1'));var path=require(_0x7bdb('0x2'));var timeout=require(_0x7bdb('0x3'));var express=require(_0x7bdb('0x4'));var router=express[_0x7bdb('0x5')]();var auth=require(_0x7bdb('0x6'));var interaction=require(_0x7bdb('0x7'));var config=require(_0x7bdb('0x8'));var controller=require('./squareProject.controller');router[_0x7bdb('0x9')]('/',auth['isAuthenticated'](),controller['index']);router[_0x7bdb('0x9')](_0x7bdb('0xa'),auth['isAuthenticated'](),controller['show']);router[_0x7bdb('0x9')](_0x7bdb('0xb'),auth['isAuthenticated'](),controller['getUsers']);router[_0x7bdb('0xc')]('/',auth[_0x7bdb('0xd')](),controller[_0x7bdb('0xe')]);router[_0x7bdb('0xc')](_0x7bdb('0xb'),auth[_0x7bdb('0xd')](),controller[_0x7bdb('0xf')]);router[_0x7bdb('0x10')]('/:id',auth['isAuthenticated'](),controller['update']);router[_0x7bdb('0x11')](_0x7bdb('0xa'),auth['isAuthenticated'](),controller[_0x7bdb('0x12')]);router['delete']('/:id/users',auth[_0x7bdb('0xd')](),controller[_0x7bdb('0x13')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/squareProject/squareProject.attributes.js b/server/api/squareProject/squareProject.attributes.js index 43d4877..3e5ab30 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 _0xa86a=['long','getDataValue','preproduction','toString','production','utf8','sequelize','STRING','BLOB'];(function(_0x349a9e,_0x473cb8){var _0x24c207=function(_0x22f148){while(--_0x22f148){_0x349a9e['push'](_0x349a9e['shift']());}};_0x24c207(++_0x473cb8);}(_0xa86a,0x72));var _0xaa86=function(_0x344c7c,_0x4ea093){_0x344c7c=_0x344c7c-0x0;var _0x12e843=_0xa86a[_0x344c7c];return _0x12e843;};'use strict';var Sequelize=require(_0xaa86('0x0'));module['exports']={'name':{'type':Sequelize[_0xaa86('0x1')],'unique':'name','allowNull':![]},'description':{'type':Sequelize[_0xaa86('0x1')]},'notes':{'type':Sequelize['TEXT']},'preproduction':{'type':Sequelize[_0xaa86('0x2')](_0xaa86('0x3')),'get':function(){if(this[_0xaa86('0x4')](_0xaa86('0x5'))){return this[_0xaa86('0x4')](_0xaa86('0x5'))[_0xaa86('0x6')]('utf8');}}},'production':{'type':Sequelize[_0xaa86('0x2')]('long'),'get':function(){if(this['getDataValue']('production')){return this[_0xaa86('0x4')](_0xaa86('0x7'))[_0xaa86('0x6')](_0xaa86('0x8'));}}}}; \ No newline at end of file +var _0xb0a6=['toString','exports','STRING','name','TEXT','BLOB','long','preproduction','getDataValue'];(function(_0x599f41,_0x4db732){var _0x2e4d58=function(_0x14c882){while(--_0x14c882){_0x599f41['push'](_0x599f41['shift']());}};_0x2e4d58(++_0x4db732);}(_0xb0a6,0xb5));var _0x6b0a=function(_0xffaaac,_0x264cbf){_0xffaaac=_0xffaaac-0x0;var _0x48e488=_0xb0a6[_0xffaaac];return _0x48e488;};'use strict';var Sequelize=require('sequelize');module[_0x6b0a('0x0')]={'name':{'type':Sequelize[_0x6b0a('0x1')],'unique':_0x6b0a('0x2'),'allowNull':![]},'description':{'type':Sequelize[_0x6b0a('0x1')]},'notes':{'type':Sequelize[_0x6b0a('0x3')]},'preproduction':{'type':Sequelize[_0x6b0a('0x4')](_0x6b0a('0x5')),'get':function(){if(this['getDataValue'](_0x6b0a('0x6'))){return this[_0x6b0a('0x7')]('preproduction')[_0x6b0a('0x8')]('utf8');}}},'production':{'type':Sequelize[_0x6b0a('0x4')](_0x6b0a('0x5')),'get':function(){if(this[_0x6b0a('0x7')]('production')){return this[_0x6b0a('0x7')]('production')[_0x6b0a('0x8')]('utf8');}}}}; \ No newline at end of file diff --git a/server/api/squareProject/squareProject.controller.js b/server/api/squareProject/squareProject.controller.js index bf880fc..c7ec6d4 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 _0xe13a=['path','sox','to-csv','ejs','lodash','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','redis','localhost','sendStatus','status','end','json','count','offset','set','apply','reject','then','get','SquareProjects','destroy','error','stack','name','send','index','map','SquareProject','rawAttributes','key','model','query','keys','filters','intersection','attributes','nolimit','limit','sort','where','filter','type','options','includeAll','findAll','rows','catch','show','params','fields','length','include','merge','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','addUsers','ids','removeUsers','isArray','emit','userSquareProject:remove','getUsers','findOne','User','order','pick','hasOwnProperty','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util'];(function(_0x4b369d,_0x265eb8){var _0x571a98=function(_0x56341a){while(--_0x56341a){_0x4b369d['push'](_0x4b369d['shift']());}};_0x571a98(++_0x265eb8);}(_0xe13a,0x178));var _0xae13=function(_0x1368be,_0x34b67e){_0x1368be=_0x1368be-0x0;var _0xb9892a=_0xe13a[_0x1368be];return _0xb9892a;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0xae13('0x0'));var rimraf=require(_0xae13('0x1'));var zipdir=require(_0xae13('0x2'));var jsonpatch=require(_0xae13('0x3'));var rp=require('request-promise');var moment=require(_0xae13('0x4'));var BPromise=require(_0xae13('0x5'));var Mustache=require(_0xae13('0x6'));var util=require(_0xae13('0x7'));var path=require(_0xae13('0x8'));var sox=require(_0xae13('0x9'));var csv=require(_0xae13('0xa'));var ejs=require(_0xae13('0xb'));var fs=require('fs');var _=require(_0xae13('0xc'));var squel=require('squel');var crypto=require(_0xae13('0xd'));var jsforce=require(_0xae13('0xe'));var deskjs=require(_0xae13('0xf'));var toCsv=require(_0xae13('0xa'));var querystring=require(_0xae13('0x10'));var Papa=require(_0xae13('0x11'));var Redis=require(_0xae13('0x12'));var authService=require(_0xae13('0x13'));var qs=require(_0xae13('0x14'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xae13('0x15'));var logger=require(_0xae13('0x16'))(_0xae13('0x17'));var utils=require(_0xae13('0x18'));var config=require(_0xae13('0x19'));var db=require(_0xae13('0x1a'))['db'];config[_0xae13('0x1b')]=_['defaults'](config[_0xae13('0x1b')],{'host':_0xae13('0x1c'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require('./squareProject.socket')['register'](socket);function respondWithStatusCode(_0x52484b,_0x26ff3e){_0x26ff3e=_0x26ff3e||0xcc;return function(_0x148186){if(_0x148186){return _0x52484b[_0xae13('0x1d')](_0x26ff3e);}return _0x52484b[_0xae13('0x1e')](_0x26ff3e)[_0xae13('0x1f')]();};}function respondWithResult(_0x2912a2,_0x5c25a4){_0x5c25a4=_0x5c25a4||0xc8;return function(_0x3c488f){if(_0x3c488f){return _0x2912a2['status'](_0x5c25a4)[_0xae13('0x20')](_0x3c488f);}};}function respondWithFilteredResult(_0x16764b,_0x207363){return function(_0x118e52){if(_0x118e52){var _0x1a9c07=_0x118e52[_0xae13('0x21')],_0x1b33b7=_0x207363['offset'],_0x32dcbe=_0x207363[_0xae13('0x22')]+_0x207363['limit'],_0x326471;if(_0x32dcbe>=_0x1a9c07){_0x32dcbe=_0x1a9c07;_0x326471=0xc8;}else{_0x326471=0xce;}_0x16764b[_0xae13('0x1e')](_0x326471);return _0x16764b[_0xae13('0x23')]('Content-Range',_0x1b33b7+'-'+_0x32dcbe+'/'+_0x1a9c07)[_0xae13('0x20')](_0x118e52);}return null;};}function patchUpdates(_0x39d41c){return function(_0x3e4bc8){try{jsonpatch[_0xae13('0x24')](_0x3e4bc8,_0x39d41c,!![]);}catch(_0x184375){return BPromise[_0xae13('0x25')](_0x184375);}return _0x3e4bc8['save']();};}function saveUpdates(_0x520692,_0x149eda){return function(_0x290fb9){if(_0x290fb9){return _0x290fb9['update'](_0x520692)[_0xae13('0x26')](function(_0x519a37){return _0x519a37;});}return null;};}function removeEntity(_0x13c2de,_0x194437){return function(_0x3f12b0){if(_0x3f12b0){return _0x3f12b0['destroy']()['then'](function(){var _0x4e38c3=_0x3f12b0[_0xae13('0x27')]({'plain':!![]});var _0xc5e6a7=_0xae13('0x28');return db['UserProfileResource'][_0xae13('0x29')]({'where':{'type':_0xc5e6a7,'resourceId':_0x4e38c3['id']}})['then'](function(){return _0x3f12b0;});})[_0xae13('0x26')](function(){_0x13c2de['status'](0xcc)[_0xae13('0x1f')]();});}};}function handleEntityNotFound(_0x3117c2,_0x526e4e){return function(_0xa98d6c){if(!_0xa98d6c){_0x3117c2[_0xae13('0x1d')](0x194);}return _0xa98d6c;};}function handleError(_0x64b40b,_0x306dfb){_0x306dfb=_0x306dfb||0x1f4;return function(_0x578e99){logger[_0xae13('0x2a')](_0x578e99[_0xae13('0x2b')]);if(_0x578e99[_0xae13('0x2c')]){delete _0x578e99[_0xae13('0x2c')];}_0x64b40b[_0xae13('0x1e')](_0x306dfb)[_0xae13('0x2d')](_0x578e99);};}exports[_0xae13('0x2e')]=function(_0x5bd0ee,_0x133481){var _0x591f94={},_0xf6289c={},_0x100df1={'count':0x0,'rows':[]};var _0x2dc2af=_[_0xae13('0x2f')](db[_0xae13('0x30')][_0xae13('0x31')],function(_0x11c2ba){return{'name':_0x11c2ba['fieldName'],'type':_0x11c2ba['type'][_0xae13('0x32')]};});_0xf6289c[_0xae13('0x33')]=_[_0xae13('0x2f')](_0x2dc2af,_0xae13('0x2c'));_0xf6289c[_0xae13('0x34')]=_[_0xae13('0x35')](_0x5bd0ee[_0xae13('0x34')]);_0xf6289c[_0xae13('0x36')]=_[_0xae13('0x37')](_0xf6289c[_0xae13('0x33')],_0xf6289c['query']);_0x591f94[_0xae13('0x38')]=_[_0xae13('0x37')](_0xf6289c[_0xae13('0x33')],qs['fields'](_0x5bd0ee['query']['fields']));_0x591f94['attributes']=_0x591f94['attributes']['length']?_0x591f94[_0xae13('0x38')]:_0xf6289c[_0xae13('0x33')];if(!_0x5bd0ee[_0xae13('0x34')]['hasOwnProperty'](_0xae13('0x39'))){_0x591f94[_0xae13('0x3a')]=qs[_0xae13('0x3a')](_0x5bd0ee[_0xae13('0x34')][_0xae13('0x3a')]);_0x591f94['offset']=qs[_0xae13('0x22')](_0x5bd0ee[_0xae13('0x34')][_0xae13('0x22')]);}_0x591f94['order']=qs['sort'](_0x5bd0ee[_0xae13('0x34')][_0xae13('0x3b')]);_0x591f94[_0xae13('0x3c')]=qs[_0xae13('0x36')](_['pick'](_0x5bd0ee[_0xae13('0x34')],_0xf6289c[_0xae13('0x36')]));if(_0x5bd0ee['query'][_0xae13('0x3d')]){_0x591f94[_0xae13('0x3c')]=_['merge'](_0x591f94[_0xae13('0x3c')],{'$or':_[_0xae13('0x2f')](_0x2dc2af,function(_0x3d3569){if(_0x3d3569[_0xae13('0x3e')]!=='VIRTUAL'){var _0x20e4ec={};_0x20e4ec[_0x3d3569[_0xae13('0x2c')]]={'$like':'%'+_0x5bd0ee[_0xae13('0x34')][_0xae13('0x3d')]+'%'};return _0x20e4ec;}})});}_0x591f94=_['merge']({},_0x591f94,_0x5bd0ee[_0xae13('0x3f')]);var _0x38b410={'where':_0x591f94[_0xae13('0x3c')]};return db[_0xae13('0x30')]['count'](_0x38b410)['then'](function(_0x34bf8b){_0x100df1[_0xae13('0x21')]=_0x34bf8b;if(_0x5bd0ee['query'][_0xae13('0x40')]){_0x591f94['include']=[{'all':!![]}];}return db[_0xae13('0x30')][_0xae13('0x41')](_0x591f94);})[_0xae13('0x26')](function(_0x4a08eb){_0x100df1[_0xae13('0x42')]=_0x4a08eb;return _0x100df1;})[_0xae13('0x26')](respondWithFilteredResult(_0x133481,_0x591f94))[_0xae13('0x43')](handleError(_0x133481,null));};exports[_0xae13('0x44')]=function(_0x5553e9,_0x3ac42d){var _0x36a3c4={'raw':![],'where':{'id':_0x5553e9[_0xae13('0x45')]['id']}},_0x133f00={};_0x133f00[_0xae13('0x33')]=_[_0xae13('0x35')](db[_0xae13('0x30')][_0xae13('0x31')]);_0x133f00['query']=_[_0xae13('0x35')](_0x5553e9['query']);_0x133f00[_0xae13('0x36')]=_[_0xae13('0x37')](_0x133f00[_0xae13('0x33')],_0x133f00[_0xae13('0x34')]);_0x36a3c4['attributes']=_[_0xae13('0x37')](_0x133f00['model'],qs[_0xae13('0x46')](_0x5553e9[_0xae13('0x34')]['fields']));_0x36a3c4[_0xae13('0x38')]=_0x36a3c4[_0xae13('0x38')][_0xae13('0x47')]?_0x36a3c4[_0xae13('0x38')]:_0x133f00[_0xae13('0x33')];if(_0x5553e9[_0xae13('0x34')]['includeAll']){_0x36a3c4[_0xae13('0x48')]=[{'all':!![]}];}_0x36a3c4=_[_0xae13('0x49')]({},_0x36a3c4,_0x5553e9[_0xae13('0x3f')]);return db[_0xae13('0x30')][_0xae13('0x4a')](_0x36a3c4)['then'](handleEntityNotFound(_0x3ac42d,null))[_0xae13('0x26')](respondWithResult(_0x3ac42d,null))[_0xae13('0x43')](handleError(_0x3ac42d,null));};exports[_0xae13('0x4b')]=function(_0x551ed6,_0x5a9743){return db['SquareProject']['create'](_0x551ed6[_0xae13('0x4c')],{})['then'](function(_0x2db53a){var _0x5554a6=_0x551ed6[_0xae13('0x4d')][_0xae13('0x27')]({'plain':!![]});if(!_0x5554a6)throw new Error(_0xae13('0x4e'));if(_0x5554a6[_0xae13('0x4f')]===_0xae13('0x4d')){var _0x53d341=_0x2db53a[_0xae13('0x27')]({'plain':!![]});var _0x2560f1='SquareProjects';return db[_0xae13('0x50')][_0xae13('0x4a')]({'where':{'name':_0x2560f1,'userProfileId':_0x5554a6['userProfileId']},'raw':!![]})['then'](function(_0x5b2125){if(_0x5b2125&&_0x5b2125['autoAssociation']===0x0){return db[_0xae13('0x51')][_0xae13('0x4b')]({'name':_0x53d341['name'],'resourceId':_0x53d341['id'],'type':_0x5b2125[_0xae13('0x2c')],'sectionId':_0x5b2125['id']},{})[_0xae13('0x26')](function(){return _0x2db53a;});}else{return _0x2db53a;}})['catch'](function(_0x378f66){logger[_0xae13('0x2a')](_0xae13('0x52'),_0x378f66);throw _0x378f66;});}return _0x2db53a;})[_0xae13('0x26')](respondWithResult(_0x5a9743,0xc9))[_0xae13('0x43')](handleError(_0x5a9743,null));};exports[_0xae13('0x53')]=function(_0x2ac400,_0x3d86ad){if(_0x2ac400[_0xae13('0x4c')]['id']){delete _0x2ac400[_0xae13('0x4c')]['id'];}return db['SquareProject'][_0xae13('0x4a')]({'where':{'id':_0x2ac400[_0xae13('0x45')]['id']}})[_0xae13('0x26')](handleEntityNotFound(_0x3d86ad,null))['then'](saveUpdates(_0x2ac400[_0xae13('0x4c')],null))['then'](respondWithResult(_0x3d86ad,null))[_0xae13('0x43')](handleError(_0x3d86ad,null));};exports[_0xae13('0x29')]=function(_0xd76dc7,_0x5b61e0){return db['SquareProject'][_0xae13('0x4a')]({'where':{'id':_0xd76dc7[_0xae13('0x45')]['id']}})[_0xae13('0x26')](handleEntityNotFound(_0x5b61e0,null))[_0xae13('0x26')](removeEntity(_0x5b61e0,null))[_0xae13('0x43')](handleError(_0x5b61e0,null));};exports[_0xae13('0x54')]=function(_0x3b9840,_0x4995d9,_0x1a653e){return db[_0xae13('0x30')][_0xae13('0x4a')]({'where':{'id':_0x3b9840[_0xae13('0x45')]['id']}})[_0xae13('0x26')](handleEntityNotFound(_0x4995d9,null))[_0xae13('0x26')](function(_0x14f543){if(_0x14f543){return _0x14f543['addUsers'](_0x3b9840[_0xae13('0x4c')][_0xae13('0x55')],_['omit'](_0x3b9840[_0xae13('0x4c')],[_0xae13('0x55'),'id'])||{});}})[_0xae13('0x26')](respondWithResult(_0x4995d9,null))['catch'](handleError(_0x4995d9,null));};exports[_0xae13('0x56')]=function(_0x7fa6c5,_0x50166a,_0x3ee96f){return db[_0xae13('0x30')][_0xae13('0x4a')]({'where':{'id':_0x7fa6c5[_0xae13('0x45')]['id']}})[_0xae13('0x26')](handleEntityNotFound(_0x50166a,null))[_0xae13('0x26')](function(_0x5309a3){if(_0x5309a3){return _0x5309a3['removeUsers'](_0x7fa6c5[_0xae13('0x34')][_0xae13('0x55')])[_0xae13('0x26')](function(){if(_[_0xae13('0x57')](_0x7fa6c5[_0xae13('0x34')][_0xae13('0x55')])){for(var _0x47d84e=0x0;_0x47d84e<_0x7fa6c5[_0xae13('0x34')][_0xae13('0x55')]['length'];_0x47d84e+=0x1){socket['emit']('userSquareProject:remove',{'UserId':Number(_0x7fa6c5[_0xae13('0x34')][_0xae13('0x55')][_0x47d84e]),'SquareProjectId':Number(_0x7fa6c5[_0xae13('0x45')]['id'])});}}else{socket[_0xae13('0x58')](_0xae13('0x59'),{'UserId':Number(_0x7fa6c5[_0xae13('0x34')][_0xae13('0x55')]),'SquareProjectId':Number(_0x7fa6c5[_0xae13('0x45')]['id'])});}});}})[_0xae13('0x26')](respondWithStatusCode(_0x50166a,null))[_0xae13('0x43')](handleError(_0x50166a,null));};exports[_0xae13('0x5a')]=function(_0x28bb14,_0x177e9e,_0x276be5){var _0xc3ef7d={};var _0x4e623b={};var _0x1522c6;var _0x259f12;return db['SquareProject'][_0xae13('0x5b')]({'where':{'id':_0x28bb14['params']['id']}})['then'](handleEntityNotFound(_0x177e9e,null))[_0xae13('0x26')](function(_0x25cc60){if(_0x25cc60){_0x1522c6=_0x25cc60;_0x4e623b[_0xae13('0x33')]=_[_0xae13('0x35')](db[_0xae13('0x5c')][_0xae13('0x31')]);_0x4e623b['query']=_['keys'](_0x28bb14[_0xae13('0x34')]);_0x4e623b[_0xae13('0x36')]=_[_0xae13('0x37')](_0x4e623b['model'],_0x4e623b[_0xae13('0x34')]);_0xc3ef7d['attributes']=_[_0xae13('0x37')](_0x4e623b[_0xae13('0x33')],qs[_0xae13('0x46')](_0x28bb14[_0xae13('0x34')][_0xae13('0x46')]));_0xc3ef7d['attributes']=_0xc3ef7d[_0xae13('0x38')][_0xae13('0x47')]?_0xc3ef7d['attributes']:_0x4e623b[_0xae13('0x33')];_0xc3ef7d[_0xae13('0x5d')]=qs[_0xae13('0x3b')](_0x28bb14[_0xae13('0x34')][_0xae13('0x3b')]);_0xc3ef7d[_0xae13('0x3c')]=qs['filters'](_[_0xae13('0x5e')](_0x28bb14['query'],_0x4e623b[_0xae13('0x36')]));if(_0x28bb14['query'][_0xae13('0x3d')]){_0xc3ef7d[_0xae13('0x3c')]=_['merge'](_0xc3ef7d[_0xae13('0x3c')],{'$or':_[_0xae13('0x2f')](_0xc3ef7d[_0xae13('0x38')],function(_0xb00dd6){var _0x1f4eeb={};_0x1f4eeb[_0xb00dd6]={'$like':'%'+_0x28bb14[_0xae13('0x34')][_0xae13('0x3d')]+'%'};return _0x1f4eeb;})});}_0xc3ef7d=_[_0xae13('0x49')]({},_0xc3ef7d,_0x28bb14['options']);return _0x1522c6[_0xae13('0x5a')](_0xc3ef7d);}})[_0xae13('0x26')](function(_0x3a67f5){if(_0x3a67f5){_0x259f12=_0x3a67f5[_0xae13('0x47')];if(!_0x28bb14[_0xae13('0x34')][_0xae13('0x5f')](_0xae13('0x39'))){_0xc3ef7d[_0xae13('0x3a')]=qs[_0xae13('0x3a')](_0x28bb14[_0xae13('0x34')]['limit']);_0xc3ef7d[_0xae13('0x22')]=qs['offset'](_0x28bb14['query'][_0xae13('0x22')]);}return _0x1522c6[_0xae13('0x5a')](_0xc3ef7d);}})[_0xae13('0x26')](function(_0x4842ab){if(_0x4842ab){return _0x4842ab?{'count':_0x259f12,'rows':_0x4842ab}:null;}})[_0xae13('0x26')](respondWithResult(_0x177e9e,null))['catch'](handleError(_0x177e9e,null));}; \ No newline at end of file +var _0x2f68=['Content-Range','apply','save','destroy','then','get','error','stack','name','send','index','map','SquareProject','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','where','merge','VIRTUAL','filter','include','findAll','rows','catch','show','params','options','find','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','SquareProjects','userProfileId','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','addUsers','omit','removeUsers','ids','emit','userSquareProject:remove','findOne','User','order','pick','getUsers','eml-format','rimraf','zip-dir','fast-json-patch','moment','mustache','util','sox','to-csv','squel','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','end','status','json','count','offset','limit','set'];(function(_0x42cae2,_0x284ef8){var _0x5f256f=function(_0x41abc8){while(--_0x41abc8){_0x42cae2['push'](_0x42cae2['shift']());}};_0x5f256f(++_0x284ef8);}(_0x2f68,0x9a));var _0x82f6=function(_0x473a94,_0x392ec7){_0x473a94=_0x473a94-0x0;var _0x357697=_0x2f68[_0x473a94];return _0x357697;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x82f6('0x0'));var rimraf=require(_0x82f6('0x1'));var zipdir=require(_0x82f6('0x2'));var jsonpatch=require(_0x82f6('0x3'));var rp=require('request-promise');var moment=require(_0x82f6('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x82f6('0x5'));var util=require(_0x82f6('0x6'));var path=require('path');var sox=require(_0x82f6('0x7'));var csv=require(_0x82f6('0x8'));var ejs=require('ejs');var fs=require('fs');var _=require('lodash');var squel=require(_0x82f6('0x9'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x82f6('0xa'));var toCsv=require(_0x82f6('0x8'));var querystring=require(_0x82f6('0xb'));var Papa=require('papaparse');var Redis=require(_0x82f6('0xc'));var authService=require(_0x82f6('0xd'));var qs=require('../../components/parsers/qs');var as=require(_0x82f6('0xe'));var hardwareService=require(_0x82f6('0xf'));var logger=require(_0x82f6('0x10'))(_0x82f6('0x11'));var utils=require(_0x82f6('0x12'));var config=require(_0x82f6('0x13'));var db=require('../../mysqldb')['db'];config[_0x82f6('0x14')]=_[_0x82f6('0x15')](config['redis'],{'host':_0x82f6('0x16'),'port':0x18eb});var socket=require(_0x82f6('0x17'))(new Redis(config[_0x82f6('0x14')]));require(_0x82f6('0x18'))[_0x82f6('0x19')](socket);function respondWithStatusCode(_0xa00275,_0x115c7b){_0x115c7b=_0x115c7b||0xcc;return function(_0x171815){if(_0x171815){return _0xa00275[_0x82f6('0x1a')](_0x115c7b);}return _0xa00275['status'](_0x115c7b)[_0x82f6('0x1b')]();};}function respondWithResult(_0x5d0827,_0x249222){_0x249222=_0x249222||0xc8;return function(_0x1d0263){if(_0x1d0263){return _0x5d0827[_0x82f6('0x1c')](_0x249222)[_0x82f6('0x1d')](_0x1d0263);}};}function respondWithFilteredResult(_0x18e8dd,_0x2326ae){return function(_0x326378){if(_0x326378){var _0xcbc95f=_0x326378[_0x82f6('0x1e')],_0x4072f0=_0x2326ae[_0x82f6('0x1f')],_0x2bfd57=_0x2326ae[_0x82f6('0x1f')]+_0x2326ae[_0x82f6('0x20')],_0x1c79f9;if(_0x2bfd57>=_0xcbc95f){_0x2bfd57=_0xcbc95f;_0x1c79f9=0xc8;}else{_0x1c79f9=0xce;}_0x18e8dd['status'](_0x1c79f9);return _0x18e8dd[_0x82f6('0x21')](_0x82f6('0x22'),_0x4072f0+'-'+_0x2bfd57+'/'+_0xcbc95f)['json'](_0x326378);}return null;};}function patchUpdates(_0x2b03ad){return function(_0x4b9f0){try{jsonpatch[_0x82f6('0x23')](_0x4b9f0,_0x2b03ad,!![]);}catch(_0x25cae6){return BPromise['reject'](_0x25cae6);}return _0x4b9f0[_0x82f6('0x24')]();};}function saveUpdates(_0x4beccf,_0x8668bb){return function(_0x2a0ce6){if(_0x2a0ce6){return _0x2a0ce6['update'](_0x4beccf)['then'](function(_0x3af5f7){return _0x3af5f7;});}return null;};}function removeEntity(_0x1d96d5,_0x4c57c5){return function(_0x5a5059){if(_0x5a5059){return _0x5a5059[_0x82f6('0x25')]()[_0x82f6('0x26')](function(){var _0x4fbd92=_0x5a5059[_0x82f6('0x27')]({'plain':!![]});var _0x304e83='SquareProjects';return db['UserProfileResource'][_0x82f6('0x25')]({'where':{'type':_0x304e83,'resourceId':_0x4fbd92['id']}})['then'](function(){return _0x5a5059;});})[_0x82f6('0x26')](function(){_0x1d96d5[_0x82f6('0x1c')](0xcc)['end']();});}};}function handleEntityNotFound(_0x3795ef,_0x15c9b7){return function(_0x33ef08){if(!_0x33ef08){_0x3795ef[_0x82f6('0x1a')](0x194);}return _0x33ef08;};}function handleError(_0x4f9fa4,_0x40a071){_0x40a071=_0x40a071||0x1f4;return function(_0x1fb461){logger[_0x82f6('0x28')](_0x1fb461[_0x82f6('0x29')]);if(_0x1fb461[_0x82f6('0x2a')]){delete _0x1fb461[_0x82f6('0x2a')];}_0x4f9fa4[_0x82f6('0x1c')](_0x40a071)[_0x82f6('0x2b')](_0x1fb461);};}exports[_0x82f6('0x2c')]=function(_0x402449,_0x3c9419){var _0x20d1c5={},_0x6ce179={},_0x91117b={'count':0x0,'rows':[]};var _0x51e080=_[_0x82f6('0x2d')](db[_0x82f6('0x2e')][_0x82f6('0x2f')],function(_0x5a51b4){return{'name':_0x5a51b4[_0x82f6('0x30')],'type':_0x5a51b4[_0x82f6('0x31')][_0x82f6('0x32')]};});_0x6ce179[_0x82f6('0x33')]=_[_0x82f6('0x2d')](_0x51e080,_0x82f6('0x2a'));_0x6ce179[_0x82f6('0x34')]=_[_0x82f6('0x35')](_0x402449[_0x82f6('0x34')]);_0x6ce179[_0x82f6('0x36')]=_[_0x82f6('0x37')](_0x6ce179[_0x82f6('0x33')],_0x6ce179[_0x82f6('0x34')]);_0x20d1c5[_0x82f6('0x38')]=_['intersection'](_0x6ce179[_0x82f6('0x33')],qs[_0x82f6('0x39')](_0x402449[_0x82f6('0x34')][_0x82f6('0x39')]));_0x20d1c5[_0x82f6('0x38')]=_0x20d1c5[_0x82f6('0x38')][_0x82f6('0x3a')]?_0x20d1c5[_0x82f6('0x38')]:_0x6ce179[_0x82f6('0x33')];if(!_0x402449[_0x82f6('0x34')][_0x82f6('0x3b')](_0x82f6('0x3c'))){_0x20d1c5[_0x82f6('0x20')]=qs[_0x82f6('0x20')](_0x402449['query'][_0x82f6('0x20')]);_0x20d1c5['offset']=qs['offset'](_0x402449[_0x82f6('0x34')][_0x82f6('0x1f')]);}_0x20d1c5['order']=qs[_0x82f6('0x3d')](_0x402449[_0x82f6('0x34')][_0x82f6('0x3d')]);_0x20d1c5['where']=qs[_0x82f6('0x36')](_['pick'](_0x402449[_0x82f6('0x34')],_0x6ce179['filters']));if(_0x402449[_0x82f6('0x34')]['filter']){_0x20d1c5[_0x82f6('0x3e')]=_[_0x82f6('0x3f')](_0x20d1c5['where'],{'$or':_[_0x82f6('0x2d')](_0x51e080,function(_0x368c11){if(_0x368c11[_0x82f6('0x31')]!==_0x82f6('0x40')){var _0x51af8f={};_0x51af8f[_0x368c11[_0x82f6('0x2a')]]={'$like':'%'+_0x402449[_0x82f6('0x34')][_0x82f6('0x41')]+'%'};return _0x51af8f;}})});}_0x20d1c5=_[_0x82f6('0x3f')]({},_0x20d1c5,_0x402449['options']);var _0x15b66d={'where':_0x20d1c5[_0x82f6('0x3e')]};return db['SquareProject'][_0x82f6('0x1e')](_0x15b66d)[_0x82f6('0x26')](function(_0x2d7509){_0x91117b[_0x82f6('0x1e')]=_0x2d7509;if(_0x402449[_0x82f6('0x34')]['includeAll']){_0x20d1c5[_0x82f6('0x42')]=[{'all':!![]}];}return db['SquareProject'][_0x82f6('0x43')](_0x20d1c5);})[_0x82f6('0x26')](function(_0x32d6b5){_0x91117b[_0x82f6('0x44')]=_0x32d6b5;return _0x91117b;})[_0x82f6('0x26')](respondWithFilteredResult(_0x3c9419,_0x20d1c5))[_0x82f6('0x45')](handleError(_0x3c9419,null));};exports[_0x82f6('0x46')]=function(_0x47a0d1,_0x165493){var _0x297cda={'raw':![],'where':{'id':_0x47a0d1[_0x82f6('0x47')]['id']}},_0x274736={};_0x274736['model']=_[_0x82f6('0x35')](db['SquareProject'][_0x82f6('0x2f')]);_0x274736[_0x82f6('0x34')]=_[_0x82f6('0x35')](_0x47a0d1[_0x82f6('0x34')]);_0x274736[_0x82f6('0x36')]=_[_0x82f6('0x37')](_0x274736['model'],_0x274736[_0x82f6('0x34')]);_0x297cda[_0x82f6('0x38')]=_[_0x82f6('0x37')](_0x274736[_0x82f6('0x33')],qs[_0x82f6('0x39')](_0x47a0d1[_0x82f6('0x34')][_0x82f6('0x39')]));_0x297cda[_0x82f6('0x38')]=_0x297cda['attributes'][_0x82f6('0x3a')]?_0x297cda[_0x82f6('0x38')]:_0x274736['model'];if(_0x47a0d1[_0x82f6('0x34')]['includeAll']){_0x297cda[_0x82f6('0x42')]=[{'all':!![]}];}_0x297cda=_['merge']({},_0x297cda,_0x47a0d1[_0x82f6('0x48')]);return db[_0x82f6('0x2e')][_0x82f6('0x49')](_0x297cda)[_0x82f6('0x26')](handleEntityNotFound(_0x165493,null))[_0x82f6('0x26')](respondWithResult(_0x165493,null))[_0x82f6('0x45')](handleError(_0x165493,null));};exports['create']=function(_0x3cb1f0,_0xdc77ca){return db['SquareProject']['create'](_0x3cb1f0[_0x82f6('0x4a')],{})[_0x82f6('0x26')](function(_0x2c2b64){var _0x596360=_0x3cb1f0[_0x82f6('0x4b')][_0x82f6('0x27')]({'plain':!![]});if(!_0x596360)throw new Error(_0x82f6('0x4c'));if(_0x596360[_0x82f6('0x4d')]==='user'){var _0x495400=_0x2c2b64[_0x82f6('0x27')]({'plain':!![]});var _0x1d56e7=_0x82f6('0x4e');return db['UserProfileSection'][_0x82f6('0x49')]({'where':{'name':_0x1d56e7,'userProfileId':_0x596360[_0x82f6('0x4f')]},'raw':!![]})['then'](function(_0x4f0ef7){if(_0x4f0ef7&&_0x4f0ef7['autoAssociation']===0x0){return db[_0x82f6('0x50')]['create']({'name':_0x495400[_0x82f6('0x2a')],'resourceId':_0x495400['id'],'type':_0x4f0ef7['name'],'sectionId':_0x4f0ef7['id']},{})[_0x82f6('0x26')](function(){return _0x2c2b64;});}else{return _0x2c2b64;}})['catch'](function(_0x9fae5a){logger['error'](_0x82f6('0x51'),_0x9fae5a);throw _0x9fae5a;});}return _0x2c2b64;})[_0x82f6('0x26')](respondWithResult(_0xdc77ca,0xc9))[_0x82f6('0x45')](handleError(_0xdc77ca,null));};exports[_0x82f6('0x52')]=function(_0xb8d7d8,_0x45f2f9){if(_0xb8d7d8['body']['id']){delete _0xb8d7d8[_0x82f6('0x4a')]['id'];}return db[_0x82f6('0x2e')][_0x82f6('0x49')]({'where':{'id':_0xb8d7d8['params']['id']}})['then'](handleEntityNotFound(_0x45f2f9,null))[_0x82f6('0x26')](saveUpdates(_0xb8d7d8[_0x82f6('0x4a')],null))[_0x82f6('0x26')](respondWithResult(_0x45f2f9,null))[_0x82f6('0x45')](handleError(_0x45f2f9,null));};exports['destroy']=function(_0x2c1c0e,_0x355823){return db[_0x82f6('0x2e')]['find']({'where':{'id':_0x2c1c0e['params']['id']}})['then'](handleEntityNotFound(_0x355823,null))[_0x82f6('0x26')](removeEntity(_0x355823,null))[_0x82f6('0x45')](handleError(_0x355823,null));};exports[_0x82f6('0x53')]=function(_0x59176d,_0x4013f0,_0x26c1d8){return db[_0x82f6('0x2e')][_0x82f6('0x49')]({'where':{'id':_0x59176d['params']['id']}})[_0x82f6('0x26')](handleEntityNotFound(_0x4013f0,null))[_0x82f6('0x26')](function(_0x12a5b9){if(_0x12a5b9){return _0x12a5b9[_0x82f6('0x53')](_0x59176d['body']['ids'],_[_0x82f6('0x54')](_0x59176d[_0x82f6('0x4a')],['ids','id'])||{});}})[_0x82f6('0x26')](respondWithResult(_0x4013f0,null))[_0x82f6('0x45')](handleError(_0x4013f0,null));};exports[_0x82f6('0x55')]=function(_0x5b3aaa,_0x32fa83,_0x195088){return db[_0x82f6('0x2e')][_0x82f6('0x49')]({'where':{'id':_0x5b3aaa[_0x82f6('0x47')]['id']}})[_0x82f6('0x26')](handleEntityNotFound(_0x32fa83,null))['then'](function(_0x3633f8){if(_0x3633f8){return _0x3633f8[_0x82f6('0x55')](_0x5b3aaa[_0x82f6('0x34')][_0x82f6('0x56')])[_0x82f6('0x26')](function(){if(_['isArray'](_0x5b3aaa[_0x82f6('0x34')][_0x82f6('0x56')])){for(var _0x182ad8=0x0;_0x182ad8<_0x5b3aaa[_0x82f6('0x34')][_0x82f6('0x56')][_0x82f6('0x3a')];_0x182ad8+=0x1){socket[_0x82f6('0x57')](_0x82f6('0x58'),{'UserId':Number(_0x5b3aaa['query'][_0x82f6('0x56')][_0x182ad8]),'SquareProjectId':Number(_0x5b3aaa['params']['id'])});}}else{socket[_0x82f6('0x57')](_0x82f6('0x58'),{'UserId':Number(_0x5b3aaa['query'][_0x82f6('0x56')]),'SquareProjectId':Number(_0x5b3aaa[_0x82f6('0x47')]['id'])});}});}})[_0x82f6('0x26')](respondWithStatusCode(_0x32fa83,null))['catch'](handleError(_0x32fa83,null));};exports['getUsers']=function(_0x140dcd,_0x31f3cc,_0x58b96b){var _0x4fdbdf={};var _0x4374c3={};var _0x18a458;var _0x1c37d2;return db[_0x82f6('0x2e')][_0x82f6('0x59')]({'where':{'id':_0x140dcd[_0x82f6('0x47')]['id']}})[_0x82f6('0x26')](handleEntityNotFound(_0x31f3cc,null))[_0x82f6('0x26')](function(_0x2d0d7c){if(_0x2d0d7c){_0x18a458=_0x2d0d7c;_0x4374c3[_0x82f6('0x33')]=_[_0x82f6('0x35')](db[_0x82f6('0x5a')]['rawAttributes']);_0x4374c3[_0x82f6('0x34')]=_[_0x82f6('0x35')](_0x140dcd[_0x82f6('0x34')]);_0x4374c3[_0x82f6('0x36')]=_[_0x82f6('0x37')](_0x4374c3['model'],_0x4374c3[_0x82f6('0x34')]);_0x4fdbdf[_0x82f6('0x38')]=_[_0x82f6('0x37')](_0x4374c3['model'],qs[_0x82f6('0x39')](_0x140dcd[_0x82f6('0x34')][_0x82f6('0x39')]));_0x4fdbdf[_0x82f6('0x38')]=_0x4fdbdf[_0x82f6('0x38')][_0x82f6('0x3a')]?_0x4fdbdf[_0x82f6('0x38')]:_0x4374c3['model'];_0x4fdbdf[_0x82f6('0x5b')]=qs['sort'](_0x140dcd[_0x82f6('0x34')][_0x82f6('0x3d')]);_0x4fdbdf[_0x82f6('0x3e')]=qs[_0x82f6('0x36')](_[_0x82f6('0x5c')](_0x140dcd[_0x82f6('0x34')],_0x4374c3[_0x82f6('0x36')]));if(_0x140dcd[_0x82f6('0x34')][_0x82f6('0x41')]){_0x4fdbdf['where']=_[_0x82f6('0x3f')](_0x4fdbdf[_0x82f6('0x3e')],{'$or':_[_0x82f6('0x2d')](_0x4fdbdf[_0x82f6('0x38')],function(_0x36599f){var _0x34e755={};_0x34e755[_0x36599f]={'$like':'%'+_0x140dcd['query'][_0x82f6('0x41')]+'%'};return _0x34e755;})});}_0x4fdbdf=_[_0x82f6('0x3f')]({},_0x4fdbdf,_0x140dcd['options']);return _0x18a458['getUsers'](_0x4fdbdf);}})[_0x82f6('0x26')](function(_0x351e44){if(_0x351e44){_0x1c37d2=_0x351e44[_0x82f6('0x3a')];if(!_0x140dcd[_0x82f6('0x34')][_0x82f6('0x3b')](_0x82f6('0x3c'))){_0x4fdbdf['limit']=qs[_0x82f6('0x20')](_0x140dcd['query'][_0x82f6('0x20')]);_0x4fdbdf['offset']=qs[_0x82f6('0x1f')](_0x140dcd['query'][_0x82f6('0x1f')]);}return _0x18a458[_0x82f6('0x5d')](_0x4fdbdf);}})[_0x82f6('0x26')](function(_0x584f76){if(_0x584f76){return _0x584f76?{'count':_0x1c37d2,'rows':_0x584f76}:null;}})[_0x82f6('0x26')](respondWithResult(_0x31f3cc,null))['catch'](handleError(_0x31f3cc,null));}; \ No newline at end of file diff --git a/server/api/squareProject/squareProject.events.js b/server/api/squareProject/squareProject.events.js index cdd0031..d47e29c 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 _0xee22=['SquareProject','setMaxListeners','save','remove','emit','hasOwnProperty','hook','exports','events','../../mysqldb'];(function(_0x50fda9,_0x5ee44b){var _0x36b92b=function(_0x121877){while(--_0x121877){_0x50fda9['push'](_0x50fda9['shift']());}};_0x36b92b(++_0x5ee44b);}(_0xee22,0x8a));var _0x2ee2=function(_0x2d2949,_0x24c559){_0x2d2949=_0x2d2949-0x0;var _0x4bb11f=_0xee22[_0x2d2949];return _0x4bb11f;};'use strict';var EventEmitter=require(_0x2ee2('0x0'));var SquareProject=require(_0x2ee2('0x1'))['db'][_0x2ee2('0x2')];var SquareProjectEvents=new EventEmitter();SquareProjectEvents[_0x2ee2('0x3')](0x0);var events={'afterCreate':_0x2ee2('0x4'),'afterUpdate':'update','afterDestroy':_0x2ee2('0x5')};function emitEvent(_0x4ef521){return function(_0x895d2b,_0x2c88c7,_0x3909ea){SquareProjectEvents[_0x2ee2('0x6')](_0x4ef521+':'+_0x895d2b['id'],_0x895d2b);SquareProjectEvents[_0x2ee2('0x6')](_0x4ef521,_0x895d2b);_0x3909ea(null);};}for(var e in events){if(events[_0x2ee2('0x7')](e)){var event=events[e];SquareProject[_0x2ee2('0x8')](e,emitEvent(event));}}module[_0x2ee2('0x9')]=SquareProjectEvents; \ No newline at end of file +var _0x121d=['remove','emit','hasOwnProperty','exports','events','../../mysqldb','SquareProject','setMaxListeners','save','update'];(function(_0x33f8d7,_0x3a1165){var _0x1364ce=function(_0xf77459){while(--_0xf77459){_0x33f8d7['push'](_0x33f8d7['shift']());}};_0x1364ce(++_0x3a1165);}(_0x121d,0xea));var _0xd121=function(_0x46b122,_0x380f8a){_0x46b122=_0x46b122-0x0;var _0x201c8c=_0x121d[_0x46b122];return _0x201c8c;};'use strict';var EventEmitter=require(_0xd121('0x0'));var SquareProject=require(_0xd121('0x1'))['db'][_0xd121('0x2')];var SquareProjectEvents=new EventEmitter();SquareProjectEvents[_0xd121('0x3')](0x0);var events={'afterCreate':_0xd121('0x4'),'afterUpdate':_0xd121('0x5'),'afterDestroy':_0xd121('0x6')};function emitEvent(_0xff33a){return function(_0x20a687,_0x349fc5,_0x1de627){SquareProjectEvents[_0xd121('0x7')](_0xff33a+':'+_0x20a687['id'],_0x20a687);SquareProjectEvents[_0xd121('0x7')](_0xff33a,_0x20a687);_0x1de627(null);};}for(var e in events){if(events[_0xd121('0x8')](e)){var event=events[e];SquareProject['hook'](e,emitEvent(event));}}module[_0xd121('0x9')]=SquareProjectEvents; \ No newline at end of file diff --git a/server/api/squareProject/squareProject.model.js b/server/api/squareProject/squareProject.model.js index 0f694fa..d9a56e4 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 _0x51e7=['../../config/environment','./squareProject.attributes','exports','define','square_projects','lodash','util','../../config/logger','moment','bluebird','request-promise','path'];(function(_0x2d9a66,_0xe0b0d5){var _0x4fcc0b=function(_0x239a23){while(--_0x239a23){_0x2d9a66['push'](_0x2d9a66['shift']());}};_0x4fcc0b(++_0xe0b0d5);}(_0x51e7,0x179));var _0x751e=function(_0x679540,_0x657b1d){_0x679540=_0x679540-0x0;var _0x17ce73=_0x51e7[_0x679540];return _0x17ce73;};'use strict';var _=require(_0x751e('0x0'));var util=require(_0x751e('0x1'));var logger=require(_0x751e('0x2'))('api');var moment=require(_0x751e('0x3'));var BPromise=require(_0x751e('0x4'));var rp=require(_0x751e('0x5'));var fs=require('fs');var path=require(_0x751e('0x6'));var rimraf=require('rimraf');var config=require(_0x751e('0x7'));var attributes=require(_0x751e('0x8'));module[_0x751e('0x9')]=function(_0x166c66,_0x4600ef){return _0x166c66[_0x751e('0xa')]('SquareProject',attributes,{'tableName':_0x751e('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x27a9=['./squareProject.attributes','exports','define','square_projects','lodash','../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment'];(function(_0x2ab418,_0x1f2849){var _0x68f709=function(_0x139292){while(--_0x139292){_0x2ab418['push'](_0x2ab418['shift']());}};_0x68f709(++_0x1f2849);}(_0x27a9,0xb8));var _0x927a=function(_0x80764,_0x389472){_0x80764=_0x80764-0x0;var _0x461709=_0x27a9[_0x80764];return _0x461709;};'use strict';var _=require(_0x927a('0x0'));var util=require('util');var logger=require(_0x927a('0x1'))(_0x927a('0x2'));var moment=require(_0x927a('0x3'));var BPromise=require(_0x927a('0x4'));var rp=require(_0x927a('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x927a('0x6'));var config=require(_0x927a('0x7'));var attributes=require(_0x927a('0x8'));module[_0x927a('0x9')]=function(_0x36b2ec,_0x31e101){return _0x36b2ec[_0x927a('0xa')]('SquareProject',attributes,{'tableName':_0x927a('0xb'),'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 c9a5604..37a1897 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 _0xfddf=['error','code','message','SquareProject,\x20%s,\x20%s','info','ShowSquareProject','SquareProject','find','options','raw','where','include','map','model','attributes','catch','lodash','util','moment','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','client','http','redis','defaults','localhost','socket.io-emitter','./squareProject.socket','register','request','then','request\x20sent','debug','SquareProject,\x20%s,\x20%s,\x20%s','stringify'];(function(_0x1efea7,_0x275c0d){var _0x5e75f2=function(_0x46df9b){while(--_0x46df9b){_0x1efea7['push'](_0x1efea7['shift']());}};_0x5e75f2(++_0x275c0d);}(_0xfddf,0x1b2));var _0xffdd=function(_0x2dcc98,_0x18cf6f){_0x2dcc98=_0x2dcc98-0x0;var _0x2ae2bb=_0xfddf[_0x2dcc98];return _0x2ae2bb;};'use strict';var _=require(_0xffdd('0x0'));var util=require(_0xffdd('0x1'));var moment=require(_0xffdd('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xffdd('0x3'));var db=require(_0xffdd('0x4'))['db'];var utils=require(_0xffdd('0x5'));var logger=require(_0xffdd('0x6'))(_0xffdd('0x7'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0xffdd('0x8')][_0xffdd('0x9')]({'port':0x232a});config[_0xffdd('0xa')]=_[_0xffdd('0xb')](config[_0xffdd('0xa')],{'host':_0xffdd('0xc'),'port':0x18eb});var socket=require(_0xffdd('0xd'))(new Redis(config['redis']));require(_0xffdd('0xe'))[_0xffdd('0xf')](socket);function respondWithRpcPromise(_0x2b7afa,_0x4a577c,_0x4e4069){return new BPromise(function(_0xf2d89d,_0x347ae5){return client[_0xffdd('0x10')](_0x2b7afa,_0x4e4069)[_0xffdd('0x11')](function(_0x2655d6){logger['info']('SquareProject,\x20%s,\x20%s',_0x4a577c,_0xffdd('0x12'));logger[_0xffdd('0x13')](_0xffdd('0x14'),_0x4a577c,_0xffdd('0x12'),JSON[_0xffdd('0x15')](_0x2655d6));if(_0x2655d6[_0xffdd('0x16')]){if(_0x2655d6[_0xffdd('0x16')][_0xffdd('0x17')]===0x1f4){logger[_0xffdd('0x16')]('SquareProject,\x20%s,\x20%s',_0x4a577c,_0x2655d6['error'][_0xffdd('0x18')]);return _0x347ae5(_0x2655d6[_0xffdd('0x16')]['message']);}logger[_0xffdd('0x16')](_0xffdd('0x19'),_0x4a577c,_0x2655d6[_0xffdd('0x16')][_0xffdd('0x18')]);return _0xf2d89d(_0x2655d6[_0xffdd('0x16')][_0xffdd('0x18')]);}else{logger[_0xffdd('0x1a')](_0xffdd('0x19'),_0x4a577c,'request\x20sent');_0xf2d89d(_0x2655d6['result'][_0xffdd('0x18')]);}})['catch'](function(_0x785bf){logger[_0xffdd('0x16')](_0xffdd('0x19'),_0x4a577c,_0x785bf);_0x347ae5(_0x785bf);});});}exports[_0xffdd('0x1b')]=function(_0xed6165){var _0x5ef211=this;return new Promise(function(_0x28b47f,_0x4712cf){return db[_0xffdd('0x1c')][_0xffdd('0x1d')]({'raw':_0xed6165[_0xffdd('0x1e')]?_0xed6165[_0xffdd('0x1e')][_0xffdd('0x1f')]===undefined?!![]:![]:!![],'where':_0xed6165[_0xffdd('0x1e')]?_0xed6165['options'][_0xffdd('0x20')]||null:null,'attributes':_0xed6165[_0xffdd('0x1e')]?_0xed6165[_0xffdd('0x1e')]['attributes']||null:null,'include':_0xed6165['options']?_0xed6165[_0xffdd('0x1e')][_0xffdd('0x21')]?_[_0xffdd('0x22')](_0xed6165['options']['include'],function(_0x22f5af){return{'model':db[_0x22f5af[_0xffdd('0x23')]],'as':_0x22f5af['as'],'attributes':_0x22f5af[_0xffdd('0x24')],'include':_0x22f5af[_0xffdd('0x21')]?_['map'](_0x22f5af[_0xffdd('0x21')],function(_0x46127a){return{'model':db[_0x46127a[_0xffdd('0x23')]],'as':_0x46127a['as'],'attributes':_0x46127a[_0xffdd('0x24')],'include':_0x46127a[_0xffdd('0x21')]?_[_0xffdd('0x22')](_0x46127a['include'],function(_0x45319b){return{'model':db[_0x45319b[_0xffdd('0x23')]],'as':_0x45319b['as'],'attributes':_0x45319b[_0xffdd('0x24')]};}):[]};}):[]};}):[]:[]})[_0xffdd('0x11')](function(_0x38ddd3){logger[_0xffdd('0x1a')](_0xffdd('0x1b'),_0xed6165);logger[_0xffdd('0x13')](_0xffdd('0x1b'),_0xed6165,JSON[_0xffdd('0x15')](_0x38ddd3));_0x28b47f(_0x38ddd3);})[_0xffdd('0x25')](function(_0xaa18c3){logger[_0xffdd('0x16')](_0xffdd('0x1b'),_0xaa18c3[_0xffdd('0x18')],_0xed6165);_0x4712cf(_0x5ef211[_0xffdd('0x16')](0x1f4,_0xaa18c3[_0xffdd('0x18')]));});});}; \ No newline at end of file +var _0x3aac=['moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','jayson/promise','http','redis','localhost','socket.io-emitter','./squareProject.socket','register','info','SquareProject,\x20%s,\x20%s','request\x20sent','debug','SquareProject,\x20%s,\x20%s,\x20%s','error','message','result','catch','ShowSquareProject','find','options','raw','where','attributes','include','model','map','then','stringify','lodash','util'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x3aac,0x1d2));var _0xc3aa=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x3aac[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0xc3aa('0x0'));var util=require(_0xc3aa('0x1'));var moment=require(_0xc3aa('0x2'));var BPromise=require(_0xc3aa('0x3'));var rs=require(_0xc3aa('0x4'));var fs=require('fs');var Redis=require(_0xc3aa('0x5'));var db=require(_0xc3aa('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0xc3aa('0x7'))(_0xc3aa('0x8'));var config=require('../../config/environment');var jayson=require(_0xc3aa('0x9'));var client=jayson['client'][_0xc3aa('0xa')]({'port':0x232a});config[_0xc3aa('0xb')]=_['defaults'](config['redis'],{'host':_0xc3aa('0xc'),'port':0x18eb});var socket=require(_0xc3aa('0xd'))(new Redis(config[_0xc3aa('0xb')]));require(_0xc3aa('0xe'))[_0xc3aa('0xf')](socket);function respondWithRpcPromise(_0x224af5,_0x27300d,_0x5cd46d){return new BPromise(function(_0x4cdc29,_0x13c657){return client['request'](_0x224af5,_0x5cd46d)['then'](function(_0x148254){logger[_0xc3aa('0x10')](_0xc3aa('0x11'),_0x27300d,_0xc3aa('0x12'));logger[_0xc3aa('0x13')](_0xc3aa('0x14'),_0x27300d,_0xc3aa('0x12'),JSON['stringify'](_0x148254));if(_0x148254[_0xc3aa('0x15')]){if(_0x148254[_0xc3aa('0x15')]['code']===0x1f4){logger[_0xc3aa('0x15')](_0xc3aa('0x11'),_0x27300d,_0x148254['error'][_0xc3aa('0x16')]);return _0x13c657(_0x148254['error'][_0xc3aa('0x16')]);}logger[_0xc3aa('0x15')]('SquareProject,\x20%s,\x20%s',_0x27300d,_0x148254[_0xc3aa('0x15')][_0xc3aa('0x16')]);return _0x4cdc29(_0x148254[_0xc3aa('0x15')][_0xc3aa('0x16')]);}else{logger['info'](_0xc3aa('0x11'),_0x27300d,'request\x20sent');_0x4cdc29(_0x148254[_0xc3aa('0x17')][_0xc3aa('0x16')]);}})[_0xc3aa('0x18')](function(_0x199ae6){logger[_0xc3aa('0x15')](_0xc3aa('0x11'),_0x27300d,_0x199ae6);_0x13c657(_0x199ae6);});});}exports[_0xc3aa('0x19')]=function(_0x80dfa3){var _0x450784=this;return new Promise(function(_0xe03c30,_0x183f81){return db['SquareProject'][_0xc3aa('0x1a')]({'raw':_0x80dfa3['options']?_0x80dfa3[_0xc3aa('0x1b')][_0xc3aa('0x1c')]===undefined?!![]:![]:!![],'where':_0x80dfa3[_0xc3aa('0x1b')]?_0x80dfa3[_0xc3aa('0x1b')][_0xc3aa('0x1d')]||null:null,'attributes':_0x80dfa3[_0xc3aa('0x1b')]?_0x80dfa3['options'][_0xc3aa('0x1e')]||null:null,'include':_0x80dfa3[_0xc3aa('0x1b')]?_0x80dfa3['options'][_0xc3aa('0x1f')]?_['map'](_0x80dfa3[_0xc3aa('0x1b')][_0xc3aa('0x1f')],function(_0x1b8637){return{'model':db[_0x1b8637[_0xc3aa('0x20')]],'as':_0x1b8637['as'],'attributes':_0x1b8637[_0xc3aa('0x1e')],'include':_0x1b8637[_0xc3aa('0x1f')]?_[_0xc3aa('0x21')](_0x1b8637[_0xc3aa('0x1f')],function(_0x2092f1){return{'model':db[_0x2092f1[_0xc3aa('0x20')]],'as':_0x2092f1['as'],'attributes':_0x2092f1[_0xc3aa('0x1e')],'include':_0x2092f1[_0xc3aa('0x1f')]?_[_0xc3aa('0x21')](_0x2092f1[_0xc3aa('0x1f')],function(_0x20631e){return{'model':db[_0x20631e[_0xc3aa('0x20')]],'as':_0x20631e['as'],'attributes':_0x20631e[_0xc3aa('0x1e')]};}):[]};}):[]};}):[]:[]})[_0xc3aa('0x22')](function(_0x5923c2){logger[_0xc3aa('0x10')](_0xc3aa('0x19'),_0x80dfa3);logger[_0xc3aa('0x13')](_0xc3aa('0x19'),_0x80dfa3,JSON[_0xc3aa('0x23')](_0x5923c2));_0xe03c30(_0x5923c2);})[_0xc3aa('0x18')](function(_0x5c352a){logger[_0xc3aa('0x15')](_0xc3aa('0x19'),_0x5c352a['message'],_0x80dfa3);_0x183f81(_0x450784[_0xc3aa('0x15')](0x1f4,_0x5c352a[_0xc3aa('0x16')]));});});}; \ No newline at end of file diff --git a/server/api/squareProject/squareProject.socket.js b/server/api/squareProject/squareProject.socket.js index bc751b7..b690baa 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 _0xb016=['register','./squareProject.events','save','emit'];(function(_0x328534,_0x33b41e){var _0x2796c0=function(_0x1ba8ad){while(--_0x1ba8ad){_0x328534['push'](_0x328534['shift']());}};_0x2796c0(++_0x33b41e);}(_0xb016,0x159));var _0x6b01=function(_0x13ee5e,_0x4b660f){_0x13ee5e=_0x13ee5e-0x0;var _0x102683=_0xb016[_0x13ee5e];return _0x102683;};'use strict';var SquareProjectEvents=require(_0x6b01('0x0'));var events=[_0x6b01('0x1'),'remove','update'];function createListener(_0xf74fa1,_0x531b6a){return function(_0x160a7d){_0x531b6a[_0x6b01('0x2')](_0xf74fa1,_0x160a7d);};}function removeListener(_0x161b59,_0x3b9de1){return function(){SquareProjectEvents['removeListener'](_0x161b59,_0x3b9de1);};}exports[_0x6b01('0x3')]=function(_0x65407a){for(var _0x192b2d=0x0,_0x5759a1=events['length'];_0x192b2d<_0x5759a1;_0x192b2d++){var _0x374aab=events[_0x192b2d];var _0x39f9fa=createListener('squareProject:'+_0x374aab,_0x65407a);SquareProjectEvents['on'](_0x374aab,_0x39f9fa);}}; \ No newline at end of file +var _0x9536=['length','./squareProject.events','save','remove','update','emit','removeListener','register'];(function(_0x65c50e,_0x1aa926){var _0x4573e7=function(_0x5bc049){while(--_0x5bc049){_0x65c50e['push'](_0x65c50e['shift']());}};_0x4573e7(++_0x1aa926);}(_0x9536,0x179));var _0x6953=function(_0x146a97,_0x2d8483){_0x146a97=_0x146a97-0x0;var _0x259d5c=_0x9536[_0x146a97];return _0x259d5c;};'use strict';var SquareProjectEvents=require(_0x6953('0x0'));var events=[_0x6953('0x1'),_0x6953('0x2'),_0x6953('0x3')];function createListener(_0x4d218f,_0xc3e4dd){return function(_0x53b172){_0xc3e4dd[_0x6953('0x4')](_0x4d218f,_0x53b172);};}function removeListener(_0x3c32c7,_0x1dee7c){return function(){SquareProjectEvents[_0x6953('0x5')](_0x3c32c7,_0x1dee7c);};}exports[_0x6953('0x6')]=function(_0x494ac2){for(var _0x2b273e=0x0,_0x2bb026=events[_0x6953('0x7')];_0x2b273e<_0x2bb026;_0x2b273e++){var _0x3e1aff=events[_0x2b273e];var _0x1c8225=createListener('squareProject:'+_0x3e1aff,_0x494ac2);SquareProjectEvents['on'](_0x3e1aff,_0x1c8225);}}; \ No newline at end of file diff --git a/server/api/squareRecording/index.js b/server/api/squareRecording/index.js index 0c3302c..aeeaca3 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 _0xbc43=['/:id','isAuthenticated','show','/:id/download','download','post','put','update','destroy','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./squareRecording.controller','get'];(function(_0x512c83,_0x42a67a){var _0x1f7f25=function(_0x1e656c){while(--_0x1e656c){_0x512c83['push'](_0x512c83['shift']());}};_0x1f7f25(++_0x42a67a);}(_0xbc43,0x145));var _0x3bc4=function(_0x2f8e44,_0x25e114){_0x2f8e44=_0x2f8e44-0x0;var _0x57b567=_0xbc43[_0x2f8e44];return _0x57b567;};'use strict';var multer=require(_0x3bc4('0x0'));var util=require(_0x3bc4('0x1'));var path=require(_0x3bc4('0x2'));var timeout=require(_0x3bc4('0x3'));var express=require(_0x3bc4('0x4'));var router=express[_0x3bc4('0x5')]();var auth=require(_0x3bc4('0x6'));var interaction=require(_0x3bc4('0x7'));var config=require(_0x3bc4('0x8'));var controller=require(_0x3bc4('0x9'));router[_0x3bc4('0xa')]('/',auth['isAuthenticated'](),controller['index']);router['get'](_0x3bc4('0xb'),auth[_0x3bc4('0xc')](),controller[_0x3bc4('0xd')]);router[_0x3bc4('0xa')](_0x3bc4('0xe'),auth[_0x3bc4('0xc')](),controller[_0x3bc4('0xf')]);router[_0x3bc4('0x10')]('/',auth[_0x3bc4('0xc')](),controller['create']);router[_0x3bc4('0x11')](_0x3bc4('0xb'),auth[_0x3bc4('0xc')](),controller[_0x3bc4('0x12')]);router['delete']('/:id/delete',auth['isAuthenticated'](),controller[_0x3bc4('0x13')]);module[_0x3bc4('0x14')]=router; \ No newline at end of file +var _0x9971=['show','/:id/download','download','post','update','/:id/delete','destroy','exports','multer','util','express','Router','../../components/auth/service','./squareRecording.controller','get','isAuthenticated','index','/:id'];(function(_0xdc37a1,_0x53ebb9){var _0x99b4fe=function(_0x2811e3){while(--_0x2811e3){_0xdc37a1['push'](_0xdc37a1['shift']());}};_0x99b4fe(++_0x53ebb9);}(_0x9971,0x182));var _0x1997=function(_0x1ca42b,_0x385f91){_0x1ca42b=_0x1ca42b-0x0;var _0xc3f2d3=_0x9971[_0x1ca42b];return _0xc3f2d3;};'use strict';var multer=require(_0x1997('0x0'));var util=require(_0x1997('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0x1997('0x2'));var router=express[_0x1997('0x3')]();var auth=require(_0x1997('0x4'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x1997('0x5'));router[_0x1997('0x6')]('/',auth[_0x1997('0x7')](),controller[_0x1997('0x8')]);router['get'](_0x1997('0x9'),auth['isAuthenticated'](),controller[_0x1997('0xa')]);router[_0x1997('0x6')](_0x1997('0xb'),auth['isAuthenticated'](),controller[_0x1997('0xc')]);router[_0x1997('0xd')]('/',auth[_0x1997('0x7')](),controller['create']);router['put']('/:id',auth[_0x1997('0x7')](),controller[_0x1997('0xe')]);router['delete'](_0x1997('0xf'),auth[_0x1997('0x7')](),controller[_0x1997('0x10')]);module[_0x1997('0x11')]=router; \ No newline at end of file diff --git a/server/api/squareRecording/squareRecording.attributes.js b/server/api/squareRecording/squareRecording.attributes.js index 5bb2284..7ac2af1 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 _0x0954=['getDataValue','savePath','substring','sequelize','STRING','VIRTUAL'];(function(_0x506cbe,_0x818678){var _0x4fdaa7=function(_0x28db18){while(--_0x28db18){_0x506cbe['push'](_0x506cbe['shift']());}};_0x4fdaa7(++_0x818678);}(_0x0954,0x135));var _0x4095=function(_0x56740a,_0x568894){_0x56740a=_0x56740a-0x0;var _0x257144=_0x0954[_0x56740a];return _0x257144;};'use strict';var Sequelize=require(_0x4095('0x0'));module['exports']={'uniqueid':{'type':Sequelize[_0x4095('0x1')]},'callerid':{'type':Sequelize[_0x4095('0x1')]},'calleridname':{'type':Sequelize['STRING']},'context':{'type':Sequelize[_0x4095('0x1')]},'extension':{'type':Sequelize[_0x4095('0x1')]},'priority':{'type':Sequelize[_0x4095('0x1')]},'accountcode':{'type':Sequelize[_0x4095('0x1')]},'dnid':{'type':Sequelize[_0x4095('0x1')]},'projectName':{'type':Sequelize[_0x4095('0x1')]},'saveName':{'type':Sequelize['STRING']},'filename':{'type':Sequelize['STRING']},'savePath':{'type':Sequelize['STRING']},'format':{'type':Sequelize[_0x4095('0x2')],'get':function(){var _0x352c8f='';var _0x1cf027=this[_0x4095('0x3')](_0x4095('0x4'));if(_0x1cf027){_0x352c8f=_0x1cf027[_0x4095('0x5')](_0x1cf027['lastIndexOf']('.'));}return _0x352c8f;}}}; \ No newline at end of file +var _0xd50b=['STRING','VIRTUAL','savePath','substring','lastIndexOf','sequelize','exports'];(function(_0x4e1f51,_0xd7d9e){var _0x548c19=function(_0x501e4f){while(--_0x501e4f){_0x4e1f51['push'](_0x4e1f51['shift']());}};_0x548c19(++_0xd7d9e);}(_0xd50b,0x132));var _0xbd50=function(_0x242e41,_0x2beb78){_0x242e41=_0x242e41-0x0;var _0x171510=_0xd50b[_0x242e41];return _0x171510;};'use strict';var Sequelize=require(_0xbd50('0x0'));module[_0xbd50('0x1')]={'uniqueid':{'type':Sequelize[_0xbd50('0x2')]},'callerid':{'type':Sequelize[_0xbd50('0x2')]},'calleridname':{'type':Sequelize[_0xbd50('0x2')]},'context':{'type':Sequelize[_0xbd50('0x2')]},'extension':{'type':Sequelize[_0xbd50('0x2')]},'priority':{'type':Sequelize[_0xbd50('0x2')]},'accountcode':{'type':Sequelize[_0xbd50('0x2')]},'dnid':{'type':Sequelize[_0xbd50('0x2')]},'projectName':{'type':Sequelize[_0xbd50('0x2')]},'saveName':{'type':Sequelize[_0xbd50('0x2')]},'filename':{'type':Sequelize[_0xbd50('0x2')]},'savePath':{'type':Sequelize['STRING']},'format':{'type':Sequelize[_0xbd50('0x3')],'get':function(){var _0x3e5ed8='';var _0x395c51=this['getDataValue'](_0xbd50('0x4'));if(_0x395c51){_0x3e5ed8=_0x395c51[_0xbd50('0x5')](_0x395c51[_0xbd50('0x6')]('.'));}return _0x3e5ed8;}}}; \ No newline at end of file diff --git a/server/api/squareRecording/squareRecording.controller.js b/server/api/squareRecording/squareRecording.controller.js index e361ea1..62b4261 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 _0xb5d6=['fieldName','type','key','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','count','include','findAll','rows','catch','show','params','includeAll','create','body','find','download','../../components/encryptor','uniqueid','savePath','filename','format','%s.cypher','decryptFile','secrets','existsSync','Sequelize','SquareRecording\x20not\x20found','extname','unlink','message','send','Not\x20found','destroy','info','cancellazione\x20fisica\x20documento\x20%s','isNil','File:\x20\x22','unlinkSync','.cypher','html-pdf','eml-format','request-promise','util','path','sox','ejs','lodash','squel','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','offset','limit','apply','reject','update','then','error','name','map','SquareRecording','rawAttributes'];(function(_0x372915,_0x2dbd58){var _0x42ea51=function(_0x139233){while(--_0x139233){_0x372915['push'](_0x372915['shift']());}};_0x42ea51(++_0x2dbd58);}(_0xb5d6,0xf2));var _0x6b5d=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xb5d6[_0x20a584];return _0x4b41a8;};'use strict';var pdf=require(_0x6b5d('0x0'));var emlformat=require(_0x6b5d('0x1'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x6b5d('0x2'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x6b5d('0x3'));var path=require(_0x6b5d('0x4'));var sox=require(_0x6b5d('0x5'));var csv=require('to-csv');var ejs=require(_0x6b5d('0x6'));var fs=require('fs');var _=require(_0x6b5d('0x7'));var squel=require(_0x6b5d('0x8'));var crypto=require('crypto');var jsforce=require(_0x6b5d('0x9'));var deskjs=require(_0x6b5d('0xa'));var toCsv=require(_0x6b5d('0xb'));var querystring=require(_0x6b5d('0xc'));var Papa=require(_0x6b5d('0xd'));var Redis=require(_0x6b5d('0xe'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x6b5d('0xf'));var hardwareService=require(_0x6b5d('0x10'));var logger=require(_0x6b5d('0x11'))(_0x6b5d('0x12'));var utils=require(_0x6b5d('0x13'));var config=require(_0x6b5d('0x14'));var db=require(_0x6b5d('0x15'))['db'];function respondWithStatusCode(_0x480e87,_0x5dd4f6){_0x5dd4f6=_0x5dd4f6||0xcc;return function(_0x2b7ac4){if(_0x2b7ac4){return _0x480e87[_0x6b5d('0x16')](_0x5dd4f6);}return _0x480e87[_0x6b5d('0x17')](_0x5dd4f6)[_0x6b5d('0x18')]();};}function respondWithResult(_0x2470e9,_0x47fb8e){_0x47fb8e=_0x47fb8e||0xc8;return function(_0x493142){if(_0x493142){return _0x2470e9[_0x6b5d('0x17')](_0x47fb8e)[_0x6b5d('0x19')](_0x493142);}};}function respondWithFilteredResult(_0x33599f,_0x5773f1){return function(_0x29b575){if(_0x29b575){var _0x20c298=_0x29b575['count'],_0x210670=_0x5773f1[_0x6b5d('0x1a')],_0x42ec9c=_0x5773f1[_0x6b5d('0x1a')]+_0x5773f1[_0x6b5d('0x1b')],_0x128bf1;if(_0x42ec9c>=_0x20c298){_0x42ec9c=_0x20c298;_0x128bf1=0xc8;}else{_0x128bf1=0xce;}_0x33599f[_0x6b5d('0x17')](_0x128bf1);return _0x33599f['set']('Content-Range',_0x210670+'-'+_0x42ec9c+'/'+_0x20c298)[_0x6b5d('0x19')](_0x29b575);}return null;};}function patchUpdates(_0x18a898){return function(_0x575920){try{jsonpatch[_0x6b5d('0x1c')](_0x575920,_0x18a898,!![]);}catch(_0x33c4ef){return BPromise[_0x6b5d('0x1d')](_0x33c4ef);}return _0x575920['save']();};}function saveUpdates(_0x6e6bee,_0x3914f6){return function(_0x5e8a7b){if(_0x5e8a7b){return _0x5e8a7b[_0x6b5d('0x1e')](_0x6e6bee)[_0x6b5d('0x1f')](function(_0x3b5282){return _0x3b5282;});}return null;};}function removeEntity(_0x18927a,_0x3de6f5){return function(_0x3cee13){if(_0x3cee13){return _0x3cee13['destroy']()['then'](function(){_0x18927a[_0x6b5d('0x17')](0xcc)[_0x6b5d('0x18')]();});}};}function handleEntityNotFound(_0x169874,_0x983786){return function(_0xa84904){if(!_0xa84904){_0x169874[_0x6b5d('0x16')](0x194);}return _0xa84904;};}function handleError(_0x343962,_0x1800ad){_0x1800ad=_0x1800ad||0x1f4;return function(_0x4f4a46){logger[_0x6b5d('0x20')](_0x4f4a46['stack']);if(_0x4f4a46[_0x6b5d('0x21')]){delete _0x4f4a46[_0x6b5d('0x21')];}_0x343962[_0x6b5d('0x17')](_0x1800ad)['send'](_0x4f4a46);};}exports['index']=function(_0x126ed4,_0x3eecdf){var _0x23ff99={},_0x1a5db8={},_0x41baff={'count':0x0,'rows':[]};var _0x58ffaa=_[_0x6b5d('0x22')](db[_0x6b5d('0x23')][_0x6b5d('0x24')],function(_0x292a4e){return{'name':_0x292a4e[_0x6b5d('0x25')],'type':_0x292a4e[_0x6b5d('0x26')][_0x6b5d('0x27')]};});_0x1a5db8[_0x6b5d('0x28')]=_[_0x6b5d('0x22')](_0x58ffaa,_0x6b5d('0x21'));_0x1a5db8[_0x6b5d('0x29')]=_[_0x6b5d('0x2a')](_0x126ed4[_0x6b5d('0x29')]);_0x1a5db8[_0x6b5d('0x2b')]=_['intersection'](_0x1a5db8['model'],_0x1a5db8[_0x6b5d('0x29')]);_0x23ff99['attributes']=_[_0x6b5d('0x2c')](_0x1a5db8[_0x6b5d('0x28')],qs[_0x6b5d('0x2d')](_0x126ed4['query'][_0x6b5d('0x2d')]));_0x23ff99[_0x6b5d('0x2e')]=_0x23ff99[_0x6b5d('0x2e')][_0x6b5d('0x2f')]?_0x23ff99['attributes']:_0x1a5db8[_0x6b5d('0x28')];if(!_0x126ed4[_0x6b5d('0x29')][_0x6b5d('0x30')](_0x6b5d('0x31'))){_0x23ff99[_0x6b5d('0x1b')]=qs[_0x6b5d('0x1b')](_0x126ed4[_0x6b5d('0x29')][_0x6b5d('0x1b')]);_0x23ff99['offset']=qs[_0x6b5d('0x1a')](_0x126ed4[_0x6b5d('0x29')]['offset']);}_0x23ff99[_0x6b5d('0x32')]=qs[_0x6b5d('0x33')](_0x126ed4[_0x6b5d('0x29')][_0x6b5d('0x33')]);_0x23ff99[_0x6b5d('0x34')]=qs[_0x6b5d('0x2b')](_[_0x6b5d('0x35')](_0x126ed4[_0x6b5d('0x29')],_0x1a5db8['filters']));if(_0x126ed4[_0x6b5d('0x29')][_0x6b5d('0x36')]){_0x23ff99[_0x6b5d('0x34')]=_[_0x6b5d('0x37')](_0x23ff99[_0x6b5d('0x34')],{'$or':_[_0x6b5d('0x22')](_0x58ffaa,function(_0x65ee5d){if(_0x65ee5d[_0x6b5d('0x26')]!==_0x6b5d('0x38')){var _0x3ac5b5={};_0x3ac5b5[_0x65ee5d[_0x6b5d('0x21')]]={'$like':'%'+_0x126ed4[_0x6b5d('0x29')][_0x6b5d('0x36')]+'%'};return _0x3ac5b5;}})});}_0x23ff99=_[_0x6b5d('0x37')]({},_0x23ff99,_0x126ed4[_0x6b5d('0x39')]);var _0x330b40={'where':_0x23ff99['where']};return db[_0x6b5d('0x23')][_0x6b5d('0x3a')](_0x330b40)['then'](function(_0xf6acda){_0x41baff[_0x6b5d('0x3a')]=_0xf6acda;if(_0x126ed4[_0x6b5d('0x29')]['includeAll']){_0x23ff99[_0x6b5d('0x3b')]=[{'all':!![]}];}return db['SquareRecording'][_0x6b5d('0x3c')](_0x23ff99);})[_0x6b5d('0x1f')](function(_0xc7de4c){_0x41baff[_0x6b5d('0x3d')]=_0xc7de4c;return _0x41baff;})['then'](respondWithFilteredResult(_0x3eecdf,_0x23ff99))[_0x6b5d('0x3e')](handleError(_0x3eecdf,null));};exports[_0x6b5d('0x3f')]=function(_0x5bbe27,_0x4024f6){var _0x1084f2={'raw':!![],'where':{'id':_0x5bbe27[_0x6b5d('0x40')]['id']}},_0x27a224={};_0x27a224[_0x6b5d('0x28')]=_['keys'](db['SquareRecording'][_0x6b5d('0x24')]);_0x27a224[_0x6b5d('0x29')]=_[_0x6b5d('0x2a')](_0x5bbe27[_0x6b5d('0x29')]);_0x27a224[_0x6b5d('0x2b')]=_[_0x6b5d('0x2c')](_0x27a224[_0x6b5d('0x28')],_0x27a224['query']);_0x1084f2[_0x6b5d('0x2e')]=_[_0x6b5d('0x2c')](_0x27a224[_0x6b5d('0x28')],qs[_0x6b5d('0x2d')](_0x5bbe27[_0x6b5d('0x29')][_0x6b5d('0x2d')]));_0x1084f2[_0x6b5d('0x2e')]=_0x1084f2[_0x6b5d('0x2e')][_0x6b5d('0x2f')]?_0x1084f2[_0x6b5d('0x2e')]:_0x27a224[_0x6b5d('0x28')];if(_0x5bbe27[_0x6b5d('0x29')][_0x6b5d('0x41')]){_0x1084f2[_0x6b5d('0x3b')]=[{'all':!![]}];}_0x1084f2=_['merge']({},_0x1084f2,_0x5bbe27[_0x6b5d('0x39')]);return db[_0x6b5d('0x23')]['find'](_0x1084f2)['then'](handleEntityNotFound(_0x4024f6,null))[_0x6b5d('0x1f')](respondWithResult(_0x4024f6,null))[_0x6b5d('0x3e')](handleError(_0x4024f6,null));};exports[_0x6b5d('0x42')]=function(_0x305f41,_0x408bbb){return db[_0x6b5d('0x23')][_0x6b5d('0x42')](_0x305f41[_0x6b5d('0x43')],{})['then'](respondWithResult(_0x408bbb,0xc9))[_0x6b5d('0x3e')](handleError(_0x408bbb,null));};exports['update']=function(_0x1c3d89,_0x34e978){if(_0x1c3d89[_0x6b5d('0x43')]['id']){delete _0x1c3d89['body']['id'];}return db[_0x6b5d('0x23')][_0x6b5d('0x44')]({'where':{'id':_0x1c3d89['params']['id']}})[_0x6b5d('0x1f')](handleEntityNotFound(_0x34e978,null))[_0x6b5d('0x1f')](saveUpdates(_0x1c3d89['body'],null))[_0x6b5d('0x1f')](respondWithResult(_0x34e978,null))[_0x6b5d('0x3e')](handleError(_0x34e978,null));};exports[_0x6b5d('0x45')]=function(_0x221538,_0x3d3c61,_0x5bce8d){var _0x5f34b3=require(_0x6b5d('0x46'));var _0x3327f8=![];var _0x425c85={};if(_0x221538[_0x6b5d('0x29')][_0x6b5d('0x26')]&&_0x221538[_0x6b5d('0x29')][_0x6b5d('0x26')]===_0x6b5d('0x47')){_0x425c85[_0x6b5d('0x47')]=_0x221538[_0x6b5d('0x40')]['id'];}else{_0x425c85['id']=_0x221538['params']['id'];}return db['SquareRecording'][_0x6b5d('0x44')]({'where':_0x425c85,'attributes':['id',_0x6b5d('0x48'),_0x6b5d('0x49')],'raw':!![]})[_0x6b5d('0x1f')](handleEntityNotFound(_0x3d3c61,null))['then'](function(_0x1af81d){if(_0x1af81d){var _0x334fb8=_0x1af81d[_0x6b5d('0x48')];var _0x41c65d=util[_0x6b5d('0x4a')](_0x6b5d('0x4b'),_0x334fb8);if(fs['existsSync'](_0x41c65d)){_0x3327f8=!![];return _0x5f34b3[_0x6b5d('0x4c')](_0x41c65d,_0x334fb8,config[_0x6b5d('0x4d')]['recording'])['then'](function(){return _0x1af81d;});}return _0x1af81d;}})[_0x6b5d('0x1f')](function(_0x174c58){if(_0x174c58){var _0x400fe2=_0x174c58[_0x6b5d('0x48')];if(!fs[_0x6b5d('0x4e')](_0x400fe2)){throw new db[(_0x6b5d('0x4f'))]['ValidationError'](_0x6b5d('0x50'));}if(_0x174c58['filename']){return _0x3d3c61['download'](_0x400fe2,_0x174c58['filename']+path[_0x6b5d('0x51')](_0x400fe2),function(){if(_0x3327f8){fs[_0x6b5d('0x52')](_0x400fe2);}});}else{return _0x3d3c61[_0x6b5d('0x45')](_0x400fe2,function(_0x5538f0){if(_0x3327f8){fs['unlink'](_0x400fe2);}});}}})['catch'](function(_0x7fe17){if(_0x7fe17[_0x6b5d('0x53')]==='SquareRecording\x20not\x20found'){_0x3d3c61[_0x6b5d('0x17')](0x194)[_0x6b5d('0x54')](_0x6b5d('0x55'));}else{return handleError(_0x3d3c61,null);}});};exports[_0x6b5d('0x56')]=function(_0x3265dd,_0x5aaf2a){return db[_0x6b5d('0x23')][_0x6b5d('0x44')]({'where':{'id':_0x3265dd[_0x6b5d('0x40')]['id']}})[_0x6b5d('0x1f')](function(_0xd83c4d){if(!_0xd83c4d)throw new ReferenceError('Entity\x20not\x20found');return _0xd83c4d;})['then'](function(_0xcbab03){var _0x19c4c7=_0xcbab03['savePath'];logger[_0x6b5d('0x57')](_0x6b5d('0x58'),_0x19c4c7);if(!_[_0x6b5d('0x59')](_0xcbab03[_0x6b5d('0x48')])&&fs['existsSync'](_0x19c4c7)){logger['info'](_0x6b5d('0x5a')+_0x19c4c7+'\x22\x20trovato\x20eseguo\x20la\x20cancellazione');fs[_0x6b5d('0x5b')](_0x19c4c7);}_0x19c4c7=_0x19c4c7+_0x6b5d('0x5c');if(!_['isNil'](_0xcbab03['savePath'])&&fs[_0x6b5d('0x4e')](_0x19c4c7)){logger[_0x6b5d('0x57')](_0x6b5d('0x5a')+_0x19c4c7+'\x22\x20trovato\x20eseguo\x20la\x20cancellazione');fs[_0x6b5d('0x5b')](_0x19c4c7);}return _0xcbab03;})['then'](function(_0x14cbd6){if(!_0x14cbd6)throw new InternalError();return _0x14cbd6[_0x6b5d('0x56')]();})[_0x6b5d('0x1f')](function(){_0x5aaf2a[_0x6b5d('0x17')](0xcc)[_0x6b5d('0x18')]();})[_0x6b5d('0x3e')](handleError(_0x5aaf2a,null));}; \ No newline at end of file +var _0xf7e2=['../../config/license/hardware','../../config/utils','../../config/environment','../../mysqldb','sendStatus','end','status','json','count','offset','limit','set','Content-Range','apply','reject','update','then','stack','name','send','map','fieldName','type','key','model','query','filters','intersection','fields','attributes','length','order','sort','where','pick','filter','VIRTUAL','merge','options','SquareRecording','includeAll','include','findAll','catch','show','keys','find','create','body','params','download','../../components/encryptor','uniqueid','savePath','filename','format','recording','existsSync','Sequelize','ValidationError','SquareRecording\x20not\x20found','extname','unlink','destroy','Entity\x20not\x20found','info','cancellazione\x20fisica\x20documento\x20%s','isNil','File:\x20\x22','.cypher','\x22\x20trovato\x20eseguo\x20la\x20cancellazione','unlinkSync','html-pdf','rimraf','zip-dir','fast-json-patch','request-promise','mustache','sox','to-csv','ejs','lodash','squel','jsforce','desk.js','querystring','ioredis','../../components/auth/service'];(function(_0x21887c,_0x3192f3){var _0x45dd8e=function(_0x55587d){while(--_0x55587d){_0x21887c['push'](_0x21887c['shift']());}};_0x45dd8e(++_0x3192f3);}(_0xf7e2,0xa0));var _0x2f7e=function(_0x347733,_0x5de9fa){_0x347733=_0x347733-0x0;var _0x398c75=_0xf7e2[_0x347733];return _0x398c75;};'use strict';var pdf=require(_0x2f7e('0x0'));var emlformat=require('eml-format');var rimraf=require(_0x2f7e('0x1'));var zipdir=require(_0x2f7e('0x2'));var jsonpatch=require(_0x2f7e('0x3'));var rp=require(_0x2f7e('0x4'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x2f7e('0x5'));var util=require('util');var path=require('path');var sox=require(_0x2f7e('0x6'));var csv=require(_0x2f7e('0x7'));var ejs=require(_0x2f7e('0x8'));var fs=require('fs');var _=require(_0x2f7e('0x9'));var squel=require(_0x2f7e('0xa'));var crypto=require('crypto');var jsforce=require(_0x2f7e('0xb'));var deskjs=require(_0x2f7e('0xc'));var toCsv=require(_0x2f7e('0x7'));var querystring=require(_0x2f7e('0xd'));var Papa=require('papaparse');var Redis=require(_0x2f7e('0xe'));var authService=require(_0x2f7e('0xf'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x2f7e('0x10'));var logger=require('../../config/logger')('api');var utils=require(_0x2f7e('0x11'));var config=require(_0x2f7e('0x12'));var db=require(_0x2f7e('0x13'))['db'];function respondWithStatusCode(_0x320c3a,_0x4a1cdd){_0x4a1cdd=_0x4a1cdd||0xcc;return function(_0x100d43){if(_0x100d43){return _0x320c3a[_0x2f7e('0x14')](_0x4a1cdd);}return _0x320c3a['status'](_0x4a1cdd)[_0x2f7e('0x15')]();};}function respondWithResult(_0x536c9e,_0x3a9fb3){_0x3a9fb3=_0x3a9fb3||0xc8;return function(_0x2eb82d){if(_0x2eb82d){return _0x536c9e[_0x2f7e('0x16')](_0x3a9fb3)[_0x2f7e('0x17')](_0x2eb82d);}};}function respondWithFilteredResult(_0x47dd1f,_0x39209c){return function(_0x14f1d1){if(_0x14f1d1){var _0x4f4743=_0x14f1d1[_0x2f7e('0x18')],_0x5c3186=_0x39209c[_0x2f7e('0x19')],_0xd88780=_0x39209c[_0x2f7e('0x19')]+_0x39209c[_0x2f7e('0x1a')],_0xd97c15;if(_0xd88780>=_0x4f4743){_0xd88780=_0x4f4743;_0xd97c15=0xc8;}else{_0xd97c15=0xce;}_0x47dd1f[_0x2f7e('0x16')](_0xd97c15);return _0x47dd1f[_0x2f7e('0x1b')](_0x2f7e('0x1c'),_0x5c3186+'-'+_0xd88780+'/'+_0x4f4743)['json'](_0x14f1d1);}return null;};}function patchUpdates(_0x1c1f8b){return function(_0x56271c){try{jsonpatch[_0x2f7e('0x1d')](_0x56271c,_0x1c1f8b,!![]);}catch(_0x4b5f3c){return BPromise[_0x2f7e('0x1e')](_0x4b5f3c);}return _0x56271c['save']();};}function saveUpdates(_0x449083,_0x28a44e){return function(_0x44f313){if(_0x44f313){return _0x44f313[_0x2f7e('0x1f')](_0x449083)[_0x2f7e('0x20')](function(_0x1c762c){return _0x1c762c;});}return null;};}function removeEntity(_0x5dae34,_0x3a09d8){return function(_0x4e9ce2){if(_0x4e9ce2){return _0x4e9ce2['destroy']()[_0x2f7e('0x20')](function(){_0x5dae34[_0x2f7e('0x16')](0xcc)[_0x2f7e('0x15')]();});}};}function handleEntityNotFound(_0x167c5f,_0x49f32a){return function(_0xd5218b){if(!_0xd5218b){_0x167c5f[_0x2f7e('0x14')](0x194);}return _0xd5218b;};}function handleError(_0x2269fc,_0x1d04a7){_0x1d04a7=_0x1d04a7||0x1f4;return function(_0x5129be){logger['error'](_0x5129be[_0x2f7e('0x21')]);if(_0x5129be[_0x2f7e('0x22')]){delete _0x5129be[_0x2f7e('0x22')];}_0x2269fc[_0x2f7e('0x16')](_0x1d04a7)[_0x2f7e('0x23')](_0x5129be);};}exports['index']=function(_0x58e369,_0x2fceaf){var _0x208fab={},_0x2e6082={},_0x49092c={'count':0x0,'rows':[]};var _0x502c11=_[_0x2f7e('0x24')](db['SquareRecording']['rawAttributes'],function(_0x379b48){return{'name':_0x379b48[_0x2f7e('0x25')],'type':_0x379b48[_0x2f7e('0x26')][_0x2f7e('0x27')]};});_0x2e6082[_0x2f7e('0x28')]=_[_0x2f7e('0x24')](_0x502c11,'name');_0x2e6082[_0x2f7e('0x29')]=_['keys'](_0x58e369[_0x2f7e('0x29')]);_0x2e6082[_0x2f7e('0x2a')]=_['intersection'](_0x2e6082[_0x2f7e('0x28')],_0x2e6082[_0x2f7e('0x29')]);_0x208fab['attributes']=_[_0x2f7e('0x2b')](_0x2e6082['model'],qs['fields'](_0x58e369[_0x2f7e('0x29')][_0x2f7e('0x2c')]));_0x208fab['attributes']=_0x208fab[_0x2f7e('0x2d')][_0x2f7e('0x2e')]?_0x208fab['attributes']:_0x2e6082['model'];if(!_0x58e369[_0x2f7e('0x29')]['hasOwnProperty']('nolimit')){_0x208fab[_0x2f7e('0x1a')]=qs[_0x2f7e('0x1a')](_0x58e369[_0x2f7e('0x29')]['limit']);_0x208fab[_0x2f7e('0x19')]=qs[_0x2f7e('0x19')](_0x58e369['query'][_0x2f7e('0x19')]);}_0x208fab[_0x2f7e('0x2f')]=qs[_0x2f7e('0x30')](_0x58e369['query'][_0x2f7e('0x30')]);_0x208fab[_0x2f7e('0x31')]=qs[_0x2f7e('0x2a')](_[_0x2f7e('0x32')](_0x58e369[_0x2f7e('0x29')],_0x2e6082['filters']));if(_0x58e369[_0x2f7e('0x29')][_0x2f7e('0x33')]){_0x208fab[_0x2f7e('0x31')]=_['merge'](_0x208fab['where'],{'$or':_[_0x2f7e('0x24')](_0x502c11,function(_0x392ddd){if(_0x392ddd['type']!==_0x2f7e('0x34')){var _0x12a67e={};_0x12a67e[_0x392ddd[_0x2f7e('0x22')]]={'$like':'%'+_0x58e369[_0x2f7e('0x29')]['filter']+'%'};return _0x12a67e;}})});}_0x208fab=_[_0x2f7e('0x35')]({},_0x208fab,_0x58e369[_0x2f7e('0x36')]);var _0x11ab8f={'where':_0x208fab[_0x2f7e('0x31')]};return db[_0x2f7e('0x37')][_0x2f7e('0x18')](_0x11ab8f)['then'](function(_0x3046b0){_0x49092c[_0x2f7e('0x18')]=_0x3046b0;if(_0x58e369[_0x2f7e('0x29')][_0x2f7e('0x38')]){_0x208fab[_0x2f7e('0x39')]=[{'all':!![]}];}return db['SquareRecording'][_0x2f7e('0x3a')](_0x208fab);})[_0x2f7e('0x20')](function(_0x4cec30){_0x49092c['rows']=_0x4cec30;return _0x49092c;})[_0x2f7e('0x20')](respondWithFilteredResult(_0x2fceaf,_0x208fab))[_0x2f7e('0x3b')](handleError(_0x2fceaf,null));};exports[_0x2f7e('0x3c')]=function(_0x51f983,_0x170266){var _0x4d758f={'raw':!![],'where':{'id':_0x51f983['params']['id']}},_0x52df3f={};_0x52df3f['model']=_['keys'](db[_0x2f7e('0x37')]['rawAttributes']);_0x52df3f[_0x2f7e('0x29')]=_[_0x2f7e('0x3d')](_0x51f983[_0x2f7e('0x29')]);_0x52df3f[_0x2f7e('0x2a')]=_[_0x2f7e('0x2b')](_0x52df3f[_0x2f7e('0x28')],_0x52df3f[_0x2f7e('0x29')]);_0x4d758f[_0x2f7e('0x2d')]=_['intersection'](_0x52df3f[_0x2f7e('0x28')],qs[_0x2f7e('0x2c')](_0x51f983[_0x2f7e('0x29')][_0x2f7e('0x2c')]));_0x4d758f[_0x2f7e('0x2d')]=_0x4d758f['attributes'][_0x2f7e('0x2e')]?_0x4d758f[_0x2f7e('0x2d')]:_0x52df3f[_0x2f7e('0x28')];if(_0x51f983[_0x2f7e('0x29')][_0x2f7e('0x38')]){_0x4d758f[_0x2f7e('0x39')]=[{'all':!![]}];}_0x4d758f=_[_0x2f7e('0x35')]({},_0x4d758f,_0x51f983[_0x2f7e('0x36')]);return db[_0x2f7e('0x37')][_0x2f7e('0x3e')](_0x4d758f)[_0x2f7e('0x20')](handleEntityNotFound(_0x170266,null))['then'](respondWithResult(_0x170266,null))[_0x2f7e('0x3b')](handleError(_0x170266,null));};exports[_0x2f7e('0x3f')]=function(_0x4677b8,_0x3ae1d5){return db[_0x2f7e('0x37')][_0x2f7e('0x3f')](_0x4677b8['body'],{})[_0x2f7e('0x20')](respondWithResult(_0x3ae1d5,0xc9))['catch'](handleError(_0x3ae1d5,null));};exports[_0x2f7e('0x1f')]=function(_0x1e3f04,_0x2d43f6){if(_0x1e3f04[_0x2f7e('0x40')]['id']){delete _0x1e3f04['body']['id'];}return db[_0x2f7e('0x37')][_0x2f7e('0x3e')]({'where':{'id':_0x1e3f04[_0x2f7e('0x41')]['id']}})[_0x2f7e('0x20')](handleEntityNotFound(_0x2d43f6,null))['then'](saveUpdates(_0x1e3f04[_0x2f7e('0x40')],null))[_0x2f7e('0x20')](respondWithResult(_0x2d43f6,null))[_0x2f7e('0x3b')](handleError(_0x2d43f6,null));};exports[_0x2f7e('0x42')]=function(_0x1c5b35,_0x103b79,_0x35971c){var _0xa6703b=require(_0x2f7e('0x43'));var _0x2f4fc0=![];var _0x8795a8={};if(_0x1c5b35[_0x2f7e('0x29')]['type']&&_0x1c5b35[_0x2f7e('0x29')][_0x2f7e('0x26')]===_0x2f7e('0x44')){_0x8795a8[_0x2f7e('0x44')]=_0x1c5b35['params']['id'];}else{_0x8795a8['id']=_0x1c5b35[_0x2f7e('0x41')]['id'];}return db['SquareRecording'][_0x2f7e('0x3e')]({'where':_0x8795a8,'attributes':['id',_0x2f7e('0x45'),_0x2f7e('0x46')],'raw':!![]})[_0x2f7e('0x20')](handleEntityNotFound(_0x103b79,null))[_0x2f7e('0x20')](function(_0x207c96){if(_0x207c96){var _0x5e7bff=_0x207c96[_0x2f7e('0x45')];var _0x9a9ab9=util[_0x2f7e('0x47')]('%s.cypher',_0x5e7bff);if(fs['existsSync'](_0x9a9ab9)){_0x2f4fc0=!![];return _0xa6703b['decryptFile'](_0x9a9ab9,_0x5e7bff,config['secrets'][_0x2f7e('0x48')])[_0x2f7e('0x20')](function(){return _0x207c96;});}return _0x207c96;}})[_0x2f7e('0x20')](function(_0x29021b){if(_0x29021b){var _0x125fc8=_0x29021b[_0x2f7e('0x45')];if(!fs[_0x2f7e('0x49')](_0x125fc8)){throw new db[(_0x2f7e('0x4a'))][(_0x2f7e('0x4b'))](_0x2f7e('0x4c'));}if(_0x29021b[_0x2f7e('0x46')]){return _0x103b79[_0x2f7e('0x42')](_0x125fc8,_0x29021b[_0x2f7e('0x46')]+path[_0x2f7e('0x4d')](_0x125fc8),function(){if(_0x2f4fc0){fs[_0x2f7e('0x4e')](_0x125fc8);}});}else{return _0x103b79[_0x2f7e('0x42')](_0x125fc8,function(_0x109934){if(_0x2f4fc0){fs['unlink'](_0x125fc8);}});}}})['catch'](function(_0x197e35){if(_0x197e35['message']==='SquareRecording\x20not\x20found'){_0x103b79['status'](0x194)['send']('Not\x20found');}else{return handleError(_0x103b79,null);}});};exports[_0x2f7e('0x4f')]=function(_0x1cc8f4,_0x46071b){return db['SquareRecording'][_0x2f7e('0x3e')]({'where':{'id':_0x1cc8f4[_0x2f7e('0x41')]['id']}})[_0x2f7e('0x20')](function(_0x40a7a3){if(!_0x40a7a3)throw new ReferenceError(_0x2f7e('0x50'));return _0x40a7a3;})[_0x2f7e('0x20')](function(_0x372654){var _0xd01871=_0x372654[_0x2f7e('0x45')];logger[_0x2f7e('0x51')](_0x2f7e('0x52'),_0xd01871);if(!_[_0x2f7e('0x53')](_0x372654[_0x2f7e('0x45')])&&fs['existsSync'](_0xd01871)){logger[_0x2f7e('0x51')](_0x2f7e('0x54')+_0xd01871+'\x22\x20trovato\x20eseguo\x20la\x20cancellazione');fs['unlinkSync'](_0xd01871);}_0xd01871=_0xd01871+_0x2f7e('0x55');if(!_['isNil'](_0x372654[_0x2f7e('0x45')])&&fs[_0x2f7e('0x49')](_0xd01871)){logger[_0x2f7e('0x51')](_0x2f7e('0x54')+_0xd01871+_0x2f7e('0x56'));fs[_0x2f7e('0x57')](_0xd01871);}return _0x372654;})[_0x2f7e('0x20')](function(_0x3cbed5){if(!_0x3cbed5)throw new InternalError();return _0x3cbed5[_0x2f7e('0x4f')]();})[_0x2f7e('0x20')](function(){_0x46071b['status'](0xcc)[_0x2f7e('0x15')]();})[_0x2f7e('0x3b')](handleError(_0x46071b,null));}; \ No newline at end of file diff --git a/server/api/squareRecording/squareRecording.model.js b/server/api/squareRecording/squareRecording.model.js index 901965b..62a0b7c 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 _0x0137=['./squareRecording.attributes','exports','define','square_recordings','lodash','util','../../config/logger','api','moment','request-promise','path','rimraf','../../config/environment'];(function(_0x28b0a4,_0x2ea758){var _0x105ce6=function(_0x6df20f){while(--_0x6df20f){_0x28b0a4['push'](_0x28b0a4['shift']());}};_0x105ce6(++_0x2ea758);}(_0x0137,0x1d8));var _0x7013=function(_0x2f922f,_0x34a14f){_0x2f922f=_0x2f922f-0x0;var _0x4a63d4=_0x0137[_0x2f922f];return _0x4a63d4;};'use strict';var _=require(_0x7013('0x0'));var util=require(_0x7013('0x1'));var logger=require(_0x7013('0x2'))(_0x7013('0x3'));var moment=require(_0x7013('0x4'));var BPromise=require('bluebird');var rp=require(_0x7013('0x5'));var fs=require('fs');var path=require(_0x7013('0x6'));var rimraf=require(_0x7013('0x7'));var config=require(_0x7013('0x8'));var attributes=require(_0x7013('0x9'));module[_0x7013('0xa')]=function(_0x50b822,_0x24cb85){return _0x50b822[_0x7013('0xb')]('SquareRecording',attributes,{'tableName':_0x7013('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xd070=['../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./squareRecording.attributes','exports','define','square_recordings','lodash'];(function(_0x48571f,_0x4c86f4){var _0x495a93=function(_0x4928b7){while(--_0x4928b7){_0x48571f['push'](_0x48571f['shift']());}};_0x495a93(++_0x4c86f4);}(_0xd070,0x8e));var _0x0d07=function(_0x129eba,_0x52ba0a){_0x129eba=_0x129eba-0x0;var _0x51d66c=_0xd070[_0x129eba];return _0x51d66c;};'use strict';var _=require(_0x0d07('0x0'));var util=require('util');var logger=require(_0x0d07('0x1'))(_0x0d07('0x2'));var moment=require(_0x0d07('0x3'));var BPromise=require(_0x0d07('0x4'));var rp=require(_0x0d07('0x5'));var fs=require('fs');var path=require(_0x0d07('0x6'));var rimraf=require(_0x0d07('0x7'));var config=require(_0x0d07('0x8'));var attributes=require(_0x0d07('0x9'));module[_0x0d07('0xa')]=function(_0x18943f,_0x495815){return _0x18943f[_0x0d07('0xb')]('SquareRecording',attributes,{'tableName':_0x0d07('0xc'),'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 844e54e..d704b3f 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 _0xc041=['../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','request','then','info','request\x20sent','debug','SquareRecording,\x20%s,\x20%s,\x20%s','stringify','error','code','SquareRecording,\x20%s,\x20%s','message','catch','CreateSquareRecording','create','body','options','raw','lodash','util','moment','bluebird','ioredis'];(function(_0x207db1,_0x19c38c){var _0x3744e1=function(_0x1cd678){while(--_0x1cd678){_0x207db1['push'](_0x207db1['shift']());}};_0x3744e1(++_0x19c38c);}(_0xc041,0xee));var _0x1c04=function(_0x2d604b,_0x4f1748){_0x2d604b=_0x2d604b-0x0;var _0x504857=_0xc041[_0x2d604b];return _0x504857;};'use strict';var _=require(_0x1c04('0x0'));var util=require(_0x1c04('0x1'));var moment=require(_0x1c04('0x2'));var BPromise=require(_0x1c04('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x1c04('0x4'));var db=require(_0x1c04('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x1c04('0x6'))(_0x1c04('0x7'));var config=require(_0x1c04('0x8'));var jayson=require(_0x1c04('0x9'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x44ad54,_0x571bd5,_0x26a93b){return new BPromise(function(_0x472706,_0x28c9ba){return client[_0x1c04('0xa')](_0x44ad54,_0x26a93b)[_0x1c04('0xb')](function(_0x2db421){logger[_0x1c04('0xc')]('SquareRecording,\x20%s,\x20%s',_0x571bd5,_0x1c04('0xd'));logger[_0x1c04('0xe')](_0x1c04('0xf'),_0x571bd5,_0x1c04('0xd'),JSON[_0x1c04('0x10')](_0x2db421));if(_0x2db421[_0x1c04('0x11')]){if(_0x2db421[_0x1c04('0x11')][_0x1c04('0x12')]===0x1f4){logger[_0x1c04('0x11')](_0x1c04('0x13'),_0x571bd5,_0x2db421['error'][_0x1c04('0x14')]);return _0x28c9ba(_0x2db421['error'][_0x1c04('0x14')]);}logger[_0x1c04('0x11')](_0x1c04('0x13'),_0x571bd5,_0x2db421[_0x1c04('0x11')][_0x1c04('0x14')]);return _0x472706(_0x2db421['error'][_0x1c04('0x14')]);}else{logger[_0x1c04('0xc')]('SquareRecording,\x20%s,\x20%s',_0x571bd5,_0x1c04('0xd'));_0x472706(_0x2db421['result'][_0x1c04('0x14')]);}})[_0x1c04('0x15')](function(_0x2bc788){logger[_0x1c04('0x11')](_0x1c04('0x13'),_0x571bd5,_0x2bc788);_0x28c9ba(_0x2bc788);});});}exports[_0x1c04('0x16')]=function(_0x3f7785){var _0x400bd5=this;return new Promise(function(_0x2e28a8,_0x8810c9){return db['SquareRecording'][_0x1c04('0x17')](_0x3f7785[_0x1c04('0x18')],{'raw':_0x3f7785[_0x1c04('0x19')]?_0x3f7785[_0x1c04('0x19')][_0x1c04('0x1a')]===undefined?!![]:![]:!![]})[_0x1c04('0xb')](function(_0x3da8cf){logger[_0x1c04('0xc')](_0x1c04('0x16'),_0x3f7785);logger['debug']('CreateSquareRecording',_0x3f7785,JSON[_0x1c04('0x10')](_0x3da8cf));_0x2e28a8(_0x3da8cf);})[_0x1c04('0x15')](function(_0x3b57ef){logger['error'](_0x1c04('0x16'),_0x3b57ef[_0x1c04('0x14')],_0x3f7785);_0x8810c9(_0x400bd5[_0x1c04('0x11')](0x1f4,_0x3b57ef['message']));});});}; \ No newline at end of file +var _0x64e2=['rpc','http','request','info','SquareRecording,\x20%s,\x20%s','debug','SquareRecording,\x20%s,\x20%s,\x20%s','request\x20sent','error','message','result','catch','CreateSquareRecording','create','options','raw','then','stringify','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger'];(function(_0xa8883,_0x1f107f){var _0x479426=function(_0x4e56b9){while(--_0x4e56b9){_0xa8883['push'](_0xa8883['shift']());}};_0x479426(++_0x1f107f);}(_0x64e2,0x189));var _0x264e=function(_0x5d22f0,_0x34f84f){_0x5d22f0=_0x5d22f0-0x0;var _0x21b32b=_0x64e2[_0x5d22f0];return _0x21b32b;};'use strict';var _=require(_0x264e('0x0'));var util=require(_0x264e('0x1'));var moment=require('moment');var BPromise=require(_0x264e('0x2'));var rs=require(_0x264e('0x3'));var fs=require('fs');var Redis=require(_0x264e('0x4'));var db=require(_0x264e('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x264e('0x6'))(_0x264e('0x7'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson['client'][_0x264e('0x8')]({'port':0x232a});function respondWithRpcPromise(_0xc3d0bb,_0x3069dd,_0xdb1d88){return new BPromise(function(_0x38a492,_0x17f1df){return client[_0x264e('0x9')](_0xc3d0bb,_0xdb1d88)['then'](function(_0x4210d2){logger[_0x264e('0xa')](_0x264e('0xb'),_0x3069dd,'request\x20sent');logger[_0x264e('0xc')](_0x264e('0xd'),_0x3069dd,_0x264e('0xe'),JSON['stringify'](_0x4210d2));if(_0x4210d2[_0x264e('0xf')]){if(_0x4210d2['error']['code']===0x1f4){logger['error'](_0x264e('0xb'),_0x3069dd,_0x4210d2[_0x264e('0xf')][_0x264e('0x10')]);return _0x17f1df(_0x4210d2[_0x264e('0xf')][_0x264e('0x10')]);}logger[_0x264e('0xf')]('SquareRecording,\x20%s,\x20%s',_0x3069dd,_0x4210d2[_0x264e('0xf')][_0x264e('0x10')]);return _0x38a492(_0x4210d2[_0x264e('0xf')][_0x264e('0x10')]);}else{logger[_0x264e('0xa')](_0x264e('0xb'),_0x3069dd,_0x264e('0xe'));_0x38a492(_0x4210d2[_0x264e('0x11')][_0x264e('0x10')]);}})[_0x264e('0x12')](function(_0x1281d7){logger['error'](_0x264e('0xb'),_0x3069dd,_0x1281d7);_0x17f1df(_0x1281d7);});});}exports[_0x264e('0x13')]=function(_0x339af7){var _0x18b785=this;return new Promise(function(_0x1cc554,_0x279ab9){return db['SquareRecording'][_0x264e('0x14')](_0x339af7['body'],{'raw':_0x339af7['options']?_0x339af7[_0x264e('0x15')][_0x264e('0x16')]===undefined?!![]:![]:!![]})[_0x264e('0x17')](function(_0x36a2dd){logger[_0x264e('0xa')](_0x264e('0x13'),_0x339af7);logger[_0x264e('0xc')](_0x264e('0x13'),_0x339af7,JSON[_0x264e('0x18')](_0x36a2dd));_0x1cc554(_0x36a2dd);})['catch'](function(_0x3a0f2e){logger[_0x264e('0xf')](_0x264e('0x13'),_0x3a0f2e[_0x264e('0x10')],_0x339af7);_0x279ab9(_0x18b785[_0x264e('0xf')](0x1f4,_0x3a0f2e['message']));});});}; \ No newline at end of file diff --git a/server/api/squareReport/index.js b/server/api/squareReport/index.js index 0be472c..d3b2d38 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 _0xefb6=['describe','/:id','show','put','update','delete','exports','multer','util','connect-timeout','express','../../components/interaction/service','../../config/environment','./squareReport.controller','isAuthenticated','index','/describe'];(function(_0x1ccdf7,_0x215d5a){var _0x52a0ae=function(_0x40324a){while(--_0x40324a){_0x1ccdf7['push'](_0x1ccdf7['shift']());}};_0x52a0ae(++_0x215d5a);}(_0xefb6,0xc2));var _0x6efb=function(_0x5db657,_0x2f40b3){_0x5db657=_0x5db657-0x0;var _0x2d6e70=_0xefb6[_0x5db657];return _0x2d6e70;};'use strict';var multer=require(_0x6efb('0x0'));var util=require(_0x6efb('0x1'));var path=require('path');var timeout=require(_0x6efb('0x2'));var express=require(_0x6efb('0x3'));var router=express['Router']();var auth=require('../../components/auth/service');var interaction=require(_0x6efb('0x4'));var config=require(_0x6efb('0x5'));var controller=require(_0x6efb('0x6'));router['get']('/',auth[_0x6efb('0x7')](),controller[_0x6efb('0x8')]);router['get'](_0x6efb('0x9'),auth['isAuthenticated'](),controller[_0x6efb('0xa')]);router['get'](_0x6efb('0xb'),auth['isAuthenticated'](),controller[_0x6efb('0xc')]);router['post']('/',auth['isAuthenticated'](),controller['create']);router[_0x6efb('0xd')](_0x6efb('0xb'),auth['isAuthenticated'](),controller[_0x6efb('0xe')]);router[_0x6efb('0xf')](_0x6efb('0xb'),auth[_0x6efb('0x7')](),controller['destroy']);module[_0x6efb('0x10')]=router; \ No newline at end of file +var _0xc64f=['./squareReport.controller','isAuthenticated','index','get','/describe','describe','/:id','show','create','put','delete','destroy','exports','multer','path','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment'];(function(_0x12ddb2,_0x5ad61e){var _0x10b6dd=function(_0x47dd27){while(--_0x47dd27){_0x12ddb2['push'](_0x12ddb2['shift']());}};_0x10b6dd(++_0x5ad61e);}(_0xc64f,0x99));var _0xfc64=function(_0x1d30b4,_0x3cfaad){_0x1d30b4=_0x1d30b4-0x0;var _0x5bbcb6=_0xc64f[_0x1d30b4];return _0x5bbcb6;};'use strict';var multer=require(_0xfc64('0x0'));var util=require('util');var path=require(_0xfc64('0x1'));var timeout=require('connect-timeout');var express=require(_0xfc64('0x2'));var router=express[_0xfc64('0x3')]();var auth=require(_0xfc64('0x4'));var interaction=require(_0xfc64('0x5'));var config=require(_0xfc64('0x6'));var controller=require(_0xfc64('0x7'));router['get']('/',auth[_0xfc64('0x8')](),controller[_0xfc64('0x9')]);router[_0xfc64('0xa')](_0xfc64('0xb'),auth[_0xfc64('0x8')](),controller[_0xfc64('0xc')]);router[_0xfc64('0xa')](_0xfc64('0xd'),auth[_0xfc64('0x8')](),controller[_0xfc64('0xe')]);router['post']('/',auth['isAuthenticated'](),controller[_0xfc64('0xf')]);router[_0xfc64('0x10')](_0xfc64('0xd'),auth[_0xfc64('0x8')](),controller['update']);router[_0xfc64('0x11')](_0xfc64('0xd'),auth[_0xfc64('0x8')](),controller[_0xfc64('0x12')]);module[_0xfc64('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 c43161f..fc44e0e 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 _0x75d9=['STRING','DATE','BOOLEAN','sequelize'];(function(_0x34af83,_0xb93e26){var _0x16dc42=function(_0x55c203){while(--_0x55c203){_0x34af83['push'](_0x34af83['shift']());}};_0x16dc42(++_0xb93e26);}(_0x75d9,0x87));var _0x975d=function(_0x254abd,_0x1ab7f0){_0x254abd=_0x254abd-0x0;var _0x31bf1b=_0x75d9[_0x254abd];return _0x31bf1b;};'use strict';var Sequelize=require(_0x975d('0x0'));module['exports']={'network':{'type':Sequelize[_0x975d('0x1')]},'network_script':{'type':Sequelize[_0x975d('0x1')]},'request':{'type':Sequelize[_0x975d('0x1')]},'channel':{'type':Sequelize[_0x975d('0x1')]},'language':{'type':Sequelize[_0x975d('0x1')]},'type':{'type':Sequelize[_0x975d('0x1')]},'uniqueid':{'type':Sequelize[_0x975d('0x1')]},'version':{'type':Sequelize[_0x975d('0x1')]},'callerid':{'type':Sequelize[_0x975d('0x1')]},'calleridname':{'type':Sequelize[_0x975d('0x1')]},'callingpres':{'type':Sequelize[_0x975d('0x1')]},'callingani2':{'type':Sequelize[_0x975d('0x1')]},'callington':{'type':Sequelize[_0x975d('0x1')]},'callingtns':{'type':Sequelize[_0x975d('0x1')]},'dnid':{'type':Sequelize[_0x975d('0x1')]},'rdnis':{'type':Sequelize['STRING']},'context':{'type':Sequelize[_0x975d('0x1')]},'extension':{'type':Sequelize['STRING']},'priority':{'type':Sequelize[_0x975d('0x1')]},'enhanced':{'type':Sequelize[_0x975d('0x1')]},'accountcode':{'type':Sequelize[_0x975d('0x1')]},'threadid':{'type':Sequelize['STRING']},'project_name':{'type':Sequelize[_0x975d('0x1')]},'joinAt':{'type':Sequelize[_0x975d('0x2')]},'leaveAt':{'type':Sequelize['DATE']},'bot':{'type':Sequelize[_0x975d('0x3')],'defaultValue':![]}}; \ No newline at end of file +var _0x40d7=['DATE','exports','STRING'];(function(_0x35d073,_0x27bf8c){var _0x4ff441=function(_0x539e97){while(--_0x539e97){_0x35d073['push'](_0x35d073['shift']());}};_0x4ff441(++_0x27bf8c);}(_0x40d7,0x1ba));var _0x740d=function(_0x5280f4,_0x3c36d0){_0x5280f4=_0x5280f4-0x0;var _0xba93e7=_0x40d7[_0x5280f4];return _0xba93e7;};'use strict';var Sequelize=require('sequelize');module[_0x740d('0x0')]={'network':{'type':Sequelize['STRING']},'network_script':{'type':Sequelize[_0x740d('0x1')]},'request':{'type':Sequelize[_0x740d('0x1')]},'channel':{'type':Sequelize[_0x740d('0x1')]},'language':{'type':Sequelize[_0x740d('0x1')]},'type':{'type':Sequelize[_0x740d('0x1')]},'uniqueid':{'type':Sequelize[_0x740d('0x1')]},'version':{'type':Sequelize[_0x740d('0x1')]},'callerid':{'type':Sequelize['STRING']},'calleridname':{'type':Sequelize[_0x740d('0x1')]},'callingpres':{'type':Sequelize[_0x740d('0x1')]},'callingani2':{'type':Sequelize[_0x740d('0x1')]},'callington':{'type':Sequelize[_0x740d('0x1')]},'callingtns':{'type':Sequelize[_0x740d('0x1')]},'dnid':{'type':Sequelize[_0x740d('0x1')]},'rdnis':{'type':Sequelize[_0x740d('0x1')]},'context':{'type':Sequelize['STRING']},'extension':{'type':Sequelize[_0x740d('0x1')]},'priority':{'type':Sequelize[_0x740d('0x1')]},'enhanced':{'type':Sequelize[_0x740d('0x1')]},'accountcode':{'type':Sequelize[_0x740d('0x1')]},'threadid':{'type':Sequelize[_0x740d('0x1')]},'project_name':{'type':Sequelize[_0x740d('0x1')]},'joinAt':{'type':Sequelize[_0x740d('0x2')]},'leaveAt':{'type':Sequelize[_0x740d('0x2')]},'bot':{'type':Sequelize['BOOLEAN'],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/squareReport/squareReport.controller.js b/server/api/squareReport/squareReport.controller.js index dc20019..c48d6d0 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 _0x814b=['index','map','rawAttributes','fieldName','key','model','keys','intersection','query','attributes','fields','length','hasOwnProperty','nolimit','sort','filters','pick','filter','where','merge','VIRTUAL','include','findAll','rows','catch','show','SquareReport','options','find','create','body','params','describe','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','to-csv','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../mysqldb','sendStatus','status','end','json','count','offset','limit','set','Content-Range','apply','save','update','destroy','then','error','stack','name','send'];(function(_0x1b5e26,_0x453ef6){var _0x246191=function(_0x54a89e){while(--_0x54a89e){_0x1b5e26['push'](_0x1b5e26['shift']());}};_0x246191(++_0x453ef6);}(_0x814b,0x1a2));var _0xb814=function(_0x287059,_0x499940){_0x287059=_0x287059-0x0;var _0x225c79=_0x814b[_0x287059];return _0x225c79;};'use strict';var pdf=require(_0xb814('0x0'));var emlformat=require(_0xb814('0x1'));var rimraf=require(_0xb814('0x2'));var zipdir=require(_0xb814('0x3'));var jsonpatch=require(_0xb814('0x4'));var rp=require(_0xb814('0x5'));var moment=require('moment');var BPromise=require(_0xb814('0x6'));var Mustache=require(_0xb814('0x7'));var util=require(_0xb814('0x8'));var path=require(_0xb814('0x9'));var sox=require(_0xb814('0xa'));var csv=require(_0xb814('0xb'));var ejs=require('ejs');var fs=require('fs');var _=require(_0xb814('0xc'));var squel=require(_0xb814('0xd'));var crypto=require('crypto');var jsforce=require(_0xb814('0xe'));var deskjs=require(_0xb814('0xf'));var toCsv=require(_0xb814('0xb'));var querystring=require(_0xb814('0x10'));var Papa=require(_0xb814('0x11'));var Redis=require(_0xb814('0x12'));var authService=require(_0xb814('0x13'));var qs=require(_0xb814('0x14'));var as=require(_0xb814('0x15'));var hardwareService=require(_0xb814('0x16'));var logger=require(_0xb814('0x17'))('api');var utils=require(_0xb814('0x18'));var config=require('../../config/environment');var db=require(_0xb814('0x19'))['db'];function respondWithStatusCode(_0x15d6ef,_0x35b10d){_0x35b10d=_0x35b10d||0xcc;return function(_0x2cc46b){if(_0x2cc46b){return _0x15d6ef[_0xb814('0x1a')](_0x35b10d);}return _0x15d6ef[_0xb814('0x1b')](_0x35b10d)[_0xb814('0x1c')]();};}function respondWithResult(_0x41ed7b,_0xa0a2e5){_0xa0a2e5=_0xa0a2e5||0xc8;return function(_0x2ab627){if(_0x2ab627){return _0x41ed7b[_0xb814('0x1b')](_0xa0a2e5)[_0xb814('0x1d')](_0x2ab627);}};}function respondWithFilteredResult(_0x17f5bd,_0x39bfcf){return function(_0x303aca){if(_0x303aca){var _0x3a71d6=_0x303aca[_0xb814('0x1e')],_0x45e0d0=_0x39bfcf[_0xb814('0x1f')],_0x265a83=_0x39bfcf['offset']+_0x39bfcf[_0xb814('0x20')],_0x125ce2;if(_0x265a83>=_0x3a71d6){_0x265a83=_0x3a71d6;_0x125ce2=0xc8;}else{_0x125ce2=0xce;}_0x17f5bd['status'](_0x125ce2);return _0x17f5bd[_0xb814('0x21')](_0xb814('0x22'),_0x45e0d0+'-'+_0x265a83+'/'+_0x3a71d6)['json'](_0x303aca);}return null;};}function patchUpdates(_0x4b55a7){return function(_0x55d63c){try{jsonpatch[_0xb814('0x23')](_0x55d63c,_0x4b55a7,!![]);}catch(_0x4d5276){return BPromise['reject'](_0x4d5276);}return _0x55d63c[_0xb814('0x24')]();};}function saveUpdates(_0x24211d,_0x25b6b6){return function(_0x4e139e){if(_0x4e139e){return _0x4e139e[_0xb814('0x25')](_0x24211d)['then'](function(_0x1e6393){return _0x1e6393;});}return null;};}function removeEntity(_0x1808a3,_0x3b267e){return function(_0x470e81){if(_0x470e81){return _0x470e81[_0xb814('0x26')]()[_0xb814('0x27')](function(){_0x1808a3[_0xb814('0x1b')](0xcc)['end']();});}};}function handleEntityNotFound(_0x2ead86,_0x52b7a3){return function(_0x3f81d0){if(!_0x3f81d0){_0x2ead86[_0xb814('0x1a')](0x194);}return _0x3f81d0;};}function handleError(_0x31c7ec,_0x208927){_0x208927=_0x208927||0x1f4;return function(_0x1c8a2e){logger[_0xb814('0x28')](_0x1c8a2e[_0xb814('0x29')]);if(_0x1c8a2e['name']){delete _0x1c8a2e[_0xb814('0x2a')];}_0x31c7ec[_0xb814('0x1b')](_0x208927)[_0xb814('0x2b')](_0x1c8a2e);};}exports[_0xb814('0x2c')]=function(_0x32ed56,_0x1d5965){var _0x3f0150={},_0x1e4e89={},_0x5a6291={'count':0x0,'rows':[]};var _0x271aa8=_[_0xb814('0x2d')](db['SquareReport'][_0xb814('0x2e')],function(_0x37d24d){return{'name':_0x37d24d[_0xb814('0x2f')],'type':_0x37d24d['type'][_0xb814('0x30')]};});_0x1e4e89[_0xb814('0x31')]=_['map'](_0x271aa8,_0xb814('0x2a'));_0x1e4e89['query']=_[_0xb814('0x32')](_0x32ed56['query']);_0x1e4e89['filters']=_[_0xb814('0x33')](_0x1e4e89['model'],_0x1e4e89[_0xb814('0x34')]);_0x3f0150[_0xb814('0x35')]=_[_0xb814('0x33')](_0x1e4e89['model'],qs['fields'](_0x32ed56[_0xb814('0x34')][_0xb814('0x36')]));_0x3f0150['attributes']=_0x3f0150[_0xb814('0x35')][_0xb814('0x37')]?_0x3f0150[_0xb814('0x35')]:_0x1e4e89[_0xb814('0x31')];if(!_0x32ed56[_0xb814('0x34')][_0xb814('0x38')](_0xb814('0x39'))){_0x3f0150['limit']=qs[_0xb814('0x20')](_0x32ed56[_0xb814('0x34')][_0xb814('0x20')]);_0x3f0150[_0xb814('0x1f')]=qs[_0xb814('0x1f')](_0x32ed56['query'][_0xb814('0x1f')]);}_0x3f0150['order']=qs[_0xb814('0x3a')](_0x32ed56[_0xb814('0x34')][_0xb814('0x3a')]);_0x3f0150['where']=qs[_0xb814('0x3b')](_[_0xb814('0x3c')](_0x32ed56['query'],_0x1e4e89[_0xb814('0x3b')]));if(_0x32ed56[_0xb814('0x34')][_0xb814('0x3d')]){_0x3f0150[_0xb814('0x3e')]=_[_0xb814('0x3f')](_0x3f0150[_0xb814('0x3e')],{'$or':_['map'](_0x271aa8,function(_0xa6ce87){if(_0xa6ce87['type']!==_0xb814('0x40')){var _0x4b5583={};_0x4b5583[_0xa6ce87[_0xb814('0x2a')]]={'$like':'%'+_0x32ed56['query'][_0xb814('0x3d')]+'%'};return _0x4b5583;}})});}_0x3f0150=_[_0xb814('0x3f')]({},_0x3f0150,_0x32ed56['options']);var _0x4d308a={'where':_0x3f0150['where']};return db['SquareReport'][_0xb814('0x1e')](_0x4d308a)[_0xb814('0x27')](function(_0x38cdc2){_0x5a6291[_0xb814('0x1e')]=_0x38cdc2;if(_0x32ed56['query']['includeAll']){_0x3f0150[_0xb814('0x41')]=[{'all':!![]}];}return db['SquareReport'][_0xb814('0x42')](_0x3f0150);})[_0xb814('0x27')](function(_0x178823){_0x5a6291[_0xb814('0x43')]=_0x178823;return _0x5a6291;})[_0xb814('0x27')](respondWithFilteredResult(_0x1d5965,_0x3f0150))[_0xb814('0x44')](handleError(_0x1d5965,null));};exports[_0xb814('0x45')]=function(_0x28b2b4,_0x31989d){var _0x4b6ff8={'raw':!![],'where':{'id':_0x28b2b4['params']['id']}},_0x544d36={};_0x544d36[_0xb814('0x31')]=_['keys'](db[_0xb814('0x46')]['rawAttributes']);_0x544d36[_0xb814('0x34')]=_[_0xb814('0x32')](_0x28b2b4[_0xb814('0x34')]);_0x544d36[_0xb814('0x3b')]=_['intersection'](_0x544d36[_0xb814('0x31')],_0x544d36[_0xb814('0x34')]);_0x4b6ff8[_0xb814('0x35')]=_[_0xb814('0x33')](_0x544d36[_0xb814('0x31')],qs[_0xb814('0x36')](_0x28b2b4['query'][_0xb814('0x36')]));_0x4b6ff8[_0xb814('0x35')]=_0x4b6ff8[_0xb814('0x35')][_0xb814('0x37')]?_0x4b6ff8[_0xb814('0x35')]:_0x544d36[_0xb814('0x31')];if(_0x28b2b4[_0xb814('0x34')]['includeAll']){_0x4b6ff8['include']=[{'all':!![]}];}_0x4b6ff8=_[_0xb814('0x3f')]({},_0x4b6ff8,_0x28b2b4[_0xb814('0x47')]);return db[_0xb814('0x46')][_0xb814('0x48')](_0x4b6ff8)[_0xb814('0x27')](handleEntityNotFound(_0x31989d,null))[_0xb814('0x27')](respondWithResult(_0x31989d,null))[_0xb814('0x44')](handleError(_0x31989d,null));};exports[_0xb814('0x49')]=function(_0x2eb9b6,_0x344198){return db[_0xb814('0x46')]['create'](_0x2eb9b6[_0xb814('0x4a')],{})[_0xb814('0x27')](respondWithResult(_0x344198,0xc9))['catch'](handleError(_0x344198,null));};exports[_0xb814('0x25')]=function(_0x55234d,_0x2fb0f7){if(_0x55234d[_0xb814('0x4a')]['id']){delete _0x55234d[_0xb814('0x4a')]['id'];}return db[_0xb814('0x46')][_0xb814('0x48')]({'where':{'id':_0x55234d[_0xb814('0x4b')]['id']}})[_0xb814('0x27')](handleEntityNotFound(_0x2fb0f7,null))[_0xb814('0x27')](saveUpdates(_0x55234d[_0xb814('0x4a')],null))[_0xb814('0x27')](respondWithResult(_0x2fb0f7,null))['catch'](handleError(_0x2fb0f7,null));};exports['destroy']=function(_0x32eca6,_0x30f07b){return db[_0xb814('0x46')][_0xb814('0x48')]({'where':{'id':_0x32eca6[_0xb814('0x4b')]['id']}})[_0xb814('0x27')](handleEntityNotFound(_0x30f07b,null))[_0xb814('0x27')](removeEntity(_0x30f07b,null))['catch'](handleError(_0x30f07b,null));};exports[_0xb814('0x4c')]=function(_0x388324,_0xf27a6e){return db['SquareReport'][_0xb814('0x4c')]()['then'](respondWithResult(_0xf27a6e,null))[_0xb814('0x44')](handleError(_0xf27a6e,null));}; \ No newline at end of file +var _0xf494=['pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','catch','show','params','find','create','body','destroy','describe','html-pdf','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../config/utils','sendStatus','status','end','count','offset','limit','apply','reject','update','then','stack','name','send','index','map','SquareReport','rawAttributes','fieldName','type','key','query','keys','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where'];(function(_0x23e6bb,_0x5c2d69){var _0x1e3b4c=function(_0x1afc46){while(--_0x1afc46){_0x23e6bb['push'](_0x23e6bb['shift']());}};_0x1e3b4c(++_0x5c2d69);}(_0xf494,0x1c6));var _0x4f49=function(_0x1046b8,_0x2dcf18){_0x1046b8=_0x1046b8-0x0;var _0x480e1d=_0xf494[_0x1046b8];return _0x480e1d;};'use strict';var pdf=require(_0x4f49('0x0'));var emlformat=require(_0x4f49('0x1'));var rimraf=require(_0x4f49('0x2'));var zipdir=require('zip-dir');var jsonpatch=require(_0x4f49('0x3'));var rp=require(_0x4f49('0x4'));var moment=require(_0x4f49('0x5'));var BPromise=require(_0x4f49('0x6'));var Mustache=require(_0x4f49('0x7'));var util=require(_0x4f49('0x8'));var path=require(_0x4f49('0x9'));var sox=require(_0x4f49('0xa'));var csv=require(_0x4f49('0xb'));var ejs=require(_0x4f49('0xc'));var fs=require('fs');var _=require(_0x4f49('0xd'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x4f49('0xe'));var deskjs=require(_0x4f49('0xf'));var toCsv=require(_0x4f49('0xb'));var querystring=require(_0x4f49('0x10'));var Papa=require(_0x4f49('0x11'));var Redis=require(_0x4f49('0x12'));var authService=require(_0x4f49('0x13'));var qs=require(_0x4f49('0x14'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x4f49('0x15'));var logger=require(_0x4f49('0x16'))('api');var utils=require(_0x4f49('0x17'));var config=require('../../config/environment');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x4b9cd3,_0x12527d){_0x12527d=_0x12527d||0xcc;return function(_0x4bf89f){if(_0x4bf89f){return _0x4b9cd3[_0x4f49('0x18')](_0x12527d);}return _0x4b9cd3[_0x4f49('0x19')](_0x12527d)[_0x4f49('0x1a')]();};}function respondWithResult(_0x2efe49,_0x1a0f1e){_0x1a0f1e=_0x1a0f1e||0xc8;return function(_0x2f0131){if(_0x2f0131){return _0x2efe49[_0x4f49('0x19')](_0x1a0f1e)['json'](_0x2f0131);}};}function respondWithFilteredResult(_0x515ace,_0x1f2d0d){return function(_0x415e83){if(_0x415e83){var _0x5878f4=_0x415e83[_0x4f49('0x1b')],_0x5bdfaf=_0x1f2d0d['offset'],_0x2f0a0d=_0x1f2d0d[_0x4f49('0x1c')]+_0x1f2d0d[_0x4f49('0x1d')],_0x2ecaaa;if(_0x2f0a0d>=_0x5878f4){_0x2f0a0d=_0x5878f4;_0x2ecaaa=0xc8;}else{_0x2ecaaa=0xce;}_0x515ace[_0x4f49('0x19')](_0x2ecaaa);return _0x515ace['set']('Content-Range',_0x5bdfaf+'-'+_0x2f0a0d+'/'+_0x5878f4)['json'](_0x415e83);}return null;};}function patchUpdates(_0x47f1e8){return function(_0xb2081a){try{jsonpatch[_0x4f49('0x1e')](_0xb2081a,_0x47f1e8,!![]);}catch(_0x1c2d70){return BPromise[_0x4f49('0x1f')](_0x1c2d70);}return _0xb2081a['save']();};}function saveUpdates(_0x416893,_0x2aed27){return function(_0x197a49){if(_0x197a49){return _0x197a49[_0x4f49('0x20')](_0x416893)[_0x4f49('0x21')](function(_0x509f7c){return _0x509f7c;});}return null;};}function removeEntity(_0x3e7e28,_0x357446){return function(_0x3ae590){if(_0x3ae590){return _0x3ae590['destroy']()[_0x4f49('0x21')](function(){_0x3e7e28[_0x4f49('0x19')](0xcc)[_0x4f49('0x1a')]();});}};}function handleEntityNotFound(_0x43c458,_0x9d30aa){return function(_0x36187b){if(!_0x36187b){_0x43c458['sendStatus'](0x194);}return _0x36187b;};}function handleError(_0x4e9041,_0x3a947b){_0x3a947b=_0x3a947b||0x1f4;return function(_0x429de7){logger['error'](_0x429de7[_0x4f49('0x22')]);if(_0x429de7[_0x4f49('0x23')]){delete _0x429de7[_0x4f49('0x23')];}_0x4e9041['status'](_0x3a947b)[_0x4f49('0x24')](_0x429de7);};}exports[_0x4f49('0x25')]=function(_0x298785,_0x148153){var _0xfefbab={},_0x122404={},_0x4915af={'count':0x0,'rows':[]};var _0x50c571=_[_0x4f49('0x26')](db[_0x4f49('0x27')][_0x4f49('0x28')],function(_0x560050){return{'name':_0x560050[_0x4f49('0x29')],'type':_0x560050[_0x4f49('0x2a')][_0x4f49('0x2b')]};});_0x122404['model']=_['map'](_0x50c571,_0x4f49('0x23'));_0x122404[_0x4f49('0x2c')]=_[_0x4f49('0x2d')](_0x298785['query']);_0x122404[_0x4f49('0x2e')]=_[_0x4f49('0x2f')](_0x122404[_0x4f49('0x30')],_0x122404[_0x4f49('0x2c')]);_0xfefbab[_0x4f49('0x31')]=_[_0x4f49('0x2f')](_0x122404[_0x4f49('0x30')],qs[_0x4f49('0x32')](_0x298785[_0x4f49('0x2c')][_0x4f49('0x32')]));_0xfefbab[_0x4f49('0x31')]=_0xfefbab[_0x4f49('0x31')][_0x4f49('0x33')]?_0xfefbab[_0x4f49('0x31')]:_0x122404[_0x4f49('0x30')];if(!_0x298785[_0x4f49('0x2c')][_0x4f49('0x34')](_0x4f49('0x35'))){_0xfefbab[_0x4f49('0x1d')]=qs['limit'](_0x298785[_0x4f49('0x2c')][_0x4f49('0x1d')]);_0xfefbab[_0x4f49('0x1c')]=qs[_0x4f49('0x1c')](_0x298785[_0x4f49('0x2c')][_0x4f49('0x1c')]);}_0xfefbab[_0x4f49('0x36')]=qs[_0x4f49('0x37')](_0x298785[_0x4f49('0x2c')][_0x4f49('0x37')]);_0xfefbab[_0x4f49('0x38')]=qs[_0x4f49('0x2e')](_[_0x4f49('0x39')](_0x298785['query'],_0x122404[_0x4f49('0x2e')]));if(_0x298785[_0x4f49('0x2c')][_0x4f49('0x3a')]){_0xfefbab[_0x4f49('0x38')]=_[_0x4f49('0x3b')](_0xfefbab[_0x4f49('0x38')],{'$or':_[_0x4f49('0x26')](_0x50c571,function(_0x25fdf8){if(_0x25fdf8[_0x4f49('0x2a')]!==_0x4f49('0x3c')){var _0x173b6e={};_0x173b6e[_0x25fdf8[_0x4f49('0x23')]]={'$like':'%'+_0x298785[_0x4f49('0x2c')][_0x4f49('0x3a')]+'%'};return _0x173b6e;}})});}_0xfefbab=_['merge']({},_0xfefbab,_0x298785[_0x4f49('0x3d')]);var _0xb0e6c2={'where':_0xfefbab['where']};return db[_0x4f49('0x27')][_0x4f49('0x1b')](_0xb0e6c2)['then'](function(_0x29e762){_0x4915af[_0x4f49('0x1b')]=_0x29e762;if(_0x298785[_0x4f49('0x2c')][_0x4f49('0x3e')]){_0xfefbab[_0x4f49('0x3f')]=[{'all':!![]}];}return db[_0x4f49('0x27')][_0x4f49('0x40')](_0xfefbab);})['then'](function(_0x5e1461){_0x4915af['rows']=_0x5e1461;return _0x4915af;})[_0x4f49('0x21')](respondWithFilteredResult(_0x148153,_0xfefbab))[_0x4f49('0x41')](handleError(_0x148153,null));};exports[_0x4f49('0x42')]=function(_0x373f90,_0x1053b2){var _0x1ecf6c={'raw':!![],'where':{'id':_0x373f90[_0x4f49('0x43')]['id']}},_0x38aff8={};_0x38aff8[_0x4f49('0x30')]=_['keys'](db['SquareReport'][_0x4f49('0x28')]);_0x38aff8[_0x4f49('0x2c')]=_[_0x4f49('0x2d')](_0x373f90['query']);_0x38aff8[_0x4f49('0x2e')]=_['intersection'](_0x38aff8['model'],_0x38aff8[_0x4f49('0x2c')]);_0x1ecf6c[_0x4f49('0x31')]=_[_0x4f49('0x2f')](_0x38aff8['model'],qs[_0x4f49('0x32')](_0x373f90[_0x4f49('0x2c')]['fields']));_0x1ecf6c[_0x4f49('0x31')]=_0x1ecf6c['attributes'][_0x4f49('0x33')]?_0x1ecf6c[_0x4f49('0x31')]:_0x38aff8[_0x4f49('0x30')];if(_0x373f90['query'][_0x4f49('0x3e')]){_0x1ecf6c[_0x4f49('0x3f')]=[{'all':!![]}];}_0x1ecf6c=_[_0x4f49('0x3b')]({},_0x1ecf6c,_0x373f90[_0x4f49('0x3d')]);return db[_0x4f49('0x27')][_0x4f49('0x44')](_0x1ecf6c)[_0x4f49('0x21')](handleEntityNotFound(_0x1053b2,null))[_0x4f49('0x21')](respondWithResult(_0x1053b2,null))[_0x4f49('0x41')](handleError(_0x1053b2,null));};exports[_0x4f49('0x45')]=function(_0x4fe382,_0x26c222){return db[_0x4f49('0x27')]['create'](_0x4fe382[_0x4f49('0x46')],{})['then'](respondWithResult(_0x26c222,0xc9))[_0x4f49('0x41')](handleError(_0x26c222,null));};exports[_0x4f49('0x20')]=function(_0x2d3dcd,_0x300230){if(_0x2d3dcd['body']['id']){delete _0x2d3dcd[_0x4f49('0x46')]['id'];}return db[_0x4f49('0x27')][_0x4f49('0x44')]({'where':{'id':_0x2d3dcd[_0x4f49('0x43')]['id']}})[_0x4f49('0x21')](handleEntityNotFound(_0x300230,null))[_0x4f49('0x21')](saveUpdates(_0x2d3dcd[_0x4f49('0x46')],null))[_0x4f49('0x21')](respondWithResult(_0x300230,null))[_0x4f49('0x41')](handleError(_0x300230,null));};exports[_0x4f49('0x47')]=function(_0x1be59a,_0x4482f7){return db[_0x4f49('0x27')][_0x4f49('0x44')]({'where':{'id':_0x1be59a[_0x4f49('0x43')]['id']}})[_0x4f49('0x21')](handleEntityNotFound(_0x4482f7,null))['then'](removeEntity(_0x4482f7,null))['catch'](handleError(_0x4482f7,null));};exports[_0x4f49('0x48')]=function(_0x197670,_0x36bcc2){return db[_0x4f49('0x27')][_0x4f49('0x48')]()[_0x4f49('0x21')](respondWithResult(_0x36bcc2,null))[_0x4f49('0x41')](handleError(_0x36bcc2,null));}; \ No newline at end of file diff --git a/server/api/squareReport/squareReport.model.js b/server/api/squareReport/squareReport.model.js index 178053b..88b3e71 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 _0x0385=['exports','SquareReport','uid_pname','uniqueid','leaveAt','lodash','util','../../config/logger','api','moment','bluebird','request-promise','rimraf'];(function(_0x25938e,_0x2f0639){var _0x26255e=function(_0x2a8348){while(--_0x2a8348){_0x25938e['push'](_0x25938e['shift']());}};_0x26255e(++_0x2f0639);}(_0x0385,0xa1));var _0x5038=function(_0x3d82af,_0x5a703d){_0x3d82af=_0x3d82af-0x0;var _0x22de45=_0x0385[_0x3d82af];return _0x22de45;};'use strict';var _=require(_0x5038('0x0'));var util=require(_0x5038('0x1'));var logger=require(_0x5038('0x2'))(_0x5038('0x3'));var moment=require(_0x5038('0x4'));var BPromise=require(_0x5038('0x5'));var rp=require(_0x5038('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0x5038('0x7'));var config=require('../../config/environment');var attributes=require('./squareReport.attributes');module[_0x5038('0x8')]=function(_0xdb807,_0x39f9ef){return _0xdb807['define'](_0x5038('0x9'),attributes,{'tableName':'report_square','paranoid':![],'indexes':[{'name':_0x5038('0xa'),'fields':[_0x5038('0xb'),'project_name']},{'name':_0x5038('0xc'),'fields':[_0x5038('0xc')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x7dd9=['SquareReport','report_square','uniqueid','leaveAt','lodash','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','exports','define'];(function(_0x187499,_0x5e416a){var _0x2965fe=function(_0xc6645e){while(--_0xc6645e){_0x187499['push'](_0x187499['shift']());}};_0x2965fe(++_0x5e416a);}(_0x7dd9,0x1e4));var _0x97dd=function(_0x3bedf6,_0x3f4cf7){_0x3bedf6=_0x3bedf6-0x0;var _0xc273a6=_0x7dd9[_0x3bedf6];return _0xc273a6;};'use strict';var _=require(_0x97dd('0x0'));var util=require('util');var logger=require(_0x97dd('0x1'))(_0x97dd('0x2'));var moment=require(_0x97dd('0x3'));var BPromise=require(_0x97dd('0x4'));var rp=require(_0x97dd('0x5'));var fs=require('fs');var path=require(_0x97dd('0x6'));var rimraf=require(_0x97dd('0x7'));var config=require(_0x97dd('0x8'));var attributes=require('./squareReport.attributes');module[_0x97dd('0x9')]=function(_0x547ca7,_0x1fe610){return _0x547ca7[_0x97dd('0xa')](_0x97dd('0xb'),attributes,{'tableName':_0x97dd('0xc'),'paranoid':![],'indexes':[{'name':'uid_pname','fields':[_0x97dd('0xd'),'project_name']},{'name':'leaveAt','fields':[_0x97dd('0xe')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/squareReport/squareReport.rpc.js b/server/api/squareReport/squareReport.rpc.js index 6bf2572..49227fa 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 _0xb182=['options','update','raw','where','attributes','limit','debug','lodash','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','then','info','SquareReport,\x20%s,\x20%s','request\x20sent','stringify','error','message','result','catch','CreateSquareReport','create','body'];(function(_0x4ccd32,_0x3b11c9){var _0x30b693=function(_0x1b816f){while(--_0x1b816f){_0x4ccd32['push'](_0x4ccd32['shift']());}};_0x30b693(++_0x3b11c9);}(_0xb182,0x19a));var _0x2b18=function(_0x136619,_0x31c9b2){_0x136619=_0x136619-0x0;var _0x38c4a5=_0xb182[_0x136619];return _0x38c4a5;};'use strict';var _=require(_0x2b18('0x0'));var util=require('util');var moment=require(_0x2b18('0x1'));var BPromise=require('bluebird');var rs=require(_0x2b18('0x2'));var fs=require('fs');var Redis=require(_0x2b18('0x3'));var db=require(_0x2b18('0x4'))['db'];var utils=require(_0x2b18('0x5'));var logger=require(_0x2b18('0x6'))(_0x2b18('0x7'));var config=require(_0x2b18('0x8'));var jayson=require(_0x2b18('0x9'));var client=jayson[_0x2b18('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x13bbbc,_0x5b851c,_0xc47ecd){return new BPromise(function(_0x5ee80d,_0x5ebe48){return client[_0x2b18('0xb')](_0x13bbbc,_0xc47ecd)[_0x2b18('0xc')](function(_0x408515){logger[_0x2b18('0xd')](_0x2b18('0xe'),_0x5b851c,'request\x20sent');logger['debug']('SquareReport,\x20%s,\x20%s,\x20%s',_0x5b851c,_0x2b18('0xf'),JSON[_0x2b18('0x10')](_0x408515));if(_0x408515['error']){if(_0x408515[_0x2b18('0x11')]['code']===0x1f4){logger[_0x2b18('0x11')](_0x2b18('0xe'),_0x5b851c,_0x408515[_0x2b18('0x11')]['message']);return _0x5ebe48(_0x408515[_0x2b18('0x11')][_0x2b18('0x12')]);}logger[_0x2b18('0x11')]('SquareReport,\x20%s,\x20%s',_0x5b851c,_0x408515[_0x2b18('0x11')][_0x2b18('0x12')]);return _0x5ee80d(_0x408515[_0x2b18('0x11')][_0x2b18('0x12')]);}else{logger[_0x2b18('0xd')]('SquareReport,\x20%s,\x20%s',_0x5b851c,_0x2b18('0xf'));_0x5ee80d(_0x408515[_0x2b18('0x13')][_0x2b18('0x12')]);}})[_0x2b18('0x14')](function(_0x12dfb5){logger['error'](_0x2b18('0xe'),_0x5b851c,_0x12dfb5);_0x5ebe48(_0x12dfb5);});});}exports[_0x2b18('0x15')]=function(_0x51989d){var _0x188fef=this;return new Promise(function(_0x1f714f,_0x5b620c){return db['SquareReport'][_0x2b18('0x16')](_0x51989d[_0x2b18('0x17')],{'raw':_0x51989d[_0x2b18('0x18')]?_0x51989d[_0x2b18('0x18')]['raw']===undefined?!![]:![]:!![]})[_0x2b18('0xc')](function(_0x19f423){logger['info'](_0x2b18('0x15'),_0x51989d);logger['debug'](_0x2b18('0x15'),_0x51989d,JSON[_0x2b18('0x10')](_0x19f423));_0x1f714f(_0x19f423);})['catch'](function(_0x38fdfb){logger[_0x2b18('0x11')](_0x2b18('0x15'),_0x38fdfb[_0x2b18('0x12')],_0x51989d);_0x5b620c(_0x188fef[_0x2b18('0x11')](0x1f4,_0x38fdfb['message']));});});};exports['UpdateSquareReport']=function(_0x1f1b74){var _0x14c7d2=this;return new Promise(function(_0x51cccb,_0x27780f){return db['SquareReport'][_0x2b18('0x19')](_0x1f1b74['body'],{'raw':_0x1f1b74[_0x2b18('0x18')]?_0x1f1b74[_0x2b18('0x18')][_0x2b18('0x1a')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x1f1b74[_0x2b18('0x18')]?_0x1f1b74[_0x2b18('0x18')][_0x2b18('0x1b')]||null:null,'attributes':_0x1f1b74[_0x2b18('0x18')]?_0x1f1b74[_0x2b18('0x18')][_0x2b18('0x1c')]||null:null,'limit':_0x1f1b74[_0x2b18('0x18')]?_0x1f1b74[_0x2b18('0x18')][_0x2b18('0x1d')]||null:null})['then'](function(_0x995f1f){logger[_0x2b18('0xd')]('UpdateSquareReport',_0x1f1b74);logger[_0x2b18('0x1e')]('UpdateSquareReport',_0x1f1b74,JSON[_0x2b18('0x10')](_0x995f1f));_0x51cccb(_0x995f1f);})[_0x2b18('0x14')](function(_0x297782){logger[_0x2b18('0x11')]('UpdateSquareReport',_0x297782['message'],_0x1f1b74);_0x27780f(_0x14c7d2[_0x2b18('0x11')](0x1f4,_0x297782[_0x2b18('0x12')]));});});}; \ No newline at end of file +var _0x9550=['attributes','limit','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','SquareReport,\x20%s,\x20%s','SquareReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','request\x20sent','result','catch','SquareReport','body','options','raw','CreateSquareReport','debug','UpdateSquareReport','update','where'];(function(_0x17d9e3,_0x1f969c){var _0x14192d=function(_0x159745){while(--_0x159745){_0x17d9e3['push'](_0x17d9e3['shift']());}};_0x14192d(++_0x1f969c);}(_0x9550,0xda));var _0x0955=function(_0x3b8f95,_0x5e0107){_0x3b8f95=_0x3b8f95-0x0;var _0x237bcc=_0x9550[_0x3b8f95];return _0x237bcc;};'use strict';var _=require(_0x0955('0x0'));var util=require(_0x0955('0x1'));var moment=require(_0x0955('0x2'));var BPromise=require(_0x0955('0x3'));var rs=require(_0x0955('0x4'));var fs=require('fs');var Redis=require(_0x0955('0x5'));var db=require(_0x0955('0x6'))['db'];var utils=require(_0x0955('0x7'));var logger=require(_0x0955('0x8'))(_0x0955('0x9'));var config=require(_0x0955('0xa'));var jayson=require(_0x0955('0xb'));var client=jayson['client'][_0x0955('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x2e89ee,_0x33b9d5,_0x2bfb5a){return new BPromise(function(_0x3e545b,_0x1a0f15){return client[_0x0955('0xd')](_0x2e89ee,_0x2bfb5a)[_0x0955('0xe')](function(_0x160efa){logger['info'](_0x0955('0xf'),_0x33b9d5,'request\x20sent');logger['debug'](_0x0955('0x10'),_0x33b9d5,'request\x20sent',JSON[_0x0955('0x11')](_0x160efa));if(_0x160efa[_0x0955('0x12')]){if(_0x160efa[_0x0955('0x12')][_0x0955('0x13')]===0x1f4){logger[_0x0955('0x12')](_0x0955('0xf'),_0x33b9d5,_0x160efa['error'][_0x0955('0x14')]);return _0x1a0f15(_0x160efa[_0x0955('0x12')]['message']);}logger['error']('SquareReport,\x20%s,\x20%s',_0x33b9d5,_0x160efa[_0x0955('0x12')][_0x0955('0x14')]);return _0x3e545b(_0x160efa[_0x0955('0x12')][_0x0955('0x14')]);}else{logger[_0x0955('0x15')]('SquareReport,\x20%s,\x20%s',_0x33b9d5,_0x0955('0x16'));_0x3e545b(_0x160efa[_0x0955('0x17')][_0x0955('0x14')]);}})[_0x0955('0x18')](function(_0x211b82){logger[_0x0955('0x12')](_0x0955('0xf'),_0x33b9d5,_0x211b82);_0x1a0f15(_0x211b82);});});}exports['CreateSquareReport']=function(_0x3f8034){var _0x5aba10=this;return new Promise(function(_0x3edc50,_0x33aa9c){return db[_0x0955('0x19')]['create'](_0x3f8034[_0x0955('0x1a')],{'raw':_0x3f8034[_0x0955('0x1b')]?_0x3f8034[_0x0955('0x1b')][_0x0955('0x1c')]===undefined?!![]:![]:!![]})[_0x0955('0xe')](function(_0x22940b){logger[_0x0955('0x15')](_0x0955('0x1d'),_0x3f8034);logger[_0x0955('0x1e')]('CreateSquareReport',_0x3f8034,JSON[_0x0955('0x11')](_0x22940b));_0x3edc50(_0x22940b);})[_0x0955('0x18')](function(_0xe39a61){logger[_0x0955('0x12')](_0x0955('0x1d'),_0xe39a61['message'],_0x3f8034);_0x33aa9c(_0x5aba10[_0x0955('0x12')](0x1f4,_0xe39a61[_0x0955('0x14')]));});});};exports[_0x0955('0x1f')]=function(_0x5ce212){var _0x26c178=this;return new Promise(function(_0x200746,_0x274464){return db[_0x0955('0x19')][_0x0955('0x20')](_0x5ce212[_0x0955('0x1a')],{'raw':_0x5ce212[_0x0955('0x1b')]?_0x5ce212[_0x0955('0x1b')][_0x0955('0x1c')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x5ce212[_0x0955('0x1b')]?_0x5ce212[_0x0955('0x1b')][_0x0955('0x21')]||null:null,'attributes':_0x5ce212['options']?_0x5ce212['options'][_0x0955('0x22')]||null:null,'limit':_0x5ce212[_0x0955('0x1b')]?_0x5ce212[_0x0955('0x1b')][_0x0955('0x23')]||null:null})[_0x0955('0xe')](function(_0x46a406){logger['info'](_0x0955('0x1f'),_0x5ce212);logger[_0x0955('0x1e')](_0x0955('0x1f'),_0x5ce212,JSON[_0x0955('0x11')](_0x46a406));_0x200746(_0x46a406);})[_0x0955('0x18')](function(_0x552359){logger[_0x0955('0x12')](_0x0955('0x1f'),_0x552359[_0x0955('0x14')],_0x5ce212);_0x274464(_0x26c178[_0x0955('0x12')](0x1f4,_0x552359[_0x0955('0x14')]));});});}; \ No newline at end of file diff --git a/server/api/squareReportDetail/index.js b/server/api/squareReportDetail/index.js index 5a77a4d..d67e0f8 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(_0x3b55d1,_0x1875cd){var _0x4e6a4d=function(_0x5a9a33){while(--_0x5a9a33){_0x3b55d1['push'](_0x3b55d1['shift']());}};_0x4e6a4d(++_0x1875cd);}(_0x7a54,0x106));var _0x47a5=function(_0x29de7b,_0x593442){_0x29de7b=_0x29de7b-0x0;var _0x5221e8=_0x7a54[_0x29de7b];return _0x5221e8;};'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 _0x814b=['path','connect-timeout','express','Router','../../components/interaction/service','../../config/environment','./squareReportDetail.controller','get','isAuthenticated','index','/describe','/:id','show','post','create','put','update','destroy','exports','multer','util'];(function(_0x1facfa,_0x1acf7d){var _0x9ec701=function(_0x115e37){while(--_0x115e37){_0x1facfa['push'](_0x1facfa['shift']());}};_0x9ec701(++_0x1acf7d);}(_0x814b,0x1a2));var _0xb814=function(_0x4b7f28,_0x27d23a){_0x4b7f28=_0x4b7f28-0x0;var _0xf5b553=_0x814b[_0x4b7f28];return _0xf5b553;};'use strict';var multer=require(_0xb814('0x0'));var util=require(_0xb814('0x1'));var path=require(_0xb814('0x2'));var timeout=require(_0xb814('0x3'));var express=require(_0xb814('0x4'));var router=express[_0xb814('0x5')]();var auth=require('../../components/auth/service');var interaction=require(_0xb814('0x6'));var config=require(_0xb814('0x7'));var controller=require(_0xb814('0x8'));router[_0xb814('0x9')]('/',auth[_0xb814('0xa')](),controller[_0xb814('0xb')]);router['get'](_0xb814('0xc'),auth[_0xb814('0xa')](),controller['describe']);router[_0xb814('0x9')](_0xb814('0xd'),auth[_0xb814('0xa')](),controller[_0xb814('0xe')]);router[_0xb814('0xf')]('/',auth[_0xb814('0xa')](),controller[_0xb814('0x10')]);router[_0xb814('0x11')](_0xb814('0xd'),auth[_0xb814('0xa')](),controller[_0xb814('0x12')]);router['delete'](_0xb814('0xd'),auth['isAuthenticated'](),controller[_0xb814('0x13')]);module[_0xb814('0x14')]=router; \ No newline at end of file diff --git a/server/api/squareReportDetail/squareReportDetail.attributes.js b/server/api/squareReportDetail/squareReportDetail.attributes.js index 7399ec9..27d3e21 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 _0x7d2e=['exports','STRING','TEXT','sequelize'];(function(_0x4d986d,_0x3d2cb2){var _0x150b8a=function(_0x37fad7){while(--_0x37fad7){_0x4d986d['push'](_0x4d986d['shift']());}};_0x150b8a(++_0x3d2cb2);}(_0x7d2e,0xd3));var _0xe7d2=function(_0x3ad06e,_0x2cc9af){_0x3ad06e=_0x3ad06e-0x0;var _0xa97338=_0x7d2e[_0x3ad06e];return _0xa97338;};'use strict';var Sequelize=require(_0xe7d2('0x0'));module[_0xe7d2('0x1')]={'uniqueid':{'type':Sequelize[_0xe7d2('0x2')]},'node':{'type':Sequelize[_0xe7d2('0x2')]},'application':{'type':Sequelize[_0xe7d2('0x2')]},'data':{'type':Sequelize[_0xe7d2('0x3')]},'project_name':{'type':Sequelize[_0xe7d2('0x2')]},'callerid':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x0cc4=['TEXT','sequelize','exports','STRING'];(function(_0x3d8440,_0xcf877b){var _0x220da9=function(_0x24feaf){while(--_0x24feaf){_0x3d8440['push'](_0x3d8440['shift']());}};_0x220da9(++_0xcf877b);}(_0x0cc4,0x181));var _0x40cc=function(_0x3b0d12,_0x581b78){_0x3b0d12=_0x3b0d12-0x0;var _0x44eb08=_0x0cc4[_0x3b0d12];return _0x44eb08;};'use strict';var Sequelize=require(_0x40cc('0x0'));module[_0x40cc('0x1')]={'uniqueid':{'type':Sequelize['STRING']},'node':{'type':Sequelize[_0x40cc('0x2')]},'application':{'type':Sequelize['STRING']},'data':{'type':Sequelize[_0x40cc('0x3')]},'project_name':{'type':Sequelize['STRING']},'callerid':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/squareReportDetail/squareReportDetail.controller.js b/server/api/squareReportDetail/squareReportDetail.controller.js index 9c1df1c..37a57c1 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 _0x33eb=['eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','end','json','count','offset','status','set','Content-Range','apply','reject','save','then','error','stack','name','send','index','SquareDetailsReport','rawAttributes','fieldName','type','key','model','map','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','limit','order','sort','where','pick','filter','merge','options','includeAll','include','rows','params','keys','catch','create','body','update','find','destroy','describe','html-pdf'];(function(_0x1b6025,_0xd1a810){var _0x406a7c=function(_0x397828){while(--_0x397828){_0x1b6025['push'](_0x1b6025['shift']());}};_0x406a7c(++_0xd1a810);}(_0x33eb,0x137));var _0xb33e=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x33eb[_0x20a584];return _0x4b41a8;};'use strict';var pdf=require(_0xb33e('0x0'));var emlformat=require(_0xb33e('0x1'));var rimraf=require(_0xb33e('0x2'));var zipdir=require(_0xb33e('0x3'));var jsonpatch=require(_0xb33e('0x4'));var rp=require(_0xb33e('0x5'));var moment=require('moment');var BPromise=require(_0xb33e('0x6'));var Mustache=require(_0xb33e('0x7'));var util=require('util');var path=require(_0xb33e('0x8'));var sox=require(_0xb33e('0x9'));var csv=require(_0xb33e('0xa'));var ejs=require(_0xb33e('0xb'));var fs=require('fs');var _=require(_0xb33e('0xc'));var squel=require(_0xb33e('0xd'));var crypto=require(_0xb33e('0xe'));var jsforce=require(_0xb33e('0xf'));var deskjs=require(_0xb33e('0x10'));var toCsv=require(_0xb33e('0xa'));var querystring=require(_0xb33e('0x11'));var Papa=require(_0xb33e('0x12'));var Redis=require(_0xb33e('0x13'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0xb33e('0x14'));var hardwareService=require(_0xb33e('0x15'));var logger=require('../../config/logger')(_0xb33e('0x16'));var utils=require(_0xb33e('0x17'));var config=require(_0xb33e('0x18'));var db=require(_0xb33e('0x19'))['db'];function respondWithStatusCode(_0x308fbc,_0x534e55){_0x534e55=_0x534e55||0xcc;return function(_0x3a89c3){if(_0x3a89c3){return _0x308fbc[_0xb33e('0x1a')](_0x534e55);}return _0x308fbc['status'](_0x534e55)[_0xb33e('0x1b')]();};}function respondWithResult(_0x1685b0,_0xc2a033){_0xc2a033=_0xc2a033||0xc8;return function(_0x208424){if(_0x208424){return _0x1685b0['status'](_0xc2a033)[_0xb33e('0x1c')](_0x208424);}};}function respondWithFilteredResult(_0x3b1284,_0xc19c93){return function(_0x51dae0){if(_0x51dae0){var _0x2e6944=_0x51dae0[_0xb33e('0x1d')],_0x306201=_0xc19c93['offset'],_0x458e4e=_0xc19c93[_0xb33e('0x1e')]+_0xc19c93['limit'],_0xf6842;if(_0x458e4e>=_0x2e6944){_0x458e4e=_0x2e6944;_0xf6842=0xc8;}else{_0xf6842=0xce;}_0x3b1284[_0xb33e('0x1f')](_0xf6842);return _0x3b1284[_0xb33e('0x20')](_0xb33e('0x21'),_0x306201+'-'+_0x458e4e+'/'+_0x2e6944)[_0xb33e('0x1c')](_0x51dae0);}return null;};}function patchUpdates(_0x29b991){return function(_0x4bba67){try{jsonpatch[_0xb33e('0x22')](_0x4bba67,_0x29b991,!![]);}catch(_0x189266){return BPromise[_0xb33e('0x23')](_0x189266);}return _0x4bba67[_0xb33e('0x24')]();};}function saveUpdates(_0x4eb045,_0x17a142){return function(_0x3d9af0){if(_0x3d9af0){return _0x3d9af0['update'](_0x4eb045)[_0xb33e('0x25')](function(_0x4276b3){return _0x4276b3;});}return null;};}function removeEntity(_0x3c8c0b,_0xddbda4){return function(_0x351220){if(_0x351220){return _0x351220['destroy']()[_0xb33e('0x25')](function(){_0x3c8c0b[_0xb33e('0x1f')](0xcc)[_0xb33e('0x1b')]();});}};}function handleEntityNotFound(_0x4d7025,_0x3f44aa){return function(_0x1e40f4){if(!_0x1e40f4){_0x4d7025[_0xb33e('0x1a')](0x194);}return _0x1e40f4;};}function handleError(_0x1fca19,_0x11351a){_0x11351a=_0x11351a||0x1f4;return function(_0x40e9be){logger[_0xb33e('0x26')](_0x40e9be[_0xb33e('0x27')]);if(_0x40e9be[_0xb33e('0x28')]){delete _0x40e9be[_0xb33e('0x28')];}_0x1fca19[_0xb33e('0x1f')](_0x11351a)[_0xb33e('0x29')](_0x40e9be);};}exports[_0xb33e('0x2a')]=function(_0x47b4fc,_0x5b1767){var _0x3ef81e={},_0x4ee030={},_0x27be01={'count':0x0,'rows':[]};var _0x3c2765=_['map'](db[_0xb33e('0x2b')][_0xb33e('0x2c')],function(_0x21824e){return{'name':_0x21824e[_0xb33e('0x2d')],'type':_0x21824e[_0xb33e('0x2e')][_0xb33e('0x2f')]};});_0x4ee030[_0xb33e('0x30')]=_[_0xb33e('0x31')](_0x3c2765,_0xb33e('0x28'));_0x4ee030['query']=_['keys'](_0x47b4fc[_0xb33e('0x32')]);_0x4ee030[_0xb33e('0x33')]=_[_0xb33e('0x34')](_0x4ee030[_0xb33e('0x30')],_0x4ee030[_0xb33e('0x32')]);_0x3ef81e[_0xb33e('0x35')]=_[_0xb33e('0x34')](_0x4ee030[_0xb33e('0x30')],qs[_0xb33e('0x36')](_0x47b4fc[_0xb33e('0x32')]['fields']));_0x3ef81e[_0xb33e('0x35')]=_0x3ef81e[_0xb33e('0x35')][_0xb33e('0x37')]?_0x3ef81e[_0xb33e('0x35')]:_0x4ee030['model'];if(!_0x47b4fc['query'][_0xb33e('0x38')](_0xb33e('0x39'))){_0x3ef81e['limit']=qs[_0xb33e('0x3a')](_0x47b4fc['query'][_0xb33e('0x3a')]);_0x3ef81e[_0xb33e('0x1e')]=qs[_0xb33e('0x1e')](_0x47b4fc[_0xb33e('0x32')][_0xb33e('0x1e')]);}_0x3ef81e[_0xb33e('0x3b')]=qs[_0xb33e('0x3c')](_0x47b4fc['query'][_0xb33e('0x3c')]);_0x3ef81e[_0xb33e('0x3d')]=qs[_0xb33e('0x33')](_[_0xb33e('0x3e')](_0x47b4fc[_0xb33e('0x32')],_0x4ee030[_0xb33e('0x33')]));if(_0x47b4fc['query'][_0xb33e('0x3f')]){_0x3ef81e[_0xb33e('0x3d')]=_[_0xb33e('0x40')](_0x3ef81e[_0xb33e('0x3d')],{'$or':_['map'](_0x3c2765,function(_0x337205){if(_0x337205[_0xb33e('0x2e')]!=='VIRTUAL'){var _0x1d93ea={};_0x1d93ea[_0x337205['name']]={'$like':'%'+_0x47b4fc[_0xb33e('0x32')][_0xb33e('0x3f')]+'%'};return _0x1d93ea;}})});}_0x3ef81e=_['merge']({},_0x3ef81e,_0x47b4fc[_0xb33e('0x41')]);var _0x354d5a={'where':_0x3ef81e[_0xb33e('0x3d')]};return db[_0xb33e('0x2b')]['count'](_0x354d5a)[_0xb33e('0x25')](function(_0x34acfa){_0x27be01[_0xb33e('0x1d')]=_0x34acfa;if(_0x47b4fc[_0xb33e('0x32')][_0xb33e('0x42')]){_0x3ef81e[_0xb33e('0x43')]=[{'all':!![]}];}return db[_0xb33e('0x2b')]['findAll'](_0x3ef81e);})[_0xb33e('0x25')](function(_0x4a0148){_0x27be01[_0xb33e('0x44')]=_0x4a0148;return _0x27be01;})[_0xb33e('0x25')](respondWithFilteredResult(_0x5b1767,_0x3ef81e))['catch'](handleError(_0x5b1767,null));};exports['show']=function(_0x428865,_0x4f2851){var _0x415e95={'raw':!![],'where':{'id':_0x428865[_0xb33e('0x45')]['id']}},_0x52fd8c={};_0x52fd8c[_0xb33e('0x30')]=_[_0xb33e('0x46')](db['SquareDetailsReport']['rawAttributes']);_0x52fd8c[_0xb33e('0x32')]=_[_0xb33e('0x46')](_0x428865[_0xb33e('0x32')]);_0x52fd8c['filters']=_[_0xb33e('0x34')](_0x52fd8c[_0xb33e('0x30')],_0x52fd8c[_0xb33e('0x32')]);_0x415e95[_0xb33e('0x35')]=_['intersection'](_0x52fd8c[_0xb33e('0x30')],qs[_0xb33e('0x36')](_0x428865['query'][_0xb33e('0x36')]));_0x415e95[_0xb33e('0x35')]=_0x415e95['attributes']['length']?_0x415e95[_0xb33e('0x35')]:_0x52fd8c[_0xb33e('0x30')];if(_0x428865[_0xb33e('0x32')]['includeAll']){_0x415e95['include']=[{'all':!![]}];}_0x415e95=_[_0xb33e('0x40')]({},_0x415e95,_0x428865[_0xb33e('0x41')]);return db['SquareDetailsReport']['find'](_0x415e95)['then'](handleEntityNotFound(_0x4f2851,null))[_0xb33e('0x25')](respondWithResult(_0x4f2851,null))[_0xb33e('0x47')](handleError(_0x4f2851,null));};exports[_0xb33e('0x48')]=function(_0x3267b9,_0x1b120f){return db[_0xb33e('0x2b')][_0xb33e('0x48')](_0x3267b9[_0xb33e('0x49')],{})[_0xb33e('0x25')](respondWithResult(_0x1b120f,0xc9))[_0xb33e('0x47')](handleError(_0x1b120f,null));};exports[_0xb33e('0x4a')]=function(_0x284936,_0x35520f){if(_0x284936[_0xb33e('0x49')]['id']){delete _0x284936[_0xb33e('0x49')]['id'];}return db[_0xb33e('0x2b')][_0xb33e('0x4b')]({'where':{'id':_0x284936[_0xb33e('0x45')]['id']}})[_0xb33e('0x25')](handleEntityNotFound(_0x35520f,null))['then'](saveUpdates(_0x284936['body'],null))[_0xb33e('0x25')](respondWithResult(_0x35520f,null))['catch'](handleError(_0x35520f,null));};exports[_0xb33e('0x4c')]=function(_0x188e74,_0x33fbcf){return db['SquareDetailsReport'][_0xb33e('0x4b')]({'where':{'id':_0x188e74[_0xb33e('0x45')]['id']}})[_0xb33e('0x25')](handleEntityNotFound(_0x33fbcf,null))['then'](removeEntity(_0x33fbcf,null))['catch'](handleError(_0x33fbcf,null));};exports['describe']=function(_0x19a556,_0x40b8ac){return db[_0xb33e('0x2b')][_0xb33e('0x4d')]()[_0xb33e('0x25')](respondWithResult(_0x40b8ac,null))[_0xb33e('0x47')](handleError(_0x40b8ac,null));}; \ No newline at end of file +var _0x98b1=['filters','filter','where','merge','count','includeAll','include','findAll','rows','catch','show','params','options','create','body','find','describe','html-pdf','eml-format','rimraf','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','lodash','crypto','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','offset','limit','Content-Range','apply','reject','save','update','destroy','then','error','index','SquareDetailsReport','rawAttributes','fieldName','type','key','model','map','name','keys','intersection','query','attributes','fields','length','hasOwnProperty','order'];(function(_0x3ca7bd,_0x377ca3){var _0x4b1edc=function(_0x22893d){while(--_0x22893d){_0x3ca7bd['push'](_0x3ca7bd['shift']());}};_0x4b1edc(++_0x377ca3);}(_0x98b1,0x179));var _0x198b=function(_0x2b4085,_0x4e21fe){_0x2b4085=_0x2b4085-0x0;var _0x5cc0c5=_0x98b1[_0x2b4085];return _0x5cc0c5;};'use strict';var pdf=require(_0x198b('0x0'));var emlformat=require(_0x198b('0x1'));var rimraf=require(_0x198b('0x2'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x198b('0x3'));var moment=require(_0x198b('0x4'));var BPromise=require(_0x198b('0x5'));var Mustache=require(_0x198b('0x6'));var util=require(_0x198b('0x7'));var path=require(_0x198b('0x8'));var sox=require(_0x198b('0x9'));var csv=require(_0x198b('0xa'));var ejs=require('ejs');var fs=require('fs');var _=require(_0x198b('0xb'));var squel=require('squel');var crypto=require(_0x198b('0xc'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x198b('0xa'));var querystring=require(_0x198b('0xd'));var Papa=require('papaparse');var Redis=require(_0x198b('0xe'));var authService=require(_0x198b('0xf'));var qs=require(_0x198b('0x10'));var as=require(_0x198b('0x11'));var hardwareService=require(_0x198b('0x12'));var logger=require(_0x198b('0x13'))(_0x198b('0x14'));var utils=require(_0x198b('0x15'));var config=require(_0x198b('0x16'));var db=require(_0x198b('0x17'))['db'];function respondWithStatusCode(_0xdffa6a,_0x3bcd39){_0x3bcd39=_0x3bcd39||0xcc;return function(_0xa4a8a2){if(_0xa4a8a2){return _0xdffa6a[_0x198b('0x18')](_0x3bcd39);}return _0xdffa6a[_0x198b('0x19')](_0x3bcd39)[_0x198b('0x1a')]();};}function respondWithResult(_0x1675e6,_0x5e25b3){_0x5e25b3=_0x5e25b3||0xc8;return function(_0x258a27){if(_0x258a27){return _0x1675e6[_0x198b('0x19')](_0x5e25b3)[_0x198b('0x1b')](_0x258a27);}};}function respondWithFilteredResult(_0x40f56c,_0x39eabf){return function(_0x1c974c){if(_0x1c974c){var _0x2e4f34=_0x1c974c['count'],_0x35a653=_0x39eabf[_0x198b('0x1c')],_0x499bb7=_0x39eabf[_0x198b('0x1c')]+_0x39eabf[_0x198b('0x1d')],_0x414974;if(_0x499bb7>=_0x2e4f34){_0x499bb7=_0x2e4f34;_0x414974=0xc8;}else{_0x414974=0xce;}_0x40f56c['status'](_0x414974);return _0x40f56c['set'](_0x198b('0x1e'),_0x35a653+'-'+_0x499bb7+'/'+_0x2e4f34)[_0x198b('0x1b')](_0x1c974c);}return null;};}function patchUpdates(_0x20d25f){return function(_0x5e5164){try{jsonpatch[_0x198b('0x1f')](_0x5e5164,_0x20d25f,!![]);}catch(_0x19ac95){return BPromise[_0x198b('0x20')](_0x19ac95);}return _0x5e5164[_0x198b('0x21')]();};}function saveUpdates(_0x50f407,_0x49c0b2){return function(_0x619f6b){if(_0x619f6b){return _0x619f6b[_0x198b('0x22')](_0x50f407)['then'](function(_0xc6286c){return _0xc6286c;});}return null;};}function removeEntity(_0x2667b0,_0x5131ca){return function(_0x3cf88c){if(_0x3cf88c){return _0x3cf88c[_0x198b('0x23')]()[_0x198b('0x24')](function(){_0x2667b0[_0x198b('0x19')](0xcc)[_0x198b('0x1a')]();});}};}function handleEntityNotFound(_0x59448e,_0x2d9e40){return function(_0x2b48fc){if(!_0x2b48fc){_0x59448e[_0x198b('0x18')](0x194);}return _0x2b48fc;};}function handleError(_0x198aa7,_0x464079){_0x464079=_0x464079||0x1f4;return function(_0xacd5e){logger[_0x198b('0x25')](_0xacd5e['stack']);if(_0xacd5e['name']){delete _0xacd5e['name'];}_0x198aa7[_0x198b('0x19')](_0x464079)['send'](_0xacd5e);};}exports[_0x198b('0x26')]=function(_0x3d4d2e,_0x2e398e){var _0x197497={},_0x42d755={},_0x39ad2a={'count':0x0,'rows':[]};var _0x490169=_['map'](db[_0x198b('0x27')][_0x198b('0x28')],function(_0x1b7c3b){return{'name':_0x1b7c3b[_0x198b('0x29')],'type':_0x1b7c3b[_0x198b('0x2a')][_0x198b('0x2b')]};});_0x42d755[_0x198b('0x2c')]=_[_0x198b('0x2d')](_0x490169,_0x198b('0x2e'));_0x42d755['query']=_[_0x198b('0x2f')](_0x3d4d2e['query']);_0x42d755['filters']=_[_0x198b('0x30')](_0x42d755[_0x198b('0x2c')],_0x42d755[_0x198b('0x31')]);_0x197497[_0x198b('0x32')]=_[_0x198b('0x30')](_0x42d755[_0x198b('0x2c')],qs[_0x198b('0x33')](_0x3d4d2e['query'][_0x198b('0x33')]));_0x197497[_0x198b('0x32')]=_0x197497[_0x198b('0x32')][_0x198b('0x34')]?_0x197497[_0x198b('0x32')]:_0x42d755['model'];if(!_0x3d4d2e['query'][_0x198b('0x35')]('nolimit')){_0x197497['limit']=qs['limit'](_0x3d4d2e['query'][_0x198b('0x1d')]);_0x197497['offset']=qs['offset'](_0x3d4d2e['query'][_0x198b('0x1c')]);}_0x197497[_0x198b('0x36')]=qs['sort'](_0x3d4d2e[_0x198b('0x31')]['sort']);_0x197497['where']=qs[_0x198b('0x37')](_['pick'](_0x3d4d2e[_0x198b('0x31')],_0x42d755[_0x198b('0x37')]));if(_0x3d4d2e[_0x198b('0x31')][_0x198b('0x38')]){_0x197497[_0x198b('0x39')]=_[_0x198b('0x3a')](_0x197497['where'],{'$or':_[_0x198b('0x2d')](_0x490169,function(_0x224af1){if(_0x224af1['type']!=='VIRTUAL'){var _0x607a1a={};_0x607a1a[_0x224af1[_0x198b('0x2e')]]={'$like':'%'+_0x3d4d2e[_0x198b('0x31')][_0x198b('0x38')]+'%'};return _0x607a1a;}})});}_0x197497=_[_0x198b('0x3a')]({},_0x197497,_0x3d4d2e['options']);var _0x2e307a={'where':_0x197497['where']};return db[_0x198b('0x27')]['count'](_0x2e307a)[_0x198b('0x24')](function(_0x1a4fcf){_0x39ad2a[_0x198b('0x3b')]=_0x1a4fcf;if(_0x3d4d2e[_0x198b('0x31')][_0x198b('0x3c')]){_0x197497[_0x198b('0x3d')]=[{'all':!![]}];}return db[_0x198b('0x27')][_0x198b('0x3e')](_0x197497);})['then'](function(_0x3f1a31){_0x39ad2a[_0x198b('0x3f')]=_0x3f1a31;return _0x39ad2a;})['then'](respondWithFilteredResult(_0x2e398e,_0x197497))[_0x198b('0x40')](handleError(_0x2e398e,null));};exports[_0x198b('0x41')]=function(_0x40398c,_0x59eb5a){var _0x372996={'raw':!![],'where':{'id':_0x40398c[_0x198b('0x42')]['id']}},_0x331a13={};_0x331a13[_0x198b('0x2c')]=_[_0x198b('0x2f')](db[_0x198b('0x27')][_0x198b('0x28')]);_0x331a13[_0x198b('0x31')]=_[_0x198b('0x2f')](_0x40398c['query']);_0x331a13[_0x198b('0x37')]=_[_0x198b('0x30')](_0x331a13['model'],_0x331a13[_0x198b('0x31')]);_0x372996[_0x198b('0x32')]=_['intersection'](_0x331a13['model'],qs[_0x198b('0x33')](_0x40398c[_0x198b('0x31')][_0x198b('0x33')]));_0x372996['attributes']=_0x372996[_0x198b('0x32')][_0x198b('0x34')]?_0x372996[_0x198b('0x32')]:_0x331a13[_0x198b('0x2c')];if(_0x40398c[_0x198b('0x31')][_0x198b('0x3c')]){_0x372996['include']=[{'all':!![]}];}_0x372996=_[_0x198b('0x3a')]({},_0x372996,_0x40398c[_0x198b('0x43')]);return db[_0x198b('0x27')]['find'](_0x372996)['then'](handleEntityNotFound(_0x59eb5a,null))['then'](respondWithResult(_0x59eb5a,null))[_0x198b('0x40')](handleError(_0x59eb5a,null));};exports[_0x198b('0x44')]=function(_0x2b9cd8,_0x3452b3){return db['SquareDetailsReport']['create'](_0x2b9cd8[_0x198b('0x45')],{})['then'](respondWithResult(_0x3452b3,0xc9))[_0x198b('0x40')](handleError(_0x3452b3,null));};exports[_0x198b('0x22')]=function(_0x6b66a9,_0x4ac823){if(_0x6b66a9[_0x198b('0x45')]['id']){delete _0x6b66a9['body']['id'];}return db['SquareDetailsReport']['find']({'where':{'id':_0x6b66a9[_0x198b('0x42')]['id']}})[_0x198b('0x24')](handleEntityNotFound(_0x4ac823,null))[_0x198b('0x24')](saveUpdates(_0x6b66a9[_0x198b('0x45')],null))[_0x198b('0x24')](respondWithResult(_0x4ac823,null))[_0x198b('0x40')](handleError(_0x4ac823,null));};exports[_0x198b('0x23')]=function(_0x548dbb,_0x1a0007){return db[_0x198b('0x27')][_0x198b('0x46')]({'where':{'id':_0x548dbb[_0x198b('0x42')]['id']}})[_0x198b('0x24')](handleEntityNotFound(_0x1a0007,null))[_0x198b('0x24')](removeEntity(_0x1a0007,null))['catch'](handleError(_0x1a0007,null));};exports['describe']=function(_0x505a3d,_0x16ab39){return db['SquareDetailsReport'][_0x198b('0x47')]()['then'](respondWithResult(_0x16ab39,null))[_0x198b('0x40')](handleError(_0x16ab39,null));}; \ No newline at end of file diff --git a/server/api/squareReportDetail/squareReportDetail.model.js b/server/api/squareReportDetail/squareReportDetail.model.js index 71a631c..32945c0 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 _0xd185=['define','SquareDetailsReport','report_square_details','lodash','api','moment','request-promise','path','rimraf','../../config/environment','./squareReportDetail.attributes'];(function(_0x396248,_0x5b7ff2){var _0x568f77=function(_0x4a5108){while(--_0x4a5108){_0x396248['push'](_0x396248['shift']());}};_0x568f77(++_0x5b7ff2);}(_0xd185,0x92));var _0x5d18=function(_0x39bd45,_0x3f6f04){_0x39bd45=_0x39bd45-0x0;var _0x440b78=_0xd185[_0x39bd45];return _0x440b78;};'use strict';var _=require(_0x5d18('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x5d18('0x1'));var moment=require(_0x5d18('0x2'));var BPromise=require('bluebird');var rp=require(_0x5d18('0x3'));var fs=require('fs');var path=require(_0x5d18('0x4'));var rimraf=require(_0x5d18('0x5'));var config=require(_0x5d18('0x6'));var attributes=require(_0x5d18('0x7'));module['exports']=function(_0x4de72b,_0x3e08b5){return _0x4de72b[_0x5d18('0x8')](_0x5d18('0x9'),attributes,{'tableName':_0x5d18('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xe81b=['lodash','util','../../config/logger','api','moment','bluebird','../../config/environment','./squareReportDetail.attributes','exports','define','SquareDetailsReport','report_square_details'];(function(_0x2d2c16,_0x4e88b6){var _0x53f2fb=function(_0x6b6dac){while(--_0x6b6dac){_0x2d2c16['push'](_0x2d2c16['shift']());}};_0x53f2fb(++_0x4e88b6);}(_0xe81b,0xe4));var _0xbe81=function(_0x49b207,_0x408ade){_0x49b207=_0x49b207-0x0;var _0x2dc8fa=_0xe81b[_0x49b207];return _0x2dc8fa;};'use strict';var _=require(_0xbe81('0x0'));var util=require(_0xbe81('0x1'));var logger=require(_0xbe81('0x2'))(_0xbe81('0x3'));var moment=require(_0xbe81('0x4'));var BPromise=require(_0xbe81('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0xbe81('0x6'));var attributes=require(_0xbe81('0x7'));module[_0xbe81('0x8')]=function(_0x341da7,_0x1c937a){return _0x341da7[_0xbe81('0x9')](_0xbe81('0xa'),attributes,{'tableName':_0xbe81('0xb'),'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 d82f2ba..7156689 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 _0x07fd=['util','moment','bluebird','ioredis','../../mysqldb','../../config/logger','rpc','jayson/promise','client','http','info','request\x20sent','debug','stringify','error','SquareDetailsReport,\x20%s,\x20%s','message','result','catch','CreateSquareDetailsReport','SquareDetailsReport','create','body','options','raw','then','lodash'];(function(_0x154e78,_0x2cd7d8){var _0x597b82=function(_0x547701){while(--_0x547701){_0x154e78['push'](_0x154e78['shift']());}};_0x597b82(++_0x2cd7d8);}(_0x07fd,0xa1));var _0xd07f=function(_0x1bd224,_0xd2b3c8){_0x1bd224=_0x1bd224-0x0;var _0x4292a1=_0x07fd[_0x1bd224];return _0x4292a1;};'use strict';var _=require(_0xd07f('0x0'));var util=require(_0xd07f('0x1'));var moment=require(_0xd07f('0x2'));var BPromise=require(_0xd07f('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xd07f('0x4'));var db=require(_0xd07f('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0xd07f('0x6'))(_0xd07f('0x7'));var config=require('../../config/environment');var jayson=require(_0xd07f('0x8'));var client=jayson[_0xd07f('0x9')][_0xd07f('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x5ad159,_0x2ee99f,_0x187ec4){return new BPromise(function(_0x22a45d,_0x41ab4c){return client['request'](_0x5ad159,_0x187ec4)['then'](function(_0x5a9f7e){logger[_0xd07f('0xb')]('SquareDetailsReport,\x20%s,\x20%s',_0x2ee99f,_0xd07f('0xc'));logger[_0xd07f('0xd')]('SquareDetailsReport,\x20%s,\x20%s,\x20%s',_0x2ee99f,_0xd07f('0xc'),JSON[_0xd07f('0xe')](_0x5a9f7e));if(_0x5a9f7e['error']){if(_0x5a9f7e[_0xd07f('0xf')]['code']===0x1f4){logger[_0xd07f('0xf')](_0xd07f('0x10'),_0x2ee99f,_0x5a9f7e[_0xd07f('0xf')][_0xd07f('0x11')]);return _0x41ab4c(_0x5a9f7e[_0xd07f('0xf')]['message']);}logger['error'](_0xd07f('0x10'),_0x2ee99f,_0x5a9f7e[_0xd07f('0xf')]['message']);return _0x22a45d(_0x5a9f7e['error'][_0xd07f('0x11')]);}else{logger[_0xd07f('0xb')](_0xd07f('0x10'),_0x2ee99f,_0xd07f('0xc'));_0x22a45d(_0x5a9f7e[_0xd07f('0x12')][_0xd07f('0x11')]);}})[_0xd07f('0x13')](function(_0x31bc09){logger[_0xd07f('0xf')]('SquareDetailsReport,\x20%s,\x20%s',_0x2ee99f,_0x31bc09);_0x41ab4c(_0x31bc09);});});}exports[_0xd07f('0x14')]=function(_0x7e9250){var _0x4448c3=this;return new Promise(function(_0x46c1df,_0x24f946){return db[_0xd07f('0x15')][_0xd07f('0x16')](_0x7e9250[_0xd07f('0x17')],{'raw':_0x7e9250[_0xd07f('0x18')]?_0x7e9250[_0xd07f('0x18')][_0xd07f('0x19')]===undefined?!![]:![]:!![]})[_0xd07f('0x1a')](function(_0x3e474e){logger[_0xd07f('0xb')]('CreateSquareDetailsReport',_0x7e9250);logger[_0xd07f('0xd')](_0xd07f('0x14'),_0x7e9250,JSON['stringify'](_0x3e474e));_0x46c1df(_0x3e474e);})['catch'](function(_0x218518){logger[_0xd07f('0xf')]('CreateSquareDetailsReport',_0x218518[_0xd07f('0x11')],_0x7e9250);_0x24f946(_0x4448c3[_0xd07f('0xf')](0x1f4,_0x218518[_0xd07f('0x11')]));});});}; \ No newline at end of file +var _0xf445=['ioredis','../../config/utils','rpc','../../config/environment','jayson/promise','http','request','then','info','debug','SquareDetailsReport,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','SquareDetailsReport,\x20%s,\x20%s','message','result','catch','CreateSquareDetailsReport','create','options','raw','lodash','moment','bluebird','randomstring'];(function(_0x1c5725,_0x52798c){var _0x5784b0=function(_0xb6b153){while(--_0xb6b153){_0x1c5725['push'](_0x1c5725['shift']());}};_0x5784b0(++_0x52798c);}(_0xf445,0x1d0));var _0x5f44=function(_0x25d4ee,_0xc95872){_0x25d4ee=_0x25d4ee-0x0;var _0x214a35=_0xf445[_0x25d4ee];return _0x214a35;};'use strict';var _=require(_0x5f44('0x0'));var util=require('util');var moment=require(_0x5f44('0x1'));var BPromise=require(_0x5f44('0x2'));var rs=require(_0x5f44('0x3'));var fs=require('fs');var Redis=require(_0x5f44('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x5f44('0x5'));var logger=require('../../config/logger')(_0x5f44('0x6'));var config=require(_0x5f44('0x7'));var jayson=require(_0x5f44('0x8'));var client=jayson['client'][_0x5f44('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x562667,_0x301575,_0x380b41){return new BPromise(function(_0x49e968,_0x28c5cf){return client[_0x5f44('0xa')](_0x562667,_0x380b41)[_0x5f44('0xb')](function(_0x46909f){logger[_0x5f44('0xc')]('SquareDetailsReport,\x20%s,\x20%s',_0x301575,'request\x20sent');logger[_0x5f44('0xd')](_0x5f44('0xe'),_0x301575,_0x5f44('0xf'),JSON[_0x5f44('0x10')](_0x46909f));if(_0x46909f[_0x5f44('0x11')]){if(_0x46909f[_0x5f44('0x11')]['code']===0x1f4){logger[_0x5f44('0x11')](_0x5f44('0x12'),_0x301575,_0x46909f[_0x5f44('0x11')][_0x5f44('0x13')]);return _0x28c5cf(_0x46909f[_0x5f44('0x11')][_0x5f44('0x13')]);}logger[_0x5f44('0x11')](_0x5f44('0x12'),_0x301575,_0x46909f[_0x5f44('0x11')]['message']);return _0x49e968(_0x46909f[_0x5f44('0x11')][_0x5f44('0x13')]);}else{logger[_0x5f44('0xc')](_0x5f44('0x12'),_0x301575,'request\x20sent');_0x49e968(_0x46909f[_0x5f44('0x14')][_0x5f44('0x13')]);}})[_0x5f44('0x15')](function(_0x3da1cb){logger[_0x5f44('0x11')]('SquareDetailsReport,\x20%s,\x20%s',_0x301575,_0x3da1cb);_0x28c5cf(_0x3da1cb);});});}exports[_0x5f44('0x16')]=function(_0x52c56d){var _0x2a9355=this;return new Promise(function(_0x5a7a86,_0x11ee6f){return db['SquareDetailsReport'][_0x5f44('0x17')](_0x52c56d['body'],{'raw':_0x52c56d[_0x5f44('0x18')]?_0x52c56d[_0x5f44('0x18')][_0x5f44('0x19')]===undefined?!![]:![]:!![]})['then'](function(_0x2be550){logger[_0x5f44('0xc')](_0x5f44('0x16'),_0x52c56d);logger[_0x5f44('0xd')](_0x5f44('0x16'),_0x52c56d,JSON[_0x5f44('0x10')](_0x2be550));_0x5a7a86(_0x2be550);})['catch'](function(_0x5c6bc7){logger[_0x5f44('0x11')](_0x5f44('0x16'),_0x5c6bc7[_0x5f44('0x13')],_0x52c56d);_0x11ee6f(_0x2a9355[_0x5f44('0x11')](0x1f4,_0x5c6bc7[_0x5f44('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/system/index.js b/server/api/system/index.js index d641d28..bf6376e 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 _0xe0b3=['get','isAuthenticated','index','/process/:pid/kill','killProcess','exports','express','Router','../../components/auth/service','./system.controller'];(function(_0x90ddca,_0x4afe48){var _0x19ded3=function(_0x26359c){while(--_0x26359c){_0x90ddca['push'](_0x90ddca['shift']());}};_0x19ded3(++_0x4afe48);}(_0xe0b3,0x1e6));var _0x3e0b=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xe0b3[_0x20a584];return _0x4b41a8;};'use strict';var express=require(_0x3e0b('0x0'));var router=express[_0x3e0b('0x1')]();var auth=require(_0x3e0b('0x2'));var controller=require(_0x3e0b('0x3'));router[_0x3e0b('0x4')]('/',auth[_0x3e0b('0x5')](),controller[_0x3e0b('0x6')]);router[_0x3e0b('0x4')](_0x3e0b('0x7'),auth[_0x3e0b('0x5')](),controller[_0x3e0b('0x8')]);module[_0x3e0b('0x9')]=router; \ No newline at end of file +var _0x3260=['Router','../../components/auth/service','./system.controller','index','get','/process/:pid/kill','isAuthenticated','exports','express'];(function(_0x8cca08,_0x4b60b7){var _0x346ff8=function(_0x2a6a1c){while(--_0x2a6a1c){_0x8cca08['push'](_0x8cca08['shift']());}};_0x346ff8(++_0x4b60b7);}(_0x3260,0xd7));var _0x0326=function(_0x50439d,_0x3aed4c){_0x50439d=_0x50439d-0x0;var _0x5dc279=_0x3260[_0x50439d];return _0x5dc279;};'use strict';var express=require(_0x0326('0x0'));var router=express[_0x0326('0x1')]();var auth=require(_0x0326('0x2'));var controller=require(_0x0326('0x3'));router['get']('/',auth['isAuthenticated'](),controller[_0x0326('0x4')]);router[_0x0326('0x5')](_0x0326('0x6'),auth[_0x0326('0x7')](),controller['killProcess']);module[_0x0326('0x8')]=router; \ No newline at end of file diff --git a/server/api/system/system.controller.js b/server/api/system/system.controller.js index b2e1261..0867d1f 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 _0x0bdb=['killProcess','systeminformation','../../config/logger','api','util','bluebird','lodash','error','<%-\x20name\x20%>,\x20%s,\x20%s,\x20%s','name','status','send','index','then','json','catch','ps\x20-p\x20%s\x20-ww\x20-o\x20args','params','pid','split','indexOf','Process\x20with\x20pid\x20%s\x20not\x20found!','kill','SIGINT','format','Process\x20with\x20pid\x20%s\x20killed\x20correctly'];(function(_0x487b0c,_0x14ff74){var _0x1adbdc=function(_0x2e7b9d){while(--_0x2e7b9d){_0x487b0c['push'](_0x487b0c['shift']());}};_0x1adbdc(++_0x14ff74);}(_0x0bdb,0x11f));var _0xb0bd=function(_0x26d9c5,_0x57e918){_0x26d9c5=_0x26d9c5-0x0;var _0x560d97=_0x0bdb[_0x26d9c5];return _0x560d97;};'use strict';var info=require(_0xb0bd('0x0'));var exec=require('child_process')['exec'];var logger=require(_0xb0bd('0x1'))(_0xb0bd('0x2'));var util=require(_0xb0bd('0x3'));var BPromise=require(_0xb0bd('0x4'));var _=require(_0xb0bd('0x5'));function handleError(_0x177100,_0x95626f,_0x20f04e){_0x95626f=_0x95626f||0x1f4;return function(_0x21b3c2){logger[_0xb0bd('0x6')](_0xb0bd('0x7'),_0x20f04e,_0x95626f,util['inspect'](_0x21b3c2,{'showHidden':![],'depth':null}));delete _0x21b3c2[_0xb0bd('0x8')];_0x177100[_0xb0bd('0x9')](_0x95626f)[_0xb0bd('0xa')](_0x21b3c2);};}exports[_0xb0bd('0xb')]=function(_0x39c08c,_0x3fc52d){return info['getAllData']()[_0xb0bd('0xc')](function(_0x246dd0){return _0x3fc52d[_0xb0bd('0x9')](0xc8)[_0xb0bd('0xd')](_0x246dd0);})[_0xb0bd('0xe')](function(_0x24be21){return _0x3fc52d[_0xb0bd('0x9')](0x1f4)[_0xb0bd('0xd')](_0x24be21);});};exports['killProcess']=function(_0x4c0dbb,_0x4493d8){var _0x316074=['components/import/cm'];return new BPromise(function(_0x1b3237,_0x2476c3){return exec(util['format'](_0xb0bd('0xf'),_0x4c0dbb[_0xb0bd('0x10')][_0xb0bd('0x11')]),function(_0x1aaa34,_0x35592c,_0xfb2eaf){if(_0x1aaa34){return _0x2476c3(_0x1aaa34);}return _0x1b3237(_0x35592c);});})[_0xb0bd('0xc')](function(_0x4eb525){var _0x1df700=![];var _0x3d6a44=_0x4eb525[_0xb0bd('0x12')](/\n/);for(var _0x42e335=0x0,_0x114f1a=_0x316074['length'];_0x42e335<_0x114f1a,_0x1df700===![];_0x42e335+=0x1){if(_0x4eb525[_0xb0bd('0x13')](_0x316074[_0x42e335])>=0x0){_0x1df700=!![];}}if(!_0x1df700){throw new Error(util['format'](_0xb0bd('0x14'),_0x4c0dbb[_0xb0bd('0x10')][_0xb0bd('0x11')]));}process[_0xb0bd('0x15')](_0x4c0dbb['params'][_0xb0bd('0x11')],_0xb0bd('0x16'));return _0x4493d8[_0xb0bd('0x9')](0xc8)[_0xb0bd('0xd')]({'message':util[_0xb0bd('0x17')](_0xb0bd('0x18'),_0x4c0dbb[_0xb0bd('0x10')][_0xb0bd('0x11')])});})[_0xb0bd('0xe')](handleError(_0x4493d8,null,_0xb0bd('0x19')));}; \ No newline at end of file +var _0x855a=['getAllData','then','json','catch','killProcess','components/import/cm','format','ps\x20-p\x20%s\x20-ww\x20-o\x20args','pid','split','length','indexOf','params','SIGINT','Process\x20with\x20pid\x20%s\x20killed\x20correctly','child_process','../../config/logger','api','util','<%-\x20name\x20%>,\x20%s,\x20%s,\x20%s','inspect','name','status','index'];(function(_0xc72b0f,_0xacc5e8){var _0xd66522=function(_0x4c4983){while(--_0x4c4983){_0xc72b0f['push'](_0xc72b0f['shift']());}};_0xd66522(++_0xacc5e8);}(_0x855a,0x6f));var _0xa855=function(_0x134192,_0x36adc5){_0x134192=_0x134192-0x0;var _0x3cd080=_0x855a[_0x134192];return _0x3cd080;};'use strict';var info=require('systeminformation');var exec=require(_0xa855('0x0'))['exec'];var logger=require(_0xa855('0x1'))(_0xa855('0x2'));var util=require(_0xa855('0x3'));var BPromise=require('bluebird');var _=require('lodash');function handleError(_0x4a4dd6,_0x402783,_0x373344){_0x402783=_0x402783||0x1f4;return function(_0x523a90){logger['error'](_0xa855('0x4'),_0x373344,_0x402783,util[_0xa855('0x5')](_0x523a90,{'showHidden':![],'depth':null}));delete _0x523a90[_0xa855('0x6')];_0x4a4dd6[_0xa855('0x7')](_0x402783)['send'](_0x523a90);};}exports[_0xa855('0x8')]=function(_0x4e9b27,_0x2e1e74){return info[_0xa855('0x9')]()[_0xa855('0xa')](function(_0x3f77e3){return _0x2e1e74[_0xa855('0x7')](0xc8)[_0xa855('0xb')](_0x3f77e3);})[_0xa855('0xc')](function(_0x2bbd31){return _0x2e1e74['status'](0x1f4)[_0xa855('0xb')](_0x2bbd31);});};exports[_0xa855('0xd')]=function(_0x1f0d62,_0xebcc9a){var _0x26dbd0=[_0xa855('0xe')];return new BPromise(function(_0x2dac0c,_0x4f3910){return exec(util[_0xa855('0xf')](_0xa855('0x10'),_0x1f0d62['params'][_0xa855('0x11')]),function(_0x16a709,_0x48bf01,_0x4aa79d){if(_0x16a709){return _0x4f3910(_0x16a709);}return _0x2dac0c(_0x48bf01);});})['then'](function(_0x878143){var _0x142659=![];var _0xf66be4=_0x878143[_0xa855('0x12')](/\n/);for(var _0x17527e=0x0,_0x1b7aac=_0x26dbd0[_0xa855('0x13')];_0x17527e<_0x1b7aac,_0x142659===![];_0x17527e+=0x1){if(_0x878143[_0xa855('0x14')](_0x26dbd0[_0x17527e])>=0x0){_0x142659=!![];}}if(!_0x142659){throw new Error(util[_0xa855('0xf')]('Process\x20with\x20pid\x20%s\x20not\x20found!',_0x1f0d62[_0xa855('0x15')]['pid']));}process['kill'](_0x1f0d62[_0xa855('0x15')]['pid'],_0xa855('0x16'));return _0xebcc9a['status'](0xc8)[_0xa855('0xb')]({'message':util[_0xa855('0xf')](_0xa855('0x17'),_0x1f0d62['params'][_0xa855('0x11')])});})[_0xa855('0xc')](handleError(_0xebcc9a,null,_0xa855('0xd')));}; \ No newline at end of file diff --git a/server/api/tag/index.js b/server/api/tag/index.js index ea58c8d..085ea41 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 _0x5c12=['../../components/auth/service','../../components/interaction/service','../../config/environment','./tag.controller','get','index','/:id','post','isAuthenticated','create','put','update','delete','destroy','util','path','express','Router'];(function(_0x490208,_0x46f559){var _0x56f3d7=function(_0x5ebd2b){while(--_0x5ebd2b){_0x490208['push'](_0x490208['shift']());}};_0x56f3d7(++_0x46f559);}(_0x5c12,0x188));var _0x25c1=function(_0x5a60ce,_0x48f080){_0x5a60ce=_0x5a60ce-0x0;var _0x393e5e=_0x5c12[_0x5a60ce];return _0x393e5e;};'use strict';var multer=require('multer');var util=require(_0x25c1('0x0'));var path=require(_0x25c1('0x1'));var timeout=require('connect-timeout');var express=require(_0x25c1('0x2'));var router=express[_0x25c1('0x3')]();var auth=require(_0x25c1('0x4'));var interaction=require(_0x25c1('0x5'));var config=require(_0x25c1('0x6'));var controller=require(_0x25c1('0x7'));router[_0x25c1('0x8')]('/',auth['isAuthenticated'](),controller[_0x25c1('0x9')]);router[_0x25c1('0x8')](_0x25c1('0xa'),auth['isAuthenticated'](),controller['show']);router[_0x25c1('0xb')]('/',auth[_0x25c1('0xc')](),controller[_0x25c1('0xd')]);router[_0x25c1('0xe')](_0x25c1('0xa'),auth['isAuthenticated'](),controller[_0x25c1('0xf')]);router[_0x25c1('0x10')](_0x25c1('0xa'),auth[_0x25c1('0xc')](),controller[_0x25c1('0x11')]);module['exports']=router; \ No newline at end of file +var _0xaa88=['post','put','/:id','delete','destroy','multer','util','path','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./tag.controller','get','isAuthenticated','show'];(function(_0x2d5aff,_0x218bf9){var _0x71f75c=function(_0xf67087){while(--_0xf67087){_0x2d5aff['push'](_0x2d5aff['shift']());}};_0x71f75c(++_0x218bf9);}(_0xaa88,0x137));var _0x8aa8=function(_0xd02def,_0x144f25){_0xd02def=_0xd02def-0x0;var _0x2e8374=_0xaa88[_0xd02def];return _0x2e8374;};'use strict';var multer=require(_0x8aa8('0x0'));var util=require(_0x8aa8('0x1'));var path=require(_0x8aa8('0x2'));var timeout=require(_0x8aa8('0x3'));var express=require('express');var router=express[_0x8aa8('0x4')]();var auth=require(_0x8aa8('0x5'));var interaction=require(_0x8aa8('0x6'));var config=require(_0x8aa8('0x7'));var controller=require(_0x8aa8('0x8'));router[_0x8aa8('0x9')]('/',auth['isAuthenticated'](),controller['index']);router[_0x8aa8('0x9')]('/:id',auth[_0x8aa8('0xa')](),controller[_0x8aa8('0xb')]);router[_0x8aa8('0xc')]('/',auth[_0x8aa8('0xa')](),controller['create']);router[_0x8aa8('0xd')](_0x8aa8('0xe'),auth[_0x8aa8('0xa')](),controller['update']);router[_0x8aa8('0xf')](_0x8aa8('0xe'),auth[_0x8aa8('0xa')](),controller[_0x8aa8('0x10')]);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 ffbab8d..b57dfa3 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 _0xdd4f=['sequelize','STRING','#0091EA'];(function(_0x48d16e,_0x1044eb){var _0x1ae6d0=function(_0x5ba731){while(--_0x5ba731){_0x48d16e['push'](_0x48d16e['shift']());}};_0x1ae6d0(++_0x1044eb);}(_0xdd4f,0x1ce));var _0xfdd4=function(_0x241858,_0x2ecb42){_0x241858=_0x241858-0x0;var _0x321d16=_0xdd4f[_0x241858];return _0x321d16;};'use strict';var Sequelize=require(_0xfdd4('0x0'));module['exports']={'name':{'type':Sequelize['STRING'],'unique':'name','allowNull':![],'validate':{'is':/[A-Za-z0-9._\\+*!-]+/,'notEmpty':!![]}},'color':{'type':Sequelize[_0xfdd4('0x1')],'defaultValue':_0xfdd4('0x2')},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0xd8b0=['STRING','sequelize','exports','#0091EA'];(function(_0x21dc0c,_0x64bb32){var _0x57d588=function(_0x62a3f4){while(--_0x62a3f4){_0x21dc0c['push'](_0x21dc0c['shift']());}};_0x57d588(++_0x64bb32);}(_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')]={'name':{'type':Sequelize['STRING'],'unique':'name','allowNull':![],'validate':{'is':/[A-Za-z0-9._\\+*!-]+/,'notEmpty':!![]}},'color':{'type':Sequelize['STRING'],'defaultValue':_0x0d8b('0x2')},'description':{'type':Sequelize[_0x0d8b('0x3')]}}; \ No newline at end of file diff --git a/server/api/tag/tag.controller.js b/server/api/tag/tag.controller.js index cd12b77..65026a9 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 _0xd477=['merge','VIRTUAL','options','includeAll','include','rows','show','catch','create','body','role','user','UserProfileSection','find','userProfileId','error','params','eml-format','rimraf','fast-json-patch','request-promise','moment','mustache','util','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','count','offset','Content-Range','json','save','update','then','get','Tags','UserProfileResource','destroy','stack','name','send','index','Tag','rawAttributes','fieldName','type','key','map','query','keys','filters','model','attributes','intersection','fields','length','nolimit','limit','order','sort','where','pick','filter'];(function(_0x3e625b,_0x2c9f7d){var _0x6113ba=function(_0x5c661e){while(--_0x5c661e){_0x3e625b['push'](_0x3e625b['shift']());}};_0x6113ba(++_0x2c9f7d);}(_0xd477,0xfe));var _0x7d47=function(_0xdeea17,_0x2d08b7){_0xdeea17=_0xdeea17-0x0;var _0x467a89=_0xd477[_0xdeea17];return _0x467a89;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x7d47('0x0'));var rimraf=require(_0x7d47('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x7d47('0x2'));var rp=require(_0x7d47('0x3'));var moment=require(_0x7d47('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x7d47('0x5'));var util=require(_0x7d47('0x6'));var path=require('path');var sox=require(_0x7d47('0x7'));var csv=require(_0x7d47('0x8'));var ejs=require(_0x7d47('0x9'));var fs=require('fs');var _=require(_0x7d47('0xa'));var squel=require(_0x7d47('0xb'));var crypto=require(_0x7d47('0xc'));var jsforce=require(_0x7d47('0xd'));var deskjs=require(_0x7d47('0xe'));var toCsv=require(_0x7d47('0x8'));var querystring=require('querystring');var Papa=require(_0x7d47('0xf'));var Redis=require(_0x7d47('0x10'));var authService=require(_0x7d47('0x11'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x7d47('0x12'))(_0x7d47('0x13'));var utils=require(_0x7d47('0x14'));var config=require(_0x7d47('0x15'));var db=require(_0x7d47('0x16'))['db'];function respondWithStatusCode(_0x26ff86,_0x15fd0e){_0x15fd0e=_0x15fd0e||0xcc;return function(_0x5ca205){if(_0x5ca205){return _0x26ff86[_0x7d47('0x17')](_0x15fd0e);}return _0x26ff86[_0x7d47('0x18')](_0x15fd0e)[_0x7d47('0x19')]();};}function respondWithResult(_0x4d8a34,_0x41e74d){_0x41e74d=_0x41e74d||0xc8;return function(_0x96c212){if(_0x96c212){return _0x4d8a34[_0x7d47('0x18')](_0x41e74d)['json'](_0x96c212);}};}function respondWithFilteredResult(_0x3d48a6,_0x1b210e){return function(_0x2dd3f7){if(_0x2dd3f7){var _0x1598ca=_0x2dd3f7[_0x7d47('0x1a')],_0x40a150=_0x1b210e['offset'],_0x2f48a7=_0x1b210e[_0x7d47('0x1b')]+_0x1b210e['limit'],_0xf6ec38;if(_0x2f48a7>=_0x1598ca){_0x2f48a7=_0x1598ca;_0xf6ec38=0xc8;}else{_0xf6ec38=0xce;}_0x3d48a6['status'](_0xf6ec38);return _0x3d48a6['set'](_0x7d47('0x1c'),_0x40a150+'-'+_0x2f48a7+'/'+_0x1598ca)[_0x7d47('0x1d')](_0x2dd3f7);}return null;};}function patchUpdates(_0x6bc362){return function(_0x501244){try{jsonpatch['apply'](_0x501244,_0x6bc362,!![]);}catch(_0x194126){return BPromise['reject'](_0x194126);}return _0x501244[_0x7d47('0x1e')]();};}function saveUpdates(_0x4b3df4,_0x39bbb6){return function(_0xa07f1){if(_0xa07f1){return _0xa07f1[_0x7d47('0x1f')](_0x4b3df4)[_0x7d47('0x20')](function(_0x13c7c8){return _0x13c7c8;});}return null;};}function removeEntity(_0x21a10f,_0xc263fe){return function(_0xd04a39){if(_0xd04a39){return _0xd04a39['destroy']()[_0x7d47('0x20')](function(){var _0x5dd952=_0xd04a39[_0x7d47('0x21')]({'plain':!![]});var _0xf898c3=_0x7d47('0x22');return db[_0x7d47('0x23')][_0x7d47('0x24')]({'where':{'type':_0xf898c3,'resourceId':_0x5dd952['id']}})[_0x7d47('0x20')](function(){return _0xd04a39;});})['then'](function(){_0x21a10f[_0x7d47('0x18')](0xcc)[_0x7d47('0x19')]();});}};}function handleEntityNotFound(_0x15d841,_0x3d539d){return function(_0x29b58e){if(!_0x29b58e){_0x15d841[_0x7d47('0x17')](0x194);}return _0x29b58e;};}function handleError(_0x4d83d0,_0x2c237a){_0x2c237a=_0x2c237a||0x1f4;return function(_0x1f6c0a){logger['error'](_0x1f6c0a[_0x7d47('0x25')]);if(_0x1f6c0a[_0x7d47('0x26')]){delete _0x1f6c0a[_0x7d47('0x26')];}_0x4d83d0[_0x7d47('0x18')](_0x2c237a)[_0x7d47('0x27')](_0x1f6c0a);};}exports[_0x7d47('0x28')]=function(_0x2d845d,_0x40a112){var _0x3274c1={},_0x3f99f5={},_0x4beb8f={'count':0x0,'rows':[]};var _0x202013=_['map'](db[_0x7d47('0x29')][_0x7d47('0x2a')],function(_0x47ec2f){return{'name':_0x47ec2f[_0x7d47('0x2b')],'type':_0x47ec2f[_0x7d47('0x2c')][_0x7d47('0x2d')]};});_0x3f99f5['model']=_[_0x7d47('0x2e')](_0x202013,_0x7d47('0x26'));_0x3f99f5[_0x7d47('0x2f')]=_[_0x7d47('0x30')](_0x2d845d[_0x7d47('0x2f')]);_0x3f99f5[_0x7d47('0x31')]=_['intersection'](_0x3f99f5[_0x7d47('0x32')],_0x3f99f5[_0x7d47('0x2f')]);_0x3274c1[_0x7d47('0x33')]=_[_0x7d47('0x34')](_0x3f99f5['model'],qs[_0x7d47('0x35')](_0x2d845d[_0x7d47('0x2f')][_0x7d47('0x35')]));_0x3274c1[_0x7d47('0x33')]=_0x3274c1[_0x7d47('0x33')][_0x7d47('0x36')]?_0x3274c1[_0x7d47('0x33')]:_0x3f99f5[_0x7d47('0x32')];if(!_0x2d845d[_0x7d47('0x2f')]['hasOwnProperty'](_0x7d47('0x37'))){_0x3274c1[_0x7d47('0x38')]=qs[_0x7d47('0x38')](_0x2d845d[_0x7d47('0x2f')][_0x7d47('0x38')]);_0x3274c1[_0x7d47('0x1b')]=qs[_0x7d47('0x1b')](_0x2d845d[_0x7d47('0x2f')]['offset']);}_0x3274c1[_0x7d47('0x39')]=qs['sort'](_0x2d845d[_0x7d47('0x2f')][_0x7d47('0x3a')]);_0x3274c1[_0x7d47('0x3b')]=qs[_0x7d47('0x31')](_[_0x7d47('0x3c')](_0x2d845d[_0x7d47('0x2f')],_0x3f99f5[_0x7d47('0x31')]));if(_0x2d845d[_0x7d47('0x2f')][_0x7d47('0x3d')]){_0x3274c1[_0x7d47('0x3b')]=_[_0x7d47('0x3e')](_0x3274c1[_0x7d47('0x3b')],{'$or':_[_0x7d47('0x2e')](_0x202013,function(_0x324e36){if(_0x324e36[_0x7d47('0x2c')]!==_0x7d47('0x3f')){var _0x2885c8={};_0x2885c8[_0x324e36[_0x7d47('0x26')]]={'$like':'%'+_0x2d845d[_0x7d47('0x2f')][_0x7d47('0x3d')]+'%'};return _0x2885c8;}})});}_0x3274c1=_['merge']({},_0x3274c1,_0x2d845d[_0x7d47('0x40')]);var _0xd4b587={'where':_0x3274c1[_0x7d47('0x3b')]};return db['Tag']['count'](_0xd4b587)[_0x7d47('0x20')](function(_0x2c9107){_0x4beb8f[_0x7d47('0x1a')]=_0x2c9107;if(_0x2d845d['query'][_0x7d47('0x41')]){_0x3274c1[_0x7d47('0x42')]=[{'all':!![]}];}return db[_0x7d47('0x29')]['findAll'](_0x3274c1);})['then'](function(_0x38ad17){_0x4beb8f[_0x7d47('0x43')]=_0x38ad17;return _0x4beb8f;})['then'](respondWithFilteredResult(_0x40a112,_0x3274c1))['catch'](handleError(_0x40a112,null));};exports[_0x7d47('0x44')]=function(_0x8ce332,_0x263bc4){var _0x405493={'raw':!![],'where':{'id':_0x8ce332['params']['id']}},_0x47148c={};_0x47148c['model']=_[_0x7d47('0x30')](db[_0x7d47('0x29')][_0x7d47('0x2a')]);_0x47148c[_0x7d47('0x2f')]=_[_0x7d47('0x30')](_0x8ce332[_0x7d47('0x2f')]);_0x47148c[_0x7d47('0x31')]=_[_0x7d47('0x34')](_0x47148c[_0x7d47('0x32')],_0x47148c[_0x7d47('0x2f')]);_0x405493[_0x7d47('0x33')]=_[_0x7d47('0x34')](_0x47148c[_0x7d47('0x32')],qs['fields'](_0x8ce332[_0x7d47('0x2f')]['fields']));_0x405493[_0x7d47('0x33')]=_0x405493[_0x7d47('0x33')]['length']?_0x405493[_0x7d47('0x33')]:_0x47148c['model'];if(_0x8ce332['query'][_0x7d47('0x41')]){_0x405493['include']=[{'all':!![]}];}_0x405493=_[_0x7d47('0x3e')]({},_0x405493,_0x8ce332[_0x7d47('0x40')]);return db[_0x7d47('0x29')]['find'](_0x405493)['then'](handleEntityNotFound(_0x263bc4,null))[_0x7d47('0x20')](respondWithResult(_0x263bc4,null))[_0x7d47('0x45')](handleError(_0x263bc4,null));};exports[_0x7d47('0x46')]=function(_0x24f1cd,_0x2f0da4){return db[_0x7d47('0x29')][_0x7d47('0x46')](_0x24f1cd[_0x7d47('0x47')],{})[_0x7d47('0x20')](function(_0x3b7ebd){var _0x28410a=_0x24f1cd['user'][_0x7d47('0x21')]({'plain':!![]});if(!_0x28410a)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x28410a[_0x7d47('0x48')]===_0x7d47('0x49')){var _0x5dccd3=_0x3b7ebd[_0x7d47('0x21')]({'plain':!![]});var _0x5ea7a0='Tags';return db[_0x7d47('0x4a')][_0x7d47('0x4b')]({'where':{'name':_0x5ea7a0,'userProfileId':_0x28410a[_0x7d47('0x4c')]},'raw':!![]})[_0x7d47('0x20')](function(_0x4d1f56){if(_0x4d1f56&&_0x4d1f56['autoAssociation']===0x0){return db[_0x7d47('0x23')][_0x7d47('0x46')]({'name':_0x5dccd3[_0x7d47('0x26')],'resourceId':_0x5dccd3['id'],'type':_0x4d1f56[_0x7d47('0x26')],'sectionId':_0x4d1f56['id']},{})[_0x7d47('0x20')](function(){return _0x3b7ebd;});}else{return _0x3b7ebd;}})[_0x7d47('0x45')](function(_0x17515b){logger[_0x7d47('0x4d')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x17515b);throw _0x17515b;});}return _0x3b7ebd;})[_0x7d47('0x20')](respondWithResult(_0x2f0da4,0xc9))[_0x7d47('0x45')](handleError(_0x2f0da4,null));};exports[_0x7d47('0x1f')]=function(_0x54254c,_0x5c5f26){if(_0x54254c[_0x7d47('0x47')]['id']){delete _0x54254c[_0x7d47('0x47')]['id'];}return db['Tag'][_0x7d47('0x4b')]({'where':{'id':_0x54254c[_0x7d47('0x4e')]['id']}})[_0x7d47('0x20')](handleEntityNotFound(_0x5c5f26,null))[_0x7d47('0x20')](saveUpdates(_0x54254c['body'],null))[_0x7d47('0x20')](respondWithResult(_0x5c5f26,null))[_0x7d47('0x45')](handleError(_0x5c5f26,null));};exports[_0x7d47('0x24')]=function(_0x354de1,_0x2e6208){return db[_0x7d47('0x29')][_0x7d47('0x4b')]({'where':{'id':_0x354de1[_0x7d47('0x4e')]['id']}})[_0x7d47('0x20')](handleEntityNotFound(_0x2e6208,null))['then'](removeEntity(_0x2e6208,null))[_0x7d47('0x45')](handleError(_0x2e6208,null));}; \ No newline at end of file +var _0x5c37=['../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../mysqldb','status','count','offset','limit','set','Content-Range','reject','save','update','then','destroy','get','Tags','UserProfileResource','end','sendStatus','error','stack','name','send','index','map','fieldName','model','query','keys','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','where','filter','merge','type','VIRTUAL','options','Tag','include','findAll','rows','catch','show','params','rawAttributes','includeAll','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','html-pdf','rimraf','fast-json-patch','moment','bluebird','mustache','util','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis'];(function(_0x503734,_0x3879d0){var _0x432d56=function(_0x3c8842){while(--_0x3c8842){_0x503734['push'](_0x503734['shift']());}};_0x432d56(++_0x3879d0);}(_0x5c37,0xeb));var _0x75c3=function(_0x368587,_0x1b6554){_0x368587=_0x368587-0x0;var _0x42d33c=_0x5c37[_0x368587];return _0x42d33c;};'use strict';var pdf=require(_0x75c3('0x0'));var emlformat=require('eml-format');var rimraf=require(_0x75c3('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x75c3('0x2'));var rp=require('request-promise');var moment=require(_0x75c3('0x3'));var BPromise=require(_0x75c3('0x4'));var Mustache=require(_0x75c3('0x5'));var util=require(_0x75c3('0x6'));var path=require('path');var sox=require('sox');var csv=require(_0x75c3('0x7'));var ejs=require(_0x75c3('0x8'));var fs=require('fs');var _=require(_0x75c3('0x9'));var squel=require(_0x75c3('0xa'));var crypto=require(_0x75c3('0xb'));var jsforce=require(_0x75c3('0xc'));var deskjs=require(_0x75c3('0xd'));var toCsv=require(_0x75c3('0x7'));var querystring=require(_0x75c3('0xe'));var Papa=require(_0x75c3('0xf'));var Redis=require(_0x75c3('0x10'));var authService=require(_0x75c3('0x11'));var qs=require(_0x75c3('0x12'));var as=require(_0x75c3('0x13'));var hardwareService=require(_0x75c3('0x14'));var logger=require(_0x75c3('0x15'))(_0x75c3('0x16'));var utils=require('../../config/utils');var config=require(_0x75c3('0x17'));var db=require(_0x75c3('0x18'))['db'];function respondWithStatusCode(_0xdae993,_0xf42b99){_0xf42b99=_0xf42b99||0xcc;return function(_0x1254ad){if(_0x1254ad){return _0xdae993['sendStatus'](_0xf42b99);}return _0xdae993[_0x75c3('0x19')](_0xf42b99)['end']();};}function respondWithResult(_0x17b636,_0x203b30){_0x203b30=_0x203b30||0xc8;return function(_0xd97c22){if(_0xd97c22){return _0x17b636['status'](_0x203b30)['json'](_0xd97c22);}};}function respondWithFilteredResult(_0x189559,_0x2907d0){return function(_0x17203d){if(_0x17203d){var _0x37e167=_0x17203d[_0x75c3('0x1a')],_0x276ddb=_0x2907d0[_0x75c3('0x1b')],_0x59bd09=_0x2907d0['offset']+_0x2907d0[_0x75c3('0x1c')],_0x427a6f;if(_0x59bd09>=_0x37e167){_0x59bd09=_0x37e167;_0x427a6f=0xc8;}else{_0x427a6f=0xce;}_0x189559['status'](_0x427a6f);return _0x189559[_0x75c3('0x1d')](_0x75c3('0x1e'),_0x276ddb+'-'+_0x59bd09+'/'+_0x37e167)['json'](_0x17203d);}return null;};}function patchUpdates(_0x16c98b){return function(_0x557f1f){try{jsonpatch['apply'](_0x557f1f,_0x16c98b,!![]);}catch(_0x1eb905){return BPromise[_0x75c3('0x1f')](_0x1eb905);}return _0x557f1f[_0x75c3('0x20')]();};}function saveUpdates(_0x390ff5,_0x1fba78){return function(_0x1f7ac2){if(_0x1f7ac2){return _0x1f7ac2[_0x75c3('0x21')](_0x390ff5)[_0x75c3('0x22')](function(_0x260812){return _0x260812;});}return null;};}function removeEntity(_0x5c96a3,_0x54e369){return function(_0x1e08b9){if(_0x1e08b9){return _0x1e08b9[_0x75c3('0x23')]()['then'](function(){var _0x1c5e8c=_0x1e08b9[_0x75c3('0x24')]({'plain':!![]});var _0x4d95fb=_0x75c3('0x25');return db[_0x75c3('0x26')][_0x75c3('0x23')]({'where':{'type':_0x4d95fb,'resourceId':_0x1c5e8c['id']}})[_0x75c3('0x22')](function(){return _0x1e08b9;});})['then'](function(){_0x5c96a3['status'](0xcc)[_0x75c3('0x27')]();});}};}function handleEntityNotFound(_0x5bb3bf,_0x2168ab){return function(_0x5cc393){if(!_0x5cc393){_0x5bb3bf[_0x75c3('0x28')](0x194);}return _0x5cc393;};}function handleError(_0x43466f,_0x15bc3e){_0x15bc3e=_0x15bc3e||0x1f4;return function(_0x4ccecf){logger[_0x75c3('0x29')](_0x4ccecf[_0x75c3('0x2a')]);if(_0x4ccecf[_0x75c3('0x2b')]){delete _0x4ccecf['name'];}_0x43466f['status'](_0x15bc3e)[_0x75c3('0x2c')](_0x4ccecf);};}exports[_0x75c3('0x2d')]=function(_0x7aef8d,_0x39fd74){var _0x4fcfd6={},_0x154528={},_0x1d02f7={'count':0x0,'rows':[]};var _0x2044f8=_[_0x75c3('0x2e')](db['Tag']['rawAttributes'],function(_0x3e9ef0){return{'name':_0x3e9ef0[_0x75c3('0x2f')],'type':_0x3e9ef0['type']['key']};});_0x154528[_0x75c3('0x30')]=_[_0x75c3('0x2e')](_0x2044f8,_0x75c3('0x2b'));_0x154528[_0x75c3('0x31')]=_[_0x75c3('0x32')](_0x7aef8d[_0x75c3('0x31')]);_0x154528[_0x75c3('0x33')]=_['intersection'](_0x154528['model'],_0x154528[_0x75c3('0x31')]);_0x4fcfd6[_0x75c3('0x34')]=_[_0x75c3('0x35')](_0x154528['model'],qs[_0x75c3('0x36')](_0x7aef8d[_0x75c3('0x31')][_0x75c3('0x36')]));_0x4fcfd6[_0x75c3('0x34')]=_0x4fcfd6[_0x75c3('0x34')][_0x75c3('0x37')]?_0x4fcfd6[_0x75c3('0x34')]:_0x154528[_0x75c3('0x30')];if(!_0x7aef8d[_0x75c3('0x31')][_0x75c3('0x38')](_0x75c3('0x39'))){_0x4fcfd6['limit']=qs[_0x75c3('0x1c')](_0x7aef8d['query'][_0x75c3('0x1c')]);_0x4fcfd6[_0x75c3('0x1b')]=qs[_0x75c3('0x1b')](_0x7aef8d[_0x75c3('0x31')][_0x75c3('0x1b')]);}_0x4fcfd6[_0x75c3('0x3a')]=qs[_0x75c3('0x3b')](_0x7aef8d['query'][_0x75c3('0x3b')]);_0x4fcfd6[_0x75c3('0x3c')]=qs['filters'](_['pick'](_0x7aef8d[_0x75c3('0x31')],_0x154528[_0x75c3('0x33')]));if(_0x7aef8d[_0x75c3('0x31')][_0x75c3('0x3d')]){_0x4fcfd6[_0x75c3('0x3c')]=_[_0x75c3('0x3e')](_0x4fcfd6['where'],{'$or':_[_0x75c3('0x2e')](_0x2044f8,function(_0x507408){if(_0x507408[_0x75c3('0x3f')]!==_0x75c3('0x40')){var _0x29deb0={};_0x29deb0[_0x507408[_0x75c3('0x2b')]]={'$like':'%'+_0x7aef8d[_0x75c3('0x31')][_0x75c3('0x3d')]+'%'};return _0x29deb0;}})});}_0x4fcfd6=_['merge']({},_0x4fcfd6,_0x7aef8d[_0x75c3('0x41')]);var _0x3c17da={'where':_0x4fcfd6['where']};return db[_0x75c3('0x42')][_0x75c3('0x1a')](_0x3c17da)[_0x75c3('0x22')](function(_0x135519){_0x1d02f7[_0x75c3('0x1a')]=_0x135519;if(_0x7aef8d[_0x75c3('0x31')]['includeAll']){_0x4fcfd6[_0x75c3('0x43')]=[{'all':!![]}];}return db[_0x75c3('0x42')][_0x75c3('0x44')](_0x4fcfd6);})[_0x75c3('0x22')](function(_0x4f600a){_0x1d02f7[_0x75c3('0x45')]=_0x4f600a;return _0x1d02f7;})[_0x75c3('0x22')](respondWithFilteredResult(_0x39fd74,_0x4fcfd6))[_0x75c3('0x46')](handleError(_0x39fd74,null));};exports[_0x75c3('0x47')]=function(_0x53c41c,_0x2d3629){var _0x11d682={'raw':!![],'where':{'id':_0x53c41c[_0x75c3('0x48')]['id']}},_0x6bcaf1={};_0x6bcaf1[_0x75c3('0x30')]=_[_0x75c3('0x32')](db['Tag'][_0x75c3('0x49')]);_0x6bcaf1['query']=_['keys'](_0x53c41c['query']);_0x6bcaf1[_0x75c3('0x33')]=_[_0x75c3('0x35')](_0x6bcaf1['model'],_0x6bcaf1[_0x75c3('0x31')]);_0x11d682['attributes']=_[_0x75c3('0x35')](_0x6bcaf1['model'],qs['fields'](_0x53c41c[_0x75c3('0x31')][_0x75c3('0x36')]));_0x11d682['attributes']=_0x11d682[_0x75c3('0x34')][_0x75c3('0x37')]?_0x11d682['attributes']:_0x6bcaf1[_0x75c3('0x30')];if(_0x53c41c[_0x75c3('0x31')][_0x75c3('0x4a')]){_0x11d682[_0x75c3('0x43')]=[{'all':!![]}];}_0x11d682=_['merge']({},_0x11d682,_0x53c41c[_0x75c3('0x41')]);return db[_0x75c3('0x42')][_0x75c3('0x4b')](_0x11d682)['then'](handleEntityNotFound(_0x2d3629,null))['then'](respondWithResult(_0x2d3629,null))[_0x75c3('0x46')](handleError(_0x2d3629,null));};exports[_0x75c3('0x4c')]=function(_0x1d75e9,_0x4db0d3){return db[_0x75c3('0x42')]['create'](_0x1d75e9[_0x75c3('0x4d')],{})[_0x75c3('0x22')](function(_0x413d4a){var _0x44051c=_0x1d75e9[_0x75c3('0x4e')][_0x75c3('0x24')]({'plain':!![]});if(!_0x44051c)throw new Error(_0x75c3('0x4f'));if(_0x44051c['role']===_0x75c3('0x4e')){var _0x1f967a=_0x413d4a[_0x75c3('0x24')]({'plain':!![]});var _0x5be496=_0x75c3('0x25');return db[_0x75c3('0x50')][_0x75c3('0x4b')]({'where':{'name':_0x5be496,'userProfileId':_0x44051c[_0x75c3('0x51')]},'raw':!![]})[_0x75c3('0x22')](function(_0x14de59){if(_0x14de59&&_0x14de59[_0x75c3('0x52')]===0x0){return db[_0x75c3('0x26')][_0x75c3('0x4c')]({'name':_0x1f967a['name'],'resourceId':_0x1f967a['id'],'type':_0x14de59[_0x75c3('0x2b')],'sectionId':_0x14de59['id']},{})[_0x75c3('0x22')](function(){return _0x413d4a;});}else{return _0x413d4a;}})[_0x75c3('0x46')](function(_0x34cb5d){logger[_0x75c3('0x29')](_0x75c3('0x53'),_0x34cb5d);throw _0x34cb5d;});}return _0x413d4a;})[_0x75c3('0x22')](respondWithResult(_0x4db0d3,0xc9))[_0x75c3('0x46')](handleError(_0x4db0d3,null));};exports[_0x75c3('0x21')]=function(_0x173d45,_0xecbbd7){if(_0x173d45['body']['id']){delete _0x173d45[_0x75c3('0x4d')]['id'];}return db[_0x75c3('0x42')][_0x75c3('0x4b')]({'where':{'id':_0x173d45[_0x75c3('0x48')]['id']}})[_0x75c3('0x22')](handleEntityNotFound(_0xecbbd7,null))[_0x75c3('0x22')](saveUpdates(_0x173d45['body'],null))[_0x75c3('0x22')](respondWithResult(_0xecbbd7,null))['catch'](handleError(_0xecbbd7,null));};exports[_0x75c3('0x23')]=function(_0xc7da85,_0x4fb1a8){return db[_0x75c3('0x42')]['find']({'where':{'id':_0xc7da85[_0x75c3('0x48')]['id']}})[_0x75c3('0x22')](handleEntityNotFound(_0x4fb1a8,null))[_0x75c3('0x22')](removeEntity(_0x4fb1a8,null))[_0x75c3('0x46')](handleError(_0x4fb1a8,null));}; \ No newline at end of file diff --git a/server/api/tag/tag.model.js b/server/api/tag/tag.model.js index 9127a40..9180ee3 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 _0x1ac8=['api','moment','bluebird','request-promise','path','rimraf','exports','Tag','tools_tags','lodash'];(function(_0x122ef9,_0x451d2a){var _0x42fba0=function(_0x17c9d3){while(--_0x17c9d3){_0x122ef9['push'](_0x122ef9['shift']());}};_0x42fba0(++_0x451d2a);}(_0x1ac8,0xd1));var _0x81ac=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x1ac8[_0x321bb2];return _0x9c12ed;};'use strict';var _=require(_0x81ac('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x81ac('0x1'));var moment=require(_0x81ac('0x2'));var BPromise=require(_0x81ac('0x3'));var rp=require(_0x81ac('0x4'));var fs=require('fs');var path=require(_0x81ac('0x5'));var rimraf=require(_0x81ac('0x6'));var config=require('../../config/environment');var attributes=require('./tag.attributes');module[_0x81ac('0x7')]=function(_0x58357f,_0x4057a2){return _0x58357f['define'](_0x81ac('0x8'),attributes,{'tableName':_0x81ac('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xe1e0=['exports','Tag','lodash','../../config/logger','moment','bluebird','path','rimraf','./tag.attributes'];(function(_0x3fe0fe,_0x3bdc49){var _0x5c11f4=function(_0x127973){while(--_0x127973){_0x3fe0fe['push'](_0x3fe0fe['shift']());}};_0x5c11f4(++_0x3bdc49);}(_0xe1e0,0x1b2));var _0x0e1e=function(_0x4eff6f,_0x41ddcb){_0x4eff6f=_0x4eff6f-0x0;var _0x600bc8=_0xe1e0[_0x4eff6f];return _0x600bc8;};'use strict';var _=require(_0x0e1e('0x0'));var util=require('util');var logger=require(_0x0e1e('0x1'))('api');var moment=require(_0x0e1e('0x2'));var BPromise=require(_0x0e1e('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x0e1e('0x4'));var rimraf=require(_0x0e1e('0x5'));var config=require('../../config/environment');var attributes=require(_0x0e1e('0x6'));module[_0x0e1e('0x7')]=function(_0x1133e3,_0x1812c2){return _0x1133e3['define'](_0x0e1e('0x8'),attributes,{'tableName':'tools_tags','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 04a2c02..f07c606 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 _0x5b02=['client','then','info','request\x20sent','debug','Tag,\x20%s,\x20%s,\x20%s','stringify','error','code','Tag,\x20%s,\x20%s','message','result','catch','lodash','util','moment','bluebird','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise'];(function(_0x58c56a,_0x40d9e4){var _0x4f83d0=function(_0x16d682){while(--_0x16d682){_0x58c56a['push'](_0x58c56a['shift']());}};_0x4f83d0(++_0x40d9e4);}(_0x5b02,0xe9));var _0x25b0=function(_0x52ed6a,_0x2f03b6){_0x52ed6a=_0x52ed6a-0x0;var _0x437960=_0x5b02[_0x52ed6a];return _0x437960;};'use strict';var _=require(_0x25b0('0x0'));var util=require(_0x25b0('0x1'));var moment=require(_0x25b0('0x2'));var BPromise=require(_0x25b0('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x25b0('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x25b0('0x5'))(_0x25b0('0x6'));var config=require(_0x25b0('0x7'));var jayson=require(_0x25b0('0x8'));var client=jayson[_0x25b0('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x1d82c6,_0xd8276d,_0x49ef3a){return new BPromise(function(_0x412954,_0x4d3e71){return client['request'](_0x1d82c6,_0x49ef3a)[_0x25b0('0xa')](function(_0x45429b){logger[_0x25b0('0xb')]('Tag,\x20%s,\x20%s',_0xd8276d,_0x25b0('0xc'));logger[_0x25b0('0xd')](_0x25b0('0xe'),_0xd8276d,_0x25b0('0xc'),JSON[_0x25b0('0xf')](_0x45429b));if(_0x45429b[_0x25b0('0x10')]){if(_0x45429b[_0x25b0('0x10')][_0x25b0('0x11')]===0x1f4){logger[_0x25b0('0x10')](_0x25b0('0x12'),_0xd8276d,_0x45429b[_0x25b0('0x10')][_0x25b0('0x13')]);return _0x4d3e71(_0x45429b[_0x25b0('0x10')][_0x25b0('0x13')]);}logger[_0x25b0('0x10')](_0x25b0('0x12'),_0xd8276d,_0x45429b[_0x25b0('0x10')][_0x25b0('0x13')]);return _0x412954(_0x45429b[_0x25b0('0x10')][_0x25b0('0x13')]);}else{logger[_0x25b0('0xb')]('Tag,\x20%s,\x20%s',_0xd8276d,'request\x20sent');_0x412954(_0x45429b[_0x25b0('0x14')]['message']);}})[_0x25b0('0x15')](function(_0x1d009f){logger[_0x25b0('0x10')](_0x25b0('0x12'),_0xd8276d,_0x1d009f);_0x4d3e71(_0x1d009f);});});} \ No newline at end of file +var _0x3f8c=['Tag,\x20%s,\x20%s','request\x20sent','Tag,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','moment','bluebird','randomstring','ioredis','jayson/promise','client','http','request','then','info'];(function(_0x3d485b,_0x2b3f42){var _0x3a5e58=function(_0x38f866){while(--_0x38f866){_0x3d485b['push'](_0x3d485b['shift']());}};_0x3a5e58(++_0x2b3f42);}(_0x3f8c,0x104));var _0xc3f8=function(_0x33b338,_0x252f25){_0x33b338=_0x33b338-0x0;var _0x1de3a6=_0x3f8c[_0x33b338];return _0x1de3a6;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0xc3f8('0x0'));var BPromise=require(_0xc3f8('0x1'));var rs=require(_0xc3f8('0x2'));var fs=require('fs');var Redis=require(_0xc3f8('0x3'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')('rpc');var config=require('../../config/environment');var jayson=require(_0xc3f8('0x4'));var client=jayson[_0xc3f8('0x5')][_0xc3f8('0x6')]({'port':0x232a});function respondWithRpcPromise(_0x44c25d,_0x2bbaa5,_0x15512a){return new BPromise(function(_0x51093a,_0x28397e){return client[_0xc3f8('0x7')](_0x44c25d,_0x15512a)[_0xc3f8('0x8')](function(_0x3c340c){logger[_0xc3f8('0x9')](_0xc3f8('0xa'),_0x2bbaa5,_0xc3f8('0xb'));logger['debug'](_0xc3f8('0xc'),_0x2bbaa5,_0xc3f8('0xb'),JSON[_0xc3f8('0xd')](_0x3c340c));if(_0x3c340c[_0xc3f8('0xe')]){if(_0x3c340c['error'][_0xc3f8('0xf')]===0x1f4){logger[_0xc3f8('0xe')](_0xc3f8('0xa'),_0x2bbaa5,_0x3c340c[_0xc3f8('0xe')]['message']);return _0x28397e(_0x3c340c[_0xc3f8('0xe')][_0xc3f8('0x10')]);}logger[_0xc3f8('0xe')](_0xc3f8('0xa'),_0x2bbaa5,_0x3c340c[_0xc3f8('0xe')][_0xc3f8('0x10')]);return _0x51093a(_0x3c340c[_0xc3f8('0xe')][_0xc3f8('0x10')]);}else{logger[_0xc3f8('0x9')](_0xc3f8('0xa'),_0x2bbaa5,_0xc3f8('0xb'));_0x51093a(_0x3c340c[_0xc3f8('0x11')][_0xc3f8('0x10')]);}})['catch'](function(_0x14b3ed){logger['error']('Tag,\x20%s,\x20%s',_0x2bbaa5,_0x14b3ed);_0x28397e(_0x14b3ed);});});} \ No newline at end of file diff --git a/server/api/team/index.js b/server/api/team/index.js index 0c264a5..44554cc 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 _0x8a33=['express','Router','../../components/auth/service','../../config/environment','get','index','/:id','show','/:id/queues','isAuthenticated','/:id/users','post','create','addQueues','destroy','delete','removeQueues','exports','multer','util','connect-timeout'];(function(_0x18168d,_0x47657f){var _0x3e969d=function(_0x4c81a1){while(--_0x4c81a1){_0x18168d['push'](_0x18168d['shift']());}};_0x3e969d(++_0x47657f);}(_0x8a33,0x90));var _0x38a3=function(_0x1ee0a1,_0x51058e){_0x1ee0a1=_0x1ee0a1-0x0;var _0x1d2d5b=_0x8a33[_0x1ee0a1];return _0x1d2d5b;};'use strict';var multer=require(_0x38a3('0x0'));var util=require(_0x38a3('0x1'));var path=require('path');var timeout=require(_0x38a3('0x2'));var express=require(_0x38a3('0x3'));var router=express[_0x38a3('0x4')]();var auth=require(_0x38a3('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x38a3('0x6'));var controller=require('./team.controller');router[_0x38a3('0x7')]('/',auth['isAuthenticated'](),controller[_0x38a3('0x8')]);router[_0x38a3('0x7')](_0x38a3('0x9'),auth['isAuthenticated'](),controller[_0x38a3('0xa')]);router[_0x38a3('0x7')](_0x38a3('0xb'),auth[_0x38a3('0xc')](),controller['getQueues']);router[_0x38a3('0x7')](_0x38a3('0xd'),auth['isAuthenticated'](),controller['getAgents']);router[_0x38a3('0xe')]('/',auth[_0x38a3('0xc')](),controller[_0x38a3('0xf')]);router[_0x38a3('0xe')]('/:id/queues',auth[_0x38a3('0xc')](),controller[_0x38a3('0x10')]);router['post'](_0x38a3('0xd'),auth[_0x38a3('0xc')](),controller['addAgents']);router['put'](_0x38a3('0x9'),auth[_0x38a3('0xc')](),controller['update']);router['delete'](_0x38a3('0x9'),auth['isAuthenticated'](),controller[_0x38a3('0x11')]);router[_0x38a3('0x12')]('/:id/queues',auth[_0x38a3('0xc')](),controller[_0x38a3('0x13')]);router[_0x38a3('0x12')](_0x38a3('0xd'),auth[_0x38a3('0xc')](),controller['removeAgents']);module[_0x38a3('0x14')]=router; \ No newline at end of file +var _0x69a0=['index','/:id','show','/:id/queues','getQueues','/:id/users','getAgents','create','post','addAgents','update','delete','destroy','removeQueues','removeAgents','exports','multer','util','path','connect-timeout','Router','../../components/auth/service','../../config/environment','get','isAuthenticated'];(function(_0x3694d4,_0x2aaf3a){var _0x3d33cf=function(_0x3d6d44){while(--_0x3d6d44){_0x3694d4['push'](_0x3694d4['shift']());}};_0x3d33cf(++_0x2aaf3a);}(_0x69a0,0x13c));var _0x069a=function(_0x5e5ff2,_0x3b327e){_0x5e5ff2=_0x5e5ff2-0x0;var _0x2615f2=_0x69a0[_0x5e5ff2];return _0x2615f2;};'use strict';var multer=require(_0x069a('0x0'));var util=require(_0x069a('0x1'));var path=require(_0x069a('0x2'));var timeout=require(_0x069a('0x3'));var express=require('express');var router=express[_0x069a('0x4')]();var auth=require(_0x069a('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x069a('0x6'));var controller=require('./team.controller');router[_0x069a('0x7')]('/',auth[_0x069a('0x8')](),controller[_0x069a('0x9')]);router[_0x069a('0x7')](_0x069a('0xa'),auth[_0x069a('0x8')](),controller[_0x069a('0xb')]);router[_0x069a('0x7')](_0x069a('0xc'),auth['isAuthenticated'](),controller[_0x069a('0xd')]);router[_0x069a('0x7')](_0x069a('0xe'),auth[_0x069a('0x8')](),controller[_0x069a('0xf')]);router['post']('/',auth[_0x069a('0x8')](),controller[_0x069a('0x10')]);router[_0x069a('0x11')](_0x069a('0xc'),auth[_0x069a('0x8')](),controller['addQueues']);router[_0x069a('0x11')]('/:id/users',auth[_0x069a('0x8')](),controller[_0x069a('0x12')]);router['put']('/:id',auth[_0x069a('0x8')](),controller[_0x069a('0x13')]);router[_0x069a('0x14')](_0x069a('0xa'),auth[_0x069a('0x8')](),controller[_0x069a('0x15')]);router[_0x069a('0x14')](_0x069a('0xc'),auth[_0x069a('0x8')](),controller[_0x069a('0x16')]);router[_0x069a('0x14')](_0x069a('0xe'),auth[_0x069a('0x8')](),controller[_0x069a('0x17')]);module[_0x069a('0x18')]=router; \ No newline at end of file diff --git a/server/api/team/team.attributes.js b/server/api/team/team.attributes.js index f31a421..4725526 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 _0x189d=['exports','STRING','sequelize'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x189d,0xb6));var _0xd189=function(_0x58c7c5,_0x2e13a8){_0x58c7c5=_0x58c7c5-0x0;var _0x9660e6=_0x189d[_0x58c7c5];return _0x9660e6;};'use strict';var Sequelize=require(_0xd189('0x0'));module[_0xd189('0x1')]={'name':{'type':Sequelize[_0xd189('0x2')],'allowNull':![],'unique':'name'},'description':{'type':Sequelize[_0xd189('0x2')]}}; \ No newline at end of file +var _0x0b4f=['sequelize','STRING','name'];(function(_0x5b18f7,_0x1a1e84){var _0x45aa7b=function(_0x1fcd7a){while(--_0x1fcd7a){_0x5b18f7['push'](_0x5b18f7['shift']());}};_0x45aa7b(++_0x1a1e84);}(_0x0b4f,0x8a));var _0xf0b4=function(_0x3a3e9f,_0x1cf439){_0x3a3e9f=_0x3a3e9f-0x0;var _0x29304a=_0x0b4f[_0x3a3e9f];return _0x29304a;};'use strict';var Sequelize=require(_0xf0b4('0x0'));module['exports']={'name':{'type':Sequelize[_0xf0b4('0x1')],'allowNull':![],'unique':_0xf0b4('0x2')},'description':{'type':Sequelize[_0xf0b4('0x1')]}}; \ No newline at end of file diff --git a/server/api/team/team.controller.js b/server/api/team/team.controller.js index 26ab201..0c0e10b 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 _0xd290=['offset','limit','set','Content-Range','apply','reject','save','update','then','get','Teams','UserProfileResource','destroy','sendStatus','error','stack','name','send','map','Team','rawAttributes','type','key','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','pick','filter','where','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','keys','create','body','role','user','UserProfileSection','find','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','getQueues','findOne','isValidChannel','channel','Sequelize','Unknown\x20channel','toLowerCase','Queue','Queues','addQueues','ValidationError','add','capitalize','ids','removeQueues','remove','addAgents','Voice','Chat','Mail','Sms','Openchannel','each','User','online','voicePause','interface','upsert','format','SIP/%s','omit','userTeam:save','voice','chat','mail','sms','fax','openchannel','removeAgents','UserVoiceQueueRt','userTeam:remove','getAgents','html-pdf','eml-format','zip-dir','moment','bluebird','mustache','util','path','to-csv','ejs','lodash','squel','crypto','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/environment','../../mysqldb','redis','defaults','socket.io-emitter','./team.socket','register','status','json','count'];(function(_0x3bc23a,_0x2505ef){var _0xe34f38=function(_0x15f2c8){while(--_0x15f2c8){_0x3bc23a['push'](_0x3bc23a['shift']());}};_0xe34f38(++_0x2505ef);}(_0xd290,0x165));var _0x0d29=function(_0x22cf2e,_0x2c1f6b){_0x22cf2e=_0x22cf2e-0x0;var _0x50bdc7=_0xd290[_0x22cf2e];return _0x50bdc7;};'use strict';var pdf=require(_0x0d29('0x0'));var emlformat=require(_0x0d29('0x1'));var rimraf=require('rimraf');var zipdir=require(_0x0d29('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x0d29('0x3'));var BPromise=require(_0x0d29('0x4'));var Mustache=require(_0x0d29('0x5'));var util=require(_0x0d29('0x6'));var path=require(_0x0d29('0x7'));var sox=require('sox');var csv=require(_0x0d29('0x8'));var ejs=require(_0x0d29('0x9'));var fs=require('fs');var _=require(_0x0d29('0xa'));var squel=require(_0x0d29('0xb'));var crypto=require(_0x0d29('0xc'));var jsforce=require('jsforce');var deskjs=require(_0x0d29('0xd'));var toCsv=require(_0x0d29('0x8'));var querystring=require(_0x0d29('0xe'));var Papa=require('papaparse');var Redis=require(_0x0d29('0xf'));var authService=require(_0x0d29('0x10'));var qs=require('../../components/parsers/qs');var as=require(_0x0d29('0x11'));var hardwareService=require(_0x0d29('0x12'));var logger=require('../../config/logger')(_0x0d29('0x13'));var utils=require('../../config/utils');var config=require(_0x0d29('0x14'));var db=require(_0x0d29('0x15'))['db'];config[_0x0d29('0x16')]=_[_0x0d29('0x17')](config[_0x0d29('0x16')],{'host':'localhost','port':0x18eb});var socket=require(_0x0d29('0x18'))(new Redis(config[_0x0d29('0x16')]));require(_0x0d29('0x19'))[_0x0d29('0x1a')](socket);function respondWithStatusCode(_0x1a0f48,_0x5f474a){_0x5f474a=_0x5f474a||0xcc;return function(_0x5f2076){if(_0x5f2076){return _0x1a0f48['sendStatus'](_0x5f474a);}return _0x1a0f48[_0x0d29('0x1b')](_0x5f474a)['end']();};}function respondWithResult(_0x44fe29,_0x4c4044){_0x4c4044=_0x4c4044||0xc8;return function(_0x3131e1){if(_0x3131e1){return _0x44fe29[_0x0d29('0x1b')](_0x4c4044)[_0x0d29('0x1c')](_0x3131e1);}};}function respondWithFilteredResult(_0xd35777,_0x39c7cc){return function(_0x190710){if(_0x190710){var _0x488fa2=_0x190710[_0x0d29('0x1d')],_0x319a36=_0x39c7cc[_0x0d29('0x1e')],_0x2600b3=_0x39c7cc[_0x0d29('0x1e')]+_0x39c7cc[_0x0d29('0x1f')],_0xca30af;if(_0x2600b3>=_0x488fa2){_0x2600b3=_0x488fa2;_0xca30af=0xc8;}else{_0xca30af=0xce;}_0xd35777['status'](_0xca30af);return _0xd35777[_0x0d29('0x20')](_0x0d29('0x21'),_0x319a36+'-'+_0x2600b3+'/'+_0x488fa2)[_0x0d29('0x1c')](_0x190710);}return null;};}function patchUpdates(_0x138465){return function(_0x1538c8){try{jsonpatch[_0x0d29('0x22')](_0x1538c8,_0x138465,!![]);}catch(_0x392394){return BPromise[_0x0d29('0x23')](_0x392394);}return _0x1538c8[_0x0d29('0x24')]();};}function saveUpdates(_0xed8228,_0x17b7e5){return function(_0x1f80bc){if(_0x1f80bc){return _0x1f80bc[_0x0d29('0x25')](_0xed8228)['then'](function(_0x30e109){return _0x30e109;});}return null;};}function removeEntity(_0x1b78b7,_0x2f0fe2){return function(_0xd3afa0){if(_0xd3afa0){return _0xd3afa0['destroy']()[_0x0d29('0x26')](function(){var _0x24991c=_0xd3afa0[_0x0d29('0x27')]({'plain':!![]});var _0xceff8a=_0x0d29('0x28');return db[_0x0d29('0x29')][_0x0d29('0x2a')]({'where':{'type':_0xceff8a,'resourceId':_0x24991c['id']}})['then'](function(){return _0xd3afa0;});})['then'](function(){_0x1b78b7[_0x0d29('0x1b')](0xcc)['end']();});}};}function handleEntityNotFound(_0x4083c3,_0x50e519){return function(_0x5a6348){if(!_0x5a6348){_0x4083c3[_0x0d29('0x2b')](0x194);}return _0x5a6348;};}function handleError(_0x504f0c,_0x97b82b){_0x97b82b=_0x97b82b||0x1f4;return function(_0x5c197f){logger[_0x0d29('0x2c')](_0x5c197f[_0x0d29('0x2d')]);if(_0x5c197f['name']){delete _0x5c197f[_0x0d29('0x2e')];}_0x504f0c[_0x0d29('0x1b')](_0x97b82b)[_0x0d29('0x2f')](_0x5c197f);};}exports['index']=function(_0x33af2f,_0x3a22a1){var _0xac69ac={},_0x174c09={},_0x2ca4cb={'count':0x0,'rows':[]};var _0x309e90=_[_0x0d29('0x30')](db[_0x0d29('0x31')][_0x0d29('0x32')],function(_0x116925){return{'name':_0x116925['fieldName'],'type':_0x116925[_0x0d29('0x33')][_0x0d29('0x34')]};});_0x174c09[_0x0d29('0x35')]=_[_0x0d29('0x30')](_0x309e90,_0x0d29('0x2e'));_0x174c09[_0x0d29('0x36')]=_['keys'](_0x33af2f[_0x0d29('0x36')]);_0x174c09[_0x0d29('0x37')]=_[_0x0d29('0x38')](_0x174c09[_0x0d29('0x35')],_0x174c09[_0x0d29('0x36')]);_0xac69ac[_0x0d29('0x39')]=_[_0x0d29('0x38')](_0x174c09['model'],qs[_0x0d29('0x3a')](_0x33af2f[_0x0d29('0x36')][_0x0d29('0x3a')]));_0xac69ac[_0x0d29('0x39')]=_0xac69ac[_0x0d29('0x39')][_0x0d29('0x3b')]?_0xac69ac['attributes']:_0x174c09[_0x0d29('0x35')];if(!_0x33af2f['query'][_0x0d29('0x3c')](_0x0d29('0x3d'))){_0xac69ac[_0x0d29('0x1f')]=qs[_0x0d29('0x1f')](_0x33af2f[_0x0d29('0x36')]['limit']);_0xac69ac[_0x0d29('0x1e')]=qs[_0x0d29('0x1e')](_0x33af2f[_0x0d29('0x36')]['offset']);}_0xac69ac[_0x0d29('0x3e')]=qs[_0x0d29('0x3f')](_0x33af2f[_0x0d29('0x36')]['sort']);_0xac69ac['where']=qs[_0x0d29('0x37')](_[_0x0d29('0x40')](_0x33af2f[_0x0d29('0x36')],_0x174c09[_0x0d29('0x37')]));if(_0x33af2f['query'][_0x0d29('0x41')]){_0xac69ac[_0x0d29('0x42')]=_[_0x0d29('0x43')](_0xac69ac['where'],{'$or':_['map'](_0x309e90,function(_0x4fe57e){if(_0x4fe57e['type']!==_0x0d29('0x44')){var _0x27f264={};_0x27f264[_0x4fe57e['name']]={'$like':'%'+_0x33af2f[_0x0d29('0x36')][_0x0d29('0x41')]+'%'};return _0x27f264;}})});}_0xac69ac=_[_0x0d29('0x43')]({},_0xac69ac,_0x33af2f[_0x0d29('0x45')]);var _0x25cd3f={'where':_0xac69ac[_0x0d29('0x42')]};return db[_0x0d29('0x31')][_0x0d29('0x1d')](_0x25cd3f)[_0x0d29('0x26')](function(_0x568a01){_0x2ca4cb[_0x0d29('0x1d')]=_0x568a01;if(_0x33af2f['query'][_0x0d29('0x46')]){_0xac69ac[_0x0d29('0x47')]=[{'all':!![]}];}return db[_0x0d29('0x31')][_0x0d29('0x48')](_0xac69ac);})[_0x0d29('0x26')](function(_0x433fce){_0x2ca4cb[_0x0d29('0x49')]=_0x433fce;return _0x2ca4cb;})[_0x0d29('0x26')](respondWithFilteredResult(_0x3a22a1,_0xac69ac))[_0x0d29('0x4a')](handleError(_0x3a22a1,null));};exports[_0x0d29('0x4b')]=function(_0x4b522b,_0x9ebd18){var _0x4b8bc5={'raw':![],'where':{'id':_0x4b522b[_0x0d29('0x4c')]['id']}},_0x5ddac8={};_0x5ddac8['model']=_[_0x0d29('0x4d')](db[_0x0d29('0x31')][_0x0d29('0x32')]);_0x5ddac8[_0x0d29('0x36')]=_[_0x0d29('0x4d')](_0x4b522b[_0x0d29('0x36')]);_0x5ddac8[_0x0d29('0x37')]=_['intersection'](_0x5ddac8[_0x0d29('0x35')],_0x5ddac8['query']);_0x4b8bc5[_0x0d29('0x39')]=_['intersection'](_0x5ddac8['model'],qs[_0x0d29('0x3a')](_0x4b522b[_0x0d29('0x36')][_0x0d29('0x3a')]));_0x4b8bc5[_0x0d29('0x39')]=_0x4b8bc5[_0x0d29('0x39')][_0x0d29('0x3b')]?_0x4b8bc5['attributes']:_0x5ddac8[_0x0d29('0x35')];if(_0x4b522b['query']['includeAll']){_0x4b8bc5[_0x0d29('0x47')]=[{'all':!![]}];}_0x4b8bc5=_[_0x0d29('0x43')]({},_0x4b8bc5,_0x4b522b[_0x0d29('0x45')]);return db['Team']['find'](_0x4b8bc5)[_0x0d29('0x26')](handleEntityNotFound(_0x9ebd18,null))[_0x0d29('0x26')](respondWithResult(_0x9ebd18,null))[_0x0d29('0x4a')](handleError(_0x9ebd18,null));};exports[_0x0d29('0x4e')]=function(_0x5ea255,_0xa9658d){return db[_0x0d29('0x31')]['create'](_0x5ea255[_0x0d29('0x4f')],{})[_0x0d29('0x26')](function(_0x2e33f0){var _0x366260=_0x5ea255['user'][_0x0d29('0x27')]({'plain':!![]});if(!_0x366260)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x366260[_0x0d29('0x50')]===_0x0d29('0x51')){var _0x3c6513=_0x2e33f0[_0x0d29('0x27')]({'plain':!![]});var _0x647b7e=_0x0d29('0x28');return db[_0x0d29('0x52')][_0x0d29('0x53')]({'where':{'name':_0x647b7e,'userProfileId':_0x366260[_0x0d29('0x54')]},'raw':!![]})[_0x0d29('0x26')](function(_0x4ba640){if(_0x4ba640&&_0x4ba640[_0x0d29('0x55')]===0x0){return db[_0x0d29('0x29')][_0x0d29('0x4e')]({'name':_0x3c6513[_0x0d29('0x2e')],'resourceId':_0x3c6513['id'],'type':_0x4ba640['name'],'sectionId':_0x4ba640['id']},{})['then'](function(){return _0x2e33f0;});}else{return _0x2e33f0;}})[_0x0d29('0x4a')](function(_0x4d5dac){logger['error'](_0x0d29('0x56'),_0x4d5dac);throw _0x4d5dac;});}return _0x2e33f0;})[_0x0d29('0x26')](respondWithResult(_0xa9658d,0xc9))['catch'](handleError(_0xa9658d,null));};exports[_0x0d29('0x25')]=function(_0x91dc27,_0x5f4397){if(_0x91dc27[_0x0d29('0x4f')]['id']){delete _0x91dc27['body']['id'];}return db[_0x0d29('0x31')][_0x0d29('0x53')]({'where':{'id':_0x91dc27['params']['id']}})[_0x0d29('0x26')](handleEntityNotFound(_0x5f4397,null))[_0x0d29('0x26')](saveUpdates(_0x91dc27[_0x0d29('0x4f')],null))['then'](respondWithResult(_0x5f4397,null))[_0x0d29('0x4a')](handleError(_0x5f4397,null));};exports['destroy']=function(_0x5617cb,_0x33ec59){return db[_0x0d29('0x31')][_0x0d29('0x53')]({'where':{'id':_0x5617cb['params']['id']}})[_0x0d29('0x26')](handleEntityNotFound(_0x33ec59,null))[_0x0d29('0x26')](removeEntity(_0x33ec59,null))['catch'](handleError(_0x33ec59,null));};exports[_0x0d29('0x57')]=function(_0x159350,_0x4691c7,_0x4e4e2e){return db[_0x0d29('0x31')][_0x0d29('0x58')]({'where':{'id':_0x159350[_0x0d29('0x4c')]['id']}})['then'](handleEntityNotFound(_0x4691c7,null))['then'](function(_0x42e3b6){if(!_0x159350[_0x0d29('0x36')]['channel']||!utils[_0x0d29('0x59')](_0x159350['query'][_0x0d29('0x5a')])){throw new db[(_0x0d29('0x5b'))]['ValidationError'](_0x0d29('0x5c'));}var _0x145c6c={};var _0x1ec7d2={};_0x1ec7d2['model']=_[_0x0d29('0x4d')](db[_['capitalize'](_0x159350[_0x0d29('0x36')][_0x0d29('0x5a')][_0x0d29('0x5d')]())+_0x0d29('0x5e')]['rawAttributes']);_0x1ec7d2[_0x0d29('0x36')]=_['keys'](_0x159350[_0x0d29('0x36')]);_0x1ec7d2[_0x0d29('0x37')]=_[_0x0d29('0x38')](_0x1ec7d2[_0x0d29('0x35')],_0x1ec7d2['query']);_0x145c6c['attributes']=_['intersection'](_0x1ec7d2['model'],qs[_0x0d29('0x3a')](_0x159350[_0x0d29('0x36')][_0x0d29('0x3a')]));_0x145c6c[_0x0d29('0x39')]=_0x145c6c[_0x0d29('0x39')][_0x0d29('0x3b')]?_0x145c6c[_0x0d29('0x39')]:_0x1ec7d2['model'];_0x145c6c[_0x0d29('0x1f')]=qs[_0x0d29('0x1f')](_0x159350[_0x0d29('0x36')]['limit']);_0x145c6c[_0x0d29('0x1e')]=qs[_0x0d29('0x1e')](_0x159350[_0x0d29('0x36')][_0x0d29('0x1e')]);_0x145c6c[_0x0d29('0x3e')]=qs[_0x0d29('0x3f')](_0x159350[_0x0d29('0x36')]['sort']);_0x145c6c[_0x0d29('0x42')]=qs['filters'](_[_0x0d29('0x40')](_0x159350[_0x0d29('0x36')],_0x1ec7d2[_0x0d29('0x37')]));_0x145c6c=_[_0x0d29('0x43')]({},_0x145c6c,_0x159350[_0x0d29('0x45')]);return _0x42e3b6[_0x0d29('0x27')+_['capitalize'](_0x159350['query'][_0x0d29('0x5a')][_0x0d29('0x5d')]())+_0x0d29('0x5f')](_0x145c6c);})[_0x0d29('0x26')](respondWithResult(_0x4691c7,null))[_0x0d29('0x4a')](handleError(_0x4691c7,null));};exports[_0x0d29('0x60')]=function(_0x42bc82,_0x5f55ff,_0x594f46){return db[_0x0d29('0x31')][_0x0d29('0x58')]({'where':{'id':_0x42bc82['params']['id']}})[_0x0d29('0x26')](function(_0xd1df69){if(_0xd1df69){if(!_0x42bc82[_0x0d29('0x4f')][_0x0d29('0x5a')]||!utils[_0x0d29('0x59')](_0x42bc82[_0x0d29('0x4f')][_0x0d29('0x5a')])){throw new db[(_0x0d29('0x5b'))][(_0x0d29('0x61'))](_0x0d29('0x5c'));}return _0xd1df69[_0x0d29('0x62')+_[_0x0d29('0x63')](_0x42bc82[_0x0d29('0x4f')][_0x0d29('0x5a')][_0x0d29('0x5d')]())+_0x0d29('0x5f')](_0x42bc82['body'][_0x0d29('0x64')]);}return null;})[_0x0d29('0x26')](handleEntityNotFound(_0x5f55ff,null))[_0x0d29('0x26')](respondWithStatusCode(_0x5f55ff,null))[_0x0d29('0x4a')](handleError(_0x5f55ff,null));};exports[_0x0d29('0x65')]=function(_0x1d229b,_0x2efd2e,_0x5bbf6b){return db['Team'][_0x0d29('0x58')]({'where':{'id':_0x1d229b[_0x0d29('0x4c')]['id']}})[_0x0d29('0x26')](function(_0x541921){if(_0x541921){if(!_0x1d229b[_0x0d29('0x36')][_0x0d29('0x5a')]||!utils['isValidChannel'](_0x1d229b[_0x0d29('0x36')][_0x0d29('0x5a')])){throw new db[(_0x0d29('0x5b'))]['ValidationError'](_0x0d29('0x5c'));}return _0x541921[_0x0d29('0x66')+_[_0x0d29('0x63')](_0x1d229b['query']['channel'][_0x0d29('0x5d')]())+_0x0d29('0x5f')](_0x1d229b[_0x0d29('0x36')][_0x0d29('0x64')]);}return null;})[_0x0d29('0x26')](handleEntityNotFound(_0x2efd2e,null))[_0x0d29('0x26')](respondWithStatusCode(_0x2efd2e,null))[_0x0d29('0x4a')](handleError(_0x2efd2e,null));};exports[_0x0d29('0x67')]=function(_0x1b0c8f,_0x41726c,_0x307d1){return db[_0x0d29('0x31')][_0x0d29('0x53')]({'where':{'id':_0x1b0c8f[_0x0d29('0x4c')]['id']}})['then'](handleEntityNotFound(_0x41726c,null))['then'](function(_0x54e1f9){if(_0x54e1f9){var _0xa26720=[_0x0d29('0x68'),_0x0d29('0x69'),_0x0d29('0x6a'),_0x0d29('0x6b'),'Fax',_0x0d29('0x6c')];return BPromise[_0x0d29('0x6d')](_0xa26720,function(_0x3d875e){return _0x54e1f9['get'+_0x3d875e+_0x0d29('0x5f')]({'attributes':['id',_0x0d29('0x2e')]})[_0x0d29('0x26')](function(_0x56245a){return BPromise[_0x0d29('0x6d')](_0x56245a,function(_0x35b379){return _0x35b379[_0x0d29('0x67')](_0x1b0c8f[_0x0d29('0x4f')][_0x0d29('0x64')])['then'](function(){if(_0x3d875e===_0x0d29('0x68')){return db[_0x0d29('0x6e')][_0x0d29('0x48')]({'where':{'id':_0x1b0c8f[_0x0d29('0x4f')][_0x0d29('0x64')]},'attributes':['id',_0x0d29('0x2e'),_0x0d29('0x6f'),_0x0d29('0x70'),_0x0d29('0x71')],'raw':!![]})[_0x0d29('0x26')](function(_0x5ddb58){return BPromise['each'](_[_0x0d29('0x41')](_0x5ddb58,{'online':0x1}),function(_0x4e5bd9){return db['UserVoiceQueueRt'][_0x0d29('0x72')]({'membername':_0x4e5bd9[_0x0d29('0x2e')],'UserId':_0x4e5bd9['id'],'queue_name':_0x35b379['name'],'VoiceQueueId':_0x35b379['id'],'interface':_['isNil'](_0x4e5bd9[_0x0d29('0x71')])?util[_0x0d29('0x73')](_0x0d29('0x74'),_0x4e5bd9[_0x0d29('0x2e')]):_0x4e5bd9['interface'],'paused':_0x4e5bd9[_0x0d29('0x70')]||![],'penalty':0x0});});});}});});})[_0x0d29('0x26')](function(){return _0x54e1f9;});})['then'](function(){return _0x54e1f9;});}})[_0x0d29('0x26')](function(_0x239ffd){if(_0x239ffd){return _0x239ffd[_0x0d29('0x67')](_0x1b0c8f['body'][_0x0d29('0x64')],_[_0x0d29('0x75')](_0x1b0c8f[_0x0d29('0x4f')],[_0x0d29('0x64'),'id'])||{})['spread'](function(_0x16af9d){for(var _0x3d1869=0x0;_0x3d1869<_0x1b0c8f[_0x0d29('0x4f')][_0x0d29('0x64')][_0x0d29('0x3b')];_0x3d1869+=0x1){socket['emit'](_0x0d29('0x76'),{'UserId':_0x1b0c8f['body']['ids'][_0x3d1869],'TeamId':_0x1b0c8f[_0x0d29('0x4c')]['id']});}return _0x16af9d;});}})[_0x0d29('0x26')](respondWithResult(_0x41726c,null))['catch'](handleError(_0x41726c,null));};exports['removeAgents']=function(_0x479932,_0x38cd82,_0x32521b){return db[_0x0d29('0x31')][_0x0d29('0x53')]({'where':{'id':_0x479932[_0x0d29('0x4c')]['id']}})[_0x0d29('0x26')](handleEntityNotFound(_0x38cd82,null))['then'](function(_0x545b8c){if(_0x545b8c){return BPromise[_0x0d29('0x6d')]([_0x0d29('0x77'),_0x0d29('0x78'),_0x0d29('0x79'),_0x0d29('0x7a'),_0x0d29('0x7b'),_0x0d29('0x7c')],function(_0x414c43){return _0x545b8c[_0x0d29('0x27')+_['capitalize'](_0x414c43)+_0x0d29('0x5f')]({'attributes':['id',_0x0d29('0x2e')]})[_0x0d29('0x26')](function(_0xa7cab8){return BPromise[_0x0d29('0x6d')](_0xa7cab8,function(_0x6eefa0){return _0x6eefa0[_0x0d29('0x7d')](_0x479932[_0x0d29('0x36')]['ids'])[_0x0d29('0x26')](function(){if(_0x414c43==='voice'){return db[_0x0d29('0x7e')][_0x0d29('0x2a')]({'where':{'VoiceQueueId':_0x6eefa0['id'],'UserId':_0x479932[_0x0d29('0x36')]['ids']}});}});});})['then'](function(){return _0x545b8c;});})['then'](function(){return _0x545b8c;});}})[_0x0d29('0x26')](function(_0x26716b){if(_0x26716b){return _0x26716b[_0x0d29('0x7d')](_0x479932[_0x0d29('0x36')]['ids'])[_0x0d29('0x26')](function(){if(_['isArray'](_0x479932[_0x0d29('0x36')][_0x0d29('0x64')])){for(var _0x2f3347=0x0;_0x2f3347<_0x479932['query'][_0x0d29('0x64')][_0x0d29('0x3b')];_0x2f3347+=0x1){socket['emit'](_0x0d29('0x7f'),{'UserId':Number(_0x479932['query']['ids'][_0x2f3347]),'TeamId':Number(_0x479932['params']['id'])});}}else{socket['emit'](_0x0d29('0x7f'),{'UserId':Number(_0x479932[_0x0d29('0x36')][_0x0d29('0x64')]),'TeamId':Number(_0x479932[_0x0d29('0x4c')]['id'])});}});}})['then'](respondWithStatusCode(_0x38cd82,null))['catch'](handleError(_0x38cd82,null));};exports[_0x0d29('0x80')]=function(_0x2fc77a,_0x35c6a2,_0x1dcb5f){var _0x37e58a={};var _0x433f4b={};var _0x2ef9bc;var _0x107ad3;return db[_0x0d29('0x31')][_0x0d29('0x58')]({'where':{'id':_0x2fc77a[_0x0d29('0x4c')]['id']}})[_0x0d29('0x26')](handleEntityNotFound(_0x35c6a2,null))['then'](function(_0x28643e){if(_0x28643e){_0x2ef9bc=_0x28643e;_0x433f4b[_0x0d29('0x35')]=_[_0x0d29('0x4d')](db[_0x0d29('0x6e')]['rawAttributes']);_0x433f4b[_0x0d29('0x36')]=_[_0x0d29('0x4d')](_0x2fc77a['query']);_0x433f4b[_0x0d29('0x37')]=_[_0x0d29('0x38')](_0x433f4b[_0x0d29('0x35')],_0x433f4b[_0x0d29('0x36')]);_0x37e58a[_0x0d29('0x39')]=_[_0x0d29('0x38')](_0x433f4b['model'],qs[_0x0d29('0x3a')](_0x2fc77a[_0x0d29('0x36')]['fields']));_0x37e58a['attributes']=_0x37e58a[_0x0d29('0x39')][_0x0d29('0x3b')]?_0x37e58a['attributes']:_0x433f4b[_0x0d29('0x35')];_0x37e58a[_0x0d29('0x3e')]=qs[_0x0d29('0x3f')](_0x2fc77a[_0x0d29('0x36')]['sort']);_0x37e58a['where']=qs[_0x0d29('0x37')](_[_0x0d29('0x40')](_0x2fc77a[_0x0d29('0x36')],_0x433f4b[_0x0d29('0x37')]));if(_0x2fc77a[_0x0d29('0x36')]['filter']){_0x37e58a[_0x0d29('0x42')]=_['merge'](_0x37e58a[_0x0d29('0x42')],{'$or':_[_0x0d29('0x30')](_0x37e58a[_0x0d29('0x39')],function(_0x41929a){var _0x4a9ec8={};_0x4a9ec8[_0x41929a]={'$like':'%'+_0x2fc77a[_0x0d29('0x36')][_0x0d29('0x41')]+'%'};return _0x4a9ec8;})});}_0x37e58a=_[_0x0d29('0x43')]({},_0x37e58a,_0x2fc77a['options']);return _0x2ef9bc[_0x0d29('0x80')](_0x37e58a);}})[_0x0d29('0x26')](function(_0x144629){if(_0x144629){_0x107ad3=_0x144629['length'];if(!_0x2fc77a['query'][_0x0d29('0x3c')]('nolimit')){_0x37e58a[_0x0d29('0x1f')]=qs['limit'](_0x2fc77a['query'][_0x0d29('0x1f')]);_0x37e58a[_0x0d29('0x1e')]=qs[_0x0d29('0x1e')](_0x2fc77a[_0x0d29('0x36')]['offset']);}return _0x2ef9bc[_0x0d29('0x80')](_0x37e58a);}})[_0x0d29('0x26')](function(_0x443be3){if(_0x443be3){return _0x443be3?{'count':_0x107ad3,'rows':_0x443be3}:null;}})['then'](respondWithResult(_0x35c6a2,null))[_0x0d29('0x4a')](handleError(_0x35c6a2,null));}; \ No newline at end of file +var _0x253d=['VIRTUAL','options','count','includeAll','include','findAll','rows','catch','show','params','keys','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','findOne','channel','ValidationError','Unknown\x20channel','capitalize','toLowerCase','addQueues','isValidChannel','Sequelize','add','Queues','ids','removeQueues','remove','addAgents','Voice','Chat','Mail','Sms','Fax','each','User','online','voicePause','interface','UserVoiceQueueRt','upsert','isNil','format','SIP/%s','spread','emit','voice','sms','fax','removeAgents','isArray','userTeam:remove','getAgents','html-pdf','request-promise','moment','bluebird','mustache','util','sox','to-csv','ejs','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','redis','localhost','socket.io-emitter','status','json','offset','Content-Range','save','update','then','destroy','get','Teams','UserProfileResource','end','sendStatus','error','stack','name','send','index','map','Team','rawAttributes','fieldName','type','key','model','query','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','limit','order','sort','where','pick','filter','merge'];(function(_0x2b6cd6,_0x52a474){var _0x4115d5=function(_0x13f802){while(--_0x13f802){_0x2b6cd6['push'](_0x2b6cd6['shift']());}};_0x4115d5(++_0x52a474);}(_0x253d,0x1b3));var _0xd253=function(_0x42a077,_0x491c0a){_0x42a077=_0x42a077-0x0;var _0x481e93=_0x253d[_0x42a077];return _0x481e93;};'use strict';var pdf=require(_0xd253('0x0'));var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0xd253('0x1'));var moment=require(_0xd253('0x2'));var BPromise=require(_0xd253('0x3'));var Mustache=require(_0xd253('0x4'));var util=require(_0xd253('0x5'));var path=require('path');var sox=require(_0xd253('0x6'));var csv=require(_0xd253('0x7'));var ejs=require(_0xd253('0x8'));var fs=require('fs');var _=require(_0xd253('0x9'));var squel=require(_0xd253('0xa'));var crypto=require('crypto');var jsforce=require(_0xd253('0xb'));var deskjs=require(_0xd253('0xc'));var toCsv=require(_0xd253('0x7'));var querystring=require(_0xd253('0xd'));var Papa=require(_0xd253('0xe'));var Redis=require(_0xd253('0xf'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0xd253('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xd253('0x11'))(_0xd253('0x12'));var utils=require(_0xd253('0x13'));var config=require(_0xd253('0x14'));var db=require(_0xd253('0x15'))['db'];config[_0xd253('0x16')]=_['defaults'](config['redis'],{'host':_0xd253('0x17'),'port':0x18eb});var socket=require(_0xd253('0x18'))(new Redis(config[_0xd253('0x16')]));require('./team.socket')['register'](socket);function respondWithStatusCode(_0x3a4c2e,_0x10d903){_0x10d903=_0x10d903||0xcc;return function(_0x1998ec){if(_0x1998ec){return _0x3a4c2e['sendStatus'](_0x10d903);}return _0x3a4c2e[_0xd253('0x19')](_0x10d903)['end']();};}function respondWithResult(_0x8b15a6,_0x435711){_0x435711=_0x435711||0xc8;return function(_0x24fa24){if(_0x24fa24){return _0x8b15a6['status'](_0x435711)[_0xd253('0x1a')](_0x24fa24);}};}function respondWithFilteredResult(_0x5bb9c9,_0x427c6a){return function(_0x215354){if(_0x215354){var _0x5e4051=_0x215354['count'],_0x2496cb=_0x427c6a[_0xd253('0x1b')],_0x2a2adc=_0x427c6a['offset']+_0x427c6a['limit'],_0x5b24ff;if(_0x2a2adc>=_0x5e4051){_0x2a2adc=_0x5e4051;_0x5b24ff=0xc8;}else{_0x5b24ff=0xce;}_0x5bb9c9[_0xd253('0x19')](_0x5b24ff);return _0x5bb9c9['set'](_0xd253('0x1c'),_0x2496cb+'-'+_0x2a2adc+'/'+_0x5e4051)[_0xd253('0x1a')](_0x215354);}return null;};}function patchUpdates(_0x289821){return function(_0x31b984){try{jsonpatch['apply'](_0x31b984,_0x289821,!![]);}catch(_0x307c00){return BPromise['reject'](_0x307c00);}return _0x31b984[_0xd253('0x1d')]();};}function saveUpdates(_0x50f8b5,_0x448b5b){return function(_0x9c1d53){if(_0x9c1d53){return _0x9c1d53[_0xd253('0x1e')](_0x50f8b5)[_0xd253('0x1f')](function(_0x592b7f){return _0x592b7f;});}return null;};}function removeEntity(_0x111580,_0x34d98d){return function(_0x585c14){if(_0x585c14){return _0x585c14[_0xd253('0x20')]()[_0xd253('0x1f')](function(){var _0x136c52=_0x585c14[_0xd253('0x21')]({'plain':!![]});var _0xb6f301=_0xd253('0x22');return db[_0xd253('0x23')]['destroy']({'where':{'type':_0xb6f301,'resourceId':_0x136c52['id']}})[_0xd253('0x1f')](function(){return _0x585c14;});})['then'](function(){_0x111580['status'](0xcc)[_0xd253('0x24')]();});}};}function handleEntityNotFound(_0x3e36cc,_0x4a4ba1){return function(_0x542494){if(!_0x542494){_0x3e36cc[_0xd253('0x25')](0x194);}return _0x542494;};}function handleError(_0x44486d,_0x566e37){_0x566e37=_0x566e37||0x1f4;return function(_0x3955a0){logger[_0xd253('0x26')](_0x3955a0[_0xd253('0x27')]);if(_0x3955a0[_0xd253('0x28')]){delete _0x3955a0[_0xd253('0x28')];}_0x44486d['status'](_0x566e37)[_0xd253('0x29')](_0x3955a0);};}exports[_0xd253('0x2a')]=function(_0x3d0e0b,_0x5dc9c9){var _0x6db8ef={},_0x51b8dd={},_0x204a78={'count':0x0,'rows':[]};var _0x3c11c8=_[_0xd253('0x2b')](db[_0xd253('0x2c')][_0xd253('0x2d')],function(_0x16d6d2){return{'name':_0x16d6d2[_0xd253('0x2e')],'type':_0x16d6d2[_0xd253('0x2f')][_0xd253('0x30')]};});_0x51b8dd[_0xd253('0x31')]=_['map'](_0x3c11c8,_0xd253('0x28'));_0x51b8dd[_0xd253('0x32')]=_['keys'](_0x3d0e0b['query']);_0x51b8dd[_0xd253('0x33')]=_['intersection'](_0x51b8dd[_0xd253('0x31')],_0x51b8dd[_0xd253('0x32')]);_0x6db8ef[_0xd253('0x34')]=_[_0xd253('0x35')](_0x51b8dd['model'],qs[_0xd253('0x36')](_0x3d0e0b[_0xd253('0x32')][_0xd253('0x36')]));_0x6db8ef[_0xd253('0x34')]=_0x6db8ef[_0xd253('0x34')][_0xd253('0x37')]?_0x6db8ef[_0xd253('0x34')]:_0x51b8dd['model'];if(!_0x3d0e0b[_0xd253('0x32')][_0xd253('0x38')](_0xd253('0x39'))){_0x6db8ef[_0xd253('0x3a')]=qs[_0xd253('0x3a')](_0x3d0e0b['query'][_0xd253('0x3a')]);_0x6db8ef['offset']=qs[_0xd253('0x1b')](_0x3d0e0b[_0xd253('0x32')][_0xd253('0x1b')]);}_0x6db8ef[_0xd253('0x3b')]=qs['sort'](_0x3d0e0b[_0xd253('0x32')][_0xd253('0x3c')]);_0x6db8ef[_0xd253('0x3d')]=qs[_0xd253('0x33')](_[_0xd253('0x3e')](_0x3d0e0b[_0xd253('0x32')],_0x51b8dd[_0xd253('0x33')]));if(_0x3d0e0b[_0xd253('0x32')][_0xd253('0x3f')]){_0x6db8ef[_0xd253('0x3d')]=_[_0xd253('0x40')](_0x6db8ef[_0xd253('0x3d')],{'$or':_[_0xd253('0x2b')](_0x3c11c8,function(_0x28c5f0){if(_0x28c5f0['type']!==_0xd253('0x41')){var _0x34b723={};_0x34b723[_0x28c5f0[_0xd253('0x28')]]={'$like':'%'+_0x3d0e0b['query'][_0xd253('0x3f')]+'%'};return _0x34b723;}})});}_0x6db8ef=_[_0xd253('0x40')]({},_0x6db8ef,_0x3d0e0b[_0xd253('0x42')]);var _0x45b37c={'where':_0x6db8ef['where']};return db[_0xd253('0x2c')][_0xd253('0x43')](_0x45b37c)['then'](function(_0x1bbcbc){_0x204a78[_0xd253('0x43')]=_0x1bbcbc;if(_0x3d0e0b[_0xd253('0x32')][_0xd253('0x44')]){_0x6db8ef[_0xd253('0x45')]=[{'all':!![]}];}return db[_0xd253('0x2c')][_0xd253('0x46')](_0x6db8ef);})[_0xd253('0x1f')](function(_0x1403ca){_0x204a78[_0xd253('0x47')]=_0x1403ca;return _0x204a78;})['then'](respondWithFilteredResult(_0x5dc9c9,_0x6db8ef))[_0xd253('0x48')](handleError(_0x5dc9c9,null));};exports[_0xd253('0x49')]=function(_0x1cd482,_0x1a70bd){var _0x5d350f={'raw':![],'where':{'id':_0x1cd482[_0xd253('0x4a')]['id']}},_0x5c72b3={};_0x5c72b3[_0xd253('0x31')]=_[_0xd253('0x4b')](db[_0xd253('0x2c')][_0xd253('0x2d')]);_0x5c72b3[_0xd253('0x32')]=_[_0xd253('0x4b')](_0x1cd482['query']);_0x5c72b3[_0xd253('0x33')]=_[_0xd253('0x35')](_0x5c72b3['model'],_0x5c72b3[_0xd253('0x32')]);_0x5d350f[_0xd253('0x34')]=_[_0xd253('0x35')](_0x5c72b3[_0xd253('0x31')],qs['fields'](_0x1cd482[_0xd253('0x32')]['fields']));_0x5d350f[_0xd253('0x34')]=_0x5d350f['attributes'][_0xd253('0x37')]?_0x5d350f[_0xd253('0x34')]:_0x5c72b3['model'];if(_0x1cd482['query']['includeAll']){_0x5d350f[_0xd253('0x45')]=[{'all':!![]}];}_0x5d350f=_['merge']({},_0x5d350f,_0x1cd482['options']);return db[_0xd253('0x2c')][_0xd253('0x4c')](_0x5d350f)[_0xd253('0x1f')](handleEntityNotFound(_0x1a70bd,null))[_0xd253('0x1f')](respondWithResult(_0x1a70bd,null))['catch'](handleError(_0x1a70bd,null));};exports[_0xd253('0x4d')]=function(_0x53307f,_0x5d6795){return db[_0xd253('0x2c')][_0xd253('0x4d')](_0x53307f[_0xd253('0x4e')],{})[_0xd253('0x1f')](function(_0x8d7f15){var _0x33479c=_0x53307f[_0xd253('0x4f')][_0xd253('0x21')]({'plain':!![]});if(!_0x33479c)throw new Error(_0xd253('0x50'));if(_0x33479c[_0xd253('0x51')]===_0xd253('0x4f')){var _0x203c58=_0x8d7f15[_0xd253('0x21')]({'plain':!![]});var _0x151443=_0xd253('0x22');return db[_0xd253('0x52')][_0xd253('0x4c')]({'where':{'name':_0x151443,'userProfileId':_0x33479c[_0xd253('0x53')]},'raw':!![]})[_0xd253('0x1f')](function(_0x3de79a){if(_0x3de79a&&_0x3de79a[_0xd253('0x54')]===0x0){return db[_0xd253('0x23')][_0xd253('0x4d')]({'name':_0x203c58[_0xd253('0x28')],'resourceId':_0x203c58['id'],'type':_0x3de79a[_0xd253('0x28')],'sectionId':_0x3de79a['id']},{})[_0xd253('0x1f')](function(){return _0x8d7f15;});}else{return _0x8d7f15;}})['catch'](function(_0xe4f0b2){logger[_0xd253('0x26')](_0xd253('0x55'),_0xe4f0b2);throw _0xe4f0b2;});}return _0x8d7f15;})['then'](respondWithResult(_0x5d6795,0xc9))[_0xd253('0x48')](handleError(_0x5d6795,null));};exports['update']=function(_0x2a25b6,_0xa722a2){if(_0x2a25b6[_0xd253('0x4e')]['id']){delete _0x2a25b6[_0xd253('0x4e')]['id'];}return db[_0xd253('0x2c')][_0xd253('0x4c')]({'where':{'id':_0x2a25b6[_0xd253('0x4a')]['id']}})[_0xd253('0x1f')](handleEntityNotFound(_0xa722a2,null))[_0xd253('0x1f')](saveUpdates(_0x2a25b6[_0xd253('0x4e')],null))[_0xd253('0x1f')](respondWithResult(_0xa722a2,null))[_0xd253('0x48')](handleError(_0xa722a2,null));};exports[_0xd253('0x20')]=function(_0x410d4f,_0xe24ce5){return db[_0xd253('0x2c')]['find']({'where':{'id':_0x410d4f[_0xd253('0x4a')]['id']}})[_0xd253('0x1f')](handleEntityNotFound(_0xe24ce5,null))[_0xd253('0x1f')](removeEntity(_0xe24ce5,null))[_0xd253('0x48')](handleError(_0xe24ce5,null));};exports['getQueues']=function(_0x22baab,_0x4cec88,_0x677cd8){return db[_0xd253('0x2c')][_0xd253('0x56')]({'where':{'id':_0x22baab[_0xd253('0x4a')]['id']}})[_0xd253('0x1f')](handleEntityNotFound(_0x4cec88,null))[_0xd253('0x1f')](function(_0xc5353a){if(!_0x22baab[_0xd253('0x32')][_0xd253('0x57')]||!utils['isValidChannel'](_0x22baab[_0xd253('0x32')]['channel'])){throw new db['Sequelize'][(_0xd253('0x58'))](_0xd253('0x59'));}var _0x3615c8={};var _0x2a24cb={};_0x2a24cb[_0xd253('0x31')]=_[_0xd253('0x4b')](db[_[_0xd253('0x5a')](_0x22baab['query']['channel']['toLowerCase']())+'Queue'][_0xd253('0x2d')]);_0x2a24cb[_0xd253('0x32')]=_[_0xd253('0x4b')](_0x22baab['query']);_0x2a24cb[_0xd253('0x33')]=_[_0xd253('0x35')](_0x2a24cb[_0xd253('0x31')],_0x2a24cb[_0xd253('0x32')]);_0x3615c8[_0xd253('0x34')]=_[_0xd253('0x35')](_0x2a24cb['model'],qs[_0xd253('0x36')](_0x22baab[_0xd253('0x32')][_0xd253('0x36')]));_0x3615c8[_0xd253('0x34')]=_0x3615c8[_0xd253('0x34')]['length']?_0x3615c8[_0xd253('0x34')]:_0x2a24cb[_0xd253('0x31')];_0x3615c8[_0xd253('0x3a')]=qs[_0xd253('0x3a')](_0x22baab[_0xd253('0x32')][_0xd253('0x3a')]);_0x3615c8[_0xd253('0x1b')]=qs['offset'](_0x22baab[_0xd253('0x32')][_0xd253('0x1b')]);_0x3615c8[_0xd253('0x3b')]=qs[_0xd253('0x3c')](_0x22baab[_0xd253('0x32')][_0xd253('0x3c')]);_0x3615c8['where']=qs[_0xd253('0x33')](_[_0xd253('0x3e')](_0x22baab['query'],_0x2a24cb[_0xd253('0x33')]));_0x3615c8=_[_0xd253('0x40')]({},_0x3615c8,_0x22baab[_0xd253('0x42')]);return _0xc5353a[_0xd253('0x21')+_[_0xd253('0x5a')](_0x22baab['query'][_0xd253('0x57')][_0xd253('0x5b')]())+'Queues'](_0x3615c8);})[_0xd253('0x1f')](respondWithResult(_0x4cec88,null))['catch'](handleError(_0x4cec88,null));};exports[_0xd253('0x5c')]=function(_0x3eeeb4,_0x43e78c,_0xb5a252){return db['Team'][_0xd253('0x56')]({'where':{'id':_0x3eeeb4[_0xd253('0x4a')]['id']}})[_0xd253('0x1f')](function(_0x23d48a){if(_0x23d48a){if(!_0x3eeeb4[_0xd253('0x4e')][_0xd253('0x57')]||!utils[_0xd253('0x5d')](_0x3eeeb4[_0xd253('0x4e')]['channel'])){throw new db[(_0xd253('0x5e'))][(_0xd253('0x58'))](_0xd253('0x59'));}return _0x23d48a[_0xd253('0x5f')+_[_0xd253('0x5a')](_0x3eeeb4['body'][_0xd253('0x57')][_0xd253('0x5b')]())+_0xd253('0x60')](_0x3eeeb4[_0xd253('0x4e')][_0xd253('0x61')]);}return null;})['then'](handleEntityNotFound(_0x43e78c,null))[_0xd253('0x1f')](respondWithStatusCode(_0x43e78c,null))['catch'](handleError(_0x43e78c,null));};exports[_0xd253('0x62')]=function(_0x2e5c8a,_0x31ab25,_0x2448a0){return db[_0xd253('0x2c')]['findOne']({'where':{'id':_0x2e5c8a[_0xd253('0x4a')]['id']}})[_0xd253('0x1f')](function(_0x2d4fe1){if(_0x2d4fe1){if(!_0x2e5c8a[_0xd253('0x32')][_0xd253('0x57')]||!utils[_0xd253('0x5d')](_0x2e5c8a[_0xd253('0x32')][_0xd253('0x57')])){throw new db[(_0xd253('0x5e'))][(_0xd253('0x58'))]('Unknown\x20channel');}return _0x2d4fe1[_0xd253('0x63')+_[_0xd253('0x5a')](_0x2e5c8a['query'][_0xd253('0x57')][_0xd253('0x5b')]())+_0xd253('0x60')](_0x2e5c8a[_0xd253('0x32')]['ids']);}return null;})[_0xd253('0x1f')](handleEntityNotFound(_0x31ab25,null))['then'](respondWithStatusCode(_0x31ab25,null))[_0xd253('0x48')](handleError(_0x31ab25,null));};exports[_0xd253('0x64')]=function(_0x1d7ac6,_0x2643a3,_0x13fd2d){return db['Team'][_0xd253('0x4c')]({'where':{'id':_0x1d7ac6[_0xd253('0x4a')]['id']}})[_0xd253('0x1f')](handleEntityNotFound(_0x2643a3,null))['then'](function(_0x4a6be1){if(_0x4a6be1){var _0x5d03f5=[_0xd253('0x65'),_0xd253('0x66'),_0xd253('0x67'),_0xd253('0x68'),_0xd253('0x69'),'Openchannel'];return BPromise[_0xd253('0x6a')](_0x5d03f5,function(_0x81022e){return _0x4a6be1[_0xd253('0x21')+_0x81022e+'Queues']({'attributes':['id',_0xd253('0x28')]})['then'](function(_0x6cd92d){return BPromise[_0xd253('0x6a')](_0x6cd92d,function(_0x805e05){return _0x805e05[_0xd253('0x64')](_0x1d7ac6[_0xd253('0x4e')]['ids'])['then'](function(){if(_0x81022e===_0xd253('0x65')){return db[_0xd253('0x6b')][_0xd253('0x46')]({'where':{'id':_0x1d7ac6['body'][_0xd253('0x61')]},'attributes':['id',_0xd253('0x28'),_0xd253('0x6c'),_0xd253('0x6d'),_0xd253('0x6e')],'raw':!![]})[_0xd253('0x1f')](function(_0x4adfac){return BPromise[_0xd253('0x6a')](_[_0xd253('0x3f')](_0x4adfac,{'online':0x1}),function(_0x5a758c){return db[_0xd253('0x6f')][_0xd253('0x70')]({'membername':_0x5a758c[_0xd253('0x28')],'UserId':_0x5a758c['id'],'queue_name':_0x805e05['name'],'VoiceQueueId':_0x805e05['id'],'interface':_[_0xd253('0x71')](_0x5a758c[_0xd253('0x6e')])?util[_0xd253('0x72')](_0xd253('0x73'),_0x5a758c[_0xd253('0x28')]):_0x5a758c[_0xd253('0x6e')],'paused':_0x5a758c[_0xd253('0x6d')]||![],'penalty':0x0});});});}});});})['then'](function(){return _0x4a6be1;});})['then'](function(){return _0x4a6be1;});}})[_0xd253('0x1f')](function(_0x390a00){if(_0x390a00){return _0x390a00[_0xd253('0x64')](_0x1d7ac6['body'][_0xd253('0x61')],_['omit'](_0x1d7ac6[_0xd253('0x4e')],[_0xd253('0x61'),'id'])||{})[_0xd253('0x74')](function(_0xfa4625){for(var _0x5df20c=0x0;_0x5df20c<_0x1d7ac6[_0xd253('0x4e')]['ids']['length'];_0x5df20c+=0x1){socket[_0xd253('0x75')]('userTeam:save',{'UserId':_0x1d7ac6[_0xd253('0x4e')][_0xd253('0x61')][_0x5df20c],'TeamId':_0x1d7ac6[_0xd253('0x4a')]['id']});}return _0xfa4625;});}})['then'](respondWithResult(_0x2643a3,null))[_0xd253('0x48')](handleError(_0x2643a3,null));};exports['removeAgents']=function(_0x4a6e27,_0x764796,_0x12e16f){return db['Team'][_0xd253('0x4c')]({'where':{'id':_0x4a6e27[_0xd253('0x4a')]['id']}})[_0xd253('0x1f')](handleEntityNotFound(_0x764796,null))[_0xd253('0x1f')](function(_0x2e497e){if(_0x2e497e){return BPromise[_0xd253('0x6a')]([_0xd253('0x76'),'chat','mail',_0xd253('0x77'),_0xd253('0x78'),'openchannel'],function(_0xae483f){return _0x2e497e[_0xd253('0x21')+_[_0xd253('0x5a')](_0xae483f)+_0xd253('0x60')]({'attributes':['id',_0xd253('0x28')]})[_0xd253('0x1f')](function(_0x3f2239){return BPromise[_0xd253('0x6a')](_0x3f2239,function(_0x239dbc){return _0x239dbc[_0xd253('0x79')](_0x4a6e27[_0xd253('0x32')][_0xd253('0x61')])[_0xd253('0x1f')](function(){if(_0xae483f===_0xd253('0x76')){return db['UserVoiceQueueRt'][_0xd253('0x20')]({'where':{'VoiceQueueId':_0x239dbc['id'],'UserId':_0x4a6e27[_0xd253('0x32')][_0xd253('0x61')]}});}});});})['then'](function(){return _0x2e497e;});})['then'](function(){return _0x2e497e;});}})['then'](function(_0x1bfb37){if(_0x1bfb37){return _0x1bfb37[_0xd253('0x79')](_0x4a6e27[_0xd253('0x32')][_0xd253('0x61')])['then'](function(){if(_[_0xd253('0x7a')](_0x4a6e27['query'][_0xd253('0x61')])){for(var _0x2cbf53=0x0;_0x2cbf53<_0x4a6e27[_0xd253('0x32')][_0xd253('0x61')]['length'];_0x2cbf53+=0x1){socket[_0xd253('0x75')](_0xd253('0x7b'),{'UserId':Number(_0x4a6e27['query']['ids'][_0x2cbf53]),'TeamId':Number(_0x4a6e27[_0xd253('0x4a')]['id'])});}}else{socket['emit'](_0xd253('0x7b'),{'UserId':Number(_0x4a6e27[_0xd253('0x32')][_0xd253('0x61')]),'TeamId':Number(_0x4a6e27[_0xd253('0x4a')]['id'])});}});}})['then'](respondWithStatusCode(_0x764796,null))['catch'](handleError(_0x764796,null));};exports['getAgents']=function(_0x3fe396,_0x3b026b,_0x52e793){var _0x3f9a05={};var _0x4e5d99={};var _0x29f473;var _0x439f8f;return db[_0xd253('0x2c')][_0xd253('0x56')]({'where':{'id':_0x3fe396[_0xd253('0x4a')]['id']}})['then'](handleEntityNotFound(_0x3b026b,null))[_0xd253('0x1f')](function(_0x4349ed){if(_0x4349ed){_0x29f473=_0x4349ed;_0x4e5d99[_0xd253('0x31')]=_[_0xd253('0x4b')](db[_0xd253('0x6b')][_0xd253('0x2d')]);_0x4e5d99['query']=_['keys'](_0x3fe396[_0xd253('0x32')]);_0x4e5d99[_0xd253('0x33')]=_[_0xd253('0x35')](_0x4e5d99[_0xd253('0x31')],_0x4e5d99[_0xd253('0x32')]);_0x3f9a05[_0xd253('0x34')]=_[_0xd253('0x35')](_0x4e5d99[_0xd253('0x31')],qs[_0xd253('0x36')](_0x3fe396[_0xd253('0x32')][_0xd253('0x36')]));_0x3f9a05[_0xd253('0x34')]=_0x3f9a05[_0xd253('0x34')][_0xd253('0x37')]?_0x3f9a05[_0xd253('0x34')]:_0x4e5d99['model'];_0x3f9a05[_0xd253('0x3b')]=qs[_0xd253('0x3c')](_0x3fe396[_0xd253('0x32')][_0xd253('0x3c')]);_0x3f9a05['where']=qs[_0xd253('0x33')](_['pick'](_0x3fe396[_0xd253('0x32')],_0x4e5d99[_0xd253('0x33')]));if(_0x3fe396[_0xd253('0x32')][_0xd253('0x3f')]){_0x3f9a05['where']=_[_0xd253('0x40')](_0x3f9a05['where'],{'$or':_['map'](_0x3f9a05[_0xd253('0x34')],function(_0x548d16){var _0x1beecd={};_0x1beecd[_0x548d16]={'$like':'%'+_0x3fe396['query'][_0xd253('0x3f')]+'%'};return _0x1beecd;})});}_0x3f9a05=_['merge']({},_0x3f9a05,_0x3fe396[_0xd253('0x42')]);return _0x29f473[_0xd253('0x7c')](_0x3f9a05);}})['then'](function(_0x302567){if(_0x302567){_0x439f8f=_0x302567[_0xd253('0x37')];if(!_0x3fe396[_0xd253('0x32')]['hasOwnProperty'](_0xd253('0x39'))){_0x3f9a05['limit']=qs['limit'](_0x3fe396[_0xd253('0x32')][_0xd253('0x3a')]);_0x3f9a05[_0xd253('0x1b')]=qs['offset'](_0x3fe396[_0xd253('0x32')][_0xd253('0x1b')]);}return _0x29f473['getAgents'](_0x3f9a05);}})[_0xd253('0x1f')](function(_0x1c1ea4){if(_0x1c1ea4){return _0x1c1ea4?{'count':_0x439f8f,'rows':_0x1c1ea4}:null;}})[_0xd253('0x1f')](respondWithResult(_0x3b026b,null))[_0xd253('0x48')](handleError(_0x3b026b,null));}; \ No newline at end of file diff --git a/server/api/team/team.events.js b/server/api/team/team.events.js index 514032c..d53c64b 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 _0x04e6=['setMaxListeners','save','update','remove','emit','hasOwnProperty','exports','events','Team'];(function(_0x93be41,_0x46c7f2){var _0x5cf92a=function(_0x38096a){while(--_0x38096a){_0x93be41['push'](_0x93be41['shift']());}};_0x5cf92a(++_0x46c7f2);}(_0x04e6,0xbb));var _0x604e=function(_0x1a014b,_0x48acae){_0x1a014b=_0x1a014b-0x0;var _0x462258=_0x04e6[_0x1a014b];return _0x462258;};'use strict';var EventEmitter=require(_0x604e('0x0'));var Team=require('../../mysqldb')['db'][_0x604e('0x1')];var TeamEvents=new EventEmitter();TeamEvents[_0x604e('0x2')](0x0);var events={'afterCreate':_0x604e('0x3'),'afterUpdate':_0x604e('0x4'),'afterDestroy':_0x604e('0x5')};function emitEvent(_0x3f07a0){return function(_0x5c6cab,_0x407c7e,_0x3d23f8){TeamEvents['emit'](_0x3f07a0+':'+_0x5c6cab['id'],_0x5c6cab);TeamEvents[_0x604e('0x6')](_0x3f07a0,_0x5c6cab);_0x3d23f8(null);};}for(var e in events){if(events[_0x604e('0x7')](e)){var event=events[e];Team['hook'](e,emitEvent(event));}}module[_0x604e('0x8')]=TeamEvents; \ No newline at end of file +var _0xb2e9=['hasOwnProperty','hook','exports','Team','setMaxListeners','update','remove'];(function(_0x218972,_0x1f9794){var _0x1bb1a8=function(_0x3fb962){while(--_0x3fb962){_0x218972['push'](_0x218972['shift']());}};_0x1bb1a8(++_0x1f9794);}(_0xb2e9,0x176));var _0x9b2e=function(_0x45b5c7,_0x5880ce){_0x45b5c7=_0x45b5c7-0x0;var _0x483f85=_0xb2e9[_0x45b5c7];return _0x483f85;};'use strict';var EventEmitter=require('events');var Team=require('../../mysqldb')['db'][_0x9b2e('0x0')];var TeamEvents=new EventEmitter();TeamEvents[_0x9b2e('0x1')](0x0);var events={'afterCreate':'save','afterUpdate':_0x9b2e('0x2'),'afterDestroy':_0x9b2e('0x3')};function emitEvent(_0x3bf145){return function(_0x44758c,_0x4a9aec,_0x372304){TeamEvents['emit'](_0x3bf145+':'+_0x44758c['id'],_0x44758c);TeamEvents['emit'](_0x3bf145,_0x44758c);_0x372304(null);};}for(var e in events){if(events[_0x9b2e('0x4')](e)){var event=events[e];Team[_0x9b2e('0x5')](e,emitEvent(event));}}module[_0x9b2e('0x6')]=TeamEvents; \ No newline at end of file diff --git a/server/api/team/team.model.js b/server/api/team/team.model.js index 687f45e..d234c67 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 _0x0998=['../../config/environment','define','Team','lodash','util','../../config/logger','moment','bluebird','request-promise','rimraf'];(function(_0x4a422a,_0x5a1932){var _0x399d65=function(_0x41a382){while(--_0x41a382){_0x4a422a['push'](_0x4a422a['shift']());}};_0x399d65(++_0x5a1932);}(_0x0998,0x14d));var _0x8099=function(_0x400a3d,_0x376549){_0x400a3d=_0x400a3d-0x0;var _0x25fb8a=_0x0998[_0x400a3d];return _0x25fb8a;};'use strict';var _=require(_0x8099('0x0'));var util=require(_0x8099('0x1'));var logger=require(_0x8099('0x2'))('api');var moment=require(_0x8099('0x3'));var BPromise=require(_0x8099('0x4'));var rp=require(_0x8099('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x8099('0x6'));var config=require(_0x8099('0x7'));var attributes=require('./team.attributes');module['exports']=function(_0x15dc81,_0x5097d7){return _0x15dc81[_0x8099('0x8')](_0x8099('0x9'),attributes,{'tableName':'teams','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x62ad=['Team','bluebird','request-promise','../../config/environment','./team.attributes','exports','define'];(function(_0x1733e9,_0x4bbadc){var _0x33b9d2=function(_0x4ca894){while(--_0x4ca894){_0x1733e9['push'](_0x1733e9['shift']());}};_0x33b9d2(++_0x4bbadc);}(_0x62ad,0x174));var _0xd62a=function(_0x592c1f,_0x310fdf){_0x592c1f=_0x592c1f-0x0;var _0x5d2e29=_0x62ad[_0x592c1f];return _0x5d2e29;};'use strict';var _=require('lodash');var util=require('util');var logger=require('../../config/logger')('api');var moment=require('moment');var BPromise=require(_0xd62a('0x0'));var rp=require(_0xd62a('0x1'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0xd62a('0x2'));var attributes=require(_0xd62a('0x3'));module[_0xd62a('0x4')]=function(_0x1649f5,_0x459e20){return _0x1649f5[_0xd62a('0x5')](_0xd62a('0x6'),attributes,{'tableName':'teams','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 c53860c..308d74b 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 _0x4b5c=['redis','defaults','localhost','socket.io-emitter','./team.socket','request','info','Team,\x20%s,\x20%s','request\x20sent','debug','Team,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','http'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x4b5c,0x16f));var _0xc4b5=function(_0x58a4ef,_0xdf8cf6){_0x58a4ef=_0x58a4ef-0x0;var _0x1cfcfe=_0x4b5c[_0x58a4ef];return _0x1cfcfe;};'use strict';var _=require(_0xc4b5('0x0'));var util=require('util');var moment=require(_0xc4b5('0x1'));var BPromise=require(_0xc4b5('0x2'));var rs=require(_0xc4b5('0x3'));var fs=require('fs');var Redis=require(_0xc4b5('0x4'));var db=require(_0xc4b5('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0xc4b5('0x6'))(_0xc4b5('0x7'));var config=require(_0xc4b5('0x8'));var jayson=require(_0xc4b5('0x9'));var client=jayson['client'][_0xc4b5('0xa')]({'port':0x232a});config[_0xc4b5('0xb')]=_[_0xc4b5('0xc')](config[_0xc4b5('0xb')],{'host':_0xc4b5('0xd'),'port':0x18eb});var socket=require(_0xc4b5('0xe'))(new Redis(config[_0xc4b5('0xb')]));require(_0xc4b5('0xf'))['register'](socket);function respondWithRpcPromise(_0x523083,_0x48dae1,_0x563fdc){return new BPromise(function(_0x47a6d5,_0x10cb07){return client[_0xc4b5('0x10')](_0x523083,_0x563fdc)['then'](function(_0x5a5eea){logger[_0xc4b5('0x11')](_0xc4b5('0x12'),_0x48dae1,_0xc4b5('0x13'));logger[_0xc4b5('0x14')](_0xc4b5('0x15'),_0x48dae1,_0xc4b5('0x13'),JSON[_0xc4b5('0x16')](_0x5a5eea));if(_0x5a5eea[_0xc4b5('0x17')]){if(_0x5a5eea[_0xc4b5('0x17')][_0xc4b5('0x18')]===0x1f4){logger[_0xc4b5('0x17')](_0xc4b5('0x12'),_0x48dae1,_0x5a5eea[_0xc4b5('0x17')][_0xc4b5('0x19')]);return _0x10cb07(_0x5a5eea[_0xc4b5('0x17')]['message']);}logger[_0xc4b5('0x17')](_0xc4b5('0x12'),_0x48dae1,_0x5a5eea[_0xc4b5('0x17')][_0xc4b5('0x19')]);return _0x47a6d5(_0x5a5eea[_0xc4b5('0x17')]['message']);}else{logger['info']('Team,\x20%s,\x20%s',_0x48dae1,'request\x20sent');_0x47a6d5(_0x5a5eea['result']['message']);}})[_0xc4b5('0x1a')](function(_0x239931){logger[_0xc4b5('0x17')](_0xc4b5('0x12'),_0x48dae1,_0x239931);_0x10cb07(_0x239931);});});} \ No newline at end of file +var _0x701f=['debug','Team,\x20%s,\x20%s,\x20%s','error','code','message','Team,\x20%s,\x20%s','result','catch','lodash','moment','bluebird','ioredis','../../config/utils','rpc','../../config/environment','client','http','redis','defaults','localhost','socket.io-emitter','./team.socket','register','request','info','request\x20sent'];(function(_0x12bff2,_0x1ae209){var _0x1153d5=function(_0x523225){while(--_0x523225){_0x12bff2['push'](_0x12bff2['shift']());}};_0x1153d5(++_0x1ae209);}(_0x701f,0xa4));var _0xf701=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x701f[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0xf701('0x0'));var util=require('util');var moment=require(_0xf701('0x1'));var BPromise=require(_0xf701('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xf701('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0xf701('0x4'));var logger=require('../../config/logger')(_0xf701('0x5'));var config=require(_0xf701('0x6'));var jayson=require('jayson/promise');var client=jayson[_0xf701('0x7')][_0xf701('0x8')]({'port':0x232a});config[_0xf701('0x9')]=_[_0xf701('0xa')](config['redis'],{'host':_0xf701('0xb'),'port':0x18eb});var socket=require(_0xf701('0xc'))(new Redis(config[_0xf701('0x9')]));require(_0xf701('0xd'))[_0xf701('0xe')](socket);function respondWithRpcPromise(_0x25aca8,_0x420d05,_0x5495e6){return new BPromise(function(_0x29e235,_0x44cac3){return client[_0xf701('0xf')](_0x25aca8,_0x5495e6)['then'](function(_0x1b5289){logger[_0xf701('0x10')]('Team,\x20%s,\x20%s',_0x420d05,_0xf701('0x11'));logger[_0xf701('0x12')](_0xf701('0x13'),_0x420d05,'request\x20sent',JSON['stringify'](_0x1b5289));if(_0x1b5289[_0xf701('0x14')]){if(_0x1b5289[_0xf701('0x14')][_0xf701('0x15')]===0x1f4){logger[_0xf701('0x14')]('Team,\x20%s,\x20%s',_0x420d05,_0x1b5289[_0xf701('0x14')][_0xf701('0x16')]);return _0x44cac3(_0x1b5289['error'][_0xf701('0x16')]);}logger[_0xf701('0x14')](_0xf701('0x17'),_0x420d05,_0x1b5289[_0xf701('0x14')][_0xf701('0x16')]);return _0x29e235(_0x1b5289[_0xf701('0x14')]['message']);}else{logger['info'](_0xf701('0x17'),_0x420d05,_0xf701('0x11'));_0x29e235(_0x1b5289[_0xf701('0x18')]['message']);}})[_0xf701('0x19')](function(_0x52cbbb){logger['error']('Team,\x20%s,\x20%s',_0x420d05,_0x52cbbb);_0x44cac3(_0x52cbbb);});});} \ No newline at end of file diff --git a/server/api/team/team.socket.js b/server/api/team/team.socket.js index 7b4561b..29e54f9 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 _0xb296=['register','length','./team.events','save','remove','update','removeListener'];(function(_0x3c21d1,_0x2f12f7){var _0x1847d4=function(_0x1f33dd){while(--_0x1f33dd){_0x3c21d1['push'](_0x3c21d1['shift']());}};_0x1847d4(++_0x2f12f7);}(_0xb296,0xa3));var _0x6b29=function(_0x2f7fa4,_0xa76bcb){_0x2f7fa4=_0x2f7fa4-0x0;var _0x89fcf3=_0xb296[_0x2f7fa4];return _0x89fcf3;};'use strict';var TeamEvents=require(_0x6b29('0x0'));var events=[_0x6b29('0x1'),_0x6b29('0x2'),_0x6b29('0x3')];function createListener(_0x2e0ea3,_0x20b375){return function(_0x2c502e){_0x20b375['emit'](_0x2e0ea3,_0x2c502e);};}function removeListener(_0x3ff65c,_0x5c1cf5){return function(){TeamEvents[_0x6b29('0x4')](_0x3ff65c,_0x5c1cf5);};}exports[_0x6b29('0x5')]=function(_0x5e0aa1){for(var _0x327329=0x0,_0xf1b5ac=events[_0x6b29('0x6')];_0x327329<_0xf1b5ac;_0x327329++){var _0x1c506f=events[_0x327329];var _0x12bcae=createListener('team:'+_0x1c506f,_0x5e0aa1);TeamEvents['on'](_0x1c506f,_0x12bcae);}}; \ No newline at end of file +var _0xdced=['save','remove','update','removeListener','register','length','team:'];(function(_0x1e7bdd,_0x216b81){var _0xcd343d=function(_0x5203cd){while(--_0x5203cd){_0x1e7bdd['push'](_0x1e7bdd['shift']());}};_0xcd343d(++_0x216b81);}(_0xdced,0xcb));var _0xddce=function(_0x44f4b9,_0x416a6f){_0x44f4b9=_0x44f4b9-0x0;var _0x34a656=_0xdced[_0x44f4b9];return _0x34a656;};'use strict';var TeamEvents=require('./team.events');var events=[_0xddce('0x0'),_0xddce('0x1'),_0xddce('0x2')];function createListener(_0x3d775a,_0x7e2315){return function(_0x1a747d){_0x7e2315['emit'](_0x3d775a,_0x1a747d);};}function removeListener(_0x1c3f2a,_0x509b66){return function(){TeamEvents[_0xddce('0x3')](_0x1c3f2a,_0x509b66);};}exports[_0xddce('0x4')]=function(_0x541f99){for(var _0x31c76b=0x0,_0x57e11c=events[_0xddce('0x5')];_0x31c76b<_0x57e11c;_0x31c76b++){var _0x46b464=events[_0x31c76b];var _0x272a2c=createListener(_0xddce('0x6')+_0x46b464,_0x541f99);TeamEvents['on'](_0x46b464,_0x272a2c);}}; \ No newline at end of file diff --git a/server/api/template/index.js b/server/api/template/index.js index 1895a40..210587c 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 _0xfd61=['index','create','put','/:id','update','destroy','exports','multer','path','connect-timeout','express','../../components/auth/service','../../config/environment','get','isAuthenticated'];(function(_0x2641f9,_0x26715f){var _0x585741=function(_0x2d1462){while(--_0x2d1462){_0x2641f9['push'](_0x2641f9['shift']());}};_0x585741(++_0x26715f);}(_0xfd61,0x17e));var _0x1fd6=function(_0x5f15a3,_0x504b4b){_0x5f15a3=_0x5f15a3-0x0;var _0x3afa59=_0xfd61[_0x5f15a3];return _0x3afa59;};'use strict';var multer=require(_0x1fd6('0x0'));var util=require('util');var path=require(_0x1fd6('0x1'));var timeout=require(_0x1fd6('0x2'));var express=require(_0x1fd6('0x3'));var router=express['Router']();var auth=require(_0x1fd6('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0x1fd6('0x5'));var controller=require('./template.controller');router[_0x1fd6('0x6')]('/',auth[_0x1fd6('0x7')](),controller[_0x1fd6('0x8')]);router['get']('/:id',auth[_0x1fd6('0x7')](),controller['show']);router['post']('/',auth[_0x1fd6('0x7')](),controller[_0x1fd6('0x9')]);router[_0x1fd6('0xa')](_0x1fd6('0xb'),auth[_0x1fd6('0x7')](),controller[_0x1fd6('0xc')]);router['delete'](_0x1fd6('0xb'),auth[_0x1fd6('0x7')](),controller[_0x1fd6('0xd')]);module[_0x1fd6('0xe')]=router; \ No newline at end of file +var _0xffdf=['get','/:id','post','create','put','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','isAuthenticated'];(function(_0xb55c0f,_0xcd52c9){var _0x582489=function(_0x4cb980){while(--_0x4cb980){_0xb55c0f['push'](_0xb55c0f['shift']());}};_0x582489(++_0xcd52c9);}(_0xffdf,0x1e4));var _0xfffd=function(_0x229428,_0x2f23d7){_0x229428=_0x229428-0x0;var _0x162ac9=_0xffdf[_0x229428];return _0x162ac9;};'use strict';var multer=require(_0xfffd('0x0'));var util=require(_0xfffd('0x1'));var path=require(_0xfffd('0x2'));var timeout=require(_0xfffd('0x3'));var express=require(_0xfffd('0x4'));var router=express[_0xfffd('0x5')]();var auth=require(_0xfffd('0x6'));var interaction=require(_0xfffd('0x7'));var config=require('../../config/environment');var controller=require('./template.controller');router['get']('/',auth[_0xfffd('0x8')](),controller['index']);router[_0xfffd('0x9')](_0xfffd('0xa'),auth[_0xfffd('0x8')](),controller['show']);router[_0xfffd('0xb')]('/',auth['isAuthenticated'](),controller[_0xfffd('0xc')]);router[_0xfffd('0xd')]('/:id',auth[_0xfffd('0x8')](),controller['update']);router[_0xfffd('0xe')](_0xfffd('0xa'),auth[_0xfffd('0x8')](),controller[_0xfffd('0xf')]);module[_0xfffd('0x10')]=router; \ No newline at end of file diff --git a/server/api/template/template.attributes.js b/server/api/template/template.attributes.js index 57c17e2..46fa9dd 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 _0xcf9d=['TEXT','exports','STRING'];(function(_0x5a0190,_0xca40ee){var _0x42b523=function(_0x4e4510){while(--_0x4e4510){_0x5a0190['push'](_0x5a0190['shift']());}};_0x42b523(++_0xca40ee);}(_0xcf9d,0x1ae));var _0xdcf9=function(_0x2d0ac7,_0x46908d){_0x2d0ac7=_0x2d0ac7-0x0;var _0xda20f2=_0xcf9d[_0x2d0ac7];return _0xda20f2;};'use strict';var Sequelize=require('sequelize');module[_0xdcf9('0x0')]={'name':{'type':Sequelize[_0xdcf9('0x1')]},'description':{'type':Sequelize[_0xdcf9('0x1')]},'html':{'type':Sequelize[_0xdcf9('0x2')]}}; \ No newline at end of file +var _0x8e8d=['STRING','exports'];(function(_0x36a3a6,_0x51ed54){var _0x24311b=function(_0x34df4c){while(--_0x34df4c){_0x36a3a6['push'](_0x36a3a6['shift']());}};_0x24311b(++_0x51ed54);}(_0x8e8d,0x1c7));var _0xd8e8=function(_0x2c16a7,_0x52cf2e){_0x2c16a7=_0x2c16a7-0x0;var _0x549c02=_0x8e8d[_0x2c16a7];return _0x549c02;};'use strict';var Sequelize=require('sequelize');module[_0xd8e8('0x0')]={'name':{'type':Sequelize[_0xd8e8('0x1')]},'description':{'type':Sequelize['STRING']},'html':{'type':Sequelize['TEXT']}}; \ No newline at end of file diff --git a/server/api/template/template.controller.js b/server/api/template/template.controller.js index d2f7a47..b1873e7 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 _0x53ff=['sort','filter','merge','VIRTUAL','options','where','includeAll','include','Template','findAll','rows','show','params','find','catch','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','autoAssociation','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','to-csv','ejs','lodash','squel','crypto','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','api','../../config/utils','../../config/environment','sendStatus','status','end','json','count','offset','limit','set','Content-Range','reject','save','update','destroy','then','get','Templates','UserProfileResource','stack','name','send','index','map','rawAttributes','fieldName','model','query','keys','filters','intersection','attributes','fields','length','nolimit','order'];(function(_0x112514,_0x5c40eb){var _0x6ea52e=function(_0x38c78b){while(--_0x38c78b){_0x112514['push'](_0x112514['shift']());}};_0x6ea52e(++_0x5c40eb);}(_0x53ff,0x157));var _0xf53f=function(_0x187e82,_0x5254eb){_0x187e82=_0x187e82-0x0;var _0x58625e=_0x53ff[_0x187e82];return _0x58625e;};'use strict';var pdf=require(_0xf53f('0x0'));var emlformat=require(_0xf53f('0x1'));var rimraf=require(_0xf53f('0x2'));var zipdir=require(_0xf53f('0x3'));var jsonpatch=require(_0xf53f('0x4'));var rp=require(_0xf53f('0x5'));var moment=require(_0xf53f('0x6'));var BPromise=require(_0xf53f('0x7'));var Mustache=require(_0xf53f('0x8'));var util=require('util');var path=require(_0xf53f('0x9'));var sox=require('sox');var csv=require(_0xf53f('0xa'));var ejs=require(_0xf53f('0xb'));var fs=require('fs');var _=require(_0xf53f('0xc'));var squel=require(_0xf53f('0xd'));var crypto=require(_0xf53f('0xe'));var jsforce=require('jsforce');var deskjs=require(_0xf53f('0xf'));var toCsv=require(_0xf53f('0xa'));var querystring=require('querystring');var Papa=require(_0xf53f('0x10'));var Redis=require(_0xf53f('0x11'));var authService=require(_0xf53f('0x12'));var qs=require(_0xf53f('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0xf53f('0x14'));var utils=require(_0xf53f('0x15'));var config=require(_0xf53f('0x16'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x9a8bc9,_0x324b33){_0x324b33=_0x324b33||0xcc;return function(_0x45f46b){if(_0x45f46b){return _0x9a8bc9[_0xf53f('0x17')](_0x324b33);}return _0x9a8bc9[_0xf53f('0x18')](_0x324b33)[_0xf53f('0x19')]();};}function respondWithResult(_0x4c5120,_0x3111ee){_0x3111ee=_0x3111ee||0xc8;return function(_0x38b091){if(_0x38b091){return _0x4c5120['status'](_0x3111ee)[_0xf53f('0x1a')](_0x38b091);}};}function respondWithFilteredResult(_0x1b7b7d,_0x483ee2){return function(_0x461092){if(_0x461092){var _0x4e60a2=_0x461092[_0xf53f('0x1b')],_0x167442=_0x483ee2[_0xf53f('0x1c')],_0x3fed56=_0x483ee2[_0xf53f('0x1c')]+_0x483ee2[_0xf53f('0x1d')],_0x574185;if(_0x3fed56>=_0x4e60a2){_0x3fed56=_0x4e60a2;_0x574185=0xc8;}else{_0x574185=0xce;}_0x1b7b7d['status'](_0x574185);return _0x1b7b7d[_0xf53f('0x1e')](_0xf53f('0x1f'),_0x167442+'-'+_0x3fed56+'/'+_0x4e60a2)[_0xf53f('0x1a')](_0x461092);}return null;};}function patchUpdates(_0x2f1411){return function(_0x42d387){try{jsonpatch['apply'](_0x42d387,_0x2f1411,!![]);}catch(_0x1c25d7){return BPromise[_0xf53f('0x20')](_0x1c25d7);}return _0x42d387[_0xf53f('0x21')]();};}function saveUpdates(_0x5c47e3,_0x505506){return function(_0x399104){if(_0x399104){return _0x399104[_0xf53f('0x22')](_0x5c47e3)['then'](function(_0x3d9bee){return _0x3d9bee;});}return null;};}function removeEntity(_0x5554bc,_0x13e230){return function(_0x452c7b){if(_0x452c7b){return _0x452c7b[_0xf53f('0x23')]()[_0xf53f('0x24')](function(){var _0x1d0463=_0x452c7b[_0xf53f('0x25')]({'plain':!![]});var _0xf6d8d3=_0xf53f('0x26');return db[_0xf53f('0x27')][_0xf53f('0x23')]({'where':{'type':_0xf6d8d3,'resourceId':_0x1d0463['id']}})[_0xf53f('0x24')](function(){return _0x452c7b;});})[_0xf53f('0x24')](function(){_0x5554bc[_0xf53f('0x18')](0xcc)['end']();});}};}function handleEntityNotFound(_0x1ebe1e,_0x30da88){return function(_0x320c89){if(!_0x320c89){_0x1ebe1e['sendStatus'](0x194);}return _0x320c89;};}function handleError(_0x869ba8,_0x4eb980){_0x4eb980=_0x4eb980||0x1f4;return function(_0x1f9cb2){logger['error'](_0x1f9cb2[_0xf53f('0x28')]);if(_0x1f9cb2[_0xf53f('0x29')]){delete _0x1f9cb2['name'];}_0x869ba8[_0xf53f('0x18')](_0x4eb980)[_0xf53f('0x2a')](_0x1f9cb2);};}exports[_0xf53f('0x2b')]=function(_0x43b5b0,_0x496981){var _0x1361b4={},_0x155bec={},_0xb0f73f={'count':0x0,'rows':[]};var _0x4059c3=_[_0xf53f('0x2c')](db['Template'][_0xf53f('0x2d')],function(_0xc36b68){return{'name':_0xc36b68[_0xf53f('0x2e')],'type':_0xc36b68['type']['key']};});_0x155bec[_0xf53f('0x2f')]=_[_0xf53f('0x2c')](_0x4059c3,_0xf53f('0x29'));_0x155bec[_0xf53f('0x30')]=_[_0xf53f('0x31')](_0x43b5b0[_0xf53f('0x30')]);_0x155bec[_0xf53f('0x32')]=_[_0xf53f('0x33')](_0x155bec[_0xf53f('0x2f')],_0x155bec['query']);_0x1361b4[_0xf53f('0x34')]=_[_0xf53f('0x33')](_0x155bec[_0xf53f('0x2f')],qs[_0xf53f('0x35')](_0x43b5b0[_0xf53f('0x30')][_0xf53f('0x35')]));_0x1361b4['attributes']=_0x1361b4[_0xf53f('0x34')][_0xf53f('0x36')]?_0x1361b4[_0xf53f('0x34')]:_0x155bec[_0xf53f('0x2f')];if(!_0x43b5b0[_0xf53f('0x30')]['hasOwnProperty'](_0xf53f('0x37'))){_0x1361b4[_0xf53f('0x1d')]=qs[_0xf53f('0x1d')](_0x43b5b0[_0xf53f('0x30')]['limit']);_0x1361b4[_0xf53f('0x1c')]=qs[_0xf53f('0x1c')](_0x43b5b0[_0xf53f('0x30')]['offset']);}_0x1361b4[_0xf53f('0x38')]=qs[_0xf53f('0x39')](_0x43b5b0['query']['sort']);_0x1361b4['where']=qs['filters'](_['pick'](_0x43b5b0[_0xf53f('0x30')],_0x155bec[_0xf53f('0x32')]));if(_0x43b5b0[_0xf53f('0x30')][_0xf53f('0x3a')]){_0x1361b4['where']=_[_0xf53f('0x3b')](_0x1361b4['where'],{'$or':_[_0xf53f('0x2c')](_0x4059c3,function(_0x50d3b1){if(_0x50d3b1['type']!==_0xf53f('0x3c')){var _0x34f6b2={};_0x34f6b2[_0x50d3b1[_0xf53f('0x29')]]={'$like':'%'+_0x43b5b0[_0xf53f('0x30')][_0xf53f('0x3a')]+'%'};return _0x34f6b2;}})});}_0x1361b4=_[_0xf53f('0x3b')]({},_0x1361b4,_0x43b5b0[_0xf53f('0x3d')]);var _0x4be894={'where':_0x1361b4[_0xf53f('0x3e')]};return db['Template'][_0xf53f('0x1b')](_0x4be894)['then'](function(_0x222c72){_0xb0f73f['count']=_0x222c72;if(_0x43b5b0[_0xf53f('0x30')][_0xf53f('0x3f')]){_0x1361b4[_0xf53f('0x40')]=[{'all':!![]}];}return db[_0xf53f('0x41')][_0xf53f('0x42')](_0x1361b4);})[_0xf53f('0x24')](function(_0x1e249b){_0xb0f73f[_0xf53f('0x43')]=_0x1e249b;return _0xb0f73f;})[_0xf53f('0x24')](respondWithFilteredResult(_0x496981,_0x1361b4))['catch'](handleError(_0x496981,null));};exports[_0xf53f('0x44')]=function(_0x448fe8,_0x1b8d4e){var _0x3306ad={'raw':!![],'where':{'id':_0x448fe8[_0xf53f('0x45')]['id']}},_0x2b19b7={};_0x2b19b7['model']=_[_0xf53f('0x31')](db[_0xf53f('0x41')][_0xf53f('0x2d')]);_0x2b19b7[_0xf53f('0x30')]=_[_0xf53f('0x31')](_0x448fe8[_0xf53f('0x30')]);_0x2b19b7[_0xf53f('0x32')]=_[_0xf53f('0x33')](_0x2b19b7['model'],_0x2b19b7[_0xf53f('0x30')]);_0x3306ad[_0xf53f('0x34')]=_[_0xf53f('0x33')](_0x2b19b7[_0xf53f('0x2f')],qs[_0xf53f('0x35')](_0x448fe8[_0xf53f('0x30')][_0xf53f('0x35')]));_0x3306ad['attributes']=_0x3306ad[_0xf53f('0x34')][_0xf53f('0x36')]?_0x3306ad[_0xf53f('0x34')]:_0x2b19b7[_0xf53f('0x2f')];if(_0x448fe8['query'][_0xf53f('0x3f')]){_0x3306ad[_0xf53f('0x40')]=[{'all':!![]}];}_0x3306ad=_['merge']({},_0x3306ad,_0x448fe8['options']);return db['Template'][_0xf53f('0x46')](_0x3306ad)['then'](handleEntityNotFound(_0x1b8d4e,null))[_0xf53f('0x24')](respondWithResult(_0x1b8d4e,null))[_0xf53f('0x47')](handleError(_0x1b8d4e,null));};exports[_0xf53f('0x48')]=function(_0x508ce3,_0x4e9118){return db[_0xf53f('0x41')][_0xf53f('0x48')](_0x508ce3[_0xf53f('0x49')],{})[_0xf53f('0x24')](function(_0xcf3010){var _0x15d72c=_0x508ce3[_0xf53f('0x4a')][_0xf53f('0x25')]({'plain':!![]});if(!_0x15d72c)throw new Error(_0xf53f('0x4b'));if(_0x15d72c[_0xf53f('0x4c')]===_0xf53f('0x4a')){var _0x455328=_0xcf3010['get']({'plain':!![]});var _0x475f54=_0xf53f('0x26');return db['UserProfileSection']['find']({'where':{'name':_0x475f54,'userProfileId':_0x15d72c['userProfileId']},'raw':!![]})[_0xf53f('0x24')](function(_0x5e0925){if(_0x5e0925&&_0x5e0925[_0xf53f('0x4d')]===0x0){return db[_0xf53f('0x27')][_0xf53f('0x48')]({'name':_0x455328['name'],'resourceId':_0x455328['id'],'type':_0x5e0925[_0xf53f('0x29')],'sectionId':_0x5e0925['id']},{})[_0xf53f('0x24')](function(){return _0xcf3010;});}else{return _0xcf3010;}})[_0xf53f('0x47')](function(_0x57fff3){logger[_0xf53f('0x4e')](_0xf53f('0x4f'),_0x57fff3);throw _0x57fff3;});}return _0xcf3010;})[_0xf53f('0x24')](respondWithResult(_0x4e9118,0xc9))[_0xf53f('0x47')](handleError(_0x4e9118,null));};exports['update']=function(_0x2951b1,_0x294a26){if(_0x2951b1['body']['id']){delete _0x2951b1['body']['id'];}return db[_0xf53f('0x41')][_0xf53f('0x46')]({'where':{'id':_0x2951b1[_0xf53f('0x45')]['id']}})[_0xf53f('0x24')](handleEntityNotFound(_0x294a26,null))[_0xf53f('0x24')](saveUpdates(_0x2951b1['body'],null))['then'](respondWithResult(_0x294a26,null))[_0xf53f('0x47')](handleError(_0x294a26,null));};exports[_0xf53f('0x23')]=function(_0x55f6f6,_0x3eb58e){return db[_0xf53f('0x41')][_0xf53f('0x46')]({'where':{'id':_0x55f6f6[_0xf53f('0x45')]['id']}})[_0xf53f('0x24')](handleEntityNotFound(_0x3eb58e,null))[_0xf53f('0x24')](removeEntity(_0x3eb58e,null))[_0xf53f('0x47')](handleError(_0x3eb58e,null));}; \ No newline at end of file +var _0xc87d=['jsforce','desk.js','querystring','../../components/auth/service','../../config/license/hardware','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','offset','limit','status','set','Content-Range','reject','save','then','destroy','get','Templates','end','error','stack','name','send','index','map','Template','fieldName','key','query','keys','filters','intersection','model','fields','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','type','VIRTUAL','options','count','includeAll','include','findAll','rows','show','params','rawAttributes','attributes','find','catch','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','userProfileId','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','html-pdf','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','util','sox','to-csv','ejs','lodash','squel','crypto'];(function(_0x53199f,_0x1dac3a){var _0x1f9609=function(_0x452065){while(--_0x452065){_0x53199f['push'](_0x53199f['shift']());}};_0x1f9609(++_0x1dac3a);}(_0xc87d,0xeb));var _0xdc87=function(_0x26dd05,_0x135f80){_0x26dd05=_0x26dd05-0x0;var _0x5da547=_0xc87d[_0x26dd05];return _0x5da547;};'use strict';var pdf=require(_0xdc87('0x0'));var emlformat=require(_0xdc87('0x1'));var rimraf=require(_0xdc87('0x2'));var zipdir=require(_0xdc87('0x3'));var jsonpatch=require('fast-json-patch');var rp=require(_0xdc87('0x4'));var moment=require(_0xdc87('0x5'));var BPromise=require(_0xdc87('0x6'));var Mustache=require('mustache');var util=require(_0xdc87('0x7'));var path=require('path');var sox=require(_0xdc87('0x8'));var csv=require(_0xdc87('0x9'));var ejs=require(_0xdc87('0xa'));var fs=require('fs');var _=require(_0xdc87('0xb'));var squel=require(_0xdc87('0xc'));var crypto=require(_0xdc87('0xd'));var jsforce=require(_0xdc87('0xe'));var deskjs=require(_0xdc87('0xf'));var toCsv=require(_0xdc87('0x9'));var querystring=require(_0xdc87('0x10'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0xdc87('0x11'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xdc87('0x12'));var logger=require('../../config/logger')(_0xdc87('0x13'));var utils=require(_0xdc87('0x14'));var config=require(_0xdc87('0x15'));var db=require(_0xdc87('0x16'))['db'];function respondWithStatusCode(_0x561674,_0x4d273f){_0x4d273f=_0x4d273f||0xcc;return function(_0x1688e6){if(_0x1688e6){return _0x561674[_0xdc87('0x17')](_0x4d273f);}return _0x561674['status'](_0x4d273f)['end']();};}function respondWithResult(_0x44aaca,_0x508260){_0x508260=_0x508260||0xc8;return function(_0x319dc3){if(_0x319dc3){return _0x44aaca['status'](_0x508260)['json'](_0x319dc3);}};}function respondWithFilteredResult(_0x3b6b5d,_0xdc226e){return function(_0x2fbbb2){if(_0x2fbbb2){var _0x168cd4=_0x2fbbb2['count'],_0x504d37=_0xdc226e[_0xdc87('0x18')],_0x262893=_0xdc226e['offset']+_0xdc226e[_0xdc87('0x19')],_0x244876;if(_0x262893>=_0x168cd4){_0x262893=_0x168cd4;_0x244876=0xc8;}else{_0x244876=0xce;}_0x3b6b5d[_0xdc87('0x1a')](_0x244876);return _0x3b6b5d[_0xdc87('0x1b')](_0xdc87('0x1c'),_0x504d37+'-'+_0x262893+'/'+_0x168cd4)['json'](_0x2fbbb2);}return null;};}function patchUpdates(_0x34667d){return function(_0x5164d8){try{jsonpatch['apply'](_0x5164d8,_0x34667d,!![]);}catch(_0x2eaf7d){return BPromise[_0xdc87('0x1d')](_0x2eaf7d);}return _0x5164d8[_0xdc87('0x1e')]();};}function saveUpdates(_0x154478,_0x322912){return function(_0x364359){if(_0x364359){return _0x364359['update'](_0x154478)[_0xdc87('0x1f')](function(_0x5b9749){return _0x5b9749;});}return null;};}function removeEntity(_0x4e072c,_0x1af59d){return function(_0x458e54){if(_0x458e54){return _0x458e54[_0xdc87('0x20')]()[_0xdc87('0x1f')](function(){var _0x23c881=_0x458e54[_0xdc87('0x21')]({'plain':!![]});var _0x4e5c80=_0xdc87('0x22');return db['UserProfileResource']['destroy']({'where':{'type':_0x4e5c80,'resourceId':_0x23c881['id']}})[_0xdc87('0x1f')](function(){return _0x458e54;});})[_0xdc87('0x1f')](function(){_0x4e072c['status'](0xcc)[_0xdc87('0x23')]();});}};}function handleEntityNotFound(_0x56f27b,_0xed8cf7){return function(_0x481ae5){if(!_0x481ae5){_0x56f27b[_0xdc87('0x17')](0x194);}return _0x481ae5;};}function handleError(_0x5d34ec,_0x4f918c){_0x4f918c=_0x4f918c||0x1f4;return function(_0x3439c8){logger[_0xdc87('0x24')](_0x3439c8[_0xdc87('0x25')]);if(_0x3439c8[_0xdc87('0x26')]){delete _0x3439c8[_0xdc87('0x26')];}_0x5d34ec[_0xdc87('0x1a')](_0x4f918c)[_0xdc87('0x27')](_0x3439c8);};}exports[_0xdc87('0x28')]=function(_0x4774a0,_0x3b29ba){var _0xfa4e90={},_0x3451a1={},_0xdad067={'count':0x0,'rows':[]};var _0x203c91=_[_0xdc87('0x29')](db[_0xdc87('0x2a')]['rawAttributes'],function(_0x5c5e0c){return{'name':_0x5c5e0c[_0xdc87('0x2b')],'type':_0x5c5e0c['type'][_0xdc87('0x2c')]};});_0x3451a1['model']=_[_0xdc87('0x29')](_0x203c91,_0xdc87('0x26'));_0x3451a1[_0xdc87('0x2d')]=_[_0xdc87('0x2e')](_0x4774a0[_0xdc87('0x2d')]);_0x3451a1[_0xdc87('0x2f')]=_[_0xdc87('0x30')](_0x3451a1[_0xdc87('0x31')],_0x3451a1['query']);_0xfa4e90['attributes']=_[_0xdc87('0x30')](_0x3451a1[_0xdc87('0x31')],qs[_0xdc87('0x32')](_0x4774a0[_0xdc87('0x2d')][_0xdc87('0x32')]));_0xfa4e90['attributes']=_0xfa4e90['attributes']['length']?_0xfa4e90['attributes']:_0x3451a1[_0xdc87('0x31')];if(!_0x4774a0[_0xdc87('0x2d')][_0xdc87('0x33')](_0xdc87('0x34'))){_0xfa4e90[_0xdc87('0x19')]=qs[_0xdc87('0x19')](_0x4774a0[_0xdc87('0x2d')][_0xdc87('0x19')]);_0xfa4e90[_0xdc87('0x18')]=qs['offset'](_0x4774a0[_0xdc87('0x2d')][_0xdc87('0x18')]);}_0xfa4e90[_0xdc87('0x35')]=qs['sort'](_0x4774a0['query'][_0xdc87('0x36')]);_0xfa4e90[_0xdc87('0x37')]=qs[_0xdc87('0x2f')](_[_0xdc87('0x38')](_0x4774a0[_0xdc87('0x2d')],_0x3451a1[_0xdc87('0x2f')]));if(_0x4774a0[_0xdc87('0x2d')][_0xdc87('0x39')]){_0xfa4e90[_0xdc87('0x37')]=_[_0xdc87('0x3a')](_0xfa4e90[_0xdc87('0x37')],{'$or':_[_0xdc87('0x29')](_0x203c91,function(_0xbe0b71){if(_0xbe0b71[_0xdc87('0x3b')]!==_0xdc87('0x3c')){var _0x5cd694={};_0x5cd694[_0xbe0b71[_0xdc87('0x26')]]={'$like':'%'+_0x4774a0[_0xdc87('0x2d')][_0xdc87('0x39')]+'%'};return _0x5cd694;}})});}_0xfa4e90=_[_0xdc87('0x3a')]({},_0xfa4e90,_0x4774a0[_0xdc87('0x3d')]);var _0x1d899a={'where':_0xfa4e90[_0xdc87('0x37')]};return db[_0xdc87('0x2a')][_0xdc87('0x3e')](_0x1d899a)[_0xdc87('0x1f')](function(_0x41600b){_0xdad067[_0xdc87('0x3e')]=_0x41600b;if(_0x4774a0[_0xdc87('0x2d')][_0xdc87('0x3f')]){_0xfa4e90[_0xdc87('0x40')]=[{'all':!![]}];}return db[_0xdc87('0x2a')][_0xdc87('0x41')](_0xfa4e90);})['then'](function(_0x425836){_0xdad067[_0xdc87('0x42')]=_0x425836;return _0xdad067;})[_0xdc87('0x1f')](respondWithFilteredResult(_0x3b29ba,_0xfa4e90))['catch'](handleError(_0x3b29ba,null));};exports[_0xdc87('0x43')]=function(_0x2695ee,_0x1c2216){var _0x4dc2e9={'raw':!![],'where':{'id':_0x2695ee[_0xdc87('0x44')]['id']}},_0x4a792d={};_0x4a792d[_0xdc87('0x31')]=_[_0xdc87('0x2e')](db[_0xdc87('0x2a')][_0xdc87('0x45')]);_0x4a792d[_0xdc87('0x2d')]=_[_0xdc87('0x2e')](_0x2695ee[_0xdc87('0x2d')]);_0x4a792d[_0xdc87('0x2f')]=_[_0xdc87('0x30')](_0x4a792d[_0xdc87('0x31')],_0x4a792d[_0xdc87('0x2d')]);_0x4dc2e9[_0xdc87('0x46')]=_[_0xdc87('0x30')](_0x4a792d[_0xdc87('0x31')],qs[_0xdc87('0x32')](_0x2695ee['query']['fields']));_0x4dc2e9[_0xdc87('0x46')]=_0x4dc2e9[_0xdc87('0x46')]['length']?_0x4dc2e9[_0xdc87('0x46')]:_0x4a792d[_0xdc87('0x31')];if(_0x2695ee[_0xdc87('0x2d')][_0xdc87('0x3f')]){_0x4dc2e9[_0xdc87('0x40')]=[{'all':!![]}];}_0x4dc2e9=_[_0xdc87('0x3a')]({},_0x4dc2e9,_0x2695ee[_0xdc87('0x3d')]);return db['Template'][_0xdc87('0x47')](_0x4dc2e9)[_0xdc87('0x1f')](handleEntityNotFound(_0x1c2216,null))['then'](respondWithResult(_0x1c2216,null))[_0xdc87('0x48')](handleError(_0x1c2216,null));};exports[_0xdc87('0x49')]=function(_0x2c5695,_0x459a64){return db[_0xdc87('0x2a')]['create'](_0x2c5695[_0xdc87('0x4a')],{})[_0xdc87('0x1f')](function(_0x394665){var _0x1ce019=_0x2c5695[_0xdc87('0x4b')][_0xdc87('0x21')]({'plain':!![]});if(!_0x1ce019)throw new Error(_0xdc87('0x4c'));if(_0x1ce019[_0xdc87('0x4d')]===_0xdc87('0x4b')){var _0x298ce3=_0x394665[_0xdc87('0x21')]({'plain':!![]});var _0xfbe397=_0xdc87('0x22');return db['UserProfileSection'][_0xdc87('0x47')]({'where':{'name':_0xfbe397,'userProfileId':_0x1ce019[_0xdc87('0x4e')]},'raw':!![]})['then'](function(_0x4aa1df){if(_0x4aa1df&&_0x4aa1df[_0xdc87('0x4f')]===0x0){return db[_0xdc87('0x50')][_0xdc87('0x49')]({'name':_0x298ce3[_0xdc87('0x26')],'resourceId':_0x298ce3['id'],'type':_0x4aa1df[_0xdc87('0x26')],'sectionId':_0x4aa1df['id']},{})[_0xdc87('0x1f')](function(){return _0x394665;});}else{return _0x394665;}})[_0xdc87('0x48')](function(_0x142bdd){logger[_0xdc87('0x24')](_0xdc87('0x51'),_0x142bdd);throw _0x142bdd;});}return _0x394665;})['then'](respondWithResult(_0x459a64,0xc9))[_0xdc87('0x48')](handleError(_0x459a64,null));};exports[_0xdc87('0x52')]=function(_0x1ce4f6,_0x12af76){if(_0x1ce4f6[_0xdc87('0x4a')]['id']){delete _0x1ce4f6[_0xdc87('0x4a')]['id'];}return db[_0xdc87('0x2a')][_0xdc87('0x47')]({'where':{'id':_0x1ce4f6['params']['id']}})[_0xdc87('0x1f')](handleEntityNotFound(_0x12af76,null))[_0xdc87('0x1f')](saveUpdates(_0x1ce4f6[_0xdc87('0x4a')],null))[_0xdc87('0x1f')](respondWithResult(_0x12af76,null))['catch'](handleError(_0x12af76,null));};exports[_0xdc87('0x20')]=function(_0x3e3d66,_0x3d01ec){return db[_0xdc87('0x2a')][_0xdc87('0x47')]({'where':{'id':_0x3e3d66[_0xdc87('0x44')]['id']}})[_0xdc87('0x1f')](handleEntityNotFound(_0x3d01ec,null))[_0xdc87('0x1f')](removeEntity(_0x3d01ec,null))[_0xdc87('0x48')](handleError(_0x3d01ec,null));}; \ No newline at end of file diff --git a/server/api/template/template.model.js b/server/api/template/template.model.js index 3c8f779..0a62ced 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 _0x73e6=['../../config/environment','./template.attributes','exports','Template','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf'];(function(_0x43cef0,_0x40a902){var _0x280b8e=function(_0x414d04){while(--_0x414d04){_0x43cef0['push'](_0x43cef0['shift']());}};_0x280b8e(++_0x40a902);}(_0x73e6,0x1f2));var _0x673e=function(_0x5ca308,_0x3dbae8){_0x5ca308=_0x5ca308-0x0;var _0x4e8c60=_0x73e6[_0x5ca308];return _0x4e8c60;};'use strict';var _=require(_0x673e('0x0'));var util=require(_0x673e('0x1'));var logger=require(_0x673e('0x2'))(_0x673e('0x3'));var moment=require(_0x673e('0x4'));var BPromise=require(_0x673e('0x5'));var rp=require(_0x673e('0x6'));var fs=require('fs');var path=require(_0x673e('0x7'));var rimraf=require(_0x673e('0x8'));var config=require(_0x673e('0x9'));var attributes=require(_0x673e('0xa'));module[_0x673e('0xb')]=function(_0x5d5161,_0x2e50fb){return _0x5d5161['define'](_0x673e('0xc'),attributes,{'tableName':'tools_templates','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x598e=['lodash','util','api','moment','bluebird','request-promise','../../config/environment','./template.attributes','define','Template','tools_templates'];(function(_0x3b17ac,_0x33c0f3){var _0x4e65ba=function(_0x1e7d63){while(--_0x1e7d63){_0x3b17ac['push'](_0x3b17ac['shift']());}};_0x4e65ba(++_0x33c0f3);}(_0x598e,0x6e));var _0xe598=function(_0x404052,_0x58013b){_0x404052=_0x404052-0x0;var _0x569bb8=_0x598e[_0x404052];return _0x569bb8;};'use strict';var _=require(_0xe598('0x0'));var util=require(_0xe598('0x1'));var logger=require('../../config/logger')(_0xe598('0x2'));var moment=require(_0xe598('0x3'));var BPromise=require(_0xe598('0x4'));var rp=require(_0xe598('0x5'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0xe598('0x6'));var attributes=require(_0xe598('0x7'));module['exports']=function(_0x3c189a,_0x4bbce0){return _0x3c189a[_0xe598('0x8')](_0xe598('0x9'),attributes,{'tableName':_0xe598('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 3ccaced..cbb780e 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 _0x854c=['message','result','catch','GetTemplate','Template','options','raw','attributes','limit','include','model','map','lodash','util','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request','then','info','request\x20sent','debug','Template,\x20%s,\x20%s,\x20%s','stringify','error','Template,\x20%s,\x20%s'];(function(_0x44c768,_0x552a5e){var _0x55daf5=function(_0x4958e8){while(--_0x4958e8){_0x44c768['push'](_0x44c768['shift']());}};_0x55daf5(++_0x552a5e);}(_0x854c,0xec));var _0xc854=function(_0x3207a4,_0x3866e6){_0x3207a4=_0x3207a4-0x0;var _0x7d772f=_0x854c[_0x3207a4];return _0x7d772f;};'use strict';var _=require(_0xc854('0x0'));var util=require(_0xc854('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0xc854('0x2'));var fs=require('fs');var Redis=require(_0xc854('0x3'));var db=require(_0xc854('0x4'))['db'];var utils=require(_0xc854('0x5'));var logger=require(_0xc854('0x6'))('rpc');var config=require(_0xc854('0x7'));var jayson=require(_0xc854('0x8'));var client=jayson[_0xc854('0x9')][_0xc854('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x35b501,_0xcd0bf1,_0x52e34c){return new BPromise(function(_0x1ca802,_0x2a16f6){return client[_0xc854('0xb')](_0x35b501,_0x52e34c)[_0xc854('0xc')](function(_0x4c25ae){logger[_0xc854('0xd')]('Template,\x20%s,\x20%s',_0xcd0bf1,_0xc854('0xe'));logger[_0xc854('0xf')](_0xc854('0x10'),_0xcd0bf1,'request\x20sent',JSON[_0xc854('0x11')](_0x4c25ae));if(_0x4c25ae[_0xc854('0x12')]){if(_0x4c25ae[_0xc854('0x12')]['code']===0x1f4){logger[_0xc854('0x12')](_0xc854('0x13'),_0xcd0bf1,_0x4c25ae['error'][_0xc854('0x14')]);return _0x2a16f6(_0x4c25ae[_0xc854('0x12')][_0xc854('0x14')]);}logger[_0xc854('0x12')](_0xc854('0x13'),_0xcd0bf1,_0x4c25ae['error'][_0xc854('0x14')]);return _0x1ca802(_0x4c25ae[_0xc854('0x12')][_0xc854('0x14')]);}else{logger['info'](_0xc854('0x13'),_0xcd0bf1,_0xc854('0xe'));_0x1ca802(_0x4c25ae[_0xc854('0x15')][_0xc854('0x14')]);}})[_0xc854('0x16')](function(_0x11c2ad){logger[_0xc854('0x12')](_0xc854('0x13'),_0xcd0bf1,_0x11c2ad);_0x2a16f6(_0x11c2ad);});});}exports[_0xc854('0x17')]=function(_0x29406d){var _0xf67ac8=this;return new Promise(function(_0x3c8246,_0x24fc92){return db[_0xc854('0x18')]['findAll']({'raw':_0x29406d[_0xc854('0x19')]?_0x29406d['options'][_0xc854('0x1a')]===undefined?!![]:![]:!![],'where':_0x29406d[_0xc854('0x19')]?_0x29406d[_0xc854('0x19')]['where']||null:null,'attributes':_0x29406d[_0xc854('0x19')]?_0x29406d[_0xc854('0x19')][_0xc854('0x1b')]||null:null,'limit':_0x29406d[_0xc854('0x19')]?_0x29406d['options'][_0xc854('0x1c')]||null:null,'include':_0x29406d[_0xc854('0x19')]?_0x29406d[_0xc854('0x19')][_0xc854('0x1d')]?_['map'](_0x29406d[_0xc854('0x19')][_0xc854('0x1d')],function(_0x4876ec){return{'model':db[_0x4876ec[_0xc854('0x1e')]],'as':_0x4876ec['as'],'attributes':_0x4876ec[_0xc854('0x1b')],'include':_0x4876ec[_0xc854('0x1d')]?_[_0xc854('0x1f')](_0x4876ec[_0xc854('0x1d')],function(_0x3c0971){return{'model':db[_0x3c0971[_0xc854('0x1e')]],'as':_0x3c0971['as'],'attributes':_0x3c0971[_0xc854('0x1b')],'include':_0x3c0971[_0xc854('0x1d')]?_[_0xc854('0x1f')](_0x3c0971[_0xc854('0x1d')],function(_0x497503){return{'model':db[_0x497503[_0xc854('0x1e')]],'as':_0x497503['as'],'attributes':_0x497503[_0xc854('0x1b')]};}):[]};}):[]};}):[]:[]})[_0xc854('0xc')](function(_0x343a5b){logger[_0xc854('0xd')](_0xc854('0x17'),_0x29406d);logger['debug']('GetTemplate',_0x29406d,JSON[_0xc854('0x11')](_0x343a5b));_0x3c8246(_0x343a5b);})['catch'](function(_0x89ccbf){logger[_0xc854('0x12')](_0xc854('0x17'),_0x89ccbf['message'],_0x29406d);_0x24fc92(_0xf67ac8[_0xc854('0x12')](0x1f4,_0x89ccbf[_0xc854('0x14')]));});});}; \ No newline at end of file +var _0x4ac5=['lodash','moment','bluebird','randomstring','ioredis','../../config/logger','rpc','../../config/environment','client','request','info','Template,\x20%s,\x20%s','request\x20sent','Template,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','Template','options','raw','where','attributes','limit','map','include','model','debug','GetTemplate'];(function(_0x55f549,_0x4f90ac){var _0x589a78=function(_0x4b2cc3){while(--_0x4b2cc3){_0x55f549['push'](_0x55f549['shift']());}};_0x589a78(++_0x4f90ac);}(_0x4ac5,0xf0));var _0x54ac=function(_0x33a694,_0x9b6640){_0x33a694=_0x33a694-0x0;var _0x41ff01=_0x4ac5[_0x33a694];return _0x41ff01;};'use strict';var _=require(_0x54ac('0x0'));var util=require('util');var moment=require(_0x54ac('0x1'));var BPromise=require(_0x54ac('0x2'));var rs=require(_0x54ac('0x3'));var fs=require('fs');var Redis=require(_0x54ac('0x4'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x54ac('0x5'))(_0x54ac('0x6'));var config=require(_0x54ac('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x54ac('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x4758c5,_0x4d7bb0,_0x39c569){return new BPromise(function(_0x22fc0e,_0x2d5547){return client[_0x54ac('0x9')](_0x4758c5,_0x39c569)['then'](function(_0x4cf0c7){logger[_0x54ac('0xa')](_0x54ac('0xb'),_0x4d7bb0,_0x54ac('0xc'));logger['debug'](_0x54ac('0xd'),_0x4d7bb0,_0x54ac('0xc'),JSON[_0x54ac('0xe')](_0x4cf0c7));if(_0x4cf0c7[_0x54ac('0xf')]){if(_0x4cf0c7[_0x54ac('0xf')]['code']===0x1f4){logger[_0x54ac('0xf')](_0x54ac('0xb'),_0x4d7bb0,_0x4cf0c7[_0x54ac('0xf')][_0x54ac('0x10')]);return _0x2d5547(_0x4cf0c7[_0x54ac('0xf')][_0x54ac('0x10')]);}logger[_0x54ac('0xf')](_0x54ac('0xb'),_0x4d7bb0,_0x4cf0c7[_0x54ac('0xf')][_0x54ac('0x10')]);return _0x22fc0e(_0x4cf0c7['error']['message']);}else{logger[_0x54ac('0xa')](_0x54ac('0xb'),_0x4d7bb0,_0x54ac('0xc'));_0x22fc0e(_0x4cf0c7[_0x54ac('0x11')][_0x54ac('0x10')]);}})[_0x54ac('0x12')](function(_0x1cd747){logger['error'](_0x54ac('0xb'),_0x4d7bb0,_0x1cd747);_0x2d5547(_0x1cd747);});});}exports['GetTemplate']=function(_0xb68374){var _0x3c57a7=this;return new Promise(function(_0x568b26,_0x4f962d){return db[_0x54ac('0x13')]['findAll']({'raw':_0xb68374[_0x54ac('0x14')]?_0xb68374['options'][_0x54ac('0x15')]===undefined?!![]:![]:!![],'where':_0xb68374['options']?_0xb68374[_0x54ac('0x14')][_0x54ac('0x16')]||null:null,'attributes':_0xb68374[_0x54ac('0x14')]?_0xb68374[_0x54ac('0x14')][_0x54ac('0x17')]||null:null,'limit':_0xb68374[_0x54ac('0x14')]?_0xb68374[_0x54ac('0x14')][_0x54ac('0x18')]||null:null,'include':_0xb68374[_0x54ac('0x14')]?_0xb68374[_0x54ac('0x14')]['include']?_[_0x54ac('0x19')](_0xb68374['options']['include'],function(_0x4c8c36){return{'model':db[_0x4c8c36['model']],'as':_0x4c8c36['as'],'attributes':_0x4c8c36['attributes'],'include':_0x4c8c36['include']?_[_0x54ac('0x19')](_0x4c8c36[_0x54ac('0x1a')],function(_0x58faf5){return{'model':db[_0x58faf5[_0x54ac('0x1b')]],'as':_0x58faf5['as'],'attributes':_0x58faf5['attributes'],'include':_0x58faf5[_0x54ac('0x1a')]?_[_0x54ac('0x19')](_0x58faf5[_0x54ac('0x1a')],function(_0x129694){return{'model':db[_0x129694[_0x54ac('0x1b')]],'as':_0x129694['as'],'attributes':_0x129694[_0x54ac('0x17')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x41221b){logger[_0x54ac('0xa')]('GetTemplate',_0xb68374);logger[_0x54ac('0x1c')](_0x54ac('0x1d'),_0xb68374,JSON[_0x54ac('0xe')](_0x41221b));_0x568b26(_0x41221b);})['catch'](function(_0x270725){logger[_0x54ac('0xf')](_0x54ac('0x1d'),_0x270725[_0x54ac('0x10')],_0xb68374);_0x4f962d(_0x3c57a7[_0x54ac('0xf')](0x1f4,_0x270725[_0x54ac('0x10')]));});});}; \ No newline at end of file diff --git a/server/api/trigger/index.js b/server/api/trigger/index.js index 9cf35cf..24aad9c 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 _0x5f60=['/:id/any_conditions','getAnyConditions','/:id/actions','getActions','post','create','addAnyCondition','addAction','put','/:id','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./trigger.controller','isAuthenticated','index','get','/:id/all_conditions'];(function(_0x3664d7,_0x4d88d5){var _0x58c676=function(_0x521042){while(--_0x521042){_0x3664d7['push'](_0x3664d7['shift']());}};_0x58c676(++_0x4d88d5);}(_0x5f60,0x182));var _0x05f6=function(_0x2238b1,_0x2cf83b){_0x2238b1=_0x2238b1-0x0;var _0x3bffa6=_0x5f60[_0x2238b1];return _0x3bffa6;};'use strict';var multer=require(_0x05f6('0x0'));var util=require(_0x05f6('0x1'));var path=require(_0x05f6('0x2'));var timeout=require(_0x05f6('0x3'));var express=require(_0x05f6('0x4'));var router=express[_0x05f6('0x5')]();var auth=require(_0x05f6('0x6'));var interaction=require(_0x05f6('0x7'));var config=require(_0x05f6('0x8'));var controller=require(_0x05f6('0x9'));router['get']('/',auth[_0x05f6('0xa')](),controller[_0x05f6('0xb')]);router[_0x05f6('0xc')]('/:id',auth[_0x05f6('0xa')](),controller['show']);router['get'](_0x05f6('0xd'),auth[_0x05f6('0xa')](),controller['getAllConditions']);router[_0x05f6('0xc')](_0x05f6('0xe'),auth['isAuthenticated'](),controller[_0x05f6('0xf')]);router['get'](_0x05f6('0x10'),auth[_0x05f6('0xa')](),controller[_0x05f6('0x11')]);router[_0x05f6('0x12')]('/',auth['isAuthenticated'](),controller[_0x05f6('0x13')]);router[_0x05f6('0x12')](_0x05f6('0xd'),auth[_0x05f6('0xa')](),controller['addAllCondition']);router[_0x05f6('0x12')](_0x05f6('0xe'),auth[_0x05f6('0xa')](),controller[_0x05f6('0x14')]);router[_0x05f6('0x12')]('/:id/actions',auth[_0x05f6('0xa')](),controller[_0x05f6('0x15')]);router[_0x05f6('0x16')](_0x05f6('0x17'),auth['isAuthenticated'](),controller['update']);router['delete'](_0x05f6('0x17'),auth['isAuthenticated'](),controller['destroy']);module[_0x05f6('0x18')]=router; \ No newline at end of file +var _0x0ada=['util','path','connect-timeout','express','Router','./trigger.controller','get','isAuthenticated','index','/:id','show','getAllConditions','/:id/any_conditions','getAnyConditions','/:id/actions','getActions','post','/:id/all_conditions','addAllCondition','addAction','put','update','delete','destroy','exports','multer'];(function(_0x250123,_0x36e23d){var _0x1b3551=function(_0x575b9b){while(--_0x575b9b){_0x250123['push'](_0x250123['shift']());}};_0x1b3551(++_0x36e23d);}(_0x0ada,0x137));var _0xa0ad=function(_0x5a437b,_0x56e902){_0x5a437b=_0x5a437b-0x0;var _0x5284b0=_0x0ada[_0x5a437b];return _0x5284b0;};'use strict';var multer=require(_0xa0ad('0x0'));var util=require(_0xa0ad('0x1'));var path=require(_0xa0ad('0x2'));var timeout=require(_0xa0ad('0x3'));var express=require(_0xa0ad('0x4'));var router=express[_0xa0ad('0x5')]();var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0xa0ad('0x6'));router[_0xa0ad('0x7')]('/',auth[_0xa0ad('0x8')](),controller[_0xa0ad('0x9')]);router[_0xa0ad('0x7')](_0xa0ad('0xa'),auth['isAuthenticated'](),controller[_0xa0ad('0xb')]);router[_0xa0ad('0x7')]('/:id/all_conditions',auth['isAuthenticated'](),controller[_0xa0ad('0xc')]);router[_0xa0ad('0x7')](_0xa0ad('0xd'),auth[_0xa0ad('0x8')](),controller[_0xa0ad('0xe')]);router[_0xa0ad('0x7')](_0xa0ad('0xf'),auth[_0xa0ad('0x8')](),controller[_0xa0ad('0x10')]);router[_0xa0ad('0x11')]('/',auth[_0xa0ad('0x8')](),controller['create']);router[_0xa0ad('0x11')](_0xa0ad('0x12'),auth[_0xa0ad('0x8')](),controller[_0xa0ad('0x13')]);router['post']('/:id/any_conditions',auth[_0xa0ad('0x8')](),controller['addAnyCondition']);router[_0xa0ad('0x11')](_0xa0ad('0xf'),auth['isAuthenticated'](),controller[_0xa0ad('0x14')]);router[_0xa0ad('0x15')]('/:id',auth[_0xa0ad('0x8')](),controller[_0xa0ad('0x16')]);router[_0xa0ad('0x17')]('/:id',auth[_0xa0ad('0x8')](),controller[_0xa0ad('0x18')]);module[_0xa0ad('0x19')]=router; \ No newline at end of file diff --git a/server/api/trigger/trigger.attributes.js b/server/api/trigger/trigger.attributes.js index 955999d..e8ea913 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 _0x3ee9=['sequelize','exports','STRING','BOOLEAN'];(function(_0x41108d,_0x3efcbb){var _0x2a0d2f=function(_0x2f04fa){while(--_0x2f04fa){_0x41108d['push'](_0x41108d['shift']());}};_0x2a0d2f(++_0x3efcbb);}(_0x3ee9,0x138));var _0x93ee=function(_0x101647,_0x4dbe8f){_0x101647=_0x101647-0x0;var _0x55fc55=_0x3ee9[_0x101647];return _0x55fc55;};'use strict';var Sequelize=require(_0x93ee('0x0'));module[_0x93ee('0x1')]={'name':{'type':Sequelize[_0x93ee('0x2')]},'channel':{'type':Sequelize['STRING']},'description':{'type':Sequelize['STRING']},'status':{'type':Sequelize[_0x93ee('0x3')],'defaultValue':![]}}; \ No newline at end of file +var _0x8a09=['sequelize','STRING','BOOLEAN'];(function(_0x358140,_0x1b1465){var _0x3685c6=function(_0xabe98b){while(--_0xabe98b){_0x358140['push'](_0x358140['shift']());}};_0x3685c6(++_0x1b1465);}(_0x8a09,0x90));var _0x98a0=function(_0x19950b,_0x53d0d7){_0x19950b=_0x19950b-0x0;var _0x3c6b41=_0x8a09[_0x19950b];return _0x3c6b41;};'use strict';var Sequelize=require(_0x98a0('0x0'));module['exports']={'name':{'type':Sequelize['STRING']},'channel':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0x98a0('0x1')]},'status':{'type':Sequelize[_0x98a0('0x2')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/trigger/trigger.controller.js b/server/api/trigger/trigger.controller.js index e199795..29dc082 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 _0x5496=['util','path','ejs','lodash','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','json','count','offset','limit','Content-Range','apply','reject','save','update','then','destroy','get','Triggers','UserProfileResource','end','error','stack','name','send','index','map','Trigger','fieldName','type','key','model','keys','query','filters','intersection','fields','attributes','hasOwnProperty','order','sort','where','pick','filter','merge','VIRTUAL','options','include','findAll','rows','catch','show','params','rawAttributes','includeAll','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','find','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','addAllCondition','TriggerAllId','Condition','TriggerAnyId','getAllConditions','findOne','length','nolimit','getAnyConditions','addAction','Action','getActions','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','moment','mustache'];(function(_0x290142,_0x38c7d3){var _0x4c4776=function(_0x3e814d){while(--_0x3e814d){_0x290142['push'](_0x290142['shift']());}};_0x4c4776(++_0x38c7d3);}(_0x5496,0x175));var _0x6549=function(_0x4e47e4,_0x22888){_0x4e47e4=_0x4e47e4-0x0;var _0x3e0f99=_0x5496[_0x4e47e4];return _0x3e0f99;};'use strict';var pdf=require(_0x6549('0x0'));var emlformat=require(_0x6549('0x1'));var rimraf=require(_0x6549('0x2'));var zipdir=require(_0x6549('0x3'));var jsonpatch=require(_0x6549('0x4'));var rp=require('request-promise');var moment=require(_0x6549('0x5'));var BPromise=require('bluebird');var Mustache=require(_0x6549('0x6'));var util=require(_0x6549('0x7'));var path=require(_0x6549('0x8'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x6549('0x9'));var fs=require('fs');var _=require(_0x6549('0xa'));var squel=require('squel');var crypto=require(_0x6549('0xb'));var jsforce=require(_0x6549('0xc'));var deskjs=require(_0x6549('0xd'));var toCsv=require('to-csv');var querystring=require(_0x6549('0xe'));var Papa=require(_0x6549('0xf'));var Redis=require(_0x6549('0x10'));var authService=require(_0x6549('0x11'));var qs=require(_0x6549('0x12'));var as=require(_0x6549('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x6549('0x14'));var utils=require(_0x6549('0x15'));var config=require(_0x6549('0x16'));var db=require(_0x6549('0x17'))['db'];function respondWithStatusCode(_0x1a0f72,_0x5bc018){_0x5bc018=_0x5bc018||0xcc;return function(_0x4dfb06){if(_0x4dfb06){return _0x1a0f72[_0x6549('0x18')](_0x5bc018);}return _0x1a0f72[_0x6549('0x19')](_0x5bc018)['end']();};}function respondWithResult(_0x200ff1,_0x150fc8){_0x150fc8=_0x150fc8||0xc8;return function(_0x195d25){if(_0x195d25){return _0x200ff1[_0x6549('0x19')](_0x150fc8)[_0x6549('0x1a')](_0x195d25);}};}function respondWithFilteredResult(_0x86ae9d,_0x55c112){return function(_0x5db86d){if(_0x5db86d){var _0x384f75=_0x5db86d[_0x6549('0x1b')],_0x25da29=_0x55c112[_0x6549('0x1c')],_0x47a81a=_0x55c112[_0x6549('0x1c')]+_0x55c112[_0x6549('0x1d')],_0x238a04;if(_0x47a81a>=_0x384f75){_0x47a81a=_0x384f75;_0x238a04=0xc8;}else{_0x238a04=0xce;}_0x86ae9d['status'](_0x238a04);return _0x86ae9d['set'](_0x6549('0x1e'),_0x25da29+'-'+_0x47a81a+'/'+_0x384f75)['json'](_0x5db86d);}return null;};}function patchUpdates(_0x56c15b){return function(_0x31f8e7){try{jsonpatch[_0x6549('0x1f')](_0x31f8e7,_0x56c15b,!![]);}catch(_0x19c4a6){return BPromise[_0x6549('0x20')](_0x19c4a6);}return _0x31f8e7[_0x6549('0x21')]();};}function saveUpdates(_0x5ce3aa,_0x228117){return function(_0x4b40c1){if(_0x4b40c1){return _0x4b40c1[_0x6549('0x22')](_0x5ce3aa)[_0x6549('0x23')](function(_0x3992cf){return _0x3992cf;});}return null;};}function removeEntity(_0x29c6b3,_0x22bcf8){return function(_0x12d547){if(_0x12d547){return _0x12d547[_0x6549('0x24')]()[_0x6549('0x23')](function(){var _0x2be467=_0x12d547[_0x6549('0x25')]({'plain':!![]});var _0x40d3f9=_0x6549('0x26');return db[_0x6549('0x27')]['destroy']({'where':{'type':_0x40d3f9,'resourceId':_0x2be467['id']}})[_0x6549('0x23')](function(){return _0x12d547;});})[_0x6549('0x23')](function(){_0x29c6b3['status'](0xcc)[_0x6549('0x28')]();});}};}function handleEntityNotFound(_0x29f89e,_0x3768cb){return function(_0x583c7d){if(!_0x583c7d){_0x29f89e[_0x6549('0x18')](0x194);}return _0x583c7d;};}function handleError(_0xfb51a1,_0x14de1f){_0x14de1f=_0x14de1f||0x1f4;return function(_0x2900cd){logger[_0x6549('0x29')](_0x2900cd[_0x6549('0x2a')]);if(_0x2900cd[_0x6549('0x2b')]){delete _0x2900cd[_0x6549('0x2b')];}_0xfb51a1['status'](_0x14de1f)[_0x6549('0x2c')](_0x2900cd);};}exports[_0x6549('0x2d')]=function(_0x17fdfb,_0x4c605c){var _0x3f1502={},_0x4acaf5={},_0x4f0ad1={'count':0x0,'rows':[]};var _0x5aa3a6=_[_0x6549('0x2e')](db[_0x6549('0x2f')]['rawAttributes'],function(_0x30aac6){return{'name':_0x30aac6[_0x6549('0x30')],'type':_0x30aac6[_0x6549('0x31')][_0x6549('0x32')]};});_0x4acaf5[_0x6549('0x33')]=_[_0x6549('0x2e')](_0x5aa3a6,_0x6549('0x2b'));_0x4acaf5['query']=_[_0x6549('0x34')](_0x17fdfb[_0x6549('0x35')]);_0x4acaf5[_0x6549('0x36')]=_[_0x6549('0x37')](_0x4acaf5[_0x6549('0x33')],_0x4acaf5[_0x6549('0x35')]);_0x3f1502['attributes']=_[_0x6549('0x37')](_0x4acaf5['model'],qs[_0x6549('0x38')](_0x17fdfb['query'][_0x6549('0x38')]));_0x3f1502[_0x6549('0x39')]=_0x3f1502[_0x6549('0x39')]['length']?_0x3f1502[_0x6549('0x39')]:_0x4acaf5[_0x6549('0x33')];if(!_0x17fdfb[_0x6549('0x35')][_0x6549('0x3a')]('nolimit')){_0x3f1502['limit']=qs['limit'](_0x17fdfb[_0x6549('0x35')][_0x6549('0x1d')]);_0x3f1502['offset']=qs[_0x6549('0x1c')](_0x17fdfb[_0x6549('0x35')][_0x6549('0x1c')]);}_0x3f1502[_0x6549('0x3b')]=qs[_0x6549('0x3c')](_0x17fdfb['query']['sort']);_0x3f1502[_0x6549('0x3d')]=qs[_0x6549('0x36')](_[_0x6549('0x3e')](_0x17fdfb[_0x6549('0x35')],_0x4acaf5[_0x6549('0x36')]));if(_0x17fdfb[_0x6549('0x35')][_0x6549('0x3f')]){_0x3f1502[_0x6549('0x3d')]=_[_0x6549('0x40')](_0x3f1502[_0x6549('0x3d')],{'$or':_['map'](_0x5aa3a6,function(_0x3ecf9a){if(_0x3ecf9a[_0x6549('0x31')]!==_0x6549('0x41')){var _0x38f048={};_0x38f048[_0x3ecf9a[_0x6549('0x2b')]]={'$like':'%'+_0x17fdfb['query']['filter']+'%'};return _0x38f048;}})});}_0x3f1502=_['merge']({},_0x3f1502,_0x17fdfb[_0x6549('0x42')]);var _0x179933={'where':_0x3f1502[_0x6549('0x3d')]};return db[_0x6549('0x2f')]['count'](_0x179933)['then'](function(_0x438f0b){_0x4f0ad1[_0x6549('0x1b')]=_0x438f0b;if(_0x17fdfb[_0x6549('0x35')]['includeAll']){_0x3f1502[_0x6549('0x43')]=[{'all':!![]}];}return db['Trigger'][_0x6549('0x44')](_0x3f1502);})[_0x6549('0x23')](function(_0x19920f){_0x4f0ad1[_0x6549('0x45')]=_0x19920f;return _0x4f0ad1;})[_0x6549('0x23')](respondWithFilteredResult(_0x4c605c,_0x3f1502))[_0x6549('0x46')](handleError(_0x4c605c,null));};exports[_0x6549('0x47')]=function(_0x4deaab,_0x132625){var _0x309f45={'raw':![],'where':{'id':_0x4deaab[_0x6549('0x48')]['id']}},_0x12f56c={};_0x12f56c[_0x6549('0x33')]=_[_0x6549('0x34')](db[_0x6549('0x2f')][_0x6549('0x49')]);_0x12f56c[_0x6549('0x35')]=_[_0x6549('0x34')](_0x4deaab[_0x6549('0x35')]);_0x12f56c[_0x6549('0x36')]=_[_0x6549('0x37')](_0x12f56c[_0x6549('0x33')],_0x12f56c[_0x6549('0x35')]);_0x309f45[_0x6549('0x39')]=_['intersection'](_0x12f56c[_0x6549('0x33')],qs[_0x6549('0x38')](_0x4deaab[_0x6549('0x35')][_0x6549('0x38')]));_0x309f45['attributes']=_0x309f45[_0x6549('0x39')]['length']?_0x309f45[_0x6549('0x39')]:_0x12f56c[_0x6549('0x33')];if(_0x4deaab['query'][_0x6549('0x4a')]){_0x309f45[_0x6549('0x43')]=[{'all':!![]}];}_0x309f45=_[_0x6549('0x40')]({},_0x309f45,_0x4deaab[_0x6549('0x42')]);return db[_0x6549('0x2f')]['find'](_0x309f45)['then'](handleEntityNotFound(_0x132625,null))[_0x6549('0x23')](respondWithResult(_0x132625,null))[_0x6549('0x46')](handleError(_0x132625,null));};exports[_0x6549('0x4b')]=function(_0x1712f3,_0x1e562b){return db['Trigger'][_0x6549('0x4b')](_0x1712f3[_0x6549('0x4c')],{})[_0x6549('0x23')](function(_0x6121af){var _0xa4c650=_0x1712f3[_0x6549('0x4d')][_0x6549('0x25')]({'plain':!![]});if(!_0xa4c650)throw new Error(_0x6549('0x4e'));if(_0xa4c650['role']===_0x6549('0x4d')){var _0x58746c=_0x6121af[_0x6549('0x25')]({'plain':!![]});var _0x1e09e1=_0x6549('0x26');return db['UserProfileSection'][_0x6549('0x4f')]({'where':{'name':_0x1e09e1,'userProfileId':_0xa4c650[_0x6549('0x50')]},'raw':!![]})[_0x6549('0x23')](function(_0x5300c8){if(_0x5300c8&&_0x5300c8[_0x6549('0x51')]===0x0){return db[_0x6549('0x27')][_0x6549('0x4b')]({'name':_0x58746c[_0x6549('0x2b')],'resourceId':_0x58746c['id'],'type':_0x5300c8[_0x6549('0x2b')],'sectionId':_0x5300c8['id']},{})[_0x6549('0x23')](function(){return _0x6121af;});}else{return _0x6121af;}})['catch'](function(_0x28af00){logger['error'](_0x6549('0x52'),_0x28af00);throw _0x28af00;});}return _0x6121af;})[_0x6549('0x23')](respondWithResult(_0x1e562b,0xc9))[_0x6549('0x46')](handleError(_0x1e562b,null));};exports[_0x6549('0x22')]=function(_0x40c92e,_0x21d2fb){if(_0x40c92e[_0x6549('0x4c')]['id']){delete _0x40c92e[_0x6549('0x4c')]['id'];}return db[_0x6549('0x2f')][_0x6549('0x4f')]({'where':{'id':_0x40c92e[_0x6549('0x48')]['id']}})[_0x6549('0x23')](handleEntityNotFound(_0x21d2fb,null))['then'](saveUpdates(_0x40c92e[_0x6549('0x4c')],null))[_0x6549('0x23')](respondWithResult(_0x21d2fb,null))[_0x6549('0x46')](handleError(_0x21d2fb,null));};exports[_0x6549('0x24')]=function(_0x260097,_0x1ffa23){return db[_0x6549('0x2f')][_0x6549('0x4f')]({'where':{'id':_0x260097['params']['id']}})[_0x6549('0x23')](handleEntityNotFound(_0x1ffa23,null))[_0x6549('0x23')](removeEntity(_0x1ffa23,null))[_0x6549('0x46')](handleError(_0x1ffa23,null));};exports[_0x6549('0x53')]=function(_0x2b0ba8,_0x8bbdf4,_0x2eb30c){if(_0x2b0ba8[_0x6549('0x4c')]['id']){delete _0x2b0ba8['body']['id'];}return db[_0x6549('0x2f')][_0x6549('0x4f')]({'where':{'id':_0x2b0ba8[_0x6549('0x48')]['id']}})[_0x6549('0x23')](handleEntityNotFound(_0x8bbdf4,null))[_0x6549('0x23')](function(_0xaf5b7b){if(_0xaf5b7b){_0x2b0ba8['body'][_0x6549('0x54')]=_0xaf5b7b['id'];return db[_0x6549('0x55')]['create'](_0x2b0ba8[_0x6549('0x4c')]);}})[_0x6549('0x23')](respondWithResult(_0x8bbdf4,null))[_0x6549('0x46')](handleError(_0x8bbdf4,null));};exports['addAnyCondition']=function(_0x4640c8,_0x25d086,_0x5c05c9){if(_0x4640c8[_0x6549('0x4c')]['id']){delete _0x4640c8['body']['id'];}return db[_0x6549('0x2f')]['find']({'where':{'id':_0x4640c8[_0x6549('0x48')]['id']}})[_0x6549('0x23')](handleEntityNotFound(_0x25d086,null))[_0x6549('0x23')](function(_0x3a4165){if(_0x3a4165){_0x4640c8[_0x6549('0x4c')][_0x6549('0x56')]=_0x3a4165['id'];return db[_0x6549('0x55')][_0x6549('0x4b')](_0x4640c8[_0x6549('0x4c')]);}})[_0x6549('0x23')](respondWithResult(_0x25d086,null))[_0x6549('0x46')](handleError(_0x25d086,null));};exports[_0x6549('0x57')]=function(_0x50cd18,_0x2f3fc7,_0x5cdbcb){var _0x2bff46={};var _0x355f53={};var _0x51d376;var _0xfb11e1;return db[_0x6549('0x2f')][_0x6549('0x58')]({'where':{'id':_0x50cd18[_0x6549('0x48')]['id']}})['then'](handleEntityNotFound(_0x2f3fc7,null))[_0x6549('0x23')](function(_0x28ff2e){if(_0x28ff2e){_0x51d376=_0x28ff2e;_0x355f53[_0x6549('0x33')]=_[_0x6549('0x34')](db['Condition'][_0x6549('0x49')]);_0x355f53['query']=_[_0x6549('0x34')](_0x50cd18[_0x6549('0x35')]);_0x355f53[_0x6549('0x36')]=_[_0x6549('0x37')](_0x355f53[_0x6549('0x33')],_0x355f53[_0x6549('0x35')]);_0x2bff46[_0x6549('0x39')]=_[_0x6549('0x37')](_0x355f53[_0x6549('0x33')],qs[_0x6549('0x38')](_0x50cd18['query'][_0x6549('0x38')]));_0x2bff46[_0x6549('0x39')]=_0x2bff46[_0x6549('0x39')][_0x6549('0x59')]?_0x2bff46[_0x6549('0x39')]:_0x355f53[_0x6549('0x33')];_0x2bff46['order']=qs['sort'](_0x50cd18[_0x6549('0x35')][_0x6549('0x3c')]);_0x2bff46[_0x6549('0x3d')]=qs['filters'](_[_0x6549('0x3e')](_0x50cd18[_0x6549('0x35')],_0x355f53['filters']));if(_0x50cd18[_0x6549('0x35')][_0x6549('0x3f')]){_0x2bff46[_0x6549('0x3d')]=_[_0x6549('0x40')](_0x2bff46[_0x6549('0x3d')],{'$or':_[_0x6549('0x2e')](_0x2bff46[_0x6549('0x39')],function(_0x402c26){var _0x503935={};_0x503935[_0x402c26]={'$like':'%'+_0x50cd18[_0x6549('0x35')]['filter']+'%'};return _0x503935;})});}_0x2bff46=_[_0x6549('0x40')]({},_0x2bff46,_0x50cd18[_0x6549('0x42')]);return _0x51d376['getAllConditions'](_0x2bff46);}})[_0x6549('0x23')](function(_0x2c00a1){if(_0x2c00a1){_0xfb11e1=_0x2c00a1[_0x6549('0x59')];if(!_0x50cd18['query'][_0x6549('0x3a')](_0x6549('0x5a'))){_0x2bff46[_0x6549('0x1d')]=qs[_0x6549('0x1d')](_0x50cd18[_0x6549('0x35')][_0x6549('0x1d')]);_0x2bff46['offset']=qs[_0x6549('0x1c')](_0x50cd18[_0x6549('0x35')][_0x6549('0x1c')]);}return _0x51d376['getAllConditions'](_0x2bff46);}})['then'](function(_0x4bcd01){if(_0x4bcd01){return _0x4bcd01?{'count':_0xfb11e1,'rows':_0x4bcd01}:null;}})[_0x6549('0x23')](respondWithResult(_0x2f3fc7,null))[_0x6549('0x46')](handleError(_0x2f3fc7,null));};exports[_0x6549('0x5b')]=function(_0x4d3103,_0x5255e1,_0x1458a3){var _0x4f941b={};var _0xf1d80f={};var _0x3e3f8c;var _0xcba9e1;return db[_0x6549('0x2f')][_0x6549('0x58')]({'where':{'id':_0x4d3103[_0x6549('0x48')]['id']}})[_0x6549('0x23')](handleEntityNotFound(_0x5255e1,null))['then'](function(_0x2f8c3a){if(_0x2f8c3a){_0x3e3f8c=_0x2f8c3a;_0xf1d80f[_0x6549('0x33')]=_[_0x6549('0x34')](db['Condition'][_0x6549('0x49')]);_0xf1d80f[_0x6549('0x35')]=_[_0x6549('0x34')](_0x4d3103[_0x6549('0x35')]);_0xf1d80f[_0x6549('0x36')]=_[_0x6549('0x37')](_0xf1d80f[_0x6549('0x33')],_0xf1d80f['query']);_0x4f941b[_0x6549('0x39')]=_['intersection'](_0xf1d80f[_0x6549('0x33')],qs[_0x6549('0x38')](_0x4d3103[_0x6549('0x35')][_0x6549('0x38')]));_0x4f941b[_0x6549('0x39')]=_0x4f941b[_0x6549('0x39')][_0x6549('0x59')]?_0x4f941b[_0x6549('0x39')]:_0xf1d80f['model'];_0x4f941b[_0x6549('0x3b')]=qs[_0x6549('0x3c')](_0x4d3103[_0x6549('0x35')][_0x6549('0x3c')]);_0x4f941b[_0x6549('0x3d')]=qs[_0x6549('0x36')](_[_0x6549('0x3e')](_0x4d3103[_0x6549('0x35')],_0xf1d80f[_0x6549('0x36')]));if(_0x4d3103[_0x6549('0x35')]['filter']){_0x4f941b[_0x6549('0x3d')]=_[_0x6549('0x40')](_0x4f941b[_0x6549('0x3d')],{'$or':_[_0x6549('0x2e')](_0x4f941b[_0x6549('0x39')],function(_0xd80e41){var _0x2d6b35={};_0x2d6b35[_0xd80e41]={'$like':'%'+_0x4d3103[_0x6549('0x35')][_0x6549('0x3f')]+'%'};return _0x2d6b35;})});}_0x4f941b=_[_0x6549('0x40')]({},_0x4f941b,_0x4d3103[_0x6549('0x42')]);return _0x3e3f8c[_0x6549('0x5b')](_0x4f941b);}})[_0x6549('0x23')](function(_0x44f005){if(_0x44f005){_0xcba9e1=_0x44f005[_0x6549('0x59')];if(!_0x4d3103[_0x6549('0x35')][_0x6549('0x3a')](_0x6549('0x5a'))){_0x4f941b['limit']=qs[_0x6549('0x1d')](_0x4d3103[_0x6549('0x35')][_0x6549('0x1d')]);_0x4f941b[_0x6549('0x1c')]=qs[_0x6549('0x1c')](_0x4d3103[_0x6549('0x35')][_0x6549('0x1c')]);}return _0x3e3f8c[_0x6549('0x5b')](_0x4f941b);}})[_0x6549('0x23')](function(_0x1196f9){if(_0x1196f9){return _0x1196f9?{'count':_0xcba9e1,'rows':_0x1196f9}:null;}})[_0x6549('0x23')](respondWithResult(_0x5255e1,null))[_0x6549('0x46')](handleError(_0x5255e1,null));};exports[_0x6549('0x5c')]=function(_0x184995,_0x38df70,_0x322f4e){if(_0x184995[_0x6549('0x4c')]['id']){delete _0x184995['body']['id'];}return db[_0x6549('0x2f')][_0x6549('0x4f')]({'where':{'id':_0x184995[_0x6549('0x48')]['id']}})[_0x6549('0x23')](handleEntityNotFound(_0x38df70,null))[_0x6549('0x23')](function(_0x42a47f){if(_0x42a47f){_0x184995[_0x6549('0x4c')]['TriggerId']=_0x42a47f['id'];return db[_0x6549('0x5d')]['create'](_0x184995['body']);}})[_0x6549('0x23')](respondWithResult(_0x38df70,null))['catch'](handleError(_0x38df70,null));};exports[_0x6549('0x5e')]=function(_0x1f3230,_0x30083b,_0x1536a9){var _0x419fdb={};var _0x5ac35c={};var _0x352182;var _0x51253c;return db[_0x6549('0x2f')][_0x6549('0x58')]({'where':{'id':_0x1f3230[_0x6549('0x48')]['id']}})['then'](handleEntityNotFound(_0x30083b,null))[_0x6549('0x23')](function(_0x2e013e){if(_0x2e013e){_0x352182=_0x2e013e;_0x5ac35c['model']=_['keys'](db[_0x6549('0x5d')][_0x6549('0x49')]);_0x5ac35c[_0x6549('0x35')]=_[_0x6549('0x34')](_0x1f3230[_0x6549('0x35')]);_0x5ac35c[_0x6549('0x36')]=_[_0x6549('0x37')](_0x5ac35c[_0x6549('0x33')],_0x5ac35c[_0x6549('0x35')]);_0x419fdb[_0x6549('0x39')]=_[_0x6549('0x37')](_0x5ac35c[_0x6549('0x33')],qs[_0x6549('0x38')](_0x1f3230[_0x6549('0x35')][_0x6549('0x38')]));_0x419fdb[_0x6549('0x39')]=_0x419fdb[_0x6549('0x39')][_0x6549('0x59')]?_0x419fdb[_0x6549('0x39')]:_0x5ac35c['model'];_0x419fdb['order']=qs[_0x6549('0x3c')](_0x1f3230[_0x6549('0x35')][_0x6549('0x3c')]);_0x419fdb[_0x6549('0x3d')]=qs[_0x6549('0x36')](_[_0x6549('0x3e')](_0x1f3230[_0x6549('0x35')],_0x5ac35c[_0x6549('0x36')]));if(_0x1f3230[_0x6549('0x35')][_0x6549('0x3f')]){_0x419fdb['where']=_['merge'](_0x419fdb['where'],{'$or':_[_0x6549('0x2e')](_0x419fdb[_0x6549('0x39')],function(_0x4261c2){var _0xc84cdb={};_0xc84cdb[_0x4261c2]={'$like':'%'+_0x1f3230[_0x6549('0x35')]['filter']+'%'};return _0xc84cdb;})});}_0x419fdb=_[_0x6549('0x40')]({},_0x419fdb,_0x1f3230[_0x6549('0x42')]);return _0x352182[_0x6549('0x5e')](_0x419fdb);}})[_0x6549('0x23')](function(_0x230874){if(_0x230874){_0x51253c=_0x230874[_0x6549('0x59')];if(!_0x1f3230[_0x6549('0x35')][_0x6549('0x3a')](_0x6549('0x5a'))){_0x419fdb[_0x6549('0x1d')]=qs[_0x6549('0x1d')](_0x1f3230['query'][_0x6549('0x1d')]);_0x419fdb[_0x6549('0x1c')]=qs[_0x6549('0x1c')](_0x1f3230[_0x6549('0x35')]['offset']);}return _0x352182[_0x6549('0x5e')](_0x419fdb);}})[_0x6549('0x23')](function(_0x1dbcc4){if(_0x1dbcc4){return _0x1dbcc4?{'count':_0x51253c,'rows':_0x1dbcc4}:null;}})[_0x6549('0x23')](respondWithResult(_0x30083b,null))[_0x6549('0x46')](handleError(_0x30083b,null));}; \ No newline at end of file +var _0x708c=['map','rawAttributes','fieldName','type','model','query','filters','intersection','attributes','fields','length','nolimit','sort','where','pick','filter','merge','VIRTUAL','options','Trigger','includeAll','include','findAll','rows','catch','show','params','keys','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','find','Condition','addAnyCondition','getAllConditions','order','hasOwnProperty','getAnyConditions','addAction','getActions','html-pdf','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','to-csv','ejs','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','status','count','offset','limit','set','Content-Range','json','apply','save','update','destroy','then','get','Triggers','end','error','stack','name','send','index'];(function(_0x2a2b4,_0xcc17b){var _0x16bec5=function(_0x5d5e08){while(--_0x5d5e08){_0x2a2b4['push'](_0x2a2b4['shift']());}};_0x16bec5(++_0xcc17b);}(_0x708c,0x8b));var _0xc708=function(_0x298825,_0xf5151){_0x298825=_0x298825-0x0;var _0x34c563=_0x708c[_0x298825];return _0x34c563;};'use strict';var pdf=require(_0xc708('0x0'));var emlformat=require(_0xc708('0x1'));var rimraf=require(_0xc708('0x2'));var zipdir=require('zip-dir');var jsonpatch=require(_0xc708('0x3'));var rp=require(_0xc708('0x4'));var moment=require(_0xc708('0x5'));var BPromise=require(_0xc708('0x6'));var Mustache=require(_0xc708('0x7'));var util=require(_0xc708('0x8'));var path=require('path');var sox=require(_0xc708('0x9'));var csv=require(_0xc708('0xa'));var ejs=require(_0xc708('0xb'));var fs=require('fs');var _=require('lodash');var squel=require(_0xc708('0xc'));var crypto=require(_0xc708('0xd'));var jsforce=require(_0xc708('0xe'));var deskjs=require(_0xc708('0xf'));var toCsv=require(_0xc708('0xa'));var querystring=require(_0xc708('0x10'));var Papa=require(_0xc708('0x11'));var Redis=require(_0xc708('0x12'));var authService=require(_0xc708('0x13'));var qs=require(_0xc708('0x14'));var as=require(_0xc708('0x15'));var hardwareService=require(_0xc708('0x16'));var logger=require(_0xc708('0x17'))('api');var utils=require(_0xc708('0x18'));var config=require(_0xc708('0x19'));var db=require(_0xc708('0x1a'))['db'];function respondWithStatusCode(_0x532c97,_0x1425c2){_0x1425c2=_0x1425c2||0xcc;return function(_0x56f226){if(_0x56f226){return _0x532c97['sendStatus'](_0x1425c2);}return _0x532c97[_0xc708('0x1b')](_0x1425c2)['end']();};}function respondWithResult(_0x44648e,_0x360a2a){_0x360a2a=_0x360a2a||0xc8;return function(_0x52bab6){if(_0x52bab6){return _0x44648e[_0xc708('0x1b')](_0x360a2a)['json'](_0x52bab6);}};}function respondWithFilteredResult(_0x4f89ad,_0x1814ff){return function(_0x19f5d0){if(_0x19f5d0){var _0x517eca=_0x19f5d0[_0xc708('0x1c')],_0x3182bc=_0x1814ff[_0xc708('0x1d')],_0x1dcf96=_0x1814ff[_0xc708('0x1d')]+_0x1814ff[_0xc708('0x1e')],_0xba21eb;if(_0x1dcf96>=_0x517eca){_0x1dcf96=_0x517eca;_0xba21eb=0xc8;}else{_0xba21eb=0xce;}_0x4f89ad['status'](_0xba21eb);return _0x4f89ad[_0xc708('0x1f')](_0xc708('0x20'),_0x3182bc+'-'+_0x1dcf96+'/'+_0x517eca)[_0xc708('0x21')](_0x19f5d0);}return null;};}function patchUpdates(_0x50dc0e){return function(_0x22a015){try{jsonpatch[_0xc708('0x22')](_0x22a015,_0x50dc0e,!![]);}catch(_0x57df50){return BPromise['reject'](_0x57df50);}return _0x22a015[_0xc708('0x23')]();};}function saveUpdates(_0x48edc9,_0x28022c){return function(_0x168025){if(_0x168025){return _0x168025[_0xc708('0x24')](_0x48edc9)['then'](function(_0x2df3d8){return _0x2df3d8;});}return null;};}function removeEntity(_0x41f5fa,_0x305092){return function(_0x5eff2f){if(_0x5eff2f){return _0x5eff2f[_0xc708('0x25')]()[_0xc708('0x26')](function(){var _0x9bcb2c=_0x5eff2f[_0xc708('0x27')]({'plain':!![]});var _0x2e7082=_0xc708('0x28');return db['UserProfileResource']['destroy']({'where':{'type':_0x2e7082,'resourceId':_0x9bcb2c['id']}})[_0xc708('0x26')](function(){return _0x5eff2f;});})[_0xc708('0x26')](function(){_0x41f5fa[_0xc708('0x1b')](0xcc)[_0xc708('0x29')]();});}};}function handleEntityNotFound(_0x1b25ba,_0x5c84e5){return function(_0x360410){if(!_0x360410){_0x1b25ba['sendStatus'](0x194);}return _0x360410;};}function handleError(_0x32ad03,_0x34c048){_0x34c048=_0x34c048||0x1f4;return function(_0x5844ee){logger[_0xc708('0x2a')](_0x5844ee[_0xc708('0x2b')]);if(_0x5844ee[_0xc708('0x2c')]){delete _0x5844ee[_0xc708('0x2c')];}_0x32ad03[_0xc708('0x1b')](_0x34c048)[_0xc708('0x2d')](_0x5844ee);};}exports[_0xc708('0x2e')]=function(_0x4cff56,_0x160543){var _0x99126f={},_0x629d9b={},_0x51dc2e={'count':0x0,'rows':[]};var _0x23cd0c=_[_0xc708('0x2f')](db['Trigger'][_0xc708('0x30')],function(_0x754bc2){return{'name':_0x754bc2[_0xc708('0x31')],'type':_0x754bc2[_0xc708('0x32')]['key']};});_0x629d9b[_0xc708('0x33')]=_['map'](_0x23cd0c,_0xc708('0x2c'));_0x629d9b[_0xc708('0x34')]=_['keys'](_0x4cff56['query']);_0x629d9b[_0xc708('0x35')]=_[_0xc708('0x36')](_0x629d9b[_0xc708('0x33')],_0x629d9b[_0xc708('0x34')]);_0x99126f[_0xc708('0x37')]=_[_0xc708('0x36')](_0x629d9b[_0xc708('0x33')],qs[_0xc708('0x38')](_0x4cff56[_0xc708('0x34')]['fields']));_0x99126f[_0xc708('0x37')]=_0x99126f[_0xc708('0x37')][_0xc708('0x39')]?_0x99126f[_0xc708('0x37')]:_0x629d9b[_0xc708('0x33')];if(!_0x4cff56['query']['hasOwnProperty'](_0xc708('0x3a'))){_0x99126f[_0xc708('0x1e')]=qs[_0xc708('0x1e')](_0x4cff56[_0xc708('0x34')]['limit']);_0x99126f[_0xc708('0x1d')]=qs[_0xc708('0x1d')](_0x4cff56[_0xc708('0x34')]['offset']);}_0x99126f['order']=qs[_0xc708('0x3b')](_0x4cff56[_0xc708('0x34')][_0xc708('0x3b')]);_0x99126f[_0xc708('0x3c')]=qs[_0xc708('0x35')](_[_0xc708('0x3d')](_0x4cff56[_0xc708('0x34')],_0x629d9b['filters']));if(_0x4cff56[_0xc708('0x34')][_0xc708('0x3e')]){_0x99126f[_0xc708('0x3c')]=_[_0xc708('0x3f')](_0x99126f[_0xc708('0x3c')],{'$or':_[_0xc708('0x2f')](_0x23cd0c,function(_0x176d0b){if(_0x176d0b[_0xc708('0x32')]!==_0xc708('0x40')){var _0x1c389e={};_0x1c389e[_0x176d0b[_0xc708('0x2c')]]={'$like':'%'+_0x4cff56[_0xc708('0x34')]['filter']+'%'};return _0x1c389e;}})});}_0x99126f=_[_0xc708('0x3f')]({},_0x99126f,_0x4cff56[_0xc708('0x41')]);var _0x32a834={'where':_0x99126f[_0xc708('0x3c')]};return db[_0xc708('0x42')][_0xc708('0x1c')](_0x32a834)['then'](function(_0xa409ac){_0x51dc2e[_0xc708('0x1c')]=_0xa409ac;if(_0x4cff56[_0xc708('0x34')][_0xc708('0x43')]){_0x99126f[_0xc708('0x44')]=[{'all':!![]}];}return db[_0xc708('0x42')][_0xc708('0x45')](_0x99126f);})[_0xc708('0x26')](function(_0x20bf0b){_0x51dc2e[_0xc708('0x46')]=_0x20bf0b;return _0x51dc2e;})[_0xc708('0x26')](respondWithFilteredResult(_0x160543,_0x99126f))[_0xc708('0x47')](handleError(_0x160543,null));};exports[_0xc708('0x48')]=function(_0x2153a1,_0x16a18a){var _0x3ad758={'raw':![],'where':{'id':_0x2153a1[_0xc708('0x49')]['id']}},_0x36db10={};_0x36db10[_0xc708('0x33')]=_[_0xc708('0x4a')](db['Trigger'][_0xc708('0x30')]);_0x36db10[_0xc708('0x34')]=_[_0xc708('0x4a')](_0x2153a1[_0xc708('0x34')]);_0x36db10[_0xc708('0x35')]=_[_0xc708('0x36')](_0x36db10[_0xc708('0x33')],_0x36db10[_0xc708('0x34')]);_0x3ad758['attributes']=_['intersection'](_0x36db10['model'],qs[_0xc708('0x38')](_0x2153a1['query'][_0xc708('0x38')]));_0x3ad758[_0xc708('0x37')]=_0x3ad758[_0xc708('0x37')][_0xc708('0x39')]?_0x3ad758[_0xc708('0x37')]:_0x36db10['model'];if(_0x2153a1[_0xc708('0x34')][_0xc708('0x43')]){_0x3ad758['include']=[{'all':!![]}];}_0x3ad758=_[_0xc708('0x3f')]({},_0x3ad758,_0x2153a1['options']);return db['Trigger']['find'](_0x3ad758)[_0xc708('0x26')](handleEntityNotFound(_0x16a18a,null))['then'](respondWithResult(_0x16a18a,null))[_0xc708('0x47')](handleError(_0x16a18a,null));};exports['create']=function(_0x498c4b,_0x3a7b11){return db[_0xc708('0x42')][_0xc708('0x4b')](_0x498c4b[_0xc708('0x4c')],{})[_0xc708('0x26')](function(_0x39a855){var _0x31a737=_0x498c4b[_0xc708('0x4d')]['get']({'plain':!![]});if(!_0x31a737)throw new Error(_0xc708('0x4e'));if(_0x31a737[_0xc708('0x4f')]==='user'){var _0x6f9cb1=_0x39a855[_0xc708('0x27')]({'plain':!![]});var _0x256197=_0xc708('0x28');return db[_0xc708('0x50')]['find']({'where':{'name':_0x256197,'userProfileId':_0x31a737[_0xc708('0x51')]},'raw':!![]})[_0xc708('0x26')](function(_0x1c1f3e){if(_0x1c1f3e&&_0x1c1f3e[_0xc708('0x52')]===0x0){return db['UserProfileResource']['create']({'name':_0x6f9cb1[_0xc708('0x2c')],'resourceId':_0x6f9cb1['id'],'type':_0x1c1f3e[_0xc708('0x2c')],'sectionId':_0x1c1f3e['id']},{})[_0xc708('0x26')](function(){return _0x39a855;});}else{return _0x39a855;}})[_0xc708('0x47')](function(_0x10d42c){logger[_0xc708('0x2a')](_0xc708('0x53'),_0x10d42c);throw _0x10d42c;});}return _0x39a855;})[_0xc708('0x26')](respondWithResult(_0x3a7b11,0xc9))['catch'](handleError(_0x3a7b11,null));};exports['update']=function(_0x16f15f,_0x45f890){if(_0x16f15f[_0xc708('0x4c')]['id']){delete _0x16f15f[_0xc708('0x4c')]['id'];}return db['Trigger'][_0xc708('0x54')]({'where':{'id':_0x16f15f[_0xc708('0x49')]['id']}})[_0xc708('0x26')](handleEntityNotFound(_0x45f890,null))[_0xc708('0x26')](saveUpdates(_0x16f15f['body'],null))[_0xc708('0x26')](respondWithResult(_0x45f890,null))[_0xc708('0x47')](handleError(_0x45f890,null));};exports['destroy']=function(_0x2d6075,_0x2f7a07){return db[_0xc708('0x42')][_0xc708('0x54')]({'where':{'id':_0x2d6075['params']['id']}})['then'](handleEntityNotFound(_0x2f7a07,null))[_0xc708('0x26')](removeEntity(_0x2f7a07,null))[_0xc708('0x47')](handleError(_0x2f7a07,null));};exports['addAllCondition']=function(_0x1e2e25,_0x3e00c9,_0x4e00b1){if(_0x1e2e25[_0xc708('0x4c')]['id']){delete _0x1e2e25['body']['id'];}return db['Trigger'][_0xc708('0x54')]({'where':{'id':_0x1e2e25[_0xc708('0x49')]['id']}})[_0xc708('0x26')](handleEntityNotFound(_0x3e00c9,null))[_0xc708('0x26')](function(_0x42f441){if(_0x42f441){_0x1e2e25['body']['TriggerAllId']=_0x42f441['id'];return db[_0xc708('0x55')][_0xc708('0x4b')](_0x1e2e25[_0xc708('0x4c')]);}})[_0xc708('0x26')](respondWithResult(_0x3e00c9,null))[_0xc708('0x47')](handleError(_0x3e00c9,null));};exports[_0xc708('0x56')]=function(_0x326ec0,_0x130f4c,_0x212f50){if(_0x326ec0[_0xc708('0x4c')]['id']){delete _0x326ec0[_0xc708('0x4c')]['id'];}return db['Trigger']['find']({'where':{'id':_0x326ec0[_0xc708('0x49')]['id']}})[_0xc708('0x26')](handleEntityNotFound(_0x130f4c,null))[_0xc708('0x26')](function(_0x5a2520){if(_0x5a2520){_0x326ec0['body']['TriggerAnyId']=_0x5a2520['id'];return db['Condition'][_0xc708('0x4b')](_0x326ec0[_0xc708('0x4c')]);}})[_0xc708('0x26')](respondWithResult(_0x130f4c,null))['catch'](handleError(_0x130f4c,null));};exports[_0xc708('0x57')]=function(_0x1b40ec,_0x49cd1d,_0xdf742f){var _0x55b396={};var _0x3c93a1={};var _0x35c3a8;var _0x182b30;return db[_0xc708('0x42')]['findOne']({'where':{'id':_0x1b40ec[_0xc708('0x49')]['id']}})[_0xc708('0x26')](handleEntityNotFound(_0x49cd1d,null))[_0xc708('0x26')](function(_0x40a771){if(_0x40a771){_0x35c3a8=_0x40a771;_0x3c93a1[_0xc708('0x33')]=_[_0xc708('0x4a')](db[_0xc708('0x55')][_0xc708('0x30')]);_0x3c93a1[_0xc708('0x34')]=_[_0xc708('0x4a')](_0x1b40ec['query']);_0x3c93a1[_0xc708('0x35')]=_[_0xc708('0x36')](_0x3c93a1[_0xc708('0x33')],_0x3c93a1[_0xc708('0x34')]);_0x55b396[_0xc708('0x37')]=_[_0xc708('0x36')](_0x3c93a1[_0xc708('0x33')],qs[_0xc708('0x38')](_0x1b40ec['query'][_0xc708('0x38')]));_0x55b396['attributes']=_0x55b396[_0xc708('0x37')][_0xc708('0x39')]?_0x55b396[_0xc708('0x37')]:_0x3c93a1[_0xc708('0x33')];_0x55b396[_0xc708('0x58')]=qs[_0xc708('0x3b')](_0x1b40ec['query'][_0xc708('0x3b')]);_0x55b396[_0xc708('0x3c')]=qs[_0xc708('0x35')](_[_0xc708('0x3d')](_0x1b40ec[_0xc708('0x34')],_0x3c93a1[_0xc708('0x35')]));if(_0x1b40ec['query'][_0xc708('0x3e')]){_0x55b396[_0xc708('0x3c')]=_[_0xc708('0x3f')](_0x55b396[_0xc708('0x3c')],{'$or':_[_0xc708('0x2f')](_0x55b396[_0xc708('0x37')],function(_0x56a0e1){var _0x33bc75={};_0x33bc75[_0x56a0e1]={'$like':'%'+_0x1b40ec[_0xc708('0x34')][_0xc708('0x3e')]+'%'};return _0x33bc75;})});}_0x55b396=_[_0xc708('0x3f')]({},_0x55b396,_0x1b40ec[_0xc708('0x41')]);return _0x35c3a8[_0xc708('0x57')](_0x55b396);}})[_0xc708('0x26')](function(_0x539d3a){if(_0x539d3a){_0x182b30=_0x539d3a['length'];if(!_0x1b40ec[_0xc708('0x34')][_0xc708('0x59')](_0xc708('0x3a'))){_0x55b396[_0xc708('0x1e')]=qs[_0xc708('0x1e')](_0x1b40ec[_0xc708('0x34')][_0xc708('0x1e')]);_0x55b396['offset']=qs['offset'](_0x1b40ec[_0xc708('0x34')][_0xc708('0x1d')]);}return _0x35c3a8[_0xc708('0x57')](_0x55b396);}})[_0xc708('0x26')](function(_0x5e8014){if(_0x5e8014){return _0x5e8014?{'count':_0x182b30,'rows':_0x5e8014}:null;}})[_0xc708('0x26')](respondWithResult(_0x49cd1d,null))[_0xc708('0x47')](handleError(_0x49cd1d,null));};exports['getAnyConditions']=function(_0x531639,_0x2bf65b,_0x14a728){var _0x3bea70={};var _0x4de4f7={};var _0x25cd77;var _0x537fbd;return db[_0xc708('0x42')]['findOne']({'where':{'id':_0x531639[_0xc708('0x49')]['id']}})[_0xc708('0x26')](handleEntityNotFound(_0x2bf65b,null))[_0xc708('0x26')](function(_0x3daba2){if(_0x3daba2){_0x25cd77=_0x3daba2;_0x4de4f7[_0xc708('0x33')]=_['keys'](db[_0xc708('0x55')]['rawAttributes']);_0x4de4f7[_0xc708('0x34')]=_['keys'](_0x531639[_0xc708('0x34')]);_0x4de4f7[_0xc708('0x35')]=_[_0xc708('0x36')](_0x4de4f7['model'],_0x4de4f7['query']);_0x3bea70[_0xc708('0x37')]=_['intersection'](_0x4de4f7[_0xc708('0x33')],qs[_0xc708('0x38')](_0x531639['query'][_0xc708('0x38')]));_0x3bea70[_0xc708('0x37')]=_0x3bea70['attributes'][_0xc708('0x39')]?_0x3bea70[_0xc708('0x37')]:_0x4de4f7['model'];_0x3bea70[_0xc708('0x58')]=qs[_0xc708('0x3b')](_0x531639[_0xc708('0x34')]['sort']);_0x3bea70[_0xc708('0x3c')]=qs[_0xc708('0x35')](_['pick'](_0x531639[_0xc708('0x34')],_0x4de4f7[_0xc708('0x35')]));if(_0x531639[_0xc708('0x34')]['filter']){_0x3bea70['where']=_['merge'](_0x3bea70['where'],{'$or':_[_0xc708('0x2f')](_0x3bea70['attributes'],function(_0x51c934){var _0x15a5ee={};_0x15a5ee[_0x51c934]={'$like':'%'+_0x531639[_0xc708('0x34')]['filter']+'%'};return _0x15a5ee;})});}_0x3bea70=_[_0xc708('0x3f')]({},_0x3bea70,_0x531639[_0xc708('0x41')]);return _0x25cd77[_0xc708('0x5a')](_0x3bea70);}})[_0xc708('0x26')](function(_0x3a13ac){if(_0x3a13ac){_0x537fbd=_0x3a13ac[_0xc708('0x39')];if(!_0x531639[_0xc708('0x34')][_0xc708('0x59')](_0xc708('0x3a'))){_0x3bea70[_0xc708('0x1e')]=qs[_0xc708('0x1e')](_0x531639[_0xc708('0x34')][_0xc708('0x1e')]);_0x3bea70[_0xc708('0x1d')]=qs[_0xc708('0x1d')](_0x531639[_0xc708('0x34')]['offset']);}return _0x25cd77[_0xc708('0x5a')](_0x3bea70);}})['then'](function(_0x5a35d0){if(_0x5a35d0){return _0x5a35d0?{'count':_0x537fbd,'rows':_0x5a35d0}:null;}})[_0xc708('0x26')](respondWithResult(_0x2bf65b,null))['catch'](handleError(_0x2bf65b,null));};exports[_0xc708('0x5b')]=function(_0xe4baeb,_0x46050f,_0x39be12){if(_0xe4baeb[_0xc708('0x4c')]['id']){delete _0xe4baeb[_0xc708('0x4c')]['id'];}return db[_0xc708('0x42')][_0xc708('0x54')]({'where':{'id':_0xe4baeb[_0xc708('0x49')]['id']}})[_0xc708('0x26')](handleEntityNotFound(_0x46050f,null))[_0xc708('0x26')](function(_0x137c90){if(_0x137c90){_0xe4baeb[_0xc708('0x4c')]['TriggerId']=_0x137c90['id'];return db['Action'][_0xc708('0x4b')](_0xe4baeb['body']);}})[_0xc708('0x26')](respondWithResult(_0x46050f,null))['catch'](handleError(_0x46050f,null));};exports[_0xc708('0x5c')]=function(_0x5b7718,_0x814a86,_0x1de0c0){var _0x499456={};var _0x416165={};var _0x3cb39a;var _0x1dc4c4;return db[_0xc708('0x42')]['findOne']({'where':{'id':_0x5b7718[_0xc708('0x49')]['id']}})['then'](handleEntityNotFound(_0x814a86,null))[_0xc708('0x26')](function(_0x2d8fe4){if(_0x2d8fe4){_0x3cb39a=_0x2d8fe4;_0x416165[_0xc708('0x33')]=_[_0xc708('0x4a')](db['Action'][_0xc708('0x30')]);_0x416165['query']=_['keys'](_0x5b7718[_0xc708('0x34')]);_0x416165[_0xc708('0x35')]=_['intersection'](_0x416165[_0xc708('0x33')],_0x416165[_0xc708('0x34')]);_0x499456['attributes']=_['intersection'](_0x416165[_0xc708('0x33')],qs['fields'](_0x5b7718[_0xc708('0x34')][_0xc708('0x38')]));_0x499456[_0xc708('0x37')]=_0x499456[_0xc708('0x37')][_0xc708('0x39')]?_0x499456[_0xc708('0x37')]:_0x416165['model'];_0x499456['order']=qs[_0xc708('0x3b')](_0x5b7718[_0xc708('0x34')][_0xc708('0x3b')]);_0x499456[_0xc708('0x3c')]=qs['filters'](_['pick'](_0x5b7718[_0xc708('0x34')],_0x416165[_0xc708('0x35')]));if(_0x5b7718[_0xc708('0x34')]['filter']){_0x499456[_0xc708('0x3c')]=_[_0xc708('0x3f')](_0x499456[_0xc708('0x3c')],{'$or':_[_0xc708('0x2f')](_0x499456[_0xc708('0x37')],function(_0x19154f){var _0x5a7307={};_0x5a7307[_0x19154f]={'$like':'%'+_0x5b7718[_0xc708('0x34')]['filter']+'%'};return _0x5a7307;})});}_0x499456=_['merge']({},_0x499456,_0x5b7718[_0xc708('0x41')]);return _0x3cb39a[_0xc708('0x5c')](_0x499456);}})[_0xc708('0x26')](function(_0x3c814c){if(_0x3c814c){_0x1dc4c4=_0x3c814c[_0xc708('0x39')];if(!_0x5b7718[_0xc708('0x34')]['hasOwnProperty'](_0xc708('0x3a'))){_0x499456[_0xc708('0x1e')]=qs[_0xc708('0x1e')](_0x5b7718['query']['limit']);_0x499456[_0xc708('0x1d')]=qs[_0xc708('0x1d')](_0x5b7718[_0xc708('0x34')][_0xc708('0x1d')]);}return _0x3cb39a['getActions'](_0x499456);}})[_0xc708('0x26')](function(_0x1c2935){if(_0x1c2935){return _0x1c2935?{'count':_0x1dc4c4,'rows':_0x1c2935}:null;}})[_0xc708('0x26')](respondWithResult(_0x814a86,null))[_0xc708('0x47')](handleError(_0x814a86,null));}; \ No newline at end of file diff --git a/server/api/trigger/trigger.model.js b/server/api/trigger/trigger.model.js index ffa84c6..ca91821 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 _0xadd9=['api','moment','path','rimraf','../../config/environment','./trigger.attributes','define','Trigger','tools_triggers','../../config/logger'];(function(_0x272638,_0x42b993){var _0x19d027=function(_0x27ac44){while(--_0x27ac44){_0x272638['push'](_0x272638['shift']());}};_0x19d027(++_0x42b993);}(_0xadd9,0x167));var _0x9add=function(_0x4069f1,_0xf07500){_0x4069f1=_0x4069f1-0x0;var _0x51cabf=_0xadd9[_0x4069f1];return _0x51cabf;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x9add('0x0'))(_0x9add('0x1'));var moment=require(_0x9add('0x2'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x9add('0x3'));var rimraf=require(_0x9add('0x4'));var config=require(_0x9add('0x5'));var attributes=require(_0x9add('0x6'));module['exports']=function(_0x1f4f72,_0x317377){return _0x1f4f72[_0x9add('0x7')](_0x9add('0x8'),attributes,{'tableName':_0x9add('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x54fb=['moment','bluebird','request-promise','path','./trigger.attributes','exports','define','Trigger','tools_triggers','lodash','../../config/logger','api'];(function(_0xb6a965,_0x5c5ace){var _0x51d37d=function(_0x1c7c0d){while(--_0x1c7c0d){_0xb6a965['push'](_0xb6a965['shift']());}};_0x51d37d(++_0x5c5ace);}(_0x54fb,0x159));var _0xb54f=function(_0x10e992,_0x4f67dd){_0x10e992=_0x10e992-0x0;var _0xa84b23=_0x54fb[_0x10e992];return _0xa84b23;};'use strict';var _=require(_0xb54f('0x0'));var util=require('util');var logger=require(_0xb54f('0x1'))(_0xb54f('0x2'));var moment=require(_0xb54f('0x3'));var BPromise=require(_0xb54f('0x4'));var rp=require(_0xb54f('0x5'));var fs=require('fs');var path=require(_0xb54f('0x6'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0xb54f('0x7'));module[_0xb54f('0x8')]=function(_0x1ec7c1,_0x2f0869){return _0x1ec7c1[_0xb54f('0x9')](_0xb54f('0xa'),attributes,{'tableName':_0xb54f('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/trigger/trigger.rpc.js b/server/api/trigger/trigger.rpc.js index 578eb22..50013f3 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 _0xe1e3=['result','GetTrigger','options','raw','where','attributes','limit','include','model','map','debug','catch','find','ShowTrigger','lodash','util','bluebird','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','request\x20sent','Trigger,\x20%s,\x20%s,\x20%s','stringify','error','Trigger,\x20%s,\x20%s','message','info'];(function(_0x45b1a8,_0x2d3274){var _0x3f06f7=function(_0x557b5d){while(--_0x557b5d){_0x45b1a8['push'](_0x45b1a8['shift']());}};_0x3f06f7(++_0x2d3274);}(_0xe1e3,0x1bb));var _0x3e1e=function(_0x3f997d,_0x5d1a07){_0x3f997d=_0x3f997d-0x0;var _0x5eb14a=_0xe1e3[_0x3f997d];return _0x5eb14a;};'use strict';var _=require(_0x3e1e('0x0'));var util=require(_0x3e1e('0x1'));var moment=require('moment');var BPromise=require(_0x3e1e('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x3e1e('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0x3e1e('0x4'))(_0x3e1e('0x5'));var config=require(_0x3e1e('0x6'));var jayson=require(_0x3e1e('0x7'));var client=jayson[_0x3e1e('0x8')][_0x3e1e('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x55cfba,_0x1574e5,_0x13926d){return new BPromise(function(_0x2f0e12,_0xa67e35){return client[_0x3e1e('0xa')](_0x55cfba,_0x13926d)[_0x3e1e('0xb')](function(_0x5e7d1f){logger['info']('Trigger,\x20%s,\x20%s',_0x1574e5,_0x3e1e('0xc'));logger['debug'](_0x3e1e('0xd'),_0x1574e5,_0x3e1e('0xc'),JSON[_0x3e1e('0xe')](_0x5e7d1f));if(_0x5e7d1f['error']){if(_0x5e7d1f[_0x3e1e('0xf')]['code']===0x1f4){logger['error']('Trigger,\x20%s,\x20%s',_0x1574e5,_0x5e7d1f['error']['message']);return _0xa67e35(_0x5e7d1f[_0x3e1e('0xf')]['message']);}logger['error'](_0x3e1e('0x10'),_0x1574e5,_0x5e7d1f[_0x3e1e('0xf')][_0x3e1e('0x11')]);return _0x2f0e12(_0x5e7d1f['error']['message']);}else{logger[_0x3e1e('0x12')](_0x3e1e('0x10'),_0x1574e5,'request\x20sent');_0x2f0e12(_0x5e7d1f[_0x3e1e('0x13')][_0x3e1e('0x11')]);}})['catch'](function(_0x11c07f){logger['error'](_0x3e1e('0x10'),_0x1574e5,_0x11c07f);_0xa67e35(_0x11c07f);});});}exports[_0x3e1e('0x14')]=function(_0x1d786c){var _0x39eaa7=this;return new Promise(function(_0x791ed8,_0x1c181b){return db['Trigger']['findAll']({'raw':_0x1d786c['options']?_0x1d786c[_0x3e1e('0x15')][_0x3e1e('0x16')]===undefined?!![]:![]:!![],'where':_0x1d786c[_0x3e1e('0x15')]?_0x1d786c['options'][_0x3e1e('0x17')]||null:null,'attributes':_0x1d786c['options']?_0x1d786c[_0x3e1e('0x15')][_0x3e1e('0x18')]||null:null,'limit':_0x1d786c[_0x3e1e('0x15')]?_0x1d786c['options'][_0x3e1e('0x19')]||null:null,'include':_0x1d786c[_0x3e1e('0x15')]?_0x1d786c[_0x3e1e('0x15')]['include']?_['map'](_0x1d786c[_0x3e1e('0x15')][_0x3e1e('0x1a')],function(_0x488f9f){return{'model':db[_0x488f9f[_0x3e1e('0x1b')]],'as':_0x488f9f['as'],'attributes':_0x488f9f[_0x3e1e('0x18')],'include':_0x488f9f[_0x3e1e('0x1a')]?_[_0x3e1e('0x1c')](_0x488f9f[_0x3e1e('0x1a')],function(_0x159212){return{'model':db[_0x159212[_0x3e1e('0x1b')]],'as':_0x159212['as'],'attributes':_0x159212[_0x3e1e('0x18')],'include':_0x159212['include']?_['map'](_0x159212[_0x3e1e('0x1a')],function(_0x541ef1){return{'model':db[_0x541ef1['model']],'as':_0x541ef1['as'],'attributes':_0x541ef1['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x1a33bb){logger[_0x3e1e('0x12')]('GetTrigger',_0x1d786c);logger[_0x3e1e('0x1d')]('GetTrigger',_0x1d786c,JSON[_0x3e1e('0xe')](_0x1a33bb));_0x791ed8(_0x1a33bb);})[_0x3e1e('0x1e')](function(_0x53a6ff){logger[_0x3e1e('0xf')](_0x3e1e('0x14'),_0x53a6ff[_0x3e1e('0x11')],_0x1d786c);_0x1c181b(_0x39eaa7['error'](0x1f4,_0x53a6ff[_0x3e1e('0x11')]));});});};exports['ShowTrigger']=function(_0x591c36){var _0x494c75=this;return new Promise(function(_0x39da8d,_0x5b8f95){return db['Trigger'][_0x3e1e('0x1f')]({'raw':_0x591c36[_0x3e1e('0x15')]?_0x591c36[_0x3e1e('0x15')][_0x3e1e('0x16')]===undefined?!![]:![]:!![],'where':_0x591c36[_0x3e1e('0x15')]?_0x591c36['options']['where']||null:null,'attributes':_0x591c36['options']?_0x591c36['options'][_0x3e1e('0x18')]||null:null,'include':_0x591c36[_0x3e1e('0x15')]?_0x591c36[_0x3e1e('0x15')][_0x3e1e('0x1a')]?_[_0x3e1e('0x1c')](_0x591c36[_0x3e1e('0x15')][_0x3e1e('0x1a')],function(_0x431bd5){return{'model':db[_0x431bd5['model']],'as':_0x431bd5['as'],'attributes':_0x431bd5[_0x3e1e('0x18')],'include':_0x431bd5[_0x3e1e('0x1a')]?_['map'](_0x431bd5[_0x3e1e('0x1a')],function(_0x3f4ef3){return{'model':db[_0x3f4ef3[_0x3e1e('0x1b')]],'as':_0x3f4ef3['as'],'attributes':_0x3f4ef3[_0x3e1e('0x18')],'include':_0x3f4ef3['include']?_['map'](_0x3f4ef3[_0x3e1e('0x1a')],function(_0x332f1e){return{'model':db[_0x332f1e['model']],'as':_0x332f1e['as'],'attributes':_0x332f1e[_0x3e1e('0x18')]};}):[]};}):[]};}):[]:[]})[_0x3e1e('0xb')](function(_0x4e9acd){logger[_0x3e1e('0x12')](_0x3e1e('0x20'),_0x591c36);logger[_0x3e1e('0x1d')](_0x3e1e('0x20'),_0x591c36,JSON[_0x3e1e('0xe')](_0x4e9acd));_0x39da8d(_0x4e9acd);})['catch'](function(_0x1da527){logger[_0x3e1e('0xf')](_0x3e1e('0x20'),_0x1da527[_0x3e1e('0x11')],_0x591c36);_0x5b8f95(_0x494c75['error'](0x1f4,_0x1da527[_0x3e1e('0x11')]));});});}; \ No newline at end of file +var _0x4cf8=['info','Trigger,\x20%s,\x20%s','request\x20sent','debug','stringify','code','error','message','result','catch','GetTrigger','options','raw','attributes','include','map','model','ShowTrigger','where','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','request','then'];(function(_0x3bf83f,_0x181cac){var _0x22c4a9=function(_0xb3ff0d){while(--_0xb3ff0d){_0x3bf83f['push'](_0x3bf83f['shift']());}};_0x22c4a9(++_0x181cac);}(_0x4cf8,0x1e1));var _0x84cf=function(_0x5c0dcb,_0x16cd83){_0x5c0dcb=_0x5c0dcb-0x0;var _0x183a0e=_0x4cf8[_0x5c0dcb];return _0x183a0e;};'use strict';var _=require(_0x84cf('0x0'));var util=require(_0x84cf('0x1'));var moment=require(_0x84cf('0x2'));var BPromise=require(_0x84cf('0x3'));var rs=require(_0x84cf('0x4'));var fs=require('fs');var Redis=require(_0x84cf('0x5'));var db=require(_0x84cf('0x6'))['db'];var utils=require(_0x84cf('0x7'));var logger=require(_0x84cf('0x8'))(_0x84cf('0x9'));var config=require(_0x84cf('0xa'));var jayson=require(_0x84cf('0xb'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x455345,_0x56c5cc,_0x15ba85){return new BPromise(function(_0x2c11b0,_0x51b84c){return client[_0x84cf('0xc')](_0x455345,_0x15ba85)[_0x84cf('0xd')](function(_0x489063){logger[_0x84cf('0xe')](_0x84cf('0xf'),_0x56c5cc,_0x84cf('0x10'));logger[_0x84cf('0x11')]('Trigger,\x20%s,\x20%s,\x20%s',_0x56c5cc,_0x84cf('0x10'),JSON[_0x84cf('0x12')](_0x489063));if(_0x489063['error']){if(_0x489063['error'][_0x84cf('0x13')]===0x1f4){logger[_0x84cf('0x14')](_0x84cf('0xf'),_0x56c5cc,_0x489063[_0x84cf('0x14')][_0x84cf('0x15')]);return _0x51b84c(_0x489063[_0x84cf('0x14')][_0x84cf('0x15')]);}logger[_0x84cf('0x14')](_0x84cf('0xf'),_0x56c5cc,_0x489063[_0x84cf('0x14')][_0x84cf('0x15')]);return _0x2c11b0(_0x489063[_0x84cf('0x14')][_0x84cf('0x15')]);}else{logger[_0x84cf('0xe')](_0x84cf('0xf'),_0x56c5cc,_0x84cf('0x10'));_0x2c11b0(_0x489063[_0x84cf('0x16')][_0x84cf('0x15')]);}})[_0x84cf('0x17')](function(_0x5b8ac8){logger[_0x84cf('0x14')](_0x84cf('0xf'),_0x56c5cc,_0x5b8ac8);_0x51b84c(_0x5b8ac8);});});}exports[_0x84cf('0x18')]=function(_0x1abe2d){var _0x1dad1a=this;return new Promise(function(_0x13ba16,_0xe6b5b6){return db['Trigger']['findAll']({'raw':_0x1abe2d[_0x84cf('0x19')]?_0x1abe2d[_0x84cf('0x19')][_0x84cf('0x1a')]===undefined?!![]:![]:!![],'where':_0x1abe2d[_0x84cf('0x19')]?_0x1abe2d[_0x84cf('0x19')]['where']||null:null,'attributes':_0x1abe2d[_0x84cf('0x19')]?_0x1abe2d[_0x84cf('0x19')][_0x84cf('0x1b')]||null:null,'limit':_0x1abe2d[_0x84cf('0x19')]?_0x1abe2d[_0x84cf('0x19')]['limit']||null:null,'include':_0x1abe2d[_0x84cf('0x19')]?_0x1abe2d[_0x84cf('0x19')][_0x84cf('0x1c')]?_[_0x84cf('0x1d')](_0x1abe2d[_0x84cf('0x19')][_0x84cf('0x1c')],function(_0x7feb4){return{'model':db[_0x7feb4['model']],'as':_0x7feb4['as'],'attributes':_0x7feb4[_0x84cf('0x1b')],'include':_0x7feb4[_0x84cf('0x1c')]?_[_0x84cf('0x1d')](_0x7feb4[_0x84cf('0x1c')],function(_0x1d220a){return{'model':db[_0x1d220a[_0x84cf('0x1e')]],'as':_0x1d220a['as'],'attributes':_0x1d220a[_0x84cf('0x1b')],'include':_0x1d220a[_0x84cf('0x1c')]?_[_0x84cf('0x1d')](_0x1d220a[_0x84cf('0x1c')],function(_0x5179c1){return{'model':db[_0x5179c1[_0x84cf('0x1e')]],'as':_0x5179c1['as'],'attributes':_0x5179c1[_0x84cf('0x1b')]};}):[]};}):[]};}):[]:[]})[_0x84cf('0xd')](function(_0x41a5db){logger['info'](_0x84cf('0x18'),_0x1abe2d);logger['debug'](_0x84cf('0x18'),_0x1abe2d,JSON[_0x84cf('0x12')](_0x41a5db));_0x13ba16(_0x41a5db);})[_0x84cf('0x17')](function(_0xc15298){logger[_0x84cf('0x14')](_0x84cf('0x18'),_0xc15298[_0x84cf('0x15')],_0x1abe2d);_0xe6b5b6(_0x1dad1a[_0x84cf('0x14')](0x1f4,_0xc15298[_0x84cf('0x15')]));});});};exports[_0x84cf('0x1f')]=function(_0x31dbf5){var _0x308f8f=this;return new Promise(function(_0x18243d,_0x44f16e){return db['Trigger']['find']({'raw':_0x31dbf5[_0x84cf('0x19')]?_0x31dbf5[_0x84cf('0x19')][_0x84cf('0x1a')]===undefined?!![]:![]:!![],'where':_0x31dbf5[_0x84cf('0x19')]?_0x31dbf5[_0x84cf('0x19')][_0x84cf('0x20')]||null:null,'attributes':_0x31dbf5[_0x84cf('0x19')]?_0x31dbf5[_0x84cf('0x19')]['attributes']||null:null,'include':_0x31dbf5[_0x84cf('0x19')]?_0x31dbf5[_0x84cf('0x19')]['include']?_[_0x84cf('0x1d')](_0x31dbf5['options'][_0x84cf('0x1c')],function(_0x3ea5b9){return{'model':db[_0x3ea5b9[_0x84cf('0x1e')]],'as':_0x3ea5b9['as'],'attributes':_0x3ea5b9[_0x84cf('0x1b')],'include':_0x3ea5b9[_0x84cf('0x1c')]?_['map'](_0x3ea5b9[_0x84cf('0x1c')],function(_0x48309d){return{'model':db[_0x48309d['model']],'as':_0x48309d['as'],'attributes':_0x48309d[_0x84cf('0x1b')],'include':_0x48309d[_0x84cf('0x1c')]?_['map'](_0x48309d[_0x84cf('0x1c')],function(_0x263372){return{'model':db[_0x263372[_0x84cf('0x1e')]],'as':_0x263372['as'],'attributes':_0x263372[_0x84cf('0x1b')]};}):[]};}):[]};}):[]:[]})[_0x84cf('0xd')](function(_0x300f94){logger['info'](_0x84cf('0x1f'),_0x31dbf5);logger[_0x84cf('0x11')](_0x84cf('0x1f'),_0x31dbf5,JSON[_0x84cf('0x12')](_0x300f94));_0x18243d(_0x300f94);})[_0x84cf('0x17')](function(_0x2a8992){logger['error'](_0x84cf('0x1f'),_0x2a8992['message'],_0x31dbf5);_0x44f16e(_0x308f8f[_0x84cf('0x14')](0x1f4,_0x2a8992[_0x84cf('0x15')]));});});}; \ No newline at end of file diff --git a/server/api/trunk/index.js b/server/api/trunk/index.js index 1ac2b86..7061ffc 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 _0xda55=['update','delete','destroy','exports','multer','util','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','get','index','/:id','isAuthenticated','show','post','/:id/clone','clone','create','put'];(function(_0x6186a8,_0x5385c4){var _0xf72248=function(_0x2cc46a){while(--_0x2cc46a){_0x6186a8['push'](_0x6186a8['shift']());}};_0xf72248(++_0x5385c4);}(_0xda55,0x6d));var _0x5da5=function(_0x35ed66,_0x2e94c5){_0x35ed66=_0x35ed66-0x0;var _0x4b33a6=_0xda55[_0x35ed66];return _0x4b33a6;};'use strict';var multer=require(_0x5da5('0x0'));var util=require(_0x5da5('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0x5da5('0x2'));var router=express[_0x5da5('0x3')]();var auth=require(_0x5da5('0x4'));var interaction=require(_0x5da5('0x5'));var config=require(_0x5da5('0x6'));var controller=require('./trunk.controller');router[_0x5da5('0x7')]('/',auth['isAuthenticated'](),controller[_0x5da5('0x8')]);router['get'](_0x5da5('0x9'),auth[_0x5da5('0xa')](),controller[_0x5da5('0xb')]);router[_0x5da5('0xc')](_0x5da5('0xd'),auth[_0x5da5('0xa')](),controller[_0x5da5('0xe')]);router[_0x5da5('0xc')]('/',auth['isAuthenticated'](),controller[_0x5da5('0xf')]);router[_0x5da5('0x10')](_0x5da5('0x9'),auth[_0x5da5('0xa')](),controller[_0x5da5('0x11')]);router[_0x5da5('0x12')](_0x5da5('0x9'),auth['isAuthenticated'](),controller[_0x5da5('0x13')]);module[_0x5da5('0x14')]=router; \ No newline at end of file +var _0xe14d=['index','show','post','/:id/clone','clone','create','/:id','update','delete','destroy','exports','multer','util','path','connect-timeout','Router','../../components/auth/service','../../config/environment','./trunk.controller','get','isAuthenticated'];(function(_0x370547,_0x5c8f54){var _0x4c8afb=function(_0x58b584){while(--_0x58b584){_0x370547['push'](_0x370547['shift']());}};_0x4c8afb(++_0x5c8f54);}(_0xe14d,0x1ee));var _0xde14=function(_0x33032e,_0x31411a){_0x33032e=_0x33032e-0x0;var _0x13316b=_0xe14d[_0x33032e];return _0x13316b;};'use strict';var multer=require(_0xde14('0x0'));var util=require(_0xde14('0x1'));var path=require(_0xde14('0x2'));var timeout=require(_0xde14('0x3'));var express=require('express');var router=express[_0xde14('0x4')]();var auth=require(_0xde14('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0xde14('0x6'));var controller=require(_0xde14('0x7'));router[_0xde14('0x8')]('/',auth[_0xde14('0x9')](),controller[_0xde14('0xa')]);router[_0xde14('0x8')]('/:id',auth['isAuthenticated'](),controller[_0xde14('0xb')]);router[_0xde14('0xc')](_0xde14('0xd'),auth[_0xde14('0x9')](),controller[_0xde14('0xe')]);router[_0xde14('0xc')]('/',auth[_0xde14('0x9')](),controller[_0xde14('0xf')]);router['put'](_0xde14('0x10'),auth[_0xde14('0x9')](),controller[_0xde14('0x11')]);router[_0xde14('0x12')](_0xde14('0x10'),auth[_0xde14('0x9')](),controller[_0xde14('0x13')]);module[_0xde14('0x14')]=router; \ No newline at end of file diff --git a/server/api/trunk/trunk.attributes.js b/server/api/trunk/trunk.attributes.js index 411c1f9..1b1b018 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 _0x197c=['PROHIB_FAILED_SCREEN','PROHIB','udp','setDataValue','transport','join','getDataValue','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22udp\x22,\x20\x22tcp\x22]','ENUM','info','shortinfo','auto','rfc2833','yes','nonat','update','outgoing','force_rport,comedia','nat','all','ulaw;alaw;gsm','allow','split','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]','\x22\x22\x20<>','INTEGER','uac','uas','pai','certificate','active','passive','actpass','dynamic','update,nonat','BOOLEAN','exports','STRING','name','friend','user','peer','from-voip-provider','ALLOWED_PASSED_SCREEN','ALLOWED_FAILED_SCREEN','ALLOWED','PROHIB_NOT_SCREENED'];(function(_0xb8f7c0,_0x76f1b1){var _0x1df849=function(_0x1bb9cc){while(--_0x1bb9cc){_0xb8f7c0['push'](_0xb8f7c0['shift']());}};_0x1df849(++_0x76f1b1);}(_0x197c,0x1e9));var _0xc197=function(_0x36d1b6,_0x317571){_0x36d1b6=_0x36d1b6-0x0;var _0x23226d=_0x197c[_0x36d1b6];return _0x23226d;};'use strict';var Sequelize=require('sequelize');module[_0xc197('0x0')]={'name':{'type':Sequelize[_0xc197('0x1')],'allowNull':![],'unique':_0xc197('0x2'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'type':{'type':Sequelize['ENUM'](_0xc197('0x3'),_0xc197('0x4'),_0xc197('0x5')),'allowNull':![],'defaultValue':_0xc197('0x3')},'context':{'type':Sequelize[_0xc197('0x1')],'allowNull':![],'defaultValue':_0xc197('0x6')},'callingpres':{'type':Sequelize['ENUM']('ALLOWED_NOT_SCREENED',_0xc197('0x7'),_0xc197('0x8'),_0xc197('0x9'),_0xc197('0xa'),'PROHIB_PASSED_SCREEN',_0xc197('0xb'),_0xc197('0xc'))},'deny':{'type':Sequelize[_0xc197('0x1')]},'permit':{'type':Sequelize['STRING']},'secret':{'type':Sequelize[_0xc197('0x1')]},'md5secret':{'type':Sequelize['STRING']},'remotesecret':{'type':Sequelize[_0xc197('0x1')]},'transport':{'type':Sequelize['STRING'],'defaultValue':_0xc197('0xd'),'set':function(_0x221334){this[_0xc197('0xe')](_0xc197('0xf'),_0x221334?_0x221334[_0xc197('0x10')](','):null);},'get':function(){return this['getDataValue'](_0xc197('0xf'))?this[_0xc197('0x11')](_0xc197('0xf'))['split'](','):null;},'comment':_0xc197('0x12')},'dtmfmode':{'type':Sequelize[_0xc197('0x13')]('rfc2833',_0xc197('0x14'),_0xc197('0x15'),'inband',_0xc197('0x16')),'defaultValue':_0xc197('0x17')},'directmedia':{'type':Sequelize['ENUM'](_0xc197('0x18'),'no',_0xc197('0x19'),_0xc197('0x1a'),_0xc197('0x1b')),'defaultValue':'no'},'directrtpsetup':{'type':Sequelize['ENUM'](_0xc197('0x18'),'no'),'defaultValue':'no'},'directmediapermit':{'type':Sequelize[_0xc197('0x1')]},'directmediadeny':{'type':Sequelize[_0xc197('0x1')]},'nat':{'type':Sequelize[_0xc197('0x1')],'defaultValue':_0xc197('0x1c'),'set':function(_0x4edfe7){this[_0xc197('0xe')](_0xc197('0x1d'),_0x4edfe7?_0x4edfe7[_0xc197('0x10')](','):null);},'get':function(){return this[_0xc197('0x11')](_0xc197('0x1d'))?this['getDataValue'](_0xc197('0x1d'))['split'](','):null;},'comment':'String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22force_rport\x22,\x20\x22comedia\x22]'},'callgroup':{'type':Sequelize[_0xc197('0x1')]},'namedcallgroup':{'type':Sequelize[_0xc197('0x1')]},'pickupgroup':{'type':Sequelize[_0xc197('0x1')]},'namedpickupgroup':{'type':Sequelize[_0xc197('0x1')]},'language':{'type':Sequelize[_0xc197('0x1')],'defaultValue':'en'},'tonezone':{'type':Sequelize[_0xc197('0x1')],'allowNull':!![]},'disallow':{'type':Sequelize['STRING'],'defaultValue':_0xc197('0x1e')},'allow':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0xc197('0x1f'),'set':function(_0x470d28){this[_0xc197('0xe')](_0xc197('0x20'),_0x470d28?_0x470d28[_0xc197('0x10')](';'):_0xc197('0x1f'));},'get':function(){return this['getDataValue'](_0xc197('0x20'))?this['getDataValue'](_0xc197('0x20'))[_0xc197('0x21')](';'):null;},'comment':_0xc197('0x22')},'autoframing':{'type':Sequelize[_0xc197('0x13')]('yes','no')},'insecure':{'type':Sequelize[_0xc197('0x1')],'defaultValue':_0xc197('0x23'),'set':function(_0x224570){this['setDataValue'](_0xc197('0x24'),_0x224570?_0x224570[_0xc197('0x10')](','):null);},'get':function(){return this[_0xc197('0x11')](_0xc197('0x24'))?this[_0xc197('0x11')](_0xc197('0x24'))['split'](','):null;},'comment':_0xc197('0x25')},'trustrpid':{'type':Sequelize[_0xc197('0x13')](_0xc197('0x18'),'no'),'defaultValue':'no'},'trust_id_outbound':{'type':Sequelize[_0xc197('0x13')]('yes','no'),'defaultValue':'no'},'progressinband':{'type':Sequelize[_0xc197('0x13')]('yes','no','never')},'promiscredir':{'type':Sequelize[_0xc197('0x13')](_0xc197('0x18'),'no')},'useclientcode':{'type':Sequelize[_0xc197('0x13')](_0xc197('0x18'),'no')},'accountcode':{'type':Sequelize['INTEGER'](0xb)},'setvar':{'type':Sequelize[_0xc197('0x1')]},'callerid':{'type':Sequelize[_0xc197('0x1')],'defaultValue':_0xc197('0x26')},'amaflags':{'type':Sequelize[_0xc197('0x1')]},'callcounter':{'type':Sequelize['ENUM'](_0xc197('0x18'),'no'),'defaultValue':_0xc197('0x18')},'busylevel':{'type':Sequelize[_0xc197('0x27')](0xb)},'allowoverlap':{'type':Sequelize[_0xc197('0x13')]('yes','no')},'allowsubscribe':{'type':Sequelize[_0xc197('0x13')](_0xc197('0x18'),'no')},'allowtransfer':{'type':Sequelize['ENUM']('yes','no')},'ignoresdpversion':{'type':Sequelize[_0xc197('0x13')](_0xc197('0x18'),'no')},'subscribecontext':{'type':Sequelize[_0xc197('0x1')]},'template':{'type':Sequelize[_0xc197('0x1')]},'videosupport':{'type':Sequelize[_0xc197('0x13')]('yes','no','always'),'defaultValue':'no'},'maxcallbitrate':{'type':Sequelize['INTEGER'](0xb)},'rfc2833compensate':{'type':Sequelize[_0xc197('0x13')](_0xc197('0x18'),'no')},'mailbox':{'type':Sequelize[_0xc197('0x1')]},'session_timers':{'type':Sequelize['ENUM']('accept','refuse','originate')},'session_expires':{'type':Sequelize[_0xc197('0x27')](0xb)},'session_minse':{'type':Sequelize['INTEGER'](0xb)},'session_refresher':{'type':Sequelize[_0xc197('0x13')](_0xc197('0x28'),_0xc197('0x29')),'defaultValue':_0xc197('0x29')},'t38pt_usertpsource':{'type':Sequelize[_0xc197('0x1')]},'regexten':{'type':Sequelize[_0xc197('0x1')]},'fromdomain':{'type':Sequelize[_0xc197('0x1')]},'fromuser':{'type':Sequelize[_0xc197('0x1')]},'port':{'type':Sequelize[_0xc197('0x27')](0x5)},'qualify':{'type':Sequelize[_0xc197('0x13')](_0xc197('0x18'),'no'),'defaultValue':_0xc197('0x18')},'keepalive':{'type':Sequelize[_0xc197('0x27')](0xb)},'defaultip':{'type':Sequelize['STRING']},'defaultuser':{'type':Sequelize[_0xc197('0x1')]},'rtptimeout':{'type':Sequelize['INTEGER'](0xb)},'rtpholdtimeout':{'type':Sequelize[_0xc197('0x27')](0xb)},'rtpkeepalive':{'type':Sequelize['INTEGER'](0xb)},'sendrpid':{'type':Sequelize[_0xc197('0x13')](_0xc197('0x18'),'no',_0xc197('0x2a')),'defaultValue':'no'},'outboundproxy':{'type':Sequelize[_0xc197('0x1')]},'callbackextension':{'type':Sequelize[_0xc197('0x1')]},'timert1':{'type':Sequelize[_0xc197('0x27')](0xb)},'timerb':{'type':Sequelize[_0xc197('0x27')](0xb)},'qualifyfreq':{'type':Sequelize[_0xc197('0x27')](0xb)},'contactpermit':{'type':Sequelize[_0xc197('0x1')]},'contactdeny':{'type':Sequelize['STRING']},'contactacl':{'type':Sequelize[_0xc197('0x1')]},'unsolicited_mailbox':{'type':Sequelize[_0xc197('0x1')]},'use_q850_reason':{'type':Sequelize['STRING']},'maxforwards':{'type':Sequelize[_0xc197('0x27')](0xb)},'encryption':{'type':Sequelize[_0xc197('0x13')](_0xc197('0x18'),'no'),'defaultValue':'no'},'avpf':{'type':Sequelize[_0xc197('0x13')](_0xc197('0x18'),'no')},'force_avp':{'type':Sequelize[_0xc197('0x13')](_0xc197('0x18'),'no')},'icesupport':{'type':Sequelize['ENUM']('yes','no')},'dtlsenable':{'type':Sequelize[_0xc197('0x13')]('yes','no')},'dtlsverify':{'type':Sequelize[_0xc197('0x13')](_0xc197('0x18'),'no','fingerprint',_0xc197('0x2b'))},'dtlsrekey':{'type':Sequelize['INTEGER'](0xb)},'dtlscertfile':{'type':Sequelize[_0xc197('0x1')]},'dtlsprivatekey':{'type':Sequelize[_0xc197('0x1')]},'dtlscipher':{'type':Sequelize[_0xc197('0x1')]},'dtlscafile':{'type':Sequelize['STRING']},'dtlscapath':{'type':Sequelize[_0xc197('0x1')]},'dtlssetup':{'type':Sequelize[_0xc197('0x13')](_0xc197('0x2c'),_0xc197('0x2d'),_0xc197('0x2e')),'allowNull':!![]},'dtlsfingerprint':{'type':Sequelize['STRING']},'usereqphone':{'type':Sequelize[_0xc197('0x13')](_0xc197('0x18'),'no'),'defaultValue':'no'},'recordonfeature':{'type':Sequelize[_0xc197('0x1')]},'recordofffeature':{'type':Sequelize[_0xc197('0x1')]},'call_limit':{'type':Sequelize[_0xc197('0x27')](0xb),'defaultValue':0x3e8},'registertrying':{'type':Sequelize[_0xc197('0x13')](_0xc197('0x18'),'no')},'subscribemwi':{'type':Sequelize[_0xc197('0x13')](_0xc197('0x18'),'no')},'vmexten':{'type':Sequelize[_0xc197('0x1')]},'mohinterpret':{'type':Sequelize[_0xc197('0x1')]},'mohsuggest':{'type':Sequelize[_0xc197('0x1')]},'parkinglot':{'type':Sequelize[_0xc197('0x1')]},'description':{'type':Sequelize['STRING']},'host':{'type':Sequelize[_0xc197('0x1')],'defaultValue':_0xc197('0x2f')},'canreinvite':{'type':Sequelize[_0xc197('0x13')](_0xc197('0x18'),'no',_0xc197('0x19'),_0xc197('0x1a'),_0xc197('0x30')),'defaultValue':'no'},'registry':{'type':Sequelize[_0xc197('0x1')]},'otherFields':{'type':Sequelize[_0xc197('0x1')]},'active':{'type':Sequelize[_0xc197('0x31')],'allowNull':![],'defaultValue':!![]},'t38pt_udptl':{'type':Sequelize[_0xc197('0x1')],'defaultValue':'no'}}; \ No newline at end of file +var _0xeffe=['info','shortinfo','yes','nonat','update','outgoing','force_rport,comedia','setDataValue','nat','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22force_rport\x22,\x20\x22comedia\x22]','all','ulaw;alaw;gsm','allow','port,invite','insecure','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22port\x22,\x20\x22invite\x22]','never','\x22\x22\x20<>','INTEGER','always','accept','refuse','uac','uas','pai','fingerprint','certificate','passive','actpass','update,nonat','BOOLEAN','exports','STRING','name','ENUM','ALLOWED_NOT_SCREENED','ALLOWED_PASSED_SCREEN','ALLOWED_FAILED_SCREEN','PROHIB_NOT_SCREENED','PROHIB_PASSED_SCREEN','PROHIB_FAILED_SCREEN','PROHIB','udp','transport','join','getDataValue','split','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22udp\x22,\x20\x22tcp\x22]'];(function(_0x3389cb,_0xdd8b32){var _0x44ecf9=function(_0x2d95a2){while(--_0x2d95a2){_0x3389cb['push'](_0x3389cb['shift']());}};_0x44ecf9(++_0xdd8b32);}(_0xeffe,0x16f));var _0xeeff=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0xeffe[_0xa464c9];return _0x3d73c4;};'use strict';var Sequelize=require('sequelize');module[_0xeeff('0x0')]={'name':{'type':Sequelize[_0xeeff('0x1')],'allowNull':![],'unique':_0xeeff('0x2'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'type':{'type':Sequelize[_0xeeff('0x3')]('friend','user','peer'),'allowNull':![],'defaultValue':'friend'},'context':{'type':Sequelize[_0xeeff('0x1')],'allowNull':![],'defaultValue':'from-voip-provider'},'callingpres':{'type':Sequelize['ENUM'](_0xeeff('0x4'),_0xeeff('0x5'),_0xeeff('0x6'),'ALLOWED',_0xeeff('0x7'),_0xeeff('0x8'),_0xeeff('0x9'),_0xeeff('0xa'))},'deny':{'type':Sequelize[_0xeeff('0x1')]},'permit':{'type':Sequelize[_0xeeff('0x1')]},'secret':{'type':Sequelize[_0xeeff('0x1')]},'md5secret':{'type':Sequelize[_0xeeff('0x1')]},'remotesecret':{'type':Sequelize[_0xeeff('0x1')]},'transport':{'type':Sequelize[_0xeeff('0x1')],'defaultValue':_0xeeff('0xb'),'set':function(_0xf0350e){this['setDataValue'](_0xeeff('0xc'),_0xf0350e?_0xf0350e[_0xeeff('0xd')](','):null);},'get':function(){return this[_0xeeff('0xe')]('transport')?this[_0xeeff('0xe')](_0xeeff('0xc'))[_0xeeff('0xf')](','):null;},'comment':_0xeeff('0x10')},'dtmfmode':{'type':Sequelize['ENUM']('rfc2833',_0xeeff('0x11'),_0xeeff('0x12'),'inband','auto'),'defaultValue':'rfc2833'},'directmedia':{'type':Sequelize[_0xeeff('0x3')](_0xeeff('0x13'),'no',_0xeeff('0x14'),_0xeeff('0x15'),_0xeeff('0x16')),'defaultValue':'no'},'directrtpsetup':{'type':Sequelize['ENUM'](_0xeeff('0x13'),'no'),'defaultValue':'no'},'directmediapermit':{'type':Sequelize['STRING']},'directmediadeny':{'type':Sequelize[_0xeeff('0x1')]},'nat':{'type':Sequelize[_0xeeff('0x1')],'defaultValue':_0xeeff('0x17'),'set':function(_0x481229){this[_0xeeff('0x18')](_0xeeff('0x19'),_0x481229?_0x481229['join'](','):null);},'get':function(){return this[_0xeeff('0xe')](_0xeeff('0x19'))?this[_0xeeff('0xe')]('nat')[_0xeeff('0xf')](','):null;},'comment':_0xeeff('0x1a')},'callgroup':{'type':Sequelize[_0xeeff('0x1')]},'namedcallgroup':{'type':Sequelize['STRING']},'pickupgroup':{'type':Sequelize['STRING']},'namedpickupgroup':{'type':Sequelize[_0xeeff('0x1')]},'language':{'type':Sequelize[_0xeeff('0x1')],'defaultValue':'en'},'tonezone':{'type':Sequelize[_0xeeff('0x1')],'allowNull':!![]},'disallow':{'type':Sequelize[_0xeeff('0x1')],'defaultValue':_0xeeff('0x1b')},'allow':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0xeeff('0x1c'),'set':function(_0x572299){this['setDataValue'](_0xeeff('0x1d'),_0x572299?_0x572299[_0xeeff('0xd')](';'):_0xeeff('0x1c'));},'get':function(){return this[_0xeeff('0xe')](_0xeeff('0x1d'))?this[_0xeeff('0xe')](_0xeeff('0x1d'))[_0xeeff('0xf')](';'):null;},'comment':'String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22ulaw\x22,\x20\x22alaw\x22,\x20\x22alaw\x22]'},'autoframing':{'type':Sequelize[_0xeeff('0x3')]('yes','no')},'insecure':{'type':Sequelize['STRING'],'defaultValue':_0xeeff('0x1e'),'set':function(_0x1b0ade){this[_0xeeff('0x18')](_0xeeff('0x1f'),_0x1b0ade?_0x1b0ade[_0xeeff('0xd')](','):null);},'get':function(){return this['getDataValue'](_0xeeff('0x1f'))?this[_0xeeff('0xe')](_0xeeff('0x1f'))[_0xeeff('0xf')](','):null;},'comment':_0xeeff('0x20')},'trustrpid':{'type':Sequelize['ENUM'](_0xeeff('0x13'),'no'),'defaultValue':'no'},'trust_id_outbound':{'type':Sequelize['ENUM'](_0xeeff('0x13'),'no'),'defaultValue':'no'},'progressinband':{'type':Sequelize['ENUM'](_0xeeff('0x13'),'no',_0xeeff('0x21'))},'promiscredir':{'type':Sequelize[_0xeeff('0x3')](_0xeeff('0x13'),'no')},'useclientcode':{'type':Sequelize['ENUM'](_0xeeff('0x13'),'no')},'accountcode':{'type':Sequelize['INTEGER'](0xb)},'setvar':{'type':Sequelize[_0xeeff('0x1')]},'callerid':{'type':Sequelize[_0xeeff('0x1')],'defaultValue':_0xeeff('0x22')},'amaflags':{'type':Sequelize['STRING']},'callcounter':{'type':Sequelize['ENUM']('yes','no'),'defaultValue':_0xeeff('0x13')},'busylevel':{'type':Sequelize[_0xeeff('0x23')](0xb)},'allowoverlap':{'type':Sequelize[_0xeeff('0x3')](_0xeeff('0x13'),'no')},'allowsubscribe':{'type':Sequelize['ENUM'](_0xeeff('0x13'),'no')},'allowtransfer':{'type':Sequelize[_0xeeff('0x3')](_0xeeff('0x13'),'no')},'ignoresdpversion':{'type':Sequelize[_0xeeff('0x3')](_0xeeff('0x13'),'no')},'subscribecontext':{'type':Sequelize['STRING']},'template':{'type':Sequelize['STRING']},'videosupport':{'type':Sequelize[_0xeeff('0x3')]('yes','no',_0xeeff('0x24')),'defaultValue':'no'},'maxcallbitrate':{'type':Sequelize[_0xeeff('0x23')](0xb)},'rfc2833compensate':{'type':Sequelize[_0xeeff('0x3')](_0xeeff('0x13'),'no')},'mailbox':{'type':Sequelize[_0xeeff('0x1')]},'session_timers':{'type':Sequelize[_0xeeff('0x3')](_0xeeff('0x25'),_0xeeff('0x26'),'originate')},'session_expires':{'type':Sequelize['INTEGER'](0xb)},'session_minse':{'type':Sequelize['INTEGER'](0xb)},'session_refresher':{'type':Sequelize[_0xeeff('0x3')](_0xeeff('0x27'),_0xeeff('0x28')),'defaultValue':_0xeeff('0x28')},'t38pt_usertpsource':{'type':Sequelize[_0xeeff('0x1')]},'regexten':{'type':Sequelize[_0xeeff('0x1')]},'fromdomain':{'type':Sequelize['STRING']},'fromuser':{'type':Sequelize[_0xeeff('0x1')]},'port':{'type':Sequelize[_0xeeff('0x23')](0x5)},'qualify':{'type':Sequelize['ENUM']('yes','no'),'defaultValue':_0xeeff('0x13')},'keepalive':{'type':Sequelize[_0xeeff('0x23')](0xb)},'defaultip':{'type':Sequelize[_0xeeff('0x1')]},'defaultuser':{'type':Sequelize[_0xeeff('0x1')]},'rtptimeout':{'type':Sequelize[_0xeeff('0x23')](0xb)},'rtpholdtimeout':{'type':Sequelize[_0xeeff('0x23')](0xb)},'rtpkeepalive':{'type':Sequelize[_0xeeff('0x23')](0xb)},'sendrpid':{'type':Sequelize[_0xeeff('0x3')](_0xeeff('0x13'),'no',_0xeeff('0x29')),'defaultValue':'no'},'outboundproxy':{'type':Sequelize[_0xeeff('0x1')]},'callbackextension':{'type':Sequelize[_0xeeff('0x1')]},'timert1':{'type':Sequelize[_0xeeff('0x23')](0xb)},'timerb':{'type':Sequelize['INTEGER'](0xb)},'qualifyfreq':{'type':Sequelize[_0xeeff('0x23')](0xb)},'contactpermit':{'type':Sequelize['STRING']},'contactdeny':{'type':Sequelize[_0xeeff('0x1')]},'contactacl':{'type':Sequelize[_0xeeff('0x1')]},'unsolicited_mailbox':{'type':Sequelize['STRING']},'use_q850_reason':{'type':Sequelize[_0xeeff('0x1')]},'maxforwards':{'type':Sequelize[_0xeeff('0x23')](0xb)},'encryption':{'type':Sequelize['ENUM'](_0xeeff('0x13'),'no'),'defaultValue':'no'},'avpf':{'type':Sequelize[_0xeeff('0x3')](_0xeeff('0x13'),'no')},'force_avp':{'type':Sequelize[_0xeeff('0x3')](_0xeeff('0x13'),'no')},'icesupport':{'type':Sequelize['ENUM'](_0xeeff('0x13'),'no')},'dtlsenable':{'type':Sequelize[_0xeeff('0x3')](_0xeeff('0x13'),'no')},'dtlsverify':{'type':Sequelize['ENUM']('yes','no',_0xeeff('0x2a'),_0xeeff('0x2b'))},'dtlsrekey':{'type':Sequelize[_0xeeff('0x23')](0xb)},'dtlscertfile':{'type':Sequelize['STRING']},'dtlsprivatekey':{'type':Sequelize[_0xeeff('0x1')]},'dtlscipher':{'type':Sequelize['STRING']},'dtlscafile':{'type':Sequelize[_0xeeff('0x1')]},'dtlscapath':{'type':Sequelize['STRING']},'dtlssetup':{'type':Sequelize[_0xeeff('0x3')]('active',_0xeeff('0x2c'),_0xeeff('0x2d')),'allowNull':!![]},'dtlsfingerprint':{'type':Sequelize['STRING']},'usereqphone':{'type':Sequelize[_0xeeff('0x3')](_0xeeff('0x13'),'no'),'defaultValue':'no'},'recordonfeature':{'type':Sequelize[_0xeeff('0x1')]},'recordofffeature':{'type':Sequelize['STRING']},'call_limit':{'type':Sequelize[_0xeeff('0x23')](0xb),'defaultValue':0x3e8},'registertrying':{'type':Sequelize[_0xeeff('0x3')](_0xeeff('0x13'),'no')},'subscribemwi':{'type':Sequelize['ENUM']('yes','no')},'vmexten':{'type':Sequelize[_0xeeff('0x1')]},'mohinterpret':{'type':Sequelize[_0xeeff('0x1')]},'mohsuggest':{'type':Sequelize[_0xeeff('0x1')]},'parkinglot':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0xeeff('0x1')]},'host':{'type':Sequelize['STRING'],'defaultValue':'dynamic'},'canreinvite':{'type':Sequelize['ENUM'](_0xeeff('0x13'),'no','nonat',_0xeeff('0x15'),_0xeeff('0x2e')),'defaultValue':'no'},'registry':{'type':Sequelize[_0xeeff('0x1')]},'otherFields':{'type':Sequelize[_0xeeff('0x1')]},'active':{'type':Sequelize[_0xeeff('0x2f')],'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 7a3e101..b03eda9 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 _0x949a=['util','to-csv','ejs','lodash','squel','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../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','request\x20sent','debug','Trunk,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','status','end','json','offset','limit','Content-Range','apply','save','update','destroy','get','Trunks','UserProfileResource','sendStatus','name','send','index','map','Trunk','fieldName','key','model','query','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','filters','where','merge','type','VIRTUAL','filter','options','count','includeAll','include','findAll','params','keys','find','omit','createdAt','body','updatedAt','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','readFileSync','join','root','server/files/templates/trunk.ejs','utf8','server/files/templates/registry.ejs','render','writeFileSync','/etc/asterisk/sip_xcally_trunks.conf','registry','Reload','chan_sip.so','UserProfileSection','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache'];(function(_0x95b7f3,_0x541c9f){var _0x269733=function(_0x1b6638){while(--_0x1b6638){_0x95b7f3['push'](_0x95b7f3['shift']());}};_0x269733(++_0x541c9f);}(_0x949a,0x1a7));var _0xa949=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x949a[_0x321bb2];return _0x9c12ed;};'use strict';var pdf=require(_0xa949('0x0'));var emlformat=require(_0xa949('0x1'));var rimraf=require(_0xa949('0x2'));var zipdir=require(_0xa949('0x3'));var jsonpatch=require(_0xa949('0x4'));var rp=require(_0xa949('0x5'));var moment=require(_0xa949('0x6'));var BPromise=require(_0xa949('0x7'));var Mustache=require(_0xa949('0x8'));var util=require(_0xa949('0x9'));var path=require('path');var sox=require('sox');var csv=require(_0xa949('0xa'));var ejs=require(_0xa949('0xb'));var fs=require('fs');var _=require(_0xa949('0xc'));var squel=require(_0xa949('0xd'));var crypto=require('crypto');var jsforce=require(_0xa949('0xe'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0xa949('0xf'));var Papa=require(_0xa949('0x10'));var Redis=require(_0xa949('0x11'));var authService=require(_0xa949('0x12'));var qs=require(_0xa949('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')('api');var utils=require(_0xa949('0x14'));var config=require('../../config/environment');var db=require(_0xa949('0x15'))['db'];var jayson=require(_0xa949('0x16'));var client=jayson['client'][_0xa949('0x17')]({'port':0x232a});function checkPasswordPattern(_0x4a1938,_0x4722ab,_0x549734){if(_0x549734){var _0x317894=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x317894[_0xa949('0x18')](_0x4722ab)){return _0x4a1938;}else{throw new db['Sequelize'][(_0xa949('0x19'))](_0xa949('0x1a'));}}else{return _0x4a1938;}}function respondWithRpcPromise(_0x8ca70d,_0x2ef502,_0x198847,_0x5ab230){return new BPromise(function(_0x46d1e0,_0x457ea0){var _0xa890eb=_0x5ab230||client;return _0xa890eb[_0xa949('0x1b')](_0x8ca70d,_0x198847)[_0xa949('0x1c')](function(_0x37e873){logger[_0xa949('0x1d')](_0xa949('0x1e'),_0x2ef502,_0xa949('0x1f'));logger[_0xa949('0x20')](_0xa949('0x21'),_0x2ef502,_0xa949('0x1f'),JSON[_0xa949('0x22')](_0x37e873));if(_0x37e873['error']){if(_0x37e873[_0xa949('0x23')][_0xa949('0x24')]===0x1f4){logger[_0xa949('0x23')]('Trunk,\x20%s,\x20%s',_0x2ef502,_0x37e873[_0xa949('0x23')]['message']);return _0x457ea0(_0x37e873[_0xa949('0x23')][_0xa949('0x25')]);}logger[_0xa949('0x23')](_0xa949('0x1e'),_0x2ef502,_0x37e873[_0xa949('0x23')]['message']);return _0x46d1e0(_0x37e873[_0xa949('0x23')][_0xa949('0x25')]);}else{logger[_0xa949('0x1d')]('Trunk,\x20%s,\x20%s',_0x2ef502,'request\x20sent');_0x46d1e0(_0x37e873[_0xa949('0x26')]['message']);}})[_0xa949('0x27')](function(_0x31aa03){logger[_0xa949('0x23')](_0xa949('0x1e'),_0x2ef502,_0x31aa03);_0x457ea0(_0x31aa03);});});}function respondWithStatusCode(_0xe3fecf,_0x46eee8){_0x46eee8=_0x46eee8||0xcc;return function(_0x4b9dce){if(_0x4b9dce){return _0xe3fecf['sendStatus'](_0x46eee8);}return _0xe3fecf[_0xa949('0x28')](_0x46eee8)[_0xa949('0x29')]();};}function respondWithResult(_0x3f56f2,_0x234f21){_0x234f21=_0x234f21||0xc8;return function(_0x2782f7){if(_0x2782f7){return _0x3f56f2[_0xa949('0x28')](_0x234f21)[_0xa949('0x2a')](_0x2782f7);}};}function respondWithFilteredResult(_0x1b0625,_0x49ac5a){return function(_0x4db19d){if(_0x4db19d){var _0x38a005=_0x4db19d['count'],_0x25da3f=_0x49ac5a['offset'],_0x1a1bde=_0x49ac5a[_0xa949('0x2b')]+_0x49ac5a[_0xa949('0x2c')],_0x364f62;if(_0x1a1bde>=_0x38a005){_0x1a1bde=_0x38a005;_0x364f62=0xc8;}else{_0x364f62=0xce;}_0x1b0625[_0xa949('0x28')](_0x364f62);return _0x1b0625['set'](_0xa949('0x2d'),_0x25da3f+'-'+_0x1a1bde+'/'+_0x38a005)['json'](_0x4db19d);}return null;};}function patchUpdates(_0x3b3cf3){return function(_0x51d634){try{jsonpatch[_0xa949('0x2e')](_0x51d634,_0x3b3cf3,!![]);}catch(_0x3fe0e1){return BPromise['reject'](_0x3fe0e1);}return _0x51d634[_0xa949('0x2f')]();};}function saveUpdates(_0x1e34a9,_0x24d161){return function(_0x7760c5){if(_0x7760c5){return _0x7760c5[_0xa949('0x30')](_0x1e34a9)[_0xa949('0x1c')](function(_0x3c5e54){return _0x3c5e54;});}return null;};}function removeEntity(_0x210da8,_0x1b4881){return function(_0xdd0f2f){if(_0xdd0f2f){return _0xdd0f2f[_0xa949('0x31')]()['then'](function(){var _0x348a19=_0xdd0f2f[_0xa949('0x32')]({'plain':!![]});var _0x43df7b=_0xa949('0x33');return db[_0xa949('0x34')][_0xa949('0x31')]({'where':{'type':_0x43df7b,'resourceId':_0x348a19['id']}})['then'](function(){return _0xdd0f2f;});})['then'](function(){_0x210da8[_0xa949('0x28')](0xcc)['end']();});}};}function handleEntityNotFound(_0x19725c,_0xaf7a49){return function(_0x311ee8){if(!_0x311ee8){_0x19725c[_0xa949('0x35')](0x194);}return _0x311ee8;};}function handleError(_0x5a7c1f,_0x3526d0){_0x3526d0=_0x3526d0||0x1f4;return function(_0x56d91d){logger[_0xa949('0x23')](_0x56d91d['stack']);if(_0x56d91d[_0xa949('0x36')]){delete _0x56d91d[_0xa949('0x36')];}_0x5a7c1f['status'](_0x3526d0)[_0xa949('0x37')](_0x56d91d);};}exports[_0xa949('0x38')]=function(_0x544aff,_0x52716c){var _0x4d4ceb={},_0x2f894d={},_0x3e103b={'count':0x0,'rows':[]};var _0x262131=_[_0xa949('0x39')](db[_0xa949('0x3a')]['rawAttributes'],function(_0x5baa90){return{'name':_0x5baa90[_0xa949('0x3b')],'type':_0x5baa90['type'][_0xa949('0x3c')]};});_0x2f894d[_0xa949('0x3d')]=_['map'](_0x262131,_0xa949('0x36'));_0x2f894d[_0xa949('0x3e')]=_['keys'](_0x544aff[_0xa949('0x3e')]);_0x2f894d['filters']=_[_0xa949('0x3f')](_0x2f894d[_0xa949('0x3d')],_0x2f894d[_0xa949('0x3e')]);_0x4d4ceb[_0xa949('0x40')]=_[_0xa949('0x3f')](_0x2f894d['model'],qs[_0xa949('0x41')](_0x544aff[_0xa949('0x3e')][_0xa949('0x41')]));_0x4d4ceb[_0xa949('0x40')]=_0x4d4ceb[_0xa949('0x40')][_0xa949('0x42')]?_0x4d4ceb[_0xa949('0x40')]:_0x2f894d[_0xa949('0x3d')];if(!_0x544aff[_0xa949('0x3e')][_0xa949('0x43')](_0xa949('0x44'))){_0x4d4ceb[_0xa949('0x2c')]=qs[_0xa949('0x2c')](_0x544aff[_0xa949('0x3e')][_0xa949('0x2c')]);_0x4d4ceb[_0xa949('0x2b')]=qs[_0xa949('0x2b')](_0x544aff[_0xa949('0x3e')][_0xa949('0x2b')]);}_0x4d4ceb[_0xa949('0x45')]=qs[_0xa949('0x46')](_0x544aff[_0xa949('0x3e')]['sort']);_0x4d4ceb['where']=qs[_0xa949('0x47')](_['pick'](_0x544aff[_0xa949('0x3e')],_0x2f894d[_0xa949('0x47')]));if(_0x544aff[_0xa949('0x3e')]['filter']){_0x4d4ceb[_0xa949('0x48')]=_[_0xa949('0x49')](_0x4d4ceb[_0xa949('0x48')],{'$or':_[_0xa949('0x39')](_0x262131,function(_0x5b3698){if(_0x5b3698[_0xa949('0x4a')]!==_0xa949('0x4b')){var _0x331d12={};_0x331d12[_0x5b3698['name']]={'$like':'%'+_0x544aff[_0xa949('0x3e')][_0xa949('0x4c')]+'%'};return _0x331d12;}})});}_0x4d4ceb=_[_0xa949('0x49')]({},_0x4d4ceb,_0x544aff[_0xa949('0x4d')]);var _0x1e3e81={'where':_0x4d4ceb['where']};return db['Trunk'][_0xa949('0x4e')](_0x1e3e81)[_0xa949('0x1c')](function(_0x3bf044){_0x3e103b[_0xa949('0x4e')]=_0x3bf044;if(_0x544aff['query'][_0xa949('0x4f')]){_0x4d4ceb[_0xa949('0x50')]=[{'all':!![]}];}return db[_0xa949('0x3a')][_0xa949('0x51')](_0x4d4ceb);})[_0xa949('0x1c')](function(_0x3927dd){_0x3e103b['rows']=_0x3927dd;return _0x3e103b;})['then'](respondWithFilteredResult(_0x52716c,_0x4d4ceb))[_0xa949('0x27')](handleError(_0x52716c,null));};exports['show']=function(_0x511e03,_0x56a5cd){var _0x11ff50={'raw':![],'where':{'id':_0x511e03[_0xa949('0x52')]['id']}},_0x4e2f52={};_0x4e2f52['model']=_['keys'](db['Trunk']['rawAttributes']);_0x4e2f52[_0xa949('0x3e')]=_[_0xa949('0x53')](_0x511e03[_0xa949('0x3e')]);_0x4e2f52[_0xa949('0x47')]=_[_0xa949('0x3f')](_0x4e2f52[_0xa949('0x3d')],_0x4e2f52[_0xa949('0x3e')]);_0x11ff50[_0xa949('0x40')]=_[_0xa949('0x3f')](_0x4e2f52[_0xa949('0x3d')],qs[_0xa949('0x41')](_0x511e03['query'][_0xa949('0x41')]));_0x11ff50[_0xa949('0x40')]=_0x11ff50[_0xa949('0x40')][_0xa949('0x42')]?_0x11ff50[_0xa949('0x40')]:_0x4e2f52[_0xa949('0x3d')];if(_0x511e03[_0xa949('0x3e')][_0xa949('0x4f')]){_0x11ff50[_0xa949('0x50')]=[{'all':!![]}];}_0x11ff50=_[_0xa949('0x49')]({},_0x11ff50,_0x511e03['options']);return db[_0xa949('0x3a')]['find'](_0x11ff50)[_0xa949('0x1c')](handleEntityNotFound(_0x56a5cd,null))[_0xa949('0x1c')](respondWithResult(_0x56a5cd,null))[_0xa949('0x27')](handleError(_0x56a5cd,null));};exports['clone']=function(_0x4cdc7a,_0x504c07){var _0x41c2a4={'where':{'id':_0x4cdc7a[_0xa949('0x52')]['id']}},_0x534400={};_0x534400[_0xa949('0x3d')]=_[_0xa949('0x53')](db[_0xa949('0x3a')]['rawAttributes']);_0x41c2a4[_0xa949('0x40')]=_[_0xa949('0x3f')](_0x534400[_0xa949('0x3d')],qs['fields'](_0x4cdc7a[_0xa949('0x3e')][_0xa949('0x41')]));_0x41c2a4['attributes']=_0x41c2a4[_0xa949('0x40')][_0xa949('0x42')]?_0x41c2a4['attributes']:_0x534400['model'];if(_0x4cdc7a[_0xa949('0x3e')][_0xa949('0x4f')]){_0x41c2a4[_0xa949('0x50')]=[{'all':!![]}];}_0x41c2a4=_[_0xa949('0x49')]({},_0x41c2a4,_0x4cdc7a[_0xa949('0x4d')]);return db['Trunk'][_0xa949('0x54')](_0x41c2a4)[_0xa949('0x1c')](handleEntityNotFound(_0x504c07,null))[_0xa949('0x1c')](function(_0x5eb075){if(_0x5eb075){var _0x44222a=_0x5eb075['get']({'plain':!![]});_0x44222a=qs[_0xa949('0x55')](_0x44222a,['id',_0xa949('0x56'),'updatedAt']);_0x4cdc7a[_0xa949('0x57')]=_[_0xa949('0x55')](_0x4cdc7a['body'],['id',_0xa949('0x56'),_0xa949('0x58')]);return db[_0xa949('0x3a')][_0xa949('0x59')](_[_0xa949('0x49')](_0x44222a,_0x4cdc7a[_0xa949('0x57')]),{'include':_0x4cdc7a[_0xa949('0x3e')]['includeAll']?[{'all':!![]}]:undefined})[_0xa949('0x1c')](function(_0x4d893d){var _0x38ddda=_0x4cdc7a[_0xa949('0x5a')][_0xa949('0x32')]({'plain':!![]});if(!_0x38ddda)throw new Error(_0xa949('0x5b'));if(_0x38ddda['role']===_0xa949('0x5a')){var _0x41e062=_0x4d893d[_0xa949('0x32')]({'plain':!![]});var _0x298919=_0xa949('0x33');return db['UserProfileSection']['find']({'where':{'name':_0x298919,'userProfileId':_0x38ddda[_0xa949('0x5c')]},'raw':!![]})[_0xa949('0x1c')](function(_0x40ab05){if(_0x40ab05&&_0x40ab05[_0xa949('0x5d')]===0x0){return db['UserProfileResource'][_0xa949('0x59')]({'name':_0x41e062[_0xa949('0x36')],'resourceId':_0x41e062['id'],'type':_0x40ab05[_0xa949('0x36')],'sectionId':_0x40ab05['id']},{})[_0xa949('0x1c')](function(){return _0x4d893d;});}else{return _0x4d893d;}})[_0xa949('0x27')](function(_0x1589fc){logger['error'](_0xa949('0x5e'),_0x1589fc);throw _0x1589fc;});}return _0x4d893d;});}})['then'](respondWithResult(_0x504c07,0xc9))[_0xa949('0x27')](handleError(_0x504c07,null));};exports[_0xa949('0x59')]=function(_0x5bad98,_0x3e546d,_0x2f2b81){var _0x1f338d;return db[_0xa949('0x3a')][_0xa949('0x59')](_0x5bad98[_0xa949('0x57')],{'raw':!![]})['then'](function(_0x45e6ec){_0x1f338d=_0x45e6ec;return db['Trunk'][_0xa949('0x51')]({'raw':!![]});})['then'](function(_0x149ae5){var _0x372725=fs[_0xa949('0x5f')](path[_0xa949('0x60')](config[_0xa949('0x61')],_0xa949('0x62')),_0xa949('0x63'));var _0x30f4aa=fs['readFileSync'](path[_0xa949('0x60')](config[_0xa949('0x61')],_0xa949('0x64')),'utf8');var _0x26dc7b=ejs[_0xa949('0x65')](_0x372725,{'trunks':_0x149ae5||[]});fs[_0xa949('0x66')](_0xa949('0x67'),_0x26dc7b);if(_0x1f338d[_0xa949('0x68')]){var _0x297673=ejs[_0xa949('0x65')](_0x30f4aa,{'trunks':_0x149ae5||[]});fs[_0xa949('0x66')]('/etc/asterisk/sip_xcally_registers.conf',_0x297673);}})[_0xa949('0x1c')](function(){return respondWithRpcPromise(_0xa949('0x69'),_0xa949('0x59'),{'module':_0xa949('0x6a')});})[_0xa949('0x1c')](function(){var _0x2d49e3=_0x5bad98[_0xa949('0x5a')]['get']({'plain':!![]});if(!_0x2d49e3)throw new Error(_0xa949('0x5b'));if(_0x2d49e3['role']===_0xa949('0x5a')){var _0x278505=_0x1f338d[_0xa949('0x32')]({'plain':!![]});return db[_0xa949('0x6b')][_0xa949('0x54')]({'where':{'name':_0xa949('0x33'),'userProfileId':_0x2d49e3[_0xa949('0x5c')]},'raw':!![]})[_0xa949('0x1c')](function(_0x49911a){if(_0x49911a&&_0x49911a[_0xa949('0x5d')]===0x0){return db[_0xa949('0x34')][_0xa949('0x59')]({'name':_0x278505[_0xa949('0x36')],'resourceId':_0x278505['id'],'type':_0x49911a[_0xa949('0x36')],'sectionId':_0x49911a['id']},{})[_0xa949('0x1c')](function(){return _0x1f338d;});}else{return _0x1f338d;}})[_0xa949('0x27')](function(_0x144c1a){logger['error'](_0xa949('0x5e'),_0x144c1a);throw _0x144c1a;});}return _0x1f338d;})[_0xa949('0x1c')](respondWithResult(_0x3e546d,0xc9))['catch'](handleError(_0x3e546d,null));};exports['update']=function(_0x5a94f6,_0x41c3d5,_0x23c357){var _0x3fd3da;return db['Trunk'][_0xa949('0x54')]({'where':{'id':_0x5a94f6[_0xa949('0x52')]['id']}})[_0xa949('0x1c')](handleEntityNotFound(_0x41c3d5,null))[_0xa949('0x1c')](saveUpdates(_0x5a94f6[_0xa949('0x57')],null))[_0xa949('0x1c')](function(_0x3e82db){if(_0x3e82db){_0x3fd3da=_0x3e82db;return db['Trunk']['findAll']({'raw':!![]});}})[_0xa949('0x1c')](function(_0x3dd0c0){if(_0x3dd0c0){var _0x26c49d=fs[_0xa949('0x5f')](path[_0xa949('0x60')](config[_0xa949('0x61')],_0xa949('0x62')),_0xa949('0x63'));var _0x706d8b=fs['readFileSync'](path['join'](config[_0xa949('0x61')],_0xa949('0x64')),'utf8');var _0x4828da=ejs['render'](_0x26c49d,{'trunks':_0x3dd0c0||[]});fs[_0xa949('0x66')](_0xa949('0x67'),_0x4828da);var _0x3573dc=ejs['render'](_0x706d8b,{'trunks':_0x3dd0c0||[]});fs[_0xa949('0x66')]('/etc/asterisk/sip_xcally_registers.conf',_0x3573dc);return respondWithRpcPromise(_0xa949('0x69'),_0xa949('0x30'),{'module':_0xa949('0x6a')});}return null;})['then'](function(_0x40fcb1){if(_0x40fcb1){return _0x3fd3da;}})[_0xa949('0x1c')](respondWithResult(_0x41c3d5,null))['catch'](handleError(_0x41c3d5,null));};exports[_0xa949('0x31')]=function(_0x1bd454,_0x22496f,_0xcb1737){var _0x5baba9;return db['Trunk']['find']({'where':{'id':_0x1bd454[_0xa949('0x52')]['id']}})[_0xa949('0x1c')](handleEntityNotFound(_0x22496f,null))[_0xa949('0x1c')](removeEntity(_0x22496f,null))['then'](function(){return db[_0xa949('0x3a')]['findAll']({'raw':!![]});})['then'](function(_0x26a8c5){var _0x5e1ce2=fs[_0xa949('0x5f')](path['join'](config[_0xa949('0x61')],_0xa949('0x62')),_0xa949('0x63'));var _0x158be7=fs[_0xa949('0x5f')](path[_0xa949('0x60')](config['root'],_0xa949('0x64')),_0xa949('0x63'));var _0x503c34=ejs[_0xa949('0x65')](_0x5e1ce2,{'trunks':_0x26a8c5});var _0x5abf6b=ejs[_0xa949('0x65')](_0x158be7,{'trunks':_0x26a8c5});fs[_0xa949('0x66')](_0xa949('0x67'),_0x503c34);fs[_0xa949('0x66')]('/etc/asterisk/sip_xcally_registers.conf',_0x5abf6b);return respondWithRpcPromise(_0xa949('0x69'),_0xa949('0x31'),{'module':_0xa949('0x6a')});})[_0xa949('0x27')](handleError(_0x22496f,null));}; \ No newline at end of file +var _0xb664=['createdAt','updatedAt','body','create','user','role','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','findAll','readFileSync','join','root','server/files/templates/trunk.ejs','server/files/templates/registry.ejs','utf8','render','/etc/asterisk/sip_xcally_trunks.conf','writeFileSync','/etc/asterisk/sip_xcally_registers.conf','Reload','chan_sip.so','Unable\x20to\x20retrieve\x20the\x20current\x20user','update','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','to-csv','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','jayson/promise','http','Sequelize','ValidationError','request','then','info','Trunk,\x20%s,\x20%s','request\x20sent','Trunk,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','status','end','count','offset','limit','set','Content-Range','json','apply','reject','destroy','get','Trunks','UserProfileResource','sendStatus','stack','name','index','map','Trunk','rawAttributes','fieldName','type','key','model','keys','intersection','query','attributes','length','hasOwnProperty','sort','where','filters','pick','filter','VIRTUAL','merge','options','includeAll','rows','show','fields','include','find','clone','params','omit'];(function(_0x2d808c,_0x58e54f){var _0xd5b55f=function(_0x1847d8){while(--_0x1847d8){_0x2d808c['push'](_0x2d808c['shift']());}};_0xd5b55f(++_0x58e54f);}(_0xb664,0x163));var _0x4b66=function(_0x44a580,_0x5c77a9){_0x44a580=_0x44a580-0x0;var _0x55a26f=_0xb664[_0x44a580];return _0x55a26f;};'use strict';var pdf=require('html-pdf');var emlformat=require('eml-format');var rimraf=require(_0x4b66('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0x4b66('0x1'));var rp=require(_0x4b66('0x2'));var moment=require(_0x4b66('0x3'));var BPromise=require(_0x4b66('0x4'));var Mustache=require(_0x4b66('0x5'));var util=require(_0x4b66('0x6'));var path=require('path');var sox=require('sox');var csv=require(_0x4b66('0x7'));var ejs=require('ejs');var fs=require('fs');var _=require(_0x4b66('0x8'));var squel=require(_0x4b66('0x9'));var crypto=require(_0x4b66('0xa'));var jsforce=require(_0x4b66('0xb'));var deskjs=require(_0x4b66('0xc'));var toCsv=require(_0x4b66('0x7'));var querystring=require(_0x4b66('0xd'));var Papa=require(_0x4b66('0xe'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x4b66('0xf'));var as=require(_0x4b66('0x10'));var hardwareService=require(_0x4b66('0x11'));var logger=require('../../config/logger')(_0x4b66('0x12'));var utils=require(_0x4b66('0x13'));var config=require(_0x4b66('0x14'));var db=require('../../mysqldb')['db'];var jayson=require(_0x4b66('0x15'));var client=jayson['client'][_0x4b66('0x16')]({'port':0x232a});function checkPasswordPattern(_0x32d73a,_0x41ce4d,_0x251001){if(_0x251001){var _0xcd3cff=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0xcd3cff['test'](_0x41ce4d)){return _0x32d73a;}else{throw new db[(_0x4b66('0x17'))][(_0x4b66('0x18'))]('The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.');}}else{return _0x32d73a;}}function respondWithRpcPromise(_0x3651ed,_0x298cdd,_0x1439f3,_0x6d64e1){return new BPromise(function(_0x32e3fe,_0x2869f6){var _0x543472=_0x6d64e1||client;return _0x543472[_0x4b66('0x19')](_0x3651ed,_0x1439f3)[_0x4b66('0x1a')](function(_0xc7f2c1){logger[_0x4b66('0x1b')](_0x4b66('0x1c'),_0x298cdd,_0x4b66('0x1d'));logger['debug'](_0x4b66('0x1e'),_0x298cdd,_0x4b66('0x1d'),JSON[_0x4b66('0x1f')](_0xc7f2c1));if(_0xc7f2c1[_0x4b66('0x20')]){if(_0xc7f2c1['error'][_0x4b66('0x21')]===0x1f4){logger[_0x4b66('0x20')](_0x4b66('0x1c'),_0x298cdd,_0xc7f2c1[_0x4b66('0x20')][_0x4b66('0x22')]);return _0x2869f6(_0xc7f2c1['error'][_0x4b66('0x22')]);}logger[_0x4b66('0x20')](_0x4b66('0x1c'),_0x298cdd,_0xc7f2c1[_0x4b66('0x20')][_0x4b66('0x22')]);return _0x32e3fe(_0xc7f2c1[_0x4b66('0x20')][_0x4b66('0x22')]);}else{logger[_0x4b66('0x1b')](_0x4b66('0x1c'),_0x298cdd,_0x4b66('0x1d'));_0x32e3fe(_0xc7f2c1[_0x4b66('0x23')][_0x4b66('0x22')]);}})[_0x4b66('0x24')](function(_0x4ee379){logger[_0x4b66('0x20')](_0x4b66('0x1c'),_0x298cdd,_0x4ee379);_0x2869f6(_0x4ee379);});});}function respondWithStatusCode(_0x40b3d2,_0x96252e){_0x96252e=_0x96252e||0xcc;return function(_0x11bed5){if(_0x11bed5){return _0x40b3d2['sendStatus'](_0x96252e);}return _0x40b3d2[_0x4b66('0x25')](_0x96252e)[_0x4b66('0x26')]();};}function respondWithResult(_0x24f0bd,_0x391762){_0x391762=_0x391762||0xc8;return function(_0xa2edd9){if(_0xa2edd9){return _0x24f0bd[_0x4b66('0x25')](_0x391762)['json'](_0xa2edd9);}};}function respondWithFilteredResult(_0x582271,_0x5c1ca6){return function(_0x3d880b){if(_0x3d880b){var _0x165320=_0x3d880b[_0x4b66('0x27')],_0x290918=_0x5c1ca6[_0x4b66('0x28')],_0xeeaab3=_0x5c1ca6['offset']+_0x5c1ca6[_0x4b66('0x29')],_0x493b15;if(_0xeeaab3>=_0x165320){_0xeeaab3=_0x165320;_0x493b15=0xc8;}else{_0x493b15=0xce;}_0x582271[_0x4b66('0x25')](_0x493b15);return _0x582271[_0x4b66('0x2a')](_0x4b66('0x2b'),_0x290918+'-'+_0xeeaab3+'/'+_0x165320)[_0x4b66('0x2c')](_0x3d880b);}return null;};}function patchUpdates(_0x26564a){return function(_0x169bf0){try{jsonpatch[_0x4b66('0x2d')](_0x169bf0,_0x26564a,!![]);}catch(_0x3944fb){return BPromise[_0x4b66('0x2e')](_0x3944fb);}return _0x169bf0['save']();};}function saveUpdates(_0x3de96d,_0xd489db){return function(_0x591c32){if(_0x591c32){return _0x591c32['update'](_0x3de96d)[_0x4b66('0x1a')](function(_0x494ed8){return _0x494ed8;});}return null;};}function removeEntity(_0x2a4ea0,_0x480997){return function(_0x1239a2){if(_0x1239a2){return _0x1239a2[_0x4b66('0x2f')]()[_0x4b66('0x1a')](function(){var _0x130916=_0x1239a2[_0x4b66('0x30')]({'plain':!![]});var _0x32e6f7=_0x4b66('0x31');return db[_0x4b66('0x32')][_0x4b66('0x2f')]({'where':{'type':_0x32e6f7,'resourceId':_0x130916['id']}})[_0x4b66('0x1a')](function(){return _0x1239a2;});})[_0x4b66('0x1a')](function(){_0x2a4ea0[_0x4b66('0x25')](0xcc)[_0x4b66('0x26')]();});}};}function handleEntityNotFound(_0x1f48ae,_0x2b19f6){return function(_0x2f829a){if(!_0x2f829a){_0x1f48ae[_0x4b66('0x33')](0x194);}return _0x2f829a;};}function handleError(_0x5540af,_0x3d1426){_0x3d1426=_0x3d1426||0x1f4;return function(_0x456536){logger[_0x4b66('0x20')](_0x456536[_0x4b66('0x34')]);if(_0x456536[_0x4b66('0x35')]){delete _0x456536[_0x4b66('0x35')];}_0x5540af[_0x4b66('0x25')](_0x3d1426)['send'](_0x456536);};}exports[_0x4b66('0x36')]=function(_0x4053bd,_0x4dd493){var _0x5e127a={},_0x570b8a={},_0x326ecc={'count':0x0,'rows':[]};var _0x18674b=_[_0x4b66('0x37')](db[_0x4b66('0x38')][_0x4b66('0x39')],function(_0xe2e339){return{'name':_0xe2e339[_0x4b66('0x3a')],'type':_0xe2e339[_0x4b66('0x3b')][_0x4b66('0x3c')]};});_0x570b8a[_0x4b66('0x3d')]=_[_0x4b66('0x37')](_0x18674b,'name');_0x570b8a['query']=_[_0x4b66('0x3e')](_0x4053bd['query']);_0x570b8a['filters']=_[_0x4b66('0x3f')](_0x570b8a[_0x4b66('0x3d')],_0x570b8a[_0x4b66('0x40')]);_0x5e127a[_0x4b66('0x41')]=_[_0x4b66('0x3f')](_0x570b8a['model'],qs['fields'](_0x4053bd[_0x4b66('0x40')]['fields']));_0x5e127a[_0x4b66('0x41')]=_0x5e127a['attributes'][_0x4b66('0x42')]?_0x5e127a[_0x4b66('0x41')]:_0x570b8a[_0x4b66('0x3d')];if(!_0x4053bd[_0x4b66('0x40')][_0x4b66('0x43')]('nolimit')){_0x5e127a[_0x4b66('0x29')]=qs[_0x4b66('0x29')](_0x4053bd[_0x4b66('0x40')][_0x4b66('0x29')]);_0x5e127a[_0x4b66('0x28')]=qs['offset'](_0x4053bd[_0x4b66('0x40')][_0x4b66('0x28')]);}_0x5e127a['order']=qs[_0x4b66('0x44')](_0x4053bd['query'][_0x4b66('0x44')]);_0x5e127a[_0x4b66('0x45')]=qs[_0x4b66('0x46')](_[_0x4b66('0x47')](_0x4053bd[_0x4b66('0x40')],_0x570b8a['filters']));if(_0x4053bd['query'][_0x4b66('0x48')]){_0x5e127a[_0x4b66('0x45')]=_['merge'](_0x5e127a[_0x4b66('0x45')],{'$or':_[_0x4b66('0x37')](_0x18674b,function(_0x165f3d){if(_0x165f3d[_0x4b66('0x3b')]!==_0x4b66('0x49')){var _0x21978c={};_0x21978c[_0x165f3d[_0x4b66('0x35')]]={'$like':'%'+_0x4053bd[_0x4b66('0x40')][_0x4b66('0x48')]+'%'};return _0x21978c;}})});}_0x5e127a=_[_0x4b66('0x4a')]({},_0x5e127a,_0x4053bd[_0x4b66('0x4b')]);var _0x3cb992={'where':_0x5e127a['where']};return db['Trunk'][_0x4b66('0x27')](_0x3cb992)[_0x4b66('0x1a')](function(_0x475db8){_0x326ecc[_0x4b66('0x27')]=_0x475db8;if(_0x4053bd[_0x4b66('0x40')][_0x4b66('0x4c')]){_0x5e127a['include']=[{'all':!![]}];}return db[_0x4b66('0x38')]['findAll'](_0x5e127a);})[_0x4b66('0x1a')](function(_0xe12880){_0x326ecc[_0x4b66('0x4d')]=_0xe12880;return _0x326ecc;})[_0x4b66('0x1a')](respondWithFilteredResult(_0x4dd493,_0x5e127a))[_0x4b66('0x24')](handleError(_0x4dd493,null));};exports[_0x4b66('0x4e')]=function(_0x1ddbd4,_0x3ecb7d){var _0x1ac883={'raw':![],'where':{'id':_0x1ddbd4['params']['id']}},_0x6f9927={};_0x6f9927[_0x4b66('0x3d')]=_['keys'](db[_0x4b66('0x38')][_0x4b66('0x39')]);_0x6f9927[_0x4b66('0x40')]=_[_0x4b66('0x3e')](_0x1ddbd4['query']);_0x6f9927[_0x4b66('0x46')]=_[_0x4b66('0x3f')](_0x6f9927[_0x4b66('0x3d')],_0x6f9927[_0x4b66('0x40')]);_0x1ac883['attributes']=_[_0x4b66('0x3f')](_0x6f9927[_0x4b66('0x3d')],qs[_0x4b66('0x4f')](_0x1ddbd4[_0x4b66('0x40')][_0x4b66('0x4f')]));_0x1ac883['attributes']=_0x1ac883[_0x4b66('0x41')][_0x4b66('0x42')]?_0x1ac883[_0x4b66('0x41')]:_0x6f9927[_0x4b66('0x3d')];if(_0x1ddbd4[_0x4b66('0x40')]['includeAll']){_0x1ac883[_0x4b66('0x50')]=[{'all':!![]}];}_0x1ac883=_['merge']({},_0x1ac883,_0x1ddbd4['options']);return db[_0x4b66('0x38')][_0x4b66('0x51')](_0x1ac883)['then'](handleEntityNotFound(_0x3ecb7d,null))[_0x4b66('0x1a')](respondWithResult(_0x3ecb7d,null))['catch'](handleError(_0x3ecb7d,null));};exports[_0x4b66('0x52')]=function(_0x4468e8,_0x4ab42a){var _0x5ef6c1={'where':{'id':_0x4468e8[_0x4b66('0x53')]['id']}},_0x246582={};_0x246582['model']=_[_0x4b66('0x3e')](db[_0x4b66('0x38')][_0x4b66('0x39')]);_0x5ef6c1[_0x4b66('0x41')]=_[_0x4b66('0x3f')](_0x246582[_0x4b66('0x3d')],qs[_0x4b66('0x4f')](_0x4468e8[_0x4b66('0x40')][_0x4b66('0x4f')]));_0x5ef6c1['attributes']=_0x5ef6c1[_0x4b66('0x41')][_0x4b66('0x42')]?_0x5ef6c1[_0x4b66('0x41')]:_0x246582['model'];if(_0x4468e8[_0x4b66('0x40')][_0x4b66('0x4c')]){_0x5ef6c1['include']=[{'all':!![]}];}_0x5ef6c1=_[_0x4b66('0x4a')]({},_0x5ef6c1,_0x4468e8[_0x4b66('0x4b')]);return db['Trunk'][_0x4b66('0x51')](_0x5ef6c1)[_0x4b66('0x1a')](handleEntityNotFound(_0x4ab42a,null))[_0x4b66('0x1a')](function(_0x3c37fb){if(_0x3c37fb){var _0x207db3=_0x3c37fb[_0x4b66('0x30')]({'plain':!![]});_0x207db3=qs[_0x4b66('0x54')](_0x207db3,['id',_0x4b66('0x55'),_0x4b66('0x56')]);_0x4468e8[_0x4b66('0x57')]=_[_0x4b66('0x54')](_0x4468e8[_0x4b66('0x57')],['id',_0x4b66('0x55'),_0x4b66('0x56')]);return db[_0x4b66('0x38')][_0x4b66('0x58')](_['merge'](_0x207db3,_0x4468e8[_0x4b66('0x57')]),{'include':_0x4468e8[_0x4b66('0x40')][_0x4b66('0x4c')]?[{'all':!![]}]:undefined})[_0x4b66('0x1a')](function(_0x50ac64){var _0x5c79f1=_0x4468e8[_0x4b66('0x59')]['get']({'plain':!![]});if(!_0x5c79f1)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x5c79f1[_0x4b66('0x5a')]==='user'){var _0x2a82f3=_0x50ac64[_0x4b66('0x30')]({'plain':!![]});var _0x2cffe4=_0x4b66('0x31');return db[_0x4b66('0x5b')]['find']({'where':{'name':_0x2cffe4,'userProfileId':_0x5c79f1[_0x4b66('0x5c')]},'raw':!![]})['then'](function(_0x4e5cc3){if(_0x4e5cc3&&_0x4e5cc3[_0x4b66('0x5d')]===0x0){return db[_0x4b66('0x32')][_0x4b66('0x58')]({'name':_0x2a82f3['name'],'resourceId':_0x2a82f3['id'],'type':_0x4e5cc3['name'],'sectionId':_0x4e5cc3['id']},{})[_0x4b66('0x1a')](function(){return _0x50ac64;});}else{return _0x50ac64;}})[_0x4b66('0x24')](function(_0x527602){logger[_0x4b66('0x20')](_0x4b66('0x5e'),_0x527602);throw _0x527602;});}return _0x50ac64;});}})[_0x4b66('0x1a')](respondWithResult(_0x4ab42a,0xc9))[_0x4b66('0x24')](handleError(_0x4ab42a,null));};exports[_0x4b66('0x58')]=function(_0x5eaa6f,_0x465c0b,_0x4c9660){var _0x1c8f64;return db['Trunk'][_0x4b66('0x58')](_0x5eaa6f[_0x4b66('0x57')],{'raw':!![]})[_0x4b66('0x1a')](function(_0x35d589){_0x1c8f64=_0x35d589;return db[_0x4b66('0x38')][_0x4b66('0x5f')]({'raw':!![]});})[_0x4b66('0x1a')](function(_0x4424f8){var _0x22e58e=fs[_0x4b66('0x60')](path[_0x4b66('0x61')](config[_0x4b66('0x62')],_0x4b66('0x63')),'utf8');var _0x1aa12f=fs['readFileSync'](path[_0x4b66('0x61')](config[_0x4b66('0x62')],_0x4b66('0x64')),_0x4b66('0x65'));var _0x586dab=ejs[_0x4b66('0x66')](_0x22e58e,{'trunks':_0x4424f8||[]});fs['writeFileSync'](_0x4b66('0x67'),_0x586dab);if(_0x1c8f64['registry']){var _0x40cba1=ejs[_0x4b66('0x66')](_0x1aa12f,{'trunks':_0x4424f8||[]});fs[_0x4b66('0x68')](_0x4b66('0x69'),_0x40cba1);}})[_0x4b66('0x1a')](function(){return respondWithRpcPromise(_0x4b66('0x6a'),'create',{'module':_0x4b66('0x6b')});})[_0x4b66('0x1a')](function(){var _0x616b78=_0x5eaa6f[_0x4b66('0x59')][_0x4b66('0x30')]({'plain':!![]});if(!_0x616b78)throw new Error(_0x4b66('0x6c'));if(_0x616b78[_0x4b66('0x5a')]==='user'){var _0x25ecfd=_0x1c8f64[_0x4b66('0x30')]({'plain':!![]});return db['UserProfileSection'][_0x4b66('0x51')]({'where':{'name':_0x4b66('0x31'),'userProfileId':_0x616b78['userProfileId']},'raw':!![]})[_0x4b66('0x1a')](function(_0x5a0038){if(_0x5a0038&&_0x5a0038[_0x4b66('0x5d')]===0x0){return db[_0x4b66('0x32')]['create']({'name':_0x25ecfd[_0x4b66('0x35')],'resourceId':_0x25ecfd['id'],'type':_0x5a0038[_0x4b66('0x35')],'sectionId':_0x5a0038['id']},{})[_0x4b66('0x1a')](function(){return _0x1c8f64;});}else{return _0x1c8f64;}})['catch'](function(_0x159b0c){logger['error'](_0x4b66('0x5e'),_0x159b0c);throw _0x159b0c;});}return _0x1c8f64;})[_0x4b66('0x1a')](respondWithResult(_0x465c0b,0xc9))[_0x4b66('0x24')](handleError(_0x465c0b,null));};exports[_0x4b66('0x6d')]=function(_0x5aa8e6,_0x4f82fe,_0x2f3b34){var _0x5be3a6;return db[_0x4b66('0x38')][_0x4b66('0x51')]({'where':{'id':_0x5aa8e6[_0x4b66('0x53')]['id']}})['then'](handleEntityNotFound(_0x4f82fe,null))[_0x4b66('0x1a')](saveUpdates(_0x5aa8e6[_0x4b66('0x57')],null))[_0x4b66('0x1a')](function(_0x4599be){if(_0x4599be){_0x5be3a6=_0x4599be;return db[_0x4b66('0x38')][_0x4b66('0x5f')]({'raw':!![]});}})[_0x4b66('0x1a')](function(_0x28e4c4){if(_0x28e4c4){var _0x5dbcbf=fs[_0x4b66('0x60')](path[_0x4b66('0x61')](config[_0x4b66('0x62')],_0x4b66('0x63')),_0x4b66('0x65'));var _0x3dcc2a=fs[_0x4b66('0x60')](path['join'](config['root'],_0x4b66('0x64')),_0x4b66('0x65'));var _0x38e083=ejs[_0x4b66('0x66')](_0x5dbcbf,{'trunks':_0x28e4c4||[]});fs[_0x4b66('0x68')](_0x4b66('0x67'),_0x38e083);var _0x1bc731=ejs['render'](_0x3dcc2a,{'trunks':_0x28e4c4||[]});fs[_0x4b66('0x68')](_0x4b66('0x69'),_0x1bc731);return respondWithRpcPromise(_0x4b66('0x6a'),_0x4b66('0x6d'),{'module':'chan_sip.so'});}return null;})['then'](function(_0x8a9572){if(_0x8a9572){return _0x5be3a6;}})['then'](respondWithResult(_0x4f82fe,null))[_0x4b66('0x24')](handleError(_0x4f82fe,null));};exports[_0x4b66('0x2f')]=function(_0x89440f,_0x2c0eff,_0x4500ab){var _0x34c24d;return db[_0x4b66('0x38')]['find']({'where':{'id':_0x89440f[_0x4b66('0x53')]['id']}})['then'](handleEntityNotFound(_0x2c0eff,null))[_0x4b66('0x1a')](removeEntity(_0x2c0eff,null))[_0x4b66('0x1a')](function(){return db[_0x4b66('0x38')][_0x4b66('0x5f')]({'raw':!![]});})[_0x4b66('0x1a')](function(_0x1c1505){var _0x5f20a0=fs[_0x4b66('0x60')](path['join'](config[_0x4b66('0x62')],'server/files/templates/trunk.ejs'),_0x4b66('0x65'));var _0x12b67e=fs[_0x4b66('0x60')](path[_0x4b66('0x61')](config[_0x4b66('0x62')],'server/files/templates/registry.ejs'),_0x4b66('0x65'));var _0xa2ba43=ejs[_0x4b66('0x66')](_0x5f20a0,{'trunks':_0x1c1505});var _0xe4ee54=ejs['render'](_0x12b67e,{'trunks':_0x1c1505});fs[_0x4b66('0x68')](_0x4b66('0x67'),_0xa2ba43);fs[_0x4b66('0x68')](_0x4b66('0x69'),_0xe4ee54);return respondWithRpcPromise(_0x4b66('0x6a'),'destroy',{'module':'chan_sip.so'});})[_0x4b66('0x24')](handleError(_0x2c0eff,null));}; \ No newline at end of file diff --git a/server/api/trunk/trunk.model.js b/server/api/trunk/trunk.model.js index 474dc42..6d75af0 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 _0x4222=['tools_trunks','../../config/logger','moment','request-promise','path','../../config/environment','./trunk.attributes','exports','Trunk'];(function(_0x5b7e03,_0xc2360e){var _0x25edb1=function(_0x332e5e){while(--_0x332e5e){_0x5b7e03['push'](_0x5b7e03['shift']());}};_0x25edb1(++_0xc2360e);}(_0x4222,0xd9));var _0x2422=function(_0x1928c9,_0x13a6d1){_0x1928c9=_0x1928c9-0x0;var _0x51b5fb=_0x4222[_0x1928c9];return _0x51b5fb;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x2422('0x0'))('api');var moment=require(_0x2422('0x1'));var BPromise=require('bluebird');var rp=require(_0x2422('0x2'));var fs=require('fs');var path=require(_0x2422('0x3'));var rimraf=require('rimraf');var config=require(_0x2422('0x4'));var attributes=require(_0x2422('0x5'));module[_0x2422('0x6')]=function(_0x143a19,_0x3b850f){return _0x143a19['define'](_0x2422('0x7'),attributes,{'tableName':_0x2422('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xfa72=['Trunk','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./trunk.attributes','exports','define'];(function(_0x3fac06,_0x378e3c){var _0x379fa9=function(_0x366900){while(--_0x366900){_0x3fac06['push'](_0x3fac06['shift']());}};_0x379fa9(++_0x378e3c);}(_0xfa72,0xd3));var _0x2fa7=function(_0x542898,_0x47f6de){_0x542898=_0x542898-0x0;var _0x10cf37=_0xfa72[_0x542898];return _0x10cf37;};'use strict';var _=require(_0x2fa7('0x0'));var util=require(_0x2fa7('0x1'));var logger=require(_0x2fa7('0x2'))(_0x2fa7('0x3'));var moment=require(_0x2fa7('0x4'));var BPromise=require(_0x2fa7('0x5'));var rp=require(_0x2fa7('0x6'));var fs=require('fs');var path=require(_0x2fa7('0x7'));var rimraf=require(_0x2fa7('0x8'));var config=require(_0x2fa7('0x9'));var attributes=require(_0x2fa7('0xa'));module[_0x2fa7('0xb')]=function(_0x15dfc2,_0x420c44){return _0x15dfc2[_0x2fa7('0xc')](_0x2fa7('0xd'),attributes,{'tableName':'tools_trunks','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 bc4adfa..919f4fc 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(_0x9fd887,_0x47f76c){var _0x1a54ab=function(_0xb65c08){while(--_0xb65c08){_0x9fd887['push'](_0x9fd887['shift']());}};_0x1a54ab(++_0x47f76c);}(_0x5f2f,0x73));var _0xf5f2=function(_0x1f604b,_0x221930){_0x1f604b=_0x1f604b-0x0;var _0x42ed00=_0x5f2f[_0x1f604b];return _0x42ed00;};'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 _0x8603=['result','catch','GetTrunk','Trunk','findAll','options','raw','where','attributes','limit','include','map','model','stringify','ShowTrunk','debug','util','moment','bluebird','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','client','http','then','Trunk,\x20%s,\x20%s','request\x20sent','Trunk,\x20%s,\x20%s,\x20%s','error','message','info'];(function(_0x54c711,_0x13d3d7){var _0x5374db=function(_0x3f88be){while(--_0x3f88be){_0x54c711['push'](_0x54c711['shift']());}};_0x5374db(++_0x13d3d7);}(_0x8603,0x190));var _0x3860=function(_0x66b9f9,_0x32d667){_0x66b9f9=_0x66b9f9-0x0;var _0x241ce9=_0x8603[_0x66b9f9];return _0x241ce9;};'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);});});}exports[_0x3860('0x12')]=function(_0x45b799){var _0x4b6b15=this;return new Promise(function(_0x4863bd,_0x373b06){return db[_0x3860('0x13')][_0x3860('0x14')]({'raw':_0x45b799['options']?_0x45b799[_0x3860('0x15')][_0x3860('0x16')]===undefined?!![]:![]:!![],'where':_0x45b799[_0x3860('0x15')]?_0x45b799[_0x3860('0x15')][_0x3860('0x17')]||null:null,'attributes':_0x45b799[_0x3860('0x15')]?_0x45b799[_0x3860('0x15')][_0x3860('0x18')]||null:null,'limit':_0x45b799[_0x3860('0x15')]?_0x45b799[_0x3860('0x15')][_0x3860('0x19')]||null:null,'include':_0x45b799[_0x3860('0x15')]?_0x45b799[_0x3860('0x15')][_0x3860('0x1a')]?_[_0x3860('0x1b')](_0x45b799['options'][_0x3860('0x1a')],function(_0x133093){return{'model':db[_0x133093[_0x3860('0x1c')]],'as':_0x133093['as'],'attributes':_0x133093[_0x3860('0x18')],'include':_0x133093[_0x3860('0x1a')]?_['map'](_0x133093[_0x3860('0x1a')],function(_0x568515){return{'model':db[_0x568515['model']],'as':_0x568515['as'],'attributes':_0x568515[_0x3860('0x18')],'include':_0x568515[_0x3860('0x1a')]?_['map'](_0x568515['include'],function(_0x5f42d5){return{'model':db[_0x5f42d5[_0x3860('0x1c')]],'as':_0x5f42d5['as'],'attributes':_0x5f42d5[_0x3860('0x18')]};}):[]};}):[]};}):[]:[]})[_0x3860('0x9')](function(_0x371f3a){logger[_0x3860('0xf')](_0x3860('0x12'),_0x45b799);logger['debug']('GetTrunk',_0x45b799,JSON[_0x3860('0x1d')](_0x371f3a));_0x4863bd(_0x371f3a);})[_0x3860('0x11')](function(_0x5a9af2){logger[_0x3860('0xd')](_0x3860('0x12'),_0x5a9af2[_0x3860('0xe')],_0x45b799);_0x373b06(_0x4b6b15[_0x3860('0xd')](0x1f4,_0x5a9af2[_0x3860('0xe')]));});});};exports['ShowTrunk']=function(_0x36ae2b){var _0xf624ba=this;return new Promise(function(_0x367b14,_0x4bd90c){return db[_0x3860('0x13')]['find']({'raw':_0x36ae2b[_0x3860('0x15')]?_0x36ae2b['options'][_0x3860('0x16')]===undefined?!![]:![]:!![],'where':_0x36ae2b[_0x3860('0x15')]?_0x36ae2b[_0x3860('0x15')]['where']||null:null,'attributes':_0x36ae2b[_0x3860('0x15')]?_0x36ae2b[_0x3860('0x15')]['attributes']||null:null,'include':_0x36ae2b[_0x3860('0x15')]?_0x36ae2b['options'][_0x3860('0x1a')]?_[_0x3860('0x1b')](_0x36ae2b[_0x3860('0x15')][_0x3860('0x1a')],function(_0x30dc2a){return{'model':db[_0x30dc2a[_0x3860('0x1c')]],'as':_0x30dc2a['as'],'attributes':_0x30dc2a[_0x3860('0x18')],'include':_0x30dc2a['include']?_[_0x3860('0x1b')](_0x30dc2a[_0x3860('0x1a')],function(_0x4d62e9){return{'model':db[_0x4d62e9[_0x3860('0x1c')]],'as':_0x4d62e9['as'],'attributes':_0x4d62e9[_0x3860('0x18')],'include':_0x4d62e9[_0x3860('0x1a')]?_['map'](_0x4d62e9['include'],function(_0x285b1b){return{'model':db[_0x285b1b[_0x3860('0x1c')]],'as':_0x285b1b['as'],'attributes':_0x285b1b[_0x3860('0x18')]};}):[]};}):[]};}):[]:[]})[_0x3860('0x9')](function(_0x59271f){logger['info'](_0x3860('0x1e'),_0x36ae2b);logger[_0x3860('0x1f')](_0x3860('0x1e'),_0x36ae2b,JSON[_0x3860('0x1d')](_0x59271f));_0x367b14(_0x59271f);})[_0x3860('0x11')](function(_0x4df2a9){logger[_0x3860('0xd')](_0x3860('0x1e'),_0x4df2a9['message'],_0x36ae2b);_0x4bd90c(_0xf624ba['error'](0x1f4,_0x4df2a9[_0x3860('0xe')]));});});}; \ No newline at end of file diff --git a/server/api/user/index.js b/server/api/user/index.js index 1aa1369..76812d0 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(_0x594e11,_0x28f652){var _0x5418ad=function(_0x5dcfa7){while(--_0x5dcfa7){_0x594e11['push'](_0x594e11['shift']());}};_0x5418ad(++_0x28f652);}(_0x5f2f,0x73));var _0xf5f2=function(_0x2b0667,_0x49794b){_0x2b0667=_0x2b0667-0x0;var _0x46bee1=_0x5f2f[_0x2b0667];return _0x46bee1;};'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 _0x1261=['getSquareProjects','/:id/scheduled_calls','getScheduledCalls','getApiKey','post','/create_many','addContacts','create','diskStorage','server/files/images/','format','%s-%s','single','file','login','/:id/logout','/:id/pause','pause','/:id/unpause','/:id/teams','addTeams','addChatInteractions','/:id/mail_interactions','addMailInteractions','addSmsInteractions','/:id/openchannel_interactions','/:id/fax_accounts','/:id/openchannel_accounts','addSquareProjects','/:id/api_key','put','update','changePassword','removeQueues','removeTeams','delete','destroy','/:id/fax_interactions','/:id/sms_interactions','removeSmsInteractions','removeFaxAccounts','removeMailAccounts','removeSmsAccounts','removeChatWebsites','/:id/square_projects','removeSquareProjects','removeApiKey','exports','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./user.controller','get','/describe','describe','/whoami','isAuthenticated','whoami','/:id','show','/:id/avatar','/:id/contacts','getContacts','/:id/queues','getQueues','/:id/queues_rt','getVoiceQueuesRt','getGroups','/:id/screen_recordings','/:id/chat/interactions','/:id/openchannel/interactions','getMailInteractions','/:id/fax/interactions','getFaxInteractions','getTeams','/:id/lists','/:id/agents','getAgents','/:id/prefixes','getVoicePrefixes','getFaxAccounts','getMailAccounts','getOpenchannelAccounts','/:id/sms_accounts','getSmsAccounts','/:id/chat_websites','getChatWebsites'];(function(_0x5dc50e,_0x2fccaa){var _0x20885a=function(_0x3bfcd0){while(--_0x3bfcd0){_0x5dc50e['push'](_0x5dc50e['shift']());}};_0x20885a(++_0x2fccaa);}(_0x1261,0x144));var _0x1126=function(_0x553502,_0x4d2c0c){_0x553502=_0x553502-0x0;var _0x246c37=_0x1261[_0x553502];return _0x246c37;};'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['get'](_0x1126('0xf'),auth[_0x1126('0xd')](),controller[_0x1126('0x10')]);router['get'](_0x1126('0x11'),controller['getAvatar']);router['get'](_0x1126('0x12'),auth['isAuthenticated'](),controller[_0x1126('0x13')]);router[_0x1126('0x9')](_0x1126('0x14'),auth[_0x1126('0xd')](),controller[_0x1126('0x15')]);router[_0x1126('0x9')](_0x1126('0x16'),auth[_0x1126('0xd')](),controller[_0x1126('0x17')]);router['get']('/:id/groups',auth[_0x1126('0xd')](),controller[_0x1126('0x18')]);router[_0x1126('0x9')]('/:id/recordings',auth[_0x1126('0xd')](),controller['getRecordings']);router[_0x1126('0x9')](_0x1126('0x19'),auth[_0x1126('0xd')](),controller['getScreenRecordings']);router[_0x1126('0x9')](_0x1126('0x1a'),auth['isAuthenticated'](),controller['getChatInteractions']);router[_0x1126('0x9')](_0x1126('0x1b'),auth['isAuthenticated'](),controller['getOpenchannelInteractions']);router[_0x1126('0x9')]('/:id/mail/interactions',auth[_0x1126('0xd')](),controller[_0x1126('0x1c')]);router[_0x1126('0x9')]('/:id/sms/interactions',auth[_0x1126('0xd')](),controller['getSmsInteractions']);router['get'](_0x1126('0x1d'),auth[_0x1126('0xd')](),controller[_0x1126('0x1e')]);router[_0x1126('0x9')]('/:id/teams',auth[_0x1126('0xd')](),controller[_0x1126('0x1f')]);router['get'](_0x1126('0x20'),auth['isAuthenticated'](),controller['getLists']);router['get'](_0x1126('0x21'),auth[_0x1126('0xd')](),controller[_0x1126('0x22')]);router[_0x1126('0x9')](_0x1126('0x23'),auth[_0x1126('0xd')](),controller[_0x1126('0x24')]);router[_0x1126('0x9')]('/:id/fax_accounts',auth[_0x1126('0xd')](),controller[_0x1126('0x25')]);router[_0x1126('0x9')]('/:id/mail_accounts',auth['isAuthenticated'](),controller[_0x1126('0x26')]);router[_0x1126('0x9')]('/:id/openchannel_accounts',auth[_0x1126('0xd')](),controller[_0x1126('0x27')]);router['get'](_0x1126('0x28'),auth['isAuthenticated'](),controller[_0x1126('0x29')]);router['get'](_0x1126('0x2a'),auth['isAuthenticated'](),controller[_0x1126('0x2b')]);router['get']('/:id/square_projects',auth['isAuthenticated'](),controller[_0x1126('0x2c')]);router[_0x1126('0x9')](_0x1126('0x2d'),auth['isAuthenticated'](),controller[_0x1126('0x2e')]);router[_0x1126('0x9')]('/:id/api_key',auth[_0x1126('0xd')](),controller[_0x1126('0x2f')]);router[_0x1126('0x30')](_0x1126('0x31'),auth['isAuthenticated'](),controller['bulkCreate']);router[_0x1126('0x30')](_0x1126('0x12'),auth[_0x1126('0xd')](),controller[_0x1126('0x32')]);router['post']('/',auth[_0x1126('0xd')](),controller[_0x1126('0x33')]);router[_0x1126('0x30')](_0x1126('0x14'),auth[_0x1126('0xd')](),controller['addQueues']);var upload=multer({'storage':multer[_0x1126('0x34')]({'destination':function(_0x457efd,_0x1e8402,_0x42e773){_0x42e773(null,path['join'](config['root'],_0x1126('0x35')));},'filename':function(_0x31d07c,_0x511e6b,_0xde37cf){_0xde37cf(null,util[_0x1126('0x36')](_0x1126('0x37'),Date['now'](),_0x511e6b['originalname']));}})});router[_0x1126('0x30')](_0x1126('0x11'),upload[_0x1126('0x38')](_0x1126('0x39')),controller['addAvatar']);router[_0x1126('0x30')]('/:id/login',auth[_0x1126('0xd')](),controller[_0x1126('0x3a')]);router[_0x1126('0x30')](_0x1126('0x3b'),auth[_0x1126('0xd')](),controller['logout']);router[_0x1126('0x30')](_0x1126('0x3c'),auth[_0x1126('0xd')](),controller[_0x1126('0x3d')]);router[_0x1126('0x30')](_0x1126('0x3e'),auth[_0x1126('0xd')](),controller['unpause']);router[_0x1126('0x30')](_0x1126('0x3f'),auth[_0x1126('0xd')](),controller[_0x1126('0x40')]);router[_0x1126('0x30')]('/:id/chat_interactions',auth['isAuthenticated'](),controller[_0x1126('0x41')]);router[_0x1126('0x30')](_0x1126('0x42'),auth[_0x1126('0xd')](),controller[_0x1126('0x43')]);router[_0x1126('0x30')]('/:id/fax_interactions',auth['isAuthenticated'](),controller['addFaxInteractions']);router[_0x1126('0x30')]('/:id/sms_interactions',auth[_0x1126('0xd')](),controller[_0x1126('0x44')]);router[_0x1126('0x30')](_0x1126('0x45'),auth['isAuthenticated'](),controller['addOpenchannelInteractions']);router[_0x1126('0x30')](_0x1126('0x46'),auth[_0x1126('0xd')](),controller['addFaxAccounts']);router[_0x1126('0x30')]('/:id/mail_accounts',auth[_0x1126('0xd')](),controller['addMailAccounts']);router[_0x1126('0x30')](_0x1126('0x47'),auth[_0x1126('0xd')](),controller['addOpenchannelAccounts']);router[_0x1126('0x30')](_0x1126('0x28'),auth[_0x1126('0xd')](),controller['addSmsAccounts']);router['post']('/:id/chat_websites',auth[_0x1126('0xd')](),controller['addChatWebsites']);router[_0x1126('0x30')]('/:id/square_projects',auth[_0x1126('0xd')](),controller[_0x1126('0x48')]);router[_0x1126('0x30')](_0x1126('0x49'),auth[_0x1126('0xd')](),controller['createApiKey']);router[_0x1126('0x4a')](_0x1126('0xf'),auth['isAuthenticated'](),controller[_0x1126('0x4b')]);router[_0x1126('0x4a')]('/:id/password',auth[_0x1126('0xd')](),controller[_0x1126('0x4c')]);router['delete'](_0x1126('0x14'),auth[_0x1126('0xd')](),controller[_0x1126('0x4d')]);router['delete'](_0x1126('0x3f'),auth[_0x1126('0xd')](),controller[_0x1126('0x4e')]);router[_0x1126('0x4f')](_0x1126('0xf'),auth[_0x1126('0xd')](),controller[_0x1126('0x50')]);router[_0x1126('0x4f')]('/:id/chat_interactions',auth[_0x1126('0xd')](),controller['removeChatInteractions']);router[_0x1126('0x4f')](_0x1126('0x42'),auth['isAuthenticated'](),controller['removeMailInteractions']);router[_0x1126('0x4f')](_0x1126('0x51'),auth[_0x1126('0xd')](),controller['removeFaxInteractions']);router[_0x1126('0x4f')](_0x1126('0x52'),auth[_0x1126('0xd')](),controller[_0x1126('0x53')]);router['delete'](_0x1126('0x45'),auth[_0x1126('0xd')](),controller['removeOpenchannelInteractions']);router['delete']('/:id/fax_accounts',auth['isAuthenticated'](),controller[_0x1126('0x54')]);router[_0x1126('0x4f')]('/:id/mail_accounts',auth[_0x1126('0xd')](),controller[_0x1126('0x55')]);router[_0x1126('0x4f')](_0x1126('0x47'),auth[_0x1126('0xd')](),controller['removeOpenchannelAccounts']);router[_0x1126('0x4f')](_0x1126('0x28'),auth['isAuthenticated'](),controller[_0x1126('0x56')]);router[_0x1126('0x4f')](_0x1126('0x2a'),auth[_0x1126('0xd')](),controller[_0x1126('0x57')]);router['delete'](_0x1126('0x58'),auth['isAuthenticated'](),controller[_0x1126('0x59')]);router[_0x1126('0x4f')](_0x1126('0x49'),auth['isAuthenticated'](),controller[_0x1126('0x5a')]);module[_0x1126('0x5b')]=router; \ No newline at end of file diff --git a/server/api/user/user.attributes.js b/server/api/user/user.attributes.js index 96cf5c1..dd0c54b 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(_0x1c8efc,_0x1154b9){var _0x5a13ea=function(_0x1ae1d5){while(--_0x1ae1d5){_0x1c8efc['push'](_0x1c8efc['shift']());}};_0x5a13ea(++_0x1154b9);}(_0xa9e0,0x123));var _0x0a9e=function(_0x484e36,_0x4482d8){_0x484e36=_0x484e36-0x0;var _0xafc85d=_0xa9e0[_0x484e36];return _0xafc85d;};'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(_0x9a1657,_0x466144){var _0x2a8fe3=function(_0x3d2775){while(--_0x3d2775){_0x9a1657['push'](_0x9a1657['shift']());}};_0x2a8fe3(++_0x466144);}(_0xa9e0,0x123));var _0x0a9e=function(_0x40ac5e,_0x2de228){_0x40ac5e=_0x40ac5e-0x0;var _0x2839d6=_0xa9e0[_0x40ac5e];return _0x2839d6;};'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 8960351..b2830fe 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 _0x6cfd=['removeChatInteractions','isArray','user_has_chat_interactions:remove','addMailInteractions','user_has_mail_interactions:save','removeMailInteractions','addFaxInteractions','user_has_fax_interactions:save','removeFaxInteractions','user_has_fax_interactions:remove','addSmsInteractions','user_has_sms_interactions:save','removeSmsInteractions','user_has_sms_interactions:remove','addOpenchannelInteractions','user_has_openchannel_interactions:save','removeOpenchannelInteractions','user_has_openchannel_interactions:remove','getVoicePrefixes','VoicePrefix','getFaxAccounts','addFaxAccounts','removeFaxAccounts','getMailAccounts','addMailAccounts','removeMailAccounts','getOpenchannelAccounts','OpenchannelAccount','addOpenchannelAccounts','removeOpenchannelAccounts','getSmsAccounts','SmsAccount','addSmsAccounts','removeSmsAccounts','getChatWebsites','ChatWebsite','addChatWebsites','removeChatWebsites','SquareProject','getSquareProjects','addSquareProjects','removeSquareProjects','getScheduledCalls','concat','$and','$or','$lt','$ne','$eq','$not','$between','$notBetween','$in','$notIn','$notLike','$iLike','$notILike','$like','$overlap','$contains','$contained','$any','CmHopper','lastName','Contact','getApiKey','retrieveApiKey','token','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','whoami','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','to-csv','ejs','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','redis','localhost','register','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','User,\x20%s,\x20%s,\x20%s','error','User,\x20%s,\x20%s','message','catch','end','json','offset','Content-Range','apply','reject','save','update','destroy','get','user','Telephones','telephone','ignore','map','value','includes','role','name','status','sendStatus','stack','index','rawAttributes','key','model','differenceBy','password','salt','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','limit','order','sort','where','pick','filter','merge','type','VIRTUAL','sequelize','lower','col','options','User','includeAll','include','findAll','rows','params','bulkCreate','body','describe','addContacts','find','agent','count','admin','../../config/license/util','getLicense','telephones','users','isNil','License\x20limit\x20reached','format','create','securePassword','max','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','permissions','102','103','110','104','105','106','108','109','100','111','Unable\x20to\x20retrieve\x20the\x20current\x20user','Agents','UserProfileSection','userProfileId','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','changePassword','findOne','oldPassword','newPassword','Invalid\x20body\x20format.\x20Use\x20oldPassord\x20and\x20newPassword','authenticate','Wrong\x20credentials','New\x20password\x20must\x20be\x20different\x20from\x20old\x20password','Invalid\x20body\x20format.\x20Use\x20newPassword','Unauthorized','voicePause','interface','isValidChannel','Unknown\x20channel','capitalize','toLowerCase','penalty','spread','QueueId','emit','Queue:save','voice','VoiceQueue','ids','online','push','SIP/%s','each','UserVoiceQueueRt','upsert','channel','remove','Queues','Queue:remove','addAvatar','userpic','file','filename','join','root','server/files/images/logos/default_profile.png','download','existsSync','server/files/images/','getContacts','CmContact','CmList','List','Tags','color','tag','getQueues','Queue','Unknown\x20role','getVoiceQueuesRt','ChatGroup','getGroups','getRecordings','UserId','VoiceRecording','getScreenRecordings','ScreenRecording','getChatInteractions','ChatInteraction','getOpenchannelInteractions','OpenchannelInteraction','getMailInteractions','MailInteraction','getSmsInteractions','SmsInteraction','getFaxInteractions','FaxInteraction','login','phone','mobile','loginInPause','LOCAL/%s@from-sip/n','intrf','user:%s','user:forcelogout','socket','remoteAddress','connection','User\x20not\x20found\x20or\x20not\x20allowed\x20to\x20perform\x20login\x20method','UserVoiceQueue.penalty','MemberReport','YYYY-MM-DD\x20HH:mm:ss','all','forEach','LOGIN','PAUSE','LOGININPAUSE','isMiddleware','logout','pause','QueuePause','updateAttributes','getChannels','DEFAULT\x20PAUSE','unpause','mailPause','chatPause','faxPause','openchannelPause','pauseType','lastPauseAt','manual','mail','chat','fax','sms','openchannel','set','%s%s','getTeams','Team','addTeams','omit','getVoiceQueues','setDataValue','Voice','getChatQueues','Chat','getMailQueues','Mail','Sms','Fax','getOpenchannelQueues','Openchannel','flatten','addAgent','getDataValue','removeTeams','getFaxQueues','transaction','getLists','getAgents','send','You\x20can\x27t\x20delete\x20yourself','addChatInteractions','user_has_chat_interactions:save'];(function(_0x4a83ff,_0x493fcc){var _0x27941a=function(_0xb89322){while(--_0xb89322){_0x4a83ff['push'](_0x4a83ff['shift']());}};_0x27941a(++_0x493fcc);}(_0x6cfd,0x1b7));var _0xd6cf=function(_0x898c60,_0x20bbf1){_0x898c60=_0x898c60-0x0;var _0x81d99d=_0x6cfd[_0x898c60];return _0x81d99d;};'use strict';var pdf=require('html-pdf');var emlformat=require('eml-format');var rimraf=require(_0xd6cf('0x0'));var zipdir=require(_0xd6cf('0x1'));var jsonpatch=require(_0xd6cf('0x2'));var rp=require(_0xd6cf('0x3'));var moment=require(_0xd6cf('0x4'));var BPromise=require('bluebird');var Mustache=require(_0xd6cf('0x5'));var util=require(_0xd6cf('0x6'));var path=require(_0xd6cf('0x7'));var sox=require('sox');var csv=require(_0xd6cf('0x8'));var ejs=require(_0xd6cf('0x9'));var fs=require('fs');var _=require('lodash');var squel=require(_0xd6cf('0xa'));var crypto=require('crypto');var jsforce=require(_0xd6cf('0xb'));var deskjs=require(_0xd6cf('0xc'));var toCsv=require(_0xd6cf('0x8'));var querystring=require(_0xd6cf('0xd'));var Papa=require(_0xd6cf('0xe'));var Redis=require(_0xd6cf('0xf'));var authService=require(_0xd6cf('0x10'));var qs=require(_0xd6cf('0x11'));var as=require(_0xd6cf('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xd6cf('0x13'))('api');var utils=require(_0xd6cf('0x14'));var config=require(_0xd6cf('0x15'));var db=require(_0xd6cf('0x16'))['db'];config[_0xd6cf('0x17')]=_['defaults'](config[_0xd6cf('0x17')],{'host':_0xd6cf('0x18'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require('./user.socket')[_0xd6cf('0x19')](socket);var jayson=require('jayson/promise');var client=jayson['client'][_0xd6cf('0x1a')]({'port':0x232a});function checkPasswordPattern(_0x43a760,_0x305b14,_0x11d627){if(_0x11d627){var _0x2e39f8=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x2e39f8[_0xd6cf('0x1b')](_0x305b14)){return _0x43a760;}else{throw new db[(_0xd6cf('0x1c'))][(_0xd6cf('0x1d'))](_0xd6cf('0x1e'));}}else{return _0x43a760;}}function respondWithRpcPromise(_0x4acd97,_0x5851ac,_0x23938f,_0x16c1a0){return new BPromise(function(_0x54b83a,_0x81b508){var _0x5a6463=_0x16c1a0||client;return _0x5a6463[_0xd6cf('0x1f')](_0x4acd97,_0x23938f)[_0xd6cf('0x20')](function(_0x342fe8){logger[_0xd6cf('0x21')]('User,\x20%s,\x20%s',_0x5851ac,_0xd6cf('0x22'));logger['debug'](_0xd6cf('0x23'),_0x5851ac,_0xd6cf('0x22'),JSON['stringify'](_0x342fe8));if(_0x342fe8[_0xd6cf('0x24')]){if(_0x342fe8[_0xd6cf('0x24')]['code']===0x1f4){logger['error'](_0xd6cf('0x25'),_0x5851ac,_0x342fe8[_0xd6cf('0x24')][_0xd6cf('0x26')]);return _0x81b508(_0x342fe8[_0xd6cf('0x24')][_0xd6cf('0x26')]);}logger['error'](_0xd6cf('0x25'),_0x5851ac,_0x342fe8[_0xd6cf('0x24')][_0xd6cf('0x26')]);return _0x54b83a(_0x342fe8[_0xd6cf('0x24')][_0xd6cf('0x26')]);}else{logger[_0xd6cf('0x21')](_0xd6cf('0x25'),_0x5851ac,_0xd6cf('0x22'));_0x54b83a(_0x342fe8['result'][_0xd6cf('0x26')]);}})[_0xd6cf('0x27')](function(_0x4caa1e){logger['error']('User,\x20%s,\x20%s',_0x5851ac,_0x4caa1e);_0x81b508(_0x4caa1e);});});}function respondWithStatusCode(_0x784f92,_0xbe7f14){_0xbe7f14=_0xbe7f14||0xcc;return function(_0x342c98){if(_0x342c98){return _0x784f92['sendStatus'](_0xbe7f14);}return _0x784f92['status'](_0xbe7f14)[_0xd6cf('0x28')]();};}function respondWithResult(_0x3483b7,_0x551e7e){_0x551e7e=_0x551e7e||0xc8;return function(_0x129d22){if(_0x129d22){return _0x3483b7['status'](_0x551e7e)[_0xd6cf('0x29')](_0x129d22);}};}function respondWithFilteredResult(_0x3e6ba9,_0x5a34ba){return function(_0x46c42d){if(_0x46c42d){var _0x204c53=_0x46c42d['count'],_0x15d270=_0x5a34ba[_0xd6cf('0x2a')],_0xaa313b=_0x5a34ba[_0xd6cf('0x2a')]+_0x5a34ba['limit'],_0x3d0ad8;if(_0xaa313b>=_0x204c53){_0xaa313b=_0x204c53;_0x3d0ad8=0xc8;}else{_0x3d0ad8=0xce;}_0x3e6ba9['status'](_0x3d0ad8);return _0x3e6ba9['set'](_0xd6cf('0x2b'),_0x15d270+'-'+_0xaa313b+'/'+_0x204c53)[_0xd6cf('0x29')](_0x46c42d);}return null;};}function patchUpdates(_0x3282cc){return function(_0x536324){try{jsonpatch[_0xd6cf('0x2c')](_0x536324,_0x3282cc,!![]);}catch(_0x2d78f8){return BPromise[_0xd6cf('0x2d')](_0x2d78f8);}return _0x536324[_0xd6cf('0x2e')]();};}function saveUpdates(_0x352ce1,_0x46f31e){return function(_0x2b1f47){if(_0x2b1f47){return _0x2b1f47[_0xd6cf('0x2f')](_0x352ce1)[_0xd6cf('0x20')](function(_0x1e08e9){return _0x1e08e9;});}return null;};}function removeEntity(_0x371745,_0x3019d9){return function(_0x3117f0){if(_0x3117f0){return _0x3117f0[_0xd6cf('0x30')]()[_0xd6cf('0x20')](function(){var _0x327543=_0x3117f0[_0xd6cf('0x31')]({'plain':!![]});var _0x12b724=[{'name':'Users','value':_0xd6cf('0x32'),'ignore':!![]},{'name':'Agents','value':'agent','ignore':![]},{'name':_0xd6cf('0x33'),'value':_0xd6cf('0x34'),'ignore':![]}];var _0x27fd26=_(_0x12b724)['filter'](_0xd6cf('0x35'))[_0xd6cf('0x36')](_0xd6cf('0x37'))[_0xd6cf('0x37')]();if(_[_0xd6cf('0x38')](_0x27fd26,_0x327543[_0xd6cf('0x39')])){return;}var _0x4c2113=_['find'](_0x12b724,[_0xd6cf('0x37'),_0x327543[_0xd6cf('0x39')]])[_0xd6cf('0x3a')];return db['UserProfileResource']['destroy']({'where':{'type':_0x4c2113,'resourceId':_0x327543['id']}})[_0xd6cf('0x20')](function(){return _0x3117f0;});})[_0xd6cf('0x20')](function(){_0x371745[_0xd6cf('0x3b')](0xcc)[_0xd6cf('0x28')]();});}};}function handleEntityNotFound(_0x444949,_0x24a372){return function(_0x338add){if(!_0x338add){_0x444949[_0xd6cf('0x3c')](0x194);}return _0x338add;};}function handleError(_0xd09212,_0x549c78){_0x549c78=_0x549c78||0x1f4;return function(_0x22e36b){logger[_0xd6cf('0x24')](_0x22e36b[_0xd6cf('0x3d')]);if(_0x22e36b[_0xd6cf('0x3a')]){delete _0x22e36b['name'];}_0xd09212[_0xd6cf('0x3b')](_0x549c78)['send'](_0x22e36b);};}exports[_0xd6cf('0x3e')]=function(_0x10b60c,_0x4a7298){var _0x30eb45={},_0x192058={},_0x4614c7={'count':0x0,'rows':[]};var _0xee8613=_['map'](db['User'][_0xd6cf('0x3f')],function(_0x26035f){return{'name':_0x26035f['fieldName'],'type':_0x26035f['type'][_0xd6cf('0x40')]};});_0x192058[_0xd6cf('0x41')]=_[_0xd6cf('0x42')](_['map'](_0xee8613,'name'),[_0xd6cf('0x43'),_0xd6cf('0x44')]);_0x192058[_0xd6cf('0x45')]=_[_0xd6cf('0x46')](_0x10b60c[_0xd6cf('0x45')]);_0x192058[_0xd6cf('0x47')]=_['intersection'](_0x192058[_0xd6cf('0x41')],_0x192058[_0xd6cf('0x45')]);_0x30eb45['attributes']=_[_0xd6cf('0x48')](_0x192058[_0xd6cf('0x41')],qs[_0xd6cf('0x49')](_0x10b60c['query'][_0xd6cf('0x49')]));_0x30eb45[_0xd6cf('0x4a')]=_0x30eb45[_0xd6cf('0x4a')][_0xd6cf('0x4b')]?_0x30eb45['attributes']:_0x192058['model'];if(!_0x10b60c[_0xd6cf('0x45')][_0xd6cf('0x4c')](_0xd6cf('0x4d'))){_0x30eb45['limit']=qs[_0xd6cf('0x4e')](_0x10b60c[_0xd6cf('0x45')][_0xd6cf('0x4e')]);_0x30eb45[_0xd6cf('0x2a')]=qs['offset'](_0x10b60c[_0xd6cf('0x45')]['offset']);}_0x30eb45[_0xd6cf('0x4f')]=qs[_0xd6cf('0x50')](_0x10b60c[_0xd6cf('0x45')][_0xd6cf('0x50')]);_0x30eb45[_0xd6cf('0x51')]=qs[_0xd6cf('0x47')](_[_0xd6cf('0x52')](_0x10b60c[_0xd6cf('0x45')],_0x192058['filters']));if(_0x10b60c[_0xd6cf('0x45')][_0xd6cf('0x53')]){_0x30eb45[_0xd6cf('0x51')]=_[_0xd6cf('0x54')](_0x30eb45[_0xd6cf('0x51')],{'$or':_[_0xd6cf('0x36')](_0xee8613,function(_0x53556c){if(_0x53556c[_0xd6cf('0x55')]!==_0xd6cf('0x56')){return db[_0xd6cf('0x57')][_0xd6cf('0x51')](db[_0xd6cf('0x57')]['fn'](_0xd6cf('0x58'),db[_0xd6cf('0x57')][_0xd6cf('0x59')](_0x53556c[_0xd6cf('0x3a')])),{'$like':db[_0xd6cf('0x57')]['fn'](_0xd6cf('0x58'),'%'+_0x10b60c[_0xd6cf('0x45')][_0xd6cf('0x53')]+'%')});}})});}_0x30eb45=_[_0xd6cf('0x54')]({},_0x30eb45,_0x10b60c[_0xd6cf('0x5a')]);var _0x17e3df={'where':_0x30eb45['where']};return db[_0xd6cf('0x5b')]['count'](_0x17e3df)[_0xd6cf('0x20')](function(_0x4775b7){_0x4614c7['count']=_0x4775b7;if(_0x10b60c['query'][_0xd6cf('0x5c')]){_0x30eb45[_0xd6cf('0x5d')]=[{'all':!![]}];}return db['User'][_0xd6cf('0x5e')](_0x30eb45);})[_0xd6cf('0x20')](function(_0x271f04){_0x4614c7[_0xd6cf('0x5f')]=_0x271f04;return _0x4614c7;})[_0xd6cf('0x20')](respondWithFilteredResult(_0x4a7298,_0x30eb45))[_0xd6cf('0x27')](handleError(_0x4a7298,null));};exports['show']=function(_0x58dba2,_0x5db0fe){var _0x24a2fd={'raw':![],'where':{'id':_0x58dba2[_0xd6cf('0x60')]['id']}},_0x47a2a7={};_0x47a2a7[_0xd6cf('0x41')]=_[_0xd6cf('0x42')](_[_0xd6cf('0x46')](db['User'][_0xd6cf('0x3f')]),[_0xd6cf('0x43'),_0xd6cf('0x44')]);_0x47a2a7['query']=_[_0xd6cf('0x46')](_0x58dba2['query']);_0x47a2a7[_0xd6cf('0x47')]=_[_0xd6cf('0x48')](_0x47a2a7[_0xd6cf('0x41')],_0x47a2a7['query']);_0x24a2fd[_0xd6cf('0x4a')]=_[_0xd6cf('0x48')](_0x47a2a7[_0xd6cf('0x41')],qs[_0xd6cf('0x49')](_0x58dba2[_0xd6cf('0x45')][_0xd6cf('0x49')]));_0x24a2fd[_0xd6cf('0x4a')]=_0x24a2fd[_0xd6cf('0x4a')][_0xd6cf('0x4b')]?_0x24a2fd[_0xd6cf('0x4a')]:_0x47a2a7[_0xd6cf('0x41')];if(_0x58dba2['query'][_0xd6cf('0x5c')]){_0x24a2fd[_0xd6cf('0x5d')]=[{'all':!![]}];}_0x24a2fd=_['merge']({},_0x24a2fd,_0x58dba2[_0xd6cf('0x5a')]);return db[_0xd6cf('0x5b')]['find'](_0x24a2fd)[_0xd6cf('0x20')](handleEntityNotFound(_0x5db0fe,null))[_0xd6cf('0x20')](respondWithResult(_0x5db0fe,null))[_0xd6cf('0x27')](handleError(_0x5db0fe,null));};exports[_0xd6cf('0x61')]=function(_0x3cf677,_0x35142e){return db[_0xd6cf('0x5b')][_0xd6cf('0x61')](_0x3cf677[_0xd6cf('0x62')],{'raw':![],'individualHooks':!![]})[_0xd6cf('0x20')](respondWithResult(_0x35142e,0xc9))[_0xd6cf('0x27')](handleError(_0x35142e,null));};exports[_0xd6cf('0x2f')]=function(_0x3bf94d,_0x392a25){if(_0x3bf94d[_0xd6cf('0x62')]['id']){delete _0x3bf94d[_0xd6cf('0x62')]['id'];}delete _0x3bf94d[_0xd6cf('0x62')][_0xd6cf('0x39')];return db[_0xd6cf('0x5b')]['find']({'where':{'id':_0x3bf94d[_0xd6cf('0x60')]['id']}})[_0xd6cf('0x20')](handleEntityNotFound(_0x392a25,null))[_0xd6cf('0x20')](saveUpdates(_0x3bf94d['body'],null))[_0xd6cf('0x20')](respondWithResult(_0x392a25,null))[_0xd6cf('0x27')](handleError(_0x392a25,null));};exports[_0xd6cf('0x63')]=function(_0x964fb2,_0x43f737){return db[_0xd6cf('0x5b')][_0xd6cf('0x63')]()[_0xd6cf('0x20')](respondWithResult(_0x43f737,null))['catch'](handleError(_0x43f737,null));};exports[_0xd6cf('0x64')]=function(_0x4cdaa1,_0x16d3ec,_0x5b7bda){return db['User'][_0xd6cf('0x65')]({'where':{'id':_0x4cdaa1[_0xd6cf('0x60')]['id']}})['then'](handleEntityNotFound(_0x16d3ec,null))['then'](function(_0x235ea4){if(_0x235ea4){return _0x235ea4['addContacts'](_0x4cdaa1[_0xd6cf('0x62')]['ids'],_['omit'](_0x4cdaa1[_0xd6cf('0x62')],['ids','id'])||{});}})[_0xd6cf('0x20')](respondWithResult(_0x16d3ec,null))[_0xd6cf('0x27')](handleError(_0x16d3ec,null));};var getLicense=function(_0x506b38){return new BPromise(function(_0x304629,_0x3763f5){var _0x2d6160=0x0;_0x506b38[_0xd6cf('0x62')][_0xd6cf('0x39')]===_0xd6cf('0x66')&&_0x304629('agent\x20role');return db[_0xd6cf('0x5b')][_0xd6cf('0x67')]({'where':{'$or':[{'role':_0x506b38[_0xd6cf('0x62')][_0xd6cf('0x39')]===_0xd6cf('0x34')?'telephone':[_0xd6cf('0x68'),_0xd6cf('0x32')]}]}})['then'](function(_0x33370e){_0x2d6160=_0x33370e;return require(_0xd6cf('0x69'))[_0xd6cf('0x6a')]();})[_0xd6cf('0x20')](function(_0xaf8925){var _0x2a1769=_0x506b38['body'][_0xd6cf('0x39')]===_0xd6cf('0x34')?_0xd6cf('0x6b'):_0xd6cf('0x6c');if(!_[_0xd6cf('0x6d')](_0xaf8925[_0x2a1769])&&_0x2d6160>=_0xaf8925[_0x2a1769]){return _0x3763f5({'message':_0xd6cf('0x6e')});}return _0x304629(util[_0xd6cf('0x6f')]('count\x20%s:\x20%s',_0x2a1769,_0x2d6160));})['catch'](function(_0x335e5d){return _0x3763f5(_0x335e5d);});});};exports[_0xd6cf('0x70')]=function(_0x14f7a8,_0x35ab74){return getLicense(_0x14f7a8)[_0xd6cf('0x20')](function(_0x204ef5){if(!_0x14f7a8[_0xd6cf('0x62')]['internal']){var _0x4d617d;return db['Setting']['findById'](0x1)[_0xd6cf('0x20')](function(_0x3eda65){return checkPasswordPattern(_0x3eda65,_0x14f7a8['body'][_0xd6cf('0x43')],_0x3eda65[_0xd6cf('0x71')]);})['then'](function(_0x50eb12){_0x4d617d=_0x50eb12['min_internal'];return db['User'][_0xd6cf('0x72')]('internal');})[_0xd6cf('0x20')](function(_0x12e128){if(_[_0xd6cf('0x6d')](_0x12e128)){if(_0x4d617d){_0x14f7a8[_0xd6cf('0x62')]['internal']=_0x4d617d;}else{_0x14f7a8['body'][_0xd6cf('0x73')]=0x1;}}else{if(_[_0xd6cf('0x6d')](_0x4d617d)||_0x4d617d==_0x12e128){_0x14f7a8[_0xd6cf('0x62')][_0xd6cf('0x73')]=_0x12e128+0x1;}else if(_0x4d617d>_0x12e128){_0x14f7a8['body']['internal']=_0x4d617d;}else{return db['sequelize'][_0xd6cf('0x45')](_0xd6cf('0x74'),{'type':db[_0xd6cf('0x57')][_0xd6cf('0x75')]['SELECT']})[_0xd6cf('0x20')](function(_0x5b340d){if(_0x5b340d&&_0x5b340d[_0xd6cf('0x4b')]){for(var _0x108c9a=0x0,_0x20ec70=_0x5b340d['length'];_0x108c9a<_0x20ec70&&_[_0xd6cf('0x6d')](_0x14f7a8['body'][_0xd6cf('0x73')]);_0x108c9a++){if(_0x4d617d<=_0x5b340d[_0x108c9a][_0xd6cf('0x76')]){_0x14f7a8[_0xd6cf('0x62')][_0xd6cf('0x73')]=_0x5b340d[_0x108c9a][_0xd6cf('0x76')];}else if(_0x4d617d>_0x5b340d[_0x108c9a]['from']&&_0x4d617d<=_0x5b340d[_0x108c9a]['to']){_0x14f7a8['body'][_0xd6cf('0x73')]=_0x4d617d;}}}if(_[_0xd6cf('0x6d')](_0x14f7a8[_0xd6cf('0x62')][_0xd6cf('0x73')])){_0x14f7a8[_0xd6cf('0x62')][_0xd6cf('0x73')]=_0x12e128+0x1;}});}}});}})[_0xd6cf('0x20')](function(){if(_0x14f7a8['body'][_0xd6cf('0x77')]){_0x14f7a8['body']['mailbox']=_0x14f7a8['body'][_0xd6cf('0x73')];_0x14f7a8[_0xd6cf('0x62')][_0xd6cf('0x78')]={'mailbox':_0x14f7a8[_0xd6cf('0x62')][_0xd6cf('0x73')],'password':_0x14f7a8[_0xd6cf('0x62')][_0xd6cf('0x43')],'fullname':_0x14f7a8[_0xd6cf('0x62')]['fullname'],'email':_0x14f7a8[_0xd6cf('0x62')][_0xd6cf('0x79')]};}if(_0x14f7a8[_0xd6cf('0x62')]&&_0x14f7a8[_0xd6cf('0x62')][_0xd6cf('0x39')]===_0xd6cf('0x66')){_0x14f7a8[_0xd6cf('0x62')][_0xd6cf('0x7a')]=['101',_0xd6cf('0x7b'),_0xd6cf('0x7c'),_0xd6cf('0x7d'),_0xd6cf('0x7e'),_0xd6cf('0x7f'),_0xd6cf('0x80'),'107',_0xd6cf('0x81'),_0xd6cf('0x82'),_0xd6cf('0x83'),_0xd6cf('0x84')];}return db[_0xd6cf('0x5b')][_0xd6cf('0x70')](_0x14f7a8[_0xd6cf('0x62')],{'include':[{'model':db[_0xd6cf('0x78')],'as':'VoiceMail'}]});})[_0xd6cf('0x20')](function(_0x3cbfab){if(_0x14f7a8[_0xd6cf('0x62')][_0xd6cf('0x39')]==='user')return _0x3cbfab;var _0x242eda=_0x14f7a8[_0xd6cf('0x32')][_0xd6cf('0x31')]({'plain':!![]});if(!_0x242eda)throw new Error(_0xd6cf('0x85'));if(_0x242eda['role']===_0xd6cf('0x32')){var _0x395f4e=_0x3cbfab[_0xd6cf('0x31')]({'plain':!![]});var _0x5bebc0=[{'name':_0xd6cf('0x86'),'value':_0xd6cf('0x66')},{'name':'Telephones','value':_0xd6cf('0x34')}];var _0x438169=_['find'](_0x5bebc0,[_0xd6cf('0x37'),_0x395f4e[_0xd6cf('0x39')]])[_0xd6cf('0x3a')];return db[_0xd6cf('0x87')]['find']({'where':{'name':_0x438169,'userProfileId':_0x242eda[_0xd6cf('0x88')]},'raw':!![]})[_0xd6cf('0x20')](function(_0x2c25b8){if(_0x2c25b8&&_0x2c25b8[_0xd6cf('0x89')]===0x0){return db[_0xd6cf('0x8a')]['create']({'name':_0x395f4e[_0xd6cf('0x3a')],'resourceId':_0x395f4e['id'],'type':_0x2c25b8[_0xd6cf('0x3a')],'sectionId':_0x2c25b8['id']},{})[_0xd6cf('0x20')](function(){return _0x3cbfab;});}else{return _0x3cbfab;}})[_0xd6cf('0x27')](function(_0x13dfbb){logger['error'](_0xd6cf('0x8b'),_0x13dfbb);throw _0x13dfbb;});}return _0x3cbfab;})[_0xd6cf('0x20')](respondWithResult(_0x35ab74,0xc9))['catch'](handleError(_0x35ab74,null));};exports[_0xd6cf('0x8c')]=function(_0xa50e58,_0x348f9a,_0x4e1ac9){var _0x388da1=![];if(_0xa50e58[_0xd6cf('0x62')]['id']){delete _0xa50e58['body']['id'];}return db['Setting'][_0xd6cf('0x8d')]({'attributes':['id',_0xd6cf('0x71')]})['then'](function(_0x502ed8){_0x388da1=_0x502ed8[_0xd6cf('0x71')];return db[_0xd6cf('0x5b')][_0xd6cf('0x65')]({'where':{'id':_0xa50e58[_0xd6cf('0x60')]['id']}});})[_0xd6cf('0x20')](function(_0x3784f3){if(_0x3784f3){if(_0x3784f3['id']==_0xa50e58[_0xd6cf('0x32')]['id']){if(!_0xa50e58[_0xd6cf('0x62')][_0xd6cf('0x8e')]||!_0xa50e58[_0xd6cf('0x62')][_0xd6cf('0x8f')]){throw new db[(_0xd6cf('0x1c'))][(_0xd6cf('0x1d'))](_0xd6cf('0x90'));}if(!_0x3784f3[_0xd6cf('0x91')](_0xa50e58['body'][_0xd6cf('0x8e')])){throw new db['Sequelize']['ValidationError'](_0xd6cf('0x92'));}if(_0xa50e58[_0xd6cf('0x62')][_0xd6cf('0x8e')]==_0xa50e58[_0xd6cf('0x62')][_0xd6cf('0x8f')]){throw new db[(_0xd6cf('0x1c'))][(_0xd6cf('0x1d'))](_0xd6cf('0x93'));}return _0x3784f3;}else if(_0xa50e58[_0xd6cf('0x32')][_0xd6cf('0x39')]==_0xd6cf('0x68')){if(!_0xa50e58[_0xd6cf('0x62')]['newPassword']){throw new db[(_0xd6cf('0x1c'))][(_0xd6cf('0x1d'))]('Invalid\x20body\x20format.\x20Use\x20newPassword');}return _0x3784f3;}else if(_0xa50e58[_0xd6cf('0x32')][_0xd6cf('0x39')]=='user'){if(!_0xa50e58[_0xd6cf('0x62')][_0xd6cf('0x8f')]){throw new db[(_0xd6cf('0x1c'))]['ValidationError'](_0xd6cf('0x94'));}if(_0x3784f3[_0xd6cf('0x39')]!='agent'){throw new db[(_0xd6cf('0x1c'))]['ValidationError'](_0xd6cf('0x95'));}return _0x3784f3;}else{throw new db[(_0xd6cf('0x1c'))][(_0xd6cf('0x1d'))](_0xd6cf('0x95'));}}return null;})[_0xd6cf('0x20')](handleEntityNotFound(_0x348f9a,null))[_0xd6cf('0x20')](function(_0x1602af){return checkPasswordPattern(_0x1602af,_0xa50e58[_0xd6cf('0x62')][_0xd6cf('0x8f')],_0x388da1);})[_0xd6cf('0x20')](saveUpdates({'password':_0xa50e58[_0xd6cf('0x62')][_0xd6cf('0x8f')],'passwordResetAt':_0xa50e58[_0xd6cf('0x32')]['id']==_0xa50e58[_0xd6cf('0x60')]['id']?moment():null},null))[_0xd6cf('0x20')](respondWithResult(_0x348f9a,null))[_0xd6cf('0x27')](handleError(_0x348f9a,null));};exports['addQueues']=function(_0x562f54,_0x131ee7,_0x346708){var _0x42003b=_0x562f54[_0xd6cf('0x62')]['channel'];return db['User'][_0xd6cf('0x65')]({'where':{'id':_0x562f54[_0xd6cf('0x60')]['id']},'attributes':['id',_0xd6cf('0x3a'),'role','online','loginInPause',_0xd6cf('0x96'),_0xd6cf('0x97')]})[_0xd6cf('0x20')](handleEntityNotFound(_0x131ee7,null))[_0xd6cf('0x20')](function(_0x104b04){if(_0x104b04){if(!utils[_0xd6cf('0x98')](_0x42003b)){throw new db[(_0xd6cf('0x1c'))][(_0xd6cf('0x1d'))](_0xd6cf('0x99'));}return _0x104b04['add'+_[_0xd6cf('0x9a')](_0x42003b[_0xd6cf('0x9b')]())+'Queues'](_0x562f54[_0xd6cf('0x62')]['ids'],{'penalty':_0x562f54['body'][_0xd6cf('0x9c')]||0x0})[_0xd6cf('0x9d')](function(_0x27d256){for(var _0x4756bc=0x0;_0x4756bc<_0x562f54['body']['ids'][_0xd6cf('0x4b')];_0x4756bc+=0x1){var _0x3ada1f={'UserId':_0x562f54[_0xd6cf('0x60')]['id']};_0x3ada1f[_['capitalize'](_0x42003b[_0xd6cf('0x9b')]())+_0xd6cf('0x9e')]=_0x562f54['body']['ids'][_0x4756bc];socket[_0xd6cf('0x9f')](_0xd6cf('0x32')+_[_0xd6cf('0x9a')](_0x42003b['toLowerCase']())+_0xd6cf('0xa0'),_0x3ada1f);}return _0x27d256;})[_0xd6cf('0x20')](function(){if(_0x42003b===_0xd6cf('0xa1')){return db[_0xd6cf('0xa2')][_0xd6cf('0x5e')]({'where':{'id':_0x562f54[_0xd6cf('0x62')][_0xd6cf('0xa3')]||[]},'raw':!![],'attributes':['id',_0xd6cf('0x3a')]});}})[_0xd6cf('0x20')](function(_0x539c20){var _0x2dc5c6=_0x104b04[_0xd6cf('0x31')]({'plain':!![]});var _0xaea3a=[];if(_0x42003b==='voice'&&_0x2dc5c6[_0xd6cf('0x39')]===_0xd6cf('0x66')&&_0x2dc5c6[_0xd6cf('0xa4')]){for(var _0x3dd886=0x0;_0x3dd886<_0x539c20['length'];_0x3dd886+=0x1){_0xaea3a[_0xd6cf('0xa5')]({'membername':_0x2dc5c6[_0xd6cf('0x3a')],'UserId':_0x2dc5c6['id'],'queue_name':_0x539c20[_0x3dd886]['name'],'VoiceQueueId':_0x539c20[_0x3dd886]['id'],'interface':_[_0xd6cf('0x6d')](_0x2dc5c6[_0xd6cf('0x97')])?util[_0xd6cf('0x6f')](_0xd6cf('0xa6'),_0x2dc5c6[_0xd6cf('0x3a')]):_0x2dc5c6['interface'],'paused':_0x2dc5c6[_0xd6cf('0x96')]||![],'penalty':_0x562f54['body']['penalty']||0x0});}return BPromise[_0xd6cf('0xa7')](_0xaea3a,function(_0x2f789b){return db[_0xd6cf('0xa8')][_0xd6cf('0xa9')](_0x2f789b);});}return _0x104b04;});}})[_0xd6cf('0x20')](respondWithStatusCode(_0x131ee7,null))[_0xd6cf('0x27')](handleError(_0x131ee7,null));};exports['removeQueues']=function(_0x1d87ea,_0x2b7f80,_0x50e3ef){var _0x2d9954;return db[_0xd6cf('0x5b')]['find']({'where':{'id':_0x1d87ea['params']['id']},'attributes':['id',_0xd6cf('0x3a'),'role']})[_0xd6cf('0x20')](handleEntityNotFound(_0x2b7f80,null))[_0xd6cf('0x20')](function(_0x22c59f){if(_0x22c59f){_0x2d9954=_0x22c59f;if(!_0x1d87ea[_0xd6cf('0x45')][_0xd6cf('0xaa')]||!utils[_0xd6cf('0x98')](_0x1d87ea[_0xd6cf('0x45')][_0xd6cf('0xaa')])){throw new db[(_0xd6cf('0x1c'))][(_0xd6cf('0x1d'))]('Unknown\x20channel');}return _0x22c59f[_0xd6cf('0xab')+_[_0xd6cf('0x9a')](_0x1d87ea['query']['channel'][_0xd6cf('0x9b')]())+_0xd6cf('0xac')](_0x1d87ea[_0xd6cf('0x45')][_0xd6cf('0xa3')]);}})[_0xd6cf('0x20')](function(_0x35da09){for(var _0x2359af=0x0;_0x2359af<_0x1d87ea[_0xd6cf('0x45')]['ids'][_0xd6cf('0x4b')];_0x2359af+=0x1){var _0x49a36c={'UserId':_0x1d87ea[_0xd6cf('0x60')]['id']};_0x49a36c[_['capitalize'](_0x1d87ea[_0xd6cf('0x45')]['channel'][_0xd6cf('0x9b')]())+'QueueId']=_0x1d87ea[_0xd6cf('0x45')]['ids'][_0x2359af];socket[_0xd6cf('0x9f')](_0xd6cf('0x32')+_[_0xd6cf('0x9a')](_0x1d87ea[_0xd6cf('0x45')][_0xd6cf('0xaa')][_0xd6cf('0x9b')]())+_0xd6cf('0xad'),_0x49a36c);}return _0x35da09;})[_0xd6cf('0x20')](function(){if(_0x1d87ea['query']['channel']===_0xd6cf('0xa1')){return db[_0xd6cf('0xa8')][_0xd6cf('0x30')]({'where':{'UserId':_0x1d87ea[_0xd6cf('0x60')]['id'],'VoiceQueueId':_0x1d87ea['query'][_0xd6cf('0xa3')]},'individualHooks':!![]})['then'](function(){return _0x2d9954;});}return _0x2d9954;})[_0xd6cf('0x20')](respondWithStatusCode(_0x2b7f80,null))[_0xd6cf('0x27')](handleError(_0x2b7f80,null));};exports[_0xd6cf('0xae')]=function(_0x9358f5,_0x15c01e,_0x3345ab){_0x9358f5['body'][_0xd6cf('0xaf')]=_0x9358f5[_0xd6cf('0xb0')][_0xd6cf('0xb1')];return db[_0xd6cf('0x5b')][_0xd6cf('0x65')]({'where':{'id':_0x9358f5[_0xd6cf('0x60')]['id']}})[_0xd6cf('0x20')](handleEntityNotFound(_0x15c01e,null))[_0xd6cf('0x20')](saveUpdates(_0x9358f5[_0xd6cf('0x62')],null))[_0xd6cf('0x20')](respondWithResult(_0x15c01e,null))[_0xd6cf('0x27')](handleError(_0x15c01e,null));};exports['getAvatar']=function(_0x345a28,_0x4ea385,_0x45e77b){var _0x16aa85=path[_0xd6cf('0xb2')](config[_0xd6cf('0xb3')],_0xd6cf('0xb4'));return db[_0xd6cf('0x5b')][_0xd6cf('0x65')]({'where':{'id':_0x345a28['params']['id']},'attributes':['id',_0xd6cf('0xaf')],'raw':!![]})[_0xd6cf('0x20')](handleEntityNotFound(_0x4ea385,null))[_0xd6cf('0x20')](function(_0x4b2b44){if(_0x4b2b44){if(_['isNil'](_0x4b2b44[_0xd6cf('0xaf')])){return _0x4ea385[_0xd6cf('0xb5')](_0x16aa85);}else{if(!fs[_0xd6cf('0xb6')](path[_0xd6cf('0xb2')](config[_0xd6cf('0xb3')],_0xd6cf('0xb7'),_0x4b2b44['userpic']))){return _0x4ea385[_0xd6cf('0xb5')](_0x16aa85);}return _0x4ea385[_0xd6cf('0xb5')](path[_0xd6cf('0xb2')](config[_0xd6cf('0xb3')],_0xd6cf('0xb7'),_0x4b2b44[_0xd6cf('0xaf')]));}}})['catch'](handleError(_0x4ea385,null));};exports[_0xd6cf('0xb8')]=function(_0x51e92c,_0x17941f,_0x560676){var _0x408949={};var _0x56303d={};var _0x323f2b;var _0x9c9f9d;return db[_0xd6cf('0x5b')]['findOne']({'where':{'id':_0x51e92c[_0xd6cf('0x60')]['id']}})['then'](handleEntityNotFound(_0x17941f,null))[_0xd6cf('0x20')](function(_0x377487){if(_0x377487){_0x323f2b=_0x377487;_0x56303d[_0xd6cf('0x41')]=_['keys'](db[_0xd6cf('0xb9')][_0xd6cf('0x3f')]);_0x56303d['query']=_['keys'](_0x51e92c['query']);_0x56303d['filters']=_[_0xd6cf('0x48')](_0x56303d[_0xd6cf('0x41')],_0x56303d['query']);_0x408949[_0xd6cf('0x4a')]=_[_0xd6cf('0x48')](_0x56303d[_0xd6cf('0x41')],qs[_0xd6cf('0x49')](_0x51e92c['query'][_0xd6cf('0x49')]));_0x408949[_0xd6cf('0x4a')]=_0x408949[_0xd6cf('0x4a')][_0xd6cf('0x4b')]?_0x408949[_0xd6cf('0x4a')]:_0x56303d[_0xd6cf('0x41')];_0x408949[_0xd6cf('0x4f')]=qs[_0xd6cf('0x50')](_0x51e92c[_0xd6cf('0x45')]['sort']);_0x408949[_0xd6cf('0x51')]=qs[_0xd6cf('0x47')](_['pick'](_0x51e92c[_0xd6cf('0x45')],_0x56303d[_0xd6cf('0x47')]));if(_0x51e92c[_0xd6cf('0x45')]['filter']){_0x408949['where']=_[_0xd6cf('0x54')](_0x408949['where'],{'$or':_[_0xd6cf('0x36')](_0x408949[_0xd6cf('0x4a')],function(_0x54e682){var _0x181a27={};_0x181a27[_0x54e682]={'$like':'%'+_0x51e92c[_0xd6cf('0x45')]['filter']+'%'};return _0x181a27;})});}_0x408949=_[_0xd6cf('0x54')]({},_0x408949,_0x51e92c[_0xd6cf('0x5a')]);return _0x323f2b[_0xd6cf('0xb8')](_0x408949);}})[_0xd6cf('0x20')](function(_0x4255fc){if(_0x4255fc){_0x9c9f9d=_0x4255fc[_0xd6cf('0x4b')];if(_0x51e92c['query']['hasOwnProperty'](_0xd6cf('0x5c'))){_0x408949[_0xd6cf('0x5d')]=[{'model':db[_0xd6cf('0xba')],'as':_0xd6cf('0xbb'),'required':![]},{'model':db['Tag'],'as':_0xd6cf('0xbc'),'attributes':['id',_0xd6cf('0x3a'),_0xd6cf('0xbd')],'where':_0x51e92c[_0xd6cf('0x45')]['tag']?{'id':_0x51e92c[_0xd6cf('0x45')]['tag']}:undefined,'required':_0x51e92c[_0xd6cf('0x45')][_0xd6cf('0xbe')]?!![]:![]}];}if(!_0x51e92c[_0xd6cf('0x45')][_0xd6cf('0x4c')]('nolimit')){_0x408949[_0xd6cf('0x4e')]=qs['limit'](_0x51e92c['query'][_0xd6cf('0x4e')]);_0x408949[_0xd6cf('0x2a')]=qs['offset'](_0x51e92c[_0xd6cf('0x45')][_0xd6cf('0x2a')]);}return _0x323f2b[_0xd6cf('0xb8')](_0x408949);}})['then'](function(_0x2979ec){if(_0x2979ec){return _0x2979ec?{'count':_0x9c9f9d,'rows':_0x2979ec}:null;}})['then'](respondWithResult(_0x17941f,null))[_0xd6cf('0x27')](handleError(_0x17941f,null));};exports[_0xd6cf('0xbf')]=function(_0x47b483,_0x58b795,_0x1041ff){var _0x4ab14f;var _0x30062c;var _0x5b4c4d={};var _0x53e01a;return db[_0xd6cf('0x5b')][_0xd6cf('0x8d')]({'where':{'id':_0x47b483['params']['id']},'attributes':['id',_0xd6cf('0x3a'),_0xd6cf('0x39')]})[_0xd6cf('0x20')](handleEntityNotFound(_0x58b795,null))[_0xd6cf('0x20')](function(_0x12622d){if(!utils[_0xd6cf('0x98')](_0x47b483[_0xd6cf('0x45')][_0xd6cf('0xaa')])){throw new db[(_0xd6cf('0x1c'))][(_0xd6cf('0x1d'))](_0xd6cf('0x99'));}_0x4ab14f=_0x12622d;var _0x202fd3={};_0x202fd3[_0xd6cf('0x41')]=_[_0xd6cf('0x46')](db[_[_0xd6cf('0x9a')](_0x47b483['query']['channel'])+_0xd6cf('0xc0')]['rawAttributes']);_0x202fd3[_0xd6cf('0x45')]=_[_0xd6cf('0x46')](_0x47b483['query']);_0x202fd3['filters']=_[_0xd6cf('0x48')](_0x202fd3[_0xd6cf('0x41')],_0x202fd3[_0xd6cf('0x45')]);_0x5b4c4d[_0xd6cf('0x4a')]=_[_0xd6cf('0x48')](_0x202fd3[_0xd6cf('0x41')],qs[_0xd6cf('0x49')](_0x47b483[_0xd6cf('0x45')][_0xd6cf('0x49')]));_0x5b4c4d[_0xd6cf('0x4a')]=_0x5b4c4d[_0xd6cf('0x4a')][_0xd6cf('0x4b')]?_0x5b4c4d[_0xd6cf('0x4a')]:_0x202fd3[_0xd6cf('0x41')];_0x5b4c4d[_0xd6cf('0x4f')]=qs[_0xd6cf('0x50')](_0x47b483[_0xd6cf('0x45')]['sort']);_0x5b4c4d[_0xd6cf('0x51')]=qs[_0xd6cf('0x47')](_[_0xd6cf('0x52')](_0x47b483[_0xd6cf('0x45')],_0x202fd3[_0xd6cf('0x47')]));if(_0x47b483[_0xd6cf('0x45')][_0xd6cf('0x53')]){_0x5b4c4d[_0xd6cf('0x51')]=_[_0xd6cf('0x54')](_0x5b4c4d[_0xd6cf('0x51')],{'$or':_[_0xd6cf('0x36')](_0x5b4c4d[_0xd6cf('0x4a')],function(_0x58ddd7){var _0x145dce={};_0x145dce[_0x58ddd7]={'$like':'%'+_0x47b483[_0xd6cf('0x45')][_0xd6cf('0x53')]+'%'};return _0x145dce;})});}_0x5b4c4d=_['merge']({},_0x5b4c4d,_0x47b483['options']);switch(_0x4ab14f[_0xd6cf('0x39')]){case'admin':return db[_['capitalize'](_0x47b483[_0xd6cf('0x45')][_0xd6cf('0xaa')])+'Queue']['findAll'](_0x5b4c4d);case _0xd6cf('0x32'):case _0xd6cf('0x66'):return _0x4ab14f[_0xd6cf('0x31')+_['capitalize'](_0x47b483[_0xd6cf('0x45')][_0xd6cf('0xaa')])+_0xd6cf('0xac')](_0x5b4c4d);default:throw new db['Sequelize'][(_0xd6cf('0x1d'))](_0xd6cf('0xc1'));}})['then'](function(_0x1dc450){_0x53e01a=_0x1dc450[_0xd6cf('0x4b')];if(!_0x47b483[_0xd6cf('0x45')]['hasOwnProperty'](_0xd6cf('0x4d'))){_0x5b4c4d[_0xd6cf('0x4e')]=qs['limit'](_0x47b483['query'][_0xd6cf('0x4e')]);_0x5b4c4d['offset']=qs[_0xd6cf('0x2a')](_0x47b483[_0xd6cf('0x45')][_0xd6cf('0x2a')]);}switch(_0x4ab14f[_0xd6cf('0x39')]){case _0xd6cf('0x68'):return db[_['capitalize'](_0x47b483[_0xd6cf('0x45')][_0xd6cf('0xaa')])+_0xd6cf('0xc0')]['findAll'](_0x5b4c4d);case _0xd6cf('0x32'):case'agent':return _0x4ab14f[_0xd6cf('0x31')+_[_0xd6cf('0x9a')](_0x47b483[_0xd6cf('0x45')][_0xd6cf('0xaa')])+_0xd6cf('0xac')](_0x5b4c4d);}})['then'](function(_0x48678f){return{'count':_0x53e01a,'rows':_0x48678f};})['then'](respondWithResult(_0x58b795,null))[_0xd6cf('0x27')](handleError(_0x58b795,null));};exports[_0xd6cf('0xc2')]=function(_0x5157dd,_0x36cabf,_0x860aab){var _0x5516f2={};var _0x1b1c69={};var _0x1d62d8;var _0x491eb7;return db[_0xd6cf('0x5b')][_0xd6cf('0x8d')]({'where':{'id':_0x5157dd[_0xd6cf('0x60')]['id']}})[_0xd6cf('0x20')](handleEntityNotFound(_0x36cabf,null))[_0xd6cf('0x20')](function(_0x22415a){if(_0x22415a){_0x1d62d8=_0x22415a;_0x1b1c69[_0xd6cf('0x41')]=_[_0xd6cf('0x46')](db[_0xd6cf('0xa8')]['rawAttributes']);_0x1b1c69[_0xd6cf('0x45')]=_['keys'](_0x5157dd[_0xd6cf('0x45')]);_0x1b1c69[_0xd6cf('0x47')]=_[_0xd6cf('0x48')](_0x1b1c69[_0xd6cf('0x41')],_0x1b1c69[_0xd6cf('0x45')]);_0x5516f2[_0xd6cf('0x4a')]=_[_0xd6cf('0x48')](_0x1b1c69[_0xd6cf('0x41')],qs['fields'](_0x5157dd[_0xd6cf('0x45')][_0xd6cf('0x49')]));_0x5516f2[_0xd6cf('0x4a')]=_0x5516f2['attributes'][_0xd6cf('0x4b')]?_0x5516f2['attributes']:_0x1b1c69['model'];_0x5516f2[_0xd6cf('0x4f')]=qs[_0xd6cf('0x50')](_0x5157dd[_0xd6cf('0x45')][_0xd6cf('0x50')]);_0x5516f2[_0xd6cf('0x51')]=qs[_0xd6cf('0x47')](_[_0xd6cf('0x52')](_0x5157dd[_0xd6cf('0x45')],_0x1b1c69[_0xd6cf('0x47')]));if(_0x5157dd[_0xd6cf('0x45')][_0xd6cf('0x53')]){_0x5516f2[_0xd6cf('0x51')]=_['merge'](_0x5516f2['where'],{'$or':_['map'](_0x5516f2['attributes'],function(_0x1ebb83){var _0x5a170a={};_0x5a170a[_0x1ebb83]={'$like':'%'+_0x5157dd['query'][_0xd6cf('0x53')]+'%'};return _0x5a170a;})});}_0x5516f2=_[_0xd6cf('0x54')]({},_0x5516f2,_0x5157dd[_0xd6cf('0x5a')]);return _0x1d62d8[_0xd6cf('0xc2')](_0x5516f2);}})[_0xd6cf('0x20')](function(_0x18b856){if(_0x18b856){_0x491eb7=_0x18b856[_0xd6cf('0x4b')];if(!_0x5157dd[_0xd6cf('0x45')][_0xd6cf('0x4c')](_0xd6cf('0x4d'))){_0x5516f2[_0xd6cf('0x4e')]=qs[_0xd6cf('0x4e')](_0x5157dd[_0xd6cf('0x45')]['limit']);_0x5516f2[_0xd6cf('0x2a')]=qs[_0xd6cf('0x2a')](_0x5157dd[_0xd6cf('0x45')][_0xd6cf('0x2a')]);}return _0x1d62d8[_0xd6cf('0xc2')](_0x5516f2);}})[_0xd6cf('0x20')](function(_0x3b69a5){if(_0x3b69a5){return _0x3b69a5?{'count':_0x491eb7,'rows':_0x3b69a5}:null;}})[_0xd6cf('0x20')](respondWithResult(_0x36cabf,null))['catch'](handleError(_0x36cabf,null));};exports['getGroups']=function(_0x1c1c5e,_0x32115a,_0x5ab963){var _0x4939cb={};var _0x5193dd={};var _0x50b2f9;var _0x314faa;return db[_0xd6cf('0x5b')][_0xd6cf('0x8d')]({'where':{'id':_0x1c1c5e[_0xd6cf('0x60')]['id']}})[_0xd6cf('0x20')](handleEntityNotFound(_0x32115a,null))[_0xd6cf('0x20')](function(_0x13ab43){if(_0x13ab43){_0x50b2f9=_0x13ab43;_0x5193dd[_0xd6cf('0x41')]=_[_0xd6cf('0x46')](db[_0xd6cf('0xc3')][_0xd6cf('0x3f')]);_0x5193dd[_0xd6cf('0x45')]=_[_0xd6cf('0x46')](_0x1c1c5e[_0xd6cf('0x45')]);_0x5193dd['filters']=_[_0xd6cf('0x48')](_0x5193dd['model'],_0x5193dd[_0xd6cf('0x45')]);_0x4939cb[_0xd6cf('0x4a')]=_['intersection'](_0x5193dd[_0xd6cf('0x41')],qs['fields'](_0x1c1c5e['query'][_0xd6cf('0x49')]));_0x4939cb['attributes']=_0x4939cb[_0xd6cf('0x4a')]['length']?_0x4939cb[_0xd6cf('0x4a')]:_0x5193dd[_0xd6cf('0x41')];_0x4939cb[_0xd6cf('0x4f')]=qs[_0xd6cf('0x50')](_0x1c1c5e['query'][_0xd6cf('0x50')]);_0x4939cb['where']=qs[_0xd6cf('0x47')](_['pick'](_0x1c1c5e[_0xd6cf('0x45')],_0x5193dd[_0xd6cf('0x47')]));if(_0x1c1c5e[_0xd6cf('0x45')][_0xd6cf('0x53')]){_0x4939cb['where']=_[_0xd6cf('0x54')](_0x4939cb[_0xd6cf('0x51')],{'$or':_[_0xd6cf('0x36')](_0x4939cb[_0xd6cf('0x4a')],function(_0x188935){var _0x1ae9a9={};_0x1ae9a9[_0x188935]={'$like':'%'+_0x1c1c5e['query'][_0xd6cf('0x53')]+'%'};return _0x1ae9a9;})});}_0x4939cb=_['merge']({},_0x4939cb,_0x1c1c5e[_0xd6cf('0x5a')]);return _0x50b2f9[_0xd6cf('0xc4')](_0x4939cb);}})[_0xd6cf('0x20')](function(_0xd4f41b){if(_0xd4f41b){_0x314faa=_0xd4f41b[_0xd6cf('0x4b')];if(!_0x1c1c5e[_0xd6cf('0x45')][_0xd6cf('0x4c')]('nolimit')){_0x4939cb['limit']=qs[_0xd6cf('0x4e')](_0x1c1c5e[_0xd6cf('0x45')][_0xd6cf('0x4e')]);_0x4939cb['offset']=qs[_0xd6cf('0x2a')](_0x1c1c5e[_0xd6cf('0x45')][_0xd6cf('0x2a')]);}return _0x50b2f9[_0xd6cf('0xc4')](_0x4939cb);}})[_0xd6cf('0x20')](function(_0x563f9a){if(_0x563f9a){return _0x563f9a?{'count':_0x314faa,'rows':_0x563f9a}:null;}})['then'](respondWithResult(_0x32115a,null))[_0xd6cf('0x27')](handleError(_0x32115a,null));};exports[_0xd6cf('0xc5')]=function(_0xee632b,_0x3c3526,_0x3203ca){var _0x59b7e4={'raw':!![],'where':{}};var _0x354c24={};var _0x557b9d={'count':0x0,'rows':[]};return db[_0xd6cf('0x5b')][_0xd6cf('0x8d')]({'where':{'id':_0xee632b['params']['id']}})[_0xd6cf('0x20')](handleEntityNotFound(_0x3c3526,null))['then'](function(_0x2e8d16){if(_0x2e8d16){_0x354c24[_0xd6cf('0x41')]=_[_0xd6cf('0x46')](db['VoiceRecording'][_0xd6cf('0x3f')]);_0x354c24[_0xd6cf('0x45')]=_[_0xd6cf('0x46')](_0xee632b['query']);_0x354c24[_0xd6cf('0x47')]=_[_0xd6cf('0x48')](_0x354c24[_0xd6cf('0x41')],_0x354c24['query']);_0x59b7e4[_0xd6cf('0x4a')]=_[_0xd6cf('0x48')](_0x354c24[_0xd6cf('0x41')],qs[_0xd6cf('0x49')](_0xee632b[_0xd6cf('0x45')][_0xd6cf('0x49')]));_0x59b7e4[_0xd6cf('0x4a')]=_0x59b7e4[_0xd6cf('0x4a')]['length']?_0x59b7e4['attributes']:_0x354c24[_0xd6cf('0x41')];if(!_0xee632b[_0xd6cf('0x45')]['hasOwnProperty'](_0xd6cf('0x4d'))){_0x59b7e4['limit']=qs[_0xd6cf('0x4e')](_0xee632b['query'][_0xd6cf('0x4e')]);_0x59b7e4[_0xd6cf('0x2a')]=qs[_0xd6cf('0x2a')](_0xee632b[_0xd6cf('0x45')]['offset']);}_0x59b7e4[_0xd6cf('0x4f')]=qs[_0xd6cf('0x50')](_0xee632b[_0xd6cf('0x45')][_0xd6cf('0x50')]);_0x59b7e4[_0xd6cf('0x51')]=qs[_0xd6cf('0x47')](_['pick'](_0xee632b['query'],_0x354c24[_0xd6cf('0x47')]));_0x59b7e4[_0xd6cf('0x51')][_0xd6cf('0xc6')]=_0x2e8d16['id'];if(_0xee632b[_0xd6cf('0x45')]['filter']){_0x59b7e4[_0xd6cf('0x51')]=_['merge'](_0x59b7e4[_0xd6cf('0x51')],{'$or':_['map'](_0x59b7e4[_0xd6cf('0x4a')],function(_0x2ef0ec){var _0x3ff52b={};_0x3ff52b[_0x2ef0ec]={'$like':'%'+_0xee632b[_0xd6cf('0x45')][_0xd6cf('0x53')]+'%'};return _0x3ff52b;})});}_0x59b7e4=_['merge']({},_0x59b7e4,_0xee632b['options']);return db[_0xd6cf('0xc7')][_0xd6cf('0x67')]({'where':_0x59b7e4[_0xd6cf('0x51')]})[_0xd6cf('0x20')](function(_0x4afdbb){_0x557b9d['count']=_0x4afdbb;if(_0xee632b['query'][_0xd6cf('0x5c')]){_0x59b7e4[_0xd6cf('0x5d')]=[{'all':!![]}];}return db[_0xd6cf('0xc7')][_0xd6cf('0x5e')](_0x59b7e4);})[_0xd6cf('0x20')](function(_0x2e5689){_0x557b9d[_0xd6cf('0x5f')]=_0x2e5689;return _0x557b9d;});}})['then'](respondWithFilteredResult(_0x3c3526,_0x59b7e4))[_0xd6cf('0x27')](handleError(_0x3c3526,null));};exports[_0xd6cf('0xc8')]=function(_0x1acbc0,_0x2fbc4c,_0x3042d9){var _0x4bb1d5={'raw':!![],'where':{}};var _0xb09ed2={};var _0x4aa577={'count':0x0,'rows':[]};return db[_0xd6cf('0x5b')][_0xd6cf('0x8d')]({'where':{'id':_0x1acbc0[_0xd6cf('0x60')]['id']}})[_0xd6cf('0x20')](handleEntityNotFound(_0x2fbc4c,null))['then'](function(_0x25d8ba){if(_0x25d8ba){_0xb09ed2[_0xd6cf('0x41')]=_['keys'](db[_0xd6cf('0xc9')][_0xd6cf('0x3f')]);_0xb09ed2[_0xd6cf('0x45')]=_['keys'](_0x1acbc0[_0xd6cf('0x45')]);_0xb09ed2[_0xd6cf('0x47')]=_[_0xd6cf('0x48')](_0xb09ed2[_0xd6cf('0x41')],_0xb09ed2['query']);_0x4bb1d5[_0xd6cf('0x4a')]=_[_0xd6cf('0x48')](_0xb09ed2[_0xd6cf('0x41')],qs[_0xd6cf('0x49')](_0x1acbc0[_0xd6cf('0x45')]['fields']));_0x4bb1d5[_0xd6cf('0x4a')]=_0x4bb1d5['attributes'][_0xd6cf('0x4b')]?_0x4bb1d5['attributes']:_0xb09ed2['model'];if(!_0x1acbc0[_0xd6cf('0x45')][_0xd6cf('0x4c')](_0xd6cf('0x4d'))){_0x4bb1d5[_0xd6cf('0x4e')]=qs[_0xd6cf('0x4e')](_0x1acbc0[_0xd6cf('0x45')][_0xd6cf('0x4e')]);_0x4bb1d5[_0xd6cf('0x2a')]=qs[_0xd6cf('0x2a')](_0x1acbc0['query'][_0xd6cf('0x2a')]);}_0x4bb1d5[_0xd6cf('0x4f')]=qs[_0xd6cf('0x50')](_0x1acbc0[_0xd6cf('0x45')][_0xd6cf('0x50')]);_0x4bb1d5['where']=qs[_0xd6cf('0x47')](_['pick'](_0x1acbc0[_0xd6cf('0x45')],_0xb09ed2['filters']));_0x4bb1d5[_0xd6cf('0x51')][_0xd6cf('0xc6')]=_0x25d8ba['id'];if(_0x1acbc0[_0xd6cf('0x45')]['filter']){_0x4bb1d5[_0xd6cf('0x51')]=_[_0xd6cf('0x54')](_0x4bb1d5[_0xd6cf('0x51')],{'$or':_[_0xd6cf('0x36')](_0x4bb1d5[_0xd6cf('0x4a')],function(_0x5d92b2){var _0xefcfc5={};_0xefcfc5[_0x5d92b2]={'$like':'%'+_0x1acbc0[_0xd6cf('0x45')]['filter']+'%'};return _0xefcfc5;})});}_0x4bb1d5=_[_0xd6cf('0x54')]({},_0x4bb1d5,_0x1acbc0[_0xd6cf('0x5a')]);return db[_0xd6cf('0xc9')][_0xd6cf('0x67')]({'where':_0x4bb1d5[_0xd6cf('0x51')]})[_0xd6cf('0x20')](function(_0x3624fe){_0x4aa577[_0xd6cf('0x67')]=_0x3624fe;if(_0x1acbc0[_0xd6cf('0x45')][_0xd6cf('0x5c')]){_0x4bb1d5['include']=[{'all':!![]}];}return db[_0xd6cf('0xc9')][_0xd6cf('0x5e')](_0x4bb1d5);})[_0xd6cf('0x20')](function(_0x2878d6){_0x4aa577[_0xd6cf('0x5f')]=_0x2878d6;return _0x4aa577;});}})['then'](respondWithFilteredResult(_0x2fbc4c,_0x4bb1d5))[_0xd6cf('0x27')](handleError(_0x2fbc4c,null));};exports[_0xd6cf('0xca')]=function(_0x2b5a75,_0x21244f,_0x421374){var _0x5390eb={};var _0x48daf6={};var _0x36966d;var _0x58439d;return db['User'][_0xd6cf('0x8d')]({'where':{'id':_0x2b5a75[_0xd6cf('0x60')]['id']}})[_0xd6cf('0x20')](handleEntityNotFound(_0x21244f,null))[_0xd6cf('0x20')](function(_0xaf0acc){if(_0xaf0acc){_0x36966d=_0xaf0acc;_0x48daf6[_0xd6cf('0x41')]=_[_0xd6cf('0x46')](db[_0xd6cf('0xcb')]['rawAttributes']);_0x48daf6[_0xd6cf('0x45')]=_[_0xd6cf('0x46')](_0x2b5a75['query']);_0x48daf6[_0xd6cf('0x47')]=_['intersection'](_0x48daf6[_0xd6cf('0x41')],_0x48daf6[_0xd6cf('0x45')]);_0x5390eb[_0xd6cf('0x4a')]=_['intersection'](_0x48daf6[_0xd6cf('0x41')],qs[_0xd6cf('0x49')](_0x2b5a75[_0xd6cf('0x45')]['fields']));_0x5390eb[_0xd6cf('0x4a')]=_0x5390eb['attributes'][_0xd6cf('0x4b')]?_0x5390eb[_0xd6cf('0x4a')]:_0x48daf6[_0xd6cf('0x41')];_0x5390eb[_0xd6cf('0x4f')]=qs[_0xd6cf('0x50')](_0x2b5a75[_0xd6cf('0x45')][_0xd6cf('0x50')]);_0x5390eb['where']=qs[_0xd6cf('0x47')](_['pick'](_0x2b5a75[_0xd6cf('0x45')],_0x48daf6['filters']));if(_0x2b5a75[_0xd6cf('0x45')][_0xd6cf('0x53')]){_0x5390eb['where']=_[_0xd6cf('0x54')](_0x5390eb[_0xd6cf('0x51')],{'$or':_['map'](_0x5390eb[_0xd6cf('0x4a')],function(_0x45c389){var _0x5274fd={};_0x5274fd[_0x45c389]={'$like':'%'+_0x2b5a75[_0xd6cf('0x45')]['filter']+'%'};return _0x5274fd;})});}_0x5390eb=_['merge']({},_0x5390eb,_0x2b5a75[_0xd6cf('0x5a')]);return _0x36966d['getChatInteractions'](_0x5390eb);}})[_0xd6cf('0x20')](function(_0x5d6072){if(_0x5d6072){_0x58439d=_0x5d6072[_0xd6cf('0x4b')];if(!_0x2b5a75[_0xd6cf('0x45')]['hasOwnProperty'](_0xd6cf('0x4d'))){_0x5390eb[_0xd6cf('0x4e')]=qs[_0xd6cf('0x4e')](_0x2b5a75[_0xd6cf('0x45')][_0xd6cf('0x4e')]);_0x5390eb['offset']=qs[_0xd6cf('0x2a')](_0x2b5a75['query'][_0xd6cf('0x2a')]);}return _0x36966d[_0xd6cf('0xca')](_0x5390eb);}})[_0xd6cf('0x20')](function(_0x5b2954){if(_0x5b2954){return _0x5b2954?{'count':_0x58439d,'rows':_0x5b2954}:null;}})[_0xd6cf('0x20')](respondWithResult(_0x21244f,null))[_0xd6cf('0x27')](handleError(_0x21244f,null));};exports[_0xd6cf('0xcc')]=function(_0xe5ae3d,_0x4c971b,_0x34e3e2){var _0x314dec={};var _0x11e109={};var _0x3df96a;var _0x48ecb8;return db[_0xd6cf('0x5b')][_0xd6cf('0x8d')]({'where':{'id':_0xe5ae3d['params']['id']}})[_0xd6cf('0x20')](handleEntityNotFound(_0x4c971b,null))[_0xd6cf('0x20')](function(_0x18e0cb){if(_0x18e0cb){_0x3df96a=_0x18e0cb;_0x11e109[_0xd6cf('0x41')]=_[_0xd6cf('0x46')](db[_0xd6cf('0xcd')][_0xd6cf('0x3f')]);_0x11e109[_0xd6cf('0x45')]=_[_0xd6cf('0x46')](_0xe5ae3d[_0xd6cf('0x45')]);_0x11e109['filters']=_[_0xd6cf('0x48')](_0x11e109[_0xd6cf('0x41')],_0x11e109[_0xd6cf('0x45')]);_0x314dec[_0xd6cf('0x4a')]=_['intersection'](_0x11e109[_0xd6cf('0x41')],qs['fields'](_0xe5ae3d[_0xd6cf('0x45')][_0xd6cf('0x49')]));_0x314dec[_0xd6cf('0x4a')]=_0x314dec[_0xd6cf('0x4a')][_0xd6cf('0x4b')]?_0x314dec[_0xd6cf('0x4a')]:_0x11e109['model'];_0x314dec['order']=qs[_0xd6cf('0x50')](_0xe5ae3d[_0xd6cf('0x45')][_0xd6cf('0x50')]);_0x314dec[_0xd6cf('0x51')]=qs[_0xd6cf('0x47')](_['pick'](_0xe5ae3d[_0xd6cf('0x45')],_0x11e109[_0xd6cf('0x47')]));if(_0xe5ae3d['query']['filter']){_0x314dec[_0xd6cf('0x51')]=_['merge'](_0x314dec[_0xd6cf('0x51')],{'$or':_[_0xd6cf('0x36')](_0x314dec[_0xd6cf('0x4a')],function(_0x2c527d){var _0x2e6c9d={};_0x2e6c9d[_0x2c527d]={'$like':'%'+_0xe5ae3d[_0xd6cf('0x45')]['filter']+'%'};return _0x2e6c9d;})});}_0x314dec=_[_0xd6cf('0x54')]({},_0x314dec,_0xe5ae3d[_0xd6cf('0x5a')]);return _0x3df96a[_0xd6cf('0xcc')](_0x314dec);}})['then'](function(_0x2f1e72){if(_0x2f1e72){_0x48ecb8=_0x2f1e72[_0xd6cf('0x4b')];if(!_0xe5ae3d[_0xd6cf('0x45')][_0xd6cf('0x4c')](_0xd6cf('0x4d'))){_0x314dec['limit']=qs[_0xd6cf('0x4e')](_0xe5ae3d[_0xd6cf('0x45')][_0xd6cf('0x4e')]);_0x314dec[_0xd6cf('0x2a')]=qs[_0xd6cf('0x2a')](_0xe5ae3d[_0xd6cf('0x45')][_0xd6cf('0x2a')]);}return _0x3df96a[_0xd6cf('0xcc')](_0x314dec);}})[_0xd6cf('0x20')](function(_0x4266d4){if(_0x4266d4){return _0x4266d4?{'count':_0x48ecb8,'rows':_0x4266d4}:null;}})[_0xd6cf('0x20')](respondWithResult(_0x4c971b,null))['catch'](handleError(_0x4c971b,null));};exports[_0xd6cf('0xce')]=function(_0x1c7bdf,_0x5c83d1,_0x5948a8){var _0x39c590={'raw':!![],'where':{}};var _0x13ca64={};var _0x4d225e={'count':0x0,'rows':[]};return db[_0xd6cf('0x5b')][_0xd6cf('0x8d')]({'where':{'id':_0x1c7bdf[_0xd6cf('0x60')]['id']}})[_0xd6cf('0x20')](handleEntityNotFound(_0x5c83d1,null))['then'](function(_0x3a675a){if(_0x3a675a){_0x13ca64[_0xd6cf('0x41')]=_[_0xd6cf('0x46')](db['MailInteraction'][_0xd6cf('0x3f')]);_0x13ca64[_0xd6cf('0x45')]=_[_0xd6cf('0x46')](_0x1c7bdf[_0xd6cf('0x45')]);_0x13ca64['filters']=_['intersection'](_0x13ca64[_0xd6cf('0x41')],_0x13ca64[_0xd6cf('0x45')]);_0x39c590[_0xd6cf('0x4a')]=_[_0xd6cf('0x48')](_0x13ca64[_0xd6cf('0x41')],qs[_0xd6cf('0x49')](_0x1c7bdf[_0xd6cf('0x45')][_0xd6cf('0x49')]));_0x39c590[_0xd6cf('0x4a')]=_0x39c590[_0xd6cf('0x4a')][_0xd6cf('0x4b')]?_0x39c590[_0xd6cf('0x4a')]:_0x13ca64['model'];if(!_0x1c7bdf[_0xd6cf('0x45')]['hasOwnProperty']('nolimit')){_0x39c590[_0xd6cf('0x4e')]=qs[_0xd6cf('0x4e')](_0x1c7bdf['query'][_0xd6cf('0x4e')]);_0x39c590[_0xd6cf('0x2a')]=qs[_0xd6cf('0x2a')](_0x1c7bdf['query'][_0xd6cf('0x2a')]);}_0x39c590[_0xd6cf('0x4f')]=qs['sort'](_0x1c7bdf[_0xd6cf('0x45')]['sort']);_0x39c590[_0xd6cf('0x51')]=qs[_0xd6cf('0x47')](_[_0xd6cf('0x52')](_0x1c7bdf['query'],_0x13ca64[_0xd6cf('0x47')]));_0x39c590['where'][_0xd6cf('0xc6')]=_0x3a675a['id'];if(_0x1c7bdf[_0xd6cf('0x45')]['filter']){_0x39c590['where']=_[_0xd6cf('0x54')](_0x39c590[_0xd6cf('0x51')],{'$or':_[_0xd6cf('0x36')](_0x39c590[_0xd6cf('0x4a')],function(_0xb90d10){var _0x7350cc={};_0x7350cc[_0xb90d10]={'$like':'%'+_0x1c7bdf[_0xd6cf('0x45')]['filter']+'%'};return _0x7350cc;})});}_0x39c590=_[_0xd6cf('0x54')]({},_0x39c590,_0x1c7bdf['options']);return db[_0xd6cf('0xcf')][_0xd6cf('0x67')]({'where':_0x39c590[_0xd6cf('0x51')]})[_0xd6cf('0x20')](function(_0x4fc8a1){_0x4d225e[_0xd6cf('0x67')]=_0x4fc8a1;if(_0x1c7bdf[_0xd6cf('0x45')][_0xd6cf('0x5c')]){_0x39c590[_0xd6cf('0x5d')]=[{'all':!![]}];}return db[_0xd6cf('0xcf')]['findAll'](_0x39c590);})[_0xd6cf('0x20')](function(_0x24b55e){_0x4d225e[_0xd6cf('0x5f')]=_0x24b55e;return _0x4d225e;});}})['then'](respondWithFilteredResult(_0x5c83d1,_0x39c590))[_0xd6cf('0x27')](handleError(_0x5c83d1,null));};exports[_0xd6cf('0xd0')]=function(_0x31d9f9,_0x441145,_0x1a86a7){var _0x2b9aaf={};var _0x2dc8b3={};var _0x4c21d1;var _0x3e5420;return db[_0xd6cf('0x5b')]['findOne']({'where':{'id':_0x31d9f9[_0xd6cf('0x60')]['id']}})['then'](handleEntityNotFound(_0x441145,null))[_0xd6cf('0x20')](function(_0x19c450){if(_0x19c450){_0x4c21d1=_0x19c450;_0x2dc8b3[_0xd6cf('0x41')]=_['keys'](db[_0xd6cf('0xd1')][_0xd6cf('0x3f')]);_0x2dc8b3[_0xd6cf('0x45')]=_[_0xd6cf('0x46')](_0x31d9f9[_0xd6cf('0x45')]);_0x2dc8b3[_0xd6cf('0x47')]=_['intersection'](_0x2dc8b3[_0xd6cf('0x41')],_0x2dc8b3[_0xd6cf('0x45')]);_0x2b9aaf[_0xd6cf('0x4a')]=_[_0xd6cf('0x48')](_0x2dc8b3[_0xd6cf('0x41')],qs['fields'](_0x31d9f9[_0xd6cf('0x45')]['fields']));_0x2b9aaf[_0xd6cf('0x4a')]=_0x2b9aaf[_0xd6cf('0x4a')]['length']?_0x2b9aaf[_0xd6cf('0x4a')]:_0x2dc8b3[_0xd6cf('0x41')];_0x2b9aaf[_0xd6cf('0x4f')]=qs[_0xd6cf('0x50')](_0x31d9f9[_0xd6cf('0x45')][_0xd6cf('0x50')]);_0x2b9aaf[_0xd6cf('0x51')]=qs[_0xd6cf('0x47')](_[_0xd6cf('0x52')](_0x31d9f9[_0xd6cf('0x45')],_0x2dc8b3[_0xd6cf('0x47')]));if(_0x31d9f9[_0xd6cf('0x45')][_0xd6cf('0x53')]){_0x2b9aaf[_0xd6cf('0x51')]=_[_0xd6cf('0x54')](_0x2b9aaf[_0xd6cf('0x51')],{'$or':_['map'](_0x2b9aaf['attributes'],function(_0xd9fb93){var _0x46a0ae={};_0x46a0ae[_0xd9fb93]={'$like':'%'+_0x31d9f9[_0xd6cf('0x45')]['filter']+'%'};return _0x46a0ae;})});}_0x2b9aaf=_[_0xd6cf('0x54')]({},_0x2b9aaf,_0x31d9f9[_0xd6cf('0x5a')]);return _0x4c21d1[_0xd6cf('0xd0')](_0x2b9aaf);}})['then'](function(_0x532069){if(_0x532069){_0x3e5420=_0x532069[_0xd6cf('0x4b')];if(!_0x31d9f9[_0xd6cf('0x45')][_0xd6cf('0x4c')]('nolimit')){_0x2b9aaf[_0xd6cf('0x4e')]=qs[_0xd6cf('0x4e')](_0x31d9f9[_0xd6cf('0x45')]['limit']);_0x2b9aaf['offset']=qs[_0xd6cf('0x2a')](_0x31d9f9['query']['offset']);}return _0x4c21d1[_0xd6cf('0xd0')](_0x2b9aaf);}})['then'](function(_0x27e03f){if(_0x27e03f){return _0x27e03f?{'count':_0x3e5420,'rows':_0x27e03f}:null;}})[_0xd6cf('0x20')](respondWithResult(_0x441145,null))[_0xd6cf('0x27')](handleError(_0x441145,null));};exports[_0xd6cf('0xd2')]=function(_0x5c2b9e,_0x1c6bd1,_0x4f9163){var _0x410869={};var _0x13da10={};var _0x2d4e81;var _0x522c98;return db[_0xd6cf('0x5b')][_0xd6cf('0x8d')]({'where':{'id':_0x5c2b9e['params']['id']}})[_0xd6cf('0x20')](handleEntityNotFound(_0x1c6bd1,null))[_0xd6cf('0x20')](function(_0x5ef117){if(_0x5ef117){_0x2d4e81=_0x5ef117;_0x13da10['model']=_[_0xd6cf('0x46')](db[_0xd6cf('0xd3')][_0xd6cf('0x3f')]);_0x13da10[_0xd6cf('0x45')]=_[_0xd6cf('0x46')](_0x5c2b9e[_0xd6cf('0x45')]);_0x13da10[_0xd6cf('0x47')]=_[_0xd6cf('0x48')](_0x13da10[_0xd6cf('0x41')],_0x13da10['query']);_0x410869[_0xd6cf('0x4a')]=_['intersection'](_0x13da10[_0xd6cf('0x41')],qs[_0xd6cf('0x49')](_0x5c2b9e[_0xd6cf('0x45')]['fields']));_0x410869[_0xd6cf('0x4a')]=_0x410869[_0xd6cf('0x4a')]['length']?_0x410869['attributes']:_0x13da10[_0xd6cf('0x41')];_0x410869['order']=qs[_0xd6cf('0x50')](_0x5c2b9e[_0xd6cf('0x45')][_0xd6cf('0x50')]);_0x410869[_0xd6cf('0x51')]=qs[_0xd6cf('0x47')](_[_0xd6cf('0x52')](_0x5c2b9e[_0xd6cf('0x45')],_0x13da10[_0xd6cf('0x47')]));if(_0x5c2b9e['query'][_0xd6cf('0x53')]){_0x410869[_0xd6cf('0x51')]=_[_0xd6cf('0x54')](_0x410869[_0xd6cf('0x51')],{'$or':_['map'](_0x410869['attributes'],function(_0x13d3cc){var _0x51556a={};_0x51556a[_0x13d3cc]={'$like':'%'+_0x5c2b9e['query'][_0xd6cf('0x53')]+'%'};return _0x51556a;})});}_0x410869=_['merge']({},_0x410869,_0x5c2b9e['options']);return _0x2d4e81[_0xd6cf('0xd2')](_0x410869);}})['then'](function(_0x225d43){if(_0x225d43){_0x522c98=_0x225d43[_0xd6cf('0x4b')];if(!_0x5c2b9e['query'][_0xd6cf('0x4c')](_0xd6cf('0x4d'))){_0x410869[_0xd6cf('0x4e')]=qs[_0xd6cf('0x4e')](_0x5c2b9e['query'][_0xd6cf('0x4e')]);_0x410869[_0xd6cf('0x2a')]=qs[_0xd6cf('0x2a')](_0x5c2b9e['query'][_0xd6cf('0x2a')]);}return _0x2d4e81['getFaxInteractions'](_0x410869);}})[_0xd6cf('0x20')](function(_0x6d4d72){if(_0x6d4d72){return _0x6d4d72?{'count':_0x522c98,'rows':_0x6d4d72}:null;}})[_0xd6cf('0x20')](respondWithResult(_0x1c6bd1,null))[_0xd6cf('0x27')](handleError(_0x1c6bd1,null));};exports[_0xd6cf('0xd4')]=function(_0xf9b987,_0x55cf98,_0x25781e){var _0x80f58f;var _0x521d86;var _0x483c88;var _0x235c44=!_[_0xd6cf('0x6d')](_0xf9b987[_0xd6cf('0x60')]['id'])?_0xf9b987[_0xd6cf('0x60')]['id']:!_[_0xd6cf('0x6d')](_0xf9b987['user']['id'])?_0xf9b987[_0xd6cf('0x32')]['id']:null;return db[_0xd6cf('0x5b')][_0xd6cf('0x65')]({'where':{'id':_0x235c44,'role':{'$or':[_0xd6cf('0x68'),_0xd6cf('0x32'),_0xd6cf('0x66')]}},'attributes':['id',_0xd6cf('0x3a'),_0xd6cf('0xd5'),_0xd6cf('0xd6'),'role',_0xd6cf('0x73'),_0xd6cf('0xd7')]})[_0xd6cf('0x20')](function(_0xde1210){if(_0xde1210){if(_0xde1210['role']===_0xd6cf('0x66')){_0x80f58f=_0xde1210;if(_0xf9b987[_0xd6cf('0x62')][_0xd6cf('0x97')]){_0x483c88=util[_0xd6cf('0x6f')](_0xd6cf('0xd8'),_0x80f58f[_0xf9b987['body'][_0xd6cf('0x97')]]);}else if(_0xf9b987[_0xd6cf('0x62')]['intrf']){_0x483c88=util['format'](_0xd6cf('0xa6'),_0xf9b987[_0xd6cf('0x62')][_0xd6cf('0xd9')]);}else{_0x483c88=util[_0xd6cf('0x6f')]('SIP/%s',_0x80f58f['name']);}socket['to'](util['format'](_0xd6cf('0xda'),_0x80f58f[_0xd6cf('0x3a')]))[_0xd6cf('0x9f')](_0xd6cf('0xdb'),{'ip':_0xf9b987['headers']['x-forwarded-for']||_0xf9b987['connection']['remoteAddress']||_0xf9b987[_0xd6cf('0xdc')][_0xd6cf('0xdd')]||_0xf9b987[_0xd6cf('0xde')][_0xd6cf('0xdc')]['remoteAddress']});return db[_0xd6cf('0xa8')][_0xd6cf('0x30')]({'where':{'membername':_0x80f58f[_0xd6cf('0x3a')]},'individualHooks':!![]});}}else{throw new db[(_0xd6cf('0x1c'))][(_0xd6cf('0x1d'))](_0xd6cf('0xdf'));}})[_0xd6cf('0x20')](function(){if(_0x80f58f){return _0x80f58f['getVoiceQueues']({'raw':!![]});}})[_0xd6cf('0x20')](function(_0x5f0513){if(_0x80f58f){var _0x26a15e=[];if(_0x5f0513){_0x521d86=_0x5f0513;if(_0x521d86[_0xd6cf('0x4b')]){for(var _0x19e58d=0x0;_0x19e58d<_0x521d86[_0xd6cf('0x4b')];_0x19e58d++){_0x26a15e['push']({'membername':_0x80f58f[_0xd6cf('0x3a')],'UserId':_0x80f58f['id'],'queue_name':_0x521d86[_0x19e58d][_0xd6cf('0x3a')],'VoiceQueueId':_0x521d86[_0x19e58d]['id'],'interface':_0x483c88,'paused':_0x80f58f[_0xd6cf('0xd7')]||![],'penalty':_0x521d86[_0x19e58d][_0xd6cf('0xe0')]||0x0});}return BPromise[_0xd6cf('0xa7')](_0x26a15e,function(_0x56793d){return db[_0xd6cf('0xa8')][_0xd6cf('0xa9')](_0x56793d);});}}}})['then'](function(){if(_0x80f58f){return db[_0xd6cf('0xe1')]['findAll']({'where':{'membername':_0x80f58f['name'],'exitAt':null}});}})['then'](function(_0x4a5c98){if(_0x80f58f){var _0x48a7d1=[];_0x4a5c98['forEach'](function(_0x1e3171){_0x48a7d1['push'](_0x1e3171['update']({'exitAt':moment()['format'](_0xd6cf('0xe2'))}));});return BPromise[_0xd6cf('0xe3')](_0x48a7d1);}})[_0xd6cf('0x20')](function(){if(_0x80f58f){var _0x354317=[];var _0x1d0349=[];var _0x48e99f=utils['getChannels']();var _0x22b467={'membername':_0x80f58f[_0xd6cf('0x3a')],'interface':_0x483c88,'enterAt':moment()[_0xd6cf('0x6f')](_0xd6cf('0xe2')),'role':_0x80f58f['role'],'internal':_0x80f58f['internal']};_0x48e99f[_0xd6cf('0xe4')](function(_0x3bf353){_0x354317[_0xd6cf('0xa5')](_[_0xd6cf('0x54')]({'channel':_0x3bf353,'type':_0xd6cf('0xe5'),'data1':_0xf9b987[_0xd6cf('0x62')]['device'],'data2':_0x483c88},_0x22b467));if(_0x80f58f[_0xd6cf('0xd7')]){_0x1d0349[_0xd6cf('0xa5')](_[_0xd6cf('0x54')]({'channel':_0x3bf353,'type':_0xd6cf('0xe6'),'data1':_0xd6cf('0xe7')},_0x22b467));}});return db[_0xd6cf('0xe1')][_0xd6cf('0x61')](_0x354317['concat'](_0x1d0349),{'individualHooks':!![]});}})[_0xd6cf('0x20')](function(){if(_0x80f58f){return _0x80f58f['update']({'online':!![],'lastLoginAt':moment()[_0xd6cf('0x6f')](_0xd6cf('0xe2')),'voicePause':_0x80f58f[_0xd6cf('0xd7')]||![],'mailPause':_0x80f58f[_0xd6cf('0xd7')]||![],'chatPause':_0x80f58f[_0xd6cf('0xd7')]||![],'faxPause':_0x80f58f['loginInPause']||![],'smsPause':_0x80f58f[_0xd6cf('0xd7')]||![],'openchannelPause':_0x80f58f[_0xd6cf('0xd7')]||![],'pauseType':_0x80f58f[_0xd6cf('0xd7')]?_0xd6cf('0xe7'):null,'interface':_0x483c88,'lastPauseAt':moment()[_0xd6cf('0x6f')](_0xd6cf('0xe2'))});}})[_0xd6cf('0x20')](function(_0x2208cd){if(_0xf9b987[_0xd6cf('0xe8')]){return _0x25781e();}else{return BPromise['resolve'](_0x2208cd)[_0xd6cf('0x20')](respondWithResult(_0x55cf98,null));}})[_0xd6cf('0x27')](handleError(_0x55cf98,null));};exports[_0xd6cf('0xe9')]=function(_0x27e913,_0x326441,_0x51b0b){var _0x37eac2;return db[_0xd6cf('0x5b')]['find']({'where':{'id':_0x27e913['params']['id'],'role':_0xd6cf('0x66')},'attributes':['id',_0xd6cf('0x3a'),_0xd6cf('0x39')]})[_0xd6cf('0x20')](handleEntityNotFound(_0x326441,null))[_0xd6cf('0x20')](function(_0x2d4bfd){if(_0x2d4bfd){_0x37eac2=_0x2d4bfd;return db[_0xd6cf('0xa8')][_0xd6cf('0x30')]({'where':{'membername':_0x37eac2[_0xd6cf('0x3a')]},'individualHooks':!![]});}})[_0xd6cf('0x20')](function(){return db[_0xd6cf('0xe1')]['findAll']({'where':{'membername':_0x37eac2[_0xd6cf('0x3a')],'exitAt':null}});})[_0xd6cf('0x20')](function(_0x102d17){var _0x322e74=[];_0x102d17[_0xd6cf('0xe4')](function(_0x1fb8ef){_0x322e74[_0xd6cf('0xa5')](_0x1fb8ef['update']({'exitAt':moment()[_0xd6cf('0x6f')](_0xd6cf('0xe2'))}));});return BPromise[_0xd6cf('0xe3')](_0x322e74);})[_0xd6cf('0x20')](function(){return _0x37eac2['update']({'online':![],'lastLoginAt':null,'voicePause':![],'mailPause':![],'chatPause':![],'faxPause':![],'smsPause':![],'openchannelPause':![],'interface':null});})[_0xd6cf('0x20')](respondWithResult(_0x326441,null))[_0xd6cf('0x27')](handleError(_0x326441,null));};exports[_0xd6cf('0xea')]=function(_0xf9413a,_0x55279f,_0x362763){var _0x4877c5;return db[_0xd6cf('0xa8')][_0xd6cf('0x2f')]({'paused':0x1},{'where':{'UserId':_0xf9413a[_0xd6cf('0x60')]['id']},'individualHooks':!![]})[_0xd6cf('0x20')](function(){return db[_0xd6cf('0x5b')][_0xd6cf('0x65')]({'where':{'id':_0xf9413a[_0xd6cf('0x60')]['id'],'role':'agent'},'attributes':['id','name',_0xd6cf('0x39'),_0xd6cf('0x73'),_0xd6cf('0x97')]});})[_0xd6cf('0x20')](handleEntityNotFound(_0x55279f,null))[_0xd6cf('0x20')](function(_0x4be710){if(_0x4be710){_0x4877c5=_0x4be710;return respondWithRpcPromise(_0xd6cf('0xeb'),'pause',{'id':_0x4877c5['id'],'name':_0x4877c5[_0xd6cf('0x3a')],'pause':!![]});}})[_0xd6cf('0x20')](function(){if(_0x4877c5){return db[_0xd6cf('0xe1')]['findAll']({'where':{'membername':_0x4877c5[_0xd6cf('0x3a')],'type':_0xd6cf('0xe6'),'exitAt':null}});}})[_0xd6cf('0x20')](function(_0x25aaf0){if(_0x25aaf0[_0xd6cf('0x4b')]){var _0x55d1e0=moment()[_0xd6cf('0x6f')](_0xd6cf('0xe2'));for(var _0x2ceb63=0x0,_0x3ff6a2=_0x25aaf0[_0xd6cf('0x4b')];_0x2ceb63<_0x3ff6a2;_0x2ceb63++){_0x25aaf0[_0x2ceb63][_0xd6cf('0xec')]({'exitAt':_0x55d1e0});}}})[_0xd6cf('0x20')](function(){var _0x806509=[];var _0x2f6925=utils[_0xd6cf('0xed')]();_0x2f6925[_0xd6cf('0xe4')](function(_0x434dc7){_0x806509[_0xd6cf('0xa5')]({'channel':_0x434dc7,'membername':_0x4877c5[_0xd6cf('0x3a')],'interface':_[_0xd6cf('0x6d')](_0x4877c5[_0xd6cf('0x97')])?util[_0xd6cf('0x6f')]('SIP/%s',_0x4877c5[_0xd6cf('0x3a')]):_0x4877c5[_0xd6cf('0x97')],'type':'PAUSE','enterAt':moment()['format'](_0xd6cf('0xe2')),'data1':_0xf9413a['body'][_0xd6cf('0x55')]||_0xd6cf('0xee'),'role':_0x4877c5['role'],'internal':_0x4877c5[_0xd6cf('0x73')]});});return db['MemberReport']['bulkCreate'](_0x806509,{'individualHooks':!![]});})[_0xd6cf('0x20')](function(){return _0x4877c5['update']({'voicePause':!![],'mailPause':!![],'chatPause':!![],'faxPause':!![],'smsPause':!![],'openchannelPause':!![],'pauseType':_0xf9413a['body']['type']||'DEFAULT\x20PAUSE','lastPauseAt':moment()[_0xd6cf('0x6f')](_0xd6cf('0xe2'))});})['then'](respondWithResult(_0x55279f,null))[_0xd6cf('0x27')](handleError(_0x55279f,null));};exports[_0xd6cf('0xef')]=function(_0x4a30eb,_0x22e8d2,_0x2e1825){var _0x5e55df;return db[_0xd6cf('0x5b')][_0xd6cf('0x65')]({'where':{'id':_0x4a30eb['params']['id']},'attributes':['id',_0xd6cf('0x3a'),_0xd6cf('0x39'),_0xd6cf('0x96'),_0xd6cf('0xf0'),_0xd6cf('0xf1'),_0xd6cf('0xf2'),_0xd6cf('0xf3'),'smsPause',_0xd6cf('0xf4'),_0xd6cf('0xf5')]})[_0xd6cf('0x20')](handleEntityNotFound(_0x22e8d2,null))[_0xd6cf('0x20')](function(_0x10dfeb){if(_0x10dfeb){_0x5e55df=_0x10dfeb;if(_0x4a30eb['body'][_0xd6cf('0xaa')]&&!utils[_0xd6cf('0x98')](_0x4a30eb[_0xd6cf('0x62')][_0xd6cf('0xaa')])){throw new db[(_0xd6cf('0x1c'))][(_0xd6cf('0x1d'))](_0xd6cf('0x99'));}switch(_0x4a30eb[_0xd6cf('0x62')][_0xd6cf('0xaa')]){case'voice':return respondWithRpcPromise(_0xd6cf('0xeb'),_0xd6cf('0xef'),{'id':_0x5e55df['id'],'name':_0x5e55df[_0xd6cf('0x3a')],'pause':![]})['then'](function(){return db[_0xd6cf('0xa8')][_0xd6cf('0x2f')]({'paused':0x0},{'where':{'UserId':_0x5e55df['id']},'individualHooks':!![]});})['then'](function(){return db[_0xd6cf('0xe1')][_0xd6cf('0x65')]({'where':{'channel':_0x4a30eb[_0xd6cf('0x62')][_0xd6cf('0xaa')],'membername':_0x5e55df[_0xd6cf('0x3a')],'type':_0xd6cf('0xe6'),'exitAt':null}});})['then'](function(_0x3da13c){if(_0x3da13c){return _0x3da13c[_0xd6cf('0x2f')]({'exitAt':moment()[_0xd6cf('0x6f')]('YYYY-MM-DD\x20HH:mm:ss'),'data2':_0xd6cf('0xf6')},{'individualHooks':!![]});}return null;})[_0xd6cf('0x20')](function(){return _0x5e55df[_0xd6cf('0x2f')]({'voicePause':![]});});case _0xd6cf('0xf7'):case _0xd6cf('0xf8'):case _0xd6cf('0xf9'):case _0xd6cf('0xfa'):case _0xd6cf('0xfb'):return db[_0xd6cf('0xe1')][_0xd6cf('0x65')]({'where':{'channel':_0x4a30eb[_0xd6cf('0x62')]['channel'],'membername':_0x5e55df[_0xd6cf('0x3a')],'type':_0xd6cf('0xe6'),'exitAt':null}})[_0xd6cf('0x20')](function(_0x23a9be){if(_0x23a9be){return _0x23a9be[_0xd6cf('0x2f')]({'exitAt':moment()[_0xd6cf('0x6f')](_0xd6cf('0xe2')),'data2':_0xd6cf('0xf6')},{'individualHooks':!![]});}return null;})[_0xd6cf('0x20')](function(){var _0xe91c0b={};_[_0xd6cf('0xfc')](_0xe91c0b,util['format'](_0xd6cf('0xfd'),_0x4a30eb[_0xd6cf('0x62')][_0xd6cf('0xaa')],'Pause'),![]);return _0x5e55df[_0xd6cf('0x2f')](_0xe91c0b);});default:return respondWithRpcPromise(_0xd6cf('0xeb'),_0xd6cf('0xef'),{'id':_0x5e55df['id'],'name':_0x5e55df[_0xd6cf('0x3a')],'pause':![]})[_0xd6cf('0x20')](function(){return db[_0xd6cf('0xa8')][_0xd6cf('0x2f')]({'paused':0x0},{'where':{'UserId':_0x5e55df['id']}});})[_0xd6cf('0x20')](function(){return db['MemberReport']['findAll']({'where':{'membername':_0x5e55df[_0xd6cf('0x3a')],'type':_0xd6cf('0xe6'),'exitAt':null}});})[_0xd6cf('0x20')](function(_0x286e57){var _0x3a66fb=[];_0x286e57['forEach'](function(_0x42a0bc){_0x3a66fb[_0xd6cf('0xa5')](_0x42a0bc['update']({'exitAt':moment()[_0xd6cf('0x6f')](_0xd6cf('0xe2')),'data2':'manual'}));});return BPromise[_0xd6cf('0xe3')](_0x3a66fb);})['then'](function(){return _0x5e55df[_0xd6cf('0x2f')]({'voicePause':![],'mailPause':![],'chatPause':![],'faxPause':![],'smsPause':![],'openchannelPause':![]});});}}})[_0xd6cf('0x20')](respondWithResult(_0x22e8d2,null))[_0xd6cf('0x27')](handleError(_0x22e8d2,null));};exports[_0xd6cf('0xfe')]=function(_0x3711e4,_0xb4b00a,_0x11f40a){var _0x45191d={};var _0x368cf8={};var _0x4275e3;var _0x58d4fd;return db[_0xd6cf('0x5b')][_0xd6cf('0x8d')]({'where':{'id':_0x3711e4[_0xd6cf('0x60')]['id']}})[_0xd6cf('0x20')](handleEntityNotFound(_0xb4b00a,null))['then'](function(_0x2b9d17){if(_0x2b9d17){_0x4275e3=_0x2b9d17;_0x368cf8['model']=_[_0xd6cf('0x46')](db[_0xd6cf('0xff')][_0xd6cf('0x3f')]);_0x368cf8['query']=_[_0xd6cf('0x46')](_0x3711e4[_0xd6cf('0x45')]);_0x368cf8['filters']=_[_0xd6cf('0x48')](_0x368cf8[_0xd6cf('0x41')],_0x368cf8['query']);_0x45191d[_0xd6cf('0x4a')]=_[_0xd6cf('0x48')](_0x368cf8['model'],qs[_0xd6cf('0x49')](_0x3711e4[_0xd6cf('0x45')][_0xd6cf('0x49')]));_0x45191d[_0xd6cf('0x4a')]=_0x45191d[_0xd6cf('0x4a')]['length']?_0x45191d[_0xd6cf('0x4a')]:_0x368cf8[_0xd6cf('0x41')];_0x45191d[_0xd6cf('0x4f')]=qs[_0xd6cf('0x50')](_0x3711e4[_0xd6cf('0x45')][_0xd6cf('0x50')]);_0x45191d[_0xd6cf('0x51')]=qs[_0xd6cf('0x47')](_[_0xd6cf('0x52')](_0x3711e4[_0xd6cf('0x45')],_0x368cf8['filters']));if(_0x3711e4[_0xd6cf('0x45')][_0xd6cf('0x53')]){_0x45191d[_0xd6cf('0x51')]=_[_0xd6cf('0x54')](_0x45191d[_0xd6cf('0x51')],{'$or':_[_0xd6cf('0x36')](_0x45191d[_0xd6cf('0x4a')],function(_0x623ac7){var _0x36e5df={};_0x36e5df[_0x623ac7]={'$like':'%'+_0x3711e4[_0xd6cf('0x45')][_0xd6cf('0x53')]+'%'};return _0x36e5df;})});}_0x45191d=_[_0xd6cf('0x54')]({},_0x45191d,_0x3711e4['options']);return _0x4275e3['getTeams'](_0x45191d);}})[_0xd6cf('0x20')](function(_0xae74ce){if(_0xae74ce){_0x58d4fd=_0xae74ce[_0xd6cf('0x4b')];if(!_0x3711e4[_0xd6cf('0x45')][_0xd6cf('0x4c')](_0xd6cf('0x4d'))){_0x45191d[_0xd6cf('0x4e')]=qs[_0xd6cf('0x4e')](_0x3711e4[_0xd6cf('0x45')][_0xd6cf('0x4e')]);_0x45191d[_0xd6cf('0x2a')]=qs[_0xd6cf('0x2a')](_0x3711e4[_0xd6cf('0x45')][_0xd6cf('0x2a')]);}return _0x4275e3[_0xd6cf('0xfe')](_0x45191d);}})[_0xd6cf('0x20')](function(_0x256e58){if(_0x256e58){return _0x256e58?{'count':_0x58d4fd,'rows':_0x256e58}:null;}})[_0xd6cf('0x20')](respondWithResult(_0xb4b00a,null))[_0xd6cf('0x27')](handleError(_0xb4b00a,null));};exports[_0xd6cf('0x100')]=function(_0x255f4b,_0x3ea420){return db[_0xd6cf('0x5b')]['find']({'where':{'id':_0x255f4b[_0xd6cf('0x60')]['id']}})[_0xd6cf('0x20')](handleEntityNotFound(_0x3ea420,null))[_0xd6cf('0x20')](function(_0x4286d1){if(_0x4286d1){var _0x48b4df=_0x4286d1['get']({'plain':!![]});return _0x4286d1[_0xd6cf('0x100')](_0x255f4b[_0xd6cf('0x62')][_0xd6cf('0xa3')],_[_0xd6cf('0x101')](_0x255f4b[_0xd6cf('0x62')],['ids','id'])||{})[_0xd6cf('0x20')](function(){for(var _0x4b4fee=0x0;_0x4b4fee<_0x255f4b[_0xd6cf('0x62')][_0xd6cf('0xa3')]['length'];_0x4b4fee++){var _0x3be127=[];db[_0xd6cf('0xff')][_0xd6cf('0x8d')]({'where':{'id':_0x255f4b[_0xd6cf('0x62')][_0xd6cf('0xa3')][_0x4b4fee]}})['then'](function(_0x4590b7){_0x3be127[_0xd6cf('0xa5')](_0x4590b7[_0xd6cf('0x102')]()[_0xd6cf('0x20')](function(_0x3a6dc7){for(var _0x3f7426=0x0;_0x3f7426<_0x3a6dc7[_0xd6cf('0x4b')];_0x3f7426++){_0x3a6dc7[_0x3f7426][_0xd6cf('0x103')]('channel',_0xd6cf('0x104'));}return _0x3a6dc7;}));_0x3be127[_0xd6cf('0xa5')](_0x4590b7[_0xd6cf('0x105')]()[_0xd6cf('0x20')](function(_0x14ee92){for(var _0x3dcb6b=0x0;_0x3dcb6b<_0x14ee92[_0xd6cf('0x4b')];_0x3dcb6b++){_0x14ee92[_0x3dcb6b][_0xd6cf('0x103')]('channel',_0xd6cf('0x106'));}return _0x14ee92;}));_0x3be127[_0xd6cf('0xa5')](_0x4590b7[_0xd6cf('0x107')]()[_0xd6cf('0x20')](function(_0x4286e5){for(var _0x32e623=0x0;_0x32e623<_0x4286e5[_0xd6cf('0x4b')];_0x32e623++){_0x4286e5[_0x32e623][_0xd6cf('0x103')]('channel',_0xd6cf('0x108'));}return _0x4286e5;}));_0x3be127[_0xd6cf('0xa5')](_0x4590b7['getSmsQueues']()[_0xd6cf('0x20')](function(_0x140202){for(var _0x98f242=0x0;_0x98f242<_0x140202[_0xd6cf('0x4b')];_0x98f242++){_0x140202[_0x98f242][_0xd6cf('0x103')](_0xd6cf('0xaa'),_0xd6cf('0x109'));}return _0x140202;}));_0x3be127[_0xd6cf('0xa5')](_0x4590b7['getFaxQueues']()[_0xd6cf('0x20')](function(_0x22c436){for(var _0x24f29a=0x0;_0x24f29a<_0x22c436['length'];_0x24f29a++){_0x22c436[_0x24f29a][_0xd6cf('0x103')](_0xd6cf('0xaa'),_0xd6cf('0x10a'));}return _0x22c436;}));_0x3be127[_0xd6cf('0xa5')](_0x4590b7[_0xd6cf('0x10b')]()['then'](function(_0x177ddc){for(var _0x3a8c30=0x0;_0x3a8c30<_0x177ddc[_0xd6cf('0x4b')];_0x3a8c30++){_0x177ddc[_0x3a8c30][_0xd6cf('0x103')](_0xd6cf('0xaa'),_0xd6cf('0x10c'));}return _0x177ddc;}));return BPromise[_0xd6cf('0xe3')](_0x3be127);})[_0xd6cf('0x20')](function(_0x2d44b4){var _0x54ffd5=_[_0xd6cf('0x10d')](_0x2d44b4);_0x3be127=[];return db[_0xd6cf('0x57')]['transaction'](function(_0x53c95b){for(var _0x358cd3=0x0;_0x358cd3<_0x54ffd5[_0xd6cf('0x4b')];_0x358cd3++){_0x3be127['push'](_0x54ffd5[_0x358cd3][_0xd6cf('0x10e')](_0x48b4df['id']),{'transaction':_0x53c95b});}return BPromise[_0xd6cf('0xe3')](_0x3be127)[_0xd6cf('0x20')](function(){if(_0x48b4df[_0xd6cf('0xa4')]){return BPromise[_0xd6cf('0xa7')](_[_0xd6cf('0x53')](_0x54ffd5,function(_0x407505){return _0x407505[_0xd6cf('0x10f')]('channel')==='Voice';}),function(_0x349b4e){return db[_0xd6cf('0xa8')][_0xd6cf('0xa9')]({'membername':_0x48b4df[_0xd6cf('0x3a')],'UserId':_0x48b4df['id'],'queue_name':_0x349b4e[_0xd6cf('0x3a')],'VoiceQueueId':_0x349b4e['id'],'interface':_[_0xd6cf('0x6d')](_0x48b4df[_0xd6cf('0x97')])?util[_0xd6cf('0x6f')](_0xd6cf('0xa6'),_0x48b4df[_0xd6cf('0x3a')]):_0x48b4df[_0xd6cf('0x97')],'paused':_0x48b4df['voicePause']||![],'penalty':_0x48b4df[_0xd6cf('0x9c')]},{'transaction':_0x53c95b});});}else{return;}})[_0xd6cf('0x20')](function(){for(var _0x960663=0x0;_0x960663<_0x54ffd5['length'];_0x960663++){var _0x5563a6=_0x54ffd5[_0x960663][_0xd6cf('0x10f')](_0xd6cf('0xaa'));var _0x598e61=_0x5563a6+_0xd6cf('0x9e');socket['emit'](_0xd6cf('0x32')+_0x5563a6+'Queue:save',{'UserId':_0x48b4df['id'],['queueField']:_0x54ffd5[_0x960663]['id']});}});});});}});}})[_0xd6cf('0x20')](respondWithStatusCode(_0x3ea420,null))[_0xd6cf('0x27')](handleError(_0x3ea420,null));};exports[_0xd6cf('0x110')]=function(_0xf68045,_0x4cc8f2){return db[_0xd6cf('0x5b')][_0xd6cf('0x8d')]({'where':{'id':_0xf68045[_0xd6cf('0x60')]['id']}})[_0xd6cf('0x20')](handleEntityNotFound(_0x4cc8f2,null))[_0xd6cf('0x20')](function(_0x36af93){if(_0x36af93){var _0x2ef13f=_0x36af93[_0xd6cf('0x31')]({'plain':!![]});var _0x553f88=_0xf68045[_0xd6cf('0x45')][_0xd6cf('0xa3')];return _0x36af93[_0xd6cf('0x110')](_0x553f88)[_0xd6cf('0x20')](function(){for(var _0x711196=0x0;_0x711196<_0x553f88['length'];_0x711196++){var _0xdcf93a=[];db['Team'][_0xd6cf('0x8d')]({'where':{'id':_0x553f88[_0x711196]}})['then'](function(_0x172c47){_0xdcf93a[_0xd6cf('0xa5')](_0x172c47[_0xd6cf('0x102')]()[_0xd6cf('0x20')](function(_0x2cc4ae){for(var _0x2aabab=0x0;_0x2aabab<_0x2cc4ae[_0xd6cf('0x4b')];_0x2aabab++){_0x2cc4ae[_0x2aabab]['setDataValue'](_0xd6cf('0xaa'),_0xd6cf('0x104'));}return _0x2cc4ae;}));_0xdcf93a[_0xd6cf('0xa5')](_0x172c47['getChatQueues']()[_0xd6cf('0x20')](function(_0x465b56){for(var _0x53d59b=0x0;_0x53d59b<_0x465b56['length'];_0x53d59b++){_0x465b56[_0x53d59b]['setDataValue'](_0xd6cf('0xaa'),_0xd6cf('0x106'));}return _0x465b56;}));_0xdcf93a[_0xd6cf('0xa5')](_0x172c47['getMailQueues']()[_0xd6cf('0x20')](function(_0x474b67){for(var _0x18f2e3=0x0;_0x18f2e3<_0x474b67['length'];_0x18f2e3++){_0x474b67[_0x18f2e3][_0xd6cf('0x103')](_0xd6cf('0xaa'),_0xd6cf('0x108'));}return _0x474b67;}));_0xdcf93a[_0xd6cf('0xa5')](_0x172c47['getSmsQueues']()[_0xd6cf('0x20')](function(_0x33a964){for(var _0x44416f=0x0;_0x44416f<_0x33a964[_0xd6cf('0x4b')];_0x44416f++){_0x33a964[_0x44416f][_0xd6cf('0x103')](_0xd6cf('0xaa'),_0xd6cf('0x109'));}return _0x33a964;}));_0xdcf93a[_0xd6cf('0xa5')](_0x172c47[_0xd6cf('0x111')]()[_0xd6cf('0x20')](function(_0x34dd6f){for(var _0x471aab=0x0;_0x471aab<_0x34dd6f[_0xd6cf('0x4b')];_0x471aab++){_0x34dd6f[_0x471aab][_0xd6cf('0x103')](_0xd6cf('0xaa'),_0xd6cf('0x10a'));}return _0x34dd6f;}));_0xdcf93a[_0xd6cf('0xa5')](_0x172c47[_0xd6cf('0x10b')]()['then'](function(_0x5a1b89){for(var _0x3a96cd=0x0;_0x3a96cd<_0x5a1b89[_0xd6cf('0x4b')];_0x3a96cd++){_0x5a1b89[_0x3a96cd][_0xd6cf('0x103')]('channel',_0xd6cf('0x10c'));}return _0x5a1b89;}));return BPromise[_0xd6cf('0xe3')](_0xdcf93a);})[_0xd6cf('0x20')](function(_0x4ee3ac){var _0x254953=_[_0xd6cf('0x10d')](_0x4ee3ac);_0xdcf93a=[];return db[_0xd6cf('0x57')][_0xd6cf('0x112')](function(_0x5de937){for(var _0x2d53c4=0x0;_0x2d53c4<_0x254953[_0xd6cf('0x4b')];_0x2d53c4++){_0xdcf93a[_0xd6cf('0xa5')](_0x254953[_0x2d53c4]['removeAgent'](_0x2ef13f['id']),{'transaction':_0x5de937});}return BPromise[_0xd6cf('0xe3')](_0xdcf93a)[_0xd6cf('0x20')](function(){if(_0x2ef13f['online']){return BPromise[_0xd6cf('0xa7')](_[_0xd6cf('0x53')](_0x254953,function(_0x5a3928){return _0x5a3928['getDataValue'](_0xd6cf('0xaa'))===_0xd6cf('0x104');}),function(_0x28505c){return db[_0xd6cf('0xa8')][_0xd6cf('0x30')]({'where':{'VoiceQueueId':_0x28505c['id'],'UserId':_0x2ef13f['id']},'transaction':_0x5de937});});}else{return;}})[_0xd6cf('0x20')](function(){for(var _0x44d7e7=0x0;_0x44d7e7<_0x254953[_0xd6cf('0x4b')];_0x44d7e7++){var _0x141db0=_0x254953[_0x44d7e7][_0xd6cf('0x10f')](_0xd6cf('0xaa'));var _0x4aff86=_0x141db0+_0xd6cf('0x9e');socket['emit'](_0xd6cf('0x32')+_0x141db0+_0xd6cf('0xad'),{'UserId':_0x2ef13f['id'],['queueField']:_0x254953[_0x44d7e7]['id']});}});});});}});}})[_0xd6cf('0x20')](respondWithStatusCode(_0x4cc8f2,null))['catch'](handleError(_0x4cc8f2,null));};exports[_0xd6cf('0x113')]=function(_0x3bb9d2,_0x500e88,_0x292b68){var _0x179bd0={};var _0x598471={};var _0x3e5fba;var _0x3640fa;return db[_0xd6cf('0x5b')][_0xd6cf('0x8d')]({'where':{'id':_0x3bb9d2['params']['id']}})[_0xd6cf('0x20')](handleEntityNotFound(_0x500e88,null))['then'](function(_0x456af4){if(_0x456af4){_0x3e5fba=_0x456af4;_0x598471[_0xd6cf('0x41')]=_[_0xd6cf('0x46')](db[_0xd6cf('0xba')][_0xd6cf('0x3f')]);_0x598471['query']=_[_0xd6cf('0x46')](_0x3bb9d2[_0xd6cf('0x45')]);_0x598471[_0xd6cf('0x47')]=_['intersection'](_0x598471[_0xd6cf('0x41')],_0x598471[_0xd6cf('0x45')]);_0x179bd0['attributes']=_[_0xd6cf('0x48')](_0x598471[_0xd6cf('0x41')],qs[_0xd6cf('0x49')](_0x3bb9d2[_0xd6cf('0x45')]['fields']));_0x179bd0[_0xd6cf('0x4a')]=_0x179bd0['attributes'][_0xd6cf('0x4b')]?_0x179bd0[_0xd6cf('0x4a')]:_0x598471[_0xd6cf('0x41')];_0x179bd0[_0xd6cf('0x4f')]=qs[_0xd6cf('0x50')](_0x3bb9d2[_0xd6cf('0x45')][_0xd6cf('0x50')]);_0x179bd0[_0xd6cf('0x51')]=qs['filters'](_['pick'](_0x3bb9d2['query'],_0x598471[_0xd6cf('0x47')]));if(_0x3bb9d2[_0xd6cf('0x45')][_0xd6cf('0x53')]){_0x179bd0[_0xd6cf('0x51')]=_['merge'](_0x179bd0[_0xd6cf('0x51')],{'$or':_[_0xd6cf('0x36')](_0x179bd0[_0xd6cf('0x4a')],function(_0xe98156){var _0x3dbaa8={};_0x3dbaa8[_0xe98156]={'$like':'%'+_0x3bb9d2[_0xd6cf('0x45')][_0xd6cf('0x53')]+'%'};return _0x3dbaa8;})});}_0x179bd0=_[_0xd6cf('0x54')]({},_0x179bd0,_0x3bb9d2[_0xd6cf('0x5a')]);return _0x3e5fba[_0xd6cf('0x113')](_0x179bd0);}})['then'](function(_0x30073a){if(_0x30073a){_0x3640fa=_0x30073a[_0xd6cf('0x4b')];if(!_0x3bb9d2['query']['hasOwnProperty'](_0xd6cf('0x4d'))){_0x179bd0['limit']=qs[_0xd6cf('0x4e')](_0x3bb9d2[_0xd6cf('0x45')][_0xd6cf('0x4e')]);_0x179bd0[_0xd6cf('0x2a')]=qs[_0xd6cf('0x2a')](_0x3bb9d2[_0xd6cf('0x45')][_0xd6cf('0x2a')]);}return _0x3e5fba['getLists'](_0x179bd0);}})['then'](function(_0x359d16){if(_0x359d16){return _0x359d16?{'count':_0x3640fa,'rows':_0x359d16}:null;}})[_0xd6cf('0x20')](respondWithResult(_0x500e88,null))[_0xd6cf('0x27')](handleError(_0x500e88,null));};exports[_0xd6cf('0x114')]=function(_0x3cc69b,_0x5e0f58,_0x136ef2){var _0xd42f25={};var _0x4cedf2={};var _0x46d9de;var _0x4860f2;return db[_0xd6cf('0x5b')][_0xd6cf('0x8d')]({'where':{'id':_0x3cc69b['params']['id']}})[_0xd6cf('0x20')](handleEntityNotFound(_0x5e0f58,null))[_0xd6cf('0x20')](function(_0x466069){if(_0x466069){_0x46d9de=_0x466069;_0x4cedf2[_0xd6cf('0x41')]=_[_0xd6cf('0x46')](db[_0xd6cf('0x5b')][_0xd6cf('0x3f')]);_0x4cedf2[_0xd6cf('0x45')]=_[_0xd6cf('0x46')](_0x3cc69b[_0xd6cf('0x45')]);_0x4cedf2[_0xd6cf('0x47')]=_['intersection'](_0x4cedf2['model'],_0x4cedf2['query']);_0xd42f25[_0xd6cf('0x4a')]=_[_0xd6cf('0x48')](_0x4cedf2['model'],qs[_0xd6cf('0x49')](_0x3cc69b[_0xd6cf('0x45')][_0xd6cf('0x49')]));_0xd42f25[_0xd6cf('0x4a')]=_0xd42f25[_0xd6cf('0x4a')][_0xd6cf('0x4b')]?_0xd42f25['attributes']:_0x4cedf2['model'];_0xd42f25['order']=qs['sort'](_0x3cc69b[_0xd6cf('0x45')][_0xd6cf('0x50')]);_0xd42f25['where']=qs['filters'](_[_0xd6cf('0x52')](_0x3cc69b[_0xd6cf('0x45')],_0x4cedf2['filters']));if(_0x3cc69b[_0xd6cf('0x45')][_0xd6cf('0x53')]){_0xd42f25['where']=_[_0xd6cf('0x54')](_0xd42f25['where'],{'$or':_[_0xd6cf('0x36')](_0xd42f25['attributes'],function(_0x3b6ae5){var _0x65a23={};_0x65a23[_0x3b6ae5]={'$like':'%'+_0x3cc69b['query'][_0xd6cf('0x53')]+'%'};return _0x65a23;})});}_0xd42f25['model']=db[_0xd6cf('0x5b')];_0xd42f25['as']='Agents';_0xd42f25=_['merge']({},_0xd42f25,_0x3cc69b['options']);return _0x46d9de['getVoiceQueues']({'include':[_0xd42f25]});}})[_0xd6cf('0x20')](function(_0x1381ca){if(_0x1381ca){var _0x35d3b4={},_0x347e24=[],_0x1717a9=0x0;for(var _0x449c8a=0x0;_0x449c8a<_0x1381ca[_0xd6cf('0x4b')];_0x449c8a+=0x1){for(var _0x546fe4=0x0,_0x375771;_0x546fe4<_0x1381ca[_0x449c8a][_0xd6cf('0x86')][_0xd6cf('0x4b')];_0x546fe4+=0x1){_0x375771=_0x1381ca[_0x449c8a][_0xd6cf('0x86')][_0x546fe4][_0xd6cf('0x31')]({'plain':!![]});_0x35d3b4[_0x375771['id']]=_0x375771;}}_0x35d3b4=_['values'](_0x35d3b4);for(var _0x4a6c68=qs[_0xd6cf('0x2a')](_0x3cc69b[_0xd6cf('0x45')][_0xd6cf('0x2a')]);_0x4a6c68<_0x35d3b4[_0xd6cf('0x4b')]&&_0x347e24['length']=_0x527c2d){_0x6bfe80=_0x527c2d;_0x423287=0xc8;}else{_0x423287=0xce;}_0x3d3027['status'](_0x423287);return _0x3d3027[_0xcee9('0x32')](_0xcee9('0x33'),_0x6a9aa8+'-'+_0x6bfe80+'/'+_0x527c2d)[_0xcee9('0x34')](_0xbc83b4);}return null;};}function patchUpdates(_0x184982){return function(_0x49f5cc){try{jsonpatch['apply'](_0x49f5cc,_0x184982,!![]);}catch(_0x406939){return BPromise[_0xcee9('0x35')](_0x406939);}return _0x49f5cc[_0xcee9('0x36')]();};}function saveUpdates(_0x4524ae,_0x26c369){return function(_0x2daa14){if(_0x2daa14){return _0x2daa14[_0xcee9('0x37')](_0x4524ae)['then'](function(_0x12169c){return _0x12169c;});}return null;};}function removeEntity(_0x1a2c1a,_0x40b62f){return function(_0x4b7726){if(_0x4b7726){return _0x4b7726[_0xcee9('0x38')]()[_0xcee9('0x21')](function(){var _0x944ea1=_0x4b7726[_0xcee9('0x39')]({'plain':!![]});var _0x1fd9d7=[{'name':'Users','value':'user','ignore':!![]},{'name':_0xcee9('0x3a'),'value':_0xcee9('0x3b'),'ignore':![]},{'name':_0xcee9('0x3c'),'value':'telephone','ignore':![]}];var _0x33be39=_(_0x1fd9d7)[_0xcee9('0x3d')](_0xcee9('0x3e'))[_0xcee9('0x3f')](_0xcee9('0x40'))[_0xcee9('0x40')]();if(_['includes'](_0x33be39,_0x944ea1[_0xcee9('0x41')])){return;}var _0x6f2506=_[_0xcee9('0x42')](_0x1fd9d7,[_0xcee9('0x40'),_0x944ea1['role']])['name'];return db[_0xcee9('0x43')][_0xcee9('0x38')]({'where':{'type':_0x6f2506,'resourceId':_0x944ea1['id']}})['then'](function(){return _0x4b7726;});})['then'](function(){_0x1a2c1a[_0xcee9('0x2d')](0xcc)[_0xcee9('0x2e')]();});}};}function handleEntityNotFound(_0x5663be,_0x13d410){return function(_0x17a964){if(!_0x17a964){_0x5663be[_0xcee9('0x2c')](0x194);}return _0x17a964;};}function handleError(_0x5e6628,_0x4822c3){_0x4822c3=_0x4822c3||0x1f4;return function(_0x35dbfc){logger[_0xcee9('0x28')](_0x35dbfc[_0xcee9('0x44')]);if(_0x35dbfc[_0xcee9('0x45')]){delete _0x35dbfc[_0xcee9('0x45')];}_0x5e6628[_0xcee9('0x2d')](_0x4822c3)[_0xcee9('0x46')](_0x35dbfc);};}exports[_0xcee9('0x47')]=function(_0x2f9311,_0x441116){var _0x8cc88d={},_0x5827ae={},_0x59641f={'count':0x0,'rows':[]};var _0x3a2389=_[_0xcee9('0x3f')](db['User'][_0xcee9('0x48')],function(_0x11efe2){return{'name':_0x11efe2[_0xcee9('0x49')],'type':_0x11efe2['type'][_0xcee9('0x4a')]};});_0x5827ae['model']=_[_0xcee9('0x4b')](_[_0xcee9('0x3f')](_0x3a2389,_0xcee9('0x45')),['password',_0xcee9('0x4c')]);_0x5827ae[_0xcee9('0x4d')]=_[_0xcee9('0x4e')](_0x2f9311['query']);_0x5827ae[_0xcee9('0x4f')]=_['intersection'](_0x5827ae[_0xcee9('0x50')],_0x5827ae[_0xcee9('0x4d')]);_0x8cc88d[_0xcee9('0x51')]=_[_0xcee9('0x52')](_0x5827ae[_0xcee9('0x50')],qs[_0xcee9('0x53')](_0x2f9311[_0xcee9('0x4d')][_0xcee9('0x53')]));_0x8cc88d[_0xcee9('0x51')]=_0x8cc88d[_0xcee9('0x51')][_0xcee9('0x54')]?_0x8cc88d[_0xcee9('0x51')]:_0x5827ae['model'];if(!_0x2f9311['query'][_0xcee9('0x55')](_0xcee9('0x56'))){_0x8cc88d[_0xcee9('0x31')]=qs['limit'](_0x2f9311['query']['limit']);_0x8cc88d[_0xcee9('0x30')]=qs[_0xcee9('0x30')](_0x2f9311[_0xcee9('0x4d')][_0xcee9('0x30')]);}_0x8cc88d['order']=qs[_0xcee9('0x57')](_0x2f9311['query'][_0xcee9('0x57')]);_0x8cc88d[_0xcee9('0x58')]=qs[_0xcee9('0x4f')](_[_0xcee9('0x59')](_0x2f9311['query'],_0x5827ae['filters']));if(_0x2f9311['query']['filter']){_0x8cc88d['where']=_['merge'](_0x8cc88d[_0xcee9('0x58')],{'$or':_[_0xcee9('0x3f')](_0x3a2389,function(_0x5ae137){if(_0x5ae137[_0xcee9('0x5a')]!==_0xcee9('0x5b')){return db[_0xcee9('0x5c')]['where'](db[_0xcee9('0x5c')]['fn']('lower',db[_0xcee9('0x5c')][_0xcee9('0x5d')](_0x5ae137[_0xcee9('0x45')])),{'$like':db[_0xcee9('0x5c')]['fn'](_0xcee9('0x5e'),'%'+_0x2f9311['query'][_0xcee9('0x3d')]+'%')});}})});}_0x8cc88d=_[_0xcee9('0x5f')]({},_0x8cc88d,_0x2f9311[_0xcee9('0x60')]);var _0x54902d={'where':_0x8cc88d['where']};return db[_0xcee9('0x61')][_0xcee9('0x2f')](_0x54902d)[_0xcee9('0x21')](function(_0xc4a8b){_0x59641f[_0xcee9('0x2f')]=_0xc4a8b;if(_0x2f9311[_0xcee9('0x4d')][_0xcee9('0x62')]){_0x8cc88d['include']=[{'all':!![]}];}return db[_0xcee9('0x61')][_0xcee9('0x63')](_0x8cc88d);})[_0xcee9('0x21')](function(_0x159b12){_0x59641f['rows']=_0x159b12;return _0x59641f;})[_0xcee9('0x21')](respondWithFilteredResult(_0x441116,_0x8cc88d))[_0xcee9('0x2b')](handleError(_0x441116,null));};exports[_0xcee9('0x64')]=function(_0x5e8a03,_0x31160b){var _0x51377b={'raw':![],'where':{'id':_0x5e8a03[_0xcee9('0x65')]['id']}},_0x568e09={};_0x568e09[_0xcee9('0x50')]=_[_0xcee9('0x4b')](_[_0xcee9('0x4e')](db[_0xcee9('0x61')][_0xcee9('0x48')]),[_0xcee9('0x66'),_0xcee9('0x4c')]);_0x568e09[_0xcee9('0x4d')]=_[_0xcee9('0x4e')](_0x5e8a03[_0xcee9('0x4d')]);_0x568e09['filters']=_[_0xcee9('0x52')](_0x568e09[_0xcee9('0x50')],_0x568e09[_0xcee9('0x4d')]);_0x51377b[_0xcee9('0x51')]=_[_0xcee9('0x52')](_0x568e09[_0xcee9('0x50')],qs[_0xcee9('0x53')](_0x5e8a03[_0xcee9('0x4d')]['fields']));_0x51377b[_0xcee9('0x51')]=_0x51377b[_0xcee9('0x51')][_0xcee9('0x54')]?_0x51377b[_0xcee9('0x51')]:_0x568e09['model'];if(_0x5e8a03[_0xcee9('0x4d')][_0xcee9('0x62')]){_0x51377b[_0xcee9('0x67')]=[{'all':!![]}];}_0x51377b=_[_0xcee9('0x5f')]({},_0x51377b,_0x5e8a03[_0xcee9('0x60')]);return db['User'][_0xcee9('0x42')](_0x51377b)[_0xcee9('0x21')](handleEntityNotFound(_0x31160b,null))['then'](respondWithResult(_0x31160b,null))['catch'](handleError(_0x31160b,null));};exports[_0xcee9('0x68')]=function(_0x579072,_0x323c76){return db[_0xcee9('0x61')][_0xcee9('0x68')](_0x579072[_0xcee9('0x69')],{'raw':![],'individualHooks':!![]})[_0xcee9('0x21')](respondWithResult(_0x323c76,0xc9))[_0xcee9('0x2b')](handleError(_0x323c76,null));};exports[_0xcee9('0x37')]=function(_0x403c8d,_0x47ab59){if(_0x403c8d['body']['id']){delete _0x403c8d[_0xcee9('0x69')]['id'];}delete _0x403c8d[_0xcee9('0x69')][_0xcee9('0x41')];return db['User'][_0xcee9('0x42')]({'where':{'id':_0x403c8d[_0xcee9('0x65')]['id']}})[_0xcee9('0x21')](handleEntityNotFound(_0x47ab59,null))[_0xcee9('0x21')](saveUpdates(_0x403c8d[_0xcee9('0x69')],null))[_0xcee9('0x21')](respondWithResult(_0x47ab59,null))['catch'](handleError(_0x47ab59,null));};exports[_0xcee9('0x6a')]=function(_0x2cd8e9,_0x25b981){return db[_0xcee9('0x61')][_0xcee9('0x6a')]()['then'](respondWithResult(_0x25b981,null))[_0xcee9('0x2b')](handleError(_0x25b981,null));};exports[_0xcee9('0x6b')]=function(_0xb51870,_0x32e8c1,_0xe5fed4){return db[_0xcee9('0x61')][_0xcee9('0x42')]({'where':{'id':_0xb51870['params']['id']}})['then'](handleEntityNotFound(_0x32e8c1,null))[_0xcee9('0x21')](function(_0x5ea735){if(_0x5ea735){return _0x5ea735[_0xcee9('0x6b')](_0xb51870[_0xcee9('0x69')][_0xcee9('0x6c')],_['omit'](_0xb51870[_0xcee9('0x69')],[_0xcee9('0x6c'),'id'])||{});}})[_0xcee9('0x21')](respondWithResult(_0x32e8c1,null))[_0xcee9('0x2b')](handleError(_0x32e8c1,null));};var getLicense=function(_0x3cb4ba){return new BPromise(function(_0x4d71cd,_0x1cd48f){var _0x2c5705=0x0;_0x3cb4ba[_0xcee9('0x69')][_0xcee9('0x41')]===_0xcee9('0x3b')&&_0x4d71cd(_0xcee9('0x6d'));return db[_0xcee9('0x61')]['count']({'where':{'$or':[{'role':_0x3cb4ba[_0xcee9('0x69')][_0xcee9('0x41')]==='telephone'?_0xcee9('0x6e'):[_0xcee9('0x6f'),_0xcee9('0x70')]}]}})[_0xcee9('0x21')](function(_0x3563bc){_0x2c5705=_0x3563bc;return require(_0xcee9('0x71'))[_0xcee9('0x72')]();})[_0xcee9('0x21')](function(_0x5713ad){var _0x3853bd=_0x3cb4ba[_0xcee9('0x69')][_0xcee9('0x41')]==='telephone'?'telephones':_0xcee9('0x73');if(!_[_0xcee9('0x74')](_0x5713ad[_0x3853bd])&&_0x2c5705>=_0x5713ad[_0x3853bd]){return _0x1cd48f({'message':_0xcee9('0x75')});}return _0x4d71cd(util[_0xcee9('0x76')](_0xcee9('0x77'),_0x3853bd,_0x2c5705));})['catch'](function(_0x2f0789){return _0x1cd48f(_0x2f0789);});});};exports[_0xcee9('0x78')]=function(_0x4dfbf0,_0x1d4c9a){return getLicense(_0x4dfbf0)['then'](function(_0x3bec1d){if(!_0x4dfbf0[_0xcee9('0x69')][_0xcee9('0x79')]){var _0x4076c4;return db[_0xcee9('0x7a')][_0xcee9('0x7b')](0x1)[_0xcee9('0x21')](function(_0x391fb2){return checkPasswordPattern(_0x391fb2,_0x4dfbf0[_0xcee9('0x69')][_0xcee9('0x66')],_0x391fb2[_0xcee9('0x7c')]);})[_0xcee9('0x21')](function(_0x2105d9){_0x4076c4=_0x2105d9['min_internal'];return db[_0xcee9('0x61')]['max'](_0xcee9('0x79'));})['then'](function(_0xce2821){if(_[_0xcee9('0x74')](_0xce2821)){if(_0x4076c4){_0x4dfbf0['body'][_0xcee9('0x79')]=_0x4076c4;}else{_0x4dfbf0[_0xcee9('0x69')]['internal']=0x1;}}else{if(_[_0xcee9('0x74')](_0x4076c4)||_0x4076c4==_0xce2821){_0x4dfbf0['body']['internal']=_0xce2821+0x1;}else if(_0x4076c4>_0xce2821){_0x4dfbf0[_0xcee9('0x69')][_0xcee9('0x79')]=_0x4076c4;}else{return db[_0xcee9('0x5c')][_0xcee9('0x4d')](_0xcee9('0x7d'),{'type':db[_0xcee9('0x5c')]['QueryTypes'][_0xcee9('0x7e')]})[_0xcee9('0x21')](function(_0x42d104){if(_0x42d104&&_0x42d104[_0xcee9('0x54')]){for(var _0x252dc6=0x0,_0x4f0caa=_0x42d104[_0xcee9('0x54')];_0x252dc6<_0x4f0caa&&_[_0xcee9('0x74')](_0x4dfbf0[_0xcee9('0x69')][_0xcee9('0x79')]);_0x252dc6++){if(_0x4076c4<=_0x42d104[_0x252dc6][_0xcee9('0x7f')]){_0x4dfbf0['body'][_0xcee9('0x79')]=_0x42d104[_0x252dc6][_0xcee9('0x7f')];}else if(_0x4076c4>_0x42d104[_0x252dc6][_0xcee9('0x7f')]&&_0x4076c4<=_0x42d104[_0x252dc6]['to']){_0x4dfbf0['body'][_0xcee9('0x79')]=_0x4076c4;}}}if(_[_0xcee9('0x74')](_0x4dfbf0[_0xcee9('0x69')]['internal'])){_0x4dfbf0[_0xcee9('0x69')][_0xcee9('0x79')]=_0xce2821+0x1;}});}}});}})['then'](function(){if(_0x4dfbf0[_0xcee9('0x69')][_0xcee9('0x80')]){_0x4dfbf0[_0xcee9('0x69')][_0xcee9('0x81')]=_0x4dfbf0[_0xcee9('0x69')][_0xcee9('0x79')];_0x4dfbf0[_0xcee9('0x69')]['VoiceMail']={'mailbox':_0x4dfbf0[_0xcee9('0x69')][_0xcee9('0x79')],'password':_0x4dfbf0['body'][_0xcee9('0x66')],'fullname':_0x4dfbf0[_0xcee9('0x69')][_0xcee9('0x82')],'email':_0x4dfbf0[_0xcee9('0x69')]['email']};}if(_0x4dfbf0['body']&&_0x4dfbf0[_0xcee9('0x69')]['role']===_0xcee9('0x3b')){_0x4dfbf0[_0xcee9('0x69')]['permissions']=['101',_0xcee9('0x83'),_0xcee9('0x84'),_0xcee9('0x85'),_0xcee9('0x86'),_0xcee9('0x87'),_0xcee9('0x88'),_0xcee9('0x89'),_0xcee9('0x8a'),_0xcee9('0x8b'),_0xcee9('0x8c'),_0xcee9('0x8d')];}return db[_0xcee9('0x61')][_0xcee9('0x78')](_0x4dfbf0[_0xcee9('0x69')],{'include':[{'model':db[_0xcee9('0x8e')],'as':'VoiceMail'}]});})[_0xcee9('0x21')](function(_0x1f7a2e){if(_0x4dfbf0[_0xcee9('0x69')][_0xcee9('0x41')]===_0xcee9('0x70'))return _0x1f7a2e;var _0x4ce9a5=_0x4dfbf0[_0xcee9('0x70')]['get']({'plain':!![]});if(!_0x4ce9a5)throw new Error(_0xcee9('0x8f'));if(_0x4ce9a5[_0xcee9('0x41')]===_0xcee9('0x70')){var _0x51e3d8=_0x1f7a2e[_0xcee9('0x39')]({'plain':!![]});var _0x3e222d=[{'name':_0xcee9('0x3a'),'value':'agent'},{'name':'Telephones','value':'telephone'}];var _0x4d288c=_[_0xcee9('0x42')](_0x3e222d,[_0xcee9('0x40'),_0x51e3d8[_0xcee9('0x41')]])[_0xcee9('0x45')];return db[_0xcee9('0x90')]['find']({'where':{'name':_0x4d288c,'userProfileId':_0x4ce9a5[_0xcee9('0x91')]},'raw':!![]})['then'](function(_0x5e41f3){if(_0x5e41f3&&_0x5e41f3[_0xcee9('0x92')]===0x0){return db[_0xcee9('0x43')][_0xcee9('0x78')]({'name':_0x51e3d8[_0xcee9('0x45')],'resourceId':_0x51e3d8['id'],'type':_0x5e41f3[_0xcee9('0x45')],'sectionId':_0x5e41f3['id']},{})['then'](function(){return _0x1f7a2e;});}else{return _0x1f7a2e;}})[_0xcee9('0x2b')](function(_0x166614){logger['error'](_0xcee9('0x93'),_0x166614);throw _0x166614;});}return _0x1f7a2e;})[_0xcee9('0x21')](respondWithResult(_0x1d4c9a,0xc9))[_0xcee9('0x2b')](handleError(_0x1d4c9a,null));};exports[_0xcee9('0x94')]=function(_0x3171ae,_0x1d1d1a,_0x2400e9){var _0x231cfe=![];if(_0x3171ae['body']['id']){delete _0x3171ae[_0xcee9('0x69')]['id'];}return db[_0xcee9('0x7a')][_0xcee9('0x95')]({'attributes':['id',_0xcee9('0x7c')]})[_0xcee9('0x21')](function(_0x1ac6be){_0x231cfe=_0x1ac6be[_0xcee9('0x7c')];return db['User']['find']({'where':{'id':_0x3171ae[_0xcee9('0x65')]['id']}});})[_0xcee9('0x21')](function(_0x3dd5eb){if(_0x3dd5eb){if(_0x3dd5eb['id']==_0x3171ae['user']['id']){if(!_0x3171ae['body']['oldPassword']||!_0x3171ae['body']['newPassword']){throw new db[(_0xcee9('0x1d'))][(_0xcee9('0x1e'))]('Invalid\x20body\x20format.\x20Use\x20oldPassord\x20and\x20newPassword');}if(!_0x3dd5eb[_0xcee9('0x96')](_0x3171ae['body']['oldPassword'])){throw new db['Sequelize']['ValidationError'](_0xcee9('0x97'));}if(_0x3171ae['body'][_0xcee9('0x98')]==_0x3171ae[_0xcee9('0x69')][_0xcee9('0x99')]){throw new db[(_0xcee9('0x1d'))][(_0xcee9('0x1e'))](_0xcee9('0x9a'));}return _0x3dd5eb;}else if(_0x3171ae[_0xcee9('0x70')]['role']==_0xcee9('0x6f')){if(!_0x3171ae['body']['newPassword']){throw new db[(_0xcee9('0x1d'))]['ValidationError'](_0xcee9('0x9b'));}return _0x3dd5eb;}else if(_0x3171ae[_0xcee9('0x70')][_0xcee9('0x41')]=='user'){if(!_0x3171ae[_0xcee9('0x69')][_0xcee9('0x99')]){throw new db[(_0xcee9('0x1d'))]['ValidationError']('Invalid\x20body\x20format.\x20Use\x20newPassword');}if(_0x3dd5eb['role']!=_0xcee9('0x3b')){throw new db[(_0xcee9('0x1d'))]['ValidationError'](_0xcee9('0x9c'));}return _0x3dd5eb;}else{throw new db[(_0xcee9('0x1d'))][(_0xcee9('0x1e'))](_0xcee9('0x9c'));}}return null;})[_0xcee9('0x21')](handleEntityNotFound(_0x1d1d1a,null))['then'](function(_0x30ef29){return checkPasswordPattern(_0x30ef29,_0x3171ae[_0xcee9('0x69')][_0xcee9('0x99')],_0x231cfe);})[_0xcee9('0x21')](saveUpdates({'password':_0x3171ae['body'][_0xcee9('0x99')],'passwordResetAt':_0x3171ae[_0xcee9('0x70')]['id']==_0x3171ae[_0xcee9('0x65')]['id']?moment():null},null))[_0xcee9('0x21')](respondWithResult(_0x1d1d1a,null))[_0xcee9('0x2b')](handleError(_0x1d1d1a,null));};exports[_0xcee9('0x9d')]=function(_0x151c19,_0x3d687a,_0x3a0538){var _0x5294f7=_0x151c19[_0xcee9('0x69')][_0xcee9('0x9e')];return db['User']['find']({'where':{'id':_0x151c19[_0xcee9('0x65')]['id']},'attributes':['id',_0xcee9('0x45'),_0xcee9('0x41'),_0xcee9('0x9f'),'loginInPause',_0xcee9('0xa0'),_0xcee9('0xa1')]})[_0xcee9('0x21')](handleEntityNotFound(_0x3d687a,null))[_0xcee9('0x21')](function(_0x5833a9){if(_0x5833a9){if(!utils[_0xcee9('0xa2')](_0x5294f7)){throw new db[(_0xcee9('0x1d'))][(_0xcee9('0x1e'))](_0xcee9('0xa3'));}return _0x5833a9[_0xcee9('0xa4')+_[_0xcee9('0xa5')](_0x5294f7[_0xcee9('0xa6')]())+_0xcee9('0xa7')](_0x151c19[_0xcee9('0x69')]['ids'],{'penalty':_0x151c19['body']['penalty']||0x0})[_0xcee9('0xa8')](function(_0x3008e7){for(var _0x252057=0x0;_0x252057<_0x151c19[_0xcee9('0x69')][_0xcee9('0x6c')][_0xcee9('0x54')];_0x252057+=0x1){var _0x210720={'UserId':_0x151c19[_0xcee9('0x65')]['id']};_0x210720[_[_0xcee9('0xa5')](_0x5294f7[_0xcee9('0xa6')]())+_0xcee9('0xa9')]=_0x151c19['body'][_0xcee9('0x6c')][_0x252057];socket['emit']('user'+_[_0xcee9('0xa5')](_0x5294f7[_0xcee9('0xa6')]())+_0xcee9('0xaa'),_0x210720);}return _0x3008e7;})[_0xcee9('0x21')](function(){if(_0x5294f7===_0xcee9('0xab')){return db[_0xcee9('0xac')][_0xcee9('0x63')]({'where':{'id':_0x151c19[_0xcee9('0x69')][_0xcee9('0x6c')]||[]},'raw':!![],'attributes':['id',_0xcee9('0x45')]});}})[_0xcee9('0x21')](function(_0x3e40b3){var _0xf021d=_0x5833a9['get']({'plain':!![]});var _0x4da33b=[];if(_0x5294f7===_0xcee9('0xab')&&_0xf021d[_0xcee9('0x41')]===_0xcee9('0x3b')&&_0xf021d['online']){for(var _0x30852d=0x0;_0x30852d<_0x3e40b3[_0xcee9('0x54')];_0x30852d+=0x1){_0x4da33b[_0xcee9('0xad')]({'membername':_0xf021d[_0xcee9('0x45')],'UserId':_0xf021d['id'],'queue_name':_0x3e40b3[_0x30852d]['name'],'VoiceQueueId':_0x3e40b3[_0x30852d]['id'],'interface':_[_0xcee9('0x74')](_0xf021d[_0xcee9('0xa1')])?util['format'](_0xcee9('0xae'),_0xf021d[_0xcee9('0x45')]):_0xf021d[_0xcee9('0xa1')],'paused':_0xf021d[_0xcee9('0xa0')]||![],'penalty':_0x151c19[_0xcee9('0x69')][_0xcee9('0xaf')]||0x0});}return BPromise[_0xcee9('0xb0')](_0x4da33b,function(_0x451d05){return db['UserVoiceQueueRt']['upsert'](_0x451d05);});}return _0x5833a9;});}})[_0xcee9('0x21')](respondWithStatusCode(_0x3d687a,null))[_0xcee9('0x2b')](handleError(_0x3d687a,null));};exports[_0xcee9('0xb1')]=function(_0x208e3a,_0x27c497,_0x2cb7d4){var _0x469342;return db['User'][_0xcee9('0x42')]({'where':{'id':_0x208e3a[_0xcee9('0x65')]['id']},'attributes':['id',_0xcee9('0x45'),_0xcee9('0x41')]})['then'](handleEntityNotFound(_0x27c497,null))[_0xcee9('0x21')](function(_0x2047a0){if(_0x2047a0){_0x469342=_0x2047a0;if(!_0x208e3a[_0xcee9('0x4d')]['channel']||!utils[_0xcee9('0xa2')](_0x208e3a[_0xcee9('0x4d')][_0xcee9('0x9e')])){throw new db[(_0xcee9('0x1d'))][(_0xcee9('0x1e'))](_0xcee9('0xa3'));}return _0x2047a0[_0xcee9('0xb2')+_['capitalize'](_0x208e3a[_0xcee9('0x4d')][_0xcee9('0x9e')][_0xcee9('0xa6')]())+'Queues'](_0x208e3a[_0xcee9('0x4d')][_0xcee9('0x6c')]);}})[_0xcee9('0x21')](function(_0x2b023f){for(var _0x372e28=0x0;_0x372e28<_0x208e3a[_0xcee9('0x4d')][_0xcee9('0x6c')][_0xcee9('0x54')];_0x372e28+=0x1){var _0x26b157={'UserId':_0x208e3a[_0xcee9('0x65')]['id']};_0x26b157[_[_0xcee9('0xa5')](_0x208e3a[_0xcee9('0x4d')][_0xcee9('0x9e')][_0xcee9('0xa6')]())+_0xcee9('0xa9')]=_0x208e3a[_0xcee9('0x4d')]['ids'][_0x372e28];socket[_0xcee9('0xb3')](_0xcee9('0x70')+_[_0xcee9('0xa5')](_0x208e3a[_0xcee9('0x4d')][_0xcee9('0x9e')][_0xcee9('0xa6')]())+'Queue:remove',_0x26b157);}return _0x2b023f;})[_0xcee9('0x21')](function(){if(_0x208e3a['query']['channel']===_0xcee9('0xab')){return db[_0xcee9('0xb4')][_0xcee9('0x38')]({'where':{'UserId':_0x208e3a[_0xcee9('0x65')]['id'],'VoiceQueueId':_0x208e3a[_0xcee9('0x4d')][_0xcee9('0x6c')]},'individualHooks':!![]})['then'](function(){return _0x469342;});}return _0x469342;})[_0xcee9('0x21')](respondWithStatusCode(_0x27c497,null))[_0xcee9('0x2b')](handleError(_0x27c497,null));};exports[_0xcee9('0xb5')]=function(_0x31d867,_0x5e7d6e,_0xfbd7e8){_0x31d867[_0xcee9('0x69')][_0xcee9('0xb6')]=_0x31d867[_0xcee9('0xb7')][_0xcee9('0xb8')];return db[_0xcee9('0x61')][_0xcee9('0x42')]({'where':{'id':_0x31d867[_0xcee9('0x65')]['id']}})[_0xcee9('0x21')](handleEntityNotFound(_0x5e7d6e,null))[_0xcee9('0x21')](saveUpdates(_0x31d867[_0xcee9('0x69')],null))[_0xcee9('0x21')](respondWithResult(_0x5e7d6e,null))[_0xcee9('0x2b')](handleError(_0x5e7d6e,null));};exports[_0xcee9('0xb9')]=function(_0x191718,_0x2a9847,_0x445354){var _0x10e830=path['join'](config['root'],_0xcee9('0xba'));return db[_0xcee9('0x61')][_0xcee9('0x42')]({'where':{'id':_0x191718[_0xcee9('0x65')]['id']},'attributes':['id',_0xcee9('0xb6')],'raw':!![]})[_0xcee9('0x21')](handleEntityNotFound(_0x2a9847,null))[_0xcee9('0x21')](function(_0x5567a1){if(_0x5567a1){if(_['isNil'](_0x5567a1['userpic'])){return _0x2a9847[_0xcee9('0xbb')](_0x10e830);}else{if(!fs[_0xcee9('0xbc')](path[_0xcee9('0xbd')](config[_0xcee9('0xbe')],_0xcee9('0xbf'),_0x5567a1[_0xcee9('0xb6')]))){return _0x2a9847[_0xcee9('0xbb')](_0x10e830);}return _0x2a9847[_0xcee9('0xbb')](path[_0xcee9('0xbd')](config['root'],_0xcee9('0xbf'),_0x5567a1[_0xcee9('0xb6')]));}}})['catch'](handleError(_0x2a9847,null));};exports[_0xcee9('0xc0')]=function(_0x40309a,_0x49e653,_0x385446){var _0x10615f={};var _0x5152f={};var _0x56a9a7;var _0x4535d7;return db[_0xcee9('0x61')][_0xcee9('0x95')]({'where':{'id':_0x40309a['params']['id']}})[_0xcee9('0x21')](handleEntityNotFound(_0x49e653,null))[_0xcee9('0x21')](function(_0x2556bf){if(_0x2556bf){_0x56a9a7=_0x2556bf;_0x5152f[_0xcee9('0x50')]=_['keys'](db[_0xcee9('0xc1')][_0xcee9('0x48')]);_0x5152f[_0xcee9('0x4d')]=_[_0xcee9('0x4e')](_0x40309a[_0xcee9('0x4d')]);_0x5152f[_0xcee9('0x4f')]=_['intersection'](_0x5152f[_0xcee9('0x50')],_0x5152f['query']);_0x10615f[_0xcee9('0x51')]=_[_0xcee9('0x52')](_0x5152f[_0xcee9('0x50')],qs['fields'](_0x40309a[_0xcee9('0x4d')][_0xcee9('0x53')]));_0x10615f['attributes']=_0x10615f[_0xcee9('0x51')][_0xcee9('0x54')]?_0x10615f[_0xcee9('0x51')]:_0x5152f['model'];_0x10615f['order']=qs[_0xcee9('0x57')](_0x40309a[_0xcee9('0x4d')][_0xcee9('0x57')]);_0x10615f[_0xcee9('0x58')]=qs[_0xcee9('0x4f')](_[_0xcee9('0x59')](_0x40309a['query'],_0x5152f[_0xcee9('0x4f')]));if(_0x40309a[_0xcee9('0x4d')][_0xcee9('0x3d')]){_0x10615f[_0xcee9('0x58')]=_[_0xcee9('0x5f')](_0x10615f[_0xcee9('0x58')],{'$or':_[_0xcee9('0x3f')](_0x10615f['attributes'],function(_0x130a9c){var _0x217baa={};_0x217baa[_0x130a9c]={'$like':'%'+_0x40309a[_0xcee9('0x4d')][_0xcee9('0x3d')]+'%'};return _0x217baa;})});}_0x10615f=_[_0xcee9('0x5f')]({},_0x10615f,_0x40309a[_0xcee9('0x60')]);return _0x56a9a7['getContacts'](_0x10615f);}})['then'](function(_0x205a17){if(_0x205a17){_0x4535d7=_0x205a17[_0xcee9('0x54')];if(_0x40309a['query']['hasOwnProperty'](_0xcee9('0x62'))){_0x10615f['include']=[{'model':db['CmList'],'as':_0xcee9('0xc2'),'required':![]},{'model':db['Tag'],'as':_0xcee9('0xc3'),'attributes':['id','name',_0xcee9('0xc4')],'where':_0x40309a[_0xcee9('0x4d')][_0xcee9('0xc5')]?{'id':_0x40309a[_0xcee9('0x4d')]['tag']}:undefined,'required':_0x40309a[_0xcee9('0x4d')]['tag']?!![]:![]}];}if(!_0x40309a[_0xcee9('0x4d')][_0xcee9('0x55')](_0xcee9('0x56'))){_0x10615f[_0xcee9('0x31')]=qs[_0xcee9('0x31')](_0x40309a[_0xcee9('0x4d')][_0xcee9('0x31')]);_0x10615f['offset']=qs['offset'](_0x40309a[_0xcee9('0x4d')][_0xcee9('0x30')]);}return _0x56a9a7['getContacts'](_0x10615f);}})['then'](function(_0x115607){if(_0x115607){return _0x115607?{'count':_0x4535d7,'rows':_0x115607}:null;}})['then'](respondWithResult(_0x49e653,null))[_0xcee9('0x2b')](handleError(_0x49e653,null));};exports['getQueues']=function(_0x5ac3d5,_0x5c4db1,_0xcb1f6a){var _0x321b4c;var _0x351596;var _0xa88f51={};var _0x4c44f7;return db[_0xcee9('0x61')][_0xcee9('0x95')]({'where':{'id':_0x5ac3d5[_0xcee9('0x65')]['id']},'attributes':['id',_0xcee9('0x45'),_0xcee9('0x41')]})[_0xcee9('0x21')](handleEntityNotFound(_0x5c4db1,null))['then'](function(_0x3187d0){if(!utils[_0xcee9('0xa2')](_0x5ac3d5[_0xcee9('0x4d')][_0xcee9('0x9e')])){throw new db[(_0xcee9('0x1d'))][(_0xcee9('0x1e'))](_0xcee9('0xa3'));}_0x321b4c=_0x3187d0;var _0x37288f={};_0x37288f[_0xcee9('0x50')]=_[_0xcee9('0x4e')](db[_[_0xcee9('0xa5')](_0x5ac3d5[_0xcee9('0x4d')][_0xcee9('0x9e')])+'Queue'][_0xcee9('0x48')]);_0x37288f[_0xcee9('0x4d')]=_[_0xcee9('0x4e')](_0x5ac3d5['query']);_0x37288f[_0xcee9('0x4f')]=_[_0xcee9('0x52')](_0x37288f[_0xcee9('0x50')],_0x37288f[_0xcee9('0x4d')]);_0xa88f51[_0xcee9('0x51')]=_[_0xcee9('0x52')](_0x37288f[_0xcee9('0x50')],qs[_0xcee9('0x53')](_0x5ac3d5[_0xcee9('0x4d')][_0xcee9('0x53')]));_0xa88f51[_0xcee9('0x51')]=_0xa88f51[_0xcee9('0x51')][_0xcee9('0x54')]?_0xa88f51[_0xcee9('0x51')]:_0x37288f[_0xcee9('0x50')];_0xa88f51[_0xcee9('0xc6')]=qs[_0xcee9('0x57')](_0x5ac3d5['query'][_0xcee9('0x57')]);_0xa88f51[_0xcee9('0x58')]=qs[_0xcee9('0x4f')](_['pick'](_0x5ac3d5[_0xcee9('0x4d')],_0x37288f[_0xcee9('0x4f')]));if(_0x5ac3d5[_0xcee9('0x4d')]['filter']){_0xa88f51['where']=_[_0xcee9('0x5f')](_0xa88f51[_0xcee9('0x58')],{'$or':_[_0xcee9('0x3f')](_0xa88f51['attributes'],function(_0x421e4d){var _0x47841a={};_0x47841a[_0x421e4d]={'$like':'%'+_0x5ac3d5[_0xcee9('0x4d')]['filter']+'%'};return _0x47841a;})});}_0xa88f51=_[_0xcee9('0x5f')]({},_0xa88f51,_0x5ac3d5[_0xcee9('0x60')]);switch(_0x321b4c[_0xcee9('0x41')]){case _0xcee9('0x6f'):return db[_[_0xcee9('0xa5')](_0x5ac3d5[_0xcee9('0x4d')][_0xcee9('0x9e')])+_0xcee9('0xc7')]['findAll'](_0xa88f51);case _0xcee9('0x70'):case _0xcee9('0x3b'):return _0x321b4c[_0xcee9('0x39')+_[_0xcee9('0xa5')](_0x5ac3d5[_0xcee9('0x4d')]['channel'])+_0xcee9('0xa7')](_0xa88f51);default:throw new db[(_0xcee9('0x1d'))][(_0xcee9('0x1e'))](_0xcee9('0xc8'));}})[_0xcee9('0x21')](function(_0x3b298e){_0x4c44f7=_0x3b298e[_0xcee9('0x54')];if(!_0x5ac3d5[_0xcee9('0x4d')][_0xcee9('0x55')](_0xcee9('0x56'))){_0xa88f51[_0xcee9('0x31')]=qs[_0xcee9('0x31')](_0x5ac3d5[_0xcee9('0x4d')][_0xcee9('0x31')]);_0xa88f51[_0xcee9('0x30')]=qs[_0xcee9('0x30')](_0x5ac3d5['query'][_0xcee9('0x30')]);}switch(_0x321b4c[_0xcee9('0x41')]){case'admin':return db[_['capitalize'](_0x5ac3d5[_0xcee9('0x4d')][_0xcee9('0x9e')])+_0xcee9('0xc7')]['findAll'](_0xa88f51);case _0xcee9('0x70'):case'agent':return _0x321b4c[_0xcee9('0x39')+_['capitalize'](_0x5ac3d5[_0xcee9('0x4d')][_0xcee9('0x9e')])+_0xcee9('0xa7')](_0xa88f51);}})['then'](function(_0x3a2a3a){return{'count':_0x4c44f7,'rows':_0x3a2a3a};})[_0xcee9('0x21')](respondWithResult(_0x5c4db1,null))['catch'](handleError(_0x5c4db1,null));};exports[_0xcee9('0xc9')]=function(_0x59b1b5,_0x57cadf,_0x20c292){var _0x175d2a={};var _0x517ae2={};var _0x2d3427;var _0x1a344a;return db[_0xcee9('0x61')][_0xcee9('0x95')]({'where':{'id':_0x59b1b5[_0xcee9('0x65')]['id']}})[_0xcee9('0x21')](handleEntityNotFound(_0x57cadf,null))[_0xcee9('0x21')](function(_0x243481){if(_0x243481){_0x2d3427=_0x243481;_0x517ae2[_0xcee9('0x50')]=_[_0xcee9('0x4e')](db[_0xcee9('0xb4')]['rawAttributes']);_0x517ae2['query']=_[_0xcee9('0x4e')](_0x59b1b5[_0xcee9('0x4d')]);_0x517ae2['filters']=_[_0xcee9('0x52')](_0x517ae2[_0xcee9('0x50')],_0x517ae2[_0xcee9('0x4d')]);_0x175d2a['attributes']=_[_0xcee9('0x52')](_0x517ae2['model'],qs[_0xcee9('0x53')](_0x59b1b5['query']['fields']));_0x175d2a[_0xcee9('0x51')]=_0x175d2a['attributes'][_0xcee9('0x54')]?_0x175d2a[_0xcee9('0x51')]:_0x517ae2[_0xcee9('0x50')];_0x175d2a[_0xcee9('0xc6')]=qs[_0xcee9('0x57')](_0x59b1b5[_0xcee9('0x4d')][_0xcee9('0x57')]);_0x175d2a[_0xcee9('0x58')]=qs[_0xcee9('0x4f')](_['pick'](_0x59b1b5[_0xcee9('0x4d')],_0x517ae2[_0xcee9('0x4f')]));if(_0x59b1b5['query'][_0xcee9('0x3d')]){_0x175d2a[_0xcee9('0x58')]=_[_0xcee9('0x5f')](_0x175d2a['where'],{'$or':_[_0xcee9('0x3f')](_0x175d2a['attributes'],function(_0x3ea43a){var _0x3a2115={};_0x3a2115[_0x3ea43a]={'$like':'%'+_0x59b1b5['query'][_0xcee9('0x3d')]+'%'};return _0x3a2115;})});}_0x175d2a=_[_0xcee9('0x5f')]({},_0x175d2a,_0x59b1b5[_0xcee9('0x60')]);return _0x2d3427[_0xcee9('0xc9')](_0x175d2a);}})['then'](function(_0x220536){if(_0x220536){_0x1a344a=_0x220536[_0xcee9('0x54')];if(!_0x59b1b5['query'][_0xcee9('0x55')](_0xcee9('0x56'))){_0x175d2a[_0xcee9('0x31')]=qs[_0xcee9('0x31')](_0x59b1b5[_0xcee9('0x4d')][_0xcee9('0x31')]);_0x175d2a[_0xcee9('0x30')]=qs['offset'](_0x59b1b5['query'][_0xcee9('0x30')]);}return _0x2d3427[_0xcee9('0xc9')](_0x175d2a);}})[_0xcee9('0x21')](function(_0x21ef13){if(_0x21ef13){return _0x21ef13?{'count':_0x1a344a,'rows':_0x21ef13}:null;}})['then'](respondWithResult(_0x57cadf,null))[_0xcee9('0x2b')](handleError(_0x57cadf,null));};exports['getGroups']=function(_0x46b37a,_0x4226ae,_0x7d5369){var _0x2a8a84={};var _0x17210b={};var _0x5cf928;var _0x588e16;return db['User']['findOne']({'where':{'id':_0x46b37a[_0xcee9('0x65')]['id']}})['then'](handleEntityNotFound(_0x4226ae,null))['then'](function(_0x749d0a){if(_0x749d0a){_0x5cf928=_0x749d0a;_0x17210b[_0xcee9('0x50')]=_[_0xcee9('0x4e')](db[_0xcee9('0xca')][_0xcee9('0x48')]);_0x17210b['query']=_[_0xcee9('0x4e')](_0x46b37a[_0xcee9('0x4d')]);_0x17210b[_0xcee9('0x4f')]=_[_0xcee9('0x52')](_0x17210b[_0xcee9('0x50')],_0x17210b[_0xcee9('0x4d')]);_0x2a8a84[_0xcee9('0x51')]=_[_0xcee9('0x52')](_0x17210b[_0xcee9('0x50')],qs['fields'](_0x46b37a[_0xcee9('0x4d')][_0xcee9('0x53')]));_0x2a8a84['attributes']=_0x2a8a84[_0xcee9('0x51')][_0xcee9('0x54')]?_0x2a8a84['attributes']:_0x17210b[_0xcee9('0x50')];_0x2a8a84[_0xcee9('0xc6')]=qs[_0xcee9('0x57')](_0x46b37a[_0xcee9('0x4d')][_0xcee9('0x57')]);_0x2a8a84['where']=qs[_0xcee9('0x4f')](_[_0xcee9('0x59')](_0x46b37a[_0xcee9('0x4d')],_0x17210b['filters']));if(_0x46b37a[_0xcee9('0x4d')][_0xcee9('0x3d')]){_0x2a8a84['where']=_['merge'](_0x2a8a84[_0xcee9('0x58')],{'$or':_[_0xcee9('0x3f')](_0x2a8a84[_0xcee9('0x51')],function(_0x19e453){var _0x2f9fe0={};_0x2f9fe0[_0x19e453]={'$like':'%'+_0x46b37a[_0xcee9('0x4d')][_0xcee9('0x3d')]+'%'};return _0x2f9fe0;})});}_0x2a8a84=_[_0xcee9('0x5f')]({},_0x2a8a84,_0x46b37a[_0xcee9('0x60')]);return _0x5cf928[_0xcee9('0xcb')](_0x2a8a84);}})[_0xcee9('0x21')](function(_0x57ed4e){if(_0x57ed4e){_0x588e16=_0x57ed4e[_0xcee9('0x54')];if(!_0x46b37a[_0xcee9('0x4d')][_0xcee9('0x55')]('nolimit')){_0x2a8a84[_0xcee9('0x31')]=qs[_0xcee9('0x31')](_0x46b37a[_0xcee9('0x4d')][_0xcee9('0x31')]);_0x2a8a84['offset']=qs['offset'](_0x46b37a[_0xcee9('0x4d')]['offset']);}return _0x5cf928[_0xcee9('0xcb')](_0x2a8a84);}})['then'](function(_0x419ddc){if(_0x419ddc){return _0x419ddc?{'count':_0x588e16,'rows':_0x419ddc}:null;}})[_0xcee9('0x21')](respondWithResult(_0x4226ae,null))[_0xcee9('0x2b')](handleError(_0x4226ae,null));};exports['getRecordings']=function(_0x1596e5,_0x2d936b,_0x509fd7){var _0x376f25={'raw':!![],'where':{}};var _0x1e6812={};var _0x1dfb87={'count':0x0,'rows':[]};return db[_0xcee9('0x61')][_0xcee9('0x95')]({'where':{'id':_0x1596e5['params']['id']}})[_0xcee9('0x21')](handleEntityNotFound(_0x2d936b,null))[_0xcee9('0x21')](function(_0x32970c){if(_0x32970c){_0x1e6812[_0xcee9('0x50')]=_[_0xcee9('0x4e')](db[_0xcee9('0xcc')]['rawAttributes']);_0x1e6812[_0xcee9('0x4d')]=_[_0xcee9('0x4e')](_0x1596e5['query']);_0x1e6812[_0xcee9('0x4f')]=_[_0xcee9('0x52')](_0x1e6812[_0xcee9('0x50')],_0x1e6812[_0xcee9('0x4d')]);_0x376f25[_0xcee9('0x51')]=_[_0xcee9('0x52')](_0x1e6812[_0xcee9('0x50')],qs[_0xcee9('0x53')](_0x1596e5['query']['fields']));_0x376f25[_0xcee9('0x51')]=_0x376f25['attributes']['length']?_0x376f25['attributes']:_0x1e6812[_0xcee9('0x50')];if(!_0x1596e5[_0xcee9('0x4d')][_0xcee9('0x55')](_0xcee9('0x56'))){_0x376f25[_0xcee9('0x31')]=qs['limit'](_0x1596e5[_0xcee9('0x4d')][_0xcee9('0x31')]);_0x376f25[_0xcee9('0x30')]=qs[_0xcee9('0x30')](_0x1596e5['query']['offset']);}_0x376f25[_0xcee9('0xc6')]=qs[_0xcee9('0x57')](_0x1596e5['query'][_0xcee9('0x57')]);_0x376f25['where']=qs[_0xcee9('0x4f')](_[_0xcee9('0x59')](_0x1596e5[_0xcee9('0x4d')],_0x1e6812[_0xcee9('0x4f')]));_0x376f25[_0xcee9('0x58')][_0xcee9('0xcd')]=_0x32970c['id'];if(_0x1596e5[_0xcee9('0x4d')][_0xcee9('0x3d')]){_0x376f25[_0xcee9('0x58')]=_[_0xcee9('0x5f')](_0x376f25[_0xcee9('0x58')],{'$or':_[_0xcee9('0x3f')](_0x376f25[_0xcee9('0x51')],function(_0x3d99ec){var _0x56d6ca={};_0x56d6ca[_0x3d99ec]={'$like':'%'+_0x1596e5['query'][_0xcee9('0x3d')]+'%'};return _0x56d6ca;})});}_0x376f25=_['merge']({},_0x376f25,_0x1596e5[_0xcee9('0x60')]);return db[_0xcee9('0xcc')]['count']({'where':_0x376f25['where']})[_0xcee9('0x21')](function(_0x536d4d){_0x1dfb87[_0xcee9('0x2f')]=_0x536d4d;if(_0x1596e5[_0xcee9('0x4d')][_0xcee9('0x62')]){_0x376f25['include']=[{'all':!![]}];}return db[_0xcee9('0xcc')][_0xcee9('0x63')](_0x376f25);})[_0xcee9('0x21')](function(_0x4960d3){_0x1dfb87[_0xcee9('0xce')]=_0x4960d3;return _0x1dfb87;});}})[_0xcee9('0x21')](respondWithFilteredResult(_0x2d936b,_0x376f25))[_0xcee9('0x2b')](handleError(_0x2d936b,null));};exports[_0xcee9('0xcf')]=function(_0x5c179d,_0x115b6e,_0x430594){var _0x2fab07={'raw':!![],'where':{}};var _0x472acb={};var _0x2e3de0={'count':0x0,'rows':[]};return db[_0xcee9('0x61')]['findOne']({'where':{'id':_0x5c179d[_0xcee9('0x65')]['id']}})[_0xcee9('0x21')](handleEntityNotFound(_0x115b6e,null))[_0xcee9('0x21')](function(_0x186ee7){if(_0x186ee7){_0x472acb[_0xcee9('0x50')]=_['keys'](db[_0xcee9('0xd0')][_0xcee9('0x48')]);_0x472acb[_0xcee9('0x4d')]=_['keys'](_0x5c179d['query']);_0x472acb[_0xcee9('0x4f')]=_['intersection'](_0x472acb[_0xcee9('0x50')],_0x472acb[_0xcee9('0x4d')]);_0x2fab07[_0xcee9('0x51')]=_['intersection'](_0x472acb[_0xcee9('0x50')],qs[_0xcee9('0x53')](_0x5c179d['query'][_0xcee9('0x53')]));_0x2fab07[_0xcee9('0x51')]=_0x2fab07['attributes'][_0xcee9('0x54')]?_0x2fab07['attributes']:_0x472acb['model'];if(!_0x5c179d[_0xcee9('0x4d')][_0xcee9('0x55')]('nolimit')){_0x2fab07[_0xcee9('0x31')]=qs[_0xcee9('0x31')](_0x5c179d[_0xcee9('0x4d')]['limit']);_0x2fab07[_0xcee9('0x30')]=qs[_0xcee9('0x30')](_0x5c179d[_0xcee9('0x4d')][_0xcee9('0x30')]);}_0x2fab07['order']=qs[_0xcee9('0x57')](_0x5c179d[_0xcee9('0x4d')]['sort']);_0x2fab07[_0xcee9('0x58')]=qs[_0xcee9('0x4f')](_['pick'](_0x5c179d[_0xcee9('0x4d')],_0x472acb[_0xcee9('0x4f')]));_0x2fab07[_0xcee9('0x58')][_0xcee9('0xcd')]=_0x186ee7['id'];if(_0x5c179d[_0xcee9('0x4d')][_0xcee9('0x3d')]){_0x2fab07[_0xcee9('0x58')]=_['merge'](_0x2fab07[_0xcee9('0x58')],{'$or':_[_0xcee9('0x3f')](_0x2fab07[_0xcee9('0x51')],function(_0x52b5fc){var _0x100f3f={};_0x100f3f[_0x52b5fc]={'$like':'%'+_0x5c179d[_0xcee9('0x4d')][_0xcee9('0x3d')]+'%'};return _0x100f3f;})});}_0x2fab07=_[_0xcee9('0x5f')]({},_0x2fab07,_0x5c179d['options']);return db[_0xcee9('0xd0')]['count']({'where':_0x2fab07['where']})[_0xcee9('0x21')](function(_0x22d5ae){_0x2e3de0[_0xcee9('0x2f')]=_0x22d5ae;if(_0x5c179d['query'][_0xcee9('0x62')]){_0x2fab07[_0xcee9('0x67')]=[{'all':!![]}];}return db[_0xcee9('0xd0')][_0xcee9('0x63')](_0x2fab07);})[_0xcee9('0x21')](function(_0x4fa992){_0x2e3de0[_0xcee9('0xce')]=_0x4fa992;return _0x2e3de0;});}})[_0xcee9('0x21')](respondWithFilteredResult(_0x115b6e,_0x2fab07))['catch'](handleError(_0x115b6e,null));};exports[_0xcee9('0xd1')]=function(_0x70c720,_0x35f4f1,_0x313c7e){var _0x1344f5={};var _0x231473={};var _0x30d419;var _0x2d1f97;return db['User']['findOne']({'where':{'id':_0x70c720[_0xcee9('0x65')]['id']}})[_0xcee9('0x21')](handleEntityNotFound(_0x35f4f1,null))[_0xcee9('0x21')](function(_0x12eaed){if(_0x12eaed){_0x30d419=_0x12eaed;_0x231473[_0xcee9('0x50')]=_[_0xcee9('0x4e')](db[_0xcee9('0xd2')][_0xcee9('0x48')]);_0x231473[_0xcee9('0x4d')]=_[_0xcee9('0x4e')](_0x70c720[_0xcee9('0x4d')]);_0x231473['filters']=_['intersection'](_0x231473['model'],_0x231473[_0xcee9('0x4d')]);_0x1344f5['attributes']=_[_0xcee9('0x52')](_0x231473[_0xcee9('0x50')],qs[_0xcee9('0x53')](_0x70c720[_0xcee9('0x4d')][_0xcee9('0x53')]));_0x1344f5['attributes']=_0x1344f5[_0xcee9('0x51')][_0xcee9('0x54')]?_0x1344f5[_0xcee9('0x51')]:_0x231473[_0xcee9('0x50')];_0x1344f5[_0xcee9('0xc6')]=qs[_0xcee9('0x57')](_0x70c720['query'][_0xcee9('0x57')]);_0x1344f5['where']=qs[_0xcee9('0x4f')](_[_0xcee9('0x59')](_0x70c720[_0xcee9('0x4d')],_0x231473[_0xcee9('0x4f')]));if(_0x70c720[_0xcee9('0x4d')][_0xcee9('0x3d')]){_0x1344f5['where']=_['merge'](_0x1344f5[_0xcee9('0x58')],{'$or':_[_0xcee9('0x3f')](_0x1344f5[_0xcee9('0x51')],function(_0x3b3df5){var _0x5e76a1={};_0x5e76a1[_0x3b3df5]={'$like':'%'+_0x70c720['query']['filter']+'%'};return _0x5e76a1;})});}_0x1344f5=_[_0xcee9('0x5f')]({},_0x1344f5,_0x70c720['options']);return _0x30d419[_0xcee9('0xd1')](_0x1344f5);}})[_0xcee9('0x21')](function(_0x4318c9){if(_0x4318c9){_0x2d1f97=_0x4318c9['length'];if(!_0x70c720[_0xcee9('0x4d')][_0xcee9('0x55')](_0xcee9('0x56'))){_0x1344f5[_0xcee9('0x31')]=qs['limit'](_0x70c720[_0xcee9('0x4d')][_0xcee9('0x31')]);_0x1344f5[_0xcee9('0x30')]=qs[_0xcee9('0x30')](_0x70c720[_0xcee9('0x4d')]['offset']);}return _0x30d419[_0xcee9('0xd1')](_0x1344f5);}})['then'](function(_0x2769c4){if(_0x2769c4){return _0x2769c4?{'count':_0x2d1f97,'rows':_0x2769c4}:null;}})[_0xcee9('0x21')](respondWithResult(_0x35f4f1,null))[_0xcee9('0x2b')](handleError(_0x35f4f1,null));};exports['getOpenchannelInteractions']=function(_0x44a04b,_0x4eff5f,_0x1971a2){var _0x3dcbb8={};var _0x11b207={};var _0x15fbe2;var _0xef53b8;return db['User'][_0xcee9('0x95')]({'where':{'id':_0x44a04b[_0xcee9('0x65')]['id']}})[_0xcee9('0x21')](handleEntityNotFound(_0x4eff5f,null))[_0xcee9('0x21')](function(_0x93b0c9){if(_0x93b0c9){_0x15fbe2=_0x93b0c9;_0x11b207[_0xcee9('0x50')]=_[_0xcee9('0x4e')](db[_0xcee9('0xd3')][_0xcee9('0x48')]);_0x11b207[_0xcee9('0x4d')]=_['keys'](_0x44a04b[_0xcee9('0x4d')]);_0x11b207[_0xcee9('0x4f')]=_['intersection'](_0x11b207[_0xcee9('0x50')],_0x11b207[_0xcee9('0x4d')]);_0x3dcbb8['attributes']=_[_0xcee9('0x52')](_0x11b207['model'],qs[_0xcee9('0x53')](_0x44a04b[_0xcee9('0x4d')][_0xcee9('0x53')]));_0x3dcbb8['attributes']=_0x3dcbb8['attributes'][_0xcee9('0x54')]?_0x3dcbb8[_0xcee9('0x51')]:_0x11b207[_0xcee9('0x50')];_0x3dcbb8[_0xcee9('0xc6')]=qs[_0xcee9('0x57')](_0x44a04b[_0xcee9('0x4d')][_0xcee9('0x57')]);_0x3dcbb8[_0xcee9('0x58')]=qs[_0xcee9('0x4f')](_[_0xcee9('0x59')](_0x44a04b[_0xcee9('0x4d')],_0x11b207[_0xcee9('0x4f')]));if(_0x44a04b[_0xcee9('0x4d')]['filter']){_0x3dcbb8[_0xcee9('0x58')]=_[_0xcee9('0x5f')](_0x3dcbb8[_0xcee9('0x58')],{'$or':_[_0xcee9('0x3f')](_0x3dcbb8[_0xcee9('0x51')],function(_0x1c9931){var _0x3a3c63={};_0x3a3c63[_0x1c9931]={'$like':'%'+_0x44a04b[_0xcee9('0x4d')][_0xcee9('0x3d')]+'%'};return _0x3a3c63;})});}_0x3dcbb8=_[_0xcee9('0x5f')]({},_0x3dcbb8,_0x44a04b[_0xcee9('0x60')]);return _0x15fbe2[_0xcee9('0xd4')](_0x3dcbb8);}})[_0xcee9('0x21')](function(_0x54c977){if(_0x54c977){_0xef53b8=_0x54c977['length'];if(!_0x44a04b[_0xcee9('0x4d')]['hasOwnProperty']('nolimit')){_0x3dcbb8[_0xcee9('0x31')]=qs[_0xcee9('0x31')](_0x44a04b['query']['limit']);_0x3dcbb8[_0xcee9('0x30')]=qs[_0xcee9('0x30')](_0x44a04b[_0xcee9('0x4d')][_0xcee9('0x30')]);}return _0x15fbe2[_0xcee9('0xd4')](_0x3dcbb8);}})[_0xcee9('0x21')](function(_0x5f1d82){if(_0x5f1d82){return _0x5f1d82?{'count':_0xef53b8,'rows':_0x5f1d82}:null;}})[_0xcee9('0x21')](respondWithResult(_0x4eff5f,null))[_0xcee9('0x2b')](handleError(_0x4eff5f,null));};exports['getMailInteractions']=function(_0x6d2900,_0x40c3e1,_0x545f36){var _0xed3779={'raw':!![],'where':{}};var _0x4b25ea={};var _0x3a8545={'count':0x0,'rows':[]};return db[_0xcee9('0x61')]['findOne']({'where':{'id':_0x6d2900[_0xcee9('0x65')]['id']}})[_0xcee9('0x21')](handleEntityNotFound(_0x40c3e1,null))[_0xcee9('0x21')](function(_0x28ea9b){if(_0x28ea9b){_0x4b25ea[_0xcee9('0x50')]=_[_0xcee9('0x4e')](db['MailInteraction']['rawAttributes']);_0x4b25ea[_0xcee9('0x4d')]=_[_0xcee9('0x4e')](_0x6d2900[_0xcee9('0x4d')]);_0x4b25ea[_0xcee9('0x4f')]=_[_0xcee9('0x52')](_0x4b25ea['model'],_0x4b25ea[_0xcee9('0x4d')]);_0xed3779[_0xcee9('0x51')]=_[_0xcee9('0x52')](_0x4b25ea[_0xcee9('0x50')],qs[_0xcee9('0x53')](_0x6d2900[_0xcee9('0x4d')][_0xcee9('0x53')]));_0xed3779[_0xcee9('0x51')]=_0xed3779[_0xcee9('0x51')][_0xcee9('0x54')]?_0xed3779['attributes']:_0x4b25ea['model'];if(!_0x6d2900[_0xcee9('0x4d')]['hasOwnProperty'](_0xcee9('0x56'))){_0xed3779[_0xcee9('0x31')]=qs['limit'](_0x6d2900[_0xcee9('0x4d')][_0xcee9('0x31')]);_0xed3779[_0xcee9('0x30')]=qs['offset'](_0x6d2900[_0xcee9('0x4d')]['offset']);}_0xed3779[_0xcee9('0xc6')]=qs[_0xcee9('0x57')](_0x6d2900[_0xcee9('0x4d')]['sort']);_0xed3779[_0xcee9('0x58')]=qs[_0xcee9('0x4f')](_[_0xcee9('0x59')](_0x6d2900[_0xcee9('0x4d')],_0x4b25ea[_0xcee9('0x4f')]));_0xed3779[_0xcee9('0x58')][_0xcee9('0xcd')]=_0x28ea9b['id'];if(_0x6d2900[_0xcee9('0x4d')][_0xcee9('0x3d')]){_0xed3779[_0xcee9('0x58')]=_['merge'](_0xed3779['where'],{'$or':_[_0xcee9('0x3f')](_0xed3779[_0xcee9('0x51')],function(_0x28663a){var _0x2ac310={};_0x2ac310[_0x28663a]={'$like':'%'+_0x6d2900[_0xcee9('0x4d')]['filter']+'%'};return _0x2ac310;})});}_0xed3779=_['merge']({},_0xed3779,_0x6d2900[_0xcee9('0x60')]);return db[_0xcee9('0xd5')][_0xcee9('0x2f')]({'where':_0xed3779[_0xcee9('0x58')]})[_0xcee9('0x21')](function(_0x429193){_0x3a8545[_0xcee9('0x2f')]=_0x429193;if(_0x6d2900['query'][_0xcee9('0x62')]){_0xed3779[_0xcee9('0x67')]=[{'all':!![]}];}return db[_0xcee9('0xd5')][_0xcee9('0x63')](_0xed3779);})[_0xcee9('0x21')](function(_0x2cefa9){_0x3a8545[_0xcee9('0xce')]=_0x2cefa9;return _0x3a8545;});}})['then'](respondWithFilteredResult(_0x40c3e1,_0xed3779))[_0xcee9('0x2b')](handleError(_0x40c3e1,null));};exports[_0xcee9('0xd6')]=function(_0x543821,_0x370b5f,_0x182696){var _0x42cf50={};var _0x75ff66={};var _0xcb0bcd;var _0x24b64a;return db['User'][_0xcee9('0x95')]({'where':{'id':_0x543821[_0xcee9('0x65')]['id']}})[_0xcee9('0x21')](handleEntityNotFound(_0x370b5f,null))[_0xcee9('0x21')](function(_0x2a640b){if(_0x2a640b){_0xcb0bcd=_0x2a640b;_0x75ff66['model']=_['keys'](db[_0xcee9('0xd7')][_0xcee9('0x48')]);_0x75ff66[_0xcee9('0x4d')]=_[_0xcee9('0x4e')](_0x543821[_0xcee9('0x4d')]);_0x75ff66[_0xcee9('0x4f')]=_['intersection'](_0x75ff66[_0xcee9('0x50')],_0x75ff66[_0xcee9('0x4d')]);_0x42cf50[_0xcee9('0x51')]=_[_0xcee9('0x52')](_0x75ff66['model'],qs[_0xcee9('0x53')](_0x543821[_0xcee9('0x4d')][_0xcee9('0x53')]));_0x42cf50['attributes']=_0x42cf50[_0xcee9('0x51')]['length']?_0x42cf50['attributes']:_0x75ff66[_0xcee9('0x50')];_0x42cf50[_0xcee9('0xc6')]=qs[_0xcee9('0x57')](_0x543821[_0xcee9('0x4d')][_0xcee9('0x57')]);_0x42cf50['where']=qs[_0xcee9('0x4f')](_[_0xcee9('0x59')](_0x543821[_0xcee9('0x4d')],_0x75ff66[_0xcee9('0x4f')]));if(_0x543821[_0xcee9('0x4d')][_0xcee9('0x3d')]){_0x42cf50[_0xcee9('0x58')]=_['merge'](_0x42cf50[_0xcee9('0x58')],{'$or':_[_0xcee9('0x3f')](_0x42cf50[_0xcee9('0x51')],function(_0x2680dc){var _0x1ddd1d={};_0x1ddd1d[_0x2680dc]={'$like':'%'+_0x543821[_0xcee9('0x4d')][_0xcee9('0x3d')]+'%'};return _0x1ddd1d;})});}_0x42cf50=_['merge']({},_0x42cf50,_0x543821[_0xcee9('0x60')]);return _0xcb0bcd[_0xcee9('0xd6')](_0x42cf50);}})[_0xcee9('0x21')](function(_0x2b38f6){if(_0x2b38f6){_0x24b64a=_0x2b38f6[_0xcee9('0x54')];if(!_0x543821[_0xcee9('0x4d')][_0xcee9('0x55')](_0xcee9('0x56'))){_0x42cf50[_0xcee9('0x31')]=qs[_0xcee9('0x31')](_0x543821['query'][_0xcee9('0x31')]);_0x42cf50[_0xcee9('0x30')]=qs['offset'](_0x543821[_0xcee9('0x4d')][_0xcee9('0x30')]);}return _0xcb0bcd['getSmsInteractions'](_0x42cf50);}})[_0xcee9('0x21')](function(_0x5f103c){if(_0x5f103c){return _0x5f103c?{'count':_0x24b64a,'rows':_0x5f103c}:null;}})[_0xcee9('0x21')](respondWithResult(_0x370b5f,null))[_0xcee9('0x2b')](handleError(_0x370b5f,null));};exports[_0xcee9('0xd8')]=function(_0x5784eb,_0x9417fc,_0x3efe6f){var _0x415c11={};var _0x395da2={};var _0x220298;var _0xa15754;return db['User'][_0xcee9('0x95')]({'where':{'id':_0x5784eb[_0xcee9('0x65')]['id']}})[_0xcee9('0x21')](handleEntityNotFound(_0x9417fc,null))[_0xcee9('0x21')](function(_0x5cb5fd){if(_0x5cb5fd){_0x220298=_0x5cb5fd;_0x395da2['model']=_['keys'](db[_0xcee9('0xd9')][_0xcee9('0x48')]);_0x395da2['query']=_[_0xcee9('0x4e')](_0x5784eb['query']);_0x395da2[_0xcee9('0x4f')]=_[_0xcee9('0x52')](_0x395da2[_0xcee9('0x50')],_0x395da2['query']);_0x415c11[_0xcee9('0x51')]=_[_0xcee9('0x52')](_0x395da2['model'],qs['fields'](_0x5784eb[_0xcee9('0x4d')][_0xcee9('0x53')]));_0x415c11[_0xcee9('0x51')]=_0x415c11[_0xcee9('0x51')][_0xcee9('0x54')]?_0x415c11[_0xcee9('0x51')]:_0x395da2[_0xcee9('0x50')];_0x415c11[_0xcee9('0xc6')]=qs[_0xcee9('0x57')](_0x5784eb[_0xcee9('0x4d')][_0xcee9('0x57')]);_0x415c11[_0xcee9('0x58')]=qs[_0xcee9('0x4f')](_[_0xcee9('0x59')](_0x5784eb[_0xcee9('0x4d')],_0x395da2['filters']));if(_0x5784eb[_0xcee9('0x4d')]['filter']){_0x415c11[_0xcee9('0x58')]=_[_0xcee9('0x5f')](_0x415c11['where'],{'$or':_['map'](_0x415c11[_0xcee9('0x51')],function(_0x2d85a2){var _0xea7549={};_0xea7549[_0x2d85a2]={'$like':'%'+_0x5784eb[_0xcee9('0x4d')][_0xcee9('0x3d')]+'%'};return _0xea7549;})});}_0x415c11=_[_0xcee9('0x5f')]({},_0x415c11,_0x5784eb[_0xcee9('0x60')]);return _0x220298[_0xcee9('0xd8')](_0x415c11);}})[_0xcee9('0x21')](function(_0x1691a7){if(_0x1691a7){_0xa15754=_0x1691a7['length'];if(!_0x5784eb['query'][_0xcee9('0x55')](_0xcee9('0x56'))){_0x415c11[_0xcee9('0x31')]=qs[_0xcee9('0x31')](_0x5784eb[_0xcee9('0x4d')]['limit']);_0x415c11[_0xcee9('0x30')]=qs[_0xcee9('0x30')](_0x5784eb[_0xcee9('0x4d')][_0xcee9('0x30')]);}return _0x220298[_0xcee9('0xd8')](_0x415c11);}})[_0xcee9('0x21')](function(_0x1cdbda){if(_0x1cdbda){return _0x1cdbda?{'count':_0xa15754,'rows':_0x1cdbda}:null;}})['then'](respondWithResult(_0x9417fc,null))[_0xcee9('0x2b')](handleError(_0x9417fc,null));};exports['login']=function(_0x1dc6db,_0x2cd563,_0x137a1a){var _0x3fec39;var _0xbbf8b3;var _0x5627f1;var _0x16db87=!_[_0xcee9('0x74')](_0x1dc6db[_0xcee9('0x65')]['id'])?_0x1dc6db['params']['id']:!_[_0xcee9('0x74')](_0x1dc6db['user']['id'])?_0x1dc6db['user']['id']:null;return db[_0xcee9('0x61')]['find']({'where':{'id':_0x16db87,'role':{'$or':['admin',_0xcee9('0x70'),'agent']}},'attributes':['id',_0xcee9('0x45'),'phone','mobile',_0xcee9('0x41'),_0xcee9('0x79'),_0xcee9('0xda')]})[_0xcee9('0x21')](function(_0x3e7dea){if(_0x3e7dea){if(_0x3e7dea[_0xcee9('0x41')]===_0xcee9('0x3b')){_0x3fec39=_0x3e7dea;if(_0x1dc6db[_0xcee9('0x69')][_0xcee9('0xa1')]){_0x5627f1=util['format']('LOCAL/%s@from-sip/n',_0x3fec39[_0x1dc6db[_0xcee9('0x69')][_0xcee9('0xa1')]]);}else if(_0x1dc6db['body'][_0xcee9('0xdb')]){_0x5627f1=util[_0xcee9('0x76')](_0xcee9('0xae'),_0x1dc6db['body'][_0xcee9('0xdb')]);}else{_0x5627f1=util[_0xcee9('0x76')]('SIP/%s',_0x3fec39[_0xcee9('0x45')]);}socket['to'](util[_0xcee9('0x76')]('user:%s',_0x3fec39['name']))[_0xcee9('0xb3')]('user:forcelogout',{'ip':_0x1dc6db[_0xcee9('0xdc')][_0xcee9('0xdd')]||_0x1dc6db[_0xcee9('0xde')][_0xcee9('0xdf')]||_0x1dc6db['socket'][_0xcee9('0xdf')]||_0x1dc6db[_0xcee9('0xde')][_0xcee9('0xe0')][_0xcee9('0xdf')]});return db['UserVoiceQueueRt'][_0xcee9('0x38')]({'where':{'membername':_0x3fec39[_0xcee9('0x45')]},'individualHooks':!![]});}}else{throw new db[(_0xcee9('0x1d'))][(_0xcee9('0x1e'))](_0xcee9('0xe1'));}})[_0xcee9('0x21')](function(){if(_0x3fec39){return _0x3fec39[_0xcee9('0xe2')]({'raw':!![]});}})[_0xcee9('0x21')](function(_0x95ca52){if(_0x3fec39){var _0x11dedc=[];if(_0x95ca52){_0xbbf8b3=_0x95ca52;if(_0xbbf8b3[_0xcee9('0x54')]){for(var _0x43ac14=0x0;_0x43ac14<_0xbbf8b3[_0xcee9('0x54')];_0x43ac14++){_0x11dedc[_0xcee9('0xad')]({'membername':_0x3fec39[_0xcee9('0x45')],'UserId':_0x3fec39['id'],'queue_name':_0xbbf8b3[_0x43ac14][_0xcee9('0x45')],'VoiceQueueId':_0xbbf8b3[_0x43ac14]['id'],'interface':_0x5627f1,'paused':_0x3fec39[_0xcee9('0xda')]||![],'penalty':_0xbbf8b3[_0x43ac14][_0xcee9('0xe3')]||0x0});}return BPromise['each'](_0x11dedc,function(_0x21735a){return db[_0xcee9('0xb4')][_0xcee9('0xe4')](_0x21735a);});}}}})[_0xcee9('0x21')](function(){if(_0x3fec39){return db[_0xcee9('0xe5')][_0xcee9('0x63')]({'where':{'membername':_0x3fec39[_0xcee9('0x45')],'exitAt':null}});}})['then'](function(_0x4c70ab){if(_0x3fec39){var _0x3fec58=[];_0x4c70ab['forEach'](function(_0x21b690){_0x3fec58['push'](_0x21b690['update']({'exitAt':moment()['format'](_0xcee9('0xe6'))}));});return BPromise[_0xcee9('0xe7')](_0x3fec58);}})[_0xcee9('0x21')](function(){if(_0x3fec39){var _0x7f4e5b=[];var _0x2a2ccb=[];var _0x1a826a=utils[_0xcee9('0xe8')]();var _0x2fd440={'membername':_0x3fec39['name'],'interface':_0x5627f1,'enterAt':moment()[_0xcee9('0x76')]('YYYY-MM-DD\x20HH:mm:ss'),'role':_0x3fec39[_0xcee9('0x41')],'internal':_0x3fec39[_0xcee9('0x79')]};_0x1a826a['forEach'](function(_0x5ca10b){_0x7f4e5b[_0xcee9('0xad')](_[_0xcee9('0x5f')]({'channel':_0x5ca10b,'type':_0xcee9('0xe9'),'data1':_0x1dc6db[_0xcee9('0x69')][_0xcee9('0xea')],'data2':_0x5627f1},_0x2fd440));if(_0x3fec39['loginInPause']){_0x2a2ccb['push'](_[_0xcee9('0x5f')]({'channel':_0x5ca10b,'type':_0xcee9('0xeb'),'data1':_0xcee9('0xec')},_0x2fd440));}});return db['MemberReport'][_0xcee9('0x68')](_0x7f4e5b['concat'](_0x2a2ccb),{'individualHooks':!![]});}})[_0xcee9('0x21')](function(){if(_0x3fec39){return _0x3fec39[_0xcee9('0x37')]({'online':!![],'lastLoginAt':moment()[_0xcee9('0x76')](_0xcee9('0xe6')),'voicePause':_0x3fec39[_0xcee9('0xda')]||![],'mailPause':_0x3fec39[_0xcee9('0xda')]||![],'chatPause':_0x3fec39[_0xcee9('0xda')]||![],'faxPause':_0x3fec39[_0xcee9('0xda')]||![],'smsPause':_0x3fec39[_0xcee9('0xda')]||![],'openchannelPause':_0x3fec39[_0xcee9('0xda')]||![],'pauseType':_0x3fec39[_0xcee9('0xda')]?_0xcee9('0xec'):null,'interface':_0x5627f1,'lastPauseAt':moment()[_0xcee9('0x76')](_0xcee9('0xe6'))});}})[_0xcee9('0x21')](function(_0x40b33f){if(_0x1dc6db[_0xcee9('0xed')]){return _0x137a1a();}else{return BPromise[_0xcee9('0xee')](_0x40b33f)[_0xcee9('0x21')](respondWithResult(_0x2cd563,null));}})[_0xcee9('0x2b')](handleError(_0x2cd563,null));};exports[_0xcee9('0xef')]=function(_0x18d22d,_0x48d299,_0xe4878e){var _0x42f11c;return db[_0xcee9('0x61')][_0xcee9('0x42')]({'where':{'id':_0x18d22d[_0xcee9('0x65')]['id'],'role':_0xcee9('0x3b')},'attributes':['id',_0xcee9('0x45'),_0xcee9('0x41')]})['then'](handleEntityNotFound(_0x48d299,null))['then'](function(_0x132865){if(_0x132865){_0x42f11c=_0x132865;return db[_0xcee9('0xb4')][_0xcee9('0x38')]({'where':{'membername':_0x42f11c[_0xcee9('0x45')]},'individualHooks':!![]});}})[_0xcee9('0x21')](function(){return db['MemberReport'][_0xcee9('0x63')]({'where':{'membername':_0x42f11c[_0xcee9('0x45')],'exitAt':null}});})['then'](function(_0xe50e1){var _0x23882c=[];_0xe50e1[_0xcee9('0xf0')](function(_0x10c216){_0x23882c[_0xcee9('0xad')](_0x10c216[_0xcee9('0x37')]({'exitAt':moment()[_0xcee9('0x76')](_0xcee9('0xe6'))}));});return BPromise['all'](_0x23882c);})[_0xcee9('0x21')](function(){return _0x42f11c[_0xcee9('0x37')]({'online':![],'lastLoginAt':null,'voicePause':![],'mailPause':![],'chatPause':![],'faxPause':![],'smsPause':![],'openchannelPause':![],'interface':null});})[_0xcee9('0x21')](respondWithResult(_0x48d299,null))[_0xcee9('0x2b')](handleError(_0x48d299,null));};exports[_0xcee9('0xf1')]=function(_0x4cc45c,_0x120c8b,_0x40f44e){var _0x57f67f;return db['UserVoiceQueueRt'][_0xcee9('0x37')]({'paused':0x1},{'where':{'UserId':_0x4cc45c[_0xcee9('0x65')]['id']},'individualHooks':!![]})[_0xcee9('0x21')](function(){return db[_0xcee9('0x61')][_0xcee9('0x42')]({'where':{'id':_0x4cc45c['params']['id'],'role':'agent'},'attributes':['id',_0xcee9('0x45'),_0xcee9('0x41'),_0xcee9('0x79'),_0xcee9('0xa1')]});})[_0xcee9('0x21')](handleEntityNotFound(_0x120c8b,null))[_0xcee9('0x21')](function(_0x409cad){if(_0x409cad){_0x57f67f=_0x409cad;return respondWithRpcPromise(_0xcee9('0xf2'),_0xcee9('0xf1'),{'id':_0x57f67f['id'],'name':_0x57f67f[_0xcee9('0x45')],'pause':!![]});}})['then'](function(){if(_0x57f67f){return db['MemberReport'][_0xcee9('0x63')]({'where':{'membername':_0x57f67f[_0xcee9('0x45')],'type':_0xcee9('0xeb'),'exitAt':null}});}})[_0xcee9('0x21')](function(_0x587613){if(_0x587613[_0xcee9('0x54')]){var _0x367c3=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');for(var _0x4ec103=0x0,_0xe824a0=_0x587613[_0xcee9('0x54')];_0x4ec103<_0xe824a0;_0x4ec103++){_0x587613[_0x4ec103][_0xcee9('0xf3')]({'exitAt':_0x367c3});}}})[_0xcee9('0x21')](function(){var _0x226ecf=[];var _0x242655=utils['getChannels']();_0x242655[_0xcee9('0xf0')](function(_0x46848f){_0x226ecf[_0xcee9('0xad')]({'channel':_0x46848f,'membername':_0x57f67f[_0xcee9('0x45')],'interface':_[_0xcee9('0x74')](_0x57f67f[_0xcee9('0xa1')])?util['format']('SIP/%s',_0x57f67f[_0xcee9('0x45')]):_0x57f67f[_0xcee9('0xa1')],'type':_0xcee9('0xeb'),'enterAt':moment()[_0xcee9('0x76')]('YYYY-MM-DD\x20HH:mm:ss'),'data1':_0x4cc45c['body'][_0xcee9('0x5a')]||'DEFAULT\x20PAUSE','role':_0x57f67f[_0xcee9('0x41')],'internal':_0x57f67f[_0xcee9('0x79')]});});return db[_0xcee9('0xe5')]['bulkCreate'](_0x226ecf,{'individualHooks':!![]});})[_0xcee9('0x21')](function(){return _0x57f67f[_0xcee9('0x37')]({'voicePause':!![],'mailPause':!![],'chatPause':!![],'faxPause':!![],'smsPause':!![],'openchannelPause':!![],'pauseType':_0x4cc45c['body'][_0xcee9('0x5a')]||_0xcee9('0xf4'),'lastPauseAt':moment()[_0xcee9('0x76')]('YYYY-MM-DD\x20HH:mm:ss')});})[_0xcee9('0x21')](respondWithResult(_0x120c8b,null))[_0xcee9('0x2b')](handleError(_0x120c8b,null));};exports['unpause']=function(_0x4dde7d,_0x1a3eba,_0x399456){var _0x508ba0;return db[_0xcee9('0x61')]['find']({'where':{'id':_0x4dde7d['params']['id']},'attributes':['id','name',_0xcee9('0x41'),'voicePause','mailPause',_0xcee9('0xf5'),_0xcee9('0xf6'),'openchannelPause','smsPause','pauseType',_0xcee9('0xf7')]})[_0xcee9('0x21')](handleEntityNotFound(_0x1a3eba,null))[_0xcee9('0x21')](function(_0x1ae53c){if(_0x1ae53c){_0x508ba0=_0x1ae53c;if(_0x4dde7d[_0xcee9('0x69')][_0xcee9('0x9e')]&&!utils[_0xcee9('0xa2')](_0x4dde7d[_0xcee9('0x69')][_0xcee9('0x9e')])){throw new db['Sequelize'][(_0xcee9('0x1e'))](_0xcee9('0xa3'));}switch(_0x4dde7d[_0xcee9('0x69')][_0xcee9('0x9e')]){case'voice':return respondWithRpcPromise(_0xcee9('0xf2'),'unpause',{'id':_0x508ba0['id'],'name':_0x508ba0['name'],'pause':![]})[_0xcee9('0x21')](function(){return db[_0xcee9('0xb4')]['update']({'paused':0x0},{'where':{'UserId':_0x508ba0['id']},'individualHooks':!![]});})['then'](function(){return db['MemberReport'][_0xcee9('0x42')]({'where':{'channel':_0x4dde7d['body'][_0xcee9('0x9e')],'membername':_0x508ba0[_0xcee9('0x45')],'type':'PAUSE','exitAt':null}});})['then'](function(_0x139241){if(_0x139241){return _0x139241[_0xcee9('0x37')]({'exitAt':moment()['format']('YYYY-MM-DD\x20HH:mm:ss'),'data2':_0xcee9('0xf8')},{'individualHooks':!![]});}return null;})[_0xcee9('0x21')](function(){return _0x508ba0[_0xcee9('0x37')]({'voicePause':![]});});case'mail':case _0xcee9('0xf9'):case _0xcee9('0xfa'):case _0xcee9('0xfb'):case _0xcee9('0xfc'):return db[_0xcee9('0xe5')][_0xcee9('0x42')]({'where':{'channel':_0x4dde7d['body'][_0xcee9('0x9e')],'membername':_0x508ba0[_0xcee9('0x45')],'type':_0xcee9('0xeb'),'exitAt':null}})[_0xcee9('0x21')](function(_0x3ce835){if(_0x3ce835){return _0x3ce835[_0xcee9('0x37')]({'exitAt':moment()[_0xcee9('0x76')](_0xcee9('0xe6')),'data2':_0xcee9('0xf8')},{'individualHooks':!![]});}return null;})[_0xcee9('0x21')](function(){var _0x4ee33b={};_['set'](_0x4ee33b,util[_0xcee9('0x76')](_0xcee9('0xfd'),_0x4dde7d[_0xcee9('0x69')]['channel'],'Pause'),![]);return _0x508ba0[_0xcee9('0x37')](_0x4ee33b);});default:return respondWithRpcPromise(_0xcee9('0xf2'),_0xcee9('0xfe'),{'id':_0x508ba0['id'],'name':_0x508ba0[_0xcee9('0x45')],'pause':![]})[_0xcee9('0x21')](function(){return db[_0xcee9('0xb4')][_0xcee9('0x37')]({'paused':0x0},{'where':{'UserId':_0x508ba0['id']}});})[_0xcee9('0x21')](function(){return db[_0xcee9('0xe5')][_0xcee9('0x63')]({'where':{'membername':_0x508ba0[_0xcee9('0x45')],'type':'PAUSE','exitAt':null}});})[_0xcee9('0x21')](function(_0x284ccf){var _0x434ee6=[];_0x284ccf['forEach'](function(_0x3b5d29){_0x434ee6['push'](_0x3b5d29[_0xcee9('0x37')]({'exitAt':moment()['format'](_0xcee9('0xe6')),'data2':_0xcee9('0xf8')}));});return BPromise['all'](_0x434ee6);})[_0xcee9('0x21')](function(){return _0x508ba0[_0xcee9('0x37')]({'voicePause':![],'mailPause':![],'chatPause':![],'faxPause':![],'smsPause':![],'openchannelPause':![]});});}}})['then'](respondWithResult(_0x1a3eba,null))[_0xcee9('0x2b')](handleError(_0x1a3eba,null));};exports[_0xcee9('0xff')]=function(_0x2889d8,_0x52c1c4,_0x5e58ce){var _0x51ed41={};var _0x2b9a9b={};var _0x4278be;var _0x1bccb2;return db[_0xcee9('0x61')][_0xcee9('0x95')]({'where':{'id':_0x2889d8['params']['id']}})[_0xcee9('0x21')](handleEntityNotFound(_0x52c1c4,null))[_0xcee9('0x21')](function(_0x45550e){if(_0x45550e){_0x4278be=_0x45550e;_0x2b9a9b[_0xcee9('0x50')]=_[_0xcee9('0x4e')](db[_0xcee9('0x100')]['rawAttributes']);_0x2b9a9b['query']=_[_0xcee9('0x4e')](_0x2889d8['query']);_0x2b9a9b[_0xcee9('0x4f')]=_[_0xcee9('0x52')](_0x2b9a9b[_0xcee9('0x50')],_0x2b9a9b[_0xcee9('0x4d')]);_0x51ed41['attributes']=_[_0xcee9('0x52')](_0x2b9a9b[_0xcee9('0x50')],qs[_0xcee9('0x53')](_0x2889d8[_0xcee9('0x4d')]['fields']));_0x51ed41[_0xcee9('0x51')]=_0x51ed41[_0xcee9('0x51')]['length']?_0x51ed41['attributes']:_0x2b9a9b[_0xcee9('0x50')];_0x51ed41[_0xcee9('0xc6')]=qs['sort'](_0x2889d8[_0xcee9('0x4d')]['sort']);_0x51ed41[_0xcee9('0x58')]=qs[_0xcee9('0x4f')](_[_0xcee9('0x59')](_0x2889d8[_0xcee9('0x4d')],_0x2b9a9b[_0xcee9('0x4f')]));if(_0x2889d8[_0xcee9('0x4d')][_0xcee9('0x3d')]){_0x51ed41[_0xcee9('0x58')]=_['merge'](_0x51ed41['where'],{'$or':_[_0xcee9('0x3f')](_0x51ed41[_0xcee9('0x51')],function(_0x458c4b){var _0x5e0701={};_0x5e0701[_0x458c4b]={'$like':'%'+_0x2889d8[_0xcee9('0x4d')][_0xcee9('0x3d')]+'%'};return _0x5e0701;})});}_0x51ed41=_[_0xcee9('0x5f')]({},_0x51ed41,_0x2889d8['options']);return _0x4278be[_0xcee9('0xff')](_0x51ed41);}})[_0xcee9('0x21')](function(_0x31afd3){if(_0x31afd3){_0x1bccb2=_0x31afd3['length'];if(!_0x2889d8['query'][_0xcee9('0x55')](_0xcee9('0x56'))){_0x51ed41[_0xcee9('0x31')]=qs[_0xcee9('0x31')](_0x2889d8[_0xcee9('0x4d')][_0xcee9('0x31')]);_0x51ed41[_0xcee9('0x30')]=qs[_0xcee9('0x30')](_0x2889d8[_0xcee9('0x4d')][_0xcee9('0x30')]);}return _0x4278be[_0xcee9('0xff')](_0x51ed41);}})['then'](function(_0x214bd5){if(_0x214bd5){return _0x214bd5?{'count':_0x1bccb2,'rows':_0x214bd5}:null;}})['then'](respondWithResult(_0x52c1c4,null))['catch'](handleError(_0x52c1c4,null));};exports[_0xcee9('0x101')]=function(_0x5c2aee,_0x37ece6){return db['User'][_0xcee9('0x42')]({'where':{'id':_0x5c2aee[_0xcee9('0x65')]['id']}})['then'](handleEntityNotFound(_0x37ece6,null))[_0xcee9('0x21')](function(_0x47fc37){if(_0x47fc37){var _0xb30736=_0x47fc37[_0xcee9('0x39')]({'plain':!![]});return _0x47fc37[_0xcee9('0x101')](_0x5c2aee[_0xcee9('0x69')][_0xcee9('0x6c')],_['omit'](_0x5c2aee[_0xcee9('0x69')],[_0xcee9('0x6c'),'id'])||{})['then'](function(){for(var _0x1754cb=0x0;_0x1754cb<_0x5c2aee['body'][_0xcee9('0x6c')][_0xcee9('0x54')];_0x1754cb++){var _0x267fa0=[];db['Team'][_0xcee9('0x95')]({'where':{'id':_0x5c2aee['body'][_0xcee9('0x6c')][_0x1754cb]}})[_0xcee9('0x21')](function(_0x4bec4e){_0x267fa0[_0xcee9('0xad')](_0x4bec4e[_0xcee9('0xe2')]()['then'](function(_0x49ecf2){for(var _0x3b5a67=0x0;_0x3b5a67<_0x49ecf2[_0xcee9('0x54')];_0x3b5a67++){_0x49ecf2[_0x3b5a67][_0xcee9('0x102')](_0xcee9('0x9e'),_0xcee9('0x103'));}return _0x49ecf2;}));_0x267fa0[_0xcee9('0xad')](_0x4bec4e[_0xcee9('0x104')]()['then'](function(_0x5e8dae){for(var _0x271d43=0x0;_0x271d43<_0x5e8dae[_0xcee9('0x54')];_0x271d43++){_0x5e8dae[_0x271d43][_0xcee9('0x102')](_0xcee9('0x9e'),_0xcee9('0x105'));}return _0x5e8dae;}));_0x267fa0['push'](_0x4bec4e[_0xcee9('0x106')]()['then'](function(_0x49c336){for(var _0x441870=0x0;_0x441870<_0x49c336[_0xcee9('0x54')];_0x441870++){_0x49c336[_0x441870][_0xcee9('0x102')](_0xcee9('0x9e'),_0xcee9('0x107'));}return _0x49c336;}));_0x267fa0[_0xcee9('0xad')](_0x4bec4e[_0xcee9('0x108')]()[_0xcee9('0x21')](function(_0x50b3c2){for(var _0x2f4193=0x0;_0x2f4193<_0x50b3c2['length'];_0x2f4193++){_0x50b3c2[_0x2f4193][_0xcee9('0x102')](_0xcee9('0x9e'),'Sms');}return _0x50b3c2;}));_0x267fa0[_0xcee9('0xad')](_0x4bec4e[_0xcee9('0x109')]()[_0xcee9('0x21')](function(_0x2cbfd3){for(var _0x3aac64=0x0;_0x3aac64<_0x2cbfd3[_0xcee9('0x54')];_0x3aac64++){_0x2cbfd3[_0x3aac64][_0xcee9('0x102')]('channel',_0xcee9('0x10a'));}return _0x2cbfd3;}));_0x267fa0[_0xcee9('0xad')](_0x4bec4e[_0xcee9('0x10b')]()[_0xcee9('0x21')](function(_0x2b3e4c){for(var _0x10c2de=0x0;_0x10c2de<_0x2b3e4c['length'];_0x10c2de++){_0x2b3e4c[_0x10c2de][_0xcee9('0x102')](_0xcee9('0x9e'),_0xcee9('0x10c'));}return _0x2b3e4c;}));return BPromise['all'](_0x267fa0);})[_0xcee9('0x21')](function(_0x52f3f2){var _0x3b1019=_[_0xcee9('0x10d')](_0x52f3f2);_0x267fa0=[];return db[_0xcee9('0x5c')][_0xcee9('0x10e')](function(_0x184b23){for(var _0x3e3d44=0x0;_0x3e3d44<_0x3b1019[_0xcee9('0x54')];_0x3e3d44++){_0x267fa0[_0xcee9('0xad')](_0x3b1019[_0x3e3d44]['addAgent'](_0xb30736['id']),{'transaction':_0x184b23});}return BPromise['all'](_0x267fa0)[_0xcee9('0x21')](function(){if(_0xb30736[_0xcee9('0x9f')]){return BPromise['each'](_['filter'](_0x3b1019,function(_0x49e6b3){return _0x49e6b3[_0xcee9('0x10f')](_0xcee9('0x9e'))==='Voice';}),function(_0x43aef1){return db['UserVoiceQueueRt']['upsert']({'membername':_0xb30736[_0xcee9('0x45')],'UserId':_0xb30736['id'],'queue_name':_0x43aef1[_0xcee9('0x45')],'VoiceQueueId':_0x43aef1['id'],'interface':_[_0xcee9('0x74')](_0xb30736['interface'])?util['format'](_0xcee9('0xae'),_0xb30736[_0xcee9('0x45')]):_0xb30736['interface'],'paused':_0xb30736[_0xcee9('0xa0')]||![],'penalty':_0xb30736['penalty']},{'transaction':_0x184b23});});}else{return;}})[_0xcee9('0x21')](function(){for(var _0x9614dc=0x0;_0x9614dc<_0x3b1019[_0xcee9('0x54')];_0x9614dc++){var _0x3d25d6=_0x3b1019[_0x9614dc]['getDataValue'](_0xcee9('0x9e'));var _0x2f670b=_0x3d25d6+'QueueId';socket[_0xcee9('0xb3')]('user'+_0x3d25d6+_0xcee9('0xaa'),{'UserId':_0xb30736['id'],['queueField']:_0x3b1019[_0x9614dc]['id']});}});});});}});}})[_0xcee9('0x21')](respondWithStatusCode(_0x37ece6,null))[_0xcee9('0x2b')](handleError(_0x37ece6,null));};exports[_0xcee9('0x110')]=function(_0x2e069a,_0xf07cbd){return db[_0xcee9('0x61')][_0xcee9('0x95')]({'where':{'id':_0x2e069a[_0xcee9('0x65')]['id']}})['then'](handleEntityNotFound(_0xf07cbd,null))[_0xcee9('0x21')](function(_0x4a3b28){if(_0x4a3b28){var _0x27880c=_0x4a3b28[_0xcee9('0x39')]({'plain':!![]});var _0x181d07=_0x2e069a['query']['ids'];return _0x4a3b28['removeTeams'](_0x181d07)['then'](function(){for(var _0x244f81=0x0;_0x244f81<_0x181d07[_0xcee9('0x54')];_0x244f81++){var _0x35d12a=[];db[_0xcee9('0x100')][_0xcee9('0x95')]({'where':{'id':_0x181d07[_0x244f81]}})[_0xcee9('0x21')](function(_0x30cf85){_0x35d12a[_0xcee9('0xad')](_0x30cf85[_0xcee9('0xe2')]()[_0xcee9('0x21')](function(_0xaa67c8){for(var _0x26f9bb=0x0;_0x26f9bb<_0xaa67c8[_0xcee9('0x54')];_0x26f9bb++){_0xaa67c8[_0x26f9bb]['setDataValue'](_0xcee9('0x9e'),'Voice');}return _0xaa67c8;}));_0x35d12a[_0xcee9('0xad')](_0x30cf85[_0xcee9('0x104')]()[_0xcee9('0x21')](function(_0x1adc68){for(var _0x4af413=0x0;_0x4af413<_0x1adc68[_0xcee9('0x54')];_0x4af413++){_0x1adc68[_0x4af413]['setDataValue']('channel',_0xcee9('0x105'));}return _0x1adc68;}));_0x35d12a[_0xcee9('0xad')](_0x30cf85[_0xcee9('0x106')]()[_0xcee9('0x21')](function(_0x9f13ed){for(var _0x1d53a1=0x0;_0x1d53a1<_0x9f13ed[_0xcee9('0x54')];_0x1d53a1++){_0x9f13ed[_0x1d53a1]['setDataValue']('channel',_0xcee9('0x107'));}return _0x9f13ed;}));_0x35d12a[_0xcee9('0xad')](_0x30cf85[_0xcee9('0x108')]()[_0xcee9('0x21')](function(_0x435e5f){for(var _0x53ad1f=0x0;_0x53ad1f<_0x435e5f[_0xcee9('0x54')];_0x53ad1f++){_0x435e5f[_0x53ad1f][_0xcee9('0x102')](_0xcee9('0x9e'),_0xcee9('0x111'));}return _0x435e5f;}));_0x35d12a[_0xcee9('0xad')](_0x30cf85[_0xcee9('0x109')]()['then'](function(_0x54003f){for(var _0x5f0638=0x0;_0x5f0638<_0x54003f[_0xcee9('0x54')];_0x5f0638++){_0x54003f[_0x5f0638][_0xcee9('0x102')](_0xcee9('0x9e'),'Fax');}return _0x54003f;}));_0x35d12a['push'](_0x30cf85[_0xcee9('0x10b')]()['then'](function(_0x3b7018){for(var _0x1284c9=0x0;_0x1284c9<_0x3b7018[_0xcee9('0x54')];_0x1284c9++){_0x3b7018[_0x1284c9]['setDataValue'](_0xcee9('0x9e'),_0xcee9('0x10c'));}return _0x3b7018;}));return BPromise[_0xcee9('0xe7')](_0x35d12a);})[_0xcee9('0x21')](function(_0x39361c){var _0x4f964b=_[_0xcee9('0x10d')](_0x39361c);_0x35d12a=[];return db[_0xcee9('0x5c')]['transaction'](function(_0x1c2e26){for(var _0x58c305=0x0;_0x58c305<_0x4f964b['length'];_0x58c305++){_0x35d12a[_0xcee9('0xad')](_0x4f964b[_0x58c305][_0xcee9('0x112')](_0x27880c['id']),{'transaction':_0x1c2e26});}return BPromise['all'](_0x35d12a)[_0xcee9('0x21')](function(){if(_0x27880c[_0xcee9('0x9f')]){return BPromise[_0xcee9('0xb0')](_[_0xcee9('0x3d')](_0x4f964b,function(_0x2086b8){return _0x2086b8[_0xcee9('0x10f')](_0xcee9('0x9e'))===_0xcee9('0x103');}),function(_0x9b14e5){return db[_0xcee9('0xb4')][_0xcee9('0x38')]({'where':{'VoiceQueueId':_0x9b14e5['id'],'UserId':_0x27880c['id']},'transaction':_0x1c2e26});});}else{return;}})[_0xcee9('0x21')](function(){for(var _0x2ac093=0x0;_0x2ac093<_0x4f964b[_0xcee9('0x54')];_0x2ac093++){var _0x226eb8=_0x4f964b[_0x2ac093][_0xcee9('0x10f')](_0xcee9('0x9e'));var _0x44e6a1=_0x226eb8+_0xcee9('0xa9');socket[_0xcee9('0xb3')](_0xcee9('0x70')+_0x226eb8+_0xcee9('0x113'),{'UserId':_0x27880c['id'],['queueField']:_0x4f964b[_0x2ac093]['id']});}});});});}});}})[_0xcee9('0x21')](respondWithStatusCode(_0xf07cbd,null))[_0xcee9('0x2b')](handleError(_0xf07cbd,null));};exports[_0xcee9('0x114')]=function(_0x315f9e,_0x1e0696,_0x1ab7ce){var _0x223b6c={};var _0x3768df={};var _0x1ca205;var _0x4e5eed;return db['User']['findOne']({'where':{'id':_0x315f9e[_0xcee9('0x65')]['id']}})[_0xcee9('0x21')](handleEntityNotFound(_0x1e0696,null))[_0xcee9('0x21')](function(_0x420bfc){if(_0x420bfc){_0x1ca205=_0x420bfc;_0x3768df[_0xcee9('0x50')]=_[_0xcee9('0x4e')](db[_0xcee9('0x115')][_0xcee9('0x48')]);_0x3768df['query']=_[_0xcee9('0x4e')](_0x315f9e[_0xcee9('0x4d')]);_0x3768df[_0xcee9('0x4f')]=_[_0xcee9('0x52')](_0x3768df['model'],_0x3768df[_0xcee9('0x4d')]);_0x223b6c['attributes']=_['intersection'](_0x3768df[_0xcee9('0x50')],qs[_0xcee9('0x53')](_0x315f9e['query'][_0xcee9('0x53')]));_0x223b6c[_0xcee9('0x51')]=_0x223b6c[_0xcee9('0x51')][_0xcee9('0x54')]?_0x223b6c[_0xcee9('0x51')]:_0x3768df[_0xcee9('0x50')];_0x223b6c[_0xcee9('0xc6')]=qs[_0xcee9('0x57')](_0x315f9e[_0xcee9('0x4d')][_0xcee9('0x57')]);_0x223b6c['where']=qs[_0xcee9('0x4f')](_[_0xcee9('0x59')](_0x315f9e['query'],_0x3768df[_0xcee9('0x4f')]));if(_0x315f9e['query'][_0xcee9('0x3d')]){_0x223b6c[_0xcee9('0x58')]=_['merge'](_0x223b6c[_0xcee9('0x58')],{'$or':_[_0xcee9('0x3f')](_0x223b6c[_0xcee9('0x51')],function(_0x5cf97a){var _0x3e694c={};_0x3e694c[_0x5cf97a]={'$like':'%'+_0x315f9e[_0xcee9('0x4d')][_0xcee9('0x3d')]+'%'};return _0x3e694c;})});}_0x223b6c=_[_0xcee9('0x5f')]({},_0x223b6c,_0x315f9e['options']);return _0x1ca205[_0xcee9('0x114')](_0x223b6c);}})['then'](function(_0x475edd){if(_0x475edd){_0x4e5eed=_0x475edd[_0xcee9('0x54')];if(!_0x315f9e[_0xcee9('0x4d')][_0xcee9('0x55')](_0xcee9('0x56'))){_0x223b6c[_0xcee9('0x31')]=qs[_0xcee9('0x31')](_0x315f9e[_0xcee9('0x4d')][_0xcee9('0x31')]);_0x223b6c[_0xcee9('0x30')]=qs[_0xcee9('0x30')](_0x315f9e['query'][_0xcee9('0x30')]);}return _0x1ca205[_0xcee9('0x114')](_0x223b6c);}})[_0xcee9('0x21')](function(_0xec812e){if(_0xec812e){return _0xec812e?{'count':_0x4e5eed,'rows':_0xec812e}:null;}})['then'](respondWithResult(_0x1e0696,null))[_0xcee9('0x2b')](handleError(_0x1e0696,null));};exports[_0xcee9('0x116')]=function(_0x57790d,_0x2f3f5d,_0x385395){var _0x2064d9={};var _0x52afaf={};var _0x3fc801;var _0x5aafa9;return db[_0xcee9('0x61')][_0xcee9('0x95')]({'where':{'id':_0x57790d[_0xcee9('0x65')]['id']}})[_0xcee9('0x21')](handleEntityNotFound(_0x2f3f5d,null))[_0xcee9('0x21')](function(_0x55df57){if(_0x55df57){_0x3fc801=_0x55df57;_0x52afaf[_0xcee9('0x50')]=_[_0xcee9('0x4e')](db[_0xcee9('0x61')][_0xcee9('0x48')]);_0x52afaf[_0xcee9('0x4d')]=_['keys'](_0x57790d[_0xcee9('0x4d')]);_0x52afaf[_0xcee9('0x4f')]=_['intersection'](_0x52afaf['model'],_0x52afaf[_0xcee9('0x4d')]);_0x2064d9[_0xcee9('0x51')]=_['intersection'](_0x52afaf['model'],qs[_0xcee9('0x53')](_0x57790d[_0xcee9('0x4d')][_0xcee9('0x53')]));_0x2064d9[_0xcee9('0x51')]=_0x2064d9[_0xcee9('0x51')][_0xcee9('0x54')]?_0x2064d9[_0xcee9('0x51')]:_0x52afaf[_0xcee9('0x50')];_0x2064d9['order']=qs[_0xcee9('0x57')](_0x57790d['query']['sort']);_0x2064d9[_0xcee9('0x58')]=qs[_0xcee9('0x4f')](_[_0xcee9('0x59')](_0x57790d[_0xcee9('0x4d')],_0x52afaf['filters']));if(_0x57790d[_0xcee9('0x4d')][_0xcee9('0x3d')]){_0x2064d9[_0xcee9('0x58')]=_[_0xcee9('0x5f')](_0x2064d9[_0xcee9('0x58')],{'$or':_[_0xcee9('0x3f')](_0x2064d9[_0xcee9('0x51')],function(_0x34e609){var _0xa1079b={};_0xa1079b[_0x34e609]={'$like':'%'+_0x57790d[_0xcee9('0x4d')][_0xcee9('0x3d')]+'%'};return _0xa1079b;})});}_0x2064d9[_0xcee9('0x50')]=db['User'];_0x2064d9['as']='Agents';_0x2064d9=_[_0xcee9('0x5f')]({},_0x2064d9,_0x57790d[_0xcee9('0x60')]);return _0x3fc801[_0xcee9('0xe2')]({'include':[_0x2064d9]});}})[_0xcee9('0x21')](function(_0x33c16b){if(_0x33c16b){var _0x7a39b7={},_0x3b3f06=[],_0x3eee6f=0x0;for(var _0x443ec3=0x0;_0x443ec3<_0x33c16b[_0xcee9('0x54')];_0x443ec3+=0x1){for(var _0xd8ef90=0x0,_0x5aeb4a;_0xd8ef90<_0x33c16b[_0x443ec3][_0xcee9('0x3a')]['length'];_0xd8ef90+=0x1){_0x5aeb4a=_0x33c16b[_0x443ec3]['Agents'][_0xd8ef90]['get']({'plain':!![]});_0x7a39b7[_0x5aeb4a['id']]=_0x5aeb4a;}}_0x7a39b7=_[_0xcee9('0x117')](_0x7a39b7);for(var _0x262ed7=qs[_0xcee9('0x30')](_0x57790d[_0xcee9('0x4d')][_0xcee9('0x30')]);_0x262ed7<_0x7a39b7[_0xcee9('0x54')]&&_0x3b3f06['length']=_0x3040d3[_0x0fae('0x55')]){throw new Error(_0x0fae('0x56'));}})[_0x0fae('0x10')](function(){if(_0x35da4a){return db[_0x0fae('0x29')][_0x0fae('0x4c')]({'where':{'membername':_0x35da4a['name']},'individualHooks':!![]});}})['then'](function(){if(_0x35da4a){return _0x35da4a['getVoiceQueues']({'raw':!![]});}})['then'](function(_0x136bfb){if(_0x35da4a){if(_0x136bfb){var _0x424278=[];_0x4593bc=_0x136bfb;if(_0x4593bc[_0x0fae('0x2c')]){for(var _0x132bc0=0x0;_0x132bc0<_0x4593bc[_0x0fae('0x2c')];_0x132bc0++){_0x424278[_0x0fae('0x31')](db[_0x0fae('0x29')]['upsert']({'membername':_0x35da4a[_0x0fae('0x26')],'UserId':_0x35da4a['id'],'queue_name':_0x4593bc[_0x132bc0][_0x0fae('0x26')],'VoiceQueueId':_0x4593bc[_0x132bc0]['id'],'interface':_0x5d9291,'paused':_0x35da4a[_0x0fae('0x57')]||![],'penalty':_0x4593bc[_0x132bc0][_0x0fae('0x58')]||0x0}));}return BPromise[_0x0fae('0x4a')](_0x424278);}}}})[_0x0fae('0x10')](function(){if(_0x35da4a){return db[_0x0fae('0x37')][_0x0fae('0x49')]({'where':{'membername':_0x35da4a[_0x0fae('0x26')],'exitAt':null}});}})[_0x0fae('0x10')](function(_0xc975bb){if(_0x35da4a){if(_0xc975bb&&_0xc975bb[_0x0fae('0x2c')]){var _0x339c5a=[];_0xc975bb[_0x0fae('0x4d')](function(_0x16f095){_0x339c5a['push'](_0x16f095[_0x0fae('0x2a')]({'exitAt':moment()[_0x0fae('0x2d')](_0x0fae('0x2e'))}));});return BPromise[_0x0fae('0x4a')](_0x339c5a);}}})[_0x0fae('0x10')](function(_0x5b5caf){if(_0x35da4a){var _0x462f67=[];var _0x56819c=[];var _0x409f97=utils['getChannels']();var _0x47ce90={'membername':_0x35da4a['name'],'interface':_0x5d9291,'enterAt':moment()[_0x0fae('0x2d')](_0x0fae('0x2e')),'role':_0x35da4a[_0x0fae('0x35')],'internal':_0x35da4a[_0x0fae('0x27')]};_0x409f97[_0x0fae('0x4d')](function(_0x2544d9){_0x462f67[_0x0fae('0x31')](_[_0x0fae('0x59')]({'channel':_0x2544d9,'type':_0x0fae('0x5a'),'data1':_0x0fae('0x5b'),'data2':_0x5d9291},_0x47ce90));if(_0x35da4a['loginInPause']){_0x56819c[_0x0fae('0x31')](_[_0x0fae('0x59')]({'channel':_0x2544d9,'type':'PAUSE','data1':_0x0fae('0x5c')},_0x47ce90));}});return db[_0x0fae('0x37')][_0x0fae('0x38')](_0x462f67[_0x0fae('0x5d')](_0x56819c),{'individualHooks':!![]});}})['then'](function(){if(_0x35da4a){return _0x35da4a[_0x0fae('0x2a')]({'online':!![],'lastLoginAt':moment()['format'](_0x0fae('0x2e')),'voicePause':_0x35da4a['loginInPause']||![],'mailPause':_0x35da4a['loginInPause']||![],'chatPause':_0x35da4a[_0x0fae('0x57')]||![],'faxPause':_0x35da4a[_0x0fae('0x57')]||![],'smsPause':_0x35da4a[_0x0fae('0x57')]||![],'openchannelPause':_0x35da4a[_0x0fae('0x57')]||![],'pauseType':_0x35da4a[_0x0fae('0x57')]?_0x0fae('0x5c'):null,'lastPauseAt':moment()[_0x0fae('0x2d')](_0x0fae('0x2e')),'interface':_0x5d9291});}})[_0x0fae('0x10')](function(_0x1fa685){_0x335ac0(_0x1fa685);})[_0x0fae('0x1a')](function(_0xb9698b){_0x428be5(_0x21e973[_0x0fae('0x17')](0x1f4,_0xb9698b['message']));});});}; \ No newline at end of file +var _0xb43d=['phone','loginInPause','SIP/%s','agent','getLicense','agents','getVoiceQueues','upsert','merge','LOGIN','callysquare','LOGININPAUSE','lodash','util','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','jayson/promise','client','http','defaults','redis','localhost','socket.io-emitter','./user.socket','register','info','User,\x20%s,\x20%s','request\x20sent','debug','User,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','User','findAll','options','raw','where','attributes','limit','include','map','model','then','GetUser','ShowUser','PauseUser','name','internal','interface','UserVoiceQueueRt','MemberReport','PAUSE','length','YYYY-MM-DD\x20HH:mm:ss','updateAttributes','forEach','push','isNil','format','body','type','DEFAULT\x20PAUSE','role','uniqueid','bulkCreate','update','UnpauseUser','findOne','channel','isValidChannel','Unknown\x20channel','mail','fax','sms','openchannel','find','system','set','Pause','LogoutUser','destroy','all'];(function(_0x3edd19,_0x179b2c){var _0x28db2a=function(_0x569fa9){while(--_0x569fa9){_0x3edd19['push'](_0x3edd19['shift']());}};_0x28db2a(++_0x179b2c);}(_0xb43d,0x1c9));var _0xdb43=function(_0x3ea199,_0x30a1d2){_0x3ea199=_0x3ea199-0x0;var _0x3969eb=_0xb43d[_0x3ea199];return _0x3969eb;};'use strict';var _=require(_0xdb43('0x0'));var util=require(_0xdb43('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0xdb43('0x2'));var fs=require('fs');var Redis=require(_0xdb43('0x3'));var db=require(_0xdb43('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0xdb43('0x5'))(_0xdb43('0x6'));var config=require('../../config/environment');var jayson=require(_0xdb43('0x7'));var client=jayson[_0xdb43('0x8')][_0xdb43('0x9')]({'port':0x232a});config['redis']=_[_0xdb43('0xa')](config[_0xdb43('0xb')],{'host':_0xdb43('0xc'),'port':0x18eb});var socket=require(_0xdb43('0xd'))(new Redis(config[_0xdb43('0xb')]));require(_0xdb43('0xe'))[_0xdb43('0xf')](socket);function respondWithRpcPromise(_0x1415aa,_0x26796d,_0x3ad007){return new BPromise(function(_0x2b0baa,_0x447b94){return client['request'](_0x1415aa,_0x3ad007)['then'](function(_0x36bc64){logger[_0xdb43('0x10')](_0xdb43('0x11'),_0x26796d,_0xdb43('0x12'));logger[_0xdb43('0x13')](_0xdb43('0x14'),_0x26796d,_0xdb43('0x12'),JSON[_0xdb43('0x15')](_0x36bc64));if(_0x36bc64[_0xdb43('0x16')]){if(_0x36bc64['error'][_0xdb43('0x17')]===0x1f4){logger['error'](_0xdb43('0x11'),_0x26796d,_0x36bc64[_0xdb43('0x16')][_0xdb43('0x18')]);return _0x447b94(_0x36bc64[_0xdb43('0x16')]['message']);}logger[_0xdb43('0x16')]('User,\x20%s,\x20%s',_0x26796d,_0x36bc64['error']['message']);return _0x2b0baa(_0x36bc64[_0xdb43('0x16')]['message']);}else{logger[_0xdb43('0x10')](_0xdb43('0x11'),_0x26796d,_0xdb43('0x12'));_0x2b0baa(_0x36bc64[_0xdb43('0x19')][_0xdb43('0x18')]);}})[_0xdb43('0x1a')](function(_0x14a1d9){logger[_0xdb43('0x16')](_0xdb43('0x11'),_0x26796d,_0x14a1d9);_0x447b94(_0x14a1d9);});});}exports['GetUser']=function(_0x22c46b){var _0x2b0f33=this;return new Promise(function(_0x3cc45e,_0x4a725e){return db[_0xdb43('0x1b')][_0xdb43('0x1c')]({'raw':_0x22c46b['options']?_0x22c46b[_0xdb43('0x1d')][_0xdb43('0x1e')]===undefined?!![]:![]:!![],'where':_0x22c46b[_0xdb43('0x1d')]?_0x22c46b[_0xdb43('0x1d')][_0xdb43('0x1f')]||null:null,'attributes':_0x22c46b[_0xdb43('0x1d')]?_0x22c46b[_0xdb43('0x1d')][_0xdb43('0x20')]||null:null,'limit':_0x22c46b[_0xdb43('0x1d')]?_0x22c46b[_0xdb43('0x1d')][_0xdb43('0x21')]||null:null,'include':_0x22c46b['options']?_0x22c46b[_0xdb43('0x1d')][_0xdb43('0x22')]?_[_0xdb43('0x23')](_0x22c46b[_0xdb43('0x1d')]['include'],function(_0x4adb7f){return{'model':db[_0x4adb7f['model']],'as':_0x4adb7f['as'],'attributes':_0x4adb7f[_0xdb43('0x20')],'include':_0x4adb7f[_0xdb43('0x22')]?_[_0xdb43('0x23')](_0x4adb7f[_0xdb43('0x22')],function(_0x20ddea){return{'model':db[_0x20ddea[_0xdb43('0x24')]],'as':_0x20ddea['as'],'attributes':_0x20ddea[_0xdb43('0x20')],'include':_0x20ddea[_0xdb43('0x22')]?_['map'](_0x20ddea[_0xdb43('0x22')],function(_0x34d994){return{'model':db[_0x34d994['model']],'as':_0x34d994['as'],'attributes':_0x34d994[_0xdb43('0x20')]};}):[]};}):[]};}):[]:[]})[_0xdb43('0x25')](function(_0x4d52b2){logger[_0xdb43('0x10')](_0xdb43('0x26'),_0x22c46b);logger[_0xdb43('0x13')](_0xdb43('0x26'),_0x22c46b,JSON[_0xdb43('0x15')](_0x4d52b2));_0x3cc45e(_0x4d52b2);})[_0xdb43('0x1a')](function(_0x2cf6ef){logger[_0xdb43('0x16')](_0xdb43('0x26'),_0x2cf6ef['message'],_0x22c46b);_0x4a725e(_0x2b0f33[_0xdb43('0x16')](0x1f4,_0x2cf6ef['message']));});});};exports['ShowUser']=function(_0x4a4c75){var _0x5208ef=this;return new Promise(function(_0x872738,_0x552525){return db[_0xdb43('0x1b')]['find']({'raw':_0x4a4c75[_0xdb43('0x1d')]?_0x4a4c75[_0xdb43('0x1d')][_0xdb43('0x1e')]===undefined?!![]:![]:!![],'where':_0x4a4c75[_0xdb43('0x1d')]?_0x4a4c75[_0xdb43('0x1d')][_0xdb43('0x1f')]||null:null,'attributes':_0x4a4c75['options']?_0x4a4c75['options']['attributes']||null:null,'include':_0x4a4c75[_0xdb43('0x1d')]?_0x4a4c75[_0xdb43('0x1d')]['include']?_[_0xdb43('0x23')](_0x4a4c75[_0xdb43('0x1d')]['include'],function(_0x4f9d29){return{'model':db[_0x4f9d29[_0xdb43('0x24')]],'as':_0x4f9d29['as'],'attributes':_0x4f9d29[_0xdb43('0x20')],'include':_0x4f9d29[_0xdb43('0x22')]?_['map'](_0x4f9d29[_0xdb43('0x22')],function(_0x13bf56){return{'model':db[_0x13bf56[_0xdb43('0x24')]],'as':_0x13bf56['as'],'attributes':_0x13bf56[_0xdb43('0x20')],'include':_0x13bf56[_0xdb43('0x22')]?_['map'](_0x13bf56['include'],function(_0x40f6be){return{'model':db[_0x40f6be[_0xdb43('0x24')]],'as':_0x40f6be['as'],'attributes':_0x40f6be[_0xdb43('0x20')]};}):[]};}):[]};}):[]:[]})[_0xdb43('0x25')](function(_0x52150c){logger[_0xdb43('0x10')](_0xdb43('0x27'),_0x4a4c75);logger[_0xdb43('0x13')](_0xdb43('0x27'),_0x4a4c75,JSON[_0xdb43('0x15')](_0x52150c));_0x872738(_0x52150c);})[_0xdb43('0x1a')](function(_0x2e4c9a){logger[_0xdb43('0x16')](_0xdb43('0x27'),_0x2e4c9a[_0xdb43('0x18')],_0x4a4c75);_0x552525(_0x5208ef[_0xdb43('0x16')](0x1f4,_0x2e4c9a[_0xdb43('0x18')]));});});};exports[_0xdb43('0x28')]=function(_0x1ec2d2){var _0x542f96=this;return new Promise(function(_0x3b89cd,_0x42228c){var _0x46e132;return db['User']['find']({'where':_0x1ec2d2[_0xdb43('0x1d')][_0xdb43('0x1f')]||{},'attributes':['id',_0xdb43('0x29'),'role',_0xdb43('0x2a'),_0xdb43('0x2b')]})[_0xdb43('0x25')](function(_0x45ba85){if(_0x45ba85){_0x46e132=_0x45ba85;return db[_0xdb43('0x2c')]['update']({'paused':0x1},{'where':{'UserId':_0x46e132['id']},'individualHooks':!![]});}})['then'](function(){if(_0x46e132){return db[_0xdb43('0x2d')][_0xdb43('0x1c')]({'where':{'membername':_0x46e132[_0xdb43('0x29')],'type':_0xdb43('0x2e'),'exitAt':null}});}})[_0xdb43('0x25')](function(_0x4a6917){if(_0x46e132){if(_0x4a6917&&_0x4a6917[_0xdb43('0x2f')]){var _0x3b008f=moment()['format'](_0xdb43('0x30'));for(var _0x1aa093=0x0,_0x19f959=_0x4a6917[_0xdb43('0x2f')];_0x1aa093<_0x19f959;_0x1aa093++){_0x4a6917[_0x1aa093][_0xdb43('0x31')]({'exitAt':_0x3b008f});}}}})[_0xdb43('0x25')](function(){if(_0x46e132){var _0x14aab7=[];var _0x17e25c=utils['getChannels']();_0x17e25c[_0xdb43('0x32')](function(_0x2634d5){_0x14aab7[_0xdb43('0x33')]({'channel':_0x2634d5,'membername':_0x46e132[_0xdb43('0x29')],'interface':_[_0xdb43('0x34')](_0x46e132[_0xdb43('0x2b')])?util[_0xdb43('0x35')]('SIP/%s',_0x46e132[_0xdb43('0x29')]):_0x46e132['interface'],'type':_0xdb43('0x2e'),'enterAt':moment()[_0xdb43('0x35')](_0xdb43('0x30')),'data1':_0x1ec2d2[_0xdb43('0x36')][_0xdb43('0x37')]||_0xdb43('0x38'),'role':_0x46e132[_0xdb43('0x39')],'internal':_0x46e132[_0xdb43('0x2a')],'uniqueid':_0x1ec2d2[_0xdb43('0x36')][_0xdb43('0x3a')]||null});});return db[_0xdb43('0x2d')][_0xdb43('0x3b')](_0x14aab7,{'individualHooks':!![]});}})[_0xdb43('0x25')](function(){if(_0x46e132){return _0x46e132[_0xdb43('0x3c')]({'voicePause':!![],'mailPause':!![],'chatPause':!![],'faxPause':!![],'smsPause':!![],'openchannelPause':!![],'pauseType':_0x1ec2d2[_0xdb43('0x36')][_0xdb43('0x37')]||_0xdb43('0x38'),'lastPauseAt':moment()[_0xdb43('0x35')](_0xdb43('0x30'))});}})['then'](function(_0x512c96){_0x3b89cd(_0x512c96);})[_0xdb43('0x1a')](function(_0x20b5f2){_0x42228c(_0x542f96[_0xdb43('0x16')](0x1f4,_0x20b5f2['message']));});});};exports[_0xdb43('0x3d')]=function(_0x2e2986){var _0x3a4b52=this;return new Promise(function(_0x314c1a,_0x22e331){var _0x217e33;return db['User'][_0xdb43('0x3e')]({'where':_0x2e2986[_0xdb43('0x1d')]['where']||{},'attributes':['id','name']})[_0xdb43('0x25')](function(_0x45d3a1){if(_0x45d3a1){_0x217e33=_0x45d3a1;if(_0x2e2986[_0xdb43('0x36')][_0xdb43('0x3f')]&&!utils[_0xdb43('0x40')](_0x2e2986[_0xdb43('0x36')][_0xdb43('0x3f')])){throw new Error(_0xdb43('0x41'));}switch(_0x2e2986[_0xdb43('0x36')]['channel']){case'voice':return db[_0xdb43('0x2c')][_0xdb43('0x3c')]({'paused':0x0},{'where':{'UserId':_0x217e33['id']}})[_0xdb43('0x25')](function(){return db['MemberReport']['find']({'where':{'channel':_0x2e2986[_0xdb43('0x36')][_0xdb43('0x3f')],'membername':_0x217e33[_0xdb43('0x29')],'type':_0xdb43('0x2e'),'exitAt':null}});})[_0xdb43('0x25')](function(_0x4c7c5e){if(_0x4c7c5e){return _0x4c7c5e[_0xdb43('0x3c')]({'exitAt':moment()[_0xdb43('0x35')](_0xdb43('0x30')),'data2':'system'},{'individualHooks':!![]});}return null;})['then'](function(){return _0x217e33['update']({'voicePause':![]});});case _0xdb43('0x42'):case'chat':case _0xdb43('0x43'):case _0xdb43('0x44'):case _0xdb43('0x45'):return db['MemberReport'][_0xdb43('0x46')]({'where':{'channel':_0x2e2986[_0xdb43('0x36')]['channel'],'membername':_0x217e33['name'],'type':_0xdb43('0x2e'),'exitAt':null}})[_0xdb43('0x25')](function(_0x141fca){return _0x141fca[_0xdb43('0x3c')]({'exitAt':moment()[_0xdb43('0x35')](_0xdb43('0x30')),'data2':_0xdb43('0x47')},{'individualHooks':!![]});})[_0xdb43('0x25')](function(){var _0x639d70={};_[_0xdb43('0x48')](_0x639d70,util[_0xdb43('0x35')]('%s%s',_0x2e2986['body'][_0xdb43('0x3f')],_0xdb43('0x49')),![]);return _0x217e33[_0xdb43('0x3c')](_0x639d70);});default:return db[_0xdb43('0x2c')][_0xdb43('0x3c')]({'paused':0x0},{'where':{'UserId':_0x217e33['id']}})['then'](function(){return db[_0xdb43('0x2d')][_0xdb43('0x1c')]({'where':{'membername':_0x217e33[_0xdb43('0x29')],'type':'PAUSE','exitAt':null}});})[_0xdb43('0x25')](function(_0x1b4203){var _0x5363d6=[];_0x1b4203['forEach'](function(_0x44a014){_0x5363d6[_0xdb43('0x33')](_0x44a014['update']({'exitAt':moment()[_0xdb43('0x35')](_0xdb43('0x30')),'data2':_0xdb43('0x47')}));});return BPromise['all'](_0x5363d6);})[_0xdb43('0x25')](function(){return _0x217e33[_0xdb43('0x3c')]({'voicePause':![],'mailPause':![],'chatPause':![],'faxPause':![],'smsPause':![],'openchannelPause':![]});});}}})[_0xdb43('0x25')](function(_0x27f110){_0x314c1a(_0x27f110);})[_0xdb43('0x1a')](function(_0x4cf510){_0x22e331(_0x3a4b52['error'](0x1f4,_0x4cf510[_0xdb43('0x18')]));});});};exports[_0xdb43('0x4a')]=function(_0x46355d){var _0x52d0b0=this;return new Promise(function(_0x5b1ad3,_0x267258){var _0x43ee28;return db[_0xdb43('0x1b')]['findOne']({'where':_0x46355d['options'][_0xdb43('0x1f')]||{},'attributes':['id',_0xdb43('0x29')]})[_0xdb43('0x25')](function(_0x216c50){if(_0x216c50){_0x43ee28=_0x216c50;return db[_0xdb43('0x2c')][_0xdb43('0x4b')]({'where':{'membername':_0x43ee28[_0xdb43('0x29')]},'individualHooks':!![]});}})[_0xdb43('0x25')](function(){if(_0x43ee28){return db['MemberReport'][_0xdb43('0x1c')]({'where':{'membername':_0x43ee28[_0xdb43('0x29')],'exitAt':null}});}})[_0xdb43('0x25')](function(_0x33ac7b){if(_0x43ee28){if(_0x33ac7b&&_0x33ac7b[_0xdb43('0x2f')]){var _0x5f5bd6=[];_0x33ac7b[_0xdb43('0x32')](function(_0x129514){_0x5f5bd6[_0xdb43('0x33')](_0x129514['update']({'exitAt':moment()[_0xdb43('0x35')](_0xdb43('0x30'))}));});return BPromise[_0xdb43('0x4c')](_0x5f5bd6);}}})[_0xdb43('0x25')](function(){if(_0x43ee28){return _0x43ee28[_0xdb43('0x3c')]({'online':![],'lastLoginAt':null,'voicePause':![],'mailPause':![],'chatPause':![],'faxPause':![],'smsPause':![],'openchannelPause':![]});}})['then'](function(_0x1beeec){_0x5b1ad3(_0x1beeec);})['catch'](function(_0xe5c19c){_0x267258(_0x52d0b0['error'](0x1f4,_0xe5c19c['message']));});});};exports['LoginUser']=function(_0xea4485){var _0x2bcb2f=this;return new Promise(function(_0x20163d,_0x4cbe75){var _0x5b69f1;var _0x31affe;var _0x31f4a2;var _0xa5f661;return db[_0xdb43('0x1b')]['findOne']({'where':_0xea4485[_0xdb43('0x1d')][_0xdb43('0x1f')]||{},'attributes':['id',_0xdb43('0x29'),_0xdb43('0x39'),'mobile',_0xdb43('0x4d'),_0xdb43('0x2a'),_0xdb43('0x4e'),_0xdb43('0x2b')]})[_0xdb43('0x25')](function(_0x514497){if(_0x514497){_0x5b69f1=_0x514497;_0xa5f661=_0xea4485[_0xdb43('0x36')][_0xdb43('0x2b')]?_0xea4485['body']['interface']:util['format'](_0xdb43('0x4f'),_0x5b69f1[_0xdb43('0x29')]);return db['User']['count']({'where':{'role':_0xdb43('0x50'),'online':!![],'id':{'$ne':_0x5b69f1['id']}}});}})[_0xdb43('0x25')](function(_0x147a16){if(_0x147a16){_0x31f4a2=_0x147a16;return require('../../config/license/util')[_0xdb43('0x51')]();}})[_0xdb43('0x25')](function(_0x609dcf){if(_0x609dcf&&_0x609dcf[_0xdb43('0x52')]&&_0x31f4a2>=_0x609dcf[_0xdb43('0x52')]){throw new Error('Maximum\x20login\x20has\x20been\x20reached');}})['then'](function(){if(_0x5b69f1){return db[_0xdb43('0x2c')][_0xdb43('0x4b')]({'where':{'membername':_0x5b69f1[_0xdb43('0x29')]},'individualHooks':!![]});}})['then'](function(){if(_0x5b69f1){return _0x5b69f1[_0xdb43('0x53')]({'raw':!![]});}})['then'](function(_0x5a4a73){if(_0x5b69f1){if(_0x5a4a73){var _0x3b1e42=[];_0x31affe=_0x5a4a73;if(_0x31affe[_0xdb43('0x2f')]){for(var _0x1cd677=0x0;_0x1cd677<_0x31affe[_0xdb43('0x2f')];_0x1cd677++){_0x3b1e42[_0xdb43('0x33')](db['UserVoiceQueueRt'][_0xdb43('0x54')]({'membername':_0x5b69f1[_0xdb43('0x29')],'UserId':_0x5b69f1['id'],'queue_name':_0x31affe[_0x1cd677][_0xdb43('0x29')],'VoiceQueueId':_0x31affe[_0x1cd677]['id'],'interface':_0xa5f661,'paused':_0x5b69f1[_0xdb43('0x4e')]||![],'penalty':_0x31affe[_0x1cd677]['UserVoiceQueue.penalty']||0x0}));}return BPromise['all'](_0x3b1e42);}}}})['then'](function(){if(_0x5b69f1){return db['MemberReport'][_0xdb43('0x1c')]({'where':{'membername':_0x5b69f1[_0xdb43('0x29')],'exitAt':null}});}})['then'](function(_0x42def7){if(_0x5b69f1){if(_0x42def7&&_0x42def7[_0xdb43('0x2f')]){var _0x532f4f=[];_0x42def7[_0xdb43('0x32')](function(_0x2689f9){_0x532f4f['push'](_0x2689f9[_0xdb43('0x3c')]({'exitAt':moment()['format'](_0xdb43('0x30'))}));});return BPromise[_0xdb43('0x4c')](_0x532f4f);}}})[_0xdb43('0x25')](function(_0x575476){if(_0x5b69f1){var _0x431c41=[];var _0x30289b=[];var _0x117479=utils['getChannels']();var _0x4539c9={'membername':_0x5b69f1[_0xdb43('0x29')],'interface':_0xa5f661,'enterAt':moment()[_0xdb43('0x35')](_0xdb43('0x30')),'role':_0x5b69f1['role'],'internal':_0x5b69f1[_0xdb43('0x2a')]};_0x117479[_0xdb43('0x32')](function(_0x40453c){_0x431c41[_0xdb43('0x33')](_[_0xdb43('0x55')]({'channel':_0x40453c,'type':_0xdb43('0x56'),'data1':_0xdb43('0x57'),'data2':_0xa5f661},_0x4539c9));if(_0x5b69f1['loginInPause']){_0x30289b[_0xdb43('0x33')](_[_0xdb43('0x55')]({'channel':_0x40453c,'type':'PAUSE','data1':_0xdb43('0x58')},_0x4539c9));}});return db['MemberReport'][_0xdb43('0x3b')](_0x431c41['concat'](_0x30289b),{'individualHooks':!![]});}})[_0xdb43('0x25')](function(){if(_0x5b69f1){return _0x5b69f1[_0xdb43('0x3c')]({'online':!![],'lastLoginAt':moment()[_0xdb43('0x35')]('YYYY-MM-DD\x20HH:mm:ss'),'voicePause':_0x5b69f1[_0xdb43('0x4e')]||![],'mailPause':_0x5b69f1[_0xdb43('0x4e')]||![],'chatPause':_0x5b69f1[_0xdb43('0x4e')]||![],'faxPause':_0x5b69f1[_0xdb43('0x4e')]||![],'smsPause':_0x5b69f1['loginInPause']||![],'openchannelPause':_0x5b69f1['loginInPause']||![],'pauseType':_0x5b69f1[_0xdb43('0x4e')]?_0xdb43('0x58'):null,'lastPauseAt':moment()['format']('YYYY-MM-DD\x20HH:mm:ss'),'interface':_0xa5f661});}})[_0xdb43('0x25')](function(_0x2bc7df){_0x20163d(_0x2bc7df);})['catch'](function(_0x554f69){_0x4cbe75(_0x2bcb2f[_0xdb43('0x16')](0x1f4,_0x554f69[_0xdb43('0x18')]));});});}; \ No newline at end of file diff --git a/server/api/user/user.socket.js b/server/api/user/user.socket.js index 8710fed..17bc54b 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 _0xeedd=['emit','removeListener','register','user:','save','remove','update'];(function(_0x2157cd,_0x576828){var _0x209576=function(_0x2c7f60){while(--_0x2c7f60){_0x2157cd['push'](_0x2157cd['shift']());}};_0x209576(++_0x576828);}(_0xeedd,0x177));var _0xdeed=function(_0x553121,_0x38524e){_0x553121=_0x553121-0x0;var _0x484b55=_0xeedd[_0x553121];return _0x484b55;};'use strict';var UserEvents=require('./user.events');var events=[_0xdeed('0x0'),_0xdeed('0x1'),_0xdeed('0x2')];function createListener(_0x37411e,_0x280266){return function(_0x2b6a3c){_0x280266[_0xdeed('0x3')](_0x37411e,_0x2b6a3c);};}function removeListener(_0x1607ce,_0x140721){return function(){UserEvents[_0xdeed('0x4')](_0x1607ce,_0x140721);};}exports[_0xdeed('0x5')]=function(_0x44d73e){for(var _0x4f4bbe=0x0,_0x510836=events['length'];_0x4f4bbe<_0x510836;_0x4f4bbe++){var _0x5cf574=events[_0x4f4bbe];var _0x438ad2=createListener(_0xdeed('0x6')+_0x5cf574,_0x44d73e);UserEvents['on'](_0x5cf574,_0x438ad2);}}; \ No newline at end of file +var _0x9aef=['remove','emit','register','length','./user.events','save'];(function(_0x400d67,_0x56d777){var _0x2eeea1=function(_0x106c6b){while(--_0x106c6b){_0x400d67['push'](_0x400d67['shift']());}};_0x2eeea1(++_0x56d777);}(_0x9aef,0x82));var _0xf9ae=function(_0x2ce6d5,_0x333e0c){_0x2ce6d5=_0x2ce6d5-0x0;var _0x32d272=_0x9aef[_0x2ce6d5];return _0x32d272;};'use strict';var UserEvents=require(_0xf9ae('0x0'));var events=[_0xf9ae('0x1'),_0xf9ae('0x2'),'update'];function createListener(_0x578dff,_0x58fd74){return function(_0x16d6b1){_0x58fd74[_0xf9ae('0x3')](_0x578dff,_0x16d6b1);};}function removeListener(_0x4d132a,_0x4c27e6){return function(){UserEvents['removeListener'](_0x4d132a,_0x4c27e6);};}exports[_0xf9ae('0x4')]=function(_0x1fba29){for(var _0x330a3f=0x0,_0x39602e=events[_0xf9ae('0x5')];_0x330a3f<_0x39602e;_0x330a3f++){var _0x5930eb=events[_0x330a3f];var _0x38e2ae=createListener('user:'+_0x5930eb,_0x1fba29);UserEvents['on'](_0x5930eb,_0x38e2ae);}}; \ No newline at end of file diff --git a/server/api/userChatQueue/index.js b/server/api/userChatQueue/index.js index 360e95e..23f5c27 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 _0x1c38=['../../components/auth/service','exports','multer','util','path','connect-timeout','Router'];(function(_0x36b8b4,_0x2c2fc8){var _0x16dda2=function(_0x326542){while(--_0x326542){_0x36b8b4['push'](_0x36b8b4['shift']());}};_0x16dda2(++_0x2c2fc8);}(_0x1c38,0x1c2));var _0x81c3=function(_0x7dad80,_0x5aa23f){_0x7dad80=_0x7dad80-0x0;var _0x2d9b68=_0x1c38[_0x7dad80];return _0x2d9b68;};'use strict';var multer=require(_0x81c3('0x0'));var util=require(_0x81c3('0x1'));var path=require(_0x81c3('0x2'));var timeout=require(_0x81c3('0x3'));var express=require('express');var router=express[_0x81c3('0x4')]();var auth=require(_0x81c3('0x5'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');module[_0x81c3('0x6')]=router; \ No newline at end of file +var _0x4b14=['path','connect-timeout','Router','../../components/auth/service','../../config/environment','exports','multer','util'];(function(_0x5a7f64,_0x347d57){var _0x3d30f1=function(_0x4bd1d6){while(--_0x4bd1d6){_0x5a7f64['push'](_0x5a7f64['shift']());}};_0x3d30f1(++_0x347d57);}(_0x4b14,0x9e));var _0x44b1=function(_0x123ba3,_0x545a27){_0x123ba3=_0x123ba3-0x0;var _0xe31e78=_0x4b14[_0x123ba3];return _0xe31e78;};'use strict';var multer=require(_0x44b1('0x0'));var util=require(_0x44b1('0x1'));var path=require(_0x44b1('0x2'));var timeout=require(_0x44b1('0x3'));var express=require('express');var router=express[_0x44b1('0x4')]();var auth=require(_0x44b1('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x44b1('0x6'));module[_0x44b1('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 4180237..1e1df8f 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(_0x2f06b3,_0x12feb6){var _0x270d4d=function(_0x5e3720){while(--_0x5e3720){_0x2f06b3['push'](_0x2f06b3['shift']());}};_0x270d4d(++_0x12feb6);}(_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(_0x1362db,_0x54551e){var _0x6e2b49=function(_0x4885fc){while(--_0x4885fc){_0x1362db['push'](_0x1362db['shift']());}};_0x6e2b49(++_0x54551e);}(_0xe706,0xa3));var _0x6e70=function(_0x2fc960,_0x5219db){_0x2fc960=_0x2fc960-0x0;var _0x3072a7=_0xe706[_0x2fc960];return _0x3072a7;};'use strict';var Sequelize=require(_0x6e70('0x0'));module[_0x6e70('0x1')]={'penalty':{'type':Sequelize[_0x6e70('0x2')],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/userChatQueue/userChatQueue.model.js b/server/api/userChatQueue/userChatQueue.model.js index 295c8eb..e0e35e0 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 _0x8f0a=['./userChatQueue.attributes','exports','define','user_has_chat_queues','lodash','util','../../config/logger','api','moment','bluebird','rimraf','../../config/environment'];(function(_0x28f632,_0x19c6b5){var _0x1bbfa2=function(_0x403808){while(--_0x403808){_0x28f632['push'](_0x28f632['shift']());}};_0x1bbfa2(++_0x19c6b5);}(_0x8f0a,0x1e4));var _0xa8f0=function(_0x421196,_0x1cbd94){_0x421196=_0x421196-0x0;var _0x2738af=_0x8f0a[_0x421196];return _0x2738af;};'use strict';var _=require(_0xa8f0('0x0'));var util=require(_0xa8f0('0x1'));var logger=require(_0xa8f0('0x2'))(_0xa8f0('0x3'));var moment=require(_0xa8f0('0x4'));var BPromise=require(_0xa8f0('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0xa8f0('0x6'));var config=require(_0xa8f0('0x7'));var attributes=require(_0xa8f0('0x8'));module[_0xa8f0('0x9')]=function(_0x4ec904,_0x48b57){return _0x4ec904[_0xa8f0('0xa')]('UserChatQueue',attributes,{'tableName':_0xa8f0('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xc224=['UserChatQueue','user_has_chat_queues','lodash','util','../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment','./userChatQueue.attributes','exports'];(function(_0x1995af,_0x479c63){var _0x1f72ba=function(_0x4e8f26){while(--_0x4e8f26){_0x1995af['push'](_0x1995af['shift']());}};_0x1f72ba(++_0x479c63);}(_0xc224,0x1af));var _0x4c22=function(_0x58b55a,_0x3d9f9c){_0x58b55a=_0x58b55a-0x0;var _0x588ba2=_0xc224[_0x58b55a];return _0x588ba2;};'use strict';var _=require(_0x4c22('0x0'));var util=require(_0x4c22('0x1'));var logger=require(_0x4c22('0x2'))('api');var moment=require(_0x4c22('0x3'));var BPromise=require(_0x4c22('0x4'));var rp=require(_0x4c22('0x5'));var fs=require('fs');var path=require(_0x4c22('0x6'));var rimraf=require(_0x4c22('0x7'));var config=require(_0x4c22('0x8'));var attributes=require(_0x4c22('0x9'));module[_0x4c22('0xa')]=function(_0x576de1,_0x5d036f){return _0x576de1['define'](_0x4c22('0xb'),attributes,{'tableName':_0x4c22('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/userChatQueue/userChatQueue.rpc.js b/server/api/userChatQueue/userChatQueue.rpc.js index 952fca0..457cf97 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 _0x5ca5=['lodash','util','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','then','info','UserChatQueue,\x20%s,\x20%s','request\x20sent','debug','UserChatQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch'];(function(_0x27af45,_0x1b57aa){var _0x18df21=function(_0x4b7679){while(--_0x4b7679){_0x27af45['push'](_0x27af45['shift']());}};_0x18df21(++_0x1b57aa);}(_0x5ca5,0xbd));var _0x55ca=function(_0x1e8f25,_0x45b639){_0x1e8f25=_0x1e8f25-0x0;var _0x36c06a=_0x5ca5[_0x1e8f25];return _0x36c06a;};'use strict';var _=require(_0x55ca('0x0'));var util=require(_0x55ca('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x55ca('0x2'))['db'];var utils=require(_0x55ca('0x3'));var logger=require(_0x55ca('0x4'))(_0x55ca('0x5'));var config=require(_0x55ca('0x6'));var jayson=require(_0x55ca('0x7'));var client=jayson[_0x55ca('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x4b5407,_0x5495ff,_0x32b5c3){return new BPromise(function(_0x70812c,_0x1cf4e7){return client[_0x55ca('0x9')](_0x4b5407,_0x32b5c3)[_0x55ca('0xa')](function(_0x4b8c04){logger[_0x55ca('0xb')](_0x55ca('0xc'),_0x5495ff,_0x55ca('0xd'));logger[_0x55ca('0xe')](_0x55ca('0xf'),_0x5495ff,'request\x20sent',JSON[_0x55ca('0x10')](_0x4b8c04));if(_0x4b8c04['error']){if(_0x4b8c04[_0x55ca('0x11')][_0x55ca('0x12')]===0x1f4){logger[_0x55ca('0x11')]('UserChatQueue,\x20%s,\x20%s',_0x5495ff,_0x4b8c04['error']['message']);return _0x1cf4e7(_0x4b8c04[_0x55ca('0x11')][_0x55ca('0x13')]);}logger[_0x55ca('0x11')](_0x55ca('0xc'),_0x5495ff,_0x4b8c04[_0x55ca('0x11')]['message']);return _0x70812c(_0x4b8c04[_0x55ca('0x11')][_0x55ca('0x13')]);}else{logger[_0x55ca('0xb')]('UserChatQueue,\x20%s,\x20%s',_0x5495ff,_0x55ca('0xd'));_0x70812c(_0x4b8c04['result'][_0x55ca('0x13')]);}})[_0x55ca('0x14')](function(_0x5065db){logger[_0x55ca('0x11')]('UserChatQueue,\x20%s,\x20%s',_0x5495ff,_0x5065db);_0x1cf4e7(_0x5065db);});});} \ No newline at end of file +var _0xc0b1=['../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','request','then','info','UserChatQueue,\x20%s,\x20%s','request\x20sent','debug','error','message','result','catch','util','moment','bluebird','randomstring','ioredis'];(function(_0x197c58,_0x37a5b1){var _0x3e9b4b=function(_0xd8090f){while(--_0xd8090f){_0x197c58['push'](_0x197c58['shift']());}};_0x3e9b4b(++_0x37a5b1);}(_0xc0b1,0x7f));var _0x1c0b=function(_0x5a7f64,_0x347d57){_0x5a7f64=_0x5a7f64-0x0;var _0x3d30f1=_0xc0b1[_0x5a7f64];return _0x3d30f1;};'use strict';var _=require('lodash');var util=require(_0x1c0b('0x0'));var moment=require(_0x1c0b('0x1'));var BPromise=require(_0x1c0b('0x2'));var rs=require(_0x1c0b('0x3'));var fs=require('fs');var Redis=require(_0x1c0b('0x4'));var db=require(_0x1c0b('0x5'))['db'];var utils=require(_0x1c0b('0x6'));var logger=require(_0x1c0b('0x7'))(_0x1c0b('0x8'));var config=require(_0x1c0b('0x9'));var jayson=require('jayson/promise');var client=jayson[_0x1c0b('0xa')][_0x1c0b('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x1482b2,_0x562e13,_0xd91159){return new BPromise(function(_0x4b8b07,_0x3e0eec){return client[_0x1c0b('0xc')](_0x1482b2,_0xd91159)[_0x1c0b('0xd')](function(_0x24e83b){logger[_0x1c0b('0xe')](_0x1c0b('0xf'),_0x562e13,_0x1c0b('0x10'));logger[_0x1c0b('0x11')]('UserChatQueue,\x20%s,\x20%s,\x20%s',_0x562e13,_0x1c0b('0x10'),JSON['stringify'](_0x24e83b));if(_0x24e83b[_0x1c0b('0x12')]){if(_0x24e83b[_0x1c0b('0x12')]['code']===0x1f4){logger['error'](_0x1c0b('0xf'),_0x562e13,_0x24e83b[_0x1c0b('0x12')][_0x1c0b('0x13')]);return _0x3e0eec(_0x24e83b[_0x1c0b('0x12')][_0x1c0b('0x13')]);}logger[_0x1c0b('0x12')](_0x1c0b('0xf'),_0x562e13,_0x24e83b['error'][_0x1c0b('0x13')]);return _0x4b8b07(_0x24e83b['error'][_0x1c0b('0x13')]);}else{logger[_0x1c0b('0xe')](_0x1c0b('0xf'),_0x562e13,_0x1c0b('0x10'));_0x4b8b07(_0x24e83b[_0x1c0b('0x14')][_0x1c0b('0x13')]);}})[_0x1c0b('0x15')](function(_0x1ef181){logger[_0x1c0b('0x12')](_0x1c0b('0xf'),_0x562e13,_0x1ef181);_0x3e0eec(_0x1ef181);});});} \ No newline at end of file diff --git a/server/api/userFaxQueue/index.js b/server/api/userFaxQueue/index.js index 9953faf..dcd450f 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 _0xe0bd=['exports','multer','util','path','connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment'];(function(_0x102e37,_0x14a181){var _0x35a07c=function(_0x16577f){while(--_0x16577f){_0x102e37['push'](_0x102e37['shift']());}};_0x35a07c(++_0x14a181);}(_0xe0bd,0x184));var _0xde0b=function(_0x4c8812,_0xa9d102){_0x4c8812=_0x4c8812-0x0;var _0x42d129=_0xe0bd[_0x4c8812];return _0x42d129;};'use strict';var multer=require(_0xde0b('0x0'));var util=require(_0xde0b('0x1'));var path=require(_0xde0b('0x2'));var timeout=require(_0xde0b('0x3'));var express=require(_0xde0b('0x4'));var router=express['Router']();var auth=require(_0xde0b('0x5'));var interaction=require(_0xde0b('0x6'));var config=require(_0xde0b('0x7'));module[_0xde0b('0x8')]=router; \ No newline at end of file +var _0xa498=['exports','util','path','Router','../../components/auth/service','../../components/interaction/service','../../config/environment'];(function(_0x4243a3,_0x447337){var _0x1b2a33=function(_0x6a8200){while(--_0x6a8200){_0x4243a3['push'](_0x4243a3['shift']());}};_0x1b2a33(++_0x447337);}(_0xa498,0x1d6));var _0x8a49=function(_0x19ee96,_0x48b7d5){_0x19ee96=_0x19ee96-0x0;var _0x57aaf0=_0xa498[_0x19ee96];return _0x57aaf0;};'use strict';var multer=require('multer');var util=require(_0x8a49('0x0'));var path=require(_0x8a49('0x1'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x8a49('0x2')]();var auth=require(_0x8a49('0x3'));var interaction=require(_0x8a49('0x4'));var config=require(_0x8a49('0x5'));module[_0x8a49('0x6')]=router; \ No newline at end of file diff --git a/server/api/userFaxQueue/userFaxQueue.attributes.js b/server/api/userFaxQueue/userFaxQueue.attributes.js index c0df8da..28d7e4a 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(_0x671369,_0x433da5){var _0x33f2b4=function(_0x2e9db2){while(--_0x2e9db2){_0x671369['push'](_0x671369['shift']());}};_0x33f2b4(++_0x433da5);}(_0x7916,0x128));var _0x6791=function(_0x4b755a,_0x48b8ce){_0x4b755a=_0x4b755a-0x0;var _0x5b11e9=_0x7916[_0x4b755a];return _0x5b11e9;};'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 _0x0b0e=['STRING','sequelize','INTEGER'];(function(_0x2a1393,_0x874159){var _0x234333=function(_0x1d2ca9){while(--_0x1d2ca9){_0x2a1393['push'](_0x2a1393['shift']());}};_0x234333(++_0x874159);}(_0x0b0e,0x187));var _0xe0b0=function(_0x146dd7,_0x4d877d){_0x146dd7=_0x146dd7-0x0;var _0x2af0bb=_0x0b0e[_0x146dd7];return _0x2af0bb;};'use strict';var Sequelize=require(_0xe0b0('0x0'));module['exports']={'penalty':{'type':Sequelize[_0xe0b0('0x1')],'defaultValue':0x0},'assigned':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'queue':{'type':Sequelize[_0xe0b0('0x2')]}}; \ No newline at end of file diff --git a/server/api/userFaxQueue/userFaxQueue.model.js b/server/api/userFaxQueue/userFaxQueue.model.js index f2d5355..5fc8135 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 _0x76e0=['UserFaxQueue','lodash','util','../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment','define'];(function(_0x2d8024,_0x4c35c6){var _0x242ccb=function(_0x22e7a3){while(--_0x22e7a3){_0x2d8024['push'](_0x2d8024['shift']());}};_0x242ccb(++_0x4c35c6);}(_0x76e0,0x18d));var _0x076e=function(_0x544133,_0x2220a5){_0x544133=_0x544133-0x0;var _0x7b184f=_0x76e0[_0x544133];return _0x7b184f;};'use strict';var _=require(_0x076e('0x0'));var util=require(_0x076e('0x1'));var logger=require(_0x076e('0x2'))(_0x076e('0x3'));var moment=require(_0x076e('0x4'));var BPromise=require(_0x076e('0x5'));var rp=require(_0x076e('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0x076e('0x7'));var config=require(_0x076e('0x8'));var attributes=require('./userFaxQueue.attributes');module['exports']=function(_0x37205,_0x6e85c3){return _0x37205[_0x076e('0x9')](_0x076e('0xa'),attributes,{'tableName':'user_has_fax_queues','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xe547=['../../config/environment','./userFaxQueue.attributes','exports','define','user_has_fax_queues','../../config/logger','api','moment','bluebird','request-promise','rimraf'];(function(_0x119b0c,_0x24b229){var _0x3524eb=function(_0x19cdeb){while(--_0x19cdeb){_0x119b0c['push'](_0x119b0c['shift']());}};_0x3524eb(++_0x24b229);}(_0xe547,0x191));var _0x7e54=function(_0x37e462,_0x195e59){_0x37e462=_0x37e462-0x0;var _0x39532c=_0xe547[_0x37e462];return _0x39532c;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x7e54('0x0'))(_0x7e54('0x1'));var moment=require(_0x7e54('0x2'));var BPromise=require(_0x7e54('0x3'));var rp=require(_0x7e54('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x7e54('0x5'));var config=require(_0x7e54('0x6'));var attributes=require(_0x7e54('0x7'));module[_0x7e54('0x8')]=function(_0x3f4b73,_0x3c99e0){return _0x3f4b73[_0x7e54('0x9')]('UserFaxQueue',attributes,{'tableName':_0x7e54('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/userFaxQueue/userFaxQueue.rpc.js b/server/api/userFaxQueue/userFaxQueue.rpc.js index e89e991..5e21535 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 _0x6169=['result','catch','lodash','util','bluebird','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','http','request','then','info','request\x20sent','debug','UserFaxQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','UserFaxQueue,\x20%s,\x20%s','message'];(function(_0x874306,_0x57e634){var _0x64d65d=function(_0x3880a3){while(--_0x3880a3){_0x874306['push'](_0x874306['shift']());}};_0x64d65d(++_0x57e634);}(_0x6169,0x162));var _0x9616=function(_0x46ac46,_0x23aced){_0x46ac46=_0x46ac46-0x0;var _0xc0ee1=_0x6169[_0x46ac46];return _0xc0ee1;};'use strict';var _=require(_0x9616('0x0'));var util=require(_0x9616('0x1'));var moment=require('moment');var BPromise=require(_0x9616('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x9616('0x3'))['db'];var utils=require(_0x9616('0x4'));var logger=require(_0x9616('0x5'))('rpc');var config=require(_0x9616('0x6'));var jayson=require(_0x9616('0x7'));var client=jayson['client'][_0x9616('0x8')]({'port':0x232a});function respondWithRpcPromise(_0xa4d315,_0x4edff4,_0x8b686e){return new BPromise(function(_0x559ab2,_0x4548bd){return client[_0x9616('0x9')](_0xa4d315,_0x8b686e)[_0x9616('0xa')](function(_0x9073d6){logger[_0x9616('0xb')]('UserFaxQueue,\x20%s,\x20%s',_0x4edff4,_0x9616('0xc'));logger[_0x9616('0xd')](_0x9616('0xe'),_0x4edff4,_0x9616('0xc'),JSON[_0x9616('0xf')](_0x9073d6));if(_0x9073d6[_0x9616('0x10')]){if(_0x9073d6[_0x9616('0x10')][_0x9616('0x11')]===0x1f4){logger[_0x9616('0x10')](_0x9616('0x12'),_0x4edff4,_0x9073d6[_0x9616('0x10')][_0x9616('0x13')]);return _0x4548bd(_0x9073d6[_0x9616('0x10')][_0x9616('0x13')]);}logger[_0x9616('0x10')](_0x9616('0x12'),_0x4edff4,_0x9073d6[_0x9616('0x10')]['message']);return _0x559ab2(_0x9073d6['error'][_0x9616('0x13')]);}else{logger[_0x9616('0xb')]('UserFaxQueue,\x20%s,\x20%s',_0x4edff4,_0x9616('0xc'));_0x559ab2(_0x9073d6[_0x9616('0x14')][_0x9616('0x13')]);}})[_0x9616('0x15')](function(_0x2fa65b){logger[_0x9616('0x10')]('UserFaxQueue,\x20%s,\x20%s',_0x4edff4,_0x2fa65b);_0x4548bd(_0x2fa65b);});});} \ No newline at end of file +var _0xf03d=['../../config/environment','jayson/promise','client','request','then','request\x20sent','debug','UserFaxQueue,\x20%s,\x20%s,\x20%s','error','code','UserFaxQueue,\x20%s,\x20%s','message','info','result','catch','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc'];(function(_0x1ebe90,_0x5d29fc){var _0x447c82=function(_0x1c2646){while(--_0x1c2646){_0x1ebe90['push'](_0x1ebe90['shift']());}};_0x447c82(++_0x5d29fc);}(_0xf03d,0x1a7));var _0xdf03=function(_0x442001,_0x498d65){_0x442001=_0x442001-0x0;var _0x151c66=_0xf03d[_0x442001];return _0x151c66;};'use strict';var _=require(_0xdf03('0x0'));var util=require(_0xdf03('0x1'));var moment=require(_0xdf03('0x2'));var BPromise=require('bluebird');var rs=require(_0xdf03('0x3'));var fs=require('fs');var Redis=require(_0xdf03('0x4'));var db=require(_0xdf03('0x5'))['db'];var utils=require(_0xdf03('0x6'));var logger=require(_0xdf03('0x7'))(_0xdf03('0x8'));var config=require(_0xdf03('0x9'));var jayson=require(_0xdf03('0xa'));var client=jayson[_0xdf03('0xb')]['http']({'port':0x232a});function respondWithRpcPromise(_0xe47081,_0x501e0d,_0x19e6cb){return new BPromise(function(_0x5c3c6f,_0x5d8094){return client[_0xdf03('0xc')](_0xe47081,_0x19e6cb)[_0xdf03('0xd')](function(_0x2ed1d2){logger['info']('UserFaxQueue,\x20%s,\x20%s',_0x501e0d,_0xdf03('0xe'));logger[_0xdf03('0xf')](_0xdf03('0x10'),_0x501e0d,'request\x20sent',JSON['stringify'](_0x2ed1d2));if(_0x2ed1d2['error']){if(_0x2ed1d2[_0xdf03('0x11')][_0xdf03('0x12')]===0x1f4){logger['error'](_0xdf03('0x13'),_0x501e0d,_0x2ed1d2[_0xdf03('0x11')][_0xdf03('0x14')]);return _0x5d8094(_0x2ed1d2[_0xdf03('0x11')][_0xdf03('0x14')]);}logger['error']('UserFaxQueue,\x20%s,\x20%s',_0x501e0d,_0x2ed1d2['error'][_0xdf03('0x14')]);return _0x5c3c6f(_0x2ed1d2[_0xdf03('0x11')][_0xdf03('0x14')]);}else{logger[_0xdf03('0x15')]('UserFaxQueue,\x20%s,\x20%s',_0x501e0d,_0xdf03('0xe'));_0x5c3c6f(_0x2ed1d2[_0xdf03('0x16')][_0xdf03('0x14')]);}})[_0xdf03('0x17')](function(_0x216176){logger[_0xdf03('0x11')](_0xdf03('0x13'),_0x501e0d,_0x216176);_0x5d8094(_0x216176);});});} \ No newline at end of file diff --git a/server/api/userMailQueue/index.js b/server/api/userMailQueue/index.js index 1c6c2aa..79084e3 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 _0x938d=['multer','path','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','exports'];(function(_0x15e95a,_0x4b328b){var _0x34f87b=function(_0x1988c8){while(--_0x1988c8){_0x15e95a['push'](_0x15e95a['shift']());}};_0x34f87b(++_0x4b328b);}(_0x938d,0x188));var _0xd938=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x938d[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require(_0xd938('0x0'));var util=require('util');var path=require(_0xd938('0x1'));var timeout=require(_0xd938('0x2'));var express=require('express');var router=express[_0xd938('0x3')]();var auth=require(_0xd938('0x4'));var interaction=require(_0xd938('0x5'));var config=require('../../config/environment');module[_0xd938('0x6')]=router; \ No newline at end of file +var _0x25fa=['../../components/interaction/service','../../config/environment','exports','multer','util','path','connect-timeout','Router','../../components/auth/service'];(function(_0x37e3bc,_0x151a0e){var _0x50936a=function(_0x258579){while(--_0x258579){_0x37e3bc['push'](_0x37e3bc['shift']());}};_0x50936a(++_0x151a0e);}(_0x25fa,0x13e));var _0xa25f=function(_0x1932b1,_0x12e625){_0x1932b1=_0x1932b1-0x0;var _0x1bde95=_0x25fa[_0x1932b1];return _0x1bde95;};'use strict';var multer=require(_0xa25f('0x0'));var util=require(_0xa25f('0x1'));var path=require(_0xa25f('0x2'));var timeout=require(_0xa25f('0x3'));var express=require('express');var router=express[_0xa25f('0x4')]();var auth=require(_0xa25f('0x5'));var interaction=require(_0xa25f('0x6'));var config=require(_0xa25f('0x7'));module[_0xa25f('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 01c55f4..f7d99c1 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(_0x1c1c7d,_0x542705){var _0x3da448=function(_0x522cc5){while(--_0x522cc5){_0x1c1c7d['push'](_0x1c1c7d['shift']());}};_0x3da448(++_0x542705);}(_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 _0xb10b=['sequelize','INTEGER'];(function(_0x4ee888,_0x103389){var _0x1770f4=function(_0x35dee3){while(--_0x35dee3){_0x4ee888['push'](_0x4ee888['shift']());}};_0x1770f4(++_0x103389);}(_0xb10b,0x12a));var _0xbb10=function(_0x2acd35,_0x2b21df){_0x2acd35=_0x2acd35-0x0;var _0x272693=_0xb10b[_0x2acd35];return _0x272693;};'use strict';var Sequelize=require(_0xbb10('0x0'));module['exports']={'penalty':{'type':Sequelize[_0xbb10('0x1')],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/userMailQueue/userMailQueue.model.js b/server/api/userMailQueue/userMailQueue.model.js index 0efdf50..a89f490 100644 --- a/server/api/userMailQueue/userMailQueue.model.js +++ b/server/api/userMailQueue/userMailQueue.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x757a=['define','user_has_mail_queues','util','../../config/logger','request-promise','path','rimraf','../../config/environment','./userMailQueue.attributes','exports'];(function(_0x2b12f7,_0x4033ac){var _0x8cb277=function(_0x713b37){while(--_0x713b37){_0x2b12f7['push'](_0x2b12f7['shift']());}};_0x8cb277(++_0x4033ac);}(_0x757a,0xde));var _0xa757=function(_0x22220f,_0x5cc424){_0x22220f=_0x22220f-0x0;var _0xe2ec32=_0x757a[_0x22220f];return _0xe2ec32;};'use strict';var _=require('lodash');var util=require(_0xa757('0x0'));var logger=require(_0xa757('0x1'))('api');var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0xa757('0x2'));var fs=require('fs');var path=require(_0xa757('0x3'));var rimraf=require(_0xa757('0x4'));var config=require(_0xa757('0x5'));var attributes=require(_0xa757('0x6'));module[_0xa757('0x7')]=function(_0x5edca8,_0xae0e7c){return _0x5edca8[_0xa757('0x8')]('UserMailQueue',attributes,{'tableName':_0xa757('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xd8b0=['define','user_has_mail_queues','lodash','util','bluebird','request-promise','path','rimraf','../../config/environment'];(function(_0x50d085,_0x1d3ccd){var _0x1f3318=function(_0x5455a4){while(--_0x5455a4){_0x50d085['push'](_0x50d085['shift']());}};_0x1f3318(++_0x1d3ccd);}(_0xd8b0,0xad));var _0x0d8b=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0xd8b0[_0xa464c9];return _0x3d73c4;};'use strict';var _=require(_0x0d8b('0x0'));var util=require(_0x0d8b('0x1'));var logger=require('../../config/logger')('api');var moment=require('moment');var BPromise=require(_0x0d8b('0x2'));var rp=require(_0x0d8b('0x3'));var fs=require('fs');var path=require(_0x0d8b('0x4'));var rimraf=require(_0x0d8b('0x5'));var config=require(_0x0d8b('0x6'));var attributes=require('./userMailQueue.attributes');module['exports']=function(_0x3f8b6f,_0x227c63){return _0x3f8b6f[_0x0d8b('0x7')]('UserMailQueue',attributes,{'tableName':_0x0d8b('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/userMailQueue/userMailQueue.rpc.js b/server/api/userMailQueue/userMailQueue.rpc.js index e1bed80..d500d83 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 _0xe93a=['UserMailQueue,\x20%s,\x20%s','debug','UserMailQueue,\x20%s,\x20%s,\x20%s','stringify','error','message','request\x20sent','lodash','util','../../mysqldb','../../config/logger','rpc','jayson/promise','http','request','info'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xe93a,0x1a7));var _0xae93=function(_0x580576,_0x2f107d){_0x580576=_0x580576-0x0;var _0x3f55a0=_0xe93a[_0x580576];return _0x3f55a0;};'use strict';var _=require(_0xae93('0x0'));var util=require(_0xae93('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0xae93('0x2'))['db'];var utils=require('../../config/utils');var logger=require(_0xae93('0x3'))(_0xae93('0x4'));var config=require('../../config/environment');var jayson=require(_0xae93('0x5'));var client=jayson['client'][_0xae93('0x6')]({'port':0x232a});function respondWithRpcPromise(_0x4d7f88,_0x381a9c,_0x574d1c){return new BPromise(function(_0x54f5b5,_0x2688ae){return client[_0xae93('0x7')](_0x4d7f88,_0x574d1c)['then'](function(_0x4ef2f6){logger[_0xae93('0x8')](_0xae93('0x9'),_0x381a9c,'request\x20sent');logger[_0xae93('0xa')](_0xae93('0xb'),_0x381a9c,'request\x20sent',JSON[_0xae93('0xc')](_0x4ef2f6));if(_0x4ef2f6[_0xae93('0xd')]){if(_0x4ef2f6[_0xae93('0xd')]['code']===0x1f4){logger[_0xae93('0xd')]('UserMailQueue,\x20%s,\x20%s',_0x381a9c,_0x4ef2f6[_0xae93('0xd')][_0xae93('0xe')]);return _0x2688ae(_0x4ef2f6[_0xae93('0xd')]['message']);}logger['error'](_0xae93('0x9'),_0x381a9c,_0x4ef2f6[_0xae93('0xd')][_0xae93('0xe')]);return _0x54f5b5(_0x4ef2f6['error'][_0xae93('0xe')]);}else{logger[_0xae93('0x8')]('UserMailQueue,\x20%s,\x20%s',_0x381a9c,_0xae93('0xf'));_0x54f5b5(_0x4ef2f6['result'][_0xae93('0xe')]);}})['catch'](function(_0x34c5c8){logger['error'](_0xae93('0x9'),_0x381a9c,_0x34c5c8);_0x2688ae(_0x34c5c8);});});} \ No newline at end of file +var _0x600f=['request','then','info','request\x20sent','debug','UserMailQueue,\x20%s,\x20%s,\x20%s','error','code','UserMailQueue,\x20%s,\x20%s','message','result','catch','lodash','util','moment','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http'];(function(_0x3e0a4f,_0x1e67d1){var _0x55ef37=function(_0x217020){while(--_0x217020){_0x3e0a4f['push'](_0x3e0a4f['shift']());}};_0x55ef37(++_0x1e67d1);}(_0x600f,0xb4));var _0xf600=function(_0xdea41a,_0x552987){_0xdea41a=_0xdea41a-0x0;var _0x15d0d8=_0x600f[_0xdea41a];return _0x15d0d8;};'use strict';var _=require(_0xf600('0x0'));var util=require(_0xf600('0x1'));var moment=require(_0xf600('0x2'));var BPromise=require('bluebird');var rs=require(_0xf600('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xf600('0x4'))['db'];var utils=require(_0xf600('0x5'));var logger=require(_0xf600('0x6'))(_0xf600('0x7'));var config=require(_0xf600('0x8'));var jayson=require(_0xf600('0x9'));var client=jayson[_0xf600('0xa')][_0xf600('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x5a6457,_0x1a620c,_0x56f333){return new BPromise(function(_0x489c42,_0x5c96d8){return client[_0xf600('0xc')](_0x5a6457,_0x56f333)[_0xf600('0xd')](function(_0xa9d85e){logger[_0xf600('0xe')]('UserMailQueue,\x20%s,\x20%s',_0x1a620c,_0xf600('0xf'));logger[_0xf600('0x10')](_0xf600('0x11'),_0x1a620c,_0xf600('0xf'),JSON['stringify'](_0xa9d85e));if(_0xa9d85e[_0xf600('0x12')]){if(_0xa9d85e['error'][_0xf600('0x13')]===0x1f4){logger[_0xf600('0x12')](_0xf600('0x14'),_0x1a620c,_0xa9d85e[_0xf600('0x12')][_0xf600('0x15')]);return _0x5c96d8(_0xa9d85e[_0xf600('0x12')][_0xf600('0x15')]);}logger[_0xf600('0x12')]('UserMailQueue,\x20%s,\x20%s',_0x1a620c,_0xa9d85e[_0xf600('0x12')][_0xf600('0x15')]);return _0x489c42(_0xa9d85e[_0xf600('0x12')]['message']);}else{logger[_0xf600('0xe')]('UserMailQueue,\x20%s,\x20%s',_0x1a620c,'request\x20sent');_0x489c42(_0xa9d85e[_0xf600('0x16')][_0xf600('0x15')]);}})[_0xf600('0x17')](function(_0x439e2d){logger[_0xf600('0x12')]('UserMailQueue,\x20%s,\x20%s',_0x1a620c,_0x439e2d);_0x5c96d8(_0x439e2d);});});} \ No newline at end of file diff --git a/server/api/userOpenchannelQueue/index.js b/server/api/userOpenchannelQueue/index.js index a52cfb6..ef501af 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 _0xa940=['express','../../components/auth/service','../../config/environment','multer','util','path'];(function(_0x1b0f98,_0x544e04){var _0xaf8dd8=function(_0x1f8c36){while(--_0x1f8c36){_0x1b0f98['push'](_0x1b0f98['shift']());}};_0xaf8dd8(++_0x544e04);}(_0xa940,0x1bf));var _0x0a94=function(_0x22f46c,_0x22641c){_0x22f46c=_0x22f46c-0x0;var _0x5e8f43=_0xa940[_0x22f46c];return _0x5e8f43;};'use strict';var multer=require(_0x0a94('0x0'));var util=require(_0x0a94('0x1'));var path=require(_0x0a94('0x2'));var timeout=require('connect-timeout');var express=require(_0x0a94('0x3'));var router=express['Router']();var auth=require(_0x0a94('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0x0a94('0x5'));module['exports']=router; \ No newline at end of file +var _0x5690=['../../components/auth/service','../../components/interaction/service','exports','multer','util','path','connect-timeout','express','Router'];(function(_0x36988b,_0x4fd583){var _0xd6bd=function(_0x15588e){while(--_0x15588e){_0x36988b['push'](_0x36988b['shift']());}};_0xd6bd(++_0x4fd583);}(_0x5690,0x11a));var _0x0569=function(_0x2aa83a,_0x4b5c0b){_0x2aa83a=_0x2aa83a-0x0;var _0x36a653=_0x5690[_0x2aa83a];return _0x36a653;};'use strict';var multer=require(_0x0569('0x0'));var util=require(_0x0569('0x1'));var path=require(_0x0569('0x2'));var timeout=require(_0x0569('0x3'));var express=require(_0x0569('0x4'));var router=express[_0x0569('0x5')]();var auth=require(_0x0569('0x6'));var interaction=require(_0x0569('0x7'));var config=require('../../config/environment');module[_0x0569('0x8')]=router; \ No newline at end of file diff --git a/server/api/userOpenchannelQueue/userOpenchannelQueue.attributes.js b/server/api/userOpenchannelQueue/userOpenchannelQueue.attributes.js index cfc1428..df4d267 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 _0xb10b=['sequelize','INTEGER'];(function(_0x1fa669,_0x3bbf64){var _0x1aa962=function(_0x301870){while(--_0x301870){_0x1fa669['push'](_0x1fa669['shift']());}};_0x1aa962(++_0x3bbf64);}(_0xb10b,0x12a));var _0xbb10=function(_0x22a028,_0x5bb05e){_0x22a028=_0x22a028-0x0;var _0x3184d4=_0xb10b[_0x22a028];return _0x3184d4;};'use strict';var Sequelize=require(_0xbb10('0x0'));module['exports']={'penalty':{'type':Sequelize[_0xbb10('0x1')],'defaultValue':0x0}}; \ No newline at end of file +var _0xa9e0=['sequelize','exports','INTEGER'];(function(_0x386a09,_0x551d22){var _0x237cad=function(_0x1938ea){while(--_0x1938ea){_0x386a09['push'](_0x386a09['shift']());}};_0x237cad(++_0x551d22);}(_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')]={'penalty':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/userOpenchannelQueue/userOpenchannelQueue.model.js b/server/api/userOpenchannelQueue/userOpenchannelQueue.model.js index aea0d08..c531674 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 _0x5471=['UserOpenchannelQueue','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','./userOpenchannelQueue.attributes','exports','define'];(function(_0x1ebd10,_0x4914b4){var _0x1004d3=function(_0x59e3ba){while(--_0x59e3ba){_0x1ebd10['push'](_0x1ebd10['shift']());}};_0x1004d3(++_0x4914b4);}(_0x5471,0xc1));var _0x1547=function(_0x2c4866,_0x2eb05f){_0x2c4866=_0x2c4866-0x0;var _0x150d6f=_0x5471[_0x2c4866];return _0x150d6f;};'use strict';var _=require('lodash');var util=require(_0x1547('0x0'));var logger=require(_0x1547('0x1'))(_0x1547('0x2'));var moment=require(_0x1547('0x3'));var BPromise=require(_0x1547('0x4'));var rp=require(_0x1547('0x5'));var fs=require('fs');var path=require(_0x1547('0x6'));var rimraf=require(_0x1547('0x7'));var config=require('../../config/environment');var attributes=require(_0x1547('0x8'));module[_0x1547('0x9')]=function(_0x33a2a6,_0x2ec18b){return _0x33a2a6[_0x1547('0xa')](_0x1547('0xb'),attributes,{'tableName':'user_has_openchannel_queues','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x1332=['user_has_openchannel_queues','lodash','util','../../config/logger','api','bluebird','path','rimraf','../../config/environment','./userOpenchannelQueue.attributes','exports','define'];(function(_0x2ed547,_0x28c09b){var _0x2a8a00=function(_0x5c84ba){while(--_0x5c84ba){_0x2ed547['push'](_0x2ed547['shift']());}};_0x2a8a00(++_0x28c09b);}(_0x1332,0xa9));var _0x2133=function(_0xb2fd72,_0x296e2e){_0xb2fd72=_0xb2fd72-0x0;var _0x1f7759=_0x1332[_0xb2fd72];return _0x1f7759;};'use strict';var _=require(_0x2133('0x0'));var util=require(_0x2133('0x1'));var logger=require(_0x2133('0x2'))(_0x2133('0x3'));var moment=require('moment');var BPromise=require(_0x2133('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x2133('0x5'));var rimraf=require(_0x2133('0x6'));var config=require(_0x2133('0x7'));var attributes=require(_0x2133('0x8'));module[_0x2133('0x9')]=function(_0x3c9621,_0x3d01ca){return _0x3c9621[_0x2133('0xa')]('UserOpenchannelQueue',attributes,{'tableName':_0x2133('0xb'),'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 cdb403f..3bdc262 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 _0xc6c5=['request\x20sent','stringify','code','error','message','result','catch','lodash','util','moment','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','client','request','info','UserOpenchannelQueue,\x20%s,\x20%s','debug'];(function(_0x1626c4,_0x1d4694){var _0x3b5725=function(_0x52f549){while(--_0x52f549){_0x1626c4['push'](_0x1626c4['shift']());}};_0x3b5725(++_0x1d4694);}(_0xc6c5,0x16f));var _0x5c6c=function(_0x5af5e6,_0x39f247){_0x5af5e6=_0x5af5e6-0x0;var _0x278e5d=_0xc6c5[_0x5af5e6];return _0x278e5d;};'use strict';var _=require(_0x5c6c('0x0'));var util=require(_0x5c6c('0x1'));var moment=require(_0x5c6c('0x2'));var BPromise=require('bluebird');var rs=require(_0x5c6c('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x5c6c('0x4'))['db'];var utils=require(_0x5c6c('0x5'));var logger=require(_0x5c6c('0x6'))(_0x5c6c('0x7'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x5c6c('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x584252,_0x4dc119,_0x5280ef){return new BPromise(function(_0x837476,_0x325db3){return client[_0x5c6c('0x9')](_0x584252,_0x5280ef)['then'](function(_0x2aaa68){logger[_0x5c6c('0xa')](_0x5c6c('0xb'),_0x4dc119,'request\x20sent');logger[_0x5c6c('0xc')]('UserOpenchannelQueue,\x20%s,\x20%s,\x20%s',_0x4dc119,_0x5c6c('0xd'),JSON[_0x5c6c('0xe')](_0x2aaa68));if(_0x2aaa68['error']){if(_0x2aaa68['error'][_0x5c6c('0xf')]===0x1f4){logger['error'](_0x5c6c('0xb'),_0x4dc119,_0x2aaa68['error']['message']);return _0x325db3(_0x2aaa68[_0x5c6c('0x10')][_0x5c6c('0x11')]);}logger[_0x5c6c('0x10')](_0x5c6c('0xb'),_0x4dc119,_0x2aaa68['error']['message']);return _0x837476(_0x2aaa68[_0x5c6c('0x10')][_0x5c6c('0x11')]);}else{logger[_0x5c6c('0xa')]('UserOpenchannelQueue,\x20%s,\x20%s',_0x4dc119,'request\x20sent');_0x837476(_0x2aaa68[_0x5c6c('0x12')][_0x5c6c('0x11')]);}})[_0x5c6c('0x13')](function(_0x716c72){logger[_0x5c6c('0x10')](_0x5c6c('0xb'),_0x4dc119,_0x716c72);_0x325db3(_0x716c72);});});} \ No newline at end of file +var _0x5830=['message','catch','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','then','info','request\x20sent','stringify','error','UserOpenchannelQueue,\x20%s,\x20%s'];(function(_0x2dafbe,_0x5d04de){var _0x58a45a=function(_0x50ac96){while(--_0x50ac96){_0x2dafbe['push'](_0x2dafbe['shift']());}};_0x58a45a(++_0x5d04de);}(_0x5830,0x9a));var _0x0583=function(_0x4b9f58,_0x25032c){_0x4b9f58=_0x4b9f58-0x0;var _0x2dfe99=_0x5830[_0x4b9f58];return _0x2dfe99;};'use strict';var _=require(_0x0583('0x0'));var util=require(_0x0583('0x1'));var moment=require('moment');var BPromise=require(_0x0583('0x2'));var rs=require(_0x0583('0x3'));var fs=require('fs');var Redis=require(_0x0583('0x4'));var db=require(_0x0583('0x5'))['db'];var utils=require(_0x0583('0x6'));var logger=require(_0x0583('0x7'))(_0x0583('0x8'));var config=require('../../config/environment');var jayson=require(_0x0583('0x9'));var client=jayson[_0x0583('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x4382da,_0x4b6727,_0x15fa80){return new BPromise(function(_0x5413ef,_0x5e994a){return client['request'](_0x4382da,_0x15fa80)[_0x0583('0xb')](function(_0x50a569){logger[_0x0583('0xc')]('UserOpenchannelQueue,\x20%s,\x20%s',_0x4b6727,_0x0583('0xd'));logger['debug']('UserOpenchannelQueue,\x20%s,\x20%s,\x20%s',_0x4b6727,'request\x20sent',JSON[_0x0583('0xe')](_0x50a569));if(_0x50a569[_0x0583('0xf')]){if(_0x50a569[_0x0583('0xf')]['code']===0x1f4){logger[_0x0583('0xf')](_0x0583('0x10'),_0x4b6727,_0x50a569[_0x0583('0xf')][_0x0583('0x11')]);return _0x5e994a(_0x50a569[_0x0583('0xf')][_0x0583('0x11')]);}logger[_0x0583('0xf')](_0x0583('0x10'),_0x4b6727,_0x50a569['error']['message']);return _0x5413ef(_0x50a569['error']['message']);}else{logger[_0x0583('0xc')](_0x0583('0x10'),_0x4b6727,_0x0583('0xd'));_0x5413ef(_0x50a569['result'][_0x0583('0x11')]);}})[_0x0583('0x12')](function(_0x3f648c){logger[_0x0583('0xf')](_0x0583('0x10'),_0x4b6727,_0x3f648c);_0x5e994a(_0x3f648c);});});} \ No newline at end of file diff --git a/server/api/userProfile/index.js b/server/api/userProfile/index.js index 7c49f0b..48d4bec 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 _0x739d=['describe','/:id','isAuthenticated','/:id/sections','/:id/resources','getResources','post','create','/:id/clone','put','delete','destroy','removeSections','exports','multer','util','path','express','Router','../../components/auth/service','../../components/interaction/service','get','/describe'];(function(_0x171ff6,_0x17107f){var _0x68df4e=function(_0x27acef){while(--_0x27acef){_0x171ff6['push'](_0x171ff6['shift']());}};_0x68df4e(++_0x17107f);}(_0x739d,0x167));var _0xd739=function(_0x46910c,_0x3bb530){_0x46910c=_0x46910c-0x0;var _0x1dfcd4=_0x739d[_0x46910c];return _0x1dfcd4;};'use strict';var multer=require(_0xd739('0x0'));var util=require(_0xd739('0x1'));var path=require(_0xd739('0x2'));var timeout=require('connect-timeout');var express=require(_0xd739('0x3'));var router=express[_0xd739('0x4')]();var auth=require(_0xd739('0x5'));var interaction=require(_0xd739('0x6'));var config=require('../../config/environment');var controller=require('./userProfile.controller');router[_0xd739('0x7')]('/',auth['isAuthenticated'](),controller['index']);router[_0xd739('0x7')](_0xd739('0x8'),auth['isAuthenticated'](),controller[_0xd739('0x9')]);router[_0xd739('0x7')](_0xd739('0xa'),auth[_0xd739('0xb')](),controller['show']);router['get'](_0xd739('0xc'),auth[_0xd739('0xb')](),controller['getSections']);router[_0xd739('0x7')](_0xd739('0xd'),auth[_0xd739('0xb')](),controller[_0xd739('0xe')]);router[_0xd739('0xf')]('/',auth[_0xd739('0xb')](),controller[_0xd739('0x10')]);router[_0xd739('0xf')](_0xd739('0x11'),auth['isAuthenticated'](),controller['clone']);router[_0xd739('0xf')](_0xd739('0xc'),auth[_0xd739('0xb')](),controller['addSections']);router[_0xd739('0xf')](_0xd739('0xd'),auth[_0xd739('0xb')](),controller['addResources']);router[_0xd739('0x12')]('/:id',auth[_0xd739('0xb')](),controller['update']);router[_0xd739('0x13')](_0xd739('0xa'),auth[_0xd739('0xb')](),controller[_0xd739('0x14')]);router[_0xd739('0x13')]('/:id/sections',auth[_0xd739('0xb')](),controller[_0xd739('0x15')]);router[_0xd739('0x13')](_0xd739('0xd'),auth[_0xd739('0xb')](),controller['removeResources']);module[_0xd739('0x16')]=router; \ No newline at end of file +var _0x3b08=['index','/describe','isAuthenticated','/:id','show','/:id/sections','getResources','post','/:id/clone','addSections','/:id/resources','addResources','delete','destroy','removeSections','exports','path','connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment','get'];(function(_0x144b16,_0x528837){var _0x50369d=function(_0x589ed9){while(--_0x589ed9){_0x144b16['push'](_0x144b16['shift']());}};_0x50369d(++_0x528837);}(_0x3b08,0xf6));var _0x83b0=function(_0x3fbcdf,_0x5e47f4){_0x3fbcdf=_0x3fbcdf-0x0;var _0x1a170f=_0x3b08[_0x3fbcdf];return _0x1a170f;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x83b0('0x0'));var timeout=require(_0x83b0('0x1'));var express=require(_0x83b0('0x2'));var router=express['Router']();var auth=require(_0x83b0('0x3'));var interaction=require(_0x83b0('0x4'));var config=require(_0x83b0('0x5'));var controller=require('./userProfile.controller');router[_0x83b0('0x6')]('/',auth['isAuthenticated'](),controller[_0x83b0('0x7')]);router[_0x83b0('0x6')](_0x83b0('0x8'),auth[_0x83b0('0x9')](),controller['describe']);router[_0x83b0('0x6')](_0x83b0('0xa'),auth[_0x83b0('0x9')](),controller[_0x83b0('0xb')]);router['get'](_0x83b0('0xc'),auth[_0x83b0('0x9')](),controller['getSections']);router[_0x83b0('0x6')]('/:id/resources',auth[_0x83b0('0x9')](),controller[_0x83b0('0xd')]);router[_0x83b0('0xe')]('/',auth[_0x83b0('0x9')](),controller['create']);router[_0x83b0('0xe')](_0x83b0('0xf'),auth[_0x83b0('0x9')](),controller['clone']);router[_0x83b0('0xe')](_0x83b0('0xc'),auth[_0x83b0('0x9')](),controller[_0x83b0('0x10')]);router[_0x83b0('0xe')](_0x83b0('0x11'),auth[_0x83b0('0x9')](),controller[_0x83b0('0x12')]);router['put'](_0x83b0('0xa'),auth[_0x83b0('0x9')](),controller['update']);router[_0x83b0('0x13')](_0x83b0('0xa'),auth[_0x83b0('0x9')](),controller[_0x83b0('0x14')]);router[_0x83b0('0x13')](_0x83b0('0xc'),auth[_0x83b0('0x9')](),controller[_0x83b0('0x15')]);router[_0x83b0('0x13')](_0x83b0('0x11'),auth[_0x83b0('0x9')](),controller['removeResources']);module[_0x83b0('0x16')]=router; \ No newline at end of file diff --git a/server/api/userProfile/userProfile.attributes.js b/server/api/userProfile/userProfile.attributes.js index 9827a0a..636bfb4 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 _0xb2d3=['getDataValue','split','sequelize','exports','STRING','name','setDataValue','crudPermissions','join'];(function(_0x2846d7,_0x2f0287){var _0x3fac84=function(_0x36c7f1){while(--_0x36c7f1){_0x2846d7['push'](_0x2846d7['shift']());}};_0x3fac84(++_0x2f0287);}(_0xb2d3,0x197));var _0x3b2d=function(_0x33154d,_0x854047){_0x33154d=_0x33154d-0x0;var _0x3b2f03=_0xb2d3[_0x33154d];return _0x3b2f03;};'use strict';var Sequelize=require(_0x3b2d('0x0'));module[_0x3b2d('0x1')]={'name':{'type':Sequelize[_0x3b2d('0x2')],'allowNull':![],'unique':_0x3b2d('0x3')},'crudPermissions':{'type':Sequelize[_0x3b2d('0x2')],'set':function(_0x4c84d6){this[_0x3b2d('0x4')](_0x3b2d('0x5'),_0x4c84d6?_0x4c84d6[_0x3b2d('0x6')](''):[]);},'get':function(){return this[_0x3b2d('0x7')](_0x3b2d('0x5'))?this[_0x3b2d('0x7')](_0x3b2d('0x5'))[_0x3b2d('0x8')](''):[];},'allowNull':![],'defaultValue':'r'},'description':{'type':Sequelize[_0x3b2d('0x2')],'allowNull':!![]}}; \ No newline at end of file +var _0xc542=['exports','STRING','name','getDataValue','crudPermissions','sequelize'];(function(_0x3c1134,_0x11cb33){var _0x185e0e=function(_0x5e1ce2){while(--_0x5e1ce2){_0x3c1134['push'](_0x3c1134['shift']());}};_0x185e0e(++_0x11cb33);}(_0xc542,0xd1));var _0x2c54=function(_0x484e36,_0x4482d8){_0x484e36=_0x484e36-0x0;var _0xafc85d=_0xc542[_0x484e36];return _0xafc85d;};'use strict';var Sequelize=require(_0x2c54('0x0'));module[_0x2c54('0x1')]={'name':{'type':Sequelize[_0x2c54('0x2')],'allowNull':![],'unique':_0x2c54('0x3')},'crudPermissions':{'type':Sequelize[_0x2c54('0x2')],'set':function(_0x14c6f8){this['setDataValue']('crudPermissions',_0x14c6f8?_0x14c6f8['join'](''):[]);},'get':function(){return this[_0x2c54('0x4')](_0x2c54('0x5'))?this['getDataValue'](_0x2c54('0x5'))['split'](''):[];},'allowNull':![],'defaultValue':'r'},'description':{'type':Sequelize[_0x2c54('0x2')],'allowNull':!![]}}; \ No newline at end of file diff --git a/server/api/userProfile/userProfile.controller.js b/server/api/userProfile/userProfile.controller.js index 1a8616f..47d2ef4 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 _0xb4b4=['cannedanswers','CannedAnswer','dispositions','Disposition','customdashboards','intervals','pauses','Pause','Schedule','Sound','tags','templates','Template','triggers','Trigger','trunks','Trunk','Variable','plugins','Plugin','extractedreports','Reports','metrics','AnalyticMetric','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','ejs','lodash','squel','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','redis','defaults','socket.io-emitter','./userProfile.socket','register','sendStatus','status','count','offset','limit','set','apply','reject','then','destroy','end','error','stack','name','index','UserProfile','rawAttributes','fieldName','type','key','model','map','query','keys','filters','intersection','fields','attributes','hasOwnProperty','nolimit','order','sort','where','filter','merge','VIRTUAL','options','includeAll','findAll','catch','params','length','include','create','body','clone','find','get','omit','createdAt','crudPermissions','updatedAt','sequelize','transaction','UserProfileSection','each','autoAssociation','UserProfileResource','sectionId','userProfileId','Resources','describe','push','removeSections','ids','enabled','includes','isEmpty','subsections','findOne','Dashboard','forEach','resourceId','addResources','bulkCreate','removeResources','getResources','section','undefined','Sequelize','ValidationError','Unknown\x20section','mergeResources','childModel','Invalid\x20section\x20\x27','parentSections','ignore','pick','AnalyticExtractedReport','associatedResources','field','foreignKey','reportType','default','reportId','DefaultReports','custom','CustomReports','rows','CmContact','Tag','color','tag','ThroughTags','value','toLowerCase','squareprojects','SquareProject','SquareOdbc','SquareRecording','projectName','projects','contacts','Lists','ListId','lists','CmList','CmCustomField','chatqueues','ChatQueue','chatwebsites','ChatWebsite','faxqueues','faxaccounts','FaxAccount','inboundroutes','internalroutes','outboundroutes','VoiceExtension','voicemails','voicerecordings','VoiceRecording','Agents','membername','Telephones','User','role','telephone','VoiceQueues','queue','VoiceQueue','QueueCampaigns','musiconholds','chanspies','VoiceChanSpy','voiceprefixes','VoicePrefix','ivrcampaigns','mailqueues','MailQueue','MailAccount','mailsubstatuses','MailSubstatus','openchannelqueues','OpenchannelQueue','openchannelaccounts','OpenchannelAccount','SmsQueue','smsaccounts','teams','Team','queuecampaigns','users','Users','admin','zendeskaccounts','ZendeskAccount','salesforceaccounts','freshdeskaccounts','FreshdeskAccount','sugarcrmaccounts','SugarcrmAccount','zohoaccounts','vtigeraccounts'];(function(_0x281275,_0x283494){var _0x2805ed=function(_0xebd591){while(--_0xebd591){_0x281275['push'](_0x281275['shift']());}};_0x2805ed(++_0x283494);}(_0xb4b4,0x1da));var _0x4b4b=function(_0x422905,_0x3bce3a){_0x422905=_0x422905-0x0;var _0x33dc6c=_0xb4b4[_0x422905];return _0x33dc6c;};'use strict';var pdf=require(_0x4b4b('0x0'));var emlformat=require(_0x4b4b('0x1'));var rimraf=require(_0x4b4b('0x2'));var zipdir=require(_0x4b4b('0x3'));var jsonpatch=require(_0x4b4b('0x4'));var rp=require(_0x4b4b('0x5'));var moment=require(_0x4b4b('0x6'));var BPromise=require(_0x4b4b('0x7'));var Mustache=require(_0x4b4b('0x8'));var util=require(_0x4b4b('0x9'));var path=require('path');var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x4b4b('0xa'));var fs=require('fs');var _=require(_0x4b4b('0xb'));var squel=require(_0x4b4b('0xc'));var crypto=require('crypto');var jsforce=require(_0x4b4b('0xd'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x4b4b('0xe'));var Papa=require(_0x4b4b('0xf'));var Redis=require(_0x4b4b('0x10'));var authService=require(_0x4b4b('0x11'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x4b4b('0x12'))('api');var utils=require(_0x4b4b('0x13'));var config=require(_0x4b4b('0x14'));var db=require(_0x4b4b('0x15'))['db'];config[_0x4b4b('0x16')]=_[_0x4b4b('0x17')](config[_0x4b4b('0x16')],{'host':'localhost','port':0x18eb});var socket=require(_0x4b4b('0x18'))(new Redis(config['redis']));require(_0x4b4b('0x19'))[_0x4b4b('0x1a')](socket);function respondWithStatusCode(_0x2404c7,_0x41f5f0){_0x41f5f0=_0x41f5f0||0xcc;return function(_0x354544){if(_0x354544){return _0x2404c7[_0x4b4b('0x1b')](_0x41f5f0);}return _0x2404c7[_0x4b4b('0x1c')](_0x41f5f0)['end']();};}function respondWithResult(_0x356409,_0x39c0c2){_0x39c0c2=_0x39c0c2||0xc8;return function(_0x149ab3){if(_0x149ab3){return _0x356409[_0x4b4b('0x1c')](_0x39c0c2)['json'](_0x149ab3);}};}function respondWithFilteredResult(_0x18cfd1,_0x5d42e2){return function(_0x1656ef){if(_0x1656ef){var _0x5edf5d=_0x1656ef[_0x4b4b('0x1d')],_0x1fc78a=_0x5d42e2[_0x4b4b('0x1e')],_0x54bc8f=_0x5d42e2[_0x4b4b('0x1e')]+_0x5d42e2[_0x4b4b('0x1f')],_0x5c23d5;if(_0x54bc8f>=_0x5edf5d){_0x54bc8f=_0x5edf5d;_0x5c23d5=0xc8;}else{_0x5c23d5=0xce;}_0x18cfd1['status'](_0x5c23d5);return _0x18cfd1[_0x4b4b('0x20')]('Content-Range',_0x1fc78a+'-'+_0x54bc8f+'/'+_0x5edf5d)['json'](_0x1656ef);}return null;};}function patchUpdates(_0x47300e){return function(_0x129e0f){try{jsonpatch[_0x4b4b('0x21')](_0x129e0f,_0x47300e,!![]);}catch(_0x466db2){return BPromise[_0x4b4b('0x22')](_0x466db2);}return _0x129e0f['save']();};}function saveUpdates(_0x2f20f7,_0x20c1ea){return function(_0x3089a9){if(_0x3089a9){return _0x3089a9['update'](_0x2f20f7)[_0x4b4b('0x23')](function(_0x37d65c){return _0x37d65c;});}return null;};}function removeEntity(_0x939d33,_0x1292b5){return function(_0x37bd19){if(_0x37bd19){return _0x37bd19[_0x4b4b('0x24')]()['then'](function(){_0x939d33[_0x4b4b('0x1c')](0xcc)[_0x4b4b('0x25')]();});}};}function handleEntityNotFound(_0x6bf81,_0x5f2070){return function(_0x5ec02e){if(!_0x5ec02e){_0x6bf81[_0x4b4b('0x1b')](0x194);}return _0x5ec02e;};}function handleError(_0x505e4d,_0x523418){_0x523418=_0x523418||0x1f4;return function(_0x4a704b){logger[_0x4b4b('0x26')](_0x4a704b[_0x4b4b('0x27')]);if(_0x4a704b[_0x4b4b('0x28')]){delete _0x4a704b[_0x4b4b('0x28')];}_0x505e4d[_0x4b4b('0x1c')](_0x523418)['send'](_0x4a704b);};}exports[_0x4b4b('0x29')]=function(_0x34cc16,_0x5b126b){var _0xa70c35={},_0x401868={},_0x1d0059={'count':0x0,'rows':[]};var _0x58e05f=_['map'](db[_0x4b4b('0x2a')][_0x4b4b('0x2b')],function(_0x97c2af){return{'name':_0x97c2af[_0x4b4b('0x2c')],'type':_0x97c2af[_0x4b4b('0x2d')][_0x4b4b('0x2e')]};});_0x401868[_0x4b4b('0x2f')]=_[_0x4b4b('0x30')](_0x58e05f,_0x4b4b('0x28'));_0x401868[_0x4b4b('0x31')]=_[_0x4b4b('0x32')](_0x34cc16[_0x4b4b('0x31')]);_0x401868[_0x4b4b('0x33')]=_[_0x4b4b('0x34')](_0x401868['model'],_0x401868[_0x4b4b('0x31')]);_0xa70c35['attributes']=_[_0x4b4b('0x34')](_0x401868[_0x4b4b('0x2f')],qs[_0x4b4b('0x35')](_0x34cc16[_0x4b4b('0x31')][_0x4b4b('0x35')]));_0xa70c35[_0x4b4b('0x36')]=_0xa70c35[_0x4b4b('0x36')]['length']?_0xa70c35[_0x4b4b('0x36')]:_0x401868[_0x4b4b('0x2f')];if(!_0x34cc16[_0x4b4b('0x31')][_0x4b4b('0x37')](_0x4b4b('0x38'))){_0xa70c35[_0x4b4b('0x1f')]=qs[_0x4b4b('0x1f')](_0x34cc16[_0x4b4b('0x31')][_0x4b4b('0x1f')]);_0xa70c35[_0x4b4b('0x1e')]=qs['offset'](_0x34cc16['query']['offset']);}_0xa70c35[_0x4b4b('0x39')]=qs[_0x4b4b('0x3a')](_0x34cc16[_0x4b4b('0x31')][_0x4b4b('0x3a')]);_0xa70c35[_0x4b4b('0x3b')]=qs[_0x4b4b('0x33')](_['pick'](_0x34cc16[_0x4b4b('0x31')],_0x401868[_0x4b4b('0x33')]));if(_0x34cc16[_0x4b4b('0x31')][_0x4b4b('0x3c')]){_0xa70c35[_0x4b4b('0x3b')]=_[_0x4b4b('0x3d')](_0xa70c35[_0x4b4b('0x3b')],{'$or':_[_0x4b4b('0x30')](_0x58e05f,function(_0xaec270){if(_0xaec270[_0x4b4b('0x2d')]!==_0x4b4b('0x3e')){var _0x2e0fbc={};_0x2e0fbc[_0xaec270[_0x4b4b('0x28')]]={'$like':'%'+_0x34cc16[_0x4b4b('0x31')]['filter']+'%'};return _0x2e0fbc;}})});}_0xa70c35=_[_0x4b4b('0x3d')]({},_0xa70c35,_0x34cc16[_0x4b4b('0x3f')]);var _0x71bebc={'where':_0xa70c35[_0x4b4b('0x3b')]};return db[_0x4b4b('0x2a')]['count'](_0x71bebc)[_0x4b4b('0x23')](function(_0x2514b1){_0x1d0059['count']=_0x2514b1;if(_0x34cc16[_0x4b4b('0x31')][_0x4b4b('0x40')]){_0xa70c35['include']=[{'all':!![]}];}return db[_0x4b4b('0x2a')][_0x4b4b('0x41')](_0xa70c35);})[_0x4b4b('0x23')](function(_0x43dd63){_0x1d0059['rows']=_0x43dd63;return _0x1d0059;})[_0x4b4b('0x23')](respondWithFilteredResult(_0x5b126b,_0xa70c35))[_0x4b4b('0x42')](handleError(_0x5b126b,null));};exports['show']=function(_0x3e3603,_0x665c64){var _0x56bdcc={'raw':![],'where':{'id':_0x3e3603[_0x4b4b('0x43')]['id']}},_0xb2fcf0={};_0xb2fcf0[_0x4b4b('0x2f')]=_[_0x4b4b('0x32')](db['UserProfile'][_0x4b4b('0x2b')]);_0xb2fcf0[_0x4b4b('0x31')]=_['keys'](_0x3e3603[_0x4b4b('0x31')]);_0xb2fcf0['filters']=_['intersection'](_0xb2fcf0[_0x4b4b('0x2f')],_0xb2fcf0[_0x4b4b('0x31')]);_0x56bdcc[_0x4b4b('0x36')]=_[_0x4b4b('0x34')](_0xb2fcf0[_0x4b4b('0x2f')],qs['fields'](_0x3e3603[_0x4b4b('0x31')][_0x4b4b('0x35')]));_0x56bdcc[_0x4b4b('0x36')]=_0x56bdcc[_0x4b4b('0x36')][_0x4b4b('0x44')]?_0x56bdcc[_0x4b4b('0x36')]:_0xb2fcf0[_0x4b4b('0x2f')];if(_0x3e3603[_0x4b4b('0x31')][_0x4b4b('0x40')]){_0x56bdcc[_0x4b4b('0x45')]=[{'all':!![]}];}_0x56bdcc=_[_0x4b4b('0x3d')]({},_0x56bdcc,_0x3e3603[_0x4b4b('0x3f')]);return db[_0x4b4b('0x2a')]['find'](_0x56bdcc)[_0x4b4b('0x23')](handleEntityNotFound(_0x665c64,null))['then'](respondWithResult(_0x665c64,null))[_0x4b4b('0x42')](handleError(_0x665c64,null));};exports['create']=function(_0x10c1d1,_0x51c40f){return db[_0x4b4b('0x2a')][_0x4b4b('0x46')](_0x10c1d1[_0x4b4b('0x47')],{})[_0x4b4b('0x23')](respondWithResult(_0x51c40f,0xc9))['catch'](handleError(_0x51c40f,null));};exports[_0x4b4b('0x48')]=function(_0x5436f8,_0xaf0c5c){var _0x50eeca={'where':{'id':_0x5436f8[_0x4b4b('0x43')]['id']}},_0xf580f7={};_0xf580f7[_0x4b4b('0x2f')]=_[_0x4b4b('0x32')](db[_0x4b4b('0x2a')]['rawAttributes']);_0x50eeca[_0x4b4b('0x36')]=_['intersection'](_0xf580f7[_0x4b4b('0x2f')],qs[_0x4b4b('0x35')](_0x5436f8[_0x4b4b('0x31')][_0x4b4b('0x35')]));_0x50eeca[_0x4b4b('0x36')]=_0x50eeca['attributes'][_0x4b4b('0x44')]?_0x50eeca['attributes']:_0xf580f7[_0x4b4b('0x2f')];if(_0x5436f8['query']['includeAll']){_0x50eeca[_0x4b4b('0x45')]=[{'all':!![]}];}_0x50eeca=_[_0x4b4b('0x3d')]({},_0x50eeca,_0x5436f8[_0x4b4b('0x3f')]);return db[_0x4b4b('0x2a')][_0x4b4b('0x49')](_0x50eeca)[_0x4b4b('0x23')](handleEntityNotFound(_0xaf0c5c,null))['then'](function(_0x34d4f3){if(_0x34d4f3){var _0x10f8ed=_0x34d4f3[_0x4b4b('0x4a')]({'plain':!![]});_0x10f8ed=qs[_0x4b4b('0x4b')](_0x10f8ed,['id',_0x4b4b('0x4c'),'updatedAt',_0x4b4b('0x4d')]);_0x5436f8[_0x4b4b('0x47')]=_[_0x4b4b('0x4b')](_0x5436f8[_0x4b4b('0x47')],['id',_0x4b4b('0x4c'),_0x4b4b('0x4e')]);return db[_0x4b4b('0x4f')][_0x4b4b('0x50')](function(_0x4c6170){return db['UserProfile'][_0x4b4b('0x46')](_['merge'](_0x10f8ed,_0x5436f8[_0x4b4b('0x47')]),{'include':_0x5436f8[_0x4b4b('0x31')][_0x4b4b('0x40')]?[{'all':!![]}]:undefined,'transaction':_0x4c6170})[_0x4b4b('0x23')](function(_0x57d6f1){var _0x334400=_0x57d6f1[_0x4b4b('0x4a')]({'plain':!![]});return db[_0x4b4b('0x51')][_0x4b4b('0x41')]({'where':{'userProfileId':_0x5436f8[_0x4b4b('0x43')]['id']},'raw':!![]})[_0x4b4b('0x23')](function(_0x599621){if(_0x599621){return BPromise[_0x4b4b('0x52')](_0x599621,function(_0x5f537a){return new BPromise(function(_0xfc019a,_0x1c422f){if(_0x5f537a[_0x4b4b('0x53')]===null||_0x5f537a[_0x4b4b('0x53')]===0x1)_0xfc019a(null);return db[_0x4b4b('0x54')][_0x4b4b('0x41')]({'where':{'sectionId':_0x5f537a['id']},'raw':!![]})[_0x4b4b('0x23')](function(_0x28074f){var _0xde4943=_['map'](_0x28074f,function(_0x22c01f){return qs['omit'](_0x22c01f,['id',_0x4b4b('0x4c'),_0x4b4b('0x4e'),_0x4b4b('0x55')]);});_0xfc019a(_0xde4943);})[_0x4b4b('0x42')](function(_0x3b044e){_0x1c422f(_0x3b044e);});})[_0x4b4b('0x23')](function(_0xacdd97){var _0x2171e9=qs[_0x4b4b('0x4b')](_0x5f537a,['id',_0x4b4b('0x4c'),_0x4b4b('0x4e')]);_0x2171e9[_0x4b4b('0x56')]=_0x334400['id'];if(_0xacdd97)_0x2171e9[_0x4b4b('0x57')]=_0xacdd97;return _0x2171e9;})[_0x4b4b('0x23')](function(_0x190b9d){return db[_0x4b4b('0x51')][_0x4b4b('0x46')](_0x190b9d,{'include':[{'model':db[_0x4b4b('0x54')],'as':_0x4b4b('0x57')}],'raw':!![],'transaction':_0x4c6170});});})[_0x4b4b('0x23')](function(){return _0x334400;});}});});});}})[_0x4b4b('0x23')](respondWithResult(_0xaf0c5c,0xc9))[_0x4b4b('0x42')](handleError(_0xaf0c5c,null));};exports['update']=function(_0x5440d7,_0x27313e){if(_0x5440d7['body']['id']){delete _0x5440d7[_0x4b4b('0x47')]['id'];}return db[_0x4b4b('0x2a')]['find']({'where':{'id':_0x5440d7[_0x4b4b('0x43')]['id']}})[_0x4b4b('0x23')](handleEntityNotFound(_0x27313e,null))[_0x4b4b('0x23')](saveUpdates(_0x5440d7[_0x4b4b('0x47')],null))[_0x4b4b('0x23')](respondWithResult(_0x27313e,null))[_0x4b4b('0x42')](handleError(_0x27313e,null));};exports[_0x4b4b('0x24')]=function(_0x14b242,_0x1079b1){return db['UserProfile'][_0x4b4b('0x49')]({'where':{'id':_0x14b242[_0x4b4b('0x43')]['id']}})[_0x4b4b('0x23')](handleEntityNotFound(_0x1079b1,null))[_0x4b4b('0x23')](removeEntity(_0x1079b1,null))['catch'](handleError(_0x1079b1,null));};exports['describe']=function(_0x107451,_0x25f641){return db[_0x4b4b('0x2a')][_0x4b4b('0x58')]()[_0x4b4b('0x23')](respondWithResult(_0x25f641,null))[_0x4b4b('0x42')](handleError(_0x25f641,null));};exports['addSections']=function(_0x12ad6f,_0x3b21f3){var _0x429b79=_0x12ad6f[_0x4b4b('0x47')];return db[_0x4b4b('0x2a')]['find']({'where':{'id':_0x12ad6f[_0x4b4b('0x43')]['id']}})[_0x4b4b('0x23')](handleEntityNotFound(_0x3b21f3,null))[_0x4b4b('0x23')](function(_0x5b0fbf){if(_0x5b0fbf){return db['sequelize'][_0x4b4b('0x50')](function(_0x757663){return db['UserProfileSection'][_0x4b4b('0x24')]({'where':{'userProfileId':_0x12ad6f['params']['id'],'sectionId':_[_0x4b4b('0x30')](_0x429b79,function(_0x59176c){return _0x59176c[_0x4b4b('0x55')];})},'transaction':_0x757663})[_0x4b4b('0x23')](function(){var _0x55946e=_[_0x4b4b('0x30')](_0x429b79,function(_0x1cb5b2){_0x1cb5b2[_0x4b4b('0x56')]=_0x12ad6f[_0x4b4b('0x43')]['id'];return _0x1cb5b2;});var _0x553688=[];return BPromise[_0x4b4b('0x52')](_0x55946e,function(_0xb05bed){return db['UserProfileSection'][_0x4b4b('0x46')](_0xb05bed,{'include':[{'model':db[_0x4b4b('0x54')],'as':'Resources'}],'raw':!![],'transaction':_0x757663})['then'](function(_0xfd621f){_0x553688[_0x4b4b('0x59')](_0xfd621f['get']({'plain':!![]}));});})[_0x4b4b('0x23')](function(){return _0x553688;});});});}})[_0x4b4b('0x23')](function(_0xc20337){return _0xc20337;})['then'](respondWithResult(_0x3b21f3,null))['catch'](handleError(_0x3b21f3,null));};exports[_0x4b4b('0x5a')]=function(_0x43af2c,_0x521903){var _0xb20a2a;return db[_0x4b4b('0x2a')][_0x4b4b('0x49')]({'where':{'id':_0x43af2c['params']['id']},'attributes':['id',_0x4b4b('0x28')]})[_0x4b4b('0x23')](handleEntityNotFound(_0x521903,null))[_0x4b4b('0x23')](function(_0x153579){if(_0x153579){_0xb20a2a=_0x153579;return db['UserProfileSection'][_0x4b4b('0x24')]({'where':{'userProfileId':_0x43af2c[_0x4b4b('0x43')]['id'],'sectionId':_0x43af2c['query'][_0x4b4b('0x5b')]}});}})['then'](function(){return _0xb20a2a;})[_0x4b4b('0x23')](respondWithStatusCode(_0x521903,null))['catch'](handleError(_0x521903,null));};exports['getSections']=function(_0x3f6712,_0x1b3e63){var _0x10bcf2=[];var _0x187249=[];return db['UserProfileSection']['findAll']({'where':{'userProfileId':_0x3f6712[_0x4b4b('0x43')]['id']},'raw':!![]})[_0x4b4b('0x23')](function(_0x591926){_0x10bcf2=_[_0x4b4b('0x3c')](_0x591926,function(_0x307a37){return _0x307a37[_0x4b4b('0x5c')]===0x1||_[_0x4b4b('0x5d')]([0x3eb,0x709],_0x307a37[_0x4b4b('0x55')]);});if(!_[_0x4b4b('0x5e')](_0x10bcf2)){return _[_0x4b4b('0x30')](_0x10bcf2,function(_0x4d2e4){return _0x4d2e4[_0x4b4b('0x55')];});}else{return;}})[_0x4b4b('0x23')](function(_0x11c253){if(_0x11c253)_0x187249=_0x11c253;if(_[_0x4b4b('0x5d')](_0x187249,0x64)){var _0x152dc8=_['find'](_0x10bcf2,{'sectionId':0x64});return hasDefaultDashboard(_0x152dc8)[_0x4b4b('0x23')](function(_0x37c40e){return _[_0x4b4b('0x30')](_0x10bcf2,function(_0x11235f){if(_0x11235f[_0x4b4b('0x55')]===0x64){_0x11235f[_0x4b4b('0x5f')]=_0x37c40e;}return _0x11235f;});});}else{return;}})['then'](function(_0xc5ce2d){if(_0xc5ce2d)_0x10bcf2=_0xc5ce2d;if(_[_0x4b4b('0x5d')](_0x187249,0x3eb)){var _0x50adb1=_[_0x4b4b('0x49')](_0x10bcf2,{'sectionId':0x3eb});return getCustomDashboards(_0x50adb1)[_0x4b4b('0x23')](function(_0x3b9806){return _[_0x4b4b('0x30')](_0x10bcf2,function(_0x4a2944){if(_0x50adb1[_0x4b4b('0x5c')]){if(_0x4a2944[_0x4b4b('0x55')]===0x3eb){_0x4a2944[_0x4b4b('0x5f')]=_0x3b9806;}}else{if(_0x4a2944[_0x4b4b('0x55')]===0x64){_0x4a2944[_0x4b4b('0x5f')]=_0x3b9806;}}return _0x4a2944;});});}else{return;}})[_0x4b4b('0x23')](function(_0x584626){if(_0x584626)_0x10bcf2=_0x584626;if(_[_0x4b4b('0x5d')](_0x187249,0x709)){var _0x40be15=_[_0x4b4b('0x49')](_0x10bcf2,{'sectionId':0x709});return getPlugins(_0x40be15)[_0x4b4b('0x23')](function(_0x8a6d1f){if(_0x40be15['enabled']){return _['map'](_0x10bcf2,function(_0x8153c8){if(_0x8153c8[_0x4b4b('0x55')]===0x709){_0x8153c8[_0x4b4b('0x5f')]=_0x8a6d1f;}return _0x8153c8;});}else{var _0x4c723c={'sectionId':0x76c,'enabled':0x1,'subsections':_0x8a6d1f};var _0x531e29=_[_0x4b4b('0x30')](_0x10bcf2);_0x531e29['push'](_0x4c723c);return _0x531e29;}});}else{return;}})['then'](function(_0x1fabeb){if(_0x1fabeb)_0x10bcf2=_0x1fabeb;return _[_0x4b4b('0x3c')](_0x10bcf2,[_0x4b4b('0x5c'),0x1]);})[_0x4b4b('0x23')](respondWithResult(_0x1b3e63,null))['catch'](handleError(_0x1b3e63,null));};function hasDefaultDashboard(_0x40d64a){var _0x500ef6=[0x65];return new BPromise(function(_0x565022,_0xfb39af){try{if(_0x40d64a[_0x4b4b('0x53')]){_0x565022(_0x500ef6);}else{return db[_0x4b4b('0x54')][_0x4b4b('0x60')]({'where':{'sectionId':_0x40d64a['id']},'raw':!![]})[_0x4b4b('0x23')](function(_0x3fe94f){_0x3fe94f?_0x565022(_0x500ef6):_0x565022();});}}catch(_0x4eb017){_0xfb39af(_0x4eb017);}});}function getCustomDashboards(_0x43c6d8){var _0x38bd19=[];return new BPromise(function(_0x1526b6,_0x1f075e){try{if(_0x43c6d8[_0x4b4b('0x53')]){return db[_0x4b4b('0x61')][_0x4b4b('0x41')]({'raw':!![]})[_0x4b4b('0x23')](function(_0x2ebc20){_0x2ebc20['forEach'](function(_0x3413d4){_0x38bd19[_0x4b4b('0x59')](_0x3413d4['id']+0x1869f);});_0x1526b6(_0x38bd19);});}else{return db[_0x4b4b('0x54')][_0x4b4b('0x41')]({'where':{'sectionId':_0x43c6d8['id']},'raw':!![]})[_0x4b4b('0x23')](function(_0x486281){_0x486281[_0x4b4b('0x62')](function(_0x3087e7){_0x38bd19[_0x4b4b('0x59')](_0x3087e7[_0x4b4b('0x63')]+0x1869f);});_0x1526b6(_0x38bd19);});}}catch(_0x4b3725){_0x1f075e(_0x4b3725);}});}function getPlugins(_0x5e6b31){var _0x26f7c6=[];return new BPromise(function(_0xe93382,_0x34fc07){try{if(_0x5e6b31[_0x4b4b('0x53')]){return db['Plugin'][_0x4b4b('0x41')]({'raw':!![]})[_0x4b4b('0x23')](function(_0x4cb3d0){_0x4cb3d0[_0x4b4b('0x62')](function(_0x6e53e3){_0x26f7c6['push'](_0x6e53e3['id']+0x15b38);});_0xe93382(_0x26f7c6);});}else{return db['UserProfileResource'][_0x4b4b('0x41')]({'where':{'sectionId':_0x5e6b31['id']},'raw':!![]})['then'](function(_0x44ebf0){_0x44ebf0[_0x4b4b('0x62')](function(_0x35fc7f){_0x26f7c6[_0x4b4b('0x59')](_0x35fc7f[_0x4b4b('0x63')]+0x15b38);});_0xe93382(_0x26f7c6);});}}catch(_0x186e33){_0x34fc07(_0x186e33);}});}exports[_0x4b4b('0x64')]=function(_0x30107c,_0x4a730d){return db['UserProfile'][_0x4b4b('0x49')]({'where':{'id':_0x30107c['params']['id']}})[_0x4b4b('0x23')](handleEntityNotFound(_0x4a730d,null))[_0x4b4b('0x23')](function(_0x264923){if(_0x264923){return db[_0x4b4b('0x4f')][_0x4b4b('0x50')](function(_0x58c5c0){return db[_0x4b4b('0x51')]['findAll']({'where':{'userProfileId':_0x30107c[_0x4b4b('0x43')]['id']},'attributes':['id'],'raw':!![]})[_0x4b4b('0x23')](function(_0x1aaeb6){if(_0x1aaeb6){return db[_0x4b4b('0x51')]['destroy']({'where':{'userProfileId':_0x30107c['params']['id'],'id':_['map'](_0x1aaeb6,function(_0x51a3ed){return _0x51a3ed['id'];})},'transaction':_0x58c5c0});}})[_0x4b4b('0x23')](function(_0xe76732){var _0x2b9cee=_[_0x4b4b('0x30')](_0x30107c[_0x4b4b('0x47')],function(_0x327e64){_0x327e64[_0x4b4b('0x56')]=_0x30107c[_0x4b4b('0x43')]['id'];return _0x327e64;});return db['UserProfileSection'][_0x4b4b('0x65')](_0x2b9cee,{'raw':!![],'transaction':_0x58c5c0});})[_0x4b4b('0x23')](function(_0x3859d6){var _0x4e632d=_[_0x4b4b('0x3c')](_[_0x4b4b('0x30')](_0x3859d6,function(_0x40cf5f){return _0x40cf5f[_0x4b4b('0x4a')]({'plain':!![]});}),{'includeAll':![]});if(_0x4e632d){return db[_0x4b4b('0x51')][_0x4b4b('0x41')]({'where':{'userProfileId':_0x30107c[_0x4b4b('0x43')]['id'],'sectionId':_[_0x4b4b('0x30')](_0x4e632d,function(_0x363b53){return _0x363b53['sectionId'];})},'attributes':['id',_0x4b4b('0x55')],'raw':!![]})['then'](function(_0x3bcd0f){var _0x2b141a=_['map'](_0x30107c[_0x4b4b('0x47')],function(_0x4653ab){_0x4653ab['userProfileId']=_0x30107c['params']['id'];return _0x4653ab;});return db[_0x4b4b('0x54')][_0x4b4b('0x65')](_0x2b141a,{'raw':!![],'transaction':_0x58c5c0});});}})[_0x4b4b('0x42')](handleError(_0x4a730d,null));});}})[_0x4b4b('0x23')](function(_0x1db72d){var _0x77ad0f=_[_0x4b4b('0x30')](_0x1db72d,function(_0x156ccc){return _0x156ccc[_0x4b4b('0x4a')]({'plain':!![]});});})[_0x4b4b('0x23')](respondWithResult(_0x4a730d,null))[_0x4b4b('0x42')](handleError(_0x4a730d,null));};exports[_0x4b4b('0x66')]=function(_0x3685c0,_0x3b05bd,_0xb14418){return db[_0x4b4b('0x2a')][_0x4b4b('0x49')]({'where':{'id':_0x3685c0['params']['id']}})[_0x4b4b('0x23')](handleEntityNotFound(_0x3b05bd,null))[_0x4b4b('0x23')](function(_0x5a5d80){if(_0x5a5d80){return _0x5a5d80['removeResources'](_0x3685c0['query'][_0x4b4b('0x5b')]);}})[_0x4b4b('0x23')](respondWithStatusCode(_0x3b05bd,null))[_0x4b4b('0x42')](handleError(_0x3b05bd,null));};exports[_0x4b4b('0x67')]=function(_0x42be7,_0x3067f7){var _0x194e34={'raw':![],'where':{}};var _0x3853aa={};var _0x1b3682={'count':0x0,'rows':[]};var _0x5d96be=_0x42be7[_0x4b4b('0x31')][_0x4b4b('0x68')];if(typeof _0x5d96be===_0x4b4b('0x69')){throw new db[(_0x4b4b('0x6a'))][(_0x4b4b('0x6b'))](_0x4b4b('0x6c'));}var _0x2c17ac=_0x42be7[_0x4b4b('0x31')][_0x4b4b('0x6d')]||![];var _0x3672ed=getQueryModels(_0x5d96be,_0x2c17ac);if(typeof _0x3672ed[_0x4b4b('0x6e')]===_0x4b4b('0x69')){throw new db[(_0x4b4b('0x6a'))][(_0x4b4b('0x6b'))](_0x4b4b('0x6f')+_0x5d96be+'\x27');}var _0x509596=[];if(!_[_0x4b4b('0x5e')](_0x3672ed[_0x4b4b('0x70')])){_0x509596=_0x3672ed[_0x4b4b('0x70')];}else{_0x509596=[{'name':_0x5d96be}];}return db[_0x4b4b('0x2a')][_0x4b4b('0x60')]({'where':{'id':_0x42be7['params']['id']}})[_0x4b4b('0x23')](handleEntityNotFound(_0x3067f7,null))[_0x4b4b('0x23')](function(_0x1e7bc5){if(_0x1e7bc5){var _0x3d1e3d=[];for(var _0x548b85=0x0;_0x548b85<_0x509596[_0x4b4b('0x44')];_0x548b85++){_0x3d1e3d[_0x4b4b('0x59')](db[_0x4b4b('0x51')]['findOne']({'where':{'userProfileId':_0x1e7bc5['id'],'name':_0x509596[_0x548b85][_0x4b4b('0x28')]},'raw':!![]}));}return BPromise['all'](_0x3d1e3d);}})[_0x4b4b('0x23')](function(_0x406b10){var _0xb347d1=_[_0x4b4b('0x3c')](_0x406b10,function(_0x3d73ac){return _0x3d73ac?_0x3d73ac:undefined;});var _0x5aaf60=_['filter'](_0x509596,['ignore',!![]]);var _0x244ce6=_[_0x4b4b('0x5e')](_0xb347d1)&&_[_0x4b4b('0x5e')](_0x5aaf60)?null:_['union'](_0x5aaf60,_0xb347d1);if(_0x244ce6){var _0x20e767=[];for(var _0x35712c=0x0;_0x35712c<_0x244ce6[_0x4b4b('0x44')];_0x35712c++){var _0x19dfa8=_[_0x4b4b('0x49')](_0x509596,function(_0x4a9b26){return _0x244ce6[_0x35712c]?_0x4a9b26[_0x4b4b('0x28')]===_0x244ce6[_0x35712c][_0x4b4b('0x28')]:null;});if(_0x19dfa8){if(_0x244ce6[_0x35712c][_0x4b4b('0x71')]){_0x20e767[_0x4b4b('0x59')](getAllResources(_0x3672ed[_0x4b4b('0x6e')],_0x244ce6[_0x35712c]));}else{if(!_0x244ce6[_0x35712c][_0x4b4b('0x53')]){_0x20e767[_0x4b4b('0x59')](getAllowedResources(_0x19dfa8,_0x244ce6[_0x35712c],_0x3672ed[_0x4b4b('0x6e')]));}else{if(_0x19dfa8['model']){_0x20e767[_0x4b4b('0x59')](getAllFilteredResources(_0x19dfa8,_0x244ce6[_0x35712c]));}}}}}return BPromise['all'](_0x20e767);}else{return null;}})[_0x4b4b('0x23')](function(_0x1a2010){var _0x5c313c=_0x1a2010;var _0x15d778=null;if(_0x5c313c){_0x15d778=_0x5c313c[_0x4b4b('0x44')]===0x1?_0x5c313c[0x0]:null;}if(_0x15d778||_0x5c313c){var _0x49d9b3=db[_0x3672ed[_0x4b4b('0x6e')]]['rawAttributes'];_0x3853aa[_0x4b4b('0x2f')]=_[_0x4b4b('0x32')](_0x49d9b3);_0x3853aa[_0x4b4b('0x31')]=_[_0x4b4b('0x32')](_0x42be7[_0x4b4b('0x31')]);_0x3853aa[_0x4b4b('0x33')]=_[_0x4b4b('0x34')](_0x3853aa[_0x4b4b('0x2f')],_0x3853aa[_0x4b4b('0x31')]);_0x194e34[_0x4b4b('0x36')]=_[_0x4b4b('0x34')](_0x3853aa[_0x4b4b('0x2f')],qs['fields'](_0x42be7[_0x4b4b('0x31')][_0x4b4b('0x35')]));_0x194e34['attributes']=_0x194e34['attributes'][_0x4b4b('0x44')]?_0x194e34[_0x4b4b('0x36')]:_0x3853aa[_0x4b4b('0x2f')];if(!_0x42be7[_0x4b4b('0x31')][_0x4b4b('0x37')]('nolimit')){_0x194e34[_0x4b4b('0x1f')]=qs[_0x4b4b('0x1f')](_0x42be7[_0x4b4b('0x31')][_0x4b4b('0x1f')]);_0x194e34[_0x4b4b('0x1e')]=qs[_0x4b4b('0x1e')](_0x42be7['query'][_0x4b4b('0x1e')]);}_0x194e34[_0x4b4b('0x39')]=qs[_0x4b4b('0x3a')](_0x42be7[_0x4b4b('0x31')][_0x4b4b('0x3a')]);_0x194e34[_0x4b4b('0x3b')]=qs[_0x4b4b('0x33')](_[_0x4b4b('0x72')](_0x42be7[_0x4b4b('0x31')],_0x3853aa[_0x4b4b('0x33')]));if(_0x42be7[_0x4b4b('0x31')][_0x4b4b('0x3c')]){_0x194e34[_0x4b4b('0x3b')]=_['merge'](_0x194e34[_0x4b4b('0x3b')],{'$or':_[_0x4b4b('0x30')](_0x49d9b3,function(_0x4cf733){if(_0x4cf733[_0x4b4b('0x2d')]['key']!==_0x4b4b('0x3e')){var _0x58b4ba={};_0x58b4ba[_0x4cf733['field']]={'$like':'%'+_0x42be7[_0x4b4b('0x31')][_0x4b4b('0x3c')]+'%'};return _0x58b4ba;}})});}var _0x482e85=[];if(_0x15d778){var _0x555d6d=_[_0x4b4b('0x49')](_0x509596,[_0x4b4b('0x28'),_0x15d778[_0x4b4b('0x28')]]);if(_0x555d6d['field']){var _0x4479b8={};if(_0x3672ed[_0x4b4b('0x6e')]===_0x4b4b('0x73')){_0x4479b8[_0x555d6d['foreignKey']]=_[_0x4b4b('0x30')](_0x15d778[_0x4b4b('0x74')],'id');}else{_0x4479b8[_0x555d6d['foreignKey']]=_0x15d778[_0x4b4b('0x74')];}_0x482e85[_0x4b4b('0x59')](_0x4479b8);}else{_0x194e34[_0x4b4b('0x3b')]['id']=_0x15d778[_0x4b4b('0x74')];}}else{for(var _0x268f7c=0x0;_0x268f7c<_0x5c313c[_0x4b4b('0x44')];_0x268f7c++){var _0x555d6d=_[_0x4b4b('0x49')](_0x509596,[_0x4b4b('0x28'),_0x5c313c[_0x268f7c]['name']]);if(_0x555d6d[_0x4b4b('0x75')]){var _0x4479b8={};_0x4479b8[_0x555d6d[_0x4b4b('0x76')]]=_0x5c313c[_0x268f7c][_0x4b4b('0x74')];_0x482e85[_0x4b4b('0x59')](_0x4479b8);}else{if(!_0x194e34[_0x4b4b('0x3b')]['id'])_0x194e34['where']['id']=[];_0x5c313c[_0x268f7c][_0x4b4b('0x74')][_0x4b4b('0x62')](function(_0x15bd1e){_0x194e34[_0x4b4b('0x3b')]['id'][_0x4b4b('0x59')](_0x15bd1e);});}}}if(!_['isEmpty'](_0x482e85)){_0x194e34[_0x4b4b('0x3b')]=_[_0x4b4b('0x3d')](_0x194e34[_0x4b4b('0x3b')],{'$and':{'$or':_0x482e85}});}_0x194e34=_[_0x4b4b('0x3d')]({},_0x194e34,_0x42be7[_0x4b4b('0x3f')]);if(_0x15d778&&!_0x15d778[_0x4b4b('0x53')]&&_0x3672ed['childModel']===_0x4b4b('0x73')){if(_0x42be7['query'][_0x4b4b('0x40')]){_0x194e34[_0x4b4b('0x45')]=[{'all':!![]}];}return db[_0x3672ed['childModel']][_0x4b4b('0x41')](_0x194e34)[_0x4b4b('0x23')](function(_0x1788ec){var _0x6b8620=[];_0x1788ec['forEach'](function(_0x4995f9){var _0x37d7f1;switch(_0x4995f9[_0x4b4b('0x77')]){case _0x4b4b('0x78'):_0x37d7f1=_[_0x4b4b('0x49')](_0x15d778[_0x4b4b('0x74')],function(_0x581a50){return _0x581a50['id']===_0x4995f9[_0x4b4b('0x79')]&&_0x581a50[_0x4b4b('0x2d')]===_0x4b4b('0x7a');});break;case _0x4b4b('0x7b'):_0x37d7f1=_[_0x4b4b('0x49')](_0x15d778['associatedResources'],function(_0x112f03){return _0x112f03['id']===_0x4995f9[_0x4b4b('0x79')]&&_0x112f03['type']===_0x4b4b('0x7c');});break;}if(_0x37d7f1)_0x6b8620[_0x4b4b('0x59')](_0x4995f9);});_0x1b3682[_0x4b4b('0x1d')]=_0x6b8620[_0x4b4b('0x44')];_0x1b3682[_0x4b4b('0x7d')]=_0x6b8620;return _0x1b3682;});}else{return db[_0x3672ed[_0x4b4b('0x6e')]][_0x4b4b('0x1d')]({'where':_0x194e34['where']})[_0x4b4b('0x23')](function(_0x29f335){_0x1b3682[_0x4b4b('0x1d')]=_0x29f335;if(_0x42be7[_0x4b4b('0x31')][_0x4b4b('0x40')]){if(_0x3672ed[_0x4b4b('0x6e')]===_0x4b4b('0x7e')){_0x194e34[_0x4b4b('0x45')]=[{'model':db[_0x4b4b('0x7f')],'as':'Tags','attributes':['id',_0x4b4b('0x28'),_0x4b4b('0x80')],'required':_0x42be7['query'][_0x4b4b('0x81')]?!![]:![]},{'model':db['Tag'],'as':_0x4b4b('0x82'),'attributes':['id',_0x4b4b('0x28'),_0x4b4b('0x80')],'through':_0x42be7['query']['tag']?{'attributes':[],'where':{'TagId':_0x42be7[_0x4b4b('0x31')]['tag']||undefined}}:{},'required':_0x42be7[_0x4b4b('0x31')][_0x4b4b('0x81')]?!![]:![]}];}else{_0x194e34[_0x4b4b('0x45')]=[{'all':!![]}];}}return db[_0x3672ed[_0x4b4b('0x6e')]][_0x4b4b('0x41')](_0x194e34);})['then'](function(_0x201e71){_0x1b3682[_0x4b4b('0x7d')]=_0x201e71;return _0x1b3682;});}}else{return _0x1b3682;}})[_0x4b4b('0x23')](respondWithFilteredResult(_0x3067f7,_0x194e34))[_0x4b4b('0x42')](handleError(_0x3067f7,null));};function getAllResources(_0x132032,_0x3fc673){return new BPromise(function(_0x3c44f0,_0x35553f){if(_0x3fc673){var _0x2d4329=_0x3fc673['filter']?{[_0x3fc673[_0x4b4b('0x3c')][_0x4b4b('0x75')]]:_0x3fc673[_0x4b4b('0x3c')][_0x4b4b('0x83')]}:undefined;return db[_0x132032]['findAll']({'where':_0x2d4329,'raw':!![]})[_0x4b4b('0x23')](function(_0x5d106c){_0x3fc673[_0x4b4b('0x74')]=_[_0x4b4b('0x30')](_0x5d106c,'id');_0x3c44f0(_0x3fc673);})[_0x4b4b('0x42')](function(_0x4239f7){_0x35553f(_0x4239f7);});}else{_0x3c44f0(null);}});}function getAllFilteredResources(_0x46cc22,_0x5291de){return new BPromise(function(_0x2ad8e0,_0x503f97){var _0x12f78b=_0x46cc22[_0x4b4b('0x3c')]?{[_0x46cc22[_0x4b4b('0x3c')][_0x4b4b('0x75')]]:_0x46cc22[_0x4b4b('0x3c')][_0x4b4b('0x83')]}:undefined;return db[_0x46cc22['model']][_0x4b4b('0x41')]({'where':_0x12f78b,'raw':!![]})[_0x4b4b('0x23')](function(_0x18c55d){_0x5291de[_0x4b4b('0x74')]=_['map'](_0x18c55d,function(_0x2d8c84){return _0x2d8c84['name'];});_0x2ad8e0(_0x5291de);})[_0x4b4b('0x42')](function(_0x26b856){_0x503f97(_0x26b856);});});}function getAllowedResources(_0x191918,_0x4ad1fb,_0x15366a){return new BPromise(function(_0x5541aa,_0x7104b9){if(_0x4ad1fb){return db[_0x4b4b('0x54')][_0x4b4b('0x41')]({'where':{'sectionId':_0x4ad1fb['id']},'raw':!![]})['then'](function(_0x3cbac5){if(_0x191918[_0x4b4b('0x75')]&&_0x191918[_0x4b4b('0x75')]!=='id'){_0x4ad1fb[_0x4b4b('0x74')]=_['map'](_0x3cbac5,function(_0x1128a1){return _0x1128a1[_0x191918['field']];});}else{if(_0x15366a===_0x4b4b('0x73')){_0x4ad1fb['associatedResources']=_[_0x4b4b('0x30')](_0x3cbac5,function(_0x5a5141){return{'id':_0x5a5141['resourceId'],'type':_0x5a5141[_0x4b4b('0x2d')]};});}else{_0x4ad1fb[_0x4b4b('0x74')]=_[_0x4b4b('0x30')](_0x3cbac5,function(_0x3a3de4){return _0x3a3de4['resourceId'];});}}_0x5541aa(_0x4ad1fb);})['catch'](function(_0x2b8951){_0x7104b9(_0x2b8951);});}else{_0x5541aa(null);}});}function getQueryModels(_0x5124a3,_0x33ca8f){var _0x1c3c6b=_0x5124a3[_0x4b4b('0x84')]();var _0x1f0314={'childModel':undefined,'parentSections':[]};switch(_0x1c3c6b){case _0x4b4b('0x85'):_0x1f0314[_0x4b4b('0x6e')]=_0x4b4b('0x86');break;case'odbc':_0x1f0314[_0x4b4b('0x6e')]=_0x4b4b('0x87');break;case'squarerecordings':_0x1f0314[_0x4b4b('0x6e')]=_0x4b4b('0x88');_0x1f0314['parentSections']=[{'name':'SquareProjects','field':_0x4b4b('0x28'),'foreignKey':_0x4b4b('0x89')}];break;case _0x4b4b('0x8a'):_0x1f0314[_0x4b4b('0x6e')]='JscriptyProject';break;case _0x4b4b('0x8b'):_0x1f0314[_0x4b4b('0x6e')]='CmContact';_0x1f0314[_0x4b4b('0x70')]=[{'name':_0x4b4b('0x8c'),'field':'id','foreignKey':_0x4b4b('0x8d')}];break;case _0x4b4b('0x8e'):_0x1f0314['childModel']=_0x4b4b('0x8f');break;case'companies':_0x1f0314[_0x4b4b('0x6e')]='CmCompany';break;case'globalcustomfields':_0x1f0314[_0x4b4b('0x6e')]=_0x4b4b('0x90');break;case _0x4b4b('0x91'):_0x1f0314[_0x4b4b('0x6e')]=_0x4b4b('0x92');break;case _0x4b4b('0x93'):_0x1f0314['childModel']=_0x4b4b('0x94');break;case _0x4b4b('0x95'):_0x1f0314[_0x4b4b('0x6e')]='FaxQueue';break;case _0x4b4b('0x96'):_0x1f0314['childModel']=_0x4b4b('0x97');break;case _0x4b4b('0x98'):case _0x4b4b('0x99'):case _0x4b4b('0x9a'):_0x1f0314[_0x4b4b('0x6e')]=_0x4b4b('0x9b');break;case'contexts':_0x1f0314['childModel']='VoiceContext';break;case _0x4b4b('0x9c'):_0x1f0314['childModel']='VoiceMail';break;case _0x4b4b('0x9d'):_0x1f0314['childModel']=_0x4b4b('0x9e');_0x1f0314[_0x4b4b('0x70')]=[{'name':_0x4b4b('0x9f'),'field':_0x4b4b('0x28'),'foreignKey':_0x4b4b('0xa0'),'model':'User','filter':{'field':'role','value':['agent']}},{'name':_0x4b4b('0xa1'),'field':_0x4b4b('0x28'),'foreignKey':_0x4b4b('0xa0'),'model':_0x4b4b('0xa2'),'filter':{'field':_0x4b4b('0xa3'),'value':[_0x4b4b('0xa4')]}},{'name':_0x4b4b('0xa5'),'field':_0x4b4b('0x28'),'foreignKey':_0x4b4b('0xa6'),'model':_0x4b4b('0xa7'),'filter':{'field':_0x4b4b('0x2d'),'value':['inbound']}},{'name':_0x4b4b('0xa8'),'field':'name','foreignKey':_0x4b4b('0xa6'),'model':_0x4b4b('0xa7'),'filter':{'field':'type','value':['outbound']}}];break;case _0x4b4b('0xa9'):_0x1f0314[_0x4b4b('0x6e')]='VoiceMusicOnHold';break;case _0x4b4b('0xaa'):_0x1f0314[_0x4b4b('0x6e')]=_0x4b4b('0xab');break;case _0x4b4b('0xac'):_0x1f0314[_0x4b4b('0x6e')]=_0x4b4b('0xad');break;case _0x4b4b('0xae'):_0x1f0314[_0x4b4b('0x6e')]='Campaign';break;case _0x4b4b('0xaf'):_0x1f0314['childModel']=_0x4b4b('0xb0');break;case'mailaccounts':_0x1f0314[_0x4b4b('0x6e')]=_0x4b4b('0xb1');break;case _0x4b4b('0xb2'):_0x1f0314[_0x4b4b('0x6e')]=_0x4b4b('0xb3');break;case _0x4b4b('0xb4'):_0x1f0314[_0x4b4b('0x6e')]=_0x4b4b('0xb5');break;case _0x4b4b('0xb6'):_0x1f0314[_0x4b4b('0x6e')]=_0x4b4b('0xb7');break;case'smsqueues':_0x1f0314[_0x4b4b('0x6e')]=_0x4b4b('0xb8');break;case _0x4b4b('0xb9'):_0x1f0314[_0x4b4b('0x6e')]='SmsAccount';break;case _0x4b4b('0xba'):_0x1f0314[_0x4b4b('0x6e')]=_0x4b4b('0xbb');break;case'voicequeues':case _0x4b4b('0xbc'):_0x1f0314[_0x4b4b('0x6e')]='VoiceQueue';if(_0x33ca8f){_0x1f0314[_0x4b4b('0x70')]=[{'name':_0x4b4b('0xa5')},{'name':_0x4b4b('0xa8')}];}break;case _0x4b4b('0xbd'):case'agents':case'telephones':_0x1f0314[_0x4b4b('0x6e')]=_0x4b4b('0xa2');if(_0x33ca8f){_0x1f0314[_0x4b4b('0x70')]=[{'name':_0x4b4b('0xbe'),'filter':{'field':_0x4b4b('0xa3'),'value':[_0x4b4b('0xbf'),'user']},'ignore':!![]},{'name':'Agents'},{'name':'Telephones'}];}break;case _0x4b4b('0xc0'):_0x1f0314['childModel']=_0x4b4b('0xc1');break;case _0x4b4b('0xc2'):_0x1f0314['childModel']='SalesforceAccount';break;case _0x4b4b('0xc3'):_0x1f0314['childModel']=_0x4b4b('0xc4');break;case _0x4b4b('0xc5'):_0x1f0314['childModel']=_0x4b4b('0xc6');break;case'deskaccounts':_0x1f0314[_0x4b4b('0x6e')]='DeskAccount';break;case _0x4b4b('0xc7'):_0x1f0314[_0x4b4b('0x6e')]='ZohoAccount';break;case _0x4b4b('0xc8'):_0x1f0314[_0x4b4b('0x6e')]='User';break;case _0x4b4b('0xc9'):_0x1f0314[_0x4b4b('0x6e')]=_0x4b4b('0xca');break;case _0x4b4b('0xcb'):_0x1f0314[_0x4b4b('0x6e')]=_0x4b4b('0xcc');break;case _0x4b4b('0xcd'):_0x1f0314['childModel']=_0x4b4b('0x61');break;case _0x4b4b('0xce'):_0x1f0314[_0x4b4b('0x6e')]='Interval';break;case _0x4b4b('0xcf'):_0x1f0314[_0x4b4b('0x6e')]=_0x4b4b('0xd0');break;case'scheduler':_0x1f0314[_0x4b4b('0x6e')]=_0x4b4b('0xd1');break;case'sounds':_0x1f0314[_0x4b4b('0x6e')]=_0x4b4b('0xd2');break;case _0x4b4b('0xd3'):_0x1f0314[_0x4b4b('0x6e')]='Tag';break;case _0x4b4b('0xd4'):_0x1f0314[_0x4b4b('0x6e')]=_0x4b4b('0xd5');break;case _0x4b4b('0xd6'):_0x1f0314[_0x4b4b('0x6e')]=_0x4b4b('0xd7');break;case _0x4b4b('0xd8'):_0x1f0314[_0x4b4b('0x6e')]=_0x4b4b('0xd9');break;case'variables':_0x1f0314['childModel']=_0x4b4b('0xda');break;case _0x4b4b('0xdb'):_0x1f0314[_0x4b4b('0x6e')]=_0x4b4b('0xdc');break;case _0x4b4b('0xdd'):_0x1f0314['childModel']='AnalyticExtractedReport';_0x1f0314[_0x4b4b('0x70')]=[{'name':_0x4b4b('0xde'),'field':'id','foreignKey':'reportId'}];break;case _0x4b4b('0xdf'):_0x1f0314['childModel']=_0x4b4b('0xe0');break;default:return _0x1f0314;}return _0x1f0314;} \ No newline at end of file +var _0xe03c=['ValidationError','mergeResources','Invalid\x20section\x20\x27','parentSections','all','ignore','union','childModel','nolimit','pick','key','VIRTUAL','field','AnalyticExtractedReport','foreignKey','associatedResources','reportType','default','DefaultReports','custom','reportId','CustomReports','CmContact','Tag','Tags','color','tag','ThroughTags','rows','value','toLowerCase','squareprojects','SquareProject','odbc','SquareOdbc','squarerecordings','SquareProjects','projectName','projects','JscriptyProject','contacts','lists','CmList','companies','CmCompany','globalcustomfields','CmCustomField','chatqueues','ChatQueue','chatwebsites','ChatWebsite','faxqueues','FaxQueue','faxaccounts','FaxAccount','inboundroutes','internalroutes','outboundroutes','VoiceExtension','contexts','VoiceContext','voicemails','VoiceMail','VoiceRecording','Agents','membername','User','role','agent','Telephones','telephone','VoiceQueues','VoiceQueue','QueueCampaigns','queue','outbound','musiconholds','VoiceMusicOnHold','chanspies','voiceprefixes','VoicePrefix','MailQueue','mailaccounts','MailAccount','openchannelqueues','openchannelaccounts','smsqueues','SmsQueue','smsaccounts','SmsAccount','teams','Team','voicequeues','users','telephones','Users','admin','user','zendeskaccounts','salesforceaccounts','FreshdeskAccount','sugarcrmaccounts','SugarcrmAccount','deskaccounts','DeskAccount','cannedanswers','CannedAnswer','dispositions','customdashboards','Interval','Pause','scheduler','Schedule','sounds','tags','templates','Template','trunks','Trunk','Variable','plugins','extractedreports','metrics','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','util','path','crypto','jsforce','desk.js','to-csv','querystring','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','redis','defaults','./userProfile.socket','register','sendStatus','status','end','offset','limit','Content-Range','apply','reject','save','then','destroy','error','stack','name','send','index','map','UserProfile','rawAttributes','type','query','keys','filters','intersection','model','attributes','fields','length','hasOwnProperty','order','sort','where','filter','merge','count','includeAll','include','catch','show','options','find','create','body','clone','params','get','updatedAt','omit','createdAt','sequelize','UserProfileSection','findAll','autoAssociation','UserProfileResource','sectionId','userProfileId','Resources','update','describe','transaction','each','getSections','enabled','isEmpty','includes','subsections','push','findOne','Dashboard','forEach','resourceId','Plugin','addResources','bulkCreate','removeResources','section','undefined','Sequelize'];(function(_0x2b0bc2,_0x4331f5){var _0x56e5b9=function(_0x4c1b06){while(--_0x4c1b06){_0x2b0bc2['push'](_0x2b0bc2['shift']());}};_0x56e5b9(++_0x4331f5);}(_0xe03c,0x15d));var _0xce03=function(_0x3f47bd,_0xa1b88c){_0x3f47bd=_0x3f47bd-0x0;var _0x133064=_0xe03c[_0x3f47bd];return _0x133064;};'use strict';var pdf=require(_0xce03('0x0'));var emlformat=require(_0xce03('0x1'));var rimraf=require(_0xce03('0x2'));var zipdir=require(_0xce03('0x3'));var jsonpatch=require(_0xce03('0x4'));var rp=require('request-promise');var moment=require(_0xce03('0x5'));var BPromise=require(_0xce03('0x6'));var Mustache=require('mustache');var util=require(_0xce03('0x7'));var path=require(_0xce03('0x8'));var sox=require('sox');var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var _=require('lodash');var squel=require('squel');var crypto=require(_0xce03('0x9'));var jsforce=require(_0xce03('0xa'));var deskjs=require(_0xce03('0xb'));var toCsv=require(_0xce03('0xc'));var querystring=require(_0xce03('0xd'));var Papa=require(_0xce03('0xe'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0xce03('0xf'));var as=require(_0xce03('0x10'));var hardwareService=require(_0xce03('0x11'));var logger=require('../../config/logger')(_0xce03('0x12'));var utils=require(_0xce03('0x13'));var config=require(_0xce03('0x14'));var db=require('../../mysqldb')['db'];config[_0xce03('0x15')]=_[_0xce03('0x16')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xce03('0x15')]));require(_0xce03('0x17'))[_0xce03('0x18')](socket);function respondWithStatusCode(_0xe9d957,_0x491468){_0x491468=_0x491468||0xcc;return function(_0x3c7fbd){if(_0x3c7fbd){return _0xe9d957[_0xce03('0x19')](_0x491468);}return _0xe9d957[_0xce03('0x1a')](_0x491468)[_0xce03('0x1b')]();};}function respondWithResult(_0x262f00,_0x26f6ff){_0x26f6ff=_0x26f6ff||0xc8;return function(_0x53b3ae){if(_0x53b3ae){return _0x262f00['status'](_0x26f6ff)['json'](_0x53b3ae);}};}function respondWithFilteredResult(_0x43ad01,_0x3e3a56){return function(_0x313e20){if(_0x313e20){var _0x11579a=_0x313e20['count'],_0x194c05=_0x3e3a56['offset'],_0x582ab9=_0x3e3a56[_0xce03('0x1c')]+_0x3e3a56[_0xce03('0x1d')],_0x32e6ce;if(_0x582ab9>=_0x11579a){_0x582ab9=_0x11579a;_0x32e6ce=0xc8;}else{_0x32e6ce=0xce;}_0x43ad01['status'](_0x32e6ce);return _0x43ad01['set'](_0xce03('0x1e'),_0x194c05+'-'+_0x582ab9+'/'+_0x11579a)['json'](_0x313e20);}return null;};}function patchUpdates(_0x22090a){return function(_0x3d8438){try{jsonpatch[_0xce03('0x1f')](_0x3d8438,_0x22090a,!![]);}catch(_0x2ba2b2){return BPromise[_0xce03('0x20')](_0x2ba2b2);}return _0x3d8438[_0xce03('0x21')]();};}function saveUpdates(_0x3c57cf,_0x2d19c7){return function(_0x1262e1){if(_0x1262e1){return _0x1262e1['update'](_0x3c57cf)[_0xce03('0x22')](function(_0x335eda){return _0x335eda;});}return null;};}function removeEntity(_0x29bbcd,_0x2060fc){return function(_0x6ef1a1){if(_0x6ef1a1){return _0x6ef1a1[_0xce03('0x23')]()[_0xce03('0x22')](function(){_0x29bbcd[_0xce03('0x1a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x1dfa57,_0x571c01){return function(_0xad7659){if(!_0xad7659){_0x1dfa57['sendStatus'](0x194);}return _0xad7659;};}function handleError(_0x169c19,_0x38d6c0){_0x38d6c0=_0x38d6c0||0x1f4;return function(_0x3f5ef2){logger[_0xce03('0x24')](_0x3f5ef2[_0xce03('0x25')]);if(_0x3f5ef2[_0xce03('0x26')]){delete _0x3f5ef2[_0xce03('0x26')];}_0x169c19['status'](_0x38d6c0)[_0xce03('0x27')](_0x3f5ef2);};}exports[_0xce03('0x28')]=function(_0x4c2ca1,_0x202c17){var _0x20901e={},_0x22bcb8={},_0x4c6542={'count':0x0,'rows':[]};var _0x35d421=_[_0xce03('0x29')](db[_0xce03('0x2a')][_0xce03('0x2b')],function(_0x17696e){return{'name':_0x17696e['fieldName'],'type':_0x17696e[_0xce03('0x2c')]['key']};});_0x22bcb8['model']=_[_0xce03('0x29')](_0x35d421,_0xce03('0x26'));_0x22bcb8[_0xce03('0x2d')]=_[_0xce03('0x2e')](_0x4c2ca1[_0xce03('0x2d')]);_0x22bcb8[_0xce03('0x2f')]=_[_0xce03('0x30')](_0x22bcb8[_0xce03('0x31')],_0x22bcb8[_0xce03('0x2d')]);_0x20901e[_0xce03('0x32')]=_[_0xce03('0x30')](_0x22bcb8[_0xce03('0x31')],qs[_0xce03('0x33')](_0x4c2ca1[_0xce03('0x2d')][_0xce03('0x33')]));_0x20901e[_0xce03('0x32')]=_0x20901e[_0xce03('0x32')][_0xce03('0x34')]?_0x20901e['attributes']:_0x22bcb8['model'];if(!_0x4c2ca1['query'][_0xce03('0x35')]('nolimit')){_0x20901e[_0xce03('0x1d')]=qs['limit'](_0x4c2ca1[_0xce03('0x2d')][_0xce03('0x1d')]);_0x20901e[_0xce03('0x1c')]=qs[_0xce03('0x1c')](_0x4c2ca1['query']['offset']);}_0x20901e[_0xce03('0x36')]=qs[_0xce03('0x37')](_0x4c2ca1[_0xce03('0x2d')][_0xce03('0x37')]);_0x20901e[_0xce03('0x38')]=qs['filters'](_['pick'](_0x4c2ca1['query'],_0x22bcb8[_0xce03('0x2f')]));if(_0x4c2ca1[_0xce03('0x2d')][_0xce03('0x39')]){_0x20901e['where']=_[_0xce03('0x3a')](_0x20901e[_0xce03('0x38')],{'$or':_['map'](_0x35d421,function(_0x184752){if(_0x184752[_0xce03('0x2c')]!=='VIRTUAL'){var _0x1c6675={};_0x1c6675[_0x184752[_0xce03('0x26')]]={'$like':'%'+_0x4c2ca1['query'][_0xce03('0x39')]+'%'};return _0x1c6675;}})});}_0x20901e=_[_0xce03('0x3a')]({},_0x20901e,_0x4c2ca1['options']);var _0x138557={'where':_0x20901e[_0xce03('0x38')]};return db[_0xce03('0x2a')]['count'](_0x138557)[_0xce03('0x22')](function(_0x405b33){_0x4c6542[_0xce03('0x3b')]=_0x405b33;if(_0x4c2ca1['query'][_0xce03('0x3c')]){_0x20901e[_0xce03('0x3d')]=[{'all':!![]}];}return db[_0xce03('0x2a')]['findAll'](_0x20901e);})[_0xce03('0x22')](function(_0x33c8ba){_0x4c6542['rows']=_0x33c8ba;return _0x4c6542;})[_0xce03('0x22')](respondWithFilteredResult(_0x202c17,_0x20901e))[_0xce03('0x3e')](handleError(_0x202c17,null));};exports[_0xce03('0x3f')]=function(_0xec5f3c,_0x148d2f){var _0x28c5e8={'raw':![],'where':{'id':_0xec5f3c['params']['id']}},_0x56c9e0={};_0x56c9e0['model']=_['keys'](db[_0xce03('0x2a')]['rawAttributes']);_0x56c9e0[_0xce03('0x2d')]=_[_0xce03('0x2e')](_0xec5f3c['query']);_0x56c9e0[_0xce03('0x2f')]=_[_0xce03('0x30')](_0x56c9e0[_0xce03('0x31')],_0x56c9e0['query']);_0x28c5e8[_0xce03('0x32')]=_[_0xce03('0x30')](_0x56c9e0[_0xce03('0x31')],qs['fields'](_0xec5f3c['query']['fields']));_0x28c5e8['attributes']=_0x28c5e8['attributes'][_0xce03('0x34')]?_0x28c5e8['attributes']:_0x56c9e0[_0xce03('0x31')];if(_0xec5f3c[_0xce03('0x2d')]['includeAll']){_0x28c5e8['include']=[{'all':!![]}];}_0x28c5e8=_[_0xce03('0x3a')]({},_0x28c5e8,_0xec5f3c[_0xce03('0x40')]);return db['UserProfile'][_0xce03('0x41')](_0x28c5e8)['then'](handleEntityNotFound(_0x148d2f,null))['then'](respondWithResult(_0x148d2f,null))[_0xce03('0x3e')](handleError(_0x148d2f,null));};exports[_0xce03('0x42')]=function(_0x11427d,_0x24c820){return db[_0xce03('0x2a')]['create'](_0x11427d[_0xce03('0x43')],{})[_0xce03('0x22')](respondWithResult(_0x24c820,0xc9))[_0xce03('0x3e')](handleError(_0x24c820,null));};exports[_0xce03('0x44')]=function(_0x5401c0,_0x1b4881){var _0x3c8b77={'where':{'id':_0x5401c0[_0xce03('0x45')]['id']}},_0x51e494={};_0x51e494[_0xce03('0x31')]=_[_0xce03('0x2e')](db[_0xce03('0x2a')][_0xce03('0x2b')]);_0x3c8b77[_0xce03('0x32')]=_['intersection'](_0x51e494['model'],qs[_0xce03('0x33')](_0x5401c0['query'][_0xce03('0x33')]));_0x3c8b77[_0xce03('0x32')]=_0x3c8b77[_0xce03('0x32')][_0xce03('0x34')]?_0x3c8b77['attributes']:_0x51e494[_0xce03('0x31')];if(_0x5401c0[_0xce03('0x2d')][_0xce03('0x3c')]){_0x3c8b77[_0xce03('0x3d')]=[{'all':!![]}];}_0x3c8b77=_['merge']({},_0x3c8b77,_0x5401c0[_0xce03('0x40')]);return db['UserProfile'][_0xce03('0x41')](_0x3c8b77)['then'](handleEntityNotFound(_0x1b4881,null))[_0xce03('0x22')](function(_0x111994){if(_0x111994){var _0x3a55d6=_0x111994[_0xce03('0x46')]({'plain':!![]});_0x3a55d6=qs['omit'](_0x3a55d6,['id','createdAt',_0xce03('0x47'),'crudPermissions']);_0x5401c0['body']=_[_0xce03('0x48')](_0x5401c0[_0xce03('0x43')],['id',_0xce03('0x49'),_0xce03('0x47')]);return db[_0xce03('0x4a')]['transaction'](function(_0x46fdcf){return db[_0xce03('0x2a')]['create'](_[_0xce03('0x3a')](_0x3a55d6,_0x5401c0[_0xce03('0x43')]),{'include':_0x5401c0['query'][_0xce03('0x3c')]?[{'all':!![]}]:undefined,'transaction':_0x46fdcf})[_0xce03('0x22')](function(_0x1fbbc3){var _0xce21eb=_0x1fbbc3[_0xce03('0x46')]({'plain':!![]});return db[_0xce03('0x4b')][_0xce03('0x4c')]({'where':{'userProfileId':_0x5401c0[_0xce03('0x45')]['id']},'raw':!![]})['then'](function(_0x38b3f5){if(_0x38b3f5){return BPromise['each'](_0x38b3f5,function(_0x4120d2){return new BPromise(function(_0x2edb88,_0x5316b9){if(_0x4120d2[_0xce03('0x4d')]===null||_0x4120d2[_0xce03('0x4d')]===0x1)_0x2edb88(null);return db[_0xce03('0x4e')][_0xce03('0x4c')]({'where':{'sectionId':_0x4120d2['id']},'raw':!![]})[_0xce03('0x22')](function(_0xe9e1ab){var _0x122506=_[_0xce03('0x29')](_0xe9e1ab,function(_0xce3c0f){return qs[_0xce03('0x48')](_0xce3c0f,['id',_0xce03('0x49'),_0xce03('0x47'),_0xce03('0x4f')]);});_0x2edb88(_0x122506);})[_0xce03('0x3e')](function(_0x4db4b0){_0x5316b9(_0x4db4b0);});})[_0xce03('0x22')](function(_0x445e68){var _0x18d784=qs[_0xce03('0x48')](_0x4120d2,['id',_0xce03('0x49'),'updatedAt']);_0x18d784[_0xce03('0x50')]=_0xce21eb['id'];if(_0x445e68)_0x18d784[_0xce03('0x51')]=_0x445e68;return _0x18d784;})[_0xce03('0x22')](function(_0x275717){return db[_0xce03('0x4b')][_0xce03('0x42')](_0x275717,{'include':[{'model':db[_0xce03('0x4e')],'as':'Resources'}],'raw':!![],'transaction':_0x46fdcf});});})[_0xce03('0x22')](function(){return _0xce21eb;});}});});});}})[_0xce03('0x22')](respondWithResult(_0x1b4881,0xc9))[_0xce03('0x3e')](handleError(_0x1b4881,null));};exports[_0xce03('0x52')]=function(_0x14ae06,_0x27bcb7){if(_0x14ae06[_0xce03('0x43')]['id']){delete _0x14ae06[_0xce03('0x43')]['id'];}return db[_0xce03('0x2a')][_0xce03('0x41')]({'where':{'id':_0x14ae06['params']['id']}})[_0xce03('0x22')](handleEntityNotFound(_0x27bcb7,null))[_0xce03('0x22')](saveUpdates(_0x14ae06[_0xce03('0x43')],null))[_0xce03('0x22')](respondWithResult(_0x27bcb7,null))[_0xce03('0x3e')](handleError(_0x27bcb7,null));};exports['destroy']=function(_0x2f2ae4,_0x12a80c){return db[_0xce03('0x2a')][_0xce03('0x41')]({'where':{'id':_0x2f2ae4['params']['id']}})['then'](handleEntityNotFound(_0x12a80c,null))[_0xce03('0x22')](removeEntity(_0x12a80c,null))[_0xce03('0x3e')](handleError(_0x12a80c,null));};exports[_0xce03('0x53')]=function(_0x440432,_0x3e8661){return db[_0xce03('0x2a')][_0xce03('0x53')]()[_0xce03('0x22')](respondWithResult(_0x3e8661,null))[_0xce03('0x3e')](handleError(_0x3e8661,null));};exports['addSections']=function(_0x259a79,_0x273c5a){var _0x1c4330=_0x259a79[_0xce03('0x43')];return db[_0xce03('0x2a')]['find']({'where':{'id':_0x259a79[_0xce03('0x45')]['id']}})['then'](handleEntityNotFound(_0x273c5a,null))[_0xce03('0x22')](function(_0x47eca5){if(_0x47eca5){return db[_0xce03('0x4a')][_0xce03('0x54')](function(_0x4ff277){return db[_0xce03('0x4b')][_0xce03('0x23')]({'where':{'userProfileId':_0x259a79[_0xce03('0x45')]['id'],'sectionId':_[_0xce03('0x29')](_0x1c4330,function(_0x1950b3){return _0x1950b3[_0xce03('0x4f')];})},'transaction':_0x4ff277})[_0xce03('0x22')](function(){var _0x1b3a45=_['map'](_0x1c4330,function(_0x15aecb){_0x15aecb['userProfileId']=_0x259a79[_0xce03('0x45')]['id'];return _0x15aecb;});var _0x4b6f94=[];return BPromise[_0xce03('0x55')](_0x1b3a45,function(_0x28d280){return db[_0xce03('0x4b')][_0xce03('0x42')](_0x28d280,{'include':[{'model':db['UserProfileResource'],'as':_0xce03('0x51')}],'raw':!![],'transaction':_0x4ff277})[_0xce03('0x22')](function(_0x459592){_0x4b6f94['push'](_0x459592[_0xce03('0x46')]({'plain':!![]}));});})[_0xce03('0x22')](function(){return _0x4b6f94;});});});}})[_0xce03('0x22')](function(_0x111950){return _0x111950;})[_0xce03('0x22')](respondWithResult(_0x273c5a,null))[_0xce03('0x3e')](handleError(_0x273c5a,null));};exports['removeSections']=function(_0xb9ef47,_0x2aff44){var _0x26a1d2;return db[_0xce03('0x2a')]['find']({'where':{'id':_0xb9ef47[_0xce03('0x45')]['id']},'attributes':['id',_0xce03('0x26')]})['then'](handleEntityNotFound(_0x2aff44,null))[_0xce03('0x22')](function(_0x44768d){if(_0x44768d){_0x26a1d2=_0x44768d;return db[_0xce03('0x4b')]['destroy']({'where':{'userProfileId':_0xb9ef47[_0xce03('0x45')]['id'],'sectionId':_0xb9ef47[_0xce03('0x2d')]['ids']}});}})['then'](function(){return _0x26a1d2;})[_0xce03('0x22')](respondWithStatusCode(_0x2aff44,null))[_0xce03('0x3e')](handleError(_0x2aff44,null));};exports[_0xce03('0x56')]=function(_0x418dad,_0x1d117d){var _0x28c76b=[];var _0x46f86d=[];return db[_0xce03('0x4b')]['findAll']({'where':{'userProfileId':_0x418dad[_0xce03('0x45')]['id']},'raw':!![]})['then'](function(_0x3a5a3b){_0x28c76b=_[_0xce03('0x39')](_0x3a5a3b,function(_0x8e2b80){return _0x8e2b80[_0xce03('0x57')]===0x1||_['includes']([0x3eb,0x709],_0x8e2b80[_0xce03('0x4f')]);});if(!_[_0xce03('0x58')](_0x28c76b)){return _[_0xce03('0x29')](_0x28c76b,function(_0x2ac815){return _0x2ac815[_0xce03('0x4f')];});}else{return;}})[_0xce03('0x22')](function(_0x4e4efa){if(_0x4e4efa)_0x46f86d=_0x4e4efa;if(_[_0xce03('0x59')](_0x46f86d,0x64)){var _0x4c18a6=_[_0xce03('0x41')](_0x28c76b,{'sectionId':0x64});return hasDefaultDashboard(_0x4c18a6)[_0xce03('0x22')](function(_0x37d0be){return _[_0xce03('0x29')](_0x28c76b,function(_0x14aad4){if(_0x14aad4[_0xce03('0x4f')]===0x64){_0x14aad4[_0xce03('0x5a')]=_0x37d0be;}return _0x14aad4;});});}else{return;}})[_0xce03('0x22')](function(_0x4083f9){if(_0x4083f9)_0x28c76b=_0x4083f9;if(_['includes'](_0x46f86d,0x3eb)){var _0x2c24e9=_[_0xce03('0x41')](_0x28c76b,{'sectionId':0x3eb});return getCustomDashboards(_0x2c24e9)[_0xce03('0x22')](function(_0x362fcc){return _[_0xce03('0x29')](_0x28c76b,function(_0x2c31e8){if(_0x2c24e9['enabled']){if(_0x2c31e8[_0xce03('0x4f')]===0x3eb){_0x2c31e8[_0xce03('0x5a')]=_0x362fcc;}}else{if(_0x2c31e8[_0xce03('0x4f')]===0x64){_0x2c31e8[_0xce03('0x5a')]=_0x362fcc;}}return _0x2c31e8;});});}else{return;}})[_0xce03('0x22')](function(_0x1aeab3){if(_0x1aeab3)_0x28c76b=_0x1aeab3;if(_[_0xce03('0x59')](_0x46f86d,0x709)){var _0x49f307=_[_0xce03('0x41')](_0x28c76b,{'sectionId':0x709});return getPlugins(_0x49f307)['then'](function(_0x12f763){if(_0x49f307[_0xce03('0x57')]){return _[_0xce03('0x29')](_0x28c76b,function(_0x4e9746){if(_0x4e9746[_0xce03('0x4f')]===0x709){_0x4e9746[_0xce03('0x5a')]=_0x12f763;}return _0x4e9746;});}else{var _0x152965={'sectionId':0x76c,'enabled':0x1,'subsections':_0x12f763};var _0x4575ce=_[_0xce03('0x29')](_0x28c76b);_0x4575ce[_0xce03('0x5b')](_0x152965);return _0x4575ce;}});}else{return;}})[_0xce03('0x22')](function(_0xa319e4){if(_0xa319e4)_0x28c76b=_0xa319e4;return _[_0xce03('0x39')](_0x28c76b,['enabled',0x1]);})[_0xce03('0x22')](respondWithResult(_0x1d117d,null))[_0xce03('0x3e')](handleError(_0x1d117d,null));};function hasDefaultDashboard(_0x421449){var _0x2b920f=[0x65];return new BPromise(function(_0x174811,_0x13f88a){try{if(_0x421449[_0xce03('0x4d')]){_0x174811(_0x2b920f);}else{return db[_0xce03('0x4e')][_0xce03('0x5c')]({'where':{'sectionId':_0x421449['id']},'raw':!![]})[_0xce03('0x22')](function(_0x31d442){_0x31d442?_0x174811(_0x2b920f):_0x174811();});}}catch(_0x5e9c19){_0x13f88a(_0x5e9c19);}});}function getCustomDashboards(_0x5caba2){var _0x26686b=[];return new BPromise(function(_0x58698f,_0x189c71){try{if(_0x5caba2[_0xce03('0x4d')]){return db[_0xce03('0x5d')]['findAll']({'raw':!![]})[_0xce03('0x22')](function(_0x3e9e87){_0x3e9e87[_0xce03('0x5e')](function(_0x5a37f0){_0x26686b[_0xce03('0x5b')](_0x5a37f0['id']+0x1869f);});_0x58698f(_0x26686b);});}else{return db['UserProfileResource']['findAll']({'where':{'sectionId':_0x5caba2['id']},'raw':!![]})['then'](function(_0x17dec8){_0x17dec8['forEach'](function(_0x1987ab){_0x26686b[_0xce03('0x5b')](_0x1987ab[_0xce03('0x5f')]+0x1869f);});_0x58698f(_0x26686b);});}}catch(_0x5de943){_0x189c71(_0x5de943);}});}function getPlugins(_0x232983){var _0x27f3b2=[];return new BPromise(function(_0x506aeb,_0x3f2cd3){try{if(_0x232983[_0xce03('0x4d')]){return db[_0xce03('0x60')][_0xce03('0x4c')]({'raw':!![]})[_0xce03('0x22')](function(_0x5935c3){_0x5935c3[_0xce03('0x5e')](function(_0x2470d4){_0x27f3b2[_0xce03('0x5b')](_0x2470d4['id']+0x15b38);});_0x506aeb(_0x27f3b2);});}else{return db[_0xce03('0x4e')]['findAll']({'where':{'sectionId':_0x232983['id']},'raw':!![]})['then'](function(_0xf91112){_0xf91112[_0xce03('0x5e')](function(_0x5dded4){_0x27f3b2[_0xce03('0x5b')](_0x5dded4[_0xce03('0x5f')]+0x15b38);});_0x506aeb(_0x27f3b2);});}}catch(_0x4fe7a4){_0x3f2cd3(_0x4fe7a4);}});}exports[_0xce03('0x61')]=function(_0x3e5fae,_0x132d26){return db[_0xce03('0x2a')][_0xce03('0x41')]({'where':{'id':_0x3e5fae[_0xce03('0x45')]['id']}})[_0xce03('0x22')](handleEntityNotFound(_0x132d26,null))['then'](function(_0x2595b6){if(_0x2595b6){return db['sequelize'][_0xce03('0x54')](function(_0x3e70f2){return db[_0xce03('0x4b')][_0xce03('0x4c')]({'where':{'userProfileId':_0x3e5fae[_0xce03('0x45')]['id']},'attributes':['id'],'raw':!![]})[_0xce03('0x22')](function(_0x280a71){if(_0x280a71){return db[_0xce03('0x4b')][_0xce03('0x23')]({'where':{'userProfileId':_0x3e5fae['params']['id'],'id':_[_0xce03('0x29')](_0x280a71,function(_0x98f074){return _0x98f074['id'];})},'transaction':_0x3e70f2});}})[_0xce03('0x22')](function(_0x1bae0d){var _0x459a21=_[_0xce03('0x29')](_0x3e5fae['body'],function(_0x2cb9a2){_0x2cb9a2[_0xce03('0x50')]=_0x3e5fae[_0xce03('0x45')]['id'];return _0x2cb9a2;});return db[_0xce03('0x4b')]['bulkCreate'](_0x459a21,{'raw':!![],'transaction':_0x3e70f2});})[_0xce03('0x22')](function(_0x46b76c){var _0x4dbada=_['filter'](_[_0xce03('0x29')](_0x46b76c,function(_0x4c6834){return _0x4c6834[_0xce03('0x46')]({'plain':!![]});}),{'includeAll':![]});if(_0x4dbada){return db['UserProfileSection'][_0xce03('0x4c')]({'where':{'userProfileId':_0x3e5fae['params']['id'],'sectionId':_['map'](_0x4dbada,function(_0x5bd234){return _0x5bd234[_0xce03('0x4f')];})},'attributes':['id',_0xce03('0x4f')],'raw':!![]})[_0xce03('0x22')](function(_0x15116b){var _0x4c554d=_[_0xce03('0x29')](_0x3e5fae[_0xce03('0x43')],function(_0x4883e0){_0x4883e0[_0xce03('0x50')]=_0x3e5fae[_0xce03('0x45')]['id'];return _0x4883e0;});return db['UserProfileResource'][_0xce03('0x62')](_0x4c554d,{'raw':!![],'transaction':_0x3e70f2});});}})[_0xce03('0x3e')](handleError(_0x132d26,null));});}})[_0xce03('0x22')](function(_0x6ceee5){var _0xde171d=_[_0xce03('0x29')](_0x6ceee5,function(_0x21c5af){return _0x21c5af['get']({'plain':!![]});});})[_0xce03('0x22')](respondWithResult(_0x132d26,null))[_0xce03('0x3e')](handleError(_0x132d26,null));};exports[_0xce03('0x63')]=function(_0x20fd74,_0x4b5a74,_0x5a527d){return db[_0xce03('0x2a')]['find']({'where':{'id':_0x20fd74[_0xce03('0x45')]['id']}})[_0xce03('0x22')](handleEntityNotFound(_0x4b5a74,null))[_0xce03('0x22')](function(_0x28adb9){if(_0x28adb9){return _0x28adb9[_0xce03('0x63')](_0x20fd74[_0xce03('0x2d')]['ids']);}})[_0xce03('0x22')](respondWithStatusCode(_0x4b5a74,null))[_0xce03('0x3e')](handleError(_0x4b5a74,null));};exports['getResources']=function(_0x171b9f,_0x3e60fa){var _0x193c65={'raw':![],'where':{}};var _0x106d2f={};var _0x2813a0={'count':0x0,'rows':[]};var _0x8e2af0=_0x171b9f[_0xce03('0x2d')][_0xce03('0x64')];if(typeof _0x8e2af0===_0xce03('0x65')){throw new db[(_0xce03('0x66'))][(_0xce03('0x67'))]('Unknown\x20section');}var _0x55d8e4=_0x171b9f[_0xce03('0x2d')][_0xce03('0x68')]||![];var _0x54789d=getQueryModels(_0x8e2af0,_0x55d8e4);if(typeof _0x54789d['childModel']===_0xce03('0x65')){throw new db[(_0xce03('0x66'))][(_0xce03('0x67'))](_0xce03('0x69')+_0x8e2af0+'\x27');}var _0x186f9c=[];if(!_[_0xce03('0x58')](_0x54789d[_0xce03('0x6a')])){_0x186f9c=_0x54789d[_0xce03('0x6a')];}else{_0x186f9c=[{'name':_0x8e2af0}];}return db[_0xce03('0x2a')][_0xce03('0x5c')]({'where':{'id':_0x171b9f['params']['id']}})[_0xce03('0x22')](handleEntityNotFound(_0x3e60fa,null))[_0xce03('0x22')](function(_0x1ec870){if(_0x1ec870){var _0x2c4658=[];for(var _0x3acd72=0x0;_0x3acd72<_0x186f9c[_0xce03('0x34')];_0x3acd72++){_0x2c4658['push'](db[_0xce03('0x4b')][_0xce03('0x5c')]({'where':{'userProfileId':_0x1ec870['id'],'name':_0x186f9c[_0x3acd72]['name']},'raw':!![]}));}return BPromise[_0xce03('0x6b')](_0x2c4658);}})['then'](function(_0x228ea3){var _0x53259c=_[_0xce03('0x39')](_0x228ea3,function(_0x1b6127){return _0x1b6127?_0x1b6127:undefined;});var _0x2acf53=_['filter'](_0x186f9c,[_0xce03('0x6c'),!![]]);var _0x37fb38=_[_0xce03('0x58')](_0x53259c)&&_[_0xce03('0x58')](_0x2acf53)?null:_[_0xce03('0x6d')](_0x2acf53,_0x53259c);if(_0x37fb38){var _0x10a35f=[];for(var _0x4b08cb=0x0;_0x4b08cb<_0x37fb38[_0xce03('0x34')];_0x4b08cb++){var _0x239100=_['find'](_0x186f9c,function(_0x5e4c2e){return _0x37fb38[_0x4b08cb]?_0x5e4c2e[_0xce03('0x26')]===_0x37fb38[_0x4b08cb]['name']:null;});if(_0x239100){if(_0x37fb38[_0x4b08cb]['ignore']){_0x10a35f[_0xce03('0x5b')](getAllResources(_0x54789d[_0xce03('0x6e')],_0x37fb38[_0x4b08cb]));}else{if(!_0x37fb38[_0x4b08cb][_0xce03('0x4d')]){_0x10a35f[_0xce03('0x5b')](getAllowedResources(_0x239100,_0x37fb38[_0x4b08cb],_0x54789d[_0xce03('0x6e')]));}else{if(_0x239100['model']){_0x10a35f[_0xce03('0x5b')](getAllFilteredResources(_0x239100,_0x37fb38[_0x4b08cb]));}}}}}return BPromise[_0xce03('0x6b')](_0x10a35f);}else{return null;}})['then'](function(_0x295c01){var _0x166af5=_0x295c01;var _0x52348d=null;if(_0x166af5){_0x52348d=_0x166af5[_0xce03('0x34')]===0x1?_0x166af5[0x0]:null;}if(_0x52348d||_0x166af5){var _0xd3a5dc=db[_0x54789d[_0xce03('0x6e')]][_0xce03('0x2b')];_0x106d2f[_0xce03('0x31')]=_['keys'](_0xd3a5dc);_0x106d2f[_0xce03('0x2d')]=_[_0xce03('0x2e')](_0x171b9f[_0xce03('0x2d')]);_0x106d2f[_0xce03('0x2f')]=_['intersection'](_0x106d2f[_0xce03('0x31')],_0x106d2f[_0xce03('0x2d')]);_0x193c65[_0xce03('0x32')]=_[_0xce03('0x30')](_0x106d2f[_0xce03('0x31')],qs[_0xce03('0x33')](_0x171b9f[_0xce03('0x2d')][_0xce03('0x33')]));_0x193c65[_0xce03('0x32')]=_0x193c65[_0xce03('0x32')]['length']?_0x193c65[_0xce03('0x32')]:_0x106d2f['model'];if(!_0x171b9f[_0xce03('0x2d')][_0xce03('0x35')](_0xce03('0x6f'))){_0x193c65['limit']=qs[_0xce03('0x1d')](_0x171b9f['query']['limit']);_0x193c65[_0xce03('0x1c')]=qs[_0xce03('0x1c')](_0x171b9f[_0xce03('0x2d')][_0xce03('0x1c')]);}_0x193c65['order']=qs[_0xce03('0x37')](_0x171b9f[_0xce03('0x2d')]['sort']);_0x193c65['where']=qs['filters'](_[_0xce03('0x70')](_0x171b9f[_0xce03('0x2d')],_0x106d2f[_0xce03('0x2f')]));if(_0x171b9f[_0xce03('0x2d')][_0xce03('0x39')]){_0x193c65['where']=_['merge'](_0x193c65[_0xce03('0x38')],{'$or':_[_0xce03('0x29')](_0xd3a5dc,function(_0x5461f5){if(_0x5461f5[_0xce03('0x2c')][_0xce03('0x71')]!==_0xce03('0x72')){var _0xea2b95={};_0xea2b95[_0x5461f5[_0xce03('0x73')]]={'$like':'%'+_0x171b9f[_0xce03('0x2d')][_0xce03('0x39')]+'%'};return _0xea2b95;}})});}var _0x26f571=[];if(_0x52348d){var _0xc950d9=_[_0xce03('0x41')](_0x186f9c,[_0xce03('0x26'),_0x52348d[_0xce03('0x26')]]);if(_0xc950d9['field']){var _0x2031ae={};if(_0x54789d[_0xce03('0x6e')]===_0xce03('0x74')){_0x2031ae[_0xc950d9[_0xce03('0x75')]]=_[_0xce03('0x29')](_0x52348d[_0xce03('0x76')],'id');}else{_0x2031ae[_0xc950d9[_0xce03('0x75')]]=_0x52348d[_0xce03('0x76')];}_0x26f571['push'](_0x2031ae);}else{_0x193c65[_0xce03('0x38')]['id']=_0x52348d[_0xce03('0x76')];}}else{for(var _0x54a6f2=0x0;_0x54a6f2<_0x166af5['length'];_0x54a6f2++){var _0xc950d9=_['find'](_0x186f9c,[_0xce03('0x26'),_0x166af5[_0x54a6f2][_0xce03('0x26')]]);if(_0xc950d9[_0xce03('0x73')]){var _0x2031ae={};_0x2031ae[_0xc950d9[_0xce03('0x75')]]=_0x166af5[_0x54a6f2][_0xce03('0x76')];_0x26f571['push'](_0x2031ae);}else{if(!_0x193c65[_0xce03('0x38')]['id'])_0x193c65[_0xce03('0x38')]['id']=[];_0x166af5[_0x54a6f2][_0xce03('0x76')][_0xce03('0x5e')](function(_0x1a054f){_0x193c65['where']['id'][_0xce03('0x5b')](_0x1a054f);});}}}if(!_[_0xce03('0x58')](_0x26f571)){_0x193c65[_0xce03('0x38')]=_[_0xce03('0x3a')](_0x193c65['where'],{'$and':{'$or':_0x26f571}});}_0x193c65=_[_0xce03('0x3a')]({},_0x193c65,_0x171b9f[_0xce03('0x40')]);if(_0x52348d&&!_0x52348d[_0xce03('0x4d')]&&_0x54789d[_0xce03('0x6e')]===_0xce03('0x74')){if(_0x171b9f['query']['includeAll']){_0x193c65[_0xce03('0x3d')]=[{'all':!![]}];}return db[_0x54789d['childModel']][_0xce03('0x4c')](_0x193c65)[_0xce03('0x22')](function(_0xd1170){var _0xafbd09=[];_0xd1170[_0xce03('0x5e')](function(_0xd83121){var _0x46db70;switch(_0xd83121[_0xce03('0x77')]){case _0xce03('0x78'):_0x46db70=_[_0xce03('0x41')](_0x52348d[_0xce03('0x76')],function(_0x5285bd){return _0x5285bd['id']===_0xd83121['reportId']&&_0x5285bd[_0xce03('0x2c')]===_0xce03('0x79');});break;case _0xce03('0x7a'):_0x46db70=_['find'](_0x52348d[_0xce03('0x76')],function(_0x449dbc){return _0x449dbc['id']===_0xd83121[_0xce03('0x7b')]&&_0x449dbc['type']===_0xce03('0x7c');});break;}if(_0x46db70)_0xafbd09[_0xce03('0x5b')](_0xd83121);});_0x2813a0[_0xce03('0x3b')]=_0xafbd09['length'];_0x2813a0['rows']=_0xafbd09;return _0x2813a0;});}else{return db[_0x54789d[_0xce03('0x6e')]]['count']({'where':_0x193c65[_0xce03('0x38')]})[_0xce03('0x22')](function(_0x4d4a77){_0x2813a0[_0xce03('0x3b')]=_0x4d4a77;if(_0x171b9f[_0xce03('0x2d')][_0xce03('0x3c')]){if(_0x54789d[_0xce03('0x6e')]===_0xce03('0x7d')){_0x193c65[_0xce03('0x3d')]=[{'model':db[_0xce03('0x7e')],'as':_0xce03('0x7f'),'attributes':['id','name',_0xce03('0x80')],'required':_0x171b9f['query'][_0xce03('0x81')]?!![]:![]},{'model':db['Tag'],'as':_0xce03('0x82'),'attributes':['id',_0xce03('0x26'),'color'],'through':_0x171b9f[_0xce03('0x2d')]['tag']?{'attributes':[],'where':{'TagId':_0x171b9f[_0xce03('0x2d')][_0xce03('0x81')]||undefined}}:{},'required':_0x171b9f[_0xce03('0x2d')][_0xce03('0x81')]?!![]:![]}];}else{_0x193c65['include']=[{'all':!![]}];}}return db[_0x54789d[_0xce03('0x6e')]][_0xce03('0x4c')](_0x193c65);})[_0xce03('0x22')](function(_0x153050){_0x2813a0[_0xce03('0x83')]=_0x153050;return _0x2813a0;});}}else{return _0x2813a0;}})['then'](respondWithFilteredResult(_0x3e60fa,_0x193c65))[_0xce03('0x3e')](handleError(_0x3e60fa,null));};function getAllResources(_0x139aef,_0xa2abfd){return new BPromise(function(_0x2740ab,_0x371ee5){if(_0xa2abfd){var _0xc07d4f=_0xa2abfd[_0xce03('0x39')]?{[_0xa2abfd[_0xce03('0x39')][_0xce03('0x73')]]:_0xa2abfd[_0xce03('0x39')][_0xce03('0x84')]}:undefined;return db[_0x139aef][_0xce03('0x4c')]({'where':_0xc07d4f,'raw':!![]})[_0xce03('0x22')](function(_0x79e56f){_0xa2abfd[_0xce03('0x76')]=_['map'](_0x79e56f,'id');_0x2740ab(_0xa2abfd);})[_0xce03('0x3e')](function(_0xc69453){_0x371ee5(_0xc69453);});}else{_0x2740ab(null);}});}function getAllFilteredResources(_0x1a453d,_0x22173a){return new BPromise(function(_0x44c324,_0x18ccc4){var _0x344ddc=_0x1a453d['filter']?{[_0x1a453d['filter'][_0xce03('0x73')]]:_0x1a453d[_0xce03('0x39')][_0xce03('0x84')]}:undefined;return db[_0x1a453d['model']][_0xce03('0x4c')]({'where':_0x344ddc,'raw':!![]})[_0xce03('0x22')](function(_0x9c7487){_0x22173a[_0xce03('0x76')]=_['map'](_0x9c7487,function(_0x2f38b2){return _0x2f38b2['name'];});_0x44c324(_0x22173a);})[_0xce03('0x3e')](function(_0x58826f){_0x18ccc4(_0x58826f);});});}function getAllowedResources(_0x4e5b67,_0x441efa,_0x43e658){return new BPromise(function(_0x423c33,_0x3d2b2c){if(_0x441efa){return db['UserProfileResource'][_0xce03('0x4c')]({'where':{'sectionId':_0x441efa['id']},'raw':!![]})[_0xce03('0x22')](function(_0x50a0b0){if(_0x4e5b67[_0xce03('0x73')]&&_0x4e5b67['field']!=='id'){_0x441efa[_0xce03('0x76')]=_[_0xce03('0x29')](_0x50a0b0,function(_0x3424f7){return _0x3424f7[_0x4e5b67[_0xce03('0x73')]];});}else{if(_0x43e658===_0xce03('0x74')){_0x441efa[_0xce03('0x76')]=_[_0xce03('0x29')](_0x50a0b0,function(_0x472a81){return{'id':_0x472a81[_0xce03('0x5f')],'type':_0x472a81[_0xce03('0x2c')]};});}else{_0x441efa[_0xce03('0x76')]=_[_0xce03('0x29')](_0x50a0b0,function(_0x362fc7){return _0x362fc7[_0xce03('0x5f')];});}}_0x423c33(_0x441efa);})[_0xce03('0x3e')](function(_0x4909ae){_0x3d2b2c(_0x4909ae);});}else{_0x423c33(null);}});}function getQueryModels(_0x5bfa32,_0x351eeb){var _0x2604d8=_0x5bfa32[_0xce03('0x85')]();var _0xf4748a={'childModel':undefined,'parentSections':[]};switch(_0x2604d8){case _0xce03('0x86'):_0xf4748a[_0xce03('0x6e')]=_0xce03('0x87');break;case _0xce03('0x88'):_0xf4748a[_0xce03('0x6e')]=_0xce03('0x89');break;case _0xce03('0x8a'):_0xf4748a[_0xce03('0x6e')]='SquareRecording';_0xf4748a['parentSections']=[{'name':_0xce03('0x8b'),'field':_0xce03('0x26'),'foreignKey':_0xce03('0x8c')}];break;case _0xce03('0x8d'):_0xf4748a[_0xce03('0x6e')]=_0xce03('0x8e');break;case _0xce03('0x8f'):_0xf4748a[_0xce03('0x6e')]=_0xce03('0x7d');_0xf4748a['parentSections']=[{'name':'Lists','field':'id','foreignKey':'ListId'}];break;case _0xce03('0x90'):_0xf4748a['childModel']=_0xce03('0x91');break;case _0xce03('0x92'):_0xf4748a['childModel']=_0xce03('0x93');break;case _0xce03('0x94'):_0xf4748a[_0xce03('0x6e')]=_0xce03('0x95');break;case _0xce03('0x96'):_0xf4748a[_0xce03('0x6e')]=_0xce03('0x97');break;case _0xce03('0x98'):_0xf4748a['childModel']=_0xce03('0x99');break;case _0xce03('0x9a'):_0xf4748a[_0xce03('0x6e')]=_0xce03('0x9b');break;case _0xce03('0x9c'):_0xf4748a[_0xce03('0x6e')]=_0xce03('0x9d');break;case _0xce03('0x9e'):case _0xce03('0x9f'):case _0xce03('0xa0'):_0xf4748a[_0xce03('0x6e')]=_0xce03('0xa1');break;case _0xce03('0xa2'):_0xf4748a['childModel']=_0xce03('0xa3');break;case _0xce03('0xa4'):_0xf4748a[_0xce03('0x6e')]=_0xce03('0xa5');break;case'voicerecordings':_0xf4748a[_0xce03('0x6e')]=_0xce03('0xa6');_0xf4748a[_0xce03('0x6a')]=[{'name':_0xce03('0xa7'),'field':_0xce03('0x26'),'foreignKey':_0xce03('0xa8'),'model':_0xce03('0xa9'),'filter':{'field':_0xce03('0xaa'),'value':[_0xce03('0xab')]}},{'name':_0xce03('0xac'),'field':'name','foreignKey':_0xce03('0xa8'),'model':_0xce03('0xa9'),'filter':{'field':'role','value':[_0xce03('0xad')]}},{'name':_0xce03('0xae'),'field':_0xce03('0x26'),'foreignKey':'queue','model':_0xce03('0xaf'),'filter':{'field':_0xce03('0x2c'),'value':['inbound']}},{'name':_0xce03('0xb0'),'field':_0xce03('0x26'),'foreignKey':_0xce03('0xb1'),'model':_0xce03('0xaf'),'filter':{'field':_0xce03('0x2c'),'value':[_0xce03('0xb2')]}}];break;case _0xce03('0xb3'):_0xf4748a[_0xce03('0x6e')]=_0xce03('0xb4');break;case _0xce03('0xb5'):_0xf4748a['childModel']='VoiceChanSpy';break;case _0xce03('0xb6'):_0xf4748a[_0xce03('0x6e')]=_0xce03('0xb7');break;case'ivrcampaigns':_0xf4748a[_0xce03('0x6e')]='Campaign';break;case'mailqueues':_0xf4748a[_0xce03('0x6e')]=_0xce03('0xb8');break;case _0xce03('0xb9'):_0xf4748a[_0xce03('0x6e')]=_0xce03('0xba');break;case'mailsubstatuses':_0xf4748a[_0xce03('0x6e')]='MailSubstatus';break;case _0xce03('0xbb'):_0xf4748a[_0xce03('0x6e')]='OpenchannelQueue';break;case _0xce03('0xbc'):_0xf4748a[_0xce03('0x6e')]='OpenchannelAccount';break;case _0xce03('0xbd'):_0xf4748a['childModel']=_0xce03('0xbe');break;case _0xce03('0xbf'):_0xf4748a['childModel']=_0xce03('0xc0');break;case _0xce03('0xc1'):_0xf4748a[_0xce03('0x6e')]=_0xce03('0xc2');break;case _0xce03('0xc3'):case'queuecampaigns':_0xf4748a['childModel']=_0xce03('0xaf');if(_0x351eeb){_0xf4748a['parentSections']=[{'name':_0xce03('0xae')},{'name':_0xce03('0xb0')}];}break;case _0xce03('0xc4'):case'agents':case _0xce03('0xc5'):_0xf4748a['childModel']=_0xce03('0xa9');if(_0x351eeb){_0xf4748a[_0xce03('0x6a')]=[{'name':_0xce03('0xc6'),'filter':{'field':_0xce03('0xaa'),'value':[_0xce03('0xc7'),_0xce03('0xc8')]},'ignore':!![]},{'name':_0xce03('0xa7')},{'name':_0xce03('0xac')}];}break;case _0xce03('0xc9'):_0xf4748a[_0xce03('0x6e')]='ZendeskAccount';break;case _0xce03('0xca'):_0xf4748a['childModel']='SalesforceAccount';break;case'freshdeskaccounts':_0xf4748a[_0xce03('0x6e')]=_0xce03('0xcb');break;case _0xce03('0xcc'):_0xf4748a[_0xce03('0x6e')]=_0xce03('0xcd');break;case _0xce03('0xce'):_0xf4748a[_0xce03('0x6e')]=_0xce03('0xcf');break;case'zohoaccounts':_0xf4748a[_0xce03('0x6e')]='ZohoAccount';break;case'vtigeraccounts':_0xf4748a[_0xce03('0x6e')]=_0xce03('0xa9');break;case _0xce03('0xd0'):_0xf4748a[_0xce03('0x6e')]=_0xce03('0xd1');break;case _0xce03('0xd2'):_0xf4748a['childModel']='Disposition';break;case _0xce03('0xd3'):_0xf4748a[_0xce03('0x6e')]=_0xce03('0x5d');break;case'intervals':_0xf4748a[_0xce03('0x6e')]=_0xce03('0xd4');break;case'pauses':_0xf4748a[_0xce03('0x6e')]=_0xce03('0xd5');break;case _0xce03('0xd6'):_0xf4748a[_0xce03('0x6e')]=_0xce03('0xd7');break;case _0xce03('0xd8'):_0xf4748a[_0xce03('0x6e')]='Sound';break;case _0xce03('0xd9'):_0xf4748a[_0xce03('0x6e')]=_0xce03('0x7e');break;case _0xce03('0xda'):_0xf4748a[_0xce03('0x6e')]=_0xce03('0xdb');break;case'triggers':_0xf4748a[_0xce03('0x6e')]='Trigger';break;case _0xce03('0xdc'):_0xf4748a[_0xce03('0x6e')]=_0xce03('0xdd');break;case'variables':_0xf4748a[_0xce03('0x6e')]=_0xce03('0xde');break;case _0xce03('0xdf'):_0xf4748a[_0xce03('0x6e')]='Plugin';break;case _0xce03('0xe0'):_0xf4748a[_0xce03('0x6e')]=_0xce03('0x74');_0xf4748a[_0xce03('0x6a')]=[{'name':'Reports','field':'id','foreignKey':_0xce03('0x7b')}];break;case _0xce03('0xe1'):_0xf4748a[_0xce03('0x6e')]='AnalyticMetric';break;default:return _0xf4748a;}return _0xf4748a;} \ No newline at end of file diff --git a/server/api/userProfile/userProfile.events.js b/server/api/userProfile/userProfile.events.js index 307dd21..a48a31c 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 _0xf363=['setMaxListeners','save','update','remove','emit','hasOwnProperty','exports','events','../../mysqldb','UserProfile'];(function(_0x54f695,_0x17e578){var _0x5d8f73=function(_0x19fdb2){while(--_0x19fdb2){_0x54f695['push'](_0x54f695['shift']());}};_0x5d8f73(++_0x17e578);}(_0xf363,0x183));var _0x3f36=function(_0xd86a6f,_0x4b6b69){_0xd86a6f=_0xd86a6f-0x0;var _0x54b45f=_0xf363[_0xd86a6f];return _0x54b45f;};'use strict';var EventEmitter=require(_0x3f36('0x0'));var UserProfile=require(_0x3f36('0x1'))['db'][_0x3f36('0x2')];var UserProfileEvents=new EventEmitter();UserProfileEvents[_0x3f36('0x3')](0x0);var events={'afterCreate':_0x3f36('0x4'),'afterUpdate':_0x3f36('0x5'),'afterDestroy':_0x3f36('0x6')};function emitEvent(_0x5b7adf){return function(_0x1ac533,_0xf96eb7,_0x4c79c8){UserProfileEvents[_0x3f36('0x7')](_0x5b7adf+':'+_0x1ac533['id'],_0x1ac533);UserProfileEvents[_0x3f36('0x7')](_0x5b7adf,_0x1ac533);_0x4c79c8(null);};}for(var e in events){if(events[_0x3f36('0x8')](e)){var event=events[e];UserProfile['hook'](e,emitEvent(event));}}module[_0x3f36('0x9')]=UserProfileEvents; \ No newline at end of file +var _0x940c=['save','update','emit','hasOwnProperty','exports','events','../../mysqldb','UserProfile','setMaxListeners'];(function(_0x316f55,_0x2b7cc1){var _0x4e48af=function(_0x44e2ea){while(--_0x44e2ea){_0x316f55['push'](_0x316f55['shift']());}};_0x4e48af(++_0x2b7cc1);}(_0x940c,0x9e));var _0xc940=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x940c[_0x3dd15e];return _0x231fd0;};'use strict';var EventEmitter=require(_0xc940('0x0'));var UserProfile=require(_0xc940('0x1'))['db'][_0xc940('0x2')];var UserProfileEvents=new EventEmitter();UserProfileEvents[_0xc940('0x3')](0x0);var events={'afterCreate':_0xc940('0x4'),'afterUpdate':_0xc940('0x5'),'afterDestroy':'remove'};function emitEvent(_0x46821d){return function(_0x54d478,_0x2044b4,_0x1b1a51){UserProfileEvents[_0xc940('0x6')](_0x46821d+':'+_0x54d478['id'],_0x54d478);UserProfileEvents[_0xc940('0x6')](_0x46821d,_0x54d478);_0x1b1a51(null);};}for(var e in events){if(events[_0xc940('0x7')](e)){var event=events[e];UserProfile['hook'](e,emitEvent(event));}}module[_0xc940('0x8')]=UserProfileEvents; \ No newline at end of file diff --git a/server/api/userProfile/userProfile.model.js b/server/api/userProfile/userProfile.model.js index 25f8591..2dcd10e 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 _0x96fc=['path','rimraf','../../config/environment','./userProfile.attributes','define','UserProfile','user_profiles','lodash','util','api','moment','bluebird','request-promise'];(function(_0x2827a2,_0x45ab22){var _0xb99e21=function(_0x5558c0){while(--_0x5558c0){_0x2827a2['push'](_0x2827a2['shift']());}};_0xb99e21(++_0x45ab22);}(_0x96fc,0x13f));var _0xc96f=function(_0x59ee6f,_0x450239){_0x59ee6f=_0x59ee6f-0x0;var _0x4c0979=_0x96fc[_0x59ee6f];return _0x4c0979;};'use strict';var _=require(_0xc96f('0x0'));var util=require(_0xc96f('0x1'));var logger=require('../../config/logger')(_0xc96f('0x2'));var moment=require(_0xc96f('0x3'));var BPromise=require(_0xc96f('0x4'));var rp=require(_0xc96f('0x5'));var fs=require('fs');var path=require(_0xc96f('0x6'));var rimraf=require(_0xc96f('0x7'));var config=require(_0xc96f('0x8'));var attributes=require(_0xc96f('0x9'));module['exports']=function(_0x18bc2c,_0x2b5138){return _0x18bc2c[_0xc96f('0xa')](_0xc96f('0xb'),attributes,{'tableName':_0xc96f('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xe6b5=['UserProfile','user_profiles','lodash','moment','bluebird','../../config/environment','./userProfile.attributes','exports','define'];(function(_0x3420db,_0x5a212e){var _0x44ab98=function(_0x545dc6){while(--_0x545dc6){_0x3420db['push'](_0x3420db['shift']());}};_0x44ab98(++_0x5a212e);}(_0xe6b5,0x197));var _0x5e6b=function(_0x347a64,_0x1bcb70){_0x347a64=_0x347a64-0x0;var _0x3351be=_0xe6b5[_0x347a64];return _0x3351be;};'use strict';var _=require(_0x5e6b('0x0'));var util=require('util');var logger=require('../../config/logger')('api');var moment=require(_0x5e6b('0x1'));var BPromise=require(_0x5e6b('0x2'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x5e6b('0x3'));var attributes=require(_0x5e6b('0x4'));module[_0x5e6b('0x5')]=function(_0x5db01e,_0x2ebb40){return _0x5db01e[_0x5e6b('0x6')](_0x5e6b('0x7'),attributes,{'tableName':_0x5e6b('0x8'),'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 bd79217..92a31c6 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 _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(_0x54d5ba,_0x1f1ba9){var _0x6a592e=function(_0x394f8d){while(--_0x394f8d){_0x54d5ba['push'](_0x54d5ba['shift']());}};_0x6a592e(++_0x1f1ba9);}(_0xb4c7,0x1ea));var _0x7b4c=function(_0x540ab0,_0xb77378){_0x540ab0=_0x540ab0-0x0;var _0x2bdd03=_0xb4c7[_0x540ab0];return _0x2bdd03;};'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 +var _0x187d=['stringify','error','code','UserProfile,\x20%s,\x20%s','message','result','catch','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','client','http','redis','defaults','localhost','socket.io-emitter','register','then','info','request\x20sent','debug','UserProfile,\x20%s,\x20%s,\x20%s'];(function(_0x766efc,_0x2a0ed3){var _0x372426=function(_0x2f9998){while(--_0x2f9998){_0x766efc['push'](_0x766efc['shift']());}};_0x372426(++_0x2a0ed3);}(_0x187d,0x93));var _0xd187=function(_0x5e36d1,_0x471178){_0x5e36d1=_0x5e36d1-0x0;var _0x950b9e=_0x187d[_0x5e36d1];return _0x950b9e;};'use strict';var _=require(_0xd187('0x0'));var util=require('util');var moment=require(_0xd187('0x1'));var BPromise=require(_0xd187('0x2'));var rs=require(_0xd187('0x3'));var fs=require('fs');var Redis=require(_0xd187('0x4'));var db=require(_0xd187('0x5'))['db'];var utils=require(_0xd187('0x6'));var logger=require('../../config/logger')(_0xd187('0x7'));var config=require(_0xd187('0x8'));var jayson=require('jayson/promise');var client=jayson[_0xd187('0x9')][_0xd187('0xa')]({'port':0x232a});config[_0xd187('0xb')]=_[_0xd187('0xc')](config[_0xd187('0xb')],{'host':_0xd187('0xd'),'port':0x18eb});var socket=require(_0xd187('0xe'))(new Redis(config[_0xd187('0xb')]));require('./userProfile.socket')[_0xd187('0xf')](socket);function respondWithRpcPromise(_0x42848b,_0x4039f6,_0x473866){return new BPromise(function(_0x33ca45,_0x2a61a4){return client['request'](_0x42848b,_0x473866)[_0xd187('0x10')](function(_0x412ccf){logger[_0xd187('0x11')]('UserProfile,\x20%s,\x20%s',_0x4039f6,_0xd187('0x12'));logger[_0xd187('0x13')](_0xd187('0x14'),_0x4039f6,'request\x20sent',JSON[_0xd187('0x15')](_0x412ccf));if(_0x412ccf[_0xd187('0x16')]){if(_0x412ccf[_0xd187('0x16')][_0xd187('0x17')]===0x1f4){logger['error'](_0xd187('0x18'),_0x4039f6,_0x412ccf[_0xd187('0x16')][_0xd187('0x19')]);return _0x2a61a4(_0x412ccf[_0xd187('0x16')]['message']);}logger[_0xd187('0x16')]('UserProfile,\x20%s,\x20%s',_0x4039f6,_0x412ccf['error'][_0xd187('0x19')]);return _0x33ca45(_0x412ccf['error']['message']);}else{logger[_0xd187('0x11')](_0xd187('0x18'),_0x4039f6,_0xd187('0x12'));_0x33ca45(_0x412ccf[_0xd187('0x1a')][_0xd187('0x19')]);}})[_0xd187('0x1b')](function(_0x12b388){logger[_0xd187('0x16')](_0xd187('0x18'),_0x4039f6,_0x12b388);_0x2a61a4(_0x12b388);});});} \ No newline at end of file diff --git a/server/api/userProfile/userProfile.socket.js b/server/api/userProfile/userProfile.socket.js index 9707657..978bc9d 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 _0x2eee=['save','remove','update','emit','removeListener','length','./userProfile.events'];(function(_0x5f1cf8,_0x5e0923){var _0x27d0fa=function(_0x3f1171){while(--_0x3f1171){_0x5f1cf8['push'](_0x5f1cf8['shift']());}};_0x27d0fa(++_0x5e0923);}(_0x2eee,0x180));var _0xe2ee=function(_0x5a7d41,_0x4447e2){_0x5a7d41=_0x5a7d41-0x0;var _0x98d8fa=_0x2eee[_0x5a7d41];return _0x98d8fa;};'use strict';var UserProfileEvents=require(_0xe2ee('0x0'));var events=[_0xe2ee('0x1'),_0xe2ee('0x2'),_0xe2ee('0x3')];function createListener(_0x44aef7,_0x54ecc9){return function(_0x4d51e3){_0x54ecc9[_0xe2ee('0x4')](_0x44aef7,_0x4d51e3);};}function removeListener(_0x26debd,_0x5cb884){return function(){UserProfileEvents[_0xe2ee('0x5')](_0x26debd,_0x5cb884);};}exports['register']=function(_0x114791){for(var _0x452ad3=0x0,_0x3c21fb=events[_0xe2ee('0x6')];_0x452ad3<_0x3c21fb;_0x452ad3++){var _0x68a46b=events[_0x452ad3];var _0x215f2a=createListener('userProfile:'+_0x68a46b,_0x114791);UserProfileEvents['on'](_0x68a46b,_0x215f2a);}}; \ No newline at end of file +var _0x1a8d=['save','remove','emit','removeListener','register','length','userProfile:','./userProfile.events'];(function(_0x39096d,_0x51f8a0){var _0x13da4f=function(_0x11e6b2){while(--_0x11e6b2){_0x39096d['push'](_0x39096d['shift']());}};_0x13da4f(++_0x51f8a0);}(_0x1a8d,0x127));var _0xd1a8=function(_0x4c0240,_0x21fb25){_0x4c0240=_0x4c0240-0x0;var _0x15909b=_0x1a8d[_0x4c0240];return _0x15909b;};'use strict';var UserProfileEvents=require(_0xd1a8('0x0'));var events=[_0xd1a8('0x1'),_0xd1a8('0x2'),'update'];function createListener(_0xaceef7,_0x91c802){return function(_0x423300){_0x91c802[_0xd1a8('0x3')](_0xaceef7,_0x423300);};}function removeListener(_0x4a9e93,_0x48e12e){return function(){UserProfileEvents[_0xd1a8('0x4')](_0x4a9e93,_0x48e12e);};}exports[_0xd1a8('0x5')]=function(_0x1479f6){for(var _0x56bb21=0x0,_0x22bd14=events[_0xd1a8('0x6')];_0x56bb21<_0x22bd14;_0x56bb21++){var _0x1808c8=events[_0x56bb21];var _0x7f9fc7=createListener(_0xd1a8('0x7')+_0x1808c8,_0x1479f6);UserProfileEvents['on'](_0x1808c8,_0x7f9fc7);}}; \ No newline at end of file diff --git a/server/api/userProfileResource/index.js b/server/api/userProfileResource/index.js index 31e63ac..8590673 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 _0xb0fe=['../../components/interaction/service','./userProfileResource.controller','get','isAuthenticated','/describe','describe','/:id','show','post','update','destroy','exports','util','path','connect-timeout','express','Router','../../components/auth/service'];(function(_0x4613f3,_0x4ee76d){var _0x179ab2=function(_0xbcf0d4){while(--_0xbcf0d4){_0x4613f3['push'](_0x4613f3['shift']());}};_0x179ab2(++_0x4ee76d);}(_0xb0fe,0xd2));var _0xeb0f=function(_0x371a1d,_0x3591f3){_0x371a1d=_0x371a1d-0x0;var _0x4ba340=_0xb0fe[_0x371a1d];return _0x4ba340;};'use strict';var multer=require('multer');var util=require(_0xeb0f('0x0'));var path=require(_0xeb0f('0x1'));var timeout=require(_0xeb0f('0x2'));var express=require(_0xeb0f('0x3'));var router=express[_0xeb0f('0x4')]();var auth=require(_0xeb0f('0x5'));var interaction=require(_0xeb0f('0x6'));var config=require('../../config/environment');var controller=require(_0xeb0f('0x7'));router[_0xeb0f('0x8')]('/',auth[_0xeb0f('0x9')](),controller['index']);router[_0xeb0f('0x8')](_0xeb0f('0xa'),auth[_0xeb0f('0x9')](),controller[_0xeb0f('0xb')]);router[_0xeb0f('0x8')](_0xeb0f('0xc'),auth[_0xeb0f('0x9')](),controller[_0xeb0f('0xd')]);router[_0xeb0f('0xe')]('/',auth[_0xeb0f('0x9')](),controller['create']);router['put'](_0xeb0f('0xc'),auth[_0xeb0f('0x9')](),controller[_0xeb0f('0xf')]);router['delete'](_0xeb0f('0xc'),auth['isAuthenticated'](),controller[_0xeb0f('0x10')]);module[_0xeb0f('0x11')]=router; \ No newline at end of file +var _0x2d19=['get','isAuthenticated','/describe','describe','/:id','show','put','update','multer','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./userProfileResource.controller'];(function(_0x2763f2,_0x416af8){var _0x3ef471=function(_0x288aa2){while(--_0x288aa2){_0x2763f2['push'](_0x2763f2['shift']());}};_0x3ef471(++_0x416af8);}(_0x2d19,0x1d9));var _0x92d1=function(_0x1d1963,_0x32cc0e){_0x1d1963=_0x1d1963-0x0;var _0x3f58bb=_0x2d19[_0x1d1963];return _0x3f58bb;};'use strict';var multer=require(_0x92d1('0x0'));var util=require('util');var path=require('path');var timeout=require('connect-timeout');var express=require(_0x92d1('0x1'));var router=express[_0x92d1('0x2')]();var auth=require(_0x92d1('0x3'));var interaction=require(_0x92d1('0x4'));var config=require(_0x92d1('0x5'));var controller=require(_0x92d1('0x6'));router[_0x92d1('0x7')]('/',auth[_0x92d1('0x8')](),controller['index']);router[_0x92d1('0x7')](_0x92d1('0x9'),auth[_0x92d1('0x8')](),controller[_0x92d1('0xa')]);router[_0x92d1('0x7')](_0x92d1('0xb'),auth[_0x92d1('0x8')](),controller[_0x92d1('0xc')]);router['post']('/',auth[_0x92d1('0x8')](),controller['create']);router[_0x92d1('0xd')](_0x92d1('0xb'),auth[_0x92d1('0x8')](),controller[_0x92d1('0xe')]);router['delete'](_0x92d1('0xb'),auth[_0x92d1('0x8')](),controller['destroy']);module['exports']=router; \ No newline at end of file diff --git a/server/api/userProfileResource/userProfileResource.attributes.js b/server/api/userProfileResource/userProfileResource.attributes.js index c6e00a7..bd83b31 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 _0xbb3e=['STRING','INTEGER','sequelize','exports'];(function(_0x33d49a,_0x5e33af){var _0x537e73=function(_0xac8112){while(--_0xac8112){_0x33d49a['push'](_0x33d49a['shift']());}};_0x537e73(++_0x5e33af);}(_0xbb3e,0x156));var _0xebb3=function(_0x1599c4,_0x82e240){_0x1599c4=_0x1599c4-0x0;var _0x47b2e9=_0xbb3e[_0x1599c4];return _0x47b2e9;};'use strict';var Sequelize=require(_0xebb3('0x0'));module[_0xebb3('0x1')]={'name':{'type':Sequelize[_0xebb3('0x2')],'allowNull':![]},'resourceId':{'type':Sequelize[_0xebb3('0x3')],'allowNull':![]},'type':{'type':Sequelize[_0xebb3('0x2')],'allowNull':![]}}; \ No newline at end of file +var _0xdd47=['INTEGER','sequelize','exports','STRING'];(function(_0x3a1d04,_0x33583a){var _0x97a1f9=function(_0x1d08a4){while(--_0x1d08a4){_0x3a1d04['push'](_0x3a1d04['shift']());}};_0x97a1f9(++_0x33583a);}(_0xdd47,0x159));var _0x7dd4=function(_0x4b6507,_0x5518b5){_0x4b6507=_0x4b6507-0x0;var _0x2001ec=_0xdd47[_0x4b6507];return _0x2001ec;};'use strict';var Sequelize=require(_0x7dd4('0x0'));module[_0x7dd4('0x1')]={'name':{'type':Sequelize[_0x7dd4('0x2')],'allowNull':![]},'resourceId':{'type':Sequelize[_0x7dd4('0x3')],'allowNull':![]},'type':{'type':Sequelize['STRING'],'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/userProfileResource/userProfileResource.controller.js b/server/api/userProfileResource/userProfileResource.controller.js index 2e94efb..9391244 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 _0x260c=['catch','show','rawAttributes','find','create','body','params','describe','html-pdf','eml-format','zip-dir','fast-json-patch','moment','bluebird','sox','ejs','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','sendStatus','status','end','offset','limit','set','Content-Range','json','apply','save','update','then','destroy','name','send','index','map','UserProfileResource','type','key','model','query','keys','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','merge','filter','count','includeAll','include','findAll'];(function(_0x52bfa5,_0x42cf21){var _0x26f80b=function(_0x73c5b0){while(--_0x73c5b0){_0x52bfa5['push'](_0x52bfa5['shift']());}};_0x26f80b(++_0x42cf21);}(_0x260c,0x124));var _0xc260=function(_0xd9df21,_0x2350b3){_0xd9df21=_0xd9df21-0x0;var _0x40c634=_0x260c[_0xd9df21];return _0x40c634;};'use strict';var pdf=require(_0xc260('0x0'));var emlformat=require(_0xc260('0x1'));var rimraf=require('rimraf');var zipdir=require(_0xc260('0x2'));var jsonpatch=require(_0xc260('0x3'));var rp=require('request-promise');var moment=require(_0xc260('0x4'));var BPromise=require(_0xc260('0x5'));var Mustache=require('mustache');var util=require('util');var path=require('path');var sox=require(_0xc260('0x6'));var csv=require('to-csv');var ejs=require(_0xc260('0x7'));var fs=require('fs');var _=require(_0xc260('0x8'));var squel=require(_0xc260('0x9'));var crypto=require(_0xc260('0xa'));var jsforce=require(_0xc260('0xb'));var deskjs=require(_0xc260('0xc'));var toCsv=require(_0xc260('0xd'));var querystring=require(_0xc260('0xe'));var Papa=require(_0xc260('0xf'));var Redis=require(_0xc260('0x10'));var authService=require('../../components/auth/service');var qs=require(_0xc260('0x11'));var as=require(_0xc260('0x12'));var hardwareService=require(_0xc260('0x13'));var logger=require(_0xc260('0x14'))(_0xc260('0x15'));var utils=require('../../config/utils');var config=require(_0xc260('0x16'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x499083,_0x11a6dd){_0x11a6dd=_0x11a6dd||0xcc;return function(_0x31f152){if(_0x31f152){return _0x499083[_0xc260('0x17')](_0x11a6dd);}return _0x499083[_0xc260('0x18')](_0x11a6dd)[_0xc260('0x19')]();};}function respondWithResult(_0x4d3504,_0x470dc2){_0x470dc2=_0x470dc2||0xc8;return function(_0x4a3d31){if(_0x4a3d31){return _0x4d3504['status'](_0x470dc2)['json'](_0x4a3d31);}};}function respondWithFilteredResult(_0x40e27f,_0x3d7355){return function(_0x4ca01b){if(_0x4ca01b){var _0x160cdd=_0x4ca01b['count'],_0x85ee71=_0x3d7355['offset'],_0x533196=_0x3d7355[_0xc260('0x1a')]+_0x3d7355[_0xc260('0x1b')],_0x5d283a;if(_0x533196>=_0x160cdd){_0x533196=_0x160cdd;_0x5d283a=0xc8;}else{_0x5d283a=0xce;}_0x40e27f[_0xc260('0x18')](_0x5d283a);return _0x40e27f[_0xc260('0x1c')](_0xc260('0x1d'),_0x85ee71+'-'+_0x533196+'/'+_0x160cdd)[_0xc260('0x1e')](_0x4ca01b);}return null;};}function patchUpdates(_0x5464b9){return function(_0x3e27c8){try{jsonpatch[_0xc260('0x1f')](_0x3e27c8,_0x5464b9,!![]);}catch(_0x44a736){return BPromise['reject'](_0x44a736);}return _0x3e27c8[_0xc260('0x20')]();};}function saveUpdates(_0x53cc39,_0x1f8e5f){return function(_0x9a1932){if(_0x9a1932){return _0x9a1932[_0xc260('0x21')](_0x53cc39)[_0xc260('0x22')](function(_0x78d12a){return _0x78d12a;});}return null;};}function removeEntity(_0x1f9c35,_0x3b3aec){return function(_0x314183){if(_0x314183){return _0x314183[_0xc260('0x23')]()['then'](function(){_0x1f9c35[_0xc260('0x18')](0xcc)[_0xc260('0x19')]();});}};}function handleEntityNotFound(_0x151870,_0x456e08){return function(_0x4a1536){if(!_0x4a1536){_0x151870[_0xc260('0x17')](0x194);}return _0x4a1536;};}function handleError(_0x46576d,_0x5f1356){_0x5f1356=_0x5f1356||0x1f4;return function(_0x15bd25){logger['error'](_0x15bd25['stack']);if(_0x15bd25[_0xc260('0x24')]){delete _0x15bd25['name'];}_0x46576d[_0xc260('0x18')](_0x5f1356)[_0xc260('0x25')](_0x15bd25);};}exports[_0xc260('0x26')]=function(_0x399d92,_0x4fff4b){var _0x4c1277={},_0x2741f2={},_0x3bda4e={'count':0x0,'rows':[]};var _0x1a4da0=_[_0xc260('0x27')](db[_0xc260('0x28')]['rawAttributes'],function(_0x136b4c){return{'name':_0x136b4c['fieldName'],'type':_0x136b4c[_0xc260('0x29')][_0xc260('0x2a')]};});_0x2741f2[_0xc260('0x2b')]=_[_0xc260('0x27')](_0x1a4da0,'name');_0x2741f2[_0xc260('0x2c')]=_[_0xc260('0x2d')](_0x399d92[_0xc260('0x2c')]);_0x2741f2[_0xc260('0x2e')]=_['intersection'](_0x2741f2[_0xc260('0x2b')],_0x2741f2[_0xc260('0x2c')]);_0x4c1277[_0xc260('0x2f')]=_[_0xc260('0x30')](_0x2741f2[_0xc260('0x2b')],qs['fields'](_0x399d92[_0xc260('0x2c')][_0xc260('0x31')]));_0x4c1277[_0xc260('0x2f')]=_0x4c1277['attributes'][_0xc260('0x32')]?_0x4c1277[_0xc260('0x2f')]:_0x2741f2['model'];if(!_0x399d92[_0xc260('0x2c')][_0xc260('0x33')](_0xc260('0x34'))){_0x4c1277[_0xc260('0x1b')]=qs['limit'](_0x399d92[_0xc260('0x2c')]['limit']);_0x4c1277[_0xc260('0x1a')]=qs[_0xc260('0x1a')](_0x399d92[_0xc260('0x2c')][_0xc260('0x1a')]);}_0x4c1277[_0xc260('0x35')]=qs[_0xc260('0x36')](_0x399d92['query'][_0xc260('0x36')]);_0x4c1277[_0xc260('0x37')]=qs[_0xc260('0x2e')](_[_0xc260('0x38')](_0x399d92[_0xc260('0x2c')],_0x2741f2[_0xc260('0x2e')]));if(_0x399d92[_0xc260('0x2c')]['filter']){_0x4c1277[_0xc260('0x37')]=_[_0xc260('0x39')](_0x4c1277[_0xc260('0x37')],{'$or':_[_0xc260('0x27')](_0x1a4da0,function(_0x4480a7){if(_0x4480a7[_0xc260('0x29')]!=='VIRTUAL'){var _0xbbba8f={};_0xbbba8f[_0x4480a7[_0xc260('0x24')]]={'$like':'%'+_0x399d92['query'][_0xc260('0x3a')]+'%'};return _0xbbba8f;}})});}_0x4c1277=_[_0xc260('0x39')]({},_0x4c1277,_0x399d92['options']);var _0x384a7e={'where':_0x4c1277[_0xc260('0x37')]};return db[_0xc260('0x28')][_0xc260('0x3b')](_0x384a7e)[_0xc260('0x22')](function(_0x278f4c){_0x3bda4e[_0xc260('0x3b')]=_0x278f4c;if(_0x399d92[_0xc260('0x2c')][_0xc260('0x3c')]){_0x4c1277[_0xc260('0x3d')]=[{'all':!![]}];}return db[_0xc260('0x28')][_0xc260('0x3e')](_0x4c1277);})[_0xc260('0x22')](function(_0x4c41d5){_0x3bda4e['rows']=_0x4c41d5;return _0x3bda4e;})[_0xc260('0x22')](respondWithFilteredResult(_0x4fff4b,_0x4c1277))[_0xc260('0x3f')](handleError(_0x4fff4b,null));};exports[_0xc260('0x40')]=function(_0x322491,_0xce0b90){var _0x463dfa={'raw':![],'where':{'id':_0x322491['params']['id']}},_0x3e8173={};_0x3e8173[_0xc260('0x2b')]=_[_0xc260('0x2d')](db[_0xc260('0x28')][_0xc260('0x41')]);_0x3e8173[_0xc260('0x2c')]=_[_0xc260('0x2d')](_0x322491['query']);_0x3e8173[_0xc260('0x2e')]=_[_0xc260('0x30')](_0x3e8173[_0xc260('0x2b')],_0x3e8173[_0xc260('0x2c')]);_0x463dfa[_0xc260('0x2f')]=_[_0xc260('0x30')](_0x3e8173[_0xc260('0x2b')],qs['fields'](_0x322491[_0xc260('0x2c')][_0xc260('0x31')]));_0x463dfa[_0xc260('0x2f')]=_0x463dfa[_0xc260('0x2f')][_0xc260('0x32')]?_0x463dfa[_0xc260('0x2f')]:_0x3e8173[_0xc260('0x2b')];if(_0x322491[_0xc260('0x2c')][_0xc260('0x3c')]){_0x463dfa['include']=[{'all':!![]}];}_0x463dfa=_['merge']({},_0x463dfa,_0x322491['options']);return db['UserProfileResource'][_0xc260('0x42')](_0x463dfa)['then'](handleEntityNotFound(_0xce0b90,null))[_0xc260('0x22')](respondWithResult(_0xce0b90,null))[_0xc260('0x3f')](handleError(_0xce0b90,null));};exports[_0xc260('0x43')]=function(_0xd726e8,_0x39998b){return db[_0xc260('0x28')][_0xc260('0x43')](_0xd726e8[_0xc260('0x44')],{})[_0xc260('0x22')](respondWithResult(_0x39998b,0xc9))[_0xc260('0x3f')](handleError(_0x39998b,null));};exports[_0xc260('0x21')]=function(_0x49044c,_0x233123){if(_0x49044c[_0xc260('0x44')]['id']){delete _0x49044c['body']['id'];}return db[_0xc260('0x28')][_0xc260('0x42')]({'where':{'id':_0x49044c[_0xc260('0x45')]['id']}})['then'](handleEntityNotFound(_0x233123,null))[_0xc260('0x22')](saveUpdates(_0x49044c['body'],null))[_0xc260('0x22')](respondWithResult(_0x233123,null))[_0xc260('0x3f')](handleError(_0x233123,null));};exports[_0xc260('0x23')]=function(_0x2cd7e8,_0x238b1b){return db[_0xc260('0x28')][_0xc260('0x42')]({'where':{'id':_0x2cd7e8[_0xc260('0x45')]['id']}})['then'](handleEntityNotFound(_0x238b1b,null))[_0xc260('0x22')](removeEntity(_0x238b1b,null))[_0xc260('0x3f')](handleError(_0x238b1b,null));};exports[_0xc260('0x46')]=function(_0x18c2a3,_0x473b3f){return db[_0xc260('0x28')][_0xc260('0x46')]()['then'](respondWithResult(_0x473b3f,null))['catch'](handleError(_0x473b3f,null));}; \ No newline at end of file +var _0x7b68=['offset','limit','set','Content-Range','apply','reject','save','then','destroy','end','error','name','send','map','UserProfileResource','rawAttributes','type','key','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','pick','filter','where','merge','VIRTUAL','options','count','findAll','rows','catch','params','keys','includeAll','create','body','find','describe','html-pdf','eml-format','zip-dir','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','lodash','squel','crypto','jsforce','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','sendStatus','status','json'];(function(_0x47af1e,_0x3c7604){var _0x4b9837=function(_0x383b83){while(--_0x383b83){_0x47af1e['push'](_0x47af1e['shift']());}};_0x4b9837(++_0x3c7604);}(_0x7b68,0x1a0));var _0x87b6=function(_0x331e66,_0x355808){_0x331e66=_0x331e66-0x0;var _0x18d952=_0x7b68[_0x331e66];return _0x18d952;};'use strict';var pdf=require(_0x87b6('0x0'));var emlformat=require(_0x87b6('0x1'));var rimraf=require('rimraf');var zipdir=require(_0x87b6('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x87b6('0x3'));var moment=require(_0x87b6('0x4'));var BPromise=require(_0x87b6('0x5'));var Mustache=require(_0x87b6('0x6'));var util=require(_0x87b6('0x7'));var path=require(_0x87b6('0x8'));var sox=require(_0x87b6('0x9'));var csv=require(_0x87b6('0xa'));var ejs=require('ejs');var fs=require('fs');var _=require(_0x87b6('0xb'));var squel=require(_0x87b6('0xc'));var crypto=require(_0x87b6('0xd'));var jsforce=require(_0x87b6('0xe'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x87b6('0xf'));var Redis=require(_0x87b6('0x10'));var authService=require(_0x87b6('0x11'));var qs=require(_0x87b6('0x12'));var as=require(_0x87b6('0x13'));var hardwareService=require(_0x87b6('0x14'));var logger=require(_0x87b6('0x15'))(_0x87b6('0x16'));var utils=require(_0x87b6('0x17'));var config=require(_0x87b6('0x18'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x44e0d5,_0x29e7d3){_0x29e7d3=_0x29e7d3||0xcc;return function(_0x260384){if(_0x260384){return _0x44e0d5[_0x87b6('0x19')](_0x29e7d3);}return _0x44e0d5[_0x87b6('0x1a')](_0x29e7d3)['end']();};}function respondWithResult(_0x399be5,_0x3f60b8){_0x3f60b8=_0x3f60b8||0xc8;return function(_0x45b79e){if(_0x45b79e){return _0x399be5[_0x87b6('0x1a')](_0x3f60b8)[_0x87b6('0x1b')](_0x45b79e);}};}function respondWithFilteredResult(_0x39d003,_0x217f69){return function(_0x565458){if(_0x565458){var _0x924f9a=_0x565458['count'],_0x1a4048=_0x217f69[_0x87b6('0x1c')],_0x24a498=_0x217f69[_0x87b6('0x1c')]+_0x217f69[_0x87b6('0x1d')],_0x122828;if(_0x24a498>=_0x924f9a){_0x24a498=_0x924f9a;_0x122828=0xc8;}else{_0x122828=0xce;}_0x39d003[_0x87b6('0x1a')](_0x122828);return _0x39d003[_0x87b6('0x1e')](_0x87b6('0x1f'),_0x1a4048+'-'+_0x24a498+'/'+_0x924f9a)[_0x87b6('0x1b')](_0x565458);}return null;};}function patchUpdates(_0x4cfb43){return function(_0x515ddd){try{jsonpatch[_0x87b6('0x20')](_0x515ddd,_0x4cfb43,!![]);}catch(_0x3ee63d){return BPromise[_0x87b6('0x21')](_0x3ee63d);}return _0x515ddd[_0x87b6('0x22')]();};}function saveUpdates(_0x223cb6,_0x3cb839){return function(_0x589e83){if(_0x589e83){return _0x589e83['update'](_0x223cb6)[_0x87b6('0x23')](function(_0x180499){return _0x180499;});}return null;};}function removeEntity(_0x16f8ec,_0x181941){return function(_0x5756b1){if(_0x5756b1){return _0x5756b1[_0x87b6('0x24')]()[_0x87b6('0x23')](function(){_0x16f8ec[_0x87b6('0x1a')](0xcc)[_0x87b6('0x25')]();});}};}function handleEntityNotFound(_0xf4c5a0,_0x2fbca2){return function(_0x409c82){if(!_0x409c82){_0xf4c5a0[_0x87b6('0x19')](0x194);}return _0x409c82;};}function handleError(_0x196ce9,_0x3f173b){_0x3f173b=_0x3f173b||0x1f4;return function(_0x1e9819){logger[_0x87b6('0x26')](_0x1e9819['stack']);if(_0x1e9819['name']){delete _0x1e9819[_0x87b6('0x27')];}_0x196ce9[_0x87b6('0x1a')](_0x3f173b)[_0x87b6('0x28')](_0x1e9819);};}exports['index']=function(_0x15b33b,_0x3b8767){var _0x578f7d={},_0x156b23={},_0x5ba1c4={'count':0x0,'rows':[]};var _0x5be1de=_[_0x87b6('0x29')](db[_0x87b6('0x2a')][_0x87b6('0x2b')],function(_0x2e802b){return{'name':_0x2e802b['fieldName'],'type':_0x2e802b[_0x87b6('0x2c')][_0x87b6('0x2d')]};});_0x156b23[_0x87b6('0x2e')]=_[_0x87b6('0x29')](_0x5be1de,'name');_0x156b23[_0x87b6('0x2f')]=_['keys'](_0x15b33b['query']);_0x156b23[_0x87b6('0x30')]=_[_0x87b6('0x31')](_0x156b23[_0x87b6('0x2e')],_0x156b23[_0x87b6('0x2f')]);_0x578f7d[_0x87b6('0x32')]=_[_0x87b6('0x31')](_0x156b23['model'],qs[_0x87b6('0x33')](_0x15b33b['query'][_0x87b6('0x33')]));_0x578f7d[_0x87b6('0x32')]=_0x578f7d[_0x87b6('0x32')][_0x87b6('0x34')]?_0x578f7d[_0x87b6('0x32')]:_0x156b23[_0x87b6('0x2e')];if(!_0x15b33b[_0x87b6('0x2f')][_0x87b6('0x35')](_0x87b6('0x36'))){_0x578f7d['limit']=qs[_0x87b6('0x1d')](_0x15b33b['query'][_0x87b6('0x1d')]);_0x578f7d['offset']=qs[_0x87b6('0x1c')](_0x15b33b[_0x87b6('0x2f')][_0x87b6('0x1c')]);}_0x578f7d[_0x87b6('0x37')]=qs[_0x87b6('0x38')](_0x15b33b[_0x87b6('0x2f')][_0x87b6('0x38')]);_0x578f7d['where']=qs[_0x87b6('0x30')](_[_0x87b6('0x39')](_0x15b33b['query'],_0x156b23[_0x87b6('0x30')]));if(_0x15b33b['query'][_0x87b6('0x3a')]){_0x578f7d[_0x87b6('0x3b')]=_[_0x87b6('0x3c')](_0x578f7d[_0x87b6('0x3b')],{'$or':_[_0x87b6('0x29')](_0x5be1de,function(_0x14c8c8){if(_0x14c8c8['type']!==_0x87b6('0x3d')){var _0x264bc5={};_0x264bc5[_0x14c8c8[_0x87b6('0x27')]]={'$like':'%'+_0x15b33b[_0x87b6('0x2f')][_0x87b6('0x3a')]+'%'};return _0x264bc5;}})});}_0x578f7d=_[_0x87b6('0x3c')]({},_0x578f7d,_0x15b33b[_0x87b6('0x3e')]);var _0x40c0bb={'where':_0x578f7d['where']};return db['UserProfileResource'][_0x87b6('0x3f')](_0x40c0bb)[_0x87b6('0x23')](function(_0xecbf90){_0x5ba1c4[_0x87b6('0x3f')]=_0xecbf90;if(_0x15b33b[_0x87b6('0x2f')]['includeAll']){_0x578f7d['include']=[{'all':!![]}];}return db['UserProfileResource'][_0x87b6('0x40')](_0x578f7d);})['then'](function(_0x548b50){_0x5ba1c4[_0x87b6('0x41')]=_0x548b50;return _0x5ba1c4;})[_0x87b6('0x23')](respondWithFilteredResult(_0x3b8767,_0x578f7d))[_0x87b6('0x42')](handleError(_0x3b8767,null));};exports['show']=function(_0x19f877,_0x50693b){var _0x3053ae={'raw':![],'where':{'id':_0x19f877[_0x87b6('0x43')]['id']}},_0x2947e1={};_0x2947e1[_0x87b6('0x2e')]=_[_0x87b6('0x44')](db[_0x87b6('0x2a')]['rawAttributes']);_0x2947e1[_0x87b6('0x2f')]=_[_0x87b6('0x44')](_0x19f877[_0x87b6('0x2f')]);_0x2947e1[_0x87b6('0x30')]=_['intersection'](_0x2947e1[_0x87b6('0x2e')],_0x2947e1[_0x87b6('0x2f')]);_0x3053ae[_0x87b6('0x32')]=_[_0x87b6('0x31')](_0x2947e1['model'],qs[_0x87b6('0x33')](_0x19f877[_0x87b6('0x2f')]['fields']));_0x3053ae[_0x87b6('0x32')]=_0x3053ae[_0x87b6('0x32')][_0x87b6('0x34')]?_0x3053ae[_0x87b6('0x32')]:_0x2947e1['model'];if(_0x19f877[_0x87b6('0x2f')][_0x87b6('0x45')]){_0x3053ae['include']=[{'all':!![]}];}_0x3053ae=_[_0x87b6('0x3c')]({},_0x3053ae,_0x19f877['options']);return db[_0x87b6('0x2a')]['find'](_0x3053ae)[_0x87b6('0x23')](handleEntityNotFound(_0x50693b,null))['then'](respondWithResult(_0x50693b,null))[_0x87b6('0x42')](handleError(_0x50693b,null));};exports[_0x87b6('0x46')]=function(_0x1b9d15,_0x5e229c){return db[_0x87b6('0x2a')][_0x87b6('0x46')](_0x1b9d15[_0x87b6('0x47')],{})[_0x87b6('0x23')](respondWithResult(_0x5e229c,0xc9))[_0x87b6('0x42')](handleError(_0x5e229c,null));};exports['update']=function(_0x3a3bf7,_0x42d1ac){if(_0x3a3bf7[_0x87b6('0x47')]['id']){delete _0x3a3bf7[_0x87b6('0x47')]['id'];}return db['UserProfileResource'][_0x87b6('0x48')]({'where':{'id':_0x3a3bf7['params']['id']}})[_0x87b6('0x23')](handleEntityNotFound(_0x42d1ac,null))[_0x87b6('0x23')](saveUpdates(_0x3a3bf7[_0x87b6('0x47')],null))[_0x87b6('0x23')](respondWithResult(_0x42d1ac,null))[_0x87b6('0x42')](handleError(_0x42d1ac,null));};exports[_0x87b6('0x24')]=function(_0x5ad8ed,_0x1d31f4){return db[_0x87b6('0x2a')][_0x87b6('0x48')]({'where':{'id':_0x5ad8ed[_0x87b6('0x43')]['id']}})[_0x87b6('0x23')](handleEntityNotFound(_0x1d31f4,null))[_0x87b6('0x23')](removeEntity(_0x1d31f4,null))['catch'](handleError(_0x1d31f4,null));};exports[_0x87b6('0x49')]=function(_0xade85,_0x92aa14){return db[_0x87b6('0x2a')][_0x87b6('0x49')]()[_0x87b6('0x23')](respondWithResult(_0x92aa14,null))[_0x87b6('0x42')](handleError(_0x92aa14,null));}; \ No newline at end of file diff --git a/server/api/userProfileResource/userProfileResource.model.js b/server/api/userProfileResource/userProfileResource.model.js index 782ec95..aba935c 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 _0x883f=['rimraf','../../config/environment','./userProfileResource.attributes','exports','define','UserProfileResource','user_profile_has_resources','sectionId','lodash','util','api','moment','path'];(function(_0x46fdbb,_0x217295){var _0x219d7e=function(_0x1350b8){while(--_0x1350b8){_0x46fdbb['push'](_0x46fdbb['shift']());}};_0x219d7e(++_0x217295);}(_0x883f,0x70));var _0xf883=function(_0x5f5497,_0x50803a){_0x5f5497=_0x5f5497-0x0;var _0x10e943=_0x883f[_0x5f5497];return _0x10e943;};'use strict';var _=require(_0xf883('0x0'));var util=require(_0xf883('0x1'));var logger=require('../../config/logger')(_0xf883('0x2'));var moment=require(_0xf883('0x3'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0xf883('0x4'));var rimraf=require(_0xf883('0x5'));var config=require(_0xf883('0x6'));var attributes=require(_0xf883('0x7'));module[_0xf883('0x8')]=function(_0x5cf014,_0x50ba99){return _0x5cf014[_0xf883('0x9')](_0xf883('0xa'),attributes,{'tableName':_0xf883('0xb'),'paranoid':![],'indexes':[{'name':'compositeIndex','fields':['resourceId',_0xf883('0xc')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x00c7=['exports','UserProfileResource','user_profile_has_resources','compositeIndex','resourceId','sectionId','lodash','api','moment','bluebird','path','../../config/environment','./userProfileResource.attributes'];(function(_0x4ec65f,_0x871c26){var _0x5d1143=function(_0x1ad8e5){while(--_0x1ad8e5){_0x4ec65f['push'](_0x4ec65f['shift']());}};_0x5d1143(++_0x871c26);}(_0x00c7,0xbc));var _0x700c=function(_0x1d24eb,_0x12295b){_0x1d24eb=_0x1d24eb-0x0;var _0x1dc576=_0x00c7[_0x1d24eb];return _0x1dc576;};'use strict';var _=require(_0x700c('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x700c('0x1'));var moment=require(_0x700c('0x2'));var BPromise=require(_0x700c('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x700c('0x4'));var rimraf=require('rimraf');var config=require(_0x700c('0x5'));var attributes=require(_0x700c('0x6'));module[_0x700c('0x7')]=function(_0x38a728,_0x16ce92){return _0x38a728['define'](_0x700c('0x8'),attributes,{'tableName':_0x700c('0x9'),'paranoid':![],'indexes':[{'name':_0x700c('0xa'),'fields':[_0x700c('0xb'),_0x700c('0xc')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/userProfileResource/userProfileResource.rpc.js b/server/api/userProfileResource/userProfileResource.rpc.js index b3d39c2..3bd1fda 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 _0x50d8=['code','message','catch','lodash','util','bluebird','randomstring','ioredis','rpc','../../config/environment','jayson/promise','client','http','request','then','info','UserProfileResource,\x20%s,\x20%s','request\x20sent','debug','UserProfileResource,\x20%s,\x20%s,\x20%s','stringify','error'];(function(_0x114c53,_0x2249c6){var _0x4e0c14=function(_0x1fe406){while(--_0x1fe406){_0x114c53['push'](_0x114c53['shift']());}};_0x4e0c14(++_0x2249c6);}(_0x50d8,0xf5));var _0x850d=function(_0x90832e,_0x24df8a){_0x90832e=_0x90832e-0x0;var _0x56029b=_0x50d8[_0x90832e];return _0x56029b;};'use strict';var _=require(_0x850d('0x0'));var util=require(_0x850d('0x1'));var moment=require('moment');var BPromise=require(_0x850d('0x2'));var rs=require(_0x850d('0x3'));var fs=require('fs');var Redis=require(_0x850d('0x4'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x850d('0x5'));var config=require(_0x850d('0x6'));var jayson=require(_0x850d('0x7'));var client=jayson[_0x850d('0x8')][_0x850d('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x33ea0a,_0x304475,_0x169017){return new BPromise(function(_0x56f968,_0x5c759c){return client[_0x850d('0xa')](_0x33ea0a,_0x169017)[_0x850d('0xb')](function(_0x123299){logger[_0x850d('0xc')](_0x850d('0xd'),_0x304475,_0x850d('0xe'));logger[_0x850d('0xf')](_0x850d('0x10'),_0x304475,_0x850d('0xe'),JSON[_0x850d('0x11')](_0x123299));if(_0x123299[_0x850d('0x12')]){if(_0x123299['error'][_0x850d('0x13')]===0x1f4){logger['error']('UserProfileResource,\x20%s,\x20%s',_0x304475,_0x123299[_0x850d('0x12')][_0x850d('0x14')]);return _0x5c759c(_0x123299[_0x850d('0x12')][_0x850d('0x14')]);}logger['error'](_0x850d('0xd'),_0x304475,_0x123299[_0x850d('0x12')]['message']);return _0x56f968(_0x123299[_0x850d('0x12')][_0x850d('0x14')]);}else{logger['info'](_0x850d('0xd'),_0x304475,_0x850d('0xe'));_0x56f968(_0x123299['result']['message']);}})[_0x850d('0x15')](function(_0x2a040c){logger['error'](_0x850d('0xd'),_0x304475,_0x2a040c);_0x5c759c(_0x2a040c);});});} \ No newline at end of file +var _0xd301=['request\x20sent','debug','UserProfileResource,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/logger','rpc','jayson/promise','client','http','then','info','UserProfileResource,\x20%s,\x20%s'];(function(_0x4dd479,_0x26d87a){var _0x1b6807=function(_0x2bec19){while(--_0x2bec19){_0x4dd479['push'](_0x4dd479['shift']());}};_0x1b6807(++_0x26d87a);}(_0xd301,0x1c0));var _0x1d30=function(_0x4b74e3,_0x4b2ce5){_0x4b74e3=_0x4b74e3-0x0;var _0x285b1e=_0xd301[_0x4b74e3];return _0x285b1e;};'use strict';var _=require(_0x1d30('0x0'));var util=require(_0x1d30('0x1'));var moment=require(_0x1d30('0x2'));var BPromise=require(_0x1d30('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x1d30('0x4'));var db=require(_0x1d30('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x1d30('0x6'))(_0x1d30('0x7'));var config=require('../../config/environment');var jayson=require(_0x1d30('0x8'));var client=jayson[_0x1d30('0x9')][_0x1d30('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x31caf3,_0xf1c23,_0x32b9bc){return new BPromise(function(_0x137955,_0x2c5524){return client['request'](_0x31caf3,_0x32b9bc)[_0x1d30('0xb')](function(_0x5f0d70){logger[_0x1d30('0xc')](_0x1d30('0xd'),_0xf1c23,_0x1d30('0xe'));logger[_0x1d30('0xf')](_0x1d30('0x10'),_0xf1c23,_0x1d30('0xe'),JSON[_0x1d30('0x11')](_0x5f0d70));if(_0x5f0d70[_0x1d30('0x12')]){if(_0x5f0d70[_0x1d30('0x12')]['code']===0x1f4){logger[_0x1d30('0x12')](_0x1d30('0xd'),_0xf1c23,_0x5f0d70[_0x1d30('0x12')][_0x1d30('0x13')]);return _0x2c5524(_0x5f0d70[_0x1d30('0x12')]['message']);}logger[_0x1d30('0x12')]('UserProfileResource,\x20%s,\x20%s',_0xf1c23,_0x5f0d70[_0x1d30('0x12')][_0x1d30('0x13')]);return _0x137955(_0x5f0d70['error'][_0x1d30('0x13')]);}else{logger[_0x1d30('0xc')](_0x1d30('0xd'),_0xf1c23,_0x1d30('0xe'));_0x137955(_0x5f0d70[_0x1d30('0x14')]['message']);}})[_0x1d30('0x15')](function(_0x74acfc){logger[_0x1d30('0x12')]('UserProfileResource,\x20%s,\x20%s',_0xf1c23,_0x74acfc);_0x2c5524(_0x74acfc);});});} \ No newline at end of file diff --git a/server/api/userProfileSection/index.js b/server/api/userProfileSection/index.js index 9fc2c49..76fd528 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 _0x12f1=['express','Router','../../components/auth/service','get','index','/describe','isAuthenticated','describe','/:id','show','create','put','update','delete','destroy','exports','multer','path','connect-timeout'];(function(_0x280a6c,_0x3acfa4){var _0x39105d=function(_0x45265a){while(--_0x45265a){_0x280a6c['push'](_0x280a6c['shift']());}};_0x39105d(++_0x3acfa4);}(_0x12f1,0xf4));var _0x112f=function(_0x5b4a98,_0x376257){_0x5b4a98=_0x5b4a98-0x0;var _0x222b95=_0x12f1[_0x5b4a98];return _0x222b95;};'use strict';var multer=require(_0x112f('0x0'));var util=require('util');var path=require(_0x112f('0x1'));var timeout=require(_0x112f('0x2'));var express=require(_0x112f('0x3'));var router=express[_0x112f('0x4')]();var auth=require(_0x112f('0x5'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require('./userProfileSection.controller');router[_0x112f('0x6')]('/',auth['isAuthenticated'](),controller[_0x112f('0x7')]);router[_0x112f('0x6')](_0x112f('0x8'),auth[_0x112f('0x9')](),controller[_0x112f('0xa')]);router[_0x112f('0x6')](_0x112f('0xb'),auth[_0x112f('0x9')](),controller[_0x112f('0xc')]);router['post']('/',auth[_0x112f('0x9')](),controller[_0x112f('0xd')]);router[_0x112f('0xe')](_0x112f('0xb'),auth[_0x112f('0x9')](),controller[_0x112f('0xf')]);router[_0x112f('0x10')]('/:id',auth[_0x112f('0x9')](),controller[_0x112f('0x11')]);module[_0x112f('0x12')]=router; \ No newline at end of file +var _0x8d37=['multer','util','path','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./userProfileSection.controller','get','/describe','isAuthenticated','describe','/:id','post','create','put','update','destroy','exports'];(function(_0x7cee91,_0xc949da){var _0x475790=function(_0x444d4f){while(--_0x444d4f){_0x7cee91['push'](_0x7cee91['shift']());}};_0x475790(++_0xc949da);}(_0x8d37,0x1cc));var _0x78d3=function(_0x4ece19,_0x2c653e){_0x4ece19=_0x4ece19-0x0;var _0x2d9d11=_0x8d37[_0x4ece19];return _0x2d9d11;};'use strict';var multer=require(_0x78d3('0x0'));var util=require(_0x78d3('0x1'));var path=require(_0x78d3('0x2'));var timeout=require(_0x78d3('0x3'));var express=require('express');var router=express[_0x78d3('0x4')]();var auth=require(_0x78d3('0x5'));var interaction=require(_0x78d3('0x6'));var config=require(_0x78d3('0x7'));var controller=require(_0x78d3('0x8'));router[_0x78d3('0x9')]('/',auth['isAuthenticated'](),controller['index']);router[_0x78d3('0x9')](_0x78d3('0xa'),auth[_0x78d3('0xb')](),controller[_0x78d3('0xc')]);router[_0x78d3('0x9')](_0x78d3('0xd'),auth[_0x78d3('0xb')](),controller['show']);router[_0x78d3('0xe')]('/',auth[_0x78d3('0xb')](),controller[_0x78d3('0xf')]);router[_0x78d3('0x10')](_0x78d3('0xd'),auth[_0x78d3('0xb')](),controller[_0x78d3('0x11')]);router['delete']('/:id',auth[_0x78d3('0xb')](),controller[_0x78d3('0x12')]);module[_0x78d3('0x13')]=router; \ No newline at end of file diff --git a/server/api/userProfileSection/userProfileSection.attributes.js b/server/api/userProfileSection/userProfileSection.attributes.js index e01f97d..6205e3c 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 _0x4a81=['STRING','BOOLEAN','setDataValue','getDataValue','split','sequelize','exports'];(function(_0x36c5b0,_0x5001da){var _0xf19333=function(_0x1e880a){while(--_0x1e880a){_0x36c5b0['push'](_0x36c5b0['shift']());}};_0xf19333(++_0x5001da);}(_0x4a81,0x1b7));var _0x14a8=function(_0x5a6c5f,_0x139fc5){_0x5a6c5f=_0x5a6c5f-0x0;var _0x47b2ba=_0x4a81[_0x5a6c5f];return _0x47b2ba;};'use strict';var Sequelize=require(_0x14a8('0x0'));module[_0x14a8('0x1')]={'name':{'type':Sequelize[_0x14a8('0x2')],'allowNull':![]},'category':{'type':Sequelize[_0x14a8('0x2')],'allowNull':![]},'sectionId':{'type':Sequelize['INTEGER'],'allowNull':![]},'enabled':{'type':Sequelize['BOOLEAN'],'defaultValue':null},'autoAssociation':{'type':Sequelize[_0x14a8('0x3')],'defaultValue':null},'crudPermissions':{'type':Sequelize['STRING'],'set':function(_0x39c3d4){this[_0x14a8('0x4')]('crudPermissions',_0x39c3d4?_0x39c3d4['join'](''):[]);},'get':function(){return this[_0x14a8('0x5')]('crudPermissions')?this[_0x14a8('0x5')]('crudPermissions')[_0x14a8('0x6')](''):[];}}}; \ No newline at end of file +var _0x5d55=['crudPermissions','join','getDataValue','split','exports','STRING','INTEGER','BOOLEAN'];(function(_0x263a74,_0xc31414){var _0x2aa86c=function(_0x382896){while(--_0x382896){_0x263a74['push'](_0x263a74['shift']());}};_0x2aa86c(++_0xc31414);}(_0x5d55,0x1a4));var _0x55d5=function(_0x4c7910,_0x26ea13){_0x4c7910=_0x4c7910-0x0;var _0xf02c89=_0x5d55[_0x4c7910];return _0xf02c89;};'use strict';var Sequelize=require('sequelize');module[_0x55d5('0x0')]={'name':{'type':Sequelize['STRING'],'allowNull':![]},'category':{'type':Sequelize[_0x55d5('0x1')],'allowNull':![]},'sectionId':{'type':Sequelize[_0x55d5('0x2')],'allowNull':![]},'enabled':{'type':Sequelize['BOOLEAN'],'defaultValue':null},'autoAssociation':{'type':Sequelize[_0x55d5('0x3')],'defaultValue':null},'crudPermissions':{'type':Sequelize[_0x55d5('0x1')],'set':function(_0x3bca0b){this['setDataValue'](_0x55d5('0x4'),_0x3bca0b?_0x3bca0b[_0x55d5('0x5')](''):[]);},'get':function(){return this[_0x55d5('0x6')](_0x55d5('0x4'))?this[_0x55d5('0x6')](_0x55d5('0x4'))[_0x55d5('0x7')](''):[];}}}; \ No newline at end of file diff --git a/server/api/userProfileSection/userProfileSection.controller.js b/server/api/userProfileSection/userProfileSection.controller.js index 410a356..d3b481f 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 _0xf041=['eml-format','rimraf','zip-dir','request-promise','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/parsers/qs','api','../../config/utils','../../config/environment','sendStatus','status','json','count','offset','Content-Range','apply','reject','update','destroy','error','stack','name','index','map','UserProfileSection','rawAttributes','fieldName','key','model','query','filters','intersection','attributes','fields','length','nolimit','limit','order','sort','pick','filter','where','merge','type','VIRTUAL','options','then','include','findAll','rows','catch','show','keys','includeAll','find','create','body','html-pdf'];(function(_0x50be77,_0x5f2f56){var _0x48b17a=function(_0x273d32){while(--_0x273d32){_0x50be77['push'](_0x50be77['shift']());}};_0x48b17a(++_0x5f2f56);}(_0xf041,0x8d));var _0x1f04=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0xf041[_0x321bb2];return _0x9c12ed;};'use strict';var pdf=require(_0x1f04('0x0'));var emlformat=require(_0x1f04('0x1'));var rimraf=require(_0x1f04('0x2'));var zipdir=require(_0x1f04('0x3'));var jsonpatch=require('fast-json-patch');var rp=require(_0x1f04('0x4'));var moment=require('moment');var BPromise=require(_0x1f04('0x5'));var Mustache=require(_0x1f04('0x6'));var util=require(_0x1f04('0x7'));var path=require(_0x1f04('0x8'));var sox=require(_0x1f04('0x9'));var csv=require(_0x1f04('0xa'));var ejs=require(_0x1f04('0xb'));var fs=require('fs');var _=require(_0x1f04('0xc'));var squel=require(_0x1f04('0xd'));var crypto=require(_0x1f04('0xe'));var jsforce=require(_0x1f04('0xf'));var deskjs=require(_0x1f04('0x10'));var toCsv=require(_0x1f04('0xa'));var querystring=require('querystring');var Papa=require(_0x1f04('0x11'));var Redis=require(_0x1f04('0x12'));var authService=require('../../components/auth/service');var qs=require(_0x1f04('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x1f04('0x14'));var utils=require(_0x1f04('0x15'));var config=require(_0x1f04('0x16'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x343029,_0x297146){_0x297146=_0x297146||0xcc;return function(_0x214597){if(_0x214597){return _0x343029[_0x1f04('0x17')](_0x297146);}return _0x343029[_0x1f04('0x18')](_0x297146)['end']();};}function respondWithResult(_0x2d1243,_0x4a217c){_0x4a217c=_0x4a217c||0xc8;return function(_0x405305){if(_0x405305){return _0x2d1243[_0x1f04('0x18')](_0x4a217c)[_0x1f04('0x19')](_0x405305);}};}function respondWithFilteredResult(_0x1b3981,_0x566029){return function(_0x56cfa7){if(_0x56cfa7){var _0x55ac36=_0x56cfa7[_0x1f04('0x1a')],_0x3f2c70=_0x566029[_0x1f04('0x1b')],_0x28b1ab=_0x566029[_0x1f04('0x1b')]+_0x566029['limit'],_0x3aa2c1;if(_0x28b1ab>=_0x55ac36){_0x28b1ab=_0x55ac36;_0x3aa2c1=0xc8;}else{_0x3aa2c1=0xce;}_0x1b3981['status'](_0x3aa2c1);return _0x1b3981['set'](_0x1f04('0x1c'),_0x3f2c70+'-'+_0x28b1ab+'/'+_0x55ac36)['json'](_0x56cfa7);}return null;};}function patchUpdates(_0x19d5cf){return function(_0x307e28){try{jsonpatch[_0x1f04('0x1d')](_0x307e28,_0x19d5cf,!![]);}catch(_0x4c3a07){return BPromise[_0x1f04('0x1e')](_0x4c3a07);}return _0x307e28['save']();};}function saveUpdates(_0x17787b,_0x481fec){return function(_0xf90c26){if(_0xf90c26){return _0xf90c26[_0x1f04('0x1f')](_0x17787b)['then'](function(_0x4400ed){return _0x4400ed;});}return null;};}function removeEntity(_0x318c52,_0xefc51a){return function(_0x13d3ff){if(_0x13d3ff){return _0x13d3ff[_0x1f04('0x20')]()['then'](function(){_0x318c52[_0x1f04('0x18')](0xcc)['end']();});}};}function handleEntityNotFound(_0x527287,_0xb4a4e1){return function(_0x10c1fa){if(!_0x10c1fa){_0x527287['sendStatus'](0x194);}return _0x10c1fa;};}function handleError(_0x38f377,_0x24af7e){_0x24af7e=_0x24af7e||0x1f4;return function(_0x137ee0){logger[_0x1f04('0x21')](_0x137ee0[_0x1f04('0x22')]);if(_0x137ee0['name']){delete _0x137ee0[_0x1f04('0x23')];}_0x38f377[_0x1f04('0x18')](_0x24af7e)['send'](_0x137ee0);};}exports[_0x1f04('0x24')]=function(_0x34ae6f,_0xa5fb6b){var _0x3e2dfb={},_0x5ae3c0={},_0x491094={'count':0x0,'rows':[]};var _0x557ea6=_[_0x1f04('0x25')](db[_0x1f04('0x26')][_0x1f04('0x27')],function(_0x274c48){return{'name':_0x274c48[_0x1f04('0x28')],'type':_0x274c48['type'][_0x1f04('0x29')]};});_0x5ae3c0[_0x1f04('0x2a')]=_['map'](_0x557ea6,'name');_0x5ae3c0[_0x1f04('0x2b')]=_['keys'](_0x34ae6f[_0x1f04('0x2b')]);_0x5ae3c0[_0x1f04('0x2c')]=_[_0x1f04('0x2d')](_0x5ae3c0['model'],_0x5ae3c0['query']);_0x3e2dfb[_0x1f04('0x2e')]=_[_0x1f04('0x2d')](_0x5ae3c0[_0x1f04('0x2a')],qs[_0x1f04('0x2f')](_0x34ae6f['query'][_0x1f04('0x2f')]));_0x3e2dfb['attributes']=_0x3e2dfb['attributes'][_0x1f04('0x30')]?_0x3e2dfb[_0x1f04('0x2e')]:_0x5ae3c0[_0x1f04('0x2a')];if(!_0x34ae6f['query']['hasOwnProperty'](_0x1f04('0x31'))){_0x3e2dfb['limit']=qs[_0x1f04('0x32')](_0x34ae6f[_0x1f04('0x2b')][_0x1f04('0x32')]);_0x3e2dfb[_0x1f04('0x1b')]=qs[_0x1f04('0x1b')](_0x34ae6f['query'][_0x1f04('0x1b')]);}_0x3e2dfb[_0x1f04('0x33')]=qs[_0x1f04('0x34')](_0x34ae6f[_0x1f04('0x2b')][_0x1f04('0x34')]);_0x3e2dfb['where']=qs[_0x1f04('0x2c')](_[_0x1f04('0x35')](_0x34ae6f[_0x1f04('0x2b')],_0x5ae3c0[_0x1f04('0x2c')]));if(_0x34ae6f[_0x1f04('0x2b')][_0x1f04('0x36')]){_0x3e2dfb[_0x1f04('0x37')]=_[_0x1f04('0x38')](_0x3e2dfb[_0x1f04('0x37')],{'$or':_['map'](_0x557ea6,function(_0x360fea){if(_0x360fea[_0x1f04('0x39')]!==_0x1f04('0x3a')){var _0x293352={};_0x293352[_0x360fea[_0x1f04('0x23')]]={'$like':'%'+_0x34ae6f[_0x1f04('0x2b')]['filter']+'%'};return _0x293352;}})});}_0x3e2dfb=_[_0x1f04('0x38')]({},_0x3e2dfb,_0x34ae6f[_0x1f04('0x3b')]);var _0x138793={'where':_0x3e2dfb[_0x1f04('0x37')]};return db['UserProfileSection'][_0x1f04('0x1a')](_0x138793)[_0x1f04('0x3c')](function(_0x595740){_0x491094['count']=_0x595740;if(_0x34ae6f[_0x1f04('0x2b')]['includeAll']){_0x3e2dfb[_0x1f04('0x3d')]=[{'all':!![]}];}return db['UserProfileSection'][_0x1f04('0x3e')](_0x3e2dfb);})[_0x1f04('0x3c')](function(_0x21fe11){_0x491094[_0x1f04('0x3f')]=_0x21fe11;return _0x491094;})['then'](respondWithFilteredResult(_0xa5fb6b,_0x3e2dfb))[_0x1f04('0x40')](handleError(_0xa5fb6b,null));};exports[_0x1f04('0x41')]=function(_0x602915,_0x20d4b4){var _0x3867f3={'raw':![],'where':{'id':_0x602915['params']['id']}},_0x35dc5c={};_0x35dc5c[_0x1f04('0x2a')]=_[_0x1f04('0x42')](db['UserProfileSection'][_0x1f04('0x27')]);_0x35dc5c['query']=_['keys'](_0x602915[_0x1f04('0x2b')]);_0x35dc5c['filters']=_[_0x1f04('0x2d')](_0x35dc5c['model'],_0x35dc5c[_0x1f04('0x2b')]);_0x3867f3[_0x1f04('0x2e')]=_[_0x1f04('0x2d')](_0x35dc5c['model'],qs[_0x1f04('0x2f')](_0x602915[_0x1f04('0x2b')][_0x1f04('0x2f')]));_0x3867f3['attributes']=_0x3867f3['attributes'][_0x1f04('0x30')]?_0x3867f3['attributes']:_0x35dc5c[_0x1f04('0x2a')];if(_0x602915['query'][_0x1f04('0x43')]){_0x3867f3[_0x1f04('0x3d')]=[{'all':!![]}];}_0x3867f3=_[_0x1f04('0x38')]({},_0x3867f3,_0x602915[_0x1f04('0x3b')]);return db['UserProfileSection'][_0x1f04('0x44')](_0x3867f3)['then'](handleEntityNotFound(_0x20d4b4,null))[_0x1f04('0x3c')](respondWithResult(_0x20d4b4,null))[_0x1f04('0x40')](handleError(_0x20d4b4,null));};exports[_0x1f04('0x45')]=function(_0x3533bd,_0x2f6fbb){return db[_0x1f04('0x26')][_0x1f04('0x45')](_0x3533bd['body'],{})['then'](respondWithResult(_0x2f6fbb,0xc9))[_0x1f04('0x40')](handleError(_0x2f6fbb,null));};exports[_0x1f04('0x1f')]=function(_0x150126,_0xa0ed9b){if(_0x150126['body']['id']){delete _0x150126[_0x1f04('0x46')]['id'];}return db[_0x1f04('0x26')][_0x1f04('0x44')]({'where':{'id':_0x150126['params']['id']}})['then'](handleEntityNotFound(_0xa0ed9b,null))[_0x1f04('0x3c')](saveUpdates(_0x150126['body'],null))[_0x1f04('0x3c')](respondWithResult(_0xa0ed9b,null))['catch'](handleError(_0xa0ed9b,null));};exports[_0x1f04('0x20')]=function(_0x2d7f88,_0x2d5754){return db[_0x1f04('0x26')][_0x1f04('0x44')]({'where':{'id':_0x2d7f88['params']['id']}})[_0x1f04('0x3c')](handleEntityNotFound(_0x2d5754,null))[_0x1f04('0x3c')](removeEntity(_0x2d5754,null))['catch'](handleError(_0x2d5754,null));};exports['describe']=function(_0x113aca,_0x2f6757){return db[_0x1f04('0x26')]['describe']()[_0x1f04('0x3c')](respondWithResult(_0x2f6757,null))[_0x1f04('0x40')](handleError(_0x2f6757,null));}; \ No newline at end of file +var _0x880e=['UserProfileSection','fieldName','type','model','map','keys','query','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','filters','pick','merge','VIRTUAL','filter','options','count','includeAll','include','findAll','rows','catch','show','params','rawAttributes','find','create','body','describe','html-pdf','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','util','path','to-csv','ejs','squel','jsforce','desk.js','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../mysqldb','sendStatus','end','status','json','offset','limit','set','Content-Range','apply','reject','save','update','then','error','stack','name','index'];(function(_0xfa75cf,_0x2fae05){var _0x5d9a18=function(_0x43fcf2){while(--_0x43fcf2){_0xfa75cf['push'](_0xfa75cf['shift']());}};_0x5d9a18(++_0x2fae05);}(_0x880e,0x180));var _0xe880=function(_0xe719ec,_0x5a280e){_0xe719ec=_0xe719ec-0x0;var _0x4842a1=_0x880e[_0xe719ec];return _0x4842a1;};'use strict';var pdf=require(_0xe880('0x0'));var emlformat=require('eml-format');var rimraf=require(_0xe880('0x1'));var zipdir=require(_0xe880('0x2'));var jsonpatch=require(_0xe880('0x3'));var rp=require(_0xe880('0x4'));var moment=require('moment');var BPromise=require(_0xe880('0x5'));var Mustache=require('mustache');var util=require(_0xe880('0x6'));var path=require(_0xe880('0x7'));var sox=require('sox');var csv=require(_0xe880('0x8'));var ejs=require(_0xe880('0x9'));var fs=require('fs');var _=require('lodash');var squel=require(_0xe880('0xa'));var crypto=require('crypto');var jsforce=require(_0xe880('0xb'));var deskjs=require(_0xe880('0xc'));var toCsv=require(_0xe880('0x8'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0xe880('0xd'));var qs=require(_0xe880('0xe'));var as=require(_0xe880('0xf'));var hardwareService=require(_0xe880('0x10'));var logger=require(_0xe880('0x11'))('api');var utils=require('../../config/utils');var config=require('../../config/environment');var db=require(_0xe880('0x12'))['db'];function respondWithStatusCode(_0x1077a4,_0x150153){_0x150153=_0x150153||0xcc;return function(_0x1971ad){if(_0x1971ad){return _0x1077a4[_0xe880('0x13')](_0x150153);}return _0x1077a4['status'](_0x150153)[_0xe880('0x14')]();};}function respondWithResult(_0x3f392f,_0x31c952){_0x31c952=_0x31c952||0xc8;return function(_0x344e15){if(_0x344e15){return _0x3f392f[_0xe880('0x15')](_0x31c952)[_0xe880('0x16')](_0x344e15);}};}function respondWithFilteredResult(_0x44aaea,_0x674a32){return function(_0x3bf9ae){if(_0x3bf9ae){var _0x23e910=_0x3bf9ae['count'],_0x2fc263=_0x674a32[_0xe880('0x17')],_0x2711c9=_0x674a32[_0xe880('0x17')]+_0x674a32[_0xe880('0x18')],_0x3c65a5;if(_0x2711c9>=_0x23e910){_0x2711c9=_0x23e910;_0x3c65a5=0xc8;}else{_0x3c65a5=0xce;}_0x44aaea[_0xe880('0x15')](_0x3c65a5);return _0x44aaea[_0xe880('0x19')](_0xe880('0x1a'),_0x2fc263+'-'+_0x2711c9+'/'+_0x23e910)[_0xe880('0x16')](_0x3bf9ae);}return null;};}function patchUpdates(_0x5751b4){return function(_0x1edd32){try{jsonpatch[_0xe880('0x1b')](_0x1edd32,_0x5751b4,!![]);}catch(_0x589dbc){return BPromise[_0xe880('0x1c')](_0x589dbc);}return _0x1edd32[_0xe880('0x1d')]();};}function saveUpdates(_0x745561,_0x45cc75){return function(_0x52987c){if(_0x52987c){return _0x52987c[_0xe880('0x1e')](_0x745561)[_0xe880('0x1f')](function(_0x3db4d2){return _0x3db4d2;});}return null;};}function removeEntity(_0x1c6f70,_0x3f1023){return function(_0x32cbaa){if(_0x32cbaa){return _0x32cbaa['destroy']()[_0xe880('0x1f')](function(){_0x1c6f70[_0xe880('0x15')](0xcc)[_0xe880('0x14')]();});}};}function handleEntityNotFound(_0x23fccc,_0x34020b){return function(_0x418bd0){if(!_0x418bd0){_0x23fccc['sendStatus'](0x194);}return _0x418bd0;};}function handleError(_0x24b65b,_0x444806){_0x444806=_0x444806||0x1f4;return function(_0x3c842d){logger[_0xe880('0x20')](_0x3c842d[_0xe880('0x21')]);if(_0x3c842d['name']){delete _0x3c842d[_0xe880('0x22')];}_0x24b65b[_0xe880('0x15')](_0x444806)['send'](_0x3c842d);};}exports[_0xe880('0x23')]=function(_0x38a80c,_0x14d647){var _0x5f06fb={},_0x196a89={},_0x1969d8={'count':0x0,'rows':[]};var _0x338745=_['map'](db[_0xe880('0x24')]['rawAttributes'],function(_0x41e53e){return{'name':_0x41e53e[_0xe880('0x25')],'type':_0x41e53e[_0xe880('0x26')]['key']};});_0x196a89[_0xe880('0x27')]=_[_0xe880('0x28')](_0x338745,'name');_0x196a89['query']=_[_0xe880('0x29')](_0x38a80c[_0xe880('0x2a')]);_0x196a89['filters']=_[_0xe880('0x2b')](_0x196a89[_0xe880('0x27')],_0x196a89[_0xe880('0x2a')]);_0x5f06fb[_0xe880('0x2c')]=_[_0xe880('0x2b')](_0x196a89['model'],qs[_0xe880('0x2d')](_0x38a80c['query'][_0xe880('0x2d')]));_0x5f06fb[_0xe880('0x2c')]=_0x5f06fb[_0xe880('0x2c')]['length']?_0x5f06fb[_0xe880('0x2c')]:_0x196a89['model'];if(!_0x38a80c[_0xe880('0x2a')][_0xe880('0x2e')](_0xe880('0x2f'))){_0x5f06fb[_0xe880('0x18')]=qs[_0xe880('0x18')](_0x38a80c[_0xe880('0x2a')][_0xe880('0x18')]);_0x5f06fb[_0xe880('0x17')]=qs[_0xe880('0x17')](_0x38a80c['query']['offset']);}_0x5f06fb[_0xe880('0x30')]=qs[_0xe880('0x31')](_0x38a80c[_0xe880('0x2a')]['sort']);_0x5f06fb[_0xe880('0x32')]=qs[_0xe880('0x33')](_[_0xe880('0x34')](_0x38a80c[_0xe880('0x2a')],_0x196a89[_0xe880('0x33')]));if(_0x38a80c[_0xe880('0x2a')]['filter']){_0x5f06fb[_0xe880('0x32')]=_[_0xe880('0x35')](_0x5f06fb['where'],{'$or':_['map'](_0x338745,function(_0x90b9a8){if(_0x90b9a8['type']!==_0xe880('0x36')){var _0x24a33d={};_0x24a33d[_0x90b9a8[_0xe880('0x22')]]={'$like':'%'+_0x38a80c[_0xe880('0x2a')][_0xe880('0x37')]+'%'};return _0x24a33d;}})});}_0x5f06fb=_[_0xe880('0x35')]({},_0x5f06fb,_0x38a80c[_0xe880('0x38')]);var _0x1545e7={'where':_0x5f06fb[_0xe880('0x32')]};return db[_0xe880('0x24')]['count'](_0x1545e7)[_0xe880('0x1f')](function(_0x1d38d0){_0x1969d8[_0xe880('0x39')]=_0x1d38d0;if(_0x38a80c[_0xe880('0x2a')][_0xe880('0x3a')]){_0x5f06fb[_0xe880('0x3b')]=[{'all':!![]}];}return db['UserProfileSection'][_0xe880('0x3c')](_0x5f06fb);})[_0xe880('0x1f')](function(_0x5921aa){_0x1969d8[_0xe880('0x3d')]=_0x5921aa;return _0x1969d8;})[_0xe880('0x1f')](respondWithFilteredResult(_0x14d647,_0x5f06fb))[_0xe880('0x3e')](handleError(_0x14d647,null));};exports[_0xe880('0x3f')]=function(_0x61c5de,_0x5c414e){var _0x10a51d={'raw':![],'where':{'id':_0x61c5de[_0xe880('0x40')]['id']}},_0x352634={};_0x352634[_0xe880('0x27')]=_[_0xe880('0x29')](db[_0xe880('0x24')][_0xe880('0x41')]);_0x352634[_0xe880('0x2a')]=_[_0xe880('0x29')](_0x61c5de[_0xe880('0x2a')]);_0x352634['filters']=_[_0xe880('0x2b')](_0x352634['model'],_0x352634['query']);_0x10a51d['attributes']=_['intersection'](_0x352634[_0xe880('0x27')],qs[_0xe880('0x2d')](_0x61c5de['query'][_0xe880('0x2d')]));_0x10a51d[_0xe880('0x2c')]=_0x10a51d[_0xe880('0x2c')]['length']?_0x10a51d['attributes']:_0x352634[_0xe880('0x27')];if(_0x61c5de[_0xe880('0x2a')][_0xe880('0x3a')]){_0x10a51d['include']=[{'all':!![]}];}_0x10a51d=_[_0xe880('0x35')]({},_0x10a51d,_0x61c5de['options']);return db[_0xe880('0x24')][_0xe880('0x42')](_0x10a51d)['then'](handleEntityNotFound(_0x5c414e,null))[_0xe880('0x1f')](respondWithResult(_0x5c414e,null))[_0xe880('0x3e')](handleError(_0x5c414e,null));};exports[_0xe880('0x43')]=function(_0x35130a,_0x2e3691){return db['UserProfileSection'][_0xe880('0x43')](_0x35130a[_0xe880('0x44')],{})[_0xe880('0x1f')](respondWithResult(_0x2e3691,0xc9))[_0xe880('0x3e')](handleError(_0x2e3691,null));};exports[_0xe880('0x1e')]=function(_0x58a031,_0x429a89){if(_0x58a031[_0xe880('0x44')]['id']){delete _0x58a031['body']['id'];}return db[_0xe880('0x24')][_0xe880('0x42')]({'where':{'id':_0x58a031['params']['id']}})['then'](handleEntityNotFound(_0x429a89,null))[_0xe880('0x1f')](saveUpdates(_0x58a031['body'],null))[_0xe880('0x1f')](respondWithResult(_0x429a89,null))['catch'](handleError(_0x429a89,null));};exports['destroy']=function(_0xb7885a,_0x398d57){return db[_0xe880('0x24')][_0xe880('0x42')]({'where':{'id':_0xb7885a[_0xe880('0x40')]['id']}})[_0xe880('0x1f')](handleEntityNotFound(_0x398d57,null))[_0xe880('0x1f')](removeEntity(_0x398d57,null))[_0xe880('0x3e')](handleError(_0x398d57,null));};exports[_0xe880('0x45')]=function(_0x25b4e3,_0x42121){return db[_0xe880('0x24')][_0xe880('0x45')]()['then'](respondWithResult(_0x42121,null))[_0xe880('0x3e')](handleError(_0x42121,null));}; \ No newline at end of file diff --git a/server/api/userProfileSection/userProfileSection.model.js b/server/api/userProfileSection/userProfileSection.model.js index 420e9ce..165a23f 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 _0x4808=['moment','bluebird','request-promise','path','rimraf','../../config/environment','./userProfileSection.attributes','define','UserProfileSection','user_profile_has_sections','compositeIndex','userProfileId','lodash','util','../../config/logger','api'];(function(_0x2eee25,_0x53460d){var _0x1cb8c4=function(_0x4dad56){while(--_0x4dad56){_0x2eee25['push'](_0x2eee25['shift']());}};_0x1cb8c4(++_0x53460d);}(_0x4808,0x1cc));var _0x8480=function(_0x334841,_0x2bbc4c){_0x334841=_0x334841-0x0;var _0x5beb4b=_0x4808[_0x334841];return _0x5beb4b;};'use strict';var _=require(_0x8480('0x0'));var util=require(_0x8480('0x1'));var logger=require(_0x8480('0x2'))(_0x8480('0x3'));var moment=require(_0x8480('0x4'));var BPromise=require(_0x8480('0x5'));var rp=require(_0x8480('0x6'));var fs=require('fs');var path=require(_0x8480('0x7'));var rimraf=require(_0x8480('0x8'));var config=require(_0x8480('0x9'));var attributes=require(_0x8480('0xa'));module['exports']=function(_0x195872,_0xf1622f){return _0x195872[_0x8480('0xb')](_0x8480('0xc'),attributes,{'tableName':_0x8480('0xd'),'paranoid':![],'indexes':[{'name':_0x8480('0xe'),'fields':['sectionId',_0x8480('0xf')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x1dd4=['api','moment','request-promise','path','../../config/environment','./userProfileSection.attributes','exports','define','UserProfileSection','user_profile_has_sections','compositeIndex','sectionId','../../config/logger'];(function(_0xd94141,_0x3dff74){var _0x357c3d=function(_0x34a025){while(--_0x34a025){_0xd94141['push'](_0xd94141['shift']());}};_0x357c3d(++_0x3dff74);}(_0x1dd4,0x12a));var _0x41dd=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x1dd4[_0x3dd15e];return _0x231fd0;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x41dd('0x0'))(_0x41dd('0x1'));var moment=require(_0x41dd('0x2'));var BPromise=require('bluebird');var rp=require(_0x41dd('0x3'));var fs=require('fs');var path=require(_0x41dd('0x4'));var rimraf=require('rimraf');var config=require(_0x41dd('0x5'));var attributes=require(_0x41dd('0x6'));module[_0x41dd('0x7')]=function(_0x1e11ff,_0x374008){return _0x1e11ff[_0x41dd('0x8')](_0x41dd('0x9'),attributes,{'tableName':_0x41dd('0xa'),'paranoid':![],'indexes':[{'name':_0x41dd('0xb'),'fields':[_0x41dd('0xc'),'userProfileId']}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/userProfileSection/userProfileSection.rpc.js b/server/api/userProfileSection/userProfileSection.rpc.js index 683051f..f0bf705 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 _0x9584=['rpc','../../config/environment','jayson/promise','http','request','then','info','UserProfileSection,\x20%s,\x20%s','request\x20sent','UserProfileSection,\x20%s,\x20%s,\x20%s','stringify','error','message','result','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils'];(function(_0x432fca,_0xb0b1b5){var _0x3adba4=function(_0x5e3ae4){while(--_0x5e3ae4){_0x432fca['push'](_0x432fca['shift']());}};_0x3adba4(++_0xb0b1b5);}(_0x9584,0x66));var _0x4958=function(_0x4df583,_0x4674d8){_0x4df583=_0x4df583-0x0;var _0x105537=_0x9584[_0x4df583];return _0x105537;};'use strict';var _=require(_0x4958('0x0'));var util=require(_0x4958('0x1'));var moment=require(_0x4958('0x2'));var BPromise=require(_0x4958('0x3'));var rs=require(_0x4958('0x4'));var fs=require('fs');var Redis=require(_0x4958('0x5'));var db=require(_0x4958('0x6'))['db'];var utils=require(_0x4958('0x7'));var logger=require('../../config/logger')(_0x4958('0x8'));var config=require(_0x4958('0x9'));var jayson=require(_0x4958('0xa'));var client=jayson['client'][_0x4958('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x91827f,_0x2622a7,_0xe1fea6){return new BPromise(function(_0xa0eeb8,_0x314121){return client[_0x4958('0xc')](_0x91827f,_0xe1fea6)[_0x4958('0xd')](function(_0x13e420){logger[_0x4958('0xe')](_0x4958('0xf'),_0x2622a7,_0x4958('0x10'));logger['debug'](_0x4958('0x11'),_0x2622a7,_0x4958('0x10'),JSON[_0x4958('0x12')](_0x13e420));if(_0x13e420['error']){if(_0x13e420[_0x4958('0x13')]['code']===0x1f4){logger[_0x4958('0x13')](_0x4958('0xf'),_0x2622a7,_0x13e420[_0x4958('0x13')][_0x4958('0x14')]);return _0x314121(_0x13e420[_0x4958('0x13')]['message']);}logger['error'](_0x4958('0xf'),_0x2622a7,_0x13e420[_0x4958('0x13')][_0x4958('0x14')]);return _0xa0eeb8(_0x13e420[_0x4958('0x13')][_0x4958('0x14')]);}else{logger['info'](_0x4958('0xf'),_0x2622a7,_0x4958('0x10'));_0xa0eeb8(_0x13e420[_0x4958('0x15')][_0x4958('0x14')]);}})['catch'](function(_0x3aa6e8){logger[_0x4958('0x13')](_0x4958('0xf'),_0x2622a7,_0x3aa6e8);_0x314121(_0x3aa6e8);});});} \ No newline at end of file +var _0x0ebf=['UserProfileSection,\x20%s,\x20%s','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../config/environment','jayson/promise','client','http','request','info','request\x20sent','debug','stringify','error','code'];(function(_0x342db7,_0x2f2fac){var _0x2742e1=function(_0x43c1b5){while(--_0x43c1b5){_0x342db7['push'](_0x342db7['shift']());}};_0x2742e1(++_0x2f2fac);}(_0x0ebf,0x97));var _0xf0eb=function(_0x52684f,_0xff73fc){_0x52684f=_0x52684f-0x0;var _0x4a55f0=_0x0ebf[_0x52684f];return _0x4a55f0;};'use strict';var _=require(_0xf0eb('0x0'));var util=require(_0xf0eb('0x1'));var moment=require(_0xf0eb('0x2'));var BPromise=require(_0xf0eb('0x3'));var rs=require(_0xf0eb('0x4'));var fs=require('fs');var Redis=require(_0xf0eb('0x5'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')('rpc');var config=require(_0xf0eb('0x6'));var jayson=require(_0xf0eb('0x7'));var client=jayson[_0xf0eb('0x8')][_0xf0eb('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x49f47f,_0x21dabe,_0x4ef734){return new BPromise(function(_0x3084d9,_0xe2f8e8){return client[_0xf0eb('0xa')](_0x49f47f,_0x4ef734)['then'](function(_0x1ae726){logger[_0xf0eb('0xb')]('UserProfileSection,\x20%s,\x20%s',_0x21dabe,_0xf0eb('0xc'));logger[_0xf0eb('0xd')]('UserProfileSection,\x20%s,\x20%s,\x20%s',_0x21dabe,_0xf0eb('0xc'),JSON[_0xf0eb('0xe')](_0x1ae726));if(_0x1ae726['error']){if(_0x1ae726[_0xf0eb('0xf')][_0xf0eb('0x10')]===0x1f4){logger[_0xf0eb('0xf')](_0xf0eb('0x11'),_0x21dabe,_0x1ae726['error'][_0xf0eb('0x12')]);return _0xe2f8e8(_0x1ae726[_0xf0eb('0xf')][_0xf0eb('0x12')]);}logger[_0xf0eb('0xf')](_0xf0eb('0x11'),_0x21dabe,_0x1ae726[_0xf0eb('0xf')]['message']);return _0x3084d9(_0x1ae726[_0xf0eb('0xf')][_0xf0eb('0x12')]);}else{logger[_0xf0eb('0xb')](_0xf0eb('0x11'),_0x21dabe,_0xf0eb('0xc'));_0x3084d9(_0x1ae726[_0xf0eb('0x13')]['message']);}})[_0xf0eb('0x14')](function(_0x4dd2b9){logger[_0xf0eb('0xf')](_0xf0eb('0x11'),_0x21dabe,_0x4dd2b9);_0xe2f8e8(_0x4dd2b9);});});} \ No newline at end of file diff --git a/server/api/userSmsQueue/index.js b/server/api/userSmsQueue/index.js index b76735c..f97ca05 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 _0x982f=['express','../../components/auth/service','../../components/interaction/service','../../config/environment','exports','util','path','connect-timeout'];(function(_0x5080d9,_0xe3156b){var _0x387c22=function(_0x4bbb83){while(--_0x4bbb83){_0x5080d9['push'](_0x5080d9['shift']());}};_0x387c22(++_0xe3156b);}(_0x982f,0x1b5));var _0xf982=function(_0x203727,_0xf28a3d){_0x203727=_0x203727-0x0;var _0x3d6af0=_0x982f[_0x203727];return _0x3d6af0;};'use strict';var multer=require('multer');var util=require(_0xf982('0x0'));var path=require(_0xf982('0x1'));var timeout=require(_0xf982('0x2'));var express=require(_0xf982('0x3'));var router=express['Router']();var auth=require(_0xf982('0x4'));var interaction=require(_0xf982('0x5'));var config=require(_0xf982('0x6'));module[_0xf982('0x7')]=router; \ No newline at end of file +var _0x62c3=['exports','multer','util','path','connect-timeout','../../components/interaction/service'];(function(_0xccd9b7,_0x2ea6bd){var _0x26301d=function(_0x5892db){while(--_0x5892db){_0xccd9b7['push'](_0xccd9b7['shift']());}};_0x26301d(++_0x2ea6bd);}(_0x62c3,0x1c3));var _0x362c=function(_0x491faa,_0x4f2907){_0x491faa=_0x491faa-0x0;var _0x414440=_0x62c3[_0x491faa];return _0x414440;};'use strict';var multer=require(_0x362c('0x0'));var util=require(_0x362c('0x1'));var path=require(_0x362c('0x2'));var timeout=require(_0x362c('0x3'));var express=require('express');var router=express['Router']();var auth=require('../../components/auth/service');var interaction=require(_0x362c('0x4'));var config=require('../../config/environment');module[_0x362c('0x5')]=router; \ No newline at end of file diff --git a/server/api/userSmsQueue/userSmsQueue.attributes.js b/server/api/userSmsQueue/userSmsQueue.attributes.js index 44210d0..71b48d4 100644 --- a/server/api/userSmsQueue/userSmsQueue.attributes.js +++ b/server/api/userSmsQueue/userSmsQueue.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xd8b0=['exports','sequelize'];(function(_0x134b5e,_0x38ffae){var _0x388a4a=function(_0x5ecb89){while(--_0x5ecb89){_0x134b5e['push'](_0x134b5e['shift']());}};_0x388a4a(++_0x38ffae);}(_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 _0xa9e0=['sequelize','exports','INTEGER'];(function(_0x5b56b2,_0x38d838){var _0x108cfc=function(_0x18de13){while(--_0x18de13){_0x5b56b2['push'](_0x5b56b2['shift']());}};_0x108cfc(++_0x38d838);}(_0xa9e0,0x123));var _0x0a9e=function(_0x2a6809,_0x44edde){_0x2a6809=_0x2a6809-0x0;var _0x11c371=_0xa9e0[_0x2a6809];return _0x11c371;};'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/userSmsQueue/userSmsQueue.model.js b/server/api/userSmsQueue/userSmsQueue.model.js index 4bd3054..93f4514 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 _0xc0d5=['bluebird','request-promise','path','../../config/environment','exports','define','UserSmsQueue','user_has_sms_queues','lodash','../../config/logger','api','moment'];(function(_0x934425,_0x5af72f){var _0x31d596=function(_0x219869){while(--_0x219869){_0x934425['push'](_0x934425['shift']());}};_0x31d596(++_0x5af72f);}(_0xc0d5,0x1ac));var _0x5c0d=function(_0x46158a,_0x395e47){_0x46158a=_0x46158a-0x0;var _0x9f6bcf=_0xc0d5[_0x46158a];return _0x9f6bcf;};'use strict';var _=require(_0x5c0d('0x0'));var util=require('util');var logger=require(_0x5c0d('0x1'))(_0x5c0d('0x2'));var moment=require(_0x5c0d('0x3'));var BPromise=require(_0x5c0d('0x4'));var rp=require(_0x5c0d('0x5'));var fs=require('fs');var path=require(_0x5c0d('0x6'));var rimraf=require('rimraf');var config=require(_0x5c0d('0x7'));var attributes=require('./userSmsQueue.attributes');module[_0x5c0d('0x8')]=function(_0xc60e10,_0x440aec){return _0xc60e10[_0x5c0d('0x9')](_0x5c0d('0xa'),attributes,{'tableName':_0x5c0d('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xa8dd=['define','UserSmsQueue','user_has_sms_queues','util','../../config/logger','api','moment','bluebird','path','rimraf','./userSmsQueue.attributes','exports'];(function(_0x4b7895,_0x3c4f5d){var _0x264180=function(_0xe0e861){while(--_0xe0e861){_0x4b7895['push'](_0x4b7895['shift']());}};_0x264180(++_0x3c4f5d);}(_0xa8dd,0xdb));var _0xda8d=function(_0x1d52f8,_0x2753e0){_0x1d52f8=_0x1d52f8-0x0;var _0x212d2c=_0xa8dd[_0x1d52f8];return _0x212d2c;};'use strict';var _=require('lodash');var util=require(_0xda8d('0x0'));var logger=require(_0xda8d('0x1'))(_0xda8d('0x2'));var moment=require(_0xda8d('0x3'));var BPromise=require(_0xda8d('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xda8d('0x5'));var rimraf=require(_0xda8d('0x6'));var config=require('../../config/environment');var attributes=require(_0xda8d('0x7'));module[_0xda8d('0x8')]=function(_0x1b87d3,_0x40052e){return _0x1b87d3[_0xda8d('0x9')](_0xda8d('0xa'),attributes,{'tableName':_0xda8d('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 1956a1f..f8fb369 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 _0x5dd2=['randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','request\x20sent','debug','UserSmsQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','UserSmsQueue,\x20%s,\x20%s','message','info','result','lodash','util','moment','bluebird'];(function(_0x505df9,_0x14138e){var _0x1cc025=function(_0x5d2a1f){while(--_0x5d2a1f){_0x505df9['push'](_0x505df9['shift']());}};_0x1cc025(++_0x14138e);}(_0x5dd2,0x1ac));var _0x25dd=function(_0x13b02f,_0x462a53){_0x13b02f=_0x13b02f-0x0;var _0x12e9a6=_0x5dd2[_0x13b02f];return _0x12e9a6;};'use strict';var _=require(_0x25dd('0x0'));var util=require(_0x25dd('0x1'));var moment=require(_0x25dd('0x2'));var BPromise=require(_0x25dd('0x3'));var rs=require(_0x25dd('0x4'));var fs=require('fs');var Redis=require(_0x25dd('0x5'));var db=require(_0x25dd('0x6'))['db'];var utils=require(_0x25dd('0x7'));var logger=require(_0x25dd('0x8'))(_0x25dd('0x9'));var config=require(_0x25dd('0xa'));var jayson=require(_0x25dd('0xb'));var client=jayson['client'][_0x25dd('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x2358b1,_0x885abc,_0x317d33){return new BPromise(function(_0x42af92,_0x32ad0b){return client[_0x25dd('0xd')](_0x2358b1,_0x317d33)['then'](function(_0x39a862){logger['info']('UserSmsQueue,\x20%s,\x20%s',_0x885abc,_0x25dd('0xe'));logger[_0x25dd('0xf')](_0x25dd('0x10'),_0x885abc,'request\x20sent',JSON[_0x25dd('0x11')](_0x39a862));if(_0x39a862['error']){if(_0x39a862[_0x25dd('0x12')][_0x25dd('0x13')]===0x1f4){logger['error'](_0x25dd('0x14'),_0x885abc,_0x39a862[_0x25dd('0x12')][_0x25dd('0x15')]);return _0x32ad0b(_0x39a862['error']['message']);}logger[_0x25dd('0x12')](_0x25dd('0x14'),_0x885abc,_0x39a862['error'][_0x25dd('0x15')]);return _0x42af92(_0x39a862[_0x25dd('0x12')][_0x25dd('0x15')]);}else{logger[_0x25dd('0x16')](_0x25dd('0x14'),_0x885abc,_0x25dd('0xe'));_0x42af92(_0x39a862[_0x25dd('0x17')][_0x25dd('0x15')]);}})['catch'](function(_0x236d49){logger['error'](_0x25dd('0x14'),_0x885abc,_0x236d49);_0x32ad0b(_0x236d49);});});} \ No newline at end of file +var _0x7c61=['../../config/logger','rpc','../../config/environment','jayson/promise','client','http','then','info','UserSmsQueue,\x20%s,\x20%s','debug','UserSmsQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','request\x20sent','result','catch','util','moment','bluebird','randomstring'];(function(_0xb65e77,_0x238c3d){var _0x38134b=function(_0x39da21){while(--_0x39da21){_0xb65e77['push'](_0xb65e77['shift']());}};_0x38134b(++_0x238c3d);}(_0x7c61,0x6a));var _0x17c6=function(_0x4d7086,_0x399cdc){_0x4d7086=_0x4d7086-0x0;var _0x1ecaeb=_0x7c61[_0x4d7086];return _0x1ecaeb;};'use strict';var _=require('lodash');var util=require(_0x17c6('0x0'));var moment=require(_0x17c6('0x1'));var BPromise=require(_0x17c6('0x2'));var rs=require(_0x17c6('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x17c6('0x4'))(_0x17c6('0x5'));var config=require(_0x17c6('0x6'));var jayson=require(_0x17c6('0x7'));var client=jayson[_0x17c6('0x8')][_0x17c6('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x16d2bb,_0x3c6aa1,_0x48b6e6){return new BPromise(function(_0x30b6da,_0x5d6eff){return client['request'](_0x16d2bb,_0x48b6e6)[_0x17c6('0xa')](function(_0x242d51){logger[_0x17c6('0xb')](_0x17c6('0xc'),_0x3c6aa1,'request\x20sent');logger[_0x17c6('0xd')](_0x17c6('0xe'),_0x3c6aa1,'request\x20sent',JSON[_0x17c6('0xf')](_0x242d51));if(_0x242d51[_0x17c6('0x10')]){if(_0x242d51[_0x17c6('0x10')][_0x17c6('0x11')]===0x1f4){logger['error']('UserSmsQueue,\x20%s,\x20%s',_0x3c6aa1,_0x242d51[_0x17c6('0x10')][_0x17c6('0x12')]);return _0x5d6eff(_0x242d51[_0x17c6('0x10')]['message']);}logger[_0x17c6('0x10')](_0x17c6('0xc'),_0x3c6aa1,_0x242d51['error'][_0x17c6('0x12')]);return _0x30b6da(_0x242d51[_0x17c6('0x10')][_0x17c6('0x12')]);}else{logger['info'](_0x17c6('0xc'),_0x3c6aa1,_0x17c6('0x13'));_0x30b6da(_0x242d51[_0x17c6('0x14')][_0x17c6('0x12')]);}})[_0x17c6('0x15')](function(_0x5e7f0f){logger[_0x17c6('0x10')](_0x17c6('0xc'),_0x3c6aa1,_0x5e7f0f);_0x5d6eff(_0x5e7f0f);});});} \ No newline at end of file diff --git a/server/api/userVoiceQueue/index.js b/server/api/userVoiceQueue/index.js index 62a0916..3901036 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 _0x88bd=['../../components/interaction/service','../../config/environment','exports','multer','path','express','Router'];(function(_0x1cc884,_0x30a01b){var _0x54ed9b=function(_0x9567a4){while(--_0x9567a4){_0x1cc884['push'](_0x1cc884['shift']());}};_0x54ed9b(++_0x30a01b);}(_0x88bd,0xb9));var _0xd88b=function(_0x2dc1a1,_0x2ef333){_0x2dc1a1=_0x2dc1a1-0x0;var _0x12f1bc=_0x88bd[_0x2dc1a1];return _0x12f1bc;};'use strict';var multer=require(_0xd88b('0x0'));var util=require('util');var path=require(_0xd88b('0x1'));var timeout=require('connect-timeout');var express=require(_0xd88b('0x2'));var router=express[_0xd88b('0x3')]();var auth=require('../../components/auth/service');var interaction=require(_0xd88b('0x4'));var config=require(_0xd88b('0x5'));module[_0xd88b('0x6')]=router; \ No newline at end of file +var _0x9f1c=['exports','multer','util','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment'];(function(_0xe52a84,_0x3ae9d0){var _0x2ed80e=function(_0x4063cc){while(--_0x4063cc){_0xe52a84['push'](_0xe52a84['shift']());}};_0x2ed80e(++_0x3ae9d0);}(_0x9f1c,0x106));var _0xc9f1=function(_0x402fd4,_0x4a380a){_0x402fd4=_0x402fd4-0x0;var _0x441084=_0x9f1c[_0x402fd4];return _0x441084;};'use strict';var multer=require(_0xc9f1('0x0'));var util=require(_0xc9f1('0x1'));var path=require('path');var timeout=require(_0xc9f1('0x2'));var express=require(_0xc9f1('0x3'));var router=express[_0xc9f1('0x4')]();var auth=require(_0xc9f1('0x5'));var interaction=require(_0xc9f1('0x6'));var config=require(_0xc9f1('0x7'));module[_0xc9f1('0x8')]=router; \ No newline at end of file diff --git a/server/api/userVoiceQueue/userVoiceQueue.attributes.js b/server/api/userVoiceQueue/userVoiceQueue.attributes.js index 31e51fc..4333a96 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(_0x4da7f8,_0x5d836d){var _0x4968d0=function(_0x2bdd0b){while(--_0x2bdd0b){_0x4da7f8['push'](_0x4da7f8['shift']());}};_0x4968d0(++_0x5d836d);}(_0xd8b0,0xad));var _0x0d8b=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0xd8b0[_0xa464c9];return _0x3d73c4;};'use strict';var Sequelize=require(_0x0d8b('0x0'));module[_0x0d8b('0x1')]={'penalty':{'type':Sequelize['INTEGER'],'defaultValue':0x0}}; \ No newline at end of file +var _0xe706=['INTEGER','sequelize','exports'];(function(_0x143fc7,_0x28f1e0){var _0xf709de=function(_0x5acb0b){while(--_0x5acb0b){_0x143fc7['push'](_0x143fc7['shift']());}};_0xf709de(++_0x28f1e0);}(_0xe706,0xa3));var _0x6e70=function(_0x47b58b,_0x41a189){_0x47b58b=_0x47b58b-0x0;var _0x46bebe=_0xe706[_0x47b58b];return _0x46bebe;};'use strict';var Sequelize=require(_0x6e70('0x0'));module[_0x6e70('0x1')]={'penalty':{'type':Sequelize[_0x6e70('0x2')],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/userVoiceQueue/userVoiceQueue.model.js b/server/api/userVoiceQueue/userVoiceQueue.model.js index 9fe0b65..9dd82ab 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 _0x5178=['rimraf','../../config/environment','exports','define','UserVoiceQueue','user_has_voice_queues','util','../../config/logger','api','moment','bluebird'];(function(_0x46a3e8,_0x2e1b35){var _0xf1442e=function(_0x37b5d4){while(--_0x37b5d4){_0x46a3e8['push'](_0x46a3e8['shift']());}};_0xf1442e(++_0x2e1b35);}(_0x5178,0x171));var _0x8517=function(_0x5ddb1c,_0x5ea4df){_0x5ddb1c=_0x5ddb1c-0x0;var _0x354adc=_0x5178[_0x5ddb1c];return _0x354adc;};'use strict';var _=require('lodash');var util=require(_0x8517('0x0'));var logger=require(_0x8517('0x1'))(_0x8517('0x2'));var moment=require(_0x8517('0x3'));var BPromise=require(_0x8517('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x8517('0x5'));var config=require(_0x8517('0x6'));var attributes=require('./userVoiceQueue.attributes');module[_0x8517('0x7')]=function(_0x58ed7e,_0x13ba05){return _0x58ed7e[_0x8517('0x8')](_0x8517('0x9'),attributes,{'tableName':_0x8517('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x7217=['../../config/environment','./userVoiceQueue.attributes','exports','define','UserVoiceQueue','user_has_voice_queues','lodash','../../config/logger','api','moment','bluebird','request-promise'];(function(_0x5d4607,_0x6b5e7b){var _0x5e4a86=function(_0x46891a){while(--_0x46891a){_0x5d4607['push'](_0x5d4607['shift']());}};_0x5e4a86(++_0x6b5e7b);}(_0x7217,0x19e));var _0x7721=function(_0x4dbaad,_0x730318){_0x4dbaad=_0x4dbaad-0x0;var _0x226c72=_0x7217[_0x4dbaad];return _0x226c72;};'use strict';var _=require(_0x7721('0x0'));var util=require('util');var logger=require(_0x7721('0x1'))(_0x7721('0x2'));var moment=require(_0x7721('0x3'));var BPromise=require(_0x7721('0x4'));var rp=require(_0x7721('0x5'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x7721('0x6'));var attributes=require(_0x7721('0x7'));module[_0x7721('0x8')]=function(_0x3fe47c,_0xb239e0){return _0x3fe47c[_0x7721('0x9')](_0x7721('0xa'),attributes,{'tableName':_0x7721('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/userVoiceQueue/userVoiceQueue.rpc.js b/server/api/userVoiceQueue/userVoiceQueue.rpc.js index 9f8f472..ae3491d 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 _0xc1b2=['then','info','UserVoiceQueue,\x20%s,\x20%s','request\x20sent','debug','UserVoiceQueue,\x20%s,\x20%s,\x20%s','error','message','result','lodash','util','ioredis','../../mysqldb','rpc','client','http'];(function(_0x55fa03,_0xcb96c2){var _0x2cd7cd=function(_0x56611f){while(--_0x56611f){_0x55fa03['push'](_0x55fa03['shift']());}};_0x2cd7cd(++_0xcb96c2);}(_0xc1b2,0x69));var _0x2c1b=function(_0x15189b,_0x1e6ca8){_0x15189b=_0x15189b-0x0;var _0x2e7cff=_0xc1b2[_0x15189b];return _0x2e7cff;};'use strict';var _=require(_0x2c1b('0x0'));var util=require(_0x2c1b('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x2c1b('0x2'));var db=require(_0x2c1b('0x3'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x2c1b('0x4'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x2c1b('0x5')][_0x2c1b('0x6')]({'port':0x232a});function respondWithRpcPromise(_0x1b075b,_0x371d76,_0x5d4567){return new BPromise(function(_0x5ee4e9,_0x507279){return client['request'](_0x1b075b,_0x5d4567)[_0x2c1b('0x7')](function(_0x5e98aa){logger[_0x2c1b('0x8')](_0x2c1b('0x9'),_0x371d76,_0x2c1b('0xa'));logger[_0x2c1b('0xb')](_0x2c1b('0xc'),_0x371d76,_0x2c1b('0xa'),JSON['stringify'](_0x5e98aa));if(_0x5e98aa['error']){if(_0x5e98aa['error']['code']===0x1f4){logger[_0x2c1b('0xd')](_0x2c1b('0x9'),_0x371d76,_0x5e98aa[_0x2c1b('0xd')][_0x2c1b('0xe')]);return _0x507279(_0x5e98aa['error'][_0x2c1b('0xe')]);}logger[_0x2c1b('0xd')](_0x2c1b('0x9'),_0x371d76,_0x5e98aa[_0x2c1b('0xd')][_0x2c1b('0xe')]);return _0x5ee4e9(_0x5e98aa[_0x2c1b('0xd')][_0x2c1b('0xe')]);}else{logger[_0x2c1b('0x8')]('UserVoiceQueue,\x20%s,\x20%s',_0x371d76,_0x2c1b('0xa'));_0x5ee4e9(_0x5e98aa[_0x2c1b('0xf')]['message']);}})['catch'](function(_0x796e3){logger['error'](_0x2c1b('0x9'),_0x371d76,_0x796e3);_0x507279(_0x796e3);});});} \ No newline at end of file +var _0xae37=['error','code','UserVoiceQueue,\x20%s,\x20%s','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','request','then','info','request\x20sent','debug'];(function(_0x53c174,_0x247275){var _0x521be6=function(_0x20450d){while(--_0x20450d){_0x53c174['push'](_0x53c174['shift']());}};_0x521be6(++_0x247275);}(_0xae37,0xae));var _0x7ae3=function(_0x33747e,_0x219a50){_0x33747e=_0x33747e-0x0;var _0x4a61c1=_0xae37[_0x33747e];return _0x4a61c1;};'use strict';var _=require(_0x7ae3('0x0'));var util=require(_0x7ae3('0x1'));var moment=require(_0x7ae3('0x2'));var BPromise=require(_0x7ae3('0x3'));var rs=require(_0x7ae3('0x4'));var fs=require('fs');var Redis=require(_0x7ae3('0x5'));var db=require(_0x7ae3('0x6'))['db'];var utils=require(_0x7ae3('0x7'));var logger=require('../../config/logger')(_0x7ae3('0x8'));var config=require(_0x7ae3('0x9'));var jayson=require(_0x7ae3('0xa'));var client=jayson[_0x7ae3('0xb')][_0x7ae3('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x7ee45b,_0x3bea8c,_0x5111b9){return new BPromise(function(_0x483688,_0x3e7f24){return client[_0x7ae3('0xd')](_0x7ee45b,_0x5111b9)[_0x7ae3('0xe')](function(_0x3a4b78){logger[_0x7ae3('0xf')]('UserVoiceQueue,\x20%s,\x20%s',_0x3bea8c,_0x7ae3('0x10'));logger[_0x7ae3('0x11')]('UserVoiceQueue,\x20%s,\x20%s,\x20%s',_0x3bea8c,_0x7ae3('0x10'),JSON['stringify'](_0x3a4b78));if(_0x3a4b78[_0x7ae3('0x12')]){if(_0x3a4b78[_0x7ae3('0x12')][_0x7ae3('0x13')]===0x1f4){logger[_0x7ae3('0x12')](_0x7ae3('0x14'),_0x3bea8c,_0x3a4b78['error']['message']);return _0x3e7f24(_0x3a4b78['error'][_0x7ae3('0x15')]);}logger[_0x7ae3('0x12')](_0x7ae3('0x14'),_0x3bea8c,_0x3a4b78['error'][_0x7ae3('0x15')]);return _0x483688(_0x3a4b78['error'][_0x7ae3('0x15')]);}else{logger[_0x7ae3('0xf')](_0x7ae3('0x14'),_0x3bea8c,_0x7ae3('0x10'));_0x483688(_0x3a4b78[_0x7ae3('0x16')][_0x7ae3('0x15')]);}})[_0x7ae3('0x17')](function(_0x2d42eb){logger[_0x7ae3('0x12')](_0x7ae3('0x14'),_0x3bea8c,_0x2d42eb);_0x3e7f24(_0x2d42eb);});});} \ No newline at end of file diff --git a/server/api/userVoiceQueueRt/index.js b/server/api/userVoiceQueueRt/index.js index a94d11e..7f0a9e8 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 _0x1de7=['../../components/auth/service','../../components/interaction/service','../../config/environment','exports','path','express','Router'];(function(_0x53af5c,_0x2871f0){var _0x47b641=function(_0x46dd17){while(--_0x46dd17){_0x53af5c['push'](_0x53af5c['shift']());}};_0x47b641(++_0x2871f0);}(_0x1de7,0x138));var _0x71de=function(_0x2bbb0f,_0x3c7317){_0x2bbb0f=_0x2bbb0f-0x0;var _0x4efd63=_0x1de7[_0x2bbb0f];return _0x4efd63;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x71de('0x0'));var timeout=require('connect-timeout');var express=require(_0x71de('0x1'));var router=express[_0x71de('0x2')]();var auth=require(_0x71de('0x3'));var interaction=require(_0x71de('0x4'));var config=require(_0x71de('0x5'));module[_0x71de('0x6')]=router; \ No newline at end of file +var _0x68b4=['connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service'];(function(_0x1b828b,_0x344400){var _0x98da1a=function(_0x1a0f5b){while(--_0x1a0f5b){_0x1b828b['push'](_0x1b828b['shift']());}};_0x98da1a(++_0x344400);}(_0x68b4,0x195));var _0x468b=function(_0x47cf3a,_0x3e7355){_0x47cf3a=_0x47cf3a-0x0;var _0x32c780=_0x68b4[_0x47cf3a];return _0x32c780;};'use strict';var multer=require('multer');var util=require('util');var path=require('path');var timeout=require(_0x468b('0x0'));var express=require(_0x468b('0x1'));var router=express[_0x468b('0x2')]();var auth=require(_0x468b('0x3'));var interaction=require(_0x468b('0x4'));var config=require('../../config/environment');module['exports']=router; \ No newline at end of file diff --git a/server/api/userVoiceQueueRt/userVoiceQueueRt.attributes.js b/server/api/userVoiceQueueRt/userVoiceQueueRt.attributes.js index 13e4365..b3c54c0 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 _0x3fd9=['STRING','Required\x20by\x20Asterisk','queue_interface','exports','INTEGER'];(function(_0x5b7788,_0x309ae5){var _0x573871=function(_0x5c79fd){while(--_0x5c79fd){_0x5b7788['push'](_0x5b7788['shift']());}};_0x573871(++_0x309ae5);}(_0x3fd9,0x1b1));var _0x93fd=function(_0xfc08a4,_0x38d0c4){_0xfc08a4=_0xfc08a4-0x0;var _0x243571=_0x3fd9[_0xfc08a4];return _0x243571;};'use strict';var Sequelize=require('sequelize');module[_0x93fd('0x0')]={'uniqueid':{'type':Sequelize[_0x93fd('0x1')],'primaryKey':!![],'autoIncrement':!![],'comment':'Required\x20by\x20Asterisk'},'membername':{'type':Sequelize[_0x93fd('0x2')],'allowNull':![],'comment':_0x93fd('0x3')},'UserId':{'type':Sequelize['INTEGER'],'allowNull':![]},'queue_name':{'type':Sequelize['STRING'],'allowNull':![],'unique':_0x93fd('0x4'),'comment':_0x93fd('0x3')},'VoiceQueueId':{'type':Sequelize['INTEGER'],'allowNull':![]},'interface':{'type':Sequelize[_0x93fd('0x2')],'allowNull':![],'unique':'queue_interface','comment':_0x93fd('0x3')},'penalty':{'type':Sequelize[_0x93fd('0x1')](0xb),'defaultValue':0x0,'comment':_0x93fd('0x3')},'paused':{'type':Sequelize[_0x93fd('0x1')](0xb),'defaultValue':0x0,'comment':_0x93fd('0x3')}}; \ No newline at end of file +var _0xec24=['exports','INTEGER','Required\x20by\x20Asterisk','STRING','queue_interface','sequelize'];(function(_0x5f01b6,_0x2967fc){var _0x4c1703=function(_0x27426b){while(--_0x27426b){_0x5f01b6['push'](_0x5f01b6['shift']());}};_0x4c1703(++_0x2967fc);}(_0xec24,0xb3));var _0x4ec2=function(_0x3c63d6,_0x342b0e){_0x3c63d6=_0x3c63d6-0x0;var _0x7bdb1c=_0xec24[_0x3c63d6];return _0x7bdb1c;};'use strict';var Sequelize=require(_0x4ec2('0x0'));module[_0x4ec2('0x1')]={'uniqueid':{'type':Sequelize[_0x4ec2('0x2')],'primaryKey':!![],'autoIncrement':!![],'comment':_0x4ec2('0x3')},'membername':{'type':Sequelize[_0x4ec2('0x4')],'allowNull':![],'comment':'Required\x20by\x20Asterisk'},'UserId':{'type':Sequelize[_0x4ec2('0x2')],'allowNull':![]},'queue_name':{'type':Sequelize['STRING'],'allowNull':![],'unique':_0x4ec2('0x5'),'comment':_0x4ec2('0x3')},'VoiceQueueId':{'type':Sequelize[_0x4ec2('0x2')],'allowNull':![]},'interface':{'type':Sequelize['STRING'],'allowNull':![],'unique':_0x4ec2('0x5'),'comment':_0x4ec2('0x3')},'penalty':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x0,'comment':_0x4ec2('0x3')},'paused':{'type':Sequelize[_0x4ec2('0x2')](0xb),'defaultValue':0x0,'comment':_0x4ec2('0x3')}}; \ No newline at end of file diff --git a/server/api/userVoiceQueueRt/userVoiceQueueRt.events.js b/server/api/userVoiceQueueRt/userVoiceQueueRt.events.js index da9263a..d696aec 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 _0x4605=['exports','UserVoiceQueueRt','setMaxListeners','update','remove','emit'];(function(_0x2bd61d,_0x10219a){var _0x2e1c19=function(_0x197257){while(--_0x197257){_0x2bd61d['push'](_0x2bd61d['shift']());}};_0x2e1c19(++_0x10219a);}(_0x4605,0x1c9));var _0x5460=function(_0x2bcddb,_0x3eaf37){_0x2bcddb=_0x2bcddb-0x0;var _0x12a9e8=_0x4605[_0x2bcddb];return _0x12a9e8;};'use strict';var EventEmitter=require('events');var UserVoiceQueueRt=require('../../mysqldb')['db'][_0x5460('0x0')];var UserVoiceQueueRtEvents=new EventEmitter();UserVoiceQueueRtEvents[_0x5460('0x1')](0x0);var events={'afterCreate':'save','afterUpdate':_0x5460('0x2'),'afterDestroy':_0x5460('0x3')};function emitEvent(_0x2b7f68){return function(_0x156c54,_0x6362ad,_0x1e0440){UserVoiceQueueRtEvents[_0x5460('0x4')](_0x2b7f68+':'+_0x156c54['id'],_0x156c54);UserVoiceQueueRtEvents[_0x5460('0x4')](_0x2b7f68,_0x156c54);_0x1e0440(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];UserVoiceQueueRt['hook'](e,emitEvent(event));}}module[_0x5460('0x5')]=UserVoiceQueueRtEvents; \ No newline at end of file +var _0xfcd0=['hasOwnProperty','hook','events','../../mysqldb','UserVoiceQueueRt','save','update','remove','emit'];(function(_0x40e0e6,_0x5865b2){var _0x9658eb=function(_0x964218){while(--_0x964218){_0x40e0e6['push'](_0x40e0e6['shift']());}};_0x9658eb(++_0x5865b2);}(_0xfcd0,0x89));var _0x0fcd=function(_0x29790e,_0x1e1e71){_0x29790e=_0x29790e-0x0;var _0x160c2e=_0xfcd0[_0x29790e];return _0x160c2e;};'use strict';var EventEmitter=require(_0x0fcd('0x0'));var UserVoiceQueueRt=require(_0x0fcd('0x1'))['db'][_0x0fcd('0x2')];var UserVoiceQueueRtEvents=new EventEmitter();UserVoiceQueueRtEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x0fcd('0x3'),'afterUpdate':_0x0fcd('0x4'),'afterDestroy':_0x0fcd('0x5')};function emitEvent(_0x3d9662){return function(_0x3606db,_0x33d3a1,_0x1aadb9){UserVoiceQueueRtEvents[_0x0fcd('0x6')](_0x3d9662+':'+_0x3606db['id'],_0x3606db);UserVoiceQueueRtEvents['emit'](_0x3d9662,_0x3606db);_0x1aadb9(null);};}for(var e in events){if(events[_0x0fcd('0x7')](e)){var event=events[e];UserVoiceQueueRt[_0x0fcd('0x8')](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 63ac4ef..01157b0 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 _0x5441=['path','rimraf','../../config/environment','./userVoiceQueueRt.attributes','exports','define','UserVoiceQueueRt','util','../../config/logger','moment','bluebird','request-promise'];(function(_0x1cbca5,_0x1da854){var _0x83f3d6=function(_0x1a4671){while(--_0x1a4671){_0x1cbca5['push'](_0x1cbca5['shift']());}};_0x83f3d6(++_0x1da854);}(_0x5441,0xa3));var _0x1544=function(_0x220f3f,_0x11c540){_0x220f3f=_0x220f3f-0x0;var _0x1f170e=_0x5441[_0x220f3f];return _0x1f170e;};'use strict';var _=require('lodash');var util=require(_0x1544('0x0'));var logger=require(_0x1544('0x1'))('api');var moment=require(_0x1544('0x2'));var BPromise=require(_0x1544('0x3'));var rp=require(_0x1544('0x4'));var fs=require('fs');var path=require(_0x1544('0x5'));var rimraf=require(_0x1544('0x6'));var config=require(_0x1544('0x7'));var attributes=require(_0x1544('0x8'));module[_0x1544('0x9')]=function(_0x360592,_0x36fcda){return _0x360592[_0x1544('0xa')](_0x1544('0xb'),attributes,{'tableName':'user_has_voice_queues_rt','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xd29f=['rimraf','../../config/environment','exports','UserVoiceQueueRt','../../config/logger','moment','request-promise','path'];(function(_0x52eca9,_0x46ab92){var _0xbce426=function(_0x2c2d1c){while(--_0x2c2d1c){_0x52eca9['push'](_0x52eca9['shift']());}};_0xbce426(++_0x46ab92);}(_0xd29f,0xc4));var _0xfd29=function(_0x318410,_0x451962){_0x318410=_0x318410-0x0;var _0x2898a3=_0xd29f[_0x318410];return _0x2898a3;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0xfd29('0x0'))('api');var moment=require(_0xfd29('0x1'));var BPromise=require('bluebird');var rp=require(_0xfd29('0x2'));var fs=require('fs');var path=require(_0xfd29('0x3'));var rimraf=require(_0xfd29('0x4'));var config=require(_0xfd29('0x5'));var attributes=require('./userVoiceQueueRt.attributes');module[_0xfd29('0x6')]=function(_0x4584af,_0x59cee7){return _0x4584af['define'](_0xfd29('0x7'),attributes,{'tableName':'user_has_voice_queues_rt','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/userVoiceQueueRt/userVoiceQueueRt.rpc.js b/server/api/userVoiceQueueRt/userVoiceQueueRt.rpc.js index 4ad2009..25b25a6 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 _0x2473=['`paused`\x20=\x201,\x201,\x20null','outboundQueuePauses','stringify','catch','lodash','util','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','./userVoiceQueueRt.socket','register','request','then','UserVoiceQueueRt,\x20%s,\x20%s','request\x20sent','debug','UserVoiceQueueRt,\x20%s,\x20%s,\x20%s','error','code','message','info','result','GetVoiceQueueRtPauses','UserVoiceQueueRt','findAll','options','where','COUNT','sequelize','literal'];(function(_0x2de632,_0x43621d){var _0x446d54=function(_0x33fe9b){while(--_0x33fe9b){_0x2de632['push'](_0x2de632['shift']());}};_0x446d54(++_0x43621d);}(_0x2473,0x11c));var _0x3247=function(_0x3b380d,_0x4bf247){_0x3b380d=_0x3b380d-0x0;var _0x54502b=_0x2473[_0x3b380d];return _0x54502b;};'use strict';var _=require(_0x3247('0x0'));var util=require(_0x3247('0x1'));var moment=require('moment');var BPromise=require(_0x3247('0x2'));var rs=require(_0x3247('0x3'));var fs=require('fs');var Redis=require(_0x3247('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x3247('0x5'));var logger=require(_0x3247('0x6'))('rpc');var config=require(_0x3247('0x7'));var jayson=require(_0x3247('0x8'));var client=jayson[_0x3247('0x9')][_0x3247('0xa')]({'port':0x232a});config[_0x3247('0xb')]=_[_0x3247('0xc')](config['redis'],{'host':_0x3247('0xd'),'port':0x18eb});var socket=require(_0x3247('0xe'))(new Redis(config[_0x3247('0xb')]));require(_0x3247('0xf'))[_0x3247('0x10')](socket);function respondWithRpcPromise(_0x15c602,_0x48bbee,_0x497f51){return new BPromise(function(_0x43db3d,_0x4d300e){return client[_0x3247('0x11')](_0x15c602,_0x497f51)[_0x3247('0x12')](function(_0x5424d2){logger['info'](_0x3247('0x13'),_0x48bbee,_0x3247('0x14'));logger[_0x3247('0x15')](_0x3247('0x16'),_0x48bbee,_0x3247('0x14'),JSON['stringify'](_0x5424d2));if(_0x5424d2['error']){if(_0x5424d2[_0x3247('0x17')][_0x3247('0x18')]===0x1f4){logger[_0x3247('0x17')](_0x3247('0x13'),_0x48bbee,_0x5424d2[_0x3247('0x17')][_0x3247('0x19')]);return _0x4d300e(_0x5424d2[_0x3247('0x17')][_0x3247('0x19')]);}logger[_0x3247('0x17')](_0x3247('0x13'),_0x48bbee,_0x5424d2[_0x3247('0x17')][_0x3247('0x19')]);return _0x43db3d(_0x5424d2[_0x3247('0x17')][_0x3247('0x19')]);}else{logger[_0x3247('0x1a')](_0x3247('0x13'),_0x48bbee,_0x3247('0x14'));_0x43db3d(_0x5424d2[_0x3247('0x1b')][_0x3247('0x19')]);}})['catch'](function(_0x344f83){logger[_0x3247('0x17')](_0x3247('0x13'),_0x48bbee,_0x344f83);_0x4d300e(_0x344f83);});});}exports[_0x3247('0x1c')]=function(_0x23fb17){var _0x40fa5a=this;return new Promise(function(_0xaeca48,_0x5b1ea0){return db[_0x3247('0x1d')][_0x3247('0x1e')]({'raw':_0x23fb17['options']?_0x23fb17[_0x3247('0x1f')]['raw']===undefined?!![]:![]:!![],'where':_0x23fb17['options']?_0x23fb17[_0x3247('0x1f')][_0x3247('0x20')]||null:null,'attributes':[[db['sequelize']['fn'](_0x3247('0x21'),db['sequelize']['fn']('IF',db[_0x3247('0x22')][_0x3247('0x23')](_0x3247('0x24')))),_0x3247('0x25')]]})[_0x3247('0x12')](function(_0x22da8d){logger['info'](_0x3247('0x1c'),_0x23fb17);logger[_0x3247('0x15')](_0x3247('0x1c'),_0x23fb17,JSON[_0x3247('0x26')](_0x22da8d));_0xaeca48(_0x22da8d);})[_0x3247('0x27')](function(_0x15cb36){logger['error'](_0x3247('0x1c'),_0x15cb36[_0x3247('0x19')],_0x23fb17);_0x5b1ea0(_0x40fa5a[_0x3247('0x17')](0x1f4,_0x15cb36[_0x3247('0x19')]));});});}; \ No newline at end of file +var _0x7ea5=['client','redis','defaults','socket.io-emitter','./userVoiceQueueRt.socket','register','request','then','info','UserVoiceQueueRt,\x20%s,\x20%s','request\x20sent','debug','UserVoiceQueueRt,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','GetVoiceQueueRtPauses','findAll','options','where','sequelize','COUNT','util','moment','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise'];(function(_0x5d100b,_0x328871){var _0x153afe=function(_0x1d4565){while(--_0x1d4565){_0x5d100b['push'](_0x5d100b['shift']());}};_0x153afe(++_0x328871);}(_0x7ea5,0x18f));var _0x57ea=function(_0x24204a,_0x2b1d93){_0x24204a=_0x24204a-0x0;var _0x31195c=_0x7ea5[_0x24204a];return _0x31195c;};'use strict';var _=require('lodash');var util=require(_0x57ea('0x0'));var moment=require(_0x57ea('0x1'));var BPromise=require('bluebird');var rs=require(_0x57ea('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x57ea('0x3'))['db'];var utils=require(_0x57ea('0x4'));var logger=require(_0x57ea('0x5'))(_0x57ea('0x6'));var config=require(_0x57ea('0x7'));var jayson=require(_0x57ea('0x8'));var client=jayson[_0x57ea('0x9')]['http']({'port':0x232a});config[_0x57ea('0xa')]=_[_0x57ea('0xb')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0x57ea('0xc'))(new Redis(config[_0x57ea('0xa')]));require(_0x57ea('0xd'))[_0x57ea('0xe')](socket);function respondWithRpcPromise(_0x3b036c,_0x5609a3,_0x450a45){return new BPromise(function(_0x186a52,_0x1270dd){return client[_0x57ea('0xf')](_0x3b036c,_0x450a45)[_0x57ea('0x10')](function(_0x1fac90){logger[_0x57ea('0x11')](_0x57ea('0x12'),_0x5609a3,_0x57ea('0x13'));logger[_0x57ea('0x14')](_0x57ea('0x15'),_0x5609a3,_0x57ea('0x13'),JSON[_0x57ea('0x16')](_0x1fac90));if(_0x1fac90[_0x57ea('0x17')]){if(_0x1fac90[_0x57ea('0x17')][_0x57ea('0x18')]===0x1f4){logger[_0x57ea('0x17')]('UserVoiceQueueRt,\x20%s,\x20%s',_0x5609a3,_0x1fac90[_0x57ea('0x17')][_0x57ea('0x19')]);return _0x1270dd(_0x1fac90[_0x57ea('0x17')]['message']);}logger[_0x57ea('0x17')](_0x57ea('0x12'),_0x5609a3,_0x1fac90[_0x57ea('0x17')][_0x57ea('0x19')]);return _0x186a52(_0x1fac90[_0x57ea('0x17')]['message']);}else{logger[_0x57ea('0x11')]('UserVoiceQueueRt,\x20%s,\x20%s',_0x5609a3,_0x57ea('0x13'));_0x186a52(_0x1fac90[_0x57ea('0x1a')][_0x57ea('0x19')]);}})[_0x57ea('0x1b')](function(_0x508b17){logger[_0x57ea('0x17')]('UserVoiceQueueRt,\x20%s,\x20%s',_0x5609a3,_0x508b17);_0x1270dd(_0x508b17);});});}exports[_0x57ea('0x1c')]=function(_0x162563){var _0x1e392c=this;return new Promise(function(_0x495e7f,_0x3a1029){return db['UserVoiceQueueRt'][_0x57ea('0x1d')]({'raw':_0x162563[_0x57ea('0x1e')]?_0x162563[_0x57ea('0x1e')]['raw']===undefined?!![]:![]:!![],'where':_0x162563[_0x57ea('0x1e')]?_0x162563['options'][_0x57ea('0x1f')]||null:null,'attributes':[[db[_0x57ea('0x20')]['fn'](_0x57ea('0x21'),db[_0x57ea('0x20')]['fn']('IF',db[_0x57ea('0x20')]['literal']('`paused`\x20=\x201,\x201,\x20null'))),'outboundQueuePauses']]})[_0x57ea('0x10')](function(_0xb4e16e){logger[_0x57ea('0x11')](_0x57ea('0x1c'),_0x162563);logger['debug'](_0x57ea('0x1c'),_0x162563,JSON[_0x57ea('0x16')](_0xb4e16e));_0x495e7f(_0xb4e16e);})[_0x57ea('0x1b')](function(_0x1b9f85){logger[_0x57ea('0x17')](_0x57ea('0x1c'),_0x1b9f85['message'],_0x162563);_0x3a1029(_0x1e392c[_0x57ea('0x17')](0x1f4,_0x1b9f85[_0x57ea('0x19')]));});});}; \ No newline at end of file diff --git a/server/api/userVoiceQueueRt/userVoiceQueueRt.socket.js b/server/api/userVoiceQueueRt/userVoiceQueueRt.socket.js index 40fdb76..e8215c9 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 _0xdc99=['register','length','userVoiceQueueRt:','./userVoiceQueueRt.events','save','remove','update','emit','removeListener'];(function(_0x1eeeac,_0x3a313c){var _0x255d14=function(_0x3ea2e0){while(--_0x3ea2e0){_0x1eeeac['push'](_0x1eeeac['shift']());}};_0x255d14(++_0x3a313c);}(_0xdc99,0x8a));var _0x9dc9=function(_0x5948dd,_0x1f6ac8){_0x5948dd=_0x5948dd-0x0;var _0xb1f8be=_0xdc99[_0x5948dd];return _0xb1f8be;};'use strict';var UserVoiceQueueRtEvents=require(_0x9dc9('0x0'));var events=[_0x9dc9('0x1'),_0x9dc9('0x2'),_0x9dc9('0x3')];function createListener(_0x5d5dfe,_0x100c17){return function(_0x1b6d61){_0x100c17[_0x9dc9('0x4')](_0x5d5dfe,_0x1b6d61);};}function removeListener(_0xbcf336,_0x2de5d2){return function(){UserVoiceQueueRtEvents[_0x9dc9('0x5')](_0xbcf336,_0x2de5d2);};}exports[_0x9dc9('0x6')]=function(_0x39f780){for(var _0x21ec47=0x0,_0x100206=events[_0x9dc9('0x7')];_0x21ec47<_0x100206;_0x21ec47++){var _0xd897ef=events[_0x21ec47];var _0x526e3e=createListener(_0x9dc9('0x8')+_0xd897ef,_0x39f780);UserVoiceQueueRtEvents['on'](_0xd897ef,_0x526e3e);}}; \ No newline at end of file +var _0xde95=['removeListener','length','./userVoiceQueueRt.events','save','remove','update','emit'];(function(_0x14edb6,_0x40620e){var _0x1e7ad2=function(_0x1fb332){while(--_0x1fb332){_0x14edb6['push'](_0x14edb6['shift']());}};_0x1e7ad2(++_0x40620e);}(_0xde95,0x1de));var _0x5de9=function(_0x50aa2e,_0xfbd6f0){_0x50aa2e=_0x50aa2e-0x0;var _0x5e07f0=_0xde95[_0x50aa2e];return _0x5e07f0;};'use strict';var UserVoiceQueueRtEvents=require(_0x5de9('0x0'));var events=[_0x5de9('0x1'),_0x5de9('0x2'),_0x5de9('0x3')];function createListener(_0x1a3fdd,_0x1e38c5){return function(_0x53c6b9){_0x1e38c5[_0x5de9('0x4')](_0x1a3fdd,_0x53c6b9);};}function removeListener(_0x5435bc,_0x36d7e4){return function(){UserVoiceQueueRtEvents[_0x5de9('0x5')](_0x5435bc,_0x36d7e4);};}exports['register']=function(_0x4efab4){for(var _0x1a58ca=0x0,_0x352b10=events[_0x5de9('0x6')];_0x1a58ca<_0x352b10;_0x1a58ca++){var _0x1d6703=events[_0x1a58ca];var _0x28b44b=createListener('userVoiceQueueRt:'+_0x1d6703,_0x4efab4);UserVoiceQueueRtEvents['on'](_0x1d6703,_0x28b44b);}}; \ No newline at end of file diff --git a/server/api/userWhatsappQueue/index.js b/server/api/userWhatsappQueue/index.js index c71c35a..71333ef 100644 --- a/server/api/userWhatsappQueue/index.js +++ b/server/api/userWhatsappQueue/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x8eae=['Router','../../components/auth/service','../../components/interaction/service','../../config/environment','exports','multer','util','connect-timeout','express'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x8eae,0x1f4));var _0xe8ea=function(_0x559cd9,_0x161f8a){_0x559cd9=_0x559cd9-0x0;var _0x40ca25=_0x8eae[_0x559cd9];return _0x40ca25;};'use strict';var multer=require(_0xe8ea('0x0'));var util=require(_0xe8ea('0x1'));var path=require('path');var timeout=require(_0xe8ea('0x2'));var express=require(_0xe8ea('0x3'));var router=express[_0xe8ea('0x4')]();var auth=require(_0xe8ea('0x5'));var interaction=require(_0xe8ea('0x6'));var config=require(_0xe8ea('0x7'));module[_0xe8ea('0x8')]=router; \ No newline at end of file +var _0x7c83=['../../components/auth/service','../../components/interaction/service','../../config/environment','util','path','connect-timeout'];(function(_0x2bc3f4,_0x470b26){var _0x14ac53=function(_0x5121bd){while(--_0x5121bd){_0x2bc3f4['push'](_0x2bc3f4['shift']());}};_0x14ac53(++_0x470b26);}(_0x7c83,0x18f));var _0x37c8=function(_0x27c587,_0x2178bb){_0x27c587=_0x27c587-0x0;var _0x3f4a4a=_0x7c83[_0x27c587];return _0x3f4a4a;};'use strict';var multer=require('multer');var util=require(_0x37c8('0x0'));var path=require(_0x37c8('0x1'));var timeout=require(_0x37c8('0x2'));var express=require('express');var router=express['Router']();var auth=require(_0x37c8('0x3'));var interaction=require(_0x37c8('0x4'));var config=require(_0x37c8('0x5'));module['exports']=router; \ No newline at end of file diff --git a/server/api/userWhatsappQueue/userWhatsappQueue.attributes.js b/server/api/userWhatsappQueue/userWhatsappQueue.attributes.js index aa9a5d6..5791a0d 100644 --- a/server/api/userWhatsappQueue/userWhatsappQueue.attributes.js +++ b/server/api/userWhatsappQueue/userWhatsappQueue.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xbaf0=['exports','INTEGER'];(function(_0x52e363,_0x48062a){var _0x3fc2b5=function(_0x1b0cf9){while(--_0x1b0cf9){_0x52e363['push'](_0x52e363['shift']());}};_0x3fc2b5(++_0x48062a);}(_0xbaf0,0x12a));var _0x0baf=function(_0x4cf98e,_0xba4b79){_0x4cf98e=_0x4cf98e-0x0;var _0x1623ac=_0xbaf0[_0x4cf98e];return _0x1623ac;};'use strict';var Sequelize=require('sequelize');module[_0x0baf('0x0')]={'penalty':{'type':Sequelize[_0x0baf('0x1')],'defaultValue':0x0}}; \ No newline at end of file +var _0xd8b0=['exports','sequelize'];(function(_0x34643e,_0x272405){var _0x355adc=function(_0x31cc6c){while(--_0x31cc6c){_0x34643e['push'](_0x34643e['shift']());}};_0x355adc(++_0x272405);}(_0xd8b0,0xad));var _0x0d8b=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xd8b0[_0x20a584];return _0x4b41a8;};'use strict';var Sequelize=require(_0x0d8b('0x0'));module[_0x0d8b('0x1')]={'penalty':{'type':Sequelize['INTEGER'],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/userWhatsappQueue/userWhatsappQueue.model.js b/server/api/userWhatsappQueue/userWhatsappQueue.model.js index c340aca..f53e910 100644 --- a/server/api/userWhatsappQueue/userWhatsappQueue.model.js +++ b/server/api/userWhatsappQueue/userWhatsappQueue.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xef0f=['moment','request-promise','path','rimraf','./userWhatsappQueue.attributes','exports','define','UserWhatsappQueue','lodash','../../config/logger','api'];(function(_0x3d1260,_0x1277bb){var _0x18c14b=function(_0x2be496){while(--_0x2be496){_0x3d1260['push'](_0x3d1260['shift']());}};_0x18c14b(++_0x1277bb);}(_0xef0f,0x168));var _0xfef0=function(_0x237b23,_0x3e2b3a){_0x237b23=_0x237b23-0x0;var _0x35d102=_0xef0f[_0x237b23];return _0x35d102;};'use strict';var _=require(_0xfef0('0x0'));var util=require('util');var logger=require(_0xfef0('0x1'))(_0xfef0('0x2'));var moment=require(_0xfef0('0x3'));var BPromise=require('bluebird');var rp=require(_0xfef0('0x4'));var fs=require('fs');var path=require(_0xfef0('0x5'));var rimraf=require(_0xfef0('0x6'));var config=require('../../config/environment');var attributes=require(_0xfef0('0x7'));module[_0xfef0('0x8')]=function(_0x2697df,_0x315a8c){return _0x2697df[_0xfef0('0x9')](_0xfef0('0xa'),attributes,{'tableName':'user_has_whatsapp_queues','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x1399=['UserWhatsappQueue','lodash','util','api','bluebird','request-promise','path','rimraf','../../config/environment','./userWhatsappQueue.attributes','define'];(function(_0x1dfb05,_0x6ba45a){var _0x4b82a5=function(_0x343e5a){while(--_0x343e5a){_0x1dfb05['push'](_0x1dfb05['shift']());}};_0x4b82a5(++_0x6ba45a);}(_0x1399,0x16c));var _0x9139=function(_0x3b4861,_0x59d989){_0x3b4861=_0x3b4861-0x0;var _0x4c5b77=_0x1399[_0x3b4861];return _0x4c5b77;};'use strict';var _=require(_0x9139('0x0'));var util=require(_0x9139('0x1'));var logger=require('../../config/logger')(_0x9139('0x2'));var moment=require('moment');var BPromise=require(_0x9139('0x3'));var rp=require(_0x9139('0x4'));var fs=require('fs');var path=require(_0x9139('0x5'));var rimraf=require(_0x9139('0x6'));var config=require(_0x9139('0x7'));var attributes=require(_0x9139('0x8'));module['exports']=function(_0x54af2d,_0x8f086b){return _0x54af2d[_0x9139('0x9')](_0x9139('0xa'),attributes,{'tableName':'user_has_whatsapp_queues','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/userWhatsappQueue/userWhatsappQueue.rpc.js b/server/api/userWhatsappQueue/userWhatsappQueue.rpc.js index 9c4fc1d..a98d4eb 100644 --- a/server/api/userWhatsappQueue/userWhatsappQueue.rpc.js +++ b/server/api/userWhatsappQueue/userWhatsappQueue.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa9e0=['http','info','UserWhatsappQueue,\x20%s,\x20%s','request\x20sent','debug','UserWhatsappQueue,\x20%s,\x20%s,\x20%s','code','error','message','result','catch','lodash','util','moment','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise'];(function(_0x1dd144,_0x35e337){var _0xba7052=function(_0x54993d){while(--_0x54993d){_0x1dd144['push'](_0x1dd144['shift']());}};_0xba7052(++_0x35e337);}(_0xa9e0,0x123));var _0x0a9e=function(_0x2dafbe,_0x5d04de){_0x2dafbe=_0x2dafbe-0x0;var _0x58a45a=_0xa9e0[_0x2dafbe];return _0x58a45a;};'use strict';var _=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var moment=require(_0x0a9e('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x0a9e('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x0a9e('0x4'));var logger=require(_0x0a9e('0x5'))(_0x0a9e('0x6'));var config=require(_0x0a9e('0x7'));var jayson=require(_0x0a9e('0x8'));var client=jayson['client'][_0x0a9e('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x441e3a,_0x2cc193,_0x5f41ea){return new BPromise(function(_0x503809,_0xe42b77){return client['request'](_0x441e3a,_0x5f41ea)['then'](function(_0x39753a){logger[_0x0a9e('0xa')](_0x0a9e('0xb'),_0x2cc193,_0x0a9e('0xc'));logger[_0x0a9e('0xd')](_0x0a9e('0xe'),_0x2cc193,'request\x20sent',JSON['stringify'](_0x39753a));if(_0x39753a['error']){if(_0x39753a['error'][_0x0a9e('0xf')]===0x1f4){logger[_0x0a9e('0x10')](_0x0a9e('0xb'),_0x2cc193,_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);return _0xe42b77(_0x39753a[_0x0a9e('0x10')]['message']);}logger[_0x0a9e('0x10')](_0x0a9e('0xb'),_0x2cc193,_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);return _0x503809(_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);}else{logger['info'](_0x0a9e('0xb'),_0x2cc193,'request\x20sent');_0x503809(_0x39753a[_0x0a9e('0x12')]['message']);}})[_0x0a9e('0x13')](function(_0x12066b){logger['error'](_0x0a9e('0xb'),_0x2cc193,_0x12066b);_0xe42b77(_0x12066b);});});} \ No newline at end of file +var _0xa9e0=['http','info','UserWhatsappQueue,\x20%s,\x20%s','request\x20sent','debug','UserWhatsappQueue,\x20%s,\x20%s,\x20%s','code','error','message','result','catch','lodash','util','moment','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise'];(function(_0x212823,_0x2c4eb4){var _0x516fb0=function(_0x55702f){while(--_0x55702f){_0x212823['push'](_0x212823['shift']());}};_0x516fb0(++_0x2c4eb4);}(_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/variable/index.js b/server/api/variable/index.js index 384e82d..584fae4 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 _0x5443=['create','/:id','update','delete','destroy','util','path','connect-timeout','express','Router','../../components/auth/service','../../config/environment','./variable.controller','get','isAuthenticated','index','show','post'];(function(_0x53a6c0,_0x53df9a){var _0x30c452=function(_0x34f3ed){while(--_0x34f3ed){_0x53a6c0['push'](_0x53a6c0['shift']());}};_0x30c452(++_0x53df9a);}(_0x5443,0x15b));var _0x3544=function(_0x57b54c,_0x54ce0d){_0x57b54c=_0x57b54c-0x0;var _0x59cc19=_0x5443[_0x57b54c];return _0x59cc19;};'use strict';var multer=require('multer');var util=require(_0x3544('0x0'));var path=require(_0x3544('0x1'));var timeout=require(_0x3544('0x2'));var express=require(_0x3544('0x3'));var router=express[_0x3544('0x4')]();var auth=require(_0x3544('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x3544('0x6'));var controller=require(_0x3544('0x7'));router[_0x3544('0x8')]('/',auth[_0x3544('0x9')](),controller[_0x3544('0xa')]);router[_0x3544('0x8')]('/:id',auth[_0x3544('0x9')](),controller[_0x3544('0xb')]);router[_0x3544('0xc')]('/',auth[_0x3544('0x9')](),controller[_0x3544('0xd')]);router['put'](_0x3544('0xe'),auth[_0x3544('0x9')](),controller[_0x3544('0xf')]);router[_0x3544('0x10')](_0x3544('0xe'),auth[_0x3544('0x9')](),controller[_0x3544('0x11')]);module['exports']=router; \ No newline at end of file +var _0x187c=['get','isAuthenticated','index','/:id','post','create','exports','path','connect-timeout','express','Router','../../config/environment'];(function(_0x29fe13,_0x3cd65e){var _0x37bc9d=function(_0x9591c3){while(--_0x9591c3){_0x29fe13['push'](_0x29fe13['shift']());}};_0x37bc9d(++_0x3cd65e);}(_0x187c,0x157));var _0xc187=function(_0x1ac42e,_0x537abe){_0x1ac42e=_0x1ac42e-0x0;var _0x1c32e7=_0x187c[_0x1ac42e];return _0x1c32e7;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0xc187('0x0'));var timeout=require(_0xc187('0x1'));var express=require(_0xc187('0x2'));var router=express[_0xc187('0x3')]();var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0xc187('0x4'));var controller=require('./variable.controller');router[_0xc187('0x5')]('/',auth[_0xc187('0x6')](),controller[_0xc187('0x7')]);router[_0xc187('0x5')](_0xc187('0x8'),auth['isAuthenticated'](),controller['show']);router[_0xc187('0x9')]('/',auth[_0xc187('0x6')](),controller[_0xc187('0xa')]);router['put'](_0xc187('0x8'),auth[_0xc187('0x6')](),controller['update']);router['delete'](_0xc187('0x8'),auth[_0xc187('0x6')](),controller['destroy']);module[_0xc187('0xb')]=router; \ No newline at end of file diff --git a/server/api/variable/variable.attributes.js b/server/api/variable/variable.attributes.js index dfe9ac8..74ce705 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 _0x8100=['exports','STRING','name','sequelize'];(function(_0x19950b,_0x53d0d7){var _0x3c6b41=function(_0x3924ad){while(--_0x3924ad){_0x19950b['push'](_0x19950b['shift']());}};_0x3c6b41(++_0x53d0d7);}(_0x8100,0x8b));var _0x0810=function(_0x8f5bc4,_0x36c4){_0x8f5bc4=_0x8f5bc4-0x0;var _0x569e19=_0x8100[_0x8f5bc4];return _0x569e19;};'use strict';var Sequelize=require(_0x0810('0x0'));module[_0x0810('0x1')]={'name':{'type':Sequelize[_0x0810('0x2')],'unique':_0x0810('0x3'),'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize[_0x0810('0x2')]}}; \ No newline at end of file +var _0x755c=['STRING','name','sequelize','exports'];(function(_0x40b498,_0x2458af){var _0x4ef847=function(_0x2a3df4){while(--_0x2a3df4){_0x40b498['push'](_0x40b498['shift']());}};_0x4ef847(++_0x2458af);}(_0x755c,0xd6));var _0xc755=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x755c[_0x20a584];return _0x4b41a8;};'use strict';var Sequelize=require(_0xc755('0x0'));module[_0xc755('0x1')]={'name':{'type':Sequelize[_0xc755('0x2')],'unique':_0xc755('0x3'),'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize[_0xc755('0x2')]}}; \ No newline at end of file diff --git a/server/api/variable/variable.controller.js b/server/api/variable/variable.controller.js index 00e8e23..b63e1fe 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 _0x2159=['reject','update','then','get','Variables','UserProfileResource','destroy','end','sendStatus','error','stack','name','send','index','Variable','key','model','query','keys','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','pick','filter','where','merge','map','type','options','includeAll','include','findAll','rows','catch','params','rawAttributes','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','html-pdf','eml-format','rimraf','zip-dir','request-promise','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/environment','../../mysqldb','status','json','count','offset','limit','Content-Range','apply'];(function(_0x42629b,_0x479886){var _0x3e3da3=function(_0x2fcc48){while(--_0x2fcc48){_0x42629b['push'](_0x42629b['shift']());}};_0x3e3da3(++_0x479886);}(_0x2159,0x17f));var _0x9215=function(_0x3780c6,_0x126a4d){_0x3780c6=_0x3780c6-0x0;var _0xa2eae5=_0x2159[_0x3780c6];return _0xa2eae5;};'use strict';var pdf=require(_0x9215('0x0'));var emlformat=require(_0x9215('0x1'));var rimraf=require(_0x9215('0x2'));var zipdir=require(_0x9215('0x3'));var jsonpatch=require('fast-json-patch');var rp=require(_0x9215('0x4'));var moment=require('moment');var BPromise=require(_0x9215('0x5'));var Mustache=require(_0x9215('0x6'));var util=require(_0x9215('0x7'));var path=require(_0x9215('0x8'));var sox=require(_0x9215('0x9'));var csv=require(_0x9215('0xa'));var ejs=require(_0x9215('0xb'));var fs=require('fs');var _=require(_0x9215('0xc'));var squel=require('squel');var crypto=require(_0x9215('0xd'));var jsforce=require(_0x9215('0xe'));var deskjs=require(_0x9215('0xf'));var toCsv=require(_0x9215('0xa'));var querystring=require(_0x9215('0x10'));var Papa=require('papaparse');var Redis=require(_0x9215('0x11'));var authService=require(_0x9215('0x12'));var qs=require(_0x9215('0x13'));var as=require(_0x9215('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x9215('0x15'))(_0x9215('0x16'));var utils=require('../../config/utils');var config=require(_0x9215('0x17'));var db=require(_0x9215('0x18'))['db'];function respondWithStatusCode(_0x4e9010,_0x43b660){_0x43b660=_0x43b660||0xcc;return function(_0x10b08f){if(_0x10b08f){return _0x4e9010['sendStatus'](_0x43b660);}return _0x4e9010[_0x9215('0x19')](_0x43b660)['end']();};}function respondWithResult(_0x2db623,_0x5124b9){_0x5124b9=_0x5124b9||0xc8;return function(_0x1d65f4){if(_0x1d65f4){return _0x2db623[_0x9215('0x19')](_0x5124b9)[_0x9215('0x1a')](_0x1d65f4);}};}function respondWithFilteredResult(_0xd01ff9,_0x4826bb){return function(_0x3f44d3){if(_0x3f44d3){var _0x40b41f=_0x3f44d3[_0x9215('0x1b')],_0x4c5ab5=_0x4826bb[_0x9215('0x1c')],_0x309818=_0x4826bb[_0x9215('0x1c')]+_0x4826bb[_0x9215('0x1d')],_0x1cfb1e;if(_0x309818>=_0x40b41f){_0x309818=_0x40b41f;_0x1cfb1e=0xc8;}else{_0x1cfb1e=0xce;}_0xd01ff9[_0x9215('0x19')](_0x1cfb1e);return _0xd01ff9['set'](_0x9215('0x1e'),_0x4c5ab5+'-'+_0x309818+'/'+_0x40b41f)[_0x9215('0x1a')](_0x3f44d3);}return null;};}function patchUpdates(_0x32b658){return function(_0x18565e){try{jsonpatch[_0x9215('0x1f')](_0x18565e,_0x32b658,!![]);}catch(_0x3ec823){return BPromise[_0x9215('0x20')](_0x3ec823);}return _0x18565e['save']();};}function saveUpdates(_0x5b8aac,_0x5bc65b){return function(_0x2fd6dd){if(_0x2fd6dd){return _0x2fd6dd[_0x9215('0x21')](_0x5b8aac)['then'](function(_0x21fb81){return _0x21fb81;});}return null;};}function removeEntity(_0x223383,_0xa58f48){return function(_0x311cfb){if(_0x311cfb){return _0x311cfb['destroy']()[_0x9215('0x22')](function(){var _0x306bf2=_0x311cfb[_0x9215('0x23')]({'plain':!![]});var _0x240d25=_0x9215('0x24');return db[_0x9215('0x25')][_0x9215('0x26')]({'where':{'type':_0x240d25,'resourceId':_0x306bf2['id']}})[_0x9215('0x22')](function(){return _0x311cfb;});})[_0x9215('0x22')](function(){_0x223383[_0x9215('0x19')](0xcc)[_0x9215('0x27')]();});}};}function handleEntityNotFound(_0x4cdf58,_0x34092e){return function(_0x2c3196){if(!_0x2c3196){_0x4cdf58[_0x9215('0x28')](0x194);}return _0x2c3196;};}function handleError(_0x58e078,_0x31c03a){_0x31c03a=_0x31c03a||0x1f4;return function(_0x13f1b2){logger[_0x9215('0x29')](_0x13f1b2[_0x9215('0x2a')]);if(_0x13f1b2[_0x9215('0x2b')]){delete _0x13f1b2[_0x9215('0x2b')];}_0x58e078['status'](_0x31c03a)[_0x9215('0x2c')](_0x13f1b2);};}exports[_0x9215('0x2d')]=function(_0x3e2c32,_0x1775bc){var _0x4bf140={},_0x1c38eb={},_0x540232={'count':0x0,'rows':[]};var _0x1fb43a=_['map'](db[_0x9215('0x2e')]['rawAttributes'],function(_0x38046d){return{'name':_0x38046d['fieldName'],'type':_0x38046d['type'][_0x9215('0x2f')]};});_0x1c38eb[_0x9215('0x30')]=_['map'](_0x1fb43a,'name');_0x1c38eb[_0x9215('0x31')]=_[_0x9215('0x32')](_0x3e2c32[_0x9215('0x31')]);_0x1c38eb[_0x9215('0x33')]=_['intersection'](_0x1c38eb['model'],_0x1c38eb[_0x9215('0x31')]);_0x4bf140[_0x9215('0x34')]=_[_0x9215('0x35')](_0x1c38eb[_0x9215('0x30')],qs[_0x9215('0x36')](_0x3e2c32[_0x9215('0x31')][_0x9215('0x36')]));_0x4bf140['attributes']=_0x4bf140['attributes'][_0x9215('0x37')]?_0x4bf140[_0x9215('0x34')]:_0x1c38eb[_0x9215('0x30')];if(!_0x3e2c32['query'][_0x9215('0x38')](_0x9215('0x39'))){_0x4bf140['limit']=qs[_0x9215('0x1d')](_0x3e2c32[_0x9215('0x31')][_0x9215('0x1d')]);_0x4bf140[_0x9215('0x1c')]=qs['offset'](_0x3e2c32['query'][_0x9215('0x1c')]);}_0x4bf140[_0x9215('0x3a')]=qs['sort'](_0x3e2c32['query'][_0x9215('0x3b')]);_0x4bf140['where']=qs['filters'](_[_0x9215('0x3c')](_0x3e2c32[_0x9215('0x31')],_0x1c38eb[_0x9215('0x33')]));if(_0x3e2c32[_0x9215('0x31')][_0x9215('0x3d')]){_0x4bf140[_0x9215('0x3e')]=_[_0x9215('0x3f')](_0x4bf140[_0x9215('0x3e')],{'$or':_[_0x9215('0x40')](_0x1fb43a,function(_0x4f3bcf){if(_0x4f3bcf[_0x9215('0x41')]!=='VIRTUAL'){var _0x198181={};_0x198181[_0x4f3bcf[_0x9215('0x2b')]]={'$like':'%'+_0x3e2c32['query'][_0x9215('0x3d')]+'%'};return _0x198181;}})});}_0x4bf140=_['merge']({},_0x4bf140,_0x3e2c32[_0x9215('0x42')]);var _0x20fe94={'where':_0x4bf140[_0x9215('0x3e')]};return db[_0x9215('0x2e')]['count'](_0x20fe94)['then'](function(_0x4b19ef){_0x540232[_0x9215('0x1b')]=_0x4b19ef;if(_0x3e2c32[_0x9215('0x31')][_0x9215('0x43')]){_0x4bf140[_0x9215('0x44')]=[{'all':!![]}];}return db[_0x9215('0x2e')][_0x9215('0x45')](_0x4bf140);})[_0x9215('0x22')](function(_0x206123){_0x540232[_0x9215('0x46')]=_0x206123;return _0x540232;})[_0x9215('0x22')](respondWithFilteredResult(_0x1775bc,_0x4bf140))[_0x9215('0x47')](handleError(_0x1775bc,null));};exports['show']=function(_0x1ea7f0,_0xbe18f){var _0x1e6a6={'raw':!![],'where':{'id':_0x1ea7f0[_0x9215('0x48')]['id']}},_0x556ea6={};_0x556ea6[_0x9215('0x30')]=_['keys'](db['Variable'][_0x9215('0x49')]);_0x556ea6['query']=_[_0x9215('0x32')](_0x1ea7f0[_0x9215('0x31')]);_0x556ea6[_0x9215('0x33')]=_[_0x9215('0x35')](_0x556ea6['model'],_0x556ea6[_0x9215('0x31')]);_0x1e6a6['attributes']=_['intersection'](_0x556ea6[_0x9215('0x30')],qs[_0x9215('0x36')](_0x1ea7f0[_0x9215('0x31')]['fields']));_0x1e6a6[_0x9215('0x34')]=_0x1e6a6[_0x9215('0x34')]['length']?_0x1e6a6[_0x9215('0x34')]:_0x556ea6['model'];if(_0x1ea7f0[_0x9215('0x31')][_0x9215('0x43')]){_0x1e6a6['include']=[{'all':!![]}];}_0x1e6a6=_['merge']({},_0x1e6a6,_0x1ea7f0[_0x9215('0x42')]);return db['Variable'][_0x9215('0x4a')](_0x1e6a6)[_0x9215('0x22')](handleEntityNotFound(_0xbe18f,null))[_0x9215('0x22')](respondWithResult(_0xbe18f,null))['catch'](handleError(_0xbe18f,null));};exports[_0x9215('0x4b')]=function(_0x1b789e,_0x430cb4){return db[_0x9215('0x2e')][_0x9215('0x4b')](_0x1b789e[_0x9215('0x4c')],{})['then'](function(_0x59f8d7){var _0x3e7d2c=_0x1b789e[_0x9215('0x4d')]['get']({'plain':!![]});if(!_0x3e7d2c)throw new Error(_0x9215('0x4e'));if(_0x3e7d2c['role']===_0x9215('0x4d')){var _0x56c7fe=_0x59f8d7[_0x9215('0x23')]({'plain':!![]});var _0x24234d='Variables';return db[_0x9215('0x4f')][_0x9215('0x4a')]({'where':{'name':_0x24234d,'userProfileId':_0x3e7d2c[_0x9215('0x50')]},'raw':!![]})[_0x9215('0x22')](function(_0x2d9ea9){if(_0x2d9ea9&&_0x2d9ea9[_0x9215('0x51')]===0x0){return db[_0x9215('0x25')][_0x9215('0x4b')]({'name':_0x56c7fe[_0x9215('0x2b')],'resourceId':_0x56c7fe['id'],'type':_0x2d9ea9[_0x9215('0x2b')],'sectionId':_0x2d9ea9['id']},{})[_0x9215('0x22')](function(){return _0x59f8d7;});}else{return _0x59f8d7;}})[_0x9215('0x47')](function(_0x2e4c91){logger[_0x9215('0x29')](_0x9215('0x52'),_0x2e4c91);throw _0x2e4c91;});}return _0x59f8d7;})[_0x9215('0x22')](respondWithResult(_0x430cb4,0xc9))[_0x9215('0x47')](handleError(_0x430cb4,null));};exports[_0x9215('0x21')]=function(_0x2f66b4,_0x523b30){if(_0x2f66b4['body']['id']){delete _0x2f66b4['body']['id'];}return db[_0x9215('0x2e')][_0x9215('0x4a')]({'where':{'id':_0x2f66b4[_0x9215('0x48')]['id']}})['then'](handleEntityNotFound(_0x523b30,null))[_0x9215('0x22')](saveUpdates(_0x2f66b4[_0x9215('0x4c')],null))[_0x9215('0x22')](respondWithResult(_0x523b30,null))[_0x9215('0x47')](handleError(_0x523b30,null));};exports[_0x9215('0x26')]=function(_0x152132,_0x37a4d9){return db[_0x9215('0x2e')][_0x9215('0x4a')]({'where':{'id':_0x152132[_0x9215('0x48')]['id']}})[_0x9215('0x22')](handleEntityNotFound(_0x37a4d9,null))[_0x9215('0x22')](removeEntity(_0x37a4d9,null))[_0x9215('0x47')](handleError(_0x37a4d9,null));}; \ No newline at end of file +var _0x1ec4=['to-csv','ejs','lodash','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','sendStatus','status','end','json','count','offset','limit','set','Content-Range','save','update','then','destroy','get','Variables','UserProfileResource','error','stack','name','send','map','Variable','fieldName','type','key','model','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','pick','merge','where','VIRTUAL','filter','includeAll','include','findAll','show','params','rawAttributes','find','catch','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','html-pdf','eml-format','rimraf','fast-json-patch','request-promise','bluebird','mustache','util','path','sox'];(function(_0x5aece4,_0x51db76){var _0x42ec41=function(_0x25668d){while(--_0x25668d){_0x5aece4['push'](_0x5aece4['shift']());}};_0x42ec41(++_0x51db76);}(_0x1ec4,0xef));var _0x41ec=function(_0x5259a7,_0x2dde3b){_0x5259a7=_0x5259a7-0x0;var _0x5884fa=_0x1ec4[_0x5259a7];return _0x5884fa;};'use strict';var pdf=require(_0x41ec('0x0'));var emlformat=require(_0x41ec('0x1'));var rimraf=require(_0x41ec('0x2'));var zipdir=require('zip-dir');var jsonpatch=require(_0x41ec('0x3'));var rp=require(_0x41ec('0x4'));var moment=require('moment');var BPromise=require(_0x41ec('0x5'));var Mustache=require(_0x41ec('0x6'));var util=require(_0x41ec('0x7'));var path=require(_0x41ec('0x8'));var sox=require(_0x41ec('0x9'));var csv=require(_0x41ec('0xa'));var ejs=require(_0x41ec('0xb'));var fs=require('fs');var _=require(_0x41ec('0xc'));var squel=require('squel');var crypto=require(_0x41ec('0xd'));var jsforce=require(_0x41ec('0xe'));var deskjs=require('desk.js');var toCsv=require(_0x41ec('0xa'));var querystring=require(_0x41ec('0xf'));var Papa=require(_0x41ec('0x10'));var Redis=require(_0x41ec('0x11'));var authService=require(_0x41ec('0x12'));var qs=require(_0x41ec('0x13'));var as=require(_0x41ec('0x14'));var hardwareService=require(_0x41ec('0x15'));var logger=require(_0x41ec('0x16'))(_0x41ec('0x17'));var utils=require(_0x41ec('0x18'));var config=require(_0x41ec('0x19'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x2d9771,_0x5c4e37){_0x5c4e37=_0x5c4e37||0xcc;return function(_0x11daaa){if(_0x11daaa){return _0x2d9771[_0x41ec('0x1a')](_0x5c4e37);}return _0x2d9771[_0x41ec('0x1b')](_0x5c4e37)[_0x41ec('0x1c')]();};}function respondWithResult(_0x3c029a,_0x222a6){_0x222a6=_0x222a6||0xc8;return function(_0xb3e4b6){if(_0xb3e4b6){return _0x3c029a[_0x41ec('0x1b')](_0x222a6)[_0x41ec('0x1d')](_0xb3e4b6);}};}function respondWithFilteredResult(_0x492dfe,_0x176752){return function(_0x47758d){if(_0x47758d){var _0x353cac=_0x47758d[_0x41ec('0x1e')],_0x96df6f=_0x176752[_0x41ec('0x1f')],_0xf872d9=_0x176752[_0x41ec('0x1f')]+_0x176752[_0x41ec('0x20')],_0x67c8bb;if(_0xf872d9>=_0x353cac){_0xf872d9=_0x353cac;_0x67c8bb=0xc8;}else{_0x67c8bb=0xce;}_0x492dfe['status'](_0x67c8bb);return _0x492dfe[_0x41ec('0x21')](_0x41ec('0x22'),_0x96df6f+'-'+_0xf872d9+'/'+_0x353cac)[_0x41ec('0x1d')](_0x47758d);}return null;};}function patchUpdates(_0x16a570){return function(_0x736b0a){try{jsonpatch['apply'](_0x736b0a,_0x16a570,!![]);}catch(_0x12c580){return BPromise['reject'](_0x12c580);}return _0x736b0a[_0x41ec('0x23')]();};}function saveUpdates(_0xa30703,_0x5a8dc8){return function(_0x15c5e2){if(_0x15c5e2){return _0x15c5e2[_0x41ec('0x24')](_0xa30703)[_0x41ec('0x25')](function(_0x2e10b5){return _0x2e10b5;});}return null;};}function removeEntity(_0x323a04,_0x10a2a0){return function(_0x5bda5a){if(_0x5bda5a){return _0x5bda5a[_0x41ec('0x26')]()[_0x41ec('0x25')](function(){var _0x534415=_0x5bda5a[_0x41ec('0x27')]({'plain':!![]});var _0x308e64=_0x41ec('0x28');return db[_0x41ec('0x29')]['destroy']({'where':{'type':_0x308e64,'resourceId':_0x534415['id']}})[_0x41ec('0x25')](function(){return _0x5bda5a;});})['then'](function(){_0x323a04[_0x41ec('0x1b')](0xcc)[_0x41ec('0x1c')]();});}};}function handleEntityNotFound(_0x29a2d2,_0x4666fc){return function(_0x4aec4c){if(!_0x4aec4c){_0x29a2d2[_0x41ec('0x1a')](0x194);}return _0x4aec4c;};}function handleError(_0x37ec7d,_0x47aa83){_0x47aa83=_0x47aa83||0x1f4;return function(_0x1bc7ff){logger[_0x41ec('0x2a')](_0x1bc7ff[_0x41ec('0x2b')]);if(_0x1bc7ff[_0x41ec('0x2c')]){delete _0x1bc7ff[_0x41ec('0x2c')];}_0x37ec7d[_0x41ec('0x1b')](_0x47aa83)[_0x41ec('0x2d')](_0x1bc7ff);};}exports['index']=function(_0x4ea335,_0x2ab7c8){var _0x18e14f={},_0x1b57f9={},_0x60b0f7={'count':0x0,'rows':[]};var _0x59d9f1=_[_0x41ec('0x2e')](db[_0x41ec('0x2f')]['rawAttributes'],function(_0x46b105){return{'name':_0x46b105[_0x41ec('0x30')],'type':_0x46b105[_0x41ec('0x31')][_0x41ec('0x32')]};});_0x1b57f9[_0x41ec('0x33')]=_['map'](_0x59d9f1,_0x41ec('0x2c'));_0x1b57f9['query']=_[_0x41ec('0x34')](_0x4ea335[_0x41ec('0x35')]);_0x1b57f9[_0x41ec('0x36')]=_[_0x41ec('0x37')](_0x1b57f9[_0x41ec('0x33')],_0x1b57f9['query']);_0x18e14f[_0x41ec('0x38')]=_['intersection'](_0x1b57f9[_0x41ec('0x33')],qs[_0x41ec('0x39')](_0x4ea335[_0x41ec('0x35')][_0x41ec('0x39')]));_0x18e14f[_0x41ec('0x38')]=_0x18e14f[_0x41ec('0x38')][_0x41ec('0x3a')]?_0x18e14f[_0x41ec('0x38')]:_0x1b57f9[_0x41ec('0x33')];if(!_0x4ea335[_0x41ec('0x35')][_0x41ec('0x3b')](_0x41ec('0x3c'))){_0x18e14f[_0x41ec('0x20')]=qs['limit'](_0x4ea335[_0x41ec('0x35')]['limit']);_0x18e14f['offset']=qs[_0x41ec('0x1f')](_0x4ea335[_0x41ec('0x35')][_0x41ec('0x1f')]);}_0x18e14f['order']=qs['sort'](_0x4ea335[_0x41ec('0x35')]['sort']);_0x18e14f['where']=qs[_0x41ec('0x36')](_[_0x41ec('0x3d')](_0x4ea335[_0x41ec('0x35')],_0x1b57f9[_0x41ec('0x36')]));if(_0x4ea335['query']['filter']){_0x18e14f['where']=_[_0x41ec('0x3e')](_0x18e14f[_0x41ec('0x3f')],{'$or':_[_0x41ec('0x2e')](_0x59d9f1,function(_0x3ff2b5){if(_0x3ff2b5[_0x41ec('0x31')]!==_0x41ec('0x40')){var _0x2b6fa0={};_0x2b6fa0[_0x3ff2b5['name']]={'$like':'%'+_0x4ea335[_0x41ec('0x35')][_0x41ec('0x41')]+'%'};return _0x2b6fa0;}})});}_0x18e14f=_[_0x41ec('0x3e')]({},_0x18e14f,_0x4ea335['options']);var _0xd677be={'where':_0x18e14f[_0x41ec('0x3f')]};return db[_0x41ec('0x2f')][_0x41ec('0x1e')](_0xd677be)['then'](function(_0x4c9e78){_0x60b0f7['count']=_0x4c9e78;if(_0x4ea335[_0x41ec('0x35')][_0x41ec('0x42')]){_0x18e14f[_0x41ec('0x43')]=[{'all':!![]}];}return db[_0x41ec('0x2f')][_0x41ec('0x44')](_0x18e14f);})['then'](function(_0x42ac4e){_0x60b0f7['rows']=_0x42ac4e;return _0x60b0f7;})[_0x41ec('0x25')](respondWithFilteredResult(_0x2ab7c8,_0x18e14f))['catch'](handleError(_0x2ab7c8,null));};exports[_0x41ec('0x45')]=function(_0x29eeb0,_0x3acd2a){var _0x541304={'raw':!![],'where':{'id':_0x29eeb0[_0x41ec('0x46')]['id']}},_0x34c5f6={};_0x34c5f6['model']=_[_0x41ec('0x34')](db[_0x41ec('0x2f')][_0x41ec('0x47')]);_0x34c5f6['query']=_['keys'](_0x29eeb0[_0x41ec('0x35')]);_0x34c5f6[_0x41ec('0x36')]=_[_0x41ec('0x37')](_0x34c5f6[_0x41ec('0x33')],_0x34c5f6[_0x41ec('0x35')]);_0x541304[_0x41ec('0x38')]=_[_0x41ec('0x37')](_0x34c5f6[_0x41ec('0x33')],qs[_0x41ec('0x39')](_0x29eeb0['query'][_0x41ec('0x39')]));_0x541304[_0x41ec('0x38')]=_0x541304[_0x41ec('0x38')][_0x41ec('0x3a')]?_0x541304[_0x41ec('0x38')]:_0x34c5f6[_0x41ec('0x33')];if(_0x29eeb0[_0x41ec('0x35')][_0x41ec('0x42')]){_0x541304[_0x41ec('0x43')]=[{'all':!![]}];}_0x541304=_[_0x41ec('0x3e')]({},_0x541304,_0x29eeb0['options']);return db[_0x41ec('0x2f')][_0x41ec('0x48')](_0x541304)[_0x41ec('0x25')](handleEntityNotFound(_0x3acd2a,null))['then'](respondWithResult(_0x3acd2a,null))[_0x41ec('0x49')](handleError(_0x3acd2a,null));};exports['create']=function(_0x13618f,_0x2879b5){return db['Variable'][_0x41ec('0x4a')](_0x13618f[_0x41ec('0x4b')],{})[_0x41ec('0x25')](function(_0x2c4ac8){var _0x2ff997=_0x13618f[_0x41ec('0x4c')][_0x41ec('0x27')]({'plain':!![]});if(!_0x2ff997)throw new Error(_0x41ec('0x4d'));if(_0x2ff997[_0x41ec('0x4e')]===_0x41ec('0x4c')){var _0x3afa5f=_0x2c4ac8[_0x41ec('0x27')]({'plain':!![]});var _0x5a8c3f=_0x41ec('0x28');return db[_0x41ec('0x4f')][_0x41ec('0x48')]({'where':{'name':_0x5a8c3f,'userProfileId':_0x2ff997[_0x41ec('0x50')]},'raw':!![]})[_0x41ec('0x25')](function(_0x43a6f9){if(_0x43a6f9&&_0x43a6f9[_0x41ec('0x51')]===0x0){return db[_0x41ec('0x29')][_0x41ec('0x4a')]({'name':_0x3afa5f['name'],'resourceId':_0x3afa5f['id'],'type':_0x43a6f9[_0x41ec('0x2c')],'sectionId':_0x43a6f9['id']},{})[_0x41ec('0x25')](function(){return _0x2c4ac8;});}else{return _0x2c4ac8;}})[_0x41ec('0x49')](function(_0x44bf6e){logger[_0x41ec('0x2a')](_0x41ec('0x52'),_0x44bf6e);throw _0x44bf6e;});}return _0x2c4ac8;})[_0x41ec('0x25')](respondWithResult(_0x2879b5,0xc9))[_0x41ec('0x49')](handleError(_0x2879b5,null));};exports[_0x41ec('0x24')]=function(_0x277c42,_0x1a332a){if(_0x277c42['body']['id']){delete _0x277c42['body']['id'];}return db[_0x41ec('0x2f')][_0x41ec('0x48')]({'where':{'id':_0x277c42[_0x41ec('0x46')]['id']}})[_0x41ec('0x25')](handleEntityNotFound(_0x1a332a,null))[_0x41ec('0x25')](saveUpdates(_0x277c42[_0x41ec('0x4b')],null))[_0x41ec('0x25')](respondWithResult(_0x1a332a,null))['catch'](handleError(_0x1a332a,null));};exports['destroy']=function(_0x36c52a,_0x70def3){return db['Variable'][_0x41ec('0x48')]({'where':{'id':_0x36c52a[_0x41ec('0x46')]['id']}})[_0x41ec('0x25')](handleEntityNotFound(_0x70def3,null))[_0x41ec('0x25')](removeEntity(_0x70def3,null))[_0x41ec('0x49')](handleError(_0x70def3,null));}; \ No newline at end of file diff --git a/server/api/variable/variable.model.js b/server/api/variable/variable.model.js index 55045e8..3bfa970 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 _0x0f50=['api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./variable.attributes','exports','define','Variable','tools_variables','lodash','util','../../config/logger'];(function(_0x211fef,_0x4ab716){var _0x5447bf=function(_0x306ea3){while(--_0x306ea3){_0x211fef['push'](_0x211fef['shift']());}};_0x5447bf(++_0x4ab716);}(_0x0f50,0x1ce));var _0x00f5=function(_0x4d8d33,_0x16157e){_0x4d8d33=_0x4d8d33-0x0;var _0x17c3f3=_0x0f50[_0x4d8d33];return _0x17c3f3;};'use strict';var _=require(_0x00f5('0x0'));var util=require(_0x00f5('0x1'));var logger=require(_0x00f5('0x2'))(_0x00f5('0x3'));var moment=require(_0x00f5('0x4'));var BPromise=require(_0x00f5('0x5'));var rp=require(_0x00f5('0x6'));var fs=require('fs');var path=require(_0x00f5('0x7'));var rimraf=require(_0x00f5('0x8'));var config=require(_0x00f5('0x9'));var attributes=require(_0x00f5('0xa'));module[_0x00f5('0xb')]=function(_0x5427a1,_0x3d8c10){return _0x5427a1[_0x00f5('0xc')](_0x00f5('0xd'),attributes,{'tableName':_0x00f5('0xe'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x8bc8=['../../config/logger','api','bluebird','./variable.attributes','define','Variable','tools_variables','lodash','util'];(function(_0x35d649,_0x37210f){var _0x541bc4=function(_0x4743bb){while(--_0x4743bb){_0x35d649['push'](_0x35d649['shift']());}};_0x541bc4(++_0x37210f);}(_0x8bc8,0xc4));var _0x88bc=function(_0x2e1d5c,_0x337970){_0x2e1d5c=_0x2e1d5c-0x0;var _0x1c44c1=_0x8bc8[_0x2e1d5c];return _0x1c44c1;};'use strict';var _=require(_0x88bc('0x0'));var util=require(_0x88bc('0x1'));var logger=require(_0x88bc('0x2'))(_0x88bc('0x3'));var moment=require('moment');var BPromise=require(_0x88bc('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x88bc('0x5'));module['exports']=function(_0x330a6e,_0x57ded5){return _0x330a6e[_0x88bc('0x6')](_0x88bc('0x7'),attributes,{'tableName':_0x88bc('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/variable/variable.rpc.js b/server/api/variable/variable.rpc.js index 9e1e44e..a4f26d3 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 _0xd992=['../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','request','then','info','Variable,\x20%s,\x20%s','request\x20sent','debug','Variable,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','find','options','raw','where','attributes','include','map','model','ShowVariable','moment','bluebird','randomstring','ioredis'];(function(_0x108e53,_0xc104af){var _0x6bf497=function(_0x28693a){while(--_0x28693a){_0x108e53['push'](_0x108e53['shift']());}};_0x6bf497(++_0xc104af);}(_0xd992,0xce));var _0x2d99=function(_0x4e85cf,_0x18bbbb){_0x4e85cf=_0x4e85cf-0x0;var _0x384d11=_0xd992[_0x4e85cf];return _0x384d11;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x2d99('0x0'));var BPromise=require(_0x2d99('0x1'));var rs=require(_0x2d99('0x2'));var fs=require('fs');var Redis=require(_0x2d99('0x3'));var db=require(_0x2d99('0x4'))['db'];var utils=require(_0x2d99('0x5'));var logger=require(_0x2d99('0x6'))(_0x2d99('0x7'));var config=require('../../config/environment');var jayson=require(_0x2d99('0x8'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x1e5f7e,_0x5b1f40,_0xad3449){return new BPromise(function(_0x1410a2,_0x3a2e31){return client[_0x2d99('0x9')](_0x1e5f7e,_0xad3449)[_0x2d99('0xa')](function(_0x708d12){logger[_0x2d99('0xb')](_0x2d99('0xc'),_0x5b1f40,_0x2d99('0xd'));logger[_0x2d99('0xe')](_0x2d99('0xf'),_0x5b1f40,_0x2d99('0xd'),JSON[_0x2d99('0x10')](_0x708d12));if(_0x708d12['error']){if(_0x708d12['error']['code']===0x1f4){logger['error']('Variable,\x20%s,\x20%s',_0x5b1f40,_0x708d12[_0x2d99('0x11')][_0x2d99('0x12')]);return _0x3a2e31(_0x708d12[_0x2d99('0x11')]['message']);}logger['error'](_0x2d99('0xc'),_0x5b1f40,_0x708d12[_0x2d99('0x11')][_0x2d99('0x12')]);return _0x1410a2(_0x708d12[_0x2d99('0x11')][_0x2d99('0x12')]);}else{logger[_0x2d99('0xb')](_0x2d99('0xc'),_0x5b1f40,_0x2d99('0xd'));_0x1410a2(_0x708d12[_0x2d99('0x13')][_0x2d99('0x12')]);}})[_0x2d99('0x14')](function(_0x201f8d){logger[_0x2d99('0x11')](_0x2d99('0xc'),_0x5b1f40,_0x201f8d);_0x3a2e31(_0x201f8d);});});}exports['ShowVariable']=function(_0x18d427){var _0x3f91a0=this;return new Promise(function(_0x5c47df,_0x4aa20c){return db['Variable'][_0x2d99('0x15')]({'raw':_0x18d427[_0x2d99('0x16')]?_0x18d427[_0x2d99('0x16')][_0x2d99('0x17')]===undefined?!![]:![]:!![],'where':_0x18d427['options']?_0x18d427[_0x2d99('0x16')][_0x2d99('0x18')]||null:null,'attributes':_0x18d427[_0x2d99('0x16')]?_0x18d427[_0x2d99('0x16')][_0x2d99('0x19')]||null:null,'include':_0x18d427['options']?_0x18d427[_0x2d99('0x16')][_0x2d99('0x1a')]?_[_0x2d99('0x1b')](_0x18d427['options'][_0x2d99('0x1a')],function(_0x4062d2){return{'model':db[_0x4062d2[_0x2d99('0x1c')]],'as':_0x4062d2['as'],'attributes':_0x4062d2['attributes'],'include':_0x4062d2[_0x2d99('0x1a')]?_[_0x2d99('0x1b')](_0x4062d2[_0x2d99('0x1a')],function(_0x28cabc){return{'model':db[_0x28cabc[_0x2d99('0x1c')]],'as':_0x28cabc['as'],'attributes':_0x28cabc['attributes'],'include':_0x28cabc[_0x2d99('0x1a')]?_[_0x2d99('0x1b')](_0x28cabc[_0x2d99('0x1a')],function(_0x5978da){return{'model':db[_0x5978da[_0x2d99('0x1c')]],'as':_0x5978da['as'],'attributes':_0x5978da['attributes']};}):[]};}):[]};}):[]:[]})[_0x2d99('0xa')](function(_0x278638){logger[_0x2d99('0xb')](_0x2d99('0x1d'),_0x18d427);logger['debug'](_0x2d99('0x1d'),_0x18d427,JSON[_0x2d99('0x10')](_0x278638));_0x5c47df(_0x278638);})[_0x2d99('0x14')](function(_0x5d58ca){logger['error'](_0x2d99('0x1d'),_0x5d58ca[_0x2d99('0x12')],_0x18d427);_0x4aa20c(_0x3f91a0['error'](0x1f4,_0x5d58ca['message']));});});}; \ No newline at end of file +var _0x19bc=['request\x20sent','debug','Variable,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','ShowVariable','Variable','raw','options','attributes','include','map','model','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','request','then','info','Variable,\x20%s,\x20%s'];(function(_0x258919,_0x1754e6){var _0xfbd68b=function(_0x3bc3e9){while(--_0x3bc3e9){_0x258919['push'](_0x258919['shift']());}};_0xfbd68b(++_0x1754e6);}(_0x19bc,0x1c3));var _0xc19b=function(_0x23a1d3,_0x40504a){_0x23a1d3=_0x23a1d3-0x0;var _0x30a9ab=_0x19bc[_0x23a1d3];return _0x30a9ab;};'use strict';var _=require(_0xc19b('0x0'));var util=require(_0xc19b('0x1'));var moment=require('moment');var BPromise=require(_0xc19b('0x2'));var rs=require(_0xc19b('0x3'));var fs=require('fs');var Redis=require(_0xc19b('0x4'));var db=require(_0xc19b('0x5'))['db'];var utils=require(_0xc19b('0x6'));var logger=require(_0xc19b('0x7'))('rpc');var config=require(_0xc19b('0x8'));var jayson=require(_0xc19b('0x9'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x1b0090,_0x181be5,_0x1705f1){return new BPromise(function(_0x3c07a0,_0x4ff0ed){return client[_0xc19b('0xa')](_0x1b0090,_0x1705f1)[_0xc19b('0xb')](function(_0x108043){logger[_0xc19b('0xc')](_0xc19b('0xd'),_0x181be5,_0xc19b('0xe'));logger[_0xc19b('0xf')](_0xc19b('0x10'),_0x181be5,_0xc19b('0xe'),JSON[_0xc19b('0x11')](_0x108043));if(_0x108043[_0xc19b('0x12')]){if(_0x108043[_0xc19b('0x12')][_0xc19b('0x13')]===0x1f4){logger['error'](_0xc19b('0xd'),_0x181be5,_0x108043[_0xc19b('0x12')][_0xc19b('0x14')]);return _0x4ff0ed(_0x108043['error'][_0xc19b('0x14')]);}logger[_0xc19b('0x12')]('Variable,\x20%s,\x20%s',_0x181be5,_0x108043[_0xc19b('0x12')]['message']);return _0x3c07a0(_0x108043['error'][_0xc19b('0x14')]);}else{logger[_0xc19b('0xc')](_0xc19b('0xd'),_0x181be5,_0xc19b('0xe'));_0x3c07a0(_0x108043[_0xc19b('0x15')]['message']);}})[_0xc19b('0x16')](function(_0x1ba065){logger['error']('Variable,\x20%s,\x20%s',_0x181be5,_0x1ba065);_0x4ff0ed(_0x1ba065);});});}exports[_0xc19b('0x17')]=function(_0x5de05f){var _0x434f35=this;return new Promise(function(_0x5a5e49,_0x1e67f0){return db[_0xc19b('0x18')]['find']({'raw':_0x5de05f['options']?_0x5de05f['options'][_0xc19b('0x19')]===undefined?!![]:![]:!![],'where':_0x5de05f[_0xc19b('0x1a')]?_0x5de05f[_0xc19b('0x1a')]['where']||null:null,'attributes':_0x5de05f['options']?_0x5de05f[_0xc19b('0x1a')][_0xc19b('0x1b')]||null:null,'include':_0x5de05f[_0xc19b('0x1a')]?_0x5de05f[_0xc19b('0x1a')][_0xc19b('0x1c')]?_[_0xc19b('0x1d')](_0x5de05f[_0xc19b('0x1a')][_0xc19b('0x1c')],function(_0x590a4d){return{'model':db[_0x590a4d['model']],'as':_0x590a4d['as'],'attributes':_0x590a4d[_0xc19b('0x1b')],'include':_0x590a4d[_0xc19b('0x1c')]?_[_0xc19b('0x1d')](_0x590a4d[_0xc19b('0x1c')],function(_0x15e615){return{'model':db[_0x15e615[_0xc19b('0x1e')]],'as':_0x15e615['as'],'attributes':_0x15e615[_0xc19b('0x1b')],'include':_0x15e615[_0xc19b('0x1c')]?_[_0xc19b('0x1d')](_0x15e615[_0xc19b('0x1c')],function(_0x35937a){return{'model':db[_0x35937a[_0xc19b('0x1e')]],'as':_0x35937a['as'],'attributes':_0x35937a['attributes']};}):[]};}):[]};}):[]:[]})[_0xc19b('0xb')](function(_0x2d477e){logger[_0xc19b('0xc')](_0xc19b('0x17'),_0x5de05f);logger[_0xc19b('0xf')]('ShowVariable',_0x5de05f,JSON['stringify'](_0x2d477e));_0x5a5e49(_0x2d477e);})[_0xc19b('0x16')](function(_0x4e77b3){logger[_0xc19b('0x12')](_0xc19b('0x17'),_0x4e77b3[_0xc19b('0x14')],_0x5de05f);_0x1e67f0(_0x434f35['error'](0x1f4,_0x4e77b3[_0xc19b('0x14')]));});});}; \ No newline at end of file diff --git a/server/api/version/index.js b/server/api/version/index.js index a86cd5e..cace1e0 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 _0xd38c=['canUpdate','fetch','isAuthenticated','reset','pull','/restart','migrations','exports','express','Router','./version.controller','get','/fetch'];(function(_0x2c3f35,_0x57221b){var _0xf9105e=function(_0x113743){while(--_0x113743){_0x2c3f35['push'](_0x2c3f35['shift']());}};_0xf9105e(++_0x57221b);}(_0xd38c,0x174));var _0xcd38=function(_0x1ecec9,_0x44b3ff){_0x1ecec9=_0x1ecec9-0x0;var _0x2f9c48=_0xd38c[_0x1ecec9];return _0x2f9c48;};'use strict';var express=require(_0xcd38('0x0'));var router=express[_0xcd38('0x1')]();var auth=require('../../components/auth/service');var controller=require(_0xcd38('0x2'));router[_0xcd38('0x3')]('/',controller['index']);router[_0xcd38('0x3')](_0xcd38('0x4'),auth['isAuthenticated'](),auth[_0xcd38('0x5')](),controller[_0xcd38('0x6')]);router['get']('/reset',auth[_0xcd38('0x7')](),auth['canUpdate'](),controller[_0xcd38('0x8')]);router[_0xcd38('0x3')]('/pull',auth[_0xcd38('0x7')](),auth[_0xcd38('0x5')](),controller[_0xcd38('0x9')]);router[_0xcd38('0x3')](_0xcd38('0xa'),auth[_0xcd38('0x7')](),controller['restart']);router[_0xcd38('0x3')]('/migrations',controller[_0xcd38('0xb')]);module[_0xcd38('0xc')]=router; \ No newline at end of file +var _0x704c=['get','/fetch','isAuthenticated','fetch','/reset','canUpdate','/pull','pull','/restart','/migrations','exports','express','../../components/auth/service'];(function(_0x79c52f,_0x5bd9d3){var _0x37f2a8=function(_0x53d6f2){while(--_0x53d6f2){_0x79c52f['push'](_0x79c52f['shift']());}};_0x37f2a8(++_0x5bd9d3);}(_0x704c,0x143));var _0xc704=function(_0x550d12,_0x5384bd){_0x550d12=_0x550d12-0x0;var _0x12103d=_0x704c[_0x550d12];return _0x12103d;};'use strict';var express=require(_0xc704('0x0'));var router=express['Router']();var auth=require(_0xc704('0x1'));var controller=require('./version.controller');router[_0xc704('0x2')]('/',controller['index']);router['get'](_0xc704('0x3'),auth[_0xc704('0x4')](),auth['canUpdate'](),controller[_0xc704('0x5')]);router[_0xc704('0x2')](_0xc704('0x6'),auth[_0xc704('0x4')](),auth[_0xc704('0x7')](),controller['reset']);router[_0xc704('0x2')](_0xc704('0x8'),auth[_0xc704('0x4')](),auth['canUpdate'](),controller[_0xc704('0x9')]);router[_0xc704('0x2')](_0xc704('0xa'),auth[_0xc704('0x4')](),controller['restart']);router[_0xc704('0x2')](_0xc704('0xb'),controller['migrations']);module[_0xc704('0xc')]=router; \ No newline at end of file diff --git a/server/api/version/version.controller.js b/server/api/version/version.controller.js index ef24427..45a230d 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 _0x9aac=['\x20to\x20','last','Database\x20already\x20up-to-date','umzug','lodash','pkginfo','compare-versions','exec','../../config/environment','../../config/pm2','update','simple-git','root','version','query','tags','latest','exports','2.0.0','status','json','fetch','origin','master','git\x20fetch','git\x20fetch\x20origin\x20master','reset','FETCH_HEAD','error','info','git\x20reset\x20--hard','npm\x20install\x20--production','restart','motion2','then','pm2\x20restart\x20motion\x20%s','catch','migrations','readdirSync','join','server','length','replace','.js','push','sort','Migration','sequelize','getQueryInterface','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'];(function(_0x122ef9,_0x451d2a){var _0x42fba0=function(_0x17c9d3){while(--_0x17c9d3){_0x122ef9['push'](_0x122ef9['shift']());}};_0x42fba0(++_0x451d2a);}(_0x9aac,0x135));var _0xc9aa=function(_0x3dd742,_0x5de289){_0x3dd742=_0x3dd742-0x0;var _0x31055e=_0x9aac[_0x3dd742];return _0x31055e;};'use strict';var Umzug=require(_0xc9aa('0x0'));var path=require('path');var fs=require('fs');var _=require(_0xc9aa('0x1'));var pkginfo=require(_0xc9aa('0x2'))(module,'version');var compareVersions=require(_0xc9aa('0x3'));var exec=require('child_process')[_0xc9aa('0x4')];var db=require('../../mysqldb')['db'];var config=require(_0xc9aa('0x5'));var pm2=require(_0xc9aa('0x6'));var logger=require('../../config/logger')(_0xc9aa('0x7'));var git=require(_0xc9aa('0x8'))(config[_0xc9aa('0x9')]);exports['index']=function(_0x2f3fde,_0x24829f){var _0x2acfd4={'current':module['exports'][_0xc9aa('0xa')],'phonebar':0x2};if(_0x2f3fde[_0xc9aa('0xb')]&&_0x2f3fde[_0xc9aa('0xb')]['latest']){return git['fetch']()[_0xc9aa('0xc')](function(_0x5346e3,_0x131681){_0x2acfd4[_0xc9aa('0xd')]=(_0x5346e3?module[_0xc9aa('0xe')][_0xc9aa('0xa')]:_0x131681[_0xc9aa('0xd')])||_0xc9aa('0xf');return _0x24829f[_0xc9aa('0x10')](0xc8)[_0xc9aa('0x11')](_0x2acfd4);});}else{return _0x24829f[_0xc9aa('0x10')](0xc8)[_0xc9aa('0x11')](_0x2acfd4);}};exports[_0xc9aa('0x12')]=function(_0x884c9d,_0x39331d){return git[_0xc9aa('0x12')]([_0xc9aa('0x13'),_0xc9aa('0x14')],function(_0x2c1169){if(_0x2c1169){logger['error'](_0x2c1169);return _0x39331d[_0xc9aa('0x10')](0x1f4)['json'](_0x2c1169);}logger['info'](_0xc9aa('0x15'));return _0x39331d[_0xc9aa('0x10')](0xc8)[_0xc9aa('0x11')]({'output':_0xc9aa('0x16')});});};exports['reset']=function(_0x35f3b4,_0x28a1a0){return git[_0xc9aa('0x17')](['--hard',_0xc9aa('0x18')],function(_0x13d32d){if(_0x13d32d){logger[_0xc9aa('0x19')](_0x13d32d);return _0x28a1a0[_0xc9aa('0x10')](0x1f4)[_0xc9aa('0x11')](_0x13d32d);}logger[_0xc9aa('0x1a')]('git\x20reset\x20--hard\x20FETCH_HEAD');return _0x28a1a0[_0xc9aa('0x10')](0xc8)['json']({'output':_0xc9aa('0x1b')});});};exports['pull']=function(_0x7c837f,_0x5e51e9){exec(_0xc9aa('0x1c'),function(_0x3f8bfd,_0x214c09,_0x465f52){logger['info'](_0x214c09);logger[_0xc9aa('0x1a')](_0x465f52);if(_0x3f8bfd){logger[_0xc9aa('0x19')](_0x3f8bfd);return _0x5e51e9[_0xc9aa('0x10')](0x1f4)[_0xc9aa('0x11')](_0x3f8bfd);}return _0x5e51e9[_0xc9aa('0x10')](0xc8)['json']({'output':_0x214c09});});};exports[_0xc9aa('0x1d')]=function(_0xdd020f,_0x69a963){return pm2[_0xc9aa('0x1d')](_0xc9aa('0x1e'))[_0xc9aa('0x1f')](function(_0xee06f1){logger['info'](_0xc9aa('0x20'),_0xee06f1);return _0x69a963[_0xc9aa('0x10')](0xc8)['json']({'output':'Your\x20system\x20has\x20been\x20restart\x20successfully'});})[_0xc9aa('0x21')](function(_0x10a62e){logger[_0xc9aa('0x19')](_0x10a62e);return _0x69a963[_0xc9aa('0x10')](0x1f4)[_0xc9aa('0x11')](_0x10a62e);});};exports[_0xc9aa('0x22')]=function(_0x1251e1,_0x5865b5){var _0x1d1215=fs[_0xc9aa('0x23')](path[_0xc9aa('0x24')](config[_0xc9aa('0x9')],_0xc9aa('0x25'),_0xc9aa('0x22')));var _0x363394=[];for(var _0x574a66=0x0;_0x574a66<_0x1d1215[_0xc9aa('0x26')];_0x574a66++){var _0xbe9cc=_0x1d1215[_0x574a66][_0xc9aa('0x27')](_0xc9aa('0x28'),'');if(compareVersions(module[_0xc9aa('0xe')][_0xc9aa('0xa')],_0xbe9cc)===-0x1){_0x363394[_0xc9aa('0x29')](_0xbe9cc);}}if(_0x363394[_0xc9aa('0x26')]){var _0xfa94a8=_0x363394[_0xc9aa('0x2a')](compareVersions);var _0x340d53=new Umzug({'storage':'sequelize','storageOptions':{'model':db['Migration'],'modelName':_0xc9aa('0x2b'),'columnName':'version'},'migrations':{'params':[db[_0xc9aa('0x2c')][_0xc9aa('0x2d')](),db[_0xc9aa('0x2c')]['constructor'],function(){throw new Error(_0xc9aa('0x2e'));}],'path':path[_0xc9aa('0x24')](config['root'],_0xc9aa('0x25'),_0xc9aa('0x22')),'pattern':/\.js$/}});_0x340d53['up']({'migrations':_['map'](_0xfa94a8,function(_0x455d02){return _0x455d02+_0xc9aa('0x28');})})[_0xc9aa('0x1f')](function(){return _0x5865b5[_0xc9aa('0x10')](0xc8)['json']({'output':_0xc9aa('0x2f')+module[_0xc9aa('0xe')]['version']+_0xc9aa('0x30')+_[_0xc9aa('0x31')](_0xfa94a8),'migrations':_[_0xc9aa('0x24')](_0xfa94a8)});})[_0xc9aa('0x21')](function(_0x7544a8){if(_0x7544a8 instanceof db[_0xc9aa('0x2c')]['UniqueConstraintError']){return _0x5865b5['status'](0xc8)[_0xc9aa('0x11')]({'output':_0xc9aa('0x32')});}else{return _0x5865b5[_0xc9aa('0x10')](0x1f4)[_0xc9aa('0x11')](_0x7544a8);}});}else{return _0x5865b5[_0xc9aa('0x10')](0xc8)[_0xc9aa('0x11')]({'output':_0xc9aa('0x32')});}}; \ No newline at end of file +var _0x00f0=['Database\x20already\x20up-to-date','umzug','path','lodash','pkginfo','child_process','../../mysqldb','../../config/pm2','../../config/logger','simple-git','root','index','exports','version','query','latest','status','json','fetch','master','info','git\x20fetch','git\x20fetch\x20origin\x20master','reset','--hard','FETCH_HEAD','error','pull','restart','then','Your\x20system\x20has\x20been\x20restart\x20successfully','catch','migrations','join','server','length','replace','.js','push','sort','sequelize','Migration','constructor','Migration\x20tried\x20to\x20use\x20old\x20style\x20\x22done\x22\x20callback.\x20Please\x20upgrade\x20to\x20\x22umzug\x22\x20and\x20return\x20a\x20promise\x20instead.','map','last','UniqueConstraintError'];(function(_0xa3f91b,_0x5db913){var _0x142a05=function(_0x3ae255){while(--_0x3ae255){_0xa3f91b['push'](_0xa3f91b['shift']());}};_0x142a05(++_0x5db913);}(_0x00f0,0xec));var _0x000f=function(_0x334fac,_0xc1c965){_0x334fac=_0x334fac-0x0;var _0x453e91=_0x00f0[_0x334fac];return _0x453e91;};'use strict';var Umzug=require(_0x000f('0x0'));var path=require(_0x000f('0x1'));var fs=require('fs');var _=require(_0x000f('0x2'));var pkginfo=require(_0x000f('0x3'))(module,'version');var compareVersions=require('compare-versions');var exec=require(_0x000f('0x4'))['exec'];var db=require(_0x000f('0x5'))['db'];var config=require('../../config/environment');var pm2=require(_0x000f('0x6'));var logger=require(_0x000f('0x7'))('update');var git=require(_0x000f('0x8'))(config[_0x000f('0x9')]);exports[_0x000f('0xa')]=function(_0x621ab6,_0x330e11){var _0x468e73={'current':module[_0x000f('0xb')][_0x000f('0xc')],'phonebar':0x2};if(_0x621ab6[_0x000f('0xd')]&&_0x621ab6[_0x000f('0xd')][_0x000f('0xe')]){return git['fetch']()['tags'](function(_0x1a8ebf,_0x46d1c3){_0x468e73['latest']=(_0x1a8ebf?module[_0x000f('0xb')][_0x000f('0xc')]:_0x46d1c3['latest'])||'2.0.0';return _0x330e11[_0x000f('0xf')](0xc8)[_0x000f('0x10')](_0x468e73);});}else{return _0x330e11['status'](0xc8)['json'](_0x468e73);}};exports[_0x000f('0x11')]=function(_0x36f72a,_0x3f29cc){return git[_0x000f('0x11')](['origin',_0x000f('0x12')],function(_0x53626f){if(_0x53626f){logger['error'](_0x53626f);return _0x3f29cc[_0x000f('0xf')](0x1f4)['json'](_0x53626f);}logger[_0x000f('0x13')](_0x000f('0x14'));return _0x3f29cc[_0x000f('0xf')](0xc8)[_0x000f('0x10')]({'output':_0x000f('0x15')});});};exports[_0x000f('0x16')]=function(_0x9cbc29,_0x86ac21){return git[_0x000f('0x16')]([_0x000f('0x17'),_0x000f('0x18')],function(_0x156342){if(_0x156342){logger[_0x000f('0x19')](_0x156342);return _0x86ac21['status'](0x1f4)[_0x000f('0x10')](_0x156342);}logger[_0x000f('0x13')]('git\x20reset\x20--hard\x20FETCH_HEAD');return _0x86ac21[_0x000f('0xf')](0xc8)['json']({'output':'git\x20reset\x20--hard'});});};exports[_0x000f('0x1a')]=function(_0x1b1ad9,_0x34c999){exec('npm\x20install\x20--production',function(_0x53046d,_0x3b3b20,_0x860334){logger['info'](_0x3b3b20);logger[_0x000f('0x13')](_0x860334);if(_0x53046d){logger['error'](_0x53046d);return _0x34c999[_0x000f('0xf')](0x1f4)['json'](_0x53046d);}return _0x34c999[_0x000f('0xf')](0xc8)[_0x000f('0x10')]({'output':_0x3b3b20});});};exports[_0x000f('0x1b')]=function(_0xb7a76d,_0x24d3cb){return pm2[_0x000f('0x1b')]('motion2')[_0x000f('0x1c')](function(_0x157e9f){logger[_0x000f('0x13')]('pm2\x20restart\x20motion\x20%s',_0x157e9f);return _0x24d3cb[_0x000f('0xf')](0xc8)[_0x000f('0x10')]({'output':_0x000f('0x1d')});})[_0x000f('0x1e')](function(_0xcc2797){logger[_0x000f('0x19')](_0xcc2797);return _0x24d3cb[_0x000f('0xf')](0x1f4)['json'](_0xcc2797);});};exports[_0x000f('0x1f')]=function(_0x3dfe25,_0x42e13f){var _0x43e318=fs['readdirSync'](path[_0x000f('0x20')](config['root'],_0x000f('0x21'),_0x000f('0x1f')));var _0x3cd2c2=[];for(var _0x3d8553=0x0;_0x3d8553<_0x43e318[_0x000f('0x22')];_0x3d8553++){var _0x49bad3=_0x43e318[_0x3d8553][_0x000f('0x23')](_0x000f('0x24'),'');if(compareVersions(module['exports'][_0x000f('0xc')],_0x49bad3)===-0x1){_0x3cd2c2[_0x000f('0x25')](_0x49bad3);}}if(_0x3cd2c2[_0x000f('0x22')]){var _0x206dbc=_0x3cd2c2[_0x000f('0x26')](compareVersions);var _0x45ff70=new Umzug({'storage':_0x000f('0x27'),'storageOptions':{'model':db[_0x000f('0x28')],'modelName':'Migration','columnName':_0x000f('0xc')},'migrations':{'params':[db['sequelize']['getQueryInterface'](),db[_0x000f('0x27')][_0x000f('0x29')],function(){throw new Error(_0x000f('0x2a'));}],'path':path[_0x000f('0x20')](config[_0x000f('0x9')],_0x000f('0x21'),'migrations'),'pattern':/\.js$/}});_0x45ff70['up']({'migrations':_[_0x000f('0x2b')](_0x206dbc,function(_0x481633){return _0x481633+'.js';})})[_0x000f('0x1c')](function(){return _0x42e13f[_0x000f('0xf')](0xc8)['json']({'output':'Database\x20migrated\x20successfully\x20from\x20version\x20'+module[_0x000f('0xb')]['version']+'\x20to\x20'+_[_0x000f('0x2c')](_0x206dbc),'migrations':_[_0x000f('0x20')](_0x206dbc)});})[_0x000f('0x1e')](function(_0x544175){if(_0x544175 instanceof db['sequelize'][_0x000f('0x2d')]){return _0x42e13f[_0x000f('0xf')](0xc8)[_0x000f('0x10')]({'output':_0x000f('0x2e')});}else{return _0x42e13f['status'](0x1f4)['json'](_0x544175);}});}else{return _0x42e13f[_0x000f('0xf')](0xc8)[_0x000f('0x10')]({'output':'Database\x20already\x20up-to-date'});}}; \ No newline at end of file diff --git a/server/api/voiceAgentReport/index.js b/server/api/voiceAgentReport/index.js index ba629ae..2f985c9 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 _0x3d1e=['post','put','/:id','update','delete','destroy','exports','multer','util','path','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceAgentReport.controller','get','isAuthenticated','index','/describe','describe'];(function(_0x59a097,_0x3ef76e){var _0xa7afe9=function(_0x4f3a83){while(--_0x4f3a83){_0x59a097['push'](_0x59a097['shift']());}};_0xa7afe9(++_0x3ef76e);}(_0x3d1e,0xc4));var _0xe3d1=function(_0x48d8f4,_0x3d4978){_0x48d8f4=_0x48d8f4-0x0;var _0x1909b4=_0x3d1e[_0x48d8f4];return _0x1909b4;};'use strict';var multer=require(_0xe3d1('0x0'));var util=require(_0xe3d1('0x1'));var path=require(_0xe3d1('0x2'));var timeout=require(_0xe3d1('0x3'));var express=require('express');var router=express[_0xe3d1('0x4')]();var auth=require(_0xe3d1('0x5'));var interaction=require(_0xe3d1('0x6'));var config=require(_0xe3d1('0x7'));var controller=require(_0xe3d1('0x8'));router[_0xe3d1('0x9')]('/',auth[_0xe3d1('0xa')](),controller[_0xe3d1('0xb')]);router[_0xe3d1('0x9')](_0xe3d1('0xc'),auth[_0xe3d1('0xa')](),controller[_0xe3d1('0xd')]);router['get']('/:id',auth['isAuthenticated'](),controller['show']);router[_0xe3d1('0xe')]('/',auth[_0xe3d1('0xa')](),controller['create']);router[_0xe3d1('0xf')](_0xe3d1('0x10'),auth[_0xe3d1('0xa')](),controller[_0xe3d1('0x11')]);router[_0xe3d1('0x12')](_0xe3d1('0x10'),auth[_0xe3d1('0xa')](),controller[_0xe3d1('0x13')]);module[_0xe3d1('0x14')]=router; \ No newline at end of file +var _0x4469=['connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceAgentReport.controller','get','isAuthenticated','/describe','describe','show','create','/:id','update','delete','destroy','exports','multer','util','path'];(function(_0x2fe412,_0x28af50){var _0x2dc657=function(_0x26f410){while(--_0x26f410){_0x2fe412['push'](_0x2fe412['shift']());}};_0x2dc657(++_0x28af50);}(_0x4469,0x162));var _0x9446=function(_0x129697,_0x3e65d3){_0x129697=_0x129697-0x0;var _0x2707cd=_0x4469[_0x129697];return _0x2707cd;};'use strict';var multer=require(_0x9446('0x0'));var util=require(_0x9446('0x1'));var path=require(_0x9446('0x2'));var timeout=require(_0x9446('0x3'));var express=require(_0x9446('0x4'));var router=express[_0x9446('0x5')]();var auth=require(_0x9446('0x6'));var interaction=require(_0x9446('0x7'));var config=require(_0x9446('0x8'));var controller=require(_0x9446('0x9'));router[_0x9446('0xa')]('/',auth[_0x9446('0xb')](),controller['index']);router[_0x9446('0xa')](_0x9446('0xc'),auth['isAuthenticated'](),controller[_0x9446('0xd')]);router[_0x9446('0xa')]('/:id',auth[_0x9446('0xb')](),controller[_0x9446('0xe')]);router['post']('/',auth['isAuthenticated'](),controller[_0x9446('0xf')]);router['put'](_0x9446('0x10'),auth[_0x9446('0xb')](),controller[_0x9446('0x11')]);router[_0x9446('0x12')](_0x9446('0x10'),auth[_0x9446('0xb')](),controller[_0x9446('0x13')]);module[_0x9446('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 0199b99..8bf21b2 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 _0x24ca=['sequelize','STRING','DATE','INTEGER','BOOLEAN','FORWARD,\x20BLIND,\x20ATTENDED'];(function(_0x565ed7,_0x398228){var _0x183ad7=function(_0x5a43d7){while(--_0x5a43d7){_0x565ed7['push'](_0x565ed7['shift']());}};_0x183ad7(++_0x398228);}(_0x24ca,0x1bc));var _0xa24c=function(_0xd9f102,_0x5a0d28){_0xd9f102=_0xd9f102-0x0;var _0x2652e4=_0x24ca[_0xd9f102];return _0x2652e4;};'use strict';var Sequelize=require(_0xa24c('0x0'));module['exports']={'type':{'type':Sequelize[_0xa24c('0x1')]},'uniqueid':{'type':Sequelize[_0xa24c('0x1')]},'calleridnum':{'type':Sequelize[_0xa24c('0x1')]},'calleridname':{'type':Sequelize['STRING']},'queue':{'type':Sequelize[_0xa24c('0x1')]},'interface':{'type':Sequelize[_0xa24c('0x1')]},'membername':{'type':Sequelize[_0xa24c('0x1')]},'agentcalledAt':{'type':Sequelize[_0xa24c('0x2')]},'agentconnectAt':{'type':Sequelize[_0xa24c('0x2')]},'agentcompleteAt':{'type':Sequelize[_0xa24c('0x2')]},'agentringnoanswerAt':{'type':Sequelize[_0xa24c('0x2')]},'agentdumpAt':{'type':Sequelize[_0xa24c('0x2')]},'holdtime':{'type':Sequelize[_0xa24c('0x3')]},'agentcomplete':{'type':Sequelize[_0xa24c('0x4')],'defaultValue':![]},'agentringnoanswer':{'type':Sequelize[_0xa24c('0x4')],'defaultValue':![]},'agentdump':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'talktime':{'type':Sequelize[_0xa24c('0x3')]},'agentacw':{'type':Sequelize[_0xa24c('0x4')],'defaultValue':![]},'acwtime':{'type':Sequelize[_0xa24c('0x3')]},'reason':{'type':Sequelize['STRING']},'lastevent':{'type':Sequelize[_0xa24c('0x1')]},'channel':{'type':Sequelize[_0xa24c('0x1')]},'channelstate':{'type':Sequelize[_0xa24c('0x3')]},'channelstatedesc':{'type':Sequelize[_0xa24c('0x1')]},'connectedlinenum':{'type':Sequelize[_0xa24c('0x1')]},'connectedlinename':{'type':Sequelize[_0xa24c('0x1')]},'language':{'type':Sequelize[_0xa24c('0x1')]},'accountcode':{'type':Sequelize[_0xa24c('0x1')]},'context':{'type':Sequelize[_0xa24c('0x1')]},'exten':{'type':Sequelize['STRING']},'priority':{'type':Sequelize[_0xa24c('0x1')]},'destchannel':{'type':Sequelize[_0xa24c('0x1')]},'destchannelstate':{'type':Sequelize[_0xa24c('0x3')]},'destchannelstatedesc':{'type':Sequelize[_0xa24c('0x1')]},'destcalleridnum':{'type':Sequelize['STRING']},'destcalleridname':{'type':Sequelize[_0xa24c('0x1')]},'destconnectedlinenum':{'type':Sequelize[_0xa24c('0x1')]},'destconnectedlinename':{'type':Sequelize[_0xa24c('0x1')]},'destlanguage':{'type':Sequelize[_0xa24c('0x1')]},'destaccountcode':{'type':Sequelize[_0xa24c('0x1')]},'destcontext':{'type':Sequelize[_0xa24c('0x1')]},'destexten':{'type':Sequelize[_0xa24c('0x1')]},'destpriority':{'type':Sequelize['STRING']},'destuniqueid':{'type':Sequelize['STRING']},'answeredelsewheredestinationuniqueid':{'type':Sequelize[_0xa24c('0x1')]},'answeredelsewheremembername':{'type':Sequelize[_0xa24c('0x1')]},'transfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'transfertype':{'type':Sequelize['STRING'],'comment':_0xa24c('0x5')},'transferexten':{'type':Sequelize[_0xa24c('0x1')]},'transferuniqueid':{'type':Sequelize['STRING']},'agententerreason':{'type':Sequelize[_0xa24c('0x3')],'defaultValue':0x0}}; \ No newline at end of file +var _0xfdbd=['sequelize','exports','STRING','DATE','BOOLEAN','INTEGER'];(function(_0x7b90da,_0x474da5){var _0x690008=function(_0x1d6acb){while(--_0x1d6acb){_0x7b90da['push'](_0x7b90da['shift']());}};_0x690008(++_0x474da5);}(_0xfdbd,0xf0));var _0xdfdb=function(_0x47a8c0,_0x4d5931){_0x47a8c0=_0x47a8c0-0x0;var _0x551fa1=_0xfdbd[_0x47a8c0];return _0x551fa1;};'use strict';var Sequelize=require(_0xdfdb('0x0'));module[_0xdfdb('0x1')]={'type':{'type':Sequelize[_0xdfdb('0x2')]},'uniqueid':{'type':Sequelize[_0xdfdb('0x2')]},'calleridnum':{'type':Sequelize[_0xdfdb('0x2')]},'calleridname':{'type':Sequelize[_0xdfdb('0x2')]},'queue':{'type':Sequelize[_0xdfdb('0x2')]},'interface':{'type':Sequelize[_0xdfdb('0x2')]},'membername':{'type':Sequelize[_0xdfdb('0x2')]},'agentcalledAt':{'type':Sequelize['DATE']},'agentconnectAt':{'type':Sequelize[_0xdfdb('0x3')]},'agentcompleteAt':{'type':Sequelize['DATE']},'agentringnoanswerAt':{'type':Sequelize[_0xdfdb('0x3')]},'agentdumpAt':{'type':Sequelize[_0xdfdb('0x3')]},'holdtime':{'type':Sequelize['INTEGER']},'agentcomplete':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentringnoanswer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentdump':{'type':Sequelize[_0xdfdb('0x4')],'defaultValue':![]},'talktime':{'type':Sequelize[_0xdfdb('0x5')]},'agentacw':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'acwtime':{'type':Sequelize[_0xdfdb('0x5')]},'reason':{'type':Sequelize[_0xdfdb('0x2')]},'lastevent':{'type':Sequelize[_0xdfdb('0x2')]},'channel':{'type':Sequelize[_0xdfdb('0x2')]},'channelstate':{'type':Sequelize[_0xdfdb('0x5')]},'channelstatedesc':{'type':Sequelize[_0xdfdb('0x2')]},'connectedlinenum':{'type':Sequelize[_0xdfdb('0x2')]},'connectedlinename':{'type':Sequelize['STRING']},'language':{'type':Sequelize[_0xdfdb('0x2')]},'accountcode':{'type':Sequelize[_0xdfdb('0x2')]},'context':{'type':Sequelize['STRING']},'exten':{'type':Sequelize[_0xdfdb('0x2')]},'priority':{'type':Sequelize[_0xdfdb('0x2')]},'destchannel':{'type':Sequelize[_0xdfdb('0x2')]},'destchannelstate':{'type':Sequelize[_0xdfdb('0x5')]},'destchannelstatedesc':{'type':Sequelize[_0xdfdb('0x2')]},'destcalleridnum':{'type':Sequelize[_0xdfdb('0x2')]},'destcalleridname':{'type':Sequelize[_0xdfdb('0x2')]},'destconnectedlinenum':{'type':Sequelize[_0xdfdb('0x2')]},'destconnectedlinename':{'type':Sequelize['STRING']},'destlanguage':{'type':Sequelize['STRING']},'destaccountcode':{'type':Sequelize[_0xdfdb('0x2')]},'destcontext':{'type':Sequelize['STRING']},'destexten':{'type':Sequelize[_0xdfdb('0x2')]},'destpriority':{'type':Sequelize[_0xdfdb('0x2')]},'destuniqueid':{'type':Sequelize[_0xdfdb('0x2')]},'answeredelsewheredestinationuniqueid':{'type':Sequelize[_0xdfdb('0x2')]},'answeredelsewheremembername':{'type':Sequelize[_0xdfdb('0x2')]},'transfer':{'type':Sequelize[_0xdfdb('0x4')],'defaultValue':![]},'transfertype':{'type':Sequelize['STRING'],'comment':'FORWARD,\x20BLIND,\x20ATTENDED'},'transferexten':{'type':Sequelize[_0xdfdb('0x2')]},'transferuniqueid':{'type':Sequelize[_0xdfdb('0x2')]},'agententerreason':{'type':Sequelize[_0xdfdb('0x5')],'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 2969f6f..58840f6 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 _0x6ba5=['find','catch','create','body','describe','html-pdf','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','path','sox','to-csv','ejs','squel','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','offset','limit','set','Content-Range','apply','save','update','then','destroy','error','stack','name','send','index','map','VoiceAgentReport','rawAttributes','fieldName','type','key','model','query','keys','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','where','pick','filters','filter','merge','VIRTUAL','options','count','include','findAll','rows','show','params','includeAll'];(function(_0xc6f3b3,_0xbbdff7){var _0x4af1b6=function(_0x264da0){while(--_0x264da0){_0xc6f3b3['push'](_0xc6f3b3['shift']());}};_0x4af1b6(++_0xbbdff7);}(_0x6ba5,0x9d));var _0x56ba=function(_0x566cd3,_0x592dcc){_0x566cd3=_0x566cd3-0x0;var _0x1463b5=_0x6ba5[_0x566cd3];return _0x1463b5;};'use strict';var pdf=require(_0x56ba('0x0'));var emlformat=require(_0x56ba('0x1'));var rimraf=require(_0x56ba('0x2'));var zipdir=require(_0x56ba('0x3'));var jsonpatch=require('fast-json-patch');var rp=require(_0x56ba('0x4'));var moment=require(_0x56ba('0x5'));var BPromise=require(_0x56ba('0x6'));var Mustache=require(_0x56ba('0x7'));var util=require('util');var path=require(_0x56ba('0x8'));var sox=require(_0x56ba('0x9'));var csv=require(_0x56ba('0xa'));var ejs=require(_0x56ba('0xb'));var fs=require('fs');var _=require('lodash');var squel=require(_0x56ba('0xc'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x56ba('0xd'));var toCsv=require(_0x56ba('0xa'));var querystring=require(_0x56ba('0xe'));var Papa=require('papaparse');var Redis=require(_0x56ba('0xf'));var authService=require(_0x56ba('0x10'));var qs=require(_0x56ba('0x11'));var as=require(_0x56ba('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x56ba('0x13'))('api');var utils=require(_0x56ba('0x14'));var config=require(_0x56ba('0x15'));var db=require(_0x56ba('0x16'))['db'];function respondWithStatusCode(_0x3176bc,_0x161b76){_0x161b76=_0x161b76||0xcc;return function(_0x2381fd){if(_0x2381fd){return _0x3176bc[_0x56ba('0x17')](_0x161b76);}return _0x3176bc[_0x56ba('0x18')](_0x161b76)[_0x56ba('0x19')]();};}function respondWithResult(_0x51e40f,_0x49a9e0){_0x49a9e0=_0x49a9e0||0xc8;return function(_0x193143){if(_0x193143){return _0x51e40f[_0x56ba('0x18')](_0x49a9e0)[_0x56ba('0x1a')](_0x193143);}};}function respondWithFilteredResult(_0x51fdbb,_0x1cedb2){return function(_0x1eeb13){if(_0x1eeb13){var _0x330482=_0x1eeb13['count'],_0x456351=_0x1cedb2[_0x56ba('0x1b')],_0x2808bf=_0x1cedb2[_0x56ba('0x1b')]+_0x1cedb2[_0x56ba('0x1c')],_0x42d8c5;if(_0x2808bf>=_0x330482){_0x2808bf=_0x330482;_0x42d8c5=0xc8;}else{_0x42d8c5=0xce;}_0x51fdbb['status'](_0x42d8c5);return _0x51fdbb[_0x56ba('0x1d')](_0x56ba('0x1e'),_0x456351+'-'+_0x2808bf+'/'+_0x330482)['json'](_0x1eeb13);}return null;};}function patchUpdates(_0x4e9803){return function(_0x2666e6){try{jsonpatch[_0x56ba('0x1f')](_0x2666e6,_0x4e9803,!![]);}catch(_0x3e11cb){return BPromise['reject'](_0x3e11cb);}return _0x2666e6[_0x56ba('0x20')]();};}function saveUpdates(_0x1d2edb,_0x18d074){return function(_0x2c4809){if(_0x2c4809){return _0x2c4809[_0x56ba('0x21')](_0x1d2edb)[_0x56ba('0x22')](function(_0x1458eb){return _0x1458eb;});}return null;};}function removeEntity(_0x1db61,_0x1a9106){return function(_0x564dca){if(_0x564dca){return _0x564dca[_0x56ba('0x23')]()['then'](function(){_0x1db61[_0x56ba('0x18')](0xcc)[_0x56ba('0x19')]();});}};}function handleEntityNotFound(_0x24b864,_0x50544e){return function(_0x46cbad){if(!_0x46cbad){_0x24b864[_0x56ba('0x17')](0x194);}return _0x46cbad;};}function handleError(_0x4d1647,_0x227ef1){_0x227ef1=_0x227ef1||0x1f4;return function(_0xf3c53b){logger[_0x56ba('0x24')](_0xf3c53b[_0x56ba('0x25')]);if(_0xf3c53b[_0x56ba('0x26')]){delete _0xf3c53b[_0x56ba('0x26')];}_0x4d1647['status'](_0x227ef1)[_0x56ba('0x27')](_0xf3c53b);};}exports[_0x56ba('0x28')]=function(_0x2d415f,_0x4afd11){var _0x2224f4={},_0x3cb1a0={},_0x519e8b={'count':0x0,'rows':[]};var _0x328e7f=_[_0x56ba('0x29')](db[_0x56ba('0x2a')][_0x56ba('0x2b')],function(_0x998bd8){return{'name':_0x998bd8[_0x56ba('0x2c')],'type':_0x998bd8[_0x56ba('0x2d')][_0x56ba('0x2e')]};});_0x3cb1a0[_0x56ba('0x2f')]=_[_0x56ba('0x29')](_0x328e7f,_0x56ba('0x26'));_0x3cb1a0[_0x56ba('0x30')]=_[_0x56ba('0x31')](_0x2d415f['query']);_0x3cb1a0['filters']=_[_0x56ba('0x32')](_0x3cb1a0[_0x56ba('0x2f')],_0x3cb1a0[_0x56ba('0x30')]);_0x2224f4[_0x56ba('0x33')]=_[_0x56ba('0x32')](_0x3cb1a0[_0x56ba('0x2f')],qs[_0x56ba('0x34')](_0x2d415f[_0x56ba('0x30')][_0x56ba('0x34')]));_0x2224f4[_0x56ba('0x33')]=_0x2224f4['attributes'][_0x56ba('0x35')]?_0x2224f4[_0x56ba('0x33')]:_0x3cb1a0[_0x56ba('0x2f')];if(!_0x2d415f['query'][_0x56ba('0x36')](_0x56ba('0x37'))){_0x2224f4['limit']=qs[_0x56ba('0x1c')](_0x2d415f[_0x56ba('0x30')][_0x56ba('0x1c')]);_0x2224f4[_0x56ba('0x1b')]=qs[_0x56ba('0x1b')](_0x2d415f[_0x56ba('0x30')][_0x56ba('0x1b')]);}_0x2224f4['order']=qs[_0x56ba('0x38')](_0x2d415f[_0x56ba('0x30')][_0x56ba('0x38')]);_0x2224f4[_0x56ba('0x39')]=qs['filters'](_[_0x56ba('0x3a')](_0x2d415f[_0x56ba('0x30')],_0x3cb1a0[_0x56ba('0x3b')]));if(_0x2d415f[_0x56ba('0x30')][_0x56ba('0x3c')]){_0x2224f4['where']=_[_0x56ba('0x3d')](_0x2224f4[_0x56ba('0x39')],{'$or':_[_0x56ba('0x29')](_0x328e7f,function(_0x2b81e2){if(_0x2b81e2[_0x56ba('0x2d')]!==_0x56ba('0x3e')){var _0x52cec5={};_0x52cec5[_0x2b81e2[_0x56ba('0x26')]]={'$like':'%'+_0x2d415f[_0x56ba('0x30')][_0x56ba('0x3c')]+'%'};return _0x52cec5;}})});}_0x2224f4=_[_0x56ba('0x3d')]({},_0x2224f4,_0x2d415f[_0x56ba('0x3f')]);var _0x14068a={'where':_0x2224f4['where']};return db[_0x56ba('0x2a')][_0x56ba('0x40')](_0x14068a)[_0x56ba('0x22')](function(_0x19c598){_0x519e8b[_0x56ba('0x40')]=_0x19c598;if(_0x2d415f[_0x56ba('0x30')]['includeAll']){_0x2224f4[_0x56ba('0x41')]=[{'all':!![]}];}return db['VoiceAgentReport'][_0x56ba('0x42')](_0x2224f4);})[_0x56ba('0x22')](function(_0x3fe1c2){_0x519e8b[_0x56ba('0x43')]=_0x3fe1c2;return _0x519e8b;})[_0x56ba('0x22')](respondWithFilteredResult(_0x4afd11,_0x2224f4))['catch'](handleError(_0x4afd11,null));};exports[_0x56ba('0x44')]=function(_0x3a130c,_0x9fcd5){var _0x53befa={'raw':![],'where':{'id':_0x3a130c[_0x56ba('0x45')]['id']}},_0x23b849={};_0x23b849[_0x56ba('0x2f')]=_[_0x56ba('0x31')](db[_0x56ba('0x2a')][_0x56ba('0x2b')]);_0x23b849['query']=_['keys'](_0x3a130c['query']);_0x23b849[_0x56ba('0x3b')]=_[_0x56ba('0x32')](_0x23b849[_0x56ba('0x2f')],_0x23b849[_0x56ba('0x30')]);_0x53befa[_0x56ba('0x33')]=_[_0x56ba('0x32')](_0x23b849['model'],qs['fields'](_0x3a130c['query']['fields']));_0x53befa['attributes']=_0x53befa[_0x56ba('0x33')][_0x56ba('0x35')]?_0x53befa[_0x56ba('0x33')]:_0x23b849[_0x56ba('0x2f')];if(_0x3a130c[_0x56ba('0x30')][_0x56ba('0x46')]){_0x53befa[_0x56ba('0x41')]=[{'all':!![]}];}_0x53befa=_[_0x56ba('0x3d')]({},_0x53befa,_0x3a130c[_0x56ba('0x3f')]);return db['VoiceAgentReport'][_0x56ba('0x47')](_0x53befa)[_0x56ba('0x22')](handleEntityNotFound(_0x9fcd5,null))[_0x56ba('0x22')](respondWithResult(_0x9fcd5,null))[_0x56ba('0x48')](handleError(_0x9fcd5,null));};exports[_0x56ba('0x49')]=function(_0x12708f,_0x41931e){return db[_0x56ba('0x2a')]['create'](_0x12708f[_0x56ba('0x4a')],{})[_0x56ba('0x22')](respondWithResult(_0x41931e,0xc9))[_0x56ba('0x48')](handleError(_0x41931e,null));};exports[_0x56ba('0x21')]=function(_0x1a552c,_0x42a30f){if(_0x1a552c['body']['id']){delete _0x1a552c[_0x56ba('0x4a')]['id'];}return db[_0x56ba('0x2a')][_0x56ba('0x47')]({'where':{'id':_0x1a552c[_0x56ba('0x45')]['id']}})[_0x56ba('0x22')](handleEntityNotFound(_0x42a30f,null))[_0x56ba('0x22')](saveUpdates(_0x1a552c[_0x56ba('0x4a')],null))[_0x56ba('0x22')](respondWithResult(_0x42a30f,null))['catch'](handleError(_0x42a30f,null));};exports[_0x56ba('0x23')]=function(_0x1f8c54,_0x5dc02d){return db[_0x56ba('0x2a')]['find']({'where':{'id':_0x1f8c54[_0x56ba('0x45')]['id']}})[_0x56ba('0x22')](handleEntityNotFound(_0x5dc02d,null))['then'](removeEntity(_0x5dc02d,null))['catch'](handleError(_0x5dc02d,null));};exports[_0x56ba('0x4b')]=function(_0x2f06cb,_0x41a414){return db[_0x56ba('0x2a')][_0x56ba('0x4b')]()['then'](respondWithResult(_0x41a414,null))[_0x56ba('0x48')](handleError(_0x41a414,null));}; \ No newline at end of file +var _0x3630=['reject','save','then','error','stack','name','send','index','VoiceAgentReport','fieldName','type','model','map','query','filters','attributes','intersection','fields','nolimit','limit','order','sort','where','pick','merge','VIRTUAL','filter','options','count','include','findAll','rows','catch','show','params','keys','includeAll','find','create','body','destroy','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','to-csv','ejs','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','offset','Content-Range','apply'];(function(_0x296d34,_0x425387){var _0x1494a7=function(_0x1e7b0d){while(--_0x1e7b0d){_0x296d34['push'](_0x296d34['shift']());}};_0x1494a7(++_0x425387);}(_0x3630,0x19c));var _0x0363=function(_0x1edcfe,_0x3033fe){_0x1edcfe=_0x1edcfe-0x0;var _0x470c0d=_0x3630[_0x1edcfe];return _0x470c0d;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x0363('0x0'));var rimraf=require(_0x0363('0x1'));var zipdir=require(_0x0363('0x2'));var jsonpatch=require(_0x0363('0x3'));var rp=require(_0x0363('0x4'));var moment=require(_0x0363('0x5'));var BPromise=require('bluebird');var Mustache=require(_0x0363('0x6'));var util=require(_0x0363('0x7'));var path=require(_0x0363('0x8'));var sox=require('sox');var csv=require(_0x0363('0x9'));var ejs=require(_0x0363('0xa'));var fs=require('fs');var _=require('lodash');var squel=require('squel');var crypto=require(_0x0363('0xb'));var jsforce=require(_0x0363('0xc'));var deskjs=require(_0x0363('0xd'));var toCsv=require('to-csv');var querystring=require(_0x0363('0xe'));var Papa=require(_0x0363('0xf'));var Redis=require('ioredis');var authService=require(_0x0363('0x10'));var qs=require(_0x0363('0x11'));var as=require(_0x0363('0x12'));var hardwareService=require(_0x0363('0x13'));var logger=require(_0x0363('0x14'))(_0x0363('0x15'));var utils=require(_0x0363('0x16'));var config=require(_0x0363('0x17'));var db=require(_0x0363('0x18'))['db'];function respondWithStatusCode(_0x4685bb,_0x37d9ed){_0x37d9ed=_0x37d9ed||0xcc;return function(_0x31384c){if(_0x31384c){return _0x4685bb[_0x0363('0x19')](_0x37d9ed);}return _0x4685bb[_0x0363('0x1a')](_0x37d9ed)[_0x0363('0x1b')]();};}function respondWithResult(_0x4316da,_0x526143){_0x526143=_0x526143||0xc8;return function(_0x107a79){if(_0x107a79){return _0x4316da[_0x0363('0x1a')](_0x526143)[_0x0363('0x1c')](_0x107a79);}};}function respondWithFilteredResult(_0x1b78ad,_0x27d064){return function(_0x883a32){if(_0x883a32){var _0x2f20e0=_0x883a32['count'],_0xee82ce=_0x27d064[_0x0363('0x1d')],_0x3dfc3a=_0x27d064[_0x0363('0x1d')]+_0x27d064['limit'],_0x4a3b72;if(_0x3dfc3a>=_0x2f20e0){_0x3dfc3a=_0x2f20e0;_0x4a3b72=0xc8;}else{_0x4a3b72=0xce;}_0x1b78ad['status'](_0x4a3b72);return _0x1b78ad['set'](_0x0363('0x1e'),_0xee82ce+'-'+_0x3dfc3a+'/'+_0x2f20e0)['json'](_0x883a32);}return null;};}function patchUpdates(_0x325d26){return function(_0x2419cd){try{jsonpatch[_0x0363('0x1f')](_0x2419cd,_0x325d26,!![]);}catch(_0x267650){return BPromise[_0x0363('0x20')](_0x267650);}return _0x2419cd[_0x0363('0x21')]();};}function saveUpdates(_0x1b12ae,_0x57788a){return function(_0xc0d569){if(_0xc0d569){return _0xc0d569['update'](_0x1b12ae)[_0x0363('0x22')](function(_0x57fe62){return _0x57fe62;});}return null;};}function removeEntity(_0x523b4a,_0x25b440){return function(_0x285b01){if(_0x285b01){return _0x285b01['destroy']()[_0x0363('0x22')](function(){_0x523b4a['status'](0xcc)[_0x0363('0x1b')]();});}};}function handleEntityNotFound(_0x54920d,_0x1657bb){return function(_0x1b0365){if(!_0x1b0365){_0x54920d['sendStatus'](0x194);}return _0x1b0365;};}function handleError(_0x200cf5,_0x5e9050){_0x5e9050=_0x5e9050||0x1f4;return function(_0xba3010){logger[_0x0363('0x23')](_0xba3010[_0x0363('0x24')]);if(_0xba3010[_0x0363('0x25')]){delete _0xba3010[_0x0363('0x25')];}_0x200cf5[_0x0363('0x1a')](_0x5e9050)[_0x0363('0x26')](_0xba3010);};}exports[_0x0363('0x27')]=function(_0x1eb821,_0x9971){var _0x3188af={},_0x2aba7e={},_0x5478cb={'count':0x0,'rows':[]};var _0x44660f=_['map'](db[_0x0363('0x28')]['rawAttributes'],function(_0x325e66){return{'name':_0x325e66[_0x0363('0x29')],'type':_0x325e66[_0x0363('0x2a')]['key']};});_0x2aba7e[_0x0363('0x2b')]=_[_0x0363('0x2c')](_0x44660f,_0x0363('0x25'));_0x2aba7e[_0x0363('0x2d')]=_['keys'](_0x1eb821[_0x0363('0x2d')]);_0x2aba7e[_0x0363('0x2e')]=_['intersection'](_0x2aba7e['model'],_0x2aba7e[_0x0363('0x2d')]);_0x3188af[_0x0363('0x2f')]=_[_0x0363('0x30')](_0x2aba7e[_0x0363('0x2b')],qs['fields'](_0x1eb821[_0x0363('0x2d')][_0x0363('0x31')]));_0x3188af['attributes']=_0x3188af[_0x0363('0x2f')]['length']?_0x3188af['attributes']:_0x2aba7e['model'];if(!_0x1eb821[_0x0363('0x2d')]['hasOwnProperty'](_0x0363('0x32'))){_0x3188af['limit']=qs['limit'](_0x1eb821['query'][_0x0363('0x33')]);_0x3188af['offset']=qs[_0x0363('0x1d')](_0x1eb821[_0x0363('0x2d')]['offset']);}_0x3188af[_0x0363('0x34')]=qs[_0x0363('0x35')](_0x1eb821[_0x0363('0x2d')][_0x0363('0x35')]);_0x3188af[_0x0363('0x36')]=qs[_0x0363('0x2e')](_[_0x0363('0x37')](_0x1eb821[_0x0363('0x2d')],_0x2aba7e[_0x0363('0x2e')]));if(_0x1eb821[_0x0363('0x2d')]['filter']){_0x3188af[_0x0363('0x36')]=_[_0x0363('0x38')](_0x3188af['where'],{'$or':_[_0x0363('0x2c')](_0x44660f,function(_0x13de06){if(_0x13de06[_0x0363('0x2a')]!==_0x0363('0x39')){var _0x86f1b3={};_0x86f1b3[_0x13de06[_0x0363('0x25')]]={'$like':'%'+_0x1eb821[_0x0363('0x2d')][_0x0363('0x3a')]+'%'};return _0x86f1b3;}})});}_0x3188af=_[_0x0363('0x38')]({},_0x3188af,_0x1eb821[_0x0363('0x3b')]);var _0x28f192={'where':_0x3188af[_0x0363('0x36')]};return db[_0x0363('0x28')][_0x0363('0x3c')](_0x28f192)[_0x0363('0x22')](function(_0xf4f865){_0x5478cb[_0x0363('0x3c')]=_0xf4f865;if(_0x1eb821[_0x0363('0x2d')]['includeAll']){_0x3188af[_0x0363('0x3d')]=[{'all':!![]}];}return db[_0x0363('0x28')][_0x0363('0x3e')](_0x3188af);})[_0x0363('0x22')](function(_0x302d08){_0x5478cb[_0x0363('0x3f')]=_0x302d08;return _0x5478cb;})[_0x0363('0x22')](respondWithFilteredResult(_0x9971,_0x3188af))[_0x0363('0x40')](handleError(_0x9971,null));};exports[_0x0363('0x41')]=function(_0x5ec8f8,_0x38c2cb){var _0xda950f={'raw':![],'where':{'id':_0x5ec8f8[_0x0363('0x42')]['id']}},_0x4c308f={};_0x4c308f[_0x0363('0x2b')]=_['keys'](db['VoiceAgentReport']['rawAttributes']);_0x4c308f[_0x0363('0x2d')]=_[_0x0363('0x43')](_0x5ec8f8[_0x0363('0x2d')]);_0x4c308f['filters']=_[_0x0363('0x30')](_0x4c308f[_0x0363('0x2b')],_0x4c308f[_0x0363('0x2d')]);_0xda950f[_0x0363('0x2f')]=_['intersection'](_0x4c308f[_0x0363('0x2b')],qs[_0x0363('0x31')](_0x5ec8f8['query'][_0x0363('0x31')]));_0xda950f[_0x0363('0x2f')]=_0xda950f['attributes']['length']?_0xda950f[_0x0363('0x2f')]:_0x4c308f[_0x0363('0x2b')];if(_0x5ec8f8[_0x0363('0x2d')][_0x0363('0x44')]){_0xda950f[_0x0363('0x3d')]=[{'all':!![]}];}_0xda950f=_[_0x0363('0x38')]({},_0xda950f,_0x5ec8f8[_0x0363('0x3b')]);return db['VoiceAgentReport'][_0x0363('0x45')](_0xda950f)[_0x0363('0x22')](handleEntityNotFound(_0x38c2cb,null))[_0x0363('0x22')](respondWithResult(_0x38c2cb,null))['catch'](handleError(_0x38c2cb,null));};exports[_0x0363('0x46')]=function(_0x21075f,_0x513271){return db[_0x0363('0x28')]['create'](_0x21075f[_0x0363('0x47')],{})[_0x0363('0x22')](respondWithResult(_0x513271,0xc9))['catch'](handleError(_0x513271,null));};exports['update']=function(_0x4e7e19,_0x5a1f49){if(_0x4e7e19['body']['id']){delete _0x4e7e19[_0x0363('0x47')]['id'];}return db[_0x0363('0x28')][_0x0363('0x45')]({'where':{'id':_0x4e7e19['params']['id']}})[_0x0363('0x22')](handleEntityNotFound(_0x5a1f49,null))[_0x0363('0x22')](saveUpdates(_0x4e7e19[_0x0363('0x47')],null))[_0x0363('0x22')](respondWithResult(_0x5a1f49,null))[_0x0363('0x40')](handleError(_0x5a1f49,null));};exports[_0x0363('0x48')]=function(_0x32503d,_0x5e313b){return db['VoiceAgentReport'][_0x0363('0x45')]({'where':{'id':_0x32503d[_0x0363('0x42')]['id']}})['then'](handleEntityNotFound(_0x5e313b,null))['then'](removeEntity(_0x5e313b,null))[_0x0363('0x40')](handleError(_0x5e313b,null));};exports[_0x0363('0x49')]=function(_0x23657c,_0x5c8f36){return db['VoiceAgentReport'][_0x0363('0x49')]()[_0x0363('0x22')](respondWithResult(_0x5c8f36,null))[_0x0363('0x40')](handleError(_0x5c8f36,null));}; \ No newline at end of file diff --git a/server/api/voiceAgentReport/voiceAgentReport.model.js b/server/api/voiceAgentReport/voiceAgentReport.model.js index 35ae5b5..01a80f7 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 _0x2762=['../../config/logger','api','moment','bluebird','path','rimraf','../../config/environment','./voiceAgentReport.attributes','define','uniqueid','destuniqueid','util'];(function(_0x4d1748,_0x5deb27){var _0x5b348d=function(_0x3daf76){while(--_0x3daf76){_0x4d1748['push'](_0x4d1748['shift']());}};_0x5b348d(++_0x5deb27);}(_0x2762,0x1eb));var _0x2276=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x2762[_0x3dd15e];return _0x231fd0;};'use strict';var _=require('lodash');var util=require(_0x2276('0x0'));var logger=require(_0x2276('0x1'))(_0x2276('0x2'));var moment=require(_0x2276('0x3'));var BPromise=require(_0x2276('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x2276('0x5'));var rimraf=require(_0x2276('0x6'));var config=require(_0x2276('0x7'));var attributes=require(_0x2276('0x8'));module['exports']=function(_0x26947d,_0x2da37f){return _0x26947d[_0x2276('0x9')]('VoiceAgentReport',attributes,{'tableName':'report_agent','paranoid':![],'indexes':[{'fields':[_0x2276('0xa'),_0x2276('0xb')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xd7ad=['rimraf','../../config/environment','./voiceAgentReport.attributes','exports','define','VoiceAgentReport','report_agent','uniqueid','destuniqueid','lodash','util','../../config/logger','path'];(function(_0x445ccb,_0x34df55){var _0x5dbd5d=function(_0x5beebf){while(--_0x5beebf){_0x445ccb['push'](_0x445ccb['shift']());}};_0x5dbd5d(++_0x34df55);}(_0xd7ad,0x1ea));var _0xdd7a=function(_0x4c440b,_0x3ea627){_0x4c440b=_0x4c440b-0x0;var _0x2d48cf=_0xd7ad[_0x4c440b];return _0x2d48cf;};'use strict';var _=require(_0xdd7a('0x0'));var util=require(_0xdd7a('0x1'));var logger=require(_0xdd7a('0x2'))('api');var moment=require('moment');var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0xdd7a('0x3'));var rimraf=require(_0xdd7a('0x4'));var config=require(_0xdd7a('0x5'));var attributes=require(_0xdd7a('0x6'));module[_0xdd7a('0x7')]=function(_0x484dca,_0x17f091){return _0x484dca[_0xdd7a('0x8')](_0xdd7a('0x9'),attributes,{'tableName':_0xdd7a('0xa'),'paranoid':![],'indexes':[{'fields':[_0xdd7a('0xb'),_0xdd7a('0xc')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceAgentReport/voiceAgentReport.rpc.js b/server/api/voiceAgentReport/voiceAgentReport.rpc.js index c1ec0ea..9a59892 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 _0x4747=['../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request','then','info','VoiceAgentReport,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','catch','CreateVoiceAgentReport','VoiceAgentReport','create','body','options','raw','UpdateVoiceAgentReport','update','where','attributes','lodash','util','bluebird','randomstring','ioredis'];(function(_0xf59882,_0x279028){var _0x4127d6=function(_0x56fec8){while(--_0x56fec8){_0xf59882['push'](_0xf59882['shift']());}};_0x4127d6(++_0x279028);}(_0x4747,0xbb));var _0x7474=function(_0x353fb6,_0x4f8fcd){_0x353fb6=_0x353fb6-0x0;var _0x288c33=_0x4747[_0x353fb6];return _0x288c33;};'use strict';var _=require(_0x7474('0x0'));var util=require(_0x7474('0x1'));var moment=require('moment');var BPromise=require(_0x7474('0x2'));var rs=require(_0x7474('0x3'));var fs=require('fs');var Redis=require(_0x7474('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x7474('0x5'));var logger=require(_0x7474('0x6'))('rpc');var config=require(_0x7474('0x7'));var jayson=require(_0x7474('0x8'));var client=jayson[_0x7474('0x9')][_0x7474('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x5d9db6,_0xc85a92,_0xcc57d2){return new BPromise(function(_0x30f4a5,_0x412d6d){return client[_0x7474('0xb')](_0x5d9db6,_0xcc57d2)[_0x7474('0xc')](function(_0x2970a6){logger[_0x7474('0xd')](_0x7474('0xe'),_0xc85a92,_0x7474('0xf'));logger[_0x7474('0x10')]('VoiceAgentReport,\x20%s,\x20%s,\x20%s',_0xc85a92,_0x7474('0xf'),JSON[_0x7474('0x11')](_0x2970a6));if(_0x2970a6['error']){if(_0x2970a6[_0x7474('0x12')][_0x7474('0x13')]===0x1f4){logger['error']('VoiceAgentReport,\x20%s,\x20%s',_0xc85a92,_0x2970a6[_0x7474('0x12')][_0x7474('0x14')]);return _0x412d6d(_0x2970a6[_0x7474('0x12')][_0x7474('0x14')]);}logger['error'](_0x7474('0xe'),_0xc85a92,_0x2970a6[_0x7474('0x12')][_0x7474('0x14')]);return _0x30f4a5(_0x2970a6[_0x7474('0x12')][_0x7474('0x14')]);}else{logger['info']('VoiceAgentReport,\x20%s,\x20%s',_0xc85a92,_0x7474('0xf'));_0x30f4a5(_0x2970a6['result'][_0x7474('0x14')]);}})[_0x7474('0x15')](function(_0x110a97){logger[_0x7474('0x12')](_0x7474('0xe'),_0xc85a92,_0x110a97);_0x412d6d(_0x110a97);});});}exports[_0x7474('0x16')]=function(_0x5391a8){var _0x431184=this;return new Promise(function(_0x260109,_0x4ebe19){return db[_0x7474('0x17')][_0x7474('0x18')](_0x5391a8[_0x7474('0x19')],{'raw':_0x5391a8[_0x7474('0x1a')]?_0x5391a8[_0x7474('0x1a')][_0x7474('0x1b')]===undefined?!![]:![]:!![]})[_0x7474('0xc')](function(_0x408514){logger[_0x7474('0xd')](_0x7474('0x16'),_0x5391a8);logger['debug'](_0x7474('0x16'),_0x5391a8,JSON[_0x7474('0x11')](_0x408514));_0x260109(_0x408514);})[_0x7474('0x15')](function(_0x3ad38e){logger[_0x7474('0x12')]('CreateVoiceAgentReport',_0x3ad38e['message'],_0x5391a8);_0x4ebe19(_0x431184['error'](0x1f4,_0x3ad38e[_0x7474('0x14')]));});});};exports[_0x7474('0x1c')]=function(_0x536f56){var _0x368735=this;return new Promise(function(_0x188b07,_0x510062){return db[_0x7474('0x17')][_0x7474('0x1d')](_0x536f56[_0x7474('0x19')],{'raw':_0x536f56['options']?_0x536f56[_0x7474('0x1a')][_0x7474('0x1b')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x536f56[_0x7474('0x1a')]?_0x536f56[_0x7474('0x1a')][_0x7474('0x1e')]||null:null,'attributes':_0x536f56[_0x7474('0x1a')]?_0x536f56[_0x7474('0x1a')][_0x7474('0x1f')]||null:null,'limit':_0x536f56[_0x7474('0x1a')]?_0x536f56[_0x7474('0x1a')]['limit']||null:null})[_0x7474('0xc')](function(_0x4f6071){logger[_0x7474('0xd')]('UpdateVoiceAgentReport',_0x536f56);logger['debug']('UpdateVoiceAgentReport',_0x536f56,JSON[_0x7474('0x11')](_0x4f6071));_0x188b07(_0x4f6071);})[_0x7474('0x15')](function(_0x2b39ea){logger[_0x7474('0x12')]('UpdateVoiceAgentReport',_0x2b39ea['message'],_0x536f56);_0x510062(_0x368735[_0x7474('0x12')](0x1f4,_0x2b39ea['message']));});});}; \ No newline at end of file +var _0x3483=['VoiceAgentReport','create','options','stringify','UpdateVoiceAgentReport','update','body','raw','attributes','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','http','request','then','info','VoiceAgentReport,\x20%s,\x20%s','request\x20sent','debug','VoiceAgentReport,\x20%s,\x20%s,\x20%s','error','code','message','catch','CreateVoiceAgentReport'];(function(_0x923cb1,_0x294104){var _0x342e95=function(_0x44382f){while(--_0x44382f){_0x923cb1['push'](_0x923cb1['shift']());}};_0x342e95(++_0x294104);}(_0x3483,0x69));var _0x3348=function(_0x4d33b8,_0x20e563){_0x4d33b8=_0x4d33b8-0x0;var _0x10f97a=_0x3483[_0x4d33b8];return _0x10f97a;};'use strict';var _=require(_0x3348('0x0'));var util=require(_0x3348('0x1'));var moment=require('moment');var BPromise=require(_0x3348('0x2'));var rs=require(_0x3348('0x3'));var fs=require('fs');var Redis=require(_0x3348('0x4'));var db=require(_0x3348('0x5'))['db'];var utils=require(_0x3348('0x6'));var logger=require(_0x3348('0x7'))(_0x3348('0x8'));var config=require('../../config/environment');var jayson=require(_0x3348('0x9'));var client=jayson['client'][_0x3348('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x4fb535,_0x415d7d,_0x2563d6){return new BPromise(function(_0x302958,_0x2098db){return client[_0x3348('0xb')](_0x4fb535,_0x2563d6)[_0x3348('0xc')](function(_0x4aa180){logger[_0x3348('0xd')](_0x3348('0xe'),_0x415d7d,_0x3348('0xf'));logger[_0x3348('0x10')](_0x3348('0x11'),_0x415d7d,'request\x20sent',JSON['stringify'](_0x4aa180));if(_0x4aa180[_0x3348('0x12')]){if(_0x4aa180[_0x3348('0x12')][_0x3348('0x13')]===0x1f4){logger[_0x3348('0x12')](_0x3348('0xe'),_0x415d7d,_0x4aa180[_0x3348('0x12')][_0x3348('0x14')]);return _0x2098db(_0x4aa180[_0x3348('0x12')][_0x3348('0x14')]);}logger[_0x3348('0x12')](_0x3348('0xe'),_0x415d7d,_0x4aa180['error'][_0x3348('0x14')]);return _0x302958(_0x4aa180[_0x3348('0x12')][_0x3348('0x14')]);}else{logger['info'](_0x3348('0xe'),_0x415d7d,'request\x20sent');_0x302958(_0x4aa180['result'][_0x3348('0x14')]);}})[_0x3348('0x15')](function(_0x258d46){logger[_0x3348('0x12')](_0x3348('0xe'),_0x415d7d,_0x258d46);_0x2098db(_0x258d46);});});}exports[_0x3348('0x16')]=function(_0x5aee30){var _0x25ecc7=this;return new Promise(function(_0x549215,_0x1cdb69){return db[_0x3348('0x17')][_0x3348('0x18')](_0x5aee30['body'],{'raw':_0x5aee30[_0x3348('0x19')]?_0x5aee30[_0x3348('0x19')]['raw']===undefined?!![]:![]:!![]})['then'](function(_0x5f0ab8){logger['info'](_0x3348('0x16'),_0x5aee30);logger[_0x3348('0x10')](_0x3348('0x16'),_0x5aee30,JSON[_0x3348('0x1a')](_0x5f0ab8));_0x549215(_0x5f0ab8);})[_0x3348('0x15')](function(_0x2292f5){logger[_0x3348('0x12')]('CreateVoiceAgentReport',_0x2292f5['message'],_0x5aee30);_0x1cdb69(_0x25ecc7[_0x3348('0x12')](0x1f4,_0x2292f5[_0x3348('0x14')]));});});};exports[_0x3348('0x1b')]=function(_0x3e90b1){var _0x56ee1d=this;return new Promise(function(_0xcfa9ee,_0x17364b){return db[_0x3348('0x17')][_0x3348('0x1c')](_0x3e90b1[_0x3348('0x1d')],{'raw':_0x3e90b1[_0x3348('0x19')]?_0x3e90b1[_0x3348('0x19')][_0x3348('0x1e')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x3e90b1[_0x3348('0x19')]?_0x3e90b1[_0x3348('0x19')]['where']||null:null,'attributes':_0x3e90b1[_0x3348('0x19')]?_0x3e90b1[_0x3348('0x19')][_0x3348('0x1f')]||null:null,'limit':_0x3e90b1['options']?_0x3e90b1['options']['limit']||null:null})[_0x3348('0xc')](function(_0x1bfd71){logger['info'](_0x3348('0x1b'),_0x3e90b1);logger['debug'](_0x3348('0x1b'),_0x3e90b1,JSON[_0x3348('0x1a')](_0x1bfd71));_0xcfa9ee(_0x1bfd71);})[_0x3348('0x15')](function(_0x139f68){logger[_0x3348('0x12')](_0x3348('0x1b'),_0x139f68[_0x3348('0x14')],_0x3e90b1);_0x17364b(_0x56ee1d['error'](0x1f4,_0x139f68[_0x3348('0x14')]));});});}; \ No newline at end of file diff --git a/server/api/voiceCallReport/index.js b/server/api/voiceCallReport/index.js index 7285aef..25e0f64 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 _0x8c79=['destroy','exports','multer','path','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','describe','/:id','show','create','put','update','delete'];(function(_0x3de4f8,_0x336c7d){var _0x3d81fc=function(_0x53b9f9){while(--_0x53b9f9){_0x3de4f8['push'](_0x3de4f8['shift']());}};_0x3d81fc(++_0x336c7d);}(_0x8c79,0x18e));var _0x98c7=function(_0x8c9741,_0x1362c8){_0x8c9741=_0x8c9741-0x0;var _0x580e3e=_0x8c79[_0x8c9741];return _0x580e3e;};'use strict';var multer=require(_0x98c7('0x0'));var util=require('util');var path=require(_0x98c7('0x1'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x98c7('0x2')]();var auth=require(_0x98c7('0x3'));var interaction=require(_0x98c7('0x4'));var config=require(_0x98c7('0x5'));var controller=require('./voiceCallReport.controller');router[_0x98c7('0x6')]('/',auth[_0x98c7('0x7')](),controller[_0x98c7('0x8')]);router[_0x98c7('0x6')]('/describe',auth[_0x98c7('0x7')](),controller[_0x98c7('0x9')]);router[_0x98c7('0x6')](_0x98c7('0xa'),auth[_0x98c7('0x7')](),controller[_0x98c7('0xb')]);router['post']('/',auth[_0x98c7('0x7')](),controller[_0x98c7('0xc')]);router[_0x98c7('0xd')]('/:id',auth[_0x98c7('0x7')](),controller[_0x98c7('0xe')]);router[_0x98c7('0xf')](_0x98c7('0xa'),auth[_0x98c7('0x7')](),controller[_0x98c7('0x10')]);module[_0x98c7('0x11')]=router; \ No newline at end of file +var _0x54e9=['multer','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','./voiceCallReport.controller','get','index','/describe','isAuthenticated','/:id','show','post','create','put','update','destroy'];(function(_0x30df75,_0x4fc699){var _0x2244e2=function(_0x1f2385){while(--_0x1f2385){_0x30df75['push'](_0x30df75['shift']());}};_0x2244e2(++_0x4fc699);}(_0x54e9,0x98));var _0x954e=function(_0x4724d9,_0x2be8f6){_0x4724d9=_0x4724d9-0x0;var _0x3c168d=_0x54e9[_0x4724d9];return _0x3c168d;};'use strict';var multer=require(_0x954e('0x0'));var util=require('util');var path=require(_0x954e('0x1'));var timeout=require(_0x954e('0x2'));var express=require(_0x954e('0x3'));var router=express[_0x954e('0x4')]();var auth=require(_0x954e('0x5'));var interaction=require(_0x954e('0x6'));var config=require('../../config/environment');var controller=require(_0x954e('0x7'));router[_0x954e('0x8')]('/',auth['isAuthenticated'](),controller[_0x954e('0x9')]);router[_0x954e('0x8')](_0x954e('0xa'),auth[_0x954e('0xb')](),controller['describe']);router[_0x954e('0x8')](_0x954e('0xc'),auth[_0x954e('0xb')](),controller[_0x954e('0xd')]);router[_0x954e('0xe')]('/',auth[_0x954e('0xb')](),controller[_0x954e('0xf')]);router[_0x954e('0x10')](_0x954e('0xc'),auth[_0x954e('0xb')](),controller[_0x954e('0x11')]);router['delete'](_0x954e('0xc'),auth[_0x954e('0xb')](),controller[_0x954e('0x12')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/voiceCallReport/voiceCallReport.attributes.js b/server/api/voiceCallReport/voiceCallReport.attributes.js index d633c56..8b33181 100644 --- a/server/api/voiceCallReport/voiceCallReport.attributes.js +++ b/server/api/voiceCallReport/voiceCallReport.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa9e0=['dialer','DATE','INTEGER','sequelize','exports','STRING','internal','inbound-fax','outbound-fax'];(function(_0xdcca54,_0x4b2b61){var _0x453197=function(_0x806f6a){while(--_0x806f6a){_0xdcca54['push'](_0xdcca54['shift']());}};_0x453197(++_0x4b2b61);}(_0xa9e0,0x123));var _0x0a9e=function(_0x4dbaad,_0x730318){_0x4dbaad=_0x4dbaad-0x0;var _0x226c72=_0xa9e0[_0x4dbaad];return _0x226c72;};'use strict';var Sequelize=require(_0x0a9e('0x0'));module[_0x0a9e('0x1')]={'uniqueid':{'type':Sequelize[_0x0a9e('0x2')]},'type':{'type':Sequelize['ENUM']('inbound',_0x0a9e('0x3'),'outbound',_0x0a9e('0x4'),_0x0a9e('0x5'),_0x0a9e('0x6'))},'tag':{'type':Sequelize[_0x0a9e('0x2')]},'accountcode':{'type':Sequelize[_0x0a9e('0x2')]},'source':{'type':Sequelize['STRING']},'destination':{'type':Sequelize[_0x0a9e('0x2')]},'destinationcontext':{'type':Sequelize[_0x0a9e('0x2')]},'callerid':{'type':Sequelize[_0x0a9e('0x2')]},'channel':{'type':Sequelize['STRING']},'destinationchannel':{'type':Sequelize['STRING']},'lastapplication':{'type':Sequelize[_0x0a9e('0x2')]},'lastdata':{'type':Sequelize['TEXT']},'starttime':{'type':Sequelize['DATE']},'systemanswertime':{'type':Sequelize[_0x0a9e('0x7')]},'answertime':{'type':Sequelize[_0x0a9e('0x7')]},'endtime':{'type':Sequelize[_0x0a9e('0x7')]},'duration':{'type':Sequelize[_0x0a9e('0x8')]},'billableseconds':{'type':Sequelize[_0x0a9e('0x8')]},'mohtime':{'type':Sequelize[_0x0a9e('0x8')],'defaultValue':0x0},'disposition':{'type':Sequelize['STRING']},'amaflags':{'type':Sequelize['STRING']},'userfield':{'type':Sequelize['STRING']},'userDisposition':{'type':Sequelize['STRING']},'note':{'type':Sequelize[_0x0a9e('0x2')]},'prefix':{'type':Sequelize[_0x0a9e('0x2')]},'routeid':{'type':Sequelize[_0x0a9e('0x8')]},'sipcallid':{'type':Sequelize[_0x0a9e('0x2')]}}; \ No newline at end of file +var _0xa9e0=['dialer','DATE','INTEGER','sequelize','exports','STRING','internal','inbound-fax','outbound-fax'];(function(_0x4e7b37,_0x33b1fa){var _0x20b707=function(_0x1fb9ff){while(--_0x1fb9ff){_0x4e7b37['push'](_0x4e7b37['shift']());}};_0x20b707(++_0x33b1fa);}(_0xa9e0,0x123));var _0x0a9e=function(_0x1ddedd,_0x485606){_0x1ddedd=_0x1ddedd-0x0;var _0xa3e1ac=_0xa9e0[_0x1ddedd];return _0xa3e1ac;};'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 088c58e..ff5615e 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 _0x9057=['body','params','describe','uniqueid','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','util','path','to-csv','ejs','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','status','count','offset','limit','set','apply','reject','save','update','destroy','then','end','sendStatus','error','stack','name','index','map','rawAttributes','type','key','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','order','sort','where','pick','filter','merge','VIRTUAL','options','VoiceCallReport','includeAll','include','fullname','alias','User','findAll','rows','catch','find'];(function(_0x20c9b2,_0x55d7b1){var _0x2c6030=function(_0x10845f){while(--_0x10845f){_0x20c9b2['push'](_0x20c9b2['shift']());}};_0x2c6030(++_0x55d7b1);}(_0x9057,0x134));var _0x7905=function(_0x5ce3c8,_0x2503bd){_0x5ce3c8=_0x5ce3c8-0x0;var _0xa76867=_0x9057[_0x5ce3c8];return _0xa76867;};'use strict';var pdf=require(_0x7905('0x0'));var emlformat=require(_0x7905('0x1'));var rimraf=require(_0x7905('0x2'));var zipdir=require(_0x7905('0x3'));var jsonpatch=require(_0x7905('0x4'));var rp=require(_0x7905('0x5'));var moment=require(_0x7905('0x6'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x7905('0x7'));var path=require(_0x7905('0x8'));var sox=require('sox');var csv=require(_0x7905('0x9'));var ejs=require(_0x7905('0xa'));var fs=require('fs');var _=require('lodash');var squel=require('squel');var crypto=require(_0x7905('0xb'));var jsforce=require(_0x7905('0xc'));var deskjs=require(_0x7905('0xd'));var toCsv=require(_0x7905('0x9'));var querystring=require('querystring');var Papa=require(_0x7905('0xe'));var Redis=require(_0x7905('0xf'));var authService=require(_0x7905('0x10'));var qs=require(_0x7905('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x7905('0x12'));var logger=require(_0x7905('0x13'))(_0x7905('0x14'));var utils=require(_0x7905('0x15'));var config=require(_0x7905('0x16'));var db=require(_0x7905('0x17'))['db'];function respondWithStatusCode(_0x8f5522,_0x5a876c){_0x5a876c=_0x5a876c||0xcc;return function(_0x15c792){if(_0x15c792){return _0x8f5522['sendStatus'](_0x5a876c);}return _0x8f5522[_0x7905('0x18')](_0x5a876c)['end']();};}function respondWithResult(_0x45b9c4,_0xaaeb57){_0xaaeb57=_0xaaeb57||0xc8;return function(_0x25aa95){if(_0x25aa95){return _0x45b9c4[_0x7905('0x18')](_0xaaeb57)['json'](_0x25aa95);}};}function respondWithFilteredResult(_0x5d241f,_0x5c0aa4){return function(_0x216efe){if(_0x216efe){var _0x559e57=_0x216efe[_0x7905('0x19')],_0x5eda12=_0x5c0aa4[_0x7905('0x1a')],_0x29be60=_0x5c0aa4['offset']+_0x5c0aa4[_0x7905('0x1b')],_0x5b15db;if(_0x29be60>=_0x559e57){_0x29be60=_0x559e57;_0x5b15db=0xc8;}else{_0x5b15db=0xce;}_0x5d241f[_0x7905('0x18')](_0x5b15db);return _0x5d241f[_0x7905('0x1c')]('Content-Range',_0x5eda12+'-'+_0x29be60+'/'+_0x559e57)['json'](_0x216efe);}return null;};}function patchUpdates(_0x8d7eb3){return function(_0x3279df){try{jsonpatch[_0x7905('0x1d')](_0x3279df,_0x8d7eb3,!![]);}catch(_0x4dc929){return BPromise[_0x7905('0x1e')](_0x4dc929);}return _0x3279df[_0x7905('0x1f')]();};}function saveUpdates(_0x4ebf60,_0x3d8d32){return function(_0x30d71e){if(_0x30d71e){return _0x30d71e[_0x7905('0x20')](_0x4ebf60)['then'](function(_0x1bbab2){return _0x1bbab2;});}return null;};}function removeEntity(_0x13d925,_0x1442d2){return function(_0x6c35c9){if(_0x6c35c9){return _0x6c35c9[_0x7905('0x21')]()[_0x7905('0x22')](function(){_0x13d925[_0x7905('0x18')](0xcc)[_0x7905('0x23')]();});}};}function handleEntityNotFound(_0x29596f,_0x302faf){return function(_0x3af630){if(!_0x3af630){_0x29596f[_0x7905('0x24')](0x194);}return _0x3af630;};}function handleError(_0x1e05a3,_0xf31aa4){_0xf31aa4=_0xf31aa4||0x1f4;return function(_0x6fae19){logger[_0x7905('0x25')](_0x6fae19[_0x7905('0x26')]);if(_0x6fae19['name']){delete _0x6fae19[_0x7905('0x27')];}_0x1e05a3[_0x7905('0x18')](_0xf31aa4)['send'](_0x6fae19);};}exports[_0x7905('0x28')]=function(_0x22434f,_0x53310e){var _0x5b8617={},_0x52f67a={},_0x30d0af={'count':0x0,'rows':[]};var _0x1dda11=_[_0x7905('0x29')](db['VoiceCallReport'][_0x7905('0x2a')],function(_0x523e7a){return{'name':_0x523e7a['fieldName'],'type':_0x523e7a[_0x7905('0x2b')][_0x7905('0x2c')]};});_0x52f67a[_0x7905('0x2d')]=_[_0x7905('0x29')](_0x1dda11,_0x7905('0x27'));_0x52f67a[_0x7905('0x2e')]=_[_0x7905('0x2f')](_0x22434f['query']);_0x52f67a[_0x7905('0x30')]=_['intersection'](_0x52f67a[_0x7905('0x2d')],_0x52f67a[_0x7905('0x2e')]);_0x5b8617['attributes']=_[_0x7905('0x31')](_0x52f67a['model'],qs[_0x7905('0x32')](_0x22434f['query'][_0x7905('0x32')]));_0x5b8617[_0x7905('0x33')]=_0x5b8617[_0x7905('0x33')][_0x7905('0x34')]?_0x5b8617[_0x7905('0x33')]:_0x52f67a['model'];if(!_0x22434f[_0x7905('0x2e')][_0x7905('0x35')]('nolimit')){_0x5b8617['limit']=qs[_0x7905('0x1b')](_0x22434f[_0x7905('0x2e')][_0x7905('0x1b')]);_0x5b8617[_0x7905('0x1a')]=qs[_0x7905('0x1a')](_0x22434f[_0x7905('0x2e')][_0x7905('0x1a')]);}_0x5b8617[_0x7905('0x36')]=qs[_0x7905('0x37')](_0x22434f[_0x7905('0x2e')][_0x7905('0x37')]);_0x5b8617[_0x7905('0x38')]=qs[_0x7905('0x30')](_[_0x7905('0x39')](_0x22434f['query'],_0x52f67a['filters']));if(_0x22434f['query'][_0x7905('0x3a')]){_0x5b8617[_0x7905('0x38')]=_[_0x7905('0x3b')](_0x5b8617[_0x7905('0x38')],{'$or':_['map'](_0x1dda11,function(_0x446e03){if(_0x446e03['type']!==_0x7905('0x3c')){var _0x273508={};_0x273508[_0x446e03[_0x7905('0x27')]]={'$like':'%'+_0x22434f[_0x7905('0x2e')]['filter']+'%'};return _0x273508;}})});}_0x5b8617=_['merge']({},_0x5b8617,_0x22434f[_0x7905('0x3d')]);var _0xa358d9={'where':_0x5b8617[_0x7905('0x38')]};return db[_0x7905('0x3e')][_0x7905('0x19')](_0xa358d9)[_0x7905('0x22')](function(_0x262cb9){_0x30d0af['count']=_0x262cb9;if(_0x22434f[_0x7905('0x2e')][_0x7905('0x3f')]){_0x5b8617[_0x7905('0x40')]=[{'attributes':['id',_0x7905('0x27'),_0x7905('0x41'),_0x7905('0x42')],'model':db[_0x7905('0x43')],'as':_0x7905('0x43')}];}return db[_0x7905('0x3e')][_0x7905('0x44')](_0x5b8617);})[_0x7905('0x22')](function(_0x227ca4){_0x30d0af[_0x7905('0x45')]=_0x227ca4;return _0x30d0af;})[_0x7905('0x22')](respondWithFilteredResult(_0x53310e,_0x5b8617))[_0x7905('0x46')](handleError(_0x53310e,null));};exports['show']=function(_0xa6ac99,_0x46b8c9){var _0x17de63={'raw':!![],'where':{'id':_0xa6ac99['params']['id']}},_0x4e566a={};_0x4e566a[_0x7905('0x2d')]=_[_0x7905('0x2f')](db[_0x7905('0x3e')]['rawAttributes']);_0x4e566a[_0x7905('0x2e')]=_[_0x7905('0x2f')](_0xa6ac99[_0x7905('0x2e')]);_0x4e566a['filters']=_['intersection'](_0x4e566a[_0x7905('0x2d')],_0x4e566a['query']);_0x17de63[_0x7905('0x33')]=_[_0x7905('0x31')](_0x4e566a['model'],qs[_0x7905('0x32')](_0xa6ac99[_0x7905('0x2e')][_0x7905('0x32')]));_0x17de63['attributes']=_0x17de63[_0x7905('0x33')][_0x7905('0x34')]?_0x17de63[_0x7905('0x33')]:_0x4e566a[_0x7905('0x2d')];if(_0xa6ac99[_0x7905('0x2e')]['includeAll']){_0x17de63[_0x7905('0x40')]=[{'all':!![]}];}_0x17de63=_['merge']({},_0x17de63,_0xa6ac99[_0x7905('0x3d')]);return db[_0x7905('0x3e')][_0x7905('0x47')](_0x17de63)['then'](handleEntityNotFound(_0x46b8c9,null))[_0x7905('0x22')](respondWithResult(_0x46b8c9,null))[_0x7905('0x46')](handleError(_0x46b8c9,null));};exports['create']=function(_0x670b1c,_0x5db397){return db[_0x7905('0x3e')]['create'](_0x670b1c[_0x7905('0x48')],{})['then'](respondWithResult(_0x5db397,0xc9))[_0x7905('0x46')](handleError(_0x5db397,null));};exports[_0x7905('0x21')]=function(_0x1d54ea,_0x34a82c){return db[_0x7905('0x3e')][_0x7905('0x47')]({'where':{'id':_0x1d54ea[_0x7905('0x49')]['id']}})[_0x7905('0x22')](handleEntityNotFound(_0x34a82c,null))['then'](removeEntity(_0x34a82c,null))[_0x7905('0x46')](handleError(_0x34a82c,null));};exports[_0x7905('0x4a')]=function(_0x48434e,_0x4e767e){return db[_0x7905('0x3e')][_0x7905('0x4a')]()[_0x7905('0x22')](respondWithResult(_0x4e767e,null))[_0x7905('0x46')](handleError(_0x4e767e,null));};exports['update']=function(_0x253916,_0x380343){if(_0x253916[_0x7905('0x48')][_0x7905('0x4b')]){delete _0x253916[_0x7905('0x48')][_0x7905('0x4b')];}return db[_0x7905('0x3e')][_0x7905('0x47')]({'where':{'uniqueid':_0x253916[_0x7905('0x49')]['id'],'UserId':{'$or':[null,_0x253916['user']['id']]}}})[_0x7905('0x22')](handleEntityNotFound(_0x380343,null))[_0x7905('0x22')](saveUpdates(_0x253916[_0x7905('0x48')],null))['then'](respondWithResult(_0x380343,null))['catch'](handleError(_0x380343,null));}; \ No newline at end of file +var _0xf91f=['nolimit','order','sort','pick','filter','where','merge','include','fullname','User','findAll','rows','catch','params','options','find','destroy','describe','body','uniqueid','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','bluebird','mustache','util','sox','to-csv','ejs','lodash','squel','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../mysqldb','sendStatus','status','end','json','count','offset','limit','Content-Range','apply','save','update','then','error','stack','name','index','VoiceCallReport','rawAttributes','fieldName','type','key','model','map','query','keys','filters','intersection','fields','length','attributes','hasOwnProperty'];(function(_0x1918a8,_0x56f70a){var _0x194237=function(_0x38337c){while(--_0x38337c){_0x1918a8['push'](_0x1918a8['shift']());}};_0x194237(++_0x56f70a);}(_0xf91f,0xaa));var _0xff91=function(_0x43a8a6,_0x45a367){_0x43a8a6=_0x43a8a6-0x0;var _0x303e79=_0xf91f[_0x43a8a6];return _0x303e79;};'use strict';var pdf=require(_0xff91('0x0'));var emlformat=require(_0xff91('0x1'));var rimraf=require(_0xff91('0x2'));var zipdir=require(_0xff91('0x3'));var jsonpatch=require(_0xff91('0x4'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0xff91('0x5'));var Mustache=require(_0xff91('0x6'));var util=require(_0xff91('0x7'));var path=require('path');var sox=require(_0xff91('0x8'));var csv=require(_0xff91('0x9'));var ejs=require(_0xff91('0xa'));var fs=require('fs');var _=require(_0xff91('0xb'));var squel=require(_0xff91('0xc'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0xff91('0xd'));var toCsv=require(_0xff91('0x9'));var querystring=require(_0xff91('0xe'));var Papa=require(_0xff91('0xf'));var Redis=require(_0xff91('0x10'));var authService=require(_0xff91('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0xff91('0x12'));var hardwareService=require(_0xff91('0x13'));var logger=require(_0xff91('0x14'))(_0xff91('0x15'));var utils=require(_0xff91('0x16'));var config=require('../../config/environment');var db=require(_0xff91('0x17'))['db'];function respondWithStatusCode(_0x32ca83,_0x1b3e44){_0x1b3e44=_0x1b3e44||0xcc;return function(_0x53ec9a){if(_0x53ec9a){return _0x32ca83[_0xff91('0x18')](_0x1b3e44);}return _0x32ca83[_0xff91('0x19')](_0x1b3e44)[_0xff91('0x1a')]();};}function respondWithResult(_0x49f5d9,_0x297c40){_0x297c40=_0x297c40||0xc8;return function(_0xd8d9a4){if(_0xd8d9a4){return _0x49f5d9[_0xff91('0x19')](_0x297c40)[_0xff91('0x1b')](_0xd8d9a4);}};}function respondWithFilteredResult(_0x994c74,_0x4fcfed){return function(_0x7d873b){if(_0x7d873b){var _0x4a8c31=_0x7d873b[_0xff91('0x1c')],_0x4b8db7=_0x4fcfed['offset'],_0x1fcb4e=_0x4fcfed[_0xff91('0x1d')]+_0x4fcfed[_0xff91('0x1e')],_0x230a19;if(_0x1fcb4e>=_0x4a8c31){_0x1fcb4e=_0x4a8c31;_0x230a19=0xc8;}else{_0x230a19=0xce;}_0x994c74[_0xff91('0x19')](_0x230a19);return _0x994c74['set'](_0xff91('0x1f'),_0x4b8db7+'-'+_0x1fcb4e+'/'+_0x4a8c31)['json'](_0x7d873b);}return null;};}function patchUpdates(_0x47998e){return function(_0x4c7335){try{jsonpatch[_0xff91('0x20')](_0x4c7335,_0x47998e,!![]);}catch(_0x7a02c){return BPromise['reject'](_0x7a02c);}return _0x4c7335[_0xff91('0x21')]();};}function saveUpdates(_0x31afe4,_0x355a53){return function(_0x52dce6){if(_0x52dce6){return _0x52dce6[_0xff91('0x22')](_0x31afe4)[_0xff91('0x23')](function(_0x2ee096){return _0x2ee096;});}return null;};}function removeEntity(_0x1b761b,_0x508280){return function(_0x3f8f6c){if(_0x3f8f6c){return _0x3f8f6c['destroy']()[_0xff91('0x23')](function(){_0x1b761b[_0xff91('0x19')](0xcc)[_0xff91('0x1a')]();});}};}function handleEntityNotFound(_0xb1eb89,_0x4fd8c2){return function(_0x4c7fff){if(!_0x4c7fff){_0xb1eb89[_0xff91('0x18')](0x194);}return _0x4c7fff;};}function handleError(_0x1c05b7,_0x2b11b2){_0x2b11b2=_0x2b11b2||0x1f4;return function(_0x45b582){logger[_0xff91('0x24')](_0x45b582[_0xff91('0x25')]);if(_0x45b582[_0xff91('0x26')]){delete _0x45b582[_0xff91('0x26')];}_0x1c05b7['status'](_0x2b11b2)['send'](_0x45b582);};}exports[_0xff91('0x27')]=function(_0x12c382,_0x2422b9){var _0x1aeab9={},_0x5bc556={},_0x306557={'count':0x0,'rows':[]};var _0xfc2048=_['map'](db[_0xff91('0x28')][_0xff91('0x29')],function(_0x149233){return{'name':_0x149233[_0xff91('0x2a')],'type':_0x149233[_0xff91('0x2b')][_0xff91('0x2c')]};});_0x5bc556[_0xff91('0x2d')]=_[_0xff91('0x2e')](_0xfc2048,'name');_0x5bc556[_0xff91('0x2f')]=_[_0xff91('0x30')](_0x12c382['query']);_0x5bc556[_0xff91('0x31')]=_[_0xff91('0x32')](_0x5bc556[_0xff91('0x2d')],_0x5bc556[_0xff91('0x2f')]);_0x1aeab9['attributes']=_[_0xff91('0x32')](_0x5bc556[_0xff91('0x2d')],qs[_0xff91('0x33')](_0x12c382['query'][_0xff91('0x33')]));_0x1aeab9['attributes']=_0x1aeab9['attributes'][_0xff91('0x34')]?_0x1aeab9[_0xff91('0x35')]:_0x5bc556['model'];if(!_0x12c382[_0xff91('0x2f')][_0xff91('0x36')](_0xff91('0x37'))){_0x1aeab9[_0xff91('0x1e')]=qs[_0xff91('0x1e')](_0x12c382[_0xff91('0x2f')][_0xff91('0x1e')]);_0x1aeab9[_0xff91('0x1d')]=qs[_0xff91('0x1d')](_0x12c382[_0xff91('0x2f')][_0xff91('0x1d')]);}_0x1aeab9[_0xff91('0x38')]=qs[_0xff91('0x39')](_0x12c382[_0xff91('0x2f')][_0xff91('0x39')]);_0x1aeab9['where']=qs[_0xff91('0x31')](_[_0xff91('0x3a')](_0x12c382['query'],_0x5bc556[_0xff91('0x31')]));if(_0x12c382[_0xff91('0x2f')][_0xff91('0x3b')]){_0x1aeab9[_0xff91('0x3c')]=_['merge'](_0x1aeab9['where'],{'$or':_[_0xff91('0x2e')](_0xfc2048,function(_0x33bc0b){if(_0x33bc0b[_0xff91('0x2b')]!=='VIRTUAL'){var _0x33b42d={};_0x33b42d[_0x33bc0b[_0xff91('0x26')]]={'$like':'%'+_0x12c382['query']['filter']+'%'};return _0x33b42d;}})});}_0x1aeab9=_[_0xff91('0x3d')]({},_0x1aeab9,_0x12c382['options']);var _0x3944e0={'where':_0x1aeab9[_0xff91('0x3c')]};return db['VoiceCallReport']['count'](_0x3944e0)['then'](function(_0x5f005d){_0x306557[_0xff91('0x1c')]=_0x5f005d;if(_0x12c382[_0xff91('0x2f')]['includeAll']){_0x1aeab9[_0xff91('0x3e')]=[{'attributes':['id',_0xff91('0x26'),_0xff91('0x3f'),'alias'],'model':db[_0xff91('0x40')],'as':_0xff91('0x40')}];}return db[_0xff91('0x28')][_0xff91('0x41')](_0x1aeab9);})[_0xff91('0x23')](function(_0x26e322){_0x306557[_0xff91('0x42')]=_0x26e322;return _0x306557;})[_0xff91('0x23')](respondWithFilteredResult(_0x2422b9,_0x1aeab9))[_0xff91('0x43')](handleError(_0x2422b9,null));};exports['show']=function(_0x51fed4,_0x93ac77){var _0x25ce00={'raw':!![],'where':{'id':_0x51fed4[_0xff91('0x44')]['id']}},_0x2cc076={};_0x2cc076[_0xff91('0x2d')]=_['keys'](db['VoiceCallReport'][_0xff91('0x29')]);_0x2cc076[_0xff91('0x2f')]=_[_0xff91('0x30')](_0x51fed4['query']);_0x2cc076['filters']=_[_0xff91('0x32')](_0x2cc076[_0xff91('0x2d')],_0x2cc076['query']);_0x25ce00['attributes']=_['intersection'](_0x2cc076[_0xff91('0x2d')],qs[_0xff91('0x33')](_0x51fed4[_0xff91('0x2f')][_0xff91('0x33')]));_0x25ce00[_0xff91('0x35')]=_0x25ce00[_0xff91('0x35')][_0xff91('0x34')]?_0x25ce00[_0xff91('0x35')]:_0x2cc076['model'];if(_0x51fed4[_0xff91('0x2f')]['includeAll']){_0x25ce00[_0xff91('0x3e')]=[{'all':!![]}];}_0x25ce00=_[_0xff91('0x3d')]({},_0x25ce00,_0x51fed4[_0xff91('0x45')]);return db[_0xff91('0x28')][_0xff91('0x46')](_0x25ce00)[_0xff91('0x23')](handleEntityNotFound(_0x93ac77,null))[_0xff91('0x23')](respondWithResult(_0x93ac77,null))[_0xff91('0x43')](handleError(_0x93ac77,null));};exports['create']=function(_0x3fcff8,_0xd81c2e){return db['VoiceCallReport']['create'](_0x3fcff8['body'],{})[_0xff91('0x23')](respondWithResult(_0xd81c2e,0xc9))[_0xff91('0x43')](handleError(_0xd81c2e,null));};exports[_0xff91('0x47')]=function(_0x1f4ab0,_0x535b8f){return db[_0xff91('0x28')][_0xff91('0x46')]({'where':{'id':_0x1f4ab0[_0xff91('0x44')]['id']}})[_0xff91('0x23')](handleEntityNotFound(_0x535b8f,null))[_0xff91('0x23')](removeEntity(_0x535b8f,null))[_0xff91('0x43')](handleError(_0x535b8f,null));};exports[_0xff91('0x48')]=function(_0x14fa66,_0x65bf2e){return db[_0xff91('0x28')][_0xff91('0x48')]()['then'](respondWithResult(_0x65bf2e,null))['catch'](handleError(_0x65bf2e,null));};exports[_0xff91('0x22')]=function(_0x278497,_0x188ff7){if(_0x278497[_0xff91('0x49')][_0xff91('0x4a')]){delete _0x278497[_0xff91('0x49')][_0xff91('0x4a')];}return db[_0xff91('0x28')]['find']({'where':{'uniqueid':_0x278497[_0xff91('0x44')]['id'],'UserId':{'$or':[null,_0x278497['user']['id']]}}})[_0xff91('0x23')](handleEntityNotFound(_0x188ff7,null))[_0xff91('0x23')](saveUpdates(_0x278497[_0xff91('0x49')],null))['then'](respondWithResult(_0x188ff7,null))[_0xff91('0x43')](handleError(_0x188ff7,null));}; \ No newline at end of file diff --git a/server/api/voiceCallReport/voiceCallReport.model.js b/server/api/voiceCallReport/voiceCallReport.model.js index bf8e845..bf63f88 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 _0x0b6f=['VoiceCallReport','report_call','uniqueid','lodash','api','moment','bluebird','request-promise','path','rimraf','exports','define'];(function(_0x157f0d,_0x493646){var _0x5f3dfe=function(_0x3e4bc5){while(--_0x3e4bc5){_0x157f0d['push'](_0x157f0d['shift']());}};_0x5f3dfe(++_0x493646);}(_0x0b6f,0x1b3));var _0xf0b6=function(_0x2212d1,_0x483fc8){_0x2212d1=_0x2212d1-0x0;var _0x15eec5=_0x0b6f[_0x2212d1];return _0x15eec5;};'use strict';var _=require(_0xf0b6('0x0'));var util=require('util');var logger=require('../../config/logger')(_0xf0b6('0x1'));var moment=require(_0xf0b6('0x2'));var BPromise=require(_0xf0b6('0x3'));var rp=require(_0xf0b6('0x4'));var fs=require('fs');var path=require(_0xf0b6('0x5'));var rimraf=require(_0xf0b6('0x6'));var config=require('../../config/environment');var attributes=require('./voiceCallReport.attributes');module[_0xf0b6('0x7')]=function(_0x4cb861,_0x44b01a){return _0x4cb861[_0xf0b6('0x8')](_0xf0b6('0x9'),attributes,{'tableName':_0xf0b6('0xa'),'paranoid':![],'indexes':[{'fields':[_0xf0b6('0xb')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x3cd9=['rimraf','../../config/environment','./voiceCallReport.attributes','exports','define','VoiceCallReport','report_call','uniqueid','util','../../config/logger','api','moment','request-promise','path'];(function(_0x51ed62,_0x574379){var _0x34aee3=function(_0x2958bc){while(--_0x2958bc){_0x51ed62['push'](_0x51ed62['shift']());}};_0x34aee3(++_0x574379);}(_0x3cd9,0x1ba));var _0x93cd=function(_0x3b56c0,_0xe100d8){_0x3b56c0=_0x3b56c0-0x0;var _0x377efe=_0x3cd9[_0x3b56c0];return _0x377efe;};'use strict';var _=require('lodash');var util=require(_0x93cd('0x0'));var logger=require(_0x93cd('0x1'))(_0x93cd('0x2'));var moment=require(_0x93cd('0x3'));var BPromise=require('bluebird');var rp=require(_0x93cd('0x4'));var fs=require('fs');var path=require(_0x93cd('0x5'));var rimraf=require(_0x93cd('0x6'));var config=require(_0x93cd('0x7'));var attributes=require(_0x93cd('0x8'));module[_0x93cd('0x9')]=function(_0x2445c6,_0x2a446c){return _0x2445c6[_0x93cd('0xa')](_0x93cd('0xb'),attributes,{'tableName':_0x93cd('0xc'),'paranoid':![],'indexes':[{'fields':[_0x93cd('0xd')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceCallReport/voiceCallReport.rpc.js b/server/api/voiceCallReport/voiceCallReport.rpc.js index 208816d..591cc2b 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 _0x6479=['VoiceCallReport,\x20%s,\x20%s','request\x20sent','debug','error','code','message','result','GetVoiceCallReport','VoiceCallReport','findAll','options','raw','limit','include','map','attributes','model','then','stringify','catch','CreateVoiceCallReport','UpdateVoiceCallReport','where','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','request','info'];(function(_0x703358,_0x4d84ae){var _0x13ebd3=function(_0x171ead){while(--_0x171ead){_0x703358['push'](_0x703358['shift']());}};_0x13ebd3(++_0x4d84ae);}(_0x6479,0xab));var _0x9647=function(_0x4ded16,_0x23fcbf){_0x4ded16=_0x4ded16-0x0;var _0x4a525a=_0x6479[_0x4ded16];return _0x4a525a;};'use strict';var _=require('lodash');var util=require(_0x9647('0x0'));var moment=require(_0x9647('0x1'));var BPromise=require(_0x9647('0x2'));var rs=require(_0x9647('0x3'));var fs=require('fs');var Redis=require(_0x9647('0x4'));var db=require(_0x9647('0x5'))['db'];var utils=require(_0x9647('0x6'));var logger=require(_0x9647('0x7'))(_0x9647('0x8'));var config=require(_0x9647('0x9'));var jayson=require('jayson/promise');var client=jayson[_0x9647('0xa')][_0x9647('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x4201a6,_0x12ab56,_0x5010e2){return new BPromise(function(_0x374555,_0x1b0b91){return client[_0x9647('0xc')](_0x4201a6,_0x5010e2)['then'](function(_0xce03a9){logger[_0x9647('0xd')](_0x9647('0xe'),_0x12ab56,_0x9647('0xf'));logger[_0x9647('0x10')]('VoiceCallReport,\x20%s,\x20%s,\x20%s',_0x12ab56,'request\x20sent',JSON['stringify'](_0xce03a9));if(_0xce03a9[_0x9647('0x11')]){if(_0xce03a9[_0x9647('0x11')][_0x9647('0x12')]===0x1f4){logger[_0x9647('0x11')](_0x9647('0xe'),_0x12ab56,_0xce03a9[_0x9647('0x11')][_0x9647('0x13')]);return _0x1b0b91(_0xce03a9[_0x9647('0x11')][_0x9647('0x13')]);}logger[_0x9647('0x11')]('VoiceCallReport,\x20%s,\x20%s',_0x12ab56,_0xce03a9['error']['message']);return _0x374555(_0xce03a9[_0x9647('0x11')][_0x9647('0x13')]);}else{logger['info'](_0x9647('0xe'),_0x12ab56,'request\x20sent');_0x374555(_0xce03a9[_0x9647('0x14')]['message']);}})['catch'](function(_0x167c5e){logger[_0x9647('0x11')](_0x9647('0xe'),_0x12ab56,_0x167c5e);_0x1b0b91(_0x167c5e);});});}exports[_0x9647('0x15')]=function(_0x47f4e4){var _0x464a9f=this;return new Promise(function(_0x8c7a47,_0x546ae2){return db[_0x9647('0x16')][_0x9647('0x17')]({'raw':_0x47f4e4[_0x9647('0x18')]?_0x47f4e4[_0x9647('0x18')][_0x9647('0x19')]===undefined?!![]:![]:!![],'where':_0x47f4e4[_0x9647('0x18')]?_0x47f4e4[_0x9647('0x18')]['where']||null:null,'attributes':_0x47f4e4[_0x9647('0x18')]?_0x47f4e4[_0x9647('0x18')]['attributes']||null:null,'limit':_0x47f4e4[_0x9647('0x18')]?_0x47f4e4[_0x9647('0x18')][_0x9647('0x1a')]||null:null,'include':_0x47f4e4[_0x9647('0x18')]?_0x47f4e4[_0x9647('0x18')][_0x9647('0x1b')]?_[_0x9647('0x1c')](_0x47f4e4['options'][_0x9647('0x1b')],function(_0x233587){return{'model':db[_0x233587['model']],'as':_0x233587['as'],'attributes':_0x233587[_0x9647('0x1d')],'include':_0x233587[_0x9647('0x1b')]?_[_0x9647('0x1c')](_0x233587[_0x9647('0x1b')],function(_0x255faa){return{'model':db[_0x255faa[_0x9647('0x1e')]],'as':_0x255faa['as'],'attributes':_0x255faa[_0x9647('0x1d')],'include':_0x255faa['include']?_['map'](_0x255faa[_0x9647('0x1b')],function(_0x4bf54c){return{'model':db[_0x4bf54c[_0x9647('0x1e')]],'as':_0x4bf54c['as'],'attributes':_0x4bf54c[_0x9647('0x1d')]};}):[]};}):[]};}):[]:[]})[_0x9647('0x1f')](function(_0x361042){logger['info']('GetVoiceCallReport',_0x47f4e4);logger[_0x9647('0x10')](_0x9647('0x15'),_0x47f4e4,JSON[_0x9647('0x20')](_0x361042));_0x8c7a47(_0x361042);})[_0x9647('0x21')](function(_0x1fb6a9){logger[_0x9647('0x11')](_0x9647('0x15'),_0x1fb6a9['message'],_0x47f4e4);_0x546ae2(_0x464a9f[_0x9647('0x11')](0x1f4,_0x1fb6a9[_0x9647('0x13')]));});});};exports[_0x9647('0x22')]=function(_0x26cbdb){var _0x112611=this;return new Promise(function(_0x1656de,_0x2e902b){return db['VoiceCallReport']['create'](_0x26cbdb['body'],{'raw':_0x26cbdb[_0x9647('0x18')]?_0x26cbdb[_0x9647('0x18')][_0x9647('0x19')]===undefined?!![]:![]:!![]})[_0x9647('0x1f')](function(_0x1f5d3f){logger[_0x9647('0xd')](_0x9647('0x22'),_0x26cbdb);logger[_0x9647('0x10')](_0x9647('0x22'),_0x26cbdb,JSON['stringify'](_0x1f5d3f));_0x1656de(_0x1f5d3f);})[_0x9647('0x21')](function(_0x362d50){logger[_0x9647('0x11')](_0x9647('0x22'),_0x362d50['message'],_0x26cbdb);_0x2e902b(_0x112611[_0x9647('0x11')](0x1f4,_0x362d50[_0x9647('0x13')]));});});};exports[_0x9647('0x23')]=function(_0x47bc73){var _0x32aa96=this;return new Promise(function(_0x48bb1f,_0x1208cc){return db[_0x9647('0x16')]['update'](_0x47bc73['body'],{'raw':_0x47bc73[_0x9647('0x18')]?_0x47bc73[_0x9647('0x18')][_0x9647('0x19')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x47bc73[_0x9647('0x18')]?_0x47bc73[_0x9647('0x18')][_0x9647('0x24')]||null:null,'attributes':_0x47bc73[_0x9647('0x18')]?_0x47bc73[_0x9647('0x18')][_0x9647('0x1d')]||null:null,'limit':_0x47bc73['options']?_0x47bc73[_0x9647('0x18')][_0x9647('0x1a')]||null:null})['then'](function(_0x18bbef){logger[_0x9647('0xd')](_0x9647('0x23'),_0x47bc73);logger[_0x9647('0x10')](_0x9647('0x23'),_0x47bc73,JSON['stringify'](_0x18bbef));_0x48bb1f(_0x18bbef);})[_0x9647('0x21')](function(_0x41f291){logger[_0x9647('0x11')](_0x9647('0x23'),_0x41f291[_0x9647('0x13')],_0x47bc73);_0x1208cc(_0x32aa96[_0x9647('0x11')](0x1f4,_0x41f291[_0x9647('0x13')]));});});}; \ No newline at end of file +var _0x85f2=['update','UpdateVoiceCallReport','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','request','info','VoiceCallReport,\x20%s,\x20%s','request\x20sent','debug','error','code','message','result','GetVoiceCallReport','VoiceCallReport','findAll','options','raw','where','attributes','limit','include','model','map','then','catch','CreateVoiceCallReport','body','stringify'];(function(_0xa1e3e3,_0x29fe0e){var _0xc980e9=function(_0x1f5adc){while(--_0x1f5adc){_0xa1e3e3['push'](_0xa1e3e3['shift']());}};_0xc980e9(++_0x29fe0e);}(_0x85f2,0x7a));var _0x285f=function(_0x398b3d,_0x2f497e){_0x398b3d=_0x398b3d-0x0;var _0x20b1cf=_0x85f2[_0x398b3d];return _0x20b1cf;};'use strict';var _=require(_0x285f('0x0'));var util=require(_0x285f('0x1'));var moment=require(_0x285f('0x2'));var BPromise=require(_0x285f('0x3'));var rs=require(_0x285f('0x4'));var fs=require('fs');var Redis=require(_0x285f('0x5'));var db=require(_0x285f('0x6'))['db'];var utils=require(_0x285f('0x7'));var logger=require('../../config/logger')(_0x285f('0x8'));var config=require(_0x285f('0x9'));var jayson=require(_0x285f('0xa'));var client=jayson[_0x285f('0xb')][_0x285f('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x424846,_0xd65237,_0x1d5a74){return new BPromise(function(_0x4a3e46,_0x1f7efb){return client[_0x285f('0xd')](_0x424846,_0x1d5a74)['then'](function(_0x3a1ffb){logger[_0x285f('0xe')](_0x285f('0xf'),_0xd65237,_0x285f('0x10'));logger[_0x285f('0x11')]('VoiceCallReport,\x20%s,\x20%s,\x20%s',_0xd65237,'request\x20sent',JSON['stringify'](_0x3a1ffb));if(_0x3a1ffb[_0x285f('0x12')]){if(_0x3a1ffb[_0x285f('0x12')][_0x285f('0x13')]===0x1f4){logger[_0x285f('0x12')]('VoiceCallReport,\x20%s,\x20%s',_0xd65237,_0x3a1ffb[_0x285f('0x12')]['message']);return _0x1f7efb(_0x3a1ffb[_0x285f('0x12')][_0x285f('0x14')]);}logger[_0x285f('0x12')](_0x285f('0xf'),_0xd65237,_0x3a1ffb[_0x285f('0x12')][_0x285f('0x14')]);return _0x4a3e46(_0x3a1ffb['error'][_0x285f('0x14')]);}else{logger[_0x285f('0xe')]('VoiceCallReport,\x20%s,\x20%s',_0xd65237,'request\x20sent');_0x4a3e46(_0x3a1ffb[_0x285f('0x15')][_0x285f('0x14')]);}})['catch'](function(_0x11cb27){logger[_0x285f('0x12')](_0x285f('0xf'),_0xd65237,_0x11cb27);_0x1f7efb(_0x11cb27);});});}exports[_0x285f('0x16')]=function(_0x17ac84){var _0x328eee=this;return new Promise(function(_0x34362d,_0x2fafdb){return db[_0x285f('0x17')][_0x285f('0x18')]({'raw':_0x17ac84[_0x285f('0x19')]?_0x17ac84[_0x285f('0x19')][_0x285f('0x1a')]===undefined?!![]:![]:!![],'where':_0x17ac84[_0x285f('0x19')]?_0x17ac84['options'][_0x285f('0x1b')]||null:null,'attributes':_0x17ac84['options']?_0x17ac84['options'][_0x285f('0x1c')]||null:null,'limit':_0x17ac84['options']?_0x17ac84[_0x285f('0x19')][_0x285f('0x1d')]||null:null,'include':_0x17ac84['options']?_0x17ac84[_0x285f('0x19')][_0x285f('0x1e')]?_['map'](_0x17ac84[_0x285f('0x19')][_0x285f('0x1e')],function(_0x59e1cf){return{'model':db[_0x59e1cf[_0x285f('0x1f')]],'as':_0x59e1cf['as'],'attributes':_0x59e1cf[_0x285f('0x1c')],'include':_0x59e1cf['include']?_[_0x285f('0x20')](_0x59e1cf['include'],function(_0xe1272e){return{'model':db[_0xe1272e[_0x285f('0x1f')]],'as':_0xe1272e['as'],'attributes':_0xe1272e[_0x285f('0x1c')],'include':_0xe1272e['include']?_[_0x285f('0x20')](_0xe1272e['include'],function(_0x4429d2){return{'model':db[_0x4429d2['model']],'as':_0x4429d2['as'],'attributes':_0x4429d2['attributes']};}):[]};}):[]};}):[]:[]})[_0x285f('0x21')](function(_0xe1dda1){logger['info'](_0x285f('0x16'),_0x17ac84);logger[_0x285f('0x11')](_0x285f('0x16'),_0x17ac84,JSON['stringify'](_0xe1dda1));_0x34362d(_0xe1dda1);})[_0x285f('0x22')](function(_0x45eaba){logger[_0x285f('0x12')](_0x285f('0x16'),_0x45eaba[_0x285f('0x14')],_0x17ac84);_0x2fafdb(_0x328eee[_0x285f('0x12')](0x1f4,_0x45eaba[_0x285f('0x14')]));});});};exports[_0x285f('0x23')]=function(_0x4f6cb3){var _0x4ee7b4=this;return new Promise(function(_0x114424,_0x55ea4b){return db[_0x285f('0x17')]['create'](_0x4f6cb3[_0x285f('0x24')],{'raw':_0x4f6cb3[_0x285f('0x19')]?_0x4f6cb3[_0x285f('0x19')][_0x285f('0x1a')]===undefined?!![]:![]:!![]})[_0x285f('0x21')](function(_0x3146ca){logger[_0x285f('0xe')](_0x285f('0x23'),_0x4f6cb3);logger['debug'](_0x285f('0x23'),_0x4f6cb3,JSON[_0x285f('0x25')](_0x3146ca));_0x114424(_0x3146ca);})[_0x285f('0x22')](function(_0xf0c966){logger[_0x285f('0x12')](_0x285f('0x23'),_0xf0c966[_0x285f('0x14')],_0x4f6cb3);_0x55ea4b(_0x4ee7b4[_0x285f('0x12')](0x1f4,_0xf0c966[_0x285f('0x14')]));});});};exports['UpdateVoiceCallReport']=function(_0x3a81b0){var _0x3b35fb=this;return new Promise(function(_0x30bb34,_0x3d3a20){return db[_0x285f('0x17')][_0x285f('0x26')](_0x3a81b0[_0x285f('0x24')],{'raw':_0x3a81b0['options']?_0x3a81b0[_0x285f('0x19')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x3a81b0['options']?_0x3a81b0[_0x285f('0x19')][_0x285f('0x1b')]||null:null,'attributes':_0x3a81b0[_0x285f('0x19')]?_0x3a81b0[_0x285f('0x19')]['attributes']||null:null,'limit':_0x3a81b0['options']?_0x3a81b0[_0x285f('0x19')][_0x285f('0x1d')]||null:null})[_0x285f('0x21')](function(_0x3ff770){logger['info']('UpdateVoiceCallReport',_0x3a81b0);logger['debug']('UpdateVoiceCallReport',_0x3a81b0,JSON[_0x285f('0x25')](_0x3ff770));_0x30bb34(_0x3ff770);})[_0x285f('0x22')](function(_0x222ebb){logger[_0x285f('0x12')](_0x285f('0x27'),_0x222ebb['message'],_0x3a81b0);_0x3d3a20(_0x3b35fb[_0x285f('0x12')](0x1f4,_0x222ebb[_0x285f('0x14')]));});});}; \ No newline at end of file diff --git a/server/api/voiceChanSpy/index.js b/server/api/voiceChanSpy/index.js index 1940494..ec065d4 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 _0x4ea5=['update','delete','destroy','multer','connect-timeout','express','Router','./voiceChanSpy.controller','get','isAuthenticated','index','/:id','show','post','create','put'];(function(_0x49aa7d,_0x5d46d8){var _0xdd0d26=function(_0x159df7){while(--_0x159df7){_0x49aa7d['push'](_0x49aa7d['shift']());}};_0xdd0d26(++_0x5d46d8);}(_0x4ea5,0xd3));var _0x54ea=function(_0x421cf8,_0x23152c){_0x421cf8=_0x421cf8-0x0;var _0x145c48=_0x4ea5[_0x421cf8];return _0x145c48;};'use strict';var multer=require(_0x54ea('0x0'));var util=require('util');var path=require('path');var timeout=require(_0x54ea('0x1'));var express=require(_0x54ea('0x2'));var router=express[_0x54ea('0x3')]();var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x54ea('0x4'));router[_0x54ea('0x5')]('/',auth[_0x54ea('0x6')](),controller[_0x54ea('0x7')]);router[_0x54ea('0x5')](_0x54ea('0x8'),auth[_0x54ea('0x6')](),controller[_0x54ea('0x9')]);router[_0x54ea('0xa')]('/',auth[_0x54ea('0x6')](),controller[_0x54ea('0xb')]);router[_0x54ea('0xc')]('/:id',auth['isAuthenticated'](),controller[_0x54ea('0xd')]);router[_0x54ea('0xe')](_0x54ea('0x8'),auth[_0x54ea('0x6')](),controller[_0x54ea('0xf')]);module['exports']=router; \ No newline at end of file +var _0x12fa=['path','express','Router','../../components/auth/service','../../components/interaction/service','./voiceChanSpy.controller','get','isAuthenticated','index','/:id','show','put','update','destroy','exports','multer','util'];(function(_0x22294b,_0x5b8228){var _0xdfed1e=function(_0x4882fb){while(--_0x4882fb){_0x22294b['push'](_0x22294b['shift']());}};_0xdfed1e(++_0x5b8228);}(_0x12fa,0x130));var _0xa12f=function(_0xedbfd,_0x3df491){_0xedbfd=_0xedbfd-0x0;var _0x3b0cff=_0x12fa[_0xedbfd];return _0x3b0cff;};'use strict';var multer=require(_0xa12f('0x0'));var util=require(_0xa12f('0x1'));var path=require(_0xa12f('0x2'));var timeout=require('connect-timeout');var express=require(_0xa12f('0x3'));var router=express[_0xa12f('0x4')]();var auth=require(_0xa12f('0x5'));var interaction=require(_0xa12f('0x6'));var config=require('../../config/environment');var controller=require(_0xa12f('0x7'));router[_0xa12f('0x8')]('/',auth[_0xa12f('0x9')](),controller[_0xa12f('0xa')]);router[_0xa12f('0x8')](_0xa12f('0xb'),auth[_0xa12f('0x9')](),controller[_0xa12f('0xc')]);router['post']('/',auth[_0xa12f('0x9')](),controller['create']);router[_0xa12f('0xd')](_0xa12f('0xb'),auth[_0xa12f('0x9')](),controller[_0xa12f('0xe')]);router['delete'](_0xa12f('0xb'),auth[_0xa12f('0x9')](),controller[_0xa12f('0xf')]);module[_0xa12f('0x10')]=router; \ No newline at end of file diff --git a/server/api/voiceChanSpy/voiceChanSpy.attributes.js b/server/api/voiceChanSpy/voiceChanSpy.attributes.js index 72aaa7d..2fec461 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 _0xc11e=['name','setDataValue','options','join','getDataValue','split','BOOLEAN','sequelize','exports','STRING'];(function(_0x58f420,_0x202565){var _0x5e195b=function(_0x16c663){while(--_0x16c663){_0x58f420['push'](_0x58f420['shift']());}};_0x5e195b(++_0x202565);}(_0xc11e,0x1d3));var _0xec11=function(_0x568f96,_0x32d489){_0x568f96=_0x568f96-0x0;var _0x5a053a=_0xc11e[_0x568f96];return _0x5a053a;};'use strict';var Sequelize=require(_0xec11('0x0'));module[_0xec11('0x1')]={'name':{'type':Sequelize['STRING']},'prefix':{'type':Sequelize[_0xec11('0x2')],'unique':_0xec11('0x3'),'allowNull':![]},'options':{'type':Sequelize['STRING'],'set':function(_0x551990){this[_0xec11('0x4')](_0xec11('0x5'),_0x551990?_0x551990[_0xec11('0x6')](''):[]);},'get':function(){return this['getDataValue'](_0xec11('0x5'))?this[_0xec11('0x7')]('options')[_0xec11('0x8')](''):[];}},'auth':{'type':Sequelize[_0xec11('0x9')],'defaultValue':![]},'password':{'type':Sequelize[_0xec11('0x2')]},'record':{'type':Sequelize[_0xec11('0x9')],'defaultValue':![]},'recordingFormat':{'type':Sequelize[_0xec11('0x2')]},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x3255=['STRING','name','setDataValue','options','join','getDataValue','split','BOOLEAN','sequelize'];(function(_0x577077,_0x52f056){var _0x370769=function(_0x34d109){while(--_0x34d109){_0x577077['push'](_0x577077['shift']());}};_0x370769(++_0x52f056);}(_0x3255,0x194));var _0x5325=function(_0x31f057,_0x40a380){_0x31f057=_0x31f057-0x0;var _0x54019e=_0x3255[_0x31f057];return _0x54019e;};'use strict';var Sequelize=require(_0x5325('0x0'));module['exports']={'name':{'type':Sequelize[_0x5325('0x1')]},'prefix':{'type':Sequelize[_0x5325('0x1')],'unique':_0x5325('0x2'),'allowNull':![]},'options':{'type':Sequelize[_0x5325('0x1')],'set':function(_0x1f30c2){this[_0x5325('0x3')](_0x5325('0x4'),_0x1f30c2?_0x1f30c2[_0x5325('0x5')](''):[]);},'get':function(){return this[_0x5325('0x6')]('options')?this[_0x5325('0x6')](_0x5325('0x4'))[_0x5325('0x7')](''):[];}},'auth':{'type':Sequelize[_0x5325('0x8')],'defaultValue':![]},'password':{'type':Sequelize[_0x5325('0x1')]},'record':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'recordingFormat':{'type':Sequelize[_0x5325('0x1')]},'description':{'type':Sequelize[_0x5325('0x1')]}}; \ No newline at end of file diff --git a/server/api/voiceChanSpy/voiceChanSpy.controller.js b/server/api/voiceChanSpy/voiceChanSpy.controller.js index d504103..d2ded48 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 _0xd33c=['index','map','VoiceChanSpy','key','query','keys','filters','intersection','model','fields','attributes','length','hasOwnProperty','nolimit','where','pick','filter','merge','type','VIRTUAL','options','includeAll','include','findAll','catch','show','params','find','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','ChanSpies','UserProfileSection','userProfileId','autoAssociation','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','count','offset','limit','Content-Range','apply','save','update','then','destroy','get','UserProfileResource','stack','name'];(function(_0x2d0081,_0x1419f4){var _0xb7f5cd=function(_0x5bca4c){while(--_0x5bca4c){_0x2d0081['push'](_0x2d0081['shift']());}};_0xb7f5cd(++_0x1419f4);}(_0xd33c,0x16e));var _0xcd33=function(_0xbca1b1,_0x33f0ce){_0xbca1b1=_0xbca1b1-0x0;var _0x4e1686=_0xd33c[_0xbca1b1];return _0x4e1686;};'use strict';var pdf=require(_0xcd33('0x0'));var emlformat=require(_0xcd33('0x1'));var rimraf=require(_0xcd33('0x2'));var zipdir=require(_0xcd33('0x3'));var jsonpatch=require(_0xcd33('0x4'));var rp=require(_0xcd33('0x5'));var moment=require('moment');var BPromise=require(_0xcd33('0x6'));var Mustache=require(_0xcd33('0x7'));var util=require(_0xcd33('0x8'));var path=require(_0xcd33('0x9'));var sox=require('sox');var csv=require(_0xcd33('0xa'));var ejs=require(_0xcd33('0xb'));var fs=require('fs');var _=require(_0xcd33('0xc'));var squel=require(_0xcd33('0xd'));var crypto=require(_0xcd33('0xe'));var jsforce=require(_0xcd33('0xf'));var deskjs=require(_0xcd33('0x10'));var toCsv=require(_0xcd33('0xa'));var querystring=require(_0xcd33('0x11'));var Papa=require(_0xcd33('0x12'));var Redis=require('ioredis');var authService=require(_0xcd33('0x13'));var qs=require(_0xcd33('0x14'));var as=require(_0xcd33('0x15'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xcd33('0x16'))(_0xcd33('0x17'));var utils=require(_0xcd33('0x18'));var config=require(_0xcd33('0x19'));var db=require(_0xcd33('0x1a'))['db'];function respondWithStatusCode(_0x3303da,_0xcb94ce){_0xcb94ce=_0xcb94ce||0xcc;return function(_0x5b4c1f){if(_0x5b4c1f){return _0x3303da[_0xcd33('0x1b')](_0xcb94ce);}return _0x3303da[_0xcd33('0x1c')](_0xcb94ce)[_0xcd33('0x1d')]();};}function respondWithResult(_0x3c6d8b,_0x498e7d){_0x498e7d=_0x498e7d||0xc8;return function(_0x4c61fb){if(_0x4c61fb){return _0x3c6d8b['status'](_0x498e7d)[_0xcd33('0x1e')](_0x4c61fb);}};}function respondWithFilteredResult(_0x286f37,_0x3bd37f){return function(_0x54060a){if(_0x54060a){var _0x552bad=_0x54060a[_0xcd33('0x1f')],_0x21c12e=_0x3bd37f[_0xcd33('0x20')],_0x59760a=_0x3bd37f[_0xcd33('0x20')]+_0x3bd37f[_0xcd33('0x21')],_0x191020;if(_0x59760a>=_0x552bad){_0x59760a=_0x552bad;_0x191020=0xc8;}else{_0x191020=0xce;}_0x286f37[_0xcd33('0x1c')](_0x191020);return _0x286f37['set'](_0xcd33('0x22'),_0x21c12e+'-'+_0x59760a+'/'+_0x552bad)[_0xcd33('0x1e')](_0x54060a);}return null;};}function patchUpdates(_0x14643c){return function(_0x1860cd){try{jsonpatch[_0xcd33('0x23')](_0x1860cd,_0x14643c,!![]);}catch(_0x5403dc){return BPromise['reject'](_0x5403dc);}return _0x1860cd[_0xcd33('0x24')]();};}function saveUpdates(_0x2eb6ed,_0x444d30){return function(_0x46b364){if(_0x46b364){return _0x46b364[_0xcd33('0x25')](_0x2eb6ed)[_0xcd33('0x26')](function(_0x2ca42e){return _0x2ca42e;});}return null;};}function removeEntity(_0x440ed1,_0x3d78ed){return function(_0x20f11c){if(_0x20f11c){return _0x20f11c[_0xcd33('0x27')]()[_0xcd33('0x26')](function(){var _0x6364ce=_0x20f11c[_0xcd33('0x28')]({'plain':!![]});var _0x465fec='ChanSpies';return db[_0xcd33('0x29')][_0xcd33('0x27')]({'where':{'type':_0x465fec,'resourceId':_0x6364ce['id']}})['then'](function(){return _0x20f11c;});})['then'](function(){_0x440ed1['status'](0xcc)[_0xcd33('0x1d')]();});}};}function handleEntityNotFound(_0x184e37,_0x210f2c){return function(_0x230a14){if(!_0x230a14){_0x184e37['sendStatus'](0x194);}return _0x230a14;};}function handleError(_0x365a99,_0x38eed9){_0x38eed9=_0x38eed9||0x1f4;return function(_0x57fd7f){logger['error'](_0x57fd7f[_0xcd33('0x2a')]);if(_0x57fd7f['name']){delete _0x57fd7f[_0xcd33('0x2b')];}_0x365a99[_0xcd33('0x1c')](_0x38eed9)['send'](_0x57fd7f);};}exports[_0xcd33('0x2c')]=function(_0x3d9e13,_0x1474b1){var _0x32dd9d={},_0x43ca48={},_0x483ae8={'count':0x0,'rows':[]};var _0x9c855b=_[_0xcd33('0x2d')](db[_0xcd33('0x2e')]['rawAttributes'],function(_0x92a9e7){return{'name':_0x92a9e7['fieldName'],'type':_0x92a9e7['type'][_0xcd33('0x2f')]};});_0x43ca48['model']=_[_0xcd33('0x2d')](_0x9c855b,_0xcd33('0x2b'));_0x43ca48[_0xcd33('0x30')]=_[_0xcd33('0x31')](_0x3d9e13['query']);_0x43ca48[_0xcd33('0x32')]=_[_0xcd33('0x33')](_0x43ca48[_0xcd33('0x34')],_0x43ca48[_0xcd33('0x30')]);_0x32dd9d['attributes']=_[_0xcd33('0x33')](_0x43ca48[_0xcd33('0x34')],qs[_0xcd33('0x35')](_0x3d9e13[_0xcd33('0x30')][_0xcd33('0x35')]));_0x32dd9d[_0xcd33('0x36')]=_0x32dd9d['attributes'][_0xcd33('0x37')]?_0x32dd9d[_0xcd33('0x36')]:_0x43ca48[_0xcd33('0x34')];if(!_0x3d9e13['query'][_0xcd33('0x38')](_0xcd33('0x39'))){_0x32dd9d['limit']=qs['limit'](_0x3d9e13['query'][_0xcd33('0x21')]);_0x32dd9d['offset']=qs[_0xcd33('0x20')](_0x3d9e13[_0xcd33('0x30')][_0xcd33('0x20')]);}_0x32dd9d['order']=qs['sort'](_0x3d9e13[_0xcd33('0x30')]['sort']);_0x32dd9d[_0xcd33('0x3a')]=qs['filters'](_[_0xcd33('0x3b')](_0x3d9e13[_0xcd33('0x30')],_0x43ca48[_0xcd33('0x32')]));if(_0x3d9e13[_0xcd33('0x30')][_0xcd33('0x3c')]){_0x32dd9d[_0xcd33('0x3a')]=_[_0xcd33('0x3d')](_0x32dd9d[_0xcd33('0x3a')],{'$or':_['map'](_0x9c855b,function(_0x21cdc7){if(_0x21cdc7[_0xcd33('0x3e')]!==_0xcd33('0x3f')){var _0x78115a={};_0x78115a[_0x21cdc7[_0xcd33('0x2b')]]={'$like':'%'+_0x3d9e13[_0xcd33('0x30')]['filter']+'%'};return _0x78115a;}})});}_0x32dd9d=_[_0xcd33('0x3d')]({},_0x32dd9d,_0x3d9e13[_0xcd33('0x40')]);var _0xf729fc={'where':_0x32dd9d[_0xcd33('0x3a')]};return db[_0xcd33('0x2e')][_0xcd33('0x1f')](_0xf729fc)[_0xcd33('0x26')](function(_0x84d3e6){_0x483ae8[_0xcd33('0x1f')]=_0x84d3e6;if(_0x3d9e13['query'][_0xcd33('0x41')]){_0x32dd9d[_0xcd33('0x42')]=[{'all':!![]}];}return db[_0xcd33('0x2e')][_0xcd33('0x43')](_0x32dd9d);})['then'](function(_0x471a2a){_0x483ae8['rows']=_0x471a2a;return _0x483ae8;})[_0xcd33('0x26')](respondWithFilteredResult(_0x1474b1,_0x32dd9d))[_0xcd33('0x44')](handleError(_0x1474b1,null));};exports[_0xcd33('0x45')]=function(_0x4e76c4,_0x7e0831){var _0x51001a={'raw':![],'where':{'id':_0x4e76c4[_0xcd33('0x46')]['id']}},_0x4ab8b2={};_0x4ab8b2[_0xcd33('0x34')]=_[_0xcd33('0x31')](db[_0xcd33('0x2e')]['rawAttributes']);_0x4ab8b2[_0xcd33('0x30')]=_[_0xcd33('0x31')](_0x4e76c4[_0xcd33('0x30')]);_0x4ab8b2[_0xcd33('0x32')]=_[_0xcd33('0x33')](_0x4ab8b2[_0xcd33('0x34')],_0x4ab8b2['query']);_0x51001a['attributes']=_[_0xcd33('0x33')](_0x4ab8b2['model'],qs[_0xcd33('0x35')](_0x4e76c4['query'][_0xcd33('0x35')]));_0x51001a[_0xcd33('0x36')]=_0x51001a['attributes'][_0xcd33('0x37')]?_0x51001a[_0xcd33('0x36')]:_0x4ab8b2['model'];if(_0x4e76c4[_0xcd33('0x30')]['includeAll']){_0x51001a[_0xcd33('0x42')]=[{'all':!![]}];}_0x51001a=_[_0xcd33('0x3d')]({},_0x51001a,_0x4e76c4[_0xcd33('0x40')]);return db[_0xcd33('0x2e')][_0xcd33('0x47')](_0x51001a)['then'](handleEntityNotFound(_0x7e0831,null))[_0xcd33('0x26')](respondWithResult(_0x7e0831,null))[_0xcd33('0x44')](handleError(_0x7e0831,null));};exports[_0xcd33('0x48')]=function(_0x2c3dd3,_0xb62596){return db[_0xcd33('0x2e')][_0xcd33('0x48')](_0x2c3dd3['body'],{})[_0xcd33('0x26')](function(_0x33de26){var _0x4290a7=_0x2c3dd3[_0xcd33('0x49')][_0xcd33('0x28')]({'plain':!![]});if(!_0x4290a7)throw new Error(_0xcd33('0x4a'));if(_0x4290a7['role']==='user'){var _0x45aadb=_0x33de26[_0xcd33('0x28')]({'plain':!![]});var _0x521607=_0xcd33('0x4b');return db[_0xcd33('0x4c')][_0xcd33('0x47')]({'where':{'name':_0x521607,'userProfileId':_0x4290a7[_0xcd33('0x4d')]},'raw':!![]})[_0xcd33('0x26')](function(_0x54ab79){if(_0x54ab79&&_0x54ab79[_0xcd33('0x4e')]===0x0){return db[_0xcd33('0x29')][_0xcd33('0x48')]({'name':_0x45aadb[_0xcd33('0x2b')],'resourceId':_0x45aadb['id'],'type':_0x54ab79[_0xcd33('0x2b')],'sectionId':_0x54ab79['id']},{})['then'](function(){return _0x33de26;});}else{return _0x33de26;}})[_0xcd33('0x44')](function(_0x2d0b58){logger[_0xcd33('0x4f')](_0xcd33('0x50'),_0x2d0b58);throw _0x2d0b58;});}return _0x33de26;})[_0xcd33('0x26')](respondWithResult(_0xb62596,0xc9))['catch'](handleError(_0xb62596,null));};exports['update']=function(_0x1fc46f,_0xee033e){if(_0x1fc46f['body']['id']){delete _0x1fc46f[_0xcd33('0x51')]['id'];}return db[_0xcd33('0x2e')][_0xcd33('0x47')]({'where':{'id':_0x1fc46f[_0xcd33('0x46')]['id']}})[_0xcd33('0x26')](handleEntityNotFound(_0xee033e,null))['then'](saveUpdates(_0x1fc46f[_0xcd33('0x51')],null))['then'](respondWithResult(_0xee033e,null))[_0xcd33('0x44')](handleError(_0xee033e,null));};exports['destroy']=function(_0x267297,_0x3191e2){return db[_0xcd33('0x2e')][_0xcd33('0x47')]({'where':{'id':_0x267297[_0xcd33('0x46')]['id']}})['then'](handleEntityNotFound(_0x3191e2,null))[_0xcd33('0x26')](removeEntity(_0x3191e2,null))[_0xcd33('0x44')](handleError(_0x3191e2,null));}; \ No newline at end of file +var _0x9c9b=['fast-json-patch','request-promise','moment','bluebird','util','path','sox','ejs','squel','jsforce','to-csv','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','end','count','offset','status','set','apply','reject','update','then','destroy','get','error','stack','name','send','index','rawAttributes','type','model','map','keys','query','filters','intersection','attributes','fields','length','limit','order','sort','where','pick','filter','merge','VIRTUAL','options','VoiceChanSpy','includeAll','findAll','show','params','include','catch','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','ChanSpies','find','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','html-pdf','eml-format','rimraf','zip-dir'];(function(_0x3ab51d,_0x2fa01d){var _0x29a04e=function(_0x7807b0){while(--_0x7807b0){_0x3ab51d['push'](_0x3ab51d['shift']());}};_0x29a04e(++_0x2fa01d);}(_0x9c9b,0x182));var _0xb9c9=function(_0x312aef,_0x25e4dd){_0x312aef=_0x312aef-0x0;var _0x142d60=_0x9c9b[_0x312aef];return _0x142d60;};'use strict';var pdf=require(_0xb9c9('0x0'));var emlformat=require(_0xb9c9('0x1'));var rimraf=require(_0xb9c9('0x2'));var zipdir=require(_0xb9c9('0x3'));var jsonpatch=require(_0xb9c9('0x4'));var rp=require(_0xb9c9('0x5'));var moment=require(_0xb9c9('0x6'));var BPromise=require(_0xb9c9('0x7'));var Mustache=require('mustache');var util=require(_0xb9c9('0x8'));var path=require(_0xb9c9('0x9'));var sox=require(_0xb9c9('0xa'));var csv=require('to-csv');var ejs=require(_0xb9c9('0xb'));var fs=require('fs');var _=require('lodash');var squel=require(_0xb9c9('0xc'));var crypto=require('crypto');var jsforce=require(_0xb9c9('0xd'));var deskjs=require('desk.js');var toCsv=require(_0xb9c9('0xe'));var querystring=require('querystring');var Papa=require(_0xb9c9('0xf'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0xb9c9('0x10'));var as=require(_0xb9c9('0x11'));var hardwareService=require(_0xb9c9('0x12'));var logger=require(_0xb9c9('0x13'))(_0xb9c9('0x14'));var utils=require(_0xb9c9('0x15'));var config=require(_0xb9c9('0x16'));var db=require(_0xb9c9('0x17'))['db'];function respondWithStatusCode(_0x48ad3f,_0x32e840){_0x32e840=_0x32e840||0xcc;return function(_0x5805ee){if(_0x5805ee){return _0x48ad3f[_0xb9c9('0x18')](_0x32e840);}return _0x48ad3f['status'](_0x32e840)[_0xb9c9('0x19')]();};}function respondWithResult(_0x2fb8a0,_0x5d0ea8){_0x5d0ea8=_0x5d0ea8||0xc8;return function(_0x2eebe9){if(_0x2eebe9){return _0x2fb8a0['status'](_0x5d0ea8)['json'](_0x2eebe9);}};}function respondWithFilteredResult(_0x243f22,_0x289450){return function(_0x59fc3d){if(_0x59fc3d){var _0x2ba644=_0x59fc3d[_0xb9c9('0x1a')],_0xa0f660=_0x289450['offset'],_0x3b0518=_0x289450[_0xb9c9('0x1b')]+_0x289450['limit'],_0x3150d5;if(_0x3b0518>=_0x2ba644){_0x3b0518=_0x2ba644;_0x3150d5=0xc8;}else{_0x3150d5=0xce;}_0x243f22[_0xb9c9('0x1c')](_0x3150d5);return _0x243f22[_0xb9c9('0x1d')]('Content-Range',_0xa0f660+'-'+_0x3b0518+'/'+_0x2ba644)['json'](_0x59fc3d);}return null;};}function patchUpdates(_0x45fba6){return function(_0x549f03){try{jsonpatch[_0xb9c9('0x1e')](_0x549f03,_0x45fba6,!![]);}catch(_0x1b06cf){return BPromise[_0xb9c9('0x1f')](_0x1b06cf);}return _0x549f03['save']();};}function saveUpdates(_0x1535bf,_0x39e19a){return function(_0x11e410){if(_0x11e410){return _0x11e410[_0xb9c9('0x20')](_0x1535bf)[_0xb9c9('0x21')](function(_0x2abbd4){return _0x2abbd4;});}return null;};}function removeEntity(_0x4dd3e0,_0x26a772){return function(_0x235be4){if(_0x235be4){return _0x235be4[_0xb9c9('0x22')]()['then'](function(){var _0x1fb6e5=_0x235be4[_0xb9c9('0x23')]({'plain':!![]});var _0x32407e='ChanSpies';return db['UserProfileResource'][_0xb9c9('0x22')]({'where':{'type':_0x32407e,'resourceId':_0x1fb6e5['id']}})['then'](function(){return _0x235be4;});})[_0xb9c9('0x21')](function(){_0x4dd3e0[_0xb9c9('0x1c')](0xcc)[_0xb9c9('0x19')]();});}};}function handleEntityNotFound(_0x42871b,_0x186e43){return function(_0x48c268){if(!_0x48c268){_0x42871b[_0xb9c9('0x18')](0x194);}return _0x48c268;};}function handleError(_0x28b29f,_0x2e94d5){_0x2e94d5=_0x2e94d5||0x1f4;return function(_0x17f710){logger[_0xb9c9('0x24')](_0x17f710[_0xb9c9('0x25')]);if(_0x17f710[_0xb9c9('0x26')]){delete _0x17f710[_0xb9c9('0x26')];}_0x28b29f[_0xb9c9('0x1c')](_0x2e94d5)[_0xb9c9('0x27')](_0x17f710);};}exports[_0xb9c9('0x28')]=function(_0x1297ba,_0x2a9e8c){var _0x34bf07={},_0x5ddf42={},_0x5e8c4a={'count':0x0,'rows':[]};var _0x208f83=_['map'](db['VoiceChanSpy'][_0xb9c9('0x29')],function(_0x1bb9e6){return{'name':_0x1bb9e6['fieldName'],'type':_0x1bb9e6[_0xb9c9('0x2a')]['key']};});_0x5ddf42[_0xb9c9('0x2b')]=_[_0xb9c9('0x2c')](_0x208f83,_0xb9c9('0x26'));_0x5ddf42['query']=_[_0xb9c9('0x2d')](_0x1297ba[_0xb9c9('0x2e')]);_0x5ddf42[_0xb9c9('0x2f')]=_[_0xb9c9('0x30')](_0x5ddf42[_0xb9c9('0x2b')],_0x5ddf42[_0xb9c9('0x2e')]);_0x34bf07[_0xb9c9('0x31')]=_['intersection'](_0x5ddf42[_0xb9c9('0x2b')],qs[_0xb9c9('0x32')](_0x1297ba[_0xb9c9('0x2e')][_0xb9c9('0x32')]));_0x34bf07[_0xb9c9('0x31')]=_0x34bf07[_0xb9c9('0x31')][_0xb9c9('0x33')]?_0x34bf07[_0xb9c9('0x31')]:_0x5ddf42[_0xb9c9('0x2b')];if(!_0x1297ba[_0xb9c9('0x2e')]['hasOwnProperty']('nolimit')){_0x34bf07[_0xb9c9('0x34')]=qs['limit'](_0x1297ba[_0xb9c9('0x2e')][_0xb9c9('0x34')]);_0x34bf07[_0xb9c9('0x1b')]=qs[_0xb9c9('0x1b')](_0x1297ba[_0xb9c9('0x2e')][_0xb9c9('0x1b')]);}_0x34bf07[_0xb9c9('0x35')]=qs[_0xb9c9('0x36')](_0x1297ba[_0xb9c9('0x2e')]['sort']);_0x34bf07[_0xb9c9('0x37')]=qs['filters'](_[_0xb9c9('0x38')](_0x1297ba[_0xb9c9('0x2e')],_0x5ddf42[_0xb9c9('0x2f')]));if(_0x1297ba[_0xb9c9('0x2e')][_0xb9c9('0x39')]){_0x34bf07[_0xb9c9('0x37')]=_[_0xb9c9('0x3a')](_0x34bf07[_0xb9c9('0x37')],{'$or':_[_0xb9c9('0x2c')](_0x208f83,function(_0x166b81){if(_0x166b81[_0xb9c9('0x2a')]!==_0xb9c9('0x3b')){var _0x4db2fa={};_0x4db2fa[_0x166b81['name']]={'$like':'%'+_0x1297ba[_0xb9c9('0x2e')][_0xb9c9('0x39')]+'%'};return _0x4db2fa;}})});}_0x34bf07=_[_0xb9c9('0x3a')]({},_0x34bf07,_0x1297ba[_0xb9c9('0x3c')]);var _0x5a3368={'where':_0x34bf07[_0xb9c9('0x37')]};return db[_0xb9c9('0x3d')][_0xb9c9('0x1a')](_0x5a3368)['then'](function(_0xae22e8){_0x5e8c4a[_0xb9c9('0x1a')]=_0xae22e8;if(_0x1297ba['query'][_0xb9c9('0x3e')]){_0x34bf07['include']=[{'all':!![]}];}return db[_0xb9c9('0x3d')][_0xb9c9('0x3f')](_0x34bf07);})[_0xb9c9('0x21')](function(_0x3f2d49){_0x5e8c4a['rows']=_0x3f2d49;return _0x5e8c4a;})[_0xb9c9('0x21')](respondWithFilteredResult(_0x2a9e8c,_0x34bf07))['catch'](handleError(_0x2a9e8c,null));};exports[_0xb9c9('0x40')]=function(_0xffe191,_0x48a8d0){var _0x1a41fc={'raw':![],'where':{'id':_0xffe191[_0xb9c9('0x41')]['id']}},_0x1f8b34={};_0x1f8b34[_0xb9c9('0x2b')]=_[_0xb9c9('0x2d')](db['VoiceChanSpy'][_0xb9c9('0x29')]);_0x1f8b34[_0xb9c9('0x2e')]=_[_0xb9c9('0x2d')](_0xffe191['query']);_0x1f8b34[_0xb9c9('0x2f')]=_[_0xb9c9('0x30')](_0x1f8b34[_0xb9c9('0x2b')],_0x1f8b34['query']);_0x1a41fc[_0xb9c9('0x31')]=_[_0xb9c9('0x30')](_0x1f8b34[_0xb9c9('0x2b')],qs[_0xb9c9('0x32')](_0xffe191[_0xb9c9('0x2e')][_0xb9c9('0x32')]));_0x1a41fc['attributes']=_0x1a41fc[_0xb9c9('0x31')][_0xb9c9('0x33')]?_0x1a41fc[_0xb9c9('0x31')]:_0x1f8b34[_0xb9c9('0x2b')];if(_0xffe191[_0xb9c9('0x2e')][_0xb9c9('0x3e')]){_0x1a41fc[_0xb9c9('0x42')]=[{'all':!![]}];}_0x1a41fc=_[_0xb9c9('0x3a')]({},_0x1a41fc,_0xffe191['options']);return db[_0xb9c9('0x3d')]['find'](_0x1a41fc)[_0xb9c9('0x21')](handleEntityNotFound(_0x48a8d0,null))[_0xb9c9('0x21')](respondWithResult(_0x48a8d0,null))[_0xb9c9('0x43')](handleError(_0x48a8d0,null));};exports[_0xb9c9('0x44')]=function(_0x1d5a93,_0x5e6ffb){return db['VoiceChanSpy'][_0xb9c9('0x44')](_0x1d5a93[_0xb9c9('0x45')],{})[_0xb9c9('0x21')](function(_0x2bab8b){var _0x575dfa=_0x1d5a93['user']['get']({'plain':!![]});if(!_0x575dfa)throw new Error(_0xb9c9('0x46'));if(_0x575dfa[_0xb9c9('0x47')]===_0xb9c9('0x48')){var _0x3e41b4=_0x2bab8b[_0xb9c9('0x23')]({'plain':!![]});var _0x5c7cb6=_0xb9c9('0x49');return db['UserProfileSection'][_0xb9c9('0x4a')]({'where':{'name':_0x5c7cb6,'userProfileId':_0x575dfa[_0xb9c9('0x4b')]},'raw':!![]})['then'](function(_0x14e2d8){if(_0x14e2d8&&_0x14e2d8[_0xb9c9('0x4c')]===0x0){return db['UserProfileResource'][_0xb9c9('0x44')]({'name':_0x3e41b4['name'],'resourceId':_0x3e41b4['id'],'type':_0x14e2d8[_0xb9c9('0x26')],'sectionId':_0x14e2d8['id']},{})[_0xb9c9('0x21')](function(){return _0x2bab8b;});}else{return _0x2bab8b;}})[_0xb9c9('0x43')](function(_0x33a32e){logger[_0xb9c9('0x24')](_0xb9c9('0x4d'),_0x33a32e);throw _0x33a32e;});}return _0x2bab8b;})[_0xb9c9('0x21')](respondWithResult(_0x5e6ffb,0xc9))[_0xb9c9('0x43')](handleError(_0x5e6ffb,null));};exports[_0xb9c9('0x20')]=function(_0x22e2ac,_0x17b24c){if(_0x22e2ac['body']['id']){delete _0x22e2ac[_0xb9c9('0x45')]['id'];}return db[_0xb9c9('0x3d')][_0xb9c9('0x4a')]({'where':{'id':_0x22e2ac['params']['id']}})[_0xb9c9('0x21')](handleEntityNotFound(_0x17b24c,null))[_0xb9c9('0x21')](saveUpdates(_0x22e2ac[_0xb9c9('0x45')],null))[_0xb9c9('0x21')](respondWithResult(_0x17b24c,null))[_0xb9c9('0x43')](handleError(_0x17b24c,null));};exports[_0xb9c9('0x22')]=function(_0x3884fc,_0x4c0991){return db[_0xb9c9('0x3d')][_0xb9c9('0x4a')]({'where':{'id':_0x3884fc[_0xb9c9('0x41')]['id']}})['then'](handleEntityNotFound(_0x4c0991,null))[_0xb9c9('0x21')](removeEntity(_0x4c0991,null))[_0xb9c9('0x43')](handleError(_0x4c0991,null));}; \ No newline at end of file diff --git a/server/api/voiceChanSpy/voiceChanSpy.model.js b/server/api/voiceChanSpy/voiceChanSpy.model.js index f43d70d..44a4d26 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 _0x76fb=['agent','catch','VoiceChanSpy','voice_chanspy','then','length','VoiceExtension','bulkCreate','destroy','lodash','bluebird','./voiceChanSpy.attributes','context','from-sip','format','%s%s','system','push','Set','chanspy','record','merge','MixMonitor','${UNIQUEID}.%s,ab','auth','Authenticate','password','SIP/%s,%s','options','join','StopMixMonitor','concat','name','User','findAll','internal'];(function(_0x478700,_0x37977d){var _0x5398a0=function(_0x1d5308){while(--_0x1d5308){_0x478700['push'](_0x478700['shift']());}};_0x5398a0(++_0x37977d);}(_0x76fb,0x129));var _0xb76f=function(_0x520afd,_0x3376d7){_0x520afd=_0x520afd-0x0;var _0x563942=_0x76fb[_0x520afd];return _0x563942;};'use strict';var _=require(_0xb76f('0x0'));var util=require('util');var BPromise=require(_0xb76f('0x1'));var attributes=require(_0xb76f('0x2'));var getUserApplications=function(_0x2cdaec,_0x5c3930,_0x2bd0ce){var _0x2d933f=0x1;var _0x49586a=[];var _0x47e007={'context':_0x5c3930[_0xb76f('0x3')]||_0xb76f('0x4'),'exten':util[_0xb76f('0x5')](_0xb76f('0x6'),_0x2cdaec['prefix'],_0x2bd0ce),'type':_0xb76f('0x7'),'isApp':![],'ChanSpyId':_0x2cdaec['id'],'UserId':_0x5c3930['id']};_0x49586a[_0xb76f('0x8')](_['merge']({'app':_0xb76f('0x9'),'appdata':util[_0xb76f('0x5')]('CDR(type)=%s',_0xb76f('0xa')),'priority':_0x2d933f++},_0x47e007));if(_0x2cdaec[_0xb76f('0xb')]){_0x49586a[_0xb76f('0x8')](_[_0xb76f('0xc')]({'app':_0xb76f('0xd'),'appdata':util[_0xb76f('0x5')](_0xb76f('0xe'),_0x2cdaec['recordingFormat']),'priority':_0x2d933f++},_0x47e007));}if(_0x2cdaec[_0xb76f('0xf')]){_0x49586a[_0xb76f('0x8')](_['merge']({'app':_0xb76f('0x10'),'appdata':_0x2cdaec[_0xb76f('0x11')],'priority':_0x2d933f++},_0x47e007));}_0x49586a[_0xb76f('0x8')](_['merge']({'app':'ChanSpy','appdata':util[_0xb76f('0x5')](_0xb76f('0x12'),_0x5c3930['name'],_0x2cdaec[_0xb76f('0x13')]?_0x2cdaec[_0xb76f('0x13')][_0xb76f('0x14')](''):''),'priority':_0x2d933f++},_0x47e007));if(_0x2cdaec[_0xb76f('0xb')]){_0x49586a['push'](_[_0xb76f('0xc')]({'app':_0xb76f('0x15'),'priority':_0x2d933f++},_0x47e007));}return _0x49586a;};var getChanSpyApplications=function(_0x4975d9,_0x50ed9a){var _0x106339=[];for(var _0x4e7929=0x0,_0x497143=0x1;_0x4e7929<_0x50ed9a['length'];_0x4e7929++,_0x497143=0x1){_0x106339=_0x106339[_0xb76f('0x16')](getUserApplications(_0x4975d9,_0x50ed9a[_0x4e7929],_0x50ed9a[_0x4e7929]['internal']));if(_0x50ed9a[_0x4e7929]['internal']!=_0x50ed9a[_0x4e7929][_0xb76f('0x17')]){_0x106339=_0x106339[_0xb76f('0x16')](getUserApplications(_0x4975d9,_0x50ed9a[_0x4e7929],_0x50ed9a[_0x4e7929][_0xb76f('0x17')]));}}return _0x106339;};var getChanSpyPromise=function(_0x223145,_0x131c32){return new BPromise(function(_0x471fe9,_0x202f0a){return _0x223145[_0xb76f('0x18')][_0xb76f('0x19')]({'attributes':['id',_0xb76f('0x17'),_0xb76f('0x1a')],'where':{'role':_0xb76f('0x1b'),'chanspy':!![]},'raw':!![]})['then'](function(_0x55b756){if(_0x55b756){return _0x471fe9(getChanSpyApplications(_0x131c32,_0x55b756));}return _0x471fe9([]);})[_0xb76f('0x1c')](function(_0x2187eb){_0x202f0a(_0x2187eb);});});};module['exports']=function(_0xde7462,_0x3d6412){var _0x5756e7=_0xde7462['models'];return _0xde7462['define'](_0xb76f('0x1d'),attributes,{'tableName':_0xb76f('0x1e'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'afterCreate':function(_0x437564,_0x1cb253,_0x13e29a){return getChanSpyPromise(_0x5756e7,_0x437564)[_0xb76f('0x1f')](function(_0x431fca){if(_0x431fca&&_0x431fca[_0xb76f('0x20')]){return _0x5756e7[_0xb76f('0x21')][_0xb76f('0x22')](_0x431fca);}})[_0xb76f('0x1f')](function(){_0x13e29a();})['catch'](function(_0x21f7a7){_0x13e29a(_0x21f7a7);});},'afterUpdate':function(_0x2ef73b,_0x5324c3,_0x3b7f5e){return _0x5756e7[_0xb76f('0x21')][_0xb76f('0x23')]({'where':{'ChanSpyId':_0x2ef73b['id']}})[_0xb76f('0x1f')](function(){return getChanSpyPromise(_0x5756e7,_0x2ef73b);})[_0xb76f('0x1f')](function(_0xe0acdd){if(_0xe0acdd&&_0xe0acdd[_0xb76f('0x20')]){return _0x5756e7['VoiceExtension'][_0xb76f('0x22')](_0xe0acdd);}})['then'](function(){_0x3b7f5e();})[_0xb76f('0x1c')](function(_0x599d3f){_0x3b7f5e(_0x599d3f);});},'afterDestroy':function(_0x566e7a,_0x36149b,_0x3e4e63){return _0x5756e7[_0xb76f('0x21')]['destroy']({'where':{'ChanSpyId':_0x566e7a['id']}})['then'](function(){_0x3e4e63();})[_0xb76f('0x1c')](function(_0x51d5f4){_0x3e4e63(_0x51d5f4);});}}});}; \ No newline at end of file +var _0xe012=['password','ChanSpy','name','options','join','concat','internal','User','findAll','agent','catch','define','VoiceChanSpy','voice_chanspy','then','length','VoiceExtension','bulkCreate','destroy','lodash','util','bluebird','from-sip','format','%s%s','system','Set','CDR(type)=%s','chanspy','record','push','merge','${UNIQUEID}.%s,ab','recordingFormat','auth','Authenticate'];(function(_0x531d3e,_0x25dd52){var _0x3aeef6=function(_0xec5963){while(--_0xec5963){_0x531d3e['push'](_0x531d3e['shift']());}};_0x3aeef6(++_0x25dd52);}(_0xe012,0xeb));var _0x2e01=function(_0x46f448,_0x36d0b8){_0x46f448=_0x46f448-0x0;var _0x413c11=_0xe012[_0x46f448];return _0x413c11;};'use strict';var _=require(_0x2e01('0x0'));var util=require(_0x2e01('0x1'));var BPromise=require(_0x2e01('0x2'));var attributes=require('./voiceChanSpy.attributes');var getUserApplications=function(_0x16c789,_0x2f7041,_0x3be1d7){var _0x34d2e2=0x1;var _0x1f731e=[];var _0x200139={'context':_0x2f7041['context']||_0x2e01('0x3'),'exten':util[_0x2e01('0x4')](_0x2e01('0x5'),_0x16c789['prefix'],_0x3be1d7),'type':_0x2e01('0x6'),'isApp':![],'ChanSpyId':_0x16c789['id'],'UserId':_0x2f7041['id']};_0x1f731e['push'](_['merge']({'app':_0x2e01('0x7'),'appdata':util[_0x2e01('0x4')](_0x2e01('0x8'),_0x2e01('0x9')),'priority':_0x34d2e2++},_0x200139));if(_0x16c789[_0x2e01('0xa')]){_0x1f731e[_0x2e01('0xb')](_[_0x2e01('0xc')]({'app':'MixMonitor','appdata':util[_0x2e01('0x4')](_0x2e01('0xd'),_0x16c789[_0x2e01('0xe')]),'priority':_0x34d2e2++},_0x200139));}if(_0x16c789[_0x2e01('0xf')]){_0x1f731e[_0x2e01('0xb')](_[_0x2e01('0xc')]({'app':_0x2e01('0x10'),'appdata':_0x16c789[_0x2e01('0x11')],'priority':_0x34d2e2++},_0x200139));}_0x1f731e[_0x2e01('0xb')](_[_0x2e01('0xc')]({'app':_0x2e01('0x12'),'appdata':util[_0x2e01('0x4')]('SIP/%s,%s',_0x2f7041[_0x2e01('0x13')],_0x16c789['options']?_0x16c789[_0x2e01('0x14')][_0x2e01('0x15')](''):''),'priority':_0x34d2e2++},_0x200139));if(_0x16c789[_0x2e01('0xa')]){_0x1f731e[_0x2e01('0xb')](_[_0x2e01('0xc')]({'app':'StopMixMonitor','priority':_0x34d2e2++},_0x200139));}return _0x1f731e;};var getChanSpyApplications=function(_0x5e54c3,_0x30f8d4){var _0x40556a=[];for(var _0x381d26=0x0,_0x24c3a8=0x1;_0x381d26<_0x30f8d4['length'];_0x381d26++,_0x24c3a8=0x1){_0x40556a=_0x40556a[_0x2e01('0x16')](getUserApplications(_0x5e54c3,_0x30f8d4[_0x381d26],_0x30f8d4[_0x381d26][_0x2e01('0x17')]));if(_0x30f8d4[_0x381d26][_0x2e01('0x17')]!=_0x30f8d4[_0x381d26]['name']){_0x40556a=_0x40556a[_0x2e01('0x16')](getUserApplications(_0x5e54c3,_0x30f8d4[_0x381d26],_0x30f8d4[_0x381d26][_0x2e01('0x13')]));}}return _0x40556a;};var getChanSpyPromise=function(_0xc7a9c8,_0x30fb83){return new BPromise(function(_0x409af9,_0x103381){return _0xc7a9c8[_0x2e01('0x18')][_0x2e01('0x19')]({'attributes':['id','name',_0x2e01('0x17')],'where':{'role':_0x2e01('0x1a'),'chanspy':!![]},'raw':!![]})['then'](function(_0x5137c9){if(_0x5137c9){return _0x409af9(getChanSpyApplications(_0x30fb83,_0x5137c9));}return _0x409af9([]);})[_0x2e01('0x1b')](function(_0x36f7a7){_0x103381(_0x36f7a7);});});};module['exports']=function(_0x34b2b5,_0x54c2e1){var _0x558e30=_0x34b2b5['models'];return _0x34b2b5[_0x2e01('0x1c')](_0x2e01('0x1d'),attributes,{'tableName':_0x2e01('0x1e'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'afterCreate':function(_0xe59e01,_0x5033c3,_0xd00612){return getChanSpyPromise(_0x558e30,_0xe59e01)[_0x2e01('0x1f')](function(_0x3fa6fb){if(_0x3fa6fb&&_0x3fa6fb[_0x2e01('0x20')]){return _0x558e30[_0x2e01('0x21')][_0x2e01('0x22')](_0x3fa6fb);}})[_0x2e01('0x1f')](function(){_0xd00612();})['catch'](function(_0x55cc8a){_0xd00612(_0x55cc8a);});},'afterUpdate':function(_0x4f2de6,_0xc3513b,_0x195e10){return _0x558e30['VoiceExtension'][_0x2e01('0x23')]({'where':{'ChanSpyId':_0x4f2de6['id']}})[_0x2e01('0x1f')](function(){return getChanSpyPromise(_0x558e30,_0x4f2de6);})[_0x2e01('0x1f')](function(_0x96db41){if(_0x96db41&&_0x96db41['length']){return _0x558e30['VoiceExtension'][_0x2e01('0x22')](_0x96db41);}})[_0x2e01('0x1f')](function(){_0x195e10();})[_0x2e01('0x1b')](function(_0x202d52){_0x195e10(_0x202d52);});},'afterDestroy':function(_0x54e0ba,_0x504248,_0x125f46){return _0x558e30[_0x2e01('0x21')][_0x2e01('0x23')]({'where':{'ChanSpyId':_0x54e0ba['id']}})['then'](function(){_0x125f46();})[_0x2e01('0x1b')](function(_0x5bfbcf){_0x125f46(_0x5bfbcf);});}}});}; \ No newline at end of file diff --git a/server/api/voiceChanSpy/voiceChanSpy.rpc.js b/server/api/voiceChanSpy/voiceChanSpy.rpc.js index 12dc6b4..3912d03 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 _0x0933=['client','request','then','info','VoiceChanSpy,\x20%s,\x20%s','request\x20sent','stringify','error','message','catch','lodash','util','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise'];(function(_0xd46227,_0x18477f){var _0x2a980d=function(_0x34e452){while(--_0x34e452){_0xd46227['push'](_0xd46227['shift']());}};_0x2a980d(++_0x18477f);}(_0x0933,0x1ea));var _0x3093=function(_0xbaf324,_0x1dc19a){_0xbaf324=_0xbaf324-0x0;var _0x3a571e=_0x0933[_0xbaf324];return _0x3a571e;};'use strict';var _=require(_0x3093('0x0'));var util=require(_0x3093('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x3093('0x2'));var fs=require('fs');var Redis=require(_0x3093('0x3'));var db=require(_0x3093('0x4'))['db'];var utils=require(_0x3093('0x5'));var logger=require(_0x3093('0x6'))(_0x3093('0x7'));var config=require(_0x3093('0x8'));var jayson=require(_0x3093('0x9'));var client=jayson[_0x3093('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x1f0646,_0x2d9b30,_0x2e1d21){return new BPromise(function(_0x2b082e,_0x4028c1){return client[_0x3093('0xb')](_0x1f0646,_0x2e1d21)[_0x3093('0xc')](function(_0x3f4374){logger[_0x3093('0xd')](_0x3093('0xe'),_0x2d9b30,_0x3093('0xf'));logger['debug']('VoiceChanSpy,\x20%s,\x20%s,\x20%s',_0x2d9b30,_0x3093('0xf'),JSON[_0x3093('0x10')](_0x3f4374));if(_0x3f4374[_0x3093('0x11')]){if(_0x3f4374[_0x3093('0x11')]['code']===0x1f4){logger['error'](_0x3093('0xe'),_0x2d9b30,_0x3f4374[_0x3093('0x11')]['message']);return _0x4028c1(_0x3f4374['error'][_0x3093('0x12')]);}logger[_0x3093('0x11')](_0x3093('0xe'),_0x2d9b30,_0x3f4374[_0x3093('0x11')][_0x3093('0x12')]);return _0x2b082e(_0x3f4374[_0x3093('0x11')]['message']);}else{logger[_0x3093('0xd')]('VoiceChanSpy,\x20%s,\x20%s',_0x2d9b30,_0x3093('0xf'));_0x2b082e(_0x3f4374['result'][_0x3093('0x12')]);}})[_0x3093('0x13')](function(_0x51d346){logger[_0x3093('0x11')](_0x3093('0xe'),_0x2d9b30,_0x51d346);_0x4028c1(_0x51d346);});});} \ No newline at end of file +var _0x28bd=['http','request','then','info','VoiceChanSpy,\x20%s,\x20%s','debug','request\x20sent','stringify','error','message','result','catch','bluebird','randomstring','ioredis','../../config/utils','rpc','jayson/promise','client'];(function(_0x466033,_0x22ee49){var _0x494fb5=function(_0x148b67){while(--_0x148b67){_0x466033['push'](_0x466033['shift']());}};_0x494fb5(++_0x22ee49);}(_0x28bd,0x1d4));var _0xd28b=function(_0x10acca,_0x1219e1){_0x10acca=_0x10acca-0x0;var _0xb3bef3=_0x28bd[_0x10acca];return _0xb3bef3;};'use strict';var _=require('lodash');var util=require('util');var moment=require('moment');var BPromise=require(_0xd28b('0x0'));var rs=require(_0xd28b('0x1'));var fs=require('fs');var Redis=require(_0xd28b('0x2'));var db=require('../../mysqldb')['db'];var utils=require(_0xd28b('0x3'));var logger=require('../../config/logger')(_0xd28b('0x4'));var config=require('../../config/environment');var jayson=require(_0xd28b('0x5'));var client=jayson[_0xd28b('0x6')][_0xd28b('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x295b83,_0x4ddbb0,_0x3331f5){return new BPromise(function(_0x3e3d24,_0x37e7ca){return client[_0xd28b('0x8')](_0x295b83,_0x3331f5)[_0xd28b('0x9')](function(_0x2853f0){logger[_0xd28b('0xa')](_0xd28b('0xb'),_0x4ddbb0,'request\x20sent');logger[_0xd28b('0xc')]('VoiceChanSpy,\x20%s,\x20%s,\x20%s',_0x4ddbb0,_0xd28b('0xd'),JSON[_0xd28b('0xe')](_0x2853f0));if(_0x2853f0['error']){if(_0x2853f0['error']['code']===0x1f4){logger[_0xd28b('0xf')](_0xd28b('0xb'),_0x4ddbb0,_0x2853f0[_0xd28b('0xf')][_0xd28b('0x10')]);return _0x37e7ca(_0x2853f0['error']['message']);}logger['error'](_0xd28b('0xb'),_0x4ddbb0,_0x2853f0[_0xd28b('0xf')][_0xd28b('0x10')]);return _0x3e3d24(_0x2853f0['error'][_0xd28b('0x10')]);}else{logger['info'](_0xd28b('0xb'),_0x4ddbb0,_0xd28b('0xd'));_0x3e3d24(_0x2853f0[_0xd28b('0x11')]['message']);}})[_0xd28b('0x12')](function(_0x343bf9){logger['error'](_0xd28b('0xb'),_0x4ddbb0,_0x343bf9);_0x37e7ca(_0x343bf9);});});} \ No newline at end of file diff --git a/server/api/voiceContext/index.js b/server/api/voiceContext/index.js index b0f6e02..7418de1 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 _0x632b=['index','/:id','show','create','put','update','delete','destroy','exports','multer','path','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated'];(function(_0x7ddf03,_0xefbb6d){var _0x52bc44=function(_0x3bfe46){while(--_0x3bfe46){_0x7ddf03['push'](_0x7ddf03['shift']());}};_0x52bc44(++_0xefbb6d);}(_0x632b,0x14d));var _0xb632=function(_0x50cf17,_0x3aa136){_0x50cf17=_0x50cf17-0x0;var _0x4a8c76=_0x632b[_0x50cf17];return _0x4a8c76;};'use strict';var multer=require(_0xb632('0x0'));var util=require('util');var path=require(_0xb632('0x1'));var timeout=require(_0xb632('0x2'));var express=require('express');var router=express[_0xb632('0x3')]();var auth=require(_0xb632('0x4'));var interaction=require(_0xb632('0x5'));var config=require(_0xb632('0x6'));var controller=require('./voiceContext.controller');router[_0xb632('0x7')]('/',auth[_0xb632('0x8')](),controller[_0xb632('0x9')]);router['get'](_0xb632('0xa'),auth[_0xb632('0x8')](),controller[_0xb632('0xb')]);router['post']('/',auth['isAuthenticated'](),controller[_0xb632('0xc')]);router[_0xb632('0xd')](_0xb632('0xa'),auth[_0xb632('0x8')](),controller[_0xb632('0xe')]);router[_0xb632('0xf')]('/:id',auth[_0xb632('0x8')](),controller[_0xb632('0x10')]);module[_0xb632('0x11')]=router; \ No newline at end of file +var _0xb882=['exports','multer','path','connect-timeout','express','../../components/auth/service','../../config/environment','./voiceContext.controller','get','/:id','isAuthenticated','show','post','create','put','update','delete','destroy'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xb882,0x10f));var _0x2b88=function(_0x1ccdf7,_0x215d5a){_0x1ccdf7=_0x1ccdf7-0x0;var _0x52a0ae=_0xb882[_0x1ccdf7];return _0x52a0ae;};'use strict';var multer=require(_0x2b88('0x0'));var util=require('util');var path=require(_0x2b88('0x1'));var timeout=require(_0x2b88('0x2'));var express=require(_0x2b88('0x3'));var router=express['Router']();var auth=require(_0x2b88('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0x2b88('0x5'));var controller=require(_0x2b88('0x6'));router[_0x2b88('0x7')]('/',auth['isAuthenticated'](),controller['index']);router[_0x2b88('0x7')](_0x2b88('0x8'),auth[_0x2b88('0x9')](),controller[_0x2b88('0xa')]);router[_0x2b88('0xb')]('/',auth['isAuthenticated'](),controller[_0x2b88('0xc')]);router[_0x2b88('0xd')](_0x2b88('0x8'),auth['isAuthenticated'](),controller[_0x2b88('0xe')]);router[_0x2b88('0xf')](_0x2b88('0x8'),auth['isAuthenticated'](),controller[_0x2b88('0x10')]);module[_0x2b88('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 2863ac7..88a186c 100644 --- a/server/api/voiceContext/voiceContext.attributes.js +++ b/server/api/voiceContext/voiceContext.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x34e8=['sequelize','exports','STRING','name','BOOLEAN'];(function(_0x31d5d5,_0x2d3a2a){var _0x5f25a6=function(_0x2f58b1){while(--_0x2f58b1){_0x31d5d5['push'](_0x31d5d5['shift']());}};_0x5f25a6(++_0x2d3a2a);}(_0x34e8,0x12c));var _0x834e=function(_0x114a13,_0x3c2676){_0x114a13=_0x114a13-0x0;var _0xa38e03=_0x34e8[_0x114a13];return _0xa38e03;};'use strict';var Sequelize=require(_0x834e('0x0'));module[_0x834e('0x1')]={'name':{'type':Sequelize[_0x834e('0x2')],'unique':_0x834e('0x3')},'description':{'type':Sequelize['STRING'],'allowNull':!![]},'defaultEntry':{'type':Sequelize[_0x834e('0x4')],'defaultValue':0x0}}; \ No newline at end of file +var _0xe14b=['exports','STRING','BOOLEAN','sequelize'];(function(_0x4d075c,_0xd0f40f){var _0x5c3d08=function(_0x26e3f4){while(--_0x26e3f4){_0x4d075c['push'](_0x4d075c['shift']());}};_0x5c3d08(++_0xd0f40f);}(_0xe14b,0x93));var _0xbe14=function(_0x2b9dba,_0xa036e4){_0x2b9dba=_0x2b9dba-0x0;var _0x312af9=_0xe14b[_0x2b9dba];return _0x312af9;};'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 fc4bf98..79ce64e 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 _0x9494=['map','VIRTUAL','merge','options','includeAll','include','findAll','rows','show','params','find','readFileSync','join','root','render','writeFileSync','/etc/asterisk/extensions_xcally_contexts.conf','create','chan_sip.so','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','UserProfileSection','userProfileId','server/files/templates/context.ejs','utf8','Reload','html-pdf','eml-format','zip-dir','fast-json-patch','bluebird','util','sox','to-csv','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/environment','jayson/promise','http','test','Sequelize','ValidationError','request','then','info','VoiceContext,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','catch','status','end','count','offset','limit','json','apply','update','get','Contexts','UserProfileResource','destroy','sendStatus','stack','name','send','index','VoiceContext','rawAttributes','fieldName','type','key','query','keys','filters','intersection','attributes','model','fields','length','hasOwnProperty','nolimit','sort','pick','filter','where'];(function(_0x2f855e,_0x242df7){var _0x41f5dc=function(_0x1d9910){while(--_0x1d9910){_0x2f855e['push'](_0x2f855e['shift']());}};_0x41f5dc(++_0x242df7);}(_0x9494,0x1a7));var _0x4949=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x9494[_0x3dd15e];return _0x231fd0;};'use strict';var pdf=require(_0x4949('0x0'));var emlformat=require(_0x4949('0x1'));var rimraf=require('rimraf');var zipdir=require(_0x4949('0x2'));var jsonpatch=require(_0x4949('0x3'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x4949('0x4'));var Mustache=require('mustache');var util=require(_0x4949('0x5'));var path=require('path');var sox=require(_0x4949('0x6'));var csv=require(_0x4949('0x7'));var ejs=require('ejs');var fs=require('fs');var _=require('lodash');var squel=require(_0x4949('0x8'));var crypto=require(_0x4949('0x9'));var jsforce=require(_0x4949('0xa'));var deskjs=require(_0x4949('0xb'));var toCsv=require(_0x4949('0x7'));var querystring=require(_0x4949('0xc'));var Papa=require(_0x4949('0xd'));var Redis=require(_0x4949('0xe'));var authService=require('../../components/auth/service');var qs=require(_0x4949('0xf'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x4949('0x10'));var logger=require(_0x4949('0x11'))(_0x4949('0x12'));var utils=require('../../config/utils');var config=require(_0x4949('0x13'));var db=require('../../mysqldb')['db'];var jayson=require(_0x4949('0x14'));var client=jayson['client'][_0x4949('0x15')]({'port':0x232a});function checkPasswordPattern(_0x3317ae,_0x4e1bfa,_0x151c39){if(_0x151c39){var _0x1fc517=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x1fc517[_0x4949('0x16')](_0x4e1bfa)){return _0x3317ae;}else{throw new db[(_0x4949('0x17'))][(_0x4949('0x18'))]('The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.');}}else{return _0x3317ae;}}function respondWithRpcPromise(_0x331c75,_0x288000,_0x11537a,_0x3ae0af){return new BPromise(function(_0x5c5745,_0x5de3be){var _0x3064fa=_0x3ae0af||client;return _0x3064fa[_0x4949('0x19')](_0x331c75,_0x11537a)[_0x4949('0x1a')](function(_0x311aaf){logger[_0x4949('0x1b')](_0x4949('0x1c'),_0x288000,_0x4949('0x1d'));logger[_0x4949('0x1e')]('VoiceContext,\x20%s,\x20%s,\x20%s',_0x288000,_0x4949('0x1d'),JSON[_0x4949('0x1f')](_0x311aaf));if(_0x311aaf[_0x4949('0x20')]){if(_0x311aaf[_0x4949('0x20')][_0x4949('0x21')]===0x1f4){logger['error'](_0x4949('0x1c'),_0x288000,_0x311aaf[_0x4949('0x20')][_0x4949('0x22')]);return _0x5de3be(_0x311aaf['error'][_0x4949('0x22')]);}logger['error'](_0x4949('0x1c'),_0x288000,_0x311aaf[_0x4949('0x20')][_0x4949('0x22')]);return _0x5c5745(_0x311aaf[_0x4949('0x20')][_0x4949('0x22')]);}else{logger[_0x4949('0x1b')](_0x4949('0x1c'),_0x288000,_0x4949('0x1d'));_0x5c5745(_0x311aaf['result'][_0x4949('0x22')]);}})[_0x4949('0x23')](function(_0x2c2207){logger[_0x4949('0x20')](_0x4949('0x1c'),_0x288000,_0x2c2207);_0x5de3be(_0x2c2207);});});}function respondWithStatusCode(_0x339597,_0x57c443){_0x57c443=_0x57c443||0xcc;return function(_0x19148f){if(_0x19148f){return _0x339597['sendStatus'](_0x57c443);}return _0x339597[_0x4949('0x24')](_0x57c443)[_0x4949('0x25')]();};}function respondWithResult(_0x352ccd,_0x1a7d3e){_0x1a7d3e=_0x1a7d3e||0xc8;return function(_0x4dfe1b){if(_0x4dfe1b){return _0x352ccd[_0x4949('0x24')](_0x1a7d3e)['json'](_0x4dfe1b);}};}function respondWithFilteredResult(_0x51b790,_0xb8bca6){return function(_0x35af0b){if(_0x35af0b){var _0x3782cf=_0x35af0b[_0x4949('0x26')],_0x4c9bb3=_0xb8bca6[_0x4949('0x27')],_0x19f577=_0xb8bca6[_0x4949('0x27')]+_0xb8bca6[_0x4949('0x28')],_0x22b0eb;if(_0x19f577>=_0x3782cf){_0x19f577=_0x3782cf;_0x22b0eb=0xc8;}else{_0x22b0eb=0xce;}_0x51b790[_0x4949('0x24')](_0x22b0eb);return _0x51b790['set']('Content-Range',_0x4c9bb3+'-'+_0x19f577+'/'+_0x3782cf)[_0x4949('0x29')](_0x35af0b);}return null;};}function patchUpdates(_0x818287){return function(_0x5abc02){try{jsonpatch[_0x4949('0x2a')](_0x5abc02,_0x818287,!![]);}catch(_0x41a21d){return BPromise['reject'](_0x41a21d);}return _0x5abc02['save']();};}function saveUpdates(_0x34d0f8,_0x57a4af){return function(_0x43940b){if(_0x43940b){return _0x43940b[_0x4949('0x2b')](_0x34d0f8)['then'](function(_0x9f6cfc){return _0x9f6cfc;});}return null;};}function removeEntity(_0x13d9c1,_0x3ee03e){return function(_0x4f3dbb){if(_0x4f3dbb){return _0x4f3dbb['destroy']()['then'](function(){var _0x37e53e=_0x4f3dbb[_0x4949('0x2c')]({'plain':!![]});var _0x2f0d97=_0x4949('0x2d');return db[_0x4949('0x2e')][_0x4949('0x2f')]({'where':{'type':_0x2f0d97,'resourceId':_0x37e53e['id']}})[_0x4949('0x1a')](function(){return _0x4f3dbb;});})[_0x4949('0x1a')](function(){_0x13d9c1[_0x4949('0x24')](0xcc)[_0x4949('0x25')]();});}};}function handleEntityNotFound(_0x1808c4,_0x4ad2c7){return function(_0x4afa4e){if(!_0x4afa4e){_0x1808c4[_0x4949('0x30')](0x194);}return _0x4afa4e;};}function handleError(_0x2de446,_0x1dea1f){_0x1dea1f=_0x1dea1f||0x1f4;return function(_0x225aec){logger[_0x4949('0x20')](_0x225aec[_0x4949('0x31')]);if(_0x225aec[_0x4949('0x32')]){delete _0x225aec[_0x4949('0x32')];}_0x2de446[_0x4949('0x24')](_0x1dea1f)[_0x4949('0x33')](_0x225aec);};}exports[_0x4949('0x34')]=function(_0x5e34cb,_0x24b357){var _0x1038b3={},_0xbb03f={},_0x41f4a6={'count':0x0,'rows':[]};var _0x50d2eb=_['map'](db[_0x4949('0x35')][_0x4949('0x36')],function(_0x29207a){return{'name':_0x29207a[_0x4949('0x37')],'type':_0x29207a[_0x4949('0x38')][_0x4949('0x39')]};});_0xbb03f['model']=_['map'](_0x50d2eb,_0x4949('0x32'));_0xbb03f[_0x4949('0x3a')]=_[_0x4949('0x3b')](_0x5e34cb[_0x4949('0x3a')]);_0xbb03f[_0x4949('0x3c')]=_[_0x4949('0x3d')](_0xbb03f['model'],_0xbb03f[_0x4949('0x3a')]);_0x1038b3[_0x4949('0x3e')]=_[_0x4949('0x3d')](_0xbb03f[_0x4949('0x3f')],qs[_0x4949('0x40')](_0x5e34cb[_0x4949('0x3a')][_0x4949('0x40')]));_0x1038b3[_0x4949('0x3e')]=_0x1038b3['attributes'][_0x4949('0x41')]?_0x1038b3[_0x4949('0x3e')]:_0xbb03f[_0x4949('0x3f')];if(!_0x5e34cb['query'][_0x4949('0x42')](_0x4949('0x43'))){_0x1038b3['limit']=qs[_0x4949('0x28')](_0x5e34cb[_0x4949('0x3a')]['limit']);_0x1038b3['offset']=qs[_0x4949('0x27')](_0x5e34cb[_0x4949('0x3a')][_0x4949('0x27')]);}_0x1038b3['order']=qs[_0x4949('0x44')](_0x5e34cb[_0x4949('0x3a')][_0x4949('0x44')]);_0x1038b3['where']=qs[_0x4949('0x3c')](_[_0x4949('0x45')](_0x5e34cb[_0x4949('0x3a')],_0xbb03f['filters']));if(_0x5e34cb[_0x4949('0x3a')][_0x4949('0x46')]){_0x1038b3[_0x4949('0x47')]=_['merge'](_0x1038b3['where'],{'$or':_[_0x4949('0x48')](_0x50d2eb,function(_0x49db09){if(_0x49db09[_0x4949('0x38')]!==_0x4949('0x49')){var _0xd60f50={};_0xd60f50[_0x49db09[_0x4949('0x32')]]={'$like':'%'+_0x5e34cb['query'][_0x4949('0x46')]+'%'};return _0xd60f50;}})});}_0x1038b3=_[_0x4949('0x4a')]({},_0x1038b3,_0x5e34cb[_0x4949('0x4b')]);var _0x45e043={'where':_0x1038b3[_0x4949('0x47')]};return db[_0x4949('0x35')][_0x4949('0x26')](_0x45e043)[_0x4949('0x1a')](function(_0x490b25){_0x41f4a6[_0x4949('0x26')]=_0x490b25;if(_0x5e34cb[_0x4949('0x3a')][_0x4949('0x4c')]){_0x1038b3[_0x4949('0x4d')]=[{'all':!![]}];}return db['VoiceContext'][_0x4949('0x4e')](_0x1038b3);})[_0x4949('0x1a')](function(_0x38b247){_0x41f4a6[_0x4949('0x4f')]=_0x38b247;return _0x41f4a6;})['then'](respondWithFilteredResult(_0x24b357,_0x1038b3))[_0x4949('0x23')](handleError(_0x24b357,null));};exports[_0x4949('0x50')]=function(_0x5a21b1,_0xdf5d55){var _0x268b90={'raw':![],'where':{'id':_0x5a21b1[_0x4949('0x51')]['id']}},_0x194d35={};_0x194d35[_0x4949('0x3f')]=_[_0x4949('0x3b')](db[_0x4949('0x35')]['rawAttributes']);_0x194d35['query']=_[_0x4949('0x3b')](_0x5a21b1[_0x4949('0x3a')]);_0x194d35[_0x4949('0x3c')]=_['intersection'](_0x194d35[_0x4949('0x3f')],_0x194d35['query']);_0x268b90[_0x4949('0x3e')]=_['intersection'](_0x194d35[_0x4949('0x3f')],qs['fields'](_0x5a21b1[_0x4949('0x3a')]['fields']));_0x268b90['attributes']=_0x268b90[_0x4949('0x3e')]['length']?_0x268b90[_0x4949('0x3e')]:_0x194d35[_0x4949('0x3f')];if(_0x5a21b1[_0x4949('0x3a')][_0x4949('0x4c')]){_0x268b90['include']=[{'all':!![]}];}_0x268b90=_[_0x4949('0x4a')]({},_0x268b90,_0x5a21b1[_0x4949('0x4b')]);return db[_0x4949('0x35')][_0x4949('0x52')](_0x268b90)['then'](handleEntityNotFound(_0xdf5d55,null))['then'](respondWithResult(_0xdf5d55,null))[_0x4949('0x23')](handleError(_0xdf5d55,null));};exports['create']=function(_0x34ce88,_0x120335,_0x32d047){var _0x198560;return db[_0x4949('0x35')]['create'](_0x34ce88['body'],{'raw':!![]})[_0x4949('0x1a')](function(_0x28ef25){_0x198560=_0x28ef25;return db[_0x4949('0x35')]['findAll']({'raw':!![]});})['then'](function(_0x286dad){var _0x3e5a7f=fs[_0x4949('0x53')](path[_0x4949('0x54')](config[_0x4949('0x55')],'server/files/templates/context.ejs'),'utf8');var _0x176d9d=ejs[_0x4949('0x56')](_0x3e5a7f,{'contexts':_0x286dad||[]});fs[_0x4949('0x57')](_0x4949('0x58'),_0x176d9d);})['then'](function(){return respondWithRpcPromise('Reload',_0x4949('0x59'),{'module':_0x4949('0x5a')});})[_0x4949('0x1a')](function(){var _0x4761ea=_0x34ce88['user'][_0x4949('0x2c')]({'plain':!![]});if(!_0x4761ea)throw new Error(_0x4949('0x5b'));if(_0x4761ea[_0x4949('0x5c')]===_0x4949('0x5d')){var _0x3612f0=_0x198560[_0x4949('0x2c')]({'plain':!![]});return db[_0x4949('0x5e')][_0x4949('0x52')]({'where':{'name':'Contexts','userProfileId':_0x4761ea[_0x4949('0x5f')]},'raw':!![]})['then'](function(_0x58f4a4){if(_0x58f4a4&&_0x58f4a4['autoAssociation']===0x0){return db[_0x4949('0x2e')][_0x4949('0x59')]({'name':_0x3612f0[_0x4949('0x32')],'resourceId':_0x3612f0['id'],'type':_0x58f4a4['name'],'sectionId':_0x58f4a4['id']},{})['then'](function(){return _0x198560;});}else{return _0x198560;}})[_0x4949('0x23')](function(_0xfb4b60){logger[_0x4949('0x20')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0xfb4b60);throw _0xfb4b60;});}return _0x198560;})[_0x4949('0x1a')](respondWithResult(_0x120335,0xc9))[_0x4949('0x23')](handleError(_0x120335,null));};exports[_0x4949('0x2b')]=function(_0x40cf92,_0x59abf6,_0x14317c){var _0x2b9c79;return db[_0x4949('0x35')][_0x4949('0x52')]({'where':{'id':_0x40cf92[_0x4949('0x51')]['id']}})[_0x4949('0x1a')](handleEntityNotFound(_0x59abf6,null))[_0x4949('0x1a')](saveUpdates(_0x40cf92['body'],null))['then'](function(_0x6738c8){if(_0x6738c8){_0x2b9c79=_0x6738c8;return db[_0x4949('0x35')][_0x4949('0x4e')]({'raw':!![]});}})[_0x4949('0x1a')](function(_0x597007){var _0x300833=fs['readFileSync'](path['join'](config['root'],_0x4949('0x60')),_0x4949('0x61'));var _0x87953=ejs['render'](_0x300833,{'contexts':_0x597007||[]});fs[_0x4949('0x57')](_0x4949('0x58'),_0x87953);})[_0x4949('0x1a')](function(){return respondWithRpcPromise(_0x4949('0x62'),_0x4949('0x2b'),{'module':'chan_sip.so'});})[_0x4949('0x1a')](function(){return _0x2b9c79;})[_0x4949('0x1a')](respondWithResult(_0x59abf6,null))['catch'](handleError(_0x59abf6,null));};exports[_0x4949('0x2f')]=function(_0x23dd87,_0x3955f9,_0xf0f22c){var _0x495efd;return db[_0x4949('0x35')][_0x4949('0x52')]({'where':{'id':_0x23dd87[_0x4949('0x51')]['id']}})['then'](handleEntityNotFound(_0x3955f9,null))['then'](removeEntity(_0x3955f9,null))['then'](function(){return db[_0x4949('0x35')][_0x4949('0x4e')]({'raw':!![]});})['then'](function(_0x493594){var _0xc68fe3=fs['readFileSync'](path[_0x4949('0x54')](config[_0x4949('0x55')],_0x4949('0x60')),_0x4949('0x61'));var _0x2a370c=ejs[_0x4949('0x56')](_0xc68fe3,{'contexts':_0x493594});fs[_0x4949('0x57')](_0x4949('0x58'),_0x2a370c);return respondWithRpcPromise(_0x4949('0x62'),_0x4949('0x2f'),{'module':_0x4949('0x5a')});})[_0x4949('0x23')](handleError(_0x3955f9,null));}; \ No newline at end of file +var _0x5824=['Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','writeFileSync','html-pdf','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','ejs','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','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','VoiceContext,\x20%s,\x20%s','request\x20sent','debug','VoiceContext,\x20%s,\x20%s,\x20%s','stringify','code','error','message','result','catch','sendStatus','status','end','json','count','offset','limit','Content-Range','apply','save','update','destroy','get','Contexts','stack','name','send','index','map','fieldName','model','query','keys','intersection','attributes','fields','length','nolimit','sort','pick','filters','filter','where','options','VoiceContext','include','rows','show','params','rawAttributes','includeAll','find','create','findAll','readFileSync','join','root','server/files/templates/context.ejs','utf8','render','/etc/asterisk/extensions_xcally_contexts.conf','Reload','chan_sip.so','user'];(function(_0x9658dc,_0x4b1905){var _0x2ad48e=function(_0x3691e9){while(--_0x3691e9){_0x9658dc['push'](_0x9658dc['shift']());}};_0x2ad48e(++_0x4b1905);}(_0x5824,0x14e));var _0x4582=function(_0x528bd1,_0x35cf29){_0x528bd1=_0x528bd1-0x0;var _0x3e89f4=_0x5824[_0x528bd1];return _0x3e89f4;};'use strict';var pdf=require(_0x4582('0x0'));var emlformat=require(_0x4582('0x1'));var rimraf=require('rimraf');var zipdir=require(_0x4582('0x2'));var jsonpatch=require(_0x4582('0x3'));var rp=require(_0x4582('0x4'));var moment=require(_0x4582('0x5'));var BPromise=require(_0x4582('0x6'));var Mustache=require(_0x4582('0x7'));var util=require(_0x4582('0x8'));var path=require('path');var sox=require(_0x4582('0x9'));var csv=require('to-csv');var ejs=require(_0x4582('0xa'));var fs=require('fs');var _=require(_0x4582('0xb'));var squel=require(_0x4582('0xc'));var crypto=require(_0x4582('0xd'));var jsforce=require(_0x4582('0xe'));var deskjs=require(_0x4582('0xf'));var toCsv=require(_0x4582('0x10'));var querystring=require(_0x4582('0x11'));var Papa=require(_0x4582('0x12'));var Redis=require('ioredis');var authService=require(_0x4582('0x13'));var qs=require(_0x4582('0x14'));var as=require(_0x4582('0x15'));var hardwareService=require(_0x4582('0x16'));var logger=require(_0x4582('0x17'))(_0x4582('0x18'));var utils=require(_0x4582('0x19'));var config=require(_0x4582('0x1a'));var db=require(_0x4582('0x1b'))['db'];var jayson=require(_0x4582('0x1c'));var client=jayson[_0x4582('0x1d')][_0x4582('0x1e')]({'port':0x232a});function checkPasswordPattern(_0x370846,_0x4fda6f,_0x49f042){if(_0x49f042){var _0x5ba6a2=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x5ba6a2[_0x4582('0x1f')](_0x4fda6f)){return _0x370846;}else{throw new db[(_0x4582('0x20'))][(_0x4582('0x21'))](_0x4582('0x22'));}}else{return _0x370846;}}function respondWithRpcPromise(_0xe937b8,_0x294c43,_0x25aacc,_0x482aeb){return new BPromise(function(_0x4b3191,_0x434240){var _0x4c32b2=_0x482aeb||client;return _0x4c32b2[_0x4582('0x23')](_0xe937b8,_0x25aacc)[_0x4582('0x24')](function(_0x5c6996){logger[_0x4582('0x25')](_0x4582('0x26'),_0x294c43,_0x4582('0x27'));logger[_0x4582('0x28')](_0x4582('0x29'),_0x294c43,_0x4582('0x27'),JSON[_0x4582('0x2a')](_0x5c6996));if(_0x5c6996['error']){if(_0x5c6996['error'][_0x4582('0x2b')]===0x1f4){logger['error'](_0x4582('0x26'),_0x294c43,_0x5c6996[_0x4582('0x2c')][_0x4582('0x2d')]);return _0x434240(_0x5c6996[_0x4582('0x2c')][_0x4582('0x2d')]);}logger[_0x4582('0x2c')](_0x4582('0x26'),_0x294c43,_0x5c6996[_0x4582('0x2c')][_0x4582('0x2d')]);return _0x4b3191(_0x5c6996['error'][_0x4582('0x2d')]);}else{logger[_0x4582('0x25')]('VoiceContext,\x20%s,\x20%s',_0x294c43,'request\x20sent');_0x4b3191(_0x5c6996[_0x4582('0x2e')]['message']);}})[_0x4582('0x2f')](function(_0x466852){logger[_0x4582('0x2c')](_0x4582('0x26'),_0x294c43,_0x466852);_0x434240(_0x466852);});});}function respondWithStatusCode(_0x19745a,_0x2839d2){_0x2839d2=_0x2839d2||0xcc;return function(_0x5e0886){if(_0x5e0886){return _0x19745a[_0x4582('0x30')](_0x2839d2);}return _0x19745a[_0x4582('0x31')](_0x2839d2)[_0x4582('0x32')]();};}function respondWithResult(_0x3d03c7,_0x22c68d){_0x22c68d=_0x22c68d||0xc8;return function(_0x3ca1e0){if(_0x3ca1e0){return _0x3d03c7[_0x4582('0x31')](_0x22c68d)[_0x4582('0x33')](_0x3ca1e0);}};}function respondWithFilteredResult(_0x3033ed,_0x3ba086){return function(_0x24eb3d){if(_0x24eb3d){var _0x463434=_0x24eb3d[_0x4582('0x34')],_0x6c2abc=_0x3ba086[_0x4582('0x35')],_0x53deac=_0x3ba086[_0x4582('0x35')]+_0x3ba086[_0x4582('0x36')],_0x1b90a8;if(_0x53deac>=_0x463434){_0x53deac=_0x463434;_0x1b90a8=0xc8;}else{_0x1b90a8=0xce;}_0x3033ed[_0x4582('0x31')](_0x1b90a8);return _0x3033ed['set'](_0x4582('0x37'),_0x6c2abc+'-'+_0x53deac+'/'+_0x463434)[_0x4582('0x33')](_0x24eb3d);}return null;};}function patchUpdates(_0x54144f){return function(_0x19ee0a){try{jsonpatch[_0x4582('0x38')](_0x19ee0a,_0x54144f,!![]);}catch(_0x8146a7){return BPromise['reject'](_0x8146a7);}return _0x19ee0a[_0x4582('0x39')]();};}function saveUpdates(_0x1e858e,_0x30653a){return function(_0x30acf0){if(_0x30acf0){return _0x30acf0[_0x4582('0x3a')](_0x1e858e)[_0x4582('0x24')](function(_0x54bbc8){return _0x54bbc8;});}return null;};}function removeEntity(_0x5c2ee2,_0x35d264){return function(_0x2f80d6){if(_0x2f80d6){return _0x2f80d6[_0x4582('0x3b')]()['then'](function(){var _0x510ebf=_0x2f80d6[_0x4582('0x3c')]({'plain':!![]});var _0x3e5707=_0x4582('0x3d');return db['UserProfileResource'][_0x4582('0x3b')]({'where':{'type':_0x3e5707,'resourceId':_0x510ebf['id']}})[_0x4582('0x24')](function(){return _0x2f80d6;});})['then'](function(){_0x5c2ee2['status'](0xcc)[_0x4582('0x32')]();});}};}function handleEntityNotFound(_0x50a449,_0x389f35){return function(_0x44564f){if(!_0x44564f){_0x50a449[_0x4582('0x30')](0x194);}return _0x44564f;};}function handleError(_0x1cd635,_0x2f7b13){_0x2f7b13=_0x2f7b13||0x1f4;return function(_0x5b2aee){logger['error'](_0x5b2aee[_0x4582('0x3e')]);if(_0x5b2aee[_0x4582('0x3f')]){delete _0x5b2aee[_0x4582('0x3f')];}_0x1cd635['status'](_0x2f7b13)[_0x4582('0x40')](_0x5b2aee);};}exports[_0x4582('0x41')]=function(_0x2193ee,_0x230600){var _0x81f892={},_0x18f220={},_0x384223={'count':0x0,'rows':[]};var _0x5aac13=_[_0x4582('0x42')](db['VoiceContext']['rawAttributes'],function(_0x49068a){return{'name':_0x49068a[_0x4582('0x43')],'type':_0x49068a['type']['key']};});_0x18f220[_0x4582('0x44')]=_[_0x4582('0x42')](_0x5aac13,'name');_0x18f220[_0x4582('0x45')]=_[_0x4582('0x46')](_0x2193ee[_0x4582('0x45')]);_0x18f220['filters']=_[_0x4582('0x47')](_0x18f220[_0x4582('0x44')],_0x18f220[_0x4582('0x45')]);_0x81f892[_0x4582('0x48')]=_[_0x4582('0x47')](_0x18f220[_0x4582('0x44')],qs[_0x4582('0x49')](_0x2193ee[_0x4582('0x45')]['fields']));_0x81f892[_0x4582('0x48')]=_0x81f892[_0x4582('0x48')][_0x4582('0x4a')]?_0x81f892[_0x4582('0x48')]:_0x18f220['model'];if(!_0x2193ee['query']['hasOwnProperty'](_0x4582('0x4b'))){_0x81f892[_0x4582('0x36')]=qs['limit'](_0x2193ee[_0x4582('0x45')][_0x4582('0x36')]);_0x81f892[_0x4582('0x35')]=qs[_0x4582('0x35')](_0x2193ee[_0x4582('0x45')]['offset']);}_0x81f892['order']=qs[_0x4582('0x4c')](_0x2193ee[_0x4582('0x45')][_0x4582('0x4c')]);_0x81f892['where']=qs['filters'](_[_0x4582('0x4d')](_0x2193ee[_0x4582('0x45')],_0x18f220[_0x4582('0x4e')]));if(_0x2193ee[_0x4582('0x45')][_0x4582('0x4f')]){_0x81f892[_0x4582('0x50')]=_['merge'](_0x81f892[_0x4582('0x50')],{'$or':_[_0x4582('0x42')](_0x5aac13,function(_0x24ad20){if(_0x24ad20['type']!=='VIRTUAL'){var _0x35bdc2={};_0x35bdc2[_0x24ad20[_0x4582('0x3f')]]={'$like':'%'+_0x2193ee[_0x4582('0x45')][_0x4582('0x4f')]+'%'};return _0x35bdc2;}})});}_0x81f892=_['merge']({},_0x81f892,_0x2193ee[_0x4582('0x51')]);var _0x21e629={'where':_0x81f892['where']};return db[_0x4582('0x52')]['count'](_0x21e629)[_0x4582('0x24')](function(_0x1d9bd8){_0x384223[_0x4582('0x34')]=_0x1d9bd8;if(_0x2193ee[_0x4582('0x45')]['includeAll']){_0x81f892[_0x4582('0x53')]=[{'all':!![]}];}return db[_0x4582('0x52')]['findAll'](_0x81f892);})[_0x4582('0x24')](function(_0x4b4fa1){_0x384223[_0x4582('0x54')]=_0x4b4fa1;return _0x384223;})[_0x4582('0x24')](respondWithFilteredResult(_0x230600,_0x81f892))[_0x4582('0x2f')](handleError(_0x230600,null));};exports[_0x4582('0x55')]=function(_0x393340,_0x1a0e6f){var _0x292fae={'raw':![],'where':{'id':_0x393340[_0x4582('0x56')]['id']}},_0xe35886={};_0xe35886['model']=_['keys'](db[_0x4582('0x52')][_0x4582('0x57')]);_0xe35886[_0x4582('0x45')]=_[_0x4582('0x46')](_0x393340[_0x4582('0x45')]);_0xe35886[_0x4582('0x4e')]=_[_0x4582('0x47')](_0xe35886[_0x4582('0x44')],_0xe35886[_0x4582('0x45')]);_0x292fae[_0x4582('0x48')]=_[_0x4582('0x47')](_0xe35886[_0x4582('0x44')],qs[_0x4582('0x49')](_0x393340[_0x4582('0x45')][_0x4582('0x49')]));_0x292fae[_0x4582('0x48')]=_0x292fae[_0x4582('0x48')][_0x4582('0x4a')]?_0x292fae[_0x4582('0x48')]:_0xe35886[_0x4582('0x44')];if(_0x393340[_0x4582('0x45')][_0x4582('0x58')]){_0x292fae[_0x4582('0x53')]=[{'all':!![]}];}_0x292fae=_['merge']({},_0x292fae,_0x393340[_0x4582('0x51')]);return db[_0x4582('0x52')][_0x4582('0x59')](_0x292fae)[_0x4582('0x24')](handleEntityNotFound(_0x1a0e6f,null))[_0x4582('0x24')](respondWithResult(_0x1a0e6f,null))[_0x4582('0x2f')](handleError(_0x1a0e6f,null));};exports[_0x4582('0x5a')]=function(_0x12aba1,_0x5098ab,_0x5527f7){var _0x5676b9;return db[_0x4582('0x52')][_0x4582('0x5a')](_0x12aba1['body'],{'raw':!![]})[_0x4582('0x24')](function(_0x1dd19c){_0x5676b9=_0x1dd19c;return db['VoiceContext'][_0x4582('0x5b')]({'raw':!![]});})[_0x4582('0x24')](function(_0x223a85){var _0x15f4bc=fs[_0x4582('0x5c')](path[_0x4582('0x5d')](config[_0x4582('0x5e')],_0x4582('0x5f')),_0x4582('0x60'));var _0x157497=ejs[_0x4582('0x61')](_0x15f4bc,{'contexts':_0x223a85||[]});fs['writeFileSync'](_0x4582('0x62'),_0x157497);})[_0x4582('0x24')](function(){return respondWithRpcPromise(_0x4582('0x63'),_0x4582('0x5a'),{'module':_0x4582('0x64')});})[_0x4582('0x24')](function(){var _0x20b138=_0x12aba1[_0x4582('0x65')]['get']({'plain':!![]});if(!_0x20b138)throw new Error(_0x4582('0x66'));if(_0x20b138[_0x4582('0x67')]==='user'){var _0x145d7e=_0x5676b9[_0x4582('0x3c')]({'plain':!![]});return db[_0x4582('0x68')][_0x4582('0x59')]({'where':{'name':'Contexts','userProfileId':_0x20b138['userProfileId']},'raw':!![]})[_0x4582('0x24')](function(_0x5c06df){if(_0x5c06df&&_0x5c06df['autoAssociation']===0x0){return db[_0x4582('0x69')][_0x4582('0x5a')]({'name':_0x145d7e[_0x4582('0x3f')],'resourceId':_0x145d7e['id'],'type':_0x5c06df[_0x4582('0x3f')],'sectionId':_0x5c06df['id']},{})[_0x4582('0x24')](function(){return _0x5676b9;});}else{return _0x5676b9;}})[_0x4582('0x2f')](function(_0x238044){logger[_0x4582('0x2c')](_0x4582('0x6a'),_0x238044);throw _0x238044;});}return _0x5676b9;})[_0x4582('0x24')](respondWithResult(_0x5098ab,0xc9))['catch'](handleError(_0x5098ab,null));};exports['update']=function(_0x2e0baf,_0x25c811,_0x36c581){var _0x4a787f;return db[_0x4582('0x52')][_0x4582('0x59')]({'where':{'id':_0x2e0baf[_0x4582('0x56')]['id']}})[_0x4582('0x24')](handleEntityNotFound(_0x25c811,null))[_0x4582('0x24')](saveUpdates(_0x2e0baf[_0x4582('0x6b')],null))[_0x4582('0x24')](function(_0x1b0a59){if(_0x1b0a59){_0x4a787f=_0x1b0a59;return db['VoiceContext'][_0x4582('0x5b')]({'raw':!![]});}})[_0x4582('0x24')](function(_0x24900f){var _0x388bf4=fs[_0x4582('0x5c')](path[_0x4582('0x5d')](config[_0x4582('0x5e')],_0x4582('0x5f')),_0x4582('0x60'));var _0x1287bf=ejs['render'](_0x388bf4,{'contexts':_0x24900f||[]});fs[_0x4582('0x6c')]('/etc/asterisk/extensions_xcally_contexts.conf',_0x1287bf);})[_0x4582('0x24')](function(){return respondWithRpcPromise(_0x4582('0x63'),_0x4582('0x3a'),{'module':_0x4582('0x64')});})['then'](function(){return _0x4a787f;})[_0x4582('0x24')](respondWithResult(_0x25c811,null))[_0x4582('0x2f')](handleError(_0x25c811,null));};exports[_0x4582('0x3b')]=function(_0xc4e556,_0x1a36a0,_0x4672fd){var _0x53cda2;return db[_0x4582('0x52')]['find']({'where':{'id':_0xc4e556[_0x4582('0x56')]['id']}})[_0x4582('0x24')](handleEntityNotFound(_0x1a36a0,null))[_0x4582('0x24')](removeEntity(_0x1a36a0,null))[_0x4582('0x24')](function(){return db[_0x4582('0x52')][_0x4582('0x5b')]({'raw':!![]});})[_0x4582('0x24')](function(_0x231578){var _0x32412b=fs['readFileSync'](path['join'](config['root'],_0x4582('0x5f')),_0x4582('0x60'));var _0x2a3026=ejs[_0x4582('0x61')](_0x32412b,{'contexts':_0x231578});fs[_0x4582('0x6c')](_0x4582('0x62'),_0x2a3026);return respondWithRpcPromise(_0x4582('0x63'),'destroy',{'module':_0x4582('0x64')});})[_0x4582('0x2f')](handleError(_0x1a36a0,null));}; \ No newline at end of file diff --git a/server/api/voiceContext/voiceContext.model.js b/server/api/voiceContext/voiceContext.model.js index d7fadca..6bb56dd 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 _0x2de8=['bluebird','request-promise','rimraf','../../config/environment','./voiceContext.attributes','exports','define','VoiceContext','voice_contexts','lodash','util','../../config/logger','api','moment'];(function(_0x50589c,_0x561045){var _0x25f9c3=function(_0x410531){while(--_0x410531){_0x50589c['push'](_0x50589c['shift']());}};_0x25f9c3(++_0x561045);}(_0x2de8,0x191));var _0x82de=function(_0x150469,_0x5ec8a2){_0x150469=_0x150469-0x0;var _0x110773=_0x2de8[_0x150469];return _0x110773;};'use strict';var _=require(_0x82de('0x0'));var util=require(_0x82de('0x1'));var logger=require(_0x82de('0x2'))(_0x82de('0x3'));var moment=require(_0x82de('0x4'));var BPromise=require(_0x82de('0x5'));var rp=require(_0x82de('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0x82de('0x7'));var config=require(_0x82de('0x8'));var attributes=require(_0x82de('0x9'));module[_0x82de('0xa')]=function(_0x2baa2f,_0x281d4e){return _0x2baa2f[_0x82de('0xb')](_0x82de('0xc'),attributes,{'tableName':_0x82de('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x1e54=['define','VoiceContext','voice_contexts','util','../../config/logger','api','moment','bluebird','path','./voiceContext.attributes'];(function(_0x468da6,_0x51d6fb){var _0x44850c=function(_0x3529a8){while(--_0x3529a8){_0x468da6['push'](_0x468da6['shift']());}};_0x44850c(++_0x51d6fb);}(_0x1e54,0x14d));var _0x41e5=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x1e54[_0x3dd15e];return _0x231fd0;};'use strict';var _=require('lodash');var util=require(_0x41e5('0x0'));var logger=require(_0x41e5('0x1'))(_0x41e5('0x2'));var moment=require(_0x41e5('0x3'));var BPromise=require(_0x41e5('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x41e5('0x5'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x41e5('0x6'));module['exports']=function(_0xebbe54,_0x3f6591){return _0xebbe54[_0x41e5('0x7')](_0x41e5('0x8'),attributes,{'tableName':_0x41e5('0x9'),'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 84d1a20..e024772 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 _0x3f8c=['VoiceContext,\x20%s,\x20%s','request\x20sent','VoiceContext,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','moment','bluebird','randomstring','ioredis','jayson/promise','client','http','request','then','info'];(function(_0x56633a,_0x53ce26){var _0x25920e=function(_0x48c47f){while(--_0x48c47f){_0x56633a['push'](_0x56633a['shift']());}};_0x25920e(++_0x53ce26);}(_0x3f8c,0x104));var _0xc3f8=function(_0xfecd5d,_0x11b144){_0xfecd5d=_0xfecd5d-0x0;var _0x49cf92=_0x3f8c[_0xfecd5d];return _0x49cf92;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0xc3f8('0x0'));var BPromise=require(_0xc3f8('0x1'));var rs=require(_0xc3f8('0x2'));var fs=require('fs');var Redis=require(_0xc3f8('0x3'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')('rpc');var config=require('../../config/environment');var jayson=require(_0xc3f8('0x4'));var client=jayson[_0xc3f8('0x5')][_0xc3f8('0x6')]({'port':0x232a});function respondWithRpcPromise(_0x44c25d,_0x2bbaa5,_0x15512a){return new BPromise(function(_0x51093a,_0x28397e){return client[_0xc3f8('0x7')](_0x44c25d,_0x15512a)[_0xc3f8('0x8')](function(_0x3c340c){logger[_0xc3f8('0x9')](_0xc3f8('0xa'),_0x2bbaa5,_0xc3f8('0xb'));logger['debug'](_0xc3f8('0xc'),_0x2bbaa5,_0xc3f8('0xb'),JSON[_0xc3f8('0xd')](_0x3c340c));if(_0x3c340c[_0xc3f8('0xe')]){if(_0x3c340c['error'][_0xc3f8('0xf')]===0x1f4){logger[_0xc3f8('0xe')](_0xc3f8('0xa'),_0x2bbaa5,_0x3c340c[_0xc3f8('0xe')]['message']);return _0x28397e(_0x3c340c[_0xc3f8('0xe')][_0xc3f8('0x10')]);}logger[_0xc3f8('0xe')](_0xc3f8('0xa'),_0x2bbaa5,_0x3c340c[_0xc3f8('0xe')][_0xc3f8('0x10')]);return _0x51093a(_0x3c340c[_0xc3f8('0xe')][_0xc3f8('0x10')]);}else{logger[_0xc3f8('0x9')](_0xc3f8('0xa'),_0x2bbaa5,_0xc3f8('0xb'));_0x51093a(_0x3c340c[_0xc3f8('0x11')][_0xc3f8('0x10')]);}})['catch'](function(_0x14b3ed){logger['error']('VoiceContext,\x20%s,\x20%s',_0x2bbaa5,_0x14b3ed);_0x28397e(_0x14b3ed);});});} \ No newline at end of file +var _0xd5de=['lodash','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','request','info','VoiceContext,\x20%s,\x20%s','request\x20sent','VoiceContext,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch'];(function(_0x3e2a2a,_0x193e61){var _0x561847=function(_0x122b4d){while(--_0x122b4d){_0x3e2a2a['push'](_0x3e2a2a['shift']());}};_0x561847(++_0x193e61);}(_0xd5de,0x176));var _0xed5d=function(_0x502c7d,_0x2f1285){_0x502c7d=_0x502c7d-0x0;var _0x30b7ed=_0xd5de[_0x502c7d];return _0x30b7ed;};'use strict';var _=require(_0xed5d('0x0'));var util=require('util');var moment=require(_0xed5d('0x1'));var BPromise=require(_0xed5d('0x2'));var rs=require(_0xed5d('0x3'));var fs=require('fs');var Redis=require(_0xed5d('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0xed5d('0x5'));var logger=require(_0xed5d('0x6'))(_0xed5d('0x7'));var config=require(_0xed5d('0x8'));var jayson=require('jayson/promise');var client=jayson[_0xed5d('0x9')][_0xed5d('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x3f0fdf,_0xa1431e,_0x33534d){return new BPromise(function(_0x5b6a83,_0x57b97d){return client[_0xed5d('0xb')](_0x3f0fdf,_0x33534d)['then'](function(_0x20b6b0){logger[_0xed5d('0xc')](_0xed5d('0xd'),_0xa1431e,_0xed5d('0xe'));logger['debug'](_0xed5d('0xf'),_0xa1431e,_0xed5d('0xe'),JSON[_0xed5d('0x10')](_0x20b6b0));if(_0x20b6b0[_0xed5d('0x11')]){if(_0x20b6b0['error'][_0xed5d('0x12')]===0x1f4){logger[_0xed5d('0x11')](_0xed5d('0xd'),_0xa1431e,_0x20b6b0[_0xed5d('0x11')]['message']);return _0x57b97d(_0x20b6b0['error'][_0xed5d('0x13')]);}logger[_0xed5d('0x11')](_0xed5d('0xd'),_0xa1431e,_0x20b6b0[_0xed5d('0x11')][_0xed5d('0x13')]);return _0x5b6a83(_0x20b6b0['error'][_0xed5d('0x13')]);}else{logger[_0xed5d('0xc')]('VoiceContext,\x20%s,\x20%s',_0xa1431e,_0xed5d('0xe'));_0x5b6a83(_0x20b6b0[_0xed5d('0x14')][_0xed5d('0x13')]);}})[_0xed5d('0x15')](function(_0x3a4dad){logger['error']('VoiceContext,\x20%s,\x20%s',_0xa1431e,_0x3a4dad);_0x57b97d(_0x3a4dad);});});} \ No newline at end of file diff --git a/server/api/voiceDialReport/index.js b/server/api/voiceDialReport/index.js index 407c4b2..dab0e1b 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 _0x247a=['../../components/auth/service','../../config/environment','./voiceDialReport.controller','get','isAuthenticated','describe','/:id','show','create','put','delete','destroy','exports','multer','util','express','Router'];(function(_0x494a42,_0x1f2103){var _0x254792=function(_0x5f1c1d){while(--_0x5f1c1d){_0x494a42['push'](_0x494a42['shift']());}};_0x254792(++_0x1f2103);}(_0x247a,0x95));var _0xa247=function(_0x962edb,_0x5dd356){_0x962edb=_0x962edb-0x0;var _0x359dcf=_0x247a[_0x962edb];return _0x359dcf;};'use strict';var multer=require(_0xa247('0x0'));var util=require(_0xa247('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0xa247('0x2'));var router=express[_0xa247('0x3')]();var auth=require(_0xa247('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0xa247('0x5'));var controller=require(_0xa247('0x6'));router[_0xa247('0x7')]('/',auth[_0xa247('0x8')](),controller['index']);router[_0xa247('0x7')]('/describe',auth[_0xa247('0x8')](),controller[_0xa247('0x9')]);router[_0xa247('0x7')](_0xa247('0xa'),auth['isAuthenticated'](),controller[_0xa247('0xb')]);router['post']('/',auth[_0xa247('0x8')](),controller[_0xa247('0xc')]);router[_0xa247('0xd')](_0xa247('0xa'),auth[_0xa247('0x8')](),controller['update']);router[_0xa247('0xe')](_0xa247('0xa'),auth['isAuthenticated'](),controller[_0xa247('0xf')]);module[_0xa247('0x10')]=router; \ No newline at end of file +var _0xb97c=['multer','util','path','connect-timeout','Router','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/describe','describe','/:id','post','create','put','delete','destroy','exports'];(function(_0x4ee560,_0xa7b89){var _0x50aa2c=function(_0x128c57){while(--_0x128c57){_0x4ee560['push'](_0x4ee560['shift']());}};_0x50aa2c(++_0xa7b89);}(_0xb97c,0x72));var _0xcb97=function(_0x2bd732,_0x19da1c){_0x2bd732=_0x2bd732-0x0;var _0x40bce9=_0xb97c[_0x2bd732];return _0x40bce9;};'use strict';var multer=require(_0xcb97('0x0'));var util=require(_0xcb97('0x1'));var path=require(_0xcb97('0x2'));var timeout=require(_0xcb97('0x3'));var express=require('express');var router=express[_0xcb97('0x4')]();var auth=require('../../components/auth/service');var interaction=require(_0xcb97('0x5'));var config=require(_0xcb97('0x6'));var controller=require('./voiceDialReport.controller');router[_0xcb97('0x7')]('/',auth[_0xcb97('0x8')](),controller[_0xcb97('0x9')]);router[_0xcb97('0x7')](_0xcb97('0xa'),auth[_0xcb97('0x8')](),controller[_0xcb97('0xb')]);router[_0xcb97('0x7')](_0xcb97('0xc'),auth[_0xcb97('0x8')](),controller['show']);router[_0xcb97('0xd')]('/',auth[_0xcb97('0x8')](),controller[_0xcb97('0xe')]);router[_0xcb97('0xf')](_0xcb97('0xc'),auth[_0xcb97('0x8')](),controller['update']);router[_0xcb97('0x10')]('/:id',auth[_0xcb97('0x8')](),controller[_0xcb97('0x11')]);module[_0xcb97('0x12')]=router; \ No newline at end of file diff --git a/server/api/voiceDialReport/voiceDialReport.attributes.js b/server/api/voiceDialReport/voiceDialReport.attributes.js index b2299e2..1764efe 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 _0x4e58=['called,connect,complete','sequelize','exports','STRING','INTEGER','DATE'];(function(_0x422905,_0x3bce3a){var _0x33dc6c=function(_0x4852c9){while(--_0x4852c9){_0x422905['push'](_0x422905['shift']());}};_0x33dc6c(++_0x3bce3a);}(_0x4e58,0x1db));var _0x84e5=function(_0x45d55e,_0x2fede3){_0x45d55e=_0x45d55e-0x0;var _0x29812a=_0x4e58[_0x45d55e];return _0x29812a;};'use strict';var Sequelize=require(_0x84e5('0x0'));module[_0x84e5('0x1')]={'privilege':{'type':Sequelize[_0x84e5('0x2')]},'channel':{'type':Sequelize[_0x84e5('0x2')]},'channelstate':{'type':Sequelize[_0x84e5('0x3')]},'channelstatedesc':{'type':Sequelize[_0x84e5('0x2')]},'calleridnum':{'type':Sequelize[_0x84e5('0x2')]},'calleridname':{'type':Sequelize[_0x84e5('0x2')]},'connectedlinenum':{'type':Sequelize[_0x84e5('0x2')]},'connectedlinename':{'type':Sequelize[_0x84e5('0x2')]},'language':{'type':Sequelize['STRING']},'accountcode':{'type':Sequelize['STRING']},'context':{'type':Sequelize[_0x84e5('0x2')]},'exten':{'type':Sequelize[_0x84e5('0x2')]},'priority':{'type':Sequelize[_0x84e5('0x3')]},'uniqueid':{'type':Sequelize[_0x84e5('0x2')]},'linkedid':{'type':Sequelize[_0x84e5('0x2')]},'destchannel':{'type':Sequelize[_0x84e5('0x2')]},'destchannelstate':{'type':Sequelize[_0x84e5('0x3')]},'destchannelstatedesc':{'type':Sequelize[_0x84e5('0x2')]},'destcalleridnum':{'type':Sequelize[_0x84e5('0x2')]},'destcalleridname':{'type':Sequelize[_0x84e5('0x2')]},'destconnectedlinenum':{'type':Sequelize['STRING']},'destconnectedlinename':{'type':Sequelize[_0x84e5('0x2')]},'destlanguage':{'type':Sequelize[_0x84e5('0x2')]},'destaccountcode':{'type':Sequelize['STRING']},'destcontext':{'type':Sequelize[_0x84e5('0x2')]},'destexten':{'type':Sequelize[_0x84e5('0x2')]},'destpriority':{'type':Sequelize[_0x84e5('0x3')]},'destuniqueid':{'type':Sequelize[_0x84e5('0x2')]},'destlinkedid':{'type':Sequelize['STRING']},'dialstring':{'type':Sequelize['STRING']},'dialstatus':{'type':Sequelize[_0x84e5('0x2')]},'starttime':{'type':Sequelize[_0x84e5('0x4')]},'answertime':{'type':Sequelize[_0x84e5('0x4')]},'endtime':{'type':Sequelize['DATE']},'lastevent':{'type':Sequelize['STRING'],'comment':_0x84e5('0x5')},'routeId':{'type':Sequelize[_0x84e5('0x3')]},'duration':{'type':Sequelize[_0x84e5('0x3')]},'holdtime':{'type':Sequelize['INTEGER']},'billableseconds':{'type':Sequelize[_0x84e5('0x3')]}}; \ No newline at end of file +var _0xc244=['sequelize','exports','STRING','INTEGER','DATE'];(function(_0x365faa,_0xbc9687){var _0x5a0a8e=function(_0x203c7f){while(--_0x203c7f){_0x365faa['push'](_0x365faa['shift']());}};_0x5a0a8e(++_0xbc9687);}(_0xc244,0x190));var _0x4c24=function(_0x41c5fa,_0x37c159){_0x41c5fa=_0x41c5fa-0x0;var _0x55aff8=_0xc244[_0x41c5fa];return _0x55aff8;};'use strict';var Sequelize=require(_0x4c24('0x0'));module[_0x4c24('0x1')]={'privilege':{'type':Sequelize['STRING']},'channel':{'type':Sequelize[_0x4c24('0x2')]},'channelstate':{'type':Sequelize['INTEGER']},'channelstatedesc':{'type':Sequelize[_0x4c24('0x2')]},'calleridnum':{'type':Sequelize[_0x4c24('0x2')]},'calleridname':{'type':Sequelize['STRING']},'connectedlinenum':{'type':Sequelize[_0x4c24('0x2')]},'connectedlinename':{'type':Sequelize[_0x4c24('0x2')]},'language':{'type':Sequelize[_0x4c24('0x2')]},'accountcode':{'type':Sequelize['STRING']},'context':{'type':Sequelize[_0x4c24('0x2')]},'exten':{'type':Sequelize['STRING']},'priority':{'type':Sequelize[_0x4c24('0x3')]},'uniqueid':{'type':Sequelize[_0x4c24('0x2')]},'linkedid':{'type':Sequelize[_0x4c24('0x2')]},'destchannel':{'type':Sequelize[_0x4c24('0x2')]},'destchannelstate':{'type':Sequelize['INTEGER']},'destchannelstatedesc':{'type':Sequelize[_0x4c24('0x2')]},'destcalleridnum':{'type':Sequelize[_0x4c24('0x2')]},'destcalleridname':{'type':Sequelize[_0x4c24('0x2')]},'destconnectedlinenum':{'type':Sequelize[_0x4c24('0x2')]},'destconnectedlinename':{'type':Sequelize[_0x4c24('0x2')]},'destlanguage':{'type':Sequelize['STRING']},'destaccountcode':{'type':Sequelize['STRING']},'destcontext':{'type':Sequelize[_0x4c24('0x2')]},'destexten':{'type':Sequelize['STRING']},'destpriority':{'type':Sequelize[_0x4c24('0x3')]},'destuniqueid':{'type':Sequelize[_0x4c24('0x2')]},'destlinkedid':{'type':Sequelize[_0x4c24('0x2')]},'dialstring':{'type':Sequelize[_0x4c24('0x2')]},'dialstatus':{'type':Sequelize[_0x4c24('0x2')]},'starttime':{'type':Sequelize[_0x4c24('0x4')]},'answertime':{'type':Sequelize['DATE']},'endtime':{'type':Sequelize['DATE']},'lastevent':{'type':Sequelize[_0x4c24('0x2')],'comment':'called,connect,complete'},'routeId':{'type':Sequelize[_0x4c24('0x3')]},'duration':{'type':Sequelize[_0x4c24('0x3')]},'holdtime':{'type':Sequelize[_0x4c24('0x3')]},'billableseconds':{'type':Sequelize[_0x4c24('0x3')]}}; \ No newline at end of file diff --git a/server/api/voiceDialReport/voiceDialReport.controller.js b/server/api/voiceDialReport/voiceDialReport.controller.js index ee9e481..c51ab81 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 _0x3ab9=['zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','to-csv','lodash','squel','jsforce','desk.js','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../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','error','name','map','VoiceDialReport','fieldName','key','model','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','pick','filter','where','VIRTUAL','merge','findAll','rows','catch','show','params','include','options','find','create','body','describe','html-pdf','eml-format','rimraf'];(function(_0x4565bf,_0x5ad9d6){var _0x5610ba=function(_0x170988){while(--_0x170988){_0x4565bf['push'](_0x4565bf['shift']());}};_0x5610ba(++_0x5ad9d6);}(_0x3ab9,0x91));var _0x93ab=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x3ab9[_0x3dd15e];return _0x231fd0;};'use strict';var pdf=require(_0x93ab('0x0'));var emlformat=require(_0x93ab('0x1'));var rimraf=require(_0x93ab('0x2'));var zipdir=require(_0x93ab('0x3'));var jsonpatch=require(_0x93ab('0x4'));var rp=require(_0x93ab('0x5'));var moment=require(_0x93ab('0x6'));var BPromise=require(_0x93ab('0x7'));var Mustache=require(_0x93ab('0x8'));var util=require('util');var path=require(_0x93ab('0x9'));var sox=require(_0x93ab('0xa'));var csv=require(_0x93ab('0xb'));var ejs=require('ejs');var fs=require('fs');var _=require(_0x93ab('0xc'));var squel=require(_0x93ab('0xd'));var crypto=require('crypto');var jsforce=require(_0x93ab('0xe'));var deskjs=require(_0x93ab('0xf'));var toCsv=require(_0x93ab('0xb'));var querystring=require('querystring');var Papa=require(_0x93ab('0x10'));var Redis=require('ioredis');var authService=require(_0x93ab('0x11'));var qs=require(_0x93ab('0x12'));var as=require(_0x93ab('0x13'));var hardwareService=require(_0x93ab('0x14'));var logger=require(_0x93ab('0x15'))(_0x93ab('0x16'));var utils=require('../../config/utils');var config=require(_0x93ab('0x17'));var db=require(_0x93ab('0x18'))['db'];function respondWithStatusCode(_0x36213a,_0x177f1f){_0x177f1f=_0x177f1f||0xcc;return function(_0x5e41af){if(_0x5e41af){return _0x36213a[_0x93ab('0x19')](_0x177f1f);}return _0x36213a[_0x93ab('0x1a')](_0x177f1f)[_0x93ab('0x1b')]();};}function respondWithResult(_0x4e5b38,_0x5185ce){_0x5185ce=_0x5185ce||0xc8;return function(_0x19fd0b){if(_0x19fd0b){return _0x4e5b38[_0x93ab('0x1a')](_0x5185ce)[_0x93ab('0x1c')](_0x19fd0b);}};}function respondWithFilteredResult(_0xb4f8fb,_0x209b68){return function(_0x156b8e){if(_0x156b8e){var _0x2826d7=_0x156b8e[_0x93ab('0x1d')],_0x2198b8=_0x209b68[_0x93ab('0x1e')],_0x50b153=_0x209b68[_0x93ab('0x1e')]+_0x209b68[_0x93ab('0x1f')],_0x4e4f88;if(_0x50b153>=_0x2826d7){_0x50b153=_0x2826d7;_0x4e4f88=0xc8;}else{_0x4e4f88=0xce;}_0xb4f8fb['status'](_0x4e4f88);return _0xb4f8fb[_0x93ab('0x20')](_0x93ab('0x21'),_0x2198b8+'-'+_0x50b153+'/'+_0x2826d7)['json'](_0x156b8e);}return null;};}function patchUpdates(_0x192a12){return function(_0x78f684){try{jsonpatch[_0x93ab('0x22')](_0x78f684,_0x192a12,!![]);}catch(_0x42f7ca){return BPromise[_0x93ab('0x23')](_0x42f7ca);}return _0x78f684[_0x93ab('0x24')]();};}function saveUpdates(_0x416750,_0x1a87cc){return function(_0x412faf){if(_0x412faf){return _0x412faf[_0x93ab('0x25')](_0x416750)[_0x93ab('0x26')](function(_0x268fd1){return _0x268fd1;});}return null;};}function removeEntity(_0x207034,_0x1ba5f8){return function(_0x46450d){if(_0x46450d){return _0x46450d[_0x93ab('0x27')]()[_0x93ab('0x26')](function(){_0x207034[_0x93ab('0x1a')](0xcc)[_0x93ab('0x1b')]();});}};}function handleEntityNotFound(_0x3af59e,_0x38ccc8){return function(_0x589d45){if(!_0x589d45){_0x3af59e[_0x93ab('0x19')](0x194);}return _0x589d45;};}function handleError(_0x58725a,_0x45710c){_0x45710c=_0x45710c||0x1f4;return function(_0x533ab9){logger[_0x93ab('0x28')](_0x533ab9['stack']);if(_0x533ab9[_0x93ab('0x29')]){delete _0x533ab9['name'];}_0x58725a[_0x93ab('0x1a')](_0x45710c)['send'](_0x533ab9);};}exports['index']=function(_0x46b2c2,_0x4b908a){var _0x1c28d5={},_0x5668a0={},_0x39ac05={'count':0x0,'rows':[]};var _0x446df1=_[_0x93ab('0x2a')](db[_0x93ab('0x2b')]['rawAttributes'],function(_0x1bb445){return{'name':_0x1bb445[_0x93ab('0x2c')],'type':_0x1bb445['type'][_0x93ab('0x2d')]};});_0x5668a0[_0x93ab('0x2e')]=_['map'](_0x446df1,_0x93ab('0x29'));_0x5668a0['query']=_[_0x93ab('0x2f')](_0x46b2c2[_0x93ab('0x30')]);_0x5668a0[_0x93ab('0x31')]=_[_0x93ab('0x32')](_0x5668a0['model'],_0x5668a0[_0x93ab('0x30')]);_0x1c28d5[_0x93ab('0x33')]=_[_0x93ab('0x32')](_0x5668a0['model'],qs[_0x93ab('0x34')](_0x46b2c2[_0x93ab('0x30')]['fields']));_0x1c28d5[_0x93ab('0x33')]=_0x1c28d5[_0x93ab('0x33')][_0x93ab('0x35')]?_0x1c28d5[_0x93ab('0x33')]:_0x5668a0[_0x93ab('0x2e')];if(!_0x46b2c2[_0x93ab('0x30')][_0x93ab('0x36')](_0x93ab('0x37'))){_0x1c28d5[_0x93ab('0x1f')]=qs['limit'](_0x46b2c2[_0x93ab('0x30')][_0x93ab('0x1f')]);_0x1c28d5['offset']=qs[_0x93ab('0x1e')](_0x46b2c2[_0x93ab('0x30')][_0x93ab('0x1e')]);}_0x1c28d5[_0x93ab('0x38')]=qs[_0x93ab('0x39')](_0x46b2c2['query'][_0x93ab('0x39')]);_0x1c28d5['where']=qs[_0x93ab('0x31')](_[_0x93ab('0x3a')](_0x46b2c2['query'],_0x5668a0[_0x93ab('0x31')]));if(_0x46b2c2[_0x93ab('0x30')][_0x93ab('0x3b')]){_0x1c28d5[_0x93ab('0x3c')]=_['merge'](_0x1c28d5[_0x93ab('0x3c')],{'$or':_['map'](_0x446df1,function(_0x67e228){if(_0x67e228['type']!==_0x93ab('0x3d')){var _0x42e7dd={};_0x42e7dd[_0x67e228[_0x93ab('0x29')]]={'$like':'%'+_0x46b2c2['query'][_0x93ab('0x3b')]+'%'};return _0x42e7dd;}})});}_0x1c28d5=_[_0x93ab('0x3e')]({},_0x1c28d5,_0x46b2c2['options']);var _0x2aad8e={'where':_0x1c28d5[_0x93ab('0x3c')]};return db['VoiceDialReport'][_0x93ab('0x1d')](_0x2aad8e)[_0x93ab('0x26')](function(_0x402ad0){_0x39ac05[_0x93ab('0x1d')]=_0x402ad0;if(_0x46b2c2[_0x93ab('0x30')]['includeAll']){_0x1c28d5['include']=[{'all':!![]}];}return db[_0x93ab('0x2b')][_0x93ab('0x3f')](_0x1c28d5);})[_0x93ab('0x26')](function(_0x446be4){_0x39ac05[_0x93ab('0x40')]=_0x446be4;return _0x39ac05;})['then'](respondWithFilteredResult(_0x4b908a,_0x1c28d5))[_0x93ab('0x41')](handleError(_0x4b908a,null));};exports[_0x93ab('0x42')]=function(_0x57b678,_0x2483c4){var _0x1ddf8b={'raw':!![],'where':{'id':_0x57b678[_0x93ab('0x43')]['id']}},_0x5bacc2={};_0x5bacc2['model']=_[_0x93ab('0x2f')](db['VoiceDialReport']['rawAttributes']);_0x5bacc2[_0x93ab('0x30')]=_[_0x93ab('0x2f')](_0x57b678[_0x93ab('0x30')]);_0x5bacc2[_0x93ab('0x31')]=_[_0x93ab('0x32')](_0x5bacc2['model'],_0x5bacc2[_0x93ab('0x30')]);_0x1ddf8b[_0x93ab('0x33')]=_[_0x93ab('0x32')](_0x5bacc2[_0x93ab('0x2e')],qs['fields'](_0x57b678[_0x93ab('0x30')]['fields']));_0x1ddf8b[_0x93ab('0x33')]=_0x1ddf8b[_0x93ab('0x33')]['length']?_0x1ddf8b[_0x93ab('0x33')]:_0x5bacc2[_0x93ab('0x2e')];if(_0x57b678[_0x93ab('0x30')]['includeAll']){_0x1ddf8b[_0x93ab('0x44')]=[{'all':!![]}];}_0x1ddf8b=_[_0x93ab('0x3e')]({},_0x1ddf8b,_0x57b678[_0x93ab('0x45')]);return db[_0x93ab('0x2b')][_0x93ab('0x46')](_0x1ddf8b)['then'](handleEntityNotFound(_0x2483c4,null))['then'](respondWithResult(_0x2483c4,null))['catch'](handleError(_0x2483c4,null));};exports[_0x93ab('0x47')]=function(_0x20ac9e,_0x36cfe5){return db['VoiceDialReport'][_0x93ab('0x47')](_0x20ac9e[_0x93ab('0x48')],{})[_0x93ab('0x26')](respondWithResult(_0x36cfe5,0xc9))[_0x93ab('0x41')](handleError(_0x36cfe5,null));};exports[_0x93ab('0x25')]=function(_0x465c51,_0x360252){if(_0x465c51[_0x93ab('0x48')]['id']){delete _0x465c51['body']['id'];}return db[_0x93ab('0x2b')][_0x93ab('0x46')]({'where':{'id':_0x465c51[_0x93ab('0x43')]['id']}})[_0x93ab('0x26')](handleEntityNotFound(_0x360252,null))[_0x93ab('0x26')](saveUpdates(_0x465c51[_0x93ab('0x48')],null))[_0x93ab('0x26')](respondWithResult(_0x360252,null))[_0x93ab('0x41')](handleError(_0x360252,null));};exports[_0x93ab('0x27')]=function(_0x2a0936,_0x1f9702){return db['VoiceDialReport'][_0x93ab('0x46')]({'where':{'id':_0x2a0936[_0x93ab('0x43')]['id']}})['then'](handleEntityNotFound(_0x1f9702,null))[_0x93ab('0x26')](removeEntity(_0x1f9702,null))[_0x93ab('0x41')](handleError(_0x1f9702,null));};exports[_0x93ab('0x49')]=function(_0xa05cb7,_0x59c623){return db['VoiceDialReport'][_0x93ab('0x49')]()[_0x93ab('0x26')](respondWithResult(_0x59c623,null))[_0x93ab('0x41')](handleError(_0x59c623,null));}; \ No newline at end of file +var _0x9958=['describe','eml-format','rimraf','zip-dir','fast-json-patch','bluebird','mustache','util','sox','ejs','lodash','crypto','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','sendStatus','status','end','json','offset','set','apply','update','destroy','then','error','stack','name','send','index','map','VoiceDialReport','rawAttributes','type','key','model','keys','filters','intersection','query','attributes','fields','length','hasOwnProperty','nolimit','limit','sort','pick','filter','where','merge','options','count','findAll','rows','catch','show','params','includeAll','find','create','body'];(function(_0x429482,_0x49a379){var _0x2d16c4=function(_0x5482f4){while(--_0x5482f4){_0x429482['push'](_0x429482['shift']());}};_0x2d16c4(++_0x49a379);}(_0x9958,0x8f));var _0x8995=function(_0xfb175a,_0x197822){_0xfb175a=_0xfb175a-0x0;var _0xe5caf7=_0x9958[_0xfb175a];return _0xe5caf7;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x8995('0x0'));var rimraf=require(_0x8995('0x1'));var zipdir=require(_0x8995('0x2'));var jsonpatch=require(_0x8995('0x3'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x8995('0x4'));var Mustache=require(_0x8995('0x5'));var util=require(_0x8995('0x6'));var path=require('path');var sox=require(_0x8995('0x7'));var csv=require('to-csv');var ejs=require(_0x8995('0x8'));var fs=require('fs');var _=require(_0x8995('0x9'));var squel=require('squel');var crypto=require(_0x8995('0xa'));var jsforce=require('jsforce');var deskjs=require(_0x8995('0xb'));var toCsv=require(_0x8995('0xc'));var querystring=require(_0x8995('0xd'));var Papa=require(_0x8995('0xe'));var Redis=require(_0x8995('0xf'));var authService=require(_0x8995('0x10'));var qs=require(_0x8995('0x11'));var as=require(_0x8995('0x12'));var hardwareService=require(_0x8995('0x13'));var logger=require('../../config/logger')(_0x8995('0x14'));var utils=require(_0x8995('0x15'));var config=require(_0x8995('0x16'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x17fd80,_0x5c5bf3){_0x5c5bf3=_0x5c5bf3||0xcc;return function(_0x40395a){if(_0x40395a){return _0x17fd80[_0x8995('0x17')](_0x5c5bf3);}return _0x17fd80[_0x8995('0x18')](_0x5c5bf3)[_0x8995('0x19')]();};}function respondWithResult(_0x1ac9a0,_0x5c8c20){_0x5c8c20=_0x5c8c20||0xc8;return function(_0x464f58){if(_0x464f58){return _0x1ac9a0[_0x8995('0x18')](_0x5c8c20)[_0x8995('0x1a')](_0x464f58);}};}function respondWithFilteredResult(_0x41927b,_0xf6bae4){return function(_0x2ab945){if(_0x2ab945){var _0x4a3c5d=_0x2ab945['count'],_0x403bf7=_0xf6bae4['offset'],_0x33427b=_0xf6bae4[_0x8995('0x1b')]+_0xf6bae4['limit'],_0x423e00;if(_0x33427b>=_0x4a3c5d){_0x33427b=_0x4a3c5d;_0x423e00=0xc8;}else{_0x423e00=0xce;}_0x41927b['status'](_0x423e00);return _0x41927b[_0x8995('0x1c')]('Content-Range',_0x403bf7+'-'+_0x33427b+'/'+_0x4a3c5d)[_0x8995('0x1a')](_0x2ab945);}return null;};}function patchUpdates(_0x3ca3f8){return function(_0x4ddd13){try{jsonpatch[_0x8995('0x1d')](_0x4ddd13,_0x3ca3f8,!![]);}catch(_0xe51b40){return BPromise['reject'](_0xe51b40);}return _0x4ddd13['save']();};}function saveUpdates(_0x18d63b,_0x10d11b){return function(_0x19f65c){if(_0x19f65c){return _0x19f65c[_0x8995('0x1e')](_0x18d63b)['then'](function(_0x2dac4e){return _0x2dac4e;});}return null;};}function removeEntity(_0x23c8eb,_0x97826){return function(_0x15a81f){if(_0x15a81f){return _0x15a81f[_0x8995('0x1f')]()[_0x8995('0x20')](function(){_0x23c8eb[_0x8995('0x18')](0xcc)[_0x8995('0x19')]();});}};}function handleEntityNotFound(_0x3673c4,_0x2208e5){return function(_0x1fd383){if(!_0x1fd383){_0x3673c4[_0x8995('0x17')](0x194);}return _0x1fd383;};}function handleError(_0xca91d2,_0x1c7239){_0x1c7239=_0x1c7239||0x1f4;return function(_0x4e6cf4){logger[_0x8995('0x21')](_0x4e6cf4[_0x8995('0x22')]);if(_0x4e6cf4[_0x8995('0x23')]){delete _0x4e6cf4[_0x8995('0x23')];}_0xca91d2[_0x8995('0x18')](_0x1c7239)[_0x8995('0x24')](_0x4e6cf4);};}exports[_0x8995('0x25')]=function(_0x3063cf,_0x4d4431){var _0x1ff194={},_0xfb2325={},_0xa8a789={'count':0x0,'rows':[]};var _0x1ba6dc=_[_0x8995('0x26')](db[_0x8995('0x27')][_0x8995('0x28')],function(_0x1a9b8d){return{'name':_0x1a9b8d['fieldName'],'type':_0x1a9b8d[_0x8995('0x29')][_0x8995('0x2a')]};});_0xfb2325[_0x8995('0x2b')]=_['map'](_0x1ba6dc,_0x8995('0x23'));_0xfb2325['query']=_[_0x8995('0x2c')](_0x3063cf['query']);_0xfb2325[_0x8995('0x2d')]=_[_0x8995('0x2e')](_0xfb2325[_0x8995('0x2b')],_0xfb2325[_0x8995('0x2f')]);_0x1ff194[_0x8995('0x30')]=_['intersection'](_0xfb2325[_0x8995('0x2b')],qs['fields'](_0x3063cf[_0x8995('0x2f')][_0x8995('0x31')]));_0x1ff194[_0x8995('0x30')]=_0x1ff194[_0x8995('0x30')][_0x8995('0x32')]?_0x1ff194[_0x8995('0x30')]:_0xfb2325[_0x8995('0x2b')];if(!_0x3063cf[_0x8995('0x2f')][_0x8995('0x33')](_0x8995('0x34'))){_0x1ff194['limit']=qs[_0x8995('0x35')](_0x3063cf[_0x8995('0x2f')][_0x8995('0x35')]);_0x1ff194[_0x8995('0x1b')]=qs[_0x8995('0x1b')](_0x3063cf[_0x8995('0x2f')][_0x8995('0x1b')]);}_0x1ff194['order']=qs['sort'](_0x3063cf[_0x8995('0x2f')][_0x8995('0x36')]);_0x1ff194['where']=qs[_0x8995('0x2d')](_[_0x8995('0x37')](_0x3063cf[_0x8995('0x2f')],_0xfb2325[_0x8995('0x2d')]));if(_0x3063cf[_0x8995('0x2f')][_0x8995('0x38')]){_0x1ff194[_0x8995('0x39')]=_[_0x8995('0x3a')](_0x1ff194[_0x8995('0x39')],{'$or':_[_0x8995('0x26')](_0x1ba6dc,function(_0x48b1f6){if(_0x48b1f6[_0x8995('0x29')]!=='VIRTUAL'){var _0x19b59e={};_0x19b59e[_0x48b1f6['name']]={'$like':'%'+_0x3063cf['query']['filter']+'%'};return _0x19b59e;}})});}_0x1ff194=_[_0x8995('0x3a')]({},_0x1ff194,_0x3063cf[_0x8995('0x3b')]);var _0x4442bc={'where':_0x1ff194['where']};return db[_0x8995('0x27')][_0x8995('0x3c')](_0x4442bc)[_0x8995('0x20')](function(_0x50f798){_0xa8a789['count']=_0x50f798;if(_0x3063cf['query']['includeAll']){_0x1ff194['include']=[{'all':!![]}];}return db[_0x8995('0x27')][_0x8995('0x3d')](_0x1ff194);})['then'](function(_0x53484d){_0xa8a789[_0x8995('0x3e')]=_0x53484d;return _0xa8a789;})[_0x8995('0x20')](respondWithFilteredResult(_0x4d4431,_0x1ff194))[_0x8995('0x3f')](handleError(_0x4d4431,null));};exports[_0x8995('0x40')]=function(_0x1ff7d5,_0x491658){var _0x3cd165={'raw':!![],'where':{'id':_0x1ff7d5[_0x8995('0x41')]['id']}},_0x40ad6c={};_0x40ad6c[_0x8995('0x2b')]=_['keys'](db[_0x8995('0x27')][_0x8995('0x28')]);_0x40ad6c[_0x8995('0x2f')]=_[_0x8995('0x2c')](_0x1ff7d5[_0x8995('0x2f')]);_0x40ad6c[_0x8995('0x2d')]=_[_0x8995('0x2e')](_0x40ad6c[_0x8995('0x2b')],_0x40ad6c[_0x8995('0x2f')]);_0x3cd165['attributes']=_[_0x8995('0x2e')](_0x40ad6c[_0x8995('0x2b')],qs[_0x8995('0x31')](_0x1ff7d5[_0x8995('0x2f')][_0x8995('0x31')]));_0x3cd165[_0x8995('0x30')]=_0x3cd165[_0x8995('0x30')][_0x8995('0x32')]?_0x3cd165[_0x8995('0x30')]:_0x40ad6c[_0x8995('0x2b')];if(_0x1ff7d5[_0x8995('0x2f')][_0x8995('0x42')]){_0x3cd165['include']=[{'all':!![]}];}_0x3cd165=_[_0x8995('0x3a')]({},_0x3cd165,_0x1ff7d5[_0x8995('0x3b')]);return db[_0x8995('0x27')][_0x8995('0x43')](_0x3cd165)['then'](handleEntityNotFound(_0x491658,null))[_0x8995('0x20')](respondWithResult(_0x491658,null))[_0x8995('0x3f')](handleError(_0x491658,null));};exports[_0x8995('0x44')]=function(_0x3a333e,_0x30d305){return db[_0x8995('0x27')][_0x8995('0x44')](_0x3a333e[_0x8995('0x45')],{})[_0x8995('0x20')](respondWithResult(_0x30d305,0xc9))['catch'](handleError(_0x30d305,null));};exports[_0x8995('0x1e')]=function(_0xbf32dd,_0x676dbf){if(_0xbf32dd[_0x8995('0x45')]['id']){delete _0xbf32dd[_0x8995('0x45')]['id'];}return db[_0x8995('0x27')][_0x8995('0x43')]({'where':{'id':_0xbf32dd[_0x8995('0x41')]['id']}})['then'](handleEntityNotFound(_0x676dbf,null))[_0x8995('0x20')](saveUpdates(_0xbf32dd[_0x8995('0x45')],null))[_0x8995('0x20')](respondWithResult(_0x676dbf,null))['catch'](handleError(_0x676dbf,null));};exports['destroy']=function(_0x2d9de4,_0x4015f3){return db['VoiceDialReport']['find']({'where':{'id':_0x2d9de4[_0x8995('0x41')]['id']}})[_0x8995('0x20')](handleEntityNotFound(_0x4015f3,null))[_0x8995('0x20')](removeEntity(_0x4015f3,null))['catch'](handleError(_0x4015f3,null));};exports['describe']=function(_0x94865f,_0x51da70){return db[_0x8995('0x27')][_0x8995('0x46')]()[_0x8995('0x20')](respondWithResult(_0x51da70,null))[_0x8995('0x3f')](handleError(_0x51da70,null));}; \ No newline at end of file diff --git a/server/api/voiceDialReport/voiceDialReport.model.js b/server/api/voiceDialReport/voiceDialReport.model.js index ecf59d5..1e53acc 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 _0xd817=['moment','bluebird','../../config/environment','./voiceDialReport.attributes','exports','define','VoiceDialReport','report_dial','uniqueid','util','../../config/logger','api'];(function(_0x1573ea,_0x434f02){var _0x51c0e2=function(_0x5c9b28){while(--_0x5c9b28){_0x1573ea['push'](_0x1573ea['shift']());}};_0x51c0e2(++_0x434f02);}(_0xd817,0xb1));var _0x7d81=function(_0x1fb7d1,_0x108781){_0x1fb7d1=_0x1fb7d1-0x0;var _0x2480d8=_0xd817[_0x1fb7d1];return _0x2480d8;};'use strict';var _=require('lodash');var util=require(_0x7d81('0x0'));var logger=require(_0x7d81('0x1'))(_0x7d81('0x2'));var moment=require(_0x7d81('0x3'));var BPromise=require(_0x7d81('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x7d81('0x5'));var attributes=require(_0x7d81('0x6'));module[_0x7d81('0x7')]=function(_0x1a3baa,_0x4341f7){return _0x1a3baa[_0x7d81('0x8')](_0x7d81('0x9'),attributes,{'tableName':_0x7d81('0xa'),'paranoid':![],'indexes':[{'fields':[_0x7d81('0xb')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xf58a=['path','rimraf','../../config/environment','./voiceDialReport.attributes','exports','define','VoiceDialReport','lodash','util','../../config/logger','api','moment','request-promise'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xf58a,0x180));var _0xaf58=function(_0x72f2ba,_0x18fdfc){_0x72f2ba=_0x72f2ba-0x0;var _0x5ab7bd=_0xf58a[_0x72f2ba];return _0x5ab7bd;};'use strict';var _=require(_0xaf58('0x0'));var util=require(_0xaf58('0x1'));var logger=require(_0xaf58('0x2'))(_0xaf58('0x3'));var moment=require(_0xaf58('0x4'));var BPromise=require('bluebird');var rp=require(_0xaf58('0x5'));var fs=require('fs');var path=require(_0xaf58('0x6'));var rimraf=require(_0xaf58('0x7'));var config=require(_0xaf58('0x8'));var attributes=require(_0xaf58('0x9'));module[_0xaf58('0xa')]=function(_0x4e47c6,_0x1af9bc){return _0x4e47c6[_0xaf58('0xb')](_0xaf58('0xc'),attributes,{'tableName':'report_dial','paranoid':![],'indexes':[{'fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceDialReport/voiceDialReport.rpc.js b/server/api/voiceDialReport/voiceDialReport.rpc.js index fe29689..0c374ce 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 _0x89fe=['../../mysqldb','../../config/logger','rpc','../../config/environment','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','raw','options','where','limit','UpdateVoiceDialReport','lodash','util','moment','bluebird','ioredis'];(function(_0x52e4bd,_0x4d5c69){var _0x3df821=function(_0x4c77ea){while(--_0x4c77ea){_0x52e4bd['push'](_0x52e4bd['shift']());}};_0x3df821(++_0x4d5c69);}(_0x89fe,0x83));var _0xe89f=function(_0x4537cf,_0x5bd246){_0x4537cf=_0x4537cf-0x0;var _0x773ac5=_0x89fe[_0x4537cf];return _0x773ac5;};'use strict';var _=require(_0xe89f('0x0'));var util=require(_0xe89f('0x1'));var moment=require(_0xe89f('0x2'));var BPromise=require(_0xe89f('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xe89f('0x4'));var db=require(_0xe89f('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0xe89f('0x6'))(_0xe89f('0x7'));var config=require(_0xe89f('0x8'));var jayson=require(_0xe89f('0x9'));var client=jayson[_0xe89f('0xa')][_0xe89f('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x24358f,_0x5427d2,_0x4639f0){return new BPromise(function(_0x3e9998,_0x7043f3){return client[_0xe89f('0xc')](_0x24358f,_0x4639f0)[_0xe89f('0xd')](function(_0x4fa2fa){logger[_0xe89f('0xe')](_0xe89f('0xf'),_0x5427d2,_0xe89f('0x10'));logger[_0xe89f('0x11')](_0xe89f('0x12'),_0x5427d2,_0xe89f('0x10'),JSON[_0xe89f('0x13')](_0x4fa2fa));if(_0x4fa2fa[_0xe89f('0x14')]){if(_0x4fa2fa[_0xe89f('0x14')][_0xe89f('0x15')]===0x1f4){logger['error']('VoiceDialReport,\x20%s,\x20%s',_0x5427d2,_0x4fa2fa['error']['message']);return _0x7043f3(_0x4fa2fa['error'][_0xe89f('0x16')]);}logger[_0xe89f('0x14')]('VoiceDialReport,\x20%s,\x20%s',_0x5427d2,_0x4fa2fa['error'][_0xe89f('0x16')]);return _0x3e9998(_0x4fa2fa[_0xe89f('0x14')][_0xe89f('0x16')]);}else{logger[_0xe89f('0xe')](_0xe89f('0xf'),_0x5427d2,_0xe89f('0x10'));_0x3e9998(_0x4fa2fa[_0xe89f('0x17')][_0xe89f('0x16')]);}})[_0xe89f('0x18')](function(_0x16bfe0){logger['error'](_0xe89f('0xf'),_0x5427d2,_0x16bfe0);_0x7043f3(_0x16bfe0);});});}exports[_0xe89f('0x19')]=function(_0x510e6e){var _0x5106e4=this;return new Promise(function(_0x11e5e1,_0x127517){return db[_0xe89f('0x1a')][_0xe89f('0x1b')](_0x510e6e[_0xe89f('0x1c')],{'raw':_0x510e6e['options']?_0x510e6e['options'][_0xe89f('0x1d')]===undefined?!![]:![]:!![]})['then'](function(_0x237718){logger[_0xe89f('0xe')](_0xe89f('0x19'),_0x510e6e);logger[_0xe89f('0x11')](_0xe89f('0x19'),_0x510e6e,JSON[_0xe89f('0x13')](_0x237718));_0x11e5e1(_0x237718);})[_0xe89f('0x18')](function(_0x559d84){logger[_0xe89f('0x14')](_0xe89f('0x19'),_0x559d84['message'],_0x510e6e);_0x127517(_0x5106e4['error'](0x1f4,_0x559d84[_0xe89f('0x16')]));});});};exports['UpdateVoiceDialReport']=function(_0x24878d){var _0xe9e162=this;return new Promise(function(_0x53337d,_0x345daa){return db[_0xe89f('0x1a')]['update'](_0x24878d['body'],{'raw':_0x24878d[_0xe89f('0x1e')]?_0x24878d[_0xe89f('0x1e')][_0xe89f('0x1d')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x24878d[_0xe89f('0x1e')]?_0x24878d[_0xe89f('0x1e')][_0xe89f('0x1f')]||null:null,'attributes':_0x24878d[_0xe89f('0x1e')]?_0x24878d['options']['attributes']||null:null,'limit':_0x24878d[_0xe89f('0x1e')]?_0x24878d[_0xe89f('0x1e')][_0xe89f('0x20')]||null:null})[_0xe89f('0xd')](function(_0x26604a){logger['info'](_0xe89f('0x21'),_0x24878d);logger[_0xe89f('0x11')](_0xe89f('0x21'),_0x24878d,JSON[_0xe89f('0x13')](_0x26604a));_0x53337d(_0x26604a);})[_0xe89f('0x18')](function(_0x9944ef){logger[_0xe89f('0x14')]('UpdateVoiceDialReport',_0x9944ef[_0xe89f('0x16')],_0x24878d);_0x345daa(_0xe9e162[_0xe89f('0x14')](0x1f4,_0x9944ef['message']));});});}; \ No newline at end of file +var _0xba47=['../../config/utils','rpc','../../config/environment','http','request','then','VoiceDialReport,\x20%s,\x20%s','debug','VoiceDialReport,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','info','catch','CreateVoiceDialReport','VoiceDialReport','options','UpdateVoiceDialReport','update','body','raw','attributes','limit','lodash','util','moment','randomstring','ioredis','../../mysqldb'];(function(_0x4af8aa,_0x158718){var _0x52c099=function(_0x223520){while(--_0x223520){_0x4af8aa['push'](_0x4af8aa['shift']());}};_0x52c099(++_0x158718);}(_0xba47,0x1ac));var _0x7ba4=function(_0x497890,_0x4b2dc6){_0x497890=_0x497890-0x0;var _0x573134=_0xba47[_0x497890];return _0x573134;};'use strict';var _=require(_0x7ba4('0x0'));var util=require(_0x7ba4('0x1'));var moment=require(_0x7ba4('0x2'));var BPromise=require('bluebird');var rs=require(_0x7ba4('0x3'));var fs=require('fs');var Redis=require(_0x7ba4('0x4'));var db=require(_0x7ba4('0x5'))['db'];var utils=require(_0x7ba4('0x6'));var logger=require('../../config/logger')(_0x7ba4('0x7'));var config=require(_0x7ba4('0x8'));var jayson=require('jayson/promise');var client=jayson['client'][_0x7ba4('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x11ea18,_0x932508,_0x227abe){return new BPromise(function(_0x7963fa,_0x380790){return client[_0x7ba4('0xa')](_0x11ea18,_0x227abe)[_0x7ba4('0xb')](function(_0x48456d){logger['info'](_0x7ba4('0xc'),_0x932508,'request\x20sent');logger[_0x7ba4('0xd')](_0x7ba4('0xe'),_0x932508,_0x7ba4('0xf'),JSON[_0x7ba4('0x10')](_0x48456d));if(_0x48456d['error']){if(_0x48456d[_0x7ba4('0x11')][_0x7ba4('0x12')]===0x1f4){logger['error'](_0x7ba4('0xc'),_0x932508,_0x48456d[_0x7ba4('0x11')][_0x7ba4('0x13')]);return _0x380790(_0x48456d['error'][_0x7ba4('0x13')]);}logger[_0x7ba4('0x11')](_0x7ba4('0xc'),_0x932508,_0x48456d[_0x7ba4('0x11')][_0x7ba4('0x13')]);return _0x7963fa(_0x48456d[_0x7ba4('0x11')][_0x7ba4('0x13')]);}else{logger[_0x7ba4('0x14')](_0x7ba4('0xc'),_0x932508,'request\x20sent');_0x7963fa(_0x48456d['result'][_0x7ba4('0x13')]);}})[_0x7ba4('0x15')](function(_0x53c7b2){logger[_0x7ba4('0x11')](_0x7ba4('0xc'),_0x932508,_0x53c7b2);_0x380790(_0x53c7b2);});});}exports[_0x7ba4('0x16')]=function(_0xd5bdde){var _0x317c64=this;return new Promise(function(_0x988f2f,_0x3c7c46){return db[_0x7ba4('0x17')]['create'](_0xd5bdde['body'],{'raw':_0xd5bdde[_0x7ba4('0x18')]?_0xd5bdde[_0x7ba4('0x18')]['raw']===undefined?!![]:![]:!![]})[_0x7ba4('0xb')](function(_0x14a214){logger[_0x7ba4('0x14')]('CreateVoiceDialReport',_0xd5bdde);logger['debug'](_0x7ba4('0x16'),_0xd5bdde,JSON['stringify'](_0x14a214));_0x988f2f(_0x14a214);})['catch'](function(_0x225b6a){logger['error']('CreateVoiceDialReport',_0x225b6a[_0x7ba4('0x13')],_0xd5bdde);_0x3c7c46(_0x317c64[_0x7ba4('0x11')](0x1f4,_0x225b6a[_0x7ba4('0x13')]));});});};exports[_0x7ba4('0x19')]=function(_0x2afc11){var _0x1bd811=this;return new Promise(function(_0x243a62,_0x575de3){return db[_0x7ba4('0x17')][_0x7ba4('0x1a')](_0x2afc11[_0x7ba4('0x1b')],{'raw':_0x2afc11[_0x7ba4('0x18')]?_0x2afc11[_0x7ba4('0x18')][_0x7ba4('0x1c')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x2afc11['options']?_0x2afc11[_0x7ba4('0x18')]['where']||null:null,'attributes':_0x2afc11['options']?_0x2afc11['options'][_0x7ba4('0x1d')]||null:null,'limit':_0x2afc11[_0x7ba4('0x18')]?_0x2afc11[_0x7ba4('0x18')][_0x7ba4('0x1e')]||null:null})[_0x7ba4('0xb')](function(_0x494754){logger[_0x7ba4('0x14')](_0x7ba4('0x19'),_0x2afc11);logger[_0x7ba4('0xd')](_0x7ba4('0x19'),_0x2afc11,JSON[_0x7ba4('0x10')](_0x494754));_0x243a62(_0x494754);})[_0x7ba4('0x15')](function(_0x4fde73){logger['error'](_0x7ba4('0x19'),_0x4fde73[_0x7ba4('0x13')],_0x2afc11);_0x575de3(_0x1bd811[_0x7ba4('0x11')](0x1f4,_0x4fde73[_0x7ba4('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/voiceExtension/index.js b/server/api/voiceExtension/index.js index 529ed90..93da6f0 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 _0x6720=['util','connect-timeout','express','Router','../../components/interaction/service','../../config/environment','./voiceExtension.controller','isAuthenticated','index','get','/:id','show','post','create','/:id/applications','addApplications','update','destroy'];(function(_0x3ccfcc,_0x3f125d){var _0x2deed9=function(_0xa4b4ec){while(--_0xa4b4ec){_0x3ccfcc['push'](_0x3ccfcc['shift']());}};_0x2deed9(++_0x3f125d);}(_0x6720,0x18c));var _0x0672=function(_0x4a15e1,_0x11046d){_0x4a15e1=_0x4a15e1-0x0;var _0x33f1be=_0x6720[_0x4a15e1];return _0x33f1be;};'use strict';var multer=require('multer');var util=require(_0x0672('0x0'));var path=require('path');var timeout=require(_0x0672('0x1'));var express=require(_0x0672('0x2'));var router=express[_0x0672('0x3')]();var auth=require('../../components/auth/service');var interaction=require(_0x0672('0x4'));var config=require(_0x0672('0x5'));var controller=require(_0x0672('0x6'));router['get']('/',auth[_0x0672('0x7')](),controller[_0x0672('0x8')]);router[_0x0672('0x9')](_0x0672('0xa'),auth['isAuthenticated'](),controller[_0x0672('0xb')]);router[_0x0672('0xc')]('/',auth[_0x0672('0x7')](),controller[_0x0672('0xd')]);router[_0x0672('0xc')](_0x0672('0xe'),auth[_0x0672('0x7')](),controller[_0x0672('0xf')]);router['put'](_0x0672('0xa'),auth[_0x0672('0x7')](),controller[_0x0672('0x10')]);router['delete'](_0x0672('0xa'),auth[_0x0672('0x7')](),controller[_0x0672('0x11')]);module['exports']=router; \ No newline at end of file +var _0x1c76=['./voiceExtension.controller','index','/:id','show','post','/:id/applications','isAuthenticated','addApplications','put','delete','destroy','multer','path','connect-timeout','Router','../../components/auth/service'];(function(_0x58a236,_0x435e37){var _0x1f36ff=function(_0x2a9e4a){while(--_0x2a9e4a){_0x58a236['push'](_0x58a236['shift']());}};_0x1f36ff(++_0x435e37);}(_0x1c76,0x12b));var _0x61c7=function(_0x44b51c,_0x496143){_0x44b51c=_0x44b51c-0x0;var _0x183564=_0x1c76[_0x44b51c];return _0x183564;};'use strict';var multer=require(_0x61c7('0x0'));var util=require('util');var path=require(_0x61c7('0x1'));var timeout=require(_0x61c7('0x2'));var express=require('express');var router=express[_0x61c7('0x3')]();var auth=require(_0x61c7('0x4'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x61c7('0x5'));router['get']('/',auth['isAuthenticated'](),controller[_0x61c7('0x6')]);router['get'](_0x61c7('0x7'),auth['isAuthenticated'](),controller[_0x61c7('0x8')]);router[_0x61c7('0x9')]('/',auth['isAuthenticated'](),controller['create']);router['post'](_0x61c7('0xa'),auth[_0x61c7('0xb')](),controller[_0x61c7('0xc')]);router[_0x61c7('0xd')](_0x61c7('0x7'),auth[_0x61c7('0xb')](),controller['update']);router[_0x61c7('0xe')](_0x61c7('0x7'),auth[_0x61c7('0xb')](),controller[_0x61c7('0xf')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/voiceExtension/voiceExtension.attributes.js b/server/api/voiceExtension/voiceExtension.attributes.js index 3b4ee36..632dcde 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(_0x21aab1,_0x556ba6){var _0x47b8e1=function(_0x58f7b8){while(--_0x58f7b8){_0x21aab1['push'](_0x21aab1['shift']());}};_0x47b8e1(++_0x556ba6);}(_0xa9e0,0x123));var _0x0a9e=function(_0x501510,_0x61caa9){_0x501510=_0x501510-0x0;var _0x1e6ee5=_0xa9e0[_0x501510];return _0x1e6ee5;};'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(_0x43044e,_0x5725d6){var _0x1c6b54=function(_0x5d1a1b){while(--_0x5d1a1b){_0x43044e['push'](_0x43044e['shift']());}};_0x1c6b54(++_0x5725d6);}(_0xa9e0,0x123));var _0x0a9e=function(_0x134c2e,_0x3573c4){_0x134c2e=_0x134c2e-0x0;var _0x2825db=_0xa9e0[_0x134c2e];return _0x2825db;};'use strict';var Sequelize=require(_0x0a9e('0x0'));module[_0x0a9e('0x1')]={'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 5830241..2290f6a 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 _0x1544=['mandatoryDisposition','context','addApplications','bulkCreate','cast(priority\x20as\x20unsigned)','html-pdf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','to-csv','ejs','squel','crypto','jsforce','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/utils','../../config/environment','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./voiceExtension.socket','register','sendStatus','status','end','json','count','offset','set','apply','reject','update','then','InboundRoutes','inbound','OutboundRoutes','InternalRoutes','filter','map','type','find','value','name','UserProfileResource','destroy','error','send','index','VoiceExtension','fieldName','key','model','query','keys','intersection','attributes','fields','length','hasOwnProperty','nolimit','limit','sort','where','filters','pick','merge','options','include','findAll','rows','catch','show','params','rawAttributes','create','body','outbound','startsWith','exten','concat','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','internal','UserProfileSection','userProfileId','autoAssociation','cutdigits'];(function(_0x38ba5c,_0x5028b4){var _0x287039=function(_0x1700fc){while(--_0x1700fc){_0x38ba5c['push'](_0x38ba5c['shift']());}};_0x287039(++_0x5028b4);}(_0x1544,0x6a));var _0x4154=function(_0x24679e,_0x22d9d7){_0x24679e=_0x24679e-0x0;var _0x291f21=_0x1544[_0x24679e];return _0x291f21;};'use strict';var pdf=require(_0x4154('0x0'));var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x4154('0x1'));var jsonpatch=require(_0x4154('0x2'));var rp=require(_0x4154('0x3'));var moment=require(_0x4154('0x4'));var BPromise=require(_0x4154('0x5'));var Mustache=require(_0x4154('0x6'));var util=require(_0x4154('0x7'));var path=require('path');var sox=require(_0x4154('0x8'));var csv=require(_0x4154('0x9'));var ejs=require(_0x4154('0xa'));var fs=require('fs');var _=require('lodash');var squel=require(_0x4154('0xb'));var crypto=require(_0x4154('0xc'));var jsforce=require(_0x4154('0xd'));var deskjs=require('desk.js');var toCsv=require(_0x4154('0x9'));var querystring=require(_0x4154('0xe'));var Papa=require('papaparse');var Redis=require(_0x4154('0xf'));var authService=require(_0x4154('0x10'));var qs=require(_0x4154('0x11'));var as=require(_0x4154('0x12'));var hardwareService=require(_0x4154('0x13'));var logger=require('../../config/logger')('api');var utils=require(_0x4154('0x14'));var config=require(_0x4154('0x15'));var db=require(_0x4154('0x16'))['db'];config[_0x4154('0x17')]=_[_0x4154('0x18')](config['redis'],{'host':_0x4154('0x19'),'port':0x18eb});var socket=require(_0x4154('0x1a'))(new Redis(config[_0x4154('0x17')]));require(_0x4154('0x1b'))[_0x4154('0x1c')](socket);function respondWithStatusCode(_0x5dc2cd,_0x36c9f7){_0x36c9f7=_0x36c9f7||0xcc;return function(_0x10ea5d){if(_0x10ea5d){return _0x5dc2cd[_0x4154('0x1d')](_0x36c9f7);}return _0x5dc2cd[_0x4154('0x1e')](_0x36c9f7)[_0x4154('0x1f')]();};}function respondWithResult(_0x243f78,_0x287662){_0x287662=_0x287662||0xc8;return function(_0x395367){if(_0x395367){return _0x243f78[_0x4154('0x1e')](_0x287662)[_0x4154('0x20')](_0x395367);}};}function respondWithFilteredResult(_0x6e76d3,_0x10da05){return function(_0x1ced12){if(_0x1ced12){var _0x5a7042=_0x1ced12[_0x4154('0x21')],_0x16b378=_0x10da05['offset'],_0x3b05f7=_0x10da05[_0x4154('0x22')]+_0x10da05['limit'],_0x4db2c0;if(_0x3b05f7>=_0x5a7042){_0x3b05f7=_0x5a7042;_0x4db2c0=0xc8;}else{_0x4db2c0=0xce;}_0x6e76d3['status'](_0x4db2c0);return _0x6e76d3[_0x4154('0x23')]('Content-Range',_0x16b378+'-'+_0x3b05f7+'/'+_0x5a7042)['json'](_0x1ced12);}return null;};}function patchUpdates(_0x326fc6){return function(_0x26eabd){try{jsonpatch[_0x4154('0x24')](_0x26eabd,_0x326fc6,!![]);}catch(_0xb1a23f){return BPromise[_0x4154('0x25')](_0xb1a23f);}return _0x26eabd['save']();};}function saveUpdates(_0x5a9e66,_0x1ba1cb){return function(_0x349840){if(_0x349840){return _0x349840[_0x4154('0x26')](_0x5a9e66)[_0x4154('0x27')](function(_0x6c50b3){return _0x6c50b3;});}return null;};}function removeEntity(_0x1fa72b,_0x567676){return function(_0x48ca9f){if(_0x48ca9f){return _0x48ca9f['destroy']()[_0x4154('0x27')](function(){var _0x1eb7ae=_0x48ca9f['get']({'plain':!![]});var _0x3604bf=[{'name':_0x4154('0x28'),'value':_0x4154('0x29'),'ignore':![]},{'name':_0x4154('0x2a'),'value':'outbound','ignore':![]},{'name':_0x4154('0x2b'),'value':'internal','ignore':![]}];var _0x530064=_(_0x3604bf)[_0x4154('0x2c')]('ignore')[_0x4154('0x2d')]('value')['value']();if(_['includes'](_0x530064,_0x1eb7ae[_0x4154('0x2e')])){return;}var _0x48b023=_[_0x4154('0x2f')](_0x3604bf,[_0x4154('0x30'),_0x1eb7ae[_0x4154('0x2e')]])[_0x4154('0x31')];return db[_0x4154('0x32')][_0x4154('0x33')]({'where':{'type':_0x48b023,'resourceId':_0x1eb7ae['id']}})['then'](function(){return _0x48ca9f;});})[_0x4154('0x27')](function(){_0x1fa72b[_0x4154('0x1e')](0xcc)[_0x4154('0x1f')]();});}};}function handleEntityNotFound(_0x48bc72,_0xb8b663){return function(_0x32e61c){if(!_0x32e61c){_0x48bc72[_0x4154('0x1d')](0x194);}return _0x32e61c;};}function handleError(_0xdda0a6,_0x3b1ce2){_0x3b1ce2=_0x3b1ce2||0x1f4;return function(_0x5e6e26){logger[_0x4154('0x34')](_0x5e6e26['stack']);if(_0x5e6e26[_0x4154('0x31')]){delete _0x5e6e26[_0x4154('0x31')];}_0xdda0a6[_0x4154('0x1e')](_0x3b1ce2)[_0x4154('0x35')](_0x5e6e26);};}exports[_0x4154('0x36')]=function(_0xd4095f,_0x4d59f1){var _0x432f99={},_0x5f46c4={},_0xec9f64={'count':0x0,'rows':[]};var _0x34d286=_[_0x4154('0x2d')](db[_0x4154('0x37')]['rawAttributes'],function(_0x9580ce){return{'name':_0x9580ce[_0x4154('0x38')],'type':_0x9580ce[_0x4154('0x2e')][_0x4154('0x39')]};});_0x5f46c4[_0x4154('0x3a')]=_[_0x4154('0x2d')](_0x34d286,_0x4154('0x31'));_0x5f46c4[_0x4154('0x3b')]=_[_0x4154('0x3c')](_0xd4095f[_0x4154('0x3b')]);_0x5f46c4['filters']=_[_0x4154('0x3d')](_0x5f46c4[_0x4154('0x3a')],_0x5f46c4[_0x4154('0x3b')]);_0x432f99[_0x4154('0x3e')]=_[_0x4154('0x3d')](_0x5f46c4['model'],qs[_0x4154('0x3f')](_0xd4095f[_0x4154('0x3b')][_0x4154('0x3f')]));_0x432f99['attributes']=_0x432f99[_0x4154('0x3e')][_0x4154('0x40')]?_0x432f99[_0x4154('0x3e')]:_0x5f46c4[_0x4154('0x3a')];if(!_0xd4095f[_0x4154('0x3b')][_0x4154('0x41')](_0x4154('0x42'))){_0x432f99[_0x4154('0x43')]=qs['limit'](_0xd4095f['query']['limit']);_0x432f99['offset']=qs[_0x4154('0x22')](_0xd4095f[_0x4154('0x3b')]['offset']);}_0x432f99['order']=qs['sort'](_0xd4095f['query'][_0x4154('0x44')]);_0x432f99[_0x4154('0x45')]=qs[_0x4154('0x46')](_[_0x4154('0x47')](_0xd4095f['query'],_0x5f46c4[_0x4154('0x46')]));if(_0xd4095f['query']['filter']){_0x432f99[_0x4154('0x45')]=_['merge'](_0x432f99[_0x4154('0x45')],{'$or':_[_0x4154('0x2d')](_0x34d286,function(_0x3b8420){if(_0x3b8420[_0x4154('0x2e')]!=='VIRTUAL'){var _0x25502f={};_0x25502f[_0x3b8420[_0x4154('0x31')]]={'$like':'%'+_0xd4095f[_0x4154('0x3b')][_0x4154('0x2c')]+'%'};return _0x25502f;}})});}_0x432f99=_[_0x4154('0x48')]({},_0x432f99,_0xd4095f[_0x4154('0x49')]);var _0x438f3d={'where':_0x432f99[_0x4154('0x45')]};return db['VoiceExtension'][_0x4154('0x21')](_0x438f3d)[_0x4154('0x27')](function(_0xb40824){_0xec9f64[_0x4154('0x21')]=_0xb40824;if(_0xd4095f['query']['includeAll']){_0x432f99[_0x4154('0x4a')]=[{'all':!![]}];}return db[_0x4154('0x37')][_0x4154('0x4b')](_0x432f99);})[_0x4154('0x27')](function(_0x3b61da){_0xec9f64[_0x4154('0x4c')]=_0x3b61da;return _0xec9f64;})[_0x4154('0x27')](respondWithFilteredResult(_0x4d59f1,_0x432f99))[_0x4154('0x4d')](handleError(_0x4d59f1,null));};exports[_0x4154('0x4e')]=function(_0x560b0f,_0x4146f1){var _0x2edede={'raw':![],'where':{'id':_0x560b0f[_0x4154('0x4f')]['id']}},_0x2622fb={};_0x2622fb[_0x4154('0x3a')]=_[_0x4154('0x3c')](db[_0x4154('0x37')][_0x4154('0x50')]);_0x2622fb['query']=_['keys'](_0x560b0f['query']);_0x2622fb[_0x4154('0x46')]=_['intersection'](_0x2622fb[_0x4154('0x3a')],_0x2622fb[_0x4154('0x3b')]);_0x2edede[_0x4154('0x3e')]=_['intersection'](_0x2622fb['model'],qs[_0x4154('0x3f')](_0x560b0f[_0x4154('0x3b')][_0x4154('0x3f')]));_0x2edede[_0x4154('0x3e')]=_0x2edede[_0x4154('0x3e')][_0x4154('0x40')]?_0x2edede[_0x4154('0x3e')]:_0x2622fb[_0x4154('0x3a')];if(_0x560b0f[_0x4154('0x3b')]['includeAll']){_0x2edede['include']=[{'all':!![]}];}_0x2edede=_[_0x4154('0x48')]({},_0x2edede,_0x560b0f['options']);return db['VoiceExtension'][_0x4154('0x2f')](_0x2edede)[_0x4154('0x27')](handleEntityNotFound(_0x4146f1,null))['then'](respondWithResult(_0x4146f1,null))[_0x4154('0x4d')](handleError(_0x4146f1,null));};exports[_0x4154('0x33')]=function(_0xfce078,_0x441a3b){return db[_0x4154('0x37')][_0x4154('0x2f')]({'where':{'id':_0xfce078['params']['id']}})[_0x4154('0x27')](handleEntityNotFound(_0x441a3b,null))[_0x4154('0x27')](removeEntity(_0x441a3b,null))[_0x4154('0x4d')](handleError(_0x441a3b,null));};exports[_0x4154('0x51')]=function(_0x2140a7,_0xed4309){if(_0x2140a7[_0x4154('0x52')][_0x4154('0x2e')]===_0x4154('0x53')&&!_[_0x4154('0x54')](_0x2140a7[_0x4154('0x52')][_0x4154('0x55')],'_')){_0x2140a7[_0x4154('0x52')][_0x4154('0x55')]='_'[_0x4154('0x56')](_0x2140a7[_0x4154('0x52')][_0x4154('0x55')]);}return db[_0x4154('0x37')]['create'](_0x2140a7[_0x4154('0x52')],{'raw':![]})[_0x4154('0x27')](function(_0x304140){var _0xd4a394=_0x2140a7[_0x4154('0x57')][_0x4154('0x58')]({'plain':!![]});if(!_0xd4a394)throw new Error(_0x4154('0x59'));if(_0xd4a394[_0x4154('0x5a')]===_0x4154('0x57')){var _0x983a7e=_0x304140[_0x4154('0x58')]({'plain':!![]});var _0x4bd521=[{'name':_0x4154('0x28'),'value':_0x4154('0x29')},{'name':'OutboundRoutes','value':_0x4154('0x53')},{'name':_0x4154('0x2b'),'value':_0x4154('0x5b')}];var _0x4be3a5=_[_0x4154('0x2f')](_0x4bd521,['value',_0x983a7e[_0x4154('0x2e')]])[_0x4154('0x31')];return db[_0x4154('0x5c')]['find']({'where':{'name':_0x4be3a5,'userProfileId':_0xd4a394[_0x4154('0x5d')]},'raw':!![]})[_0x4154('0x27')](function(_0x4eb50e){if(_0x4eb50e&&_0x4eb50e[_0x4154('0x5e')]===0x0){return db[_0x4154('0x32')]['create']({'name':_0x983a7e[_0x4154('0x31')],'resourceId':_0x983a7e['id'],'type':_0x4eb50e[_0x4154('0x31')],'sectionId':_0x4eb50e['id']},{})[_0x4154('0x27')](function(){return _0x304140;});}else{return _0x304140;}})['catch'](function(_0x3d987b){logger[_0x4154('0x34')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x3d987b);throw _0x3d987b;});}return _0x304140;})[_0x4154('0x27')](respondWithResult(_0xed4309,0xc9))[_0x4154('0x4d')](handleError(_0xed4309,null));};exports[_0x4154('0x26')]=function(_0x3610a8,_0x2ef205){if(_0x3610a8['body']['id']){delete _0x3610a8['body']['id'];}return db['VoiceExtension'][_0x4154('0x2f')]({'where':{'id':_0x3610a8[_0x4154('0x4f')]['id']}})['then'](handleEntityNotFound(_0x2ef205,null))[_0x4154('0x27')](function(_0x4f73f8){if(_0x4f73f8){return db['VoiceExtension'][_0x4154('0x26')](_[_0x4154('0x47')](_0x3610a8['body'],[_0x4154('0x55'),'context','description','recordingFormat',_0x4154('0x5f'),_0x4154('0x60')]),{'where':{'context':_0x4f73f8[_0x4154('0x61')],'exten':_0x4f73f8[_0x4154('0x55')]},'individualHooks':!![]})[_0x4154('0x27')](function(_0x433d33){return _0x433d33;});}return null;})['then'](respondWithStatusCode(_0x2ef205,null))['catch'](handleError(_0x2ef205,null));};exports[_0x4154('0x62')]=function(_0x458e17,_0x1f6028,_0x4ff15b){return db[_0x4154('0x37')]['findOne']({'where':{'id':_0x458e17[_0x4154('0x4f')]['id']}})['then'](handleEntityNotFound(_0x1f6028,null))[_0x4154('0x27')](function(_0x578e56){if(_0x578e56){return db['sequelize']['transaction'](function(_0x787a52){return db['VoiceExtension'][_0x4154('0x33')]({'where':{'VoiceExtensionId':_0x458e17[_0x4154('0x4f')]['id']},'transaction':_0x787a52})[_0x4154('0x27')](function(_0x1a6cd3){var _0x5c2069=_[_0x4154('0x2d')](_0x458e17['body'],function(_0x4b2a93){_0x4b2a93['VoiceExtensionId']=_0x458e17[_0x4154('0x4f')]['id'];return _0x4b2a93;});return db['VoiceExtension'][_0x4154('0x63')](_0x5c2069,{'transaction':_0x787a52});});})['then'](function(){return db[_0x4154('0x37')]['findAndCountAll']({'where':{'isApp':!![],'VoiceExtensionId':_0x458e17[_0x4154('0x4f')]['id']},'order':_0x4154('0x64')});});}})[_0x4154('0x27')](respondWithResult(_0x1f6028,null))[_0x4154('0x4d')](handleError(_0x1f6028,null));}; \ No newline at end of file +var _0x29a3=['sendStatus','status','end','json','count','offset','limit','set','Content-Range','reject','update','then','get','InboundRoutes','inbound','OutboundRoutes','outbound','InternalRoutes','filter','ignore','map','value','type','find','name','destroy','error','stack','send','index','VoiceExtension','rawAttributes','fieldName','key','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','merge','VIRTUAL','options','includeAll','include','rows','catch','show','keys','create','body','startsWith','exten','concat','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','internal','UserProfileSection','userProfileId','autoAssociation','UserProfileResource','params','pick','description','recordingFormat','cutdigits','mandatoryDisposition','findOne','sequelize','transaction','VoiceExtensionId','findAndCountAll','html-pdf','zip-dir','fast-json-patch','bluebird','mustache','path','sox','to-csv','ejs','lodash','squel','crypto','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','redis','defaults','localhost','socket.io-emitter','./voiceExtension.socket','register'];(function(_0x3c1e42,_0x3588d3){var _0x58004d=function(_0x4799e5){while(--_0x4799e5){_0x3c1e42['push'](_0x3c1e42['shift']());}};_0x58004d(++_0x3588d3);}(_0x29a3,0x1ee));var _0x329a=function(_0x316dcc,_0x35c7ed){_0x316dcc=_0x316dcc-0x0;var _0x5c1022=_0x29a3[_0x316dcc];return _0x5c1022;};'use strict';var pdf=require(_0x329a('0x0'));var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x329a('0x1'));var jsonpatch=require(_0x329a('0x2'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x329a('0x3'));var Mustache=require(_0x329a('0x4'));var util=require('util');var path=require(_0x329a('0x5'));var sox=require(_0x329a('0x6'));var csv=require(_0x329a('0x7'));var ejs=require(_0x329a('0x8'));var fs=require('fs');var _=require(_0x329a('0x9'));var squel=require(_0x329a('0xa'));var crypto=require(_0x329a('0xb'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x329a('0x7'));var querystring=require(_0x329a('0xc'));var Papa=require(_0x329a('0xd'));var Redis=require(_0x329a('0xe'));var authService=require('../../components/auth/service');var qs=require(_0x329a('0xf'));var as=require(_0x329a('0x10'));var hardwareService=require(_0x329a('0x11'));var logger=require(_0x329a('0x12'))('api');var utils=require(_0x329a('0x13'));var config=require('../../config/environment');var db=require('../../mysqldb')['db'];config[_0x329a('0x14')]=_[_0x329a('0x15')](config[_0x329a('0x14')],{'host':_0x329a('0x16'),'port':0x18eb});var socket=require(_0x329a('0x17'))(new Redis(config[_0x329a('0x14')]));require(_0x329a('0x18'))[_0x329a('0x19')](socket);function respondWithStatusCode(_0x58eb65,_0x4a339b){_0x4a339b=_0x4a339b||0xcc;return function(_0x3cfba9){if(_0x3cfba9){return _0x58eb65[_0x329a('0x1a')](_0x4a339b);}return _0x58eb65[_0x329a('0x1b')](_0x4a339b)[_0x329a('0x1c')]();};}function respondWithResult(_0x5591b1,_0x41b7e8){_0x41b7e8=_0x41b7e8||0xc8;return function(_0x4e3cb8){if(_0x4e3cb8){return _0x5591b1[_0x329a('0x1b')](_0x41b7e8)[_0x329a('0x1d')](_0x4e3cb8);}};}function respondWithFilteredResult(_0x596795,_0x24b9cb){return function(_0x2e5944){if(_0x2e5944){var _0x22069e=_0x2e5944[_0x329a('0x1e')],_0x14a45f=_0x24b9cb[_0x329a('0x1f')],_0x19b3ea=_0x24b9cb[_0x329a('0x1f')]+_0x24b9cb[_0x329a('0x20')],_0x50de5e;if(_0x19b3ea>=_0x22069e){_0x19b3ea=_0x22069e;_0x50de5e=0xc8;}else{_0x50de5e=0xce;}_0x596795[_0x329a('0x1b')](_0x50de5e);return _0x596795[_0x329a('0x21')](_0x329a('0x22'),_0x14a45f+'-'+_0x19b3ea+'/'+_0x22069e)[_0x329a('0x1d')](_0x2e5944);}return null;};}function patchUpdates(_0x1d76d4){return function(_0x3c49ac){try{jsonpatch['apply'](_0x3c49ac,_0x1d76d4,!![]);}catch(_0x2ef5d0){return BPromise[_0x329a('0x23')](_0x2ef5d0);}return _0x3c49ac['save']();};}function saveUpdates(_0x1866e7,_0x393782){return function(_0x449c23){if(_0x449c23){return _0x449c23[_0x329a('0x24')](_0x1866e7)['then'](function(_0x4dfccc){return _0x4dfccc;});}return null;};}function removeEntity(_0x255b80,_0x3b47cf){return function(_0xc1d37b){if(_0xc1d37b){return _0xc1d37b['destroy']()[_0x329a('0x25')](function(){var _0x28a0b3=_0xc1d37b[_0x329a('0x26')]({'plain':!![]});var _0x11aa02=[{'name':_0x329a('0x27'),'value':_0x329a('0x28'),'ignore':![]},{'name':_0x329a('0x29'),'value':_0x329a('0x2a'),'ignore':![]},{'name':_0x329a('0x2b'),'value':'internal','ignore':![]}];var _0xd9f61f=_(_0x11aa02)[_0x329a('0x2c')](_0x329a('0x2d'))[_0x329a('0x2e')](_0x329a('0x2f'))[_0x329a('0x2f')]();if(_['includes'](_0xd9f61f,_0x28a0b3[_0x329a('0x30')])){return;}var _0x122485=_[_0x329a('0x31')](_0x11aa02,[_0x329a('0x2f'),_0x28a0b3['type']])[_0x329a('0x32')];return db['UserProfileResource'][_0x329a('0x33')]({'where':{'type':_0x122485,'resourceId':_0x28a0b3['id']}})[_0x329a('0x25')](function(){return _0xc1d37b;});})[_0x329a('0x25')](function(){_0x255b80[_0x329a('0x1b')](0xcc)[_0x329a('0x1c')]();});}};}function handleEntityNotFound(_0x5a58d6,_0x35221a){return function(_0xfdffdc){if(!_0xfdffdc){_0x5a58d6[_0x329a('0x1a')](0x194);}return _0xfdffdc;};}function handleError(_0x5ca9ab,_0x2f57c4){_0x2f57c4=_0x2f57c4||0x1f4;return function(_0x53e09e){logger[_0x329a('0x34')](_0x53e09e[_0x329a('0x35')]);if(_0x53e09e[_0x329a('0x32')]){delete _0x53e09e['name'];}_0x5ca9ab[_0x329a('0x1b')](_0x2f57c4)[_0x329a('0x36')](_0x53e09e);};}exports[_0x329a('0x37')]=function(_0x3937ff,_0x22133b){var _0x120bf4={},_0x17ec60={},_0x3a41c8={'count':0x0,'rows':[]};var _0x2a56f2=_[_0x329a('0x2e')](db[_0x329a('0x38')][_0x329a('0x39')],function(_0x396c65){return{'name':_0x396c65[_0x329a('0x3a')],'type':_0x396c65['type'][_0x329a('0x3b')]};});_0x17ec60[_0x329a('0x3c')]=_['map'](_0x2a56f2,_0x329a('0x32'));_0x17ec60[_0x329a('0x3d')]=_['keys'](_0x3937ff[_0x329a('0x3d')]);_0x17ec60[_0x329a('0x3e')]=_[_0x329a('0x3f')](_0x17ec60[_0x329a('0x3c')],_0x17ec60[_0x329a('0x3d')]);_0x120bf4[_0x329a('0x40')]=_['intersection'](_0x17ec60[_0x329a('0x3c')],qs[_0x329a('0x41')](_0x3937ff[_0x329a('0x3d')]['fields']));_0x120bf4[_0x329a('0x40')]=_0x120bf4[_0x329a('0x40')][_0x329a('0x42')]?_0x120bf4[_0x329a('0x40')]:_0x17ec60[_0x329a('0x3c')];if(!_0x3937ff[_0x329a('0x3d')][_0x329a('0x43')](_0x329a('0x44'))){_0x120bf4[_0x329a('0x20')]=qs['limit'](_0x3937ff[_0x329a('0x3d')][_0x329a('0x20')]);_0x120bf4[_0x329a('0x1f')]=qs[_0x329a('0x1f')](_0x3937ff['query']['offset']);}_0x120bf4[_0x329a('0x45')]=qs[_0x329a('0x46')](_0x3937ff[_0x329a('0x3d')]['sort']);_0x120bf4['where']=qs[_0x329a('0x3e')](_['pick'](_0x3937ff[_0x329a('0x3d')],_0x17ec60['filters']));if(_0x3937ff[_0x329a('0x3d')][_0x329a('0x2c')]){_0x120bf4['where']=_[_0x329a('0x47')](_0x120bf4['where'],{'$or':_[_0x329a('0x2e')](_0x2a56f2,function(_0x59b957){if(_0x59b957[_0x329a('0x30')]!==_0x329a('0x48')){var _0x34507b={};_0x34507b[_0x59b957[_0x329a('0x32')]]={'$like':'%'+_0x3937ff[_0x329a('0x3d')]['filter']+'%'};return _0x34507b;}})});}_0x120bf4=_[_0x329a('0x47')]({},_0x120bf4,_0x3937ff[_0x329a('0x49')]);var _0x1789e9={'where':_0x120bf4['where']};return db[_0x329a('0x38')][_0x329a('0x1e')](_0x1789e9)['then'](function(_0x3f26b1){_0x3a41c8[_0x329a('0x1e')]=_0x3f26b1;if(_0x3937ff[_0x329a('0x3d')][_0x329a('0x4a')]){_0x120bf4[_0x329a('0x4b')]=[{'all':!![]}];}return db[_0x329a('0x38')]['findAll'](_0x120bf4);})[_0x329a('0x25')](function(_0x3ee818){_0x3a41c8[_0x329a('0x4c')]=_0x3ee818;return _0x3a41c8;})[_0x329a('0x25')](respondWithFilteredResult(_0x22133b,_0x120bf4))[_0x329a('0x4d')](handleError(_0x22133b,null));};exports[_0x329a('0x4e')]=function(_0x138de3,_0x1edf37){var _0x972f05={'raw':![],'where':{'id':_0x138de3['params']['id']}},_0x135a7c={};_0x135a7c[_0x329a('0x3c')]=_['keys'](db['VoiceExtension'][_0x329a('0x39')]);_0x135a7c[_0x329a('0x3d')]=_[_0x329a('0x4f')](_0x138de3[_0x329a('0x3d')]);_0x135a7c['filters']=_['intersection'](_0x135a7c[_0x329a('0x3c')],_0x135a7c['query']);_0x972f05[_0x329a('0x40')]=_[_0x329a('0x3f')](_0x135a7c[_0x329a('0x3c')],qs[_0x329a('0x41')](_0x138de3[_0x329a('0x3d')]['fields']));_0x972f05[_0x329a('0x40')]=_0x972f05[_0x329a('0x40')][_0x329a('0x42')]?_0x972f05[_0x329a('0x40')]:_0x135a7c['model'];if(_0x138de3[_0x329a('0x3d')][_0x329a('0x4a')]){_0x972f05['include']=[{'all':!![]}];}_0x972f05=_[_0x329a('0x47')]({},_0x972f05,_0x138de3['options']);return db[_0x329a('0x38')][_0x329a('0x31')](_0x972f05)[_0x329a('0x25')](handleEntityNotFound(_0x1edf37,null))[_0x329a('0x25')](respondWithResult(_0x1edf37,null))[_0x329a('0x4d')](handleError(_0x1edf37,null));};exports[_0x329a('0x33')]=function(_0x5eb5fe,_0x275eff){return db[_0x329a('0x38')][_0x329a('0x31')]({'where':{'id':_0x5eb5fe['params']['id']}})[_0x329a('0x25')](handleEntityNotFound(_0x275eff,null))[_0x329a('0x25')](removeEntity(_0x275eff,null))[_0x329a('0x4d')](handleError(_0x275eff,null));};exports[_0x329a('0x50')]=function(_0x3c1762,_0x33bc64){if(_0x3c1762[_0x329a('0x51')]['type']==='outbound'&&!_[_0x329a('0x52')](_0x3c1762[_0x329a('0x51')][_0x329a('0x53')],'_')){_0x3c1762['body'][_0x329a('0x53')]='_'[_0x329a('0x54')](_0x3c1762[_0x329a('0x51')][_0x329a('0x53')]);}return db[_0x329a('0x38')][_0x329a('0x50')](_0x3c1762[_0x329a('0x51')],{'raw':![]})[_0x329a('0x25')](function(_0x5a920f){var _0x18efb0=_0x3c1762[_0x329a('0x55')][_0x329a('0x26')]({'plain':!![]});if(!_0x18efb0)throw new Error(_0x329a('0x56'));if(_0x18efb0[_0x329a('0x57')]===_0x329a('0x55')){var _0x4d35cc=_0x5a920f[_0x329a('0x26')]({'plain':!![]});var _0x2cd53d=[{'name':_0x329a('0x27'),'value':_0x329a('0x28')},{'name':_0x329a('0x29'),'value':_0x329a('0x2a')},{'name':'InternalRoutes','value':_0x329a('0x58')}];var _0x5432e3=_[_0x329a('0x31')](_0x2cd53d,[_0x329a('0x2f'),_0x4d35cc[_0x329a('0x30')]])[_0x329a('0x32')];return db[_0x329a('0x59')][_0x329a('0x31')]({'where':{'name':_0x5432e3,'userProfileId':_0x18efb0[_0x329a('0x5a')]},'raw':!![]})['then'](function(_0x5da8b7){if(_0x5da8b7&&_0x5da8b7[_0x329a('0x5b')]===0x0){return db[_0x329a('0x5c')]['create']({'name':_0x4d35cc[_0x329a('0x32')],'resourceId':_0x4d35cc['id'],'type':_0x5da8b7[_0x329a('0x32')],'sectionId':_0x5da8b7['id']},{})[_0x329a('0x25')](function(){return _0x5a920f;});}else{return _0x5a920f;}})[_0x329a('0x4d')](function(_0x21360f){logger[_0x329a('0x34')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x21360f);throw _0x21360f;});}return _0x5a920f;})[_0x329a('0x25')](respondWithResult(_0x33bc64,0xc9))[_0x329a('0x4d')](handleError(_0x33bc64,null));};exports[_0x329a('0x24')]=function(_0x29da61,_0x499384){if(_0x29da61[_0x329a('0x51')]['id']){delete _0x29da61['body']['id'];}return db['VoiceExtension'][_0x329a('0x31')]({'where':{'id':_0x29da61[_0x329a('0x5d')]['id']}})[_0x329a('0x25')](handleEntityNotFound(_0x499384,null))[_0x329a('0x25')](function(_0x280400){if(_0x280400){return db[_0x329a('0x38')][_0x329a('0x24')](_[_0x329a('0x5e')](_0x29da61[_0x329a('0x51')],[_0x329a('0x53'),'context',_0x329a('0x5f'),_0x329a('0x60'),_0x329a('0x61'),_0x329a('0x62')]),{'where':{'context':_0x280400['context'],'exten':_0x280400[_0x329a('0x53')]},'individualHooks':!![]})[_0x329a('0x25')](function(_0x59b675){return _0x59b675;});}return null;})[_0x329a('0x25')](respondWithStatusCode(_0x499384,null))[_0x329a('0x4d')](handleError(_0x499384,null));};exports['addApplications']=function(_0xd6a4fa,_0x522a60,_0x4ba9f8){return db[_0x329a('0x38')][_0x329a('0x63')]({'where':{'id':_0xd6a4fa[_0x329a('0x5d')]['id']}})[_0x329a('0x25')](handleEntityNotFound(_0x522a60,null))[_0x329a('0x25')](function(_0x6cf243){if(_0x6cf243){return db[_0x329a('0x64')][_0x329a('0x65')](function(_0x3f17a2){return db[_0x329a('0x38')][_0x329a('0x33')]({'where':{'VoiceExtensionId':_0xd6a4fa[_0x329a('0x5d')]['id']},'transaction':_0x3f17a2})[_0x329a('0x25')](function(_0x40ddf3){var _0x5e397a=_[_0x329a('0x2e')](_0xd6a4fa[_0x329a('0x51')],function(_0x52aa38){_0x52aa38[_0x329a('0x66')]=_0xd6a4fa[_0x329a('0x5d')]['id'];return _0x52aa38;});return db['VoiceExtension']['bulkCreate'](_0x5e397a,{'transaction':_0x3f17a2});});})[_0x329a('0x25')](function(){return db[_0x329a('0x38')][_0x329a('0x67')]({'where':{'isApp':!![],'VoiceExtensionId':_0xd6a4fa[_0x329a('0x5d')]['id']},'order':'cast(priority\x20as\x20unsigned)'});});}})[_0x329a('0x25')](respondWithResult(_0x522a60,null))[_0x329a('0x4d')](handleError(_0x522a60,null));}; \ No newline at end of file diff --git a/server/api/voiceExtension/voiceExtension.events.js b/server/api/voiceExtension/voiceExtension.events.js index 7f840d4..7853120 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 _0x668b=['../../mysqldb','VoiceExtension','setMaxListeners','save','update','remove','emit','hasOwnProperty','exports','events'];(function(_0x22d02b,_0x560c50){var _0x5d7022=function(_0x395d14){while(--_0x395d14){_0x22d02b['push'](_0x22d02b['shift']());}};_0x5d7022(++_0x560c50);}(_0x668b,0x95));var _0xb668=function(_0x503ffd,_0x8ecde){_0x503ffd=_0x503ffd-0x0;var _0x160437=_0x668b[_0x503ffd];return _0x160437;};'use strict';var EventEmitter=require(_0xb668('0x0'));var VoiceExtension=require(_0xb668('0x1'))['db'][_0xb668('0x2')];var VoiceExtensionEvents=new EventEmitter();VoiceExtensionEvents[_0xb668('0x3')](0x0);var events={'afterCreate':_0xb668('0x4'),'afterUpdate':_0xb668('0x5'),'afterDestroy':_0xb668('0x6')};function emitEvent(_0x3b09d3){return function(_0x361872,_0x422172,_0x5ba061){VoiceExtensionEvents[_0xb668('0x7')](_0x3b09d3+':'+_0x361872['id'],_0x361872);VoiceExtensionEvents[_0xb668('0x7')](_0x3b09d3,_0x361872);_0x5ba061(null);};}for(var e in events){if(events[_0xb668('0x8')](e)){var event=events[e];VoiceExtension['hook'](e,emitEvent(event));}}module[_0xb668('0x9')]=VoiceExtensionEvents; \ No newline at end of file +var _0xd30f=['emit','hasOwnProperty','hook','exports','VoiceExtension','setMaxListeners','update','remove'];(function(_0x538da4,_0x875d2b){var _0x28ad91=function(_0x5e1d82){while(--_0x5e1d82){_0x538da4['push'](_0x538da4['shift']());}};_0x28ad91(++_0x875d2b);}(_0xd30f,0x1bc));var _0xfd30=function(_0x286c3d,_0x21db4d){_0x286c3d=_0x286c3d-0x0;var _0x1faed4=_0xd30f[_0x286c3d];return _0x1faed4;};'use strict';var EventEmitter=require('events');var VoiceExtension=require('../../mysqldb')['db'][_0xfd30('0x0')];var VoiceExtensionEvents=new EventEmitter();VoiceExtensionEvents[_0xfd30('0x1')](0x0);var events={'afterCreate':'save','afterUpdate':_0xfd30('0x2'),'afterDestroy':_0xfd30('0x3')};function emitEvent(_0x249f2e){return function(_0x29c02b,_0x3f13a2,_0x143a7c){VoiceExtensionEvents[_0xfd30('0x4')](_0x249f2e+':'+_0x29c02b['id'],_0x29c02b);VoiceExtensionEvents[_0xfd30('0x4')](_0x249f2e,_0x29c02b);_0x143a7c(null);};}for(var e in events){if(events[_0xfd30('0x5')](e)){var event=events[e];VoiceExtension[_0xfd30('0x6')](e,emitEvent(event));}}module[_0xfd30('0x7')]=VoiceExtensionEvents; \ No newline at end of file diff --git a/server/api/voiceExtension/voiceExtension.model.js b/server/api/voiceExtension/voiceExtension.model.js index 89be17e..a66ce9d 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 _0xd87b=['path','../../config/environment','./voiceExtension.attributes','exports','VoiceExtension','voice_extensions','util','api','moment','bluebird','request-promise'];(function(_0x35b7ba,_0x155c7f){var _0x25ea5e=function(_0x4d16f6){while(--_0x4d16f6){_0x35b7ba['push'](_0x35b7ba['shift']());}};_0x25ea5e(++_0x155c7f);}(_0xd87b,0xe2));var _0xbd87=function(_0x585199,_0x15a674){_0x585199=_0x585199-0x0;var _0x4ec21f=_0xd87b[_0x585199];return _0x4ec21f;};'use strict';var _=require('lodash');var util=require(_0xbd87('0x0'));var logger=require('../../config/logger')(_0xbd87('0x1'));var moment=require(_0xbd87('0x2'));var BPromise=require(_0xbd87('0x3'));var rp=require(_0xbd87('0x4'));var fs=require('fs');var path=require(_0xbd87('0x5'));var rimraf=require('rimraf');var config=require(_0xbd87('0x6'));var attributes=require(_0xbd87('0x7'));module[_0xbd87('0x8')]=function(_0x330eee,_0x4eabee){return _0x330eee['define'](_0xbd87('0x9'),attributes,{'tableName':_0xbd87('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xa499=['moment','bluebird','request-promise','rimraf','../../config/environment','./voiceExtension.attributes','exports','define','lodash','util'];(function(_0x4b7b62,_0x4920a9){var _0x2280df=function(_0x21e1f8){while(--_0x21e1f8){_0x4b7b62['push'](_0x4b7b62['shift']());}};_0x2280df(++_0x4920a9);}(_0xa499,0xb2));var _0x9a49=function(_0x1b2ff7,_0x12a034){_0x1b2ff7=_0x1b2ff7-0x0;var _0x31656a=_0xa499[_0x1b2ff7];return _0x31656a;};'use strict';var _=require(_0x9a49('0x0'));var util=require(_0x9a49('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0x9a49('0x2'));var BPromise=require(_0x9a49('0x3'));var rp=require(_0x9a49('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x9a49('0x5'));var config=require(_0x9a49('0x6'));var attributes=require(_0x9a49('0x7'));module[_0x9a49('0x8')]=function(_0x4f58e6,_0x3cbc72){return _0x4f58e6[_0x9a49('0x9')]('VoiceExtension',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 da20d9e..4d4738a 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 _0x0846=['attributes','limit','include','map','model','then','util','moment','bluebird','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','./voiceExtension.socket','register','request','request\x20sent','debug','VoiceExtension,\x20%s,\x20%s,\x20%s','stringify','error','code','VoiceExtension,\x20%s,\x20%s','message','info','catch','GetVoiceExtension','VoiceExtension','options','raw','where'];(function(_0x119b96,_0x587acd){var _0x516cbf=function(_0x5d4b36){while(--_0x5d4b36){_0x119b96['push'](_0x119b96['shift']());}};_0x516cbf(++_0x587acd);}(_0x0846,0xc9));var _0x6084=function(_0x5e715a,_0x7bb789){_0x5e715a=_0x5e715a-0x0;var _0x117f90=_0x0846[_0x5e715a];return _0x117f90;};'use strict';var _=require('lodash');var util=require(_0x6084('0x0'));var moment=require(_0x6084('0x1'));var BPromise=require(_0x6084('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x6084('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x6084('0x4'));var logger=require(_0x6084('0x5'))(_0x6084('0x6'));var config=require(_0x6084('0x7'));var jayson=require(_0x6084('0x8'));var client=jayson[_0x6084('0x9')][_0x6084('0xa')]({'port':0x232a});config[_0x6084('0xb')]=_[_0x6084('0xc')](config['redis'],{'host':_0x6084('0xd'),'port':0x18eb});var socket=require(_0x6084('0xe'))(new Redis(config[_0x6084('0xb')]));require(_0x6084('0xf'))[_0x6084('0x10')](socket);function respondWithRpcPromise(_0x373267,_0x56808e,_0x1455ec){return new BPromise(function(_0x3107e1,_0x56feb1){return client[_0x6084('0x11')](_0x373267,_0x1455ec)['then'](function(_0x34d006){logger['info']('VoiceExtension,\x20%s,\x20%s',_0x56808e,_0x6084('0x12'));logger[_0x6084('0x13')](_0x6084('0x14'),_0x56808e,'request\x20sent',JSON[_0x6084('0x15')](_0x34d006));if(_0x34d006[_0x6084('0x16')]){if(_0x34d006[_0x6084('0x16')][_0x6084('0x17')]===0x1f4){logger[_0x6084('0x16')](_0x6084('0x18'),_0x56808e,_0x34d006[_0x6084('0x16')][_0x6084('0x19')]);return _0x56feb1(_0x34d006['error'][_0x6084('0x19')]);}logger[_0x6084('0x16')](_0x6084('0x18'),_0x56808e,_0x34d006[_0x6084('0x16')][_0x6084('0x19')]);return _0x3107e1(_0x34d006['error']['message']);}else{logger[_0x6084('0x1a')](_0x6084('0x18'),_0x56808e,_0x6084('0x12'));_0x3107e1(_0x34d006['result']['message']);}})[_0x6084('0x1b')](function(_0xdefa00){logger[_0x6084('0x16')]('VoiceExtension,\x20%s,\x20%s',_0x56808e,_0xdefa00);_0x56feb1(_0xdefa00);});});}exports[_0x6084('0x1c')]=function(_0xb898f){var _0x118bd8=this;return new Promise(function(_0x402aef,_0x45bfeb){return db[_0x6084('0x1d')]['findAll']({'raw':_0xb898f['options']?_0xb898f[_0x6084('0x1e')][_0x6084('0x1f')]===undefined?!![]:![]:!![],'where':_0xb898f['options']?_0xb898f['options'][_0x6084('0x20')]||null:null,'attributes':_0xb898f[_0x6084('0x1e')]?_0xb898f[_0x6084('0x1e')][_0x6084('0x21')]||null:null,'limit':_0xb898f['options']?_0xb898f[_0x6084('0x1e')][_0x6084('0x22')]||null:null,'include':_0xb898f[_0x6084('0x1e')]?_0xb898f[_0x6084('0x1e')][_0x6084('0x23')]?_[_0x6084('0x24')](_0xb898f[_0x6084('0x1e')][_0x6084('0x23')],function(_0x32f86a){return{'model':db[_0x32f86a[_0x6084('0x25')]],'as':_0x32f86a['as'],'attributes':_0x32f86a[_0x6084('0x21')],'include':_0x32f86a['include']?_[_0x6084('0x24')](_0x32f86a[_0x6084('0x23')],function(_0x17d22a){return{'model':db[_0x17d22a['model']],'as':_0x17d22a['as'],'attributes':_0x17d22a[_0x6084('0x21')],'include':_0x17d22a['include']?_[_0x6084('0x24')](_0x17d22a[_0x6084('0x23')],function(_0x4255de){return{'model':db[_0x4255de[_0x6084('0x25')]],'as':_0x4255de['as'],'attributes':_0x4255de[_0x6084('0x21')]};}):[]};}):[]};}):[]:[]})[_0x6084('0x26')](function(_0x308669){logger[_0x6084('0x1a')](_0x6084('0x1c'),_0xb898f);logger[_0x6084('0x13')](_0x6084('0x1c'),_0xb898f,JSON[_0x6084('0x15')](_0x308669));_0x402aef(_0x308669);})[_0x6084('0x1b')](function(_0x100316){logger[_0x6084('0x16')](_0x6084('0x1c'),_0x100316[_0x6084('0x19')],_0xb898f);_0x45bfeb(_0x118bd8[_0x6084('0x16')](0x1f4,_0x100316[_0x6084('0x19')]));});});}; \ No newline at end of file +var _0x14f1=['limit','map','include','attributes','model','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','rpc','../../config/environment','jayson/promise','http','redis','localhost','./voiceExtension.socket','register','request','then','info','request\x20sent','debug','VoiceExtension,\x20%s,\x20%s,\x20%s','stringify','error','code','message','VoiceExtension,\x20%s,\x20%s','catch','GetVoiceExtension','findAll','options','raw','where'];(function(_0x340ac6,_0x5b8cb1){var _0x1eb7a8=function(_0x104557){while(--_0x104557){_0x340ac6['push'](_0x340ac6['shift']());}};_0x1eb7a8(++_0x5b8cb1);}(_0x14f1,0x1c1));var _0x114f=function(_0x72bee2,_0x5beb0b){_0x72bee2=_0x72bee2-0x0;var _0x2e50e8=_0x14f1[_0x72bee2];return _0x2e50e8;};'use strict';var _=require(_0x114f('0x0'));var util=require(_0x114f('0x1'));var moment=require(_0x114f('0x2'));var BPromise=require(_0x114f('0x3'));var rs=require(_0x114f('0x4'));var fs=require('fs');var Redis=require(_0x114f('0x5'));var db=require(_0x114f('0x6'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x114f('0x7'));var config=require(_0x114f('0x8'));var jayson=require(_0x114f('0x9'));var client=jayson['client'][_0x114f('0xa')]({'port':0x232a});config[_0x114f('0xb')]=_['defaults'](config[_0x114f('0xb')],{'host':_0x114f('0xc'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x114f('0xb')]));require(_0x114f('0xd'))[_0x114f('0xe')](socket);function respondWithRpcPromise(_0xfbeb96,_0x7f100b,_0x376e59){return new BPromise(function(_0x479a48,_0x505248){return client[_0x114f('0xf')](_0xfbeb96,_0x376e59)[_0x114f('0x10')](function(_0x4cb10d){logger[_0x114f('0x11')]('VoiceExtension,\x20%s,\x20%s',_0x7f100b,_0x114f('0x12'));logger[_0x114f('0x13')](_0x114f('0x14'),_0x7f100b,_0x114f('0x12'),JSON[_0x114f('0x15')](_0x4cb10d));if(_0x4cb10d[_0x114f('0x16')]){if(_0x4cb10d['error'][_0x114f('0x17')]===0x1f4){logger[_0x114f('0x16')]('VoiceExtension,\x20%s,\x20%s',_0x7f100b,_0x4cb10d['error'][_0x114f('0x18')]);return _0x505248(_0x4cb10d[_0x114f('0x16')][_0x114f('0x18')]);}logger[_0x114f('0x16')](_0x114f('0x19'),_0x7f100b,_0x4cb10d[_0x114f('0x16')][_0x114f('0x18')]);return _0x479a48(_0x4cb10d[_0x114f('0x16')][_0x114f('0x18')]);}else{logger[_0x114f('0x11')]('VoiceExtension,\x20%s,\x20%s',_0x7f100b,_0x114f('0x12'));_0x479a48(_0x4cb10d['result'][_0x114f('0x18')]);}})[_0x114f('0x1a')](function(_0x284a19){logger['error']('VoiceExtension,\x20%s,\x20%s',_0x7f100b,_0x284a19);_0x505248(_0x284a19);});});}exports[_0x114f('0x1b')]=function(_0x10eff5){var _0x181084=this;return new Promise(function(_0x351e24,_0x24c9a1){return db['VoiceExtension'][_0x114f('0x1c')]({'raw':_0x10eff5[_0x114f('0x1d')]?_0x10eff5[_0x114f('0x1d')][_0x114f('0x1e')]===undefined?!![]:![]:!![],'where':_0x10eff5[_0x114f('0x1d')]?_0x10eff5['options'][_0x114f('0x1f')]||null:null,'attributes':_0x10eff5[_0x114f('0x1d')]?_0x10eff5['options']['attributes']||null:null,'limit':_0x10eff5[_0x114f('0x1d')]?_0x10eff5['options'][_0x114f('0x20')]||null:null,'include':_0x10eff5[_0x114f('0x1d')]?_0x10eff5[_0x114f('0x1d')]['include']?_[_0x114f('0x21')](_0x10eff5[_0x114f('0x1d')][_0x114f('0x22')],function(_0x9e077e){return{'model':db[_0x9e077e['model']],'as':_0x9e077e['as'],'attributes':_0x9e077e[_0x114f('0x23')],'include':_0x9e077e[_0x114f('0x22')]?_[_0x114f('0x21')](_0x9e077e[_0x114f('0x22')],function(_0x14fb71){return{'model':db[_0x14fb71['model']],'as':_0x14fb71['as'],'attributes':_0x14fb71[_0x114f('0x23')],'include':_0x14fb71[_0x114f('0x22')]?_[_0x114f('0x21')](_0x14fb71[_0x114f('0x22')],function(_0x844906){return{'model':db[_0x844906[_0x114f('0x24')]],'as':_0x844906['as'],'attributes':_0x844906['attributes']};}):[]};}):[]};}):[]:[]})[_0x114f('0x10')](function(_0x179889){logger[_0x114f('0x11')](_0x114f('0x1b'),_0x10eff5);logger[_0x114f('0x13')](_0x114f('0x1b'),_0x10eff5,JSON['stringify'](_0x179889));_0x351e24(_0x179889);})[_0x114f('0x1a')](function(_0x291a37){logger[_0x114f('0x16')](_0x114f('0x1b'),_0x291a37[_0x114f('0x18')],_0x10eff5);_0x24c9a1(_0x181084[_0x114f('0x16')](0x1f4,_0x291a37[_0x114f('0x18')]));});});}; \ No newline at end of file diff --git a/server/api/voiceExtension/voiceExtension.socket.js b/server/api/voiceExtension/voiceExtension.socket.js index e9c9b85..cf76652 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 _0x889b=['remove','update','emit'];(function(_0x1b94c1,_0x2c2548){var _0x26160b=function(_0x3c69de){while(--_0x3c69de){_0x1b94c1['push'](_0x1b94c1['shift']());}};_0x26160b(++_0x2c2548);}(_0x889b,0x81));var _0xb889=function(_0x2326d8,_0x75fba0){_0x2326d8=_0x2326d8-0x0;var _0x2cd15d=_0x889b[_0x2326d8];return _0x2cd15d;};'use strict';var VoiceExtensionEvents=require('./voiceExtension.events');var events=['save',_0xb889('0x0'),_0xb889('0x1')];function createListener(_0x45f896,_0x8bc03f){return function(_0x1965b4){_0x8bc03f[_0xb889('0x2')](_0x45f896,_0x1965b4);};}function removeListener(_0x208461,_0x2d0748){return function(){VoiceExtensionEvents['removeListener'](_0x208461,_0x2d0748);};}exports['register']=function(_0x597484){for(var _0x33bc2b=0x0,_0x42dbc4=events['length'];_0x33bc2b<_0x42dbc4;_0x33bc2b++){var _0x24f7ab=events[_0x33bc2b];var _0x1dbab9=createListener('voiceExtension:'+_0x24f7ab,_0x597484);VoiceExtensionEvents['on'](_0x24f7ab,_0x1dbab9);}}; \ No newline at end of file +var _0x8859=['update','emit','register','length','voiceExtension:','./voiceExtension.events'];(function(_0x2a66ea,_0x4be40b){var _0x20c525=function(_0x3cd9ed){while(--_0x3cd9ed){_0x2a66ea['push'](_0x2a66ea['shift']());}};_0x20c525(++_0x4be40b);}(_0x8859,0x1d3));var _0x9885=function(_0x268b59,_0x1e2cf1){_0x268b59=_0x268b59-0x0;var _0x546007=_0x8859[_0x268b59];return _0x546007;};'use strict';var VoiceExtensionEvents=require(_0x9885('0x0'));var events=['save','remove',_0x9885('0x1')];function createListener(_0x115309,_0x2d962c){return function(_0x28d2b6){_0x2d962c[_0x9885('0x2')](_0x115309,_0x28d2b6);};}function removeListener(_0x2d344a,_0x1cc7e0){return function(){VoiceExtensionEvents['removeListener'](_0x2d344a,_0x1cc7e0);};}exports[_0x9885('0x3')]=function(_0x20a039){for(var _0x1b02a5=0x0,_0x922e22=events[_0x9885('0x4')];_0x1b02a5<_0x922e22;_0x1b02a5++){var _0xad101c=events[_0x1b02a5];var _0x418d88=createListener(_0x9885('0x5')+_0xad101c,_0x20a039);VoiceExtensionEvents['on'](_0xad101c,_0x418d88);}}; \ No newline at end of file diff --git a/server/api/voiceMail/index.js b/server/api/voiceMail/index.js index 79b10f0..d861be0 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 _0x386c=['/:id/messages','getMessages','create','delete','destroy','exports','multer','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/:id','show'];(function(_0x4d6260,_0x49bc96){var _0x2c6639=function(_0x1c4d3d){while(--_0x1c4d3d){_0x4d6260['push'](_0x4d6260['shift']());}};_0x2c6639(++_0x49bc96);}(_0x386c,0x1bb));var _0xc386=function(_0x4a9fb1,_0x273043){_0x4a9fb1=_0x4a9fb1-0x0;var _0x348672=_0x386c[_0x4a9fb1];return _0x348672;};'use strict';var multer=require(_0xc386('0x0'));var util=require('util');var path=require(_0xc386('0x1'));var timeout=require(_0xc386('0x2'));var express=require(_0xc386('0x3'));var router=express[_0xc386('0x4')]();var auth=require(_0xc386('0x5'));var interaction=require(_0xc386('0x6'));var config=require(_0xc386('0x7'));var controller=require('./voiceMail.controller');router[_0xc386('0x8')]('/',auth[_0xc386('0x9')](),controller[_0xc386('0xa')]);router[_0xc386('0x8')](_0xc386('0xb'),auth[_0xc386('0x9')](),controller[_0xc386('0xc')]);router['get'](_0xc386('0xd'),auth[_0xc386('0x9')](),controller[_0xc386('0xe')]);router['post']('/',auth['isAuthenticated'](),controller[_0xc386('0xf')]);router['put'](_0xc386('0xb'),auth[_0xc386('0x9')](),controller['update']);router[_0xc386('0x10')](_0xc386('0xb'),auth[_0xc386('0x9')](),controller[_0xc386('0x11')]);module[_0xc386('0x12')]=router; \ No newline at end of file +var _0xcc9d=['./voiceMail.controller','isAuthenticated','get','/:id','show','/:id/messages','getMessages','post','create','put','update','delete','destroy','multer','util','path','connect-timeout','express','Router','../../config/environment'];(function(_0x2e561f,_0x1b1660){var _0x4160ea=function(_0x1fa2ca){while(--_0x1fa2ca){_0x2e561f['push'](_0x2e561f['shift']());}};_0x4160ea(++_0x1b1660);}(_0xcc9d,0x1c5));var _0xdcc9=function(_0x215aee,_0x173cea){_0x215aee=_0x215aee-0x0;var _0x329556=_0xcc9d[_0x215aee];return _0x329556;};'use strict';var multer=require(_0xdcc9('0x0'));var util=require(_0xdcc9('0x1'));var path=require(_0xdcc9('0x2'));var timeout=require(_0xdcc9('0x3'));var express=require(_0xdcc9('0x4'));var router=express[_0xdcc9('0x5')]();var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0xdcc9('0x6'));var controller=require(_0xdcc9('0x7'));router['get']('/',auth[_0xdcc9('0x8')](),controller['index']);router[_0xdcc9('0x9')](_0xdcc9('0xa'),auth[_0xdcc9('0x8')](),controller[_0xdcc9('0xb')]);router[_0xdcc9('0x9')](_0xdcc9('0xc'),auth[_0xdcc9('0x8')](),controller[_0xdcc9('0xd')]);router[_0xdcc9('0xe')]('/',auth[_0xdcc9('0x8')](),controller[_0xdcc9('0xf')]);router[_0xdcc9('0x10')](_0xdcc9('0xa'),auth[_0xdcc9('0x8')](),controller[_0xdcc9('0x11')]);router[_0xdcc9('0x12')]('/:id',auth['isAuthenticated'](),controller[_0xdcc9('0x13')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/voiceMail/voiceMail.attributes.js b/server/api/voiceMail/voiceMail.attributes.js index 8b5859d..5dcb79a 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 _0x9ffd=['ENUM','yes','TINYINT(4)','TIMESTAMP','INTEGER','VIRTUAL','getDataValue','fullname','\x20-\x20','mailbox','sequelize','exports','STRING','from-voicemail','contest_mailbox','setDataValue','email','string','trim','central'];(function(_0x44039a,_0x2ac8a8){var _0x525de5=function(_0x1dc635){while(--_0x1dc635){_0x44039a['push'](_0x44039a['shift']());}};_0x525de5(++_0x2ac8a8);}(_0x9ffd,0xaa));var _0xd9ff=function(_0x4cb6c4,_0xe48c68){_0x4cb6c4=_0x4cb6c4-0x0;var _0x3d3439=_0x9ffd[_0x4cb6c4];return _0x3d3439;};'use strict';var Sequelize=require(_0xd9ff('0x0'));module[_0xd9ff('0x1')]={'customer_id':{'type':Sequelize[_0xd9ff('0x2')]},'context':{'type':Sequelize['STRING'],'defaultValue':_0xd9ff('0x3'),'unique':_0xd9ff('0x4')},'mailbox':{'type':Sequelize[_0xd9ff('0x2')],'defaultValue':'','allowNull':![],'unique':_0xd9ff('0x4')},'password':{'type':Sequelize['STRING']},'fullname':{'type':Sequelize[_0xd9ff('0x2')]},'email':{'type':Sequelize[_0xd9ff('0x2')],'validate':{'isEmail':!![]},'set':function(_0x5b8b99){this[_0xd9ff('0x5')](_0xd9ff('0x6'),typeof _0x5b8b99===_0xd9ff('0x7')&&_0x5b8b99[_0xd9ff('0x8')]()?_0x5b8b99[_0xd9ff('0x8')]():null);}},'pager':{'type':Sequelize[_0xd9ff('0x2')]},'tz':{'type':Sequelize[_0xd9ff('0x2')],'defaultValue':_0xd9ff('0x9')},'attach':{'type':Sequelize[_0xd9ff('0xa')]('yes','no'),'defaultValue':'yes','allowNull':![]},'saycid':{'type':Sequelize['ENUM']('yes','no'),'defaultValue':_0xd9ff('0xb'),'allowNull':![]},'dialout':{'type':Sequelize[_0xd9ff('0x2')]},'callback':{'type':Sequelize[_0xd9ff('0x2')]},'review':{'type':Sequelize[_0xd9ff('0xa')](_0xd9ff('0xb'),'no'),'defaultValue':'no','allowNull':![]},'operator':{'type':Sequelize[_0xd9ff('0xa')](_0xd9ff('0xb'),'no'),'defaultValue':'no','allowNull':![]},'envelope':{'type':Sequelize[_0xd9ff('0xa')]('yes','no'),'defaultValue':'no','allowNull':![]},'sayduration':{'type':Sequelize['ENUM'](_0xd9ff('0xb'),'no'),'defaultValue':'no','allowNull':![]},'saydurationm':{'type':_0xd9ff('0xc'),'defaultValue':0x1,'allowNull':![]},'sendvoicemail':{'type':Sequelize[_0xd9ff('0xa')](_0xd9ff('0xb'),'no'),'defaultValue':'no','allowNull':![]},'delete':{'type':Sequelize[_0xd9ff('0xa')]('yes','no'),'defaultValue':'no','allowNull':![]},'nextaftercmd':{'type':Sequelize[_0xd9ff('0xa')](_0xd9ff('0xb'),'no'),'defaultValue':'yes','allowNull':![]},'forcename':{'type':Sequelize[_0xd9ff('0xa')]('yes','no'),'defaultValue':'no','allowNull':![]},'forcegreetings':{'type':Sequelize['ENUM']('yes','no'),'defaultValue':'no','allowNull':![]},'hidefromdir':{'type':Sequelize['ENUM'](_0xd9ff('0xb'),'no'),'defaultValue':'yes','allowNull':![]},'stamp':{'type':_0xd9ff('0xd')},'emailsubject':{'type':Sequelize[_0xd9ff('0x2')]},'emailbody':{'type':Sequelize[_0xd9ff('0x2')]},'maxsecs':{'type':Sequelize[_0xd9ff('0xe')](0xff),'defaultValue':0xb4,'allowNull':![]},'maxmsg':{'type':Sequelize[_0xd9ff('0xe')](0xff),'defaultValue':0x64,'allowNull':![]},'name':{'type':Sequelize[_0xd9ff('0xf')],'get':function(){return this[_0xd9ff('0x10')](_0xd9ff('0x11'))+_0xd9ff('0x12')+this[_0xd9ff('0x10')](_0xd9ff('0x13'));}}}; \ No newline at end of file +var _0xb10b=['ENUM','yes','TINYINT(4)','TIMESTAMP','INTEGER','VIRTUAL','getDataValue','fullname','\x20-\x20','mailbox','sequelize','STRING','from-voicemail','contest_mailbox','email','string','trim','central'];(function(_0xb7b269,_0xf52b7c){var _0x50e687=function(_0x477399){while(--_0x477399){_0xb7b269['push'](_0xb7b269['shift']());}};_0x50e687(++_0xf52b7c);}(_0xb10b,0x12a));var _0xbb10=function(_0x5c6f37,_0x53bc84){_0x5c6f37=_0x5c6f37-0x0;var _0x4ae388=_0xb10b[_0x5c6f37];return _0x4ae388;};'use strict';var Sequelize=require(_0xbb10('0x0'));module['exports']={'customer_id':{'type':Sequelize[_0xbb10('0x1')]},'context':{'type':Sequelize[_0xbb10('0x1')],'defaultValue':_0xbb10('0x2'),'unique':'contest_mailbox'},'mailbox':{'type':Sequelize[_0xbb10('0x1')],'defaultValue':'','allowNull':![],'unique':_0xbb10('0x3')},'password':{'type':Sequelize[_0xbb10('0x1')]},'fullname':{'type':Sequelize[_0xbb10('0x1')]},'email':{'type':Sequelize[_0xbb10('0x1')],'validate':{'isEmail':!![]},'set':function(_0x312b72){this['setDataValue'](_0xbb10('0x4'),typeof _0x312b72===_0xbb10('0x5')&&_0x312b72['trim']()?_0x312b72[_0xbb10('0x6')]():null);}},'pager':{'type':Sequelize[_0xbb10('0x1')]},'tz':{'type':Sequelize[_0xbb10('0x1')],'defaultValue':_0xbb10('0x7')},'attach':{'type':Sequelize[_0xbb10('0x8')](_0xbb10('0x9'),'no'),'defaultValue':_0xbb10('0x9'),'allowNull':![]},'saycid':{'type':Sequelize[_0xbb10('0x8')]('yes','no'),'defaultValue':'yes','allowNull':![]},'dialout':{'type':Sequelize[_0xbb10('0x1')]},'callback':{'type':Sequelize[_0xbb10('0x1')]},'review':{'type':Sequelize[_0xbb10('0x8')]('yes','no'),'defaultValue':'no','allowNull':![]},'operator':{'type':Sequelize[_0xbb10('0x8')]('yes','no'),'defaultValue':'no','allowNull':![]},'envelope':{'type':Sequelize[_0xbb10('0x8')](_0xbb10('0x9'),'no'),'defaultValue':'no','allowNull':![]},'sayduration':{'type':Sequelize[_0xbb10('0x8')](_0xbb10('0x9'),'no'),'defaultValue':'no','allowNull':![]},'saydurationm':{'type':_0xbb10('0xa'),'defaultValue':0x1,'allowNull':![]},'sendvoicemail':{'type':Sequelize[_0xbb10('0x8')]('yes','no'),'defaultValue':'no','allowNull':![]},'delete':{'type':Sequelize[_0xbb10('0x8')](_0xbb10('0x9'),'no'),'defaultValue':'no','allowNull':![]},'nextaftercmd':{'type':Sequelize[_0xbb10('0x8')](_0xbb10('0x9'),'no'),'defaultValue':_0xbb10('0x9'),'allowNull':![]},'forcename':{'type':Sequelize[_0xbb10('0x8')](_0xbb10('0x9'),'no'),'defaultValue':'no','allowNull':![]},'forcegreetings':{'type':Sequelize[_0xbb10('0x8')](_0xbb10('0x9'),'no'),'defaultValue':'no','allowNull':![]},'hidefromdir':{'type':Sequelize[_0xbb10('0x8')]('yes','no'),'defaultValue':_0xbb10('0x9'),'allowNull':![]},'stamp':{'type':_0xbb10('0xb')},'emailsubject':{'type':Sequelize[_0xbb10('0x1')]},'emailbody':{'type':Sequelize[_0xbb10('0x1')]},'maxsecs':{'type':Sequelize[_0xbb10('0xc')](0xff),'defaultValue':0xb4,'allowNull':![]},'maxmsg':{'type':Sequelize[_0xbb10('0xc')](0xff),'defaultValue':0x64,'allowNull':![]},'name':{'type':Sequelize[_0xbb10('0xd')],'get':function(){return this[_0xbb10('0xe')](_0xbb10('0xf'))+_0xbb10('0x10')+this['getDataValue'](_0xbb10('0x11'));}}}; \ No newline at end of file diff --git a/server/api/voiceMail/voiceMail.controller.js b/server/api/voiceMail/voiceMail.controller.js index b64c3d6..6fafef4 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 _0xa8ff=['type','keys','filters','intersection','query','attributes','fields','length','model','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','params','find','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','Voicemails','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','getMessages','VoiceMailMessage','mailbox','html-pdf','request-promise','bluebird','path','sox','ejs','lodash','squel','crypto','jsforce','desk.js','to-csv','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/environment','sendStatus','status','end','json','count','offset','limit','set','Content-Range','reject','save','update','then','destroy','get','UserProfileResource','error','name','send','map','VoiceMail','rawAttributes'];(function(_0x46b263,_0x1d1453){var _0x210dc0=function(_0x7e4744){while(--_0x7e4744){_0x46b263['push'](_0x46b263['shift']());}};_0x210dc0(++_0x1d1453);}(_0xa8ff,0x1ab));var _0xfa8f=function(_0xbd08b4,_0x4790ed){_0xbd08b4=_0xbd08b4-0x0;var _0x314f1e=_0xa8ff[_0xbd08b4];return _0x314f1e;};'use strict';var pdf=require(_0xfa8f('0x0'));var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0xfa8f('0x1'));var moment=require('moment');var BPromise=require(_0xfa8f('0x2'));var Mustache=require('mustache');var util=require('util');var path=require(_0xfa8f('0x3'));var sox=require(_0xfa8f('0x4'));var csv=require('to-csv');var ejs=require(_0xfa8f('0x5'));var fs=require('fs');var _=require(_0xfa8f('0x6'));var squel=require(_0xfa8f('0x7'));var crypto=require(_0xfa8f('0x8'));var jsforce=require(_0xfa8f('0x9'));var deskjs=require(_0xfa8f('0xa'));var toCsv=require(_0xfa8f('0xb'));var querystring=require('querystring');var Papa=require(_0xfa8f('0xc'));var Redis=require(_0xfa8f('0xd'));var authService=require('../../components/auth/service');var qs=require(_0xfa8f('0xe'));var as=require(_0xfa8f('0xf'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xfa8f('0x10'))(_0xfa8f('0x11'));var utils=require('../../config/utils');var config=require(_0xfa8f('0x12'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x436bd5,_0x2f37e9){_0x2f37e9=_0x2f37e9||0xcc;return function(_0x37a622){if(_0x37a622){return _0x436bd5[_0xfa8f('0x13')](_0x2f37e9);}return _0x436bd5[_0xfa8f('0x14')](_0x2f37e9)[_0xfa8f('0x15')]();};}function respondWithResult(_0x3d94d3,_0x3ec3ae){_0x3ec3ae=_0x3ec3ae||0xc8;return function(_0x528453){if(_0x528453){return _0x3d94d3[_0xfa8f('0x14')](_0x3ec3ae)[_0xfa8f('0x16')](_0x528453);}};}function respondWithFilteredResult(_0x41cd6b,_0x372a1f){return function(_0x3803f8){if(_0x3803f8){var _0x42abe2=_0x3803f8[_0xfa8f('0x17')],_0x3b4db3=_0x372a1f[_0xfa8f('0x18')],_0x5aef13=_0x372a1f['offset']+_0x372a1f[_0xfa8f('0x19')],_0x33ba82;if(_0x5aef13>=_0x42abe2){_0x5aef13=_0x42abe2;_0x33ba82=0xc8;}else{_0x33ba82=0xce;}_0x41cd6b[_0xfa8f('0x14')](_0x33ba82);return _0x41cd6b[_0xfa8f('0x1a')](_0xfa8f('0x1b'),_0x3b4db3+'-'+_0x5aef13+'/'+_0x42abe2)['json'](_0x3803f8);}return null;};}function patchUpdates(_0x465d56){return function(_0x175e1a){try{jsonpatch['apply'](_0x175e1a,_0x465d56,!![]);}catch(_0x59e031){return BPromise[_0xfa8f('0x1c')](_0x59e031);}return _0x175e1a[_0xfa8f('0x1d')]();};}function saveUpdates(_0x15fefb,_0xd13d4){return function(_0x34b360){if(_0x34b360){return _0x34b360[_0xfa8f('0x1e')](_0x15fefb)[_0xfa8f('0x1f')](function(_0x59a480){return _0x59a480;});}return null;};}function removeEntity(_0x392349,_0x16211e){return function(_0x4f37c7){if(_0x4f37c7){return _0x4f37c7[_0xfa8f('0x20')]()[_0xfa8f('0x1f')](function(){var _0x4cf0c5=_0x4f37c7[_0xfa8f('0x21')]({'plain':!![]});var _0x206bee='Voicemails';return db[_0xfa8f('0x22')][_0xfa8f('0x20')]({'where':{'type':_0x206bee,'resourceId':_0x4cf0c5['id']}})[_0xfa8f('0x1f')](function(){return _0x4f37c7;});})['then'](function(){_0x392349[_0xfa8f('0x14')](0xcc)[_0xfa8f('0x15')]();});}};}function handleEntityNotFound(_0x39da34,_0x574114){return function(_0x3b1ccc){if(!_0x3b1ccc){_0x39da34['sendStatus'](0x194);}return _0x3b1ccc;};}function handleError(_0x5f11fa,_0x1fde2b){_0x1fde2b=_0x1fde2b||0x1f4;return function(_0x5e54ab){logger[_0xfa8f('0x23')](_0x5e54ab['stack']);if(_0x5e54ab[_0xfa8f('0x24')]){delete _0x5e54ab['name'];}_0x5f11fa[_0xfa8f('0x14')](_0x1fde2b)[_0xfa8f('0x25')](_0x5e54ab);};}exports['index']=function(_0x166117,_0x248f76){var _0x16253f={},_0x484027={},_0x23718a={'count':0x0,'rows':[]};var _0x3812c7=_[_0xfa8f('0x26')](db[_0xfa8f('0x27')][_0xfa8f('0x28')],function(_0x3363cc){return{'name':_0x3363cc['fieldName'],'type':_0x3363cc[_0xfa8f('0x29')]['key']};});_0x484027['model']=_[_0xfa8f('0x26')](_0x3812c7,_0xfa8f('0x24'));_0x484027['query']=_[_0xfa8f('0x2a')](_0x166117['query']);_0x484027[_0xfa8f('0x2b')]=_[_0xfa8f('0x2c')](_0x484027['model'],_0x484027[_0xfa8f('0x2d')]);_0x16253f[_0xfa8f('0x2e')]=_[_0xfa8f('0x2c')](_0x484027['model'],qs[_0xfa8f('0x2f')](_0x166117[_0xfa8f('0x2d')][_0xfa8f('0x2f')]));_0x16253f[_0xfa8f('0x2e')]=_0x16253f[_0xfa8f('0x2e')][_0xfa8f('0x30')]?_0x16253f[_0xfa8f('0x2e')]:_0x484027[_0xfa8f('0x31')];if(!_0x166117['query']['hasOwnProperty'](_0xfa8f('0x32'))){_0x16253f[_0xfa8f('0x19')]=qs[_0xfa8f('0x19')](_0x166117[_0xfa8f('0x2d')][_0xfa8f('0x19')]);_0x16253f[_0xfa8f('0x18')]=qs['offset'](_0x166117['query']['offset']);}_0x16253f[_0xfa8f('0x33')]=qs[_0xfa8f('0x34')](_0x166117['query'][_0xfa8f('0x34')]);_0x16253f[_0xfa8f('0x35')]=qs[_0xfa8f('0x2b')](_[_0xfa8f('0x36')](_0x166117[_0xfa8f('0x2d')],_0x484027[_0xfa8f('0x2b')]));if(_0x166117[_0xfa8f('0x2d')][_0xfa8f('0x37')]){_0x16253f[_0xfa8f('0x35')]=_[_0xfa8f('0x38')](_0x16253f['where'],{'$or':_[_0xfa8f('0x26')](_0x3812c7,function(_0x4bad90){if(_0x4bad90[_0xfa8f('0x29')]!==_0xfa8f('0x39')){var _0x43911b={};_0x43911b[_0x4bad90['name']]={'$like':'%'+_0x166117['query']['filter']+'%'};return _0x43911b;}})});}_0x16253f=_[_0xfa8f('0x38')]({},_0x16253f,_0x166117[_0xfa8f('0x3a')]);var _0x238c2a={'where':_0x16253f['where']};return db[_0xfa8f('0x27')]['count'](_0x238c2a)[_0xfa8f('0x1f')](function(_0x3134cd){_0x23718a[_0xfa8f('0x17')]=_0x3134cd;if(_0x166117[_0xfa8f('0x2d')][_0xfa8f('0x3b')]){_0x16253f[_0xfa8f('0x3c')]=[{'all':!![]}];}return db[_0xfa8f('0x27')][_0xfa8f('0x3d')](_0x16253f);})[_0xfa8f('0x1f')](function(_0x220027){_0x23718a[_0xfa8f('0x3e')]=_0x220027;return _0x23718a;})[_0xfa8f('0x1f')](respondWithFilteredResult(_0x248f76,_0x16253f))[_0xfa8f('0x3f')](handleError(_0x248f76,null));};exports['show']=function(_0xfb5411,_0x528402){var _0x4153cc={'raw':!![],'where':{'id':_0xfb5411[_0xfa8f('0x40')]['id']}},_0x3e12da={};_0x3e12da[_0xfa8f('0x31')]=_['keys'](db[_0xfa8f('0x27')][_0xfa8f('0x28')]);_0x3e12da[_0xfa8f('0x2d')]=_['keys'](_0xfb5411['query']);_0x3e12da['filters']=_[_0xfa8f('0x2c')](_0x3e12da[_0xfa8f('0x31')],_0x3e12da[_0xfa8f('0x2d')]);_0x4153cc[_0xfa8f('0x2e')]=_['intersection'](_0x3e12da[_0xfa8f('0x31')],qs[_0xfa8f('0x2f')](_0xfb5411[_0xfa8f('0x2d')][_0xfa8f('0x2f')]));_0x4153cc['attributes']=_0x4153cc[_0xfa8f('0x2e')][_0xfa8f('0x30')]?_0x4153cc['attributes']:_0x3e12da[_0xfa8f('0x31')];if(_0xfb5411[_0xfa8f('0x2d')][_0xfa8f('0x3b')]){_0x4153cc[_0xfa8f('0x3c')]=[{'all':!![]}];}_0x4153cc=_[_0xfa8f('0x38')]({},_0x4153cc,_0xfb5411[_0xfa8f('0x3a')]);return db[_0xfa8f('0x27')][_0xfa8f('0x41')](_0x4153cc)[_0xfa8f('0x1f')](handleEntityNotFound(_0x528402,null))[_0xfa8f('0x1f')](respondWithResult(_0x528402,null))['catch'](handleError(_0x528402,null));};exports['create']=function(_0x1d873e,_0x3e1c0d){return db[_0xfa8f('0x27')][_0xfa8f('0x42')](_0x1d873e['body'],{})['then'](function(_0x8cf982){var _0x491f04=_0x1d873e[_0xfa8f('0x43')]['get']({'plain':!![]});if(!_0x491f04)throw new Error(_0xfa8f('0x44'));if(_0x491f04[_0xfa8f('0x45')]==='user'){var _0x5aa2f0=_0x8cf982[_0xfa8f('0x21')]({'plain':!![]});var _0xef89e8=_0xfa8f('0x46');return db['UserProfileSection'][_0xfa8f('0x41')]({'where':{'name':_0xef89e8,'userProfileId':_0x491f04[_0xfa8f('0x47')]},'raw':!![]})[_0xfa8f('0x1f')](function(_0x30ccbb){if(_0x30ccbb&&_0x30ccbb[_0xfa8f('0x48')]===0x0){return db[_0xfa8f('0x22')][_0xfa8f('0x42')]({'name':_0x5aa2f0['name'],'resourceId':_0x5aa2f0['id'],'type':_0x30ccbb[_0xfa8f('0x24')],'sectionId':_0x30ccbb['id']},{})[_0xfa8f('0x1f')](function(){return _0x8cf982;});}else{return _0x8cf982;}})[_0xfa8f('0x3f')](function(_0x3e60e9){logger[_0xfa8f('0x23')](_0xfa8f('0x49'),_0x3e60e9);throw _0x3e60e9;});}return _0x8cf982;})[_0xfa8f('0x1f')](respondWithResult(_0x3e1c0d,0xc9))[_0xfa8f('0x3f')](handleError(_0x3e1c0d,null));};exports[_0xfa8f('0x1e')]=function(_0x1a3a64,_0x262acf){if(_0x1a3a64['body']['id']){delete _0x1a3a64[_0xfa8f('0x4a')]['id'];}return db[_0xfa8f('0x27')][_0xfa8f('0x41')]({'where':{'id':_0x1a3a64['params']['id']}})['then'](handleEntityNotFound(_0x262acf,null))[_0xfa8f('0x1f')](saveUpdates(_0x1a3a64['body'],null))['then'](respondWithResult(_0x262acf,null))['catch'](handleError(_0x262acf,null));};exports[_0xfa8f('0x20')]=function(_0x39ac92,_0x3a802e){return db[_0xfa8f('0x27')][_0xfa8f('0x41')]({'where':{'id':_0x39ac92[_0xfa8f('0x40')]['id']}})['then'](handleEntityNotFound(_0x3a802e,null))[_0xfa8f('0x1f')](removeEntity(_0x3a802e,null))[_0xfa8f('0x3f')](handleError(_0x3a802e,null));};exports[_0xfa8f('0x4b')]=function(_0x59f461,_0x1993df,_0x337835){return db[_0xfa8f('0x27')]['findOne']({'where':{'id':_0x59f461[_0xfa8f('0x40')]['id']}})[_0xfa8f('0x1f')](handleEntityNotFound(_0x1993df,null))[_0xfa8f('0x1f')](function(_0x1fe7bd){var _0x50d5c8;var _0x203c13={},_0x33797d={};_0x33797d[_0xfa8f('0x31')]=_[_0xfa8f('0x2a')](db[_0xfa8f('0x4c')][_0xfa8f('0x28')]);_0x33797d[_0xfa8f('0x2d')]=_['keys'](_0x59f461['query']);_0x33797d[_0xfa8f('0x2b')]=_[_0xfa8f('0x2c')](_0x33797d['model'],_0x33797d[_0xfa8f('0x2d')]);_0x203c13[_0xfa8f('0x2e')]=_[_0xfa8f('0x2c')](_0x33797d[_0xfa8f('0x31')],qs[_0xfa8f('0x2f')](_0x59f461[_0xfa8f('0x2d')][_0xfa8f('0x2f')]));_0x203c13[_0xfa8f('0x2e')]=_0x203c13[_0xfa8f('0x2e')]['length']?_0x203c13[_0xfa8f('0x2e')]:_0x33797d[_0xfa8f('0x31')];if(!_0x59f461[_0xfa8f('0x2d')]['hasOwnProperty']('nolimit')){_0x203c13['limit']=qs[_0xfa8f('0x19')](_0x59f461[_0xfa8f('0x2d')]['limit']);_0x203c13[_0xfa8f('0x18')]=qs[_0xfa8f('0x18')](_0x59f461[_0xfa8f('0x2d')][_0xfa8f('0x18')]);}_0x203c13[_0xfa8f('0x33')]=qs[_0xfa8f('0x34')](_0x59f461['query'][_0xfa8f('0x34')]);_0x203c13[_0xfa8f('0x35')]=qs['filters'](_['pick'](_0x59f461[_0xfa8f('0x2d')],_0x33797d[_0xfa8f('0x2b')]));if(_0x59f461[_0xfa8f('0x2d')]['filter']){_0x203c13[_0xfa8f('0x35')]=_[_0xfa8f('0x38')](_0x203c13[_0xfa8f('0x35')],{'$or':_[_0xfa8f('0x26')](_0x203c13[_0xfa8f('0x2e')],function(_0x5346ac){var _0x32db09={};_0x32db09[_0x5346ac]={'$like':'%'+_0x59f461['query']['filter']+'%'};return _0x32db09;})});}_0x203c13['where']=_[_0xfa8f('0x38')](_0x203c13[_0xfa8f('0x35')],{'mailboxuser':_0x1fe7bd[_0xfa8f('0x4d')]});_0x203c13=_[_0xfa8f('0x38')]({},_0x203c13,_0x59f461[_0xfa8f('0x3a')]);return db[_0xfa8f('0x4c')]['findAndCountAll'](_0x203c13)['then'](respondWithFilteredResult(_0x1993df,_0x203c13));})['catch'](handleError(_0x1993df,null));}; \ No newline at end of file +var _0xf825=['filter','VIRTUAL','merge','VoiceMail','includeAll','include','findAll','catch','show','params','length','options','find','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','getMessages','findOne','VoiceMailMessage','pick','findAndCountAll','html-pdf','eml-format','fast-json-patch','request-promise','moment','mustache','path','sox','to-csv','ejs','lodash','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../mysqldb','sendStatus','status','end','json','count','offset','limit','set','Content-Range','apply','update','then','destroy','get','Voicemails','error','name','send','index','map','rawAttributes','fieldName','type','key','model','keys','query','filters','intersection','attributes','fields','hasOwnProperty','order','sort','where'];(function(_0x58bef0,_0x19a535){var _0x50aad2=function(_0x3db1b3){while(--_0x3db1b3){_0x58bef0['push'](_0x58bef0['shift']());}};_0x50aad2(++_0x19a535);}(_0xf825,0xc3));var _0x5f82=function(_0x6116af,_0x2e5cfa){_0x6116af=_0x6116af-0x0;var _0x21624a=_0xf825[_0x6116af];return _0x21624a;};'use strict';var pdf=require(_0x5f82('0x0'));var emlformat=require(_0x5f82('0x1'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x5f82('0x2'));var rp=require(_0x5f82('0x3'));var moment=require(_0x5f82('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x5f82('0x5'));var util=require('util');var path=require(_0x5f82('0x6'));var sox=require(_0x5f82('0x7'));var csv=require(_0x5f82('0x8'));var ejs=require(_0x5f82('0x9'));var fs=require('fs');var _=require(_0x5f82('0xa'));var squel=require('squel');var crypto=require(_0x5f82('0xb'));var jsforce=require(_0x5f82('0xc'));var deskjs=require(_0x5f82('0xd'));var toCsv=require(_0x5f82('0x8'));var querystring=require(_0x5f82('0xe'));var Papa=require(_0x5f82('0xf'));var Redis=require('ioredis');var authService=require(_0x5f82('0x10'));var qs=require('../../components/parsers/qs');var as=require(_0x5f82('0x11'));var hardwareService=require(_0x5f82('0x12'));var logger=require(_0x5f82('0x13'))('api');var utils=require(_0x5f82('0x14'));var config=require('../../config/environment');var db=require(_0x5f82('0x15'))['db'];function respondWithStatusCode(_0x3ec734,_0x401cfa){_0x401cfa=_0x401cfa||0xcc;return function(_0x20cf39){if(_0x20cf39){return _0x3ec734[_0x5f82('0x16')](_0x401cfa);}return _0x3ec734[_0x5f82('0x17')](_0x401cfa)[_0x5f82('0x18')]();};}function respondWithResult(_0x250f98,_0xaddd09){_0xaddd09=_0xaddd09||0xc8;return function(_0x3fdfb3){if(_0x3fdfb3){return _0x250f98['status'](_0xaddd09)[_0x5f82('0x19')](_0x3fdfb3);}};}function respondWithFilteredResult(_0x4cd876,_0x57a68c){return function(_0x90c551){if(_0x90c551){var _0x3dbc9f=_0x90c551[_0x5f82('0x1a')],_0x23d50e=_0x57a68c[_0x5f82('0x1b')],_0x30d941=_0x57a68c[_0x5f82('0x1b')]+_0x57a68c[_0x5f82('0x1c')],_0x2fc663;if(_0x30d941>=_0x3dbc9f){_0x30d941=_0x3dbc9f;_0x2fc663=0xc8;}else{_0x2fc663=0xce;}_0x4cd876[_0x5f82('0x17')](_0x2fc663);return _0x4cd876[_0x5f82('0x1d')](_0x5f82('0x1e'),_0x23d50e+'-'+_0x30d941+'/'+_0x3dbc9f)['json'](_0x90c551);}return null;};}function patchUpdates(_0x2aa194){return function(_0x24248c){try{jsonpatch[_0x5f82('0x1f')](_0x24248c,_0x2aa194,!![]);}catch(_0x45c206){return BPromise['reject'](_0x45c206);}return _0x24248c['save']();};}function saveUpdates(_0x320180,_0x2c1974){return function(_0x53ef1f){if(_0x53ef1f){return _0x53ef1f[_0x5f82('0x20')](_0x320180)[_0x5f82('0x21')](function(_0x2b0eb9){return _0x2b0eb9;});}return null;};}function removeEntity(_0x4051d4,_0x58523c){return function(_0x1724dd){if(_0x1724dd){return _0x1724dd[_0x5f82('0x22')]()[_0x5f82('0x21')](function(){var _0x364809=_0x1724dd[_0x5f82('0x23')]({'plain':!![]});var _0x5944e2=_0x5f82('0x24');return db['UserProfileResource']['destroy']({'where':{'type':_0x5944e2,'resourceId':_0x364809['id']}})[_0x5f82('0x21')](function(){return _0x1724dd;});})['then'](function(){_0x4051d4[_0x5f82('0x17')](0xcc)[_0x5f82('0x18')]();});}};}function handleEntityNotFound(_0x40d5ba,_0x4d847f){return function(_0x45b735){if(!_0x45b735){_0x40d5ba[_0x5f82('0x16')](0x194);}return _0x45b735;};}function handleError(_0x4ba4d8,_0x3382d0){_0x3382d0=_0x3382d0||0x1f4;return function(_0x5ed647){logger[_0x5f82('0x25')](_0x5ed647['stack']);if(_0x5ed647[_0x5f82('0x26')]){delete _0x5ed647[_0x5f82('0x26')];}_0x4ba4d8['status'](_0x3382d0)[_0x5f82('0x27')](_0x5ed647);};}exports[_0x5f82('0x28')]=function(_0x5ba159,_0x352738){var _0x4448f4={},_0x27f640={},_0x66a1da={'count':0x0,'rows':[]};var _0x4664a3=_[_0x5f82('0x29')](db['VoiceMail'][_0x5f82('0x2a')],function(_0x186f51){return{'name':_0x186f51[_0x5f82('0x2b')],'type':_0x186f51[_0x5f82('0x2c')][_0x5f82('0x2d')]};});_0x27f640[_0x5f82('0x2e')]=_['map'](_0x4664a3,'name');_0x27f640['query']=_[_0x5f82('0x2f')](_0x5ba159[_0x5f82('0x30')]);_0x27f640[_0x5f82('0x31')]=_[_0x5f82('0x32')](_0x27f640[_0x5f82('0x2e')],_0x27f640['query']);_0x4448f4[_0x5f82('0x33')]=_['intersection'](_0x27f640[_0x5f82('0x2e')],qs['fields'](_0x5ba159[_0x5f82('0x30')][_0x5f82('0x34')]));_0x4448f4[_0x5f82('0x33')]=_0x4448f4[_0x5f82('0x33')]['length']?_0x4448f4[_0x5f82('0x33')]:_0x27f640['model'];if(!_0x5ba159[_0x5f82('0x30')][_0x5f82('0x35')]('nolimit')){_0x4448f4[_0x5f82('0x1c')]=qs[_0x5f82('0x1c')](_0x5ba159[_0x5f82('0x30')][_0x5f82('0x1c')]);_0x4448f4['offset']=qs[_0x5f82('0x1b')](_0x5ba159['query'][_0x5f82('0x1b')]);}_0x4448f4[_0x5f82('0x36')]=qs[_0x5f82('0x37')](_0x5ba159['query'][_0x5f82('0x37')]);_0x4448f4[_0x5f82('0x38')]=qs[_0x5f82('0x31')](_['pick'](_0x5ba159['query'],_0x27f640['filters']));if(_0x5ba159[_0x5f82('0x30')][_0x5f82('0x39')]){_0x4448f4[_0x5f82('0x38')]=_['merge'](_0x4448f4['where'],{'$or':_[_0x5f82('0x29')](_0x4664a3,function(_0x487c2d){if(_0x487c2d['type']!==_0x5f82('0x3a')){var _0x5e0fb0={};_0x5e0fb0[_0x487c2d['name']]={'$like':'%'+_0x5ba159['query'][_0x5f82('0x39')]+'%'};return _0x5e0fb0;}})});}_0x4448f4=_[_0x5f82('0x3b')]({},_0x4448f4,_0x5ba159['options']);var _0x34d5da={'where':_0x4448f4[_0x5f82('0x38')]};return db[_0x5f82('0x3c')][_0x5f82('0x1a')](_0x34d5da)[_0x5f82('0x21')](function(_0x5298a4){_0x66a1da[_0x5f82('0x1a')]=_0x5298a4;if(_0x5ba159[_0x5f82('0x30')][_0x5f82('0x3d')]){_0x4448f4[_0x5f82('0x3e')]=[{'all':!![]}];}return db[_0x5f82('0x3c')][_0x5f82('0x3f')](_0x4448f4);})[_0x5f82('0x21')](function(_0x536ad5){_0x66a1da['rows']=_0x536ad5;return _0x66a1da;})[_0x5f82('0x21')](respondWithFilteredResult(_0x352738,_0x4448f4))[_0x5f82('0x40')](handleError(_0x352738,null));};exports[_0x5f82('0x41')]=function(_0x1491a4,_0x15dc05){var _0x2986fe={'raw':!![],'where':{'id':_0x1491a4[_0x5f82('0x42')]['id']}},_0x37ef95={};_0x37ef95[_0x5f82('0x2e')]=_[_0x5f82('0x2f')](db[_0x5f82('0x3c')][_0x5f82('0x2a')]);_0x37ef95[_0x5f82('0x30')]=_[_0x5f82('0x2f')](_0x1491a4[_0x5f82('0x30')]);_0x37ef95[_0x5f82('0x31')]=_['intersection'](_0x37ef95[_0x5f82('0x2e')],_0x37ef95[_0x5f82('0x30')]);_0x2986fe[_0x5f82('0x33')]=_[_0x5f82('0x32')](_0x37ef95['model'],qs[_0x5f82('0x34')](_0x1491a4[_0x5f82('0x30')][_0x5f82('0x34')]));_0x2986fe[_0x5f82('0x33')]=_0x2986fe[_0x5f82('0x33')][_0x5f82('0x43')]?_0x2986fe[_0x5f82('0x33')]:_0x37ef95[_0x5f82('0x2e')];if(_0x1491a4['query']['includeAll']){_0x2986fe['include']=[{'all':!![]}];}_0x2986fe=_[_0x5f82('0x3b')]({},_0x2986fe,_0x1491a4[_0x5f82('0x44')]);return db[_0x5f82('0x3c')][_0x5f82('0x45')](_0x2986fe)[_0x5f82('0x21')](handleEntityNotFound(_0x15dc05,null))[_0x5f82('0x21')](respondWithResult(_0x15dc05,null))[_0x5f82('0x40')](handleError(_0x15dc05,null));};exports[_0x5f82('0x46')]=function(_0x392e93,_0x304551){return db[_0x5f82('0x3c')][_0x5f82('0x46')](_0x392e93[_0x5f82('0x47')],{})[_0x5f82('0x21')](function(_0x579a48){var _0x1aca30=_0x392e93['user'][_0x5f82('0x23')]({'plain':!![]});if(!_0x1aca30)throw new Error(_0x5f82('0x48'));if(_0x1aca30[_0x5f82('0x49')]===_0x5f82('0x4a')){var _0x310f2c=_0x579a48[_0x5f82('0x23')]({'plain':!![]});var _0x39318f=_0x5f82('0x24');return db[_0x5f82('0x4b')]['find']({'where':{'name':_0x39318f,'userProfileId':_0x1aca30[_0x5f82('0x4c')]},'raw':!![]})['then'](function(_0x14cabe){if(_0x14cabe&&_0x14cabe[_0x5f82('0x4d')]===0x0){return db['UserProfileResource']['create']({'name':_0x310f2c['name'],'resourceId':_0x310f2c['id'],'type':_0x14cabe[_0x5f82('0x26')],'sectionId':_0x14cabe['id']},{})['then'](function(){return _0x579a48;});}else{return _0x579a48;}})[_0x5f82('0x40')](function(_0x3ed65e){logger[_0x5f82('0x25')](_0x5f82('0x4e'),_0x3ed65e);throw _0x3ed65e;});}return _0x579a48;})[_0x5f82('0x21')](respondWithResult(_0x304551,0xc9))[_0x5f82('0x40')](handleError(_0x304551,null));};exports[_0x5f82('0x20')]=function(_0x2b0b21,_0x30ab69){if(_0x2b0b21[_0x5f82('0x47')]['id']){delete _0x2b0b21['body']['id'];}return db[_0x5f82('0x3c')][_0x5f82('0x45')]({'where':{'id':_0x2b0b21[_0x5f82('0x42')]['id']}})[_0x5f82('0x21')](handleEntityNotFound(_0x30ab69,null))['then'](saveUpdates(_0x2b0b21[_0x5f82('0x47')],null))[_0x5f82('0x21')](respondWithResult(_0x30ab69,null))[_0x5f82('0x40')](handleError(_0x30ab69,null));};exports['destroy']=function(_0x4fcc78,_0x4c5b43){return db[_0x5f82('0x3c')][_0x5f82('0x45')]({'where':{'id':_0x4fcc78['params']['id']}})[_0x5f82('0x21')](handleEntityNotFound(_0x4c5b43,null))['then'](removeEntity(_0x4c5b43,null))[_0x5f82('0x40')](handleError(_0x4c5b43,null));};exports[_0x5f82('0x4f')]=function(_0x21f9a6,_0x20d2b7,_0x5144b4){return db[_0x5f82('0x3c')][_0x5f82('0x50')]({'where':{'id':_0x21f9a6['params']['id']}})[_0x5f82('0x21')](handleEntityNotFound(_0x20d2b7,null))['then'](function(_0x4d7f3c){var _0x59125a;var _0x2fa74b={},_0x2e53a6={};_0x2e53a6[_0x5f82('0x2e')]=_[_0x5f82('0x2f')](db[_0x5f82('0x51')][_0x5f82('0x2a')]);_0x2e53a6['query']=_[_0x5f82('0x2f')](_0x21f9a6[_0x5f82('0x30')]);_0x2e53a6[_0x5f82('0x31')]=_[_0x5f82('0x32')](_0x2e53a6[_0x5f82('0x2e')],_0x2e53a6[_0x5f82('0x30')]);_0x2fa74b[_0x5f82('0x33')]=_[_0x5f82('0x32')](_0x2e53a6[_0x5f82('0x2e')],qs['fields'](_0x21f9a6[_0x5f82('0x30')][_0x5f82('0x34')]));_0x2fa74b[_0x5f82('0x33')]=_0x2fa74b[_0x5f82('0x33')][_0x5f82('0x43')]?_0x2fa74b[_0x5f82('0x33')]:_0x2e53a6[_0x5f82('0x2e')];if(!_0x21f9a6[_0x5f82('0x30')][_0x5f82('0x35')]('nolimit')){_0x2fa74b[_0x5f82('0x1c')]=qs[_0x5f82('0x1c')](_0x21f9a6[_0x5f82('0x30')][_0x5f82('0x1c')]);_0x2fa74b[_0x5f82('0x1b')]=qs[_0x5f82('0x1b')](_0x21f9a6['query']['offset']);}_0x2fa74b['order']=qs[_0x5f82('0x37')](_0x21f9a6['query'][_0x5f82('0x37')]);_0x2fa74b['where']=qs[_0x5f82('0x31')](_[_0x5f82('0x52')](_0x21f9a6[_0x5f82('0x30')],_0x2e53a6[_0x5f82('0x31')]));if(_0x21f9a6['query']['filter']){_0x2fa74b[_0x5f82('0x38')]=_[_0x5f82('0x3b')](_0x2fa74b[_0x5f82('0x38')],{'$or':_[_0x5f82('0x29')](_0x2fa74b['attributes'],function(_0x4a6969){var _0x54176f={};_0x54176f[_0x4a6969]={'$like':'%'+_0x21f9a6[_0x5f82('0x30')][_0x5f82('0x39')]+'%'};return _0x54176f;})});}_0x2fa74b[_0x5f82('0x38')]=_['merge'](_0x2fa74b[_0x5f82('0x38')],{'mailboxuser':_0x4d7f3c['mailbox']});_0x2fa74b=_[_0x5f82('0x3b')]({},_0x2fa74b,_0x21f9a6[_0x5f82('0x44')]);return db[_0x5f82('0x51')][_0x5f82('0x53')](_0x2fa74b)['then'](respondWithFilteredResult(_0x20d2b7,_0x2fa74b));})[_0x5f82('0x40')](handleError(_0x20d2b7,null));}; \ No newline at end of file diff --git a/server/api/voiceMail/voiceMail.model.js b/server/api/voiceMail/voiceMail.model.js index e4cecf0..219f37e 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 _0xf23c=['../../config/environment','./voiceMail.attributes','exports','voice_voicemail','mailbox_context','mailbox','context','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf'];(function(_0x3defc4,_0x4d5ba6){var _0x1b681a=function(_0x17e4dc){while(--_0x17e4dc){_0x3defc4['push'](_0x3defc4['shift']());}};_0x1b681a(++_0x4d5ba6);}(_0xf23c,0x77));var _0xcf23=function(_0x3de4f8,_0x336c7d){_0x3de4f8=_0x3de4f8-0x0;var _0x3d81fc=_0xf23c[_0x3de4f8];return _0x3d81fc;};'use strict';var _=require(_0xcf23('0x0'));var util=require(_0xcf23('0x1'));var logger=require(_0xcf23('0x2'))(_0xcf23('0x3'));var moment=require(_0xcf23('0x4'));var BPromise=require(_0xcf23('0x5'));var rp=require(_0xcf23('0x6'));var fs=require('fs');var path=require(_0xcf23('0x7'));var rimraf=require(_0xcf23('0x8'));var config=require(_0xcf23('0x9'));var attributes=require(_0xcf23('0xa'));module[_0xcf23('0xb')]=function(_0x29d89c,_0x208604){return _0x29d89c['define']('VoiceMail',attributes,{'tableName':_0xcf23('0xc'),'paranoid':![],'indexes':[{'name':_0xcf23('0xd'),'fields':[_0xcf23('0xe'),_0xcf23('0xf')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xbdc4=['context','util','../../config/logger','api','moment','rimraf','../../config/environment','./voiceMail.attributes','exports','define','voice_voicemail','mailbox_context','mailbox'];(function(_0x57b54c,_0x54ce0d){var _0x59cc19=function(_0xa33bc6){while(--_0xa33bc6){_0x57b54c['push'](_0x57b54c['shift']());}};_0x59cc19(++_0x54ce0d);}(_0xbdc4,0xaa));var _0x4bdc=function(_0x1e7b16,_0x4607a1){_0x1e7b16=_0x1e7b16-0x0;var _0x37fadc=_0xbdc4[_0x1e7b16];return _0x37fadc;};'use strict';var _=require('lodash');var util=require(_0x4bdc('0x0'));var logger=require(_0x4bdc('0x1'))(_0x4bdc('0x2'));var moment=require(_0x4bdc('0x3'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x4bdc('0x4'));var config=require(_0x4bdc('0x5'));var attributes=require(_0x4bdc('0x6'));module[_0x4bdc('0x7')]=function(_0x117731,_0x3a3322){return _0x117731[_0x4bdc('0x8')]('VoiceMail',attributes,{'tableName':_0x4bdc('0x9'),'paranoid':![],'indexes':[{'name':_0x4bdc('0xa'),'fields':[_0x4bdc('0xb'),_0x4bdc('0xc')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceMail/voiceMail.rpc.js b/server/api/voiceMail/voiceMail.rpc.js index 80536f3..2d8be37 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 _0xca6b=['then','info','request\x20sent','debug','VoiceMail,\x20%s,\x20%s,\x20%s','error','code','VoiceMail,\x20%s,\x20%s','message','result','catch','util','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','request'];(function(_0x2dd77b,_0x4690fc){var _0x135961=function(_0xe1d37c){while(--_0xe1d37c){_0x2dd77b['push'](_0x2dd77b['shift']());}};_0x135961(++_0x4690fc);}(_0xca6b,0x15b));var _0xbca6=function(_0x2bf141,_0x31eac7){_0x2bf141=_0x2bf141-0x0;var _0x48277b=_0xca6b[_0x2bf141];return _0x48277b;};'use strict';var _=require('lodash');var util=require(_0xbca6('0x0'));var moment=require('moment');var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xbca6('0x1'));var db=require(_0xbca6('0x2'))['db'];var utils=require(_0xbca6('0x3'));var logger=require(_0xbca6('0x4'))(_0xbca6('0x5'));var config=require(_0xbca6('0x6'));var jayson=require('jayson/promise');var client=jayson[_0xbca6('0x7')][_0xbca6('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x43e4d9,_0x4d44d0,_0x351c4c){return new BPromise(function(_0x2ffa06,_0x5b8396){return client[_0xbca6('0x9')](_0x43e4d9,_0x351c4c)[_0xbca6('0xa')](function(_0x20ab78){logger[_0xbca6('0xb')]('VoiceMail,\x20%s,\x20%s',_0x4d44d0,_0xbca6('0xc'));logger[_0xbca6('0xd')](_0xbca6('0xe'),_0x4d44d0,_0xbca6('0xc'),JSON['stringify'](_0x20ab78));if(_0x20ab78['error']){if(_0x20ab78[_0xbca6('0xf')][_0xbca6('0x10')]===0x1f4){logger[_0xbca6('0xf')](_0xbca6('0x11'),_0x4d44d0,_0x20ab78[_0xbca6('0xf')][_0xbca6('0x12')]);return _0x5b8396(_0x20ab78[_0xbca6('0xf')]['message']);}logger[_0xbca6('0xf')](_0xbca6('0x11'),_0x4d44d0,_0x20ab78[_0xbca6('0xf')][_0xbca6('0x12')]);return _0x2ffa06(_0x20ab78[_0xbca6('0xf')]['message']);}else{logger[_0xbca6('0xb')]('VoiceMail,\x20%s,\x20%s',_0x4d44d0,'request\x20sent');_0x2ffa06(_0x20ab78[_0xbca6('0x13')][_0xbca6('0x12')]);}})[_0xbca6('0x14')](function(_0x8fd222){logger[_0xbca6('0xf')](_0xbca6('0x11'),_0x4d44d0,_0x8fd222);_0x5b8396(_0x8fd222);});});} \ No newline at end of file +var _0x8f91=['ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','info','request\x20sent','debug','VoiceMail,\x20%s,\x20%s,\x20%s','stringify','error','code','message','VoiceMail,\x20%s,\x20%s','result','util','moment','bluebird','randomstring'];(function(_0x4ef7ee,_0x16e755){var _0x5e2a5d=function(_0x1757b8){while(--_0x1757b8){_0x4ef7ee['push'](_0x4ef7ee['shift']());}};_0x5e2a5d(++_0x16e755);}(_0x8f91,0x172));var _0x18f9=function(_0x133668,_0x3c1585){_0x133668=_0x133668-0x0;var _0x140884=_0x8f91[_0x133668];return _0x140884;};'use strict';var _=require('lodash');var util=require(_0x18f9('0x0'));var moment=require(_0x18f9('0x1'));var BPromise=require(_0x18f9('0x2'));var rs=require(_0x18f9('0x3'));var fs=require('fs');var Redis=require(_0x18f9('0x4'));var db=require(_0x18f9('0x5'))['db'];var utils=require(_0x18f9('0x6'));var logger=require(_0x18f9('0x7'))(_0x18f9('0x8'));var config=require(_0x18f9('0x9'));var jayson=require('jayson/promise');var client=jayson[_0x18f9('0xa')][_0x18f9('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x3ff6d9,_0x1c0d03,_0x4bf4e9){return new BPromise(function(_0x191809,_0x2dc739){return client['request'](_0x3ff6d9,_0x4bf4e9)['then'](function(_0x2f379e){logger[_0x18f9('0xc')]('VoiceMail,\x20%s,\x20%s',_0x1c0d03,_0x18f9('0xd'));logger[_0x18f9('0xe')](_0x18f9('0xf'),_0x1c0d03,_0x18f9('0xd'),JSON[_0x18f9('0x10')](_0x2f379e));if(_0x2f379e[_0x18f9('0x11')]){if(_0x2f379e[_0x18f9('0x11')][_0x18f9('0x12')]===0x1f4){logger[_0x18f9('0x11')]('VoiceMail,\x20%s,\x20%s',_0x1c0d03,_0x2f379e[_0x18f9('0x11')][_0x18f9('0x13')]);return _0x2dc739(_0x2f379e[_0x18f9('0x11')][_0x18f9('0x13')]);}logger['error'](_0x18f9('0x14'),_0x1c0d03,_0x2f379e[_0x18f9('0x11')][_0x18f9('0x13')]);return _0x191809(_0x2f379e[_0x18f9('0x11')][_0x18f9('0x13')]);}else{logger[_0x18f9('0xc')]('VoiceMail,\x20%s,\x20%s',_0x1c0d03,'request\x20sent');_0x191809(_0x2f379e[_0x18f9('0x15')][_0x18f9('0x13')]);}})['catch'](function(_0xf84b1){logger[_0x18f9('0x11')](_0x18f9('0x14'),_0x1c0d03,_0xf84b1);_0x2dc739(_0xf84b1);});});} \ No newline at end of file diff --git a/server/api/voiceMailMessage/index.js b/server/api/voiceMailMessage/index.js index d7bfcd3..d106fa2 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 _0x7217=['./voiceMailMessage.controller','get','isAuthenticated','index','/:id','show','/:id/download','download','post','create','update','delete','destroy','exports','multer','path','connect-timeout','express','Router','../../components/auth/service'];(function(_0x27d456,_0x38816e){var _0x133e68=function(_0x12d083){while(--_0x12d083){_0x27d456['push'](_0x27d456['shift']());}};_0x133e68(++_0x38816e);}(_0x7217,0x19e));var _0x7721=function(_0x5783f4,_0x4a9e0a){_0x5783f4=_0x5783f4-0x0;var _0x28e380=_0x7217[_0x5783f4];return _0x28e380;};'use strict';var multer=require(_0x7721('0x0'));var util=require('util');var path=require(_0x7721('0x1'));var timeout=require(_0x7721('0x2'));var express=require(_0x7721('0x3'));var router=express[_0x7721('0x4')]();var auth=require(_0x7721('0x5'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x7721('0x6'));router[_0x7721('0x7')]('/',auth[_0x7721('0x8')](),controller[_0x7721('0x9')]);router[_0x7721('0x7')](_0x7721('0xa'),auth[_0x7721('0x8')](),controller[_0x7721('0xb')]);router[_0x7721('0x7')](_0x7721('0xc'),auth[_0x7721('0x8')](),controller[_0x7721('0xd')]);router[_0x7721('0xe')]('/',auth[_0x7721('0x8')](),controller[_0x7721('0xf')]);router['put'](_0x7721('0xa'),auth[_0x7721('0x8')](),controller[_0x7721('0x10')]);router[_0x7721('0x11')](_0x7721('0xa'),auth[_0x7721('0x8')](),controller[_0x7721('0x12')]);module[_0x7721('0x13')]=router; \ No newline at end of file +var _0xdbf5=['util','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceMailMessage.controller','get','isAuthenticated','index','/:id','show','/:id/download','download','post','create','delete','destroy'];(function(_0x4d821c,_0x45dca8){var _0x1462da=function(_0x2a4b89){while(--_0x2a4b89){_0x4d821c['push'](_0x4d821c['shift']());}};_0x1462da(++_0x45dca8);}(_0xdbf5,0x18c));var _0x5dbf=function(_0x30b079,_0x3d6d7e){_0x30b079=_0x30b079-0x0;var _0x11ecba=_0xdbf5[_0x30b079];return _0x11ecba;};'use strict';var multer=require('multer');var util=require(_0x5dbf('0x0'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0x5dbf('0x1'));var router=express[_0x5dbf('0x2')]();var auth=require(_0x5dbf('0x3'));var interaction=require(_0x5dbf('0x4'));var config=require(_0x5dbf('0x5'));var controller=require(_0x5dbf('0x6'));router[_0x5dbf('0x7')]('/',auth[_0x5dbf('0x8')](),controller[_0x5dbf('0x9')]);router[_0x5dbf('0x7')](_0x5dbf('0xa'),auth[_0x5dbf('0x8')](),controller[_0x5dbf('0xb')]);router['get'](_0x5dbf('0xc'),auth['isAuthenticated'](),controller[_0x5dbf('0xd')]);router[_0x5dbf('0xe')]('/',auth[_0x5dbf('0x8')](),controller[_0x5dbf('0xf')]);router['put'](_0x5dbf('0xa'),auth['isAuthenticated'](),controller['update']);router[_0x5dbf('0x10')]('/:id',auth['isAuthenticated'](),controller[_0x5dbf('0x11')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/voiceMailMessage/voiceMailMessage.attributes.js b/server/api/voiceMailMessage/voiceMailMessage.attributes.js index 12b2e6f..79b92ed 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 _0x688f=['sequelize','exports','VIRTUAL','getDataValue','INTEGER','STRING','BLOB','long','TIMESTAMP'];(function(_0x17d9e3,_0x1f969c){var _0x14192d=function(_0x159745){while(--_0x159745){_0x17d9e3['push'](_0x17d9e3['shift']());}};_0x14192d(++_0x1f969c);}(_0x688f,0x10e));var _0xf688=function(_0x16b9ed,_0x56517a){_0x16b9ed=_0x16b9ed-0x0;var _0x66b1f8=_0x688f[_0x16b9ed];return _0x66b1f8;};'use strict';var Sequelize=require(_0xf688('0x0'));module[_0xf688('0x1')]={'name':{'type':Sequelize[_0xf688('0x2')],'get':function(_0x2147da){return this[_0xf688('0x3')]('id');}},'msgnum':{'type':Sequelize[_0xf688('0x4')](0xb),'defaultValue':0x0,'allowNull':![]},'dir':{'type':Sequelize[_0xf688('0x5')],'defaultValue':''},'context':{'type':Sequelize[_0xf688('0x5')],'defaultValue':''},'macrocontext':{'type':Sequelize['STRING'],'defaultValue':''},'callerid':{'type':Sequelize['STRING'],'defaultValue':''},'origtime':{'type':Sequelize[_0xf688('0x5')],'defaultValue':''},'duration':{'type':Sequelize[_0xf688('0x5')],'defaultValue':''},'mailboxuser':{'type':Sequelize[_0xf688('0x5')],'defaultValue':''},'mailboxcontext':{'type':Sequelize[_0xf688('0x5')],'defaultValue':''},'recording':{'type':Sequelize[_0xf688('0x6')](_0xf688('0x7')),'defaultValue':null},'flag':{'type':Sequelize['STRING'],'defaultValue':''},'msg_id':{'type':Sequelize['STRING'],'defaultValue':''},'stamp':{'type':_0xf688('0x8'),'allowNull':![]}}; \ No newline at end of file +var _0x9a41=['TIMESTAMP','sequelize','exports','getDataValue','STRING'];(function(_0x21418b,_0x417f76){var _0x11283f=function(_0x3014ae){while(--_0x3014ae){_0x21418b['push'](_0x21418b['shift']());}};_0x11283f(++_0x417f76);}(_0x9a41,0xab));var _0x19a4=function(_0x5bd249,_0x2b2cda){_0x5bd249=_0x5bd249-0x0;var _0x1da6e0=_0x9a41[_0x5bd249];return _0x1da6e0;};'use strict';var Sequelize=require(_0x19a4('0x0'));module[_0x19a4('0x1')]={'name':{'type':Sequelize['VIRTUAL'],'get':function(_0x116403){return this[_0x19a4('0x2')]('id');}},'msgnum':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x0,'allowNull':![]},'dir':{'type':Sequelize[_0x19a4('0x3')],'defaultValue':''},'context':{'type':Sequelize[_0x19a4('0x3')],'defaultValue':''},'macrocontext':{'type':Sequelize[_0x19a4('0x3')],'defaultValue':''},'callerid':{'type':Sequelize[_0x19a4('0x3')],'defaultValue':''},'origtime':{'type':Sequelize[_0x19a4('0x3')],'defaultValue':''},'duration':{'type':Sequelize[_0x19a4('0x3')],'defaultValue':''},'mailboxuser':{'type':Sequelize[_0x19a4('0x3')],'defaultValue':''},'mailboxcontext':{'type':Sequelize[_0x19a4('0x3')],'defaultValue':''},'recording':{'type':Sequelize['BLOB']('long'),'defaultValue':null},'flag':{'type':Sequelize['STRING'],'defaultValue':''},'msg_id':{'type':Sequelize[_0x19a4('0x3')],'defaultValue':''},'stamp':{'type':_0x19a4('0x4'),'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/voiceMailMessage/voiceMailMessage.controller.js b/server/api/voiceMailMessage/voiceMailMessage.controller.js index 86af47c..9a0e01a 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 _0x29d4=['path','sox','to-csv','ejs','lodash','squel','jsforce','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/environment','../../mysqldb','sendStatus','status','end','json','offset','limit','Content-Range','apply','reject','save','update','then','destroy','error','name','send','index','map','VoiceMailMessage','rawAttributes','type','key','differenceBy','query','filters','intersection','model','attributes','fields','hasOwnProperty','sort','where','pick','filter','merge','VIRTUAL','options','count','includeAll','findAll','rows','show','params','keys','length','create','catch','body','find','download','recording','Sequelize','ValidationError','VoiceMailMessage\x20not\x20found','audio/wav','attachment','Content-Disposition','attachment;\x20filename=\x22','msg_id','.wav\x22','set','html-pdf','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util'];(function(_0x2b76de,_0x4665ed){var _0x43986a=function(_0x12d2b8){while(--_0x12d2b8){_0x2b76de['push'](_0x2b76de['shift']());}};_0x43986a(++_0x4665ed);}(_0x29d4,0x1a1));var _0x429d=function(_0x4e1d03,_0x786f3a){_0x4e1d03=_0x4e1d03-0x0;var _0x362d4b=_0x29d4[_0x4e1d03];return _0x362d4b;};'use strict';var pdf=require(_0x429d('0x0'));var emlformat=require('eml-format');var rimraf=require(_0x429d('0x1'));var zipdir=require(_0x429d('0x2'));var jsonpatch=require(_0x429d('0x3'));var rp=require(_0x429d('0x4'));var moment=require(_0x429d('0x5'));var BPromise=require('bluebird');var Mustache=require(_0x429d('0x6'));var util=require(_0x429d('0x7'));var path=require(_0x429d('0x8'));var sox=require(_0x429d('0x9'));var csv=require(_0x429d('0xa'));var ejs=require(_0x429d('0xb'));var fs=require('fs');var _=require(_0x429d('0xc'));var squel=require(_0x429d('0xd'));var crypto=require('crypto');var jsforce=require(_0x429d('0xe'));var deskjs=require('desk.js');var toCsv=require(_0x429d('0xa'));var querystring=require(_0x429d('0xf'));var Papa=require(_0x429d('0x10'));var Redis=require('ioredis');var authService=require(_0x429d('0x11'));var qs=require(_0x429d('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x429d('0x13'));var logger=require(_0x429d('0x14'))(_0x429d('0x15'));var utils=require('../../config/utils');var config=require(_0x429d('0x16'));var db=require(_0x429d('0x17'))['db'];function respondWithStatusCode(_0x1d933b,_0x1cb1cf){_0x1cb1cf=_0x1cb1cf||0xcc;return function(_0x4843af){if(_0x4843af){return _0x1d933b[_0x429d('0x18')](_0x1cb1cf);}return _0x1d933b[_0x429d('0x19')](_0x1cb1cf)[_0x429d('0x1a')]();};}function respondWithResult(_0x56bf5d,_0x315d8d){_0x315d8d=_0x315d8d||0xc8;return function(_0x5dc247){if(_0x5dc247){return _0x56bf5d['status'](_0x315d8d)[_0x429d('0x1b')](_0x5dc247);}};}function respondWithFilteredResult(_0x2b9411,_0x1bfbdb){return function(_0x2ee97b){if(_0x2ee97b){var _0x8c8a15=_0x2ee97b['count'],_0x2363a0=_0x1bfbdb[_0x429d('0x1c')],_0x4ddb35=_0x1bfbdb[_0x429d('0x1c')]+_0x1bfbdb[_0x429d('0x1d')],_0xbfe8a0;if(_0x4ddb35>=_0x8c8a15){_0x4ddb35=_0x8c8a15;_0xbfe8a0=0xc8;}else{_0xbfe8a0=0xce;}_0x2b9411[_0x429d('0x19')](_0xbfe8a0);return _0x2b9411['set'](_0x429d('0x1e'),_0x2363a0+'-'+_0x4ddb35+'/'+_0x8c8a15)[_0x429d('0x1b')](_0x2ee97b);}return null;};}function patchUpdates(_0x2b9e78){return function(_0x513854){try{jsonpatch[_0x429d('0x1f')](_0x513854,_0x2b9e78,!![]);}catch(_0x36916d){return BPromise[_0x429d('0x20')](_0x36916d);}return _0x513854[_0x429d('0x21')]();};}function saveUpdates(_0xd033f8,_0x4534bd){return function(_0x5a4093){if(_0x5a4093){return _0x5a4093[_0x429d('0x22')](_0xd033f8)[_0x429d('0x23')](function(_0x2d9072){return _0x2d9072;});}return null;};}function removeEntity(_0x4839bc,_0x1492f1){return function(_0x13fc71){if(_0x13fc71){return _0x13fc71[_0x429d('0x24')]()[_0x429d('0x23')](function(){_0x4839bc[_0x429d('0x19')](0xcc)[_0x429d('0x1a')]();});}};}function handleEntityNotFound(_0x4c6d89,_0x28f84e){return function(_0x3a9a75){if(!_0x3a9a75){_0x4c6d89['sendStatus'](0x194);}return _0x3a9a75;};}function handleError(_0x1a2c1c,_0x37fbf9){_0x37fbf9=_0x37fbf9||0x1f4;return function(_0x1ed030){logger[_0x429d('0x25')](_0x1ed030['stack']);if(_0x1ed030[_0x429d('0x26')]){delete _0x1ed030[_0x429d('0x26')];}_0x1a2c1c[_0x429d('0x19')](_0x37fbf9)[_0x429d('0x27')](_0x1ed030);};}exports[_0x429d('0x28')]=function(_0x514f1b,_0x33e4a4){var _0x2209aa={},_0x258557={},_0x1cba36={'count':0x0,'rows':[]};var _0x151615=_[_0x429d('0x29')](db[_0x429d('0x2a')][_0x429d('0x2b')],function(_0x2ceb54){return{'name':_0x2ceb54['fieldName'],'type':_0x2ceb54[_0x429d('0x2c')][_0x429d('0x2d')]};});_0x258557['model']=_[_0x429d('0x2e')](_[_0x429d('0x29')](_0x151615,_0x429d('0x26')),[_0x429d('0x26')]);_0x258557[_0x429d('0x2f')]=_['keys'](_0x514f1b[_0x429d('0x2f')]);_0x258557[_0x429d('0x30')]=_[_0x429d('0x31')](_0x258557[_0x429d('0x32')],_0x258557[_0x429d('0x2f')]);_0x2209aa[_0x429d('0x33')]=_['intersection'](_0x258557['model'],qs[_0x429d('0x34')](_0x514f1b[_0x429d('0x2f')]['fields']));_0x2209aa['attributes']=_0x2209aa[_0x429d('0x33')]['length']?_0x2209aa[_0x429d('0x33')]:_0x258557[_0x429d('0x32')];if(!_0x514f1b[_0x429d('0x2f')][_0x429d('0x35')]('nolimit')){_0x2209aa[_0x429d('0x1d')]=qs[_0x429d('0x1d')](_0x514f1b['query']['limit']);_0x2209aa['offset']=qs['offset'](_0x514f1b['query'][_0x429d('0x1c')]);}_0x2209aa['order']=qs['sort'](_0x514f1b[_0x429d('0x2f')][_0x429d('0x36')]);_0x2209aa[_0x429d('0x37')]=qs[_0x429d('0x30')](_[_0x429d('0x38')](_0x514f1b[_0x429d('0x2f')],_0x258557['filters']));if(_0x514f1b[_0x429d('0x2f')][_0x429d('0x39')]){_0x2209aa[_0x429d('0x37')]=_[_0x429d('0x3a')](_0x2209aa[_0x429d('0x37')],{'$or':_[_0x429d('0x29')](_0x151615,function(_0x220b42){if(_0x220b42[_0x429d('0x2c')]!==_0x429d('0x3b')){var _0x439a6d={};_0x439a6d[_0x220b42[_0x429d('0x26')]]={'$like':'%'+_0x514f1b[_0x429d('0x2f')][_0x429d('0x39')]+'%'};return _0x439a6d;}})});}_0x2209aa=_[_0x429d('0x3a')]({},_0x2209aa,_0x514f1b[_0x429d('0x3c')]);var _0x19da82={'where':_0x2209aa['where']};return db['VoiceMailMessage'][_0x429d('0x3d')](_0x19da82)[_0x429d('0x23')](function(_0x569811){_0x1cba36[_0x429d('0x3d')]=_0x569811;if(_0x514f1b[_0x429d('0x2f')][_0x429d('0x3e')]){_0x2209aa['include']=[{'all':!![]}];}return db['VoiceMailMessage'][_0x429d('0x3f')](_0x2209aa);})[_0x429d('0x23')](function(_0x4c960e){_0x1cba36[_0x429d('0x40')]=_0x4c960e;return _0x1cba36;})[_0x429d('0x23')](respondWithFilteredResult(_0x33e4a4,_0x2209aa))['catch'](handleError(_0x33e4a4,null));};exports[_0x429d('0x41')]=function(_0x5182d3,_0x1b9a19){var _0xdd3ff5={'raw':!![],'where':{'id':_0x5182d3[_0x429d('0x42')]['id']}},_0x2f2610={};_0x2f2610['model']=_[_0x429d('0x43')](db[_0x429d('0x2a')][_0x429d('0x2b')]);_0x2f2610['query']=_['keys'](_0x5182d3[_0x429d('0x2f')]);_0x2f2610[_0x429d('0x30')]=_[_0x429d('0x31')](_0x2f2610[_0x429d('0x32')],_0x2f2610['query']);_0xdd3ff5[_0x429d('0x33')]=_[_0x429d('0x31')](_0x2f2610[_0x429d('0x32')],qs[_0x429d('0x34')](_0x5182d3[_0x429d('0x2f')][_0x429d('0x34')]));_0xdd3ff5[_0x429d('0x33')]=_0xdd3ff5[_0x429d('0x33')][_0x429d('0x44')]?_0xdd3ff5[_0x429d('0x33')]:_0x2f2610['model'];if(_0x5182d3[_0x429d('0x2f')]['includeAll']){_0xdd3ff5['include']=[{'all':!![]}];}_0xdd3ff5=_['merge']({},_0xdd3ff5,_0x5182d3[_0x429d('0x3c')]);return db[_0x429d('0x2a')]['find'](_0xdd3ff5)[_0x429d('0x23')](handleEntityNotFound(_0x1b9a19,null))[_0x429d('0x23')](respondWithResult(_0x1b9a19,null))['catch'](handleError(_0x1b9a19,null));};exports[_0x429d('0x45')]=function(_0xc96391,_0xfd1ff7){return db[_0x429d('0x2a')][_0x429d('0x45')](_0xc96391['body'],{})[_0x429d('0x23')](respondWithResult(_0xfd1ff7,0xc9))[_0x429d('0x46')](handleError(_0xfd1ff7,null));};exports[_0x429d('0x22')]=function(_0x3dec0d,_0x588529){if(_0x3dec0d[_0x429d('0x47')]['id']){delete _0x3dec0d[_0x429d('0x47')]['id'];}return db[_0x429d('0x2a')]['find']({'where':{'id':_0x3dec0d[_0x429d('0x42')]['id']}})['then'](handleEntityNotFound(_0x588529,null))[_0x429d('0x23')](saveUpdates(_0x3dec0d[_0x429d('0x47')],null))[_0x429d('0x23')](respondWithResult(_0x588529,null))['catch'](handleError(_0x588529,null));};exports['destroy']=function(_0x260cf7,_0x514b1e){return db[_0x429d('0x2a')][_0x429d('0x48')]({'where':{'id':_0x260cf7[_0x429d('0x42')]['id']}})[_0x429d('0x23')](handleEntityNotFound(_0x514b1e,null))[_0x429d('0x23')](removeEntity(_0x514b1e,null))[_0x429d('0x46')](handleError(_0x514b1e,null));};exports[_0x429d('0x49')]=function(_0x2346d0,_0x5dba96,_0x5d20bc){return db[_0x429d('0x2a')][_0x429d('0x48')]({'where':{'id':_0x2346d0[_0x429d('0x42')]['id']},'attributes':['id',_0x429d('0x4a'),'msg_id']})[_0x429d('0x23')](handleEntityNotFound(_0x5dba96,null))[_0x429d('0x23')](function(_0x2caf41){if(_0x2caf41){if(!_0x2caf41[_0x429d('0x4a')]){throw new db[(_0x429d('0x4b'))][(_0x429d('0x4c'))](_0x429d('0x4d'));}var _0x210c16={'Content-Type':_0x429d('0x4e'),'Content-Disposition':_0x429d('0x4f')};if(_0x2caf41['msg_id']){_0x210c16[_0x429d('0x50')]=_0x429d('0x51')+_0x2caf41[_0x429d('0x52')]+_0x429d('0x53');}_0x5dba96[_0x429d('0x54')](_0x210c16);return _0x5dba96[_0x429d('0x27')](new Buffer(_0x2caf41[_0x429d('0x4a')]));}})['catch'](handleError(_0x5dba96,null));}; \ No newline at end of file +var _0x3baf=['sox','to-csv','ejs','lodash','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','offset','limit','Content-Range','apply','reject','update','then','error','stack','send','VoiceMailMessage','rawAttributes','fieldName','type','map','name','query','filters','intersection','model','attributes','fields','length','nolimit','sort','pick','filter','where','VIRTUAL','options','count','includeAll','include','findAll','show','params','keys','merge','find','catch','create','body','destroy','download','msg_id','recording','Sequelize','ValidationError','VoiceMailMessage\x20not\x20found','audio/wav','attachment','Content-Disposition','.wav\x22','set','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path'];(function(_0xef5f0f,_0x35b798){var _0xd3b8d=function(_0x18abe4){while(--_0x18abe4){_0xef5f0f['push'](_0xef5f0f['shift']());}};_0xd3b8d(++_0x35b798);}(_0x3baf,0xf7));var _0xf3ba=function(_0x41ed0a,_0x44b88a){_0x41ed0a=_0x41ed0a-0x0;var _0x323939=_0x3baf[_0x41ed0a];return _0x323939;};'use strict';var pdf=require(_0xf3ba('0x0'));var emlformat=require(_0xf3ba('0x1'));var rimraf=require(_0xf3ba('0x2'));var zipdir=require(_0xf3ba('0x3'));var jsonpatch=require(_0xf3ba('0x4'));var rp=require(_0xf3ba('0x5'));var moment=require(_0xf3ba('0x6'));var BPromise=require(_0xf3ba('0x7'));var Mustache=require(_0xf3ba('0x8'));var util=require(_0xf3ba('0x9'));var path=require(_0xf3ba('0xa'));var sox=require(_0xf3ba('0xb'));var csv=require(_0xf3ba('0xc'));var ejs=require(_0xf3ba('0xd'));var fs=require('fs');var _=require(_0xf3ba('0xe'));var squel=require('squel');var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0xf3ba('0xf'));var toCsv=require('to-csv');var querystring=require(_0xf3ba('0x10'));var Papa=require(_0xf3ba('0x11'));var Redis=require(_0xf3ba('0x12'));var authService=require(_0xf3ba('0x13'));var qs=require(_0xf3ba('0x14'));var as=require(_0xf3ba('0x15'));var hardwareService=require(_0xf3ba('0x16'));var logger=require(_0xf3ba('0x17'))(_0xf3ba('0x18'));var utils=require(_0xf3ba('0x19'));var config=require(_0xf3ba('0x1a'));var db=require(_0xf3ba('0x1b'))['db'];function respondWithStatusCode(_0x46c2cf,_0x85939e){_0x85939e=_0x85939e||0xcc;return function(_0x26cefe){if(_0x26cefe){return _0x46c2cf[_0xf3ba('0x1c')](_0x85939e);}return _0x46c2cf[_0xf3ba('0x1d')](_0x85939e)[_0xf3ba('0x1e')]();};}function respondWithResult(_0x505b8d,_0x327675){_0x327675=_0x327675||0xc8;return function(_0x56816b){if(_0x56816b){return _0x505b8d[_0xf3ba('0x1d')](_0x327675)[_0xf3ba('0x1f')](_0x56816b);}};}function respondWithFilteredResult(_0x4717be,_0x1e2969){return function(_0x235c8a){if(_0x235c8a){var _0x53f848=_0x235c8a['count'],_0x301856=_0x1e2969[_0xf3ba('0x20')],_0x29e45b=_0x1e2969[_0xf3ba('0x20')]+_0x1e2969[_0xf3ba('0x21')],_0x13d899;if(_0x29e45b>=_0x53f848){_0x29e45b=_0x53f848;_0x13d899=0xc8;}else{_0x13d899=0xce;}_0x4717be[_0xf3ba('0x1d')](_0x13d899);return _0x4717be['set'](_0xf3ba('0x22'),_0x301856+'-'+_0x29e45b+'/'+_0x53f848)[_0xf3ba('0x1f')](_0x235c8a);}return null;};}function patchUpdates(_0x4e601c){return function(_0x479d65){try{jsonpatch[_0xf3ba('0x23')](_0x479d65,_0x4e601c,!![]);}catch(_0x2bd5b8){return BPromise[_0xf3ba('0x24')](_0x2bd5b8);}return _0x479d65['save']();};}function saveUpdates(_0x375bcf,_0x327723){return function(_0x35d6d4){if(_0x35d6d4){return _0x35d6d4[_0xf3ba('0x25')](_0x375bcf)[_0xf3ba('0x26')](function(_0x3480cb){return _0x3480cb;});}return null;};}function removeEntity(_0x168961,_0x4caf74){return function(_0x4e94a7){if(_0x4e94a7){return _0x4e94a7['destroy']()[_0xf3ba('0x26')](function(){_0x168961[_0xf3ba('0x1d')](0xcc)[_0xf3ba('0x1e')]();});}};}function handleEntityNotFound(_0x3b6404,_0x2cc01a){return function(_0x545ee1){if(!_0x545ee1){_0x3b6404['sendStatus'](0x194);}return _0x545ee1;};}function handleError(_0x37fdda,_0xd6c2da){_0xd6c2da=_0xd6c2da||0x1f4;return function(_0x5410a2){logger[_0xf3ba('0x27')](_0x5410a2[_0xf3ba('0x28')]);if(_0x5410a2['name']){delete _0x5410a2['name'];}_0x37fdda[_0xf3ba('0x1d')](_0xd6c2da)[_0xf3ba('0x29')](_0x5410a2);};}exports['index']=function(_0x18a4fb,_0x318817){var _0x15ac44={},_0x5a880e={},_0x29ed57={'count':0x0,'rows':[]};var _0x4e1708=_['map'](db[_0xf3ba('0x2a')][_0xf3ba('0x2b')],function(_0x5b4e0d){return{'name':_0x5b4e0d[_0xf3ba('0x2c')],'type':_0x5b4e0d[_0xf3ba('0x2d')]['key']};});_0x5a880e['model']=_['differenceBy'](_[_0xf3ba('0x2e')](_0x4e1708,_0xf3ba('0x2f')),['name']);_0x5a880e[_0xf3ba('0x30')]=_['keys'](_0x18a4fb['query']);_0x5a880e[_0xf3ba('0x31')]=_[_0xf3ba('0x32')](_0x5a880e[_0xf3ba('0x33')],_0x5a880e[_0xf3ba('0x30')]);_0x15ac44[_0xf3ba('0x34')]=_[_0xf3ba('0x32')](_0x5a880e['model'],qs[_0xf3ba('0x35')](_0x18a4fb['query'][_0xf3ba('0x35')]));_0x15ac44[_0xf3ba('0x34')]=_0x15ac44['attributes'][_0xf3ba('0x36')]?_0x15ac44[_0xf3ba('0x34')]:_0x5a880e[_0xf3ba('0x33')];if(!_0x18a4fb[_0xf3ba('0x30')]['hasOwnProperty'](_0xf3ba('0x37'))){_0x15ac44['limit']=qs['limit'](_0x18a4fb['query'][_0xf3ba('0x21')]);_0x15ac44[_0xf3ba('0x20')]=qs[_0xf3ba('0x20')](_0x18a4fb[_0xf3ba('0x30')][_0xf3ba('0x20')]);}_0x15ac44['order']=qs[_0xf3ba('0x38')](_0x18a4fb['query'][_0xf3ba('0x38')]);_0x15ac44['where']=qs[_0xf3ba('0x31')](_[_0xf3ba('0x39')](_0x18a4fb[_0xf3ba('0x30')],_0x5a880e[_0xf3ba('0x31')]));if(_0x18a4fb['query'][_0xf3ba('0x3a')]){_0x15ac44[_0xf3ba('0x3b')]=_['merge'](_0x15ac44[_0xf3ba('0x3b')],{'$or':_[_0xf3ba('0x2e')](_0x4e1708,function(_0x3f60bf){if(_0x3f60bf[_0xf3ba('0x2d')]!==_0xf3ba('0x3c')){var _0x196ab2={};_0x196ab2[_0x3f60bf[_0xf3ba('0x2f')]]={'$like':'%'+_0x18a4fb['query'][_0xf3ba('0x3a')]+'%'};return _0x196ab2;}})});}_0x15ac44=_['merge']({},_0x15ac44,_0x18a4fb[_0xf3ba('0x3d')]);var _0x5a5ed3={'where':_0x15ac44[_0xf3ba('0x3b')]};return db[_0xf3ba('0x2a')][_0xf3ba('0x3e')](_0x5a5ed3)[_0xf3ba('0x26')](function(_0x2cbfca){_0x29ed57['count']=_0x2cbfca;if(_0x18a4fb['query'][_0xf3ba('0x3f')]){_0x15ac44[_0xf3ba('0x40')]=[{'all':!![]}];}return db[_0xf3ba('0x2a')][_0xf3ba('0x41')](_0x15ac44);})[_0xf3ba('0x26')](function(_0x3506cb){_0x29ed57['rows']=_0x3506cb;return _0x29ed57;})[_0xf3ba('0x26')](respondWithFilteredResult(_0x318817,_0x15ac44))['catch'](handleError(_0x318817,null));};exports[_0xf3ba('0x42')]=function(_0x239e2a,_0x2328d5){var _0xa7fd7f={'raw':!![],'where':{'id':_0x239e2a[_0xf3ba('0x43')]['id']}},_0x25f68e={};_0x25f68e[_0xf3ba('0x33')]=_[_0xf3ba('0x44')](db['VoiceMailMessage'][_0xf3ba('0x2b')]);_0x25f68e[_0xf3ba('0x30')]=_[_0xf3ba('0x44')](_0x239e2a[_0xf3ba('0x30')]);_0x25f68e[_0xf3ba('0x31')]=_[_0xf3ba('0x32')](_0x25f68e[_0xf3ba('0x33')],_0x25f68e['query']);_0xa7fd7f[_0xf3ba('0x34')]=_[_0xf3ba('0x32')](_0x25f68e['model'],qs[_0xf3ba('0x35')](_0x239e2a[_0xf3ba('0x30')][_0xf3ba('0x35')]));_0xa7fd7f[_0xf3ba('0x34')]=_0xa7fd7f[_0xf3ba('0x34')][_0xf3ba('0x36')]?_0xa7fd7f[_0xf3ba('0x34')]:_0x25f68e[_0xf3ba('0x33')];if(_0x239e2a[_0xf3ba('0x30')][_0xf3ba('0x3f')]){_0xa7fd7f[_0xf3ba('0x40')]=[{'all':!![]}];}_0xa7fd7f=_[_0xf3ba('0x45')]({},_0xa7fd7f,_0x239e2a[_0xf3ba('0x3d')]);return db[_0xf3ba('0x2a')][_0xf3ba('0x46')](_0xa7fd7f)[_0xf3ba('0x26')](handleEntityNotFound(_0x2328d5,null))[_0xf3ba('0x26')](respondWithResult(_0x2328d5,null))[_0xf3ba('0x47')](handleError(_0x2328d5,null));};exports['create']=function(_0x10d30d,_0x1a0df2){return db['VoiceMailMessage'][_0xf3ba('0x48')](_0x10d30d[_0xf3ba('0x49')],{})[_0xf3ba('0x26')](respondWithResult(_0x1a0df2,0xc9))[_0xf3ba('0x47')](handleError(_0x1a0df2,null));};exports['update']=function(_0x5d0e2a,_0x28ca9b){if(_0x5d0e2a[_0xf3ba('0x49')]['id']){delete _0x5d0e2a[_0xf3ba('0x49')]['id'];}return db[_0xf3ba('0x2a')]['find']({'where':{'id':_0x5d0e2a[_0xf3ba('0x43')]['id']}})[_0xf3ba('0x26')](handleEntityNotFound(_0x28ca9b,null))[_0xf3ba('0x26')](saveUpdates(_0x5d0e2a['body'],null))[_0xf3ba('0x26')](respondWithResult(_0x28ca9b,null))[_0xf3ba('0x47')](handleError(_0x28ca9b,null));};exports[_0xf3ba('0x4a')]=function(_0x3639d2,_0x18f913){return db[_0xf3ba('0x2a')][_0xf3ba('0x46')]({'where':{'id':_0x3639d2[_0xf3ba('0x43')]['id']}})[_0xf3ba('0x26')](handleEntityNotFound(_0x18f913,null))[_0xf3ba('0x26')](removeEntity(_0x18f913,null))['catch'](handleError(_0x18f913,null));};exports[_0xf3ba('0x4b')]=function(_0x40c70c,_0x41c4c6,_0x3bbf79){return db['VoiceMailMessage'][_0xf3ba('0x46')]({'where':{'id':_0x40c70c['params']['id']},'attributes':['id','recording',_0xf3ba('0x4c')]})[_0xf3ba('0x26')](handleEntityNotFound(_0x41c4c6,null))[_0xf3ba('0x26')](function(_0x1fc9e6){if(_0x1fc9e6){if(!_0x1fc9e6[_0xf3ba('0x4d')]){throw new db[(_0xf3ba('0x4e'))][(_0xf3ba('0x4f'))](_0xf3ba('0x50'));}var _0x557fbd={'Content-Type':_0xf3ba('0x51'),'Content-Disposition':_0xf3ba('0x52')};if(_0x1fc9e6[_0xf3ba('0x4c')]){_0x557fbd[_0xf3ba('0x53')]='attachment;\x20filename=\x22'+_0x1fc9e6['msg_id']+_0xf3ba('0x54');}_0x41c4c6[_0xf3ba('0x55')](_0x557fbd);return _0x41c4c6[_0xf3ba('0x29')](new Buffer(_0x1fc9e6[_0xf3ba('0x4d')]));}})[_0xf3ba('0x47')](handleError(_0x41c4c6,null));}; \ No newline at end of file diff --git a/server/api/voiceMailMessage/voiceMailMessage.model.js b/server/api/voiceMailMessage/voiceMailMessage.model.js index db57356..09ef3da 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 _0x1df5=['../../config/logger','moment','request-promise','path','rimraf','../../config/environment','./voiceMailMessage.attributes','exports','define','VoiceMailMessage','voice_voicemail_messages','dir','util'];(function(_0x2793c4,_0x265fc1){var _0x32223d=function(_0x347614){while(--_0x347614){_0x2793c4['push'](_0x2793c4['shift']());}};_0x32223d(++_0x265fc1);}(_0x1df5,0x12a));var _0x51df=function(_0x16f4c5,_0x3d9e14){_0x16f4c5=_0x16f4c5-0x0;var _0x19879c=_0x1df5[_0x16f4c5];return _0x19879c;};'use strict';var _=require('lodash');var util=require(_0x51df('0x0'));var logger=require(_0x51df('0x1'))('api');var moment=require(_0x51df('0x2'));var BPromise=require('bluebird');var rp=require(_0x51df('0x3'));var fs=require('fs');var path=require(_0x51df('0x4'));var rimraf=require(_0x51df('0x5'));var config=require(_0x51df('0x6'));var attributes=require(_0x51df('0x7'));module[_0x51df('0x8')]=function(_0x5a75bb,_0x5d43d9){return _0x5a75bb[_0x51df('0x9')](_0x51df('0xa'),attributes,{'tableName':_0x51df('0xb'),'paranoid':![],'indexes':[{'name':_0x51df('0xc'),'fields':[_0x51df('0xc')]}],'timestamps':![]});}; \ No newline at end of file +var _0x8c22=['request-promise','rimraf','./voiceMailMessage.attributes','exports','VoiceMailMessage','voice_voicemail_messages','dir','util','../../config/logger','api','moment','bluebird'];(function(_0x41186d,_0x1955eb){var _0x218844=function(_0x321ade){while(--_0x321ade){_0x41186d['push'](_0x41186d['shift']());}};_0x218844(++_0x1955eb);}(_0x8c22,0x10f));var _0x28c2=function(_0x589eb4,_0xaa2019){_0x589eb4=_0x589eb4-0x0;var _0xf50816=_0x8c22[_0x589eb4];return _0xf50816;};'use strict';var _=require('lodash');var util=require(_0x28c2('0x0'));var logger=require(_0x28c2('0x1'))(_0x28c2('0x2'));var moment=require(_0x28c2('0x3'));var BPromise=require(_0x28c2('0x4'));var rp=require(_0x28c2('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x28c2('0x6'));var config=require('../../config/environment');var attributes=require(_0x28c2('0x7'));module[_0x28c2('0x8')]=function(_0x20a553,_0x258525){return _0x20a553['define'](_0x28c2('0x9'),attributes,{'tableName':_0x28c2('0xa'),'paranoid':![],'indexes':[{'name':_0x28c2('0xb'),'fields':['dir']}],'timestamps':![]});}; \ No newline at end of file diff --git a/server/api/voiceMailMessage/voiceMailMessage.rpc.js b/server/api/voiceMailMessage/voiceMailMessage.rpc.js index 2cde900..ffea43c 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 _0x0b0e=['VoiceMailMessage,\x20%s,\x20%s,\x20%s','stringify','error','message','request\x20sent','result','catch','lodash','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','VoiceMailMessage,\x20%s,\x20%s','debug'];(function(_0x4709c0,_0x3396c7){var _0x13348b=function(_0x426235){while(--_0x426235){_0x4709c0['push'](_0x4709c0['shift']());}};_0x13348b(++_0x3396c7);}(_0x0b0e,0x187));var _0xe0b0=function(_0x599041,_0x40fbea){_0x599041=_0x599041-0x0;var _0x1c4969=_0x0b0e[_0x599041];return _0x1c4969;};'use strict';var _=require(_0xe0b0('0x0'));var util=require('util');var moment=require(_0xe0b0('0x1'));var BPromise=require('bluebird');var rs=require(_0xe0b0('0x2'));var fs=require('fs');var Redis=require(_0xe0b0('0x3'));var db=require(_0xe0b0('0x4'))['db'];var utils=require(_0xe0b0('0x5'));var logger=require(_0xe0b0('0x6'))(_0xe0b0('0x7'));var config=require(_0xe0b0('0x8'));var jayson=require(_0xe0b0('0x9'));var client=jayson[_0xe0b0('0xa')][_0xe0b0('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x219b1c,_0x5cf9cc,_0x50be7f){return new BPromise(function(_0x11effc,_0x435060){return client[_0xe0b0('0xc')](_0x219b1c,_0x50be7f)[_0xe0b0('0xd')](function(_0x4c24f9){logger[_0xe0b0('0xe')](_0xe0b0('0xf'),_0x5cf9cc,'request\x20sent');logger[_0xe0b0('0x10')](_0xe0b0('0x11'),_0x5cf9cc,'request\x20sent',JSON[_0xe0b0('0x12')](_0x4c24f9));if(_0x4c24f9[_0xe0b0('0x13')]){if(_0x4c24f9[_0xe0b0('0x13')]['code']===0x1f4){logger[_0xe0b0('0x13')](_0xe0b0('0xf'),_0x5cf9cc,_0x4c24f9[_0xe0b0('0x13')][_0xe0b0('0x14')]);return _0x435060(_0x4c24f9[_0xe0b0('0x13')]['message']);}logger[_0xe0b0('0x13')](_0xe0b0('0xf'),_0x5cf9cc,_0x4c24f9[_0xe0b0('0x13')][_0xe0b0('0x14')]);return _0x11effc(_0x4c24f9[_0xe0b0('0x13')]['message']);}else{logger[_0xe0b0('0xe')]('VoiceMailMessage,\x20%s,\x20%s',_0x5cf9cc,_0xe0b0('0x15'));_0x11effc(_0x4c24f9[_0xe0b0('0x16')]['message']);}})[_0xe0b0('0x17')](function(_0x4a4cc0){logger[_0xe0b0('0x13')](_0xe0b0('0xf'),_0x5cf9cc,_0x4a4cc0);_0x435060(_0x4a4cc0);});});} \ No newline at end of file +var _0x1967=['then','info','VoiceMailMessage,\x20%s,\x20%s','VoiceMailMessage,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','request'];(function(_0x5c2c7c,_0xa7d3b1){var _0xea7ffe=function(_0x471f17){while(--_0x471f17){_0x5c2c7c['push'](_0x5c2c7c['shift']());}};_0xea7ffe(++_0xa7d3b1);}(_0x1967,0x173));var _0x7196=function(_0x329e2a,_0x353a19){_0x329e2a=_0x329e2a-0x0;var _0x57f3a4=_0x1967[_0x329e2a];return _0x57f3a4;};'use strict';var _=require('lodash');var util=require(_0x7196('0x0'));var moment=require(_0x7196('0x1'));var BPromise=require(_0x7196('0x2'));var rs=require(_0x7196('0x3'));var fs=require('fs');var Redis=require(_0x7196('0x4'));var db=require(_0x7196('0x5'))['db'];var utils=require(_0x7196('0x6'));var logger=require(_0x7196('0x7'))(_0x7196('0x8'));var config=require(_0x7196('0x9'));var jayson=require('jayson/promise');var client=jayson[_0x7196('0xa')][_0x7196('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x194746,_0x40e0af,_0x266a6e){return new BPromise(function(_0xad78a,_0x510c72){return client[_0x7196('0xc')](_0x194746,_0x266a6e)[_0x7196('0xd')](function(_0x3f846e){logger[_0x7196('0xe')](_0x7196('0xf'),_0x40e0af,'request\x20sent');logger['debug'](_0x7196('0x10'),_0x40e0af,_0x7196('0x11'),JSON[_0x7196('0x12')](_0x3f846e));if(_0x3f846e[_0x7196('0x13')]){if(_0x3f846e[_0x7196('0x13')][_0x7196('0x14')]===0x1f4){logger[_0x7196('0x13')](_0x7196('0xf'),_0x40e0af,_0x3f846e[_0x7196('0x13')][_0x7196('0x15')]);return _0x510c72(_0x3f846e[_0x7196('0x13')]['message']);}logger[_0x7196('0x13')](_0x7196('0xf'),_0x40e0af,_0x3f846e[_0x7196('0x13')][_0x7196('0x15')]);return _0xad78a(_0x3f846e['error'][_0x7196('0x15')]);}else{logger['info'](_0x7196('0xf'),_0x40e0af,_0x7196('0x11'));_0xad78a(_0x3f846e[_0x7196('0x16')][_0x7196('0x15')]);}})[_0x7196('0x17')](function(_0x2e3e0e){logger[_0x7196('0x13')](_0x7196('0xf'),_0x40e0af,_0x2e3e0e);_0x510c72(_0x2e3e0e);});});} \ No newline at end of file diff --git a/server/api/voiceMusicOnHold/index.js b/server/api/voiceMusicOnHold/index.js index d84eb44..f9c7812 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 _0xd1cf=['/:id/sounds','getSounds','post','create','addSound','put','delete','/:id/sounds/:id2','removeSound','exports','multer','util','path','connect-timeout','express','../../config/environment','isAuthenticated','index','get','/:id','show'];(function(_0x2ede49,_0x1b56bd){var _0x2b239e=function(_0x8fa171){while(--_0x8fa171){_0x2ede49['push'](_0x2ede49['shift']());}};_0x2b239e(++_0x1b56bd);}(_0xd1cf,0x73));var _0xfd1c=function(_0x22868f,_0x450f48){_0x22868f=_0x22868f-0x0;var _0x97bc75=_0xd1cf[_0x22868f];return _0x97bc75;};'use strict';var multer=require(_0xfd1c('0x0'));var util=require(_0xfd1c('0x1'));var path=require(_0xfd1c('0x2'));var timeout=require(_0xfd1c('0x3'));var express=require(_0xfd1c('0x4'));var router=express['Router']();var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0xfd1c('0x5'));var controller=require('./voiceMusicOnHold.controller');router['get']('/',auth[_0xfd1c('0x6')](),controller[_0xfd1c('0x7')]);router[_0xfd1c('0x8')](_0xfd1c('0x9'),auth[_0xfd1c('0x6')](),controller[_0xfd1c('0xa')]);router[_0xfd1c('0x8')](_0xfd1c('0xb'),auth[_0xfd1c('0x6')](),controller[_0xfd1c('0xc')]);router[_0xfd1c('0xd')]('/',auth['isAuthenticated'](),controller[_0xfd1c('0xe')]);router[_0xfd1c('0xd')](_0xfd1c('0xb'),auth[_0xfd1c('0x6')](),controller[_0xfd1c('0xf')]);router[_0xfd1c('0x10')](_0xfd1c('0x9'),auth[_0xfd1c('0x6')](),controller['update']);router['delete'](_0xfd1c('0x9'),auth[_0xfd1c('0x6')](),controller['destroy']);router[_0xfd1c('0x11')](_0xfd1c('0x12'),auth[_0xfd1c('0x6')](),controller[_0xfd1c('0x13')]);module[_0xfd1c('0x14')]=router; \ No newline at end of file +var _0x95c3=['express','Router','../../config/environment','get','/:id','isAuthenticated','show','/:id/sounds','getSounds','post','create','update','delete','destroy','/:id/sounds/:id2','removeSound','exports','util','path','connect-timeout'];(function(_0x83af7f,_0x49c6fd){var _0x32d85c=function(_0xf0e8bc){while(--_0xf0e8bc){_0x83af7f['push'](_0x83af7f['shift']());}};_0x32d85c(++_0x49c6fd);}(_0x95c3,0xb1));var _0x395c=function(_0x1ac595,_0x5d2081){_0x1ac595=_0x1ac595-0x0;var _0x455fff=_0x95c3[_0x1ac595];return _0x455fff;};'use strict';var multer=require('multer');var util=require(_0x395c('0x0'));var path=require(_0x395c('0x1'));var timeout=require(_0x395c('0x2'));var express=require(_0x395c('0x3'));var router=express[_0x395c('0x4')]();var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x395c('0x5'));var controller=require('./voiceMusicOnHold.controller');router[_0x395c('0x6')]('/',auth['isAuthenticated'](),controller['index']);router[_0x395c('0x6')](_0x395c('0x7'),auth[_0x395c('0x8')](),controller[_0x395c('0x9')]);router[_0x395c('0x6')](_0x395c('0xa'),auth[_0x395c('0x8')](),controller[_0x395c('0xb')]);router[_0x395c('0xc')]('/',auth[_0x395c('0x8')](),controller[_0x395c('0xd')]);router[_0x395c('0xc')](_0x395c('0xa'),auth[_0x395c('0x8')](),controller['addSound']);router['put'](_0x395c('0x7'),auth[_0x395c('0x8')](),controller[_0x395c('0xe')]);router[_0x395c('0xf')]('/:id',auth[_0x395c('0x8')](),controller[_0x395c('0x10')]);router[_0x395c('0xf')](_0x395c('0x11'),auth[_0x395c('0x8')](),controller[_0x395c('0x12')]);module[_0x395c('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 7ef21fe..8ab3b81 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 _0x350d=['custom','files','mp3nb','quietmp3nb','quietmp3','mp3','BOOLEAN','sequelize','exports','STRING','name','ENUM'];(function(_0x5ae032,_0x2e4b62){var _0x584786=function(_0x3c534f){while(--_0x3c534f){_0x5ae032['push'](_0x5ae032['shift']());}};_0x584786(++_0x2e4b62);}(_0x350d,0x17b));var _0xd350=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x350d[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require(_0xd350('0x0'));module[_0xd350('0x1')]={'name':{'type':Sequelize[_0xd350('0x2')],'allowNull':![],'unique':_0xd350('0x3')},'mode':{'type':Sequelize[_0xd350('0x4')](_0xd350('0x5'),_0xd350('0x6'),_0xd350('0x7'),_0xd350('0x8'),_0xd350('0x9'),_0xd350('0xa')),'allowNull':!![],'defaultValue':_0xd350('0x6')},'directory':{'type':Sequelize[_0xd350('0x2')],'allowNull':!![]},'application':{'type':Sequelize[_0xd350('0x2')],'allowNull':!![]},'digit':{'type':Sequelize[_0xd350('0x2')],'allowNull':!![]},'sort':{'type':Sequelize[_0xd350('0x2')],'allowNull':!![],'defaultValue':'alpha'},'format':{'type':Sequelize[_0xd350('0x2')],'allowNull':!![]},'stamp':{'type':'TIMESTAMP'},'defaultEntry':{'type':Sequelize[_0xd350('0xb')],'defaultValue':0x0}}; \ No newline at end of file +var _0xfbc6=['mp3','alpha','TIMESTAMP','sequelize','STRING','name','ENUM','custom','files','mp3nb','quietmp3nb','quietmp3'];(function(_0x390ce2,_0x3ee239){var _0x3cefdf=function(_0x1c2b77){while(--_0x1c2b77){_0x390ce2['push'](_0x390ce2['shift']());}};_0x3cefdf(++_0x3ee239);}(_0xfbc6,0x1d7));var _0x6fbc=function(_0x3c6b7d,_0x5f0d90){_0x3c6b7d=_0x3c6b7d-0x0;var _0x1d3ed2=_0xfbc6[_0x3c6b7d];return _0x1d3ed2;};'use strict';var Sequelize=require(_0x6fbc('0x0'));module['exports']={'name':{'type':Sequelize[_0x6fbc('0x1')],'allowNull':![],'unique':_0x6fbc('0x2')},'mode':{'type':Sequelize[_0x6fbc('0x3')](_0x6fbc('0x4'),_0x6fbc('0x5'),_0x6fbc('0x6'),_0x6fbc('0x7'),_0x6fbc('0x8'),_0x6fbc('0x9')),'allowNull':!![],'defaultValue':_0x6fbc('0x5')},'directory':{'type':Sequelize[_0x6fbc('0x1')],'allowNull':!![]},'application':{'type':Sequelize[_0x6fbc('0x1')],'allowNull':!![]},'digit':{'type':Sequelize['STRING'],'allowNull':!![]},'sort':{'type':Sequelize[_0x6fbc('0x1')],'allowNull':!![],'defaultValue':_0x6fbc('0xa')},'format':{'type':Sequelize['STRING'],'allowNull':!![]},'stamp':{'type':_0x6fbc('0xb')},'defaultEntry':{'type':Sequelize['BOOLEAN'],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/voiceMusicOnHold/voiceMusicOnHold.controller.js b/server/api/voiceMusicOnHold/voiceMusicOnHold.controller.js index a232dfb..7914566 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 _0x6307=['findOne','save_name','converted_format','createdAt','server/files/sounds/converted','format','%s.%s','basename','extname','symlinkSync','Sequelize','removeSound','getSounds','html-pdf','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','to-csv','ejs','lodash','squel','jsforce','desk.js','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','json','count','limit','set','Content-Range','apply','reject','save','update','then','destroy','get','MusicOnHolds','UserProfileResource','end','stack','name','send','index','map','VoiceMusicOnHold','rawAttributes','fieldName','type','query','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','offset','order','sort','pick','merge','VIRTUAL','filter','options','where','includeAll','findAll','rows','catch','show','keys','body','find','params','create','sequelize','transaction','mode','files','join','root','server/files/moh','mkdirSync','directory','0777','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','readdirSync','forEach','unlinkSync','rmdirSync','ValidationError','message','Sound'];(function(_0x3558fd,_0x15cd6c){var _0x488d1a=function(_0x43d0e5){while(--_0x43d0e5){_0x3558fd['push'](_0x3558fd['shift']());}};_0x488d1a(++_0x15cd6c);}(_0x6307,0x15a));var _0x7630=function(_0x99868f,_0xbdb8e7){_0x99868f=_0x99868f-0x0;var _0x27a71b=_0x6307[_0x99868f];return _0x27a71b;};'use strict';var pdf=require(_0x7630('0x0'));var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x7630('0x1'));var rp=require(_0x7630('0x2'));var moment=require(_0x7630('0x3'));var BPromise=require(_0x7630('0x4'));var Mustache=require(_0x7630('0x5'));var util=require(_0x7630('0x6'));var path=require(_0x7630('0x7'));var sox=require('sox');var csv=require(_0x7630('0x8'));var ejs=require(_0x7630('0x9'));var fs=require('fs');var _=require(_0x7630('0xa'));var squel=require(_0x7630('0xb'));var crypto=require('crypto');var jsforce=require(_0x7630('0xc'));var deskjs=require(_0x7630('0xd'));var toCsv=require(_0x7630('0x8'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x7630('0xe'));var as=require(_0x7630('0xf'));var hardwareService=require(_0x7630('0x10'));var logger=require(_0x7630('0x11'))('api');var utils=require(_0x7630('0x12'));var config=require(_0x7630('0x13'));var db=require(_0x7630('0x14'))['db'];function respondWithStatusCode(_0x79df82,_0x551c05){_0x551c05=_0x551c05||0xcc;return function(_0x594fd8){if(_0x594fd8){return _0x79df82[_0x7630('0x15')](_0x551c05);}return _0x79df82['status'](_0x551c05)['end']();};}function respondWithResult(_0x518bd9,_0x57c7c3){_0x57c7c3=_0x57c7c3||0xc8;return function(_0x1dc9ff){if(_0x1dc9ff){return _0x518bd9[_0x7630('0x16')](_0x57c7c3)[_0x7630('0x17')](_0x1dc9ff);}};}function respondWithFilteredResult(_0x46a397,_0x3a7d90){return function(_0xc90a97){if(_0xc90a97){var _0xc6496c=_0xc90a97[_0x7630('0x18')],_0x26a9b0=_0x3a7d90['offset'],_0x5a81f2=_0x3a7d90['offset']+_0x3a7d90[_0x7630('0x19')],_0x301dc7;if(_0x5a81f2>=_0xc6496c){_0x5a81f2=_0xc6496c;_0x301dc7=0xc8;}else{_0x301dc7=0xce;}_0x46a397[_0x7630('0x16')](_0x301dc7);return _0x46a397[_0x7630('0x1a')](_0x7630('0x1b'),_0x26a9b0+'-'+_0x5a81f2+'/'+_0xc6496c)['json'](_0xc90a97);}return null;};}function patchUpdates(_0x263aa5){return function(_0x4f97e1){try{jsonpatch[_0x7630('0x1c')](_0x4f97e1,_0x263aa5,!![]);}catch(_0x1d8c25){return BPromise[_0x7630('0x1d')](_0x1d8c25);}return _0x4f97e1[_0x7630('0x1e')]();};}function saveUpdates(_0x518e77,_0x38b956){return function(_0x54f5f1){if(_0x54f5f1){return _0x54f5f1[_0x7630('0x1f')](_0x518e77)[_0x7630('0x20')](function(_0x29b388){return _0x29b388;});}return null;};}function removeEntity(_0x189fce,_0x4f16e4){return function(_0x79eb07){if(_0x79eb07){return _0x79eb07[_0x7630('0x21')]()['then'](function(){var _0x509be8=_0x79eb07[_0x7630('0x22')]({'plain':!![]});var _0x3ee383=_0x7630('0x23');return db[_0x7630('0x24')][_0x7630('0x21')]({'where':{'type':_0x3ee383,'resourceId':_0x509be8['id']}})[_0x7630('0x20')](function(){return _0x79eb07;});})[_0x7630('0x20')](function(){_0x189fce['status'](0xcc)[_0x7630('0x25')]();});}};}function handleEntityNotFound(_0xbffe1,_0x4fa38f){return function(_0x202cb4){if(!_0x202cb4){_0xbffe1[_0x7630('0x15')](0x194);}return _0x202cb4;};}function handleError(_0x36948a,_0x191c93){_0x191c93=_0x191c93||0x1f4;return function(_0x41a90b){logger['error'](_0x41a90b[_0x7630('0x26')]);if(_0x41a90b['name']){delete _0x41a90b[_0x7630('0x27')];}_0x36948a[_0x7630('0x16')](_0x191c93)[_0x7630('0x28')](_0x41a90b);};}exports[_0x7630('0x29')]=function(_0x28f809,_0x4e4e96){var _0x59e73b={},_0x44077d={},_0x2ae6a6={'count':0x0,'rows':[]};var _0x587224=_[_0x7630('0x2a')](db[_0x7630('0x2b')][_0x7630('0x2c')],function(_0x13c29e){return{'name':_0x13c29e[_0x7630('0x2d')],'type':_0x13c29e[_0x7630('0x2e')]['key']};});_0x44077d['model']=_[_0x7630('0x2a')](_0x587224,_0x7630('0x27'));_0x44077d[_0x7630('0x2f')]=_['keys'](_0x28f809[_0x7630('0x2f')]);_0x44077d[_0x7630('0x30')]=_[_0x7630('0x31')](_0x44077d[_0x7630('0x32')],_0x44077d[_0x7630('0x2f')]);_0x59e73b[_0x7630('0x33')]=_[_0x7630('0x31')](_0x44077d[_0x7630('0x32')],qs['fields'](_0x28f809['query'][_0x7630('0x34')]));_0x59e73b[_0x7630('0x33')]=_0x59e73b[_0x7630('0x33')][_0x7630('0x35')]?_0x59e73b['attributes']:_0x44077d['model'];if(!_0x28f809[_0x7630('0x2f')][_0x7630('0x36')](_0x7630('0x37'))){_0x59e73b['limit']=qs[_0x7630('0x19')](_0x28f809[_0x7630('0x2f')][_0x7630('0x19')]);_0x59e73b['offset']=qs[_0x7630('0x38')](_0x28f809[_0x7630('0x2f')][_0x7630('0x38')]);}_0x59e73b[_0x7630('0x39')]=qs['sort'](_0x28f809[_0x7630('0x2f')][_0x7630('0x3a')]);_0x59e73b['where']=qs['filters'](_[_0x7630('0x3b')](_0x28f809[_0x7630('0x2f')],_0x44077d[_0x7630('0x30')]));if(_0x28f809[_0x7630('0x2f')]['filter']){_0x59e73b['where']=_[_0x7630('0x3c')](_0x59e73b['where'],{'$or':_[_0x7630('0x2a')](_0x587224,function(_0x59eec9){if(_0x59eec9[_0x7630('0x2e')]!==_0x7630('0x3d')){var _0x211318={};_0x211318[_0x59eec9[_0x7630('0x27')]]={'$like':'%'+_0x28f809[_0x7630('0x2f')][_0x7630('0x3e')]+'%'};return _0x211318;}})});}_0x59e73b=_[_0x7630('0x3c')]({},_0x59e73b,_0x28f809[_0x7630('0x3f')]);var _0x387be2={'where':_0x59e73b[_0x7630('0x40')]};return db[_0x7630('0x2b')][_0x7630('0x18')](_0x387be2)[_0x7630('0x20')](function(_0x157de2){_0x2ae6a6[_0x7630('0x18')]=_0x157de2;if(_0x28f809[_0x7630('0x2f')][_0x7630('0x41')]){_0x59e73b['include']=[{'all':!![]}];}return db['VoiceMusicOnHold'][_0x7630('0x42')](_0x59e73b);})[_0x7630('0x20')](function(_0x30e49c){_0x2ae6a6[_0x7630('0x43')]=_0x30e49c;return _0x2ae6a6;})[_0x7630('0x20')](respondWithFilteredResult(_0x4e4e96,_0x59e73b))[_0x7630('0x44')](handleError(_0x4e4e96,null));};exports[_0x7630('0x45')]=function(_0x1bca4d,_0x1476bb){var _0x3a7cd6={'raw':![],'where':{'id':_0x1bca4d['params']['id']}},_0x211e1f={};_0x211e1f[_0x7630('0x32')]=_['keys'](db[_0x7630('0x2b')]['rawAttributes']);_0x211e1f[_0x7630('0x2f')]=_[_0x7630('0x46')](_0x1bca4d['query']);_0x211e1f[_0x7630('0x30')]=_['intersection'](_0x211e1f[_0x7630('0x32')],_0x211e1f['query']);_0x3a7cd6[_0x7630('0x33')]=_[_0x7630('0x31')](_0x211e1f[_0x7630('0x32')],qs[_0x7630('0x34')](_0x1bca4d[_0x7630('0x2f')][_0x7630('0x34')]));_0x3a7cd6[_0x7630('0x33')]=_0x3a7cd6[_0x7630('0x33')][_0x7630('0x35')]?_0x3a7cd6[_0x7630('0x33')]:_0x211e1f[_0x7630('0x32')];if(_0x1bca4d['query']['includeAll']){_0x3a7cd6['include']=[{'all':!![]}];}_0x3a7cd6=_[_0x7630('0x3c')]({},_0x3a7cd6,_0x1bca4d['options']);return db[_0x7630('0x2b')]['find'](_0x3a7cd6)['then'](handleEntityNotFound(_0x1476bb,null))['then'](respondWithResult(_0x1476bb,null))[_0x7630('0x44')](handleError(_0x1476bb,null));};exports[_0x7630('0x1f')]=function(_0x5cdf52,_0x5a93b2){if(_0x5cdf52[_0x7630('0x47')]['id']){delete _0x5cdf52[_0x7630('0x47')]['id'];}return db['VoiceMusicOnHold'][_0x7630('0x48')]({'where':{'id':_0x5cdf52[_0x7630('0x49')]['id']}})[_0x7630('0x20')](handleEntityNotFound(_0x5a93b2,null))[_0x7630('0x20')](saveUpdates(_0x5cdf52[_0x7630('0x47')],null))[_0x7630('0x20')](respondWithResult(_0x5a93b2,null))['catch'](handleError(_0x5a93b2,null));};exports[_0x7630('0x4a')]=function(_0x397cff,_0x2aafdb,_0x399cb4){return db[_0x7630('0x4b')][_0x7630('0x4c')](function(_0x3942ca){if(_0x397cff[_0x7630('0x47')][_0x7630('0x4d')]===_0x7630('0x4e')){_0x397cff[_0x7630('0x47')]['directory']=path[_0x7630('0x4f')](config[_0x7630('0x50')],_0x7630('0x51'),_0x397cff[_0x7630('0x47')][_0x7630('0x27')]);}return db[_0x7630('0x2b')][_0x7630('0x4a')](_0x397cff[_0x7630('0x47')],{'transaction':_0x3942ca})[_0x7630('0x20')](function(_0x22a469){if(_0x397cff[_0x7630('0x47')]['mode']===_0x7630('0x4e')){fs[_0x7630('0x52')](_0x22a469[_0x7630('0x53')],parseInt(_0x7630('0x54'),0x8));}var _0x29c392=_0x397cff[_0x7630('0x55')][_0x7630('0x22')]({'plain':!![]});if(!_0x29c392)throw new Error(_0x7630('0x56'));if(_0x29c392[_0x7630('0x57')]===_0x7630('0x55')){var _0x44857f=_0x22a469[_0x7630('0x22')]({'plain':!![]});return db[_0x7630('0x58')][_0x7630('0x48')]({'where':{'name':_0x7630('0x23'),'userProfileId':_0x29c392['userProfileId']},'raw':!![]})[_0x7630('0x20')](function(_0x3ddc2b){if(_0x3ddc2b&&_0x3ddc2b[_0x7630('0x59')]===0x0){return db[_0x7630('0x24')][_0x7630('0x4a')]({'name':_0x44857f['name'],'resourceId':_0x44857f['id'],'type':_0x3ddc2b[_0x7630('0x27')],'sectionId':_0x3ddc2b['id']},{})[_0x7630('0x20')](function(){return _0x22a469;});}else{return _0x22a469;}})[_0x7630('0x44')](function(_0x1df86c){logger['error'](_0x7630('0x5a'),_0x1df86c);});}return _0x22a469;});})[_0x7630('0x20')](respondWithResult(_0x2aafdb,0xc9))['catch'](handleError(_0x2aafdb,null));};exports[_0x7630('0x21')]=function(_0x536c70,_0x1e40f8,_0x1b2083){var _0x5061ff;return db['VoiceMusicOnHold']['find']({'where':{'id':_0x536c70['params']['id']}})[_0x7630('0x20')](function(_0x57c874){if(_0x57c874){return db[_0x7630('0x4b')][_0x7630('0x4c')](function(_0x13f362){return _0x57c874[_0x7630('0x21')]({'transaction':_0x13f362,'raw':!![]})['then'](function(_0x183caf){if(_0x183caf['directory']){fs[_0x7630('0x5b')](_0x183caf['directory'])[_0x7630('0x5c')](function(_0x459a48){fs[_0x7630('0x5d')](path[_0x7630('0x4f')](_0x183caf[_0x7630('0x53')],_0x459a48));});fs[_0x7630('0x5e')](_0x183caf[_0x7630('0x53')]);}return _0x183caf;});})[_0x7630('0x44')](function(_0x67898d){throw new db['Sequelize'][(_0x7630('0x5f'))](_0x67898d[_0x7630('0x60')]);});}})[_0x7630('0x20')](handleEntityNotFound(_0x1e40f8,null))[_0x7630('0x20')](removeEntity(_0x1e40f8,null))[_0x7630('0x44')](handleError(_0x1e40f8,null));};exports['addSound']=function(_0xeb8989,_0x3bd06a,_0x1260f9){return db[_0x7630('0x4b')]['transaction'](function(_0xbda3da){var _0x5ed093;return db['VoiceMusicOnHold']['find']({'where':{'id':_0xeb8989[_0x7630('0x49')]['id']}})['then'](function(_0x31b6c1){if(_0x31b6c1){_0x5ed093=_0x31b6c1;return _0x31b6c1['addSound'](_0xeb8989['body']['id'],{'transaction':_0xbda3da});}})[_0x7630('0x20')](function(_0x22aef8){if(_0x22aef8){return db[_0x7630('0x61')][_0x7630('0x62')]({'where':{'id':_0xeb8989[_0x7630('0x47')]['id']},'attributes':['id',_0x7630('0x27'),_0x7630('0x63'),_0x7630('0x64'),_0x7630('0x65')],'raw':!![]});}})['then'](function(_0x1e2b74){if(_0x1e2b74){var _0x51b7f6=path[_0x7630('0x4f')](config[_0x7630('0x50')],_0x7630('0x66'),util[_0x7630('0x67')](_0x7630('0x68'),path[_0x7630('0x69')](_0x1e2b74[_0x7630('0x63')],path[_0x7630('0x6a')](_0x1e2b74['save_name'])),_0x1e2b74[_0x7630('0x64')]));var _0x5e65c6=path[_0x7630('0x4f')](config[_0x7630('0x50')],_0x7630('0x51'),_0x5ed093[_0x7630('0x27')],util[_0x7630('0x67')](_0x7630('0x68'),_0x1e2b74['name'],_0x1e2b74[_0x7630('0x64')]));fs[_0x7630('0x6b')](_0x51b7f6,_0x5e65c6);return _0x1e2b74;}})[_0x7630('0x44')](function(_0x442415){throw new db[(_0x7630('0x6c'))][(_0x7630('0x5f'))](_0x442415['message']);});})[_0x7630('0x20')](handleEntityNotFound(_0x3bd06a,null))[_0x7630('0x20')](respondWithResult(_0x3bd06a,0xc9))[_0x7630('0x44')](handleError(_0x3bd06a,null));};exports['removeSound']=function(_0xf7c13c,_0x16f3ac,_0xb7bcc4){return db[_0x7630('0x4b')]['transaction'](function(_0x53e9db){var _0x18d08a;return db[_0x7630('0x2b')]['findOne']({'where':{'id':_0xf7c13c[_0x7630('0x49')]['id']}})[_0x7630('0x20')](handleEntityNotFound(_0x16f3ac,null))[_0x7630('0x20')](function(_0x51bfe1){if(_0x51bfe1){_0x18d08a=_0x51bfe1;return _0x51bfe1[_0x7630('0x6d')](_0xf7c13c[_0x7630('0x49')]['id2']);}})[_0x7630('0x20')](function(_0x4c9500){if(_0x4c9500){return db['Sound'][_0x7630('0x62')]({'where':{'id':_0xf7c13c[_0x7630('0x49')]['id2']},'attributes':['id',_0x7630('0x27'),_0x7630('0x63'),'converted_format',_0x7630('0x65')],'raw':!![]});}})[_0x7630('0x20')](function(_0x1c9760){if(_0x1c9760){fs[_0x7630('0x5d')](path[_0x7630('0x4f')](_0x18d08a[_0x7630('0x53')],util[_0x7630('0x67')](_0x7630('0x68'),_0x1c9760[_0x7630('0x27')],_0x1c9760[_0x7630('0x64')])));return _0x1c9760;}})[_0x7630('0x44')](function(_0x3a64b9){throw new db[(_0x7630('0x6c'))][(_0x7630('0x5f'))](_0x3a64b9[_0x7630('0x60')]);});})['then'](handleEntityNotFound(_0x16f3ac,null))[_0x7630('0x20')](respondWithStatusCode(_0x16f3ac,0xcc))['catch'](handleError(_0x16f3ac,null));};exports[_0x7630('0x6e')]=function(_0x2ee76e,_0x27e65e,_0x28b1a8){var _0x39b5a4={};var _0x3132b3={};var _0x157586;var _0x2da816;return db[_0x7630('0x2b')]['findOne']({'where':{'id':_0x2ee76e[_0x7630('0x49')]['id']}})[_0x7630('0x20')](handleEntityNotFound(_0x27e65e,null))[_0x7630('0x20')](function(_0x4011cf){if(_0x4011cf){_0x157586=_0x4011cf;_0x3132b3[_0x7630('0x32')]=_[_0x7630('0x46')](db[_0x7630('0x61')][_0x7630('0x2c')]);_0x3132b3[_0x7630('0x2f')]=_['keys'](_0x2ee76e['query']);_0x3132b3[_0x7630('0x30')]=_[_0x7630('0x31')](_0x3132b3['model'],_0x3132b3[_0x7630('0x2f')]);_0x39b5a4[_0x7630('0x33')]=_[_0x7630('0x31')](_0x3132b3[_0x7630('0x32')],qs[_0x7630('0x34')](_0x2ee76e['query'][_0x7630('0x34')]));_0x39b5a4[_0x7630('0x33')]=_0x39b5a4[_0x7630('0x33')][_0x7630('0x35')]?_0x39b5a4[_0x7630('0x33')]:_0x3132b3['model'];_0x39b5a4[_0x7630('0x39')]=qs[_0x7630('0x3a')](_0x2ee76e[_0x7630('0x2f')][_0x7630('0x3a')]);_0x39b5a4['where']=qs[_0x7630('0x30')](_[_0x7630('0x3b')](_0x2ee76e[_0x7630('0x2f')],_0x3132b3[_0x7630('0x30')]));if(_0x2ee76e[_0x7630('0x2f')][_0x7630('0x3e')]){_0x39b5a4[_0x7630('0x40')]=_[_0x7630('0x3c')](_0x39b5a4[_0x7630('0x40')],{'$or':_['map'](_0x39b5a4[_0x7630('0x33')],function(_0x5f0dfb){var _0x215792={};_0x215792[_0x5f0dfb]={'$like':'%'+_0x2ee76e[_0x7630('0x2f')]['filter']+'%'};return _0x215792;})});}_0x39b5a4=_['merge']({},_0x39b5a4,_0x2ee76e[_0x7630('0x3f')]);return _0x157586[_0x7630('0x6e')](_0x39b5a4);}})[_0x7630('0x20')](function(_0x47f6b9){if(_0x47f6b9){_0x2da816=_0x47f6b9[_0x7630('0x35')];if(!_0x2ee76e[_0x7630('0x2f')][_0x7630('0x36')](_0x7630('0x37'))){_0x39b5a4[_0x7630('0x19')]=qs[_0x7630('0x19')](_0x2ee76e[_0x7630('0x2f')][_0x7630('0x19')]);_0x39b5a4[_0x7630('0x38')]=qs['offset'](_0x2ee76e[_0x7630('0x2f')][_0x7630('0x38')]);}return _0x157586[_0x7630('0x6e')](_0x39b5a4);}})[_0x7630('0x20')](function(_0x31b509){if(_0x31b509){return _0x31b509?{'count':_0x2da816,'rows':_0x31b509}:null;}})[_0x7630('0x20')](respondWithResult(_0x27e65e,null))['catch'](handleError(_0x27e65e,null));}; \ No newline at end of file +var _0x493d=['attributes','length','order','sort','pick','filter','where','merge','options','includeAll','rows','catch','show','rawAttributes','fields','include','find','body','params','create','sequelize','transaction','files','join','root','server/files/moh','mode','mkdirSync','user','role','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','directory','forEach','unlinkSync','rmdirSync','Sequelize','ValidationError','addSound','findOne','converted_format','server/files/sounds/converted','format','%s.%s','basename','save_name','extname','symlinkSync','message','removeSound','id2','Sound','getSounds','hasOwnProperty','nolimit','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','path','sox','to-csv','ejs','crypto','jsforce','desk.js','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','status','end','json','count','offset','limit','set','Content-Range','apply','reject','save','update','then','get','MusicOnHolds','UserProfileResource','destroy','sendStatus','error','send','index','map','VoiceMusicOnHold','fieldName','type','key','model','name','query','keys','filters','intersection'];(function(_0x243b59,_0x3f9495){var _0x3e1676=function(_0x354052){while(--_0x354052){_0x243b59['push'](_0x243b59['shift']());}};_0x3e1676(++_0x3f9495);}(_0x493d,0x115));var _0xd493=function(_0x381372,_0xf0a5a){_0x381372=_0x381372-0x0;var _0x4e959a=_0x493d[_0x381372];return _0x4e959a;};'use strict';var pdf=require('html-pdf');var emlformat=require('eml-format');var rimraf=require(_0xd493('0x0'));var zipdir=require(_0xd493('0x1'));var jsonpatch=require(_0xd493('0x2'));var rp=require(_0xd493('0x3'));var moment=require('moment');var BPromise=require(_0xd493('0x4'));var Mustache=require(_0xd493('0x5'));var util=require('util');var path=require(_0xd493('0x6'));var sox=require(_0xd493('0x7'));var csv=require(_0xd493('0x8'));var ejs=require(_0xd493('0x9'));var fs=require('fs');var _=require('lodash');var squel=require('squel');var crypto=require(_0xd493('0xa'));var jsforce=require(_0xd493('0xb'));var deskjs=require(_0xd493('0xc'));var toCsv=require(_0xd493('0x8'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0xd493('0xd'));var authService=require(_0xd493('0xe'));var qs=require(_0xd493('0xf'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xd493('0x10'));var logger=require(_0xd493('0x11'))('api');var utils=require(_0xd493('0x12'));var config=require(_0xd493('0x13'));var db=require(_0xd493('0x14'))['db'];function respondWithStatusCode(_0x7141f6,_0x22b4cc){_0x22b4cc=_0x22b4cc||0xcc;return function(_0x552a03){if(_0x552a03){return _0x7141f6['sendStatus'](_0x22b4cc);}return _0x7141f6[_0xd493('0x15')](_0x22b4cc)[_0xd493('0x16')]();};}function respondWithResult(_0x8efdf2,_0x8613ce){_0x8613ce=_0x8613ce||0xc8;return function(_0x59b5ce){if(_0x59b5ce){return _0x8efdf2[_0xd493('0x15')](_0x8613ce)[_0xd493('0x17')](_0x59b5ce);}};}function respondWithFilteredResult(_0x56c9e6,_0x16648c){return function(_0x327ba9){if(_0x327ba9){var _0x2e15fa=_0x327ba9[_0xd493('0x18')],_0x2f1f34=_0x16648c['offset'],_0x21c46c=_0x16648c[_0xd493('0x19')]+_0x16648c[_0xd493('0x1a')],_0x1e80ab;if(_0x21c46c>=_0x2e15fa){_0x21c46c=_0x2e15fa;_0x1e80ab=0xc8;}else{_0x1e80ab=0xce;}_0x56c9e6[_0xd493('0x15')](_0x1e80ab);return _0x56c9e6[_0xd493('0x1b')](_0xd493('0x1c'),_0x2f1f34+'-'+_0x21c46c+'/'+_0x2e15fa)['json'](_0x327ba9);}return null;};}function patchUpdates(_0x220627){return function(_0x946396){try{jsonpatch[_0xd493('0x1d')](_0x946396,_0x220627,!![]);}catch(_0x3ce67d){return BPromise[_0xd493('0x1e')](_0x3ce67d);}return _0x946396[_0xd493('0x1f')]();};}function saveUpdates(_0x1edfe4,_0x274d30){return function(_0x30cc26){if(_0x30cc26){return _0x30cc26[_0xd493('0x20')](_0x1edfe4)[_0xd493('0x21')](function(_0x2cf4c9){return _0x2cf4c9;});}return null;};}function removeEntity(_0x1bbc0a,_0x24bdd3){return function(_0x498445){if(_0x498445){return _0x498445['destroy']()[_0xd493('0x21')](function(){var _0x269762=_0x498445[_0xd493('0x22')]({'plain':!![]});var _0x5c895f=_0xd493('0x23');return db[_0xd493('0x24')][_0xd493('0x25')]({'where':{'type':_0x5c895f,'resourceId':_0x269762['id']}})['then'](function(){return _0x498445;});})[_0xd493('0x21')](function(){_0x1bbc0a['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x2b5e55,_0x210aba){return function(_0xd0082e){if(!_0xd0082e){_0x2b5e55[_0xd493('0x26')](0x194);}return _0xd0082e;};}function handleError(_0x42f953,_0x6e60fa){_0x6e60fa=_0x6e60fa||0x1f4;return function(_0x547f38){logger[_0xd493('0x27')](_0x547f38['stack']);if(_0x547f38['name']){delete _0x547f38['name'];}_0x42f953['status'](_0x6e60fa)[_0xd493('0x28')](_0x547f38);};}exports[_0xd493('0x29')]=function(_0x466c5d,_0x2a0784){var _0x4b136c={},_0x53b135={},_0x4299e1={'count':0x0,'rows':[]};var _0x53e570=_[_0xd493('0x2a')](db[_0xd493('0x2b')]['rawAttributes'],function(_0x448f41){return{'name':_0x448f41[_0xd493('0x2c')],'type':_0x448f41[_0xd493('0x2d')][_0xd493('0x2e')]};});_0x53b135[_0xd493('0x2f')]=_[_0xd493('0x2a')](_0x53e570,_0xd493('0x30'));_0x53b135[_0xd493('0x31')]=_[_0xd493('0x32')](_0x466c5d['query']);_0x53b135[_0xd493('0x33')]=_[_0xd493('0x34')](_0x53b135[_0xd493('0x2f')],_0x53b135[_0xd493('0x31')]);_0x4b136c[_0xd493('0x35')]=_['intersection'](_0x53b135[_0xd493('0x2f')],qs['fields'](_0x466c5d[_0xd493('0x31')]['fields']));_0x4b136c[_0xd493('0x35')]=_0x4b136c[_0xd493('0x35')][_0xd493('0x36')]?_0x4b136c[_0xd493('0x35')]:_0x53b135[_0xd493('0x2f')];if(!_0x466c5d[_0xd493('0x31')]['hasOwnProperty']('nolimit')){_0x4b136c[_0xd493('0x1a')]=qs[_0xd493('0x1a')](_0x466c5d['query'][_0xd493('0x1a')]);_0x4b136c['offset']=qs['offset'](_0x466c5d[_0xd493('0x31')][_0xd493('0x19')]);}_0x4b136c[_0xd493('0x37')]=qs['sort'](_0x466c5d[_0xd493('0x31')][_0xd493('0x38')]);_0x4b136c['where']=qs[_0xd493('0x33')](_[_0xd493('0x39')](_0x466c5d[_0xd493('0x31')],_0x53b135[_0xd493('0x33')]));if(_0x466c5d[_0xd493('0x31')][_0xd493('0x3a')]){_0x4b136c[_0xd493('0x3b')]=_[_0xd493('0x3c')](_0x4b136c[_0xd493('0x3b')],{'$or':_['map'](_0x53e570,function(_0x50937f){if(_0x50937f['type']!=='VIRTUAL'){var _0x45ecf3={};_0x45ecf3[_0x50937f[_0xd493('0x30')]]={'$like':'%'+_0x466c5d[_0xd493('0x31')]['filter']+'%'};return _0x45ecf3;}})});}_0x4b136c=_[_0xd493('0x3c')]({},_0x4b136c,_0x466c5d[_0xd493('0x3d')]);var _0x59fca5={'where':_0x4b136c['where']};return db['VoiceMusicOnHold'][_0xd493('0x18')](_0x59fca5)['then'](function(_0x102a8d){_0x4299e1[_0xd493('0x18')]=_0x102a8d;if(_0x466c5d['query'][_0xd493('0x3e')]){_0x4b136c['include']=[{'all':!![]}];}return db[_0xd493('0x2b')]['findAll'](_0x4b136c);})[_0xd493('0x21')](function(_0x4e7a77){_0x4299e1[_0xd493('0x3f')]=_0x4e7a77;return _0x4299e1;})['then'](respondWithFilteredResult(_0x2a0784,_0x4b136c))[_0xd493('0x40')](handleError(_0x2a0784,null));};exports[_0xd493('0x41')]=function(_0xfc33de,_0x15f7b3){var _0x27805f={'raw':![],'where':{'id':_0xfc33de['params']['id']}},_0x1c3293={};_0x1c3293[_0xd493('0x2f')]=_[_0xd493('0x32')](db[_0xd493('0x2b')][_0xd493('0x42')]);_0x1c3293[_0xd493('0x31')]=_[_0xd493('0x32')](_0xfc33de[_0xd493('0x31')]);_0x1c3293[_0xd493('0x33')]=_[_0xd493('0x34')](_0x1c3293[_0xd493('0x2f')],_0x1c3293[_0xd493('0x31')]);_0x27805f[_0xd493('0x35')]=_[_0xd493('0x34')](_0x1c3293[_0xd493('0x2f')],qs[_0xd493('0x43')](_0xfc33de[_0xd493('0x31')][_0xd493('0x43')]));_0x27805f[_0xd493('0x35')]=_0x27805f[_0xd493('0x35')][_0xd493('0x36')]?_0x27805f[_0xd493('0x35')]:_0x1c3293[_0xd493('0x2f')];if(_0xfc33de['query']['includeAll']){_0x27805f[_0xd493('0x44')]=[{'all':!![]}];}_0x27805f=_[_0xd493('0x3c')]({},_0x27805f,_0xfc33de['options']);return db[_0xd493('0x2b')][_0xd493('0x45')](_0x27805f)[_0xd493('0x21')](handleEntityNotFound(_0x15f7b3,null))[_0xd493('0x21')](respondWithResult(_0x15f7b3,null))[_0xd493('0x40')](handleError(_0x15f7b3,null));};exports[_0xd493('0x20')]=function(_0x56e164,_0x2d1497){if(_0x56e164[_0xd493('0x46')]['id']){delete _0x56e164[_0xd493('0x46')]['id'];}return db[_0xd493('0x2b')]['find']({'where':{'id':_0x56e164[_0xd493('0x47')]['id']}})[_0xd493('0x21')](handleEntityNotFound(_0x2d1497,null))[_0xd493('0x21')](saveUpdates(_0x56e164[_0xd493('0x46')],null))[_0xd493('0x21')](respondWithResult(_0x2d1497,null))[_0xd493('0x40')](handleError(_0x2d1497,null));};exports[_0xd493('0x48')]=function(_0x4e4255,_0x1cb56c,_0x231575){return db[_0xd493('0x49')][_0xd493('0x4a')](function(_0x4d176c){if(_0x4e4255[_0xd493('0x46')]['mode']===_0xd493('0x4b')){_0x4e4255[_0xd493('0x46')]['directory']=path[_0xd493('0x4c')](config[_0xd493('0x4d')],_0xd493('0x4e'),_0x4e4255['body'][_0xd493('0x30')]);}return db[_0xd493('0x2b')][_0xd493('0x48')](_0x4e4255[_0xd493('0x46')],{'transaction':_0x4d176c})[_0xd493('0x21')](function(_0x31651a){if(_0x4e4255[_0xd493('0x46')][_0xd493('0x4f')]==='files'){fs[_0xd493('0x50')](_0x31651a['directory'],parseInt('0777',0x8));}var _0x34f3f7=_0x4e4255[_0xd493('0x51')][_0xd493('0x22')]({'plain':!![]});if(!_0x34f3f7)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x34f3f7[_0xd493('0x52')]===_0xd493('0x51')){var _0x8d41fd=_0x31651a[_0xd493('0x22')]({'plain':!![]});return db[_0xd493('0x53')][_0xd493('0x45')]({'where':{'name':_0xd493('0x23'),'userProfileId':_0x34f3f7[_0xd493('0x54')]},'raw':!![]})[_0xd493('0x21')](function(_0x835ea3){if(_0x835ea3&&_0x835ea3[_0xd493('0x55')]===0x0){return db[_0xd493('0x24')][_0xd493('0x48')]({'name':_0x8d41fd['name'],'resourceId':_0x8d41fd['id'],'type':_0x835ea3[_0xd493('0x30')],'sectionId':_0x835ea3['id']},{})[_0xd493('0x21')](function(){return _0x31651a;});}else{return _0x31651a;}})[_0xd493('0x40')](function(_0x5f5db2){logger[_0xd493('0x27')](_0xd493('0x56'),_0x5f5db2);});}return _0x31651a;});})['then'](respondWithResult(_0x1cb56c,0xc9))['catch'](handleError(_0x1cb56c,null));};exports[_0xd493('0x25')]=function(_0x47bda3,_0x1e4c16,_0x17b77f){var _0x130e07;return db[_0xd493('0x2b')][_0xd493('0x45')]({'where':{'id':_0x47bda3[_0xd493('0x47')]['id']}})[_0xd493('0x21')](function(_0x56710e){if(_0x56710e){return db['sequelize'][_0xd493('0x4a')](function(_0x480a72){return _0x56710e[_0xd493('0x25')]({'transaction':_0x480a72,'raw':!![]})[_0xd493('0x21')](function(_0x1d0c07){if(_0x1d0c07[_0xd493('0x57')]){fs['readdirSync'](_0x1d0c07[_0xd493('0x57')])[_0xd493('0x58')](function(_0x75c170){fs[_0xd493('0x59')](path[_0xd493('0x4c')](_0x1d0c07[_0xd493('0x57')],_0x75c170));});fs[_0xd493('0x5a')](_0x1d0c07[_0xd493('0x57')]);}return _0x1d0c07;});})['catch'](function(_0x5799d3){throw new db[(_0xd493('0x5b'))][(_0xd493('0x5c'))](_0x5799d3['message']);});}})['then'](handleEntityNotFound(_0x1e4c16,null))[_0xd493('0x21')](removeEntity(_0x1e4c16,null))[_0xd493('0x40')](handleError(_0x1e4c16,null));};exports[_0xd493('0x5d')]=function(_0x5c1115,_0x63aecd,_0x2f1c2c){return db[_0xd493('0x49')]['transaction'](function(_0xafbb67){var _0x3d65e9;return db['VoiceMusicOnHold'][_0xd493('0x45')]({'where':{'id':_0x5c1115['params']['id']}})[_0xd493('0x21')](function(_0x9ab973){if(_0x9ab973){_0x3d65e9=_0x9ab973;return _0x9ab973[_0xd493('0x5d')](_0x5c1115[_0xd493('0x46')]['id'],{'transaction':_0xafbb67});}})[_0xd493('0x21')](function(_0x4d2b06){if(_0x4d2b06){return db['Sound'][_0xd493('0x5e')]({'where':{'id':_0x5c1115[_0xd493('0x46')]['id']},'attributes':['id',_0xd493('0x30'),'save_name',_0xd493('0x5f'),'createdAt'],'raw':!![]});}})[_0xd493('0x21')](function(_0x5843fc){if(_0x5843fc){var _0xf20286=path[_0xd493('0x4c')](config[_0xd493('0x4d')],_0xd493('0x60'),util[_0xd493('0x61')](_0xd493('0x62'),path[_0xd493('0x63')](_0x5843fc[_0xd493('0x64')],path[_0xd493('0x65')](_0x5843fc[_0xd493('0x64')])),_0x5843fc[_0xd493('0x5f')]));var _0xa48b11=path[_0xd493('0x4c')](config[_0xd493('0x4d')],_0xd493('0x4e'),_0x3d65e9[_0xd493('0x30')],util[_0xd493('0x61')](_0xd493('0x62'),_0x5843fc['name'],_0x5843fc[_0xd493('0x5f')]));fs[_0xd493('0x66')](_0xf20286,_0xa48b11);return _0x5843fc;}})[_0xd493('0x40')](function(_0x367353){throw new db[(_0xd493('0x5b'))][(_0xd493('0x5c'))](_0x367353[_0xd493('0x67')]);});})[_0xd493('0x21')](handleEntityNotFound(_0x63aecd,null))[_0xd493('0x21')](respondWithResult(_0x63aecd,0xc9))['catch'](handleError(_0x63aecd,null));};exports[_0xd493('0x68')]=function(_0x12e838,_0x5ad68c,_0xb5c109){return db[_0xd493('0x49')][_0xd493('0x4a')](function(_0xda92c9){var _0x446c86;return db[_0xd493('0x2b')]['findOne']({'where':{'id':_0x12e838[_0xd493('0x47')]['id']}})[_0xd493('0x21')](handleEntityNotFound(_0x5ad68c,null))[_0xd493('0x21')](function(_0x2a16fb){if(_0x2a16fb){_0x446c86=_0x2a16fb;return _0x2a16fb[_0xd493('0x68')](_0x12e838[_0xd493('0x47')][_0xd493('0x69')]);}})[_0xd493('0x21')](function(_0x135f17){if(_0x135f17){return db[_0xd493('0x6a')][_0xd493('0x5e')]({'where':{'id':_0x12e838[_0xd493('0x47')][_0xd493('0x69')]},'attributes':['id',_0xd493('0x30'),_0xd493('0x64'),_0xd493('0x5f'),'createdAt'],'raw':!![]});}})[_0xd493('0x21')](function(_0xd00e30){if(_0xd00e30){fs[_0xd493('0x59')](path[_0xd493('0x4c')](_0x446c86['directory'],util[_0xd493('0x61')](_0xd493('0x62'),_0xd00e30[_0xd493('0x30')],_0xd00e30[_0xd493('0x5f')])));return _0xd00e30;}})[_0xd493('0x40')](function(_0x43bb3a){throw new db[(_0xd493('0x5b'))][(_0xd493('0x5c'))](_0x43bb3a['message']);});})[_0xd493('0x21')](handleEntityNotFound(_0x5ad68c,null))[_0xd493('0x21')](respondWithStatusCode(_0x5ad68c,0xcc))[_0xd493('0x40')](handleError(_0x5ad68c,null));};exports[_0xd493('0x6b')]=function(_0x36488f,_0x135759,_0x26386e){var _0x1f8a61={};var _0x2b41de={};var _0x144e5a;var _0x4d7343;return db[_0xd493('0x2b')][_0xd493('0x5e')]({'where':{'id':_0x36488f[_0xd493('0x47')]['id']}})['then'](handleEntityNotFound(_0x135759,null))[_0xd493('0x21')](function(_0x581c3a){if(_0x581c3a){_0x144e5a=_0x581c3a;_0x2b41de[_0xd493('0x2f')]=_[_0xd493('0x32')](db[_0xd493('0x6a')][_0xd493('0x42')]);_0x2b41de[_0xd493('0x31')]=_[_0xd493('0x32')](_0x36488f[_0xd493('0x31')]);_0x2b41de[_0xd493('0x33')]=_[_0xd493('0x34')](_0x2b41de['model'],_0x2b41de['query']);_0x1f8a61[_0xd493('0x35')]=_[_0xd493('0x34')](_0x2b41de[_0xd493('0x2f')],qs[_0xd493('0x43')](_0x36488f['query'][_0xd493('0x43')]));_0x1f8a61['attributes']=_0x1f8a61['attributes'][_0xd493('0x36')]?_0x1f8a61['attributes']:_0x2b41de['model'];_0x1f8a61[_0xd493('0x37')]=qs[_0xd493('0x38')](_0x36488f[_0xd493('0x31')][_0xd493('0x38')]);_0x1f8a61[_0xd493('0x3b')]=qs[_0xd493('0x33')](_[_0xd493('0x39')](_0x36488f[_0xd493('0x31')],_0x2b41de[_0xd493('0x33')]));if(_0x36488f['query'][_0xd493('0x3a')]){_0x1f8a61[_0xd493('0x3b')]=_[_0xd493('0x3c')](_0x1f8a61['where'],{'$or':_['map'](_0x1f8a61[_0xd493('0x35')],function(_0x28a15b){var _0x2e7a74={};_0x2e7a74[_0x28a15b]={'$like':'%'+_0x36488f[_0xd493('0x31')][_0xd493('0x3a')]+'%'};return _0x2e7a74;})});}_0x1f8a61=_[_0xd493('0x3c')]({},_0x1f8a61,_0x36488f[_0xd493('0x3d')]);return _0x144e5a[_0xd493('0x6b')](_0x1f8a61);}})[_0xd493('0x21')](function(_0x29fced){if(_0x29fced){_0x4d7343=_0x29fced[_0xd493('0x36')];if(!_0x36488f[_0xd493('0x31')][_0xd493('0x6c')](_0xd493('0x6d'))){_0x1f8a61[_0xd493('0x1a')]=qs[_0xd493('0x1a')](_0x36488f['query'][_0xd493('0x1a')]);_0x1f8a61[_0xd493('0x19')]=qs[_0xd493('0x19')](_0x36488f[_0xd493('0x31')][_0xd493('0x19')]);}return _0x144e5a['getSounds'](_0x1f8a61);}})[_0xd493('0x21')](function(_0x6934e4){if(_0x6934e4){return _0x6934e4?{'count':_0x4d7343,'rows':_0x6934e4}:null;}})[_0xd493('0x21')](respondWithResult(_0x135759,null))['catch'](handleError(_0x135759,null));}; \ No newline at end of file diff --git a/server/api/voiceMusicOnHold/voiceMusicOnHold.model.js b/server/api/voiceMusicOnHold/voiceMusicOnHold.model.js index 02c0091..3d523ee 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 _0xed07=['../../config/environment','./voiceMusicOnHold.attributes','exports','define','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf'];(function(_0x459335,_0x2e95dd){var _0x50f00b=function(_0x5ccdaf){while(--_0x5ccdaf){_0x459335['push'](_0x459335['shift']());}};_0x50f00b(++_0x2e95dd);}(_0xed07,0x18a));var _0x7ed0=function(_0x54cc19,_0x396255){_0x54cc19=_0x54cc19-0x0;var _0x4841cc=_0xed07[_0x54cc19];return _0x4841cc;};'use strict';var _=require(_0x7ed0('0x0'));var util=require(_0x7ed0('0x1'));var logger=require(_0x7ed0('0x2'))(_0x7ed0('0x3'));var moment=require(_0x7ed0('0x4'));var BPromise=require(_0x7ed0('0x5'));var rp=require(_0x7ed0('0x6'));var fs=require('fs');var path=require(_0x7ed0('0x7'));var rimraf=require(_0x7ed0('0x8'));var config=require(_0x7ed0('0x9'));var attributes=require(_0x7ed0('0xa'));module[_0x7ed0('0xb')]=function(_0x4cf5d3,_0x41a22c){return _0x4cf5d3[_0x7ed0('0xc')]('VoiceMusicOnHold',attributes,{'tableName':'voice_musiconhold','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x39b5=['voice_musiconhold','lodash','util','../../config/logger','api','moment','bluebird','../../config/environment','exports','define'];(function(_0x393a3b,_0x3ce487){var _0x2548a6=function(_0x485bb4){while(--_0x485bb4){_0x393a3b['push'](_0x393a3b['shift']());}};_0x2548a6(++_0x3ce487);}(_0x39b5,0xf1));var _0x539b=function(_0x2b7804,_0x29f001){_0x2b7804=_0x2b7804-0x0;var _0x48811a=_0x39b5[_0x2b7804];return _0x48811a;};'use strict';var _=require(_0x539b('0x0'));var util=require(_0x539b('0x1'));var logger=require(_0x539b('0x2'))(_0x539b('0x3'));var moment=require(_0x539b('0x4'));var BPromise=require(_0x539b('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x539b('0x6'));var attributes=require('./voiceMusicOnHold.attributes');module[_0x539b('0x7')]=function(_0xd52ead,_0x3e95cc){return _0xd52ead[_0x539b('0x8')]('VoiceMusicOnHold',attributes,{'tableName':_0x539b('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 6be9253..7c95450 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 _0x44fd=['then','VoiceMusicOnHold,\x20%s,\x20%s','debug','VoiceMusicOnHold,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','info','catch','../../config/utils','../../config/logger','rpc','jayson/promise'];(function(_0x3f89fd,_0x150e67){var _0x36ad25=function(_0x155aab){while(--_0x155aab){_0x3f89fd['push'](_0x3f89fd['shift']());}};_0x36ad25(++_0x150e67);}(_0x44fd,0x74));var _0xd44f=function(_0x3239f5,_0x50e77c){_0x3239f5=_0x3239f5-0x0;var _0x3559c8=_0x44fd[_0x3239f5];return _0x3559c8;};'use strict';var _=require('lodash');var util=require('util');var moment=require('moment');var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0xd44f('0x0'));var logger=require(_0xd44f('0x1'))(_0xd44f('0x2'));var config=require('../../config/environment');var jayson=require(_0xd44f('0x3'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x3e76d7,_0x497ea3,_0x2b1f84){return new BPromise(function(_0x3a9604,_0x263baf){return client['request'](_0x3e76d7,_0x2b1f84)[_0xd44f('0x4')](function(_0x1c5d38){logger['info'](_0xd44f('0x5'),_0x497ea3,'request\x20sent');logger[_0xd44f('0x6')](_0xd44f('0x7'),_0x497ea3,_0xd44f('0x8'),JSON[_0xd44f('0x9')](_0x1c5d38));if(_0x1c5d38[_0xd44f('0xa')]){if(_0x1c5d38[_0xd44f('0xa')][_0xd44f('0xb')]===0x1f4){logger['error'](_0xd44f('0x5'),_0x497ea3,_0x1c5d38[_0xd44f('0xa')][_0xd44f('0xc')]);return _0x263baf(_0x1c5d38[_0xd44f('0xa')][_0xd44f('0xc')]);}logger[_0xd44f('0xa')](_0xd44f('0x5'),_0x497ea3,_0x1c5d38[_0xd44f('0xa')][_0xd44f('0xc')]);return _0x3a9604(_0x1c5d38[_0xd44f('0xa')][_0xd44f('0xc')]);}else{logger[_0xd44f('0xd')](_0xd44f('0x5'),_0x497ea3,_0xd44f('0x8'));_0x3a9604(_0x1c5d38['result'][_0xd44f('0xc')]);}})[_0xd44f('0xe')](function(_0x12493d){logger['error'](_0xd44f('0x5'),_0x497ea3,_0x12493d);_0x263baf(_0x12493d);});});} \ No newline at end of file +var _0x1eea=['request','then','VoiceMusicOnHold,\x20%s,\x20%s','request\x20sent','debug','VoiceMusicOnHold,\x20%s,\x20%s,\x20%s','error','code','message','info','result','catch','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','http'];(function(_0xc6de2e,_0x1b0316){var _0xdf16d9=function(_0x7d4c32){while(--_0x7d4c32){_0xc6de2e['push'](_0xc6de2e['shift']());}};_0xdf16d9(++_0x1b0316);}(_0x1eea,0x114));var _0xa1ee=function(_0x16daad,_0x233001){_0x16daad=_0x16daad-0x0;var _0x3220bd=_0x1eea[_0x16daad];return _0x3220bd;};'use strict';var _=require(_0xa1ee('0x0'));var util=require(_0xa1ee('0x1'));var moment=require('moment');var BPromise=require(_0xa1ee('0x2'));var rs=require(_0xa1ee('0x3'));var fs=require('fs');var Redis=require(_0xa1ee('0x4'));var db=require(_0xa1ee('0x5'))['db'];var utils=require(_0xa1ee('0x6'));var logger=require('../../config/logger')(_0xa1ee('0x7'));var config=require(_0xa1ee('0x8'));var jayson=require('jayson/promise');var client=jayson['client'][_0xa1ee('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x127154,_0x74bfc6,_0x52f4a4){return new BPromise(function(_0x4f5112,_0x2063e8){return client[_0xa1ee('0xa')](_0x127154,_0x52f4a4)[_0xa1ee('0xb')](function(_0x59b765){logger['info'](_0xa1ee('0xc'),_0x74bfc6,_0xa1ee('0xd'));logger[_0xa1ee('0xe')](_0xa1ee('0xf'),_0x74bfc6,_0xa1ee('0xd'),JSON['stringify'](_0x59b765));if(_0x59b765['error']){if(_0x59b765[_0xa1ee('0x10')][_0xa1ee('0x11')]===0x1f4){logger[_0xa1ee('0x10')](_0xa1ee('0xc'),_0x74bfc6,_0x59b765[_0xa1ee('0x10')][_0xa1ee('0x12')]);return _0x2063e8(_0x59b765[_0xa1ee('0x10')]['message']);}logger[_0xa1ee('0x10')](_0xa1ee('0xc'),_0x74bfc6,_0x59b765[_0xa1ee('0x10')][_0xa1ee('0x12')]);return _0x4f5112(_0x59b765['error']['message']);}else{logger[_0xa1ee('0x13')]('VoiceMusicOnHold,\x20%s,\x20%s',_0x74bfc6,_0xa1ee('0xd'));_0x4f5112(_0x59b765[_0xa1ee('0x14')][_0xa1ee('0x12')]);}})[_0xa1ee('0x15')](function(_0x13a88d){logger['error'](_0xa1ee('0xc'),_0x74bfc6,_0x13a88d);_0x2063e8(_0x13a88d);});});} \ No newline at end of file diff --git a/server/api/voicePrefix/index.js b/server/api/voicePrefix/index.js index 86c74ed..6e13c3d 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 _0x50f0=['/:id/users','getAgents','create','addAgents','put','/:id','update','delete','destroy','removeAgents','exports','multer','util','path','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./voicePrefix.controller','isAuthenticated','get','/describe','describe'];(function(_0x1c8c28,_0x3ee093){var _0x1f59b4=function(_0x29bcc0){while(--_0x29bcc0){_0x1c8c28['push'](_0x1c8c28['shift']());}};_0x1f59b4(++_0x3ee093);}(_0x50f0,0x6b));var _0x050f=function(_0x3fe393,_0x234a3a){_0x3fe393=_0x3fe393-0x0;var _0x534d14=_0x50f0[_0x3fe393];return _0x534d14;};'use strict';var multer=require(_0x050f('0x0'));var util=require(_0x050f('0x1'));var path=require(_0x050f('0x2'));var timeout=require(_0x050f('0x3'));var express=require('express');var router=express[_0x050f('0x4')]();var auth=require(_0x050f('0x5'));var interaction=require(_0x050f('0x6'));var config=require(_0x050f('0x7'));var controller=require(_0x050f('0x8'));router['get']('/',auth[_0x050f('0x9')](),controller['index']);router[_0x050f('0xa')](_0x050f('0xb'),auth[_0x050f('0x9')](),controller[_0x050f('0xc')]);router[_0x050f('0xa')]('/:id',auth[_0x050f('0x9')](),controller['show']);router[_0x050f('0xa')](_0x050f('0xd'),auth['isAuthenticated'](),controller[_0x050f('0xe')]);router['post']('/',auth[_0x050f('0x9')](),controller[_0x050f('0xf')]);router['post'](_0x050f('0xd'),auth[_0x050f('0x9')](),controller[_0x050f('0x10')]);router[_0x050f('0x11')](_0x050f('0x12'),auth[_0x050f('0x9')](),controller[_0x050f('0x13')]);router[_0x050f('0x14')](_0x050f('0x12'),auth[_0x050f('0x9')](),controller[_0x050f('0x15')]);router[_0x050f('0x14')](_0x050f('0xd'),auth[_0x050f('0x9')](),controller[_0x050f('0x16')]);module[_0x050f('0x17')]=router; \ No newline at end of file +var _0x63d1=['index','/describe','describe','show','/:id/users','getAgents','post','create','addAgents','put','/:id','update','destroy','removeAgents','exports','multer','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','./voicePrefix.controller','get','isAuthenticated'];(function(_0x23b85e,_0x39b209){var _0x329756=function(_0x3418e1){while(--_0x3418e1){_0x23b85e['push'](_0x23b85e['shift']());}};_0x329756(++_0x39b209);}(_0x63d1,0x122));var _0x163d=function(_0x3159c5,_0x52b59f){_0x3159c5=_0x3159c5-0x0;var _0x3eb8fd=_0x63d1[_0x3159c5];return _0x3eb8fd;};'use strict';var multer=require(_0x163d('0x0'));var util=require('util');var path=require(_0x163d('0x1'));var timeout=require(_0x163d('0x2'));var express=require(_0x163d('0x3'));var router=express[_0x163d('0x4')]();var auth=require(_0x163d('0x5'));var interaction=require(_0x163d('0x6'));var config=require('../../config/environment');var controller=require(_0x163d('0x7'));router[_0x163d('0x8')]('/',auth[_0x163d('0x9')](),controller[_0x163d('0xa')]);router['get'](_0x163d('0xb'),auth[_0x163d('0x9')](),controller[_0x163d('0xc')]);router[_0x163d('0x8')]('/:id',auth[_0x163d('0x9')](),controller[_0x163d('0xd')]);router['get'](_0x163d('0xe'),auth[_0x163d('0x9')](),controller[_0x163d('0xf')]);router[_0x163d('0x10')]('/',auth[_0x163d('0x9')](),controller[_0x163d('0x11')]);router[_0x163d('0x10')](_0x163d('0xe'),auth['isAuthenticated'](),controller[_0x163d('0x12')]);router[_0x163d('0x13')](_0x163d('0x14'),auth['isAuthenticated'](),controller[_0x163d('0x15')]);router['delete'](_0x163d('0x14'),auth['isAuthenticated'](),controller[_0x163d('0x16')]);router['delete'](_0x163d('0xe'),auth[_0x163d('0x9')](),controller[_0x163d('0x17')]);module[_0x163d('0x18')]=router; \ No newline at end of file diff --git a/server/api/voicePrefix/voicePrefix.attributes.js b/server/api/voicePrefix/voicePrefix.attributes.js index dad99f5..17860d2 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 _0xdc01=['system-','getDataValue','name','sequelize','exports','STRING'];(function(_0x2bce52,_0x37c4f6){var _0x43ca44=function(_0x235565){while(--_0x235565){_0x2bce52['push'](_0x2bce52['shift']());}};_0x43ca44(++_0x37c4f6);}(_0xdc01,0xdb));var _0x1dc0=function(_0x1c0029,_0x364d6a){_0x1c0029=_0x1c0029-0x0;var _0x521bfb=_0xdc01[_0x1c0029];return _0x521bfb;};'use strict';var Sequelize=require(_0x1dc0('0x0'));module[_0x1dc0('0x1')]={'name':{'type':Sequelize[_0x1dc0('0x2')],'allowNull':![],'unique':'name'},'prefix':{'type':Sequelize['VIRTUAL'],'get':function(_0x27ff90){return _0x1dc0('0x3')+this[_0x1dc0('0x4')](_0x1dc0('0x5'))+'-';}},'description':{'type':Sequelize['STRING']},'callerIdAll':{'type':Sequelize['STRING']},'VoiceExtensionId':{'type':Sequelize['INTEGER']}}; \ No newline at end of file +var _0x459c=['name','VIRTUAL','system-','getDataValue','STRING','exports'];(function(_0x341e0f,_0x4a09d0){var _0x59555a=function(_0x4343a8){while(--_0x4343a8){_0x341e0f['push'](_0x341e0f['shift']());}};_0x59555a(++_0x4a09d0);}(_0x459c,0x12b));var _0xc459=function(_0x5c3c65,_0x2ae544){_0x5c3c65=_0x5c3c65-0x0;var _0x51756e=_0x459c[_0x5c3c65];return _0x51756e;};'use strict';var Sequelize=require('sequelize');module[_0xc459('0x0')]={'name':{'type':Sequelize['STRING'],'allowNull':![],'unique':_0xc459('0x1')},'prefix':{'type':Sequelize[_0xc459('0x2')],'get':function(_0x29fdaa){return _0xc459('0x3')+this[_0xc459('0x4')](_0xc459('0x1'))+'-';}},'description':{'type':Sequelize[_0xc459('0x5')]},'callerIdAll':{'type':Sequelize[_0xc459('0x5')]},'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 d512071..f50ede8 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 _0xa91a=['transaction','create','body','VoiceExtension','VoiceExtensionId','user','UserProfileSection','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','context','exten','app','system','description','appdata','prefix','Voice\x20Prefix','VoicePrefixId','bulkCreate','Extensions\x20creation\x20failed','push','Set','CDR(prefix)=','callerIdAll','PREFIX-CALLERIDALL=','NoOp','${EXTEN:','charAt','update','system-','findById','addAgents','ids','omit','emit','userVoicePrefix:save','removeAgents','userVoicePrefix:remove','getAgents','findOne','User','nolimit','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','path','to-csv','crypto','desk.js','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../mysqldb','redis','localhost','socket.io-emitter','./voicePrefix.socket','sendStatus','status','json','offset','limit','set','Content-Range','apply','reject','save','then','destroy','get','VoicePrefixes','UserProfileResource','end','error','stack','name','send','index','map','rawAttributes','fieldName','type','key','query','keys','filters','intersection','attributes','model','fields','length','hasOwnProperty','order','sort','where','pick','filter','merge','count','includeAll','include','VoicePrefix','findAll','rows','catch','show','params','options','find','describe','sequelize'];(function(_0x54c01d,_0x38b8b7){var _0x5e7f08=function(_0x13bfc2){while(--_0x13bfc2){_0x54c01d['push'](_0x54c01d['shift']());}};_0x5e7f08(++_0x38b8b7);}(_0xa91a,0x192));var _0xaa91=function(_0x32d9c8,_0x38b7ae){_0x32d9c8=_0x32d9c8-0x0;var _0x16597f=_0xa91a[_0x32d9c8];return _0x16597f;};'use strict';var pdf=require(_0xaa91('0x0'));var emlformat=require(_0xaa91('0x1'));var rimraf=require(_0xaa91('0x2'));var zipdir=require(_0xaa91('0x3'));var jsonpatch=require(_0xaa91('0x4'));var rp=require(_0xaa91('0x5'));var moment=require('moment');var BPromise=require(_0xaa91('0x6'));var Mustache=require(_0xaa91('0x7'));var util=require('util');var path=require(_0xaa91('0x8'));var sox=require('sox');var csv=require(_0xaa91('0x9'));var ejs=require('ejs');var fs=require('fs');var _=require('lodash');var squel=require('squel');var crypto=require(_0xaa91('0xa'));var jsforce=require('jsforce');var deskjs=require(_0xaa91('0xb'));var toCsv=require(_0xaa91('0x9'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0xaa91('0xc'));var authService=require(_0xaa91('0xd'));var qs=require(_0xaa91('0xe'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xaa91('0xf'));var logger=require(_0xaa91('0x10'))(_0xaa91('0x11'));var utils=require(_0xaa91('0x12'));var config=require('../../config/environment');var db=require(_0xaa91('0x13'))['db'];config[_0xaa91('0x14')]=_['defaults'](config[_0xaa91('0x14')],{'host':_0xaa91('0x15'),'port':0x18eb});var socket=require(_0xaa91('0x16'))(new Redis(config[_0xaa91('0x14')]));require(_0xaa91('0x17'))['register'](socket);function respondWithStatusCode(_0x44ce0f,_0x3b5743){_0x3b5743=_0x3b5743||0xcc;return function(_0x3dd58b){if(_0x3dd58b){return _0x44ce0f[_0xaa91('0x18')](_0x3b5743);}return _0x44ce0f[_0xaa91('0x19')](_0x3b5743)['end']();};}function respondWithResult(_0x584576,_0x43cbaf){_0x43cbaf=_0x43cbaf||0xc8;return function(_0x25bd55){if(_0x25bd55){return _0x584576[_0xaa91('0x19')](_0x43cbaf)[_0xaa91('0x1a')](_0x25bd55);}};}function respondWithFilteredResult(_0x451c55,_0x49055b){return function(_0x12c5bb){if(_0x12c5bb){var _0x28633a=_0x12c5bb['count'],_0x11722e=_0x49055b[_0xaa91('0x1b')],_0x11e768=_0x49055b[_0xaa91('0x1b')]+_0x49055b[_0xaa91('0x1c')],_0x3a0c5d;if(_0x11e768>=_0x28633a){_0x11e768=_0x28633a;_0x3a0c5d=0xc8;}else{_0x3a0c5d=0xce;}_0x451c55['status'](_0x3a0c5d);return _0x451c55[_0xaa91('0x1d')](_0xaa91('0x1e'),_0x11722e+'-'+_0x11e768+'/'+_0x28633a)[_0xaa91('0x1a')](_0x12c5bb);}return null;};}function patchUpdates(_0x47bf87){return function(_0x3f027e){try{jsonpatch[_0xaa91('0x1f')](_0x3f027e,_0x47bf87,!![]);}catch(_0x26810b){return BPromise[_0xaa91('0x20')](_0x26810b);}return _0x3f027e[_0xaa91('0x21')]();};}function saveUpdates(_0x63e6d1,_0x4ce04c){return function(_0x3fe76b){if(_0x3fe76b){return _0x3fe76b['update'](_0x63e6d1)[_0xaa91('0x22')](function(_0x29c046){return _0x29c046;});}return null;};}function removeEntity(_0xe6f404,_0x216a11){return function(_0x154947){if(_0x154947){return _0x154947[_0xaa91('0x23')]()[_0xaa91('0x22')](function(){var _0x3efed7=_0x154947[_0xaa91('0x24')]({'plain':!![]});var _0x10519e=_0xaa91('0x25');return db[_0xaa91('0x26')]['destroy']({'where':{'type':_0x10519e,'resourceId':_0x3efed7['id']}})[_0xaa91('0x22')](function(){return _0x154947;});})[_0xaa91('0x22')](function(){_0xe6f404[_0xaa91('0x19')](0xcc)[_0xaa91('0x27')]();});}};}function handleEntityNotFound(_0x246b95,_0x5c307c){return function(_0x47beae){if(!_0x47beae){_0x246b95['sendStatus'](0x194);}return _0x47beae;};}function handleError(_0x3b2ce9,_0x1234e9){_0x1234e9=_0x1234e9||0x1f4;return function(_0x3c394c){logger[_0xaa91('0x28')](_0x3c394c[_0xaa91('0x29')]);if(_0x3c394c[_0xaa91('0x2a')]){delete _0x3c394c['name'];}_0x3b2ce9[_0xaa91('0x19')](_0x1234e9)[_0xaa91('0x2b')](_0x3c394c);};}exports[_0xaa91('0x2c')]=function(_0x4b98ad,_0x5240f2){var _0x48a2d0={},_0x28b40a={},_0x2b2372={'count':0x0,'rows':[]};var _0x5c223f=_[_0xaa91('0x2d')](db['VoicePrefix'][_0xaa91('0x2e')],function(_0x174161){return{'name':_0x174161[_0xaa91('0x2f')],'type':_0x174161[_0xaa91('0x30')][_0xaa91('0x31')]};});_0x28b40a['model']=_[_0xaa91('0x2d')](_0x5c223f,'name');_0x28b40a[_0xaa91('0x32')]=_[_0xaa91('0x33')](_0x4b98ad[_0xaa91('0x32')]);_0x28b40a[_0xaa91('0x34')]=_[_0xaa91('0x35')](_0x28b40a['model'],_0x28b40a[_0xaa91('0x32')]);_0x48a2d0[_0xaa91('0x36')]=_['intersection'](_0x28b40a[_0xaa91('0x37')],qs[_0xaa91('0x38')](_0x4b98ad['query'][_0xaa91('0x38')]));_0x48a2d0[_0xaa91('0x36')]=_0x48a2d0[_0xaa91('0x36')][_0xaa91('0x39')]?_0x48a2d0[_0xaa91('0x36')]:_0x28b40a[_0xaa91('0x37')];if(!_0x4b98ad[_0xaa91('0x32')][_0xaa91('0x3a')]('nolimit')){_0x48a2d0['limit']=qs['limit'](_0x4b98ad[_0xaa91('0x32')][_0xaa91('0x1c')]);_0x48a2d0[_0xaa91('0x1b')]=qs[_0xaa91('0x1b')](_0x4b98ad[_0xaa91('0x32')][_0xaa91('0x1b')]);}_0x48a2d0[_0xaa91('0x3b')]=qs[_0xaa91('0x3c')](_0x4b98ad[_0xaa91('0x32')][_0xaa91('0x3c')]);_0x48a2d0[_0xaa91('0x3d')]=qs['filters'](_[_0xaa91('0x3e')](_0x4b98ad[_0xaa91('0x32')],_0x28b40a[_0xaa91('0x34')]));if(_0x4b98ad[_0xaa91('0x32')][_0xaa91('0x3f')]){_0x48a2d0[_0xaa91('0x3d')]=_[_0xaa91('0x40')](_0x48a2d0['where'],{'$or':_[_0xaa91('0x2d')](_0x5c223f,function(_0x21a209){if(_0x21a209[_0xaa91('0x30')]!=='VIRTUAL'){var _0x47bf18={};_0x47bf18[_0x21a209[_0xaa91('0x2a')]]={'$like':'%'+_0x4b98ad[_0xaa91('0x32')][_0xaa91('0x3f')]+'%'};return _0x47bf18;}})});}_0x48a2d0=_[_0xaa91('0x40')]({},_0x48a2d0,_0x4b98ad['options']);var _0x7640d7={'where':_0x48a2d0[_0xaa91('0x3d')]};return db['VoicePrefix'][_0xaa91('0x41')](_0x7640d7)[_0xaa91('0x22')](function(_0x44ea60){_0x2b2372['count']=_0x44ea60;if(_0x4b98ad[_0xaa91('0x32')][_0xaa91('0x42')]){_0x48a2d0[_0xaa91('0x43')]=[{'all':!![]}];}return db[_0xaa91('0x44')][_0xaa91('0x45')](_0x48a2d0);})[_0xaa91('0x22')](function(_0x52dcad){_0x2b2372[_0xaa91('0x46')]=_0x52dcad;return _0x2b2372;})[_0xaa91('0x22')](respondWithFilteredResult(_0x5240f2,_0x48a2d0))[_0xaa91('0x47')](handleError(_0x5240f2,null));};exports[_0xaa91('0x48')]=function(_0x2efb2c,_0x2aca2f){var _0x39b30a={'raw':![],'where':{'id':_0x2efb2c[_0xaa91('0x49')]['id']}},_0x525ee2={};_0x525ee2[_0xaa91('0x37')]=_[_0xaa91('0x33')](db[_0xaa91('0x44')][_0xaa91('0x2e')]);_0x525ee2['query']=_['keys'](_0x2efb2c['query']);_0x525ee2[_0xaa91('0x34')]=_[_0xaa91('0x35')](_0x525ee2['model'],_0x525ee2['query']);_0x39b30a['attributes']=_[_0xaa91('0x35')](_0x525ee2['model'],qs[_0xaa91('0x38')](_0x2efb2c[_0xaa91('0x32')]['fields']));_0x39b30a['attributes']=_0x39b30a[_0xaa91('0x36')]['length']?_0x39b30a['attributes']:_0x525ee2[_0xaa91('0x37')];if(_0x2efb2c[_0xaa91('0x32')][_0xaa91('0x42')]){_0x39b30a[_0xaa91('0x43')]=[{'all':!![]}];}_0x39b30a=_['merge']({},_0x39b30a,_0x2efb2c[_0xaa91('0x4a')]);return db[_0xaa91('0x44')][_0xaa91('0x4b')](_0x39b30a)[_0xaa91('0x22')](handleEntityNotFound(_0x2aca2f,null))['then'](respondWithResult(_0x2aca2f,null))['catch'](handleError(_0x2aca2f,null));};exports[_0xaa91('0x23')]=function(_0x18891f,_0x1e15d3){return db['VoicePrefix'][_0xaa91('0x4b')]({'where':{'id':_0x18891f[_0xaa91('0x49')]['id']}})[_0xaa91('0x22')](handleEntityNotFound(_0x1e15d3,null))[_0xaa91('0x22')](removeEntity(_0x1e15d3,null))[_0xaa91('0x47')](handleError(_0x1e15d3,null));};exports['describe']=function(_0x5b0e85,_0x24bcba){return db[_0xaa91('0x44')][_0xaa91('0x4c')]()[_0xaa91('0x22')](respondWithResult(_0x24bcba,null))[_0xaa91('0x47')](handleError(_0x24bcba,null));};exports['create']=function(_0x4f98cd,_0x101c49){var _0x1d6b54;return db[_0xaa91('0x4d')][_0xaa91('0x4e')](function(_0x2955a6){return db['VoicePrefix'][_0xaa91('0x4f')](_0x4f98cd[_0xaa91('0x50')],{'transaction':_0x2955a6})[_0xaa91('0x22')](function(_0x312680){_0x1d6b54=_0x312680[_0xaa91('0x24')]({'plain':!![]});return db[_0xaa91('0x51')][_0xaa91('0x4b')]({'where':{'id':_0x1d6b54[_0xaa91('0x52')]},'raw':!![]})['then'](function(_0x520e0f){return createVoicePrefixExtensions(_0x1d6b54,_0x520e0f,_0x2955a6);});});})[_0xaa91('0x22')](function(){var _0x2979ab=_0x4f98cd['user'][_0xaa91('0x24')]({'plain':!![]});if(!_0x2979ab)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x2979ab['role']===_0xaa91('0x53')){var _0x5bf88a=_0x1d6b54;return db[_0xaa91('0x54')]['find']({'where':{'name':'VoicePrefixes','userProfileId':_0x2979ab['userProfileId']},'raw':!![]})['then'](function(_0x13bd9b){if(_0x13bd9b&&_0x13bd9b[_0xaa91('0x55')]===0x0){return db[_0xaa91('0x26')][_0xaa91('0x4f')]({'name':_0x5bf88a[_0xaa91('0x2a')],'resourceId':_0x5bf88a['id'],'type':_0x13bd9b[_0xaa91('0x2a')],'sectionId':_0x13bd9b['id']},{})[_0xaa91('0x22')](function(){return _0x1d6b54;});}else{return _0x1d6b54;}})[_0xaa91('0x47')](function(_0x379070){logger[_0xaa91('0x28')](_0xaa91('0x56'),_0x379070);throw _0x379070;});}return _0x1d6b54;})['then'](respondWithResult(_0x101c49,null))[_0xaa91('0x47')](handleError(_0x101c49,null));};function Extension(_0x4dd2b4,_0x15903f,_0x2363fb,_0x28c71c){this[_0xaa91('0x57')]='from-sip';this[_0xaa91('0x58')]=_0x4dd2b4;this[_0xaa91('0x59')]=_0x2363fb;this[_0xaa91('0x30')]=_0xaa91('0x5a');this[_0xaa91('0x5b')]='Voice\x20Prefix\x20Extension';this['priority']=_0x15903f;this[_0xaa91('0x5c')]=_0x28c71c;}function createVoicePrefixExtensions(_0x475dd4,_0x155f43,_0x50e6ad){return new BPromise(function(_0x2a1c47,_0x22c220){var _0x3ffd14=new Extension(formatPrefixName(_0x475dd4[_0xaa91('0x5d')]),0x1,'NoOp',_0xaa91('0x5e'));_0x3ffd14['VoicePrefixId']=_0x475dd4['id'];return db[_0xaa91('0x51')][_0xaa91('0x4f')](_0x3ffd14,{'transaction':_0x50e6ad})[_0xaa91('0x22')](function(_0x5448bf){var _0x4f266e=_0x5448bf[_0xaa91('0x24')]({'plain':!![]});var _0x3b2c09=_[_0xaa91('0x2d')](addVoicePrefixExtensions(_0x475dd4,_0x155f43),function(_0x18b0a7){_0x18b0a7[_0xaa91('0x52')]=_0x4f266e['id'];_0x18b0a7[_0xaa91('0x5f')]=_0x475dd4['id'];return _0x18b0a7;});return db[_0xaa91('0x51')][_0xaa91('0x60')](_0x3b2c09,{'transaction':_0x50e6ad})[_0xaa91('0x22')](function(_0x404359){if(!_0x404359){return _0x22c220(_0xaa91('0x61'));}else{return _0x2a1c47(_0x404359);}})['catch'](function(_0x3dc2cb){return _0x22c220(_0x3dc2cb);});});;});};function addVoicePrefixExtensions(_0x566844,_0x3e27c9){var _0x76843=[];var _0x1da0c9=formatPrefixName(_0x566844[_0xaa91('0x5d')]);_0x76843[_0xaa91('0x62')](new Extension(_0x1da0c9,0x2,_0xaa91('0x63'),_0xaa91('0x64')+_0x566844[_0xaa91('0x2a')]));if(_0x566844[_0xaa91('0x65')]){_0x76843['push'](new Extension(_0x1da0c9,0x3,_0xaa91('0x63'),_0xaa91('0x66')+_0x566844[_0xaa91('0x65')]));}else{_0x76843[_0xaa91('0x62')](new Extension(_0x1da0c9,0x3,_0xaa91('0x67'),'No\x20callerid\x20available'));}_0x76843['push'](new Extension(_0x1da0c9,0x4,'goto',_0x3e27c9[_0xaa91('0x57')]+','+_0xaa91('0x68')+(0x8+_0x566844[_0xaa91('0x2a')][_0xaa91('0x39')])+'}'+','+0x1));return _0x76843;}function formatPrefixName(_0x44ad9b){var _0x3365ea='_';for(var _0xc990a7=0x0;_0xc990a7<_0x44ad9b[_0xaa91('0x39')];_0xc990a7++){if(_0x44ad9b[_0xaa91('0x69')](_0xc990a7)=='-'){_0x3365ea+=_0x44ad9b[_0xaa91('0x69')](_0xc990a7);}else{_0x3365ea+='['+_0x44ad9b[_0xaa91('0x69')](_0xc990a7)+']';}}_0x3365ea+='.';return _0x3365ea;}exports[_0xaa91('0x6a')]=function(_0x2b5daa,_0x4801a1,_0x396794){var _0x2b5efd=_0x2b5daa['body'];_0x2b5efd[_0xaa91('0x5d')]=_0xaa91('0x6b')+_0x2b5efd[_0xaa91('0x2a')]+'-';return db[_0xaa91('0x4d')][_0xaa91('0x4e')](function(_0x26fab8){return db[_0xaa91('0x44')][_0xaa91('0x6a')](_0x2b5efd,{'where':{'id':_0x2b5efd['id']},'transaction':_0x26fab8})[_0xaa91('0x22')](function(){return db[_0xaa91('0x51')][_0xaa91('0x23')]({'where':{'VoicePrefixId':_0x2b5efd['id']},'transaction':_0x26fab8})[_0xaa91('0x22')](function(){return db[_0xaa91('0x51')]['find']({'where':{'id':_0x2b5efd['VoiceExtensionId']},'raw':!![]})['then'](function(_0x3c834e){return createVoicePrefixExtensions(_0x2b5efd,_0x3c834e,_0x26fab8);});});});})[_0xaa91('0x22')](function(){return db[_0xaa91('0x44')][_0xaa91('0x6c')](_0x2b5efd['id']);})['then'](respondWithResult(_0x4801a1,null))['catch'](handleError(_0x4801a1,null));};exports[_0xaa91('0x6d')]=function(_0x3e6202,_0x52fbaa,_0x4fe422){return db['VoicePrefix']['find']({'where':{'id':_0x3e6202[_0xaa91('0x49')]['id']}})[_0xaa91('0x22')](handleEntityNotFound(_0x52fbaa,null))[_0xaa91('0x22')](function(_0x41bb1d){if(_0x41bb1d){return _0x41bb1d[_0xaa91('0x6d')](_0x3e6202[_0xaa91('0x50')][_0xaa91('0x6e')],_[_0xaa91('0x6f')](_0x3e6202['body'],['ids','id'])||{})['spread'](function(_0x5074a7){for(var _0x44930=0x0;_0x44930<_0x3e6202[_0xaa91('0x50')][_0xaa91('0x6e')][_0xaa91('0x39')];_0x44930+=0x1){socket[_0xaa91('0x70')](_0xaa91('0x71'),{'UserId':_0x3e6202[_0xaa91('0x50')][_0xaa91('0x6e')][_0x44930],'VoicePrefixId':_0x3e6202['params']['id']});}return _0x5074a7;});}})['then'](respondWithResult(_0x52fbaa,null))[_0xaa91('0x47')](handleError(_0x52fbaa,null));};exports[_0xaa91('0x72')]=function(_0x1c34c3,_0x5e16f4,_0x5345f0){return db[_0xaa91('0x44')][_0xaa91('0x4b')]({'where':{'id':_0x1c34c3['params']['id']}})['then'](handleEntityNotFound(_0x5e16f4,null))['then'](function(_0x403840){if(_0x403840){return _0x403840[_0xaa91('0x72')](_0x1c34c3[_0xaa91('0x32')]['ids'])['then'](function(){if(_['isArray'](_0x1c34c3[_0xaa91('0x32')]['ids'])){for(var _0x1348ba=0x0;_0x1348ba<_0x1c34c3[_0xaa91('0x32')][_0xaa91('0x6e')][_0xaa91('0x39')];_0x1348ba+=0x1){socket[_0xaa91('0x70')](_0xaa91('0x73'),{'UserId':Number(_0x1c34c3['query']['ids'][_0x1348ba]),'VoicePrefixId':Number(_0x1c34c3['params']['id'])});}}else{socket[_0xaa91('0x70')](_0xaa91('0x73'),{'UserId':Number(_0x1c34c3[_0xaa91('0x32')][_0xaa91('0x6e')]),'VoicePrefixId':Number(_0x1c34c3[_0xaa91('0x49')]['id'])});}});}})[_0xaa91('0x22')](respondWithStatusCode(_0x5e16f4,null))[_0xaa91('0x47')](handleError(_0x5e16f4,null));};exports[_0xaa91('0x74')]=function(_0x22c938,_0x256e84,_0x374b20){var _0x2c7a25={};var _0x461cef={};var _0x3c69eb;var _0x33f4e8;return db[_0xaa91('0x44')][_0xaa91('0x75')]({'where':{'id':_0x22c938[_0xaa91('0x49')]['id']}})['then'](handleEntityNotFound(_0x256e84,null))[_0xaa91('0x22')](function(_0x11ac10){if(_0x11ac10){_0x3c69eb=_0x11ac10;_0x461cef[_0xaa91('0x37')]=_[_0xaa91('0x33')](db[_0xaa91('0x76')][_0xaa91('0x2e')]);_0x461cef[_0xaa91('0x32')]=_[_0xaa91('0x33')](_0x22c938[_0xaa91('0x32')]);_0x461cef[_0xaa91('0x34')]=_[_0xaa91('0x35')](_0x461cef[_0xaa91('0x37')],_0x461cef['query']);_0x2c7a25[_0xaa91('0x36')]=_['intersection'](_0x461cef[_0xaa91('0x37')],qs['fields'](_0x22c938[_0xaa91('0x32')][_0xaa91('0x38')]));_0x2c7a25[_0xaa91('0x36')]=_0x2c7a25[_0xaa91('0x36')][_0xaa91('0x39')]?_0x2c7a25[_0xaa91('0x36')]:_0x461cef[_0xaa91('0x37')];_0x2c7a25['order']=qs[_0xaa91('0x3c')](_0x22c938[_0xaa91('0x32')][_0xaa91('0x3c')]);_0x2c7a25[_0xaa91('0x3d')]=qs[_0xaa91('0x34')](_['pick'](_0x22c938['query'],_0x461cef[_0xaa91('0x34')]));if(_0x22c938['query'][_0xaa91('0x3f')]){_0x2c7a25[_0xaa91('0x3d')]=_[_0xaa91('0x40')](_0x2c7a25[_0xaa91('0x3d')],{'$or':_[_0xaa91('0x2d')](_0x2c7a25[_0xaa91('0x36')],function(_0x3928b4){var _0x1b926d={};_0x1b926d[_0x3928b4]={'$like':'%'+_0x22c938[_0xaa91('0x32')]['filter']+'%'};return _0x1b926d;})});}_0x2c7a25=_[_0xaa91('0x40')]({},_0x2c7a25,_0x22c938['options']);return _0x3c69eb[_0xaa91('0x74')](_0x2c7a25);}})[_0xaa91('0x22')](function(_0x505e2c){if(_0x505e2c){_0x33f4e8=_0x505e2c[_0xaa91('0x39')];if(!_0x22c938['query']['hasOwnProperty'](_0xaa91('0x77'))){_0x2c7a25[_0xaa91('0x1c')]=qs[_0xaa91('0x1c')](_0x22c938['query'][_0xaa91('0x1c')]);_0x2c7a25[_0xaa91('0x1b')]=qs[_0xaa91('0x1b')](_0x22c938[_0xaa91('0x32')][_0xaa91('0x1b')]);}return _0x3c69eb['getAgents'](_0x2c7a25);}})[_0xaa91('0x22')](function(_0x254f8e){if(_0x254f8e){return _0x254f8e?{'count':_0x33f4e8,'rows':_0x254f8e}:null;}})[_0xaa91('0x22')](respondWithResult(_0x256e84,null))[_0xaa91('0x47')](handleError(_0x256e84,null));}; \ No newline at end of file +var _0x7c00=['path','sox','to-csv','lodash','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../mysqldb','redis','defaults','localhost','socket.io-emitter','register','status','end','count','offset','limit','set','Content-Range','json','reject','save','update','then','get','VoicePrefixes','UserProfileResource','sendStatus','error','stack','name','send','index','map','VoicePrefix','rawAttributes','fieldName','type','key','model','keys','query','filters','attributes','fields','length','nolimit','sort','where','pick','merge','filter','options','includeAll','include','findAll','rows','catch','show','intersection','find','destroy','describe','create','body','VoiceExtension','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','from-sip','exten','app','system','description','priority','appdata','NoOp','Voice\x20Prefix','VoicePrefixId','bulkCreate','Extensions\x20creation\x20failed','Set','callerIdAll','PREFIX-CALLERIDALL=','push','No\x20callerid\x20available','goto','context','charAt','prefix','system-','sequelize','transaction','VoiceExtensionId','findById','params','ids','omit','spread','emit','userVoicePrefix:save','removeAgents','isArray','userVoicePrefix:remove','getAgents','findOne','order','hasOwnProperty','html-pdf','eml-format','zip-dir','fast-json-patch','request-promise','bluebird','util'];(function(_0x334688,_0xf68c2c){var _0x42dc15=function(_0x17f90a){while(--_0x17f90a){_0x334688['push'](_0x334688['shift']());}};_0x42dc15(++_0xf68c2c);}(_0x7c00,0x77));var _0x07c0=function(_0x3c5765,_0x5bc24c){_0x3c5765=_0x3c5765-0x0;var _0x3c6b1b=_0x7c00[_0x3c5765];return _0x3c6b1b;};'use strict';var pdf=require(_0x07c0('0x0'));var emlformat=require(_0x07c0('0x1'));var rimraf=require('rimraf');var zipdir=require(_0x07c0('0x2'));var jsonpatch=require(_0x07c0('0x3'));var rp=require(_0x07c0('0x4'));var moment=require('moment');var BPromise=require(_0x07c0('0x5'));var Mustache=require('mustache');var util=require(_0x07c0('0x6'));var path=require(_0x07c0('0x7'));var sox=require(_0x07c0('0x8'));var csv=require(_0x07c0('0x9'));var ejs=require('ejs');var fs=require('fs');var _=require(_0x07c0('0xa'));var squel=require(_0x07c0('0xb'));var crypto=require(_0x07c0('0xc'));var jsforce=require('jsforce');var deskjs=require(_0x07c0('0xd'));var toCsv=require('to-csv');var querystring=require(_0x07c0('0xe'));var Papa=require(_0x07c0('0xf'));var Redis=require(_0x07c0('0x10'));var authService=require(_0x07c0('0x11'));var qs=require(_0x07c0('0x12'));var as=require(_0x07c0('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x07c0('0x14'))('api');var utils=require(_0x07c0('0x15'));var config=require('../../config/environment');var db=require(_0x07c0('0x16'))['db'];config[_0x07c0('0x17')]=_[_0x07c0('0x18')](config[_0x07c0('0x17')],{'host':_0x07c0('0x19'),'port':0x18eb});var socket=require(_0x07c0('0x1a'))(new Redis(config[_0x07c0('0x17')]));require('./voicePrefix.socket')[_0x07c0('0x1b')](socket);function respondWithStatusCode(_0x255f37,_0x4f9f06){_0x4f9f06=_0x4f9f06||0xcc;return function(_0x46a622){if(_0x46a622){return _0x255f37['sendStatus'](_0x4f9f06);}return _0x255f37[_0x07c0('0x1c')](_0x4f9f06)[_0x07c0('0x1d')]();};}function respondWithResult(_0x376e74,_0x1f1f08){_0x1f1f08=_0x1f1f08||0xc8;return function(_0x46689a){if(_0x46689a){return _0x376e74[_0x07c0('0x1c')](_0x1f1f08)['json'](_0x46689a);}};}function respondWithFilteredResult(_0xbf3625,_0x39901b){return function(_0x28e903){if(_0x28e903){var _0x1eaaea=_0x28e903[_0x07c0('0x1e')],_0x5f4c19=_0x39901b[_0x07c0('0x1f')],_0x3f0c8e=_0x39901b[_0x07c0('0x1f')]+_0x39901b[_0x07c0('0x20')],_0x54eb54;if(_0x3f0c8e>=_0x1eaaea){_0x3f0c8e=_0x1eaaea;_0x54eb54=0xc8;}else{_0x54eb54=0xce;}_0xbf3625[_0x07c0('0x1c')](_0x54eb54);return _0xbf3625[_0x07c0('0x21')](_0x07c0('0x22'),_0x5f4c19+'-'+_0x3f0c8e+'/'+_0x1eaaea)[_0x07c0('0x23')](_0x28e903);}return null;};}function patchUpdates(_0x5ce060){return function(_0x2ae3c6){try{jsonpatch['apply'](_0x2ae3c6,_0x5ce060,!![]);}catch(_0x3c9d22){return BPromise[_0x07c0('0x24')](_0x3c9d22);}return _0x2ae3c6[_0x07c0('0x25')]();};}function saveUpdates(_0x1f4a9b,_0x34b57a){return function(_0x3b9708){if(_0x3b9708){return _0x3b9708[_0x07c0('0x26')](_0x1f4a9b)['then'](function(_0x493dad){return _0x493dad;});}return null;};}function removeEntity(_0x2a56a0,_0xf3a01a){return function(_0x37f373){if(_0x37f373){return _0x37f373['destroy']()[_0x07c0('0x27')](function(){var _0xf568d7=_0x37f373[_0x07c0('0x28')]({'plain':!![]});var _0x2ab50e=_0x07c0('0x29');return db[_0x07c0('0x2a')]['destroy']({'where':{'type':_0x2ab50e,'resourceId':_0xf568d7['id']}})[_0x07c0('0x27')](function(){return _0x37f373;});})['then'](function(){_0x2a56a0[_0x07c0('0x1c')](0xcc)[_0x07c0('0x1d')]();});}};}function handleEntityNotFound(_0x480b8e,_0x8c9496){return function(_0x1565fd){if(!_0x1565fd){_0x480b8e[_0x07c0('0x2b')](0x194);}return _0x1565fd;};}function handleError(_0x2d995a,_0x32816c){_0x32816c=_0x32816c||0x1f4;return function(_0x46e97d){logger[_0x07c0('0x2c')](_0x46e97d[_0x07c0('0x2d')]);if(_0x46e97d[_0x07c0('0x2e')]){delete _0x46e97d[_0x07c0('0x2e')];}_0x2d995a[_0x07c0('0x1c')](_0x32816c)[_0x07c0('0x2f')](_0x46e97d);};}exports[_0x07c0('0x30')]=function(_0x5de688,_0x43e116){var _0x2d69a3={},_0x99d444={},_0x4ffb7f={'count':0x0,'rows':[]};var _0x52a383=_[_0x07c0('0x31')](db[_0x07c0('0x32')][_0x07c0('0x33')],function(_0x294785){return{'name':_0x294785[_0x07c0('0x34')],'type':_0x294785[_0x07c0('0x35')][_0x07c0('0x36')]};});_0x99d444[_0x07c0('0x37')]=_['map'](_0x52a383,'name');_0x99d444['query']=_[_0x07c0('0x38')](_0x5de688[_0x07c0('0x39')]);_0x99d444[_0x07c0('0x3a')]=_['intersection'](_0x99d444['model'],_0x99d444['query']);_0x2d69a3[_0x07c0('0x3b')]=_['intersection'](_0x99d444[_0x07c0('0x37')],qs[_0x07c0('0x3c')](_0x5de688[_0x07c0('0x39')][_0x07c0('0x3c')]));_0x2d69a3[_0x07c0('0x3b')]=_0x2d69a3[_0x07c0('0x3b')][_0x07c0('0x3d')]?_0x2d69a3[_0x07c0('0x3b')]:_0x99d444[_0x07c0('0x37')];if(!_0x5de688[_0x07c0('0x39')]['hasOwnProperty'](_0x07c0('0x3e'))){_0x2d69a3[_0x07c0('0x20')]=qs[_0x07c0('0x20')](_0x5de688[_0x07c0('0x39')][_0x07c0('0x20')]);_0x2d69a3['offset']=qs['offset'](_0x5de688['query'][_0x07c0('0x1f')]);}_0x2d69a3['order']=qs[_0x07c0('0x3f')](_0x5de688['query']['sort']);_0x2d69a3[_0x07c0('0x40')]=qs[_0x07c0('0x3a')](_[_0x07c0('0x41')](_0x5de688[_0x07c0('0x39')],_0x99d444[_0x07c0('0x3a')]));if(_0x5de688[_0x07c0('0x39')]['filter']){_0x2d69a3[_0x07c0('0x40')]=_[_0x07c0('0x42')](_0x2d69a3[_0x07c0('0x40')],{'$or':_[_0x07c0('0x31')](_0x52a383,function(_0x2445e1){if(_0x2445e1['type']!=='VIRTUAL'){var _0x1a8217={};_0x1a8217[_0x2445e1[_0x07c0('0x2e')]]={'$like':'%'+_0x5de688[_0x07c0('0x39')][_0x07c0('0x43')]+'%'};return _0x1a8217;}})});}_0x2d69a3=_[_0x07c0('0x42')]({},_0x2d69a3,_0x5de688[_0x07c0('0x44')]);var _0x376280={'where':_0x2d69a3['where']};return db[_0x07c0('0x32')]['count'](_0x376280)['then'](function(_0xdfac2){_0x4ffb7f[_0x07c0('0x1e')]=_0xdfac2;if(_0x5de688[_0x07c0('0x39')][_0x07c0('0x45')]){_0x2d69a3[_0x07c0('0x46')]=[{'all':!![]}];}return db[_0x07c0('0x32')][_0x07c0('0x47')](_0x2d69a3);})[_0x07c0('0x27')](function(_0x3513bd){_0x4ffb7f[_0x07c0('0x48')]=_0x3513bd;return _0x4ffb7f;})[_0x07c0('0x27')](respondWithFilteredResult(_0x43e116,_0x2d69a3))[_0x07c0('0x49')](handleError(_0x43e116,null));};exports[_0x07c0('0x4a')]=function(_0x20ecde,_0x165730){var _0x29cc16={'raw':![],'where':{'id':_0x20ecde['params']['id']}},_0x73fee2={};_0x73fee2[_0x07c0('0x37')]=_[_0x07c0('0x38')](db[_0x07c0('0x32')]['rawAttributes']);_0x73fee2[_0x07c0('0x39')]=_[_0x07c0('0x38')](_0x20ecde[_0x07c0('0x39')]);_0x73fee2[_0x07c0('0x3a')]=_['intersection'](_0x73fee2[_0x07c0('0x37')],_0x73fee2[_0x07c0('0x39')]);_0x29cc16[_0x07c0('0x3b')]=_[_0x07c0('0x4b')](_0x73fee2[_0x07c0('0x37')],qs[_0x07c0('0x3c')](_0x20ecde['query'][_0x07c0('0x3c')]));_0x29cc16[_0x07c0('0x3b')]=_0x29cc16['attributes'][_0x07c0('0x3d')]?_0x29cc16['attributes']:_0x73fee2[_0x07c0('0x37')];if(_0x20ecde['query'][_0x07c0('0x45')]){_0x29cc16[_0x07c0('0x46')]=[{'all':!![]}];}_0x29cc16=_[_0x07c0('0x42')]({},_0x29cc16,_0x20ecde[_0x07c0('0x44')]);return db[_0x07c0('0x32')][_0x07c0('0x4c')](_0x29cc16)[_0x07c0('0x27')](handleEntityNotFound(_0x165730,null))['then'](respondWithResult(_0x165730,null))[_0x07c0('0x49')](handleError(_0x165730,null));};exports[_0x07c0('0x4d')]=function(_0x5d2d88,_0x8173d6){return db[_0x07c0('0x32')]['find']({'where':{'id':_0x5d2d88['params']['id']}})[_0x07c0('0x27')](handleEntityNotFound(_0x8173d6,null))['then'](removeEntity(_0x8173d6,null))['catch'](handleError(_0x8173d6,null));};exports[_0x07c0('0x4e')]=function(_0x588122,_0x14f59b){return db[_0x07c0('0x32')]['describe']()[_0x07c0('0x27')](respondWithResult(_0x14f59b,null))[_0x07c0('0x49')](handleError(_0x14f59b,null));};exports[_0x07c0('0x4f')]=function(_0x53faa1,_0x2617e8){var _0xfe4a;return db['sequelize']['transaction'](function(_0x1a0fc0){return db[_0x07c0('0x32')][_0x07c0('0x4f')](_0x53faa1[_0x07c0('0x50')],{'transaction':_0x1a0fc0})[_0x07c0('0x27')](function(_0x2ca5e1){_0xfe4a=_0x2ca5e1[_0x07c0('0x28')]({'plain':!![]});return db[_0x07c0('0x51')]['find']({'where':{'id':_0xfe4a['VoiceExtensionId']},'raw':!![]})[_0x07c0('0x27')](function(_0x51aef1){return createVoicePrefixExtensions(_0xfe4a,_0x51aef1,_0x1a0fc0);});});})['then'](function(){var _0x538bf5=_0x53faa1[_0x07c0('0x52')][_0x07c0('0x28')]({'plain':!![]});if(!_0x538bf5)throw new Error(_0x07c0('0x53'));if(_0x538bf5['role']===_0x07c0('0x52')){var _0xa737cd=_0xfe4a;return db[_0x07c0('0x54')]['find']({'where':{'name':_0x07c0('0x29'),'userProfileId':_0x538bf5[_0x07c0('0x55')]},'raw':!![]})['then'](function(_0x39825e){if(_0x39825e&&_0x39825e['autoAssociation']===0x0){return db[_0x07c0('0x2a')][_0x07c0('0x4f')]({'name':_0xa737cd[_0x07c0('0x2e')],'resourceId':_0xa737cd['id'],'type':_0x39825e['name'],'sectionId':_0x39825e['id']},{})[_0x07c0('0x27')](function(){return _0xfe4a;});}else{return _0xfe4a;}})[_0x07c0('0x49')](function(_0x2fbca3){logger[_0x07c0('0x2c')](_0x07c0('0x56'),_0x2fbca3);throw _0x2fbca3;});}return _0xfe4a;})[_0x07c0('0x27')](respondWithResult(_0x2617e8,null))['catch'](handleError(_0x2617e8,null));};function Extension(_0x1d3f17,_0x5600d5,_0x41776b,_0x12a1fe){this['context']=_0x07c0('0x57');this[_0x07c0('0x58')]=_0x1d3f17;this[_0x07c0('0x59')]=_0x41776b;this[_0x07c0('0x35')]=_0x07c0('0x5a');this[_0x07c0('0x5b')]='Voice\x20Prefix\x20Extension';this[_0x07c0('0x5c')]=_0x5600d5;this[_0x07c0('0x5d')]=_0x12a1fe;}function createVoicePrefixExtensions(_0x26b128,_0x4d23ec,_0x33f73c){return new BPromise(function(_0x1deb67,_0x45e9cb){var _0x5def68=new Extension(formatPrefixName(_0x26b128['prefix']),0x1,_0x07c0('0x5e'),_0x07c0('0x5f'));_0x5def68['VoicePrefixId']=_0x26b128['id'];return db[_0x07c0('0x51')][_0x07c0('0x4f')](_0x5def68,{'transaction':_0x33f73c})[_0x07c0('0x27')](function(_0x2c3019){var _0x204ba2=_0x2c3019[_0x07c0('0x28')]({'plain':!![]});var _0x8a1826=_[_0x07c0('0x31')](addVoicePrefixExtensions(_0x26b128,_0x4d23ec),function(_0x2b968b){_0x2b968b['VoiceExtensionId']=_0x204ba2['id'];_0x2b968b[_0x07c0('0x60')]=_0x26b128['id'];return _0x2b968b;});return db['VoiceExtension'][_0x07c0('0x61')](_0x8a1826,{'transaction':_0x33f73c})[_0x07c0('0x27')](function(_0x33530d){if(!_0x33530d){return _0x45e9cb(_0x07c0('0x62'));}else{return _0x1deb67(_0x33530d);}})[_0x07c0('0x49')](function(_0x521a8b){return _0x45e9cb(_0x521a8b);});});;});};function addVoicePrefixExtensions(_0x3ba15b,_0x2f3e9f){var _0x508f0f=[];var _0x30768a=formatPrefixName(_0x3ba15b['prefix']);_0x508f0f['push'](new Extension(_0x30768a,0x2,_0x07c0('0x63'),'CDR(prefix)='+_0x3ba15b['name']));if(_0x3ba15b[_0x07c0('0x64')]){_0x508f0f['push'](new Extension(_0x30768a,0x3,_0x07c0('0x63'),_0x07c0('0x65')+_0x3ba15b[_0x07c0('0x64')]));}else{_0x508f0f[_0x07c0('0x66')](new Extension(_0x30768a,0x3,_0x07c0('0x5e'),_0x07c0('0x67')));}_0x508f0f['push'](new Extension(_0x30768a,0x4,_0x07c0('0x68'),_0x2f3e9f[_0x07c0('0x69')]+','+'${EXTEN:'+(0x8+_0x3ba15b['name']['length'])+'}'+','+0x1));return _0x508f0f;}function formatPrefixName(_0x471e3c){var _0x339868='_';for(var _0x37e6fd=0x0;_0x37e6fd<_0x471e3c[_0x07c0('0x3d')];_0x37e6fd++){if(_0x471e3c['charAt'](_0x37e6fd)=='-'){_0x339868+=_0x471e3c['charAt'](_0x37e6fd);}else{_0x339868+='['+_0x471e3c[_0x07c0('0x6a')](_0x37e6fd)+']';}}_0x339868+='.';return _0x339868;}exports[_0x07c0('0x26')]=function(_0x2242cc,_0x1fb002,_0x5bdff8){var _0x5bca6d=_0x2242cc[_0x07c0('0x50')];_0x5bca6d[_0x07c0('0x6b')]=_0x07c0('0x6c')+_0x5bca6d['name']+'-';return db[_0x07c0('0x6d')][_0x07c0('0x6e')](function(_0x49fc82){return db[_0x07c0('0x32')]['update'](_0x5bca6d,{'where':{'id':_0x5bca6d['id']},'transaction':_0x49fc82})[_0x07c0('0x27')](function(){return db[_0x07c0('0x51')]['destroy']({'where':{'VoicePrefixId':_0x5bca6d['id']},'transaction':_0x49fc82})['then'](function(){return db['VoiceExtension']['find']({'where':{'id':_0x5bca6d[_0x07c0('0x6f')]},'raw':!![]})[_0x07c0('0x27')](function(_0x2d5b26){return createVoicePrefixExtensions(_0x5bca6d,_0x2d5b26,_0x49fc82);});});});})[_0x07c0('0x27')](function(){return db[_0x07c0('0x32')][_0x07c0('0x70')](_0x5bca6d['id']);})[_0x07c0('0x27')](respondWithResult(_0x1fb002,null))[_0x07c0('0x49')](handleError(_0x1fb002,null));};exports['addAgents']=function(_0x4a101a,_0x1283f5,_0x13eba7){return db[_0x07c0('0x32')][_0x07c0('0x4c')]({'where':{'id':_0x4a101a[_0x07c0('0x71')]['id']}})[_0x07c0('0x27')](handleEntityNotFound(_0x1283f5,null))['then'](function(_0x11a3a5){if(_0x11a3a5){return _0x11a3a5['addAgents'](_0x4a101a[_0x07c0('0x50')][_0x07c0('0x72')],_[_0x07c0('0x73')](_0x4a101a['body'],[_0x07c0('0x72'),'id'])||{})[_0x07c0('0x74')](function(_0x56f75e){for(var _0x52fcff=0x0;_0x52fcff<_0x4a101a[_0x07c0('0x50')][_0x07c0('0x72')][_0x07c0('0x3d')];_0x52fcff+=0x1){socket[_0x07c0('0x75')](_0x07c0('0x76'),{'UserId':_0x4a101a[_0x07c0('0x50')][_0x07c0('0x72')][_0x52fcff],'VoicePrefixId':_0x4a101a[_0x07c0('0x71')]['id']});}return _0x56f75e;});}})[_0x07c0('0x27')](respondWithResult(_0x1283f5,null))['catch'](handleError(_0x1283f5,null));};exports['removeAgents']=function(_0x1869c9,_0x18315e,_0x2c06f){return db[_0x07c0('0x32')]['find']({'where':{'id':_0x1869c9[_0x07c0('0x71')]['id']}})[_0x07c0('0x27')](handleEntityNotFound(_0x18315e,null))['then'](function(_0x14cb2c){if(_0x14cb2c){return _0x14cb2c[_0x07c0('0x77')](_0x1869c9['query'][_0x07c0('0x72')])[_0x07c0('0x27')](function(){if(_[_0x07c0('0x78')](_0x1869c9[_0x07c0('0x39')][_0x07c0('0x72')])){for(var _0xe2f9d=0x0;_0xe2f9d<_0x1869c9['query'][_0x07c0('0x72')][_0x07c0('0x3d')];_0xe2f9d+=0x1){socket['emit'](_0x07c0('0x79'),{'UserId':Number(_0x1869c9[_0x07c0('0x39')][_0x07c0('0x72')][_0xe2f9d]),'VoicePrefixId':Number(_0x1869c9[_0x07c0('0x71')]['id'])});}}else{socket[_0x07c0('0x75')](_0x07c0('0x79'),{'UserId':Number(_0x1869c9['query']['ids']),'VoicePrefixId':Number(_0x1869c9[_0x07c0('0x71')]['id'])});}});}})[_0x07c0('0x27')](respondWithStatusCode(_0x18315e,null))[_0x07c0('0x49')](handleError(_0x18315e,null));};exports[_0x07c0('0x7a')]=function(_0xa085a0,_0x492111,_0x5ed683){var _0x598ece={};var _0xbe1eef={};var _0x4748ff;var _0x2c8239;return db[_0x07c0('0x32')][_0x07c0('0x7b')]({'where':{'id':_0xa085a0[_0x07c0('0x71')]['id']}})['then'](handleEntityNotFound(_0x492111,null))[_0x07c0('0x27')](function(_0x1c972b){if(_0x1c972b){_0x4748ff=_0x1c972b;_0xbe1eef[_0x07c0('0x37')]=_[_0x07c0('0x38')](db['User'][_0x07c0('0x33')]);_0xbe1eef[_0x07c0('0x39')]=_['keys'](_0xa085a0[_0x07c0('0x39')]);_0xbe1eef[_0x07c0('0x3a')]=_[_0x07c0('0x4b')](_0xbe1eef[_0x07c0('0x37')],_0xbe1eef[_0x07c0('0x39')]);_0x598ece[_0x07c0('0x3b')]=_[_0x07c0('0x4b')](_0xbe1eef[_0x07c0('0x37')],qs[_0x07c0('0x3c')](_0xa085a0[_0x07c0('0x39')][_0x07c0('0x3c')]));_0x598ece['attributes']=_0x598ece[_0x07c0('0x3b')][_0x07c0('0x3d')]?_0x598ece[_0x07c0('0x3b')]:_0xbe1eef[_0x07c0('0x37')];_0x598ece[_0x07c0('0x7c')]=qs[_0x07c0('0x3f')](_0xa085a0[_0x07c0('0x39')]['sort']);_0x598ece['where']=qs[_0x07c0('0x3a')](_[_0x07c0('0x41')](_0xa085a0[_0x07c0('0x39')],_0xbe1eef[_0x07c0('0x3a')]));if(_0xa085a0[_0x07c0('0x39')][_0x07c0('0x43')]){_0x598ece[_0x07c0('0x40')]=_[_0x07c0('0x42')](_0x598ece[_0x07c0('0x40')],{'$or':_['map'](_0x598ece[_0x07c0('0x3b')],function(_0x183f0e){var _0x2708b6={};_0x2708b6[_0x183f0e]={'$like':'%'+_0xa085a0['query']['filter']+'%'};return _0x2708b6;})});}_0x598ece=_[_0x07c0('0x42')]({},_0x598ece,_0xa085a0[_0x07c0('0x44')]);return _0x4748ff[_0x07c0('0x7a')](_0x598ece);}})[_0x07c0('0x27')](function(_0x33934d){if(_0x33934d){_0x2c8239=_0x33934d[_0x07c0('0x3d')];if(!_0xa085a0[_0x07c0('0x39')][_0x07c0('0x7d')](_0x07c0('0x3e'))){_0x598ece['limit']=qs['limit'](_0xa085a0['query'][_0x07c0('0x20')]);_0x598ece['offset']=qs[_0x07c0('0x1f')](_0xa085a0[_0x07c0('0x39')][_0x07c0('0x1f')]);}return _0x4748ff['getAgents'](_0x598ece);}})[_0x07c0('0x27')](function(_0x573721){if(_0x573721){return _0x573721?{'count':_0x2c8239,'rows':_0x573721}:null;}})[_0x07c0('0x27')](respondWithResult(_0x492111,null))[_0x07c0('0x49')](handleError(_0x492111,null));}; \ No newline at end of file diff --git a/server/api/voicePrefix/voicePrefix.events.js b/server/api/voicePrefix/voicePrefix.events.js index 683d389..d79f36d 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 _0xa9e0=['hasOwnProperty','hook','exports','events','../../mysqldb','VoicePrefix','update','emit'];(function(_0x25248b,_0x3c8491){var _0x509939=function(_0x457a27){while(--_0x457a27){_0x25248b['push'](_0x25248b['shift']());}};_0x509939(++_0x3c8491);}(_0xa9e0,0x123));var _0x0a9e=function(_0x30ae5e,_0x391fc4){_0x30ae5e=_0x30ae5e-0x0;var _0x1f2e93=_0xa9e0[_0x30ae5e];return _0x1f2e93;};'use strict';var EventEmitter=require(_0x0a9e('0x0'));var VoicePrefix=require(_0x0a9e('0x1'))['db'][_0x0a9e('0x2')];var VoicePrefixEvents=new EventEmitter();VoicePrefixEvents['setMaxListeners'](0x0);var events={'afterCreate':'save','afterUpdate':_0x0a9e('0x3'),'afterDestroy':'remove'};function emitEvent(_0x333808){return function(_0x432180,_0x2ab90b,_0x991246){VoicePrefixEvents[_0x0a9e('0x4')](_0x333808+':'+_0x432180['id'],_0x432180);VoicePrefixEvents['emit'](_0x333808,_0x432180);_0x991246(null);};}for(var e in events){if(events[_0x0a9e('0x5')](e)){var event=events[e];VoicePrefix[_0x0a9e('0x6')](e,emitEvent(event));}}module[_0x0a9e('0x7')]=VoicePrefixEvents; \ No newline at end of file +var _0xcb91=['save','update','emit','hasOwnProperty','hook','VoicePrefix','setMaxListeners'];(function(_0x13a26c,_0x3fab9a){var _0x2b06b7=function(_0x4ed734){while(--_0x4ed734){_0x13a26c['push'](_0x13a26c['shift']());}};_0x2b06b7(++_0x3fab9a);}(_0xcb91,0x1a9));var _0x1cb9=function(_0x3a8dc1,_0x2f03b8){_0x3a8dc1=_0x3a8dc1-0x0;var _0x4b3595=_0xcb91[_0x3a8dc1];return _0x4b3595;};'use strict';var EventEmitter=require('events');var VoicePrefix=require('../../mysqldb')['db'][_0x1cb9('0x0')];var VoicePrefixEvents=new EventEmitter();VoicePrefixEvents[_0x1cb9('0x1')](0x0);var events={'afterCreate':_0x1cb9('0x2'),'afterUpdate':_0x1cb9('0x3'),'afterDestroy':'remove'};function emitEvent(_0x8c392f){return function(_0x2c17b8,_0x545a34,_0x13d5fd){VoicePrefixEvents[_0x1cb9('0x4')](_0x8c392f+':'+_0x2c17b8['id'],_0x2c17b8);VoicePrefixEvents['emit'](_0x8c392f,_0x2c17b8);_0x13d5fd(null);};}for(var e in events){if(events[_0x1cb9('0x5')](e)){var event=events[e];VoicePrefix[_0x1cb9('0x6')](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 a624ded..04a7d54 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 _0xb59c=['../../config/environment','exports','define','VoicePrefix','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf'];(function(_0x40c4e8,_0x69df7b){var _0x1b172f=function(_0x3fde8c){while(--_0x3fde8c){_0x40c4e8['push'](_0x40c4e8['shift']());}};_0x1b172f(++_0x69df7b);}(_0xb59c,0xc4));var _0xcb59=function(_0x476016,_0x5ec9d7){_0x476016=_0x476016-0x0;var _0x33b1dd=_0xb59c[_0x476016];return _0x33b1dd;};'use strict';var _=require('lodash');var util=require(_0xcb59('0x0'));var logger=require(_0xcb59('0x1'))(_0xcb59('0x2'));var moment=require(_0xcb59('0x3'));var BPromise=require(_0xcb59('0x4'));var rp=require(_0xcb59('0x5'));var fs=require('fs');var path=require(_0xcb59('0x6'));var rimraf=require(_0xcb59('0x7'));var config=require(_0xcb59('0x8'));var attributes=require('./voicePrefix.attributes');module[_0xcb59('0x9')]=function(_0x5c76c9,_0x2a986e){return _0x5c76c9[_0xcb59('0xa')](_0xcb59('0xb'),attributes,{'tableName':'voice_prefixes','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xa40d=['rimraf','../../config/environment','./voicePrefix.attributes','exports','define','VoicePrefix','voice_prefixes','util','../../config/logger','api','request-promise'];(function(_0xd9ec45,_0xe6faab){var _0x1829ba=function(_0x566044){while(--_0x566044){_0xd9ec45['push'](_0xd9ec45['shift']());}};_0x1829ba(++_0xe6faab);}(_0xa40d,0x151));var _0xda40=function(_0x5e28c2,_0x1e48ab){_0x5e28c2=_0x5e28c2-0x0;var _0x1a8cc6=_0xa40d[_0x5e28c2];return _0x1a8cc6;};'use strict';var _=require('lodash');var util=require(_0xda40('0x0'));var logger=require(_0xda40('0x1'))(_0xda40('0x2'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0xda40('0x3'));var fs=require('fs');var path=require('path');var rimraf=require(_0xda40('0x4'));var config=require(_0xda40('0x5'));var attributes=require(_0xda40('0x6'));module[_0xda40('0x7')]=function(_0x44705c,_0x8876a5){return _0x44705c[_0xda40('0x8')](_0xda40('0x9'),attributes,{'tableName':_0xda40('0xa'),'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 6e33d29..91b3290 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 _0x62a7=['localhost','socket.io-emitter','./voicePrefix.socket','register','request','then','info','VoicePrefix,\x20%s,\x20%s','request\x20sent','VoicePrefix,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','redis','defaults'];(function(_0x54baf7,_0x44ab46){var _0x584450=function(_0x411100){while(--_0x411100){_0x54baf7['push'](_0x54baf7['shift']());}};_0x584450(++_0x44ab46);}(_0x62a7,0x84));var _0x762a=function(_0x3e5f6d,_0x121db6){_0x3e5f6d=_0x3e5f6d-0x0;var _0x1bea6e=_0x62a7[_0x3e5f6d];return _0x1bea6e;};'use strict';var _=require('lodash');var util=require(_0x762a('0x0'));var moment=require(_0x762a('0x1'));var BPromise=require(_0x762a('0x2'));var rs=require(_0x762a('0x3'));var fs=require('fs');var Redis=require(_0x762a('0x4'));var db=require(_0x762a('0x5'))['db'];var utils=require(_0x762a('0x6'));var logger=require(_0x762a('0x7'))(_0x762a('0x8'));var config=require('../../config/environment');var jayson=require(_0x762a('0x9'));var client=jayson[_0x762a('0xa')]['http']({'port':0x232a});config[_0x762a('0xb')]=_[_0x762a('0xc')](config[_0x762a('0xb')],{'host':_0x762a('0xd'),'port':0x18eb});var socket=require(_0x762a('0xe'))(new Redis(config[_0x762a('0xb')]));require(_0x762a('0xf'))[_0x762a('0x10')](socket);function respondWithRpcPromise(_0x4fb239,_0x44ddf8,_0x5c83ee){return new BPromise(function(_0x2c279a,_0x2ce08c){return client[_0x762a('0x11')](_0x4fb239,_0x5c83ee)[_0x762a('0x12')](function(_0x393371){logger[_0x762a('0x13')](_0x762a('0x14'),_0x44ddf8,_0x762a('0x15'));logger['debug'](_0x762a('0x16'),_0x44ddf8,_0x762a('0x15'),JSON[_0x762a('0x17')](_0x393371));if(_0x393371[_0x762a('0x18')]){if(_0x393371[_0x762a('0x18')][_0x762a('0x19')]===0x1f4){logger[_0x762a('0x18')](_0x762a('0x14'),_0x44ddf8,_0x393371[_0x762a('0x18')]['message']);return _0x2ce08c(_0x393371[_0x762a('0x18')]['message']);}logger[_0x762a('0x18')](_0x762a('0x14'),_0x44ddf8,_0x393371[_0x762a('0x18')][_0x762a('0x1a')]);return _0x2c279a(_0x393371[_0x762a('0x18')][_0x762a('0x1a')]);}else{logger[_0x762a('0x13')](_0x762a('0x14'),_0x44ddf8,'request\x20sent');_0x2c279a(_0x393371[_0x762a('0x1b')][_0x762a('0x1a')]);}})[_0x762a('0x1c')](function(_0x37bd4){logger[_0x762a('0x18')](_0x762a('0x14'),_0x44ddf8,_0x37bd4);_0x2ce08c(_0x37bd4);});});} \ No newline at end of file +var _0x0e1a=['info','VoicePrefix,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','catch','util','moment','bluebird','randomstring','../../config/utils','../../config/logger','../../config/environment','client','http','redis','defaults','localhost','register','request'];(function(_0x5bd426,_0x4878e5){var _0x23a7eb=function(_0x594b42){while(--_0x594b42){_0x5bd426['push'](_0x5bd426['shift']());}};_0x23a7eb(++_0x4878e5);}(_0x0e1a,0xef));var _0xa0e1=function(_0x41d1ea,_0x50903a){_0x41d1ea=_0x41d1ea-0x0;var _0x493d44=_0x0e1a[_0x41d1ea];return _0x493d44;};'use strict';var _=require('lodash');var util=require(_0xa0e1('0x0'));var moment=require(_0xa0e1('0x1'));var BPromise=require(_0xa0e1('0x2'));var rs=require(_0xa0e1('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0xa0e1('0x4'));var logger=require(_0xa0e1('0x5'))('rpc');var config=require(_0xa0e1('0x6'));var jayson=require('jayson/promise');var client=jayson[_0xa0e1('0x7')][_0xa0e1('0x8')]({'port':0x232a});config[_0xa0e1('0x9')]=_[_0xa0e1('0xa')](config['redis'],{'host':_0xa0e1('0xb'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xa0e1('0x9')]));require('./voicePrefix.socket')[_0xa0e1('0xc')](socket);function respondWithRpcPromise(_0x47d17d,_0x2bc97f,_0x5069dd){return new BPromise(function(_0x2f8f55,_0x581f41){return client[_0xa0e1('0xd')](_0x47d17d,_0x5069dd)['then'](function(_0x2195ea){logger[_0xa0e1('0xe')](_0xa0e1('0xf'),_0x2bc97f,_0xa0e1('0x10'));logger[_0xa0e1('0x11')]('VoicePrefix,\x20%s,\x20%s,\x20%s',_0x2bc97f,_0xa0e1('0x10'),JSON[_0xa0e1('0x12')](_0x2195ea));if(_0x2195ea[_0xa0e1('0x13')]){if(_0x2195ea[_0xa0e1('0x13')][_0xa0e1('0x14')]===0x1f4){logger['error'](_0xa0e1('0xf'),_0x2bc97f,_0x2195ea[_0xa0e1('0x13')]['message']);return _0x581f41(_0x2195ea[_0xa0e1('0x13')][_0xa0e1('0x15')]);}logger[_0xa0e1('0x13')](_0xa0e1('0xf'),_0x2bc97f,_0x2195ea['error'][_0xa0e1('0x15')]);return _0x2f8f55(_0x2195ea['error'][_0xa0e1('0x15')]);}else{logger['info']('VoicePrefix,\x20%s,\x20%s',_0x2bc97f,_0xa0e1('0x10'));_0x2f8f55(_0x2195ea['result']['message']);}})[_0xa0e1('0x16')](function(_0x299073){logger['error'](_0xa0e1('0xf'),_0x2bc97f,_0x299073);_0x581f41(_0x299073);});});} \ No newline at end of file diff --git a/server/api/voicePrefix/voicePrefix.socket.js b/server/api/voicePrefix/voicePrefix.socket.js index 1de9f2a..d5d13f7 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 _0x2058=['length','voicePrefix:','./voicePrefix.events','remove','update','emit','removeListener','register'];(function(_0x487ab4,_0x1e24e8){var _0x3bef77=function(_0x5ce664){while(--_0x5ce664){_0x487ab4['push'](_0x487ab4['shift']());}};_0x3bef77(++_0x1e24e8);}(_0x2058,0x18a));var _0x8205=function(_0x4e3079,_0x2e48ea){_0x4e3079=_0x4e3079-0x0;var _0x4356fb=_0x2058[_0x4e3079];return _0x4356fb;};'use strict';var VoicePrefixEvents=require(_0x8205('0x0'));var events=['save',_0x8205('0x1'),_0x8205('0x2')];function createListener(_0x18085a,_0x14c4f3){return function(_0x1a478e){_0x14c4f3[_0x8205('0x3')](_0x18085a,_0x1a478e);};}function removeListener(_0x5b119f,_0x1bceb5){return function(){VoicePrefixEvents[_0x8205('0x4')](_0x5b119f,_0x1bceb5);};}exports[_0x8205('0x5')]=function(_0x251591){for(var _0x5a9d18=0x0,_0x4a30a0=events[_0x8205('0x6')];_0x5a9d18<_0x4a30a0;_0x5a9d18++){var _0x2d6181=events[_0x5a9d18];var _0x2b841d=createListener(_0x8205('0x7')+_0x2d6181,_0x251591);VoicePrefixEvents['on'](_0x2d6181,_0x2b841d);}}; \ No newline at end of file +var _0xf3ba=['update','emit','removeListener','register','save','remove'];(function(_0x5984cf,_0x58aaff){var _0x558fcf=function(_0xcdae0c){while(--_0xcdae0c){_0x5984cf['push'](_0x5984cf['shift']());}};_0x558fcf(++_0x58aaff);}(_0xf3ba,0x70));var _0xaf3b=function(_0x1fafa5,_0x1aa281){_0x1fafa5=_0x1fafa5-0x0;var _0xcf08c9=_0xf3ba[_0x1fafa5];return _0xcf08c9;};'use strict';var VoicePrefixEvents=require('./voicePrefix.events');var events=[_0xaf3b('0x0'),_0xaf3b('0x1'),_0xaf3b('0x2')];function createListener(_0x57b621,_0x376570){return function(_0x28ea4f){_0x376570[_0xaf3b('0x3')](_0x57b621,_0x28ea4f);};}function removeListener(_0x39509f,_0x16815e){return function(){VoicePrefixEvents[_0xaf3b('0x4')](_0x39509f,_0x16815e);};}exports[_0xaf3b('0x5')]=function(_0x5cc4d6){for(var _0x16526c=0x0,_0x4414b3=events['length'];_0x16526c<_0x4414b3;_0x16526c++){var _0x1eff8a=events[_0x16526c];var _0x1af524=createListener('voicePrefix:'+_0x1eff8a,_0x5cc4d6);VoicePrefixEvents['on'](_0x1eff8a,_0x1af524);}}; \ No newline at end of file diff --git a/server/api/voiceQueue/index.js b/server/api/voiceQueue/index.js index 2af5cd3..62003b2 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 _0x8d0e=['update','delete','destroy','removeTeams','removeAgents','removeLists','removeBlackLists','exports','multer','util','connect-timeout','express','../../components/auth/service','../../components/interaction/service','./voiceQueue.controller','get','isAuthenticated','index','/:id','show','/:id/hoppers','getHoppers','/:id/hopper_histories','/:id/hopper_finals','getHopperFinals','/:id/hopper_black','getHopperBlacks','/:id/teams','getTeams','/:id/users','/:id/members','getMembers','/:id/lists','getLists','getBlackLists','post','create','clone','addAgents','addLists','/:id/blacklists','addBlackLists','put'];(function(_0x20e3cd,_0x3e6b95){var _0x42d8bd=function(_0x2e6105){while(--_0x2e6105){_0x20e3cd['push'](_0x20e3cd['shift']());}};_0x42d8bd(++_0x3e6b95);}(_0x8d0e,0xdf));var _0xe8d0=function(_0x31ff8f,_0x589d60){_0x31ff8f=_0x31ff8f-0x0;var _0x3a6f60=_0x8d0e[_0x31ff8f];return _0x3a6f60;};'use strict';var multer=require(_0xe8d0('0x0'));var util=require(_0xe8d0('0x1'));var path=require('path');var timeout=require(_0xe8d0('0x2'));var express=require(_0xe8d0('0x3'));var router=express['Router']();var auth=require(_0xe8d0('0x4'));var interaction=require(_0xe8d0('0x5'));var config=require('../../config/environment');var controller=require(_0xe8d0('0x6'));router[_0xe8d0('0x7')]('/',auth[_0xe8d0('0x8')](),controller[_0xe8d0('0x9')]);router[_0xe8d0('0x7')](_0xe8d0('0xa'),auth['isAuthenticated'](),controller[_0xe8d0('0xb')]);router[_0xe8d0('0x7')](_0xe8d0('0xc'),auth['isAuthenticated'](),controller[_0xe8d0('0xd')]);router[_0xe8d0('0x7')](_0xe8d0('0xe'),auth[_0xe8d0('0x8')](),controller['getHopperHistories']);router['get'](_0xe8d0('0xf'),auth['isAuthenticated'](),controller[_0xe8d0('0x10')]);router[_0xe8d0('0x7')](_0xe8d0('0x11'),auth[_0xe8d0('0x8')](),controller[_0xe8d0('0x12')]);router['get'](_0xe8d0('0x13'),auth[_0xe8d0('0x8')](),controller[_0xe8d0('0x14')]);router['get'](_0xe8d0('0x15'),auth['isAuthenticated'](),controller['getAgents']);router[_0xe8d0('0x7')](_0xe8d0('0x16'),auth[_0xe8d0('0x8')](),controller[_0xe8d0('0x17')]);router[_0xe8d0('0x7')](_0xe8d0('0x18'),auth[_0xe8d0('0x8')](),controller[_0xe8d0('0x19')]);router[_0xe8d0('0x7')]('/:id/blacklists',auth[_0xe8d0('0x8')](),controller[_0xe8d0('0x1a')]);router[_0xe8d0('0x1b')]('/',auth[_0xe8d0('0x8')](),controller[_0xe8d0('0x1c')]);router[_0xe8d0('0x1b')]('/:id/clone',auth[_0xe8d0('0x8')](),controller[_0xe8d0('0x1d')]);router[_0xe8d0('0x1b')](_0xe8d0('0x13'),auth['isAuthenticated'](),controller['addTeams']);router[_0xe8d0('0x1b')]('/:id/users',auth[_0xe8d0('0x8')](),controller[_0xe8d0('0x1e')]);router[_0xe8d0('0x1b')](_0xe8d0('0x18'),auth[_0xe8d0('0x8')](),controller[_0xe8d0('0x1f')]);router[_0xe8d0('0x1b')](_0xe8d0('0x20'),auth['isAuthenticated'](),controller[_0xe8d0('0x21')]);router[_0xe8d0('0x22')](_0xe8d0('0xa'),auth[_0xe8d0('0x8')](),controller[_0xe8d0('0x23')]);router[_0xe8d0('0x24')]('/:id',auth['isAuthenticated'](),controller[_0xe8d0('0x25')]);router['delete'](_0xe8d0('0x13'),auth['isAuthenticated'](),controller[_0xe8d0('0x26')]);router[_0xe8d0('0x24')]('/:id/users',auth['isAuthenticated'](),controller[_0xe8d0('0x27')]);router[_0xe8d0('0x24')]('/:id/lists',auth['isAuthenticated'](),controller[_0xe8d0('0x28')]);router[_0xe8d0('0x24')]('/:id/blacklists',auth[_0xe8d0('0x8')](),controller[_0xe8d0('0x29')]);module[_0xe8d0('0x2a')]=router; \ No newline at end of file +var _0xd32b=['getAgents','/:id/members','getMembers','/:id/lists','getLists','getBlackLists','post','create','/:id/clone','clone','addTeams','addAgents','addLists','/:id/blacklists','addBlackLists','put','update','delete','removeTeams','removeLists','multer','util','path','express','Router','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/:id','show','/:id/hoppers','getHoppers','/:id/hopper_histories','getHopperHistories','getHopperFinals','getHopperBlacks','/:id/teams','getTeams','/:id/users'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xd32b,0x15c));var _0xbd32=function(_0x528ad3,_0x53a1f7){_0x528ad3=_0x528ad3-0x0;var _0x43b7c5=_0xd32b[_0x528ad3];return _0x43b7c5;};'use strict';var multer=require(_0xbd32('0x0'));var util=require(_0xbd32('0x1'));var path=require(_0xbd32('0x2'));var timeout=require('connect-timeout');var express=require(_0xbd32('0x3'));var router=express[_0xbd32('0x4')]();var auth=require('../../components/auth/service');var interaction=require(_0xbd32('0x5'));var config=require(_0xbd32('0x6'));var controller=require('./voiceQueue.controller');router[_0xbd32('0x7')]('/',auth[_0xbd32('0x8')](),controller[_0xbd32('0x9')]);router[_0xbd32('0x7')](_0xbd32('0xa'),auth['isAuthenticated'](),controller[_0xbd32('0xb')]);router[_0xbd32('0x7')](_0xbd32('0xc'),auth[_0xbd32('0x8')](),controller[_0xbd32('0xd')]);router['get'](_0xbd32('0xe'),auth['isAuthenticated'](),controller[_0xbd32('0xf')]);router[_0xbd32('0x7')]('/:id/hopper_finals',auth[_0xbd32('0x8')](),controller[_0xbd32('0x10')]);router['get']('/:id/hopper_black',auth[_0xbd32('0x8')](),controller[_0xbd32('0x11')]);router[_0xbd32('0x7')](_0xbd32('0x12'),auth[_0xbd32('0x8')](),controller[_0xbd32('0x13')]);router[_0xbd32('0x7')](_0xbd32('0x14'),auth[_0xbd32('0x8')](),controller[_0xbd32('0x15')]);router['get'](_0xbd32('0x16'),auth[_0xbd32('0x8')](),controller[_0xbd32('0x17')]);router[_0xbd32('0x7')](_0xbd32('0x18'),auth[_0xbd32('0x8')](),controller[_0xbd32('0x19')]);router[_0xbd32('0x7')]('/:id/blacklists',auth['isAuthenticated'](),controller[_0xbd32('0x1a')]);router[_0xbd32('0x1b')]('/',auth[_0xbd32('0x8')](),controller[_0xbd32('0x1c')]);router[_0xbd32('0x1b')](_0xbd32('0x1d'),auth[_0xbd32('0x8')](),controller[_0xbd32('0x1e')]);router[_0xbd32('0x1b')](_0xbd32('0x12'),auth[_0xbd32('0x8')](),controller[_0xbd32('0x1f')]);router[_0xbd32('0x1b')]('/:id/users',auth[_0xbd32('0x8')](),controller[_0xbd32('0x20')]);router[_0xbd32('0x1b')](_0xbd32('0x18'),auth[_0xbd32('0x8')](),controller[_0xbd32('0x21')]);router[_0xbd32('0x1b')](_0xbd32('0x22'),auth['isAuthenticated'](),controller[_0xbd32('0x23')]);router[_0xbd32('0x24')](_0xbd32('0xa'),auth[_0xbd32('0x8')](),controller[_0xbd32('0x25')]);router[_0xbd32('0x26')]('/:id',auth['isAuthenticated'](),controller['destroy']);router['delete']('/:id/teams',auth['isAuthenticated'](),controller[_0xbd32('0x27')]);router[_0xbd32('0x26')](_0xbd32('0x14'),auth[_0xbd32('0x8')](),controller['removeAgents']);router[_0xbd32('0x26')](_0xbd32('0x18'),auth[_0xbd32('0x8')](),controller[_0xbd32('0x28')]);router['delete'](_0xbd32('0x22'),auth[_0xbd32('0x8')](),controller['removeBlackLists']);module['exports']=router; \ No newline at end of file diff --git a/server/api/voiceQueue/voiceQueue.attributes.js b/server/api/voiceQueue/voiceQueue.attributes.js index ac71a4a..d5c6b28 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(_0x407131,_0x1bac9e){var _0xf60c74=function(_0x3d4797){while(--_0x3d4797){_0x407131['push'](_0x407131['shift']());}};_0xf60c74(++_0x1bac9e);}(_0xa9e0,0x123));var _0x0a9e=function(_0x37bd26,_0x5ad346){_0x37bd26=_0x37bd26-0x0;var _0xe83dc4=_0xa9e0[_0x37bd26];return _0xe83dc4;};'use strict';var Sequelize=require(_0x0a9e('0x0'));module[_0x0a9e('0x1')]={'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(_0xf8f6f1,_0x551483){var _0x51db61=function(_0x31f8af){while(--_0x31f8af){_0xf8f6f1['push'](_0xf8f6f1['shift']());}};_0x51db61(++_0x551483);}(_0xa9e0,0x123));var _0x0a9e=function(_0x298ed3,_0x4ab5e1){_0x298ed3=_0x298ed3-0x0;var _0x5aad28=_0xa9e0[_0x298ed3];return _0x5aad28;};'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 375d31e..4ec7441 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 _0x4227=['map','value','type','find','name','UserProfileResource','error','stack','send','index','rawAttributes','fieldName','key','keys','filters','intersection','model','query','attributes','fields','length','nolimit','order','sort','pick','filter','where','VIRTUAL','options','VoiceQueue','includeAll','rows','catch','show','params','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','merge','createdAt','updatedAt','autoAssociation','getHoppers','findOne','CmHopper','hasOwnProperty','include','findAll','getHopperHistories','VoiceQueueId','CmHopperHistory','CmHopperFinal','getHopperBlacks','CmHopperBlack','getTeams','addTeams','Team','Agents','online','interface','flatMap','penalty','sequelize','each','UserVoiceQueue','findOrCreate','upsert','isNil','format','voicePause','forEach','emit','userVoiceQueue:save','removeTeams','ids','User','field','from','team_has_voice_queues','ut.TeamId\x20=\x20tq.TeamId','VoiceQueueId\x20=\x20?','clone','push','QueryTypes','every','TeamId','includes','all','union','compact','transaction','isEmpty','removeAgents','UserVoiceQueueRt','userVoiceQueue:remove','addAgents','omit','spread','SIP/%s','isArray','getAgents','getMembers','getLists','CmList','addLists','dialCheckDuplicateType','always','insert','into','cm_hopper','fromQuery','phone','scheduledAt','ListId','select','NOW()','CmListId','toString','cm_contacts','deletedAt\x20IS\x20NULL','ListId\x20=\x20?','phone\x20IS\x20NOT\x20NULL','phone\x20NOT\x20IN\x20(?)','cm_hopper_final','COALESCE(phone,\x27\x27)','onlyIfOpen','ContactId','removeLists','getBlackLists','addBlackLists','cm_hopper_black','removeBlackLists','html-pdf','zip-dir','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','api','../../config/utils','../../mysqldb','redis','localhost','./voiceQueue.socket','sendStatus','status','json','count','offset','limit','Content-Range','reject','save','update','then','destroy','get','VoiceQueues','inbound','QueueCampaigns','outbound','ignore'];(function(_0x3299f8,_0x47e0cc){var _0x2c488d=function(_0x2fd9f6){while(--_0x2fd9f6){_0x3299f8['push'](_0x3299f8['shift']());}};_0x2c488d(++_0x47e0cc);}(_0x4227,0x89));var _0x7422=function(_0x309aea,_0x24f158){_0x309aea=_0x309aea-0x0;var _0xf88bf0=_0x4227[_0x309aea];return _0xf88bf0;};'use strict';var pdf=require(_0x7422('0x0'));var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x7422('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x7422('0x2'));var moment=require(_0x7422('0x3'));var BPromise=require(_0x7422('0x4'));var Mustache=require('mustache');var util=require(_0x7422('0x5'));var path=require(_0x7422('0x6'));var sox=require(_0x7422('0x7'));var csv=require(_0x7422('0x8'));var ejs=require(_0x7422('0x9'));var fs=require('fs');var _=require(_0x7422('0xa'));var squel=require(_0x7422('0xb'));var crypto=require(_0x7422('0xc'));var jsforce=require(_0x7422('0xd'));var deskjs=require('desk.js');var toCsv=require(_0x7422('0x8'));var querystring=require(_0x7422('0xe'));var Papa=require(_0x7422('0xf'));var Redis=require('ioredis');var authService=require(_0x7422('0x10'));var qs=require('../../components/parsers/qs');var as=require(_0x7422('0x11'));var hardwareService=require(_0x7422('0x12'));var logger=require(_0x7422('0x13'))(_0x7422('0x14'));var utils=require(_0x7422('0x15'));var config=require('../../config/environment');var db=require(_0x7422('0x16'))['db'];config[_0x7422('0x17')]=_['defaults'](config[_0x7422('0x17')],{'host':_0x7422('0x18'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x7422('0x17')]));require(_0x7422('0x19'))['register'](socket);function respondWithStatusCode(_0x4d3f91,_0xeafd58){_0xeafd58=_0xeafd58||0xcc;return function(_0x4ca0e4){if(_0x4ca0e4){return _0x4d3f91[_0x7422('0x1a')](_0xeafd58);}return _0x4d3f91[_0x7422('0x1b')](_0xeafd58)['end']();};}function respondWithResult(_0x149c50,_0x39c31c){_0x39c31c=_0x39c31c||0xc8;return function(_0x31c3ec){if(_0x31c3ec){return _0x149c50[_0x7422('0x1b')](_0x39c31c)[_0x7422('0x1c')](_0x31c3ec);}};}function respondWithFilteredResult(_0x25401d,_0x4e2b60){return function(_0x21d4b9){if(_0x21d4b9){var _0xa7ff41=_0x21d4b9[_0x7422('0x1d')],_0x493f59=_0x4e2b60['offset'],_0x30656d=_0x4e2b60[_0x7422('0x1e')]+_0x4e2b60[_0x7422('0x1f')],_0x57b8bf;if(_0x30656d>=_0xa7ff41){_0x30656d=_0xa7ff41;_0x57b8bf=0xc8;}else{_0x57b8bf=0xce;}_0x25401d[_0x7422('0x1b')](_0x57b8bf);return _0x25401d['set'](_0x7422('0x20'),_0x493f59+'-'+_0x30656d+'/'+_0xa7ff41)[_0x7422('0x1c')](_0x21d4b9);}return null;};}function patchUpdates(_0x368e96){return function(_0x3eb555){try{jsonpatch['apply'](_0x3eb555,_0x368e96,!![]);}catch(_0x58e617){return BPromise[_0x7422('0x21')](_0x58e617);}return _0x3eb555[_0x7422('0x22')]();};}function saveUpdates(_0x20c1e3,_0x7d34f2){return function(_0x71d28c){if(_0x71d28c){return _0x71d28c[_0x7422('0x23')](_0x20c1e3)[_0x7422('0x24')](function(_0x596b89){return _0x596b89;});}return null;};}function removeEntity(_0x24ce62,_0x46b927){return function(_0x4fc200){if(_0x4fc200){return _0x4fc200[_0x7422('0x25')]()[_0x7422('0x24')](function(){var _0x11ab32=_0x4fc200[_0x7422('0x26')]({'plain':!![]});var _0x5436a4=[{'name':_0x7422('0x27'),'value':_0x7422('0x28'),'ignore':![]},{'name':_0x7422('0x29'),'value':_0x7422('0x2a'),'ignore':![]}];var _0x3438d1=_(_0x5436a4)['filter'](_0x7422('0x2b'))[_0x7422('0x2c')](_0x7422('0x2d'))[_0x7422('0x2d')]();if(_['includes'](_0x3438d1,_0x11ab32[_0x7422('0x2e')])){return;}var _0x20f71e=_[_0x7422('0x2f')](_0x5436a4,[_0x7422('0x2d'),_0x11ab32['type']])[_0x7422('0x30')];return db[_0x7422('0x31')]['destroy']({'where':{'type':_0x20f71e,'resourceId':_0x11ab32['id']}})['then'](function(){return _0x4fc200;});})[_0x7422('0x24')](function(){_0x24ce62[_0x7422('0x1b')](0xcc)['end']();});}};}function handleEntityNotFound(_0x1d5ae5,_0x194a5e){return function(_0x3f577e){if(!_0x3f577e){_0x1d5ae5[_0x7422('0x1a')](0x194);}return _0x3f577e;};}function handleError(_0x1f23b7,_0x2ca9ab){_0x2ca9ab=_0x2ca9ab||0x1f4;return function(_0x212a66){logger[_0x7422('0x32')](_0x212a66[_0x7422('0x33')]);if(_0x212a66[_0x7422('0x30')]){delete _0x212a66[_0x7422('0x30')];}_0x1f23b7['status'](_0x2ca9ab)[_0x7422('0x34')](_0x212a66);};}exports[_0x7422('0x35')]=function(_0x22327f,_0x1eff48){var _0x4c4984={},_0x3823a5={},_0x339b85={'count':0x0,'rows':[]};var _0x4606d9=_['map'](db['VoiceQueue'][_0x7422('0x36')],function(_0x49ed14){return{'name':_0x49ed14[_0x7422('0x37')],'type':_0x49ed14['type'][_0x7422('0x38')]};});_0x3823a5['model']=_[_0x7422('0x2c')](_0x4606d9,'name');_0x3823a5['query']=_[_0x7422('0x39')](_0x22327f['query']);_0x3823a5[_0x7422('0x3a')]=_[_0x7422('0x3b')](_0x3823a5[_0x7422('0x3c')],_0x3823a5[_0x7422('0x3d')]);_0x4c4984[_0x7422('0x3e')]=_[_0x7422('0x3b')](_0x3823a5[_0x7422('0x3c')],qs['fields'](_0x22327f[_0x7422('0x3d')][_0x7422('0x3f')]));_0x4c4984[_0x7422('0x3e')]=_0x4c4984[_0x7422('0x3e')][_0x7422('0x40')]?_0x4c4984['attributes']:_0x3823a5[_0x7422('0x3c')];if(!_0x22327f[_0x7422('0x3d')]['hasOwnProperty'](_0x7422('0x41'))){_0x4c4984['limit']=qs[_0x7422('0x1f')](_0x22327f['query']['limit']);_0x4c4984[_0x7422('0x1e')]=qs[_0x7422('0x1e')](_0x22327f[_0x7422('0x3d')]['offset']);}_0x4c4984[_0x7422('0x42')]=qs[_0x7422('0x43')](_0x22327f['query'][_0x7422('0x43')]);_0x4c4984['where']=qs[_0x7422('0x3a')](_[_0x7422('0x44')](_0x22327f[_0x7422('0x3d')],_0x3823a5[_0x7422('0x3a')]));if(_0x22327f[_0x7422('0x3d')][_0x7422('0x45')]){_0x4c4984[_0x7422('0x46')]=_['merge'](_0x4c4984[_0x7422('0x46')],{'$or':_[_0x7422('0x2c')](_0x4606d9,function(_0x556e01){if(_0x556e01[_0x7422('0x2e')]!==_0x7422('0x47')){var _0x5719df={};_0x5719df[_0x556e01[_0x7422('0x30')]]={'$like':'%'+_0x22327f['query'][_0x7422('0x45')]+'%'};return _0x5719df;}})});}_0x4c4984=_['merge']({},_0x4c4984,_0x22327f[_0x7422('0x48')]);var _0x2caedf={'where':_0x4c4984[_0x7422('0x46')]};return db[_0x7422('0x49')][_0x7422('0x1d')](_0x2caedf)[_0x7422('0x24')](function(_0x40c1dd){_0x339b85[_0x7422('0x1d')]=_0x40c1dd;if(_0x22327f[_0x7422('0x3d')][_0x7422('0x4a')]){_0x4c4984['include']=[{'all':!![]}];}return db[_0x7422('0x49')]['findAll'](_0x4c4984);})['then'](function(_0x2c1283){_0x339b85[_0x7422('0x4b')]=_0x2c1283;return _0x339b85;})['then'](respondWithFilteredResult(_0x1eff48,_0x4c4984))[_0x7422('0x4c')](handleError(_0x1eff48,null));};exports[_0x7422('0x4d')]=function(_0x1d09e9,_0x26bb3e){var _0x3301c7={'raw':![],'where':{'id':_0x1d09e9[_0x7422('0x4e')]['id']}},_0x2a0e96={};_0x2a0e96['model']=_[_0x7422('0x39')](db[_0x7422('0x49')][_0x7422('0x36')]);_0x2a0e96[_0x7422('0x3d')]=_['keys'](_0x1d09e9[_0x7422('0x3d')]);_0x2a0e96[_0x7422('0x3a')]=_[_0x7422('0x3b')](_0x2a0e96['model'],_0x2a0e96[_0x7422('0x3d')]);_0x3301c7[_0x7422('0x3e')]=_['intersection'](_0x2a0e96['model'],qs['fields'](_0x1d09e9[_0x7422('0x3d')][_0x7422('0x3f')]));_0x3301c7['attributes']=_0x3301c7[_0x7422('0x3e')]['length']?_0x3301c7[_0x7422('0x3e')]:_0x2a0e96[_0x7422('0x3c')];if(_0x1d09e9[_0x7422('0x3d')][_0x7422('0x4a')]){_0x3301c7['include']=[{'all':!![]}];}_0x3301c7=_['merge']({},_0x3301c7,_0x1d09e9[_0x7422('0x48')]);return db[_0x7422('0x49')]['find'](_0x3301c7)[_0x7422('0x24')](handleEntityNotFound(_0x26bb3e,null))[_0x7422('0x24')](respondWithResult(_0x26bb3e,null))['catch'](handleError(_0x26bb3e,null));};exports[_0x7422('0x4f')]=function(_0x17de3f,_0x2b7fca){return db[_0x7422('0x49')][_0x7422('0x4f')](_0x17de3f[_0x7422('0x50')],{})[_0x7422('0x24')](function(_0x38ed10){var _0x1ad0af=_0x17de3f[_0x7422('0x51')]['get']({'plain':!![]});if(!_0x1ad0af)throw new Error(_0x7422('0x52'));if(_0x1ad0af[_0x7422('0x53')]===_0x7422('0x51')){var _0x5e8be6=_0x38ed10[_0x7422('0x26')]({'plain':!![]});var _0x28531a=[{'name':_0x7422('0x27'),'value':_0x7422('0x28')},{'name':_0x7422('0x29'),'value':_0x7422('0x2a')}];var _0x55efae=_[_0x7422('0x2f')](_0x28531a,[_0x7422('0x2d'),_0x5e8be6[_0x7422('0x2e')]])[_0x7422('0x30')];return db[_0x7422('0x54')][_0x7422('0x2f')]({'where':{'name':_0x55efae,'userProfileId':_0x1ad0af[_0x7422('0x55')]},'raw':!![]})['then'](function(_0x305418){if(_0x305418&&_0x305418['autoAssociation']===0x0){return db['UserProfileResource'][_0x7422('0x4f')]({'name':_0x5e8be6['name'],'resourceId':_0x5e8be6['id'],'type':_0x305418[_0x7422('0x30')],'sectionId':_0x305418['id']},{})[_0x7422('0x24')](function(){return _0x38ed10;});}else{return _0x38ed10;}})[_0x7422('0x4c')](function(_0x54f19e){logger[_0x7422('0x32')](_0x7422('0x56'),_0x54f19e);throw _0x54f19e;});}return _0x38ed10;})[_0x7422('0x24')](respondWithResult(_0x2b7fca,0xc9))[_0x7422('0x4c')](handleError(_0x2b7fca,null));};exports['clone']=function(_0x5889f7,_0x31f468){var _0x2162f6={'where':{'id':_0x5889f7['params']['id']}},_0x4a9a6e={};_0x4a9a6e[_0x7422('0x3c')]=_[_0x7422('0x39')](db[_0x7422('0x49')][_0x7422('0x36')]);_0x2162f6[_0x7422('0x3e')]=_[_0x7422('0x3b')](_0x4a9a6e[_0x7422('0x3c')],qs[_0x7422('0x3f')](_0x5889f7[_0x7422('0x3d')][_0x7422('0x3f')]));_0x2162f6['attributes']=_0x2162f6[_0x7422('0x3e')][_0x7422('0x40')]?_0x2162f6[_0x7422('0x3e')]:_0x4a9a6e[_0x7422('0x3c')];if(_0x5889f7[_0x7422('0x3d')][_0x7422('0x4a')]){_0x2162f6['include']=[{'all':!![]}];}_0x2162f6=_[_0x7422('0x57')]({},_0x2162f6,_0x5889f7[_0x7422('0x48')]);return db[_0x7422('0x49')][_0x7422('0x2f')](_0x2162f6)[_0x7422('0x24')](handleEntityNotFound(_0x31f468,null))[_0x7422('0x24')](function(_0xe6d00c){if(_0xe6d00c){var _0x3505de=_0xe6d00c['get']({'plain':!![]});_0x3505de=qs['omit'](_0x3505de,['id',_0x7422('0x58'),_0x7422('0x59')]);_0x5889f7[_0x7422('0x50')]=_['omit'](_0x5889f7[_0x7422('0x50')],['id','createdAt','updatedAt']);return db[_0x7422('0x49')]['create'](_[_0x7422('0x57')](_0x3505de,_0x5889f7[_0x7422('0x50')]),{'include':_0x5889f7[_0x7422('0x3d')][_0x7422('0x4a')]?[{'all':!![]}]:undefined})[_0x7422('0x24')](function(_0x9a92ee){var _0x3c04a5=_0x5889f7[_0x7422('0x51')][_0x7422('0x26')]({'plain':!![]});if(!_0x3c04a5)throw new Error(_0x7422('0x52'));if(_0x3c04a5[_0x7422('0x53')]==='user'){var _0x414db8=_0x9a92ee[_0x7422('0x26')]({'plain':!![]});var _0x170b75=[{'name':_0x7422('0x27'),'value':'inbound'},{'name':_0x7422('0x29'),'value':'outbound'}];var _0x4450ec=_['find'](_0x170b75,[_0x7422('0x2d'),_0x414db8[_0x7422('0x2e')]])['name'];return db[_0x7422('0x54')][_0x7422('0x2f')]({'where':{'name':_0x4450ec,'userProfileId':_0x3c04a5[_0x7422('0x55')]},'raw':!![]})[_0x7422('0x24')](function(_0x27d478){if(_0x27d478&&_0x27d478[_0x7422('0x5a')]===0x0){return db['UserProfileResource'][_0x7422('0x4f')]({'name':_0x414db8[_0x7422('0x30')],'resourceId':_0x414db8['id'],'type':_0x27d478['name'],'sectionId':_0x27d478['id']},{})[_0x7422('0x24')](function(){return _0x9a92ee;});}else{return _0x9a92ee;}})[_0x7422('0x4c')](function(_0x50ff6f){logger[_0x7422('0x32')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x50ff6f);throw _0x50ff6f;});}return _0x9a92ee;});}})[_0x7422('0x24')](respondWithResult(_0x31f468,0xc9))[_0x7422('0x4c')](handleError(_0x31f468,null));};exports[_0x7422('0x23')]=function(_0x1b9ce9,_0x405d72){if(_0x1b9ce9[_0x7422('0x50')]['id']){delete _0x1b9ce9[_0x7422('0x50')]['id'];}return db['VoiceQueue'][_0x7422('0x2f')]({'where':{'id':_0x1b9ce9['params']['id']}})[_0x7422('0x24')](handleEntityNotFound(_0x405d72,null))[_0x7422('0x24')](saveUpdates(_0x1b9ce9['body'],null))[_0x7422('0x24')](respondWithResult(_0x405d72,null))[_0x7422('0x4c')](handleError(_0x405d72,null));};exports[_0x7422('0x25')]=function(_0x10f8f9,_0x5a8b31){return db['VoiceQueue'][_0x7422('0x2f')]({'where':{'id':_0x10f8f9[_0x7422('0x4e')]['id']}})[_0x7422('0x24')](handleEntityNotFound(_0x5a8b31,null))[_0x7422('0x24')](removeEntity(_0x5a8b31,null))[_0x7422('0x4c')](handleError(_0x5a8b31,null));};exports[_0x7422('0x5b')]=function(_0x33e1cf,_0x32ba78,_0x3e6367){var _0x4f04be={'raw':![],'where':{}};var _0x170705={};var _0x514724={'count':0x0,'rows':[]};return db['VoiceQueue'][_0x7422('0x5c')]({'where':{'id':_0x33e1cf['params']['id']}})['then'](handleEntityNotFound(_0x32ba78,null))[_0x7422('0x24')](function(_0xb7a85a){if(_0xb7a85a){_0x170705[_0x7422('0x3c')]=_[_0x7422('0x39')](db[_0x7422('0x5d')][_0x7422('0x36')]);_0x170705[_0x7422('0x3d')]=_[_0x7422('0x39')](_0x33e1cf['query']);_0x170705[_0x7422('0x3a')]=_[_0x7422('0x3b')](_0x170705[_0x7422('0x3c')],_0x170705[_0x7422('0x3d')]);_0x4f04be['attributes']=_[_0x7422('0x3b')](_0x170705[_0x7422('0x3c')],qs[_0x7422('0x3f')](_0x33e1cf[_0x7422('0x3d')]['fields']));_0x4f04be[_0x7422('0x3e')]=_0x4f04be[_0x7422('0x3e')][_0x7422('0x40')]?_0x4f04be['attributes']:_0x170705[_0x7422('0x3c')];if(!_0x33e1cf[_0x7422('0x3d')][_0x7422('0x5e')](_0x7422('0x41'))){_0x4f04be[_0x7422('0x1f')]=qs[_0x7422('0x1f')](_0x33e1cf[_0x7422('0x3d')]['limit']);_0x4f04be[_0x7422('0x1e')]=qs[_0x7422('0x1e')](_0x33e1cf[_0x7422('0x3d')][_0x7422('0x1e')]);}_0x4f04be['order']=qs[_0x7422('0x43')](_0x33e1cf['query'][_0x7422('0x43')]);_0x4f04be[_0x7422('0x46')]=qs[_0x7422('0x3a')](_['pick'](_0x33e1cf[_0x7422('0x3d')],_0x170705[_0x7422('0x3a')]));_0x4f04be[_0x7422('0x46')]['VoiceQueueId']=_0xb7a85a['id'];if(_0x33e1cf[_0x7422('0x3d')][_0x7422('0x45')]){_0x4f04be[_0x7422('0x46')]=_['merge'](_0x4f04be[_0x7422('0x46')],{'$or':_[_0x7422('0x2c')](_0x4f04be[_0x7422('0x3e')],function(_0x463a17){var _0x27219a={};_0x27219a[_0x463a17]={'$like':'%'+_0x33e1cf[_0x7422('0x3d')][_0x7422('0x45')]+'%'};return _0x27219a;})});}_0x4f04be=_['merge']({},_0x4f04be,_0x33e1cf[_0x7422('0x48')]);return db[_0x7422('0x5d')][_0x7422('0x1d')]({'where':_0x4f04be[_0x7422('0x46')]})[_0x7422('0x24')](function(_0x172ea3){_0x514724[_0x7422('0x1d')]=_0x172ea3;if(_0x33e1cf[_0x7422('0x3d')][_0x7422('0x4a')]){_0x4f04be[_0x7422('0x5f')]=[{'all':!![]}];}return db[_0x7422('0x5d')][_0x7422('0x60')](_0x4f04be);})[_0x7422('0x24')](function(_0x119c9b){_0x514724[_0x7422('0x4b')]=_0x119c9b;return _0x514724;});}})[_0x7422('0x24')](respondWithFilteredResult(_0x32ba78,_0x4f04be))['catch'](handleError(_0x32ba78,null));};exports[_0x7422('0x61')]=function(_0xc3483a,_0x357db2,_0x16b9cf){var _0x5c33b3={'raw':!![],'where':{}};var _0x3b4f9c={};var _0xa226ce={'count':0x0,'rows':[]};return db['VoiceQueue'][_0x7422('0x5c')]({'where':{'id':_0xc3483a[_0x7422('0x4e')]['id']}})['then'](handleEntityNotFound(_0x357db2,null))[_0x7422('0x24')](function(_0x289bb4){if(_0x289bb4){_0x3b4f9c[_0x7422('0x3c')]=_[_0x7422('0x39')](db['CmHopperHistory'][_0x7422('0x36')]);_0x3b4f9c[_0x7422('0x3d')]=_[_0x7422('0x39')](_0xc3483a['query']);_0x3b4f9c[_0x7422('0x3a')]=_[_0x7422('0x3b')](_0x3b4f9c[_0x7422('0x3c')],_0x3b4f9c['query']);_0x5c33b3[_0x7422('0x3e')]=_[_0x7422('0x3b')](_0x3b4f9c[_0x7422('0x3c')],qs[_0x7422('0x3f')](_0xc3483a[_0x7422('0x3d')]['fields']));_0x5c33b3[_0x7422('0x3e')]=_0x5c33b3[_0x7422('0x3e')][_0x7422('0x40')]?_0x5c33b3['attributes']:_0x3b4f9c[_0x7422('0x3c')];if(!_0xc3483a[_0x7422('0x3d')][_0x7422('0x5e')](_0x7422('0x41'))){_0x5c33b3['limit']=qs[_0x7422('0x1f')](_0xc3483a[_0x7422('0x3d')]['limit']);_0x5c33b3[_0x7422('0x1e')]=qs[_0x7422('0x1e')](_0xc3483a[_0x7422('0x3d')][_0x7422('0x1e')]);}_0x5c33b3[_0x7422('0x42')]=qs[_0x7422('0x43')](_0xc3483a[_0x7422('0x3d')][_0x7422('0x43')]);_0x5c33b3['where']=qs[_0x7422('0x3a')](_[_0x7422('0x44')](_0xc3483a[_0x7422('0x3d')],_0x3b4f9c['filters']));_0x5c33b3[_0x7422('0x46')][_0x7422('0x62')]=_0x289bb4['id'];if(_0xc3483a[_0x7422('0x3d')][_0x7422('0x45')]){_0x5c33b3[_0x7422('0x46')]=_[_0x7422('0x57')](_0x5c33b3[_0x7422('0x46')],{'$or':_['map'](_0x5c33b3[_0x7422('0x3e')],function(_0x166ce2){var _0x3e4e8e={};_0x3e4e8e[_0x166ce2]={'$like':'%'+_0xc3483a[_0x7422('0x3d')][_0x7422('0x45')]+'%'};return _0x3e4e8e;})});}_0x5c33b3=_[_0x7422('0x57')]({},_0x5c33b3,_0xc3483a[_0x7422('0x48')]);return db[_0x7422('0x63')][_0x7422('0x1d')]({'where':_0x5c33b3['where']})['then'](function(_0x225956){_0xa226ce['count']=_0x225956;if(_0xc3483a[_0x7422('0x3d')][_0x7422('0x4a')]){_0x5c33b3[_0x7422('0x5f')]=[{'all':!![]}];}return db[_0x7422('0x63')][_0x7422('0x60')](_0x5c33b3);})[_0x7422('0x24')](function(_0x220d9b){_0xa226ce[_0x7422('0x4b')]=_0x220d9b;return _0xa226ce;});}})[_0x7422('0x24')](respondWithFilteredResult(_0x357db2,_0x5c33b3))[_0x7422('0x4c')](handleError(_0x357db2,null));};exports['getHopperFinals']=function(_0x16e181,_0x45a235,_0x1c75e1){var _0x5f52ec={'raw':!![],'where':{}};var _0x298c34={};var _0x55325c={'count':0x0,'rows':[]};return db[_0x7422('0x49')][_0x7422('0x5c')]({'where':{'id':_0x16e181[_0x7422('0x4e')]['id']}})['then'](handleEntityNotFound(_0x45a235,null))[_0x7422('0x24')](function(_0x277680){if(_0x277680){_0x298c34[_0x7422('0x3c')]=_[_0x7422('0x39')](db[_0x7422('0x64')][_0x7422('0x36')]);_0x298c34[_0x7422('0x3d')]=_[_0x7422('0x39')](_0x16e181[_0x7422('0x3d')]);_0x298c34['filters']=_['intersection'](_0x298c34[_0x7422('0x3c')],_0x298c34[_0x7422('0x3d')]);_0x5f52ec[_0x7422('0x3e')]=_[_0x7422('0x3b')](_0x298c34[_0x7422('0x3c')],qs[_0x7422('0x3f')](_0x16e181['query'][_0x7422('0x3f')]));_0x5f52ec['attributes']=_0x5f52ec[_0x7422('0x3e')][_0x7422('0x40')]?_0x5f52ec[_0x7422('0x3e')]:_0x298c34['model'];if(!_0x16e181[_0x7422('0x3d')][_0x7422('0x5e')](_0x7422('0x41'))){_0x5f52ec['limit']=qs['limit'](_0x16e181[_0x7422('0x3d')]['limit']);_0x5f52ec['offset']=qs[_0x7422('0x1e')](_0x16e181[_0x7422('0x3d')][_0x7422('0x1e')]);}_0x5f52ec[_0x7422('0x42')]=qs[_0x7422('0x43')](_0x16e181[_0x7422('0x3d')][_0x7422('0x43')]);_0x5f52ec[_0x7422('0x46')]=qs[_0x7422('0x3a')](_[_0x7422('0x44')](_0x16e181['query'],_0x298c34[_0x7422('0x3a')]));_0x5f52ec['where'][_0x7422('0x62')]=_0x277680['id'];if(_0x16e181['query'][_0x7422('0x45')]){_0x5f52ec[_0x7422('0x46')]=_['merge'](_0x5f52ec[_0x7422('0x46')],{'$or':_[_0x7422('0x2c')](_0x5f52ec[_0x7422('0x3e')],function(_0x3a736f){var _0x414197={};_0x414197[_0x3a736f]={'$like':'%'+_0x16e181[_0x7422('0x3d')]['filter']+'%'};return _0x414197;})});}_0x5f52ec=_[_0x7422('0x57')]({},_0x5f52ec,_0x16e181[_0x7422('0x48')]);return db['CmHopperFinal'][_0x7422('0x1d')]({'where':_0x5f52ec['where']})[_0x7422('0x24')](function(_0x3d9162){_0x55325c[_0x7422('0x1d')]=_0x3d9162;if(_0x16e181[_0x7422('0x3d')][_0x7422('0x4a')]){_0x5f52ec['include']=[{'all':!![]}];}return db[_0x7422('0x64')][_0x7422('0x60')](_0x5f52ec);})[_0x7422('0x24')](function(_0x3fe0fc){_0x55325c['rows']=_0x3fe0fc;return _0x55325c;});}})['then'](respondWithFilteredResult(_0x45a235,_0x5f52ec))[_0x7422('0x4c')](handleError(_0x45a235,null));};exports[_0x7422('0x65')]=function(_0x240ea0,_0x34c8b0,_0x12ad11){var _0x315a22={'raw':!![],'where':{}};var _0x43aba8={};var _0x3d01f3={'count':0x0,'rows':[]};return db[_0x7422('0x49')][_0x7422('0x5c')]({'where':{'id':_0x240ea0[_0x7422('0x4e')]['id']}})['then'](handleEntityNotFound(_0x34c8b0,null))[_0x7422('0x24')](function(_0x5618d8){if(_0x5618d8){_0x43aba8[_0x7422('0x3c')]=_[_0x7422('0x39')](db[_0x7422('0x66')][_0x7422('0x36')]);_0x43aba8[_0x7422('0x3d')]=_['keys'](_0x240ea0[_0x7422('0x3d')]);_0x43aba8[_0x7422('0x3a')]=_[_0x7422('0x3b')](_0x43aba8[_0x7422('0x3c')],_0x43aba8[_0x7422('0x3d')]);_0x315a22['attributes']=_[_0x7422('0x3b')](_0x43aba8[_0x7422('0x3c')],qs[_0x7422('0x3f')](_0x240ea0[_0x7422('0x3d')][_0x7422('0x3f')]));_0x315a22[_0x7422('0x3e')]=_0x315a22[_0x7422('0x3e')]['length']?_0x315a22['attributes']:_0x43aba8['model'];if(!_0x240ea0[_0x7422('0x3d')][_0x7422('0x5e')](_0x7422('0x41'))){_0x315a22[_0x7422('0x1f')]=qs[_0x7422('0x1f')](_0x240ea0[_0x7422('0x3d')][_0x7422('0x1f')]);_0x315a22['offset']=qs[_0x7422('0x1e')](_0x240ea0[_0x7422('0x3d')][_0x7422('0x1e')]);}_0x315a22[_0x7422('0x42')]=qs[_0x7422('0x43')](_0x240ea0['query'][_0x7422('0x43')]);_0x315a22[_0x7422('0x46')]=qs[_0x7422('0x3a')](_[_0x7422('0x44')](_0x240ea0['query'],_0x43aba8[_0x7422('0x3a')]));_0x315a22['where'][_0x7422('0x62')]=_0x5618d8['id'];if(_0x240ea0[_0x7422('0x3d')]['filter']){_0x315a22[_0x7422('0x46')]=_[_0x7422('0x57')](_0x315a22[_0x7422('0x46')],{'$or':_['map'](_0x315a22[_0x7422('0x3e')],function(_0x2b7afc){var _0x20f282={};_0x20f282[_0x2b7afc]={'$like':'%'+_0x240ea0['query']['filter']+'%'};return _0x20f282;})});}_0x315a22=_[_0x7422('0x57')]({},_0x315a22,_0x240ea0[_0x7422('0x48')]);return db['CmHopperBlack'][_0x7422('0x1d')]({'where':_0x315a22[_0x7422('0x46')]})[_0x7422('0x24')](function(_0x161632){_0x3d01f3[_0x7422('0x1d')]=_0x161632;if(_0x240ea0[_0x7422('0x3d')][_0x7422('0x4a')]){_0x315a22[_0x7422('0x5f')]=[{'all':!![]}];}return db[_0x7422('0x66')]['findAll'](_0x315a22);})[_0x7422('0x24')](function(_0x20d819){_0x3d01f3[_0x7422('0x4b')]=_0x20d819;return _0x3d01f3;});}})[_0x7422('0x24')](respondWithFilteredResult(_0x34c8b0,_0x315a22))[_0x7422('0x4c')](handleError(_0x34c8b0,null));};exports[_0x7422('0x67')]=function(_0x36092c,_0x1e1a85,_0xd36f7){var _0x194612={};var _0x3c064d={};var _0x391ffb;var _0x44ff8b;return db['VoiceQueue']['findOne']({'where':{'id':_0x36092c[_0x7422('0x4e')]['id']}})[_0x7422('0x24')](handleEntityNotFound(_0x1e1a85,null))[_0x7422('0x24')](function(_0x13d60c){if(_0x13d60c){_0x391ffb=_0x13d60c;_0x3c064d[_0x7422('0x3c')]=_[_0x7422('0x39')](db['Team'][_0x7422('0x36')]);_0x3c064d[_0x7422('0x3d')]=_[_0x7422('0x39')](_0x36092c[_0x7422('0x3d')]);_0x3c064d[_0x7422('0x3a')]=_[_0x7422('0x3b')](_0x3c064d[_0x7422('0x3c')],_0x3c064d['query']);_0x194612[_0x7422('0x3e')]=_[_0x7422('0x3b')](_0x3c064d['model'],qs[_0x7422('0x3f')](_0x36092c[_0x7422('0x3d')]['fields']));_0x194612['attributes']=_0x194612[_0x7422('0x3e')][_0x7422('0x40')]?_0x194612['attributes']:_0x3c064d[_0x7422('0x3c')];_0x194612[_0x7422('0x42')]=qs['sort'](_0x36092c[_0x7422('0x3d')][_0x7422('0x43')]);_0x194612[_0x7422('0x46')]=qs[_0x7422('0x3a')](_[_0x7422('0x44')](_0x36092c[_0x7422('0x3d')],_0x3c064d[_0x7422('0x3a')]));if(_0x36092c[_0x7422('0x3d')][_0x7422('0x45')]){_0x194612[_0x7422('0x46')]=_[_0x7422('0x57')](_0x194612[_0x7422('0x46')],{'$or':_['map'](_0x194612[_0x7422('0x3e')],function(_0x1a9529){var _0x901734={};_0x901734[_0x1a9529]={'$like':'%'+_0x36092c[_0x7422('0x3d')][_0x7422('0x45')]+'%'};return _0x901734;})});}_0x194612=_['merge']({},_0x194612,_0x36092c['options']);return _0x391ffb[_0x7422('0x67')](_0x194612);}})['then'](function(_0x11e767){if(_0x11e767){_0x44ff8b=_0x11e767[_0x7422('0x40')];if(!_0x36092c[_0x7422('0x3d')]['hasOwnProperty'](_0x7422('0x41'))){_0x194612[_0x7422('0x1f')]=qs['limit'](_0x36092c[_0x7422('0x3d')][_0x7422('0x1f')]);_0x194612['offset']=qs[_0x7422('0x1e')](_0x36092c[_0x7422('0x3d')][_0x7422('0x1e')]);}return _0x391ffb[_0x7422('0x67')](_0x194612);}})[_0x7422('0x24')](function(_0x275d6a){if(_0x275d6a){return _0x275d6a?{'count':_0x44ff8b,'rows':_0x275d6a}:null;}})[_0x7422('0x24')](respondWithResult(_0x1e1a85,null))[_0x7422('0x4c')](handleError(_0x1e1a85,null));};exports[_0x7422('0x68')]=function(_0x239a23,_0x255a1d,_0x14ae26){var _0x478a9a=_0x239a23[_0x7422('0x50')]['teams'];var _0x1edb8b=_[_0x7422('0x2c')](_0x478a9a,'id');return db[_0x7422('0x69')][_0x7422('0x60')]({'where':{'id':_0x1edb8b},'attributes':['id'],'include':[{'model':db['User'],'as':_0x7422('0x6a'),'attributes':['id',_0x7422('0x30'),_0x7422('0x6b'),'voicePause',_0x7422('0x6c')],'raw':!![]}]})[_0x7422('0x24')](function(_0x35cfa0){if(_0x35cfa0){var _0x5694aa=_[_0x7422('0x6d')](_0x35cfa0,function(_0x558b78){var _0x14461c=_0x558b78[_0x7422('0x26')]({'plain':!![]});_0x14461c[_0x7422('0x6a')]['forEach'](function(_0xb0fd85){_0xb0fd85[_0x7422('0x6e')]=_[_0x7422('0x2f')](_0x478a9a,{'id':_0x14461c['id']})[_0x7422('0x6e')];});return _0x14461c[_0x7422('0x6a')];});return db[_0x7422('0x49')]['find']({'where':{'id':_0x239a23[_0x7422('0x4e')]['id']}})[_0x7422('0x24')](function(_0x4fa684){return db[_0x7422('0x6f')]['transaction'](function(_0x52b5d2){return _0x4fa684['addTeams'](_0x1edb8b,{'transaction':_0x52b5d2})['then'](function(){return BPromise[_0x7422('0x70')](_0x5694aa,function(_0x2346f6){return db[_0x7422('0x71')][_0x7422('0x72')]({'where':{'UserId':_0x2346f6['id'],'VoiceQueueId':_0x239a23[_0x7422('0x4e')]['id']},'defaults':{'penalty':_0x2346f6[_0x7422('0x6e')]},'transaction':_0x52b5d2});});})[_0x7422('0x24')](function(){return BPromise[_0x7422('0x70')](_[_0x7422('0x45')](_0x5694aa,{'online':!![]}),function(_0x32b229){return db['UserVoiceQueueRt'][_0x7422('0x73')]({'membername':_0x32b229[_0x7422('0x30')],'UserId':_0x32b229['id'],'queue_name':_0x4fa684[_0x7422('0x30')],'VoiceQueueId':_0x4fa684['id'],'interface':_[_0x7422('0x74')](_0x32b229['interface'])?util[_0x7422('0x75')]('SIP/%s',_0x32b229['name']):_0x32b229['interface'],'paused':_0x32b229[_0x7422('0x76')]||![],'penalty':_0x32b229[_0x7422('0x6e')]},{'transaction':_0x52b5d2});});})[_0x7422('0x24')](function(){_0x5694aa[_0x7422('0x77')](function(_0x1d9c12){socket[_0x7422('0x78')](_0x7422('0x79'),{'UserId':_0x1d9c12['id'],'VoiceQueueId':_0x4fa684['id']});});});});});}})[_0x7422('0x24')](respondWithStatusCode(_0x255a1d,null))['catch'](handleError(_0x255a1d,null));};exports[_0x7422('0x7a')]=function(_0x39ab43,_0x4d36c9,_0x284098){return db[_0x7422('0x69')][_0x7422('0x60')]({'where':{'id':_0x39ab43[_0x7422('0x3d')][_0x7422('0x7b')]},'attributes':['id'],'include':[{'model':db[_0x7422('0x7c')],'as':'Agents','attributes':['id'],'raw':!![]}]})[_0x7422('0x24')](handleEntityNotFound(_0x4d36c9,null))['then'](function(_0xe3480e){var _0x54ea5e=_[_0x7422('0x2c')](_0xe3480e,'id');var _0x3ec919=[];var _0x31802b=[];var _0x494cb2=squel['select']();_0x494cb2[_0x7422('0x7d')]('tq.TeamId')[_0x7422('0x7e')](_0x7422('0x7f'),'tq')['join']('user_has_teams','ut',_0x7422('0x80'))[_0x7422('0x46')](_0x7422('0x81'),_0x39ab43[_0x7422('0x4e')]['id']);for(var _0xf49fe0=0x0;_0xf49fe0<_0xe3480e[_0x7422('0x40')];_0xf49fe0+=0x1){let _0x6b7e6b=_0xe3480e[_0xf49fe0];for(var _0x4b783c=0x0;_0x4b783c<_0x6b7e6b[_0x7422('0x6a')][_0x7422('0x40')];_0x4b783c+=0x1){let _0x44e1ff=_0x6b7e6b['Agents'][_0x4b783c];var _0x16f903=_0x494cb2[_0x7422('0x82')]();_0x16f903['where']('ut.UserId\x20=\x20?',_0x44e1ff['id']);_0x31802b[_0x7422('0x83')](db[_0x7422('0x6f')]['query'](_0x16f903['toString'](),{'type':db[_0x7422('0x6f')][_0x7422('0x84')]['SELECT']})['then'](function(_0x143871){if(_0x143871[_0x7422('0x40')]===0x1){return _0x44e1ff['id'];}else{var _0x8e9838=_[_0x7422('0x85')](_[_0x7422('0x2c')](_0x143871,_0x7422('0x86')),function(_0x22d34a){return _[_0x7422('0x87')](_0x54ea5e,_0x22d34a);});if(_0x8e9838){return _0x44e1ff['id'];}}}));}}return BPromise[_0x7422('0x88')](_0x31802b)[_0x7422('0x24')](function(_0x1b21dc){_0x3ec919=_(_0x3ec919)[_0x7422('0x89')](_0x1b21dc)[_0x7422('0x8a')]()[_0x7422('0x2d')]();return db[_0x7422('0x49')]['find']({'where':{'id':_0x39ab43[_0x7422('0x4e')]['id']}})['then'](function(_0x478eb9){return db[_0x7422('0x6f')][_0x7422('0x8b')](function(_0x5490cb){return _0x478eb9[_0x7422('0x7a')](_0x39ab43[_0x7422('0x3d')][_0x7422('0x7b')],{'transaction':_0x5490cb})[_0x7422('0x24')](function(){if(!_[_0x7422('0x8c')](_0x3ec919)){return _0x478eb9[_0x7422('0x8d')](_0x3ec919,{'transaction':_0x5490cb})[_0x7422('0x24')](function(){return db[_0x7422('0x8e')]['destroy']({'where':{'VoiceQueueId':_0x39ab43[_0x7422('0x4e')]['id'],'UserId':_0x3ec919},'transaction':_0x5490cb});});}})[_0x7422('0x24')](function(){_0x3ec919[_0x7422('0x77')](function(_0x4b0737){socket[_0x7422('0x78')](_0x7422('0x8f'),{'UserId':_0x4b0737,'VoiceQueueId':_0x478eb9['id']});});});});});});})[_0x7422('0x24')](respondWithStatusCode(_0x4d36c9,null))[_0x7422('0x4c')](handleError(_0x4d36c9,null));};exports['addAgents']=function(_0x3a6bdf,_0x3050b1,_0x55b348){var _0x17fcc0,_0x1404f7;return db[_0x7422('0x49')][_0x7422('0x2f')]({'where':{'id':_0x3a6bdf[_0x7422('0x4e')]['id']}})[_0x7422('0x24')](handleEntityNotFound(_0x3050b1,null))[_0x7422('0x24')](function(_0x47b55a){if(_0x47b55a){_0x1404f7=_0x47b55a;return _0x47b55a[_0x7422('0x90')](_0x3a6bdf[_0x7422('0x50')][_0x7422('0x7b')],_[_0x7422('0x91')](_0x3a6bdf['body'],[_0x7422('0x7b'),'id'])||{})[_0x7422('0x92')](function(_0x1e7962){for(var _0xbf136b=0x0;_0xbf136b<_0x3a6bdf[_0x7422('0x50')][_0x7422('0x7b')][_0x7422('0x40')];_0xbf136b+=0x1){socket['emit'](_0x7422('0x79'),{'UserId':_0x3a6bdf[_0x7422('0x50')][_0x7422('0x7b')][_0xbf136b],'VoiceQueueId':_0x3a6bdf[_0x7422('0x4e')]['id']});}return _0x1e7962;});}})[_0x7422('0x24')](function(_0x3875bd){_0x17fcc0=_0x3875bd||[];if(_0x1404f7){return db[_0x7422('0x7c')][_0x7422('0x60')]({'where':{'id':_0x3a6bdf['body'][_0x7422('0x7b')]},'attributes':['id',_0x7422('0x30'),'online',_0x7422('0x76'),_0x7422('0x6c')],'raw':!![]});}})[_0x7422('0x24')](function(_0x495eab){if(!_[_0x7422('0x8c')](_0x495eab)){var _0xab1c4c=[];for(var _0x31cd36=0x0;_0x31cd36<_0x495eab['length'];_0x31cd36++){if(_0x495eab[_0x31cd36][_0x7422('0x6b')]){_0xab1c4c['push'](db['UserVoiceQueueRt'][_0x7422('0x73')]({'membername':_0x495eab[_0x31cd36][_0x7422('0x30')],'UserId':_0x495eab[_0x31cd36]['id'],'queue_name':_0x1404f7[_0x7422('0x30')],'VoiceQueueId':_0x1404f7['id'],'interface':_[_0x7422('0x74')](_0x495eab[_0x31cd36][_0x7422('0x6c')])?util[_0x7422('0x75')](_0x7422('0x93'),_0x495eab[_0x31cd36]['name']):_0x495eab[_0x31cd36]['interface'],'paused':_0x495eab[_0x31cd36][_0x7422('0x76')]||![],'penalty':_0x3a6bdf[_0x7422('0x50')][_0x7422('0x6e')]||0x0}));}}return BPromise['all'](_0xab1c4c);}})['then'](function(){return _0x17fcc0;})[_0x7422('0x24')](respondWithResult(_0x3050b1,null))[_0x7422('0x4c')](handleError(_0x3050b1,null));};exports[_0x7422('0x8d')]=function(_0x211f4e,_0x22b576,_0x55e595){return db[_0x7422('0x49')][_0x7422('0x2f')]({'where':{'id':_0x211f4e[_0x7422('0x4e')]['id']}})[_0x7422('0x24')](handleEntityNotFound(_0x22b576,null))['then'](function(_0x386559){if(_0x386559){return _0x386559[_0x7422('0x8d')](_0x211f4e['query'][_0x7422('0x7b')])[_0x7422('0x24')](function(){if(_[_0x7422('0x94')](_0x211f4e['query'][_0x7422('0x7b')])){for(var _0x2ea6b5=0x0;_0x2ea6b5<_0x211f4e[_0x7422('0x3d')][_0x7422('0x7b')][_0x7422('0x40')];_0x2ea6b5+=0x1){socket[_0x7422('0x78')](_0x7422('0x8f'),{'UserId':Number(_0x211f4e[_0x7422('0x3d')][_0x7422('0x7b')][_0x2ea6b5]),'VoiceQueueId':Number(_0x211f4e[_0x7422('0x4e')]['id'])});}}else{socket[_0x7422('0x78')]('userVoiceQueue:remove',{'UserId':Number(_0x211f4e[_0x7422('0x3d')][_0x7422('0x7b')]),'VoiceQueueId':Number(_0x211f4e[_0x7422('0x4e')]['id'])});}});}})[_0x7422('0x24')](function(_0x52f55b){return db[_0x7422('0x8e')][_0x7422('0x25')]({'where':{'VoiceQueueId':_0x211f4e[_0x7422('0x4e')]['id'],'UserId':_0x211f4e[_0x7422('0x3d')][_0x7422('0x7b')]}})[_0x7422('0x24')](function(){return _0x52f55b;});})[_0x7422('0x24')](respondWithStatusCode(_0x22b576,null))[_0x7422('0x4c')](handleError(_0x22b576,null));};exports[_0x7422('0x95')]=function(_0x22413f,_0x3bfa63,_0xcaf1af){var _0x52c784={};var _0x2a57cb={};var _0x3c6a2f;var _0x3d1e70;return db['VoiceQueue']['findOne']({'where':{'id':_0x22413f[_0x7422('0x4e')]['id']}})[_0x7422('0x24')](handleEntityNotFound(_0x3bfa63,null))['then'](function(_0x4817b8){if(_0x4817b8){_0x3c6a2f=_0x4817b8;_0x2a57cb[_0x7422('0x3c')]=_[_0x7422('0x39')](db[_0x7422('0x7c')][_0x7422('0x36')]);_0x2a57cb[_0x7422('0x3d')]=_[_0x7422('0x39')](_0x22413f[_0x7422('0x3d')]);_0x2a57cb[_0x7422('0x3a')]=_['intersection'](_0x2a57cb[_0x7422('0x3c')],_0x2a57cb[_0x7422('0x3d')]);_0x52c784[_0x7422('0x3e')]=_[_0x7422('0x3b')](_0x2a57cb['model'],qs[_0x7422('0x3f')](_0x22413f['query'][_0x7422('0x3f')]));_0x52c784[_0x7422('0x3e')]=_0x52c784['attributes'][_0x7422('0x40')]?_0x52c784[_0x7422('0x3e')]:_0x2a57cb[_0x7422('0x3c')];_0x52c784[_0x7422('0x42')]=qs[_0x7422('0x43')](_0x22413f[_0x7422('0x3d')][_0x7422('0x43')]);_0x52c784[_0x7422('0x46')]=qs[_0x7422('0x3a')](_[_0x7422('0x44')](_0x22413f['query'],_0x2a57cb[_0x7422('0x3a')]));if(_0x22413f[_0x7422('0x3d')][_0x7422('0x45')]){_0x52c784[_0x7422('0x46')]=_[_0x7422('0x57')](_0x52c784[_0x7422('0x46')],{'$or':_['map'](_0x52c784[_0x7422('0x3e')],function(_0x5567be){var _0x12b4c8={};_0x12b4c8[_0x5567be]={'$like':'%'+_0x22413f[_0x7422('0x3d')][_0x7422('0x45')]+'%'};return _0x12b4c8;})});}_0x52c784=_[_0x7422('0x57')]({},_0x52c784,_0x22413f[_0x7422('0x48')]);return _0x3c6a2f[_0x7422('0x95')](_0x52c784);}})[_0x7422('0x24')](function(_0x15fbaa){if(_0x15fbaa){_0x3d1e70=_0x15fbaa[_0x7422('0x40')];if(!_0x22413f[_0x7422('0x3d')]['hasOwnProperty'](_0x7422('0x41'))){_0x52c784['limit']=qs['limit'](_0x22413f[_0x7422('0x3d')][_0x7422('0x1f')]);_0x52c784[_0x7422('0x1e')]=qs['offset'](_0x22413f[_0x7422('0x3d')][_0x7422('0x1e')]);}return _0x3c6a2f[_0x7422('0x95')](_0x52c784);}})['then'](function(_0x5cbc9f){if(_0x5cbc9f){return _0x5cbc9f?{'count':_0x3d1e70,'rows':_0x5cbc9f}:null;}})[_0x7422('0x24')](respondWithResult(_0x3bfa63,null))[_0x7422('0x4c')](handleError(_0x3bfa63,null));};exports[_0x7422('0x96')]=function(_0x3d0e3d,_0x2c63f0,_0x346eb7){var _0x2d319f={};var _0x222972={};var _0x1552ea;var _0x317d2f;return db[_0x7422('0x49')][_0x7422('0x5c')]({'where':{'id':_0x3d0e3d[_0x7422('0x4e')]['id']}})['then'](handleEntityNotFound(_0x2c63f0,null))[_0x7422('0x24')](function(_0x336664){if(_0x336664){_0x1552ea=_0x336664;_0x222972[_0x7422('0x3c')]=_['keys'](db[_0x7422('0x8e')][_0x7422('0x36')]);_0x222972['query']=_[_0x7422('0x39')](_0x3d0e3d[_0x7422('0x3d')]);_0x222972['filters']=_[_0x7422('0x3b')](_0x222972[_0x7422('0x3c')],_0x222972[_0x7422('0x3d')]);_0x2d319f[_0x7422('0x3e')]=_[_0x7422('0x3b')](_0x222972[_0x7422('0x3c')],qs['fields'](_0x3d0e3d[_0x7422('0x3d')][_0x7422('0x3f')]));_0x2d319f[_0x7422('0x3e')]=_0x2d319f['attributes'][_0x7422('0x40')]?_0x2d319f[_0x7422('0x3e')]:_0x222972[_0x7422('0x3c')];_0x2d319f['order']=qs[_0x7422('0x43')](_0x3d0e3d['query'][_0x7422('0x43')]);_0x2d319f[_0x7422('0x46')]=qs[_0x7422('0x3a')](_[_0x7422('0x44')](_0x3d0e3d[_0x7422('0x3d')],_0x222972[_0x7422('0x3a')]));if(_0x3d0e3d['query'][_0x7422('0x45')]){_0x2d319f['where']=_[_0x7422('0x57')](_0x2d319f[_0x7422('0x46')],{'$or':_[_0x7422('0x2c')](_0x2d319f[_0x7422('0x3e')],function(_0x377840){var _0x51bb4b={};_0x51bb4b[_0x377840]={'$like':'%'+_0x3d0e3d[_0x7422('0x3d')][_0x7422('0x45')]+'%'};return _0x51bb4b;})});}_0x2d319f=_['merge']({},_0x2d319f,_0x3d0e3d[_0x7422('0x48')]);return _0x1552ea[_0x7422('0x96')](_0x2d319f);}})['then'](function(_0x584a99){if(_0x584a99){_0x317d2f=_0x584a99[_0x7422('0x40')];if(!_0x3d0e3d[_0x7422('0x3d')][_0x7422('0x5e')](_0x7422('0x41'))){_0x2d319f[_0x7422('0x1f')]=qs['limit'](_0x3d0e3d[_0x7422('0x3d')][_0x7422('0x1f')]);_0x2d319f[_0x7422('0x1e')]=qs[_0x7422('0x1e')](_0x3d0e3d[_0x7422('0x3d')][_0x7422('0x1e')]);}return _0x1552ea[_0x7422('0x96')](_0x2d319f);}})[_0x7422('0x24')](function(_0xc404eb){return _0xc404eb?{'count':_0x317d2f,'rows':_0xc404eb}:null;})[_0x7422('0x24')](respondWithResult(_0x2c63f0,null))[_0x7422('0x4c')](handleError(_0x2c63f0,null));};exports[_0x7422('0x97')]=function(_0x41b4d3,_0x5e515b,_0x6eefbc){var _0x304a4c={};var _0x2322b4={};var _0x3499ce;var _0x17a277;return db[_0x7422('0x49')][_0x7422('0x5c')]({'where':{'id':_0x41b4d3[_0x7422('0x4e')]['id']}})['then'](handleEntityNotFound(_0x5e515b,null))[_0x7422('0x24')](function(_0x23be29){if(_0x23be29){_0x3499ce=_0x23be29;_0x2322b4[_0x7422('0x3c')]=_['keys'](db[_0x7422('0x98')][_0x7422('0x36')]);_0x2322b4[_0x7422('0x3d')]=_[_0x7422('0x39')](_0x41b4d3[_0x7422('0x3d')]);_0x2322b4[_0x7422('0x3a')]=_[_0x7422('0x3b')](_0x2322b4[_0x7422('0x3c')],_0x2322b4[_0x7422('0x3d')]);_0x304a4c[_0x7422('0x3e')]=_[_0x7422('0x3b')](_0x2322b4[_0x7422('0x3c')],qs[_0x7422('0x3f')](_0x41b4d3[_0x7422('0x3d')]['fields']));_0x304a4c['attributes']=_0x304a4c[_0x7422('0x3e')][_0x7422('0x40')]?_0x304a4c[_0x7422('0x3e')]:_0x2322b4[_0x7422('0x3c')];_0x304a4c[_0x7422('0x42')]=qs['sort'](_0x41b4d3[_0x7422('0x3d')]['sort']);_0x304a4c[_0x7422('0x46')]=qs[_0x7422('0x3a')](_[_0x7422('0x44')](_0x41b4d3[_0x7422('0x3d')],_0x2322b4[_0x7422('0x3a')]));if(_0x41b4d3[_0x7422('0x3d')]['filter']){_0x304a4c[_0x7422('0x46')]=_[_0x7422('0x57')](_0x304a4c[_0x7422('0x46')],{'$or':_[_0x7422('0x2c')](_0x304a4c[_0x7422('0x3e')],function(_0x3f38d4){var _0x3010fc={};_0x3010fc[_0x3f38d4]={'$like':'%'+_0x41b4d3['query'][_0x7422('0x45')]+'%'};return _0x3010fc;})});}_0x304a4c=_[_0x7422('0x57')]({},_0x304a4c,_0x41b4d3['options']);return _0x3499ce[_0x7422('0x97')](_0x304a4c);}})['then'](function(_0x5cade5){if(_0x5cade5){_0x17a277=_0x5cade5['length'];if(!_0x41b4d3['query'][_0x7422('0x5e')](_0x7422('0x41'))){_0x304a4c[_0x7422('0x1f')]=qs[_0x7422('0x1f')](_0x41b4d3[_0x7422('0x3d')]['limit']);_0x304a4c['offset']=qs[_0x7422('0x1e')](_0x41b4d3[_0x7422('0x3d')][_0x7422('0x1e')]);}return _0x3499ce['getLists'](_0x304a4c);}})[_0x7422('0x24')](function(_0x3f25be){if(_0x3f25be){return _0x3f25be?{'count':_0x17a277,'rows':_0x3f25be}:null;}})[_0x7422('0x24')](respondWithResult(_0x5e515b,null))[_0x7422('0x4c')](handleError(_0x5e515b,null));};exports['addLists']=function(_0x1f28d3,_0x40b1fc,_0x4cfdf5){var _0x232594,_0xd2c38f;return db[_0x7422('0x49')][_0x7422('0x2f')]({'where':{'id':_0x1f28d3[_0x7422('0x4e')]['id']}})['then'](handleEntityNotFound(_0x40b1fc,null))[_0x7422('0x24')](function(_0x2621d6){if(_0x2621d6){_0xd2c38f=_0x2621d6;return _0x2621d6[_0x7422('0x99')](_0x1f28d3['body'][_0x7422('0x7b')],_[_0x7422('0x91')](_0x1f28d3['body'],[_0x7422('0x7b'),'id'])||{});}return null;})[_0x7422('0x92')](function(_0x5f00b7){var _0x5d883e;_0x232594=_0x5f00b7||[];var _0x2b171b=[];if(_0x5f00b7){for(var _0x2b282b=0x0;_0x2b282b<_0x5f00b7['length'];_0x2b282b+=0x1){var _0xb007bf=_0x5f00b7[_0x2b282b][_0x7422('0x26')]({'plain':!![]});_0xd2c38f['dialCheckDuplicateType']=_0x1f28d3[_0x7422('0x50')][_0x7422('0x9a')]?_0x1f28d3['body'][_0x7422('0x9a')]:_0xd2c38f[_0x7422('0x9a')];switch(_0xd2c38f[_0x7422('0x9a')]){case _0x7422('0x9b'):_0x5d883e=squel[_0x7422('0x9c')]()[_0x7422('0x9d')](_0x7422('0x9e'))[_0x7422('0x9f')]([_0x7422('0xa0'),_0x7422('0xa1'),'ContactId',_0x7422('0xa2'),'VoiceQueueId',_0x7422('0x58'),_0x7422('0x59')],squel[_0x7422('0xa3')]()['field'](_0x7422('0xa0'),_0x7422('0xa0'))['field'](_0x7422('0xa4'),'scheduledAt')[_0x7422('0x7d')]('id','ContactId')[_0x7422('0x7d')](_0xb007bf[_0x7422('0xa5')][_0x7422('0xa6')](),'ListId')[_0x7422('0x7d')](_0x1f28d3[_0x7422('0x4e')]['id'][_0x7422('0xa6')](),'VoiceQueueId')[_0x7422('0x7d')]('NOW()','createdAt')[_0x7422('0x7d')](_0x7422('0xa4'),_0x7422('0x59'))['from'](_0x7422('0xa7'))[_0x7422('0x46')](_0x7422('0xa8'))[_0x7422('0x46')](_0x7422('0xa9'),_0xb007bf[_0x7422('0xa5')][_0x7422('0xa6')]())[_0x7422('0x46')](_0x7422('0xaa'))[_0x7422('0x46')](_0x7422('0xab'),squel[_0x7422('0xa3')]()['field']('COALESCE(calleridnum,\x27\x27)')['from'](_0x7422('0xac'))[_0x7422('0x46')]('VoiceQueueId\x20=\x20?',_0x1f28d3[_0x7422('0x4e')]['id'][_0x7422('0xa6')]()))['where'](_0x7422('0xab'),squel[_0x7422('0xa3')]()[_0x7422('0x7d')](_0x7422('0xad'))[_0x7422('0x7e')](_0x7422('0x9e'))[_0x7422('0x46')]('VoiceQueueId\x20=\x20?',_0x1f28d3[_0x7422('0x4e')]['id']['toString']())))[_0x7422('0xa6')]();break;case _0x7422('0xae'):_0x5d883e=squel['insert']()[_0x7422('0x9d')]('cm_hopper')[_0x7422('0x9f')](['phone',_0x7422('0xa1'),_0x7422('0xaf'),_0x7422('0xa2'),'VoiceQueueId','createdAt','updatedAt'],squel[_0x7422('0xa3')]()[_0x7422('0x7d')](_0x7422('0xa0'),_0x7422('0xa0'))[_0x7422('0x7d')](_0x7422('0xa4'),_0x7422('0xa1'))[_0x7422('0x7d')]('id',_0x7422('0xaf'))['field'](_0xb007bf[_0x7422('0xa5')]['toString'](),_0x7422('0xa2'))['field'](_0x1f28d3[_0x7422('0x4e')]['id'][_0x7422('0xa6')](),_0x7422('0x62'))[_0x7422('0x7d')](_0x7422('0xa4'),_0x7422('0x58'))[_0x7422('0x7d')](_0x7422('0xa4'),_0x7422('0x59'))[_0x7422('0x7e')](_0x7422('0xa7'))[_0x7422('0x46')](_0x7422('0xa8'))[_0x7422('0x46')](_0x7422('0xa9'),_0xb007bf[_0x7422('0xa5')][_0x7422('0xa6')]())[_0x7422('0x46')](_0x7422('0xaa'))[_0x7422('0x46')]('phone\x20NOT\x20IN\x20(?)',squel[_0x7422('0xa3')]()[_0x7422('0x7d')](_0x7422('0xad'))[_0x7422('0x7e')](_0x7422('0x9e'))[_0x7422('0x46')]('VoiceQueueId\x20=\x20?',_0x1f28d3[_0x7422('0x4e')]['id']['toString']())))['toString']();break;default:_0x5d883e=squel['insert']()['into'](_0x7422('0x9e'))['fromQuery']([_0x7422('0xa0'),_0x7422('0xa1'),'ContactId','ListId','VoiceQueueId',_0x7422('0x58'),'updatedAt'],squel[_0x7422('0xa3')]()[_0x7422('0x7d')](_0x7422('0xa0'),_0x7422('0xa0'))['field']('NOW()',_0x7422('0xa1'))['field']('id',_0x7422('0xaf'))[_0x7422('0x7d')](_0xb007bf[_0x7422('0xa5')][_0x7422('0xa6')](),_0x7422('0xa2'))[_0x7422('0x7d')](_0x1f28d3[_0x7422('0x4e')]['id']['toString'](),_0x7422('0x62'))[_0x7422('0x7d')](_0x7422('0xa4'),_0x7422('0x58'))[_0x7422('0x7d')](_0x7422('0xa4'),'updatedAt')[_0x7422('0x7e')]('cm_contacts')[_0x7422('0x46')](_0x7422('0xa8'))['where'](_0x7422('0xa9'),_0xb007bf[_0x7422('0xa5')][_0x7422('0xa6')]())[_0x7422('0x46')](_0x7422('0xaa')))[_0x7422('0xa6')]();}_0x2b171b[_0x7422('0x83')](db['sequelize']['query'](_0x5d883e));}return BPromise['all'](_0x2b171b);}})['then'](function(){return _0x232594;})[_0x7422('0x24')](respondWithResult(_0x40b1fc,null))[_0x7422('0x4c')](handleError(_0x40b1fc,null));};exports['removeLists']=function(_0x2682bc,_0x539ead,_0x591517){return db[_0x7422('0x49')][_0x7422('0x2f')]({'where':{'id':_0x2682bc[_0x7422('0x4e')]['id']}})[_0x7422('0x24')](handleEntityNotFound(_0x539ead,null))[_0x7422('0x24')](function(_0x3e2572){if(_0x3e2572){return _0x3e2572[_0x7422('0xb0')](_0x2682bc[_0x7422('0x3d')][_0x7422('0x7b')]);}})['then'](function(_0x3274f1){if(_0x3274f1){return db[_0x7422('0x5d')][_0x7422('0x25')]({'where':{'ListId':_0x2682bc[_0x7422('0x3d')]['ids'],'VoiceQueueId':_0x2682bc[_0x7422('0x4e')]['id']}})[_0x7422('0x24')](function(){return _0x3274f1;});}})[_0x7422('0x24')](respondWithStatusCode(_0x539ead,null))[_0x7422('0x4c')](handleError(_0x539ead,null));};exports[_0x7422('0xb1')]=function(_0x4d7e71,_0x15a09a,_0x238698){var _0x510ca3={};var _0x187049={};var _0x4d4317;var _0x2a3e90;return db[_0x7422('0x49')][_0x7422('0x5c')]({'where':{'id':_0x4d7e71[_0x7422('0x4e')]['id']}})[_0x7422('0x24')](handleEntityNotFound(_0x15a09a,null))[_0x7422('0x24')](function(_0x392cb8){if(_0x392cb8){_0x4d4317=_0x392cb8;_0x187049['model']=_['keys'](db[_0x7422('0x98')]['rawAttributes']);_0x187049[_0x7422('0x3d')]=_['keys'](_0x4d7e71[_0x7422('0x3d')]);_0x187049[_0x7422('0x3a')]=_[_0x7422('0x3b')](_0x187049[_0x7422('0x3c')],_0x187049['query']);_0x510ca3[_0x7422('0x3e')]=_[_0x7422('0x3b')](_0x187049[_0x7422('0x3c')],qs[_0x7422('0x3f')](_0x4d7e71[_0x7422('0x3d')][_0x7422('0x3f')]));_0x510ca3[_0x7422('0x3e')]=_0x510ca3['attributes'][_0x7422('0x40')]?_0x510ca3[_0x7422('0x3e')]:_0x187049['model'];_0x510ca3[_0x7422('0x42')]=qs['sort'](_0x4d7e71[_0x7422('0x3d')]['sort']);_0x510ca3[_0x7422('0x46')]=qs[_0x7422('0x3a')](_['pick'](_0x4d7e71[_0x7422('0x3d')],_0x187049[_0x7422('0x3a')]));if(_0x4d7e71[_0x7422('0x3d')]['filter']){_0x510ca3[_0x7422('0x46')]=_[_0x7422('0x57')](_0x510ca3[_0x7422('0x46')],{'$or':_[_0x7422('0x2c')](_0x510ca3['attributes'],function(_0x2c0102){var _0x38f756={};_0x38f756[_0x2c0102]={'$like':'%'+_0x4d7e71['query'][_0x7422('0x45')]+'%'};return _0x38f756;})});}_0x510ca3=_[_0x7422('0x57')]({},_0x510ca3,_0x4d7e71['options']);return _0x4d4317[_0x7422('0xb1')](_0x510ca3);}})[_0x7422('0x24')](function(_0x7579d4){if(_0x7579d4){_0x2a3e90=_0x7579d4[_0x7422('0x40')];if(!_0x4d7e71['query']['hasOwnProperty'](_0x7422('0x41'))){_0x510ca3[_0x7422('0x1f')]=qs[_0x7422('0x1f')](_0x4d7e71[_0x7422('0x3d')][_0x7422('0x1f')]);_0x510ca3[_0x7422('0x1e')]=qs[_0x7422('0x1e')](_0x4d7e71[_0x7422('0x3d')][_0x7422('0x1e')]);}return _0x4d4317[_0x7422('0xb1')](_0x510ca3);}})[_0x7422('0x24')](function(_0x3a9c30){if(_0x3a9c30){return _0x3a9c30?{'count':_0x2a3e90,'rows':_0x3a9c30}:null;}})[_0x7422('0x24')](respondWithResult(_0x15a09a,null))['catch'](handleError(_0x15a09a,null));};exports[_0x7422('0xb2')]=function(_0x3155b4,_0x4a31c2,_0x5b3b3e){var _0x11c086,_0x4060a0;return db[_0x7422('0x49')][_0x7422('0x2f')]({'where':{'id':_0x3155b4[_0x7422('0x4e')]['id']}})[_0x7422('0x24')](handleEntityNotFound(_0x4a31c2,null))[_0x7422('0x24')](function(_0x189c6e){if(_0x189c6e){_0x4060a0=_0x189c6e;return _0x189c6e['addBlackLists'](_0x3155b4[_0x7422('0x50')][_0x7422('0x7b')],_['omit'](_0x3155b4['body'],['ids','id'])||{});}return null;})['spread'](function(_0x30bf64){var _0x567d5d;_0x11c086=_0x30bf64||[];var _0x273f58=[];if(_0x30bf64){for(var _0x1711b2=0x0;_0x1711b2<_0x30bf64['length'];_0x1711b2+=0x1){var _0x122bad=_0x30bf64[_0x1711b2][_0x7422('0x26')]({'plain':!![]});_0x567d5d=squel[_0x7422('0x9c')]()['into'](_0x7422('0xb3'))[_0x7422('0x9f')]([_0x7422('0xa0'),_0x7422('0xaf'),_0x7422('0xa2'),_0x7422('0x62'),_0x7422('0x58'),_0x7422('0x59')],squel['select']()[_0x7422('0x7d')](_0x7422('0xa0'),'phone')['field']('id',_0x7422('0xaf'))[_0x7422('0x7d')](_0x122bad[_0x7422('0xa5')]['toString'](),'ListId')[_0x7422('0x7d')](_0x3155b4[_0x7422('0x4e')]['id'][_0x7422('0xa6')](),_0x7422('0x62'))[_0x7422('0x7d')](_0x7422('0xa4'),'createdAt')[_0x7422('0x7d')](_0x7422('0xa4'),_0x7422('0x59'))['from']('cm_contacts')['where'](_0x7422('0xa8'))[_0x7422('0x46')]('ListId\x20=\x20?',_0x122bad[_0x7422('0xa5')][_0x7422('0xa6')]())[_0x7422('0x46')](_0x7422('0xaa')))[_0x7422('0xa6')]();_0x273f58[_0x7422('0x83')](db[_0x7422('0x6f')][_0x7422('0x3d')](_0x567d5d));}return BPromise[_0x7422('0x88')](_0x273f58);}})['then'](function(){return _0x11c086;})[_0x7422('0x24')](respondWithResult(_0x4a31c2,null))['catch'](handleError(_0x4a31c2,null));};exports[_0x7422('0xb4')]=function(_0x5a3350,_0x58a55a,_0x1cab4f){return db[_0x7422('0x49')]['find']({'where':{'id':_0x5a3350['params']['id']}})[_0x7422('0x24')](handleEntityNotFound(_0x58a55a,null))[_0x7422('0x24')](function(_0x55c47b){if(_0x55c47b){return _0x55c47b[_0x7422('0xb4')](_0x5a3350[_0x7422('0x3d')][_0x7422('0x7b')]);}})[_0x7422('0x24')](function(_0x20110e){if(_0x20110e){return db['CmHopperBlack'][_0x7422('0x25')]({'where':{'ListId':_0x5a3350[_0x7422('0x3d')][_0x7422('0x7b')],'VoiceQueueId':_0x5a3350['params']['id']}})[_0x7422('0x24')](function(){return _0x20110e;});}})[_0x7422('0x24')](respondWithStatusCode(_0x58a55a,null))['catch'](handleError(_0x58a55a,null));}; \ No newline at end of file +var _0x99cd=['VIRTUAL','filter','options','includeAll','include','findAll','rows','catch','show','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','outbound','UserProfileSection','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','rawAttributes','omit','createdAt','updatedAt','userProfileId','error','update','getHoppers','findOne','CmHopper','VoiceQueueId','CmHopperHistory','CmHopperFinal','getHopperBlacks','CmHopperBlack','Team','getTeams','addTeams','teams','Agents','online','voicePause','interface','flatMap','forEach','penalty','transaction','each','UserVoiceQueue','UserVoiceQueueRt','upsert','isNil','format','SIP/%s','userVoiceQueue:save','removeTeams','User','field','tq.TeamId','from','join','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','ut.UserId\x20=\x20?','push','sequelize','QueryTypes','SELECT','includes','all','union','compact','ids','removeAgents','emit','addAgents','spread','isEmpty','isArray','getAgents','getMembers','getLists','CmList','dialCheckDuplicateType','insert','into','cm_hopper','fromQuery','phone','scheduledAt','ListId','select','NOW()','ContactId','cm_contacts','ListId\x20=\x20?','CmListId','toString','phone\x20NOT\x20IN\x20(?)','COALESCE(calleridnum,\x27\x27)','VoiceQueueId\x20=\x20?','COALESCE(phone,\x27\x27)','onlyIfOpen','deletedAt\x20IS\x20NULL','removeLists','getBlackLists','addBlackLists','cm_hopper_black','removeBlackLists','html-pdf','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','ejs','squel','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','defaults','redis','localhost','socket.io-emitter','register','sendStatus','end','status','json','count','offset','set','Content-Range','apply','reject','save','then','get','VoiceQueues','inbound','QueueCampaigns','ignore','map','value','type','find','name','destroy','stack','send','VoiceQueue','fieldName','key','query','keys','filters','intersection','model','fields','attributes','length','hasOwnProperty','nolimit','limit','order','sort','where','pick','merge'];(function(_0x21dab3,_0x567bdb){var _0x4ee96f=function(_0x243696){while(--_0x243696){_0x21dab3['push'](_0x21dab3['shift']());}};_0x4ee96f(++_0x567bdb);}(_0x99cd,0x1df));var _0xd99c=function(_0x137c51,_0x1b0ab4){_0x137c51=_0x137c51-0x0;var _0x77b4d3=_0x99cd[_0x137c51];return _0x77b4d3;};'use strict';var pdf=require(_0xd99c('0x0'));var emlformat=require('eml-format');var rimraf=require(_0xd99c('0x1'));var zipdir=require(_0xd99c('0x2'));var jsonpatch=require(_0xd99c('0x3'));var rp=require(_0xd99c('0x4'));var moment=require(_0xd99c('0x5'));var BPromise=require(_0xd99c('0x6'));var Mustache=require(_0xd99c('0x7'));var util=require(_0xd99c('0x8'));var path=require(_0xd99c('0x9'));var sox=require(_0xd99c('0xa'));var csv=require('to-csv');var ejs=require(_0xd99c('0xb'));var fs=require('fs');var _=require('lodash');var squel=require(_0xd99c('0xc'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0xd99c('0xd'));var toCsv=require(_0xd99c('0xe'));var querystring=require(_0xd99c('0xf'));var Papa=require(_0xd99c('0x10'));var Redis=require(_0xd99c('0x11'));var authService=require(_0xd99c('0x12'));var qs=require(_0xd99c('0x13'));var as=require(_0xd99c('0x14'));var hardwareService=require(_0xd99c('0x15'));var logger=require(_0xd99c('0x16'))(_0xd99c('0x17'));var utils=require(_0xd99c('0x18'));var config=require(_0xd99c('0x19'));var db=require(_0xd99c('0x1a'))['db'];config['redis']=_[_0xd99c('0x1b')](config[_0xd99c('0x1c')],{'host':_0xd99c('0x1d'),'port':0x18eb});var socket=require(_0xd99c('0x1e'))(new Redis(config[_0xd99c('0x1c')]));require('./voiceQueue.socket')[_0xd99c('0x1f')](socket);function respondWithStatusCode(_0x407696,_0x471dcb){_0x471dcb=_0x471dcb||0xcc;return function(_0x4773fa){if(_0x4773fa){return _0x407696[_0xd99c('0x20')](_0x471dcb);}return _0x407696['status'](_0x471dcb)[_0xd99c('0x21')]();};}function respondWithResult(_0x31d5d6,_0x35b50f){_0x35b50f=_0x35b50f||0xc8;return function(_0x1d94b4){if(_0x1d94b4){return _0x31d5d6[_0xd99c('0x22')](_0x35b50f)[_0xd99c('0x23')](_0x1d94b4);}};}function respondWithFilteredResult(_0x1fa06d,_0x177aa6){return function(_0x4d2e2b){if(_0x4d2e2b){var _0x486607=_0x4d2e2b[_0xd99c('0x24')],_0x27db70=_0x177aa6[_0xd99c('0x25')],_0x2d98cb=_0x177aa6[_0xd99c('0x25')]+_0x177aa6['limit'],_0xeb2165;if(_0x2d98cb>=_0x486607){_0x2d98cb=_0x486607;_0xeb2165=0xc8;}else{_0xeb2165=0xce;}_0x1fa06d['status'](_0xeb2165);return _0x1fa06d[_0xd99c('0x26')](_0xd99c('0x27'),_0x27db70+'-'+_0x2d98cb+'/'+_0x486607)[_0xd99c('0x23')](_0x4d2e2b);}return null;};}function patchUpdates(_0x11b683){return function(_0x2d57b0){try{jsonpatch[_0xd99c('0x28')](_0x2d57b0,_0x11b683,!![]);}catch(_0x12c487){return BPromise[_0xd99c('0x29')](_0x12c487);}return _0x2d57b0[_0xd99c('0x2a')]();};}function saveUpdates(_0x1d84bb,_0x2cfbeb){return function(_0x33ca6a){if(_0x33ca6a){return _0x33ca6a['update'](_0x1d84bb)[_0xd99c('0x2b')](function(_0x4a700d){return _0x4a700d;});}return null;};}function removeEntity(_0x5cbb9f,_0x14ffb8){return function(_0x2604f1){if(_0x2604f1){return _0x2604f1['destroy']()['then'](function(){var _0x54ff0c=_0x2604f1[_0xd99c('0x2c')]({'plain':!![]});var _0x54b844=[{'name':_0xd99c('0x2d'),'value':_0xd99c('0x2e'),'ignore':![]},{'name':_0xd99c('0x2f'),'value':'outbound','ignore':![]}];var _0x22c83f=_(_0x54b844)['filter'](_0xd99c('0x30'))[_0xd99c('0x31')](_0xd99c('0x32'))['value']();if(_['includes'](_0x22c83f,_0x54ff0c[_0xd99c('0x33')])){return;}var _0x14cf86=_[_0xd99c('0x34')](_0x54b844,[_0xd99c('0x32'),_0x54ff0c[_0xd99c('0x33')]])[_0xd99c('0x35')];return db['UserProfileResource'][_0xd99c('0x36')]({'where':{'type':_0x14cf86,'resourceId':_0x54ff0c['id']}})[_0xd99c('0x2b')](function(){return _0x2604f1;});})[_0xd99c('0x2b')](function(){_0x5cbb9f['status'](0xcc)[_0xd99c('0x21')]();});}};}function handleEntityNotFound(_0x3cdfce,_0x506f8f){return function(_0x3cdab0){if(!_0x3cdab0){_0x3cdfce['sendStatus'](0x194);}return _0x3cdab0;};}function handleError(_0xc0ad42,_0x4c4405){_0x4c4405=_0x4c4405||0x1f4;return function(_0x4b524c){logger['error'](_0x4b524c[_0xd99c('0x37')]);if(_0x4b524c[_0xd99c('0x35')]){delete _0x4b524c['name'];}_0xc0ad42[_0xd99c('0x22')](_0x4c4405)[_0xd99c('0x38')](_0x4b524c);};}exports['index']=function(_0x380594,_0x11f254){var _0x2ab816={},_0x494e0b={},_0xf2f2ea={'count':0x0,'rows':[]};var _0x9998e0=_[_0xd99c('0x31')](db[_0xd99c('0x39')]['rawAttributes'],function(_0x44bf0e){return{'name':_0x44bf0e[_0xd99c('0x3a')],'type':_0x44bf0e[_0xd99c('0x33')][_0xd99c('0x3b')]};});_0x494e0b['model']=_['map'](_0x9998e0,'name');_0x494e0b[_0xd99c('0x3c')]=_[_0xd99c('0x3d')](_0x380594[_0xd99c('0x3c')]);_0x494e0b[_0xd99c('0x3e')]=_[_0xd99c('0x3f')](_0x494e0b['model'],_0x494e0b[_0xd99c('0x3c')]);_0x2ab816['attributes']=_[_0xd99c('0x3f')](_0x494e0b[_0xd99c('0x40')],qs[_0xd99c('0x41')](_0x380594[_0xd99c('0x3c')]['fields']));_0x2ab816[_0xd99c('0x42')]=_0x2ab816[_0xd99c('0x42')][_0xd99c('0x43')]?_0x2ab816['attributes']:_0x494e0b[_0xd99c('0x40')];if(!_0x380594[_0xd99c('0x3c')][_0xd99c('0x44')](_0xd99c('0x45'))){_0x2ab816[_0xd99c('0x46')]=qs[_0xd99c('0x46')](_0x380594['query'][_0xd99c('0x46')]);_0x2ab816[_0xd99c('0x25')]=qs[_0xd99c('0x25')](_0x380594[_0xd99c('0x3c')]['offset']);}_0x2ab816[_0xd99c('0x47')]=qs[_0xd99c('0x48')](_0x380594[_0xd99c('0x3c')][_0xd99c('0x48')]);_0x2ab816[_0xd99c('0x49')]=qs[_0xd99c('0x3e')](_[_0xd99c('0x4a')](_0x380594['query'],_0x494e0b[_0xd99c('0x3e')]));if(_0x380594[_0xd99c('0x3c')]['filter']){_0x2ab816[_0xd99c('0x49')]=_[_0xd99c('0x4b')](_0x2ab816[_0xd99c('0x49')],{'$or':_[_0xd99c('0x31')](_0x9998e0,function(_0x17c189){if(_0x17c189[_0xd99c('0x33')]!==_0xd99c('0x4c')){var _0x59c9f0={};_0x59c9f0[_0x17c189[_0xd99c('0x35')]]={'$like':'%'+_0x380594[_0xd99c('0x3c')][_0xd99c('0x4d')]+'%'};return _0x59c9f0;}})});}_0x2ab816=_[_0xd99c('0x4b')]({},_0x2ab816,_0x380594[_0xd99c('0x4e')]);var _0x458e1f={'where':_0x2ab816[_0xd99c('0x49')]};return db[_0xd99c('0x39')][_0xd99c('0x24')](_0x458e1f)[_0xd99c('0x2b')](function(_0x3747ab){_0xf2f2ea[_0xd99c('0x24')]=_0x3747ab;if(_0x380594[_0xd99c('0x3c')][_0xd99c('0x4f')]){_0x2ab816[_0xd99c('0x50')]=[{'all':!![]}];}return db[_0xd99c('0x39')][_0xd99c('0x51')](_0x2ab816);})[_0xd99c('0x2b')](function(_0xbb0b14){_0xf2f2ea[_0xd99c('0x52')]=_0xbb0b14;return _0xf2f2ea;})['then'](respondWithFilteredResult(_0x11f254,_0x2ab816))[_0xd99c('0x53')](handleError(_0x11f254,null));};exports[_0xd99c('0x54')]=function(_0x3159d8,_0xd0aa3e){var _0x183194={'raw':![],'where':{'id':_0x3159d8['params']['id']}},_0x1770ca={};_0x1770ca[_0xd99c('0x40')]=_[_0xd99c('0x3d')](db['VoiceQueue']['rawAttributes']);_0x1770ca[_0xd99c('0x3c')]=_[_0xd99c('0x3d')](_0x3159d8['query']);_0x1770ca[_0xd99c('0x3e')]=_[_0xd99c('0x3f')](_0x1770ca[_0xd99c('0x40')],_0x1770ca[_0xd99c('0x3c')]);_0x183194[_0xd99c('0x42')]=_['intersection'](_0x1770ca[_0xd99c('0x40')],qs[_0xd99c('0x41')](_0x3159d8['query'][_0xd99c('0x41')]));_0x183194['attributes']=_0x183194[_0xd99c('0x42')][_0xd99c('0x43')]?_0x183194[_0xd99c('0x42')]:_0x1770ca[_0xd99c('0x40')];if(_0x3159d8[_0xd99c('0x3c')][_0xd99c('0x4f')]){_0x183194['include']=[{'all':!![]}];}_0x183194=_[_0xd99c('0x4b')]({},_0x183194,_0x3159d8['options']);return db[_0xd99c('0x39')][_0xd99c('0x34')](_0x183194)[_0xd99c('0x2b')](handleEntityNotFound(_0xd0aa3e,null))[_0xd99c('0x2b')](respondWithResult(_0xd0aa3e,null))[_0xd99c('0x53')](handleError(_0xd0aa3e,null));};exports[_0xd99c('0x55')]=function(_0x48ec2b,_0x27b427){return db['VoiceQueue'][_0xd99c('0x55')](_0x48ec2b[_0xd99c('0x56')],{})[_0xd99c('0x2b')](function(_0x29acae){var _0xae8040=_0x48ec2b['user'][_0xd99c('0x2c')]({'plain':!![]});if(!_0xae8040)throw new Error(_0xd99c('0x57'));if(_0xae8040[_0xd99c('0x58')]===_0xd99c('0x59')){var _0x131934=_0x29acae[_0xd99c('0x2c')]({'plain':!![]});var _0xdc13ec=[{'name':_0xd99c('0x2d'),'value':_0xd99c('0x2e')},{'name':'QueueCampaigns','value':_0xd99c('0x5a')}];var _0x5e0085=_[_0xd99c('0x34')](_0xdc13ec,[_0xd99c('0x32'),_0x131934[_0xd99c('0x33')]])[_0xd99c('0x35')];return db[_0xd99c('0x5b')][_0xd99c('0x34')]({'where':{'name':_0x5e0085,'userProfileId':_0xae8040['userProfileId']},'raw':!![]})['then'](function(_0x5b2bb7){if(_0x5b2bb7&&_0x5b2bb7[_0xd99c('0x5c')]===0x0){return db[_0xd99c('0x5d')][_0xd99c('0x55')]({'name':_0x131934[_0xd99c('0x35')],'resourceId':_0x131934['id'],'type':_0x5b2bb7['name'],'sectionId':_0x5b2bb7['id']},{})[_0xd99c('0x2b')](function(){return _0x29acae;});}else{return _0x29acae;}})['catch'](function(_0x2ba7cb){logger['error'](_0xd99c('0x5e'),_0x2ba7cb);throw _0x2ba7cb;});}return _0x29acae;})[_0xd99c('0x2b')](respondWithResult(_0x27b427,0xc9))[_0xd99c('0x53')](handleError(_0x27b427,null));};exports['clone']=function(_0x34b8c1,_0x45fd0d){var _0x3fe608={'where':{'id':_0x34b8c1[_0xd99c('0x5f')]['id']}},_0x23a626={};_0x23a626[_0xd99c('0x40')]=_[_0xd99c('0x3d')](db['VoiceQueue'][_0xd99c('0x60')]);_0x3fe608[_0xd99c('0x42')]=_['intersection'](_0x23a626[_0xd99c('0x40')],qs[_0xd99c('0x41')](_0x34b8c1[_0xd99c('0x3c')][_0xd99c('0x41')]));_0x3fe608[_0xd99c('0x42')]=_0x3fe608['attributes'][_0xd99c('0x43')]?_0x3fe608[_0xd99c('0x42')]:_0x23a626[_0xd99c('0x40')];if(_0x34b8c1['query'][_0xd99c('0x4f')]){_0x3fe608['include']=[{'all':!![]}];}_0x3fe608=_[_0xd99c('0x4b')]({},_0x3fe608,_0x34b8c1[_0xd99c('0x4e')]);return db[_0xd99c('0x39')][_0xd99c('0x34')](_0x3fe608)[_0xd99c('0x2b')](handleEntityNotFound(_0x45fd0d,null))[_0xd99c('0x2b')](function(_0x3eb7e9){if(_0x3eb7e9){var _0x38b409=_0x3eb7e9[_0xd99c('0x2c')]({'plain':!![]});_0x38b409=qs[_0xd99c('0x61')](_0x38b409,['id',_0xd99c('0x62'),_0xd99c('0x63')]);_0x34b8c1['body']=_[_0xd99c('0x61')](_0x34b8c1['body'],['id','createdAt',_0xd99c('0x63')]);return db[_0xd99c('0x39')]['create'](_['merge'](_0x38b409,_0x34b8c1[_0xd99c('0x56')]),{'include':_0x34b8c1[_0xd99c('0x3c')][_0xd99c('0x4f')]?[{'all':!![]}]:undefined})['then'](function(_0x4e4770){var _0x11fcc0=_0x34b8c1['user'][_0xd99c('0x2c')]({'plain':!![]});if(!_0x11fcc0)throw new Error(_0xd99c('0x57'));if(_0x11fcc0['role']===_0xd99c('0x59')){var _0x763c9b=_0x4e4770[_0xd99c('0x2c')]({'plain':!![]});var _0x4f8e66=[{'name':'VoiceQueues','value':_0xd99c('0x2e')},{'name':_0xd99c('0x2f'),'value':_0xd99c('0x5a')}];var _0x1c9206=_['find'](_0x4f8e66,[_0xd99c('0x32'),_0x763c9b[_0xd99c('0x33')]])[_0xd99c('0x35')];return db[_0xd99c('0x5b')][_0xd99c('0x34')]({'where':{'name':_0x1c9206,'userProfileId':_0x11fcc0[_0xd99c('0x64')]},'raw':!![]})[_0xd99c('0x2b')](function(_0xdd2cd3){if(_0xdd2cd3&&_0xdd2cd3[_0xd99c('0x5c')]===0x0){return db[_0xd99c('0x5d')]['create']({'name':_0x763c9b[_0xd99c('0x35')],'resourceId':_0x763c9b['id'],'type':_0xdd2cd3['name'],'sectionId':_0xdd2cd3['id']},{})[_0xd99c('0x2b')](function(){return _0x4e4770;});}else{return _0x4e4770;}})[_0xd99c('0x53')](function(_0x106a79){logger[_0xd99c('0x65')](_0xd99c('0x5e'),_0x106a79);throw _0x106a79;});}return _0x4e4770;});}})[_0xd99c('0x2b')](respondWithResult(_0x45fd0d,0xc9))[_0xd99c('0x53')](handleError(_0x45fd0d,null));};exports[_0xd99c('0x66')]=function(_0x3d90c3,_0x5995d8){if(_0x3d90c3['body']['id']){delete _0x3d90c3[_0xd99c('0x56')]['id'];}return db[_0xd99c('0x39')][_0xd99c('0x34')]({'where':{'id':_0x3d90c3[_0xd99c('0x5f')]['id']}})[_0xd99c('0x2b')](handleEntityNotFound(_0x5995d8,null))[_0xd99c('0x2b')](saveUpdates(_0x3d90c3[_0xd99c('0x56')],null))[_0xd99c('0x2b')](respondWithResult(_0x5995d8,null))[_0xd99c('0x53')](handleError(_0x5995d8,null));};exports[_0xd99c('0x36')]=function(_0x29403e,_0x381102){return db[_0xd99c('0x39')][_0xd99c('0x34')]({'where':{'id':_0x29403e[_0xd99c('0x5f')]['id']}})[_0xd99c('0x2b')](handleEntityNotFound(_0x381102,null))[_0xd99c('0x2b')](removeEntity(_0x381102,null))[_0xd99c('0x53')](handleError(_0x381102,null));};exports[_0xd99c('0x67')]=function(_0x34629e,_0x53f885,_0x200628){var _0x535787={'raw':![],'where':{}};var _0x136f20={};var _0x105337={'count':0x0,'rows':[]};return db['VoiceQueue'][_0xd99c('0x68')]({'where':{'id':_0x34629e[_0xd99c('0x5f')]['id']}})[_0xd99c('0x2b')](handleEntityNotFound(_0x53f885,null))[_0xd99c('0x2b')](function(_0x14b6ff){if(_0x14b6ff){_0x136f20[_0xd99c('0x40')]=_['keys'](db[_0xd99c('0x69')]['rawAttributes']);_0x136f20[_0xd99c('0x3c')]=_[_0xd99c('0x3d')](_0x34629e[_0xd99c('0x3c')]);_0x136f20[_0xd99c('0x3e')]=_[_0xd99c('0x3f')](_0x136f20['model'],_0x136f20[_0xd99c('0x3c')]);_0x535787[_0xd99c('0x42')]=_[_0xd99c('0x3f')](_0x136f20['model'],qs[_0xd99c('0x41')](_0x34629e[_0xd99c('0x3c')][_0xd99c('0x41')]));_0x535787[_0xd99c('0x42')]=_0x535787['attributes'][_0xd99c('0x43')]?_0x535787[_0xd99c('0x42')]:_0x136f20[_0xd99c('0x40')];if(!_0x34629e[_0xd99c('0x3c')][_0xd99c('0x44')](_0xd99c('0x45'))){_0x535787[_0xd99c('0x46')]=qs[_0xd99c('0x46')](_0x34629e[_0xd99c('0x3c')][_0xd99c('0x46')]);_0x535787[_0xd99c('0x25')]=qs[_0xd99c('0x25')](_0x34629e[_0xd99c('0x3c')][_0xd99c('0x25')]);}_0x535787[_0xd99c('0x47')]=qs[_0xd99c('0x48')](_0x34629e[_0xd99c('0x3c')]['sort']);_0x535787[_0xd99c('0x49')]=qs['filters'](_[_0xd99c('0x4a')](_0x34629e[_0xd99c('0x3c')],_0x136f20[_0xd99c('0x3e')]));_0x535787[_0xd99c('0x49')][_0xd99c('0x6a')]=_0x14b6ff['id'];if(_0x34629e['query'][_0xd99c('0x4d')]){_0x535787[_0xd99c('0x49')]=_[_0xd99c('0x4b')](_0x535787[_0xd99c('0x49')],{'$or':_['map'](_0x535787[_0xd99c('0x42')],function(_0x92e0f6){var _0x1d8cc0={};_0x1d8cc0[_0x92e0f6]={'$like':'%'+_0x34629e[_0xd99c('0x3c')][_0xd99c('0x4d')]+'%'};return _0x1d8cc0;})});}_0x535787=_[_0xd99c('0x4b')]({},_0x535787,_0x34629e[_0xd99c('0x4e')]);return db[_0xd99c('0x69')][_0xd99c('0x24')]({'where':_0x535787[_0xd99c('0x49')]})[_0xd99c('0x2b')](function(_0x39ce8d){_0x105337[_0xd99c('0x24')]=_0x39ce8d;if(_0x34629e[_0xd99c('0x3c')][_0xd99c('0x4f')]){_0x535787[_0xd99c('0x50')]=[{'all':!![]}];}return db[_0xd99c('0x69')][_0xd99c('0x51')](_0x535787);})[_0xd99c('0x2b')](function(_0x456ba7){_0x105337[_0xd99c('0x52')]=_0x456ba7;return _0x105337;});}})[_0xd99c('0x2b')](respondWithFilteredResult(_0x53f885,_0x535787))[_0xd99c('0x53')](handleError(_0x53f885,null));};exports['getHopperHistories']=function(_0x1a389b,_0x482e57,_0x71680a){var _0x2afb21={'raw':!![],'where':{}};var _0x354167={};var _0x20028b={'count':0x0,'rows':[]};return db[_0xd99c('0x39')][_0xd99c('0x68')]({'where':{'id':_0x1a389b[_0xd99c('0x5f')]['id']}})['then'](handleEntityNotFound(_0x482e57,null))[_0xd99c('0x2b')](function(_0x18efff){if(_0x18efff){_0x354167['model']=_['keys'](db['CmHopperHistory'][_0xd99c('0x60')]);_0x354167[_0xd99c('0x3c')]=_[_0xd99c('0x3d')](_0x1a389b[_0xd99c('0x3c')]);_0x354167[_0xd99c('0x3e')]=_[_0xd99c('0x3f')](_0x354167[_0xd99c('0x40')],_0x354167[_0xd99c('0x3c')]);_0x2afb21['attributes']=_['intersection'](_0x354167['model'],qs['fields'](_0x1a389b[_0xd99c('0x3c')][_0xd99c('0x41')]));_0x2afb21[_0xd99c('0x42')]=_0x2afb21[_0xd99c('0x42')][_0xd99c('0x43')]?_0x2afb21['attributes']:_0x354167['model'];if(!_0x1a389b[_0xd99c('0x3c')][_0xd99c('0x44')]('nolimit')){_0x2afb21[_0xd99c('0x46')]=qs[_0xd99c('0x46')](_0x1a389b[_0xd99c('0x3c')][_0xd99c('0x46')]);_0x2afb21['offset']=qs[_0xd99c('0x25')](_0x1a389b['query'][_0xd99c('0x25')]);}_0x2afb21['order']=qs[_0xd99c('0x48')](_0x1a389b[_0xd99c('0x3c')][_0xd99c('0x48')]);_0x2afb21[_0xd99c('0x49')]=qs[_0xd99c('0x3e')](_[_0xd99c('0x4a')](_0x1a389b[_0xd99c('0x3c')],_0x354167[_0xd99c('0x3e')]));_0x2afb21[_0xd99c('0x49')][_0xd99c('0x6a')]=_0x18efff['id'];if(_0x1a389b[_0xd99c('0x3c')][_0xd99c('0x4d')]){_0x2afb21[_0xd99c('0x49')]=_[_0xd99c('0x4b')](_0x2afb21[_0xd99c('0x49')],{'$or':_[_0xd99c('0x31')](_0x2afb21[_0xd99c('0x42')],function(_0x3283eb){var _0x344238={};_0x344238[_0x3283eb]={'$like':'%'+_0x1a389b[_0xd99c('0x3c')]['filter']+'%'};return _0x344238;})});}_0x2afb21=_[_0xd99c('0x4b')]({},_0x2afb21,_0x1a389b['options']);return db[_0xd99c('0x6b')][_0xd99c('0x24')]({'where':_0x2afb21[_0xd99c('0x49')]})[_0xd99c('0x2b')](function(_0x520658){_0x20028b[_0xd99c('0x24')]=_0x520658;if(_0x1a389b[_0xd99c('0x3c')][_0xd99c('0x4f')]){_0x2afb21[_0xd99c('0x50')]=[{'all':!![]}];}return db[_0xd99c('0x6b')][_0xd99c('0x51')](_0x2afb21);})[_0xd99c('0x2b')](function(_0x292e56){_0x20028b[_0xd99c('0x52')]=_0x292e56;return _0x20028b;});}})[_0xd99c('0x2b')](respondWithFilteredResult(_0x482e57,_0x2afb21))[_0xd99c('0x53')](handleError(_0x482e57,null));};exports['getHopperFinals']=function(_0x6109da,_0x2dceab,_0x434248){var _0x2caf0f={'raw':!![],'where':{}};var _0x444ee0={};var _0x1a8180={'count':0x0,'rows':[]};return db[_0xd99c('0x39')][_0xd99c('0x68')]({'where':{'id':_0x6109da['params']['id']}})[_0xd99c('0x2b')](handleEntityNotFound(_0x2dceab,null))[_0xd99c('0x2b')](function(_0x2daf9d){if(_0x2daf9d){_0x444ee0[_0xd99c('0x40')]=_[_0xd99c('0x3d')](db[_0xd99c('0x6c')]['rawAttributes']);_0x444ee0[_0xd99c('0x3c')]=_[_0xd99c('0x3d')](_0x6109da['query']);_0x444ee0['filters']=_['intersection'](_0x444ee0[_0xd99c('0x40')],_0x444ee0['query']);_0x2caf0f[_0xd99c('0x42')]=_[_0xd99c('0x3f')](_0x444ee0[_0xd99c('0x40')],qs[_0xd99c('0x41')](_0x6109da['query'][_0xd99c('0x41')]));_0x2caf0f[_0xd99c('0x42')]=_0x2caf0f['attributes']['length']?_0x2caf0f['attributes']:_0x444ee0['model'];if(!_0x6109da[_0xd99c('0x3c')][_0xd99c('0x44')](_0xd99c('0x45'))){_0x2caf0f[_0xd99c('0x46')]=qs[_0xd99c('0x46')](_0x6109da[_0xd99c('0x3c')][_0xd99c('0x46')]);_0x2caf0f[_0xd99c('0x25')]=qs[_0xd99c('0x25')](_0x6109da['query']['offset']);}_0x2caf0f['order']=qs[_0xd99c('0x48')](_0x6109da[_0xd99c('0x3c')][_0xd99c('0x48')]);_0x2caf0f[_0xd99c('0x49')]=qs[_0xd99c('0x3e')](_['pick'](_0x6109da[_0xd99c('0x3c')],_0x444ee0[_0xd99c('0x3e')]));_0x2caf0f[_0xd99c('0x49')][_0xd99c('0x6a')]=_0x2daf9d['id'];if(_0x6109da[_0xd99c('0x3c')][_0xd99c('0x4d')]){_0x2caf0f[_0xd99c('0x49')]=_[_0xd99c('0x4b')](_0x2caf0f[_0xd99c('0x49')],{'$or':_['map'](_0x2caf0f[_0xd99c('0x42')],function(_0x1d5990){var _0x3fd0f9={};_0x3fd0f9[_0x1d5990]={'$like':'%'+_0x6109da['query']['filter']+'%'};return _0x3fd0f9;})});}_0x2caf0f=_[_0xd99c('0x4b')]({},_0x2caf0f,_0x6109da[_0xd99c('0x4e')]);return db['CmHopperFinal']['count']({'where':_0x2caf0f[_0xd99c('0x49')]})[_0xd99c('0x2b')](function(_0x8ee98f){_0x1a8180[_0xd99c('0x24')]=_0x8ee98f;if(_0x6109da[_0xd99c('0x3c')][_0xd99c('0x4f')]){_0x2caf0f['include']=[{'all':!![]}];}return db[_0xd99c('0x6c')][_0xd99c('0x51')](_0x2caf0f);})[_0xd99c('0x2b')](function(_0x5c1c53){_0x1a8180[_0xd99c('0x52')]=_0x5c1c53;return _0x1a8180;});}})['then'](respondWithFilteredResult(_0x2dceab,_0x2caf0f))[_0xd99c('0x53')](handleError(_0x2dceab,null));};exports[_0xd99c('0x6d')]=function(_0x59b83b,_0x14c603,_0x164a8b){var _0x2a81ec={'raw':!![],'where':{}};var _0x2ebc4c={};var _0x1998c0={'count':0x0,'rows':[]};return db['VoiceQueue'][_0xd99c('0x68')]({'where':{'id':_0x59b83b[_0xd99c('0x5f')]['id']}})[_0xd99c('0x2b')](handleEntityNotFound(_0x14c603,null))[_0xd99c('0x2b')](function(_0x431b08){if(_0x431b08){_0x2ebc4c[_0xd99c('0x40')]=_[_0xd99c('0x3d')](db[_0xd99c('0x6e')][_0xd99c('0x60')]);_0x2ebc4c['query']=_[_0xd99c('0x3d')](_0x59b83b[_0xd99c('0x3c')]);_0x2ebc4c['filters']=_[_0xd99c('0x3f')](_0x2ebc4c[_0xd99c('0x40')],_0x2ebc4c[_0xd99c('0x3c')]);_0x2a81ec[_0xd99c('0x42')]=_['intersection'](_0x2ebc4c['model'],qs['fields'](_0x59b83b[_0xd99c('0x3c')][_0xd99c('0x41')]));_0x2a81ec[_0xd99c('0x42')]=_0x2a81ec['attributes'][_0xd99c('0x43')]?_0x2a81ec[_0xd99c('0x42')]:_0x2ebc4c['model'];if(!_0x59b83b[_0xd99c('0x3c')][_0xd99c('0x44')](_0xd99c('0x45'))){_0x2a81ec[_0xd99c('0x46')]=qs[_0xd99c('0x46')](_0x59b83b[_0xd99c('0x3c')][_0xd99c('0x46')]);_0x2a81ec[_0xd99c('0x25')]=qs[_0xd99c('0x25')](_0x59b83b[_0xd99c('0x3c')]['offset']);}_0x2a81ec[_0xd99c('0x47')]=qs[_0xd99c('0x48')](_0x59b83b[_0xd99c('0x3c')]['sort']);_0x2a81ec[_0xd99c('0x49')]=qs['filters'](_['pick'](_0x59b83b[_0xd99c('0x3c')],_0x2ebc4c['filters']));_0x2a81ec[_0xd99c('0x49')][_0xd99c('0x6a')]=_0x431b08['id'];if(_0x59b83b['query'][_0xd99c('0x4d')]){_0x2a81ec['where']=_[_0xd99c('0x4b')](_0x2a81ec[_0xd99c('0x49')],{'$or':_[_0xd99c('0x31')](_0x2a81ec[_0xd99c('0x42')],function(_0x91a483){var _0x5d9c7e={};_0x5d9c7e[_0x91a483]={'$like':'%'+_0x59b83b[_0xd99c('0x3c')][_0xd99c('0x4d')]+'%'};return _0x5d9c7e;})});}_0x2a81ec=_['merge']({},_0x2a81ec,_0x59b83b['options']);return db[_0xd99c('0x6e')][_0xd99c('0x24')]({'where':_0x2a81ec[_0xd99c('0x49')]})[_0xd99c('0x2b')](function(_0x1ced09){_0x1998c0['count']=_0x1ced09;if(_0x59b83b[_0xd99c('0x3c')]['includeAll']){_0x2a81ec[_0xd99c('0x50')]=[{'all':!![]}];}return db[_0xd99c('0x6e')][_0xd99c('0x51')](_0x2a81ec);})[_0xd99c('0x2b')](function(_0x5f0236){_0x1998c0[_0xd99c('0x52')]=_0x5f0236;return _0x1998c0;});}})[_0xd99c('0x2b')](respondWithFilteredResult(_0x14c603,_0x2a81ec))['catch'](handleError(_0x14c603,null));};exports['getTeams']=function(_0x2d63d0,_0x2e0236,_0x476979){var _0x260409={};var _0x30cbad={};var _0x1a2189;var _0x482bdf;return db['VoiceQueue'][_0xd99c('0x68')]({'where':{'id':_0x2d63d0[_0xd99c('0x5f')]['id']}})[_0xd99c('0x2b')](handleEntityNotFound(_0x2e0236,null))[_0xd99c('0x2b')](function(_0x5caaa4){if(_0x5caaa4){_0x1a2189=_0x5caaa4;_0x30cbad['model']=_[_0xd99c('0x3d')](db[_0xd99c('0x6f')]['rawAttributes']);_0x30cbad[_0xd99c('0x3c')]=_[_0xd99c('0x3d')](_0x2d63d0[_0xd99c('0x3c')]);_0x30cbad['filters']=_['intersection'](_0x30cbad['model'],_0x30cbad['query']);_0x260409[_0xd99c('0x42')]=_[_0xd99c('0x3f')](_0x30cbad[_0xd99c('0x40')],qs[_0xd99c('0x41')](_0x2d63d0[_0xd99c('0x3c')][_0xd99c('0x41')]));_0x260409['attributes']=_0x260409[_0xd99c('0x42')][_0xd99c('0x43')]?_0x260409[_0xd99c('0x42')]:_0x30cbad[_0xd99c('0x40')];_0x260409[_0xd99c('0x47')]=qs[_0xd99c('0x48')](_0x2d63d0['query'][_0xd99c('0x48')]);_0x260409[_0xd99c('0x49')]=qs[_0xd99c('0x3e')](_['pick'](_0x2d63d0[_0xd99c('0x3c')],_0x30cbad[_0xd99c('0x3e')]));if(_0x2d63d0[_0xd99c('0x3c')]['filter']){_0x260409[_0xd99c('0x49')]=_['merge'](_0x260409[_0xd99c('0x49')],{'$or':_[_0xd99c('0x31')](_0x260409[_0xd99c('0x42')],function(_0x3fb8ec){var _0x385178={};_0x385178[_0x3fb8ec]={'$like':'%'+_0x2d63d0[_0xd99c('0x3c')][_0xd99c('0x4d')]+'%'};return _0x385178;})});}_0x260409=_[_0xd99c('0x4b')]({},_0x260409,_0x2d63d0[_0xd99c('0x4e')]);return _0x1a2189[_0xd99c('0x70')](_0x260409);}})[_0xd99c('0x2b')](function(_0xe0bf09){if(_0xe0bf09){_0x482bdf=_0xe0bf09[_0xd99c('0x43')];if(!_0x2d63d0['query'][_0xd99c('0x44')](_0xd99c('0x45'))){_0x260409[_0xd99c('0x46')]=qs[_0xd99c('0x46')](_0x2d63d0[_0xd99c('0x3c')][_0xd99c('0x46')]);_0x260409[_0xd99c('0x25')]=qs['offset'](_0x2d63d0['query'][_0xd99c('0x25')]);}return _0x1a2189[_0xd99c('0x70')](_0x260409);}})[_0xd99c('0x2b')](function(_0x399117){if(_0x399117){return _0x399117?{'count':_0x482bdf,'rows':_0x399117}:null;}})['then'](respondWithResult(_0x2e0236,null))[_0xd99c('0x53')](handleError(_0x2e0236,null));};exports[_0xd99c('0x71')]=function(_0x2d9ebe,_0x68f4f3,_0x431c88){var _0x860ef3=_0x2d9ebe[_0xd99c('0x56')][_0xd99c('0x72')];var _0x3af467=_[_0xd99c('0x31')](_0x860ef3,'id');return db['Team'][_0xd99c('0x51')]({'where':{'id':_0x3af467},'attributes':['id'],'include':[{'model':db['User'],'as':_0xd99c('0x73'),'attributes':['id','name',_0xd99c('0x74'),_0xd99c('0x75'),_0xd99c('0x76')],'raw':!![]}]})[_0xd99c('0x2b')](function(_0x346772){if(_0x346772){var _0x17e169=_[_0xd99c('0x77')](_0x346772,function(_0x396841){var _0x17a756=_0x396841['get']({'plain':!![]});_0x17a756['Agents'][_0xd99c('0x78')](function(_0x49c7fb){_0x49c7fb['penalty']=_['find'](_0x860ef3,{'id':_0x17a756['id']})[_0xd99c('0x79')];});return _0x17a756[_0xd99c('0x73')];});return db['VoiceQueue'][_0xd99c('0x34')]({'where':{'id':_0x2d9ebe[_0xd99c('0x5f')]['id']}})[_0xd99c('0x2b')](function(_0x592546){return db['sequelize'][_0xd99c('0x7a')](function(_0x6a0a30){return _0x592546[_0xd99c('0x71')](_0x3af467,{'transaction':_0x6a0a30})[_0xd99c('0x2b')](function(){return BPromise[_0xd99c('0x7b')](_0x17e169,function(_0x49b377){return db[_0xd99c('0x7c')]['findOrCreate']({'where':{'UserId':_0x49b377['id'],'VoiceQueueId':_0x2d9ebe[_0xd99c('0x5f')]['id']},'defaults':{'penalty':_0x49b377[_0xd99c('0x79')]},'transaction':_0x6a0a30});});})[_0xd99c('0x2b')](function(){return BPromise[_0xd99c('0x7b')](_['filter'](_0x17e169,{'online':!![]}),function(_0x4822bf){return db[_0xd99c('0x7d')][_0xd99c('0x7e')]({'membername':_0x4822bf[_0xd99c('0x35')],'UserId':_0x4822bf['id'],'queue_name':_0x592546[_0xd99c('0x35')],'VoiceQueueId':_0x592546['id'],'interface':_[_0xd99c('0x7f')](_0x4822bf[_0xd99c('0x76')])?util[_0xd99c('0x80')](_0xd99c('0x81'),_0x4822bf[_0xd99c('0x35')]):_0x4822bf['interface'],'paused':_0x4822bf[_0xd99c('0x75')]||![],'penalty':_0x4822bf['penalty']},{'transaction':_0x6a0a30});});})['then'](function(){_0x17e169[_0xd99c('0x78')](function(_0x483fbb){socket['emit'](_0xd99c('0x82'),{'UserId':_0x483fbb['id'],'VoiceQueueId':_0x592546['id']});});});});});}})[_0xd99c('0x2b')](respondWithStatusCode(_0x68f4f3,null))[_0xd99c('0x53')](handleError(_0x68f4f3,null));};exports[_0xd99c('0x83')]=function(_0x3f1d81,_0x404cac,_0x22009d){return db[_0xd99c('0x6f')][_0xd99c('0x51')]({'where':{'id':_0x3f1d81[_0xd99c('0x3c')]['ids']},'attributes':['id'],'include':[{'model':db[_0xd99c('0x84')],'as':'Agents','attributes':['id'],'raw':!![]}]})[_0xd99c('0x2b')](handleEntityNotFound(_0x404cac,null))[_0xd99c('0x2b')](function(_0x1232dc){var _0x4a9908=_[_0xd99c('0x31')](_0x1232dc,'id');var _0xc1d3d4=[];var _0x319d49=[];var _0x202ede=squel['select']();_0x202ede[_0xd99c('0x85')](_0xd99c('0x86'))[_0xd99c('0x87')]('team_has_voice_queues','tq')[_0xd99c('0x88')](_0xd99c('0x89'),'ut',_0xd99c('0x8a'))['where']('VoiceQueueId\x20=\x20?',_0x3f1d81[_0xd99c('0x5f')]['id']);for(var _0x44d017=0x0;_0x44d017<_0x1232dc[_0xd99c('0x43')];_0x44d017+=0x1){let _0x224c6c=_0x1232dc[_0x44d017];for(var _0x546ed7=0x0;_0x546ed7<_0x224c6c['Agents'][_0xd99c('0x43')];_0x546ed7+=0x1){let _0xd334a3=_0x224c6c[_0xd99c('0x73')][_0x546ed7];var _0x5b0860=_0x202ede['clone']();_0x5b0860['where'](_0xd99c('0x8b'),_0xd334a3['id']);_0x319d49[_0xd99c('0x8c')](db[_0xd99c('0x8d')][_0xd99c('0x3c')](_0x5b0860['toString'](),{'type':db['sequelize'][_0xd99c('0x8e')][_0xd99c('0x8f')]})[_0xd99c('0x2b')](function(_0x10dd96){if(_0x10dd96['length']===0x1){return _0xd334a3['id'];}else{var _0x116f49=_['every'](_[_0xd99c('0x31')](_0x10dd96,'TeamId'),function(_0x122041){return _[_0xd99c('0x90')](_0x4a9908,_0x122041);});if(_0x116f49){return _0xd334a3['id'];}}}));}}return BPromise[_0xd99c('0x91')](_0x319d49)['then'](function(_0x4039aa){_0xc1d3d4=_(_0xc1d3d4)[_0xd99c('0x92')](_0x4039aa)[_0xd99c('0x93')]()[_0xd99c('0x32')]();return db['VoiceQueue'][_0xd99c('0x34')]({'where':{'id':_0x3f1d81[_0xd99c('0x5f')]['id']}})['then'](function(_0x237ce9){return db[_0xd99c('0x8d')][_0xd99c('0x7a')](function(_0x5c4456){return _0x237ce9[_0xd99c('0x83')](_0x3f1d81[_0xd99c('0x3c')][_0xd99c('0x94')],{'transaction':_0x5c4456})['then'](function(){if(!_['isEmpty'](_0xc1d3d4)){return _0x237ce9[_0xd99c('0x95')](_0xc1d3d4,{'transaction':_0x5c4456})[_0xd99c('0x2b')](function(){return db[_0xd99c('0x7d')][_0xd99c('0x36')]({'where':{'VoiceQueueId':_0x3f1d81[_0xd99c('0x5f')]['id'],'UserId':_0xc1d3d4},'transaction':_0x5c4456});});}})[_0xd99c('0x2b')](function(){_0xc1d3d4['forEach'](function(_0x35d011){socket[_0xd99c('0x96')]('userVoiceQueue:remove',{'UserId':_0x35d011,'VoiceQueueId':_0x237ce9['id']});});});});});});})['then'](respondWithStatusCode(_0x404cac,null))[_0xd99c('0x53')](handleError(_0x404cac,null));};exports[_0xd99c('0x97')]=function(_0x5b3c3a,_0x90acd5,_0x3e53dd){var _0x14d601,_0x2039a4;return db['VoiceQueue'][_0xd99c('0x34')]({'where':{'id':_0x5b3c3a[_0xd99c('0x5f')]['id']}})[_0xd99c('0x2b')](handleEntityNotFound(_0x90acd5,null))['then'](function(_0x47458b){if(_0x47458b){_0x2039a4=_0x47458b;return _0x47458b[_0xd99c('0x97')](_0x5b3c3a[_0xd99c('0x56')][_0xd99c('0x94')],_[_0xd99c('0x61')](_0x5b3c3a['body'],[_0xd99c('0x94'),'id'])||{})[_0xd99c('0x98')](function(_0x44e25a){for(var _0x470a87=0x0;_0x470a87<_0x5b3c3a[_0xd99c('0x56')]['ids'][_0xd99c('0x43')];_0x470a87+=0x1){socket[_0xd99c('0x96')](_0xd99c('0x82'),{'UserId':_0x5b3c3a['body'][_0xd99c('0x94')][_0x470a87],'VoiceQueueId':_0x5b3c3a['params']['id']});}return _0x44e25a;});}})['then'](function(_0x3bb1b4){_0x14d601=_0x3bb1b4||[];if(_0x2039a4){return db['User']['findAll']({'where':{'id':_0x5b3c3a['body'][_0xd99c('0x94')]},'attributes':['id',_0xd99c('0x35'),_0xd99c('0x74'),'voicePause','interface'],'raw':!![]});}})['then'](function(_0x42b35d){if(!_[_0xd99c('0x99')](_0x42b35d)){var _0x9c1a70=[];for(var _0x27e976=0x0;_0x27e976<_0x42b35d[_0xd99c('0x43')];_0x27e976++){if(_0x42b35d[_0x27e976][_0xd99c('0x74')]){_0x9c1a70['push'](db[_0xd99c('0x7d')][_0xd99c('0x7e')]({'membername':_0x42b35d[_0x27e976][_0xd99c('0x35')],'UserId':_0x42b35d[_0x27e976]['id'],'queue_name':_0x2039a4[_0xd99c('0x35')],'VoiceQueueId':_0x2039a4['id'],'interface':_['isNil'](_0x42b35d[_0x27e976][_0xd99c('0x76')])?util[_0xd99c('0x80')](_0xd99c('0x81'),_0x42b35d[_0x27e976][_0xd99c('0x35')]):_0x42b35d[_0x27e976][_0xd99c('0x76')],'paused':_0x42b35d[_0x27e976][_0xd99c('0x75')]||![],'penalty':_0x5b3c3a[_0xd99c('0x56')]['penalty']||0x0}));}}return BPromise['all'](_0x9c1a70);}})[_0xd99c('0x2b')](function(){return _0x14d601;})[_0xd99c('0x2b')](respondWithResult(_0x90acd5,null))[_0xd99c('0x53')](handleError(_0x90acd5,null));};exports[_0xd99c('0x95')]=function(_0x2f92c4,_0xfdf637,_0x32a7d2){return db['VoiceQueue'][_0xd99c('0x34')]({'where':{'id':_0x2f92c4[_0xd99c('0x5f')]['id']}})['then'](handleEntityNotFound(_0xfdf637,null))[_0xd99c('0x2b')](function(_0x516dda){if(_0x516dda){return _0x516dda['removeAgents'](_0x2f92c4[_0xd99c('0x3c')][_0xd99c('0x94')])[_0xd99c('0x2b')](function(){if(_[_0xd99c('0x9a')](_0x2f92c4[_0xd99c('0x3c')][_0xd99c('0x94')])){for(var _0x596908=0x0;_0x596908<_0x2f92c4[_0xd99c('0x3c')][_0xd99c('0x94')][_0xd99c('0x43')];_0x596908+=0x1){socket['emit']('userVoiceQueue:remove',{'UserId':Number(_0x2f92c4[_0xd99c('0x3c')][_0xd99c('0x94')][_0x596908]),'VoiceQueueId':Number(_0x2f92c4[_0xd99c('0x5f')]['id'])});}}else{socket[_0xd99c('0x96')]('userVoiceQueue:remove',{'UserId':Number(_0x2f92c4[_0xd99c('0x3c')]['ids']),'VoiceQueueId':Number(_0x2f92c4['params']['id'])});}});}})[_0xd99c('0x2b')](function(_0xe17042){return db[_0xd99c('0x7d')][_0xd99c('0x36')]({'where':{'VoiceQueueId':_0x2f92c4[_0xd99c('0x5f')]['id'],'UserId':_0x2f92c4[_0xd99c('0x3c')][_0xd99c('0x94')]}})[_0xd99c('0x2b')](function(){return _0xe17042;});})[_0xd99c('0x2b')](respondWithStatusCode(_0xfdf637,null))[_0xd99c('0x53')](handleError(_0xfdf637,null));};exports['getAgents']=function(_0x1a59bd,_0x246597,_0x4835b5){var _0x3858b6={};var _0xb6bde8={};var _0x2bf852;var _0x11a756;return db[_0xd99c('0x39')]['findOne']({'where':{'id':_0x1a59bd[_0xd99c('0x5f')]['id']}})[_0xd99c('0x2b')](handleEntityNotFound(_0x246597,null))[_0xd99c('0x2b')](function(_0x3471ca){if(_0x3471ca){_0x2bf852=_0x3471ca;_0xb6bde8['model']=_[_0xd99c('0x3d')](db[_0xd99c('0x84')][_0xd99c('0x60')]);_0xb6bde8[_0xd99c('0x3c')]=_['keys'](_0x1a59bd[_0xd99c('0x3c')]);_0xb6bde8[_0xd99c('0x3e')]=_['intersection'](_0xb6bde8['model'],_0xb6bde8['query']);_0x3858b6['attributes']=_[_0xd99c('0x3f')](_0xb6bde8['model'],qs[_0xd99c('0x41')](_0x1a59bd[_0xd99c('0x3c')][_0xd99c('0x41')]));_0x3858b6[_0xd99c('0x42')]=_0x3858b6[_0xd99c('0x42')]['length']?_0x3858b6['attributes']:_0xb6bde8['model'];_0x3858b6[_0xd99c('0x47')]=qs['sort'](_0x1a59bd['query']['sort']);_0x3858b6['where']=qs[_0xd99c('0x3e')](_['pick'](_0x1a59bd[_0xd99c('0x3c')],_0xb6bde8['filters']));if(_0x1a59bd[_0xd99c('0x3c')][_0xd99c('0x4d')]){_0x3858b6[_0xd99c('0x49')]=_[_0xd99c('0x4b')](_0x3858b6[_0xd99c('0x49')],{'$or':_[_0xd99c('0x31')](_0x3858b6[_0xd99c('0x42')],function(_0x3c65ee){var _0x371d1c={};_0x371d1c[_0x3c65ee]={'$like':'%'+_0x1a59bd[_0xd99c('0x3c')][_0xd99c('0x4d')]+'%'};return _0x371d1c;})});}_0x3858b6=_[_0xd99c('0x4b')]({},_0x3858b6,_0x1a59bd[_0xd99c('0x4e')]);return _0x2bf852[_0xd99c('0x9b')](_0x3858b6);}})[_0xd99c('0x2b')](function(_0x34b19f){if(_0x34b19f){_0x11a756=_0x34b19f[_0xd99c('0x43')];if(!_0x1a59bd[_0xd99c('0x3c')]['hasOwnProperty']('nolimit')){_0x3858b6['limit']=qs[_0xd99c('0x46')](_0x1a59bd[_0xd99c('0x3c')][_0xd99c('0x46')]);_0x3858b6[_0xd99c('0x25')]=qs[_0xd99c('0x25')](_0x1a59bd[_0xd99c('0x3c')][_0xd99c('0x25')]);}return _0x2bf852[_0xd99c('0x9b')](_0x3858b6);}})[_0xd99c('0x2b')](function(_0x143f60){if(_0x143f60){return _0x143f60?{'count':_0x11a756,'rows':_0x143f60}:null;}})[_0xd99c('0x2b')](respondWithResult(_0x246597,null))[_0xd99c('0x53')](handleError(_0x246597,null));};exports[_0xd99c('0x9c')]=function(_0x406cd3,_0x169d06,_0x17aa02){var _0x208b30={};var _0x15184d={};var _0x2e642b;var _0x3e2493;return db['VoiceQueue'][_0xd99c('0x68')]({'where':{'id':_0x406cd3[_0xd99c('0x5f')]['id']}})[_0xd99c('0x2b')](handleEntityNotFound(_0x169d06,null))[_0xd99c('0x2b')](function(_0x95ca79){if(_0x95ca79){_0x2e642b=_0x95ca79;_0x15184d[_0xd99c('0x40')]=_[_0xd99c('0x3d')](db[_0xd99c('0x7d')][_0xd99c('0x60')]);_0x15184d[_0xd99c('0x3c')]=_[_0xd99c('0x3d')](_0x406cd3['query']);_0x15184d['filters']=_[_0xd99c('0x3f')](_0x15184d[_0xd99c('0x40')],_0x15184d['query']);_0x208b30[_0xd99c('0x42')]=_[_0xd99c('0x3f')](_0x15184d[_0xd99c('0x40')],qs[_0xd99c('0x41')](_0x406cd3['query'][_0xd99c('0x41')]));_0x208b30[_0xd99c('0x42')]=_0x208b30[_0xd99c('0x42')][_0xd99c('0x43')]?_0x208b30[_0xd99c('0x42')]:_0x15184d[_0xd99c('0x40')];_0x208b30[_0xd99c('0x47')]=qs[_0xd99c('0x48')](_0x406cd3[_0xd99c('0x3c')]['sort']);_0x208b30[_0xd99c('0x49')]=qs[_0xd99c('0x3e')](_[_0xd99c('0x4a')](_0x406cd3[_0xd99c('0x3c')],_0x15184d[_0xd99c('0x3e')]));if(_0x406cd3['query'][_0xd99c('0x4d')]){_0x208b30[_0xd99c('0x49')]=_[_0xd99c('0x4b')](_0x208b30[_0xd99c('0x49')],{'$or':_[_0xd99c('0x31')](_0x208b30['attributes'],function(_0x1a017a){var _0x1be4bc={};_0x1be4bc[_0x1a017a]={'$like':'%'+_0x406cd3[_0xd99c('0x3c')]['filter']+'%'};return _0x1be4bc;})});}_0x208b30=_[_0xd99c('0x4b')]({},_0x208b30,_0x406cd3[_0xd99c('0x4e')]);return _0x2e642b[_0xd99c('0x9c')](_0x208b30);}})[_0xd99c('0x2b')](function(_0x31f789){if(_0x31f789){_0x3e2493=_0x31f789[_0xd99c('0x43')];if(!_0x406cd3[_0xd99c('0x3c')][_0xd99c('0x44')](_0xd99c('0x45'))){_0x208b30[_0xd99c('0x46')]=qs['limit'](_0x406cd3[_0xd99c('0x3c')][_0xd99c('0x46')]);_0x208b30[_0xd99c('0x25')]=qs[_0xd99c('0x25')](_0x406cd3[_0xd99c('0x3c')]['offset']);}return _0x2e642b[_0xd99c('0x9c')](_0x208b30);}})[_0xd99c('0x2b')](function(_0x5b6457){return _0x5b6457?{'count':_0x3e2493,'rows':_0x5b6457}:null;})[_0xd99c('0x2b')](respondWithResult(_0x169d06,null))['catch'](handleError(_0x169d06,null));};exports[_0xd99c('0x9d')]=function(_0x5655d2,_0x44de00,_0x4dc995){var _0x3b347b={};var _0xac5403={};var _0x2b3eb2;var _0x5a08b2;return db['VoiceQueue'][_0xd99c('0x68')]({'where':{'id':_0x5655d2[_0xd99c('0x5f')]['id']}})['then'](handleEntityNotFound(_0x44de00,null))[_0xd99c('0x2b')](function(_0x239b88){if(_0x239b88){_0x2b3eb2=_0x239b88;_0xac5403['model']=_['keys'](db[_0xd99c('0x9e')][_0xd99c('0x60')]);_0xac5403[_0xd99c('0x3c')]=_[_0xd99c('0x3d')](_0x5655d2[_0xd99c('0x3c')]);_0xac5403[_0xd99c('0x3e')]=_[_0xd99c('0x3f')](_0xac5403['model'],_0xac5403[_0xd99c('0x3c')]);_0x3b347b[_0xd99c('0x42')]=_[_0xd99c('0x3f')](_0xac5403[_0xd99c('0x40')],qs[_0xd99c('0x41')](_0x5655d2[_0xd99c('0x3c')][_0xd99c('0x41')]));_0x3b347b['attributes']=_0x3b347b[_0xd99c('0x42')][_0xd99c('0x43')]?_0x3b347b[_0xd99c('0x42')]:_0xac5403['model'];_0x3b347b['order']=qs['sort'](_0x5655d2[_0xd99c('0x3c')][_0xd99c('0x48')]);_0x3b347b[_0xd99c('0x49')]=qs[_0xd99c('0x3e')](_[_0xd99c('0x4a')](_0x5655d2['query'],_0xac5403[_0xd99c('0x3e')]));if(_0x5655d2['query'][_0xd99c('0x4d')]){_0x3b347b[_0xd99c('0x49')]=_[_0xd99c('0x4b')](_0x3b347b[_0xd99c('0x49')],{'$or':_[_0xd99c('0x31')](_0x3b347b[_0xd99c('0x42')],function(_0x38a7a1){var _0x1464ac={};_0x1464ac[_0x38a7a1]={'$like':'%'+_0x5655d2['query'][_0xd99c('0x4d')]+'%'};return _0x1464ac;})});}_0x3b347b=_[_0xd99c('0x4b')]({},_0x3b347b,_0x5655d2[_0xd99c('0x4e')]);return _0x2b3eb2[_0xd99c('0x9d')](_0x3b347b);}})[_0xd99c('0x2b')](function(_0x51ee04){if(_0x51ee04){_0x5a08b2=_0x51ee04[_0xd99c('0x43')];if(!_0x5655d2[_0xd99c('0x3c')]['hasOwnProperty']('nolimit')){_0x3b347b[_0xd99c('0x46')]=qs['limit'](_0x5655d2['query'][_0xd99c('0x46')]);_0x3b347b[_0xd99c('0x25')]=qs[_0xd99c('0x25')](_0x5655d2[_0xd99c('0x3c')][_0xd99c('0x25')]);}return _0x2b3eb2['getLists'](_0x3b347b);}})[_0xd99c('0x2b')](function(_0x17f871){if(_0x17f871){return _0x17f871?{'count':_0x5a08b2,'rows':_0x17f871}:null;}})[_0xd99c('0x2b')](respondWithResult(_0x44de00,null))[_0xd99c('0x53')](handleError(_0x44de00,null));};exports['addLists']=function(_0x4ff8ce,_0xe5b359,_0x1df66a){var _0x2102d2,_0x7274a3;return db[_0xd99c('0x39')][_0xd99c('0x34')]({'where':{'id':_0x4ff8ce['params']['id']}})[_0xd99c('0x2b')](handleEntityNotFound(_0xe5b359,null))[_0xd99c('0x2b')](function(_0xb9921c){if(_0xb9921c){_0x7274a3=_0xb9921c;return _0xb9921c['addLists'](_0x4ff8ce[_0xd99c('0x56')][_0xd99c('0x94')],_['omit'](_0x4ff8ce[_0xd99c('0x56')],[_0xd99c('0x94'),'id'])||{});}return null;})[_0xd99c('0x98')](function(_0x2a014a){var _0x3aefa9;_0x2102d2=_0x2a014a||[];var _0x143921=[];if(_0x2a014a){for(var _0x4ee426=0x0;_0x4ee426<_0x2a014a[_0xd99c('0x43')];_0x4ee426+=0x1){var _0x32cf88=_0x2a014a[_0x4ee426][_0xd99c('0x2c')]({'plain':!![]});_0x7274a3[_0xd99c('0x9f')]=_0x4ff8ce[_0xd99c('0x56')]['dialCheckDuplicateType']?_0x4ff8ce[_0xd99c('0x56')][_0xd99c('0x9f')]:_0x7274a3[_0xd99c('0x9f')];switch(_0x7274a3[_0xd99c('0x9f')]){case'always':_0x3aefa9=squel[_0xd99c('0xa0')]()[_0xd99c('0xa1')](_0xd99c('0xa2'))[_0xd99c('0xa3')]([_0xd99c('0xa4'),_0xd99c('0xa5'),'ContactId',_0xd99c('0xa6'),'VoiceQueueId','createdAt',_0xd99c('0x63')],squel[_0xd99c('0xa7')]()['field'](_0xd99c('0xa4'),'phone')[_0xd99c('0x85')](_0xd99c('0xa8'),_0xd99c('0xa5'))[_0xd99c('0x85')]('id',_0xd99c('0xa9'))[_0xd99c('0x85')](_0x32cf88['CmListId']['toString'](),_0xd99c('0xa6'))[_0xd99c('0x85')](_0x4ff8ce['params']['id']['toString'](),'VoiceQueueId')[_0xd99c('0x85')](_0xd99c('0xa8'),_0xd99c('0x62'))[_0xd99c('0x85')](_0xd99c('0xa8'),'updatedAt')[_0xd99c('0x87')](_0xd99c('0xaa'))[_0xd99c('0x49')]('deletedAt\x20IS\x20NULL')[_0xd99c('0x49')](_0xd99c('0xab'),_0x32cf88[_0xd99c('0xac')][_0xd99c('0xad')]())[_0xd99c('0x49')]('phone\x20IS\x20NOT\x20NULL')[_0xd99c('0x49')](_0xd99c('0xae'),squel[_0xd99c('0xa7')]()[_0xd99c('0x85')](_0xd99c('0xaf'))['from']('cm_hopper_final')[_0xd99c('0x49')](_0xd99c('0xb0'),_0x4ff8ce['params']['id']['toString']()))[_0xd99c('0x49')](_0xd99c('0xae'),squel['select']()['field'](_0xd99c('0xb1'))[_0xd99c('0x87')](_0xd99c('0xa2'))[_0xd99c('0x49')]('VoiceQueueId\x20=\x20?',_0x4ff8ce[_0xd99c('0x5f')]['id'][_0xd99c('0xad')]())))['toString']();break;case _0xd99c('0xb2'):_0x3aefa9=squel[_0xd99c('0xa0')]()[_0xd99c('0xa1')](_0xd99c('0xa2'))[_0xd99c('0xa3')](['phone','scheduledAt',_0xd99c('0xa9'),_0xd99c('0xa6'),_0xd99c('0x6a'),_0xd99c('0x62'),_0xd99c('0x63')],squel[_0xd99c('0xa7')]()[_0xd99c('0x85')]('phone',_0xd99c('0xa4'))['field'](_0xd99c('0xa8'),_0xd99c('0xa5'))['field']('id',_0xd99c('0xa9'))[_0xd99c('0x85')](_0x32cf88[_0xd99c('0xac')][_0xd99c('0xad')](),_0xd99c('0xa6'))[_0xd99c('0x85')](_0x4ff8ce[_0xd99c('0x5f')]['id'][_0xd99c('0xad')](),_0xd99c('0x6a'))[_0xd99c('0x85')](_0xd99c('0xa8'),_0xd99c('0x62'))[_0xd99c('0x85')]('NOW()',_0xd99c('0x63'))[_0xd99c('0x87')]('cm_contacts')['where'](_0xd99c('0xb3'))['where'](_0xd99c('0xab'),_0x32cf88['CmListId'][_0xd99c('0xad')]())['where']('phone\x20IS\x20NOT\x20NULL')[_0xd99c('0x49')](_0xd99c('0xae'),squel[_0xd99c('0xa7')]()[_0xd99c('0x85')](_0xd99c('0xb1'))[_0xd99c('0x87')](_0xd99c('0xa2'))[_0xd99c('0x49')]('VoiceQueueId\x20=\x20?',_0x4ff8ce[_0xd99c('0x5f')]['id'][_0xd99c('0xad')]())))[_0xd99c('0xad')]();break;default:_0x3aefa9=squel[_0xd99c('0xa0')]()['into'](_0xd99c('0xa2'))['fromQuery']([_0xd99c('0xa4'),'scheduledAt',_0xd99c('0xa9'),'ListId','VoiceQueueId',_0xd99c('0x62'),_0xd99c('0x63')],squel[_0xd99c('0xa7')]()[_0xd99c('0x85')](_0xd99c('0xa4'),'phone')['field'](_0xd99c('0xa8'),_0xd99c('0xa5'))[_0xd99c('0x85')]('id','ContactId')[_0xd99c('0x85')](_0x32cf88['CmListId'][_0xd99c('0xad')](),_0xd99c('0xa6'))['field'](_0x4ff8ce['params']['id'][_0xd99c('0xad')](),_0xd99c('0x6a'))[_0xd99c('0x85')](_0xd99c('0xa8'),_0xd99c('0x62'))[_0xd99c('0x85')](_0xd99c('0xa8'),_0xd99c('0x63'))[_0xd99c('0x87')]('cm_contacts')[_0xd99c('0x49')](_0xd99c('0xb3'))['where'](_0xd99c('0xab'),_0x32cf88[_0xd99c('0xac')]['toString']())[_0xd99c('0x49')]('phone\x20IS\x20NOT\x20NULL'))[_0xd99c('0xad')]();}_0x143921[_0xd99c('0x8c')](db[_0xd99c('0x8d')][_0xd99c('0x3c')](_0x3aefa9));}return BPromise['all'](_0x143921);}})[_0xd99c('0x2b')](function(){return _0x2102d2;})[_0xd99c('0x2b')](respondWithResult(_0xe5b359,null))[_0xd99c('0x53')](handleError(_0xe5b359,null));};exports[_0xd99c('0xb4')]=function(_0x55c843,_0x50d985,_0x2354ce){return db['VoiceQueue'][_0xd99c('0x34')]({'where':{'id':_0x55c843[_0xd99c('0x5f')]['id']}})[_0xd99c('0x2b')](handleEntityNotFound(_0x50d985,null))[_0xd99c('0x2b')](function(_0x56edaa){if(_0x56edaa){return _0x56edaa[_0xd99c('0xb4')](_0x55c843[_0xd99c('0x3c')][_0xd99c('0x94')]);}})[_0xd99c('0x2b')](function(_0x67e46d){if(_0x67e46d){return db[_0xd99c('0x69')][_0xd99c('0x36')]({'where':{'ListId':_0x55c843['query'][_0xd99c('0x94')],'VoiceQueueId':_0x55c843[_0xd99c('0x5f')]['id']}})['then'](function(){return _0x67e46d;});}})['then'](respondWithStatusCode(_0x50d985,null))['catch'](handleError(_0x50d985,null));};exports['getBlackLists']=function(_0x536eee,_0x576a4f,_0x4927bf){var _0x5a7c50={};var _0x1a293a={};var _0xa6c6f6;var _0x3aeb2a;return db[_0xd99c('0x39')][_0xd99c('0x68')]({'where':{'id':_0x536eee[_0xd99c('0x5f')]['id']}})['then'](handleEntityNotFound(_0x576a4f,null))[_0xd99c('0x2b')](function(_0x41383c){if(_0x41383c){_0xa6c6f6=_0x41383c;_0x1a293a[_0xd99c('0x40')]=_[_0xd99c('0x3d')](db[_0xd99c('0x9e')][_0xd99c('0x60')]);_0x1a293a[_0xd99c('0x3c')]=_[_0xd99c('0x3d')](_0x536eee[_0xd99c('0x3c')]);_0x1a293a[_0xd99c('0x3e')]=_[_0xd99c('0x3f')](_0x1a293a[_0xd99c('0x40')],_0x1a293a['query']);_0x5a7c50[_0xd99c('0x42')]=_[_0xd99c('0x3f')](_0x1a293a[_0xd99c('0x40')],qs[_0xd99c('0x41')](_0x536eee[_0xd99c('0x3c')][_0xd99c('0x41')]));_0x5a7c50[_0xd99c('0x42')]=_0x5a7c50[_0xd99c('0x42')][_0xd99c('0x43')]?_0x5a7c50[_0xd99c('0x42')]:_0x1a293a['model'];_0x5a7c50[_0xd99c('0x47')]=qs[_0xd99c('0x48')](_0x536eee['query']['sort']);_0x5a7c50[_0xd99c('0x49')]=qs[_0xd99c('0x3e')](_[_0xd99c('0x4a')](_0x536eee[_0xd99c('0x3c')],_0x1a293a['filters']));if(_0x536eee[_0xd99c('0x3c')][_0xd99c('0x4d')]){_0x5a7c50['where']=_[_0xd99c('0x4b')](_0x5a7c50[_0xd99c('0x49')],{'$or':_['map'](_0x5a7c50['attributes'],function(_0x22ca0d){var _0x5a40ea={};_0x5a40ea[_0x22ca0d]={'$like':'%'+_0x536eee[_0xd99c('0x3c')][_0xd99c('0x4d')]+'%'};return _0x5a40ea;})});}_0x5a7c50=_[_0xd99c('0x4b')]({},_0x5a7c50,_0x536eee['options']);return _0xa6c6f6['getBlackLists'](_0x5a7c50);}})[_0xd99c('0x2b')](function(_0x5f2097){if(_0x5f2097){_0x3aeb2a=_0x5f2097[_0xd99c('0x43')];if(!_0x536eee[_0xd99c('0x3c')]['hasOwnProperty'](_0xd99c('0x45'))){_0x5a7c50['limit']=qs[_0xd99c('0x46')](_0x536eee[_0xd99c('0x3c')][_0xd99c('0x46')]);_0x5a7c50[_0xd99c('0x25')]=qs[_0xd99c('0x25')](_0x536eee[_0xd99c('0x3c')][_0xd99c('0x25')]);}return _0xa6c6f6[_0xd99c('0xb5')](_0x5a7c50);}})[_0xd99c('0x2b')](function(_0x4636af){if(_0x4636af){return _0x4636af?{'count':_0x3aeb2a,'rows':_0x4636af}:null;}})[_0xd99c('0x2b')](respondWithResult(_0x576a4f,null))[_0xd99c('0x53')](handleError(_0x576a4f,null));};exports[_0xd99c('0xb6')]=function(_0x323fba,_0x301fa4,_0x211f5c){var _0x2e5a80,_0x4f357a;return db['VoiceQueue'][_0xd99c('0x34')]({'where':{'id':_0x323fba[_0xd99c('0x5f')]['id']}})[_0xd99c('0x2b')](handleEntityNotFound(_0x301fa4,null))['then'](function(_0x544b75){if(_0x544b75){_0x4f357a=_0x544b75;return _0x544b75[_0xd99c('0xb6')](_0x323fba['body'][_0xd99c('0x94')],_[_0xd99c('0x61')](_0x323fba[_0xd99c('0x56')],['ids','id'])||{});}return null;})[_0xd99c('0x98')](function(_0x1db15e){var _0x217bd3;_0x2e5a80=_0x1db15e||[];var _0x28d9ae=[];if(_0x1db15e){for(var _0x484de7=0x0;_0x484de7<_0x1db15e[_0xd99c('0x43')];_0x484de7+=0x1){var _0x3d3c57=_0x1db15e[_0x484de7][_0xd99c('0x2c')]({'plain':!![]});_0x217bd3=squel['insert']()['into'](_0xd99c('0xb7'))[_0xd99c('0xa3')]([_0xd99c('0xa4'),_0xd99c('0xa9'),_0xd99c('0xa6'),_0xd99c('0x6a'),_0xd99c('0x62'),'updatedAt'],squel[_0xd99c('0xa7')]()['field'](_0xd99c('0xa4'),_0xd99c('0xa4'))[_0xd99c('0x85')]('id',_0xd99c('0xa9'))[_0xd99c('0x85')](_0x3d3c57[_0xd99c('0xac')][_0xd99c('0xad')](),_0xd99c('0xa6'))[_0xd99c('0x85')](_0x323fba[_0xd99c('0x5f')]['id'][_0xd99c('0xad')](),_0xd99c('0x6a'))[_0xd99c('0x85')](_0xd99c('0xa8'),_0xd99c('0x62'))['field'](_0xd99c('0xa8'),_0xd99c('0x63'))[_0xd99c('0x87')](_0xd99c('0xaa'))['where']('deletedAt\x20IS\x20NULL')[_0xd99c('0x49')](_0xd99c('0xab'),_0x3d3c57[_0xd99c('0xac')][_0xd99c('0xad')]())[_0xd99c('0x49')]('phone\x20IS\x20NOT\x20NULL'))[_0xd99c('0xad')]();_0x28d9ae['push'](db[_0xd99c('0x8d')]['query'](_0x217bd3));}return BPromise[_0xd99c('0x91')](_0x28d9ae);}})[_0xd99c('0x2b')](function(){return _0x2e5a80;})[_0xd99c('0x2b')](respondWithResult(_0x301fa4,null))[_0xd99c('0x53')](handleError(_0x301fa4,null));};exports['removeBlackLists']=function(_0x3a8aa7,_0x53da00,_0x36cae3){return db[_0xd99c('0x39')]['find']({'where':{'id':_0x3a8aa7[_0xd99c('0x5f')]['id']}})[_0xd99c('0x2b')](handleEntityNotFound(_0x53da00,null))[_0xd99c('0x2b')](function(_0x323f98){if(_0x323f98){return _0x323f98[_0xd99c('0xb8')](_0x3a8aa7['query'][_0xd99c('0x94')]);}})[_0xd99c('0x2b')](function(_0x157a0c){if(_0x157a0c){return db[_0xd99c('0x6e')]['destroy']({'where':{'ListId':_0x3a8aa7[_0xd99c('0x3c')][_0xd99c('0x94')],'VoiceQueueId':_0x3a8aa7['params']['id']}})['then'](function(){return _0x157a0c;});}})[_0xd99c('0x2b')](respondWithStatusCode(_0x53da00,null))[_0xd99c('0x53')](handleError(_0x53da00,null));}; \ No newline at end of file diff --git a/server/api/voiceQueue/voiceQueue.events.js b/server/api/voiceQueue/voiceQueue.events.js index 3c2966e..d417798 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 _0xc380=['VoiceQueue','setMaxListeners','save','update','remove','emit','hasOwnProperty','exports','events','../../mysqldb'];(function(_0x4991d6,_0x348deb){var _0x50faf7=function(_0x14c7f8){while(--_0x14c7f8){_0x4991d6['push'](_0x4991d6['shift']());}};_0x50faf7(++_0x348deb);}(_0xc380,0x1c0));var _0x0c38=function(_0x2a0f23,_0x391e9e){_0x2a0f23=_0x2a0f23-0x0;var _0x1b49b9=_0xc380[_0x2a0f23];return _0x1b49b9;};'use strict';var EventEmitter=require(_0x0c38('0x0'));var VoiceQueue=require(_0x0c38('0x1'))['db'][_0x0c38('0x2')];var VoiceQueueEvents=new EventEmitter();VoiceQueueEvents[_0x0c38('0x3')](0x0);var events={'afterCreate':_0x0c38('0x4'),'afterUpdate':_0x0c38('0x5'),'afterDestroy':_0x0c38('0x6')};function emitEvent(_0x2ca589){return function(_0x11c713,_0x4a5148,_0x307994){VoiceQueueEvents[_0x0c38('0x7')](_0x2ca589+':'+_0x11c713['id'],_0x11c713);VoiceQueueEvents[_0x0c38('0x7')](_0x2ca589,_0x11c713);_0x307994(null);};}for(var e in events){if(events[_0x0c38('0x8')](e)){var event=events[e];VoiceQueue['hook'](e,emitEvent(event));}}module[_0x0c38('0x9')]=VoiceQueueEvents; \ No newline at end of file +var _0x7eea=['save','update','remove','emit','hook','exports','events','../../mysqldb','setMaxListeners'];(function(_0x55291a,_0x814018){var _0x3c870c=function(_0x1fd787){while(--_0x1fd787){_0x55291a['push'](_0x55291a['shift']());}};_0x3c870c(++_0x814018);}(_0x7eea,0x165));var _0xa7ee=function(_0x56c4ef,_0xfa75df){_0x56c4ef=_0x56c4ef-0x0;var _0x8e6f08=_0x7eea[_0x56c4ef];return _0x8e6f08;};'use strict';var EventEmitter=require(_0xa7ee('0x0'));var VoiceQueue=require(_0xa7ee('0x1'))['db']['VoiceQueue'];var VoiceQueueEvents=new EventEmitter();VoiceQueueEvents[_0xa7ee('0x2')](0x0);var events={'afterCreate':_0xa7ee('0x3'),'afterUpdate':_0xa7ee('0x4'),'afterDestroy':_0xa7ee('0x5')};function emitEvent(_0x46b6f0){return function(_0x5221,_0x435c79,_0x57f7b4){VoiceQueueEvents[_0xa7ee('0x6')](_0x46b6f0+':'+_0x5221['id'],_0x5221);VoiceQueueEvents[_0xa7ee('0x6')](_0x46b6f0,_0x5221);_0x57f7b4(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];VoiceQueue[_0xa7ee('0x7')](e,emitEvent(event));}}module[_0xa7ee('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 c60067f..42cee28 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 _0x0886=['exports','define','VoiceQueue','voice_queues','lodash','util','../../config/logger','moment','bluebird','rimraf','../../config/environment','./voiceQueue.attributes'];(function(_0x56f151,_0x281759){var _0x52c1e3=function(_0x12ba6d){while(--_0x12ba6d){_0x56f151['push'](_0x56f151['shift']());}};_0x52c1e3(++_0x281759);}(_0x0886,0x148));var _0x6088=function(_0x24c407,_0x31ffdd){_0x24c407=_0x24c407-0x0;var _0x45a283=_0x0886[_0x24c407];return _0x45a283;};'use strict';var _=require(_0x6088('0x0'));var util=require(_0x6088('0x1'));var logger=require(_0x6088('0x2'))('api');var moment=require(_0x6088('0x3'));var BPromise=require(_0x6088('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x6088('0x5'));var config=require(_0x6088('0x6'));var attributes=require(_0x6088('0x7'));module[_0x6088('0x8')]=function(_0x74d0ae,_0x2f3f45){return _0x74d0ae[_0x6088('0x9')](_0x6088('0xa'),attributes,{'tableName':_0x6088('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x34c4=['voice_queues','lodash','util','../../config/logger','api','moment','request-promise','path','rimraf','../../config/environment','exports','define','VoiceQueue'];(function(_0x246115,_0x398123){var _0x385878=function(_0x534a9c){while(--_0x534a9c){_0x246115['push'](_0x246115['shift']());}};_0x385878(++_0x398123);}(_0x34c4,0x83));var _0x434c=function(_0x535cba,_0x2a9359){_0x535cba=_0x535cba-0x0;var _0x2bfe1c=_0x34c4[_0x535cba];return _0x2bfe1c;};'use strict';var _=require(_0x434c('0x0'));var util=require(_0x434c('0x1'));var logger=require(_0x434c('0x2'))(_0x434c('0x3'));var moment=require(_0x434c('0x4'));var BPromise=require('bluebird');var rp=require(_0x434c('0x5'));var fs=require('fs');var path=require(_0x434c('0x6'));var rimraf=require(_0x434c('0x7'));var config=require(_0x434c('0x8'));var attributes=require('./voiceQueue.attributes');module[_0x434c('0x9')]=function(_0x23c6eb,_0x35bb30){return _0x23c6eb[_0x434c('0xa')](_0x434c('0xb'),attributes,{'tableName':_0x434c('0xc'),'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 5e61e08..79714e1 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 _0x5f25=['where','limit','map','include','model','attributes','then','debug','catch','ShowVoiceQueue','raw','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','defaults','redis','localhost','./voiceQueue.socket','request','VoiceQueue,\x20%s,\x20%s','VoiceQueue,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','info','result','GetVoiceQueue','VoiceQueue','findAll','options'];(function(_0x3f8a03,_0x319b9c){var _0x147fb2=function(_0x523c1c){while(--_0x523c1c){_0x3f8a03['push'](_0x3f8a03['shift']());}};_0x147fb2(++_0x319b9c);}(_0x5f25,0xfb));var _0x55f2=function(_0x4d770d,_0x5af4ce){_0x4d770d=_0x4d770d-0x0;var _0x11dc7a=_0x5f25[_0x4d770d];return _0x11dc7a;};'use strict';var _=require('lodash');var util=require(_0x55f2('0x0'));var moment=require(_0x55f2('0x1'));var BPromise=require('bluebird');var rs=require(_0x55f2('0x2'));var fs=require('fs');var Redis=require(_0x55f2('0x3'));var db=require(_0x55f2('0x4'))['db'];var utils=require(_0x55f2('0x5'));var logger=require('../../config/logger')(_0x55f2('0x6'));var config=require(_0x55f2('0x7'));var jayson=require(_0x55f2('0x8'));var client=jayson[_0x55f2('0x9')][_0x55f2('0xa')]({'port':0x232a});config['redis']=_[_0x55f2('0xb')](config[_0x55f2('0xc')],{'host':_0x55f2('0xd'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x55f2('0xc')]));require(_0x55f2('0xe'))['register'](socket);function respondWithRpcPromise(_0x1ba877,_0x3fc420,_0xe135ae){return new BPromise(function(_0x2c7869,_0x1775aa){return client[_0x55f2('0xf')](_0x1ba877,_0xe135ae)['then'](function(_0x39ad96){logger['info'](_0x55f2('0x10'),_0x3fc420,'request\x20sent');logger['debug'](_0x55f2('0x11'),_0x3fc420,_0x55f2('0x12'),JSON[_0x55f2('0x13')](_0x39ad96));if(_0x39ad96['error']){if(_0x39ad96[_0x55f2('0x14')][_0x55f2('0x15')]===0x1f4){logger[_0x55f2('0x14')](_0x55f2('0x10'),_0x3fc420,_0x39ad96['error']['message']);return _0x1775aa(_0x39ad96[_0x55f2('0x14')][_0x55f2('0x16')]);}logger['error'](_0x55f2('0x10'),_0x3fc420,_0x39ad96[_0x55f2('0x14')]['message']);return _0x2c7869(_0x39ad96[_0x55f2('0x14')][_0x55f2('0x16')]);}else{logger[_0x55f2('0x17')]('VoiceQueue,\x20%s,\x20%s',_0x3fc420,_0x55f2('0x12'));_0x2c7869(_0x39ad96[_0x55f2('0x18')][_0x55f2('0x16')]);}})['catch'](function(_0x31b888){logger['error'](_0x55f2('0x10'),_0x3fc420,_0x31b888);_0x1775aa(_0x31b888);});});}exports[_0x55f2('0x19')]=function(_0x26878c){var _0x8d20f9=this;return new Promise(function(_0x1c424b,_0x576a0d){return db[_0x55f2('0x1a')][_0x55f2('0x1b')]({'raw':_0x26878c[_0x55f2('0x1c')]?_0x26878c[_0x55f2('0x1c')]['raw']===undefined?!![]:![]:!![],'where':_0x26878c[_0x55f2('0x1c')]?_0x26878c[_0x55f2('0x1c')][_0x55f2('0x1d')]||null:null,'attributes':_0x26878c[_0x55f2('0x1c')]?_0x26878c[_0x55f2('0x1c')]['attributes']||null:null,'limit':_0x26878c[_0x55f2('0x1c')]?_0x26878c[_0x55f2('0x1c')][_0x55f2('0x1e')]||null:null,'include':_0x26878c[_0x55f2('0x1c')]?_0x26878c['options']['include']?_[_0x55f2('0x1f')](_0x26878c[_0x55f2('0x1c')][_0x55f2('0x20')],function(_0x58d568){return{'model':db[_0x58d568[_0x55f2('0x21')]],'as':_0x58d568['as'],'attributes':_0x58d568[_0x55f2('0x22')],'include':_0x58d568[_0x55f2('0x20')]?_[_0x55f2('0x1f')](_0x58d568['include'],function(_0x11a2b2){return{'model':db[_0x11a2b2[_0x55f2('0x21')]],'as':_0x11a2b2['as'],'attributes':_0x11a2b2[_0x55f2('0x22')],'include':_0x11a2b2['include']?_[_0x55f2('0x1f')](_0x11a2b2[_0x55f2('0x20')],function(_0x435481){return{'model':db[_0x435481['model']],'as':_0x435481['as'],'attributes':_0x435481[_0x55f2('0x22')]};}):[]};}):[]};}):[]:[]})[_0x55f2('0x23')](function(_0x279f58){logger[_0x55f2('0x17')](_0x55f2('0x19'),_0x26878c);logger[_0x55f2('0x24')](_0x55f2('0x19'),_0x26878c,JSON['stringify'](_0x279f58));_0x1c424b(_0x279f58);})[_0x55f2('0x25')](function(_0x88ec35){logger[_0x55f2('0x14')]('GetVoiceQueue',_0x88ec35[_0x55f2('0x16')],_0x26878c);_0x576a0d(_0x8d20f9[_0x55f2('0x14')](0x1f4,_0x88ec35[_0x55f2('0x16')]));});});};exports[_0x55f2('0x26')]=function(_0x1f8b31){var _0x2a333a=this;return new Promise(function(_0x3dd0c4,_0x2746b6){return db['VoiceQueue']['find']({'raw':_0x1f8b31['options']?_0x1f8b31[_0x55f2('0x1c')][_0x55f2('0x27')]===undefined?!![]:![]:!![],'where':_0x1f8b31['options']?_0x1f8b31[_0x55f2('0x1c')][_0x55f2('0x1d')]||null:null,'attributes':_0x1f8b31['options']?_0x1f8b31['options'][_0x55f2('0x22')]||null:null,'include':_0x1f8b31[_0x55f2('0x1c')]?_0x1f8b31[_0x55f2('0x1c')][_0x55f2('0x20')]?_[_0x55f2('0x1f')](_0x1f8b31['options'][_0x55f2('0x20')],function(_0x307195){return{'model':db[_0x307195[_0x55f2('0x21')]],'as':_0x307195['as'],'attributes':_0x307195[_0x55f2('0x22')],'include':_0x307195[_0x55f2('0x20')]?_[_0x55f2('0x1f')](_0x307195[_0x55f2('0x20')],function(_0x78dd11){return{'model':db[_0x78dd11[_0x55f2('0x21')]],'as':_0x78dd11['as'],'attributes':_0x78dd11[_0x55f2('0x22')],'include':_0x78dd11['include']?_[_0x55f2('0x1f')](_0x78dd11[_0x55f2('0x20')],function(_0x41df06){return{'model':db[_0x41df06['model']],'as':_0x41df06['as'],'attributes':_0x41df06[_0x55f2('0x22')]};}):[]};}):[]};}):[]:[]})[_0x55f2('0x23')](function(_0x18ff66){logger[_0x55f2('0x17')](_0x55f2('0x26'),_0x1f8b31);logger['debug'](_0x55f2('0x26'),_0x1f8b31,JSON[_0x55f2('0x13')](_0x18ff66));_0x3dd0c4(_0x18ff66);})[_0x55f2('0x25')](function(_0x2efad6){logger[_0x55f2('0x14')](_0x55f2('0x26'),_0x2efad6[_0x55f2('0x16')],_0x1f8b31);_0x2746b6(_0x2a333a[_0x55f2('0x14')](0x1f4,_0x2efad6[_0x55f2('0x16')]));});});}; \ No newline at end of file +var _0x1d67=['VoiceQueue,\x20%s,\x20%s','request\x20sent','VoiceQueue,\x20%s,\x20%s,\x20%s','error','code','message','info','result','catch','VoiceQueue','findAll','options','attributes','map','include','model','then','GetVoiceQueue','debug','find','raw','where','ShowVoiceQueue','stringify','moment','bluebird','randomstring','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','redis','defaults','localhost','socket.io-emitter','./voiceQueue.socket','register'];(function(_0x1a4c35,_0x505047){var _0x2d05e0=function(_0x508a55){while(--_0x508a55){_0x1a4c35['push'](_0x1a4c35['shift']());}};_0x2d05e0(++_0x505047);}(_0x1d67,0x129));var _0x71d6=function(_0x198293,_0x173fa8){_0x198293=_0x198293-0x0;var _0x4c8d1d=_0x1d67[_0x198293];return _0x4c8d1d;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x71d6('0x0'));var BPromise=require(_0x71d6('0x1'));var rs=require(_0x71d6('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x71d6('0x3'));var logger=require(_0x71d6('0x4'))(_0x71d6('0x5'));var config=require(_0x71d6('0x6'));var jayson=require(_0x71d6('0x7'));var client=jayson['client'][_0x71d6('0x8')]({'port':0x232a});config[_0x71d6('0x9')]=_[_0x71d6('0xa')](config[_0x71d6('0x9')],{'host':_0x71d6('0xb'),'port':0x18eb});var socket=require(_0x71d6('0xc'))(new Redis(config[_0x71d6('0x9')]));require(_0x71d6('0xd'))[_0x71d6('0xe')](socket);function respondWithRpcPromise(_0x2e123e,_0x242636,_0x3fe2d8){return new BPromise(function(_0x22b07d,_0xe17cbc){return client['request'](_0x2e123e,_0x3fe2d8)['then'](function(_0x144718){logger['info'](_0x71d6('0xf'),_0x242636,_0x71d6('0x10'));logger['debug'](_0x71d6('0x11'),_0x242636,_0x71d6('0x10'),JSON['stringify'](_0x144718));if(_0x144718[_0x71d6('0x12')]){if(_0x144718[_0x71d6('0x12')][_0x71d6('0x13')]===0x1f4){logger['error'](_0x71d6('0xf'),_0x242636,_0x144718[_0x71d6('0x12')]['message']);return _0xe17cbc(_0x144718[_0x71d6('0x12')]['message']);}logger[_0x71d6('0x12')](_0x71d6('0xf'),_0x242636,_0x144718[_0x71d6('0x12')][_0x71d6('0x14')]);return _0x22b07d(_0x144718[_0x71d6('0x12')][_0x71d6('0x14')]);}else{logger[_0x71d6('0x15')](_0x71d6('0xf'),_0x242636,'request\x20sent');_0x22b07d(_0x144718[_0x71d6('0x16')][_0x71d6('0x14')]);}})[_0x71d6('0x17')](function(_0x3675f3){logger[_0x71d6('0x12')](_0x71d6('0xf'),_0x242636,_0x3675f3);_0xe17cbc(_0x3675f3);});});}exports['GetVoiceQueue']=function(_0x3883af){var _0x37f7c1=this;return new Promise(function(_0x3e49f7,_0x3f7352){return db[_0x71d6('0x18')][_0x71d6('0x19')]({'raw':_0x3883af[_0x71d6('0x1a')]?_0x3883af[_0x71d6('0x1a')]['raw']===undefined?!![]:![]:!![],'where':_0x3883af[_0x71d6('0x1a')]?_0x3883af[_0x71d6('0x1a')]['where']||null:null,'attributes':_0x3883af[_0x71d6('0x1a')]?_0x3883af[_0x71d6('0x1a')][_0x71d6('0x1b')]||null:null,'limit':_0x3883af[_0x71d6('0x1a')]?_0x3883af[_0x71d6('0x1a')]['limit']||null:null,'include':_0x3883af[_0x71d6('0x1a')]?_0x3883af[_0x71d6('0x1a')]['include']?_[_0x71d6('0x1c')](_0x3883af[_0x71d6('0x1a')][_0x71d6('0x1d')],function(_0x5a0195){return{'model':db[_0x5a0195[_0x71d6('0x1e')]],'as':_0x5a0195['as'],'attributes':_0x5a0195[_0x71d6('0x1b')],'include':_0x5a0195[_0x71d6('0x1d')]?_[_0x71d6('0x1c')](_0x5a0195[_0x71d6('0x1d')],function(_0x3b6298){return{'model':db[_0x3b6298['model']],'as':_0x3b6298['as'],'attributes':_0x3b6298[_0x71d6('0x1b')],'include':_0x3b6298[_0x71d6('0x1d')]?_[_0x71d6('0x1c')](_0x3b6298[_0x71d6('0x1d')],function(_0x29fb0f){return{'model':db[_0x29fb0f['model']],'as':_0x29fb0f['as'],'attributes':_0x29fb0f[_0x71d6('0x1b')]};}):[]};}):[]};}):[]:[]})[_0x71d6('0x1f')](function(_0x4ba68c){logger[_0x71d6('0x15')](_0x71d6('0x20'),_0x3883af);logger[_0x71d6('0x21')]('GetVoiceQueue',_0x3883af,JSON['stringify'](_0x4ba68c));_0x3e49f7(_0x4ba68c);})[_0x71d6('0x17')](function(_0x36100b){logger[_0x71d6('0x12')](_0x71d6('0x20'),_0x36100b['message'],_0x3883af);_0x3f7352(_0x37f7c1[_0x71d6('0x12')](0x1f4,_0x36100b[_0x71d6('0x14')]));});});};exports['ShowVoiceQueue']=function(_0x42fb93){var _0xeeab72=this;return new Promise(function(_0xdc6629,_0xe4e09a){return db[_0x71d6('0x18')][_0x71d6('0x22')]({'raw':_0x42fb93[_0x71d6('0x1a')]?_0x42fb93[_0x71d6('0x1a')][_0x71d6('0x23')]===undefined?!![]:![]:!![],'where':_0x42fb93['options']?_0x42fb93['options'][_0x71d6('0x24')]||null:null,'attributes':_0x42fb93[_0x71d6('0x1a')]?_0x42fb93[_0x71d6('0x1a')][_0x71d6('0x1b')]||null:null,'include':_0x42fb93[_0x71d6('0x1a')]?_0x42fb93[_0x71d6('0x1a')]['include']?_['map'](_0x42fb93[_0x71d6('0x1a')][_0x71d6('0x1d')],function(_0x2bf402){return{'model':db[_0x2bf402['model']],'as':_0x2bf402['as'],'attributes':_0x2bf402['attributes'],'include':_0x2bf402['include']?_[_0x71d6('0x1c')](_0x2bf402[_0x71d6('0x1d')],function(_0xd94fae){return{'model':db[_0xd94fae[_0x71d6('0x1e')]],'as':_0xd94fae['as'],'attributes':_0xd94fae['attributes'],'include':_0xd94fae[_0x71d6('0x1d')]?_[_0x71d6('0x1c')](_0xd94fae[_0x71d6('0x1d')],function(_0x27b760){return{'model':db[_0x27b760[_0x71d6('0x1e')]],'as':_0x27b760['as'],'attributes':_0x27b760[_0x71d6('0x1b')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x14e105){logger[_0x71d6('0x15')](_0x71d6('0x25'),_0x42fb93);logger[_0x71d6('0x21')](_0x71d6('0x25'),_0x42fb93,JSON[_0x71d6('0x26')](_0x14e105));_0xdc6629(_0x14e105);})[_0x71d6('0x17')](function(_0x537e3b){logger['error'](_0x71d6('0x25'),_0x537e3b[_0x71d6('0x14')],_0x42fb93);_0xe4e09a(_0xeeab72[_0x71d6('0x12')](0x1f4,_0x537e3b[_0x71d6('0x14')]));});});}; \ No newline at end of file diff --git a/server/api/voiceQueue/voiceQueue.socket.js b/server/api/voiceQueue/voiceQueue.socket.js index c81ff65..7acc1c6 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 _0xa4c0=['emit','removeListener','register','length','voiceQueue:','save'];(function(_0x114984,_0x5c9593){var _0x44822b=function(_0x10af37){while(--_0x10af37){_0x114984['push'](_0x114984['shift']());}};_0x44822b(++_0x5c9593);}(_0xa4c0,0x197));var _0x0a4c=function(_0x1545dd,_0x32306e){_0x1545dd=_0x1545dd-0x0;var _0x30a668=_0xa4c0[_0x1545dd];return _0x30a668;};'use strict';var VoiceQueueEvents=require('./voiceQueue.events');var events=[_0x0a4c('0x0'),'remove','update'];function createListener(_0x243e5c,_0x89ce4b){return function(_0x53482d){_0x89ce4b[_0x0a4c('0x1')](_0x243e5c,_0x53482d);};}function removeListener(_0x79777f,_0x561af3){return function(){VoiceQueueEvents[_0x0a4c('0x2')](_0x79777f,_0x561af3);};}exports[_0x0a4c('0x3')]=function(_0x5a8abc){for(var _0x41a837=0x0,_0x1326f1=events[_0x0a4c('0x4')];_0x41a837<_0x1326f1;_0x41a837++){var _0xf7cac8=events[_0x41a837];var _0x4a4360=createListener(_0x0a4c('0x5')+_0xf7cac8,_0x5a8abc);VoiceQueueEvents['on'](_0xf7cac8,_0x4a4360);}}; \ No newline at end of file +var _0xf742=['register','length','voiceQueue:','save','remove','emit'];(function(_0x49c9ee,_0x2b0ce6){var _0x3ffd02=function(_0x4e8db8){while(--_0x4e8db8){_0x49c9ee['push'](_0x49c9ee['shift']());}};_0x3ffd02(++_0x2b0ce6);}(_0xf742,0x75));var _0x2f74=function(_0x1b7fa8,_0x1638df){_0x1b7fa8=_0x1b7fa8-0x0;var _0x3e7a87=_0xf742[_0x1b7fa8];return _0x3e7a87;};'use strict';var VoiceQueueEvents=require('./voiceQueue.events');var events=[_0x2f74('0x0'),_0x2f74('0x1'),'update'];function createListener(_0x21cd13,_0x3ebd4c){return function(_0x3e3a2a){_0x3ebd4c[_0x2f74('0x2')](_0x21cd13,_0x3e3a2a);};}function removeListener(_0x4124af,_0x1bfe02){return function(){VoiceQueueEvents['removeListener'](_0x4124af,_0x1bfe02);};}exports[_0x2f74('0x3')]=function(_0x2cfaf0){for(var _0x110912=0x0,_0x295685=events[_0x2f74('0x4')];_0x110912<_0x295685;_0x110912++){var _0x14c97d=events[_0x110912];var _0x3093ae=createListener(_0x2f74('0x5')+_0x14c97d,_0x2cfaf0);VoiceQueueEvents['on'](_0x14c97d,_0x3093ae);}}; \ No newline at end of file diff --git a/server/api/voiceQueueReport/index.js b/server/api/voiceQueueReport/index.js index 3b0079f..302fcba 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 _0xba18=['post','create','put','update','delete','destroy','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','./voiceQueueReport.controller','get','isAuthenticated','index','/describe','describe','/:id','show'];(function(_0x4f40d0,_0x47036c){var _0x233f60=function(_0x5aa81a){while(--_0x5aa81a){_0x4f40d0['push'](_0x4f40d0['shift']());}};_0x233f60(++_0x47036c);}(_0xba18,0x1ea));var _0x8ba1=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xba18[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require(_0x8ba1('0x0'));var util=require(_0x8ba1('0x1'));var path=require(_0x8ba1('0x2'));var timeout=require(_0x8ba1('0x3'));var express=require(_0x8ba1('0x4'));var router=express[_0x8ba1('0x5')]();var auth=require(_0x8ba1('0x6'));var interaction=require(_0x8ba1('0x7'));var config=require('../../config/environment');var controller=require(_0x8ba1('0x8'));router[_0x8ba1('0x9')]('/',auth[_0x8ba1('0xa')](),controller[_0x8ba1('0xb')]);router[_0x8ba1('0x9')](_0x8ba1('0xc'),auth['isAuthenticated'](),controller[_0x8ba1('0xd')]);router[_0x8ba1('0x9')]('/index',auth['isAuthenticated'](),controller['getVoiceQueuesReport']);router[_0x8ba1('0x9')](_0x8ba1('0xe'),auth['isAuthenticated'](),controller[_0x8ba1('0xf')]);router[_0x8ba1('0x10')]('/',auth[_0x8ba1('0xa')](),controller[_0x8ba1('0x11')]);router[_0x8ba1('0x12')]('/:id',auth[_0x8ba1('0xa')](),controller[_0x8ba1('0x13')]);router[_0x8ba1('0x14')](_0x8ba1('0xe'),auth[_0x8ba1('0xa')](),controller[_0x8ba1('0x15')]);module['exports']=router; \ No newline at end of file +var _0xdbb1=['post','create','put','update','destroy','exports','multer','express','../../components/interaction/service','./voiceQueueReport.controller','get','/describe','isAuthenticated','describe','/index','/:id','show'];(function(_0x68c979,_0x431cff){var _0x4f0001=function(_0xa7595d){while(--_0xa7595d){_0x68c979['push'](_0x68c979['shift']());}};_0x4f0001(++_0x431cff);}(_0xdbb1,0x105));var _0x1dbb=function(_0x422905,_0x3bce3a){_0x422905=_0x422905-0x0;var _0x33dc6c=_0xdbb1[_0x422905];return _0x33dc6c;};'use strict';var multer=require(_0x1dbb('0x0'));var util=require('util');var path=require('path');var timeout=require('connect-timeout');var express=require(_0x1dbb('0x1'));var router=express['Router']();var auth=require('../../components/auth/service');var interaction=require(_0x1dbb('0x2'));var config=require('../../config/environment');var controller=require(_0x1dbb('0x3'));router[_0x1dbb('0x4')]('/',auth['isAuthenticated'](),controller['index']);router[_0x1dbb('0x4')](_0x1dbb('0x5'),auth[_0x1dbb('0x6')](),controller[_0x1dbb('0x7')]);router['get'](_0x1dbb('0x8'),auth[_0x1dbb('0x6')](),controller['getVoiceQueuesReport']);router[_0x1dbb('0x4')](_0x1dbb('0x9'),auth[_0x1dbb('0x6')](),controller[_0x1dbb('0xa')]);router[_0x1dbb('0xb')]('/',auth[_0x1dbb('0x6')](),controller[_0x1dbb('0xc')]);router[_0x1dbb('0xd')](_0x1dbb('0x9'),auth[_0x1dbb('0x6')](),controller[_0x1dbb('0xe')]);router['delete'](_0x1dbb('0x9'),auth[_0x1dbb('0x6')](),controller[_0x1dbb('0xf')]);module[_0x1dbb('0x10')]=router; \ No newline at end of file diff --git a/server/api/voiceQueueReport/voiceQueueReport.attributes.js b/server/api/voiceQueueReport/voiceQueueReport.attributes.js index 4ca1063..88d112c 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 _0xed1e=['DATE','getDataValue','queuecallerjoinAt','YYYY-MM-DD\x20HH:mm:ss','seconds','queuecallerleaveAt','setDataValue','holdtime','INTEGER','BOOLEAN','FORWARD,\x20BLIND,\x20ATTENDED','moment','exports','STRING'];(function(_0x2b4411,_0x2625ed){var _0x8e41ef=function(_0x2aa8c1){while(--_0x2aa8c1){_0x2b4411['push'](_0x2b4411['shift']());}};_0x8e41ef(++_0x2625ed);}(_0xed1e,0x131));var _0xeed1=function(_0xeadc11,_0x27e378){_0xeadc11=_0xeadc11-0x0;var _0x4257b6=_0xed1e[_0xeadc11];return _0x4257b6;};'use strict';var Sequelize=require('sequelize');var moment=require(_0xeed1('0x0'));module[_0xeed1('0x1')]={'type':{'type':Sequelize[_0xeed1('0x2')]},'uniqueid':{'type':Sequelize[_0xeed1('0x2')]},'calleridnum':{'type':Sequelize['STRING']},'calleridname':{'type':Sequelize[_0xeed1('0x2')]},'queue':{'type':Sequelize[_0xeed1('0x2')]},'queuecallerjoinAt':{'type':Sequelize[_0xeed1('0x3')]},'queuecallerleaveAt':{'type':Sequelize['DATE'],'set':function(_0x439015){var _0x4099d7=moment(_0x439015);var _0x146b76=moment(this[_0xeed1('0x4')](_0xeed1('0x5')))['format'](_0xeed1('0x6'));var _0x2cd373=_0x4099d7['diff'](_0x146b76,_0xeed1('0x7'));this['setDataValue'](_0xeed1('0x8'),_0x439015);this[_0xeed1('0x9')](_0xeed1('0xa'),_0x2cd373||null);}},'position':{'type':Sequelize[_0xeed1('0xb')]},'count':{'type':Sequelize['INTEGER']},'queuecallerabandon':{'type':Sequelize[_0xeed1('0xc')],'defaultValue':![]},'queuecallerabandonAt':{'type':Sequelize[_0xeed1('0x3')]},'queuecallercomplete':{'type':Sequelize[_0xeed1('0xc')],'defaultValue':![]},'queuecallercompleteAt':{'type':Sequelize['DATE']},'queuecallerexit':{'type':Sequelize[_0xeed1('0xc')],'defaultValue':![]},'queuecallerexitAt':{'type':Sequelize[_0xeed1('0x3')]},'queuecallerexitreason':{'type':Sequelize[_0xeed1('0x2')],'comment':'COMPLETEDBYCALLER,\x20COMPLETEDBYAGENT,\x20FORWARDTRANFER,\x20BLINDTRANSFER,\x20ATTENDEDTRANSFER,\x20EXITWITHKEY,\x20TIMEOUT'},'originalposition':{'type':Sequelize[_0xeed1('0xb')]},'channel':{'type':Sequelize[_0xeed1('0x2')]},'connectedlinenum':{'type':Sequelize[_0xeed1('0x2')]},'connectedlinename':{'type':Sequelize[_0xeed1('0x2')]},'accountcode':{'type':Sequelize[_0xeed1('0x2')]},'context':{'type':Sequelize['STRING']},'exten':{'type':Sequelize['STRING']},'priority':{'type':Sequelize[_0xeed1('0x2')]},'holdtime':{'type':Sequelize[_0xeed1('0xb')]},'mohtime':{'type':Sequelize[_0xeed1('0xb')],'defaultValue':0x0},'assigned':{'type':Sequelize[_0xeed1('0xc')],'defaultValue':![]},'lastAssignedTo':{'type':Sequelize['STRING']},'transfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'transfertype':{'type':Sequelize[_0xeed1('0x2')],'comment':_0xeed1('0xd')},'transferexten':{'type':Sequelize[_0xeed1('0x2')]},'transferuniqueid':{'type':Sequelize[_0xeed1('0x2')]},'disposition':{'type':Sequelize[_0xeed1('0x2')]},'queuecallerenterreason':{'type':Sequelize[_0xeed1('0xb')],'defaultValue':0x0}}; \ No newline at end of file +var _0x9185=['STRING','DATE','getDataValue','queuecallerjoinAt','format','YYYY-MM-DD\x20HH:mm:ss','seconds','setDataValue','queuecallerleaveAt','holdtime','INTEGER','BOOLEAN','COMPLETEDBYCALLER,\x20COMPLETEDBYAGENT,\x20FORWARDTRANFER,\x20BLINDTRANSFER,\x20ATTENDEDTRANSFER,\x20EXITWITHKEY,\x20TIMEOUT','moment','exports'];(function(_0x321d0f,_0xc41539){var _0xbe7682=function(_0xe7f528){while(--_0xe7f528){_0x321d0f['push'](_0x321d0f['shift']());}};_0xbe7682(++_0xc41539);}(_0x9185,0x1de));var _0x5918=function(_0x4d82e4,_0x3cf5be){_0x4d82e4=_0x4d82e4-0x0;var _0x3a3c8b=_0x9185[_0x4d82e4];return _0x3a3c8b;};'use strict';var Sequelize=require('sequelize');var moment=require(_0x5918('0x0'));module[_0x5918('0x1')]={'type':{'type':Sequelize[_0x5918('0x2')]},'uniqueid':{'type':Sequelize['STRING']},'calleridnum':{'type':Sequelize[_0x5918('0x2')]},'calleridname':{'type':Sequelize[_0x5918('0x2')]},'queue':{'type':Sequelize[_0x5918('0x2')]},'queuecallerjoinAt':{'type':Sequelize[_0x5918('0x3')]},'queuecallerleaveAt':{'type':Sequelize[_0x5918('0x3')],'set':function(_0x4e5053){var _0x561b09=moment(_0x4e5053);var _0x1d4aa1=moment(this[_0x5918('0x4')](_0x5918('0x5')))[_0x5918('0x6')](_0x5918('0x7'));var _0x4f9523=_0x561b09['diff'](_0x1d4aa1,_0x5918('0x8'));this[_0x5918('0x9')](_0x5918('0xa'),_0x4e5053);this[_0x5918('0x9')](_0x5918('0xb'),_0x4f9523||null);}},'position':{'type':Sequelize['INTEGER']},'count':{'type':Sequelize[_0x5918('0xc')]},'queuecallerabandon':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'queuecallerabandonAt':{'type':Sequelize[_0x5918('0x3')]},'queuecallercomplete':{'type':Sequelize[_0x5918('0xd')],'defaultValue':![]},'queuecallercompleteAt':{'type':Sequelize[_0x5918('0x3')]},'queuecallerexit':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'queuecallerexitAt':{'type':Sequelize['DATE']},'queuecallerexitreason':{'type':Sequelize[_0x5918('0x2')],'comment':_0x5918('0xe')},'originalposition':{'type':Sequelize['INTEGER']},'channel':{'type':Sequelize[_0x5918('0x2')]},'connectedlinenum':{'type':Sequelize[_0x5918('0x2')]},'connectedlinename':{'type':Sequelize[_0x5918('0x2')]},'accountcode':{'type':Sequelize[_0x5918('0x2')]},'context':{'type':Sequelize[_0x5918('0x2')]},'exten':{'type':Sequelize[_0x5918('0x2')]},'priority':{'type':Sequelize['STRING']},'holdtime':{'type':Sequelize['INTEGER']},'mohtime':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'assigned':{'type':Sequelize[_0x5918('0xd')],'defaultValue':![]},'lastAssignedTo':{'type':Sequelize[_0x5918('0x2')]},'transfer':{'type':Sequelize[_0x5918('0xd')],'defaultValue':![]},'transfertype':{'type':Sequelize[_0x5918('0x2')],'comment':'FORWARD,\x20BLIND,\x20ATTENDED'},'transferexten':{'type':Sequelize[_0x5918('0x2')]},'transferuniqueid':{'type':Sequelize[_0x5918('0x2')]},'disposition':{'type':Sequelize[_0x5918('0x2')]},'queuecallerenterreason':{'type':Sequelize[_0x5918('0xc')],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/voiceQueueReport/voiceQueueReport.controller.js b/server/api/voiceQueueReport/voiceQueueReport.controller.js index c62013b..978e7f4 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 _0x5f2f=['stack','name','send','map','VoiceQueueReport','rawAttributes','fieldName','model','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','limit','order','sort','where','pick','merge','VIRTUAL','filter','options','includeAll','include','findAll','rows','params','find','create','body','catch','destroy','describe','getVoiceQueuesReport','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','path','sox','to-csv','ejs','lodash','squel','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','api','../../config/utils','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./voiceQueueReport.socket','register','status','end','json','count','offset','set','reject','save','update','then','sendStatus','error'];(function(_0x265c0d,_0x35d8a8){var _0x1efe5d=function(_0x1a861c){while(--_0x1a861c){_0x265c0d['push'](_0x265c0d['shift']());}};_0x1efe5d(++_0x35d8a8);}(_0x5f2f,0x73));var _0xf5f2=function(_0x5a5887,_0x1bc53e){_0x5a5887=_0x5a5887-0x0;var _0x14f156=_0x5f2f[_0x5a5887];return _0x14f156;};'use strict';var pdf=require(_0xf5f2('0x0'));var emlformat=require(_0xf5f2('0x1'));var rimraf=require(_0xf5f2('0x2'));var zipdir=require(_0xf5f2('0x3'));var jsonpatch=require(_0xf5f2('0x4'));var rp=require(_0xf5f2('0x5'));var moment=require(_0xf5f2('0x6'));var BPromise=require(_0xf5f2('0x7'));var Mustache=require('mustache');var util=require('util');var path=require(_0xf5f2('0x8'));var sox=require(_0xf5f2('0x9'));var csv=require(_0xf5f2('0xa'));var ejs=require(_0xf5f2('0xb'));var fs=require('fs');var _=require(_0xf5f2('0xc'));var squel=require(_0xf5f2('0xd'));var crypto=require('crypto');var jsforce=require(_0xf5f2('0xe'));var deskjs=require(_0xf5f2('0xf'));var toCsv=require(_0xf5f2('0xa'));var querystring=require('querystring');var Papa=require(_0xf5f2('0x10'));var Redis=require(_0xf5f2('0x11'));var authService=require(_0xf5f2('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0xf5f2('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0xf5f2('0x14'));var utils=require(_0xf5f2('0x15'));var config=require('../../config/environment');var db=require(_0xf5f2('0x16'))['db'];config[_0xf5f2('0x17')]=_[_0xf5f2('0x18')](config[_0xf5f2('0x17')],{'host':_0xf5f2('0x19'),'port':0x18eb});var socket=require(_0xf5f2('0x1a'))(new Redis(config['redis']));require(_0xf5f2('0x1b'))[_0xf5f2('0x1c')](socket);function respondWithStatusCode(_0x269909,_0x1c1a5c){_0x1c1a5c=_0x1c1a5c||0xcc;return function(_0x422b55){if(_0x422b55){return _0x269909['sendStatus'](_0x1c1a5c);}return _0x269909[_0xf5f2('0x1d')](_0x1c1a5c)[_0xf5f2('0x1e')]();};}function respondWithResult(_0x17d656,_0x1b6dd2){_0x1b6dd2=_0x1b6dd2||0xc8;return function(_0x23e23a){if(_0x23e23a){return _0x17d656[_0xf5f2('0x1d')](_0x1b6dd2)[_0xf5f2('0x1f')](_0x23e23a);}};}function respondWithFilteredResult(_0x395a5a,_0x11f702){return function(_0x228ace){if(_0x228ace){var _0x20fccd=_0x228ace[_0xf5f2('0x20')],_0x28e097=_0x11f702[_0xf5f2('0x21')],_0x4ff59b=_0x11f702[_0xf5f2('0x21')]+_0x11f702['limit'],_0x3ee69;if(_0x4ff59b>=_0x20fccd){_0x4ff59b=_0x20fccd;_0x3ee69=0xc8;}else{_0x3ee69=0xce;}_0x395a5a[_0xf5f2('0x1d')](_0x3ee69);return _0x395a5a[_0xf5f2('0x22')]('Content-Range',_0x28e097+'-'+_0x4ff59b+'/'+_0x20fccd)['json'](_0x228ace);}return null;};}function patchUpdates(_0x2d2805){return function(_0x388e6c){try{jsonpatch['apply'](_0x388e6c,_0x2d2805,!![]);}catch(_0x45b74f){return BPromise[_0xf5f2('0x23')](_0x45b74f);}return _0x388e6c[_0xf5f2('0x24')]();};}function saveUpdates(_0x39c024,_0x36f1cb){return function(_0x4c691a){if(_0x4c691a){return _0x4c691a[_0xf5f2('0x25')](_0x39c024)[_0xf5f2('0x26')](function(_0x4e8bda){return _0x4e8bda;});}return null;};}function removeEntity(_0x2833fe,_0x287ad5){return function(_0x5bdf4a){if(_0x5bdf4a){return _0x5bdf4a['destroy']()[_0xf5f2('0x26')](function(){_0x2833fe[_0xf5f2('0x1d')](0xcc)[_0xf5f2('0x1e')]();});}};}function handleEntityNotFound(_0x1a5bb3,_0xf6c58d){return function(_0x788a8d){if(!_0x788a8d){_0x1a5bb3[_0xf5f2('0x27')](0x194);}return _0x788a8d;};}function handleError(_0x281ec8,_0x294414){_0x294414=_0x294414||0x1f4;return function(_0x4ab014){logger[_0xf5f2('0x28')](_0x4ab014[_0xf5f2('0x29')]);if(_0x4ab014[_0xf5f2('0x2a')]){delete _0x4ab014[_0xf5f2('0x2a')];}_0x281ec8[_0xf5f2('0x1d')](_0x294414)[_0xf5f2('0x2b')](_0x4ab014);};}exports['index']=function(_0x53cb96,_0x22c826){var _0x14c829={},_0x11c771={},_0x5027ab={'count':0x0,'rows':[]};var _0x5a2c7e=_[_0xf5f2('0x2c')](db[_0xf5f2('0x2d')][_0xf5f2('0x2e')],function(_0x153924){return{'name':_0x153924[_0xf5f2('0x2f')],'type':_0x153924['type']['key']};});_0x11c771[_0xf5f2('0x30')]=_['map'](_0x5a2c7e,_0xf5f2('0x2a'));_0x11c771['query']=_[_0xf5f2('0x31')](_0x53cb96[_0xf5f2('0x32')]);_0x11c771[_0xf5f2('0x33')]=_[_0xf5f2('0x34')](_0x11c771[_0xf5f2('0x30')],_0x11c771[_0xf5f2('0x32')]);_0x14c829[_0xf5f2('0x35')]=_[_0xf5f2('0x34')](_0x11c771['model'],qs[_0xf5f2('0x36')](_0x53cb96[_0xf5f2('0x32')][_0xf5f2('0x36')]));_0x14c829[_0xf5f2('0x35')]=_0x14c829[_0xf5f2('0x35')][_0xf5f2('0x37')]?_0x14c829[_0xf5f2('0x35')]:_0x11c771['model'];if(!_0x53cb96[_0xf5f2('0x32')][_0xf5f2('0x38')]('nolimit')){_0x14c829[_0xf5f2('0x39')]=qs['limit'](_0x53cb96[_0xf5f2('0x32')][_0xf5f2('0x39')]);_0x14c829[_0xf5f2('0x21')]=qs[_0xf5f2('0x21')](_0x53cb96['query']['offset']);}_0x14c829[_0xf5f2('0x3a')]=qs[_0xf5f2('0x3b')](_0x53cb96[_0xf5f2('0x32')]['sort']);_0x14c829[_0xf5f2('0x3c')]=qs['filters'](_[_0xf5f2('0x3d')](_0x53cb96['query'],_0x11c771[_0xf5f2('0x33')]));if(_0x53cb96[_0xf5f2('0x32')]['filter']){_0x14c829[_0xf5f2('0x3c')]=_[_0xf5f2('0x3e')](_0x14c829[_0xf5f2('0x3c')],{'$or':_[_0xf5f2('0x2c')](_0x5a2c7e,function(_0x542cd6){if(_0x542cd6['type']!==_0xf5f2('0x3f')){var _0x140a11={};_0x140a11[_0x542cd6[_0xf5f2('0x2a')]]={'$like':'%'+_0x53cb96[_0xf5f2('0x32')][_0xf5f2('0x40')]+'%'};return _0x140a11;}})});}_0x14c829=_[_0xf5f2('0x3e')]({},_0x14c829,_0x53cb96[_0xf5f2('0x41')]);var _0x4c0ac7={'where':_0x14c829[_0xf5f2('0x3c')]};return db[_0xf5f2('0x2d')]['count'](_0x4c0ac7)[_0xf5f2('0x26')](function(_0x3f3895){_0x5027ab[_0xf5f2('0x20')]=_0x3f3895;if(_0x53cb96[_0xf5f2('0x32')][_0xf5f2('0x42')]){_0x14c829[_0xf5f2('0x43')]=[{'all':!![]}];}return db[_0xf5f2('0x2d')][_0xf5f2('0x44')](_0x14c829);})['then'](function(_0x31c3c){_0x5027ab[_0xf5f2('0x45')]=_0x31c3c;return _0x5027ab;})[_0xf5f2('0x26')](respondWithFilteredResult(_0x22c826,_0x14c829))['catch'](handleError(_0x22c826,null));};exports['show']=function(_0x59eb00,_0x76d21b){var _0x2ad13c={'raw':![],'where':{'id':_0x59eb00[_0xf5f2('0x46')]['id']}},_0x4c8d8e={};_0x4c8d8e[_0xf5f2('0x30')]=_[_0xf5f2('0x31')](db[_0xf5f2('0x2d')][_0xf5f2('0x2e')]);_0x4c8d8e[_0xf5f2('0x32')]=_[_0xf5f2('0x31')](_0x59eb00[_0xf5f2('0x32')]);_0x4c8d8e[_0xf5f2('0x33')]=_[_0xf5f2('0x34')](_0x4c8d8e[_0xf5f2('0x30')],_0x4c8d8e[_0xf5f2('0x32')]);_0x2ad13c[_0xf5f2('0x35')]=_[_0xf5f2('0x34')](_0x4c8d8e['model'],qs[_0xf5f2('0x36')](_0x59eb00['query'][_0xf5f2('0x36')]));_0x2ad13c[_0xf5f2('0x35')]=_0x2ad13c[_0xf5f2('0x35')][_0xf5f2('0x37')]?_0x2ad13c[_0xf5f2('0x35')]:_0x4c8d8e[_0xf5f2('0x30')];if(_0x59eb00['query'][_0xf5f2('0x42')]){_0x2ad13c[_0xf5f2('0x43')]=[{'all':!![]}];}_0x2ad13c=_[_0xf5f2('0x3e')]({},_0x2ad13c,_0x59eb00[_0xf5f2('0x41')]);return db[_0xf5f2('0x2d')][_0xf5f2('0x47')](_0x2ad13c)[_0xf5f2('0x26')](handleEntityNotFound(_0x76d21b,null))[_0xf5f2('0x26')](respondWithResult(_0x76d21b,null))['catch'](handleError(_0x76d21b,null));};exports[_0xf5f2('0x48')]=function(_0x33ec29,_0x45db9a){return db['VoiceQueueReport'][_0xf5f2('0x48')](_0x33ec29[_0xf5f2('0x49')],{})[_0xf5f2('0x26')](respondWithResult(_0x45db9a,0xc9))['catch'](handleError(_0x45db9a,null));};exports['update']=function(_0x7bb942,_0x27c472){if(_0x7bb942['body']['id']){delete _0x7bb942[_0xf5f2('0x49')]['id'];}return db['VoiceQueueReport'][_0xf5f2('0x47')]({'where':{'id':_0x7bb942['params']['id']}})[_0xf5f2('0x26')](handleEntityNotFound(_0x27c472,null))['then'](saveUpdates(_0x7bb942[_0xf5f2('0x49')],null))[_0xf5f2('0x26')](respondWithResult(_0x27c472,null))[_0xf5f2('0x4a')](handleError(_0x27c472,null));};exports[_0xf5f2('0x4b')]=function(_0x4fa738,_0x3154c1){return db[_0xf5f2('0x2d')]['find']({'where':{'id':_0x4fa738['params']['id']}})[_0xf5f2('0x26')](handleEntityNotFound(_0x3154c1,null))[_0xf5f2('0x26')](removeEntity(_0x3154c1,null))['catch'](handleError(_0x3154c1,null));};exports[_0xf5f2('0x4c')]=function(_0xe0ce7f,_0x29c9b6){return db[_0xf5f2('0x2d')]['describe']()['then'](respondWithResult(_0x29c9b6,null))[_0xf5f2('0x4a')](handleError(_0x29c9b6,null));};exports[_0xf5f2('0x4d')]=function(_0x4b62fc,_0x40eef){var _0x43fc49={},_0x255125={},_0x14029e={'count':0x0,'rows':[]};_0x255125[_0xf5f2('0x30')]=_[_0xf5f2('0x31')](db[_0xf5f2('0x2d')]['rawAttributes']);_0x255125['query']=_[_0xf5f2('0x31')](_0x4b62fc[_0xf5f2('0x32')]);_0x255125[_0xf5f2('0x33')]=_[_0xf5f2('0x34')](_0x255125[_0xf5f2('0x30')],_0x255125['query']);_0x43fc49[_0xf5f2('0x35')]=_[_0xf5f2('0x34')](_0x255125[_0xf5f2('0x30')],qs['fields'](_0x4b62fc[_0xf5f2('0x32')]['fields']));_0x43fc49[_0xf5f2('0x35')]=_0x43fc49[_0xf5f2('0x35')][_0xf5f2('0x37')]?_0x43fc49[_0xf5f2('0x35')]:_0x255125['model'];if(!_0x4b62fc['query'][_0xf5f2('0x38')]('nolimit')){_0x43fc49[_0xf5f2('0x39')]=qs[_0xf5f2('0x39')](_0x4b62fc['query'][_0xf5f2('0x39')]);_0x43fc49[_0xf5f2('0x21')]=qs[_0xf5f2('0x21')](_0x4b62fc['query'][_0xf5f2('0x21')]);}_0x43fc49[_0xf5f2('0x3a')]=qs[_0xf5f2('0x3b')](_0x4b62fc[_0xf5f2('0x32')]['sort']);_0x43fc49[_0xf5f2('0x3c')]=qs['filters'](_[_0xf5f2('0x3d')](_0x4b62fc[_0xf5f2('0x32')],_0x255125[_0xf5f2('0x33')]));if(_0x4b62fc[_0xf5f2('0x32')][_0xf5f2('0x40')]){_0x43fc49['where']=_[_0xf5f2('0x3e')](_0x43fc49[_0xf5f2('0x3c')],{'$or':_[_0xf5f2('0x2c')](_0x43fc49[_0xf5f2('0x35')],function(_0x2c5733){var _0x5359b5={};_0x5359b5[_0x2c5733]={'$like':'%'+_0x4b62fc[_0xf5f2('0x32')]['filter']+'%'};return _0x5359b5;})});}_0x43fc49=_['merge']({},_0x43fc49,_0x4b62fc[_0xf5f2('0x41')]);var _0x4802c5={'where':_0x43fc49[_0xf5f2('0x3c')]};return db[_0xf5f2('0x2d')][_0xf5f2('0x20')](_0x4802c5)[_0xf5f2('0x26')](function(_0x5767fc){_0x14029e[_0xf5f2('0x20')]=_0x5767fc;if(_0x4b62fc[_0xf5f2('0x32')][_0xf5f2('0x42')]){_0x43fc49[_0xf5f2('0x43')]=[{'all':!![]}];}return db[_0xf5f2('0x2d')][_0xf5f2('0x44')](_0x43fc49);})[_0xf5f2('0x26')](function(_0x4a7be9){_0x14029e[_0xf5f2('0x45')]=_0x4a7be9;return _0x14029e;})[_0xf5f2('0x26')](respondWithFilteredResult(_0x40eef,_0x43fc49,_0xf5f2('0x4d')))[_0xf5f2('0x4a')](handleError(_0x40eef,null,'getVoiceQueuesReport'));}; \ No newline at end of file +var _0xc4aa=['fieldName','type','key','model','keys','filters','intersection','query','attributes','fields','length','hasOwnProperty','limit','sort','where','pick','filter','merge','options','VoiceQueueReport','includeAll','rows','catch','show','rawAttributes','include','find','body','params','describe','getVoiceQueuesReport','nolimit','order','findAll','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','util','path','sox','to-csv','ejs','lodash','squel','crypto','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./voiceQueueReport.socket','register','sendStatus','status','end','json','count','offset','set','Content-Range','apply','save','update','then','destroy','error','stack','name','send','index','map'];(function(_0x1330fc,_0x262332){var _0x259fd6=function(_0x4a567a){while(--_0x4a567a){_0x1330fc['push'](_0x1330fc['shift']());}};_0x259fd6(++_0x262332);}(_0xc4aa,0x1b7));var _0xac4a=function(_0x88cd7b,_0x4c884c){_0x88cd7b=_0x88cd7b-0x0;var _0x56fcc8=_0xc4aa[_0x88cd7b];return _0x56fcc8;};'use strict';var pdf=require(_0xac4a('0x0'));var emlformat=require(_0xac4a('0x1'));var rimraf=require(_0xac4a('0x2'));var zipdir=require(_0xac4a('0x3'));var jsonpatch=require(_0xac4a('0x4'));var rp=require(_0xac4a('0x5'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0xac4a('0x6'));var path=require(_0xac4a('0x7'));var sox=require(_0xac4a('0x8'));var csv=require(_0xac4a('0x9'));var ejs=require(_0xac4a('0xa'));var fs=require('fs');var _=require(_0xac4a('0xb'));var squel=require(_0xac4a('0xc'));var crypto=require(_0xac4a('0xd'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0xac4a('0x9'));var querystring=require(_0xac4a('0xe'));var Papa=require(_0xac4a('0xf'));var Redis=require('ioredis');var authService=require(_0xac4a('0x10'));var qs=require(_0xac4a('0x11'));var as=require(_0xac4a('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xac4a('0x13'))('api');var utils=require(_0xac4a('0x14'));var config=require('../../config/environment');var db=require(_0xac4a('0x15'))['db'];config[_0xac4a('0x16')]=_[_0xac4a('0x17')](config['redis'],{'host':_0xac4a('0x18'),'port':0x18eb});var socket=require(_0xac4a('0x19'))(new Redis(config[_0xac4a('0x16')]));require(_0xac4a('0x1a'))[_0xac4a('0x1b')](socket);function respondWithStatusCode(_0x3b71c0,_0x34bc01){_0x34bc01=_0x34bc01||0xcc;return function(_0x33c287){if(_0x33c287){return _0x3b71c0[_0xac4a('0x1c')](_0x34bc01);}return _0x3b71c0[_0xac4a('0x1d')](_0x34bc01)[_0xac4a('0x1e')]();};}function respondWithResult(_0x26dbb8,_0x4a2119){_0x4a2119=_0x4a2119||0xc8;return function(_0x402fff){if(_0x402fff){return _0x26dbb8[_0xac4a('0x1d')](_0x4a2119)[_0xac4a('0x1f')](_0x402fff);}};}function respondWithFilteredResult(_0x144553,_0x3e88e3){return function(_0x387a54){if(_0x387a54){var _0x28e304=_0x387a54[_0xac4a('0x20')],_0x44ec59=_0x3e88e3[_0xac4a('0x21')],_0x546c5d=_0x3e88e3[_0xac4a('0x21')]+_0x3e88e3['limit'],_0x5ac21e;if(_0x546c5d>=_0x28e304){_0x546c5d=_0x28e304;_0x5ac21e=0xc8;}else{_0x5ac21e=0xce;}_0x144553[_0xac4a('0x1d')](_0x5ac21e);return _0x144553[_0xac4a('0x22')](_0xac4a('0x23'),_0x44ec59+'-'+_0x546c5d+'/'+_0x28e304)[_0xac4a('0x1f')](_0x387a54);}return null;};}function patchUpdates(_0x123694){return function(_0x3e829c){try{jsonpatch[_0xac4a('0x24')](_0x3e829c,_0x123694,!![]);}catch(_0x3ca790){return BPromise['reject'](_0x3ca790);}return _0x3e829c[_0xac4a('0x25')]();};}function saveUpdates(_0x3204ad,_0x599787){return function(_0x3d7ce0){if(_0x3d7ce0){return _0x3d7ce0[_0xac4a('0x26')](_0x3204ad)[_0xac4a('0x27')](function(_0x947d8e){return _0x947d8e;});}return null;};}function removeEntity(_0x4d2d6c,_0x1b7998){return function(_0x2503d8){if(_0x2503d8){return _0x2503d8[_0xac4a('0x28')]()[_0xac4a('0x27')](function(){_0x4d2d6c[_0xac4a('0x1d')](0xcc)[_0xac4a('0x1e')]();});}};}function handleEntityNotFound(_0x222507,_0x36054a){return function(_0x3e2c69){if(!_0x3e2c69){_0x222507[_0xac4a('0x1c')](0x194);}return _0x3e2c69;};}function handleError(_0x1d0539,_0x215a31){_0x215a31=_0x215a31||0x1f4;return function(_0x14832b){logger[_0xac4a('0x29')](_0x14832b[_0xac4a('0x2a')]);if(_0x14832b[_0xac4a('0x2b')]){delete _0x14832b['name'];}_0x1d0539[_0xac4a('0x1d')](_0x215a31)[_0xac4a('0x2c')](_0x14832b);};}exports[_0xac4a('0x2d')]=function(_0x2772fe,_0x116700){var _0x4a5a9e={},_0x47f49c={},_0xdb7e={'count':0x0,'rows':[]};var _0x7a948b=_[_0xac4a('0x2e')](db['VoiceQueueReport']['rawAttributes'],function(_0x355755){return{'name':_0x355755[_0xac4a('0x2f')],'type':_0x355755[_0xac4a('0x30')][_0xac4a('0x31')]};});_0x47f49c[_0xac4a('0x32')]=_['map'](_0x7a948b,_0xac4a('0x2b'));_0x47f49c['query']=_[_0xac4a('0x33')](_0x2772fe['query']);_0x47f49c[_0xac4a('0x34')]=_[_0xac4a('0x35')](_0x47f49c[_0xac4a('0x32')],_0x47f49c[_0xac4a('0x36')]);_0x4a5a9e[_0xac4a('0x37')]=_[_0xac4a('0x35')](_0x47f49c[_0xac4a('0x32')],qs[_0xac4a('0x38')](_0x2772fe[_0xac4a('0x36')][_0xac4a('0x38')]));_0x4a5a9e[_0xac4a('0x37')]=_0x4a5a9e[_0xac4a('0x37')][_0xac4a('0x39')]?_0x4a5a9e[_0xac4a('0x37')]:_0x47f49c['model'];if(!_0x2772fe[_0xac4a('0x36')][_0xac4a('0x3a')]('nolimit')){_0x4a5a9e[_0xac4a('0x3b')]=qs[_0xac4a('0x3b')](_0x2772fe['query']['limit']);_0x4a5a9e[_0xac4a('0x21')]=qs[_0xac4a('0x21')](_0x2772fe[_0xac4a('0x36')][_0xac4a('0x21')]);}_0x4a5a9e['order']=qs[_0xac4a('0x3c')](_0x2772fe[_0xac4a('0x36')]['sort']);_0x4a5a9e[_0xac4a('0x3d')]=qs[_0xac4a('0x34')](_[_0xac4a('0x3e')](_0x2772fe['query'],_0x47f49c[_0xac4a('0x34')]));if(_0x2772fe[_0xac4a('0x36')][_0xac4a('0x3f')]){_0x4a5a9e['where']=_[_0xac4a('0x40')](_0x4a5a9e[_0xac4a('0x3d')],{'$or':_['map'](_0x7a948b,function(_0x59bebf){if(_0x59bebf[_0xac4a('0x30')]!=='VIRTUAL'){var _0x50e03e={};_0x50e03e[_0x59bebf['name']]={'$like':'%'+_0x2772fe['query'][_0xac4a('0x3f')]+'%'};return _0x50e03e;}})});}_0x4a5a9e=_[_0xac4a('0x40')]({},_0x4a5a9e,_0x2772fe[_0xac4a('0x41')]);var _0x472484={'where':_0x4a5a9e[_0xac4a('0x3d')]};return db[_0xac4a('0x42')][_0xac4a('0x20')](_0x472484)[_0xac4a('0x27')](function(_0x28292c){_0xdb7e[_0xac4a('0x20')]=_0x28292c;if(_0x2772fe[_0xac4a('0x36')][_0xac4a('0x43')]){_0x4a5a9e['include']=[{'all':!![]}];}return db['VoiceQueueReport']['findAll'](_0x4a5a9e);})[_0xac4a('0x27')](function(_0x5c46a){_0xdb7e[_0xac4a('0x44')]=_0x5c46a;return _0xdb7e;})[_0xac4a('0x27')](respondWithFilteredResult(_0x116700,_0x4a5a9e))[_0xac4a('0x45')](handleError(_0x116700,null));};exports[_0xac4a('0x46')]=function(_0x8febf0,_0x3441f2){var _0x3e9973={'raw':![],'where':{'id':_0x8febf0['params']['id']}},_0x3edb19={};_0x3edb19[_0xac4a('0x32')]=_[_0xac4a('0x33')](db[_0xac4a('0x42')][_0xac4a('0x47')]);_0x3edb19[_0xac4a('0x36')]=_['keys'](_0x8febf0[_0xac4a('0x36')]);_0x3edb19[_0xac4a('0x34')]=_['intersection'](_0x3edb19[_0xac4a('0x32')],_0x3edb19['query']);_0x3e9973[_0xac4a('0x37')]=_[_0xac4a('0x35')](_0x3edb19[_0xac4a('0x32')],qs[_0xac4a('0x38')](_0x8febf0[_0xac4a('0x36')][_0xac4a('0x38')]));_0x3e9973[_0xac4a('0x37')]=_0x3e9973[_0xac4a('0x37')][_0xac4a('0x39')]?_0x3e9973[_0xac4a('0x37')]:_0x3edb19[_0xac4a('0x32')];if(_0x8febf0[_0xac4a('0x36')]['includeAll']){_0x3e9973[_0xac4a('0x48')]=[{'all':!![]}];}_0x3e9973=_[_0xac4a('0x40')]({},_0x3e9973,_0x8febf0[_0xac4a('0x41')]);return db['VoiceQueueReport'][_0xac4a('0x49')](_0x3e9973)[_0xac4a('0x27')](handleEntityNotFound(_0x3441f2,null))['then'](respondWithResult(_0x3441f2,null))[_0xac4a('0x45')](handleError(_0x3441f2,null));};exports['create']=function(_0x244950,_0xe620f6){return db[_0xac4a('0x42')]['create'](_0x244950['body'],{})[_0xac4a('0x27')](respondWithResult(_0xe620f6,0xc9))['catch'](handleError(_0xe620f6,null));};exports[_0xac4a('0x26')]=function(_0x566258,_0x3d2aaf){if(_0x566258['body']['id']){delete _0x566258[_0xac4a('0x4a')]['id'];}return db[_0xac4a('0x42')][_0xac4a('0x49')]({'where':{'id':_0x566258[_0xac4a('0x4b')]['id']}})['then'](handleEntityNotFound(_0x3d2aaf,null))[_0xac4a('0x27')](saveUpdates(_0x566258[_0xac4a('0x4a')],null))[_0xac4a('0x27')](respondWithResult(_0x3d2aaf,null))[_0xac4a('0x45')](handleError(_0x3d2aaf,null));};exports[_0xac4a('0x28')]=function(_0x138876,_0x187306){return db['VoiceQueueReport'][_0xac4a('0x49')]({'where':{'id':_0x138876[_0xac4a('0x4b')]['id']}})['then'](handleEntityNotFound(_0x187306,null))[_0xac4a('0x27')](removeEntity(_0x187306,null))[_0xac4a('0x45')](handleError(_0x187306,null));};exports[_0xac4a('0x4c')]=function(_0x3ac36e,_0x4bb2fb){return db[_0xac4a('0x42')][_0xac4a('0x4c')]()[_0xac4a('0x27')](respondWithResult(_0x4bb2fb,null))[_0xac4a('0x45')](handleError(_0x4bb2fb,null));};exports[_0xac4a('0x4d')]=function(_0x49fbc3,_0x179373){var _0x564b10={},_0x307441={},_0x2c04af={'count':0x0,'rows':[]};_0x307441['model']=_['keys'](db[_0xac4a('0x42')][_0xac4a('0x47')]);_0x307441['query']=_[_0xac4a('0x33')](_0x49fbc3[_0xac4a('0x36')]);_0x307441[_0xac4a('0x34')]=_[_0xac4a('0x35')](_0x307441['model'],_0x307441[_0xac4a('0x36')]);_0x564b10[_0xac4a('0x37')]=_[_0xac4a('0x35')](_0x307441[_0xac4a('0x32')],qs[_0xac4a('0x38')](_0x49fbc3[_0xac4a('0x36')][_0xac4a('0x38')]));_0x564b10['attributes']=_0x564b10[_0xac4a('0x37')][_0xac4a('0x39')]?_0x564b10[_0xac4a('0x37')]:_0x307441[_0xac4a('0x32')];if(!_0x49fbc3[_0xac4a('0x36')][_0xac4a('0x3a')](_0xac4a('0x4e'))){_0x564b10[_0xac4a('0x3b')]=qs[_0xac4a('0x3b')](_0x49fbc3[_0xac4a('0x36')][_0xac4a('0x3b')]);_0x564b10[_0xac4a('0x21')]=qs[_0xac4a('0x21')](_0x49fbc3[_0xac4a('0x36')][_0xac4a('0x21')]);}_0x564b10[_0xac4a('0x4f')]=qs['sort'](_0x49fbc3[_0xac4a('0x36')]['sort']);_0x564b10[_0xac4a('0x3d')]=qs['filters'](_[_0xac4a('0x3e')](_0x49fbc3['query'],_0x307441[_0xac4a('0x34')]));if(_0x49fbc3['query']['filter']){_0x564b10[_0xac4a('0x3d')]=_[_0xac4a('0x40')](_0x564b10[_0xac4a('0x3d')],{'$or':_[_0xac4a('0x2e')](_0x564b10[_0xac4a('0x37')],function(_0xb7b884){var _0x592a4b={};_0x592a4b[_0xb7b884]={'$like':'%'+_0x49fbc3[_0xac4a('0x36')]['filter']+'%'};return _0x592a4b;})});}_0x564b10=_[_0xac4a('0x40')]({},_0x564b10,_0x49fbc3['options']);var _0x347880={'where':_0x564b10[_0xac4a('0x3d')]};return db[_0xac4a('0x42')][_0xac4a('0x20')](_0x347880)[_0xac4a('0x27')](function(_0x2bc39a){_0x2c04af[_0xac4a('0x20')]=_0x2bc39a;if(_0x49fbc3[_0xac4a('0x36')][_0xac4a('0x43')]){_0x564b10[_0xac4a('0x48')]=[{'all':!![]}];}return db[_0xac4a('0x42')][_0xac4a('0x50')](_0x564b10);})[_0xac4a('0x27')](function(_0x2cc410){_0x2c04af[_0xac4a('0x44')]=_0x2cc410;return _0x2c04af;})[_0xac4a('0x27')](respondWithFilteredResult(_0x179373,_0x564b10,_0xac4a('0x4d')))['catch'](handleError(_0x179373,null,_0xac4a('0x4d')));}; \ No newline at end of file diff --git a/server/api/voiceQueueReport/voiceQueueReport.events.js b/server/api/voiceQueueReport/voiceQueueReport.events.js index 278b706..d5c65c5 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 _0x7ee0=['update','remove','emit','hasOwnProperty','exports','events','../../mysqldb','VoiceQueueReport','save'];(function(_0x2261ce,_0x9ed8b6){var _0x524640=function(_0x3cbb90){while(--_0x3cbb90){_0x2261ce['push'](_0x2261ce['shift']());}};_0x524640(++_0x9ed8b6);}(_0x7ee0,0x7a));var _0x07ee=function(_0x537c3b,_0x51e8d5){_0x537c3b=_0x537c3b-0x0;var _0x4d7197=_0x7ee0[_0x537c3b];return _0x4d7197;};'use strict';var EventEmitter=require(_0x07ee('0x0'));var VoiceQueueReport=require(_0x07ee('0x1'))['db'][_0x07ee('0x2')];var VoiceQueueReportEvents=new EventEmitter();VoiceQueueReportEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x07ee('0x3'),'afterUpdate':_0x07ee('0x4'),'afterDestroy':_0x07ee('0x5')};function emitEvent(_0x28b96b){return function(_0x237ffb,_0x41c71a,_0x3748fe){VoiceQueueReportEvents['emit'](_0x28b96b+':'+_0x237ffb['id'],_0x237ffb);VoiceQueueReportEvents[_0x07ee('0x6')](_0x28b96b,_0x237ffb);_0x3748fe(null);};}for(var e in events){if(events[_0x07ee('0x7')](e)){var event=events[e];VoiceQueueReport['hook'](e,emitEvent(event));}}module[_0x07ee('0x8')]=VoiceQueueReportEvents; \ No newline at end of file +var _0x2147=['remove','emit','exports','events','VoiceQueueReport','setMaxListeners','save','update'];(function(_0x17e618,_0x289d48){var _0x2e0d72=function(_0x16d66e){while(--_0x16d66e){_0x17e618['push'](_0x17e618['shift']());}};_0x2e0d72(++_0x289d48);}(_0x2147,0x11b));var _0x7214=function(_0x2a76cb,_0x5927ed){_0x2a76cb=_0x2a76cb-0x0;var _0x5edb5d=_0x2147[_0x2a76cb];return _0x5edb5d;};'use strict';var EventEmitter=require(_0x7214('0x0'));var VoiceQueueReport=require('../../mysqldb')['db'][_0x7214('0x1')];var VoiceQueueReportEvents=new EventEmitter();VoiceQueueReportEvents[_0x7214('0x2')](0x0);var events={'afterCreate':_0x7214('0x3'),'afterUpdate':_0x7214('0x4'),'afterDestroy':_0x7214('0x5')};function emitEvent(_0x376d75){return function(_0x1a37ee,_0x24c718,_0x3378d1){VoiceQueueReportEvents[_0x7214('0x6')](_0x376d75+':'+_0x1a37ee['id'],_0x1a37ee);VoiceQueueReportEvents[_0x7214('0x6')](_0x376d75,_0x1a37ee);_0x3378d1(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];VoiceQueueReport['hook'](e,emitEvent(event));}}module[_0x7214('0x7')]=VoiceQueueReportEvents; \ No newline at end of file diff --git a/server/api/voiceQueueReport/voiceQueueReport.model.js b/server/api/voiceQueueReport/voiceQueueReport.model.js index c4e4bc2..acc20f4 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(_0x30e7e6,_0x2ce648){var _0x58fd15=function(_0xe5f665){while(--_0xe5f665){_0x30e7e6['push'](_0x30e7e6['shift']());}};_0x58fd15(++_0x2ce648);}(_0x5f66,0x1a0));var _0x65f6=function(_0x3947c9,_0x4d6c97){_0x3947c9=_0x3947c9-0x0;var _0x2e7871=_0x5f66[_0x3947c9];return _0x2e7871;};'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 _0x0b0e=['calleridnum','lodash','../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment','./voiceQueueReport.attributes','exports','define','uniqueid'];(function(_0x561b66,_0x51fd13){var _0x52cdaf=function(_0x300626){while(--_0x300626){_0x561b66['push'](_0x561b66['shift']());}};_0x52cdaf(++_0x51fd13);}(_0x0b0e,0x187));var _0xe0b0=function(_0x321e39,_0x2f99c8){_0x321e39=_0x321e39-0x0;var _0x2e5be2=_0x0b0e[_0x321e39];return _0x2e5be2;};'use strict';var _=require(_0xe0b0('0x0'));var util=require('util');var logger=require(_0xe0b0('0x1'))('api');var moment=require(_0xe0b0('0x2'));var BPromise=require(_0xe0b0('0x3'));var rp=require(_0xe0b0('0x4'));var fs=require('fs');var path=require(_0xe0b0('0x5'));var rimraf=require(_0xe0b0('0x6'));var config=require(_0xe0b0('0x7'));var attributes=require(_0xe0b0('0x8'));module[_0xe0b0('0x9')]=function(_0x30e20d,_0x28e40f){return _0x30e20d[_0xe0b0('0xa')]('VoiceQueueReport',attributes,{'tableName':'report_queue','paranoid':![],'indexes':[{'fields':[_0xe0b0('0xb')]},{'fields':[_0xe0b0('0xc')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceQueueReport/voiceQueueReport.rpc.js b/server/api/voiceQueueReport/voiceQueueReport.rpc.js index c4d6055..d58d9ba 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 _0x7a0c=['VoiceQueueReport,\x20%s,\x20%s','VoiceQueueReport,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','GetVoiceQueueReport','VoiceQueueReport','findAll','options','raw','attributes','limit','include','map','model','debug','catch','create','body','CreateVoiceQueueReport','update','where','UpdateVoiceQueueReport','lodash','util','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','defaults','redis','localhost','socket.io-emitter','./voiceQueueReport.socket','register','request','then','info'];(function(_0x5e9aa2,_0xd197ca){var _0xc42277=function(_0xbda71a){while(--_0xbda71a){_0x5e9aa2['push'](_0x5e9aa2['shift']());}};_0xc42277(++_0xd197ca);}(_0x7a0c,0x1e5));var _0xc7a0=function(_0x3aa30d,_0x1b1fa9){_0x3aa30d=_0x3aa30d-0x0;var _0x4fe3a6=_0x7a0c[_0x3aa30d];return _0x4fe3a6;};'use strict';var _=require(_0xc7a0('0x0'));var util=require(_0xc7a0('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0xc7a0('0x2'));var fs=require('fs');var Redis=require(_0xc7a0('0x3'));var db=require(_0xc7a0('0x4'))['db'];var utils=require(_0xc7a0('0x5'));var logger=require(_0xc7a0('0x6'))(_0xc7a0('0x7'));var config=require(_0xc7a0('0x8'));var jayson=require(_0xc7a0('0x9'));var client=jayson[_0xc7a0('0xa')][_0xc7a0('0xb')]({'port':0x232a});config['redis']=_[_0xc7a0('0xc')](config[_0xc7a0('0xd')],{'host':_0xc7a0('0xe'),'port':0x18eb});var socket=require(_0xc7a0('0xf'))(new Redis(config[_0xc7a0('0xd')]));require(_0xc7a0('0x10'))[_0xc7a0('0x11')](socket);function respondWithRpcPromise(_0x4d0355,_0x39c55f,_0x5e2061){return new BPromise(function(_0x153e3a,_0x325176){return client[_0xc7a0('0x12')](_0x4d0355,_0x5e2061)[_0xc7a0('0x13')](function(_0x549f39){logger[_0xc7a0('0x14')](_0xc7a0('0x15'),_0x39c55f,'request\x20sent');logger['debug'](_0xc7a0('0x16'),_0x39c55f,_0xc7a0('0x17'),JSON[_0xc7a0('0x18')](_0x549f39));if(_0x549f39[_0xc7a0('0x19')]){if(_0x549f39[_0xc7a0('0x19')][_0xc7a0('0x1a')]===0x1f4){logger['error'](_0xc7a0('0x15'),_0x39c55f,_0x549f39['error']['message']);return _0x325176(_0x549f39[_0xc7a0('0x19')][_0xc7a0('0x1b')]);}logger[_0xc7a0('0x19')](_0xc7a0('0x15'),_0x39c55f,_0x549f39[_0xc7a0('0x19')][_0xc7a0('0x1b')]);return _0x153e3a(_0x549f39[_0xc7a0('0x19')][_0xc7a0('0x1b')]);}else{logger[_0xc7a0('0x14')](_0xc7a0('0x15'),_0x39c55f,'request\x20sent');_0x153e3a(_0x549f39['result']['message']);}})['catch'](function(_0x14a5b4){logger[_0xc7a0('0x19')](_0xc7a0('0x15'),_0x39c55f,_0x14a5b4);_0x325176(_0x14a5b4);});});}exports[_0xc7a0('0x1c')]=function(_0x246e24){var _0x1027de=this;return new Promise(function(_0x281129,_0x2b0f89){return db[_0xc7a0('0x1d')][_0xc7a0('0x1e')]({'raw':_0x246e24[_0xc7a0('0x1f')]?_0x246e24['options'][_0xc7a0('0x20')]===undefined?!![]:![]:!![],'where':_0x246e24[_0xc7a0('0x1f')]?_0x246e24[_0xc7a0('0x1f')]['where']||null:null,'attributes':_0x246e24[_0xc7a0('0x1f')]?_0x246e24[_0xc7a0('0x1f')][_0xc7a0('0x21')]||null:null,'limit':_0x246e24[_0xc7a0('0x1f')]?_0x246e24[_0xc7a0('0x1f')][_0xc7a0('0x22')]||null:null,'include':_0x246e24[_0xc7a0('0x1f')]?_0x246e24[_0xc7a0('0x1f')][_0xc7a0('0x23')]?_[_0xc7a0('0x24')](_0x246e24[_0xc7a0('0x1f')][_0xc7a0('0x23')],function(_0x23bac3){return{'model':db[_0x23bac3['model']],'as':_0x23bac3['as'],'attributes':_0x23bac3[_0xc7a0('0x21')],'include':_0x23bac3[_0xc7a0('0x23')]?_[_0xc7a0('0x24')](_0x23bac3[_0xc7a0('0x23')],function(_0x2bd05d){return{'model':db[_0x2bd05d['model']],'as':_0x2bd05d['as'],'attributes':_0x2bd05d[_0xc7a0('0x21')],'include':_0x2bd05d[_0xc7a0('0x23')]?_[_0xc7a0('0x24')](_0x2bd05d[_0xc7a0('0x23')],function(_0x21d45c){return{'model':db[_0x21d45c[_0xc7a0('0x25')]],'as':_0x21d45c['as'],'attributes':_0x21d45c[_0xc7a0('0x21')]};}):[]};}):[]};}):[]:[]})[_0xc7a0('0x13')](function(_0x1386bf){logger[_0xc7a0('0x14')](_0xc7a0('0x1c'),_0x246e24);logger[_0xc7a0('0x26')](_0xc7a0('0x1c'),_0x246e24,JSON[_0xc7a0('0x18')](_0x1386bf));_0x281129(_0x1386bf);})[_0xc7a0('0x27')](function(_0x1106be){logger['error'](_0xc7a0('0x1c'),_0x1106be[_0xc7a0('0x1b')],_0x246e24);_0x2b0f89(_0x1027de[_0xc7a0('0x19')](0x1f4,_0x1106be[_0xc7a0('0x1b')]));});});};exports['CreateVoiceQueueReport']=function(_0x530a77){var _0x246bca=this;return new Promise(function(_0x207502,_0x3d0f11){return db['VoiceQueueReport'][_0xc7a0('0x28')](_0x530a77[_0xc7a0('0x29')],{'raw':_0x530a77[_0xc7a0('0x1f')]?_0x530a77['options'][_0xc7a0('0x20')]===undefined?!![]:![]:!![]})[_0xc7a0('0x13')](function(_0x5a0a18){logger[_0xc7a0('0x14')]('CreateVoiceQueueReport',_0x530a77);logger[_0xc7a0('0x26')](_0xc7a0('0x2a'),_0x530a77,JSON['stringify'](_0x5a0a18));_0x207502(_0x5a0a18);})[_0xc7a0('0x27')](function(_0xfff90c){logger['error']('CreateVoiceQueueReport',_0xfff90c[_0xc7a0('0x1b')],_0x530a77);_0x3d0f11(_0x246bca['error'](0x1f4,_0xfff90c[_0xc7a0('0x1b')]));});});};exports['UpdateVoiceQueueReport']=function(_0x35b6f4){var _0x2d47f8=this;return new Promise(function(_0x408087,_0x5e27b4){return db[_0xc7a0('0x1d')][_0xc7a0('0x2b')](_0x35b6f4[_0xc7a0('0x29')],{'raw':_0x35b6f4[_0xc7a0('0x1f')]?_0x35b6f4['options']['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x35b6f4['options']?_0x35b6f4[_0xc7a0('0x1f')][_0xc7a0('0x2c')]||null:null,'attributes':_0x35b6f4[_0xc7a0('0x1f')]?_0x35b6f4[_0xc7a0('0x1f')][_0xc7a0('0x21')]||null:null,'limit':_0x35b6f4[_0xc7a0('0x1f')]?_0x35b6f4[_0xc7a0('0x1f')][_0xc7a0('0x22')]||null:null})['then'](function(_0xbe7b7c){logger[_0xc7a0('0x14')](_0xc7a0('0x2d'),_0x35b6f4);logger[_0xc7a0('0x26')](_0xc7a0('0x2d'),_0x35b6f4,JSON[_0xc7a0('0x18')](_0xbe7b7c));_0x408087(_0xbe7b7c);})[_0xc7a0('0x27')](function(_0x20e719){logger[_0xc7a0('0x19')](_0xc7a0('0x2d'),_0x20e719[_0xc7a0('0x1b')],_0x35b6f4);_0x5e27b4(_0x2d47f8[_0xc7a0('0x19')](0x1f4,_0x20e719[_0xc7a0('0x1b')]));});});}; \ No newline at end of file +var _0xf3f4=['VoiceQueueReport','options','raw','where','include','map','model','attributes','GetVoiceQueueReport','CreateVoiceQueueReport','create','body','debug','update','limit','UpdateVoiceQueueReport','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','jayson/promise','client','http','redis','defaults','./voiceQueueReport.socket','register','request','then','info','VoiceQueueReport,\x20%s,\x20%s','request\x20sent','VoiceQueueReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch'];(function(_0xda5315,_0x1d6e0c){var _0x325e31=function(_0x9454b6){while(--_0x9454b6){_0xda5315['push'](_0xda5315['shift']());}};_0x325e31(++_0x1d6e0c);}(_0xf3f4,0x94));var _0x4f3f=function(_0x2ce71a,_0x15a383){_0x2ce71a=_0x2ce71a-0x0;var _0xc0fb18=_0xf3f4[_0x2ce71a];return _0xc0fb18;};'use strict';var _=require(_0x4f3f('0x0'));var util=require(_0x4f3f('0x1'));var moment=require(_0x4f3f('0x2'));var BPromise=require(_0x4f3f('0x3'));var rs=require(_0x4f3f('0x4'));var fs=require('fs');var Redis=require(_0x4f3f('0x5'));var db=require(_0x4f3f('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0x4f3f('0x7'))(_0x4f3f('0x8'));var config=require('../../config/environment');var jayson=require(_0x4f3f('0x9'));var client=jayson[_0x4f3f('0xa')][_0x4f3f('0xb')]({'port':0x232a});config[_0x4f3f('0xc')]=_[_0x4f3f('0xd')](config[_0x4f3f('0xc')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x4f3f('0xc')]));require(_0x4f3f('0xe'))[_0x4f3f('0xf')](socket);function respondWithRpcPromise(_0x490881,_0x1b55fc,_0x16205d){return new BPromise(function(_0x3f3ccc,_0x1f95d5){return client[_0x4f3f('0x10')](_0x490881,_0x16205d)[_0x4f3f('0x11')](function(_0x1f0dd8){logger[_0x4f3f('0x12')](_0x4f3f('0x13'),_0x1b55fc,_0x4f3f('0x14'));logger['debug'](_0x4f3f('0x15'),_0x1b55fc,'request\x20sent',JSON[_0x4f3f('0x16')](_0x1f0dd8));if(_0x1f0dd8[_0x4f3f('0x17')]){if(_0x1f0dd8[_0x4f3f('0x17')][_0x4f3f('0x18')]===0x1f4){logger[_0x4f3f('0x17')](_0x4f3f('0x13'),_0x1b55fc,_0x1f0dd8['error'][_0x4f3f('0x19')]);return _0x1f95d5(_0x1f0dd8[_0x4f3f('0x17')][_0x4f3f('0x19')]);}logger['error'](_0x4f3f('0x13'),_0x1b55fc,_0x1f0dd8[_0x4f3f('0x17')][_0x4f3f('0x19')]);return _0x3f3ccc(_0x1f0dd8[_0x4f3f('0x17')][_0x4f3f('0x19')]);}else{logger['info'](_0x4f3f('0x13'),_0x1b55fc,'request\x20sent');_0x3f3ccc(_0x1f0dd8[_0x4f3f('0x1a')]['message']);}})[_0x4f3f('0x1b')](function(_0x30b113){logger[_0x4f3f('0x17')]('VoiceQueueReport,\x20%s,\x20%s',_0x1b55fc,_0x30b113);_0x1f95d5(_0x30b113);});});}exports['GetVoiceQueueReport']=function(_0x33112c){var _0x13525c=this;return new Promise(function(_0x414955,_0x50382b){return db[_0x4f3f('0x1c')]['findAll']({'raw':_0x33112c[_0x4f3f('0x1d')]?_0x33112c[_0x4f3f('0x1d')][_0x4f3f('0x1e')]===undefined?!![]:![]:!![],'where':_0x33112c[_0x4f3f('0x1d')]?_0x33112c[_0x4f3f('0x1d')][_0x4f3f('0x1f')]||null:null,'attributes':_0x33112c[_0x4f3f('0x1d')]?_0x33112c['options']['attributes']||null:null,'limit':_0x33112c[_0x4f3f('0x1d')]?_0x33112c[_0x4f3f('0x1d')]['limit']||null:null,'include':_0x33112c['options']?_0x33112c['options'][_0x4f3f('0x20')]?_[_0x4f3f('0x21')](_0x33112c[_0x4f3f('0x1d')]['include'],function(_0x3b2473){return{'model':db[_0x3b2473[_0x4f3f('0x22')]],'as':_0x3b2473['as'],'attributes':_0x3b2473[_0x4f3f('0x23')],'include':_0x3b2473[_0x4f3f('0x20')]?_[_0x4f3f('0x21')](_0x3b2473[_0x4f3f('0x20')],function(_0x3f263b){return{'model':db[_0x3f263b[_0x4f3f('0x22')]],'as':_0x3f263b['as'],'attributes':_0x3f263b[_0x4f3f('0x23')],'include':_0x3f263b[_0x4f3f('0x20')]?_['map'](_0x3f263b[_0x4f3f('0x20')],function(_0x416f4c){return{'model':db[_0x416f4c['model']],'as':_0x416f4c['as'],'attributes':_0x416f4c[_0x4f3f('0x23')]};}):[]};}):[]};}):[]:[]})[_0x4f3f('0x11')](function(_0x1cc8dd){logger[_0x4f3f('0x12')](_0x4f3f('0x24'),_0x33112c);logger['debug'](_0x4f3f('0x24'),_0x33112c,JSON[_0x4f3f('0x16')](_0x1cc8dd));_0x414955(_0x1cc8dd);})['catch'](function(_0x28db0e){logger['error'](_0x4f3f('0x24'),_0x28db0e[_0x4f3f('0x19')],_0x33112c);_0x50382b(_0x13525c[_0x4f3f('0x17')](0x1f4,_0x28db0e[_0x4f3f('0x19')]));});});};exports[_0x4f3f('0x25')]=function(_0x314d32){var _0xb99658=this;return new Promise(function(_0x8a3253,_0x28a976){return db['VoiceQueueReport'][_0x4f3f('0x26')](_0x314d32[_0x4f3f('0x27')],{'raw':_0x314d32[_0x4f3f('0x1d')]?_0x314d32[_0x4f3f('0x1d')][_0x4f3f('0x1e')]===undefined?!![]:![]:!![]})['then'](function(_0x4ea095){logger[_0x4f3f('0x12')]('CreateVoiceQueueReport',_0x314d32);logger[_0x4f3f('0x28')](_0x4f3f('0x25'),_0x314d32,JSON['stringify'](_0x4ea095));_0x8a3253(_0x4ea095);})[_0x4f3f('0x1b')](function(_0x5c15b1){logger[_0x4f3f('0x17')](_0x4f3f('0x25'),_0x5c15b1[_0x4f3f('0x19')],_0x314d32);_0x28a976(_0xb99658['error'](0x1f4,_0x5c15b1[_0x4f3f('0x19')]));});});};exports['UpdateVoiceQueueReport']=function(_0x46d926){var _0x331af5=this;return new Promise(function(_0x57eca3,_0x4847fc){return db[_0x4f3f('0x1c')][_0x4f3f('0x29')](_0x46d926[_0x4f3f('0x27')],{'raw':_0x46d926[_0x4f3f('0x1d')]?_0x46d926['options'][_0x4f3f('0x1e')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x46d926[_0x4f3f('0x1d')]?_0x46d926['options']['where']||null:null,'attributes':_0x46d926['options']?_0x46d926[_0x4f3f('0x1d')]['attributes']||null:null,'limit':_0x46d926[_0x4f3f('0x1d')]?_0x46d926[_0x4f3f('0x1d')][_0x4f3f('0x2a')]||null:null})[_0x4f3f('0x11')](function(_0x35f046){logger[_0x4f3f('0x12')](_0x4f3f('0x2b'),_0x46d926);logger[_0x4f3f('0x28')](_0x4f3f('0x2b'),_0x46d926,JSON[_0x4f3f('0x16')](_0x35f046));_0x57eca3(_0x35f046);})[_0x4f3f('0x1b')](function(_0x98f2f5){logger[_0x4f3f('0x17')](_0x4f3f('0x2b'),_0x98f2f5[_0x4f3f('0x19')],_0x46d926);_0x4847fc(_0x331af5[_0x4f3f('0x17')](0x1f4,_0x98f2f5[_0x4f3f('0x19')]));});});}; \ No newline at end of file diff --git a/server/api/voiceQueueReport/voiceQueueReport.socket.js b/server/api/voiceQueueReport/voiceQueueReport.socket.js index 9095f1d..cd3ab75 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 _0xc2a4=['remove','update','emit','register','length','voiceQueueReport:','./voiceQueueReport.events'];(function(_0x154df5,_0x33ae3d){var _0x478a3d=function(_0x2b3b9a){while(--_0x2b3b9a){_0x154df5['push'](_0x154df5['shift']());}};_0x478a3d(++_0x33ae3d);}(_0xc2a4,0xdf));var _0x4c2a=function(_0x5cdeed,_0x179a1d){_0x5cdeed=_0x5cdeed-0x0;var _0x11f20e=_0xc2a4[_0x5cdeed];return _0x11f20e;};'use strict';var VoiceQueueReportEvents=require(_0x4c2a('0x0'));var events=['save',_0x4c2a('0x1'),_0x4c2a('0x2')];function createListener(_0xb6a69,_0x52b39e){return function(_0x409389){_0x52b39e[_0x4c2a('0x3')](_0xb6a69,_0x409389);};}function removeListener(_0x36e0e1,_0x2fd3bd){return function(){VoiceQueueReportEvents['removeListener'](_0x36e0e1,_0x2fd3bd);};}exports[_0x4c2a('0x4')]=function(_0x254d28){for(var _0x25666d=0x0,_0x3b3383=events[_0x4c2a('0x5')];_0x25666d<_0x3b3383;_0x25666d++){var _0x46b486=events[_0x25666d];var _0x29ebba=createListener(_0x4c2a('0x6')+_0x46b486,_0x254d28);VoiceQueueReportEvents['on'](_0x46b486,_0x29ebba);}}; \ No newline at end of file +var _0xcbc1=['save','remove','update','removeListener','register','length','./voiceQueueReport.events'];(function(_0x4e3e9f,_0x1b75b1){var _0x1f3438=function(_0x5ae613){while(--_0x5ae613){_0x4e3e9f['push'](_0x4e3e9f['shift']());}};_0x1f3438(++_0x1b75b1);}(_0xcbc1,0x133));var _0x1cbc=function(_0x35aeb5,_0x4e8855){_0x35aeb5=_0x35aeb5-0x0;var _0x18fcec=_0xcbc1[_0x35aeb5];return _0x18fcec;};'use strict';var VoiceQueueReportEvents=require(_0x1cbc('0x0'));var events=[_0x1cbc('0x1'),_0x1cbc('0x2'),_0x1cbc('0x3')];function createListener(_0x91703c,_0x877d4){return function(_0x5bc4e1){_0x877d4['emit'](_0x91703c,_0x5bc4e1);};}function removeListener(_0x3cb00c,_0x2c1527){return function(){VoiceQueueReportEvents[_0x1cbc('0x4')](_0x3cb00c,_0x2c1527);};}exports[_0x1cbc('0x5')]=function(_0x19b8cd){for(var _0x49fe5f=0x0,_0x153bcf=events[_0x1cbc('0x6')];_0x49fe5f<_0x153bcf;_0x49fe5f++){var _0x2f1741=events[_0x49fe5f];var _0x3558ff=createListener('voiceQueueReport:'+_0x2f1741,_0x19b8cd);VoiceQueueReportEvents['on'](_0x2f1741,_0x3558ff);}}; \ No newline at end of file diff --git a/server/api/voiceQueuesLog/index.js b/server/api/voiceQueuesLog/index.js index 4ae3e0e..25e1b09 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 _0xfded=['post','create','put','delete','exports','express','Router','../../components/auth/service','../../config/environment','get','isAuthenticated','index','/:id','show'];(function(_0x4b355c,_0x5078cf){var _0x4bf29a=function(_0x1237d5){while(--_0x1237d5){_0x4b355c['push'](_0x4b355c['shift']());}};_0x4bf29a(++_0x5078cf);}(_0xfded,0x1c5));var _0xdfde=function(_0x124da8,_0x2f4adf){_0x124da8=_0x124da8-0x0;var _0x470b89=_0xfded[_0x124da8];return _0x470b89;};'use strict';var multer=require('multer');var util=require('util');var path=require('path');var timeout=require('connect-timeout');var express=require(_0xdfde('0x0'));var router=express[_0xdfde('0x1')]();var auth=require(_0xdfde('0x2'));var interaction=require('../../components/interaction/service');var config=require(_0xdfde('0x3'));var controller=require('./voiceQueuesLog.controller');router[_0xdfde('0x4')]('/',auth[_0xdfde('0x5')](),controller[_0xdfde('0x6')]);router[_0xdfde('0x4')](_0xdfde('0x7'),auth['isAuthenticated'](),controller[_0xdfde('0x8')]);router[_0xdfde('0x9')]('/',auth['isAuthenticated'](),controller[_0xdfde('0xa')]);router[_0xdfde('0xb')](_0xdfde('0x7'),auth[_0xdfde('0x5')](),controller['update']);router[_0xdfde('0xc')]('/:id',auth[_0xdfde('0x5')](),controller['destroy']);module[_0xdfde('0xd')]=router; \ No newline at end of file +var _0x003d=['delete','destroy','exports','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceQueuesLog.controller','get','isAuthenticated','index','/:id','create','put','update'];(function(_0x2c9cf9,_0x2bed45){var _0x560d6d=function(_0x419979){while(--_0x419979){_0x2c9cf9['push'](_0x2c9cf9['shift']());}};_0x560d6d(++_0x2bed45);}(_0x003d,0x1bd));var _0xd003=function(_0x37d532,_0x36c10d){_0x37d532=_0x37d532-0x0;var _0x336487=_0x003d[_0x37d532];return _0x336487;};'use strict';var multer=require('multer');var util=require('util');var path=require('path');var timeout=require(_0xd003('0x0'));var express=require(_0xd003('0x1'));var router=express[_0xd003('0x2')]();var auth=require(_0xd003('0x3'));var interaction=require(_0xd003('0x4'));var config=require(_0xd003('0x5'));var controller=require(_0xd003('0x6'));router[_0xd003('0x7')]('/',auth[_0xd003('0x8')](),controller[_0xd003('0x9')]);router['get'](_0xd003('0xa'),auth[_0xd003('0x8')](),controller['show']);router['post']('/',auth[_0xd003('0x8')](),controller[_0xd003('0xb')]);router[_0xd003('0xc')]('/:id',auth['isAuthenticated'](),controller[_0xd003('0xd')]);router[_0xd003('0xe')](_0xd003('0xa'),auth[_0xd003('0x8')](),controller[_0xd003('0xf')]);module[_0xd003('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 c0fd8cc..8dd4807 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 _0x1f99=['exports','STRING','DATE','format','YYYY-MM-DD\x20HH:mm:ss','moment'];(function(_0x962fc5,_0x58f074){var _0x43667c=function(_0x5e6ec0){while(--_0x5e6ec0){_0x962fc5['push'](_0x962fc5['shift']());}};_0x43667c(++_0x58f074);}(_0x1f99,0x113));var _0x91f9=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x1f99[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require('sequelize');var moment=require(_0x91f9('0x0'));module[_0x91f9('0x1')]={'time':{'type':Sequelize['STRING']},'callid':{'type':Sequelize[_0x91f9('0x2')],'allowNull':![],'defaultValue':''},'queuename':{'type':Sequelize[_0x91f9('0x2')],'allowNull':![],'defaultValue':''},'agent':{'type':Sequelize[_0x91f9('0x2')],'allowNull':![],'defaultValue':''},'event':{'type':Sequelize[_0x91f9('0x2')],'allowNull':![],'defaultValue':''},'data':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':''},'data1':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':''},'data2':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':''},'data3':{'type':Sequelize[_0x91f9('0x2')],'allowNull':![],'defaultValue':''},'data4':{'type':Sequelize[_0x91f9('0x2')],'allowNull':![],'defaultValue':''},'data5':{'type':Sequelize[_0x91f9('0x2')],'allowNull':![],'defaultValue':''},'dtm':{'type':Sequelize[_0x91f9('0x3')],'allowNull':![],'defaultValue':moment()[_0x91f9('0x4')](_0x91f9('0x5'))}}; \ No newline at end of file +var _0x0c8c=['sequelize','moment','exports','STRING','format','YYYY-MM-DD\x20HH:mm:ss'];(function(_0xa76cbe,_0x53b6b6){var _0x4e47a8=function(_0x452d75){while(--_0x452d75){_0xa76cbe['push'](_0xa76cbe['shift']());}};_0x4e47a8(++_0x53b6b6);}(_0x0c8c,0xcc));var _0xc0c8=function(_0x1f4097,_0x5eea7a){_0x1f4097=_0x1f4097-0x0;var _0x101490=_0x0c8c[_0x1f4097];return _0x101490;};'use strict';var Sequelize=require(_0xc0c8('0x0'));var moment=require(_0xc0c8('0x1'));module[_0xc0c8('0x2')]={'time':{'type':Sequelize[_0xc0c8('0x3')]},'callid':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':''},'queuename':{'type':Sequelize[_0xc0c8('0x3')],'allowNull':![],'defaultValue':''},'agent':{'type':Sequelize[_0xc0c8('0x3')],'allowNull':![],'defaultValue':''},'event':{'type':Sequelize[_0xc0c8('0x3')],'allowNull':![],'defaultValue':''},'data':{'type':Sequelize[_0xc0c8('0x3')],'allowNull':![],'defaultValue':''},'data1':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':''},'data2':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':''},'data3':{'type':Sequelize[_0xc0c8('0x3')],'allowNull':![],'defaultValue':''},'data4':{'type':Sequelize[_0xc0c8('0x3')],'allowNull':![],'defaultValue':''},'data5':{'type':Sequelize[_0xc0c8('0x3')],'allowNull':![],'defaultValue':''},'dtm':{'type':Sequelize['DATE'],'allowNull':![],'defaultValue':moment()[_0xc0c8('0x4')](_0xc0c8('0x5'))}}; \ No newline at end of file diff --git a/server/api/voiceQueuesLog/voiceQueuesLog.controller.js b/server/api/voiceQueuesLog/voiceQueuesLog.controller.js index 2b36b5c..0c45b47 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 _0x3836=['pick','merge','VIRTUAL','filter','VoiceQueuesLog','includeAll','include','rows','catch','show','params','rawAttributes','length','find','create','body','html-pdf','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','to-csv','ejs','lodash','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','sendStatus','status','end','json','count','offset','Content-Range','apply','reject','save','update','then','name','send','index','map','fieldName','type','query','keys','filters','intersection','model','fields','attributes','hasOwnProperty','limit','sort','where'];(function(_0x1d2af7,_0x45abd5){var _0x8c1eb=function(_0x4a118b){while(--_0x4a118b){_0x1d2af7['push'](_0x1d2af7['shift']());}};_0x8c1eb(++_0x45abd5);}(_0x3836,0xe2));var _0x6383=function(_0x40bbf9,_0x29b344){_0x40bbf9=_0x40bbf9-0x0;var _0x5b32e7=_0x3836[_0x40bbf9];return _0x5b32e7;};'use strict';var pdf=require(_0x6383('0x0'));var emlformat=require('eml-format');var rimraf=require(_0x6383('0x1'));var zipdir=require(_0x6383('0x2'));var jsonpatch=require(_0x6383('0x3'));var rp=require(_0x6383('0x4'));var moment=require(_0x6383('0x5'));var BPromise=require(_0x6383('0x6'));var Mustache=require(_0x6383('0x7'));var util=require(_0x6383('0x8'));var path=require('path');var sox=require(_0x6383('0x9'));var csv=require(_0x6383('0xa'));var ejs=require(_0x6383('0xb'));var fs=require('fs');var _=require(_0x6383('0xc'));var squel=require(_0x6383('0xd'));var crypto=require(_0x6383('0xe'));var jsforce=require(_0x6383('0xf'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x6383('0x10'));var Papa=require(_0x6383('0x11'));var Redis=require(_0x6383('0x12'));var authService=require(_0x6383('0x13'));var qs=require('../../components/parsers/qs');var as=require(_0x6383('0x14'));var hardwareService=require(_0x6383('0x15'));var logger=require(_0x6383('0x16'))(_0x6383('0x17'));var utils=require('../../config/utils');var config=require(_0x6383('0x18'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x5d8d5d,_0x30c87c){_0x30c87c=_0x30c87c||0xcc;return function(_0x3244d4){if(_0x3244d4){return _0x5d8d5d[_0x6383('0x19')](_0x30c87c);}return _0x5d8d5d[_0x6383('0x1a')](_0x30c87c)[_0x6383('0x1b')]();};}function respondWithResult(_0xfdcb23,_0x2722e0){_0x2722e0=_0x2722e0||0xc8;return function(_0x124a31){if(_0x124a31){return _0xfdcb23[_0x6383('0x1a')](_0x2722e0)[_0x6383('0x1c')](_0x124a31);}};}function respondWithFilteredResult(_0x5a7e57,_0x339e3c){return function(_0x23e454){if(_0x23e454){var _0x6c7835=_0x23e454[_0x6383('0x1d')],_0x30fc3f=_0x339e3c[_0x6383('0x1e')],_0x25ed2f=_0x339e3c[_0x6383('0x1e')]+_0x339e3c['limit'],_0xaab37b;if(_0x25ed2f>=_0x6c7835){_0x25ed2f=_0x6c7835;_0xaab37b=0xc8;}else{_0xaab37b=0xce;}_0x5a7e57['status'](_0xaab37b);return _0x5a7e57['set'](_0x6383('0x1f'),_0x30fc3f+'-'+_0x25ed2f+'/'+_0x6c7835)[_0x6383('0x1c')](_0x23e454);}return null;};}function patchUpdates(_0x100632){return function(_0x2682e2){try{jsonpatch[_0x6383('0x20')](_0x2682e2,_0x100632,!![]);}catch(_0x453c50){return BPromise[_0x6383('0x21')](_0x453c50);}return _0x2682e2[_0x6383('0x22')]();};}function saveUpdates(_0x3875d5,_0x1a50b9){return function(_0x3fcecd){if(_0x3fcecd){return _0x3fcecd[_0x6383('0x23')](_0x3875d5)[_0x6383('0x24')](function(_0x59b2b3){return _0x59b2b3;});}return null;};}function removeEntity(_0x5b1617,_0x572cb4){return function(_0x4a4f72){if(_0x4a4f72){return _0x4a4f72['destroy']()['then'](function(){_0x5b1617[_0x6383('0x1a')](0xcc)[_0x6383('0x1b')]();});}};}function handleEntityNotFound(_0x5d0b4c,_0x62b85b){return function(_0x4d8042){if(!_0x4d8042){_0x5d0b4c[_0x6383('0x19')](0x194);}return _0x4d8042;};}function handleError(_0x56c69e,_0x11cf33){_0x11cf33=_0x11cf33||0x1f4;return function(_0x338451){logger['error'](_0x338451['stack']);if(_0x338451[_0x6383('0x25')]){delete _0x338451['name'];}_0x56c69e['status'](_0x11cf33)[_0x6383('0x26')](_0x338451);};}exports[_0x6383('0x27')]=function(_0x154620,_0xdb55ee){var _0x3ec6f2={},_0x502ebb={},_0x5b5828={'count':0x0,'rows':[]};var _0x211f6c=_[_0x6383('0x28')](db['VoiceQueuesLog']['rawAttributes'],function(_0xd802bb){return{'name':_0xd802bb[_0x6383('0x29')],'type':_0xd802bb[_0x6383('0x2a')]['key']};});_0x502ebb['model']=_[_0x6383('0x28')](_0x211f6c,_0x6383('0x25'));_0x502ebb[_0x6383('0x2b')]=_[_0x6383('0x2c')](_0x154620[_0x6383('0x2b')]);_0x502ebb[_0x6383('0x2d')]=_[_0x6383('0x2e')](_0x502ebb['model'],_0x502ebb[_0x6383('0x2b')]);_0x3ec6f2['attributes']=_[_0x6383('0x2e')](_0x502ebb[_0x6383('0x2f')],qs[_0x6383('0x30')](_0x154620[_0x6383('0x2b')][_0x6383('0x30')]));_0x3ec6f2['attributes']=_0x3ec6f2['attributes']['length']?_0x3ec6f2[_0x6383('0x31')]:_0x502ebb[_0x6383('0x2f')];if(!_0x154620[_0x6383('0x2b')][_0x6383('0x32')]('nolimit')){_0x3ec6f2['limit']=qs[_0x6383('0x33')](_0x154620['query'][_0x6383('0x33')]);_0x3ec6f2[_0x6383('0x1e')]=qs[_0x6383('0x1e')](_0x154620['query'][_0x6383('0x1e')]);}_0x3ec6f2['order']=qs[_0x6383('0x34')](_0x154620[_0x6383('0x2b')][_0x6383('0x34')]);_0x3ec6f2[_0x6383('0x35')]=qs[_0x6383('0x2d')](_[_0x6383('0x36')](_0x154620[_0x6383('0x2b')],_0x502ebb[_0x6383('0x2d')]));if(_0x154620['query']['filter']){_0x3ec6f2[_0x6383('0x35')]=_[_0x6383('0x37')](_0x3ec6f2['where'],{'$or':_[_0x6383('0x28')](_0x211f6c,function(_0x445ed2){if(_0x445ed2[_0x6383('0x2a')]!==_0x6383('0x38')){var _0x2b4745={};_0x2b4745[_0x445ed2['name']]={'$like':'%'+_0x154620['query'][_0x6383('0x39')]+'%'};return _0x2b4745;}})});}_0x3ec6f2=_['merge']({},_0x3ec6f2,_0x154620['options']);var _0x2320fd={'where':_0x3ec6f2['where']};return db[_0x6383('0x3a')]['count'](_0x2320fd)[_0x6383('0x24')](function(_0x19cc0d){_0x5b5828[_0x6383('0x1d')]=_0x19cc0d;if(_0x154620[_0x6383('0x2b')][_0x6383('0x3b')]){_0x3ec6f2[_0x6383('0x3c')]=[{'all':!![]}];}return db[_0x6383('0x3a')]['findAll'](_0x3ec6f2);})[_0x6383('0x24')](function(_0xa9c61f){_0x5b5828[_0x6383('0x3d')]=_0xa9c61f;return _0x5b5828;})[_0x6383('0x24')](respondWithFilteredResult(_0xdb55ee,_0x3ec6f2))[_0x6383('0x3e')](handleError(_0xdb55ee,null));};exports[_0x6383('0x3f')]=function(_0x4a7c9c,_0x3463de){var _0x16bbec={'raw':!![],'where':{'id':_0x4a7c9c[_0x6383('0x40')]['id']}},_0xaf54a6={};_0xaf54a6[_0x6383('0x2f')]=_[_0x6383('0x2c')](db['VoiceQueuesLog'][_0x6383('0x41')]);_0xaf54a6[_0x6383('0x2b')]=_[_0x6383('0x2c')](_0x4a7c9c[_0x6383('0x2b')]);_0xaf54a6[_0x6383('0x2d')]=_[_0x6383('0x2e')](_0xaf54a6[_0x6383('0x2f')],_0xaf54a6[_0x6383('0x2b')]);_0x16bbec[_0x6383('0x31')]=_[_0x6383('0x2e')](_0xaf54a6[_0x6383('0x2f')],qs['fields'](_0x4a7c9c[_0x6383('0x2b')][_0x6383('0x30')]));_0x16bbec[_0x6383('0x31')]=_0x16bbec['attributes'][_0x6383('0x42')]?_0x16bbec['attributes']:_0xaf54a6[_0x6383('0x2f')];if(_0x4a7c9c['query'][_0x6383('0x3b')]){_0x16bbec[_0x6383('0x3c')]=[{'all':!![]}];}_0x16bbec=_['merge']({},_0x16bbec,_0x4a7c9c['options']);return db['VoiceQueuesLog'][_0x6383('0x43')](_0x16bbec)[_0x6383('0x24')](handleEntityNotFound(_0x3463de,null))[_0x6383('0x24')](respondWithResult(_0x3463de,null))['catch'](handleError(_0x3463de,null));};exports[_0x6383('0x44')]=function(_0x569426,_0x540114){return db[_0x6383('0x3a')][_0x6383('0x44')](_0x569426[_0x6383('0x45')],{})[_0x6383('0x24')](respondWithResult(_0x540114,0xc9))[_0x6383('0x3e')](handleError(_0x540114,null));};exports[_0x6383('0x23')]=function(_0x560d4d,_0x21d67b){if(_0x560d4d[_0x6383('0x45')]['id']){delete _0x560d4d['body']['id'];}return db['VoiceQueuesLog'][_0x6383('0x43')]({'where':{'id':_0x560d4d[_0x6383('0x40')]['id']}})[_0x6383('0x24')](handleEntityNotFound(_0x21d67b,null))['then'](saveUpdates(_0x560d4d[_0x6383('0x45')],null))[_0x6383('0x24')](respondWithResult(_0x21d67b,null))[_0x6383('0x3e')](handleError(_0x21d67b,null));};exports['destroy']=function(_0x274750,_0x5dd957){return db[_0x6383('0x3a')][_0x6383('0x43')]({'where':{'id':_0x274750[_0x6383('0x40')]['id']}})[_0x6383('0x24')](handleEntityNotFound(_0x5dd957,null))[_0x6383('0x24')](removeEntity(_0x5dd957,null))['catch'](handleError(_0x5dd957,null));}; \ No newline at end of file +var _0x3f6e=['catch','show','params','find','create','body','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','ejs','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','sendStatus','status','end','json','offset','set','Content-Range','apply','reject','save','update','then','destroy','stack','name','send','index','map','VoiceQueuesLog','rawAttributes','fieldName','type','query','keys','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','limit','order','sort','filters','pick','where','merge','VIRTUAL','options','count','includeAll','include'];(function(_0x5aec68,_0x52d749){var _0x44f628=function(_0x387c0b){while(--_0x387c0b){_0x5aec68['push'](_0x5aec68['shift']());}};_0x44f628(++_0x52d749);}(_0x3f6e,0x98));var _0xe3f6=function(_0x88f701,_0x5ed538){_0x88f701=_0x88f701-0x0;var _0x53bf89=_0x3f6e[_0x88f701];return _0x53bf89;};'use strict';var pdf=require(_0xe3f6('0x0'));var emlformat=require(_0xe3f6('0x1'));var rimraf=require(_0xe3f6('0x2'));var zipdir=require(_0xe3f6('0x3'));var jsonpatch=require(_0xe3f6('0x4'));var rp=require(_0xe3f6('0x5'));var moment=require(_0xe3f6('0x6'));var BPromise=require(_0xe3f6('0x7'));var Mustache=require(_0xe3f6('0x8'));var util=require(_0xe3f6('0x9'));var path=require('path');var sox=require('sox');var csv=require('to-csv');var ejs=require(_0xe3f6('0xa'));var fs=require('fs');var _=require('lodash');var squel=require('squel');var crypto=require(_0xe3f6('0xb'));var jsforce=require(_0xe3f6('0xc'));var deskjs=require(_0xe3f6('0xd'));var toCsv=require(_0xe3f6('0xe'));var querystring=require(_0xe3f6('0xf'));var Papa=require(_0xe3f6('0x10'));var Redis=require(_0xe3f6('0x11'));var authService=require(_0xe3f6('0x12'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xe3f6('0x13'));var logger=require(_0xe3f6('0x14'))(_0xe3f6('0x15'));var utils=require(_0xe3f6('0x16'));var config=require(_0xe3f6('0x17'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x5a2b91,_0x34e648){_0x34e648=_0x34e648||0xcc;return function(_0x4aa5fc){if(_0x4aa5fc){return _0x5a2b91[_0xe3f6('0x18')](_0x34e648);}return _0x5a2b91[_0xe3f6('0x19')](_0x34e648)[_0xe3f6('0x1a')]();};}function respondWithResult(_0x36f8fb,_0x303e77){_0x303e77=_0x303e77||0xc8;return function(_0x3a3bb4){if(_0x3a3bb4){return _0x36f8fb[_0xe3f6('0x19')](_0x303e77)[_0xe3f6('0x1b')](_0x3a3bb4);}};}function respondWithFilteredResult(_0x57eb08,_0x3c0a45){return function(_0xd8ac7){if(_0xd8ac7){var _0x12836b=_0xd8ac7['count'],_0x30a6ef=_0x3c0a45['offset'],_0x50dc4a=_0x3c0a45[_0xe3f6('0x1c')]+_0x3c0a45['limit'],_0x38cfde;if(_0x50dc4a>=_0x12836b){_0x50dc4a=_0x12836b;_0x38cfde=0xc8;}else{_0x38cfde=0xce;}_0x57eb08[_0xe3f6('0x19')](_0x38cfde);return _0x57eb08[_0xe3f6('0x1d')](_0xe3f6('0x1e'),_0x30a6ef+'-'+_0x50dc4a+'/'+_0x12836b)[_0xe3f6('0x1b')](_0xd8ac7);}return null;};}function patchUpdates(_0x245854){return function(_0x69c7f0){try{jsonpatch[_0xe3f6('0x1f')](_0x69c7f0,_0x245854,!![]);}catch(_0x5df868){return BPromise[_0xe3f6('0x20')](_0x5df868);}return _0x69c7f0[_0xe3f6('0x21')]();};}function saveUpdates(_0x391953,_0x114dd4){return function(_0x20a712){if(_0x20a712){return _0x20a712[_0xe3f6('0x22')](_0x391953)[_0xe3f6('0x23')](function(_0x252775){return _0x252775;});}return null;};}function removeEntity(_0x5d00d2,_0x29400d){return function(_0x4decdc){if(_0x4decdc){return _0x4decdc[_0xe3f6('0x24')]()['then'](function(){_0x5d00d2[_0xe3f6('0x19')](0xcc)['end']();});}};}function handleEntityNotFound(_0x40dec8,_0x5f0460){return function(_0x12e107){if(!_0x12e107){_0x40dec8['sendStatus'](0x194);}return _0x12e107;};}function handleError(_0x3c6981,_0x2c0de0){_0x2c0de0=_0x2c0de0||0x1f4;return function(_0x390e59){logger['error'](_0x390e59[_0xe3f6('0x25')]);if(_0x390e59[_0xe3f6('0x26')]){delete _0x390e59[_0xe3f6('0x26')];}_0x3c6981['status'](_0x2c0de0)[_0xe3f6('0x27')](_0x390e59);};}exports[_0xe3f6('0x28')]=function(_0x24e752,_0x5d22c0){var _0x2bdd9e={},_0x1b1cda={},_0x2311e1={'count':0x0,'rows':[]};var _0x241cc2=_[_0xe3f6('0x29')](db[_0xe3f6('0x2a')][_0xe3f6('0x2b')],function(_0x2028f3){return{'name':_0x2028f3[_0xe3f6('0x2c')],'type':_0x2028f3[_0xe3f6('0x2d')]['key']};});_0x1b1cda['model']=_[_0xe3f6('0x29')](_0x241cc2,_0xe3f6('0x26'));_0x1b1cda[_0xe3f6('0x2e')]=_[_0xe3f6('0x2f')](_0x24e752[_0xe3f6('0x2e')]);_0x1b1cda['filters']=_[_0xe3f6('0x30')](_0x1b1cda[_0xe3f6('0x31')],_0x1b1cda['query']);_0x2bdd9e[_0xe3f6('0x32')]=_[_0xe3f6('0x30')](_0x1b1cda[_0xe3f6('0x31')],qs[_0xe3f6('0x33')](_0x24e752['query'][_0xe3f6('0x33')]));_0x2bdd9e[_0xe3f6('0x32')]=_0x2bdd9e['attributes'][_0xe3f6('0x34')]?_0x2bdd9e[_0xe3f6('0x32')]:_0x1b1cda[_0xe3f6('0x31')];if(!_0x24e752[_0xe3f6('0x2e')][_0xe3f6('0x35')](_0xe3f6('0x36'))){_0x2bdd9e[_0xe3f6('0x37')]=qs['limit'](_0x24e752[_0xe3f6('0x2e')][_0xe3f6('0x37')]);_0x2bdd9e['offset']=qs[_0xe3f6('0x1c')](_0x24e752[_0xe3f6('0x2e')][_0xe3f6('0x1c')]);}_0x2bdd9e[_0xe3f6('0x38')]=qs[_0xe3f6('0x39')](_0x24e752['query'][_0xe3f6('0x39')]);_0x2bdd9e['where']=qs[_0xe3f6('0x3a')](_[_0xe3f6('0x3b')](_0x24e752[_0xe3f6('0x2e')],_0x1b1cda['filters']));if(_0x24e752[_0xe3f6('0x2e')]['filter']){_0x2bdd9e[_0xe3f6('0x3c')]=_[_0xe3f6('0x3d')](_0x2bdd9e[_0xe3f6('0x3c')],{'$or':_[_0xe3f6('0x29')](_0x241cc2,function(_0x85b241){if(_0x85b241[_0xe3f6('0x2d')]!==_0xe3f6('0x3e')){var _0x39030f={};_0x39030f[_0x85b241[_0xe3f6('0x26')]]={'$like':'%'+_0x24e752[_0xe3f6('0x2e')]['filter']+'%'};return _0x39030f;}})});}_0x2bdd9e=_[_0xe3f6('0x3d')]({},_0x2bdd9e,_0x24e752[_0xe3f6('0x3f')]);var _0x5dbd57={'where':_0x2bdd9e['where']};return db[_0xe3f6('0x2a')]['count'](_0x5dbd57)[_0xe3f6('0x23')](function(_0x47dca6){_0x2311e1[_0xe3f6('0x40')]=_0x47dca6;if(_0x24e752[_0xe3f6('0x2e')][_0xe3f6('0x41')]){_0x2bdd9e[_0xe3f6('0x42')]=[{'all':!![]}];}return db[_0xe3f6('0x2a')]['findAll'](_0x2bdd9e);})[_0xe3f6('0x23')](function(_0x2922f9){_0x2311e1['rows']=_0x2922f9;return _0x2311e1;})[_0xe3f6('0x23')](respondWithFilteredResult(_0x5d22c0,_0x2bdd9e))[_0xe3f6('0x43')](handleError(_0x5d22c0,null));};exports[_0xe3f6('0x44')]=function(_0x5e88c9,_0xc10ac2){var _0x3108a3={'raw':!![],'where':{'id':_0x5e88c9[_0xe3f6('0x45')]['id']}},_0x41738d={};_0x41738d[_0xe3f6('0x31')]=_[_0xe3f6('0x2f')](db['VoiceQueuesLog'][_0xe3f6('0x2b')]);_0x41738d['query']=_['keys'](_0x5e88c9['query']);_0x41738d['filters']=_[_0xe3f6('0x30')](_0x41738d[_0xe3f6('0x31')],_0x41738d[_0xe3f6('0x2e')]);_0x3108a3[_0xe3f6('0x32')]=_[_0xe3f6('0x30')](_0x41738d[_0xe3f6('0x31')],qs[_0xe3f6('0x33')](_0x5e88c9['query'][_0xe3f6('0x33')]));_0x3108a3[_0xe3f6('0x32')]=_0x3108a3[_0xe3f6('0x32')][_0xe3f6('0x34')]?_0x3108a3[_0xe3f6('0x32')]:_0x41738d[_0xe3f6('0x31')];if(_0x5e88c9[_0xe3f6('0x2e')][_0xe3f6('0x41')]){_0x3108a3[_0xe3f6('0x42')]=[{'all':!![]}];}_0x3108a3=_['merge']({},_0x3108a3,_0x5e88c9[_0xe3f6('0x3f')]);return db[_0xe3f6('0x2a')][_0xe3f6('0x46')](_0x3108a3)[_0xe3f6('0x23')](handleEntityNotFound(_0xc10ac2,null))[_0xe3f6('0x23')](respondWithResult(_0xc10ac2,null))[_0xe3f6('0x43')](handleError(_0xc10ac2,null));};exports[_0xe3f6('0x47')]=function(_0x3490ba,_0x25adbb){return db[_0xe3f6('0x2a')][_0xe3f6('0x47')](_0x3490ba['body'],{})[_0xe3f6('0x23')](respondWithResult(_0x25adbb,0xc9))[_0xe3f6('0x43')](handleError(_0x25adbb,null));};exports[_0xe3f6('0x22')]=function(_0x507295,_0x2e3166){if(_0x507295[_0xe3f6('0x48')]['id']){delete _0x507295[_0xe3f6('0x48')]['id'];}return db['VoiceQueuesLog'][_0xe3f6('0x46')]({'where':{'id':_0x507295['params']['id']}})['then'](handleEntityNotFound(_0x2e3166,null))[_0xe3f6('0x23')](saveUpdates(_0x507295[_0xe3f6('0x48')],null))[_0xe3f6('0x23')](respondWithResult(_0x2e3166,null))[_0xe3f6('0x43')](handleError(_0x2e3166,null));};exports[_0xe3f6('0x24')]=function(_0x3a4e14,_0x44b1b3){return db[_0xe3f6('0x2a')][_0xe3f6('0x46')]({'where':{'id':_0x3a4e14['params']['id']}})['then'](handleEntityNotFound(_0x44b1b3,null))[_0xe3f6('0x23')](removeEntity(_0x44b1b3,null))['catch'](handleError(_0x44b1b3,null));}; \ No newline at end of file diff --git a/server/api/voiceQueuesLog/voiceQueuesLog.model.js b/server/api/voiceQueuesLog/voiceQueuesLog.model.js index b61b1f0..2dff54c 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 _0xfb5e=['voice_queues_log','event_dtm','event','dtm','lodash','util','../../config/logger','moment','request-promise','path','rimraf','../../config/environment','exports','define'];(function(_0x4a9fb1,_0x273043){var _0x348672=function(_0x142b69){while(--_0x142b69){_0x4a9fb1['push'](_0x4a9fb1['shift']());}};_0x348672(++_0x273043);}(_0xfb5e,0x100));var _0xefb5=function(_0x2b4d01,_0x4c6044){_0x2b4d01=_0x2b4d01-0x0;var _0x4195d7=_0xfb5e[_0x2b4d01];return _0x4195d7;};'use strict';var _=require(_0xefb5('0x0'));var util=require(_0xefb5('0x1'));var logger=require(_0xefb5('0x2'))('api');var moment=require(_0xefb5('0x3'));var BPromise=require('bluebird');var rp=require(_0xefb5('0x4'));var fs=require('fs');var path=require(_0xefb5('0x5'));var rimraf=require(_0xefb5('0x6'));var config=require(_0xefb5('0x7'));var attributes=require('./voiceQueuesLog.attributes');module[_0xefb5('0x8')]=function(_0x2ac6e8,_0x2d81de){return _0x2ac6e8[_0xefb5('0x9')]('VoiceQueuesLog',attributes,{'tableName':_0xefb5('0xa'),'paranoid':![],'indexes':[{'name':_0xefb5('0xb'),'fields':[_0xefb5('0xc'),_0xefb5('0xd')]}],'timestamps':![]});}; \ No newline at end of file +var _0x4e2c=['lodash','util','../../config/logger','moment','bluebird','request-promise','path','../../config/environment','./voiceQueuesLog.attributes','exports','define','VoiceQueuesLog','event_dtm','event','dtm'];(function(_0x55c465,_0x56c919){var _0x2c43a0=function(_0x57bf8d){while(--_0x57bf8d){_0x55c465['push'](_0x55c465['shift']());}};_0x2c43a0(++_0x56c919);}(_0x4e2c,0x1d1));var _0xc4e2=function(_0x1cfca1,_0x44d20b){_0x1cfca1=_0x1cfca1-0x0;var _0x5389b6=_0x4e2c[_0x1cfca1];return _0x5389b6;};'use strict';var _=require(_0xc4e2('0x0'));var util=require(_0xc4e2('0x1'));var logger=require(_0xc4e2('0x2'))('api');var moment=require(_0xc4e2('0x3'));var BPromise=require(_0xc4e2('0x4'));var rp=require(_0xc4e2('0x5'));var fs=require('fs');var path=require(_0xc4e2('0x6'));var rimraf=require('rimraf');var config=require(_0xc4e2('0x7'));var attributes=require(_0xc4e2('0x8'));module[_0xc4e2('0x9')]=function(_0x4873ee,_0x3409b6){return _0x4873ee[_0xc4e2('0xa')](_0xc4e2('0xb'),attributes,{'tableName':'voice_queues_log','paranoid':![],'indexes':[{'name':_0xc4e2('0xc'),'fields':[_0xc4e2('0xd'),_0xc4e2('0xe')]}],'timestamps':![]});}; \ No newline at end of file diff --git a/server/api/voiceQueuesLog/voiceQueuesLog.rpc.js b/server/api/voiceQueuesLog/voiceQueuesLog.rpc.js index 358c3dd..2dde848 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 _0xd87e=['stringify','error','code','message','result','catch','lodash','util','bluebird','randomstring','ioredis','../../config/utils','rpc','../../config/environment','client','then','info','VoiceQueuesLog,\x20%s,\x20%s','request\x20sent','debug','VoiceQueuesLog,\x20%s,\x20%s,\x20%s'];(function(_0x5206a7,_0x3c7975){var _0x4cd7ee=function(_0x4ce1a5){while(--_0x4ce1a5){_0x5206a7['push'](_0x5206a7['shift']());}};_0x4cd7ee(++_0x3c7975);}(_0xd87e,0x1bf));var _0xed87=function(_0x3a9dd9,_0x93ae44){_0x3a9dd9=_0x3a9dd9-0x0;var _0x3ff267=_0xd87e[_0x3a9dd9];return _0x3ff267;};'use strict';var _=require(_0xed87('0x0'));var util=require(_0xed87('0x1'));var moment=require('moment');var BPromise=require(_0xed87('0x2'));var rs=require(_0xed87('0x3'));var fs=require('fs');var Redis=require(_0xed87('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0xed87('0x5'));var logger=require('../../config/logger')(_0xed87('0x6'));var config=require(_0xed87('0x7'));var jayson=require('jayson/promise');var client=jayson[_0xed87('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x5da793,_0xa33c67,_0x42fef6){return new BPromise(function(_0x33e1c1,_0x2f348a){return client['request'](_0x5da793,_0x42fef6)[_0xed87('0x9')](function(_0x3dce4b){logger[_0xed87('0xa')](_0xed87('0xb'),_0xa33c67,_0xed87('0xc'));logger[_0xed87('0xd')](_0xed87('0xe'),_0xa33c67,'request\x20sent',JSON[_0xed87('0xf')](_0x3dce4b));if(_0x3dce4b[_0xed87('0x10')]){if(_0x3dce4b['error'][_0xed87('0x11')]===0x1f4){logger[_0xed87('0x10')]('VoiceQueuesLog,\x20%s,\x20%s',_0xa33c67,_0x3dce4b['error'][_0xed87('0x12')]);return _0x2f348a(_0x3dce4b[_0xed87('0x10')][_0xed87('0x12')]);}logger[_0xed87('0x10')](_0xed87('0xb'),_0xa33c67,_0x3dce4b[_0xed87('0x10')]['message']);return _0x33e1c1(_0x3dce4b[_0xed87('0x10')][_0xed87('0x12')]);}else{logger[_0xed87('0xa')](_0xed87('0xb'),_0xa33c67,_0xed87('0xc'));_0x33e1c1(_0x3dce4b[_0xed87('0x13')][_0xed87('0x12')]);}})[_0xed87('0x14')](function(_0x385859){logger['error'](_0xed87('0xb'),_0xa33c67,_0x385859);_0x2f348a(_0x385859);});});} \ No newline at end of file +var _0xb9a7=['request\x20sent','VoiceQueuesLog,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','util','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','VoiceQueuesLog,\x20%s,\x20%s'];(function(_0xbbfe59,_0x46067f){var _0x28a2a4=function(_0xfe230){while(--_0xfe230){_0xbbfe59['push'](_0xbbfe59['shift']());}};_0x28a2a4(++_0x46067f);}(_0xb9a7,0x112));var _0x7b9a=function(_0x8c43de,_0x90ff31){_0x8c43de=_0x8c43de-0x0;var _0xa6591b=_0xb9a7[_0x8c43de];return _0xa6591b;};'use strict';var _=require('lodash');var util=require(_0x7b9a('0x0'));var moment=require('moment');var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x7b9a('0x1'));var db=require('../../mysqldb')['db'];var utils=require(_0x7b9a('0x2'));var logger=require(_0x7b9a('0x3'))(_0x7b9a('0x4'));var config=require(_0x7b9a('0x5'));var jayson=require(_0x7b9a('0x6'));var client=jayson[_0x7b9a('0x7')][_0x7b9a('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x7019fd,_0x37ce81,_0x3e51f0){return new BPromise(function(_0x4d3f20,_0x43d8e2){return client[_0x7b9a('0x9')](_0x7019fd,_0x3e51f0)['then'](function(_0x511e28){logger['info'](_0x7b9a('0xa'),_0x37ce81,_0x7b9a('0xb'));logger['debug'](_0x7b9a('0xc'),_0x37ce81,'request\x20sent',JSON[_0x7b9a('0xd')](_0x511e28));if(_0x511e28['error']){if(_0x511e28[_0x7b9a('0xe')][_0x7b9a('0xf')]===0x1f4){logger[_0x7b9a('0xe')]('VoiceQueuesLog,\x20%s,\x20%s',_0x37ce81,_0x511e28[_0x7b9a('0xe')][_0x7b9a('0x10')]);return _0x43d8e2(_0x511e28['error'][_0x7b9a('0x10')]);}logger[_0x7b9a('0xe')]('VoiceQueuesLog,\x20%s,\x20%s',_0x37ce81,_0x511e28[_0x7b9a('0xe')][_0x7b9a('0x10')]);return _0x4d3f20(_0x511e28[_0x7b9a('0xe')][_0x7b9a('0x10')]);}else{logger[_0x7b9a('0x11')](_0x7b9a('0xa'),_0x37ce81,_0x7b9a('0xb'));_0x4d3f20(_0x511e28[_0x7b9a('0x12')][_0x7b9a('0x10')]);}})['catch'](function(_0x34a82d){logger['error'](_0x7b9a('0xa'),_0x37ce81,_0x34a82d);_0x43d8e2(_0x34a82d);});});} \ No newline at end of file diff --git a/server/api/voiceRecording/index.js b/server/api/voiceRecording/index.js index 73771cd..acd63eb 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 _0x9cf9=['../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceRecording.controller','get','index','/:id','isAuthenticated','show','/:id/download','download','downloads','post','put','update','delete','destroy','multer','util','path','express','Router'];(function(_0x3cdd2f,_0x1c829e){var _0x59892b=function(_0x5ef867){while(--_0x5ef867){_0x3cdd2f['push'](_0x3cdd2f['shift']());}};_0x59892b(++_0x1c829e);}(_0x9cf9,0x1b3));var _0x99cf=function(_0x30f8c9,_0x33a092){_0x30f8c9=_0x30f8c9-0x0;var _0x2942da=_0x9cf9[_0x30f8c9];return _0x2942da;};'use strict';var multer=require(_0x99cf('0x0'));var util=require(_0x99cf('0x1'));var path=require(_0x99cf('0x2'));var timeout=require('connect-timeout');var express=require(_0x99cf('0x3'));var router=express[_0x99cf('0x4')]();var auth=require(_0x99cf('0x5'));var interaction=require(_0x99cf('0x6'));var config=require(_0x99cf('0x7'));var controller=require(_0x99cf('0x8'));router[_0x99cf('0x9')]('/',auth['isAuthenticated'](),controller[_0x99cf('0xa')]);router[_0x99cf('0x9')]('/describe',auth['isAuthenticated'](),controller['describe']);router[_0x99cf('0x9')](_0x99cf('0xb'),auth[_0x99cf('0xc')](),controller[_0x99cf('0xd')]);router[_0x99cf('0x9')](_0x99cf('0xe'),auth[_0x99cf('0xc')](),controller[_0x99cf('0xf')]);router[_0x99cf('0x9')]('/:id/downloads',controller[_0x99cf('0x10')]);router[_0x99cf('0x11')]('/',auth['isAuthenticated'](),controller['create']);router[_0x99cf('0x12')]('/:id',auth[_0x99cf('0xc')](),controller[_0x99cf('0x13')]);router[_0x99cf('0x14')](_0x99cf('0xb'),auth[_0x99cf('0xc')](),controller[_0x99cf('0x15')]);module['exports']=router; \ No newline at end of file +var _0x6ddf=['../../components/interaction/service','./voiceRecording.controller','get','index','describe','/:id/download','isAuthenticated','/:id/downloads','downloads','create','delete','/:id','destroy','exports','multer','util','path','connect-timeout','Router','../../components/auth/service'];(function(_0xf78627,_0xde62cc){var _0x4388cf=function(_0x27c7dd){while(--_0x27c7dd){_0xf78627['push'](_0xf78627['shift']());}};_0x4388cf(++_0xde62cc);}(_0x6ddf,0x1ee));var _0xf6dd=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x6ddf[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require(_0xf6dd('0x0'));var util=require(_0xf6dd('0x1'));var path=require(_0xf6dd('0x2'));var timeout=require(_0xf6dd('0x3'));var express=require('express');var router=express[_0xf6dd('0x4')]();var auth=require(_0xf6dd('0x5'));var interaction=require(_0xf6dd('0x6'));var config=require('../../config/environment');var controller=require(_0xf6dd('0x7'));router[_0xf6dd('0x8')]('/',auth['isAuthenticated'](),controller[_0xf6dd('0x9')]);router['get']('/describe',auth['isAuthenticated'](),controller[_0xf6dd('0xa')]);router[_0xf6dd('0x8')]('/:id',auth['isAuthenticated'](),controller['show']);router[_0xf6dd('0x8')](_0xf6dd('0xb'),auth[_0xf6dd('0xc')](),controller['download']);router['get'](_0xf6dd('0xd'),controller[_0xf6dd('0xe')]);router['post']('/',auth[_0xf6dd('0xc')](),controller[_0xf6dd('0xf')]);router['put']('/:id',auth[_0xf6dd('0xc')](),controller['update']);router[_0xf6dd('0x10')](_0xf6dd('0x11'),auth[_0xf6dd('0xc')](),controller[_0xf6dd('0x12')]);module[_0xf6dd('0x13')]=router; \ No newline at end of file diff --git a/server/api/voiceRecording/voiceRecording.attributes.js b/server/api/voiceRecording/voiceRecording.attributes.js index 010fe24..b99fdcc 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 _0x8c0b=['STRING','channel','setDataValue','INTEGER','DATE','createdAt','toString','format','MM-DD-YYYY\x20HH:mm','sequelize','moment','exports','getDataValue','value'];(function(_0x8583e,_0x1f965c){var _0x1ba58a=function(_0x3a1d5e){while(--_0x3a1d5e){_0x8583e['push'](_0x8583e['shift']());}};_0x1ba58a(++_0x1f965c);}(_0x8c0b,0x167));var _0xb8c0=function(_0x1efddd,_0x3182fb){_0x1efddd=_0x1efddd-0x0;var _0x3a9e9d=_0x8c0b[_0x1efddd];return _0x3a9e9d;};'use strict';var Sequelize=require(_0xb8c0('0x0'));var moment=require(_0xb8c0('0x1'));var path=require('path');module[_0xb8c0('0x2')]={'format':{'type':Sequelize['VIRTUAL'],'get':function(){return this[_0xb8c0('0x3')](_0xb8c0('0x4'))?path['extname'](this[_0xb8c0('0x3')](_0xb8c0('0x4'))):undefined;}},'uniqueid':{'type':Sequelize[_0xb8c0('0x5')]},'channel':{'type':Sequelize['STRING'],'set':function(_0xd1645f){if(_0xd1645f){this['setDataValue'](_0xb8c0('0x6'),_0xd1645f);this[_0xb8c0('0x7')]('membername',_0xd1645f['split'](/\/|-/)[0x1]);}}},'membername':{'type':Sequelize[_0xb8c0('0x5')]},'calleridnum':{'type':Sequelize['STRING']},'calleridname':{'type':Sequelize[_0xb8c0('0x5')]},'connectedlinenum':{'type':Sequelize[_0xb8c0('0x5')]},'connectedlinename':{'type':Sequelize[_0xb8c0('0x5')]},'accountcode':{'type':Sequelize[_0xb8c0('0x5')]},'context':{'type':Sequelize['STRING']},'exten':{'type':Sequelize['STRING']},'value':{'type':Sequelize[_0xb8c0('0x5')]},'type':{'type':Sequelize[_0xb8c0('0x5')]},'rating':{'type':Sequelize[_0xb8c0('0x8')],'validate':{'max':0x5,'min':0x0}},'queue':{'type':Sequelize[_0xb8c0('0x5')]},'userDisposition':{'type':Sequelize[_0xb8c0('0x5')]},'createdAt':{'type':Sequelize[_0xb8c0('0x9')],'get':function(){return moment(this[_0xb8c0('0x3')](_0xb8c0('0xa')))['format']('MM-DD-YYYY\x20HH:mm')[_0xb8c0('0xb')]();}},'updatedAt':{'type':Sequelize[_0xb8c0('0x9')],'get':function(){return moment(this[_0xb8c0('0x3')]('updatedAt'))[_0xb8c0('0xc')](_0xb8c0('0xd'))[_0xb8c0('0xb')]();}}}; \ No newline at end of file +var _0xf090=['channel','split','INTEGER','DATE','createdAt','format','MM-DD-YYYY\x20HH:mm','toString','updatedAt','sequelize','moment','path','getDataValue','extname','value','STRING','setDataValue'];(function(_0x6f5598,_0xabeb74){var _0x1e1325=function(_0x1da246){while(--_0x1da246){_0x6f5598['push'](_0x6f5598['shift']());}};_0x1e1325(++_0xabeb74);}(_0xf090,0xf7));var _0x0f09=function(_0xb66e2d,_0x470df1){_0xb66e2d=_0xb66e2d-0x0;var _0x440050=_0xf090[_0xb66e2d];return _0x440050;};'use strict';var Sequelize=require(_0x0f09('0x0'));var moment=require(_0x0f09('0x1'));var path=require(_0x0f09('0x2'));module['exports']={'format':{'type':Sequelize['VIRTUAL'],'get':function(){return this[_0x0f09('0x3')]('value')?path[_0x0f09('0x4')](this[_0x0f09('0x3')](_0x0f09('0x5'))):undefined;}},'uniqueid':{'type':Sequelize[_0x0f09('0x6')]},'channel':{'type':Sequelize['STRING'],'set':function(_0x643e54){if(_0x643e54){this[_0x0f09('0x7')](_0x0f09('0x8'),_0x643e54);this[_0x0f09('0x7')]('membername',_0x643e54[_0x0f09('0x9')](/\/|-/)[0x1]);}}},'membername':{'type':Sequelize[_0x0f09('0x6')]},'calleridnum':{'type':Sequelize[_0x0f09('0x6')]},'calleridname':{'type':Sequelize[_0x0f09('0x6')]},'connectedlinenum':{'type':Sequelize[_0x0f09('0x6')]},'connectedlinename':{'type':Sequelize['STRING']},'accountcode':{'type':Sequelize[_0x0f09('0x6')]},'context':{'type':Sequelize['STRING']},'exten':{'type':Sequelize[_0x0f09('0x6')]},'value':{'type':Sequelize[_0x0f09('0x6')]},'type':{'type':Sequelize[_0x0f09('0x6')]},'rating':{'type':Sequelize[_0x0f09('0xa')],'validate':{'max':0x5,'min':0x0}},'queue':{'type':Sequelize[_0x0f09('0x6')]},'userDisposition':{'type':Sequelize['STRING']},'createdAt':{'type':Sequelize[_0x0f09('0xb')],'get':function(){return moment(this[_0x0f09('0x3')](_0x0f09('0xc')))[_0x0f09('0xd')](_0x0f09('0xe'))[_0x0f09('0xf')]();}},'updatedAt':{'type':Sequelize['DATE'],'get':function(){return moment(this[_0x0f09('0x3')](_0x0f09('0x10')))['format']('MM-DD-YYYY\x20HH:mm')[_0x0f09('0xf')]();}}}; \ No newline at end of file diff --git a/server/api/voiceRecording/voiceRecording.controller.js b/server/api/voiceRecording/voiceRecording.controller.js index d1d6367..4981921 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 _0xbfb5=['save','update','destroy','error','stack','name','send','index','map','VoiceRecording','rawAttributes','fieldName','type','key','differenceBy','format','query','keys','filters','intersection','model','fields','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','findAll','then','catch','show','attributes','length','includeAll','find','create','body','describe','download','uniqueid','params','value','%s.cypher','existsSync','decryptFile','secrets','recording','Sequelize','ValidationError','VoiceRecording\x20not\x20found','filename','extname','unlink','message','Not\x20found','downloads','../../components/encryptor','sequelize','MD5','col','token','$and','push','Entity\x20not\x20found','info','cancellazione\x20fisica\x20documento\x20%s','isNil','File:\x20\x22','unlinkSync','end','html-pdf','zip-dir','moment','bluebird','path','sox','to-csv','ejs','lodash','squel','crypto','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/environment','sendStatus','status','json','count','offset','limit','Content-Range','apply','reject'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0xbfb5,0x1e3));var _0x5bfb=function(_0x244d45,_0x5bad4b){_0x244d45=_0x244d45-0x0;var _0x5aa4e3=_0xbfb5[_0x244d45];return _0x5aa4e3;};'use strict';var pdf=require(_0x5bfb('0x0'));var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x5bfb('0x1'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x5bfb('0x2'));var BPromise=require(_0x5bfb('0x3'));var Mustache=require('mustache');var util=require('util');var path=require(_0x5bfb('0x4'));var sox=require(_0x5bfb('0x5'));var csv=require(_0x5bfb('0x6'));var ejs=require(_0x5bfb('0x7'));var fs=require('fs');var _=require(_0x5bfb('0x8'));var squel=require(_0x5bfb('0x9'));var crypto=require(_0x5bfb('0xa'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x5bfb('0x6'));var querystring=require(_0x5bfb('0xb'));var Papa=require(_0x5bfb('0xc'));var Redis=require(_0x5bfb('0xd'));var authService=require(_0x5bfb('0xe'));var qs=require(_0x5bfb('0xf'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x5bfb('0x10'));var logger=require('../../config/logger')('api');var utils=require('../../config/utils');var config=require(_0x5bfb('0x11'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x13523d,_0x3e3a96){_0x3e3a96=_0x3e3a96||0xcc;return function(_0x15075b){if(_0x15075b){return _0x13523d[_0x5bfb('0x12')](_0x3e3a96);}return _0x13523d[_0x5bfb('0x13')](_0x3e3a96)['end']();};}function respondWithResult(_0x4bf666,_0x2bcb3e){_0x2bcb3e=_0x2bcb3e||0xc8;return function(_0x251183){if(_0x251183){return _0x4bf666[_0x5bfb('0x13')](_0x2bcb3e)[_0x5bfb('0x14')](_0x251183);}};}function respondWithFilteredResult(_0x385950,_0x206ebf){return function(_0x1b8073){if(_0x1b8073){var _0x138aab=_0x1b8073[_0x5bfb('0x15')],_0x8bbd78=_0x206ebf[_0x5bfb('0x16')],_0x52ce52=_0x206ebf[_0x5bfb('0x16')]+_0x206ebf[_0x5bfb('0x17')],_0x420dbd;if(_0x52ce52>=_0x138aab){_0x52ce52=_0x138aab;_0x420dbd=0xc8;}else{_0x420dbd=0xce;}_0x385950[_0x5bfb('0x13')](_0x420dbd);return _0x385950['set'](_0x5bfb('0x18'),_0x8bbd78+'-'+_0x52ce52+'/'+_0x138aab)[_0x5bfb('0x14')](_0x1b8073);}return null;};}function patchUpdates(_0xb1d3a0){return function(_0x321809){try{jsonpatch[_0x5bfb('0x19')](_0x321809,_0xb1d3a0,!![]);}catch(_0x3fbb55){return BPromise[_0x5bfb('0x1a')](_0x3fbb55);}return _0x321809[_0x5bfb('0x1b')]();};}function saveUpdates(_0x22a1ff,_0x20e269){return function(_0x37e558){if(_0x37e558){return _0x37e558[_0x5bfb('0x1c')](_0x22a1ff)['then'](function(_0x4299d9){return _0x4299d9;});}return null;};}function removeEntity(_0x37a228,_0xf2c8f){return function(_0x132e99){if(_0x132e99){return _0x132e99[_0x5bfb('0x1d')]()['then'](function(){_0x37a228[_0x5bfb('0x13')](0xcc)['end']();});}};}function handleEntityNotFound(_0x309ba7,_0x514056){return function(_0x34109a){if(!_0x34109a){_0x309ba7[_0x5bfb('0x12')](0x194);}return _0x34109a;};}function handleError(_0x311110,_0x170d9f){_0x170d9f=_0x170d9f||0x1f4;return function(_0x5f2192){logger[_0x5bfb('0x1e')](_0x5f2192[_0x5bfb('0x1f')]);if(_0x5f2192[_0x5bfb('0x20')]){delete _0x5f2192[_0x5bfb('0x20')];}_0x311110[_0x5bfb('0x13')](_0x170d9f)[_0x5bfb('0x21')](_0x5f2192);};}exports[_0x5bfb('0x22')]=function(_0x2b6823,_0x5ecb34){var _0x587eda={},_0x7c9ec8={},_0x3396cc={'count':0x0,'rows':[]};var _0x51fb17=_[_0x5bfb('0x23')](db[_0x5bfb('0x24')][_0x5bfb('0x25')],function(_0x5ed6c3){return{'name':_0x5ed6c3[_0x5bfb('0x26')],'type':_0x5ed6c3[_0x5bfb('0x27')][_0x5bfb('0x28')]};});_0x7c9ec8['model']=_[_0x5bfb('0x29')](_['map'](_0x51fb17,_0x5bfb('0x20')),[_0x5bfb('0x2a')]);_0x7c9ec8[_0x5bfb('0x2b')]=_[_0x5bfb('0x2c')](_0x2b6823[_0x5bfb('0x2b')]);_0x7c9ec8[_0x5bfb('0x2d')]=_[_0x5bfb('0x2e')](_0x7c9ec8['model'],_0x7c9ec8[_0x5bfb('0x2b')]);_0x587eda['attributes']=_['intersection'](_0x7c9ec8[_0x5bfb('0x2f')],qs[_0x5bfb('0x30')](_0x2b6823[_0x5bfb('0x2b')][_0x5bfb('0x30')]));_0x587eda['attributes']=_0x587eda['attributes']['length']?_0x587eda['attributes']:_0x7c9ec8[_0x5bfb('0x2f')];if(!_0x2b6823[_0x5bfb('0x2b')][_0x5bfb('0x31')](_0x5bfb('0x32'))){_0x587eda[_0x5bfb('0x17')]=qs['limit'](_0x2b6823[_0x5bfb('0x2b')][_0x5bfb('0x17')]);_0x587eda[_0x5bfb('0x16')]=qs[_0x5bfb('0x16')](_0x2b6823[_0x5bfb('0x2b')][_0x5bfb('0x16')]);}_0x587eda[_0x5bfb('0x33')]=qs[_0x5bfb('0x34')](_0x2b6823[_0x5bfb('0x2b')]['sort']);_0x587eda[_0x5bfb('0x35')]=qs['filters'](_[_0x5bfb('0x36')](_0x2b6823[_0x5bfb('0x2b')],_0x7c9ec8[_0x5bfb('0x2d')]));if(_0x2b6823['query'][_0x5bfb('0x37')]){_0x587eda[_0x5bfb('0x35')]=_[_0x5bfb('0x38')](_0x587eda[_0x5bfb('0x35')],{'$or':_['map'](_0x51fb17,function(_0x3bbe3c){if(_0x3bbe3c[_0x5bfb('0x27')]!==_0x5bfb('0x39')){var _0x2e6e3e={};_0x2e6e3e[_0x3bbe3c[_0x5bfb('0x20')]]={'$like':'%'+_0x2b6823[_0x5bfb('0x2b')][_0x5bfb('0x37')]+'%'};return _0x2e6e3e;}})});}_0x587eda=_['merge']({},_0x587eda,_0x2b6823[_0x5bfb('0x3a')]);var _0x5d223a={'where':_0x587eda[_0x5bfb('0x35')]};return db[_0x5bfb('0x24')][_0x5bfb('0x15')](_0x5d223a)['then'](function(_0x556984){_0x3396cc[_0x5bfb('0x15')]=_0x556984;if(_0x2b6823[_0x5bfb('0x2b')]['includeAll']){_0x587eda['include']=[{'all':!![]}];}return db[_0x5bfb('0x24')][_0x5bfb('0x3b')](_0x587eda);})[_0x5bfb('0x3c')](function(_0x1c3c1e){_0x3396cc['rows']=_0x1c3c1e;return _0x3396cc;})[_0x5bfb('0x3c')](respondWithFilteredResult(_0x5ecb34,_0x587eda))[_0x5bfb('0x3d')](handleError(_0x5ecb34,null));};exports[_0x5bfb('0x3e')]=function(_0x4dd8a4,_0x4beb46){var _0xdbd5c2={'raw':![],'where':{'id':_0x4dd8a4['params']['id']}},_0x294eda={};_0x294eda[_0x5bfb('0x2f')]=_[_0x5bfb('0x2c')](db[_0x5bfb('0x24')][_0x5bfb('0x25')]);_0x294eda[_0x5bfb('0x2b')]=_[_0x5bfb('0x2c')](_0x4dd8a4['query']);_0x294eda[_0x5bfb('0x2d')]=_[_0x5bfb('0x2e')](_0x294eda['model'],_0x294eda[_0x5bfb('0x2b')]);_0xdbd5c2['attributes']=_[_0x5bfb('0x2e')](_0x294eda[_0x5bfb('0x2f')],qs[_0x5bfb('0x30')](_0x4dd8a4[_0x5bfb('0x2b')][_0x5bfb('0x30')]));_0xdbd5c2[_0x5bfb('0x3f')]=_0xdbd5c2[_0x5bfb('0x3f')][_0x5bfb('0x40')]?_0xdbd5c2[_0x5bfb('0x3f')]:_0x294eda[_0x5bfb('0x2f')];if(_0x4dd8a4[_0x5bfb('0x2b')][_0x5bfb('0x41')]){_0xdbd5c2['include']=[{'all':!![]}];}_0xdbd5c2=_[_0x5bfb('0x38')]({},_0xdbd5c2,_0x4dd8a4[_0x5bfb('0x3a')]);return db['VoiceRecording'][_0x5bfb('0x42')](_0xdbd5c2)[_0x5bfb('0x3c')](handleEntityNotFound(_0x4beb46,null))['then'](respondWithResult(_0x4beb46,null))[_0x5bfb('0x3d')](handleError(_0x4beb46,null));};exports[_0x5bfb('0x43')]=function(_0x3ce854,_0x46e58f){return db['VoiceRecording'][_0x5bfb('0x43')](_0x3ce854[_0x5bfb('0x44')],{})[_0x5bfb('0x3c')](respondWithResult(_0x46e58f,0xc9))['catch'](handleError(_0x46e58f,null));};exports[_0x5bfb('0x1c')]=function(_0x50c2dd,_0x425266){if(_0x50c2dd[_0x5bfb('0x44')]['id']){delete _0x50c2dd[_0x5bfb('0x44')]['id'];}return db[_0x5bfb('0x24')][_0x5bfb('0x42')]({'where':{'id':_0x50c2dd['params']['id']}})[_0x5bfb('0x3c')](handleEntityNotFound(_0x425266,null))[_0x5bfb('0x3c')](saveUpdates(_0x50c2dd[_0x5bfb('0x44')],null))[_0x5bfb('0x3c')](respondWithResult(_0x425266,null))[_0x5bfb('0x3d')](handleError(_0x425266,null));};exports[_0x5bfb('0x45')]=function(_0x34a4ca,_0x2320ee){return db['VoiceRecording'][_0x5bfb('0x45')]()[_0x5bfb('0x3c')](respondWithResult(_0x2320ee,null))[_0x5bfb('0x3d')](handleError(_0x2320ee,null));};exports[_0x5bfb('0x46')]=function(_0x3c9b90,_0x158c63,_0x4d4bf8){var _0x45850c=require('../../components/encryptor');var _0x4b096e=![];var _0xcf2351={};if(_0x3c9b90[_0x5bfb('0x2b')][_0x5bfb('0x27')]&&_0x3c9b90[_0x5bfb('0x2b')][_0x5bfb('0x27')]===_0x5bfb('0x47')){_0xcf2351[_0x5bfb('0x47')]=_0x3c9b90[_0x5bfb('0x48')]['id'];}else{_0xcf2351['id']=_0x3c9b90['params']['id'];}return db[_0x5bfb('0x24')][_0x5bfb('0x42')]({'where':_0xcf2351,'attributes':['id',_0x5bfb('0x49')],'raw':!![]})[_0x5bfb('0x3c')](handleEntityNotFound(_0x158c63,null))['then'](function(_0x25e2de){if(_0x25e2de){var _0x699e0d=_0x25e2de['value'];var _0x3a26f0=util['format'](_0x5bfb('0x4a'),_0x699e0d);if(fs[_0x5bfb('0x4b')](_0x3a26f0)){_0x4b096e=!![];return _0x45850c[_0x5bfb('0x4c')](_0x3a26f0,_0x699e0d,config[_0x5bfb('0x4d')][_0x5bfb('0x4e')])[_0x5bfb('0x3c')](function(){return _0x25e2de;});}return _0x25e2de;}})[_0x5bfb('0x3c')](function(_0x2fa143){if(_0x2fa143){var _0x42342f=_0x2fa143['value'];if(!fs[_0x5bfb('0x4b')](_0x42342f)){throw new db[(_0x5bfb('0x4f'))][(_0x5bfb('0x50'))](_0x5bfb('0x51'));}if(_0x2fa143[_0x5bfb('0x52')]){return _0x158c63['download'](_0x42342f,_0x2fa143['filename']+path[_0x5bfb('0x53')](_0x42342f),function(){if(_0x4b096e){fs[_0x5bfb('0x54')](_0x42342f);}});}else{return _0x158c63['download'](_0x42342f,function(_0x5bd990){if(_0x4b096e){fs[_0x5bfb('0x54')](_0x42342f);}});}}})[_0x5bfb('0x3d')](function(_0x51cd0e){if(_0x51cd0e[_0x5bfb('0x55')]==='VoiceRecording\x20not\x20found'){_0x158c63[_0x5bfb('0x13')](0x194)['send'](_0x5bfb('0x56'));}else{return handleError(_0x158c63,null);}});};exports[_0x5bfb('0x57')]=function(_0x19e4d7,_0x25442a,_0x1c1d36){var _0x35a61b=require(_0x5bfb('0x58'));var _0x403697=![];var _0x368e40={'$and':[db[_0x5bfb('0x59')][_0x5bfb('0x35')](db['sequelize']['fn'](_0x5bfb('0x5a'),db['sequelize'][_0x5bfb('0x5b')](_0x5bfb('0x47'))),_0x19e4d7['query'][_0x5bfb('0x5c')])]};if(_0x19e4d7[_0x5bfb('0x2b')][_0x5bfb('0x27')]&&_0x19e4d7['query'][_0x5bfb('0x27')]==='uniqueid'){_0x368e40[_0x5bfb('0x5d')][_0x5bfb('0x5e')]({'uniqueid':_0x19e4d7[_0x5bfb('0x48')]['id']});}else{_0x368e40[_0x5bfb('0x5d')][_0x5bfb('0x5e')]({'id':_0x19e4d7['params']['id']});}return db['VoiceRecording'][_0x5bfb('0x42')]({'where':_0x368e40,'attributes':['id',_0x5bfb('0x49')],'raw':!![]})[_0x5bfb('0x3c')](handleEntityNotFound(_0x25442a,null))['then'](function(_0x3ee55d){if(_0x3ee55d){var _0x3125f0=util[_0x5bfb('0x2a')](_0x5bfb('0x4a'),_0x3ee55d[_0x5bfb('0x49')]);if(fs[_0x5bfb('0x4b')](_0x3125f0)){_0x403697=!![];return _0x35a61b[_0x5bfb('0x4c')](_0x3125f0,_0x3ee55d['value'],config[_0x5bfb('0x4d')][_0x5bfb('0x4e')])[_0x5bfb('0x3c')](function(){return _0x3ee55d;});}return _0x3ee55d;}})['then'](function(_0x4ecbf0){if(_0x4ecbf0){if(!fs['existsSync'](_0x4ecbf0[_0x5bfb('0x49')])){throw new db[(_0x5bfb('0x4f'))][(_0x5bfb('0x50'))](_0x5bfb('0x51'));}if(_0x4ecbf0[_0x5bfb('0x52')]){return _0x25442a['download'](_0x4ecbf0[_0x5bfb('0x49')],_0x4ecbf0[_0x5bfb('0x52')]+path[_0x5bfb('0x53')](_0x4ecbf0[_0x5bfb('0x49')]),function(){if(_0x403697){fs[_0x5bfb('0x54')](_0x4ecbf0[_0x5bfb('0x49')]);}});}else{return _0x25442a[_0x5bfb('0x46')](_0x4ecbf0[_0x5bfb('0x49')],function(_0x1696f5){if(_0x403697){fs[_0x5bfb('0x54')](_0x4ecbf0[_0x5bfb('0x49')]);}});}}})['catch'](handleError(_0x25442a,null));};exports[_0x5bfb('0x1d')]=function(_0x461668,_0x5563aa){return db[_0x5bfb('0x24')]['find']({'where':{'id':_0x461668[_0x5bfb('0x48')]['id']}})[_0x5bfb('0x3c')](function(_0x1cc15c){if(!_0x1cc15c)throw new ReferenceError(_0x5bfb('0x5f'));return _0x1cc15c;})[_0x5bfb('0x3c')](function(_0x3a7810){var _0x5826e5=_0x3a7810[_0x5bfb('0x49')];logger[_0x5bfb('0x60')](_0x5bfb('0x61'),_0x5826e5);if(!_[_0x5bfb('0x62')](_0x3a7810[_0x5bfb('0x49')])&&fs[_0x5bfb('0x4b')](_0x5826e5)){logger[_0x5bfb('0x60')](_0x5bfb('0x63')+_0x5826e5+'\x22\x20trovato\x20eseguo\x20la\x20cancellazione');fs[_0x5bfb('0x64')](_0x5826e5);}_0x5826e5=_0x5826e5+'.cypher';if(!_[_0x5bfb('0x62')](_0x3a7810['value'])&&fs['existsSync'](_0x5826e5)){logger[_0x5bfb('0x60')](_0x5bfb('0x63')+_0x5826e5+'\x22\x20trovato\x20eseguo\x20la\x20cancellazione');fs[_0x5bfb('0x64')](_0x5826e5);}return _0x3a7810;})[_0x5bfb('0x3c')](function(_0x3b0776){if(!_0x3b0776)throw new InternalError();return _0x3b0776[_0x5bfb('0x1d')]();})[_0x5bfb('0x3c')](function(){_0x5563aa['status'](0xcc)[_0x5bfb('0x65')]();})[_0x5bfb('0x3d')](handleError(_0x5563aa,null));}; \ No newline at end of file +var _0xd4a0=['sequelize','MD5','$and','push','recording','Entity\x20not\x20found','File:\x20\x22','\x22\x20trovato\x20eseguo\x20la\x20cancellazione','unlinkSync','.cypher','info','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','count','offset','limit','set','json','apply','save','then','destroy','end','error','name','index','map','rawAttributes','fieldName','type','model','differenceBy','format','query','keys','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','merge','VIRTUAL','filter','VoiceRecording','includeAll','include','findAll','rows','catch','show','create','body','update','find','params','describe','download','../../components/encryptor','uniqueid','value','%s.cypher','existsSync','decryptFile','secrets','Sequelize','ValidationError','VoiceRecording\x20not\x20found','filename','extname','unlink','Not\x20found','downloads'];(function(_0x40aa31,_0x175b59){var _0x393c74=function(_0x119817){while(--_0x119817){_0x40aa31['push'](_0x40aa31['shift']());}};_0x393c74(++_0x175b59);}(_0xd4a0,0x1ab));var _0x0d4a=function(_0x247699,_0x3bcdb1){_0x247699=_0x247699-0x0;var _0x4c9a40=_0xd4a0[_0x247699];return _0x4c9a40;};'use strict';var pdf=require(_0x0d4a('0x0'));var emlformat=require(_0x0d4a('0x1'));var rimraf=require(_0x0d4a('0x2'));var zipdir=require(_0x0d4a('0x3'));var jsonpatch=require(_0x0d4a('0x4'));var rp=require('request-promise');var moment=require(_0x0d4a('0x5'));var BPromise=require(_0x0d4a('0x6'));var Mustache=require(_0x0d4a('0x7'));var util=require(_0x0d4a('0x8'));var path=require(_0x0d4a('0x9'));var sox=require(_0x0d4a('0xa'));var csv=require(_0x0d4a('0xb'));var ejs=require(_0x0d4a('0xc'));var fs=require('fs');var _=require(_0x0d4a('0xd'));var squel=require(_0x0d4a('0xe'));var crypto=require(_0x0d4a('0xf'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x0d4a('0xb'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x0d4a('0x10'));var authService=require(_0x0d4a('0x11'));var qs=require(_0x0d4a('0x12'));var as=require(_0x0d4a('0x13'));var hardwareService=require(_0x0d4a('0x14'));var logger=require(_0x0d4a('0x15'))(_0x0d4a('0x16'));var utils=require(_0x0d4a('0x17'));var config=require(_0x0d4a('0x18'));var db=require(_0x0d4a('0x19'))['db'];function respondWithStatusCode(_0x2ae5bf,_0x371275){_0x371275=_0x371275||0xcc;return function(_0x15e6a0){if(_0x15e6a0){return _0x2ae5bf[_0x0d4a('0x1a')](_0x371275);}return _0x2ae5bf[_0x0d4a('0x1b')](_0x371275)['end']();};}function respondWithResult(_0x3b1351,_0xab0606){_0xab0606=_0xab0606||0xc8;return function(_0x312b70){if(_0x312b70){return _0x3b1351[_0x0d4a('0x1b')](_0xab0606)['json'](_0x312b70);}};}function respondWithFilteredResult(_0x4163b0,_0x12f280){return function(_0x57de21){if(_0x57de21){var _0x56c83f=_0x57de21[_0x0d4a('0x1c')],_0x40267c=_0x12f280['offset'],_0x189df5=_0x12f280[_0x0d4a('0x1d')]+_0x12f280[_0x0d4a('0x1e')],_0x22fb90;if(_0x189df5>=_0x56c83f){_0x189df5=_0x56c83f;_0x22fb90=0xc8;}else{_0x22fb90=0xce;}_0x4163b0['status'](_0x22fb90);return _0x4163b0[_0x0d4a('0x1f')]('Content-Range',_0x40267c+'-'+_0x189df5+'/'+_0x56c83f)[_0x0d4a('0x20')](_0x57de21);}return null;};}function patchUpdates(_0x100a69){return function(_0x119629){try{jsonpatch[_0x0d4a('0x21')](_0x119629,_0x100a69,!![]);}catch(_0x1c49b1){return BPromise['reject'](_0x1c49b1);}return _0x119629[_0x0d4a('0x22')]();};}function saveUpdates(_0x282dec,_0x22612c){return function(_0x28443d){if(_0x28443d){return _0x28443d['update'](_0x282dec)[_0x0d4a('0x23')](function(_0xbb1242){return _0xbb1242;});}return null;};}function removeEntity(_0x1b6441,_0x1902e0){return function(_0x2d6d7d){if(_0x2d6d7d){return _0x2d6d7d[_0x0d4a('0x24')]()[_0x0d4a('0x23')](function(){_0x1b6441[_0x0d4a('0x1b')](0xcc)[_0x0d4a('0x25')]();});}};}function handleEntityNotFound(_0xf47415,_0x452fa2){return function(_0x1de7be){if(!_0x1de7be){_0xf47415[_0x0d4a('0x1a')](0x194);}return _0x1de7be;};}function handleError(_0x373255,_0x35f1a8){_0x35f1a8=_0x35f1a8||0x1f4;return function(_0x43e619){logger[_0x0d4a('0x26')](_0x43e619['stack']);if(_0x43e619[_0x0d4a('0x27')]){delete _0x43e619[_0x0d4a('0x27')];}_0x373255[_0x0d4a('0x1b')](_0x35f1a8)['send'](_0x43e619);};}exports[_0x0d4a('0x28')]=function(_0x171a32,_0x4b61c2){var _0xbd255b={},_0x2d5f70={},_0x4e773={'count':0x0,'rows':[]};var _0x541731=_[_0x0d4a('0x29')](db['VoiceRecording'][_0x0d4a('0x2a')],function(_0x46fcf9){return{'name':_0x46fcf9[_0x0d4a('0x2b')],'type':_0x46fcf9[_0x0d4a('0x2c')]['key']};});_0x2d5f70[_0x0d4a('0x2d')]=_[_0x0d4a('0x2e')](_[_0x0d4a('0x29')](_0x541731,_0x0d4a('0x27')),[_0x0d4a('0x2f')]);_0x2d5f70[_0x0d4a('0x30')]=_[_0x0d4a('0x31')](_0x171a32[_0x0d4a('0x30')]);_0x2d5f70['filters']=_[_0x0d4a('0x32')](_0x2d5f70[_0x0d4a('0x2d')],_0x2d5f70[_0x0d4a('0x30')]);_0xbd255b[_0x0d4a('0x33')]=_['intersection'](_0x2d5f70['model'],qs[_0x0d4a('0x34')](_0x171a32[_0x0d4a('0x30')][_0x0d4a('0x34')]));_0xbd255b[_0x0d4a('0x33')]=_0xbd255b['attributes'][_0x0d4a('0x35')]?_0xbd255b[_0x0d4a('0x33')]:_0x2d5f70['model'];if(!_0x171a32[_0x0d4a('0x30')][_0x0d4a('0x36')](_0x0d4a('0x37'))){_0xbd255b[_0x0d4a('0x1e')]=qs['limit'](_0x171a32[_0x0d4a('0x30')]['limit']);_0xbd255b[_0x0d4a('0x1d')]=qs[_0x0d4a('0x1d')](_0x171a32[_0x0d4a('0x30')][_0x0d4a('0x1d')]);}_0xbd255b[_0x0d4a('0x38')]=qs[_0x0d4a('0x39')](_0x171a32['query'][_0x0d4a('0x39')]);_0xbd255b[_0x0d4a('0x3a')]=qs[_0x0d4a('0x3b')](_[_0x0d4a('0x3c')](_0x171a32[_0x0d4a('0x30')],_0x2d5f70[_0x0d4a('0x3b')]));if(_0x171a32['query']['filter']){_0xbd255b[_0x0d4a('0x3a')]=_[_0x0d4a('0x3d')](_0xbd255b[_0x0d4a('0x3a')],{'$or':_[_0x0d4a('0x29')](_0x541731,function(_0x1a403f){if(_0x1a403f[_0x0d4a('0x2c')]!==_0x0d4a('0x3e')){var _0x3d0d85={};_0x3d0d85[_0x1a403f[_0x0d4a('0x27')]]={'$like':'%'+_0x171a32['query'][_0x0d4a('0x3f')]+'%'};return _0x3d0d85;}})});}_0xbd255b=_[_0x0d4a('0x3d')]({},_0xbd255b,_0x171a32['options']);var _0x5c0ac5={'where':_0xbd255b['where']};return db[_0x0d4a('0x40')][_0x0d4a('0x1c')](_0x5c0ac5)[_0x0d4a('0x23')](function(_0x76c17e){_0x4e773[_0x0d4a('0x1c')]=_0x76c17e;if(_0x171a32[_0x0d4a('0x30')][_0x0d4a('0x41')]){_0xbd255b[_0x0d4a('0x42')]=[{'all':!![]}];}return db[_0x0d4a('0x40')][_0x0d4a('0x43')](_0xbd255b);})[_0x0d4a('0x23')](function(_0x4da175){_0x4e773[_0x0d4a('0x44')]=_0x4da175;return _0x4e773;})[_0x0d4a('0x23')](respondWithFilteredResult(_0x4b61c2,_0xbd255b))[_0x0d4a('0x45')](handleError(_0x4b61c2,null));};exports[_0x0d4a('0x46')]=function(_0xa89394,_0x2122c8){var _0xe59aa6={'raw':![],'where':{'id':_0xa89394['params']['id']}},_0x51436b={};_0x51436b[_0x0d4a('0x2d')]=_[_0x0d4a('0x31')](db[_0x0d4a('0x40')]['rawAttributes']);_0x51436b[_0x0d4a('0x30')]=_[_0x0d4a('0x31')](_0xa89394[_0x0d4a('0x30')]);_0x51436b[_0x0d4a('0x3b')]=_[_0x0d4a('0x32')](_0x51436b[_0x0d4a('0x2d')],_0x51436b[_0x0d4a('0x30')]);_0xe59aa6[_0x0d4a('0x33')]=_[_0x0d4a('0x32')](_0x51436b[_0x0d4a('0x2d')],qs['fields'](_0xa89394[_0x0d4a('0x30')][_0x0d4a('0x34')]));_0xe59aa6[_0x0d4a('0x33')]=_0xe59aa6[_0x0d4a('0x33')][_0x0d4a('0x35')]?_0xe59aa6[_0x0d4a('0x33')]:_0x51436b[_0x0d4a('0x2d')];if(_0xa89394['query'][_0x0d4a('0x41')]){_0xe59aa6['include']=[{'all':!![]}];}_0xe59aa6=_[_0x0d4a('0x3d')]({},_0xe59aa6,_0xa89394['options']);return db[_0x0d4a('0x40')]['find'](_0xe59aa6)['then'](handleEntityNotFound(_0x2122c8,null))[_0x0d4a('0x23')](respondWithResult(_0x2122c8,null))[_0x0d4a('0x45')](handleError(_0x2122c8,null));};exports[_0x0d4a('0x47')]=function(_0x59fb15,_0xa5c744){return db[_0x0d4a('0x40')][_0x0d4a('0x47')](_0x59fb15[_0x0d4a('0x48')],{})['then'](respondWithResult(_0xa5c744,0xc9))[_0x0d4a('0x45')](handleError(_0xa5c744,null));};exports[_0x0d4a('0x49')]=function(_0x5a0556,_0x1030f9){if(_0x5a0556[_0x0d4a('0x48')]['id']){delete _0x5a0556[_0x0d4a('0x48')]['id'];}return db['VoiceRecording'][_0x0d4a('0x4a')]({'where':{'id':_0x5a0556[_0x0d4a('0x4b')]['id']}})[_0x0d4a('0x23')](handleEntityNotFound(_0x1030f9,null))[_0x0d4a('0x23')](saveUpdates(_0x5a0556['body'],null))[_0x0d4a('0x23')](respondWithResult(_0x1030f9,null))[_0x0d4a('0x45')](handleError(_0x1030f9,null));};exports[_0x0d4a('0x4c')]=function(_0x13551a,_0xd675cc){return db[_0x0d4a('0x40')][_0x0d4a('0x4c')]()[_0x0d4a('0x23')](respondWithResult(_0xd675cc,null))[_0x0d4a('0x45')](handleError(_0xd675cc,null));};exports[_0x0d4a('0x4d')]=function(_0x403344,_0x4d19be,_0x1b3130){var _0x57ab43=require(_0x0d4a('0x4e'));var _0xfb810a=![];var _0x4cd802={};if(_0x403344[_0x0d4a('0x30')][_0x0d4a('0x2c')]&&_0x403344['query'][_0x0d4a('0x2c')]===_0x0d4a('0x4f')){_0x4cd802[_0x0d4a('0x4f')]=_0x403344[_0x0d4a('0x4b')]['id'];}else{_0x4cd802['id']=_0x403344[_0x0d4a('0x4b')]['id'];}return db[_0x0d4a('0x40')][_0x0d4a('0x4a')]({'where':_0x4cd802,'attributes':['id',_0x0d4a('0x50')],'raw':!![]})['then'](handleEntityNotFound(_0x4d19be,null))[_0x0d4a('0x23')](function(_0x2407ee){if(_0x2407ee){var _0x3dff0e=_0x2407ee[_0x0d4a('0x50')];var _0x2d38c2=util['format'](_0x0d4a('0x51'),_0x3dff0e);if(fs[_0x0d4a('0x52')](_0x2d38c2)){_0xfb810a=!![];return _0x57ab43[_0x0d4a('0x53')](_0x2d38c2,_0x3dff0e,config[_0x0d4a('0x54')]['recording'])[_0x0d4a('0x23')](function(){return _0x2407ee;});}return _0x2407ee;}})['then'](function(_0x445b19){if(_0x445b19){var _0x5677d8=_0x445b19[_0x0d4a('0x50')];if(!fs[_0x0d4a('0x52')](_0x5677d8)){throw new db[(_0x0d4a('0x55'))][(_0x0d4a('0x56'))](_0x0d4a('0x57'));}if(_0x445b19[_0x0d4a('0x58')]){return _0x4d19be[_0x0d4a('0x4d')](_0x5677d8,_0x445b19['filename']+path[_0x0d4a('0x59')](_0x5677d8),function(){if(_0xfb810a){fs[_0x0d4a('0x5a')](_0x5677d8);}});}else{return _0x4d19be[_0x0d4a('0x4d')](_0x5677d8,function(_0x2cd2a0){if(_0xfb810a){fs[_0x0d4a('0x5a')](_0x5677d8);}});}}})[_0x0d4a('0x45')](function(_0x124cdd){if(_0x124cdd['message']===_0x0d4a('0x57')){_0x4d19be[_0x0d4a('0x1b')](0x194)['send'](_0x0d4a('0x5b'));}else{return handleError(_0x4d19be,null);}});};exports[_0x0d4a('0x5c')]=function(_0x193fa5,_0x516a56,_0x2442e9){var _0x2ac8f6=require(_0x0d4a('0x4e'));var _0x6e1d4e=![];var _0x5b6a39={'$and':[db[_0x0d4a('0x5d')][_0x0d4a('0x3a')](db['sequelize']['fn'](_0x0d4a('0x5e'),db[_0x0d4a('0x5d')]['col'](_0x0d4a('0x4f'))),_0x193fa5['query']['token'])]};if(_0x193fa5['query'][_0x0d4a('0x2c')]&&_0x193fa5['query'][_0x0d4a('0x2c')]===_0x0d4a('0x4f')){_0x5b6a39[_0x0d4a('0x5f')][_0x0d4a('0x60')]({'uniqueid':_0x193fa5[_0x0d4a('0x4b')]['id']});}else{_0x5b6a39[_0x0d4a('0x5f')][_0x0d4a('0x60')]({'id':_0x193fa5[_0x0d4a('0x4b')]['id']});}return db['VoiceRecording'][_0x0d4a('0x4a')]({'where':_0x5b6a39,'attributes':['id','value'],'raw':!![]})['then'](handleEntityNotFound(_0x516a56,null))[_0x0d4a('0x23')](function(_0x17d583){if(_0x17d583){var _0x83d92c=util[_0x0d4a('0x2f')](_0x0d4a('0x51'),_0x17d583[_0x0d4a('0x50')]);if(fs[_0x0d4a('0x52')](_0x83d92c)){_0x6e1d4e=!![];return _0x2ac8f6['decryptFile'](_0x83d92c,_0x17d583[_0x0d4a('0x50')],config[_0x0d4a('0x54')][_0x0d4a('0x61')])[_0x0d4a('0x23')](function(){return _0x17d583;});}return _0x17d583;}})[_0x0d4a('0x23')](function(_0x3e343d){if(_0x3e343d){if(!fs['existsSync'](_0x3e343d[_0x0d4a('0x50')])){throw new db[(_0x0d4a('0x55'))]['ValidationError'](_0x0d4a('0x57'));}if(_0x3e343d['filename']){return _0x516a56['download'](_0x3e343d[_0x0d4a('0x50')],_0x3e343d[_0x0d4a('0x58')]+path[_0x0d4a('0x59')](_0x3e343d[_0x0d4a('0x50')]),function(){if(_0x6e1d4e){fs[_0x0d4a('0x5a')](_0x3e343d['value']);}});}else{return _0x516a56[_0x0d4a('0x4d')](_0x3e343d[_0x0d4a('0x50')],function(_0x2fb6fd){if(_0x6e1d4e){fs[_0x0d4a('0x5a')](_0x3e343d[_0x0d4a('0x50')]);}});}}})[_0x0d4a('0x45')](handleError(_0x516a56,null));};exports[_0x0d4a('0x24')]=function(_0x1fd90d,_0x5a5c04){return db[_0x0d4a('0x40')][_0x0d4a('0x4a')]({'where':{'id':_0x1fd90d[_0x0d4a('0x4b')]['id']}})['then'](function(_0x1d2eb6){if(!_0x1d2eb6)throw new ReferenceError(_0x0d4a('0x62'));return _0x1d2eb6;})[_0x0d4a('0x23')](function(_0x38c186){var _0x923890=_0x38c186['value'];logger['info']('cancellazione\x20fisica\x20documento\x20%s',_0x923890);if(!_['isNil'](_0x38c186['value'])&&fs['existsSync'](_0x923890)){logger['info'](_0x0d4a('0x63')+_0x923890+_0x0d4a('0x64'));fs[_0x0d4a('0x65')](_0x923890);}_0x923890=_0x923890+_0x0d4a('0x66');if(!_['isNil'](_0x38c186['value'])&&fs[_0x0d4a('0x52')](_0x923890)){logger[_0x0d4a('0x67')]('File:\x20\x22'+_0x923890+_0x0d4a('0x64'));fs['unlinkSync'](_0x923890);}return _0x38c186;})['then'](function(_0x51a5b3){if(!_0x51a5b3)throw new InternalError();return _0x51a5b3[_0x0d4a('0x24')]();})[_0x0d4a('0x23')](function(){_0x5a5c04[_0x0d4a('0x1b')](0xcc)[_0x0d4a('0x25')]();})['catch'](handleError(_0x5a5c04,null));}; \ No newline at end of file diff --git a/server/api/voiceRecording/voiceRecording.model.js b/server/api/voiceRecording/voiceRecording.model.js index 0844220..7f7fafd 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 _0x08f5=['define','voice_recordings','uniqueid','lodash','util','../../config/logger','api','bluebird','request-promise','rimraf','../../config/environment','./voiceRecording.attributes'];(function(_0x50e3ac,_0x1149ed){var _0x377ebc=function(_0x2552b9){while(--_0x2552b9){_0x50e3ac['push'](_0x50e3ac['shift']());}};_0x377ebc(++_0x1149ed);}(_0x08f5,0x147));var _0x508f=function(_0x3f6e26,_0x811a34){_0x3f6e26=_0x3f6e26-0x0;var _0x474345=_0x08f5[_0x3f6e26];return _0x474345;};'use strict';var _=require(_0x508f('0x0'));var util=require(_0x508f('0x1'));var logger=require(_0x508f('0x2'))(_0x508f('0x3'));var moment=require('moment');var BPromise=require(_0x508f('0x4'));var rp=require(_0x508f('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x508f('0x6'));var config=require(_0x508f('0x7'));var attributes=require(_0x508f('0x8'));module['exports']=function(_0x442b51,_0x4d3c5f){return _0x442b51[_0x508f('0x9')]('VoiceRecording',attributes,{'tableName':_0x508f('0xa'),'paranoid':![],'indexes':[{'name':_0x508f('0xb'),'fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file +var _0x69cb=['VoiceRecording','voice_recordings','uniqueid','lodash','../../config/logger','api','request-promise','rimraf','../../config/environment','./voiceRecording.attributes','exports','define'];(function(_0x40a045,_0x516f0e){var _0x1a687c=function(_0x48c9fe){while(--_0x48c9fe){_0x40a045['push'](_0x40a045['shift']());}};_0x1a687c(++_0x516f0e);}(_0x69cb,0x9f));var _0xb69c=function(_0x2afb28,_0x19e8b0){_0x2afb28=_0x2afb28-0x0;var _0x41d764=_0x69cb[_0x2afb28];return _0x41d764;};'use strict';var _=require(_0xb69c('0x0'));var util=require('util');var logger=require(_0xb69c('0x1'))(_0xb69c('0x2'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0xb69c('0x3'));var fs=require('fs');var path=require('path');var rimraf=require(_0xb69c('0x4'));var config=require(_0xb69c('0x5'));var attributes=require(_0xb69c('0x6'));module[_0xb69c('0x7')]=function(_0x489192,_0x2de703){return _0x489192[_0xb69c('0x8')](_0xb69c('0x9'),attributes,{'tableName':_0xb69c('0xa'),'paranoid':![],'indexes':[{'name':_0xb69c('0xb'),'fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceRecording/voiceRecording.rpc.js b/server/api/voiceRecording/voiceRecording.rpc.js index 06bf3a7..b8c78b9 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(_0x321d5e,_0x1ae4a9){var _0x3458cd=function(_0x120f19){while(--_0x120f19){_0x321d5e['push'](_0x321d5e['shift']());}};_0x3458cd(++_0x1ae4a9);}(_0xa9e0,0x123));var _0x0a9e=function(_0x5447fd,_0x52a6b5){_0x5447fd=_0x5447fd-0x0;var _0x15b28a=_0xa9e0[_0x5447fd];return _0x15b28a;};'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(_0x1d3d1a,_0x2a3dde){var _0x4bc3ad=function(_0x534345){while(--_0x534345){_0x1d3d1a['push'](_0x1d3d1a['shift']());}};_0x4bc3ad(++_0x2a3dde);}(_0xa9e0,0x123));var _0x0a9e=function(_0x5037ab,_0x43209e){_0x5037ab=_0x5037ab-0x0;var _0x512adb=_0xa9e0[_0x5037ab];return _0x512adb;};'use strict';var _=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var moment=require(_0x0a9e('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x0a9e('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x0a9e('0x4'));var logger=require(_0x0a9e('0x5'))(_0x0a9e('0x6'));var config=require(_0x0a9e('0x7'));var jayson=require(_0x0a9e('0x8'));var client=jayson['client'][_0x0a9e('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x441e3a,_0x2cc193,_0x5f41ea){return new BPromise(function(_0x503809,_0xe42b77){return client['request'](_0x441e3a,_0x5f41ea)['then'](function(_0x39753a){logger[_0x0a9e('0xa')](_0x0a9e('0xb'),_0x2cc193,_0x0a9e('0xc'));logger[_0x0a9e('0xd')](_0x0a9e('0xe'),_0x2cc193,'request\x20sent',JSON['stringify'](_0x39753a));if(_0x39753a['error']){if(_0x39753a['error'][_0x0a9e('0xf')]===0x1f4){logger[_0x0a9e('0x10')](_0x0a9e('0xb'),_0x2cc193,_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);return _0xe42b77(_0x39753a[_0x0a9e('0x10')]['message']);}logger[_0x0a9e('0x10')](_0x0a9e('0xb'),_0x2cc193,_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);return _0x503809(_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);}else{logger['info'](_0x0a9e('0xb'),_0x2cc193,'request\x20sent');_0x503809(_0x39753a[_0x0a9e('0x12')]['message']);}})[_0x0a9e('0x13')](function(_0x12066b){logger['error'](_0x0a9e('0xb'),_0x2cc193,_0x12066b);_0xe42b77(_0x12066b);});});}exports['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 d58904e..caf65d1 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 _0x187d=['update','delete','exports','multer','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','./voiceTransferReport.controller','get','index','/:id','isAuthenticated','show','post','create'];(function(_0x7ae212,_0x1067c8){var _0x4c2f1b=function(_0x2a6bf7){while(--_0x2a6bf7){_0x7ae212['push'](_0x7ae212['shift']());}};_0x4c2f1b(++_0x1067c8);}(_0x187d,0x93));var _0xd187=function(_0x53cf8e,_0x3d290f){_0x53cf8e=_0x53cf8e-0x0;var _0x459197=_0x187d[_0x53cf8e];return _0x459197;};'use strict';var multer=require(_0xd187('0x0'));var util=require('util');var path=require(_0xd187('0x1'));var timeout=require(_0xd187('0x2'));var express=require(_0xd187('0x3'));var router=express[_0xd187('0x4')]();var auth=require(_0xd187('0x5'));var interaction=require(_0xd187('0x6'));var config=require('../../config/environment');var controller=require(_0xd187('0x7'));router[_0xd187('0x8')]('/',auth['isAuthenticated'](),controller[_0xd187('0x9')]);router[_0xd187('0x8')](_0xd187('0xa'),auth[_0xd187('0xb')](),controller[_0xd187('0xc')]);router[_0xd187('0xd')]('/',auth[_0xd187('0xb')](),controller[_0xd187('0xe')]);router['put'](_0xd187('0xa'),auth[_0xd187('0xb')](),controller[_0xd187('0xf')]);router[_0xd187('0x10')](_0xd187('0xa'),auth[_0xd187('0xb')](),controller['destroy']);module[_0xd187('0x11')]=router; \ No newline at end of file +var _0x038b=['update','delete','destroy','exports','util','path','connect-timeout','Router','../../components/interaction/service','../../config/environment','get','isAuthenticated','/:id','show','create','put'];(function(_0xea9b39,_0x1cf0c2){var _0x489ff4=function(_0xe4c0f2){while(--_0xe4c0f2){_0xea9b39['push'](_0xea9b39['shift']());}};_0x489ff4(++_0x1cf0c2);}(_0x038b,0x114));var _0xb038=function(_0x535d0,_0x4500d4){_0x535d0=_0x535d0-0x0;var _0x14f3d9=_0x038b[_0x535d0];return _0x14f3d9;};'use strict';var multer=require('multer');var util=require(_0xb038('0x0'));var path=require(_0xb038('0x1'));var timeout=require(_0xb038('0x2'));var express=require('express');var router=express[_0xb038('0x3')]();var auth=require('../../components/auth/service');var interaction=require(_0xb038('0x4'));var config=require(_0xb038('0x5'));var controller=require('./voiceTransferReport.controller');router[_0xb038('0x6')]('/',auth[_0xb038('0x7')](),controller['index']);router['get'](_0xb038('0x8'),auth[_0xb038('0x7')](),controller[_0xb038('0x9')]);router['post']('/',auth['isAuthenticated'](),controller[_0xb038('0xa')]);router[_0xb038('0xb')]('/:id',auth['isAuthenticated'](),controller[_0xb038('0xc')]);router[_0xb038('0xd')]('/:id',auth[_0xb038('0x7')](),controller[_0xb038('0xe')]);module[_0xb038('0xf')]=router; \ No newline at end of file diff --git a/server/api/voiceTransferReport/voiceTransferReport.attributes.js b/server/api/voiceTransferReport/voiceTransferReport.attributes.js index 4045253..c34a527 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 _0x4fea=['Yes','sequelize','moment','ENUM','blind','attended','STRING'];(function(_0x4da503,_0x124bd3){var _0x26986c=function(_0x109410){while(--_0x109410){_0x4da503['push'](_0x4da503['shift']());}};_0x26986c(++_0x124bd3);}(_0x4fea,0x78));var _0xa4fe=function(_0x415cd3,_0x420d55){_0x415cd3=_0x415cd3-0x0;var _0x3a76f0=_0x4fea[_0x415cd3];return _0x3a76f0;};'use strict';var Sequelize=require(_0xa4fe('0x0'));var moment=require(_0xa4fe('0x1'));module['exports']={'type':{'type':Sequelize[_0xa4fe('0x2')](_0xa4fe('0x3'),_0xa4fe('0x4'))},'result':{'type':Sequelize[_0xa4fe('0x5')]},'transfererchannel':{'type':Sequelize[_0xa4fe('0x5')]},'transferercalleridnum':{'type':Sequelize[_0xa4fe('0x5')]},'transferercalleridname':{'type':Sequelize[_0xa4fe('0x5')]},'transfererconnectedlinenum':{'type':Sequelize['STRING']},'transfererconnectedlinename':{'type':Sequelize[_0xa4fe('0x5')]},'transfereraccountcode':{'type':Sequelize[_0xa4fe('0x5')]},'transferercontext':{'type':Sequelize['STRING']},'transfererexten':{'type':Sequelize[_0xa4fe('0x5')]},'transfererlinkedid':{'type':Sequelize[_0xa4fe('0x5')]},'transfereechannel':{'type':Sequelize[_0xa4fe('0x5')]},'transfereecalleridnum':{'type':Sequelize[_0xa4fe('0x5')]},'transfereecalleridname':{'type':Sequelize[_0xa4fe('0x5')]},'transfereeconnectedlinenum':{'type':Sequelize[_0xa4fe('0x5')]},'transfereeconnectedlinename':{'type':Sequelize[_0xa4fe('0x5')]},'transfereeaccountcode':{'type':Sequelize['STRING']},'transfereecontext':{'type':Sequelize[_0xa4fe('0x5')]},'transfereeexten':{'type':Sequelize[_0xa4fe('0x5')]},'transfereelinkedid':{'type':Sequelize[_0xa4fe('0x5')]},'isexternal':{'type':Sequelize[_0xa4fe('0x2')](_0xa4fe('0x6'),'No')},'context':{'type':Sequelize[_0xa4fe('0x5')]},'extension':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x38f3=['blind','attended','STRING','Yes','sequelize','ENUM'];(function(_0x1f36bb,_0x8af718){var _0xaf97fa=function(_0xeca489){while(--_0xeca489){_0x1f36bb['push'](_0x1f36bb['shift']());}};_0xaf97fa(++_0x8af718);}(_0x38f3,0xd6));var _0x338f=function(_0x21b706,_0x1022f4){_0x21b706=_0x21b706-0x0;var _0x13b94a=_0x38f3[_0x21b706];return _0x13b94a;};'use strict';var Sequelize=require(_0x338f('0x0'));var moment=require('moment');module['exports']={'type':{'type':Sequelize[_0x338f('0x1')](_0x338f('0x2'),_0x338f('0x3'))},'result':{'type':Sequelize[_0x338f('0x4')]},'transfererchannel':{'type':Sequelize[_0x338f('0x4')]},'transferercalleridnum':{'type':Sequelize['STRING']},'transferercalleridname':{'type':Sequelize[_0x338f('0x4')]},'transfererconnectedlinenum':{'type':Sequelize[_0x338f('0x4')]},'transfererconnectedlinename':{'type':Sequelize[_0x338f('0x4')]},'transfereraccountcode':{'type':Sequelize[_0x338f('0x4')]},'transferercontext':{'type':Sequelize['STRING']},'transfererexten':{'type':Sequelize[_0x338f('0x4')]},'transfererlinkedid':{'type':Sequelize['STRING']},'transfereechannel':{'type':Sequelize['STRING']},'transfereecalleridnum':{'type':Sequelize[_0x338f('0x4')]},'transfereecalleridname':{'type':Sequelize['STRING']},'transfereeconnectedlinenum':{'type':Sequelize[_0x338f('0x4')]},'transfereeconnectedlinename':{'type':Sequelize[_0x338f('0x4')]},'transfereeaccountcode':{'type':Sequelize[_0x338f('0x4')]},'transfereecontext':{'type':Sequelize[_0x338f('0x4')]},'transfereeexten':{'type':Sequelize[_0x338f('0x4')]},'transfereelinkedid':{'type':Sequelize['STRING']},'isexternal':{'type':Sequelize[_0x338f('0x1')](_0x338f('0x5'),'No')},'context':{'type':Sequelize[_0x338f('0x4')]},'extension':{'type':Sequelize[_0x338f('0x4')]}}; \ No newline at end of file diff --git a/server/api/voiceTransferReport/voiceTransferReport.controller.js b/server/api/voiceTransferReport/voiceTransferReport.controller.js index 9629fc9..360d1b3 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 _0xd8b0=['key','query','keys','intersection','fields','attributes','length','model','nolimit','order','sort','where','filters','filter','VIRTUAL','merge','VoiceTransferReport','count','includeAll','include','findAll','catch','show','params','options','create','body','find','destroy','html-pdf','eml-format','request-promise','moment','bluebird','mustache','util','to-csv','ejs','lodash','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/environment','../../mysqldb','sendStatus','status','end','json','offset','limit','set','Content-Range','apply','reject','save','update','then','error','stack','name','send','index','map','rawAttributes','fieldName'];(function(_0x14e7f2,_0x4bdd32){var _0x4979a0=function(_0x3e8770){while(--_0x3e8770){_0x14e7f2['push'](_0x14e7f2['shift']());}};_0x4979a0(++_0x4bdd32);}(_0xd8b0,0xad));var _0x0d8b=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xd8b0[_0x20a584];return _0x4b41a8;};'use strict';var pdf=require(_0x0d8b('0x0'));var emlformat=require(_0x0d8b('0x1'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x0d8b('0x2'));var moment=require(_0x0d8b('0x3'));var BPromise=require(_0x0d8b('0x4'));var Mustache=require(_0x0d8b('0x5'));var util=require(_0x0d8b('0x6'));var path=require('path');var sox=require('sox');var csv=require(_0x0d8b('0x7'));var ejs=require(_0x0d8b('0x8'));var fs=require('fs');var _=require(_0x0d8b('0x9'));var squel=require('squel');var crypto=require(_0x0d8b('0xa'));var jsforce=require(_0x0d8b('0xb'));var deskjs=require('desk.js');var toCsv=require(_0x0d8b('0x7'));var querystring=require(_0x0d8b('0xc'));var Papa=require(_0x0d8b('0xd'));var Redis=require(_0x0d8b('0xe'));var authService=require(_0x0d8b('0xf'));var qs=require(_0x0d8b('0x10'));var as=require(_0x0d8b('0x11'));var hardwareService=require(_0x0d8b('0x12'));var logger=require('../../config/logger')(_0x0d8b('0x13'));var utils=require('../../config/utils');var config=require(_0x0d8b('0x14'));var db=require(_0x0d8b('0x15'))['db'];function respondWithStatusCode(_0x340cc4,_0x92cdd8){_0x92cdd8=_0x92cdd8||0xcc;return function(_0x35a07b){if(_0x35a07b){return _0x340cc4[_0x0d8b('0x16')](_0x92cdd8);}return _0x340cc4[_0x0d8b('0x17')](_0x92cdd8)[_0x0d8b('0x18')]();};}function respondWithResult(_0x1d4bbc,_0x2ce75e){_0x2ce75e=_0x2ce75e||0xc8;return function(_0x5ad086){if(_0x5ad086){return _0x1d4bbc[_0x0d8b('0x17')](_0x2ce75e)[_0x0d8b('0x19')](_0x5ad086);}};}function respondWithFilteredResult(_0x2d4e1c,_0x4f6f21){return function(_0x23eb7b){if(_0x23eb7b){var _0xa86349=_0x23eb7b['count'],_0x17f7df=_0x4f6f21[_0x0d8b('0x1a')],_0xe2e167=_0x4f6f21[_0x0d8b('0x1a')]+_0x4f6f21[_0x0d8b('0x1b')],_0x2cb03c;if(_0xe2e167>=_0xa86349){_0xe2e167=_0xa86349;_0x2cb03c=0xc8;}else{_0x2cb03c=0xce;}_0x2d4e1c[_0x0d8b('0x17')](_0x2cb03c);return _0x2d4e1c[_0x0d8b('0x1c')](_0x0d8b('0x1d'),_0x17f7df+'-'+_0xe2e167+'/'+_0xa86349)[_0x0d8b('0x19')](_0x23eb7b);}return null;};}function patchUpdates(_0xa3612a){return function(_0x4a15bf){try{jsonpatch[_0x0d8b('0x1e')](_0x4a15bf,_0xa3612a,!![]);}catch(_0x23d58f){return BPromise[_0x0d8b('0x1f')](_0x23d58f);}return _0x4a15bf[_0x0d8b('0x20')]();};}function saveUpdates(_0x24e8ed,_0x5b709c){return function(_0x393beb){if(_0x393beb){return _0x393beb[_0x0d8b('0x21')](_0x24e8ed)['then'](function(_0x4f0a1a){return _0x4f0a1a;});}return null;};}function removeEntity(_0x33fb87,_0x54a9a7){return function(_0x56c729){if(_0x56c729){return _0x56c729['destroy']()[_0x0d8b('0x22')](function(){_0x33fb87[_0x0d8b('0x17')](0xcc)[_0x0d8b('0x18')]();});}};}function handleEntityNotFound(_0x38efc8,_0x221071){return function(_0x2c64e2){if(!_0x2c64e2){_0x38efc8[_0x0d8b('0x16')](0x194);}return _0x2c64e2;};}function handleError(_0x4562cb,_0x27b695){_0x27b695=_0x27b695||0x1f4;return function(_0x5e5bc3){logger[_0x0d8b('0x23')](_0x5e5bc3[_0x0d8b('0x24')]);if(_0x5e5bc3['name']){delete _0x5e5bc3[_0x0d8b('0x25')];}_0x4562cb['status'](_0x27b695)[_0x0d8b('0x26')](_0x5e5bc3);};}exports[_0x0d8b('0x27')]=function(_0xa2af02,_0x4fe6f9){var _0x59a905={},_0x28f639={},_0x3ef745={'count':0x0,'rows':[]};var _0x4c05ee=_[_0x0d8b('0x28')](db['VoiceTransferReport'][_0x0d8b('0x29')],function(_0x4b59e5){return{'name':_0x4b59e5[_0x0d8b('0x2a')],'type':_0x4b59e5['type'][_0x0d8b('0x2b')]};});_0x28f639['model']=_[_0x0d8b('0x28')](_0x4c05ee,'name');_0x28f639[_0x0d8b('0x2c')]=_[_0x0d8b('0x2d')](_0xa2af02[_0x0d8b('0x2c')]);_0x28f639['filters']=_['intersection'](_0x28f639['model'],_0x28f639[_0x0d8b('0x2c')]);_0x59a905['attributes']=_[_0x0d8b('0x2e')](_0x28f639['model'],qs['fields'](_0xa2af02[_0x0d8b('0x2c')][_0x0d8b('0x2f')]));_0x59a905[_0x0d8b('0x30')]=_0x59a905[_0x0d8b('0x30')][_0x0d8b('0x31')]?_0x59a905[_0x0d8b('0x30')]:_0x28f639[_0x0d8b('0x32')];if(!_0xa2af02[_0x0d8b('0x2c')]['hasOwnProperty'](_0x0d8b('0x33'))){_0x59a905[_0x0d8b('0x1b')]=qs['limit'](_0xa2af02[_0x0d8b('0x2c')][_0x0d8b('0x1b')]);_0x59a905[_0x0d8b('0x1a')]=qs['offset'](_0xa2af02[_0x0d8b('0x2c')][_0x0d8b('0x1a')]);}_0x59a905[_0x0d8b('0x34')]=qs[_0x0d8b('0x35')](_0xa2af02[_0x0d8b('0x2c')]['sort']);_0x59a905[_0x0d8b('0x36')]=qs[_0x0d8b('0x37')](_['pick'](_0xa2af02[_0x0d8b('0x2c')],_0x28f639[_0x0d8b('0x37')]));if(_0xa2af02[_0x0d8b('0x2c')][_0x0d8b('0x38')]){_0x59a905[_0x0d8b('0x36')]=_['merge'](_0x59a905['where'],{'$or':_[_0x0d8b('0x28')](_0x4c05ee,function(_0x5c2c04){if(_0x5c2c04['type']!==_0x0d8b('0x39')){var _0x2e279c={};_0x2e279c[_0x5c2c04[_0x0d8b('0x25')]]={'$like':'%'+_0xa2af02[_0x0d8b('0x2c')][_0x0d8b('0x38')]+'%'};return _0x2e279c;}})});}_0x59a905=_[_0x0d8b('0x3a')]({},_0x59a905,_0xa2af02['options']);var _0x6e5bab={'where':_0x59a905[_0x0d8b('0x36')]};return db[_0x0d8b('0x3b')][_0x0d8b('0x3c')](_0x6e5bab)[_0x0d8b('0x22')](function(_0x1a39ad){_0x3ef745[_0x0d8b('0x3c')]=_0x1a39ad;if(_0xa2af02['query'][_0x0d8b('0x3d')]){_0x59a905[_0x0d8b('0x3e')]=[{'all':!![]}];}return db[_0x0d8b('0x3b')][_0x0d8b('0x3f')](_0x59a905);})['then'](function(_0xe0bf42){_0x3ef745['rows']=_0xe0bf42;return _0x3ef745;})[_0x0d8b('0x22')](respondWithFilteredResult(_0x4fe6f9,_0x59a905))[_0x0d8b('0x40')](handleError(_0x4fe6f9,null));};exports[_0x0d8b('0x41')]=function(_0x26ac10,_0x35fa7e){var _0x3e632e={'raw':!![],'where':{'id':_0x26ac10[_0x0d8b('0x42')]['id']}},_0x1ff17d={};_0x1ff17d[_0x0d8b('0x32')]=_[_0x0d8b('0x2d')](db['VoiceTransferReport']['rawAttributes']);_0x1ff17d['query']=_['keys'](_0x26ac10['query']);_0x1ff17d[_0x0d8b('0x37')]=_[_0x0d8b('0x2e')](_0x1ff17d[_0x0d8b('0x32')],_0x1ff17d['query']);_0x3e632e['attributes']=_[_0x0d8b('0x2e')](_0x1ff17d[_0x0d8b('0x32')],qs[_0x0d8b('0x2f')](_0x26ac10['query'][_0x0d8b('0x2f')]));_0x3e632e[_0x0d8b('0x30')]=_0x3e632e['attributes']['length']?_0x3e632e[_0x0d8b('0x30')]:_0x1ff17d['model'];if(_0x26ac10[_0x0d8b('0x2c')]['includeAll']){_0x3e632e['include']=[{'all':!![]}];}_0x3e632e=_[_0x0d8b('0x3a')]({},_0x3e632e,_0x26ac10[_0x0d8b('0x43')]);return db['VoiceTransferReport']['find'](_0x3e632e)['then'](handleEntityNotFound(_0x35fa7e,null))['then'](respondWithResult(_0x35fa7e,null))[_0x0d8b('0x40')](handleError(_0x35fa7e,null));};exports[_0x0d8b('0x44')]=function(_0xd9d4c3,_0x490eda){return db[_0x0d8b('0x3b')][_0x0d8b('0x44')](_0xd9d4c3[_0x0d8b('0x45')],{})[_0x0d8b('0x22')](respondWithResult(_0x490eda,0xc9))[_0x0d8b('0x40')](handleError(_0x490eda,null));};exports[_0x0d8b('0x21')]=function(_0x11d22b,_0x1d5067){if(_0x11d22b[_0x0d8b('0x45')]['id']){delete _0x11d22b[_0x0d8b('0x45')]['id'];}return db[_0x0d8b('0x3b')][_0x0d8b('0x46')]({'where':{'id':_0x11d22b[_0x0d8b('0x42')]['id']}})[_0x0d8b('0x22')](handleEntityNotFound(_0x1d5067,null))[_0x0d8b('0x22')](saveUpdates(_0x11d22b[_0x0d8b('0x45')],null))[_0x0d8b('0x22')](respondWithResult(_0x1d5067,null))[_0x0d8b('0x40')](handleError(_0x1d5067,null));};exports[_0x0d8b('0x47')]=function(_0x574b90,_0x371fa0){return db['VoiceTransferReport']['find']({'where':{'id':_0x574b90[_0x0d8b('0x42')]['id']}})[_0x0d8b('0x22')](handleEntityNotFound(_0x371fa0,null))[_0x0d8b('0x22')](removeEntity(_0x371fa0,null))[_0x0d8b('0x40')](handleError(_0x371fa0,null));}; \ No newline at end of file +var _0xcb91=['order','sort','filters','pick','filter','where','merge','options','includeAll','include','findAll','params','find','catch','create','body','update','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','path','sox','ejs','lodash','crypto','jsforce','to-csv','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../mysqldb','status','end','json','count','offset','limit','apply','reject','save','then','destroy','sendStatus','error','stack','name','send','map','VoiceTransferReport','rawAttributes','type','model','query','keys','intersection','attributes','fields','length','hasOwnProperty','nolimit'];(function(_0x53087a,_0x3eff0a){var _0x35bc12=function(_0x573a83){while(--_0x573a83){_0x53087a['push'](_0x53087a['shift']());}};_0x35bc12(++_0x3eff0a);}(_0xcb91,0x1a9));var _0x1cb9=function(_0x236c89,_0xd76ba9){_0x236c89=_0x236c89-0x0;var _0x3b2a15=_0xcb91[_0x236c89];return _0x3b2a15;};'use strict';var pdf=require('html-pdf');var emlformat=require('eml-format');var rimraf=require(_0x1cb9('0x0'));var zipdir=require(_0x1cb9('0x1'));var jsonpatch=require(_0x1cb9('0x2'));var rp=require(_0x1cb9('0x3'));var moment=require('moment');var BPromise=require(_0x1cb9('0x4'));var Mustache=require(_0x1cb9('0x5'));var util=require('util');var path=require(_0x1cb9('0x6'));var sox=require(_0x1cb9('0x7'));var csv=require('to-csv');var ejs=require(_0x1cb9('0x8'));var fs=require('fs');var _=require(_0x1cb9('0x9'));var squel=require('squel');var crypto=require(_0x1cb9('0xa'));var jsforce=require(_0x1cb9('0xb'));var deskjs=require('desk.js');var toCsv=require(_0x1cb9('0xc'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x1cb9('0xd'));var authService=require(_0x1cb9('0xe'));var qs=require(_0x1cb9('0xf'));var as=require(_0x1cb9('0x10'));var hardwareService=require(_0x1cb9('0x11'));var logger=require('../../config/logger')(_0x1cb9('0x12'));var utils=require(_0x1cb9('0x13'));var config=require(_0x1cb9('0x14'));var db=require(_0x1cb9('0x15'))['db'];function respondWithStatusCode(_0x46af58,_0x5445e1){_0x5445e1=_0x5445e1||0xcc;return function(_0x5e3c19){if(_0x5e3c19){return _0x46af58['sendStatus'](_0x5445e1);}return _0x46af58[_0x1cb9('0x16')](_0x5445e1)[_0x1cb9('0x17')]();};}function respondWithResult(_0x384496,_0x1c714f){_0x1c714f=_0x1c714f||0xc8;return function(_0x56884d){if(_0x56884d){return _0x384496[_0x1cb9('0x16')](_0x1c714f)[_0x1cb9('0x18')](_0x56884d);}};}function respondWithFilteredResult(_0x1b3cd7,_0x8dfa55){return function(_0x3e2d11){if(_0x3e2d11){var _0x5806d8=_0x3e2d11[_0x1cb9('0x19')],_0x5572cb=_0x8dfa55[_0x1cb9('0x1a')],_0xd446a3=_0x8dfa55[_0x1cb9('0x1a')]+_0x8dfa55[_0x1cb9('0x1b')],_0x3cc765;if(_0xd446a3>=_0x5806d8){_0xd446a3=_0x5806d8;_0x3cc765=0xc8;}else{_0x3cc765=0xce;}_0x1b3cd7[_0x1cb9('0x16')](_0x3cc765);return _0x1b3cd7['set']('Content-Range',_0x5572cb+'-'+_0xd446a3+'/'+_0x5806d8)[_0x1cb9('0x18')](_0x3e2d11);}return null;};}function patchUpdates(_0x41ac41){return function(_0x2b2669){try{jsonpatch[_0x1cb9('0x1c')](_0x2b2669,_0x41ac41,!![]);}catch(_0x280a84){return BPromise[_0x1cb9('0x1d')](_0x280a84);}return _0x2b2669[_0x1cb9('0x1e')]();};}function saveUpdates(_0x4ac422,_0x559bcc){return function(_0x1a5a72){if(_0x1a5a72){return _0x1a5a72['update'](_0x4ac422)[_0x1cb9('0x1f')](function(_0x2265ea){return _0x2265ea;});}return null;};}function removeEntity(_0x523b26,_0x599275){return function(_0x2e3854){if(_0x2e3854){return _0x2e3854[_0x1cb9('0x20')]()[_0x1cb9('0x1f')](function(){_0x523b26[_0x1cb9('0x16')](0xcc)[_0x1cb9('0x17')]();});}};}function handleEntityNotFound(_0x27db16,_0x59ebea){return function(_0x55b232){if(!_0x55b232){_0x27db16[_0x1cb9('0x21')](0x194);}return _0x55b232;};}function handleError(_0x557199,_0x10a419){_0x10a419=_0x10a419||0x1f4;return function(_0x2b1275){logger[_0x1cb9('0x22')](_0x2b1275[_0x1cb9('0x23')]);if(_0x2b1275[_0x1cb9('0x24')]){delete _0x2b1275['name'];}_0x557199[_0x1cb9('0x16')](_0x10a419)[_0x1cb9('0x25')](_0x2b1275);};}exports['index']=function(_0xd6891c,_0x21effa){var _0x41a9a0={},_0x1804fd={},_0x406821={'count':0x0,'rows':[]};var _0x21d6f5=_[_0x1cb9('0x26')](db[_0x1cb9('0x27')][_0x1cb9('0x28')],function(_0x9de64b){return{'name':_0x9de64b['fieldName'],'type':_0x9de64b[_0x1cb9('0x29')]['key']};});_0x1804fd[_0x1cb9('0x2a')]=_['map'](_0x21d6f5,_0x1cb9('0x24'));_0x1804fd[_0x1cb9('0x2b')]=_[_0x1cb9('0x2c')](_0xd6891c[_0x1cb9('0x2b')]);_0x1804fd['filters']=_[_0x1cb9('0x2d')](_0x1804fd['model'],_0x1804fd[_0x1cb9('0x2b')]);_0x41a9a0[_0x1cb9('0x2e')]=_[_0x1cb9('0x2d')](_0x1804fd['model'],qs[_0x1cb9('0x2f')](_0xd6891c['query'][_0x1cb9('0x2f')]));_0x41a9a0['attributes']=_0x41a9a0[_0x1cb9('0x2e')][_0x1cb9('0x30')]?_0x41a9a0[_0x1cb9('0x2e')]:_0x1804fd[_0x1cb9('0x2a')];if(!_0xd6891c['query'][_0x1cb9('0x31')](_0x1cb9('0x32'))){_0x41a9a0[_0x1cb9('0x1b')]=qs[_0x1cb9('0x1b')](_0xd6891c[_0x1cb9('0x2b')][_0x1cb9('0x1b')]);_0x41a9a0[_0x1cb9('0x1a')]=qs[_0x1cb9('0x1a')](_0xd6891c[_0x1cb9('0x2b')][_0x1cb9('0x1a')]);}_0x41a9a0[_0x1cb9('0x33')]=qs[_0x1cb9('0x34')](_0xd6891c[_0x1cb9('0x2b')]['sort']);_0x41a9a0['where']=qs[_0x1cb9('0x35')](_[_0x1cb9('0x36')](_0xd6891c[_0x1cb9('0x2b')],_0x1804fd[_0x1cb9('0x35')]));if(_0xd6891c[_0x1cb9('0x2b')][_0x1cb9('0x37')]){_0x41a9a0[_0x1cb9('0x38')]=_[_0x1cb9('0x39')](_0x41a9a0['where'],{'$or':_[_0x1cb9('0x26')](_0x21d6f5,function(_0x1482c4){if(_0x1482c4[_0x1cb9('0x29')]!=='VIRTUAL'){var _0x2a5aac={};_0x2a5aac[_0x1482c4['name']]={'$like':'%'+_0xd6891c[_0x1cb9('0x2b')]['filter']+'%'};return _0x2a5aac;}})});}_0x41a9a0=_[_0x1cb9('0x39')]({},_0x41a9a0,_0xd6891c[_0x1cb9('0x3a')]);var _0x289b73={'where':_0x41a9a0[_0x1cb9('0x38')]};return db[_0x1cb9('0x27')][_0x1cb9('0x19')](_0x289b73)[_0x1cb9('0x1f')](function(_0x4a4788){_0x406821['count']=_0x4a4788;if(_0xd6891c[_0x1cb9('0x2b')][_0x1cb9('0x3b')]){_0x41a9a0[_0x1cb9('0x3c')]=[{'all':!![]}];}return db[_0x1cb9('0x27')][_0x1cb9('0x3d')](_0x41a9a0);})[_0x1cb9('0x1f')](function(_0x32130b){_0x406821['rows']=_0x32130b;return _0x406821;})[_0x1cb9('0x1f')](respondWithFilteredResult(_0x21effa,_0x41a9a0))['catch'](handleError(_0x21effa,null));};exports['show']=function(_0x4c6c75,_0x409c62){var _0x397ff9={'raw':!![],'where':{'id':_0x4c6c75[_0x1cb9('0x3e')]['id']}},_0x1bf51c={};_0x1bf51c[_0x1cb9('0x2a')]=_['keys'](db[_0x1cb9('0x27')]['rawAttributes']);_0x1bf51c[_0x1cb9('0x2b')]=_[_0x1cb9('0x2c')](_0x4c6c75[_0x1cb9('0x2b')]);_0x1bf51c['filters']=_[_0x1cb9('0x2d')](_0x1bf51c['model'],_0x1bf51c[_0x1cb9('0x2b')]);_0x397ff9[_0x1cb9('0x2e')]=_['intersection'](_0x1bf51c['model'],qs[_0x1cb9('0x2f')](_0x4c6c75[_0x1cb9('0x2b')][_0x1cb9('0x2f')]));_0x397ff9[_0x1cb9('0x2e')]=_0x397ff9[_0x1cb9('0x2e')]['length']?_0x397ff9[_0x1cb9('0x2e')]:_0x1bf51c['model'];if(_0x4c6c75['query']['includeAll']){_0x397ff9[_0x1cb9('0x3c')]=[{'all':!![]}];}_0x397ff9=_[_0x1cb9('0x39')]({},_0x397ff9,_0x4c6c75[_0x1cb9('0x3a')]);return db[_0x1cb9('0x27')][_0x1cb9('0x3f')](_0x397ff9)[_0x1cb9('0x1f')](handleEntityNotFound(_0x409c62,null))[_0x1cb9('0x1f')](respondWithResult(_0x409c62,null))[_0x1cb9('0x40')](handleError(_0x409c62,null));};exports[_0x1cb9('0x41')]=function(_0x148a01,_0x3ea88c){return db['VoiceTransferReport'][_0x1cb9('0x41')](_0x148a01[_0x1cb9('0x42')],{})[_0x1cb9('0x1f')](respondWithResult(_0x3ea88c,0xc9))['catch'](handleError(_0x3ea88c,null));};exports[_0x1cb9('0x43')]=function(_0x57251,_0x3c6044){if(_0x57251[_0x1cb9('0x42')]['id']){delete _0x57251[_0x1cb9('0x42')]['id'];}return db['VoiceTransferReport'][_0x1cb9('0x3f')]({'where':{'id':_0x57251['params']['id']}})[_0x1cb9('0x1f')](handleEntityNotFound(_0x3c6044,null))['then'](saveUpdates(_0x57251[_0x1cb9('0x42')],null))[_0x1cb9('0x1f')](respondWithResult(_0x3c6044,null))[_0x1cb9('0x40')](handleError(_0x3c6044,null));};exports[_0x1cb9('0x20')]=function(_0x56d0c5,_0x298475){return db[_0x1cb9('0x27')][_0x1cb9('0x3f')]({'where':{'id':_0x56d0c5[_0x1cb9('0x3e')]['id']}})[_0x1cb9('0x1f')](handleEntityNotFound(_0x298475,null))[_0x1cb9('0x1f')](removeEntity(_0x298475,null))[_0x1cb9('0x40')](handleError(_0x298475,null));}; \ No newline at end of file diff --git a/server/api/voiceTransferReport/voiceTransferReport.model.js b/server/api/voiceTransferReport/voiceTransferReport.model.js index eee1f20..15daccf 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 _0x98e5=['lodash','util','bluebird','request-promise','path','rimraf','define','VoiceTransferReport','report_call_transfer'];(function(_0x169a55,_0x26315c){var _0x27b1fb=function(_0x532e76){while(--_0x532e76){_0x169a55['push'](_0x169a55['shift']());}};_0x27b1fb(++_0x26315c);}(_0x98e5,0x1d4));var _0x598e=function(_0x29a7ac,_0x24f67c){_0x29a7ac=_0x29a7ac-0x0;var _0xb96e99=_0x98e5[_0x29a7ac];return _0xb96e99;};'use strict';var _=require(_0x598e('0x0'));var util=require(_0x598e('0x1'));var logger=require('../../config/logger')('api');var moment=require('moment');var BPromise=require(_0x598e('0x2'));var rp=require(_0x598e('0x3'));var fs=require('fs');var path=require(_0x598e('0x4'));var rimraf=require(_0x598e('0x5'));var config=require('../../config/environment');var attributes=require('./voiceTransferReport.attributes');module['exports']=function(_0x1eca74,_0x510923){return _0x1eca74[_0x598e('0x6')](_0x598e('0x7'),attributes,{'tableName':_0x598e('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x27c2=['../../config/environment','exports','define','VoiceTransferReport','report_call_transfer','lodash','util','../../config/logger','api','moment','bluebird','rimraf'];(function(_0x311666,_0x17b07d){var _0x2bc692=function(_0x200073){while(--_0x200073){_0x311666['push'](_0x311666['shift']());}};_0x2bc692(++_0x17b07d);}(_0x27c2,0x71));var _0x227c=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x27c2[_0x14add3];return _0x4a174f;};'use strict';var _=require(_0x227c('0x0'));var util=require(_0x227c('0x1'));var logger=require(_0x227c('0x2'))(_0x227c('0x3'));var moment=require(_0x227c('0x4'));var BPromise=require(_0x227c('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x227c('0x6'));var config=require(_0x227c('0x7'));var attributes=require('./voiceTransferReport.attributes');module[_0x227c('0x8')]=function(_0x19dd08,_0x3dcb55){return _0x19dd08[_0x227c('0x9')](_0x227c('0xa'),attributes,{'tableName':_0x227c('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 2786b75..aba57ae 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 _0x9289=['CreateVoiceTransferReport','VoiceTransferReport','create','body','raw','stringify','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','rpc','jayson/promise','client','http','then','VoiceTransferReport,\x20%s,\x20%s','request\x20sent','debug','VoiceTransferReport,\x20%s,\x20%s,\x20%s','error','code','message','info','result','catch'];(function(_0x14d6f3,_0x1dcb11){var _0x421177=function(_0x4e622f){while(--_0x4e622f){_0x14d6f3['push'](_0x14d6f3['shift']());}};_0x421177(++_0x1dcb11);}(_0x9289,0x11e));var _0x9928=function(_0x20d72d,_0x584475){_0x20d72d=_0x20d72d-0x0;var _0x2ccf04=_0x9289[_0x20d72d];return _0x2ccf04;};'use strict';var _=require(_0x9928('0x0'));var util=require(_0x9928('0x1'));var moment=require(_0x9928('0x2'));var BPromise=require(_0x9928('0x3'));var rs=require(_0x9928('0x4'));var fs=require('fs');var Redis=require(_0x9928('0x5'));var db=require(_0x9928('0x6'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x9928('0x7'));var config=require('../../config/environment');var jayson=require(_0x9928('0x8'));var client=jayson[_0x9928('0x9')][_0x9928('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x2ec03c,_0x4ddaba,_0x1ab3f4){return new BPromise(function(_0x42667c,_0x2e22a3){return client['request'](_0x2ec03c,_0x1ab3f4)[_0x9928('0xb')](function(_0x283d0b){logger['info'](_0x9928('0xc'),_0x4ddaba,_0x9928('0xd'));logger[_0x9928('0xe')](_0x9928('0xf'),_0x4ddaba,_0x9928('0xd'),JSON['stringify'](_0x283d0b));if(_0x283d0b[_0x9928('0x10')]){if(_0x283d0b[_0x9928('0x10')][_0x9928('0x11')]===0x1f4){logger['error'](_0x9928('0xc'),_0x4ddaba,_0x283d0b[_0x9928('0x10')][_0x9928('0x12')]);return _0x2e22a3(_0x283d0b[_0x9928('0x10')][_0x9928('0x12')]);}logger['error']('VoiceTransferReport,\x20%s,\x20%s',_0x4ddaba,_0x283d0b['error'][_0x9928('0x12')]);return _0x42667c(_0x283d0b[_0x9928('0x10')]['message']);}else{logger[_0x9928('0x13')](_0x9928('0xc'),_0x4ddaba,'request\x20sent');_0x42667c(_0x283d0b[_0x9928('0x14')][_0x9928('0x12')]);}})[_0x9928('0x15')](function(_0x5e1705){logger[_0x9928('0x10')]('VoiceTransferReport,\x20%s,\x20%s',_0x4ddaba,_0x5e1705);_0x2e22a3(_0x5e1705);});});}exports[_0x9928('0x16')]=function(_0x30b3ef){var _0x345a4f=this;return new Promise(function(_0x38f771,_0xc261ce){return db[_0x9928('0x17')][_0x9928('0x18')](_0x30b3ef[_0x9928('0x19')],{'raw':_0x30b3ef['options']?_0x30b3ef['options'][_0x9928('0x1a')]===undefined?!![]:![]:!![]})['then'](function(_0x34ac98){logger[_0x9928('0x13')](_0x9928('0x16'),_0x30b3ef);logger[_0x9928('0xe')]('CreateVoiceTransferReport',_0x30b3ef,JSON[_0x9928('0x1b')](_0x34ac98));_0x38f771(_0x34ac98);})[_0x9928('0x15')](function(_0x1cbfef){logger['error'](_0x9928('0x16'),_0x1cbfef['message'],_0x30b3ef);_0xc261ce(_0x345a4f['error'](0x1f4,_0x1cbfef['message']));});});}; \ No newline at end of file +var _0xdb14=['../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','then','info','VoiceTransferReport,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','CreateVoiceTransferReport','create','body','options','util','moment','randomstring','ioredis','../../mysqldb'];(function(_0x1cd47d,_0x55bc75){var _0x29d52f=function(_0x37737a){while(--_0x37737a){_0x1cd47d['push'](_0x1cd47d['shift']());}};_0x29d52f(++_0x55bc75);}(_0xdb14,0xb1));var _0x4db1=function(_0x28053f,_0x291883){_0x28053f=_0x28053f-0x0;var _0x1da07a=_0xdb14[_0x28053f];return _0x1da07a;};'use strict';var _=require('lodash');var util=require(_0x4db1('0x0'));var moment=require(_0x4db1('0x1'));var BPromise=require('bluebird');var rs=require(_0x4db1('0x2'));var fs=require('fs');var Redis=require(_0x4db1('0x3'));var db=require(_0x4db1('0x4'))['db'];var utils=require(_0x4db1('0x5'));var logger=require(_0x4db1('0x6'))(_0x4db1('0x7'));var config=require(_0x4db1('0x8'));var jayson=require(_0x4db1('0x9'));var client=jayson[_0x4db1('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x5a44e5,_0x4f6312,_0x20651d){return new BPromise(function(_0xb208a8,_0x394deb){return client[_0x4db1('0xb')](_0x5a44e5,_0x20651d)[_0x4db1('0xc')](function(_0x4ce001){logger[_0x4db1('0xd')](_0x4db1('0xe'),_0x4f6312,_0x4db1('0xf'));logger[_0x4db1('0x10')]('VoiceTransferReport,\x20%s,\x20%s,\x20%s',_0x4f6312,_0x4db1('0xf'),JSON[_0x4db1('0x11')](_0x4ce001));if(_0x4ce001[_0x4db1('0x12')]){if(_0x4ce001[_0x4db1('0x12')][_0x4db1('0x13')]===0x1f4){logger[_0x4db1('0x12')](_0x4db1('0xe'),_0x4f6312,_0x4ce001[_0x4db1('0x12')][_0x4db1('0x14')]);return _0x394deb(_0x4ce001[_0x4db1('0x12')][_0x4db1('0x14')]);}logger[_0x4db1('0x12')]('VoiceTransferReport,\x20%s,\x20%s',_0x4f6312,_0x4ce001[_0x4db1('0x12')][_0x4db1('0x14')]);return _0xb208a8(_0x4ce001[_0x4db1('0x12')][_0x4db1('0x14')]);}else{logger['info'](_0x4db1('0xe'),_0x4f6312,'request\x20sent');_0xb208a8(_0x4ce001[_0x4db1('0x15')]['message']);}})['catch'](function(_0x263554){logger['error']('VoiceTransferReport,\x20%s,\x20%s',_0x4f6312,_0x263554);_0x394deb(_0x263554);});});}exports[_0x4db1('0x16')]=function(_0x552a6c){var _0x557025=this;return new Promise(function(_0x10a5b5,_0x5762ae){return db['VoiceTransferReport'][_0x4db1('0x17')](_0x552a6c[_0x4db1('0x18')],{'raw':_0x552a6c[_0x4db1('0x19')]?_0x552a6c[_0x4db1('0x19')]['raw']===undefined?!![]:![]:!![]})[_0x4db1('0xc')](function(_0x384404){logger['info'](_0x4db1('0x16'),_0x552a6c);logger['debug']('CreateVoiceTransferReport',_0x552a6c,JSON[_0x4db1('0x11')](_0x384404));_0x10a5b5(_0x384404);})['catch'](function(_0x48cb2c){logger[_0x4db1('0x12')](_0x4db1('0x16'),_0x48cb2c[_0x4db1('0x14')],_0x552a6c);_0x5762ae(_0x557025[_0x4db1('0x12')](0x1f4,_0x48cb2c[_0x4db1('0x14')]));});});}; \ No newline at end of file diff --git a/server/api/webbar/index.js b/server/api/webbar/index.js index a77019c..43491e1 100644 --- a/server/api/webbar/index.js +++ b/server/api/webbar/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x94dc=['exports','express','../../components/auth/service','post','/originate','isAuthenticated','originate','/hangup','canUpdate','hangup','answer','/hold','hold','/unhold','/calls','transfer'];(function(_0x65ff6c,_0x4c2da3){var _0x238215=function(_0x485ddf){while(--_0x485ddf){_0x65ff6c['push'](_0x65ff6c['shift']());}};_0x238215(++_0x4c2da3);}(_0x94dc,0xb1));var _0xc94d=function(_0x2a00c3,_0x3912a8){_0x2a00c3=_0x2a00c3-0x0;var _0x30825c=_0x94dc[_0x2a00c3];return _0x30825c;};'use strict';var express=require(_0xc94d('0x0'));var router=express['Router']();var auth=require(_0xc94d('0x1'));var controller=require('./webbar.controller');router[_0xc94d('0x2')](_0xc94d('0x3'),auth[_0xc94d('0x4')](),auth['canUpdate'](),controller[_0xc94d('0x5')]);router[_0xc94d('0x2')](_0xc94d('0x6'),auth[_0xc94d('0x4')](),auth[_0xc94d('0x7')](),controller[_0xc94d('0x8')]);router[_0xc94d('0x2')]('/answer',auth[_0xc94d('0x4')](),auth[_0xc94d('0x7')](),controller[_0xc94d('0x9')]);router[_0xc94d('0x2')](_0xc94d('0xa'),auth['isAuthenticated'](),auth[_0xc94d('0x7')](),controller[_0xc94d('0xb')]);router[_0xc94d('0x2')](_0xc94d('0xc'),auth[_0xc94d('0x4')](),auth[_0xc94d('0x7')](),controller['unhold']);router[_0xc94d('0x2')](_0xc94d('0xd'),auth[_0xc94d('0x4')](),auth[_0xc94d('0x7')](),controller['calls']);router['post']('/transfer',auth[_0xc94d('0x4')](),auth[_0xc94d('0x7')](),controller[_0xc94d('0xe')]);module[_0xc94d('0xf')]=router; \ No newline at end of file +var _0x8b04=['./webbar.controller','/originate','isAuthenticated','canUpdate','originate','post','/hangup','hangup','answer','/hold','/unhold','unhold','/calls','calls','/transfer','transfer','express','Router'];(function(_0x2b40bc,_0x186d20){var _0x108c6c=function(_0x173961){while(--_0x173961){_0x2b40bc['push'](_0x2b40bc['shift']());}};_0x108c6c(++_0x186d20);}(_0x8b04,0x130));var _0x48b0=function(_0x5099ee,_0x331450){_0x5099ee=_0x5099ee-0x0;var _0x5e72b9=_0x8b04[_0x5099ee];return _0x5e72b9;};'use strict';var express=require(_0x48b0('0x0'));var router=express[_0x48b0('0x1')]();var auth=require('../../components/auth/service');var controller=require(_0x48b0('0x2'));router['post'](_0x48b0('0x3'),auth[_0x48b0('0x4')](),auth[_0x48b0('0x5')](),controller[_0x48b0('0x6')]);router[_0x48b0('0x7')](_0x48b0('0x8'),auth[_0x48b0('0x4')](),auth[_0x48b0('0x5')](),controller[_0x48b0('0x9')]);router[_0x48b0('0x7')]('/answer',auth[_0x48b0('0x4')](),auth[_0x48b0('0x5')](),controller[_0x48b0('0xa')]);router[_0x48b0('0x7')](_0x48b0('0xb'),auth[_0x48b0('0x4')](),auth[_0x48b0('0x5')](),controller['hold']);router[_0x48b0('0x7')](_0x48b0('0xc'),auth['isAuthenticated'](),auth[_0x48b0('0x5')](),controller[_0x48b0('0xd')]);router['post'](_0x48b0('0xe'),auth[_0x48b0('0x4')](),auth[_0x48b0('0x5')](),controller[_0x48b0('0xf')]);router[_0x48b0('0x7')](_0x48b0('0x10'),auth[_0x48b0('0x4')](),auth['canUpdate'](),controller[_0x48b0('0x11')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/webbar/webbar.controller.js b/server/api/webbar/webbar.controller.js index 80fc86b..5a6070e 100644 --- a/server/api/webbar/webbar.controller.js +++ b/server/api/webbar/webbar.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x39e0=['transferNumber','webbar:transfer','transfer\x20executed!','../../mysqldb','util','bluebird','jayson/promise','client','../../config/logger','webbarapi','ioredis','defaults','redis','localhost','socket.io-emitter','validate','number','userId\x20is\x20required','string','info','log','handleError:','error','name','status','request','then','message','result','User','agent','all','filter','UserId','sessionId','length','sessionId\x20','\x20not\x20found!','originate','originate\x20fired:','body','json','callNumber','callerId','callbackUrl','entityFound:','format','user:%s','webbar:originate','catch','hangup','hangup\x20fired:','userId','hangup\x20executed!','answer','answer\x20fired:','webbar:answer','answer\x20executed!','hold','hold\x20fired:','webbar:hold','hold\x20executed!','unhold','unhold\x20fired:','webbar:unhold','unhold\x20executed!','calls\x20fired:','VoiceChannels','rows','conference','conference\x20fired:','webbar:conference','conference\x20executed!','transfer','transfer\x20fired:'];(function(_0x5cc710,_0x21f7ab){var _0x15ccb1=function(_0x23a346){while(--_0x23a346){_0x5cc710['push'](_0x5cc710['shift']());}};_0x15ccb1(++_0x21f7ab);}(_0x39e0,0x1c5));var _0x039e=function(_0x2e03bd,_0x4f9d0e){_0x2e03bd=_0x2e03bd-0x0;var _0x3cb242=_0x39e0[_0x2e03bd];return _0x3cb242;};'use strict';var path=require('path');var fs=require('fs');var _=require('lodash');var db=require(_0x039e('0x0'))['db'];var config=require('../../config/environment');var util=require(_0x039e('0x1'));var BPromise=require(_0x039e('0x2'));var jayson=require(_0x039e('0x3'));var amiClient=jayson[_0x039e('0x4')]['http']({'port':0x232a});var logger=require(_0x039e('0x5'))(_0x039e('0x6'));var Redis=require(_0x039e('0x7'));config['redis']=_[_0x039e('0x8')](config[_0x039e('0x9')],{'host':_0x039e('0xa'),'port':0x18eb});var io=require(_0x039e('0xb'))(new Redis(config[_0x039e('0x9')]));var Schema=require(_0x039e('0xc'));var originateValidation=new Schema({'userId':{'type':_0x039e('0xd'),'required':[!![],_0x039e('0xe')]},'callNumber':{'type':_0x039e('0xf'),'required':[!![],'callNumber\x20is\x20required']},'callerId':{'type':_0x039e('0xf')},'callbackUrl':{'type':_0x039e('0xf')}});var hangupValidation=new Schema({'userId':{'type':_0x039e('0xd'),'required':[!![],_0x039e('0xe')]},'sessionId':{'type':_0x039e('0xf'),'required':![]}});var answerValidation=new Schema({'userId':{'type':_0x039e('0xd'),'required':[!![],'userId\x20is\x20required']},'sessionId':{'type':_0x039e('0xf'),'required':![]}});var transferValidation=new Schema({'userId':{'type':_0x039e('0xd'),'required':[!![],_0x039e('0xe')]},'sessionId':{'type':_0x039e('0xf'),'required':[!![],'sessionId\x20is\x20required']},'transferNumber':{'type':_0x039e('0xf'),'required':[!![],'transferNumber\x20is\x20required']}});var holdValidation=new Schema({'userId':{'type':'number','required':[!![],_0x039e('0xe')]},'sessionId':{'type':_0x039e('0xf'),'required':![]}});var unholdValidation=new Schema({'userId':{'type':_0x039e('0xd'),'required':[!![],_0x039e('0xe')]},'sessionId':{'type':_0x039e('0xf'),'required':![]}});var callsValidation=new Schema({'userId':{'type':'number','required':[!![],'userId\x20is\x20required']}});var conferenceValidation=new Schema({'userId':{'type':_0x039e('0xd'),'required':[!![],_0x039e('0xe')]}});function emit(_0x72fbba,_0x207084,_0x599cf2){logger[_0x039e('0x10')](_0x72fbba,_0x207084,JSON['stringify'](_0x599cf2));io['to'](_0x72fbba)['emit'](_0x207084,_0x599cf2);}function handleError(_0x281728){return function(_0x3b47dd){console[_0x039e('0x11')](_0x039e('0x12'),_0x3b47dd,_0x3b47dd instanceof RangeError);logger[_0x039e('0x13')](_0x3b47dd['stack']);if(_0x3b47dd instanceof RangeError){if(_0x3b47dd['name']){delete _0x3b47dd[_0x039e('0x14')];}_0x281728[_0x039e('0x15')](0x194)['send'](_0x3b47dd);}else{if(_0x3b47dd['name']){delete _0x3b47dd[_0x039e('0x14')];}_0x281728['status'](0x1f4)['send'](_0x3b47dd);}};}function checkError(){return function(_0x4c3192){if(!_0x4c3192){throw new RangeError('NotFound');}return _0x4c3192;};}function respondWithRpcPromise(_0x195839,_0x5932f0){return new BPromise(function(_0x57f81a,_0x4c3e9c){var _0xd9b437=amiClient;return _0xd9b437[_0x039e('0x16')](_0x195839,_0x5932f0)[_0x039e('0x17')](function(_0x3cfe3f){if(_0x3cfe3f['error']){if(_0x3cfe3f['error']['code']===0x1f4){return _0x4c3e9c(_0x3cfe3f[_0x039e('0x13')][_0x039e('0x18')]);}return _0x57f81a(_0x3cfe3f[_0x039e('0x13')][_0x039e('0x18')]);}else{_0x57f81a(_0x3cfe3f[_0x039e('0x19')]);}})['catch'](function(_0x5b32f3){_0x4c3e9c(_0x5b32f3);});});}function getAgent(_0x38c019){return db[_0x039e('0x1a')]['findOne']({'where':{'id':_0x38c019,'role':_0x039e('0x1b')}})[_0x039e('0x17')](checkError());}function getAgentCheckSession(_0x48dc9f,_0x1d323a){return new BPromise(function(_0x11f21a,_0xd623ae){var _0x506f4d=respondWithRpcPromise('VoiceChannels');var _0x574364=getAgent(_0x48dc9f);Promise[_0x039e('0x1c')]([_0x506f4d,_0x574364])['then'](function(_0x215506){var _0x2986b2=_0x215506[0x0];var _0x1c1910=_0x215506[0x1];var _0x452207=_[_0x039e('0x1d')](_0x2986b2['rows'],function(_0xba9c4c){return _0xba9c4c[_0x039e('0x1e')]==_0x1c1910['id']&&_0xba9c4c[_0x039e('0x1f')]==_0x1d323a;});if(_0x452207[_0x039e('0x20')]==0x1){_0x11f21a(_0x1c1910);}else{_0xd623ae(new RangeError(_0x039e('0x21')+_0x1d323a+_0x039e('0x22')));}});});}exports[_0x039e('0x23')]=function(_0x44c9ff,_0x4e7719){logger[_0x039e('0x10')](_0x039e('0x24'),_0x44c9ff['body']);var _0x25425e=originateValidation[_0x039e('0xc')](_0x44c9ff[_0x039e('0x25')]);if(_0x25425e[_0x039e('0x20')]>0x0){return _0x4e7719[_0x039e('0x15')](0x190)[_0x039e('0x26')](_0x25425e);}var _0x67303f=_0x44c9ff[_0x039e('0x25')]['userId'];var _0x274a20=_0x44c9ff[_0x039e('0x25')][_0x039e('0x27')];var _0x5b15f1=_0x44c9ff[_0x039e('0x25')][_0x039e('0x28')];var _0x4ece8e=_0x44c9ff[_0x039e('0x25')][_0x039e('0x29')];return getAgent(_0x67303f)[_0x039e('0x17')](function(_0x441c16){logger['info'](_0x039e('0x2a'),_0x441c16[_0x039e('0x14')]);emit(util[_0x039e('0x2b')](_0x039e('0x2c'),_0x441c16['name']),_0x039e('0x2d'),{'callNumber':_0x274a20,'callerId':_0x5b15f1,'callbackUrl':_0x4ece8e});return _0x4e7719[_0x039e('0x15')](0xc8)['json']({'error':![],'message':'originate\x20executed!'});})[_0x039e('0x2e')](handleError(_0x4e7719));};exports[_0x039e('0x2f')]=function(_0x4061c6,_0x11de92){logger[_0x039e('0x10')](_0x039e('0x30'),_0x4061c6[_0x039e('0x25')]);var _0x13c5af=hangupValidation['validate'](_0x4061c6[_0x039e('0x25')]);if(_0x13c5af[_0x039e('0x20')]>0x0){return _0x11de92[_0x039e('0x15')](0x190)[_0x039e('0x26')](_0x13c5af);}var _0x258763=_0x4061c6[_0x039e('0x25')][_0x039e('0x31')];var _0x587035=_0x4061c6[_0x039e('0x25')][_0x039e('0x1f')];return getAgent(_0x258763)[_0x039e('0x17')](function(_0x56ecb5){logger['info'](_0x039e('0x2a'),_0x56ecb5[_0x039e('0x14')]);emit(util[_0x039e('0x2b')]('user:%s',_0x56ecb5['name']),'webbar:hangup',{'sessionId':_0x587035});return _0x11de92[_0x039e('0x15')](0xc8)[_0x039e('0x26')]({'error':![],'message':_0x039e('0x32')});})[_0x039e('0x2e')](handleError(_0x11de92));};exports[_0x039e('0x33')]=function(_0x2ac17b,_0x3ee312){logger['info'](_0x039e('0x34'),_0x2ac17b[_0x039e('0x25')]);var _0x3c90dd=answerValidation['validate'](_0x2ac17b[_0x039e('0x25')]);if(_0x3c90dd['length']>0x0){return _0x3ee312[_0x039e('0x15')](0x190)['json'](_0x3c90dd);}var _0x28aff2=_0x2ac17b[_0x039e('0x25')][_0x039e('0x31')];var _0x23c537=_0x2ac17b[_0x039e('0x25')][_0x039e('0x1f')];return getAgent(_0x28aff2)[_0x039e('0x17')](function(_0xaa1f3b){logger[_0x039e('0x10')](_0x039e('0x2a'),_0xaa1f3b['name']);emit(util['format']('user:%s',_0xaa1f3b[_0x039e('0x14')]),_0x039e('0x35'),{'sessionId':_0x23c537});return _0x3ee312['status'](0xc8)[_0x039e('0x26')]({'error':![],'message':_0x039e('0x36')});})[_0x039e('0x2e')](handleError(_0x3ee312));};exports[_0x039e('0x37')]=function(_0x34769d,_0x5d8163){logger[_0x039e('0x10')](_0x039e('0x38'),_0x34769d[_0x039e('0x25')]);var _0x9fa58b=holdValidation[_0x039e('0xc')](_0x34769d['body']);if(_0x9fa58b['length']>0x0){return _0x5d8163[_0x039e('0x15')](0x190)[_0x039e('0x26')](_0x9fa58b);}var _0x372be2=_0x34769d['body'][_0x039e('0x31')];var _0x3f0659=_0x34769d[_0x039e('0x25')][_0x039e('0x1f')];return getAgent(_0x372be2)['then'](function(_0x4e817e){logger[_0x039e('0x10')]('entityFound:',_0x4e817e['name']);emit(util[_0x039e('0x2b')](_0x039e('0x2c'),_0x4e817e[_0x039e('0x14')]),_0x039e('0x39'),{'sessionId':_0x3f0659});return _0x5d8163[_0x039e('0x15')](0xc8)['json']({'error':![],'message':_0x039e('0x3a')});})[_0x039e('0x2e')](handleError(_0x5d8163));};exports[_0x039e('0x3b')]=function(_0x24f512,_0x215dd3){logger['info'](_0x039e('0x3c'),_0x24f512[_0x039e('0x25')]);var _0x33a388=unholdValidation[_0x039e('0xc')](_0x24f512[_0x039e('0x25')]);if(_0x33a388[_0x039e('0x20')]>0x0){return _0x215dd3[_0x039e('0x15')](0x190)[_0x039e('0x26')](_0x33a388);}var _0x4ed54b=_0x24f512['body'][_0x039e('0x31')];var _0x46922c=_0x24f512[_0x039e('0x25')][_0x039e('0x1f')];return getAgent(_0x4ed54b)[_0x039e('0x17')](function(_0xf82c35){logger[_0x039e('0x10')]('entityFound:',_0xf82c35[_0x039e('0x14')]);emit(util[_0x039e('0x2b')](_0x039e('0x2c'),_0xf82c35[_0x039e('0x14')]),_0x039e('0x3d'),{'sessionId':_0x46922c});return _0x215dd3['status'](0xc8)['json']({'error':![],'message':_0x039e('0x3e')});})['catch'](handleError(_0x215dd3));};exports['calls']=function(_0x12c8d6,_0x380b93){logger[_0x039e('0x10')](_0x039e('0x3f'),_0x380b93['body']);var _0x4fc814=callsValidation[_0x039e('0xc')](_0x12c8d6[_0x039e('0x25')]);if(_0x4fc814['length']>0x0){return _0x380b93[_0x039e('0x15')](0x190)[_0x039e('0x26')](_0x4fc814);}var _0xdde309=_0x12c8d6[_0x039e('0x25')]['userId'];var _0x4b21a2=respondWithRpcPromise(_0x039e('0x40'));var _0x2dbe8f=getAgent(_0xdde309);return Promise[_0x039e('0x1c')]([_0x4b21a2,_0x2dbe8f])[_0x039e('0x17')](function(_0xf7eeb){var _0x3eb39b=_0xf7eeb[0x0];var _0x355586=_0xf7eeb[0x1];var _0x51225d=_[_0x039e('0x1d')](_0x3eb39b[_0x039e('0x41')],function(_0x545d93){return _0x545d93[_0x039e('0x1e')]==_0x355586['id'];});return _0x380b93[_0x039e('0x15')](0xc8)[_0x039e('0x26')]({'count':_0x51225d['length'],'rows':_0x51225d});})['catch'](handleError(_0x380b93));};exports[_0x039e('0x42')]=function(_0x1c1892,_0x2c35ca){logger[_0x039e('0x10')](_0x039e('0x43'),_0x1c1892[_0x039e('0x25')]);var _0xe1ba2a=conferenceValidation['validate'](_0x1c1892[_0x039e('0x25')]);if(_0xe1ba2a['length']>0x0){return _0x2c35ca['status'](0x190)[_0x039e('0x26')](_0xe1ba2a);}var _0x36a6ff=_0x1c1892['body'][_0x039e('0x31')];return getAgent(_0x36a6ff)[_0x039e('0x17')](function(_0x33a66d){logger[_0x039e('0x10')]('entityFound:',_0x33a66d[_0x039e('0x14')]);emit(util[_0x039e('0x2b')]('user:%s',_0x33a66d[_0x039e('0x14')]),_0x039e('0x44'));return _0x2c35ca['status'](0xc8)[_0x039e('0x26')]({'error':![],'message':_0x039e('0x45')});})[_0x039e('0x2e')](handleError(_0x2c35ca));};exports[_0x039e('0x46')]=function(_0x1086dd,_0x5e0c11){logger['info'](_0x039e('0x47'),_0x1086dd[_0x039e('0x25')]);var _0x4e0678=transferValidation['validate'](_0x1086dd['body']);if(_0x4e0678[_0x039e('0x20')]>0x0){return _0x5e0c11[_0x039e('0x15')](0x190)[_0x039e('0x26')](_0x4e0678);}var _0x50b413=_0x1086dd['body'][_0x039e('0x31')];var _0x41abd5=_0x1086dd[_0x039e('0x25')][_0x039e('0x1f')];var _0x5f48a7=_0x1086dd['body'][_0x039e('0x48')];return getAgent(_0x50b413)[_0x039e('0x17')](function(_0x306e94){logger['info']('entityFound:',_0x306e94[_0x039e('0x14')]);emit(util[_0x039e('0x2b')](_0x039e('0x2c'),_0x306e94[_0x039e('0x14')]),_0x039e('0x49'),{'sessionId':_0x41abd5,'transferNumber':_0x5f48a7});return _0x5e0c11[_0x039e('0x15')](0xc8)[_0x039e('0x26')]({'error':![],'message':_0x039e('0x4a')});})[_0x039e('0x2e')](handleError(_0x5e0c11));}; \ No newline at end of file +var _0x0298=['error','code','message','findOne','agent','VoiceChannels','all','filter','rows','UserId','sessionId','length','sessionId\x20','\x20not\x20found!','originate','json','body','callNumber','callerId','user:%s','webbar:originate','catch','hangup','hangup\x20fired:','userId','entityFound:','format','webbar:hangup','hangup\x20executed!','answer\x20fired:','answer\x20executed!','hold','hold\x20fired:','webbar:hold','unhold','webbar:unhold','conference','conference\x20fired:','webbar:conference','conference\x20executed!','transfer','transfer\x20fired:','webbar:transfer','transfer\x20executed!','path','lodash','../../config/environment','bluebird','jayson/promise','client','http','../../config/logger','webbarapi','ioredis','redis','localhost','socket.io-emitter','validate','number','userId\x20is\x20required','callNumber\x20is\x20required','string','sessionId\x20is\x20required','transferNumber\x20is\x20required','info','stringify','name','status','send','NotFound','request','then'];(function(_0x16bfe9,_0xdf0152){var _0x2dda75=function(_0x5d0083){while(--_0x5d0083){_0x16bfe9['push'](_0x16bfe9['shift']());}};_0x2dda75(++_0xdf0152);}(_0x0298,0x74));var _0x8029=function(_0x560d2a,_0x4a9f54){_0x560d2a=_0x560d2a-0x0;var _0x3df62d=_0x0298[_0x560d2a];return _0x3df62d;};'use strict';var path=require(_0x8029('0x0'));var fs=require('fs');var _=require(_0x8029('0x1'));var db=require('../../mysqldb')['db'];var config=require(_0x8029('0x2'));var util=require('util');var BPromise=require(_0x8029('0x3'));var jayson=require(_0x8029('0x4'));var amiClient=jayson[_0x8029('0x5')][_0x8029('0x6')]({'port':0x232a});var logger=require(_0x8029('0x7'))(_0x8029('0x8'));var Redis=require(_0x8029('0x9'));config[_0x8029('0xa')]=_['defaults'](config[_0x8029('0xa')],{'host':_0x8029('0xb'),'port':0x18eb});var io=require(_0x8029('0xc'))(new Redis(config[_0x8029('0xa')]));var Schema=require(_0x8029('0xd'));var originateValidation=new Schema({'userId':{'type':_0x8029('0xe'),'required':[!![],_0x8029('0xf')]},'callNumber':{'type':'string','required':[!![],_0x8029('0x10')]},'callerId':{'type':_0x8029('0x11')},'callbackUrl':{'type':_0x8029('0x11')}});var hangupValidation=new Schema({'userId':{'type':_0x8029('0xe'),'required':[!![],_0x8029('0xf')]},'sessionId':{'type':_0x8029('0x11'),'required':![]}});var answerValidation=new Schema({'userId':{'type':_0x8029('0xe'),'required':[!![],_0x8029('0xf')]},'sessionId':{'type':'string','required':![]}});var transferValidation=new Schema({'userId':{'type':_0x8029('0xe'),'required':[!![],_0x8029('0xf')]},'sessionId':{'type':_0x8029('0x11'),'required':[!![],_0x8029('0x12')]},'transferNumber':{'type':_0x8029('0x11'),'required':[!![],_0x8029('0x13')]}});var holdValidation=new Schema({'userId':{'type':_0x8029('0xe'),'required':[!![],'userId\x20is\x20required']},'sessionId':{'type':'string','required':![]}});var unholdValidation=new Schema({'userId':{'type':_0x8029('0xe'),'required':[!![],_0x8029('0xf')]},'sessionId':{'type':_0x8029('0x11'),'required':![]}});var callsValidation=new Schema({'userId':{'type':_0x8029('0xe'),'required':[!![],'userId\x20is\x20required']}});var conferenceValidation=new Schema({'userId':{'type':_0x8029('0xe'),'required':[!![],_0x8029('0xf')]}});function emit(_0x5900d5,_0x80d0a7,_0x4fa3cc){logger[_0x8029('0x14')](_0x5900d5,_0x80d0a7,JSON[_0x8029('0x15')](_0x4fa3cc));io['to'](_0x5900d5)['emit'](_0x80d0a7,_0x4fa3cc);}function handleError(_0x29118f){return function(_0x22e136){console['log']('handleError:',_0x22e136,_0x22e136 instanceof RangeError);logger['error'](_0x22e136['stack']);if(_0x22e136 instanceof RangeError){if(_0x22e136['name']){delete _0x22e136[_0x8029('0x16')];}_0x29118f[_0x8029('0x17')](0x194)[_0x8029('0x18')](_0x22e136);}else{if(_0x22e136['name']){delete _0x22e136[_0x8029('0x16')];}_0x29118f[_0x8029('0x17')](0x1f4)[_0x8029('0x18')](_0x22e136);}};}function checkError(){return function(_0x513924){if(!_0x513924){throw new RangeError(_0x8029('0x19'));}return _0x513924;};}function respondWithRpcPromise(_0x1780a2,_0x9a1621){return new BPromise(function(_0x3fcefb,_0x27b875){var _0x393ad9=amiClient;return _0x393ad9[_0x8029('0x1a')](_0x1780a2,_0x9a1621)[_0x8029('0x1b')](function(_0x39e1c5){if(_0x39e1c5['error']){if(_0x39e1c5[_0x8029('0x1c')][_0x8029('0x1d')]===0x1f4){return _0x27b875(_0x39e1c5[_0x8029('0x1c')][_0x8029('0x1e')]);}return _0x3fcefb(_0x39e1c5[_0x8029('0x1c')][_0x8029('0x1e')]);}else{_0x3fcefb(_0x39e1c5['result']);}})['catch'](function(_0x351adb){_0x27b875(_0x351adb);});});}function getAgent(_0x251f0c){return db['User'][_0x8029('0x1f')]({'where':{'id':_0x251f0c,'role':_0x8029('0x20')}})[_0x8029('0x1b')](checkError());}function getAgentCheckSession(_0x1e13c2,_0x18a988){return new BPromise(function(_0x3d24c8,_0x5b8b78){var _0x4a65dd=respondWithRpcPromise(_0x8029('0x21'));var _0x3e9747=getAgent(_0x1e13c2);Promise[_0x8029('0x22')]([_0x4a65dd,_0x3e9747])[_0x8029('0x1b')](function(_0x142de9){var _0xef86d7=_0x142de9[0x0];var _0x5a96d3=_0x142de9[0x1];var _0x5b81c8=_[_0x8029('0x23')](_0xef86d7[_0x8029('0x24')],function(_0x309a93){return _0x309a93[_0x8029('0x25')]==_0x5a96d3['id']&&_0x309a93[_0x8029('0x26')]==_0x18a988;});if(_0x5b81c8[_0x8029('0x27')]==0x1){_0x3d24c8(_0x5a96d3);}else{_0x5b8b78(new RangeError(_0x8029('0x28')+_0x18a988+_0x8029('0x29')));}});});}exports[_0x8029('0x2a')]=function(_0x2a24c6,_0x3805af){logger['info']('originate\x20fired:',_0x2a24c6['body']);var _0x380734=originateValidation[_0x8029('0xd')](_0x2a24c6['body']);if(_0x380734[_0x8029('0x27')]>0x0){return _0x3805af[_0x8029('0x17')](0x190)[_0x8029('0x2b')](_0x380734);}var _0x3137c6=_0x2a24c6[_0x8029('0x2c')]['userId'];var _0x3b1ce6=_0x2a24c6['body'][_0x8029('0x2d')];var _0x24fe5e=_0x2a24c6['body'][_0x8029('0x2e')];var _0x5eb5b4=_0x2a24c6[_0x8029('0x2c')]['callbackUrl'];return getAgent(_0x3137c6)[_0x8029('0x1b')](function(_0x129bd6){logger[_0x8029('0x14')]('entityFound:',_0x129bd6[_0x8029('0x16')]);emit(util['format'](_0x8029('0x2f'),_0x129bd6[_0x8029('0x16')]),_0x8029('0x30'),{'callNumber':_0x3b1ce6,'callerId':_0x24fe5e,'callbackUrl':_0x5eb5b4});return _0x3805af[_0x8029('0x17')](0xc8)[_0x8029('0x2b')]({'error':![],'message':'originate\x20executed!'});})[_0x8029('0x31')](handleError(_0x3805af));};exports[_0x8029('0x32')]=function(_0x3f75d2,_0x393290){logger[_0x8029('0x14')](_0x8029('0x33'),_0x3f75d2[_0x8029('0x2c')]);var _0x1b51b4=hangupValidation[_0x8029('0xd')](_0x3f75d2[_0x8029('0x2c')]);if(_0x1b51b4['length']>0x0){return _0x393290[_0x8029('0x17')](0x190)['json'](_0x1b51b4);}var _0x511f2c=_0x3f75d2['body'][_0x8029('0x34')];var _0x5445d4=_0x3f75d2[_0x8029('0x2c')][_0x8029('0x26')];return getAgent(_0x511f2c)[_0x8029('0x1b')](function(_0x5b55dc){logger['info'](_0x8029('0x35'),_0x5b55dc[_0x8029('0x16')]);emit(util[_0x8029('0x36')]('user:%s',_0x5b55dc['name']),_0x8029('0x37'),{'sessionId':_0x5445d4});return _0x393290[_0x8029('0x17')](0xc8)['json']({'error':![],'message':_0x8029('0x38')});})['catch'](handleError(_0x393290));};exports['answer']=function(_0xf901d3,_0x4eba46){logger[_0x8029('0x14')](_0x8029('0x39'),_0xf901d3['body']);var _0x649168=answerValidation[_0x8029('0xd')](_0xf901d3['body']);if(_0x649168['length']>0x0){return _0x4eba46[_0x8029('0x17')](0x190)[_0x8029('0x2b')](_0x649168);}var _0xaf44a1=_0xf901d3[_0x8029('0x2c')][_0x8029('0x34')];var _0x5c1dcb=_0xf901d3[_0x8029('0x2c')][_0x8029('0x26')];return getAgent(_0xaf44a1)[_0x8029('0x1b')](function(_0x558e85){logger[_0x8029('0x14')](_0x8029('0x35'),_0x558e85['name']);emit(util[_0x8029('0x36')]('user:%s',_0x558e85[_0x8029('0x16')]),'webbar:answer',{'sessionId':_0x5c1dcb});return _0x4eba46[_0x8029('0x17')](0xc8)[_0x8029('0x2b')]({'error':![],'message':_0x8029('0x3a')});})[_0x8029('0x31')](handleError(_0x4eba46));};exports[_0x8029('0x3b')]=function(_0x44a02f,_0x1fd687){logger[_0x8029('0x14')](_0x8029('0x3c'),_0x44a02f[_0x8029('0x2c')]);var _0x43d655=holdValidation[_0x8029('0xd')](_0x44a02f[_0x8029('0x2c')]);if(_0x43d655[_0x8029('0x27')]>0x0){return _0x1fd687[_0x8029('0x17')](0x190)[_0x8029('0x2b')](_0x43d655);}var _0xcbffc8=_0x44a02f[_0x8029('0x2c')][_0x8029('0x34')];var _0x34dc65=_0x44a02f[_0x8029('0x2c')]['sessionId'];return getAgent(_0xcbffc8)[_0x8029('0x1b')](function(_0x715f1e){logger[_0x8029('0x14')]('entityFound:',_0x715f1e[_0x8029('0x16')]);emit(util[_0x8029('0x36')](_0x8029('0x2f'),_0x715f1e[_0x8029('0x16')]),_0x8029('0x3d'),{'sessionId':_0x34dc65});return _0x1fd687[_0x8029('0x17')](0xc8)[_0x8029('0x2b')]({'error':![],'message':'hold\x20executed!'});})[_0x8029('0x31')](handleError(_0x1fd687));};exports[_0x8029('0x3e')]=function(_0x25e75c,_0x268c75){logger['info']('unhold\x20fired:',_0x25e75c[_0x8029('0x2c')]);var _0xd2fc35=unholdValidation[_0x8029('0xd')](_0x25e75c[_0x8029('0x2c')]);if(_0xd2fc35['length']>0x0){return _0x268c75['status'](0x190)[_0x8029('0x2b')](_0xd2fc35);}var _0x3af6d4=_0x25e75c['body']['userId'];var _0x421487=_0x25e75c['body'][_0x8029('0x26')];return getAgent(_0x3af6d4)['then'](function(_0x1ed31e){logger[_0x8029('0x14')](_0x8029('0x35'),_0x1ed31e[_0x8029('0x16')]);emit(util[_0x8029('0x36')](_0x8029('0x2f'),_0x1ed31e[_0x8029('0x16')]),_0x8029('0x3f'),{'sessionId':_0x421487});return _0x268c75['status'](0xc8)['json']({'error':![],'message':'unhold\x20executed!'});})['catch'](handleError(_0x268c75));};exports['calls']=function(_0x160d2f,_0x5d1df1){logger[_0x8029('0x14')]('calls\x20fired:',_0x5d1df1[_0x8029('0x2c')]);var _0x52b922=callsValidation['validate'](_0x160d2f['body']);if(_0x52b922[_0x8029('0x27')]>0x0){return _0x5d1df1[_0x8029('0x17')](0x190)[_0x8029('0x2b')](_0x52b922);}var _0x3d0e16=_0x160d2f[_0x8029('0x2c')][_0x8029('0x34')];var _0x38f2c2=respondWithRpcPromise('VoiceChannels');var _0x29bf59=getAgent(_0x3d0e16);return Promise[_0x8029('0x22')]([_0x38f2c2,_0x29bf59])[_0x8029('0x1b')](function(_0x370fa7){var _0x2c5aae=_0x370fa7[0x0];var _0x3530d3=_0x370fa7[0x1];var _0xe830a3=_[_0x8029('0x23')](_0x2c5aae[_0x8029('0x24')],function(_0x3f8c21){return _0x3f8c21['UserId']==_0x3530d3['id'];});return _0x5d1df1['status'](0xc8)[_0x8029('0x2b')]({'count':_0xe830a3['length'],'rows':_0xe830a3});})[_0x8029('0x31')](handleError(_0x5d1df1));};exports[_0x8029('0x40')]=function(_0x3b8dae,_0x583b8e){logger['info'](_0x8029('0x41'),_0x3b8dae[_0x8029('0x2c')]);var _0x3b9432=conferenceValidation[_0x8029('0xd')](_0x3b8dae[_0x8029('0x2c')]);if(_0x3b9432[_0x8029('0x27')]>0x0){return _0x583b8e[_0x8029('0x17')](0x190)[_0x8029('0x2b')](_0x3b9432);}var _0x4acd5a=_0x3b8dae[_0x8029('0x2c')]['userId'];return getAgent(_0x4acd5a)['then'](function(_0x3cf737){logger[_0x8029('0x14')](_0x8029('0x35'),_0x3cf737[_0x8029('0x16')]);emit(util[_0x8029('0x36')](_0x8029('0x2f'),_0x3cf737['name']),_0x8029('0x42'));return _0x583b8e[_0x8029('0x17')](0xc8)['json']({'error':![],'message':_0x8029('0x43')});})[_0x8029('0x31')](handleError(_0x583b8e));};exports[_0x8029('0x44')]=function(_0x5694ed,_0x35cee5){logger[_0x8029('0x14')](_0x8029('0x45'),_0x5694ed['body']);var _0x5cf9fb=transferValidation['validate'](_0x5694ed[_0x8029('0x2c')]);if(_0x5cf9fb[_0x8029('0x27')]>0x0){return _0x35cee5['status'](0x190)['json'](_0x5cf9fb);}var _0x19a39d=_0x5694ed['body'][_0x8029('0x34')];var _0x183133=_0x5694ed[_0x8029('0x2c')]['sessionId'];var _0x15d2a3=_0x5694ed['body']['transferNumber'];return getAgent(_0x19a39d)[_0x8029('0x1b')](function(_0x29b073){logger['info'](_0x8029('0x35'),_0x29b073[_0x8029('0x16')]);emit(util[_0x8029('0x36')](_0x8029('0x2f'),_0x29b073[_0x8029('0x16')]),_0x8029('0x46'),{'sessionId':_0x183133,'transferNumber':_0x15d2a3});return _0x35cee5[_0x8029('0x17')](0xc8)[_0x8029('0x2b')]({'error':![],'message':_0x8029('0x47')});})[_0x8029('0x31')](handleError(_0x35cee5));}; \ No newline at end of file diff --git a/server/api/whatsappAccount/index.js b/server/api/whatsappAccount/index.js index d19c9d2..bc43974 100644 --- a/server/api/whatsappAccount/index.js +++ b/server/api/whatsappAccount/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x092d=['./whatsappAccount.controller','isAuthenticated','index','/describe','/:id','show','get','getDispositions','getAnswers','/:id/users','getAgents','/:id/applications','getApplications','post','create','/:id/dispositions','addDisposition','/:id/canned_answers','addAgents','addApplications','/:id/notify','notify','/:id/send','send','put','update','delete','destroy','removeDispositions','exports','multer','path','connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment'];(function(_0x305486,_0x24acd4){var _0xa04940=function(_0x29e866){while(--_0x29e866){_0x305486['push'](_0x305486['shift']());}};_0xa04940(++_0x24acd4);}(_0x092d,0x68));var _0xd092=function(_0x7b173,_0x539d7f){_0x7b173=_0x7b173-0x0;var _0x1c598c=_0x092d[_0x7b173];return _0x1c598c;};'use strict';var multer=require(_0xd092('0x0'));var util=require('util');var path=require(_0xd092('0x1'));var timeout=require(_0xd092('0x2'));var express=require(_0xd092('0x3'));var router=express['Router']();var auth=require(_0xd092('0x4'));var interaction=require(_0xd092('0x5'));var config=require(_0xd092('0x6'));var controller=require(_0xd092('0x7'));router['get']('/',auth[_0xd092('0x8')](),controller[_0xd092('0x9')]);router['get'](_0xd092('0xa'),auth[_0xd092('0x8')](),controller['describe']);router['get'](_0xd092('0xb'),auth[_0xd092('0x8')](),controller[_0xd092('0xc')]);router[_0xd092('0xd')]('/:id/dispositions',auth[_0xd092('0x8')](),controller[_0xd092('0xe')]);router[_0xd092('0xd')]('/:id/canned_answers',auth[_0xd092('0x8')](),controller[_0xd092('0xf')]);router['get'](_0xd092('0x10'),auth[_0xd092('0x8')](),controller[_0xd092('0x11')]);router[_0xd092('0xd')](_0xd092('0x12'),auth['isAuthenticated'](),controller[_0xd092('0x13')]);router[_0xd092('0x14')]('/',auth['isAuthenticated'](),controller[_0xd092('0x15')]);router['post'](_0xd092('0x16'),auth[_0xd092('0x8')](),controller[_0xd092('0x17')]);router[_0xd092('0x14')](_0xd092('0x18'),auth['isAuthenticated'](),controller['addAnswer']);router[_0xd092('0x14')](_0xd092('0x10'),auth[_0xd092('0x8')](),controller[_0xd092('0x19')]);router[_0xd092('0x14')](_0xd092('0x12'),auth[_0xd092('0x8')](),controller[_0xd092('0x1a')]);router[_0xd092('0x14')](_0xd092('0x1b'),controller[_0xd092('0x1c')]);router[_0xd092('0x14')](_0xd092('0x1d'),auth[_0xd092('0x8')](),controller[_0xd092('0x1e')]);router[_0xd092('0x1f')](_0xd092('0xb'),auth[_0xd092('0x8')](),controller[_0xd092('0x20')]);router[_0xd092('0x21')](_0xd092('0xb'),auth[_0xd092('0x8')](),controller[_0xd092('0x22')]);router['delete']('/:id/dispositions',auth[_0xd092('0x8')](),controller[_0xd092('0x23')]);router[_0xd092('0x21')](_0xd092('0x18'),auth[_0xd092('0x8')](),controller['removeAnswers']);router[_0xd092('0x21')]('/:id/users',auth[_0xd092('0x8')](),controller['removeAgents']);module[_0xd092('0x24')]=router; \ No newline at end of file +var _0x605e=['../../config/environment','./whatsappAccount.controller','get','index','describe','/:id','isAuthenticated','show','/:id/dispositions','getDispositions','/:id/canned_answers','getAnswers','/:id/users','getAgents','/:id/applications','getApplications','post','create','addDisposition','addAnswer','addAgents','addApplications','/:id/notify','notify','/:id/send','put','update','destroy','removeDispositions','delete','removeAnswers','removeAgents','exports','multer','util','connect-timeout','express'];(function(_0x5a6644,_0x45d612){var _0x3a2a5d=function(_0x54159e){while(--_0x54159e){_0x5a6644['push'](_0x5a6644['shift']());}};_0x3a2a5d(++_0x45d612);}(_0x605e,0x1b8));var _0xe605=function(_0x113c4b,_0x1bf587){_0x113c4b=_0x113c4b-0x0;var _0x559092=_0x605e[_0x113c4b];return _0x559092;};'use strict';var multer=require(_0xe605('0x0'));var util=require(_0xe605('0x1'));var path=require('path');var timeout=require(_0xe605('0x2'));var express=require(_0xe605('0x3'));var router=express['Router']();var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0xe605('0x4'));var controller=require(_0xe605('0x5'));router[_0xe605('0x6')]('/',auth['isAuthenticated'](),controller[_0xe605('0x7')]);router[_0xe605('0x6')]('/describe',auth['isAuthenticated'](),controller[_0xe605('0x8')]);router[_0xe605('0x6')](_0xe605('0x9'),auth[_0xe605('0xa')](),controller[_0xe605('0xb')]);router['get'](_0xe605('0xc'),auth[_0xe605('0xa')](),controller[_0xe605('0xd')]);router[_0xe605('0x6')](_0xe605('0xe'),auth['isAuthenticated'](),controller[_0xe605('0xf')]);router[_0xe605('0x6')](_0xe605('0x10'),auth[_0xe605('0xa')](),controller[_0xe605('0x11')]);router[_0xe605('0x6')](_0xe605('0x12'),auth['isAuthenticated'](),controller[_0xe605('0x13')]);router[_0xe605('0x14')]('/',auth[_0xe605('0xa')](),controller[_0xe605('0x15')]);router[_0xe605('0x14')](_0xe605('0xc'),auth['isAuthenticated'](),controller[_0xe605('0x16')]);router[_0xe605('0x14')](_0xe605('0xe'),auth[_0xe605('0xa')](),controller[_0xe605('0x17')]);router[_0xe605('0x14')](_0xe605('0x10'),auth['isAuthenticated'](),controller[_0xe605('0x18')]);router['post']('/:id/applications',auth['isAuthenticated'](),controller[_0xe605('0x19')]);router[_0xe605('0x14')](_0xe605('0x1a'),controller[_0xe605('0x1b')]);router[_0xe605('0x14')](_0xe605('0x1c'),auth[_0xe605('0xa')](),controller['send']);router[_0xe605('0x1d')](_0xe605('0x9'),auth[_0xe605('0xa')](),controller[_0xe605('0x1e')]);router['delete'](_0xe605('0x9'),auth[_0xe605('0xa')](),controller[_0xe605('0x1f')]);router['delete'](_0xe605('0xc'),auth[_0xe605('0xa')](),controller[_0xe605('0x20')]);router[_0xe605('0x21')](_0xe605('0xe'),auth[_0xe605('0xa')](),controller[_0xe605('0x22')]);router['delete'](_0xe605('0x10'),auth[_0xe605('0xa')](),controller[_0xe605('0x23')]);module[_0xe605('0x24')]=router; \ No newline at end of file diff --git a/server/api/whatsappAccount/whatsappAccount.attributes.js b/server/api/whatsappAccount/whatsappAccount.attributes.js index 133da69..df30bf0 100644 --- a/server/api/whatsappAccount/whatsappAccount.attributes.js +++ b/server/api/whatsappAccount/whatsappAccount.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x0e79=['INTEGER','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','setDataValue','mandatoryDispositionPauseId','mandatoryDisposition','sequelize','randomstring','exports','STRING','name','generate','ENUM','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}','BOOLEAN'];(function(_0x5a4baa,_0x4f3f49){var _0x4465c0=function(_0x16f5f2){while(--_0x16f5f2){_0x5a4baa['push'](_0x5a4baa['shift']());}};_0x4465c0(++_0x4f3f49);}(_0x0e79,0x1aa));var _0x90e7=function(_0x4b1665,_0xb0c095){_0x4b1665=_0x4b1665-0x0;var _0x5850c0=_0x0e79[_0x4b1665];return _0x5850c0;};'use strict';var Sequelize=require(_0x90e7('0x0'));var rs=require(_0x90e7('0x1'));module[_0x90e7('0x2')]={'name':{'type':Sequelize[_0x90e7('0x3')],'unique':_0x90e7('0x4'),'allowNull':![]},'key':{'type':Sequelize[_0x90e7('0x3')],'allowNull':![]},'remote':{'type':Sequelize[_0x90e7('0x3')],'allowNull':![]},'token':{'type':Sequelize[_0x90e7('0x3')],'defaultValue':function(){return rs[_0x90e7('0x5')]();}},'phone':{'type':Sequelize[_0x90e7('0x3')]},'type':{'type':Sequelize[_0x90e7('0x6')]('twilio')},'accountSid':{'type':Sequelize[_0x90e7('0x3')]},'authToken':{'type':Sequelize[_0x90e7('0x3')]},'notificationTemplate':{'type':Sequelize['TEXT'],'defaultValue':function(){return _0x90e7('0x7');}},'notificationSound':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'notificationShake':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize[_0x90e7('0x8')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0x90e7('0x9')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0x90e7('0x8')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0x90e7('0x9')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize['INTEGER'],'comment':_0x90e7('0xa')},'mandatoryDisposition':{'type':Sequelize[_0x90e7('0x8')],'defaultValue':![],'comment':_0x90e7('0xb'),'set':function(_0x528eeb){if(!_0x528eeb){this[_0x90e7('0xc')](_0x90e7('0xd'),null);}this[_0x90e7('0xc')](_0x90e7('0xe'),_0x528eeb);}},'description':{'type':Sequelize[_0x90e7('0x3')]}}; \ No newline at end of file +var _0xa809=['Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}','BOOLEAN','INTEGER','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','setDataValue','mandatoryDispositionPauseId','mandatoryDisposition','sequelize','randomstring','exports','STRING','name','generate','twilio','TEXT'];(function(_0x2823fd,_0x5dfcc1){var _0x2f100e=function(_0x125039){while(--_0x125039){_0x2823fd['push'](_0x2823fd['shift']());}};_0x2f100e(++_0x5dfcc1);}(_0xa809,0xac));var _0x9a80=function(_0x5e9e46,_0x111005){_0x5e9e46=_0x5e9e46-0x0;var _0x1b4c54=_0xa809[_0x5e9e46];return _0x1b4c54;};'use strict';var Sequelize=require(_0x9a80('0x0'));var rs=require(_0x9a80('0x1'));module[_0x9a80('0x2')]={'name':{'type':Sequelize[_0x9a80('0x3')],'unique':_0x9a80('0x4'),'allowNull':![]},'key':{'type':Sequelize[_0x9a80('0x3')],'allowNull':![]},'remote':{'type':Sequelize[_0x9a80('0x3')],'allowNull':![]},'token':{'type':Sequelize['STRING'],'defaultValue':function(){return rs[_0x9a80('0x5')]();}},'phone':{'type':Sequelize[_0x9a80('0x3')]},'type':{'type':Sequelize['ENUM'](_0x9a80('0x6'))},'accountSid':{'type':Sequelize['STRING']},'authToken':{'type':Sequelize['STRING']},'notificationTemplate':{'type':Sequelize[_0x9a80('0x7')],'defaultValue':function(){return _0x9a80('0x8');}},'notificationSound':{'type':Sequelize[_0x9a80('0x9')],'defaultValue':![]},'notificationShake':{'type':Sequelize[_0x9a80('0x9')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize[_0x9a80('0x9')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0x9a80('0xa')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0x9a80('0x9')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0x9a80('0xa')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize[_0x9a80('0xa')],'comment':_0x9a80('0xb')},'mandatoryDisposition':{'type':Sequelize[_0x9a80('0x9')],'defaultValue':![],'comment':'Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','set':function(_0x3a6779){if(!_0x3a6779){this[_0x9a80('0xc')](_0x9a80('0xd'),null);}this[_0x9a80('0xc')](_0x9a80('0xe'),_0x3a6779);}},'description':{'type':Sequelize[_0x9a80('0x3')]}}; \ No newline at end of file diff --git a/server/api/whatsappAccount/whatsappAccount.controller.js b/server/api/whatsappAccount/whatsappAccount.controller.js index 8d578b2..1706670 100644 --- a/server/api/whatsappAccount/whatsappAccount.controller.js +++ b/server/api/whatsappAccount/whatsappAccount.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xf290=['DESC','list','contact','WhatsappInteraction','interaction','autoclose','push','applications','close','*,*,*,*','created','ContactId','AttachmentId','UserId','User','unshift','agent','waitForTheAssignedAgent','Start','startRouting','receiveMessage','entity\x20found','WhatsappAccount,\x20%s,\x20%s,\x20%s,\x20%s','Content-Type','text/xml','send','to\x20is\x20mandatory','List','out','WhatsappMessage','Messages','dataValues','eml-format','zip-dir','request-promise','moment','bluebird','mustache','util','sox','ejs','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./whatsappAccount.socket','register','jayson/promise','client','http','Sequelize','ValidationError','The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.','then','info','WhatsappAccount,\x20%s,\x20%s','request\x20sent','debug','WhatsappAccount,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','status','end','count','offset','set','apply','save','update','destroy','get','UserProfileResource','sendStatus','name','Pause','mandatoryDispositionPause','map','WhatsappAccount','rawAttributes','fieldName','type','key','model','query','keys','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','limit','order','sort','where','pick','filter','merge','options','includeAll','include','findAll','show','params','find','create','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','WhatsappAccounts','userProfileId','autoAssociation','body','describe','addDisposition','WhatsappAccountId','Disposition','getDispositions','findOne','removeDispositions','ids','addAnswer','CannedAnswer','getAnswers','rows','removeAnswers','addAgents','omit','spread','emit','userWhatsappAccount:save','removeAgents','isArray','userWhatsappAccount:remove','getAgents','addApplications','sequelize','transaction','WhatsappApplication','bulkCreate','findAndCountAll','priority','getApplications','whatsapp','Applications','orderBy','asc','account','CmContact','no\x20available\x20attributes','difference','createdAt','updatedAt','CompanyId','ListId','mobile','twilio','From','whatsapp:','Body','messageId','MessageSid','isNil','from','from\x20is\x20mandatory','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','CmList','Contacts'];(function(_0x431979,_0x2b3eb6){var _0x731032=function(_0x5929a8){while(--_0x5929a8){_0x431979['push'](_0x431979['shift']());}};_0x731032(++_0x2b3eb6);}(_0xf290,0xde));var _0x0f29=function(_0x512c83,_0x42a67a){_0x512c83=_0x512c83-0x0;var _0x1f7f25=_0xf290[_0x512c83];return _0x1f7f25;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x0f29('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x0f29('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x0f29('0x2'));var moment=require(_0x0f29('0x3'));var BPromise=require(_0x0f29('0x4'));var Mustache=require(_0x0f29('0x5'));var util=require(_0x0f29('0x6'));var path=require('path');var sox=require(_0x0f29('0x7'));var csv=require('to-csv');var ejs=require(_0x0f29('0x8'));var fs=require('fs');var _=require(_0x0f29('0x9'));var squel=require(_0x0f29('0xa'));var crypto=require(_0x0f29('0xb'));var jsforce=require(_0x0f29('0xc'));var deskjs=require(_0x0f29('0xd'));var toCsv=require(_0x0f29('0xe'));var querystring=require(_0x0f29('0xf'));var Papa=require(_0x0f29('0x10'));var Redis=require(_0x0f29('0x11'));var authService=require(_0x0f29('0x12'));var qs=require(_0x0f29('0x13'));var as=require(_0x0f29('0x14'));var hardwareService=require(_0x0f29('0x15'));var logger=require(_0x0f29('0x16'))('api');var utils=require(_0x0f29('0x17'));var config=require('../../config/environment');var db=require(_0x0f29('0x18'))['db'];config[_0x0f29('0x19')]=_[_0x0f29('0x1a')](config[_0x0f29('0x19')],{'host':_0x0f29('0x1b'),'port':0x18eb});var socket=require(_0x0f29('0x1c'))(new Redis(config['redis']));require(_0x0f29('0x1d'))[_0x0f29('0x1e')](socket);var jayson=require(_0x0f29('0x1f'));var client=jayson[_0x0f29('0x20')][_0x0f29('0x21')]({'port':0x232c});function checkPasswordPattern(_0x2ed9c5,_0x1c518,_0x69df36){if(_0x69df36){var _0x547404=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x547404['test'](_0x1c518)){return _0x2ed9c5;}else{throw new db[(_0x0f29('0x22'))][(_0x0f29('0x23'))](_0x0f29('0x24'));}}else{return _0x2ed9c5;}}function respondWithRpcPromise(_0x233c78,_0x4b3f0b,_0x122bfa,_0x5d72a5){return new BPromise(function(_0x17b994,_0x4ca5e8){var _0x5ddc74=_0x5d72a5||client;return _0x5ddc74['request'](_0x233c78,_0x122bfa)[_0x0f29('0x25')](function(_0x8fc03f){logger[_0x0f29('0x26')](_0x0f29('0x27'),_0x4b3f0b,_0x0f29('0x28'));logger[_0x0f29('0x29')](_0x0f29('0x2a'),_0x4b3f0b,'request\x20sent',JSON[_0x0f29('0x2b')](_0x8fc03f));if(_0x8fc03f['error']){if(_0x8fc03f['error']['code']===0x1f4){logger['error'](_0x0f29('0x27'),_0x4b3f0b,_0x8fc03f[_0x0f29('0x2c')]['message']);return _0x4ca5e8(_0x8fc03f[_0x0f29('0x2c')][_0x0f29('0x2d')]);}logger[_0x0f29('0x2c')](_0x0f29('0x27'),_0x4b3f0b,_0x8fc03f[_0x0f29('0x2c')]['message']);return _0x17b994(_0x8fc03f[_0x0f29('0x2c')]['message']);}else{logger[_0x0f29('0x26')](_0x0f29('0x27'),_0x4b3f0b,_0x0f29('0x28'));_0x17b994(_0x8fc03f[_0x0f29('0x2e')]['message']);}})[_0x0f29('0x2f')](function(_0x540d72){logger['error'](_0x0f29('0x27'),_0x4b3f0b,_0x540d72);_0x4ca5e8(_0x540d72);});});}function respondWithStatusCode(_0x5c0202,_0x5bfcac){_0x5bfcac=_0x5bfcac||0xcc;return function(_0x57dcc7){if(_0x57dcc7){return _0x5c0202['sendStatus'](_0x5bfcac);}return _0x5c0202[_0x0f29('0x30')](_0x5bfcac)[_0x0f29('0x31')]();};}function respondWithResult(_0x4cc5a0,_0x1fc4fd){_0x1fc4fd=_0x1fc4fd||0xc8;return function(_0x2ab528){if(_0x2ab528){return _0x4cc5a0[_0x0f29('0x30')](_0x1fc4fd)['json'](_0x2ab528);}};}function respondWithFilteredResult(_0x56e729,_0x37ebcc){return function(_0x5e0768){if(_0x5e0768){var _0x36b65c=_0x5e0768[_0x0f29('0x32')],_0x561c31=_0x37ebcc[_0x0f29('0x33')],_0x526364=_0x37ebcc[_0x0f29('0x33')]+_0x37ebcc['limit'],_0x7b10f;if(_0x526364>=_0x36b65c){_0x526364=_0x36b65c;_0x7b10f=0xc8;}else{_0x7b10f=0xce;}_0x56e729['status'](_0x7b10f);return _0x56e729[_0x0f29('0x34')]('Content-Range',_0x561c31+'-'+_0x526364+'/'+_0x36b65c)['json'](_0x5e0768);}return null;};}function patchUpdates(_0x156d91){return function(_0x5baebb){try{jsonpatch[_0x0f29('0x35')](_0x5baebb,_0x156d91,!![]);}catch(_0x5367e4){return BPromise['reject'](_0x5367e4);}return _0x5baebb[_0x0f29('0x36')]();};}function saveUpdates(_0x462fde,_0x3ea452){return function(_0x7f2b3b){if(_0x7f2b3b){return _0x7f2b3b[_0x0f29('0x37')](_0x462fde)['then'](function(_0x426a3e){return _0x426a3e;});}return null;};}function removeEntity(_0x59e52d,_0x2cc510){return function(_0x3e8f3f){if(_0x3e8f3f){return _0x3e8f3f[_0x0f29('0x38')]()[_0x0f29('0x25')](function(){var _0x4852a5=_0x3e8f3f[_0x0f29('0x39')]({'plain':!![]});var _0x398c15='WhatsappAccounts';return db[_0x0f29('0x3a')][_0x0f29('0x38')]({'where':{'type':_0x398c15,'resourceId':_0x4852a5['id']}})['then'](function(){return _0x3e8f3f;});})['then'](function(){_0x59e52d[_0x0f29('0x30')](0xcc)[_0x0f29('0x31')]();});}};}function handleEntityNotFound(_0x3691d4,_0xf7f38f){return function(_0x138658){if(!_0x138658){_0x3691d4[_0x0f29('0x3b')](0x194);}return _0x138658;};}function handleError(_0x50018c,_0xa62a0e){_0xa62a0e=_0xa62a0e||0x1f4;return function(_0x5a538e){logger[_0x0f29('0x2c')](_0x5a538e['stack']);if(_0x5a538e[_0x0f29('0x3c')]){delete _0x5a538e[_0x0f29('0x3c')];}_0x50018c[_0x0f29('0x30')](_0xa62a0e)['send'](_0x5a538e);};}exports['index']=function(_0x16a9eb,_0x542d05){var _0x312c07={'include':[{'model':db[_0x0f29('0x3d')],'as':_0x0f29('0x3e')}]},_0x3f49f8={},_0x32f1ef={'count':0x0,'rows':[]};var _0x5afbb8=_[_0x0f29('0x3f')](db[_0x0f29('0x40')][_0x0f29('0x41')],function(_0x387cdf){return{'name':_0x387cdf[_0x0f29('0x42')],'type':_0x387cdf[_0x0f29('0x43')][_0x0f29('0x44')]};});_0x3f49f8[_0x0f29('0x45')]=_[_0x0f29('0x3f')](_0x5afbb8,'name');_0x3f49f8[_0x0f29('0x46')]=_[_0x0f29('0x47')](_0x16a9eb[_0x0f29('0x46')]);_0x3f49f8[_0x0f29('0x48')]=_['intersection'](_0x3f49f8[_0x0f29('0x45')],_0x3f49f8[_0x0f29('0x46')]);_0x312c07[_0x0f29('0x49')]=_[_0x0f29('0x4a')](_0x3f49f8[_0x0f29('0x45')],qs['fields'](_0x16a9eb[_0x0f29('0x46')][_0x0f29('0x4b')]));_0x312c07[_0x0f29('0x49')]=_0x312c07['attributes'][_0x0f29('0x4c')]?_0x312c07[_0x0f29('0x49')]:_0x3f49f8[_0x0f29('0x45')];if(!_0x16a9eb[_0x0f29('0x46')][_0x0f29('0x4d')](_0x0f29('0x4e'))){_0x312c07[_0x0f29('0x4f')]=qs[_0x0f29('0x4f')](_0x16a9eb['query']['limit']);_0x312c07['offset']=qs[_0x0f29('0x33')](_0x16a9eb[_0x0f29('0x46')][_0x0f29('0x33')]);}_0x312c07[_0x0f29('0x50')]=qs[_0x0f29('0x51')](_0x16a9eb[_0x0f29('0x46')]['sort']);_0x312c07[_0x0f29('0x52')]=qs['filters'](_[_0x0f29('0x53')](_0x16a9eb['query'],_0x3f49f8[_0x0f29('0x48')]),_0x5afbb8);if(_0x16a9eb[_0x0f29('0x46')][_0x0f29('0x54')]){_0x312c07[_0x0f29('0x52')]=_[_0x0f29('0x55')](_0x312c07['where'],{'$or':_[_0x0f29('0x3f')](_0x5afbb8,function(_0x587bf3){if(_0x587bf3[_0x0f29('0x43')]!=='VIRTUAL'){var _0x14b747={};_0x14b747[_0x587bf3['name']]={'$like':'%'+_0x16a9eb['query'][_0x0f29('0x54')]+'%'};return _0x14b747;}})});}_0x312c07=_[_0x0f29('0x55')]({},_0x312c07,_0x16a9eb[_0x0f29('0x56')]);var _0x2f448f={'where':_0x312c07[_0x0f29('0x52')]};return db[_0x0f29('0x40')]['count'](_0x2f448f)[_0x0f29('0x25')](function(_0x44bceb){_0x32f1ef[_0x0f29('0x32')]=_0x44bceb;if(_0x16a9eb[_0x0f29('0x46')][_0x0f29('0x57')]){_0x312c07[_0x0f29('0x58')]=[{'all':!![]}];}return db[_0x0f29('0x40')][_0x0f29('0x59')](_0x312c07);})[_0x0f29('0x25')](function(_0x67f1bb){_0x32f1ef['rows']=_0x67f1bb;return _0x32f1ef;})['then'](respondWithFilteredResult(_0x542d05,_0x312c07))[_0x0f29('0x2f')](handleError(_0x542d05,null));};exports[_0x0f29('0x5a')]=function(_0x3f84fc,_0x178f21){var _0x54fbd7={'raw':![],'where':{'id':_0x3f84fc[_0x0f29('0x5b')]['id']},'include':[{'model':db[_0x0f29('0x3d')],'as':_0x0f29('0x3e')}]},_0x239625={};_0x239625[_0x0f29('0x45')]=_[_0x0f29('0x47')](db[_0x0f29('0x40')]['rawAttributes']);_0x239625[_0x0f29('0x46')]=_[_0x0f29('0x47')](_0x3f84fc[_0x0f29('0x46')]);_0x239625[_0x0f29('0x48')]=_[_0x0f29('0x4a')](_0x239625[_0x0f29('0x45')],_0x239625['query']);_0x54fbd7[_0x0f29('0x49')]=_[_0x0f29('0x4a')](_0x239625[_0x0f29('0x45')],qs['fields'](_0x3f84fc[_0x0f29('0x46')]['fields']));_0x54fbd7[_0x0f29('0x49')]=_0x54fbd7['attributes'][_0x0f29('0x4c')]?_0x54fbd7[_0x0f29('0x49')]:_0x239625['model'];if(_0x3f84fc[_0x0f29('0x46')][_0x0f29('0x57')]){_0x54fbd7[_0x0f29('0x58')]=[{'all':!![]}];}_0x54fbd7=_['merge']({},_0x54fbd7,_0x3f84fc[_0x0f29('0x56')]);return db['WhatsappAccount'][_0x0f29('0x5c')](_0x54fbd7)[_0x0f29('0x25')](handleEntityNotFound(_0x178f21,null))['then'](respondWithResult(_0x178f21,null))[_0x0f29('0x2f')](handleError(_0x178f21,null));};exports[_0x0f29('0x5d')]=function(_0x4f2da6,_0xbe013b){return db['WhatsappAccount'][_0x0f29('0x5d')](_0x4f2da6['body'],{})[_0x0f29('0x25')](function(_0x302d05){var _0x36a7df=_0x4f2da6['user'][_0x0f29('0x39')]({'plain':!![]});if(!_0x36a7df)throw new Error(_0x0f29('0x5e'));if(_0x36a7df[_0x0f29('0x5f')]===_0x0f29('0x60')){var _0x584552=_0x302d05[_0x0f29('0x39')]({'plain':!![]});var _0x4e9288=_0x0f29('0x61');return db['UserProfileSection'][_0x0f29('0x5c')]({'where':{'name':_0x4e9288,'userProfileId':_0x36a7df[_0x0f29('0x62')]},'raw':!![]})[_0x0f29('0x25')](function(_0xdd8291){if(_0xdd8291&&_0xdd8291[_0x0f29('0x63')]===0x0){return db[_0x0f29('0x3a')][_0x0f29('0x5d')]({'name':_0x584552['name'],'resourceId':_0x584552['id'],'type':_0xdd8291[_0x0f29('0x3c')],'sectionId':_0xdd8291['id']},{})['then'](function(){return _0x302d05;});}else{return _0x302d05;}})[_0x0f29('0x2f')](function(_0x27b047){logger[_0x0f29('0x2c')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x27b047);throw _0x27b047;});}return _0x302d05;})[_0x0f29('0x25')](respondWithResult(_0xbe013b,0xc9))[_0x0f29('0x2f')](handleError(_0xbe013b,null));};exports[_0x0f29('0x37')]=function(_0x4664f0,_0x43d5ed){if(_0x4664f0['body']['id']){delete _0x4664f0['body']['id'];}return db[_0x0f29('0x40')][_0x0f29('0x5c')]({'where':{'id':_0x4664f0[_0x0f29('0x5b')]['id']},'include':[{'model':db['Pause'],'as':'mandatoryDispositionPause'}]})[_0x0f29('0x25')](handleEntityNotFound(_0x43d5ed,null))[_0x0f29('0x25')](saveUpdates(_0x4664f0[_0x0f29('0x64')],null))['then'](respondWithResult(_0x43d5ed,null))['catch'](handleError(_0x43d5ed,null));};exports['destroy']=function(_0x252ac9,_0x38c644){return db['WhatsappAccount'][_0x0f29('0x5c')]({'where':{'id':_0x252ac9[_0x0f29('0x5b')]['id']}})['then'](handleEntityNotFound(_0x38c644,null))[_0x0f29('0x25')](removeEntity(_0x38c644,null))['catch'](handleError(_0x38c644,null));};exports[_0x0f29('0x65')]=function(_0x1d245e,_0x47c238){return db[_0x0f29('0x40')][_0x0f29('0x65')]()[_0x0f29('0x25')](respondWithResult(_0x47c238,null))[_0x0f29('0x2f')](handleError(_0x47c238,null));};exports[_0x0f29('0x66')]=function(_0x786e0b,_0x4ea5a6,_0x2babb0){if(_0x786e0b[_0x0f29('0x64')]['id']){delete _0x786e0b[_0x0f29('0x64')]['id'];}return db['WhatsappAccount'][_0x0f29('0x5c')]({'where':{'id':_0x786e0b[_0x0f29('0x5b')]['id']}})['then'](handleEntityNotFound(_0x4ea5a6,null))[_0x0f29('0x25')](function(_0x497429){if(_0x497429){_0x786e0b[_0x0f29('0x64')][_0x0f29('0x67')]=_0x497429['id'];return db[_0x0f29('0x68')]['create'](_0x786e0b[_0x0f29('0x64')]);}})[_0x0f29('0x25')](respondWithResult(_0x4ea5a6,null))[_0x0f29('0x2f')](handleError(_0x4ea5a6,null));};exports[_0x0f29('0x69')]=function(_0x1271a3,_0x293477,_0x5c3264){var _0x1473c3={'raw':![],'where':{}};var _0x506cee={};var _0x527485={'count':0x0,'rows':[]};return db[_0x0f29('0x40')][_0x0f29('0x6a')]({'where':{'id':_0x1271a3['params']['id']}})[_0x0f29('0x25')](handleEntityNotFound(_0x293477,null))[_0x0f29('0x25')](function(_0x4afc1b){if(_0x4afc1b){_0x506cee['model']=_['keys'](db['Disposition'][_0x0f29('0x41')]);_0x506cee[_0x0f29('0x46')]=_['keys'](_0x1271a3['query']);_0x506cee[_0x0f29('0x48')]=_['intersection'](_0x506cee[_0x0f29('0x45')],_0x506cee[_0x0f29('0x46')]);_0x1473c3[_0x0f29('0x49')]=_[_0x0f29('0x4a')](_0x506cee['model'],qs[_0x0f29('0x4b')](_0x1271a3[_0x0f29('0x46')][_0x0f29('0x4b')]));_0x1473c3[_0x0f29('0x49')]=_0x1473c3[_0x0f29('0x49')]['length']?_0x1473c3[_0x0f29('0x49')]:_0x506cee[_0x0f29('0x45')];if(!_0x1271a3[_0x0f29('0x46')][_0x0f29('0x4d')](_0x0f29('0x4e'))){_0x1473c3[_0x0f29('0x4f')]=qs[_0x0f29('0x4f')](_0x1271a3[_0x0f29('0x46')][_0x0f29('0x4f')]);_0x1473c3[_0x0f29('0x33')]=qs[_0x0f29('0x33')](_0x1271a3[_0x0f29('0x46')][_0x0f29('0x33')]);}_0x1473c3[_0x0f29('0x50')]=qs[_0x0f29('0x51')](_0x1271a3['query'][_0x0f29('0x51')]);_0x1473c3[_0x0f29('0x52')]=qs[_0x0f29('0x48')](_[_0x0f29('0x53')](_0x1271a3['query'],_0x506cee['filters']));_0x1473c3[_0x0f29('0x52')][_0x0f29('0x67')]=_0x4afc1b['id'];if(_0x1271a3[_0x0f29('0x46')]['filter']){_0x1473c3[_0x0f29('0x52')]=_['merge'](_0x1473c3[_0x0f29('0x52')],{'$or':_['map'](_0x1473c3[_0x0f29('0x49')],function(_0x30edb4){var _0x3fa996={};_0x3fa996[_0x30edb4]={'$like':'%'+_0x1271a3['query'][_0x0f29('0x54')]+'%'};return _0x3fa996;})});}_0x1473c3=_['merge']({},_0x1473c3,_0x1271a3['options']);return db[_0x0f29('0x68')]['count']({'where':_0x1473c3[_0x0f29('0x52')]})[_0x0f29('0x25')](function(_0x55b810){_0x527485[_0x0f29('0x32')]=_0x55b810;if(_0x1271a3[_0x0f29('0x46')][_0x0f29('0x57')]){_0x1473c3[_0x0f29('0x58')]=[{'all':!![]}];}return db[_0x0f29('0x68')][_0x0f29('0x59')](_0x1473c3);})[_0x0f29('0x25')](function(_0x334bc0){_0x527485['rows']=_0x334bc0;return _0x527485;});}})[_0x0f29('0x25')](respondWithFilteredResult(_0x293477,_0x1473c3))[_0x0f29('0x2f')](handleError(_0x293477,null));};exports[_0x0f29('0x6b')]=function(_0x5e73c6,_0x44f7f6,_0xd6810f){return db['WhatsappAccount'][_0x0f29('0x5c')]({'where':{'id':_0x5e73c6['params']['id']}})[_0x0f29('0x25')](handleEntityNotFound(_0x44f7f6,null))['then'](function(_0x5bc6b2){if(_0x5bc6b2){return _0x5bc6b2['removeDispositions'](_0x5e73c6[_0x0f29('0x46')][_0x0f29('0x6c')]);}})[_0x0f29('0x25')](respondWithStatusCode(_0x44f7f6,null))[_0x0f29('0x2f')](handleError(_0x44f7f6,null));};exports[_0x0f29('0x6d')]=function(_0x45c7c9,_0x425a0d,_0x5d8a18){if(_0x45c7c9[_0x0f29('0x64')]['id']){delete _0x45c7c9[_0x0f29('0x64')]['id'];}return db[_0x0f29('0x40')][_0x0f29('0x5c')]({'where':{'id':_0x45c7c9[_0x0f29('0x5b')]['id']}})[_0x0f29('0x25')](handleEntityNotFound(_0x425a0d,null))['then'](function(_0x1fe30f){if(_0x1fe30f){_0x45c7c9[_0x0f29('0x64')][_0x0f29('0x67')]=_0x1fe30f['id'];return db[_0x0f29('0x6e')]['create'](_0x45c7c9[_0x0f29('0x64')]);}})['then'](respondWithResult(_0x425a0d,null))[_0x0f29('0x2f')](handleError(_0x425a0d,null));};exports[_0x0f29('0x6f')]=function(_0x4d23df,_0x4e1297,_0xd483a9){var _0x27024a={'raw':![],'where':{}};var _0x237662={};var _0x5a5238={'count':0x0,'rows':[]};return db[_0x0f29('0x40')]['findOne']({'where':{'id':_0x4d23df['params']['id']}})[_0x0f29('0x25')](handleEntityNotFound(_0x4e1297,null))['then'](function(_0x42abce){if(_0x42abce){_0x237662[_0x0f29('0x45')]=_[_0x0f29('0x47')](db['CannedAnswer'][_0x0f29('0x41')]);_0x237662[_0x0f29('0x46')]=_[_0x0f29('0x47')](_0x4d23df[_0x0f29('0x46')]);_0x237662[_0x0f29('0x48')]=_[_0x0f29('0x4a')](_0x237662['model'],_0x237662[_0x0f29('0x46')]);_0x27024a['attributes']=_[_0x0f29('0x4a')](_0x237662[_0x0f29('0x45')],qs['fields'](_0x4d23df[_0x0f29('0x46')][_0x0f29('0x4b')]));_0x27024a['attributes']=_0x27024a[_0x0f29('0x49')][_0x0f29('0x4c')]?_0x27024a[_0x0f29('0x49')]:_0x237662[_0x0f29('0x45')];if(!_0x4d23df['query'][_0x0f29('0x4d')](_0x0f29('0x4e'))){_0x27024a['limit']=qs[_0x0f29('0x4f')](_0x4d23df[_0x0f29('0x46')][_0x0f29('0x4f')]);_0x27024a[_0x0f29('0x33')]=qs['offset'](_0x4d23df[_0x0f29('0x46')][_0x0f29('0x33')]);}_0x27024a['order']=qs[_0x0f29('0x51')](_0x4d23df['query']['sort']);_0x27024a[_0x0f29('0x52')]=qs[_0x0f29('0x48')](_[_0x0f29('0x53')](_0x4d23df[_0x0f29('0x46')],_0x237662[_0x0f29('0x48')]));_0x27024a[_0x0f29('0x52')][_0x0f29('0x67')]=_0x42abce['id'];if(_0x4d23df[_0x0f29('0x46')][_0x0f29('0x54')]){_0x27024a[_0x0f29('0x52')]=_['merge'](_0x27024a[_0x0f29('0x52')],{'$or':_[_0x0f29('0x3f')](_0x27024a[_0x0f29('0x49')],function(_0x3603b1){var _0x57ae71={};_0x57ae71[_0x3603b1]={'$like':'%'+_0x4d23df[_0x0f29('0x46')][_0x0f29('0x54')]+'%'};return _0x57ae71;})});}_0x27024a=_[_0x0f29('0x55')]({},_0x27024a,_0x4d23df[_0x0f29('0x56')]);return db[_0x0f29('0x6e')][_0x0f29('0x32')]({'where':_0x27024a['where']})[_0x0f29('0x25')](function(_0xbd86d2){_0x5a5238['count']=_0xbd86d2;if(_0x4d23df[_0x0f29('0x46')][_0x0f29('0x57')]){_0x27024a['include']=[{'all':!![]}];}return db[_0x0f29('0x6e')][_0x0f29('0x59')](_0x27024a);})[_0x0f29('0x25')](function(_0x250c79){_0x5a5238[_0x0f29('0x70')]=_0x250c79;return _0x5a5238;});}})[_0x0f29('0x25')](respondWithFilteredResult(_0x4e1297,_0x27024a))['catch'](handleError(_0x4e1297,null));};exports[_0x0f29('0x71')]=function(_0x454b66,_0x379330,_0x4cd143){return db['WhatsappAccount']['find']({'where':{'id':_0x454b66[_0x0f29('0x5b')]['id']}})['then'](handleEntityNotFound(_0x379330,null))[_0x0f29('0x25')](function(_0x27f80d){if(_0x27f80d){return _0x27f80d[_0x0f29('0x71')](_0x454b66['query'][_0x0f29('0x6c')]);}})[_0x0f29('0x25')](respondWithStatusCode(_0x379330,null))['catch'](handleError(_0x379330,null));};exports[_0x0f29('0x72')]=function(_0x22b1f1,_0x8bbecf,_0x35ef6b){return db[_0x0f29('0x40')][_0x0f29('0x5c')]({'where':{'id':_0x22b1f1[_0x0f29('0x5b')]['id']}})[_0x0f29('0x25')](handleEntityNotFound(_0x8bbecf,null))[_0x0f29('0x25')](function(_0x223193){if(_0x223193){return _0x223193['addAgents'](_0x22b1f1[_0x0f29('0x64')][_0x0f29('0x6c')],_[_0x0f29('0x73')](_0x22b1f1['body'],[_0x0f29('0x6c'),'id'])||{})[_0x0f29('0x74')](function(_0xd8314f){for(var _0x46aee3=0x0;_0x46aee3<_0x22b1f1[_0x0f29('0x64')][_0x0f29('0x6c')][_0x0f29('0x4c')];_0x46aee3+=0x1){socket[_0x0f29('0x75')](_0x0f29('0x76'),{'UserId':_0x22b1f1[_0x0f29('0x64')][_0x0f29('0x6c')][_0x46aee3],'WhatsappAccountId':_0x22b1f1[_0x0f29('0x5b')]['id']});}return _0xd8314f;});}})[_0x0f29('0x25')](respondWithResult(_0x8bbecf,null))[_0x0f29('0x2f')](handleError(_0x8bbecf,null));};exports[_0x0f29('0x77')]=function(_0x5d209f,_0x495276,_0x53eaf1){return db[_0x0f29('0x40')][_0x0f29('0x5c')]({'where':{'id':_0x5d209f[_0x0f29('0x5b')]['id']}})['then'](handleEntityNotFound(_0x495276,null))[_0x0f29('0x25')](function(_0x3ef662){if(_0x3ef662){return _0x3ef662[_0x0f29('0x77')](_0x5d209f[_0x0f29('0x46')][_0x0f29('0x6c')])['then'](function(){if(_[_0x0f29('0x78')](_0x5d209f[_0x0f29('0x46')]['ids'])){for(var _0x58381f=0x0;_0x58381f<_0x5d209f[_0x0f29('0x46')][_0x0f29('0x6c')][_0x0f29('0x4c')];_0x58381f+=0x1){socket[_0x0f29('0x75')](_0x0f29('0x79'),{'UserId':Number(_0x5d209f['query']['ids'][_0x58381f]),'WhatsappAccountId':Number(_0x5d209f[_0x0f29('0x5b')]['id'])});}}else{socket[_0x0f29('0x75')]('userWhatsappAccount:remove',{'UserId':Number(_0x5d209f['query'][_0x0f29('0x6c')]),'WhatsappAccountId':Number(_0x5d209f['params']['id'])});}});}})[_0x0f29('0x25')](respondWithStatusCode(_0x495276,null))[_0x0f29('0x2f')](handleError(_0x495276,null));};exports[_0x0f29('0x7a')]=function(_0x4c84d,_0x4176ce,_0x4e1a1c){var _0x170bfa={};var _0x1cb5e8={};var _0x10ed00;var _0x32a49f;return db[_0x0f29('0x40')][_0x0f29('0x6a')]({'where':{'id':_0x4c84d[_0x0f29('0x5b')]['id']}})[_0x0f29('0x25')](handleEntityNotFound(_0x4176ce,null))[_0x0f29('0x25')](function(_0x1cf090){if(_0x1cf090){_0x10ed00=_0x1cf090;_0x1cb5e8['model']=_['keys'](db['User'][_0x0f29('0x41')]);_0x1cb5e8[_0x0f29('0x46')]=_[_0x0f29('0x47')](_0x4c84d[_0x0f29('0x46')]);_0x1cb5e8['filters']=_[_0x0f29('0x4a')](_0x1cb5e8['model'],_0x1cb5e8['query']);_0x170bfa[_0x0f29('0x49')]=_[_0x0f29('0x4a')](_0x1cb5e8[_0x0f29('0x45')],qs[_0x0f29('0x4b')](_0x4c84d[_0x0f29('0x46')][_0x0f29('0x4b')]));_0x170bfa['attributes']=_0x170bfa[_0x0f29('0x49')][_0x0f29('0x4c')]?_0x170bfa[_0x0f29('0x49')]:_0x1cb5e8[_0x0f29('0x45')];_0x170bfa['order']=qs[_0x0f29('0x51')](_0x4c84d[_0x0f29('0x46')][_0x0f29('0x51')]);_0x170bfa[_0x0f29('0x52')]=qs[_0x0f29('0x48')](_[_0x0f29('0x53')](_0x4c84d[_0x0f29('0x46')],_0x1cb5e8['filters']));if(_0x4c84d[_0x0f29('0x46')][_0x0f29('0x54')]){_0x170bfa[_0x0f29('0x52')]=_[_0x0f29('0x55')](_0x170bfa[_0x0f29('0x52')],{'$or':_['map'](_0x170bfa[_0x0f29('0x49')],function(_0x275beb){var _0x4ebd60={};_0x4ebd60[_0x275beb]={'$like':'%'+_0x4c84d['query']['filter']+'%'};return _0x4ebd60;})});}_0x170bfa=_[_0x0f29('0x55')]({},_0x170bfa,_0x4c84d[_0x0f29('0x56')]);return _0x10ed00[_0x0f29('0x7a')](_0x170bfa);}})[_0x0f29('0x25')](function(_0x3f025e){if(_0x3f025e){_0x32a49f=_0x3f025e['length'];if(!_0x4c84d['query'][_0x0f29('0x4d')](_0x0f29('0x4e'))){_0x170bfa[_0x0f29('0x4f')]=qs[_0x0f29('0x4f')](_0x4c84d[_0x0f29('0x46')]['limit']);_0x170bfa[_0x0f29('0x33')]=qs[_0x0f29('0x33')](_0x4c84d['query'][_0x0f29('0x33')]);}return _0x10ed00[_0x0f29('0x7a')](_0x170bfa);}})[_0x0f29('0x25')](function(_0x3ee238){if(_0x3ee238){return _0x3ee238?{'count':_0x32a49f,'rows':_0x3ee238}:null;}})[_0x0f29('0x25')](respondWithResult(_0x4176ce,null))[_0x0f29('0x2f')](handleError(_0x4176ce,null));};exports[_0x0f29('0x7b')]=function(_0x34efb5,_0x2246e7,_0x13b7a0){return db['WhatsappAccount'][_0x0f29('0x6a')]({'where':{'id':_0x34efb5[_0x0f29('0x5b')]['id']}})[_0x0f29('0x25')](handleEntityNotFound(_0x2246e7,null))[_0x0f29('0x25')](function(_0x46e4fc){if(_0x46e4fc){return db[_0x0f29('0x7c')][_0x0f29('0x7d')](function(_0x84fd0b){return db[_0x0f29('0x7e')]['destroy']({'where':{'WhatsappAccountId':_0x34efb5[_0x0f29('0x5b')]['id']},'transaction':_0x84fd0b})['then'](function(_0x35dcc9){var _0x300aa1=_[_0x0f29('0x3f')](_0x34efb5['body'],function(_0x2d2372){_0x2d2372[_0x0f29('0x67')]=_0x34efb5[_0x0f29('0x5b')]['id'];return _0x2d2372;});return db[_0x0f29('0x7e')][_0x0f29('0x7f')](_0x300aa1,{'transaction':_0x84fd0b});});})[_0x0f29('0x25')](function(){return db['WhatsappApplication'][_0x0f29('0x80')]({'where':{'WhatsappAccountId':_0x34efb5[_0x0f29('0x5b')]['id']},'order':_0x0f29('0x81')});});}})[_0x0f29('0x25')](respondWithResult(_0x2246e7,null))[_0x0f29('0x2f')](handleError(_0x2246e7,null));};exports['getApplications']=function(_0x363b45,_0x21a00a,_0x27b1a0){var _0x30a1de={};var _0x36a218={};var _0x25766d;var _0x357bb4;return db['WhatsappAccount']['findOne']({'where':{'id':_0x363b45['params']['id']}})[_0x0f29('0x25')](handleEntityNotFound(_0x21a00a,null))[_0x0f29('0x25')](function(_0x5898bd){if(_0x5898bd){_0x25766d=_0x5898bd;_0x36a218[_0x0f29('0x45')]=_[_0x0f29('0x47')](db[_0x0f29('0x7e')]['rawAttributes']);_0x36a218[_0x0f29('0x46')]=_[_0x0f29('0x47')](_0x363b45[_0x0f29('0x46')]);_0x36a218[_0x0f29('0x48')]=_[_0x0f29('0x4a')](_0x36a218['model'],_0x36a218[_0x0f29('0x46')]);_0x30a1de['attributes']=_[_0x0f29('0x4a')](_0x36a218[_0x0f29('0x45')],qs['fields'](_0x363b45[_0x0f29('0x46')][_0x0f29('0x4b')]));_0x30a1de[_0x0f29('0x49')]=_0x30a1de[_0x0f29('0x49')][_0x0f29('0x4c')]?_0x30a1de[_0x0f29('0x49')]:_0x36a218[_0x0f29('0x45')];_0x30a1de[_0x0f29('0x50')]=qs['sort'](_0x363b45[_0x0f29('0x46')][_0x0f29('0x51')]);_0x30a1de[_0x0f29('0x52')]=qs[_0x0f29('0x48')](_[_0x0f29('0x53')](_0x363b45[_0x0f29('0x46')],_0x36a218[_0x0f29('0x48')]));if(_0x363b45[_0x0f29('0x46')][_0x0f29('0x54')]){_0x30a1de[_0x0f29('0x52')]=_[_0x0f29('0x55')](_0x30a1de[_0x0f29('0x52')],{'$or':_[_0x0f29('0x3f')](_0x30a1de['attributes'],function(_0x3ac6e9){var _0xcbe8ad={};_0xcbe8ad[_0x3ac6e9]={'$like':'%'+_0x363b45[_0x0f29('0x46')][_0x0f29('0x54')]+'%'};return _0xcbe8ad;})});}_0x30a1de=_[_0x0f29('0x55')]({},_0x30a1de,_0x363b45[_0x0f29('0x56')]);return _0x25766d[_0x0f29('0x82')](_0x30a1de);}})[_0x0f29('0x25')](function(_0xfee854){if(_0xfee854){_0x357bb4=_0xfee854[_0x0f29('0x4c')];if(!_0x363b45[_0x0f29('0x46')]['hasOwnProperty'](_0x0f29('0x4e'))){_0x30a1de[_0x0f29('0x4f')]=qs[_0x0f29('0x4f')](_0x363b45[_0x0f29('0x46')]['limit']);_0x30a1de[_0x0f29('0x33')]=qs['offset'](_0x363b45['query'][_0x0f29('0x33')]);}return _0x25766d[_0x0f29('0x82')](_0x30a1de);}})['then'](function(_0x1473c7){if(_0x1473c7){return _0x1473c7?{'count':_0x357bb4,'rows':_0x1473c7}:null;}})['then'](respondWithResult(_0x21a00a,null))[_0x0f29('0x2f')](handleError(_0x21a00a,null));};exports['notify']=function(_0x16bdee,_0x2569f3,_0xc05b29){var _0x319929={'channel':_0x0f29('0x83')};var _0x1797b2=[];var _0x4ba69b=[];var _0x45bd24={};return db[_0x0f29('0x40')][_0x0f29('0x5c')]({'where':{'id':_0x16bdee[_0x0f29('0x5b')]['id']},'include':[{'model':db[_0x0f29('0x7e')],'as':_0x0f29('0x84')}]})[_0x0f29('0x25')](handleEntityNotFound(_0x2569f3,null))[_0x0f29('0x25')](function(_0x2c2bfb){_0x319929['account']=_0x2c2bfb;_0x319929['applications']=_[_0x0f29('0x85')](_0x2c2bfb[_0x0f29('0x84')],['priority'],[_0x0f29('0x86')]);if(_0x319929[_0x0f29('0x87')]['Applications']){delete _0x319929[_0x0f29('0x87')][_0x0f29('0x84')];}return db[_0x0f29('0x88')]['describe']();})[_0x0f29('0x25')](function(_0x3399ea){if(!_0x3399ea){throw new db[(_0x0f29('0x22'))][(_0x0f29('0x23'))](_0x0f29('0x89'));}_0x1797b2=_[_0x0f29('0x8a')](_[_0x0f29('0x47')](_0x3399ea),[_0x0f29('0x8b'),_0x0f29('0x8c')]);_0x4ba69b=_[_0x0f29('0x8a')](_[_0x0f29('0x47')](_0x3399ea),[_0x0f29('0x8b'),'updatedAt',_0x0f29('0x8d'),_0x0f29('0x8e')]);_0x319929['body']={'mapKey':_0x0f29('0x8f')};if(_0x319929['account'][_0x0f29('0x43')]&&_0x319929[_0x0f29('0x87')]['type']===_0x0f29('0x90')){_0x319929[_0x0f29('0x64')]['from']=_0x16bdee['body'][_0x0f29('0x91')]['replace'](_0x0f29('0x92'),'');_0x319929['body'][_0x0f29('0x64')]=_0x16bdee[_0x0f29('0x64')][_0x0f29('0x93')];_0x319929[_0x0f29('0x64')][_0x0f29('0x94')]=_0x16bdee[_0x0f29('0x64')][_0x0f29('0x95')];}if(_0x319929[_0x0f29('0x64')]['id']){delete _0x319929[_0x0f29('0x64')]['id'];}if(_[_0x0f29('0x96')](_0x319929[_0x0f29('0x64')][_0x0f29('0x97')])){throw new db[(_0x0f29('0x22'))][(_0x0f29('0x23'))](_0x0f29('0x98'));}if(_[_0x0f29('0x96')](_0x319929[_0x0f29('0x64')][_0x0f29('0x64')])||_0x319929[_0x0f29('0x64')][_0x0f29('0x64')]===''){throw new db[(_0x0f29('0x22'))][(_0x0f29('0x23'))](_0x0f29('0x99'));}if(_[_0x0f29('0x96')](_0x319929[_0x0f29('0x64')][_0x0f29('0x9a')])){throw new db['Sequelize'][(_0x0f29('0x23'))](_0x0f29('0x9b')+_0x4ba69b);}if(!_['includes'](_0x4ba69b,_0x319929[_0x0f29('0x64')][_0x0f29('0x9a')])){throw new db[(_0x0f29('0x22'))]['ValidationError']('mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20'+_0x4ba69b);}_0x45bd24[_0x319929['body'][_0x0f29('0x9a')]]=_0x319929[_0x0f29('0x64')][_0x0f29('0x97')];return db[_0x0f29('0x9c')][_0x0f29('0x5c')]({'where':{'id':_0x319929[_0x0f29('0x87')][_0x0f29('0x8e')]},'include':[{'model':db[_0x0f29('0x88')],'as':_0x0f29('0x9d'),'where':_0x45bd24,'limit':0x1,'order':[['updatedAt',_0x0f29('0x9e')]]}]});})['then'](handleEntityNotFound(_0x2569f3,null))[_0x0f29('0x25')](function(_0x4a3294){if(_0x4a3294){_0x319929[_0x0f29('0x9f')]=_[_0x0f29('0x73')](_0x4a3294,[_0x0f29('0x9d')]);if(_0x4a3294['Contacts'][_0x0f29('0x4c')]){return _0x4a3294['Contacts'][0x0];}var _0x3c3035=_['defaults'](_0x319929['body'],{'firstName':_0x319929[_0x0f29('0x64')][_0x0f29('0x97')],'ListId':_0x4a3294['id']});_0x3c3035[_0x319929['body'][_0x0f29('0x9a')]]=_0x319929['body'][_0x0f29('0x97')];return db['CmContact'][_0x0f29('0x5d')](_0x3c3035,{'fields':_0x1797b2,'raw':!![]});}})['then'](handleEntityNotFound(_0x2569f3,null))[_0x0f29('0x25')](function(_0x15a87f){if(_0x15a87f){_0x319929[_0x0f29('0xa0')]=_0x15a87f;var _0x451c50={'ContactId':_0x15a87f['id'],'phone':_0x319929['body'][_0x0f29('0x97')],'WhatsappAccountId':_0x16bdee[_0x0f29('0x5b')]['id']};var _0x15c8ed={'ContactId':_0x15a87f['id'],'WhatsappAccountId':_0x16bdee[_0x0f29('0x5b')]['id'],'closed':![]};return db[_0x0f29('0xa1')][_0x0f29('0x5c')]({'where':_0x15c8ed})[_0x0f29('0x25')](function(_0x5e7c3c){if(_0x5e7c3c){return[_0x5e7c3c,![]];}return db['WhatsappInteraction'][_0x0f29('0x5d')](_0x451c50)[_0x0f29('0x25')](function(_0x3457d8){return[_0x3457d8,!![]];});});}})[_0x0f29('0x74')](function(_0x487e25,_0x5aae6b){_0x319929[_0x0f29('0xa2')]=_0x487e25[_0x0f29('0x39')]({'plain':!![]});_0x319929[_0x0f29('0xa2')]['created']=![];if(_0x5aae6b){if(_0x319929['account'][_0x0f29('0xa3')]){_0x319929['applications'][_0x0f29('0xa4')]({'id':0x0,'priority':_0x319929[_0x0f29('0xa5')]['length']+0x1,'app':_0x0f29('0xa6'),'appdata':'unmanaged','interval':_0x0f29('0xa7')});}_0x319929['interaction'][_0x0f29('0xa8')]=!![];}return db['WhatsappMessage'][_0x0f29('0x5d')]({'phone':_0x319929[_0x0f29('0x64')][_0x0f29('0x97')],'messageId':_0x319929['body']['messageId'],'body':_0x319929[_0x0f29('0x64')]['body'],'WhatsappAccountId':_0x16bdee[_0x0f29('0x5b')]['id'],'WhatsappInteractionId':_0x487e25['id'],'direction':'in','ContactId':_0x487e25[_0x0f29('0xa9')],'AttachmentId':_0x319929[_0x0f29('0x64')][_0x0f29('0xaa')]});})[_0x0f29('0x25')](function(_0x306db9){_0x319929[_0x0f29('0x2d')]=_0x306db9;if(_0x319929[_0x0f29('0xa2')][_0x0f29('0xab')]){return db[_0x0f29('0xac')][_0x0f29('0x5c')]({'attributes':['id','name'],'where':{'id':_0x319929['interaction'][_0x0f29('0xab')]}})[_0x0f29('0x25')](function(_0xb0a74a){if(_0xb0a74a){_0x319929[_0x0f29('0xa5')][_0x0f29('0xad')]({'id':0x0,'priority':0x0,'app':_0x0f29('0xae'),'appdata':_0xb0a74a[_0x0f29('0x3c')]+','+(_0x319929[_0x0f29('0x87')][_0x0f29('0xaf')]||0xa),'interval':_0x0f29('0xa7')});}return respondWithRpcPromise(_0x0f29('0xb0'),_0x0f29('0xb1'),_0x319929);});}return respondWithRpcPromise(_0x0f29('0xb0'),_0x0f29('0xb1'),_0x319929);})[_0x0f29('0x25')](function(_0x5efcf4){if(_0x5efcf4){var _0x49fb6d=0xc8;var _0x2112f0=_0x0f29('0xb2');logger[_0x0f29('0x26')]('WhatsappAccount,\x20%s,\x20%s,\x20%s',_0x2112f0,_0x49fb6d,_0x0f29('0xb3'));logger[_0x0f29('0x29')](_0x0f29('0xb4'),_0x2112f0,_0x49fb6d,_0x0f29('0xb3'),JSON['stringify'](_0x5efcf4));if(_0x319929['account'][_0x0f29('0x43')]===_0x0f29('0x90')){return _0x2569f3[_0x0f29('0x30')](_0x49fb6d)[_0x0f29('0x34')](_0x0f29('0xb5'),_0x0f29('0xb6'))[_0x0f29('0xb7')]('\x0a');}else{return _0x2569f3[_0x0f29('0x30')](_0x49fb6d)['json'](_0x5efcf4);}}})[_0x0f29('0x2f')](handleError(_0x2569f3,null));};exports['send']=function(_0x2de5cb,_0x5c597a,_0x5597fe){var _0x530968,_0x2870bf,_0x4ae17e;if(_[_0x0f29('0x96')](_0x2de5cb[_0x0f29('0x64')][_0x0f29('0x64')])||_0x2de5cb[_0x0f29('0x64')]['body']===''){throw new db[(_0x0f29('0x22'))][(_0x0f29('0x23'))]('body\x20is\x20mandatory\x20and\x20not\x20empty');}if(_['isNil'](_0x2de5cb[_0x0f29('0x64')]['to'])){throw new db[(_0x0f29('0x22'))][(_0x0f29('0x23'))](_0x0f29('0xb8'));}_0x530968=_0x2de5cb[_0x0f29('0x64')]['to'];return db[_0x0f29('0x40')]['find']({'where':{'id':_0x2de5cb[_0x0f29('0x5b')]['id']},'include':[{'model':db[_0x0f29('0x9c')],'as':_0x0f29('0xb9'),'include':[{'model':db[_0x0f29('0x88')],'as':_0x0f29('0x9d'),'where':{'mobile':_0x530968},'limit':0x1,'order':[[_0x0f29('0x8c'),_0x0f29('0x9e')]]}]}]})['then'](handleEntityNotFound(_0x5c597a,null))[_0x0f29('0x25')](function(_0xb54755){if(_0xb54755&&_0xb54755[_0x0f29('0xb9')]){_0x2870bf=_0xb54755['get']({'plain':!![]});if(_0x2870bf['List']&&_0x2870bf['List'][_0x0f29('0x9d')][_0x0f29('0x4c')]){return _0x2870bf['List'][_0x0f29('0x9d')][0x0];}return db[_0x0f29('0x88')][_0x0f29('0x5d')](_[_0x0f29('0x1a')](_0x2de5cb[_0x0f29('0x64')],{'firstName':_0x530968,'mobile':_0x530968,'phone':_0x530968,'ListId':_0x2870bf[_0x0f29('0x8e')]}));}})[_0x0f29('0x25')](handleEntityNotFound(_0x5c597a,null))['then'](function(_0x40d01d){if(_0x40d01d){_0x4ae17e=_0x40d01d;return db[_0x0f29('0xa1')]['find']({'where':{'ContactId':_0x4ae17e['id'],'closed':![],'WhatsappAccountId':_0x2870bf['id']}})[_0x0f29('0x25')](function(_0x3a24e9){if(_0x3a24e9){return[_0x3a24e9,![]];}return db[_0x0f29('0xa1')][_0x0f29('0x5d')]({'UserId':_0x2de5cb[_0x0f29('0x60')]['id'],'ContactId':_0x4ae17e['id'],'WhatsappAccountId':_0x2870bf['id'],'phone':_0x530968,'firstMsgDirection':_0x0f29('0xba'),'Messages':[_[_0x0f29('0x55')](_0x2de5cb[_0x0f29('0x64')],{'read':![],'body':_0x2de5cb[_0x0f29('0x64')][_0x0f29('0x64')],'phone':_0x530968,'WhatsappAccountId':_0x2870bf['id'],'UserId':_0x2de5cb[_0x0f29('0x60')]['id'],'ContactId':_0x4ae17e['id']})]},{'include':[{'model':db[_0x0f29('0xbb')],'as':_0x0f29('0xbc')}]})[_0x0f29('0x25')](function(_0x25b7b9){return[_0x25b7b9,!![]];});});}})[_0x0f29('0x74')](function(_0x56d080,_0x2d3c05){if(_0x2d3c05){return _0x56d080;}return db['WhatsappMessage'][_0x0f29('0x5d')](_['merge'](_0x2de5cb[_0x0f29('0x64')],{'read':![],'body':_0x2de5cb[_0x0f29('0x64')][_0x0f29('0x64')],'phone':_0x530968,'WhatsappAccountId':_0x2870bf['id'],'WhatsappInteractionId':_0x56d080['id'],'UserId':_0x2de5cb[_0x0f29('0x60')]['id'],'ContactId':_0x4ae17e['id']}))[_0x0f29('0x25')](function(_0x6673d7){_0x56d080[_0x0f29('0xbd')][_0x0f29('0xbc')]=[];_0x56d080[_0x0f29('0xbd')][_0x0f29('0xbc')][_0x0f29('0xa4')](_0x6673d7['dataValues']);return _0x56d080;});})['then'](respondWithResult(_0x5c597a,null))['catch'](handleError(_0x5c597a,null));}; \ No newline at end of file +var _0xbfcc=['autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','body','describe','addDisposition','WhatsappAccountId','getDispositions','findOne','Disposition','includeAll','removeDispositions','addAnswer','CannedAnswer','getAnswers','removeAnswers','ids','addAgents','emit','userWhatsappAccount:save','removeAgents','isArray','userWhatsappAccount:remove','getAgents','User','addApplications','sequelize','transaction','WhatsappApplication','bulkCreate','findAndCountAll','priority','getApplications','notify','whatsapp','Applications','account','applications','orderBy','asc','CmContact','ValidationError','no\x20available\x20attributes','createdAt','updatedAt','CompanyId','ListId','mobile','twilio','from','From','replace','whatsapp:','Body','MessageSid','isNil','Sequelize','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','includes','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','CmList','DESC','list','omit','Contacts','defaults','contact','WhatsappInteraction','spread','interaction','created','push','close','unmanaged','*,*,*,*','messageId','ContactId','AttachmentId','UserId','agent','waitForTheAssignedAgent','Start','startRouting','receiveMessage','entity\x20found','WhatsappAccount,\x20%s,\x20%s,\x20%s,\x20%s','stringify','Content-Type','text/xml','\x0a','to\x20is\x20mandatory','List','WhatsappMessage','Messages','dataValues','html-pdf','zip-dir','fast-json-patch','request-promise','moment','sox','to-csv','lodash','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../mysqldb','redis','localhost','socket.io-emitter','./whatsappAccount.socket','register','jayson/promise','client','http','test','The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.','then','info','WhatsappAccount,\x20%s,\x20%s','request\x20sent','debug','WhatsappAccount,\x20%s,\x20%s,\x20%s','error','message','result','catch','status','end','json','count','offset','limit','set','Content-Range','apply','save','destroy','get','WhatsappAccounts','UserProfileResource','stack','name','send','Pause','map','WhatsappAccount','rawAttributes','fieldName','key','model','query','keys','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filters','filter','merge','type','include','findAll','rows','show','params','mandatoryDispositionPause','options','find','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role'];(function(_0x1fd9e7,_0x24cdbe){var _0x1781f2=function(_0x2bd0a3){while(--_0x2bd0a3){_0x1fd9e7['push'](_0x1fd9e7['shift']());}};_0x1781f2(++_0x24cdbe);}(_0xbfcc,0x1dd));var _0xcbfc=function(_0x4bb66f,_0x3cd682){_0x4bb66f=_0x4bb66f-0x0;var _0xf2772f=_0xbfcc[_0x4bb66f];return _0xf2772f;};'use strict';var pdf=require(_0xcbfc('0x0'));var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0xcbfc('0x1'));var jsonpatch=require(_0xcbfc('0x2'));var rp=require(_0xcbfc('0x3'));var moment=require(_0xcbfc('0x4'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require('util');var path=require('path');var sox=require(_0xcbfc('0x5'));var csv=require(_0xcbfc('0x6'));var ejs=require('ejs');var fs=require('fs');var _=require(_0xcbfc('0x7'));var squel=require('squel');var crypto=require(_0xcbfc('0x8'));var jsforce=require(_0xcbfc('0x9'));var deskjs=require(_0xcbfc('0xa'));var toCsv=require(_0xcbfc('0x6'));var querystring=require('querystring');var Papa=require(_0xcbfc('0xb'));var Redis=require(_0xcbfc('0xc'));var authService=require(_0xcbfc('0xd'));var qs=require(_0xcbfc('0xe'));var as=require(_0xcbfc('0xf'));var hardwareService=require(_0xcbfc('0x10'));var logger=require('../../config/logger')(_0xcbfc('0x11'));var utils=require(_0xcbfc('0x12'));var config=require(_0xcbfc('0x13'));var db=require(_0xcbfc('0x14'))['db'];config[_0xcbfc('0x15')]=_['defaults'](config[_0xcbfc('0x15')],{'host':_0xcbfc('0x16'),'port':0x18eb});var socket=require(_0xcbfc('0x17'))(new Redis(config['redis']));require(_0xcbfc('0x18'))[_0xcbfc('0x19')](socket);var jayson=require(_0xcbfc('0x1a'));var client=jayson[_0xcbfc('0x1b')][_0xcbfc('0x1c')]({'port':0x232c});function checkPasswordPattern(_0x53a7ea,_0x3c69ed,_0x1963de){if(_0x1963de){var _0x1ec8c4=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x1ec8c4[_0xcbfc('0x1d')](_0x3c69ed)){return _0x53a7ea;}else{throw new db['Sequelize']['ValidationError'](_0xcbfc('0x1e'));}}else{return _0x53a7ea;}}function respondWithRpcPromise(_0xd8bbb3,_0xa65368,_0x4d6946,_0x5b078f){return new BPromise(function(_0x33f731,_0x99b59d){var _0x344510=_0x5b078f||client;return _0x344510['request'](_0xd8bbb3,_0x4d6946)[_0xcbfc('0x1f')](function(_0x552777){logger[_0xcbfc('0x20')](_0xcbfc('0x21'),_0xa65368,_0xcbfc('0x22'));logger[_0xcbfc('0x23')](_0xcbfc('0x24'),_0xa65368,_0xcbfc('0x22'),JSON['stringify'](_0x552777));if(_0x552777[_0xcbfc('0x25')]){if(_0x552777[_0xcbfc('0x25')]['code']===0x1f4){logger[_0xcbfc('0x25')]('WhatsappAccount,\x20%s,\x20%s',_0xa65368,_0x552777['error']['message']);return _0x99b59d(_0x552777[_0xcbfc('0x25')]['message']);}logger['error'](_0xcbfc('0x21'),_0xa65368,_0x552777[_0xcbfc('0x25')][_0xcbfc('0x26')]);return _0x33f731(_0x552777[_0xcbfc('0x25')]['message']);}else{logger[_0xcbfc('0x20')]('WhatsappAccount,\x20%s,\x20%s',_0xa65368,_0xcbfc('0x22'));_0x33f731(_0x552777[_0xcbfc('0x27')]['message']);}})[_0xcbfc('0x28')](function(_0x3b73a3){logger['error'](_0xcbfc('0x21'),_0xa65368,_0x3b73a3);_0x99b59d(_0x3b73a3);});});}function respondWithStatusCode(_0x3c3afd,_0x2f7549){_0x2f7549=_0x2f7549||0xcc;return function(_0x41f3b8){if(_0x41f3b8){return _0x3c3afd['sendStatus'](_0x2f7549);}return _0x3c3afd[_0xcbfc('0x29')](_0x2f7549)[_0xcbfc('0x2a')]();};}function respondWithResult(_0x4f632a,_0x1f6a14){_0x1f6a14=_0x1f6a14||0xc8;return function(_0x26463f){if(_0x26463f){return _0x4f632a[_0xcbfc('0x29')](_0x1f6a14)[_0xcbfc('0x2b')](_0x26463f);}};}function respondWithFilteredResult(_0x2b4286,_0x19d2e){return function(_0x203cec){if(_0x203cec){var _0x5366cf=_0x203cec[_0xcbfc('0x2c')],_0x41b68b=_0x19d2e['offset'],_0x433300=_0x19d2e[_0xcbfc('0x2d')]+_0x19d2e[_0xcbfc('0x2e')],_0x3f9d20;if(_0x433300>=_0x5366cf){_0x433300=_0x5366cf;_0x3f9d20=0xc8;}else{_0x3f9d20=0xce;}_0x2b4286[_0xcbfc('0x29')](_0x3f9d20);return _0x2b4286[_0xcbfc('0x2f')](_0xcbfc('0x30'),_0x41b68b+'-'+_0x433300+'/'+_0x5366cf)[_0xcbfc('0x2b')](_0x203cec);}return null;};}function patchUpdates(_0x7f7dda){return function(_0x544f7c){try{jsonpatch[_0xcbfc('0x31')](_0x544f7c,_0x7f7dda,!![]);}catch(_0x26172f){return BPromise['reject'](_0x26172f);}return _0x544f7c[_0xcbfc('0x32')]();};}function saveUpdates(_0x442cab,_0x145530){return function(_0x4f9334){if(_0x4f9334){return _0x4f9334['update'](_0x442cab)['then'](function(_0x3c6d04){return _0x3c6d04;});}return null;};}function removeEntity(_0x7e69bb,_0x1d47a4){return function(_0x9c1ff3){if(_0x9c1ff3){return _0x9c1ff3[_0xcbfc('0x33')]()[_0xcbfc('0x1f')](function(){var _0x856e83=_0x9c1ff3[_0xcbfc('0x34')]({'plain':!![]});var _0x49ad63=_0xcbfc('0x35');return db[_0xcbfc('0x36')]['destroy']({'where':{'type':_0x49ad63,'resourceId':_0x856e83['id']}})[_0xcbfc('0x1f')](function(){return _0x9c1ff3;});})['then'](function(){_0x7e69bb[_0xcbfc('0x29')](0xcc)[_0xcbfc('0x2a')]();});}};}function handleEntityNotFound(_0x43121e,_0x53ac0e){return function(_0x43f45b){if(!_0x43f45b){_0x43121e['sendStatus'](0x194);}return _0x43f45b;};}function handleError(_0x5af34d,_0x2baf2f){_0x2baf2f=_0x2baf2f||0x1f4;return function(_0x218772){logger[_0xcbfc('0x25')](_0x218772[_0xcbfc('0x37')]);if(_0x218772[_0xcbfc('0x38')]){delete _0x218772[_0xcbfc('0x38')];}_0x5af34d[_0xcbfc('0x29')](_0x2baf2f)[_0xcbfc('0x39')](_0x218772);};}exports['index']=function(_0x15fb08,_0x4aa064){var _0x15a5c4={'include':[{'model':db[_0xcbfc('0x3a')],'as':'mandatoryDispositionPause'}]},_0x44064d={},_0x312d28={'count':0x0,'rows':[]};var _0x5306e9=_[_0xcbfc('0x3b')](db[_0xcbfc('0x3c')][_0xcbfc('0x3d')],function(_0x291389){return{'name':_0x291389[_0xcbfc('0x3e')],'type':_0x291389['type'][_0xcbfc('0x3f')]};});_0x44064d[_0xcbfc('0x40')]=_[_0xcbfc('0x3b')](_0x5306e9,'name');_0x44064d[_0xcbfc('0x41')]=_[_0xcbfc('0x42')](_0x15fb08[_0xcbfc('0x41')]);_0x44064d['filters']=_[_0xcbfc('0x43')](_0x44064d[_0xcbfc('0x40')],_0x44064d[_0xcbfc('0x41')]);_0x15a5c4[_0xcbfc('0x44')]=_[_0xcbfc('0x43')](_0x44064d[_0xcbfc('0x40')],qs[_0xcbfc('0x45')](_0x15fb08['query'][_0xcbfc('0x45')]));_0x15a5c4[_0xcbfc('0x44')]=_0x15a5c4['attributes'][_0xcbfc('0x46')]?_0x15a5c4[_0xcbfc('0x44')]:_0x44064d[_0xcbfc('0x40')];if(!_0x15fb08[_0xcbfc('0x41')][_0xcbfc('0x47')](_0xcbfc('0x48'))){_0x15a5c4[_0xcbfc('0x2e')]=qs[_0xcbfc('0x2e')](_0x15fb08['query'][_0xcbfc('0x2e')]);_0x15a5c4[_0xcbfc('0x2d')]=qs[_0xcbfc('0x2d')](_0x15fb08[_0xcbfc('0x41')][_0xcbfc('0x2d')]);}_0x15a5c4[_0xcbfc('0x49')]=qs[_0xcbfc('0x4a')](_0x15fb08['query'][_0xcbfc('0x4a')]);_0x15a5c4[_0xcbfc('0x4b')]=qs['filters'](_[_0xcbfc('0x4c')](_0x15fb08[_0xcbfc('0x41')],_0x44064d[_0xcbfc('0x4d')]),_0x5306e9);if(_0x15fb08['query'][_0xcbfc('0x4e')]){_0x15a5c4[_0xcbfc('0x4b')]=_[_0xcbfc('0x4f')](_0x15a5c4[_0xcbfc('0x4b')],{'$or':_[_0xcbfc('0x3b')](_0x5306e9,function(_0xe0025a){if(_0xe0025a[_0xcbfc('0x50')]!=='VIRTUAL'){var _0x5a87b6={};_0x5a87b6[_0xe0025a[_0xcbfc('0x38')]]={'$like':'%'+_0x15fb08[_0xcbfc('0x41')][_0xcbfc('0x4e')]+'%'};return _0x5a87b6;}})});}_0x15a5c4=_[_0xcbfc('0x4f')]({},_0x15a5c4,_0x15fb08['options']);var _0x52a835={'where':_0x15a5c4[_0xcbfc('0x4b')]};return db[_0xcbfc('0x3c')][_0xcbfc('0x2c')](_0x52a835)['then'](function(_0x155236){_0x312d28[_0xcbfc('0x2c')]=_0x155236;if(_0x15fb08[_0xcbfc('0x41')]['includeAll']){_0x15a5c4[_0xcbfc('0x51')]=[{'all':!![]}];}return db[_0xcbfc('0x3c')][_0xcbfc('0x52')](_0x15a5c4);})[_0xcbfc('0x1f')](function(_0x32e0c3){_0x312d28[_0xcbfc('0x53')]=_0x32e0c3;return _0x312d28;})[_0xcbfc('0x1f')](respondWithFilteredResult(_0x4aa064,_0x15a5c4))[_0xcbfc('0x28')](handleError(_0x4aa064,null));};exports[_0xcbfc('0x54')]=function(_0xdee298,_0x48b5c8){var _0x3fb619={'raw':![],'where':{'id':_0xdee298[_0xcbfc('0x55')]['id']},'include':[{'model':db['Pause'],'as':_0xcbfc('0x56')}]},_0x3a2c1a={};_0x3a2c1a[_0xcbfc('0x40')]=_['keys'](db[_0xcbfc('0x3c')][_0xcbfc('0x3d')]);_0x3a2c1a[_0xcbfc('0x41')]=_[_0xcbfc('0x42')](_0xdee298['query']);_0x3a2c1a[_0xcbfc('0x4d')]=_[_0xcbfc('0x43')](_0x3a2c1a['model'],_0x3a2c1a[_0xcbfc('0x41')]);_0x3fb619[_0xcbfc('0x44')]=_[_0xcbfc('0x43')](_0x3a2c1a[_0xcbfc('0x40')],qs[_0xcbfc('0x45')](_0xdee298[_0xcbfc('0x41')][_0xcbfc('0x45')]));_0x3fb619[_0xcbfc('0x44')]=_0x3fb619[_0xcbfc('0x44')][_0xcbfc('0x46')]?_0x3fb619['attributes']:_0x3a2c1a[_0xcbfc('0x40')];if(_0xdee298['query']['includeAll']){_0x3fb619['include']=[{'all':!![]}];}_0x3fb619=_[_0xcbfc('0x4f')]({},_0x3fb619,_0xdee298[_0xcbfc('0x57')]);return db[_0xcbfc('0x3c')][_0xcbfc('0x58')](_0x3fb619)[_0xcbfc('0x1f')](handleEntityNotFound(_0x48b5c8,null))[_0xcbfc('0x1f')](respondWithResult(_0x48b5c8,null))[_0xcbfc('0x28')](handleError(_0x48b5c8,null));};exports[_0xcbfc('0x59')]=function(_0x4d2df1,_0x9e0c38){return db[_0xcbfc('0x3c')][_0xcbfc('0x59')](_0x4d2df1['body'],{})[_0xcbfc('0x1f')](function(_0x2c5c9e){var _0x1ad026=_0x4d2df1[_0xcbfc('0x5a')][_0xcbfc('0x34')]({'plain':!![]});if(!_0x1ad026)throw new Error(_0xcbfc('0x5b'));if(_0x1ad026[_0xcbfc('0x5c')]==='user'){var _0x329ae6=_0x2c5c9e['get']({'plain':!![]});var _0x1e0492=_0xcbfc('0x35');return db['UserProfileSection'][_0xcbfc('0x58')]({'where':{'name':_0x1e0492,'userProfileId':_0x1ad026['userProfileId']},'raw':!![]})[_0xcbfc('0x1f')](function(_0x3e6cbf){if(_0x3e6cbf&&_0x3e6cbf[_0xcbfc('0x5d')]===0x0){return db[_0xcbfc('0x36')][_0xcbfc('0x59')]({'name':_0x329ae6[_0xcbfc('0x38')],'resourceId':_0x329ae6['id'],'type':_0x3e6cbf['name'],'sectionId':_0x3e6cbf['id']},{})[_0xcbfc('0x1f')](function(){return _0x2c5c9e;});}else{return _0x2c5c9e;}})[_0xcbfc('0x28')](function(_0x5a78c9){logger[_0xcbfc('0x25')](_0xcbfc('0x5e'),_0x5a78c9);throw _0x5a78c9;});}return _0x2c5c9e;})[_0xcbfc('0x1f')](respondWithResult(_0x9e0c38,0xc9))[_0xcbfc('0x28')](handleError(_0x9e0c38,null));};exports[_0xcbfc('0x5f')]=function(_0x3af38b,_0x2bf39a){if(_0x3af38b[_0xcbfc('0x60')]['id']){delete _0x3af38b['body']['id'];}return db[_0xcbfc('0x3c')][_0xcbfc('0x58')]({'where':{'id':_0x3af38b[_0xcbfc('0x55')]['id']},'include':[{'model':db[_0xcbfc('0x3a')],'as':_0xcbfc('0x56')}]})[_0xcbfc('0x1f')](handleEntityNotFound(_0x2bf39a,null))[_0xcbfc('0x1f')](saveUpdates(_0x3af38b[_0xcbfc('0x60')],null))[_0xcbfc('0x1f')](respondWithResult(_0x2bf39a,null))[_0xcbfc('0x28')](handleError(_0x2bf39a,null));};exports['destroy']=function(_0x185303,_0x108768){return db['WhatsappAccount'][_0xcbfc('0x58')]({'where':{'id':_0x185303['params']['id']}})['then'](handleEntityNotFound(_0x108768,null))[_0xcbfc('0x1f')](removeEntity(_0x108768,null))[_0xcbfc('0x28')](handleError(_0x108768,null));};exports[_0xcbfc('0x61')]=function(_0x133829,_0x33d4d8){return db['WhatsappAccount']['describe']()[_0xcbfc('0x1f')](respondWithResult(_0x33d4d8,null))[_0xcbfc('0x28')](handleError(_0x33d4d8,null));};exports[_0xcbfc('0x62')]=function(_0x26cb3a,_0x17e42f,_0x53012d){if(_0x26cb3a[_0xcbfc('0x60')]['id']){delete _0x26cb3a[_0xcbfc('0x60')]['id'];}return db[_0xcbfc('0x3c')]['find']({'where':{'id':_0x26cb3a['params']['id']}})['then'](handleEntityNotFound(_0x17e42f,null))[_0xcbfc('0x1f')](function(_0x47f928){if(_0x47f928){_0x26cb3a['body'][_0xcbfc('0x63')]=_0x47f928['id'];return db['Disposition'][_0xcbfc('0x59')](_0x26cb3a[_0xcbfc('0x60')]);}})[_0xcbfc('0x1f')](respondWithResult(_0x17e42f,null))[_0xcbfc('0x28')](handleError(_0x17e42f,null));};exports[_0xcbfc('0x64')]=function(_0x4923e5,_0x25d2a7,_0xd3c182){var _0x1140d1={'raw':![],'where':{}};var _0x538954={};var _0xa490ee={'count':0x0,'rows':[]};return db[_0xcbfc('0x3c')][_0xcbfc('0x65')]({'where':{'id':_0x4923e5['params']['id']}})[_0xcbfc('0x1f')](handleEntityNotFound(_0x25d2a7,null))[_0xcbfc('0x1f')](function(_0x18863c){if(_0x18863c){_0x538954[_0xcbfc('0x40')]=_[_0xcbfc('0x42')](db[_0xcbfc('0x66')][_0xcbfc('0x3d')]);_0x538954['query']=_[_0xcbfc('0x42')](_0x4923e5['query']);_0x538954[_0xcbfc('0x4d')]=_[_0xcbfc('0x43')](_0x538954[_0xcbfc('0x40')],_0x538954['query']);_0x1140d1[_0xcbfc('0x44')]=_['intersection'](_0x538954[_0xcbfc('0x40')],qs[_0xcbfc('0x45')](_0x4923e5[_0xcbfc('0x41')][_0xcbfc('0x45')]));_0x1140d1[_0xcbfc('0x44')]=_0x1140d1[_0xcbfc('0x44')][_0xcbfc('0x46')]?_0x1140d1['attributes']:_0x538954[_0xcbfc('0x40')];if(!_0x4923e5[_0xcbfc('0x41')][_0xcbfc('0x47')]('nolimit')){_0x1140d1[_0xcbfc('0x2e')]=qs['limit'](_0x4923e5[_0xcbfc('0x41')][_0xcbfc('0x2e')]);_0x1140d1[_0xcbfc('0x2d')]=qs['offset'](_0x4923e5[_0xcbfc('0x41')][_0xcbfc('0x2d')]);}_0x1140d1['order']=qs[_0xcbfc('0x4a')](_0x4923e5['query'][_0xcbfc('0x4a')]);_0x1140d1['where']=qs[_0xcbfc('0x4d')](_[_0xcbfc('0x4c')](_0x4923e5['query'],_0x538954[_0xcbfc('0x4d')]));_0x1140d1['where'][_0xcbfc('0x63')]=_0x18863c['id'];if(_0x4923e5[_0xcbfc('0x41')][_0xcbfc('0x4e')]){_0x1140d1[_0xcbfc('0x4b')]=_['merge'](_0x1140d1[_0xcbfc('0x4b')],{'$or':_['map'](_0x1140d1[_0xcbfc('0x44')],function(_0x44c295){var _0xab8e52={};_0xab8e52[_0x44c295]={'$like':'%'+_0x4923e5[_0xcbfc('0x41')][_0xcbfc('0x4e')]+'%'};return _0xab8e52;})});}_0x1140d1=_[_0xcbfc('0x4f')]({},_0x1140d1,_0x4923e5[_0xcbfc('0x57')]);return db[_0xcbfc('0x66')][_0xcbfc('0x2c')]({'where':_0x1140d1[_0xcbfc('0x4b')]})[_0xcbfc('0x1f')](function(_0x297513){_0xa490ee[_0xcbfc('0x2c')]=_0x297513;if(_0x4923e5[_0xcbfc('0x41')][_0xcbfc('0x67')]){_0x1140d1[_0xcbfc('0x51')]=[{'all':!![]}];}return db[_0xcbfc('0x66')]['findAll'](_0x1140d1);})[_0xcbfc('0x1f')](function(_0x59725a){_0xa490ee[_0xcbfc('0x53')]=_0x59725a;return _0xa490ee;});}})['then'](respondWithFilteredResult(_0x25d2a7,_0x1140d1))[_0xcbfc('0x28')](handleError(_0x25d2a7,null));};exports[_0xcbfc('0x68')]=function(_0x3bbe6d,_0x2f99a3,_0x386156){return db[_0xcbfc('0x3c')][_0xcbfc('0x58')]({'where':{'id':_0x3bbe6d['params']['id']}})[_0xcbfc('0x1f')](handleEntityNotFound(_0x2f99a3,null))['then'](function(_0x144c8d){if(_0x144c8d){return _0x144c8d[_0xcbfc('0x68')](_0x3bbe6d['query']['ids']);}})['then'](respondWithStatusCode(_0x2f99a3,null))[_0xcbfc('0x28')](handleError(_0x2f99a3,null));};exports[_0xcbfc('0x69')]=function(_0x12238c,_0x511463,_0x4f298c){if(_0x12238c[_0xcbfc('0x60')]['id']){delete _0x12238c[_0xcbfc('0x60')]['id'];}return db[_0xcbfc('0x3c')][_0xcbfc('0x58')]({'where':{'id':_0x12238c[_0xcbfc('0x55')]['id']}})['then'](handleEntityNotFound(_0x511463,null))['then'](function(_0x5ee979){if(_0x5ee979){_0x12238c[_0xcbfc('0x60')][_0xcbfc('0x63')]=_0x5ee979['id'];return db[_0xcbfc('0x6a')][_0xcbfc('0x59')](_0x12238c['body']);}})['then'](respondWithResult(_0x511463,null))[_0xcbfc('0x28')](handleError(_0x511463,null));};exports[_0xcbfc('0x6b')]=function(_0xcd6615,_0x3053d9,_0x36ab87){var _0x57fe81={'raw':![],'where':{}};var _0x560505={};var _0x20d523={'count':0x0,'rows':[]};return db[_0xcbfc('0x3c')][_0xcbfc('0x65')]({'where':{'id':_0xcd6615[_0xcbfc('0x55')]['id']}})[_0xcbfc('0x1f')](handleEntityNotFound(_0x3053d9,null))[_0xcbfc('0x1f')](function(_0x182471){if(_0x182471){_0x560505[_0xcbfc('0x40')]=_[_0xcbfc('0x42')](db[_0xcbfc('0x6a')][_0xcbfc('0x3d')]);_0x560505[_0xcbfc('0x41')]=_[_0xcbfc('0x42')](_0xcd6615[_0xcbfc('0x41')]);_0x560505['filters']=_['intersection'](_0x560505[_0xcbfc('0x40')],_0x560505[_0xcbfc('0x41')]);_0x57fe81[_0xcbfc('0x44')]=_['intersection'](_0x560505[_0xcbfc('0x40')],qs[_0xcbfc('0x45')](_0xcd6615[_0xcbfc('0x41')][_0xcbfc('0x45')]));_0x57fe81['attributes']=_0x57fe81['attributes'][_0xcbfc('0x46')]?_0x57fe81[_0xcbfc('0x44')]:_0x560505[_0xcbfc('0x40')];if(!_0xcd6615[_0xcbfc('0x41')][_0xcbfc('0x47')](_0xcbfc('0x48'))){_0x57fe81[_0xcbfc('0x2e')]=qs[_0xcbfc('0x2e')](_0xcd6615[_0xcbfc('0x41')][_0xcbfc('0x2e')]);_0x57fe81[_0xcbfc('0x2d')]=qs[_0xcbfc('0x2d')](_0xcd6615[_0xcbfc('0x41')][_0xcbfc('0x2d')]);}_0x57fe81[_0xcbfc('0x49')]=qs[_0xcbfc('0x4a')](_0xcd6615[_0xcbfc('0x41')][_0xcbfc('0x4a')]);_0x57fe81[_0xcbfc('0x4b')]=qs['filters'](_[_0xcbfc('0x4c')](_0xcd6615['query'],_0x560505[_0xcbfc('0x4d')]));_0x57fe81['where'][_0xcbfc('0x63')]=_0x182471['id'];if(_0xcd6615['query']['filter']){_0x57fe81['where']=_[_0xcbfc('0x4f')](_0x57fe81[_0xcbfc('0x4b')],{'$or':_[_0xcbfc('0x3b')](_0x57fe81[_0xcbfc('0x44')],function(_0x3fb8e1){var _0x5a2b33={};_0x5a2b33[_0x3fb8e1]={'$like':'%'+_0xcd6615[_0xcbfc('0x41')][_0xcbfc('0x4e')]+'%'};return _0x5a2b33;})});}_0x57fe81=_[_0xcbfc('0x4f')]({},_0x57fe81,_0xcd6615[_0xcbfc('0x57')]);return db[_0xcbfc('0x6a')][_0xcbfc('0x2c')]({'where':_0x57fe81[_0xcbfc('0x4b')]})[_0xcbfc('0x1f')](function(_0x48078d){_0x20d523[_0xcbfc('0x2c')]=_0x48078d;if(_0xcd6615[_0xcbfc('0x41')][_0xcbfc('0x67')]){_0x57fe81['include']=[{'all':!![]}];}return db[_0xcbfc('0x6a')][_0xcbfc('0x52')](_0x57fe81);})[_0xcbfc('0x1f')](function(_0x10299e){_0x20d523['rows']=_0x10299e;return _0x20d523;});}})[_0xcbfc('0x1f')](respondWithFilteredResult(_0x3053d9,_0x57fe81))[_0xcbfc('0x28')](handleError(_0x3053d9,null));};exports[_0xcbfc('0x6c')]=function(_0x355b7c,_0x3ace3c,_0x3dc2b1){return db[_0xcbfc('0x3c')][_0xcbfc('0x58')]({'where':{'id':_0x355b7c[_0xcbfc('0x55')]['id']}})[_0xcbfc('0x1f')](handleEntityNotFound(_0x3ace3c,null))['then'](function(_0x4d6bf6){if(_0x4d6bf6){return _0x4d6bf6[_0xcbfc('0x6c')](_0x355b7c[_0xcbfc('0x41')][_0xcbfc('0x6d')]);}})['then'](respondWithStatusCode(_0x3ace3c,null))[_0xcbfc('0x28')](handleError(_0x3ace3c,null));};exports['addAgents']=function(_0x5bd871,_0x47e307,_0x58f952){return db[_0xcbfc('0x3c')][_0xcbfc('0x58')]({'where':{'id':_0x5bd871[_0xcbfc('0x55')]['id']}})[_0xcbfc('0x1f')](handleEntityNotFound(_0x47e307,null))[_0xcbfc('0x1f')](function(_0x4d8f4f){if(_0x4d8f4f){return _0x4d8f4f[_0xcbfc('0x6e')](_0x5bd871[_0xcbfc('0x60')][_0xcbfc('0x6d')],_['omit'](_0x5bd871[_0xcbfc('0x60')],['ids','id'])||{})['spread'](function(_0x24e0ca){for(var _0x26940d=0x0;_0x26940d<_0x5bd871[_0xcbfc('0x60')]['ids'][_0xcbfc('0x46')];_0x26940d+=0x1){socket[_0xcbfc('0x6f')](_0xcbfc('0x70'),{'UserId':_0x5bd871['body'][_0xcbfc('0x6d')][_0x26940d],'WhatsappAccountId':_0x5bd871[_0xcbfc('0x55')]['id']});}return _0x24e0ca;});}})[_0xcbfc('0x1f')](respondWithResult(_0x47e307,null))[_0xcbfc('0x28')](handleError(_0x47e307,null));};exports[_0xcbfc('0x71')]=function(_0x5abde1,_0x2665c0,_0x2e187e){return db[_0xcbfc('0x3c')]['find']({'where':{'id':_0x5abde1[_0xcbfc('0x55')]['id']}})[_0xcbfc('0x1f')](handleEntityNotFound(_0x2665c0,null))[_0xcbfc('0x1f')](function(_0xc7dd85){if(_0xc7dd85){return _0xc7dd85['removeAgents'](_0x5abde1[_0xcbfc('0x41')][_0xcbfc('0x6d')])[_0xcbfc('0x1f')](function(){if(_[_0xcbfc('0x72')](_0x5abde1[_0xcbfc('0x41')][_0xcbfc('0x6d')])){for(var _0x5ac72c=0x0;_0x5ac72c<_0x5abde1['query']['ids']['length'];_0x5ac72c+=0x1){socket[_0xcbfc('0x6f')](_0xcbfc('0x73'),{'UserId':Number(_0x5abde1[_0xcbfc('0x41')][_0xcbfc('0x6d')][_0x5ac72c]),'WhatsappAccountId':Number(_0x5abde1[_0xcbfc('0x55')]['id'])});}}else{socket[_0xcbfc('0x6f')](_0xcbfc('0x73'),{'UserId':Number(_0x5abde1['query'][_0xcbfc('0x6d')]),'WhatsappAccountId':Number(_0x5abde1['params']['id'])});}});}})[_0xcbfc('0x1f')](respondWithStatusCode(_0x2665c0,null))[_0xcbfc('0x28')](handleError(_0x2665c0,null));};exports[_0xcbfc('0x74')]=function(_0x2cf01d,_0x5066c3,_0x270345){var _0x2d9156={};var _0x2478d0={};var _0x10b32c;var _0xbff166;return db[_0xcbfc('0x3c')][_0xcbfc('0x65')]({'where':{'id':_0x2cf01d[_0xcbfc('0x55')]['id']}})[_0xcbfc('0x1f')](handleEntityNotFound(_0x5066c3,null))[_0xcbfc('0x1f')](function(_0x31a2e9){if(_0x31a2e9){_0x10b32c=_0x31a2e9;_0x2478d0[_0xcbfc('0x40')]=_['keys'](db[_0xcbfc('0x75')][_0xcbfc('0x3d')]);_0x2478d0[_0xcbfc('0x41')]=_[_0xcbfc('0x42')](_0x2cf01d[_0xcbfc('0x41')]);_0x2478d0[_0xcbfc('0x4d')]=_[_0xcbfc('0x43')](_0x2478d0[_0xcbfc('0x40')],_0x2478d0[_0xcbfc('0x41')]);_0x2d9156['attributes']=_[_0xcbfc('0x43')](_0x2478d0['model'],qs['fields'](_0x2cf01d[_0xcbfc('0x41')][_0xcbfc('0x45')]));_0x2d9156[_0xcbfc('0x44')]=_0x2d9156[_0xcbfc('0x44')][_0xcbfc('0x46')]?_0x2d9156[_0xcbfc('0x44')]:_0x2478d0[_0xcbfc('0x40')];_0x2d9156[_0xcbfc('0x49')]=qs[_0xcbfc('0x4a')](_0x2cf01d[_0xcbfc('0x41')][_0xcbfc('0x4a')]);_0x2d9156['where']=qs[_0xcbfc('0x4d')](_['pick'](_0x2cf01d[_0xcbfc('0x41')],_0x2478d0[_0xcbfc('0x4d')]));if(_0x2cf01d[_0xcbfc('0x41')][_0xcbfc('0x4e')]){_0x2d9156[_0xcbfc('0x4b')]=_[_0xcbfc('0x4f')](_0x2d9156[_0xcbfc('0x4b')],{'$or':_[_0xcbfc('0x3b')](_0x2d9156[_0xcbfc('0x44')],function(_0x389a8a){var _0x2f6b7f={};_0x2f6b7f[_0x389a8a]={'$like':'%'+_0x2cf01d[_0xcbfc('0x41')][_0xcbfc('0x4e')]+'%'};return _0x2f6b7f;})});}_0x2d9156=_[_0xcbfc('0x4f')]({},_0x2d9156,_0x2cf01d[_0xcbfc('0x57')]);return _0x10b32c[_0xcbfc('0x74')](_0x2d9156);}})[_0xcbfc('0x1f')](function(_0x2dd811){if(_0x2dd811){_0xbff166=_0x2dd811[_0xcbfc('0x46')];if(!_0x2cf01d[_0xcbfc('0x41')][_0xcbfc('0x47')](_0xcbfc('0x48'))){_0x2d9156[_0xcbfc('0x2e')]=qs['limit'](_0x2cf01d['query']['limit']);_0x2d9156[_0xcbfc('0x2d')]=qs[_0xcbfc('0x2d')](_0x2cf01d[_0xcbfc('0x41')][_0xcbfc('0x2d')]);}return _0x10b32c[_0xcbfc('0x74')](_0x2d9156);}})[_0xcbfc('0x1f')](function(_0x44e3fc){if(_0x44e3fc){return _0x44e3fc?{'count':_0xbff166,'rows':_0x44e3fc}:null;}})[_0xcbfc('0x1f')](respondWithResult(_0x5066c3,null))[_0xcbfc('0x28')](handleError(_0x5066c3,null));};exports[_0xcbfc('0x76')]=function(_0x5cfebe,_0x2d813a,_0x3e993c){return db[_0xcbfc('0x3c')][_0xcbfc('0x65')]({'where':{'id':_0x5cfebe[_0xcbfc('0x55')]['id']}})['then'](handleEntityNotFound(_0x2d813a,null))[_0xcbfc('0x1f')](function(_0x1b6fcd){if(_0x1b6fcd){return db[_0xcbfc('0x77')][_0xcbfc('0x78')](function(_0x19cb9a){return db[_0xcbfc('0x79')][_0xcbfc('0x33')]({'where':{'WhatsappAccountId':_0x5cfebe[_0xcbfc('0x55')]['id']},'transaction':_0x19cb9a})[_0xcbfc('0x1f')](function(_0x483cfc){var _0xe33430=_['map'](_0x5cfebe['body'],function(_0x3680bd){_0x3680bd[_0xcbfc('0x63')]=_0x5cfebe[_0xcbfc('0x55')]['id'];return _0x3680bd;});return db['WhatsappApplication'][_0xcbfc('0x7a')](_0xe33430,{'transaction':_0x19cb9a});});})[_0xcbfc('0x1f')](function(){return db[_0xcbfc('0x79')][_0xcbfc('0x7b')]({'where':{'WhatsappAccountId':_0x5cfebe[_0xcbfc('0x55')]['id']},'order':_0xcbfc('0x7c')});});}})['then'](respondWithResult(_0x2d813a,null))[_0xcbfc('0x28')](handleError(_0x2d813a,null));};exports[_0xcbfc('0x7d')]=function(_0x2b9b08,_0x85665b,_0x212c00){var _0x241b30={};var _0x68bbab={};var _0x54bcba;var _0x4637ce;return db[_0xcbfc('0x3c')]['findOne']({'where':{'id':_0x2b9b08['params']['id']}})['then'](handleEntityNotFound(_0x85665b,null))[_0xcbfc('0x1f')](function(_0x2d20f8){if(_0x2d20f8){_0x54bcba=_0x2d20f8;_0x68bbab[_0xcbfc('0x40')]=_[_0xcbfc('0x42')](db['WhatsappApplication']['rawAttributes']);_0x68bbab[_0xcbfc('0x41')]=_[_0xcbfc('0x42')](_0x2b9b08['query']);_0x68bbab[_0xcbfc('0x4d')]=_[_0xcbfc('0x43')](_0x68bbab['model'],_0x68bbab[_0xcbfc('0x41')]);_0x241b30[_0xcbfc('0x44')]=_[_0xcbfc('0x43')](_0x68bbab[_0xcbfc('0x40')],qs[_0xcbfc('0x45')](_0x2b9b08['query'][_0xcbfc('0x45')]));_0x241b30[_0xcbfc('0x44')]=_0x241b30[_0xcbfc('0x44')][_0xcbfc('0x46')]?_0x241b30['attributes']:_0x68bbab[_0xcbfc('0x40')];_0x241b30[_0xcbfc('0x49')]=qs[_0xcbfc('0x4a')](_0x2b9b08[_0xcbfc('0x41')][_0xcbfc('0x4a')]);_0x241b30[_0xcbfc('0x4b')]=qs['filters'](_[_0xcbfc('0x4c')](_0x2b9b08['query'],_0x68bbab[_0xcbfc('0x4d')]));if(_0x2b9b08[_0xcbfc('0x41')][_0xcbfc('0x4e')]){_0x241b30['where']=_[_0xcbfc('0x4f')](_0x241b30[_0xcbfc('0x4b')],{'$or':_[_0xcbfc('0x3b')](_0x241b30[_0xcbfc('0x44')],function(_0x4661d){var _0x18e451={};_0x18e451[_0x4661d]={'$like':'%'+_0x2b9b08[_0xcbfc('0x41')]['filter']+'%'};return _0x18e451;})});}_0x241b30=_[_0xcbfc('0x4f')]({},_0x241b30,_0x2b9b08[_0xcbfc('0x57')]);return _0x54bcba[_0xcbfc('0x7d')](_0x241b30);}})[_0xcbfc('0x1f')](function(_0x22e3b6){if(_0x22e3b6){_0x4637ce=_0x22e3b6[_0xcbfc('0x46')];if(!_0x2b9b08[_0xcbfc('0x41')]['hasOwnProperty'](_0xcbfc('0x48'))){_0x241b30['limit']=qs[_0xcbfc('0x2e')](_0x2b9b08[_0xcbfc('0x41')][_0xcbfc('0x2e')]);_0x241b30['offset']=qs[_0xcbfc('0x2d')](_0x2b9b08['query'][_0xcbfc('0x2d')]);}return _0x54bcba[_0xcbfc('0x7d')](_0x241b30);}})[_0xcbfc('0x1f')](function(_0x35cd37){if(_0x35cd37){return _0x35cd37?{'count':_0x4637ce,'rows':_0x35cd37}:null;}})[_0xcbfc('0x1f')](respondWithResult(_0x85665b,null))[_0xcbfc('0x28')](handleError(_0x85665b,null));};exports[_0xcbfc('0x7e')]=function(_0x4f5bab,_0x210218,_0x59f7a8){var _0x422e8c={'channel':_0xcbfc('0x7f')};var _0x31f657=[];var _0x141bfe=[];var _0x34d23a={};return db[_0xcbfc('0x3c')][_0xcbfc('0x58')]({'where':{'id':_0x4f5bab[_0xcbfc('0x55')]['id']},'include':[{'model':db[_0xcbfc('0x79')],'as':_0xcbfc('0x80')}]})[_0xcbfc('0x1f')](handleEntityNotFound(_0x210218,null))[_0xcbfc('0x1f')](function(_0x36ab9c){_0x422e8c[_0xcbfc('0x81')]=_0x36ab9c;_0x422e8c[_0xcbfc('0x82')]=_[_0xcbfc('0x83')](_0x36ab9c[_0xcbfc('0x80')],[_0xcbfc('0x7c')],[_0xcbfc('0x84')]);if(_0x422e8c[_0xcbfc('0x81')][_0xcbfc('0x80')]){delete _0x422e8c['account'][_0xcbfc('0x80')];}return db[_0xcbfc('0x85')][_0xcbfc('0x61')]();})[_0xcbfc('0x1f')](function(_0x4dbabd){if(!_0x4dbabd){throw new db['Sequelize'][(_0xcbfc('0x86'))](_0xcbfc('0x87'));}_0x31f657=_['difference'](_['keys'](_0x4dbabd),[_0xcbfc('0x88'),_0xcbfc('0x89')]);_0x141bfe=_['difference'](_['keys'](_0x4dbabd),[_0xcbfc('0x88'),_0xcbfc('0x89'),_0xcbfc('0x8a'),_0xcbfc('0x8b')]);_0x422e8c[_0xcbfc('0x60')]={'mapKey':_0xcbfc('0x8c')};if(_0x422e8c[_0xcbfc('0x81')][_0xcbfc('0x50')]&&_0x422e8c[_0xcbfc('0x81')][_0xcbfc('0x50')]===_0xcbfc('0x8d')){_0x422e8c['body'][_0xcbfc('0x8e')]=_0x4f5bab[_0xcbfc('0x60')][_0xcbfc('0x8f')][_0xcbfc('0x90')](_0xcbfc('0x91'),'');_0x422e8c[_0xcbfc('0x60')][_0xcbfc('0x60')]=_0x4f5bab[_0xcbfc('0x60')][_0xcbfc('0x92')];_0x422e8c[_0xcbfc('0x60')]['messageId']=_0x4f5bab[_0xcbfc('0x60')][_0xcbfc('0x93')];}if(_0x422e8c[_0xcbfc('0x60')]['id']){delete _0x422e8c[_0xcbfc('0x60')]['id'];}if(_[_0xcbfc('0x94')](_0x422e8c['body'][_0xcbfc('0x8e')])){throw new db[(_0xcbfc('0x95'))][(_0xcbfc('0x86'))]('from\x20is\x20mandatory');}if(_[_0xcbfc('0x94')](_0x422e8c['body'][_0xcbfc('0x60')])||_0x422e8c[_0xcbfc('0x60')]['body']===''){throw new db[(_0xcbfc('0x95'))][(_0xcbfc('0x86'))](_0xcbfc('0x96'));}if(_['isNil'](_0x422e8c[_0xcbfc('0x60')][_0xcbfc('0x97')])){throw new db[(_0xcbfc('0x95'))][(_0xcbfc('0x86'))](_0xcbfc('0x98')+_0x141bfe);}if(!_[_0xcbfc('0x99')](_0x141bfe,_0x422e8c['body'][_0xcbfc('0x97')])){throw new db[(_0xcbfc('0x95'))][(_0xcbfc('0x86'))](_0xcbfc('0x9a')+_0x141bfe);}_0x34d23a[_0x422e8c[_0xcbfc('0x60')][_0xcbfc('0x97')]]=_0x422e8c['body'][_0xcbfc('0x8e')];return db[_0xcbfc('0x9b')]['find']({'where':{'id':_0x422e8c['account'][_0xcbfc('0x8b')]},'include':[{'model':db[_0xcbfc('0x85')],'as':'Contacts','where':_0x34d23a,'limit':0x1,'order':[[_0xcbfc('0x89'),_0xcbfc('0x9c')]]}]});})[_0xcbfc('0x1f')](handleEntityNotFound(_0x210218,null))[_0xcbfc('0x1f')](function(_0x543b4b){if(_0x543b4b){_0x422e8c[_0xcbfc('0x9d')]=_[_0xcbfc('0x9e')](_0x543b4b,[_0xcbfc('0x9f')]);if(_0x543b4b[_0xcbfc('0x9f')][_0xcbfc('0x46')]){return _0x543b4b[_0xcbfc('0x9f')][0x0];}var _0x50c3aa=_[_0xcbfc('0xa0')](_0x422e8c[_0xcbfc('0x60')],{'firstName':_0x422e8c[_0xcbfc('0x60')][_0xcbfc('0x8e')],'ListId':_0x543b4b['id']});_0x50c3aa[_0x422e8c[_0xcbfc('0x60')]['mapKey']]=_0x422e8c['body'][_0xcbfc('0x8e')];return db[_0xcbfc('0x85')][_0xcbfc('0x59')](_0x50c3aa,{'fields':_0x31f657,'raw':!![]});}})[_0xcbfc('0x1f')](handleEntityNotFound(_0x210218,null))[_0xcbfc('0x1f')](function(_0x433d8e){if(_0x433d8e){_0x422e8c[_0xcbfc('0xa1')]=_0x433d8e;var _0x32b8ca={'ContactId':_0x433d8e['id'],'phone':_0x422e8c[_0xcbfc('0x60')][_0xcbfc('0x8e')],'WhatsappAccountId':_0x4f5bab[_0xcbfc('0x55')]['id']};var _0x18b44a={'ContactId':_0x433d8e['id'],'WhatsappAccountId':_0x4f5bab[_0xcbfc('0x55')]['id'],'closed':![]};return db[_0xcbfc('0xa2')][_0xcbfc('0x58')]({'where':_0x18b44a})[_0xcbfc('0x1f')](function(_0x5d97d9){if(_0x5d97d9){return[_0x5d97d9,![]];}return db[_0xcbfc('0xa2')][_0xcbfc('0x59')](_0x32b8ca)[_0xcbfc('0x1f')](function(_0x2898c8){return[_0x2898c8,!![]];});});}})[_0xcbfc('0xa3')](function(_0x52a328,_0x4ef47f){_0x422e8c[_0xcbfc('0xa4')]=_0x52a328[_0xcbfc('0x34')]({'plain':!![]});_0x422e8c[_0xcbfc('0xa4')][_0xcbfc('0xa5')]=![];if(_0x4ef47f){if(_0x422e8c[_0xcbfc('0x81')]['autoclose']){_0x422e8c[_0xcbfc('0x82')][_0xcbfc('0xa6')]({'id':0x0,'priority':_0x422e8c[_0xcbfc('0x82')]['length']+0x1,'app':_0xcbfc('0xa7'),'appdata':_0xcbfc('0xa8'),'interval':_0xcbfc('0xa9')});}_0x422e8c['interaction'][_0xcbfc('0xa5')]=!![];}return db['WhatsappMessage'][_0xcbfc('0x59')]({'phone':_0x422e8c[_0xcbfc('0x60')][_0xcbfc('0x8e')],'messageId':_0x422e8c['body'][_0xcbfc('0xaa')],'body':_0x422e8c[_0xcbfc('0x60')]['body'],'WhatsappAccountId':_0x4f5bab['params']['id'],'WhatsappInteractionId':_0x52a328['id'],'direction':'in','ContactId':_0x52a328[_0xcbfc('0xab')],'AttachmentId':_0x422e8c[_0xcbfc('0x60')][_0xcbfc('0xac')]});})[_0xcbfc('0x1f')](function(_0x31d70e){_0x422e8c[_0xcbfc('0x26')]=_0x31d70e;if(_0x422e8c[_0xcbfc('0xa4')][_0xcbfc('0xad')]){return db[_0xcbfc('0x75')][_0xcbfc('0x58')]({'attributes':['id',_0xcbfc('0x38')],'where':{'id':_0x422e8c['interaction'][_0xcbfc('0xad')]}})[_0xcbfc('0x1f')](function(_0x85c5c6){if(_0x85c5c6){_0x422e8c[_0xcbfc('0x82')]['unshift']({'id':0x0,'priority':0x0,'app':_0xcbfc('0xae'),'appdata':_0x85c5c6[_0xcbfc('0x38')]+','+(_0x422e8c['account'][_0xcbfc('0xaf')]||0xa),'interval':_0xcbfc('0xa9')});}return respondWithRpcPromise('Start','startRouting',_0x422e8c);});}return respondWithRpcPromise(_0xcbfc('0xb0'),_0xcbfc('0xb1'),_0x422e8c);})[_0xcbfc('0x1f')](function(_0x58a735){if(_0x58a735){var _0x3823a6=0xc8;var _0x2cad6b=_0xcbfc('0xb2');logger[_0xcbfc('0x20')](_0xcbfc('0x24'),_0x2cad6b,_0x3823a6,_0xcbfc('0xb3'));logger[_0xcbfc('0x23')](_0xcbfc('0xb4'),_0x2cad6b,_0x3823a6,_0xcbfc('0xb3'),JSON[_0xcbfc('0xb5')](_0x58a735));if(_0x422e8c['account'][_0xcbfc('0x50')]===_0xcbfc('0x8d')){return _0x210218[_0xcbfc('0x29')](_0x3823a6)[_0xcbfc('0x2f')](_0xcbfc('0xb6'),_0xcbfc('0xb7'))['send'](_0xcbfc('0xb8'));}else{return _0x210218[_0xcbfc('0x29')](_0x3823a6)[_0xcbfc('0x2b')](_0x58a735);}}})[_0xcbfc('0x28')](handleError(_0x210218,null));};exports['send']=function(_0x531992,_0x541a90,_0x1522ec){var _0x52961c,_0x3fae32,_0x55fd41;if(_['isNil'](_0x531992[_0xcbfc('0x60')][_0xcbfc('0x60')])||_0x531992[_0xcbfc('0x60')][_0xcbfc('0x60')]===''){throw new db[(_0xcbfc('0x95'))]['ValidationError'](_0xcbfc('0x96'));}if(_[_0xcbfc('0x94')](_0x531992[_0xcbfc('0x60')]['to'])){throw new db['Sequelize']['ValidationError'](_0xcbfc('0xb9'));}_0x52961c=_0x531992[_0xcbfc('0x60')]['to'];return db['WhatsappAccount'][_0xcbfc('0x58')]({'where':{'id':_0x531992['params']['id']},'include':[{'model':db['CmList'],'as':_0xcbfc('0xba'),'include':[{'model':db[_0xcbfc('0x85')],'as':_0xcbfc('0x9f'),'where':{'mobile':_0x52961c},'limit':0x1,'order':[[_0xcbfc('0x89'),_0xcbfc('0x9c')]]}]}]})['then'](handleEntityNotFound(_0x541a90,null))[_0xcbfc('0x1f')](function(_0x1b4179){if(_0x1b4179&&_0x1b4179['List']){_0x3fae32=_0x1b4179[_0xcbfc('0x34')]({'plain':!![]});if(_0x3fae32[_0xcbfc('0xba')]&&_0x3fae32[_0xcbfc('0xba')][_0xcbfc('0x9f')][_0xcbfc('0x46')]){return _0x3fae32['List'][_0xcbfc('0x9f')][0x0];}return db[_0xcbfc('0x85')][_0xcbfc('0x59')](_[_0xcbfc('0xa0')](_0x531992[_0xcbfc('0x60')],{'firstName':_0x52961c,'mobile':_0x52961c,'phone':_0x52961c,'ListId':_0x3fae32[_0xcbfc('0x8b')]}));}})[_0xcbfc('0x1f')](handleEntityNotFound(_0x541a90,null))[_0xcbfc('0x1f')](function(_0x4a2284){if(_0x4a2284){_0x55fd41=_0x4a2284;return db[_0xcbfc('0xa2')][_0xcbfc('0x58')]({'where':{'ContactId':_0x55fd41['id'],'closed':![],'WhatsappAccountId':_0x3fae32['id']}})[_0xcbfc('0x1f')](function(_0x54d8f9){if(_0x54d8f9){return[_0x54d8f9,![]];}return db[_0xcbfc('0xa2')][_0xcbfc('0x59')]({'UserId':_0x531992[_0xcbfc('0x5a')]['id'],'ContactId':_0x55fd41['id'],'WhatsappAccountId':_0x3fae32['id'],'phone':_0x52961c,'firstMsgDirection':'out','Messages':[_[_0xcbfc('0x4f')](_0x531992[_0xcbfc('0x60')],{'read':![],'body':_0x531992[_0xcbfc('0x60')][_0xcbfc('0x60')],'phone':_0x52961c,'WhatsappAccountId':_0x3fae32['id'],'UserId':_0x531992[_0xcbfc('0x5a')]['id'],'ContactId':_0x55fd41['id']})]},{'include':[{'model':db[_0xcbfc('0xbb')],'as':_0xcbfc('0xbc')}]})[_0xcbfc('0x1f')](function(_0x2388af){return[_0x2388af,!![]];});});}})[_0xcbfc('0xa3')](function(_0x5e5c0f,_0x4bc911){if(_0x4bc911){return _0x5e5c0f;}return db[_0xcbfc('0xbb')][_0xcbfc('0x59')](_['merge'](_0x531992[_0xcbfc('0x60')],{'read':![],'body':_0x531992[_0xcbfc('0x60')][_0xcbfc('0x60')],'phone':_0x52961c,'WhatsappAccountId':_0x3fae32['id'],'WhatsappInteractionId':_0x5e5c0f['id'],'UserId':_0x531992['user']['id'],'ContactId':_0x55fd41['id']}))[_0xcbfc('0x1f')](function(_0x22099f){_0x5e5c0f[_0xcbfc('0xbd')][_0xcbfc('0xbc')]=[];_0x5e5c0f[_0xcbfc('0xbd')][_0xcbfc('0xbc')][_0xcbfc('0xa6')](_0x22099f['dataValues']);return _0x5e5c0f;});})[_0xcbfc('0x1f')](respondWithResult(_0x541a90,null))['catch'](handleError(_0x541a90,null));}; \ No newline at end of file diff --git a/server/api/whatsappAccount/whatsappAccount.events.js b/server/api/whatsappAccount/whatsappAccount.events.js index f2fec1a..2a2e5a9 100644 --- a/server/api/whatsappAccount/whatsappAccount.events.js +++ b/server/api/whatsappAccount/whatsappAccount.events.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x3f8a=['../../mysqldb','WhatsappAccount','setMaxListeners','update','remove','emit','hasOwnProperty','hook','exports','events'];(function(_0x2e997e,_0x4edf31){var _0x5a6cb1=function(_0x3904da){while(--_0x3904da){_0x2e997e['push'](_0x2e997e['shift']());}};_0x5a6cb1(++_0x4edf31);}(_0x3f8a,0x1d5));var _0xa3f8=function(_0x3b4137,_0x3f6584){_0x3b4137=_0x3b4137-0x0;var _0x4276c3=_0x3f8a[_0x3b4137];return _0x4276c3;};'use strict';var EventEmitter=require(_0xa3f8('0x0'));var WhatsappAccount=require(_0xa3f8('0x1'))['db'][_0xa3f8('0x2')];var WhatsappAccountEvents=new EventEmitter();WhatsappAccountEvents[_0xa3f8('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':_0xa3f8('0x4'),'afterDestroy':_0xa3f8('0x5')};function emitEvent(_0x928738){return function(_0x15b6aa,_0x2553fd,_0x2847b4){WhatsappAccountEvents[_0xa3f8('0x6')](_0x928738+':'+_0x15b6aa['id'],_0x15b6aa);WhatsappAccountEvents[_0xa3f8('0x6')](_0x928738,_0x15b6aa);_0x2847b4(null);};}for(var e in events){if(events[_0xa3f8('0x7')](e)){var event=events[e];WhatsappAccount[_0xa3f8('0x8')](e,emitEvent(event));}}module[_0xa3f8('0x9')]=WhatsappAccountEvents; \ No newline at end of file +var _0x5d17=['update','remove','emit','hasOwnProperty','hook','exports','events','../../mysqldb','save'];(function(_0x565ed7,_0x398228){var _0x183ad7=function(_0x5a43d7){while(--_0x5a43d7){_0x565ed7['push'](_0x565ed7['shift']());}};_0x183ad7(++_0x398228);}(_0x5d17,0x114));var _0x75d1=function(_0xc1136d,_0x3d339f){_0xc1136d=_0xc1136d-0x0;var _0x3ba510=_0x5d17[_0xc1136d];return _0x3ba510;};'use strict';var EventEmitter=require(_0x75d1('0x0'));var WhatsappAccount=require(_0x75d1('0x1'))['db']['WhatsappAccount'];var WhatsappAccountEvents=new EventEmitter();WhatsappAccountEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x75d1('0x2'),'afterUpdate':_0x75d1('0x3'),'afterDestroy':_0x75d1('0x4')};function emitEvent(_0x5b3267){return function(_0x177460,_0x45d03a,_0x387e35){WhatsappAccountEvents[_0x75d1('0x5')](_0x5b3267+':'+_0x177460['id'],_0x177460);WhatsappAccountEvents['emit'](_0x5b3267,_0x177460);_0x387e35(null);};}for(var e in events){if(events[_0x75d1('0x6')](e)){var event=events[e];WhatsappAccount[_0x75d1('0x7')](e,emitEvent(event));}}module[_0x75d1('0x8')]=WhatsappAccountEvents; \ No newline at end of file diff --git a/server/api/whatsappAccount/whatsappAccount.model.js b/server/api/whatsappAccount/whatsappAccount.model.js index fae2ad4..a510e34 100644 --- a/server/api/whatsappAccount/whatsappAccount.model.js +++ b/server/api/whatsappAccount/whatsappAccount.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xf617=['util','../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment','./whatsappAccount.attributes','exports','define','WhatsappAccount','whatsapp_accounts'];(function(_0x4dbefa,_0x4b3f3a){var _0x22d340=function(_0x2ce780){while(--_0x2ce780){_0x4dbefa['push'](_0x4dbefa['shift']());}};_0x22d340(++_0x4b3f3a);}(_0xf617,0x1d4));var _0x7f61=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xf617[_0x3dd15e];return _0x231fd0;};'use strict';var _=require('lodash');var util=require(_0x7f61('0x0'));var logger=require(_0x7f61('0x1'))(_0x7f61('0x2'));var moment=require(_0x7f61('0x3'));var BPromise=require(_0x7f61('0x4'));var rp=require(_0x7f61('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x7f61('0x6'));var config=require(_0x7f61('0x7'));var attributes=require(_0x7f61('0x8'));module[_0x7f61('0x9')]=function(_0x55efbe,_0x4981cb){return _0x55efbe[_0x7f61('0xa')](_0x7f61('0xb'),attributes,{'tableName':_0x7f61('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x4e26=['util','../../config/logger','api','moment','request-promise','path','rimraf','./whatsappAccount.attributes','define','WhatsappAccount','lodash'];(function(_0x3d42d8,_0x4cffaa){var _0x27fc41=function(_0x3a363b){while(--_0x3a363b){_0x3d42d8['push'](_0x3d42d8['shift']());}};_0x27fc41(++_0x4cffaa);}(_0x4e26,0xf1));var _0x64e2=function(_0x125fd6,_0xf63f9e){_0x125fd6=_0x125fd6-0x0;var _0x127a89=_0x4e26[_0x125fd6];return _0x127a89;};'use strict';var _=require(_0x64e2('0x0'));var util=require(_0x64e2('0x1'));var logger=require(_0x64e2('0x2'))(_0x64e2('0x3'));var moment=require(_0x64e2('0x4'));var BPromise=require('bluebird');var rp=require(_0x64e2('0x5'));var fs=require('fs');var path=require(_0x64e2('0x6'));var rimraf=require(_0x64e2('0x7'));var config=require('../../config/environment');var attributes=require(_0x64e2('0x8'));module['exports']=function(_0x52d39b,_0x1258ea){return _0x52d39b[_0x64e2('0x9')](_0x64e2('0xa'),attributes,{'tableName':'whatsapp_accounts','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/whatsappAccount/whatsappAccount.rpc.js b/server/api/whatsappAccount/whatsappAccount.rpc.js index a84c761..985dabf 100644 --- a/server/api/whatsappAccount/whatsappAccount.rpc.js +++ b/server/api/whatsappAccount/whatsappAccount.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x1a4b=['bluebird','randomstring','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','redis','socket.io-emitter','./whatsappAccount.socket','register','request','then','info','WhatsappAccount,\x20%s,\x20%s','request\x20sent','debug','stringify','code','error','message','result','WhatsappAccount','find','options','include','model','attributes','map','ShowWhatsappAccount','catch','util','moment'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x1a4b,0x86));var _0xb1a4=function(_0x203b5a,_0x1fa2ae){_0x203b5a=_0x203b5a-0x0;var _0x3e2a6e=_0x1a4b[_0x203b5a];return _0x3e2a6e;};'use strict';var _=require('lodash');var util=require(_0xb1a4('0x0'));var moment=require(_0xb1a4('0x1'));var BPromise=require(_0xb1a4('0x2'));var rs=require(_0xb1a4('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0xb1a4('0x4'));var logger=require(_0xb1a4('0x5'))('rpc');var config=require(_0xb1a4('0x6'));var jayson=require(_0xb1a4('0x7'));var client=jayson[_0xb1a4('0x8')][_0xb1a4('0x9')]({'port':0x232a});config[_0xb1a4('0xa')]=_['defaults'](config[_0xb1a4('0xa')],{'host':'localhost','port':0x18eb});var socket=require(_0xb1a4('0xb'))(new Redis(config['redis']));require(_0xb1a4('0xc'))[_0xb1a4('0xd')](socket);function respondWithRpcPromise(_0x51db3b,_0x408333,_0x2439c8){return new BPromise(function(_0x1e3157,_0x4345fa){return client[_0xb1a4('0xe')](_0x51db3b,_0x2439c8)[_0xb1a4('0xf')](function(_0x2e1a56){logger[_0xb1a4('0x10')](_0xb1a4('0x11'),_0x408333,_0xb1a4('0x12'));logger[_0xb1a4('0x13')]('WhatsappAccount,\x20%s,\x20%s,\x20%s',_0x408333,_0xb1a4('0x12'),JSON[_0xb1a4('0x14')](_0x2e1a56));if(_0x2e1a56['error']){if(_0x2e1a56['error'][_0xb1a4('0x15')]===0x1f4){logger[_0xb1a4('0x16')](_0xb1a4('0x11'),_0x408333,_0x2e1a56[_0xb1a4('0x16')][_0xb1a4('0x17')]);return _0x4345fa(_0x2e1a56[_0xb1a4('0x16')][_0xb1a4('0x17')]);}logger[_0xb1a4('0x16')](_0xb1a4('0x11'),_0x408333,_0x2e1a56[_0xb1a4('0x16')][_0xb1a4('0x17')]);return _0x1e3157(_0x2e1a56['error'][_0xb1a4('0x17')]);}else{logger[_0xb1a4('0x10')]('WhatsappAccount,\x20%s,\x20%s',_0x408333,_0xb1a4('0x12'));_0x1e3157(_0x2e1a56[_0xb1a4('0x18')][_0xb1a4('0x17')]);}})['catch'](function(_0x3b8cb7){logger[_0xb1a4('0x16')](_0xb1a4('0x11'),_0x408333,_0x3b8cb7);_0x4345fa(_0x3b8cb7);});});}exports['ShowWhatsappAccount']=function(_0x1f26ad){var _0x11e33a=this;return new Promise(function(_0x36cc2f,_0x2ae17c){return db[_0xb1a4('0x19')][_0xb1a4('0x1a')]({'raw':_0x1f26ad['options']?_0x1f26ad[_0xb1a4('0x1b')]['raw']===undefined?!![]:![]:!![],'where':_0x1f26ad[_0xb1a4('0x1b')]?_0x1f26ad['options']['where']||null:null,'attributes':_0x1f26ad['options']?_0x1f26ad[_0xb1a4('0x1b')]['attributes']||null:null,'include':_0x1f26ad[_0xb1a4('0x1b')]?_0x1f26ad['options'][_0xb1a4('0x1c')]?_['map'](_0x1f26ad[_0xb1a4('0x1b')][_0xb1a4('0x1c')],function(_0x5163a2){return{'model':db[_0x5163a2[_0xb1a4('0x1d')]],'as':_0x5163a2['as'],'attributes':_0x5163a2['attributes'],'include':_0x5163a2['include']?_['map'](_0x5163a2['include'],function(_0xac0c77){return{'model':db[_0xac0c77[_0xb1a4('0x1d')]],'as':_0xac0c77['as'],'attributes':_0xac0c77[_0xb1a4('0x1e')],'include':_0xac0c77['include']?_[_0xb1a4('0x1f')](_0xac0c77[_0xb1a4('0x1c')],function(_0x1a4060){return{'model':db[_0x1a4060[_0xb1a4('0x1d')]],'as':_0x1a4060['as'],'attributes':_0x1a4060[_0xb1a4('0x1e')]};}):[]};}):[]};}):[]:[]})[_0xb1a4('0xf')](function(_0x57fc0e){logger[_0xb1a4('0x10')](_0xb1a4('0x20'),_0x1f26ad);logger[_0xb1a4('0x13')](_0xb1a4('0x20'),_0x1f26ad,JSON[_0xb1a4('0x14')](_0x57fc0e));_0x36cc2f(_0x57fc0e);})[_0xb1a4('0x21')](function(_0x40893d){logger[_0xb1a4('0x16')]('ShowWhatsappAccount',_0x40893d[_0xb1a4('0x17')],_0x1f26ad);_0x2ae17c(_0x11e33a['error'](0x1f4,_0x40893d[_0xb1a4('0x17')]));});});}; \ No newline at end of file +var _0x1918=['stringify','error','code','message','ShowWhatsappAccount','WhatsappAccount','find','options','raw','where','attributes','map','model','include','then','util','moment','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','client','http','defaults','redis','localhost','socket.io-emitter','register','info','WhatsappAccount,\x20%s,\x20%s','request\x20sent'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x1918,0x1dd));var _0x8191=function(_0x4afa97,_0x1b7727){_0x4afa97=_0x4afa97-0x0;var _0x11215e=_0x1918[_0x4afa97];return _0x11215e;};'use strict';var _=require('lodash');var util=require(_0x8191('0x0'));var moment=require(_0x8191('0x1'));var BPromise=require('bluebird');var rs=require(_0x8191('0x2'));var fs=require('fs');var Redis=require(_0x8191('0x3'));var db=require(_0x8191('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x8191('0x5'))(_0x8191('0x6'));var config=require(_0x8191('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x8191('0x8')][_0x8191('0x9')]({'port':0x232a});config['redis']=_[_0x8191('0xa')](config[_0x8191('0xb')],{'host':_0x8191('0xc'),'port':0x18eb});var socket=require(_0x8191('0xd'))(new Redis(config['redis']));require('./whatsappAccount.socket')[_0x8191('0xe')](socket);function respondWithRpcPromise(_0x5aaa67,_0x5914dd,_0x3ac54d){return new BPromise(function(_0x480c3d,_0x34115d){return client['request'](_0x5aaa67,_0x3ac54d)['then'](function(_0x529945){logger[_0x8191('0xf')](_0x8191('0x10'),_0x5914dd,_0x8191('0x11'));logger['debug']('WhatsappAccount,\x20%s,\x20%s,\x20%s',_0x5914dd,'request\x20sent',JSON[_0x8191('0x12')](_0x529945));if(_0x529945['error']){if(_0x529945[_0x8191('0x13')][_0x8191('0x14')]===0x1f4){logger[_0x8191('0x13')](_0x8191('0x10'),_0x5914dd,_0x529945['error'][_0x8191('0x15')]);return _0x34115d(_0x529945[_0x8191('0x13')][_0x8191('0x15')]);}logger[_0x8191('0x13')](_0x8191('0x10'),_0x5914dd,_0x529945[_0x8191('0x13')][_0x8191('0x15')]);return _0x480c3d(_0x529945['error']['message']);}else{logger[_0x8191('0xf')](_0x8191('0x10'),_0x5914dd,_0x8191('0x11'));_0x480c3d(_0x529945['result']['message']);}})['catch'](function(_0xfe22d){logger['error'](_0x8191('0x10'),_0x5914dd,_0xfe22d);_0x34115d(_0xfe22d);});});}exports[_0x8191('0x16')]=function(_0x2105b5){var _0x5944b5=this;return new Promise(function(_0x5f4b50,_0x3605ba){return db[_0x8191('0x17')][_0x8191('0x18')]({'raw':_0x2105b5[_0x8191('0x19')]?_0x2105b5[_0x8191('0x19')][_0x8191('0x1a')]===undefined?!![]:![]:!![],'where':_0x2105b5[_0x8191('0x19')]?_0x2105b5['options'][_0x8191('0x1b')]||null:null,'attributes':_0x2105b5[_0x8191('0x19')]?_0x2105b5[_0x8191('0x19')][_0x8191('0x1c')]||null:null,'include':_0x2105b5[_0x8191('0x19')]?_0x2105b5['options']['include']?_[_0x8191('0x1d')](_0x2105b5[_0x8191('0x19')]['include'],function(_0x3a8ad8){return{'model':db[_0x3a8ad8[_0x8191('0x1e')]],'as':_0x3a8ad8['as'],'attributes':_0x3a8ad8[_0x8191('0x1c')],'include':_0x3a8ad8['include']?_[_0x8191('0x1d')](_0x3a8ad8[_0x8191('0x1f')],function(_0x23e033){return{'model':db[_0x23e033[_0x8191('0x1e')]],'as':_0x23e033['as'],'attributes':_0x23e033[_0x8191('0x1c')],'include':_0x23e033['include']?_[_0x8191('0x1d')](_0x23e033[_0x8191('0x1f')],function(_0x337466){return{'model':db[_0x337466['model']],'as':_0x337466['as'],'attributes':_0x337466[_0x8191('0x1c')]};}):[]};}):[]};}):[]:[]})[_0x8191('0x20')](function(_0xee5e67){logger['info'](_0x8191('0x16'),_0x2105b5);logger['debug'](_0x8191('0x16'),_0x2105b5,JSON[_0x8191('0x12')](_0xee5e67));_0x5f4b50(_0xee5e67);})['catch'](function(_0x44bedc){logger[_0x8191('0x13')](_0x8191('0x16'),_0x44bedc[_0x8191('0x15')],_0x2105b5);_0x3605ba(_0x5944b5[_0x8191('0x13')](0x1f4,_0x44bedc['message']));});});}; \ No newline at end of file diff --git a/server/api/whatsappAccount/whatsappAccount.socket.js b/server/api/whatsappAccount/whatsappAccount.socket.js index 106e580..55b445b 100644 --- a/server/api/whatsappAccount/whatsappAccount.socket.js +++ b/server/api/whatsappAccount/whatsappAccount.socket.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x8ed9=['update','emit','length','whatsappAccount:','./whatsappAccount.events','save'];(function(_0x4d9dfd,_0x2903ba){var _0x1821e9=function(_0x299e67){while(--_0x299e67){_0x4d9dfd['push'](_0x4d9dfd['shift']());}};_0x1821e9(++_0x2903ba);}(_0x8ed9,0xdc));var _0x98ed=function(_0x52b395,_0x1afa64){_0x52b395=_0x52b395-0x0;var _0x55d9d4=_0x8ed9[_0x52b395];return _0x55d9d4;};'use strict';var WhatsappAccountEvents=require(_0x98ed('0x0'));var events=[_0x98ed('0x1'),'remove',_0x98ed('0x2')];function createListener(_0x1b2dd5,_0x4ab10e){return function(_0x4f7471){_0x4ab10e[_0x98ed('0x3')](_0x1b2dd5,_0x4f7471);};}function removeListener(_0x244bf9,_0x507b9a){return function(){WhatsappAccountEvents['removeListener'](_0x244bf9,_0x507b9a);};}exports['register']=function(_0x2f23d9){for(var _0x46bdd5=0x0,_0x2197fd=events[_0x98ed('0x4')];_0x46bdd5<_0x2197fd;_0x46bdd5++){var _0x5203d3=events[_0x46bdd5];var _0x59a1ab=createListener(_0x98ed('0x5')+_0x5203d3,_0x2f23d9);WhatsappAccountEvents['on'](_0x5203d3,_0x59a1ab);}}; \ No newline at end of file +var _0x8b83=['register','length','whatsappAccount:','save','update','removeListener'];(function(_0x155edc,_0x113d26){var _0x284eb3=function(_0x238cab){while(--_0x238cab){_0x155edc['push'](_0x155edc['shift']());}};_0x284eb3(++_0x113d26);}(_0x8b83,0x111));var _0x38b8=function(_0x51b181,_0x5694e7){_0x51b181=_0x51b181-0x0;var _0x24a638=_0x8b83[_0x51b181];return _0x24a638;};'use strict';var WhatsappAccountEvents=require('./whatsappAccount.events');var events=[_0x38b8('0x0'),'remove',_0x38b8('0x1')];function createListener(_0x86baf4,_0x11e6d3){return function(_0x94c77d){_0x11e6d3['emit'](_0x86baf4,_0x94c77d);};}function removeListener(_0x1862ff,_0x22567a){return function(){WhatsappAccountEvents[_0x38b8('0x2')](_0x1862ff,_0x22567a);};}exports[_0x38b8('0x3')]=function(_0x1cd161){for(var _0x6830ff=0x0,_0x3f434e=events[_0x38b8('0x4')];_0x6830ff<_0x3f434e;_0x6830ff++){var _0x444f31=events[_0x6830ff];var _0x51615d=createListener(_0x38b8('0x5')+_0x444f31,_0x1cd161);WhatsappAccountEvents['on'](_0x444f31,_0x51615d);}}; \ No newline at end of file diff --git a/server/api/whatsappApplication/index.js b/server/api/whatsappApplication/index.js index 3b74655..9b407b4 100644 --- a/server/api/whatsappApplication/index.js +++ b/server/api/whatsappApplication/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xc8cd=['../../components/interaction/service','./whatsappApplication.controller','isAuthenticated','index','get','show','post','put','/:id','destroy','exports','connect-timeout','../../components/auth/service'];(function(_0x411017,_0x4a8117){var _0x2adeea=function(_0x545222){while(--_0x545222){_0x411017['push'](_0x411017['shift']());}};_0x2adeea(++_0x4a8117);}(_0xc8cd,0x80));var _0xdc8c=function(_0xce4e60,_0x5af26d){_0xce4e60=_0xce4e60-0x0;var _0x1c7d65=_0xc8cd[_0xce4e60];return _0x1c7d65;};'use strict';var multer=require('multer');var util=require('util');var path=require('path');var timeout=require(_0xdc8c('0x0'));var express=require('express');var router=express['Router']();var auth=require(_0xdc8c('0x1'));var interaction=require(_0xdc8c('0x2'));var config=require('../../config/environment');var controller=require(_0xdc8c('0x3'));router['get']('/',auth[_0xdc8c('0x4')](),controller[_0xdc8c('0x5')]);router[_0xdc8c('0x6')]('/:id',auth[_0xdc8c('0x4')](),controller[_0xdc8c('0x7')]);router[_0xdc8c('0x8')]('/',auth[_0xdc8c('0x4')](),controller['create']);router[_0xdc8c('0x9')](_0xdc8c('0xa'),auth[_0xdc8c('0x4')](),controller['update']);router['delete'](_0xdc8c('0xa'),auth[_0xdc8c('0x4')](),controller[_0xdc8c('0xb')]);module[_0xdc8c('0xc')]=router; \ No newline at end of file +var _0xcc17=['../../components/auth/service','../../components/interaction/service','../../config/environment','./whatsappApplication.controller','get','index','isAuthenticated','post','create','update','/:id','destroy','exports','util','connect-timeout','Router'];(function(_0x4c045d,_0x33349d){var _0x56581a=function(_0x1cadae){while(--_0x1cadae){_0x4c045d['push'](_0x4c045d['shift']());}};_0x56581a(++_0x33349d);}(_0xcc17,0x9d));var _0x7cc1=function(_0x54bac5,_0x8d3a16){_0x54bac5=_0x54bac5-0x0;var _0xc15971=_0xcc17[_0x54bac5];return _0xc15971;};'use strict';var multer=require('multer');var util=require(_0x7cc1('0x0'));var path=require('path');var timeout=require(_0x7cc1('0x1'));var express=require('express');var router=express[_0x7cc1('0x2')]();var auth=require(_0x7cc1('0x3'));var interaction=require(_0x7cc1('0x4'));var config=require(_0x7cc1('0x5'));var controller=require(_0x7cc1('0x6'));router[_0x7cc1('0x7')]('/',auth['isAuthenticated'](),controller[_0x7cc1('0x8')]);router['get']('/:id',auth[_0x7cc1('0x9')](),controller['show']);router[_0x7cc1('0xa')]('/',auth[_0x7cc1('0x9')](),controller[_0x7cc1('0xb')]);router['put']('/:id',auth[_0x7cc1('0x9')](),controller[_0x7cc1('0xc')]);router['delete'](_0x7cc1('0xd'),auth[_0x7cc1('0x9')](),controller[_0x7cc1('0xe')]);module[_0x7cc1('0xf')]=router; \ No newline at end of file diff --git a/server/api/whatsappApplication/whatsappApplication.attributes.js b/server/api/whatsappApplication/whatsappApplication.attributes.js index e615ba2..f4c877b 100644 --- a/server/api/whatsappApplication/whatsappApplication.attributes.js +++ b/server/api/whatsappApplication/whatsappApplication.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xcf24=['TEXT','*,*,*,*','sequelize','exports','INTEGER','STRING','noop'];(function(_0xb0f7c3,_0x4eae95){var _0x28ea68=function(_0x4395a7){while(--_0x4395a7){_0xb0f7c3['push'](_0xb0f7c3['shift']());}};_0x28ea68(++_0x4eae95);}(_0xcf24,0x113));var _0x4cf2=function(_0x1ce22e,_0x30c0c4){_0x1ce22e=_0x1ce22e-0x0;var _0x950c43=_0xcf24[_0x1ce22e];return _0x950c43;};'use strict';var Sequelize=require(_0x4cf2('0x0'));module[_0x4cf2('0x1')]={'priority':{'type':Sequelize[_0x4cf2('0x2')],'allowNull':![]},'app':{'type':Sequelize[_0x4cf2('0x3')],'allowNull':![],'defaultValue':_0x4cf2('0x4')},'appdata':{'type':Sequelize[_0x4cf2('0x5')]()},'description':{'type':Sequelize[_0x4cf2('0x3')]},'interval':{'type':Sequelize[_0x4cf2('0x3')],'defaultValue':_0x4cf2('0x6')}}; \ No newline at end of file +var _0x86a4=['noop','TEXT','*,*,*,*','sequelize','exports','INTEGER','STRING'];(function(_0x4a708c,_0x8fda69){var _0x16173b=function(_0x27319a){while(--_0x27319a){_0x4a708c['push'](_0x4a708c['shift']());}};_0x16173b(++_0x8fda69);}(_0x86a4,0xea));var _0x486a=function(_0x945e9b,_0x32f681){_0x945e9b=_0x945e9b-0x0;var _0x5beebd=_0x86a4[_0x945e9b];return _0x5beebd;};'use strict';var Sequelize=require(_0x486a('0x0'));module[_0x486a('0x1')]={'priority':{'type':Sequelize[_0x486a('0x2')],'allowNull':![]},'app':{'type':Sequelize[_0x486a('0x3')],'allowNull':![],'defaultValue':_0x486a('0x4')},'appdata':{'type':Sequelize[_0x486a('0x5')]()},'description':{'type':Sequelize[_0x486a('0x3')]},'interval':{'type':Sequelize[_0x486a('0x3')],'defaultValue':_0x486a('0x6')}}; \ No newline at end of file diff --git a/server/api/whatsappApplication/whatsappApplication.controller.js b/server/api/whatsappApplication/whatsappApplication.controller.js index 0cf935a..4b3a588 100644 --- a/server/api/whatsappApplication/whatsappApplication.controller.js +++ b/server/api/whatsappApplication/whatsappApplication.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x6de8=['html-pdf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../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','index','map','rawAttributes','fieldName','type','model','query','keys','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filters','merge','filter','options','WhatsappApplication','includeAll','include','findAll','rows','catch','show','params','body','find'];(function(_0x1ac595,_0x5d2081){var _0x455fff=function(_0x3043ee){while(--_0x3043ee){_0x1ac595['push'](_0x1ac595['shift']());}};_0x455fff(++_0x5d2081);}(_0x6de8,0xe1));var _0x86de=function(_0x5e238b,_0x17ae49){_0x5e238b=_0x5e238b-0x0;var _0x389bea=_0x6de8[_0x5e238b];return _0x389bea;};'use strict';var pdf=require(_0x86de('0x0'));var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x86de('0x1'));var jsonpatch=require(_0x86de('0x2'));var rp=require(_0x86de('0x3'));var moment=require('moment');var BPromise=require(_0x86de('0x4'));var Mustache=require(_0x86de('0x5'));var util=require('util');var path=require(_0x86de('0x6'));var sox=require(_0x86de('0x7'));var csv=require(_0x86de('0x8'));var ejs=require(_0x86de('0x9'));var fs=require('fs');var _=require(_0x86de('0xa'));var squel=require(_0x86de('0xb'));var crypto=require(_0x86de('0xc'));var jsforce=require(_0x86de('0xd'));var deskjs=require(_0x86de('0xe'));var toCsv=require(_0x86de('0x8'));var querystring=require(_0x86de('0xf'));var Papa=require(_0x86de('0x10'));var Redis=require(_0x86de('0x11'));var authService=require(_0x86de('0x12'));var qs=require(_0x86de('0x13'));var as=require(_0x86de('0x14'));var hardwareService=require(_0x86de('0x15'));var logger=require(_0x86de('0x16'))(_0x86de('0x17'));var utils=require(_0x86de('0x18'));var config=require(_0x86de('0x19'));var db=require(_0x86de('0x1a'))['db'];function respondWithStatusCode(_0x1b102d,_0x158acb){_0x158acb=_0x158acb||0xcc;return function(_0x38c417){if(_0x38c417){return _0x1b102d[_0x86de('0x1b')](_0x158acb);}return _0x1b102d[_0x86de('0x1c')](_0x158acb)[_0x86de('0x1d')]();};}function respondWithResult(_0x1d1658,_0x33d692){_0x33d692=_0x33d692||0xc8;return function(_0x198097){if(_0x198097){return _0x1d1658['status'](_0x33d692)[_0x86de('0x1e')](_0x198097);}};}function respondWithFilteredResult(_0x10e5c5,_0x302208){return function(_0x20c3dc){if(_0x20c3dc){var _0x313e62=_0x20c3dc[_0x86de('0x1f')],_0x4d54bb=_0x302208[_0x86de('0x20')],_0xfbf2c8=_0x302208[_0x86de('0x20')]+_0x302208[_0x86de('0x21')],_0xdf7959;if(_0xfbf2c8>=_0x313e62){_0xfbf2c8=_0x313e62;_0xdf7959=0xc8;}else{_0xdf7959=0xce;}_0x10e5c5[_0x86de('0x1c')](_0xdf7959);return _0x10e5c5[_0x86de('0x22')]('Content-Range',_0x4d54bb+'-'+_0xfbf2c8+'/'+_0x313e62)['json'](_0x20c3dc);}return null;};}function patchUpdates(_0x53a0e7){return function(_0x45f251){try{jsonpatch[_0x86de('0x23')](_0x45f251,_0x53a0e7,!![]);}catch(_0xfb19e5){return BPromise['reject'](_0xfb19e5);}return _0x45f251[_0x86de('0x24')]();};}function saveUpdates(_0x416947,_0x44cf17){return function(_0x5ad0da){if(_0x5ad0da){return _0x5ad0da[_0x86de('0x25')](_0x416947)[_0x86de('0x26')](function(_0x120631){return _0x120631;});}return null;};}function removeEntity(_0x353279,_0x4d1fbb){return function(_0x55c92f){if(_0x55c92f){return _0x55c92f[_0x86de('0x27')]()[_0x86de('0x26')](function(){_0x353279[_0x86de('0x1c')](0xcc)[_0x86de('0x1d')]();});}};}function handleEntityNotFound(_0x48beee,_0x56bf5e){return function(_0x37f82c){if(!_0x37f82c){_0x48beee['sendStatus'](0x194);}return _0x37f82c;};}function handleError(_0x416717,_0x4d5627){_0x4d5627=_0x4d5627||0x1f4;return function(_0x15b3b7){logger[_0x86de('0x28')](_0x15b3b7[_0x86de('0x29')]);if(_0x15b3b7[_0x86de('0x2a')]){delete _0x15b3b7[_0x86de('0x2a')];}_0x416717[_0x86de('0x1c')](_0x4d5627)['send'](_0x15b3b7);};}exports[_0x86de('0x2b')]=function(_0x23de34,_0x366c89){var _0x3cea78={},_0x22bb8a={},_0x2cbf06={'count':0x0,'rows':[]};var _0x4759e2=_[_0x86de('0x2c')](db['WhatsappApplication'][_0x86de('0x2d')],function(_0x4a1fbe){return{'name':_0x4a1fbe[_0x86de('0x2e')],'type':_0x4a1fbe[_0x86de('0x2f')]['key']};});_0x22bb8a[_0x86de('0x30')]=_[_0x86de('0x2c')](_0x4759e2,_0x86de('0x2a'));_0x22bb8a[_0x86de('0x31')]=_[_0x86de('0x32')](_0x23de34['query']);_0x22bb8a['filters']=_[_0x86de('0x33')](_0x22bb8a[_0x86de('0x30')],_0x22bb8a[_0x86de('0x31')]);_0x3cea78[_0x86de('0x34')]=_[_0x86de('0x33')](_0x22bb8a['model'],qs[_0x86de('0x35')](_0x23de34[_0x86de('0x31')][_0x86de('0x35')]));_0x3cea78[_0x86de('0x34')]=_0x3cea78[_0x86de('0x34')][_0x86de('0x36')]?_0x3cea78[_0x86de('0x34')]:_0x22bb8a['model'];if(!_0x23de34[_0x86de('0x31')][_0x86de('0x37')](_0x86de('0x38'))){_0x3cea78[_0x86de('0x21')]=qs['limit'](_0x23de34[_0x86de('0x31')][_0x86de('0x21')]);_0x3cea78['offset']=qs[_0x86de('0x20')](_0x23de34['query'][_0x86de('0x20')]);}_0x3cea78[_0x86de('0x39')]=qs['sort'](_0x23de34[_0x86de('0x31')][_0x86de('0x3a')]);_0x3cea78[_0x86de('0x3b')]=qs['filters'](_[_0x86de('0x3c')](_0x23de34['query'],_0x22bb8a[_0x86de('0x3d')]),_0x4759e2);if(_0x23de34[_0x86de('0x31')]['filter']){_0x3cea78[_0x86de('0x3b')]=_[_0x86de('0x3e')](_0x3cea78['where'],{'$or':_[_0x86de('0x2c')](_0x4759e2,function(_0x2be1ef){if(_0x2be1ef['type']!=='VIRTUAL'){var _0x24ea17={};_0x24ea17[_0x2be1ef[_0x86de('0x2a')]]={'$like':'%'+_0x23de34[_0x86de('0x31')][_0x86de('0x3f')]+'%'};return _0x24ea17;}})});}_0x3cea78=_['merge']({},_0x3cea78,_0x23de34[_0x86de('0x40')]);var _0x460ca1={'where':_0x3cea78['where']};return db[_0x86de('0x41')]['count'](_0x460ca1)['then'](function(_0x2c587c){_0x2cbf06['count']=_0x2c587c;if(_0x23de34['query'][_0x86de('0x42')]){_0x3cea78[_0x86de('0x43')]=[{'all':!![]}];}return db[_0x86de('0x41')][_0x86de('0x44')](_0x3cea78);})[_0x86de('0x26')](function(_0x155058){_0x2cbf06[_0x86de('0x45')]=_0x155058;return _0x2cbf06;})['then'](respondWithFilteredResult(_0x366c89,_0x3cea78))[_0x86de('0x46')](handleError(_0x366c89,null));};exports[_0x86de('0x47')]=function(_0x4318ec,_0x17f949){var _0x2c7128={'raw':!![],'where':{'id':_0x4318ec[_0x86de('0x48')]['id']}},_0x5792f8={};_0x5792f8[_0x86de('0x30')]=_['keys'](db['WhatsappApplication'][_0x86de('0x2d')]);_0x5792f8[_0x86de('0x31')]=_[_0x86de('0x32')](_0x4318ec[_0x86de('0x31')]);_0x5792f8['filters']=_['intersection'](_0x5792f8[_0x86de('0x30')],_0x5792f8['query']);_0x2c7128[_0x86de('0x34')]=_[_0x86de('0x33')](_0x5792f8[_0x86de('0x30')],qs[_0x86de('0x35')](_0x4318ec[_0x86de('0x31')][_0x86de('0x35')]));_0x2c7128[_0x86de('0x34')]=_0x2c7128[_0x86de('0x34')]['length']?_0x2c7128[_0x86de('0x34')]:_0x5792f8['model'];if(_0x4318ec[_0x86de('0x31')][_0x86de('0x42')]){_0x2c7128['include']=[{'all':!![]}];}_0x2c7128=_[_0x86de('0x3e')]({},_0x2c7128,_0x4318ec[_0x86de('0x40')]);return db[_0x86de('0x41')]['find'](_0x2c7128)['then'](handleEntityNotFound(_0x17f949,null))['then'](respondWithResult(_0x17f949,null))['catch'](handleError(_0x17f949,null));};exports['create']=function(_0x154cb2,_0x361f58){return db[_0x86de('0x41')]['create'](_0x154cb2[_0x86de('0x49')],{})[_0x86de('0x26')](respondWithResult(_0x361f58,0xc9))[_0x86de('0x46')](handleError(_0x361f58,null));};exports['update']=function(_0xa51627,_0x385815){if(_0xa51627[_0x86de('0x49')]['id']){delete _0xa51627[_0x86de('0x49')]['id'];}return db[_0x86de('0x41')][_0x86de('0x4a')]({'where':{'id':_0xa51627[_0x86de('0x48')]['id']}})['then'](handleEntityNotFound(_0x385815,null))[_0x86de('0x26')](saveUpdates(_0xa51627[_0x86de('0x49')],null))[_0x86de('0x26')](respondWithResult(_0x385815,null))[_0x86de('0x46')](handleError(_0x385815,null));};exports['destroy']=function(_0x291d9b,_0x1af09c){return db[_0x86de('0x41')][_0x86de('0x4a')]({'where':{'id':_0x291d9b['params']['id']}})[_0x86de('0x26')](handleEntityNotFound(_0x1af09c,null))[_0x86de('0x26')](removeEntity(_0x1af09c,null))[_0x86de('0x46')](handleError(_0x1af09c,null));}; \ No newline at end of file +var _0x6002=['moment','bluebird','mustache','util','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../config/logger','../../config/environment','sendStatus','status','end','json','count','offset','limit','set','Content-Range','apply','reject','save','then','destroy','error','stack','name','send','index','map','WhatsappApplication','rawAttributes','type','key','model','query','keys','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','pick','filter','where','merge','VIRTUAL','options','includeAll','include','rows','catch','show','params','find','create','body','update','html-pdf','eml-format','rimraf','fast-json-patch','request-promise'];(function(_0x2dafbe,_0x5d04de){var _0x58a45a=function(_0x50ac96){while(--_0x50ac96){_0x2dafbe['push'](_0x2dafbe['shift']());}};_0x58a45a(++_0x5d04de);}(_0x6002,0x172));var _0x2600=function(_0x5dcf9e,_0x46534c){_0x5dcf9e=_0x5dcf9e-0x0;var _0x198a2c=_0x6002[_0x5dcf9e];return _0x198a2c;};'use strict';var pdf=require(_0x2600('0x0'));var emlformat=require(_0x2600('0x1'));var rimraf=require(_0x2600('0x2'));var zipdir=require('zip-dir');var jsonpatch=require(_0x2600('0x3'));var rp=require(_0x2600('0x4'));var moment=require(_0x2600('0x5'));var BPromise=require(_0x2600('0x6'));var Mustache=require(_0x2600('0x7'));var util=require(_0x2600('0x8'));var path=require('path');var sox=require(_0x2600('0x9'));var csv=require(_0x2600('0xa'));var ejs=require(_0x2600('0xb'));var fs=require('fs');var _=require(_0x2600('0xc'));var squel=require(_0x2600('0xd'));var crypto=require(_0x2600('0xe'));var jsforce=require(_0x2600('0xf'));var deskjs=require(_0x2600('0x10'));var toCsv=require(_0x2600('0xa'));var querystring=require(_0x2600('0x11'));var Papa=require(_0x2600('0x12'));var Redis=require(_0x2600('0x13'));var authService=require('../../components/auth/service');var qs=require(_0x2600('0x14'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x2600('0x15'))('api');var utils=require('../../config/utils');var config=require(_0x2600('0x16'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x193d7f,_0x5af047){_0x5af047=_0x5af047||0xcc;return function(_0x45a765){if(_0x45a765){return _0x193d7f[_0x2600('0x17')](_0x5af047);}return _0x193d7f[_0x2600('0x18')](_0x5af047)[_0x2600('0x19')]();};}function respondWithResult(_0x46574f,_0x417df6){_0x417df6=_0x417df6||0xc8;return function(_0x3f66f6){if(_0x3f66f6){return _0x46574f[_0x2600('0x18')](_0x417df6)[_0x2600('0x1a')](_0x3f66f6);}};}function respondWithFilteredResult(_0x51af65,_0x301bb0){return function(_0x4e4b0d){if(_0x4e4b0d){var _0x1b0efc=_0x4e4b0d[_0x2600('0x1b')],_0x408b0a=_0x301bb0[_0x2600('0x1c')],_0x582493=_0x301bb0[_0x2600('0x1c')]+_0x301bb0[_0x2600('0x1d')],_0xa73400;if(_0x582493>=_0x1b0efc){_0x582493=_0x1b0efc;_0xa73400=0xc8;}else{_0xa73400=0xce;}_0x51af65[_0x2600('0x18')](_0xa73400);return _0x51af65[_0x2600('0x1e')](_0x2600('0x1f'),_0x408b0a+'-'+_0x582493+'/'+_0x1b0efc)[_0x2600('0x1a')](_0x4e4b0d);}return null;};}function patchUpdates(_0x38831d){return function(_0x4fae02){try{jsonpatch[_0x2600('0x20')](_0x4fae02,_0x38831d,!![]);}catch(_0x139e15){return BPromise[_0x2600('0x21')](_0x139e15);}return _0x4fae02[_0x2600('0x22')]();};}function saveUpdates(_0x30bda1,_0x53c446){return function(_0xe1e813){if(_0xe1e813){return _0xe1e813['update'](_0x30bda1)[_0x2600('0x23')](function(_0x3cc3db){return _0x3cc3db;});}return null;};}function removeEntity(_0x114b07,_0x26e729){return function(_0x4ffa8a){if(_0x4ffa8a){return _0x4ffa8a[_0x2600('0x24')]()[_0x2600('0x23')](function(){_0x114b07[_0x2600('0x18')](0xcc)[_0x2600('0x19')]();});}};}function handleEntityNotFound(_0x326e2e,_0x2de564){return function(_0x401a7b){if(!_0x401a7b){_0x326e2e[_0x2600('0x17')](0x194);}return _0x401a7b;};}function handleError(_0xc3df16,_0x1e2924){_0x1e2924=_0x1e2924||0x1f4;return function(_0x58b907){logger[_0x2600('0x25')](_0x58b907[_0x2600('0x26')]);if(_0x58b907[_0x2600('0x27')]){delete _0x58b907[_0x2600('0x27')];}_0xc3df16[_0x2600('0x18')](_0x1e2924)[_0x2600('0x28')](_0x58b907);};}exports[_0x2600('0x29')]=function(_0x54caa4,_0x146d12){var _0x271a98={},_0x4e899f={},_0x1ecb50={'count':0x0,'rows':[]};var _0x319a51=_[_0x2600('0x2a')](db[_0x2600('0x2b')][_0x2600('0x2c')],function(_0x37c62a){return{'name':_0x37c62a['fieldName'],'type':_0x37c62a[_0x2600('0x2d')][_0x2600('0x2e')]};});_0x4e899f[_0x2600('0x2f')]=_[_0x2600('0x2a')](_0x319a51,'name');_0x4e899f[_0x2600('0x30')]=_[_0x2600('0x31')](_0x54caa4['query']);_0x4e899f[_0x2600('0x32')]=_['intersection'](_0x4e899f[_0x2600('0x2f')],_0x4e899f['query']);_0x271a98[_0x2600('0x33')]=_[_0x2600('0x34')](_0x4e899f[_0x2600('0x2f')],qs['fields'](_0x54caa4[_0x2600('0x30')][_0x2600('0x35')]));_0x271a98[_0x2600('0x33')]=_0x271a98[_0x2600('0x33')][_0x2600('0x36')]?_0x271a98[_0x2600('0x33')]:_0x4e899f[_0x2600('0x2f')];if(!_0x54caa4[_0x2600('0x30')][_0x2600('0x37')](_0x2600('0x38'))){_0x271a98[_0x2600('0x1d')]=qs[_0x2600('0x1d')](_0x54caa4['query'][_0x2600('0x1d')]);_0x271a98['offset']=qs[_0x2600('0x1c')](_0x54caa4['query'][_0x2600('0x1c')]);}_0x271a98[_0x2600('0x39')]=qs['sort'](_0x54caa4['query'][_0x2600('0x3a')]);_0x271a98['where']=qs['filters'](_[_0x2600('0x3b')](_0x54caa4[_0x2600('0x30')],_0x4e899f[_0x2600('0x32')]),_0x319a51);if(_0x54caa4[_0x2600('0x30')][_0x2600('0x3c')]){_0x271a98[_0x2600('0x3d')]=_[_0x2600('0x3e')](_0x271a98[_0x2600('0x3d')],{'$or':_[_0x2600('0x2a')](_0x319a51,function(_0x3b30d7){if(_0x3b30d7['type']!==_0x2600('0x3f')){var _0x32f220={};_0x32f220[_0x3b30d7[_0x2600('0x27')]]={'$like':'%'+_0x54caa4[_0x2600('0x30')][_0x2600('0x3c')]+'%'};return _0x32f220;}})});}_0x271a98=_[_0x2600('0x3e')]({},_0x271a98,_0x54caa4[_0x2600('0x40')]);var _0x64f53f={'where':_0x271a98['where']};return db[_0x2600('0x2b')][_0x2600('0x1b')](_0x64f53f)[_0x2600('0x23')](function(_0x121546){_0x1ecb50[_0x2600('0x1b')]=_0x121546;if(_0x54caa4[_0x2600('0x30')][_0x2600('0x41')]){_0x271a98[_0x2600('0x42')]=[{'all':!![]}];}return db['WhatsappApplication']['findAll'](_0x271a98);})[_0x2600('0x23')](function(_0x2526d6){_0x1ecb50[_0x2600('0x43')]=_0x2526d6;return _0x1ecb50;})[_0x2600('0x23')](respondWithFilteredResult(_0x146d12,_0x271a98))[_0x2600('0x44')](handleError(_0x146d12,null));};exports[_0x2600('0x45')]=function(_0x44c4a2,_0x24ffd6){var _0x2b680e={'raw':!![],'where':{'id':_0x44c4a2[_0x2600('0x46')]['id']}},_0x4d8c81={};_0x4d8c81[_0x2600('0x2f')]=_[_0x2600('0x31')](db[_0x2600('0x2b')][_0x2600('0x2c')]);_0x4d8c81['query']=_['keys'](_0x44c4a2[_0x2600('0x30')]);_0x4d8c81['filters']=_[_0x2600('0x34')](_0x4d8c81[_0x2600('0x2f')],_0x4d8c81[_0x2600('0x30')]);_0x2b680e[_0x2600('0x33')]=_['intersection'](_0x4d8c81[_0x2600('0x2f')],qs['fields'](_0x44c4a2[_0x2600('0x30')][_0x2600('0x35')]));_0x2b680e[_0x2600('0x33')]=_0x2b680e[_0x2600('0x33')]['length']?_0x2b680e[_0x2600('0x33')]:_0x4d8c81[_0x2600('0x2f')];if(_0x44c4a2[_0x2600('0x30')][_0x2600('0x41')]){_0x2b680e[_0x2600('0x42')]=[{'all':!![]}];}_0x2b680e=_[_0x2600('0x3e')]({},_0x2b680e,_0x44c4a2['options']);return db[_0x2600('0x2b')][_0x2600('0x47')](_0x2b680e)[_0x2600('0x23')](handleEntityNotFound(_0x24ffd6,null))['then'](respondWithResult(_0x24ffd6,null))['catch'](handleError(_0x24ffd6,null));};exports[_0x2600('0x48')]=function(_0x5789a1,_0x5363fa){return db['WhatsappApplication'][_0x2600('0x48')](_0x5789a1[_0x2600('0x49')],{})[_0x2600('0x23')](respondWithResult(_0x5363fa,0xc9))[_0x2600('0x44')](handleError(_0x5363fa,null));};exports[_0x2600('0x4a')]=function(_0xc784de,_0xf5b698){if(_0xc784de['body']['id']){delete _0xc784de['body']['id'];}return db['WhatsappApplication'][_0x2600('0x47')]({'where':{'id':_0xc784de[_0x2600('0x46')]['id']}})[_0x2600('0x23')](handleEntityNotFound(_0xf5b698,null))[_0x2600('0x23')](saveUpdates(_0xc784de['body'],null))[_0x2600('0x23')](respondWithResult(_0xf5b698,null))['catch'](handleError(_0xf5b698,null));};exports[_0x2600('0x24')]=function(_0x56e46d,_0x4d5ba7){return db['WhatsappApplication'][_0x2600('0x47')]({'where':{'id':_0x56e46d[_0x2600('0x46')]['id']}})[_0x2600('0x23')](handleEntityNotFound(_0x4d5ba7,null))[_0x2600('0x23')](removeEntity(_0x4d5ba7,null))[_0x2600('0x44')](handleError(_0x4d5ba7,null));}; \ No newline at end of file diff --git a/server/api/whatsappApplication/whatsappApplication.model.js b/server/api/whatsappApplication/whatsappApplication.model.js index e3d1551..e7d3bf6 100644 --- a/server/api/whatsappApplication/whatsappApplication.model.js +++ b/server/api/whatsappApplication/whatsappApplication.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x424c=['define','WhatsappApplication','whatsapp_applications','utf8mb4','utf8mb4_unicode_ci','../../config/logger','api','moment','bluebird','path','../../config/environment','./whatsappApplication.attributes','exports'];(function(_0x501510,_0x61caa9){var _0x1e6ee5=function(_0x32845b){while(--_0x32845b){_0x501510['push'](_0x501510['shift']());}};_0x1e6ee5(++_0x61caa9);}(_0x424c,0x6d));var _0xc424=function(_0x1f869c,_0x118fd4){_0x1f869c=_0x1f869c-0x0;var _0x47eb58=_0x424c[_0x1f869c];return _0x47eb58;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0xc424('0x0'))(_0xc424('0x1'));var moment=require(_0xc424('0x2'));var BPromise=require(_0xc424('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xc424('0x4'));var rimraf=require('rimraf');var config=require(_0xc424('0x5'));var attributes=require(_0xc424('0x6'));module[_0xc424('0x7')]=function(_0x3bebd9,_0x5707c3){return _0x3bebd9[_0xc424('0x8')](_0xc424('0x9'),attributes,{'tableName':_0xc424('0xa'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0xc424('0xb'),'collate':_0xc424('0xc')});}; \ No newline at end of file +var _0x58ed=['./whatsappApplication.attributes','exports','define','WhatsappApplication','whatsapp_applications','lodash','util','../../config/logger','api','moment','bluebird','path','../../config/environment'];(function(_0x17b3a0,_0x24e743){var _0x3bb234=function(_0x589579){while(--_0x589579){_0x17b3a0['push'](_0x17b3a0['shift']());}};_0x3bb234(++_0x24e743);}(_0x58ed,0xae));var _0xd58e=function(_0x346797,_0x2d92e2){_0x346797=_0x346797-0x0;var _0x4f1b71=_0x58ed[_0x346797];return _0x4f1b71;};'use strict';var _=require(_0xd58e('0x0'));var util=require(_0xd58e('0x1'));var logger=require(_0xd58e('0x2'))(_0xd58e('0x3'));var moment=require(_0xd58e('0x4'));var BPromise=require(_0xd58e('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xd58e('0x6'));var rimraf=require('rimraf');var config=require(_0xd58e('0x7'));var attributes=require(_0xd58e('0x8'));module[_0xd58e('0x9')]=function(_0x596906,_0x53a50b){return _0x596906[_0xd58e('0xa')](_0xd58e('0xb'),attributes,{'tableName':_0xd58e('0xc'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':'utf8mb4','collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file diff --git a/server/api/whatsappApplication/whatsappApplication.rpc.js b/server/api/whatsappApplication/whatsappApplication.rpc.js index 57111cc..d6a33a9 100644 --- a/server/api/whatsappApplication/whatsappApplication.rpc.js +++ b/server/api/whatsappApplication/whatsappApplication.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9e8a=['info','request\x20sent','debug','WhatsappApplication,\x20%s,\x20%s,\x20%s','error','code','WhatsappApplication,\x20%s,\x20%s','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','http','request','then'];(function(_0x4625dc,_0x30603e){var _0x48ceca=function(_0x43ee9f){while(--_0x43ee9f){_0x4625dc['push'](_0x4625dc['shift']());}};_0x48ceca(++_0x30603e);}(_0x9e8a,0x112));var _0xa9e8=function(_0x4fce48,_0x2d5d19){_0x4fce48=_0x4fce48-0x0;var _0x1ce81f=_0x9e8a[_0x4fce48];return _0x1ce81f;};'use strict';var _=require(_0xa9e8('0x0'));var util=require(_0xa9e8('0x1'));var moment=require(_0xa9e8('0x2'));var BPromise=require(_0xa9e8('0x3'));var rs=require(_0xa9e8('0x4'));var fs=require('fs');var Redis=require(_0xa9e8('0x5'));var db=require(_0xa9e8('0x6'))['db'];var utils=require(_0xa9e8('0x7'));var logger=require(_0xa9e8('0x8'))('rpc');var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson['client'][_0xa9e8('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x3f9d95,_0x44e943,_0x3578d3){return new BPromise(function(_0x456245,_0x538ba7){return client[_0xa9e8('0xa')](_0x3f9d95,_0x3578d3)[_0xa9e8('0xb')](function(_0x1467f2){logger[_0xa9e8('0xc')]('WhatsappApplication,\x20%s,\x20%s',_0x44e943,_0xa9e8('0xd'));logger[_0xa9e8('0xe')](_0xa9e8('0xf'),_0x44e943,_0xa9e8('0xd'),JSON['stringify'](_0x1467f2));if(_0x1467f2[_0xa9e8('0x10')]){if(_0x1467f2[_0xa9e8('0x10')][_0xa9e8('0x11')]===0x1f4){logger[_0xa9e8('0x10')](_0xa9e8('0x12'),_0x44e943,_0x1467f2[_0xa9e8('0x10')][_0xa9e8('0x13')]);return _0x538ba7(_0x1467f2[_0xa9e8('0x10')]['message']);}logger[_0xa9e8('0x10')]('WhatsappApplication,\x20%s,\x20%s',_0x44e943,_0x1467f2['error']['message']);return _0x456245(_0x1467f2['error']['message']);}else{logger[_0xa9e8('0xc')](_0xa9e8('0x12'),_0x44e943,_0xa9e8('0xd'));_0x456245(_0x1467f2[_0xa9e8('0x14')][_0xa9e8('0x13')]);}})[_0xa9e8('0x15')](function(_0x541831){logger[_0xa9e8('0x10')]('WhatsappApplication,\x20%s,\x20%s',_0x44e943,_0x541831);_0x538ba7(_0x541831);});});} \ No newline at end of file +var _0x4c60=['client','http','request','then','debug','request\x20sent','stringify','error','code','WhatsappApplication,\x20%s,\x20%s','message','info','catch','lodash','util','moment','bluebird','ioredis','../../config/environment','jayson/promise'];(function(_0x1c75fe,_0x100ea9){var _0x589f00=function(_0x245233){while(--_0x245233){_0x1c75fe['push'](_0x1c75fe['shift']());}};_0x589f00(++_0x100ea9);}(_0x4c60,0xc1));var _0x04c6=function(_0x5e8ef4,_0xc9e8df){_0x5e8ef4=_0x5e8ef4-0x0;var _0x1d68fa=_0x4c60[_0x5e8ef4];return _0x1d68fa;};'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']('WhatsappApplication,\x20%s,\x20%s',_0x39be2d,'request\x20sent');logger[_0x04c6('0xb')]('WhatsappApplication,\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);});});} \ No newline at end of file diff --git a/server/api/whatsappInteraction/index.js b/server/api/whatsappInteraction/index.js index 8927afc..8e78776 100644 --- a/server/api/whatsappInteraction/index.js +++ b/server/api/whatsappInteraction/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x50aa=['connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./whatsappInteraction.controller','get','isAuthenticated','/describe','describe','/:id','show','/:id/download','download','post','/:id/messages','addMessage','/:id/tags','whatsappinteraction:addtags','addTags','put','tracked','whatsapp','delete','destroy','removeTags','exports','path'];(function(_0x36c732,_0x37fa2a){var _0x45f202=function(_0x508f94){while(--_0x508f94){_0x36c732['push'](_0x36c732['shift']());}};_0x45f202(++_0x37fa2a);}(_0x50aa,0x195));var _0xa50a=function(_0x5eca50,_0xc1e3f8){_0x5eca50=_0x5eca50-0x0;var _0x41fb84=_0x50aa[_0x5eca50];return _0x41fb84;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0xa50a('0x0'));var timeout=require(_0xa50a('0x1'));var express=require(_0xa50a('0x2'));var router=express[_0xa50a('0x3')]();var auth=require(_0xa50a('0x4'));var interaction=require(_0xa50a('0x5'));var config=require(_0xa50a('0x6'));var controller=require(_0xa50a('0x7'));router[_0xa50a('0x8')]('/',auth[_0xa50a('0x9')](),controller['index']);router[_0xa50a('0x8')](_0xa50a('0xa'),auth[_0xa50a('0x9')](),controller[_0xa50a('0xb')]);router['get'](_0xa50a('0xc'),auth[_0xa50a('0x9')](),controller[_0xa50a('0xd')]);router[_0xa50a('0x8')]('/:id/messages',auth[_0xa50a('0x9')](),controller['getMessages']);router['get'](_0xa50a('0xe'),auth[_0xa50a('0x9')](),controller[_0xa50a('0xf')]);router[_0xa50a('0x10')]('/',auth[_0xa50a('0x9')](),controller['create']);router['post'](_0xa50a('0x11'),auth[_0xa50a('0x9')](),controller[_0xa50a('0x12')]);router[_0xa50a('0x10')](_0xa50a('0x13'),auth[_0xa50a('0x9')](),interaction['tracked']('whatsapp',_0xa50a('0x14')),controller[_0xa50a('0x15')]);router[_0xa50a('0x16')](_0xa50a('0xc'),auth['isAuthenticated'](),interaction[_0xa50a('0x17')](_0xa50a('0x18'),'whatsappinteraction:update'),controller['update']);router[_0xa50a('0x19')]('/:id',auth[_0xa50a('0x9')](),interaction[_0xa50a('0x17')](_0xa50a('0x18'),'whatsappinteraction:destroy'),controller[_0xa50a('0x1a')]);router[_0xa50a('0x19')](_0xa50a('0x13'),auth[_0xa50a('0x9')](),controller[_0xa50a('0x1b')]);module[_0xa50a('0x1c')]=router; \ No newline at end of file +var _0xf15e=['path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','./whatsappInteraction.controller','get','isAuthenticated','index','/describe','describe','/:id','show','getMessages','download','post','create','addMessage','whatsapp','whatsappinteraction:addtags','addTags','update','delete','tracked','whatsappinteraction:destroy','destroy','/:id/tags','removeTags','exports','multer'];(function(_0x3ef59f,_0x468ced){var _0x403e29=function(_0x2c8faa){while(--_0x2c8faa){_0x3ef59f['push'](_0x3ef59f['shift']());}};_0x403e29(++_0x468ced);}(_0xf15e,0xb9));var _0xef15=function(_0xe98280,_0x4618b8){_0xe98280=_0xe98280-0x0;var _0x57b85d=_0xf15e[_0xe98280];return _0x57b85d;};'use strict';var multer=require(_0xef15('0x0'));var util=require('util');var path=require(_0xef15('0x1'));var timeout=require(_0xef15('0x2'));var express=require(_0xef15('0x3'));var router=express[_0xef15('0x4')]();var auth=require(_0xef15('0x5'));var interaction=require(_0xef15('0x6'));var config=require('../../config/environment');var controller=require(_0xef15('0x7'));router[_0xef15('0x8')]('/',auth[_0xef15('0x9')](),controller[_0xef15('0xa')]);router['get'](_0xef15('0xb'),auth[_0xef15('0x9')](),controller[_0xef15('0xc')]);router['get'](_0xef15('0xd'),auth[_0xef15('0x9')](),controller[_0xef15('0xe')]);router[_0xef15('0x8')]('/:id/messages',auth[_0xef15('0x9')](),controller[_0xef15('0xf')]);router[_0xef15('0x8')]('/:id/download',auth[_0xef15('0x9')](),controller[_0xef15('0x10')]);router[_0xef15('0x11')]('/',auth[_0xef15('0x9')](),controller[_0xef15('0x12')]);router['post']('/:id/messages',auth[_0xef15('0x9')](),controller[_0xef15('0x13')]);router[_0xef15('0x11')]('/:id/tags',auth[_0xef15('0x9')](),interaction['tracked'](_0xef15('0x14'),_0xef15('0x15')),controller[_0xef15('0x16')]);router['put'](_0xef15('0xd'),auth['isAuthenticated'](),interaction['tracked'](_0xef15('0x14'),'whatsappinteraction:update'),controller[_0xef15('0x17')]);router[_0xef15('0x18')](_0xef15('0xd'),auth[_0xef15('0x9')](),interaction[_0xef15('0x19')]('whatsapp',_0xef15('0x1a')),controller[_0xef15('0x1b')]);router[_0xef15('0x18')](_0xef15('0x1c'),auth['isAuthenticated'](),controller[_0xef15('0x1d')]);module[_0xef15('0x1e')]=router; \ No newline at end of file diff --git a/server/api/whatsappInteraction/whatsappInteraction.attributes.js b/server/api/whatsappInteraction/whatsappInteraction.attributes.js index fb5edbe..339ecad 100644 --- a/server/api/whatsappInteraction/whatsappInteraction.attributes.js +++ b/server/api/whatsappInteraction/whatsappInteraction.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x58c4=['STRING','out','sequelize','exports','BOOLEAN','DATE'];(function(_0x996bc8,_0x291e01){var _0x20b0ea=function(_0x5ba992){while(--_0x5ba992){_0x996bc8['push'](_0x996bc8['shift']());}};_0x20b0ea(++_0x291e01);}(_0x58c4,0x11c));var _0x458c=function(_0x3ad8cd,_0x1361ad){_0x3ad8cd=_0x3ad8cd-0x0;var _0x25e7c1=_0x58c4[_0x3ad8cd];return _0x25e7c1;};'use strict';var Sequelize=require(_0x458c('0x0'));var moment=require('moment');module[_0x458c('0x1')]={'closed':{'type':Sequelize[_0x458c('0x2')],'defaultValue':![]},'closedAt':{'type':Sequelize[_0x458c('0x3')]},'disposition':{'type':Sequelize[_0x458c('0x4')]},'note':{'type':Sequelize[_0x458c('0x4')]},'phone':{'type':Sequelize[_0x458c('0x4')]},'read1stAt':{'type':Sequelize[_0x458c('0x3')]},'firstMsgDirection':{'type':Sequelize['ENUM']('in',_0x458c('0x5')),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize['DATE']},'lastMsgDirection':{'type':Sequelize['ENUM']('in',_0x458c('0x5')),'defaultValue':'in','allowNull':![]}}; \ No newline at end of file +var _0x24d0=['sequelize','exports','BOOLEAN','STRING','DATE','ENUM','out'];(function(_0x5068d5,_0x353c3d){var _0x22123e=function(_0x3cf8ee){while(--_0x3cf8ee){_0x5068d5['push'](_0x5068d5['shift']());}};_0x22123e(++_0x353c3d);}(_0x24d0,0x1ab));var _0x024d=function(_0x138adb,_0x193fee){_0x138adb=_0x138adb-0x0;var _0x1b27f2=_0x24d0[_0x138adb];return _0x1b27f2;};'use strict';var Sequelize=require(_0x024d('0x0'));var moment=require('moment');module[_0x024d('0x1')]={'closed':{'type':Sequelize[_0x024d('0x2')],'defaultValue':![]},'closedAt':{'type':Sequelize['DATE']},'disposition':{'type':Sequelize[_0x024d('0x3')]},'note':{'type':Sequelize[_0x024d('0x3')]},'phone':{'type':Sequelize['STRING']},'read1stAt':{'type':Sequelize[_0x024d('0x4')]},'firstMsgDirection':{'type':Sequelize[_0x024d('0x5')]('in',_0x024d('0x6')),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize[_0x024d('0x4')]},'lastMsgDirection':{'type':Sequelize[_0x024d('0x5')]('in',_0x024d('0x6')),'defaultValue':'in','allowNull':![]}}; \ No newline at end of file diff --git a/server/api/whatsappInteraction/whatsappInteraction.controller.js b/server/api/whatsappInteraction/whatsappInteraction.controller.js index 1434022..c76d8d2 100644 --- a/server/api/whatsappInteraction/whatsappInteraction.controller.js +++ b/server/api/whatsappInteraction/whatsappInteraction.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x7a54=['attachments','Attachment','direction','secret','WhatsappAccount','Account','Owner','mkdirSync','30px','%s\x20#%d','Whatsapp','YYYY-MM-DD','YYYY-MM-DD\x20HH:mm:ss','closedAt','disposition','Messages','basename','existsSync','createReadStream','pipe','createWriteStream','System','out','renderFile','views','downloadInteraction.html','toFile','transcript-','.pdf','download','log','err','unlinkSync','html-pdf','eml-format','rimraf','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','ejs','squel','crypto','desk.js','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','api','../../config/utils','../../config/environment','../../mysqldb','redis','defaults','socket.io-emitter','./whatsappInteraction.socket','register','sendStatus','end','status','count','offset','limit','set','json','apply','reject','update','destroy','then','error','stack','name','send','Users','map','fullname','TagIds','Tags','split','push','catch','index','rawAttributes','fieldName','type','key','model','query','keys','intersection','attributes','fields','length','hasOwnProperty','order','sort','where','pick','filters','select','color','tools_tags','u.id','field','ui.WhatsappInteractionId','user_has_whatsapp_interactions','left_join','users','u.id\x20=\x20ui.UserId','from','whatsapp_interactions','cm_contacts','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL','o.id\x20=\x20i.UserId','whatsapp_accounts','whatsapp_messages','whatsapp_interaction_has_tags','expr','search','parseSearch','sqlOperator','conditions','find','unreadMessages','having','`\x20=\x200','`\x20>\x200','Contact','operator','$substring','value','getFullTextValue','c.firstName\x20LIKE\x20?\x20OR\x20c.lastName\x20LIKE\x20?\x20OR\x20c.email\x20LIKE\x20?','ContactId','text','Tag','CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','union','UserId','buildExpression','start','body','isEmpty','WhatsappAccountId','i.WhatsappAccountId\x20IN\x20?','concat','createdAt','$gte','parse','i.createdAt\x20BETWEEN\x20?\x20AND\x20?','null','\x20IS\x20NULL','\x20=\x20?','read','`unreadMessages`\x20=\x200','`unreadMessages`\x20>\x200','tag','filter','isNumeric','i.id\x20LIKE\x20?','i.phone\x20LIKE\x20?','MATCH\x20(me.body)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','CONCAT(c.firstName,\x20\x27\x20\x27,\x20c.lastName)\x20LIKE\x20?','group','i.id','Sequelize','QueryTypes','SELECT','clone','SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','forEach','DESC','t.id\x20IN\x20?','resolve','i.WhatsappAccountId\x20IS\x20NOT\x20NULL','user','i.WhatsappAccountId\x20IS\x20NULL','sequelize','toString','keyBy','merge','Account.key','Account.mandatoryDisposition','i.*','c.firstName','c.lastName','Contact.lastName','c.email','Contact.email','Contact.phone','c.mobile','c.fax','Contact.fax','Owner.fullname','o.internal','Owner.internal','ui.WhatsappInteractionId\x20IN\x20?','WhatsappInteractionId','rows','show','params','includeAll','include','WhatsappInteraction','create','addMessage','WhatsappMessage','omit','ids','getMessages','findOne','format','options','findAll','emit','removeTags','unix','root','files','tmp','server','join','transcript-%d-%s.zip','User','firstName','lastName'];(function(_0xe73080,_0x24c56d){var _0x12cbc4=function(_0x1377e2){while(--_0x1377e2){_0xe73080['push'](_0xe73080['shift']());}};_0x12cbc4(++_0x24c56d);}(_0x7a54,0x106));var _0x47a5=function(_0x125cc3,_0x49f37d){_0x125cc3=_0x125cc3-0x0;var _0x468a1f=_0x7a54[_0x125cc3];return _0x468a1f;};'use strict';var pdf=require(_0x47a5('0x0'));var emlformat=require(_0x47a5('0x1'));var rimraf=require(_0x47a5('0x2'));var zipdir=require('zip-dir');var jsonpatch=require(_0x47a5('0x3'));var rp=require(_0x47a5('0x4'));var moment=require('moment');var BPromise=require(_0x47a5('0x5'));var Mustache=require(_0x47a5('0x6'));var util=require(_0x47a5('0x7'));var path=require(_0x47a5('0x8'));var sox=require(_0x47a5('0x9'));var csv=require('to-csv');var ejs=require(_0x47a5('0xa'));var fs=require('fs');var _=require('lodash');var squel=require(_0x47a5('0xb'));var crypto=require(_0x47a5('0xc'));var jsforce=require('jsforce');var deskjs=require(_0x47a5('0xd'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x47a5('0xe'));var authService=require(_0x47a5('0xf'));var qs=require('../../components/parsers/qs');var as=require(_0x47a5('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x47a5('0x11'));var utils=require(_0x47a5('0x12'));var config=require(_0x47a5('0x13'));var db=require(_0x47a5('0x14'))['db'];config[_0x47a5('0x15')]=_[_0x47a5('0x16')](config[_0x47a5('0x15')],{'host':'localhost','port':0x18eb});var socket=require(_0x47a5('0x17'))(new Redis(config[_0x47a5('0x15')]));require(_0x47a5('0x18'))[_0x47a5('0x19')](socket);function respondWithStatusCode(_0x139f25,_0x620ee9){_0x620ee9=_0x620ee9||0xcc;return function(_0x3c6c46){if(_0x3c6c46){return _0x139f25[_0x47a5('0x1a')](_0x620ee9);}return _0x139f25['status'](_0x620ee9)[_0x47a5('0x1b')]();};}function respondWithResult(_0x11faf5,_0x3b001e){_0x3b001e=_0x3b001e||0xc8;return function(_0x2a2cbb){if(_0x2a2cbb){return _0x11faf5[_0x47a5('0x1c')](_0x3b001e)['json'](_0x2a2cbb);}};}function respondWithFilteredResult(_0x549de3,_0x138bc0){return function(_0x4b966e){if(_0x4b966e){var _0x5247fd=_0x4b966e[_0x47a5('0x1d')],_0x423a81=_0x138bc0[_0x47a5('0x1e')],_0xaf70a6=_0x138bc0[_0x47a5('0x1e')]+_0x138bc0[_0x47a5('0x1f')],_0x2ce454;if(_0xaf70a6>=_0x5247fd){_0xaf70a6=_0x5247fd;_0x2ce454=0xc8;}else{_0x2ce454=0xce;}_0x549de3[_0x47a5('0x1c')](_0x2ce454);return _0x549de3[_0x47a5('0x20')]('Content-Range',_0x423a81+'-'+_0xaf70a6+'/'+_0x5247fd)[_0x47a5('0x21')](_0x4b966e);}return null;};}function patchUpdates(_0xf160ba){return function(_0x47cf3c){try{jsonpatch[_0x47a5('0x22')](_0x47cf3c,_0xf160ba,!![]);}catch(_0x1f03f7){return BPromise[_0x47a5('0x23')](_0x1f03f7);}return _0x47cf3c['save']();};}function saveUpdates(_0xb8ae6c,_0x2f142b){return function(_0x23db32){if(_0x23db32){return _0x23db32[_0x47a5('0x24')](_0xb8ae6c)['then'](function(_0xe2dea9){return _0xe2dea9;});}return null;};}function removeEntity(_0x385687,_0x513981){return function(_0x28747d){if(_0x28747d){return _0x28747d[_0x47a5('0x25')]()[_0x47a5('0x26')](function(){_0x385687[_0x47a5('0x1c')](0xcc)[_0x47a5('0x1b')]();});}};}function handleEntityNotFound(_0x50bf17,_0x53078a){return function(_0x136745){if(!_0x136745){_0x50bf17['sendStatus'](0x194);}return _0x136745;};}function handleError(_0x1ea9c8,_0x5b6c4e){_0x5b6c4e=_0x5b6c4e||0x1f4;return function(_0x23cb77){logger[_0x47a5('0x27')](_0x23cb77[_0x47a5('0x28')]);if(_0x23cb77[_0x47a5('0x29')]){delete _0x23cb77[_0x47a5('0x29')];}_0x1ea9c8[_0x47a5('0x1c')](_0x5b6c4e)[_0x47a5('0x2a')](_0x23cb77);};}function getInteractionUsers(_0x136b14,_0x16631f){return new BPromise(function(_0x361bfa,_0x1127f8){try{if(_0x16631f[_0x136b14['id']]){_0x136b14[_0x47a5('0x2b')]=_[_0x47a5('0x2c')](_0x16631f[_0x136b14['id']],function(_0x528582){return{'id':_0x528582['id'],'fullname':_0x528582[_0x47a5('0x2d')]};});}}catch(_0x51833b){_0x1127f8(_0x51833b);}_0x361bfa(_0x136b14);});}function getInteractionTags(_0x2ef875,_0x9ac908){return new BPromise(function(_0x16901f,_0x4d6b57){try{if(_0x2ef875[_0x47a5('0x2e')]){_0x2ef875[_0x47a5('0x2f')]=[];_0x2ef875[_0x47a5('0x2e')][_0x47a5('0x30')](',')['forEach'](function(_0x50d875){_0x2ef875[_0x47a5('0x2f')][_0x47a5('0x31')](_0x9ac908[_0x50d875]);});}delete _0x2ef875['TagIds'];}catch(_0x4e1006){_0x4d6b57(_0x4e1006);}_0x16901f(_0x2ef875);});}function updateWhatsappInteraction(_0x836303,_0x51544e,_0x57bff6){return new BPromise(function(_0x42f70c,_0x53119b){return getInteractionUsers(_0x836303,_0x57bff6)[_0x47a5('0x26')](function(_0xd972c){return getInteractionTags(_0xd972c,_0x51544e);})['then'](function(_0x4843c0){_0x42f70c(_0x4843c0);})[_0x47a5('0x32')](function(_0x5910bb){_0x53119b(_0x5910bb);});});}exports[_0x47a5('0x33')]=function(_0x87e4c9,_0xf269a8){var _0x52749b={},_0x18f7e9={},_0x50c086={'count':0x0,'rows':[]};var _0x53c754=_[_0x47a5('0x2c')](db['WhatsappInteraction'][_0x47a5('0x34')],function(_0x5ef577){return{'name':_0x5ef577[_0x47a5('0x35')],'type':_0x5ef577[_0x47a5('0x36')][_0x47a5('0x37')]};});_0x18f7e9[_0x47a5('0x38')]=_[_0x47a5('0x2c')](_0x53c754,_0x47a5('0x29'));_0x18f7e9[_0x47a5('0x39')]=_[_0x47a5('0x3a')](_0x87e4c9[_0x47a5('0x39')]);_0x18f7e9['filters']=_[_0x47a5('0x3b')](_0x18f7e9[_0x47a5('0x38')],_0x18f7e9['query']);_0x52749b[_0x47a5('0x3c')]=_[_0x47a5('0x3b')](_0x18f7e9[_0x47a5('0x38')],qs['fields'](_0x87e4c9[_0x47a5('0x39')][_0x47a5('0x3d')]));_0x52749b['attributes']=_0x52749b[_0x47a5('0x3c')][_0x47a5('0x3e')]?_0x52749b['attributes']:_0x18f7e9['model'];if(!_0x87e4c9['query'][_0x47a5('0x3f')]('nolimit')){_0x52749b[_0x47a5('0x1f')]=qs[_0x47a5('0x1f')](_0x87e4c9[_0x47a5('0x39')][_0x47a5('0x1f')]);_0x52749b[_0x47a5('0x1e')]=qs[_0x47a5('0x1e')](_0x87e4c9[_0x47a5('0x39')][_0x47a5('0x1e')]);}_0x52749b[_0x47a5('0x40')]=qs[_0x47a5('0x41')](_0x87e4c9[_0x47a5('0x39')][_0x47a5('0x41')]);_0x52749b[_0x47a5('0x42')]=qs['filters'](_[_0x47a5('0x43')](_0x87e4c9[_0x47a5('0x39')],_0x18f7e9[_0x47a5('0x44')]),_0x53c754);var _0x23bd8d=[];var _0x586f4f=squel[_0x47a5('0x45')]()['field']('id')['field']('name')['field'](_0x47a5('0x46'))['from'](_0x47a5('0x47'));var _0x3a740b=squel[_0x47a5('0x45')]()['field'](_0x47a5('0x48'))[_0x47a5('0x49')]('u.fullname')['field'](_0x47a5('0x4a'))['from'](_0x47a5('0x4b'),'ui')[_0x47a5('0x4c')](_0x47a5('0x4d'),'u',_0x47a5('0x4e'));var _0x34a9ae=squel[_0x47a5('0x45')]()[_0x47a5('0x4f')](_0x47a5('0x50'),'i')[_0x47a5('0x4c')](_0x47a5('0x51'),'c',_0x47a5('0x52'))[_0x47a5('0x4c')](_0x47a5('0x4d'),'o',_0x47a5('0x53'))[_0x47a5('0x4c')](_0x47a5('0x54'),'a','a.id\x20=\x20i.WhatsappAccountId')[_0x47a5('0x4c')](_0x47a5('0x55'),'me','me.WhatsappInteractionId\x20=\x20i.id')['left_join'](_0x47a5('0x56'),'it','it.WhatsappInteractionId\x20=\x20i.id')[_0x47a5('0x4c')](_0x47a5('0x47'),'t','t.id\x20=\x20it.TagId');var _0x4f62d3=squel[_0x47a5('0x57')]();var _0x52d409=[];var _0x2d147c=squel[_0x47a5('0x57')]();var _0x3548bc;if(_0x87e4c9[_0x47a5('0x39')][_0x47a5('0x58')]){_0x3548bc=as[_0x47a5('0x59')](_0x87e4c9[_0x47a5('0x39')]['search']);var _0x48a0ef=_0x3548bc[_0x47a5('0x5a')];for(var _0x411230=0x0;_0x411230<_0x3548bc[_0x47a5('0x5b')][_0x47a5('0x3e')];_0x411230++){var _0x2c7020=_0x3548bc[_0x47a5('0x5b')][_0x411230];var _0x249de5='i';var _0x492cf7=_[_0x47a5('0x5c')](_0x53c754,[_0x47a5('0x29'),_0x2c7020[_0x47a5('0x49')]]);if(!_0x492cf7){switch(_0x2c7020['field']){case _0x47a5('0x5d'):if(_0x2c7020['value']==0x1){_0x34a9ae[_0x47a5('0x5e')]('`'+_0x2c7020[_0x47a5('0x49')]+_0x47a5('0x5f'));}else{_0x34a9ae[_0x47a5('0x5e')]('`'+_0x2c7020['field']+_0x47a5('0x60'));}break;case _0x47a5('0x61'):if(_0x2c7020[_0x47a5('0x62')]===_0x47a5('0x63')){if(_0x2c7020[_0x47a5('0x64')][_0x47a5('0x30')]('\x20')[_0x47a5('0x3e')]>0x1){_0x4f62d3[_0x48a0ef]('MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)',qs[_0x47a5('0x65')](_0x2c7020[_0x47a5('0x64')]),null);}else{var _0x187d7e='%'+_0x2c7020[_0x47a5('0x64')]+'%';_0x4f62d3[_0x48a0ef](_0x47a5('0x66'),_0x187d7e,_0x187d7e,_0x187d7e);}}else{_0x492cf7=_[_0x47a5('0x5c')](_0x53c754,['name',_0x47a5('0x67')]);_0x2c7020[_0x47a5('0x49')]=_0x47a5('0x67');_0x5cbe97=as['buildExpression'](_0x249de5,_0x492cf7[_0x47a5('0x36')],_0x2c7020);_0x4f62d3[_0x48a0ef](_0x5cbe97[_0x47a5('0x68')],_0x5cbe97[_0x47a5('0x64')]['start'],_0x5cbe97['value'][_0x47a5('0x1b')]);}break;case _0x47a5('0x69'):var _0x4fa1da=_0x2c7020['value'][_0x47a5('0x30')](',')['map'](function(_0x16bb8a){return Number(_0x16bb8a);});_0x4fa1da['forEach'](function(_0x482de6){_0x2d147c['or'](_0x47a5('0x6a'),'%,'+_0x482de6+',%');});_0x52d409=_[_0x47a5('0x6b')](_0x52d409,_0x4fa1da);break;case'User':if(_0x2c7020[_0x47a5('0x62')]===_0x47a5('0x63')){_0x4f62d3[_0x48a0ef]('CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?','%'+_0x2c7020['value']+'%',null);}else{_0x492cf7=_[_0x47a5('0x5c')](_0x53c754,[_0x47a5('0x29'),_0x47a5('0x6c')]);_0x2c7020[_0x47a5('0x49')]='UserId';_0x5cbe97=as[_0x47a5('0x6d')](_0x249de5,_0x492cf7[_0x47a5('0x36')],_0x2c7020);_0x4f62d3[_0x48a0ef](_0x5cbe97[_0x47a5('0x68')],_0x5cbe97['value'][_0x47a5('0x6e')],_0x5cbe97['value'][_0x47a5('0x1b')]);}break;case _0x47a5('0x6f'):_0x5cbe97=as[_0x47a5('0x6d')]('me',null,_0x2c7020);_0x4f62d3[_0x48a0ef](_0x5cbe97[_0x47a5('0x68')],_0x5cbe97[_0x47a5('0x64')]['start'],_0x5cbe97[_0x47a5('0x64')]['end']);break;}}else{var _0x5cbe97=as['buildExpression'](_0x249de5,_0x492cf7['type'],_0x2c7020);_0x4f62d3[_0x48a0ef](_0x5cbe97[_0x47a5('0x68')],_0x5cbe97[_0x47a5('0x64')][_0x47a5('0x6e')],_0x5cbe97['value']['end']);}}}else{var _0x139229=_(_0x87e4c9[_0x47a5('0x39')])[_0x47a5('0x3a')]()[_0x47a5('0x2c')](function(_0xc45e25){return _['some'](_0x53c754,[_0x47a5('0x29'),_0xc45e25])?_0xc45e25:undefined;})['compact']()[_0x47a5('0x64')]();if(!_[_0x47a5('0x70')](_0x139229)){_0x139229['forEach'](function(_0x32b4de){if(_0x32b4de===_0x47a5('0x71')){_0x34a9ae[_0x47a5('0x42')](_0x47a5('0x72'),[][_0x47a5('0x73')](_0x87e4c9[_0x47a5('0x39')][_0x32b4de]));}else if(_0x32b4de===_0x47a5('0x74')){var _0x3ac38c=JSON['parse'](_0x87e4c9[_0x47a5('0x39')][_0x32b4de])[_0x47a5('0x75')];var _0x3c75c6=JSON[_0x47a5('0x76')](_0x87e4c9[_0x47a5('0x39')][_0x32b4de])['$lte'];_0x34a9ae[_0x47a5('0x42')](_0x47a5('0x77'),_0x3ac38c,_0x3c75c6);}else{if(_0x87e4c9[_0x47a5('0x39')][_0x32b4de]===_0x47a5('0x78')){_0x34a9ae[_0x47a5('0x42')]('i.'+_0x32b4de+_0x47a5('0x79'));}else{_0x34a9ae[_0x47a5('0x42')]('i.'+_0x32b4de+_0x47a5('0x7a'),_0x87e4c9[_0x47a5('0x39')][_0x32b4de]);}}});}if(_0x87e4c9[_0x47a5('0x39')][_0x47a5('0x7b')]){if(_0x87e4c9[_0x47a5('0x39')][_0x47a5('0x7b')]==0x1){_0x34a9ae[_0x47a5('0x5e')](_0x47a5('0x7c'));}else{_0x34a9ae['having'](_0x47a5('0x7d'));}}if(_0x87e4c9[_0x47a5('0x39')][_0x47a5('0x7e')]){_0x52d409=_['isArray'](_0x87e4c9[_0x47a5('0x39')][_0x47a5('0x7e')])?_0x87e4c9[_0x47a5('0x39')][_0x47a5('0x7e')]:new Array(_0x87e4c9['query'][_0x47a5('0x7e')]);_0x52d409['forEach'](function(_0x2d5ee6){_0x2d147c['or']('CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','%,'+_0x2d5ee6+',%');});}if(_0x87e4c9[_0x47a5('0x39')]['filter']){var _0x7c1190=_0x87e4c9[_0x47a5('0x39')][_0x47a5('0x7f')]['replace']('\x5c','\x5c\x5c')['replace']('\x27\x27','\x27\x27\x27\x27');if(qs[_0x47a5('0x80')](_0x7c1190)){_0x4f62d3['or'](_0x47a5('0x81'),_0x7c1190+'%')['or'](_0x47a5('0x82'),_0x7c1190+'%');}else{_0x4f62d3['or'](_0x47a5('0x83'),qs['getFullTextValue'](_0x7c1190))['or'](_0x47a5('0x84'),_0x7c1190+'%');}}}_0x34a9ae[_0x47a5('0x42')](_0x4f62d3);_0x34a9ae[_0x47a5('0x85')](_0x47a5('0x86'));var _0x308c9a={'type':db[_0x47a5('0x87')][_0x47a5('0x88')][_0x47a5('0x89')],'raw':!![]};var _0x4618a0=_0x34a9ae[_0x47a5('0x8a')]();_0x4618a0[_0x47a5('0x49')](_0x47a5('0x86'));_0x4618a0['field'](_0x47a5('0x8b'),'unreadMessages');if(_0x52749b[_0x47a5('0x40')]){_0x52749b[_0x47a5('0x40')][_0x47a5('0x8c')](function(_0x12fec9){_0x34a9ae[_0x47a5('0x40')]('i.'+_0x12fec9[0x0],_0x12fec9[0x1]===_0x47a5('0x8d')?![]:!![]);});}if(!_[_0x47a5('0x70')](_0x52d409)){_0x34a9ae[_0x47a5('0x5e')](_0x2d147c);_0x4618a0[_0x47a5('0x42')](_0x47a5('0x8e'),_0x52d409);}BPromise[_0x47a5('0x8f')]()[_0x47a5('0x26')](function(){if(!_0x3548bc){if(_0x87e4c9[_0x47a5('0x39')][_0x47a5('0x71')]||_0x87e4c9[_0x47a5('0x39')]['journey'])return;_0x4618a0['where']('i.WhatsappAccountId\x20IS\x20NOT\x20NULL');_0x34a9ae['where'](_0x47a5('0x90'));return;}return _0x87e4c9[_0x47a5('0x91')]['getWhatsappAccounts']({'attributes':['id'],'raw':!![]})[_0x47a5('0x26')](function(_0x44dda2){if(_[_0x47a5('0x70')](_0x44dda2)){_0x4618a0[_0x47a5('0x42')](_0x47a5('0x92'));_0x34a9ae[_0x47a5('0x42')](_0x47a5('0x92'));}else{_0x4618a0[_0x47a5('0x42')](_0x47a5('0x72'),_[_0x47a5('0x2c')](_0x44dda2,'id'));_0x34a9ae[_0x47a5('0x42')]('i.WhatsappAccountId\x20IN\x20?',_[_0x47a5('0x2c')](_0x44dda2,'id'));}});})[_0x47a5('0x26')](function(){db[_0x47a5('0x93')]['query'](_0x4618a0[_0x47a5('0x94')](),_0x308c9a)[_0x47a5('0x26')](function(_0x17b61d){_0x50c086['count']=_0x17b61d[_0x47a5('0x3e')];if(_0x50c086['count']===0x0)return[];return db['sequelize'][_0x47a5('0x39')](_0x586f4f[_0x47a5('0x94')](),_0x308c9a)[_0x47a5('0x26')](function(_0x27333e){_0x23bd8d=_[_0x47a5('0x95')](_0x27333e,'id');_0x308c9a=_[_0x47a5('0x96')](_0x308c9a,{'model':db['WhatsappInteraction'],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x87e4c9['query'][_0x47a5('0x3d')]){_0x52749b['attributes'][_0x47a5('0x8c')](function(_0x3fffd1){_0x34a9ae[_0x47a5('0x49')]('i.'+_0x3fffd1);});}else{_0x34a9ae[_0x47a5('0x49')]('SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)',_0x47a5('0x5d'));_0x34a9ae['field']('a.key',_0x47a5('0x97'));_0x34a9ae[_0x47a5('0x49')]('a.mandatoryDisposition',_0x47a5('0x98'));_0x34a9ae[_0x47a5('0x49')](_0x47a5('0x99'));_0x34a9ae['field'](_0x47a5('0x9a'),'Contact.firstName');_0x34a9ae[_0x47a5('0x49')](_0x47a5('0x9b'),_0x47a5('0x9c'));_0x34a9ae['field'](_0x47a5('0x9d'),_0x47a5('0x9e'));_0x34a9ae[_0x47a5('0x49')]('c.phone',_0x47a5('0x9f'));_0x34a9ae['field'](_0x47a5('0xa0'),'Contact.mobile');_0x34a9ae[_0x47a5('0x49')](_0x47a5('0xa1'),_0x47a5('0xa2'));_0x34a9ae[_0x47a5('0x49')]('o.fullname',_0x47a5('0xa3'));_0x34a9ae[_0x47a5('0x49')](_0x47a5('0xa4'),_0x47a5('0xa5'));_0x34a9ae[_0x47a5('0x49')]('GROUP_CONCAT(DISTINCT\x20t.id)','TagIds');}if(_0x52749b[_0x47a5('0x1f')])_0x34a9ae['limit'](_0x52749b[_0x47a5('0x1f')]);if(_0x52749b[_0x47a5('0x1e')])_0x34a9ae[_0x47a5('0x1e')](_0x52749b['offset']);return db[_0x47a5('0x93')][_0x47a5('0x39')](_0x34a9ae['toString'](),_0x308c9a);})[_0x47a5('0x26')](function(_0x8a9dea){_0x3a740b[_0x47a5('0x42')](_0x47a5('0xa6'),_['map'](_0x8a9dea,'id'));return db['sequelize'][_0x47a5('0x39')](_0x3a740b[_0x47a5('0x94')](),_0x308c9a)['then'](function(_0x27d422){var _0x23f055=_['groupBy'](_0x27d422,_0x47a5('0xa7'));var _0x2a02cd=[];_0x8a9dea[_0x47a5('0x8c')](function(_0x59f010){_0x2a02cd[_0x47a5('0x31')](updateWhatsappInteraction(_0x59f010,_0x23bd8d,_0x23f055));});return BPromise['all'](_0x2a02cd);});});})[_0x47a5('0x26')](function(_0x5e2946){_0x50c086[_0x47a5('0xa8')]=_0x5e2946;return _0x50c086;})[_0x47a5('0x26')](respondWithFilteredResult(_0xf269a8,_0x52749b));})['catch'](handleError(_0xf269a8,null));};exports[_0x47a5('0xa9')]=function(_0x597cb2,_0x1eabef){var _0x36f619={'raw':![],'where':{'id':_0x597cb2[_0x47a5('0xaa')]['id']}},_0x37e045={};_0x37e045['model']=_[_0x47a5('0x3a')](db['WhatsappInteraction']['rawAttributes']);_0x37e045[_0x47a5('0x39')]=_[_0x47a5('0x3a')](_0x597cb2[_0x47a5('0x39')]);_0x37e045[_0x47a5('0x44')]=_[_0x47a5('0x3b')](_0x37e045['model'],_0x37e045[_0x47a5('0x39')]);_0x36f619[_0x47a5('0x3c')]=_[_0x47a5('0x3b')](_0x37e045[_0x47a5('0x38')],qs['fields'](_0x597cb2[_0x47a5('0x39')]['fields']));_0x36f619[_0x47a5('0x3c')]=_0x36f619[_0x47a5('0x3c')][_0x47a5('0x3e')]?_0x36f619[_0x47a5('0x3c')]:_0x37e045[_0x47a5('0x38')];if(_0x597cb2[_0x47a5('0x39')][_0x47a5('0xab')]){_0x36f619[_0x47a5('0xac')]=[{'all':!![]}];}_0x36f619=_[_0x47a5('0x96')]({},_0x36f619,_0x597cb2['options']);return db[_0x47a5('0xad')][_0x47a5('0x5c')](_0x36f619)['then'](handleEntityNotFound(_0x1eabef,null))[_0x47a5('0x26')](respondWithResult(_0x1eabef,null))[_0x47a5('0x32')](handleError(_0x1eabef,null));};exports[_0x47a5('0xae')]=function(_0x5b85cd,_0x4bf1f5){return db[_0x47a5('0xad')][_0x47a5('0xae')](_0x5b85cd['body'],{})['then'](respondWithResult(_0x4bf1f5,0xc9))[_0x47a5('0x32')](handleError(_0x4bf1f5,null));};exports[_0x47a5('0x24')]=function(_0x54eab1,_0x29e384){if(_0x54eab1[_0x47a5('0x6f')]['id']){delete _0x54eab1['body']['id'];}return db[_0x47a5('0xad')][_0x47a5('0x5c')]({'where':{'id':_0x54eab1[_0x47a5('0xaa')]['id']}})[_0x47a5('0x26')](handleEntityNotFound(_0x29e384,null))[_0x47a5('0x26')](saveUpdates(_0x54eab1[_0x47a5('0x6f')],null))['then'](respondWithResult(_0x29e384,null))['catch'](handleError(_0x29e384,null));};exports['destroy']=function(_0x133b7a,_0xce5ada){return db['WhatsappInteraction'][_0x47a5('0x5c')]({'where':{'id':_0x133b7a[_0x47a5('0xaa')]['id']}})[_0x47a5('0x26')](handleEntityNotFound(_0xce5ada,null))[_0x47a5('0x26')](removeEntity(_0xce5ada,null))[_0x47a5('0x32')](handleError(_0xce5ada,null));};exports['describe']=function(_0x3e7750,_0x548a06){return db['WhatsappInteraction']['describe']()[_0x47a5('0x26')](respondWithResult(_0x548a06,null))['catch'](handleError(_0x548a06,null));};exports[_0x47a5('0xaf')]=function(_0xf3edc8,_0x5a316e,_0x49f791){return db[_0x47a5('0xb0')][_0x47a5('0x5c')]({'where':{'id':_0xf3edc8[_0x47a5('0xaa')]['id']}})[_0x47a5('0x26')](handleEntityNotFound(_0x5a316e,null))[_0x47a5('0x26')](function(_0x581a87){if(_0x581a87){return _0x581a87[_0x47a5('0xaf')](_0xf3edc8[_0x47a5('0x6f')]['ids'],_[_0x47a5('0xb1')](_0xf3edc8[_0x47a5('0x6f')],[_0x47a5('0xb2'),'id'])||{});}})[_0x47a5('0x26')](respondWithResult(_0x5a316e,null))[_0x47a5('0x32')](handleError(_0x5a316e,null));};exports[_0x47a5('0xb3')]=function(_0x5112d7,_0x6a8174,_0x2e418d){var _0x50b236={'raw':![],'where':{}};var _0x263521={};var _0x9769b5={'count':0x0,'rows':[]};return db[_0x47a5('0xad')][_0x47a5('0xb4')]({'where':{'id':_0x5112d7['params']['id']}})['then'](handleEntityNotFound(_0x6a8174,null))['then'](function(_0x4eee99){if(_0x4eee99){_0x263521[_0x47a5('0x38')]=_[_0x47a5('0x3a')](db[_0x47a5('0xb0')][_0x47a5('0x34')]);_0x263521[_0x47a5('0x39')]=_[_0x47a5('0x3a')](_0x5112d7[_0x47a5('0x39')]);_0x263521[_0x47a5('0x44')]=_['intersection'](_0x263521[_0x47a5('0x38')],_0x263521[_0x47a5('0x39')]);_0x50b236[_0x47a5('0x3c')]=_[_0x47a5('0x3b')](_0x263521['model'],qs['fields'](_0x5112d7[_0x47a5('0x39')]['fields']));_0x50b236['attributes']=_0x50b236[_0x47a5('0x3c')][_0x47a5('0x3e')]?_0x50b236['attributes']:_0x263521[_0x47a5('0x38')];if(!_0x5112d7[_0x47a5('0x39')][_0x47a5('0x3f')]('nolimit')){_0x50b236[_0x47a5('0x1f')]=qs[_0x47a5('0x1f')](_0x5112d7['query'][_0x47a5('0x1f')]);_0x50b236[_0x47a5('0x1e')]=qs[_0x47a5('0x1e')](_0x5112d7[_0x47a5('0x39')][_0x47a5('0x1e')]);}_0x50b236[_0x47a5('0x40')]=qs['sort'](_0x5112d7[_0x47a5('0x39')]['sort']);_0x50b236[_0x47a5('0x42')]=qs[_0x47a5('0x44')](_[_0x47a5('0x43')](_0x5112d7[_0x47a5('0x39')],_0x263521['filters']));_0x50b236[_0x47a5('0x42')][_0x47a5('0xa7')]=_0x4eee99['id'];if(_0x5112d7[_0x47a5('0x39')][_0x47a5('0x7f')]){_0x50b236[_0x47a5('0x42')]=_[_0x47a5('0x96')](_0x50b236[_0x47a5('0x42')],{'$or':_[_0x47a5('0x2c')](_0x50b236[_0x47a5('0x3c')],function(_0xa2045c){var _0x109738={};_0x109738[_0xa2045c]={'$like':'%'+_0x5112d7[_0x47a5('0x39')]['filter']+'%'};return _0x109738;})});}if(_0x5112d7[_0x47a5('0x39')][_0x47a5('0x75')]){var _0x591bde=_0x5112d7[_0x47a5('0x39')][_0x47a5('0x75')][_0x47a5('0x30')](',');var _0x2ccf21={};_0x2ccf21[_0x591bde[0x0]]={'$gte':moment(_0x591bde[0x1])[_0x47a5('0xb5')]('YYYY-MM-DD\x20HH:mm:ss')};_0x50b236[_0x47a5('0x42')]=_[_0x47a5('0x96')](_0x50b236[_0x47a5('0x42')],_0x2ccf21);}_0x50b236=_[_0x47a5('0x96')]({},_0x50b236,_0x5112d7[_0x47a5('0xb6')]);return db[_0x47a5('0xb0')][_0x47a5('0x1d')]({'where':_0x50b236['where']})['then'](function(_0xa3d578){_0x9769b5['count']=_0xa3d578;if(_0x5112d7[_0x47a5('0x39')]['includeAll']){_0x50b236[_0x47a5('0xac')]=[{'all':!![]}];}return db[_0x47a5('0xb0')][_0x47a5('0xb7')](_0x50b236);})[_0x47a5('0x26')](function(_0x49cb8c){_0x9769b5[_0x47a5('0xa8')]=_0x49cb8c;return _0x9769b5;});}})[_0x47a5('0x26')](respondWithFilteredResult(_0x6a8174,_0x50b236))[_0x47a5('0x32')](handleError(_0x6a8174,null));};exports['addTags']=function(_0x581759,_0x30375f,_0x29015a){return db[_0x47a5('0xad')][_0x47a5('0x5c')]({'where':{'id':_0x581759[_0x47a5('0xaa')]['id']}})[_0x47a5('0x26')](handleEntityNotFound(_0x30375f,null))[_0x47a5('0x26')](function(_0xe662d7){if(_0xe662d7){return _0xe662d7['setTags'](_0x581759[_0x47a5('0x6f')]['ids'],_[_0x47a5('0xb1')](_0x581759[_0x47a5('0x6f')],['ids','id'])||{})['spread'](function(){return db[_0x47a5('0x69')][_0x47a5('0xb7')]({'attributes':['id','name',_0x47a5('0x46')],'where':{'id':_0x581759[_0x47a5('0x6f')][_0x47a5('0xb2')]}});})[_0x47a5('0x26')](function(_0x5a7f32){socket[_0x47a5('0xb8')]('whatsappInteractionTags:save',{'id':Number(_0x581759['params']['id']),'tags':_0x5a7f32||[]});return{'id':Number(_0x581759['params']['id']),'tags':_0x5a7f32||[]};});}})[_0x47a5('0x26')](respondWithResult(_0x30375f,null))['catch'](handleError(_0x30375f,null));};exports[_0x47a5('0xb9')]=function(_0x156d51,_0x401139,_0x2005d5){return db[_0x47a5('0xad')][_0x47a5('0x5c')]({'where':{'id':_0x156d51[_0x47a5('0xaa')]['id']}})[_0x47a5('0x26')](handleEntityNotFound(_0x401139,null))[_0x47a5('0x26')](function(_0x2200f9){if(_0x2200f9){return _0x2200f9[_0x47a5('0xb9')](_0x156d51[_0x47a5('0x39')][_0x47a5('0xb2')]);}})[_0x47a5('0x26')](respondWithStatusCode(_0x401139,null))[_0x47a5('0x32')](handleError(_0x401139,null));};exports['download']=function(_0xdd95c8,_0x40aee5){var _0x322cee=moment()[_0x47a5('0xba')]()['toString']();var _0x367662=path['join'](config[_0x47a5('0xbb')],'server',_0x47a5('0xbc'),_0x47a5('0xbd'));var _0x3b894d=path['join'](config[_0x47a5('0xbb')],_0x47a5('0xbe'),_0x47a5('0xbc'),'attachments');var _0x52798d=path[_0x47a5('0xbf')](_0x367662,_0x322cee);var _0x1a5e07=util[_0x47a5('0xb5')](_0x47a5('0xc0'),_0xdd95c8[_0x47a5('0xaa')]['id'],_0x322cee);var _0x579e5c=path[_0x47a5('0xbf')](_0x367662,_0x1a5e07);var _0x4b3ae4=[];_0x4b3ae4[_0x47a5('0x31')]({'model':db[_0x47a5('0xc1')],'as':_0x47a5('0xc1'),'attributes':['id',_0x47a5('0x2d')],'raw':!![]});_0x4b3ae4['push']({'model':db['CmContact'],'as':_0x47a5('0x61'),'attributes':['id',_0x47a5('0xc2'),_0x47a5('0xc3')],'raw':!![]});if(_0xdd95c8[_0x47a5('0x39')][_0x47a5('0xc4')]){_0x4b3ae4[_0x47a5('0x31')]({'model':db[_0x47a5('0xc5')],'as':_0x47a5('0xc5'),'raw':!![]});}var _0x2c2245=[{'model':db['WhatsappMessage'],'as':'Messages','attributes':['id',_0x47a5('0x6f'),'createdAt',_0x47a5('0xc6'),_0x47a5('0xc7'),_0x47a5('0x7b')],'include':_0x4b3ae4}];_0x2c2245['push']({'model':db[_0x47a5('0xc8')],'as':_0x47a5('0xc9'),'attributes':['id','name']});_0x2c2245[_0x47a5('0x31')]({'model':db['User'],'as':_0x47a5('0xca'),'attributes':['id',_0x47a5('0x2d')]});return db[_0x47a5('0xad')]['find']({'where':{'id':_0xdd95c8['params']['id']},'include':_0x2c2245})['then'](handleEntityNotFound(_0x40aee5,null))['then'](function(_0x5075a6){if(_0x5075a6){var _0x1ba5b6=_0x5075a6['get']({'plain':!![]});fs[_0x47a5('0xcb')](_0x52798d);var _0x2287b0={'format':'A4','border':'10px','header':{'height':'40px','contents':{'first':'\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20
Interaction\x20Transcript
\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20'}},'footer':{'height':_0x47a5('0xcc'),'contents':{'default':util['format']('\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20%s\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20{{page}}/{{pages}}\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20%s\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',util['format'](_0x47a5('0xcd'),_0x47a5('0xce'),_0x1ba5b6['id']),moment()[_0x47a5('0xb5')](_0x47a5('0xcf'))['toString']())}}};var _0xdda046={'channel':'Whatsapp','account':_0x1ba5b6[_0x47a5('0xc9')]['name'],'agent':_0x1ba5b6[_0x47a5('0xca')]?_0x1ba5b6[_0x47a5('0xca')][_0x47a5('0x2d')]:'N.A.','createdAt':moment(_0x1ba5b6[_0x47a5('0x74')])[_0x47a5('0xb5')](_0x47a5('0xd0'))[_0x47a5('0x94')](),'closedAt':_0x1ba5b6['closed']?moment(_0x1ba5b6[_0x47a5('0xd1')])[_0x47a5('0xb5')](_0x47a5('0xd0'))[_0x47a5('0x94')]():'','disposition':_0x1ba5b6[_0x47a5('0xd2')],'messages':_(_0x1ba5b6[_0x47a5('0xd3')])['filter']({'secret':![]})[_0x47a5('0x2c')](function(_0xe245ca){if(_0xe245ca[_0x47a5('0xc5')]){var _0xac8d4f=path[_0x47a5('0xbf')](_0x3b894d,_0xe245ca[_0x47a5('0xc5')][_0x47a5('0xd4')]);if(fs[_0x47a5('0xd5')](_0xac8d4f)){fs[_0x47a5('0xd6')](_0xac8d4f)[_0x47a5('0xd7')](fs[_0x47a5('0xd8')](path[_0x47a5('0xbf')](_0x52798d,_0xe245ca[_0x47a5('0xc5')][_0x47a5('0xd4')])));}}return{'date':moment(_0xe245ca[_0x47a5('0x74')])[_0x47a5('0xb5')](_0x47a5('0xd0'))['toString'](),'sender':_0xe245ca[_0x47a5('0xc6')]==='out'?_0xe245ca['User']?_0xe245ca[_0x47a5('0xc1')][_0x47a5('0x2d')]:_0x47a5('0xd9'):_0xe245ca['Contact'][_0x47a5('0xc2')]+(_0xe245ca[_0x47a5('0x61')][_0x47a5('0xc3')]?'\x20'+_0xe245ca[_0x47a5('0x61')][_0x47a5('0xc3')]:''),'body':_0xe245ca[_0x47a5('0xc5')]?_0xe245ca[_0x47a5('0xc5')][_0x47a5('0xd4')]:_0xe245ca[_0x47a5('0x6f')],'direction':_0xe245ca[_0x47a5('0xc6')]===_0x47a5('0xda')?'A':'C','secret':_0xe245ca[_0x47a5('0xc7')],'read':_0xe245ca[_0x47a5('0x7b')],'attachment':_0xe245ca['Attachment']};})['value']()};return ejs[_0x47a5('0xdb')](path['join'](config[_0x47a5('0xbb')],_0x47a5('0xbe'),_0x47a5('0xdc'),_0x47a5('0xdd')),{'interaction':_0xdda046})[_0x47a5('0x26')](function(_0x3708ea){return new BPromise(function(_0x583b37,_0x2b4039){pdf[_0x47a5('0xae')](_0x3708ea,_0x2287b0)[_0x47a5('0xde')](path['join'](_0x52798d,_0x47a5('0xdf')+_0x1ba5b6['id']+'-'+_0x322cee+_0x47a5('0xe0')),function(_0x3ecc41,_0x3e4148){if(_0x3ecc41)return _0x2b4039(_0x3ecc41);_0x583b37(_0x3e4148);});});})[_0x47a5('0x26')](function(){return new BPromise(function(_0x23e649,_0x35e20f){zipdir(_0x52798d,{'saveTo':_0x579e5c},function(_0x46615a,_0xd6e255){if(_0x46615a)return _0x35e20f(_0x46615a);return _0x23e649(_0xd6e255);});})[_0x47a5('0x26')](function(){return new BPromise(function(_0x1b91ad,_0x40b7a5){rimraf(_0x52798d,function(_0x28e998){if(_0x28e998)_0x40b7a5(_0x28e998);return _0x1b91ad();});});})[_0x47a5('0x26')](function(){return _0x40aee5[_0x47a5('0xe1')](_0x579e5c,_0x1a5e07,function(_0x3f7fdc){if(_0x3f7fdc){console[_0x47a5('0xe2')](_0x47a5('0xe3'),_0x3f7fdc);}else{fs[_0x47a5('0xe4')](_0x579e5c);}});});});}else{return _0x40aee5[_0x47a5('0x1a')](0xc8);}})[_0x47a5('0x32')](handleError(_0x40aee5,null));}; \ No newline at end of file +var _0x7a54=['attachments','Attachment','direction','secret','WhatsappAccount','Account','Owner','mkdirSync','30px','%s\x20#%d','Whatsapp','YYYY-MM-DD','YYYY-MM-DD\x20HH:mm:ss','closedAt','disposition','Messages','basename','existsSync','createReadStream','pipe','createWriteStream','System','out','renderFile','views','downloadInteraction.html','toFile','transcript-','.pdf','download','log','err','unlinkSync','html-pdf','eml-format','rimraf','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','ejs','squel','crypto','desk.js','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','api','../../config/utils','../../config/environment','../../mysqldb','redis','defaults','socket.io-emitter','./whatsappInteraction.socket','register','sendStatus','end','status','count','offset','limit','set','json','apply','reject','update','destroy','then','error','stack','name','send','Users','map','fullname','TagIds','Tags','split','push','catch','index','rawAttributes','fieldName','type','key','model','query','keys','intersection','attributes','fields','length','hasOwnProperty','order','sort','where','pick','filters','select','color','tools_tags','u.id','field','ui.WhatsappInteractionId','user_has_whatsapp_interactions','left_join','users','u.id\x20=\x20ui.UserId','from','whatsapp_interactions','cm_contacts','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL','o.id\x20=\x20i.UserId','whatsapp_accounts','whatsapp_messages','whatsapp_interaction_has_tags','expr','search','parseSearch','sqlOperator','conditions','find','unreadMessages','having','`\x20=\x200','`\x20>\x200','Contact','operator','$substring','value','getFullTextValue','c.firstName\x20LIKE\x20?\x20OR\x20c.lastName\x20LIKE\x20?\x20OR\x20c.email\x20LIKE\x20?','ContactId','text','Tag','CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','union','UserId','buildExpression','start','body','isEmpty','WhatsappAccountId','i.WhatsappAccountId\x20IN\x20?','concat','createdAt','$gte','parse','i.createdAt\x20BETWEEN\x20?\x20AND\x20?','null','\x20IS\x20NULL','\x20=\x20?','read','`unreadMessages`\x20=\x200','`unreadMessages`\x20>\x200','tag','filter','isNumeric','i.id\x20LIKE\x20?','i.phone\x20LIKE\x20?','MATCH\x20(me.body)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','CONCAT(c.firstName,\x20\x27\x20\x27,\x20c.lastName)\x20LIKE\x20?','group','i.id','Sequelize','QueryTypes','SELECT','clone','SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','forEach','DESC','t.id\x20IN\x20?','resolve','i.WhatsappAccountId\x20IS\x20NOT\x20NULL','user','i.WhatsappAccountId\x20IS\x20NULL','sequelize','toString','keyBy','merge','Account.key','Account.mandatoryDisposition','i.*','c.firstName','c.lastName','Contact.lastName','c.email','Contact.email','Contact.phone','c.mobile','c.fax','Contact.fax','Owner.fullname','o.internal','Owner.internal','ui.WhatsappInteractionId\x20IN\x20?','WhatsappInteractionId','rows','show','params','includeAll','include','WhatsappInteraction','create','addMessage','WhatsappMessage','omit','ids','getMessages','findOne','format','options','findAll','emit','removeTags','unix','root','files','tmp','server','join','transcript-%d-%s.zip','User','firstName','lastName'];(function(_0x2e4e19,_0x493b50){var _0x9ba20b=function(_0x2f6456){while(--_0x2f6456){_0x2e4e19['push'](_0x2e4e19['shift']());}};_0x9ba20b(++_0x493b50);}(_0x7a54,0x106));var _0x47a5=function(_0x17c201,_0x59b1a9){_0x17c201=_0x17c201-0x0;var _0x19631c=_0x7a54[_0x17c201];return _0x19631c;};'use strict';var pdf=require(_0x47a5('0x0'));var emlformat=require(_0x47a5('0x1'));var rimraf=require(_0x47a5('0x2'));var zipdir=require('zip-dir');var jsonpatch=require(_0x47a5('0x3'));var rp=require(_0x47a5('0x4'));var moment=require('moment');var BPromise=require(_0x47a5('0x5'));var Mustache=require(_0x47a5('0x6'));var util=require(_0x47a5('0x7'));var path=require(_0x47a5('0x8'));var sox=require(_0x47a5('0x9'));var csv=require('to-csv');var ejs=require(_0x47a5('0xa'));var fs=require('fs');var _=require('lodash');var squel=require(_0x47a5('0xb'));var crypto=require(_0x47a5('0xc'));var jsforce=require('jsforce');var deskjs=require(_0x47a5('0xd'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x47a5('0xe'));var authService=require(_0x47a5('0xf'));var qs=require('../../components/parsers/qs');var as=require(_0x47a5('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x47a5('0x11'));var utils=require(_0x47a5('0x12'));var config=require(_0x47a5('0x13'));var db=require(_0x47a5('0x14'))['db'];config[_0x47a5('0x15')]=_[_0x47a5('0x16')](config[_0x47a5('0x15')],{'host':'localhost','port':0x18eb});var socket=require(_0x47a5('0x17'))(new Redis(config[_0x47a5('0x15')]));require(_0x47a5('0x18'))[_0x47a5('0x19')](socket);function respondWithStatusCode(_0x139f25,_0x620ee9){_0x620ee9=_0x620ee9||0xcc;return function(_0x3c6c46){if(_0x3c6c46){return _0x139f25[_0x47a5('0x1a')](_0x620ee9);}return _0x139f25['status'](_0x620ee9)[_0x47a5('0x1b')]();};}function respondWithResult(_0x11faf5,_0x3b001e){_0x3b001e=_0x3b001e||0xc8;return function(_0x2a2cbb){if(_0x2a2cbb){return _0x11faf5[_0x47a5('0x1c')](_0x3b001e)['json'](_0x2a2cbb);}};}function respondWithFilteredResult(_0x549de3,_0x138bc0){return function(_0x4b966e){if(_0x4b966e){var _0x5247fd=_0x4b966e[_0x47a5('0x1d')],_0x423a81=_0x138bc0[_0x47a5('0x1e')],_0xaf70a6=_0x138bc0[_0x47a5('0x1e')]+_0x138bc0[_0x47a5('0x1f')],_0x2ce454;if(_0xaf70a6>=_0x5247fd){_0xaf70a6=_0x5247fd;_0x2ce454=0xc8;}else{_0x2ce454=0xce;}_0x549de3[_0x47a5('0x1c')](_0x2ce454);return _0x549de3[_0x47a5('0x20')]('Content-Range',_0x423a81+'-'+_0xaf70a6+'/'+_0x5247fd)[_0x47a5('0x21')](_0x4b966e);}return null;};}function patchUpdates(_0xf160ba){return function(_0x47cf3c){try{jsonpatch[_0x47a5('0x22')](_0x47cf3c,_0xf160ba,!![]);}catch(_0x1f03f7){return BPromise[_0x47a5('0x23')](_0x1f03f7);}return _0x47cf3c['save']();};}function saveUpdates(_0xb8ae6c,_0x2f142b){return function(_0x23db32){if(_0x23db32){return _0x23db32[_0x47a5('0x24')](_0xb8ae6c)['then'](function(_0xe2dea9){return _0xe2dea9;});}return null;};}function removeEntity(_0x385687,_0x513981){return function(_0x28747d){if(_0x28747d){return _0x28747d[_0x47a5('0x25')]()[_0x47a5('0x26')](function(){_0x385687[_0x47a5('0x1c')](0xcc)[_0x47a5('0x1b')]();});}};}function handleEntityNotFound(_0x50bf17,_0x53078a){return function(_0x136745){if(!_0x136745){_0x50bf17['sendStatus'](0x194);}return _0x136745;};}function handleError(_0x1ea9c8,_0x5b6c4e){_0x5b6c4e=_0x5b6c4e||0x1f4;return function(_0x23cb77){logger[_0x47a5('0x27')](_0x23cb77[_0x47a5('0x28')]);if(_0x23cb77[_0x47a5('0x29')]){delete _0x23cb77[_0x47a5('0x29')];}_0x1ea9c8[_0x47a5('0x1c')](_0x5b6c4e)[_0x47a5('0x2a')](_0x23cb77);};}function getInteractionUsers(_0x136b14,_0x16631f){return new BPromise(function(_0x361bfa,_0x1127f8){try{if(_0x16631f[_0x136b14['id']]){_0x136b14[_0x47a5('0x2b')]=_[_0x47a5('0x2c')](_0x16631f[_0x136b14['id']],function(_0x528582){return{'id':_0x528582['id'],'fullname':_0x528582[_0x47a5('0x2d')]};});}}catch(_0x51833b){_0x1127f8(_0x51833b);}_0x361bfa(_0x136b14);});}function getInteractionTags(_0x2ef875,_0x9ac908){return new BPromise(function(_0x16901f,_0x4d6b57){try{if(_0x2ef875[_0x47a5('0x2e')]){_0x2ef875[_0x47a5('0x2f')]=[];_0x2ef875[_0x47a5('0x2e')][_0x47a5('0x30')](',')['forEach'](function(_0x50d875){_0x2ef875[_0x47a5('0x2f')][_0x47a5('0x31')](_0x9ac908[_0x50d875]);});}delete _0x2ef875['TagIds'];}catch(_0x4e1006){_0x4d6b57(_0x4e1006);}_0x16901f(_0x2ef875);});}function updateWhatsappInteraction(_0x836303,_0x51544e,_0x57bff6){return new BPromise(function(_0x42f70c,_0x53119b){return getInteractionUsers(_0x836303,_0x57bff6)[_0x47a5('0x26')](function(_0xd972c){return getInteractionTags(_0xd972c,_0x51544e);})['then'](function(_0x4843c0){_0x42f70c(_0x4843c0);})[_0x47a5('0x32')](function(_0x5910bb){_0x53119b(_0x5910bb);});});}exports[_0x47a5('0x33')]=function(_0x87e4c9,_0xf269a8){var _0x52749b={},_0x18f7e9={},_0x50c086={'count':0x0,'rows':[]};var _0x53c754=_[_0x47a5('0x2c')](db['WhatsappInteraction'][_0x47a5('0x34')],function(_0x5ef577){return{'name':_0x5ef577[_0x47a5('0x35')],'type':_0x5ef577[_0x47a5('0x36')][_0x47a5('0x37')]};});_0x18f7e9[_0x47a5('0x38')]=_[_0x47a5('0x2c')](_0x53c754,_0x47a5('0x29'));_0x18f7e9[_0x47a5('0x39')]=_[_0x47a5('0x3a')](_0x87e4c9[_0x47a5('0x39')]);_0x18f7e9['filters']=_[_0x47a5('0x3b')](_0x18f7e9[_0x47a5('0x38')],_0x18f7e9['query']);_0x52749b[_0x47a5('0x3c')]=_[_0x47a5('0x3b')](_0x18f7e9[_0x47a5('0x38')],qs['fields'](_0x87e4c9[_0x47a5('0x39')][_0x47a5('0x3d')]));_0x52749b['attributes']=_0x52749b[_0x47a5('0x3c')][_0x47a5('0x3e')]?_0x52749b['attributes']:_0x18f7e9['model'];if(!_0x87e4c9['query'][_0x47a5('0x3f')]('nolimit')){_0x52749b[_0x47a5('0x1f')]=qs[_0x47a5('0x1f')](_0x87e4c9[_0x47a5('0x39')][_0x47a5('0x1f')]);_0x52749b[_0x47a5('0x1e')]=qs[_0x47a5('0x1e')](_0x87e4c9[_0x47a5('0x39')][_0x47a5('0x1e')]);}_0x52749b[_0x47a5('0x40')]=qs[_0x47a5('0x41')](_0x87e4c9[_0x47a5('0x39')][_0x47a5('0x41')]);_0x52749b[_0x47a5('0x42')]=qs['filters'](_[_0x47a5('0x43')](_0x87e4c9[_0x47a5('0x39')],_0x18f7e9[_0x47a5('0x44')]),_0x53c754);var _0x23bd8d=[];var _0x586f4f=squel[_0x47a5('0x45')]()['field']('id')['field']('name')['field'](_0x47a5('0x46'))['from'](_0x47a5('0x47'));var _0x3a740b=squel[_0x47a5('0x45')]()['field'](_0x47a5('0x48'))[_0x47a5('0x49')]('u.fullname')['field'](_0x47a5('0x4a'))['from'](_0x47a5('0x4b'),'ui')[_0x47a5('0x4c')](_0x47a5('0x4d'),'u',_0x47a5('0x4e'));var _0x34a9ae=squel[_0x47a5('0x45')]()[_0x47a5('0x4f')](_0x47a5('0x50'),'i')[_0x47a5('0x4c')](_0x47a5('0x51'),'c',_0x47a5('0x52'))[_0x47a5('0x4c')](_0x47a5('0x4d'),'o',_0x47a5('0x53'))[_0x47a5('0x4c')](_0x47a5('0x54'),'a','a.id\x20=\x20i.WhatsappAccountId')[_0x47a5('0x4c')](_0x47a5('0x55'),'me','me.WhatsappInteractionId\x20=\x20i.id')['left_join'](_0x47a5('0x56'),'it','it.WhatsappInteractionId\x20=\x20i.id')[_0x47a5('0x4c')](_0x47a5('0x47'),'t','t.id\x20=\x20it.TagId');var _0x4f62d3=squel[_0x47a5('0x57')]();var _0x52d409=[];var _0x2d147c=squel[_0x47a5('0x57')]();var _0x3548bc;if(_0x87e4c9[_0x47a5('0x39')][_0x47a5('0x58')]){_0x3548bc=as[_0x47a5('0x59')](_0x87e4c9[_0x47a5('0x39')]['search']);var _0x48a0ef=_0x3548bc[_0x47a5('0x5a')];for(var _0x411230=0x0;_0x411230<_0x3548bc[_0x47a5('0x5b')][_0x47a5('0x3e')];_0x411230++){var _0x2c7020=_0x3548bc[_0x47a5('0x5b')][_0x411230];var _0x249de5='i';var _0x492cf7=_[_0x47a5('0x5c')](_0x53c754,[_0x47a5('0x29'),_0x2c7020[_0x47a5('0x49')]]);if(!_0x492cf7){switch(_0x2c7020['field']){case _0x47a5('0x5d'):if(_0x2c7020['value']==0x1){_0x34a9ae[_0x47a5('0x5e')]('`'+_0x2c7020[_0x47a5('0x49')]+_0x47a5('0x5f'));}else{_0x34a9ae[_0x47a5('0x5e')]('`'+_0x2c7020['field']+_0x47a5('0x60'));}break;case _0x47a5('0x61'):if(_0x2c7020[_0x47a5('0x62')]===_0x47a5('0x63')){if(_0x2c7020[_0x47a5('0x64')][_0x47a5('0x30')]('\x20')[_0x47a5('0x3e')]>0x1){_0x4f62d3[_0x48a0ef]('MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)',qs[_0x47a5('0x65')](_0x2c7020[_0x47a5('0x64')]),null);}else{var _0x187d7e='%'+_0x2c7020[_0x47a5('0x64')]+'%';_0x4f62d3[_0x48a0ef](_0x47a5('0x66'),_0x187d7e,_0x187d7e,_0x187d7e);}}else{_0x492cf7=_[_0x47a5('0x5c')](_0x53c754,['name',_0x47a5('0x67')]);_0x2c7020[_0x47a5('0x49')]=_0x47a5('0x67');_0x5cbe97=as['buildExpression'](_0x249de5,_0x492cf7[_0x47a5('0x36')],_0x2c7020);_0x4f62d3[_0x48a0ef](_0x5cbe97[_0x47a5('0x68')],_0x5cbe97[_0x47a5('0x64')]['start'],_0x5cbe97['value'][_0x47a5('0x1b')]);}break;case _0x47a5('0x69'):var _0x4fa1da=_0x2c7020['value'][_0x47a5('0x30')](',')['map'](function(_0x16bb8a){return Number(_0x16bb8a);});_0x4fa1da['forEach'](function(_0x482de6){_0x2d147c['or'](_0x47a5('0x6a'),'%,'+_0x482de6+',%');});_0x52d409=_[_0x47a5('0x6b')](_0x52d409,_0x4fa1da);break;case'User':if(_0x2c7020[_0x47a5('0x62')]===_0x47a5('0x63')){_0x4f62d3[_0x48a0ef]('CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?','%'+_0x2c7020['value']+'%',null);}else{_0x492cf7=_[_0x47a5('0x5c')](_0x53c754,[_0x47a5('0x29'),_0x47a5('0x6c')]);_0x2c7020[_0x47a5('0x49')]='UserId';_0x5cbe97=as[_0x47a5('0x6d')](_0x249de5,_0x492cf7[_0x47a5('0x36')],_0x2c7020);_0x4f62d3[_0x48a0ef](_0x5cbe97[_0x47a5('0x68')],_0x5cbe97['value'][_0x47a5('0x6e')],_0x5cbe97['value'][_0x47a5('0x1b')]);}break;case _0x47a5('0x6f'):_0x5cbe97=as[_0x47a5('0x6d')]('me',null,_0x2c7020);_0x4f62d3[_0x48a0ef](_0x5cbe97[_0x47a5('0x68')],_0x5cbe97[_0x47a5('0x64')]['start'],_0x5cbe97[_0x47a5('0x64')]['end']);break;}}else{var _0x5cbe97=as['buildExpression'](_0x249de5,_0x492cf7['type'],_0x2c7020);_0x4f62d3[_0x48a0ef](_0x5cbe97[_0x47a5('0x68')],_0x5cbe97[_0x47a5('0x64')][_0x47a5('0x6e')],_0x5cbe97['value']['end']);}}}else{var _0x139229=_(_0x87e4c9[_0x47a5('0x39')])[_0x47a5('0x3a')]()[_0x47a5('0x2c')](function(_0xc45e25){return _['some'](_0x53c754,[_0x47a5('0x29'),_0xc45e25])?_0xc45e25:undefined;})['compact']()[_0x47a5('0x64')]();if(!_[_0x47a5('0x70')](_0x139229)){_0x139229['forEach'](function(_0x32b4de){if(_0x32b4de===_0x47a5('0x71')){_0x34a9ae[_0x47a5('0x42')](_0x47a5('0x72'),[][_0x47a5('0x73')](_0x87e4c9[_0x47a5('0x39')][_0x32b4de]));}else if(_0x32b4de===_0x47a5('0x74')){var _0x3ac38c=JSON['parse'](_0x87e4c9[_0x47a5('0x39')][_0x32b4de])[_0x47a5('0x75')];var _0x3c75c6=JSON[_0x47a5('0x76')](_0x87e4c9[_0x47a5('0x39')][_0x32b4de])['$lte'];_0x34a9ae[_0x47a5('0x42')](_0x47a5('0x77'),_0x3ac38c,_0x3c75c6);}else{if(_0x87e4c9[_0x47a5('0x39')][_0x32b4de]===_0x47a5('0x78')){_0x34a9ae[_0x47a5('0x42')]('i.'+_0x32b4de+_0x47a5('0x79'));}else{_0x34a9ae[_0x47a5('0x42')]('i.'+_0x32b4de+_0x47a5('0x7a'),_0x87e4c9[_0x47a5('0x39')][_0x32b4de]);}}});}if(_0x87e4c9[_0x47a5('0x39')][_0x47a5('0x7b')]){if(_0x87e4c9[_0x47a5('0x39')][_0x47a5('0x7b')]==0x1){_0x34a9ae[_0x47a5('0x5e')](_0x47a5('0x7c'));}else{_0x34a9ae['having'](_0x47a5('0x7d'));}}if(_0x87e4c9[_0x47a5('0x39')][_0x47a5('0x7e')]){_0x52d409=_['isArray'](_0x87e4c9[_0x47a5('0x39')][_0x47a5('0x7e')])?_0x87e4c9[_0x47a5('0x39')][_0x47a5('0x7e')]:new Array(_0x87e4c9['query'][_0x47a5('0x7e')]);_0x52d409['forEach'](function(_0x2d5ee6){_0x2d147c['or']('CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','%,'+_0x2d5ee6+',%');});}if(_0x87e4c9[_0x47a5('0x39')]['filter']){var _0x7c1190=_0x87e4c9[_0x47a5('0x39')][_0x47a5('0x7f')]['replace']('\x5c','\x5c\x5c')['replace']('\x27\x27','\x27\x27\x27\x27');if(qs[_0x47a5('0x80')](_0x7c1190)){_0x4f62d3['or'](_0x47a5('0x81'),_0x7c1190+'%')['or'](_0x47a5('0x82'),_0x7c1190+'%');}else{_0x4f62d3['or'](_0x47a5('0x83'),qs['getFullTextValue'](_0x7c1190))['or'](_0x47a5('0x84'),_0x7c1190+'%');}}}_0x34a9ae[_0x47a5('0x42')](_0x4f62d3);_0x34a9ae[_0x47a5('0x85')](_0x47a5('0x86'));var _0x308c9a={'type':db[_0x47a5('0x87')][_0x47a5('0x88')][_0x47a5('0x89')],'raw':!![]};var _0x4618a0=_0x34a9ae[_0x47a5('0x8a')]();_0x4618a0[_0x47a5('0x49')](_0x47a5('0x86'));_0x4618a0['field'](_0x47a5('0x8b'),'unreadMessages');if(_0x52749b[_0x47a5('0x40')]){_0x52749b[_0x47a5('0x40')][_0x47a5('0x8c')](function(_0x12fec9){_0x34a9ae[_0x47a5('0x40')]('i.'+_0x12fec9[0x0],_0x12fec9[0x1]===_0x47a5('0x8d')?![]:!![]);});}if(!_[_0x47a5('0x70')](_0x52d409)){_0x34a9ae[_0x47a5('0x5e')](_0x2d147c);_0x4618a0[_0x47a5('0x42')](_0x47a5('0x8e'),_0x52d409);}BPromise[_0x47a5('0x8f')]()[_0x47a5('0x26')](function(){if(!_0x3548bc){if(_0x87e4c9[_0x47a5('0x39')][_0x47a5('0x71')]||_0x87e4c9[_0x47a5('0x39')]['journey'])return;_0x4618a0['where']('i.WhatsappAccountId\x20IS\x20NOT\x20NULL');_0x34a9ae['where'](_0x47a5('0x90'));return;}return _0x87e4c9[_0x47a5('0x91')]['getWhatsappAccounts']({'attributes':['id'],'raw':!![]})[_0x47a5('0x26')](function(_0x44dda2){if(_[_0x47a5('0x70')](_0x44dda2)){_0x4618a0[_0x47a5('0x42')](_0x47a5('0x92'));_0x34a9ae[_0x47a5('0x42')](_0x47a5('0x92'));}else{_0x4618a0[_0x47a5('0x42')](_0x47a5('0x72'),_[_0x47a5('0x2c')](_0x44dda2,'id'));_0x34a9ae[_0x47a5('0x42')]('i.WhatsappAccountId\x20IN\x20?',_[_0x47a5('0x2c')](_0x44dda2,'id'));}});})[_0x47a5('0x26')](function(){db[_0x47a5('0x93')]['query'](_0x4618a0[_0x47a5('0x94')](),_0x308c9a)[_0x47a5('0x26')](function(_0x17b61d){_0x50c086['count']=_0x17b61d[_0x47a5('0x3e')];if(_0x50c086['count']===0x0)return[];return db['sequelize'][_0x47a5('0x39')](_0x586f4f[_0x47a5('0x94')](),_0x308c9a)[_0x47a5('0x26')](function(_0x27333e){_0x23bd8d=_[_0x47a5('0x95')](_0x27333e,'id');_0x308c9a=_[_0x47a5('0x96')](_0x308c9a,{'model':db['WhatsappInteraction'],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x87e4c9['query'][_0x47a5('0x3d')]){_0x52749b['attributes'][_0x47a5('0x8c')](function(_0x3fffd1){_0x34a9ae[_0x47a5('0x49')]('i.'+_0x3fffd1);});}else{_0x34a9ae[_0x47a5('0x49')]('SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)',_0x47a5('0x5d'));_0x34a9ae['field']('a.key',_0x47a5('0x97'));_0x34a9ae[_0x47a5('0x49')]('a.mandatoryDisposition',_0x47a5('0x98'));_0x34a9ae[_0x47a5('0x49')](_0x47a5('0x99'));_0x34a9ae['field'](_0x47a5('0x9a'),'Contact.firstName');_0x34a9ae[_0x47a5('0x49')](_0x47a5('0x9b'),_0x47a5('0x9c'));_0x34a9ae['field'](_0x47a5('0x9d'),_0x47a5('0x9e'));_0x34a9ae[_0x47a5('0x49')]('c.phone',_0x47a5('0x9f'));_0x34a9ae['field'](_0x47a5('0xa0'),'Contact.mobile');_0x34a9ae[_0x47a5('0x49')](_0x47a5('0xa1'),_0x47a5('0xa2'));_0x34a9ae[_0x47a5('0x49')]('o.fullname',_0x47a5('0xa3'));_0x34a9ae[_0x47a5('0x49')](_0x47a5('0xa4'),_0x47a5('0xa5'));_0x34a9ae[_0x47a5('0x49')]('GROUP_CONCAT(DISTINCT\x20t.id)','TagIds');}if(_0x52749b[_0x47a5('0x1f')])_0x34a9ae['limit'](_0x52749b[_0x47a5('0x1f')]);if(_0x52749b[_0x47a5('0x1e')])_0x34a9ae[_0x47a5('0x1e')](_0x52749b['offset']);return db[_0x47a5('0x93')][_0x47a5('0x39')](_0x34a9ae['toString'](),_0x308c9a);})[_0x47a5('0x26')](function(_0x8a9dea){_0x3a740b[_0x47a5('0x42')](_0x47a5('0xa6'),_['map'](_0x8a9dea,'id'));return db['sequelize'][_0x47a5('0x39')](_0x3a740b[_0x47a5('0x94')](),_0x308c9a)['then'](function(_0x27d422){var _0x23f055=_['groupBy'](_0x27d422,_0x47a5('0xa7'));var _0x2a02cd=[];_0x8a9dea[_0x47a5('0x8c')](function(_0x59f010){_0x2a02cd[_0x47a5('0x31')](updateWhatsappInteraction(_0x59f010,_0x23bd8d,_0x23f055));});return BPromise['all'](_0x2a02cd);});});})[_0x47a5('0x26')](function(_0x5e2946){_0x50c086[_0x47a5('0xa8')]=_0x5e2946;return _0x50c086;})[_0x47a5('0x26')](respondWithFilteredResult(_0xf269a8,_0x52749b));})['catch'](handleError(_0xf269a8,null));};exports[_0x47a5('0xa9')]=function(_0x597cb2,_0x1eabef){var _0x36f619={'raw':![],'where':{'id':_0x597cb2[_0x47a5('0xaa')]['id']}},_0x37e045={};_0x37e045['model']=_[_0x47a5('0x3a')](db['WhatsappInteraction']['rawAttributes']);_0x37e045[_0x47a5('0x39')]=_[_0x47a5('0x3a')](_0x597cb2[_0x47a5('0x39')]);_0x37e045[_0x47a5('0x44')]=_[_0x47a5('0x3b')](_0x37e045['model'],_0x37e045[_0x47a5('0x39')]);_0x36f619[_0x47a5('0x3c')]=_[_0x47a5('0x3b')](_0x37e045[_0x47a5('0x38')],qs['fields'](_0x597cb2[_0x47a5('0x39')]['fields']));_0x36f619[_0x47a5('0x3c')]=_0x36f619[_0x47a5('0x3c')][_0x47a5('0x3e')]?_0x36f619[_0x47a5('0x3c')]:_0x37e045[_0x47a5('0x38')];if(_0x597cb2[_0x47a5('0x39')][_0x47a5('0xab')]){_0x36f619[_0x47a5('0xac')]=[{'all':!![]}];}_0x36f619=_[_0x47a5('0x96')]({},_0x36f619,_0x597cb2['options']);return db[_0x47a5('0xad')][_0x47a5('0x5c')](_0x36f619)['then'](handleEntityNotFound(_0x1eabef,null))[_0x47a5('0x26')](respondWithResult(_0x1eabef,null))[_0x47a5('0x32')](handleError(_0x1eabef,null));};exports[_0x47a5('0xae')]=function(_0x5b85cd,_0x4bf1f5){return db[_0x47a5('0xad')][_0x47a5('0xae')](_0x5b85cd['body'],{})['then'](respondWithResult(_0x4bf1f5,0xc9))[_0x47a5('0x32')](handleError(_0x4bf1f5,null));};exports[_0x47a5('0x24')]=function(_0x54eab1,_0x29e384){if(_0x54eab1[_0x47a5('0x6f')]['id']){delete _0x54eab1['body']['id'];}return db[_0x47a5('0xad')][_0x47a5('0x5c')]({'where':{'id':_0x54eab1[_0x47a5('0xaa')]['id']}})[_0x47a5('0x26')](handleEntityNotFound(_0x29e384,null))[_0x47a5('0x26')](saveUpdates(_0x54eab1[_0x47a5('0x6f')],null))['then'](respondWithResult(_0x29e384,null))['catch'](handleError(_0x29e384,null));};exports['destroy']=function(_0x133b7a,_0xce5ada){return db['WhatsappInteraction'][_0x47a5('0x5c')]({'where':{'id':_0x133b7a[_0x47a5('0xaa')]['id']}})[_0x47a5('0x26')](handleEntityNotFound(_0xce5ada,null))[_0x47a5('0x26')](removeEntity(_0xce5ada,null))[_0x47a5('0x32')](handleError(_0xce5ada,null));};exports['describe']=function(_0x3e7750,_0x548a06){return db['WhatsappInteraction']['describe']()[_0x47a5('0x26')](respondWithResult(_0x548a06,null))['catch'](handleError(_0x548a06,null));};exports[_0x47a5('0xaf')]=function(_0xf3edc8,_0x5a316e,_0x49f791){return db[_0x47a5('0xb0')][_0x47a5('0x5c')]({'where':{'id':_0xf3edc8[_0x47a5('0xaa')]['id']}})[_0x47a5('0x26')](handleEntityNotFound(_0x5a316e,null))[_0x47a5('0x26')](function(_0x581a87){if(_0x581a87){return _0x581a87[_0x47a5('0xaf')](_0xf3edc8[_0x47a5('0x6f')]['ids'],_[_0x47a5('0xb1')](_0xf3edc8[_0x47a5('0x6f')],[_0x47a5('0xb2'),'id'])||{});}})[_0x47a5('0x26')](respondWithResult(_0x5a316e,null))[_0x47a5('0x32')](handleError(_0x5a316e,null));};exports[_0x47a5('0xb3')]=function(_0x5112d7,_0x6a8174,_0x2e418d){var _0x50b236={'raw':![],'where':{}};var _0x263521={};var _0x9769b5={'count':0x0,'rows':[]};return db[_0x47a5('0xad')][_0x47a5('0xb4')]({'where':{'id':_0x5112d7['params']['id']}})['then'](handleEntityNotFound(_0x6a8174,null))['then'](function(_0x4eee99){if(_0x4eee99){_0x263521[_0x47a5('0x38')]=_[_0x47a5('0x3a')](db[_0x47a5('0xb0')][_0x47a5('0x34')]);_0x263521[_0x47a5('0x39')]=_[_0x47a5('0x3a')](_0x5112d7[_0x47a5('0x39')]);_0x263521[_0x47a5('0x44')]=_['intersection'](_0x263521[_0x47a5('0x38')],_0x263521[_0x47a5('0x39')]);_0x50b236[_0x47a5('0x3c')]=_[_0x47a5('0x3b')](_0x263521['model'],qs['fields'](_0x5112d7[_0x47a5('0x39')]['fields']));_0x50b236['attributes']=_0x50b236[_0x47a5('0x3c')][_0x47a5('0x3e')]?_0x50b236['attributes']:_0x263521[_0x47a5('0x38')];if(!_0x5112d7[_0x47a5('0x39')][_0x47a5('0x3f')]('nolimit')){_0x50b236[_0x47a5('0x1f')]=qs[_0x47a5('0x1f')](_0x5112d7['query'][_0x47a5('0x1f')]);_0x50b236[_0x47a5('0x1e')]=qs[_0x47a5('0x1e')](_0x5112d7[_0x47a5('0x39')][_0x47a5('0x1e')]);}_0x50b236[_0x47a5('0x40')]=qs['sort'](_0x5112d7[_0x47a5('0x39')]['sort']);_0x50b236[_0x47a5('0x42')]=qs[_0x47a5('0x44')](_[_0x47a5('0x43')](_0x5112d7[_0x47a5('0x39')],_0x263521['filters']));_0x50b236[_0x47a5('0x42')][_0x47a5('0xa7')]=_0x4eee99['id'];if(_0x5112d7[_0x47a5('0x39')][_0x47a5('0x7f')]){_0x50b236[_0x47a5('0x42')]=_[_0x47a5('0x96')](_0x50b236[_0x47a5('0x42')],{'$or':_[_0x47a5('0x2c')](_0x50b236[_0x47a5('0x3c')],function(_0xa2045c){var _0x109738={};_0x109738[_0xa2045c]={'$like':'%'+_0x5112d7[_0x47a5('0x39')]['filter']+'%'};return _0x109738;})});}if(_0x5112d7[_0x47a5('0x39')][_0x47a5('0x75')]){var _0x591bde=_0x5112d7[_0x47a5('0x39')][_0x47a5('0x75')][_0x47a5('0x30')](',');var _0x2ccf21={};_0x2ccf21[_0x591bde[0x0]]={'$gte':moment(_0x591bde[0x1])[_0x47a5('0xb5')]('YYYY-MM-DD\x20HH:mm:ss')};_0x50b236[_0x47a5('0x42')]=_[_0x47a5('0x96')](_0x50b236[_0x47a5('0x42')],_0x2ccf21);}_0x50b236=_[_0x47a5('0x96')]({},_0x50b236,_0x5112d7[_0x47a5('0xb6')]);return db[_0x47a5('0xb0')][_0x47a5('0x1d')]({'where':_0x50b236['where']})['then'](function(_0xa3d578){_0x9769b5['count']=_0xa3d578;if(_0x5112d7[_0x47a5('0x39')]['includeAll']){_0x50b236[_0x47a5('0xac')]=[{'all':!![]}];}return db[_0x47a5('0xb0')][_0x47a5('0xb7')](_0x50b236);})[_0x47a5('0x26')](function(_0x49cb8c){_0x9769b5[_0x47a5('0xa8')]=_0x49cb8c;return _0x9769b5;});}})[_0x47a5('0x26')](respondWithFilteredResult(_0x6a8174,_0x50b236))[_0x47a5('0x32')](handleError(_0x6a8174,null));};exports['addTags']=function(_0x581759,_0x30375f,_0x29015a){return db[_0x47a5('0xad')][_0x47a5('0x5c')]({'where':{'id':_0x581759[_0x47a5('0xaa')]['id']}})[_0x47a5('0x26')](handleEntityNotFound(_0x30375f,null))[_0x47a5('0x26')](function(_0xe662d7){if(_0xe662d7){return _0xe662d7['setTags'](_0x581759[_0x47a5('0x6f')]['ids'],_[_0x47a5('0xb1')](_0x581759[_0x47a5('0x6f')],['ids','id'])||{})['spread'](function(){return db[_0x47a5('0x69')][_0x47a5('0xb7')]({'attributes':['id','name',_0x47a5('0x46')],'where':{'id':_0x581759[_0x47a5('0x6f')][_0x47a5('0xb2')]}});})[_0x47a5('0x26')](function(_0x5a7f32){socket[_0x47a5('0xb8')]('whatsappInteractionTags:save',{'id':Number(_0x581759['params']['id']),'tags':_0x5a7f32||[]});return{'id':Number(_0x581759['params']['id']),'tags':_0x5a7f32||[]};});}})[_0x47a5('0x26')](respondWithResult(_0x30375f,null))['catch'](handleError(_0x30375f,null));};exports[_0x47a5('0xb9')]=function(_0x156d51,_0x401139,_0x2005d5){return db[_0x47a5('0xad')][_0x47a5('0x5c')]({'where':{'id':_0x156d51[_0x47a5('0xaa')]['id']}})[_0x47a5('0x26')](handleEntityNotFound(_0x401139,null))[_0x47a5('0x26')](function(_0x2200f9){if(_0x2200f9){return _0x2200f9[_0x47a5('0xb9')](_0x156d51[_0x47a5('0x39')][_0x47a5('0xb2')]);}})[_0x47a5('0x26')](respondWithStatusCode(_0x401139,null))[_0x47a5('0x32')](handleError(_0x401139,null));};exports['download']=function(_0xdd95c8,_0x40aee5){var _0x322cee=moment()[_0x47a5('0xba')]()['toString']();var _0x367662=path['join'](config[_0x47a5('0xbb')],'server',_0x47a5('0xbc'),_0x47a5('0xbd'));var _0x3b894d=path['join'](config[_0x47a5('0xbb')],_0x47a5('0xbe'),_0x47a5('0xbc'),'attachments');var _0x52798d=path[_0x47a5('0xbf')](_0x367662,_0x322cee);var _0x1a5e07=util[_0x47a5('0xb5')](_0x47a5('0xc0'),_0xdd95c8[_0x47a5('0xaa')]['id'],_0x322cee);var _0x579e5c=path[_0x47a5('0xbf')](_0x367662,_0x1a5e07);var _0x4b3ae4=[];_0x4b3ae4[_0x47a5('0x31')]({'model':db[_0x47a5('0xc1')],'as':_0x47a5('0xc1'),'attributes':['id',_0x47a5('0x2d')],'raw':!![]});_0x4b3ae4['push']({'model':db['CmContact'],'as':_0x47a5('0x61'),'attributes':['id',_0x47a5('0xc2'),_0x47a5('0xc3')],'raw':!![]});if(_0xdd95c8[_0x47a5('0x39')][_0x47a5('0xc4')]){_0x4b3ae4[_0x47a5('0x31')]({'model':db[_0x47a5('0xc5')],'as':_0x47a5('0xc5'),'raw':!![]});}var _0x2c2245=[{'model':db['WhatsappMessage'],'as':'Messages','attributes':['id',_0x47a5('0x6f'),'createdAt',_0x47a5('0xc6'),_0x47a5('0xc7'),_0x47a5('0x7b')],'include':_0x4b3ae4}];_0x2c2245['push']({'model':db[_0x47a5('0xc8')],'as':_0x47a5('0xc9'),'attributes':['id','name']});_0x2c2245[_0x47a5('0x31')]({'model':db['User'],'as':_0x47a5('0xca'),'attributes':['id',_0x47a5('0x2d')]});return db[_0x47a5('0xad')]['find']({'where':{'id':_0xdd95c8['params']['id']},'include':_0x2c2245})['then'](handleEntityNotFound(_0x40aee5,null))['then'](function(_0x5075a6){if(_0x5075a6){var _0x1ba5b6=_0x5075a6['get']({'plain':!![]});fs[_0x47a5('0xcb')](_0x52798d);var _0x2287b0={'format':'A4','border':'10px','header':{'height':'40px','contents':{'first':'\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20
Interaction\x20Transcript
\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20'}},'footer':{'height':_0x47a5('0xcc'),'contents':{'default':util['format']('\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20%s\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20{{page}}/{{pages}}\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20%s\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',util['format'](_0x47a5('0xcd'),_0x47a5('0xce'),_0x1ba5b6['id']),moment()[_0x47a5('0xb5')](_0x47a5('0xcf'))['toString']())}}};var _0xdda046={'channel':'Whatsapp','account':_0x1ba5b6[_0x47a5('0xc9')]['name'],'agent':_0x1ba5b6[_0x47a5('0xca')]?_0x1ba5b6[_0x47a5('0xca')][_0x47a5('0x2d')]:'N.A.','createdAt':moment(_0x1ba5b6[_0x47a5('0x74')])[_0x47a5('0xb5')](_0x47a5('0xd0'))[_0x47a5('0x94')](),'closedAt':_0x1ba5b6['closed']?moment(_0x1ba5b6[_0x47a5('0xd1')])[_0x47a5('0xb5')](_0x47a5('0xd0'))[_0x47a5('0x94')]():'','disposition':_0x1ba5b6[_0x47a5('0xd2')],'messages':_(_0x1ba5b6[_0x47a5('0xd3')])['filter']({'secret':![]})[_0x47a5('0x2c')](function(_0xe245ca){if(_0xe245ca[_0x47a5('0xc5')]){var _0xac8d4f=path[_0x47a5('0xbf')](_0x3b894d,_0xe245ca[_0x47a5('0xc5')][_0x47a5('0xd4')]);if(fs[_0x47a5('0xd5')](_0xac8d4f)){fs[_0x47a5('0xd6')](_0xac8d4f)[_0x47a5('0xd7')](fs[_0x47a5('0xd8')](path[_0x47a5('0xbf')](_0x52798d,_0xe245ca[_0x47a5('0xc5')][_0x47a5('0xd4')])));}}return{'date':moment(_0xe245ca[_0x47a5('0x74')])[_0x47a5('0xb5')](_0x47a5('0xd0'))['toString'](),'sender':_0xe245ca[_0x47a5('0xc6')]==='out'?_0xe245ca['User']?_0xe245ca[_0x47a5('0xc1')][_0x47a5('0x2d')]:_0x47a5('0xd9'):_0xe245ca['Contact'][_0x47a5('0xc2')]+(_0xe245ca[_0x47a5('0x61')][_0x47a5('0xc3')]?'\x20'+_0xe245ca[_0x47a5('0x61')][_0x47a5('0xc3')]:''),'body':_0xe245ca[_0x47a5('0xc5')]?_0xe245ca[_0x47a5('0xc5')][_0x47a5('0xd4')]:_0xe245ca[_0x47a5('0x6f')],'direction':_0xe245ca[_0x47a5('0xc6')]===_0x47a5('0xda')?'A':'C','secret':_0xe245ca[_0x47a5('0xc7')],'read':_0xe245ca[_0x47a5('0x7b')],'attachment':_0xe245ca['Attachment']};})['value']()};return ejs[_0x47a5('0xdb')](path['join'](config[_0x47a5('0xbb')],_0x47a5('0xbe'),_0x47a5('0xdc'),_0x47a5('0xdd')),{'interaction':_0xdda046})[_0x47a5('0x26')](function(_0x3708ea){return new BPromise(function(_0x583b37,_0x2b4039){pdf[_0x47a5('0xae')](_0x3708ea,_0x2287b0)[_0x47a5('0xde')](path['join'](_0x52798d,_0x47a5('0xdf')+_0x1ba5b6['id']+'-'+_0x322cee+_0x47a5('0xe0')),function(_0x3ecc41,_0x3e4148){if(_0x3ecc41)return _0x2b4039(_0x3ecc41);_0x583b37(_0x3e4148);});});})[_0x47a5('0x26')](function(){return new BPromise(function(_0x23e649,_0x35e20f){zipdir(_0x52798d,{'saveTo':_0x579e5c},function(_0x46615a,_0xd6e255){if(_0x46615a)return _0x35e20f(_0x46615a);return _0x23e649(_0xd6e255);});})[_0x47a5('0x26')](function(){return new BPromise(function(_0x1b91ad,_0x40b7a5){rimraf(_0x52798d,function(_0x28e998){if(_0x28e998)_0x40b7a5(_0x28e998);return _0x1b91ad();});});})[_0x47a5('0x26')](function(){return _0x40aee5[_0x47a5('0xe1')](_0x579e5c,_0x1a5e07,function(_0x3f7fdc){if(_0x3f7fdc){console[_0x47a5('0xe2')](_0x47a5('0xe3'),_0x3f7fdc);}else{fs[_0x47a5('0xe4')](_0x579e5c);}});});});}else{return _0x40aee5[_0x47a5('0x1a')](0xc8);}})[_0x47a5('0x32')](handleError(_0x40aee5,null));}; \ No newline at end of file diff --git a/server/api/whatsappInteraction/whatsappInteraction.events.js b/server/api/whatsappInteraction/whatsappInteraction.events.js index 5d412e2..cd24dab 100644 --- a/server/api/whatsappInteraction/whatsappInteraction.events.js +++ b/server/api/whatsappInteraction/whatsappInteraction.events.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x4638=['catch','hasOwnProperty','hook','exports','events','../../mysqldb','WhatsappInteraction','WhatsappMessage','update','remove','then','setDataValue','Users','findAll','unreadMessages','emit'];(function(_0x36c5b0,_0x5001da){var _0xf19333=function(_0x1e880a){while(--_0x1e880a){_0x36c5b0['push'](_0x36c5b0['shift']());}};_0xf19333(++_0x5001da);}(_0x4638,0x84));var _0x8463=function(_0x552947,_0x22bbaa){_0x552947=_0x552947-0x0;var _0x3027b9=_0x4638[_0x552947];return _0x3027b9;};'use strict';var EventEmitter=require(_0x8463('0x0'));var WhatsappInteraction=require(_0x8463('0x1'))['db'][_0x8463('0x2')];var WhatsappMessage=require(_0x8463('0x1'))['db'][_0x8463('0x3')];var WhatsappInteractionEvents=new EventEmitter();WhatsappInteractionEvents['setMaxListeners'](0x0);var events={'afterCreate':'save','afterUpdate':_0x8463('0x4'),'afterDestroy':_0x8463('0x5')};function emitEvent(_0x46f7dc){return function(_0x42ffdd,_0x1f6a88,_0x409029){_0x42ffdd['getUsers']({'attributes':['id'],'raw':!![]})[_0x8463('0x6')](function(_0xad5e4d){_0x42ffdd[_0x8463('0x7')](_0x8463('0x8'),_0xad5e4d['map'](function(_0x5583a0){return{'id':_0x5583a0['id']};}));return WhatsappMessage[_0x8463('0x9')]({'where':{'WhatsappInteractionId':_0x42ffdd['id'],'direction':'in','read':![]},'raw':!![]});})[_0x8463('0x6')](function(_0x2672dd){_0x42ffdd[_0x8463('0x7')](_0x8463('0xa'),_0x2672dd['length']);WhatsappInteractionEvents[_0x8463('0xb')](_0x46f7dc+':'+_0x42ffdd['id'],_0x42ffdd);WhatsappInteractionEvents[_0x8463('0xb')](_0x46f7dc,_0x42ffdd);_0x409029(null);})[_0x8463('0xc')](_0x409029(null));};}for(var e in events){if(events[_0x8463('0xd')](e)){var event=events[e];WhatsappInteraction[_0x8463('0xe')](e,emitEvent(event));}}module[_0x8463('0xf')]=WhatsappInteractionEvents; \ No newline at end of file +var _0x6bda=['events','../../mysqldb','WhatsappMessage','setMaxListeners','update','getUsers','then','setDataValue','Users','map','findAll','length','emit','hasOwnProperty','hook','exports'];(function(_0x3ba671,_0x40d517){var _0x1a610d=function(_0x2862d3){while(--_0x2862d3){_0x3ba671['push'](_0x3ba671['shift']());}};_0x1a610d(++_0x40d517);}(_0x6bda,0xf0));var _0xa6bd=function(_0x5f1f5b,_0x17d1a2){_0x5f1f5b=_0x5f1f5b-0x0;var _0x21f2e3=_0x6bda[_0x5f1f5b];return _0x21f2e3;};'use strict';var EventEmitter=require(_0xa6bd('0x0'));var WhatsappInteraction=require(_0xa6bd('0x1'))['db']['WhatsappInteraction'];var WhatsappMessage=require(_0xa6bd('0x1'))['db'][_0xa6bd('0x2')];var WhatsappInteractionEvents=new EventEmitter();WhatsappInteractionEvents[_0xa6bd('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':_0xa6bd('0x4'),'afterDestroy':'remove'};function emitEvent(_0x1598fb){return function(_0xb5e354,_0x20a7ab,_0x1d9c9d){_0xb5e354[_0xa6bd('0x5')]({'attributes':['id'],'raw':!![]})[_0xa6bd('0x6')](function(_0x25daa0){_0xb5e354[_0xa6bd('0x7')](_0xa6bd('0x8'),_0x25daa0[_0xa6bd('0x9')](function(_0x318d30){return{'id':_0x318d30['id']};}));return WhatsappMessage[_0xa6bd('0xa')]({'where':{'WhatsappInteractionId':_0xb5e354['id'],'direction':'in','read':![]},'raw':!![]});})[_0xa6bd('0x6')](function(_0x465a0a){_0xb5e354[_0xa6bd('0x7')]('unreadMessages',_0x465a0a[_0xa6bd('0xb')]);WhatsappInteractionEvents[_0xa6bd('0xc')](_0x1598fb+':'+_0xb5e354['id'],_0xb5e354);WhatsappInteractionEvents[_0xa6bd('0xc')](_0x1598fb,_0xb5e354);_0x1d9c9d(null);})['catch'](_0x1d9c9d(null));};}for(var e in events){if(events[_0xa6bd('0xd')](e)){var event=events[e];WhatsappInteraction[_0xa6bd('0xe')](e,emitEvent(event));}}module[_0xa6bd('0xf')]=WhatsappInteractionEvents; \ No newline at end of file diff --git a/server/api/whatsappInteraction/whatsappInteraction.model.js b/server/api/whatsappInteraction/whatsappInteraction.model.js index c4f135f..8d3ed37 100644 --- a/server/api/whatsappInteraction/whatsappInteraction.model.js +++ b/server/api/whatsappInteraction/whatsappInteraction.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa1ce=['../../config/environment','./whatsappInteraction.attributes','exports','WhatsappInteraction','whatsapp_interactions','changed','closedAt','format','../../config/logger','api','moment','bluebird','request-promise'];(function(_0x459fb1,_0x48b273){var _0xfe817c=function(_0x6a8189){while(--_0x6a8189){_0x459fb1['push'](_0x459fb1['shift']());}};_0xfe817c(++_0x48b273);}(_0xa1ce,0x1cf));var _0xea1c=function(_0x2c5fb5,_0x5867cb){_0x2c5fb5=_0x2c5fb5-0x0;var _0x3247c0=_0xa1ce[_0x2c5fb5];return _0x3247c0;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0xea1c('0x0'))(_0xea1c('0x1'));var moment=require(_0xea1c('0x2'));var BPromise=require(_0xea1c('0x3'));var rp=require(_0xea1c('0x4'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0xea1c('0x5'));var attributes=require(_0xea1c('0x6'));module[_0xea1c('0x7')]=function(_0x4f762e,_0xafe582){return _0x4f762e['define'](_0xea1c('0x8'),attributes,{'tableName':_0xea1c('0x9'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x4f7336,_0x1c4853,_0x42e1f8){if(_0x4f7336[_0xea1c('0xa')]('closed')){_0x4f7336[_0xea1c('0xb')]=moment()[_0xea1c('0xc')]('YYYY-MM-DD\x20HH:mm:ss');}_0x42e1f8(null,_0x4f7336);}}});}; \ No newline at end of file +var _0x7576=['exports','define','WhatsappInteraction','whatsapp_interactions','changed','closed','closedAt','format','YYYY-MM-DD\x20HH:mm:ss','lodash','api','moment','request-promise','rimraf','../../config/environment','./whatsappInteraction.attributes'];(function(_0x49f913,_0x12ccd8){var _0xf48ea5=function(_0xfd48b0){while(--_0xfd48b0){_0x49f913['push'](_0x49f913['shift']());}};_0xf48ea5(++_0x12ccd8);}(_0x7576,0x169));var _0x6757=function(_0x44120e,_0x2c231f){_0x44120e=_0x44120e-0x0;var _0x172179=_0x7576[_0x44120e];return _0x172179;};'use strict';var _=require(_0x6757('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x6757('0x1'));var moment=require(_0x6757('0x2'));var BPromise=require('bluebird');var rp=require(_0x6757('0x3'));var fs=require('fs');var path=require('path');var rimraf=require(_0x6757('0x4'));var config=require(_0x6757('0x5'));var attributes=require(_0x6757('0x6'));module[_0x6757('0x7')]=function(_0x25bcdd,_0x567f33){return _0x25bcdd[_0x6757('0x8')](_0x6757('0x9'),attributes,{'tableName':_0x6757('0xa'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x407644,_0x5e486e,_0x5c9ae5){if(_0x407644[_0x6757('0xb')](_0x6757('0xc'))){_0x407644[_0x6757('0xd')]=moment()[_0x6757('0xe')](_0x6757('0xf'));}_0x5c9ae5(null,_0x407644);}}});}; \ No newline at end of file diff --git a/server/api/whatsappInteraction/whatsappInteraction.rpc.js b/server/api/whatsappInteraction/whatsappInteraction.rpc.js index cd53ade..da3b440 100644 --- a/server/api/whatsappInteraction/whatsappInteraction.rpc.js +++ b/server/api/whatsappInteraction/whatsappInteraction.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xed3e=['message','result','catch','UpdateWhatsappInteraction','WhatsappInteraction','update','body','options','raw','where','attributes','AddTagsToWhatsappInteraction','find','addTags','ids','spread','AddTags','util','moment','bluebird','../../mysqldb','rpc','jayson/promise','client','http','redis','localhost','./whatsappInteraction.socket','then','info','WhatsappInteraction,\x20%s,\x20%s','request\x20sent','debug','WhatsappInteraction,\x20%s,\x20%s,\x20%s','stringify','error','code'];(function(_0x4d1753,_0x50fd94){var _0x5c7f10=function(_0x150941){while(--_0x150941){_0x4d1753['push'](_0x4d1753['shift']());}};_0x5c7f10(++_0x50fd94);}(_0xed3e,0x114));var _0xeed3=function(_0x52d37b,_0x123d48){_0x52d37b=_0x52d37b-0x0;var _0x1db466=_0xed3e[_0x52d37b];return _0x1db466;};'use strict';var _=require('lodash');var util=require(_0xeed3('0x0'));var moment=require(_0xeed3('0x1'));var BPromise=require(_0xeed3('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0xeed3('0x3'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0xeed3('0x4'));var config=require('../../config/environment');var jayson=require(_0xeed3('0x5'));var client=jayson[_0xeed3('0x6')][_0xeed3('0x7')]({'port':0x232a});config[_0xeed3('0x8')]=_['defaults'](config[_0xeed3('0x8')],{'host':_0xeed3('0x9'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0xeed3('0xa'))['register'](socket);function respondWithRpcPromise(_0x4cc26c,_0x20e662,_0x37e5b1){return new BPromise(function(_0x4629ce,_0x522d0d){return client['request'](_0x4cc26c,_0x37e5b1)[_0xeed3('0xb')](function(_0x358072){logger[_0xeed3('0xc')](_0xeed3('0xd'),_0x20e662,_0xeed3('0xe'));logger[_0xeed3('0xf')](_0xeed3('0x10'),_0x20e662,_0xeed3('0xe'),JSON[_0xeed3('0x11')](_0x358072));if(_0x358072['error']){if(_0x358072[_0xeed3('0x12')][_0xeed3('0x13')]===0x1f4){logger['error'](_0xeed3('0xd'),_0x20e662,_0x358072['error'][_0xeed3('0x14')]);return _0x522d0d(_0x358072['error'][_0xeed3('0x14')]);}logger[_0xeed3('0x12')](_0xeed3('0xd'),_0x20e662,_0x358072[_0xeed3('0x12')][_0xeed3('0x14')]);return _0x4629ce(_0x358072[_0xeed3('0x12')]['message']);}else{logger[_0xeed3('0xc')]('WhatsappInteraction,\x20%s,\x20%s',_0x20e662,_0xeed3('0xe'));_0x4629ce(_0x358072[_0xeed3('0x15')][_0xeed3('0x14')]);}})[_0xeed3('0x16')](function(_0x28be3b){logger[_0xeed3('0x12')]('WhatsappInteraction,\x20%s,\x20%s',_0x20e662,_0x28be3b);_0x522d0d(_0x28be3b);});});}exports[_0xeed3('0x17')]=function(_0x48bbfb){var _0x3be720=this;return new Promise(function(_0x371af4,_0x1f628b){return db[_0xeed3('0x18')][_0xeed3('0x19')](_0x48bbfb[_0xeed3('0x1a')],{'raw':_0x48bbfb[_0xeed3('0x1b')]?_0x48bbfb[_0xeed3('0x1b')][_0xeed3('0x1c')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x48bbfb[_0xeed3('0x1b')]?_0x48bbfb[_0xeed3('0x1b')][_0xeed3('0x1d')]||null:null,'attributes':_0x48bbfb[_0xeed3('0x1b')]?_0x48bbfb[_0xeed3('0x1b')][_0xeed3('0x1e')]||null:null,'limit':_0x48bbfb['options']?_0x48bbfb['options']['limit']||null:null})[_0xeed3('0xb')](function(_0x5b90bc){logger[_0xeed3('0xc')](_0xeed3('0x17'),_0x48bbfb);logger[_0xeed3('0xf')](_0xeed3('0x17'),_0x48bbfb,JSON[_0xeed3('0x11')](_0x5b90bc));_0x371af4(_0x5b90bc);})[_0xeed3('0x16')](function(_0x1d8b7c){logger[_0xeed3('0x12')](_0xeed3('0x17'),_0x1d8b7c[_0xeed3('0x14')],_0x48bbfb);_0x1f628b(_0x3be720['error'](0x1f4,_0x1d8b7c[_0xeed3('0x14')]));});});};exports[_0xeed3('0x1f')]=function(_0x247000){return new Promise(function(_0x4b54d4,_0x36e558){return db[_0xeed3('0x18')][_0xeed3('0x20')]({'where':_0x247000[_0xeed3('0x1b')]?_0x247000['options'][_0xeed3('0x1d')]||null:null})[_0xeed3('0xb')](function(_0x5e5563){if(_0x5e5563){return _0x5e5563[_0xeed3('0x21')](_0x247000[_0xeed3('0x1a')][_0xeed3('0x22')],_['omit'](_0x247000[_0xeed3('0x1a')],[_0xeed3('0x22'),'id'])||{});}})[_0xeed3('0x23')](function(_0x570508){logger[_0xeed3('0xc')]('AddTags',_0x247000);logger['debug'](_0xeed3('0x24'),_0x247000,JSON[_0xeed3('0x11')](_0x570508));_0x4b54d4(_0x570508);})['catch'](function(_0x25abe6){logger[_0xeed3('0x12')](_0xeed3('0x24'),_0x25abe6['message'],_0x247000);_0x36e558(_this[_0xeed3('0x12')](0x1f4,_0x25abe6[_0xeed3('0x14')]));});});}; \ No newline at end of file +var _0xfb75=['../../config/utils','../../config/logger','jayson/promise','client','http','redis','localhost','./whatsappInteraction.socket','register','request','then','info','WhatsappInteraction,\x20%s,\x20%s','debug','WhatsappInteraction,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','UpdateWhatsappInteraction','WhatsappInteraction','update','body','options','raw','where','limit','AddTagsToWhatsappInteraction','find','addTags','ids','omit','spread','AddTags','lodash','moment','bluebird','ioredis'];(function(_0x298ed3,_0x4ab5e1){var _0x5aad28=function(_0x168687){while(--_0x168687){_0x298ed3['push'](_0x298ed3['shift']());}};_0x5aad28(++_0x4ab5e1);}(_0xfb75,0xa0));var _0x5fb7=function(_0x2cc7f7,_0x3ca015){_0x2cc7f7=_0x2cc7f7-0x0;var _0x15faff=_0xfb75[_0x2cc7f7];return _0x15faff;};'use strict';var _=require(_0x5fb7('0x0'));var util=require('util');var moment=require(_0x5fb7('0x1'));var BPromise=require(_0x5fb7('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x5fb7('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x5fb7('0x4'));var logger=require(_0x5fb7('0x5'))('rpc');var config=require('../../config/environment');var jayson=require(_0x5fb7('0x6'));var client=jayson[_0x5fb7('0x7')][_0x5fb7('0x8')]({'port':0x232a});config[_0x5fb7('0x9')]=_['defaults'](config[_0x5fb7('0x9')],{'host':_0x5fb7('0xa'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x5fb7('0x9')]));require(_0x5fb7('0xb'))[_0x5fb7('0xc')](socket);function respondWithRpcPromise(_0x168e3b,_0x5618a2,_0x5ea221){return new BPromise(function(_0xe7eeed,_0x2e4e82){return client[_0x5fb7('0xd')](_0x168e3b,_0x5ea221)[_0x5fb7('0xe')](function(_0x1195d0){logger[_0x5fb7('0xf')](_0x5fb7('0x10'),_0x5618a2,'request\x20sent');logger[_0x5fb7('0x11')](_0x5fb7('0x12'),_0x5618a2,_0x5fb7('0x13'),JSON[_0x5fb7('0x14')](_0x1195d0));if(_0x1195d0[_0x5fb7('0x15')]){if(_0x1195d0[_0x5fb7('0x15')][_0x5fb7('0x16')]===0x1f4){logger[_0x5fb7('0x15')](_0x5fb7('0x10'),_0x5618a2,_0x1195d0[_0x5fb7('0x15')][_0x5fb7('0x17')]);return _0x2e4e82(_0x1195d0[_0x5fb7('0x15')][_0x5fb7('0x17')]);}logger[_0x5fb7('0x15')](_0x5fb7('0x10'),_0x5618a2,_0x1195d0[_0x5fb7('0x15')][_0x5fb7('0x17')]);return _0xe7eeed(_0x1195d0[_0x5fb7('0x15')][_0x5fb7('0x17')]);}else{logger[_0x5fb7('0xf')](_0x5fb7('0x10'),_0x5618a2,_0x5fb7('0x13'));_0xe7eeed(_0x1195d0[_0x5fb7('0x18')][_0x5fb7('0x17')]);}})[_0x5fb7('0x19')](function(_0x3e4063){logger[_0x5fb7('0x15')](_0x5fb7('0x10'),_0x5618a2,_0x3e4063);_0x2e4e82(_0x3e4063);});});}exports[_0x5fb7('0x1a')]=function(_0x2bde74){var _0x28ad0f=this;return new Promise(function(_0x53b674,_0x17496d){return db[_0x5fb7('0x1b')][_0x5fb7('0x1c')](_0x2bde74[_0x5fb7('0x1d')],{'raw':_0x2bde74[_0x5fb7('0x1e')]?_0x2bde74[_0x5fb7('0x1e')][_0x5fb7('0x1f')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x2bde74[_0x5fb7('0x1e')]?_0x2bde74[_0x5fb7('0x1e')][_0x5fb7('0x20')]||null:null,'attributes':_0x2bde74[_0x5fb7('0x1e')]?_0x2bde74[_0x5fb7('0x1e')]['attributes']||null:null,'limit':_0x2bde74[_0x5fb7('0x1e')]?_0x2bde74[_0x5fb7('0x1e')][_0x5fb7('0x21')]||null:null})[_0x5fb7('0xe')](function(_0x3302d5){logger[_0x5fb7('0xf')](_0x5fb7('0x1a'),_0x2bde74);logger[_0x5fb7('0x11')]('UpdateWhatsappInteraction',_0x2bde74,JSON[_0x5fb7('0x14')](_0x3302d5));_0x53b674(_0x3302d5);})['catch'](function(_0x5e7631){logger[_0x5fb7('0x15')](_0x5fb7('0x1a'),_0x5e7631[_0x5fb7('0x17')],_0x2bde74);_0x17496d(_0x28ad0f[_0x5fb7('0x15')](0x1f4,_0x5e7631['message']));});});};exports[_0x5fb7('0x22')]=function(_0xcea1cf){return new Promise(function(_0xc2de4d,_0x42e588){return db[_0x5fb7('0x1b')][_0x5fb7('0x23')]({'where':_0xcea1cf[_0x5fb7('0x1e')]?_0xcea1cf[_0x5fb7('0x1e')][_0x5fb7('0x20')]||null:null})[_0x5fb7('0xe')](function(_0x579018){if(_0x579018){return _0x579018[_0x5fb7('0x24')](_0xcea1cf['body'][_0x5fb7('0x25')],_[_0x5fb7('0x26')](_0xcea1cf[_0x5fb7('0x1d')],[_0x5fb7('0x25'),'id'])||{});}})[_0x5fb7('0x27')](function(_0x425f8b){logger[_0x5fb7('0xf')]('AddTags',_0xcea1cf);logger[_0x5fb7('0x11')](_0x5fb7('0x28'),_0xcea1cf,JSON[_0x5fb7('0x14')](_0x425f8b));_0xc2de4d(_0x425f8b);})[_0x5fb7('0x19')](function(_0x1e49c1){logger[_0x5fb7('0x15')]('AddTags',_0x1e49c1[_0x5fb7('0x17')],_0xcea1cf);_0x42e588(_this[_0x5fb7('0x15')](0x1f4,_0x1e49c1[_0x5fb7('0x17')]));});});}; \ No newline at end of file diff --git a/server/api/whatsappInteraction/whatsappInteraction.socket.js b/server/api/whatsappInteraction/whatsappInteraction.socket.js index fc9bac1..e5ad01f 100644 --- a/server/api/whatsappInteraction/whatsappInteraction.socket.js +++ b/server/api/whatsappInteraction/whatsappInteraction.socket.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x88e8=['length','whatsappInteraction:','save','remove','update','emit','removeListener','register'];(function(_0x1c16f4,_0x14ebb6){var _0x1e006c=function(_0x2ccb91){while(--_0x2ccb91){_0x1c16f4['push'](_0x1c16f4['shift']());}};_0x1e006c(++_0x14ebb6);}(_0x88e8,0x172));var _0x888e=function(_0x237815,_0x1ef2b0){_0x237815=_0x237815-0x0;var _0x5498ee=_0x88e8[_0x237815];return _0x5498ee;};'use strict';var WhatsappInteractionEvents=require('./whatsappInteraction.events');var events=[_0x888e('0x0'),_0x888e('0x1'),_0x888e('0x2')];function createListener(_0xa14689,_0x3ba466){return function(_0x2a3da3){_0x3ba466[_0x888e('0x3')](_0xa14689,_0x2a3da3);};}function removeListener(_0x240153,_0x2c4e94){return function(){WhatsappInteractionEvents[_0x888e('0x4')](_0x240153,_0x2c4e94);};}exports[_0x888e('0x5')]=function(_0x194af2){for(var _0x2ec956=0x0,_0x385c25=events[_0x888e('0x6')];_0x2ec956<_0x385c25;_0x2ec956++){var _0x399af0=events[_0x2ec956];var _0x1f1968=createListener(_0x888e('0x7')+_0x399af0,_0x194af2);WhatsappInteractionEvents['on'](_0x399af0,_0x1f1968);}}; \ No newline at end of file +var _0x20b2=['update','removeListener','length','whatsappInteraction:','./whatsappInteraction.events','save','remove'];(function(_0x2db8e0,_0x17ba83){var _0x3740cc=function(_0x3320a9){while(--_0x3320a9){_0x2db8e0['push'](_0x2db8e0['shift']());}};_0x3740cc(++_0x17ba83);}(_0x20b2,0x19a));var _0x220b=function(_0xa1dbb5,_0x163f28){_0xa1dbb5=_0xa1dbb5-0x0;var _0x1c04fd=_0x20b2[_0xa1dbb5];return _0x1c04fd;};'use strict';var WhatsappInteractionEvents=require(_0x220b('0x0'));var events=[_0x220b('0x1'),_0x220b('0x2'),_0x220b('0x3')];function createListener(_0x2c00fe,_0x93fe85){return function(_0x123e91){_0x93fe85['emit'](_0x2c00fe,_0x123e91);};}function removeListener(_0x4dd9af,_0x47731c){return function(){WhatsappInteractionEvents[_0x220b('0x4')](_0x4dd9af,_0x47731c);};}exports['register']=function(_0x39c3dc){for(var _0x517bcc=0x0,_0x5740d7=events[_0x220b('0x5')];_0x517bcc<_0x5740d7;_0x517bcc++){var _0x3fa388=events[_0x517bcc];var _0x216b11=createListener(_0x220b('0x6')+_0x3fa388,_0x39c3dc);WhatsappInteractionEvents['on'](_0x3fa388,_0x216b11);}}; \ No newline at end of file diff --git a/server/api/whatsappMessage/index.js b/server/api/whatsappMessage/index.js index a7b44ac..3e08713 100644 --- a/server/api/whatsappMessage/index.js +++ b/server/api/whatsappMessage/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xeafd=['accept','/:id/reject','reject','delete','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./whatsappMessage.controller','get','isAuthenticated','/describe','describe','/:id','post','whatsapp','create','/:id/status','update','put'];(function(_0x2b0d16,_0xc9278e){var _0x50405c=function(_0x1ce357){while(--_0x1ce357){_0x2b0d16['push'](_0x2b0d16['shift']());}};_0x50405c(++_0xc9278e);}(_0xeafd,0x1f3));var _0xdeaf=function(_0x174ef5,_0x256e8e){_0x174ef5=_0x174ef5-0x0;var _0x1cc379=_0xeafd[_0x174ef5];return _0x1cc379;};'use strict';var multer=require(_0xdeaf('0x0'));var util=require(_0xdeaf('0x1'));var path=require(_0xdeaf('0x2'));var timeout=require(_0xdeaf('0x3'));var express=require(_0xdeaf('0x4'));var router=express[_0xdeaf('0x5')]();var auth=require(_0xdeaf('0x6'));var interaction=require(_0xdeaf('0x7'));var config=require(_0xdeaf('0x8'));var controller=require(_0xdeaf('0x9'));router[_0xdeaf('0xa')]('/',auth[_0xdeaf('0xb')](),controller['index']);router[_0xdeaf('0xa')](_0xdeaf('0xc'),auth[_0xdeaf('0xb')](),controller[_0xdeaf('0xd')]);router[_0xdeaf('0xa')](_0xdeaf('0xe'),auth[_0xdeaf('0xb')](),controller['show']);router[_0xdeaf('0xf')]('/',auth[_0xdeaf('0xb')](),interaction['tracked'](_0xdeaf('0x10'),'whatsappmessage:create'),controller[_0xdeaf('0x11')]);router[_0xdeaf('0xf')](_0xdeaf('0x12'),controller['status']);router['put']('/:id',auth['isAuthenticated'](),controller[_0xdeaf('0x13')]);router[_0xdeaf('0x14')]('/:id/accept',auth[_0xdeaf('0xb')](),controller[_0xdeaf('0x15')]);router[_0xdeaf('0x14')](_0xdeaf('0x16'),auth[_0xdeaf('0xb')](),controller[_0xdeaf('0x17')]);router[_0xdeaf('0x18')]('/:id',auth[_0xdeaf('0xb')](),controller['destroy']);module[_0xdeaf('0x19')]=router; \ No newline at end of file +var _0x4466=['reject','delete','destroy','exports','multer','util','path','connect-timeout','../../components/auth/service','../../config/environment','./whatsappMessage.controller','get','isAuthenticated','/describe','describe','/:id','show','post','whatsapp','whatsappmessage:create','create','status','put','update','/:id/accept','/:id/reject'];(function(_0xfc4cca,_0x48728c){var _0x2090b0=function(_0xbb4a66){while(--_0xbb4a66){_0xfc4cca['push'](_0xfc4cca['shift']());}};_0x2090b0(++_0x48728c);}(_0x4466,0xba));var _0x6446=function(_0x465d8c,_0x101ece){_0x465d8c=_0x465d8c-0x0;var _0x28f93e=_0x4466[_0x465d8c];return _0x28f93e;};'use strict';var multer=require(_0x6446('0x0'));var util=require(_0x6446('0x1'));var path=require(_0x6446('0x2'));var timeout=require(_0x6446('0x3'));var express=require('express');var router=express['Router']();var auth=require(_0x6446('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0x6446('0x5'));var controller=require(_0x6446('0x6'));router[_0x6446('0x7')]('/',auth[_0x6446('0x8')](),controller['index']);router[_0x6446('0x7')](_0x6446('0x9'),auth[_0x6446('0x8')](),controller[_0x6446('0xa')]);router[_0x6446('0x7')](_0x6446('0xb'),auth[_0x6446('0x8')](),controller[_0x6446('0xc')]);router[_0x6446('0xd')]('/',auth[_0x6446('0x8')](),interaction['tracked'](_0x6446('0xe'),_0x6446('0xf')),controller[_0x6446('0x10')]);router[_0x6446('0xd')]('/:id/status',controller[_0x6446('0x11')]);router[_0x6446('0x12')](_0x6446('0xb'),auth[_0x6446('0x8')](),controller[_0x6446('0x13')]);router[_0x6446('0x12')](_0x6446('0x14'),auth[_0x6446('0x8')](),controller['accept']);router[_0x6446('0x12')](_0x6446('0x15'),auth[_0x6446('0x8')](),controller[_0x6446('0x16')]);router[_0x6446('0x17')](_0x6446('0xb'),auth[_0x6446('0x8')](),controller[_0x6446('0x18')]);module[_0x6446('0x19')]=router; \ No newline at end of file diff --git a/server/api/whatsappMessage/whatsappMessage.attributes.js b/server/api/whatsappMessage/whatsappMessage.attributes.js index f909f13..ab519a0 100644 --- a/server/api/whatsappMessage/whatsappMessage.attributes.js +++ b/server/api/whatsappMessage/whatsappMessage.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x5881=['STRING','DATE','exports','TEXT','medium','BOOLEAN','ENUM','out'];(function(_0xc4ce48,_0x1ca08f){var _0x5275a9=function(_0x34cf49){while(--_0x34cf49){_0xc4ce48['push'](_0xc4ce48['shift']());}};_0x5275a9(++_0x1ca08f);}(_0x5881,0x1f2));var _0x1588=function(_0x1c7ea7,_0x255b7f){_0x1c7ea7=_0x1c7ea7-0x0;var _0x55f21d=_0x5881[_0x1c7ea7];return _0x55f21d;};'use strict';var Sequelize=require('sequelize');module[_0x1588('0x0')]={'body':{'type':Sequelize[_0x1588('0x1')](_0x1588('0x2')),'allowNull':![]},'read':{'type':Sequelize[_0x1588('0x3')],'defaultValue':![]},'direction':{'type':Sequelize[_0x1588('0x4')]('in','out'),'defaultValue':_0x1588('0x5'),'allowNull':![]},'messageId':{'type':Sequelize['STRING'](0xbe)},'phone':{'type':Sequelize[_0x1588('0x6')]},'readAt':{'type':Sequelize[_0x1588('0x7')]},'secret':{'type':Sequelize[_0x1588('0x3')],'defaultValue':![]}}; \ No newline at end of file +var _0x1a52=['ENUM','out','STRING','DATE','sequelize','exports','BOOLEAN'];(function(_0x5f53ab,_0x324327){var _0x116166=function(_0x2e8e6a){while(--_0x2e8e6a){_0x5f53ab['push'](_0x5f53ab['shift']());}};_0x116166(++_0x324327);}(_0x1a52,0x115));var _0x21a5=function(_0x16e011,_0xf9237f){_0x16e011=_0x16e011-0x0;var _0x513069=_0x1a52[_0x16e011];return _0x513069;};'use strict';var Sequelize=require(_0x21a5('0x0'));module[_0x21a5('0x1')]={'body':{'type':Sequelize['TEXT']('medium'),'allowNull':![]},'read':{'type':Sequelize[_0x21a5('0x2')],'defaultValue':![]},'direction':{'type':Sequelize[_0x21a5('0x3')]('in',_0x21a5('0x4')),'defaultValue':_0x21a5('0x4'),'allowNull':![]},'messageId':{'type':Sequelize[_0x21a5('0x5')](0xbe)},'phone':{'type':Sequelize[_0x21a5('0x5')]},'readAt':{'type':Sequelize[_0x21a5('0x6')]},'secret':{'type':Sequelize[_0x21a5('0x2')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/whatsappMessage/whatsappMessage.controller.js b/server/api/whatsappMessage/whatsappMessage.controller.js index ed09646..04bd79e 100644 --- a/server/api/whatsappMessage/whatsappMessage.controller.js +++ b/server/api/whatsappMessage/whatsappMessage.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x4703=['then','info','WhatsappMessage,\x20%s,\x20%s','request\x20sent','debug','WhatsappMessage,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','sendStatus','status','end','json','count','offset','set','Content-Range','apply','reject','save','destroy','stack','name','send','index','map','fieldName','type','key','model','query','keys','intersection','attributes','fields','length','hasOwnProperty','nolimit','limit','sort','where','pick','merge','VIRTUAL','filter','options','WhatsappMessage','includeAll','include','findAll','rows','params','rawAttributes','filters','find','create','body','update','describe','../../config/logger','whatsapp-interactions','accept','whatsapp','readAt','format','YYYY-MM-DD\x20HH:mm:ss','UserId','Contact','get','WhatsappInteractionId','isNil','read1stAt','interaction','[WHATSAPPMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','user','role','stringify','AcceptMessage','acceptMessage','manual','interface','SIP/%s','channel','event','EventManager','acceptmessage','agent','[WHATSAPPMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','null','RejectMessage','WhatsappAccount','WhatsppMessage,\x20%s,\x20%s,\x20%s','received\x20delivery\x20report\x20from','inspect','twilio','MessageSid','messageId','MessageStatus','WhatsappAccount,\x20%s,\x20%s,\x20%s','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','path','to-csv','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','redis','defaults','socket.io-emitter','./whatsappMessage.socket','register','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'];(function(_0x3284cd,_0x2e10a2){var _0xe92280=function(_0x398d2e){while(--_0x398d2e){_0x3284cd['push'](_0x3284cd['shift']());}};_0xe92280(++_0x2e10a2);}(_0x4703,0x65));var _0x3470=function(_0x1767d9,_0x2dcf6c){_0x1767d9=_0x1767d9-0x0;var _0x25ec43=_0x4703[_0x1767d9];return _0x25ec43;};'use strict';var pdf=require(_0x3470('0x0'));var emlformat=require(_0x3470('0x1'));var rimraf=require(_0x3470('0x2'));var zipdir=require(_0x3470('0x3'));var jsonpatch=require(_0x3470('0x4'));var rp=require(_0x3470('0x5'));var moment=require(_0x3470('0x6'));var BPromise=require('bluebird');var Mustache=require(_0x3470('0x7'));var util=require('util');var path=require(_0x3470('0x8'));var sox=require('sox');var csv=require(_0x3470('0x9'));var ejs=require('ejs');var fs=require('fs');var _=require('lodash');var squel=require(_0x3470('0xa'));var crypto=require(_0x3470('0xb'));var jsforce=require(_0x3470('0xc'));var deskjs=require(_0x3470('0xd'));var toCsv=require('to-csv');var querystring=require(_0x3470('0xe'));var Papa=require(_0x3470('0xf'));var Redis=require(_0x3470('0x10'));var authService=require(_0x3470('0x11'));var qs=require(_0x3470('0x12'));var as=require(_0x3470('0x13'));var hardwareService=require(_0x3470('0x14'));var logger=require('../../config/logger')(_0x3470('0x15'));var utils=require(_0x3470('0x16'));var config=require('../../config/environment');var db=require('../../mysqldb')['db'];config[_0x3470('0x17')]=_[_0x3470('0x18')](config[_0x3470('0x17')],{'host':'localhost','port':0x18eb});var socket=require(_0x3470('0x19'))(new Redis(config[_0x3470('0x17')]));require(_0x3470('0x1a'))[_0x3470('0x1b')](socket);var jayson=require(_0x3470('0x1c'));var client=jayson[_0x3470('0x1d')][_0x3470('0x1e')]({'port':0x232c});var client9002=jayson[_0x3470('0x1d')]['http']({'port':0x232a});function checkPasswordPattern(_0x4fdcf6,_0xb8fabb,_0x1fcd26){if(_0x1fcd26){var _0x50bb53=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x50bb53['test'](_0xb8fabb)){return _0x4fdcf6;}else{throw new db[(_0x3470('0x1f'))]['ValidationError'](_0x3470('0x20'));}}else{return _0x4fdcf6;}}function respondWithRpcPromise(_0xb6a204,_0xc1055,_0x20e725,_0x59bcd1){return new BPromise(function(_0x96ea6,_0x2d1e81){var _0xb3d734=_0x59bcd1||client;return _0xb3d734[_0x3470('0x21')](_0xb6a204,_0x20e725)[_0x3470('0x22')](function(_0x61026a){logger[_0x3470('0x23')](_0x3470('0x24'),_0xc1055,_0x3470('0x25'));logger[_0x3470('0x26')](_0x3470('0x27'),_0xc1055,'request\x20sent',JSON['stringify'](_0x61026a));if(_0x61026a[_0x3470('0x28')]){if(_0x61026a[_0x3470('0x28')][_0x3470('0x29')]===0x1f4){logger[_0x3470('0x28')](_0x3470('0x24'),_0xc1055,_0x61026a[_0x3470('0x28')][_0x3470('0x2a')]);return _0x2d1e81(_0x61026a[_0x3470('0x28')][_0x3470('0x2a')]);}logger[_0x3470('0x28')](_0x3470('0x24'),_0xc1055,_0x61026a['error'][_0x3470('0x2a')]);return _0x96ea6(_0x61026a['error'][_0x3470('0x2a')]);}else{logger[_0x3470('0x23')](_0x3470('0x24'),_0xc1055,'request\x20sent');_0x96ea6(_0x61026a[_0x3470('0x2b')][_0x3470('0x2a')]);}})[_0x3470('0x2c')](function(_0x3795d8){logger[_0x3470('0x28')](_0x3470('0x24'),_0xc1055,_0x3795d8);_0x2d1e81(_0x3795d8);});});}function respondWithStatusCode(_0x18550a,_0x147b66){_0x147b66=_0x147b66||0xcc;return function(_0x136bdd){if(_0x136bdd){return _0x18550a[_0x3470('0x2d')](_0x147b66);}return _0x18550a[_0x3470('0x2e')](_0x147b66)[_0x3470('0x2f')]();};}function respondWithResult(_0x8e090f,_0x4ec0ba){_0x4ec0ba=_0x4ec0ba||0xc8;return function(_0x4e47c3){if(_0x4e47c3){return _0x8e090f[_0x3470('0x2e')](_0x4ec0ba)[_0x3470('0x30')](_0x4e47c3);}};}function respondWithFilteredResult(_0x16eb37,_0x41b5fb){return function(_0x163807){if(_0x163807){var _0x384e67=_0x163807[_0x3470('0x31')],_0x2fc6b9=_0x41b5fb[_0x3470('0x32')],_0x440782=_0x41b5fb[_0x3470('0x32')]+_0x41b5fb['limit'],_0x3b2a70;if(_0x440782>=_0x384e67){_0x440782=_0x384e67;_0x3b2a70=0xc8;}else{_0x3b2a70=0xce;}_0x16eb37[_0x3470('0x2e')](_0x3b2a70);return _0x16eb37[_0x3470('0x33')](_0x3470('0x34'),_0x2fc6b9+'-'+_0x440782+'/'+_0x384e67)[_0x3470('0x30')](_0x163807);}return null;};}function patchUpdates(_0x49cedb){return function(_0x1a26f2){try{jsonpatch[_0x3470('0x35')](_0x1a26f2,_0x49cedb,!![]);}catch(_0x5c8b28){return BPromise[_0x3470('0x36')](_0x5c8b28);}return _0x1a26f2[_0x3470('0x37')]();};}function saveUpdates(_0x8b9862,_0x51fc58){return function(_0x3dc007){if(_0x3dc007){return _0x3dc007['update'](_0x8b9862)[_0x3470('0x22')](function(_0x2be792){return _0x2be792;});}return null;};}function removeEntity(_0xcb182a,_0x111ae8){return function(_0x37a896){if(_0x37a896){return _0x37a896[_0x3470('0x38')]()[_0x3470('0x22')](function(){_0xcb182a[_0x3470('0x2e')](0xcc)[_0x3470('0x2f')]();});}};}function handleEntityNotFound(_0x401b32,_0x4ce708){return function(_0x133ce3){if(!_0x133ce3){_0x401b32['sendStatus'](0x194);}return _0x133ce3;};}function handleError(_0x16e607,_0x2c7eb7){_0x2c7eb7=_0x2c7eb7||0x1f4;return function(_0x42718d){logger['error'](_0x42718d[_0x3470('0x39')]);if(_0x42718d[_0x3470('0x3a')]){delete _0x42718d[_0x3470('0x3a')];}_0x16e607[_0x3470('0x2e')](_0x2c7eb7)[_0x3470('0x3b')](_0x42718d);};}exports[_0x3470('0x3c')]=function(_0x560efe,_0x551a0e){var _0x5329d2={},_0x3eb65b={},_0x11b456={'count':0x0,'rows':[]};var _0x4f2a54=_[_0x3470('0x3d')](db['WhatsappMessage']['rawAttributes'],function(_0x4ff019){return{'name':_0x4ff019[_0x3470('0x3e')],'type':_0x4ff019[_0x3470('0x3f')][_0x3470('0x40')]};});_0x3eb65b[_0x3470('0x41')]=_[_0x3470('0x3d')](_0x4f2a54,_0x3470('0x3a'));_0x3eb65b[_0x3470('0x42')]=_[_0x3470('0x43')](_0x560efe[_0x3470('0x42')]);_0x3eb65b['filters']=_[_0x3470('0x44')](_0x3eb65b[_0x3470('0x41')],_0x3eb65b[_0x3470('0x42')]);_0x5329d2[_0x3470('0x45')]=_[_0x3470('0x44')](_0x3eb65b[_0x3470('0x41')],qs[_0x3470('0x46')](_0x560efe['query'][_0x3470('0x46')]));_0x5329d2[_0x3470('0x45')]=_0x5329d2['attributes'][_0x3470('0x47')]?_0x5329d2['attributes']:_0x3eb65b[_0x3470('0x41')];if(!_0x560efe['query'][_0x3470('0x48')](_0x3470('0x49'))){_0x5329d2[_0x3470('0x4a')]=qs[_0x3470('0x4a')](_0x560efe[_0x3470('0x42')][_0x3470('0x4a')]);_0x5329d2[_0x3470('0x32')]=qs[_0x3470('0x32')](_0x560efe['query']['offset']);}_0x5329d2['order']=qs[_0x3470('0x4b')](_0x560efe[_0x3470('0x42')][_0x3470('0x4b')]);_0x5329d2[_0x3470('0x4c')]=qs['filters'](_[_0x3470('0x4d')](_0x560efe[_0x3470('0x42')],_0x3eb65b['filters']),_0x4f2a54);if(_0x560efe[_0x3470('0x42')]['filter']){_0x5329d2[_0x3470('0x4c')]=_[_0x3470('0x4e')](_0x5329d2[_0x3470('0x4c')],{'$or':_['map'](_0x4f2a54,function(_0x33d365){if(_0x33d365[_0x3470('0x3f')]!==_0x3470('0x4f')){var _0x6306b1={};_0x6306b1[_0x33d365[_0x3470('0x3a')]]={'$like':'%'+_0x560efe[_0x3470('0x42')][_0x3470('0x50')]+'%'};return _0x6306b1;}})});}_0x5329d2=_[_0x3470('0x4e')]({},_0x5329d2,_0x560efe[_0x3470('0x51')]);var _0x364eac={'where':_0x5329d2[_0x3470('0x4c')]};return db[_0x3470('0x52')][_0x3470('0x31')](_0x364eac)[_0x3470('0x22')](function(_0x465ef8){_0x11b456[_0x3470('0x31')]=_0x465ef8;if(_0x560efe[_0x3470('0x42')][_0x3470('0x53')]){_0x5329d2[_0x3470('0x54')]=[{'all':!![]}];}return db['WhatsappMessage'][_0x3470('0x55')](_0x5329d2);})[_0x3470('0x22')](function(_0x1be8e5){_0x11b456[_0x3470('0x56')]=_0x1be8e5;return _0x11b456;})[_0x3470('0x22')](respondWithFilteredResult(_0x551a0e,_0x5329d2))[_0x3470('0x2c')](handleError(_0x551a0e,null));};exports['show']=function(_0x3d90a5,_0x174746){var _0xd84cef={'raw':!![],'where':{'id':_0x3d90a5[_0x3470('0x57')]['id']}},_0x5c74bc={};_0x5c74bc[_0x3470('0x41')]=_[_0x3470('0x43')](db[_0x3470('0x52')][_0x3470('0x58')]);_0x5c74bc['query']=_[_0x3470('0x43')](_0x3d90a5[_0x3470('0x42')]);_0x5c74bc[_0x3470('0x59')]=_[_0x3470('0x44')](_0x5c74bc[_0x3470('0x41')],_0x5c74bc[_0x3470('0x42')]);_0xd84cef[_0x3470('0x45')]=_['intersection'](_0x5c74bc[_0x3470('0x41')],qs[_0x3470('0x46')](_0x3d90a5[_0x3470('0x42')]['fields']));_0xd84cef['attributes']=_0xd84cef[_0x3470('0x45')][_0x3470('0x47')]?_0xd84cef['attributes']:_0x5c74bc[_0x3470('0x41')];if(_0x3d90a5[_0x3470('0x42')]['includeAll']){_0xd84cef['include']=[{'all':!![]}];}_0xd84cef=_[_0x3470('0x4e')]({},_0xd84cef,_0x3d90a5[_0x3470('0x51')]);return db[_0x3470('0x52')][_0x3470('0x5a')](_0xd84cef)[_0x3470('0x22')](handleEntityNotFound(_0x174746,null))[_0x3470('0x22')](respondWithResult(_0x174746,null))['catch'](handleError(_0x174746,null));};exports[_0x3470('0x5b')]=function(_0x5966eb,_0x5ec7cb){return db['WhatsappMessage'][_0x3470('0x5b')](_0x5966eb[_0x3470('0x5c')],{})['then'](respondWithResult(_0x5ec7cb,0xc9))[_0x3470('0x2c')](handleError(_0x5ec7cb,null));};exports[_0x3470('0x5d')]=function(_0x3b311d,_0x1c7455){if(_0x3b311d['body']['id']){delete _0x3b311d['body']['id'];}return db['WhatsappMessage'][_0x3470('0x5a')]({'where':{'id':_0x3b311d['params']['id']}})[_0x3470('0x22')](handleEntityNotFound(_0x1c7455,null))[_0x3470('0x22')](saveUpdates(_0x3b311d[_0x3470('0x5c')],null))['then'](respondWithResult(_0x1c7455,null))[_0x3470('0x2c')](handleError(_0x1c7455,null));};exports[_0x3470('0x38')]=function(_0x2667b7,_0x36c3c4){return db['WhatsappMessage'][_0x3470('0x5a')]({'where':{'id':_0x2667b7[_0x3470('0x57')]['id']}})['then'](handleEntityNotFound(_0x36c3c4,null))[_0x3470('0x22')](removeEntity(_0x36c3c4,null))[_0x3470('0x2c')](handleError(_0x36c3c4,null));};exports[_0x3470('0x5e')]=function(_0x58ed71,_0x5dba58){return db[_0x3470('0x52')][_0x3470('0x5e')]()['then'](respondWithResult(_0x5dba58,null))[_0x3470('0x2c')](handleError(_0x5dba58,null));};var interaction_log=require(_0x3470('0x5f'))(_0x3470('0x60'));exports[_0x3470('0x61')]=function(_0x5bd35c,_0x3c58d1,_0x2e1b94){var _0x558705={'channel':_0x3470('0x62')};if(_0x5bd35c[_0x3470('0x5c')]['id']){delete _0x5bd35c[_0x3470('0x5c')]['id'];}_0x5bd35c[_0x3470('0x5c')]['read']=!![];_0x5bd35c['body'][_0x3470('0x63')]=moment()[_0x3470('0x64')](_0x3470('0x65'));_0x5bd35c[_0x3470('0x5c')][_0x3470('0x66')]=_0x5bd35c[_0x3470('0x5c')][_0x3470('0x66')]||_0x5bd35c['user']['id'];return db[_0x3470('0x52')]['find']({'where':{'id':_0x5bd35c['params']['id'],'UserId':null},'include':[{'model':db['CmContact'],'as':_0x3470('0x67')}]})['then'](handleEntityNotFound(_0x3c58d1,null))['then'](saveUpdates(_0x5bd35c[_0x3470('0x5c')],null))[_0x3470('0x22')](function(_0x2ae351){if(_0x2ae351){_0x558705[_0x3470('0x2a')]=_0x2ae351[_0x3470('0x68')]({'plain':!![]});return db['WhatsappInteraction'][_0x3470('0x5a')]({'where':{'id':_0x2ae351[_0x3470('0x69')]}});}return null;})['then'](handleEntityNotFound(_0x3c58d1,null))[_0x3470('0x22')](function(_0x5f2721){if(_0x5f2721){return _0x5f2721[_0x3470('0x5d')]({'UserId':_0x5bd35c[_0x3470('0x5c')][_0x3470('0x66')],'read1stAt':_[_0x3470('0x6a')](_0x5f2721[_0x3470('0x6b')])?moment()[_0x3470('0x64')](_0x3470('0x65')):undefined});}return null;})['then'](function(_0x32fecb){if(_0x32fecb){_0x558705[_0x3470('0x6c')]=_0x32fecb[_0x3470('0x68')]({'plain':!![]});interaction_log[_0x3470('0x23')](_0x3470('0x6d'),_0x5bd35c[_0x3470('0x6e')]['id'],_0x5bd35c[_0x3470('0x6e')][_0x3470('0x3a')],_0x5bd35c[_0x3470('0x6e')][_0x3470('0x6f')],_0x558705[_0x3470('0x6c')]['id'],_0x5bd35c['body']?JSON[_0x3470('0x70')](_0x5bd35c[_0x3470('0x5c')]):'null');return respondWithRpcPromise(_0x3470('0x71'),_0x3470('0x72'),_0x558705);}return null;})['then'](function(_0x102de8){if(_0x102de8){if(_0x5bd35c[_0x3470('0x5c')][_0x3470('0x73')]){_0x558705[_0x3470('0x2a')][_0x3470('0x74')]=util['format'](_0x3470('0x75'),_0x5bd35c[_0x3470('0x6e')][_0x3470('0x3a')]);_0x558705[_0x3470('0x2a')][_0x3470('0x76')]=_0x558705[_0x3470('0x76')];_0x558705[_0x3470('0x2a')][_0x3470('0x77')]=_0x3470('0x61');return respondWithRpcPromise(_0x3470('0x78'),_0x3470('0x78'),{'event':_0x3470('0x79'),'message':_0x558705['message']},client9002)[_0x3470('0x22')](function(){return _0x558705;});}return _0x558705;}return null;})['then'](respondWithResult(_0x3c58d1,null))[_0x3470('0x2c')](handleError(_0x3c58d1,null));};var interaction_log=require(_0x3470('0x5f'))('whatsapp-interactions');exports[_0x3470('0x36')]=function(_0x74a885,_0x335ad2,_0x39d100){var _0x50c877={'agent':{},'channel':'whatsapp'};if(_0x74a885[_0x3470('0x5c')]['id']){delete _0x74a885[_0x3470('0x5c')]['id'];}_0x74a885[_0x3470('0x5c')][_0x3470('0x66')]=_0x74a885[_0x3470('0x5c')][_0x3470('0x66')]||_0x74a885[_0x3470('0x6e')]['id'];_0x50c877[_0x3470('0x7a')]['id']=_0x74a885[_0x3470('0x5c')][_0x3470('0x66')];return db[_0x3470('0x52')][_0x3470('0x5a')]({'where':{'id':_0x74a885[_0x3470('0x57')]['id'],'UserId':null}})[_0x3470('0x22')](handleEntityNotFound(_0x335ad2,null))[_0x3470('0x22')](function(_0x121fa3){if(_0x121fa3){_0x50c877['message']=_0x121fa3[_0x3470('0x68')]({'plain':!![]});return db['WhatsappInteraction'][_0x3470('0x5a')]({'where':{'id':_0x121fa3[_0x3470('0x69')]}});}return null;})['then'](handleEntityNotFound(_0x335ad2,null))[_0x3470('0x22')](function(_0x1a157a){if(_0x1a157a){_0x50c877['interaction']=_0x1a157a[_0x3470('0x68')]({'plain':!![]});interaction_log['info'](_0x3470('0x7b'),_0x74a885[_0x3470('0x6e')]['id'],_0x74a885['user'][_0x3470('0x3a')],_0x74a885[_0x3470('0x6e')][_0x3470('0x6f')],_0x50c877[_0x3470('0x6c')]['id'],_0x74a885[_0x3470('0x5c')]?JSON[_0x3470('0x70')](_0x74a885[_0x3470('0x5c')]):_0x3470('0x7c'));return respondWithRpcPromise(_0x3470('0x7d'),'rejectMessage',_0x50c877);}return null;})[_0x3470('0x22')](function(_0x1a405e){if(_0x1a405e){_0x1a405e[_0x3470('0x2a')]['interface']=util[_0x3470('0x64')](_0x3470('0x75'),_0x74a885[_0x3470('0x6e')]['name']);_0x1a405e[_0x3470('0x2a')]['channel']=_0x50c877[_0x3470('0x76')];_0x1a405e[_0x3470('0x2a')][_0x3470('0x77')]=_0x3470('0x36');respondWithRpcPromise('EventManager','EventManager',{'event':'rejectmessage','message':_0x1a405e[_0x3470('0x2a')]},client9002);return _0x50c877;}return null;})[_0x3470('0x22')](respondWithResult(_0x335ad2,null))['catch'](handleError(_0x335ad2,null));};exports['status']=function(_0x18591e,_0x415cff,_0x4bd1f4){if(_0x18591e[_0x3470('0x5c')]['id']){delete _0x18591e[_0x3470('0x5c')]['id'];}var _0x4f96ae;return db[_0x3470('0x52')]['find']({'where':{'id':_0x18591e[_0x3470('0x57')]['id']}})[_0x3470('0x22')](handleEntityNotFound(_0x415cff,null))[_0x3470('0x22')](function(_0x44b3e9){if(_0x44b3e9){_0x4f96ae=_0x44b3e9;return db[_0x3470('0x7e')][_0x3470('0x5a')]({'where':{'id':_0x44b3e9['WhatsappAccountId']}});}})[_0x3470('0x22')](handleEntityNotFound(_0x415cff,null))['then'](function(_0x50fdeb){if(_0x50fdeb){logger[_0x3470('0x26')](_0x3470('0x7f'),_0x3470('0x2e'),_0x3470('0x80'),_0x50fdeb['type'],util[_0x3470('0x81')](_0x18591e[_0x3470('0x5c')],{'showHidden':![],'depth':null}));switch(_0x50fdeb['type']){case _0x3470('0x82'):if(_0x18591e['body'][_0x3470('0x83')]&&_0x18591e[_0x3470('0x5c')][_0x3470('0x83')]===_0x4f96ae[_0x3470('0x84')]&&_0x18591e[_0x3470('0x5c')][_0x3470('0x85')]&&_0x18591e[_0x3470('0x5c')][_0x3470('0x85')]==='read'){return _0x4f96ae[_0x3470('0x5d')]({'read':!![]});}else{logger[_0x3470('0x28')](_0x3470('0x86'),_0x3470('0x2e'),_0x3470('0x82'),util[_0x3470('0x81')](_0x18591e[_0x3470('0x5c')],{'showHidden':![],'depth':null}));}break;}return _0x4f96ae;}})[_0x3470('0x22')](respondWithResult(_0x415cff,null))[_0x3470('0x2c')](handleError(_0x415cff,null));}; \ No newline at end of file +var _0xaa92=['format','YYYY-MM-DD\x20HH:mm:ss','UserId','user','Contact','get','WhatsappInteraction','WhatsappInteractionId','isNil','read1stAt','interaction','[WHATSAPPMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','role','AcceptMessage','acceptMessage','manual','interface','SIP/%s','channel','event','EventManager','acceptmessage','reject','[WHATSAPPMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','null','RejectMessage','rejectMessage','rejectmessage','debug','received\x20delivery\x20report\x20from','inspect','MessageSid','messageId','MessageStatus','WhatsappAccount,\x20%s,\x20%s,\x20%s','html-pdf','eml-format','rimraf','moment','bluebird','path','ejs','lodash','squel','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./whatsappMessage.socket','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','info','WhatsappMessage,\x20%s,\x20%s','request\x20sent','WhatsappMessage,\x20%s,\x20%s,\x20%s','stringify','error','message','catch','sendStatus','status','end','offset','limit','set','Content-Range','json','apply','update','then','destroy','stack','name','send','WhatsappMessage','rawAttributes','fieldName','key','map','query','filters','intersection','model','fields','attributes','length','nolimit','order','sort','pick','where','type','VIRTUAL','merge','options','count','includeAll','include','findAll','rows','show','params','keys','find','create','body','describe','whatsapp-interactions','accept','read','readAt'];(function(_0x2641f9,_0x26715f){var _0x585741=function(_0x2d1462){while(--_0x2d1462){_0x2641f9['push'](_0x2641f9['shift']());}};_0x585741(++_0x26715f);}(_0xaa92,0xa0));var _0x2aa9=function(_0x284506,_0x191316){_0x284506=_0x284506-0x0;var _0x1e9ee5=_0xaa92[_0x284506];return _0x1e9ee5;};'use strict';var pdf=require(_0x2aa9('0x0'));var emlformat=require(_0x2aa9('0x1'));var rimraf=require(_0x2aa9('0x2'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x2aa9('0x3'));var BPromise=require(_0x2aa9('0x4'));var Mustache=require('mustache');var util=require('util');var path=require(_0x2aa9('0x5'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x2aa9('0x6'));var fs=require('fs');var _=require(_0x2aa9('0x7'));var squel=require(_0x2aa9('0x8'));var crypto=require('crypto');var jsforce=require(_0x2aa9('0x9'));var deskjs=require(_0x2aa9('0xa'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x2aa9('0xb'));var Redis=require(_0x2aa9('0xc'));var authService=require(_0x2aa9('0xd'));var qs=require(_0x2aa9('0xe'));var as=require(_0x2aa9('0xf'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x2aa9('0x10'))(_0x2aa9('0x11'));var utils=require(_0x2aa9('0x12'));var config=require('../../config/environment');var db=require(_0x2aa9('0x13'))['db'];config[_0x2aa9('0x14')]=_[_0x2aa9('0x15')](config[_0x2aa9('0x14')],{'host':_0x2aa9('0x16'),'port':0x18eb});var socket=require(_0x2aa9('0x17'))(new Redis(config[_0x2aa9('0x14')]));require(_0x2aa9('0x18'))['register'](socket);var jayson=require('jayson/promise');var client=jayson[_0x2aa9('0x19')]['http']({'port':0x232c});var client9002=jayson[_0x2aa9('0x19')]['http']({'port':0x232a});function checkPasswordPattern(_0x5cc84b,_0x241ad3,_0x47b368){if(_0x47b368){var _0x5d0703=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x5d0703['test'](_0x241ad3)){return _0x5cc84b;}else{throw new db[(_0x2aa9('0x1a'))][(_0x2aa9('0x1b'))](_0x2aa9('0x1c'));}}else{return _0x5cc84b;}}function respondWithRpcPromise(_0x337f7c,_0x5818cf,_0x4dd4d0,_0x9eba20){return new BPromise(function(_0x53711d,_0x462dcf){var _0x1887cd=_0x9eba20||client;return _0x1887cd[_0x2aa9('0x1d')](_0x337f7c,_0x4dd4d0)['then'](function(_0x6d788c){logger[_0x2aa9('0x1e')](_0x2aa9('0x1f'),_0x5818cf,_0x2aa9('0x20'));logger['debug'](_0x2aa9('0x21'),_0x5818cf,_0x2aa9('0x20'),JSON[_0x2aa9('0x22')](_0x6d788c));if(_0x6d788c[_0x2aa9('0x23')]){if(_0x6d788c[_0x2aa9('0x23')]['code']===0x1f4){logger[_0x2aa9('0x23')]('WhatsappMessage,\x20%s,\x20%s',_0x5818cf,_0x6d788c[_0x2aa9('0x23')][_0x2aa9('0x24')]);return _0x462dcf(_0x6d788c['error'][_0x2aa9('0x24')]);}logger['error'](_0x2aa9('0x1f'),_0x5818cf,_0x6d788c[_0x2aa9('0x23')][_0x2aa9('0x24')]);return _0x53711d(_0x6d788c[_0x2aa9('0x23')][_0x2aa9('0x24')]);}else{logger['info']('WhatsappMessage,\x20%s,\x20%s',_0x5818cf,_0x2aa9('0x20'));_0x53711d(_0x6d788c['result'][_0x2aa9('0x24')]);}})[_0x2aa9('0x25')](function(_0x2f444a){logger[_0x2aa9('0x23')]('WhatsappMessage,\x20%s,\x20%s',_0x5818cf,_0x2f444a);_0x462dcf(_0x2f444a);});});}function respondWithStatusCode(_0x5b55ef,_0x37c457){_0x37c457=_0x37c457||0xcc;return function(_0x5a859e){if(_0x5a859e){return _0x5b55ef[_0x2aa9('0x26')](_0x37c457);}return _0x5b55ef[_0x2aa9('0x27')](_0x37c457)[_0x2aa9('0x28')]();};}function respondWithResult(_0x518a17,_0x4fcc7f){_0x4fcc7f=_0x4fcc7f||0xc8;return function(_0x4c4735){if(_0x4c4735){return _0x518a17[_0x2aa9('0x27')](_0x4fcc7f)['json'](_0x4c4735);}};}function respondWithFilteredResult(_0x25014b,_0x48eebb){return function(_0x2f7db1){if(_0x2f7db1){var _0x3cc398=_0x2f7db1['count'],_0x38c4b9=_0x48eebb[_0x2aa9('0x29')],_0x22898e=_0x48eebb[_0x2aa9('0x29')]+_0x48eebb[_0x2aa9('0x2a')],_0x196099;if(_0x22898e>=_0x3cc398){_0x22898e=_0x3cc398;_0x196099=0xc8;}else{_0x196099=0xce;}_0x25014b[_0x2aa9('0x27')](_0x196099);return _0x25014b[_0x2aa9('0x2b')](_0x2aa9('0x2c'),_0x38c4b9+'-'+_0x22898e+'/'+_0x3cc398)[_0x2aa9('0x2d')](_0x2f7db1);}return null;};}function patchUpdates(_0x53f4f7){return function(_0x35cf26){try{jsonpatch[_0x2aa9('0x2e')](_0x35cf26,_0x53f4f7,!![]);}catch(_0x35dc3b){return BPromise['reject'](_0x35dc3b);}return _0x35cf26['save']();};}function saveUpdates(_0xa85121,_0x5a5f3e){return function(_0x4f03fc){if(_0x4f03fc){return _0x4f03fc[_0x2aa9('0x2f')](_0xa85121)[_0x2aa9('0x30')](function(_0x4b2136){return _0x4b2136;});}return null;};}function removeEntity(_0x2d2851,_0x419367){return function(_0x1234a5){if(_0x1234a5){return _0x1234a5[_0x2aa9('0x31')]()[_0x2aa9('0x30')](function(){_0x2d2851[_0x2aa9('0x27')](0xcc)[_0x2aa9('0x28')]();});}};}function handleEntityNotFound(_0x44ca5d,_0x576222){return function(_0x345f5d){if(!_0x345f5d){_0x44ca5d[_0x2aa9('0x26')](0x194);}return _0x345f5d;};}function handleError(_0x155b8f,_0x514143){_0x514143=_0x514143||0x1f4;return function(_0x5bdf31){logger[_0x2aa9('0x23')](_0x5bdf31[_0x2aa9('0x32')]);if(_0x5bdf31[_0x2aa9('0x33')]){delete _0x5bdf31['name'];}_0x155b8f[_0x2aa9('0x27')](_0x514143)[_0x2aa9('0x34')](_0x5bdf31);};}exports['index']=function(_0x43f730,_0x5c3992){var _0x1c78d9={},_0x4c6e1a={},_0x26cbe1={'count':0x0,'rows':[]};var _0x1a62b5=_['map'](db[_0x2aa9('0x35')][_0x2aa9('0x36')],function(_0x4199f3){return{'name':_0x4199f3[_0x2aa9('0x37')],'type':_0x4199f3['type'][_0x2aa9('0x38')]};});_0x4c6e1a['model']=_[_0x2aa9('0x39')](_0x1a62b5,_0x2aa9('0x33'));_0x4c6e1a['query']=_['keys'](_0x43f730[_0x2aa9('0x3a')]);_0x4c6e1a[_0x2aa9('0x3b')]=_[_0x2aa9('0x3c')](_0x4c6e1a[_0x2aa9('0x3d')],_0x4c6e1a['query']);_0x1c78d9['attributes']=_[_0x2aa9('0x3c')](_0x4c6e1a[_0x2aa9('0x3d')],qs['fields'](_0x43f730[_0x2aa9('0x3a')][_0x2aa9('0x3e')]));_0x1c78d9[_0x2aa9('0x3f')]=_0x1c78d9[_0x2aa9('0x3f')][_0x2aa9('0x40')]?_0x1c78d9[_0x2aa9('0x3f')]:_0x4c6e1a[_0x2aa9('0x3d')];if(!_0x43f730[_0x2aa9('0x3a')]['hasOwnProperty'](_0x2aa9('0x41'))){_0x1c78d9[_0x2aa9('0x2a')]=qs[_0x2aa9('0x2a')](_0x43f730['query'][_0x2aa9('0x2a')]);_0x1c78d9['offset']=qs[_0x2aa9('0x29')](_0x43f730[_0x2aa9('0x3a')][_0x2aa9('0x29')]);}_0x1c78d9[_0x2aa9('0x42')]=qs[_0x2aa9('0x43')](_0x43f730[_0x2aa9('0x3a')][_0x2aa9('0x43')]);_0x1c78d9['where']=qs[_0x2aa9('0x3b')](_[_0x2aa9('0x44')](_0x43f730[_0x2aa9('0x3a')],_0x4c6e1a['filters']),_0x1a62b5);if(_0x43f730[_0x2aa9('0x3a')]['filter']){_0x1c78d9['where']=_['merge'](_0x1c78d9[_0x2aa9('0x45')],{'$or':_['map'](_0x1a62b5,function(_0x18f348){if(_0x18f348[_0x2aa9('0x46')]!==_0x2aa9('0x47')){var _0x20ab5c={};_0x20ab5c[_0x18f348[_0x2aa9('0x33')]]={'$like':'%'+_0x43f730[_0x2aa9('0x3a')]['filter']+'%'};return _0x20ab5c;}})});}_0x1c78d9=_[_0x2aa9('0x48')]({},_0x1c78d9,_0x43f730[_0x2aa9('0x49')]);var _0x305857={'where':_0x1c78d9[_0x2aa9('0x45')]};return db[_0x2aa9('0x35')][_0x2aa9('0x4a')](_0x305857)[_0x2aa9('0x30')](function(_0x6e06bc){_0x26cbe1[_0x2aa9('0x4a')]=_0x6e06bc;if(_0x43f730[_0x2aa9('0x3a')][_0x2aa9('0x4b')]){_0x1c78d9[_0x2aa9('0x4c')]=[{'all':!![]}];}return db[_0x2aa9('0x35')][_0x2aa9('0x4d')](_0x1c78d9);})['then'](function(_0x56020d){_0x26cbe1[_0x2aa9('0x4e')]=_0x56020d;return _0x26cbe1;})[_0x2aa9('0x30')](respondWithFilteredResult(_0x5c3992,_0x1c78d9))[_0x2aa9('0x25')](handleError(_0x5c3992,null));};exports[_0x2aa9('0x4f')]=function(_0x3dc2b2,_0x3080dd){var _0x2fe3c7={'raw':!![],'where':{'id':_0x3dc2b2[_0x2aa9('0x50')]['id']}},_0x1249eb={};_0x1249eb[_0x2aa9('0x3d')]=_[_0x2aa9('0x51')](db['WhatsappMessage'][_0x2aa9('0x36')]);_0x1249eb[_0x2aa9('0x3a')]=_[_0x2aa9('0x51')](_0x3dc2b2[_0x2aa9('0x3a')]);_0x1249eb[_0x2aa9('0x3b')]=_[_0x2aa9('0x3c')](_0x1249eb[_0x2aa9('0x3d')],_0x1249eb[_0x2aa9('0x3a')]);_0x2fe3c7[_0x2aa9('0x3f')]=_[_0x2aa9('0x3c')](_0x1249eb[_0x2aa9('0x3d')],qs[_0x2aa9('0x3e')](_0x3dc2b2[_0x2aa9('0x3a')][_0x2aa9('0x3e')]));_0x2fe3c7[_0x2aa9('0x3f')]=_0x2fe3c7['attributes'][_0x2aa9('0x40')]?_0x2fe3c7[_0x2aa9('0x3f')]:_0x1249eb[_0x2aa9('0x3d')];if(_0x3dc2b2[_0x2aa9('0x3a')]['includeAll']){_0x2fe3c7[_0x2aa9('0x4c')]=[{'all':!![]}];}_0x2fe3c7=_[_0x2aa9('0x48')]({},_0x2fe3c7,_0x3dc2b2['options']);return db[_0x2aa9('0x35')][_0x2aa9('0x52')](_0x2fe3c7)['then'](handleEntityNotFound(_0x3080dd,null))[_0x2aa9('0x30')](respondWithResult(_0x3080dd,null))[_0x2aa9('0x25')](handleError(_0x3080dd,null));};exports[_0x2aa9('0x53')]=function(_0x70574a,_0x168766){return db[_0x2aa9('0x35')][_0x2aa9('0x53')](_0x70574a['body'],{})[_0x2aa9('0x30')](respondWithResult(_0x168766,0xc9))['catch'](handleError(_0x168766,null));};exports[_0x2aa9('0x2f')]=function(_0x1c9737,_0x5a56e9){if(_0x1c9737[_0x2aa9('0x54')]['id']){delete _0x1c9737['body']['id'];}return db[_0x2aa9('0x35')][_0x2aa9('0x52')]({'where':{'id':_0x1c9737[_0x2aa9('0x50')]['id']}})[_0x2aa9('0x30')](handleEntityNotFound(_0x5a56e9,null))['then'](saveUpdates(_0x1c9737['body'],null))[_0x2aa9('0x30')](respondWithResult(_0x5a56e9,null))[_0x2aa9('0x25')](handleError(_0x5a56e9,null));};exports[_0x2aa9('0x31')]=function(_0x2e65a3,_0x5b0c8b){return db[_0x2aa9('0x35')][_0x2aa9('0x52')]({'where':{'id':_0x2e65a3[_0x2aa9('0x50')]['id']}})[_0x2aa9('0x30')](handleEntityNotFound(_0x5b0c8b,null))[_0x2aa9('0x30')](removeEntity(_0x5b0c8b,null))['catch'](handleError(_0x5b0c8b,null));};exports[_0x2aa9('0x55')]=function(_0x13d1d9,_0x275768){return db[_0x2aa9('0x35')]['describe']()[_0x2aa9('0x30')](respondWithResult(_0x275768,null))[_0x2aa9('0x25')](handleError(_0x275768,null));};var interaction_log=require('../../config/logger')(_0x2aa9('0x56'));exports[_0x2aa9('0x57')]=function(_0xafb76d,_0x343ddb,_0xe631ea){var _0x56cc77={'channel':'whatsapp'};if(_0xafb76d[_0x2aa9('0x54')]['id']){delete _0xafb76d[_0x2aa9('0x54')]['id'];}_0xafb76d[_0x2aa9('0x54')][_0x2aa9('0x58')]=!![];_0xafb76d[_0x2aa9('0x54')][_0x2aa9('0x59')]=moment()[_0x2aa9('0x5a')](_0x2aa9('0x5b'));_0xafb76d[_0x2aa9('0x54')][_0x2aa9('0x5c')]=_0xafb76d['body'][_0x2aa9('0x5c')]||_0xafb76d[_0x2aa9('0x5d')]['id'];return db['WhatsappMessage']['find']({'where':{'id':_0xafb76d[_0x2aa9('0x50')]['id'],'UserId':null},'include':[{'model':db['CmContact'],'as':_0x2aa9('0x5e')}]})[_0x2aa9('0x30')](handleEntityNotFound(_0x343ddb,null))[_0x2aa9('0x30')](saveUpdates(_0xafb76d['body'],null))['then'](function(_0xda43b4){if(_0xda43b4){_0x56cc77[_0x2aa9('0x24')]=_0xda43b4[_0x2aa9('0x5f')]({'plain':!![]});return db[_0x2aa9('0x60')][_0x2aa9('0x52')]({'where':{'id':_0xda43b4[_0x2aa9('0x61')]}});}return null;})['then'](handleEntityNotFound(_0x343ddb,null))[_0x2aa9('0x30')](function(_0x4e1e64){if(_0x4e1e64){return _0x4e1e64[_0x2aa9('0x2f')]({'UserId':_0xafb76d['body'][_0x2aa9('0x5c')],'read1stAt':_[_0x2aa9('0x62')](_0x4e1e64[_0x2aa9('0x63')])?moment()[_0x2aa9('0x5a')](_0x2aa9('0x5b')):undefined});}return null;})[_0x2aa9('0x30')](function(_0xd52aae){if(_0xd52aae){_0x56cc77[_0x2aa9('0x64')]=_0xd52aae[_0x2aa9('0x5f')]({'plain':!![]});interaction_log[_0x2aa9('0x1e')](_0x2aa9('0x65'),_0xafb76d[_0x2aa9('0x5d')]['id'],_0xafb76d[_0x2aa9('0x5d')][_0x2aa9('0x33')],_0xafb76d['user'][_0x2aa9('0x66')],_0x56cc77['interaction']['id'],_0xafb76d[_0x2aa9('0x54')]?JSON['stringify'](_0xafb76d['body']):'null');return respondWithRpcPromise(_0x2aa9('0x67'),_0x2aa9('0x68'),_0x56cc77);}return null;})[_0x2aa9('0x30')](function(_0x111318){if(_0x111318){if(_0xafb76d['body'][_0x2aa9('0x69')]){_0x56cc77[_0x2aa9('0x24')][_0x2aa9('0x6a')]=util[_0x2aa9('0x5a')](_0x2aa9('0x6b'),_0xafb76d[_0x2aa9('0x5d')][_0x2aa9('0x33')]);_0x56cc77[_0x2aa9('0x24')][_0x2aa9('0x6c')]=_0x56cc77[_0x2aa9('0x6c')];_0x56cc77[_0x2aa9('0x24')][_0x2aa9('0x6d')]=_0x2aa9('0x57');return respondWithRpcPromise('EventManager',_0x2aa9('0x6e'),{'event':_0x2aa9('0x6f'),'message':_0x56cc77[_0x2aa9('0x24')]},client9002)[_0x2aa9('0x30')](function(){return _0x56cc77;});}return _0x56cc77;}return null;})['then'](respondWithResult(_0x343ddb,null))['catch'](handleError(_0x343ddb,null));};var interaction_log=require(_0x2aa9('0x10'))(_0x2aa9('0x56'));exports[_0x2aa9('0x70')]=function(_0x32f256,_0x1bfc62,_0x340d3d){var _0x2f4a7e={'agent':{},'channel':'whatsapp'};if(_0x32f256[_0x2aa9('0x54')]['id']){delete _0x32f256[_0x2aa9('0x54')]['id'];}_0x32f256[_0x2aa9('0x54')][_0x2aa9('0x5c')]=_0x32f256[_0x2aa9('0x54')][_0x2aa9('0x5c')]||_0x32f256[_0x2aa9('0x5d')]['id'];_0x2f4a7e['agent']['id']=_0x32f256[_0x2aa9('0x54')][_0x2aa9('0x5c')];return db[_0x2aa9('0x35')][_0x2aa9('0x52')]({'where':{'id':_0x32f256[_0x2aa9('0x50')]['id'],'UserId':null}})['then'](handleEntityNotFound(_0x1bfc62,null))['then'](function(_0x178599){if(_0x178599){_0x2f4a7e['message']=_0x178599[_0x2aa9('0x5f')]({'plain':!![]});return db['WhatsappInteraction']['find']({'where':{'id':_0x178599[_0x2aa9('0x61')]}});}return null;})[_0x2aa9('0x30')](handleEntityNotFound(_0x1bfc62,null))['then'](function(_0x4affd7){if(_0x4affd7){_0x2f4a7e['interaction']=_0x4affd7[_0x2aa9('0x5f')]({'plain':!![]});interaction_log[_0x2aa9('0x1e')](_0x2aa9('0x71'),_0x32f256[_0x2aa9('0x5d')]['id'],_0x32f256[_0x2aa9('0x5d')][_0x2aa9('0x33')],_0x32f256[_0x2aa9('0x5d')][_0x2aa9('0x66')],_0x2f4a7e[_0x2aa9('0x64')]['id'],_0x32f256[_0x2aa9('0x54')]?JSON['stringify'](_0x32f256['body']):_0x2aa9('0x72'));return respondWithRpcPromise(_0x2aa9('0x73'),_0x2aa9('0x74'),_0x2f4a7e);}return null;})['then'](function(_0x1c2933){if(_0x1c2933){_0x1c2933[_0x2aa9('0x24')][_0x2aa9('0x6a')]=util['format'](_0x2aa9('0x6b'),_0x32f256[_0x2aa9('0x5d')][_0x2aa9('0x33')]);_0x1c2933[_0x2aa9('0x24')]['channel']=_0x2f4a7e['channel'];_0x1c2933[_0x2aa9('0x24')][_0x2aa9('0x6d')]=_0x2aa9('0x70');respondWithRpcPromise('EventManager',_0x2aa9('0x6e'),{'event':_0x2aa9('0x75'),'message':_0x1c2933[_0x2aa9('0x24')]},client9002);return _0x2f4a7e;}return null;})['then'](respondWithResult(_0x1bfc62,null))[_0x2aa9('0x25')](handleError(_0x1bfc62,null));};exports[_0x2aa9('0x27')]=function(_0x5b6626,_0xff9b1f,_0x3c6e6f){if(_0x5b6626[_0x2aa9('0x54')]['id']){delete _0x5b6626['body']['id'];}var _0xe67d98;return db[_0x2aa9('0x35')][_0x2aa9('0x52')]({'where':{'id':_0x5b6626['params']['id']}})[_0x2aa9('0x30')](handleEntityNotFound(_0xff9b1f,null))[_0x2aa9('0x30')](function(_0x518406){if(_0x518406){_0xe67d98=_0x518406;return db['WhatsappAccount'][_0x2aa9('0x52')]({'where':{'id':_0x518406['WhatsappAccountId']}});}})[_0x2aa9('0x30')](handleEntityNotFound(_0xff9b1f,null))['then'](function(_0x1fa585){if(_0x1fa585){logger[_0x2aa9('0x76')]('WhatsppMessage,\x20%s,\x20%s,\x20%s',_0x2aa9('0x27'),_0x2aa9('0x77'),_0x1fa585[_0x2aa9('0x46')],util[_0x2aa9('0x78')](_0x5b6626[_0x2aa9('0x54')],{'showHidden':![],'depth':null}));switch(_0x1fa585[_0x2aa9('0x46')]){case'twilio':if(_0x5b6626[_0x2aa9('0x54')][_0x2aa9('0x79')]&&_0x5b6626['body'][_0x2aa9('0x79')]===_0xe67d98[_0x2aa9('0x7a')]&&_0x5b6626[_0x2aa9('0x54')][_0x2aa9('0x7b')]&&_0x5b6626[_0x2aa9('0x54')][_0x2aa9('0x7b')]===_0x2aa9('0x58')){return _0xe67d98['update']({'read':!![]});}else{logger[_0x2aa9('0x23')](_0x2aa9('0x7c'),'status','twilio',util[_0x2aa9('0x78')](_0x5b6626[_0x2aa9('0x54')],{'showHidden':![],'depth':null}));}break;}return _0xe67d98;}})[_0x2aa9('0x30')](respondWithResult(_0xff9b1f,null))[_0x2aa9('0x25')](handleError(_0xff9b1f,null));}; \ No newline at end of file diff --git a/server/api/whatsappMessage/whatsappMessage.events.js b/server/api/whatsappMessage/whatsappMessage.events.js index b44afc6..e0fe1f7 100644 --- a/server/api/whatsappMessage/whatsappMessage.events.js +++ b/server/api/whatsappMessage/whatsappMessage.events.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xb10b=['hasOwnProperty','hook','events','WhatsappMessage','setMaxListeners','save','remove','emit'];(function(_0x25e947,_0x34e45a){var _0x4135b8=function(_0x32dd97){while(--_0x32dd97){_0x25e947['push'](_0x25e947['shift']());}};_0x4135b8(++_0x34e45a);}(_0xb10b,0x12a));var _0xbb10=function(_0x19aaa9,_0x9d0bb6){_0x19aaa9=_0x19aaa9-0x0;var _0x465463=_0xb10b[_0x19aaa9];return _0x465463;};'use strict';var EventEmitter=require(_0xbb10('0x0'));var WhatsappMessage=require('../../mysqldb')['db'][_0xbb10('0x1')];var WhatsappMessageEvents=new EventEmitter();WhatsappMessageEvents[_0xbb10('0x2')](0x0);var events={'afterCreate':_0xbb10('0x3'),'afterUpdate':'update','afterDestroy':_0xbb10('0x4')};function emitEvent(_0x9bbed){return function(_0x460981,_0x22320e,_0x49baf4){WhatsappMessageEvents[_0xbb10('0x5')](_0x9bbed+':'+_0x460981['id'],_0x460981);WhatsappMessageEvents['emit'](_0x9bbed,_0x460981);_0x49baf4(null);};}for(var e in events){if(events[_0xbb10('0x6')](e)){var event=events[e];WhatsappMessage[_0xbb10('0x7')](e,emitEvent(event));}}module['exports']=WhatsappMessageEvents; \ No newline at end of file +var _0x5f2f=['remove','emit','hasOwnProperty','hook','exports','events','../../mysqldb','WhatsappMessage','setMaxListeners','save','update'];(function(_0x55b195,_0x28579a){var _0x5ab313=function(_0x25963c){while(--_0x25963c){_0x55b195['push'](_0x55b195['shift']());}};_0x5ab313(++_0x28579a);}(_0x5f2f,0x73));var _0xf5f2=function(_0x236b98,_0x18bf71){_0x236b98=_0x236b98-0x0;var _0x3358a8=_0x5f2f[_0x236b98];return _0x3358a8;};'use strict';var EventEmitter=require(_0xf5f2('0x0'));var WhatsappMessage=require(_0xf5f2('0x1'))['db'][_0xf5f2('0x2')];var WhatsappMessageEvents=new EventEmitter();WhatsappMessageEvents[_0xf5f2('0x3')](0x0);var events={'afterCreate':_0xf5f2('0x4'),'afterUpdate':_0xf5f2('0x5'),'afterDestroy':_0xf5f2('0x6')};function emitEvent(_0x107cf){return function(_0x501fbd,_0x4854b6,_0x1665c7){WhatsappMessageEvents[_0xf5f2('0x7')](_0x107cf+':'+_0x501fbd['id'],_0x501fbd);WhatsappMessageEvents[_0xf5f2('0x7')](_0x107cf,_0x501fbd);_0x1665c7(null);};}for(var e in events){if(events[_0xf5f2('0x8')](e)){var event=events[e];WhatsappMessage[_0xf5f2('0x9')](e,emitEvent(event));}}module[_0xf5f2('0xa')]=WhatsappMessageEvents; \ No newline at end of file diff --git a/server/api/whatsappMessage/whatsappMessage.model.js b/server/api/whatsappMessage/whatsappMessage.model.js index 650be73..b44a9ad 100644 --- a/server/api/whatsappMessage/whatsappMessage.model.js +++ b/server/api/whatsappMessage/whatsappMessage.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x6716=['../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','define','WhatsappMessage','messageId','fti_whatsapp_messages','body','FULLTEXT','models','direction','toLowerCase','out','secret','isNil','UserId','then','update','createdAt','error','WhatsappAccount','find','WhatsappAccountId','type','twilio','authToken','phone','accountSid','messages','create','whatsapp:','/api/whatsapp/messages/','/status?token=','token','sid','catch','WhatsappMessage,\x20%s,\x20%s,\x20%s','inspect','afterCreate','finally','utf8mb4','lodash','util'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x6716,0x11e));var _0x6671=function(_0x442b7c,_0x2bda10){_0x442b7c=_0x442b7c-0x0;var _0x289a67=_0x6716[_0x442b7c];return _0x289a67;};'use strict';var _=require(_0x6671('0x0'));var util=require(_0x6671('0x1'));var logger=require(_0x6671('0x2'))(_0x6671('0x3'));var moment=require(_0x6671('0x4'));var BPromise=require(_0x6671('0x5'));var rp=require(_0x6671('0x6'));var fs=require('fs');var path=require(_0x6671('0x7'));var rimraf=require(_0x6671('0x8'));var config=require(_0x6671('0x9'));var attributes=require('./whatsappMessage.attributes');module['exports']=function(_0x383a68,_0x408193){return _0x383a68[_0x6671('0xa')](_0x6671('0xb'),attributes,{'tableName':'whatsapp_messages','paranoid':![],'indexes':[{'name':_0x6671('0xc'),'fields':[_0x6671('0xc')]},{'name':_0x6671('0xd'),'fields':[_0x6671('0xe')],'type':_0x6671('0xf')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x4838fb,_0x1fbbd0,_0x5d40ca){var _0x27022a=_0x383a68[_0x6671('0x10')];var _0xb7c86=_0x4838fb['get']({'plain':!![]});if(_0xb7c86[_0x6671('0x11')][_0x6671('0x12')]()==='in'||_0xb7c86['direction'][_0x6671('0x12')]()===_0x6671('0x13')&&!_0xb7c86[_0x6671('0x14')]&&!_[_0x6671('0x15')](_0xb7c86[_0x6671('0x16')])){_0x27022a['WhatsappInteraction']['findOne']({'where':{'id':_0xb7c86['WhatsappInteractionId']}})[_0x6671('0x17')](function(_0x3be6f2){if(_0x3be6f2){_0x3be6f2[_0x6671('0x18')]({'lastMsgAt':_0xb7c86[_0x6671('0x19')],'lastMsgDirection':_0xb7c86[_0x6671('0x11')][_0x6671('0x12')]()});}})['catch'](function(_0x591cac){console[_0x6671('0x1a')](_0x591cac);});}if(_0xb7c86[_0x6671('0x11')]==='out'&&!_0xb7c86[_0x6671('0x14')]){var _0x162001;_0x27022a[_0x6671('0x1b')][_0x6671('0x1c')]({'where':{'id':_0xb7c86[_0x6671('0x1d')]},'raw':!![]})[_0x6671('0x17')](function(_0x5343b0){_0x162001=_0x5343b0;if(_0x162001&&_0x162001['type']){switch(_0x162001[_0x6671('0x1e')]){case _0x6671('0x1f'):var _0x1fec3d=require(_0x6671('0x1f'));if(_0x162001['accountSid']&&_0x162001[_0x6671('0x20')]&&_0x162001[_0x6671('0x21')]){var _0x26e014=new _0x1fec3d(_0x162001[_0x6671('0x22')],_0x162001[_0x6671('0x20')]);_0x26e014[_0x6671('0x23')][_0x6671('0x24')]({'body':_0xb7c86[_0x6671('0xe')],'to':_0x6671('0x25')+_0xb7c86[_0x6671('0x21')],'from':_0x6671('0x25')+_0x162001[_0x6671('0x21')],'statusCallback':_0x162001['remote']+_0x6671('0x26')+_0xb7c86['id']+_0x6671('0x27')+_0x162001[_0x6671('0x28')]})[_0x6671('0x17')](function(_0x58f7c5){if(_0x58f7c5[_0x6671('0x29')]){return _0x4838fb[_0x6671('0x18')]({'messageId':_0x58f7c5[_0x6671('0x29')]});}})[_0x6671('0x2a')](function(_0x15e82e){logger[_0x6671('0x1a')](_0x6671('0x2b'),'afterCreate',_0x6671('0x1f'),util[_0x6671('0x2c')](_0x15e82e,{'showHidden':![],'depth':null}));});}else{logger['error'](_0x6671('0x2b'),_0x6671('0x2d'),'twilio','Missing\x20parameters:\x20phone,\x20accountSid\x20or\x20authToken');}break;}}})[_0x6671('0x2e')](function(){_0x5d40ca();});}else{_0x5d40ca();}}},'charset':_0x6671('0x2f'),'collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file +var _0x059c=['WhatsappMessage,\x20%s,\x20%s,\x20%s','afterCreate','Missing\x20parameters:\x20phone,\x20accountSid\x20or\x20authToken','finally','utf8mb4_unicode_ci','../../config/logger','api','moment','bluebird','request-promise','path','./whatsappMessage.attributes','exports','define','whatsapp_messages','messageId','fti_whatsapp_messages','body','FULLTEXT','models','direction','toLowerCase','out','secret','isNil','UserId','WhatsappInteraction','findOne','WhatsappInteractionId','then','createdAt','catch','error','find','WhatsappAccountId','type','twilio','authToken','phone','accountSid','messages','whatsapp:','remote','/api/whatsapp/messages/','/status?token=','token','sid','update'];(function(_0x154983,_0xc29edf){var _0x3d1243=function(_0x5cb7a4){while(--_0x5cb7a4){_0x154983['push'](_0x154983['shift']());}};_0x3d1243(++_0xc29edf);}(_0x059c,0xf5));var _0xc059=function(_0x30cd7e,_0x4db10a){_0x30cd7e=_0x30cd7e-0x0;var _0x462a02=_0x059c[_0x30cd7e];return _0x462a02;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0xc059('0x0'))(_0xc059('0x1'));var moment=require(_0xc059('0x2'));var BPromise=require(_0xc059('0x3'));var rp=require(_0xc059('0x4'));var fs=require('fs');var path=require(_0xc059('0x5'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0xc059('0x6'));module[_0xc059('0x7')]=function(_0xfa2044,_0x420a29){return _0xfa2044[_0xc059('0x8')]('WhatsappMessage',attributes,{'tableName':_0xc059('0x9'),'paranoid':![],'indexes':[{'name':_0xc059('0xa'),'fields':['messageId']},{'name':_0xc059('0xb'),'fields':[_0xc059('0xc')],'type':_0xc059('0xd')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x3145e4,_0x565b57,_0x145933){var _0x1bb81a=_0xfa2044[_0xc059('0xe')];var _0x5eeb66=_0x3145e4['get']({'plain':!![]});if(_0x5eeb66[_0xc059('0xf')][_0xc059('0x10')]()==='in'||_0x5eeb66[_0xc059('0xf')][_0xc059('0x10')]()===_0xc059('0x11')&&!_0x5eeb66[_0xc059('0x12')]&&!_[_0xc059('0x13')](_0x5eeb66[_0xc059('0x14')])){_0x1bb81a[_0xc059('0x15')][_0xc059('0x16')]({'where':{'id':_0x5eeb66[_0xc059('0x17')]}})[_0xc059('0x18')](function(_0x28824b){if(_0x28824b){_0x28824b['update']({'lastMsgAt':_0x5eeb66[_0xc059('0x19')],'lastMsgDirection':_0x5eeb66[_0xc059('0xf')]['toLowerCase']()});}})[_0xc059('0x1a')](function(_0x67af18){console[_0xc059('0x1b')](_0x67af18);});}if(_0x5eeb66[_0xc059('0xf')]===_0xc059('0x11')&&!_0x5eeb66[_0xc059('0x12')]){var _0x157574;_0x1bb81a['WhatsappAccount'][_0xc059('0x1c')]({'where':{'id':_0x5eeb66[_0xc059('0x1d')]},'raw':!![]})[_0xc059('0x18')](function(_0x3497fc){_0x157574=_0x3497fc;if(_0x157574&&_0x157574[_0xc059('0x1e')]){switch(_0x157574[_0xc059('0x1e')]){case _0xc059('0x1f'):var _0xcb6c3d=require(_0xc059('0x1f'));if(_0x157574['accountSid']&&_0x157574[_0xc059('0x20')]&&_0x157574[_0xc059('0x21')]){var _0x3f7083=new _0xcb6c3d(_0x157574[_0xc059('0x22')],_0x157574[_0xc059('0x20')]);_0x3f7083[_0xc059('0x23')]['create']({'body':_0x5eeb66[_0xc059('0xc')],'to':'whatsapp:'+_0x5eeb66[_0xc059('0x21')],'from':_0xc059('0x24')+_0x157574['phone'],'statusCallback':_0x157574[_0xc059('0x25')]+_0xc059('0x26')+_0x5eeb66['id']+_0xc059('0x27')+_0x157574[_0xc059('0x28')]})[_0xc059('0x18')](function(_0x462105){if(_0x462105[_0xc059('0x29')]){return _0x3145e4[_0xc059('0x2a')]({'messageId':_0x462105[_0xc059('0x29')]});}})[_0xc059('0x1a')](function(_0x31bef2){logger[_0xc059('0x1b')](_0xc059('0x2b'),_0xc059('0x2c'),'twilio',util['inspect'](_0x31bef2,{'showHidden':![],'depth':null}));});}else{logger['error'](_0xc059('0x2b'),'afterCreate',_0xc059('0x1f'),_0xc059('0x2d'));}break;}}})[_0xc059('0x2e')](function(){_0x145933();});}else{_0x145933();}}},'charset':'utf8mb4','collate':_0xc059('0x2f')});}; \ No newline at end of file diff --git a/server/api/whatsappMessage/whatsappMessage.rpc.js b/server/api/whatsappMessage/whatsappMessage.rpc.js index 6249886..1f254b2 100644 --- a/server/api/whatsappMessage/whatsappMessage.rpc.js +++ b/server/api/whatsappMessage/whatsappMessage.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x3580=['rpc','../../config/environment','client','http','redis','localhost','socket.io-emitter','request','then','info','WhatsappMessage,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','CreateWhatsappMessage','WhatsappMessage','create','body','options','raw','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger'];(function(_0x45e7a0,_0x18b2c3){var _0x42d2cd=function(_0x757271){while(--_0x757271){_0x45e7a0['push'](_0x45e7a0['shift']());}};_0x42d2cd(++_0x18b2c3);}(_0x3580,0x1b8));var _0x0358=function(_0x122835,_0x5bf3c2){_0x122835=_0x122835-0x0;var _0x5ef7ab=_0x3580[_0x122835];return _0x5ef7ab;};'use strict';var _=require(_0x0358('0x0'));var util=require(_0x0358('0x1'));var moment=require(_0x0358('0x2'));var BPromise=require(_0x0358('0x3'));var rs=require(_0x0358('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x0358('0x5'))['db'];var utils=require(_0x0358('0x6'));var logger=require(_0x0358('0x7'))(_0x0358('0x8'));var config=require(_0x0358('0x9'));var jayson=require('jayson/promise');var client=jayson[_0x0358('0xa')][_0x0358('0xb')]({'port':0x232a});config['redis']=_['defaults'](config[_0x0358('0xc')],{'host':_0x0358('0xd'),'port':0x18eb});var socket=require(_0x0358('0xe'))(new Redis(config[_0x0358('0xc')]));require('./whatsappMessage.socket')['register'](socket);function respondWithRpcPromise(_0x200940,_0x1e56b0,_0x10e518){return new BPromise(function(_0x2677d5,_0x535039){return client[_0x0358('0xf')](_0x200940,_0x10e518)[_0x0358('0x10')](function(_0x205229){logger[_0x0358('0x11')](_0x0358('0x12'),_0x1e56b0,_0x0358('0x13'));logger['debug']('WhatsappMessage,\x20%s,\x20%s,\x20%s',_0x1e56b0,_0x0358('0x13'),JSON[_0x0358('0x14')](_0x205229));if(_0x205229['error']){if(_0x205229[_0x0358('0x15')][_0x0358('0x16')]===0x1f4){logger[_0x0358('0x15')](_0x0358('0x12'),_0x1e56b0,_0x205229[_0x0358('0x15')]['message']);return _0x535039(_0x205229[_0x0358('0x15')][_0x0358('0x17')]);}logger['error'](_0x0358('0x12'),_0x1e56b0,_0x205229[_0x0358('0x15')][_0x0358('0x17')]);return _0x2677d5(_0x205229[_0x0358('0x15')][_0x0358('0x17')]);}else{logger[_0x0358('0x11')](_0x0358('0x12'),_0x1e56b0,_0x0358('0x13'));_0x2677d5(_0x205229[_0x0358('0x18')][_0x0358('0x17')]);}})[_0x0358('0x19')](function(_0x552fa4){logger['error'](_0x0358('0x12'),_0x1e56b0,_0x552fa4);_0x535039(_0x552fa4);});});}exports[_0x0358('0x1a')]=function(_0x298d93){var _0x389bd4=this;return new Promise(function(_0x6da8ad,_0x453ffa){return db[_0x0358('0x1b')][_0x0358('0x1c')](_0x298d93[_0x0358('0x1d')],{'raw':_0x298d93[_0x0358('0x1e')]?_0x298d93['options'][_0x0358('0x1f')]===undefined?!![]:![]:!![]})[_0x0358('0x10')](function(_0x4aceae){logger[_0x0358('0x11')](_0x0358('0x1a'),_0x298d93);logger['debug'](_0x0358('0x1a'),_0x298d93,JSON[_0x0358('0x14')](_0x4aceae));_0x6da8ad(_0x4aceae);})[_0x0358('0x19')](function(_0x5f3f80){logger['error'](_0x0358('0x1a'),_0x5f3f80[_0x0358('0x17')],_0x298d93);_0x453ffa(_0x389bd4['error'](0x1f4,_0x5f3f80[_0x0358('0x17')]));});});}; \ No newline at end of file +var _0x306d=['body','options','raw','debug','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','redis','defaults','localhost','socket.io-emitter','request','then','info','WhatsappMessage,\x20%s,\x20%s','request\x20sent','WhatsappMessage,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','CreateWhatsappMessage','WhatsappMessage','create'];(function(_0x5365d5,_0x51aa66){var _0x1d3d0e=function(_0x3d1e01){while(--_0x3d1e01){_0x5365d5['push'](_0x5365d5['shift']());}};_0x1d3d0e(++_0x51aa66);}(_0x306d,0xfc));var _0xd306=function(_0x4f71e1,_0x2d38f7){_0x4f71e1=_0x4f71e1-0x0;var _0x2eb26b=_0x306d[_0x4f71e1];return _0x2eb26b;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0xd306('0x0'));var BPromise=require('bluebird');var rs=require(_0xd306('0x1'));var fs=require('fs');var Redis=require(_0xd306('0x2'));var db=require(_0xd306('0x3'))['db'];var utils=require(_0xd306('0x4'));var logger=require(_0xd306('0x5'))(_0xd306('0x6'));var config=require(_0xd306('0x7'));var jayson=require('jayson/promise');var client=jayson[_0xd306('0x8')]['http']({'port':0x232a});config[_0xd306('0x9')]=_[_0xd306('0xa')](config[_0xd306('0x9')],{'host':_0xd306('0xb'),'port':0x18eb});var socket=require(_0xd306('0xc'))(new Redis(config[_0xd306('0x9')]));require('./whatsappMessage.socket')['register'](socket);function respondWithRpcPromise(_0x59e98e,_0x191290,_0xe0c27b){return new BPromise(function(_0x183863,_0x52c705){return client[_0xd306('0xd')](_0x59e98e,_0xe0c27b)[_0xd306('0xe')](function(_0x1daaca){logger[_0xd306('0xf')](_0xd306('0x10'),_0x191290,_0xd306('0x11'));logger['debug'](_0xd306('0x12'),_0x191290,_0xd306('0x11'),JSON[_0xd306('0x13')](_0x1daaca));if(_0x1daaca[_0xd306('0x14')]){if(_0x1daaca[_0xd306('0x14')]['code']===0x1f4){logger[_0xd306('0x14')]('WhatsappMessage,\x20%s,\x20%s',_0x191290,_0x1daaca[_0xd306('0x14')][_0xd306('0x15')]);return _0x52c705(_0x1daaca[_0xd306('0x14')][_0xd306('0x15')]);}logger['error'](_0xd306('0x10'),_0x191290,_0x1daaca[_0xd306('0x14')]['message']);return _0x183863(_0x1daaca['error']['message']);}else{logger[_0xd306('0xf')]('WhatsappMessage,\x20%s,\x20%s',_0x191290,'request\x20sent');_0x183863(_0x1daaca[_0xd306('0x16')][_0xd306('0x15')]);}})[_0xd306('0x17')](function(_0x3b5457){logger['error'](_0xd306('0x10'),_0x191290,_0x3b5457);_0x52c705(_0x3b5457);});});}exports[_0xd306('0x18')]=function(_0x453045){var _0x204703=this;return new Promise(function(_0x302a8b,_0xea63ae){return db[_0xd306('0x19')][_0xd306('0x1a')](_0x453045[_0xd306('0x1b')],{'raw':_0x453045['options']?_0x453045[_0xd306('0x1c')][_0xd306('0x1d')]===undefined?!![]:![]:!![]})[_0xd306('0xe')](function(_0x34ff0d){logger[_0xd306('0xf')](_0xd306('0x18'),_0x453045);logger[_0xd306('0x1e')](_0xd306('0x18'),_0x453045,JSON['stringify'](_0x34ff0d));_0x302a8b(_0x34ff0d);})[_0xd306('0x17')](function(_0x7a5765){logger['error']('CreateWhatsappMessage',_0x7a5765[_0xd306('0x15')],_0x453045);_0xea63ae(_0x204703[_0xd306('0x14')](0x1f4,_0x7a5765['message']));});});}; \ No newline at end of file diff --git a/server/api/whatsappMessage/whatsappMessage.socket.js b/server/api/whatsappMessage/whatsappMessage.socket.js index a02f728..97035b4 100644 --- a/server/api/whatsappMessage/whatsappMessage.socket.js +++ b/server/api/whatsappMessage/whatsappMessage.socket.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xfd8e=['removeListener','register','length','whatsappMessage:','./whatsappMessage.events','remove','update','emit'];(function(_0x3c22c7,_0x3f9f86){var _0x795901=function(_0x240511){while(--_0x240511){_0x3c22c7['push'](_0x3c22c7['shift']());}};_0x795901(++_0x3f9f86);}(_0xfd8e,0x1dc));var _0xefd8=function(_0x248412,_0x2a69da){_0x248412=_0x248412-0x0;var _0x59b733=_0xfd8e[_0x248412];return _0x59b733;};'use strict';var WhatsappMessageEvents=require(_0xefd8('0x0'));var events=['save',_0xefd8('0x1'),_0xefd8('0x2')];function createListener(_0x5c43fc,_0x1fe626){return function(_0x187161){_0x1fe626[_0xefd8('0x3')](_0x5c43fc,_0x187161);};}function removeListener(_0x969115,_0x4319f0){return function(){WhatsappMessageEvents[_0xefd8('0x4')](_0x969115,_0x4319f0);};}exports[_0xefd8('0x5')]=function(_0x83fdcd){for(var _0x365c57=0x0,_0x477efa=events[_0xefd8('0x6')];_0x365c57<_0x477efa;_0x365c57++){var _0x21c9f4=events[_0x365c57];var _0x1e8e72=createListener(_0xefd8('0x7')+_0x21c9f4,_0x83fdcd);WhatsappMessageEvents['on'](_0x21c9f4,_0x1e8e72);}}; \ No newline at end of file +var _0x8c47=['./whatsappMessage.events','save','remove','update','emit','length','whatsappMessage:'];(function(_0x59c301,_0x359c50){var _0x3866b9=function(_0x2d380e){while(--_0x2d380e){_0x59c301['push'](_0x59c301['shift']());}};_0x3866b9(++_0x359c50);}(_0x8c47,0x69));var _0x78c4=function(_0x17b6e3,_0x4522ed){_0x17b6e3=_0x17b6e3-0x0;var _0x3906f3=_0x8c47[_0x17b6e3];return _0x3906f3;};'use strict';var WhatsappMessageEvents=require(_0x78c4('0x0'));var events=[_0x78c4('0x1'),_0x78c4('0x2'),_0x78c4('0x3')];function createListener(_0x1b6605,_0x55260a){return function(_0x4273b1){_0x55260a[_0x78c4('0x4')](_0x1b6605,_0x4273b1);};}function removeListener(_0x2979d6,_0x5d243b){return function(){WhatsappMessageEvents['removeListener'](_0x2979d6,_0x5d243b);};}exports['register']=function(_0x3624ce){for(var _0x49580d=0x0,_0x5bada7=events[_0x78c4('0x5')];_0x49580d<_0x5bada7;_0x49580d++){var _0x5195ff=events[_0x49580d];var _0x590587=createListener(_0x78c4('0x6')+_0x5195ff,_0x3624ce);WhatsappMessageEvents['on'](_0x5195ff,_0x590587);}}; \ No newline at end of file diff --git a/server/api/whatsappQueue/index.js b/server/api/whatsappQueue/index.js index e5958f8..8d8ea3c 100644 --- a/server/api/whatsappQueue/index.js +++ b/server/api/whatsappQueue/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x55ea=['../../config/environment','isAuthenticated','index','get','/describe','describe','/:id/members','/:id/teams','getTeams','getAgents','post','addTeams','addAgents','put','delete','/:id','destroy','removeTeams','removeAgents','exports','util','path','express','../../components/auth/service','../../components/interaction/service'];(function(_0x8b631b,_0x386724){var _0x3e6832=function(_0x17a132){while(--_0x17a132){_0x8b631b['push'](_0x8b631b['shift']());}};_0x3e6832(++_0x386724);}(_0x55ea,0x172));var _0xa55e=function(_0x37cd64,_0x2ea740){_0x37cd64=_0x37cd64-0x0;var _0x21c01c=_0x55ea[_0x37cd64];return _0x21c01c;};'use strict';var multer=require('multer');var util=require(_0xa55e('0x0'));var path=require(_0xa55e('0x1'));var timeout=require('connect-timeout');var express=require(_0xa55e('0x2'));var router=express['Router']();var auth=require(_0xa55e('0x3'));var interaction=require(_0xa55e('0x4'));var config=require(_0xa55e('0x5'));var controller=require('./whatsappQueue.controller');router['get']('/',auth[_0xa55e('0x6')](),controller[_0xa55e('0x7')]);router[_0xa55e('0x8')](_0xa55e('0x9'),auth[_0xa55e('0x6')](),controller[_0xa55e('0xa')]);router[_0xa55e('0x8')]('/:id',auth['isAuthenticated'](),controller['show']);router[_0xa55e('0x8')](_0xa55e('0xb'),auth[_0xa55e('0x6')](),controller['getMembers']);router[_0xa55e('0x8')](_0xa55e('0xc'),auth[_0xa55e('0x6')](),controller[_0xa55e('0xd')]);router[_0xa55e('0x8')]('/:id/users',auth[_0xa55e('0x6')](),controller[_0xa55e('0xe')]);router['post']('/',auth[_0xa55e('0x6')](),controller['create']);router[_0xa55e('0xf')](_0xa55e('0xc'),auth[_0xa55e('0x6')](),controller[_0xa55e('0x10')]);router['post']('/:id/users',auth[_0xa55e('0x6')](),controller[_0xa55e('0x11')]);router[_0xa55e('0x12')]('/:id',auth[_0xa55e('0x6')](),controller['update']);router[_0xa55e('0x13')](_0xa55e('0x14'),auth[_0xa55e('0x6')](),controller[_0xa55e('0x15')]);router[_0xa55e('0x13')](_0xa55e('0xc'),auth['isAuthenticated'](),controller[_0xa55e('0x16')]);router['delete']('/:id/users',auth['isAuthenticated'](),controller[_0xa55e('0x17')]);module[_0xa55e('0x18')]=router; \ No newline at end of file +var _0x8da9=['getAgents','post','addTeams','/:id/users','addAgents','update','destroy','delete','removeTeams','removeAgents','exports','util','path','connect-timeout','express','Router','../../components/auth/service','../../config/environment','./whatsappQueue.controller','isAuthenticated','index','describe','/:id','show','/:id/members','getMembers','/:id/teams','getTeams'];(function(_0x386525,_0xefae6){var _0x14d015=function(_0x4a45c1){while(--_0x4a45c1){_0x386525['push'](_0x386525['shift']());}};_0x14d015(++_0xefae6);}(_0x8da9,0x177));var _0x98da=function(_0x4f6c62,_0x4e0267){_0x4f6c62=_0x4f6c62-0x0;var _0x4f6d3e=_0x8da9[_0x4f6c62];return _0x4f6d3e;};'use strict';var multer=require('multer');var util=require(_0x98da('0x0'));var path=require(_0x98da('0x1'));var timeout=require(_0x98da('0x2'));var express=require(_0x98da('0x3'));var router=express[_0x98da('0x4')]();var auth=require(_0x98da('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x98da('0x6'));var controller=require(_0x98da('0x7'));router['get']('/',auth[_0x98da('0x8')](),controller[_0x98da('0x9')]);router['get']('/describe',auth['isAuthenticated'](),controller[_0x98da('0xa')]);router['get'](_0x98da('0xb'),auth[_0x98da('0x8')](),controller[_0x98da('0xc')]);router['get'](_0x98da('0xd'),auth[_0x98da('0x8')](),controller[_0x98da('0xe')]);router['get'](_0x98da('0xf'),auth[_0x98da('0x8')](),controller[_0x98da('0x10')]);router['get']('/:id/users',auth[_0x98da('0x8')](),controller[_0x98da('0x11')]);router[_0x98da('0x12')]('/',auth[_0x98da('0x8')](),controller['create']);router['post'](_0x98da('0xf'),auth[_0x98da('0x8')](),controller[_0x98da('0x13')]);router[_0x98da('0x12')](_0x98da('0x14'),auth[_0x98da('0x8')](),controller[_0x98da('0x15')]);router['put'](_0x98da('0xb'),auth[_0x98da('0x8')](),controller[_0x98da('0x16')]);router['delete']('/:id',auth[_0x98da('0x8')](),controller[_0x98da('0x17')]);router[_0x98da('0x18')]('/:id/teams',auth[_0x98da('0x8')](),controller[_0x98da('0x19')]);router[_0x98da('0x18')](_0x98da('0x14'),auth[_0x98da('0x8')](),controller[_0x98da('0x1a')]);module[_0x98da('0x1b')]=router; \ No newline at end of file diff --git a/server/api/whatsappQueue/whatsappQueue.attributes.js b/server/api/whatsappQueue/whatsappQueue.attributes.js index 5bd6c78..7c83e63 100644 --- a/server/api/whatsappQueue/whatsappQueue.attributes.js +++ b/server/api/whatsappQueue/whatsappQueue.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x4e7e=['rrmemory','beepall','roundrobin','INTEGER','ENUM'];(function(_0x7a3247,_0x15cb12){var _0x1bfde5=function(_0x62bbef){while(--_0x62bbef){_0x7a3247['push'](_0x7a3247['shift']());}};_0x1bfde5(++_0x15cb12);}(_0x4e7e,0x1d9));var _0xe4e7=function(_0x1c0ef1,_0x4a445e){_0x1c0ef1=_0x1c0ef1-0x0;var _0x18d25d=_0x4e7e[_0x1c0ef1];return _0x18d25d;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize['STRING'],'unique':'name','validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'timeout':{'type':Sequelize[_0xe4e7('0x0')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0xe4e7('0x1')](_0xe4e7('0x2'),_0xe4e7('0x3'),_0xe4e7('0x4'))},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x4854=['exports','rrmemory','roundrobin','STRING','sequelize'];(function(_0x58afd5,_0x534a48){var _0x3e503b=function(_0x27ba44){while(--_0x27ba44){_0x58afd5['push'](_0x58afd5['shift']());}};_0x3e503b(++_0x534a48);}(_0x4854,0xb8));var _0x4485=function(_0x3ff085,_0x27c92e){_0x3ff085=_0x3ff085-0x0;var _0x2b68c3=_0x4854[_0x3ff085];return _0x2b68c3;};'use strict';var Sequelize=require(_0x4485('0x0'));module[_0x4485('0x1')]={'name':{'type':Sequelize['STRING'],'unique':'name','validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'timeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize['ENUM'](_0x4485('0x2'),'beepall',_0x4485('0x3'))},'description':{'type':Sequelize[_0x4485('0x4')]}}; \ No newline at end of file diff --git a/server/api/whatsappQueue/whatsappQueue.controller.js b/server/api/whatsappQueue/whatsappQueue.controller.js index b51cff2..952a20e 100644 --- a/server/api/whatsappQueue/whatsappQueue.controller.js +++ b/server/api/whatsappQueue/whatsappQueue.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xd2e6=['socket.io-emitter','sendStatus','status','end','json','count','offset','limit','apply','save','then','destroy','get','WhatsappQueues','UserProfileResource','stack','name','send','index','map','rawAttributes','fieldName','type','key','model','keys','filters','intersection','query','attributes','fields','hasOwnProperty','order','sort','where','pick','filter','merge','options','WhatsappQueue','includeAll','include','rows','catch','show','params','length','find','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','update','describe','getMembers','findOne','nolimit','WhatsappQueueId','findAll','User','findAndCountAll','UserId','agent','whatsappPause','updatedAt','createdAt','%s/%s','SIP','Team','getTeams','addTeams','ids','Agents','online','interface','flatMap','transaction','each','UserWhatsappQueue','forEach','emit','userWhatsappQueue:save','removeTeams','field','tq.TeamId','from','team_has_whatsapp_queues','join','user_has_teams','WhatsappQueueId\x20=\x20?','clone','sequelize','QueryTypes','SELECT','every','TeamId','includes','all','union','compact','value','isEmpty','removeAgents','addAgents','omit','spread','isArray','userWhatsappQueue:remove','getAgents','eml-format','fast-json-patch','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','redis','defaults','localhost'];(function(_0x1ee4ff,_0x1cacb9){var _0x2f331c=function(_0xe0a306){while(--_0xe0a306){_0x1ee4ff['push'](_0x1ee4ff['shift']());}};_0x2f331c(++_0x1cacb9);}(_0xd2e6,0x70));var _0x6d2e=function(_0x329be1,_0x302daf){_0x329be1=_0x329be1-0x0;var _0x55c9a2=_0xd2e6[_0x329be1];return _0x55c9a2;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x6d2e('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x6d2e('0x1'));var rp=require(_0x6d2e('0x2'));var moment=require(_0x6d2e('0x3'));var BPromise=require(_0x6d2e('0x4'));var Mustache=require(_0x6d2e('0x5'));var util=require(_0x6d2e('0x6'));var path=require(_0x6d2e('0x7'));var sox=require(_0x6d2e('0x8'));var csv=require(_0x6d2e('0x9'));var ejs=require('ejs');var fs=require('fs');var _=require('lodash');var squel=require('squel');var crypto=require(_0x6d2e('0xa'));var jsforce=require(_0x6d2e('0xb'));var deskjs=require(_0x6d2e('0xc'));var toCsv=require(_0x6d2e('0x9'));var querystring=require(_0x6d2e('0xd'));var Papa=require('papaparse');var Redis=require(_0x6d2e('0xe'));var authService=require(_0x6d2e('0xf'));var qs=require(_0x6d2e('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x6d2e('0x11'));var logger=require(_0x6d2e('0x12'))(_0x6d2e('0x13'));var utils=require(_0x6d2e('0x14'));var config=require(_0x6d2e('0x15'));var db=require('../../mysqldb')['db'];config[_0x6d2e('0x16')]=_[_0x6d2e('0x17')](config[_0x6d2e('0x16')],{'host':_0x6d2e('0x18'),'port':0x18eb});var socket=require(_0x6d2e('0x19'))(new Redis(config['redis']));require('./whatsappQueue.socket')['register'](socket);function respondWithStatusCode(_0x3b034a,_0x4b955f){_0x4b955f=_0x4b955f||0xcc;return function(_0x2b2a34){if(_0x2b2a34){return _0x3b034a[_0x6d2e('0x1a')](_0x4b955f);}return _0x3b034a[_0x6d2e('0x1b')](_0x4b955f)[_0x6d2e('0x1c')]();};}function respondWithResult(_0x15d7e9,_0x5e292d){_0x5e292d=_0x5e292d||0xc8;return function(_0x409259){if(_0x409259){return _0x15d7e9[_0x6d2e('0x1b')](_0x5e292d)[_0x6d2e('0x1d')](_0x409259);}};}function respondWithFilteredResult(_0x506b1a,_0x4a8c5f){return function(_0x4074b3){if(_0x4074b3){var _0x1ed1fb=_0x4074b3[_0x6d2e('0x1e')],_0x3f3cb2=_0x4a8c5f[_0x6d2e('0x1f')],_0x1ea104=_0x4a8c5f[_0x6d2e('0x1f')]+_0x4a8c5f[_0x6d2e('0x20')],_0x462ab0;if(_0x1ea104>=_0x1ed1fb){_0x1ea104=_0x1ed1fb;_0x462ab0=0xc8;}else{_0x462ab0=0xce;}_0x506b1a[_0x6d2e('0x1b')](_0x462ab0);return _0x506b1a['set']('Content-Range',_0x3f3cb2+'-'+_0x1ea104+'/'+_0x1ed1fb)[_0x6d2e('0x1d')](_0x4074b3);}return null;};}function patchUpdates(_0x1eace9){return function(_0x1aaba6){try{jsonpatch[_0x6d2e('0x21')](_0x1aaba6,_0x1eace9,!![]);}catch(_0x496b43){return BPromise['reject'](_0x496b43);}return _0x1aaba6[_0x6d2e('0x22')]();};}function saveUpdates(_0x31a4d7,_0x32baaa){return function(_0x22ca12){if(_0x22ca12){return _0x22ca12['update'](_0x31a4d7)[_0x6d2e('0x23')](function(_0x22f84d){return _0x22f84d;});}return null;};}function removeEntity(_0x26e7cb,_0x594416){return function(_0x4763d2){if(_0x4763d2){return _0x4763d2[_0x6d2e('0x24')]()[_0x6d2e('0x23')](function(){var _0x51832a=_0x4763d2[_0x6d2e('0x25')]({'plain':!![]});var _0xf02c9b=_0x6d2e('0x26');return db[_0x6d2e('0x27')][_0x6d2e('0x24')]({'where':{'type':_0xf02c9b,'resourceId':_0x51832a['id']}})[_0x6d2e('0x23')](function(){return _0x4763d2;});})[_0x6d2e('0x23')](function(){_0x26e7cb[_0x6d2e('0x1b')](0xcc)['end']();});}};}function handleEntityNotFound(_0xc46d6e,_0x54fc1c){return function(_0x1b1d0c){if(!_0x1b1d0c){_0xc46d6e['sendStatus'](0x194);}return _0x1b1d0c;};}function handleError(_0x575808,_0x10b340){_0x10b340=_0x10b340||0x1f4;return function(_0x36f640){logger['error'](_0x36f640[_0x6d2e('0x28')]);if(_0x36f640[_0x6d2e('0x29')]){delete _0x36f640[_0x6d2e('0x29')];}_0x575808['status'](_0x10b340)[_0x6d2e('0x2a')](_0x36f640);};}exports[_0x6d2e('0x2b')]=function(_0x43882b,_0x7e4408){var _0x227feb={},_0x534e93={},_0x5cb595={'count':0x0,'rows':[]};var _0x352869=_[_0x6d2e('0x2c')](db['WhatsappQueue'][_0x6d2e('0x2d')],function(_0x1df1c6){return{'name':_0x1df1c6[_0x6d2e('0x2e')],'type':_0x1df1c6[_0x6d2e('0x2f')][_0x6d2e('0x30')]};});_0x534e93[_0x6d2e('0x31')]=_[_0x6d2e('0x2c')](_0x352869,_0x6d2e('0x29'));_0x534e93['query']=_[_0x6d2e('0x32')](_0x43882b['query']);_0x534e93[_0x6d2e('0x33')]=_[_0x6d2e('0x34')](_0x534e93[_0x6d2e('0x31')],_0x534e93[_0x6d2e('0x35')]);_0x227feb[_0x6d2e('0x36')]=_[_0x6d2e('0x34')](_0x534e93[_0x6d2e('0x31')],qs[_0x6d2e('0x37')](_0x43882b['query']['fields']));_0x227feb['attributes']=_0x227feb[_0x6d2e('0x36')]['length']?_0x227feb[_0x6d2e('0x36')]:_0x534e93['model'];if(!_0x43882b[_0x6d2e('0x35')][_0x6d2e('0x38')]('nolimit')){_0x227feb[_0x6d2e('0x20')]=qs[_0x6d2e('0x20')](_0x43882b[_0x6d2e('0x35')][_0x6d2e('0x20')]);_0x227feb[_0x6d2e('0x1f')]=qs['offset'](_0x43882b[_0x6d2e('0x35')][_0x6d2e('0x1f')]);}_0x227feb[_0x6d2e('0x39')]=qs['sort'](_0x43882b[_0x6d2e('0x35')][_0x6d2e('0x3a')]);_0x227feb[_0x6d2e('0x3b')]=qs[_0x6d2e('0x33')](_[_0x6d2e('0x3c')](_0x43882b[_0x6d2e('0x35')],_0x534e93[_0x6d2e('0x33')]),_0x352869);if(_0x43882b['query'][_0x6d2e('0x3d')]){_0x227feb[_0x6d2e('0x3b')]=_[_0x6d2e('0x3e')](_0x227feb['where'],{'$or':_['map'](_0x352869,function(_0x290037){if(_0x290037['type']!=='VIRTUAL'){var _0x4830a0={};_0x4830a0[_0x290037['name']]={'$like':'%'+_0x43882b[_0x6d2e('0x35')][_0x6d2e('0x3d')]+'%'};return _0x4830a0;}})});}_0x227feb=_['merge']({},_0x227feb,_0x43882b[_0x6d2e('0x3f')]);var _0x48752c={'where':_0x227feb[_0x6d2e('0x3b')]};return db[_0x6d2e('0x40')][_0x6d2e('0x1e')](_0x48752c)[_0x6d2e('0x23')](function(_0x1c520c){_0x5cb595[_0x6d2e('0x1e')]=_0x1c520c;if(_0x43882b[_0x6d2e('0x35')][_0x6d2e('0x41')]){_0x227feb[_0x6d2e('0x42')]=[{'all':!![]}];}return db[_0x6d2e('0x40')]['findAll'](_0x227feb);})[_0x6d2e('0x23')](function(_0x285682){_0x5cb595[_0x6d2e('0x43')]=_0x285682;return _0x5cb595;})[_0x6d2e('0x23')](respondWithFilteredResult(_0x7e4408,_0x227feb))[_0x6d2e('0x44')](handleError(_0x7e4408,null));};exports[_0x6d2e('0x45')]=function(_0x320d30,_0x3722c1){var _0x1b33c3={'raw':!![],'where':{'id':_0x320d30[_0x6d2e('0x46')]['id']}},_0x438587={};_0x438587[_0x6d2e('0x31')]=_[_0x6d2e('0x32')](db[_0x6d2e('0x40')][_0x6d2e('0x2d')]);_0x438587[_0x6d2e('0x35')]=_[_0x6d2e('0x32')](_0x320d30[_0x6d2e('0x35')]);_0x438587[_0x6d2e('0x33')]=_[_0x6d2e('0x34')](_0x438587[_0x6d2e('0x31')],_0x438587[_0x6d2e('0x35')]);_0x1b33c3[_0x6d2e('0x36')]=_['intersection'](_0x438587[_0x6d2e('0x31')],qs[_0x6d2e('0x37')](_0x320d30[_0x6d2e('0x35')]['fields']));_0x1b33c3[_0x6d2e('0x36')]=_0x1b33c3[_0x6d2e('0x36')][_0x6d2e('0x47')]?_0x1b33c3[_0x6d2e('0x36')]:_0x438587[_0x6d2e('0x31')];if(_0x320d30[_0x6d2e('0x35')][_0x6d2e('0x41')]){_0x1b33c3[_0x6d2e('0x42')]=[{'all':!![]}];}_0x1b33c3=_['merge']({},_0x1b33c3,_0x320d30[_0x6d2e('0x3f')]);return db[_0x6d2e('0x40')][_0x6d2e('0x48')](_0x1b33c3)['then'](handleEntityNotFound(_0x3722c1,null))[_0x6d2e('0x23')](respondWithResult(_0x3722c1,null))[_0x6d2e('0x44')](handleError(_0x3722c1,null));};exports[_0x6d2e('0x49')]=function(_0x5894bf,_0x47d948){return db[_0x6d2e('0x40')][_0x6d2e('0x49')](_0x5894bf[_0x6d2e('0x4a')],{})[_0x6d2e('0x23')](function(_0x2295c1){var _0x200ba2=_0x5894bf['user'][_0x6d2e('0x25')]({'plain':!![]});if(!_0x200ba2)throw new Error(_0x6d2e('0x4b'));if(_0x200ba2[_0x6d2e('0x4c')]==='user'){var _0x5dccc6=_0x2295c1[_0x6d2e('0x25')]({'plain':!![]});var _0x9b5a1f=_0x6d2e('0x26');return db[_0x6d2e('0x4d')]['find']({'where':{'name':_0x9b5a1f,'userProfileId':_0x200ba2[_0x6d2e('0x4e')]},'raw':!![]})[_0x6d2e('0x23')](function(_0x3877fb){if(_0x3877fb&&_0x3877fb[_0x6d2e('0x4f')]===0x0){return db[_0x6d2e('0x27')][_0x6d2e('0x49')]({'name':_0x5dccc6['name'],'resourceId':_0x5dccc6['id'],'type':_0x3877fb[_0x6d2e('0x29')],'sectionId':_0x3877fb['id']},{})['then'](function(){return _0x2295c1;});}else{return _0x2295c1;}})[_0x6d2e('0x44')](function(_0x659f95){logger['error']('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x659f95);throw _0x659f95;});}return _0x2295c1;})['then'](respondWithResult(_0x47d948,0xc9))['catch'](handleError(_0x47d948,null));};exports[_0x6d2e('0x50')]=function(_0x4242e1,_0x5f5545){if(_0x4242e1['body']['id']){delete _0x4242e1[_0x6d2e('0x4a')]['id'];}return db[_0x6d2e('0x40')][_0x6d2e('0x48')]({'where':{'id':_0x4242e1[_0x6d2e('0x46')]['id']}})['then'](handleEntityNotFound(_0x5f5545,null))[_0x6d2e('0x23')](saveUpdates(_0x4242e1[_0x6d2e('0x4a')],null))[_0x6d2e('0x23')](respondWithResult(_0x5f5545,null))[_0x6d2e('0x44')](handleError(_0x5f5545,null));};exports[_0x6d2e('0x24')]=function(_0x5b2b3c,_0x534a9c){return db['WhatsappQueue'][_0x6d2e('0x48')]({'where':{'id':_0x5b2b3c[_0x6d2e('0x46')]['id']}})['then'](handleEntityNotFound(_0x534a9c,null))[_0x6d2e('0x23')](removeEntity(_0x534a9c,null))[_0x6d2e('0x44')](handleError(_0x534a9c,null));};exports[_0x6d2e('0x51')]=function(_0x350e69,_0x134243){return db['WhatsappQueue']['describe']()[_0x6d2e('0x23')](respondWithResult(_0x134243,null))[_0x6d2e('0x44')](handleError(_0x134243,null));};exports[_0x6d2e('0x52')]=function(_0xdcab5f,_0x205227,_0x482526){var _0x40d814={'raw':!![],'where':{}},_0x4f8bbc={},_0x5a5fcb;return db[_0x6d2e('0x40')][_0x6d2e('0x53')]({'where':{'id':_0xdcab5f[_0x6d2e('0x46')]['id']}})[_0x6d2e('0x23')](handleEntityNotFound(_0x205227,null))[_0x6d2e('0x23')](function(_0x226d8c){if(_0x226d8c){_0x5a5fcb=_0x226d8c[_0x6d2e('0x25')]({'plain':!![]});_0x4f8bbc[_0x6d2e('0x31')]=_[_0x6d2e('0x32')](db['UserWhatsappQueue'][_0x6d2e('0x2d')]);_0x4f8bbc[_0x6d2e('0x35')]=_['keys'](_0xdcab5f[_0x6d2e('0x35')]);_0x4f8bbc[_0x6d2e('0x33')]=_[_0x6d2e('0x34')](_0x4f8bbc[_0x6d2e('0x31')],_0x4f8bbc[_0x6d2e('0x35')]);_0x40d814[_0x6d2e('0x36')]=_[_0x6d2e('0x34')](_0x4f8bbc['model'],qs['fields'](_0xdcab5f['query'][_0x6d2e('0x37')]));_0x40d814[_0x6d2e('0x36')]=_0x40d814[_0x6d2e('0x36')]['length']?_0x40d814[_0x6d2e('0x36')]:_0x4f8bbc[_0x6d2e('0x31')];if(!_0xdcab5f[_0x6d2e('0x35')][_0x6d2e('0x38')](_0x6d2e('0x54'))){_0x40d814[_0x6d2e('0x20')]=qs[_0x6d2e('0x20')](_0xdcab5f[_0x6d2e('0x35')][_0x6d2e('0x20')]);_0x40d814['offset']=qs[_0x6d2e('0x1f')](_0xdcab5f[_0x6d2e('0x35')][_0x6d2e('0x1f')]);}_0x40d814['order']=qs[_0x6d2e('0x3a')](_0xdcab5f['query'][_0x6d2e('0x3a')]);_0x40d814[_0x6d2e('0x3b')]=qs[_0x6d2e('0x33')](_[_0x6d2e('0x3c')](_0xdcab5f[_0x6d2e('0x35')],_0x4f8bbc['filters']));_0x40d814[_0x6d2e('0x3b')][_0x6d2e('0x55')]=_0x226d8c['id'];if(_0xdcab5f['query']['filter']){_0x40d814[_0x6d2e('0x3b')]=_[_0x6d2e('0x3e')](_0x40d814[_0x6d2e('0x3b')],{'$or':_[_0x6d2e('0x2c')](_0x40d814[_0x6d2e('0x36')],function(_0x4ac2c6){var _0x26877d={};_0x26877d[_0x4ac2c6]={'$like':'%'+_0xdcab5f[_0x6d2e('0x35')][_0x6d2e('0x3d')]+'%'};return _0x26877d;})});}_0x40d814=_[_0x6d2e('0x3e')]({},_0x40d814,_0xdcab5f['options']);return db['UserWhatsappQueue'][_0x6d2e('0x56')](_0x40d814);}})[_0x6d2e('0x23')](function(_0x818e94){if(_0x818e94){return db[_0x6d2e('0x57')][_0x6d2e('0x58')]({'where':{'id':_['map'](_0x818e94,_0x6d2e('0x59')),'role':_0x6d2e('0x5a')},'attributes':['id',_0x6d2e('0x29'),_0x6d2e('0x5b'),_0x6d2e('0x5c'),_0x6d2e('0x5d')]});}})[_0x6d2e('0x23')](function(_0x41c0c1){if(_0x41c0c1){return{'count':_0x41c0c1['count'],'rows':_[_0x6d2e('0x2c')](_0x41c0c1['rows'],function(_0x238ea6){return{'membername':_0x238ea6[_0x6d2e('0x29')],'UserId':_0x238ea6['id'],'queue_name':_0x5a5fcb[_0x6d2e('0x29')],'WhatsappQueueId':_0x5a5fcb['id'],'interface':util['format'](_0x6d2e('0x5e'),_0x6d2e('0x5f'),_0x238ea6['name']),'penalty':0x0,'paused':_0x238ea6[_0x6d2e('0x5b')],'createdAt':_0x238ea6[_0x6d2e('0x5d')],'updatedAt':_0x238ea6[_0x6d2e('0x5c')]};})};}else{return{'count':0x0,'rows':[]};}})[_0x6d2e('0x23')](respondWithFilteredResult(_0x205227,_0x40d814))[_0x6d2e('0x44')](handleError(_0x205227,null));};exports['getTeams']=function(_0x35763c,_0x1e1449,_0xcd3ada){var _0x26e106={};var _0x2096c4={};var _0x47324b;var _0xbb735b;return db['WhatsappQueue'][_0x6d2e('0x53')]({'where':{'id':_0x35763c['params']['id']}})[_0x6d2e('0x23')](handleEntityNotFound(_0x1e1449,null))[_0x6d2e('0x23')](function(_0xaed011){if(_0xaed011){_0x47324b=_0xaed011;_0x2096c4[_0x6d2e('0x31')]=_[_0x6d2e('0x32')](db[_0x6d2e('0x60')][_0x6d2e('0x2d')]);_0x2096c4[_0x6d2e('0x35')]=_[_0x6d2e('0x32')](_0x35763c[_0x6d2e('0x35')]);_0x2096c4[_0x6d2e('0x33')]=_[_0x6d2e('0x34')](_0x2096c4[_0x6d2e('0x31')],_0x2096c4['query']);_0x26e106['attributes']=_[_0x6d2e('0x34')](_0x2096c4['model'],qs['fields'](_0x35763c[_0x6d2e('0x35')]['fields']));_0x26e106[_0x6d2e('0x36')]=_0x26e106['attributes']['length']?_0x26e106[_0x6d2e('0x36')]:_0x2096c4[_0x6d2e('0x31')];_0x26e106[_0x6d2e('0x39')]=qs[_0x6d2e('0x3a')](_0x35763c[_0x6d2e('0x35')][_0x6d2e('0x3a')]);_0x26e106[_0x6d2e('0x3b')]=qs[_0x6d2e('0x33')](_[_0x6d2e('0x3c')](_0x35763c[_0x6d2e('0x35')],_0x2096c4['filters']));if(_0x35763c[_0x6d2e('0x35')][_0x6d2e('0x3d')]){_0x26e106[_0x6d2e('0x3b')]=_[_0x6d2e('0x3e')](_0x26e106[_0x6d2e('0x3b')],{'$or':_[_0x6d2e('0x2c')](_0x26e106[_0x6d2e('0x36')],function(_0x432782){var _0x4268cf={};_0x4268cf[_0x432782]={'$like':'%'+_0x35763c[_0x6d2e('0x35')][_0x6d2e('0x3d')]+'%'};return _0x4268cf;})});}_0x26e106=_[_0x6d2e('0x3e')]({},_0x26e106,_0x35763c[_0x6d2e('0x3f')]);return _0x47324b[_0x6d2e('0x61')](_0x26e106);}})[_0x6d2e('0x23')](function(_0x377c49){if(_0x377c49){_0xbb735b=_0x377c49[_0x6d2e('0x47')];if(!_0x35763c[_0x6d2e('0x35')][_0x6d2e('0x38')](_0x6d2e('0x54'))){_0x26e106['limit']=qs[_0x6d2e('0x20')](_0x35763c[_0x6d2e('0x35')][_0x6d2e('0x20')]);_0x26e106[_0x6d2e('0x1f')]=qs[_0x6d2e('0x1f')](_0x35763c[_0x6d2e('0x35')]['offset']);}return _0x47324b[_0x6d2e('0x61')](_0x26e106);}})[_0x6d2e('0x23')](function(_0x1c8140){if(_0x1c8140){return _0x1c8140?{'count':_0xbb735b,'rows':_0x1c8140}:null;}})['then'](respondWithResult(_0x1e1449,null))[_0x6d2e('0x44')](handleError(_0x1e1449,null));};exports[_0x6d2e('0x62')]=function(_0xe11593,_0x59aef8,_0x19e808){var _0x3cf7e7=_0xe11593[_0x6d2e('0x4a')][_0x6d2e('0x63')];return db[_0x6d2e('0x60')][_0x6d2e('0x56')]({'where':{'id':_0x3cf7e7},'attributes':['id'],'include':[{'model':db[_0x6d2e('0x57')],'as':_0x6d2e('0x64'),'attributes':['id','name',_0x6d2e('0x65'),'voicePause',_0x6d2e('0x66')],'raw':!![]}]})['then'](function(_0x359610){if(_0x359610){var _0xf3ac1b=_[_0x6d2e('0x67')](_0x359610,function(_0x23e381){var _0x2e66f9=_0x23e381[_0x6d2e('0x25')]({'plain':!![]});return _0x2e66f9[_0x6d2e('0x64')];});return db[_0x6d2e('0x40')][_0x6d2e('0x48')]({'where':{'id':_0xe11593[_0x6d2e('0x46')]['id']}})[_0x6d2e('0x23')](function(_0x47ea2e){return db['sequelize'][_0x6d2e('0x68')](function(_0x39da54){return _0x47ea2e[_0x6d2e('0x62')](_0x3cf7e7,{'transaction':_0x39da54})[_0x6d2e('0x23')](function(){return BPromise[_0x6d2e('0x69')](_0xf3ac1b,function(_0x5f22fe){return db[_0x6d2e('0x6a')]['findOrCreate']({'where':{'UserId':_0x5f22fe['id'],'WhatsappQueueId':_0xe11593[_0x6d2e('0x46')]['id']},'transaction':_0x39da54});});})[_0x6d2e('0x23')](function(){_0xf3ac1b[_0x6d2e('0x6b')](function(_0x20311e){socket[_0x6d2e('0x6c')](_0x6d2e('0x6d'),{'UserId':_0x20311e['id'],'WhatsappQueueId':_0x47ea2e['id']});});});});});}})[_0x6d2e('0x23')](respondWithStatusCode(_0x59aef8,null))[_0x6d2e('0x44')](handleError(_0x59aef8,null));};exports[_0x6d2e('0x6e')]=function(_0x2fd0e7,_0x41bdf9,_0x5cd87e){return db[_0x6d2e('0x60')][_0x6d2e('0x56')]({'where':{'id':_0x2fd0e7['query'][_0x6d2e('0x63')]},'attributes':['id'],'include':[{'model':db['User'],'as':_0x6d2e('0x64'),'attributes':['id'],'raw':!![]}]})[_0x6d2e('0x23')](handleEntityNotFound(_0x41bdf9,null))[_0x6d2e('0x23')](function(_0x2da9bc){var _0x4f7148=_['map'](_0x2da9bc,'id');var _0x32c146=[];var _0x5967fd=[];var _0x3ddf12=squel['select']();_0x3ddf12[_0x6d2e('0x6f')](_0x6d2e('0x70'))[_0x6d2e('0x71')](_0x6d2e('0x72'),'tq')[_0x6d2e('0x73')](_0x6d2e('0x74'),'ut','ut.TeamId\x20=\x20tq.TeamId')[_0x6d2e('0x3b')](_0x6d2e('0x75'),_0x2fd0e7['params']['id']);for(var _0x237def=0x0;_0x237def<_0x2da9bc[_0x6d2e('0x47')];_0x237def+=0x1){let _0x5bb940=_0x2da9bc[_0x237def];for(var _0x184aed=0x0;_0x184aed<_0x5bb940[_0x6d2e('0x64')][_0x6d2e('0x47')];_0x184aed+=0x1){let _0x34ae73=_0x5bb940['Agents'][_0x184aed];var _0xe1854a=_0x3ddf12[_0x6d2e('0x76')]();_0xe1854a[_0x6d2e('0x3b')]('ut.UserId\x20=\x20?',_0x34ae73['id']);_0x5967fd['push'](db[_0x6d2e('0x77')][_0x6d2e('0x35')](_0xe1854a['toString'](),{'type':db[_0x6d2e('0x77')][_0x6d2e('0x78')][_0x6d2e('0x79')]})[_0x6d2e('0x23')](function(_0x5787b2){if(_0x5787b2[_0x6d2e('0x47')]===0x1){return _0x34ae73['id'];}else{var _0x2cd403=_[_0x6d2e('0x7a')](_['map'](_0x5787b2,_0x6d2e('0x7b')),function(_0x1f8af8){return _[_0x6d2e('0x7c')](_0x4f7148,_0x1f8af8);});if(_0x2cd403){return _0x34ae73['id'];}}}));}}return BPromise[_0x6d2e('0x7d')](_0x5967fd)[_0x6d2e('0x23')](function(_0x3d03ac){_0x32c146=_(_0x32c146)[_0x6d2e('0x7e')](_0x3d03ac)[_0x6d2e('0x7f')]()[_0x6d2e('0x80')]();return db[_0x6d2e('0x40')]['find']({'where':{'id':_0x2fd0e7[_0x6d2e('0x46')]['id']}})[_0x6d2e('0x23')](function(_0x51db51){return db[_0x6d2e('0x77')][_0x6d2e('0x68')](function(_0x5cdd1f){return _0x51db51[_0x6d2e('0x6e')](_0x2fd0e7[_0x6d2e('0x35')][_0x6d2e('0x63')],{'transaction':_0x5cdd1f})[_0x6d2e('0x23')](function(){if(!_[_0x6d2e('0x81')](_0x32c146)){return _0x51db51[_0x6d2e('0x82')](_0x32c146,{'transaction':_0x5cdd1f});}})[_0x6d2e('0x23')](function(){_0x32c146['forEach'](function(_0x33a360){socket[_0x6d2e('0x6c')]('userWhatsappQueue:remove',{'UserId':_0x33a360,'WhatsappQueueId':_0x51db51['id']});});});});});});})[_0x6d2e('0x23')](respondWithStatusCode(_0x41bdf9,null))['catch'](handleError(_0x41bdf9,null));};exports['addAgents']=function(_0x17a483,_0x4cfede,_0x15393d){return db[_0x6d2e('0x40')][_0x6d2e('0x48')]({'where':{'id':_0x17a483[_0x6d2e('0x46')]['id']}})[_0x6d2e('0x23')](handleEntityNotFound(_0x4cfede,null))[_0x6d2e('0x23')](function(_0x50ebbe){if(_0x50ebbe){return _0x50ebbe[_0x6d2e('0x83')](_0x17a483[_0x6d2e('0x4a')][_0x6d2e('0x63')],_[_0x6d2e('0x84')](_0x17a483[_0x6d2e('0x4a')],[_0x6d2e('0x63'),'id'])||{})[_0x6d2e('0x85')](function(_0x2b7e8b){for(var _0x10dac4=0x0;_0x10dac4<_0x17a483[_0x6d2e('0x4a')][_0x6d2e('0x63')][_0x6d2e('0x47')];_0x10dac4+=0x1){socket['emit'](_0x6d2e('0x6d'),{'UserId':_0x17a483['body']['ids'][_0x10dac4],'WhatsappQueueId':_0x17a483['params']['id']});}return _0x2b7e8b;});}})['then'](respondWithResult(_0x4cfede,null))[_0x6d2e('0x44')](handleError(_0x4cfede,null));};exports['removeAgents']=function(_0x546126,_0x47e107,_0x117ff3){return db[_0x6d2e('0x40')][_0x6d2e('0x48')]({'where':{'id':_0x546126['params']['id']}})[_0x6d2e('0x23')](handleEntityNotFound(_0x47e107,null))['then'](function(_0x34875e){if(_0x34875e){return _0x34875e[_0x6d2e('0x82')](_0x546126[_0x6d2e('0x35')][_0x6d2e('0x63')])[_0x6d2e('0x23')](function(){if(_[_0x6d2e('0x86')](_0x546126[_0x6d2e('0x35')]['ids'])){for(var _0x278004=0x0;_0x278004<_0x546126[_0x6d2e('0x35')][_0x6d2e('0x63')][_0x6d2e('0x47')];_0x278004+=0x1){socket[_0x6d2e('0x6c')]('userWhatsappQueue:remove',{'UserId':Number(_0x546126[_0x6d2e('0x35')][_0x6d2e('0x63')][_0x278004]),'WhatsappQueueId':Number(_0x546126[_0x6d2e('0x46')]['id'])});}}else{socket['emit'](_0x6d2e('0x87'),{'UserId':Number(_0x546126[_0x6d2e('0x35')][_0x6d2e('0x63')]),'WhatsappQueueId':Number(_0x546126[_0x6d2e('0x46')]['id'])});}});}})[_0x6d2e('0x23')](respondWithStatusCode(_0x47e107,null))[_0x6d2e('0x44')](handleError(_0x47e107,null));};exports[_0x6d2e('0x88')]=function(_0x290bc5,_0x41c46f,_0x499963){var _0x13fce5={};var _0x24ae23={};var _0x16c417;var _0x262004;return db[_0x6d2e('0x40')][_0x6d2e('0x53')]({'where':{'id':_0x290bc5[_0x6d2e('0x46')]['id']}})[_0x6d2e('0x23')](handleEntityNotFound(_0x41c46f,null))[_0x6d2e('0x23')](function(_0x195169){if(_0x195169){_0x16c417=_0x195169;_0x24ae23[_0x6d2e('0x31')]=_['keys'](db['User'][_0x6d2e('0x2d')]);_0x24ae23[_0x6d2e('0x35')]=_[_0x6d2e('0x32')](_0x290bc5[_0x6d2e('0x35')]);_0x24ae23[_0x6d2e('0x33')]=_[_0x6d2e('0x34')](_0x24ae23['model'],_0x24ae23[_0x6d2e('0x35')]);_0x13fce5[_0x6d2e('0x36')]=_[_0x6d2e('0x34')](_0x24ae23[_0x6d2e('0x31')],qs['fields'](_0x290bc5[_0x6d2e('0x35')]['fields']));_0x13fce5['attributes']=_0x13fce5[_0x6d2e('0x36')][_0x6d2e('0x47')]?_0x13fce5['attributes']:_0x24ae23[_0x6d2e('0x31')];_0x13fce5['order']=qs[_0x6d2e('0x3a')](_0x290bc5[_0x6d2e('0x35')][_0x6d2e('0x3a')]);_0x13fce5['where']=qs[_0x6d2e('0x33')](_[_0x6d2e('0x3c')](_0x290bc5[_0x6d2e('0x35')],_0x24ae23[_0x6d2e('0x33')]));if(_0x290bc5[_0x6d2e('0x35')]['filter']){_0x13fce5[_0x6d2e('0x3b')]=_['merge'](_0x13fce5[_0x6d2e('0x3b')],{'$or':_[_0x6d2e('0x2c')](_0x13fce5[_0x6d2e('0x36')],function(_0x464aa7){var _0x32c960={};_0x32c960[_0x464aa7]={'$like':'%'+_0x290bc5[_0x6d2e('0x35')][_0x6d2e('0x3d')]+'%'};return _0x32c960;})});}_0x13fce5=_[_0x6d2e('0x3e')]({},_0x13fce5,_0x290bc5[_0x6d2e('0x3f')]);return _0x16c417[_0x6d2e('0x88')](_0x13fce5);}})[_0x6d2e('0x23')](function(_0x5e05d5){if(_0x5e05d5){_0x262004=_0x5e05d5[_0x6d2e('0x47')];if(!_0x290bc5[_0x6d2e('0x35')][_0x6d2e('0x38')](_0x6d2e('0x54'))){_0x13fce5[_0x6d2e('0x20')]=qs['limit'](_0x290bc5[_0x6d2e('0x35')][_0x6d2e('0x20')]);_0x13fce5['offset']=qs[_0x6d2e('0x1f')](_0x290bc5['query']['offset']);}return _0x16c417[_0x6d2e('0x88')](_0x13fce5);}})[_0x6d2e('0x23')](function(_0x94b139){if(_0x94b139){return _0x94b139?{'count':_0x262004,'rows':_0x94b139}:null;}})[_0x6d2e('0x23')](respondWithResult(_0x41c46f,null))[_0x6d2e('0x44')](handleError(_0x41c46f,null));}; \ No newline at end of file +var _0xaa6a=['Team','User','select','tq.TeamId','from','team_has_whatsapp_queues','join','ut.TeamId\x20=\x20tq.TeamId','WhatsappQueueId\x20=\x20?','clone','ut.UserId\x20=\x20?','push','toString','QueryTypes','SELECT','TeamId','all','union','value','isEmpty','removeAgents','forEach','userWhatsappQueue:remove','addAgents','omit','spread','userWhatsappQueue:save','isArray','getAgents','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','to-csv','lodash','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/environment','../../mysqldb','redis','defaults','localhost','register','sendStatus','end','status','json','count','offset','limit','set','Content-Range','reject','save','update','then','destroy','get','WhatsappQueues','UserProfileResource','error','name','send','index','rawAttributes','fieldName','model','map','query','keys','filters','intersection','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','type','VIRTUAL','options','WhatsappQueue','includeAll','include','findAll','rows','catch','fields','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','getMembers','UserWhatsappQueue','WhatsappQueueId','findAndCountAll','UserId','agent','whatsappPause','updatedAt','format','%s/%s','createdAt','findOne','getTeams','ids','voicePause','interface','Agents','sequelize','transaction','addTeams','emit','removeTeams'];(function(_0x2be8c2,_0x14a4b5){var _0x97f531=function(_0xcee58d){while(--_0xcee58d){_0x2be8c2['push'](_0x2be8c2['shift']());}};_0x97f531(++_0x14a4b5);}(_0xaa6a,0x1bb));var _0xaaa6=function(_0x2737c4,_0x474c0d){_0x2737c4=_0x2737c4-0x0;var _0x187a90=_0xaa6a[_0x2737c4];return _0x187a90;};'use strict';var pdf=require(_0xaaa6('0x0'));var emlformat=require(_0xaaa6('0x1'));var rimraf=require(_0xaaa6('0x2'));var zipdir=require(_0xaaa6('0x3'));var jsonpatch=require(_0xaaa6('0x4'));var rp=require(_0xaaa6('0x5'));var moment=require(_0xaaa6('0x6'));var BPromise=require(_0xaaa6('0x7'));var Mustache=require(_0xaaa6('0x8'));var util=require('util');var path=require(_0xaaa6('0x9'));var sox=require(_0xaaa6('0xa'));var csv=require(_0xaaa6('0xb'));var ejs=require('ejs');var fs=require('fs');var _=require(_0xaaa6('0xc'));var squel=require(_0xaaa6('0xd'));var crypto=require(_0xaaa6('0xe'));var jsforce=require('jsforce');var deskjs=require(_0xaaa6('0xf'));var toCsv=require(_0xaaa6('0xb'));var querystring=require(_0xaaa6('0x10'));var Papa=require(_0xaaa6('0x11'));var Redis=require(_0xaaa6('0x12'));var authService=require('../../components/auth/service');var qs=require(_0xaaa6('0x13'));var as=require(_0xaaa6('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xaaa6('0x15'))('api');var utils=require('../../config/utils');var config=require(_0xaaa6('0x16'));var db=require(_0xaaa6('0x17'))['db'];config[_0xaaa6('0x18')]=_[_0xaaa6('0x19')](config['redis'],{'host':_0xaaa6('0x1a'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xaaa6('0x18')]));require('./whatsappQueue.socket')[_0xaaa6('0x1b')](socket);function respondWithStatusCode(_0x2c3f3b,_0x586137){_0x586137=_0x586137||0xcc;return function(_0x3f01d6){if(_0x3f01d6){return _0x2c3f3b[_0xaaa6('0x1c')](_0x586137);}return _0x2c3f3b['status'](_0x586137)[_0xaaa6('0x1d')]();};}function respondWithResult(_0x2a09fd,_0x5ca1f3){_0x5ca1f3=_0x5ca1f3||0xc8;return function(_0x3767e0){if(_0x3767e0){return _0x2a09fd[_0xaaa6('0x1e')](_0x5ca1f3)[_0xaaa6('0x1f')](_0x3767e0);}};}function respondWithFilteredResult(_0x589bd5,_0x154692){return function(_0x479530){if(_0x479530){var _0x2ecaa2=_0x479530[_0xaaa6('0x20')],_0x2885ef=_0x154692[_0xaaa6('0x21')],_0xfd4777=_0x154692[_0xaaa6('0x21')]+_0x154692[_0xaaa6('0x22')],_0x58e885;if(_0xfd4777>=_0x2ecaa2){_0xfd4777=_0x2ecaa2;_0x58e885=0xc8;}else{_0x58e885=0xce;}_0x589bd5[_0xaaa6('0x1e')](_0x58e885);return _0x589bd5[_0xaaa6('0x23')](_0xaaa6('0x24'),_0x2885ef+'-'+_0xfd4777+'/'+_0x2ecaa2)[_0xaaa6('0x1f')](_0x479530);}return null;};}function patchUpdates(_0x1b8502){return function(_0x34ed71){try{jsonpatch['apply'](_0x34ed71,_0x1b8502,!![]);}catch(_0x5600b2){return BPromise[_0xaaa6('0x25')](_0x5600b2);}return _0x34ed71[_0xaaa6('0x26')]();};}function saveUpdates(_0x1bdbf9,_0x343c43){return function(_0x139a8b){if(_0x139a8b){return _0x139a8b[_0xaaa6('0x27')](_0x1bdbf9)[_0xaaa6('0x28')](function(_0x2c3335){return _0x2c3335;});}return null;};}function removeEntity(_0x58f6db,_0x4fb284){return function(_0x534a22){if(_0x534a22){return _0x534a22[_0xaaa6('0x29')]()['then'](function(){var _0x1d07b3=_0x534a22[_0xaaa6('0x2a')]({'plain':!![]});var _0x360bbf=_0xaaa6('0x2b');return db[_0xaaa6('0x2c')][_0xaaa6('0x29')]({'where':{'type':_0x360bbf,'resourceId':_0x1d07b3['id']}})[_0xaaa6('0x28')](function(){return _0x534a22;});})[_0xaaa6('0x28')](function(){_0x58f6db[_0xaaa6('0x1e')](0xcc)[_0xaaa6('0x1d')]();});}};}function handleEntityNotFound(_0x24c2e8,_0x4b089e){return function(_0x686c62){if(!_0x686c62){_0x24c2e8[_0xaaa6('0x1c')](0x194);}return _0x686c62;};}function handleError(_0x445c54,_0x1c1dd7){_0x1c1dd7=_0x1c1dd7||0x1f4;return function(_0x2c0558){logger[_0xaaa6('0x2d')](_0x2c0558['stack']);if(_0x2c0558[_0xaaa6('0x2e')]){delete _0x2c0558[_0xaaa6('0x2e')];}_0x445c54['status'](_0x1c1dd7)[_0xaaa6('0x2f')](_0x2c0558);};}exports[_0xaaa6('0x30')]=function(_0x2f3db4,_0x3f8ee3){var _0x4be09a={},_0xfc7901={},_0x3c7a20={'count':0x0,'rows':[]};var _0x16d29f=_['map'](db['WhatsappQueue'][_0xaaa6('0x31')],function(_0x458123){return{'name':_0x458123[_0xaaa6('0x32')],'type':_0x458123['type']['key']};});_0xfc7901[_0xaaa6('0x33')]=_[_0xaaa6('0x34')](_0x16d29f,_0xaaa6('0x2e'));_0xfc7901[_0xaaa6('0x35')]=_[_0xaaa6('0x36')](_0x2f3db4[_0xaaa6('0x35')]);_0xfc7901[_0xaaa6('0x37')]=_[_0xaaa6('0x38')](_0xfc7901['model'],_0xfc7901[_0xaaa6('0x35')]);_0x4be09a['attributes']=_[_0xaaa6('0x38')](_0xfc7901[_0xaaa6('0x33')],qs['fields'](_0x2f3db4['query']['fields']));_0x4be09a[_0xaaa6('0x39')]=_0x4be09a[_0xaaa6('0x39')][_0xaaa6('0x3a')]?_0x4be09a[_0xaaa6('0x39')]:_0xfc7901[_0xaaa6('0x33')];if(!_0x2f3db4[_0xaaa6('0x35')][_0xaaa6('0x3b')](_0xaaa6('0x3c'))){_0x4be09a[_0xaaa6('0x22')]=qs[_0xaaa6('0x22')](_0x2f3db4['query'][_0xaaa6('0x22')]);_0x4be09a[_0xaaa6('0x21')]=qs[_0xaaa6('0x21')](_0x2f3db4[_0xaaa6('0x35')][_0xaaa6('0x21')]);}_0x4be09a[_0xaaa6('0x3d')]=qs[_0xaaa6('0x3e')](_0x2f3db4['query'][_0xaaa6('0x3e')]);_0x4be09a[_0xaaa6('0x3f')]=qs[_0xaaa6('0x37')](_[_0xaaa6('0x40')](_0x2f3db4[_0xaaa6('0x35')],_0xfc7901['filters']),_0x16d29f);if(_0x2f3db4[_0xaaa6('0x35')][_0xaaa6('0x41')]){_0x4be09a[_0xaaa6('0x3f')]=_[_0xaaa6('0x42')](_0x4be09a['where'],{'$or':_['map'](_0x16d29f,function(_0x134a9f){if(_0x134a9f[_0xaaa6('0x43')]!==_0xaaa6('0x44')){var _0x22e842={};_0x22e842[_0x134a9f[_0xaaa6('0x2e')]]={'$like':'%'+_0x2f3db4['query']['filter']+'%'};return _0x22e842;}})});}_0x4be09a=_['merge']({},_0x4be09a,_0x2f3db4[_0xaaa6('0x45')]);var _0x296ce4={'where':_0x4be09a['where']};return db[_0xaaa6('0x46')]['count'](_0x296ce4)[_0xaaa6('0x28')](function(_0x4d9545){_0x3c7a20[_0xaaa6('0x20')]=_0x4d9545;if(_0x2f3db4[_0xaaa6('0x35')][_0xaaa6('0x47')]){_0x4be09a[_0xaaa6('0x48')]=[{'all':!![]}];}return db['WhatsappQueue'][_0xaaa6('0x49')](_0x4be09a);})['then'](function(_0x555862){_0x3c7a20[_0xaaa6('0x4a')]=_0x555862;return _0x3c7a20;})['then'](respondWithFilteredResult(_0x3f8ee3,_0x4be09a))[_0xaaa6('0x4b')](handleError(_0x3f8ee3,null));};exports['show']=function(_0x54b860,_0x127c63){var _0x3ad4c1={'raw':!![],'where':{'id':_0x54b860['params']['id']}},_0x4f6703={};_0x4f6703[_0xaaa6('0x33')]=_[_0xaaa6('0x36')](db[_0xaaa6('0x46')][_0xaaa6('0x31')]);_0x4f6703['query']=_[_0xaaa6('0x36')](_0x54b860['query']);_0x4f6703[_0xaaa6('0x37')]=_[_0xaaa6('0x38')](_0x4f6703[_0xaaa6('0x33')],_0x4f6703[_0xaaa6('0x35')]);_0x3ad4c1[_0xaaa6('0x39')]=_['intersection'](_0x4f6703[_0xaaa6('0x33')],qs['fields'](_0x54b860[_0xaaa6('0x35')][_0xaaa6('0x4c')]));_0x3ad4c1[_0xaaa6('0x39')]=_0x3ad4c1[_0xaaa6('0x39')]['length']?_0x3ad4c1[_0xaaa6('0x39')]:_0x4f6703['model'];if(_0x54b860[_0xaaa6('0x35')][_0xaaa6('0x47')]){_0x3ad4c1['include']=[{'all':!![]}];}_0x3ad4c1=_[_0xaaa6('0x42')]({},_0x3ad4c1,_0x54b860['options']);return db[_0xaaa6('0x46')][_0xaaa6('0x4d')](_0x3ad4c1)[_0xaaa6('0x28')](handleEntityNotFound(_0x127c63,null))['then'](respondWithResult(_0x127c63,null))['catch'](handleError(_0x127c63,null));};exports[_0xaaa6('0x4e')]=function(_0x13f988,_0x18d8d2){return db[_0xaaa6('0x46')][_0xaaa6('0x4e')](_0x13f988[_0xaaa6('0x4f')],{})['then'](function(_0xd34777){var _0x34b4c3=_0x13f988[_0xaaa6('0x50')][_0xaaa6('0x2a')]({'plain':!![]});if(!_0x34b4c3)throw new Error(_0xaaa6('0x51'));if(_0x34b4c3[_0xaaa6('0x52')]===_0xaaa6('0x50')){var _0x387899=_0xd34777[_0xaaa6('0x2a')]({'plain':!![]});var _0x343be1='WhatsappQueues';return db[_0xaaa6('0x53')][_0xaaa6('0x4d')]({'where':{'name':_0x343be1,'userProfileId':_0x34b4c3['userProfileId']},'raw':!![]})[_0xaaa6('0x28')](function(_0x528a2e){if(_0x528a2e&&_0x528a2e[_0xaaa6('0x54')]===0x0){return db['UserProfileResource'][_0xaaa6('0x4e')]({'name':_0x387899[_0xaaa6('0x2e')],'resourceId':_0x387899['id'],'type':_0x528a2e['name'],'sectionId':_0x528a2e['id']},{})[_0xaaa6('0x28')](function(){return _0xd34777;});}else{return _0xd34777;}})[_0xaaa6('0x4b')](function(_0x52799d){logger[_0xaaa6('0x2d')](_0xaaa6('0x55'),_0x52799d);throw _0x52799d;});}return _0xd34777;})[_0xaaa6('0x28')](respondWithResult(_0x18d8d2,0xc9))[_0xaaa6('0x4b')](handleError(_0x18d8d2,null));};exports['update']=function(_0x2601f0,_0x2e424e){if(_0x2601f0[_0xaaa6('0x4f')]['id']){delete _0x2601f0[_0xaaa6('0x4f')]['id'];}return db[_0xaaa6('0x46')][_0xaaa6('0x4d')]({'where':{'id':_0x2601f0['params']['id']}})[_0xaaa6('0x28')](handleEntityNotFound(_0x2e424e,null))['then'](saveUpdates(_0x2601f0[_0xaaa6('0x4f')],null))[_0xaaa6('0x28')](respondWithResult(_0x2e424e,null))[_0xaaa6('0x4b')](handleError(_0x2e424e,null));};exports['destroy']=function(_0x62aecd,_0x343ce6){return db[_0xaaa6('0x46')][_0xaaa6('0x4d')]({'where':{'id':_0x62aecd[_0xaaa6('0x56')]['id']}})[_0xaaa6('0x28')](handleEntityNotFound(_0x343ce6,null))['then'](removeEntity(_0x343ce6,null))[_0xaaa6('0x4b')](handleError(_0x343ce6,null));};exports['describe']=function(_0x4091e7,_0x5123a4){return db['WhatsappQueue']['describe']()[_0xaaa6('0x28')](respondWithResult(_0x5123a4,null))['catch'](handleError(_0x5123a4,null));};exports[_0xaaa6('0x57')]=function(_0x3241c0,_0x374d10,_0x319bcb){var _0x27e874={'raw':!![],'where':{}},_0xb49a0b={},_0xbc43aa;return db[_0xaaa6('0x46')]['findOne']({'where':{'id':_0x3241c0[_0xaaa6('0x56')]['id']}})[_0xaaa6('0x28')](handleEntityNotFound(_0x374d10,null))[_0xaaa6('0x28')](function(_0x5ddc9e){if(_0x5ddc9e){_0xbc43aa=_0x5ddc9e[_0xaaa6('0x2a')]({'plain':!![]});_0xb49a0b['model']=_[_0xaaa6('0x36')](db[_0xaaa6('0x58')][_0xaaa6('0x31')]);_0xb49a0b[_0xaaa6('0x35')]=_[_0xaaa6('0x36')](_0x3241c0['query']);_0xb49a0b[_0xaaa6('0x37')]=_[_0xaaa6('0x38')](_0xb49a0b['model'],_0xb49a0b[_0xaaa6('0x35')]);_0x27e874[_0xaaa6('0x39')]=_[_0xaaa6('0x38')](_0xb49a0b[_0xaaa6('0x33')],qs[_0xaaa6('0x4c')](_0x3241c0[_0xaaa6('0x35')]['fields']));_0x27e874[_0xaaa6('0x39')]=_0x27e874[_0xaaa6('0x39')]['length']?_0x27e874['attributes']:_0xb49a0b[_0xaaa6('0x33')];if(!_0x3241c0[_0xaaa6('0x35')][_0xaaa6('0x3b')](_0xaaa6('0x3c'))){_0x27e874[_0xaaa6('0x22')]=qs[_0xaaa6('0x22')](_0x3241c0[_0xaaa6('0x35')][_0xaaa6('0x22')]);_0x27e874[_0xaaa6('0x21')]=qs['offset'](_0x3241c0[_0xaaa6('0x35')][_0xaaa6('0x21')]);}_0x27e874[_0xaaa6('0x3d')]=qs['sort'](_0x3241c0[_0xaaa6('0x35')][_0xaaa6('0x3e')]);_0x27e874['where']=qs[_0xaaa6('0x37')](_[_0xaaa6('0x40')](_0x3241c0['query'],_0xb49a0b[_0xaaa6('0x37')]));_0x27e874[_0xaaa6('0x3f')][_0xaaa6('0x59')]=_0x5ddc9e['id'];if(_0x3241c0[_0xaaa6('0x35')][_0xaaa6('0x41')]){_0x27e874[_0xaaa6('0x3f')]=_[_0xaaa6('0x42')](_0x27e874['where'],{'$or':_['map'](_0x27e874['attributes'],function(_0x4904b6){var _0x535d39={};_0x535d39[_0x4904b6]={'$like':'%'+_0x3241c0[_0xaaa6('0x35')][_0xaaa6('0x41')]+'%'};return _0x535d39;})});}_0x27e874=_[_0xaaa6('0x42')]({},_0x27e874,_0x3241c0[_0xaaa6('0x45')]);return db[_0xaaa6('0x58')][_0xaaa6('0x49')](_0x27e874);}})['then'](function(_0x3da9a1){if(_0x3da9a1){return db['User'][_0xaaa6('0x5a')]({'where':{'id':_[_0xaaa6('0x34')](_0x3da9a1,_0xaaa6('0x5b')),'role':_0xaaa6('0x5c')},'attributes':['id','name',_0xaaa6('0x5d'),_0xaaa6('0x5e'),'createdAt']});}})[_0xaaa6('0x28')](function(_0x33b06a){if(_0x33b06a){return{'count':_0x33b06a[_0xaaa6('0x20')],'rows':_['map'](_0x33b06a['rows'],function(_0x3a4e9f){return{'membername':_0x3a4e9f[_0xaaa6('0x2e')],'UserId':_0x3a4e9f['id'],'queue_name':_0xbc43aa[_0xaaa6('0x2e')],'WhatsappQueueId':_0xbc43aa['id'],'interface':util[_0xaaa6('0x5f')](_0xaaa6('0x60'),'SIP',_0x3a4e9f[_0xaaa6('0x2e')]),'penalty':0x0,'paused':_0x3a4e9f[_0xaaa6('0x5d')],'createdAt':_0x3a4e9f[_0xaaa6('0x61')],'updatedAt':_0x3a4e9f['updatedAt']};})};}else{return{'count':0x0,'rows':[]};}})['then'](respondWithFilteredResult(_0x374d10,_0x27e874))[_0xaaa6('0x4b')](handleError(_0x374d10,null));};exports['getTeams']=function(_0x4bfbef,_0x19e2f8,_0x36aece){var _0x2d7866={};var _0x1a07de={};var _0x2ae60e;var _0x56c4a6;return db['WhatsappQueue'][_0xaaa6('0x62')]({'where':{'id':_0x4bfbef[_0xaaa6('0x56')]['id']}})[_0xaaa6('0x28')](handleEntityNotFound(_0x19e2f8,null))[_0xaaa6('0x28')](function(_0xc90a43){if(_0xc90a43){_0x2ae60e=_0xc90a43;_0x1a07de[_0xaaa6('0x33')]=_[_0xaaa6('0x36')](db['Team'][_0xaaa6('0x31')]);_0x1a07de[_0xaaa6('0x35')]=_[_0xaaa6('0x36')](_0x4bfbef[_0xaaa6('0x35')]);_0x1a07de[_0xaaa6('0x37')]=_[_0xaaa6('0x38')](_0x1a07de['model'],_0x1a07de[_0xaaa6('0x35')]);_0x2d7866['attributes']=_['intersection'](_0x1a07de[_0xaaa6('0x33')],qs[_0xaaa6('0x4c')](_0x4bfbef[_0xaaa6('0x35')][_0xaaa6('0x4c')]));_0x2d7866[_0xaaa6('0x39')]=_0x2d7866[_0xaaa6('0x39')][_0xaaa6('0x3a')]?_0x2d7866[_0xaaa6('0x39')]:_0x1a07de[_0xaaa6('0x33')];_0x2d7866[_0xaaa6('0x3d')]=qs[_0xaaa6('0x3e')](_0x4bfbef[_0xaaa6('0x35')][_0xaaa6('0x3e')]);_0x2d7866[_0xaaa6('0x3f')]=qs[_0xaaa6('0x37')](_[_0xaaa6('0x40')](_0x4bfbef['query'],_0x1a07de[_0xaaa6('0x37')]));if(_0x4bfbef[_0xaaa6('0x35')][_0xaaa6('0x41')]){_0x2d7866[_0xaaa6('0x3f')]=_[_0xaaa6('0x42')](_0x2d7866[_0xaaa6('0x3f')],{'$or':_[_0xaaa6('0x34')](_0x2d7866['attributes'],function(_0x58e07c){var _0x468034={};_0x468034[_0x58e07c]={'$like':'%'+_0x4bfbef[_0xaaa6('0x35')][_0xaaa6('0x41')]+'%'};return _0x468034;})});}_0x2d7866=_[_0xaaa6('0x42')]({},_0x2d7866,_0x4bfbef[_0xaaa6('0x45')]);return _0x2ae60e[_0xaaa6('0x63')](_0x2d7866);}})[_0xaaa6('0x28')](function(_0x540ba6){if(_0x540ba6){_0x56c4a6=_0x540ba6[_0xaaa6('0x3a')];if(!_0x4bfbef[_0xaaa6('0x35')][_0xaaa6('0x3b')]('nolimit')){_0x2d7866[_0xaaa6('0x22')]=qs[_0xaaa6('0x22')](_0x4bfbef[_0xaaa6('0x35')][_0xaaa6('0x22')]);_0x2d7866[_0xaaa6('0x21')]=qs[_0xaaa6('0x21')](_0x4bfbef[_0xaaa6('0x35')]['offset']);}return _0x2ae60e[_0xaaa6('0x63')](_0x2d7866);}})['then'](function(_0x4d5c83){if(_0x4d5c83){return _0x4d5c83?{'count':_0x56c4a6,'rows':_0x4d5c83}:null;}})[_0xaaa6('0x28')](respondWithResult(_0x19e2f8,null))['catch'](handleError(_0x19e2f8,null));};exports['addTeams']=function(_0x5c52b6,_0x5d9d94,_0x1c81f6){var _0x5d5180=_0x5c52b6[_0xaaa6('0x4f')][_0xaaa6('0x64')];return db['Team'][_0xaaa6('0x49')]({'where':{'id':_0x5d5180},'attributes':['id'],'include':[{'model':db['User'],'as':'Agents','attributes':['id',_0xaaa6('0x2e'),'online',_0xaaa6('0x65'),_0xaaa6('0x66')],'raw':!![]}]})[_0xaaa6('0x28')](function(_0xedd534){if(_0xedd534){var _0x72b799=_['flatMap'](_0xedd534,function(_0x1d1762){var _0x4f6da6=_0x1d1762[_0xaaa6('0x2a')]({'plain':!![]});return _0x4f6da6[_0xaaa6('0x67')];});return db['WhatsappQueue'][_0xaaa6('0x4d')]({'where':{'id':_0x5c52b6['params']['id']}})['then'](function(_0x49d6e2){return db[_0xaaa6('0x68')][_0xaaa6('0x69')](function(_0x4379e9){return _0x49d6e2[_0xaaa6('0x6a')](_0x5d5180,{'transaction':_0x4379e9})[_0xaaa6('0x28')](function(){return BPromise['each'](_0x72b799,function(_0x169eb9){return db[_0xaaa6('0x58')]['findOrCreate']({'where':{'UserId':_0x169eb9['id'],'WhatsappQueueId':_0x5c52b6[_0xaaa6('0x56')]['id']},'transaction':_0x4379e9});});})[_0xaaa6('0x28')](function(){_0x72b799['forEach'](function(_0x52196e){socket[_0xaaa6('0x6b')]('userWhatsappQueue:save',{'UserId':_0x52196e['id'],'WhatsappQueueId':_0x49d6e2['id']});});});});});}})[_0xaaa6('0x28')](respondWithStatusCode(_0x5d9d94,null))['catch'](handleError(_0x5d9d94,null));};exports[_0xaaa6('0x6c')]=function(_0x4a2f1c,_0x4009af,_0x383652){return db[_0xaaa6('0x6d')][_0xaaa6('0x49')]({'where':{'id':_0x4a2f1c[_0xaaa6('0x35')][_0xaaa6('0x64')]},'attributes':['id'],'include':[{'model':db[_0xaaa6('0x6e')],'as':_0xaaa6('0x67'),'attributes':['id'],'raw':!![]}]})[_0xaaa6('0x28')](handleEntityNotFound(_0x4009af,null))[_0xaaa6('0x28')](function(_0x209f39){var _0x14f823=_[_0xaaa6('0x34')](_0x209f39,'id');var _0x4a0cf8=[];var _0x4b708c=[];var _0x52ce07=squel[_0xaaa6('0x6f')]();_0x52ce07['field'](_0xaaa6('0x70'))[_0xaaa6('0x71')](_0xaaa6('0x72'),'tq')[_0xaaa6('0x73')]('user_has_teams','ut',_0xaaa6('0x74'))[_0xaaa6('0x3f')](_0xaaa6('0x75'),_0x4a2f1c['params']['id']);for(var _0x247e2f=0x0;_0x247e2f<_0x209f39[_0xaaa6('0x3a')];_0x247e2f+=0x1){let _0x6975fe=_0x209f39[_0x247e2f];for(var _0x316383=0x0;_0x316383<_0x6975fe[_0xaaa6('0x67')][_0xaaa6('0x3a')];_0x316383+=0x1){let _0x4cb0a3=_0x6975fe[_0xaaa6('0x67')][_0x316383];var _0x2288e9=_0x52ce07[_0xaaa6('0x76')]();_0x2288e9[_0xaaa6('0x3f')](_0xaaa6('0x77'),_0x4cb0a3['id']);_0x4b708c[_0xaaa6('0x78')](db['sequelize'][_0xaaa6('0x35')](_0x2288e9[_0xaaa6('0x79')](),{'type':db[_0xaaa6('0x68')][_0xaaa6('0x7a')][_0xaaa6('0x7b')]})['then'](function(_0x4ec8b6){if(_0x4ec8b6[_0xaaa6('0x3a')]===0x1){return _0x4cb0a3['id'];}else{var _0x9d7487=_['every'](_[_0xaaa6('0x34')](_0x4ec8b6,_0xaaa6('0x7c')),function(_0x45e400){return _['includes'](_0x14f823,_0x45e400);});if(_0x9d7487){return _0x4cb0a3['id'];}}}));}}return BPromise[_0xaaa6('0x7d')](_0x4b708c)[_0xaaa6('0x28')](function(_0x33e2e1){_0x4a0cf8=_(_0x4a0cf8)[_0xaaa6('0x7e')](_0x33e2e1)['compact']()[_0xaaa6('0x7f')]();return db[_0xaaa6('0x46')][_0xaaa6('0x4d')]({'where':{'id':_0x4a2f1c[_0xaaa6('0x56')]['id']}})[_0xaaa6('0x28')](function(_0x471bfe){return db[_0xaaa6('0x68')][_0xaaa6('0x69')](function(_0xa1f6f){return _0x471bfe['removeTeams'](_0x4a2f1c['query'][_0xaaa6('0x64')],{'transaction':_0xa1f6f})[_0xaaa6('0x28')](function(){if(!_[_0xaaa6('0x80')](_0x4a0cf8)){return _0x471bfe[_0xaaa6('0x81')](_0x4a0cf8,{'transaction':_0xa1f6f});}})[_0xaaa6('0x28')](function(){_0x4a0cf8[_0xaaa6('0x82')](function(_0x4c9bef){socket[_0xaaa6('0x6b')](_0xaaa6('0x83'),{'UserId':_0x4c9bef,'WhatsappQueueId':_0x471bfe['id']});});});});});});})[_0xaaa6('0x28')](respondWithStatusCode(_0x4009af,null))['catch'](handleError(_0x4009af,null));};exports[_0xaaa6('0x84')]=function(_0x12c89c,_0x2f7937,_0x3a0f20){return db[_0xaaa6('0x46')][_0xaaa6('0x4d')]({'where':{'id':_0x12c89c[_0xaaa6('0x56')]['id']}})[_0xaaa6('0x28')](handleEntityNotFound(_0x2f7937,null))[_0xaaa6('0x28')](function(_0x339be2){if(_0x339be2){return _0x339be2['addAgents'](_0x12c89c['body']['ids'],_[_0xaaa6('0x85')](_0x12c89c[_0xaaa6('0x4f')],[_0xaaa6('0x64'),'id'])||{})[_0xaaa6('0x86')](function(_0x4bd75d){for(var _0x4807ed=0x0;_0x4807ed<_0x12c89c[_0xaaa6('0x4f')]['ids'][_0xaaa6('0x3a')];_0x4807ed+=0x1){socket[_0xaaa6('0x6b')](_0xaaa6('0x87'),{'UserId':_0x12c89c['body']['ids'][_0x4807ed],'WhatsappQueueId':_0x12c89c[_0xaaa6('0x56')]['id']});}return _0x4bd75d;});}})[_0xaaa6('0x28')](respondWithResult(_0x2f7937,null))['catch'](handleError(_0x2f7937,null));};exports[_0xaaa6('0x81')]=function(_0x32a1cb,_0x31b2d1,_0x371cec){return db['WhatsappQueue']['find']({'where':{'id':_0x32a1cb[_0xaaa6('0x56')]['id']}})[_0xaaa6('0x28')](handleEntityNotFound(_0x31b2d1,null))['then'](function(_0x3213ea){if(_0x3213ea){return _0x3213ea[_0xaaa6('0x81')](_0x32a1cb['query'][_0xaaa6('0x64')])[_0xaaa6('0x28')](function(){if(_[_0xaaa6('0x88')](_0x32a1cb[_0xaaa6('0x35')][_0xaaa6('0x64')])){for(var _0x5411c7=0x0;_0x5411c7<_0x32a1cb[_0xaaa6('0x35')]['ids']['length'];_0x5411c7+=0x1){socket[_0xaaa6('0x6b')](_0xaaa6('0x83'),{'UserId':Number(_0x32a1cb[_0xaaa6('0x35')]['ids'][_0x5411c7]),'WhatsappQueueId':Number(_0x32a1cb[_0xaaa6('0x56')]['id'])});}}else{socket[_0xaaa6('0x6b')](_0xaaa6('0x83'),{'UserId':Number(_0x32a1cb[_0xaaa6('0x35')][_0xaaa6('0x64')]),'WhatsappQueueId':Number(_0x32a1cb[_0xaaa6('0x56')]['id'])});}});}})[_0xaaa6('0x28')](respondWithStatusCode(_0x31b2d1,null))[_0xaaa6('0x4b')](handleError(_0x31b2d1,null));};exports['getAgents']=function(_0x3733e9,_0x54d3b0,_0x2756a1){var _0x26fd0c={};var _0x4b7098={};var _0x2f6748;var _0x18e0c0;return db['WhatsappQueue'][_0xaaa6('0x62')]({'where':{'id':_0x3733e9[_0xaaa6('0x56')]['id']}})[_0xaaa6('0x28')](handleEntityNotFound(_0x54d3b0,null))[_0xaaa6('0x28')](function(_0x240141){if(_0x240141){_0x2f6748=_0x240141;_0x4b7098[_0xaaa6('0x33')]=_[_0xaaa6('0x36')](db['User'][_0xaaa6('0x31')]);_0x4b7098[_0xaaa6('0x35')]=_['keys'](_0x3733e9[_0xaaa6('0x35')]);_0x4b7098['filters']=_['intersection'](_0x4b7098['model'],_0x4b7098[_0xaaa6('0x35')]);_0x26fd0c['attributes']=_[_0xaaa6('0x38')](_0x4b7098[_0xaaa6('0x33')],qs[_0xaaa6('0x4c')](_0x3733e9[_0xaaa6('0x35')]['fields']));_0x26fd0c[_0xaaa6('0x39')]=_0x26fd0c[_0xaaa6('0x39')][_0xaaa6('0x3a')]?_0x26fd0c[_0xaaa6('0x39')]:_0x4b7098[_0xaaa6('0x33')];_0x26fd0c[_0xaaa6('0x3d')]=qs[_0xaaa6('0x3e')](_0x3733e9[_0xaaa6('0x35')]['sort']);_0x26fd0c[_0xaaa6('0x3f')]=qs[_0xaaa6('0x37')](_[_0xaaa6('0x40')](_0x3733e9[_0xaaa6('0x35')],_0x4b7098['filters']));if(_0x3733e9[_0xaaa6('0x35')][_0xaaa6('0x41')]){_0x26fd0c[_0xaaa6('0x3f')]=_[_0xaaa6('0x42')](_0x26fd0c[_0xaaa6('0x3f')],{'$or':_['map'](_0x26fd0c[_0xaaa6('0x39')],function(_0x4cb96f){var _0x37f8fc={};_0x37f8fc[_0x4cb96f]={'$like':'%'+_0x3733e9[_0xaaa6('0x35')][_0xaaa6('0x41')]+'%'};return _0x37f8fc;})});}_0x26fd0c=_['merge']({},_0x26fd0c,_0x3733e9[_0xaaa6('0x45')]);return _0x2f6748[_0xaaa6('0x89')](_0x26fd0c);}})['then'](function(_0xf95b57){if(_0xf95b57){_0x18e0c0=_0xf95b57['length'];if(!_0x3733e9[_0xaaa6('0x35')][_0xaaa6('0x3b')]('nolimit')){_0x26fd0c[_0xaaa6('0x22')]=qs[_0xaaa6('0x22')](_0x3733e9[_0xaaa6('0x35')][_0xaaa6('0x22')]);_0x26fd0c[_0xaaa6('0x21')]=qs['offset'](_0x3733e9[_0xaaa6('0x35')][_0xaaa6('0x21')]);}return _0x2f6748[_0xaaa6('0x89')](_0x26fd0c);}})[_0xaaa6('0x28')](function(_0x3e7b5b){if(_0x3e7b5b){return _0x3e7b5b?{'count':_0x18e0c0,'rows':_0x3e7b5b}:null;}})[_0xaaa6('0x28')](respondWithResult(_0x54d3b0,null))['catch'](handleError(_0x54d3b0,null));}; \ No newline at end of file diff --git a/server/api/whatsappQueue/whatsappQueue.events.js b/server/api/whatsappQueue/whatsappQueue.events.js index 37f26ab..71ef8a3 100644 --- a/server/api/whatsappQueue/whatsappQueue.events.js +++ b/server/api/whatsappQueue/whatsappQueue.events.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x77d8=['events','WhatsappQueue','setMaxListeners','save','update','remove','emit','hook','exports'];(function(_0x826c33,_0xa28cc1){var _0x64aa77=function(_0x5c08a6){while(--_0x5c08a6){_0x826c33['push'](_0x826c33['shift']());}};_0x64aa77(++_0xa28cc1);}(_0x77d8,0xf3));var _0x877d=function(_0x1e003b,_0x3e4ded){_0x1e003b=_0x1e003b-0x0;var _0x268789=_0x77d8[_0x1e003b];return _0x268789;};'use strict';var EventEmitter=require(_0x877d('0x0'));var WhatsappQueue=require('../../mysqldb')['db'][_0x877d('0x1')];var WhatsappQueueEvents=new EventEmitter();WhatsappQueueEvents[_0x877d('0x2')](0x0);var events={'afterCreate':_0x877d('0x3'),'afterUpdate':_0x877d('0x4'),'afterDestroy':_0x877d('0x5')};function emitEvent(_0x1a9c74){return function(_0x473ce3,_0x4428a7,_0x184eac){WhatsappQueueEvents[_0x877d('0x6')](_0x1a9c74+':'+_0x473ce3['id'],_0x473ce3);WhatsappQueueEvents[_0x877d('0x6')](_0x1a9c74,_0x473ce3);_0x184eac(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];WhatsappQueue[_0x877d('0x7')](e,emitEvent(event));}}module[_0x877d('0x8')]=WhatsappQueueEvents; \ No newline at end of file +var _0x7ab5=['hasOwnProperty','events','../../mysqldb','WhatsappQueue','save','update','emit'];(function(_0x197005,_0x1d8b1b){var _0x5501e1=function(_0x5625d5){while(--_0x5625d5){_0x197005['push'](_0x197005['shift']());}};_0x5501e1(++_0x1d8b1b);}(_0x7ab5,0x1dd));var _0x57ab=function(_0x1f33e8,_0x398b50){_0x1f33e8=_0x1f33e8-0x0;var _0x3a7c89=_0x7ab5[_0x1f33e8];return _0x3a7c89;};'use strict';var EventEmitter=require(_0x57ab('0x0'));var WhatsappQueue=require(_0x57ab('0x1'))['db'][_0x57ab('0x2')];var WhatsappQueueEvents=new EventEmitter();WhatsappQueueEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x57ab('0x3'),'afterUpdate':_0x57ab('0x4'),'afterDestroy':'remove'};function emitEvent(_0x22a202){return function(_0x4ddb61,_0x591bcb,_0x5ef4ac){WhatsappQueueEvents[_0x57ab('0x5')](_0x22a202+':'+_0x4ddb61['id'],_0x4ddb61);WhatsappQueueEvents[_0x57ab('0x5')](_0x22a202,_0x4ddb61);_0x5ef4ac(null);};}for(var e in events){if(events[_0x57ab('0x6')](e)){var event=events[e];WhatsappQueue['hook'](e,emitEvent(event));}}module['exports']=WhatsappQueueEvents; \ No newline at end of file diff --git a/server/api/whatsappQueue/whatsappQueue.model.js b/server/api/whatsappQueue/whatsappQueue.model.js index 0a2d786..719df7d 100644 --- a/server/api/whatsappQueue/whatsappQueue.model.js +++ b/server/api/whatsappQueue/whatsappQueue.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x8f21=['../../config/environment','./whatsappQueue.attributes','exports','define','WhatsappQueue','whatsapp_queues','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf'];(function(_0x2dea24,_0x2fc021){var _0x309d58=function(_0x2eb89f){while(--_0x2eb89f){_0x2dea24['push'](_0x2dea24['shift']());}};_0x309d58(++_0x2fc021);}(_0x8f21,0x132));var _0x18f2=function(_0x380d65,_0x1adf28){_0x380d65=_0x380d65-0x0;var _0x30f686=_0x8f21[_0x380d65];return _0x30f686;};'use strict';var _=require(_0x18f2('0x0'));var util=require(_0x18f2('0x1'));var logger=require(_0x18f2('0x2'))(_0x18f2('0x3'));var moment=require(_0x18f2('0x4'));var BPromise=require(_0x18f2('0x5'));var rp=require(_0x18f2('0x6'));var fs=require('fs');var path=require(_0x18f2('0x7'));var rimraf=require(_0x18f2('0x8'));var config=require(_0x18f2('0x9'));var attributes=require(_0x18f2('0xa'));module[_0x18f2('0xb')]=function(_0xc30acb,_0x3324d4){return _0xc30acb[_0x18f2('0xc')](_0x18f2('0xd'),attributes,{'tableName':_0x18f2('0xe'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x3b21=['util','../../config/logger','api','rimraf','../../config/environment','./whatsappQueue.attributes','define','WhatsappQueue','whatsapp_queues','lodash'];(function(_0x5acfcf,_0x3db06b){var _0x41588d=function(_0x4949b6){while(--_0x4949b6){_0x5acfcf['push'](_0x5acfcf['shift']());}};_0x41588d(++_0x3db06b);}(_0x3b21,0x121));var _0x13b2=function(_0x5c6e52,_0x5297ff){_0x5c6e52=_0x5c6e52-0x0;var _0x193919=_0x3b21[_0x5c6e52];return _0x193919;};'use strict';var _=require(_0x13b2('0x0'));var util=require(_0x13b2('0x1'));var logger=require(_0x13b2('0x2'))(_0x13b2('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(_0x13b2('0x4'));var config=require(_0x13b2('0x5'));var attributes=require(_0x13b2('0x6'));module['exports']=function(_0x4ce99d,_0x272a48){return _0x4ce99d[_0x13b2('0x7')](_0x13b2('0x8'),attributes,{'tableName':_0x13b2('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/whatsappQueue/whatsappQueue.rpc.js b/server/api/whatsappQueue/whatsappQueue.rpc.js index 97296d1..6cc74ed 100644 --- a/server/api/whatsappQueue/whatsappQueue.rpc.js +++ b/server/api/whatsappQueue/whatsappQueue.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x4030=['WhatsappQueue','findAll','options','raw','where','attributes','limit','map','include','model','then','GetWhatsappQueue','ShowWhatsappQueue','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/logger','client','http','defaults','localhost','socket.io-emitter','redis','register','request','info','request\x20sent','debug','WhatsappQueue,\x20%s,\x20%s,\x20%s','stringify','error','WhatsappQueue,\x20%s,\x20%s','message','result','catch'];(function(_0x2eeba0,_0x513537){var _0x6270d0=function(_0x474d5e){while(--_0x474d5e){_0x2eeba0['push'](_0x2eeba0['shift']());}};_0x6270d0(++_0x513537);}(_0x4030,0x189));var _0x0403=function(_0x5c0232,_0x1c449f){_0x5c0232=_0x5c0232-0x0;var _0x589366=_0x4030[_0x5c0232];return _0x589366;};'use strict';var _=require(_0x0403('0x0'));var util=require(_0x0403('0x1'));var moment=require(_0x0403('0x2'));var BPromise=require(_0x0403('0x3'));var rs=require(_0x0403('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x0403('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x0403('0x6'))('rpc');var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x0403('0x7')][_0x0403('0x8')]({'port':0x232a});config['redis']=_[_0x0403('0x9')](config['redis'],{'host':_0x0403('0xa'),'port':0x18eb});var socket=require(_0x0403('0xb'))(new Redis(config[_0x0403('0xc')]));require('./whatsappQueue.socket')[_0x0403('0xd')](socket);function respondWithRpcPromise(_0x2eaafe,_0x29b522,_0x22b907){return new BPromise(function(_0x2a4b55,_0x280c94){return client[_0x0403('0xe')](_0x2eaafe,_0x22b907)['then'](function(_0x22f063){logger[_0x0403('0xf')]('WhatsappQueue,\x20%s,\x20%s',_0x29b522,_0x0403('0x10'));logger[_0x0403('0x11')](_0x0403('0x12'),_0x29b522,_0x0403('0x10'),JSON[_0x0403('0x13')](_0x22f063));if(_0x22f063['error']){if(_0x22f063[_0x0403('0x14')]['code']===0x1f4){logger['error'](_0x0403('0x15'),_0x29b522,_0x22f063['error'][_0x0403('0x16')]);return _0x280c94(_0x22f063[_0x0403('0x14')][_0x0403('0x16')]);}logger[_0x0403('0x14')]('WhatsappQueue,\x20%s,\x20%s',_0x29b522,_0x22f063[_0x0403('0x14')][_0x0403('0x16')]);return _0x2a4b55(_0x22f063[_0x0403('0x14')][_0x0403('0x16')]);}else{logger[_0x0403('0xf')](_0x0403('0x15'),_0x29b522,'request\x20sent');_0x2a4b55(_0x22f063[_0x0403('0x17')][_0x0403('0x16')]);}})[_0x0403('0x18')](function(_0x4b933b){logger[_0x0403('0x14')](_0x0403('0x15'),_0x29b522,_0x4b933b);_0x280c94(_0x4b933b);});});}exports['GetWhatsappQueue']=function(_0x341b5a){var _0x404aac=this;return new Promise(function(_0x33674b,_0x5e38a9){return db[_0x0403('0x19')][_0x0403('0x1a')]({'raw':_0x341b5a[_0x0403('0x1b')]?_0x341b5a['options'][_0x0403('0x1c')]===undefined?!![]:![]:!![],'where':_0x341b5a[_0x0403('0x1b')]?_0x341b5a[_0x0403('0x1b')][_0x0403('0x1d')]||null:null,'attributes':_0x341b5a[_0x0403('0x1b')]?_0x341b5a[_0x0403('0x1b')][_0x0403('0x1e')]||null:null,'limit':_0x341b5a[_0x0403('0x1b')]?_0x341b5a[_0x0403('0x1b')][_0x0403('0x1f')]||null:null,'include':_0x341b5a[_0x0403('0x1b')]?_0x341b5a[_0x0403('0x1b')]['include']?_[_0x0403('0x20')](_0x341b5a[_0x0403('0x1b')][_0x0403('0x21')],function(_0x17d01d){return{'model':db[_0x17d01d[_0x0403('0x22')]],'as':_0x17d01d['as'],'attributes':_0x17d01d['attributes'],'include':_0x17d01d[_0x0403('0x21')]?_['map'](_0x17d01d['include'],function(_0x39754a){return{'model':db[_0x39754a[_0x0403('0x22')]],'as':_0x39754a['as'],'attributes':_0x39754a[_0x0403('0x1e')],'include':_0x39754a[_0x0403('0x21')]?_['map'](_0x39754a['include'],function(_0x1aaf53){return{'model':db[_0x1aaf53[_0x0403('0x22')]],'as':_0x1aaf53['as'],'attributes':_0x1aaf53[_0x0403('0x1e')]};}):[]};}):[]};}):[]:[]})[_0x0403('0x23')](function(_0xc88db1){logger[_0x0403('0xf')]('GetWhatsappQueue',_0x341b5a);logger[_0x0403('0x11')](_0x0403('0x24'),_0x341b5a,JSON['stringify'](_0xc88db1));_0x33674b(_0xc88db1);})[_0x0403('0x18')](function(_0x1bf1ce){logger[_0x0403('0x14')](_0x0403('0x24'),_0x1bf1ce[_0x0403('0x16')],_0x341b5a);_0x5e38a9(_0x404aac[_0x0403('0x14')](0x1f4,_0x1bf1ce[_0x0403('0x16')]));});});};exports[_0x0403('0x25')]=function(_0xeffba4){var _0x1016ce=this;return new Promise(function(_0x88af51,_0x4134f5){return db['WhatsappQueue']['find']({'raw':_0xeffba4['options']?_0xeffba4['options'][_0x0403('0x1c')]===undefined?!![]:![]:!![],'where':_0xeffba4[_0x0403('0x1b')]?_0xeffba4[_0x0403('0x1b')][_0x0403('0x1d')]||null:null,'attributes':_0xeffba4[_0x0403('0x1b')]?_0xeffba4['options'][_0x0403('0x1e')]||null:null,'include':_0xeffba4[_0x0403('0x1b')]?_0xeffba4[_0x0403('0x1b')][_0x0403('0x21')]?_[_0x0403('0x20')](_0xeffba4[_0x0403('0x1b')][_0x0403('0x21')],function(_0x51830f){return{'model':db[_0x51830f[_0x0403('0x22')]],'as':_0x51830f['as'],'attributes':_0x51830f[_0x0403('0x1e')],'include':_0x51830f[_0x0403('0x21')]?_[_0x0403('0x20')](_0x51830f[_0x0403('0x21')],function(_0x3af8d6){return{'model':db[_0x3af8d6[_0x0403('0x22')]],'as':_0x3af8d6['as'],'attributes':_0x3af8d6[_0x0403('0x1e')],'include':_0x3af8d6[_0x0403('0x21')]?_[_0x0403('0x20')](_0x3af8d6['include'],function(_0x351165){return{'model':db[_0x351165[_0x0403('0x22')]],'as':_0x351165['as'],'attributes':_0x351165['attributes']};}):[]};}):[]};}):[]:[]})[_0x0403('0x23')](function(_0x346a28){logger[_0x0403('0xf')]('ShowWhatsappQueue',_0xeffba4);logger['debug']('ShowWhatsappQueue',_0xeffba4,JSON[_0x0403('0x13')](_0x346a28));_0x88af51(_0x346a28);})[_0x0403('0x18')](function(_0x30db8e){logger['error']('ShowWhatsappQueue',_0x30db8e[_0x0403('0x16')],_0xeffba4);_0x4134f5(_0x1016ce[_0x0403('0x14')](0x1f4,_0x30db8e[_0x0403('0x16')]));});});}; \ No newline at end of file +var _0xdf1d=['rpc','../../config/environment','jayson/promise','http','defaults','redis','localhost','socket.io-emitter','./whatsappQueue.socket','request','then','debug','WhatsappQueue,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','WhatsappQueue,\x20%s,\x20%s','message','catch','GetWhatsappQueue','WhatsappQueue','findAll','options','where','attributes','limit','include','map','model','info','ShowWhatsappQueue','find','raw','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils'];(function(_0x595406,_0x1fc25b){var _0x4bc4c4=function(_0x477a3f){while(--_0x477a3f){_0x595406['push'](_0x595406['shift']());}};_0x4bc4c4(++_0x1fc25b);}(_0xdf1d,0x1c6));var _0xddf1=function(_0x167cc1,_0x56ef5a){_0x167cc1=_0x167cc1-0x0;var _0x10bc4b=_0xdf1d[_0x167cc1];return _0x10bc4b;};'use strict';var _=require(_0xddf1('0x0'));var util=require(_0xddf1('0x1'));var moment=require(_0xddf1('0x2'));var BPromise=require(_0xddf1('0x3'));var rs=require(_0xddf1('0x4'));var fs=require('fs');var Redis=require(_0xddf1('0x5'));var db=require(_0xddf1('0x6'))['db'];var utils=require(_0xddf1('0x7'));var logger=require('../../config/logger')(_0xddf1('0x8'));var config=require(_0xddf1('0x9'));var jayson=require(_0xddf1('0xa'));var client=jayson['client'][_0xddf1('0xb')]({'port':0x232a});config['redis']=_[_0xddf1('0xc')](config[_0xddf1('0xd')],{'host':_0xddf1('0xe'),'port':0x18eb});var socket=require(_0xddf1('0xf'))(new Redis(config[_0xddf1('0xd')]));require(_0xddf1('0x10'))['register'](socket);function respondWithRpcPromise(_0x3629d4,_0x3be0ad,_0x218d4c){return new BPromise(function(_0x29aecc,_0x44e232){return client[_0xddf1('0x11')](_0x3629d4,_0x218d4c)[_0xddf1('0x12')](function(_0x23f36b){logger['info']('WhatsappQueue,\x20%s,\x20%s',_0x3be0ad,'request\x20sent');logger[_0xddf1('0x13')](_0xddf1('0x14'),_0x3be0ad,_0xddf1('0x15'),JSON[_0xddf1('0x16')](_0x23f36b));if(_0x23f36b[_0xddf1('0x17')]){if(_0x23f36b[_0xddf1('0x17')][_0xddf1('0x18')]===0x1f4){logger['error'](_0xddf1('0x19'),_0x3be0ad,_0x23f36b['error'][_0xddf1('0x1a')]);return _0x44e232(_0x23f36b[_0xddf1('0x17')]['message']);}logger[_0xddf1('0x17')](_0xddf1('0x19'),_0x3be0ad,_0x23f36b[_0xddf1('0x17')][_0xddf1('0x1a')]);return _0x29aecc(_0x23f36b[_0xddf1('0x17')][_0xddf1('0x1a')]);}else{logger['info'](_0xddf1('0x19'),_0x3be0ad,_0xddf1('0x15'));_0x29aecc(_0x23f36b['result'][_0xddf1('0x1a')]);}})[_0xddf1('0x1b')](function(_0x3a7845){logger[_0xddf1('0x17')](_0xddf1('0x19'),_0x3be0ad,_0x3a7845);_0x44e232(_0x3a7845);});});}exports[_0xddf1('0x1c')]=function(_0x3d3b76){var _0x106dfb=this;return new Promise(function(_0x4ea45f,_0xa626ef){return db[_0xddf1('0x1d')][_0xddf1('0x1e')]({'raw':_0x3d3b76[_0xddf1('0x1f')]?_0x3d3b76[_0xddf1('0x1f')]['raw']===undefined?!![]:![]:!![],'where':_0x3d3b76[_0xddf1('0x1f')]?_0x3d3b76['options'][_0xddf1('0x20')]||null:null,'attributes':_0x3d3b76[_0xddf1('0x1f')]?_0x3d3b76['options'][_0xddf1('0x21')]||null:null,'limit':_0x3d3b76['options']?_0x3d3b76[_0xddf1('0x1f')][_0xddf1('0x22')]||null:null,'include':_0x3d3b76['options']?_0x3d3b76[_0xddf1('0x1f')][_0xddf1('0x23')]?_[_0xddf1('0x24')](_0x3d3b76[_0xddf1('0x1f')][_0xddf1('0x23')],function(_0x162a7b){return{'model':db[_0x162a7b[_0xddf1('0x25')]],'as':_0x162a7b['as'],'attributes':_0x162a7b[_0xddf1('0x21')],'include':_0x162a7b[_0xddf1('0x23')]?_['map'](_0x162a7b['include'],function(_0x2ec350){return{'model':db[_0x2ec350[_0xddf1('0x25')]],'as':_0x2ec350['as'],'attributes':_0x2ec350[_0xddf1('0x21')],'include':_0x2ec350['include']?_[_0xddf1('0x24')](_0x2ec350[_0xddf1('0x23')],function(_0x4b6040){return{'model':db[_0x4b6040[_0xddf1('0x25')]],'as':_0x4b6040['as'],'attributes':_0x4b6040[_0xddf1('0x21')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x3c2eee){logger[_0xddf1('0x26')](_0xddf1('0x1c'),_0x3d3b76);logger[_0xddf1('0x13')]('GetWhatsappQueue',_0x3d3b76,JSON[_0xddf1('0x16')](_0x3c2eee));_0x4ea45f(_0x3c2eee);})[_0xddf1('0x1b')](function(_0x786959){logger[_0xddf1('0x17')](_0xddf1('0x1c'),_0x786959['message'],_0x3d3b76);_0xa626ef(_0x106dfb[_0xddf1('0x17')](0x1f4,_0x786959[_0xddf1('0x1a')]));});});};exports[_0xddf1('0x27')]=function(_0x4beb2a){var _0x549e29=this;return new Promise(function(_0x304fbe,_0x4206b7){return db[_0xddf1('0x1d')][_0xddf1('0x28')]({'raw':_0x4beb2a[_0xddf1('0x1f')]?_0x4beb2a[_0xddf1('0x1f')][_0xddf1('0x29')]===undefined?!![]:![]:!![],'where':_0x4beb2a['options']?_0x4beb2a['options']['where']||null:null,'attributes':_0x4beb2a['options']?_0x4beb2a[_0xddf1('0x1f')][_0xddf1('0x21')]||null:null,'include':_0x4beb2a[_0xddf1('0x1f')]?_0x4beb2a['options'][_0xddf1('0x23')]?_[_0xddf1('0x24')](_0x4beb2a[_0xddf1('0x1f')][_0xddf1('0x23')],function(_0x458f58){return{'model':db[_0x458f58['model']],'as':_0x458f58['as'],'attributes':_0x458f58['attributes'],'include':_0x458f58[_0xddf1('0x23')]?_[_0xddf1('0x24')](_0x458f58[_0xddf1('0x23')],function(_0x195d89){return{'model':db[_0x195d89['model']],'as':_0x195d89['as'],'attributes':_0x195d89[_0xddf1('0x21')],'include':_0x195d89['include']?_['map'](_0x195d89[_0xddf1('0x23')],function(_0x5eefa9){return{'model':db[_0x5eefa9[_0xddf1('0x25')]],'as':_0x5eefa9['as'],'attributes':_0x5eefa9[_0xddf1('0x21')]};}):[]};}):[]};}):[]:[]})[_0xddf1('0x12')](function(_0x5d3a00){logger[_0xddf1('0x26')](_0xddf1('0x27'),_0x4beb2a);logger[_0xddf1('0x13')](_0xddf1('0x27'),_0x4beb2a,JSON[_0xddf1('0x16')](_0x5d3a00));_0x304fbe(_0x5d3a00);})['catch'](function(_0x13ee58){logger[_0xddf1('0x17')](_0xddf1('0x27'),_0x13ee58[_0xddf1('0x1a')],_0x4beb2a);_0x4206b7(_0x549e29['error'](0x1f4,_0x13ee58[_0xddf1('0x1a')]));});});}; \ No newline at end of file diff --git a/server/api/whatsappQueue/whatsappQueue.socket.js b/server/api/whatsappQueue/whatsappQueue.socket.js index b76845a..1c01827 100644 --- a/server/api/whatsappQueue/whatsappQueue.socket.js +++ b/server/api/whatsappQueue/whatsappQueue.socket.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xf881=['whatsappQueue:','./whatsappQueue.events','save','emit','removeListener'];(function(_0xe72729,_0x503951){var _0x3f679b=function(_0x58939f){while(--_0x58939f){_0xe72729['push'](_0xe72729['shift']());}};_0x3f679b(++_0x503951);}(_0xf881,0x10a));var _0x1f88=function(_0x3f0a7c,_0x16edda){_0x3f0a7c=_0x3f0a7c-0x0;var _0x2b3a28=_0xf881[_0x3f0a7c];return _0x2b3a28;};'use strict';var WhatsappQueueEvents=require(_0x1f88('0x0'));var events=[_0x1f88('0x1'),'remove','update'];function createListener(_0x1eb289,_0x50d577){return function(_0x42e1e2){_0x50d577[_0x1f88('0x2')](_0x1eb289,_0x42e1e2);};}function removeListener(_0x2eb88a,_0x59c293){return function(){WhatsappQueueEvents[_0x1f88('0x3')](_0x2eb88a,_0x59c293);};}exports['register']=function(_0x280337){for(var _0x338927=0x0,_0x1f49b5=events['length'];_0x338927<_0x1f49b5;_0x338927++){var _0x14f095=events[_0x338927];var _0x598404=createListener(_0x1f88('0x4')+_0x14f095,_0x280337);WhatsappQueueEvents['on'](_0x14f095,_0x598404);}}; \ No newline at end of file +var _0xfc45=['register','length','whatsappQueue:','remove','update','emit'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0xfc45,0x16b));var _0x5fc4=function(_0x17e955,_0x5015fa){_0x17e955=_0x17e955-0x0;var _0x5cdb63=_0xfc45[_0x17e955];return _0x5cdb63;};'use strict';var WhatsappQueueEvents=require('./whatsappQueue.events');var events=['save',_0x5fc4('0x0'),_0x5fc4('0x1')];function createListener(_0x24ff93,_0x2958f){return function(_0x55fead){_0x2958f[_0x5fc4('0x2')](_0x24ff93,_0x55fead);};}function removeListener(_0x59017d,_0x1d0b33){return function(){WhatsappQueueEvents['removeListener'](_0x59017d,_0x1d0b33);};}exports[_0x5fc4('0x3')]=function(_0x11c0ed){for(var _0x38823a=0x0,_0x6f7f92=events[_0x5fc4('0x4')];_0x38823a<_0x6f7f92;_0x38823a++){var _0x294794=events[_0x38823a];var _0x125907=createListener(_0x5fc4('0x5')+_0x294794,_0x11c0ed);WhatsappQueueEvents['on'](_0x294794,_0x125907);}}; \ No newline at end of file diff --git a/server/api/whatsappQueueReport/index.js b/server/api/whatsappQueueReport/index.js index 0853972..3a7f4da 100644 --- a/server/api/whatsappQueueReport/index.js +++ b/server/api/whatsappQueueReport/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x508a=['create','put','/:id','delete','destroy','exports','multer','path','connect-timeout','express','Router','../../components/auth/service','../../config/environment','./whatsappQueueReport.controller','get','index','/describe','describe','isAuthenticated','show'];(function(_0x1d740a,_0x547683){var _0x1ed34f=function(_0x3243b1){while(--_0x3243b1){_0x1d740a['push'](_0x1d740a['shift']());}};_0x1ed34f(++_0x547683);}(_0x508a,0x1aa));var _0xa508=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x508a[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require(_0xa508('0x0'));var util=require('util');var path=require(_0xa508('0x1'));var timeout=require(_0xa508('0x2'));var express=require(_0xa508('0x3'));var router=express[_0xa508('0x4')]();var auth=require(_0xa508('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0xa508('0x6'));var controller=require(_0xa508('0x7'));router[_0xa508('0x8')]('/',auth['isAuthenticated'](),controller[_0xa508('0x9')]);router[_0xa508('0x8')](_0xa508('0xa'),auth['isAuthenticated'](),controller[_0xa508('0xb')]);router[_0xa508('0x8')]('/:id',auth[_0xa508('0xc')](),controller[_0xa508('0xd')]);router['post']('/',auth[_0xa508('0xc')](),controller[_0xa508('0xe')]);router[_0xa508('0xf')](_0xa508('0x10'),auth[_0xa508('0xc')](),controller['update']);router[_0xa508('0x11')](_0xa508('0x10'),auth['isAuthenticated'](),controller[_0xa508('0x12')]);module[_0xa508('0x13')]=router; \ No newline at end of file +var _0xcbd7=['connect-timeout','Router','../../components/auth/service','../../components/interaction/service','./whatsappQueueReport.controller','get','isAuthenticated','/describe','describe','/:id','create','put','update','delete','destroy','exports','util'];(function(_0xd444ca,_0x3e2485){var _0x7e451e=function(_0x5ea443){while(--_0x5ea443){_0xd444ca['push'](_0xd444ca['shift']());}};_0x7e451e(++_0x3e2485);}(_0xcbd7,0x197));var _0x7cbd=function(_0x757be8,_0xfe75e5){_0x757be8=_0x757be8-0x0;var _0x3c338e=_0xcbd7[_0x757be8];return _0x3c338e;};'use strict';var multer=require('multer');var util=require(_0x7cbd('0x0'));var path=require('path');var timeout=require(_0x7cbd('0x1'));var express=require('express');var router=express[_0x7cbd('0x2')]();var auth=require(_0x7cbd('0x3'));var interaction=require(_0x7cbd('0x4'));var config=require('../../config/environment');var controller=require(_0x7cbd('0x5'));router[_0x7cbd('0x6')]('/',auth[_0x7cbd('0x7')](),controller['index']);router[_0x7cbd('0x6')](_0x7cbd('0x8'),auth[_0x7cbd('0x7')](),controller[_0x7cbd('0x9')]);router[_0x7cbd('0x6')](_0x7cbd('0xa'),auth['isAuthenticated'](),controller['show']);router['post']('/',auth[_0x7cbd('0x7')](),controller[_0x7cbd('0xb')]);router[_0x7cbd('0xc')](_0x7cbd('0xa'),auth['isAuthenticated'](),controller[_0x7cbd('0xd')]);router[_0x7cbd('0xe')]('/:id',auth[_0x7cbd('0x7')](),controller[_0x7cbd('0xf')]);module[_0x7cbd('0x10')]=router; \ No newline at end of file diff --git a/server/api/whatsappQueueReport/whatsappQueueReport.attributes.js b/server/api/whatsappQueueReport/whatsappQueueReport.attributes.js index 2e976e0..67b4361 100644 --- a/server/api/whatsappQueueReport/whatsappQueueReport.attributes.js +++ b/server/api/whatsappQueueReport/whatsappQueueReport.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x55ca=['DATE','STRING','sequelize','exports'];(function(_0x1036e8,_0x1a7553){var _0x30e171=function(_0x103b4f){while(--_0x103b4f){_0x1036e8['push'](_0x1036e8['shift']());}};_0x30e171(++_0x1a7553);}(_0x55ca,0x126));var _0xa55c=function(_0x15f27e,_0x547fea){_0x15f27e=_0x15f27e-0x0;var _0x18da4f=_0x55ca[_0x15f27e];return _0x18da4f;};'use strict';var Sequelize=require(_0xa55c('0x0'));module[_0xa55c('0x1')]={'uniqueid':{'type':Sequelize['STRING'],'allowNull':![]},'from':{'type':Sequelize['STRING']},'joinAt':{'type':Sequelize['DATE']},'leaveAt':{'type':Sequelize[_0xa55c('0x2')]},'acceptAt':{'type':Sequelize[_0xa55c('0x2')]},'exitAt':{'type':Sequelize['DATE']},'reason':{'type':Sequelize[_0xa55c('0x3')]}}; \ No newline at end of file +var _0xedd9=['exports','STRING','DATE'];(function(_0x48cb3b,_0x770492){var _0x2414f0=function(_0x125c23){while(--_0x125c23){_0x48cb3b['push'](_0x48cb3b['shift']());}};_0x2414f0(++_0x770492);}(_0xedd9,0xfc));var _0x9edd=function(_0x3f2fea,_0x3c4ea8){_0x3f2fea=_0x3f2fea-0x0;var _0x69a4d5=_0xedd9[_0x3f2fea];return _0x69a4d5;};'use strict';var Sequelize=require('sequelize');module[_0x9edd('0x0')]={'uniqueid':{'type':Sequelize[_0x9edd('0x1')],'allowNull':![]},'from':{'type':Sequelize[_0x9edd('0x1')]},'joinAt':{'type':Sequelize[_0x9edd('0x2')]},'leaveAt':{'type':Sequelize[_0x9edd('0x2')]},'acceptAt':{'type':Sequelize[_0x9edd('0x2')]},'exitAt':{'type':Sequelize[_0x9edd('0x2')]},'reason':{'type':Sequelize[_0x9edd('0x1')]}}; \ No newline at end of file diff --git a/server/api/whatsappQueueReport/whatsappQueueReport.controller.js b/server/api/whatsappQueueReport/whatsappQueueReport.controller.js index 93496b7..d4c3938 100644 --- a/server/api/whatsappQueueReport/whatsappQueueReport.controller.js +++ b/server/api/whatsappQueueReport/whatsappQueueReport.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x8921=['bluebird','mustache','util','path','sox','to-csv','ejs','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','count','offset','set','json','apply','reject','save','destroy','then','error','stack','name','send','index','map','rawAttributes','fieldName','type','key','query','keys','filters','intersection','model','fields','attributes','length','hasOwnProperty','nolimit','limit','order','sort','where','pick','filter','VIRTUAL','merge','options','WhatsappQueueReport','includeAll','findAll','rows','catch','show','find','create','update','body','params','describe','html-pdf','rimraf','zip-dir','fast-json-patch','request-promise','moment'];(function(_0x13d07a,_0x41efc3){var _0x5ee0ee=function(_0x4ca94a){while(--_0x4ca94a){_0x13d07a['push'](_0x13d07a['shift']());}};_0x5ee0ee(++_0x41efc3);}(_0x8921,0x9a));var _0x1892=function(_0x5a7405,_0x8ac3bd){_0x5a7405=_0x5a7405-0x0;var _0x2dc4b3=_0x8921[_0x5a7405];return _0x2dc4b3;};'use strict';var pdf=require(_0x1892('0x0'));var emlformat=require('eml-format');var rimraf=require(_0x1892('0x1'));var zipdir=require(_0x1892('0x2'));var jsonpatch=require(_0x1892('0x3'));var rp=require(_0x1892('0x4'));var moment=require(_0x1892('0x5'));var BPromise=require(_0x1892('0x6'));var Mustache=require(_0x1892('0x7'));var util=require(_0x1892('0x8'));var path=require(_0x1892('0x9'));var sox=require(_0x1892('0xa'));var csv=require(_0x1892('0xb'));var ejs=require(_0x1892('0xc'));var fs=require('fs');var _=require('lodash');var squel=require(_0x1892('0xd'));var crypto=require(_0x1892('0xe'));var jsforce=require(_0x1892('0xf'));var deskjs=require(_0x1892('0x10'));var toCsv=require(_0x1892('0xb'));var querystring=require(_0x1892('0x11'));var Papa=require('papaparse');var Redis=require(_0x1892('0x12'));var authService=require(_0x1892('0x13'));var qs=require(_0x1892('0x14'));var as=require(_0x1892('0x15'));var hardwareService=require(_0x1892('0x16'));var logger=require(_0x1892('0x17'))(_0x1892('0x18'));var utils=require(_0x1892('0x19'));var config=require(_0x1892('0x1a'));var db=require(_0x1892('0x1b'))['db'];function respondWithStatusCode(_0xe5ef78,_0x5b8534){_0x5b8534=_0x5b8534||0xcc;return function(_0x9437fc){if(_0x9437fc){return _0xe5ef78[_0x1892('0x1c')](_0x5b8534);}return _0xe5ef78[_0x1892('0x1d')](_0x5b8534)['end']();};}function respondWithResult(_0x474d22,_0xeb57f7){_0xeb57f7=_0xeb57f7||0xc8;return function(_0xdfdecf){if(_0xdfdecf){return _0x474d22[_0x1892('0x1d')](_0xeb57f7)['json'](_0xdfdecf);}};}function respondWithFilteredResult(_0x5e436d,_0x934968){return function(_0x4b15ec){if(_0x4b15ec){var _0x1fafe1=_0x4b15ec[_0x1892('0x1e')],_0x4b3757=_0x934968[_0x1892('0x1f')],_0x10b5f7=_0x934968[_0x1892('0x1f')]+_0x934968['limit'],_0x425251;if(_0x10b5f7>=_0x1fafe1){_0x10b5f7=_0x1fafe1;_0x425251=0xc8;}else{_0x425251=0xce;}_0x5e436d['status'](_0x425251);return _0x5e436d[_0x1892('0x20')]('Content-Range',_0x4b3757+'-'+_0x10b5f7+'/'+_0x1fafe1)[_0x1892('0x21')](_0x4b15ec);}return null;};}function patchUpdates(_0x5f29b5){return function(_0x11c2e6){try{jsonpatch[_0x1892('0x22')](_0x11c2e6,_0x5f29b5,!![]);}catch(_0x4c2e74){return BPromise[_0x1892('0x23')](_0x4c2e74);}return _0x11c2e6[_0x1892('0x24')]();};}function saveUpdates(_0x41bfd9,_0xf4d237){return function(_0x55b410){if(_0x55b410){return _0x55b410['update'](_0x41bfd9)['then'](function(_0x3f5759){return _0x3f5759;});}return null;};}function removeEntity(_0x1fd123,_0x48ca15){return function(_0xa9a3e0){if(_0xa9a3e0){return _0xa9a3e0[_0x1892('0x25')]()[_0x1892('0x26')](function(){_0x1fd123[_0x1892('0x1d')](0xcc)['end']();});}};}function handleEntityNotFound(_0xff60d4,_0x3d7da3){return function(_0x2fc141){if(!_0x2fc141){_0xff60d4[_0x1892('0x1c')](0x194);}return _0x2fc141;};}function handleError(_0x573e5e,_0x8e9dd4){_0x8e9dd4=_0x8e9dd4||0x1f4;return function(_0x17ed21){logger[_0x1892('0x27')](_0x17ed21[_0x1892('0x28')]);if(_0x17ed21[_0x1892('0x29')]){delete _0x17ed21[_0x1892('0x29')];}_0x573e5e[_0x1892('0x1d')](_0x8e9dd4)[_0x1892('0x2a')](_0x17ed21);};}exports[_0x1892('0x2b')]=function(_0x2c3465,_0x2a40ba){var _0x5bbcf1={},_0x1cbe0f={},_0x280a18={'count':0x0,'rows':[]};var _0x5a2f70=_[_0x1892('0x2c')](db['WhatsappQueueReport'][_0x1892('0x2d')],function(_0x1ca4db){return{'name':_0x1ca4db[_0x1892('0x2e')],'type':_0x1ca4db[_0x1892('0x2f')][_0x1892('0x30')]};});_0x1cbe0f['model']=_[_0x1892('0x2c')](_0x5a2f70,_0x1892('0x29'));_0x1cbe0f[_0x1892('0x31')]=_[_0x1892('0x32')](_0x2c3465[_0x1892('0x31')]);_0x1cbe0f[_0x1892('0x33')]=_[_0x1892('0x34')](_0x1cbe0f[_0x1892('0x35')],_0x1cbe0f[_0x1892('0x31')]);_0x5bbcf1['attributes']=_['intersection'](_0x1cbe0f['model'],qs[_0x1892('0x36')](_0x2c3465[_0x1892('0x31')]['fields']));_0x5bbcf1['attributes']=_0x5bbcf1[_0x1892('0x37')][_0x1892('0x38')]?_0x5bbcf1['attributes']:_0x1cbe0f[_0x1892('0x35')];if(!_0x2c3465[_0x1892('0x31')][_0x1892('0x39')](_0x1892('0x3a'))){_0x5bbcf1['limit']=qs[_0x1892('0x3b')](_0x2c3465[_0x1892('0x31')]['limit']);_0x5bbcf1[_0x1892('0x1f')]=qs['offset'](_0x2c3465['query'][_0x1892('0x1f')]);}_0x5bbcf1[_0x1892('0x3c')]=qs['sort'](_0x2c3465[_0x1892('0x31')][_0x1892('0x3d')]);_0x5bbcf1[_0x1892('0x3e')]=qs[_0x1892('0x33')](_[_0x1892('0x3f')](_0x2c3465[_0x1892('0x31')],_0x1cbe0f[_0x1892('0x33')]),_0x5a2f70);if(_0x2c3465[_0x1892('0x31')][_0x1892('0x40')]){_0x5bbcf1[_0x1892('0x3e')]=_['merge'](_0x5bbcf1[_0x1892('0x3e')],{'$or':_[_0x1892('0x2c')](_0x5a2f70,function(_0x1ac7bd){if(_0x1ac7bd['type']!==_0x1892('0x41')){var _0xfc18b4={};_0xfc18b4[_0x1ac7bd[_0x1892('0x29')]]={'$like':'%'+_0x2c3465[_0x1892('0x31')]['filter']+'%'};return _0xfc18b4;}})});}_0x5bbcf1=_[_0x1892('0x42')]({},_0x5bbcf1,_0x2c3465[_0x1892('0x43')]);var _0x128faf={'where':_0x5bbcf1[_0x1892('0x3e')]};return db[_0x1892('0x44')][_0x1892('0x1e')](_0x128faf)[_0x1892('0x26')](function(_0x89e8d5){_0x280a18[_0x1892('0x1e')]=_0x89e8d5;if(_0x2c3465[_0x1892('0x31')][_0x1892('0x45')]){_0x5bbcf1['include']=[{'all':!![]}];}return db[_0x1892('0x44')][_0x1892('0x46')](_0x5bbcf1);})[_0x1892('0x26')](function(_0xd4936a){_0x280a18[_0x1892('0x47')]=_0xd4936a;return _0x280a18;})[_0x1892('0x26')](respondWithFilteredResult(_0x2a40ba,_0x5bbcf1))[_0x1892('0x48')](handleError(_0x2a40ba,null));};exports[_0x1892('0x49')]=function(_0x2d654d,_0x3ae8b6){var _0x2ded54={'raw':!![],'where':{'id':_0x2d654d['params']['id']}},_0x30db96={};_0x30db96['model']=_['keys'](db['WhatsappQueueReport']['rawAttributes']);_0x30db96[_0x1892('0x31')]=_['keys'](_0x2d654d[_0x1892('0x31')]);_0x30db96['filters']=_[_0x1892('0x34')](_0x30db96[_0x1892('0x35')],_0x30db96[_0x1892('0x31')]);_0x2ded54[_0x1892('0x37')]=_[_0x1892('0x34')](_0x30db96[_0x1892('0x35')],qs[_0x1892('0x36')](_0x2d654d[_0x1892('0x31')][_0x1892('0x36')]));_0x2ded54[_0x1892('0x37')]=_0x2ded54[_0x1892('0x37')][_0x1892('0x38')]?_0x2ded54[_0x1892('0x37')]:_0x30db96['model'];if(_0x2d654d[_0x1892('0x31')]['includeAll']){_0x2ded54['include']=[{'all':!![]}];}_0x2ded54=_[_0x1892('0x42')]({},_0x2ded54,_0x2d654d['options']);return db[_0x1892('0x44')][_0x1892('0x4a')](_0x2ded54)[_0x1892('0x26')](handleEntityNotFound(_0x3ae8b6,null))[_0x1892('0x26')](respondWithResult(_0x3ae8b6,null))['catch'](handleError(_0x3ae8b6,null));};exports['create']=function(_0x11ab70,_0x68b91e){return db['WhatsappQueueReport'][_0x1892('0x4b')](_0x11ab70['body'],{})[_0x1892('0x26')](respondWithResult(_0x68b91e,0xc9))[_0x1892('0x48')](handleError(_0x68b91e,null));};exports[_0x1892('0x4c')]=function(_0x150612,_0x3f9135){if(_0x150612['body']['id']){delete _0x150612[_0x1892('0x4d')]['id'];}return db['WhatsappQueueReport']['find']({'where':{'id':_0x150612[_0x1892('0x4e')]['id']}})[_0x1892('0x26')](handleEntityNotFound(_0x3f9135,null))[_0x1892('0x26')](saveUpdates(_0x150612[_0x1892('0x4d')],null))[_0x1892('0x26')](respondWithResult(_0x3f9135,null))[_0x1892('0x48')](handleError(_0x3f9135,null));};exports[_0x1892('0x25')]=function(_0x580a40,_0x16b5bc){return db[_0x1892('0x44')][_0x1892('0x4a')]({'where':{'id':_0x580a40[_0x1892('0x4e')]['id']}})[_0x1892('0x26')](handleEntityNotFound(_0x16b5bc,null))[_0x1892('0x26')](removeEntity(_0x16b5bc,null))['catch'](handleError(_0x16b5bc,null));};exports[_0x1892('0x4f')]=function(_0x52fefe,_0x11efd5){return db[_0x1892('0x44')]['describe']()[_0x1892('0x26')](respondWithResult(_0x11efd5,null))[_0x1892('0x48')](handleError(_0x11efd5,null));}; \ No newline at end of file +var _0xc0d7=['squel','crypto','desk.js','to-csv','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../config/logger','api','../../config/environment','../../mysqldb','sendStatus','end','status','json','count','offset','limit','set','Content-Range','apply','reject','save','update','then','name','send','index','map','WhatsappQueueReport','type','key','model','query','intersection','fields','attributes','hasOwnProperty','order','sort','where','filters','pick','merge','filter','include','findAll','catch','show','params','keys','length','includeAll','create','body','find','describe','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','ejs','lodash'];(function(_0x3d3b05,_0x334c57){var _0x2c6ca3=function(_0x3fd1cc){while(--_0x3fd1cc){_0x3d3b05['push'](_0x3d3b05['shift']());}};_0x2c6ca3(++_0x334c57);}(_0xc0d7,0x7f));var _0x7c0d=function(_0x3cc9a9,_0x257aa7){_0x3cc9a9=_0x3cc9a9-0x0;var _0xe2cde8=_0xc0d7[_0x3cc9a9];return _0xe2cde8;};'use strict';var pdf=require('html-pdf');var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x7c0d('0x0'));var jsonpatch=require(_0x7c0d('0x1'));var rp=require(_0x7c0d('0x2'));var moment=require(_0x7c0d('0x3'));var BPromise=require(_0x7c0d('0x4'));var Mustache=require(_0x7c0d('0x5'));var util=require(_0x7c0d('0x6'));var path=require(_0x7c0d('0x7'));var sox=require(_0x7c0d('0x8'));var csv=require('to-csv');var ejs=require(_0x7c0d('0x9'));var fs=require('fs');var _=require(_0x7c0d('0xa'));var squel=require(_0x7c0d('0xb'));var crypto=require(_0x7c0d('0xc'));var jsforce=require('jsforce');var deskjs=require(_0x7c0d('0xd'));var toCsv=require(_0x7c0d('0xe'));var querystring=require(_0x7c0d('0xf'));var Papa=require(_0x7c0d('0x10'));var Redis=require('ioredis');var authService=require(_0x7c0d('0x11'));var qs=require(_0x7c0d('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x7c0d('0x13'))(_0x7c0d('0x14'));var utils=require('../../config/utils');var config=require(_0x7c0d('0x15'));var db=require(_0x7c0d('0x16'))['db'];function respondWithStatusCode(_0x31b829,_0x198dde){_0x198dde=_0x198dde||0xcc;return function(_0x41236d){if(_0x41236d){return _0x31b829[_0x7c0d('0x17')](_0x198dde);}return _0x31b829['status'](_0x198dde)[_0x7c0d('0x18')]();};}function respondWithResult(_0x3d2a6b,_0x2ee593){_0x2ee593=_0x2ee593||0xc8;return function(_0x25c4a8){if(_0x25c4a8){return _0x3d2a6b[_0x7c0d('0x19')](_0x2ee593)[_0x7c0d('0x1a')](_0x25c4a8);}};}function respondWithFilteredResult(_0x9c965b,_0x13f301){return function(_0x4a5fb4){if(_0x4a5fb4){var _0x340937=_0x4a5fb4[_0x7c0d('0x1b')],_0x4e9850=_0x13f301[_0x7c0d('0x1c')],_0x20bf75=_0x13f301[_0x7c0d('0x1c')]+_0x13f301[_0x7c0d('0x1d')],_0x571480;if(_0x20bf75>=_0x340937){_0x20bf75=_0x340937;_0x571480=0xc8;}else{_0x571480=0xce;}_0x9c965b[_0x7c0d('0x19')](_0x571480);return _0x9c965b[_0x7c0d('0x1e')](_0x7c0d('0x1f'),_0x4e9850+'-'+_0x20bf75+'/'+_0x340937)[_0x7c0d('0x1a')](_0x4a5fb4);}return null;};}function patchUpdates(_0x34f2ef){return function(_0xf0657e){try{jsonpatch[_0x7c0d('0x20')](_0xf0657e,_0x34f2ef,!![]);}catch(_0x2e3f30){return BPromise[_0x7c0d('0x21')](_0x2e3f30);}return _0xf0657e[_0x7c0d('0x22')]();};}function saveUpdates(_0x407f52,_0x12e19a){return function(_0x2f0ac0){if(_0x2f0ac0){return _0x2f0ac0[_0x7c0d('0x23')](_0x407f52)[_0x7c0d('0x24')](function(_0x5b6329){return _0x5b6329;});}return null;};}function removeEntity(_0x58f715,_0x5dae80){return function(_0x54b14f){if(_0x54b14f){return _0x54b14f['destroy']()[_0x7c0d('0x24')](function(){_0x58f715[_0x7c0d('0x19')](0xcc)[_0x7c0d('0x18')]();});}};}function handleEntityNotFound(_0x2f657e,_0x1ef191){return function(_0x2a92ce){if(!_0x2a92ce){_0x2f657e[_0x7c0d('0x17')](0x194);}return _0x2a92ce;};}function handleError(_0x5b4b2b,_0x42467f){_0x42467f=_0x42467f||0x1f4;return function(_0xb7d5e4){logger['error'](_0xb7d5e4['stack']);if(_0xb7d5e4[_0x7c0d('0x25')]){delete _0xb7d5e4['name'];}_0x5b4b2b[_0x7c0d('0x19')](_0x42467f)[_0x7c0d('0x26')](_0xb7d5e4);};}exports[_0x7c0d('0x27')]=function(_0x34309,_0x4625d0){var _0x5ea868={},_0x27fc36={},_0x197530={'count':0x0,'rows':[]};var _0x36a264=_[_0x7c0d('0x28')](db[_0x7c0d('0x29')]['rawAttributes'],function(_0x2b261){return{'name':_0x2b261['fieldName'],'type':_0x2b261[_0x7c0d('0x2a')][_0x7c0d('0x2b')]};});_0x27fc36[_0x7c0d('0x2c')]=_[_0x7c0d('0x28')](_0x36a264,_0x7c0d('0x25'));_0x27fc36[_0x7c0d('0x2d')]=_['keys'](_0x34309[_0x7c0d('0x2d')]);_0x27fc36['filters']=_[_0x7c0d('0x2e')](_0x27fc36[_0x7c0d('0x2c')],_0x27fc36['query']);_0x5ea868['attributes']=_[_0x7c0d('0x2e')](_0x27fc36['model'],qs[_0x7c0d('0x2f')](_0x34309[_0x7c0d('0x2d')]['fields']));_0x5ea868['attributes']=_0x5ea868['attributes']['length']?_0x5ea868[_0x7c0d('0x30')]:_0x27fc36['model'];if(!_0x34309[_0x7c0d('0x2d')][_0x7c0d('0x31')]('nolimit')){_0x5ea868[_0x7c0d('0x1d')]=qs[_0x7c0d('0x1d')](_0x34309[_0x7c0d('0x2d')][_0x7c0d('0x1d')]);_0x5ea868['offset']=qs[_0x7c0d('0x1c')](_0x34309[_0x7c0d('0x2d')][_0x7c0d('0x1c')]);}_0x5ea868[_0x7c0d('0x32')]=qs[_0x7c0d('0x33')](_0x34309[_0x7c0d('0x2d')][_0x7c0d('0x33')]);_0x5ea868[_0x7c0d('0x34')]=qs[_0x7c0d('0x35')](_[_0x7c0d('0x36')](_0x34309['query'],_0x27fc36[_0x7c0d('0x35')]),_0x36a264);if(_0x34309[_0x7c0d('0x2d')]['filter']){_0x5ea868[_0x7c0d('0x34')]=_[_0x7c0d('0x37')](_0x5ea868[_0x7c0d('0x34')],{'$or':_[_0x7c0d('0x28')](_0x36a264,function(_0x304606){if(_0x304606[_0x7c0d('0x2a')]!=='VIRTUAL'){var _0x2c8520={};_0x2c8520[_0x304606[_0x7c0d('0x25')]]={'$like':'%'+_0x34309[_0x7c0d('0x2d')][_0x7c0d('0x38')]+'%'};return _0x2c8520;}})});}_0x5ea868=_[_0x7c0d('0x37')]({},_0x5ea868,_0x34309['options']);var _0x5ccc68={'where':_0x5ea868[_0x7c0d('0x34')]};return db[_0x7c0d('0x29')]['count'](_0x5ccc68)[_0x7c0d('0x24')](function(_0x4c87d8){_0x197530[_0x7c0d('0x1b')]=_0x4c87d8;if(_0x34309[_0x7c0d('0x2d')]['includeAll']){_0x5ea868[_0x7c0d('0x39')]=[{'all':!![]}];}return db['WhatsappQueueReport'][_0x7c0d('0x3a')](_0x5ea868);})[_0x7c0d('0x24')](function(_0x5f5ba2){_0x197530['rows']=_0x5f5ba2;return _0x197530;})['then'](respondWithFilteredResult(_0x4625d0,_0x5ea868))[_0x7c0d('0x3b')](handleError(_0x4625d0,null));};exports[_0x7c0d('0x3c')]=function(_0x1ff57c,_0x1a08e6){var _0x5dc200={'raw':!![],'where':{'id':_0x1ff57c[_0x7c0d('0x3d')]['id']}},_0x5de55c={};_0x5de55c['model']=_['keys'](db[_0x7c0d('0x29')]['rawAttributes']);_0x5de55c[_0x7c0d('0x2d')]=_[_0x7c0d('0x3e')](_0x1ff57c['query']);_0x5de55c[_0x7c0d('0x35')]=_[_0x7c0d('0x2e')](_0x5de55c[_0x7c0d('0x2c')],_0x5de55c[_0x7c0d('0x2d')]);_0x5dc200[_0x7c0d('0x30')]=_['intersection'](_0x5de55c[_0x7c0d('0x2c')],qs[_0x7c0d('0x2f')](_0x1ff57c['query'][_0x7c0d('0x2f')]));_0x5dc200[_0x7c0d('0x30')]=_0x5dc200[_0x7c0d('0x30')][_0x7c0d('0x3f')]?_0x5dc200['attributes']:_0x5de55c[_0x7c0d('0x2c')];if(_0x1ff57c[_0x7c0d('0x2d')][_0x7c0d('0x40')]){_0x5dc200[_0x7c0d('0x39')]=[{'all':!![]}];}_0x5dc200=_[_0x7c0d('0x37')]({},_0x5dc200,_0x1ff57c['options']);return db[_0x7c0d('0x29')]['find'](_0x5dc200)[_0x7c0d('0x24')](handleEntityNotFound(_0x1a08e6,null))['then'](respondWithResult(_0x1a08e6,null))[_0x7c0d('0x3b')](handleError(_0x1a08e6,null));};exports[_0x7c0d('0x41')]=function(_0x2db55b,_0x1d8451){return db[_0x7c0d('0x29')]['create'](_0x2db55b[_0x7c0d('0x42')],{})['then'](respondWithResult(_0x1d8451,0xc9))[_0x7c0d('0x3b')](handleError(_0x1d8451,null));};exports[_0x7c0d('0x23')]=function(_0x32bb12,_0x4fe5fd){if(_0x32bb12[_0x7c0d('0x42')]['id']){delete _0x32bb12['body']['id'];}return db['WhatsappQueueReport'][_0x7c0d('0x43')]({'where':{'id':_0x32bb12[_0x7c0d('0x3d')]['id']}})[_0x7c0d('0x24')](handleEntityNotFound(_0x4fe5fd,null))['then'](saveUpdates(_0x32bb12[_0x7c0d('0x42')],null))[_0x7c0d('0x24')](respondWithResult(_0x4fe5fd,null))[_0x7c0d('0x3b')](handleError(_0x4fe5fd,null));};exports['destroy']=function(_0x17ffea,_0x1d95d9){return db[_0x7c0d('0x29')][_0x7c0d('0x43')]({'where':{'id':_0x17ffea[_0x7c0d('0x3d')]['id']}})['then'](handleEntityNotFound(_0x1d95d9,null))['then'](removeEntity(_0x1d95d9,null))[_0x7c0d('0x3b')](handleError(_0x1d95d9,null));};exports[_0x7c0d('0x44')]=function(_0x4e6164,_0x4c1731){return db[_0x7c0d('0x29')][_0x7c0d('0x44')]()[_0x7c0d('0x24')](respondWithResult(_0x4c1731,null))['catch'](handleError(_0x4c1731,null));}; \ No newline at end of file diff --git a/server/api/whatsappQueueReport/whatsappQueueReport.model.js b/server/api/whatsappQueueReport/whatsappQueueReport.model.js index 734f223..77aceeb 100644 --- a/server/api/whatsappQueueReport/whatsappQueueReport.model.js +++ b/server/api/whatsappQueueReport/whatsappQueueReport.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x4da6=['../../config/logger','api','moment','bluebird','path','../../config/environment','exports','WhatsappQueueReport','report_whatsapp_queue','uniqueid','lodash','util'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x4da6,0x142));var _0x64da=function(_0x343736,_0x3938f1){_0x343736=_0x343736-0x0;var _0x3e83d1=_0x4da6[_0x343736];return _0x3e83d1;};'use strict';var _=require(_0x64da('0x0'));var util=require(_0x64da('0x1'));var logger=require(_0x64da('0x2'))(_0x64da('0x3'));var moment=require(_0x64da('0x4'));var BPromise=require(_0x64da('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x64da('0x6'));var rimraf=require('rimraf');var config=require(_0x64da('0x7'));var attributes=require('./whatsappQueueReport.attributes');module[_0x64da('0x8')]=function(_0x4dd271,_0x4c9e04){return _0x4dd271['define'](_0x64da('0x9'),attributes,{'tableName':_0x64da('0xa'),'paranoid':![],'indexes':[{'name':'uniqueid','fields':[_0x64da('0xb')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x6ec6=['uniqueid','lodash','util','api','bluebird','rimraf','./whatsappQueueReport.attributes','define','report_whatsapp_queue'];(function(_0x449caa,_0x1e43db){var _0x10c2f3=function(_0x15b5e9){while(--_0x15b5e9){_0x449caa['push'](_0x449caa['shift']());}};_0x10c2f3(++_0x1e43db);}(_0x6ec6,0xbe));var _0x66ec=function(_0x3a4f18,_0x1af741){_0x3a4f18=_0x3a4f18-0x0;var _0x4c20fc=_0x6ec6[_0x3a4f18];return _0x4c20fc;};'use strict';var _=require(_0x66ec('0x0'));var util=require(_0x66ec('0x1'));var logger=require('../../config/logger')(_0x66ec('0x2'));var moment=require('moment');var BPromise=require(_0x66ec('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x66ec('0x4'));var config=require('../../config/environment');var attributes=require(_0x66ec('0x5'));module['exports']=function(_0x474295,_0x1f47b5){return _0x474295[_0x66ec('0x6')]('WhatsappQueueReport',attributes,{'tableName':_0x66ec('0x7'),'paranoid':![],'indexes':[{'name':'uniqueid','fields':[_0x66ec('0x8')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/whatsappQueueReport/whatsappQueueReport.rpc.js b/server/api/whatsappQueueReport/whatsappQueueReport.rpc.js index 1699caf..24303f5 100644 --- a/server/api/whatsappQueueReport/whatsappQueueReport.rpc.js +++ b/server/api/whatsappQueueReport/whatsappQueueReport.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x94a6=['randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request','info','WhatsappQueueReport,\x20%s,\x20%s','debug','stringify','error','code','message','request\x20sent','result','catch','WhatsappQueueReport','create','body','options','raw','CreateWhatsappQueueReport','UpdateWhatsappQueueReport','where','attributes','limit','lodash','moment','bluebird'];(function(_0x5182f9,_0x4acf0c){var _0x4c9fad=function(_0x453b0e){while(--_0x453b0e){_0x5182f9['push'](_0x5182f9['shift']());}};_0x4c9fad(++_0x4acf0c);}(_0x94a6,0x1aa));var _0x694a=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x94a6[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x694a('0x0'));var util=require('util');var moment=require(_0x694a('0x1'));var BPromise=require(_0x694a('0x2'));var rs=require(_0x694a('0x3'));var fs=require('fs');var Redis=require(_0x694a('0x4'));var db=require(_0x694a('0x5'))['db'];var utils=require(_0x694a('0x6'));var logger=require(_0x694a('0x7'))(_0x694a('0x8'));var config=require('../../config/environment');var jayson=require(_0x694a('0x9'));var client=jayson[_0x694a('0xa')][_0x694a('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x3c846a,_0x186aa7,_0x120d18){return new BPromise(function(_0x580b52,_0x132550){return client[_0x694a('0xc')](_0x3c846a,_0x120d18)['then'](function(_0xc6405e){logger[_0x694a('0xd')](_0x694a('0xe'),_0x186aa7,'request\x20sent');logger[_0x694a('0xf')]('WhatsappQueueReport,\x20%s,\x20%s,\x20%s',_0x186aa7,'request\x20sent',JSON[_0x694a('0x10')](_0xc6405e));if(_0xc6405e[_0x694a('0x11')]){if(_0xc6405e[_0x694a('0x11')][_0x694a('0x12')]===0x1f4){logger[_0x694a('0x11')](_0x694a('0xe'),_0x186aa7,_0xc6405e[_0x694a('0x11')][_0x694a('0x13')]);return _0x132550(_0xc6405e['error'][_0x694a('0x13')]);}logger[_0x694a('0x11')](_0x694a('0xe'),_0x186aa7,_0xc6405e[_0x694a('0x11')][_0x694a('0x13')]);return _0x580b52(_0xc6405e[_0x694a('0x11')][_0x694a('0x13')]);}else{logger['info'](_0x694a('0xe'),_0x186aa7,_0x694a('0x14'));_0x580b52(_0xc6405e[_0x694a('0x15')][_0x694a('0x13')]);}})[_0x694a('0x16')](function(_0x7f26cc){logger[_0x694a('0x11')](_0x694a('0xe'),_0x186aa7,_0x7f26cc);_0x132550(_0x7f26cc);});});}exports['CreateWhatsappQueueReport']=function(_0x40cc34){var _0x1f1632=this;return new Promise(function(_0x111695,_0x39cae0){return db[_0x694a('0x17')][_0x694a('0x18')](_0x40cc34[_0x694a('0x19')],{'raw':_0x40cc34[_0x694a('0x1a')]?_0x40cc34['options'][_0x694a('0x1b')]===undefined?!![]:![]:!![]})['then'](function(_0x3d8af1){logger['info'](_0x694a('0x1c'),_0x40cc34);logger['debug'](_0x694a('0x1c'),_0x40cc34,JSON[_0x694a('0x10')](_0x3d8af1));_0x111695(_0x3d8af1);})[_0x694a('0x16')](function(_0x3e0ba3){logger['error'](_0x694a('0x1c'),_0x3e0ba3[_0x694a('0x13')],_0x40cc34);_0x39cae0(_0x1f1632['error'](0x1f4,_0x3e0ba3[_0x694a('0x13')]));});});};exports[_0x694a('0x1d')]=function(_0x47ab20){var _0x1c60cc=this;return new Promise(function(_0x1dbca1,_0x52f4c0){return db[_0x694a('0x17')]['update'](_0x47ab20['body'],{'raw':_0x47ab20['options']?_0x47ab20[_0x694a('0x1a')][_0x694a('0x1b')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x47ab20[_0x694a('0x1a')]?_0x47ab20[_0x694a('0x1a')][_0x694a('0x1e')]||null:null,'attributes':_0x47ab20[_0x694a('0x1a')]?_0x47ab20[_0x694a('0x1a')][_0x694a('0x1f')]||null:null,'limit':_0x47ab20[_0x694a('0x1a')]?_0x47ab20[_0x694a('0x1a')][_0x694a('0x20')]||null:null})['then'](function(_0xf49934){logger['info']('UpdateWhatsappQueueReport',_0x47ab20);logger[_0x694a('0xf')](_0x694a('0x1d'),_0x47ab20,JSON[_0x694a('0x10')](_0xf49934));_0x1dbca1(_0xf49934);})['catch'](function(_0xe04df9){logger[_0x694a('0x11')]('UpdateWhatsappQueueReport',_0xe04df9[_0x694a('0x13')],_0x47ab20);_0x52f4c0(_0x1c60cc[_0x694a('0x11')](0x1f4,_0xe04df9[_0x694a('0x13')]));});});}; \ No newline at end of file +var _0x15e2=['../../config/environment','jayson/promise','client','http','request','then','info','request\x20sent','debug','error','WhatsappQueueReport,\x20%s,\x20%s','message','result','CreateWhatsappQueueReport','body','options','raw','stringify','UpdateWhatsappQueueReport','where','attributes','limit','catch','moment','randomstring','ioredis','../../mysqldb','../../config/logger'];(function(_0x19b0fc,_0x93c7fe){var _0x5c8fd8=function(_0x41e15a){while(--_0x41e15a){_0x19b0fc['push'](_0x19b0fc['shift']());}};_0x5c8fd8(++_0x93c7fe);}(_0x15e2,0x19f));var _0x215e=function(_0x2c91e9,_0x2fb965){_0x2c91e9=_0x2c91e9-0x0;var _0x13f0ff=_0x15e2[_0x2c91e9];return _0x13f0ff;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x215e('0x0'));var BPromise=require('bluebird');var rs=require(_0x215e('0x1'));var fs=require('fs');var Redis=require(_0x215e('0x2'));var db=require(_0x215e('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0x215e('0x4'))('rpc');var config=require(_0x215e('0x5'));var jayson=require(_0x215e('0x6'));var client=jayson[_0x215e('0x7')][_0x215e('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x35f476,_0x41d7e6,_0x343d84){return new BPromise(function(_0x40e598,_0x53eba9){return client[_0x215e('0x9')](_0x35f476,_0x343d84)[_0x215e('0xa')](function(_0x50edb3){logger[_0x215e('0xb')]('WhatsappQueueReport,\x20%s,\x20%s',_0x41d7e6,_0x215e('0xc'));logger[_0x215e('0xd')]('WhatsappQueueReport,\x20%s,\x20%s,\x20%s',_0x41d7e6,'request\x20sent',JSON['stringify'](_0x50edb3));if(_0x50edb3['error']){if(_0x50edb3[_0x215e('0xe')]['code']===0x1f4){logger[_0x215e('0xe')](_0x215e('0xf'),_0x41d7e6,_0x50edb3[_0x215e('0xe')][_0x215e('0x10')]);return _0x53eba9(_0x50edb3[_0x215e('0xe')][_0x215e('0x10')]);}logger[_0x215e('0xe')](_0x215e('0xf'),_0x41d7e6,_0x50edb3[_0x215e('0xe')][_0x215e('0x10')]);return _0x40e598(_0x50edb3['error'][_0x215e('0x10')]);}else{logger[_0x215e('0xb')](_0x215e('0xf'),_0x41d7e6,_0x215e('0xc'));_0x40e598(_0x50edb3[_0x215e('0x11')][_0x215e('0x10')]);}})['catch'](function(_0x4e6958){logger[_0x215e('0xe')]('WhatsappQueueReport,\x20%s,\x20%s',_0x41d7e6,_0x4e6958);_0x53eba9(_0x4e6958);});});}exports[_0x215e('0x12')]=function(_0x310b06){var _0x479a01=this;return new Promise(function(_0x53e605,_0x1609a9){return db['WhatsappQueueReport']['create'](_0x310b06[_0x215e('0x13')],{'raw':_0x310b06[_0x215e('0x14')]?_0x310b06[_0x215e('0x14')][_0x215e('0x15')]===undefined?!![]:![]:!![]})['then'](function(_0x5c5ba4){logger[_0x215e('0xb')](_0x215e('0x12'),_0x310b06);logger['debug'](_0x215e('0x12'),_0x310b06,JSON[_0x215e('0x16')](_0x5c5ba4));_0x53e605(_0x5c5ba4);})['catch'](function(_0x5ab60d){logger['error'](_0x215e('0x12'),_0x5ab60d['message'],_0x310b06);_0x1609a9(_0x479a01['error'](0x1f4,_0x5ab60d[_0x215e('0x10')]));});});};exports[_0x215e('0x17')]=function(_0x267aa9){var _0xee035d=this;return new Promise(function(_0x23187c,_0x288573){return db['WhatsappQueueReport']['update'](_0x267aa9[_0x215e('0x13')],{'raw':_0x267aa9[_0x215e('0x14')]?_0x267aa9[_0x215e('0x14')][_0x215e('0x15')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x267aa9[_0x215e('0x14')]?_0x267aa9[_0x215e('0x14')][_0x215e('0x18')]||null:null,'attributes':_0x267aa9['options']?_0x267aa9[_0x215e('0x14')][_0x215e('0x19')]||null:null,'limit':_0x267aa9[_0x215e('0x14')]?_0x267aa9['options'][_0x215e('0x1a')]||null:null})[_0x215e('0xa')](function(_0x2c9b83){logger['info']('UpdateWhatsappQueueReport',_0x267aa9);logger[_0x215e('0xd')](_0x215e('0x17'),_0x267aa9,JSON[_0x215e('0x16')](_0x2c9b83));_0x23187c(_0x2c9b83);})[_0x215e('0x1b')](function(_0x2f1530){logger[_0x215e('0xe')](_0x215e('0x17'),_0x2f1530['message'],_0x267aa9);_0x288573(_0xee035d[_0x215e('0xe')](0x1f4,_0x2f1530['message']));});});}; \ No newline at end of file diff --git a/server/api/whatsappTransferReport/index.js b/server/api/whatsappTransferReport/index.js index d4129ae..05dea66 100644 --- a/server/api/whatsappTransferReport/index.js +++ b/server/api/whatsappTransferReport/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xec18=['connect-timeout','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./whatsappTransferReport.controller','get','isAuthenticated','/describe','describe','show','post','put','update','delete','/:id','destroy','exports','util','path'];(function(_0x4fd3a9,_0x4947d9){var _0x29a781=function(_0x573979){while(--_0x573979){_0x4fd3a9['push'](_0x4fd3a9['shift']());}};_0x29a781(++_0x4947d9);}(_0xec18,0x12a));var _0x8ec1=function(_0x4b385f,_0x936ace){_0x4b385f=_0x4b385f-0x0;var _0x234003=_0xec18[_0x4b385f];return _0x234003;};'use strict';var multer=require('multer');var util=require(_0x8ec1('0x0'));var path=require(_0x8ec1('0x1'));var timeout=require(_0x8ec1('0x2'));var express=require('express');var router=express[_0x8ec1('0x3')]();var auth=require(_0x8ec1('0x4'));var interaction=require(_0x8ec1('0x5'));var config=require(_0x8ec1('0x6'));var controller=require(_0x8ec1('0x7'));router[_0x8ec1('0x8')]('/',auth[_0x8ec1('0x9')](),controller['index']);router[_0x8ec1('0x8')](_0x8ec1('0xa'),auth[_0x8ec1('0x9')](),controller[_0x8ec1('0xb')]);router['get']('/:id',auth[_0x8ec1('0x9')](),controller[_0x8ec1('0xc')]);router[_0x8ec1('0xd')]('/',auth['isAuthenticated'](),controller['create']);router[_0x8ec1('0xe')]('/:id',auth[_0x8ec1('0x9')](),controller[_0x8ec1('0xf')]);router[_0x8ec1('0x10')](_0x8ec1('0x11'),auth[_0x8ec1('0x9')](),controller[_0x8ec1('0x12')]);module[_0x8ec1('0x13')]=router; \ No newline at end of file +var _0x9ade=['Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./whatsappTransferReport.controller','isAuthenticated','/describe','describe','get','/:id','show','post','create','put','update','destroy','multer','util','path','connect-timeout','express'];(function(_0x1aba25,_0x1faed1){var _0x47d997=function(_0x4f9e11){while(--_0x4f9e11){_0x1aba25['push'](_0x1aba25['shift']());}};_0x47d997(++_0x1faed1);}(_0x9ade,0x8e));var _0xe9ad=function(_0x2181e0,_0x165371){_0x2181e0=_0x2181e0-0x0;var _0x10137e=_0x9ade[_0x2181e0];return _0x10137e;};'use strict';var multer=require(_0xe9ad('0x0'));var util=require(_0xe9ad('0x1'));var path=require(_0xe9ad('0x2'));var timeout=require(_0xe9ad('0x3'));var express=require(_0xe9ad('0x4'));var router=express[_0xe9ad('0x5')]();var auth=require(_0xe9ad('0x6'));var interaction=require(_0xe9ad('0x7'));var config=require(_0xe9ad('0x8'));var controller=require(_0xe9ad('0x9'));router['get']('/',auth[_0xe9ad('0xa')](),controller['index']);router['get'](_0xe9ad('0xb'),auth[_0xe9ad('0xa')](),controller[_0xe9ad('0xc')]);router[_0xe9ad('0xd')](_0xe9ad('0xe'),auth[_0xe9ad('0xa')](),controller[_0xe9ad('0xf')]);router[_0xe9ad('0x10')]('/',auth[_0xe9ad('0xa')](),controller[_0xe9ad('0x11')]);router[_0xe9ad('0x12')]('/:id',auth[_0xe9ad('0xa')](),controller[_0xe9ad('0x13')]);router['delete'](_0xe9ad('0xe'),auth[_0xe9ad('0xa')](),controller[_0xe9ad('0x14')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/whatsappTransferReport/whatsappTransferReport.attributes.js b/server/api/whatsappTransferReport/whatsappTransferReport.attributes.js index e1cf090..53892ee 100644 --- a/server/api/whatsappTransferReport/whatsappTransferReport.attributes.js +++ b/server/api/whatsappTransferReport/whatsappTransferReport.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xb10b=['ENUM','account','queue','DATE','sequelize','STRING'];(function(_0x7e2eb0,_0x17cd58){var _0xd92de4=function(_0x5d005b){while(--_0x5d005b){_0x7e2eb0['push'](_0x7e2eb0['shift']());}};_0xd92de4(++_0x17cd58);}(_0xb10b,0x12a));var _0xbb10=function(_0xa3d9a7,_0x1cf219){_0xa3d9a7=_0xa3d9a7-0x0;var _0x48080a=_0xb10b[_0xa3d9a7];return _0x48080a;};'use strict';var Sequelize=require(_0xbb10('0x0'));module['exports']={'uniqueid':{'type':Sequelize[_0xbb10('0x1')],'allowNull':![]},'type':{'type':Sequelize[_0xbb10('0x2')](_0xbb10('0x3'),'agent',_0xbb10('0x4')),'allowNull':![]},'transferredAt':{'type':Sequelize[_0xbb10('0x5')]}}; \ No newline at end of file +var _0x757a=['queue','DATE','exports','STRING'];(function(_0x4ea955,_0x1eda76){var _0x558561=function(_0x5b20f4){while(--_0x5b20f4){_0x4ea955['push'](_0x4ea955['shift']());}};_0x558561(++_0x1eda76);}(_0x757a,0xde));var _0xa757=function(_0x527bca,_0x3e8c7d){_0x527bca=_0x527bca-0x0;var _0x4e5a5c=_0x757a[_0x527bca];return _0x4e5a5c;};'use strict';var Sequelize=require('sequelize');module[_0xa757('0x0')]={'uniqueid':{'type':Sequelize[_0xa757('0x1')],'allowNull':![]},'type':{'type':Sequelize['ENUM']('account','agent',_0xa757('0x2')),'allowNull':![]},'transferredAt':{'type':Sequelize[_0xa757('0x3')]}}; \ No newline at end of file diff --git a/server/api/whatsappTransferReport/whatsappTransferReport.controller.js b/server/api/whatsappTransferReport/whatsappTransferReport.controller.js index f29dc93..1e80767 100644 --- a/server/api/whatsappTransferReport/whatsappTransferReport.controller.js +++ b/server/api/whatsappTransferReport/whatsappTransferReport.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xb721=['path','sox','to-csv','ejs','lodash','squel','crypto','desk.js','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','status','json','offset','limit','set','Content-Range','apply','reject','then','destroy','end','error','stack','name','send','index','map','WhatsappTransferReport','rawAttributes','fieldName','type','key','model','query','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','count','includeAll','include','findAll','rows','catch','show','params','keys','options','find','create','body','update','describe','html-pdf','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache'];(function(_0x42270b,_0x12d5ae){var _0x17ffde=function(_0x479455){while(--_0x479455){_0x42270b['push'](_0x42270b['shift']());}};_0x17ffde(++_0x12d5ae);}(_0xb721,0x1cc));var _0x1b72=function(_0x51c52b,_0x147712){_0x51c52b=_0x51c52b-0x0;var _0x581ce3=_0xb721[_0x51c52b];return _0x581ce3;};'use strict';var pdf=require(_0x1b72('0x0'));var emlformat=require(_0x1b72('0x1'));var rimraf=require(_0x1b72('0x2'));var zipdir=require(_0x1b72('0x3'));var jsonpatch=require('fast-json-patch');var rp=require(_0x1b72('0x4'));var moment=require(_0x1b72('0x5'));var BPromise=require(_0x1b72('0x6'));var Mustache=require(_0x1b72('0x7'));var util=require('util');var path=require(_0x1b72('0x8'));var sox=require(_0x1b72('0x9'));var csv=require(_0x1b72('0xa'));var ejs=require(_0x1b72('0xb'));var fs=require('fs');var _=require(_0x1b72('0xc'));var squel=require(_0x1b72('0xd'));var crypto=require(_0x1b72('0xe'));var jsforce=require('jsforce');var deskjs=require(_0x1b72('0xf'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x1b72('0x10'));var Redis=require('ioredis');var authService=require(_0x1b72('0x11'));var qs=require(_0x1b72('0x12'));var as=require(_0x1b72('0x13'));var hardwareService=require(_0x1b72('0x14'));var logger=require(_0x1b72('0x15'))(_0x1b72('0x16'));var utils=require(_0x1b72('0x17'));var config=require(_0x1b72('0x18'));var db=require(_0x1b72('0x19'))['db'];function respondWithStatusCode(_0x5d604c,_0x2f9523){_0x2f9523=_0x2f9523||0xcc;return function(_0xaabe4c){if(_0xaabe4c){return _0x5d604c['sendStatus'](_0x2f9523);}return _0x5d604c['status'](_0x2f9523)['end']();};}function respondWithResult(_0x20d056,_0x598bb7){_0x598bb7=_0x598bb7||0xc8;return function(_0x36b40b){if(_0x36b40b){return _0x20d056[_0x1b72('0x1a')](_0x598bb7)[_0x1b72('0x1b')](_0x36b40b);}};}function respondWithFilteredResult(_0x3ae578,_0x29d839){return function(_0xd8f3e7){if(_0xd8f3e7){var _0x260820=_0xd8f3e7['count'],_0x340b62=_0x29d839[_0x1b72('0x1c')],_0x4c0f60=_0x29d839[_0x1b72('0x1c')]+_0x29d839[_0x1b72('0x1d')],_0x2dfd2f;if(_0x4c0f60>=_0x260820){_0x4c0f60=_0x260820;_0x2dfd2f=0xc8;}else{_0x2dfd2f=0xce;}_0x3ae578[_0x1b72('0x1a')](_0x2dfd2f);return _0x3ae578[_0x1b72('0x1e')](_0x1b72('0x1f'),_0x340b62+'-'+_0x4c0f60+'/'+_0x260820)['json'](_0xd8f3e7);}return null;};}function patchUpdates(_0x3b6406){return function(_0x523fd2){try{jsonpatch[_0x1b72('0x20')](_0x523fd2,_0x3b6406,!![]);}catch(_0x39c6bd){return BPromise[_0x1b72('0x21')](_0x39c6bd);}return _0x523fd2['save']();};}function saveUpdates(_0x22dd04,_0x5555a4){return function(_0x4ae9be){if(_0x4ae9be){return _0x4ae9be['update'](_0x22dd04)[_0x1b72('0x22')](function(_0x27eb6c){return _0x27eb6c;});}return null;};}function removeEntity(_0x32a1cb,_0x487173){return function(_0x527e8c){if(_0x527e8c){return _0x527e8c[_0x1b72('0x23')]()[_0x1b72('0x22')](function(){_0x32a1cb['status'](0xcc)[_0x1b72('0x24')]();});}};}function handleEntityNotFound(_0x36d38e,_0x15f708){return function(_0x42c5d3){if(!_0x42c5d3){_0x36d38e['sendStatus'](0x194);}return _0x42c5d3;};}function handleError(_0x545a6b,_0x5481e3){_0x5481e3=_0x5481e3||0x1f4;return function(_0x179afa){logger[_0x1b72('0x25')](_0x179afa[_0x1b72('0x26')]);if(_0x179afa[_0x1b72('0x27')]){delete _0x179afa[_0x1b72('0x27')];}_0x545a6b[_0x1b72('0x1a')](_0x5481e3)[_0x1b72('0x28')](_0x179afa);};}exports[_0x1b72('0x29')]=function(_0x468061,_0x4cb19c){var _0x47af4c={},_0x45b169={},_0x3a0e2f={'count':0x0,'rows':[]};var _0x102934=_[_0x1b72('0x2a')](db[_0x1b72('0x2b')][_0x1b72('0x2c')],function(_0x45bf36){return{'name':_0x45bf36[_0x1b72('0x2d')],'type':_0x45bf36[_0x1b72('0x2e')][_0x1b72('0x2f')]};});_0x45b169[_0x1b72('0x30')]=_['map'](_0x102934,_0x1b72('0x27'));_0x45b169['query']=_['keys'](_0x468061[_0x1b72('0x31')]);_0x45b169[_0x1b72('0x32')]=_['intersection'](_0x45b169[_0x1b72('0x30')],_0x45b169[_0x1b72('0x31')]);_0x47af4c[_0x1b72('0x33')]=_[_0x1b72('0x34')](_0x45b169[_0x1b72('0x30')],qs[_0x1b72('0x35')](_0x468061[_0x1b72('0x31')][_0x1b72('0x35')]));_0x47af4c[_0x1b72('0x33')]=_0x47af4c[_0x1b72('0x33')][_0x1b72('0x36')]?_0x47af4c[_0x1b72('0x33')]:_0x45b169[_0x1b72('0x30')];if(!_0x468061[_0x1b72('0x31')][_0x1b72('0x37')](_0x1b72('0x38'))){_0x47af4c[_0x1b72('0x1d')]=qs[_0x1b72('0x1d')](_0x468061['query'][_0x1b72('0x1d')]);_0x47af4c[_0x1b72('0x1c')]=qs[_0x1b72('0x1c')](_0x468061[_0x1b72('0x31')][_0x1b72('0x1c')]);}_0x47af4c[_0x1b72('0x39')]=qs[_0x1b72('0x3a')](_0x468061['query'][_0x1b72('0x3a')]);_0x47af4c[_0x1b72('0x3b')]=qs[_0x1b72('0x32')](_[_0x1b72('0x3c')](_0x468061['query'],_0x45b169['filters']),_0x102934);if(_0x468061[_0x1b72('0x31')][_0x1b72('0x3d')]){_0x47af4c[_0x1b72('0x3b')]=_[_0x1b72('0x3e')](_0x47af4c[_0x1b72('0x3b')],{'$or':_[_0x1b72('0x2a')](_0x102934,function(_0x4f9437){if(_0x4f9437[_0x1b72('0x2e')]!=='VIRTUAL'){var _0x389f78={};_0x389f78[_0x4f9437[_0x1b72('0x27')]]={'$like':'%'+_0x468061['query'][_0x1b72('0x3d')]+'%'};return _0x389f78;}})});}_0x47af4c=_['merge']({},_0x47af4c,_0x468061['options']);var _0x32d0b5={'where':_0x47af4c[_0x1b72('0x3b')]};return db[_0x1b72('0x2b')][_0x1b72('0x3f')](_0x32d0b5)['then'](function(_0x3cf3ed){_0x3a0e2f['count']=_0x3cf3ed;if(_0x468061[_0x1b72('0x31')][_0x1b72('0x40')]){_0x47af4c[_0x1b72('0x41')]=[{'all':!![]}];}return db[_0x1b72('0x2b')][_0x1b72('0x42')](_0x47af4c);})[_0x1b72('0x22')](function(_0x50aa12){_0x3a0e2f[_0x1b72('0x43')]=_0x50aa12;return _0x3a0e2f;})[_0x1b72('0x22')](respondWithFilteredResult(_0x4cb19c,_0x47af4c))[_0x1b72('0x44')](handleError(_0x4cb19c,null));};exports[_0x1b72('0x45')]=function(_0x5ca85e,_0x354db6){var _0x42a6ac={'raw':!![],'where':{'id':_0x5ca85e[_0x1b72('0x46')]['id']}},_0x571338={};_0x571338[_0x1b72('0x30')]=_[_0x1b72('0x47')](db[_0x1b72('0x2b')][_0x1b72('0x2c')]);_0x571338[_0x1b72('0x31')]=_['keys'](_0x5ca85e[_0x1b72('0x31')]);_0x571338[_0x1b72('0x32')]=_[_0x1b72('0x34')](_0x571338['model'],_0x571338['query']);_0x42a6ac[_0x1b72('0x33')]=_[_0x1b72('0x34')](_0x571338[_0x1b72('0x30')],qs['fields'](_0x5ca85e['query'][_0x1b72('0x35')]));_0x42a6ac[_0x1b72('0x33')]=_0x42a6ac[_0x1b72('0x33')][_0x1b72('0x36')]?_0x42a6ac[_0x1b72('0x33')]:_0x571338[_0x1b72('0x30')];if(_0x5ca85e[_0x1b72('0x31')][_0x1b72('0x40')]){_0x42a6ac[_0x1b72('0x41')]=[{'all':!![]}];}_0x42a6ac=_[_0x1b72('0x3e')]({},_0x42a6ac,_0x5ca85e[_0x1b72('0x48')]);return db[_0x1b72('0x2b')][_0x1b72('0x49')](_0x42a6ac)['then'](handleEntityNotFound(_0x354db6,null))['then'](respondWithResult(_0x354db6,null))['catch'](handleError(_0x354db6,null));};exports[_0x1b72('0x4a')]=function(_0x4df6a7,_0x372521){return db[_0x1b72('0x2b')]['create'](_0x4df6a7[_0x1b72('0x4b')],{})[_0x1b72('0x22')](respondWithResult(_0x372521,0xc9))['catch'](handleError(_0x372521,null));};exports[_0x1b72('0x4c')]=function(_0x3ca26b,_0x4eb099){if(_0x3ca26b[_0x1b72('0x4b')]['id']){delete _0x3ca26b['body']['id'];}return db[_0x1b72('0x2b')][_0x1b72('0x49')]({'where':{'id':_0x3ca26b[_0x1b72('0x46')]['id']}})[_0x1b72('0x22')](handleEntityNotFound(_0x4eb099,null))['then'](saveUpdates(_0x3ca26b[_0x1b72('0x4b')],null))[_0x1b72('0x22')](respondWithResult(_0x4eb099,null))[_0x1b72('0x44')](handleError(_0x4eb099,null));};exports[_0x1b72('0x23')]=function(_0x16ff62,_0xfc0653){return db[_0x1b72('0x2b')][_0x1b72('0x49')]({'where':{'id':_0x16ff62[_0x1b72('0x46')]['id']}})[_0x1b72('0x22')](handleEntityNotFound(_0xfc0653,null))[_0x1b72('0x22')](removeEntity(_0xfc0653,null))[_0x1b72('0x44')](handleError(_0xfc0653,null));};exports[_0x1b72('0x4d')]=function(_0x3f6b35,_0x4e664b){return db[_0x1b72('0x2b')][_0x1b72('0x4d')]()[_0x1b72('0x22')](respondWithResult(_0x4e664b,null))['catch'](handleError(_0x4e664b,null));}; \ No newline at end of file +var _0x7618=['key','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','offset','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','create','body','find','params','describe','html-pdf','eml-format','rimraf','fast-json-patch','bluebird','util','sox','ejs','squel','crypto','jsforce','desk.js','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../mysqldb','sendStatus','status','end','json','count','limit','Content-Range','reject','then','destroy','error','stack','name','send','index','map','WhatsappTransferReport','rawAttributes','fieldName'];(function(_0x1d6f49,_0x4679ca){var _0x43a3ad=function(_0x666001){while(--_0x666001){_0x1d6f49['push'](_0x1d6f49['shift']());}};_0x43a3ad(++_0x4679ca);}(_0x7618,0x171));var _0x8761=function(_0x3523af,_0x4b5ebf){_0x3523af=_0x3523af-0x0;var _0x210e89=_0x7618[_0x3523af];return _0x210e89;};'use strict';var pdf=require(_0x8761('0x0'));var emlformat=require(_0x8761('0x1'));var rimraf=require(_0x8761('0x2'));var zipdir=require('zip-dir');var jsonpatch=require(_0x8761('0x3'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x8761('0x4'));var Mustache=require('mustache');var util=require(_0x8761('0x5'));var path=require('path');var sox=require(_0x8761('0x6'));var csv=require('to-csv');var ejs=require(_0x8761('0x7'));var fs=require('fs');var _=require('lodash');var squel=require(_0x8761('0x8'));var crypto=require(_0x8761('0x9'));var jsforce=require(_0x8761('0xa'));var deskjs=require(_0x8761('0xb'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x8761('0xc'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x8761('0xd'));var as=require(_0x8761('0xe'));var hardwareService=require(_0x8761('0xf'));var logger=require(_0x8761('0x10'))(_0x8761('0x11'));var utils=require('../../config/utils');var config=require(_0x8761('0x12'));var db=require(_0x8761('0x13'))['db'];function respondWithStatusCode(_0x31266b,_0x8083e3){_0x8083e3=_0x8083e3||0xcc;return function(_0x462fd6){if(_0x462fd6){return _0x31266b[_0x8761('0x14')](_0x8083e3);}return _0x31266b[_0x8761('0x15')](_0x8083e3)[_0x8761('0x16')]();};}function respondWithResult(_0x20a958,_0x51160e){_0x51160e=_0x51160e||0xc8;return function(_0x458954){if(_0x458954){return _0x20a958[_0x8761('0x15')](_0x51160e)[_0x8761('0x17')](_0x458954);}};}function respondWithFilteredResult(_0x113c43,_0x3d0bdc){return function(_0x44970a){if(_0x44970a){var _0x1a2326=_0x44970a[_0x8761('0x18')],_0x2f9774=_0x3d0bdc['offset'],_0x157b5a=_0x3d0bdc['offset']+_0x3d0bdc[_0x8761('0x19')],_0x4f600a;if(_0x157b5a>=_0x1a2326){_0x157b5a=_0x1a2326;_0x4f600a=0xc8;}else{_0x4f600a=0xce;}_0x113c43[_0x8761('0x15')](_0x4f600a);return _0x113c43['set'](_0x8761('0x1a'),_0x2f9774+'-'+_0x157b5a+'/'+_0x1a2326)[_0x8761('0x17')](_0x44970a);}return null;};}function patchUpdates(_0x3a17a4){return function(_0xddd18c){try{jsonpatch['apply'](_0xddd18c,_0x3a17a4,!![]);}catch(_0x1acf8f){return BPromise[_0x8761('0x1b')](_0x1acf8f);}return _0xddd18c['save']();};}function saveUpdates(_0xa36ae5,_0xd6dbdc){return function(_0x5dacb5){if(_0x5dacb5){return _0x5dacb5['update'](_0xa36ae5)[_0x8761('0x1c')](function(_0x1118f1){return _0x1118f1;});}return null;};}function removeEntity(_0x538f66,_0x18f284){return function(_0x252f3f){if(_0x252f3f){return _0x252f3f[_0x8761('0x1d')]()['then'](function(){_0x538f66[_0x8761('0x15')](0xcc)[_0x8761('0x16')]();});}};}function handleEntityNotFound(_0x4ec93b,_0xa0b968){return function(_0x11aac6){if(!_0x11aac6){_0x4ec93b['sendStatus'](0x194);}return _0x11aac6;};}function handleError(_0x11a941,_0x54d083){_0x54d083=_0x54d083||0x1f4;return function(_0x31ee3c){logger[_0x8761('0x1e')](_0x31ee3c[_0x8761('0x1f')]);if(_0x31ee3c[_0x8761('0x20')]){delete _0x31ee3c[_0x8761('0x20')];}_0x11a941['status'](_0x54d083)[_0x8761('0x21')](_0x31ee3c);};}exports[_0x8761('0x22')]=function(_0x1321e2,_0x12333b){var _0x5a43d8={},_0x41ad94={},_0x822c80={'count':0x0,'rows':[]};var _0x36ae6e=_[_0x8761('0x23')](db[_0x8761('0x24')][_0x8761('0x25')],function(_0x3def0d){return{'name':_0x3def0d[_0x8761('0x26')],'type':_0x3def0d['type'][_0x8761('0x27')]};});_0x41ad94[_0x8761('0x28')]=_[_0x8761('0x23')](_0x36ae6e,_0x8761('0x20'));_0x41ad94[_0x8761('0x29')]=_[_0x8761('0x2a')](_0x1321e2[_0x8761('0x29')]);_0x41ad94[_0x8761('0x2b')]=_['intersection'](_0x41ad94[_0x8761('0x28')],_0x41ad94[_0x8761('0x29')]);_0x5a43d8['attributes']=_[_0x8761('0x2c')](_0x41ad94[_0x8761('0x28')],qs[_0x8761('0x2d')](_0x1321e2[_0x8761('0x29')][_0x8761('0x2d')]));_0x5a43d8[_0x8761('0x2e')]=_0x5a43d8[_0x8761('0x2e')][_0x8761('0x2f')]?_0x5a43d8[_0x8761('0x2e')]:_0x41ad94[_0x8761('0x28')];if(!_0x1321e2[_0x8761('0x29')][_0x8761('0x30')](_0x8761('0x31'))){_0x5a43d8[_0x8761('0x19')]=qs[_0x8761('0x19')](_0x1321e2[_0x8761('0x29')][_0x8761('0x19')]);_0x5a43d8['offset']=qs[_0x8761('0x32')](_0x1321e2['query'][_0x8761('0x32')]);}_0x5a43d8['order']=qs['sort'](_0x1321e2[_0x8761('0x29')][_0x8761('0x33')]);_0x5a43d8[_0x8761('0x34')]=qs[_0x8761('0x2b')](_[_0x8761('0x35')](_0x1321e2['query'],_0x41ad94[_0x8761('0x2b')]),_0x36ae6e);if(_0x1321e2['query'][_0x8761('0x36')]){_0x5a43d8['where']=_[_0x8761('0x37')](_0x5a43d8[_0x8761('0x34')],{'$or':_['map'](_0x36ae6e,function(_0x31af2e){if(_0x31af2e['type']!==_0x8761('0x38')){var _0x3fc696={};_0x3fc696[_0x31af2e['name']]={'$like':'%'+_0x1321e2[_0x8761('0x29')][_0x8761('0x36')]+'%'};return _0x3fc696;}})});}_0x5a43d8=_['merge']({},_0x5a43d8,_0x1321e2[_0x8761('0x39')]);var _0xceab20={'where':_0x5a43d8[_0x8761('0x34')]};return db[_0x8761('0x24')][_0x8761('0x18')](_0xceab20)[_0x8761('0x1c')](function(_0x5290c5){_0x822c80[_0x8761('0x18')]=_0x5290c5;if(_0x1321e2[_0x8761('0x29')][_0x8761('0x3a')]){_0x5a43d8[_0x8761('0x3b')]=[{'all':!![]}];}return db['WhatsappTransferReport'][_0x8761('0x3c')](_0x5a43d8);})[_0x8761('0x1c')](function(_0x257188){_0x822c80[_0x8761('0x3d')]=_0x257188;return _0x822c80;})[_0x8761('0x1c')](respondWithFilteredResult(_0x12333b,_0x5a43d8))[_0x8761('0x3e')](handleError(_0x12333b,null));};exports['show']=function(_0x270215,_0x28650a){var _0x1370cc={'raw':!![],'where':{'id':_0x270215['params']['id']}},_0x43ffd6={};_0x43ffd6[_0x8761('0x28')]=_['keys'](db[_0x8761('0x24')][_0x8761('0x25')]);_0x43ffd6['query']=_['keys'](_0x270215[_0x8761('0x29')]);_0x43ffd6[_0x8761('0x2b')]=_[_0x8761('0x2c')](_0x43ffd6['model'],_0x43ffd6[_0x8761('0x29')]);_0x1370cc[_0x8761('0x2e')]=_[_0x8761('0x2c')](_0x43ffd6[_0x8761('0x28')],qs[_0x8761('0x2d')](_0x270215[_0x8761('0x29')][_0x8761('0x2d')]));_0x1370cc[_0x8761('0x2e')]=_0x1370cc[_0x8761('0x2e')][_0x8761('0x2f')]?_0x1370cc[_0x8761('0x2e')]:_0x43ffd6[_0x8761('0x28')];if(_0x270215[_0x8761('0x29')][_0x8761('0x3a')]){_0x1370cc[_0x8761('0x3b')]=[{'all':!![]}];}_0x1370cc=_[_0x8761('0x37')]({},_0x1370cc,_0x270215[_0x8761('0x39')]);return db[_0x8761('0x24')]['find'](_0x1370cc)[_0x8761('0x1c')](handleEntityNotFound(_0x28650a,null))[_0x8761('0x1c')](respondWithResult(_0x28650a,null))[_0x8761('0x3e')](handleError(_0x28650a,null));};exports[_0x8761('0x3f')]=function(_0x182a00,_0x42f1de){return db['WhatsappTransferReport'][_0x8761('0x3f')](_0x182a00['body'],{})['then'](respondWithResult(_0x42f1de,0xc9))[_0x8761('0x3e')](handleError(_0x42f1de,null));};exports['update']=function(_0x258402,_0x2168b4){if(_0x258402[_0x8761('0x40')]['id']){delete _0x258402[_0x8761('0x40')]['id'];}return db[_0x8761('0x24')][_0x8761('0x41')]({'where':{'id':_0x258402[_0x8761('0x42')]['id']}})[_0x8761('0x1c')](handleEntityNotFound(_0x2168b4,null))[_0x8761('0x1c')](saveUpdates(_0x258402[_0x8761('0x40')],null))['then'](respondWithResult(_0x2168b4,null))[_0x8761('0x3e')](handleError(_0x2168b4,null));};exports['destroy']=function(_0x201862,_0x1187dc){return db[_0x8761('0x24')]['find']({'where':{'id':_0x201862[_0x8761('0x42')]['id']}})[_0x8761('0x1c')](handleEntityNotFound(_0x1187dc,null))[_0x8761('0x1c')](removeEntity(_0x1187dc,null))['catch'](handleError(_0x1187dc,null));};exports[_0x8761('0x43')]=function(_0x3d9319,_0x289075){return db[_0x8761('0x24')][_0x8761('0x43')]()[_0x8761('0x1c')](respondWithResult(_0x289075,null))[_0x8761('0x3e')](handleError(_0x289075,null));}; \ No newline at end of file diff --git a/server/api/whatsappTransferReport/whatsappTransferReport.model.js b/server/api/whatsappTransferReport/whatsappTransferReport.model.js index fbcc614..0b46289 100644 --- a/server/api/whatsappTransferReport/whatsappTransferReport.model.js +++ b/server/api/whatsappTransferReport/whatsappTransferReport.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x72f8=['lodash','util','../../config/logger','moment','request-promise','rimraf','../../config/environment','./whatsappTransferReport.attributes','exports','define','WhatsappTransferReport','uniqueid'];(function(_0xf0ec6e,_0xa183d3){var _0x8bbc27=function(_0x39822b){while(--_0x39822b){_0xf0ec6e['push'](_0xf0ec6e['shift']());}};_0x8bbc27(++_0xa183d3);}(_0x72f8,0x168));var _0x872f=function(_0x48999d,_0x1e02cb){_0x48999d=_0x48999d-0x0;var _0x1ad0d1=_0x72f8[_0x48999d];return _0x1ad0d1;};'use strict';var _=require(_0x872f('0x0'));var util=require(_0x872f('0x1'));var logger=require(_0x872f('0x2'))('api');var moment=require(_0x872f('0x3'));var BPromise=require('bluebird');var rp=require(_0x872f('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x872f('0x5'));var config=require(_0x872f('0x6'));var attributes=require(_0x872f('0x7'));module[_0x872f('0x8')]=function(_0x193b5b,_0x4c35d4){return _0x193b5b[_0x872f('0x9')](_0x872f('0xa'),attributes,{'tableName':'report_whatsapp_transfer','paranoid':![],'indexes':[{'name':'uniqueid','fields':[_0x872f('0xb')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xbce7=['uniqueid','util','../../config/logger','api','request-promise','rimraf','./whatsappTransferReport.attributes','exports','report_whatsapp_transfer'];(function(_0xa148b7,_0x2f3eb2){var _0x51efd3=function(_0x34bcec){while(--_0x34bcec){_0xa148b7['push'](_0xa148b7['shift']());}};_0x51efd3(++_0x2f3eb2);}(_0xbce7,0x160));var _0x7bce=function(_0xb55b47,_0x4acac6){_0xb55b47=_0xb55b47-0x0;var _0x53650f=_0xbce7[_0xb55b47];return _0x53650f;};'use strict';var _=require('lodash');var util=require(_0x7bce('0x0'));var logger=require(_0x7bce('0x1'))(_0x7bce('0x2'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x7bce('0x3'));var fs=require('fs');var path=require('path');var rimraf=require(_0x7bce('0x4'));var config=require('../../config/environment');var attributes=require(_0x7bce('0x5'));module[_0x7bce('0x6')]=function(_0x236da4,_0x3284d1){return _0x236da4['define']('WhatsappTransferReport',attributes,{'tableName':_0x7bce('0x7'),'paranoid':![],'indexes':[{'name':_0x7bce('0x8'),'fields':[_0x7bce('0x8')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/whatsappTransferReport/whatsappTransferReport.rpc.js b/server/api/whatsappTransferReport/whatsappTransferReport.rpc.js index 0c110d3..1fab733 100644 --- a/server/api/whatsappTransferReport/whatsappTransferReport.rpc.js +++ b/server/api/whatsappTransferReport/whatsappTransferReport.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa9e0=['http','info','WhatsappTransferReport,\x20%s,\x20%s','request\x20sent','debug','WhatsappTransferReport,\x20%s,\x20%s,\x20%s','code','error','message','result','catch','lodash','util','moment','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise'];(function(_0x541c1d,_0x572c2c){var _0x3a0077=function(_0x3b637f){while(--_0x3b637f){_0x541c1d['push'](_0x541c1d['shift']());}};_0x3a0077(++_0x572c2c);}(_0xa9e0,0x123));var _0x0a9e=function(_0x2763f2,_0x416af8){_0x2763f2=_0x2763f2-0x0;var _0x3ef471=_0xa9e0[_0x2763f2];return _0x3ef471;};'use strict';var _=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var moment=require(_0x0a9e('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x0a9e('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x0a9e('0x4'));var logger=require(_0x0a9e('0x5'))(_0x0a9e('0x6'));var config=require(_0x0a9e('0x7'));var jayson=require(_0x0a9e('0x8'));var client=jayson['client'][_0x0a9e('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x441e3a,_0x2cc193,_0x5f41ea){return new BPromise(function(_0x503809,_0xe42b77){return client['request'](_0x441e3a,_0x5f41ea)['then'](function(_0x39753a){logger[_0x0a9e('0xa')](_0x0a9e('0xb'),_0x2cc193,_0x0a9e('0xc'));logger[_0x0a9e('0xd')](_0x0a9e('0xe'),_0x2cc193,'request\x20sent',JSON['stringify'](_0x39753a));if(_0x39753a['error']){if(_0x39753a['error'][_0x0a9e('0xf')]===0x1f4){logger[_0x0a9e('0x10')](_0x0a9e('0xb'),_0x2cc193,_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);return _0xe42b77(_0x39753a[_0x0a9e('0x10')]['message']);}logger[_0x0a9e('0x10')](_0x0a9e('0xb'),_0x2cc193,_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);return _0x503809(_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);}else{logger['info'](_0x0a9e('0xb'),_0x2cc193,'request\x20sent');_0x503809(_0x39753a[_0x0a9e('0x12')]['message']);}})[_0x0a9e('0x13')](function(_0x12066b){logger['error'](_0x0a9e('0xb'),_0x2cc193,_0x12066b);_0xe42b77(_0x12066b);});});} \ No newline at end of file +var _0xa9e0=['http','info','WhatsappTransferReport,\x20%s,\x20%s','request\x20sent','debug','WhatsappTransferReport,\x20%s,\x20%s,\x20%s','code','error','message','result','catch','lodash','util','moment','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise'];(function(_0x1fca7a,_0x15d866){var _0x4ee436=function(_0x395ac7){while(--_0x395ac7){_0x1fca7a['push'](_0x1fca7a['shift']());}};_0x4ee436(++_0x15d866);}(_0xa9e0,0x123));var _0x0a9e=function(_0x297fd3,_0x115406){_0x297fd3=_0x297fd3-0x0;var _0x2af381=_0xa9e0[_0x297fd3];return _0x2af381;};'use strict';var _=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var moment=require(_0x0a9e('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x0a9e('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x0a9e('0x4'));var logger=require(_0x0a9e('0x5'))(_0x0a9e('0x6'));var config=require(_0x0a9e('0x7'));var jayson=require(_0x0a9e('0x8'));var client=jayson['client'][_0x0a9e('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x441e3a,_0x2cc193,_0x5f41ea){return new BPromise(function(_0x503809,_0xe42b77){return client['request'](_0x441e3a,_0x5f41ea)['then'](function(_0x39753a){logger[_0x0a9e('0xa')](_0x0a9e('0xb'),_0x2cc193,_0x0a9e('0xc'));logger[_0x0a9e('0xd')](_0x0a9e('0xe'),_0x2cc193,'request\x20sent',JSON['stringify'](_0x39753a));if(_0x39753a['error']){if(_0x39753a['error'][_0x0a9e('0xf')]===0x1f4){logger[_0x0a9e('0x10')](_0x0a9e('0xb'),_0x2cc193,_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);return _0xe42b77(_0x39753a[_0x0a9e('0x10')]['message']);}logger[_0x0a9e('0x10')](_0x0a9e('0xb'),_0x2cc193,_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);return _0x503809(_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);}else{logger['info'](_0x0a9e('0xb'),_0x2cc193,'request\x20sent');_0x503809(_0x39753a[_0x0a9e('0x12')]['message']);}})[_0x0a9e('0x13')](function(_0x12066b){logger['error'](_0x0a9e('0xb'),_0x2cc193,_0x12066b);_0xe42b77(_0x12066b);});});} \ No newline at end of file diff --git a/server/app.js b/server/app.js index 338177a..4028781 100644 --- a/server/app.js +++ b/server/app.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xf39d=['./config/seedDB','./config/license','catch','error','Server\x20failed\x20to\x20start\x20due\x20to\x20error:\x20%s','./mysqldb','./config/logger','./config/pm2','./config/schedule','./config/schedule/chat','sequelize','sync','then','listen','info','start','Online\x20apps:','map','filter','status','online','name','join','None'];(function(_0x35da42,_0x5c2610){var _0x370035=function(_0x546db5){while(--_0x546db5){_0x35da42['push'](_0x35da42['shift']());}};_0x370035(++_0x5c2610);}(_0xf39d,0xf5));var _0xdf39=function(_0x16eb11,_0x1a2251){_0x16eb11=_0x16eb11-0x0;var _0x3ae7ef=_0xf39d[_0x16eb11];return _0x3ae7ef;};'use strict';var _=require('lodash');var mysqldb=require(_0xdf39('0x0'));var rpc=require('./rpc');var config=require('./config/environment');var logger=require(_0xdf39('0x1'))('app');var pm2=require(_0xdf39('0x2'));var pm2Config=require('./config/pm2/config');var schedule=require(_0xdf39('0x3'));var chat=require(_0xdf39('0x4'));function main(){return mysqldb['db'][_0xdf39('0x5')][_0xdf39('0x6')]()[_0xdf39('0x7')](function(){return rpc[_0xdf39('0x8')]();})[_0xdf39('0x7')](function(_0x1b73d9){logger[_0xdf39('0x9')](_0x1b73d9);return chat[_0xdf39('0xa')]();})[_0xdf39('0x7')](function(){return schedule['start']();})[_0xdf39('0x7')](function(_0x2394cf){logger[_0xdf39('0x9')](_0x2394cf);return pm2[_0xdf39('0xa')](pm2Config);})[_0xdf39('0x7')](function(_0x1921b5){logger[_0xdf39('0x9')](_0xdf39('0xb'),_[_0xdf39('0xc')](_['filter'](_0x1921b5,{'status':'online'}),'name')['join']());logger[_0xdf39('0x9')]('Offline\x20apps:',_[_0xdf39('0xc')](_[_0xdf39('0xd')](_0x1921b5,function(_0x1fced5){return _0x1fced5[_0xdf39('0xe')]!==_0xdf39('0xf');}),_0xdf39('0x10'))[_0xdf39('0x11')]()||_0xdf39('0x12'));config['seedDB']&&require(_0xdf39('0x13'))['default']();require(_0xdf39('0x14'))['default']();})[_0xdf39('0x15')](function(_0x4f4543){logger[_0xdf39('0x16')](_0xdf39('0x17'),_0x4f4543);process['exit'](0x1);});}main(); \ No newline at end of file +var _0x9803=['seedDB','./config/seedDB','default','./config/license','catch','error','exit','lodash','./mysqldb','./rpc','./config/environment','./config/logger','./config/pm2','./config/pm2/config','./config/schedule','./config/schedule/chat','sync','then','listen','start','info','Online\x20apps:','map','filter','online','join','Offline\x20apps:','status','None'];(function(_0x15a551,_0x63d4a4){var _0x14034f=function(_0x5d9515){while(--_0x5d9515){_0x15a551['push'](_0x15a551['shift']());}};_0x14034f(++_0x63d4a4);}(_0x9803,0x163));var _0x3980=function(_0x19e35c,_0x29cd1e){_0x19e35c=_0x19e35c-0x0;var _0x3e1fe8=_0x9803[_0x19e35c];return _0x3e1fe8;};'use strict';var _=require(_0x3980('0x0'));var mysqldb=require(_0x3980('0x1'));var rpc=require(_0x3980('0x2'));var config=require(_0x3980('0x3'));var logger=require(_0x3980('0x4'))('app');var pm2=require(_0x3980('0x5'));var pm2Config=require(_0x3980('0x6'));var schedule=require(_0x3980('0x7'));var chat=require(_0x3980('0x8'));function main(){return mysqldb['db']['sequelize'][_0x3980('0x9')]()[_0x3980('0xa')](function(){return rpc[_0x3980('0xb')]();})['then'](function(_0x5c21d6){logger['info'](_0x5c21d6);return chat[_0x3980('0xc')]();})['then'](function(){return schedule['start']();})[_0x3980('0xa')](function(_0x214028){logger[_0x3980('0xd')](_0x214028);return pm2['start'](pm2Config);})[_0x3980('0xa')](function(_0x50d63e){logger[_0x3980('0xd')](_0x3980('0xe'),_[_0x3980('0xf')](_[_0x3980('0x10')](_0x50d63e,{'status':_0x3980('0x11')}),'name')[_0x3980('0x12')]());logger[_0x3980('0xd')](_0x3980('0x13'),_['map'](_['filter'](_0x50d63e,function(_0x9f874c){return _0x9f874c[_0x3980('0x14')]!=='online';}),'name')[_0x3980('0x12')]()||_0x3980('0x15'));config[_0x3980('0x16')]&&require(_0x3980('0x17'))[_0x3980('0x18')]();require(_0x3980('0x19'))[_0x3980('0x18')]();})[_0x3980('0x1a')](function(_0x7c1dfc){logger[_0x3980('0x1b')]('Server\x20failed\x20to\x20start\x20due\x20to\x20error:\x20%s',_0x7c1dfc);process[_0x3980('0x1c')](0x1);});}main(); \ No newline at end of file diff --git a/server/components/auth/service.js b/server/components/auth/service.js index b712d30..df36bee 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 _0x9f0e=['toString','HS512','../../mysqldb','../../config/environment','../../config/license/hardware','lodash','jsonwebtoken','basic-auth','crypto','bluebird','secrets','session','name','internal','email','permissions','md5secret','voicePause','chatPause','mailPause','faxPause','smsPause','openchannelPause','pauseType','lastLoginAt','lastPauseAt','crudPermissions','passwordResetAt','phoneBarAutoAnswer','phoneBarAutoAnswerDelay','phoneBarEnableRecording','phoneBarEnableDtmfTone','phoneBarExpires','phoneBarRemoteControl','phoneBarRemoteControlPort','hotdesk','userProfileId','isChatInteractionAuthorized','isAuthenticated','user','ChatInteraction','findOne','params','disposition','then','status','unmanaged','json','Unmanaged.','use','headers','authorization','startsWith','Basic','User','find','authenticate','pass','Wrong\x20credentials.','catch','Bearer','Unknown\x20authorization\x20format','query','apikey','getUuid','sub','isEqual','apiKeyNonce','nonce','Invalid\x20API\x20access\x20key','User\x20not\x20found.','User\x20object\x20not\x20found.','../../config/license/util','getLicense','isMiddleware','signToken','setTokenCookie','It\x20looks\x20like\x20you\x20aren\x27t\x20logged\x20in,\x20please\x20try\x20again.','cookie','motion.token','/dashboards/general','send','isNil','apiKeyIat','regenerateApiKey','promisify','secret','payload','options','randomBytes','hex','floor'];(function(_0x1e9163,_0x438c87){var _0x10a65e=function(_0x253b65){while(--_0x253b65){_0x1e9163['push'](_0x1e9163['shift']());}};_0x10a65e(++_0x438c87);}(_0x9f0e,0x116));var _0xe9f0=function(_0x575712,_0x9910f7){_0x575712=_0x575712-0x0;var _0x544fe8=_0x9f0e[_0x575712];return _0x544fe8;};'use strict';var db=require(_0xe9f0('0x0'))['db'];var config=require(_0xe9f0('0x1'));var hardwareConf=require(_0xe9f0('0x2'));var _=require(_0xe9f0('0x3'));var jwt=require(_0xe9f0('0x4'));var expressJwt=require('express-jwt');var compose=require('composable-middleware');var basicAuth=require(_0xe9f0('0x5'));var crypto=require(_0xe9f0('0x6'));var BPromise=require(_0xe9f0('0x7'));var validateJwt=expressJwt({'secret':config[_0xe9f0('0x8')][_0xe9f0('0x9')]});var userAttributes=['id','role','fullname',_0xe9f0('0xa'),_0xe9f0('0xb'),_0xe9f0('0xc'),'userpic',_0xe9f0('0xd'),_0xe9f0('0xe'),_0xe9f0('0xf'),_0xe9f0('0x10'),_0xe9f0('0x11'),_0xe9f0('0x12'),_0xe9f0('0x13'),_0xe9f0('0x14'),_0xe9f0('0x15'),'showWebBar',_0xe9f0('0x16'),_0xe9f0('0x17'),_0xe9f0('0x18'),'allowmessenger',_0xe9f0('0x19'),'alias',_0xe9f0('0x1a'),_0xe9f0('0x1b'),_0xe9f0('0x1c'),_0xe9f0('0x1d'),'phoneBarEnableSettings',_0xe9f0('0x1e'),'phoneBarPrefixRequired',_0xe9f0('0x1f'),_0xe9f0('0x20'),_0xe9f0('0x21'),'interface',_0xe9f0('0x22')];exports[_0xe9f0('0x23')]=function(){return this[_0xe9f0('0x24')](!![])['use'](function(_0xaa7aa6,_0x1e16e0,_0xcd2042){if(_0xaa7aa6[_0xe9f0('0x25')]){_0xcd2042();}else{return db[_0xe9f0('0x26')][_0xe9f0('0x27')]({'where':{'id':_0xaa7aa6[_0xe9f0('0x28')]['id']},'attributes':['id','closed',_0xe9f0('0x29')],'raw':!![]})[_0xe9f0('0x2a')](function(_0x232f2c){if(_0x232f2c&&_0x232f2c['closed']){return _0x1e16e0[_0xe9f0('0x2b')](_0x232f2c[_0xe9f0('0x29')]===_0xe9f0('0x2c')?0x195:0x193)[_0xe9f0('0x2d')]({'message':_0x232f2c['disposition']===_0xe9f0('0x2c')?_0xe9f0('0x2e'):'Forbidden.'});}else{_0xcd2042();}})['catch'](function(_0x4cc403){_0xcd2042(_0x4cc403);});}});};exports[_0xe9f0('0x24')]=function isAuthenticated(_0xa1ddc){return compose()[_0xe9f0('0x2f')](function(_0x316cdf,_0x3ce106,_0x4a5c27){if(_0x316cdf[_0xe9f0('0x30')][_0xe9f0('0x31')]){if(_[_0xe9f0('0x32')](_0x316cdf[_0xe9f0('0x30')][_0xe9f0('0x31')],_0xe9f0('0x33'))){var _0x37c0fc=basicAuth(_0x316cdf);db[_0xe9f0('0x34')][_0xe9f0('0x35')]({'where':{'name':_0x37c0fc[_0xe9f0('0xa')]}})['then'](function(_0x371095){if(!_0x371095||!_0x371095[_0xe9f0('0x36')](_0x37c0fc[_0xe9f0('0x37')])){return _0x3ce106[_0xe9f0('0x2b')](0x191)['json']({'message':_0xe9f0('0x38')});}_0x316cdf[_0xe9f0('0x25')]={'id':_0x371095['id']};_0x4a5c27();})[_0xe9f0('0x39')](function(_0x1f98a7){_0x4a5c27(_0x1f98a7);});}else if(_[_0xe9f0('0x32')](_0x316cdf['headers'][_0xe9f0('0x31')],_0xe9f0('0x3a'))){validateJwt(_0x316cdf,_0x3ce106,_0x4a5c27);}else{if(_0xa1ddc){_0x4a5c27();}else{return _0x3ce106[_0xe9f0('0x2b')](0x193)[_0xe9f0('0x2d')]({'message':_0xe9f0('0x3b')});}}}else if(_0x316cdf[_0xe9f0('0x3c')][_0xe9f0('0x3d')]){try{var _0x2efd33={'audience':hardwareConf[_0xe9f0('0x3e')](),'issuer':hardwareConf[_0xe9f0('0x3e')]()};verifyJwt(_0x316cdf[_0xe9f0('0x3c')][_0xe9f0('0x3d')],_0x2efd33)[_0xe9f0('0x2a')](function(_0x2ab77d){return db[_0xe9f0('0x34')][_0xe9f0('0x35')]({'where':{'id':_0x2ab77d[_0xe9f0('0x3f')]}})[_0xe9f0('0x2a')](function(_0x2e7535){if(!_0x2e7535||!_[_0xe9f0('0x40')](_0x2e7535[_0xe9f0('0x41')],_0x2ab77d[_0xe9f0('0x42')])){return _0x3ce106[_0xe9f0('0x2b')](0x191)[_0xe9f0('0x2d')]({'message':'API\x20access\x20key\x20is\x20not\x20valid\x20anymore'});}_0x316cdf['user']={'id':_0x2e7535['id']};_0x4a5c27();});})['catch'](function(){return _0x3ce106[_0xe9f0('0x2b')](0x191)['json']({'message':_0xe9f0('0x43')});});}catch(_0xc5fa13){_0x4a5c27(_0xc5fa13);}}else if(_0xa1ddc){_0x4a5c27();}else{return _0x3ce106['status'](0x193)[_0xe9f0('0x2d')]({'message':'Unknown\x20authorization\x20format'});}})['use'](function(_0x59024e,_0x165440,_0x39722b){if(_0x59024e['user']){db[_0xe9f0('0x34')][_0xe9f0('0x35')]({'where':{'id':_0x59024e[_0xe9f0('0x25')]['id']},'attributes':userAttributes})['then'](function(_0x523fbc){if(!_0x523fbc){return _0x165440[_0xe9f0('0x2b')](0x194)[_0xe9f0('0x2d')]({'message':_0xe9f0('0x44')});}_0x59024e['user']=_0x523fbc;_0x39722b();})[_0xe9f0('0x39')](function(_0x2e7997){_0x39722b(_0x2e7997);});}else if(_0xa1ddc){_0x39722b();}else{return _0x165440[_0xe9f0('0x2b')](0x194)[_0xe9f0('0x2d')]({'message':_0xe9f0('0x45')});}});};exports['canUpdate']=function canUpdate(){return compose()[_0xe9f0('0x2f')](function(_0x3a2b23,_0x2ede2,_0x5a8c5a){return require(_0xe9f0('0x46'))[_0xe9f0('0x47')]()['then'](function(_0x317278){if(_0x317278['update']){_0x5a8c5a();}else{return _0x2ede2[_0xe9f0('0x2b')](0x193)['json']({'message':'Forbidden'});}})['catch'](function(_0x5bddcc){_0x5a8c5a(_0x5bddcc);});});};exports['isMiddleware']=function(_0x35062f,_0x2d4115,_0x2d8f93){_0x35062f[_0xe9f0('0x48')]=!![];return _0x2d8f93();};exports[_0xe9f0('0x49')]=function signToken(_0xd9b61b){return signJwt(_0xd9b61b);};exports[_0xe9f0('0x4a')]=function(_0x3e79c1,_0xb06e04){if(!_0x3e79c1['user']){return _0xb06e04[_0xe9f0('0x2b')](0x194)[_0xe9f0('0x2d')]({'message':_0xe9f0('0x4b')});}var _0x571366={'payload':{'id':_0x3e79c1['user']['id'],'role':_0x3e79c1[_0xe9f0('0x25')]['role']},'options':{'expiresIn':0x15180}};return signJwt(_0x571366)[_0xe9f0('0x2a')](function(_0x52613a){_0xb06e04[_0xe9f0('0x4c')](_0xe9f0('0x4d'),_0x52613a);_0xb06e04['redirect'](_0xe9f0('0x4e'));})[_0xe9f0('0x39')](function(_0x43e971){return _0xb06e04[_0xe9f0('0x2b')](0x1f4)[_0xe9f0('0x4f')](_0x43e971);});};exports['retrieveApiKey']=function(_0x60a40d){if(_[_0xe9f0('0x50')](_0x60a40d[_0xe9f0('0x41')])||_[_0xe9f0('0x50')](_0x60a40d[_0xe9f0('0x51')])){return null;}else{return createJwt(_0x60a40d);}};exports['generateApiKey']=function(_0x3a8d1d){_0x3a8d1d['apiKeyNonce']=generateNonce();_0x3a8d1d['apiKeyIat']=generateIssuedAt();return createJwt(_0x3a8d1d);};exports[_0xe9f0('0x52')]=function(_0x17b832,_0x536734){var _0x10a360=_0x17b832[_0xe9f0('0x3c')][_0xe9f0('0x3d')];if(_0x10a360){var _0x7b167b={'nonce':_0x536734[_0xe9f0('0x41')],'iat':_0x536734[_0xe9f0('0x51')],'audience':hardwareConf[_0xe9f0('0x3e')](),'issuer':hardwareConf['getUuid']()};return verifyJwt(_0x10a360,_0x7b167b)[_0xe9f0('0x2a')](function(){return generateApiKey(_0x536734);});}else{throw{'message':'Please\x20use\x20the\x20previous\x20API\x20access\x20key\x20to\x20generate\x20a\x20new\x20one'};}};function signJwt(_0x3b8712){var _0x5a3488=BPromise[_0xe9f0('0x53')](jwt['sign'],{'context':jwt});var _0xe6497a=_0x3b8712[_0xe9f0('0x54')]||config[_0xe9f0('0x8')]['session'];return new BPromise(function(_0x26c091,_0xcf426d){_0x5a3488(_0x3b8712[_0xe9f0('0x55')],_0xe6497a,_0x3b8712[_0xe9f0('0x56')])[_0xe9f0('0x2a')](function(_0x135175){_0x26c091(_0x135175);})[_0xe9f0('0x39')](function(_0x42ff7){_0xcf426d(_0x42ff7);});});}function verifyJwt(_0x18fc2b,_0x13c4ad,_0x108467){var _0x1325a2=BPromise['promisify'](jwt['verify'],{'context':jwt});var _0x31aa19=_0x108467||config[_0xe9f0('0x8')][_0xe9f0('0x9')];return new BPromise(function(_0x5d2a78,_0x1ac381){_0x1325a2(_0x18fc2b,_0x31aa19,_0x13c4ad)['then'](function(_0x323e1e){_0x5d2a78(_0x323e1e);})[_0xe9f0('0x39')](function(_0x31770f){_0x1ac381(_0x31770f);});});}function generateNonce(){return crypto[_0xe9f0('0x57')](0x10)['toString'](_0xe9f0('0x58'));}function generateIssuedAt(){return Math[_0xe9f0('0x59')](Date['now']()/0x3e8)[_0xe9f0('0x5a')]();}function createJwt(_0xafb4d7){var _0x33f26c={'payload':{'iat':_0xafb4d7[_0xe9f0('0x51')],'nonce':_0xafb4d7['apiKeyNonce']},'options':{'algorithm':_0xe9f0('0x5b'),'subject':_0xafb4d7['id'][_0xe9f0('0x5a')](),'issuer':hardwareConf[_0xe9f0('0x3e')](),'audience':hardwareConf[_0xe9f0('0x3e')]()}};return signJwt(_0x33f26c)[_0xe9f0('0x2a')](function(_0x27ae5a){return{'iat':_0xafb4d7[_0xe9f0('0x51')],'nonce':_0xafb4d7[_0xe9f0('0x41')],'token':_0x27ae5a};});} \ No newline at end of file +var _0x5f2f=['send','retrieveApiKey','isNil','apiKeyIat','generateApiKey','regenerateApiKey','Please\x20use\x20the\x20previous\x20API\x20access\x20key\x20to\x20generate\x20a\x20new\x20one','promisify','sign','secret','payload','options','verify','toString','hex','now','HS512','../../mysqldb','../../config/environment','../../config/license/hardware','lodash','jsonwebtoken','express-jwt','composable-middleware','basic-auth','secrets','session','role','fullname','name','internal','userpic','permissions','md5secret','chatPause','mailPause','faxPause','openchannelPause','lastLoginAt','lastPauseAt','allowmessenger','passwordResetAt','alias','phoneBarAutoAnswer','phoneBarAutoAnswerDelay','phoneBarEnableRecording','phoneBarEnableSettings','phoneBarExpires','phoneBarPrefixRequired','phoneBarRemoteControl','phoneBarRemoteControlPort','interface','userProfileId','isChatInteractionAuthorized','isAuthenticated','use','user','ChatInteraction','findOne','params','closed','disposition','then','unmanaged','Unmanaged.','catch','headers','authorization','startsWith','Basic','User','find','authenticate','pass','json','Wrong\x20credentials.','Bearer','status','apikey','getUuid','query','isEqual','apiKeyNonce','nonce','API\x20access\x20key\x20is\x20not\x20valid\x20anymore','Invalid\x20API\x20access\x20key','User\x20not\x20found.','canUpdate','../../config/license/util','getLicense','update','Forbidden','isMiddleware','signToken','setTokenCookie','cookie','motion.token','/dashboards/general'];(function(_0x5c4f6b,_0x2cdfce){var _0x104c4e=function(_0x31171b){while(--_0x31171b){_0x5c4f6b['push'](_0x5c4f6b['shift']());}};_0x104c4e(++_0x2cdfce);}(_0x5f2f,0x73));var _0xf5f2=function(_0x5a0f87,_0x38214a){_0x5a0f87=_0x5a0f87-0x0;var _0x24d4dd=_0x5f2f[_0x5a0f87];return _0x24d4dd;};'use strict';var db=require(_0xf5f2('0x0'))['db'];var config=require(_0xf5f2('0x1'));var hardwareConf=require(_0xf5f2('0x2'));var _=require(_0xf5f2('0x3'));var jwt=require(_0xf5f2('0x4'));var expressJwt=require(_0xf5f2('0x5'));var compose=require(_0xf5f2('0x6'));var basicAuth=require(_0xf5f2('0x7'));var crypto=require('crypto');var BPromise=require('bluebird');var validateJwt=expressJwt({'secret':config[_0xf5f2('0x8')][_0xf5f2('0x9')]});var userAttributes=['id',_0xf5f2('0xa'),_0xf5f2('0xb'),_0xf5f2('0xc'),_0xf5f2('0xd'),'email',_0xf5f2('0xe'),_0xf5f2('0xf'),_0xf5f2('0x10'),'voicePause',_0xf5f2('0x11'),_0xf5f2('0x12'),_0xf5f2('0x13'),'smsPause',_0xf5f2('0x14'),'pauseType','showWebBar',_0xf5f2('0x15'),_0xf5f2('0x16'),'crudPermissions',_0xf5f2('0x17'),_0xf5f2('0x18'),_0xf5f2('0x19'),_0xf5f2('0x1a'),_0xf5f2('0x1b'),_0xf5f2('0x1c'),'phoneBarEnableDtmfTone',_0xf5f2('0x1d'),_0xf5f2('0x1e'),_0xf5f2('0x1f'),_0xf5f2('0x20'),_0xf5f2('0x21'),'hotdesk',_0xf5f2('0x22'),_0xf5f2('0x23')];exports[_0xf5f2('0x24')]=function(){return this[_0xf5f2('0x25')](!![])[_0xf5f2('0x26')](function(_0x3a9dbb,_0xdb61b3,_0x395a5a){if(_0x3a9dbb[_0xf5f2('0x27')]){_0x395a5a();}else{return db[_0xf5f2('0x28')][_0xf5f2('0x29')]({'where':{'id':_0x3a9dbb[_0xf5f2('0x2a')]['id']},'attributes':['id',_0xf5f2('0x2b'),_0xf5f2('0x2c')],'raw':!![]})[_0xf5f2('0x2d')](function(_0x626999){if(_0x626999&&_0x626999[_0xf5f2('0x2b')]){return _0xdb61b3['status'](_0x626999[_0xf5f2('0x2c')]===_0xf5f2('0x2e')?0x195:0x193)['json']({'message':_0x626999['disposition']===_0xf5f2('0x2e')?_0xf5f2('0x2f'):'Forbidden.'});}else{_0x395a5a();}})[_0xf5f2('0x30')](function(_0x170042){_0x395a5a(_0x170042);});}});};exports[_0xf5f2('0x25')]=function isAuthenticated(_0x39c024){return compose()[_0xf5f2('0x26')](function(_0x4c691a,_0x21cd91,_0x4669a6){if(_0x4c691a[_0xf5f2('0x31')][_0xf5f2('0x32')]){if(_[_0xf5f2('0x33')](_0x4c691a['headers']['authorization'],_0xf5f2('0x34'))){var _0x3f79d5=basicAuth(_0x4c691a);db[_0xf5f2('0x35')][_0xf5f2('0x36')]({'where':{'name':_0x3f79d5[_0xf5f2('0xc')]}})[_0xf5f2('0x2d')](function(_0x13a3be){if(!_0x13a3be||!_0x13a3be[_0xf5f2('0x37')](_0x3f79d5[_0xf5f2('0x38')])){return _0x21cd91['status'](0x191)[_0xf5f2('0x39')]({'message':_0xf5f2('0x3a')});}_0x4c691a[_0xf5f2('0x27')]={'id':_0x13a3be['id']};_0x4669a6();})[_0xf5f2('0x30')](function(_0x198c73){_0x4669a6(_0x198c73);});}else if(_[_0xf5f2('0x33')](_0x4c691a['headers']['authorization'],_0xf5f2('0x3b'))){validateJwt(_0x4c691a,_0x21cd91,_0x4669a6);}else{if(_0x39c024){_0x4669a6();}else{return _0x21cd91[_0xf5f2('0x3c')](0x193)[_0xf5f2('0x39')]({'message':'Unknown\x20authorization\x20format'});}}}else if(_0x4c691a['query'][_0xf5f2('0x3d')]){try{var _0x50b8a2={'audience':hardwareConf[_0xf5f2('0x3e')](),'issuer':hardwareConf[_0xf5f2('0x3e')]()};verifyJwt(_0x4c691a[_0xf5f2('0x3f')]['apikey'],_0x50b8a2)['then'](function(_0x2f4778){return db['User'][_0xf5f2('0x36')]({'where':{'id':_0x2f4778['sub']}})[_0xf5f2('0x2d')](function(_0x31087c){if(!_0x31087c||!_[_0xf5f2('0x40')](_0x31087c[_0xf5f2('0x41')],_0x2f4778[_0xf5f2('0x42')])){return _0x21cd91[_0xf5f2('0x3c')](0x191)[_0xf5f2('0x39')]({'message':_0xf5f2('0x43')});}_0x4c691a['user']={'id':_0x31087c['id']};_0x4669a6();});})[_0xf5f2('0x30')](function(){return _0x21cd91[_0xf5f2('0x3c')](0x191)[_0xf5f2('0x39')]({'message':_0xf5f2('0x44')});});}catch(_0x1408b9){_0x4669a6(_0x1408b9);}}else if(_0x39c024){_0x4669a6();}else{return _0x21cd91[_0xf5f2('0x3c')](0x193)[_0xf5f2('0x39')]({'message':'Unknown\x20authorization\x20format'});}})[_0xf5f2('0x26')](function(_0xf503e8,_0x55989d,_0x3fc168){if(_0xf503e8['user']){db[_0xf5f2('0x35')][_0xf5f2('0x36')]({'where':{'id':_0xf503e8[_0xf5f2('0x27')]['id']},'attributes':userAttributes})[_0xf5f2('0x2d')](function(_0x59a6dd){if(!_0x59a6dd){return _0x55989d['status'](0x194)[_0xf5f2('0x39')]({'message':_0xf5f2('0x45')});}_0xf503e8[_0xf5f2('0x27')]=_0x59a6dd;_0x3fc168();})['catch'](function(_0x41447f){_0x3fc168(_0x41447f);});}else if(_0x39c024){_0x3fc168();}else{return _0x55989d['status'](0x194)[_0xf5f2('0x39')]({'message':'User\x20object\x20not\x20found.'});}});};exports[_0xf5f2('0x46')]=function canUpdate(){return compose()[_0xf5f2('0x26')](function(_0x5337a6,_0x29694f,_0x46eb22){return require(_0xf5f2('0x47'))[_0xf5f2('0x48')]()['then'](function(_0x5d2d82){if(_0x5d2d82[_0xf5f2('0x49')]){_0x46eb22();}else{return _0x29694f[_0xf5f2('0x3c')](0x193)[_0xf5f2('0x39')]({'message':_0xf5f2('0x4a')});}})[_0xf5f2('0x30')](function(_0xe62b57){_0x46eb22(_0xe62b57);});});};exports[_0xf5f2('0x4b')]=function(_0x4c0ac7,_0x110fe5,_0x3b4ea6){_0x4c0ac7['isMiddleware']=!![];return _0x3b4ea6();};exports[_0xf5f2('0x4c')]=function signToken(_0x3f3895){return signJwt(_0x3f3895);};exports[_0xf5f2('0x4d')]=function(_0x85b6d0,_0xd10701){if(!_0x85b6d0[_0xf5f2('0x27')]){return _0xd10701[_0xf5f2('0x3c')](0x194)[_0xf5f2('0x39')]({'message':'It\x20looks\x20like\x20you\x20aren\x27t\x20logged\x20in,\x20please\x20try\x20again.'});}var _0x31c3c={'payload':{'id':_0x85b6d0[_0xf5f2('0x27')]['id'],'role':_0x85b6d0[_0xf5f2('0x27')]['role']},'options':{'expiresIn':0x15180}};return signJwt(_0x31c3c)['then'](function(_0x59eb00){_0xd10701[_0xf5f2('0x4e')](_0xf5f2('0x4f'),_0x59eb00);_0xd10701['redirect'](_0xf5f2('0x50'));})[_0xf5f2('0x30')](function(_0x28e33f){return _0xd10701[_0xf5f2('0x3c')](0x1f4)[_0xf5f2('0x51')](_0x28e33f);});};exports[_0xf5f2('0x52')]=function(_0x1a6ec1){if(_[_0xf5f2('0x53')](_0x1a6ec1[_0xf5f2('0x41')])||_[_0xf5f2('0x53')](_0x1a6ec1[_0xf5f2('0x54')])){return null;}else{return createJwt(_0x1a6ec1);}};exports[_0xf5f2('0x55')]=function(_0x4252a3){_0x4252a3[_0xf5f2('0x41')]=generateNonce();_0x4252a3['apiKeyIat']=generateIssuedAt();return createJwt(_0x4252a3);};exports[_0xf5f2('0x56')]=function(_0x578c93,_0x3d62c1){var _0xc04f44=_0x578c93[_0xf5f2('0x3f')][_0xf5f2('0x3d')];if(_0xc04f44){var _0x31bf0e={'nonce':_0x3d62c1[_0xf5f2('0x41')],'iat':_0x3d62c1['apiKeyIat'],'audience':hardwareConf[_0xf5f2('0x3e')](),'issuer':hardwareConf[_0xf5f2('0x3e')]()};return verifyJwt(_0xc04f44,_0x31bf0e)[_0xf5f2('0x2d')](function(){return generateApiKey(_0x3d62c1);});}else{throw{'message':_0xf5f2('0x57')};}};function signJwt(_0x12124d){var _0x10753a=BPromise[_0xf5f2('0x58')](jwt[_0xf5f2('0x59')],{'context':jwt});var _0x5e6071=_0x12124d[_0xf5f2('0x5a')]||config[_0xf5f2('0x8')][_0xf5f2('0x9')];return new BPromise(function(_0x492eea,_0x1177ba){_0x10753a(_0x12124d[_0xf5f2('0x5b')],_0x5e6071,_0x12124d[_0xf5f2('0x5c')])['then'](function(_0x57a7cb){_0x492eea(_0x57a7cb);})[_0xf5f2('0x30')](function(_0x27c472){_0x1177ba(_0x27c472);});});}function verifyJwt(_0x5db519,_0x14aa81,_0x533cca){var _0x740321=BPromise['promisify'](jwt[_0xf5f2('0x5d')],{'context':jwt});var _0x5d9120=_0x533cca||config[_0xf5f2('0x8')][_0xf5f2('0x9')];return new BPromise(function(_0xbb658c,_0x11a083){_0x740321(_0x5db519,_0x5d9120,_0x14aa81)['then'](function(_0x3154c1){_0xbb658c(_0x3154c1);})[_0xf5f2('0x30')](function(_0x4f6b01){_0x11a083(_0x4f6b01);});});}function generateNonce(){return crypto['randomBytes'](0x10)[_0xf5f2('0x5e')](_0xf5f2('0x5f'));}function generateIssuedAt(){return Math['floor'](Date[_0xf5f2('0x60')]()/0x3e8)[_0xf5f2('0x5e')]();}function createJwt(_0x29c9b6){var _0x41b1c7={'payload':{'iat':_0x29c9b6['apiKeyIat'],'nonce':_0x29c9b6['apiKeyNonce']},'options':{'algorithm':_0xf5f2('0x61'),'subject':_0x29c9b6['id'][_0xf5f2('0x5e')](),'issuer':hardwareConf['getUuid'](),'audience':hardwareConf[_0xf5f2('0x3e')]()}};return signJwt(_0x41b1c7)[_0xf5f2('0x2d')](function(_0x255125){return{'iat':_0x29c9b6[_0xf5f2('0x54')],'nonce':_0x29c9b6[_0xf5f2('0x41')],'token':_0x255125};});} \ No newline at end of file diff --git a/server/components/encryptor/index.js b/server/components/encryptor/index.js index 5662073..f9b96b9 100644 --- a/server/components/encryptor/index.js +++ b/server/components/encryptor/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa9e0=['update','close','crypto','bluebird','aes192','hasOwnProperty','encryptFile','createReadStream','createCipher','algorithm','data','final','binary','write','end','unlink','decryptFile'];(function(_0x5555a4,_0x59fc5c){var _0x33d5ce=function(_0x182b74){while(--_0x182b74){_0x5555a4['push'](_0x5555a4['shift']());}};_0x33d5ce(++_0x59fc5c);}(_0xa9e0,0x123));var _0x0a9e=function(_0x1ddedd,_0x485606){_0x1ddedd=_0x1ddedd-0x0;var _0xa3e1ac=_0xa9e0[_0x1ddedd];return _0xa3e1ac;};'use strict';var crypto=require(_0x0a9e('0x0'));var fs=require('fs');var BPromise=require(_0x0a9e('0x1'));var defaultOptions={'algorithm':_0x0a9e('0x2')};function combineOptions(_0x5dd881){var _0x550fbc={};for(var _0x18d5c9 in defaultOptions){if(defaultOptions['hasOwnProperty'](_0x18d5c9)){_0x550fbc[_0x18d5c9]=defaultOptions[_0x18d5c9];}}if(_0x5dd881){for(var _0x333808 in _0x5dd881){if(_0x5dd881[_0x0a9e('0x3')](_0x333808)){_0x550fbc[_0x333808]=_0x5dd881[_0x333808];}}}return _0x550fbc;}exports[_0x0a9e('0x4')]=function(_0x991246,_0x981158,_0x57b080,_0x219af0){return new BPromise(function(_0x441e3a,_0x2cc193){_0x219af0=combineOptions(_0x219af0);var _0x5f41ea=new Buffer(_0x57b080);var _0x503809=fs[_0x0a9e('0x5')](_0x991246);var _0x56465b=fs['createWriteStream'](_0x981158);var _0x39753a=crypto[_0x0a9e('0x6')](_0x219af0[_0x0a9e('0x7')],_0x5f41ea);_0x503809['on'](_0x0a9e('0x8'),function(_0xfeb75b){var _0xbd1168=new Buffer(_0x39753a['update'](_0xfeb75b),'binary');_0x56465b['write'](_0xbd1168);});_0x503809['on']('end',function(){try{var _0x273d4d=new Buffer(_0x39753a[_0x0a9e('0x9')](_0x0a9e('0xa')),_0x0a9e('0xa'));_0x56465b[_0x0a9e('0xb')](_0x273d4d);_0x56465b[_0x0a9e('0xc')]();_0x56465b['on']('close',function(){return _0x441e3a(_0x981158);});}catch(_0x4283ce){fs[_0x0a9e('0xd')](_0x981158);return _0x2cc193(_0x4283ce);}});});};exports[_0x0a9e('0xe')]=function(_0x281129,_0x44dcfd,_0x4d5611,_0x52a03d){return new BPromise(function(_0x22dccb,_0x5d0880){_0x52a03d=combineOptions(_0x52a03d);var _0x1985b6=new Buffer(_0x4d5611);var _0x519dfd=fs[_0x0a9e('0x5')](_0x281129);var _0x12066b=fs['createWriteStream'](_0x44dcfd);var _0x225616=crypto['createDecipher'](_0x52a03d[_0x0a9e('0x7')],_0x1985b6);_0x519dfd['on'](_0x0a9e('0x8'),function(_0x106033){var _0x205fd6=new Buffer(_0x225616[_0x0a9e('0xf')](_0x106033),_0x0a9e('0xa'));_0x12066b[_0x0a9e('0xb')](_0x205fd6);});_0x519dfd['on'](_0x0a9e('0xc'),function(){try{var _0x1314ae=new Buffer(_0x225616[_0x0a9e('0x9')](_0x0a9e('0xa')),_0x0a9e('0xa'));_0x12066b['write'](_0x1314ae);_0x12066b[_0x0a9e('0xc')]();_0x12066b['on'](_0x0a9e('0x10'),function(){return _0x22dccb(_0x44dcfd);});}catch(_0x53682f){fs[_0x0a9e('0xd')](_0x44dcfd);return _0x5d0880(_0x53682f);}});});}; \ No newline at end of file +var _0xd8b0=['data','binary','end','final','write','close','unlink','decryptFile','createReadStream','createDecipher','update','crypto','bluebird','hasOwnProperty','encryptFile','createWriteStream','createCipher','algorithm'];(function(_0x176c41,_0x5df842){var _0x309082=function(_0x23a264){while(--_0x23a264){_0x176c41['push'](_0x176c41['shift']());}};_0x309082(++_0x5df842);}(_0xd8b0,0xad));var _0x0d8b=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0xd8b0[_0xa464c9];return _0x3d73c4;};'use strict';var crypto=require(_0x0d8b('0x0'));var fs=require('fs');var BPromise=require(_0x0d8b('0x1'));var defaultOptions={'algorithm':'aes192'};function combineOptions(_0x585166){var _0x4b72b0={};for(var _0x3ff8df in defaultOptions){if(defaultOptions[_0x0d8b('0x2')](_0x3ff8df)){_0x4b72b0[_0x3ff8df]=defaultOptions[_0x3ff8df];}}if(_0x585166){for(var _0x43bca1 in _0x585166){if(_0x585166[_0x0d8b('0x2')](_0x43bca1)){_0x4b72b0[_0x43bca1]=_0x585166[_0x43bca1];}}}return _0x4b72b0;}exports[_0x0d8b('0x3')]=function(_0x577834,_0x5e15e6,_0x3f8b6f,_0x227c63){return new BPromise(function(_0x39f43a,_0x4a4470){_0x227c63=combineOptions(_0x227c63);var _0x413284=new Buffer(_0x3f8b6f);var _0x284169=fs['createReadStream'](_0x577834);var _0x129310=fs[_0x0d8b('0x4')](_0x5e15e6);var _0x3b027f=crypto[_0x0d8b('0x5')](_0x227c63[_0x0d8b('0x6')],_0x413284);_0x284169['on'](_0x0d8b('0x7'),function(_0x2c5e9e){var _0x28f87c=new Buffer(_0x3b027f['update'](_0x2c5e9e),_0x0d8b('0x8'));_0x129310['write'](_0x28f87c);});_0x284169['on'](_0x0d8b('0x9'),function(){try{var _0xc574a3=new Buffer(_0x3b027f[_0x0d8b('0xa')](_0x0d8b('0x8')),_0x0d8b('0x8'));_0x129310[_0x0d8b('0xb')](_0xc574a3);_0x129310[_0x0d8b('0x9')]();_0x129310['on'](_0x0d8b('0xc'),function(){return _0x39f43a(_0x5e15e6);});}catch(_0x1d4bbc){fs[_0x0d8b('0xd')](_0x5e15e6);return _0x4a4470(_0x1d4bbc);}});});};exports[_0x0d8b('0xe')]=function(_0xe65334,_0x1567ce,_0x2d4e1c,_0x4f6f21){return new BPromise(function(_0x23eb7b,_0xa86349){_0x4f6f21=combineOptions(_0x4f6f21);var _0x17f7df=new Buffer(_0x2d4e1c);var _0xe2e167=fs[_0x0d8b('0xf')](_0xe65334);var _0x5cd485=fs[_0x0d8b('0x4')](_0x1567ce);var _0x4586c2=crypto[_0x0d8b('0x10')](_0x4f6f21[_0x0d8b('0x6')],_0x17f7df);_0xe2e167['on'](_0x0d8b('0x7'),function(_0x18dd2d){var _0x264b39=new Buffer(_0x4586c2[_0x0d8b('0x11')](_0x18dd2d),'binary');_0x5cd485[_0x0d8b('0xb')](_0x264b39);});_0xe2e167['on'](_0x0d8b('0x9'),function(){try{var _0x196c0a=new Buffer(_0x4586c2[_0x0d8b('0xa')](_0x0d8b('0x8')),_0x0d8b('0x8'));_0x5cd485[_0x0d8b('0xb')](_0x196c0a);_0x5cd485[_0x0d8b('0x9')]();_0x5cd485['on']('close',function(){return _0x23eb7b(_0x1567ce);});}catch(_0x4f0a1a){fs[_0x0d8b('0xd')](_0x1567ce);return _0xa86349(_0x4f0a1a);}});});}; \ No newline at end of file diff --git a/server/components/export/csv.js b/server/components/export/csv.js index fb72020..8301587 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 _0xec56=['../../mysqldb','dbH','../../config/logger','analytics','argv','savename','AnalyticExtractedReport','update','info','format','Start\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','CSV','Setting','find','splitSizeCsv','then','sequelize','query','SELECT','num','Empty','length','split','push','%s\x20limit\x20%d\x20OFFSET\x20%d','QueryTypes','dirname','.csv','existsSync','join','each','%s%d.%s','csv','writeFileSync','%s.%s','zip','Extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format\x20completed','Completed','Error\x20during\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','Failed','util','to-csv','bluebird','zip-dir','rimraf'];(function(_0x2d000b,_0x5ccb20){var _0x1f4858=function(_0x78c305){while(--_0x78c305){_0x2d000b['push'](_0x2d000b['shift']());}};_0x1f4858(++_0x5ccb20);}(_0xec56,0x1bd));var _0x6ec5=function(_0x51c883,_0x30b452){_0x51c883=_0x51c883-0x0;var _0x3203ce=_0xec56[_0x51c883];return _0x3203ce;};'use strict';var util=require(_0x6ec5('0x0'));var path=require('path');var _=require('lodash');var csv=require(_0x6ec5('0x1'));var fs=require('fs');var BPromise=require(_0x6ec5('0x2'));var zipdir=require(_0x6ec5('0x3'));var rimraf=require(_0x6ec5('0x4'));var db=require(_0x6ec5('0x5'))['db'];var dbH=require(_0x6ec5('0x5'))[_0x6ec5('0x6')];var logger=require(_0x6ec5('0x7'))(_0x6ec5('0x8'));var EXTRACTED_REPORT_ID=Number(process[_0x6ec5('0x9')][0x2]);var QUERY=process[_0x6ec5('0x9')][0x3];var PATH=process[_0x6ec5('0x9')][0x4];function analyticExtractedReport(_0x35be4e,_0x1f59cd){var _0x3dd891={'status':_0x35be4e};var _0x225d2f={'where':{'id':EXTRACTED_REPORT_ID}};if(_0x1f59cd){_0x3dd891[_0x6ec5('0xa')]=_0x1f59cd;}return db[_0x6ec5('0xb')][_0x6ec5('0xc')](_0x3dd891,_0x225d2f);}function main(){var _0x4a23b6=0x1388;var _0x2e880d;logger[_0x6ec5('0xd')](util[_0x6ec5('0xe')](_0x6ec5('0xf'),EXTRACTED_REPORT_ID,_0x6ec5('0x10')));return db[_0x6ec5('0x11')][_0x6ec5('0x12')]({'where':{'id':0x1},'raw':!![],'attributes':['id','split',_0x6ec5('0x13')]})[_0x6ec5('0x14')](function(_0x2b1f61){if(_0x2b1f61){_0x2e880d=_0x2b1f61;_0x4a23b6=_0x2e880d[_0x6ec5('0x13')]||0x1388;}})[_0x6ec5('0x14')](function(){return dbH[_0x6ec5('0x15')][_0x6ec5('0x16')](util[_0x6ec5('0xe')]('SELECT\x20count(*)\x20as\x20num\x20FROM\x20(%s)\x20t',QUERY),{'type':dbH[_0x6ec5('0x15')]['QueryTypes'][_0x6ec5('0x17')]});})[_0x6ec5('0x14')](function(_0x4a4e3c){if(!_0x4a4e3c[0x0][_0x6ec5('0x18')]){return analyticExtractedReport(_0x6ec5('0x19'));}var _0x4d09fe=[];var _0x13b725=0x0;var _0x3df696=!![];if(_0x4a4e3c&&_0x4a4e3c[_0x6ec5('0x1a')]){var _0x211934=_0x4a4e3c[0x0][_0x6ec5('0x18')]%(_0x13b725+_0x4a23b6);if(_0x2e880d[_0x6ec5('0x1b')]){for(;_0x3df696;_0x13b725+=_0x4a23b6,_0x211934=_0x4a4e3c[0x0][_0x6ec5('0x18')]%(_0x13b725+_0x4a23b6)){if(_0x211934==0x0||_0x211934==_0x4a4e3c[0x0][_0x6ec5('0x18')]){_0x3df696=![];}_0x4d09fe[_0x6ec5('0x1c')](dbH[_0x6ec5('0x15')][_0x6ec5('0x16')](util[_0x6ec5('0xe')](_0x6ec5('0x1d'),QUERY,_0x4a23b6,_0x13b725),{'type':dbH[_0x6ec5('0x15')][_0x6ec5('0x1e')][_0x6ec5('0x17')]}));}}else{_0x4d09fe[_0x6ec5('0x1c')](dbH['sequelize'][_0x6ec5('0x16')](QUERY,{'type':dbH[_0x6ec5('0x15')][_0x6ec5('0x1e')][_0x6ec5('0x17')]}));}}var _0x3fc9d7=path[_0x6ec5('0x1f')](PATH);var _0x18243f=path['basename'](PATH,_0x6ec5('0x20'));var _0x2ecdcf=_0x2e880d[_0x6ec5('0x1b')]&&_0x4d09fe[_0x6ec5('0x1a')]>0x1;var _0x57060c=[];if(!fs[_0x6ec5('0x21')](path[_0x6ec5('0x22')](_0x3fc9d7,_0x18243f))&&_0x2ecdcf){fs['mkdirSync'](path[_0x6ec5('0x22')](_0x3fc9d7,_0x18243f));}return BPromise[_0x6ec5('0x23')](_0x4d09fe,function(_0xb4d269){_0x57060c['push'](_0xb4d269);})[_0x6ec5('0x14')](function(){for(var _0xd0e8d7=0x0;_0xd0e8d7<_0x57060c[_0x6ec5('0x1a')];_0xd0e8d7+=0x1){var _0x462488;var _0x425fac=_0x57060c[_0xd0e8d7];if(_0x2ecdcf){_0x462488=path['join'](_0x3fc9d7,_0x18243f,util[_0x6ec5('0xe')](_0x6ec5('0x24'),_0x18243f,_0xd0e8d7,'csv'));}else{_0x462488=path[_0x6ec5('0x22')](_0x3fc9d7,util[_0x6ec5('0xe')]('%s.%s',_0x18243f,_0x6ec5('0x25')));}fs[_0x6ec5('0x26')](_0x462488,csv(_0x425fac));}})[_0x6ec5('0x14')](function(){if(_0x2ecdcf){zipdir(path[_0x6ec5('0x22')](_0x3fc9d7,_0x18243f),{'saveTo':path[_0x6ec5('0x22')](_0x3fc9d7,util['format'](_0x6ec5('0x27'),_0x18243f,_0x6ec5('0x28')))},function(_0x24aff9,_0x174164){});rimraf(path[_0x6ec5('0x22')](_0x3fc9d7,_0x18243f),function(){});}})[_0x6ec5('0x14')](function(){logger[_0x6ec5('0xd')](util['format'](_0x6ec5('0x29'),EXTRACTED_REPORT_ID,'CSV'));return analyticExtractedReport(_0x6ec5('0x2a'),_0x2ecdcf?util['format'](_0x6ec5('0x27'),_0x18243f,_0x2ecdcf?_0x6ec5('0x28'):'csv'):null);});})['catch'](function(_0x3bfab4){logger[_0x6ec5('0xd')](util['format'](_0x6ec5('0x2b'),EXTRACTED_REPORT_ID,_0x6ec5('0x10')),util['inspect'](_0x3bfab4,{'showHidden':![],'depth':null}));return analyticExtractedReport(_0x6ec5('0x2c'));});}main(); \ No newline at end of file +var _0x750a=['%s\x20limit\x20%d\x20OFFSET\x20%d','push','dirname','basename','existsSync','join','mkdirSync','each','length','csv','writeFileSync','%s.%s','zip','Extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format\x20completed','Completed','catch','Error\x20during\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','inspect','Failed','path','bluebird','zip-dir','rimraf','../../mysqldb','dbH','../../config/logger','analytics','argv','savename','update','info','format','Setting','split','splitSizeCsv','then','query','SELECT\x20count(*)\x20as\x20num\x20FROM\x20(%s)\x20t','sequelize','QueryTypes','SELECT','num','Empty'];(function(_0x3ee99e,_0x4affec){var _0x1b56e1=function(_0x3857a2){while(--_0x3857a2){_0x3ee99e['push'](_0x3ee99e['shift']());}};_0x1b56e1(++_0x4affec);}(_0x750a,0x140));var _0xa750=function(_0xe7decc,_0x2a4014){_0xe7decc=_0xe7decc-0x0;var _0x3577e5=_0x750a[_0xe7decc];return _0x3577e5;};'use strict';var util=require('util');var path=require(_0xa750('0x0'));var _=require('lodash');var csv=require('to-csv');var fs=require('fs');var BPromise=require(_0xa750('0x1'));var zipdir=require(_0xa750('0x2'));var rimraf=require(_0xa750('0x3'));var db=require(_0xa750('0x4'))['db'];var dbH=require(_0xa750('0x4'))[_0xa750('0x5')];var logger=require(_0xa750('0x6'))(_0xa750('0x7'));var EXTRACTED_REPORT_ID=Number(process[_0xa750('0x8')][0x2]);var QUERY=process[_0xa750('0x8')][0x3];var PATH=process[_0xa750('0x8')][0x4];function analyticExtractedReport(_0x1ae455,_0x3d7c43){var _0x47a4dd={'status':_0x1ae455};var _0x53f2cb={'where':{'id':EXTRACTED_REPORT_ID}};if(_0x3d7c43){_0x47a4dd[_0xa750('0x9')]=_0x3d7c43;}return db['AnalyticExtractedReport'][_0xa750('0xa')](_0x47a4dd,_0x53f2cb);}function main(){var _0x1760f5=0x1388;var _0x51f594;logger[_0xa750('0xb')](util[_0xa750('0xc')]('Start\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format',EXTRACTED_REPORT_ID,'CSV'));return db[_0xa750('0xd')]['find']({'where':{'id':0x1},'raw':!![],'attributes':['id',_0xa750('0xe'),_0xa750('0xf')]})['then'](function(_0x24ec62){if(_0x24ec62){_0x51f594=_0x24ec62;_0x1760f5=_0x51f594[_0xa750('0xf')]||0x1388;}})[_0xa750('0x10')](function(){return dbH['sequelize'][_0xa750('0x11')](util[_0xa750('0xc')](_0xa750('0x12'),QUERY),{'type':dbH[_0xa750('0x13')][_0xa750('0x14')][_0xa750('0x15')]});})['then'](function(_0x3ae2a1){if(!_0x3ae2a1[0x0][_0xa750('0x16')]){return analyticExtractedReport(_0xa750('0x17'));}var _0x49fe3b=[];var _0x337095=0x0;var _0x29480c=!![];if(_0x3ae2a1&&_0x3ae2a1['length']){var _0x4afb05=_0x3ae2a1[0x0][_0xa750('0x16')]%(_0x337095+_0x1760f5);if(_0x51f594['split']){for(;_0x29480c;_0x337095+=_0x1760f5,_0x4afb05=_0x3ae2a1[0x0][_0xa750('0x16')]%(_0x337095+_0x1760f5)){if(_0x4afb05==0x0||_0x4afb05==_0x3ae2a1[0x0][_0xa750('0x16')]){_0x29480c=![];}_0x49fe3b['push'](dbH[_0xa750('0x13')]['query'](util['format'](_0xa750('0x18'),QUERY,_0x1760f5,_0x337095),{'type':dbH['sequelize'][_0xa750('0x14')]['SELECT']}));}}else{_0x49fe3b[_0xa750('0x19')](dbH['sequelize'][_0xa750('0x11')](QUERY,{'type':dbH['sequelize'][_0xa750('0x14')]['SELECT']}));}}var _0x52f166=path[_0xa750('0x1a')](PATH);var _0x52da84=path[_0xa750('0x1b')](PATH,'.csv');var _0x5c7203=_0x51f594['split']&&_0x49fe3b['length']>0x1;var _0x15d72f=[];if(!fs[_0xa750('0x1c')](path[_0xa750('0x1d')](_0x52f166,_0x52da84))&&_0x5c7203){fs[_0xa750('0x1e')](path[_0xa750('0x1d')](_0x52f166,_0x52da84));}return BPromise[_0xa750('0x1f')](_0x49fe3b,function(_0x3001bc){_0x15d72f[_0xa750('0x19')](_0x3001bc);})[_0xa750('0x10')](function(){for(var _0x94697a=0x0;_0x94697a<_0x15d72f[_0xa750('0x20')];_0x94697a+=0x1){var _0x27a5eb;var _0x31ea63=_0x15d72f[_0x94697a];if(_0x5c7203){_0x27a5eb=path[_0xa750('0x1d')](_0x52f166,_0x52da84,util[_0xa750('0xc')]('%s%d.%s',_0x52da84,_0x94697a,_0xa750('0x21')));}else{_0x27a5eb=path[_0xa750('0x1d')](_0x52f166,util[_0xa750('0xc')]('%s.%s',_0x52da84,_0xa750('0x21')));}fs[_0xa750('0x22')](_0x27a5eb,csv(_0x31ea63));}})[_0xa750('0x10')](function(){if(_0x5c7203){zipdir(path[_0xa750('0x1d')](_0x52f166,_0x52da84),{'saveTo':path['join'](_0x52f166,util[_0xa750('0xc')](_0xa750('0x23'),_0x52da84,_0xa750('0x24')))},function(_0x2aef3a,_0x2c5253){});rimraf(path['join'](_0x52f166,_0x52da84),function(){});}})[_0xa750('0x10')](function(){logger['info'](util[_0xa750('0xc')](_0xa750('0x25'),EXTRACTED_REPORT_ID,'CSV'));return analyticExtractedReport(_0xa750('0x26'),_0x5c7203?util[_0xa750('0xc')](_0xa750('0x23'),_0x52da84,_0x5c7203?_0xa750('0x24'):_0xa750('0x21')):null);});})[_0xa750('0x27')](function(_0x31066b){logger[_0xa750('0xb')](util['format'](_0xa750('0x28'),EXTRACTED_REPORT_ID,'CSV'),util[_0xa750('0x29')](_0x31066b,{'showHidden':![],'depth':null}));return analyticExtractedReport(_0xa750('0x2a'));});}main(); \ No newline at end of file diff --git a/server/components/export/pdf.js b/server/components/export/pdf.js index 571f864..635064e 100644 --- a/server/components/export/pdf.js +++ b/server/components/export/pdf.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xb10b=['query','format','%s\x20limit\x20%d\x20OFFSET\x20%d','QueryTypes','push','SELECT','existsSync','join','mkdirSync','each','name','startDate','endDate','landscape','black','body','content','/fonts/Roboto-Medium.ttf','/fonts/Roboto-Italic.ttf','/fonts/Roboto-MediumItalic.ttf','createPdfKitDocument','pdf','%s.%s','pipe','createWriteStream','finish','log','err','end','zip','info','Completed','PDF','findOne','SELECT\x20count(*)\x20as\x20num\x20FROM\x20(%s)\x20t','catch','Error\x20during\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','Failed','lodash','util','path','moment','zip-dir','rimraf','../../mysqldb','dbH','../../config/logger','argv','MMMM\x20Do\x20YYYY,\x20h:mm:ss\x20a','savename','AnalyticExtractedReport','hasOwnProperty','tableHeader','num','Empty','dirname','basename','.pdf','Setting','find','split','then','splitSizePdf','length','sequelize'];(function(_0x4eb6f5,_0x8046db){var _0x2f65f8=function(_0x569096){while(--_0x569096){_0x4eb6f5['push'](_0x4eb6f5['shift']());}};_0x2f65f8(++_0x8046db);}(_0xb10b,0x12a));var _0xbb10=function(_0x379eaf,_0x4eb489){_0x379eaf=_0x379eaf-0x0;var _0x326f1f=_0xb10b[_0x379eaf];return _0x326f1f;};'use strict';var _=require(_0xbb10('0x0'));var fs=require('fs');var BPromise=require('bluebird');var util=require(_0xbb10('0x1'));var path=require(_0xbb10('0x2'));var moment=require(_0xbb10('0x3'));var PdfPrinter=require('pdfmake/src/printer');var zipdir=require(_0xbb10('0x4'));var rimraf=require(_0xbb10('0x5'));var db=require(_0xbb10('0x6'))['db'];var dbH=require(_0xbb10('0x6'))[_0xbb10('0x7')];var logger=require(_0xbb10('0x8'))('analytics');var EXTRACTED_REPORT_ID=Number(process[_0xbb10('0x9')][0x2]);var QUERY=process[_0xbb10('0x9')][0x3];var PATH=process['argv'][0x4];var NAME=process[_0xbb10('0x9')][0x5];var FORMAT=_0xbb10('0xa');var _extractedReport;function analyticExtractedReport(_0x21370f,_0x1c3ee5){var _0x2353ef={'status':_0x21370f};var _0x1ce33e={'where':{'id':EXTRACTED_REPORT_ID}};if(_0x1c3ee5){_0x2353ef[_0xbb10('0xb')]=_0x1c3ee5;}return db[_0xbb10('0xc')]['update'](_0x2353ef,_0x1ce33e);}function getHeader(_0x4e47f8){var _0x20bd61=[];for(var _0x118a74 in _0x4e47f8){if(_0x4e47f8[_0xbb10('0xd')](_0x118a74)){_0x20bd61['push']({'text':_0x118a74,'style':_0xbb10('0xe')});}}return _0x20bd61;}function extractReport(_0x5be7e0){var _0x44fb19=0x1388;var _0x916a32;if(!_0x5be7e0[0x0][_0xbb10('0xf')]){return analyticExtractedReport(_0xbb10('0x10'));}var _0x442548=[];var _0x147230=0x0;var _0x58a612=!![];var _0x26e021=path[_0xbb10('0x11')](PATH);var _0x45b9d6=path[_0xbb10('0x12')](PATH,_0xbb10('0x13'));var _0x2f2ebf=![];var _0x24a57b=[];return db[_0xbb10('0x14')][_0xbb10('0x15')]({'where':{'id':0x1},'raw':!![],'attributes':['id',_0xbb10('0x16'),'splitSizePdf']})[_0xbb10('0x17')](function(_0x1145f1){if(_0x1145f1){_0x916a32=_0x1145f1;_0x44fb19=_0x916a32[_0xbb10('0x18')]||0x3e8;}})[_0xbb10('0x17')](function(){if(_0x5be7e0&&_0x5be7e0[_0xbb10('0x19')]){var _0x1682a4=_0x5be7e0[0x0][_0xbb10('0xf')]%(_0x147230+_0x44fb19);if(_0x916a32[_0xbb10('0x16')]){for(;_0x58a612;_0x147230+=_0x44fb19,_0x1682a4=_0x5be7e0[0x0][_0xbb10('0xf')]%(_0x147230+_0x44fb19)){if(_0x1682a4==0x0||_0x1682a4==_0x5be7e0[0x0][_0xbb10('0xf')]){_0x58a612=![];}_0x442548['push'](dbH[_0xbb10('0x1a')][_0xbb10('0x1b')](util[_0xbb10('0x1c')](_0xbb10('0x1d'),QUERY,_0x44fb19,_0x147230),{'type':dbH[_0xbb10('0x1a')][_0xbb10('0x1e')]['SELECT']}));}}else{_0x442548[_0xbb10('0x1f')](dbH[_0xbb10('0x1a')]['query'](QUERY,{'type':dbH['sequelize'][_0xbb10('0x1e')][_0xbb10('0x20')]}));}}_0x2f2ebf=_0x916a32[_0xbb10('0x16')]&&_0x442548[_0xbb10('0x19')]>0x1;if(!fs[_0xbb10('0x21')](path[_0xbb10('0x22')](_0x26e021,_0x45b9d6))&&_0x2f2ebf){fs[_0xbb10('0x23')](path[_0xbb10('0x22')](_0x26e021,_0x45b9d6));}return BPromise[_0xbb10('0x24')](_0x442548,function(_0x395404){_0x24a57b[_0xbb10('0x1f')](_0x395404);});})[_0xbb10('0x17')](function(){return BPromise['each'](_0x442548,function(_0x4fedac,_0x4fb5e0){var _0xc93a04;var _0x3c5ae7=util[_0xbb10('0x1c')]('Name:\x20%s\x0aReport:\x20%s\x0aFrom:\x20%s\x20To:\x20%s',NAME,_extractedReport[_0xbb10('0x25')],moment(_extractedReport[_0xbb10('0x26')])[_0xbb10('0x1c')](FORMAT),moment(_extractedReport[_0xbb10('0x27')])[_0xbb10('0x1c')](FORMAT));var _0x20d946={'pageSize':'A4','pageOrientation':_0xbb10('0x28'),'content':[{'text':_0x3c5ae7,'style':'header'}],'styles':{'header':{'fontSize':0x12,'bold':!![],'margin':[0x0,0x0,0x0,0xa]},'tableHeader':{'bold':!![],'fontSize':0xd,'color':_0xbb10('0x29')}}};var _0x21ac54={'headerRows':0x1,'body':[]};_0x21ac54[_0xbb10('0x2a')][_0xbb10('0x1f')](getHeader(_0x4fedac[0x0]));var _0x1d30aa;for(var _0x2ff4c1=0x0;_0x2ff4c1<_0x4fedac['length'];_0x2ff4c1+=0x1){_0x1d30aa=[];for(var _0x221624 in _0x4fedac[_0x2ff4c1]){if(_0x4fedac[_0x2ff4c1]['hasOwnProperty'](_0x221624)){_0x1d30aa[_0xbb10('0x1f')](_0x4fedac[_0x2ff4c1][_0x221624]?_['toString'](_0x4fedac[_0x2ff4c1][_0x221624]):'');}}_0x21ac54[_0xbb10('0x2a')][_0xbb10('0x1f')](_0x1d30aa);}_0x20d946[_0xbb10('0x2b')]['push']({'table':_0x21ac54});return new BPromise(function(_0x518d47,_0x4c3744){var _0x34f65e=new PdfPrinter({'Roboto':{'normal':__dirname+'/fonts/Roboto-Regular.ttf','bold':__dirname+_0xbb10('0x2c'),'italics':__dirname+_0xbb10('0x2d'),'bolditalics':__dirname+_0xbb10('0x2e')}});var _0x1c0b57=_0x34f65e[_0xbb10('0x2f')](_0x20d946);if(_0x2f2ebf){_0xc93a04=path[_0xbb10('0x22')](_0x26e021,_0x45b9d6,util[_0xbb10('0x1c')]('%s%d.%s',_0x45b9d6,_0x4fb5e0,_0xbb10('0x30')));}else{_0xc93a04=path[_0xbb10('0x22')](_0x26e021,util[_0xbb10('0x1c')](_0xbb10('0x31'),_0x45b9d6,_0xbb10('0x30')));}var _0x9de708=_0x1c0b57[_0xbb10('0x32')](fs[_0xbb10('0x33')](_0xc93a04));_0x9de708['on'](_0xbb10('0x34'),function(){_0x518d47();});_0x9de708['on']('error',function(_0x2b5352){console[_0xbb10('0x35')](_0xbb10('0x36'),_0x2b5352);_0x4c3744(_0x2b5352);});_0x1c0b57[_0xbb10('0x37')]();});});})['then'](function(){if(_0x2f2ebf){return new BPromise(function(_0x111762,_0x5de37b){zipdir(path['join'](_0x26e021,_0x45b9d6),{'saveTo':path[_0xbb10('0x22')](_0x26e021,util[_0xbb10('0x1c')](_0xbb10('0x31'),_0x45b9d6,_0xbb10('0x38')))},function(_0x15d895){if(_0x15d895){_0x5de37b(_0x15d895);}else{_0x111762();}});});}})[_0xbb10('0x17')](function(){if(_0x2f2ebf){rimraf(path['join'](_0x26e021,_0x45b9d6),function(){});}})[_0xbb10('0x17')](function(){logger[_0xbb10('0x39')](util['format']('Extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format\x20completed',EXTRACTED_REPORT_ID,'CSV'));return analyticExtractedReport(_0xbb10('0x3a'),_0x2f2ebf?util[_0xbb10('0x1c')](_0xbb10('0x31'),_0x45b9d6,_0x2f2ebf?'zip':_0xbb10('0x30')):null);});}function main(){logger[_0xbb10('0x39')](util[_0xbb10('0x1c')]('Start\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format',EXTRACTED_REPORT_ID,_0xbb10('0x3b')));return db[_0xbb10('0xc')][_0xbb10('0x3c')]({'where':{'id':EXTRACTED_REPORT_ID}})[_0xbb10('0x17')](function(_0x4f1cdd){_extractedReport=_0x4f1cdd;return dbH[_0xbb10('0x1a')][_0xbb10('0x1b')](util['format'](_0xbb10('0x3d'),QUERY),{'type':dbH[_0xbb10('0x1a')][_0xbb10('0x1e')][_0xbb10('0x20')]});})[_0xbb10('0x17')](extractReport)[_0xbb10('0x3e')](function(_0x5f3d67){logger[_0xbb10('0x39')](util[_0xbb10('0x1c')](_0xbb10('0x3f'),EXTRACTED_REPORT_ID,_0xbb10('0x3b')),util['inspect'](_0x5f3d67,{'showHidden':![],'depth':null}));return analyticExtractedReport(_0xbb10('0x40'));});}main(); \ No newline at end of file +var _0xd8b0=['format','%s\x20limit\x20%d\x20OFFSET\x20%d','QueryTypes','SELECT','existsSync','join','mkdirSync','each','Name:\x20%s\x0aReport:\x20%s\x0aFrom:\x20%s\x20To:\x20%s','name','endDate','landscape','black','body','toString','/fonts/Roboto-Medium.ttf','/fonts/Roboto-Italic.ttf','/fonts/Roboto-MediumItalic.ttf','createPdfKitDocument','%s%d.%s','pdf','pipe','finish','error','log','err','%s.%s','zip','Extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format\x20completed','CSV','Completed','info','Start\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','PDF','findOne','catch','Error\x20during\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','inspect','Failed','lodash','bluebird','pdfmake/src/printer','zip-dir','rimraf','../../mysqldb','analytics','argv','MMMM\x20Do\x20YYYY,\x20h:mm:ss\x20a','savename','AnalyticExtractedReport','update','hasOwnProperty','tableHeader','num','Empty','dirname','basename','.pdf','Setting','find','split','splitSizePdf','then','length','push','sequelize','query'];(function(_0x4d0110,_0x3f24e1){var _0x47d283=function(_0x49435c){while(--_0x49435c){_0x4d0110['push'](_0x4d0110['shift']());}};_0x47d283(++_0x3f24e1);}(_0xd8b0,0xad));var _0x0d8b=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0xd8b0[_0xa464c9];return _0x3d73c4;};'use strict';var _=require(_0x0d8b('0x0'));var fs=require('fs');var BPromise=require(_0x0d8b('0x1'));var util=require('util');var path=require('path');var moment=require('moment');var PdfPrinter=require(_0x0d8b('0x2'));var zipdir=require(_0x0d8b('0x3'));var rimraf=require(_0x0d8b('0x4'));var db=require(_0x0d8b('0x5'))['db'];var dbH=require(_0x0d8b('0x5'))['dbH'];var logger=require('../../config/logger')(_0x0d8b('0x6'));var EXTRACTED_REPORT_ID=Number(process[_0x0d8b('0x7')][0x2]);var QUERY=process[_0x0d8b('0x7')][0x3];var PATH=process['argv'][0x4];var NAME=process[_0x0d8b('0x7')][0x5];var FORMAT=_0x0d8b('0x8');var _extractedReport;function analyticExtractedReport(_0x58e4e2,_0x129310){var _0x348e65={'status':_0x58e4e2};var _0x3b027f={'where':{'id':EXTRACTED_REPORT_ID}};if(_0x129310){_0x348e65[_0x0d8b('0x9')]=_0x129310;}return db[_0x0d8b('0xa')][_0x0d8b('0xb')](_0x348e65,_0x3b027f);}function getHeader(_0x2c5e9e){var _0x28f87c=[];for(var _0x48fa16 in _0x2c5e9e){if(_0x2c5e9e[_0x0d8b('0xc')](_0x48fa16)){_0x28f87c['push']({'text':_0x48fa16,'style':_0x0d8b('0xd')});}}return _0x28f87c;}function extractReport(_0xc574a3){var _0x340cc4=0x1388;var _0x92cdd8;if(!_0xc574a3[0x0][_0x0d8b('0xe')]){return analyticExtractedReport(_0x0d8b('0xf'));}var _0x15dd0f=[];var _0x31a8cc=0x0;var _0x1d4bbc=!![];var _0x2ce75e=path[_0x0d8b('0x10')](PATH);var _0xe65334=path[_0x0d8b('0x11')](PATH,_0x0d8b('0x12'));var _0x4f6f21=![];var _0x23eb7b=[];return db[_0x0d8b('0x13')][_0x0d8b('0x14')]({'where':{'id':0x1},'raw':!![],'attributes':['id',_0x0d8b('0x15'),_0x0d8b('0x16')]})['then'](function(_0x106a01){if(_0x106a01){_0x92cdd8=_0x106a01;_0x340cc4=_0x92cdd8[_0x0d8b('0x16')]||0x3e8;}})[_0x0d8b('0x17')](function(){if(_0xc574a3&&_0xc574a3[_0x0d8b('0x18')]){var _0x333674=_0xc574a3[0x0][_0x0d8b('0xe')]%(_0x31a8cc+_0x340cc4);if(_0x92cdd8[_0x0d8b('0x15')]){for(;_0x1d4bbc;_0x31a8cc+=_0x340cc4,_0x333674=_0xc574a3[0x0][_0x0d8b('0xe')]%(_0x31a8cc+_0x340cc4)){if(_0x333674==0x0||_0x333674==_0xc574a3[0x0]['num']){_0x1d4bbc=![];}_0x15dd0f[_0x0d8b('0x19')](dbH[_0x0d8b('0x1a')][_0x0d8b('0x1b')](util[_0x0d8b('0x1c')](_0x0d8b('0x1d'),QUERY,_0x340cc4,_0x31a8cc),{'type':dbH[_0x0d8b('0x1a')][_0x0d8b('0x1e')][_0x0d8b('0x1f')]}));}}else{_0x15dd0f['push'](dbH['sequelize'][_0x0d8b('0x1b')](QUERY,{'type':dbH['sequelize']['QueryTypes']['SELECT']}));}}_0x4f6f21=_0x92cdd8[_0x0d8b('0x15')]&&_0x15dd0f[_0x0d8b('0x18')]>0x1;if(!fs[_0x0d8b('0x20')](path[_0x0d8b('0x21')](_0x2ce75e,_0xe65334))&&_0x4f6f21){fs[_0x0d8b('0x22')](path[_0x0d8b('0x21')](_0x2ce75e,_0xe65334));}return BPromise[_0x0d8b('0x23')](_0x15dd0f,function(_0x4562cb){_0x23eb7b[_0x0d8b('0x19')](_0x4562cb);});})['then'](function(){return BPromise[_0x0d8b('0x23')](_0x15dd0f,function(_0x4463ee,_0x5363e3){var _0xe1ef20;var _0x4a0ae4=util[_0x0d8b('0x1c')](_0x0d8b('0x24'),NAME,_extractedReport[_0x0d8b('0x25')],moment(_extractedReport['startDate'])['format'](FORMAT),moment(_extractedReport[_0x0d8b('0x26')])[_0x0d8b('0x1c')](FORMAT));var _0x4c05ee={'pageSize':'A4','pageOrientation':_0x0d8b('0x27'),'content':[{'text':_0x4a0ae4,'style':'header'}],'styles':{'header':{'fontSize':0x12,'bold':!![],'margin':[0x0,0x0,0x0,0xa]},'tableHeader':{'bold':!![],'fontSize':0xd,'color':_0x0d8b('0x28')}}};var _0x4b59e5={'headerRows':0x1,'body':[]};_0x4b59e5[_0x0d8b('0x29')]['push'](getHeader(_0x4463ee[0x0]));var _0x2ab00d;for(var _0x546bf6=0x0;_0x546bf6<_0x4463ee[_0x0d8b('0x18')];_0x546bf6+=0x1){_0x2ab00d=[];for(var _0x544735 in _0x4463ee[_0x546bf6]){if(_0x4463ee[_0x546bf6][_0x0d8b('0xc')](_0x544735)){_0x2ab00d[_0x0d8b('0x19')](_0x4463ee[_0x546bf6][_0x544735]?_[_0x0d8b('0x2a')](_0x4463ee[_0x546bf6][_0x544735]):'');}}_0x4b59e5['body']['push'](_0x2ab00d);}_0x4c05ee['content'][_0x0d8b('0x19')]({'table':_0x4b59e5});return new BPromise(function(_0x5515d2,_0x3cdf3c){var _0x54f6f3=new PdfPrinter({'Roboto':{'normal':__dirname+'/fonts/Roboto-Regular.ttf','bold':__dirname+_0x0d8b('0x2b'),'italics':__dirname+_0x0d8b('0x2c'),'bolditalics':__dirname+_0x0d8b('0x2d')}});var _0xdeee5d=_0x54f6f3[_0x0d8b('0x2e')](_0x4c05ee);if(_0x4f6f21){_0xe1ef20=path[_0x0d8b('0x21')](_0x2ce75e,_0xe65334,util[_0x0d8b('0x1c')](_0x0d8b('0x2f'),_0xe65334,_0x5363e3,'pdf'));}else{_0xe1ef20=path[_0x0d8b('0x21')](_0x2ce75e,util[_0x0d8b('0x1c')]('%s.%s',_0xe65334,_0x0d8b('0x30')));}var _0x23f7f6=_0xdeee5d[_0x0d8b('0x31')](fs['createWriteStream'](_0xe1ef20));_0x23f7f6['on'](_0x0d8b('0x32'),function(){_0x5515d2();});_0x23f7f6['on'](_0x0d8b('0x33'),function(_0x206157){console[_0x0d8b('0x34')](_0x0d8b('0x35'),_0x206157);_0x3cdf3c(_0x206157);});_0xdeee5d['end']();});});})[_0x0d8b('0x17')](function(){if(_0x4f6f21){return new BPromise(function(_0x1649fc,_0x5ad0fe){zipdir(path[_0x0d8b('0x21')](_0x2ce75e,_0xe65334),{'saveTo':path[_0x0d8b('0x21')](_0x2ce75e,util[_0x0d8b('0x1c')](_0x0d8b('0x36'),_0xe65334,_0x0d8b('0x37')))},function(_0x519088){if(_0x519088){_0x5ad0fe(_0x519088);}else{_0x1649fc();}});});}})['then'](function(){if(_0x4f6f21){rimraf(path[_0x0d8b('0x21')](_0x2ce75e,_0xe65334),function(){});}})['then'](function(){logger['info'](util[_0x0d8b('0x1c')](_0x0d8b('0x38'),EXTRACTED_REPORT_ID,_0x0d8b('0x39')));return analyticExtractedReport(_0x0d8b('0x3a'),_0x4f6f21?util[_0x0d8b('0x1c')](_0x0d8b('0x36'),_0xe65334,_0x4f6f21?'zip':_0x0d8b('0x30')):null);});}function main(){logger[_0x0d8b('0x3b')](util[_0x0d8b('0x1c')](_0x0d8b('0x3c'),EXTRACTED_REPORT_ID,_0x0d8b('0x3d')));return db[_0x0d8b('0xa')][_0x0d8b('0x3e')]({'where':{'id':EXTRACTED_REPORT_ID}})['then'](function(_0x1d06b6){_extractedReport=_0x1d06b6;return dbH[_0x0d8b('0x1a')][_0x0d8b('0x1b')](util[_0x0d8b('0x1c')]('SELECT\x20count(*)\x20as\x20num\x20FROM\x20(%s)\x20t',QUERY),{'type':dbH[_0x0d8b('0x1a')]['QueryTypes'][_0x0d8b('0x1f')]});})[_0x0d8b('0x17')](extractReport)[_0x0d8b('0x3f')](function(_0x26ac10){logger[_0x0d8b('0x3b')](util[_0x0d8b('0x1c')](_0x0d8b('0x40'),EXTRACTED_REPORT_ID,_0x0d8b('0x3d')),util[_0x0d8b('0x41')](_0x26ac10,{'showHidden':![],'depth':null}));return analyticExtractedReport(_0x0d8b('0x42'));});}main(); \ No newline at end of file diff --git a/server/components/export/xlsx.js b/server/components/export/xlsx.js index 3c5bb61..e24d96f 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 _0xe65b=['length','num','push','dirname','basename','.xlsx','existsSync','join','mkdirSync','each','xlsx','%s.%s','writeFileSync','binary','zip','Completed','catch','Error\x20during\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','Failed','util','path','lodash','json2xls','bluebird','zip-dir','rimraf','../../mysqldb','dbH','analytics','argv','AnalyticExtractedReport','update','info','format','Start\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','XLSX','Setting','find','split','splitSizeXlsx','then','sequelize','query','SELECT\x20count(*)\x20as\x20num\x20FROM\x20(%s)\x20t','QueryTypes','SELECT'];(function(_0x8a30cf,_0x40f19b){var _0x20f439=function(_0x157a5d){while(--_0x157a5d){_0x8a30cf['push'](_0x8a30cf['shift']());}};_0x20f439(++_0x40f19b);}(_0xe65b,0xf9));var _0xbe65=function(_0x178e48,_0x3c9509){_0x178e48=_0x178e48-0x0;var _0x440d7e=_0xe65b[_0x178e48];return _0x440d7e;};'use strict';var util=require(_0xbe65('0x0'));var path=require(_0xbe65('0x1'));var _=require(_0xbe65('0x2'));var fs=require('fs');var json2xls=require(_0xbe65('0x3'));var BPromise=require(_0xbe65('0x4'));var zipdir=require(_0xbe65('0x5'));var rimraf=require(_0xbe65('0x6'));var db=require(_0xbe65('0x7'))['db'];var dbH=require(_0xbe65('0x7'))[_0xbe65('0x8')];var logger=require('../../config/logger')(_0xbe65('0x9'));var EXTRACTED_REPORT_ID=Number(process[_0xbe65('0xa')][0x2]);var QUERY=process[_0xbe65('0xa')][0x3];var PATH=process['argv'][0x4];function analyticExtractedReport(_0x2959e4,_0x4f62e7){var _0x2a1f1a={'status':_0x2959e4};var _0x9d4133={'where':{'id':EXTRACTED_REPORT_ID}};if(_0x4f62e7){_0x2a1f1a['savename']=_0x4f62e7;}return db[_0xbe65('0xb')][_0xbe65('0xc')](_0x2a1f1a,_0x9d4133);}function main(){var _0x5d2f15=0x1388;var _0x277e46;logger[_0xbe65('0xd')](util[_0xbe65('0xe')](_0xbe65('0xf'),EXTRACTED_REPORT_ID,_0xbe65('0x10')));return db[_0xbe65('0x11')][_0xbe65('0x12')]({'where':{'id':0x1},'raw':!![],'attributes':['id',_0xbe65('0x13'),_0xbe65('0x14')]})['then'](function(_0x45ee92){if(_0x45ee92){_0x277e46=_0x45ee92;_0x5d2f15=_0x277e46[_0xbe65('0x14')]||0x1388;}})[_0xbe65('0x15')](function(){return dbH[_0xbe65('0x16')][_0xbe65('0x17')](util[_0xbe65('0xe')](_0xbe65('0x18'),QUERY),{'type':dbH[_0xbe65('0x16')][_0xbe65('0x19')][_0xbe65('0x1a')]});})[_0xbe65('0x15')](function(_0x3c936d){if(!_0x3c936d[0x0]['num']){return analyticExtractedReport('Empty');}var _0x20a7b9=[];var _0xf0cfcb=0x0;var _0x2108ac=!![];if(_0x277e46['split']){if(_0x3c936d&&_0x3c936d[_0xbe65('0x1b')]){var _0x3eee78=_0x3c936d[0x0][_0xbe65('0x1c')]%(_0xf0cfcb+_0x5d2f15);for(;_0x2108ac;_0xf0cfcb+=_0x5d2f15,_0x3eee78=_0x3c936d[0x0][_0xbe65('0x1c')]%(_0xf0cfcb+_0x5d2f15)){if(_0x3eee78==0x0||_0x3eee78==_0x3c936d[0x0][_0xbe65('0x1c')]){_0x2108ac=![];}_0x20a7b9[_0xbe65('0x1d')](dbH['sequelize'][_0xbe65('0x17')](util[_0xbe65('0xe')]('%s\x20limit\x20%d\x20OFFSET\x20%d',QUERY,_0x5d2f15,_0xf0cfcb),{'type':dbH[_0xbe65('0x16')][_0xbe65('0x19')][_0xbe65('0x1a')]}));}}}else{_0x20a7b9['push'](dbH[_0xbe65('0x16')][_0xbe65('0x17')](QUERY,{'type':dbH[_0xbe65('0x16')][_0xbe65('0x19')][_0xbe65('0x1a')]}));}var _0x57918a=path[_0xbe65('0x1e')](PATH);var _0x5c652f=path[_0xbe65('0x1f')](PATH,_0xbe65('0x20'));var _0x43b28a=_0x277e46[_0xbe65('0x13')]&&_0x20a7b9['length']>0x1;var _0x34c4ff=[];if(!fs[_0xbe65('0x21')](path[_0xbe65('0x22')](_0x57918a,_0x5c652f))&&_0x43b28a){fs[_0xbe65('0x23')](path[_0xbe65('0x22')](_0x57918a,_0x5c652f));}return BPromise[_0xbe65('0x24')](_0x20a7b9,function(_0x4a0773){_0x34c4ff[_0xbe65('0x1d')](_0x4a0773);})[_0xbe65('0x15')](function(){for(var _0x5c57b8=0x0;_0x5c57b8<_0x34c4ff['length'];_0x5c57b8+=0x1){var _0xbcaf84;var _0x12f233=_0x34c4ff[_0x5c57b8];if(_0x43b28a){_0xbcaf84=path[_0xbe65('0x22')](_0x57918a,_0x5c652f,util[_0xbe65('0xe')]('%s%d.%s',_0x5c652f,_0x5c57b8,_0xbe65('0x25')));}else{_0xbcaf84=path[_0xbe65('0x22')](_0x57918a,util[_0xbe65('0xe')](_0xbe65('0x26'),_0x5c652f,'xlsx'));}fs[_0xbe65('0x27')](_0xbcaf84,json2xls(_0x12f233),_0xbe65('0x28'));}})[_0xbe65('0x15')](function(){if(_0x43b28a){zipdir(path[_0xbe65('0x22')](_0x57918a,_0x5c652f),{'saveTo':path[_0xbe65('0x22')](_0x57918a,util[_0xbe65('0xe')](_0xbe65('0x26'),_0x5c652f,_0xbe65('0x29')))},function(_0x12ccba,_0x5926d7){});rimraf(path['join'](_0x57918a,_0x5c652f),function(){});}})['then'](function(){logger[_0xbe65('0xd')](util[_0xbe65('0xe')]('Extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format\x20completed',EXTRACTED_REPORT_ID,_0xbe65('0x10')));return analyticExtractedReport(_0xbe65('0x2a'),_0x43b28a?util[_0xbe65('0xe')](_0xbe65('0x26'),_0x5c652f,_0x43b28a?'zip':_0xbe65('0x25')):null);});})[_0xbe65('0x2b')](function(_0x3b7730){logger[_0xbe65('0xd')](util[_0xbe65('0xe')](_0xbe65('0x2c'),EXTRACTED_REPORT_ID,_0xbe65('0x10')),util['inspect'](_0x3b7730,{'showHidden':![],'depth':null}));return analyticExtractedReport(_0xbe65('0x2d'));});}main(); \ No newline at end of file +var _0x691d=['join','%s%d.%s','xlsx','writeFileSync','binary','zip','Extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format\x20completed','Completed','%s.%s','info','Error\x20during\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','inspect','Failed','util','path','lodash','json2xls','bluebird','zip-dir','rimraf','../../mysqldb','analytics','argv','savename','update','format','Start\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','XLSX','Setting','split','splitSizeXlsx','then','sequelize','QueryTypes','SELECT','num','length','query','%s\x20limit\x20%d\x20OFFSET\x20%d','push','dirname','.xlsx'];(function(_0x26e15e,_0x513e3e){var _0x54bdc7=function(_0x3c164c){while(--_0x3c164c){_0x26e15e['push'](_0x26e15e['shift']());}};_0x54bdc7(++_0x513e3e);}(_0x691d,0xb5));var _0xd691=function(_0x5e5c29,_0x2ac56d){_0x5e5c29=_0x5e5c29-0x0;var _0x281d80=_0x691d[_0x5e5c29];return _0x281d80;};'use strict';var util=require(_0xd691('0x0'));var path=require(_0xd691('0x1'));var _=require(_0xd691('0x2'));var fs=require('fs');var json2xls=require(_0xd691('0x3'));var BPromise=require(_0xd691('0x4'));var zipdir=require(_0xd691('0x5'));var rimraf=require(_0xd691('0x6'));var db=require(_0xd691('0x7'))['db'];var dbH=require(_0xd691('0x7'))['dbH'];var logger=require('../../config/logger')(_0xd691('0x8'));var EXTRACTED_REPORT_ID=Number(process[_0xd691('0x9')][0x2]);var QUERY=process['argv'][0x3];var PATH=process['argv'][0x4];function analyticExtractedReport(_0x9b0444,_0x5c7bed){var _0x1fe078={'status':_0x9b0444};var _0x46c2ef={'where':{'id':EXTRACTED_REPORT_ID}};if(_0x5c7bed){_0x1fe078[_0xd691('0xa')]=_0x5c7bed;}return db['AnalyticExtractedReport'][_0xd691('0xb')](_0x1fe078,_0x46c2ef);}function main(){var _0x60fa90=0x1388;var _0x1e79b3;logger['info'](util[_0xd691('0xc')](_0xd691('0xd'),EXTRACTED_REPORT_ID,_0xd691('0xe')));return db[_0xd691('0xf')]['find']({'where':{'id':0x1},'raw':!![],'attributes':['id',_0xd691('0x10'),_0xd691('0x11')]})[_0xd691('0x12')](function(_0xaf9322){if(_0xaf9322){_0x1e79b3=_0xaf9322;_0x60fa90=_0x1e79b3['splitSizeXlsx']||0x1388;}})['then'](function(){return dbH['sequelize']['query'](util[_0xd691('0xc')]('SELECT\x20count(*)\x20as\x20num\x20FROM\x20(%s)\x20t',QUERY),{'type':dbH[_0xd691('0x13')][_0xd691('0x14')][_0xd691('0x15')]});})[_0xd691('0x12')](function(_0x5b1052){if(!_0x5b1052[0x0][_0xd691('0x16')]){return analyticExtractedReport('Empty');}var _0x178951=[];var _0x44d3e6=0x0;var _0x55e089=!![];if(_0x1e79b3[_0xd691('0x10')]){if(_0x5b1052&&_0x5b1052[_0xd691('0x17')]){var _0x2399df=_0x5b1052[0x0][_0xd691('0x16')]%(_0x44d3e6+_0x60fa90);for(;_0x55e089;_0x44d3e6+=_0x60fa90,_0x2399df=_0x5b1052[0x0][_0xd691('0x16')]%(_0x44d3e6+_0x60fa90)){if(_0x2399df==0x0||_0x2399df==_0x5b1052[0x0][_0xd691('0x16')]){_0x55e089=![];}_0x178951['push'](dbH[_0xd691('0x13')][_0xd691('0x18')](util[_0xd691('0xc')](_0xd691('0x19'),QUERY,_0x60fa90,_0x44d3e6),{'type':dbH[_0xd691('0x13')][_0xd691('0x14')]['SELECT']}));}}}else{_0x178951[_0xd691('0x1a')](dbH[_0xd691('0x13')][_0xd691('0x18')](QUERY,{'type':dbH[_0xd691('0x13')][_0xd691('0x14')][_0xd691('0x15')]}));}var _0x927a62=path[_0xd691('0x1b')](PATH);var _0x5e05ea=path['basename'](PATH,_0xd691('0x1c'));var _0x2cab93=_0x1e79b3['split']&&_0x178951['length']>0x1;var _0x3d46c2=[];if(!fs['existsSync'](path[_0xd691('0x1d')](_0x927a62,_0x5e05ea))&&_0x2cab93){fs['mkdirSync'](path[_0xd691('0x1d')](_0x927a62,_0x5e05ea));}return BPromise['each'](_0x178951,function(_0x5ec1a2){_0x3d46c2[_0xd691('0x1a')](_0x5ec1a2);})[_0xd691('0x12')](function(){for(var _0xf2f7b5=0x0;_0xf2f7b5<_0x3d46c2[_0xd691('0x17')];_0xf2f7b5+=0x1){var _0x197694;var _0x50664f=_0x3d46c2[_0xf2f7b5];if(_0x2cab93){_0x197694=path[_0xd691('0x1d')](_0x927a62,_0x5e05ea,util[_0xd691('0xc')](_0xd691('0x1e'),_0x5e05ea,_0xf2f7b5,_0xd691('0x1f')));}else{_0x197694=path[_0xd691('0x1d')](_0x927a62,util[_0xd691('0xc')]('%s.%s',_0x5e05ea,_0xd691('0x1f')));}fs[_0xd691('0x20')](_0x197694,json2xls(_0x50664f),_0xd691('0x21'));}})[_0xd691('0x12')](function(){if(_0x2cab93){zipdir(path[_0xd691('0x1d')](_0x927a62,_0x5e05ea),{'saveTo':path['join'](_0x927a62,util[_0xd691('0xc')]('%s.%s',_0x5e05ea,_0xd691('0x22')))},function(_0x12d084,_0x54413d){});rimraf(path[_0xd691('0x1d')](_0x927a62,_0x5e05ea),function(){});}})['then'](function(){logger['info'](util[_0xd691('0xc')](_0xd691('0x23'),EXTRACTED_REPORT_ID,_0xd691('0xe')));return analyticExtractedReport(_0xd691('0x24'),_0x2cab93?util[_0xd691('0xc')](_0xd691('0x25'),_0x5e05ea,_0x2cab93?_0xd691('0x22'):_0xd691('0x1f')):null);});})['catch'](function(_0x1084c7){logger[_0xd691('0x26')](util[_0xd691('0xc')](_0xd691('0x27'),EXTRACTED_REPORT_ID,_0xd691('0xe')),util[_0xd691('0x28')](_0x1084c7,{'showHidden':![],'depth':null}));return analyticExtractedReport(_0xd691('0x29'));});}main(); \ No newline at end of file diff --git a/server/components/extensions/rewrite.js b/server/components/extensions/rewrite.js index d556ae0..528342b 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 _0x5cd8=['XCALLY-MOTION-PROGRESS=1','splice','GotoIfTime',',${EXTEN},','last','concat','transaction','destroy','sortBy','catch','error','lodash','models','findAll','intervals','VoiceExtension','then','uniq','map','exten','CAST(priority\x20AS\x20UNSIGNED)','filter','groupBy','queue','playback','hasOwnProperty','priority','extensions','find','push','type','format','VoiceExtensionId','outbound','extension','Set','cutdigits','context','CDR(routeid)=','ExecIf','$[${LEN(${CDR(prefix)})}\x20>\x200]?Goto(','):Goto(','CDR(prefix)=${EXTEN:0:','outboundrouteid=','recordingFormat','none','_XCALLY_MIXMONITOR_UNIQUEID=${UNIQUEID}','_XCALLY_MIXMONITOR_FORMAT=','wav','XCALLY-MOTION-ANSWER=0','MONITOR_OPTIONS=ab','length','toLowerCase','createdAt','updatedAt','interval','*,*,*,*','tag','CDR(tag)=','callerID','$[${LEN(${PREFIX-CALLERIDALL})}\x20>\x200]?Set(CALLERID(all)=${PREFIX-CALLERIDALL}):NoOp(No\x20number\x20available)','app','appType','custom','XCALLY-MOTION-ANSWER=1'];(function(_0x15ec42,_0x12f11f){var _0x2acf50=function(_0x489b52){while(--_0x489b52){_0x15ec42['push'](_0x15ec42['shift']());}};_0x2acf50(++_0x12f11f);}(_0x5cd8,0x1d2));var _0x85cd=function(_0x4e74f6,_0x26c8e7){_0x4e74f6=_0x4e74f6-0x0;var _0x48a703=_0x5cd8[_0x4e74f6];return _0x48a703;};'use strict';var _=require(_0x85cd('0x0'));var util=require('util');function rewrite(_0x24bfe8,_0x32ee64){var _0x2bfe8e=this;return _0x24bfe8[_0x85cd('0x1')]['Interval'][_0x85cd('0x2')]({'raw':!![]})['then'](function(_0x1c9dc8){_0x2bfe8e[_0x85cd('0x3')]=_0x1c9dc8;return _0x24bfe8[_0x85cd('0x1')][_0x85cd('0x4')][_0x85cd('0x2')]({'where':{'IntervalId':_0x32ee64['IntervalId']},'raw':!![]});})[_0x85cd('0x5')](function(_0x1a69c4){return _0x24bfe8['models'][_0x85cd('0x4')][_0x85cd('0x2')]({'where':{'exten':{'$in':_[_0x85cd('0x6')](_[_0x85cd('0x7')](_0x1a69c4,_0x85cd('0x8')))}},'order':[{'raw':_0x85cd('0x9')}],'raw':!![]});})[_0x85cd('0x5')](function(_0x13d545){var _0x3a28bb=_['filter'](_0x13d545,{'priority':'1'});var _0x526093=_[_0x85cd('0xa')](_0x13d545,{'isApp':0x1});var _0x2301b2=_[_0x85cd('0xb')](_0x526093,_0x85cd('0x8'));var _0x4f054b=[_0x85cd('0xc'),_0x85cd('0xd')];var _0x46432e=[];var _0x8d4f02=[];for(var _0xc695a0 in _0x2301b2){if(_0x2301b2[_0x85cd('0xe')](_0xc695a0)){_0x2bfe8e[_0x85cd('0xf')]=0x2;_0x2bfe8e[_0x85cd('0x10')]=[];_0x2bfe8e['extension']=_[_0x85cd('0x11')](_0x3a28bb,{'exten':_0x2301b2[_0xc695a0][0x0][_0x85cd('0x8')]});_0x2bfe8e[_0x85cd('0x10')][_0x85cd('0x12')]({'type':_0x2301b2[_0xc695a0][0x0][_0x85cd('0x13')],'app':'Set','appdata':util[_0x85cd('0x14')]('CDR(type)=%s',_0x2301b2[_0xc695a0][0x0][_0x85cd('0x13')]),'context':_0x2301b2[_0xc695a0][0x0]['context'],'exten':_0x2301b2[_0xc695a0][0x0][_0x85cd('0x8')],'priority':_0x2bfe8e['priority']++,'VoiceExtensionId':_0x2301b2[_0xc695a0][0x0][_0x85cd('0x15')]});if(_0x2301b2[_0xc695a0][0x0][_0x85cd('0x13')]===_0x85cd('0x16')){if(_0x2bfe8e[_0x85cd('0x17')]){_0x2bfe8e[_0x85cd('0x10')][_0x85cd('0x12')]({'type':_0x2301b2[_0xc695a0][0x0][_0x85cd('0x13')],'app':_0x85cd('0x18'),'appdata':'CDR(destination)='+(_0x2bfe8e[_0x85cd('0x17')][_0x85cd('0x19')]?'${EXTEN:'+_0x2bfe8e['extension']['cutdigits']+'}':'${EXTEN}'),'context':_0x2301b2[_0xc695a0][0x0][_0x85cd('0x1a')],'exten':_0x2301b2[_0xc695a0][0x0]['exten'],'priority':_0x2bfe8e[_0x85cd('0xf')]++,'VoiceExtensionId':_0x2301b2[_0xc695a0][0x0][_0x85cd('0x15')]});}_0x2bfe8e[_0x85cd('0x10')][_0x85cd('0x12')]({'type':_0x2301b2[_0xc695a0][0x0]['type'],'app':_0x85cd('0x18'),'appdata':_0x85cd('0x1b')+_0x2301b2[_0xc695a0][0x0][_0x85cd('0x15')],'context':_0x2301b2[_0xc695a0][0x0][_0x85cd('0x1a')],'exten':_0x2301b2[_0xc695a0][0x0][_0x85cd('0x8')],'priority':_0x2bfe8e[_0x85cd('0xf')]++,'VoiceExtensionId':_0x2301b2[_0xc695a0][0x0]['VoiceExtensionId']});var _0xb3500f=_0x2bfe8e[_0x85cd('0xf')]++;_0x2bfe8e[_0x85cd('0x10')][_0x85cd('0x12')]({'type':_0x2301b2[_0xc695a0][0x0]['type'],'app':_0x85cd('0x1c'),'appdata':_0x85cd('0x1d')+(_0xb3500f+0x2)+_0x85cd('0x1e')+(_0xb3500f+0x1)+')','context':_0x2301b2[_0xc695a0][0x0]['context'],'exten':_0x2301b2[_0xc695a0][0x0]['exten'],'priority':_0xb3500f,'VoiceExtensionId':_0x2301b2[_0xc695a0][0x0][_0x85cd('0x15')]});if(_0x2bfe8e['extension']){_0x2bfe8e[_0x85cd('0x10')][_0x85cd('0x12')]({'type':_0x2301b2[_0xc695a0][0x0][_0x85cd('0x13')],'app':_0x85cd('0x18'),'appdata':_0x2bfe8e['extension'][_0x85cd('0x19')]?_0x85cd('0x1f')+_0x2bfe8e[_0x85cd('0x17')][_0x85cd('0x19')]+'}':'CDR(prefix)=noprefix','context':_0x2301b2[_0xc695a0][0x0][_0x85cd('0x1a')],'exten':_0x2301b2[_0xc695a0][0x0][_0x85cd('0x8')],'priority':_0x2bfe8e[_0x85cd('0xf')]++,'VoiceExtensionId':_0x2301b2[_0xc695a0][0x0]['VoiceExtensionId']});}_0x2bfe8e['extensions'][_0x85cd('0x12')]({'type':_0x2301b2[_0xc695a0][0x0][_0x85cd('0x13')],'app':_0x85cd('0x18'),'appdata':_0x85cd('0x20')+_0x2301b2[_0xc695a0][0x0][_0x85cd('0x15')],'context':_0x2301b2[_0xc695a0][0x0][_0x85cd('0x1a')],'exten':_0x2301b2[_0xc695a0][0x0][_0x85cd('0x8')],'priority':_0x2bfe8e[_0x85cd('0xf')]++,'VoiceExtensionId':_0x2301b2[_0xc695a0][0x0]['VoiceExtensionId']});if(_0x2bfe8e[_0x85cd('0x17')]&&_0x2bfe8e[_0x85cd('0x17')][_0x85cd('0xe')](_0x85cd('0x21'))&&_0x2bfe8e['extension'][_0x85cd('0x21')]!==_0x85cd('0x22')){_0x2bfe8e[_0x85cd('0x10')][_0x85cd('0x12')]({'type':_0x2301b2[_0xc695a0][0x0][_0x85cd('0x13')],'app':'Set','appdata':_0x85cd('0x23'),'context':_0x2301b2[_0xc695a0][0x0][_0x85cd('0x1a')],'exten':_0x2301b2[_0xc695a0][0x0]['exten'],'priority':_0x2bfe8e[_0x85cd('0xf')]++,'VoiceExtensionId':_0x2301b2[_0xc695a0][0x0][_0x85cd('0x15')]});_0x2bfe8e[_0x85cd('0x10')]['push']({'type':_0x2301b2[_0xc695a0][0x0]['type'],'app':_0x85cd('0x18'),'appdata':_0x85cd('0x24')+_0x2bfe8e['extension']['recordingFormat']||_0x85cd('0x25'),'context':_0x2301b2[_0xc695a0][0x0]['context'],'exten':_0x2301b2[_0xc695a0][0x0]['exten'],'priority':_0x2bfe8e[_0x85cd('0xf')]++,'VoiceExtensionId':_0x2301b2[_0xc695a0][0x0][_0x85cd('0x15')]});}}_0x2bfe8e[_0x85cd('0x10')][_0x85cd('0x12')]({'type':_0x2301b2[_0xc695a0][0x0][_0x85cd('0x13')],'app':_0x85cd('0x18'),'appdata':_0x85cd('0x26'),'context':_0x2301b2[_0xc695a0][0x0][_0x85cd('0x1a')],'exten':_0x2301b2[_0xc695a0][0x0][_0x85cd('0x8')],'priority':_0x2bfe8e[_0x85cd('0xf')]++,'VoiceExtensionId':_0x2301b2[_0xc695a0][0x0][_0x85cd('0x15')]});_0x2bfe8e[_0x85cd('0x10')][_0x85cd('0x12')]({'type':_0x2301b2[_0xc695a0][0x0][_0x85cd('0x13')],'app':_0x85cd('0x18'),'appdata':'XCALLY-MOTION-PROGRESS=0','context':_0x2301b2[_0xc695a0][0x0][_0x85cd('0x1a')],'exten':_0x2301b2[_0xc695a0][0x0][_0x85cd('0x8')],'priority':_0x2bfe8e[_0x85cd('0xf')]++,'VoiceExtensionId':_0x2301b2[_0xc695a0][0x0][_0x85cd('0x15')]});_0x2bfe8e[_0x85cd('0x10')][_0x85cd('0x12')]({'type':_0x2301b2[_0xc695a0][0x0][_0x85cd('0x13')],'app':_0x85cd('0x18'),'appdata':_0x85cd('0x27'),'context':_0x2301b2[_0xc695a0][0x0][_0x85cd('0x1a')],'exten':_0x2301b2[_0xc695a0][0x0][_0x85cd('0x8')],'priority':_0x2bfe8e['priority']++,'VoiceExtensionId':_0x2301b2[_0xc695a0][0x0]['VoiceExtensionId']});for(var _0x467589=0x0,_0x3494fd=0x0;_0x467589<_0x2301b2[_0xc695a0][_0x85cd('0x28')];_0x467589+=0x1,_0x3494fd=0x0){var _0x25b7c7=_0x2301b2[_0xc695a0][_0x467589];if(_0x25b7c7['type']){_0x25b7c7[_0x85cd('0x13')]=_0x25b7c7[_0x85cd('0x13')][_0x85cd('0x29')]();}var _0x4efb8e=[];var _0x1139e0=[];delete _0x25b7c7['id'];delete _0x25b7c7[_0x85cd('0x2a')];delete _0x25b7c7[_0x85cd('0x2b')];var _0xd1c180=_0x25b7c7[_0x85cd('0x2c')]!==_0x85cd('0x2d')?[_0x25b7c7['interval']]:_0x25b7c7['IntervalId']?_[_0x85cd('0x7')](_[_0x85cd('0xa')](_0x2bfe8e[_0x85cd('0x3')],{'IntervalId':_0x25b7c7['IntervalId']}),_0x85cd('0x2c')):[];if(_0x25b7c7[_0x85cd('0xe')](_0x85cd('0x2e'))){if(_0x25b7c7['tag']&&_0x25b7c7[_0x85cd('0x2e')]!=='--'){_0x4efb8e['push']({'type':_0x25b7c7['type'],'app':_0x85cd('0x18'),'appdata':_0x85cd('0x2f')+_0x25b7c7[_0x85cd('0x2e')],'context':_0x25b7c7[_0x85cd('0x1a')],'exten':_0x25b7c7[_0x85cd('0x8')],'priority':_0xd1c180[_0x85cd('0x28')]+_0x2bfe8e['priority']+_0x3494fd++,'VoiceExtensionId':_0x25b7c7[_0x85cd('0x15')]});}}if(_0x25b7c7[_0x85cd('0x13')]===_0x85cd('0x16')&&_0x25b7c7[_0x85cd('0xe')](_0x85cd('0x30'))){if(_0x25b7c7[_0x85cd('0x30')]){_0x4efb8e[_0x85cd('0x12')]({'type':_0x25b7c7[_0x85cd('0x13')],'app':'ExecIf','appdata':'$[${LEN(${PREFIX-CALLERIDALL})}\x20>\x200]?Set(CALLERID(all)=${PREFIX-CALLERIDALL}):Set(CALLERID(all)='+_0x25b7c7[_0x85cd('0x30')]+')','context':_0x25b7c7[_0x85cd('0x1a')],'exten':_0x25b7c7[_0x85cd('0x8')],'priority':_0xd1c180[_0x85cd('0x28')]+_0x2bfe8e[_0x85cd('0xf')]+_0x3494fd++,'VoiceExtensionId':_0x25b7c7[_0x85cd('0x15')]});}else{_0x4efb8e['push']({'type':_0x25b7c7[_0x85cd('0x13')],'app':_0x85cd('0x1c'),'appdata':_0x85cd('0x31'),'context':_0x25b7c7['context'],'exten':_0x25b7c7['exten'],'priority':_0xd1c180['length']+_0x2bfe8e['priority']+_0x3494fd++,'VoiceExtensionId':_0x25b7c7['VoiceExtensionId']});}}if(_0x25b7c7[_0x85cd('0xe')]('answer')){if(_0x4f054b['indexOf'](_0x25b7c7[_0x85cd('0x32')][_0x85cd('0x29')]())>=0x0&&_0x25b7c7[_0x85cd('0x33')]!==_0x85cd('0x34')){if(_0x25b7c7['answer']){_0x4efb8e[_0x85cd('0x12')]({'type':_0x25b7c7[_0x85cd('0x13')],'app':'ExecIf','appdata':'$[${XCALLY-MOTION-ANSWER}=0]?Answer','context':_0x25b7c7[_0x85cd('0x1a')],'exten':_0x25b7c7['exten'],'priority':_0xd1c180[_0x85cd('0x28')]+_0x2bfe8e['priority']+_0x3494fd++,'VoiceExtensionId':_0x25b7c7[_0x85cd('0x15')]});_0x4efb8e[_0x85cd('0x12')]({'type':_0x25b7c7[_0x85cd('0x13')],'app':'Set','appdata':_0x85cd('0x35'),'context':_0x25b7c7[_0x85cd('0x1a')],'exten':_0x25b7c7[_0x85cd('0x8')],'priority':_0xd1c180[_0x85cd('0x28')]+_0x2bfe8e['priority']+_0x3494fd++,'VoiceExtensionId':_0x25b7c7[_0x85cd('0x15')]});}else{_0x4efb8e[_0x85cd('0x12')]({'type':_0x25b7c7['type'],'app':_0x85cd('0x1c'),'appdata':'$[${XCALLY-MOTION-PROGRESS}=0]?Progress','context':_0x25b7c7[_0x85cd('0x1a')],'exten':_0x25b7c7[_0x85cd('0x8')],'priority':_0xd1c180[_0x85cd('0x28')]+_0x2bfe8e[_0x85cd('0xf')]+_0x3494fd++,'VoiceExtensionId':_0x25b7c7[_0x85cd('0x15')]});_0x4efb8e[_0x85cd('0x12')]({'type':_0x25b7c7['type'],'app':'Set','appdata':_0x85cd('0x36'),'context':_0x25b7c7[_0x85cd('0x1a')],'exten':_0x25b7c7[_0x85cd('0x8')],'priority':_0xd1c180[_0x85cd('0x28')]+_0x2bfe8e['priority']+_0x3494fd++,'VoiceExtensionId':_0x25b7c7[_0x85cd('0x15')]});}}}for(var _0x1afbff=0x0;_0x1afbff<_0xd1c180[_0x85cd('0x28')];_0x1afbff+=0x1){var _0xbabb64=_0x2bfe8e[_0x85cd('0xf')]+_0xd1c180[_0x85cd('0x28')];var _0x3ab6d4=_0x1afbff===_0xd1c180['length']-0x1?_0x2bfe8e['priority']+_0x4efb8e[_0x85cd('0x28')]+_0x1139e0[_0x85cd('0x28')]+0x2:_0x2bfe8e[_0x85cd('0xf')]+_0x1afbff+0x1;_0x4efb8e[_0x85cd('0x37')](_0x1afbff,0x0,{'type':_0x25b7c7['type'],'app':_0x85cd('0x38'),'appdata':_0xd1c180[_0x1afbff]+'?'+_0x25b7c7[_0x85cd('0x1a')]+',${EXTEN},'+_0xbabb64+':'+_0x25b7c7[_0x85cd('0x1a')]+_0x85cd('0x39')+_0x3ab6d4,'exten':_0x25b7c7['exten'],'context':_0x25b7c7[_0x85cd('0x1a')],'priority':_0x2bfe8e['priority']+_0x1afbff,'VoiceExtensionId':_0x2301b2[_0xc695a0][0x0][_0x85cd('0x15')]});}_0x25b7c7[_0x85cd('0xf')]=_0x4efb8e[_0x85cd('0x28')]?_[_0x85cd('0x3a')](_0x4efb8e)[_0x85cd('0xf')]+0x1:_0x2bfe8e[_0x85cd('0xf')];_0x2bfe8e[_0x85cd('0xf')]=(_0x1139e0['length']?_['last'](_0x1139e0)[_0x85cd('0xf')]:_0x25b7c7[_0x85cd('0xf')])+0x1;_0x2bfe8e['extensions']=_[_0x85cd('0x3b')](_0x2bfe8e[_0x85cd('0x10')],_0x4efb8e,[_0x25b7c7],_0x1139e0);}_0x2bfe8e[_0x85cd('0x10')][_0x85cd('0x12')]({'type':_0x2301b2[_0xc695a0][0x0][_0x85cd('0x13')],'app':'Hangup','exten':_0x2301b2[_0xc695a0][0x0][_0x85cd('0x8')],'context':_0x2301b2[_0xc695a0][0x0][_0x85cd('0x1a')],'priority':_0x2bfe8e[_0x85cd('0xf')],'VoiceExtensionId':_0x2301b2[_0xc695a0][0x0][_0x85cd('0x15')]});_0x46432e[_0x85cd('0x12')](_0x2301b2[_0xc695a0][0x0][_0x85cd('0x15')]);_0x8d4f02=_[_0x85cd('0x3b')](_0x8d4f02,_0x2bfe8e[_0x85cd('0x10')]);}}return _0x24bfe8[_0x85cd('0x3c')](function(_0x5441b3){return _0x24bfe8['models'][_0x85cd('0x4')][_0x85cd('0x3d')]({'where':{'VoiceExtensionId':{'$in':_0x46432e}},'transaction':_0x5441b3})[_0x85cd('0x5')](function(_0x4525f8){return _0x24bfe8[_0x85cd('0x1')][_0x85cd('0x4')]['bulkCreate'](_[_0x85cd('0x3e')](_0x8d4f02,_0x85cd('0xf')),{'transaction':_0x5441b3});});});})[_0x85cd('0x3f')](function(_0x5eb538){console[_0x85cd('0x40')](_0x5eb538);});}exports['rewrite']=rewrite; \ No newline at end of file +var _0xdadf=['CDR(prefix)=${EXTEN:0:','outboundrouteid=','recordingFormat','none','_XCALLY_MIXMONITOR_UNIQUEID=${UNIQUEID}','_XCALLY_MIXMONITOR_FORMAT=','wav','XCALLY-MOTION-ANSWER=0','length','toLowerCase','createdAt','*,*,*,*','interval','tag','callerID','$[${LEN(${PREFIX-CALLERIDALL})}\x20>\x200]?Set(CALLERID(all)=${PREFIX-CALLERIDALL}):Set(CALLERID(all)=','$[${LEN(${PREFIX-CALLERIDALL})}\x20>\x200]?Set(CALLERID(all)=${PREFIX-CALLERIDALL}):NoOp(No\x20number\x20available)','answer','indexOf','app','appType','custom','XCALLY-MOTION-ANSWER=1','$[${XCALLY-MOTION-PROGRESS}=0]?Progress','XCALLY-MOTION-PROGRESS=1','splice','GotoIfTime','last','concat','transaction','destroy','error','rewrite','lodash','util','models','Interval','findAll','then','intervals','VoiceExtension','IntervalId','uniq','map','exten','CAST(priority\x20AS\x20UNSIGNED)','filter','groupBy','playback','hasOwnProperty','priority','extensions','extension','find','push','CDR(type)=%s','type','context','VoiceExtensionId','outbound','Set','${EXTEN:','${EXTEN}','CDR(routeid)=','ExecIf','$[${LEN(${CDR(prefix)})}\x20>\x200]?Goto(','):Goto(','cutdigits'];(function(_0x49d40d,_0x30e0ea){var _0x5ec463=function(_0x11bab1){while(--_0x11bab1){_0x49d40d['push'](_0x49d40d['shift']());}};_0x5ec463(++_0x30e0ea);}(_0xdadf,0x175));var _0xfdad=function(_0x37cfe5,_0xb16501){_0x37cfe5=_0x37cfe5-0x0;var _0x3fe426=_0xdadf[_0x37cfe5];return _0x3fe426;};'use strict';var _=require(_0xfdad('0x0'));var util=require(_0xfdad('0x1'));function rewrite(_0x5a99c5,_0x2ca89b){var _0x1910af=this;return _0x5a99c5[_0xfdad('0x2')][_0xfdad('0x3')][_0xfdad('0x4')]({'raw':!![]})[_0xfdad('0x5')](function(_0x449e44){_0x1910af[_0xfdad('0x6')]=_0x449e44;return _0x5a99c5[_0xfdad('0x2')][_0xfdad('0x7')][_0xfdad('0x4')]({'where':{'IntervalId':_0x2ca89b[_0xfdad('0x8')]},'raw':!![]});})[_0xfdad('0x5')](function(_0x3bb44e){return _0x5a99c5[_0xfdad('0x2')][_0xfdad('0x7')][_0xfdad('0x4')]({'where':{'exten':{'$in':_[_0xfdad('0x9')](_[_0xfdad('0xa')](_0x3bb44e,_0xfdad('0xb')))}},'order':[{'raw':_0xfdad('0xc')}],'raw':!![]});})[_0xfdad('0x5')](function(_0xe04eda){var _0x218535=_[_0xfdad('0xd')](_0xe04eda,{'priority':'1'});var _0x742aa9=_[_0xfdad('0xd')](_0xe04eda,{'isApp':0x1});var _0x2b871a=_[_0xfdad('0xe')](_0x742aa9,_0xfdad('0xb'));var _0x20923a=['queue',_0xfdad('0xf')];var _0x57ff17=[];var _0x2ff893=[];for(var _0x1c3335 in _0x2b871a){if(_0x2b871a[_0xfdad('0x10')](_0x1c3335)){_0x1910af[_0xfdad('0x11')]=0x2;_0x1910af[_0xfdad('0x12')]=[];_0x1910af[_0xfdad('0x13')]=_[_0xfdad('0x14')](_0x218535,{'exten':_0x2b871a[_0x1c3335][0x0][_0xfdad('0xb')]});_0x1910af['extensions'][_0xfdad('0x15')]({'type':_0x2b871a[_0x1c3335][0x0]['type'],'app':'Set','appdata':util['format'](_0xfdad('0x16'),_0x2b871a[_0x1c3335][0x0][_0xfdad('0x17')]),'context':_0x2b871a[_0x1c3335][0x0][_0xfdad('0x18')],'exten':_0x2b871a[_0x1c3335][0x0][_0xfdad('0xb')],'priority':_0x1910af['priority']++,'VoiceExtensionId':_0x2b871a[_0x1c3335][0x0][_0xfdad('0x19')]});if(_0x2b871a[_0x1c3335][0x0][_0xfdad('0x17')]===_0xfdad('0x1a')){if(_0x1910af['extension']){_0x1910af[_0xfdad('0x12')]['push']({'type':_0x2b871a[_0x1c3335][0x0][_0xfdad('0x17')],'app':_0xfdad('0x1b'),'appdata':'CDR(destination)='+(_0x1910af[_0xfdad('0x13')]['cutdigits']?_0xfdad('0x1c')+_0x1910af['extension']['cutdigits']+'}':_0xfdad('0x1d')),'context':_0x2b871a[_0x1c3335][0x0]['context'],'exten':_0x2b871a[_0x1c3335][0x0][_0xfdad('0xb')],'priority':_0x1910af[_0xfdad('0x11')]++,'VoiceExtensionId':_0x2b871a[_0x1c3335][0x0][_0xfdad('0x19')]});}_0x1910af[_0xfdad('0x12')][_0xfdad('0x15')]({'type':_0x2b871a[_0x1c3335][0x0][_0xfdad('0x17')],'app':_0xfdad('0x1b'),'appdata':_0xfdad('0x1e')+_0x2b871a[_0x1c3335][0x0][_0xfdad('0x19')],'context':_0x2b871a[_0x1c3335][0x0][_0xfdad('0x18')],'exten':_0x2b871a[_0x1c3335][0x0][_0xfdad('0xb')],'priority':_0x1910af[_0xfdad('0x11')]++,'VoiceExtensionId':_0x2b871a[_0x1c3335][0x0][_0xfdad('0x19')]});var _0x3f66b5=_0x1910af[_0xfdad('0x11')]++;_0x1910af[_0xfdad('0x12')][_0xfdad('0x15')]({'type':_0x2b871a[_0x1c3335][0x0][_0xfdad('0x17')],'app':_0xfdad('0x1f'),'appdata':_0xfdad('0x20')+(_0x3f66b5+0x2)+_0xfdad('0x21')+(_0x3f66b5+0x1)+')','context':_0x2b871a[_0x1c3335][0x0][_0xfdad('0x18')],'exten':_0x2b871a[_0x1c3335][0x0][_0xfdad('0xb')],'priority':_0x3f66b5,'VoiceExtensionId':_0x2b871a[_0x1c3335][0x0][_0xfdad('0x19')]});if(_0x1910af[_0xfdad('0x13')]){_0x1910af[_0xfdad('0x12')][_0xfdad('0x15')]({'type':_0x2b871a[_0x1c3335][0x0][_0xfdad('0x17')],'app':_0xfdad('0x1b'),'appdata':_0x1910af[_0xfdad('0x13')][_0xfdad('0x22')]?_0xfdad('0x23')+_0x1910af[_0xfdad('0x13')]['cutdigits']+'}':'CDR(prefix)=noprefix','context':_0x2b871a[_0x1c3335][0x0]['context'],'exten':_0x2b871a[_0x1c3335][0x0][_0xfdad('0xb')],'priority':_0x1910af[_0xfdad('0x11')]++,'VoiceExtensionId':_0x2b871a[_0x1c3335][0x0][_0xfdad('0x19')]});}_0x1910af[_0xfdad('0x12')]['push']({'type':_0x2b871a[_0x1c3335][0x0][_0xfdad('0x17')],'app':_0xfdad('0x1b'),'appdata':_0xfdad('0x24')+_0x2b871a[_0x1c3335][0x0][_0xfdad('0x19')],'context':_0x2b871a[_0x1c3335][0x0][_0xfdad('0x18')],'exten':_0x2b871a[_0x1c3335][0x0]['exten'],'priority':_0x1910af[_0xfdad('0x11')]++,'VoiceExtensionId':_0x2b871a[_0x1c3335][0x0][_0xfdad('0x19')]});if(_0x1910af['extension']&&_0x1910af[_0xfdad('0x13')][_0xfdad('0x10')](_0xfdad('0x25'))&&_0x1910af[_0xfdad('0x13')][_0xfdad('0x25')]!==_0xfdad('0x26')){_0x1910af[_0xfdad('0x12')][_0xfdad('0x15')]({'type':_0x2b871a[_0x1c3335][0x0]['type'],'app':'Set','appdata':_0xfdad('0x27'),'context':_0x2b871a[_0x1c3335][0x0][_0xfdad('0x18')],'exten':_0x2b871a[_0x1c3335][0x0][_0xfdad('0xb')],'priority':_0x1910af[_0xfdad('0x11')]++,'VoiceExtensionId':_0x2b871a[_0x1c3335][0x0][_0xfdad('0x19')]});_0x1910af[_0xfdad('0x12')][_0xfdad('0x15')]({'type':_0x2b871a[_0x1c3335][0x0][_0xfdad('0x17')],'app':_0xfdad('0x1b'),'appdata':_0xfdad('0x28')+_0x1910af[_0xfdad('0x13')][_0xfdad('0x25')]||_0xfdad('0x29'),'context':_0x2b871a[_0x1c3335][0x0][_0xfdad('0x18')],'exten':_0x2b871a[_0x1c3335][0x0][_0xfdad('0xb')],'priority':_0x1910af[_0xfdad('0x11')]++,'VoiceExtensionId':_0x2b871a[_0x1c3335][0x0][_0xfdad('0x19')]});}}_0x1910af[_0xfdad('0x12')]['push']({'type':_0x2b871a[_0x1c3335][0x0]['type'],'app':_0xfdad('0x1b'),'appdata':_0xfdad('0x2a'),'context':_0x2b871a[_0x1c3335][0x0][_0xfdad('0x18')],'exten':_0x2b871a[_0x1c3335][0x0][_0xfdad('0xb')],'priority':_0x1910af[_0xfdad('0x11')]++,'VoiceExtensionId':_0x2b871a[_0x1c3335][0x0][_0xfdad('0x19')]});_0x1910af[_0xfdad('0x12')][_0xfdad('0x15')]({'type':_0x2b871a[_0x1c3335][0x0][_0xfdad('0x17')],'app':_0xfdad('0x1b'),'appdata':'XCALLY-MOTION-PROGRESS=0','context':_0x2b871a[_0x1c3335][0x0]['context'],'exten':_0x2b871a[_0x1c3335][0x0][_0xfdad('0xb')],'priority':_0x1910af['priority']++,'VoiceExtensionId':_0x2b871a[_0x1c3335][0x0][_0xfdad('0x19')]});_0x1910af[_0xfdad('0x12')]['push']({'type':_0x2b871a[_0x1c3335][0x0][_0xfdad('0x17')],'app':_0xfdad('0x1b'),'appdata':'MONITOR_OPTIONS=ab','context':_0x2b871a[_0x1c3335][0x0]['context'],'exten':_0x2b871a[_0x1c3335][0x0][_0xfdad('0xb')],'priority':_0x1910af[_0xfdad('0x11')]++,'VoiceExtensionId':_0x2b871a[_0x1c3335][0x0][_0xfdad('0x19')]});for(var _0x866252=0x0,_0x3e6aab=0x0;_0x866252<_0x2b871a[_0x1c3335][_0xfdad('0x2b')];_0x866252+=0x1,_0x3e6aab=0x0){var _0x12800e=_0x2b871a[_0x1c3335][_0x866252];if(_0x12800e[_0xfdad('0x17')]){_0x12800e['type']=_0x12800e['type'][_0xfdad('0x2c')]();}var _0x110258=[];var _0x13ba43=[];delete _0x12800e['id'];delete _0x12800e[_0xfdad('0x2d')];delete _0x12800e['updatedAt'];var _0x5ebf40=_0x12800e['interval']!==_0xfdad('0x2e')?[_0x12800e[_0xfdad('0x2f')]]:_0x12800e[_0xfdad('0x8')]?_[_0xfdad('0xa')](_[_0xfdad('0xd')](_0x1910af[_0xfdad('0x6')],{'IntervalId':_0x12800e[_0xfdad('0x8')]}),_0xfdad('0x2f')):[];if(_0x12800e[_0xfdad('0x10')](_0xfdad('0x30'))){if(_0x12800e['tag']&&_0x12800e['tag']!=='--'){_0x110258[_0xfdad('0x15')]({'type':_0x12800e[_0xfdad('0x17')],'app':_0xfdad('0x1b'),'appdata':'CDR(tag)='+_0x12800e[_0xfdad('0x30')],'context':_0x12800e[_0xfdad('0x18')],'exten':_0x12800e[_0xfdad('0xb')],'priority':_0x5ebf40['length']+_0x1910af['priority']+_0x3e6aab++,'VoiceExtensionId':_0x12800e['VoiceExtensionId']});}}if(_0x12800e[_0xfdad('0x17')]===_0xfdad('0x1a')&&_0x12800e[_0xfdad('0x10')](_0xfdad('0x31'))){if(_0x12800e[_0xfdad('0x31')]){_0x110258[_0xfdad('0x15')]({'type':_0x12800e['type'],'app':_0xfdad('0x1f'),'appdata':_0xfdad('0x32')+_0x12800e['callerID']+')','context':_0x12800e['context'],'exten':_0x12800e[_0xfdad('0xb')],'priority':_0x5ebf40['length']+_0x1910af['priority']+_0x3e6aab++,'VoiceExtensionId':_0x12800e[_0xfdad('0x19')]});}else{_0x110258[_0xfdad('0x15')]({'type':_0x12800e['type'],'app':_0xfdad('0x1f'),'appdata':_0xfdad('0x33'),'context':_0x12800e['context'],'exten':_0x12800e['exten'],'priority':_0x5ebf40[_0xfdad('0x2b')]+_0x1910af[_0xfdad('0x11')]+_0x3e6aab++,'VoiceExtensionId':_0x12800e[_0xfdad('0x19')]});}}if(_0x12800e['hasOwnProperty'](_0xfdad('0x34'))){if(_0x20923a[_0xfdad('0x35')](_0x12800e[_0xfdad('0x36')][_0xfdad('0x2c')]())>=0x0&&_0x12800e[_0xfdad('0x37')]!==_0xfdad('0x38')){if(_0x12800e[_0xfdad('0x34')]){_0x110258[_0xfdad('0x15')]({'type':_0x12800e[_0xfdad('0x17')],'app':_0xfdad('0x1f'),'appdata':'$[${XCALLY-MOTION-ANSWER}=0]?Answer','context':_0x12800e['context'],'exten':_0x12800e['exten'],'priority':_0x5ebf40[_0xfdad('0x2b')]+_0x1910af[_0xfdad('0x11')]+_0x3e6aab++,'VoiceExtensionId':_0x12800e['VoiceExtensionId']});_0x110258[_0xfdad('0x15')]({'type':_0x12800e[_0xfdad('0x17')],'app':_0xfdad('0x1b'),'appdata':_0xfdad('0x39'),'context':_0x12800e[_0xfdad('0x18')],'exten':_0x12800e[_0xfdad('0xb')],'priority':_0x5ebf40[_0xfdad('0x2b')]+_0x1910af[_0xfdad('0x11')]+_0x3e6aab++,'VoiceExtensionId':_0x12800e[_0xfdad('0x19')]});}else{_0x110258[_0xfdad('0x15')]({'type':_0x12800e[_0xfdad('0x17')],'app':_0xfdad('0x1f'),'appdata':_0xfdad('0x3a'),'context':_0x12800e[_0xfdad('0x18')],'exten':_0x12800e['exten'],'priority':_0x5ebf40[_0xfdad('0x2b')]+_0x1910af[_0xfdad('0x11')]+_0x3e6aab++,'VoiceExtensionId':_0x12800e[_0xfdad('0x19')]});_0x110258[_0xfdad('0x15')]({'type':_0x12800e[_0xfdad('0x17')],'app':_0xfdad('0x1b'),'appdata':_0xfdad('0x3b'),'context':_0x12800e[_0xfdad('0x18')],'exten':_0x12800e[_0xfdad('0xb')],'priority':_0x5ebf40[_0xfdad('0x2b')]+_0x1910af[_0xfdad('0x11')]+_0x3e6aab++,'VoiceExtensionId':_0x12800e[_0xfdad('0x19')]});}}}for(var _0x57dd42=0x0;_0x57dd42<_0x5ebf40[_0xfdad('0x2b')];_0x57dd42+=0x1){var _0x1b32f4=_0x1910af[_0xfdad('0x11')]+_0x5ebf40['length'];var _0x290cf1=_0x57dd42===_0x5ebf40['length']-0x1?_0x1910af[_0xfdad('0x11')]+_0x110258[_0xfdad('0x2b')]+_0x13ba43[_0xfdad('0x2b')]+0x2:_0x1910af[_0xfdad('0x11')]+_0x57dd42+0x1;_0x110258[_0xfdad('0x3c')](_0x57dd42,0x0,{'type':_0x12800e[_0xfdad('0x17')],'app':_0xfdad('0x3d'),'appdata':_0x5ebf40[_0x57dd42]+'?'+_0x12800e['context']+',${EXTEN},'+_0x1b32f4+':'+_0x12800e[_0xfdad('0x18')]+',${EXTEN},'+_0x290cf1,'exten':_0x12800e[_0xfdad('0xb')],'context':_0x12800e[_0xfdad('0x18')],'priority':_0x1910af[_0xfdad('0x11')]+_0x57dd42,'VoiceExtensionId':_0x2b871a[_0x1c3335][0x0][_0xfdad('0x19')]});}_0x12800e['priority']=_0x110258['length']?_[_0xfdad('0x3e')](_0x110258)[_0xfdad('0x11')]+0x1:_0x1910af[_0xfdad('0x11')];_0x1910af[_0xfdad('0x11')]=(_0x13ba43[_0xfdad('0x2b')]?_[_0xfdad('0x3e')](_0x13ba43)[_0xfdad('0x11')]:_0x12800e[_0xfdad('0x11')])+0x1;_0x1910af[_0xfdad('0x12')]=_[_0xfdad('0x3f')](_0x1910af[_0xfdad('0x12')],_0x110258,[_0x12800e],_0x13ba43);}_0x1910af[_0xfdad('0x12')][_0xfdad('0x15')]({'type':_0x2b871a[_0x1c3335][0x0][_0xfdad('0x17')],'app':'Hangup','exten':_0x2b871a[_0x1c3335][0x0][_0xfdad('0xb')],'context':_0x2b871a[_0x1c3335][0x0][_0xfdad('0x18')],'priority':_0x1910af[_0xfdad('0x11')],'VoiceExtensionId':_0x2b871a[_0x1c3335][0x0]['VoiceExtensionId']});_0x57ff17['push'](_0x2b871a[_0x1c3335][0x0][_0xfdad('0x19')]);_0x2ff893=_[_0xfdad('0x3f')](_0x2ff893,_0x1910af[_0xfdad('0x12')]);}}return _0x5a99c5[_0xfdad('0x40')](function(_0x42cf82){return _0x5a99c5[_0xfdad('0x2')][_0xfdad('0x7')][_0xfdad('0x41')]({'where':{'VoiceExtensionId':{'$in':_0x57ff17}},'transaction':_0x42cf82})[_0xfdad('0x5')](function(_0x470392){return _0x5a99c5[_0xfdad('0x2')][_0xfdad('0x7')]['bulkCreate'](_['sortBy'](_0x2ff893,'priority'),{'transaction':_0x42cf82});});});})['catch'](function(_0x5356fe){console[_0xfdad('0x42')](_0x5356fe);});}exports[_0xfdad('0x43')]=rewrite; \ No newline at end of file diff --git a/server/components/import/cm/csv.js b/server/components/import/cm/csv.js index 7e892c6..929f6f2 100644 --- a/server/components/import/cm/csv.js +++ b/server/components/import/cm/csv.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xd8b0=['find','Duplicate\x20Contact','CmContact','keys','then','push','pick','catch','message','stringify','cmContact','checkHopper','inspect','into','cm_hopper','fromQuery','scheduledAt','ContactId','createdAt','updatedAt','select','field','ListId','toString','NOW()','from','cm_contacts','where','phone\x20IS\x20NOT\x20NULL','phone\x20NOT\x20IN\x20(?)','\x20=\x20?','ListId\x20=\x20?','id\x20IN\x20?','insert','deletedAt\x20IS\x20NULL','str','cm_hopper_black','VoiceQueue','outbound','Lists','get','dialCheckDuplicateType','always','sequelize','VoiceQueueId','onlyIfOpen','query','all','CmList','Campaign','findAll','CampaignId','cmContact,\x20%s,\x20%s','Error\x20processing\x20rows\x20block:','finally','emit','contact:csv_','resume','unlinkSync','Unable\x20to\x20delete\x20temp\x20file:','exit','info','createReadStream','parse','duplicate','pause','CSV\x20parse\x20error','Error\x20executing\x20contact\x20csv\x20import:','bluebird','util','ioredis','../../../mysqldb','../../../config/environment','../../../config/logger','api','redis','localhost','socket.io-emitter','../../../api/cmContact/cmContact.socket','register','argv','undefined','null','Missing\x20filepath\x20parameter!','Missing\x20binding\x20parameters!','zipObject','split','Missing\x20ListId\x20parameter!','Missing\x20socket_timestamp\x20parameter!','contact','index','test','error','The\x20row\x20is\x20empty\x20or\x20the\x20number\x20of\x20parameters\x20does\x20not\x20match\x20the\x20columns!','errors','map','hasOwnProperty','data','phone','phone\x20not\x20specified!','birthDate','YYYY-MM-DD','email','CompanyId','length'];(function(_0x18b476,_0x1bb631){var _0x3035df=function(_0x2326bd){while(--_0x2326bd){_0x18b476['push'](_0x18b476['shift']());}};_0x3035df(++_0x1bb631);}(_0xd8b0,0xad));var _0x0d8b=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xd8b0[_0x20a584];return _0x4b41a8;};'use strict';var BPromise=require(_0x0d8b('0x0'));var util=require(_0x0d8b('0x1'));var _=require('lodash');var fs=require('fs');var squel=require('squel');var Papa=require('papaparse');var Redis=require(_0x0d8b('0x2'));var db=require(_0x0d8b('0x3'))['db'];var config=require(_0x0d8b('0x4'));var logger=require(_0x0d8b('0x5'))(_0x0d8b('0x6'));config['redis']=_['defaults'](config[_0x0d8b('0x7')],{'host':_0x0d8b('0x8'),'port':0x18eb});var socket=require(_0x0d8b('0x9'))(new Redis(config['redis']));require(_0x0d8b('0xa'))[_0x0d8b('0xb')](socket);try{if(!process['argv'][0x2]||process[_0x0d8b('0xc')][0x2]===_0x0d8b('0xd')||process[_0x0d8b('0xc')][0x2]===_0x0d8b('0xe')){throw new Error(_0x0d8b('0xf'));}var FILEPATH=process[_0x0d8b('0xc')][0x2];if(!process[_0x0d8b('0xc')][0x3]||process[_0x0d8b('0xc')][0x3]==='undefined'||process[_0x0d8b('0xc')][0x3]==='null'||!process[_0x0d8b('0xc')][0x4]||process[_0x0d8b('0xc')][0x4]===_0x0d8b('0xd')||process[_0x0d8b('0xc')][0x4]===_0x0d8b('0xe')){throw new Error(_0x0d8b('0x10'));}var FIELDS=_[_0x0d8b('0x11')](process[_0x0d8b('0xc')][0x3][_0x0d8b('0x12')](','),process[_0x0d8b('0xc')][0x4][_0x0d8b('0x12')](','));if(!process[_0x0d8b('0xc')][0x5]||process[_0x0d8b('0xc')][0x5]===_0x0d8b('0xd')||process['argv'][0x5]===_0x0d8b('0xe')){throw new Error(_0x0d8b('0x13'));}var LISTID=process[_0x0d8b('0xc')][0x5];var COMPANYID=process[_0x0d8b('0xc')][0x6]&&process[_0x0d8b('0xc')][0x6]!=='undefined'&&process[_0x0d8b('0xc')][0x6]!==_0x0d8b('0xe')?process[_0x0d8b('0xc')][0x6]:null;var DUPLICATES=process[_0x0d8b('0xc')][0x7]&&process[_0x0d8b('0xc')][0x7]!==_0x0d8b('0xd')&&process[_0x0d8b('0xc')][0x7]!==_0x0d8b('0xe')?process['argv'][0x7]:null;if(!process[_0x0d8b('0xc')][0x8]||process[_0x0d8b('0xc')][0x8]===_0x0d8b('0xd')||process[_0x0d8b('0xc')][0x8]===_0x0d8b('0xe')){throw new Error(_0x0d8b('0x14'));}var SOCKET_TIMESTAMP=process[_0x0d8b('0xc')][0x8];}catch(_0x352c17){logger['error'](_0x352c17);endCsv();}var total=0x0;var pTotal=0x0;var success=0x0;var errors=0x0;var duplicates=0x0;var rows=[];var hopperContacts='';var promises=[];var index=0x0;var alreadyInvalid=![];function handleCheckRowError(_0x4f0a1a,_0x33fb87,_0x54a9a7,_0x56c729){var _0x5527d8={'message':_0x33fb87};_0x5527d8[_0x4f0a1a]=!![];if(_0x54a9a7){_0x5527d8[_0x0d8b('0x15')]=_0x54a9a7;}if(_0x56c729){_0x5527d8[_0x0d8b('0x16')]=_0x56c729;}return _0x5527d8;}function isEmail(_0x214778){return/^([^\x00-\x20\x22\x28\x29\x2c\x2e\x3a-\x3c\x3e\x40\x5b-\x5d\x7f-\xff]+|\x22([^\x0d\x22\x5c\x80-\xff]|\x5c[\x00-\x7f])*\x22)(\x2e([^\x00-\x20\x22\x28\x29\x2c\x2e\x3a-\x3c\x3e\x40\x5b-\x5d\x7f-\xff]+|\x22([^\x0d\x22\x5c\x80-\xff]|\x5c[\x00-\x7f])*\x22))*\x40([^\x00-\x20\x22\x28\x29\x2c\x2e\x3a-\x3c\x3e\x40\x5b-\x5d\x7f-\xff]+|\x5b([^\x0d\x5b-\x5d\x80-\xff]|\x5c[\x00-\x7f])*\x5d)(\x2e([^\x00-\x20\x22\x28\x29\x2c\x2e\x3a-\x3c\x3e\x40\x5b-\x5d\x7f-\xff]+|\x5b([^\x0d\x5b-\x5d\x80-\xff]|\x5c[\x00-\x7f])*\x5d))*$/[_0x0d8b('0x17')](_0x214778);}function checkRow(_0x221071,_0x2c64e2,_0x30980c){return new BPromise(function(_0x4562cb,_0x27b695){if(_['isNil'](_0x221071)){return _0x27b695(handleCheckRowError(_0x0d8b('0x18'),_0x0d8b('0x19'),null,_0x30980c));}if(_0x221071['errors']&&_0x221071[_0x0d8b('0x1a')]['length']){var _0x3dd149=_[_0x0d8b('0x1b')](_0x221071[_0x0d8b('0x1a')],'message')['join'](';');return _0x27b695(handleCheckRowError(_0x0d8b('0x18'),_0x3dd149,null,_0x30980c));}var _0x3ef745={};for(var _0x4c05ee in FIELDS){if(FIELDS[_0x0d8b('0x1c')](_0x4c05ee)&&FIELDS[_0x4c05ee]){_0x3ef745[_0x4c05ee]=_0x221071['data'][0x0][FIELDS[_0x4c05ee]]||_0x221071[_0x0d8b('0x1d')][0x0]['\ufeff'+FIELDS[_0x4c05ee]];}}if(!_0x3ef745['firstName']){return _0x27b695(handleCheckRowError(_0x0d8b('0x18'),'firstName\x20not\x20specified!',null,_0x30980c));}if(!_0x3ef745[_0x0d8b('0x1e')]){return _0x27b695(handleCheckRowError('error',_0x0d8b('0x1f'),null,_0x30980c));}if(_0x3ef745['birthDate']){var _0x3c8887=moment(_0x3ef745[_0x0d8b('0x20')],_0x0d8b('0x21'));if(!_0x3c8887['isValid']()){return _0x27b695(handleCheckRowError('error','birthDate\x20format\x20is\x20invalid,\x20YYYY-MM-DD\x20format\x20is\x20supported!',null,_0x30980c));}}if(_0x3ef745[_0x0d8b('0x22')]){if(!isEmail(_0x3ef745['email'])){return _0x27b695(handleCheckRowError(_0x0d8b('0x18'),'email\x20format\x20is\x20not\x20valid!',null,_0x30980c));}}_0x3ef745['ListId']=LISTID;_0x3ef745[_0x0d8b('0x23')]=COMPANYID||undefined;if(DUPLICATES&&DUPLICATES[_0x0d8b('0x24')]&&_0x2c64e2){var _0x109c14={};for(var _0xdeee5d=0x0,_0x183220=DUPLICATES[_0x0d8b('0x24')];_0xdeee5d<_0x183220;_0xdeee5d+=0x1){_0x109c14[DUPLICATES[_0xdeee5d]]=_0x3ef745[DUPLICATES[_0xdeee5d]];}var _0x4a99d3=_[_0x0d8b('0x25')](_0x2c64e2,_0x109c14);if(_0x4a99d3){return _0x27b695(handleCheckRowError('duplicate',_0x0d8b('0x26'),_0x4a99d3,_0x30980c));}}return db[_0x0d8b('0x27')]['create'](_0x3ef745,{'raw':!![],'hooks':![],'fields':_[_0x0d8b('0x28')](_0x3ef745)})[_0x0d8b('0x29')](function(_0x18a905){if(DUPLICATES&&DUPLICATES['length']&&_0x2c64e2){_0x2c64e2[_0x0d8b('0x2a')](_[_0x0d8b('0x2b')](_0x3ef745,DUPLICATES));}hopperContacts+=(hopperContacts?',':'')+_0x18a905['id'];return _0x4562cb();})[_0x0d8b('0x2c')](function(_0x31ceba){return _0x27b695(handleCheckRowError(_0x0d8b('0x18'),'Error\x20while\x20creating\x20contact:\x20'+(_0x31ceba[_0x0d8b('0x2d')]||JSON[_0x0d8b('0x2e')](_0x31ceba)),null,_0x30980c));});});}function checkHopper(){function _0x5ad0fe(){return function(_0x1180ac){logger[_0x0d8b('0x18')](_0x0d8b('0x2f'),_0x0d8b('0x30'),util[_0x0d8b('0x31')](_0x1180ac,{'showHidden':![],'depth':null}));};}var _0x519088=function(_0x497a71,_0x41b4f9){var _0x5c2c04=squel['insert']()[_0x0d8b('0x32')](_0x0d8b('0x33'))[_0x0d8b('0x34')]([_0x0d8b('0x1e'),_0x0d8b('0x35'),_0x0d8b('0x36'),'ListId',_0x41b4f9,_0x0d8b('0x37'),_0x0d8b('0x38')],squel[_0x0d8b('0x39')]()[_0x0d8b('0x3a')](_0x0d8b('0x1e'),_0x0d8b('0x1e'))[_0x0d8b('0x3a')]('NOW()',_0x0d8b('0x35'))[_0x0d8b('0x3a')]('id',_0x0d8b('0x36'))[_0x0d8b('0x3a')](LISTID['toString'](),_0x0d8b('0x3b'))['field'](_0x497a71['id'][_0x0d8b('0x3c')](),_0x41b4f9)[_0x0d8b('0x3a')](_0x0d8b('0x3d'),_0x0d8b('0x37'))[_0x0d8b('0x3a')](_0x0d8b('0x3d'),_0x0d8b('0x38'))[_0x0d8b('0x3e')](_0x0d8b('0x3f'))[_0x0d8b('0x40')]('deletedAt\x20IS\x20NULL')['where']('ListId\x20=\x20?',LISTID['toString']())['where'](_0x0d8b('0x41'))[_0x0d8b('0x40')](_0x0d8b('0x42'),squel['select']()['field'](_0x0d8b('0x1e'))[_0x0d8b('0x3e')](_0x0d8b('0x33'))['where'](_0x41b4f9+_0x0d8b('0x43'),_0x497a71['id'][_0x0d8b('0x3c')]())))['toString']();return _0x5c2c04;};var _0x4d7bb0=function(_0x372740,_0x495870){var _0x1e22e5=squel['insert']()['into'](_0x0d8b('0x33'))[_0x0d8b('0x34')](['phone','scheduledAt','ContactId','ListId',_0x495870,_0x0d8b('0x37'),_0x0d8b('0x38')],squel[_0x0d8b('0x39')]()['field'](_0x0d8b('0x1e'),_0x0d8b('0x1e'))[_0x0d8b('0x3a')](_0x0d8b('0x3d'),_0x0d8b('0x35'))[_0x0d8b('0x3a')]('id',_0x0d8b('0x36'))[_0x0d8b('0x3a')](LISTID[_0x0d8b('0x3c')](),_0x0d8b('0x3b'))[_0x0d8b('0x3a')](_0x372740['id'][_0x0d8b('0x3c')](),_0x495870)[_0x0d8b('0x3a')](_0x0d8b('0x3d'),_0x0d8b('0x37'))[_0x0d8b('0x3a')](_0x0d8b('0x3d'),_0x0d8b('0x38'))[_0x0d8b('0x3e')]('cm_contacts')[_0x0d8b('0x40')]('deletedAt\x20IS\x20NULL')['where'](_0x0d8b('0x44'),LISTID[_0x0d8b('0x3c')]())[_0x0d8b('0x40')](_0x0d8b('0x45'),squel['str'](hopperContacts))[_0x0d8b('0x40')](_0x0d8b('0x41'))[_0x0d8b('0x40')](_0x0d8b('0x42'),squel[_0x0d8b('0x39')]()['field']('calleridnum')['from']('cm_hopper_final')[_0x0d8b('0x40')](_0x495870+_0x0d8b('0x43'),_0x372740['id']['toString']()))['where'](_0x0d8b('0x42'),squel[_0x0d8b('0x39')]()['field']('phone')[_0x0d8b('0x3e')](_0x0d8b('0x33'))[_0x0d8b('0x40')](_0x495870+_0x0d8b('0x43'),_0x372740['id'][_0x0d8b('0x3c')]())))['toString']();return _0x1e22e5;};function _0x2de903(_0x2afe34,_0x5481fc){var _0x580580=squel[_0x0d8b('0x46')]()[_0x0d8b('0x32')]('cm_hopper')['fromQuery']([_0x0d8b('0x1e'),_0x0d8b('0x35'),_0x0d8b('0x36'),_0x0d8b('0x3b'),_0x5481fc,'createdAt',_0x0d8b('0x38')],squel['select']()['field'](_0x0d8b('0x1e'),_0x0d8b('0x1e'))['field']('NOW()',_0x0d8b('0x35'))[_0x0d8b('0x3a')]('id',_0x0d8b('0x36'))[_0x0d8b('0x3a')](LISTID[_0x0d8b('0x3c')](),_0x0d8b('0x3b'))[_0x0d8b('0x3a')](_0x2afe34['id'][_0x0d8b('0x3c')](),_0x5481fc)['field'](_0x0d8b('0x3d'),_0x0d8b('0x37'))[_0x0d8b('0x3a')](_0x0d8b('0x3d'),_0x0d8b('0x38'))[_0x0d8b('0x3e')](_0x0d8b('0x3f'))[_0x0d8b('0x40')](_0x0d8b('0x47'))['where'](_0x0d8b('0x44'),LISTID[_0x0d8b('0x3c')]())[_0x0d8b('0x40')](_0x0d8b('0x45'),squel[_0x0d8b('0x48')](hopperContacts))['where'](_0x0d8b('0x41')))[_0x0d8b('0x3c')]();return _0x580580;}function _0x181d49(_0x17a87f,_0x1d6cd4){var _0x59ada2=squel['insert']()[_0x0d8b('0x32')](_0x0d8b('0x49'))[_0x0d8b('0x34')]([_0x0d8b('0x1e'),'ContactId',_0x0d8b('0x3b'),_0x1d6cd4,_0x0d8b('0x37'),_0x0d8b('0x38')],squel['select']()[_0x0d8b('0x3a')]('phone',_0x0d8b('0x1e'))[_0x0d8b('0x3a')]('id',_0x0d8b('0x36'))[_0x0d8b('0x3a')](LISTID[_0x0d8b('0x3c')](),_0x0d8b('0x3b'))['field'](_0x17a87f['id'][_0x0d8b('0x3c')](),_0x1d6cd4)['field'](_0x0d8b('0x3d'),_0x0d8b('0x37'))[_0x0d8b('0x3a')](_0x0d8b('0x3d'),'updatedAt')[_0x0d8b('0x3e')](_0x0d8b('0x3f'))[_0x0d8b('0x40')](_0x0d8b('0x47'))[_0x0d8b('0x40')](_0x0d8b('0x44'),LISTID[_0x0d8b('0x3c')]())[_0x0d8b('0x40')](_0x0d8b('0x45'),squel[_0x0d8b('0x48')](hopperContacts))['where']('phone\x20IS\x20NOT\x20NULL'))[_0x0d8b('0x3c')]();return _0x59ada2;}return db[_0x0d8b('0x4a')]['findAll']({'where':{'type':_0x0d8b('0x4b')},'attributes':['id','dialCheckDuplicateType'],'include':[{'model':db['CmList'],'as':_0x0d8b('0x4c'),'where':{'id':LISTID}}]})[_0x0d8b('0x29')](function(_0x4f4b4d){var _0x587128=[];if(_0x4f4b4d){var _0x1900e3;for(var _0x1c007b=0x0,_0x70e4b2;_0x1c007b<_0x4f4b4d[_0x0d8b('0x24')];_0x1c007b+=0x1){_0x70e4b2=_0x4f4b4d[_0x1c007b][_0x0d8b('0x4d')]({'plain':!![]});switch(_0x70e4b2[_0x0d8b('0x4e')]){case _0x0d8b('0x4f'):_0x587128['push'](db[_0x0d8b('0x50')]['query'](_0x4d7bb0(_0x70e4b2,_0x0d8b('0x51')))[_0x0d8b('0x29')](function(){})[_0x0d8b('0x2c')](_0x5ad0fe()));break;case _0x0d8b('0x52'):_0x587128['push'](db[_0x0d8b('0x50')]['query'](_0x519088(_0x70e4b2,_0x0d8b('0x51')))[_0x0d8b('0x29')](function(){})[_0x0d8b('0x2c')](_0x5ad0fe()));break;default:_0x587128[_0x0d8b('0x2a')](db[_0x0d8b('0x50')][_0x0d8b('0x53')](_0x2de903(_0x70e4b2,_0x0d8b('0x51')))[_0x0d8b('0x29')](function(){})[_0x0d8b('0x2c')](_0x5ad0fe()));}}}return _0x587128;})[_0x0d8b('0x54')]()['then'](function(){return db[_0x0d8b('0x4a')]['findAll']({'where':{'type':_0x0d8b('0x4b')},'attributes':['id'],'include':[{'model':db[_0x0d8b('0x55')],'as':'BlackLists','where':{'id':LISTID}}]})[_0x0d8b('0x29')](function(_0x56e03c){var _0x10c318=[];if(_0x56e03c){var _0x445a00;for(var _0x24f75=0x0,_0x259ac9;_0x24f75<_0x56e03c[_0x0d8b('0x24')];_0x24f75+=0x1){_0x259ac9=_0x56e03c[_0x24f75][_0x0d8b('0x4d')]({'plain':!![]});_0x10c318[_0x0d8b('0x2a')](db[_0x0d8b('0x50')]['query'](_0x181d49(_0x259ac9,_0x0d8b('0x51')))[_0x0d8b('0x29')](function(){})['catch'](_0x5ad0fe()));}}return _0x10c318;})[_0x0d8b('0x54')]();})[_0x0d8b('0x29')](function(){return db[_0x0d8b('0x56')][_0x0d8b('0x57')]({'attributes':['id',_0x0d8b('0x4e')],'include':[{'model':db[_0x0d8b('0x55')],'as':_0x0d8b('0x4c'),'where':{'id':LISTID}}]})[_0x0d8b('0x29')](function(_0x466082){var _0x5007c0=[];if(_0x466082){for(var _0xe35028=0x0,_0x16df83;_0xe35028<_0x466082['length'];_0xe35028+=0x1){_0x16df83=_0x466082[_0xe35028][_0x0d8b('0x4d')]({'plain':!![]});switch(_0x16df83[_0x0d8b('0x4e')]){case _0x0d8b('0x4f'):_0x5007c0['push'](db['sequelize'][_0x0d8b('0x53')](_0x4d7bb0(_0x16df83,_0x0d8b('0x58')))[_0x0d8b('0x29')](function(){})['catch'](_0x5ad0fe()));break;case'onlyIfOpen':_0x5007c0[_0x0d8b('0x2a')](db[_0x0d8b('0x50')][_0x0d8b('0x53')](_0x519088(_0x16df83,_0x0d8b('0x58')))[_0x0d8b('0x29')](function(){})[_0x0d8b('0x2c')](_0x5ad0fe()));break;default:_0x5007c0[_0x0d8b('0x2a')](db[_0x0d8b('0x50')][_0x0d8b('0x53')](_0x2de903(_0x16df83,_0x0d8b('0x58')))[_0x0d8b('0x29')](function(){})[_0x0d8b('0x2c')](_0x5ad0fe()));}}}return _0x5007c0;})[_0x0d8b('0x54')]();})['then'](function(){return db[_0x0d8b('0x56')][_0x0d8b('0x57')]({'attributes':['id'],'include':[{'model':db['CmList'],'as':'BlackLists','where':{'id':LISTID}}]})[_0x0d8b('0x29')](function(_0x1dad9f){var _0x3573b4=[];if(_0x1dad9f){for(var _0x14b1b8=0x0,_0x23e2e0;_0x14b1b8<_0x1dad9f[_0x0d8b('0x24')];_0x14b1b8+=0x1){_0x23e2e0=_0x1dad9f[_0x14b1b8]['get']({'plain':!![]});_0x3573b4['push'](db['sequelize'][_0x0d8b('0x53')](_0x181d49(_0x23e2e0,_0x0d8b('0x58')))[_0x0d8b('0x29')](function(){})[_0x0d8b('0x2c')](_0x5ad0fe()));}}return _0x3573b4;})[_0x0d8b('0x54')]();})[_0x0d8b('0x2c')](function(_0x5ef461){logger[_0x0d8b('0x18')](_0x0d8b('0x59'),'generalCheckHopper',_0x5ef461[_0x0d8b('0x2d')]);});}var processPromises=function(_0x57e3c2){return BPromise[_0x0d8b('0x54')](promises)[_0x0d8b('0x29')](function(_0x9dfa5a){})[_0x0d8b('0x2c')](function(_0x10c7ab){logger[_0x0d8b('0x18')](_0x0d8b('0x5a'),JSON[_0x0d8b('0x2e')](_0x10c7ab));})[_0x0d8b('0x5b')](function(){socket[_0x0d8b('0x5c')](_0x0d8b('0x5d')+SOCKET_TIMESTAMP,{'success':success,'errors':errors,'duplicates':duplicates,'rows':rows});promises=[];success=0x0;errors=0x0;duplicates=0x0;rows=[];if(_0x57e3c2){return _0x57e3c2[_0x0d8b('0x5e')]();}});};var endCsv=function(){return BPromise['resolve']()['then'](function(){if(hopperContacts){return checkHopper();}})[_0x0d8b('0x29')](function(){socket[_0x0d8b('0x5c')](_0x0d8b('0x5d')+SOCKET_TIMESTAMP,{'finished':!![],'success':success,'errors':errors,'duplicates':duplicates,'rows':rows});try{fs[_0x0d8b('0x5f')](FILEPATH);}catch(_0xf91ecd){logger[_0x0d8b('0x18')](_0x0d8b('0x60'),JSON['stringify'](_0xf91ecd));}finally{process[_0x0d8b('0x61')](0x0);}});};process['on']('SIGINT',function(){logger[_0x0d8b('0x62')]('CSV\x20import\x20process\x20stopped!');endCsv();});function main(){return BPromise['resolve']()[_0x0d8b('0x29')](function(){if(DUPLICATES){DUPLICATES=DUPLICATES[_0x0d8b('0x12')](',');return db[_0x0d8b('0x27')][_0x0d8b('0x57')]({'where':{'ListId':LISTID},'attributes':DUPLICATES,'raw':!![]});}})[_0x0d8b('0x29')](function(_0x2eece2){var _0x3c7b9b=fs[_0x0d8b('0x63')](FILEPATH,{'highWaterMark':0xf*0x400*0x400});Papa[_0x0d8b('0x64')](_0x3c7b9b,{'header':!![],'skipEmptyLines':!![],'step':function(_0x20a8b6,_0x3a6014){total+=0x1;var _0x180539=total;promises['push'](checkRow(_0x20a8b6,_0x2eece2,_0x180539)[_0x0d8b('0x29')](function(){success+=0x1;})[_0x0d8b('0x2c')](function(_0x8be77c){if(_0x8be77c['error']){errors+=0x1;delete _0x8be77c['error'];}else if(_0x8be77c[_0x0d8b('0x65')]){duplicates+=0x1;delete _0x8be77c[_0x0d8b('0x65')];}rows[_0x0d8b('0x2a')](_0x8be77c);}));if(total%0xc8===0x0){_0x3a6014[_0x0d8b('0x66')]();return processPromises(_0x3a6014);}},'complete':function(){return processPromises()[_0x0d8b('0x29')](function(){logger[_0x0d8b('0x62')]('CSV\x20parsed\x20correctly!');endCsv();});},'error':function(_0x1a96ce,_0x3d6267){logger[_0x0d8b('0x62')](_0x0d8b('0x67'),JSON[_0x0d8b('0x2e')](_0x1a96ce));endCsv();}});})['catch'](function(_0x4dbcfc){logger[_0x0d8b('0x18')](_0x0d8b('0x68'),JSON[_0x0d8b('0x2e')](_0x4dbcfc));});}main(); \ No newline at end of file +var _0xb7e7=['birthDate','YYYY-MM-DD','isValid','email','email\x20format\x20is\x20not\x20valid!','ListId','CompanyId','find','Duplicate\x20Contact','CmContact','create','then','push','pick','catch','Error\x20while\x20creating\x20contact:\x20','message','stringify','cmContact','checkHopper','insert','into','cm_hopper','fromQuery','scheduledAt','createdAt','updatedAt','select','field','toString','NOW()','from','deletedAt\x20IS\x20NULL','ListId\x20=\x20?','phone\x20IS\x20NOT\x20NULL','phone\x20NOT\x20IN\x20(?)','\x20=\x20?','ContactId','cm_contacts','where','str','id\x20IN\x20?','cm_hopper_black','VoiceQueue','findAll','outbound','dialCheckDuplicateType','CmList','Lists','get','always','query','VoiceQueueId','onlyIfOpen','sequelize','all','BlackLists','Campaign','CampaignId','cmContact,\x20%s,\x20%s','generalCheckHopper','Error\x20processing\x20rows\x20block:','finally','emit','contact:csv_','resolve','unlinkSync','Unable\x20to\x20delete\x20temp\x20file:','SIGINT','createReadStream','parse','duplicate','pause','info','CSV\x20parsed\x20correctly!','CSV\x20parse\x20error','Error\x20executing\x20contact\x20csv\x20import:','bluebird','lodash','papaparse','../../../mysqldb','../../../config/logger','api','redis','localhost','socket.io-emitter','register','argv','undefined','null','Missing\x20filepath\x20parameter!','Missing\x20binding\x20parameters!','zipObject','split','error','contact','index','test','isNil','errors','length','map','join','data','phone','phone\x20not\x20specified!'];(function(_0x4a9fb1,_0x273043){var _0x348672=function(_0x142b69){while(--_0x142b69){_0x4a9fb1['push'](_0x4a9fb1['shift']());}};_0x348672(++_0x273043);}(_0xb7e7,0x121));var _0x7b7e=function(_0x186376,_0x5d988a){_0x186376=_0x186376-0x0;var _0x2dbdd9=_0xb7e7[_0x186376];return _0x2dbdd9;};'use strict';var BPromise=require(_0x7b7e('0x0'));var util=require('util');var _=require(_0x7b7e('0x1'));var fs=require('fs');var squel=require('squel');var Papa=require(_0x7b7e('0x2'));var Redis=require('ioredis');var db=require(_0x7b7e('0x3'))['db'];var config=require('../../../config/environment');var logger=require(_0x7b7e('0x4'))(_0x7b7e('0x5'));config[_0x7b7e('0x6')]=_['defaults'](config['redis'],{'host':_0x7b7e('0x7'),'port':0x18eb});var socket=require(_0x7b7e('0x8'))(new Redis(config[_0x7b7e('0x6')]));require('../../../api/cmContact/cmContact.socket')[_0x7b7e('0x9')](socket);try{if(!process[_0x7b7e('0xa')][0x2]||process[_0x7b7e('0xa')][0x2]===_0x7b7e('0xb')||process[_0x7b7e('0xa')][0x2]===_0x7b7e('0xc')){throw new Error(_0x7b7e('0xd'));}var FILEPATH=process['argv'][0x2];if(!process[_0x7b7e('0xa')][0x3]||process[_0x7b7e('0xa')][0x3]===_0x7b7e('0xb')||process[_0x7b7e('0xa')][0x3]===_0x7b7e('0xc')||!process[_0x7b7e('0xa')][0x4]||process[_0x7b7e('0xa')][0x4]===_0x7b7e('0xb')||process[_0x7b7e('0xa')][0x4]==='null'){throw new Error(_0x7b7e('0xe'));}var FIELDS=_[_0x7b7e('0xf')](process['argv'][0x3][_0x7b7e('0x10')](','),process['argv'][0x4]['split'](','));if(!process[_0x7b7e('0xa')][0x5]||process[_0x7b7e('0xa')][0x5]===_0x7b7e('0xb')||process[_0x7b7e('0xa')][0x5]===_0x7b7e('0xc')){throw new Error('Missing\x20ListId\x20parameter!');}var LISTID=process['argv'][0x5];var COMPANYID=process[_0x7b7e('0xa')][0x6]&&process[_0x7b7e('0xa')][0x6]!==_0x7b7e('0xb')&&process[_0x7b7e('0xa')][0x6]!==_0x7b7e('0xc')?process[_0x7b7e('0xa')][0x6]:null;var DUPLICATES=process[_0x7b7e('0xa')][0x7]&&process[_0x7b7e('0xa')][0x7]!==_0x7b7e('0xb')&&process[_0x7b7e('0xa')][0x7]!==_0x7b7e('0xc')?process[_0x7b7e('0xa')][0x7]:null;if(!process[_0x7b7e('0xa')][0x8]||process[_0x7b7e('0xa')][0x8]===_0x7b7e('0xb')||process[_0x7b7e('0xa')][0x8]===_0x7b7e('0xc')){throw new Error('Missing\x20socket_timestamp\x20parameter!');}var SOCKET_TIMESTAMP=process[_0x7b7e('0xa')][0x8];}catch(_0x43db4f){logger[_0x7b7e('0x11')](_0x43db4f);endCsv();}var total=0x0;var pTotal=0x0;var success=0x0;var errors=0x0;var duplicates=0x0;var rows=[];var hopperContacts='';var promises=[];var index=0x0;var alreadyInvalid=![];function handleCheckRowError(_0x4c0647,_0x313122,_0xbf0cb3,_0x14243b){var _0x200156={'message':_0x313122};_0x200156[_0x4c0647]=!![];if(_0xbf0cb3){_0x200156[_0x7b7e('0x12')]=_0xbf0cb3;}if(_0x14243b){_0x200156[_0x7b7e('0x13')]=_0x14243b;}return _0x200156;}function isEmail(_0x28bf43){return/^([^\x00-\x20\x22\x28\x29\x2c\x2e\x3a-\x3c\x3e\x40\x5b-\x5d\x7f-\xff]+|\x22([^\x0d\x22\x5c\x80-\xff]|\x5c[\x00-\x7f])*\x22)(\x2e([^\x00-\x20\x22\x28\x29\x2c\x2e\x3a-\x3c\x3e\x40\x5b-\x5d\x7f-\xff]+|\x22([^\x0d\x22\x5c\x80-\xff]|\x5c[\x00-\x7f])*\x22))*\x40([^\x00-\x20\x22\x28\x29\x2c\x2e\x3a-\x3c\x3e\x40\x5b-\x5d\x7f-\xff]+|\x5b([^\x0d\x5b-\x5d\x80-\xff]|\x5c[\x00-\x7f])*\x5d)(\x2e([^\x00-\x20\x22\x28\x29\x2c\x2e\x3a-\x3c\x3e\x40\x5b-\x5d\x7f-\xff]+|\x5b([^\x0d\x5b-\x5d\x80-\xff]|\x5c[\x00-\x7f])*\x5d))*$/[_0x7b7e('0x14')](_0x28bf43);}function checkRow(_0x53bbb3,_0x5d6215,_0x4a836a){return new BPromise(function(_0x26ee14,_0x22598e){if(_[_0x7b7e('0x15')](_0x53bbb3)){return _0x22598e(handleCheckRowError('error','The\x20row\x20is\x20empty\x20or\x20the\x20number\x20of\x20parameters\x20does\x20not\x20match\x20the\x20columns!',null,_0x4a836a));}if(_0x53bbb3['errors']&&_0x53bbb3[_0x7b7e('0x16')][_0x7b7e('0x17')]){var _0x16a3c7=_[_0x7b7e('0x18')](_0x53bbb3[_0x7b7e('0x16')],'message')[_0x7b7e('0x19')](';');return _0x22598e(handleCheckRowError(_0x7b7e('0x11'),_0x16a3c7,null,_0x4a836a));}var _0x4c46b8={};for(var _0x57b9da in FIELDS){if(FIELDS['hasOwnProperty'](_0x57b9da)&&FIELDS[_0x57b9da]){_0x4c46b8[_0x57b9da]=_0x53bbb3[_0x7b7e('0x1a')][0x0][FIELDS[_0x57b9da]]||_0x53bbb3[_0x7b7e('0x1a')][0x0]['\ufeff'+FIELDS[_0x57b9da]];}}if(!_0x4c46b8['firstName']){return _0x22598e(handleCheckRowError(_0x7b7e('0x11'),'firstName\x20not\x20specified!',null,_0x4a836a));}if(!_0x4c46b8[_0x7b7e('0x1b')]){return _0x22598e(handleCheckRowError(_0x7b7e('0x11'),_0x7b7e('0x1c'),null,_0x4a836a));}if(_0x4c46b8['birthDate']){var _0x3960b8=moment(_0x4c46b8[_0x7b7e('0x1d')],_0x7b7e('0x1e'));if(!_0x3960b8[_0x7b7e('0x1f')]()){return _0x22598e(handleCheckRowError(_0x7b7e('0x11'),'birthDate\x20format\x20is\x20invalid,\x20YYYY-MM-DD\x20format\x20is\x20supported!',null,_0x4a836a));}}if(_0x4c46b8[_0x7b7e('0x20')]){if(!isEmail(_0x4c46b8['email'])){return _0x22598e(handleCheckRowError(_0x7b7e('0x11'),_0x7b7e('0x21'),null,_0x4a836a));}}_0x4c46b8[_0x7b7e('0x22')]=LISTID;_0x4c46b8[_0x7b7e('0x23')]=COMPANYID||undefined;if(DUPLICATES&&DUPLICATES[_0x7b7e('0x17')]&&_0x5d6215){var _0x247ea0={};for(var _0x29cb58=0x0,_0x4bfe7f=DUPLICATES['length'];_0x29cb58<_0x4bfe7f;_0x29cb58+=0x1){_0x247ea0[DUPLICATES[_0x29cb58]]=_0x4c46b8[DUPLICATES[_0x29cb58]];}var _0xebcdbc=_[_0x7b7e('0x24')](_0x5d6215,_0x247ea0);if(_0xebcdbc){return _0x22598e(handleCheckRowError('duplicate',_0x7b7e('0x25'),_0xebcdbc,_0x4a836a));}}return db[_0x7b7e('0x26')][_0x7b7e('0x27')](_0x4c46b8,{'raw':!![],'hooks':![],'fields':_['keys'](_0x4c46b8)})[_0x7b7e('0x28')](function(_0x256908){if(DUPLICATES&&DUPLICATES[_0x7b7e('0x17')]&&_0x5d6215){_0x5d6215[_0x7b7e('0x29')](_[_0x7b7e('0x2a')](_0x4c46b8,DUPLICATES));}hopperContacts+=(hopperContacts?',':'')+_0x256908['id'];return _0x26ee14();})[_0x7b7e('0x2b')](function(_0x3e8cf4){return _0x22598e(handleCheckRowError(_0x7b7e('0x11'),_0x7b7e('0x2c')+(_0x3e8cf4[_0x7b7e('0x2d')]||JSON[_0x7b7e('0x2e')](_0x3e8cf4)),null,_0x4a836a));});});}function checkHopper(){function _0x2d0620(){return function(_0x442366){logger[_0x7b7e('0x11')](_0x7b7e('0x2f'),_0x7b7e('0x30'),util['inspect'](_0x442366,{'showHidden':![],'depth':null}));};}var _0x8c80d5=function(_0x156dca,_0xb20532){var _0x242609=squel[_0x7b7e('0x31')]()[_0x7b7e('0x32')](_0x7b7e('0x33'))[_0x7b7e('0x34')]([_0x7b7e('0x1b'),_0x7b7e('0x35'),'ContactId',_0x7b7e('0x22'),_0xb20532,_0x7b7e('0x36'),_0x7b7e('0x37')],squel[_0x7b7e('0x38')]()['field'](_0x7b7e('0x1b'),_0x7b7e('0x1b'))[_0x7b7e('0x39')]('NOW()','scheduledAt')[_0x7b7e('0x39')]('id','ContactId')[_0x7b7e('0x39')](LISTID[_0x7b7e('0x3a')](),'ListId')[_0x7b7e('0x39')](_0x156dca['id'][_0x7b7e('0x3a')](),_0xb20532)[_0x7b7e('0x39')](_0x7b7e('0x3b'),_0x7b7e('0x36'))[_0x7b7e('0x39')](_0x7b7e('0x3b'),_0x7b7e('0x37'))[_0x7b7e('0x3c')]('cm_contacts')['where'](_0x7b7e('0x3d'))['where'](_0x7b7e('0x3e'),LISTID['toString']())['where'](_0x7b7e('0x3f'))['where'](_0x7b7e('0x40'),squel['select']()[_0x7b7e('0x39')](_0x7b7e('0x1b'))[_0x7b7e('0x3c')](_0x7b7e('0x33'))['where'](_0xb20532+_0x7b7e('0x41'),_0x156dca['id'][_0x7b7e('0x3a')]())))[_0x7b7e('0x3a')]();return _0x242609;};var _0x37895a=function(_0x3e4f21,_0xccdfc7){var _0x5e8572=squel['insert']()['into'](_0x7b7e('0x33'))[_0x7b7e('0x34')]([_0x7b7e('0x1b'),_0x7b7e('0x35'),_0x7b7e('0x42'),_0x7b7e('0x22'),_0xccdfc7,'createdAt',_0x7b7e('0x37')],squel[_0x7b7e('0x38')]()['field']('phone',_0x7b7e('0x1b'))[_0x7b7e('0x39')](_0x7b7e('0x3b'),_0x7b7e('0x35'))[_0x7b7e('0x39')]('id',_0x7b7e('0x42'))['field'](LISTID[_0x7b7e('0x3a')](),'ListId')[_0x7b7e('0x39')](_0x3e4f21['id'][_0x7b7e('0x3a')](),_0xccdfc7)[_0x7b7e('0x39')](_0x7b7e('0x3b'),'createdAt')[_0x7b7e('0x39')](_0x7b7e('0x3b'),_0x7b7e('0x37'))[_0x7b7e('0x3c')](_0x7b7e('0x43'))['where'](_0x7b7e('0x3d'))[_0x7b7e('0x44')](_0x7b7e('0x3e'),LISTID[_0x7b7e('0x3a')]())[_0x7b7e('0x44')]('id\x20IN\x20?',squel[_0x7b7e('0x45')](hopperContacts))[_0x7b7e('0x44')](_0x7b7e('0x3f'))[_0x7b7e('0x44')](_0x7b7e('0x40'),squel[_0x7b7e('0x38')]()[_0x7b7e('0x39')]('calleridnum')[_0x7b7e('0x3c')]('cm_hopper_final')[_0x7b7e('0x44')](_0xccdfc7+_0x7b7e('0x41'),_0x3e4f21['id']['toString']()))[_0x7b7e('0x44')](_0x7b7e('0x40'),squel[_0x7b7e('0x38')]()[_0x7b7e('0x39')](_0x7b7e('0x1b'))[_0x7b7e('0x3c')](_0x7b7e('0x33'))['where'](_0xccdfc7+_0x7b7e('0x41'),_0x3e4f21['id'][_0x7b7e('0x3a')]())))[_0x7b7e('0x3a')]();return _0x5e8572;};function _0x24481a(_0x5b9ab5,_0x527403){var _0x5bdf1d=squel[_0x7b7e('0x31')]()[_0x7b7e('0x32')](_0x7b7e('0x33'))['fromQuery'](['phone',_0x7b7e('0x35'),_0x7b7e('0x42'),'ListId',_0x527403,_0x7b7e('0x36'),_0x7b7e('0x37')],squel[_0x7b7e('0x38')]()['field'](_0x7b7e('0x1b'),_0x7b7e('0x1b'))['field'](_0x7b7e('0x3b'),_0x7b7e('0x35'))[_0x7b7e('0x39')]('id',_0x7b7e('0x42'))[_0x7b7e('0x39')](LISTID[_0x7b7e('0x3a')](),_0x7b7e('0x22'))[_0x7b7e('0x39')](_0x5b9ab5['id'][_0x7b7e('0x3a')](),_0x527403)['field'](_0x7b7e('0x3b'),_0x7b7e('0x36'))['field'](_0x7b7e('0x3b'),_0x7b7e('0x37'))[_0x7b7e('0x3c')]('cm_contacts')[_0x7b7e('0x44')]('deletedAt\x20IS\x20NULL')[_0x7b7e('0x44')](_0x7b7e('0x3e'),LISTID['toString']())[_0x7b7e('0x44')](_0x7b7e('0x46'),squel['str'](hopperContacts))[_0x7b7e('0x44')](_0x7b7e('0x3f')))[_0x7b7e('0x3a')]();return _0x5bdf1d;}function _0x3b1adb(_0x5eb32c,_0x101896){var _0x73904d=squel[_0x7b7e('0x31')]()[_0x7b7e('0x32')](_0x7b7e('0x47'))[_0x7b7e('0x34')]([_0x7b7e('0x1b'),_0x7b7e('0x42'),_0x7b7e('0x22'),_0x101896,_0x7b7e('0x36'),'updatedAt'],squel[_0x7b7e('0x38')]()['field']('phone',_0x7b7e('0x1b'))[_0x7b7e('0x39')]('id',_0x7b7e('0x42'))[_0x7b7e('0x39')](LISTID['toString'](),_0x7b7e('0x22'))[_0x7b7e('0x39')](_0x5eb32c['id'][_0x7b7e('0x3a')](),_0x101896)[_0x7b7e('0x39')](_0x7b7e('0x3b'),_0x7b7e('0x36'))['field'](_0x7b7e('0x3b'),'updatedAt')['from'](_0x7b7e('0x43'))['where'](_0x7b7e('0x3d'))['where'](_0x7b7e('0x3e'),LISTID[_0x7b7e('0x3a')]())['where'](_0x7b7e('0x46'),squel[_0x7b7e('0x45')](hopperContacts))['where'](_0x7b7e('0x3f')))[_0x7b7e('0x3a')]();return _0x73904d;}return db[_0x7b7e('0x48')][_0x7b7e('0x49')]({'where':{'type':_0x7b7e('0x4a')},'attributes':['id',_0x7b7e('0x4b')],'include':[{'model':db[_0x7b7e('0x4c')],'as':_0x7b7e('0x4d'),'where':{'id':LISTID}}]})[_0x7b7e('0x28')](function(_0x17e5ba){var _0x589b02=[];if(_0x17e5ba){var _0x59ecf9;for(var _0x34e7df=0x0,_0x46ac1f;_0x34e7df<_0x17e5ba[_0x7b7e('0x17')];_0x34e7df+=0x1){_0x46ac1f=_0x17e5ba[_0x34e7df][_0x7b7e('0x4e')]({'plain':!![]});switch(_0x46ac1f[_0x7b7e('0x4b')]){case _0x7b7e('0x4f'):_0x589b02[_0x7b7e('0x29')](db['sequelize'][_0x7b7e('0x50')](_0x37895a(_0x46ac1f,_0x7b7e('0x51')))['then'](function(){})[_0x7b7e('0x2b')](_0x2d0620()));break;case _0x7b7e('0x52'):_0x589b02[_0x7b7e('0x29')](db[_0x7b7e('0x53')][_0x7b7e('0x50')](_0x8c80d5(_0x46ac1f,_0x7b7e('0x51')))[_0x7b7e('0x28')](function(){})[_0x7b7e('0x2b')](_0x2d0620()));break;default:_0x589b02[_0x7b7e('0x29')](db[_0x7b7e('0x53')][_0x7b7e('0x50')](_0x24481a(_0x46ac1f,'VoiceQueueId'))[_0x7b7e('0x28')](function(){})[_0x7b7e('0x2b')](_0x2d0620()));}}}return _0x589b02;})[_0x7b7e('0x54')]()[_0x7b7e('0x28')](function(){return db[_0x7b7e('0x48')][_0x7b7e('0x49')]({'where':{'type':_0x7b7e('0x4a')},'attributes':['id'],'include':[{'model':db['CmList'],'as':_0x7b7e('0x55'),'where':{'id':LISTID}}]})[_0x7b7e('0x28')](function(_0x1eb5ce){var _0x49f0a4=[];if(_0x1eb5ce){var _0x1d6aa4;for(var _0x195ae2=0x0,_0x381ee6;_0x195ae2<_0x1eb5ce[_0x7b7e('0x17')];_0x195ae2+=0x1){_0x381ee6=_0x1eb5ce[_0x195ae2][_0x7b7e('0x4e')]({'plain':!![]});_0x49f0a4['push'](db['sequelize']['query'](_0x3b1adb(_0x381ee6,_0x7b7e('0x51')))[_0x7b7e('0x28')](function(){})[_0x7b7e('0x2b')](_0x2d0620()));}}return _0x49f0a4;})['all']();})[_0x7b7e('0x28')](function(){return db[_0x7b7e('0x56')][_0x7b7e('0x49')]({'attributes':['id','dialCheckDuplicateType'],'include':[{'model':db[_0x7b7e('0x4c')],'as':_0x7b7e('0x4d'),'where':{'id':LISTID}}]})[_0x7b7e('0x28')](function(_0x34a06c){var _0x538c5f=[];if(_0x34a06c){for(var _0x315923=0x0,_0x40b4ae;_0x315923<_0x34a06c[_0x7b7e('0x17')];_0x315923+=0x1){_0x40b4ae=_0x34a06c[_0x315923][_0x7b7e('0x4e')]({'plain':!![]});switch(_0x40b4ae['dialCheckDuplicateType']){case'always':_0x538c5f[_0x7b7e('0x29')](db['sequelize'][_0x7b7e('0x50')](_0x37895a(_0x40b4ae,_0x7b7e('0x57')))[_0x7b7e('0x28')](function(){})[_0x7b7e('0x2b')](_0x2d0620()));break;case'onlyIfOpen':_0x538c5f[_0x7b7e('0x29')](db[_0x7b7e('0x53')][_0x7b7e('0x50')](_0x8c80d5(_0x40b4ae,_0x7b7e('0x57')))[_0x7b7e('0x28')](function(){})[_0x7b7e('0x2b')](_0x2d0620()));break;default:_0x538c5f[_0x7b7e('0x29')](db[_0x7b7e('0x53')][_0x7b7e('0x50')](_0x24481a(_0x40b4ae,_0x7b7e('0x57')))[_0x7b7e('0x28')](function(){})[_0x7b7e('0x2b')](_0x2d0620()));}}}return _0x538c5f;})[_0x7b7e('0x54')]();})[_0x7b7e('0x28')](function(){return db[_0x7b7e('0x56')][_0x7b7e('0x49')]({'attributes':['id'],'include':[{'model':db['CmList'],'as':_0x7b7e('0x55'),'where':{'id':LISTID}}]})[_0x7b7e('0x28')](function(_0x1d9e08){var _0xa03d7a=[];if(_0x1d9e08){for(var _0x10c35e=0x0,_0x302462;_0x10c35e<_0x1d9e08[_0x7b7e('0x17')];_0x10c35e+=0x1){_0x302462=_0x1d9e08[_0x10c35e]['get']({'plain':!![]});_0xa03d7a[_0x7b7e('0x29')](db[_0x7b7e('0x53')][_0x7b7e('0x50')](_0x3b1adb(_0x302462,_0x7b7e('0x57')))[_0x7b7e('0x28')](function(){})['catch'](_0x2d0620()));}}return _0xa03d7a;})['all']();})[_0x7b7e('0x2b')](function(_0x110f2b){logger[_0x7b7e('0x11')](_0x7b7e('0x58'),_0x7b7e('0x59'),_0x110f2b[_0x7b7e('0x2d')]);});}var processPromises=function(_0x2c65b8){return BPromise[_0x7b7e('0x54')](promises)[_0x7b7e('0x28')](function(_0x850d0f){})['catch'](function(_0x27402a){logger[_0x7b7e('0x11')](_0x7b7e('0x5a'),JSON[_0x7b7e('0x2e')](_0x27402a));})[_0x7b7e('0x5b')](function(){socket[_0x7b7e('0x5c')](_0x7b7e('0x5d')+SOCKET_TIMESTAMP,{'success':success,'errors':errors,'duplicates':duplicates,'rows':rows});promises=[];success=0x0;errors=0x0;duplicates=0x0;rows=[];if(_0x2c65b8){return _0x2c65b8['resume']();}});};var endCsv=function(){return BPromise[_0x7b7e('0x5e')]()['then'](function(){if(hopperContacts){return checkHopper();}})[_0x7b7e('0x28')](function(){socket[_0x7b7e('0x5c')]('contact:csv_'+SOCKET_TIMESTAMP,{'finished':!![],'success':success,'errors':errors,'duplicates':duplicates,'rows':rows});try{fs[_0x7b7e('0x5f')](FILEPATH);}catch(_0x38fd40){logger[_0x7b7e('0x11')](_0x7b7e('0x60'),JSON[_0x7b7e('0x2e')](_0x38fd40));}finally{process['exit'](0x0);}});};process['on'](_0x7b7e('0x61'),function(){logger['info']('CSV\x20import\x20process\x20stopped!');endCsv();});function main(){return BPromise[_0x7b7e('0x5e')]()[_0x7b7e('0x28')](function(){if(DUPLICATES){DUPLICATES=DUPLICATES[_0x7b7e('0x10')](',');return db[_0x7b7e('0x26')]['findAll']({'where':{'ListId':LISTID},'attributes':DUPLICATES,'raw':!![]});}})[_0x7b7e('0x28')](function(_0x5cedd4){var _0x25233a=fs[_0x7b7e('0x62')](FILEPATH,{'highWaterMark':0xf*0x400*0x400});Papa[_0x7b7e('0x63')](_0x25233a,{'header':!![],'skipEmptyLines':!![],'step':function(_0x1e71ab,_0x11d615){total+=0x1;var _0x3afd15=total;promises[_0x7b7e('0x29')](checkRow(_0x1e71ab,_0x5cedd4,_0x3afd15)['then'](function(){success+=0x1;})[_0x7b7e('0x2b')](function(_0x30eeee){if(_0x30eeee['error']){errors+=0x1;delete _0x30eeee[_0x7b7e('0x11')];}else if(_0x30eeee[_0x7b7e('0x64')]){duplicates+=0x1;delete _0x30eeee[_0x7b7e('0x64')];}rows[_0x7b7e('0x29')](_0x30eeee);}));if(total%0xc8===0x0){_0x11d615[_0x7b7e('0x65')]();return processPromises(_0x11d615);}},'complete':function(){return processPromises()[_0x7b7e('0x28')](function(){logger[_0x7b7e('0x66')](_0x7b7e('0x67'));endCsv();});},'error':function(_0x41e2b5,_0x97232d){logger[_0x7b7e('0x66')](_0x7b7e('0x68'),JSON[_0x7b7e('0x2e')](_0x41e2b5));endCsv();}});})[_0x7b7e('0x2b')](function(_0x12d0cb){logger[_0x7b7e('0x11')](_0x7b7e('0x69'),JSON[_0x7b7e('0x2e')](_0x12d0cb));});}main(); \ No newline at end of file diff --git a/server/components/import/cm/csv2.js b/server/components/import/cm/csv2.js index 6e406b3..46355d6 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 _0x07cd=['cm_contacts_','\x20LIKE\x20cm_contacts;','LOAD\x20DATA\x20LOCAL\x20INFILE\x20\x27%s\x27\x20INTO\x20TABLE\x20%s\x20CHARACTER\x20SET\x20UTF8\x20FIELDS\x20TERMINATED\x20BY\x20\x27,\x27\x20ENCLOSED\x20BY\x20\x27\x22\x27\x20LINES\x20TERMINATED\x20BY\x20\x27\x0a\x27\x20IGNORE\x201\x20ROWS\x20(%s)\x20SET\x20id\x20=\x20NULL,\x20ListId\x20=\x20%s,\x20CompanyId\x20=\x20%s,\x20createdAt\x20=\x20\x27%s\x27,\x20updatedAt\x20=\x20\x27%s\x27','CompanyId',',\x20scheduledAt\x20=\x20NOW()','DROP\x20TABLE\x20','voice_queues_has_cm_lists','voice_queues','voice_queues_has_cm_blacklists','VoiceQueueId','campaigns','CampaignId','campaigns_has_cm_blacklists','each','then','finish','affectedRows','unlink','argv','arguments\x20\x20\x20','existsSync','file\x20doesn\x27t\x20exists','binding\x20doesn\x27t\x20exists','phone\x20is\x20mandatory','firstName\x20is\x20mandatory','ListId\x20is\x20mandatory','SIGINT','lodash','papaparse','util','bluebird','moment','squel','ioredis','../../../mysqldb','../../../config/logger','redis','localhost','socket.io-emitter','test','select','field','phone','from','.id\x20=\x20','\x20=\x20','where','join','cm_contacts.phone','cm_contacts.scheduledat','cm_contacts.ListId','cm_contacts.createdAt','cm_contacts.updatedAt','cm_contacts.priority','insert','fromQuery','scheduledat','ContactId','createdAt','updatedAt','priority','fields','cm_contacts','cm_contacts.ListId\x20=\x20','.CmListId','.CmListId\x20=\x20?','cm_contacts.createdAt\x20=\x20?','cm_contacts.phone\x20NOT\x20IN\x20(?)','cm_hopper','\x22onlyIfOpen\x22','\x22always\x22','toString','cm_contacts.id','into','cm_hopper_black','ListId','\x20=\x20?','concat','keys',')\x20NOT\x20IN\x20?','ListId\x20=\x20?','deletedAt\x20IS\x20NULL','id\x20IN\x20?','MIN(id)','min_id','group','Received\x20SIGINT','error','message','exit','errors','sequelize','query','push','catch','stringify','send','binding','root','server/files/tmp','info','header','writeFileSync','parse','createReadStream','data','length','hasOwnProperty','trim','replace','YYYY-MM-DD\x20HH:mm:ss','scheduledat\x20wrong\x20format\x20(YYYY-MM-DD\x20HH:mm:ss)','isNaN','UserId','isNumber','includes','agent\x20not\x20exists','email','YYYY-MM-DD','isValid','firstName','\x20not\x20specified','SystemRow','appendFileSync','rows','contact:import:','Abort\x20parser','abort','SystemError','step','duplicates'];(function(_0x3c4fb2,_0x29cca3){var _0x27c56b=function(_0x2ad590){while(--_0x2ad590){_0x3c4fb2['push'](_0x3c4fb2['shift']());}};_0x27c56b(++_0x29cca3);}(_0x07cd,0x1a4));var _0xd07c=function(_0x71e493,_0x4308b7){_0x71e493=_0x71e493-0x0;var _0x3d40ab=_0x07cd[_0x71e493];return _0x3d40ab;};'use strict';var fs=require('fs');var path=require('path');var _=require(_0xd07c('0x0'));var Papa=require(_0xd07c('0x1'));var util=require(_0xd07c('0x2'));var BPromise=require(_0xd07c('0x3'));var moment=require(_0xd07c('0x4'));var squel=require(_0xd07c('0x5'));var Redis=require(_0xd07c('0x6'));var db=require(_0xd07c('0x7'))['db'];var config=require('../../../config/environment');var logger=require(_0xd07c('0x8'))('import');config[_0xd07c('0x9')]=_['defaults'](config['redis'],{'host':_0xd07c('0xa'),'port':0x18eb});var socket=require(_0xd07c('0xb'))(new Redis(config[_0xd07c('0x9')]));var stats={'finish':![],'errors':[],'rows':0x0,'affectedRows':0x0};var results=[];var stopped=![];var NOW=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');function isEmail(_0x22e2b7){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))*$/[_0xd07c('0xc')](_0x22e2b7);}function selectNotIn(_0x1d1e05,_0x225483,_0x2392b1,_0x2d6aab,_0x45af73){return squel[_0xd07c('0xd')]()[_0xd07c('0xe')](_0xd07c('0xf'))[_0xd07c('0x10')](_0x2d6aab)['join'](_0x225483,null,_0x225483+_0xd07c('0x11')+_0x2d6aab+'.'+_0x2392b1)['where'](_0x2d6aab+'.'+_0x2392b1+_0xd07c('0x12')+_0x1d1e05+'.'+_0x2392b1)[_0xd07c('0x13')](_0x225483+'.dialCheckDuplicateType\x20IN\x20('+_0x45af73[_0xd07c('0x14')]()+')');}function insertCmHopper(_0x314859,_0x46388e,_0x518c8b,_0x51d26d,_0x374878){var _0x57111e=[_0xd07c('0x15'),_0xd07c('0x16'),'cm_contacts.id',_0xd07c('0x17'),_0x46388e+'.'+_0x51d26d,_0xd07c('0x18'),_0xd07c('0x19'),_0xd07c('0x1a'),'cm_contacts.UserId','\x22'+_0x374878+'\x22'];return squel[_0xd07c('0x1b')]()['into']('cm_hopper')[_0xd07c('0x1c')]([_0xd07c('0xf'),_0xd07c('0x1d'),_0xd07c('0x1e'),'ListId',_0x51d26d,_0xd07c('0x1f'),_0xd07c('0x20'),_0xd07c('0x21'),'UserId','recallme'],squel[_0xd07c('0xd')]()[_0xd07c('0x22')](_0x57111e)[_0xd07c('0x10')](_0x46388e)[_0xd07c('0x14')](_0xd07c('0x23'),null,_0xd07c('0x24')+_0x46388e+_0xd07c('0x25'))[_0xd07c('0x14')](_0x518c8b,null,_0x518c8b+_0xd07c('0x11')+_0x46388e+'.'+_0x51d26d)[_0xd07c('0x13')](_0x46388e+_0xd07c('0x26'),_0x314859)['where'](_0xd07c('0x27'),NOW)[_0xd07c('0x13')](_0xd07c('0x28'),selectNotIn(_0x46388e,_0x518c8b,_0x51d26d,_0xd07c('0x29'),['\x22always\x22',_0xd07c('0x2a')]))['where']('cm_contacts.phone\x20NOT\x20IN\x20(?)',selectNotIn(_0x46388e,_0x518c8b,_0x51d26d,_0xd07c('0x29'),[_0xd07c('0x2b')])))[_0xd07c('0x2c')]();}function insertCmHopperBlack(_0x5bb91c,_0x52900e,_0x29d62d,_0x8f5a3b){var _0x148ece=['cm_contacts.phone',_0xd07c('0x2d'),'cm_contacts.ListId',_0x52900e+'.'+_0x8f5a3b,'cm_contacts.createdAt',_0xd07c('0x19')];return squel[_0xd07c('0x1b')]()[_0xd07c('0x2e')](_0xd07c('0x2f'))[_0xd07c('0x1c')](['phone','ContactId',_0xd07c('0x30'),_0x8f5a3b,_0xd07c('0x1f'),_0xd07c('0x20')],squel[_0xd07c('0xd')]()[_0xd07c('0x22')](_0x148ece)[_0xd07c('0x10')](_0x52900e)['join'](_0xd07c('0x23'),null,'cm_contacts.ListId\x20=\x20'+_0x52900e+_0xd07c('0x25'))[_0xd07c('0x14')](_0x29d62d,null,_0x29d62d+_0xd07c('0x11')+_0x52900e+'.'+_0x8f5a3b)['where'](_0x52900e+'.CmListId\x20=\x20?',_0x5bb91c)['where'](_0xd07c('0x27'),NOW)[_0xd07c('0x13')](_0xd07c('0x28'),squel[_0xd07c('0xd')]()[_0xd07c('0xe')](_0xd07c('0xf'))[_0xd07c('0x10')](_0xd07c('0x2f'))[_0xd07c('0x13')]('ListId\x20=\x20?',_0x5bb91c)['where'](_0x8f5a3b+_0xd07c('0x31'),_0x52900e+'.'+_0x8f5a3b)))[_0xd07c('0x2c')]();}function insertCmContact(_0x20e60d,_0x88d96e,_0x520977,_0x415fb0){var _0x1359c7=_[_0xd07c('0x32')](_[_0xd07c('0x33')](_0x415fb0),[_0xd07c('0x30'),'CompanyId',_0xd07c('0x1f'),_0xd07c('0x20')]);return squel[_0xd07c('0x1b')]()['into'](_0xd07c('0x23'))[_0xd07c('0x1c')](_0x1359c7,squel['select']()[_0xd07c('0x22')](_0x1359c7)['from'](_0x88d96e)['where']('('+_0x520977[_0xd07c('0x14')](',')+_0xd07c('0x34'),squel[_0xd07c('0xd')]()[_0xd07c('0x22')](_0x520977)[_0xd07c('0x10')]('cm_contacts')[_0xd07c('0x13')](_0xd07c('0x35'),_0x20e60d)[_0xd07c('0x13')](_0xd07c('0x36')))[_0xd07c('0x13')](_0xd07c('0x37'),squel[_0xd07c('0xd')]()[_0xd07c('0xe')](_0xd07c('0x38'),_0xd07c('0x39'))[_0xd07c('0x10')](_0x88d96e)[_0xd07c('0x3a')](_0x520977[_0xd07c('0x14')](','))))[_0xd07c('0x2c')]();}function handleStop(){logger['info'](_0xd07c('0x3b'));stopped=!![];}function handleUncaughtException(_0x4191b2){logger[_0xd07c('0x3c')](_0x4191b2[_0xd07c('0x3d')]);process[_0xd07c('0x3e')](0x1);}function handleError(_0x503020,_0x227e84){stats[_0xd07c('0x3f')]['push']({'name':_0x227e84['code'],'message':_0x227e84[_0xd07c('0x3d')],'row':_0x503020});}function handleQuery(_0x326af3){logger['info'](_0x326af3);return db[_0xd07c('0x40')][_0xd07c('0x41')](_0x326af3)['spread'](function(_0x51bc66){results[_0xd07c('0x42')](_0x51bc66);})[_0xd07c('0x43')](function(_0x99b02f){logger['error'](_0x99b02f[_0xd07c('0x3d')]);});}function main(_0x4540e7,_0x487c46,_0x4a9727,_0x2ada2d){logger['info']('main',_0x4540e7,JSON[_0xd07c('0x44')](_0x487c46));process[_0xd07c('0x45')]('start');var _0x459a64=_0x487c46[_0xd07c('0x46')];var _0x4ebb38=_0x487c46['socket_timestamp'];var _0x21d788=path['join'](config[_0xd07c('0x47')],_0xd07c('0x48'),_0x4ebb38+'.csv');var _0x565514=_[_0xd07c('0x33')](_0x459a64)[_0xd07c('0x14')]();logger[_0xd07c('0x49')](_0xd07c('0x4a'),_0x565514);fs[_0xd07c('0x4b')](_0x21d788,_0x565514+'\x0a');Papa[_0xd07c('0x4c')](fs[_0xd07c('0x4d')](_0x4540e7),{'header':!![],'skipEmptyLines':!![],'step':function(_0x3fe4b5,_0x4145cd){try{for(var _0x2f739d=0x0,_0x10ec93=[];_0x2f739d<_0x3fe4b5[_0xd07c('0x4e')][_0xd07c('0x4f')];_0x2f739d++){stats['rows']+=0x1;if(_0x3fe4b5[_0xd07c('0x3f')][_0x2f739d]){handleError(_0x3fe4b5['data'][_0x2f739d],_0x3fe4b5[_0xd07c('0x3f')][_0x2f739d]);}else{var _0x52037e=[];for(var _0x95650b in _0x459a64){if(_0x459a64[_0xd07c('0x50')](_0x95650b)){if(_0x3fe4b5[_0xd07c('0x4e')][_0x2f739d][_0x459a64[_0x95650b]]){var _0x49f8af=_[_0xd07c('0x51')](_0x3fe4b5[_0xd07c('0x4e')][_0x2f739d][_0x459a64[_0x95650b]][_0xd07c('0x52')](/"/g,'\x27'));switch(_0x95650b){case _0xd07c('0x1d'):var _0x19ce3b=moment(_0x49f8af,_0xd07c('0x53'),!![]);if(_0x19ce3b['isValid']()){_0x10ec93['push']('\x22'+_0x49f8af+'\x22');}else{_0x52037e['push'](_0xd07c('0x54'));}break;case _0xd07c('0x21'):var _0x882741=parseInt(_0x49f8af);_0x49f8af=_[_0xd07c('0x55')](_0x882741)||_0x882741<0x0||_0x882741>0x4?_0x2ada2d?0x3:0x2:_0x882741;_0x10ec93[_0xd07c('0x42')]('\x22'+_0x49f8af+'\x22');break;case _0xd07c('0x56'):var _0x508e70=parseInt(_0x49f8af);if(_[_0xd07c('0x57')](_0x508e70)&&_[_0xd07c('0x58')](_0x4a9727,_0x508e70)){_0x10ec93[_0xd07c('0x42')]('\x22'+_0x508e70+'\x22');}else{_0x52037e[_0xd07c('0x42')](_0xd07c('0x59'));}break;case _0xd07c('0x5a'):if(isEmail(_0x49f8af)){_0x10ec93[_0xd07c('0x42')]('\x22'+_0x49f8af+'\x22');}else{_0x52037e[_0xd07c('0x42')]('email\x20wrong\x20format');}break;case'dateOfBirth':var _0x29fa20=moment(_0x49f8af,_0xd07c('0x5b'),!![]);if(_0x29fa20[_0xd07c('0x5c')]()){_0x10ec93[_0xd07c('0x42')]('\x22'+_0x49f8af+'\x22');}else{_0x52037e['push']('dateOfBirth\x20wrong\x20format\x20(YYYY-MM-DD)');}break;default:_0x10ec93[_0xd07c('0x42')]('\x22'+_0x49f8af+'\x22');}}else{switch(_0x95650b){case _0xd07c('0x5d'):case _0xd07c('0xf'):_0x52037e['push'](_0x95650b+_0xd07c('0x5e'));break;default:_0x10ec93['push']('\x22\x22');}}}}if(_0x52037e[_0xd07c('0x4f')]){handleError(_0x3fe4b5[_0xd07c('0x4e')][_0x2f739d],{'code':_0xd07c('0x5f'),'message':_0x52037e[_0xd07c('0x14')]()});}else{fs[_0xd07c('0x60')](_0x21d788,_0x10ec93[_0xd07c('0x14')]()+'\x0a');}_0x10ec93=[];}if(!(stats[_0xd07c('0x61')]%0xc8)){socket['emit'](_0xd07c('0x62')+_0x4ebb38,stats);stats[_0xd07c('0x3f')]=[];}}if(stopped){logger[_0xd07c('0x49')](_0xd07c('0x63'));_0x4145cd[_0xd07c('0x64')]();}}catch(_0x37e4f9){handleError(_0x3fe4b5[_0xd07c('0x4e')][_0x2f739d],{'code':_0xd07c('0x65'),'message':_0x37e4f9['message']});logger[_0xd07c('0x3c')](_0xd07c('0x66'),_0x37e4f9['message']);}},'complete':function(){try{var _0x3fd8fa=[];var _0x53c0e0='cm_contacts';if(_0x487c46[_0xd07c('0x67')]&&_0x487c46['duplicates'][_0xd07c('0x4f')]){_0x53c0e0=_0xd07c('0x68')+_0x4ebb38;_0x3fd8fa[_0xd07c('0x42')]('CREATE\x20TABLE\x20'+_0x53c0e0+_0xd07c('0x69'));}var _0x36f7ae=util['format'](_0xd07c('0x6a'),_0x21d788,_0x53c0e0,_0x565514,_0x487c46[_0xd07c('0x30')],_0x487c46[_0xd07c('0x6b')]||null,NOW,NOW);if(_['isNil'](_0x459a64[_0xd07c('0x1d')])){_0x36f7ae+=_0xd07c('0x6c');}_0x3fd8fa[_0xd07c('0x42')](_0x36f7ae);if(_0x487c46[_0xd07c('0x67')]&&_0x487c46[_0xd07c('0x67')][_0xd07c('0x4f')]){_0x3fd8fa[_0xd07c('0x42')](insertCmContact(_0x487c46[_0xd07c('0x30')],_0x53c0e0,_0x487c46[_0xd07c('0x67')],_0x459a64));_0x3fd8fa[_0xd07c('0x42')](_0xd07c('0x6d')+_0x53c0e0+';');}_0x3fd8fa['push'](insertCmHopper(_0x487c46['ListId'],_0xd07c('0x6e'),_0xd07c('0x6f'),'VoiceQueueId',_0x2ada2d));_0x3fd8fa[_0xd07c('0x42')](insertCmHopperBlack(_0x487c46[_0xd07c('0x30')],_0xd07c('0x70'),'voice_queues',_0xd07c('0x71')));_0x3fd8fa[_0xd07c('0x42')](insertCmHopper(_0x487c46[_0xd07c('0x30')],'campaigns_has_cm_lists',_0xd07c('0x72'),_0xd07c('0x73'),_0x2ada2d));_0x3fd8fa[_0xd07c('0x42')](insertCmHopperBlack(_0x487c46[_0xd07c('0x30')],_0xd07c('0x74'),'campaigns','CampaignId'));BPromise[_0xd07c('0x75')](_0x3fd8fa,handleQuery)[_0xd07c('0x76')](function(_0x276b54){stats[_0xd07c('0x77')]=!![];stats['affectedRows']=_0x487c46[_0xd07c('0x67')]&&_0x487c46[_0xd07c('0x67')][_0xd07c('0x4f')]?results[0x2][_0xd07c('0x78')]:results[0x0][_0xd07c('0x78')];socket['emit'](_0xd07c('0x62')+_0x4ebb38,stats);fs[_0xd07c('0x79')](_0x4540e7);fs[_0xd07c('0x79')](_0x21d788);process[_0xd07c('0x3e')](0x0);})[_0xd07c('0x43')](function(_0x5493e9){logger[_0xd07c('0x3c')](_0x5493e9[_0xd07c('0x3d')]);process['exit'](0x1);});}catch(_0x3d0595){logger[_0xd07c('0x3c')]('complete',_0x3d0595[_0xd07c('0x3d')]);process['exit'](0x1);}},'error':function(_0x2dea50,_0x5dde47,_0xa69d93,_0x181f9a){throw new Error(_0x181f9a);}});}function validate(){if(process[_0xd07c('0x7a')]&&process[_0xd07c('0x7a')][_0xd07c('0x4f')]<0x4){throw new Error(_0xd07c('0x7b'));}var _0x1c9fa1=path[_0xd07c('0x14')](config[_0xd07c('0x47')],_0xd07c('0x48'),process[_0xd07c('0x7a')][0x2]);if(!fs[_0xd07c('0x7c')](_0x1c9fa1)){throw new Error(_0xd07c('0x7d'));}var _0x4aa33a={};try{_0x4aa33a=JSON[_0xd07c('0x4c')](process['argv'][0x3]);if(!_0x4aa33a[_0xd07c('0x46')]){throw new Error(_0xd07c('0x7e'));}if(!_0x4aa33a[_0xd07c('0x46')]['phone']){throw new Error(_0xd07c('0x7f'));}if(!_0x4aa33a[_0xd07c('0x46')][_0xd07c('0x5d')]){throw new Error(_0xd07c('0x80'));}var _0x10da97=0x0;if(_0x4aa33a[_0xd07c('0x46')]['UserId']){_0x10da97=0x1;}if(!_0x4aa33a[_0xd07c('0x30')]){throw new Error(_0xd07c('0x81'));}}catch(_0x3fbcd4){throw new Error('body\x20id\x20mandatory');}var _0xb35a22=[];try{_0xb35a22=_['map'](JSON[_0xd07c('0x4c')](process[_0xd07c('0x7a')][0x4]),'id');}catch(_0x182f8a){logger[_0xd07c('0x49')]('No\x20agent\x20available');}main(_0x1c9fa1,_0x4aa33a,_0xb35a22,_0x10da97);}validate();process['on'](_0xd07c('0x82'),handleStop);process['on']('uncaughtException',handleUncaughtException); \ No newline at end of file +var _0x21ed=['socket_timestamp','.csv','header','writeFileSync','parse','createReadStream','data','rows','hasOwnProperty','trim','replace','scheduledat\x20wrong\x20format\x20(YYYY-MM-DD\x20HH:mm:ss)','isNumber','agent\x20not\x20exists','email','email\x20wrong\x20format','YYYY-MM-DD','isValid','firstName','\x20not\x20specified','length','SystemRow','appendFileSync','emit','contact:import:','abort','SystemError','step','cm_contacts_','CREATE\x20TABLE\x20','LOAD\x20DATA\x20LOCAL\x20INFILE\x20\x27%s\x27\x20INTO\x20TABLE\x20%s\x20CHARACTER\x20SET\x20UTF8\x20FIELDS\x20TERMINATED\x20BY\x20\x27,\x27\x20ENCLOSED\x20BY\x20\x27\x22\x27\x20LINES\x20TERMINATED\x20BY\x20\x27\x0a\x27\x20IGNORE\x201\x20ROWS\x20(%s)\x20SET\x20id\x20=\x20NULL,\x20ListId\x20=\x20%s,\x20CompanyId\x20=\x20%s,\x20createdAt\x20=\x20\x27%s\x27,\x20updatedAt\x20=\x20\x27%s\x27',',\x20scheduledAt\x20=\x20NOW()','duplicates','DROP\x20TABLE\x20','voice_queues_has_cm_lists','voice_queues','VoiceQueueId','campaigns_has_cm_lists','campaigns','CampaignId','campaigns_has_cm_blacklists','each','affectedRows','unlink','complete','argv','root','server/files/tmp','existsSync','firstName\x20is\x20mandatory','UserId','ListId\x20is\x20mandatory','body\x20id\x20mandatory','map','No\x20agent\x20available','SIGINT','uncaughtException','path','papaparse','util','bluebird','squel','ioredis','../../../mysqldb','../../../config/environment','redis','defaults','socket.io-emitter','format','YYYY-MM-DD\x20HH:mm:ss','test','select','field','phone','join','.id\x20=\x20','where','\x20=\x20','.dialCheckDuplicateType\x20IN\x20(','cm_contacts.phone','cm_contacts.scheduledat','cm_contacts.id','cm_contacts.ListId','cm_contacts.createdAt','cm_contacts.updatedAt','cm_contacts.priority','into','cm_hopper','fromQuery','scheduledat','ContactId','createdAt','updatedAt','priority','cm_contacts','cm_contacts.ListId\x20=\x20','.CmListId\x20=\x20?','cm_contacts.phone\x20NOT\x20IN\x20(?)','\x22always\x22','\x22onlyIfOpen\x22','insert','cm_hopper_black','ListId','from','cm_contacts.createdAt\x20=\x20?','ListId\x20=\x20?','\x20=\x20?','toString','concat','keys','CompanyId','fields',')\x20NOT\x20IN\x20?','id\x20IN\x20?','MIN(id)','min_id','group','info','error','message','exit','errors','code','sequelize','query','push','catch','main','send','start','binding'];(function(_0x3522d6,_0x280f99){var _0x16d5b8=function(_0x4eb67d){while(--_0x4eb67d){_0x3522d6['push'](_0x3522d6['shift']());}};_0x16d5b8(++_0x280f99);}(_0x21ed,0x13f));var _0xd21e=function(_0xaf68ee,_0x3a10de){_0xaf68ee=_0xaf68ee-0x0;var _0x1c5594=_0x21ed[_0xaf68ee];return _0x1c5594;};'use strict';var fs=require('fs');var path=require(_0xd21e('0x0'));var _=require('lodash');var Papa=require(_0xd21e('0x1'));var util=require(_0xd21e('0x2'));var BPromise=require(_0xd21e('0x3'));var moment=require('moment');var squel=require(_0xd21e('0x4'));var Redis=require(_0xd21e('0x5'));var db=require(_0xd21e('0x6'))['db'];var config=require(_0xd21e('0x7'));var logger=require('../../../config/logger')('import');config[_0xd21e('0x8')]=_[_0xd21e('0x9')](config[_0xd21e('0x8')],{'host':'localhost','port':0x18eb});var socket=require(_0xd21e('0xa'))(new Redis(config['redis']));var stats={'finish':![],'errors':[],'rows':0x0,'affectedRows':0x0};var results=[];var stopped=![];var NOW=moment()[_0xd21e('0xb')](_0xd21e('0xc'));function isEmail(_0x4520d4){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))*$/[_0xd21e('0xd')](_0x4520d4);}function selectNotIn(_0x46e6c4,_0x97ab61,_0xc20096,_0x203560,_0x1fefd1){return squel[_0xd21e('0xe')]()[_0xd21e('0xf')](_0xd21e('0x10'))['from'](_0x203560)[_0xd21e('0x11')](_0x97ab61,null,_0x97ab61+_0xd21e('0x12')+_0x203560+'.'+_0xc20096)[_0xd21e('0x13')](_0x203560+'.'+_0xc20096+_0xd21e('0x14')+_0x46e6c4+'.'+_0xc20096)[_0xd21e('0x13')](_0x97ab61+_0xd21e('0x15')+_0x1fefd1[_0xd21e('0x11')]()+')');}function insertCmHopper(_0x9ac948,_0x545125,_0x280011,_0x3da737,_0x1d1bac){var _0x29bba7=[_0xd21e('0x16'),_0xd21e('0x17'),_0xd21e('0x18'),_0xd21e('0x19'),_0x545125+'.'+_0x3da737,_0xd21e('0x1a'),_0xd21e('0x1b'),_0xd21e('0x1c'),'cm_contacts.UserId','\x22'+_0x1d1bac+'\x22'];return squel['insert']()[_0xd21e('0x1d')](_0xd21e('0x1e'))[_0xd21e('0x1f')]([_0xd21e('0x10'),_0xd21e('0x20'),_0xd21e('0x21'),'ListId',_0x3da737,_0xd21e('0x22'),_0xd21e('0x23'),_0xd21e('0x24'),'UserId','recallme'],squel[_0xd21e('0xe')]()['fields'](_0x29bba7)['from'](_0x545125)['join'](_0xd21e('0x25'),null,_0xd21e('0x26')+_0x545125+'.CmListId')['join'](_0x280011,null,_0x280011+'.id\x20=\x20'+_0x545125+'.'+_0x3da737)[_0xd21e('0x13')](_0x545125+_0xd21e('0x27'),_0x9ac948)[_0xd21e('0x13')]('cm_contacts.createdAt\x20=\x20?',NOW)[_0xd21e('0x13')](_0xd21e('0x28'),selectNotIn(_0x545125,_0x280011,_0x3da737,_0xd21e('0x1e'),[_0xd21e('0x29'),_0xd21e('0x2a')]))[_0xd21e('0x13')](_0xd21e('0x28'),selectNotIn(_0x545125,_0x280011,_0x3da737,_0xd21e('0x1e'),[_0xd21e('0x29')])))['toString']();}function insertCmHopperBlack(_0x254204,_0x20f04a,_0x4ed843,_0x457d86){var _0x10c5db=['cm_contacts.phone',_0xd21e('0x18'),_0xd21e('0x19'),_0x20f04a+'.'+_0x457d86,_0xd21e('0x1a'),_0xd21e('0x1b')];return squel[_0xd21e('0x2b')]()[_0xd21e('0x1d')](_0xd21e('0x2c'))[_0xd21e('0x1f')]([_0xd21e('0x10'),_0xd21e('0x21'),_0xd21e('0x2d'),_0x457d86,_0xd21e('0x22'),_0xd21e('0x23')],squel['select']()['fields'](_0x10c5db)[_0xd21e('0x2e')](_0x20f04a)[_0xd21e('0x11')](_0xd21e('0x25'),null,_0xd21e('0x26')+_0x20f04a+'.CmListId')[_0xd21e('0x11')](_0x4ed843,null,_0x4ed843+_0xd21e('0x12')+_0x20f04a+'.'+_0x457d86)[_0xd21e('0x13')](_0x20f04a+_0xd21e('0x27'),_0x254204)[_0xd21e('0x13')](_0xd21e('0x2f'),NOW)['where'](_0xd21e('0x28'),squel['select']()['field'](_0xd21e('0x10'))[_0xd21e('0x2e')](_0xd21e('0x2c'))['where'](_0xd21e('0x30'),_0x254204)['where'](_0x457d86+_0xd21e('0x31'),_0x20f04a+'.'+_0x457d86)))[_0xd21e('0x32')]();}function insertCmContact(_0xe4595e,_0x3d6974,_0x4dad8f,_0x4d4dfb){var _0x1b8c29=_[_0xd21e('0x33')](_[_0xd21e('0x34')](_0x4d4dfb),['ListId',_0xd21e('0x35'),'createdAt',_0xd21e('0x23')]);return squel[_0xd21e('0x2b')]()[_0xd21e('0x1d')](_0xd21e('0x25'))[_0xd21e('0x1f')](_0x1b8c29,squel['select']()[_0xd21e('0x36')](_0x1b8c29)[_0xd21e('0x2e')](_0x3d6974)[_0xd21e('0x13')]('('+_0x4dad8f[_0xd21e('0x11')](',')+_0xd21e('0x37'),squel[_0xd21e('0xe')]()[_0xd21e('0x36')](_0x4dad8f)[_0xd21e('0x2e')]('cm_contacts')[_0xd21e('0x13')]('ListId\x20=\x20?',_0xe4595e)['where']('deletedAt\x20IS\x20NULL'))['where'](_0xd21e('0x38'),squel[_0xd21e('0xe')]()['field'](_0xd21e('0x39'),_0xd21e('0x3a'))[_0xd21e('0x2e')](_0x3d6974)[_0xd21e('0x3b')](_0x4dad8f[_0xd21e('0x11')](','))))[_0xd21e('0x32')]();}function handleStop(){logger[_0xd21e('0x3c')]('Received\x20SIGINT');stopped=!![];}function handleUncaughtException(_0x50ccfa){logger[_0xd21e('0x3d')](_0x50ccfa[_0xd21e('0x3e')]);process[_0xd21e('0x3f')](0x1);}function handleError(_0x31ae99,_0x5af3ac){stats[_0xd21e('0x40')]['push']({'name':_0x5af3ac[_0xd21e('0x41')],'message':_0x5af3ac[_0xd21e('0x3e')],'row':_0x31ae99});}function handleQuery(_0x30d7e5){logger[_0xd21e('0x3c')](_0x30d7e5);return db[_0xd21e('0x42')][_0xd21e('0x43')](_0x30d7e5)['spread'](function(_0x341f91){results[_0xd21e('0x44')](_0x341f91);})[_0xd21e('0x45')](function(_0x2459be){logger[_0xd21e('0x3d')](_0x2459be[_0xd21e('0x3e')]);});}function main(_0x29af7f,_0x51b0bb,_0x14dab5,_0x45bfab){logger['info'](_0xd21e('0x46'),_0x29af7f,JSON['stringify'](_0x51b0bb));process[_0xd21e('0x47')](_0xd21e('0x48'));var _0x5c3b67=_0x51b0bb[_0xd21e('0x49')];var _0x410bc2=_0x51b0bb[_0xd21e('0x4a')];var _0x4c10bf=path[_0xd21e('0x11')](config['root'],'server/files/tmp',_0x410bc2+_0xd21e('0x4b'));var _0x5483a2=_['keys'](_0x5c3b67)[_0xd21e('0x11')]();logger[_0xd21e('0x3c')](_0xd21e('0x4c'),_0x5483a2);fs[_0xd21e('0x4d')](_0x4c10bf,_0x5483a2+'\x0a');Papa[_0xd21e('0x4e')](fs[_0xd21e('0x4f')](_0x29af7f),{'header':!![],'skipEmptyLines':!![],'step':function(_0x4feba,_0x5ecdb0){try{for(var _0x4caae2=0x0,_0x99952e=[];_0x4caae2<_0x4feba[_0xd21e('0x50')]['length'];_0x4caae2++){stats[_0xd21e('0x51')]+=0x1;if(_0x4feba[_0xd21e('0x40')][_0x4caae2]){handleError(_0x4feba['data'][_0x4caae2],_0x4feba[_0xd21e('0x40')][_0x4caae2]);}else{var _0x5a0da7=[];for(var _0x348c2d in _0x5c3b67){if(_0x5c3b67[_0xd21e('0x52')](_0x348c2d)){if(_0x4feba['data'][_0x4caae2][_0x5c3b67[_0x348c2d]]){var _0x4bc414=_[_0xd21e('0x53')](_0x4feba['data'][_0x4caae2][_0x5c3b67[_0x348c2d]][_0xd21e('0x54')](/"/g,'\x27'));switch(_0x348c2d){case'scheduledat':var _0x2e23bf=moment(_0x4bc414,_0xd21e('0xc'),!![]);if(_0x2e23bf['isValid']()){_0x99952e[_0xd21e('0x44')]('\x22'+_0x4bc414+'\x22');}else{_0x5a0da7['push'](_0xd21e('0x55'));}break;case _0xd21e('0x24'):var _0x4b34a8=parseInt(_0x4bc414);_0x4bc414=_['isNaN'](_0x4b34a8)||_0x4b34a8<0x0||_0x4b34a8>0x4?_0x45bfab?0x3:0x2:_0x4b34a8;_0x99952e[_0xd21e('0x44')]('\x22'+_0x4bc414+'\x22');break;case'UserId':var _0x182610=parseInt(_0x4bc414);if(_[_0xd21e('0x56')](_0x182610)&&_['includes'](_0x14dab5,_0x182610)){_0x99952e['push']('\x22'+_0x182610+'\x22');}else{_0x5a0da7[_0xd21e('0x44')](_0xd21e('0x57'));}break;case _0xd21e('0x58'):if(isEmail(_0x4bc414)){_0x99952e[_0xd21e('0x44')]('\x22'+_0x4bc414+'\x22');}else{_0x5a0da7[_0xd21e('0x44')](_0xd21e('0x59'));}break;case'dateOfBirth':var _0x9a0c36=moment(_0x4bc414,_0xd21e('0x5a'),!![]);if(_0x9a0c36[_0xd21e('0x5b')]()){_0x99952e[_0xd21e('0x44')]('\x22'+_0x4bc414+'\x22');}else{_0x5a0da7['push']('dateOfBirth\x20wrong\x20format\x20(YYYY-MM-DD)');}break;default:_0x99952e[_0xd21e('0x44')]('\x22'+_0x4bc414+'\x22');}}else{switch(_0x348c2d){case _0xd21e('0x5c'):case _0xd21e('0x10'):_0x5a0da7[_0xd21e('0x44')](_0x348c2d+_0xd21e('0x5d'));break;default:_0x99952e[_0xd21e('0x44')]('\x22\x22');}}}}if(_0x5a0da7[_0xd21e('0x5e')]){handleError(_0x4feba[_0xd21e('0x50')][_0x4caae2],{'code':_0xd21e('0x5f'),'message':_0x5a0da7[_0xd21e('0x11')]()});}else{fs[_0xd21e('0x60')](_0x4c10bf,_0x99952e['join']()+'\x0a');}_0x99952e=[];}if(!(stats[_0xd21e('0x51')]%0xc8)){socket[_0xd21e('0x61')](_0xd21e('0x62')+_0x410bc2,stats);stats['errors']=[];}}if(stopped){logger[_0xd21e('0x3c')]('Abort\x20parser');_0x5ecdb0[_0xd21e('0x63')]();}}catch(_0x1d0ccf){handleError(_0x4feba['data'][_0x4caae2],{'code':_0xd21e('0x64'),'message':_0x1d0ccf[_0xd21e('0x3e')]});logger[_0xd21e('0x3d')](_0xd21e('0x65'),_0x1d0ccf[_0xd21e('0x3e')]);}},'complete':function(){try{var _0x5097a5=[];var _0x42a3bd=_0xd21e('0x25');if(_0x51b0bb['duplicates']&&_0x51b0bb['duplicates'][_0xd21e('0x5e')]){_0x42a3bd=_0xd21e('0x66')+_0x410bc2;_0x5097a5[_0xd21e('0x44')](_0xd21e('0x67')+_0x42a3bd+'\x20LIKE\x20cm_contacts;');}var _0x841be2=util[_0xd21e('0xb')](_0xd21e('0x68'),_0x4c10bf,_0x42a3bd,_0x5483a2,_0x51b0bb[_0xd21e('0x2d')],_0x51b0bb['CompanyId']||null,NOW,NOW);if(_['isNil'](_0x5c3b67['scheduledat'])){_0x841be2+=_0xd21e('0x69');}_0x5097a5[_0xd21e('0x44')](_0x841be2);if(_0x51b0bb['duplicates']&&_0x51b0bb[_0xd21e('0x6a')][_0xd21e('0x5e')]){_0x5097a5['push'](insertCmContact(_0x51b0bb['ListId'],_0x42a3bd,_0x51b0bb[_0xd21e('0x6a')],_0x5c3b67));_0x5097a5[_0xd21e('0x44')](_0xd21e('0x6b')+_0x42a3bd+';');}_0x5097a5[_0xd21e('0x44')](insertCmHopper(_0x51b0bb['ListId'],_0xd21e('0x6c'),_0xd21e('0x6d'),_0xd21e('0x6e'),_0x45bfab));_0x5097a5[_0xd21e('0x44')](insertCmHopperBlack(_0x51b0bb['ListId'],'voice_queues_has_cm_blacklists',_0xd21e('0x6d'),_0xd21e('0x6e')));_0x5097a5[_0xd21e('0x44')](insertCmHopper(_0x51b0bb[_0xd21e('0x2d')],_0xd21e('0x6f'),_0xd21e('0x70'),_0xd21e('0x71'),_0x45bfab));_0x5097a5[_0xd21e('0x44')](insertCmHopperBlack(_0x51b0bb[_0xd21e('0x2d')],_0xd21e('0x72'),_0xd21e('0x70'),_0xd21e('0x71')));BPromise[_0xd21e('0x73')](_0x5097a5,handleQuery)['then'](function(_0x2079fb){stats['finish']=!![];stats['affectedRows']=_0x51b0bb[_0xd21e('0x6a')]&&_0x51b0bb[_0xd21e('0x6a')]['length']?results[0x2][_0xd21e('0x74')]:results[0x0]['affectedRows'];socket[_0xd21e('0x61')](_0xd21e('0x62')+_0x410bc2,stats);fs['unlink'](_0x29af7f);fs[_0xd21e('0x75')](_0x4c10bf);process[_0xd21e('0x3f')](0x0);})['catch'](function(_0x1484a4){logger[_0xd21e('0x3d')](_0x1484a4['message']);process[_0xd21e('0x3f')](0x1);});}catch(_0x27dc8b){logger['error'](_0xd21e('0x76'),_0x27dc8b[_0xd21e('0x3e')]);process['exit'](0x1);}},'error':function(_0x4155ce,_0x295cd8,_0x45fcd1,_0x20bb58){throw new Error(_0x20bb58);}});}function validate(){if(process[_0xd21e('0x77')]&&process[_0xd21e('0x77')][_0xd21e('0x5e')]<0x4){throw new Error('arguments\x20\x20\x20');}var _0x1baf6f=path['join'](config[_0xd21e('0x78')],_0xd21e('0x79'),process[_0xd21e('0x77')][0x2]);if(!fs[_0xd21e('0x7a')](_0x1baf6f)){throw new Error('file\x20doesn\x27t\x20exists');}var _0x2bdb95={};try{_0x2bdb95=JSON[_0xd21e('0x4e')](process[_0xd21e('0x77')][0x3]);if(!_0x2bdb95[_0xd21e('0x49')]){throw new Error('binding\x20doesn\x27t\x20exists');}if(!_0x2bdb95[_0xd21e('0x49')][_0xd21e('0x10')]){throw new Error('phone\x20is\x20mandatory');}if(!_0x2bdb95[_0xd21e('0x49')]['firstName']){throw new Error(_0xd21e('0x7b'));}var _0x1efc32=0x0;if(_0x2bdb95[_0xd21e('0x49')][_0xd21e('0x7c')]){_0x1efc32=0x1;}if(!_0x2bdb95['ListId']){throw new Error(_0xd21e('0x7d'));}}catch(_0x4ce699){throw new Error(_0xd21e('0x7e'));}var _0x2737ac=[];try{_0x2737ac=_[_0xd21e('0x7f')](JSON['parse'](process[_0xd21e('0x77')][0x4]),'id');}catch(_0x245daf){logger['info'](_0xd21e('0x80'));}main(_0x1baf6f,_0x2bdb95,_0x2737ac,_0x1efc32);}validate();process['on'](_0xd21e('0x81'),handleStop);process['on'](_0xd21e('0x82'),handleUncaughtException); \ No newline at end of file diff --git a/server/components/integrations/configuration.js b/server/components/integrations/configuration.js index c2ed813..39b2b67 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 _0xbc9d=['Member\x20Name','starttime','Answer\x20Time','Complete\x20Time','endtime','Duration','Billable\x20Time','billableseconds','getSubjects','string','toLowerCase','inbound','push','variable','queue','outbound','getDescriptions','voice','***\x20Call\x20Info\x20***','keyValue','calleridnum','Caller\x20Name','calleridname','Call\x20To','destexten','Queue','UniqueId','uniqueid','Date','agentcalledAt','***\x20Agent\x20Info\x20***','Agent\x20Name','destcalleridname','Agent\x20Ring','Agent\x20Connect','agentconnectAt','Agent\x20Complete','agentcompleteAt','Hold\x20Time','holdtime','Talk\x20Time','talktime','Called\x20Number'];(function(_0x3ecd3a,_0x5967b4){var _0x87d60c=function(_0x3dc0d3){while(--_0x3dc0d3){_0x3ecd3a['push'](_0x3ecd3a['shift']());}};_0x87d60c(++_0x5967b4);}(_0xbc9d,0xb4));var _0xdbc9=function(_0x28c768,_0x2032aa){_0x28c768=_0x28c768-0x0;var _0x31ab36=_0xbc9d[_0x28c768];return _0x31ab36;};'use strict';exports[_0xdbc9('0x0')]=function(_0xbca678,_0x8aa82b){var _0x434f6e=[{'type':_0xdbc9('0x1'),'content':'[xCALLY\x20Ticket]','variableName':null}];switch(_0xbca678['toLowerCase']()){case'voice':switch(_0x8aa82b[_0xdbc9('0x2')]()){case _0xdbc9('0x3'):_0x434f6e[_0xdbc9('0x4')]({'type':_0xdbc9('0x5'),'content':'','variableName':_0xdbc9('0x6')});_0x434f6e[_0xdbc9('0x4')]({'type':_0xdbc9('0x5'),'content':'','variableName':'calleridnum'});break;case _0xdbc9('0x7'):_0x434f6e[_0xdbc9('0x4')]({'type':_0xdbc9('0x1'),'content':'Outbound\x20Call','variableName':null});_0x434f6e[_0xdbc9('0x4')]({'type':'variable','content':'','variableName':'destcalleridnum'});break;}}return _0x434f6e;};exports[_0xdbc9('0x8')]=function(_0xe9bbde,_0x19be1d){var _0x2f5e6d=[];switch(_0xe9bbde['toLowerCase']()){case _0xdbc9('0x9'):switch(_0x19be1d[_0xdbc9('0x2')]()){case _0xdbc9('0x3'):_0x2f5e6d=[{'type':_0xdbc9('0x1'),'content':_0xdbc9('0xa'),'key':null,'keyType':null,'variableName':null},{'type':_0xdbc9('0xb'),'content':'','key':'Caller\x20Number','keyType':'variable','variableName':_0xdbc9('0xc')},{'type':_0xdbc9('0xb'),'content':'','key':_0xdbc9('0xd'),'keyType':_0xdbc9('0x5'),'variableName':_0xdbc9('0xe')},{'type':'keyValue','content':'','key':_0xdbc9('0xf'),'keyType':_0xdbc9('0x5'),'variableName':_0xdbc9('0x10')},{'type':'keyValue','content':'','key':_0xdbc9('0x11'),'keyType':_0xdbc9('0x5'),'variableName':'queue'},{'type':_0xdbc9('0xb'),'content':'','key':_0xdbc9('0x12'),'keyType':_0xdbc9('0x5'),'variableName':_0xdbc9('0x13')},{'type':_0xdbc9('0xb'),'content':'','key':_0xdbc9('0x14'),'keyType':_0xdbc9('0x5'),'variableName':_0xdbc9('0x15')},{'type':_0xdbc9('0x1'),'content':_0xdbc9('0x16'),'key':null,'keyType':null,'variableName':null},{'type':'keyValue','content':'','key':_0xdbc9('0x17'),'keyType':'variable','variableName':_0xdbc9('0x18')},{'type':_0xdbc9('0xb'),'content':'','key':'Agent\x20Number','keyType':_0xdbc9('0x5'),'variableName':'destcalleridnum'},{'type':'string','content':'***\x20Time\x20Info\x20***','key':null,'keyType':null,'variableName':null},{'type':'keyValue','content':'','key':_0xdbc9('0x19'),'keyType':_0xdbc9('0x5'),'variableName':'agentcalledAt'},{'type':_0xdbc9('0xb'),'content':'','key':_0xdbc9('0x1a'),'keyType':'variable','variableName':_0xdbc9('0x1b')},{'type':_0xdbc9('0xb'),'content':'','key':_0xdbc9('0x1c'),'keyType':_0xdbc9('0x5'),'variableName':_0xdbc9('0x1d')},{'type':_0xdbc9('0xb'),'content':'','key':_0xdbc9('0x1e'),'keyType':_0xdbc9('0x5'),'variableName':_0xdbc9('0x1f')},{'type':'keyValue','content':'','key':_0xdbc9('0x20'),'keyType':_0xdbc9('0x5'),'variableName':_0xdbc9('0x21')}];break;case _0xdbc9('0x7'):_0x2f5e6d=[{'type':_0xdbc9('0x1'),'content':'***\x20Call\x20Info\x20***','variableName':null},{'type':_0xdbc9('0xb'),'content':'','key':_0xdbc9('0x22'),'keyType':'variable','keyContent':'','variableName':'destcalleridnum'},{'type':_0xdbc9('0xb'),'content':'','key':_0xdbc9('0x23'),'keyType':_0xdbc9('0x5'),'keyContent':'','variableName':'membername'},{'type':_0xdbc9('0xb'),'content':'','key':'UniqueId','keyType':'variable','keyContent':'','variableName':_0xdbc9('0x13')},{'type':'keyValue','content':'','key':'Date','keyType':_0xdbc9('0x5'),'keyContent':'','variableName':_0xdbc9('0x24')},{'type':_0xdbc9('0x1'),'content':'***\x20Time\x20Info\x20***'},{'type':_0xdbc9('0xb'),'content':'','key':_0xdbc9('0x25'),'keyType':'variable','keyContent':'','variableName':'answertime'},{'type':_0xdbc9('0xb'),'content':'','key':_0xdbc9('0x26'),'keyType':_0xdbc9('0x5'),'keyContent':'','variableName':_0xdbc9('0x27')},{'type':_0xdbc9('0xb'),'content':'','key':_0xdbc9('0x28'),'keyType':_0xdbc9('0x5'),'keyContent':'','variableName':'duration'},{'type':_0xdbc9('0xb'),'content':'','key':_0xdbc9('0x29'),'keyType':_0xdbc9('0x5'),'keyContent':'','variableName':_0xdbc9('0x2a')}];break;}}return _0x2f5e6d;}; \ No newline at end of file +var _0x36ee=['toLowerCase','voice','inbound','push','variable','queue','calleridnum','Outbound\x20Call','getDescriptions','***\x20Call\x20Info\x20***','Caller\x20Number','keyValue','Call\x20To','destexten','Queue','UniqueId','Date','agentcalledAt','***\x20Agent\x20Info\x20***','destcalleridname','destcalleridnum','***\x20Time\x20Info\x20***','Agent\x20Ring','Agent\x20Connect','agentconnectAt','agentcompleteAt','Hold\x20Time','holdtime','talktime','outbound','Answer\x20Time','answertime','endtime','Duration','duration','Billable\x20Time','billableseconds','string','[xCALLY\x20Ticket]'];(function(_0x17d9e3,_0x1f969c){var _0x14192d=function(_0x159745){while(--_0x159745){_0x17d9e3['push'](_0x17d9e3['shift']());}};_0x14192d(++_0x1f969c);}(_0x36ee,0xe8));var _0xe36e=function(_0x3b380d,_0x4bf247){_0x3b380d=_0x3b380d-0x0;var _0x54502b=_0x36ee[_0x3b380d];return _0x54502b;};'use strict';exports['getSubjects']=function(_0x4889d8,_0x34e33c){var _0x521ff3=[{'type':_0xe36e('0x0'),'content':_0xe36e('0x1'),'variableName':null}];switch(_0x4889d8[_0xe36e('0x2')]()){case _0xe36e('0x3'):switch(_0x34e33c[_0xe36e('0x2')]()){case _0xe36e('0x4'):_0x521ff3[_0xe36e('0x5')]({'type':_0xe36e('0x6'),'content':'','variableName':_0xe36e('0x7')});_0x521ff3[_0xe36e('0x5')]({'type':_0xe36e('0x6'),'content':'','variableName':_0xe36e('0x8')});break;case'outbound':_0x521ff3[_0xe36e('0x5')]({'type':'string','content':_0xe36e('0x9'),'variableName':null});_0x521ff3[_0xe36e('0x5')]({'type':_0xe36e('0x6'),'content':'','variableName':'destcalleridnum'});break;}}return _0x521ff3;};exports[_0xe36e('0xa')]=function(_0x48981b,_0x2e968d){var _0x2133cf=[];switch(_0x48981b[_0xe36e('0x2')]()){case _0xe36e('0x3'):switch(_0x2e968d[_0xe36e('0x2')]()){case _0xe36e('0x4'):_0x2133cf=[{'type':_0xe36e('0x0'),'content':_0xe36e('0xb'),'key':null,'keyType':null,'variableName':null},{'type':'keyValue','content':'','key':_0xe36e('0xc'),'keyType':_0xe36e('0x6'),'variableName':_0xe36e('0x8')},{'type':_0xe36e('0xd'),'content':'','key':'Caller\x20Name','keyType':_0xe36e('0x6'),'variableName':'calleridname'},{'type':'keyValue','content':'','key':_0xe36e('0xe'),'keyType':_0xe36e('0x6'),'variableName':_0xe36e('0xf')},{'type':_0xe36e('0xd'),'content':'','key':_0xe36e('0x10'),'keyType':_0xe36e('0x6'),'variableName':_0xe36e('0x7')},{'type':_0xe36e('0xd'),'content':'','key':_0xe36e('0x11'),'keyType':_0xe36e('0x6'),'variableName':'uniqueid'},{'type':_0xe36e('0xd'),'content':'','key':_0xe36e('0x12'),'keyType':'variable','variableName':_0xe36e('0x13')},{'type':'string','content':_0xe36e('0x14'),'key':null,'keyType':null,'variableName':null},{'type':_0xe36e('0xd'),'content':'','key':'Agent\x20Name','keyType':_0xe36e('0x6'),'variableName':_0xe36e('0x15')},{'type':_0xe36e('0xd'),'content':'','key':'Agent\x20Number','keyType':_0xe36e('0x6'),'variableName':_0xe36e('0x16')},{'type':_0xe36e('0x0'),'content':_0xe36e('0x17'),'key':null,'keyType':null,'variableName':null},{'type':_0xe36e('0xd'),'content':'','key':_0xe36e('0x18'),'keyType':'variable','variableName':_0xe36e('0x13')},{'type':_0xe36e('0xd'),'content':'','key':_0xe36e('0x19'),'keyType':_0xe36e('0x6'),'variableName':_0xe36e('0x1a')},{'type':'keyValue','content':'','key':'Agent\x20Complete','keyType':_0xe36e('0x6'),'variableName':_0xe36e('0x1b')},{'type':_0xe36e('0xd'),'content':'','key':_0xe36e('0x1c'),'keyType':_0xe36e('0x6'),'variableName':_0xe36e('0x1d')},{'type':_0xe36e('0xd'),'content':'','key':'Talk\x20Time','keyType':_0xe36e('0x6'),'variableName':_0xe36e('0x1e')}];break;case _0xe36e('0x1f'):_0x2133cf=[{'type':_0xe36e('0x0'),'content':'***\x20Call\x20Info\x20***','variableName':null},{'type':_0xe36e('0xd'),'content':'','key':'Called\x20Number','keyType':_0xe36e('0x6'),'keyContent':'','variableName':'destcalleridnum'},{'type':_0xe36e('0xd'),'content':'','key':'Member\x20Name','keyType':_0xe36e('0x6'),'keyContent':'','variableName':'membername'},{'type':_0xe36e('0xd'),'content':'','key':'UniqueId','keyType':'variable','keyContent':'','variableName':'uniqueid'},{'type':'keyValue','content':'','key':_0xe36e('0x12'),'keyType':_0xe36e('0x6'),'keyContent':'','variableName':'starttime'},{'type':'string','content':_0xe36e('0x17')},{'type':_0xe36e('0xd'),'content':'','key':_0xe36e('0x20'),'keyType':_0xe36e('0x6'),'keyContent':'','variableName':_0xe36e('0x21')},{'type':_0xe36e('0xd'),'content':'','key':'Complete\x20Time','keyType':_0xe36e('0x6'),'keyContent':'','variableName':_0xe36e('0x22')},{'type':'keyValue','content':'','key':_0xe36e('0x23'),'keyType':_0xe36e('0x6'),'keyContent':'','variableName':_0xe36e('0x24')},{'type':_0xe36e('0xd'),'content':'','key':_0xe36e('0x25'),'keyType':_0xe36e('0x6'),'keyContent':'','variableName':_0xe36e('0x26')}];break;}}return _0x2133cf;}; \ No newline at end of file diff --git a/server/components/interaction/service.js b/server/components/interaction/service.js index c53128f..344bf75 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 _0x959e=['unknown','toLowerCase','toUpperCase','name','role','null','Interaction','findOne','then','info','error','tracked','user','query','clone','body','omit','html','phone','fax','../../config/logger','fax-interactions','sms-interactions','chat-interactions','InteractionId'];(function(_0x160c73,_0x2ee678){var _0xd9302=function(_0x169454){while(--_0x169454){_0x160c73['push'](_0x160c73['shift']());}};_0xd9302(++_0x2ee678);}(_0x959e,0x78));var _0xe959=function(_0x4ab3fb,_0x776775){_0x4ab3fb=_0x4ab3fb-0x0;var _0x34fe1e=_0x959e[_0x4ab3fb];return _0x34fe1e;};'use strict';var _=require('lodash');var db=require('../../mysqldb')['db'];var loggers={'openchannel':require(_0xe959('0x0'))('openchannel-interactions'),'mail':require(_0xe959('0x0'))('mail-interactions'),'fax':require(_0xe959('0x0'))(_0xe959('0x1')),'sms':require(_0xe959('0x0'))(_0xe959('0x2')),'chat':require(_0xe959('0x0'))(_0xe959('0x3'))};function getInteractionId(_0x2c3b6f,_0x45a2af,_0x3ed12c){if(_0x2c3b6f&&_0x2c3b6f[_['upperFirst'](_0x3ed12c)+_0xe959('0x4')]){return _0x2c3b6f[_['upperFirst'](_0x3ed12c)+_0xe959('0x4')];}else if(_0x2c3b6f&&_0x2c3b6f['id']){return _0x2c3b6f['id'];}else if(_0x45a2af&&_0x45a2af['id']){return _0x45a2af['id'];}else{return _0xe959('0x5');}}function log(_0x4defb,_0x5128ca,_0x3abcb8,_0x66ab0f,_0xeea06f,_0x1eb6ed){loggers[_0xeea06f[_0xe959('0x6')]()][_0x4defb]('[%s]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s',_0x1eb6ed[_0xe959('0x7')](),_0x5128ca?_0x5128ca['id']:null,_0x5128ca?_0x5128ca[_0xe959('0x8')]:null,_0x5128ca?_0x5128ca[_0xe959('0x9')]:null,getInteractionId(_0x3abcb8,_0x66ab0f,_0xeea06f),_0x3abcb8?JSON['stringify'](_0x3abcb8):_0xe959('0xa'));}function updateUser(_0x5be7f5,_0x1eb573,_0x3c96fb,_0x3ec8cc,_0x4268a){db[_['upperFirst'](_0x3ec8cc)+_0xe959('0xb')][_0xe959('0xc')]({'where':{'id':getInteractionId(_0x1eb573,_0x3c96fb,_0x3ec8cc)}})['then'](function(_0x10e440){if(_0x10e440){return _0x10e440['update']({'UserId':_0x5be7f5?_0x5be7f5['id']:null});}})[_0xe959('0xd')](function(_0x373f1c){if(_0x373f1c){log(_0xe959('0xe'),_0x5be7f5,_0x1eb573,_0x3c96fb,_0x3ec8cc,_0x4268a);}})['catch'](function(){log(_0xe959('0xf'),_0x5be7f5,_0x1eb573,_0x3c96fb,_0x3ec8cc,_0x4268a);});}exports[_0xe959('0x10')]=function(_0x732d58,_0x5bf74f){return function(_0x5409d3,_0xb9e3bf,_0x39d2ea){var _0x982bc4=_0x5409d3[_0xe959('0x11')];var _0x12066c={};var _0x4f265a=_0x5409d3[_0xe959('0x12')];if(_0x12066c){_0x12066c=_[_0xe959('0x13')](_0x5409d3[_0xe959('0x14')]);_0x12066c=_[_0xe959('0x15')](_0x12066c,[_0xe959('0x14'),_0xe959('0x16'),_0xe959('0x17'),_0xe959('0x18'),'mobile']);}updateUser(_0x982bc4,_0x12066c,_0x4f265a,_0x732d58,_0x5bf74f);_0x39d2ea(null);};}; \ No newline at end of file +var _0x94a7=['upperFirst','InteractionId','unknown','toLowerCase','[%s]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','name','role','Interaction','findOne','update','then','info','catch','tracked','user','query','clone','body','omit','html','phone','fax','mobile','lodash','../../config/logger','openchannel-interactions','mail-interactions','fax-interactions','sms-interactions','chat-interactions'];(function(_0x417964,_0x11177a){var _0x197510=function(_0x3a7f07){while(--_0x3a7f07){_0x417964['push'](_0x417964['shift']());}};_0x197510(++_0x11177a);}(_0x94a7,0x8f));var _0x794a=function(_0x365dab,_0x1b7ed4){_0x365dab=_0x365dab-0x0;var _0xa7285a=_0x94a7[_0x365dab];return _0xa7285a;};'use strict';var _=require(_0x794a('0x0'));var db=require('../../mysqldb')['db'];var loggers={'openchannel':require(_0x794a('0x1'))(_0x794a('0x2')),'mail':require(_0x794a('0x1'))(_0x794a('0x3')),'fax':require(_0x794a('0x1'))(_0x794a('0x4')),'sms':require('../../config/logger')(_0x794a('0x5')),'chat':require(_0x794a('0x1'))(_0x794a('0x6'))};function getInteractionId(_0x418129,_0x1edbeb,_0x2371b4){if(_0x418129&&_0x418129[_[_0x794a('0x7')](_0x2371b4)+'InteractionId']){return _0x418129[_[_0x794a('0x7')](_0x2371b4)+_0x794a('0x8')];}else if(_0x418129&&_0x418129['id']){return _0x418129['id'];}else if(_0x1edbeb&&_0x1edbeb['id']){return _0x1edbeb['id'];}else{return _0x794a('0x9');}}function log(_0x204373,_0x1f753f,_0x544774,_0xbf80f4,_0x5f2861,_0x35ae15){loggers[_0x5f2861[_0x794a('0xa')]()][_0x204373](_0x794a('0xb'),_0x35ae15['toUpperCase'](),_0x1f753f?_0x1f753f['id']:null,_0x1f753f?_0x1f753f[_0x794a('0xc')]:null,_0x1f753f?_0x1f753f[_0x794a('0xd')]:null,getInteractionId(_0x544774,_0xbf80f4,_0x5f2861),_0x544774?JSON['stringify'](_0x544774):'null');}function updateUser(_0x42c9e2,_0x4991af,_0x32c8a0,_0x12cbca,_0x2e26a6){db[_[_0x794a('0x7')](_0x12cbca)+_0x794a('0xe')][_0x794a('0xf')]({'where':{'id':getInteractionId(_0x4991af,_0x32c8a0,_0x12cbca)}})['then'](function(_0x3566bf){if(_0x3566bf){return _0x3566bf[_0x794a('0x10')]({'UserId':_0x42c9e2?_0x42c9e2['id']:null});}})[_0x794a('0x11')](function(_0x2eb1dc){if(_0x2eb1dc){log(_0x794a('0x12'),_0x42c9e2,_0x4991af,_0x32c8a0,_0x12cbca,_0x2e26a6);}})[_0x794a('0x13')](function(){log('error',_0x42c9e2,_0x4991af,_0x32c8a0,_0x12cbca,_0x2e26a6);});}exports[_0x794a('0x14')]=function(_0x5d199f,_0x22450f){return function(_0x457d0a,_0xd6567f,_0x28c6b8){var _0x5a9080=_0x457d0a[_0x794a('0x15')];var _0x255d25={};var _0x35a2c6=_0x457d0a[_0x794a('0x16')];if(_0x255d25){_0x255d25=_[_0x794a('0x17')](_0x457d0a[_0x794a('0x18')]);_0x255d25=_[_0x794a('0x19')](_0x255d25,['body',_0x794a('0x1a'),_0x794a('0x1b'),_0x794a('0x1c'),_0x794a('0x1d')]);}updateUser(_0x5a9080,_0x255d25,_0x35a2c6,_0x5d199f,_0x22450f);_0x28c6b8(null);};}; \ No newline at end of file diff --git a/server/components/license/service.js b/server/components/license/service.js index 297a5e6..5aed26f 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 _0x4343=['../../config/environment','license','data1','split','createDecipher','update','base64','utf8','final','parse','hasOwnProperty','License','findOne','then','json','format','Maximum\x20%s\x20limit\x20have\x20been\x20reached','catch','users','isUserLimit','crypto','util','composable-middleware','../../mysqldb'];(function(_0x55dbdc,_0x2a203a){var _0x5d7a04=function(_0x44621e){while(--_0x44621e){_0x55dbdc['push'](_0x55dbdc['shift']());}};_0x5d7a04(++_0x2a203a);}(_0x4343,0x1dc));var _0x3434=function(_0xa9ebf3,_0x49af2f){_0xa9ebf3=_0xa9ebf3-0x0;var _0x437022=_0x4343[_0xa9ebf3];return _0x437022;};'use strict';var crypto=require(_0x3434('0x0'));var util=require(_0x3434('0x1'));var compose=require(_0x3434('0x2'));var db=require(_0x3434('0x3'))['db'];var config=require(_0x3434('0x4'));function getValueFromLicense(_0x3f9ccc,_0x2304a6){if(_0x3f9ccc&&_0x2304a6){if(_0x2304a6['data1']&&_0x2304a6[_0x3434('0x5')]){var _0xf52776=_0x2304a6[_0x3434('0x6')];var _0x133d83=_0x2304a6['license'];var _0x42f9cc=_0xf52776['split']('-')[0x4];var _0xf85326=_0xf52776[_0x3434('0x7')]('-')[0x0];var _0x285884=crypto[_0x3434('0x8')]('aes-256-ctr',util['format']('%s:%s:%s',_0x42f9cc,_0xf52776,_0xf85326));var _0x465e5f=_0x285884[_0x3434('0x9')](_0x133d83,_0x3434('0xa'),_0x3434('0xb'));_0x465e5f+=_0x285884[_0x3434('0xc')]('utf8');var _0x571ef8=JSON[_0x3434('0xd')](_0x465e5f);return _0x571ef8[_0x3434('0xe')](_0x3f9ccc)?_0x571ef8[_0x3f9ccc]:null;}}return null;}function isLimit(_0x554830,_0x70efac,_0x569da9,_0x3d42ea){var _0x2d5aac=_0x70efac;return compose()['use'](function(_0x12842e,_0xcb35b0,_0x39de0c){return db[_0x3434('0xf')][_0x3434('0x10')]({'where':{'id':0x1},'raw':!![]})[_0x3434('0x11')](function(_0x4a716b){var _0xc06cb8=getValueFromLicense(_0x554830,_0x4a716b);return _0xc06cb8?_0xc06cb8:_0x2d5aac;})[_0x3434('0x11')](function(_0x182dcc){_0x2d5aac=_0x182dcc;return _0x569da9['count'](_0x3d42ea);})[_0x3434('0x11')](function(_0x11fb0e){if(_0x11fb0e>=_0x2d5aac){return _0xcb35b0['status'](0x193)[_0x3434('0x12')]({'message':util[_0x3434('0x13')](_0x3434('0x14'),_0x554830)});}_0x39de0c();})[_0x3434('0x15')](function(_0x407ae7){_0x39de0c(_0x407ae7);});});}function isUserLimit(){return isLimit(_0x3434('0x16'),0x1,db['User'],{'where':{'$or':[{'role':'admin'},{'role':'user'}]}});}exports[_0x3434('0x17')]=isUserLimit; \ No newline at end of file +var _0x0146=['createDecipher','aes-256-ctr','format','%s:%s:%s','update','base64','utf8','final','parse','License','then','count','status','json','Maximum\x20%s\x20limit\x20have\x20been\x20reached','users','User','admin','user','isUserLimit','crypto','util','composable-middleware','../../mysqldb','../../config/environment','license','data1','split'];(function(_0x114da5,_0x34677b){var _0x1e52e3=function(_0x53a5a9){while(--_0x53a5a9){_0x114da5['push'](_0x114da5['shift']());}};_0x1e52e3(++_0x34677b);}(_0x0146,0xa0));var _0x6014=function(_0x4c3ffe,_0x457374){_0x4c3ffe=_0x4c3ffe-0x0;var _0x28d3eb=_0x0146[_0x4c3ffe];return _0x28d3eb;};'use strict';var crypto=require(_0x6014('0x0'));var util=require(_0x6014('0x1'));var compose=require(_0x6014('0x2'));var db=require(_0x6014('0x3'))['db'];var config=require(_0x6014('0x4'));function getValueFromLicense(_0x4c79af,_0x16d1bd){if(_0x4c79af&&_0x16d1bd){if(_0x16d1bd['data1']&&_0x16d1bd[_0x6014('0x5')]){var _0x408991=_0x16d1bd[_0x6014('0x6')];var _0x52c317=_0x16d1bd[_0x6014('0x5')];var _0x3f5a5a=_0x408991[_0x6014('0x7')]('-')[0x4];var _0x5b45c7=_0x408991[_0x6014('0x7')]('-')[0x0];var _0x2cba64=crypto[_0x6014('0x8')](_0x6014('0x9'),util[_0x6014('0xa')](_0x6014('0xb'),_0x3f5a5a,_0x408991,_0x5b45c7));var _0x57799b=_0x2cba64[_0x6014('0xc')](_0x52c317,_0x6014('0xd'),_0x6014('0xe'));_0x57799b+=_0x2cba64[_0x6014('0xf')](_0x6014('0xe'));var _0x4a7054=JSON[_0x6014('0x10')](_0x57799b);return _0x4a7054['hasOwnProperty'](_0x4c79af)?_0x4a7054[_0x4c79af]:null;}}return null;}function isLimit(_0x13e532,_0x75fb9a,_0x49c72b,_0x3118b9){var _0x258bb7=_0x75fb9a;return compose()['use'](function(_0x420452,_0x2665fe,_0x55dbbc){return db[_0x6014('0x11')]['findOne']({'where':{'id':0x1},'raw':!![]})[_0x6014('0x12')](function(_0x4cb07f){var _0x4f848a=getValueFromLicense(_0x13e532,_0x4cb07f);return _0x4f848a?_0x4f848a:_0x258bb7;})[_0x6014('0x12')](function(_0x5cb3fb){_0x258bb7=_0x5cb3fb;return _0x49c72b[_0x6014('0x13')](_0x3118b9);})['then'](function(_0x26f8ff){if(_0x26f8ff>=_0x258bb7){return _0x2665fe[_0x6014('0x14')](0x193)[_0x6014('0x15')]({'message':util[_0x6014('0xa')](_0x6014('0x16'),_0x13e532)});}_0x55dbbc();})['catch'](function(_0x27074a){_0x55dbbc(_0x27074a);});});}function isUserLimit(){return isLimit(_0x6014('0x17'),0x1,db[_0x6014('0x18')],{'where':{'$or':[{'role':_0x6014('0x19')},{'role':_0x6014('0x1a')}]}});}exports[_0x6014('0x1b')]=isUserLimit; \ No newline at end of file diff --git a/server/components/parsers/advancedSearch.js b/server/components/parsers/advancedSearch.js index 3ec4e2d..45c2c70 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 _0xdd40=['minutes','lodash','moment','parseSearch','sqlOperator','startsWith','and','replace','[$and]','[$or]','split','length','slice','shift','match','forEach','filter','indexOf','map','conditions','push','buildExpression','operator','value','includes','$gt','add','days','format','castTo','text','field','\x20AS\x20','$ne','$notIn','\x20OR\x20','$in','IN\x20?','NOT\x20IN\x20?','$eq','=\x20?','<>\x20?','$substring','$endsWith','LIKE\x20?','$lt','<\x20?','>\x20?','$gte','>=\x20?','$between','BETWEEN\x20?\x20AND\x20?','start','$startsWith','DATE','utcOffset','hours'];(function(_0x521c1f,_0x2edc35){var _0x49efb8=function(_0x466cf7){while(--_0x466cf7){_0x521c1f['push'](_0x521c1f['shift']());}};_0x49efb8(++_0x2edc35);}(_0xdd40,0xac));var _0x0dd4=function(_0xe44869,_0x4e688b){_0xe44869=_0xe44869-0x0;var _0x4629cf=_0xdd40[_0xe44869];return _0x4629cf;};'use strict';var _=require(_0x0dd4('0x0'));var moment=require(_0x0dd4('0x1'));exports[_0x0dd4('0x2')]=function(_0x569034){var _0x1c9f29={'conditions':[]};_0x1c9f29[_0x0dd4('0x3')]=_[_0x0dd4('0x4')](_0x569034,'[$or]')?'or':_0x0dd4('0x5');var _0x2a45cc=_0x569034[_0x0dd4('0x6')](_0x0dd4('0x7'),'')[_0x0dd4('0x6')](_0x0dd4('0x8'),'')[_0x0dd4('0x9')]('||');for(var _0x27e2c3=0x0;_0x27e2c3<_0x2a45cc[_0x0dd4('0xa')];_0x27e2c3++){var _0x48de60=_0x2a45cc[_0x27e2c3][_0x0dd4('0x9')](':=');var _0x22f1ba=_0x48de60[0x0];var _0xb7fb16=_0x48de60[_0x0dd4('0xb')](0x1);_0xb7fb16['forEach'](function(_0x31f371){var _0x580b42=_0x31f371[_0x0dd4('0x9')]('[')[_0x0dd4('0xc')]();var _0x3d632f=_0x31f371[_0x0dd4('0xd')](/\[(.*?)\]/g);_0x3d632f[_0x0dd4('0xe')](function(_0x9fcb2f){var _0x4c767e=_0x9fcb2f['split']('[')[_0x0dd4('0xf')](function(_0x3e4fa3){return _0x3e4fa3[_0x0dd4('0x10')](']')>-0x1;})[_0x0dd4('0x11')](function(_0x33e40f){return _0x33e40f[_0x0dd4('0x9')](']')[0x0];})[0x0];_0x1c9f29[_0x0dd4('0x12')][_0x0dd4('0x13')]({'field':_0x22f1ba,'operator':_0x580b42,'value':_0x4c767e});});});}return _0x1c9f29;};exports[_0x0dd4('0x14')]=function(_0x393d69,_0x3bfa98,_0x3ae37d){var _0x1b64a0={};if(_0x3bfa98==='DATE'){if(_0x3ae37d[_0x0dd4('0x15')]==='$eq'){_0x3ae37d[_0x0dd4('0x15')]='$between';_0x3ae37d['value']+=','+_0x3ae37d[_0x0dd4('0x16')];}else if(_[_0x0dd4('0x17')]([_0x0dd4('0x18'),'$lte'],_0x3ae37d['operator'])){_0x3ae37d[_0x0dd4('0x16')]=moment(_0x3ae37d[_0x0dd4('0x16')])[_0x0dd4('0x19')](0x1,_0x0dd4('0x1a'))[_0x0dd4('0x1b')]('YYYY-MM-DD');}}if(_0x3ae37d['castTo']){_0x3bfa98=_0x3ae37d[_0x0dd4('0x1c')];_0x1b64a0[_0x0dd4('0x1d')]='CAST('+_0x393d69+'.'+_0x3ae37d[_0x0dd4('0x1e')]+_0x0dd4('0x1f')+_0x3ae37d['castTo']+')\x20'+parseOperator(_0x3ae37d[_0x0dd4('0x15')]);}else{_0x1b64a0[_0x0dd4('0x1d')]=_0x393d69+'.'+_0x3ae37d[_0x0dd4('0x1e')]+'\x20'+parseOperator(_0x3ae37d[_0x0dd4('0x15')]);}if(_[_0x0dd4('0x17')]([_0x0dd4('0x20'),_0x0dd4('0x21')],_0x3ae37d[_0x0dd4('0x15')]))_0x1b64a0[_0x0dd4('0x1d')]='('+_0x1b64a0[_0x0dd4('0x1d')]+_0x0dd4('0x22')+_0x393d69+'.'+_0x3ae37d[_0x0dd4('0x1e')]+'\x20IS\x20NULL)';_0x1b64a0['value']=parseValue(_0x3bfa98,_0x3ae37d[_0x0dd4('0x15')],_0x3ae37d[_0x0dd4('0x16')]);return _0x1b64a0;};function parseOperator(_0x43993d){var _0x51fe12;switch(_0x43993d){case _0x0dd4('0x23'):_0x51fe12=_0x0dd4('0x24');break;case'$notIn':_0x51fe12=_0x0dd4('0x25');break;case _0x0dd4('0x26'):_0x51fe12=_0x0dd4('0x27');break;case _0x0dd4('0x20'):_0x51fe12=_0x0dd4('0x28');break;case _0x0dd4('0x29'):case'$startsWith':case _0x0dd4('0x2a'):_0x51fe12=_0x0dd4('0x2b');break;case _0x0dd4('0x2c'):_0x51fe12=_0x0dd4('0x2d');break;case _0x0dd4('0x18'):_0x51fe12=_0x0dd4('0x2e');break;case'$lte':_0x51fe12='<=\x20?';break;case _0x0dd4('0x2f'):_0x51fe12=_0x0dd4('0x30');break;case _0x0dd4('0x31'):_0x51fe12=_0x0dd4('0x32');break;}return _0x51fe12;}function parseValue(_0x15d0ea,_0x494f3d,_0x3fee02){var _0xb205dc={'start':undefined,'end':undefined};switch(_0x494f3d){case _0x0dd4('0x23'):case _0x0dd4('0x21'):_0xb205dc[_0x0dd4('0x33')]=_0x3fee02['split'](',');break;case _0x0dd4('0x29'):_0xb205dc['start']='%'+_0x3fee02+'%';break;case _0x0dd4('0x34'):_0xb205dc['start']=_0x3fee02+'%';break;case _0x0dd4('0x2a'):_0xb205dc['start']='%'+_0x3fee02;break;case'$between':var _0x2e1ff1=_0x3fee02[_0x0dd4('0x9')](',');var _0x3fee02=_0x2e1ff1[_0x0dd4('0xc')]();var _0x1c8056=_0x2e1ff1['pop']();if(_0x15d0ea===_0x0dd4('0x35')){_0x3fee02=moment(_0x3fee02)[_0x0dd4('0x36')](0x0,!![])[_0x0dd4('0x1b')]();_0x1c8056=moment(_0x1c8056)[_0x0dd4('0x36')](0x0,!![])['add'](0x17,_0x0dd4('0x37'))[_0x0dd4('0x19')](0x3b,_0x0dd4('0x38'))['add'](0x3b,'seconds')[_0x0dd4('0x1b')]();}_0xb205dc={'start':_0x3fee02,'end':_0x1c8056};break;default:_0xb205dc[_0x0dd4('0x33')]=_0x3fee02;break;}return _0xb205dc;} \ No newline at end of file +var _0x2f07=['indexOf','map','conditions','buildExpression','DATE','operator','$eq','$between','value','$gt','add','days','castTo','text','field','includes','$ne','$notIn','\x20OR\x20','\x20IS\x20NULL)','$in','IN\x20?','NOT\x20IN\x20?','<>\x20?','$startsWith','$endsWith','LIKE\x20?','$lt','<\x20?','$lte','<=\x20?','>=\x20?','BETWEEN\x20?\x20AND\x20?','start','$substring','pop','utcOffset','format','minutes','lodash','moment','sqlOperator','and','replace','[$and]','[$or]','length','slice','forEach','shift','match','split','filter'];(function(_0x1beef3,_0x57c4b8){var _0x5af964=function(_0x36f463){while(--_0x36f463){_0x1beef3['push'](_0x1beef3['shift']());}};_0x5af964(++_0x57c4b8);}(_0x2f07,0xc6));var _0x72f0=function(_0x4e3723,_0x4e2bc6){_0x4e3723=_0x4e3723-0x0;var _0x91e138=_0x2f07[_0x4e3723];return _0x91e138;};'use strict';var _=require(_0x72f0('0x0'));var moment=require(_0x72f0('0x1'));exports['parseSearch']=function(_0x2778b8){var _0x1319b9={'conditions':[]};_0x1319b9[_0x72f0('0x2')]=_['startsWith'](_0x2778b8,'[$or]')?'or':_0x72f0('0x3');var _0x337950=_0x2778b8[_0x72f0('0x4')](_0x72f0('0x5'),'')[_0x72f0('0x4')](_0x72f0('0x6'),'')['split']('||');for(var _0x42d5bf=0x0;_0x42d5bf<_0x337950[_0x72f0('0x7')];_0x42d5bf++){var _0x38a020=_0x337950[_0x42d5bf]['split'](':=');var _0x5aa9b9=_0x38a020[0x0];var _0x43d84d=_0x38a020[_0x72f0('0x8')](0x1);_0x43d84d[_0x72f0('0x9')](function(_0x3e02e3){var _0x525b6c=_0x3e02e3['split']('[')[_0x72f0('0xa')]();var _0x147074=_0x3e02e3[_0x72f0('0xb')](/\[(.*?)\]/g);_0x147074[_0x72f0('0x9')](function(_0x1752a1){var _0x4e0e47=_0x1752a1[_0x72f0('0xc')]('[')[_0x72f0('0xd')](function(_0x3fcacf){return _0x3fcacf[_0x72f0('0xe')](']')>-0x1;})[_0x72f0('0xf')](function(_0x1c7786){return _0x1c7786['split'](']')[0x0];})[0x0];_0x1319b9[_0x72f0('0x10')]['push']({'field':_0x5aa9b9,'operator':_0x525b6c,'value':_0x4e0e47});});});}return _0x1319b9;};exports[_0x72f0('0x11')]=function(_0x273f8a,_0x80286c,_0x53e00f){var _0x4c013c={};if(_0x80286c===_0x72f0('0x12')){if(_0x53e00f[_0x72f0('0x13')]===_0x72f0('0x14')){_0x53e00f['operator']=_0x72f0('0x15');_0x53e00f[_0x72f0('0x16')]+=','+_0x53e00f[_0x72f0('0x16')];}else if(_['includes']([_0x72f0('0x17'),'$lte'],_0x53e00f[_0x72f0('0x13')])){_0x53e00f[_0x72f0('0x16')]=moment(_0x53e00f[_0x72f0('0x16')])[_0x72f0('0x18')](0x1,_0x72f0('0x19'))['format']('YYYY-MM-DD');}}if(_0x53e00f[_0x72f0('0x1a')]){_0x80286c=_0x53e00f[_0x72f0('0x1a')];_0x4c013c[_0x72f0('0x1b')]='CAST('+_0x273f8a+'.'+_0x53e00f[_0x72f0('0x1c')]+'\x20AS\x20'+_0x53e00f['castTo']+')\x20'+parseOperator(_0x53e00f[_0x72f0('0x13')]);}else{_0x4c013c[_0x72f0('0x1b')]=_0x273f8a+'.'+_0x53e00f[_0x72f0('0x1c')]+'\x20'+parseOperator(_0x53e00f[_0x72f0('0x13')]);}if(_[_0x72f0('0x1d')]([_0x72f0('0x1e'),_0x72f0('0x1f')],_0x53e00f[_0x72f0('0x13')]))_0x4c013c['text']='('+_0x4c013c[_0x72f0('0x1b')]+_0x72f0('0x20')+_0x273f8a+'.'+_0x53e00f[_0x72f0('0x1c')]+_0x72f0('0x21');_0x4c013c['value']=parseValue(_0x80286c,_0x53e00f[_0x72f0('0x13')],_0x53e00f[_0x72f0('0x16')]);return _0x4c013c;};function parseOperator(_0x4c7c1c){var _0x42a876;switch(_0x4c7c1c){case _0x72f0('0x22'):_0x42a876=_0x72f0('0x23');break;case'$notIn':_0x42a876=_0x72f0('0x24');break;case _0x72f0('0x14'):_0x42a876='=\x20?';break;case _0x72f0('0x1e'):_0x42a876=_0x72f0('0x25');break;case'$substring':case _0x72f0('0x26'):case _0x72f0('0x27'):_0x42a876=_0x72f0('0x28');break;case _0x72f0('0x29'):_0x42a876=_0x72f0('0x2a');break;case _0x72f0('0x17'):_0x42a876='>\x20?';break;case _0x72f0('0x2b'):_0x42a876=_0x72f0('0x2c');break;case'$gte':_0x42a876=_0x72f0('0x2d');break;case _0x72f0('0x15'):_0x42a876=_0x72f0('0x2e');break;}return _0x42a876;}function parseValue(_0x3e1e4c,_0x3639c2,_0x235e08){var _0x241eb={'start':undefined,'end':undefined};switch(_0x3639c2){case _0x72f0('0x22'):case _0x72f0('0x1f'):_0x241eb[_0x72f0('0x2f')]=_0x235e08['split'](',');break;case _0x72f0('0x30'):_0x241eb['start']='%'+_0x235e08+'%';break;case _0x72f0('0x26'):_0x241eb[_0x72f0('0x2f')]=_0x235e08+'%';break;case _0x72f0('0x27'):_0x241eb[_0x72f0('0x2f')]='%'+_0x235e08;break;case'$between':var _0x3e8bf9=_0x235e08[_0x72f0('0xc')](',');var _0x235e08=_0x3e8bf9[_0x72f0('0xa')]();var _0x41dc5b=_0x3e8bf9[_0x72f0('0x31')]();if(_0x3e1e4c==='DATE'){_0x235e08=moment(_0x235e08)[_0x72f0('0x32')](0x0,!![])[_0x72f0('0x33')]();_0x41dc5b=moment(_0x41dc5b)[_0x72f0('0x32')](0x0,!![])[_0x72f0('0x18')](0x17,'hours')[_0x72f0('0x18')](0x3b,_0x72f0('0x34'))[_0x72f0('0x18')](0x3b,'seconds')['format']();}_0x241eb={'start':_0x235e08,'end':_0x41dc5b};break;default:_0x241eb[_0x72f0('0x2f')]=_0x235e08;break;}return _0x241eb;} \ No newline at end of file diff --git a/server/components/parsers/qs.js b/server/components/parsers/qs.js index a3ad791..a676b47 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 _0x4b75=['filters','isEmpty','forOwn','isArray','sort','indexOf','priority','cast','col','unsigned','substr','DESC','ASC','omit','isObject','isString','hasOwnProperty','isNumeric','match','isEmail','getFullTextValue','lodash','sequelize','fields','split'];(function(_0x1e55a4,_0x282687){var _0x89e43d=function(_0x40b61a){while(--_0x40b61a){_0x1e55a4['push'](_0x1e55a4['shift']());}};_0x89e43d(++_0x282687);}(_0x4b75,0x128));var _0x54b7=function(_0x580a31,_0x1ed582){_0x580a31=_0x580a31-0x0;var _0x545e9b=_0x4b75[_0x580a31];return _0x545e9b;};'use strict';var _=require(_0x54b7('0x0'));var sequelize=require(_0x54b7('0x1'));var LIMIT_VALUE=0xfa;exports[_0x54b7('0x2')]=function(_0x3096f3){var _0x175a32=null;if(_0x3096f3){_0x175a32=_0x3096f3[_0x54b7('0x3')](',');}return _0x175a32;};exports[_0x54b7('0x4')]=function(_0x1b4104){var _0x135f96={};if(!_[_0x54b7('0x5')](_0x1b4104)){_0x135f96={};_[_0x54b7('0x6')](_0x1b4104,function(_0x368ad6,_0x251b95){try{_0x135f96[_0x251b95]=_[_0x54b7('0x7')](_0x368ad6)?_0x368ad6:JSON['parse'](_0x368ad6);}catch(_0x170ba0){_0x135f96[_0x251b95]=_0x368ad6['split'](',');}});}return _0x135f96;};exports['limit']=function(_0x5b05b9){_0x5b05b9=parseInt(_0x5b05b9,0xa);if(!_0x5b05b9||_0x5b05b9<0x0){_0x5b05b9=LIMIT_VALUE;}return _0x5b05b9;};exports['offset']=function(_0x4fcef8){_0x4fcef8=parseInt(_0x4fcef8,0xa);if(!_0x4fcef8||_0x4fcef8<0x0){_0x4fcef8=0x0;}return _0x4fcef8;};exports[_0x54b7('0x8')]=function(_0xb543ad){var _0x2a8f35,_0x4b4582=null;if(_0xb543ad){_0x2a8f35=_0xb543ad[_0x54b7('0x3')](',');_0x4b4582=_['map'](_0x2a8f35,function(_0x4427be){if(_0x4427be[_0x54b7('0x9')]('-')===0x0){return[_0x4427be===_0x54b7('0xa')?sequelize[_0x54b7('0xb')](sequelize[_0x54b7('0xc')](_0x54b7('0xa')),_0x54b7('0xd')):_0x4427be[_0x54b7('0xe')](0x1),_0x54b7('0xf')];}else{return[_0x4427be===_0x54b7('0xa')?sequelize['cast'](sequelize[_0x54b7('0xc')](_0x54b7('0xa')),_0x54b7('0xd')):_0x4427be,_0x54b7('0x10')];}});}return _0x4b4582;};exports[_0x54b7('0x11')]=function(_0x285681,_0x315c22){if(_['isEmpty'](_0x285681)){return _0x285681;}if(_[_0x54b7('0x7')](_0x285681)){for(var _0x24981a=0x0;_0x24981a<_0x285681['length'];_0x24981a+=0x1){_0x285681[_0x24981a]=this['omit'](_0x285681[_0x24981a],_0x315c22);}return _0x285681;}if(!_[_0x54b7('0x12')](_0x285681)){return _0x285681;}if(_[_0x54b7('0x13')](_0x315c22)){_0x315c22=[_0x315c22];}if(!_[_0x54b7('0x7')](_0x315c22)){return _0x285681;}for(var _0x4fc03b=0x0;_0x4fc03b<_0x315c22['length'];_0x4fc03b+=0x1){_['unset'](_0x285681,_0x315c22[_0x4fc03b]);}for(var _0x5a76c9 in _0x285681){if(_0x285681[_0x54b7('0x14')](_0x5a76c9)){_0x285681[_0x5a76c9]=this[_0x54b7('0x11')](_0x285681[_0x5a76c9],_0x315c22);}}return _0x285681;};exports[_0x54b7('0x15')]=function(_0x2f8d26){return _0x2f8d26[_0x54b7('0x16')](RegExp('^[0-9]*$'))?!![]:![];};exports[_0x54b7('0x17')]=function(_0x378394){return _0x378394['match'](/^\S+@\S+$/)?!![]:![];};exports[_0x54b7('0x18')]=function(_0x3b8964){var _0x12e6b2=[];_0x3b8964[_0x54b7('0x3')]('\x20')['forEach'](function(_0x31553b){_0x12e6b2['push']('+'+_0x31553b['toString']()+'*');});return _0x12e6b2['join']('\x20');}; \ No newline at end of file +var _0x5b0d=['isNumeric','match','^[0-9]*$','isEmail','getFullTextValue','push','toString','join','lodash','sequelize','filters','isEmpty','forOwn','isArray','offset','split','map','priority','col','unsigned','DESC','cast','ASC','omit','isObject','isString','length','unset','hasOwnProperty'];(function(_0x3c581b,_0x323cc0){var _0xc2c62=function(_0x3608b5){while(--_0x3608b5){_0x3c581b['push'](_0x3c581b['shift']());}};_0xc2c62(++_0x323cc0);}(_0x5b0d,0x99));var _0xd5b0=function(_0x47bf6b,_0x3dd817){_0x47bf6b=_0x47bf6b-0x0;var _0x19e722=_0x5b0d[_0x47bf6b];return _0x19e722;};'use strict';var _=require(_0xd5b0('0x0'));var sequelize=require(_0xd5b0('0x1'));var LIMIT_VALUE=0xfa;exports['fields']=function(_0x1b06bd){var _0x1c352b=null;if(_0x1b06bd){_0x1c352b=_0x1b06bd['split'](',');}return _0x1c352b;};exports[_0xd5b0('0x2')]=function(_0x5934b8){var _0x3b5e5a={};if(!_[_0xd5b0('0x3')](_0x5934b8)){_0x3b5e5a={};_[_0xd5b0('0x4')](_0x5934b8,function(_0xe73df7,_0x5c2daa){try{_0x3b5e5a[_0x5c2daa]=_[_0xd5b0('0x5')](_0xe73df7)?_0xe73df7:JSON['parse'](_0xe73df7);}catch(_0x2d1e8c){_0x3b5e5a[_0x5c2daa]=_0xe73df7['split'](',');}});}return _0x3b5e5a;};exports['limit']=function(_0x210d2c){_0x210d2c=parseInt(_0x210d2c,0xa);if(!_0x210d2c||_0x210d2c<0x0){_0x210d2c=LIMIT_VALUE;}return _0x210d2c;};exports[_0xd5b0('0x6')]=function(_0x5c136e){_0x5c136e=parseInt(_0x5c136e,0xa);if(!_0x5c136e||_0x5c136e<0x0){_0x5c136e=0x0;}return _0x5c136e;};exports['sort']=function(_0x24f638){var _0xc1c519,_0x2bb411=null;if(_0x24f638){_0xc1c519=_0x24f638[_0xd5b0('0x7')](',');_0x2bb411=_[_0xd5b0('0x8')](_0xc1c519,function(_0x267b9e){if(_0x267b9e['indexOf']('-')===0x0){return[_0x267b9e===_0xd5b0('0x9')?sequelize['cast'](sequelize[_0xd5b0('0xa')](_0xd5b0('0x9')),_0xd5b0('0xb')):_0x267b9e['substr'](0x1),_0xd5b0('0xc')];}else{return[_0x267b9e===_0xd5b0('0x9')?sequelize[_0xd5b0('0xd')](sequelize[_0xd5b0('0xa')]('priority'),_0xd5b0('0xb')):_0x267b9e,_0xd5b0('0xe')];}});}return _0x2bb411;};exports['omit']=function(_0x2caf1e,_0x276329){if(_[_0xd5b0('0x3')](_0x2caf1e)){return _0x2caf1e;}if(_[_0xd5b0('0x5')](_0x2caf1e)){for(var _0x59970a=0x0;_0x59970a<_0x2caf1e['length'];_0x59970a+=0x1){_0x2caf1e[_0x59970a]=this[_0xd5b0('0xf')](_0x2caf1e[_0x59970a],_0x276329);}return _0x2caf1e;}if(!_[_0xd5b0('0x10')](_0x2caf1e)){return _0x2caf1e;}if(_[_0xd5b0('0x11')](_0x276329)){_0x276329=[_0x276329];}if(!_[_0xd5b0('0x5')](_0x276329)){return _0x2caf1e;}for(var _0x2fbc50=0x0;_0x2fbc50<_0x276329[_0xd5b0('0x12')];_0x2fbc50+=0x1){_[_0xd5b0('0x13')](_0x2caf1e,_0x276329[_0x2fbc50]);}for(var _0x13bd31 in _0x2caf1e){if(_0x2caf1e[_0xd5b0('0x14')](_0x13bd31)){_0x2caf1e[_0x13bd31]=this[_0xd5b0('0xf')](_0x2caf1e[_0x13bd31],_0x276329);}}return _0x2caf1e;};exports[_0xd5b0('0x15')]=function(_0x1cd630){return _0x1cd630[_0xd5b0('0x16')](RegExp(_0xd5b0('0x17')))?!![]:![];};exports[_0xd5b0('0x18')]=function(_0xdc0576){return _0xdc0576[_0xd5b0('0x16')](/^\S+@\S+$/)?!![]:![];};exports[_0xd5b0('0x19')]=function(_0x415b10){var _0x3f8c6c=[];_0x415b10[_0xd5b0('0x7')]('\x20')['forEach'](function(_0x57d9f4){_0x3f8c6c[_0xd5b0('0x1a')]('+'+_0x57d9f4[_0xd5b0('0x1b')]()+'*');});return _0x3f8c6c[_0xd5b0('0x1c')]('\x20');}; \ No newline at end of file diff --git a/server/config/express.js b/server/config/express.js index 8e44c30..c68941e 100644 --- a/server/config/express.js +++ b/server/config/express.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xfabe=['html','renderFile','view\x20engine','urlencoded','50mb','json','initialize','express','serve-favicon','body-parser','method-override','errorhandler','path','passport','cors','moment','../mysqldb','default','get','production','appPath','root','public','development','test','set','join','client','use','json\x20replacer','toISOString','static','views','/server/views','engine'];(function(_0x50697c,_0xea90f6){var _0x1a7f02=function(_0x2c3612){while(--_0x2c3612){_0x50697c['push'](_0x50697c['shift']());}};_0x1a7f02(++_0xea90f6);}(_0xfabe,0xb6));var _0xefab=function(_0x36bc65,_0x22fcfe){_0x36bc65=_0x36bc65-0x0;var _0x132ae3=_0xfabe[_0x36bc65];return _0x132ae3;};'use strict';var express=require(_0xefab('0x0'));var favicon=require(_0xefab('0x1'));var bodyParser=require(_0xefab('0x2'));var methodOverride=require(_0xefab('0x3'));var cookieParser=require('cookie-parser');var errorHandler=require(_0xefab('0x4'));var path=require(_0xefab('0x5'));var passport=require(_0xefab('0x6'));var cors=require(_0xefab('0x7'));var moment=require(_0xefab('0x8'));var config=require('./environment');var db=require(_0xefab('0x9'))['db'];exports[_0xefab('0xa')]=function(_0x5271c2){var _0x49973f=_0x5271c2[_0xefab('0xb')]('env');if(_0x49973f===_0xefab('0xc')){_0x5271c2['set'](_0xefab('0xd'),path['join'](config[_0xefab('0xe')],_0xefab('0xf')));}if(_0x49973f===_0xefab('0x10')||_0x49973f===_0xefab('0x11')){_0x5271c2[_0xefab('0x12')](_0xefab('0xd'),path[_0xefab('0x13')](config[_0xefab('0xe')],_0xefab('0x14')));_0x5271c2[_0xefab('0x15')](errorHandler());}_0x5271c2['set'](_0xefab('0x16'),function(_0x5a0423,_0x13db98){if(this[_0x5a0423]instanceof Date){_0x13db98=this[_0x5a0423][_0xefab('0x17')]()['split']('.')[0x0]+'Z';}return _0x13db98;});_0x5271c2[_0xefab('0x15')](express[_0xefab('0x18')](_0x5271c2[_0xefab('0xb')]('appPath')));_0x5271c2['set'](_0xefab('0x19'),config[_0xefab('0xe')]+_0xefab('0x1a'));_0x5271c2[_0xefab('0x1b')](_0xefab('0x1c'),require('ejs')[_0xefab('0x1d')]);_0x5271c2[_0xefab('0x12')](_0xefab('0x1e'),_0xefab('0x1c'));_0x5271c2['use'](bodyParser[_0xefab('0x1f')]({'limit':_0xefab('0x20'),'extended':!![]}));_0x5271c2['use'](bodyParser[_0xefab('0x21')]({'limit':_0xefab('0x20')}));_0x5271c2[_0xefab('0x15')](cors());_0x5271c2[_0xefab('0x15')](methodOverride());_0x5271c2['use'](cookieParser());_0x5271c2[_0xefab('0x15')](passport[_0xefab('0x22')]());}; \ No newline at end of file +var _0x8f75=['passport','cors','moment','./environment','../mysqldb','default','get','env','production','appPath','join','root','public','development','set','json\x20replacer','toISOString','split','use','static','/server/views','engine','html','ejs','view\x20engine','50mb','json','initialize','body-parser','cookie-parser','path'];(function(_0x4f9d1b,_0x462b56){var _0x338aa9=function(_0x3146c8){while(--_0x3146c8){_0x4f9d1b['push'](_0x4f9d1b['shift']());}};_0x338aa9(++_0x462b56);}(_0x8f75,0x152));var _0x58f7=function(_0x601c1,_0x499c87){_0x601c1=_0x601c1-0x0;var _0x3246b4=_0x8f75[_0x601c1];return _0x3246b4;};'use strict';var express=require('express');var favicon=require('serve-favicon');var bodyParser=require(_0x58f7('0x0'));var methodOverride=require('method-override');var cookieParser=require(_0x58f7('0x1'));var errorHandler=require('errorhandler');var path=require(_0x58f7('0x2'));var passport=require(_0x58f7('0x3'));var cors=require(_0x58f7('0x4'));var moment=require(_0x58f7('0x5'));var config=require(_0x58f7('0x6'));var db=require(_0x58f7('0x7'))['db'];exports[_0x58f7('0x8')]=function(_0x1f8f03){var _0x5554ea=_0x1f8f03[_0x58f7('0x9')](_0x58f7('0xa'));if(_0x5554ea===_0x58f7('0xb')){_0x1f8f03['set'](_0x58f7('0xc'),path[_0x58f7('0xd')](config[_0x58f7('0xe')],_0x58f7('0xf')));}if(_0x5554ea===_0x58f7('0x10')||_0x5554ea==='test'){_0x1f8f03[_0x58f7('0x11')]('appPath',path[_0x58f7('0xd')](config[_0x58f7('0xe')],'client'));_0x1f8f03['use'](errorHandler());}_0x1f8f03[_0x58f7('0x11')](_0x58f7('0x12'),function(_0x10efe8,_0x5305a4){if(this[_0x10efe8]instanceof Date){_0x5305a4=this[_0x10efe8][_0x58f7('0x13')]()[_0x58f7('0x14')]('.')[0x0]+'Z';}return _0x5305a4;});_0x1f8f03[_0x58f7('0x15')](express[_0x58f7('0x16')](_0x1f8f03[_0x58f7('0x9')]('appPath')));_0x1f8f03[_0x58f7('0x11')]('views',config[_0x58f7('0xe')]+_0x58f7('0x17'));_0x1f8f03[_0x58f7('0x18')](_0x58f7('0x19'),require(_0x58f7('0x1a'))['renderFile']);_0x1f8f03[_0x58f7('0x11')](_0x58f7('0x1b'),'html');_0x1f8f03['use'](bodyParser['urlencoded']({'limit':_0x58f7('0x1c'),'extended':!![]}));_0x1f8f03[_0x58f7('0x15')](bodyParser[_0x58f7('0x1d')]({'limit':_0x58f7('0x1c')}));_0x1f8f03[_0x58f7('0x15')](cors());_0x1f8f03[_0x58f7('0x15')](methodOverride());_0x1f8f03[_0x58f7('0x15')](cookieParser());_0x1f8f03['use'](passport[_0x58f7('0x1e')]());}; \ No newline at end of file diff --git a/server/config/license/hardware.js b/server/config/license/hardware.js index bf68da2..a9be421 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 _0x11e5=['model','join','createHash','md5','digest','hex','platform','win32','utf8','replace','hostname','macAddress','ipAddress','update','substring','lodash','bimedia-machine-uuid','child_process','networkInterfaces','orderBy','length','filter','IPv4','internal','concat','head','mac','00:00:00:00:00:00','address','127.0.0.1','map'];(function(_0xa464c9,_0x7c86d8){var _0x3d73c4=function(_0x5c2056){while(--_0x5c2056){_0xa464c9['push'](_0xa464c9['shift']());}};_0x3d73c4(++_0x7c86d8);}(_0x11e5,0x8b));var _0x511e=function(_0x2946ba,_0x3256a3){_0x2946ba=_0x2946ba-0x0;var _0x31458f=_0x11e5[_0x2946ba];return _0x31458f;};'use strict';var _=require(_0x511e('0x0'));var os=require('os');var crypto=require('crypto');var machine=require(_0x511e('0x1'));var exec=require(_0x511e('0x2'))['execSync'];function getInterfaces(){var _0x2947e4=[];var _0x30fb24=os[_0x511e('0x3')]();var _0x5cab33=_[_0x511e('0x4')](_['keys'](_0x30fb24));for(var _0x5923a7=0x0;_0x5923a7<_0x5cab33[_0x511e('0x5')];_0x5923a7++){var _0x323f8c=_0x30fb24[_0x5cab33[_0x5923a7]][_0x511e('0x6')](function(_0x57cac3){return _0x57cac3['family']===_0x511e('0x7')&&_0x57cac3[_0x511e('0x8')]===![];});_0x2947e4=_0x2947e4[_0x511e('0x9')](_0x323f8c);}return _0x2947e4;}function getFirstInterface(){var _0x306694=_[_0x511e('0xa')](getInterfaces());return{'macAddress':_0x306694&&_0x306694[_0x511e('0xb')]?_0x306694[_0x511e('0xb')]:_0x511e('0xc'),'ipAddress':_0x306694&&_0x306694[_0x511e('0xd')]?_0x306694[_0x511e('0xd')]:_0x511e('0xe')};}exports['getFirstInterface']=getFirstInterface;function getCPUhash(){var _0x7e50db=_['orderBy'](os['cpus']()[_0x511e('0xf')](function(_0x327880){return _0x327880[_0x511e('0x10')];}))[_0x511e('0x11')](':');return crypto[_0x511e('0x12')](_0x511e('0x13'))['update'](_0x7e50db)[_0x511e('0x14')](_0x511e('0x15'));}exports['getUuid']=function(){switch(os[_0x511e('0x16')]()){case _0x511e('0x17'):return exec('dmidecode\x20--string\x20system-uuid',{'encoding':_0x511e('0x18')})[_0x511e('0x19')]('\x0d\x0a','');default:var _0x3b990b=getFirstInterface();var _0x17fd4a=getCPUhash();var _0x5b6cd6=_0x17fd4a+'|'+os[_0x511e('0x1a')]()+'|'+_0x3b990b[_0x511e('0x1b')]+'|'+_0x3b990b[_0x511e('0x1c')];var _0x577616=crypto[_0x511e('0x12')]('md5')[_0x511e('0x1d')](_0x5b6cd6)['digest']('hex');return _0x577616[_0x511e('0x1e')](0x0,0x8)+'-'+_0x577616['substring'](0x8,0xc)+'-'+_0x577616[_0x511e('0x1e')](0xc,0x10)+'-'+_0x577616[_0x511e('0x1e')](0x10,0x14)+'-'+_0x577616[_0x511e('0x1e')](0x14);}}; \ No newline at end of file +var _0xd9ef=['getFirstInterface','cpus','map','model','join','createHash','md5','update','digest','hex','getUuid','platform','win32','utf8','hostname','ipAddress','substring','lodash','crypto','child_process','networkInterfaces','orderBy','keys','length','filter','family','IPv4','internal','concat','head','mac','00:00:00:00:00:00','address'];(function(_0x3f7982,_0x24c737){var _0x4e6a0d=function(_0x13b8ba){while(--_0x13b8ba){_0x3f7982['push'](_0x3f7982['shift']());}};_0x4e6a0d(++_0x24c737);}(_0xd9ef,0x95));var _0xfd9e=function(_0x49f702,_0x45166a){_0x49f702=_0x49f702-0x0;var _0xf10d16=_0xd9ef[_0x49f702];return _0xf10d16;};'use strict';var _=require(_0xfd9e('0x0'));var os=require('os');var crypto=require(_0xfd9e('0x1'));var machine=require('bimedia-machine-uuid');var exec=require(_0xfd9e('0x2'))['execSync'];function getInterfaces(){var _0x57c743=[];var _0x505f7f=os[_0xfd9e('0x3')]();var _0x28cfac=_[_0xfd9e('0x4')](_[_0xfd9e('0x5')](_0x505f7f));for(var _0x6f57f6=0x0;_0x6f57f6<_0x28cfac[_0xfd9e('0x6')];_0x6f57f6++){var _0x2d549f=_0x505f7f[_0x28cfac[_0x6f57f6]][_0xfd9e('0x7')](function(_0x261826){return _0x261826[_0xfd9e('0x8')]===_0xfd9e('0x9')&&_0x261826[_0xfd9e('0xa')]===![];});_0x57c743=_0x57c743[_0xfd9e('0xb')](_0x2d549f);}return _0x57c743;}function getFirstInterface(){var _0x49457a=_[_0xfd9e('0xc')](getInterfaces());return{'macAddress':_0x49457a&&_0x49457a[_0xfd9e('0xd')]?_0x49457a['mac']:_0xfd9e('0xe'),'ipAddress':_0x49457a&&_0x49457a[_0xfd9e('0xf')]?_0x49457a[_0xfd9e('0xf')]:'127.0.0.1'};}exports[_0xfd9e('0x10')]=getFirstInterface;function getCPUhash(){var _0x188629=_[_0xfd9e('0x4')](os[_0xfd9e('0x11')]()[_0xfd9e('0x12')](function(_0x5c2f96){return _0x5c2f96[_0xfd9e('0x13')];}))[_0xfd9e('0x14')](':');return crypto[_0xfd9e('0x15')](_0xfd9e('0x16'))[_0xfd9e('0x17')](_0x188629)[_0xfd9e('0x18')](_0xfd9e('0x19'));}exports[_0xfd9e('0x1a')]=function(){switch(os[_0xfd9e('0x1b')]()){case _0xfd9e('0x1c'):return exec('dmidecode\x20--string\x20system-uuid',{'encoding':_0xfd9e('0x1d')})['replace']('\x0d\x0a','');default:var _0x5e7d67=getFirstInterface();var _0x388ee8=getCPUhash();var _0x12aa09=_0x388ee8+'|'+os[_0xfd9e('0x1e')]()+'|'+_0x5e7d67['macAddress']+'|'+_0x5e7d67[_0xfd9e('0x1f')];var _0xee091f=crypto[_0xfd9e('0x15')](_0xfd9e('0x16'))[_0xfd9e('0x17')](_0x12aa09)[_0xfd9e('0x18')](_0xfd9e('0x19'));return _0xee091f['substring'](0x0,0x8)+'-'+_0xee091f[_0xfd9e('0x20')](0x8,0xc)+'-'+_0xee091f[_0xfd9e('0x20')](0xc,0x10)+'-'+_0xee091f[_0xfd9e('0x20')](0x10,0x14)+'-'+_0xee091f[_0xfd9e('0x20')](0x14);}}; \ No newline at end of file diff --git a/server/config/license/index.js b/server/config/license/index.js index 51efad2..720ca1a 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 _0x1a37=['format','%s/api/servers/%s/check?version=%s&oldtoken=%s','exports','GET','then','createCipher','aes-256-ctr','secrets','session','update','utf8','base64','final','||FIELD||VALUE||\x0a','User','findOne','admin','email','|reason|','|uuid|','|name|','|email|','getFirstInterface','openIssue','MOTLICENSE','Motion\x20License\x20Alert','Alert','get','active','data2','info','THE\x20LICENSE\x20HAS\x20BEEN\x20ENABLED','THE\x20LICENSE\x20HAS\x20BEEN\x20UPDATED','data1','THE\x20LICENSE\x20HAS\x20BEEN\x20DISABLED','Changed','NEW\x20UUID\x20DETECTED:\x20FROM\x20%s\x20TO\x20%s','uuid','%s\x20-\x20GRAY\x20PERIOD\x20STARTED\x20AT\x20%s','toUpperCase','YYYY-MM-DD\x20HH:mm','days','DEMO\x20START\x20AT\x20%s','error','message','finally','getUuid','License','findOrCreate','spread','SERVICE\x20LICENSE\x20STARTED\x20%s','catch','util','crypto','moment','request-promise','bluebird','pkginfo','version','../../mysqldb','../environment','./hardware','license','https://www.xcallymotion.com'];(function(_0x501bb4,_0x29acbf){var _0xdb7855=function(_0x3a1a53){while(--_0x3a1a53){_0x501bb4['push'](_0x501bb4['shift']());}};_0xdb7855(++_0x29acbf);}(_0x1a37,0xb4));var _0x71a3=function(_0x18cd5b,_0x10240b){_0x18cd5b=_0x18cd5b-0x0;var _0x5eaa52=_0x1a37[_0x18cd5b];return _0x5eaa52;};'use strict';var util=require(_0x71a3('0x0'));var crypto=require(_0x71a3('0x1'));var moment=require(_0x71a3('0x2'));var rp=require(_0x71a3('0x3'));var BPromise=require(_0x71a3('0x4'));var pkginfo=require(_0x71a3('0x5'))(module,_0x71a3('0x6'));var db=require(_0x71a3('0x7'))['db'];var config=require(_0x71a3('0x8'));var hardware=require(_0x71a3('0x9'));var logger=require('../logger')(_0x71a3('0xa'));var jira=require('../../api/jira/jira.controller');var HOST=_0x71a3('0xb');var TIME=0x3c*0x1388;var DAYS=0x7;var GRAY_PERIOD_REASON;var ADMIN;var oldToken;function httpRequest(_0x45050a){return new BPromise(function(_0x231ea7,_0x2bb6a2){var _0x4a9ab2=util['format']('%s/api/servers/%s/check?version=%s',HOST,_0x45050a,module['exports'][_0x71a3('0x6')]);if(oldToken){_0x4a9ab2=util[_0x71a3('0xc')](_0x71a3('0xd'),HOST,_0x45050a,module[_0x71a3('0xe')][_0x71a3('0x6')],oldToken);}var _0x2215f2={'uri':_0x4a9ab2,'method':_0x71a3('0xf'),'timeout':0xea60,'json':!![]};return rp(_0x2215f2)[_0x71a3('0x10')](function(_0x5c464c){_0x231ea7(_0x5c464c);})['catch'](function(_0x5e37e8){_0x2bb6a2(_0x5e37e8);});});}function encryptDate(_0x15923f){var _0x3830cb=crypto[_0x71a3('0x11')](_0x71a3('0x12'),config[_0x71a3('0x13')][_0x71a3('0x14')]);var _0x2bbc8c=_0x3830cb[_0x71a3('0x15')](_0x15923f,_0x71a3('0x16'),_0x71a3('0x17'));_0x2bbc8c+=_0x3830cb[_0x71a3('0x18')]('base64');return _0x2bbc8c;}function decryptDate(_0x1743d7){var _0x32591a=crypto['createDecipher']('aes-256-ctr',config[_0x71a3('0x13')][_0x71a3('0x14')]);var _0xee797f=_0x32591a[_0x71a3('0x15')](_0x1743d7,_0x71a3('0x17'),_0x71a3('0x16'));_0xee797f+=_0x32591a['final'](_0x71a3('0x16'));return _0xee797f;}function sendJiraAlert(_0x27bfb4,_0x5b955a,_0x5f4562){var _0x410a65=_0x71a3('0x19');return db[_0x71a3('0x1a')][_0x71a3('0x1b')]({'where':{'role':_0x71a3('0x1c')},'attributes':['fullname',_0x71a3('0x1d')],'raw':!![]})[_0x71a3('0x10')](function(_0x28535b){ADMIN=_0x28535b;_0x410a65+=_0x71a3('0x1e')+_0x5f4562+'|\x0a';_0x410a65+=_0x71a3('0x1f')+_0x27bfb4+'|\x0a';_0x410a65+='|machineUuid|'+_0x5b955a+'|\x0a';_0x410a65+=_0x71a3('0x20')+ADMIN['fullname']+'|\x0a';_0x410a65+=_0x71a3('0x21')+ADMIN[_0x71a3('0x1d')]+'|\x0a';return _0x410a65;})[_0x71a3('0x10')](function(_0x21899d){var _0x452bc4=hardware[_0x71a3('0x22')]()['ipAddress'];return jira[_0x71a3('0x23')]({'key':_0x71a3('0x24'),'summary':_0x71a3('0x25'),'description':_0x21899d,'issuetype':_0x71a3('0x26'),'oldToken':_0x27bfb4,'newToken':_0x5b955a,'email':ADMIN[_0x71a3('0x1d')],'name':ADMIN['fullname'],'reason':GRAY_PERIOD_REASON,'ip':_0x452bc4});});}function manageLicense(_0x107fbd,_0x2b414d){var _0x4c1a3d=_0x2b414d[_0x71a3('0x27')]({'plain':!![]});httpRequest(_0x107fbd)['then'](function(_0x46f1ff){if(oldToken){oldToken=undefined;}if(_0x46f1ff[_0x71a3('0x28')]){if(!_0x4c1a3d[_0x71a3('0xa')]&&_0x4c1a3d[_0x71a3('0xa')]!=_0x46f1ff[_0x71a3('0xa')]||_0x4c1a3d[_0x71a3('0xa')]&&_0x4c1a3d[_0x71a3('0x29')]){logger[_0x71a3('0x2a')](_0x71a3('0x2b'));}if(_0x4c1a3d[_0x71a3('0xa')]&&!_0x4c1a3d[_0x71a3('0x29')]&&_0x4c1a3d[_0x71a3('0xa')]!=_0x46f1ff['license']){logger[_0x71a3('0x2a')](_0x71a3('0x2c'));}if(_0x4c1a3d[_0x71a3('0xa')]&&!_0x4c1a3d[_0x71a3('0x29')]&&_0x4c1a3d['license']==_0x46f1ff[_0x71a3('0xa')]){return _0x2b414d;}return _0x2b414d[_0x71a3('0x15')]({'data1':_0x107fbd,'data2':null,'license':_0x46f1ff[_0x71a3('0xa')]});}else{if(_0x46f1ff[_0x71a3('0xa')]||_0x4c1a3d[_0x71a3('0xa')]){if(!_0x4c1a3d[_0x71a3('0x29')]){if(_0x4c1a3d[_0x71a3('0x2d')]==_0x107fbd){GRAY_PERIOD_REASON='Disabled';logger[_0x71a3('0x2a')](_0x71a3('0x2e'));}else{GRAY_PERIOD_REASON=_0x71a3('0x2f');oldToken=_0x4c1a3d[_0x71a3('0x2d')];logger[_0x71a3('0x2a')](_0x71a3('0x30'),_0x4c1a3d[_0x71a3('0x2d')],_0x107fbd);}sendJiraAlert(_0x4c1a3d[_0x71a3('0x2d')],_0x46f1ff[_0x71a3('0x31')],GRAY_PERIOD_REASON);logger[_0x71a3('0x2a')](_0x71a3('0x32'),GRAY_PERIOD_REASON[_0x71a3('0x33')](),moment()[_0x71a3('0xc')]('YYYY-MM-DD\x20HH:mm'));return _0x2b414d['update']({'data2':encryptDate(moment()[_0x71a3('0xc')](_0x71a3('0x34')))});}else{if(moment()['diff'](decryptDate(_0x4c1a3d[_0x71a3('0x29')]),_0x71a3('0x35'))>DAYS){logger['info'](_0x71a3('0x36'),moment()[_0x71a3('0xc')](_0x71a3('0x34')));return _0x2b414d[_0x71a3('0x15')]({'data1':_0x107fbd,'data2':null,'license':null});}}}else{if(_0x4c1a3d[_0x71a3('0x2d')]!=_0x107fbd){logger[_0x71a3('0x2a')](_0x71a3('0x30'),_0x4c1a3d['data1'],_0x107fbd);return _0x2b414d[_0x71a3('0x15')]({'data1':_0x107fbd,'data2':null,'license':null});}}}return _0x2b414d;})[_0x71a3('0x10')](function(_0x4043e7){_0x2b414d=_0x4043e7;})['catch'](function(_0x3fc9d3){logger[_0x71a3('0x37')](_0x3fc9d3[_0x71a3('0x38')]);})[_0x71a3('0x39')](function(){setTimeout(function(){manageLicense(hardware[_0x71a3('0x3a')](),_0x2b414d);},TIME);});}function defaultLicense(){var _0x54d03b=hardware['getUuid']();if(_0x54d03b){return db[_0x71a3('0x3b')][_0x71a3('0x3c')]({'where':{'id':0x1},'defaults':{'data1':_0x54d03b}})[_0x71a3('0x3d')](function(_0x1d7353,_0x36ed2e){logger['info'](_0x71a3('0x3e'),_0x54d03b);manageLicense(_0x54d03b,_0x1d7353);})[_0x71a3('0x3f')](function(_0x2458ba){logger['error'](_0x2458ba[_0x71a3('0x38')]);});}}exports['default']=defaultLicense; \ No newline at end of file +var _0xd991=['then','|reason|','|machineUuid|','|name|','|email|','getFirstInterface','ipAddress','openIssue','MOTLICENSE','Alert','active','data2','info','THE\x20LICENSE\x20HAS\x20BEEN\x20ENABLED','THE\x20LICENSE\x20HAS\x20BEEN\x20UPDATED','data1','Disabled','Changed','%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','License','findOrCreate','SERVICE\x20LICENSE\x20STARTED\x20%s','default','util','crypto','moment','request-promise','bluebird','version','../../mysqldb','../environment','./hardware','../logger','license','https://www.xcallymotion.com','format','%s/api/servers/%s/check?version=%s','exports','%s/api/servers/%s/check?version=%s&oldtoken=%s','GET','catch','createCipher','aes-256-ctr','secrets','session','utf8','final','createDecipher','update','fullname','email'];(function(_0x5678b5,_0x1c4aa8){var _0x4c09a5=function(_0x2aa89a){while(--_0x2aa89a){_0x5678b5['push'](_0x5678b5['shift']());}};_0x4c09a5(++_0x1c4aa8);}(_0xd991,0x115));var _0x1d99=function(_0x2105aa,_0x43c809){_0x2105aa=_0x2105aa-0x0;var _0x543abe=_0xd991[_0x2105aa];return _0x543abe;};'use strict';var util=require(_0x1d99('0x0'));var crypto=require(_0x1d99('0x1'));var moment=require(_0x1d99('0x2'));var rp=require(_0x1d99('0x3'));var BPromise=require(_0x1d99('0x4'));var pkginfo=require('pkginfo')(module,_0x1d99('0x5'));var db=require(_0x1d99('0x6'))['db'];var config=require(_0x1d99('0x7'));var hardware=require(_0x1d99('0x8'));var logger=require(_0x1d99('0x9'))(_0x1d99('0xa'));var jira=require('../../api/jira/jira.controller');var HOST=_0x1d99('0xb');var TIME=0x3c*0x1388;var DAYS=0x7;var GRAY_PERIOD_REASON;var ADMIN;var oldToken;function httpRequest(_0x440bb4){return new BPromise(function(_0x5100fc,_0x21d746){var _0x2f4502=util[_0x1d99('0xc')](_0x1d99('0xd'),HOST,_0x440bb4,module[_0x1d99('0xe')][_0x1d99('0x5')]);if(oldToken){_0x2f4502=util[_0x1d99('0xc')](_0x1d99('0xf'),HOST,_0x440bb4,module[_0x1d99('0xe')]['version'],oldToken);}var _0x3ca61a={'uri':_0x2f4502,'method':_0x1d99('0x10'),'timeout':0xea60,'json':!![]};return rp(_0x3ca61a)['then'](function(_0x1058a6){_0x5100fc(_0x1058a6);})[_0x1d99('0x11')](function(_0x38c1de){_0x21d746(_0x38c1de);});});}function encryptDate(_0x49f7f7){var _0x442843=crypto[_0x1d99('0x12')](_0x1d99('0x13'),config[_0x1d99('0x14')][_0x1d99('0x15')]);var _0x1e9bb8=_0x442843['update'](_0x49f7f7,_0x1d99('0x16'),'base64');_0x1e9bb8+=_0x442843[_0x1d99('0x17')]('base64');return _0x1e9bb8;}function decryptDate(_0x2f8738){var _0x1b2c78=crypto[_0x1d99('0x18')](_0x1d99('0x13'),config[_0x1d99('0x14')][_0x1d99('0x15')]);var _0x8cf8b8=_0x1b2c78[_0x1d99('0x19')](_0x2f8738,'base64',_0x1d99('0x16'));_0x8cf8b8+=_0x1b2c78['final'](_0x1d99('0x16'));return _0x8cf8b8;}function sendJiraAlert(_0x1a51a4,_0xb6555a,_0x34cd9b){var _0x209af7='||FIELD||VALUE||\x0a';return db['User']['findOne']({'where':{'role':'admin'},'attributes':[_0x1d99('0x1a'),_0x1d99('0x1b')],'raw':!![]})[_0x1d99('0x1c')](function(_0x374780){ADMIN=_0x374780;_0x209af7+=_0x1d99('0x1d')+_0x34cd9b+'|\x0a';_0x209af7+='|uuid|'+_0x1a51a4+'|\x0a';_0x209af7+=_0x1d99('0x1e')+_0xb6555a+'|\x0a';_0x209af7+=_0x1d99('0x1f')+ADMIN[_0x1d99('0x1a')]+'|\x0a';_0x209af7+=_0x1d99('0x20')+ADMIN[_0x1d99('0x1b')]+'|\x0a';return _0x209af7;})[_0x1d99('0x1c')](function(_0x3e7160){var _0x42e482=hardware[_0x1d99('0x21')]()[_0x1d99('0x22')];return jira[_0x1d99('0x23')]({'key':_0x1d99('0x24'),'summary':'Motion\x20License\x20Alert','description':_0x3e7160,'issuetype':_0x1d99('0x25'),'oldToken':_0x1a51a4,'newToken':_0xb6555a,'email':ADMIN[_0x1d99('0x1b')],'name':ADMIN[_0x1d99('0x1a')],'reason':GRAY_PERIOD_REASON,'ip':_0x42e482});});}function manageLicense(_0x30a1ef,_0x5c226a){var _0x27d9d9=_0x5c226a['get']({'plain':!![]});httpRequest(_0x30a1ef)[_0x1d99('0x1c')](function(_0x1930c5){if(oldToken){oldToken=undefined;}if(_0x1930c5[_0x1d99('0x26')]){if(!_0x27d9d9[_0x1d99('0xa')]&&_0x27d9d9['license']!=_0x1930c5[_0x1d99('0xa')]||_0x27d9d9[_0x1d99('0xa')]&&_0x27d9d9[_0x1d99('0x27')]){logger[_0x1d99('0x28')](_0x1d99('0x29'));}if(_0x27d9d9[_0x1d99('0xa')]&&!_0x27d9d9['data2']&&_0x27d9d9[_0x1d99('0xa')]!=_0x1930c5[_0x1d99('0xa')]){logger[_0x1d99('0x28')](_0x1d99('0x2a'));}if(_0x27d9d9[_0x1d99('0xa')]&&!_0x27d9d9['data2']&&_0x27d9d9[_0x1d99('0xa')]==_0x1930c5[_0x1d99('0xa')]){return _0x5c226a;}return _0x5c226a[_0x1d99('0x19')]({'data1':_0x30a1ef,'data2':null,'license':_0x1930c5[_0x1d99('0xa')]});}else{if(_0x1930c5[_0x1d99('0xa')]||_0x27d9d9[_0x1d99('0xa')]){if(!_0x27d9d9[_0x1d99('0x27')]){if(_0x27d9d9[_0x1d99('0x2b')]==_0x30a1ef){GRAY_PERIOD_REASON=_0x1d99('0x2c');logger[_0x1d99('0x28')]('THE\x20LICENSE\x20HAS\x20BEEN\x20DISABLED');}else{GRAY_PERIOD_REASON=_0x1d99('0x2d');oldToken=_0x27d9d9[_0x1d99('0x2b')];logger[_0x1d99('0x28')]('NEW\x20UUID\x20DETECTED:\x20FROM\x20%s\x20TO\x20%s',_0x27d9d9[_0x1d99('0x2b')],_0x30a1ef);}sendJiraAlert(_0x27d9d9[_0x1d99('0x2b')],_0x1930c5['uuid'],GRAY_PERIOD_REASON);logger[_0x1d99('0x28')](_0x1d99('0x2e'),GRAY_PERIOD_REASON[_0x1d99('0x2f')](),moment()[_0x1d99('0xc')](_0x1d99('0x30')));return _0x5c226a['update']({'data2':encryptDate(moment()[_0x1d99('0xc')](_0x1d99('0x30')))});}else{if(moment()[_0x1d99('0x31')](decryptDate(_0x27d9d9[_0x1d99('0x27')]),_0x1d99('0x32'))>DAYS){logger[_0x1d99('0x28')](_0x1d99('0x33'),moment()['format']('YYYY-MM-DD\x20HH:mm'));return _0x5c226a[_0x1d99('0x19')]({'data1':_0x30a1ef,'data2':null,'license':null});}}}else{if(_0x27d9d9[_0x1d99('0x2b')]!=_0x30a1ef){logger[_0x1d99('0x28')](_0x1d99('0x34'),_0x27d9d9[_0x1d99('0x2b')],_0x30a1ef);return _0x5c226a['update']({'data1':_0x30a1ef,'data2':null,'license':null});}}}return _0x5c226a;})[_0x1d99('0x1c')](function(_0x41dfa3){_0x5c226a=_0x41dfa3;})[_0x1d99('0x11')](function(_0x276e83){logger[_0x1d99('0x35')](_0x276e83[_0x1d99('0x36')]);})[_0x1d99('0x37')](function(){setTimeout(function(){manageLicense(hardware[_0x1d99('0x38')](),_0x5c226a);},TIME);});}function defaultLicense(){var _0x4a4c36=hardware[_0x1d99('0x38')]();if(_0x4a4c36){return db[_0x1d99('0x39')][_0x1d99('0x3a')]({'where':{'id':0x1},'defaults':{'data1':_0x4a4c36}})['spread'](function(_0x32b5c0,_0x478624){logger['info'](_0x1d99('0x3b'),_0x4a4c36);manageLicense(_0x4a4c36,_0x32b5c0);})[_0x1d99('0x11')](function(_0x17b40e){logger[_0x1d99('0x35')](_0x17b40e['message']);});}}exports[_0x1d99('0x3c')]=defaultLicense; \ No newline at end of file diff --git a/server/config/license/util.js b/server/config/license/util.js index e710c2d..05ab593 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 _0xef8b=['parse','demo','getUuid','secrets','base64','gray','deadline','days','grayReason','uuid','machineUuid','changed','disabled','2027-01-01T00:00:00.000Z','Breaking\x20license','message','Demo\x20license','data1','getLicense','License','find','defaults','checkLicense','crypto','util','lodash','moment','./hardware','../environment','../../mysqldb','license','License\x20key\x20value\x20not\x20found','data2','split','createDecipher','aes-256-ctr','update','utf8','final'];(function(_0x4ec890,_0x231590){var _0x59d83a=function(_0x444ab0){while(--_0x444ab0){_0x4ec890['push'](_0x4ec890['shift']());}};_0x59d83a(++_0x231590);}(_0xef8b,0xb3));var _0xbef8=function(_0x53e19d,_0x604957){_0x53e19d=_0x53e19d-0x0;var _0x5ba332=_0xef8b[_0x53e19d];return _0x5ba332;};'use strict';var crypto=require(_0xbef8('0x0'));var util=require(_0xbef8('0x1'));var _=require(_0xbef8('0x2'));var moment=require(_0xbef8('0x3'));var hardware=require(_0xbef8('0x4'));var config=require(_0xbef8('0x5'));var db=require(_0xbef8('0x6'))['db'];function checkLicense(_0x5d826e,_0x5d4b28){if(_0x5d826e){try{var _0x16490e=_0x5d4b28||_0x5d826e[_0xbef8('0x7')];if(_['isEmpty'](_0x16490e)){throw new Error(_0xbef8('0x8'));}var _0xeec6c2=_0x5d826e['data1'];var _0xac5ac1=_0x5d826e[_0xbef8('0x9')];var _0x1d12e0=_0xeec6c2[_0xbef8('0xa')]('-')[0x4];var _0xb17d1f=_0xeec6c2[_0xbef8('0xa')]('-')[0x0];var _0x504edc=crypto[_0xbef8('0xb')](_0xbef8('0xc'),util['format']('%s:%s:%s',_0x1d12e0,_0xeec6c2,_0xb17d1f));var _0x5d384b=_0x504edc[_0xbef8('0xd')](_0x16490e,'base64',_0xbef8('0xe'));_0x5d384b+=_0x504edc[_0xbef8('0xf')](_0xbef8('0xe'));var _0xc8089f=JSON[_0xbef8('0x10')](_0x5d384b);_0xc8089f[_0xbef8('0x11')]=![];_0xc8089f['uuid']=_0xeec6c2;_0xc8089f['machineUuid']=hardware[_0xbef8('0x12')]();if(_0xac5ac1){var _0x1834ae=crypto['createDecipher'](_0xbef8('0xc'),config[_0xbef8('0x13')]['session']);var _0x598d62=_0x1834ae[_0xbef8('0xd')](_0xac5ac1,_0xbef8('0x14'),_0xbef8('0xe'));_0x598d62+=_0x1834ae[_0xbef8('0xf')](_0xbef8('0xe'));_0xc8089f[_0xbef8('0x15')]=_0x598d62;_0xc8089f[_0xbef8('0x16')]=moment(_0x598d62)['add'](0x7,_0xbef8('0x17'))['format']();_0xc8089f[_0xbef8('0x18')]=_0xc8089f[_0xbef8('0x19')]!=_0xc8089f[_0xbef8('0x1a')]?_0xbef8('0x1b'):_0xbef8('0x1c');}return _0xc8089f;}catch(_0x167dbe){return{'breaking':!![],'demo':!![],'agents':0x2,'telephones':0x0,'users':0x1,'expiration':_0xbef8('0x1d'),'chat':![],'mail':![],'fax':![],'messaging':![],'cm':![],'dialer':![],'jscripty':![],'openchannel':![],'callysquare':0x2,'webrtc':![],'jaws':![],'custom':![],'update':![],'description':_0xbef8('0x1e'),'uuid':_0x5d826e['data1'],'machineUuid':hardware['getUuid'](),'message':_0x167dbe[_0xbef8('0x1f')],'virtual':0x0,'voice':!![],'screenrecording':![],'preferred':![]};}}return{'demo':!![],'agents':0x2,'telephones':0x0,'users':0x1,'expiration':_0xbef8('0x1d'),'chat':![],'mail':![],'fax':![],'messaging':![],'cm':![],'dialer':![],'jscripty':![],'openchannel':![],'callysquare':0x2,'webrtc':![],'jaws':![],'custom':![],'description':_0xbef8('0x20'),'uuid':_0x5d826e[_0xbef8('0x21')],'machineUuid':hardware[_0xbef8('0x12')](),'virtual':0x0,'voice':!![],'screenrecording':![],'preferred':![]};}exports[_0xbef8('0x22')]=function(_0x22eb99){return db[_0xbef8('0x23')][_0xbef8('0x24')](_[_0xbef8('0x25')](_0x22eb99,{'raw':!![],'where':{'id':0x1}}))['then'](function(_0x22542e){return checkLicense(_0x22542e,null);});};exports[_0xbef8('0x26')]=checkLicense; \ No newline at end of file +var _0x9391=['deadline','days','machineUuid','disabled','2027-01-01T00:00:00.000Z','getUuid','getLicense','License','defaults','util','lodash','moment','./hardware','../environment','license','data1','data2','split','createDecipher','aes-256-ctr','format','%s:%s:%s','update','utf8','final','parse','uuid','secrets','session','base64'];(function(_0x3c4caa,_0x3f9f60){var _0xb5c714=function(_0x23986e){while(--_0x23986e){_0x3c4caa['push'](_0x3c4caa['shift']());}};_0xb5c714(++_0x3f9f60);}(_0x9391,0xf9));var _0x1939=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x9391[_0x321bb2];return _0x9c12ed;};'use strict';var crypto=require('crypto');var util=require(_0x1939('0x0'));var _=require(_0x1939('0x1'));var moment=require(_0x1939('0x2'));var hardware=require(_0x1939('0x3'));var config=require(_0x1939('0x4'));var db=require('../../mysqldb')['db'];function checkLicense(_0x3e073c,_0x315f84){if(_0x3e073c){try{var _0x29f020=_0x315f84||_0x3e073c[_0x1939('0x5')];if(_['isEmpty'](_0x29f020)){throw new Error('License\x20key\x20value\x20not\x20found');}var _0x7b1b49=_0x3e073c[_0x1939('0x6')];var _0x578600=_0x3e073c[_0x1939('0x7')];var _0x354e1d=_0x7b1b49[_0x1939('0x8')]('-')[0x4];var _0x348104=_0x7b1b49[_0x1939('0x8')]('-')[0x0];var _0x16af79=crypto[_0x1939('0x9')](_0x1939('0xa'),util[_0x1939('0xb')](_0x1939('0xc'),_0x354e1d,_0x7b1b49,_0x348104));var _0x39d037=_0x16af79[_0x1939('0xd')](_0x29f020,'base64',_0x1939('0xe'));_0x39d037+=_0x16af79[_0x1939('0xf')](_0x1939('0xe'));var _0x5a34ce=JSON[_0x1939('0x10')](_0x39d037);_0x5a34ce['demo']=![];_0x5a34ce[_0x1939('0x11')]=_0x7b1b49;_0x5a34ce['machineUuid']=hardware['getUuid']();if(_0x578600){var _0x203a74=crypto['createDecipher']('aes-256-ctr',config[_0x1939('0x12')][_0x1939('0x13')]);var _0x16a566=_0x203a74[_0x1939('0xd')](_0x578600,_0x1939('0x14'),_0x1939('0xe'));_0x16a566+=_0x203a74[_0x1939('0xf')](_0x1939('0xe'));_0x5a34ce['gray']=_0x16a566;_0x5a34ce[_0x1939('0x15')]=moment(_0x16a566)['add'](0x7,_0x1939('0x16'))[_0x1939('0xb')]();_0x5a34ce['grayReason']=_0x5a34ce[_0x1939('0x11')]!=_0x5a34ce[_0x1939('0x17')]?'changed':_0x1939('0x18');}return _0x5a34ce;}catch(_0x2e25d7){return{'breaking':!![],'demo':!![],'agents':0x2,'telephones':0x0,'users':0x1,'expiration':_0x1939('0x19'),'chat':![],'mail':![],'fax':![],'messaging':![],'cm':![],'dialer':![],'jscripty':![],'openchannel':![],'callysquare':0x2,'webrtc':![],'jaws':![],'custom':![],'update':![],'description':'Breaking\x20license','uuid':_0x3e073c['data1'],'machineUuid':hardware['getUuid'](),'message':_0x2e25d7['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':'Demo\x20license','uuid':_0x3e073c['data1'],'machineUuid':hardware[_0x1939('0x1a')](),'virtual':0x0,'voice':!![],'screenrecording':![],'preferred':![]};}exports[_0x1939('0x1b')]=function(_0x50aecc){return db[_0x1939('0x1c')]['find'](_[_0x1939('0x1d')](_0x50aecc,{'raw':!![],'where':{'id':0x1}}))['then'](function(_0x3df3fb){return checkLicense(_0x3df3fb,null);});};exports['checkLicense']=checkLicense; \ No newline at end of file diff --git a/server/config/local.env.js b/server/config/local.env.js index 3986531..1b81e8c 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 _0x4bf2=['myappanuglar-secret','app-id','secret','http://localhost:9000'];(function(_0x2efc42,_0x4a5f87){var _0x32808c=function(_0x5356bc){while(--_0x5356bc){_0x2efc42['push'](_0x2efc42['shift']());}};_0x32808c(++_0x4a5f87);}(_0x4bf2,0xa3));var _0x24bf=function(_0x5842eb,_0x585f4c){_0x5842eb=_0x5842eb-0x0;var _0x3eca2d=_0x4bf2[_0x5842eb];return _0x3eca2d;};'use strict';module['exports']={'DOMAIN':_0x24bf('0x0'),'SESSION_SECRET':_0x24bf('0x1'),'GOOGLE_ID':_0x24bf('0x2'),'GOOGLE_SECRET':_0x24bf('0x3'),'DEBUG':''}; \ No newline at end of file +var _0xfc37=['app-id','exports','http://localhost:9000','myappanuglar-secret'];(function(_0x21592b,_0x515c2e){var _0x165f78=function(_0x28cf38){while(--_0x28cf38){_0x21592b['push'](_0x21592b['shift']());}};_0x165f78(++_0x515c2e);}(_0xfc37,0x17d));var _0x7fc3=function(_0x113346,_0x3cd644){_0x113346=_0x113346-0x0;var _0x360a8e=_0xfc37[_0x113346];return _0x360a8e;};'use strict';module[_0x7fc3('0x0')]={'DOMAIN':_0x7fc3('0x1'),'SESSION_SECRET':_0x7fc3('0x2'),'GOOGLE_ID':_0x7fc3('0x3'),'GOOGLE_SECRET':'secret','DEBUG':''}; \ No newline at end of file diff --git a/server/config/logger.js b/server/config/logger.js index 9d9876b..77f5db0 100644 --- a/server/config/logger.js +++ b/server/config/logger.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x990c=['%s-%s','error','info','Console','env','debugLevel','moment','winston','util','path','INFO','/var','xcally','format','level','toUpperCase','exports','transports','File'];(function(_0x9c75f4,_0xc54e83){var _0x57f1db=function(_0x42c906){while(--_0x42c906){_0x9c75f4['push'](_0x9c75f4['shift']());}};_0x57f1db(++_0xc54e83);}(_0x990c,0x8b));var _0xc990=function(_0x14217b,_0x1d7653){_0x14217b=_0x14217b-0x0;var _0x693277=_0x990c[_0x14217b];return _0x693277;};'use strict';var moment=require(_0xc990('0x0'));var winston=require(_0xc990('0x1'));var util=require(_0xc990('0x2'));var path=require(_0xc990('0x3'));var debugLevel=_0xc990('0x4');function filename(_0x20799f,_0x25dbdc){return path['join'](_0xc990('0x5'),'log',_0xc990('0x6'),util[_0xc990('0x7')]('%s-%s.log',_0x20799f,_0x25dbdc));}function formatter(_0x515d56,_0x3a110b){return util[_0xc990('0x7')]('[%s]\x20[%s]\x20%s\x20-\x20%s',moment()[_0xc990('0x7')]('YYYY-MM-DD\x20HH:mm:ss'),_0x3a110b[_0xc990('0x8')][_0xc990('0x9')](),_0x515d56,_0x3a110b['message']);}module[_0xc990('0xa')]=function(_0x587aec){return new winston['Logger']({'transports':[new winston[(_0xc990('0xb'))][(_0xc990('0xc'))]({'name':util[_0xc990('0x7')](_0xc990('0xd'),_0x587aec,'error'),'filename':filename(_0x587aec,'error'),'level':_0xc990('0xe'),'json':![],'maxsize':0xa00000,'maxFiles':0xa,'tailable':!![],'formatter':function(_0x4f3d9a){return formatter(_0x587aec,_0x4f3d9a);}}),new winston['transports'][(_0xc990('0xc'))]({'name':util[_0xc990('0x7')](_0xc990('0xd'),_0x587aec,_0xc990('0xf')),'filename':filename(_0x587aec,'info'),'level':_0xc990('0xf'),'json':![],'maxsize':0xa00000,'maxFiles':0xa,'tailable':!![],'formatter':function(_0x4db809){return formatter(_0x587aec,_0x4db809);}}),new winston[(_0xc990('0xb'))][(_0xc990('0x10'))]({'level':process[_0xc990('0x11')][_0xc990('0x12')]||debugLevel,'json':![],'formatter':function(_0x9821b0){return formatter(_0x587aec,_0x9821b0);}})]});}; \ No newline at end of file +var _0x88a8=['/var','log','xcally','format','[%s]\x20[%s]\x20%s\x20-\x20%s','YYYY-MM-DD\x20HH:mm:ss','level','toUpperCase','message','Logger','transports','%s-%s','error','File','info','Console','env','debugLevel','util','path','INFO','join'];(function(_0x39a031,_0x2dc4e4){var _0x3a5988=function(_0x24f50e){while(--_0x24f50e){_0x39a031['push'](_0x39a031['shift']());}};_0x3a5988(++_0x2dc4e4);}(_0x88a8,0x15c));var _0x888a=function(_0x36d2aa,_0x490f1c){_0x36d2aa=_0x36d2aa-0x0;var _0x39221f=_0x88a8[_0x36d2aa];return _0x39221f;};'use strict';var moment=require('moment');var winston=require('winston');var util=require(_0x888a('0x0'));var path=require(_0x888a('0x1'));var debugLevel=_0x888a('0x2');function filename(_0x522ea8,_0x87e06e){return path[_0x888a('0x3')](_0x888a('0x4'),_0x888a('0x5'),_0x888a('0x6'),util[_0x888a('0x7')]('%s-%s.log',_0x522ea8,_0x87e06e));}function formatter(_0x6e3a24,_0x59760e){return util[_0x888a('0x7')](_0x888a('0x8'),moment()[_0x888a('0x7')](_0x888a('0x9')),_0x59760e[_0x888a('0xa')][_0x888a('0xb')](),_0x6e3a24,_0x59760e[_0x888a('0xc')]);}module['exports']=function(_0x4f67ff){return new winston[(_0x888a('0xd'))]({'transports':[new winston[(_0x888a('0xe'))]['File']({'name':util[_0x888a('0x7')](_0x888a('0xf'),_0x4f67ff,_0x888a('0x10')),'filename':filename(_0x4f67ff,_0x888a('0x10')),'level':_0x888a('0x10'),'json':![],'maxsize':0xa00000,'maxFiles':0xa,'tailable':!![],'formatter':function(_0x4d3436){return formatter(_0x4f67ff,_0x4d3436);}}),new winston[(_0x888a('0xe'))][(_0x888a('0x11'))]({'name':util[_0x888a('0x7')](_0x888a('0xf'),_0x4f67ff,_0x888a('0x12')),'filename':filename(_0x4f67ff,'info'),'level':_0x888a('0x12'),'json':![],'maxsize':0xa00000,'maxFiles':0xa,'tailable':!![],'formatter':function(_0x3be41d){return formatter(_0x4f67ff,_0x3be41d);}}),new winston[(_0x888a('0xe'))][(_0x888a('0x13'))]({'level':process[_0x888a('0x14')][_0x888a('0x15')]||debugLevel,'json':![],'formatter':function(_0x44fac8){return formatter(_0x4f67ff,_0x44fac8);}})]});}; \ No newline at end of file diff --git a/server/config/pm2/config.js b/server/config/pm2/config.js index bf5242d..78bae9f 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 _0x3036=['../../services/email/index.js','routing','xdr','../../services/xdr/index.js','exports','join','../../services/express/index.js','ami','../../services/ami/index.js','email'];(function(_0x3b87f4,_0x112243){var _0x63d16e=function(_0x3e7323){while(--_0x3e7323){_0x3b87f4['push'](_0x3b87f4['shift']());}};_0x63d16e(++_0x112243);}(_0x3036,0x1a9));var _0x6303=function(_0x56f90c,_0x3bf2de){_0x56f90c=_0x56f90c-0x0;var _0x13c37f=_0x3036[_0x56f90c];return _0x13c37f;};'use strict';var path=require('path');var os=require('os');var config={'apps':[{'name':'express','script':path[_0x6303('0x0')](__dirname,_0x6303('0x1'))},{'name':_0x6303('0x2'),'script':path['join'](__dirname,_0x6303('0x3'))},{'name':'agi','script':path['join'](__dirname,'../../services/agi/index.js')},{'name':_0x6303('0x4'),'script':path['join'](__dirname,_0x6303('0x5'))},{'name':_0x6303('0x6'),'script':path[_0x6303('0x0')](__dirname,'../../services/routing/index.js')},{'name':_0x6303('0x7'),'script':path[_0x6303('0x0')](__dirname,_0x6303('0x8'))}]};module[_0x6303('0x9')]=config; \ No newline at end of file +var _0xf363=['../../services/xdr/index.js','express','join','../../services/express/index.js','ami','agi','../../services/agi/index.js','email','../../services/email/index.js','routing','../../services/routing/index.js','xdr'];(function(_0x1128f2,_0x268393){var _0x2c7786=function(_0x3d1699){while(--_0x3d1699){_0x1128f2['push'](_0x1128f2['shift']());}};_0x2c7786(++_0x268393);}(_0xf363,0xd9));var _0x3f36=function(_0x233c03,_0x7c58ea){_0x233c03=_0x233c03-0x0;var _0x28a5db=_0xf363[_0x233c03];return _0x28a5db;};'use strict';var path=require('path');var os=require('os');var config={'apps':[{'name':_0x3f36('0x0'),'script':path[_0x3f36('0x1')](__dirname,_0x3f36('0x2'))},{'name':_0x3f36('0x3'),'script':path[_0x3f36('0x1')](__dirname,'../../services/ami/index.js')},{'name':_0x3f36('0x4'),'script':path[_0x3f36('0x1')](__dirname,_0x3f36('0x5'))},{'name':_0x3f36('0x6'),'script':path[_0x3f36('0x1')](__dirname,_0x3f36('0x7'))},{'name':_0x3f36('0x8'),'script':path['join'](__dirname,_0x3f36('0x9'))},{'name':_0x3f36('0xa'),'script':path['join'](__dirname,_0x3f36('0xb'))}]};module['exports']=config; \ No newline at end of file diff --git a/server/config/pm2/index.js b/server/config/pm2/index.js index 81dabba..dd650c5 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 _0xdc0d=['bluebird','connect','connected','start','then','disconnect','stop','restart','list','describe','delete','dump','saved','pm2'];(function(_0x194158,_0x5cba12){var _0x52b902=function(_0x19492b){while(--_0x19492b){_0x194158['push'](_0x194158['shift']());}};_0x52b902(++_0x5cba12);}(_0xdc0d,0x1db));var _0xddc0=function(_0x51605e,_0x40bcd9){_0x51605e=_0x51605e-0x0;var _0x1afe45=_0xdc0d[_0x51605e];return _0x1afe45;};'use strict';var pm2=require(_0xddc0('0x0'));var BPromise=require(_0xddc0('0x1'));var config=require('./config');function connect(){return new BPromise(function(_0x3b6966,_0x558a1a){return pm2[_0xddc0('0x2')](function(_0xac8cc5){if(_0xac8cc5){return _0x558a1a(_0xac8cc5);}return _0x3b6966(_0xddc0('0x3'));});});};exports[_0xddc0('0x4')]=function(_0xb4e3f){return connect()[_0xddc0('0x5')](function(){return new BPromise(function(_0x2d915c,_0x39a8da){return pm2[_0xddc0('0x4')](_0xb4e3f,function(_0x5dca02,_0x350899){if(_0x5dca02){return _0x39a8da(_0x5dca02);}pm2[_0xddc0('0x6')]();return _0x2d915c(_0x350899);});});});};exports[_0xddc0('0x7')]=function(_0x288149){return connect()[_0xddc0('0x5')](function(){return new BPromise(function(_0x3aad0e,_0x5ddc10){return pm2[_0xddc0('0x7')](_0x288149,function(_0xb4a23d,_0x388a4b){if(_0xb4a23d){return _0x5ddc10(_0xb4a23d);}pm2[_0xddc0('0x6')]();return _0x3aad0e(_0x388a4b);});});});};exports[_0xddc0('0x8')]=function(_0x30bf3f){return connect()[_0xddc0('0x5')](function(){return new BPromise(function(_0x36cf5e,_0x53075e){return pm2[_0xddc0('0x8')](_0x30bf3f,function(_0x4168a3,_0x52038b){if(_0x4168a3){return _0x53075e(_0x4168a3);}pm2[_0xddc0('0x6')]();return _0x36cf5e(_0x52038b);});});});};exports[_0xddc0('0x9')]=function(){return connect()[_0xddc0('0x5')](function(){return new BPromise(function(_0x39d44c,_0x2faa0d){return pm2['list'](function(_0xd08dd7,_0x28d771){if(_0xd08dd7){return _0x2faa0d(_0xd08dd7);}pm2['disconnect']();return _0x39d44c(_0x28d771);});});});};exports[_0xddc0('0xa')]=function(_0x4bb771){return connect()[_0xddc0('0x5')](function(){return new BPromise(function(_0x135468,_0x235f63){return pm2['describe'](_0x4bb771,function(_0x512951,_0x22cf96){if(_0x512951){return _0x235f63(_0x512951);}pm2[_0xddc0('0x6')]();return _0x135468(_0x22cf96);});});});};exports[_0xddc0('0xb')]=function(_0x22d0b0){return connect()['then'](function(){return new BPromise(function(_0x3fe789,_0x3c55da){return pm2[_0xddc0('0xb')](_0x22d0b0,function(_0x3aedb2,_0x54875b){if(_0x3aedb2){return _0x3c55da(_0x3aedb2);}pm2[_0xddc0('0x6')]();return _0x3fe789(_0x54875b);});});});};exports[_0xddc0('0xc')]=function(){return connect()[_0xddc0('0x5')](function(){return new BPromise(function(_0x5d1864,_0x8cbb4d){return pm2['dump'](function(_0x2accad){if(_0x2accad){return _0x8cbb4d(_0x2accad);}return _0x5d1864(_0xddc0('0xd'));});});});}; \ No newline at end of file +var _0x5e0c=['stop','disconnect','restart','list','describe','delete','dump','bluebird','./config','connect','start','then'];(function(_0x495cac,_0x4ee370){var _0x336443=function(_0xd5ca6f){while(--_0xd5ca6f){_0x495cac['push'](_0x495cac['shift']());}};_0x336443(++_0x4ee370);}(_0x5e0c,0x19f));var _0xc5e0=function(_0x47d804,_0x5cc88f){_0x47d804=_0x47d804-0x0;var _0x284c47=_0x5e0c[_0x47d804];return _0x284c47;};'use strict';var pm2=require('pm2');var BPromise=require(_0xc5e0('0x0'));var config=require(_0xc5e0('0x1'));function connect(){return new BPromise(function(_0x3e355f,_0x41596c){return pm2[_0xc5e0('0x2')](function(_0x1400f3){if(_0x1400f3){return _0x41596c(_0x1400f3);}return _0x3e355f('connected');});});};exports[_0xc5e0('0x3')]=function(_0x108ea2){return connect()[_0xc5e0('0x4')](function(){return new BPromise(function(_0x2427ef,_0x665907){return pm2['start'](_0x108ea2,function(_0x4b46de,_0x12b5cb){if(_0x4b46de){return _0x665907(_0x4b46de);}pm2['disconnect']();return _0x2427ef(_0x12b5cb);});});});};exports[_0xc5e0('0x5')]=function(_0x398b67){return connect()[_0xc5e0('0x4')](function(){return new BPromise(function(_0xc7c777,_0x5ce913){return pm2[_0xc5e0('0x5')](_0x398b67,function(_0x558bbd,_0x37627e){if(_0x558bbd){return _0x5ce913(_0x558bbd);}pm2[_0xc5e0('0x6')]();return _0xc7c777(_0x37627e);});});});};exports[_0xc5e0('0x7')]=function(_0x2863e4){return connect()[_0xc5e0('0x4')](function(){return new BPromise(function(_0x44980b,_0x508d9a){return pm2[_0xc5e0('0x7')](_0x2863e4,function(_0x239620,_0x3de61c){if(_0x239620){return _0x508d9a(_0x239620);}pm2[_0xc5e0('0x6')]();return _0x44980b(_0x3de61c);});});});};exports[_0xc5e0('0x8')]=function(){return connect()['then'](function(){return new BPromise(function(_0x3d0503,_0x402f5d){return pm2['list'](function(_0x55e389,_0x2fa026){if(_0x55e389){return _0x402f5d(_0x55e389);}pm2['disconnect']();return _0x3d0503(_0x2fa026);});});});};exports['describe']=function(_0xcf0eba){return connect()[_0xc5e0('0x4')](function(){return new BPromise(function(_0x310537,_0x24700e){return pm2[_0xc5e0('0x9')](_0xcf0eba,function(_0x247138,_0x1667b9){if(_0x247138){return _0x24700e(_0x247138);}pm2[_0xc5e0('0x6')]();return _0x310537(_0x1667b9);});});});};exports[_0xc5e0('0xa')]=function(_0x1baf22){return connect()[_0xc5e0('0x4')](function(){return new BPromise(function(_0x21cf18,_0x7cdb63){return pm2[_0xc5e0('0xa')](_0x1baf22,function(_0x5c534d,_0x50db3a){if(_0x5c534d){return _0x7cdb63(_0x5c534d);}pm2[_0xc5e0('0x6')]();return _0x21cf18(_0x50db3a);});});});};exports[_0xc5e0('0xb')]=function(){return connect()[_0xc5e0('0x4')](function(){return new BPromise(function(_0x2dba3d,_0x4214b0){return pm2[_0xc5e0('0xb')](function(_0x4a07e8){if(_0x4a07e8){return _0x4214b0(_0x4a07e8);}return _0x2dba3d('saved');});});});}; \ No newline at end of file diff --git a/server/config/schedule/chat.js b/server/config/schedule/chat.js index 518d6dd..7940333 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 _0xe680=['redis','defaults','localhost','socket.io-emitter','Setting','find','chatTimeout','then','subtract','minutes','ChatInteraction','update','timeout','format','map','error','start','lodash','moment','ioredis','../../mysqldb'];(function(_0x35bad0,_0x21927d){var _0x4fe50f=function(_0x1873df){while(--_0x1873df){_0x35bad0['push'](_0x35bad0['shift']());}};_0x4fe50f(++_0x21927d);}(_0xe680,0x8f));var _0x0e68=function(_0x5d0609,_0x127562){_0x5d0609=_0x5d0609-0x0;var _0xaa3fd1=_0xe680[_0x5d0609];return _0xaa3fd1;};'use strict';var _=require(_0x0e68('0x0'));var moment=require(_0x0e68('0x1'));var Redis=require(_0x0e68('0x2'));var db=require(_0x0e68('0x3'))['db'];var config=require('../../config/environment');config[_0x0e68('0x4')]=_[_0x0e68('0x5')](config[_0x0e68('0x4')],{'host':_0x0e68('0x6'),'port':0x18eb});var io=require(_0x0e68('0x7'))(new Redis(config[_0x0e68('0x4')]));function closeInteractions(){var _0x4f0479=0x0;var _0x1a0ba0=[];return db[_0x0e68('0x8')][_0x0e68('0x9')]({'raw':!![],'attributes':['id',_0x0e68('0xa')],'where':{'id':0x1}})[_0x0e68('0xb')](function(_0x3789cf){_0x4f0479=_0x3789cf[_0x0e68('0xa')];if(_0x4f0479){return db['ChatInteraction']['findAll']({'raw':!![],'attributes':['id','lastMsgAt'],'where':{'closed':![],'lastMsgAt':{'$lt':moment()[_0x0e68('0xc')](_0x3789cf[_0x0e68('0xa')],_0x0e68('0xd'))}}});}else{return[];}})[_0x0e68('0xb')](function(_0x55fa50){_0x1a0ba0=_0x55fa50;if(_0x4f0479){return db[_0x0e68('0xe')][_0x0e68('0xf')]({'closeReason':'system','disposition':_0x0e68('0x10'),'closed':!![],'closedAt':moment()[_0x0e68('0x11')]('YYYY-MM-DD\x20HH:mm:ss')},{'where':{'id':_[_0x0e68('0x12')](_0x1a0ba0||[],'id')}});}})[_0x0e68('0xb')](function(_0x4f365d){for(var _0x444b00=0x0;_0x444b00<_0x1a0ba0['length'];_0x444b00++){io['emit']('chatInteraction:update',{'id':_0x1a0ba0[_0x444b00]['id'],'closed':!![]});}})['catch'](function(_0x59bbb4){console[_0x0e68('0x13')](_0x59bbb4);});}exports[_0x0e68('0x14')]=function(){setInterval(function(){return closeInteractions();},0x3c*0x3e8);return closeInteractions();}; \ No newline at end of file +var _0x74af=['ioredis','../../mysqldb','../../config/environment','redis','defaults','localhost','socket.io-emitter','Setting','find','chatTimeout','ChatInteraction','lastMsgAt','subtract','minutes','update','system','timeout','format','YYYY-MM-DD\x20HH:mm:ss','map','length','emit','catch','start','lodash','moment'];(function(_0x4d4066,_0xa97093){var _0x4017cc=function(_0x4a3605){while(--_0x4a3605){_0x4d4066['push'](_0x4d4066['shift']());}};_0x4017cc(++_0xa97093);}(_0x74af,0x1d2));var _0xf74a=function(_0x25b440,_0x547598){_0x25b440=_0x25b440-0x0;var _0x265514=_0x74af[_0x25b440];return _0x265514;};'use strict';var _=require(_0xf74a('0x0'));var moment=require(_0xf74a('0x1'));var Redis=require(_0xf74a('0x2'));var db=require(_0xf74a('0x3'))['db'];var config=require(_0xf74a('0x4'));config[_0xf74a('0x5')]=_[_0xf74a('0x6')](config[_0xf74a('0x5')],{'host':_0xf74a('0x7'),'port':0x18eb});var io=require(_0xf74a('0x8'))(new Redis(config['redis']));function closeInteractions(){var _0x310826=0x0;var _0x412e99=[];return db[_0xf74a('0x9')][_0xf74a('0xa')]({'raw':!![],'attributes':['id',_0xf74a('0xb')],'where':{'id':0x1}})['then'](function(_0x17d381){_0x310826=_0x17d381['chatTimeout'];if(_0x310826){return db[_0xf74a('0xc')]['findAll']({'raw':!![],'attributes':['id',_0xf74a('0xd')],'where':{'closed':![],'lastMsgAt':{'$lt':moment()[_0xf74a('0xe')](_0x17d381[_0xf74a('0xb')],_0xf74a('0xf'))}}});}else{return[];}})['then'](function(_0x4342bf){_0x412e99=_0x4342bf;if(_0x310826){return db[_0xf74a('0xc')][_0xf74a('0x10')]({'closeReason':_0xf74a('0x11'),'disposition':_0xf74a('0x12'),'closed':!![],'closedAt':moment()[_0xf74a('0x13')](_0xf74a('0x14'))},{'where':{'id':_[_0xf74a('0x15')](_0x412e99||[],'id')}});}})['then'](function(_0x2fd743){for(var _0x463616=0x0;_0x463616<_0x412e99[_0xf74a('0x16')];_0x463616++){io[_0xf74a('0x17')]('chatInteraction:update',{'id':_0x412e99[_0x463616]['id'],'closed':!![]});}})[_0xf74a('0x18')](function(_0x32057d){console['error'](_0x32057d);});}exports[_0xf74a('0x19')]=function(){setInterval(function(){return closeInteractions();},0x3c*0x3e8);return closeInteractions();}; \ No newline at end of file diff --git a/server/config/schedule/index.js b/server/config/schedule/index.js index 2147a4d..33726f2 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 _0xdfb0=['Try\x20to\x20send\x20a\x20mail\x20to','MailAccount','Smtp','service','host','port','secure','authentication','user','pass','format','\x22%s\x22\x20<%s>','email','bcc','name','subtractNumber','join','../../files/reports','savename','%s.%s','basename','extname','zip','existsSync','Sent','message','text','Info\x20report:\x0a%s\x0aPlease\x20see\x20the\x20attachments\x0aThis\x20is\x20an\x20automatically\x20generated\x20email\x20–\x20please\x20do\x20not\x20reply\x20to\x20it.\x0a\x0a','stringify','attachments','sendIfEmpty','info','empty\x20file,\x20email\x20not\x20sent','request','then','error','error\x20mail','email\x20sent','catch','isNil','subtractUnit','YYYY-MM-DD\x20HH:mm:ss','scheduled','output','DefaultReportId','exec\x20defaul\x20report\x20id:%s','CustomReportId','exec\x20custom\x20report\x20id:%s','runReport','no\x20report\x20id','Schedule','findAll','keys','jobs','map','toString','keyBy','difference','intersection','length','exists','stop','deleteJob','delete\x20cron','toRun','my\x20id','resolve','run\x20job','cron','startAt','endAt','start','add\x20cron','stop\x20cron','isBetween','update\x20cron','run','util','path','moment','cron-job-manager','jayson/promise','schedule','../../mysqldb','../../api/analyticDefaultReport/analyticDefaultReport.controller','http'];(function(_0x573f83,_0x1f3cd3){var _0xe89cd1=function(_0x317706){while(--_0x317706){_0x573f83['push'](_0x573f83['shift']());}};_0xe89cd1(++_0x1f3cd3);}(_0xdfb0,0xa3));var _0x0dfb=function(_0x269d2b,_0x3719b0){_0x269d2b=_0x269d2b-0x0;var _0x340153=_0xdfb0[_0x269d2b];return _0x340153;};'use strict';var fs=require('fs');var util=require(_0x0dfb('0x0'));var path=require(_0x0dfb('0x1'));var _=require('lodash');var moment=require(_0x0dfb('0x2'));var CronJobManager=require(_0x0dfb('0x3'));var jayson=require(_0x0dfb('0x4'));var BPromise=require('bluebird');var logger=require('../logger')(_0x0dfb('0x5'));var db=require(_0x0dfb('0x6'))['db'];var analyticCustomReportController=require('../../api/analyticCustomReport/analyticCustomReport.controller');var analyticDefaultReportController=require(_0x0dfb('0x7'));var client=jayson['client'][_0x0dfb('0x8')]({'port':0x232b});var manager=new CronJobManager();function handleSendEmail(_0x346a04,_0x1cf2ca){return function(){logger['info'](_0x0dfb('0x9'),_0x346a04['email']);var _0x113ffa=!![];var _0x3ce7ce={'tls':{'rejectUnauthorized':![]}};if(_0x346a04[_0x0dfb('0xa')][_0x0dfb('0xb')][_0x0dfb('0xc')]){_0x3ce7ce['service']=_0x346a04['MailAccount'][_0x0dfb('0xb')][_0x0dfb('0xc')];}else{_0x3ce7ce[_0x0dfb('0xd')]=_0x346a04['MailAccount'][_0x0dfb('0xb')][_0x0dfb('0xd')];_0x3ce7ce['port']=_0x346a04[_0x0dfb('0xa')][_0x0dfb('0xb')][_0x0dfb('0xe')];_0x3ce7ce['secure']=_0x346a04[_0x0dfb('0xa')][_0x0dfb('0xb')][_0x0dfb('0xf')];}if(_0x346a04[_0x0dfb('0xa')][_0x0dfb('0xb')][_0x0dfb('0x10')]){_0x3ce7ce['auth']={'user':_0x346a04[_0x0dfb('0xa')][_0x0dfb('0xb')][_0x0dfb('0x11')],'pass':_0x346a04[_0x0dfb('0xa')][_0x0dfb('0xb')][_0x0dfb('0x12')]};}var _0x507ed3={'account':_0x3ce7ce,'message':{'from':util[_0x0dfb('0x13')](_0x0dfb('0x14'),_0x346a04['MailAccount']['name'],_0x346a04['MailAccount'][_0x0dfb('0x15')]||_0x346a04['MailAccount']['Smtp'][_0x0dfb('0x11')]),'to':_0x346a04[_0x0dfb('0x15')],'cc':_0x346a04['cc'],'bcc':_0x346a04[_0x0dfb('0x16')],'subject':util[_0x0dfb('0x13')]('Report\x20%s\x20last\x20%s\x20%s',_0x1cf2ca[_0x0dfb('0x17')],_0x346a04[_0x0dfb('0x18')],_0x346a04['subtractUnit'])}};var _0x4b7abe=path[_0x0dfb('0x19')](__dirname,_0x0dfb('0x1a'));var _0x34acbb=_0x1cf2ca[_0x0dfb('0x1b')];var _0xb3d215=util[_0x0dfb('0x13')](_0x0dfb('0x1c'),path[_0x0dfb('0x1d')](_0x1cf2ca[_0x0dfb('0x1b')],path[_0x0dfb('0x1e')](_0x1cf2ca[_0x0dfb('0x1b')])),_0x0dfb('0x1f'));var _0x348182=path[_0x0dfb('0x19')](_0x4b7abe,_0x34acbb);var _0x54b262=path[_0x0dfb('0x19')](_0x4b7abe,_0xb3d215);if(fs[_0x0dfb('0x20')](_0x348182)){_0x1cf2ca['status']=_0x0dfb('0x21');_0x507ed3[_0x0dfb('0x22')]['attachments']=[{'filename':_0x34acbb,'path':_0x348182}];_0x507ed3[_0x0dfb('0x22')][_0x0dfb('0x23')]=util['format'](_0x0dfb('0x24'),JSON[_0x0dfb('0x25')](_0x1cf2ca,null,0x2));}else if(fs[_0x0dfb('0x20')](_0x54b262)){_0x1cf2ca['status']='Sent';_0x507ed3[_0x0dfb('0x22')][_0x0dfb('0x26')]=[{'filename':_0xb3d215,'path':_0x54b262}];}else{_0x507ed3['message']['text']='Report\x20empty\x0aThis\x20is\x20an\x20automatically\x20generated\x20email\x20–\x20please\x20do\x20not\x20reply\x20to\x20this\x20email.\x0a\x0a';if(!_0x346a04[_0x0dfb('0x27')]){_0x113ffa=![];logger[_0x0dfb('0x28')](_0x0dfb('0x29'));}}if(_0x113ffa){return client[_0x0dfb('0x2a')]('SendMail',_0x507ed3)[_0x0dfb('0x2b')](function(_0x58bb52){if(_0x58bb52[_0x0dfb('0x2c')]){return logger[_0x0dfb('0x2c')](_0x0dfb('0x2d'),JSON['stringify'](_0x58bb52));}return logger[_0x0dfb('0x28')](_0x0dfb('0x2e'));})[_0x0dfb('0x2f')](function(_0xd5be0c){return logger[_0x0dfb('0x2c')]('error\x20mail',JSON[_0x0dfb('0x25')](_0xd5be0c));});}};}function handleError(){return function(_0x19cc20){return logger[_0x0dfb('0x2c')](JSON[_0x0dfb('0x25')](_0x19cc20));};}function handleResult(_0x2dd72a){return function(_0x306c2e){logger['info']('data',JSON['stringify'](_0x306c2e));if(_0x2dd72a[_0x0dfb('0xa')]&&_0x2dd72a[_0x0dfb('0xa')][_0x0dfb('0xb')]&&!_[_0x0dfb('0x30')](_0x2dd72a[_0x0dfb('0x15')])){setTimeout(handleSendEmail(_0x2dd72a,_0x306c2e),0x3c*0x3e8);}};}function handleJob(_0x10bb8d){return function(){try{if(_[_0x0dfb('0x30')](_0x10bb8d[_0x0dfb('0x18')])){return logger[_0x0dfb('0x28')]('subtractNumber\x20null\x20or\x20undefined');}if(_[_0x0dfb('0x30')](_0x10bb8d[_0x0dfb('0x31')])){return logger[_0x0dfb('0x28')]('subtractUnit\x20null\x20or\x20undefined');}var _0x2bcfb1={'startDate':moment()['subtract'](_0x10bb8d[_0x0dfb('0x18')],_0x10bb8d[_0x0dfb('0x31')])[_0x0dfb('0x13')](_0x0dfb('0x32')),'endDate':moment()['format'](_0x0dfb('0x32')),'type':_0x0dfb('0x33'),'output':_0x10bb8d[_0x0dfb('0x34')],'name':_0x10bb8d['name']};if(!_[_0x0dfb('0x30')](_0x10bb8d[_0x0dfb('0x35')])){logger[_0x0dfb('0x28')](_0x0dfb('0x36'),_0x10bb8d[_0x0dfb('0x35')]);return analyticDefaultReportController['runReport']({'id':_0x10bb8d['DefaultReportId']},_0x2bcfb1)[_0x0dfb('0x2b')](handleResult(_0x10bb8d))[_0x0dfb('0x2f')](handleError());}if(!_['isNil'](_0x10bb8d[_0x0dfb('0x37')])){logger[_0x0dfb('0x28')](_0x0dfb('0x38'),_0x10bb8d[_0x0dfb('0x37')]);return analyticCustomReportController[_0x0dfb('0x39')]({'id':_0x10bb8d[_0x0dfb('0x37')]},_0x2bcfb1)['then'](handleResult(_0x10bb8d))[_0x0dfb('0x2f')](handleError());}}catch(_0x33f51a){logger['error'](JSON[_0x0dfb('0x25')](_0x33f51a));}return logger[_0x0dfb('0x28')](_0x0dfb('0x3a'));};}function getJobs(_0x55a2f6){var _0x48b0cd={};if(_0x55a2f6){_0x48b0cd['id']=_0x55a2f6;}return db[_0x0dfb('0x3b')][_0x0dfb('0x3c')]({'where':_0x48b0cd,'include':[{'model':db[_0x0dfb('0xa')],'attributes':['id',_0x0dfb('0x17'),_0x0dfb('0x15')],'include':[{'model':db['MailServerOut'],'as':_0x0dfb('0xb')}]}]})['then'](function(_0x2a63fe){var _0x3d3c6c=_[_0x0dfb('0x3d')](manager[_0x0dfb('0x3e')]);var _0x4b8c45=_[_0x0dfb('0x3f')](_0x2a63fe,function(_0x535664){return _0x535664['id'][_0x0dfb('0x40')]();});var _0xfc85f1=_[_0x0dfb('0x41')](_0x2a63fe,function(_0x4250a1){return _0x4250a1['id'][_0x0dfb('0x40')]();});var _0xcb3c3=_0x55a2f6?_0x4b8c45:_[_0x0dfb('0x42')](_0x4b8c45,_0x3d3c6c);var _0x1e78e1=_[_0x0dfb('0x43')](_0x4b8c45,_0x3d3c6c);var _0xd48f8f=_[_0x0dfb('0x42')](_0x3d3c6c,_0x4b8c45);var _0x4b9da0;var _0x493e65;for(_0x4b9da0=0x0;_0x4b9da0<_0xd48f8f[_0x0dfb('0x44')]&&!_0x55a2f6;_0x4b9da0+=0x1){_0x493e65=_0xd48f8f[_0x4b9da0][_0x0dfb('0x40')]();if(manager[_0x0dfb('0x45')](_0x493e65)){manager[_0x0dfb('0x46')](_0x493e65);manager[_0x0dfb('0x47')](_0x493e65);logger[_0x0dfb('0x28')](_0x0dfb('0x48'),_0x493e65);}}logger[_0x0dfb('0x28')](_0x0dfb('0x49'),JSON[_0x0dfb('0x25')](_0xcb3c3));for(_0x4b9da0=0x0;_0x4b9da0<_0xcb3c3[_0x0dfb('0x44')];_0x4b9da0+=0x1){_0x493e65=_0xcb3c3[_0x4b9da0][_0x0dfb('0x40')]();logger[_0x0dfb('0x28')]('index',_0x493e65);if(_0x55a2f6){logger[_0x0dfb('0x28')](_0x0dfb('0x4a'),_0x55a2f6);logger['info'](JSON[_0x0dfb('0x25')](_0xfc85f1[_0x493e65]));BPromise[_0x0dfb('0x4b')]()[_0x0dfb('0x2b')](handleJob(_0xfc85f1[_0x493e65]));logger[_0x0dfb('0x28')](_0x0dfb('0x4c'),_0xfc85f1[_0x493e65]['name'],_0xfc85f1[_0x493e65]['cron']);}else if(_0xfc85f1[_0x493e65][_0x0dfb('0x4d')]&&_0xfc85f1[_0x493e65]['active']&&moment()['isBetween'](_0xfc85f1[_0x493e65][_0x0dfb('0x4e')],_0xfc85f1[_0x493e65][_0x0dfb('0x4f')])){manager['add'](_0x493e65,_0xfc85f1[_0x493e65]['cron'],handleJob(_0xfc85f1[_0x493e65]));manager[_0x0dfb('0x50')](_0x493e65);logger[_0x0dfb('0x28')](_0x0dfb('0x51'),_0xfc85f1[_0x493e65][_0x0dfb('0x17')],_0xfc85f1[_0x493e65]['cron']);}else if(manager['exists'](_0x493e65)){manager[_0x0dfb('0x46')](_0x493e65);manager[_0x0dfb('0x47')](_0x493e65);logger[_0x0dfb('0x28')](_0x0dfb('0x52'),_0xfc85f1[_0x493e65][_0x0dfb('0x17')],_0xfc85f1[_0x493e65][_0x0dfb('0x4d')]);}}for(_0x4b9da0=0x0,_0x493e65;_0x4b9da0<_0x1e78e1[_0x0dfb('0x44')]&&!_0x55a2f6;_0x4b9da0+=0x1){_0x493e65=_0x1e78e1[_0x4b9da0][_0x0dfb('0x40')]();if(manager['exists'](_0x493e65)){if(_0xfc85f1[_0x493e65][_0x0dfb('0x4d')]&&_0xfc85f1[_0x493e65]['active']&&moment()[_0x0dfb('0x53')](_0xfc85f1[_0x493e65][_0x0dfb('0x4e')],_0xfc85f1[_0x493e65]['endAt'])){manager['update'](_0x493e65,_0xfc85f1[_0x493e65][_0x0dfb('0x4d')],handleJob(_0xfc85f1[_0x493e65]));logger[_0x0dfb('0x28')](_0x0dfb('0x54'),_0xfc85f1[_0x493e65]['name'],_0xfc85f1[_0x493e65][_0x0dfb('0x4d')]);}else{manager[_0x0dfb('0x46')](_0x493e65);manager[_0x0dfb('0x47')](_0x493e65);logger[_0x0dfb('0x28')](_0x0dfb('0x52'),_0xfc85f1[_0x493e65]['name'],_0xfc85f1[_0x493e65][_0x0dfb('0x4d')]);}}}})['catch'](function(_0x1c470a){logger['error'](JSON[_0x0dfb('0x25')](_0x1c470a));});}exports[_0x0dfb('0x55')]=function(_0x4d0c15){return getJobs(_0x4d0c15);};exports['start']=function(){setInterval(function(){return getJobs();},0x3c*0x3e8);return getJobs();}; \ No newline at end of file +var _0xb55d=['keyBy','difference','intersection','exists','stop','deleteJob','toRun','length','index','my\x20id','resolve','run\x20job','cron','active','stop\x20cron','isBetween','startAt','endAt','update','update\x20cron','run','start','util','path','lodash','moment','cron-job-manager','jayson/promise','bluebird','schedule','../../api/analyticCustomReport/analyticCustomReport.controller','../../api/analyticDefaultReport/analyticDefaultReport.controller','client','http','info','Try\x20to\x20send\x20a\x20mail\x20to','email','MailAccount','Smtp','service','host','port','secure','authentication','auth','user','pass','format','\x22%s\x22\x20<%s>','bcc','name','subtractNumber','subtractUnit','join','../../files/reports','savename','basename','extname','zip','existsSync','status','Sent','message','text','Info\x20report:\x0a%s\x0aPlease\x20see\x20the\x20attachments\x0aThis\x20is\x20an\x20automatically\x20generated\x20email\x20–\x20please\x20do\x20not\x20reply\x20to\x20it.\x0a\x0a','stringify','attachments','sendIfEmpty','request','then','error','email\x20sent','error\x20mail','isNil','subtractUnit\x20null\x20or\x20undefined','subtract','YYYY-MM-DD\x20HH:mm:ss','scheduled','output','exec\x20defaul\x20report\x20id:%s','runReport','catch','CustomReportId','exec\x20custom\x20report\x20id:%s','no\x20report\x20id','Schedule','MailServerOut','keys','jobs','map','toString'];(function(_0xd3e0ed,_0x54c02f){var _0x5b54dd=function(_0x36733a){while(--_0x36733a){_0xd3e0ed['push'](_0xd3e0ed['shift']());}};_0x5b54dd(++_0x54c02f);}(_0xb55d,0xcc));var _0xdb55=function(_0x294a6f,_0x194a3a){_0x294a6f=_0x294a6f-0x0;var _0x250707=_0xb55d[_0x294a6f];return _0x250707;};'use strict';var fs=require('fs');var util=require(_0xdb55('0x0'));var path=require(_0xdb55('0x1'));var _=require(_0xdb55('0x2'));var moment=require(_0xdb55('0x3'));var CronJobManager=require(_0xdb55('0x4'));var jayson=require(_0xdb55('0x5'));var BPromise=require(_0xdb55('0x6'));var logger=require('../logger')(_0xdb55('0x7'));var db=require('../../mysqldb')['db'];var analyticCustomReportController=require(_0xdb55('0x8'));var analyticDefaultReportController=require(_0xdb55('0x9'));var client=jayson[_0xdb55('0xa')][_0xdb55('0xb')]({'port':0x232b});var manager=new CronJobManager();function handleSendEmail(_0x5e62df,_0x4aa189){return function(){logger[_0xdb55('0xc')](_0xdb55('0xd'),_0x5e62df[_0xdb55('0xe')]);var _0x3ea225=!![];var _0x513417={'tls':{'rejectUnauthorized':![]}};if(_0x5e62df[_0xdb55('0xf')][_0xdb55('0x10')][_0xdb55('0x11')]){_0x513417['service']=_0x5e62df[_0xdb55('0xf')]['Smtp'][_0xdb55('0x11')];}else{_0x513417[_0xdb55('0x12')]=_0x5e62df[_0xdb55('0xf')][_0xdb55('0x10')]['host'];_0x513417[_0xdb55('0x13')]=_0x5e62df[_0xdb55('0xf')][_0xdb55('0x10')][_0xdb55('0x13')];_0x513417[_0xdb55('0x14')]=_0x5e62df['MailAccount'][_0xdb55('0x10')][_0xdb55('0x14')];}if(_0x5e62df[_0xdb55('0xf')]['Smtp'][_0xdb55('0x15')]){_0x513417[_0xdb55('0x16')]={'user':_0x5e62df[_0xdb55('0xf')][_0xdb55('0x10')][_0xdb55('0x17')],'pass':_0x5e62df['MailAccount'][_0xdb55('0x10')][_0xdb55('0x18')]};}var _0x27bc4b={'account':_0x513417,'message':{'from':util[_0xdb55('0x19')](_0xdb55('0x1a'),_0x5e62df[_0xdb55('0xf')]['name'],_0x5e62df[_0xdb55('0xf')][_0xdb55('0xe')]||_0x5e62df[_0xdb55('0xf')][_0xdb55('0x10')][_0xdb55('0x17')]),'to':_0x5e62df[_0xdb55('0xe')],'cc':_0x5e62df['cc'],'bcc':_0x5e62df[_0xdb55('0x1b')],'subject':util['format']('Report\x20%s\x20last\x20%s\x20%s',_0x4aa189[_0xdb55('0x1c')],_0x5e62df[_0xdb55('0x1d')],_0x5e62df[_0xdb55('0x1e')])}};var _0xf85956=path[_0xdb55('0x1f')](__dirname,_0xdb55('0x20'));var _0x1a36fc=_0x4aa189[_0xdb55('0x21')];var _0x3356cb=util['format']('%s.%s',path[_0xdb55('0x22')](_0x4aa189[_0xdb55('0x21')],path[_0xdb55('0x23')](_0x4aa189[_0xdb55('0x21')])),_0xdb55('0x24'));var _0x7fa04e=path['join'](_0xf85956,_0x1a36fc);var _0x4d1865=path[_0xdb55('0x1f')](_0xf85956,_0x3356cb);if(fs[_0xdb55('0x25')](_0x7fa04e)){_0x4aa189[_0xdb55('0x26')]=_0xdb55('0x27');_0x27bc4b[_0xdb55('0x28')]['attachments']=[{'filename':_0x1a36fc,'path':_0x7fa04e}];_0x27bc4b[_0xdb55('0x28')][_0xdb55('0x29')]=util[_0xdb55('0x19')](_0xdb55('0x2a'),JSON[_0xdb55('0x2b')](_0x4aa189,null,0x2));}else if(fs['existsSync'](_0x4d1865)){_0x4aa189[_0xdb55('0x26')]=_0xdb55('0x27');_0x27bc4b[_0xdb55('0x28')][_0xdb55('0x2c')]=[{'filename':_0x3356cb,'path':_0x4d1865}];}else{_0x27bc4b[_0xdb55('0x28')]['text']='Report\x20empty\x0aThis\x20is\x20an\x20automatically\x20generated\x20email\x20–\x20please\x20do\x20not\x20reply\x20to\x20this\x20email.\x0a\x0a';if(!_0x5e62df[_0xdb55('0x2d')]){_0x3ea225=![];logger[_0xdb55('0xc')]('empty\x20file,\x20email\x20not\x20sent');}}if(_0x3ea225){return client[_0xdb55('0x2e')]('SendMail',_0x27bc4b)[_0xdb55('0x2f')](function(_0x4106a2){if(_0x4106a2[_0xdb55('0x30')]){return logger['error']('error\x20mail',JSON[_0xdb55('0x2b')](_0x4106a2));}return logger[_0xdb55('0xc')](_0xdb55('0x31'));})['catch'](function(_0x34ebae){return logger[_0xdb55('0x30')](_0xdb55('0x32'),JSON[_0xdb55('0x2b')](_0x34ebae));});}};}function handleError(){return function(_0x468d35){return logger[_0xdb55('0x30')](JSON['stringify'](_0x468d35));};}function handleResult(_0xd4be6d){return function(_0x21834e){logger[_0xdb55('0xc')]('data',JSON[_0xdb55('0x2b')](_0x21834e));if(_0xd4be6d[_0xdb55('0xf')]&&_0xd4be6d[_0xdb55('0xf')][_0xdb55('0x10')]&&!_[_0xdb55('0x33')](_0xd4be6d[_0xdb55('0xe')])){setTimeout(handleSendEmail(_0xd4be6d,_0x21834e),0x3c*0x3e8);}};}function handleJob(_0x3ebafa){return function(){try{if(_[_0xdb55('0x33')](_0x3ebafa[_0xdb55('0x1d')])){return logger[_0xdb55('0xc')]('subtractNumber\x20null\x20or\x20undefined');}if(_['isNil'](_0x3ebafa[_0xdb55('0x1e')])){return logger[_0xdb55('0xc')](_0xdb55('0x34'));}var _0x2ec5a3={'startDate':moment()[_0xdb55('0x35')](_0x3ebafa[_0xdb55('0x1d')],_0x3ebafa['subtractUnit'])[_0xdb55('0x19')](_0xdb55('0x36')),'endDate':moment()['format']('YYYY-MM-DD\x20HH:mm:ss'),'type':_0xdb55('0x37'),'output':_0x3ebafa[_0xdb55('0x38')],'name':_0x3ebafa['name']};if(!_[_0xdb55('0x33')](_0x3ebafa['DefaultReportId'])){logger[_0xdb55('0xc')](_0xdb55('0x39'),_0x3ebafa['DefaultReportId']);return analyticDefaultReportController[_0xdb55('0x3a')]({'id':_0x3ebafa['DefaultReportId']},_0x2ec5a3)['then'](handleResult(_0x3ebafa))[_0xdb55('0x3b')](handleError());}if(!_[_0xdb55('0x33')](_0x3ebafa[_0xdb55('0x3c')])){logger[_0xdb55('0xc')](_0xdb55('0x3d'),_0x3ebafa['CustomReportId']);return analyticCustomReportController['runReport']({'id':_0x3ebafa[_0xdb55('0x3c')]},_0x2ec5a3)['then'](handleResult(_0x3ebafa))[_0xdb55('0x3b')](handleError());}}catch(_0xaf77a7){logger[_0xdb55('0x30')](JSON[_0xdb55('0x2b')](_0xaf77a7));}return logger['info'](_0xdb55('0x3e'));};}function getJobs(_0x279746){var _0x5cffa1={};if(_0x279746){_0x5cffa1['id']=_0x279746;}return db[_0xdb55('0x3f')]['findAll']({'where':_0x5cffa1,'include':[{'model':db[_0xdb55('0xf')],'attributes':['id',_0xdb55('0x1c'),'email'],'include':[{'model':db[_0xdb55('0x40')],'as':_0xdb55('0x10')}]}]})[_0xdb55('0x2f')](function(_0x22fcfe){var _0x4b1285=_[_0xdb55('0x41')](manager[_0xdb55('0x42')]);var _0x847d81=_[_0xdb55('0x43')](_0x22fcfe,function(_0xc87abd){return _0xc87abd['id'][_0xdb55('0x44')]();});var _0x38ee1e=_[_0xdb55('0x45')](_0x22fcfe,function(_0x131fbd){return _0x131fbd['id'][_0xdb55('0x44')]();});var _0x3befbb=_0x279746?_0x847d81:_[_0xdb55('0x46')](_0x847d81,_0x4b1285);var _0x37d53c=_[_0xdb55('0x47')](_0x847d81,_0x4b1285);var _0x1960c9=_[_0xdb55('0x46')](_0x4b1285,_0x847d81);var _0x3cc466;var _0x2b9147;for(_0x3cc466=0x0;_0x3cc466<_0x1960c9['length']&&!_0x279746;_0x3cc466+=0x1){_0x2b9147=_0x1960c9[_0x3cc466][_0xdb55('0x44')]();if(manager[_0xdb55('0x48')](_0x2b9147)){manager[_0xdb55('0x49')](_0x2b9147);manager[_0xdb55('0x4a')](_0x2b9147);logger[_0xdb55('0xc')]('delete\x20cron',_0x2b9147);}}logger[_0xdb55('0xc')](_0xdb55('0x4b'),JSON[_0xdb55('0x2b')](_0x3befbb));for(_0x3cc466=0x0;_0x3cc466<_0x3befbb[_0xdb55('0x4c')];_0x3cc466+=0x1){_0x2b9147=_0x3befbb[_0x3cc466][_0xdb55('0x44')]();logger[_0xdb55('0xc')](_0xdb55('0x4d'),_0x2b9147);if(_0x279746){logger['info'](_0xdb55('0x4e'),_0x279746);logger[_0xdb55('0xc')](JSON[_0xdb55('0x2b')](_0x38ee1e[_0x2b9147]));BPromise[_0xdb55('0x4f')]()[_0xdb55('0x2f')](handleJob(_0x38ee1e[_0x2b9147]));logger[_0xdb55('0xc')](_0xdb55('0x50'),_0x38ee1e[_0x2b9147][_0xdb55('0x1c')],_0x38ee1e[_0x2b9147][_0xdb55('0x51')]);}else if(_0x38ee1e[_0x2b9147][_0xdb55('0x51')]&&_0x38ee1e[_0x2b9147][_0xdb55('0x52')]&&moment()['isBetween'](_0x38ee1e[_0x2b9147]['startAt'],_0x38ee1e[_0x2b9147]['endAt'])){manager['add'](_0x2b9147,_0x38ee1e[_0x2b9147]['cron'],handleJob(_0x38ee1e[_0x2b9147]));manager['start'](_0x2b9147);logger[_0xdb55('0xc')]('add\x20cron',_0x38ee1e[_0x2b9147]['name'],_0x38ee1e[_0x2b9147]['cron']);}else if(manager[_0xdb55('0x48')](_0x2b9147)){manager[_0xdb55('0x49')](_0x2b9147);manager[_0xdb55('0x4a')](_0x2b9147);logger[_0xdb55('0xc')](_0xdb55('0x53'),_0x38ee1e[_0x2b9147]['name'],_0x38ee1e[_0x2b9147]['cron']);}}for(_0x3cc466=0x0,_0x2b9147;_0x3cc466<_0x37d53c[_0xdb55('0x4c')]&&!_0x279746;_0x3cc466+=0x1){_0x2b9147=_0x37d53c[_0x3cc466]['toString']();if(manager[_0xdb55('0x48')](_0x2b9147)){if(_0x38ee1e[_0x2b9147][_0xdb55('0x51')]&&_0x38ee1e[_0x2b9147][_0xdb55('0x52')]&&moment()[_0xdb55('0x54')](_0x38ee1e[_0x2b9147][_0xdb55('0x55')],_0x38ee1e[_0x2b9147][_0xdb55('0x56')])){manager[_0xdb55('0x57')](_0x2b9147,_0x38ee1e[_0x2b9147][_0xdb55('0x51')],handleJob(_0x38ee1e[_0x2b9147]));logger[_0xdb55('0xc')](_0xdb55('0x58'),_0x38ee1e[_0x2b9147][_0xdb55('0x1c')],_0x38ee1e[_0x2b9147][_0xdb55('0x51')]);}else{manager[_0xdb55('0x49')](_0x2b9147);manager[_0xdb55('0x4a')](_0x2b9147);logger[_0xdb55('0xc')](_0xdb55('0x53'),_0x38ee1e[_0x2b9147]['name'],_0x38ee1e[_0x2b9147][_0xdb55('0x51')]);}}}})[_0xdb55('0x3b')](function(_0x3dca19){logger[_0xdb55('0x30')](JSON['stringify'](_0x3dca19));});}exports[_0xdb55('0x59')]=function(_0x48f7ec){return getJobs(_0x48f7ec);};exports[_0xdb55('0x5a')]=function(){setInterval(function(){return getJobs();},0x3c*0x3e8);return getJobs();}; \ No newline at end of file diff --git a/server/config/schedule/transcribe.js b/server/config/schedule/transcribe.js index 3005fa1..e0a726c 100644 --- a/server/config/schedule/transcribe.js +++ b/server/config/schedule/transcribe.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x538e=['Neutral','FAILED','FailureReason','[RECORDING:%d]\x20Voice\x20Recording\x20entry\x20updated','[RECORDING:%d]\x20Transcript\x20Job\x20status\x20not\x20managed','Transcript\x20not\x20available','Sentiment','Positive','COMPLETED','catch','name','error','[RECORDING:%d]\x20Error\x20running\x20Transcribe\x20&\x20Sentiment\x20Analysis','VoiceRecording','findAll','IN_PROGRESS','length','No\x20transcribe\x20job\x20to\x20check','Setting','Settings\x20not\x20available','transcribe','transcribeAccountId','forEach','push','SequelizeValidationError','inspect','start','aws-sdk','../../mysqldb','../../config/logger','Comprehend','detectSentiment','substring','info','format','[RECORDING:%d]\x20Get\x20status\x20for\x20transcript\x20job\x20(%s)','transcribeName','data2','transcribeRegion','then','[RECORDING:%d]\x20Status\x20of\x20transcript\x20job\x20(%s):\x20%s','TranscriptionJobStatus','TranscriptionJob','Transcript','TranscriptFileUri','results','fileText','transcripts','transcript','update','tempSentiment','Sequelize','ValidationError','Sentiment\x20Analysis\x20not\x20requested','sentiment','sentimentAccountId','sentimentRegion','language','bucket','Sentiment\x20Analysis\x20not\x20configured','CloudProvider','findOne','Cloud\x20Provider\x20not\x20available','Cloud\x20Provider\x20not\x20configured','[RECORDING:%d]\x20Requesting\x20sentiment\x20analysis','data1','[RECORDING:%d]\x20Sentiment\x20Analysis\x20available','SentimentScore','Negative','Mixed'];(function(_0x2ab3d9,_0x50e716){var _0x210a54=function(_0x24c479){while(--_0x24c479){_0x2ab3d9['push'](_0x2ab3d9['shift']());}};_0x210a54(++_0x50e716);}(_0x538e,0xed));var _0xe538=function(_0x17570f,_0x211472){_0x17570f=_0x17570f-0x0;var _0x1d608e=_0x538e[_0x17570f];return _0x1d608e;};var _=require('lodash');var AWS=require(_0xe538('0x0'));var rp=require('request-promise');var util=require('util');var BPromise=require('bluebird');var db=require(_0xe538('0x1'))['db'];var logger=require(_0xe538('0x2'))('transcribe');function getTranscriptionJob(_0x6836d2,_0x8d2ed9,_0x45563e,_0x5b2ac9){return new Promise(function(_0x1374c0,_0x1aee14){var _0x171d45=new AWS['TranscribeService']({'accessKeyId':_0x8d2ed9,'secretAccessKey':_0x6836d2,'region':_0x45563e});_0x171d45['getTranscriptionJob']({'TranscriptionJobName':_0x5b2ac9},function(_0x23f828,_0x42a242){if(_0x23f828){return _0x1aee14(_0x23f828);}else{return _0x1374c0(_0x42a242);}});});}function sentiment(_0x4b42e4,_0x12aab5,_0x2cacdd,_0x334453,_0x2e8ce5){return new Promise(function(_0x27a75b,_0x50720f){var _0x3a3ffa=new AWS[(_0xe538('0x3'))]({'accessKeyId':_0x12aab5,'secretAccessKey':_0x4b42e4,'region':_0x2cacdd});_0x3a3ffa[_0xe538('0x4')]({'Text':_0x334453,'LanguageCode':_0x2e8ce5[_0xe538('0x5')](0x0,0x2)},function(_0x213a67,_0x432f55){if(_0x213a67){return _0x50720f(_0x213a67);}else{return _0x27a75b(_0x432f55);}});});}function checkTranscribeJob(_0x29facb,_0x1c560b,_0x4a026b){var _0x398ff5;return new BPromise(function(_0x85fec1,_0x1dfb4f){logger[_0xe538('0x6')](util[_0xe538('0x7')](_0xe538('0x8'),_0x29facb['id'],_0x29facb[_0xe538('0x9')]));return getTranscriptionJob(_0x4a026b['data1'],_0x4a026b[_0xe538('0xa')],_0x1c560b[_0xe538('0xb')],_0x29facb[_0xe538('0x9')])[_0xe538('0xc')](function(_0x39cac6){logger[_0xe538('0x6')](util[_0xe538('0x7')](_0xe538('0xd'),_0x29facb['id'],_0x29facb[_0xe538('0x9')],_0x39cac6['TranscriptionJob'][_0xe538('0xe')]));if(!_0x29facb['fileText']){switch(_0x39cac6[_0xe538('0xf')][_0xe538('0xe')]){case'COMPLETED':var _0x58dd8a={'transcribeStatus':_0x39cac6[_0xe538('0xf')]['TranscriptionJobStatus'],'fileUri':_0x39cac6[_0xe538('0xf')][_0xe538('0x10')][_0xe538('0x11')]};logger[_0xe538('0x6')](util[_0xe538('0x7')]('[RECORDING:%d]\x20Get\x20transcript',_0x29facb['id']));return rp({'uri':_0x39cac6[_0xe538('0xf')][_0xe538('0x10')][_0xe538('0x11')],'json':!![]})[_0xe538('0xc')](function(_0x149200){logger[_0xe538('0x6')](util[_0xe538('0x7')]('[RECORDING:%d]\x20Transcript\x20downloaded',_0x29facb['id']));if(_0x149200&&_0x149200[_0xe538('0x12')]&&_0x149200['results']['transcripts']&&_0x149200[_0xe538('0x12')]['transcripts']['length']){_0x58dd8a[_0xe538('0x13')]='';for(var _0x2931fe=0x0;_0x2931fe<_0x149200[_0xe538('0x12')][_0xe538('0x14')]['length'];_0x2931fe++){_0x58dd8a[_0xe538('0x13')]+=_0x149200['results'][_0xe538('0x14')][_0x2931fe][_0xe538('0x15')]+'';}}return _0x29facb[_0xe538('0x16')](_0x58dd8a);})['then'](function(){logger[_0xe538('0x6')](util['format']('[RECORDING:%d]\x20Voice\x20Recording\x20entry\x20updated',_0x29facb['id']));if(!_0x29facb[_0xe538('0x17')]){throw new db[(_0xe538('0x18'))][(_0xe538('0x19'))](_0xe538('0x1a'));}if(!_0x1c560b[_0xe538('0x1b')]||!_0x1c560b[_0xe538('0x1c')]||!_0x1c560b[_0xe538('0x1d')]||!_0x1c560b[_0xe538('0x1e')]||!_0x1c560b[_0xe538('0x1f')]){throw new db[(_0xe538('0x18'))]['ValidationError'](_0xe538('0x20'));}if(!_0x58dd8a[_0xe538('0x13')]){throw new Error('Transcript\x20not\x20available');}if(_0x1c560b[_0xe538('0x1c')]===_0x4a026b['id']){return _0x4a026b;}else{return db[_0xe538('0x21')][_0xe538('0x22')]({'where':{'id':_settings[_0xe538('0x1c')]}});}})[_0xe538('0xc')](function(_0x3fb4b0){if(!_0x3fb4b0){throw new db[(_0xe538('0x18'))]['ValidationError'](_0xe538('0x23'));}if(!_0x3fb4b0['data1']||!_0x3fb4b0['data2']){throw new db[(_0xe538('0x18'))][(_0xe538('0x19'))](_0xe538('0x24'));}_0x398ff5=_0x3fb4b0;logger[_0xe538('0x6')](util[_0xe538('0x7')](_0xe538('0x25'),_0x29facb['id']));return sentiment(_0x398ff5[_0xe538('0x26')],_0x398ff5[_0xe538('0xa')],_0x1c560b[_0xe538('0x1d')],_0x58dd8a['fileText'],_0x1c560b['language']);})[_0xe538('0xc')](function(_0x603468){logger[_0xe538('0x6')](util['format'](_0xe538('0x27'),_0x29facb['id']));return _0x29facb[_0xe538('0x16')]({'sentiment':_0x603468['Sentiment'],'sPositive':_0x603468['SentimentScore']['Positive'],'sNegative':_0x603468[_0xe538('0x28')][_0xe538('0x29')],'sMixed':_0x603468[_0xe538('0x28')][_0xe538('0x2a')],'sNeutral':_0x603468[_0xe538('0x28')][_0xe538('0x2b')]});})[_0xe538('0xc')](function(){logger['info'](util[_0xe538('0x7')]('[RECORDING:%d]\x20Voice\x20Recording\x20entry\x20updated',_0x29facb['id']));_0x85fec1();});case _0xe538('0x2c'):return _0x29facb[_0xe538('0x16')]({'transcribeStatus':_0xe538('0x2c'),'failureReason':_0x39cac6[_0xe538('0xf')][_0xe538('0x2d')]})[_0xe538('0xc')](function(){logger[_0xe538('0x6')](util[_0xe538('0x7')](_0xe538('0x2e'),_0x29facb['id']));_0x85fec1();});default:logger['info'](util['format'](_0xe538('0x2f'),_0x29facb['id']));break;}}else{return BPromise['resolve']()[_0xe538('0xc')](function(){if(!_0x29facb[_0xe538('0x17')]){throw new db['Sequelize'][(_0xe538('0x19'))]('Sentiment\x20Analysis\x20not\x20requested');}if(!_0x1c560b[_0xe538('0x1b')]||!_0x1c560b[_0xe538('0x1c')]||!_0x1c560b['sentimentRegion']||!_0x1c560b[_0xe538('0x1e')]||!_0x1c560b[_0xe538('0x1f')]){throw new db[(_0xe538('0x18'))][(_0xe538('0x19'))](_0xe538('0x20'));}if(!_0x29facb[_0xe538('0x13')]){throw new Error(_0xe538('0x30'));}if(_0x1c560b[_0xe538('0x1c')]===_0x4a026b['id']){return _0x4a026b;}else{return db[_0xe538('0x21')]['findOne']({'where':{'id':_settings[_0xe538('0x1c')]}});}})[_0xe538('0xc')](function(_0x25e6c8){if(!_0x25e6c8){throw new db['Sequelize'][(_0xe538('0x19'))](_0xe538('0x23'));}if(!_0x25e6c8[_0xe538('0x26')]||!_0x25e6c8[_0xe538('0xa')]){throw new db[(_0xe538('0x18'))][(_0xe538('0x19'))](_0xe538('0x24'));}_0x398ff5=_0x25e6c8;logger[_0xe538('0x6')](util[_0xe538('0x7')](_0xe538('0x25'),_0x29facb['id']));return sentiment(_0x398ff5[_0xe538('0x26')],_0x398ff5[_0xe538('0xa')],_0x1c560b[_0xe538('0x1d')],_0x29facb[_0xe538('0x13')],_0x1c560b['language']);})[_0xe538('0xc')](function(_0x35f6fb){logger[_0xe538('0x6')](util[_0xe538('0x7')](_0xe538('0x27'),_0x29facb['id']));return _0x29facb[_0xe538('0x16')]({'sentiment':_0x35f6fb[_0xe538('0x31')],'sPositive':_0x35f6fb[_0xe538('0x28')][_0xe538('0x32')],'sNegative':_0x35f6fb[_0xe538('0x28')][_0xe538('0x29')],'sMixed':_0x35f6fb['SentimentScore'][_0xe538('0x2a')],'sNeutral':_0x35f6fb[_0xe538('0x28')][_0xe538('0x2b')],'transcribeStatus':_0xe538('0x33')});})[_0xe538('0xc')](function(){logger['info'](util[_0xe538('0x7')](_0xe538('0x2e'),_0x29facb['id']));_0x85fec1();});}})[_0xe538('0x34')](function(_0x58ea78){if(_0x58ea78){if(!_0x58ea78[_0xe538('0x35')]||_0x58ea78[_0xe538('0x35')]!=='SequelizeValidationError'){logger[_0xe538('0x36')](util['format'](_0xe538('0x37'),_0x29facb['id']),util['inspect'](_0x58ea78,{'showHidden':![],'depth':null}));}}_0x85fec1();});});}function checkTranscribe(){var _0x4f26ca;var _0x2c7d06;var _0x2ad809;return db[_0xe538('0x38')][_0xe538('0x39')]({'where':{'transcribeStatus':_0xe538('0x3a')}})[_0xe538('0xc')](function(_0x2247d7){if(!_0x2247d7||!_0x2247d7[_0xe538('0x3b')]){throw new db[(_0xe538('0x18'))][(_0xe538('0x19'))](_0xe538('0x3c'));}_0x4f26ca=_0x2247d7;return db[_0xe538('0x3d')]['findOne']({'where':{'id':0x1}});})[_0xe538('0xc')](function(_0x593c25){if(!_0x593c25){throw new db['Sequelize'][(_0xe538('0x19'))](_0xe538('0x3e'));}_0x2c7d06=_0x593c25;if(!_0x2c7d06[_0xe538('0x3f')]||!_0x2c7d06['transcribeAccountId']||!_0x2c7d06[_0xe538('0xb')]||!_0x2c7d06[_0xe538('0x1e')]||!_0x2c7d06[_0xe538('0x1f')]){throw new db[(_0xe538('0x18'))][(_0xe538('0x19'))]('Transcribe\x20not\x20configured');}return db[_0xe538('0x21')][_0xe538('0x22')]({'where':{'id':_0x2c7d06[_0xe538('0x40')]}});})[_0xe538('0xc')](function(_0xe3f20c){if(!_0xe3f20c){throw new db[(_0xe538('0x18'))][(_0xe538('0x19'))](_0xe538('0x23'));}if(!_0xe3f20c[_0xe538('0x26')]||!_0xe3f20c['data2']){throw new db[(_0xe538('0x18'))][(_0xe538('0x19'))](_0xe538('0x24'));}_0x2ad809=_0xe3f20c;var _0x3597c6=[];_0x4f26ca[_0xe538('0x41')](function(_0x2e2f89){_0x3597c6[_0xe538('0x42')](checkTranscribeJob(_0x2e2f89,_0x2c7d06,_0x2ad809));});return BPromise['all'](_0x3597c6);})[_0xe538('0x34')](function(_0x3e1223){if(_0x3e1223){if(!_0x3e1223[_0xe538('0x35')]||_0x3e1223[_0xe538('0x35')]!==_0xe538('0x43')){logger[_0xe538('0x36')](util[_0xe538('0x44')](_0x3e1223,{'showHidden':![],'depth':null}));}}});}exports[_0xe538('0x45')]=function(){setInterval(function(){return checkTranscribe();},0x3c*0x3e8);return checkTranscribe();}; \ No newline at end of file +var _0x7439=['results','transcripts','length','transcript','update','[RECORDING:%d]\x20Voice\x20Recording\x20entry\x20updated','tempSentiment','ValidationError','sentimentAccountId','sentimentRegion','language','bucket','Sentiment\x20Analysis\x20not\x20configured','Transcript\x20not\x20available','CloudProvider','findOne','Cloud\x20Provider\x20not\x20available','Sequelize','Positive','SentimentScore','Negative','Mixed','Neutral','FAILED','FailureReason','[RECORDING:%d]\x20Transcript\x20Job\x20status\x20not\x20managed','resolve','Sentiment\x20Analysis\x20not\x20requested','sentiment','Sentiment','catch','name','SequelizeValidationError','error','[RECORDING:%d]\x20Error\x20running\x20Transcribe\x20&\x20Sentiment\x20Analysis','VoiceRecording','findAll','No\x20transcribe\x20job\x20to\x20check','Settings\x20not\x20available','transcribeAccountId','Cloud\x20Provider\x20not\x20configured','forEach','push','all','inspect','start','lodash','aws-sdk','request-promise','bluebird','../../mysqldb','detectSentiment','substring','info','format','[RECORDING:%d]\x20Get\x20status\x20for\x20transcript\x20job\x20(%s)','transcribeName','data1','data2','transcribeRegion','[RECORDING:%d]\x20Status\x20of\x20transcript\x20job\x20(%s):\x20%s','TranscriptionJobStatus','fileText','COMPLETED','TranscriptionJob','Transcript','TranscriptFileUri','[RECORDING:%d]\x20Get\x20transcript','then'];(function(_0x390aca,_0x25ea70){var _0x48eeba=function(_0x35a260){while(--_0x35a260){_0x390aca['push'](_0x390aca['shift']());}};_0x48eeba(++_0x25ea70);}(_0x7439,0xb8));var _0x9743=function(_0x2a745f,_0x5a973d){_0x2a745f=_0x2a745f-0x0;var _0x3e905c=_0x7439[_0x2a745f];return _0x3e905c;};var _=require(_0x9743('0x0'));var AWS=require(_0x9743('0x1'));var rp=require(_0x9743('0x2'));var util=require('util');var BPromise=require(_0x9743('0x3'));var db=require(_0x9743('0x4'))['db'];var logger=require('../../config/logger')('transcribe');function getTranscriptionJob(_0x4af2df,_0x53b74a,_0x5365b6,_0x527491){return new Promise(function(_0x4a1bc4,_0x53e96c){var _0x4d1836=new AWS['TranscribeService']({'accessKeyId':_0x53b74a,'secretAccessKey':_0x4af2df,'region':_0x5365b6});_0x4d1836['getTranscriptionJob']({'TranscriptionJobName':_0x527491},function(_0x2a47e8,_0x43be19){if(_0x2a47e8){return _0x53e96c(_0x2a47e8);}else{return _0x4a1bc4(_0x43be19);}});});}function sentiment(_0x5198bf,_0x1ca2af,_0x194874,_0x13dda2,_0x1416c9){return new Promise(function(_0x127a1a,_0x42e3f6){var _0x53e1e8=new AWS['Comprehend']({'accessKeyId':_0x1ca2af,'secretAccessKey':_0x5198bf,'region':_0x194874});_0x53e1e8[_0x9743('0x5')]({'Text':_0x13dda2,'LanguageCode':_0x1416c9[_0x9743('0x6')](0x0,0x2)},function(_0x38b87d,_0x2acc4b){if(_0x38b87d){return _0x42e3f6(_0x38b87d);}else{return _0x127a1a(_0x2acc4b);}});});}function checkTranscribeJob(_0x183193,_0x4ae2b4,_0x15e6b9){var _0x118a93;return new BPromise(function(_0x4f1abd,_0x18eb44){logger[_0x9743('0x7')](util[_0x9743('0x8')](_0x9743('0x9'),_0x183193['id'],_0x183193[_0x9743('0xa')]));return getTranscriptionJob(_0x15e6b9[_0x9743('0xb')],_0x15e6b9[_0x9743('0xc')],_0x4ae2b4[_0x9743('0xd')],_0x183193[_0x9743('0xa')])['then'](function(_0xa34f95){logger['info'](util[_0x9743('0x8')](_0x9743('0xe'),_0x183193['id'],_0x183193[_0x9743('0xa')],_0xa34f95['TranscriptionJob'][_0x9743('0xf')]));if(!_0x183193[_0x9743('0x10')]){switch(_0xa34f95['TranscriptionJob'][_0x9743('0xf')]){case _0x9743('0x11'):var _0xe7523d={'transcribeStatus':_0xa34f95[_0x9743('0x12')]['TranscriptionJobStatus'],'fileUri':_0xa34f95[_0x9743('0x12')][_0x9743('0x13')][_0x9743('0x14')]};logger[_0x9743('0x7')](util['format'](_0x9743('0x15'),_0x183193['id']));return rp({'uri':_0xa34f95[_0x9743('0x12')][_0x9743('0x13')][_0x9743('0x14')],'json':!![]})[_0x9743('0x16')](function(_0x2b97e0){logger['info'](util[_0x9743('0x8')]('[RECORDING:%d]\x20Transcript\x20downloaded',_0x183193['id']));if(_0x2b97e0&&_0x2b97e0[_0x9743('0x17')]&&_0x2b97e0['results'][_0x9743('0x18')]&&_0x2b97e0[_0x9743('0x17')][_0x9743('0x18')][_0x9743('0x19')]){_0xe7523d[_0x9743('0x10')]='';for(var _0x3b516e=0x0;_0x3b516e<_0x2b97e0[_0x9743('0x17')][_0x9743('0x18')][_0x9743('0x19')];_0x3b516e++){_0xe7523d[_0x9743('0x10')]+=_0x2b97e0[_0x9743('0x17')]['transcripts'][_0x3b516e][_0x9743('0x1a')]+'';}}return _0x183193[_0x9743('0x1b')](_0xe7523d);})[_0x9743('0x16')](function(){logger['info'](util[_0x9743('0x8')](_0x9743('0x1c'),_0x183193['id']));if(!_0x183193[_0x9743('0x1d')]){throw new db['Sequelize'][(_0x9743('0x1e'))]('Sentiment\x20Analysis\x20not\x20requested');}if(!_0x4ae2b4['sentiment']||!_0x4ae2b4[_0x9743('0x1f')]||!_0x4ae2b4[_0x9743('0x20')]||!_0x4ae2b4[_0x9743('0x21')]||!_0x4ae2b4[_0x9743('0x22')]){throw new db['Sequelize']['ValidationError'](_0x9743('0x23'));}if(!_0xe7523d[_0x9743('0x10')]){throw new Error(_0x9743('0x24'));}if(_0x4ae2b4[_0x9743('0x1f')]===_0x15e6b9['id']){return _0x15e6b9;}else{return db[_0x9743('0x25')][_0x9743('0x26')]({'where':{'id':_settings[_0x9743('0x1f')]}});}})[_0x9743('0x16')](function(_0x3cea5e){if(!_0x3cea5e){throw new db['Sequelize']['ValidationError'](_0x9743('0x27'));}if(!_0x3cea5e[_0x9743('0xb')]||!_0x3cea5e[_0x9743('0xc')]){throw new db[(_0x9743('0x28'))]['ValidationError']('Cloud\x20Provider\x20not\x20configured');}_0x118a93=_0x3cea5e;logger[_0x9743('0x7')](util[_0x9743('0x8')]('[RECORDING:%d]\x20Requesting\x20sentiment\x20analysis',_0x183193['id']));return sentiment(_0x118a93[_0x9743('0xb')],_0x118a93['data2'],_0x4ae2b4[_0x9743('0x20')],_0xe7523d['fileText'],_0x4ae2b4['language']);})[_0x9743('0x16')](function(_0x382d5f){logger[_0x9743('0x7')](util[_0x9743('0x8')]('[RECORDING:%d]\x20Sentiment\x20Analysis\x20available',_0x183193['id']));return _0x183193['update']({'sentiment':_0x382d5f['Sentiment'],'sPositive':_0x382d5f['SentimentScore'][_0x9743('0x29')],'sNegative':_0x382d5f[_0x9743('0x2a')][_0x9743('0x2b')],'sMixed':_0x382d5f[_0x9743('0x2a')][_0x9743('0x2c')],'sNeutral':_0x382d5f[_0x9743('0x2a')][_0x9743('0x2d')]});})['then'](function(){logger['info'](util['format'](_0x9743('0x1c'),_0x183193['id']));_0x4f1abd();});case _0x9743('0x2e'):return _0x183193[_0x9743('0x1b')]({'transcribeStatus':_0x9743('0x2e'),'failureReason':_0xa34f95['TranscriptionJob'][_0x9743('0x2f')]})['then'](function(){logger[_0x9743('0x7')](util[_0x9743('0x8')](_0x9743('0x1c'),_0x183193['id']));_0x4f1abd();});default:logger[_0x9743('0x7')](util[_0x9743('0x8')](_0x9743('0x30'),_0x183193['id']));break;}}else{return BPromise[_0x9743('0x31')]()[_0x9743('0x16')](function(){if(!_0x183193[_0x9743('0x1d')]){throw new db['Sequelize'][(_0x9743('0x1e'))](_0x9743('0x32'));}if(!_0x4ae2b4[_0x9743('0x33')]||!_0x4ae2b4[_0x9743('0x1f')]||!_0x4ae2b4[_0x9743('0x20')]||!_0x4ae2b4[_0x9743('0x21')]||!_0x4ae2b4['bucket']){throw new db['Sequelize'][(_0x9743('0x1e'))]('Sentiment\x20Analysis\x20not\x20configured');}if(!_0x183193['fileText']){throw new Error('Transcript\x20not\x20available');}if(_0x4ae2b4[_0x9743('0x1f')]===_0x15e6b9['id']){return _0x15e6b9;}else{return db[_0x9743('0x25')][_0x9743('0x26')]({'where':{'id':_settings['sentimentAccountId']}});}})[_0x9743('0x16')](function(_0x36be4b){if(!_0x36be4b){throw new db[(_0x9743('0x28'))][(_0x9743('0x1e'))](_0x9743('0x27'));}if(!_0x36be4b[_0x9743('0xb')]||!_0x36be4b[_0x9743('0xc')]){throw new db[(_0x9743('0x28'))]['ValidationError']('Cloud\x20Provider\x20not\x20configured');}_0x118a93=_0x36be4b;logger[_0x9743('0x7')](util[_0x9743('0x8')]('[RECORDING:%d]\x20Requesting\x20sentiment\x20analysis',_0x183193['id']));return sentiment(_0x118a93[_0x9743('0xb')],_0x118a93['data2'],_0x4ae2b4['sentimentRegion'],_0x183193[_0x9743('0x10')],_0x4ae2b4[_0x9743('0x21')]);})[_0x9743('0x16')](function(_0x5cc7a5){logger[_0x9743('0x7')](util['format']('[RECORDING:%d]\x20Sentiment\x20Analysis\x20available',_0x183193['id']));return _0x183193[_0x9743('0x1b')]({'sentiment':_0x5cc7a5[_0x9743('0x34')],'sPositive':_0x5cc7a5[_0x9743('0x2a')][_0x9743('0x29')],'sNegative':_0x5cc7a5[_0x9743('0x2a')][_0x9743('0x2b')],'sMixed':_0x5cc7a5[_0x9743('0x2a')][_0x9743('0x2c')],'sNeutral':_0x5cc7a5[_0x9743('0x2a')][_0x9743('0x2d')],'transcribeStatus':'COMPLETED'});})['then'](function(){logger[_0x9743('0x7')](util[_0x9743('0x8')]('[RECORDING:%d]\x20Voice\x20Recording\x20entry\x20updated',_0x183193['id']));_0x4f1abd();});}})[_0x9743('0x35')](function(_0x384730){if(_0x384730){if(!_0x384730[_0x9743('0x36')]||_0x384730[_0x9743('0x36')]!==_0x9743('0x37')){logger[_0x9743('0x38')](util[_0x9743('0x8')](_0x9743('0x39'),_0x183193['id']),util['inspect'](_0x384730,{'showHidden':![],'depth':null}));}}_0x4f1abd();});});}function checkTranscribe(){var _0x348bd8;var _0x5520d3;var _0x1dde38;return db[_0x9743('0x3a')][_0x9743('0x3b')]({'where':{'transcribeStatus':'IN_PROGRESS'}})[_0x9743('0x16')](function(_0x2eb138){if(!_0x2eb138||!_0x2eb138['length']){throw new db[(_0x9743('0x28'))][(_0x9743('0x1e'))](_0x9743('0x3c'));}_0x348bd8=_0x2eb138;return db['Setting'][_0x9743('0x26')]({'where':{'id':0x1}});})['then'](function(_0x484c38){if(!_0x484c38){throw new db['Sequelize'][(_0x9743('0x1e'))](_0x9743('0x3d'));}_0x5520d3=_0x484c38;if(!_0x5520d3['transcribe']||!_0x5520d3[_0x9743('0x3e')]||!_0x5520d3['transcribeRegion']||!_0x5520d3[_0x9743('0x21')]||!_0x5520d3['bucket']){throw new db['Sequelize']['ValidationError']('Transcribe\x20not\x20configured');}return db['CloudProvider'][_0x9743('0x26')]({'where':{'id':_0x5520d3[_0x9743('0x3e')]}});})['then'](function(_0x1e5188){if(!_0x1e5188){throw new db['Sequelize'][(_0x9743('0x1e'))](_0x9743('0x27'));}if(!_0x1e5188[_0x9743('0xb')]||!_0x1e5188[_0x9743('0xc')]){throw new db[(_0x9743('0x28'))][(_0x9743('0x1e'))](_0x9743('0x3f'));}_0x1dde38=_0x1e5188;var _0x27dfbb=[];_0x348bd8[_0x9743('0x40')](function(_0x44f926){_0x27dfbb[_0x9743('0x41')](checkTranscribeJob(_0x44f926,_0x5520d3,_0x1dde38));});return BPromise[_0x9743('0x42')](_0x27dfbb);})[_0x9743('0x35')](function(_0x209bab){if(_0x209bab){if(!_0x209bab[_0x9743('0x36')]||_0x209bab[_0x9743('0x36')]!==_0x9743('0x37')){logger['error'](util[_0x9743('0x43')](_0x209bab,{'showHidden':![],'depth':null}));}}});}exports[_0x9743('0x44')]=function(){setInterval(function(){return checkTranscribe();},0x3c*0x3e8);return checkTranscribe();}; \ No newline at end of file diff --git a/server/config/seedContact.js b/server/config/seedContact.js index e792570..42f61c7 100644 --- a/server/config/seedContact.js +++ b/server/config/seedContact.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xc835=['hopper2','util','../mysqldb','push','Biondo','innocenzo.biondo','@xcally.com','now','Innocenzo','CmContact','destroy','then','bulkCreate','log','finished\x20populating','contacts1','CmHopper','hopper1','contacts2'];(function(_0x344432,_0x5b990f){var _0x54f671=function(_0x5c6dc8){while(--_0x5c6dc8){_0x344432['push'](_0x344432['shift']());}};_0x54f671(++_0x5b990f);}(_0xc835,0x144));var _0x5c83=function(_0x5b644e,_0x2e5e07){_0x5b644e=_0x5b644e-0x0;var _0x49c6bf=_0xc835[_0x5b644e];return _0x49c6bf;};'use strict';var util=require(_0x5c83('0x0'));var db=require(_0x5c83('0x1'))['db'];var contacts=[];var hopper=[];var contacts2=[];var hopper2=[];for(var i=0x1;i<=0x4b0;i+=0x1){contacts[_0x5c83('0x2')]({'id':i,'firstName':'Innocenzo'+i,'lastName':_0x5c83('0x3')+i,'phone':0xf879fb460+i,'email':_0x5c83('0x4')+i+_0x5c83('0x5')});}for(var i=0x1;i<=0x4b0;i+=0x1){hopper[_0x5c83('0x2')]({'id':i,'active':![],'scheduledat':Date[_0x5c83('0x6')](),'countbusyretry':0x0,'countcongestionretry':0x0,'countnoanswerretry':0x0,'ContactId':i,'ListId':0x1,'UserId':0x1,'VoiceQueueId':0x3fd,'createdAt':Date[_0x5c83('0x6')](),'updatedAt':Date['now']()});}for(var i=0x4b1;i<=0x960;i+=0x1){contacts2[_0x5c83('0x2')]({'id':i,'firstName':_0x5c83('0x7')+i,'lastName':'Biondo'+i,'phone':0xf879fb460+i,'email':_0x5c83('0x4')+i+_0x5c83('0x5')});}for(var i=0x4b1;i<=0x960;i+=0x1){hopper2['push']({'id':i,'active':![],'scheduledat':Date[_0x5c83('0x6')](),'countbusyretry':0x0,'countcongestionretry':0x0,'countnoanswerretry':0x0,'ContactId':i,'ListId':0x1,'UserId':0x1,'VoiceQueueId':0x3fd,'createdAt':Date[_0x5c83('0x6')](),'updatedAt':Date[_0x5c83('0x6')]()});}db[_0x5c83('0x8')][_0x5c83('0x9')]({'where':{}})[_0x5c83('0xa')](function(){return db[_0x5c83('0x8')][_0x5c83('0xb')](contacts);})[_0x5c83('0xa')](function(){console[_0x5c83('0xc')](_0x5c83('0xd'),_0x5c83('0xe'));return db[_0x5c83('0xf')][_0x5c83('0x9')]({'where':{}});})['then'](function(){return db['CmHopper'][_0x5c83('0xb')](hopper);})[_0x5c83('0xa')](function(){console[_0x5c83('0xc')]('finished\x20populating',_0x5c83('0x10'));return db[_0x5c83('0x8')][_0x5c83('0xb')](contacts2);})[_0x5c83('0xa')](function(){console[_0x5c83('0xc')](_0x5c83('0xd'),_0x5c83('0x11'));return db['CmHopper'][_0x5c83('0xb')](hopper2);})['then'](function(){console[_0x5c83('0xc')](_0x5c83('0xd'),_0x5c83('0x12'));})['catch'](function(_0x5a50a9){console['log'](_0x5a50a9);}); \ No newline at end of file +var _0x86a6=['@xcally.com','now','innocenzo.biondo','destroy','then','CmContact','bulkCreate','log','finished\x20populating','contacts1','CmHopper','contacts2','hopper2','../mysqldb','push','Innocenzo','Biondo'];(function(_0xe7707,_0x22c1b8){var _0x194e8e=function(_0x439885){while(--_0x439885){_0xe7707['push'](_0xe7707['shift']());}};_0x194e8e(++_0x22c1b8);}(_0x86a6,0x10c));var _0x686a=function(_0x3ff2f9,_0x544ba1){_0x3ff2f9=_0x3ff2f9-0x0;var _0x3b0913=_0x86a6[_0x3ff2f9];return _0x3b0913;};'use strict';var util=require('util');var db=require(_0x686a('0x0'))['db'];var contacts=[];var hopper=[];var contacts2=[];var hopper2=[];for(var i=0x1;i<=0x4b0;i+=0x1){contacts[_0x686a('0x1')]({'id':i,'firstName':_0x686a('0x2')+i,'lastName':_0x686a('0x3')+i,'phone':0xf879fb460+i,'email':'innocenzo.biondo'+i+_0x686a('0x4')});}for(var i=0x1;i<=0x4b0;i+=0x1){hopper[_0x686a('0x1')]({'id':i,'active':![],'scheduledat':Date[_0x686a('0x5')](),'countbusyretry':0x0,'countcongestionretry':0x0,'countnoanswerretry':0x0,'ContactId':i,'ListId':0x1,'UserId':0x1,'VoiceQueueId':0x3fd,'createdAt':Date[_0x686a('0x5')](),'updatedAt':Date[_0x686a('0x5')]()});}for(var i=0x4b1;i<=0x960;i+=0x1){contacts2['push']({'id':i,'firstName':_0x686a('0x2')+i,'lastName':'Biondo'+i,'phone':0xf879fb460+i,'email':_0x686a('0x6')+i+_0x686a('0x4')});}for(var i=0x4b1;i<=0x960;i+=0x1){hopper2[_0x686a('0x1')]({'id':i,'active':![],'scheduledat':Date[_0x686a('0x5')](),'countbusyretry':0x0,'countcongestionretry':0x0,'countnoanswerretry':0x0,'ContactId':i,'ListId':0x1,'UserId':0x1,'VoiceQueueId':0x3fd,'createdAt':Date['now'](),'updatedAt':Date[_0x686a('0x5')]()});}db['CmContact'][_0x686a('0x7')]({'where':{}})[_0x686a('0x8')](function(){return db[_0x686a('0x9')][_0x686a('0xa')](contacts);})[_0x686a('0x8')](function(){console[_0x686a('0xb')](_0x686a('0xc'),_0x686a('0xd'));return db[_0x686a('0xe')][_0x686a('0x7')]({'where':{}});})['then'](function(){return db[_0x686a('0xe')][_0x686a('0xa')](hopper);})[_0x686a('0x8')](function(){console[_0x686a('0xb')](_0x686a('0xc'),'hopper1');return db[_0x686a('0x9')][_0x686a('0xa')](contacts2);})[_0x686a('0x8')](function(){console[_0x686a('0xb')](_0x686a('0xc'),_0x686a('0xf'));return db[_0x686a('0xe')]['bulkCreate'](hopper2);})['then'](function(){console[_0x686a('0xb')](_0x686a('0xc'),_0x686a('0x10'));})['catch'](function(_0x35d88b){console[_0x686a('0xb')](_0x35d88b);}); \ No newline at end of file diff --git a/server/config/seedUsers.js b/server/config/seedUsers.js index ea95e5c..88ca39a 100644 --- a/server/config/seedUsers.js +++ b/server/config/seedUsers.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x218a=['../mysqldb','push','agent','format','%s%s@xcally.com','friend','udp','wss','all','ulaw','%s%s','yes','/etc/pki/tls/certs/motion.crt','\x22%s\x22\x20<%s>','bulkCreate','then','add\x20user','util'];(function(_0x1861c9,_0x59a8f1){var _0x1ce18f=function(_0x1e3c89){while(--_0x1e3c89){_0x1861c9['push'](_0x1861c9['shift']());}};_0x1ce18f(++_0x59a8f1);}(_0x218a,0x179));var _0xa218=function(_0x44b82e,_0x527fb7){_0x44b82e=_0x44b82e-0x0;var _0x12ec1e=_0x218a[_0x44b82e];return _0x12ec1e;};'use strict';var util=require(_0xa218('0x0'));var db=require(_0xa218('0x1'))['db'];var users=[];for(var i=0x1;i<=0xc8;i+=0x1){users[_0xa218('0x2')]({'name':util['format']('%s%s',_0xa218('0x3'),i),'fullname':util[_0xa218('0x4')]('%s%s','agent',i),'email':util[_0xa218('0x4')](_0xa218('0x5'),'agent',i),'role':_0xa218('0x3'),'password':'password','internal':0xfa0+i,'type':_0xa218('0x6'),'transport':[_0xa218('0x7'),'ws',_0xa218('0x8')],'disallow':[_0xa218('0x9')],'allow':[_0xa218('0xa')],'defaultuser':util['format'](_0xa218('0xb'),_0xa218('0x3'),i),'encryption':'yes','avpf':_0xa218('0xc'),'force_avp':_0xa218('0xc'),'icesupport':'yes','dtlsenable':_0xa218('0xc'),'dtlsverify':'no','dtlscertfile':_0xa218('0xd'),'dtlsprivatekey':'/etc/pki/tls/private/motion.key','dtlssetup':'actpass','callerid':util['format'](_0xa218('0xe'),util['format']('%s%s',_0xa218('0x3'),i),0xfa0+i)});}db['User'][_0xa218('0xf')](users)[_0xa218('0x10')](function(){console['log'](_0xa218('0x11'));})['catch'](function(_0x661261){console['log'](_0x661261);}); \ No newline at end of file +var _0xa85c=['add\x20user','catch','util','format','%s%s','agent','%s%s@xcally.com','password','friend','udp','all','ulaw','yes','/etc/pki/tls/certs/motion.crt','/etc/pki/tls/private/motion.key','actpass','User','bulkCreate','log'];(function(_0x2b4201,_0x383749){var _0x3887f5=function(_0x2cfd0f){while(--_0x2cfd0f){_0x2b4201['push'](_0x2b4201['shift']());}};_0x3887f5(++_0x383749);}(_0xa85c,0xc0));var _0xca85=function(_0x396466,_0xe9857b){_0x396466=_0x396466-0x0;var _0x5e9ab4=_0xa85c[_0x396466];return _0x5e9ab4;};'use strict';var util=require(_0xca85('0x0'));var db=require('../mysqldb')['db'];var users=[];for(var i=0x1;i<=0xc8;i+=0x1){users['push']({'name':util[_0xca85('0x1')](_0xca85('0x2'),'agent',i),'fullname':util[_0xca85('0x1')](_0xca85('0x2'),_0xca85('0x3'),i),'email':util[_0xca85('0x1')](_0xca85('0x4'),_0xca85('0x3'),i),'role':_0xca85('0x3'),'password':_0xca85('0x5'),'internal':0xfa0+i,'type':_0xca85('0x6'),'transport':[_0xca85('0x7'),'ws','wss'],'disallow':[_0xca85('0x8')],'allow':[_0xca85('0x9')],'defaultuser':util[_0xca85('0x1')](_0xca85('0x2'),_0xca85('0x3'),i),'encryption':_0xca85('0xa'),'avpf':'yes','force_avp':_0xca85('0xa'),'icesupport':_0xca85('0xa'),'dtlsenable':'yes','dtlsverify':'no','dtlscertfile':_0xca85('0xb'),'dtlsprivatekey':_0xca85('0xc'),'dtlssetup':_0xca85('0xd'),'callerid':util[_0xca85('0x1')]('\x22%s\x22\x20<%s>',util[_0xca85('0x1')](_0xca85('0x2'),'agent',i),0xfa0+i)});}db[_0xca85('0xe')][_0xca85('0xf')](users)['then'](function(){console[_0xca85('0x10')](_0xca85('0x11'));})[_0xca85('0x12')](function(_0x1c9229){console[_0xca85('0x10')](_0x1c9229);}); \ No newline at end of file diff --git a/server/config/socketio.js b/server/config/socketio.js index 1499247..f2b0fdb 100644 --- a/server/config/socketio.js +++ b/server/config/socketio.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa828=['util','bluebird','../mysqldb','./environment','Agents','User','role','name','telephone','type','ivr','UserProfileSection','findOne','autoAssociation','ChatQueues','FaxQueues','OpenchannelQueues','findAll','Telephones','Trunks','resourceId','then','map','where','format','%s:queue:%s','length','query','userProfileId','handshake','ChatInteractions','MailInteractions','FaxInteraction','FaxInteractions','SmsInteraction','OpenchannelInteraction','user:%s','admin','voice:inbound','hasOwnProperty','VoiceQueue','push','ChatQueue','FaxQueue','SmsQueue','MailQueue','OpenchannelQueue','Trunk','Campaign','user','voice:outbound','VoiceQueues','SmsQueues','MailQueues','IvrCampaigns','agent','getVoiceQueues','getChatQueues','getSmsQueues','getMailQueues','getOpenchannelQueues','all','voice','chat','fax','mail','openchannel','telephone:%s','campaign:%s:%s','leave','removeChatInteractions','emit','user_has_chat_interactions:remove','removeFaxInteractions','user_has_fax_interactions:remove','SmsInteractions','removeSmsInteractions','OpenchannelInteractions','removeOpenchannelInteractions','user_has_openchannel_interactions:remove','catch','log','default','connection','setMaxListeners','address','request','remoteAddress','remotePort','connectedAt','SocketIO\x20','nsp','DISCONNECTED','CONNECTED','lodash'];(function(_0x24897e,_0x37936f){var _0x43944c=function(_0x401ccc){while(--_0x401ccc){_0x24897e['push'](_0x24897e['shift']());}};_0x43944c(++_0x37936f);}(_0xa828,0x1da));var _0x8a82=function(_0x7818b1,_0x505da9){_0x7818b1=_0x7818b1-0x0;var _0x15e2f1=_0xa828[_0x7818b1];return _0x15e2f1;};'use strict';var _=require(_0x8a82('0x0'));var util=require(_0x8a82('0x1'));var BPromise=require(_0x8a82('0x2'));var db=require(_0x8a82('0x3'))['db'];var config=require(_0x8a82('0x4'));var queryQueues={'attributes':['id','name'],'include':[{'as':_0x8a82('0x5'),'model':db[_0x8a82('0x6')],'attributes':['id','name',_0x8a82('0x7')],'raw':!![],'where':{'role':'agent'},'required':![]}]};var queryTelephones={'raw':!![],'attributes':['id',_0x8a82('0x8')],'where':{'role':_0x8a82('0x9')}};var queryTrunks={'raw':!![],'attributes':['id','name']};var queryAgents={'raw':!![],'attributes':['id',_0x8a82('0x8')],'where':{'role':'agent'}};var queryCampaigns={'raw':!![],'attributes':['id',_0x8a82('0x8'),_0x8a82('0xa')],'where':{'type':_0x8a82('0xb')}};function getAssociatedResources(_0x13fead,_0x27be02,_0x364eee){return db[_0x8a82('0xc')][_0x8a82('0xd')]({'where':{'name':_0x13fead,'userProfileId':_0x27be02},'raw':!![]})['then'](function(_0xee770e){if(_0xee770e){if(_0xee770e[_0x8a82('0xe')]){switch(_0x13fead){case'VoiceQueues':case _0x8a82('0xf'):case _0x8a82('0x10'):case'SmsQueues':case'MailQueues':case _0x8a82('0x11'):return db[_0x364eee][_0x8a82('0x12')](queryQueues);case _0x8a82('0x13'):return db[_0x364eee][_0x8a82('0x12')](queryTelephones);case _0x8a82('0x14'):return db[_0x364eee][_0x8a82('0x12')](queryTrunks);case'IvrCampaigns':return db[_0x364eee][_0x8a82('0x12')](queryCampaigns);}}else{return db['UserProfileResource'][_0x8a82('0x12')]({'attributes':[_0x8a82('0x15')],'where':{'sectionId':_0xee770e['id']},'raw':!![]})[_0x8a82('0x16')](function(_0x3673db){if(_0x3673db){var _0x448882={'where':{'id':_[_0x8a82('0x17')](_0x3673db,_0x8a82('0x15'))},'raw':!![]};switch(_0x364eee){case _0x8a82('0x6'):_0x448882[_0x8a82('0x18')][_0x8a82('0x7')]=_0x8a82('0x9');break;case'Campaign':_0x448882[_0x8a82('0x18')][_0x8a82('0xa')]=_0x8a82('0xb');break;}return db[_0x364eee][_0x8a82('0x12')](_0x448882);}else{return[];}});}}else{return[];}})[_0x8a82('0x16')](function(_0x1cf933){return _0x1cf933;});}function joinOrLeaveQueues(_0x2f230f,_0x475371,_0x4544ea,_0x44a305){_0x2f230f[_0x475371](util[_0x8a82('0x19')](_0x8a82('0x1a'),_0x4544ea,_0x44a305[_0x8a82('0x8')]));if(_0x44a305[_0x8a82('0x5')]){for(var _0xa0179f=0x0;_0xa0179f<_0x44a305['Agents'][_0x8a82('0x1b')];_0xa0179f+=0x1){_0x2f230f[_0x475371](util[_0x8a82('0x19')]('user:%s',_0x44a305[_0x8a82('0x5')][_0xa0179f][_0x8a82('0x8')]));}}}function joinOrLeave(_0x598c51,_0x1579a7,_0x3e87a3){var _0x41c4f1;if(_0x598c51['handshake'][_0x8a82('0x1c')]['id']){db['User']['find']({'attributes':['id','name',_0x8a82('0x7'),_0x8a82('0x1d')],'where':{'id':_0x598c51[_0x8a82('0x1e')][_0x8a82('0x1c')]['id']},'include':[{'model':db['ChatInteraction'],'as':_0x8a82('0x1f'),'attributes':['id'],'raw':!![]},{'model':db['MailInteraction'],'as':_0x8a82('0x20'),'attributes':['id'],'raw':!![]},{'model':db[_0x8a82('0x21')],'as':_0x8a82('0x22'),'attributes':['id'],'raw':!![]},{'model':db[_0x8a82('0x23')],'as':'SmsInteractions','attributes':['id'],'raw':!![]},{'model':db[_0x8a82('0x24')],'as':'OpenchannelInteractions','attributes':['id'],'raw':!![]}]})['then'](function(_0x12beed){if(_0x12beed){_0x41c4f1=_0x12beed;_0x598c51[_0x1579a7](util[_0x8a82('0x19')](_0x8a82('0x25'),_0x12beed['name']));var _0x4c9164=[];switch(_0x12beed[_0x8a82('0x7')]){case _0x8a82('0x26'):_0x598c51[_0x1579a7](_0x8a82('0x27'));_0x598c51[_0x1579a7]('voice:outbound');if(queryQueues[_0x8a82('0x28')]('include')){delete queryQueues['include'];}_0x4c9164['push'](db[_0x8a82('0x29')][_0x8a82('0x12')](queryQueues));_0x4c9164[_0x8a82('0x2a')](db[_0x8a82('0x2b')][_0x8a82('0x12')](queryQueues));_0x4c9164[_0x8a82('0x2a')](db[_0x8a82('0x2c')][_0x8a82('0x12')](queryQueues));_0x4c9164['push'](db[_0x8a82('0x2d')][_0x8a82('0x12')](queryQueues));_0x4c9164[_0x8a82('0x2a')](db[_0x8a82('0x2e')][_0x8a82('0x12')](queryQueues));_0x4c9164[_0x8a82('0x2a')](db[_0x8a82('0x2f')]['findAll'](queryQueues));_0x4c9164['push'](db[_0x8a82('0x6')]['findAll'](queryTelephones));_0x4c9164[_0x8a82('0x2a')](db[_0x8a82('0x30')][_0x8a82('0x12')](queryTrunks));_0x4c9164[_0x8a82('0x2a')](db[_0x8a82('0x31')][_0x8a82('0x12')](queryCampaigns));_0x4c9164[_0x8a82('0x2a')](db['User']['findAll'](queryAgents));break;case _0x8a82('0x32'):_0x598c51[_0x1579a7]('voice:inbound');_0x598c51[_0x1579a7](_0x8a82('0x33'));_0x4c9164['push'](getAssociatedResources(_0x8a82('0x34'),_0x12beed[_0x8a82('0x1d')],'VoiceQueue'));_0x4c9164[_0x8a82('0x2a')](getAssociatedResources(_0x8a82('0xf'),_0x12beed[_0x8a82('0x1d')],_0x8a82('0x2b')));_0x4c9164[_0x8a82('0x2a')](getAssociatedResources(_0x8a82('0x10'),_0x12beed['userProfileId'],_0x8a82('0x2c')));_0x4c9164[_0x8a82('0x2a')](getAssociatedResources(_0x8a82('0x35'),_0x12beed[_0x8a82('0x1d')],'SmsQueue'));_0x4c9164[_0x8a82('0x2a')](getAssociatedResources(_0x8a82('0x36'),_0x12beed[_0x8a82('0x1d')],'MailQueue'));_0x4c9164[_0x8a82('0x2a')](getAssociatedResources(_0x8a82('0x11'),_0x12beed['userProfileId'],_0x8a82('0x2f')));_0x4c9164[_0x8a82('0x2a')](getAssociatedResources(_0x8a82('0x13'),_0x12beed[_0x8a82('0x1d')],_0x8a82('0x6')));_0x4c9164[_0x8a82('0x2a')](getAssociatedResources(_0x8a82('0x14'),_0x12beed['userProfileId'],_0x8a82('0x30')));_0x4c9164[_0x8a82('0x2a')](getAssociatedResources(_0x8a82('0x37'),_0x12beed[_0x8a82('0x1d')],_0x8a82('0x31')));_0x4c9164[_0x8a82('0x2a')](db['User'][_0x8a82('0x12')](queryAgents));break;case _0x8a82('0x38'):_0x598c51[_0x1579a7]('voice:inbound');_0x598c51[_0x1579a7](_0x8a82('0x33'));_0x4c9164[_0x8a82('0x2a')](_0x12beed[_0x8a82('0x39')]({'attributes':['id',_0x8a82('0x8')]}));_0x4c9164[_0x8a82('0x2a')](_0x12beed[_0x8a82('0x3a')]({'attributes':['id',_0x8a82('0x8')]}));_0x4c9164[_0x8a82('0x2a')](_0x12beed['getFaxQueues']({'attributes':['id',_0x8a82('0x8')]}));_0x4c9164[_0x8a82('0x2a')](_0x12beed[_0x8a82('0x3b')]({'attributes':['id','name']}));_0x4c9164[_0x8a82('0x2a')](_0x12beed[_0x8a82('0x3c')]({'attributes':['id',_0x8a82('0x8')]}));_0x4c9164[_0x8a82('0x2a')](_0x12beed[_0x8a82('0x3d')]({'attributes':['id',_0x8a82('0x8')]}));break;}return BPromise[_0x8a82('0x3e')](_0x4c9164);}})[_0x8a82('0x16')](function(_0x4cdd0d){if(_0x4cdd0d&&_0x4cdd0d[_0x8a82('0x1b')]){for(var _0x49bce3=0x0;_0x49bce3<_0x4cdd0d[_0x8a82('0x1b')];_0x49bce3+=0x1){for(var _0x2faa73=0x0;_0x2faa73<_0x4cdd0d[_0x49bce3][_0x8a82('0x1b')];_0x2faa73+=0x1){switch(_0x49bce3){case 0x0:joinOrLeaveQueues(_0x598c51,_0x1579a7,_0x8a82('0x3f'),_0x4cdd0d[_0x49bce3][_0x2faa73]);break;case 0x1:joinOrLeaveQueues(_0x598c51,_0x1579a7,_0x8a82('0x40'),_0x4cdd0d[_0x49bce3][_0x2faa73]);break;case 0x2:joinOrLeaveQueues(_0x598c51,_0x1579a7,_0x8a82('0x41'),_0x4cdd0d[_0x49bce3][_0x2faa73]);break;case 0x3:joinOrLeaveQueues(_0x598c51,_0x1579a7,'sms',_0x4cdd0d[_0x49bce3][_0x2faa73]);break;case 0x4:joinOrLeaveQueues(_0x598c51,_0x1579a7,_0x8a82('0x42'),_0x4cdd0d[_0x49bce3][_0x2faa73]);break;case 0x5:joinOrLeaveQueues(_0x598c51,_0x1579a7,_0x8a82('0x43'),_0x4cdd0d[_0x49bce3][_0x2faa73]);break;case 0x6:_0x598c51[_0x1579a7](util[_0x8a82('0x19')](_0x8a82('0x44'),_0x4cdd0d[_0x49bce3][_0x2faa73]['name']));break;case 0x7:_0x598c51[_0x1579a7](util['format']('trunk:%s',_0x4cdd0d[_0x49bce3][_0x2faa73][_0x8a82('0x8')]));break;case 0x8:_0x598c51[_0x1579a7](util[_0x8a82('0x19')](_0x8a82('0x45'),_0x4cdd0d[_0x49bce3][_0x2faa73][_0x8a82('0xa')],_0x4cdd0d[_0x49bce3][_0x2faa73][_0x8a82('0x8')]));break;case 0x9:_0x598c51[_0x1579a7](util[_0x8a82('0x19')](_0x8a82('0x25'),_0x4cdd0d[_0x49bce3][_0x2faa73][_0x8a82('0x8')]));break;}}}}})[_0x8a82('0x16')](function(){if(_0x1579a7===_0x8a82('0x46')){var _0x5c8343=_[_0x8a82('0x17')](_0x41c4f1[_0x8a82('0x1f')],'id');return _0x41c4f1[_0x8a82('0x47')](_0x5c8343)['then'](function(){for(var _0x3962a0=0x0;_0x3962a0<_0x5c8343[_0x8a82('0x1b')];_0x3962a0+=0x1){_0x3e87a3[_0x8a82('0x48')](_0x8a82('0x49'),{'ChatInteractionId':Number(_0x5c8343[_0x3962a0]),'UserId':Number(_0x41c4f1['id'])});}});}})[_0x8a82('0x16')](function(){if(_0x1579a7===_0x8a82('0x46')){var _0x549099=_['map'](_0x41c4f1[_0x8a82('0x20')],'id');return _0x41c4f1['removeMailInteractions'](_0x549099)['then'](function(){for(var _0x54f513=0x0;_0x54f513<_0x549099[_0x8a82('0x1b')];_0x54f513+=0x1){_0x3e87a3[_0x8a82('0x48')]('user_has_mail_interactions:remove',{'MailInteractionId':Number(_0x549099[_0x54f513]),'UserId':Number(_0x41c4f1['id'])});}});}})['then'](function(){if(_0x1579a7===_0x8a82('0x46')){var _0xab7780=_['map'](_0x41c4f1[_0x8a82('0x22')],'id');return _0x41c4f1[_0x8a82('0x4a')](_0xab7780)[_0x8a82('0x16')](function(){for(var _0xaaddb6=0x0;_0xaaddb6<_0xab7780[_0x8a82('0x1b')];_0xaaddb6+=0x1){_0x3e87a3[_0x8a82('0x48')](_0x8a82('0x4b'),{'FaxInteractionId':Number(_0xab7780[_0xaaddb6]),'UserId':Number(_0x41c4f1['id'])});}});}})[_0x8a82('0x16')](function(){if(_0x1579a7==='leave'){var _0x4934c8=_[_0x8a82('0x17')](_0x41c4f1[_0x8a82('0x4c')],'id');return _0x41c4f1[_0x8a82('0x4d')](_0x4934c8)[_0x8a82('0x16')](function(){for(var _0x10e909=0x0;_0x10e909<_0x4934c8[_0x8a82('0x1b')];_0x10e909+=0x1){_0x3e87a3[_0x8a82('0x48')]('user_has_sms_interactions:remove',{'SmsInteractionId':Number(_0x4934c8[_0x10e909]),'UserId':Number(_0x41c4f1['id'])});}});}})[_0x8a82('0x16')](function(){if(_0x1579a7===_0x8a82('0x46')){var _0x45b1d5=_[_0x8a82('0x17')](_0x41c4f1[_0x8a82('0x4e')],'id');return _0x41c4f1[_0x8a82('0x4f')](_0x45b1d5)[_0x8a82('0x16')](function(){for(var _0x15ae83=0x0;_0x15ae83<_0x45b1d5[_0x8a82('0x1b')];_0x15ae83+=0x1){_0x3e87a3[_0x8a82('0x48')](_0x8a82('0x50'),{'OpenchannelInteractionId':Number(_0x45b1d5[_0x15ae83]),'UserId':Number(_0x41c4f1['id'])});}});}})[_0x8a82('0x51')](function(_0x48d593){_0x598c51[_0x8a82('0x52')](_0x48d593);});}}function onDisconnect(_0x5cea58,_0x162e9d){joinOrLeave(_0x5cea58,'leave',_0x162e9d);}function onConnect(_0x32f00f){joinOrLeave(_0x32f00f,'join');}exports[_0x8a82('0x53')]=function(_0x4ff8bf){_0x4ff8bf['on'](_0x8a82('0x54'),function(_0x1108d9){_0x1108d9[_0x8a82('0x55')](0x0);_0x1108d9[_0x8a82('0x56')]=_0x1108d9[_0x8a82('0x57')][_0x8a82('0x54')][_0x8a82('0x58')]+':'+_0x1108d9[_0x8a82('0x57')]['connection'][_0x8a82('0x59')];_0x1108d9[_0x8a82('0x5a')]=new Date();_0x1108d9[_0x8a82('0x52')]=function(_0x41d9d6){console[_0x8a82('0x52')](_0x8a82('0x5b')+_0x1108d9[_0x8a82('0x5c')][_0x8a82('0x8')]+'['+_0x1108d9[_0x8a82('0x56')]+']',_0x41d9d6);};_0x1108d9['on']('disconnect',function(){onDisconnect(_0x1108d9,_0x4ff8bf);_0x1108d9[_0x8a82('0x52')](_0x8a82('0x5d'));});onConnect(_0x1108d9);_0x1108d9[_0x8a82('0x52')](_0x8a82('0x5e'));});}; \ No newline at end of file +var _0x8e89=['telephone','Campaign','where','length','format','user:%s','handshake','find','query','ChatInteraction','ChatInteractions','MailInteraction','MailInteractions','FaxInteraction','FaxInteractions','SmsInteraction','SmsInteractions','OpenchannelInteraction','OpenchannelInteractions','admin','voice:outbound','hasOwnProperty','include','push','VoiceQueue','ChatQueue','FaxQueue','SmsQueue','OpenchannelQueue','Trunk','userProfileId','OpenchannelQueues','voice:inbound','getFaxQueues','getOpenchannelQueues','all','chat','fax','mail','telephone:%s','campaign:%s:%s','removeChatInteractions','emit','removeMailInteractions','user_has_mail_interactions:remove','leave','user_has_fax_interactions:remove','removeSmsInteractions','user_has_sms_interactions:remove','user_has_openchannel_interactions:remove','log','setMaxListeners','address','request','connection','remoteAddress','remotePort','connectedAt','SocketIO\x20','nsp','disconnect','DISCONNECTED','CONNECTED','lodash','util','bluebird','../mysqldb','./environment','name','Agents','User','role','agent','type','ivr','UserProfileSection','findOne','then','autoAssociation','ChatQueues','FaxQueues','SmsQueues','MailQueues','Telephones','findAll','Trunks','IvrCampaigns','map','resourceId'];(function(_0x5e6487,_0x2718b8){var _0x70c092=function(_0x16300f){while(--_0x16300f){_0x5e6487['push'](_0x5e6487['shift']());}};_0x70c092(++_0x2718b8);}(_0x8e89,0x14a));var _0x98e8=function(_0x183b97,_0x2d297c){_0x183b97=_0x183b97-0x0;var _0x629cf7=_0x8e89[_0x183b97];return _0x629cf7;};'use strict';var _=require(_0x98e8('0x0'));var util=require(_0x98e8('0x1'));var BPromise=require(_0x98e8('0x2'));var db=require(_0x98e8('0x3'))['db'];var config=require(_0x98e8('0x4'));var queryQueues={'attributes':['id',_0x98e8('0x5')],'include':[{'as':_0x98e8('0x6'),'model':db[_0x98e8('0x7')],'attributes':['id',_0x98e8('0x5'),_0x98e8('0x8')],'raw':!![],'where':{'role':_0x98e8('0x9')},'required':![]}]};var queryTelephones={'raw':!![],'attributes':['id',_0x98e8('0x5')],'where':{'role':'telephone'}};var queryTrunks={'raw':!![],'attributes':['id',_0x98e8('0x5')]};var queryAgents={'raw':!![],'attributes':['id',_0x98e8('0x5')],'where':{'role':_0x98e8('0x9')}};var queryCampaigns={'raw':!![],'attributes':['id',_0x98e8('0x5'),_0x98e8('0xa')],'where':{'type':_0x98e8('0xb')}};function getAssociatedResources(_0x552c3f,_0x3fdf25,_0x435347){return db[_0x98e8('0xc')][_0x98e8('0xd')]({'where':{'name':_0x552c3f,'userProfileId':_0x3fdf25},'raw':!![]})[_0x98e8('0xe')](function(_0x4766a2){if(_0x4766a2){if(_0x4766a2[_0x98e8('0xf')]){switch(_0x552c3f){case'VoiceQueues':case _0x98e8('0x10'):case _0x98e8('0x11'):case _0x98e8('0x12'):case _0x98e8('0x13'):case'OpenchannelQueues':return db[_0x435347]['findAll'](queryQueues);case _0x98e8('0x14'):return db[_0x435347][_0x98e8('0x15')](queryTelephones);case _0x98e8('0x16'):return db[_0x435347][_0x98e8('0x15')](queryTrunks);case _0x98e8('0x17'):return db[_0x435347][_0x98e8('0x15')](queryCampaigns);}}else{return db['UserProfileResource'][_0x98e8('0x15')]({'attributes':['resourceId'],'where':{'sectionId':_0x4766a2['id']},'raw':!![]})[_0x98e8('0xe')](function(_0x3d2482){if(_0x3d2482){var _0x18c76a={'where':{'id':_[_0x98e8('0x18')](_0x3d2482,_0x98e8('0x19'))},'raw':!![]};switch(_0x435347){case _0x98e8('0x7'):_0x18c76a['where']['role']=_0x98e8('0x1a');break;case _0x98e8('0x1b'):_0x18c76a[_0x98e8('0x1c')][_0x98e8('0xa')]=_0x98e8('0xb');break;}return db[_0x435347][_0x98e8('0x15')](_0x18c76a);}else{return[];}});}}else{return[];}})[_0x98e8('0xe')](function(_0x4daea9){return _0x4daea9;});}function joinOrLeaveQueues(_0x4419e8,_0x58163c,_0x5cf999,_0x51e75a){_0x4419e8[_0x58163c](util['format']('%s:queue:%s',_0x5cf999,_0x51e75a[_0x98e8('0x5')]));if(_0x51e75a[_0x98e8('0x6')]){for(var _0x41af79=0x0;_0x41af79<_0x51e75a[_0x98e8('0x6')][_0x98e8('0x1d')];_0x41af79+=0x1){_0x4419e8[_0x58163c](util[_0x98e8('0x1e')](_0x98e8('0x1f'),_0x51e75a[_0x98e8('0x6')][_0x41af79][_0x98e8('0x5')]));}}}function joinOrLeave(_0x5f71aa,_0x4574ae,_0x3d920d){var _0xa111dc;if(_0x5f71aa[_0x98e8('0x20')]['query']['id']){db[_0x98e8('0x7')][_0x98e8('0x21')]({'attributes':['id',_0x98e8('0x5'),'role','userProfileId'],'where':{'id':_0x5f71aa[_0x98e8('0x20')][_0x98e8('0x22')]['id']},'include':[{'model':db[_0x98e8('0x23')],'as':_0x98e8('0x24'),'attributes':['id'],'raw':!![]},{'model':db[_0x98e8('0x25')],'as':_0x98e8('0x26'),'attributes':['id'],'raw':!![]},{'model':db[_0x98e8('0x27')],'as':_0x98e8('0x28'),'attributes':['id'],'raw':!![]},{'model':db[_0x98e8('0x29')],'as':_0x98e8('0x2a'),'attributes':['id'],'raw':!![]},{'model':db[_0x98e8('0x2b')],'as':_0x98e8('0x2c'),'attributes':['id'],'raw':!![]}]})[_0x98e8('0xe')](function(_0x1ba2f1){if(_0x1ba2f1){_0xa111dc=_0x1ba2f1;_0x5f71aa[_0x4574ae](util['format'](_0x98e8('0x1f'),_0x1ba2f1[_0x98e8('0x5')]));var _0x5e326e=[];switch(_0x1ba2f1[_0x98e8('0x8')]){case _0x98e8('0x2d'):_0x5f71aa[_0x4574ae]('voice:inbound');_0x5f71aa[_0x4574ae](_0x98e8('0x2e'));if(queryQueues[_0x98e8('0x2f')](_0x98e8('0x30'))){delete queryQueues['include'];}_0x5e326e[_0x98e8('0x31')](db[_0x98e8('0x32')][_0x98e8('0x15')](queryQueues));_0x5e326e['push'](db[_0x98e8('0x33')][_0x98e8('0x15')](queryQueues));_0x5e326e[_0x98e8('0x31')](db[_0x98e8('0x34')]['findAll'](queryQueues));_0x5e326e['push'](db[_0x98e8('0x35')][_0x98e8('0x15')](queryQueues));_0x5e326e[_0x98e8('0x31')](db['MailQueue'][_0x98e8('0x15')](queryQueues));_0x5e326e[_0x98e8('0x31')](db[_0x98e8('0x36')][_0x98e8('0x15')](queryQueues));_0x5e326e[_0x98e8('0x31')](db[_0x98e8('0x7')]['findAll'](queryTelephones));_0x5e326e[_0x98e8('0x31')](db[_0x98e8('0x37')][_0x98e8('0x15')](queryTrunks));_0x5e326e[_0x98e8('0x31')](db['Campaign'][_0x98e8('0x15')](queryCampaigns));_0x5e326e[_0x98e8('0x31')](db[_0x98e8('0x7')][_0x98e8('0x15')](queryAgents));break;case'user':_0x5f71aa[_0x4574ae]('voice:inbound');_0x5f71aa[_0x4574ae](_0x98e8('0x2e'));_0x5e326e['push'](getAssociatedResources('VoiceQueues',_0x1ba2f1[_0x98e8('0x38')],_0x98e8('0x32')));_0x5e326e[_0x98e8('0x31')](getAssociatedResources(_0x98e8('0x10'),_0x1ba2f1['userProfileId'],'ChatQueue'));_0x5e326e['push'](getAssociatedResources(_0x98e8('0x11'),_0x1ba2f1['userProfileId'],_0x98e8('0x34')));_0x5e326e[_0x98e8('0x31')](getAssociatedResources(_0x98e8('0x12'),_0x1ba2f1[_0x98e8('0x38')],_0x98e8('0x35')));_0x5e326e[_0x98e8('0x31')](getAssociatedResources(_0x98e8('0x13'),_0x1ba2f1[_0x98e8('0x38')],'MailQueue'));_0x5e326e['push'](getAssociatedResources(_0x98e8('0x39'),_0x1ba2f1[_0x98e8('0x38')],_0x98e8('0x36')));_0x5e326e[_0x98e8('0x31')](getAssociatedResources(_0x98e8('0x14'),_0x1ba2f1['userProfileId'],_0x98e8('0x7')));_0x5e326e[_0x98e8('0x31')](getAssociatedResources(_0x98e8('0x16'),_0x1ba2f1[_0x98e8('0x38')],_0x98e8('0x37')));_0x5e326e[_0x98e8('0x31')](getAssociatedResources(_0x98e8('0x17'),_0x1ba2f1[_0x98e8('0x38')],'Campaign'));_0x5e326e[_0x98e8('0x31')](db['User'][_0x98e8('0x15')](queryAgents));break;case _0x98e8('0x9'):_0x5f71aa[_0x4574ae](_0x98e8('0x3a'));_0x5f71aa[_0x4574ae](_0x98e8('0x2e'));_0x5e326e['push'](_0x1ba2f1['getVoiceQueues']({'attributes':['id',_0x98e8('0x5')]}));_0x5e326e[_0x98e8('0x31')](_0x1ba2f1['getChatQueues']({'attributes':['id',_0x98e8('0x5')]}));_0x5e326e[_0x98e8('0x31')](_0x1ba2f1[_0x98e8('0x3b')]({'attributes':['id','name']}));_0x5e326e[_0x98e8('0x31')](_0x1ba2f1['getSmsQueues']({'attributes':['id',_0x98e8('0x5')]}));_0x5e326e[_0x98e8('0x31')](_0x1ba2f1['getMailQueues']({'attributes':['id',_0x98e8('0x5')]}));_0x5e326e[_0x98e8('0x31')](_0x1ba2f1[_0x98e8('0x3c')]({'attributes':['id',_0x98e8('0x5')]}));break;}return BPromise[_0x98e8('0x3d')](_0x5e326e);}})['then'](function(_0x2e0088){if(_0x2e0088&&_0x2e0088[_0x98e8('0x1d')]){for(var _0x278cc2=0x0;_0x278cc2<_0x2e0088[_0x98e8('0x1d')];_0x278cc2+=0x1){for(var _0x388818=0x0;_0x388818<_0x2e0088[_0x278cc2][_0x98e8('0x1d')];_0x388818+=0x1){switch(_0x278cc2){case 0x0:joinOrLeaveQueues(_0x5f71aa,_0x4574ae,'voice',_0x2e0088[_0x278cc2][_0x388818]);break;case 0x1:joinOrLeaveQueues(_0x5f71aa,_0x4574ae,_0x98e8('0x3e'),_0x2e0088[_0x278cc2][_0x388818]);break;case 0x2:joinOrLeaveQueues(_0x5f71aa,_0x4574ae,_0x98e8('0x3f'),_0x2e0088[_0x278cc2][_0x388818]);break;case 0x3:joinOrLeaveQueues(_0x5f71aa,_0x4574ae,'sms',_0x2e0088[_0x278cc2][_0x388818]);break;case 0x4:joinOrLeaveQueues(_0x5f71aa,_0x4574ae,_0x98e8('0x40'),_0x2e0088[_0x278cc2][_0x388818]);break;case 0x5:joinOrLeaveQueues(_0x5f71aa,_0x4574ae,'openchannel',_0x2e0088[_0x278cc2][_0x388818]);break;case 0x6:_0x5f71aa[_0x4574ae](util[_0x98e8('0x1e')](_0x98e8('0x41'),_0x2e0088[_0x278cc2][_0x388818][_0x98e8('0x5')]));break;case 0x7:_0x5f71aa[_0x4574ae](util[_0x98e8('0x1e')]('trunk:%s',_0x2e0088[_0x278cc2][_0x388818]['name']));break;case 0x8:_0x5f71aa[_0x4574ae](util[_0x98e8('0x1e')](_0x98e8('0x42'),_0x2e0088[_0x278cc2][_0x388818][_0x98e8('0xa')],_0x2e0088[_0x278cc2][_0x388818]['name']));break;case 0x9:_0x5f71aa[_0x4574ae](util[_0x98e8('0x1e')]('user:%s',_0x2e0088[_0x278cc2][_0x388818][_0x98e8('0x5')]));break;}}}}})['then'](function(){if(_0x4574ae==='leave'){var _0x15127a=_[_0x98e8('0x18')](_0xa111dc[_0x98e8('0x24')],'id');return _0xa111dc[_0x98e8('0x43')](_0x15127a)[_0x98e8('0xe')](function(){for(var _0x238a88=0x0;_0x238a88<_0x15127a[_0x98e8('0x1d')];_0x238a88+=0x1){_0x3d920d[_0x98e8('0x44')]('user_has_chat_interactions:remove',{'ChatInteractionId':Number(_0x15127a[_0x238a88]),'UserId':Number(_0xa111dc['id'])});}});}})['then'](function(){if(_0x4574ae==='leave'){var _0x44fd03=_[_0x98e8('0x18')](_0xa111dc[_0x98e8('0x26')],'id');return _0xa111dc[_0x98e8('0x45')](_0x44fd03)['then'](function(){for(var _0x383b77=0x0;_0x383b77<_0x44fd03['length'];_0x383b77+=0x1){_0x3d920d['emit'](_0x98e8('0x46'),{'MailInteractionId':Number(_0x44fd03[_0x383b77]),'UserId':Number(_0xa111dc['id'])});}});}})[_0x98e8('0xe')](function(){if(_0x4574ae===_0x98e8('0x47')){var _0x589c1c=_[_0x98e8('0x18')](_0xa111dc['FaxInteractions'],'id');return _0xa111dc['removeFaxInteractions'](_0x589c1c)[_0x98e8('0xe')](function(){for(var _0x14b2e5=0x0;_0x14b2e5<_0x589c1c['length'];_0x14b2e5+=0x1){_0x3d920d[_0x98e8('0x44')](_0x98e8('0x48'),{'FaxInteractionId':Number(_0x589c1c[_0x14b2e5]),'UserId':Number(_0xa111dc['id'])});}});}})[_0x98e8('0xe')](function(){if(_0x4574ae==='leave'){var _0x197ef0=_[_0x98e8('0x18')](_0xa111dc['SmsInteractions'],'id');return _0xa111dc[_0x98e8('0x49')](_0x197ef0)[_0x98e8('0xe')](function(){for(var _0x3ae5a2=0x0;_0x3ae5a2<_0x197ef0[_0x98e8('0x1d')];_0x3ae5a2+=0x1){_0x3d920d['emit'](_0x98e8('0x4a'),{'SmsInteractionId':Number(_0x197ef0[_0x3ae5a2]),'UserId':Number(_0xa111dc['id'])});}});}})['then'](function(){if(_0x4574ae===_0x98e8('0x47')){var _0x15d859=_[_0x98e8('0x18')](_0xa111dc[_0x98e8('0x2c')],'id');return _0xa111dc['removeOpenchannelInteractions'](_0x15d859)[_0x98e8('0xe')](function(){for(var _0x3db283=0x0;_0x3db283<_0x15d859[_0x98e8('0x1d')];_0x3db283+=0x1){_0x3d920d[_0x98e8('0x44')](_0x98e8('0x4b'),{'OpenchannelInteractionId':Number(_0x15d859[_0x3db283]),'UserId':Number(_0xa111dc['id'])});}});}})['catch'](function(_0x418c11){_0x5f71aa[_0x98e8('0x4c')](_0x418c11);});}}function onDisconnect(_0x4811e8,_0x1b06a1){joinOrLeave(_0x4811e8,'leave',_0x1b06a1);}function onConnect(_0x1fe6ea){joinOrLeave(_0x1fe6ea,'join');}exports['default']=function(_0x3be885){_0x3be885['on']('connection',function(_0x53b4a){_0x53b4a[_0x98e8('0x4d')](0x0);_0x53b4a[_0x98e8('0x4e')]=_0x53b4a[_0x98e8('0x4f')][_0x98e8('0x50')][_0x98e8('0x51')]+':'+_0x53b4a['request'][_0x98e8('0x50')][_0x98e8('0x52')];_0x53b4a[_0x98e8('0x53')]=new Date();_0x53b4a[_0x98e8('0x4c')]=function(_0x16da60){console['log'](_0x98e8('0x54')+_0x53b4a[_0x98e8('0x55')][_0x98e8('0x5')]+'['+_0x53b4a[_0x98e8('0x4e')]+']',_0x16da60);};_0x53b4a['on'](_0x98e8('0x56'),function(){onDisconnect(_0x53b4a,_0x3be885);_0x53b4a[_0x98e8('0x4c')](_0x98e8('0x57'));});onConnect(_0x53b4a);_0x53b4a[_0x98e8('0x4c')](_0x98e8('0x58'));});}; \ No newline at end of file diff --git a/server/config/triggers/index.js b/server/config/triggers/index.js index 69287cb..c1a9108 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 _0xfd61=['afterCreate','newinteraction','ChatInteraction','afterUpdate','closedinteraction','ChatMessage','newmessage','Sms','SmsInteraction','SmsMessage','Fax','FaxInteraction','FaxMessage','Mail','MailInteraction','MailMessage','Openchannel','OpenchannelInteraction','OpenchannelMessage','request','EventManager','then','info','Trigger,\x20%s','error','code','catch','get','channel','event','direction','UserId','find','name','interface','format','SIP/%s','outgoingmessage','opened','changed','closed','User','default','length','hasOwnProperty','model','callback','toLowerCase','condition','util','../../mysqldb','../logger','triggers','client','http','Chat'];(function(_0x234ae1,_0x42bdd6){var _0x227ba0=function(_0x1f6531){while(--_0x1f6531){_0x234ae1['push'](_0x234ae1['shift']());}};_0x227ba0(++_0x42bdd6);}(_0xfd61,0xd9));var _0x1fd6=function(_0x29975a,_0x2ca253){_0x29975a=_0x29975a-0x0;var _0x41bcac=_0xfd61[_0x29975a];return _0x41bcac;};'use strict';var util=require(_0x1fd6('0x0'));var db=require(_0x1fd6('0x1'))['db'];var jayson=require('jayson/promise');var logger=require(_0x1fd6('0x2'))(_0x1fd6('0x3'));var client=jayson[_0x1fd6('0x4')][_0x1fd6('0x5')]({'port':0x232a});var triggers=[{'channel':_0x1fd6('0x6'),'model':'ChatInteraction','event':_0x1fd6('0x7'),'condition':_0x1fd6('0x8'),'callback':afterCreate},{'channel':'Chat','model':_0x1fd6('0x9'),'event':_0x1fd6('0xa'),'condition':_0x1fd6('0xb'),'callback':afterUpdate},{'channel':_0x1fd6('0x6'),'model':_0x1fd6('0xc'),'event':_0x1fd6('0x7'),'condition':_0x1fd6('0xd'),'callback':afterCreateMessage},{'channel':_0x1fd6('0xe'),'model':_0x1fd6('0xf'),'event':_0x1fd6('0x7'),'condition':_0x1fd6('0x8'),'callback':afterCreate},{'channel':_0x1fd6('0xe'),'model':_0x1fd6('0xf'),'event':_0x1fd6('0xa'),'condition':'closedinteraction','callback':afterUpdate},{'channel':'Sms','model':_0x1fd6('0x10'),'event':_0x1fd6('0x7'),'condition':_0x1fd6('0xd'),'callback':afterCreateMessage},{'channel':_0x1fd6('0x11'),'model':_0x1fd6('0x12'),'event':'afterCreate','condition':_0x1fd6('0x8'),'callback':afterCreate},{'channel':_0x1fd6('0x11'),'model':_0x1fd6('0x12'),'event':_0x1fd6('0xa'),'condition':_0x1fd6('0xb'),'callback':afterUpdate},{'channel':_0x1fd6('0x11'),'model':_0x1fd6('0x13'),'event':_0x1fd6('0x7'),'condition':_0x1fd6('0xd'),'callback':afterCreateMessage},{'channel':_0x1fd6('0x14'),'model':_0x1fd6('0x15'),'event':_0x1fd6('0x7'),'condition':_0x1fd6('0x8'),'callback':afterCreate},{'channel':_0x1fd6('0x14'),'model':_0x1fd6('0x15'),'event':_0x1fd6('0xa'),'condition':_0x1fd6('0xb'),'callback':afterUpdate},{'channel':_0x1fd6('0x14'),'model':_0x1fd6('0x16'),'event':_0x1fd6('0x7'),'condition':_0x1fd6('0xd'),'callback':afterCreateMessage},{'channel':_0x1fd6('0x17'),'model':_0x1fd6('0x18'),'event':_0x1fd6('0x7'),'condition':_0x1fd6('0x8'),'callback':afterCreate},{'channel':_0x1fd6('0x17'),'model':'OpenchannelInteraction','event':_0x1fd6('0xa'),'condition':_0x1fd6('0xb'),'callback':afterUpdate},{'channel':_0x1fd6('0x17'),'model':_0x1fd6('0x19'),'event':_0x1fd6('0x7'),'condition':_0x1fd6('0xd'),'callback':afterCreateMessage}];function request(_0x52f8f2){return client[_0x1fd6('0x1a')](_0x1fd6('0x1b'),_0x52f8f2)[_0x1fd6('0x1c')](function(_0xd2b491){logger[_0x1fd6('0x1d')](_0x1fd6('0x1e'),_0x1fd6('0x1b'),_0xd2b491);if(_0xd2b491[_0x1fd6('0x1f')]){if(_0xd2b491['error'][_0x1fd6('0x20')]===0x1f4){logger[_0x1fd6('0x1f')](_0x1fd6('0x1e'),_0x1fd6('0x1b'),_0xd2b491['error']);}}})[_0x1fd6('0x21')](function(_0x5ee3fa){logger[_0x1fd6('0x1f')](_0x1fd6('0x1e'),'EventManager',_0x5ee3fa);});}function afterCreateMessage(_0x546bc2,_0x222683){return function(_0x411e08,_0x2c5028){_0x411e08=_0x411e08[_0x1fd6('0x22')]({'plain':!![]});_0x411e08[_0x1fd6('0x23')]=_0x546bc2;_0x411e08[_0x1fd6('0x24')]=_0x411e08[_0x1fd6('0x25')];if(_0x411e08[_0x1fd6('0x26')]){return db['User'][_0x1fd6('0x27')]({'where':{'id':_0x411e08[_0x1fd6('0x26')]},'attributes':['id',_0x1fd6('0x28')],'raw':!![]})[_0x1fd6('0x1c')](function(_0xa3b3b7){_0x411e08[_0x1fd6('0x29')]=util[_0x1fd6('0x2a')](_0x1fd6('0x2b'),_0xa3b3b7[_0x1fd6('0x28')]);_0x411e08[_0x1fd6('0x23')]=_0x546bc2;return request({'event':'incomingmessage','message':_0x411e08});})[_0x1fd6('0x21')](function(_0x2b3151){console[_0x1fd6('0x1f')](_0x2b3151);});}else{return request({'event':_0x1fd6('0x2c'),'message':_0x411e08});}};}function afterCreate(_0xd688ef,_0x44d8ab){return function(_0x322d52,_0x3e220e){_0x322d52=_0x322d52['get']({'plain':!![]});_0x322d52[_0x1fd6('0x23')]=_0xd688ef;_0x322d52[_0x1fd6('0x24')]=_0x1fd6('0x2d');return request({'event':_0x44d8ab,'message':_0x322d52});};}function afterUpdate(_0x4f0ac5,_0x209010){return function(_0x3685b9,_0x4136fc){if(_0x3685b9[_0x1fd6('0x2e')](_0x1fd6('0x2f'))&&_0x3685b9[_0x1fd6('0x2f')]){_0x3685b9=_0x3685b9['get']({'plain':!![]});_0x3685b9[_0x1fd6('0x23')]=_0x4f0ac5;_0x3685b9[_0x1fd6('0x24')]='closed';if(_0x3685b9[_0x1fd6('0x26')]){return db[_0x1fd6('0x30')][_0x1fd6('0x27')]({'where':{'id':_0x3685b9[_0x1fd6('0x26')]},'attributes':['id','name'],'raw':!![]})[_0x1fd6('0x1c')](function(_0x2d8f9e){_0x3685b9[_0x1fd6('0x29')]=util[_0x1fd6('0x2a')](_0x1fd6('0x2b'),_0x2d8f9e[_0x1fd6('0x28')]);return request({'event':_0x209010,'message':_0x3685b9});})[_0x1fd6('0x21')](function(_0x5343ad){console[_0x1fd6('0x1f')](_0x5343ad);});}else{return request({'event':_0x209010,'message':_0x3685b9});}}};}exports[_0x1fd6('0x31')]=function(){for(var _0x346582=0x0;_0x346582=_0x3fb75a[_0xe20e('0x12')]){throw Error(_0xe20e('0x13'));}_0x1393ea(_0x2bb84b);})[_0xe20e('0x14')](function(_0x22319b){_0x23761a(_0x22319b);});});}; \ No newline at end of file +var _0x6833=['fax','sms','getChannels','isValidChannel','toLowerCase','clearBlockUser','blockedAt','updateAttributes','getLicense','role','agent','count','then','agents','Maximum\x20login\x20has\x20been\x20reached','catch','lodash','bluebird','../mysqldb','./license/util','voice','chat'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x6833,0x68));var _0x3683=function(_0x42b55d,_0x241889){_0x42b55d=_0x42b55d-0x0;var _0x50722a=_0x6833[_0x42b55d];return _0x50722a;};'use strict';var _=require(_0x3683('0x0'));var BPromise=require(_0x3683('0x1'));var db=require(_0x3683('0x2'))['db'];var util=require(_0x3683('0x3'));var channels=[_0x3683('0x4'),'mail',_0x3683('0x5'),_0x3683('0x6'),_0x3683('0x7'),'openchannel'];exports[_0x3683('0x8')]=function(){return channels;};exports[_0x3683('0x9')]=function(_0x4eea85){_0x4eea85=_0x4eea85[_0x3683('0xa')]();return _['includes'](channels,_0x4eea85);};exports[_0x3683('0xb')]=function(_0x2bf7a5,_0x92a882,_0x596942,_0x1469fb){var _0x4860b4={'loginAttempts':_0x92a882,'blocked':_0x596942};if(!_['isUndefined'](_0x1469fb)){_0x4860b4[_0x3683('0xc')]=_0x1469fb;}return _0x2bf7a5[_0x3683('0xd')](_0x4860b4);};exports[_0x3683('0xe')]=function(_0x3163ef){return new BPromise(function(_0x4f209b,_0x44d4aa){var _0x1f0b7f=0x0;if(_0x3163ef[_0x3683('0xf')]!==_0x3683('0x10')){_0x4f209b(_0x3163ef);}db['User'][_0x3683('0x11')]({'where':{'role':_0x3683('0x10'),'online':!![],'id':{'$ne':_0x3163ef['id']}}})[_0x3683('0x12')](function(_0x2af142){_0x1f0b7f=_0x2af142;return util[_0x3683('0xe')]();})[_0x3683('0x12')](function(_0x4f15a8){if(_0x4f15a8&&_0x4f15a8['agents']&&_0x1f0b7f>=_0x4f15a8[_0x3683('0x13')]){throw Error(_0x3683('0x14'));}_0x4f209b(_0x3163ef);})[_0x3683('0x15')](function(_0x44fd78){_0x44d4aa(_0x44fd78);});});}; \ No newline at end of file diff --git a/server/errors/index.js b/server/errors/index.js index f2d829d..508c98f 100644 --- a/server/errors/index.js +++ b/server/errors/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xd78c=['404','status','json','send','exports'];(function(_0x21501d,_0x422d9d){var _0x199d36=function(_0x553d36){while(--_0x553d36){_0x21501d['push'](_0x21501d['shift']());}};_0x199d36(++_0x422d9d);}(_0xd78c,0x86));var _0xcd78=function(_0x1035c1,_0x2d8583){_0x1035c1=_0x1035c1-0x0;var _0x308d67=_0xd78c[_0x1035c1];return _0x308d67;};'use strict';module[_0xcd78('0x0')][0x194]=function pageNotFound(_0x367307,_0x2f79c0){var _0x3b90f6=_0xcd78('0x1');var _0x557f17=0x194;var _0x231861={'status':_0x557f17};_0x2f79c0[_0xcd78('0x2')](_0x231861[_0xcd78('0x2')]);_0x2f79c0['render'](_0x3b90f6,{},function(_0x5a3d76,_0x25e2fa){if(_0x5a3d76){return _0x2f79c0[_0xcd78('0x2')](_0x231861[_0xcd78('0x2')])[_0xcd78('0x3')](_0x231861);}_0x2f79c0[_0xcd78('0x4')](_0x25e2fa);});}; \ No newline at end of file +var _0xf3b8=['exports','404','status','render','send'];(function(_0x3e45a6,_0x477ac5){var _0x128ac4=function(_0x17a075){while(--_0x17a075){_0x3e45a6['push'](_0x3e45a6['shift']());}};_0x128ac4(++_0x477ac5);}(_0xf3b8,0x11d));var _0x8f3b=function(_0x33032e,_0x31411a){_0x33032e=_0x33032e-0x0;var _0x13316b=_0xf3b8[_0x33032e];return _0x13316b;};'use strict';module[_0x8f3b('0x0')][0x194]=function pageNotFound(_0x275958,_0x1ea032){var _0x53f1dc=_0x8f3b('0x1');var _0x3128ae=0x194;var _0x146a69={'status':_0x3128ae};_0x1ea032[_0x8f3b('0x2')](_0x146a69['status']);_0x1ea032[_0x8f3b('0x3')](_0x53f1dc,{},function(_0x9a20c1,_0x5a9bf4){if(_0x9a20c1){return _0x1ea032[_0x8f3b('0x2')](_0x146a69[_0x8f3b('0x2')])['json'](_0x146a69);}_0x1ea032[_0x8f3b('0x4')](_0x5a9bf4);});}; \ No newline at end of file diff --git a/server/mysqldb/index.js b/server/mysqldb/index.js index baefa3e..051c288 100644 --- a/server/mysqldb/index.js +++ b/server/mysqldb/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x54b6=['../api/faxAccount/faxAccount.model','../api/faxApplication/faxApplication.model','FaxInteraction','../api/faxInteraction/faxInteraction.model','FaxMessage','../api/faxMessage/faxMessage.model','FaxQueue','../api/faxQueue/faxQueue.model','SmsAccount','../api/smsAccount/smsAccount.model','SmsInteraction','SmsMessage','../api/smsMessage/smsMessage.model','SmsQueue','../api/smsQueue/smsQueue.model','OpenchannelAccount','../api/openchannelAccount/openchannelAccount.model','OpenchannelApplication','OpenchannelInteraction','../api/openchannelInteraction/openchannelInteraction.model','OpenchannelMessage','../api/openchannelMessage/openchannelMessage.model','../api/openchannelQueue/openchannelQueue.model','ChatWebsite','../api/chatWebsite/chatWebsite.model','OpenchannelQueueReport','../api/openchannelQueueReport/openchannelQueueReport.model','ChatApplication','ChatInteraction','../api/chatInteraction/chatInteraction.model','ChatMessage','../api/chatMessage/chatMessage.model','ChatOfflineMessage','../api/chatOfflineMessage/chatOfflineMessage.model','ChatQueue','../api/chatQueue/chatQueue.model','ChatGroup','../api/chatGroup/chatGroup.model','ChatProactiveAction','../api/chatProactiveAction/chatProactiveAction.model','CmCompany','../api/cmCompany/cmCompany.model','CmContact','../api/cmContact/cmContact.model','CmHopper','../api/cmHopper/cmHopper.model','../api/cmHopperBlack/cmHopperBlack.model','CmHopperFinal','../api/cmHopperFinal/cmHopperFinal.model','CmHopperHistory','../api/cmHopperHistory/cmHopperHistory.model','../api/reportAgentPreview/reportAgentPreview.model','CmCustomField','../api/cmCustomField/cmCustomField.model','Action','../api/action/action.model','Automation','../api/automation/automation.model','../api/cannedAnswer/cannedAnswer.model','Disposition','../api/disposition/disposition.model','Condition','../api/condition/condition.model','Interval','../api/interval/interval.model','Pause','Cdr','../api/cdr/cdr.model','VoiceQueuesLog','../api/voiceQueuesLog/voiceQueuesLog.model','../api/sound/sound.model','Tag','../api/tag/tag.model','Template','../api/template/template.model','Trigger','Variable','../api/variable/variable.model','../api/integration/integration.model','IntegrationReport','../api/integrationReport/integrationReport.model','AnalyticCustomReport','../api/analyticCustomReport/analyticCustomReport.model','AnalyticDefaultReport','../api/analyticDefaultReport/analyticDefaultReport.model','AnalyticExtractedReport','../api/analyticExtractedReport/analyticExtractedReport.model','../api/analyticMetric/analyticMetric.model','AnalyticFieldReport','../api/analyticFieldReport/analyticFieldReport.model','../api/analyticTreeReport/analyticTreeReport.model','SalesforceAccount','../api/intSalesforceAccount/intSalesforceAccount.model','../api/intSalesforceConfiguration/intSalesforceConfiguration.model','SalesforceField','../api/intSalesforceField/intSalesforceField.model','SugarcrmAccount','../api/intSugarcrmConfiguration/intSugarcrmConfiguration.model','SugarcrmField','../api/intSugarcrmField/intSugarcrmField.model','DeskAccount','../api/intDeskAccount/intDeskAccount.model','../api/intDeskConfiguration/intDeskConfiguration.model','DeskField','ZohoAccount','../api/intZohoAccount/intZohoAccount.model','ZohoConfiguration','../api/intZohoConfiguration/intZohoConfiguration.model','ZohoField','../api/intZohoField/intZohoField.model','ZendeskAccount','../api/intZendeskAccount/intZendeskAccount.model','ZendeskConfiguration','../api/intZendeskConfiguration/intZendeskConfiguration.model','ZendeskField','../api/intZendeskField/intZendeskField.model','FreshdeskConfiguration','../api/intFreshdeskField/intFreshdeskField.model','VtigerAccount','../api/intVtigerAccount/intVtigerAccount.model','VtigerConfiguration','../api/intVtigerConfiguration/intVtigerConfiguration.model','VtigerField','../api/intVtigerField/intVtigerField.model','ServicenowAccount','../api/intServicenowAccount/intServicenowAccount.model','ServicenowConfiguration','../api/intServicenowField/intServicenowField.model','Dynamics365Account','../api/intDynamics365Account/intDynamics365Account.model','Dynamics365Configuration','../api/intDynamics365Configuration/intDynamics365Configuration.model','Dynamics365Field','../api/intDynamics365Field/intDynamics365Field.model','FreshsalesConfiguration','FreshsalesField','../api/intFreshsalesField/intFreshsalesField.model','Integration','Network','ChatQueueReport','../api/chatQueueReport/chatQueueReport.model','ChatInternalMessage','JscriptyQuestionReport','../api/jscriptyQuestionReport/jscriptyQuestionReport.model','../api/jscriptySessionReport/jscriptySessionReport.model','SmsQueueReport','../api/smsQueueReport/smsQueueReport.model','SquareReport','../api/squareReport/squareReport.model','SquareDetailsReport','../api/squareReportDetail/squareReportDetail.model','JscriptyProject','Setting','../api/setting/setting.model','../api/squareOdbc/squareOdbc.model','../api/squareProject/squareProject.model','SquareRecording','../api/squareRecording/squareRecording.model','Team','../api/team/team.model','../api/license/license.model','Campaign','../api/campaign/campaign.model','Migration','../api/migration/migration.model','Attachment','../api/attachment/attachment.model','Plugin','../api/plugin/plugin.model','../api/mailTransferReport/mailTransferReport.model','ChatTransferReport','../api/chatTransferReport/chatTransferReport.model','FaxTransferReport','OpenchannelTransferReport','../api/openchannelTransferReport/openchannelTransferReport.model','SmsTransferReport','../api/smsTransferReport/smsTransferReport.model','CmList','VoicePrefix','../api/voicePrefix/voicePrefix.model','UserProfile','../api/userProfile/userProfile.model','UserProfileSection','UserProfileResource','../api/userProfileResource/userProfileResource.model','VoiceMail','cascade','hasMany','VoiceQueuesRt','UserId','Extensions','HopperHistory','ReportAgentPreview','OpenchannelInteractions','ChatInteractions','FaxInteractions','MailInteractions','userProfileId','Groups','belongsToMany','Contacts','Lists','user_has_mail_interactions','user_has_chat_interactions','SmsInteractions','VoiceQueues','ChatQueues','OpenchannelQueue','OpenchannelQueues','user_has_voice_prefixes','ChatWebsites','FaxAccount','FaxAccounts','user_has_fax_accounts','MailAccounts','user_has_mail_accounts','OpenchannelAccounts','user_has_openchannel_accounts','user_has_sms_accounts','SquareProject','SquareProjects','user_has_square_projects','SpiedAgents','ChanSpyId','Applications','Sound','moh_has_sounds','VoiceQueue','Members','VoiceQueueId','HopperFinals','CmHopperBlack','HopperBlacks','JscriptySessionReport','JscriptySessions','belongsTo','TrunkId','TrunkBackupId','IntervalId','mandatoryDispositionPause','voice_queues_has_cm_lists','Agents','Teams','team_has_voice_queues','BlackLists','voice_queues_has_cm_blacklists','mailboxuser','VoiceCallReport','QueueCalls','uniqueid','VoiceAgentReport','AgentReports','Contact','ContactId','MailAccountId','MailServerOut','Imap','hasOne','Smtp','Dispositions','CannedAnswer','Answers','Interactions','List','ListId','mandatoryDispositionPauseId','team_has_mail_queues','MailInteractionId','Owner','mail_interaction_has_tags','Tags','ThroughTags','Users','Attachments','Interaction','Account','restrict','MailQueueReport','Items','FaxAccountId','FaxApplication','Messages','TagId','FaxInteractionId','fax_interaction_has_tags','AttachmentId','team_has_fax_queues','FaxQueueReport','SmsAccountId','SmsApplication','SmsInteractionId','sms_interaction_has_tags','user_has_sms_interactions','SmsQueueId','team_has_sms_queues','OpenchannelAccountId','openchannel_interaction_has_tags','user_has_openchannel_interactions','OpenchannelInteractionId','UserOpenchannelQueue','OpenchannelQueueId','team_has_openchannel_queues','ChatWebsiteId','ProactiveActions','Agent','Queue','ChatQueueId','Website','chat_interaction_has_tags','ChatInteractionId','team_has_chat_queues','ChatGroupId','chat_group_has_users','CompanyId','Hoppers','HopperHistories','Company','cm_user_has_contacts','cm_contact_has_tags','CampaignId','OwnerId','All','OneAll','AutomationAllId','Any','OneAny','Actions','AutomationId','Intervals','MailApplications','FaxApplications','SmsApplications','Schedule','DefaultReportId','CustomReportId','Mohs','AllConditions','AllCondition','AnyConditions','TriggerAnyId','TriggerId','Fields','AnalyticMetric','MetricId','SalesforceConfiguration','Configurations','AccountId','Descriptions','FieldId','Subject','Description','DescriptionId','Field','VariableId','SugarcrmConfiguration','Subjects','SubjectId','DeskConfiguration','int_zendesk_configuration_has_tags','FreshdeskAccount','FreshdeskField','int_freshdesk_configuration_has_tags','ServicenowField','FreshsalesAccount','FromId','ToId','SessionId','JscriptyAnswerReport','ProjectId','user_has_teams','MailQueues','FaxQueues','SmsQueues','SquareProjectId','campaigns_has_cm_lists','campaigns_has_cm_blacklists','MailTransferReport','FromMailAccountId','FromAccount','ToUserId','ToAgent','ToMailQueueId','ToQueue','ToMailAccountId','ToAccount','FromChatWebsiteId','FromUserId','FromAgent','ToChatQueueId','ToChatWebsiteId','FromFaxAccountId','ToFaxQueueId','FromOpenchannelAccountId','FromSmsAccountId','ToSmsQueueId','CustomFields','Queues','cm_user_has_lists','Resources','path','../config/environment','determine','sequelize','xcall','xC@LL1234','mysql','name','utf8','utf8_general_ci','sequelizeHistory','defaultsDeep','motion2','127.0.0.1','utf8mb4','database','username','password','options','User','import','../api/user/user.model','VoiceChanSpy','../api/voiceChanSpy/voiceChanSpy.model','VoiceContext','../api/voiceContext/voiceContext.model','VoiceExtension','../api/voiceExtension/voiceExtension.model','VoiceMusicOnHold','../api/voiceQueue/voiceQueue.model','VoiceRecording','../api/voiceRecording/voiceRecording.model','ScreenRecording','../api/screenRecording/screenRecording.model','../api/voiceMail/voiceMail.model','VoiceMailMessage','VoiceDialReport','../api/voiceDialReport/voiceDialReport.model','../api/voiceAgentReport/voiceAgentReport.model','VoiceQueueReport','../api/voiceQueueReport/voiceQueueReport.model','MemberReport','Trunk','../api/trunk/trunk.model','UserVoiceQueueRt','../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','../api/userOpenchannelQueue/userOpenchannelQueue.model','MailServerIn','../api/mailServerIn/mailServerIn.model','MailAccount','../api/mailAccount/mailAccount.model','MailQueue','../api/mailQueue/mailQueue.model','MailSubstatus','../api/mailSubstatus/mailSubstatus.model','MailInteraction','../api/mailInteraction/mailInteraction.model','MailMessage','../api/mailMessage/mailMessage.model','MailApplication','../api/mailApplication/mailApplication.model','../api/mailQueueReport/mailQueueReport.model','Dashboard','../api/dashboard/dashboard.model','DashboardItem','../api/dashboardItem/dashboardItem.model'];(function(_0x353d59,_0xbc0e8e){var _0x59d50f=function(_0x397865){while(--_0x397865){_0x353d59['push'](_0x353d59['shift']());}};_0x59d50f(++_0xbc0e8e);}(_0x54b6,0x18f));var _0x654b=function(_0x45fc6a,_0x166adb){_0x45fc6a=_0x45fc6a-0x0;var _0x14bcfd=_0x54b6[_0x45fc6a];return _0x14bcfd;};'use strict';var path=require(_0x654b('0x0'));var config=require(_0x654b('0x1'));var Sequelize=require('sequelize');var _=require('lodash');var jstz=require('jstz');var timezone=jstz[_0x654b('0x2')]();config[_0x654b('0x3')]=_['defaultsDeep'](config[_0x654b('0x3')],{'database':'motion2','username':_0x654b('0x4'),'password':_0x654b('0x5'),'options':{'host':'127.0.0.1','port':0xcea,'dialect':_0x654b('0x6'),'dialectOptions':{'charset':'utf8mb4'},'logging':![],'timezone':timezone[_0x654b('0x7')](),'define':{'charset':_0x654b('0x8'),'collate':_0x654b('0x9')}}});config[_0x654b('0xa')]=_[_0x654b('0xb')](config[_0x654b('0xa')],{'database':_0x654b('0xc'),'username':_0x654b('0x4'),'password':_0x654b('0x5'),'options':{'host':_0x654b('0xd'),'port':0xcea,'dialect':_0x654b('0x6'),'dialectOptions':{'charset':_0x654b('0xe')},'logging':![],'timezone':timezone[_0x654b('0x7')](),'define':{'charset':'utf8','collate':_0x654b('0x9')}}});var db={'Sequelize':Sequelize,'sequelize':new Sequelize(config[_0x654b('0x3')][_0x654b('0xf')],config[_0x654b('0x3')][_0x654b('0x10')],config[_0x654b('0x3')][_0x654b('0x11')],config[_0x654b('0x3')][_0x654b('0x12')])};var dbH={'Sequelize':Sequelize,'sequelize':new Sequelize(config[_0x654b('0xa')][_0x654b('0xf')],config[_0x654b('0xa')]['username'],config[_0x654b('0xa')][_0x654b('0x11')],config[_0x654b('0xa')][_0x654b('0x12')])};db[_0x654b('0x13')]=db['sequelize'][_0x654b('0x14')](_0x654b('0x15'));db[_0x654b('0x16')]=db['sequelize']['import'](_0x654b('0x17'));db[_0x654b('0x18')]=db[_0x654b('0x3')][_0x654b('0x14')](_0x654b('0x19'));db[_0x654b('0x1a')]=db['sequelize'][_0x654b('0x14')](_0x654b('0x1b'));db[_0x654b('0x1c')]=db['sequelize'][_0x654b('0x14')]('../api/voiceMusicOnHold/voiceMusicOnHold.model');db['VoiceQueue']=db[_0x654b('0x3')][_0x654b('0x14')](_0x654b('0x1d'));db[_0x654b('0x1e')]=db[_0x654b('0x3')][_0x654b('0x14')](_0x654b('0x1f'));db[_0x654b('0x20')]=db['sequelize']['import'](_0x654b('0x21'));db['VoiceMail']=db[_0x654b('0x3')]['import'](_0x654b('0x22'));db[_0x654b('0x23')]=db[_0x654b('0x3')]['import']('../api/voiceMailMessage/voiceMailMessage.model');db['VoiceCallReport']=db[_0x654b('0x3')][_0x654b('0x14')]('../api/voiceCallReport/voiceCallReport.model');db[_0x654b('0x24')]=db[_0x654b('0x3')][_0x654b('0x14')](_0x654b('0x25'));db['VoiceAgentReport']=db[_0x654b('0x3')][_0x654b('0x14')](_0x654b('0x26'));db[_0x654b('0x27')]=db[_0x654b('0x3')][_0x654b('0x14')](_0x654b('0x28'));db[_0x654b('0x29')]=db[_0x654b('0x3')][_0x654b('0x14')]('../api/memberReport/memberReport.model');db[_0x654b('0x2a')]=db['sequelize'][_0x654b('0x14')](_0x654b('0x2b'));db['VoiceTransferReport']=db[_0x654b('0x3')][_0x654b('0x14')]('../api/voiceTransferReport/voiceTransferReport.model');db[_0x654b('0x2c')]=db[_0x654b('0x3')]['import'](_0x654b('0x2d'));db[_0x654b('0x2e')]=db[_0x654b('0x3')][_0x654b('0x14')](_0x654b('0x2f'));db[_0x654b('0x30')]=db[_0x654b('0x3')][_0x654b('0x14')](_0x654b('0x31'));db[_0x654b('0x32')]=db[_0x654b('0x3')][_0x654b('0x14')]('../api/userMailQueue/userMailQueue.model');db[_0x654b('0x33')]=db[_0x654b('0x3')][_0x654b('0x14')](_0x654b('0x34'));db[_0x654b('0x35')]=db[_0x654b('0x3')][_0x654b('0x14')](_0x654b('0x36'));db['UserOpenchannelQueue']=db[_0x654b('0x3')]['import'](_0x654b('0x37'));db[_0x654b('0x38')]=db[_0x654b('0x3')][_0x654b('0x14')](_0x654b('0x39'));db['MailServerOut']=db[_0x654b('0x3')][_0x654b('0x14')]('../api/mailServerOut/mailServerOut.model');db[_0x654b('0x3a')]=db[_0x654b('0x3')][_0x654b('0x14')](_0x654b('0x3b'));db[_0x654b('0x3c')]=db[_0x654b('0x3')][_0x654b('0x14')](_0x654b('0x3d'));db[_0x654b('0x3e')]=db[_0x654b('0x3')][_0x654b('0x14')](_0x654b('0x3f'));db[_0x654b('0x40')]=db[_0x654b('0x3')][_0x654b('0x14')](_0x654b('0x41'));db[_0x654b('0x42')]=db[_0x654b('0x3')][_0x654b('0x14')](_0x654b('0x43'));db[_0x654b('0x44')]=db[_0x654b('0x3')]['import'](_0x654b('0x45'));db['MailQueueReport']=db[_0x654b('0x3')][_0x654b('0x14')](_0x654b('0x46'));db[_0x654b('0x47')]=db[_0x654b('0x3')][_0x654b('0x14')](_0x654b('0x48'));db[_0x654b('0x49')]=db['sequelize'][_0x654b('0x14')](_0x654b('0x4a'));db['FaxAccount']=db[_0x654b('0x3')][_0x654b('0x14')](_0x654b('0x4b'));db['FaxApplication']=db[_0x654b('0x3')][_0x654b('0x14')](_0x654b('0x4c'));db[_0x654b('0x4d')]=db['sequelize'][_0x654b('0x14')](_0x654b('0x4e'));db[_0x654b('0x4f')]=db[_0x654b('0x3')]['import'](_0x654b('0x50'));db[_0x654b('0x51')]=db[_0x654b('0x3')][_0x654b('0x14')](_0x654b('0x52'));db['FaxQueueReport']=db['sequelize'][_0x654b('0x14')]('../api/faxQueueReport/faxQueueReport.model');db[_0x654b('0x53')]=db[_0x654b('0x3')]['import'](_0x654b('0x54'));db['SmsApplication']=db[_0x654b('0x3')][_0x654b('0x14')]('../api/smsApplication/smsApplication.model');db[_0x654b('0x55')]=db[_0x654b('0x3')]['import']('../api/smsInteraction/smsInteraction.model');db[_0x654b('0x56')]=db[_0x654b('0x3')][_0x654b('0x14')](_0x654b('0x57'));db[_0x654b('0x58')]=db[_0x654b('0x3')][_0x654b('0x14')](_0x654b('0x59'));db[_0x654b('0x5a')]=db[_0x654b('0x3')][_0x654b('0x14')](_0x654b('0x5b'));db[_0x654b('0x5c')]=db['sequelize']['import']('../api/openchannelApplication/openchannelApplication.model');db[_0x654b('0x5d')]=db['sequelize']['import'](_0x654b('0x5e'));db[_0x654b('0x5f')]=db['sequelize'][_0x654b('0x14')](_0x654b('0x60'));db['OpenchannelQueue']=db[_0x654b('0x3')]['import'](_0x654b('0x61'));db[_0x654b('0x62')]=db[_0x654b('0x3')][_0x654b('0x14')](_0x654b('0x63'));db[_0x654b('0x64')]=db[_0x654b('0x3')]['import'](_0x654b('0x65'));db[_0x654b('0x66')]=db[_0x654b('0x3')][_0x654b('0x14')]('../api/chatApplication/chatApplication.model');db[_0x654b('0x67')]=db['sequelize'][_0x654b('0x14')](_0x654b('0x68'));db[_0x654b('0x69')]=db['sequelize'][_0x654b('0x14')](_0x654b('0x6a'));db[_0x654b('0x6b')]=db[_0x654b('0x3')][_0x654b('0x14')](_0x654b('0x6c'));db[_0x654b('0x6d')]=db[_0x654b('0x3')][_0x654b('0x14')](_0x654b('0x6e'));db[_0x654b('0x6f')]=db[_0x654b('0x3')][_0x654b('0x14')](_0x654b('0x70'));db[_0x654b('0x71')]=db[_0x654b('0x3')][_0x654b('0x14')](_0x654b('0x72'));db[_0x654b('0x73')]=db[_0x654b('0x3')]['import'](_0x654b('0x74'));db[_0x654b('0x75')]=db['sequelize'][_0x654b('0x14')](_0x654b('0x76'));db[_0x654b('0x77')]=db['sequelize']['import'](_0x654b('0x78'));db['CmHopperBlack']=db[_0x654b('0x3')][_0x654b('0x14')](_0x654b('0x79'));db[_0x654b('0x7a')]=db[_0x654b('0x3')][_0x654b('0x14')](_0x654b('0x7b'));db[_0x654b('0x7c')]=db['sequelize']['import'](_0x654b('0x7d'));db['ReportAgentPreview']=db[_0x654b('0x3')]['import'](_0x654b('0x7e'));db[_0x654b('0x7f')]=db[_0x654b('0x3')]['import'](_0x654b('0x80'));db[_0x654b('0x81')]=db[_0x654b('0x3')]['import'](_0x654b('0x82'));db[_0x654b('0x83')]=db['sequelize']['import'](_0x654b('0x84'));db['CannedAnswer']=db[_0x654b('0x3')][_0x654b('0x14')](_0x654b('0x85'));db[_0x654b('0x86')]=db['sequelize'][_0x654b('0x14')](_0x654b('0x87'));db[_0x654b('0x88')]=db[_0x654b('0x3')][_0x654b('0x14')](_0x654b('0x89'));db[_0x654b('0x8a')]=db[_0x654b('0x3')][_0x654b('0x14')](_0x654b('0x8b'));db[_0x654b('0x8c')]=db[_0x654b('0x3')][_0x654b('0x14')]('../api/pause/pause.model');db[_0x654b('0x8d')]=db[_0x654b('0x3')][_0x654b('0x14')](_0x654b('0x8e'));db[_0x654b('0x8f')]=db[_0x654b('0x3')][_0x654b('0x14')](_0x654b('0x90'));db['Schedule']=db['sequelize'][_0x654b('0x14')]('../api/schedule/schedule.model');db['Sound']=db[_0x654b('0x3')][_0x654b('0x14')](_0x654b('0x91'));db[_0x654b('0x92')]=db[_0x654b('0x3')][_0x654b('0x14')](_0x654b('0x93'));db[_0x654b('0x94')]=db[_0x654b('0x3')][_0x654b('0x14')](_0x654b('0x95'));db[_0x654b('0x96')]=db[_0x654b('0x3')][_0x654b('0x14')]('../api/trigger/trigger.model');db[_0x654b('0x97')]=db[_0x654b('0x3')][_0x654b('0x14')](_0x654b('0x98'));db['Integration']=db[_0x654b('0x3')][_0x654b('0x14')](_0x654b('0x99'));db[_0x654b('0x9a')]=db['sequelize'][_0x654b('0x14')](_0x654b('0x9b'));db[_0x654b('0x9c')]=db[_0x654b('0x3')][_0x654b('0x14')](_0x654b('0x9d'));db[_0x654b('0x9e')]=db['sequelize'][_0x654b('0x14')](_0x654b('0x9f'));db[_0x654b('0xa0')]=db[_0x654b('0x3')]['import'](_0x654b('0xa1'));db['AnalyticMetric']=db[_0x654b('0x3')][_0x654b('0x14')](_0x654b('0xa2'));db[_0x654b('0xa3')]=db[_0x654b('0x3')]['import'](_0x654b('0xa4'));db['AnalyticTreeReport']=db['sequelize'][_0x654b('0x14')](_0x654b('0xa5'));db[_0x654b('0xa6')]=db[_0x654b('0x3')]['import'](_0x654b('0xa7'));db['SalesforceConfiguration']=db[_0x654b('0x3')][_0x654b('0x14')](_0x654b('0xa8'));db[_0x654b('0xa9')]=db[_0x654b('0x3')][_0x654b('0x14')](_0x654b('0xaa'));db[_0x654b('0xab')]=db['sequelize'][_0x654b('0x14')]('../api/intSugarcrmAccount/intSugarcrmAccount.model');db['SugarcrmConfiguration']=db[_0x654b('0x3')]['import'](_0x654b('0xac'));db[_0x654b('0xad')]=db[_0x654b('0x3')][_0x654b('0x14')](_0x654b('0xae'));db[_0x654b('0xaf')]=db['sequelize'][_0x654b('0x14')](_0x654b('0xb0'));db['DeskConfiguration']=db[_0x654b('0x3')][_0x654b('0x14')](_0x654b('0xb1'));db[_0x654b('0xb2')]=db[_0x654b('0x3')][_0x654b('0x14')]('../api/intDeskField/intDeskField.model');db[_0x654b('0xb3')]=db[_0x654b('0x3')][_0x654b('0x14')](_0x654b('0xb4'));db[_0x654b('0xb5')]=db[_0x654b('0x3')]['import'](_0x654b('0xb6'));db[_0x654b('0xb7')]=db[_0x654b('0x3')][_0x654b('0x14')](_0x654b('0xb8'));db[_0x654b('0xb9')]=db[_0x654b('0x3')][_0x654b('0x14')](_0x654b('0xba'));db[_0x654b('0xbb')]=db[_0x654b('0x3')][_0x654b('0x14')](_0x654b('0xbc'));db[_0x654b('0xbd')]=db['sequelize']['import'](_0x654b('0xbe'));db['FreshdeskAccount']=db['sequelize'][_0x654b('0x14')]('../api/intFreshdeskAccount/intFreshdeskAccount.model');db[_0x654b('0xbf')]=db[_0x654b('0x3')][_0x654b('0x14')]('../api/intFreshdeskConfiguration/intFreshdeskConfiguration.model');db['FreshdeskField']=db[_0x654b('0x3')][_0x654b('0x14')](_0x654b('0xc0'));db[_0x654b('0xc1')]=db[_0x654b('0x3')]['import'](_0x654b('0xc2'));db[_0x654b('0xc3')]=db[_0x654b('0x3')][_0x654b('0x14')](_0x654b('0xc4'));db[_0x654b('0xc5')]=db[_0x654b('0x3')]['import'](_0x654b('0xc6'));db[_0x654b('0xc7')]=db[_0x654b('0x3')]['import'](_0x654b('0xc8'));db[_0x654b('0xc9')]=db[_0x654b('0x3')][_0x654b('0x14')]('../api/intServicenowConfiguration/intServicenowConfiguration.model');db['ServicenowField']=db[_0x654b('0x3')][_0x654b('0x14')](_0x654b('0xca'));db[_0x654b('0xcb')]=db[_0x654b('0x3')][_0x654b('0x14')](_0x654b('0xcc'));db[_0x654b('0xcd')]=db[_0x654b('0x3')][_0x654b('0x14')](_0x654b('0xce'));db[_0x654b('0xcf')]=db['sequelize']['import'](_0x654b('0xd0'));db['FreshsalesAccount']=db[_0x654b('0x3')][_0x654b('0x14')]('../api/intFreshsalesAccount/intFreshsalesAccount.model');db[_0x654b('0xd1')]=db[_0x654b('0x3')][_0x654b('0x14')]('../api/intFreshsalesConfiguration/intFreshsalesConfiguration.model');db[_0x654b('0xd2')]=db['sequelize'][_0x654b('0x14')](_0x654b('0xd3'));db[_0x654b('0xd4')]=db['sequelize'][_0x654b('0x14')](_0x654b('0x99'));db[_0x654b('0xd5')]=db[_0x654b('0x3')][_0x654b('0x14')]('../api/network/network.model');db[_0x654b('0xd6')]=db[_0x654b('0x3')]['import'](_0x654b('0xd7'));db[_0x654b('0xd8')]=db[_0x654b('0x3')][_0x654b('0x14')]('../api/chatInternalMessage/chatInternalMessage.model');db['JscriptyAnswerReport']=db['sequelize'][_0x654b('0x14')]('../api/jscriptyAnswerReport/jscriptyAnswerReport.model');db[_0x654b('0xd9')]=db[_0x654b('0x3')][_0x654b('0x14')](_0x654b('0xda'));db['JscriptySessionReport']=db[_0x654b('0x3')][_0x654b('0x14')](_0x654b('0xdb'));db[_0x654b('0xdc')]=db['sequelize'][_0x654b('0x14')](_0x654b('0xdd'));db[_0x654b('0xde')]=db[_0x654b('0x3')]['import'](_0x654b('0xdf'));db[_0x654b('0xe0')]=db['sequelize']['import'](_0x654b('0xe1'));db[_0x654b('0xe2')]=db[_0x654b('0x3')][_0x654b('0x14')]('../api/jscriptyProject/jscriptyProject.model');db[_0x654b('0xe3')]=db[_0x654b('0x3')][_0x654b('0x14')](_0x654b('0xe4'));db['SquareOdbc']=db[_0x654b('0x3')][_0x654b('0x14')](_0x654b('0xe5'));db['SquareProject']=db[_0x654b('0x3')]['import'](_0x654b('0xe6'));db[_0x654b('0xe7')]=db[_0x654b('0x3')][_0x654b('0x14')](_0x654b('0xe8'));db['SquareMessage']=db[_0x654b('0x3')][_0x654b('0x14')]('../api/squareMessage/squareMessage.model');db[_0x654b('0xe9')]=db[_0x654b('0x3')][_0x654b('0x14')](_0x654b('0xea'));db['License']=db[_0x654b('0x3')][_0x654b('0x14')](_0x654b('0xeb'));db[_0x654b('0xec')]=db[_0x654b('0x3')][_0x654b('0x14')](_0x654b('0xed'));db[_0x654b('0xee')]=db[_0x654b('0x3')][_0x654b('0x14')](_0x654b('0xef'));db[_0x654b('0xf0')]=db[_0x654b('0x3')]['import'](_0x654b('0xf1'));db[_0x654b('0xf2')]=db['sequelize']['import'](_0x654b('0xf3'));db['MailTransferReport']=db['sequelize'][_0x654b('0x14')](_0x654b('0xf4'));db[_0x654b('0xf5')]=db[_0x654b('0x3')][_0x654b('0x14')](_0x654b('0xf6'));db[_0x654b('0xf7')]=db[_0x654b('0x3')]['import']('../api/faxTransferReport/faxTransferReport.model');db[_0x654b('0xf8')]=db[_0x654b('0x3')][_0x654b('0x14')](_0x654b('0xf9'));db[_0x654b('0xfa')]=db[_0x654b('0x3')][_0x654b('0x14')](_0x654b('0xfb'));db[_0x654b('0xfc')]=db[_0x654b('0x3')][_0x654b('0x14')]('../api/cmList/cmList.model');db[_0x654b('0xfd')]=db['sequelize'][_0x654b('0x14')](_0x654b('0xfe'));db[_0x654b('0xff')]=db[_0x654b('0x3')]['import'](_0x654b('0x100'));db[_0x654b('0x101')]=db[_0x654b('0x3')][_0x654b('0x14')]('../api/userProfileSection/userProfileSection.model');db[_0x654b('0x102')]=db[_0x654b('0x3')]['import'](_0x654b('0x103'));db[_0x654b('0x13')]['hasOne'](db[_0x654b('0x104')],{'as':_0x654b('0x104'),'onDelete':_0x654b('0x105'),'foreignKey':'UserId'});db['User'][_0x654b('0x106')](db[_0x654b('0x1e')],{'as':'Recordings','foreignKey':'UserId'});db[_0x654b('0x13')][_0x654b('0x106')](db[_0x654b('0x2c')],{'as':_0x654b('0x107'),'foreignKey':_0x654b('0x108')});db['User'][_0x654b('0x106')](db['VoiceExtension'],{'as':_0x654b('0x109'),'onDelete':_0x654b('0x105'),'hooks':!![]});db[_0x654b('0x13')][_0x654b('0x106')](db['CmHopperFinal'],{'as':'HopperFinals','foreignKey':_0x654b('0x108')});db[_0x654b('0x13')][_0x654b('0x106')](db[_0x654b('0x7c')],{'as':_0x654b('0x10a'),'foreignKey':'UserId'});db[_0x654b('0x13')]['hasMany'](db[_0x654b('0x10b')],{'as':_0x654b('0x10b'),'foreignKey':'UserId'});db[_0x654b('0x13')][_0x654b('0x106')](db[_0x654b('0x5d')],{'as':_0x654b('0x10c'),'foreignKey':'UserId'});db[_0x654b('0x13')][_0x654b('0x106')](db['ChatInteraction'],{'as':_0x654b('0x10d'),'foreignKey':_0x654b('0x108')});db[_0x654b('0x13')][_0x654b('0x106')](db['SmsInteraction'],{'as':'SmsInteractions','foreignKey':_0x654b('0x108')});db[_0x654b('0x13')][_0x654b('0x106')](db[_0x654b('0x4d')],{'as':_0x654b('0x10e'),'foreignKey':_0x654b('0x108')});db[_0x654b('0x13')]['hasMany'](db[_0x654b('0x40')],{'as':_0x654b('0x10f'),'foreignKey':_0x654b('0x108')});db[_0x654b('0x13')]['belongsTo'](db[_0x654b('0xff')],{'as':_0x654b('0xff'),'foreignKey':_0x654b('0x110')});db['User']['belongsToMany'](db[_0x654b('0x6f')],{'as':_0x654b('0x111'),'through':'chat_group_has_users'});db['User'][_0x654b('0x112')](db[_0x654b('0x75')],{'as':_0x654b('0x113'),'through':'cm_user_has_contacts'});db[_0x654b('0x13')][_0x654b('0x112')](db[_0x654b('0xfc')],{'as':_0x654b('0x114'),'through':'cm_user_has_lists'});db[_0x654b('0x13')][_0x654b('0x112')](db[_0x654b('0xe9')],{'through':'user_has_teams'});db[_0x654b('0x13')]['belongsToMany'](db['MailInteraction'],{'as':_0x654b('0x10f'),'through':_0x654b('0x115')});db['User'][_0x654b('0x112')](db[_0x654b('0x67')],{'as':'ChatInteractions','through':_0x654b('0x116')});db[_0x654b('0x13')][_0x654b('0x112')](db[_0x654b('0x4d')],{'as':_0x654b('0x10e'),'through':'user_has_fax_interactions'});db[_0x654b('0x13')][_0x654b('0x112')](db[_0x654b('0x55')],{'as':_0x654b('0x117'),'through':'user_has_sms_interactions'});db[_0x654b('0x13')][_0x654b('0x112')](db['OpenchannelInteraction'],{'as':_0x654b('0x10c'),'through':'user_has_openchannel_interactions'});db['User']['belongsToMany'](db['VoiceQueue'],{'as':_0x654b('0x118'),'through':_0x654b('0x2e'),'required':![]});db[_0x654b('0x13')][_0x654b('0x112')](db['MailQueue'],{'as':'MailQueues','through':'UserMailQueue','required':![]});db[_0x654b('0x13')]['belongsToMany'](db[_0x654b('0x6d')],{'as':_0x654b('0x119'),'through':'UserChatQueue','required':![],'hooks':!![]});db[_0x654b('0x13')][_0x654b('0x112')](db[_0x654b('0x51')],{'as':'FaxQueues','through':_0x654b('0x33'),'required':![]});db['User'][_0x654b('0x112')](db['SmsQueue'],{'as':'SmsQueues','through':_0x654b('0x35'),'required':![]});db[_0x654b('0x13')][_0x654b('0x112')](db[_0x654b('0x11a')],{'as':_0x654b('0x11b'),'through':'UserOpenchannelQueue','required':![]});db[_0x654b('0x13')][_0x654b('0x112')](db[_0x654b('0xfc')],{'through':'cm_user_has_lists'});db[_0x654b('0x13')][_0x654b('0x112')](db[_0x654b('0xfd')],{'as':'VoicePrefixes','through':_0x654b('0x11c'),'required':![]});db[_0x654b('0x13')][_0x654b('0x112')](db[_0x654b('0x62')],{'as':_0x654b('0x11d'),'through':'user_has_chat_websites'});db[_0x654b('0x13')][_0x654b('0x112')](db[_0x654b('0x11e')],{'as':_0x654b('0x11f'),'through':_0x654b('0x120')});db[_0x654b('0x13')]['belongsToMany'](db[_0x654b('0x3a')],{'as':_0x654b('0x121'),'through':_0x654b('0x122')});db['User'][_0x654b('0x112')](db[_0x654b('0x5a')],{'as':_0x654b('0x123'),'through':_0x654b('0x124')});db['User']['belongsToMany'](db[_0x654b('0x53')],{'as':'SmsAccounts','through':_0x654b('0x125')});db[_0x654b('0x13')]['belongsToMany'](db[_0x654b('0x126')],{'as':_0x654b('0x127'),'through':_0x654b('0x128')});db[_0x654b('0x16')][_0x654b('0x106')](db['VoiceExtension'],{'as':_0x654b('0x129'),'onDelete':_0x654b('0x105'),'foreignKey':_0x654b('0x12a')});db[_0x654b('0x18')][_0x654b('0x106')](db['VoiceExtension'],{'onDelete':_0x654b('0x105')});db['VoiceExtension'][_0x654b('0x106')](db['VoiceExtension'],{'as':_0x654b('0x12b'),'onDelete':'cascade'});db[_0x654b('0x1c')][_0x654b('0x112')](db[_0x654b('0x12c')],{'as':'Sounds','through':_0x654b('0x12d')});db[_0x654b('0x12e')]['hasMany'](db[_0x654b('0x2c')],{'as':_0x654b('0x12f'),'foreignKey':_0x654b('0x130')});db[_0x654b('0x12e')][_0x654b('0x106')](db[_0x654b('0x77')],{'as':'Hoppers','foreignKey':_0x654b('0x130')});db[_0x654b('0x12e')]['hasMany'](db[_0x654b('0x7a')],{'as':_0x654b('0x131'),'foreignKey':_0x654b('0x130')});db['VoiceQueue']['hasMany'](db[_0x654b('0x7c')],{'as':'HopperHistories','foreignKey':_0x654b('0x130')});db[_0x654b('0x12e')][_0x654b('0x106')](db[_0x654b('0x10b')],{'as':_0x654b('0x10b'),'foreignKey':_0x654b('0x130')});db['VoiceQueue'][_0x654b('0x106')](db[_0x654b('0x132')],{'as':_0x654b('0x133'),'foreignKey':_0x654b('0x130')});db[_0x654b('0x12e')][_0x654b('0x106')](db[_0x654b('0x134')],{'as':_0x654b('0x135'),'foreignKey':_0x654b('0x130')});db[_0x654b('0x12e')][_0x654b('0x136')](db['Trunk'],{'as':_0x654b('0x2a'),'foreignKey':_0x654b('0x137')});db[_0x654b('0x12e')][_0x654b('0x136')](db[_0x654b('0x2a')],{'as':'TrunkBackup','foreignKey':_0x654b('0x138')});db[_0x654b('0x12e')][_0x654b('0x136')](db[_0x654b('0x8a')],{'as':'Interval','foreignKey':_0x654b('0x139')});db[_0x654b('0x12e')][_0x654b('0x136')](db[_0x654b('0x8c')],{'as':_0x654b('0x13a'),'foreignKey':'mandatoryDispositionPauseId'});db['VoiceQueue'][_0x654b('0x112')](db[_0x654b('0xfc')],{'as':'Lists','through':_0x654b('0x13b')});db[_0x654b('0x12e')][_0x654b('0x112')](db[_0x654b('0x13')],{'as':_0x654b('0x13c'),'through':_0x654b('0x2e')});db[_0x654b('0x12e')][_0x654b('0x112')](db[_0x654b('0xe9')],{'as':_0x654b('0x13d'),'through':_0x654b('0x13e')});db[_0x654b('0x12e')][_0x654b('0x112')](db[_0x654b('0xfc')],{'as':_0x654b('0x13f'),'through':_0x654b('0x140')});db['VoiceRecording'][_0x654b('0x136')](db[_0x654b('0x13')],{'as':_0x654b('0x13'),'foreignKey':_0x654b('0x108')});db[_0x654b('0x20')]['belongsTo'](db[_0x654b('0x13')],{'as':_0x654b('0x13'),'foreignKey':_0x654b('0x108')});db[_0x654b('0x104')][_0x654b('0x106')](db[_0x654b('0x23')],{'as':'Messages','onDelete':_0x654b('0x105'),'foreignKey':_0x654b('0x141'),'sourceKey':'mailbox'});db[_0x654b('0x23')][_0x654b('0x136')](db[_0x654b('0x104')],{'foreignKey':_0x654b('0x141'),'targetKey':'mailbox'});db[_0x654b('0x142')]['hasMany'](db['VoiceQueueReport'],{'as':_0x654b('0x143'),'foreignKey':_0x654b('0x144'),'constraints':![]});db[_0x654b('0x142')][_0x654b('0x106')](db[_0x654b('0x145')],{'as':_0x654b('0x146'),'foreignKey':_0x654b('0x144'),'constraints':![]});db[_0x654b('0x142')][_0x654b('0x136')](db[_0x654b('0x13')],{'as':_0x654b('0x13'),'foreignKey':_0x654b('0x108')});db[_0x654b('0x142')][_0x654b('0x136')](db['CmContact'],{'as':_0x654b('0x147'),'foreignKey':_0x654b('0x148')});db[_0x654b('0x38')][_0x654b('0x136')](db[_0x654b('0x3a')],{'as':_0x654b('0x3a'),'foreignKey':_0x654b('0x149')});db[_0x654b('0x14a')]['belongsTo'](db[_0x654b('0x3a')],{'as':'MailAccount','foreignKey':_0x654b('0x149')});db['MailAccount']['hasOne'](db[_0x654b('0x38')],{'as':_0x654b('0x14b'),'onDelete':_0x654b('0x105')});db['MailAccount'][_0x654b('0x14c')](db[_0x654b('0x14a')],{'as':_0x654b('0x14d'),'onDelete':'cascade'});db[_0x654b('0x3a')][_0x654b('0x106')](db[_0x654b('0x86')],{'as':_0x654b('0x14e'),'foreignKey':'MailAccountId'});db[_0x654b('0x3a')][_0x654b('0x106')](db[_0x654b('0x14f')],{'as':_0x654b('0x150'),'foreignKey':_0x654b('0x149')});db[_0x654b('0x3a')][_0x654b('0x106')](db['MailMessage'],{'as':'Messages','foreignKey':_0x654b('0x149')});db[_0x654b('0x3a')][_0x654b('0x106')](db[_0x654b('0x40')],{'as':_0x654b('0x151')});db[_0x654b('0x3a')]['hasMany'](db['MailApplication'],{'as':_0x654b('0x12b')});db[_0x654b('0x3a')]['belongsTo'](db[_0x654b('0xfc')],{'as':_0x654b('0x152'),'foreignKey':_0x654b('0x153')});db[_0x654b('0x3a')][_0x654b('0x136')](db[_0x654b('0x94')],{'as':_0x654b('0x94'),'foreignKey':'TemplateId'});db[_0x654b('0x3a')][_0x654b('0x136')](db[_0x654b('0x8c')],{'as':_0x654b('0x13a'),'foreignKey':_0x654b('0x154')});db[_0x654b('0x3a')]['belongsToMany'](db['User'],{'as':_0x654b('0x13c'),'through':_0x654b('0x122')});db[_0x654b('0x3c')]['belongsToMany'](db[_0x654b('0x13')],{'as':_0x654b('0x13c'),'through':_0x654b('0x32')});db[_0x654b('0x3c')][_0x654b('0x112')](db[_0x654b('0xe9')],{'through':_0x654b('0x155'),'as':_0x654b('0x13d')});db[_0x654b('0x40')][_0x654b('0x106')](db[_0x654b('0x42')],{'as':'Messages','onDelete':_0x654b('0x105'),'foreignKey':_0x654b('0x156')});db[_0x654b('0x40')][_0x654b('0x136')](db[_0x654b('0x3a')],{'as':'Account','foreignKey':_0x654b('0x149')});db[_0x654b('0x40')][_0x654b('0x136')](db[_0x654b('0x75')],{'as':'Contact','foreignKey':_0x654b('0x148')});db[_0x654b('0x40')][_0x654b('0x136')](db['User'],{'as':_0x654b('0x157'),'foreignKey':_0x654b('0x108')});db[_0x654b('0x40')][_0x654b('0x112')](db[_0x654b('0x92')],{'through':_0x654b('0x158'),'as':_0x654b('0x159')});db[_0x654b('0x40')]['belongsToMany'](db[_0x654b('0x92')],{'through':_0x654b('0x158'),'as':_0x654b('0x15a')});db['MailInteraction'][_0x654b('0x112')](db[_0x654b('0x13')],{'as':_0x654b('0x15b'),'through':_0x654b('0x115'),'foreignKey':_0x654b('0x156')});db[_0x654b('0x42')][_0x654b('0x106')](db[_0x654b('0xf0')],{'as':_0x654b('0x15c'),'onDelete':'cascade'});db['MailMessage']['belongsTo'](db['User'],{'as':'User'});db[_0x654b('0x42')][_0x654b('0x136')](db[_0x654b('0x75')],{'onDelete':_0x654b('0x105'),'as':'Contact'});db[_0x654b('0x42')][_0x654b('0x136')](db[_0x654b('0x40')],{'as':_0x654b('0x15d'),'foreignKey':'MailInteractionId'});db['MailMessage']['belongsTo'](db['MailAccount'],{'as':_0x654b('0x15e'),'foreignKey':_0x654b('0x149')});db['MailApplication'][_0x654b('0x136')](db[_0x654b('0x13')],{'onDelete':_0x654b('0x15f')});db['MailApplication'][_0x654b('0x136')](db[_0x654b('0x3c')],{'onDelete':_0x654b('0x15f')});db[_0x654b('0x44')]['belongsTo'](db[_0x654b('0x3a')],{'onDelete':_0x654b('0x15f')});db[_0x654b('0x44')]['belongsTo'](db['Interval'],{'onDelete':_0x654b('0x15f'),'foreignKey':'IntervalId'});db[_0x654b('0x44')][_0x654b('0x136')](db[_0x654b('0x92')],{'onDelete':_0x654b('0x15f'),'foreignKey':'TagId'});db[_0x654b('0x160')][_0x654b('0x136')](db[_0x654b('0x3a')],{});db['MailQueueReport'][_0x654b('0x136')](db[_0x654b('0xfc')],{'as':_0x654b('0x152'),'foreignKey':_0x654b('0x153')});db['MailQueueReport'][_0x654b('0x136')](db[_0x654b('0x75')],{'as':_0x654b('0x147'),'foreignKey':_0x654b('0x148')});db[_0x654b('0x160')][_0x654b('0x136')](db['MailInteraction'],{});db['MailQueueReport'][_0x654b('0x136')](db['MailMessage'],{});db[_0x654b('0x160')][_0x654b('0x136')](db['User'],{});db[_0x654b('0x160')]['belongsTo'](db[_0x654b('0x3c')],{});db[_0x654b('0x47')][_0x654b('0x106')](db[_0x654b('0x49')],{'as':_0x654b('0x161'),'onDelete':_0x654b('0x105')});db[_0x654b('0x11e')][_0x654b('0x106')](db[_0x654b('0x86')],{'as':_0x654b('0x14e'),'foreignKey':_0x654b('0x162')});db[_0x654b('0x11e')][_0x654b('0x106')](db[_0x654b('0x14f')],{'as':_0x654b('0x150'),'foreignKey':_0x654b('0x162')});db['FaxAccount'][_0x654b('0x106')](db[_0x654b('0x4d')],{'as':_0x654b('0x151')});db[_0x654b('0x11e')][_0x654b('0x106')](db[_0x654b('0x163')],{'as':_0x654b('0x12b')});db['FaxAccount'][_0x654b('0x106')](db[_0x654b('0x1a')],{'as':'Exntensions','onDelete':'cascade'});db[_0x654b('0x11e')]['hasMany'](db[_0x654b('0x4f')],{'as':_0x654b('0x164')});db[_0x654b('0x11e')][_0x654b('0x136')](db[_0x654b('0x2a')],{'as':'Trunk'});db[_0x654b('0x11e')][_0x654b('0x136')](db[_0x654b('0xfc')],{'as':_0x654b('0x152'),'foreignKey':'ListId'});db[_0x654b('0x11e')][_0x654b('0x136')](db[_0x654b('0x8c')],{'as':'mandatoryDispositionPause','foreignKey':_0x654b('0x154')});db[_0x654b('0x11e')][_0x654b('0x112')](db[_0x654b('0x13')],{'as':_0x654b('0x13c'),'through':_0x654b('0x120')});db['FaxApplication'][_0x654b('0x136')](db[_0x654b('0x13')],{'onDelete':_0x654b('0x15f')});db[_0x654b('0x163')][_0x654b('0x136')](db[_0x654b('0x51')],{'onDelete':'restrict'});db[_0x654b('0x163')][_0x654b('0x136')](db[_0x654b('0x11e')],{'onDelete':_0x654b('0x15f')});db[_0x654b('0x163')]['belongsTo'](db[_0x654b('0x92')],{'onDelete':'restrict','foreignKey':_0x654b('0x165')});db['FaxInteraction']['hasMany'](db[_0x654b('0x4f')],{'as':'Messages','onDelete':_0x654b('0x105'),'foreignKey':_0x654b('0x166')});db[_0x654b('0x4d')][_0x654b('0x136')](db[_0x654b('0x11e')],{'as':_0x654b('0x15e'),'foreignKey':_0x654b('0x162')});db[_0x654b('0x4d')]['belongsTo'](db['CmContact'],{'as':'Contact','foreignKey':'ContactId'});db[_0x654b('0x4d')][_0x654b('0x136')](db[_0x654b('0x13')],{'as':'Owner','foreignKey':_0x654b('0x108')});db[_0x654b('0x4d')][_0x654b('0x112')](db[_0x654b('0x92')],{'through':_0x654b('0x167'),'as':_0x654b('0x159')});db[_0x654b('0x4d')]['belongsToMany'](db[_0x654b('0x92')],{'through':_0x654b('0x167'),'as':_0x654b('0x15a')});db['FaxInteraction'][_0x654b('0x112')](db[_0x654b('0x13')],{'as':_0x654b('0x15b'),'through':'user_has_fax_interactions','foreignKey':'FaxInteractionId'});db[_0x654b('0x4f')][_0x654b('0x136')](db['User'],{'onDelete':_0x654b('0x105'),'as':_0x654b('0x13')});db[_0x654b('0x4f')]['belongsTo'](db[_0x654b('0x4d')],{'as':_0x654b('0x15d'),'foreignKey':_0x654b('0x166')});db[_0x654b('0x4f')][_0x654b('0x136')](db[_0x654b('0x75')],{'onDelete':_0x654b('0x105'),'as':'Contact'});db[_0x654b('0x4f')][_0x654b('0x136')](db[_0x654b('0xf0')],{'as':'Attachment','foreignKey':_0x654b('0x168')});db[_0x654b('0x4f')][_0x654b('0x136')](db['FaxAccount'],{'as':'Account','foreignKey':_0x654b('0x162')});db[_0x654b('0x51')]['belongsToMany'](db['User'],{'as':'Agents','through':'UserFaxQueue'});db[_0x654b('0x51')]['belongsToMany'](db[_0x654b('0xe9')],{'through':_0x654b('0x169'),'as':_0x654b('0x13d')});db[_0x654b('0x16a')][_0x654b('0x136')](db['FaxAccount'],{});db[_0x654b('0x16a')]['belongsTo'](db[_0x654b('0xfc')],{'as':'List','foreignKey':'ListId'});db['FaxQueueReport'][_0x654b('0x136')](db['CmContact'],{'as':_0x654b('0x147'),'foreignKey':_0x654b('0x148')});db[_0x654b('0x16a')][_0x654b('0x136')](db['FaxInteraction'],{});db[_0x654b('0x16a')][_0x654b('0x136')](db[_0x654b('0x4f')],{});db['FaxQueueReport'][_0x654b('0x136')](db[_0x654b('0x13')],{});db['FaxQueueReport'][_0x654b('0x136')](db[_0x654b('0x51')],{});db[_0x654b('0x53')]['hasMany'](db[_0x654b('0x86')],{'as':'Dispositions','foreignKey':_0x654b('0x16b')});db[_0x654b('0x53')][_0x654b('0x106')](db['CannedAnswer'],{'as':_0x654b('0x150'),'foreignKey':_0x654b('0x16b')});db[_0x654b('0x53')][_0x654b('0x106')](db['SmsMessage'],{'as':'Messages','foreignKey':'SmsAccountId'});db[_0x654b('0x53')]['hasMany'](db[_0x654b('0x55')],{'as':_0x654b('0x151')});db[_0x654b('0x53')][_0x654b('0x106')](db['SmsApplication'],{'as':_0x654b('0x12b')});db['SmsAccount']['belongsTo'](db['CmList'],{'as':_0x654b('0x152'),'foreignKey':'ListId'});db['SmsAccount'][_0x654b('0x136')](db[_0x654b('0x8c')],{'as':_0x654b('0x13a'),'foreignKey':_0x654b('0x154')});db['SmsAccount'][_0x654b('0x112')](db[_0x654b('0x13')],{'as':_0x654b('0x13c'),'through':_0x654b('0x125')});db[_0x654b('0x16c')]['belongsTo'](db[_0x654b('0x13')],{'onDelete':_0x654b('0x15f')});db[_0x654b('0x16c')][_0x654b('0x136')](db[_0x654b('0x58')],{'onDelete':_0x654b('0x15f')});db[_0x654b('0x16c')]['belongsTo'](db[_0x654b('0x53')],{'onDelete':_0x654b('0x15f')});db[_0x654b('0x16c')][_0x654b('0x136')](db[_0x654b('0x8a')],{'onDelete':_0x654b('0x15f'),'foreignKey':_0x654b('0x139')});db[_0x654b('0x16c')]['belongsTo'](db[_0x654b('0x92')],{'onDelete':_0x654b('0x15f'),'foreignKey':_0x654b('0x165')});db[_0x654b('0x55')][_0x654b('0x106')](db['SmsMessage'],{'as':_0x654b('0x164'),'onDelete':_0x654b('0x105'),'foreignKey':_0x654b('0x16d')});db[_0x654b('0x55')][_0x654b('0x136')](db[_0x654b('0x53')],{'as':'Account','foreignKey':'SmsAccountId'});db[_0x654b('0x55')][_0x654b('0x136')](db['CmContact'],{'as':'Contact','foreignKey':_0x654b('0x148')});db[_0x654b('0x55')][_0x654b('0x136')](db[_0x654b('0x13')],{'as':'Owner','foreignKey':_0x654b('0x108')});db[_0x654b('0x55')]['belongsToMany'](db['Tag'],{'through':_0x654b('0x16e'),'as':_0x654b('0x159')});db[_0x654b('0x55')][_0x654b('0x112')](db[_0x654b('0x92')],{'through':_0x654b('0x16e'),'as':_0x654b('0x15a')});db[_0x654b('0x55')][_0x654b('0x112')](db['User'],{'as':_0x654b('0x15b'),'through':_0x654b('0x16f'),'foreignKey':_0x654b('0x16d')});db[_0x654b('0x56')][_0x654b('0x136')](db['User'],{'as':_0x654b('0x13')});db[_0x654b('0x56')][_0x654b('0x136')](db[_0x654b('0x75')],{'onDelete':_0x654b('0x105'),'as':'Contact'});db[_0x654b('0x56')][_0x654b('0x136')](db[_0x654b('0x55')],{'onDelete':_0x654b('0x105'),'as':_0x654b('0x15d'),'foreignKey':_0x654b('0x16d')});db['SmsMessage'][_0x654b('0x136')](db[_0x654b('0x53')],{'as':_0x654b('0x15e'),'foreignKey':_0x654b('0x16b')});db[_0x654b('0x58')]['belongsToMany'](db[_0x654b('0x13')],{'as':_0x654b('0x13c'),'through':_0x654b('0x35'),'foreignKey':_0x654b('0x170')});db[_0x654b('0x58')][_0x654b('0x112')](db['Team'],{'through':_0x654b('0x171'),'as':_0x654b('0x13d')});db[_0x654b('0x5a')][_0x654b('0x106')](db['Disposition'],{'as':_0x654b('0x14e'),'foreignKey':_0x654b('0x172')});db[_0x654b('0x5a')]['hasMany'](db[_0x654b('0x14f')],{'as':_0x654b('0x150'),'foreignKey':'OpenchannelAccountId'});db['OpenchannelAccount']['hasMany'](db[_0x654b('0x5d')],{'as':_0x654b('0x151'),'foreignKey':_0x654b('0x172')});db[_0x654b('0x5a')][_0x654b('0x106')](db[_0x654b('0x5f')],{'as':_0x654b('0x164'),'foreignKey':_0x654b('0x172')});db['OpenchannelAccount'][_0x654b('0x106')](db[_0x654b('0x5c')],{'as':_0x654b('0x12b'),'foreignKey':'OpenchannelAccountId'});db[_0x654b('0x5a')][_0x654b('0x136')](db[_0x654b('0xfc')],{'as':_0x654b('0x152'),'foreignKey':'ListId'});db[_0x654b('0x5a')][_0x654b('0x136')](db[_0x654b('0x8c')],{'as':_0x654b('0x13a'),'foreignKey':'mandatoryDispositionPauseId'});db[_0x654b('0x5a')][_0x654b('0x112')](db[_0x654b('0x13')],{'as':_0x654b('0x13c'),'through':'user_has_openchannel_accounts'});db[_0x654b('0x5c')][_0x654b('0x136')](db[_0x654b('0x13')],{'onDelete':_0x654b('0x15f')});db['OpenchannelApplication'][_0x654b('0x136')](db[_0x654b('0x11a')],{'onDelete':_0x654b('0x15f'),'foreignKey':'OpenchannelQueueId'});db[_0x654b('0x5c')]['belongsTo'](db[_0x654b('0x5a')],{'onDelete':'restrict','foreignKey':'OpenchannelAccountId'});db['OpenchannelApplication'][_0x654b('0x136')](db['Interval'],{'onDelete':_0x654b('0x15f'),'foreignKey':_0x654b('0x139')});db[_0x654b('0x5c')]['belongsTo'](db[_0x654b('0x92')],{'onDelete':'restrict','foreignKey':_0x654b('0x165')});db[_0x654b('0x5d')][_0x654b('0x106')](db[_0x654b('0x5f')],{'as':'Messages','onDelete':_0x654b('0x105'),'foreignKey':'OpenchannelInteractionId'});db['OpenchannelInteraction'][_0x654b('0x136')](db[_0x654b('0x5a')],{'as':_0x654b('0x15e'),'foreignKey':_0x654b('0x172')});db['OpenchannelInteraction']['belongsTo'](db[_0x654b('0x75')],{'as':'Contact','foreignKey':_0x654b('0x148')});db[_0x654b('0x5d')]['belongsTo'](db[_0x654b('0x13')],{'as':_0x654b('0x157'),'foreignKey':'UserId'});db[_0x654b('0x5d')][_0x654b('0x112')](db[_0x654b('0x92')],{'through':_0x654b('0x173'),'as':_0x654b('0x159')});db[_0x654b('0x5d')]['belongsToMany'](db[_0x654b('0x92')],{'through':_0x654b('0x173'),'as':_0x654b('0x15a')});db['OpenchannelInteraction'][_0x654b('0x112')](db['User'],{'as':'Users','through':_0x654b('0x174'),'foreignKey':_0x654b('0x175')});db['OpenchannelMessage']['belongsTo'](db['User'],{'onDelete':_0x654b('0x105'),'as':'User'});db['OpenchannelMessage']['belongsTo'](db[_0x654b('0x75')],{'onDelete':_0x654b('0x105'),'as':_0x654b('0x147')});db['OpenchannelMessage'][_0x654b('0x136')](db[_0x654b('0x5d')],{'onDelete':_0x654b('0x105'),'as':_0x654b('0x15d'),'foreignKey':_0x654b('0x175')});db[_0x654b('0x5f')][_0x654b('0x136')](db[_0x654b('0xf0')],{'as':'Attachment','foreignKey':_0x654b('0x168')});db['OpenchannelMessage'][_0x654b('0x136')](db[_0x654b('0x5a')],{'as':'Account','foreignKey':_0x654b('0x172')});db['OpenchannelQueue'][_0x654b('0x112')](db[_0x654b('0x13')],{'as':_0x654b('0x13c'),'through':_0x654b('0x176'),'foreignKey':_0x654b('0x177')});db['OpenchannelQueue'][_0x654b('0x112')](db['Team'],{'through':_0x654b('0x178'),'as':_0x654b('0x13d')});db[_0x654b('0x62')]['hasMany'](db['Disposition'],{'as':'Dispositions','foreignKey':_0x654b('0x179')});db['ChatWebsite'][_0x654b('0x106')](db[_0x654b('0x14f')],{'as':_0x654b('0x150'),'foreignKey':_0x654b('0x179')});db['ChatWebsite'][_0x654b('0x106')](db[_0x654b('0x71')],{'as':_0x654b('0x17a')});db['ChatWebsite']['hasMany'](db['ChatInteraction'],{'as':_0x654b('0x151')});db[_0x654b('0x62')][_0x654b('0x106')](db[_0x654b('0x66')],{'as':'Applications'});db[_0x654b('0x62')]['hasMany'](db['ChatMessage'],{'as':_0x654b('0x164')});db[_0x654b('0x62')][_0x654b('0x136')](db['CmList'],{'as':_0x654b('0x152'),'foreignKey':_0x654b('0x153')});db[_0x654b('0x62')][_0x654b('0x136')](db[_0x654b('0x8a')],{'as':'Interval','foreignKey':_0x654b('0x139')});db[_0x654b('0x62')][_0x654b('0x136')](db[_0x654b('0x8c')],{'as':'mandatoryDispositionPause','foreignKey':'mandatoryDispositionPauseId'});db[_0x654b('0x62')][_0x654b('0x112')](db[_0x654b('0x13')],{'as':'Agents','through':'user_has_chat_websites'});db[_0x654b('0x64')][_0x654b('0x136')](db[_0x654b('0x5a')],{});db[_0x654b('0x64')]['belongsTo'](db[_0x654b('0xfc')],{'as':_0x654b('0x152'),'foreignKey':_0x654b('0x153')});db[_0x654b('0x64')][_0x654b('0x136')](db[_0x654b('0x75')],{'as':_0x654b('0x147'),'foreignKey':_0x654b('0x148')});db[_0x654b('0x64')]['belongsTo'](db[_0x654b('0x5d')],{});db[_0x654b('0x64')][_0x654b('0x136')](db[_0x654b('0x5f')],{});db[_0x654b('0x64')][_0x654b('0x136')](db['User'],{});db[_0x654b('0x64')][_0x654b('0x136')](db[_0x654b('0x11a')],{});db[_0x654b('0x66')][_0x654b('0x136')](db[_0x654b('0x13')],{'as':_0x654b('0x17b'),'foreignKey':_0x654b('0x108'),'onDelete':_0x654b('0x15f')});db[_0x654b('0x66')][_0x654b('0x136')](db[_0x654b('0x6d')],{'as':_0x654b('0x17c'),'foreignKey':_0x654b('0x17d'),'onDelete':'restrict'});db[_0x654b('0x66')][_0x654b('0x136')](db[_0x654b('0x62')],{'as':_0x654b('0x17e'),'foreignKey':_0x654b('0x179'),'onDelete':_0x654b('0x15f')});db[_0x654b('0x66')][_0x654b('0x136')](db[_0x654b('0x92')],{'onDelete':_0x654b('0x15f'),'foreignKey':_0x654b('0x165')});db[_0x654b('0x67')]['hasMany'](db['ChatMessage'],{'as':_0x654b('0x164'),'onDelete':'cascade','foreignKey':'ChatInteractionId'});db[_0x654b('0x67')][_0x654b('0x136')](db[_0x654b('0x62')],{'as':_0x654b('0x15e'),'foreignKey':_0x654b('0x179')});db[_0x654b('0x67')][_0x654b('0x136')](db[_0x654b('0x75')],{'as':_0x654b('0x147'),'foreignKey':_0x654b('0x148')});db[_0x654b('0x67')]['belongsTo'](db['User'],{'as':_0x654b('0x157'),'foreignKey':_0x654b('0x108')});db[_0x654b('0x67')][_0x654b('0x112')](db[_0x654b('0x92')],{'through':_0x654b('0x17f'),'as':_0x654b('0x159')});db[_0x654b('0x67')][_0x654b('0x112')](db[_0x654b('0x92')],{'through':'chat_interaction_has_tags','as':_0x654b('0x15a')});db[_0x654b('0x67')][_0x654b('0x112')](db[_0x654b('0x13')],{'as':_0x654b('0x15b'),'through':'user_has_chat_interactions','foreignKey':_0x654b('0x180')});db[_0x654b('0x69')]['belongsTo'](db[_0x654b('0x13')],{'onDelete':_0x654b('0x105'),'as':_0x654b('0x13')});db['ChatMessage'][_0x654b('0x136')](db['CmContact'],{'onDelete':_0x654b('0x105'),'as':_0x654b('0x147'),'foreignKey':_0x654b('0x148')});db['ChatMessage']['belongsTo'](db[_0x654b('0x67')],{'onDelete':_0x654b('0x105'),'as':_0x654b('0x15d'),'foreignKey':_0x654b('0x180')});db[_0x654b('0x69')][_0x654b('0x136')](db['Attachment'],{'as':_0x654b('0xf0'),'foreignKey':_0x654b('0x168')});db[_0x654b('0x69')][_0x654b('0x136')](db[_0x654b('0x62')],{'as':'Account','foreignKey':_0x654b('0x179')});db['ChatOfflineMessage'][_0x654b('0x136')](db[_0x654b('0x75')],{'onDelete':_0x654b('0x105'),'as':_0x654b('0x147'),'foreignKey':'ContactId'});db[_0x654b('0x6b')][_0x654b('0x136')](db[_0x654b('0x62')],{'as':'Account','foreignKey':_0x654b('0x179')});db[_0x654b('0x6d')][_0x654b('0x112')](db[_0x654b('0x13')],{'as':'Agents','through':_0x654b('0x30'),'hooks':!![]});db[_0x654b('0x6d')][_0x654b('0x112')](db[_0x654b('0xe9')],{'through':_0x654b('0x181'),'as':'Teams'});db[_0x654b('0x6f')]['hasMany'](db['ChatInternalMessage'],{'as':_0x654b('0x164'),'foreignKey':_0x654b('0x182'),'onDelete':_0x654b('0x105')});db[_0x654b('0x6f')][_0x654b('0x112')](db[_0x654b('0x13')],{'as':_0x654b('0x12f'),'through':_0x654b('0x183')});db[_0x654b('0x71')]['belongsTo'](db[_0x654b('0x62')],{'as':_0x654b('0x17e'),'foreignKey':'ChatWebsiteId'});db[_0x654b('0x73')][_0x654b('0x106')](db['CmContact'],{'as':_0x654b('0x113'),'foreignKey':_0x654b('0x184')});db[_0x654b('0x75')]['hasMany'](db[_0x654b('0x77')],{'as':_0x654b('0x185'),'foreignKey':'ContactId'});db[_0x654b('0x75')][_0x654b('0x106')](db['CmHopperFinal'],{'as':_0x654b('0x131'),'foreignKey':_0x654b('0x148')});db[_0x654b('0x75')][_0x654b('0x106')](db[_0x654b('0x7c')],{'as':_0x654b('0x186'),'foreignKey':_0x654b('0x148')});db[_0x654b('0x75')]['hasMany'](db[_0x654b('0x10b')],{'as':'ReportAgentPreview','foreignKey':_0x654b('0x148')});db[_0x654b('0x75')][_0x654b('0x106')](db['JscriptySessionReport'],{'as':'JscriptySessions','foreignKey':_0x654b('0x148')});db[_0x654b('0x75')]['hasMany'](db[_0x654b('0x5d')],{'as':_0x654b('0x10c'),'foreignKey':_0x654b('0x148'),'onDelete':'restrict'});db[_0x654b('0x75')][_0x654b('0x106')](db[_0x654b('0x67')],{'as':_0x654b('0x10d'),'foreignKey':_0x654b('0x148'),'onDelete':_0x654b('0x15f')});db[_0x654b('0x75')]['hasMany'](db[_0x654b('0x55')],{'as':_0x654b('0x117'),'foreignKey':_0x654b('0x148'),'onDelete':_0x654b('0x15f')});db[_0x654b('0x75')][_0x654b('0x106')](db[_0x654b('0x4d')],{'as':_0x654b('0x10e'),'foreignKey':_0x654b('0x148'),'onDelete':_0x654b('0x15f')});db[_0x654b('0x75')][_0x654b('0x106')](db[_0x654b('0x40')],{'as':_0x654b('0x10f'),'foreignKey':_0x654b('0x148'),'onDelete':_0x654b('0x15f')});db[_0x654b('0x75')][_0x654b('0x136')](db[_0x654b('0x73')],{'as':_0x654b('0x187'),'foreignKey':_0x654b('0x184')});db['CmContact'][_0x654b('0x136')](db[_0x654b('0xfc')],{'as':_0x654b('0x152'),'foreignKey':'ListId','onDelete':_0x654b('0x105')});db[_0x654b('0x75')][_0x654b('0x112')](db[_0x654b('0x13')],{'as':'Users','through':_0x654b('0x188')});db['CmContact']['belongsToMany'](db[_0x654b('0x92')],{'as':'Tags','through':_0x654b('0x189')});db[_0x654b('0x75')][_0x654b('0x112')](db['Tag'],{'through':_0x654b('0x189'),'as':_0x654b('0x15a')});db[_0x654b('0x77')][_0x654b('0x136')](db[_0x654b('0x75')],{'as':_0x654b('0x147'),'foreignKey':_0x654b('0x148'),'onDelete':_0x654b('0x105')});db[_0x654b('0x77')][_0x654b('0x136')](db['CmList'],{'as':_0x654b('0x152'),'foreignKey':_0x654b('0x153'),'onDelete':_0x654b('0x105')});db[_0x654b('0x77')]['belongsTo'](db[_0x654b('0x13')],{'as':_0x654b('0x17b'),'foreignKey':_0x654b('0x108')});db['CmHopper'][_0x654b('0x136')](db[_0x654b('0x12e')],{'as':'Queue','foreignKey':_0x654b('0x130'),'onDelete':_0x654b('0x105')});db['CmHopper'][_0x654b('0x136')](db[_0x654b('0xec')],{'as':'Campaign','foreignKey':_0x654b('0x18a'),'onDelete':_0x654b('0x105')});db[_0x654b('0x77')][_0x654b('0x136')](db['User'],{'as':'Owner','foreignKey':_0x654b('0x18b')});db[_0x654b('0x132')][_0x654b('0x136')](db[_0x654b('0x75')],{'as':'Contact','foreignKey':_0x654b('0x148'),'onDelete':_0x654b('0x105')});db[_0x654b('0x132')][_0x654b('0x136')](db[_0x654b('0xfc')],{'as':_0x654b('0x152'),'foreignKey':'ListId','onDelete':_0x654b('0x105')});db[_0x654b('0x132')]['belongsTo'](db[_0x654b('0x12e')],{'as':'Queue','foreignKey':'VoiceQueueId','onDelete':_0x654b('0x105')});db[_0x654b('0x132')]['belongsTo'](db[_0x654b('0xec')],{'as':_0x654b('0xec'),'foreignKey':_0x654b('0x18a'),'onDelete':'cascade'});db['Automation'][_0x654b('0x106')](db['Condition'],{'as':{'plural':_0x654b('0x18c'),'singular':_0x654b('0x18d')},'foreignKey':_0x654b('0x18e'),'onDelete':'cascade','hooks':!![]});db['Automation'][_0x654b('0x106')](db[_0x654b('0x88')],{'as':{'plural':_0x654b('0x18f'),'singular':_0x654b('0x190')},'foreignKey':'AutomationAnyId','onDelete':_0x654b('0x105'),'hooks':!![]});db[_0x654b('0x83')][_0x654b('0x106')](db['Action'],{'as':_0x654b('0x191'),'foreignKey':_0x654b('0x192'),'onDelete':_0x654b('0x105'),'hooks':!![]});db[_0x654b('0x8a')]['hasMany'](db[_0x654b('0x8a')],{'as':_0x654b('0x193'),'foreignKey':_0x654b('0x139'),'onDelete':_0x654b('0x105'),'hooks':!![],'required':![]});db['Interval'][_0x654b('0x106')](db[_0x654b('0x1a')],{'as':_0x654b('0x109'),'foreignKey':_0x654b('0x139'),'onDelete':_0x654b('0x15f')});db[_0x654b('0x8a')][_0x654b('0x106')](db['MailApplication'],{'as':_0x654b('0x194'),'foreignKey':_0x654b('0x139')});db[_0x654b('0x8a')][_0x654b('0x106')](db[_0x654b('0x66')],{'as':'ChatApplications','foreignKey':_0x654b('0x139')});db[_0x654b('0x8a')][_0x654b('0x106')](db[_0x654b('0x163')],{'as':_0x654b('0x195'),'foreignKey':_0x654b('0x139')});db[_0x654b('0x8a')][_0x654b('0x106')](db[_0x654b('0x16c')],{'as':_0x654b('0x196'),'foreignKey':_0x654b('0x139')});db[_0x654b('0x197')]['belongsTo'](db['MailAccount'],{});db[_0x654b('0x197')][_0x654b('0x136')](db[_0x654b('0x9e')],{'foreignKey':_0x654b('0x198')});db['Schedule'][_0x654b('0x136')](db['AnalyticCustomReport'],{'foreignKey':_0x654b('0x199')});db[_0x654b('0x12c')]['belongsToMany'](db['VoiceMusicOnHold'],{'as':_0x654b('0x19a'),'through':_0x654b('0x12d'),'onDelete':_0x654b('0x15f')});db[_0x654b('0x92')][_0x654b('0x112')](db[_0x654b('0x75')],{'through':_0x654b('0x189')});db['Tag'][_0x654b('0x112')](db[_0x654b('0x67')],{'through':_0x654b('0x17f')});db[_0x654b('0x92')][_0x654b('0x112')](db['MailInteraction'],{'through':_0x654b('0x158')});db[_0x654b('0x92')]['belongsToMany'](db['SmsInteraction'],{'through':'sms_interaction_has_tags'});db[_0x654b('0x92')][_0x654b('0x112')](db['FaxInteraction'],{'through':_0x654b('0x167')});db[_0x654b('0x92')][_0x654b('0x112')](db['OpenchannelInteraction'],{'through':_0x654b('0x173')});db[_0x654b('0x96')][_0x654b('0x106')](db[_0x654b('0x88')],{'as':{'plural':_0x654b('0x19b'),'singular':_0x654b('0x19c')},'foreignKey':'TriggerAllId','onDelete':_0x654b('0x105'),'hooks':!![]});db['Trigger'][_0x654b('0x106')](db[_0x654b('0x88')],{'as':{'plural':_0x654b('0x19d'),'singular':'AnyCondition'},'foreignKey':_0x654b('0x19e'),'onDelete':_0x654b('0x105'),'hooks':!![]});db[_0x654b('0x96')][_0x654b('0x106')](db[_0x654b('0x81')],{'as':_0x654b('0x191'),'foreignKey':_0x654b('0x19f'),'onDelete':'cascade','hooks':!![]});db[_0x654b('0x9c')][_0x654b('0x106')](db['AnalyticFieldReport'],{'as':_0x654b('0x1a0'),'onDelete':'cascade','foreignKey':_0x654b('0x199'),'hooks':!![]});db[_0x654b('0x9e')][_0x654b('0x106')](db[_0x654b('0xa3')],{'as':_0x654b('0x1a0'),'onDelete':_0x654b('0x105'),'foreignKey':_0x654b('0x198')});db[_0x654b('0x1a1')][_0x654b('0x106')](db['AnalyticFieldReport'],{'as':_0x654b('0x1a0'),'onDelete':'cascade','foreignKey':_0x654b('0x1a2')});db[_0x654b('0xa3')][_0x654b('0x136')](db['AnalyticMetric'],{'foreignKey':_0x654b('0x1a2')});db[_0x654b('0xa6')]['hasMany'](db[_0x654b('0x1a3')],{'as':_0x654b('0x1a4'),'onDelete':'cascade','foreignKey':_0x654b('0x1a5')});db[_0x654b('0x1a3')][_0x654b('0x106')](db['SalesforceField'],{'as':'Subjects','onDelete':_0x654b('0x105'),'foreignKey':'SubjectId'});db[_0x654b('0x1a3')][_0x654b('0x106')](db['SalesforceField'],{'as':_0x654b('0x1a6'),'onDelete':_0x654b('0x105'),'foreignKey':'DescriptionId'});db[_0x654b('0x1a3')]['hasMany'](db['SalesforceField'],{'as':'Fields','onDelete':_0x654b('0x105'),'foreignKey':_0x654b('0x1a7')});db[_0x654b('0x1a3')][_0x654b('0x136')](db[_0x654b('0xa6')],{'as':_0x654b('0x15e'),'foreignKey':_0x654b('0x1a5')});db[_0x654b('0xa9')][_0x654b('0x106')](db[_0x654b('0xa9')],{'as':_0x654b('0x1a8'),'foreignKey':'SubjectId'});db['SalesforceField'][_0x654b('0x106')](db[_0x654b('0xa9')],{'as':_0x654b('0x1a9'),'foreignKey':_0x654b('0x1aa')});db[_0x654b('0xa9')][_0x654b('0x106')](db[_0x654b('0xa9')],{'as':_0x654b('0x1ab'),'foreignKey':'FieldId'});db[_0x654b('0xa9')][_0x654b('0x136')](db[_0x654b('0x97')],{'as':_0x654b('0x97'),'foreignKey':_0x654b('0x1ac')});db['SugarcrmAccount'][_0x654b('0x106')](db[_0x654b('0x1ad')],{'as':_0x654b('0x1a4'),'onDelete':_0x654b('0x105'),'foreignKey':_0x654b('0x1a5')});db['SugarcrmConfiguration'][_0x654b('0x106')](db[_0x654b('0xad')],{'as':_0x654b('0x1ae'),'onDelete':_0x654b('0x105'),'foreignKey':_0x654b('0x1af')});db[_0x654b('0x1ad')][_0x654b('0x106')](db[_0x654b('0xad')],{'as':'Descriptions','onDelete':_0x654b('0x105'),'foreignKey':_0x654b('0x1aa')});db[_0x654b('0x1ad')][_0x654b('0x106')](db[_0x654b('0xad')],{'as':_0x654b('0x1a0'),'onDelete':_0x654b('0x105'),'foreignKey':_0x654b('0x1a7')});db[_0x654b('0x1ad')][_0x654b('0x136')](db[_0x654b('0xab')],{'as':_0x654b('0x15e'),'foreignKey':_0x654b('0x1a5')});db['SugarcrmField'][_0x654b('0x106')](db[_0x654b('0xad')],{'as':'Subject','foreignKey':_0x654b('0x1af')});db[_0x654b('0xad')]['hasMany'](db[_0x654b('0xad')],{'as':_0x654b('0x1a9'),'foreignKey':_0x654b('0x1aa')});db[_0x654b('0xad')][_0x654b('0x106')](db[_0x654b('0xad')],{'as':'Field','foreignKey':_0x654b('0x1a7')});db[_0x654b('0xad')][_0x654b('0x136')](db[_0x654b('0x97')],{'as':'Variable','foreignKey':_0x654b('0x1ac')});db['DeskAccount'][_0x654b('0x106')](db[_0x654b('0x1b0')],{'as':'Configurations','onDelete':_0x654b('0x105'),'foreignKey':_0x654b('0x1a5')});db['DeskConfiguration'][_0x654b('0x106')](db[_0x654b('0xb2')],{'as':_0x654b('0x1ae'),'onDelete':'cascade','foreignKey':_0x654b('0x1af')});db['DeskConfiguration'][_0x654b('0x106')](db[_0x654b('0xb2')],{'as':_0x654b('0x1a6'),'onDelete':_0x654b('0x105'),'foreignKey':_0x654b('0x1aa')});db[_0x654b('0x1b0')]['hasMany'](db[_0x654b('0xb2')],{'as':_0x654b('0x1a0'),'onDelete':'cascade','foreignKey':_0x654b('0x1a7')});db[_0x654b('0x1b0')][_0x654b('0x136')](db[_0x654b('0xaf')],{'as':_0x654b('0x15e'),'foreignKey':_0x654b('0x1a5')});db['DeskConfiguration'][_0x654b('0x112')](db['Tag'],{'through':'int_desk_configuration_has_tags'});db[_0x654b('0xb2')][_0x654b('0x106')](db[_0x654b('0xb2')],{'as':'Subject','foreignKey':_0x654b('0x1af')});db[_0x654b('0xb2')][_0x654b('0x106')](db[_0x654b('0xb2')],{'as':_0x654b('0x1a9'),'foreignKey':_0x654b('0x1aa')});db[_0x654b('0xb2')][_0x654b('0x106')](db['DeskField'],{'as':_0x654b('0x1ab'),'foreignKey':'FieldId'});db[_0x654b('0xb2')][_0x654b('0x136')](db[_0x654b('0x97')],{'as':_0x654b('0x97'),'foreignKey':_0x654b('0x1ac')});db[_0x654b('0xb3')][_0x654b('0x106')](db[_0x654b('0xb5')],{'as':'Configurations','onDelete':'cascade','foreignKey':_0x654b('0x1a5')});db[_0x654b('0xb5')][_0x654b('0x106')](db[_0x654b('0xb7')],{'as':_0x654b('0x1ae'),'onDelete':_0x654b('0x105'),'foreignKey':_0x654b('0x1af')});db[_0x654b('0xb5')][_0x654b('0x106')](db[_0x654b('0xb7')],{'as':'Descriptions','onDelete':_0x654b('0x105'),'foreignKey':_0x654b('0x1aa')});db[_0x654b('0xb5')][_0x654b('0x106')](db[_0x654b('0xb7')],{'as':_0x654b('0x1a0'),'onDelete':'cascade','foreignKey':_0x654b('0x1a7')});db[_0x654b('0xb5')][_0x654b('0x136')](db['ZohoAccount'],{'as':_0x654b('0x15e'),'foreignKey':_0x654b('0x1a5')});db[_0x654b('0xb7')][_0x654b('0x106')](db[_0x654b('0xb7')],{'as':_0x654b('0x1a8'),'foreignKey':'SubjectId'});db[_0x654b('0xb7')][_0x654b('0x106')](db[_0x654b('0xb7')],{'as':_0x654b('0x1a9'),'foreignKey':_0x654b('0x1aa')});db[_0x654b('0xb7')]['hasMany'](db['ZohoField'],{'as':_0x654b('0x1ab'),'foreignKey':_0x654b('0x1a7')});db['ZohoField'][_0x654b('0x136')](db[_0x654b('0x97')],{'as':_0x654b('0x97'),'foreignKey':_0x654b('0x1ac')});db['ZendeskAccount'][_0x654b('0x106')](db[_0x654b('0xbb')],{'as':_0x654b('0x1a4'),'onDelete':_0x654b('0x105'),'foreignKey':_0x654b('0x1a5')});db[_0x654b('0xbb')][_0x654b('0x106')](db['ZendeskField'],{'as':_0x654b('0x1ae'),'foreignKey':_0x654b('0x1af')});db['ZendeskConfiguration'][_0x654b('0x106')](db[_0x654b('0xbd')],{'as':_0x654b('0x1a6'),'foreignKey':'DescriptionId'});db[_0x654b('0xbb')][_0x654b('0x106')](db['ZendeskField'],{'as':_0x654b('0x1a0'),'foreignKey':_0x654b('0x1a7')});db[_0x654b('0xbb')][_0x654b('0x136')](db[_0x654b('0xb9')],{'as':_0x654b('0x15e'),'foreignKey':_0x654b('0x1a5')});db[_0x654b('0xbb')][_0x654b('0x112')](db[_0x654b('0x92')],{'through':_0x654b('0x1b1')});db[_0x654b('0xbd')][_0x654b('0x106')](db['ZendeskField'],{'as':_0x654b('0x1a8'),'foreignKey':_0x654b('0x1af')});db[_0x654b('0xbd')][_0x654b('0x106')](db[_0x654b('0xbd')],{'as':_0x654b('0x1a9'),'foreignKey':_0x654b('0x1aa')});db[_0x654b('0xbd')]['hasMany'](db[_0x654b('0xbd')],{'as':'Field','foreignKey':_0x654b('0x1a7')});db[_0x654b('0xbd')][_0x654b('0x136')](db[_0x654b('0x97')],{'as':_0x654b('0x97'),'foreignKey':_0x654b('0x1ac')});db[_0x654b('0x1b2')][_0x654b('0x106')](db[_0x654b('0xbf')],{'as':_0x654b('0x1a4'),'onDelete':_0x654b('0x105'),'foreignKey':'AccountId'});db['FreshdeskConfiguration'][_0x654b('0x106')](db['FreshdeskField'],{'as':_0x654b('0x1ae'),'onDelete':_0x654b('0x105'),'foreignKey':'SubjectId'});db[_0x654b('0xbf')][_0x654b('0x106')](db['FreshdeskField'],{'as':_0x654b('0x1a6'),'onDelete':'cascade','foreignKey':_0x654b('0x1aa')});db[_0x654b('0xbf')]['hasMany'](db[_0x654b('0x1b3')],{'as':'Fields','onDelete':_0x654b('0x105'),'foreignKey':_0x654b('0x1a7')});db[_0x654b('0xbf')][_0x654b('0x136')](db[_0x654b('0x1b2')],{'as':_0x654b('0x15e'),'foreignKey':_0x654b('0x1a5')});db['FreshdeskConfiguration'][_0x654b('0x112')](db['Tag'],{'through':_0x654b('0x1b4')});db[_0x654b('0x1b3')][_0x654b('0x106')](db[_0x654b('0x1b3')],{'as':'Subject','foreignKey':'SubjectId'});db[_0x654b('0x1b3')][_0x654b('0x106')](db[_0x654b('0x1b3')],{'as':_0x654b('0x1a9'),'foreignKey':_0x654b('0x1aa')});db['FreshdeskField'][_0x654b('0x106')](db['FreshdeskField'],{'as':'Field','foreignKey':_0x654b('0x1a7')});db[_0x654b('0x1b3')][_0x654b('0x136')](db[_0x654b('0x97')],{'as':_0x654b('0x97'),'foreignKey':_0x654b('0x1ac')});db['VtigerAccount'][_0x654b('0x106')](db[_0x654b('0xc3')],{'as':'Configurations','onDelete':'cascade','foreignKey':_0x654b('0x1a5')});db['VtigerConfiguration'][_0x654b('0x106')](db['VtigerField'],{'as':_0x654b('0x1ae'),'foreignKey':_0x654b('0x1af')});db[_0x654b('0xc3')][_0x654b('0x106')](db['VtigerField'],{'as':'Descriptions','foreignKey':_0x654b('0x1aa')});db[_0x654b('0xc3')][_0x654b('0x106')](db['VtigerField'],{'as':_0x654b('0x1a0'),'foreignKey':_0x654b('0x1a7')});db['VtigerConfiguration'][_0x654b('0x136')](db[_0x654b('0xc1')],{'as':_0x654b('0x15e'),'foreignKey':'AccountId'});db['VtigerField'][_0x654b('0x106')](db[_0x654b('0xc5')],{'as':_0x654b('0x1a8'),'foreignKey':'SubjectId'});db['VtigerField']['hasMany'](db['VtigerField'],{'as':_0x654b('0x1a9'),'foreignKey':_0x654b('0x1aa')});db[_0x654b('0xc5')]['hasMany'](db['VtigerField'],{'as':_0x654b('0x1ab'),'foreignKey':_0x654b('0x1a7')});db[_0x654b('0xc5')][_0x654b('0x136')](db['Variable'],{'as':_0x654b('0x97'),'foreignKey':_0x654b('0x1ac')});db[_0x654b('0xc7')][_0x654b('0x106')](db[_0x654b('0xc9')],{'as':_0x654b('0x1a4'),'onDelete':_0x654b('0x105'),'foreignKey':_0x654b('0x1a5')});db['ServicenowConfiguration'][_0x654b('0x106')](db[_0x654b('0x1b5')],{'as':_0x654b('0x1ae'),'foreignKey':_0x654b('0x1af')});db[_0x654b('0xc9')][_0x654b('0x106')](db[_0x654b('0x1b5')],{'as':_0x654b('0x1a6'),'foreignKey':_0x654b('0x1aa')});db[_0x654b('0xc9')][_0x654b('0x106')](db[_0x654b('0x1b5')],{'as':_0x654b('0x1a0'),'foreignKey':_0x654b('0x1a7')});db[_0x654b('0xc9')][_0x654b('0x136')](db[_0x654b('0xc7')],{'as':_0x654b('0x15e'),'foreignKey':'AccountId'});db['ServicenowField'][_0x654b('0x106')](db[_0x654b('0x1b5')],{'as':_0x654b('0x1a8'),'foreignKey':_0x654b('0x1af')});db[_0x654b('0x1b5')][_0x654b('0x106')](db[_0x654b('0x1b5')],{'as':'Description','foreignKey':_0x654b('0x1aa')});db['ServicenowField'][_0x654b('0x106')](db[_0x654b('0x1b5')],{'as':_0x654b('0x1ab'),'foreignKey':_0x654b('0x1a7')});db[_0x654b('0x1b5')][_0x654b('0x136')](db['Variable'],{'as':'Variable','foreignKey':_0x654b('0x1ac')});db[_0x654b('0xcb')][_0x654b('0x106')](db[_0x654b('0xcd')],{'as':'Configurations','onDelete':_0x654b('0x105'),'foreignKey':_0x654b('0x1a5')});db[_0x654b('0xcd')][_0x654b('0x106')](db[_0x654b('0xcf')],{'as':_0x654b('0x1ae'),'onDelete':_0x654b('0x105'),'foreignKey':_0x654b('0x1af')});db['Dynamics365Configuration']['hasMany'](db['Dynamics365Field'],{'as':_0x654b('0x1a6'),'onDelete':'cascade','foreignKey':_0x654b('0x1aa')});db[_0x654b('0xcd')]['hasMany'](db['Dynamics365Field'],{'as':'Fields','onDelete':_0x654b('0x105'),'foreignKey':'FieldId'});db[_0x654b('0xcd')][_0x654b('0x136')](db[_0x654b('0xcb')],{'as':_0x654b('0x15e'),'foreignKey':_0x654b('0x1a5')});db[_0x654b('0xcf')][_0x654b('0x106')](db[_0x654b('0xcf')],{'as':_0x654b('0x1a8'),'foreignKey':'SubjectId'});db[_0x654b('0xcf')][_0x654b('0x106')](db[_0x654b('0xcf')],{'as':'Description','foreignKey':'DescriptionId'});db[_0x654b('0xcf')]['hasMany'](db[_0x654b('0xcf')],{'as':'Field','foreignKey':_0x654b('0x1a7')});db[_0x654b('0xcf')]['belongsTo'](db[_0x654b('0x97')],{'as':_0x654b('0x97'),'foreignKey':_0x654b('0x1ac')});db['FreshsalesAccount']['hasMany'](db['FreshsalesConfiguration'],{'as':_0x654b('0x1a4'),'onDelete':'cascade','foreignKey':'AccountId'});db[_0x654b('0xd1')][_0x654b('0x106')](db[_0x654b('0xd2')],{'as':_0x654b('0x1ae'),'foreignKey':_0x654b('0x1af')});db[_0x654b('0xd1')][_0x654b('0x106')](db[_0x654b('0xd2')],{'as':_0x654b('0x1a6'),'foreignKey':'DescriptionId'});db[_0x654b('0xd1')]['hasMany'](db['FreshsalesField'],{'as':_0x654b('0x1a0'),'foreignKey':_0x654b('0x1a7')});db['FreshsalesConfiguration'][_0x654b('0x136')](db[_0x654b('0x1b6')],{'as':_0x654b('0x15e'),'foreignKey':_0x654b('0x1a5')});db[_0x654b('0xd2')][_0x654b('0x106')](db[_0x654b('0xd2')],{'as':_0x654b('0x1a8'),'foreignKey':_0x654b('0x1af')});db[_0x654b('0xd2')][_0x654b('0x106')](db[_0x654b('0xd2')],{'as':_0x654b('0x1a9'),'foreignKey':_0x654b('0x1aa')});db[_0x654b('0xd2')][_0x654b('0x106')](db['FreshsalesField'],{'as':_0x654b('0x1ab'),'foreignKey':'FieldId'});db['FreshsalesField'][_0x654b('0x136')](db[_0x654b('0x97')],{'as':_0x654b('0x97'),'foreignKey':_0x654b('0x1ac')});db['ChatQueueReport'][_0x654b('0x136')](db[_0x654b('0x62')],{});db['ChatQueueReport'][_0x654b('0x136')](db[_0x654b('0xfc')],{'as':_0x654b('0x152'),'foreignKey':_0x654b('0x153')});db[_0x654b('0xd6')][_0x654b('0x136')](db[_0x654b('0x75')],{'as':_0x654b('0x147'),'foreignKey':'ContactId'});db[_0x654b('0xd6')][_0x654b('0x136')](db['ChatInteraction'],{});db[_0x654b('0xd6')][_0x654b('0x136')](db[_0x654b('0x69')],{});db[_0x654b('0xd6')][_0x654b('0x136')](db['User'],{});db[_0x654b('0xd6')][_0x654b('0x136')](db[_0x654b('0x6d')],{});db[_0x654b('0xd8')][_0x654b('0x136')](db['User'],{'onDelete':_0x654b('0x105'),'foreignKey':_0x654b('0x1b7')});db[_0x654b('0xd8')][_0x654b('0x136')](db['User'],{'onDelete':_0x654b('0x105'),'foreignKey':_0x654b('0x1b8')});db[_0x654b('0x134')][_0x654b('0x106')](db[_0x654b('0xd9')],{'foreignKey':_0x654b('0x1b9'),'onDelete':_0x654b('0x105')});db['JscriptySessionReport']['hasMany'](db[_0x654b('0x1ba')],{'foreignKey':_0x654b('0x1b9'),'onDelete':_0x654b('0x105')});db['SmsQueueReport'][_0x654b('0x136')](db[_0x654b('0x53')],{});db[_0x654b('0xdc')]['belongsTo'](db[_0x654b('0xfc')],{'as':_0x654b('0x152'),'foreignKey':_0x654b('0x153')});db[_0x654b('0xdc')][_0x654b('0x136')](db[_0x654b('0x75')],{'as':_0x654b('0x147'),'foreignKey':_0x654b('0x148')});db[_0x654b('0xdc')][_0x654b('0x136')](db[_0x654b('0x55')],{});db[_0x654b('0xdc')][_0x654b('0x136')](db['SmsMessage'],{});db[_0x654b('0xdc')][_0x654b('0x136')](db[_0x654b('0x13')],{});db[_0x654b('0xdc')][_0x654b('0x136')](db[_0x654b('0x58')],{});db[_0x654b('0xe2')][_0x654b('0x106')](db[_0x654b('0x134')],{'foreignKey':_0x654b('0x1bb')});db[_0x654b('0xe2')][_0x654b('0x106')](db[_0x654b('0xd9')],{'foreignKey':_0x654b('0x1bb')});db[_0x654b('0xe2')][_0x654b('0x106')](db['JscriptyAnswerReport'],{'foreignKey':_0x654b('0x1bb')});db[_0x654b('0x126')][_0x654b('0x112')](db['User'],{'as':'Users','through':_0x654b('0x128')});db[_0x654b('0xe9')][_0x654b('0x112')](db[_0x654b('0x13')],{'as':_0x654b('0x13c'),'through':_0x654b('0x1bc')});db[_0x654b('0xe9')]['belongsToMany'](db['VoiceQueue'],{'through':_0x654b('0x13e'),'as':'VoiceQueues'});db[_0x654b('0xe9')][_0x654b('0x112')](db[_0x654b('0x3c')],{'through':_0x654b('0x155'),'as':_0x654b('0x1bd')});db[_0x654b('0xe9')][_0x654b('0x112')](db[_0x654b('0x6d')],{'through':_0x654b('0x181'),'as':_0x654b('0x119')});db['Team'][_0x654b('0x112')](db['FaxQueue'],{'through':_0x654b('0x169'),'as':_0x654b('0x1be')});db['Team'][_0x654b('0x112')](db[_0x654b('0x58')],{'through':_0x654b('0x171'),'as':_0x654b('0x1bf')});db['Team']['belongsToMany'](db[_0x654b('0x11a')],{'through':_0x654b('0x178'),'as':_0x654b('0x11b')});db[_0x654b('0xec')][_0x654b('0x106')](db[_0x654b('0x77')],{'as':_0x654b('0x185'),'foreignKey':_0x654b('0x18a')});db['Campaign'][_0x654b('0x106')](db[_0x654b('0x7a')],{'as':_0x654b('0x131'),'foreignKey':_0x654b('0x18a')});db[_0x654b('0xec')][_0x654b('0x106')](db[_0x654b('0x7c')],{'as':_0x654b('0x186'),'foreignKey':'CampaignId'});db[_0x654b('0xec')]['hasMany'](db[_0x654b('0x132')],{'as':_0x654b('0x133'),'foreignKey':'CampaignId'});db['Campaign'][_0x654b('0x136')](db['Trunk'],{'as':_0x654b('0x2a'),'foreignKey':_0x654b('0x137')});db[_0x654b('0xec')][_0x654b('0x136')](db['Trunk'],{'as':'TrunkBackup','foreignKey':_0x654b('0x138')});db['Campaign'][_0x654b('0x136')](db[_0x654b('0x8a')],{'as':_0x654b('0x8a'),'foreignKey':'IntervalId'});db['Campaign']['belongsTo'](db[_0x654b('0x126')],{'as':'SquareProject','foreignKey':_0x654b('0x1c0')});db['Campaign']['belongsToMany'](db['CmList'],{'as':_0x654b('0x114'),'through':_0x654b('0x1c1')});db[_0x654b('0xec')][_0x654b('0x112')](db['CmList'],{'as':'BlackLists','through':_0x654b('0x1c2')});db['MailTransferReport'][_0x654b('0x136')](db[_0x654b('0x42')],{});db[_0x654b('0x1c3')]['belongsTo'](db[_0x654b('0x40')],{});db[_0x654b('0x1c3')][_0x654b('0x136')](db[_0x654b('0x3a')],{'foreignKey':_0x654b('0x1c4'),'as':_0x654b('0x1c5')});db[_0x654b('0x1c3')][_0x654b('0x136')](db['User'],{'foreignKey':'FromUserId','as':'FromAgent'});db[_0x654b('0x1c3')][_0x654b('0x136')](db[_0x654b('0x13')],{'foreignKey':_0x654b('0x1c6'),'as':_0x654b('0x1c7')});db[_0x654b('0x1c3')]['belongsTo'](db[_0x654b('0x3c')],{'foreignKey':_0x654b('0x1c8'),'as':_0x654b('0x1c9')});db[_0x654b('0x1c3')][_0x654b('0x136')](db['MailAccount'],{'foreignKey':_0x654b('0x1ca'),'as':_0x654b('0x1cb')});db[_0x654b('0xf5')]['belongsTo'](db[_0x654b('0x69')],{});db[_0x654b('0xf5')]['belongsTo'](db[_0x654b('0x67')],{});db['ChatTransferReport'][_0x654b('0x136')](db[_0x654b('0x62')],{'foreignKey':_0x654b('0x1cc'),'as':_0x654b('0x1c5')});db[_0x654b('0xf5')][_0x654b('0x136')](db['User'],{'foreignKey':_0x654b('0x1cd'),'as':_0x654b('0x1ce')});db[_0x654b('0xf5')][_0x654b('0x136')](db[_0x654b('0x13')],{'foreignKey':_0x654b('0x1c6'),'as':_0x654b('0x1c7')});db[_0x654b('0xf5')]['belongsTo'](db[_0x654b('0x6d')],{'foreignKey':_0x654b('0x1cf'),'as':_0x654b('0x1c9')});db[_0x654b('0xf5')][_0x654b('0x136')](db['ChatWebsite'],{'foreignKey':_0x654b('0x1d0'),'as':_0x654b('0x1cb')});db[_0x654b('0xf7')]['belongsTo'](db[_0x654b('0x4f')],{});db['FaxTransferReport'][_0x654b('0x136')](db[_0x654b('0x4d')],{});db[_0x654b('0xf7')][_0x654b('0x136')](db['FaxAccount'],{'foreignKey':_0x654b('0x1d1'),'as':_0x654b('0x1c5')});db['FaxTransferReport'][_0x654b('0x136')](db['User'],{'foreignKey':_0x654b('0x1cd'),'as':'FromAgent'});db['FaxTransferReport']['belongsTo'](db[_0x654b('0x13')],{'foreignKey':'ToUserId','as':_0x654b('0x1c7')});db[_0x654b('0xf7')]['belongsTo'](db[_0x654b('0x51')],{'foreignKey':_0x654b('0x1d2'),'as':_0x654b('0x1c9')});db[_0x654b('0xf7')][_0x654b('0x136')](db[_0x654b('0x11e')],{'foreignKey':'ToFaxAccountId','as':'ToAccount'});db[_0x654b('0xf8')][_0x654b('0x136')](db[_0x654b('0x5f')],{});db['OpenchannelTransferReport'][_0x654b('0x136')](db[_0x654b('0x5d')],{});db[_0x654b('0xf8')][_0x654b('0x136')](db[_0x654b('0x5a')],{'foreignKey':_0x654b('0x1d3'),'as':_0x654b('0x1c5')});db[_0x654b('0xf8')][_0x654b('0x136')](db[_0x654b('0x13')],{'foreignKey':_0x654b('0x1cd'),'as':_0x654b('0x1ce')});db['OpenchannelTransferReport'][_0x654b('0x136')](db[_0x654b('0x13')],{'foreignKey':_0x654b('0x1c6'),'as':_0x654b('0x1c7')});db[_0x654b('0xf8')][_0x654b('0x136')](db[_0x654b('0x11a')],{'foreignKey':'ToOpenchannelQueueId','as':_0x654b('0x1c9')});db[_0x654b('0xf8')][_0x654b('0x136')](db[_0x654b('0x5a')],{'foreignKey':'ToOpenchannelAccountId','as':_0x654b('0x1cb')});db['SmsTransferReport'][_0x654b('0x136')](db[_0x654b('0x56')],{});db['SmsTransferReport'][_0x654b('0x136')](db[_0x654b('0x55')],{});db[_0x654b('0xfa')][_0x654b('0x136')](db[_0x654b('0x53')],{'foreignKey':_0x654b('0x1d4'),'as':_0x654b('0x1c5')});db[_0x654b('0xfa')][_0x654b('0x136')](db[_0x654b('0x13')],{'foreignKey':_0x654b('0x1cd'),'as':_0x654b('0x1ce')});db[_0x654b('0xfa')][_0x654b('0x136')](db['User'],{'foreignKey':_0x654b('0x1c6'),'as':_0x654b('0x1c7')});db[_0x654b('0xfa')]['belongsTo'](db[_0x654b('0x58')],{'foreignKey':_0x654b('0x1d5'),'as':_0x654b('0x1c9')});db[_0x654b('0xfa')][_0x654b('0x136')](db['SmsAccount'],{'foreignKey':'ToSmsAccountId','as':_0x654b('0x1cb')});db['CmList'][_0x654b('0x106')](db[_0x654b('0x86')],{'as':_0x654b('0x14e'),'foreignKey':_0x654b('0x153')});db['CmList'][_0x654b('0x106')](db[_0x654b('0x7f')],{'as':_0x654b('0x1d6'),'foreignKey':'ListId'});db[_0x654b('0xfc')]['hasMany'](db[_0x654b('0x75')],{'as':_0x654b('0x113'),'onDelete':_0x654b('0x105'),'foreignKey':_0x654b('0x153')});db['CmList'][_0x654b('0x106')](db[_0x654b('0x7a')],{'as':_0x654b('0x131'),'foreignKey':_0x654b('0x153')});db[_0x654b('0xfc')]['hasMany'](db['CmHopperHistory'],{'as':'HopperHistory','foreignKey':_0x654b('0x153')});db['CmList'][_0x654b('0x106')](db[_0x654b('0x10b')],{'as':'ReportAgentPreview','foreignKey':_0x654b('0x153')});db[_0x654b('0xfc')][_0x654b('0x112')](db[_0x654b('0x12e')],{'as':_0x654b('0x1d7'),'through':_0x654b('0x13b')});db['CmList'][_0x654b('0x112')](db[_0x654b('0x13')],{'as':_0x654b('0x13c'),'through':_0x654b('0x1d8')});db[_0x654b('0xfd')][_0x654b('0x106')](db[_0x654b('0x1a')],{'as':_0x654b('0x109'),'onDelete':_0x654b('0x15f')});db[_0x654b('0xfd')]['belongsToMany'](db[_0x654b('0x13')],{'as':'Agents','through':_0x654b('0x11c')});db[_0x654b('0xff')]['hasMany'](db['User'],{'as':_0x654b('0x15b'),'foreignKey':'userProfileId'});db[_0x654b('0xff')][_0x654b('0x106')](db[_0x654b('0x101')],{'as':'UserProfileSections','foreignKey':_0x654b('0x110'),'onDelete':_0x654b('0x105')});db[_0x654b('0x101')]['hasMany'](db[_0x654b('0x102')],{'as':_0x654b('0x1d9'),'foreignKey':'sectionId','onDelete':_0x654b('0x105')});module['exports']={'db':db,'dbH':dbH}; \ No newline at end of file +var _0xf544=['ChatApplication','../api/chatApplication/chatApplication.model','ChatInteraction','../api/chatInteraction/chatInteraction.model','ChatMessage','ChatOfflineMessage','../api/chatOfflineMessage/chatOfflineMessage.model','../api/chatQueue/chatQueue.model','../api/chatGroup/chatGroup.model','ChatProactiveAction','../api/chatProactiveAction/chatProactiveAction.model','CmCompany','../api/cmCompany/cmCompany.model','../api/cmContact/cmContact.model','CmHopper','CmHopperBlack','../api/cmHopperBlack/cmHopperBlack.model','CmHopperFinal','../api/cmHopperFinal/cmHopperFinal.model','CmHopperHistory','ReportAgentPreview','../api/reportAgentPreview/reportAgentPreview.model','CmCustomField','../api/cmCustomField/cmCustomField.model','Action','../api/action/action.model','Automation','../api/automation/automation.model','CannedAnswer','../api/cannedAnswer/cannedAnswer.model','Disposition','Condition','../api/condition/condition.model','Interval','../api/interval/interval.model','Cdr','../api/cdr/cdr.model','VoiceQueuesLog','../api/voiceQueuesLog/voiceQueuesLog.model','Schedule','../api/schedule/schedule.model','../api/sound/sound.model','Tag','../api/tag/tag.model','../api/template/template.model','Trigger','Variable','Integration','IntegrationReport','../api/integrationReport/integrationReport.model','AnalyticCustomReport','../api/analyticCustomReport/analyticCustomReport.model','AnalyticDefaultReport','../api/analyticDefaultReport/analyticDefaultReport.model','AnalyticExtractedReport','../api/analyticExtractedReport/analyticExtractedReport.model','../api/analyticFieldReport/analyticFieldReport.model','AnalyticTreeReport','../api/analyticTreeReport/analyticTreeReport.model','SalesforceAccount','../api/intSalesforceAccount/intSalesforceAccount.model','SalesforceConfiguration','../api/intSalesforceConfiguration/intSalesforceConfiguration.model','SalesforceField','../api/intSalesforceField/intSalesforceField.model','SugarcrmAccount','../api/intSugarcrmConfiguration/intSugarcrmConfiguration.model','SugarcrmField','../api/intSugarcrmField/intSugarcrmField.model','DeskAccount','../api/intDeskAccount/intDeskAccount.model','DeskField','../api/intDeskField/intDeskField.model','ZohoConfiguration','../api/intZohoField/intZohoField.model','ZendeskAccount','../api/intZendeskAccount/intZendeskAccount.model','ZendeskConfiguration','../api/intZendeskConfiguration/intZendeskConfiguration.model','ZendeskField','../api/intZendeskField/intZendeskField.model','FreshdeskAccount','../api/intFreshdeskAccount/intFreshdeskAccount.model','FreshdeskConfiguration','../api/intFreshdeskConfiguration/intFreshdeskConfiguration.model','../api/intFreshdeskField/intFreshdeskField.model','../api/intVtigerAccount/intVtigerAccount.model','VtigerConfiguration','ServicenowAccount','../api/intServicenowAccount/intServicenowAccount.model','ServicenowConfiguration','ServicenowField','../api/intServicenowField/intServicenowField.model','Dynamics365Account','../api/intDynamics365Account/intDynamics365Account.model','../api/intDynamics365Configuration/intDynamics365Configuration.model','../api/intDynamics365Field/intDynamics365Field.model','FreshsalesAccount','../api/intFreshsalesAccount/intFreshsalesAccount.model','FreshsalesConfiguration','../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','../api/jscriptySessionReport/jscriptySessionReport.model','../api/smsQueueReport/smsQueueReport.model','SquareReport','../api/squareReport/squareReport.model','../api/squareReportDetail/squareReportDetail.model','JscriptyProject','../api/jscriptyProject/jscriptyProject.model','Setting','../api/setting/setting.model','SquareOdbc','../api/squareOdbc/squareOdbc.model','SquareProject','../api/squareProject/squareProject.model','SquareRecording','../api/squareRecording/squareRecording.model','SquareMessage','../api/squareMessage/squareMessage.model','Team','License','../api/license/license.model','../api/campaign/campaign.model','Migration','../api/migration/migration.model','../api/attachment/attachment.model','../api/plugin/plugin.model','../api/mailTransferReport/mailTransferReport.model','../api/chatTransferReport/chatTransferReport.model','FaxTransferReport','../api/faxTransferReport/faxTransferReport.model','OpenchannelTransferReport','../api/openchannelTransferReport/openchannelTransferReport.model','SmsTransferReport','CmList','VoicePrefix','../api/voicePrefix/voicePrefix.model','UserProfile','../api/userProfile/userProfile.model','UserProfileSection','../api/userProfileSection/userProfileSection.model','../api/userProfileResource/userProfileResource.model','hasOne','cascade','hasMany','Recordings','UserId','VoiceExtension','HopperFinals','HopperHistory','OpenchannelInteraction','ChatInteractions','SmsInteractions','FaxInteractions','belongsToMany','ChatGroup','Groups','CmContact','cm_user_has_contacts','Lists','cm_user_has_lists','user_has_teams','MailInteractions','user_has_mail_interactions','user_has_fax_interactions','user_has_sms_interactions','OpenchannelInteractions','user_has_openchannel_interactions','VoiceQueues','MailQueues','ChatQueue','ChatQueues','SmsQueue','SmsQueues','OpenchannelQueue','UserOpenchannelQueue','ChatWebsites','user_has_chat_websites','FaxAccounts','user_has_fax_accounts','user_has_mail_accounts','OpenchannelAccounts','user_has_openchannel_accounts','SmsAccounts','SquareProjects','user_has_square_projects','SpiedAgents','ChanSpyId','Applications','Sound','Sounds','moh_has_sounds','Members','VoiceQueueId','Hoppers','HopperHistories','HopperBlacks','JscriptySessionReport','JscriptySessions','belongsTo','TrunkId','TrunkBackupId','IntervalId','Pause','mandatoryDispositionPause','Agents','Teams','voice_queues_has_cm_blacklists','VoiceRecording','Messages','mailboxuser','VoiceMailMessage','VoiceCallReport','VoiceQueueReport','QueueCalls','uniqueid','AgentReports','Contact','ContactId','MailAccount','MailAccountId','Smtp','Dispositions','Answers','MailMessage','List','Template','team_has_mail_queues','MailInteractionId','Account','Owner','mail_interaction_has_tags','Users','Attachment','Attachments','restrict','TagId','DashboardItem','Items','FaxAccountId','Interactions','Exntensions','ListId','mandatoryDispositionPauseId','FaxInteractionId','Tags','fax_interaction_has_tags','ThroughTags','FaxMessage','Interaction','AttachmentId','SmsAccountId','user_has_sms_accounts','SmsApplication','SmsInteractionId','sms_interaction_has_tags','OpenchannelAccountId','OpenchannelApplication','OpenchannelQueueId','openchannel_interaction_has_tags','OpenchannelInteractionId','team_has_openchannel_queues','ChatWebsiteId','ProactiveActions','Agent','Queue','ChatQueueId','Website','ChatInteractionId','chat_interaction_has_tags','team_has_chat_queues','chat_group_has_users','Contacts','CompanyId','cm_contact_has_tags','Campaign','CampaignId','OwnerId','All','OneAll','AutomationAllId','Any','AutomationAnyId','Actions','AutomationId','Intervals','ChatApplications','FaxApplications','SmsApplications','DefaultReportId','CustomReportId','AllConditions','TriggerAllId','AnyConditions','AnyCondition','TriggerAnyId','TriggerId','AnalyticFieldReport','Fields','AnalyticMetric','MetricId','Configurations','AccountId','Subjects','SubjectId','Descriptions','DescriptionId','FieldId','Subject','Description','VariableId','SugarcrmConfiguration','DeskConfiguration','Field','ZohoField','ZohoAccount','int_zendesk_configuration_has_tags','FreshdeskField','int_freshdesk_configuration_has_tags','VtigerAccount','VtigerField','Dynamics365Configuration','Dynamics365Field','FreshsalesField','ToId','SessionId','SmsQueueReport','ProjectId','team_has_voice_queues','FaxQueues','team_has_sms_queues','OpenchannelQueues','TrunkBackup','SquareProjectId','campaigns_has_cm_blacklists','MailTransferReport','FromMailAccountId','FromAccount','FromUserId','FromAgent','ToUserId','ToAgent','ToMailQueueId','ToAccount','ChatTransferReport','FromChatWebsiteId','ToChatQueueId','ToChatWebsiteId','FromFaxAccountId','ToFaxQueueId','ToQueue','ToFaxAccountId','FromOpenchannelAccountId','ToOpenchannelQueueId','ToOpenchannelAccountId','FromSmsAccountId','ToSmsQueueId','ToSmsAccountId','CustomFields','Queues','voice_queues_has_cm_lists','Extensions','user_has_voice_prefixes','userProfileId','UserProfileResource','Resources','sectionId','exports','path','sequelize','lodash','jstz','motion2','xcall','xC@LL1234','127.0.0.1','mysql','utf8mb4','name','utf8','utf8_general_ci','sequelizeHistory','defaultsDeep','database','username','password','options','User','import','../api/user/user.model','VoiceChanSpy','../api/voiceChanSpy/voiceChanSpy.model','../api/voiceContext/voiceContext.model','../api/voiceExtension/voiceExtension.model','VoiceMusicOnHold','../api/voiceMusicOnHold/voiceMusicOnHold.model','VoiceQueue','../api/voiceQueue/voiceQueue.model','../api/voiceRecording/voiceRecording.model','ScreenRecording','VoiceMail','../api/voiceMailMessage/voiceMailMessage.model','../api/voiceCallReport/voiceCallReport.model','../api/voiceDialReport/voiceDialReport.model','VoiceAgentReport','../api/voiceAgentReport/voiceAgentReport.model','MemberReport','Trunk','../api/trunk/trunk.model','VoiceTransferReport','../api/voiceTransferReport/voiceTransferReport.model','UserVoiceQueueRt','../api/userVoiceQueueRt/userVoiceQueueRt.model','UserVoiceQueue','../api/userVoiceQueue/userVoiceQueue.model','UserChatQueue','../api/userChatQueue/userChatQueue.model','UserMailQueue','../api/userMailQueue/userMailQueue.model','UserFaxQueue','UserSmsQueue','../api/userSmsQueue/userSmsQueue.model','../api/userOpenchannelQueue/userOpenchannelQueue.model','MailServerIn','MailServerOut','../api/mailServerOut/mailServerOut.model','../api/mailAccount/mailAccount.model','MailQueue','../api/mailQueue/mailQueue.model','MailSubstatus','MailInteraction','../api/mailMessage/mailMessage.model','MailApplication','../api/mailApplication/mailApplication.model','MailQueueReport','../api/mailQueueReport/mailQueueReport.model','Dashboard','../api/dashboard/dashboard.model','FaxAccount','../api/faxAccount/faxAccount.model','FaxApplication','../api/faxApplication/faxApplication.model','FaxInteraction','FaxQueue','FaxQueueReport','../api/faxQueueReport/faxQueueReport.model','SmsAccount','../api/smsAccount/smsAccount.model','../api/smsApplication/smsApplication.model','SmsInteraction','../api/smsInteraction/smsInteraction.model','SmsMessage','../api/smsMessage/smsMessage.model','OpenchannelAccount','../api/openchannelAccount/openchannelAccount.model','../api/openchannelApplication/openchannelApplication.model','OpenchannelMessage','../api/openchannelMessage/openchannelMessage.model','../api/openchannelQueue/openchannelQueue.model','ChatWebsite','OpenchannelQueueReport','../api/openchannelQueueReport/openchannelQueueReport.model'];(function(_0x2cd998,_0x51f62d){var _0x23bde2=function(_0x95fd24){while(--_0x95fd24){_0x2cd998['push'](_0x2cd998['shift']());}};_0x23bde2(++_0x51f62d);}(_0xf544,0x179));var _0x4f54=function(_0x17406a,_0x1e2320){_0x17406a=_0x17406a-0x0;var _0x1501ff=_0xf544[_0x17406a];return _0x1501ff;};'use strict';var path=require(_0x4f54('0x0'));var config=require('../config/environment');var Sequelize=require(_0x4f54('0x1'));var _=require(_0x4f54('0x2'));var jstz=require(_0x4f54('0x3'));var timezone=jstz['determine']();config['sequelize']=_['defaultsDeep'](config['sequelize'],{'database':_0x4f54('0x4'),'username':_0x4f54('0x5'),'password':_0x4f54('0x6'),'options':{'host':_0x4f54('0x7'),'port':0xcea,'dialect':_0x4f54('0x8'),'dialectOptions':{'charset':_0x4f54('0x9')},'logging':![],'timezone':timezone[_0x4f54('0xa')](),'define':{'charset':_0x4f54('0xb'),'collate':_0x4f54('0xc')}}});config[_0x4f54('0xd')]=_[_0x4f54('0xe')](config[_0x4f54('0xd')],{'database':_0x4f54('0x4'),'username':_0x4f54('0x5'),'password':_0x4f54('0x6'),'options':{'host':'127.0.0.1','port':0xcea,'dialect':_0x4f54('0x8'),'dialectOptions':{'charset':_0x4f54('0x9')},'logging':![],'timezone':timezone['name'](),'define':{'charset':'utf8','collate':_0x4f54('0xc')}}});var db={'Sequelize':Sequelize,'sequelize':new Sequelize(config['sequelize'][_0x4f54('0xf')],config[_0x4f54('0x1')][_0x4f54('0x10')],config[_0x4f54('0x1')]['password'],config[_0x4f54('0x1')]['options'])};var dbH={'Sequelize':Sequelize,'sequelize':new Sequelize(config[_0x4f54('0xd')]['database'],config[_0x4f54('0xd')][_0x4f54('0x10')],config['sequelizeHistory'][_0x4f54('0x11')],config[_0x4f54('0xd')][_0x4f54('0x12')])};db[_0x4f54('0x13')]=db[_0x4f54('0x1')][_0x4f54('0x14')](_0x4f54('0x15'));db[_0x4f54('0x16')]=db[_0x4f54('0x1')][_0x4f54('0x14')](_0x4f54('0x17'));db['VoiceContext']=db['sequelize'][_0x4f54('0x14')](_0x4f54('0x18'));db['VoiceExtension']=db[_0x4f54('0x1')][_0x4f54('0x14')](_0x4f54('0x19'));db[_0x4f54('0x1a')]=db[_0x4f54('0x1')][_0x4f54('0x14')](_0x4f54('0x1b'));db[_0x4f54('0x1c')]=db[_0x4f54('0x1')][_0x4f54('0x14')](_0x4f54('0x1d'));db['VoiceRecording']=db['sequelize'][_0x4f54('0x14')](_0x4f54('0x1e'));db[_0x4f54('0x1f')]=db[_0x4f54('0x1')]['import']('../api/screenRecording/screenRecording.model');db[_0x4f54('0x20')]=db[_0x4f54('0x1')][_0x4f54('0x14')]('../api/voiceMail/voiceMail.model');db['VoiceMailMessage']=db['sequelize'][_0x4f54('0x14')](_0x4f54('0x21'));db['VoiceCallReport']=db[_0x4f54('0x1')][_0x4f54('0x14')](_0x4f54('0x22'));db['VoiceDialReport']=db[_0x4f54('0x1')][_0x4f54('0x14')](_0x4f54('0x23'));db[_0x4f54('0x24')]=db[_0x4f54('0x1')][_0x4f54('0x14')](_0x4f54('0x25'));db['VoiceQueueReport']=db['sequelize'][_0x4f54('0x14')]('../api/voiceQueueReport/voiceQueueReport.model');db[_0x4f54('0x26')]=db[_0x4f54('0x1')][_0x4f54('0x14')]('../api/memberReport/memberReport.model');db[_0x4f54('0x27')]=db[_0x4f54('0x1')][_0x4f54('0x14')](_0x4f54('0x28'));db[_0x4f54('0x29')]=db['sequelize'][_0x4f54('0x14')](_0x4f54('0x2a'));db[_0x4f54('0x2b')]=db[_0x4f54('0x1')][_0x4f54('0x14')](_0x4f54('0x2c'));db[_0x4f54('0x2d')]=db[_0x4f54('0x1')][_0x4f54('0x14')](_0x4f54('0x2e'));db[_0x4f54('0x2f')]=db['sequelize'][_0x4f54('0x14')](_0x4f54('0x30'));db[_0x4f54('0x31')]=db[_0x4f54('0x1')][_0x4f54('0x14')](_0x4f54('0x32'));db[_0x4f54('0x33')]=db[_0x4f54('0x1')][_0x4f54('0x14')]('../api/userFaxQueue/userFaxQueue.model');db[_0x4f54('0x34')]=db[_0x4f54('0x1')][_0x4f54('0x14')](_0x4f54('0x35'));db['UserOpenchannelQueue']=db[_0x4f54('0x1')][_0x4f54('0x14')](_0x4f54('0x36'));db[_0x4f54('0x37')]=db[_0x4f54('0x1')][_0x4f54('0x14')]('../api/mailServerIn/mailServerIn.model');db[_0x4f54('0x38')]=db['sequelize'][_0x4f54('0x14')](_0x4f54('0x39'));db['MailAccount']=db['sequelize']['import'](_0x4f54('0x3a'));db[_0x4f54('0x3b')]=db[_0x4f54('0x1')]['import'](_0x4f54('0x3c'));db[_0x4f54('0x3d')]=db['sequelize'][_0x4f54('0x14')]('../api/mailSubstatus/mailSubstatus.model');db[_0x4f54('0x3e')]=db[_0x4f54('0x1')][_0x4f54('0x14')]('../api/mailInteraction/mailInteraction.model');db['MailMessage']=db[_0x4f54('0x1')][_0x4f54('0x14')](_0x4f54('0x3f'));db[_0x4f54('0x40')]=db['sequelize'][_0x4f54('0x14')](_0x4f54('0x41'));db[_0x4f54('0x42')]=db[_0x4f54('0x1')][_0x4f54('0x14')](_0x4f54('0x43'));db[_0x4f54('0x44')]=db[_0x4f54('0x1')][_0x4f54('0x14')](_0x4f54('0x45'));db['DashboardItem']=db[_0x4f54('0x1')][_0x4f54('0x14')]('../api/dashboardItem/dashboardItem.model');db[_0x4f54('0x46')]=db[_0x4f54('0x1')][_0x4f54('0x14')](_0x4f54('0x47'));db[_0x4f54('0x48')]=db['sequelize'][_0x4f54('0x14')](_0x4f54('0x49'));db[_0x4f54('0x4a')]=db[_0x4f54('0x1')][_0x4f54('0x14')]('../api/faxInteraction/faxInteraction.model');db['FaxMessage']=db['sequelize']['import']('../api/faxMessage/faxMessage.model');db[_0x4f54('0x4b')]=db[_0x4f54('0x1')][_0x4f54('0x14')]('../api/faxQueue/faxQueue.model');db[_0x4f54('0x4c')]=db[_0x4f54('0x1')][_0x4f54('0x14')](_0x4f54('0x4d'));db[_0x4f54('0x4e')]=db[_0x4f54('0x1')]['import'](_0x4f54('0x4f'));db['SmsApplication']=db[_0x4f54('0x1')]['import'](_0x4f54('0x50'));db[_0x4f54('0x51')]=db[_0x4f54('0x1')][_0x4f54('0x14')](_0x4f54('0x52'));db[_0x4f54('0x53')]=db[_0x4f54('0x1')][_0x4f54('0x14')](_0x4f54('0x54'));db['SmsQueue']=db[_0x4f54('0x1')][_0x4f54('0x14')]('../api/smsQueue/smsQueue.model');db[_0x4f54('0x55')]=db[_0x4f54('0x1')][_0x4f54('0x14')](_0x4f54('0x56'));db['OpenchannelApplication']=db[_0x4f54('0x1')][_0x4f54('0x14')](_0x4f54('0x57'));db['OpenchannelInteraction']=db['sequelize'][_0x4f54('0x14')]('../api/openchannelInteraction/openchannelInteraction.model');db[_0x4f54('0x58')]=db[_0x4f54('0x1')]['import'](_0x4f54('0x59'));db['OpenchannelQueue']=db[_0x4f54('0x1')][_0x4f54('0x14')](_0x4f54('0x5a'));db[_0x4f54('0x5b')]=db['sequelize'][_0x4f54('0x14')]('../api/chatWebsite/chatWebsite.model');db[_0x4f54('0x5c')]=db[_0x4f54('0x1')]['import'](_0x4f54('0x5d'));db[_0x4f54('0x5e')]=db[_0x4f54('0x1')][_0x4f54('0x14')](_0x4f54('0x5f'));db[_0x4f54('0x60')]=db[_0x4f54('0x1')][_0x4f54('0x14')](_0x4f54('0x61'));db[_0x4f54('0x62')]=db[_0x4f54('0x1')]['import']('../api/chatMessage/chatMessage.model');db[_0x4f54('0x63')]=db[_0x4f54('0x1')][_0x4f54('0x14')](_0x4f54('0x64'));db['ChatQueue']=db[_0x4f54('0x1')][_0x4f54('0x14')](_0x4f54('0x65'));db['ChatGroup']=db[_0x4f54('0x1')][_0x4f54('0x14')](_0x4f54('0x66'));db[_0x4f54('0x67')]=db[_0x4f54('0x1')][_0x4f54('0x14')](_0x4f54('0x68'));db[_0x4f54('0x69')]=db['sequelize'][_0x4f54('0x14')](_0x4f54('0x6a'));db['CmContact']=db[_0x4f54('0x1')][_0x4f54('0x14')](_0x4f54('0x6b'));db[_0x4f54('0x6c')]=db['sequelize'][_0x4f54('0x14')]('../api/cmHopper/cmHopper.model');db[_0x4f54('0x6d')]=db[_0x4f54('0x1')][_0x4f54('0x14')](_0x4f54('0x6e'));db[_0x4f54('0x6f')]=db[_0x4f54('0x1')][_0x4f54('0x14')](_0x4f54('0x70'));db[_0x4f54('0x71')]=db['sequelize'][_0x4f54('0x14')]('../api/cmHopperHistory/cmHopperHistory.model');db[_0x4f54('0x72')]=db[_0x4f54('0x1')][_0x4f54('0x14')](_0x4f54('0x73'));db[_0x4f54('0x74')]=db['sequelize'][_0x4f54('0x14')](_0x4f54('0x75'));db[_0x4f54('0x76')]=db[_0x4f54('0x1')]['import'](_0x4f54('0x77'));db[_0x4f54('0x78')]=db[_0x4f54('0x1')][_0x4f54('0x14')](_0x4f54('0x79'));db[_0x4f54('0x7a')]=db[_0x4f54('0x1')]['import'](_0x4f54('0x7b'));db[_0x4f54('0x7c')]=db['sequelize'][_0x4f54('0x14')]('../api/disposition/disposition.model');db[_0x4f54('0x7d')]=db[_0x4f54('0x1')]['import'](_0x4f54('0x7e'));db[_0x4f54('0x7f')]=db[_0x4f54('0x1')]['import'](_0x4f54('0x80'));db['Pause']=db[_0x4f54('0x1')][_0x4f54('0x14')]('../api/pause/pause.model');db[_0x4f54('0x81')]=db[_0x4f54('0x1')][_0x4f54('0x14')](_0x4f54('0x82'));db[_0x4f54('0x83')]=db[_0x4f54('0x1')][_0x4f54('0x14')](_0x4f54('0x84'));db[_0x4f54('0x85')]=db[_0x4f54('0x1')][_0x4f54('0x14')](_0x4f54('0x86'));db['Sound']=db[_0x4f54('0x1')][_0x4f54('0x14')](_0x4f54('0x87'));db[_0x4f54('0x88')]=db[_0x4f54('0x1')][_0x4f54('0x14')](_0x4f54('0x89'));db['Template']=db[_0x4f54('0x1')][_0x4f54('0x14')](_0x4f54('0x8a'));db[_0x4f54('0x8b')]=db[_0x4f54('0x1')][_0x4f54('0x14')]('../api/trigger/trigger.model');db[_0x4f54('0x8c')]=db['sequelize'][_0x4f54('0x14')]('../api/variable/variable.model');db[_0x4f54('0x8d')]=db['sequelize']['import']('../api/integration/integration.model');db[_0x4f54('0x8e')]=db[_0x4f54('0x1')][_0x4f54('0x14')](_0x4f54('0x8f'));db[_0x4f54('0x90')]=db['sequelize'][_0x4f54('0x14')](_0x4f54('0x91'));db[_0x4f54('0x92')]=db[_0x4f54('0x1')][_0x4f54('0x14')](_0x4f54('0x93'));db[_0x4f54('0x94')]=db['sequelize'][_0x4f54('0x14')](_0x4f54('0x95'));db['AnalyticMetric']=db['sequelize'][_0x4f54('0x14')]('../api/analyticMetric/analyticMetric.model');db['AnalyticFieldReport']=db[_0x4f54('0x1')][_0x4f54('0x14')](_0x4f54('0x96'));db[_0x4f54('0x97')]=db['sequelize'][_0x4f54('0x14')](_0x4f54('0x98'));db[_0x4f54('0x99')]=db[_0x4f54('0x1')]['import'](_0x4f54('0x9a'));db[_0x4f54('0x9b')]=db['sequelize'][_0x4f54('0x14')](_0x4f54('0x9c'));db[_0x4f54('0x9d')]=db[_0x4f54('0x1')][_0x4f54('0x14')](_0x4f54('0x9e'));db[_0x4f54('0x9f')]=db[_0x4f54('0x1')][_0x4f54('0x14')]('../api/intSugarcrmAccount/intSugarcrmAccount.model');db['SugarcrmConfiguration']=db[_0x4f54('0x1')][_0x4f54('0x14')](_0x4f54('0xa0'));db[_0x4f54('0xa1')]=db[_0x4f54('0x1')][_0x4f54('0x14')](_0x4f54('0xa2'));db[_0x4f54('0xa3')]=db[_0x4f54('0x1')][_0x4f54('0x14')](_0x4f54('0xa4'));db['DeskConfiguration']=db['sequelize']['import']('../api/intDeskConfiguration/intDeskConfiguration.model');db[_0x4f54('0xa5')]=db[_0x4f54('0x1')]['import'](_0x4f54('0xa6'));db['ZohoAccount']=db[_0x4f54('0x1')]['import']('../api/intZohoAccount/intZohoAccount.model');db[_0x4f54('0xa7')]=db[_0x4f54('0x1')][_0x4f54('0x14')]('../api/intZohoConfiguration/intZohoConfiguration.model');db['ZohoField']=db['sequelize'][_0x4f54('0x14')](_0x4f54('0xa8'));db[_0x4f54('0xa9')]=db['sequelize'][_0x4f54('0x14')](_0x4f54('0xaa'));db[_0x4f54('0xab')]=db[_0x4f54('0x1')][_0x4f54('0x14')](_0x4f54('0xac'));db[_0x4f54('0xad')]=db[_0x4f54('0x1')][_0x4f54('0x14')](_0x4f54('0xae'));db[_0x4f54('0xaf')]=db[_0x4f54('0x1')]['import'](_0x4f54('0xb0'));db[_0x4f54('0xb1')]=db[_0x4f54('0x1')][_0x4f54('0x14')](_0x4f54('0xb2'));db['FreshdeskField']=db[_0x4f54('0x1')][_0x4f54('0x14')](_0x4f54('0xb3'));db['VtigerAccount']=db[_0x4f54('0x1')][_0x4f54('0x14')](_0x4f54('0xb4'));db[_0x4f54('0xb5')]=db[_0x4f54('0x1')][_0x4f54('0x14')]('../api/intVtigerConfiguration/intVtigerConfiguration.model');db['VtigerField']=db[_0x4f54('0x1')][_0x4f54('0x14')]('../api/intVtigerField/intVtigerField.model');db[_0x4f54('0xb6')]=db['sequelize'][_0x4f54('0x14')](_0x4f54('0xb7'));db[_0x4f54('0xb8')]=db[_0x4f54('0x1')]['import']('../api/intServicenowConfiguration/intServicenowConfiguration.model');db[_0x4f54('0xb9')]=db[_0x4f54('0x1')][_0x4f54('0x14')](_0x4f54('0xba'));db[_0x4f54('0xbb')]=db[_0x4f54('0x1')][_0x4f54('0x14')](_0x4f54('0xbc'));db['Dynamics365Configuration']=db[_0x4f54('0x1')]['import'](_0x4f54('0xbd'));db['Dynamics365Field']=db['sequelize'][_0x4f54('0x14')](_0x4f54('0xbe'));db[_0x4f54('0xbf')]=db[_0x4f54('0x1')][_0x4f54('0x14')](_0x4f54('0xc0'));db[_0x4f54('0xc1')]=db[_0x4f54('0x1')]['import']('../api/intFreshsalesConfiguration/intFreshsalesConfiguration.model');db['FreshsalesField']=db[_0x4f54('0x1')]['import'](_0x4f54('0xc2'));db[_0x4f54('0x8d')]=db[_0x4f54('0x1')]['import']('../api/integration/integration.model');db[_0x4f54('0xc3')]=db[_0x4f54('0x1')]['import'](_0x4f54('0xc4'));db[_0x4f54('0xc5')]=db[_0x4f54('0x1')][_0x4f54('0x14')](_0x4f54('0xc6'));db[_0x4f54('0xc7')]=db['sequelize'][_0x4f54('0x14')](_0x4f54('0xc8'));db[_0x4f54('0xc9')]=db[_0x4f54('0x1')][_0x4f54('0x14')](_0x4f54('0xca'));db[_0x4f54('0xcb')]=db[_0x4f54('0x1')][_0x4f54('0x14')](_0x4f54('0xcc'));db['JscriptySessionReport']=db['sequelize'][_0x4f54('0x14')](_0x4f54('0xcd'));db['SmsQueueReport']=db[_0x4f54('0x1')][_0x4f54('0x14')](_0x4f54('0xce'));db[_0x4f54('0xcf')]=db[_0x4f54('0x1')][_0x4f54('0x14')](_0x4f54('0xd0'));db['SquareDetailsReport']=db['sequelize'][_0x4f54('0x14')](_0x4f54('0xd1'));db[_0x4f54('0xd2')]=db[_0x4f54('0x1')][_0x4f54('0x14')](_0x4f54('0xd3'));db[_0x4f54('0xd4')]=db[_0x4f54('0x1')]['import'](_0x4f54('0xd5'));db[_0x4f54('0xd6')]=db['sequelize'][_0x4f54('0x14')](_0x4f54('0xd7'));db[_0x4f54('0xd8')]=db[_0x4f54('0x1')]['import'](_0x4f54('0xd9'));db[_0x4f54('0xda')]=db['sequelize']['import'](_0x4f54('0xdb'));db[_0x4f54('0xdc')]=db['sequelize']['import'](_0x4f54('0xdd'));db[_0x4f54('0xde')]=db['sequelize']['import']('../api/team/team.model');db[_0x4f54('0xdf')]=db[_0x4f54('0x1')][_0x4f54('0x14')](_0x4f54('0xe0'));db['Campaign']=db[_0x4f54('0x1')]['import'](_0x4f54('0xe1'));db[_0x4f54('0xe2')]=db[_0x4f54('0x1')][_0x4f54('0x14')](_0x4f54('0xe3'));db['Attachment']=db[_0x4f54('0x1')]['import'](_0x4f54('0xe4'));db['Plugin']=db[_0x4f54('0x1')]['import'](_0x4f54('0xe5'));db['MailTransferReport']=db['sequelize'][_0x4f54('0x14')](_0x4f54('0xe6'));db['ChatTransferReport']=db[_0x4f54('0x1')][_0x4f54('0x14')](_0x4f54('0xe7'));db[_0x4f54('0xe8')]=db['sequelize']['import'](_0x4f54('0xe9'));db[_0x4f54('0xea')]=db[_0x4f54('0x1')][_0x4f54('0x14')](_0x4f54('0xeb'));db[_0x4f54('0xec')]=db[_0x4f54('0x1')]['import']('../api/smsTransferReport/smsTransferReport.model');db[_0x4f54('0xed')]=db[_0x4f54('0x1')]['import']('../api/cmList/cmList.model');db[_0x4f54('0xee')]=db[_0x4f54('0x1')]['import'](_0x4f54('0xef'));db[_0x4f54('0xf0')]=db[_0x4f54('0x1')][_0x4f54('0x14')](_0x4f54('0xf1'));db[_0x4f54('0xf2')]=db[_0x4f54('0x1')][_0x4f54('0x14')](_0x4f54('0xf3'));db['UserProfileResource']=db[_0x4f54('0x1')]['import'](_0x4f54('0xf4'));db['User'][_0x4f54('0xf5')](db['VoiceMail'],{'as':_0x4f54('0x20'),'onDelete':_0x4f54('0xf6'),'foreignKey':'UserId'});db['User'][_0x4f54('0xf7')](db['VoiceRecording'],{'as':_0x4f54('0xf8'),'foreignKey':_0x4f54('0xf9')});db[_0x4f54('0x13')]['hasMany'](db[_0x4f54('0x2b')],{'as':'VoiceQueuesRt','foreignKey':'UserId'});db[_0x4f54('0x13')][_0x4f54('0xf7')](db[_0x4f54('0xfa')],{'as':'Extensions','onDelete':'cascade','hooks':!![]});db['User'][_0x4f54('0xf7')](db[_0x4f54('0x6f')],{'as':_0x4f54('0xfb'),'foreignKey':_0x4f54('0xf9')});db[_0x4f54('0x13')][_0x4f54('0xf7')](db[_0x4f54('0x71')],{'as':_0x4f54('0xfc'),'foreignKey':_0x4f54('0xf9')});db[_0x4f54('0x13')][_0x4f54('0xf7')](db['ReportAgentPreview'],{'as':'ReportAgentPreview','foreignKey':_0x4f54('0xf9')});db['User'][_0x4f54('0xf7')](db[_0x4f54('0xfd')],{'as':'OpenchannelInteractions','foreignKey':_0x4f54('0xf9')});db[_0x4f54('0x13')][_0x4f54('0xf7')](db['ChatInteraction'],{'as':_0x4f54('0xfe'),'foreignKey':'UserId'});db[_0x4f54('0x13')][_0x4f54('0xf7')](db[_0x4f54('0x51')],{'as':_0x4f54('0xff'),'foreignKey':_0x4f54('0xf9')});db[_0x4f54('0x13')][_0x4f54('0xf7')](db[_0x4f54('0x4a')],{'as':_0x4f54('0x100'),'foreignKey':'UserId'});db[_0x4f54('0x13')][_0x4f54('0xf7')](db[_0x4f54('0x3e')],{'as':'MailInteractions','foreignKey':_0x4f54('0xf9')});db['User']['belongsTo'](db[_0x4f54('0xf0')],{'as':_0x4f54('0xf0'),'foreignKey':'userProfileId'});db['User'][_0x4f54('0x101')](db[_0x4f54('0x102')],{'as':_0x4f54('0x103'),'through':'chat_group_has_users'});db[_0x4f54('0x13')][_0x4f54('0x101')](db[_0x4f54('0x104')],{'as':'Contacts','through':_0x4f54('0x105')});db[_0x4f54('0x13')]['belongsToMany'](db[_0x4f54('0xed')],{'as':_0x4f54('0x106'),'through':_0x4f54('0x107')});db['User']['belongsToMany'](db[_0x4f54('0xde')],{'through':_0x4f54('0x108')});db[_0x4f54('0x13')]['belongsToMany'](db[_0x4f54('0x3e')],{'as':_0x4f54('0x109'),'through':_0x4f54('0x10a')});db['User'][_0x4f54('0x101')](db[_0x4f54('0x60')],{'as':'ChatInteractions','through':'user_has_chat_interactions'});db[_0x4f54('0x13')][_0x4f54('0x101')](db['FaxInteraction'],{'as':'FaxInteractions','through':_0x4f54('0x10b')});db[_0x4f54('0x13')][_0x4f54('0x101')](db[_0x4f54('0x51')],{'as':_0x4f54('0xff'),'through':_0x4f54('0x10c')});db[_0x4f54('0x13')][_0x4f54('0x101')](db[_0x4f54('0xfd')],{'as':_0x4f54('0x10d'),'through':_0x4f54('0x10e')});db[_0x4f54('0x13')][_0x4f54('0x101')](db[_0x4f54('0x1c')],{'as':_0x4f54('0x10f'),'through':_0x4f54('0x2d'),'required':![]});db[_0x4f54('0x13')][_0x4f54('0x101')](db[_0x4f54('0x3b')],{'as':_0x4f54('0x110'),'through':_0x4f54('0x31'),'required':![]});db[_0x4f54('0x13')]['belongsToMany'](db[_0x4f54('0x111')],{'as':_0x4f54('0x112'),'through':'UserChatQueue','required':![],'hooks':!![]});db['User'][_0x4f54('0x101')](db[_0x4f54('0x4b')],{'as':'FaxQueues','through':_0x4f54('0x33'),'required':![]});db['User']['belongsToMany'](db[_0x4f54('0x113')],{'as':_0x4f54('0x114'),'through':_0x4f54('0x34'),'required':![]});db[_0x4f54('0x13')]['belongsToMany'](db[_0x4f54('0x115')],{'as':'OpenchannelQueues','through':_0x4f54('0x116'),'required':![]});db['User'][_0x4f54('0x101')](db[_0x4f54('0xed')],{'through':_0x4f54('0x107')});db['User'][_0x4f54('0x101')](db['VoicePrefix'],{'as':'VoicePrefixes','through':'user_has_voice_prefixes','required':![]});db['User']['belongsToMany'](db[_0x4f54('0x5b')],{'as':_0x4f54('0x117'),'through':_0x4f54('0x118')});db[_0x4f54('0x13')]['belongsToMany'](db['FaxAccount'],{'as':_0x4f54('0x119'),'through':_0x4f54('0x11a')});db[_0x4f54('0x13')][_0x4f54('0x101')](db['MailAccount'],{'as':'MailAccounts','through':_0x4f54('0x11b')});db[_0x4f54('0x13')]['belongsToMany'](db[_0x4f54('0x55')],{'as':_0x4f54('0x11c'),'through':_0x4f54('0x11d')});db['User'][_0x4f54('0x101')](db[_0x4f54('0x4e')],{'as':_0x4f54('0x11e'),'through':'user_has_sms_accounts'});db[_0x4f54('0x13')][_0x4f54('0x101')](db[_0x4f54('0xd8')],{'as':_0x4f54('0x11f'),'through':_0x4f54('0x120')});db[_0x4f54('0x16')][_0x4f54('0xf7')](db[_0x4f54('0xfa')],{'as':_0x4f54('0x121'),'onDelete':_0x4f54('0xf6'),'foreignKey':_0x4f54('0x122')});db['VoiceContext'][_0x4f54('0xf7')](db[_0x4f54('0xfa')],{'onDelete':_0x4f54('0xf6')});db[_0x4f54('0xfa')][_0x4f54('0xf7')](db[_0x4f54('0xfa')],{'as':_0x4f54('0x123'),'onDelete':_0x4f54('0xf6')});db[_0x4f54('0x1a')][_0x4f54('0x101')](db[_0x4f54('0x124')],{'as':_0x4f54('0x125'),'through':_0x4f54('0x126')});db[_0x4f54('0x1c')][_0x4f54('0xf7')](db[_0x4f54('0x2b')],{'as':_0x4f54('0x127'),'foreignKey':_0x4f54('0x128')});db['VoiceQueue'][_0x4f54('0xf7')](db['CmHopper'],{'as':_0x4f54('0x129'),'foreignKey':_0x4f54('0x128')});db[_0x4f54('0x1c')]['hasMany'](db[_0x4f54('0x6f')],{'as':_0x4f54('0xfb'),'foreignKey':_0x4f54('0x128')});db[_0x4f54('0x1c')][_0x4f54('0xf7')](db[_0x4f54('0x71')],{'as':_0x4f54('0x12a'),'foreignKey':'VoiceQueueId'});db[_0x4f54('0x1c')][_0x4f54('0xf7')](db[_0x4f54('0x72')],{'as':_0x4f54('0x72'),'foreignKey':_0x4f54('0x128')});db[_0x4f54('0x1c')][_0x4f54('0xf7')](db[_0x4f54('0x6d')],{'as':_0x4f54('0x12b'),'foreignKey':'VoiceQueueId'});db[_0x4f54('0x1c')]['hasMany'](db[_0x4f54('0x12c')],{'as':_0x4f54('0x12d'),'foreignKey':_0x4f54('0x128')});db[_0x4f54('0x1c')][_0x4f54('0x12e')](db[_0x4f54('0x27')],{'as':_0x4f54('0x27'),'foreignKey':_0x4f54('0x12f')});db[_0x4f54('0x1c')][_0x4f54('0x12e')](db[_0x4f54('0x27')],{'as':'TrunkBackup','foreignKey':_0x4f54('0x130')});db[_0x4f54('0x1c')][_0x4f54('0x12e')](db[_0x4f54('0x7f')],{'as':_0x4f54('0x7f'),'foreignKey':_0x4f54('0x131')});db[_0x4f54('0x1c')][_0x4f54('0x12e')](db[_0x4f54('0x132')],{'as':_0x4f54('0x133'),'foreignKey':'mandatoryDispositionPauseId'});db[_0x4f54('0x1c')][_0x4f54('0x101')](db[_0x4f54('0xed')],{'as':_0x4f54('0x106'),'through':'voice_queues_has_cm_lists'});db[_0x4f54('0x1c')][_0x4f54('0x101')](db[_0x4f54('0x13')],{'as':_0x4f54('0x134'),'through':_0x4f54('0x2d')});db['VoiceQueue'][_0x4f54('0x101')](db[_0x4f54('0xde')],{'as':_0x4f54('0x135'),'through':'team_has_voice_queues'});db[_0x4f54('0x1c')][_0x4f54('0x101')](db[_0x4f54('0xed')],{'as':'BlackLists','through':_0x4f54('0x136')});db[_0x4f54('0x137')][_0x4f54('0x12e')](db[_0x4f54('0x13')],{'as':_0x4f54('0x13'),'foreignKey':'UserId'});db['ScreenRecording'][_0x4f54('0x12e')](db['User'],{'as':_0x4f54('0x13'),'foreignKey':'UserId'});db[_0x4f54('0x20')][_0x4f54('0xf7')](db['VoiceMailMessage'],{'as':_0x4f54('0x138'),'onDelete':'cascade','foreignKey':_0x4f54('0x139'),'sourceKey':'mailbox'});db[_0x4f54('0x13a')][_0x4f54('0x12e')](db[_0x4f54('0x20')],{'foreignKey':_0x4f54('0x139'),'targetKey':'mailbox'});db[_0x4f54('0x13b')][_0x4f54('0xf7')](db[_0x4f54('0x13c')],{'as':_0x4f54('0x13d'),'foreignKey':_0x4f54('0x13e'),'constraints':![]});db[_0x4f54('0x13b')][_0x4f54('0xf7')](db[_0x4f54('0x24')],{'as':_0x4f54('0x13f'),'foreignKey':_0x4f54('0x13e'),'constraints':![]});db['VoiceCallReport'][_0x4f54('0x12e')](db['User'],{'as':'User','foreignKey':_0x4f54('0xf9')});db[_0x4f54('0x13b')]['belongsTo'](db['CmContact'],{'as':_0x4f54('0x140'),'foreignKey':_0x4f54('0x141')});db[_0x4f54('0x37')]['belongsTo'](db['MailAccount'],{'as':'MailAccount','foreignKey':'MailAccountId'});db[_0x4f54('0x38')]['belongsTo'](db[_0x4f54('0x142')],{'as':'MailAccount','foreignKey':_0x4f54('0x143')});db[_0x4f54('0x142')][_0x4f54('0xf5')](db[_0x4f54('0x37')],{'as':'Imap','onDelete':_0x4f54('0xf6')});db[_0x4f54('0x142')]['hasOne'](db[_0x4f54('0x38')],{'as':_0x4f54('0x144'),'onDelete':_0x4f54('0xf6')});db[_0x4f54('0x142')][_0x4f54('0xf7')](db[_0x4f54('0x7c')],{'as':_0x4f54('0x145'),'foreignKey':_0x4f54('0x143')});db[_0x4f54('0x142')][_0x4f54('0xf7')](db['CannedAnswer'],{'as':_0x4f54('0x146'),'foreignKey':_0x4f54('0x143')});db['MailAccount'][_0x4f54('0xf7')](db[_0x4f54('0x147')],{'as':_0x4f54('0x138'),'foreignKey':_0x4f54('0x143')});db['MailAccount'][_0x4f54('0xf7')](db[_0x4f54('0x3e')],{'as':'Interactions'});db['MailAccount']['hasMany'](db[_0x4f54('0x40')],{'as':_0x4f54('0x123')});db[_0x4f54('0x142')][_0x4f54('0x12e')](db[_0x4f54('0xed')],{'as':_0x4f54('0x148'),'foreignKey':'ListId'});db[_0x4f54('0x142')][_0x4f54('0x12e')](db[_0x4f54('0x149')],{'as':_0x4f54('0x149'),'foreignKey':'TemplateId'});db[_0x4f54('0x142')][_0x4f54('0x12e')](db[_0x4f54('0x132')],{'as':_0x4f54('0x133'),'foreignKey':'mandatoryDispositionPauseId'});db[_0x4f54('0x142')]['belongsToMany'](db['User'],{'as':'Agents','through':'user_has_mail_accounts'});db['MailQueue'][_0x4f54('0x101')](db[_0x4f54('0x13')],{'as':_0x4f54('0x134'),'through':_0x4f54('0x31')});db['MailQueue'][_0x4f54('0x101')](db['Team'],{'through':_0x4f54('0x14a'),'as':_0x4f54('0x135')});db[_0x4f54('0x3e')][_0x4f54('0xf7')](db[_0x4f54('0x147')],{'as':_0x4f54('0x138'),'onDelete':_0x4f54('0xf6'),'foreignKey':_0x4f54('0x14b')});db[_0x4f54('0x3e')][_0x4f54('0x12e')](db[_0x4f54('0x142')],{'as':_0x4f54('0x14c'),'foreignKey':_0x4f54('0x143')});db[_0x4f54('0x3e')]['belongsTo'](db['CmContact'],{'as':'Contact','foreignKey':'ContactId'});db['MailInteraction'][_0x4f54('0x12e')](db[_0x4f54('0x13')],{'as':_0x4f54('0x14d'),'foreignKey':_0x4f54('0xf9')});db[_0x4f54('0x3e')][_0x4f54('0x101')](db['Tag'],{'through':_0x4f54('0x14e'),'as':'Tags'});db[_0x4f54('0x3e')][_0x4f54('0x101')](db[_0x4f54('0x88')],{'through':_0x4f54('0x14e'),'as':'ThroughTags'});db['MailInteraction'][_0x4f54('0x101')](db[_0x4f54('0x13')],{'as':_0x4f54('0x14f'),'through':_0x4f54('0x10a'),'foreignKey':_0x4f54('0x14b')});db[_0x4f54('0x147')]['hasMany'](db[_0x4f54('0x150')],{'as':_0x4f54('0x151'),'onDelete':_0x4f54('0xf6')});db['MailMessage'][_0x4f54('0x12e')](db[_0x4f54('0x13')],{'as':'User'});db['MailMessage']['belongsTo'](db[_0x4f54('0x104')],{'onDelete':_0x4f54('0xf6'),'as':_0x4f54('0x140')});db['MailMessage']['belongsTo'](db['MailInteraction'],{'as':'Interaction','foreignKey':_0x4f54('0x14b')});db['MailMessage'][_0x4f54('0x12e')](db[_0x4f54('0x142')],{'as':'Account','foreignKey':'MailAccountId'});db['MailApplication'][_0x4f54('0x12e')](db[_0x4f54('0x13')],{'onDelete':'restrict'});db['MailApplication'][_0x4f54('0x12e')](db[_0x4f54('0x3b')],{'onDelete':_0x4f54('0x152')});db[_0x4f54('0x40')]['belongsTo'](db[_0x4f54('0x142')],{'onDelete':'restrict'});db['MailApplication']['belongsTo'](db[_0x4f54('0x7f')],{'onDelete':_0x4f54('0x152'),'foreignKey':'IntervalId'});db[_0x4f54('0x40')][_0x4f54('0x12e')](db[_0x4f54('0x88')],{'onDelete':'restrict','foreignKey':_0x4f54('0x153')});db['MailQueueReport'][_0x4f54('0x12e')](db[_0x4f54('0x142')],{});db[_0x4f54('0x42')][_0x4f54('0x12e')](db[_0x4f54('0xed')],{'as':_0x4f54('0x148'),'foreignKey':'ListId'});db[_0x4f54('0x42')]['belongsTo'](db[_0x4f54('0x104')],{'as':'Contact','foreignKey':_0x4f54('0x141')});db[_0x4f54('0x42')][_0x4f54('0x12e')](db[_0x4f54('0x3e')],{});db['MailQueueReport'][_0x4f54('0x12e')](db['MailMessage'],{});db[_0x4f54('0x42')]['belongsTo'](db[_0x4f54('0x13')],{});db[_0x4f54('0x42')][_0x4f54('0x12e')](db[_0x4f54('0x3b')],{});db['Dashboard'][_0x4f54('0xf7')](db[_0x4f54('0x154')],{'as':_0x4f54('0x155'),'onDelete':_0x4f54('0xf6')});db[_0x4f54('0x46')]['hasMany'](db[_0x4f54('0x7c')],{'as':'Dispositions','foreignKey':_0x4f54('0x156')});db[_0x4f54('0x46')][_0x4f54('0xf7')](db[_0x4f54('0x7a')],{'as':_0x4f54('0x146'),'foreignKey':_0x4f54('0x156')});db['FaxAccount'][_0x4f54('0xf7')](db['FaxInteraction'],{'as':_0x4f54('0x157')});db[_0x4f54('0x46')][_0x4f54('0xf7')](db[_0x4f54('0x48')],{'as':'Applications'});db[_0x4f54('0x46')][_0x4f54('0xf7')](db[_0x4f54('0xfa')],{'as':_0x4f54('0x158'),'onDelete':_0x4f54('0xf6')});db['FaxAccount'][_0x4f54('0xf7')](db['FaxMessage'],{'as':_0x4f54('0x138')});db['FaxAccount'][_0x4f54('0x12e')](db[_0x4f54('0x27')],{'as':_0x4f54('0x27')});db['FaxAccount'][_0x4f54('0x12e')](db[_0x4f54('0xed')],{'as':_0x4f54('0x148'),'foreignKey':_0x4f54('0x159')});db[_0x4f54('0x46')][_0x4f54('0x12e')](db['Pause'],{'as':_0x4f54('0x133'),'foreignKey':_0x4f54('0x15a')});db[_0x4f54('0x46')][_0x4f54('0x101')](db[_0x4f54('0x13')],{'as':'Agents','through':_0x4f54('0x11a')});db[_0x4f54('0x48')][_0x4f54('0x12e')](db[_0x4f54('0x13')],{'onDelete':'restrict'});db[_0x4f54('0x48')][_0x4f54('0x12e')](db[_0x4f54('0x4b')],{'onDelete':_0x4f54('0x152')});db['FaxApplication']['belongsTo'](db['FaxAccount'],{'onDelete':_0x4f54('0x152')});db['FaxApplication'][_0x4f54('0x12e')](db[_0x4f54('0x88')],{'onDelete':_0x4f54('0x152'),'foreignKey':_0x4f54('0x153')});db['FaxInteraction']['hasMany'](db['FaxMessage'],{'as':_0x4f54('0x138'),'onDelete':_0x4f54('0xf6'),'foreignKey':_0x4f54('0x15b')});db['FaxInteraction']['belongsTo'](db[_0x4f54('0x46')],{'as':_0x4f54('0x14c'),'foreignKey':_0x4f54('0x156')});db['FaxInteraction']['belongsTo'](db[_0x4f54('0x104')],{'as':_0x4f54('0x140'),'foreignKey':_0x4f54('0x141')});db[_0x4f54('0x4a')][_0x4f54('0x12e')](db[_0x4f54('0x13')],{'as':_0x4f54('0x14d'),'foreignKey':_0x4f54('0xf9')});db[_0x4f54('0x4a')][_0x4f54('0x101')](db['Tag'],{'through':'fax_interaction_has_tags','as':_0x4f54('0x15c')});db[_0x4f54('0x4a')][_0x4f54('0x101')](db[_0x4f54('0x88')],{'through':_0x4f54('0x15d'),'as':_0x4f54('0x15e')});db[_0x4f54('0x4a')]['belongsToMany'](db[_0x4f54('0x13')],{'as':_0x4f54('0x14f'),'through':_0x4f54('0x10b'),'foreignKey':_0x4f54('0x15b')});db['FaxMessage'][_0x4f54('0x12e')](db['User'],{'onDelete':_0x4f54('0xf6'),'as':_0x4f54('0x13')});db[_0x4f54('0x15f')][_0x4f54('0x12e')](db[_0x4f54('0x4a')],{'as':_0x4f54('0x160'),'foreignKey':'FaxInteractionId'});db['FaxMessage'][_0x4f54('0x12e')](db[_0x4f54('0x104')],{'onDelete':_0x4f54('0xf6'),'as':_0x4f54('0x140')});db[_0x4f54('0x15f')][_0x4f54('0x12e')](db[_0x4f54('0x150')],{'as':_0x4f54('0x150'),'foreignKey':_0x4f54('0x161')});db['FaxMessage'][_0x4f54('0x12e')](db[_0x4f54('0x46')],{'as':_0x4f54('0x14c'),'foreignKey':_0x4f54('0x156')});db[_0x4f54('0x4b')][_0x4f54('0x101')](db[_0x4f54('0x13')],{'as':_0x4f54('0x134'),'through':_0x4f54('0x33')});db[_0x4f54('0x4b')]['belongsToMany'](db[_0x4f54('0xde')],{'through':'team_has_fax_queues','as':_0x4f54('0x135')});db[_0x4f54('0x4c')][_0x4f54('0x12e')](db[_0x4f54('0x46')],{});db[_0x4f54('0x4c')][_0x4f54('0x12e')](db[_0x4f54('0xed')],{'as':'List','foreignKey':_0x4f54('0x159')});db['FaxQueueReport'][_0x4f54('0x12e')](db[_0x4f54('0x104')],{'as':_0x4f54('0x140'),'foreignKey':_0x4f54('0x141')});db[_0x4f54('0x4c')][_0x4f54('0x12e')](db['FaxInteraction'],{});db[_0x4f54('0x4c')][_0x4f54('0x12e')](db['FaxMessage'],{});db[_0x4f54('0x4c')][_0x4f54('0x12e')](db[_0x4f54('0x13')],{});db['FaxQueueReport']['belongsTo'](db[_0x4f54('0x4b')],{});db[_0x4f54('0x4e')][_0x4f54('0xf7')](db[_0x4f54('0x7c')],{'as':_0x4f54('0x145'),'foreignKey':_0x4f54('0x162')});db[_0x4f54('0x4e')][_0x4f54('0xf7')](db[_0x4f54('0x7a')],{'as':_0x4f54('0x146'),'foreignKey':_0x4f54('0x162')});db[_0x4f54('0x4e')][_0x4f54('0xf7')](db[_0x4f54('0x53')],{'as':_0x4f54('0x138'),'foreignKey':_0x4f54('0x162')});db[_0x4f54('0x4e')][_0x4f54('0xf7')](db[_0x4f54('0x51')],{'as':_0x4f54('0x157')});db[_0x4f54('0x4e')][_0x4f54('0xf7')](db['SmsApplication'],{'as':_0x4f54('0x123')});db['SmsAccount'][_0x4f54('0x12e')](db['CmList'],{'as':_0x4f54('0x148'),'foreignKey':_0x4f54('0x159')});db[_0x4f54('0x4e')][_0x4f54('0x12e')](db[_0x4f54('0x132')],{'as':'mandatoryDispositionPause','foreignKey':_0x4f54('0x15a')});db[_0x4f54('0x4e')][_0x4f54('0x101')](db[_0x4f54('0x13')],{'as':_0x4f54('0x134'),'through':_0x4f54('0x163')});db[_0x4f54('0x164')][_0x4f54('0x12e')](db[_0x4f54('0x13')],{'onDelete':_0x4f54('0x152')});db['SmsApplication'][_0x4f54('0x12e')](db[_0x4f54('0x113')],{'onDelete':_0x4f54('0x152')});db['SmsApplication'][_0x4f54('0x12e')](db[_0x4f54('0x4e')],{'onDelete':'restrict'});db[_0x4f54('0x164')]['belongsTo'](db[_0x4f54('0x7f')],{'onDelete':_0x4f54('0x152'),'foreignKey':_0x4f54('0x131')});db['SmsApplication'][_0x4f54('0x12e')](db['Tag'],{'onDelete':_0x4f54('0x152'),'foreignKey':_0x4f54('0x153')});db[_0x4f54('0x51')]['hasMany'](db[_0x4f54('0x53')],{'as':_0x4f54('0x138'),'onDelete':_0x4f54('0xf6'),'foreignKey':_0x4f54('0x165')});db['SmsInteraction']['belongsTo'](db[_0x4f54('0x4e')],{'as':_0x4f54('0x14c'),'foreignKey':_0x4f54('0x162')});db[_0x4f54('0x51')][_0x4f54('0x12e')](db['CmContact'],{'as':'Contact','foreignKey':_0x4f54('0x141')});db[_0x4f54('0x51')][_0x4f54('0x12e')](db[_0x4f54('0x13')],{'as':_0x4f54('0x14d'),'foreignKey':_0x4f54('0xf9')});db['SmsInteraction'][_0x4f54('0x101')](db[_0x4f54('0x88')],{'through':_0x4f54('0x166'),'as':_0x4f54('0x15c')});db[_0x4f54('0x51')][_0x4f54('0x101')](db[_0x4f54('0x88')],{'through':'sms_interaction_has_tags','as':_0x4f54('0x15e')});db[_0x4f54('0x51')][_0x4f54('0x101')](db[_0x4f54('0x13')],{'as':'Users','through':_0x4f54('0x10c'),'foreignKey':_0x4f54('0x165')});db['SmsMessage'][_0x4f54('0x12e')](db[_0x4f54('0x13')],{'as':_0x4f54('0x13')});db[_0x4f54('0x53')][_0x4f54('0x12e')](db[_0x4f54('0x104')],{'onDelete':_0x4f54('0xf6'),'as':_0x4f54('0x140')});db[_0x4f54('0x53')]['belongsTo'](db[_0x4f54('0x51')],{'onDelete':'cascade','as':_0x4f54('0x160'),'foreignKey':'SmsInteractionId'});db[_0x4f54('0x53')][_0x4f54('0x12e')](db[_0x4f54('0x4e')],{'as':_0x4f54('0x14c'),'foreignKey':_0x4f54('0x162')});db[_0x4f54('0x113')][_0x4f54('0x101')](db[_0x4f54('0x13')],{'as':_0x4f54('0x134'),'through':_0x4f54('0x34'),'foreignKey':'SmsQueueId'});db[_0x4f54('0x113')][_0x4f54('0x101')](db[_0x4f54('0xde')],{'through':'team_has_sms_queues','as':_0x4f54('0x135')});db[_0x4f54('0x55')][_0x4f54('0xf7')](db[_0x4f54('0x7c')],{'as':_0x4f54('0x145'),'foreignKey':_0x4f54('0x167')});db['OpenchannelAccount'][_0x4f54('0xf7')](db[_0x4f54('0x7a')],{'as':'Answers','foreignKey':_0x4f54('0x167')});db['OpenchannelAccount']['hasMany'](db[_0x4f54('0xfd')],{'as':_0x4f54('0x157'),'foreignKey':'OpenchannelAccountId'});db[_0x4f54('0x55')]['hasMany'](db['OpenchannelMessage'],{'as':_0x4f54('0x138'),'foreignKey':_0x4f54('0x167')});db[_0x4f54('0x55')][_0x4f54('0xf7')](db[_0x4f54('0x168')],{'as':_0x4f54('0x123'),'foreignKey':'OpenchannelAccountId'});db['OpenchannelAccount'][_0x4f54('0x12e')](db['CmList'],{'as':_0x4f54('0x148'),'foreignKey':_0x4f54('0x159')});db[_0x4f54('0x55')][_0x4f54('0x12e')](db[_0x4f54('0x132')],{'as':_0x4f54('0x133'),'foreignKey':_0x4f54('0x15a')});db['OpenchannelAccount'][_0x4f54('0x101')](db['User'],{'as':'Agents','through':'user_has_openchannel_accounts'});db[_0x4f54('0x168')]['belongsTo'](db[_0x4f54('0x13')],{'onDelete':_0x4f54('0x152')});db[_0x4f54('0x168')]['belongsTo'](db[_0x4f54('0x115')],{'onDelete':_0x4f54('0x152'),'foreignKey':_0x4f54('0x169')});db['OpenchannelApplication'][_0x4f54('0x12e')](db['OpenchannelAccount'],{'onDelete':'restrict','foreignKey':_0x4f54('0x167')});db['OpenchannelApplication'][_0x4f54('0x12e')](db[_0x4f54('0x7f')],{'onDelete':'restrict','foreignKey':_0x4f54('0x131')});db[_0x4f54('0x168')][_0x4f54('0x12e')](db[_0x4f54('0x88')],{'onDelete':'restrict','foreignKey':_0x4f54('0x153')});db[_0x4f54('0xfd')][_0x4f54('0xf7')](db[_0x4f54('0x58')],{'as':_0x4f54('0x138'),'onDelete':_0x4f54('0xf6'),'foreignKey':'OpenchannelInteractionId'});db[_0x4f54('0xfd')][_0x4f54('0x12e')](db[_0x4f54('0x55')],{'as':_0x4f54('0x14c'),'foreignKey':'OpenchannelAccountId'});db['OpenchannelInteraction'][_0x4f54('0x12e')](db[_0x4f54('0x104')],{'as':_0x4f54('0x140'),'foreignKey':_0x4f54('0x141')});db['OpenchannelInteraction'][_0x4f54('0x12e')](db[_0x4f54('0x13')],{'as':_0x4f54('0x14d'),'foreignKey':_0x4f54('0xf9')});db[_0x4f54('0xfd')][_0x4f54('0x101')](db[_0x4f54('0x88')],{'through':_0x4f54('0x16a'),'as':_0x4f54('0x15c')});db[_0x4f54('0xfd')][_0x4f54('0x101')](db['Tag'],{'through':_0x4f54('0x16a'),'as':'ThroughTags'});db[_0x4f54('0xfd')][_0x4f54('0x101')](db[_0x4f54('0x13')],{'as':_0x4f54('0x14f'),'through':_0x4f54('0x10e'),'foreignKey':_0x4f54('0x16b')});db[_0x4f54('0x58')]['belongsTo'](db[_0x4f54('0x13')],{'onDelete':'cascade','as':'User'});db[_0x4f54('0x58')][_0x4f54('0x12e')](db['CmContact'],{'onDelete':_0x4f54('0xf6'),'as':_0x4f54('0x140')});db[_0x4f54('0x58')][_0x4f54('0x12e')](db[_0x4f54('0xfd')],{'onDelete':_0x4f54('0xf6'),'as':_0x4f54('0x160'),'foreignKey':_0x4f54('0x16b')});db[_0x4f54('0x58')][_0x4f54('0x12e')](db[_0x4f54('0x150')],{'as':'Attachment','foreignKey':'AttachmentId'});db['OpenchannelMessage'][_0x4f54('0x12e')](db[_0x4f54('0x55')],{'as':_0x4f54('0x14c'),'foreignKey':_0x4f54('0x167')});db['OpenchannelQueue']['belongsToMany'](db[_0x4f54('0x13')],{'as':'Agents','through':_0x4f54('0x116'),'foreignKey':_0x4f54('0x169')});db[_0x4f54('0x115')][_0x4f54('0x101')](db[_0x4f54('0xde')],{'through':_0x4f54('0x16c'),'as':_0x4f54('0x135')});db['ChatWebsite'][_0x4f54('0xf7')](db['Disposition'],{'as':_0x4f54('0x145'),'foreignKey':_0x4f54('0x16d')});db[_0x4f54('0x5b')][_0x4f54('0xf7')](db['CannedAnswer'],{'as':'Answers','foreignKey':'ChatWebsiteId'});db['ChatWebsite'][_0x4f54('0xf7')](db['ChatProactiveAction'],{'as':_0x4f54('0x16e')});db['ChatWebsite'][_0x4f54('0xf7')](db[_0x4f54('0x60')],{'as':_0x4f54('0x157')});db[_0x4f54('0x5b')][_0x4f54('0xf7')](db[_0x4f54('0x5e')],{'as':'Applications'});db[_0x4f54('0x5b')][_0x4f54('0xf7')](db[_0x4f54('0x62')],{'as':_0x4f54('0x138')});db[_0x4f54('0x5b')][_0x4f54('0x12e')](db['CmList'],{'as':_0x4f54('0x148'),'foreignKey':'ListId'});db[_0x4f54('0x5b')]['belongsTo'](db['Interval'],{'as':_0x4f54('0x7f'),'foreignKey':'IntervalId'});db[_0x4f54('0x5b')][_0x4f54('0x12e')](db[_0x4f54('0x132')],{'as':_0x4f54('0x133'),'foreignKey':_0x4f54('0x15a')});db[_0x4f54('0x5b')][_0x4f54('0x101')](db[_0x4f54('0x13')],{'as':_0x4f54('0x134'),'through':_0x4f54('0x118')});db[_0x4f54('0x5c')]['belongsTo'](db[_0x4f54('0x55')],{});db[_0x4f54('0x5c')][_0x4f54('0x12e')](db[_0x4f54('0xed')],{'as':_0x4f54('0x148'),'foreignKey':'ListId'});db['OpenchannelQueueReport'][_0x4f54('0x12e')](db[_0x4f54('0x104')],{'as':_0x4f54('0x140'),'foreignKey':_0x4f54('0x141')});db[_0x4f54('0x5c')][_0x4f54('0x12e')](db[_0x4f54('0xfd')],{});db[_0x4f54('0x5c')][_0x4f54('0x12e')](db[_0x4f54('0x58')],{});db['OpenchannelQueueReport'][_0x4f54('0x12e')](db[_0x4f54('0x13')],{});db[_0x4f54('0x5c')][_0x4f54('0x12e')](db[_0x4f54('0x115')],{});db['ChatApplication'][_0x4f54('0x12e')](db[_0x4f54('0x13')],{'as':_0x4f54('0x16f'),'foreignKey':_0x4f54('0xf9'),'onDelete':_0x4f54('0x152')});db[_0x4f54('0x5e')][_0x4f54('0x12e')](db[_0x4f54('0x111')],{'as':_0x4f54('0x170'),'foreignKey':_0x4f54('0x171'),'onDelete':_0x4f54('0x152')});db[_0x4f54('0x5e')][_0x4f54('0x12e')](db[_0x4f54('0x5b')],{'as':_0x4f54('0x172'),'foreignKey':_0x4f54('0x16d'),'onDelete':_0x4f54('0x152')});db[_0x4f54('0x5e')]['belongsTo'](db[_0x4f54('0x88')],{'onDelete':_0x4f54('0x152'),'foreignKey':_0x4f54('0x153')});db[_0x4f54('0x60')]['hasMany'](db[_0x4f54('0x62')],{'as':_0x4f54('0x138'),'onDelete':_0x4f54('0xf6'),'foreignKey':_0x4f54('0x173')});db[_0x4f54('0x60')][_0x4f54('0x12e')](db[_0x4f54('0x5b')],{'as':_0x4f54('0x14c'),'foreignKey':_0x4f54('0x16d')});db[_0x4f54('0x60')]['belongsTo'](db[_0x4f54('0x104')],{'as':_0x4f54('0x140'),'foreignKey':_0x4f54('0x141')});db['ChatInteraction'][_0x4f54('0x12e')](db[_0x4f54('0x13')],{'as':_0x4f54('0x14d'),'foreignKey':_0x4f54('0xf9')});db['ChatInteraction'][_0x4f54('0x101')](db[_0x4f54('0x88')],{'through':'chat_interaction_has_tags','as':_0x4f54('0x15c')});db[_0x4f54('0x60')]['belongsToMany'](db[_0x4f54('0x88')],{'through':_0x4f54('0x174'),'as':'ThroughTags'});db[_0x4f54('0x60')][_0x4f54('0x101')](db[_0x4f54('0x13')],{'as':_0x4f54('0x14f'),'through':'user_has_chat_interactions','foreignKey':_0x4f54('0x173')});db['ChatMessage'][_0x4f54('0x12e')](db['User'],{'onDelete':_0x4f54('0xf6'),'as':_0x4f54('0x13')});db[_0x4f54('0x62')][_0x4f54('0x12e')](db[_0x4f54('0x104')],{'onDelete':'cascade','as':_0x4f54('0x140'),'foreignKey':_0x4f54('0x141')});db[_0x4f54('0x62')][_0x4f54('0x12e')](db[_0x4f54('0x60')],{'onDelete':_0x4f54('0xf6'),'as':_0x4f54('0x160'),'foreignKey':_0x4f54('0x173')});db[_0x4f54('0x62')]['belongsTo'](db[_0x4f54('0x150')],{'as':'Attachment','foreignKey':_0x4f54('0x161')});db[_0x4f54('0x62')][_0x4f54('0x12e')](db[_0x4f54('0x5b')],{'as':_0x4f54('0x14c'),'foreignKey':'ChatWebsiteId'});db['ChatOfflineMessage'][_0x4f54('0x12e')](db[_0x4f54('0x104')],{'onDelete':_0x4f54('0xf6'),'as':_0x4f54('0x140'),'foreignKey':_0x4f54('0x141')});db[_0x4f54('0x63')][_0x4f54('0x12e')](db[_0x4f54('0x5b')],{'as':'Account','foreignKey':'ChatWebsiteId'});db[_0x4f54('0x111')][_0x4f54('0x101')](db[_0x4f54('0x13')],{'as':_0x4f54('0x134'),'through':_0x4f54('0x2f'),'hooks':!![]});db['ChatQueue'][_0x4f54('0x101')](db[_0x4f54('0xde')],{'through':_0x4f54('0x175'),'as':'Teams'});db['ChatGroup'][_0x4f54('0xf7')](db['ChatInternalMessage'],{'as':_0x4f54('0x138'),'foreignKey':'ChatGroupId','onDelete':_0x4f54('0xf6')});db[_0x4f54('0x102')][_0x4f54('0x101')](db['User'],{'as':'Members','through':_0x4f54('0x176')});db[_0x4f54('0x67')]['belongsTo'](db[_0x4f54('0x5b')],{'as':'Website','foreignKey':_0x4f54('0x16d')});db[_0x4f54('0x69')][_0x4f54('0xf7')](db[_0x4f54('0x104')],{'as':_0x4f54('0x177'),'foreignKey':_0x4f54('0x178')});db[_0x4f54('0x104')][_0x4f54('0xf7')](db['CmHopper'],{'as':_0x4f54('0x129'),'foreignKey':'ContactId'});db[_0x4f54('0x104')][_0x4f54('0xf7')](db[_0x4f54('0x6f')],{'as':_0x4f54('0xfb'),'foreignKey':'ContactId'});db[_0x4f54('0x104')]['hasMany'](db[_0x4f54('0x71')],{'as':_0x4f54('0x12a'),'foreignKey':_0x4f54('0x141')});db['CmContact'][_0x4f54('0xf7')](db[_0x4f54('0x72')],{'as':_0x4f54('0x72'),'foreignKey':_0x4f54('0x141')});db['CmContact']['hasMany'](db[_0x4f54('0x12c')],{'as':'JscriptySessions','foreignKey':_0x4f54('0x141')});db[_0x4f54('0x104')][_0x4f54('0xf7')](db[_0x4f54('0xfd')],{'as':_0x4f54('0x10d'),'foreignKey':_0x4f54('0x141'),'onDelete':_0x4f54('0x152')});db[_0x4f54('0x104')][_0x4f54('0xf7')](db['ChatInteraction'],{'as':_0x4f54('0xfe'),'foreignKey':_0x4f54('0x141'),'onDelete':_0x4f54('0x152')});db[_0x4f54('0x104')][_0x4f54('0xf7')](db[_0x4f54('0x51')],{'as':_0x4f54('0xff'),'foreignKey':_0x4f54('0x141'),'onDelete':_0x4f54('0x152')});db['CmContact'][_0x4f54('0xf7')](db[_0x4f54('0x4a')],{'as':_0x4f54('0x100'),'foreignKey':'ContactId','onDelete':_0x4f54('0x152')});db[_0x4f54('0x104')][_0x4f54('0xf7')](db[_0x4f54('0x3e')],{'as':_0x4f54('0x109'),'foreignKey':'ContactId','onDelete':_0x4f54('0x152')});db['CmContact']['belongsTo'](db[_0x4f54('0x69')],{'as':'Company','foreignKey':'CompanyId'});db['CmContact'][_0x4f54('0x12e')](db[_0x4f54('0xed')],{'as':_0x4f54('0x148'),'foreignKey':'ListId','onDelete':'cascade'});db[_0x4f54('0x104')]['belongsToMany'](db[_0x4f54('0x13')],{'as':_0x4f54('0x14f'),'through':_0x4f54('0x105')});db[_0x4f54('0x104')][_0x4f54('0x101')](db[_0x4f54('0x88')],{'as':_0x4f54('0x15c'),'through':_0x4f54('0x179')});db[_0x4f54('0x104')][_0x4f54('0x101')](db[_0x4f54('0x88')],{'through':'cm_contact_has_tags','as':_0x4f54('0x15e')});db[_0x4f54('0x6c')][_0x4f54('0x12e')](db['CmContact'],{'as':_0x4f54('0x140'),'foreignKey':_0x4f54('0x141'),'onDelete':_0x4f54('0xf6')});db['CmHopper'][_0x4f54('0x12e')](db[_0x4f54('0xed')],{'as':_0x4f54('0x148'),'foreignKey':_0x4f54('0x159'),'onDelete':'cascade'});db[_0x4f54('0x6c')][_0x4f54('0x12e')](db[_0x4f54('0x13')],{'as':_0x4f54('0x16f'),'foreignKey':'UserId'});db[_0x4f54('0x6c')][_0x4f54('0x12e')](db[_0x4f54('0x1c')],{'as':_0x4f54('0x170'),'foreignKey':_0x4f54('0x128'),'onDelete':'cascade'});db[_0x4f54('0x6c')]['belongsTo'](db[_0x4f54('0x17a')],{'as':_0x4f54('0x17a'),'foreignKey':_0x4f54('0x17b'),'onDelete':_0x4f54('0xf6')});db[_0x4f54('0x6c')][_0x4f54('0x12e')](db[_0x4f54('0x13')],{'as':_0x4f54('0x14d'),'foreignKey':_0x4f54('0x17c')});db[_0x4f54('0x6d')][_0x4f54('0x12e')](db[_0x4f54('0x104')],{'as':_0x4f54('0x140'),'foreignKey':_0x4f54('0x141'),'onDelete':_0x4f54('0xf6')});db[_0x4f54('0x6d')]['belongsTo'](db['CmList'],{'as':'List','foreignKey':_0x4f54('0x159'),'onDelete':_0x4f54('0xf6')});db[_0x4f54('0x6d')][_0x4f54('0x12e')](db[_0x4f54('0x1c')],{'as':_0x4f54('0x170'),'foreignKey':'VoiceQueueId','onDelete':'cascade'});db[_0x4f54('0x6d')][_0x4f54('0x12e')](db['Campaign'],{'as':_0x4f54('0x17a'),'foreignKey':'CampaignId','onDelete':_0x4f54('0xf6')});db[_0x4f54('0x78')]['hasMany'](db['Condition'],{'as':{'plural':_0x4f54('0x17d'),'singular':_0x4f54('0x17e')},'foreignKey':_0x4f54('0x17f'),'onDelete':_0x4f54('0xf6'),'hooks':!![]});db[_0x4f54('0x78')][_0x4f54('0xf7')](db['Condition'],{'as':{'plural':_0x4f54('0x180'),'singular':'OneAny'},'foreignKey':_0x4f54('0x181'),'onDelete':'cascade','hooks':!![]});db[_0x4f54('0x78')][_0x4f54('0xf7')](db['Action'],{'as':_0x4f54('0x182'),'foreignKey':_0x4f54('0x183'),'onDelete':_0x4f54('0xf6'),'hooks':!![]});db[_0x4f54('0x7f')][_0x4f54('0xf7')](db['Interval'],{'as':_0x4f54('0x184'),'foreignKey':_0x4f54('0x131'),'onDelete':_0x4f54('0xf6'),'hooks':!![],'required':![]});db[_0x4f54('0x7f')][_0x4f54('0xf7')](db[_0x4f54('0xfa')],{'as':'Extensions','foreignKey':_0x4f54('0x131'),'onDelete':'restrict'});db[_0x4f54('0x7f')][_0x4f54('0xf7')](db[_0x4f54('0x40')],{'as':'MailApplications','foreignKey':_0x4f54('0x131')});db[_0x4f54('0x7f')][_0x4f54('0xf7')](db[_0x4f54('0x5e')],{'as':_0x4f54('0x185'),'foreignKey':_0x4f54('0x131')});db[_0x4f54('0x7f')]['hasMany'](db[_0x4f54('0x48')],{'as':_0x4f54('0x186'),'foreignKey':_0x4f54('0x131')});db[_0x4f54('0x7f')][_0x4f54('0xf7')](db[_0x4f54('0x164')],{'as':_0x4f54('0x187'),'foreignKey':_0x4f54('0x131')});db[_0x4f54('0x85')][_0x4f54('0x12e')](db[_0x4f54('0x142')],{});db[_0x4f54('0x85')][_0x4f54('0x12e')](db[_0x4f54('0x92')],{'foreignKey':_0x4f54('0x188')});db[_0x4f54('0x85')][_0x4f54('0x12e')](db[_0x4f54('0x90')],{'foreignKey':_0x4f54('0x189')});db[_0x4f54('0x124')][_0x4f54('0x101')](db[_0x4f54('0x1a')],{'as':'Mohs','through':_0x4f54('0x126'),'onDelete':_0x4f54('0x152')});db['Tag'][_0x4f54('0x101')](db[_0x4f54('0x104')],{'through':'cm_contact_has_tags'});db[_0x4f54('0x88')][_0x4f54('0x101')](db['ChatInteraction'],{'through':_0x4f54('0x174')});db[_0x4f54('0x88')]['belongsToMany'](db[_0x4f54('0x3e')],{'through':_0x4f54('0x14e')});db[_0x4f54('0x88')][_0x4f54('0x101')](db[_0x4f54('0x51')],{'through':'sms_interaction_has_tags'});db[_0x4f54('0x88')][_0x4f54('0x101')](db['FaxInteraction'],{'through':_0x4f54('0x15d')});db['Tag'][_0x4f54('0x101')](db[_0x4f54('0xfd')],{'through':_0x4f54('0x16a')});db[_0x4f54('0x8b')]['hasMany'](db[_0x4f54('0x7d')],{'as':{'plural':_0x4f54('0x18a'),'singular':'AllCondition'},'foreignKey':_0x4f54('0x18b'),'onDelete':'cascade','hooks':!![]});db[_0x4f54('0x8b')][_0x4f54('0xf7')](db['Condition'],{'as':{'plural':_0x4f54('0x18c'),'singular':_0x4f54('0x18d')},'foreignKey':_0x4f54('0x18e'),'onDelete':_0x4f54('0xf6'),'hooks':!![]});db[_0x4f54('0x8b')][_0x4f54('0xf7')](db[_0x4f54('0x76')],{'as':_0x4f54('0x182'),'foreignKey':_0x4f54('0x18f'),'onDelete':_0x4f54('0xf6'),'hooks':!![]});db['AnalyticCustomReport'][_0x4f54('0xf7')](db[_0x4f54('0x190')],{'as':_0x4f54('0x191'),'onDelete':_0x4f54('0xf6'),'foreignKey':'CustomReportId','hooks':!![]});db[_0x4f54('0x92')][_0x4f54('0xf7')](db['AnalyticFieldReport'],{'as':_0x4f54('0x191'),'onDelete':_0x4f54('0xf6'),'foreignKey':_0x4f54('0x188')});db[_0x4f54('0x192')][_0x4f54('0xf7')](db[_0x4f54('0x190')],{'as':'Fields','onDelete':_0x4f54('0xf6'),'foreignKey':_0x4f54('0x193')});db[_0x4f54('0x190')]['belongsTo'](db[_0x4f54('0x192')],{'foreignKey':_0x4f54('0x193')});db[_0x4f54('0x99')][_0x4f54('0xf7')](db[_0x4f54('0x9b')],{'as':_0x4f54('0x194'),'onDelete':_0x4f54('0xf6'),'foreignKey':_0x4f54('0x195')});db[_0x4f54('0x9b')][_0x4f54('0xf7')](db[_0x4f54('0x9d')],{'as':_0x4f54('0x196'),'onDelete':_0x4f54('0xf6'),'foreignKey':_0x4f54('0x197')});db[_0x4f54('0x9b')][_0x4f54('0xf7')](db[_0x4f54('0x9d')],{'as':_0x4f54('0x198'),'onDelete':'cascade','foreignKey':_0x4f54('0x199')});db[_0x4f54('0x9b')][_0x4f54('0xf7')](db[_0x4f54('0x9d')],{'as':_0x4f54('0x191'),'onDelete':_0x4f54('0xf6'),'foreignKey':_0x4f54('0x19a')});db['SalesforceConfiguration'][_0x4f54('0x12e')](db[_0x4f54('0x99')],{'as':_0x4f54('0x14c'),'foreignKey':'AccountId'});db[_0x4f54('0x9d')][_0x4f54('0xf7')](db[_0x4f54('0x9d')],{'as':_0x4f54('0x19b'),'foreignKey':_0x4f54('0x197')});db[_0x4f54('0x9d')][_0x4f54('0xf7')](db[_0x4f54('0x9d')],{'as':_0x4f54('0x19c'),'foreignKey':_0x4f54('0x199')});db[_0x4f54('0x9d')][_0x4f54('0xf7')](db[_0x4f54('0x9d')],{'as':'Field','foreignKey':_0x4f54('0x19a')});db['SalesforceField'][_0x4f54('0x12e')](db[_0x4f54('0x8c')],{'as':_0x4f54('0x8c'),'foreignKey':_0x4f54('0x19d')});db['SugarcrmAccount'][_0x4f54('0xf7')](db['SugarcrmConfiguration'],{'as':_0x4f54('0x194'),'onDelete':_0x4f54('0xf6'),'foreignKey':_0x4f54('0x195')});db[_0x4f54('0x19e')]['hasMany'](db['SugarcrmField'],{'as':_0x4f54('0x196'),'onDelete':_0x4f54('0xf6'),'foreignKey':_0x4f54('0x197')});db['SugarcrmConfiguration'][_0x4f54('0xf7')](db[_0x4f54('0xa1')],{'as':_0x4f54('0x198'),'onDelete':_0x4f54('0xf6'),'foreignKey':_0x4f54('0x199')});db[_0x4f54('0x19e')]['hasMany'](db[_0x4f54('0xa1')],{'as':'Fields','onDelete':_0x4f54('0xf6'),'foreignKey':_0x4f54('0x19a')});db[_0x4f54('0x19e')][_0x4f54('0x12e')](db[_0x4f54('0x9f')],{'as':_0x4f54('0x14c'),'foreignKey':_0x4f54('0x195')});db[_0x4f54('0xa1')][_0x4f54('0xf7')](db[_0x4f54('0xa1')],{'as':'Subject','foreignKey':'SubjectId'});db[_0x4f54('0xa1')][_0x4f54('0xf7')](db[_0x4f54('0xa1')],{'as':_0x4f54('0x19c'),'foreignKey':_0x4f54('0x199')});db[_0x4f54('0xa1')][_0x4f54('0xf7')](db['SugarcrmField'],{'as':'Field','foreignKey':'FieldId'});db[_0x4f54('0xa1')][_0x4f54('0x12e')](db['Variable'],{'as':_0x4f54('0x8c'),'foreignKey':'VariableId'});db[_0x4f54('0xa3')]['hasMany'](db[_0x4f54('0x19f')],{'as':_0x4f54('0x194'),'onDelete':_0x4f54('0xf6'),'foreignKey':'AccountId'});db[_0x4f54('0x19f')][_0x4f54('0xf7')](db[_0x4f54('0xa5')],{'as':_0x4f54('0x196'),'onDelete':'cascade','foreignKey':_0x4f54('0x197')});db[_0x4f54('0x19f')][_0x4f54('0xf7')](db['DeskField'],{'as':_0x4f54('0x198'),'onDelete':_0x4f54('0xf6'),'foreignKey':'DescriptionId'});db['DeskConfiguration']['hasMany'](db[_0x4f54('0xa5')],{'as':_0x4f54('0x191'),'onDelete':_0x4f54('0xf6'),'foreignKey':_0x4f54('0x19a')});db[_0x4f54('0x19f')][_0x4f54('0x12e')](db[_0x4f54('0xa3')],{'as':_0x4f54('0x14c'),'foreignKey':_0x4f54('0x195')});db[_0x4f54('0x19f')][_0x4f54('0x101')](db[_0x4f54('0x88')],{'through':'int_desk_configuration_has_tags'});db[_0x4f54('0xa5')][_0x4f54('0xf7')](db[_0x4f54('0xa5')],{'as':_0x4f54('0x19b'),'foreignKey':'SubjectId'});db['DeskField'][_0x4f54('0xf7')](db[_0x4f54('0xa5')],{'as':_0x4f54('0x19c'),'foreignKey':_0x4f54('0x199')});db['DeskField'][_0x4f54('0xf7')](db['DeskField'],{'as':_0x4f54('0x1a0'),'foreignKey':_0x4f54('0x19a')});db[_0x4f54('0xa5')]['belongsTo'](db[_0x4f54('0x8c')],{'as':_0x4f54('0x8c'),'foreignKey':_0x4f54('0x19d')});db['ZohoAccount'][_0x4f54('0xf7')](db[_0x4f54('0xa7')],{'as':_0x4f54('0x194'),'onDelete':_0x4f54('0xf6'),'foreignKey':_0x4f54('0x195')});db['ZohoConfiguration'][_0x4f54('0xf7')](db[_0x4f54('0x1a1')],{'as':_0x4f54('0x196'),'onDelete':_0x4f54('0xf6'),'foreignKey':'SubjectId'});db[_0x4f54('0xa7')]['hasMany'](db[_0x4f54('0x1a1')],{'as':'Descriptions','onDelete':'cascade','foreignKey':_0x4f54('0x199')});db[_0x4f54('0xa7')]['hasMany'](db[_0x4f54('0x1a1')],{'as':'Fields','onDelete':_0x4f54('0xf6'),'foreignKey':_0x4f54('0x19a')});db['ZohoConfiguration'][_0x4f54('0x12e')](db[_0x4f54('0x1a2')],{'as':'Account','foreignKey':_0x4f54('0x195')});db[_0x4f54('0x1a1')][_0x4f54('0xf7')](db['ZohoField'],{'as':_0x4f54('0x19b'),'foreignKey':_0x4f54('0x197')});db[_0x4f54('0x1a1')][_0x4f54('0xf7')](db['ZohoField'],{'as':_0x4f54('0x19c'),'foreignKey':_0x4f54('0x199')});db[_0x4f54('0x1a1')][_0x4f54('0xf7')](db[_0x4f54('0x1a1')],{'as':_0x4f54('0x1a0'),'foreignKey':'FieldId'});db[_0x4f54('0x1a1')]['belongsTo'](db[_0x4f54('0x8c')],{'as':_0x4f54('0x8c'),'foreignKey':_0x4f54('0x19d')});db[_0x4f54('0xa9')][_0x4f54('0xf7')](db[_0x4f54('0xab')],{'as':_0x4f54('0x194'),'onDelete':'cascade','foreignKey':'AccountId'});db[_0x4f54('0xab')][_0x4f54('0xf7')](db[_0x4f54('0xad')],{'as':'Subjects','foreignKey':'SubjectId'});db[_0x4f54('0xab')][_0x4f54('0xf7')](db[_0x4f54('0xad')],{'as':_0x4f54('0x198'),'foreignKey':_0x4f54('0x199')});db['ZendeskConfiguration'][_0x4f54('0xf7')](db[_0x4f54('0xad')],{'as':_0x4f54('0x191'),'foreignKey':_0x4f54('0x19a')});db[_0x4f54('0xab')][_0x4f54('0x12e')](db[_0x4f54('0xa9')],{'as':'Account','foreignKey':_0x4f54('0x195')});db[_0x4f54('0xab')][_0x4f54('0x101')](db[_0x4f54('0x88')],{'through':_0x4f54('0x1a3')});db[_0x4f54('0xad')][_0x4f54('0xf7')](db[_0x4f54('0xad')],{'as':'Subject','foreignKey':_0x4f54('0x197')});db['ZendeskField'][_0x4f54('0xf7')](db[_0x4f54('0xad')],{'as':'Description','foreignKey':_0x4f54('0x199')});db[_0x4f54('0xad')]['hasMany'](db['ZendeskField'],{'as':_0x4f54('0x1a0'),'foreignKey':_0x4f54('0x19a')});db[_0x4f54('0xad')][_0x4f54('0x12e')](db['Variable'],{'as':'Variable','foreignKey':'VariableId'});db[_0x4f54('0xaf')]['hasMany'](db[_0x4f54('0xb1')],{'as':_0x4f54('0x194'),'onDelete':_0x4f54('0xf6'),'foreignKey':_0x4f54('0x195')});db[_0x4f54('0xb1')][_0x4f54('0xf7')](db['FreshdeskField'],{'as':'Subjects','onDelete':_0x4f54('0xf6'),'foreignKey':_0x4f54('0x197')});db[_0x4f54('0xb1')][_0x4f54('0xf7')](db[_0x4f54('0x1a4')],{'as':'Descriptions','onDelete':_0x4f54('0xf6'),'foreignKey':_0x4f54('0x199')});db[_0x4f54('0xb1')][_0x4f54('0xf7')](db[_0x4f54('0x1a4')],{'as':_0x4f54('0x191'),'onDelete':'cascade','foreignKey':_0x4f54('0x19a')});db[_0x4f54('0xb1')][_0x4f54('0x12e')](db[_0x4f54('0xaf')],{'as':'Account','foreignKey':'AccountId'});db[_0x4f54('0xb1')][_0x4f54('0x101')](db['Tag'],{'through':_0x4f54('0x1a5')});db['FreshdeskField'][_0x4f54('0xf7')](db[_0x4f54('0x1a4')],{'as':'Subject','foreignKey':_0x4f54('0x197')});db['FreshdeskField'][_0x4f54('0xf7')](db['FreshdeskField'],{'as':_0x4f54('0x19c'),'foreignKey':_0x4f54('0x199')});db['FreshdeskField'][_0x4f54('0xf7')](db[_0x4f54('0x1a4')],{'as':_0x4f54('0x1a0'),'foreignKey':_0x4f54('0x19a')});db[_0x4f54('0x1a4')][_0x4f54('0x12e')](db[_0x4f54('0x8c')],{'as':_0x4f54('0x8c'),'foreignKey':_0x4f54('0x19d')});db[_0x4f54('0x1a6')][_0x4f54('0xf7')](db['VtigerConfiguration'],{'as':'Configurations','onDelete':_0x4f54('0xf6'),'foreignKey':'AccountId'});db['VtigerConfiguration'][_0x4f54('0xf7')](db[_0x4f54('0x1a7')],{'as':_0x4f54('0x196'),'foreignKey':'SubjectId'});db[_0x4f54('0xb5')]['hasMany'](db['VtigerField'],{'as':'Descriptions','foreignKey':_0x4f54('0x199')});db[_0x4f54('0xb5')][_0x4f54('0xf7')](db['VtigerField'],{'as':'Fields','foreignKey':_0x4f54('0x19a')});db['VtigerConfiguration']['belongsTo'](db[_0x4f54('0x1a6')],{'as':'Account','foreignKey':_0x4f54('0x195')});db[_0x4f54('0x1a7')]['hasMany'](db[_0x4f54('0x1a7')],{'as':_0x4f54('0x19b'),'foreignKey':_0x4f54('0x197')});db[_0x4f54('0x1a7')][_0x4f54('0xf7')](db[_0x4f54('0x1a7')],{'as':_0x4f54('0x19c'),'foreignKey':'DescriptionId'});db['VtigerField'][_0x4f54('0xf7')](db['VtigerField'],{'as':_0x4f54('0x1a0'),'foreignKey':_0x4f54('0x19a')});db['VtigerField']['belongsTo'](db['Variable'],{'as':_0x4f54('0x8c'),'foreignKey':_0x4f54('0x19d')});db[_0x4f54('0xb6')][_0x4f54('0xf7')](db[_0x4f54('0xb8')],{'as':_0x4f54('0x194'),'onDelete':'cascade','foreignKey':'AccountId'});db[_0x4f54('0xb8')][_0x4f54('0xf7')](db[_0x4f54('0xb9')],{'as':'Subjects','foreignKey':'SubjectId'});db[_0x4f54('0xb8')]['hasMany'](db[_0x4f54('0xb9')],{'as':_0x4f54('0x198'),'foreignKey':_0x4f54('0x199')});db[_0x4f54('0xb8')]['hasMany'](db[_0x4f54('0xb9')],{'as':_0x4f54('0x191'),'foreignKey':_0x4f54('0x19a')});db[_0x4f54('0xb8')]['belongsTo'](db[_0x4f54('0xb6')],{'as':_0x4f54('0x14c'),'foreignKey':'AccountId'});db['ServicenowField'][_0x4f54('0xf7')](db[_0x4f54('0xb9')],{'as':_0x4f54('0x19b'),'foreignKey':_0x4f54('0x197')});db[_0x4f54('0xb9')][_0x4f54('0xf7')](db['ServicenowField'],{'as':'Description','foreignKey':'DescriptionId'});db['ServicenowField']['hasMany'](db[_0x4f54('0xb9')],{'as':_0x4f54('0x1a0'),'foreignKey':_0x4f54('0x19a')});db[_0x4f54('0xb9')][_0x4f54('0x12e')](db[_0x4f54('0x8c')],{'as':_0x4f54('0x8c'),'foreignKey':_0x4f54('0x19d')});db['Dynamics365Account']['hasMany'](db[_0x4f54('0x1a8')],{'as':'Configurations','onDelete':'cascade','foreignKey':'AccountId'});db[_0x4f54('0x1a8')][_0x4f54('0xf7')](db[_0x4f54('0x1a9')],{'as':_0x4f54('0x196'),'onDelete':_0x4f54('0xf6'),'foreignKey':_0x4f54('0x197')});db[_0x4f54('0x1a8')][_0x4f54('0xf7')](db[_0x4f54('0x1a9')],{'as':_0x4f54('0x198'),'onDelete':_0x4f54('0xf6'),'foreignKey':'DescriptionId'});db['Dynamics365Configuration'][_0x4f54('0xf7')](db[_0x4f54('0x1a9')],{'as':_0x4f54('0x191'),'onDelete':_0x4f54('0xf6'),'foreignKey':_0x4f54('0x19a')});db[_0x4f54('0x1a8')][_0x4f54('0x12e')](db['Dynamics365Account'],{'as':_0x4f54('0x14c'),'foreignKey':'AccountId'});db['Dynamics365Field'][_0x4f54('0xf7')](db[_0x4f54('0x1a9')],{'as':_0x4f54('0x19b'),'foreignKey':_0x4f54('0x197')});db['Dynamics365Field'][_0x4f54('0xf7')](db['Dynamics365Field'],{'as':_0x4f54('0x19c'),'foreignKey':'DescriptionId'});db[_0x4f54('0x1a9')][_0x4f54('0xf7')](db['Dynamics365Field'],{'as':_0x4f54('0x1a0'),'foreignKey':_0x4f54('0x19a')});db[_0x4f54('0x1a9')][_0x4f54('0x12e')](db[_0x4f54('0x8c')],{'as':_0x4f54('0x8c'),'foreignKey':_0x4f54('0x19d')});db[_0x4f54('0xbf')][_0x4f54('0xf7')](db[_0x4f54('0xc1')],{'as':_0x4f54('0x194'),'onDelete':_0x4f54('0xf6'),'foreignKey':_0x4f54('0x195')});db[_0x4f54('0xc1')][_0x4f54('0xf7')](db[_0x4f54('0x1aa')],{'as':_0x4f54('0x196'),'foreignKey':_0x4f54('0x197')});db['FreshsalesConfiguration'][_0x4f54('0xf7')](db[_0x4f54('0x1aa')],{'as':_0x4f54('0x198'),'foreignKey':_0x4f54('0x199')});db[_0x4f54('0xc1')][_0x4f54('0xf7')](db[_0x4f54('0x1aa')],{'as':_0x4f54('0x191'),'foreignKey':_0x4f54('0x19a')});db['FreshsalesConfiguration'][_0x4f54('0x12e')](db[_0x4f54('0xbf')],{'as':_0x4f54('0x14c'),'foreignKey':_0x4f54('0x195')});db['FreshsalesField'][_0x4f54('0xf7')](db['FreshsalesField'],{'as':_0x4f54('0x19b'),'foreignKey':_0x4f54('0x197')});db[_0x4f54('0x1aa')][_0x4f54('0xf7')](db[_0x4f54('0x1aa')],{'as':_0x4f54('0x19c'),'foreignKey':_0x4f54('0x199')});db[_0x4f54('0x1aa')][_0x4f54('0xf7')](db['FreshsalesField'],{'as':_0x4f54('0x1a0'),'foreignKey':_0x4f54('0x19a')});db[_0x4f54('0x1aa')][_0x4f54('0x12e')](db[_0x4f54('0x8c')],{'as':_0x4f54('0x8c'),'foreignKey':'VariableId'});db['ChatQueueReport']['belongsTo'](db[_0x4f54('0x5b')],{});db['ChatQueueReport']['belongsTo'](db[_0x4f54('0xed')],{'as':'List','foreignKey':_0x4f54('0x159')});db[_0x4f54('0xc5')][_0x4f54('0x12e')](db[_0x4f54('0x104')],{'as':_0x4f54('0x140'),'foreignKey':'ContactId'});db[_0x4f54('0xc5')][_0x4f54('0x12e')](db[_0x4f54('0x60')],{});db[_0x4f54('0xc5')]['belongsTo'](db[_0x4f54('0x62')],{});db['ChatQueueReport'][_0x4f54('0x12e')](db[_0x4f54('0x13')],{});db['ChatQueueReport'][_0x4f54('0x12e')](db[_0x4f54('0x111')],{});db[_0x4f54('0xc7')][_0x4f54('0x12e')](db[_0x4f54('0x13')],{'onDelete':_0x4f54('0xf6'),'foreignKey':'FromId'});db[_0x4f54('0xc7')]['belongsTo'](db['User'],{'onDelete':_0x4f54('0xf6'),'foreignKey':_0x4f54('0x1ab')});db[_0x4f54('0x12c')][_0x4f54('0xf7')](db[_0x4f54('0xcb')],{'foreignKey':_0x4f54('0x1ac'),'onDelete':_0x4f54('0xf6')});db['JscriptySessionReport']['hasMany'](db[_0x4f54('0xc9')],{'foreignKey':_0x4f54('0x1ac'),'onDelete':_0x4f54('0xf6')});db[_0x4f54('0x1ad')][_0x4f54('0x12e')](db[_0x4f54('0x4e')],{});db[_0x4f54('0x1ad')][_0x4f54('0x12e')](db[_0x4f54('0xed')],{'as':'List','foreignKey':_0x4f54('0x159')});db['SmsQueueReport'][_0x4f54('0x12e')](db[_0x4f54('0x104')],{'as':'Contact','foreignKey':_0x4f54('0x141')});db['SmsQueueReport']['belongsTo'](db[_0x4f54('0x51')],{});db[_0x4f54('0x1ad')][_0x4f54('0x12e')](db[_0x4f54('0x53')],{});db[_0x4f54('0x1ad')]['belongsTo'](db['User'],{});db[_0x4f54('0x1ad')][_0x4f54('0x12e')](db[_0x4f54('0x113')],{});db['JscriptyProject']['hasMany'](db[_0x4f54('0x12c')],{'foreignKey':_0x4f54('0x1ae')});db[_0x4f54('0xd2')][_0x4f54('0xf7')](db[_0x4f54('0xcb')],{'foreignKey':_0x4f54('0x1ae')});db[_0x4f54('0xd2')][_0x4f54('0xf7')](db['JscriptyAnswerReport'],{'foreignKey':'ProjectId'});db[_0x4f54('0xd8')]['belongsToMany'](db[_0x4f54('0x13')],{'as':_0x4f54('0x14f'),'through':_0x4f54('0x120')});db[_0x4f54('0xde')][_0x4f54('0x101')](db[_0x4f54('0x13')],{'as':_0x4f54('0x134'),'through':_0x4f54('0x108')});db[_0x4f54('0xde')][_0x4f54('0x101')](db['VoiceQueue'],{'through':_0x4f54('0x1af'),'as':_0x4f54('0x10f')});db[_0x4f54('0xde')]['belongsToMany'](db[_0x4f54('0x3b')],{'through':'team_has_mail_queues','as':_0x4f54('0x110')});db[_0x4f54('0xde')][_0x4f54('0x101')](db[_0x4f54('0x111')],{'through':_0x4f54('0x175'),'as':'ChatQueues'});db[_0x4f54('0xde')][_0x4f54('0x101')](db['FaxQueue'],{'through':'team_has_fax_queues','as':_0x4f54('0x1b0')});db[_0x4f54('0xde')][_0x4f54('0x101')](db[_0x4f54('0x113')],{'through':_0x4f54('0x1b1'),'as':_0x4f54('0x114')});db[_0x4f54('0xde')]['belongsToMany'](db[_0x4f54('0x115')],{'through':_0x4f54('0x16c'),'as':_0x4f54('0x1b2')});db[_0x4f54('0x17a')][_0x4f54('0xf7')](db['CmHopper'],{'as':'Hoppers','foreignKey':_0x4f54('0x17b')});db[_0x4f54('0x17a')]['hasMany'](db['CmHopperFinal'],{'as':_0x4f54('0xfb'),'foreignKey':_0x4f54('0x17b')});db[_0x4f54('0x17a')][_0x4f54('0xf7')](db['CmHopperHistory'],{'as':_0x4f54('0x12a'),'foreignKey':_0x4f54('0x17b')});db['Campaign'][_0x4f54('0xf7')](db[_0x4f54('0x6d')],{'as':_0x4f54('0x12b'),'foreignKey':_0x4f54('0x17b')});db['Campaign'][_0x4f54('0x12e')](db[_0x4f54('0x27')],{'as':_0x4f54('0x27'),'foreignKey':'TrunkId'});db['Campaign'][_0x4f54('0x12e')](db[_0x4f54('0x27')],{'as':_0x4f54('0x1b3'),'foreignKey':_0x4f54('0x130')});db[_0x4f54('0x17a')][_0x4f54('0x12e')](db[_0x4f54('0x7f')],{'as':'Interval','foreignKey':_0x4f54('0x131')});db[_0x4f54('0x17a')]['belongsTo'](db['SquareProject'],{'as':_0x4f54('0xd8'),'foreignKey':_0x4f54('0x1b4')});db[_0x4f54('0x17a')][_0x4f54('0x101')](db[_0x4f54('0xed')],{'as':_0x4f54('0x106'),'through':'campaigns_has_cm_lists'});db[_0x4f54('0x17a')][_0x4f54('0x101')](db[_0x4f54('0xed')],{'as':'BlackLists','through':_0x4f54('0x1b5')});db['MailTransferReport'][_0x4f54('0x12e')](db[_0x4f54('0x147')],{});db['MailTransferReport'][_0x4f54('0x12e')](db['MailInteraction'],{});db[_0x4f54('0x1b6')][_0x4f54('0x12e')](db[_0x4f54('0x142')],{'foreignKey':_0x4f54('0x1b7'),'as':_0x4f54('0x1b8')});db[_0x4f54('0x1b6')][_0x4f54('0x12e')](db['User'],{'foreignKey':_0x4f54('0x1b9'),'as':_0x4f54('0x1ba')});db[_0x4f54('0x1b6')]['belongsTo'](db['User'],{'foreignKey':_0x4f54('0x1bb'),'as':_0x4f54('0x1bc')});db[_0x4f54('0x1b6')][_0x4f54('0x12e')](db[_0x4f54('0x3b')],{'foreignKey':_0x4f54('0x1bd'),'as':'ToQueue'});db[_0x4f54('0x1b6')]['belongsTo'](db[_0x4f54('0x142')],{'foreignKey':'ToMailAccountId','as':_0x4f54('0x1be')});db[_0x4f54('0x1bf')][_0x4f54('0x12e')](db[_0x4f54('0x62')],{});db['ChatTransferReport']['belongsTo'](db[_0x4f54('0x60')],{});db[_0x4f54('0x1bf')][_0x4f54('0x12e')](db[_0x4f54('0x5b')],{'foreignKey':_0x4f54('0x1c0'),'as':_0x4f54('0x1b8')});db[_0x4f54('0x1bf')]['belongsTo'](db['User'],{'foreignKey':_0x4f54('0x1b9'),'as':_0x4f54('0x1ba')});db[_0x4f54('0x1bf')][_0x4f54('0x12e')](db[_0x4f54('0x13')],{'foreignKey':_0x4f54('0x1bb'),'as':_0x4f54('0x1bc')});db[_0x4f54('0x1bf')]['belongsTo'](db[_0x4f54('0x111')],{'foreignKey':_0x4f54('0x1c1'),'as':'ToQueue'});db['ChatTransferReport'][_0x4f54('0x12e')](db[_0x4f54('0x5b')],{'foreignKey':_0x4f54('0x1c2'),'as':_0x4f54('0x1be')});db[_0x4f54('0xe8')][_0x4f54('0x12e')](db[_0x4f54('0x15f')],{});db[_0x4f54('0xe8')][_0x4f54('0x12e')](db[_0x4f54('0x4a')],{});db[_0x4f54('0xe8')][_0x4f54('0x12e')](db['FaxAccount'],{'foreignKey':_0x4f54('0x1c3'),'as':_0x4f54('0x1b8')});db['FaxTransferReport']['belongsTo'](db['User'],{'foreignKey':'FromUserId','as':_0x4f54('0x1ba')});db[_0x4f54('0xe8')][_0x4f54('0x12e')](db[_0x4f54('0x13')],{'foreignKey':_0x4f54('0x1bb'),'as':_0x4f54('0x1bc')});db[_0x4f54('0xe8')][_0x4f54('0x12e')](db[_0x4f54('0x4b')],{'foreignKey':_0x4f54('0x1c4'),'as':_0x4f54('0x1c5')});db[_0x4f54('0xe8')][_0x4f54('0x12e')](db[_0x4f54('0x46')],{'foreignKey':_0x4f54('0x1c6'),'as':_0x4f54('0x1be')});db['OpenchannelTransferReport'][_0x4f54('0x12e')](db['OpenchannelMessage'],{});db[_0x4f54('0xea')][_0x4f54('0x12e')](db['OpenchannelInteraction'],{});db[_0x4f54('0xea')][_0x4f54('0x12e')](db[_0x4f54('0x55')],{'foreignKey':_0x4f54('0x1c7'),'as':_0x4f54('0x1b8')});db[_0x4f54('0xea')]['belongsTo'](db[_0x4f54('0x13')],{'foreignKey':_0x4f54('0x1b9'),'as':_0x4f54('0x1ba')});db[_0x4f54('0xea')]['belongsTo'](db['User'],{'foreignKey':_0x4f54('0x1bb'),'as':_0x4f54('0x1bc')});db[_0x4f54('0xea')][_0x4f54('0x12e')](db[_0x4f54('0x115')],{'foreignKey':_0x4f54('0x1c8'),'as':_0x4f54('0x1c5')});db['OpenchannelTransferReport'][_0x4f54('0x12e')](db['OpenchannelAccount'],{'foreignKey':_0x4f54('0x1c9'),'as':'ToAccount'});db[_0x4f54('0xec')]['belongsTo'](db[_0x4f54('0x53')],{});db[_0x4f54('0xec')][_0x4f54('0x12e')](db[_0x4f54('0x51')],{});db[_0x4f54('0xec')][_0x4f54('0x12e')](db['SmsAccount'],{'foreignKey':_0x4f54('0x1ca'),'as':_0x4f54('0x1b8')});db[_0x4f54('0xec')][_0x4f54('0x12e')](db[_0x4f54('0x13')],{'foreignKey':_0x4f54('0x1b9'),'as':_0x4f54('0x1ba')});db[_0x4f54('0xec')][_0x4f54('0x12e')](db[_0x4f54('0x13')],{'foreignKey':'ToUserId','as':'ToAgent'});db[_0x4f54('0xec')]['belongsTo'](db[_0x4f54('0x113')],{'foreignKey':_0x4f54('0x1cb'),'as':_0x4f54('0x1c5')});db['SmsTransferReport'][_0x4f54('0x12e')](db['SmsAccount'],{'foreignKey':_0x4f54('0x1cc'),'as':_0x4f54('0x1be')});db[_0x4f54('0xed')][_0x4f54('0xf7')](db[_0x4f54('0x7c')],{'as':'Dispositions','foreignKey':'ListId'});db[_0x4f54('0xed')][_0x4f54('0xf7')](db[_0x4f54('0x74')],{'as':_0x4f54('0x1cd'),'foreignKey':_0x4f54('0x159')});db[_0x4f54('0xed')][_0x4f54('0xf7')](db[_0x4f54('0x104')],{'as':_0x4f54('0x177'),'onDelete':_0x4f54('0xf6'),'foreignKey':_0x4f54('0x159')});db['CmList'][_0x4f54('0xf7')](db[_0x4f54('0x6f')],{'as':'HopperFinals','foreignKey':'ListId'});db[_0x4f54('0xed')][_0x4f54('0xf7')](db[_0x4f54('0x71')],{'as':_0x4f54('0xfc'),'foreignKey':_0x4f54('0x159')});db['CmList'][_0x4f54('0xf7')](db[_0x4f54('0x72')],{'as':_0x4f54('0x72'),'foreignKey':_0x4f54('0x159')});db[_0x4f54('0xed')]['belongsToMany'](db[_0x4f54('0x1c')],{'as':_0x4f54('0x1ce'),'through':_0x4f54('0x1cf')});db['CmList'][_0x4f54('0x101')](db[_0x4f54('0x13')],{'as':_0x4f54('0x134'),'through':_0x4f54('0x107')});db['VoicePrefix'][_0x4f54('0xf7')](db['VoiceExtension'],{'as':_0x4f54('0x1d0'),'onDelete':_0x4f54('0x152')});db[_0x4f54('0xee')]['belongsToMany'](db[_0x4f54('0x13')],{'as':_0x4f54('0x134'),'through':_0x4f54('0x1d1')});db[_0x4f54('0xf0')][_0x4f54('0xf7')](db[_0x4f54('0x13')],{'as':'Users','foreignKey':_0x4f54('0x1d2')});db[_0x4f54('0xf0')][_0x4f54('0xf7')](db['UserProfileSection'],{'as':'UserProfileSections','foreignKey':_0x4f54('0x1d2'),'onDelete':'cascade'});db[_0x4f54('0xf2')][_0x4f54('0xf7')](db[_0x4f54('0x1d3')],{'as':_0x4f54('0x1d4'),'foreignKey':_0x4f54('0x1d5'),'onDelete':'cascade'});module[_0x4f54('0x1d6')]={'db':db,'dbH':dbH}; \ No newline at end of file diff --git a/server/routes.js b/server/routes.js index 6d2909d..2a32706 100644 --- a/server/routes.js +++ b/server/routes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xf749=['/api/fax/reports/queue','./api/faxQueueReport','/api/sms/accounts','./api/smsApplication','./api/smsInteraction','/api/sms/messages','./api/smsMessage','/api/sms/queues','./api/smsQueue','/api/openchannel/accounts','/api/openchannel/applications','./api/openchannelApplication','./api/openchannelInteraction','/api/openchannel/messages','./api/openchannelMessage','/api/openchannel/queues','./api/chatWebsite','/api/openchannel/reports/queue','/api/chat/interactions','./api/chatInteraction','/api/chat/messages','./api/chatMessage','/api/chat/offline_messages','./api/chatOfflineMessage','./api/chatQueue','/api/chat/groups','./api/chatGroup','/api/chat/proactive_actions','./api/chatProactiveAction','./api/cmCompany','/api/cm/contacts','./api/cmContact','/api/cm/hopper','./api/cmHopper','/api/cm/hopper_black','./api/cmHopperBlack','/api/cm/hopper_final','./api/cmHopperFinal','./api/cmHopperHistory','/api/cm/custom_fields','./api/cmCustomField','./api/action','/api/automations','./api/automation','/api/canned_answers','/api/dispositions','./api/condition','/api/intervals','./api/interval','/api/pauses','/api/voiceQueuesLog','./api/voiceQueuesLog','/api/schedules','./api/schedule','/api/sounds','./api/sound','/api/templates','./api/template','/api/variables','./api/variable','/api/integrations','./api/integration','./api/integrationReport','/api/analytics/custom_reports','./api/analyticCustomReport','/api/analytics/default_reports','./api/analyticDefaultReport','/api/analytics/extracted_reports','./api/analyticExtractedReport','/api/analytics/metrics','./api/analyticMetric','/api/analytics/field_reports','./api/analyticFieldReport','/api/analytics/tree_reports','./api/intSalesforceAccount','/api/integrations/salesforce/configurations','/api/integrations/salesforce/fields','./api/intSalesforceField','/api/integrations/sugarcrm/accounts','./api/intSugarcrmAccount','/api/integrations/sugarcrm/configurations','./api/intSugarcrmConfiguration','/api/integrations/sugarcrm/fields','./api/intDeskConfiguration','./api/intDeskField','/api/integrations/zoho/accounts','/api/integrations/zoho/configurations','./api/intZohoField','/api/integrations/zendesk/accounts','./api/intZendeskAccount','/api/integrations/zendesk/configurations','./api/intZendeskConfiguration','/api/integrations/zendesk/fields','./api/intZendeskField','./api/intFreshdeskAccount','/api/integrations/freshdesk/configurations','./api/intFreshdeskConfiguration','/api/integrations/freshdesk/fields','/api/integrations/vtiger/accounts','./api/intVtigerAccount','/api/integrations/vtiger/configurations','./api/intVtigerConfiguration','/api/integrations/vtiger/fields','./api/intVtigerField','/api/integrations/servicenow/accounts','./api/intServicenowAccount','./api/intServicenowConfiguration','./api/intServicenowField','/api/integrations/dynamics365/accounts','/api/integrations/dynamics365/configurations','/api/integrations/dynamics365/fields','./api/intDynamics365Field','/api/integrations/freshsales/accounts','./api/intFreshsalesAccount','/api/integrations/freshsales/configurations','./api/intFreshsalesConfiguration','/api/integrations/freshsales/fields','/api/networks','./api/network','/api/chat/internal/messages','/api/jscripty/answers/reports','./api/jscriptyAnswerReport','/api/jscripty/questions/reports','./api/jscriptyQuestionReport','/api/jscripty/sessions/reports','./api/jscriptySessionReport','/api/square/reports','./api/squareReport','/api/jscripty/projects','./api/jscriptyProject','/api/settings','./api/setting','/api/square/odbc','./api/squareOdbc','/api/square/projects','./api/squareProject','/api/square/recordings','/api/square/messages','./api/squareMessage','/api/teams','./api/team','/api/license','./api/license','/api/campaigns','./api/campaign','/api/migrations','./api/migration','/api/attachments','./api/attachment','/api/plugins','./api/plugin','/api/mail/reports/transfer','./api/mailTransferReport','/api/chat/reports/transfer','./api/chatTransferReport','/api/fax/reports/transfer','./api/faxTransferReport','./api/openchannelTransferReport','./api/smsTransferReport','/api/cm/lists','./api/cmList','/api/voice/prefixes','./api/voicePrefix','/api/userProfiles','./api/userProfile','./api/userProfileSection','./api/userProfileResource','/api/auth/local','./api/authLocal','/api/auth/google','/api/jira','./api/jira','/api/rpc','./api/rpc','/api/system','./api/system','/api/pm2','./api/pm2','/apidoc','static','join','root','/www','/demo','/snippet','snippet','/plugins','/server/files/plugins','route','/:url(api|auth|components|app|bower_components|assets)/*','sendFile','resolve','appPath','/index.html','path','express','express-winston','util','./config/environment','./config/logger','auth','default','use','logger','format','method','headers','x-forwarded-for','connection','url','statusCode','responseTime','user','%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)','remoteAddress','name','other','agent_name','/api/users','./api/voiceChanSpy','/api/voice/contexts','./api/voiceContext','./api/voiceExtension','/api/voice/mohs','./api/voiceMusicOnHold','/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/calls/reports','./api/voiceCallReport','./api/voiceDialReport','/api/voice/agents/reports','./api/voiceQueueReport','/api/members/reports','/api/trunks','./api/trunk','/api/voice/transfers/reports','./api/voiceTransferReport','./api/mailAccount','/api/mail/queues','./api/mailQueue','/api/mail/substatuses','/api/mail/interactions','./api/mailInteraction','/api/mail/messages','/api/mail/applications','./api/mailApplication','/api/mail/reports/queue','./api/mailQueueReport','/api/dashboards','./api/dashboard','/api/dashboards/items','/api/fax/accounts','./api/faxAccount','/api/fax/applications','./api/faxApplication','./api/faxMessage','/api/fax/queues'];(function(_0x416d75,_0x2c8e81){var _0x10af66=function(_0x48f136){while(--_0x48f136){_0x416d75['push'](_0x416d75['shift']());}};_0x10af66(++_0x2c8e81);}(_0xf749,0x1cf));var _0x9f74=function(_0x46e363,_0x45d7e2){_0x46e363=_0x46e363-0x0;var _0x3fb059=_0xf749[_0x46e363];return _0x3fb059;};'use strict';var path=require(_0x9f74('0x0'));var express=require(_0x9f74('0x1'));var ewinston=require(_0x9f74('0x2'));var util=require(_0x9f74('0x3'));var errors=require('./errors');var config=require(_0x9f74('0x4'));var logger=require(_0x9f74('0x5'))('api');var authLogger=require(_0x9f74('0x5'))(_0x9f74('0x6'));exports[_0x9f74('0x7')]=function(_0x495645){_0x495645[_0x9f74('0x8')](ewinston[_0x9f74('0x9')]({'winstonInstance':logger,'meta':![],'statusLevels':!![],'msg':function(_0x35bdaa,_0x59f508){return util[_0x9f74('0xa')]('%s\x20%s\x20%s\x20%s\x20%sms\x20id=%s\x20name=%s\x20role=%s',_0x35bdaa[_0x9f74('0xb')],_0x35bdaa[_0x9f74('0xc')][_0x9f74('0xd')]?_0x35bdaa[_0x9f74('0xc')]['x-forwarded-for']:_0x35bdaa[_0x9f74('0xe')]['remoteAddress']||_0x35bdaa['ip'],_0x35bdaa[_0x9f74('0xf')],_0x59f508[_0x9f74('0x10')],_0x59f508[_0x9f74('0x11')],_0x35bdaa[_0x9f74('0x12')]?_0x35bdaa['user']['id']:null,_0x35bdaa[_0x9f74('0x12')]?_0x35bdaa['user']['name']:null,_0x35bdaa[_0x9f74('0x12')]?_0x35bdaa[_0x9f74('0x12')]['role']:null);}}));_0x495645[_0x9f74('0x8')](ewinston[_0x9f74('0x9')]({'winstonInstance':authLogger,'meta':![],'statusLevels':!![],'msg':function(_0x36a938,_0x2e4ba1){var _0x3a2f93=_0x9f74('0x13');if(_0x36a938[_0x9f74('0x14')]&&_0x36a938[_0x9f74('0x14')][_0x9f74('0x15')]&&_0x36a938['body'][_0x9f74('0x16')]){_0x3a2f93=_0x9f74('0x17');}return util[_0x9f74('0xa')](_0x3a2f93,_0x36a938[_0x9f74('0xb')],_0x36a938['headers'][_0x9f74('0xd')]?_0x36a938['headers']['x-forwarded-for']:_0x36a938[_0x9f74('0xe')][_0x9f74('0x18')]||_0x36a938['ip'],_0x36a938[_0x9f74('0xf')],_0x2e4ba1['statusCode'],_0x2e4ba1[_0x9f74('0x11')],_0x36a938[_0x9f74('0x12')]?_0x36a938[_0x9f74('0x12')]['id']:null,_0x36a938['user']?_0x36a938['user'][_0x9f74('0x19')]:null,_0x36a938[_0x9f74('0x12')]?_0x36a938[_0x9f74('0x12')]['role']:null,_0x36a938['body']&&_0x36a938['body'][_0x9f74('0x15')]?_0x36a938[_0x9f74('0x14')][_0x9f74('0x15')]:_0x9f74('0x1a'),_0x36a938[_0x9f74('0x14')]&&_0x36a938[_0x9f74('0x14')][_0x9f74('0x16')]?_0x36a938[_0x9f74('0x14')][_0x9f74('0x16')]:'',_0x36a938[_0x9f74('0x14')]&&_0x36a938[_0x9f74('0x14')][_0x9f74('0x1b')]?_0x36a938[_0x9f74('0x14')][_0x9f74('0x1b')]:'');},'ignoreRoute':function(_0x3d889f){var _0x559b91=/\/api\/users\/[0-9]+\/(login|logout)/gi;return!_0x559b91['test'](_0x3d889f[_0x9f74('0xf')]);}}));_0x495645[_0x9f74('0x8')](_0x9f74('0x1c'),require('./api/user'));_0x495645['use']('/api/voice/chanspy',require(_0x9f74('0x1d')));_0x495645['use'](_0x9f74('0x1e'),require(_0x9f74('0x1f')));_0x495645[_0x9f74('0x8')]('/api/voice/extensions',require(_0x9f74('0x20')));_0x495645['use'](_0x9f74('0x21'),require(_0x9f74('0x22')));_0x495645['use'](_0x9f74('0x23'),require(_0x9f74('0x24')));_0x495645[_0x9f74('0x8')](_0x9f74('0x25'),require(_0x9f74('0x26')));_0x495645['use'](_0x9f74('0x27'),require(_0x9f74('0x28')));_0x495645[_0x9f74('0x8')](_0x9f74('0x29'),require(_0x9f74('0x2a')));_0x495645['use'](_0x9f74('0x2b'),require(_0x9f74('0x2c')));_0x495645[_0x9f74('0x8')](_0x9f74('0x2d'),require(_0x9f74('0x2e')));_0x495645[_0x9f74('0x8')]('/api/voice/dials/reports',require(_0x9f74('0x2f')));_0x495645[_0x9f74('0x8')](_0x9f74('0x30'),require('./api/voiceAgentReport'));_0x495645[_0x9f74('0x8')]('/api/voice/queues/reports',require(_0x9f74('0x31')));_0x495645['use'](_0x9f74('0x32'),require('./api/memberReport'));_0x495645['use'](_0x9f74('0x33'),require(_0x9f74('0x34')));_0x495645[_0x9f74('0x8')](_0x9f74('0x35'),require(_0x9f74('0x36')));_0x495645[_0x9f74('0x8')]('/api/mail/out_servers',require('./api/mailServerOut'));_0x495645[_0x9f74('0x8')]('/api/mail/accounts',require(_0x9f74('0x37')));_0x495645[_0x9f74('0x8')](_0x9f74('0x38'),require(_0x9f74('0x39')));_0x495645[_0x9f74('0x8')](_0x9f74('0x3a'),require('./api/mailSubstatus'));_0x495645[_0x9f74('0x8')](_0x9f74('0x3b'),require(_0x9f74('0x3c')));_0x495645['use'](_0x9f74('0x3d'),require('./api/mailMessage'));_0x495645[_0x9f74('0x8')](_0x9f74('0x3e'),require(_0x9f74('0x3f')));_0x495645['use'](_0x9f74('0x40'),require(_0x9f74('0x41')));_0x495645[_0x9f74('0x8')](_0x9f74('0x42'),require(_0x9f74('0x43')));_0x495645[_0x9f74('0x8')](_0x9f74('0x44'),require('./api/dashboardItem'));_0x495645[_0x9f74('0x8')](_0x9f74('0x45'),require(_0x9f74('0x46')));_0x495645[_0x9f74('0x8')](_0x9f74('0x47'),require(_0x9f74('0x48')));_0x495645[_0x9f74('0x8')]('/api/fax/interactions',require('./api/faxInteraction'));_0x495645[_0x9f74('0x8')]('/api/fax/messages',require(_0x9f74('0x49')));_0x495645[_0x9f74('0x8')](_0x9f74('0x4a'),require('./api/faxQueue'));_0x495645[_0x9f74('0x8')](_0x9f74('0x4b'),require(_0x9f74('0x4c')));_0x495645[_0x9f74('0x8')](_0x9f74('0x4d'),require('./api/smsAccount'));_0x495645[_0x9f74('0x8')]('/api/sms/applications',require(_0x9f74('0x4e')));_0x495645[_0x9f74('0x8')]('/api/sms/interactions',require(_0x9f74('0x4f')));_0x495645[_0x9f74('0x8')](_0x9f74('0x50'),require(_0x9f74('0x51')));_0x495645[_0x9f74('0x8')](_0x9f74('0x52'),require(_0x9f74('0x53')));_0x495645[_0x9f74('0x8')](_0x9f74('0x54'),require('./api/openchannelAccount'));_0x495645[_0x9f74('0x8')](_0x9f74('0x55'),require(_0x9f74('0x56')));_0x495645['use']('/api/openchannel/interactions',require(_0x9f74('0x57')));_0x495645[_0x9f74('0x8')](_0x9f74('0x58'),require(_0x9f74('0x59')));_0x495645[_0x9f74('0x8')](_0x9f74('0x5a'),require('./api/openchannelQueue'));_0x495645[_0x9f74('0x8')]('/api/chat/websites',require(_0x9f74('0x5b')));_0x495645[_0x9f74('0x8')](_0x9f74('0x5c'),require('./api/openchannelQueueReport'));_0x495645[_0x9f74('0x8')]('/api/chat/applications',require('./api/chatApplication'));_0x495645[_0x9f74('0x8')](_0x9f74('0x5d'),require(_0x9f74('0x5e')));_0x495645[_0x9f74('0x8')](_0x9f74('0x5f'),require(_0x9f74('0x60')));_0x495645['use'](_0x9f74('0x61'),require(_0x9f74('0x62')));_0x495645[_0x9f74('0x8')]('/api/chat/queues',require(_0x9f74('0x63')));_0x495645[_0x9f74('0x8')](_0x9f74('0x64'),require(_0x9f74('0x65')));_0x495645[_0x9f74('0x8')](_0x9f74('0x66'),require(_0x9f74('0x67')));_0x495645[_0x9f74('0x8')]('/api/cm/companies',require(_0x9f74('0x68')));_0x495645[_0x9f74('0x8')](_0x9f74('0x69'),require(_0x9f74('0x6a')));_0x495645[_0x9f74('0x8')](_0x9f74('0x6b'),require(_0x9f74('0x6c')));_0x495645[_0x9f74('0x8')](_0x9f74('0x6d'),require(_0x9f74('0x6e')));_0x495645[_0x9f74('0x8')](_0x9f74('0x6f'),require(_0x9f74('0x70')));_0x495645[_0x9f74('0x8')]('/api/cm/hopper_history',require(_0x9f74('0x71')));_0x495645[_0x9f74('0x8')](_0x9f74('0x72'),require(_0x9f74('0x73')));_0x495645[_0x9f74('0x8')]('/api/actions',require(_0x9f74('0x74')));_0x495645['use'](_0x9f74('0x75'),require(_0x9f74('0x76')));_0x495645[_0x9f74('0x8')](_0x9f74('0x77'),require('./api/cannedAnswer'));_0x495645['use'](_0x9f74('0x78'),require('./api/disposition'));_0x495645['use']('/api/conditions',require(_0x9f74('0x79')));_0x495645[_0x9f74('0x8')](_0x9f74('0x7a'),require(_0x9f74('0x7b')));_0x495645['use'](_0x9f74('0x7c'),require('./api/pause'));_0x495645[_0x9f74('0x8')]('/api/cdr',require('./api/cdr'));_0x495645[_0x9f74('0x8')](_0x9f74('0x7d'),require(_0x9f74('0x7e')));_0x495645['use'](_0x9f74('0x7f'),require(_0x9f74('0x80')));_0x495645[_0x9f74('0x8')](_0x9f74('0x81'),require(_0x9f74('0x82')));_0x495645[_0x9f74('0x8')]('/api/tags',require('./api/tag'));_0x495645[_0x9f74('0x8')](_0x9f74('0x83'),require(_0x9f74('0x84')));_0x495645[_0x9f74('0x8')]('/api/triggers',require('./api/trigger'));_0x495645[_0x9f74('0x8')](_0x9f74('0x85'),require(_0x9f74('0x86')));_0x495645['use'](_0x9f74('0x87'),require(_0x9f74('0x88')));_0x495645[_0x9f74('0x8')]('/api/integrations/reports',require(_0x9f74('0x89')));_0x495645[_0x9f74('0x8')](_0x9f74('0x8a'),require(_0x9f74('0x8b')));_0x495645[_0x9f74('0x8')](_0x9f74('0x8c'),require(_0x9f74('0x8d')));_0x495645[_0x9f74('0x8')](_0x9f74('0x8e'),require(_0x9f74('0x8f')));_0x495645[_0x9f74('0x8')](_0x9f74('0x90'),require(_0x9f74('0x91')));_0x495645[_0x9f74('0x8')](_0x9f74('0x92'),require(_0x9f74('0x93')));_0x495645[_0x9f74('0x8')](_0x9f74('0x94'),require('./api/analyticTreeReport'));_0x495645[_0x9f74('0x8')]('/api/integrations/salesforce/accounts',require(_0x9f74('0x95')));_0x495645[_0x9f74('0x8')](_0x9f74('0x96'),require('./api/intSalesforceConfiguration'));_0x495645[_0x9f74('0x8')](_0x9f74('0x97'),require(_0x9f74('0x98')));_0x495645[_0x9f74('0x8')](_0x9f74('0x99'),require(_0x9f74('0x9a')));_0x495645['use'](_0x9f74('0x9b'),require(_0x9f74('0x9c')));_0x495645[_0x9f74('0x8')](_0x9f74('0x9d'),require('./api/intSugarcrmField'));_0x495645['use']('/api/integrations/desk/accounts',require('./api/intDeskAccount'));_0x495645[_0x9f74('0x8')]('/api/integrations/desk/configurations',require(_0x9f74('0x9e')));_0x495645[_0x9f74('0x8')]('/api/integrations/desk/fields',require(_0x9f74('0x9f')));_0x495645[_0x9f74('0x8')](_0x9f74('0xa0'),require('./api/intZohoAccount'));_0x495645[_0x9f74('0x8')](_0x9f74('0xa1'),require('./api/intZohoConfiguration'));_0x495645[_0x9f74('0x8')]('/api/integrations/zoho/fields',require(_0x9f74('0xa2')));_0x495645[_0x9f74('0x8')](_0x9f74('0xa3'),require(_0x9f74('0xa4')));_0x495645[_0x9f74('0x8')](_0x9f74('0xa5'),require(_0x9f74('0xa6')));_0x495645[_0x9f74('0x8')](_0x9f74('0xa7'),require(_0x9f74('0xa8')));_0x495645[_0x9f74('0x8')]('/api/integrations/freshdesk/accounts',require(_0x9f74('0xa9')));_0x495645[_0x9f74('0x8')](_0x9f74('0xaa'),require(_0x9f74('0xab')));_0x495645[_0x9f74('0x8')](_0x9f74('0xac'),require('./api/intFreshdeskField'));_0x495645['use'](_0x9f74('0xad'),require(_0x9f74('0xae')));_0x495645[_0x9f74('0x8')](_0x9f74('0xaf'),require(_0x9f74('0xb0')));_0x495645[_0x9f74('0x8')](_0x9f74('0xb1'),require(_0x9f74('0xb2')));_0x495645[_0x9f74('0x8')](_0x9f74('0xb3'),require(_0x9f74('0xb4')));_0x495645['use']('/api/integrations/servicenow/configurations',require(_0x9f74('0xb5')));_0x495645['use']('/api/integrations/servicenow/fields',require(_0x9f74('0xb6')));_0x495645[_0x9f74('0x8')](_0x9f74('0xb7'),require('./api/intDynamics365Account'));_0x495645[_0x9f74('0x8')](_0x9f74('0xb8'),require('./api/intDynamics365Configuration'));_0x495645[_0x9f74('0x8')](_0x9f74('0xb9'),require(_0x9f74('0xba')));_0x495645[_0x9f74('0x8')](_0x9f74('0xbb'),require(_0x9f74('0xbc')));_0x495645[_0x9f74('0x8')](_0x9f74('0xbd'),require(_0x9f74('0xbe')));_0x495645[_0x9f74('0x8')](_0x9f74('0xbf'),require('./api/intFreshsalesField'));_0x495645['use'](_0x9f74('0xc0'),require(_0x9f74('0xc1')));_0x495645[_0x9f74('0x8')]('/api/chat/reports/queue',require('./api/chatQueueReport'));_0x495645[_0x9f74('0x8')](_0x9f74('0xc2'),require('./api/chatInternalMessage'));_0x495645[_0x9f74('0x8')](_0x9f74('0xc3'),require(_0x9f74('0xc4')));_0x495645[_0x9f74('0x8')](_0x9f74('0xc5'),require(_0x9f74('0xc6')));_0x495645[_0x9f74('0x8')](_0x9f74('0xc7'),require(_0x9f74('0xc8')));_0x495645[_0x9f74('0x8')]('/api/sms/reports/queue',require('./api/smsQueueReport'));_0x495645['use'](_0x9f74('0xc9'),require(_0x9f74('0xca')));_0x495645[_0x9f74('0x8')]('/api/square/details/reports',require('./api/squareReportDetail'));_0x495645['use'](_0x9f74('0xcb'),require(_0x9f74('0xcc')));_0x495645['use'](_0x9f74('0xcd'),require(_0x9f74('0xce')));_0x495645[_0x9f74('0x8')](_0x9f74('0xcf'),require(_0x9f74('0xd0')));_0x495645[_0x9f74('0x8')](_0x9f74('0xd1'),require(_0x9f74('0xd2')));_0x495645[_0x9f74('0x8')](_0x9f74('0xd3'),require('./api/squareRecording'));_0x495645[_0x9f74('0x8')](_0x9f74('0xd4'),require(_0x9f74('0xd5')));_0x495645[_0x9f74('0x8')](_0x9f74('0xd6'),require(_0x9f74('0xd7')));_0x495645[_0x9f74('0x8')](_0x9f74('0xd8'),require(_0x9f74('0xd9')));_0x495645[_0x9f74('0x8')](_0x9f74('0xda'),require(_0x9f74('0xdb')));_0x495645['use'](_0x9f74('0xdc'),require(_0x9f74('0xdd')));_0x495645[_0x9f74('0x8')](_0x9f74('0xde'),require(_0x9f74('0xdf')));_0x495645[_0x9f74('0x8')](_0x9f74('0xe0'),require(_0x9f74('0xe1')));_0x495645[_0x9f74('0x8')](_0x9f74('0xe2'),require(_0x9f74('0xe3')));_0x495645[_0x9f74('0x8')](_0x9f74('0xe4'),require(_0x9f74('0xe5')));_0x495645[_0x9f74('0x8')](_0x9f74('0xe6'),require(_0x9f74('0xe7')));_0x495645[_0x9f74('0x8')]('/api/openchannel/reports/transfer',require(_0x9f74('0xe8')));_0x495645['use']('/api/sms/reports/transfer',require(_0x9f74('0xe9')));_0x495645[_0x9f74('0x8')](_0x9f74('0xea'),require(_0x9f74('0xeb')));_0x495645[_0x9f74('0x8')](_0x9f74('0xec'),require(_0x9f74('0xed')));_0x495645[_0x9f74('0x8')](_0x9f74('0xee'),require(_0x9f74('0xef')));_0x495645[_0x9f74('0x8')]('/api/userProfile/sections',require(_0x9f74('0xf0')));_0x495645['use']('/api/userProfile/resources',require(_0x9f74('0xf1')));_0x495645['use'](_0x9f74('0xf2'),require(_0x9f74('0xf3')));_0x495645[_0x9f74('0x8')](_0x9f74('0xf4'),require('./api/authGoogle'));_0x495645[_0x9f74('0x8')](_0x9f74('0xf5'),require(_0x9f74('0xf6')));_0x495645[_0x9f74('0x8')](_0x9f74('0xf7'),require(_0x9f74('0xf8')));_0x495645['use']('/api/version',require('./api/version'));_0x495645[_0x9f74('0x8')](_0x9f74('0xf9'),require(_0x9f74('0xfa')));_0x495645[_0x9f74('0x8')](_0x9f74('0xfb'),require(_0x9f74('0xfc')));_0x495645[_0x9f74('0x8')](_0x9f74('0xfd'),express[_0x9f74('0xfe')](path[_0x9f74('0xff')](config[_0x9f74('0x100')],_0x9f74('0xfd'))));_0x495645[_0x9f74('0x8')](_0x9f74('0x101'),express['static'](path[_0x9f74('0xff')](config[_0x9f74('0x100')],_0x9f74('0x101'))));_0x495645[_0x9f74('0x8')](_0x9f74('0x102'),express[_0x9f74('0xfe')](path[_0x9f74('0xff')](config[_0x9f74('0x100')],'/demo')));_0x495645['use'](_0x9f74('0x103'),express[_0x9f74('0xfe')](path[_0x9f74('0xff')](config[_0x9f74('0x100')],_0x9f74('0x104'),'1.0.16')));_0x495645[_0x9f74('0x8')](_0x9f74('0x105'),express['static'](path[_0x9f74('0xff')](config[_0x9f74('0x100')],_0x9f74('0x106'))));_0x495645[_0x9f74('0x107')](_0x9f74('0x108'))['get'](errors[0x194]);_0x495645[_0x9f74('0x107')]('/*')['get'](function(_0x504424,_0x1ae83a){_0x1ae83a[_0x9f74('0x109')](path[_0x9f74('0x10a')](_0x495645['get'](_0x9f74('0x10b'))+_0x9f74('0x10c')));});}; \ No newline at end of file +var _0xc8c4=['./api/schedule','/api/sounds','./api/sound','/api/tags','./api/tag','/api/templates','/api/triggers','./api/trigger','/api/variables','./api/variable','/api/analytics/custom_reports','/api/analytics/default_reports','./api/analyticDefaultReport','/api/analytics/extracted_reports','./api/analyticExtractedReport','/api/analytics/metrics','/api/analytics/field_reports','./api/analyticFieldReport','./api/analyticTreeReport','/api/integrations/salesforce/accounts','./api/intSalesforceAccount','/api/integrations/salesforce/configurations','/api/integrations/salesforce/fields','./api/intSalesforceField','/api/integrations/sugarcrm/accounts','./api/intSugarcrmAccount','/api/integrations/sugarcrm/configurations','/api/integrations/desk/fields','./api/intDeskField','/api/integrations/zoho/accounts','./api/intZohoAccount','/api/integrations/zoho/configurations','./api/intZohoConfiguration','/api/integrations/zendesk/accounts','/api/integrations/zendesk/configurations','./api/intZendeskConfiguration','./api/intZendeskField','/api/integrations/freshdesk/accounts','./api/intFreshdeskAccount','/api/integrations/freshdesk/configurations','./api/intFreshdeskConfiguration','/api/integrations/freshdesk/fields','./api/intFreshdeskField','/api/integrations/vtiger/configurations','/api/integrations/vtiger/fields','./api/intVtigerField','/api/integrations/servicenow/accounts','./api/intServicenowAccount','/api/integrations/servicenow/configurations','./api/intServicenowField','/api/integrations/dynamics365/accounts','./api/intDynamics365Account','/api/integrations/dynamics365/configurations','./api/intDynamics365Configuration','/api/integrations/dynamics365/fields','./api/intDynamics365Field','/api/integrations/freshsales/accounts','./api/intFreshsalesAccount','/api/integrations/freshsales/configurations','./api/intFreshsalesConfiguration','/api/integrations/freshsales/fields','./api/intFreshsalesField','/api/networks','./api/network','/api/chat/reports/queue','./api/chatQueueReport','/api/chat/internal/messages','./api/jscriptyAnswerReport','./api/jscriptyQuestionReport','/api/jscripty/sessions/reports','./api/jscriptySessionReport','./api/smsQueueReport','/api/square/reports','./api/squareReport','/api/square/details/reports','./api/squareReportDetail','/api/jscripty/projects','./api/jscriptyProject','/api/settings','./api/setting','/api/square/odbc','./api/squareProject','./api/squareRecording','/api/square/messages','./api/squareMessage','/api/teams','/api/license','./api/license','./api/campaign','/api/migrations','/api/attachments','./api/attachment','/api/mail/reports/transfer','./api/mailTransferReport','/api/chat/reports/transfer','./api/chatTransferReport','/api/fax/reports/transfer','./api/faxTransferReport','./api/openchannelTransferReport','/api/sms/reports/transfer','./api/smsTransferReport','/api/cm/lists','./api/cmList','/api/voice/prefixes','./api/userProfile','/api/userProfile/sections','./api/userProfileSection','/api/userProfile/resources','./api/userProfileResource','/api/auth/local','./api/authLocal','/api/auth/google','./api/authGoogle','/api/jira','./api/jira','/api/rpc','./api/rpc','./api/version','./api/system','/apidoc','join','root','static','/demo','/snippet','snippet','1.0.16','/plugins','/server/files/plugins','route','/:url(api|auth|components|app|bower_components|assets)/*','resolve','get','appPath','/index.html','path','util','./errors','./config/logger','auth','default','use','logger','format','%s\x20%s\x20%s\x20%s\x20%sms\x20id=%s\x20name=%s\x20role=%s','method','x-forwarded-for','headers','connection','remoteAddress','url','statusCode','responseTime','user','role','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)','name','body','other','test','/api/users','./api/user','./api/voiceChanSpy','/api/voice/contexts','/api/voice/extensions','./api/voiceExtension','/api/voice/mohs','./api/voiceMusicOnHold','./api/voiceQueue','/api/voice/recordings','./api/voiceRecording','./api/screenRecording','/api/voice/mails','./api/voiceMailMessage','./api/voiceCallReport','/api/voice/dials/reports','./api/voiceDialReport','/api/voice/agents/reports','/api/voice/queues/reports','./api/voiceQueueReport','/api/members/reports','./api/memberReport','/api/trunks','./api/trunk','/api/voice/transfers/reports','./api/voiceTransferReport','/api/mail/out_servers','./api/mailQueue','/api/mail/substatuses','/api/mail/interactions','./api/mailInteraction','./api/mailMessage','./api/mailApplication','/api/mail/reports/queue','./api/mailQueueReport','/api/dashboards','./api/dashboard','/api/dashboards/items','./api/dashboardItem','/api/fax/accounts','./api/faxAccount','./api/faxApplication','/api/fax/interactions','/api/fax/messages','./api/faxMessage','/api/fax/queues','./api/faxQueue','/api/fax/reports/queue','./api/faxQueueReport','/api/sms/accounts','/api/sms/interactions','./api/smsInteraction','/api/sms/messages','./api/smsMessage','/api/sms/queues','./api/smsQueue','/api/openchannel/accounts','/api/openchannel/applications','./api/openchannelApplication','/api/openchannel/interactions','./api/openchannelInteraction','/api/openchannel/messages','./api/openchannelMessage','/api/openchannel/queues','./api/openchannelQueue','/api/chat/websites','/api/openchannel/reports/queue','./api/openchannelQueueReport','/api/chat/applications','./api/chatApplication','/api/chat/interactions','./api/chatInteraction','/api/chat/messages','./api/chatMessage','/api/chat/offline_messages','./api/chatOfflineMessage','/api/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/cmHopperHistory','/api/cm/custom_fields','./api/cmCustomField','/api/actions','./api/action','/api/automations','./api/automation','/api/canned_answers','./api/disposition','/api/intervals','./api/interval','/api/pauses','./api/pause','./api/cdr','/api/voiceQueuesLog','/api/schedules'];(function(_0x57fcc0,_0x585004){var _0x5270df=function(_0x5f2db0){while(--_0x5f2db0){_0x57fcc0['push'](_0x57fcc0['shift']());}};_0x5270df(++_0x585004);}(_0xc8c4,0x193));var _0x4c8c=function(_0x3f43ef,_0x4c2ba9){_0x3f43ef=_0x3f43ef-0x0;var _0x20af43=_0xc8c4[_0x3f43ef];return _0x20af43;};'use strict';var path=require(_0x4c8c('0x0'));var express=require('express');var ewinston=require('express-winston');var util=require(_0x4c8c('0x1'));var errors=require(_0x4c8c('0x2'));var config=require('./config/environment');var logger=require('./config/logger')('api');var authLogger=require(_0x4c8c('0x3'))(_0x4c8c('0x4'));exports[_0x4c8c('0x5')]=function(_0x2bf158){_0x2bf158[_0x4c8c('0x6')](ewinston[_0x4c8c('0x7')]({'winstonInstance':logger,'meta':![],'statusLevels':!![],'msg':function(_0x485f18,_0x414fb8){return util[_0x4c8c('0x8')](_0x4c8c('0x9'),_0x485f18[_0x4c8c('0xa')],_0x485f18['headers'][_0x4c8c('0xb')]?_0x485f18[_0x4c8c('0xc')][_0x4c8c('0xb')]:_0x485f18[_0x4c8c('0xd')][_0x4c8c('0xe')]||_0x485f18['ip'],_0x485f18[_0x4c8c('0xf')],_0x414fb8[_0x4c8c('0x10')],_0x414fb8[_0x4c8c('0x11')],_0x485f18[_0x4c8c('0x12')]?_0x485f18['user']['id']:null,_0x485f18[_0x4c8c('0x12')]?_0x485f18[_0x4c8c('0x12')]['name']:null,_0x485f18[_0x4c8c('0x12')]?_0x485f18[_0x4c8c('0x12')][_0x4c8c('0x13')]:null);}}));_0x2bf158[_0x4c8c('0x6')](ewinston['logger']({'winstonInstance':authLogger,'meta':![],'statusLevels':!![],'msg':function(_0x2b93dc,_0x3deef7){var _0x53b3e7='%s\x20%s\x20%s\x20%s\x20%sms\x20id=%s\x20name=%s\x20role=%s\x20device=%s';if(_0x2b93dc['body']&&_0x2b93dc['body'][_0x4c8c('0x14')]&&_0x2b93dc['body'][_0x4c8c('0x15')]){_0x53b3e7=_0x4c8c('0x16');}return util[_0x4c8c('0x8')](_0x53b3e7,_0x2b93dc[_0x4c8c('0xa')],_0x2b93dc[_0x4c8c('0xc')][_0x4c8c('0xb')]?_0x2b93dc['headers'][_0x4c8c('0xb')]:_0x2b93dc[_0x4c8c('0xd')][_0x4c8c('0xe')]||_0x2b93dc['ip'],_0x2b93dc[_0x4c8c('0xf')],_0x3deef7['statusCode'],_0x3deef7[_0x4c8c('0x11')],_0x2b93dc[_0x4c8c('0x12')]?_0x2b93dc[_0x4c8c('0x12')]['id']:null,_0x2b93dc[_0x4c8c('0x12')]?_0x2b93dc[_0x4c8c('0x12')][_0x4c8c('0x17')]:null,_0x2b93dc[_0x4c8c('0x12')]?_0x2b93dc['user'][_0x4c8c('0x13')]:null,_0x2b93dc[_0x4c8c('0x18')]&&_0x2b93dc[_0x4c8c('0x18')][_0x4c8c('0x14')]?_0x2b93dc['body']['device']:_0x4c8c('0x19'),_0x2b93dc[_0x4c8c('0x18')]&&_0x2b93dc[_0x4c8c('0x18')][_0x4c8c('0x15')]?_0x2b93dc[_0x4c8c('0x18')][_0x4c8c('0x15')]:'',_0x2b93dc[_0x4c8c('0x18')]&&_0x2b93dc[_0x4c8c('0x18')]['agent_name']?_0x2b93dc[_0x4c8c('0x18')]['agent_name']:'');},'ignoreRoute':function(_0x2f3958){var _0x4f805d=/\/api\/users\/[0-9]+\/(login|logout)/gi;return!_0x4f805d[_0x4c8c('0x1a')](_0x2f3958[_0x4c8c('0xf')]);}}));_0x2bf158['use'](_0x4c8c('0x1b'),require(_0x4c8c('0x1c')));_0x2bf158['use']('/api/voice/chanspy',require(_0x4c8c('0x1d')));_0x2bf158[_0x4c8c('0x6')](_0x4c8c('0x1e'),require('./api/voiceContext'));_0x2bf158['use'](_0x4c8c('0x1f'),require(_0x4c8c('0x20')));_0x2bf158[_0x4c8c('0x6')](_0x4c8c('0x21'),require(_0x4c8c('0x22')));_0x2bf158['use']('/api/voice/queues',require(_0x4c8c('0x23')));_0x2bf158[_0x4c8c('0x6')](_0x4c8c('0x24'),require(_0x4c8c('0x25')));_0x2bf158[_0x4c8c('0x6')]('/api/screen/recordings',require(_0x4c8c('0x26')));_0x2bf158[_0x4c8c('0x6')](_0x4c8c('0x27'),require('./api/voiceMail'));_0x2bf158['use']('/api/voice/mails/messages',require(_0x4c8c('0x28')));_0x2bf158[_0x4c8c('0x6')]('/api/voice/calls/reports',require(_0x4c8c('0x29')));_0x2bf158[_0x4c8c('0x6')](_0x4c8c('0x2a'),require(_0x4c8c('0x2b')));_0x2bf158[_0x4c8c('0x6')](_0x4c8c('0x2c'),require('./api/voiceAgentReport'));_0x2bf158['use'](_0x4c8c('0x2d'),require(_0x4c8c('0x2e')));_0x2bf158[_0x4c8c('0x6')](_0x4c8c('0x2f'),require(_0x4c8c('0x30')));_0x2bf158['use'](_0x4c8c('0x31'),require(_0x4c8c('0x32')));_0x2bf158['use'](_0x4c8c('0x33'),require(_0x4c8c('0x34')));_0x2bf158[_0x4c8c('0x6')](_0x4c8c('0x35'),require('./api/mailServerOut'));_0x2bf158['use']('/api/mail/accounts',require('./api/mailAccount'));_0x2bf158['use']('/api/mail/queues',require(_0x4c8c('0x36')));_0x2bf158[_0x4c8c('0x6')](_0x4c8c('0x37'),require('./api/mailSubstatus'));_0x2bf158[_0x4c8c('0x6')](_0x4c8c('0x38'),require(_0x4c8c('0x39')));_0x2bf158[_0x4c8c('0x6')]('/api/mail/messages',require(_0x4c8c('0x3a')));_0x2bf158[_0x4c8c('0x6')]('/api/mail/applications',require(_0x4c8c('0x3b')));_0x2bf158['use'](_0x4c8c('0x3c'),require(_0x4c8c('0x3d')));_0x2bf158[_0x4c8c('0x6')](_0x4c8c('0x3e'),require(_0x4c8c('0x3f')));_0x2bf158['use'](_0x4c8c('0x40'),require(_0x4c8c('0x41')));_0x2bf158[_0x4c8c('0x6')](_0x4c8c('0x42'),require(_0x4c8c('0x43')));_0x2bf158[_0x4c8c('0x6')]('/api/fax/applications',require(_0x4c8c('0x44')));_0x2bf158[_0x4c8c('0x6')](_0x4c8c('0x45'),require('./api/faxInteraction'));_0x2bf158[_0x4c8c('0x6')](_0x4c8c('0x46'),require(_0x4c8c('0x47')));_0x2bf158[_0x4c8c('0x6')](_0x4c8c('0x48'),require(_0x4c8c('0x49')));_0x2bf158[_0x4c8c('0x6')](_0x4c8c('0x4a'),require(_0x4c8c('0x4b')));_0x2bf158['use'](_0x4c8c('0x4c'),require('./api/smsAccount'));_0x2bf158['use']('/api/sms/applications',require('./api/smsApplication'));_0x2bf158['use'](_0x4c8c('0x4d'),require(_0x4c8c('0x4e')));_0x2bf158['use'](_0x4c8c('0x4f'),require(_0x4c8c('0x50')));_0x2bf158[_0x4c8c('0x6')](_0x4c8c('0x51'),require(_0x4c8c('0x52')));_0x2bf158['use'](_0x4c8c('0x53'),require('./api/openchannelAccount'));_0x2bf158[_0x4c8c('0x6')](_0x4c8c('0x54'),require(_0x4c8c('0x55')));_0x2bf158[_0x4c8c('0x6')](_0x4c8c('0x56'),require(_0x4c8c('0x57')));_0x2bf158['use'](_0x4c8c('0x58'),require(_0x4c8c('0x59')));_0x2bf158[_0x4c8c('0x6')](_0x4c8c('0x5a'),require(_0x4c8c('0x5b')));_0x2bf158[_0x4c8c('0x6')](_0x4c8c('0x5c'),require('./api/chatWebsite'));_0x2bf158[_0x4c8c('0x6')](_0x4c8c('0x5d'),require(_0x4c8c('0x5e')));_0x2bf158['use'](_0x4c8c('0x5f'),require(_0x4c8c('0x60')));_0x2bf158[_0x4c8c('0x6')](_0x4c8c('0x61'),require(_0x4c8c('0x62')));_0x2bf158[_0x4c8c('0x6')](_0x4c8c('0x63'),require(_0x4c8c('0x64')));_0x2bf158['use'](_0x4c8c('0x65'),require(_0x4c8c('0x66')));_0x2bf158[_0x4c8c('0x6')](_0x4c8c('0x67'),require(_0x4c8c('0x68')));_0x2bf158['use'](_0x4c8c('0x69'),require(_0x4c8c('0x6a')));_0x2bf158['use'](_0x4c8c('0x6b'),require(_0x4c8c('0x6c')));_0x2bf158[_0x4c8c('0x6')](_0x4c8c('0x6d'),require(_0x4c8c('0x6e')));_0x2bf158['use'](_0x4c8c('0x6f'),require('./api/cmContact'));_0x2bf158[_0x4c8c('0x6')](_0x4c8c('0x70'),require('./api/cmHopper'));_0x2bf158[_0x4c8c('0x6')](_0x4c8c('0x71'),require(_0x4c8c('0x72')));_0x2bf158[_0x4c8c('0x6')]('/api/cm/hopper_final',require(_0x4c8c('0x73')));_0x2bf158[_0x4c8c('0x6')](_0x4c8c('0x74'),require(_0x4c8c('0x75')));_0x2bf158['use'](_0x4c8c('0x76'),require(_0x4c8c('0x77')));_0x2bf158[_0x4c8c('0x6')](_0x4c8c('0x78'),require(_0x4c8c('0x79')));_0x2bf158['use'](_0x4c8c('0x7a'),require(_0x4c8c('0x7b')));_0x2bf158[_0x4c8c('0x6')](_0x4c8c('0x7c'),require('./api/cannedAnswer'));_0x2bf158[_0x4c8c('0x6')]('/api/dispositions',require(_0x4c8c('0x7d')));_0x2bf158[_0x4c8c('0x6')]('/api/conditions',require('./api/condition'));_0x2bf158[_0x4c8c('0x6')](_0x4c8c('0x7e'),require(_0x4c8c('0x7f')));_0x2bf158[_0x4c8c('0x6')](_0x4c8c('0x80'),require(_0x4c8c('0x81')));_0x2bf158[_0x4c8c('0x6')]('/api/cdr',require(_0x4c8c('0x82')));_0x2bf158['use'](_0x4c8c('0x83'),require('./api/voiceQueuesLog'));_0x2bf158[_0x4c8c('0x6')](_0x4c8c('0x84'),require(_0x4c8c('0x85')));_0x2bf158[_0x4c8c('0x6')](_0x4c8c('0x86'),require(_0x4c8c('0x87')));_0x2bf158[_0x4c8c('0x6')](_0x4c8c('0x88'),require(_0x4c8c('0x89')));_0x2bf158[_0x4c8c('0x6')](_0x4c8c('0x8a'),require('./api/template'));_0x2bf158[_0x4c8c('0x6')](_0x4c8c('0x8b'),require(_0x4c8c('0x8c')));_0x2bf158['use'](_0x4c8c('0x8d'),require(_0x4c8c('0x8e')));_0x2bf158[_0x4c8c('0x6')]('/api/integrations',require('./api/integration'));_0x2bf158[_0x4c8c('0x6')]('/api/integrations/reports',require('./api/integrationReport'));_0x2bf158[_0x4c8c('0x6')](_0x4c8c('0x8f'),require('./api/analyticCustomReport'));_0x2bf158['use'](_0x4c8c('0x90'),require(_0x4c8c('0x91')));_0x2bf158['use'](_0x4c8c('0x92'),require(_0x4c8c('0x93')));_0x2bf158[_0x4c8c('0x6')](_0x4c8c('0x94'),require('./api/analyticMetric'));_0x2bf158[_0x4c8c('0x6')](_0x4c8c('0x95'),require(_0x4c8c('0x96')));_0x2bf158['use']('/api/analytics/tree_reports',require(_0x4c8c('0x97')));_0x2bf158[_0x4c8c('0x6')](_0x4c8c('0x98'),require(_0x4c8c('0x99')));_0x2bf158[_0x4c8c('0x6')](_0x4c8c('0x9a'),require('./api/intSalesforceConfiguration'));_0x2bf158[_0x4c8c('0x6')](_0x4c8c('0x9b'),require(_0x4c8c('0x9c')));_0x2bf158[_0x4c8c('0x6')](_0x4c8c('0x9d'),require(_0x4c8c('0x9e')));_0x2bf158[_0x4c8c('0x6')](_0x4c8c('0x9f'),require('./api/intSugarcrmConfiguration'));_0x2bf158[_0x4c8c('0x6')]('/api/integrations/sugarcrm/fields',require('./api/intSugarcrmField'));_0x2bf158['use']('/api/integrations/desk/accounts',require('./api/intDeskAccount'));_0x2bf158[_0x4c8c('0x6')]('/api/integrations/desk/configurations',require('./api/intDeskConfiguration'));_0x2bf158[_0x4c8c('0x6')](_0x4c8c('0xa0'),require(_0x4c8c('0xa1')));_0x2bf158[_0x4c8c('0x6')](_0x4c8c('0xa2'),require(_0x4c8c('0xa3')));_0x2bf158[_0x4c8c('0x6')](_0x4c8c('0xa4'),require(_0x4c8c('0xa5')));_0x2bf158[_0x4c8c('0x6')]('/api/integrations/zoho/fields',require('./api/intZohoField'));_0x2bf158['use'](_0x4c8c('0xa6'),require('./api/intZendeskAccount'));_0x2bf158[_0x4c8c('0x6')](_0x4c8c('0xa7'),require(_0x4c8c('0xa8')));_0x2bf158['use']('/api/integrations/zendesk/fields',require(_0x4c8c('0xa9')));_0x2bf158['use'](_0x4c8c('0xaa'),require(_0x4c8c('0xab')));_0x2bf158[_0x4c8c('0x6')](_0x4c8c('0xac'),require(_0x4c8c('0xad')));_0x2bf158[_0x4c8c('0x6')](_0x4c8c('0xae'),require(_0x4c8c('0xaf')));_0x2bf158['use']('/api/integrations/vtiger/accounts',require('./api/intVtigerAccount'));_0x2bf158[_0x4c8c('0x6')](_0x4c8c('0xb0'),require('./api/intVtigerConfiguration'));_0x2bf158[_0x4c8c('0x6')](_0x4c8c('0xb1'),require(_0x4c8c('0xb2')));_0x2bf158['use'](_0x4c8c('0xb3'),require(_0x4c8c('0xb4')));_0x2bf158['use'](_0x4c8c('0xb5'),require('./api/intServicenowConfiguration'));_0x2bf158[_0x4c8c('0x6')]('/api/integrations/servicenow/fields',require(_0x4c8c('0xb6')));_0x2bf158[_0x4c8c('0x6')](_0x4c8c('0xb7'),require(_0x4c8c('0xb8')));_0x2bf158['use'](_0x4c8c('0xb9'),require(_0x4c8c('0xba')));_0x2bf158[_0x4c8c('0x6')](_0x4c8c('0xbb'),require(_0x4c8c('0xbc')));_0x2bf158[_0x4c8c('0x6')](_0x4c8c('0xbd'),require(_0x4c8c('0xbe')));_0x2bf158[_0x4c8c('0x6')](_0x4c8c('0xbf'),require(_0x4c8c('0xc0')));_0x2bf158[_0x4c8c('0x6')](_0x4c8c('0xc1'),require(_0x4c8c('0xc2')));_0x2bf158['use'](_0x4c8c('0xc3'),require(_0x4c8c('0xc4')));_0x2bf158[_0x4c8c('0x6')](_0x4c8c('0xc5'),require(_0x4c8c('0xc6')));_0x2bf158[_0x4c8c('0x6')](_0x4c8c('0xc7'),require('./api/chatInternalMessage'));_0x2bf158[_0x4c8c('0x6')]('/api/jscripty/answers/reports',require(_0x4c8c('0xc8')));_0x2bf158['use']('/api/jscripty/questions/reports',require(_0x4c8c('0xc9')));_0x2bf158[_0x4c8c('0x6')](_0x4c8c('0xca'),require(_0x4c8c('0xcb')));_0x2bf158['use']('/api/sms/reports/queue',require(_0x4c8c('0xcc')));_0x2bf158['use'](_0x4c8c('0xcd'),require(_0x4c8c('0xce')));_0x2bf158['use'](_0x4c8c('0xcf'),require(_0x4c8c('0xd0')));_0x2bf158[_0x4c8c('0x6')](_0x4c8c('0xd1'),require(_0x4c8c('0xd2')));_0x2bf158[_0x4c8c('0x6')](_0x4c8c('0xd3'),require(_0x4c8c('0xd4')));_0x2bf158[_0x4c8c('0x6')](_0x4c8c('0xd5'),require('./api/squareOdbc'));_0x2bf158[_0x4c8c('0x6')]('/api/square/projects',require(_0x4c8c('0xd6')));_0x2bf158['use']('/api/square/recordings',require(_0x4c8c('0xd7')));_0x2bf158[_0x4c8c('0x6')](_0x4c8c('0xd8'),require(_0x4c8c('0xd9')));_0x2bf158[_0x4c8c('0x6')](_0x4c8c('0xda'),require('./api/team'));_0x2bf158['use'](_0x4c8c('0xdb'),require(_0x4c8c('0xdc')));_0x2bf158[_0x4c8c('0x6')]('/api/campaigns',require(_0x4c8c('0xdd')));_0x2bf158[_0x4c8c('0x6')](_0x4c8c('0xde'),require('./api/migration'));_0x2bf158[_0x4c8c('0x6')](_0x4c8c('0xdf'),require(_0x4c8c('0xe0')));_0x2bf158[_0x4c8c('0x6')]('/api/plugins',require('./api/plugin'));_0x2bf158['use'](_0x4c8c('0xe1'),require(_0x4c8c('0xe2')));_0x2bf158[_0x4c8c('0x6')](_0x4c8c('0xe3'),require(_0x4c8c('0xe4')));_0x2bf158[_0x4c8c('0x6')](_0x4c8c('0xe5'),require(_0x4c8c('0xe6')));_0x2bf158[_0x4c8c('0x6')]('/api/openchannel/reports/transfer',require(_0x4c8c('0xe7')));_0x2bf158[_0x4c8c('0x6')](_0x4c8c('0xe8'),require(_0x4c8c('0xe9')));_0x2bf158[_0x4c8c('0x6')](_0x4c8c('0xea'),require(_0x4c8c('0xeb')));_0x2bf158[_0x4c8c('0x6')](_0x4c8c('0xec'),require('./api/voicePrefix'));_0x2bf158[_0x4c8c('0x6')]('/api/userProfiles',require(_0x4c8c('0xed')));_0x2bf158['use'](_0x4c8c('0xee'),require(_0x4c8c('0xef')));_0x2bf158[_0x4c8c('0x6')](_0x4c8c('0xf0'),require(_0x4c8c('0xf1')));_0x2bf158[_0x4c8c('0x6')](_0x4c8c('0xf2'),require(_0x4c8c('0xf3')));_0x2bf158[_0x4c8c('0x6')](_0x4c8c('0xf4'),require(_0x4c8c('0xf5')));_0x2bf158[_0x4c8c('0x6')](_0x4c8c('0xf6'),require(_0x4c8c('0xf7')));_0x2bf158[_0x4c8c('0x6')](_0x4c8c('0xf8'),require(_0x4c8c('0xf9')));_0x2bf158[_0x4c8c('0x6')]('/api/version',require(_0x4c8c('0xfa')));_0x2bf158[_0x4c8c('0x6')]('/api/system',require(_0x4c8c('0xfb')));_0x2bf158[_0x4c8c('0x6')]('/api/pm2',require('./api/pm2'));_0x2bf158['use'](_0x4c8c('0xfc'),express['static'](path[_0x4c8c('0xfd')](config[_0x4c8c('0xfe')],'/apidoc')));_0x2bf158[_0x4c8c('0x6')]('/www',express[_0x4c8c('0xff')](path[_0x4c8c('0xfd')](config[_0x4c8c('0xfe')],'/www')));_0x2bf158[_0x4c8c('0x6')](_0x4c8c('0x100'),express[_0x4c8c('0xff')](path['join'](config['root'],_0x4c8c('0x100'))));_0x2bf158[_0x4c8c('0x6')](_0x4c8c('0x101'),express[_0x4c8c('0xff')](path['join'](config[_0x4c8c('0xfe')],_0x4c8c('0x102'),_0x4c8c('0x103'))));_0x2bf158['use'](_0x4c8c('0x104'),express[_0x4c8c('0xff')](path[_0x4c8c('0xfd')](config[_0x4c8c('0xfe')],_0x4c8c('0x105'))));_0x2bf158[_0x4c8c('0x106')](_0x4c8c('0x107'))['get'](errors[0x194]);_0x2bf158['route']('/*')['get'](function(_0x469ce7,_0x30b309){_0x30b309['sendFile'](path[_0x4c8c('0x108')](_0x2bf158[_0x4c8c('0x109')](_0x4c8c('0x10a'))+_0x4c8c('0x10b')));});}; \ No newline at end of file diff --git a/server/rpc/index.js b/server/rpc/index.js index 782859d..1c3b149 100644 --- a/server/rpc/index.js +++ b/server/rpc/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xb947=['../api/cmHopperBlack/cmHopperBlack.rpc','../api/cmHopperFinal/cmHopperFinal.rpc','../api/cmHopperHistory/cmHopperHistory.rpc','../api/reportAgentPreview/reportAgentPreview.rpc','../api/interval/interval.rpc','../api/pause/pause.rpc','../api/sound/sound.rpc','../api/template/template.rpc','../api/trigger/trigger.rpc','../api/variable/variable.rpc','../api/intDeskAccount/intDeskAccount.rpc','../api/intZohoAccount/intZohoAccount.rpc','../api/intZendeskAccount/intZendeskAccount.rpc','../api/intFreshdeskAccount/intFreshdeskAccount.rpc','../api/intServicenowAccount/intServicenowAccount.rpc','../api/intDynamics365Account/intDynamics365Account.rpc','../api/intFreshsalesAccount/intFreshsalesAccount.rpc','../api/squareReport/squareReport.rpc','../api/squareReportDetail/squareReportDetail.rpc','../api/squareProject/squareProject.rpc','../api/squareRecording/squareRecording.rpc','../api/squareMessage/squareMessage.rpc','../api/attachment/attachment.rpc','../api/plugin/plugin.rpc','server','http','port','rpc','error','Express\x20RPC\x20server\x20listening\x20on\x20%s:%d!','default','RPC\x20listening\x20on\x20','jayson/promise','bluebird','../config/environment','listen','merge','../api/user/user.rpc','../api/voiceQueue/voiceQueue.rpc','../api/voiceRecording/voiceRecording.rpc','../api/voiceCallReport/voiceCallReport.rpc','../api/voiceDialReport/voiceDialReport.rpc','../api/voiceAgentReport/voiceAgentReport.rpc','../api/voiceQueueReport/voiceQueueReport.rpc','../api/memberReport/memberReport.rpc','../api/trunk/trunk.rpc','../api/voiceTransferReport/voiceTransferReport.rpc','../api/mailServerIn/mailServerIn.rpc','../api/mailAccount/mailAccount.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/faxQueue/faxQueue.rpc','../api/faxQueueReport/faxQueueReport.rpc','../api/smsInteraction/smsInteraction.rpc','../api/smsMessage/smsMessage.rpc','../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/cmHopper/cmHopper.rpc'];(function(_0x580576,_0x2f107d){var _0x3f55a0=function(_0x2e180b){while(--_0x2e180b){_0x580576['push'](_0x580576['shift']());}};_0x3f55a0(++_0x2f107d);}(_0xb947,0x65));var _0x7b94=function(_0x4930da,_0x59c575){_0x4930da=_0x4930da-0x0;var _0x3d3e54=_0xb947[_0x4930da];return _0x3d3e54;};'use strict';var jayson=require(_0x7b94('0x0'));var BPromise=require(_0x7b94('0x1'));var _=require('lodash');var config=require(_0x7b94('0x2'));exports[_0x7b94('0x3')]=function(){return new BPromise(function(_0x50af15,_0x639922){var _0x302d86={};_0x302d86=_[_0x7b94('0x4')](_0x302d86,require(_0x7b94('0x5')));_0x302d86=_['merge'](_0x302d86,require('../api/voiceExtension/voiceExtension.rpc'));_0x302d86=_[_0x7b94('0x4')](_0x302d86,require(_0x7b94('0x6')));_0x302d86=_[_0x7b94('0x4')](_0x302d86,require(_0x7b94('0x7')));_0x302d86=_['merge'](_0x302d86,require(_0x7b94('0x8')));_0x302d86=_[_0x7b94('0x4')](_0x302d86,require(_0x7b94('0x9')));_0x302d86=_[_0x7b94('0x4')](_0x302d86,require(_0x7b94('0xa')));_0x302d86=_['merge'](_0x302d86,require(_0x7b94('0xb')));_0x302d86=_[_0x7b94('0x4')](_0x302d86,require(_0x7b94('0xc')));_0x302d86=_[_0x7b94('0x4')](_0x302d86,require(_0x7b94('0xd')));_0x302d86=_['merge'](_0x302d86,require(_0x7b94('0xe')));_0x302d86=_[_0x7b94('0x4')](_0x302d86,require('../api/userVoiceQueueRt/userVoiceQueueRt.rpc'));_0x302d86=_[_0x7b94('0x4')](_0x302d86,require(_0x7b94('0xf')));_0x302d86=_[_0x7b94('0x4')](_0x302d86,require(_0x7b94('0x10')));_0x302d86=_[_0x7b94('0x4')](_0x302d86,require('../api/mailQueue/mailQueue.rpc'));_0x302d86=_[_0x7b94('0x4')](_0x302d86,require(_0x7b94('0x11')));_0x302d86=_[_0x7b94('0x4')](_0x302d86,require(_0x7b94('0x12')));_0x302d86=_['merge'](_0x302d86,require(_0x7b94('0x13')));_0x302d86=_[_0x7b94('0x4')](_0x302d86,require('../api/mailQueueReport/mailQueueReport.rpc'));_0x302d86=_[_0x7b94('0x4')](_0x302d86,require(_0x7b94('0x14')));_0x302d86=_[_0x7b94('0x4')](_0x302d86,require(_0x7b94('0x15')));_0x302d86=_[_0x7b94('0x4')](_0x302d86,require(_0x7b94('0x16')));_0x302d86=_[_0x7b94('0x4')](_0x302d86,require(_0x7b94('0x17')));_0x302d86=_[_0x7b94('0x4')](_0x302d86,require(_0x7b94('0x18')));_0x302d86=_[_0x7b94('0x4')](_0x302d86,require(_0x7b94('0x19')));_0x302d86=_[_0x7b94('0x4')](_0x302d86,require('../api/smsAccount/smsAccount.rpc'));_0x302d86=_[_0x7b94('0x4')](_0x302d86,require(_0x7b94('0x1a')));_0x302d86=_[_0x7b94('0x4')](_0x302d86,require(_0x7b94('0x1b')));_0x302d86=_[_0x7b94('0x4')](_0x302d86,require('../api/smsQueue/smsQueue.rpc'));_0x302d86=_['merge'](_0x302d86,require(_0x7b94('0x1c')));_0x302d86=_[_0x7b94('0x4')](_0x302d86,require(_0x7b94('0x1d')));_0x302d86=_[_0x7b94('0x4')](_0x302d86,require(_0x7b94('0x1e')));_0x302d86=_[_0x7b94('0x4')](_0x302d86,require(_0x7b94('0x1f')));_0x302d86=_[_0x7b94('0x4')](_0x302d86,require(_0x7b94('0x20')));_0x302d86=_[_0x7b94('0x4')](_0x302d86,require('../api/chatInteraction/chatInteraction.rpc'));_0x302d86=_[_0x7b94('0x4')](_0x302d86,require(_0x7b94('0x21')));_0x302d86=_[_0x7b94('0x4')](_0x302d86,require(_0x7b94('0x22')));_0x302d86=_['merge'](_0x302d86,require(_0x7b94('0x23')));_0x302d86=_[_0x7b94('0x4')](_0x302d86,require(_0x7b94('0x24')));_0x302d86=_['merge'](_0x302d86,require(_0x7b94('0x25')));_0x302d86=_[_0x7b94('0x4')](_0x302d86,require(_0x7b94('0x26')));_0x302d86=_['merge'](_0x302d86,require(_0x7b94('0x27')));_0x302d86=_[_0x7b94('0x4')](_0x302d86,require(_0x7b94('0x28')));_0x302d86=_['merge'](_0x302d86,require(_0x7b94('0x29')));_0x302d86=_[_0x7b94('0x4')](_0x302d86,require(_0x7b94('0x2a')));_0x302d86=_[_0x7b94('0x4')](_0x302d86,require(_0x7b94('0x2b')));_0x302d86=_[_0x7b94('0x4')](_0x302d86,require(_0x7b94('0x2c')));_0x302d86=_[_0x7b94('0x4')](_0x302d86,require(_0x7b94('0x2d')));_0x302d86=_[_0x7b94('0x4')](_0x302d86,require(_0x7b94('0x2e')));_0x302d86=_[_0x7b94('0x4')](_0x302d86,require('../api/intSalesforceAccount/intSalesforceAccount.rpc'));_0x302d86=_[_0x7b94('0x4')](_0x302d86,require('../api/intSugarcrmAccount/intSugarcrmAccount.rpc'));_0x302d86=_[_0x7b94('0x4')](_0x302d86,require(_0x7b94('0x2f')));_0x302d86=_[_0x7b94('0x4')](_0x302d86,require(_0x7b94('0x30')));_0x302d86=_['merge'](_0x302d86,require(_0x7b94('0x31')));_0x302d86=_['merge'](_0x302d86,require(_0x7b94('0x32')));_0x302d86=_['merge'](_0x302d86,require('../api/intVtigerAccount/intVtigerAccount.rpc'));_0x302d86=_['merge'](_0x302d86,require(_0x7b94('0x33')));_0x302d86=_[_0x7b94('0x4')](_0x302d86,require(_0x7b94('0x34')));_0x302d86=_[_0x7b94('0x4')](_0x302d86,require(_0x7b94('0x35')));_0x302d86=_[_0x7b94('0x4')](_0x302d86,require('../api/chatQueueReport/chatQueueReport.rpc'));_0x302d86=_['merge'](_0x302d86,require('../api/smsQueueReport/smsQueueReport.rpc'));_0x302d86=_[_0x7b94('0x4')](_0x302d86,require(_0x7b94('0x36')));_0x302d86=_[_0x7b94('0x4')](_0x302d86,require(_0x7b94('0x37')));_0x302d86=_[_0x7b94('0x4')](_0x302d86,require('../api/squareOdbc/squareOdbc.rpc'));_0x302d86=_[_0x7b94('0x4')](_0x302d86,require(_0x7b94('0x38')));_0x302d86=_[_0x7b94('0x4')](_0x302d86,require(_0x7b94('0x39')));_0x302d86=_[_0x7b94('0x4')](_0x302d86,require(_0x7b94('0x3a')));_0x302d86=_[_0x7b94('0x4')](_0x302d86,require('../api/campaign/campaign.rpc'));_0x302d86=_[_0x7b94('0x4')](_0x302d86,require(_0x7b94('0x3b')));_0x302d86=_[_0x7b94('0x4')](_0x302d86,require(_0x7b94('0x3c')));var _0x58ddd0=jayson[_0x7b94('0x3d')](_0x302d86)[_0x7b94('0x3e')]();var _0x59e569=config['rpc'][_0x7b94('0x3f')]||config[_0x7b94('0x3f')]+0x1;var _0xc7374e=config[_0x7b94('0x40')]['ip']||'localhost';_0x58ddd0['on'](_0x7b94('0x41'),function(_0x3f1600){return _0x639922(_0x3f1600);});_0x58ddd0[_0x7b94('0x3')](_0x59e569,_0xc7374e,function(){console['log'](_0x7b94('0x42'),_0xc7374e,_0x59e569);require('../config/triggers')[_0x7b94('0x43')]();return _0x50af15(_0x7b94('0x44')+_0xc7374e+':'+_0x59e569);});});}; \ No newline at end of file +var _0xe931=['listen','merge','../api/user/user.rpc','../api/voiceExtension/voiceExtension.rpc','../api/voiceQueue/voiceQueue.rpc','../api/voiceRecording/voiceRecording.rpc','../api/voiceCallReport/voiceCallReport.rpc','../api/voiceDialReport/voiceDialReport.rpc','../api/voiceAgentReport/voiceAgentReport.rpc','../api/memberReport/memberReport.rpc','../api/trunk/trunk.rpc','../api/voiceTransferReport/voiceTransferReport.rpc','../api/userVoiceQueueRt/userVoiceQueueRt.rpc','../api/mailAccount/mailAccount.rpc','../api/mailQueue/mailQueue.rpc','../api/mailMessage/mailMessage.rpc','../api/mailQueueReport/mailQueueReport.rpc','../api/faxAccount/faxAccount.rpc','../api/faxMessage/faxMessage.rpc','../api/faxQueue/faxQueue.rpc','../api/faxQueueReport/faxQueueReport.rpc','../api/smsAccount/smsAccount.rpc','../api/smsInteraction/smsInteraction.rpc','../api/smsQueue/smsQueue.rpc','../api/openchannelApplication/openchannelApplication.rpc','../api/openchannelInteraction/openchannelInteraction.rpc','../api/openchannelQueueReport/openchannelQueueReport.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/cmHopperHistory/cmHopperHistory.rpc','../api/reportAgentPreview/reportAgentPreview.rpc','../api/pause/pause.rpc','../api/sound/sound.rpc','../api/trigger/trigger.rpc','../api/variable/variable.rpc','../api/intSalesforceAccount/intSalesforceAccount.rpc','../api/intSugarcrmAccount/intSugarcrmAccount.rpc','../api/intDeskAccount/intDeskAccount.rpc','../api/intZendeskAccount/intZendeskAccount.rpc','../api/intServicenowAccount/intServicenowAccount.rpc','../api/intDynamics365Account/intDynamics365Account.rpc','../api/chatQueueReport/chatQueueReport.rpc','../api/smsQueueReport/smsQueueReport.rpc','../api/squareReport/squareReport.rpc','../api/squareReportDetail/squareReportDetail.rpc','../api/squareOdbc/squareOdbc.rpc','../api/squareProject/squareProject.rpc','../api/squareRecording/squareRecording.rpc','../api/squareMessage/squareMessage.rpc','../api/campaign/campaign.rpc','../api/attachment/attachment.rpc','../api/plugin/plugin.rpc','http','rpc','port','error','log','../config/triggers','default','RPC\x20listening\x20on\x20','jayson/promise','bluebird','lodash'];(function(_0x51d3f2,_0x353351){var _0x314dde=function(_0x5ce341){while(--_0x5ce341){_0x51d3f2['push'](_0x51d3f2['shift']());}};_0x314dde(++_0x353351);}(_0xe931,0xc6));var _0x1e93=function(_0x20e15c,_0x306150){_0x20e15c=_0x20e15c-0x0;var _0x3eb6d4=_0xe931[_0x20e15c];return _0x3eb6d4;};'use strict';var jayson=require(_0x1e93('0x0'));var BPromise=require(_0x1e93('0x1'));var _=require(_0x1e93('0x2'));var config=require('../config/environment');exports[_0x1e93('0x3')]=function(){return new BPromise(function(_0xc45ea9,_0x29fb6e){var _0xd9ba97={};_0xd9ba97=_[_0x1e93('0x4')](_0xd9ba97,require(_0x1e93('0x5')));_0xd9ba97=_['merge'](_0xd9ba97,require(_0x1e93('0x6')));_0xd9ba97=_[_0x1e93('0x4')](_0xd9ba97,require(_0x1e93('0x7')));_0xd9ba97=_[_0x1e93('0x4')](_0xd9ba97,require(_0x1e93('0x8')));_0xd9ba97=_['merge'](_0xd9ba97,require(_0x1e93('0x9')));_0xd9ba97=_['merge'](_0xd9ba97,require(_0x1e93('0xa')));_0xd9ba97=_[_0x1e93('0x4')](_0xd9ba97,require(_0x1e93('0xb')));_0xd9ba97=_['merge'](_0xd9ba97,require('../api/voiceQueueReport/voiceQueueReport.rpc'));_0xd9ba97=_['merge'](_0xd9ba97,require(_0x1e93('0xc')));_0xd9ba97=_[_0x1e93('0x4')](_0xd9ba97,require(_0x1e93('0xd')));_0xd9ba97=_[_0x1e93('0x4')](_0xd9ba97,require(_0x1e93('0xe')));_0xd9ba97=_[_0x1e93('0x4')](_0xd9ba97,require(_0x1e93('0xf')));_0xd9ba97=_['merge'](_0xd9ba97,require('../api/mailServerIn/mailServerIn.rpc'));_0xd9ba97=_[_0x1e93('0x4')](_0xd9ba97,require(_0x1e93('0x10')));_0xd9ba97=_[_0x1e93('0x4')](_0xd9ba97,require(_0x1e93('0x11')));_0xd9ba97=_[_0x1e93('0x4')](_0xd9ba97,require('../api/mailInteraction/mailInteraction.rpc'));_0xd9ba97=_[_0x1e93('0x4')](_0xd9ba97,require(_0x1e93('0x12')));_0xd9ba97=_[_0x1e93('0x4')](_0xd9ba97,require('../api/mailApplication/mailApplication.rpc'));_0xd9ba97=_[_0x1e93('0x4')](_0xd9ba97,require(_0x1e93('0x13')));_0xd9ba97=_[_0x1e93('0x4')](_0xd9ba97,require(_0x1e93('0x14')));_0xd9ba97=_[_0x1e93('0x4')](_0xd9ba97,require('../api/faxApplication/faxApplication.rpc'));_0xd9ba97=_[_0x1e93('0x4')](_0xd9ba97,require('../api/faxInteraction/faxInteraction.rpc'));_0xd9ba97=_[_0x1e93('0x4')](_0xd9ba97,require(_0x1e93('0x15')));_0xd9ba97=_[_0x1e93('0x4')](_0xd9ba97,require(_0x1e93('0x16')));_0xd9ba97=_[_0x1e93('0x4')](_0xd9ba97,require(_0x1e93('0x17')));_0xd9ba97=_[_0x1e93('0x4')](_0xd9ba97,require(_0x1e93('0x18')));_0xd9ba97=_['merge'](_0xd9ba97,require(_0x1e93('0x19')));_0xd9ba97=_[_0x1e93('0x4')](_0xd9ba97,require('../api/smsMessage/smsMessage.rpc'));_0xd9ba97=_[_0x1e93('0x4')](_0xd9ba97,require(_0x1e93('0x1a')));_0xd9ba97=_[_0x1e93('0x4')](_0xd9ba97,require(_0x1e93('0x1b')));_0xd9ba97=_['merge'](_0xd9ba97,require(_0x1e93('0x1c')));_0xd9ba97=_[_0x1e93('0x4')](_0xd9ba97,require('../api/openchannelMessage/openchannelMessage.rpc'));_0xd9ba97=_['merge'](_0xd9ba97,require('../api/openchannelQueue/openchannelQueue.rpc'));_0xd9ba97=_[_0x1e93('0x4')](_0xd9ba97,require(_0x1e93('0x1d')));_0xd9ba97=_[_0x1e93('0x4')](_0xd9ba97,require('../api/chatInteraction/chatInteraction.rpc'));_0xd9ba97=_[_0x1e93('0x4')](_0xd9ba97,require(_0x1e93('0x1e')));_0xd9ba97=_[_0x1e93('0x4')](_0xd9ba97,require(_0x1e93('0x1f')));_0xd9ba97=_[_0x1e93('0x4')](_0xd9ba97,require(_0x1e93('0x20')));_0xd9ba97=_[_0x1e93('0x4')](_0xd9ba97,require(_0x1e93('0x21')));_0xd9ba97=_[_0x1e93('0x4')](_0xd9ba97,require(_0x1e93('0x22')));_0xd9ba97=_['merge'](_0xd9ba97,require(_0x1e93('0x23')));_0xd9ba97=_[_0x1e93('0x4')](_0xd9ba97,require(_0x1e93('0x24')));_0xd9ba97=_[_0x1e93('0x4')](_0xd9ba97,require(_0x1e93('0x25')));_0xd9ba97=_[_0x1e93('0x4')](_0xd9ba97,require('../api/interval/interval.rpc'));_0xd9ba97=_[_0x1e93('0x4')](_0xd9ba97,require(_0x1e93('0x26')));_0xd9ba97=_['merge'](_0xd9ba97,require(_0x1e93('0x27')));_0xd9ba97=_[_0x1e93('0x4')](_0xd9ba97,require('../api/template/template.rpc'));_0xd9ba97=_[_0x1e93('0x4')](_0xd9ba97,require(_0x1e93('0x28')));_0xd9ba97=_['merge'](_0xd9ba97,require(_0x1e93('0x29')));_0xd9ba97=_['merge'](_0xd9ba97,require(_0x1e93('0x2a')));_0xd9ba97=_['merge'](_0xd9ba97,require(_0x1e93('0x2b')));_0xd9ba97=_[_0x1e93('0x4')](_0xd9ba97,require(_0x1e93('0x2c')));_0xd9ba97=_[_0x1e93('0x4')](_0xd9ba97,require('../api/intZohoAccount/intZohoAccount.rpc'));_0xd9ba97=_[_0x1e93('0x4')](_0xd9ba97,require(_0x1e93('0x2d')));_0xd9ba97=_['merge'](_0xd9ba97,require('../api/intFreshdeskAccount/intFreshdeskAccount.rpc'));_0xd9ba97=_[_0x1e93('0x4')](_0xd9ba97,require('../api/intVtigerAccount/intVtigerAccount.rpc'));_0xd9ba97=_[_0x1e93('0x4')](_0xd9ba97,require(_0x1e93('0x2e')));_0xd9ba97=_['merge'](_0xd9ba97,require(_0x1e93('0x2f')));_0xd9ba97=_[_0x1e93('0x4')](_0xd9ba97,require('../api/intFreshsalesAccount/intFreshsalesAccount.rpc'));_0xd9ba97=_['merge'](_0xd9ba97,require(_0x1e93('0x30')));_0xd9ba97=_[_0x1e93('0x4')](_0xd9ba97,require(_0x1e93('0x31')));_0xd9ba97=_[_0x1e93('0x4')](_0xd9ba97,require(_0x1e93('0x32')));_0xd9ba97=_['merge'](_0xd9ba97,require(_0x1e93('0x33')));_0xd9ba97=_[_0x1e93('0x4')](_0xd9ba97,require(_0x1e93('0x34')));_0xd9ba97=_[_0x1e93('0x4')](_0xd9ba97,require(_0x1e93('0x35')));_0xd9ba97=_[_0x1e93('0x4')](_0xd9ba97,require(_0x1e93('0x36')));_0xd9ba97=_[_0x1e93('0x4')](_0xd9ba97,require(_0x1e93('0x37')));_0xd9ba97=_[_0x1e93('0x4')](_0xd9ba97,require(_0x1e93('0x38')));_0xd9ba97=_[_0x1e93('0x4')](_0xd9ba97,require(_0x1e93('0x39')));_0xd9ba97=_[_0x1e93('0x4')](_0xd9ba97,require(_0x1e93('0x3a')));var _0x4fa796=jayson['server'](_0xd9ba97)[_0x1e93('0x3b')]();var _0x16e9cb=config[_0x1e93('0x3c')]['port']||config[_0x1e93('0x3d')]+0x1;var _0x132c73=config['rpc']['ip']||'localhost';_0x4fa796['on'](_0x1e93('0x3e'),function(_0x2258d1){return _0x29fb6e(_0x2258d1);});_0x4fa796[_0x1e93('0x3')](_0x16e9cb,_0x132c73,function(){console[_0x1e93('0x3f')]('Express\x20RPC\x20server\x20listening\x20on\x20%s:%d!',_0x132c73,_0x16e9cb);require(_0x1e93('0x40'))[_0x1e93('0x41')]();return _0xc45ea9(_0x1e93('0x42')+_0x132c73+':'+_0x16e9cb);});});}; \ No newline at end of file diff --git a/server/services/agi/channel.js b/server/services/agi/channel.js index 6ed964c..6ae7a7c 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 _0xe706=['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','AGI','wait','WAIT','label','exports','util','lodash','events','./reply','./error','call','setEncoding','utf8','setTimeout','headers','emit','ready','line','toLowerCase','hangup','search','520\x20End\x20of\x20proper','function','substring','no\x20code','indexOf','startsWith','split','length','error','close','E_AGI_SOCKET_CLOSE','timeout','E_AGI_SOCKET_TIMEOUT','destroy','pipe','write','inherits','command','sync','answer','sendRequest','prototype','getData','beep','format','GET\x20DATA\x20\x22%s\x22\x20%s\x20%s','NO\x20MESSAGE','VERBOSE\x20\x22%s\x22','exec','isArray','join','EXEC\x20%s\x20%s','SET\x20CONTEXT\x20%s','SET\x20EXTENSION\x20%s','setPriority','SET\x20PRIORITY\x20%s','HANGUP','setVariable','isBoolean','isNumber','toString','SET\x20VARIABLE\x20%s\x20\x22%s\x22','SAY\x20NUMBER\x20%s\x20%s','SAY\x20DIGITS\x20%s\x20%s','sayPhonetic','SAY\x20PHONETIC\x20\x22%s\x22\x20%s','continueAt','setExtension','noop','GOTO\x20%s\x20%s\x20%s','getVariable','recordFile'];(function(_0x52a9fa,_0x13f364){var _0x13280b=function(_0x5bd93a){while(--_0x5bd93a){_0x52a9fa['push'](_0x52a9fa['shift']());}};_0x13280b(++_0x13f364);}(_0xe706,0xa3));var _0x6e70=function(_0x1385dc,_0x2c7fd7){_0x1385dc=_0x1385dc-0x0;var _0x2f6469=_0xe706[_0x1385dc];return _0x2f6469;};'use strict';var util=require(_0x6e70('0x0'));var _=require(_0x6e70('0x1'));var EventEmitter=require(_0x6e70('0x2'))['EventEmitter'];var AGIReply=require(_0x6e70('0x3'));var AGIError=require(_0x6e70('0x4'));function AGIChannel(_0x2ca810){var _0x7dfbc3=this,_0x142c27=new AGIReply(),_0x2164a4=![],_0x376a8d={};EventEmitter[_0x6e70('0x5')](_0x7dfbc3);_0x2ca810[_0x6e70('0x6')](_0x6e70('0x7'));_0x2ca810[_0x6e70('0x8')](0x8*0x3c*0x3c*0x3e8);_0x142c27[_0x6e70('0x6')](_0x6e70('0x7'));_0x142c27['on'](_0x6e70('0x9'),function(_0x3c4843){for(var _0x449b48 in _0x3c4843){_0x7dfbc3[_0x449b48]=_0x3c4843[_0x449b48];}_0x7dfbc3[_0x6e70('0xa')](_0x6e70('0xb'));});_0x142c27['on'](_0x6e70('0xc'),function(_0x463853){if(_0x463853[_0x6e70('0xd')]()==_0x6e70('0xe')){_0x7dfbc3[_0x6e70('0xa')](_0x6e70('0xe'));return;}if(_0x463853['substring'](0x0,0xb)=='520-Invalid'){_0x2164a4=!![];}if(_0x2164a4){_0x376a8d['rx']+=_0x463853+'\x0a';if(_0x463853[_0x6e70('0xf')](_0x6e70('0x10'))!=-0x1){_0x2164a4=![];}}else{_0x376a8d['rx']=_0x463853;}if(_0x2164a4){return;}if(typeof _0x376a8d['cb']==_0x6e70('0x11')){var _0x27dd9b=_0x376a8d['rx'][_0x6e70('0x12')](0x0,0x3),_0x3b38f3=null,_0x310eb7=null;_0x27dd9b=parseInt(_0x27dd9b);if(isNaN(_0x27dd9b)){_0x376a8d['cb'](null,{'code':0x1f4,'result':-0x1,'extra':_0x6e70('0x13')});return;}if(_0x27dd9b!=0xc8){_0x376a8d['cb'](null,{'code':_0x27dd9b,'result':-0x1,'extra':'KO'});return;}_0x3b38f3=_0x376a8d['rx']['substring'](0x4)['replace']('result=','');if(_0x3b38f3[_0x6e70('0x14')]('\x20')!=-0x1){_0x3b38f3=_0x3b38f3['substr'](0x0,_0x3b38f3['indexOf']('\x20'));}if(_[_0x6e70('0x15')](_0x3b38f3,'-1')){_0x3b38f3=parseInt(_0x3b38f3);}_0x310eb7=_0x376a8d['rx'][_0x6e70('0x16')]('\x20');if(_0x310eb7['length']==0x3){_0x310eb7=_0x310eb7[0x2][_0x6e70('0x12')](0x1,_0x310eb7[0x2]['length']-0x1);}else if(_0x310eb7[_0x6e70('0x17')]>0x3){var _0x161f23=/\((.+)\)/;var _0x4ca554=_0x376a8d['rx']['match'](_0x161f23);if(_0x4ca554){_0x310eb7=_0x4ca554[0x1];}else{_0x310eb7=null;}}else{_0x310eb7=null;}_0x376a8d['cb'](null,{'code':_0x27dd9b,'result':_0x3b38f3,'extra':_0x310eb7});}});_0x2ca810['on'](_0x6e70('0x18'),function(_0x5ea7a5){_0x7dfbc3[_0x6e70('0xa')](_0x6e70('0x18'),new AGIError('E_AGI_SOCKET_ERROR',_0x5ea7a5['code']));});_0x2ca810['on'](_0x6e70('0x19'),function(){_0x7dfbc3[_0x6e70('0xa')](_0x6e70('0x19'),new AGIError(_0x6e70('0x1a')));});_0x2ca810['on'](_0x6e70('0x1b'),function(){_0x7dfbc3[_0x6e70('0xa')](_0x6e70('0x1b'),new AGIError(_0x6e70('0x1c')));_0x2ca810[_0x6e70('0x1d')]();});_0x2ca810[_0x6e70('0x1e')](_0x142c27);this['command']=function(_0x228350,_0x344b65){var _0x228350=_0x228350||'',_0x344b65=typeof _0x344b65==_0x6e70('0x11')?_0x344b65:new Function();_0x376a8d={'tx':_0x228350,'rx':'','cb':_0x344b65};_0x2ca810[_0x6e70('0x1f')](_0x228350+'\x0a');},this[_0x6e70('0x19')]=function(){_0x2ca810['destroy']();};}util[_0x6e70('0x20')](AGIChannel,EventEmitter);AGIChannel['prototype']['sendRequest']=function(_0x4e97c7){return this[_0x6e70('0x21')][_0x6e70('0x22')](this,_0x4e97c7);};AGIChannel['prototype'][_0x6e70('0x23')]=function(){return this[_0x6e70('0x24')]('ANSWER');};AGIChannel[_0x6e70('0x25')][_0x6e70('0x26')]=function(_0x2bb231,_0x4a67ac,_0x54a5fe){_0x2bb231=_0x2bb231===undefined?_0x6e70('0x27'):_0x2bb231;_0x4a67ac=_0x4a67ac===undefined?'5':_0x4a67ac;_0x54a5fe=_0x54a5fe===undefined?'1':_0x54a5fe;return this[_0x6e70('0x24')](util[_0x6e70('0x28')](_0x6e70('0x29'),_0x2bb231,_0x4a67ac*0x3e8,_0x54a5fe));};AGIChannel[_0x6e70('0x25')]['noop']=function(_0x1952ea){_0x1952ea=_0x1952ea||_0x6e70('0x2a');return this[_0x6e70('0x24')](util[_0x6e70('0x28')](_0x6e70('0x2b'),_0x1952ea));};AGIChannel[_0x6e70('0x25')][_0x6e70('0x2c')]=function(_0x24114a,_0x3a0821){if(_[_0x6e70('0x2d')](_0x3a0821)){return this['sendRequest'](util[_0x6e70('0x28')]('EXEC\x20%s\x20%s',_0x24114a,_0x3a0821[_0x6e70('0x2e')](',')));}return this['sendRequest'](util[_0x6e70('0x28')](_0x6e70('0x2f'),_0x24114a,_0x3a0821));};AGIChannel[_0x6e70('0x25')]['setContext']=function(_0x38c40d){return this[_0x6e70('0x24')](util['format'](_0x6e70('0x30'),_0x38c40d));};AGIChannel[_0x6e70('0x25')]['setExtension']=function(_0x10d8f6){return this[_0x6e70('0x24')](util[_0x6e70('0x28')](_0x6e70('0x31'),_0x10d8f6));};AGIChannel[_0x6e70('0x25')][_0x6e70('0x32')]=function(_0x44b19d){return this[_0x6e70('0x24')](util[_0x6e70('0x28')](_0x6e70('0x33'),_0x44b19d));};AGIChannel['prototype'][_0x6e70('0xe')]=function(){return this['sendRequest'](_0x6e70('0x34'));};AGIChannel[_0x6e70('0x25')][_0x6e70('0x35')]=function(_0x32d12d,_0x233a83){var _0x989b80=_[_0x6e70('0x36')](_0x233a83)||_[_0x6e70('0x37')](_0x233a83)?_0x233a83[_0x6e70('0x38')]():_0x233a83;return this[_0x6e70('0x24')](util[_0x6e70('0x28')](_0x6e70('0x39'),_0x32d12d,_0x989b80?_0x989b80[_0x6e70('0x38')]()['replace'](/(\r\n|\n|\r)/gm,'\x20'):''));};AGIChannel['prototype']['sayNumber']=function(_0x155a46,_0x3841a0){return this[_0x6e70('0x24')](util[_0x6e70('0x28')](_0x6e70('0x3a'),_0x155a46,_0x3841a0));};AGIChannel[_0x6e70('0x25')]['sayDigits']=function(_0x3b508c,_0x9e7ad2){return this[_0x6e70('0x24')](util[_0x6e70('0x28')](_0x6e70('0x3b'),_0x3b508c,_0x9e7ad2));};AGIChannel[_0x6e70('0x25')][_0x6e70('0x3c')]=function(_0x16fc7d,_0x5be100){return this[_0x6e70('0x24')](util[_0x6e70('0x28')](_0x6e70('0x3d'),_0x16fc7d,_0x5be100));};AGIChannel[_0x6e70('0x25')][_0x6e70('0x3e')]=function(_0x1de947,_0x21b0e7,_0x4a8adc){_0x21b0e7=_0x21b0e7||this['extension'];_0x4a8adc=_0x4a8adc||0x1;this['setContext'](_0x1de947);this[_0x6e70('0x3f')](_0x21b0e7);this[_0x6e70('0x32')](_0x4a8adc);return this[_0x6e70('0x40')](util[_0x6e70('0x28')](_0x6e70('0x41'),_0x1de947,_0x21b0e7,_0x4a8adc));};AGIChannel['prototype'][_0x6e70('0x42')]=function(_0x2a58d7){return this[_0x6e70('0x24')](util['format']('GET\x20VARIABLE\x20\x22%s\x22',_0x2a58d7));};AGIChannel['prototype'][_0x6e70('0x43')]=function(_0x5cca5b,_0x42f49a,_0x39913a,_0x3fed21,_0x75a90d,_0x59c87d){_0x42f49a=_0x42f49a||_0x6e70('0x44');_0x39913a=_0x39913a||'';_0x3fed21=_0x3fed21===undefined?-0x1:_0x3fed21==='-1'?-0x1:_0x3fed21*0x3e8;_0x75a90d=_0x75a90d===undefined?'':'s='+_0x75a90d;_0x59c87d=_0x59c87d?'BEEP':'';return this[_0x6e70('0x24')](util[_0x6e70('0x28')](_0x6e70('0x45'),_0x5cca5b,_0x42f49a,_0x39913a,_0x3fed21,_0x59c87d,_0x75a90d));};AGIChannel[_0x6e70('0x25')]['streamFile']=function(_0x291de6,_0x44b637){_0x44b637=_0x44b637||'';return this[_0x6e70('0x24')](util[_0x6e70('0x28')](_0x6e70('0x46'),_0x291de6,_0x44b637));};AGIChannel[_0x6e70('0x25')][_0x6e70('0x47')]=function(_0x552e7e){return this[_0x6e70('0x2c')](_0x6e70('0x48'),_0x552e7e);};AGIChannel[_0x6e70('0x25')][_0x6e70('0x49')]=function(_0x3f86cf){return this[_0x6e70('0x2c')](_0x6e70('0x4a'),_0x3f86cf);};AGIChannel['prototype'][_0x6e70('0x18')]=function(_0x50cdf1,_0x11794e){this[_0x6e70('0x40')](util['format']('ID:%s\x20-\x20LABEL:\x20%s\x20-\x20MSG:\x20%s',_0x50cdf1['id'],_0x50cdf1[_0x6e70('0x4b')],_0x11794e));return{'code':0x1f4,'result':'-1','extra':''};};module[_0x6e70('0x4c')]=AGIChannel; \ No newline at end of file +var _0xedd9=['getVariable','GET\x20VARIABLE\x20\x22%s\x22','recordFile','wav','BEEP','RECORD\x20FILE\x20\x22%s\x22\x20\x22%s\x22\x20\x22%s\x22\x20%s\x20%s\x20%s','streamFile','STREAM\x20FILE\x20\x22%s\x22\x20\x22%s\x22','AGI','wait','WAIT','noop','ID:%s\x20-\x20LABEL:\x20%s\x20-\x20MSG:\x20%s','label','exports','lodash','events','EventEmitter','./reply','./error','call','setEncoding','utf8','headers','emit','line','toLowerCase','hangup','substring','search','520\x20End\x20of\x20proper','function','no\x20code','replace','result=','indexOf','substr','startsWith','split','length','match','error','code','close','E_AGI_SOCKET_CLOSE','destroy','pipe','write','inherits','prototype','command','sync','answer','getData','format','GET\x20DATA\x20\x22%s\x22\x20%s\x20%s','NO\x20MESSAGE','sendRequest','exec','isArray','EXEC\x20%s\x20%s','join','setContext','SET\x20CONTEXT\x20%s','SET\x20EXTENSION\x20%s','setPriority','SET\x20PRIORITY\x20%s','HANGUP','setVariable','isBoolean','isNumber','toString','SET\x20VARIABLE\x20%s\x20\x22%s\x22','sayNumber','SAY\x20DIGITS\x20%s\x20%s','sayPhonetic','continueAt','extension','GOTO\x20%s\x20%s\x20%s'];(function(_0x2c91e9,_0x2fb965){var _0x13f0ff=function(_0xb39edf){while(--_0xb39edf){_0x2c91e9['push'](_0x2c91e9['shift']());}};_0x13f0ff(++_0x2fb965);}(_0xedd9,0xfc));var _0x9edd=function(_0x4cb55d,_0x1c6444){_0x4cb55d=_0x4cb55d-0x0;var _0x18b1ed=_0xedd9[_0x4cb55d];return _0x18b1ed;};'use strict';var util=require('util');var _=require(_0x9edd('0x0'));var EventEmitter=require(_0x9edd('0x1'))[_0x9edd('0x2')];var AGIReply=require(_0x9edd('0x3'));var AGIError=require(_0x9edd('0x4'));function AGIChannel(_0x127cbe){var _0x3e6d3a=this,_0x36b53f=new AGIReply(),_0x5943b3=![],_0x33679f={};EventEmitter[_0x9edd('0x5')](_0x3e6d3a);_0x127cbe[_0x9edd('0x6')](_0x9edd('0x7'));_0x127cbe['setTimeout'](0x8*0x3c*0x3c*0x3e8);_0x36b53f[_0x9edd('0x6')]('utf8');_0x36b53f['on'](_0x9edd('0x8'),function(_0x190185){for(var _0x1355be in _0x190185){_0x3e6d3a[_0x1355be]=_0x190185[_0x1355be];}_0x3e6d3a[_0x9edd('0x9')]('ready');});_0x36b53f['on'](_0x9edd('0xa'),function(_0x5d2f90){if(_0x5d2f90[_0x9edd('0xb')]()==_0x9edd('0xc')){_0x3e6d3a['emit'](_0x9edd('0xc'));return;}if(_0x5d2f90[_0x9edd('0xd')](0x0,0xb)=='520-Invalid'){_0x5943b3=!![];}if(_0x5943b3){_0x33679f['rx']+=_0x5d2f90+'\x0a';if(_0x5d2f90[_0x9edd('0xe')](_0x9edd('0xf'))!=-0x1){_0x5943b3=![];}}else{_0x33679f['rx']=_0x5d2f90;}if(_0x5943b3){return;}if(typeof _0x33679f['cb']==_0x9edd('0x10')){var _0xfd544a=_0x33679f['rx'][_0x9edd('0xd')](0x0,0x3),_0x287ddd=null,_0x3a7b84=null;_0xfd544a=parseInt(_0xfd544a);if(isNaN(_0xfd544a)){_0x33679f['cb'](null,{'code':0x1f4,'result':-0x1,'extra':_0x9edd('0x11')});return;}if(_0xfd544a!=0xc8){_0x33679f['cb'](null,{'code':_0xfd544a,'result':-0x1,'extra':'KO'});return;}_0x287ddd=_0x33679f['rx']['substring'](0x4)[_0x9edd('0x12')](_0x9edd('0x13'),'');if(_0x287ddd[_0x9edd('0x14')]('\x20')!=-0x1){_0x287ddd=_0x287ddd[_0x9edd('0x15')](0x0,_0x287ddd[_0x9edd('0x14')]('\x20'));}if(_[_0x9edd('0x16')](_0x287ddd,'-1')){_0x287ddd=parseInt(_0x287ddd);}_0x3a7b84=_0x33679f['rx'][_0x9edd('0x17')]('\x20');if(_0x3a7b84[_0x9edd('0x18')]==0x3){_0x3a7b84=_0x3a7b84[0x2]['substring'](0x1,_0x3a7b84[0x2][_0x9edd('0x18')]-0x1);}else if(_0x3a7b84[_0x9edd('0x18')]>0x3){var _0x449cee=/\((.+)\)/;var _0x5acf65=_0x33679f['rx'][_0x9edd('0x19')](_0x449cee);if(_0x5acf65){_0x3a7b84=_0x5acf65[0x1];}else{_0x3a7b84=null;}}else{_0x3a7b84=null;}_0x33679f['cb'](null,{'code':_0xfd544a,'result':_0x287ddd,'extra':_0x3a7b84});}});_0x127cbe['on'](_0x9edd('0x1a'),function(_0x40ba32){_0x3e6d3a['emit'](_0x9edd('0x1a'),new AGIError('E_AGI_SOCKET_ERROR',_0x40ba32[_0x9edd('0x1b')]));});_0x127cbe['on'](_0x9edd('0x1c'),function(){_0x3e6d3a['emit']('close',new AGIError(_0x9edd('0x1d')));});_0x127cbe['on']('timeout',function(){_0x3e6d3a[_0x9edd('0x9')]('timeout',new AGIError('E_AGI_SOCKET_TIMEOUT'));_0x127cbe[_0x9edd('0x1e')]();});_0x127cbe[_0x9edd('0x1f')](_0x36b53f);this['command']=function(_0x5823bc,_0x341d67){var _0x5823bc=_0x5823bc||'',_0x341d67=typeof _0x341d67=='function'?_0x341d67:new Function();_0x33679f={'tx':_0x5823bc,'rx':'','cb':_0x341d67};_0x127cbe[_0x9edd('0x20')](_0x5823bc+'\x0a');},this[_0x9edd('0x1c')]=function(){_0x127cbe[_0x9edd('0x1e')]();};}util[_0x9edd('0x21')](AGIChannel,EventEmitter);AGIChannel[_0x9edd('0x22')]['sendRequest']=function(_0x46c383){return this[_0x9edd('0x23')][_0x9edd('0x24')](this,_0x46c383);};AGIChannel[_0x9edd('0x22')][_0x9edd('0x25')]=function(){return this['sendRequest']('ANSWER');};AGIChannel[_0x9edd('0x22')][_0x9edd('0x26')]=function(_0x8d67aa,_0x25e135,_0x3c2227){_0x8d67aa=_0x8d67aa===undefined?'beep':_0x8d67aa;_0x25e135=_0x25e135===undefined?'5':_0x25e135;_0x3c2227=_0x3c2227===undefined?'1':_0x3c2227;return this['sendRequest'](util[_0x9edd('0x27')](_0x9edd('0x28'),_0x8d67aa,_0x25e135*0x3e8,_0x3c2227));};AGIChannel[_0x9edd('0x22')]['noop']=function(_0x238b22){_0x238b22=_0x238b22||_0x9edd('0x29');return this[_0x9edd('0x2a')](util[_0x9edd('0x27')]('VERBOSE\x20\x22%s\x22',_0x238b22));};AGIChannel[_0x9edd('0x22')][_0x9edd('0x2b')]=function(_0xbe87e1,_0x12c1bc){if(_[_0x9edd('0x2c')](_0x12c1bc)){return this[_0x9edd('0x2a')](util[_0x9edd('0x27')](_0x9edd('0x2d'),_0xbe87e1,_0x12c1bc[_0x9edd('0x2e')](',')));}return this[_0x9edd('0x2a')](util[_0x9edd('0x27')](_0x9edd('0x2d'),_0xbe87e1,_0x12c1bc));};AGIChannel[_0x9edd('0x22')][_0x9edd('0x2f')]=function(_0x1a6c23){return this['sendRequest'](util[_0x9edd('0x27')](_0x9edd('0x30'),_0x1a6c23));};AGIChannel[_0x9edd('0x22')]['setExtension']=function(_0x2d2f88){return this[_0x9edd('0x2a')](util[_0x9edd('0x27')](_0x9edd('0x31'),_0x2d2f88));};AGIChannel[_0x9edd('0x22')][_0x9edd('0x32')]=function(_0x473068){return this[_0x9edd('0x2a')](util[_0x9edd('0x27')](_0x9edd('0x33'),_0x473068));};AGIChannel[_0x9edd('0x22')][_0x9edd('0xc')]=function(){return this[_0x9edd('0x2a')](_0x9edd('0x34'));};AGIChannel['prototype'][_0x9edd('0x35')]=function(_0x5ed62d,_0x968303){var _0x148630=_[_0x9edd('0x36')](_0x968303)||_[_0x9edd('0x37')](_0x968303)?_0x968303[_0x9edd('0x38')]():_0x968303;return this['sendRequest'](util[_0x9edd('0x27')](_0x9edd('0x39'),_0x5ed62d,_0x148630?_0x148630[_0x9edd('0x38')]()[_0x9edd('0x12')](/(\r\n|\n|\r)/gm,'\x20'):''));};AGIChannel[_0x9edd('0x22')][_0x9edd('0x3a')]=function(_0x5c0627,_0x1cbbac){return this[_0x9edd('0x2a')](util[_0x9edd('0x27')]('SAY\x20NUMBER\x20%s\x20%s',_0x5c0627,_0x1cbbac));};AGIChannel[_0x9edd('0x22')]['sayDigits']=function(_0x3ef1d5,_0x5658d6){return this[_0x9edd('0x2a')](util[_0x9edd('0x27')](_0x9edd('0x3b'),_0x3ef1d5,_0x5658d6));};AGIChannel['prototype'][_0x9edd('0x3c')]=function(_0xcbd0ef,_0x2f8f61){return this['sendRequest'](util[_0x9edd('0x27')]('SAY\x20PHONETIC\x20\x22%s\x22\x20%s',_0xcbd0ef,_0x2f8f61));};AGIChannel[_0x9edd('0x22')][_0x9edd('0x3d')]=function(_0x50be2c,_0x315f52,_0x40fdfb){_0x315f52=_0x315f52||this[_0x9edd('0x3e')];_0x40fdfb=_0x40fdfb||0x1;this[_0x9edd('0x2f')](_0x50be2c);this['setExtension'](_0x315f52);this[_0x9edd('0x32')](_0x40fdfb);return this['noop'](util[_0x9edd('0x27')](_0x9edd('0x3f'),_0x50be2c,_0x315f52,_0x40fdfb));};AGIChannel['prototype'][_0x9edd('0x40')]=function(_0x49a128){return this['sendRequest'](util[_0x9edd('0x27')](_0x9edd('0x41'),_0x49a128));};AGIChannel[_0x9edd('0x22')][_0x9edd('0x42')]=function(_0x25e6ec,_0x4737ae,_0x3ff512,_0x75efbe,_0x18c149,_0x2b081a){_0x4737ae=_0x4737ae||_0x9edd('0x43');_0x3ff512=_0x3ff512||'';_0x75efbe=_0x75efbe===undefined?-0x1:_0x75efbe==='-1'?-0x1:_0x75efbe*0x3e8;_0x18c149=_0x18c149===undefined?'':'s='+_0x18c149;_0x2b081a=_0x2b081a?_0x9edd('0x44'):'';return this[_0x9edd('0x2a')](util[_0x9edd('0x27')](_0x9edd('0x45'),_0x25e6ec,_0x4737ae,_0x3ff512,_0x75efbe,_0x2b081a,_0x18c149));};AGIChannel['prototype'][_0x9edd('0x46')]=function(_0x2570e3,_0x2231c1){_0x2231c1=_0x2231c1||'';return this[_0x9edd('0x2a')](util[_0x9edd('0x27')](_0x9edd('0x47'),_0x2570e3,_0x2231c1));};AGIChannel[_0x9edd('0x22')]['agi']=function(_0x4a4656){return this['exec'](_0x9edd('0x48'),_0x4a4656);};AGIChannel['prototype'][_0x9edd('0x49')]=function(_0x19b56b){return this[_0x9edd('0x2b')](_0x9edd('0x4a'),_0x19b56b);};AGIChannel[_0x9edd('0x22')]['error']=function(_0x387fb8,_0x35e63c){this[_0x9edd('0x4b')](util['format'](_0x9edd('0x4c'),_0x387fb8['id'],_0x387fb8[_0x9edd('0x4d')],_0x35e63c));return{'code':0x1f4,'result':'-1','extra':''};};module[_0x9edd('0x4e')]=AGIChannel; \ No newline at end of file diff --git a/server/services/agi/error.js b/server/services/agi/error.js index 050184b..a3960b9 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 _0xc474=['Server\x20closed.','[LICENSE]\x20Server\x20max\x20connection.\x20Count:\x20%s.','[LICENSE\x20VOICE]\x20Server\x20license\x20voice\x20disabled.','Socket\x20error.\x20Code:\x20%s.','Socket\x20closed.','Socket\x20timeout.','Empty\x20command.','Missing\x20\x27ivr.agi_network_script\x27.','E_AGI_UNDEFINED','push','format','message','name','exports','util','Undefined\x20error.','Argument\x20\x27port\x27\x20missing\x20in\x20function\x20call.'];(function(_0x152761,_0x249ec5){var _0x9700a8=function(_0x3b488a){while(--_0x3b488a){_0x152761['push'](_0x152761['shift']());}};_0x9700a8(++_0x249ec5);}(_0xc474,0xfc));var _0x4c47=function(_0x45d3f0,_0x4be53f){_0x45d3f0=_0x45d3f0-0x0;var _0x314b79=_0xc474[_0x45d3f0];return _0x314b79;};'use strict';var util=require(_0x4c47('0x0'));var error={'E_AGI_UNDEFINED':_0x4c47('0x1'),'E_AGI_ARGUMENT_PORT':_0x4c47('0x2'),'E_AGI_SERVER_ERROR':'Server\x20error.\x20Code:\x20%s.','E_AGI_SERVER_CLOSE':_0x4c47('0x3'),'E_AGI_SERVER_MAXCONNECTION':_0x4c47('0x4'),'E_AGI_SERVER_VOICE_DISABLED':_0x4c47('0x5'),'E_AGI_SOCKET_ERROR':_0x4c47('0x6'),'E_AGI_SOCKET_CLOSE':_0x4c47('0x7'),'E_AGI_SOCKET_TIMEOUT':_0x4c47('0x8'),'E_AGI_COMMAND_EMPTY':_0x4c47('0x9'),'E_AGI_IVR_AGI_NETWORK_SCRIPT':_0x4c47('0xa'),'E_AGI_IVR_ENTRY':'Missing\x20\x27ivr.entry\x27\x20menu.'};function AGIError(_0x5aaf0e){var _0x5aaf0e=_0x5aaf0e||null,_0x255b6e=_0x255b6e||[],_0x275a64=0x1,_0x35a093='';if(!error[_0x5aaf0e]){_0x5aaf0e=_0x4c47('0xb');}_0x255b6e['push'](error[_0x5aaf0e]);while(arguments[_0x275a64]){_0x255b6e[_0x4c47('0xc')](arguments[_0x275a64]);_0x275a64++;}_0x35a093=util[_0x4c47('0xd')]['apply'](util,_0x255b6e);this[_0x4c47('0xe')]=_0x35a093;this[_0x4c47('0xf')]=_0x5aaf0e;}module[_0x4c47('0x10')]=AGIError; \ No newline at end of file +var _0x5447=['Socket\x20timeout.','Empty\x20command.','Missing\x20\x27ivr.agi_network_script\x27.','Missing\x20\x27ivr.entry\x27\x20menu.','push','format','exports','util','Argument\x20\x27port\x27\x20missing\x20in\x20function\x20call.','Server\x20error.\x20Code:\x20%s.','[LICENSE]\x20Server\x20max\x20connection.\x20Count:\x20%s.','Socket\x20error.\x20Code:\x20%s.','Socket\x20closed.'];(function(_0x4595ac,_0x4a6c83){var _0x13c73c=function(_0x3b5faf){while(--_0x3b5faf){_0x4595ac['push'](_0x4595ac['shift']());}};_0x13c73c(++_0x4a6c83);}(_0x5447,0xf1));var _0x7544=function(_0x1ca1f3,_0x39d514){_0x1ca1f3=_0x1ca1f3-0x0;var _0x5255c0=_0x5447[_0x1ca1f3];return _0x5255c0;};'use strict';var util=require(_0x7544('0x0'));var error={'E_AGI_UNDEFINED':'Undefined\x20error.','E_AGI_ARGUMENT_PORT':_0x7544('0x1'),'E_AGI_SERVER_ERROR':_0x7544('0x2'),'E_AGI_SERVER_CLOSE':'Server\x20closed.','E_AGI_SERVER_MAXCONNECTION':_0x7544('0x3'),'E_AGI_SERVER_VOICE_DISABLED':'[LICENSE\x20VOICE]\x20Server\x20license\x20voice\x20disabled.','E_AGI_SOCKET_ERROR':_0x7544('0x4'),'E_AGI_SOCKET_CLOSE':_0x7544('0x5'),'E_AGI_SOCKET_TIMEOUT':_0x7544('0x6'),'E_AGI_COMMAND_EMPTY':_0x7544('0x7'),'E_AGI_IVR_AGI_NETWORK_SCRIPT':_0x7544('0x8'),'E_AGI_IVR_ENTRY':_0x7544('0x9')};function AGIError(_0x3feef7){var _0x3feef7=_0x3feef7||null,_0x77d91e=_0x77d91e||[],_0x1201c8=0x1,_0x2137ab='';if(!error[_0x3feef7]){_0x3feef7='E_AGI_UNDEFINED';}_0x77d91e[_0x7544('0xa')](error[_0x3feef7]);while(arguments[_0x1201c8]){_0x77d91e[_0x7544('0xa')](arguments[_0x1201c8]);_0x1201c8++;}_0x2137ab=util[_0x7544('0xb')]['apply'](util,_0x77d91e);this['message']=_0x2137ab;this['name']=_0x3feef7;}module[_0x7544('0xc')]=AGIError; \ No newline at end of file diff --git a/server/services/agi/graph/index.js b/server/services/agi/graph/index.js index c225f35..c42989c 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 _0x4024=['no\x20edge/s\x20available','condition','split','agicommand','default','target','invalid','traverseBFS','vswitch','default\x20on\x20switch\x20not\x20found','max\x20retry\x20reach','condition\x20not\x20found','lodash','../../../config/logger','menu','getdigits','vertices','numberOfEdges','prototype','edges','size','info','no\x20vertex\x20found','stop\x20traverse','length'];(function(_0xec17e6,_0x491b71){var _0x3f7dd1=function(_0x353697){while(--_0x353697){_0xec17e6['push'](_0xec17e6['shift']());}};_0x3f7dd1(++_0x491b71);}(_0x4024,0x89));var _0x4402=function(_0x54e7cb,_0x543d0e){_0x54e7cb=_0x54e7cb-0x0;var _0x1435ec=_0x4024[_0x54e7cb];return _0x1435ec;};'use strict';var _=require(_0x4402('0x0'));var logger=require(_0x4402('0x1'))('agi');var verticesWithRetry=[_0x4402('0x2'),_0x4402('0x3'),'getsecretdigits'];var Graph=function(){this[_0x4402('0x4')]={};this['edges']={};this[_0x4402('0x5')]=0x0;};Graph[_0x4402('0x6')]['addVertex']=function(_0x4f9482){this[_0x4402('0x4')][_0x4f9482['id']]=_0x4f9482;this[_0x4402('0x7')][_0x4f9482['id']]=[];};Graph[_0x4402('0x6')]['addEdge']=function(_0x3045ae,_0x5d7ca4,_0x5c0b70){this[_0x4402('0x7')][_0x3045ae]['push']({'target':_0x5d7ca4,'condition':_0x5c0b70});this['numberOfEdges']+=0x1;};Graph[_0x4402('0x6')]['size']=function(){return _[_0x4402('0x8')](this['vertices']);};Graph[_0x4402('0x6')]['relations']=function(){return this[_0x4402('0x5')];};Graph[_0x4402('0x6')]['getVertex']=function(_0x949ab7){return this[_0x4402('0x4')][_0x949ab7];};Graph[_0x4402('0x6')]['traverseBFS']=function(_0x7e4475,_0x34d952){if(!this[_0x4402('0x4')][_0x7e4475]){return logger[_0x4402('0x9')](_0x4402('0xa'));}var _0x31710c=_0x34d952(this[_0x4402('0x4')][_0x7e4475]);if(!_0x31710c){return logger[_0x4402('0x9')](_0x4402('0xb'));}if(this[_0x4402('0x7')][_0x7e4475][_0x4402('0xc')]===0x0){return logger[_0x4402('0x9')](_0x4402('0xd'));}for(var _0x19fe7b=0x0,_0xfd9853=[],_0x30c390=![];_0x19fe7b\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','[HANGUP]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','evtHangup','mxGraphModel','root','agicommand','retry','maxRetry','hasOwnProperty','length','source','target','addEdge','value','then','catch','substring','inspect','debug','stringify','[START]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','hangup','sync','production','start','joinAt','YYYY-MM-DD\x20HH:mm:ss','omit','mxCell','[START\x20TRAVERSE]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','traverseBFS','clear','context','extension','priority','response','isUndefined','result','toString','agicommand\x20not\x20found','finally','[FINALLY\x20TRAVERSE]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','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','Project\x20%s\x20not\x20published','continueAt','close','Project\x20%s\x20not\x20found','voice','callysquare','[LICENSE]\x20CHANNELS:\x20%s','[LICENSE]\x20CHANNELS:\x20UNLIMITED','[LICENSE]','./server','listening','connection','xml2json','lodash','syncho','moment','../../config/logger','agi','./rpc','./mailRpc','./graph','./vertices','defaults','nextTick','error','stack','Cally\x20Square\x20server\x20listening\x20on\x20port\x20%d!','port','info','format','[LISTENING]\x20Cally\x20Square\x20listening\x20%s:%d','message','[%s]\x20%s','name','[ERROR]\x20%s','[CLOSE]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','arg_1','calleridname','callerid','dnid','uniqueid'];(function(_0x2b3bb9,_0x1556ce){var _0x5d3da5=function(_0x10e14d){while(--_0x10e14d){_0x2b3bb9['push'](_0x2b3bb9['shift']());}};_0x5d3da5(++_0x1556ce);}(_0xdc97,0x13b));var _0x7dc9=function(_0x12ab1f,_0x1c555f){_0x12ab1f=_0x12ab1f-0x0;var _0x1598be=_0xdc97[_0x12ab1f];return _0x1598be;};'use strict';var parser=require(_0x7dc9('0x0'));var _=require(_0x7dc9('0x1'));var syncho=require(_0x7dc9('0x2'));var util=require('util');var moment=require(_0x7dc9('0x3'));var config=require('../../config/environment');var logger=require(_0x7dc9('0x4'))(_0x7dc9('0x5'));var utilLicense=require('../../config/license/util');var rpc=require(_0x7dc9('0x6'));var mailRpc=require(_0x7dc9('0x7'));var Graph=require(_0x7dc9('0x8'));var Vertices=require(_0x7dc9('0x9'));var AGI_CODE_SUCCESS=0xc8;var AGI_RESULT_ERROR=-0x1;config['agi']=_[_0x7dc9('0xa')](config['agi'],{'ip':'127.0.0.1','port':0x11dd});function connectionHandler(_0x2ff923){process[_0x7dc9('0xb')](function(){syncho(function(){try{setChannelVariables(_0x2ff923);agiHandler(_0x2ff923);}catch(_0x3318ea){logger[_0x7dc9('0xc')](_0x3318ea[_0x7dc9('0xd')]);}});});}function listeningHandler(){console['log'](_0x7dc9('0xe'),config[_0x7dc9('0x5')][_0x7dc9('0xf')]);logger[_0x7dc9('0x10')](util[_0x7dc9('0x11')](_0x7dc9('0x12'),config[_0x7dc9('0x5')]['ip'],config['agi']['port']));}function errorHandler(_0x4be1c8){if(_0x4be1c8&&_0x4be1c8['name']&&_0x4be1c8[_0x7dc9('0x13')]){logger[_0x7dc9('0xc')](util['format'](_0x7dc9('0x14'),_0x4be1c8[_0x7dc9('0x15')],_0x4be1c8[_0x7dc9('0x13')]));}else{logger[_0x7dc9('0xc')](util[_0x7dc9('0x11')](_0x7dc9('0x16'),_0x4be1c8['stack']));}}function closeHandler(){logger[_0x7dc9('0x10')](util[_0x7dc9('0x11')](_0x7dc9('0x17'),this[_0x7dc9('0x18')],this[_0x7dc9('0x19')],this[_0x7dc9('0x1a')],this[_0x7dc9('0x1b')],this[_0x7dc9('0x1c')]));try{createSquareReport(this);}catch(_0x4778d5){logger['error'](_0x4778d5[_0x7dc9('0xd')]);}}function timeoutHandler(){logger['info'](util[_0x7dc9('0x11')](_0x7dc9('0x1d'),this['arg_1'],this[_0x7dc9('0x19')],this[_0x7dc9('0x1a')],this[_0x7dc9('0x1b')],this[_0x7dc9('0x1c')]));}function hangupHandler(){logger[_0x7dc9('0x10')](util[_0x7dc9('0x11')](_0x7dc9('0x1e'),this[_0x7dc9('0x18')],this[_0x7dc9('0x19')],this[_0x7dc9('0x1a')],this['dnid'],this['uniqueid']));this[_0x7dc9('0x1f')]=!![];}function getRoot(_0x5981e2){return parser['toJson'](_0x5981e2,{'object':!![]})[_0x7dc9('0x20')][_0x7dc9('0x21')];}function addVertex(_0x5e9525,_0xffc080,_0x43d31f){_0xffc080[_0x7dc9('0x22')]=_0x43d31f;if(_0xffc080['hasOwnProperty'](_0x7dc9('0x23'))){_0xffc080[_0x7dc9('0x24')]=parseInt(_0xffc080[_0x7dc9('0x23')],0xa);}_0x5e9525['addVertex'](_['omit'](_0xffc080,'mxCell'));}function initGraph(_0x25b383,_0x32d032){var _0x5843bf=new Graph();for(var _0x585eef in _0x25b383){if(_0x25b383[_0x7dc9('0x25')](_0x585eef)){if(_['isArray'](_0x25b383[_0x585eef])){for(var _0x2d22eb=0x0;_0x2d22eb<_0x25b383[_0x585eef][_0x7dc9('0x26')];_0x2d22eb+=0x1){addVertex(_0x5843bf,_0x25b383[_0x585eef][_0x2d22eb],_0x585eef);}}else{addVertex(_0x5843bf,_0x25b383[_0x585eef],_0x585eef);}}}for(var _0x3a74a0=0x0;_0x3a74a0<_0x32d032[_0x7dc9('0x26')];_0x3a74a0+=0x1){if(_0x32d032[_0x3a74a0][_0x7dc9('0x27')]&&_0x32d032[_0x3a74a0][_0x7dc9('0x28')]){_0x5843bf[_0x7dc9('0x29')](_0x32d032[_0x3a74a0][_0x7dc9('0x27')],_0x32d032[_0x3a74a0][_0x7dc9('0x28')],_0x32d032[_0x3a74a0][_0x7dc9('0x2a')]);}}return _0x5843bf;}function getSquareProject(_0x14083d,_0x2a456c){rpc['getSquareProject'](_0x14083d)['then'](function(_0x513dd6){_0x2a456c(null,_0x513dd6);})['catch'](function(_0x4a68f0){_0x2a456c(null,_0x4a68f0);});}function createSquareReport(_0x553a03,_0x58c4e8){rpc['createSquareReport'](_0x553a03)[_0x7dc9('0x2b')](function(_0x21c4c2){if(_0x58c4e8){_0x58c4e8(null,_0x21c4c2);}})[_0x7dc9('0x2c')](function(_0x225410){if(_0x58c4e8){_0x58c4e8(null,_0x225410);}});}function setChannelVariables(_0x3300ff){for(var _0x154e22 in _0x3300ff){if(_0x3300ff['hasOwnProperty'](_0x154e22)){if(_0x154e22['indexOf']('agi_')===0x0){_0x3300ff[_0x154e22[_0x7dc9('0x2d')](0x4)]=_0x3300ff[_0x154e22];delete _0x3300ff[_0x154e22];}}}}function getLogFromObject(_0x49ed97){return util[_0x7dc9('0x2e')](_0x49ed97,{'showHidden':![],'depth':null});}function agiHandler(_0x448e46){var _0x1298f9,_0x213066,_0x109c66,_0x165882,_0xbb11e1;logger[_0x7dc9('0x2f')]('variables',JSON[_0x7dc9('0x30')](_0x448e46,null,0x2));logger['info'](util[_0x7dc9('0x11')](_0x7dc9('0x31'),_0x448e46[_0x7dc9('0x18')],_0x448e46[_0x7dc9('0x19')],_0x448e46['callerid'],_0x448e46[_0x7dc9('0x1b')],_0x448e46['uniqueid']));_0x448e46['on'](_0x7dc9('0xc'),errorHandler);_0x448e46['on']('close',closeHandler);_0x448e46['on']('timeout',timeoutHandler);_0x448e46[_0x7dc9('0x1f')]=![];_0x448e46['on'](_0x7dc9('0x32'),hangupHandler);var _0x21e036=getSquareProject[_0x7dc9('0x33')](null,_0x448e46['arg_1']);if(_0x21e036){if(_0x21e036[_0x7dc9('0x34')]){_0x1298f9=getRoot(_0x21e036[_0x7dc9('0x34')]);if(_0x1298f9&&_0x1298f9[_0x7dc9('0x35')]){logger[_0x7dc9('0x2f')](_0x7dc9('0x21'),JSON[_0x7dc9('0x30')](_0x1298f9,null,0x2));_0x448e46[_0x7dc9('0x36')]=moment()[_0x7dc9('0x11')](_0x7dc9('0x37'));_0x213066=initGraph(_[_0x7dc9('0x38')](_0x1298f9,_0x7dc9('0x39')),_0x1298f9[_0x7dc9('0x39')]);_0x109c66=new Vertices(_0x448e46,rpc,mailRpc);logger['info'](util[_0x7dc9('0x11')](_0x7dc9('0x3a'),_0x448e46[_0x7dc9('0x18')],_0x448e46[_0x7dc9('0x19')],_0x448e46['callerid'],_0x448e46[_0x7dc9('0x1b')],_0x448e46[_0x7dc9('0x1c')]));_0x213066[_0x7dc9('0x3b')](_0x1298f9[_0x7dc9('0x35')]['id'],function(_0x295853){try{_0x295853=_0x109c66[_0x7dc9('0x3c')](_0x295853);logger['debug']('vertex',JSON[_0x7dc9('0x30')](_0x295853,null,0x2));if(_0x295853[_0x7dc9('0x22')]==='gotoc'){logger[_0x7dc9('0x10')]('gotoc\x20block\x20stop\x20traverse\x20BFS');_0x448e46[_0x7dc9('0x3d')]=_0x295853[_0x7dc9('0x3d')]||_0x448e46[_0x7dc9('0x3d')];_0x448e46['extension']=_0x295853[_0x7dc9('0x3e')];_0x448e46[_0x7dc9('0x3f')]=_0x295853[_0x7dc9('0x3f')]?_0x295853[_0x7dc9('0x3f')]-0x1:0x1;return null;}else if(_0x295853&&_0x109c66[_0x295853[_0x7dc9('0x22')]]){_0xbb11e1=_0x109c66[_0x295853[_0x7dc9('0x22')]](_0x295853);logger[_0x7dc9('0x10')]('response',JSON[_0x7dc9('0x30')](_0xbb11e1,null,0x2));if(_0xbb11e1&&_0xbb11e1['code']===AGI_CODE_SUCCESS&&_0xbb11e1['result']!==AGI_RESULT_ERROR&&!_0x448e46[_0x7dc9('0x1f')]){logger[_0x7dc9('0x2f')](_0x7dc9('0x40'),getLogFromObject(_0xbb11e1));return _[_0x7dc9('0x41')](_0xbb11e1[_0x7dc9('0x42')])?null:_0xbb11e1[_0x7dc9('0x42')][_0x7dc9('0x43')]();}else{logger[_0x7dc9('0xc')](_0x7dc9('0x40'),getLogFromObject(_0xbb11e1));return null;}}else{logger['error'](_0x7dc9('0x44'));return null;}}catch(_0x1971c7){logger[_0x7dc9('0xc')](_0x1971c7[_0x7dc9('0xd')]);return null;}});if(_0x1298f9[_0x7dc9('0x45')]){logger[_0x7dc9('0x10')](util['format'](_0x7dc9('0x46'),_0x448e46[_0x7dc9('0x18')],_0x448e46['calleridname'],_0x448e46[_0x7dc9('0x1a')],_0x448e46[_0x7dc9('0x1b')],_0x448e46[_0x7dc9('0x1c')]));_0x213066['traverseBFS'](_0x1298f9[_0x7dc9('0x45')]['id'],function(_0x5b3895){try{_0x5b3895=_0x109c66['clear'](_0x5b3895);logger[_0x7dc9('0x2f')](_0x7dc9('0x47'),JSON[_0x7dc9('0x30')](_0x5b3895,null,0x2));if(_0x5b3895&&_0x109c66[_0x5b3895['agicommand']]){_0xbb11e1=_0x109c66[_0x5b3895['agicommand']](_0x5b3895);if(_0xbb11e1){logger[_0x7dc9('0x2f')]('response',getLogFromObject(_0xbb11e1));return _[_0x7dc9('0x41')](_0xbb11e1[_0x7dc9('0x42')])?null:_0xbb11e1['result'][_0x7dc9('0x43')]();}else{logger[_0x7dc9('0xc')](_0x7dc9('0x40'),getLogFromObject(_0xbb11e1));return null;}}else{logger[_0x7dc9('0xc')](_0x7dc9('0x44'));return null;}}catch(_0x113087){logger[_0x7dc9('0xc')](_0x113087[_0x7dc9('0xd')]);return null;}});}logger[_0x7dc9('0x10')](util[_0x7dc9('0x11')](_0x7dc9('0x48'),_0x448e46[_0x7dc9('0x18')],_0x448e46[_0x7dc9('0x19')],_0x448e46['callerid'],_0x448e46[_0x7dc9('0x1b')],_0x448e46['uniqueid']));logger['info'](util[_0x7dc9('0x11')](_0x7dc9('0x49'),_0x448e46[_0x7dc9('0x3d')],_0x448e46[_0x7dc9('0x3e')],parseInt(_0x448e46[_0x7dc9('0x3f')],0xa)+0x1));_0x448e46['continueAt'](_0x448e46[_0x7dc9('0x3d')],_0x448e46[_0x7dc9('0x3e')],parseInt(_0x448e46[_0x7dc9('0x3f')],0xa)+0x1);_0x448e46['close']();}}else{logger[_0x7dc9('0xc')](util[_0x7dc9('0x11')](_0x7dc9('0x4a'),_0x448e46[_0x7dc9('0x18')]));_0x448e46[_0x7dc9('0x4b')](_0x448e46[_0x7dc9('0x3d')],_0x448e46['extension'],parseInt(_0x448e46[_0x7dc9('0x3f')],0xa)+0x1);_0x448e46[_0x7dc9('0x4c')]();}}else{logger[_0x7dc9('0xc')](util[_0x7dc9('0x11')](_0x7dc9('0x4d'),_0x448e46[_0x7dc9('0x18')]));_0x448e46[_0x7dc9('0x4b')](_0x448e46[_0x7dc9('0x3d')],_0x448e46[_0x7dc9('0x3e')],parseInt(_0x448e46[_0x7dc9('0x3f')],0xa)+0x1);_0x448e46[_0x7dc9('0x4c')]();}}function main(){var _0x3819e5;return utilLicense['getLicense']()[_0x7dc9('0x2b')](function(_0x39be46){if(_0x39be46){if(_0x39be46[_0x7dc9('0x4e')]){if(_0x39be46[_0x7dc9('0x4f')]&&_0x39be46[_0x7dc9('0x4f')]>0x0){logger['info'](util[_0x7dc9('0x11')](_0x7dc9('0x50'),_0x39be46[_0x7dc9('0x4f')]));_0x3819e5=_0x39be46[_0x7dc9('0x4f')];}else{logger[_0x7dc9('0x10')](_0x7dc9('0x51'));}}else{logger['info']('[LICENSE]\x20VOICE\x20IS\x20DISABLED');_0x3819e5=-0x1;}}})['catch'](function(_0x25bdee){logger[_0x7dc9('0xc')](_0x7dc9('0x52'),_0x25bdee[_0x7dc9('0xd')]);})['finally'](function(){var _0x5a6cfe=require(_0x7dc9('0x53'))(config[_0x7dc9('0x5')][_0x7dc9('0xf')],config[_0x7dc9('0x5')]['ip'],_0x3819e5);_0x5a6cfe['on'](_0x7dc9('0xc'),errorHandler);_0x5a6cfe['on'](_0x7dc9('0x54'),listeningHandler);_0x5a6cfe['on'](_0x7dc9('0x55'),connectionHandler);_0x5a6cfe['on']('close',closeHandler);});}main(); \ No newline at end of file +var _0xf2ca=['[START\x20TRAVERSE]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','traverseBFS','vertex','gotoc','context','priority','result','response','toString','agicommand\x20not\x20found','finally','clear','isUndefined','[END]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','extension','Project\x20%s\x20not\x20published','continueAt','Project\x20%s\x20not\x20found','getLicense','voice','callysquare','catch','[LICENSE]','./server','listening','connection','xml2json','lodash','syncho','moment','../../config/environment','../../config/logger','agi','../../config/license/util','./rpc','./graph','./vertices','defaults','127.0.0.1','stack','Cally\x20Square\x20server\x20listening\x20on\x20port\x20%d!','port','info','name','format','[%s]\x20%s','message','error','[ERROR]\x20%s','[CLOSE]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','arg_1','calleridname','callerid','dnid','uniqueid','[HANGUP]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','evtHangup','toJson','agicommand','retry','maxRetry','addVertex','omit','mxCell','hasOwnProperty','isArray','length','source','target','value','getSquareProject','then','agi_','substring','inspect','debug','stringify','close','timeout','sync','production','start','joinAt','YYYY-MM-DD\x20HH:mm:ss'];(function(_0x3e5086,_0x48f4a2){var _0xfeb102=function(_0x5a945f){while(--_0x5a945f){_0x3e5086['push'](_0x3e5086['shift']());}};_0xfeb102(++_0x48f4a2);}(_0xf2ca,0x16a));var _0xaf2c=function(_0x4b1012,_0x1415eb){_0x4b1012=_0x4b1012-0x0;var _0x23d715=_0xf2ca[_0x4b1012];return _0x23d715;};'use strict';var parser=require(_0xaf2c('0x0'));var _=require(_0xaf2c('0x1'));var syncho=require(_0xaf2c('0x2'));var util=require('util');var moment=require(_0xaf2c('0x3'));var config=require(_0xaf2c('0x4'));var logger=require(_0xaf2c('0x5'))(_0xaf2c('0x6'));var utilLicense=require(_0xaf2c('0x7'));var rpc=require(_0xaf2c('0x8'));var mailRpc=require('./mailRpc');var Graph=require(_0xaf2c('0x9'));var Vertices=require(_0xaf2c('0xa'));var AGI_CODE_SUCCESS=0xc8;var AGI_RESULT_ERROR=-0x1;config[_0xaf2c('0x6')]=_[_0xaf2c('0xb')](config['agi'],{'ip':_0xaf2c('0xc'),'port':0x11dd});function connectionHandler(_0x3c0421){process['nextTick'](function(){syncho(function(){try{setChannelVariables(_0x3c0421);agiHandler(_0x3c0421);}catch(_0x2a011d){logger['error'](_0x2a011d[_0xaf2c('0xd')]);}});});}function listeningHandler(){console['log'](_0xaf2c('0xe'),config[_0xaf2c('0x6')][_0xaf2c('0xf')]);logger[_0xaf2c('0x10')](util['format']('[LISTENING]\x20Cally\x20Square\x20listening\x20%s:%d',config[_0xaf2c('0x6')]['ip'],config[_0xaf2c('0x6')][_0xaf2c('0xf')]));}function errorHandler(_0xd56a5d){if(_0xd56a5d&&_0xd56a5d[_0xaf2c('0x11')]&&_0xd56a5d['message']){logger['error'](util[_0xaf2c('0x12')](_0xaf2c('0x13'),_0xd56a5d[_0xaf2c('0x11')],_0xd56a5d[_0xaf2c('0x14')]));}else{logger[_0xaf2c('0x15')](util[_0xaf2c('0x12')](_0xaf2c('0x16'),_0xd56a5d[_0xaf2c('0xd')]));}}function closeHandler(){logger[_0xaf2c('0x10')](util[_0xaf2c('0x12')](_0xaf2c('0x17'),this[_0xaf2c('0x18')],this[_0xaf2c('0x19')],this[_0xaf2c('0x1a')],this[_0xaf2c('0x1b')],this['uniqueid']));try{createSquareReport(this);}catch(_0x3ca650){logger['error'](_0x3ca650[_0xaf2c('0xd')]);}}function timeoutHandler(){logger[_0xaf2c('0x10')](util[_0xaf2c('0x12')]('[TIMEOUT]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s',this[_0xaf2c('0x18')],this[_0xaf2c('0x19')],this[_0xaf2c('0x1a')],this[_0xaf2c('0x1b')],this[_0xaf2c('0x1c')]));}function hangupHandler(){logger[_0xaf2c('0x10')](util['format'](_0xaf2c('0x1d'),this[_0xaf2c('0x18')],this[_0xaf2c('0x19')],this[_0xaf2c('0x1a')],this[_0xaf2c('0x1b')],this['uniqueid']));this[_0xaf2c('0x1e')]=!![];}function getRoot(_0xbf6f62){return parser[_0xaf2c('0x1f')](_0xbf6f62,{'object':!![]})['mxGraphModel']['root'];}function addVertex(_0x29cbdf,_0x303546,_0x1cafad){_0x303546[_0xaf2c('0x20')]=_0x1cafad;if(_0x303546['hasOwnProperty'](_0xaf2c('0x21'))){_0x303546[_0xaf2c('0x22')]=parseInt(_0x303546[_0xaf2c('0x21')],0xa);}_0x29cbdf[_0xaf2c('0x23')](_[_0xaf2c('0x24')](_0x303546,_0xaf2c('0x25')));}function initGraph(_0xf0a56c,_0x4a8dd8){var _0x29f8b0=new Graph();for(var _0x2051be in _0xf0a56c){if(_0xf0a56c[_0xaf2c('0x26')](_0x2051be)){if(_[_0xaf2c('0x27')](_0xf0a56c[_0x2051be])){for(var _0x4b7cf2=0x0;_0x4b7cf2<_0xf0a56c[_0x2051be][_0xaf2c('0x28')];_0x4b7cf2+=0x1){addVertex(_0x29f8b0,_0xf0a56c[_0x2051be][_0x4b7cf2],_0x2051be);}}else{addVertex(_0x29f8b0,_0xf0a56c[_0x2051be],_0x2051be);}}}for(var _0x589d47=0x0;_0x589d47<_0x4a8dd8[_0xaf2c('0x28')];_0x589d47+=0x1){if(_0x4a8dd8[_0x589d47][_0xaf2c('0x29')]&&_0x4a8dd8[_0x589d47][_0xaf2c('0x2a')]){_0x29f8b0['addEdge'](_0x4a8dd8[_0x589d47][_0xaf2c('0x29')],_0x4a8dd8[_0x589d47][_0xaf2c('0x2a')],_0x4a8dd8[_0x589d47][_0xaf2c('0x2b')]);}}return _0x29f8b0;}function getSquareProject(_0x4a96d2,_0xe18ba7){rpc[_0xaf2c('0x2c')](_0x4a96d2)[_0xaf2c('0x2d')](function(_0x19364e){_0xe18ba7(null,_0x19364e);})['catch'](function(_0x3da072){_0xe18ba7(null,_0x3da072);});}function createSquareReport(_0x4072ff,_0x1be1ef){rpc['createSquareReport'](_0x4072ff)['then'](function(_0x359cab){if(_0x1be1ef){_0x1be1ef(null,_0x359cab);}})['catch'](function(_0x39c0ed){if(_0x1be1ef){_0x1be1ef(null,_0x39c0ed);}});}function setChannelVariables(_0x5e7247){for(var _0x337cea in _0x5e7247){if(_0x5e7247[_0xaf2c('0x26')](_0x337cea)){if(_0x337cea['indexOf'](_0xaf2c('0x2e'))===0x0){_0x5e7247[_0x337cea[_0xaf2c('0x2f')](0x4)]=_0x5e7247[_0x337cea];delete _0x5e7247[_0x337cea];}}}}function getLogFromObject(_0x54db57){return util[_0xaf2c('0x30')](_0x54db57,{'showHidden':![],'depth':null});}function agiHandler(_0xbec302){var _0x211a69,_0x53d58c,_0x2d6ed7,_0x30ae30,_0x5b1a7c;logger[_0xaf2c('0x31')]('variables',JSON[_0xaf2c('0x32')](_0xbec302,null,0x2));logger['info'](util[_0xaf2c('0x12')]('[START]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s',_0xbec302[_0xaf2c('0x18')],_0xbec302['calleridname'],_0xbec302[_0xaf2c('0x1a')],_0xbec302['dnid'],_0xbec302[_0xaf2c('0x1c')]));_0xbec302['on'](_0xaf2c('0x15'),errorHandler);_0xbec302['on'](_0xaf2c('0x33'),closeHandler);_0xbec302['on'](_0xaf2c('0x34'),timeoutHandler);_0xbec302[_0xaf2c('0x1e')]=![];_0xbec302['on']('hangup',hangupHandler);var _0x4cba13=getSquareProject[_0xaf2c('0x35')](null,_0xbec302[_0xaf2c('0x18')]);if(_0x4cba13){if(_0x4cba13[_0xaf2c('0x36')]){_0x211a69=getRoot(_0x4cba13[_0xaf2c('0x36')]);if(_0x211a69&&_0x211a69[_0xaf2c('0x37')]){logger[_0xaf2c('0x31')]('root',JSON[_0xaf2c('0x32')](_0x211a69,null,0x2));_0xbec302[_0xaf2c('0x38')]=moment()['format'](_0xaf2c('0x39'));_0x53d58c=initGraph(_[_0xaf2c('0x24')](_0x211a69,_0xaf2c('0x25')),_0x211a69[_0xaf2c('0x25')]);_0x2d6ed7=new Vertices(_0xbec302,rpc,mailRpc);logger[_0xaf2c('0x10')](util[_0xaf2c('0x12')](_0xaf2c('0x3a'),_0xbec302[_0xaf2c('0x18')],_0xbec302[_0xaf2c('0x19')],_0xbec302[_0xaf2c('0x1a')],_0xbec302[_0xaf2c('0x1b')],_0xbec302[_0xaf2c('0x1c')]));_0x53d58c[_0xaf2c('0x3b')](_0x211a69['start']['id'],function(_0x54a953){try{_0x54a953=_0x2d6ed7['clear'](_0x54a953);logger[_0xaf2c('0x31')](_0xaf2c('0x3c'),JSON[_0xaf2c('0x32')](_0x54a953,null,0x2));if(_0x54a953[_0xaf2c('0x20')]===_0xaf2c('0x3d')){logger[_0xaf2c('0x10')]('gotoc\x20block\x20stop\x20traverse\x20BFS');_0xbec302[_0xaf2c('0x3e')]=_0x54a953[_0xaf2c('0x3e')]||_0xbec302[_0xaf2c('0x3e')];_0xbec302['extension']=_0x54a953['extension'];_0xbec302[_0xaf2c('0x3f')]=_0x54a953['priority']?_0x54a953[_0xaf2c('0x3f')]-0x1:0x1;return null;}else if(_0x54a953&&_0x2d6ed7[_0x54a953[_0xaf2c('0x20')]]){_0x5b1a7c=_0x2d6ed7[_0x54a953[_0xaf2c('0x20')]](_0x54a953);logger[_0xaf2c('0x10')]('response',JSON[_0xaf2c('0x32')](_0x5b1a7c,null,0x2));if(_0x5b1a7c&&_0x5b1a7c['code']===AGI_CODE_SUCCESS&&_0x5b1a7c[_0xaf2c('0x40')]!==AGI_RESULT_ERROR&&!_0xbec302[_0xaf2c('0x1e')]){logger['debug'](_0xaf2c('0x41'),getLogFromObject(_0x5b1a7c));return _['isUndefined'](_0x5b1a7c[_0xaf2c('0x40')])?null:_0x5b1a7c[_0xaf2c('0x40')][_0xaf2c('0x42')]();}else{logger[_0xaf2c('0x15')](_0xaf2c('0x41'),getLogFromObject(_0x5b1a7c));return null;}}else{logger[_0xaf2c('0x15')](_0xaf2c('0x43'));return null;}}catch(_0x16b469){logger[_0xaf2c('0x15')](_0x16b469['stack']);return null;}});if(_0x211a69['finally']){logger[_0xaf2c('0x10')](util['format']('[FINALLY\x20TRAVERSE]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s',_0xbec302['arg_1'],_0xbec302[_0xaf2c('0x19')],_0xbec302[_0xaf2c('0x1a')],_0xbec302[_0xaf2c('0x1b')],_0xbec302[_0xaf2c('0x1c')]));_0x53d58c['traverseBFS'](_0x211a69[_0xaf2c('0x44')]['id'],function(_0x52e2c1){try{_0x52e2c1=_0x2d6ed7[_0xaf2c('0x45')](_0x52e2c1);logger['debug'](_0xaf2c('0x3c'),JSON[_0xaf2c('0x32')](_0x52e2c1,null,0x2));if(_0x52e2c1&&_0x2d6ed7[_0x52e2c1[_0xaf2c('0x20')]]){_0x5b1a7c=_0x2d6ed7[_0x52e2c1[_0xaf2c('0x20')]](_0x52e2c1);if(_0x5b1a7c){logger[_0xaf2c('0x31')]('response',getLogFromObject(_0x5b1a7c));return _[_0xaf2c('0x46')](_0x5b1a7c[_0xaf2c('0x40')])?null:_0x5b1a7c['result']['toString']();}else{logger[_0xaf2c('0x15')]('response',getLogFromObject(_0x5b1a7c));return null;}}else{logger[_0xaf2c('0x15')](_0xaf2c('0x43'));return null;}}catch(_0x17b9ec){logger[_0xaf2c('0x15')](_0x17b9ec[_0xaf2c('0xd')]);return null;}});}logger[_0xaf2c('0x10')](util[_0xaf2c('0x12')](_0xaf2c('0x47'),_0xbec302[_0xaf2c('0x18')],_0xbec302[_0xaf2c('0x19')],_0xbec302[_0xaf2c('0x1a')],_0xbec302['dnid'],_0xbec302[_0xaf2c('0x1c')]));logger[_0xaf2c('0x10')](util['format']('[GOTO]\x20context:\x20%s\x20extension:\x20%s\x20priority:\x20%s',_0xbec302['context'],_0xbec302[_0xaf2c('0x48')],parseInt(_0xbec302[_0xaf2c('0x3f')],0xa)+0x1));_0xbec302['continueAt'](_0xbec302[_0xaf2c('0x3e')],_0xbec302[_0xaf2c('0x48')],parseInt(_0xbec302[_0xaf2c('0x3f')],0xa)+0x1);_0xbec302[_0xaf2c('0x33')]();}}else{logger[_0xaf2c('0x15')](util[_0xaf2c('0x12')](_0xaf2c('0x49'),_0xbec302['arg_1']));_0xbec302[_0xaf2c('0x4a')](_0xbec302[_0xaf2c('0x3e')],_0xbec302['extension'],parseInt(_0xbec302[_0xaf2c('0x3f')],0xa)+0x1);_0xbec302[_0xaf2c('0x33')]();}}else{logger[_0xaf2c('0x15')](util[_0xaf2c('0x12')](_0xaf2c('0x4b'),_0xbec302[_0xaf2c('0x18')]));_0xbec302[_0xaf2c('0x4a')](_0xbec302[_0xaf2c('0x3e')],_0xbec302[_0xaf2c('0x48')],parseInt(_0xbec302[_0xaf2c('0x3f')],0xa)+0x1);_0xbec302[_0xaf2c('0x33')]();}}function main(){var _0x10a270;return utilLicense[_0xaf2c('0x4c')]()[_0xaf2c('0x2d')](function(_0x297a22){if(_0x297a22){if(_0x297a22[_0xaf2c('0x4d')]){if(_0x297a22[_0xaf2c('0x4e')]&&_0x297a22[_0xaf2c('0x4e')]>0x0){logger[_0xaf2c('0x10')](util[_0xaf2c('0x12')]('[LICENSE]\x20CHANNELS:\x20%s',_0x297a22[_0xaf2c('0x4e')]));_0x10a270=_0x297a22[_0xaf2c('0x4e')];}else{logger[_0xaf2c('0x10')]('[LICENSE]\x20CHANNELS:\x20UNLIMITED');}}else{logger[_0xaf2c('0x10')]('[LICENSE]\x20VOICE\x20IS\x20DISABLED');_0x10a270=-0x1;}}})[_0xaf2c('0x4f')](function(_0x2bce19){logger[_0xaf2c('0x15')](_0xaf2c('0x50'),_0x2bce19[_0xaf2c('0xd')]);})[_0xaf2c('0x44')](function(){var _0x118e03=require(_0xaf2c('0x51'))(config[_0xaf2c('0x6')]['port'],config[_0xaf2c('0x6')]['ip'],_0x10a270);_0x118e03['on'](_0xaf2c('0x15'),errorHandler);_0x118e03['on'](_0xaf2c('0x52'),listeningHandler);_0x118e03['on'](_0xaf2c('0x53'),connectionHandler);_0x118e03['on'](_0xaf2c('0x33'),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 967e182..e20e4f7 100644 --- a/server/services/agi/mailRpc/index.js +++ b/server/services/agi/mailRpc/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9957=['result','catch','sendMailMessage','SendMail','bluebird','jayson/promise','client','http','request','error','message'];(function(_0x4095dd,_0x1d951a){var _0x324bf0=function(_0x395da1){while(--_0x395da1){_0x4095dd['push'](_0x4095dd['shift']());}};_0x324bf0(++_0x1d951a);}(_0x9957,0x93));var _0x7995=function(_0x2f5ac5,_0x1ee939){_0x2f5ac5=_0x2f5ac5-0x0;var _0x37c9a8=_0x9957[_0x2f5ac5];return _0x37c9a8;};'use strict';var BPromise=require(_0x7995('0x0'));var jayson=require(_0x7995('0x1'));var client=jayson[_0x7995('0x2')][_0x7995('0x3')]({'port':0x232b});function request(_0x5b96eb,_0x86c128){return new BPromise(function(_0x3c58eb,_0x1902b4){return client[_0x7995('0x4')](_0x5b96eb,_0x86c128)['then'](function(_0x744bea){if(_0x744bea[_0x7995('0x5')]){return _0x1902b4(_0x744bea[_0x7995('0x5')][_0x7995('0x6')]);}else{return _0x3c58eb(_0x744bea[_0x7995('0x7')]);}})[_0x7995('0x8')](function(_0x4996ca){return _0x1902b4(_0x4996ca);});});}exports[_0x7995('0x9')]=function(_0x1cad37,_0x4a64f7){return request(_0x7995('0xa'),{'account':_0x1cad37,'message':_0x4a64f7});}; \ No newline at end of file +var _0x9957=['result','catch','sendMailMessage','SendMail','bluebird','jayson/promise','client','http','request','error','message'];(function(_0x3e7666,_0x7a0d){var _0x839f3a=function(_0x1032ff){while(--_0x1032ff){_0x3e7666['push'](_0x3e7666['shift']());}};_0x839f3a(++_0x7a0d);}(_0x9957,0x93));var _0x7995=function(_0x2dafbe,_0x5d04de){_0x2dafbe=_0x2dafbe-0x0;var _0x58a45a=_0x9957[_0x2dafbe];return _0x58a45a;};'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 f470b19..5840fa6 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 _0xb10b=['call','_inBody','inherits','prototype','_transform','\x0d\x0a\x0d\x0a','_localBuffer','toString','indexOf','substring','split','trim','slice','length','emit','headers','line','exports','util','Transform'];(function(_0x38fb0d,_0x52b5db){var _0x30a5d6=function(_0x31eba6){while(--_0x31eba6){_0x38fb0d['push'](_0x38fb0d['shift']());}};_0x30a5d6(++_0x52b5db);}(_0xb10b,0x12a));var _0xbb10=function(_0x3e5608,_0x8b6979){_0x3e5608=_0x3e5608-0x0;var _0x4128d3=_0xb10b[_0x3e5608];return _0x4128d3;};'use strict';var util=require(_0xbb10('0x0'));var Transform=require('stream')[_0xbb10('0x1')];function AGIReply(_0x35bc5f){Transform[_0xbb10('0x2')](this,_0x35bc5f);this['_localBuffer']='';this[_0xbb10('0x3')]=![];}util[_0xbb10('0x4')](AGIReply,Transform);AGIReply[_0xbb10('0x5')][_0xbb10('0x6')]=function(_0x49baf4,_0x312b72,_0x481979){var _0x328583='\x0a',_0x3cdd53=['\x0a\x0a',_0xbb10('0x7')],_0x513741=-0x1,_0x1b9e94=-0x1,_0x3fb675='',_0x21370f=0x0,_0x1c3ee5='',_0x2353ef='';this[_0xbb10('0x8')]+=_0x49baf4[_0xbb10('0x9')]();_0x1c3ee5=this['_localBuffer'];if(!this['_inBody']){_0x21370f=0x0;while(_0x3cdd53[_0x21370f]){while((_0x1b9e94=_0x1c3ee5[_0xbb10('0xa')](_0x3cdd53[_0x21370f]))!=-0x1){_0x3fb675=_0x3cdd53[_0x21370f];_0x2353ef=_0x1c3ee5[_0xbb10('0xb')](0x0,_0x1b9e94);_0x1c3ee5=_0x1c3ee5[_0xbb10('0xb')](_0x1b9e94+_0x3fb675['length']);var _0x408248=_0x2353ef[_0xbb10('0xc')](_0x328583),_0x5be7e0=0x0,_0x44fb19={},_0x916a32='',_0x285009='',_0x193a27=-0x1;while(_0x408248[_0x5be7e0]){_0x193a27=_0x408248[_0x5be7e0][_0xbb10('0xa')](':');if(_0x193a27!=-0x1){_0x916a32=_0x408248[_0x5be7e0]['slice'](0x0,_0x193a27)[_0xbb10('0xd')]();_0x285009=_0x408248[_0x5be7e0][_0xbb10('0xe')](_0x193a27+0x1)[_0xbb10('0xd')]();if(_0x916a32[_0xbb10('0xf')]>0x0){_0x44fb19[_0x916a32]=_0x285009;}}else{}_0x5be7e0++;}this[_0xbb10('0x10')](_0xbb10('0x11'),_0x44fb19);this[_0xbb10('0x3')]=!![];}_0x21370f++;}this[_0xbb10('0x8')]=_0x1c3ee5;}else{while((_0x513741=_0x1c3ee5[_0xbb10('0xa')](_0x328583))!=-0x1){_0x2353ef=_0x1c3ee5[_0xbb10('0xb')](0x0,_0x513741);this['emit'](_0xbb10('0x12'),_0x2353ef);_0x1c3ee5=_0x1c3ee5[_0xbb10('0xb')](_0x513741+_0x328583[_0xbb10('0xf')]);}this[_0xbb10('0x8')]=_0x1c3ee5;}_0x481979();};module[_0xbb10('0x13')]=AGIReply; \ No newline at end of file +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(_0x2d08d2,_0x22d0c1){var _0x5b91e9=function(_0x4c93b2){while(--_0x4c93b2){_0x2d08d2['push'](_0x2d08d2['shift']());}};_0x5b91e9(++_0x22d0c1);}(_0x5f2f,0x73));var _0xf5f2=function(_0x14dddc,_0x3074b5){_0x14dddc=_0x14dddc-0x0;var _0x3f69f0=_0x5f2f[_0x14dddc];return _0x3f69f0;};'use strict';var util=require(_0xf5f2('0x0'));var Transform=require(_0xf5f2('0x1'))[_0xf5f2('0x2')];function AGIReply(_0x1a7be1){Transform[_0xf5f2('0x3')](this,_0x1a7be1);this[_0xf5f2('0x4')]='';this[_0xf5f2('0x5')]=![];}util[_0xf5f2('0x6')](AGIReply,Transform);AGIReply['prototype']['_transform']=function(_0x1665c7,_0x192215,_0xad7f65){var _0x3eebf6='\x0a',_0x3133bc=['\x0a\x0a',_0xf5f2('0x7')],_0x473100=-0x1,_0x5907aa=-0x1,_0x466882='',_0x46cd9c=0x0,_0x2ec345='',_0x56a69f='';this[_0xf5f2('0x4')]+=_0x1665c7[_0xf5f2('0x8')]();_0x2ec345=this['_localBuffer'];if(!this[_0xf5f2('0x5')]){_0x46cd9c=0x0;while(_0x3133bc[_0x46cd9c]){while((_0x5907aa=_0x2ec345['indexOf'](_0x3133bc[_0x46cd9c]))!=-0x1){_0x466882=_0x3133bc[_0x46cd9c];_0x56a69f=_0x2ec345['substring'](0x0,_0x5907aa);_0x2ec345=_0x2ec345[_0xf5f2('0x9')](_0x5907aa+_0x466882[_0xf5f2('0xa')]);var _0x4b78cd=_0x56a69f[_0xf5f2('0xb')](_0x3eebf6),_0x336f6b=0x0,_0x14b51f={},_0x331482='',_0x3f2997='',_0x59bb6c=-0x1;while(_0x4b78cd[_0x336f6b]){_0x59bb6c=_0x4b78cd[_0x336f6b]['indexOf'](':');if(_0x59bb6c!=-0x1){_0x331482=_0x4b78cd[_0x336f6b][_0xf5f2('0xc')](0x0,_0x59bb6c)[_0xf5f2('0xd')]();_0x3f2997=_0x4b78cd[_0x336f6b][_0xf5f2('0xc')](_0x59bb6c+0x1)[_0xf5f2('0xd')]();if(_0x331482[_0xf5f2('0xa')]>0x0){_0x14b51f[_0x331482]=_0x3f2997;}}else{}_0x336f6b++;}this['emit'](_0xf5f2('0xe'),_0x14b51f);this[_0xf5f2('0x5')]=!![];}_0x46cd9c++;}this[_0xf5f2('0x4')]=_0x2ec345;}else{while((_0x473100=_0x2ec345[_0xf5f2('0xf')](_0x3eebf6))!=-0x1){_0x56a69f=_0x2ec345[_0xf5f2('0x9')](0x0,_0x473100);this[_0xf5f2('0x10')](_0xf5f2('0x11'),_0x56a69f);_0x2ec345=_0x2ec345[_0xf5f2('0x9')](_0x473100+_0x3eebf6[_0xf5f2('0xa')]);}this[_0xf5f2('0x4')]=_0x2ec345;}_0xad7f65();};module[_0xf5f2('0x12')]=AGIReply; \ No newline at end of file diff --git a/server/services/agi/rpc/index.js b/server/services/agi/rpc/index.js index 98c1b0d..448ff3a 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 _0x9f80=['then','error','result','catch','ShowSquareProject','production','getMailAccountById','MailServerOut','Smtp','name','email','getVoiceQueueById','ShowVoiceQueue','getVariableById','ShowVariable','ShowSquareOdbc','dsn','getTrunkById','ShowTrunk','getSoundById','ShowSound','save_name','ShowInterval','Interval','getSmsAccountById','ShowSmsAccount','createSmsMessage','CreateSmsMessage','createSquareDetailsReport','CreateSquareReport','merge','arg_1','arg_2','format','YYYY-MM-DD\x20HH:mm:ss','createSquareRecording','CreateSquareRecording','createCmContact','ShowCmHopper','phone','CreateCmContact','ShowPause','agentLogin','LoginUser','PauseUser','agentUnpause','UnpauseUser','agentLogout','LogoutUser','bluebird','lodash','http','request'];(function(_0x11affd,_0xa8655d){var _0x483345=function(_0x17c677){while(--_0x17c677){_0x11affd['push'](_0x11affd['shift']());}};_0x483345(++_0xa8655d);}(_0x9f80,0x105));var _0x09f8=function(_0x427383,_0x45a480){_0x427383=_0x427383-0x0;var _0x16e84c=_0x9f80[_0x427383];return _0x16e84c;};'use strict';var BPromise=require(_0x09f8('0x0'));var moment=require('moment');var _=require(_0x09f8('0x1'));var util=require('util');var jayson=require('jayson/promise');var client=jayson['client'][_0x09f8('0x2')]({'port':0x2329});function request(_0x5d2e36,_0x27adb3){return new BPromise(function(_0x58946b,_0x1c5419){return client[_0x09f8('0x3')](_0x5d2e36,_0x27adb3)[_0x09f8('0x4')](function(_0x3b573d){if(_0x3b573d[_0x09f8('0x5')]){return _0x1c5419(_0x3b573d[_0x09f8('0x5')]['message']);}else{return _0x58946b(_0x3b573d[_0x09f8('0x6')]);}})[_0x09f8('0x7')](function(_0x2ae8bc){return _0x1c5419(_0x2ae8bc);});});}exports['getSquareProject']=function(_0x1f8983){return request(_0x09f8('0x8'),{'options':{'raw':![],'where':{'name':_0x1f8983},'attributes':[_0x09f8('0x9')]}});};exports[_0x09f8('0xa')]=function(_0x224542){return request('ShowMailAccount',{'options':{'raw':![],'where':{'id':_0x224542},'include':[{'model':_0x09f8('0xb'),'as':_0x09f8('0xc')}],'attributes':['id',_0x09f8('0xd'),_0x09f8('0xe')]}});};exports['getSquareProjectById']=function(_0x5c51e4){return request(_0x09f8('0x8'),{'options':{'where':{'id':_0x5c51e4},'attributes':[_0x09f8('0xd')]}});};exports[_0x09f8('0xf')]=function(_0x1176a4){return request(_0x09f8('0x10'),{'options':{'where':{'id':_0x1176a4},'attributes':[_0x09f8('0xd')]}});};exports[_0x09f8('0x11')]=function(_0x490cea){return request(_0x09f8('0x12'),{'options':{'where':{'id':_0x490cea},'attributes':[_0x09f8('0xd')]}});};exports['getSquareOdbcById']=function(_0xc009bf){return request(_0x09f8('0x13'),{'options':{'where':{'id':_0xc009bf},'attributes':[_0x09f8('0x14')]}});};exports['getUserById']=function(_0x5cc244){return request('ShowUser',{'options':{'where':{'id':_0x5cc244},'attributes':['name']}});};exports[_0x09f8('0x15')]=function(_0x129b19){return request(_0x09f8('0x16'),{'options':{'where':{'id':_0x129b19},'attributes':[_0x09f8('0xd')]}});};exports[_0x09f8('0x17')]=function(_0x46e5db){return request(_0x09f8('0x18'),{'options':{'where':{'id':_0x46e5db},'attributes':[_0x09f8('0x19')]}});};exports['getIntervalById']=function(_0x16c963){return request(_0x09f8('0x1a'),{'options':{'raw':![],'where':{'id':_0x16c963},'include':[{'model':_0x09f8('0x1b'),'as':'Intervals'}]}});};exports[_0x09f8('0x1c')]=function(_0x5608db){return request(_0x09f8('0x1d'),{'options':{'where':{'id':_0x5608db},'attributes':['id',_0x09f8('0xd')]}});};exports[_0x09f8('0x1e')]=function(_0x1adca5){return request(_0x09f8('0x1f'),{'body':_0x1adca5});};exports[_0x09f8('0x20')]=function(_0x18c5a6){return request('CreateSquareDetailsReport',{'body':_0x18c5a6});};exports['createSquareReport']=function(_0x43d1d7){return request(_0x09f8('0x21'),{'body':_[_0x09f8('0x22')](_0x43d1d7,{'project_name':_0x43d1d7[_0x09f8('0x23')],'prev_project_name':_0x43d1d7[_0x09f8('0x24')]||'','is_subproject':_0x43d1d7[_0x09f8('0x24')]?!![]:![],'leaveAt':moment()[_0x09f8('0x25')](_0x09f8('0x26'))})});};exports[_0x09f8('0x27')]=function(_0x33d236){return request(_0x09f8('0x28'),{'body':_0x33d236});};exports['createSquareMessage']=function(_0x2582e4){return request('CreateSquareMessage',{'body':_0x2582e4});};exports[_0x09f8('0x29')]=function(_0x17b2b9){return request(_0x09f8('0x2a'),{'options':{'raw':![],'where':{'phone':_0x17b2b9[_0x09f8('0x2b')],'ListId':_0x17b2b9['ListId']}}})[_0x09f8('0x4')](function(_0x4f600b){if(_0x4f600b){return _0x4f600b;}return request(_0x09f8('0x2c'),{'body':_0x17b2b9});});};exports['getPauseById']=function(_0x4f9c9b){return request(_0x09f8('0x2d'),{'options':{'where':{'id':_0x4f9c9b},'attributes':[_0x09f8('0xd')]}});};exports[_0x09f8('0x2e')]=function(_0x56ac39,_0x359e7f){return request(_0x09f8('0x2f'),{'body':{'interface':_0x359e7f},'options':{'where':_0x56ac39}});};exports['agentPause']=function(_0x349e1e,_0x1b2817,_0x2aa232){return request(_0x09f8('0x30'),{'body':{'type':_0x1b2817,'uniqueid':_0x2aa232},'options':{'where':_0x349e1e}});};exports[_0x09f8('0x31')]=function(_0x1fdee1){return request(_0x09f8('0x32'),{'body':{},'options':{'where':_0x1fdee1}});};exports[_0x09f8('0x33')]=function(_0x4a88b8){return request(_0x09f8('0x34'),{'body':{},'options':{'where':_0x4a88b8}});}; \ No newline at end of file +var _0x8c43=['ListId','CreateCmContact','agentLogin','LoginUser','agentPause','UnpauseUser','agentLogout','LogoutUser','bluebird','moment','lodash','util','jayson/promise','http','request','then','error','message','result','catch','getSquareProject','production','ShowMailAccount','MailServerOut','Smtp','getSquareProjectById','ShowSquareProject','getVoiceQueueById','ShowVoiceQueue','name','dsn','ShowUser','getTrunkById','ShowTrunk','ShowSound','getIntervalById','ShowInterval','Intervals','getSmsAccountById','ShowSmsAccount','createSmsMessage','CreateSmsMessage','createSquareDetailsReport','CreateSquareDetailsReport','createSquareReport','merge','arg_1','arg_2','format','CreateSquareRecording','CreateSquareMessage','createCmContact','ShowCmHopper'];(function(_0x2a7544,_0x47e6d1){var _0xdaac83=function(_0x3adf98){while(--_0x3adf98){_0x2a7544['push'](_0x2a7544['shift']());}};_0xdaac83(++_0x47e6d1);}(_0x8c43,0x1e5));var _0x38c4=function(_0x4b31d8,_0x4e3043){_0x4b31d8=_0x4b31d8-0x0;var _0x959ea7=_0x8c43[_0x4b31d8];return _0x959ea7;};'use strict';var BPromise=require(_0x38c4('0x0'));var moment=require(_0x38c4('0x1'));var _=require(_0x38c4('0x2'));var util=require(_0x38c4('0x3'));var jayson=require(_0x38c4('0x4'));var client=jayson['client'][_0x38c4('0x5')]({'port':0x2329});function request(_0x1d600b,_0x5036cf){return new BPromise(function(_0x4b5b37,_0x1f23c1){return client[_0x38c4('0x6')](_0x1d600b,_0x5036cf)[_0x38c4('0x7')](function(_0x5df33d){if(_0x5df33d[_0x38c4('0x8')]){return _0x1f23c1(_0x5df33d[_0x38c4('0x8')][_0x38c4('0x9')]);}else{return _0x4b5b37(_0x5df33d[_0x38c4('0xa')]);}})[_0x38c4('0xb')](function(_0x3c64d2){return _0x1f23c1(_0x3c64d2);});});}exports[_0x38c4('0xc')]=function(_0xb91b3a){return request('ShowSquareProject',{'options':{'raw':![],'where':{'name':_0xb91b3a},'attributes':[_0x38c4('0xd')]}});};exports['getMailAccountById']=function(_0x3d0009){return request(_0x38c4('0xe'),{'options':{'raw':![],'where':{'id':_0x3d0009},'include':[{'model':_0x38c4('0xf'),'as':_0x38c4('0x10')}],'attributes':['id','name','email']}});};exports[_0x38c4('0x11')]=function(_0x3361d0){return request(_0x38c4('0x12'),{'options':{'where':{'id':_0x3361d0},'attributes':['name']}});};exports[_0x38c4('0x13')]=function(_0x123f5e){return request(_0x38c4('0x14'),{'options':{'where':{'id':_0x123f5e},'attributes':[_0x38c4('0x15')]}});};exports['getVariableById']=function(_0x4d52d2){return request('ShowVariable',{'options':{'where':{'id':_0x4d52d2},'attributes':['name']}});};exports['getSquareOdbcById']=function(_0x1f0e59){return request('ShowSquareOdbc',{'options':{'where':{'id':_0x1f0e59},'attributes':[_0x38c4('0x16')]}});};exports['getUserById']=function(_0x3741be){return request(_0x38c4('0x17'),{'options':{'where':{'id':_0x3741be},'attributes':[_0x38c4('0x15')]}});};exports[_0x38c4('0x18')]=function(_0x45001e){return request(_0x38c4('0x19'),{'options':{'where':{'id':_0x45001e},'attributes':['name']}});};exports['getSoundById']=function(_0x39d616){return request(_0x38c4('0x1a'),{'options':{'where':{'id':_0x39d616},'attributes':['save_name']}});};exports[_0x38c4('0x1b')]=function(_0x5bbcb1){return request(_0x38c4('0x1c'),{'options':{'raw':![],'where':{'id':_0x5bbcb1},'include':[{'model':'Interval','as':_0x38c4('0x1d')}]}});};exports[_0x38c4('0x1e')]=function(_0x17663a){return request(_0x38c4('0x1f'),{'options':{'where':{'id':_0x17663a},'attributes':['id',_0x38c4('0x15')]}});};exports[_0x38c4('0x20')]=function(_0x5dc3db){return request(_0x38c4('0x21'),{'body':_0x5dc3db});};exports[_0x38c4('0x22')]=function(_0xe0dc0f){return request(_0x38c4('0x23'),{'body':_0xe0dc0f});};exports[_0x38c4('0x24')]=function(_0x129a8f){return request('CreateSquareReport',{'body':_[_0x38c4('0x25')](_0x129a8f,{'project_name':_0x129a8f[_0x38c4('0x26')],'prev_project_name':_0x129a8f[_0x38c4('0x27')]||'','is_subproject':_0x129a8f[_0x38c4('0x27')]?!![]:![],'leaveAt':moment()[_0x38c4('0x28')]('YYYY-MM-DD\x20HH:mm:ss')})});};exports['createSquareRecording']=function(_0x433fa4){return request(_0x38c4('0x29'),{'body':_0x433fa4});};exports['createSquareMessage']=function(_0x46f6fa){return request(_0x38c4('0x2a'),{'body':_0x46f6fa});};exports[_0x38c4('0x2b')]=function(_0x55bc20){return request(_0x38c4('0x2c'),{'options':{'raw':![],'where':{'phone':_0x55bc20['phone'],'ListId':_0x55bc20[_0x38c4('0x2d')]}}})['then'](function(_0x2f6dd3){if(_0x2f6dd3){return _0x2f6dd3;}return request(_0x38c4('0x2e'),{'body':_0x55bc20});});};exports['getPauseById']=function(_0xba9861){return request('ShowPause',{'options':{'where':{'id':_0xba9861},'attributes':[_0x38c4('0x15')]}});};exports[_0x38c4('0x2f')]=function(_0x1db9c9,_0x211f77){return request(_0x38c4('0x30'),{'body':{'interface':_0x211f77},'options':{'where':_0x1db9c9}});};exports[_0x38c4('0x31')]=function(_0x4f8f38,_0x37dd6b,_0x4d6ed7){return request('PauseUser',{'body':{'type':_0x37dd6b,'uniqueid':_0x4d6ed7},'options':{'where':_0x4f8f38}});};exports['agentUnpause']=function(_0x3c3b4c){return request(_0x38c4('0x32'),{'body':{},'options':{'where':_0x3c3b4c}});};exports[_0x38c4('0x33')]=function(_0x2f2578){return request(_0x38c4('0x34'),{'body':{},'options':{'where':_0x2f2578}});}; \ 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 54e8d7f..5e55b9e 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 _0x4c6d=['./lex','exports','./polly'];(function(_0x260a7e,_0x2782da){var _0x4da59c=function(_0x440587){while(--_0x440587){_0x260a7e['push'](_0x260a7e['shift']());}};_0x4da59c(++_0x2782da);}(_0x4c6d,0x1d0));var _0xd4c6=function(_0x3149c5,_0x58701a){_0x3149c5=_0x3149c5-0x0;var _0x34658d=_0x4c6d[_0x3149c5];return _0x34658d;};var polly=require(_0xd4c6('0x0'));var lex=require(_0xd4c6('0x1'));module[_0xd4c6('0x2')]={'polly':polly,'lex':lex}; \ No newline at end of file +var _0x22fb=['exports'];(function(_0x44c974,_0x1bcfde){var _0x5214c6=function(_0x10aad5){while(--_0x10aad5){_0x44c974['push'](_0x44c974['shift']());}};_0x5214c6(++_0x1bcfde);}(_0x22fb,0x192));var _0xb22f=function(_0x37d34d,_0x9dff3b){_0x37d34d=_0x37d34d-0x0;var _0x3b5bb9=_0x22fb[_0x37d34d];return _0x3b5bb9;};var polly=require('./polly');var lex=require('./lex');module[_0xb22f('0x0')]={'polly':polly,'lex':lex}; \ No newline at end of file diff --git a/server/services/agi/scripts/aws/lex/index.js b/server/services/agi/scripts/aws/lex/index.js index 27847d6..7cfc272 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 _0x4fdb=['./lib/api','exports'];(function(_0x42cae2,_0x284ef8){var _0x5f256f=function(_0x41abc8){while(--_0x41abc8){_0x42cae2['push'](_0x42cae2['shift']());}};_0x5f256f(++_0x284ef8);}(_0x4fdb,0x9c));var _0xb4fd=function(_0x8d1d53,_0x5d8e35){_0x8d1d53=_0x8d1d53-0x0;var _0x55650d=_0x4fdb[_0x8d1d53];return _0x55650d;};'use strict';var lex=require(_0xb4fd('0x0'));module[_0xb4fd('0x1')]=function(_0x243990,_0x326dea,_0x3b399e,_0xafe34b,_0x260a35,_0xd55d8e){return lex(_0x243990,_0x326dea,_0x3b399e,_0xafe34b,_0x260a35,_0xd55d8e);}; \ No newline at end of file +var _0xa9e0=['exports','./lib/api'];(function(_0x468b0f,_0x408566){var _0x3e74d9=function(_0x27a545){while(--_0x27a545){_0x468b0f['push'](_0x468b0f['shift']());}};_0x3e74d9(++_0x408566);}(_0xa9e0,0x123));var _0x0a9e=function(_0x1ddedd,_0x485606){_0x1ddedd=_0x1ddedd-0x0;var _0xa3e1ac=_0xa9e0[_0x1ddedd];return _0xa3e1ac;};'use strict';var lex=require(_0x0a9e('0x0'));module[_0x0a9e('0x1')]=function(_0x29929c,_0x5dd881,_0x550fbc,_0x18d5c9,_0x4ce2f1,_0x333808){return lex(_0x29929c,_0x5dd881,_0x550fbc,_0x18d5c9,_0x4ce2f1,_0x333808);}; \ 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 902db3a..aac7779 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 _0x2542=['$LATEST','bluebird','aws-sdk','slots','hasOwnProperty','slot_','exports','LexRuntime'];(function(_0x27fc85,_0x25cebd){var _0x194eaa=function(_0x36352d){while(--_0x36352d){_0x27fc85['push'](_0x27fc85['shift']());}};_0x194eaa(++_0x25cebd);}(_0x2542,0x169));var _0x2254=function(_0x8fbe89,_0x260590){_0x8fbe89=_0x8fbe89-0x0;var _0x30aaf9=_0x2542[_0x8fbe89];return _0x30aaf9;};'use strict';var BPromise=require(_0x2254('0x0'));var AWS=require(_0x2254('0x1'));function lexResult(_0x2f3bcd,_0x20dfee){return new BPromise(function(_0x578407,_0x105910){_0x2f3bcd['postText'](_0x20dfee,function(_0x4059d1,_0x3b3dcb){if(_0x4059d1){_0x105910(_0x4059d1);}if(_0x3b3dcb[_0x2254('0x2')]){for(const _0x456612 in _0x3b3dcb[_0x2254('0x2')]){if(_0x3b3dcb['slots'][_0x2254('0x3')](_0x456612)){var _0xe8ca50=_0x3b3dcb[_0x2254('0x2')][_0x456612];_0x3b3dcb[_0x2254('0x4')+_0x456612]=_0xe8ca50;}}}_0x578407(_0x3b3dcb);});});}module[_0x2254('0x5')]=function(_0x477b47,_0x263459,_0xbf1c18,_0xb395da,_0x1ae415,_0x38fb2b){var _0x5b1ab9=new AWS[(_0x2254('0x6'))]({'accessKeyId':_0x263459,'secretAccessKey':_0xbf1c18,'region':_0xb395da});var _0x2655ea={'botAlias':_0x2254('0x7'),'botName':_0x38fb2b,'inputText':_0x1ae415,'userId':_0x477b47};return lexResult(_0x5b1ab9,_0x2655ea);}; \ No newline at end of file +var _0x8266=['postText','slots','slot_','exports','LexRuntime','$LATEST','bluebird','aws-sdk'];(function(_0x4e170e,_0x207e58){var _0x338291=function(_0x4cb198){while(--_0x4cb198){_0x4e170e['push'](_0x4e170e['shift']());}};_0x338291(++_0x207e58);}(_0x8266,0x136));var _0x6826=function(_0x457268,_0x515179){_0x457268=_0x457268-0x0;var _0xb77b0a=_0x8266[_0x457268];return _0xb77b0a;};'use strict';var BPromise=require(_0x6826('0x0'));var AWS=require(_0x6826('0x1'));function lexResult(_0x4557b5,_0x47e548){return new BPromise(function(_0xd689f4,_0x518529){_0x4557b5[_0x6826('0x2')](_0x47e548,function(_0x480e68,_0x25f7d3){if(_0x480e68){_0x518529(_0x480e68);}if(_0x25f7d3[_0x6826('0x3')]){for(const _0x4926ff in _0x25f7d3[_0x6826('0x3')]){if(_0x25f7d3[_0x6826('0x3')]['hasOwnProperty'](_0x4926ff)){var _0x5f24bf=_0x25f7d3['slots'][_0x4926ff];_0x25f7d3[_0x6826('0x4')+_0x4926ff]=_0x5f24bf;}}}_0xd689f4(_0x25f7d3);});});}module[_0x6826('0x5')]=function(_0x3b663d,_0xd60d2,_0x61d399,_0x218bd2,_0x39a0d7,_0x4e3a93){var _0x58066a=new AWS[(_0x6826('0x6'))]({'accessKeyId':_0xd60d2,'secretAccessKey':_0x61d399,'region':_0x218bd2});var _0x131c08={'botAlias':_0x6826('0x7'),'botName':_0x4e3a93,'inputText':_0x39a0d7,'userId':_0x3b663d};return lexResult(_0x58066a,_0x131c08);}; \ 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 d68a818..4d0d2b6 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 _0xdb3b=['exports'];(function(_0xb35b46,_0x332ba2){var _0x19863a=function(_0x2dd532){while(--_0x2dd532){_0xb35b46['push'](_0xb35b46['shift']());}};_0x19863a(++_0x332ba2);}(_0xdb3b,0x1ba));var _0xbdb3=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0xdb3b[_0xa464c9];return _0x3d73c4;};'use strict';var polly=require('./lib/api');module[_0xbdb3('0x0')]=function(_0x41d1e4,_0x5c121e,_0x48ce67,_0x41d634,_0x4b553b,_0x103b41,_0x58525e){return polly(_0x41d1e4,_0x5c121e,_0x48ce67,_0x41d634,_0x4b553b,_0x103b41,_0x58525e);}; \ No newline at end of file +'use strict';var polly=require('./lib/api');module['exports']=function(_0x5866b6,_0x58cdc8,_0x5d4a09,_0x2b21,_0x4c2b41,_0x4d2b08,_0x80a129){return polly(_0x5866b6,_0x58cdc8,_0x5d4a09,_0x2b21,_0x4c2b41,_0x4d2b08,_0x80a129);}; \ 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 f452a4a..227bd38 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 _0x8604=['path','bluebird','randomstring','aws-sdk','AudioStream','writeFile','Invalid\x20data\x20response\x20from\x20aws\x20Polly!','No\x20data\x20response\x20from\x20aws\x20Polly!','exports','Polly','mp3'];(function(_0x4228e6,_0x5e66de){var _0xca03e2=function(_0x38af38){while(--_0x38af38){_0x4228e6['push'](_0x4228e6['shift']());}};_0xca03e2(++_0x5e66de);}(_0x8604,0x16b));var _0x4860=function(_0x494dab,_0x24a6c5){_0x494dab=_0x494dab-0x0;var _0x2c9e47=_0x8604[_0x494dab];return _0x2c9e47;};'use strict';var fs=require('fs');var path=require(_0x4860('0x0'));var BPromise=require(_0x4860('0x1'));var rs=require(_0x4860('0x2'));var AWS=require(_0x4860('0x3'));function pollyResult(_0x558fa9,_0x26893a,_0xd09fb3){return new BPromise(function(_0x17774e,_0x3ad242){_0x558fa9['synthesizeSpeech'](_0x26893a,function(_0x5d38b7,_0xf0e865){if(_0x5d38b7){_0x3ad242(_0x5d38b7);}else if(_0xf0e865){if(_0xf0e865[_0x4860('0x4')]instanceof Buffer){fs[_0x4860('0x5')](_0xd09fb3,_0xf0e865[_0x4860('0x4')],function(_0x23fca8){if(_0x23fca8){_0x3ad242(_0x23fca8);}else{_0x17774e();}});}else{_0x3ad242(new Error(_0x4860('0x6')));}}else{_0x3ad242(new Error(_0x4860('0x7')));}});});}module[_0x4860('0x8')]=function(_0x31bb28,_0x175fe6,_0x16a4da,_0x35b4c1,_0x36ac1a,_0x4f477b,_0x16a9c6){var _0x191dab=new AWS[(_0x4860('0x9'))]({'accessKeyId':_0x31bb28,'secretAccessKey':_0x175fe6,'region':_0x16a4da});var _0x71b1e8={'Text':_0x36ac1a,'TextType':_0x4f477b||'text','OutputFormat':_0x4860('0xa'),'VoiceId':_0x35b4c1};return pollyResult(_0x191dab,_0x71b1e8,_0x16a9c6);}; \ No newline at end of file +var _0xfad9=['text','mp3','path','randomstring','synthesizeSpeech','AudioStream','Invalid\x20data\x20response\x20from\x20aws\x20Polly!','No\x20data\x20response\x20from\x20aws\x20Polly!','exports','Polly'];(function(_0x31c243,_0x12ff8a){var _0x9b0d5c=function(_0x1afaed){while(--_0x1afaed){_0x31c243['push'](_0x31c243['shift']());}};_0x9b0d5c(++_0x12ff8a);}(_0xfad9,0xe8));var _0x9fad=function(_0x487a0b,_0x33c302){_0x487a0b=_0x487a0b-0x0;var _0x4cb1ba=_0xfad9[_0x487a0b];return _0x4cb1ba;};'use strict';var fs=require('fs');var path=require(_0x9fad('0x0'));var BPromise=require('bluebird');var rs=require(_0x9fad('0x1'));var AWS=require('aws-sdk');function pollyResult(_0x4b3f9c,_0x911b71,_0x4a02f2){return new BPromise(function(_0x41710c,_0x350d8f){_0x4b3f9c[_0x9fad('0x2')](_0x911b71,function(_0x4e4890,_0x1affae){if(_0x4e4890){_0x350d8f(_0x4e4890);}else if(_0x1affae){if(_0x1affae[_0x9fad('0x3')]instanceof Buffer){fs['writeFile'](_0x4a02f2,_0x1affae[_0x9fad('0x3')],function(_0x119422){if(_0x119422){_0x350d8f(_0x119422);}else{_0x41710c();}});}else{_0x350d8f(new Error(_0x9fad('0x4')));}}else{_0x350d8f(new Error(_0x9fad('0x5')));}});});}module[_0x9fad('0x6')]=function(_0x4e7cec,_0x228c10,_0xd0585a,_0xb368aa,_0x24c2ea,_0x273e9e,_0x363ce8){var _0x2452c6=new AWS[(_0x9fad('0x7'))]({'accessKeyId':_0x4e7cec,'secretAccessKey':_0x228c10,'region':_0xd0585a});var _0xf6bce6={'Text':_0x24c2ea,'TextType':_0x273e9e||_0x9fad('0x8'),'OutputFormat':_0x9fad('0x9'),'VoiceId':_0xb368aa};return pollyResult(_0x2452c6,_0xf6bce6,_0x363ce8);}; \ 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 77b7dc8..a75f23a 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. * // * * // ************************************************************************* -'use strict';var asr=require('./lib/api');module['exports']=function(_0x9359dc,_0x516cd0,_0x295e33,_0x33088d){return asr(_0x9359dc,_0x516cd0,_0x295e33);}; \ No newline at end of file +var _0x3565=['./lib/api','exports'];(function(_0x365feb,_0x6a3c7f){var _0x223ed6=function(_0x5eb069){while(--_0x5eb069){_0x365feb['push'](_0x365feb['shift']());}};_0x223ed6(++_0x6a3c7f);}(_0x3565,0x104));var _0x5356=function(_0x2a1986,_0x393ac1){_0x2a1986=_0x2a1986-0x0;var _0x571a8d=_0x3565[_0x2a1986];return _0x571a8d;};'use strict';var asr=require(_0x5356('0x0'));module[_0x5356('0x1')]=function(_0x2856db,_0x4e628e,_0x5a3d7,_0x317743){return asr(_0x2856db,_0x4e628e,_0x5a3d7);}; \ 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 7b91987..2b165a9 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 _0x4a50=['key\x20should\x20be\x20a\x20string','undefined','string','lang\x20should\x20be\x20a\x20string','readFileSync','toString','base64','POST','LINEAR16','url','https://speech.googleapis.com','exports','length','filepath\x20should\x20be\x20a\x20string'];(function(_0xf24418,_0x1b8dc3){var _0x5498f0=function(_0x3a6935){while(--_0x3a6935){_0xf24418['push'](_0xf24418['shift']());}};_0x5498f0(++_0x1b8dc3);}(_0x4a50,0x175));var _0x04a5=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x4a50[_0x321bb2];return _0x9c12ed;};'use strict';var url=require(_0x04a5('0x0'));var BPromise=require('bluebird');var fs=require('fs');var host=_0x04a5('0x1');module[_0x04a5('0x2')]=function(_0x99cf35,_0x5ab6df,_0xfc991f){return new BPromise(function(_0x5901dc,_0x3fc2d3){var _0x60736f;if(typeof _0x99cf35!=='string'||_0x99cf35[_0x04a5('0x3')]===0x0){return _0x3fc2d3(_0x04a5('0x4'));}if(typeof _0x5ab6df!=='string'||_0x5ab6df['length']===0x0){return _0x3fc2d3(_0x04a5('0x5'));}if(typeof _0xfc991f!==_0x04a5('0x6')&&(typeof _0xfc991f!==_0x04a5('0x7')||_0xfc991f[_0x04a5('0x3')]===0x0)){return _0x3fc2d3(_0x04a5('0x8'));}try{_0x60736f=fs[_0x04a5('0x9')](_0x99cf35)[_0x04a5('0xa')](_0x04a5('0xb'));}catch(_0x2d0c42){return _0x3fc2d3(_0x2d0c42);}return _0x5901dc({'method':_0x04a5('0xc'),'uri':host+'/v1/speech:recognize?key='+_0x5ab6df,'body':{'config':{'encoding':_0x04a5('0xd'),'sampleRateHertz':'8000','languageCode':_0xfc991f},'audio':{'content':_0x60736f}},'json':!![]});});}; \ No newline at end of file +var _0xb8ba=['/v1/speech:recognize?key=','LINEAR16','8000','url','bluebird','https://speech.googleapis.com','string','length','key\x20should\x20be\x20a\x20string','undefined','lang\x20should\x20be\x20a\x20string','readFileSync','base64'];(function(_0x15bbae,_0x5ab778){var _0x2c99b6=function(_0xedf623){while(--_0xedf623){_0x15bbae['push'](_0x15bbae['shift']());}};_0x2c99b6(++_0x5ab778);}(_0xb8ba,0x17c));var _0xab8b=function(_0x4b37a9,_0x2cf023){_0x4b37a9=_0x4b37a9-0x0;var _0x31bfc6=_0xb8ba[_0x4b37a9];return _0x31bfc6;};'use strict';var url=require(_0xab8b('0x0'));var BPromise=require(_0xab8b('0x1'));var fs=require('fs');var host=_0xab8b('0x2');module['exports']=function(_0x35631d,_0x42b751,_0x2f2eca){return new BPromise(function(_0x1ed763,_0x435db9){var _0x53f31a;if(typeof _0x35631d!==_0xab8b('0x3')||_0x35631d[_0xab8b('0x4')]===0x0){return _0x435db9('filepath\x20should\x20be\x20a\x20string');}if(typeof _0x42b751!==_0xab8b('0x3')||_0x42b751['length']===0x0){return _0x435db9(_0xab8b('0x5'));}if(typeof _0x2f2eca!==_0xab8b('0x6')&&(typeof _0x2f2eca!==_0xab8b('0x3')||_0x2f2eca['length']===0x0)){return _0x435db9(_0xab8b('0x7'));}try{_0x53f31a=fs[_0xab8b('0x8')](_0x35631d)['toString'](_0xab8b('0x9'));}catch(_0x5e7e35){return _0x435db9(_0x5e7e35);}return _0x1ed763({'method':'POST','uri':host+_0xab8b('0xa')+_0x42b751,'body':{'config':{'encoding':_0xab8b('0xb'),'sampleRateHertz':_0xab8b('0xc'),'languageCode':_0x2f2eca},'audio':{'content':_0x53f31a}},'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 806bedf..fa85bb4 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 _0xfb54=['./asr','exports'];(function(_0x6c0123,_0x4c8d3b){var _0x5a87d2=function(_0x1ff614){while(--_0x1ff614){_0x6c0123['push'](_0x6c0123['shift']());}};_0x5a87d2(++_0x4c8d3b);}(_0xfb54,0x116));var _0x4fb5=function(_0x406fe5,_0xe5550f){_0x406fe5=_0x406fe5-0x0;var _0x365bfc=_0xfb54[_0x406fe5];return _0x365bfc;};var asr=require(_0x4fb5('0x0'));module[_0x4fb5('0x1')]={'asr':asr}; \ No newline at end of file +var _0xa809=['exports'];(function(_0x8d46ec,_0xd06634){var _0x56f046=function(_0x1f2d6e){while(--_0x1f2d6e){_0x8d46ec['push'](_0x8d46ec['shift']());}};_0x56f046(++_0xd06634);}(_0xa809,0x1f3));var _0x9a80=function(_0x69d6c5,_0x26d921){_0x69d6c5=_0x69d6c5-0x0;var _0x19b1e7=_0xa809[_0x69d6c5];return _0x19b1e7;};var asr=require('./asr');module[_0x9a80('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 370ef8a..ab71bd8 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 _0x2250=['777','split','toString','googleCloudTTS','https://texttospeech.googleapis.com/v1/','ssml','input','voice','audioConfig','MP3','POST','resolve','generate','.mp3','from','base64','writeFile','.wav','googleTTS','goggleTTS\x20path','googleASR','asr','uri','results','alternatives','transcript','join','map','confidence','googleASR\x20transcription','googleASR\x20confidence','catch','[%s]\x20%s:%s','name','message','googleDialogflow','textRequest','stringify','source','result','action','score','status','code','metadata','endConversation','Tilde\x20ASR\x20transcription','Tilde\x20ASR\x20confidence','awsPolly','polly','ispeechTTS','format','%s?apikey=%s&action=convert&text=%s&voice=%s&speed=%s&format=mp3','ispeechASR','%s?apikey=%s&action=recognize&locale=%s&content-type=audio/x-wav&audio=%s&%s','model=%s','freeform=3','sestekNDA','nda','text','channelData','AudioFromTts','Data','audiofile','http','https','url','parse','bluebird','randomstring','sox','util','querystring','google-tts-api','apiai-promise','md5','./aws','./tilde','./sestek','../../../config/logger','agi','https:','host','path','WHAT_EVER','get','error','request\x20to\x20','\x20failed,\x20status\x20code\x20=\x20','statusCode','statusMessage','createWriteStream','finish','info','unlink','pipe','end','protocol','data','transcode','wav','start','tmp','then','chmodSync'];(function(_0x1472b8,_0x3dca8f){var _0x317288=function(_0x3697e3){while(--_0x3697e3){_0x1472b8['push'](_0x1472b8['shift']());}};_0x317288(++_0x3dca8f);}(_0x2250,0x1e4));var _0x0225=function(_0x535963,_0x326515){_0x535963=_0x535963-0x0;var _0x3975f6=_0x2250[_0x535963];return _0x3975f6;};'use strict';var fs=require('fs');var path=require('path');var http=require(_0x0225('0x0'));var https=require(_0x0225('0x1'));var urlParse=require(_0x0225('0x2'))[_0x0225('0x3')];var BPromise=require(_0x0225('0x4'));var rs=require(_0x0225('0x5'));var sox=require(_0x0225('0x6'));var rp=require('request-promise');var util=require(_0x0225('0x7'));var querystring=require(_0x0225('0x8'));var tts=require(_0x0225('0x9'));var apiai=require(_0x0225('0xa'));var md5=require(_0x0225('0xb'));var google=require('./google');var aws=require(_0x0225('0xc'));var tilde=require(_0x0225('0xd'));var sestek=require(_0x0225('0xe'));var logger=require(_0x0225('0xf'))(_0x0225('0x10'));var ISPEECH_API='https://api.ispeech.org/api/rest';function downloadFile(_0x3d049c,_0x5658fe){return new BPromise(function(_0x131e31,_0x197fd4){var _0x3a2a40=urlParse(_0x3d049c);var _0x8ea0a=_0x3a2a40['protocol']===_0x0225('0x11')?https:http;var _0x4c798a={'host':_0x3a2a40[_0x0225('0x12')],'path':_0x3a2a40[_0x0225('0x13')],'headers':{'user-agent':_0x0225('0x14')}};_0x8ea0a[_0x0225('0x15')](_0x4c798a,function(_0x5f5071){if(_0x5f5071['statusCode']!==0xc8){logger[_0x0225('0x16')](_0x0225('0x17')+_0x3d049c+_0x0225('0x18')+_0x5f5071[_0x0225('0x19')]+'\x20('+_0x5f5071['statusMessage']+')');_0x197fd4(new Error(_0x0225('0x17')+_0x3d049c+_0x0225('0x18')+_0x5f5071[_0x0225('0x19')]+'\x20('+_0x5f5071[_0x0225('0x1a')]+')'));return;}var _0x141411=fs[_0x0225('0x1b')](_0x5658fe);_0x141411['on'](_0x0225('0x1c'),function(){logger[_0x0225('0x1d')]('finish\x20download\x20file');_0x141411['close'](_0x131e31);});_0x141411['on'](_0x0225('0x16'),function(_0x568fc5){fs[_0x0225('0x1e')](_0x5658fe);logger[_0x0225('0x16')]('download\x20error',_0x568fc5);_0x197fd4(_0x568fc5);});_0x5f5071[_0x0225('0x1f')](_0x141411);})['on'](_0x0225('0x16'),function(_0x1072cb){logger[_0x0225('0x16')](_0x1072cb);_0x197fd4(_0x1072cb);})[_0x0225('0x20')]();});}function uploadFile(_0x216b89){return new BPromise(function(_0x37950f,_0x2533bc){var _0x5693d4=urlParse(_0x216b89);var _0x53fbd9=_0x5693d4[_0x0225('0x21')]===_0x0225('0x11')?https:http;var _0x3b2b89={'host':_0x5693d4[_0x0225('0x12')],'path':_0x5693d4['path'],'headers':{'user-agent':_0x0225('0x14')}};_0x53fbd9[_0x0225('0x15')](_0x3b2b89,function(_0x3a8c86){if(_0x3a8c86[_0x0225('0x19')]!==0xc8){_0x2533bc(new Error(_0x0225('0x17')+_0x216b89+'\x20failed,\x20status\x20code\x20=\x20'+_0x3a8c86['statusCode']+'\x20('+_0x3a8c86[_0x0225('0x1a')]+')'));return;}var _0x3709b3='';_0x3a8c86['on'](_0x0225('0x22'),function(_0x10e383){_0x3709b3+=_0x10e383;});_0x3a8c86['on']('end',function(){_0x37950f(_0x3709b3);});})['on'](_0x0225('0x16'),function(_0x1f643a){_0x2533bc(_0x1f643a);})[_0x0225('0x20')]();});}function convertFile(_0xdfaf92,_0x59e54d){return new BPromise(function(_0x364358,_0x4e7269){var _0x4084e6=sox[_0x0225('0x23')](_0xdfaf92,_0x59e54d,{'sampleRate':0x1f40,'format':_0x0225('0x24'),'channelCount':0x1,'bitRate':0xc0*0x400,'compressionQuality':0x5});_0x4084e6['on'](_0x0225('0x16'),function(_0x135e8f){logger[_0x0225('0x16')]('error\x20convert',_0x135e8f);_0x4e7269(_0x135e8f);});_0x4084e6['on'](_0x0225('0x20'),function(){logger['info']('finish\x20to\x20convert');_0x364358();});_0x4084e6[_0x0225('0x25')]();});}function base64Decode(_0x1084f2,_0x428cee){var _0xdbfcab=path['resolve'](__dirname,_0x0225('0x26'),rs['generate'](0x4)+'.wav');fs['writeFileSync'](_0xdbfcab,_0x1084f2,'base64');return convertFile(_0xdbfcab,_0x428cee)[_0x0225('0x27')](function(){try{fs[_0x0225('0x1e')](_0xdbfcab);fs[_0x0225('0x28')](_0x428cee,_0x0225('0x29'));}catch(_0x3db69b){logger[_0x0225('0x16')](_0x3db69b);}return _0x428cee[_0x0225('0x2a')]('.')[0x0];});}function base64Encode(_0x4aafd3){var _0x528c4b=fs['readFileSync'](_0x4aafd3);return new Buffer(_0x528c4b)[_0x0225('0x2b')]('base64');}exports[_0x0225('0x2c')]=function(_0x1ae6a0,_0x195ff2,_0x2489d0,_0xe5d06d,_0x326b70,_0x56053a){var _0x1f23c7,_0x443268;var _0x19c425=_0x0225('0x2d');var _0x5cba57='?key='+_0x1ae6a0;var _0x194aa4={};if(_0x195ff2===_0x0225('0x2e')){_0x194aa4[_0x0225('0x2f')]={'ssml':_0x2489d0};}else{_0x194aa4[_0x0225('0x2f')]={'text':_0x2489d0};};_0x194aa4[_0x0225('0x30')]={'languageCode':_0xe5d06d,'ssmlGender':_0x326b70};_0x194aa4[_0x0225('0x31')]={'audioEncoding':_0x0225('0x32'),'sampleRateHertz':0x1f40};var _0x24f9f7={'url':_0x19c425+'text:synthesize'+_0x5cba57,'method':_0x0225('0x33'),'json':!![],'body':_0x194aa4};return rp(_0x24f9f7)['then'](function(_0x2110e9){return new BPromise(function(_0x5b581f,_0x3b1450){_0x1f23c7=path[_0x0225('0x34')](__dirname,_0x0225('0x26'),rs[_0x0225('0x35')](0x4)+_0x0225('0x36'));var _0x1cc04b=Buffer[_0x0225('0x37')](_0x2110e9['audioContent'],_0x0225('0x38'));return fs[_0x0225('0x39')](_0x1f23c7,_0x1cc04b,function(_0x571c73){_0x3b1450(_0x571c73);},function(_0x38027f){fs[_0x0225('0x28')](_0x1f23c7,'777');_0x5b581f(_0x38027f);});});})[_0x0225('0x27')](function(_0x47faca){_0x443268=path[_0x0225('0x34')](__dirname,_0x0225('0x26'),rs[_0x0225('0x35')](0x4)+_0x0225('0x3a'));return convertFile(_0x1f23c7,_0x443268);})[_0x0225('0x27')](function(){try{fs[_0x0225('0x1e')](_0x1f23c7);fs['chmodSync'](_0x443268,_0x0225('0x29'));}catch(_0x597f06){logger[_0x0225('0x16')](_0x597f06);}logger[_0x0225('0x1d')]('googleCloudTTS\x20path',_0x443268[_0x0225('0x2a')]('.')[0x0]);return _0x443268[_0x0225('0x2a')]('.')[0x0];});};exports[_0x0225('0x3b')]=function(_0x2ee666,_0x468f54){var _0x465b3f,_0x197b63;return tts(_0x2ee666,_0x468f54||'en',0x1)['then'](function(_0x227cea){logger['info'](_0x227cea);_0x465b3f=path[_0x0225('0x34')](__dirname,_0x0225('0x26'),rs[_0x0225('0x35')](0x4)+_0x0225('0x36'));return downloadFile(_0x227cea,_0x465b3f);})[_0x0225('0x27')](function(){_0x197b63=path[_0x0225('0x34')](__dirname,'tmp',rs['generate'](0x4)+_0x0225('0x3a'));return convertFile(_0x465b3f,_0x197b63);})[_0x0225('0x27')](function(){try{fs[_0x0225('0x1e')](_0x465b3f);fs[_0x0225('0x28')](_0x197b63,_0x0225('0x29'));}catch(_0x391548){logger[_0x0225('0x16')](_0x391548);}logger[_0x0225('0x1d')](_0x0225('0x3c'),_0x197b63[_0x0225('0x2a')]('.')[0x0]);return _0x197b63[_0x0225('0x2a')]('.')[0x0];});};exports[_0x0225('0x3d')]=function(_0x4510f5,_0x3c74da,_0x96185b){return google[_0x0225('0x3e')](_0x4510f5,_0x3c74da,_0x96185b)['then'](function(_0x1cd39f){logger[_0x0225('0x1d')](_0x1cd39f[_0x0225('0x3f')]);return rp(_0x1cd39f);})[_0x0225('0x27')](function(_0x2ed9b4){var _0x5ee85f='';var _0x5640e4=0x0;try{fs['unlink'](_0x4510f5);}catch(_0x29f346){logger[_0x0225('0x16')](_0x29f346);}if(_0x2ed9b4&&_0x2ed9b4[_0x0225('0x40')]){_0x5ee85f=_0x2ed9b4[_0x0225('0x40')]['map'](function(_0x497144){return _0x497144&&_0x497144['alternatives'][0x0]&&_0x497144[_0x0225('0x41')][0x0][_0x0225('0x42')]?_0x497144[_0x0225('0x41')][0x0]['transcript']:'';})[_0x0225('0x43')]('\x0a');_0x5640e4=_0x2ed9b4['results'][_0x0225('0x44')](function(_0x2026bf){return _0x2026bf&&_0x2026bf['alternatives'][0x0]&&_0x2026bf[_0x0225('0x41')][0x0][_0x0225('0x45')]?_0x2026bf[_0x0225('0x41')][0x0][_0x0225('0x45')]:0x0;})['join']('\x0a');}logger['info'](_0x0225('0x46'),_0x5ee85f);logger['info'](_0x0225('0x47'),_0x5640e4);return{'transcript':_0x5ee85f,'confidence':_0x5640e4};})[_0x0225('0x48')](function(_0x3f4158){logger[_0x0225('0x16')](_0x0225('0x49'),_0x3f4158[_0x0225('0x19')],_0x3f4158[_0x0225('0x4a')],_0x3f4158[_0x0225('0x4b')]);});};exports[_0x0225('0x4c')]=function(_0x23dc62,_0x203df0,_0x427b42,_0x21d8ec){var _0x28bee4=apiai(_0x203df0,{'language':_0x21d8ec||'en'});return _0x28bee4[_0x0225('0x4d')](_0x427b42,{'sessionId':md5(_0x23dc62)})[_0x0225('0x27')](function(_0x42ba21){logger[_0x0225('0x1d')](JSON[_0x0225('0x4e')](_0x42ba21));return{'source':_0x42ba21['result'][_0x0225('0x4f')],'resolvedQuery':_0x42ba21[_0x0225('0x50')]['resolvedQuery'],'action':_0x42ba21[_0x0225('0x50')][_0x0225('0x51')],'actionIncomplete':_0x42ba21['result']['actionIncomplete'],'speech':_0x42ba21[_0x0225('0x50')]['fulfillment']['speech'],'score':_0x42ba21[_0x0225('0x50')][_0x0225('0x52')],'statusCode':_0x42ba21[_0x0225('0x53')][_0x0225('0x54')],'endConversation':_0x42ba21[_0x0225('0x50')][_0x0225('0x55')][_0x0225('0x56')]||![],'isFallbackIntent':_0x42ba21['result'][_0x0225('0x55')]['isFallbackIntent']};});};exports['tildeASR']=function(_0x52d949,_0xac11e7,_0x420488,_0x198de1){return tilde['asr'](_0x52d949,_0xac11e7,_0x420488,_0x198de1)[_0x0225('0x27')](function(_0x52d3ff){try{fs[_0x0225('0x1e')](_0x52d949);}catch(_0x31e6ee){logger[_0x0225('0x16')](_0x31e6ee);}logger[_0x0225('0x1d')](_0x0225('0x57'),_0x52d3ff[_0x0225('0x42')]);logger[_0x0225('0x1d')](_0x0225('0x58'),_0x52d3ff['confidence']);return _0x52d3ff;});};exports[_0x0225('0x59')]=function(_0x11e3c9,_0x2b86da,_0x4dd145,_0x2eb7ff,_0x437c6d,_0xefd2){var _0x835af6=path['resolve'](__dirname,_0x0225('0x26'),rs[_0x0225('0x35')](0x4)+_0x0225('0x36'));var _0x276a2e;return aws[_0x0225('0x5a')](_0x11e3c9,_0x2b86da,_0x4dd145,_0x2eb7ff,_0x437c6d,_0xefd2,_0x835af6)[_0x0225('0x27')](function(){_0x276a2e=path[_0x0225('0x34')](__dirname,_0x0225('0x26'),rs['generate'](0x4)+_0x0225('0x3a'));return convertFile(_0x835af6,_0x276a2e);})['then'](function(){try{fs[_0x0225('0x1e')](_0x835af6);fs[_0x0225('0x28')](_0x276a2e,_0x0225('0x29'));}catch(_0x5d8aa7){logger['error'](_0x5d8aa7);}return _0x276a2e['split']('.')[0x0];});};exports['awsLex']=function(_0x16ed72,_0x2425bd,_0x3c125b,_0x19b4cb,_0x59bc64,_0x48fe6c){return aws['lex'](_0x16ed72,_0x2425bd,_0x3c125b,_0x19b4cb,_0x59bc64,_0x48fe6c)[_0x0225('0x27')](function(_0x10e944){logger['info'](JSON[_0x0225('0x4e')](_0x10e944));return _0x10e944;});};exports[_0x0225('0x5b')]=function(_0x4d0c0e,_0xfa32df,_0x489ee8,_0x26145b){var _0x14f970=util[_0x0225('0x5c')](_0x0225('0x5d'),ISPEECH_API,_0x4d0c0e,encodeURIComponent(_0xfa32df),_0x489ee8,_0x26145b);var _0x152b30=path['resolve'](__dirname,_0x0225('0x26'),rs[_0x0225('0x35')](0x4)+_0x0225('0x36'));var _0x39bddf;return downloadFile(_0x14f970,_0x152b30)[_0x0225('0x27')](function(){_0x39bddf=path[_0x0225('0x34')](__dirname,_0x0225('0x26'),rs[_0x0225('0x35')](0x4)+_0x0225('0x3a'));return convertFile(_0x152b30,_0x39bddf);})['then'](function(){try{fs[_0x0225('0x1e')](_0x152b30);fs[_0x0225('0x28')](_0x39bddf,_0x0225('0x29'));}catch(_0x5e8060){logger[_0x0225('0x16')](_0x5e8060);}return _0x39bddf[_0x0225('0x2a')]('.')[0x0];});};exports[_0x0225('0x5e')]=function(_0x3e3074,_0x58011d,_0xfa6547,_0x5171d1){var _0x4b3915=util[_0x0225('0x5c')](_0x0225('0x5f'),ISPEECH_API,_0x58011d,_0xfa6547,base64Encode(_0x3e3074),_0x5171d1?util[_0x0225('0x5c')](_0x0225('0x60'),encodeURIComponent(_0x5171d1)):_0x0225('0x61'));return uploadFile(_0x4b3915)[_0x0225('0x27')](function(_0x46b8d7){return querystring[_0x0225('0x3')](_0x46b8d7);});};exports[_0x0225('0x62')]=function(_0x47da1a,_0x3a1fab){return sestek[_0x0225('0x63')](_0x47da1a,_0x3a1fab)[_0x0225('0x27')](function(_0x1fa66a){logger['info'](JSON[_0x0225('0x4e')](_0x1fa66a));var _0x1d3fda={'speech':_0x1fa66a[_0x0225('0x64')],'action':_0x1fa66a[_0x0225('0x65')]?_0x1fa66a[_0x0225('0x65')]['CustomAction']:undefined,'actiondata':_0x1fa66a[_0x0225('0x65')]?_0x1fa66a[_0x0225('0x65')]['CustomActionData']:undefined};if(_0x1fa66a[_0x0225('0x65')]&&_0x1fa66a[_0x0225('0x65')][_0x0225('0x66')]){return base64Decode(_0x1fa66a['channelData'][_0x0225('0x66')][_0x0225('0x67')],path[_0x0225('0x34')](__dirname,'tmp',rs[_0x0225('0x35')](0x4)+_0x0225('0x3a')))['then'](function(_0x299294){_0x1d3fda[_0x0225('0x68')]=_0x299294;return _0x1d3fda;});}return _0x1d3fda;});};exports['dirName']=function(){return __dirname;}; \ No newline at end of file +var _0x6b2a=['nda','text','channelData','CustomAction','AudioFromTts','Data','audiofile','dirName','http','https','url','parse','bluebird','randomstring','sox','request-promise','util','querystring','google-tts-api','apiai-promise','./google','./aws','./sestek','../../../config/logger','agi','host','path','WHAT_EVER','get','error','\x20failed,\x20status\x20code\x20=\x20','statusCode','statusMessage','finish','info','finish\x20download\x20file','close','unlink','download\x20error','pipe','request\x20to\x20','data','end','transcode','wav','tmp','generate','writeFileSync','chmodSync','777','split','readFileSync','toString','https://texttospeech.googleapis.com/v1/','input','voice','audioConfig','MP3','text:synthesize','POST','then','resolve','.mp3','from','audioContent','.wav','googleTTS','asr','uri','map','alternatives','transcript','join','results','confidence','googleASR\x20transcription','catch','[%s]\x20%s:%s','textRequest','stringify','result','resolvedQuery','actionIncomplete','score','code','metadata','tildeASR','Tilde\x20ASR\x20transcription','Tilde\x20ASR\x20confidence','lex','ispeechTTS','format','model=%s','freeform=3','sestekNDA'];(function(_0x2477bf,_0x6b6a15){var _0x177377=function(_0x5173e4){while(--_0x5173e4){_0x2477bf['push'](_0x2477bf['shift']());}};_0x177377(++_0x6b6a15);}(_0x6b2a,0x125));var _0xa6b2=function(_0x2c9caa,_0x4ab15f){_0x2c9caa=_0x2c9caa-0x0;var _0x27bf35=_0x6b2a[_0x2c9caa];return _0x27bf35;};'use strict';var fs=require('fs');var path=require('path');var http=require(_0xa6b2('0x0'));var https=require(_0xa6b2('0x1'));var urlParse=require(_0xa6b2('0x2'))[_0xa6b2('0x3')];var BPromise=require(_0xa6b2('0x4'));var rs=require(_0xa6b2('0x5'));var sox=require(_0xa6b2('0x6'));var rp=require(_0xa6b2('0x7'));var util=require(_0xa6b2('0x8'));var querystring=require(_0xa6b2('0x9'));var tts=require(_0xa6b2('0xa'));var apiai=require(_0xa6b2('0xb'));var md5=require('md5');var google=require(_0xa6b2('0xc'));var aws=require(_0xa6b2('0xd'));var tilde=require('./tilde');var sestek=require(_0xa6b2('0xe'));var logger=require(_0xa6b2('0xf'))(_0xa6b2('0x10'));var ISPEECH_API='https://api.ispeech.org/api/rest';function downloadFile(_0x9e2d66,_0xccff1c){return new BPromise(function(_0x55bbed,_0x1c9265){var _0x1b0465=urlParse(_0x9e2d66);var _0x1897ea=_0x1b0465['protocol']==='https:'?https:http;var _0x345a4d={'host':_0x1b0465[_0xa6b2('0x11')],'path':_0x1b0465[_0xa6b2('0x12')],'headers':{'user-agent':_0xa6b2('0x13')}};_0x1897ea[_0xa6b2('0x14')](_0x345a4d,function(_0x27f5de){if(_0x27f5de['statusCode']!==0xc8){logger[_0xa6b2('0x15')]('request\x20to\x20'+_0x9e2d66+_0xa6b2('0x16')+_0x27f5de[_0xa6b2('0x17')]+'\x20('+_0x27f5de[_0xa6b2('0x18')]+')');_0x1c9265(new Error('request\x20to\x20'+_0x9e2d66+_0xa6b2('0x16')+_0x27f5de[_0xa6b2('0x17')]+'\x20('+_0x27f5de['statusMessage']+')'));return;}var _0x2fe9e5=fs['createWriteStream'](_0xccff1c);_0x2fe9e5['on'](_0xa6b2('0x19'),function(){logger[_0xa6b2('0x1a')](_0xa6b2('0x1b'));_0x2fe9e5[_0xa6b2('0x1c')](_0x55bbed);});_0x2fe9e5['on'](_0xa6b2('0x15'),function(_0x3d1278){fs[_0xa6b2('0x1d')](_0xccff1c);logger['error'](_0xa6b2('0x1e'),_0x3d1278);_0x1c9265(_0x3d1278);});_0x27f5de[_0xa6b2('0x1f')](_0x2fe9e5);})['on']('error',function(_0x204401){logger[_0xa6b2('0x15')](_0x204401);_0x1c9265(_0x204401);})['end']();});}function uploadFile(_0x38c937){return new BPromise(function(_0x502b42,_0x12ec26){var _0x51d2e7=urlParse(_0x38c937);var _0x393e91=_0x51d2e7['protocol']==='https:'?https:http;var _0x35eb5f={'host':_0x51d2e7[_0xa6b2('0x11')],'path':_0x51d2e7[_0xa6b2('0x12')],'headers':{'user-agent':_0xa6b2('0x13')}};_0x393e91[_0xa6b2('0x14')](_0x35eb5f,function(_0x2cc3e8){if(_0x2cc3e8['statusCode']!==0xc8){_0x12ec26(new Error(_0xa6b2('0x20')+_0x38c937+_0xa6b2('0x16')+_0x2cc3e8[_0xa6b2('0x17')]+'\x20('+_0x2cc3e8[_0xa6b2('0x18')]+')'));return;}var _0x5b2151='';_0x2cc3e8['on'](_0xa6b2('0x21'),function(_0x378149){_0x5b2151+=_0x378149;});_0x2cc3e8['on'](_0xa6b2('0x22'),function(){_0x502b42(_0x5b2151);});})['on'](_0xa6b2('0x15'),function(_0x457154){_0x12ec26(_0x457154);})[_0xa6b2('0x22')]();});}function convertFile(_0x3c2743,_0x169497){return new BPromise(function(_0x4a5e6b,_0x70ddae){var _0x482e90=sox[_0xa6b2('0x23')](_0x3c2743,_0x169497,{'sampleRate':0x1f40,'format':_0xa6b2('0x24'),'channelCount':0x1,'bitRate':0xc0*0x400,'compressionQuality':0x5});_0x482e90['on']('error',function(_0x20a12c){logger[_0xa6b2('0x15')]('error\x20convert',_0x20a12c);_0x70ddae(_0x20a12c);});_0x482e90['on'](_0xa6b2('0x22'),function(){logger[_0xa6b2('0x1a')]('finish\x20to\x20convert');_0x4a5e6b();});_0x482e90['start']();});}function base64Decode(_0x5d37d1,_0x2ce5c9){var _0x15b63a=path['resolve'](__dirname,_0xa6b2('0x25'),rs[_0xa6b2('0x26')](0x4)+'.wav');fs[_0xa6b2('0x27')](_0x15b63a,_0x5d37d1,'base64');return convertFile(_0x15b63a,_0x2ce5c9)['then'](function(){try{fs['unlink'](_0x15b63a);fs[_0xa6b2('0x28')](_0x2ce5c9,_0xa6b2('0x29'));}catch(_0x9e7843){logger[_0xa6b2('0x15')](_0x9e7843);}return _0x2ce5c9[_0xa6b2('0x2a')]('.')[0x0];});}function base64Encode(_0x188ac3){var _0x3648c8=fs[_0xa6b2('0x2b')](_0x188ac3);return new Buffer(_0x3648c8)[_0xa6b2('0x2c')]('base64');}exports['googleCloudTTS']=function(_0x5c1f23,_0x54a7de,_0x42cc8,_0x1259e9,_0x5c60df,_0x115d2a){var _0x54463d,_0x505c9a;var _0x41331b=_0xa6b2('0x2d');var _0x276be0='?key='+_0x5c1f23;var _0x126565={};if(_0x54a7de==='ssml'){_0x126565[_0xa6b2('0x2e')]={'ssml':_0x42cc8};}else{_0x126565[_0xa6b2('0x2e')]={'text':_0x42cc8};};_0x126565[_0xa6b2('0x2f')]={'languageCode':_0x1259e9,'ssmlGender':_0x5c60df};_0x126565[_0xa6b2('0x30')]={'audioEncoding':_0xa6b2('0x31'),'sampleRateHertz':0x1f40};var _0x223488={'url':_0x41331b+_0xa6b2('0x32')+_0x276be0,'method':_0xa6b2('0x33'),'json':!![],'body':_0x126565};return rp(_0x223488)[_0xa6b2('0x34')](function(_0x35d539){return new BPromise(function(_0x388ac1,_0x12094c){_0x54463d=path[_0xa6b2('0x35')](__dirname,_0xa6b2('0x25'),rs['generate'](0x4)+_0xa6b2('0x36'));var _0x1fe978=Buffer[_0xa6b2('0x37')](_0x35d539[_0xa6b2('0x38')],'base64');return fs['writeFile'](_0x54463d,_0x1fe978,function(_0x3f6b66){_0x12094c(_0x3f6b66);},function(_0x26fa28){fs[_0xa6b2('0x28')](_0x54463d,_0xa6b2('0x29'));_0x388ac1(_0x26fa28);});});})[_0xa6b2('0x34')](function(_0x570878){_0x505c9a=path['resolve'](__dirname,_0xa6b2('0x25'),rs[_0xa6b2('0x26')](0x4)+_0xa6b2('0x39'));return convertFile(_0x54463d,_0x505c9a);})[_0xa6b2('0x34')](function(){try{fs[_0xa6b2('0x1d')](_0x54463d);fs['chmodSync'](_0x505c9a,'777');}catch(_0x5565d5){logger[_0xa6b2('0x15')](_0x5565d5);}logger[_0xa6b2('0x1a')]('googleCloudTTS\x20path',_0x505c9a[_0xa6b2('0x2a')]('.')[0x0]);return _0x505c9a[_0xa6b2('0x2a')]('.')[0x0];});};exports[_0xa6b2('0x3a')]=function(_0x2a4f27,_0x114bf4){var _0x185755,_0x2aab4c;return tts(_0x2a4f27,_0x114bf4||'en',0x1)[_0xa6b2('0x34')](function(_0x5cc8c0){logger[_0xa6b2('0x1a')](_0x5cc8c0);_0x185755=path['resolve'](__dirname,'tmp',rs[_0xa6b2('0x26')](0x4)+'.mp3');return downloadFile(_0x5cc8c0,_0x185755);})[_0xa6b2('0x34')](function(){_0x2aab4c=path[_0xa6b2('0x35')](__dirname,_0xa6b2('0x25'),rs['generate'](0x4)+_0xa6b2('0x39'));return convertFile(_0x185755,_0x2aab4c);})[_0xa6b2('0x34')](function(){try{fs[_0xa6b2('0x1d')](_0x185755);fs[_0xa6b2('0x28')](_0x2aab4c,_0xa6b2('0x29'));}catch(_0x36b78b){logger[_0xa6b2('0x15')](_0x36b78b);}logger['info']('goggleTTS\x20path',_0x2aab4c['split']('.')[0x0]);return _0x2aab4c[_0xa6b2('0x2a')]('.')[0x0];});};exports['googleASR']=function(_0x79df83,_0x3bac7c,_0x56b6c1){return google[_0xa6b2('0x3b')](_0x79df83,_0x3bac7c,_0x56b6c1)[_0xa6b2('0x34')](function(_0x23ca90){logger['info'](_0x23ca90[_0xa6b2('0x3c')]);return rp(_0x23ca90);})[_0xa6b2('0x34')](function(_0x25876e){var _0x2e2b99='';var _0x3ed4fa=0x0;try{fs['unlink'](_0x79df83);}catch(_0x848945){logger[_0xa6b2('0x15')](_0x848945);}if(_0x25876e&&_0x25876e['results']){_0x2e2b99=_0x25876e['results'][_0xa6b2('0x3d')](function(_0x424820){return _0x424820&&_0x424820[_0xa6b2('0x3e')][0x0]&&_0x424820['alternatives'][0x0][_0xa6b2('0x3f')]?_0x424820['alternatives'][0x0][_0xa6b2('0x3f')]:'';})[_0xa6b2('0x40')]('\x0a');_0x3ed4fa=_0x25876e[_0xa6b2('0x41')][_0xa6b2('0x3d')](function(_0x5ea6de){return _0x5ea6de&&_0x5ea6de['alternatives'][0x0]&&_0x5ea6de[_0xa6b2('0x3e')][0x0]['confidence']?_0x5ea6de[_0xa6b2('0x3e')][0x0][_0xa6b2('0x42')]:0x0;})[_0xa6b2('0x40')]('\x0a');}logger[_0xa6b2('0x1a')](_0xa6b2('0x43'),_0x2e2b99);logger[_0xa6b2('0x1a')]('googleASR\x20confidence',_0x3ed4fa);return{'transcript':_0x2e2b99,'confidence':_0x3ed4fa};})[_0xa6b2('0x44')](function(_0xb31e28){logger[_0xa6b2('0x15')](_0xa6b2('0x45'),_0xb31e28['statusCode'],_0xb31e28['name'],_0xb31e28['message']);});};exports['googleDialogflow']=function(_0x3c987c,_0x148aa7,_0x314815,_0x4caa12){var _0x8d88f8=apiai(_0x148aa7,{'language':_0x4caa12||'en'});return _0x8d88f8[_0xa6b2('0x46')](_0x314815,{'sessionId':md5(_0x3c987c)})['then'](function(_0x5f1f7f){logger[_0xa6b2('0x1a')](JSON[_0xa6b2('0x47')](_0x5f1f7f));return{'source':_0x5f1f7f[_0xa6b2('0x48')]['source'],'resolvedQuery':_0x5f1f7f[_0xa6b2('0x48')][_0xa6b2('0x49')],'action':_0x5f1f7f[_0xa6b2('0x48')]['action'],'actionIncomplete':_0x5f1f7f[_0xa6b2('0x48')][_0xa6b2('0x4a')],'speech':_0x5f1f7f[_0xa6b2('0x48')]['fulfillment']['speech'],'score':_0x5f1f7f[_0xa6b2('0x48')][_0xa6b2('0x4b')],'statusCode':_0x5f1f7f['status'][_0xa6b2('0x4c')],'endConversation':_0x5f1f7f[_0xa6b2('0x48')][_0xa6b2('0x4d')]['endConversation']||![],'isFallbackIntent':_0x5f1f7f[_0xa6b2('0x48')][_0xa6b2('0x4d')]['isFallbackIntent']};});};exports[_0xa6b2('0x4e')]=function(_0x462d09,_0x56c5ef,_0x49cbd2,_0x2782eb){return tilde[_0xa6b2('0x3b')](_0x462d09,_0x56c5ef,_0x49cbd2,_0x2782eb)['then'](function(_0x536658){try{fs[_0xa6b2('0x1d')](_0x462d09);}catch(_0x410889){logger['error'](_0x410889);}logger[_0xa6b2('0x1a')](_0xa6b2('0x4f'),_0x536658['transcript']);logger['info'](_0xa6b2('0x50'),_0x536658['confidence']);return _0x536658;});};exports['awsPolly']=function(_0x561a77,_0xc903be,_0x1e530d,_0x49809e,_0xd2b2fc,_0x292d75){var _0x5baebc=path[_0xa6b2('0x35')](__dirname,_0xa6b2('0x25'),rs[_0xa6b2('0x26')](0x4)+_0xa6b2('0x36'));var _0x4c3a23;return aws['polly'](_0x561a77,_0xc903be,_0x1e530d,_0x49809e,_0xd2b2fc,_0x292d75,_0x5baebc)[_0xa6b2('0x34')](function(){_0x4c3a23=path[_0xa6b2('0x35')](__dirname,_0xa6b2('0x25'),rs[_0xa6b2('0x26')](0x4)+'.wav');return convertFile(_0x5baebc,_0x4c3a23);})['then'](function(){try{fs[_0xa6b2('0x1d')](_0x5baebc);fs[_0xa6b2('0x28')](_0x4c3a23,_0xa6b2('0x29'));}catch(_0x5a110b){logger[_0xa6b2('0x15')](_0x5a110b);}return _0x4c3a23[_0xa6b2('0x2a')]('.')[0x0];});};exports['awsLex']=function(_0x1ed7af,_0x52ab09,_0x1384bd,_0x575822,_0x1816c2,_0x15212a){return aws[_0xa6b2('0x51')](_0x1ed7af,_0x52ab09,_0x1384bd,_0x575822,_0x1816c2,_0x15212a)[_0xa6b2('0x34')](function(_0x1fe129){logger[_0xa6b2('0x1a')](JSON[_0xa6b2('0x47')](_0x1fe129));return _0x1fe129;});};exports[_0xa6b2('0x52')]=function(_0x4868ff,_0xa22535,_0x1ccae1,_0x619c28){var _0x2e2f61=util[_0xa6b2('0x53')]('%s?apikey=%s&action=convert&text=%s&voice=%s&speed=%s&format=mp3',ISPEECH_API,_0x4868ff,encodeURIComponent(_0xa22535),_0x1ccae1,_0x619c28);var _0x1c5c78=path['resolve'](__dirname,'tmp',rs[_0xa6b2('0x26')](0x4)+'.mp3');var _0x277e5d;return downloadFile(_0x2e2f61,_0x1c5c78)['then'](function(){_0x277e5d=path['resolve'](__dirname,'tmp',rs['generate'](0x4)+_0xa6b2('0x39'));return convertFile(_0x1c5c78,_0x277e5d);})['then'](function(){try{fs[_0xa6b2('0x1d')](_0x1c5c78);fs['chmodSync'](_0x277e5d,_0xa6b2('0x29'));}catch(_0x50e367){logger[_0xa6b2('0x15')](_0x50e367);}return _0x277e5d['split']('.')[0x0];});};exports['ispeechASR']=function(_0x16fdc7,_0x481fc8,_0x22ece0,_0x576d9f){var _0x3ccf90=util[_0xa6b2('0x53')]('%s?apikey=%s&action=recognize&locale=%s&content-type=audio/x-wav&audio=%s&%s',ISPEECH_API,_0x481fc8,_0x22ece0,base64Encode(_0x16fdc7),_0x576d9f?util['format'](_0xa6b2('0x54'),encodeURIComponent(_0x576d9f)):_0xa6b2('0x55'));return uploadFile(_0x3ccf90)[_0xa6b2('0x34')](function(_0x51db48){return querystring[_0xa6b2('0x3')](_0x51db48);});};exports[_0xa6b2('0x56')]=function(_0x294f9e,_0x1a9d6b){return sestek[_0xa6b2('0x57')](_0x294f9e,_0x1a9d6b)[_0xa6b2('0x34')](function(_0x102a05){logger[_0xa6b2('0x1a')](JSON[_0xa6b2('0x47')](_0x102a05));var _0x587818={'speech':_0x102a05[_0xa6b2('0x58')],'action':_0x102a05[_0xa6b2('0x59')]?_0x102a05[_0xa6b2('0x59')][_0xa6b2('0x5a')]:undefined,'actiondata':_0x102a05[_0xa6b2('0x59')]?_0x102a05['channelData']['CustomActionData']:undefined};if(_0x102a05[_0xa6b2('0x59')]&&_0x102a05[_0xa6b2('0x59')]['AudioFromTts']){return base64Decode(_0x102a05[_0xa6b2('0x59')][_0xa6b2('0x5b')][_0xa6b2('0x5c')],path['resolve'](__dirname,'tmp',rs[_0xa6b2('0x26')](0x4)+_0xa6b2('0x39')))[_0xa6b2('0x34')](function(_0x2faacd){_0x587818[_0xa6b2('0x5d')]=_0x2faacd;return _0x587818;});}return _0x587818;});};exports[_0xa6b2('0x5e')]=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 3927f38..e7a7b8c 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 _0x3d24=['./nda'];(function(_0x3e92e2,_0x5bc9d4){var _0x155d7b=function(_0x4359e9){while(--_0x4359e9){_0x3e92e2['push'](_0x3e92e2['shift']());}};_0x155d7b(++_0x5bc9d4);}(_0x3d24,0xd9));var _0x43d2=function(_0xfe0166,_0x465310){_0xfe0166=_0xfe0166-0x0;var _0x5e05e0=_0x3d24[_0xfe0166];return _0x5e05e0;};var nda=require(_0x43d2('0x0'));module['exports']={'nda':nda}; \ No newline at end of file +var _0x6cdc=['./nda'];(function(_0x399d76,_0xdc4493){var _0x3b19a1=function(_0x262225){while(--_0x262225){_0x399d76['push'](_0x399d76['shift']());}};_0x3b19a1(++_0xdc4493);}(_0x6cdc,0x193));var _0xc6cd=function(_0x3296c3,_0xc96c4a){_0x3296c3=_0x3296c3-0x0;var _0x1fb66a=_0x6cdc[_0x3296c3];return _0x1fb66a;};var nda=require(_0xc6cd('0x0'));module['exports']={'nda':nda}; \ No newline at end of file diff --git a/server/services/agi/scripts/sestek/nda/index.js b/server/services/agi/scripts/sestek/nda/index.js index 80bb262..5e5a2d2 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 _0xd8e1=['ndaactivity_type','Nda','uniqueid','dnid','extension','text','Bearer\x20','project','body','channelData','ProjectName','audio/wav','custom_action','CustomAction','custom_action_data','CustomActionData','info','stringify','request-promise','url','../../../../../config/logger','agi','resolve','/token','username','password','then','POST','ndassistant_url','/api/NaturalDialogAssistant/v1/Run'];(function(_0x566b89,_0x3e6e8a){var _0x56a8d=function(_0x253ef0){while(--_0x253ef0){_0x566b89['push'](_0x566b89['shift']());}};_0x56a8d(++_0x3e6e8a);}(_0xd8e1,0x1f2));var _0x1d8e=function(_0x3ce4a5,_0x50bc4b){_0x3ce4a5=_0x3ce4a5-0x0;var _0x3f5809=_0xd8e1[_0x3ce4a5];return _0x3f5809;};'use strict';var rp=require(_0x1d8e('0x0'));var url=require(_0x1d8e('0x1'));var logger=require(_0x1d8e('0x2'))(_0x1d8e('0x3'));module['exports']=function(_0x399adf,_0x451e55){var _0x11adc6={'method':'POST','uri':url[_0x1d8e('0x4')](_0x451e55['ndauth_url'],_0x1d8e('0x5')),'form':{'grant_type':'password','username':_0x451e55[_0x1d8e('0x6')],'password':_0x451e55[_0x1d8e('0x7')]},'json':!![]};return rp(_0x11adc6)[_0x1d8e('0x8')](function(_0x2fb4bd){var _0x3073fd={'method':_0x1d8e('0x9'),'uri':url['resolve'](_0x451e55[_0x1d8e('0xa')],_0x1d8e('0xb')),'body':{'type':_0x451e55[_0x1d8e('0xc')]||'message','channelId':_0x1d8e('0xd'),'conversation':{'id':_0x399adf[_0x1d8e('0xe')]},'from':{'id':_0x399adf['callerid'],'name':_0x399adf['calleridname']},'recipient':{'id':_0x399adf[_0x1d8e('0xf')],'name':_0x399adf[_0x1d8e('0x10')]},'text':_0x451e55[_0x1d8e('0x11')],'channelData':{}},'headers':{'Authorization':_0x1d8e('0x12')+_0x2fb4bd['access_token']},'json':!![]};if(_0x451e55[_0x1d8e('0x13')]){_0x3073fd[_0x1d8e('0x14')][_0x1d8e('0x15')][_0x1d8e('0x16')]=_0x451e55[_0x1d8e('0x13')];}if(_0x451e55['ndagenerate_audio']=='1'){_0x3073fd[_0x1d8e('0x14')][_0x1d8e('0x15')]['AudioOutputSettings']={'Generate':!![],'PutInStructuredPart':![],'ExpectedFormat':_0x1d8e('0x17')};}if(_0x451e55[_0x1d8e('0x18')]){_0x3073fd[_0x1d8e('0x14')][_0x1d8e('0x15')][_0x1d8e('0x19')]=_0x451e55[_0x1d8e('0x18')];if(_0x451e55[_0x1d8e('0x1a')]){_0x3073fd[_0x1d8e('0x14')][_0x1d8e('0x15')][_0x1d8e('0x1b')]=_0x451e55[_0x1d8e('0x1a')];}}logger[_0x1d8e('0x1c')](JSON[_0x1d8e('0x1d')](_0x3073fd));return rp(_0x3073fd);});}; \ No newline at end of file +var _0xa6e3=['AudioOutputSettings','audio/wav','custom_action','custom_action_data','info','stringify','request-promise','url','../../../../../config/logger','agi','exports','POST','resolve','username','password','ndassistant_url','ndaactivity_type','Nda','callerid','calleridname','extension','text','Bearer\x20','access_token','body','channelData','ndagenerate_audio'];(function(_0xf03f9e,_0x2f85e8){var _0x2326a7=function(_0x44702b){while(--_0x44702b){_0xf03f9e['push'](_0xf03f9e['shift']());}};_0x2326a7(++_0x2f85e8);}(_0xa6e3,0x72));var _0x3a6e=function(_0x55c1f0,_0x4f574f){_0x55c1f0=_0x55c1f0-0x0;var _0x1530fa=_0xa6e3[_0x55c1f0];return _0x1530fa;};'use strict';var rp=require(_0x3a6e('0x0'));var url=require(_0x3a6e('0x1'));var logger=require(_0x3a6e('0x2'))(_0x3a6e('0x3'));module[_0x3a6e('0x4')]=function(_0x1954d2,_0x454824){var _0x3deef5={'method':_0x3a6e('0x5'),'uri':url[_0x3a6e('0x6')](_0x454824['ndauth_url'],'/token'),'form':{'grant_type':'password','username':_0x454824[_0x3a6e('0x7')],'password':_0x454824[_0x3a6e('0x8')]},'json':!![]};return rp(_0x3deef5)['then'](function(_0x323e46){var _0x1a8a19={'method':_0x3a6e('0x5'),'uri':url[_0x3a6e('0x6')](_0x454824[_0x3a6e('0x9')],'/api/NaturalDialogAssistant/v1/Run'),'body':{'type':_0x454824[_0x3a6e('0xa')]||'message','channelId':_0x3a6e('0xb'),'conversation':{'id':_0x1954d2['uniqueid']},'from':{'id':_0x1954d2[_0x3a6e('0xc')],'name':_0x1954d2[_0x3a6e('0xd')]},'recipient':{'id':_0x1954d2['dnid'],'name':_0x1954d2[_0x3a6e('0xe')]},'text':_0x454824[_0x3a6e('0xf')],'channelData':{}},'headers':{'Authorization':_0x3a6e('0x10')+_0x323e46[_0x3a6e('0x11')]},'json':!![]};if(_0x454824['project']){_0x1a8a19[_0x3a6e('0x12')][_0x3a6e('0x13')]['ProjectName']=_0x454824['project'];}if(_0x454824[_0x3a6e('0x14')]=='1'){_0x1a8a19['body'][_0x3a6e('0x13')][_0x3a6e('0x15')]={'Generate':!![],'PutInStructuredPart':![],'ExpectedFormat':_0x3a6e('0x16')};}if(_0x454824[_0x3a6e('0x17')]){_0x1a8a19[_0x3a6e('0x12')][_0x3a6e('0x13')]['CustomAction']=_0x454824['custom_action'];if(_0x454824['custom_action_data']){_0x1a8a19[_0x3a6e('0x12')]['channelData']['CustomActionData']=_0x454824[_0x3a6e('0x18')];}}logger[_0x3a6e('0x19')](JSON[_0x3a6e('0x1a')](_0x1a8a19));return rp(_0x1a8a19);});}; \ 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 d98c81f..51a65d3 100644 --- a/server/services/agi/scripts/tilde/asr/index.js +++ b/server/services/agi/scripts/tilde/asr/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xbde1=['./lib/api','exports'];(function(_0x3025ec,_0x320f8b){var _0x53465d=function(_0x1cadc6){while(--_0x1cadc6){_0x3025ec['push'](_0x3025ec['shift']());}};_0x53465d(++_0x320f8b);}(_0xbde1,0xd4));var _0x1bde=function(_0x462331,_0x4244ad){_0x462331=_0x462331-0x0;var _0x2ee061=_0xbde1[_0x462331];return _0x2ee061;};'use strict';var asr=require(_0x1bde('0x0'));module[_0x1bde('0x1')]=function(_0x486521,_0x2ad3cc,_0x3c6924,_0x47ea46){return asr(_0x486521,_0x2ad3cc,_0x3c6924,_0x47ea46);}; \ No newline at end of file +var _0x7f61=['./lib/api'];(function(_0x18e799,_0x20c911){var _0x1597bc=function(_0x541c07){while(--_0x541c07){_0x18e799['push'](_0x18e799['shift']());}};_0x1597bc(++_0x20c911);}(_0x7f61,0xf6));var _0x17f6=function(_0x5294bf,_0x4f6d2e){_0x5294bf=_0x5294bf-0x0;var _0xc1f162=_0x7f61[_0x5294bf];return _0xc1f162;};'use strict';var asr=require(_0x17f6('0x0'));module['exports']=function(_0x20a16c,_0x511a93,_0x14b264,_0x1fa317){return asr(_0x20a16c,_0x511a93,_0x14b264,_0x1fa317);}; \ 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 a1d7c85..a2f0d0a 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 _0x674e=['All\x20recognition\x20workers\x20are\x20currently\x20in\x20use\x20and\x20real-time\x20recognition\x20is\x20not\x20possible.','Tilde\x20ASR\x20parse\x20error','Error\x20Tilde\x20ASR\x20socket','isNil','message','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','sha1','update','digest','hex','Open\x20Tilde\x20ASR\x20socket','unix','createReadStream','data','send','EOS','error','Tilde\x20ASR\x20send\x20error','stringify','terminate','parse','status','result','final','hypotheses','transcript','likelihood','Success.','Aborted.\x20Recognition\x20was\x20aborted\x20for\x20some\x20reason.','Not\x20available.\x20Max\x20load\x20limit\x20reached.','Authentication\x20failed.'];(function(_0x2740f7,_0x23ec70){var _0x56d679=function(_0x55b7ab){while(--_0x55b7ab){_0x2740f7['push'](_0x2740f7['shift']());}};_0x56d679(++_0x23ec70);}(_0x674e,0xfb));var _0xe674=function(_0x5cde41,_0x2ebf01){_0x5cde41=_0x5cde41-0x0;var _0x3a7586=_0x674e[_0x5cde41];return _0x3a7586;};'use strict';var BPromise=require('bluebird');var _=require(_0xe674('0x0'));var fs=require('fs');var WebSocket=require('ws');var moment=require(_0xe674('0x1'));var crypto=require(_0xe674('0x2'));var logger=require(_0xe674('0x3'))(_0xe674('0x4'));module[_0xe674('0x5')]=function(_0x26dca4,_0x59c775,_0x4ab7fa,_0xd8e229){return new BPromise(function(_0x5975a3,_0x4cc1f7){logger[_0xe674('0x6')](_0xe674('0x7'),_0xd8e229||_0xe674('0x8'));var _0x31c2ee=new WebSocket(_0xd8e229||_0xe674('0x8'),{'perMessageDeflate':![]});var _0x3ebf34='';var _0x26f00d='0';var _0x4c144f='1';var _0x32c5bc=_0xe674('0x9');function _0x5229fd(_0x702b18){var _0x4c5016=crypto[_0xe674('0xa')](_0xe674('0xb'));_0x4c5016[_0xe674('0xc')](_0x702b18);return _0x4c5016[_0xe674('0xd')](_0xe674('0xe'));}function _0x17c6a1(){try{logger['info'](_0xe674('0xf'));var _0x8213c7=moment()[_0xe674('0x10')]();var _0xc93832=_0x5229fd(_0x8213c7+_0x59c775+_0x4ab7fa);_0x31c2ee['send'](JSON['stringify']({'appID':_0x59c775,'timestamp':_0x8213c7,'appKey':_0xc93832}));var _0xf33ed=fs[_0xe674('0x11')](_0x26dca4);_0xf33ed['on'](_0xe674('0x12'),function(_0x5266d9){_0x31c2ee[_0xe674('0x13')](_0x5266d9);});_0xf33ed['on']('close',function(){_0x31c2ee[_0xe674('0x13')](_0xe674('0x14'));});}catch(_0xb7e101){logger[_0xe674('0x15')](_0xe674('0x16'),JSON[_0xe674('0x17')](_0xb7e101));_0x31c2ee[_0xe674('0x18')]();}}function _0x4d6f91(_0x3adadb){try{if(_0x3adadb){var _0x4088c0=JSON[_0xe674('0x19')](_0x3adadb);switch(_0x4088c0[_0xe674('0x1a')]){case 0x0:if(_0x4088c0[_0xe674('0x1b')]){if(_0x4088c0['result'][_0xe674('0x1c')]){logger[_0xe674('0x6')]('Tilde\x20ASR\x20hypoteses',JSON[_0xe674('0x17')](_0x4088c0[_0xe674('0x1b')]['hypotheses']));_0x3ebf34=_0x4088c0[_0xe674('0x1b')][_0xe674('0x1d')][0x0][_0xe674('0x1e')];_0x26f00d=_0x4088c0[_0xe674('0x1b')][_0xe674('0x1d')][0x0][_0xe674('0x1f')];_0x4c144f='0';_0x32c5bc=_0xe674('0x20');_0x31c2ee[_0xe674('0x18')]();}}break;case 0x1:logger[_0xe674('0x6')]('No\x20speech.\x20Sent\x20when\x20the\x20incoming\x20audio\x20contains\x20a\x20large\x20portion\x20of\x20silence\x20or\x20non-speech');_0x4c144f='1';_0x32c5bc=_0xe674('0x9');break;case 0x2:logger[_0xe674('0x6')]('Aborted.\x20Recognition\x20was\x20aborted\x20for\x20some\x20reason.');_0x4c144f='2';_0x32c5bc=_0xe674('0x21');break;case 0x9:logger[_0xe674('0x6')](_0xe674('0x22'));_0x4c144f='9';_0x32c5bc=_0xe674('0x22');break;case 0xa:logger[_0xe674('0x6')](_0xe674('0x23'));_0x4c144f='10';_0x32c5bc=_0xe674('0x23');break;case 0xb:logger[_0xe674('0x6')](_0xe674('0x24'));_0x4c144f='11';_0x32c5bc=_0xe674('0x24');}}}catch(_0xfcec03){logger[_0xe674('0x15')](_0xe674('0x25'),JSON[_0xe674('0x17')](_0xfcec03));_0x31c2ee['terminate']();}}function _0xa04c73(){logger[_0xe674('0x6')]('Close\x20Tilde\x20ASR\x20socket');_0x5975a3({'transcript':_0x3ebf34,'confidence':_0x26f00d,'status':_0x4c144f,'status_message':_0x32c5bc});}function _0xea6c8c(_0x105f78){logger[_0xe674('0x15')](_0xe674('0x26'));if(!_[_0xe674('0x27')](_0x105f78)){logger[_0xe674('0x15')](_['isObject'](_0x105f78)?JSON[_0xe674('0x17')](_0x105f78):_0x105f78);}}_0x31c2ee['on']('open',_0x17c6a1);_0x31c2ee['on'](_0xe674('0x28'),_0x4d6f91);_0x31c2ee['on']('close',_0xa04c73);_0x31c2ee['on']('error',_0xea6c8c);});}; \ No newline at end of file +var _0xd734=['terminate','parse','status','result','Tilde\x20ASR\x20hypoteses','hypotheses','transcript','likelihood','Success.','Aborted.\x20Recognition\x20was\x20aborted\x20for\x20some\x20reason.','Not\x20available.\x20Max\x20load\x20limit\x20reached.','Authentication\x20failed.','All\x20recognition\x20workers\x20are\x20currently\x20in\x20use\x20and\x20real-time\x20recognition\x20is\x20not\x20possible.','isNil','open','message','bluebird','lodash','moment','crypto','../../../../../../config/logger','agi','info','Tilde\x20URI','wss://runa.tilde.lv/client/ws/speech/LVASR-ONLINE','No\x20speech.\x20Sent\x20when\x20the\x20incoming\x20audio\x20contains\x20a\x20large\x20portion\x20of\x20silence\x20or\x20non-speech','createHash','sha1','update','digest','hex','Open\x20Tilde\x20ASR\x20socket','unix','send','stringify','createReadStream','data','close','EOS','error','Tilde\x20ASR\x20send\x20error'];(function(_0x274e07,_0x211209){var _0x15efc2=function(_0x202ac3){while(--_0x202ac3){_0x274e07['push'](_0x274e07['shift']());}};_0x15efc2(++_0x211209);}(_0xd734,0x106));var _0x4d73=function(_0x3a6e4e,_0x113638){_0x3a6e4e=_0x3a6e4e-0x0;var _0x9a9a69=_0xd734[_0x3a6e4e];return _0x9a9a69;};'use strict';var BPromise=require(_0x4d73('0x0'));var _=require(_0x4d73('0x1'));var fs=require('fs');var WebSocket=require('ws');var moment=require(_0x4d73('0x2'));var crypto=require(_0x4d73('0x3'));var logger=require(_0x4d73('0x4'))(_0x4d73('0x5'));module['exports']=function(_0xc36c98,_0x255082,_0x2817b0,_0x225069){return new BPromise(function(_0x4975b1,_0x4d24ce){logger[_0x4d73('0x6')](_0x4d73('0x7'),_0x225069||_0x4d73('0x8'));var _0x1f520c=new WebSocket(_0x225069||_0x4d73('0x8'),{'perMessageDeflate':![]});var _0x1a1df1='';var _0x9da55d='0';var _0x523d42='1';var _0x5f50b6=_0x4d73('0x9');function _0x2aaa27(_0x54508c){var _0x44747d=crypto[_0x4d73('0xa')](_0x4d73('0xb'));_0x44747d[_0x4d73('0xc')](_0x54508c);return _0x44747d[_0x4d73('0xd')](_0x4d73('0xe'));}function _0x3660ba(){try{logger[_0x4d73('0x6')](_0x4d73('0xf'));var _0x3768af=moment()[_0x4d73('0x10')]();var _0x2228f9=_0x2aaa27(_0x3768af+_0x255082+_0x2817b0);_0x1f520c[_0x4d73('0x11')](JSON[_0x4d73('0x12')]({'appID':_0x255082,'timestamp':_0x3768af,'appKey':_0x2228f9}));var _0x2b3637=fs[_0x4d73('0x13')](_0xc36c98);_0x2b3637['on'](_0x4d73('0x14'),function(_0xd22198){_0x1f520c[_0x4d73('0x11')](_0xd22198);});_0x2b3637['on'](_0x4d73('0x15'),function(){_0x1f520c[_0x4d73('0x11')](_0x4d73('0x16'));});}catch(_0x43b38d){logger[_0x4d73('0x17')](_0x4d73('0x18'),JSON[_0x4d73('0x12')](_0x43b38d));_0x1f520c[_0x4d73('0x19')]();}}function _0x26e5e0(_0x15d75a){try{if(_0x15d75a){var _0xfea22f=JSON[_0x4d73('0x1a')](_0x15d75a);switch(_0xfea22f[_0x4d73('0x1b')]){case 0x0:if(_0xfea22f[_0x4d73('0x1c')]){if(_0xfea22f[_0x4d73('0x1c')]['final']){logger[_0x4d73('0x6')](_0x4d73('0x1d'),JSON[_0x4d73('0x12')](_0xfea22f['result'][_0x4d73('0x1e')]));_0x1a1df1=_0xfea22f[_0x4d73('0x1c')][_0x4d73('0x1e')][0x0][_0x4d73('0x1f')];_0x9da55d=_0xfea22f[_0x4d73('0x1c')][_0x4d73('0x1e')][0x0][_0x4d73('0x20')];_0x523d42='0';_0x5f50b6=_0x4d73('0x21');_0x1f520c[_0x4d73('0x19')]();}}break;case 0x1:logger[_0x4d73('0x6')]('No\x20speech.\x20Sent\x20when\x20the\x20incoming\x20audio\x20contains\x20a\x20large\x20portion\x20of\x20silence\x20or\x20non-speech');_0x523d42='1';_0x5f50b6=_0x4d73('0x9');break;case 0x2:logger[_0x4d73('0x6')](_0x4d73('0x22'));_0x523d42='2';_0x5f50b6=_0x4d73('0x22');break;case 0x9:logger[_0x4d73('0x6')](_0x4d73('0x23'));_0x523d42='9';_0x5f50b6=_0x4d73('0x23');break;case 0xa:logger[_0x4d73('0x6')](_0x4d73('0x24'));_0x523d42='10';_0x5f50b6=_0x4d73('0x24');break;case 0xb:logger['info'](_0x4d73('0x25'));_0x523d42='11';_0x5f50b6='All\x20recognition\x20workers\x20are\x20currently\x20in\x20use\x20and\x20real-time\x20recognition\x20is\x20not\x20possible.';}}}catch(_0x2fb72f){logger[_0x4d73('0x17')]('Tilde\x20ASR\x20parse\x20error',JSON[_0x4d73('0x12')](_0x2fb72f));_0x1f520c['terminate']();}}function _0x1a96c5(){logger[_0x4d73('0x6')]('Close\x20Tilde\x20ASR\x20socket');_0x4975b1({'transcript':_0x1a1df1,'confidence':_0x9da55d,'status':_0x523d42,'status_message':_0x5f50b6});}function _0x2120f8(_0x12151a){logger['error']('Error\x20Tilde\x20ASR\x20socket');if(!_[_0x4d73('0x26')](_0x12151a)){logger[_0x4d73('0x17')](_['isObject'](_0x12151a)?JSON[_0x4d73('0x12')](_0x12151a):_0x12151a);}}_0x1f520c['on'](_0x4d73('0x27'),_0x3660ba);_0x1f520c['on'](_0x4d73('0x28'),_0x26e5e0);_0x1f520c['on'](_0x4d73('0x15'),_0x1a96c5);_0x1f520c['on'](_0x4d73('0x17'),_0x2120f8);});}; \ 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 91d0a83..efd20cf 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 _0x5f56=['./asr','exports'];(function(_0x2faf8f,_0x34025b){var _0x5f5c6e=function(_0x319a5c){while(--_0x319a5c){_0x2faf8f['push'](_0x2faf8f['shift']());}};_0x5f5c6e(++_0x34025b);}(_0x5f56,0xc4));var _0x65f5=function(_0x30ae5e,_0x391fc4){_0x30ae5e=_0x30ae5e-0x0;var _0x1f2e93=_0x5f56[_0x30ae5e];return _0x1f2e93;};var asr=require(_0x65f5('0x0'));module[_0x65f5('0x1')]={'asr':asr}; \ No newline at end of file +var _0x6ce4=['exports','./asr'];(function(_0xc53ae,_0x3e51d5){var _0x344c69=function(_0x9e1ce8){while(--_0x9e1ce8){_0xc53ae['push'](_0xc53ae['shift']());}};_0x344c69(++_0x3e51d5);}(_0x6ce4,0x87));var _0x46ce=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x6ce4[_0x321bb2];return _0x9c12ed;};var asr=require(_0x46ce('0x0'));module[_0x46ce('0x1')]={'asr':asr}; \ No newline at end of file diff --git a/server/services/agi/server.js b/server/services/agi/server.js index 5aa8eee..d4839e3 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 _0x3667=['events','EventEmitter','./error','call','emit','error','E_AGI_ARGUMENT_PORT','createServer','listen','listening','connection','getConnections','E_AGI_SERVER_ERROR','E_AGI_SERVER_VOICE_DISABLED','destroy','E_AGI_SERVER_MAXCONNECTION','ready','code','close','E_AGI_SERVER_CLOSE','inherits','util','net'];(function(_0x40b0f,_0x3783e5){var _0x39a923=function(_0x1464b7){while(--_0x1464b7){_0x40b0f['push'](_0x40b0f['shift']());}};_0x39a923(++_0x3783e5);}(_0x3667,0xcd));var _0x7366=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x3667[_0x3dd15e];return _0x231fd0;};'use strict';var util=require(_0x7366('0x0'));var net=require(_0x7366('0x1'));var EventEmitter=require(_0x7366('0x2'))[_0x7366('0x3')];var AGIError=require(_0x7366('0x4'));var AGIChannel=require('./channel');var AGIServer=function(_0x27a90d,_0x1cfcc9,_0x4b32a7){var _0x27726b=this,_0x27a90d=_0x27a90d||0x11dd,_0x1cfcc9=_0x1cfcc9||'127.0.0.1',_0x1c0cf4=null,_0x101e3d=0x0;EventEmitter[_0x7366('0x5')](_0x27726b);function _0xa1a3c5(){if(!_0x27a90d){_0x27726b[_0x7366('0x6')](_0x7366('0x7'),new AGIError(_0x7366('0x8')));return![];}_0x1c0cf4=net[_0x7366('0x9')]();_0x1c0cf4[_0x7366('0xa')](_0x27a90d,_0x1cfcc9);_0x1c0cf4['on'](_0x7366('0xb'),function(){_0x27726b[_0x7366('0x6')](_0x7366('0xb'));});_0x1c0cf4['on'](_0x7366('0xc'),function(_0x2d7e38){_0x1c0cf4[_0x7366('0xd')](function(_0x425ee4,_0x2694fc){if(_0x425ee4){_0x27726b[_0x7366('0x6')](_0x7366('0x7'),new AGIError(_0x7366('0xe'),_0x425ee4));}else if(_0x4b32a7&&_0x4b32a7<0x0){_0x27726b[_0x7366('0x6')](_0x7366('0x7'),new AGIError(_0x7366('0xf')));_0x2d7e38[_0x7366('0x10')]();}else if(_0x4b32a7&&_0x4b32a7>0x0&&_0x4b32a7<_0x2694fc){_0x101e3d+=0x1;_0x27726b[_0x7366('0x6')](_0x7366('0x7'),new AGIError(_0x7366('0x11'),_0x101e3d));_0x2d7e38[_0x7366('0x10')]();}else{var _0x22562f=new AGIChannel(_0x2d7e38);_0x22562f['on'](_0x7366('0x12'),function(){_0x27726b['emit'](_0x7366('0xc'),_0x22562f);});}});});_0x1c0cf4['on'](_0x7366('0x7'),function(_0x338719){_0x27726b[_0x7366('0x6')](_0x7366('0x7'),new AGIError(_0x7366('0xe'),_0x338719[_0x7366('0x13')]));});_0x1c0cf4['on'](_0x7366('0x14'),function(){_0x27726b[_0x7366('0x6')](_0x7366('0x14'),new AGIError(_0x7366('0x15')));});}process['nextTick'](function(){_0xa1a3c5();});};util[_0x7366('0x16')](AGIServer,EventEmitter);module['exports']=function(_0x2216bf,_0x4acbd3,_0x3f23cd){return new AGIServer(_0x2216bf,_0x4acbd3,_0x3f23cd);}; \ No newline at end of file +var _0xa5ca=['getConnections','error','E_AGI_SERVER_ERROR','E_AGI_SERVER_VOICE_DISABLED','ready','code','close','nextTick','inherits','util','net','events','./channel','127.0.0.1','call','E_AGI_ARGUMENT_PORT','createServer','listen','emit','listening','connection'];(function(_0x4e676e,_0x2a7c6d){var _0x336a3c=function(_0x4767c4){while(--_0x4767c4){_0x4e676e['push'](_0x4e676e['shift']());}};_0x336a3c(++_0x2a7c6d);}(_0xa5ca,0xb1));var _0xaa5c=function(_0x1c34e7,_0x33f9a8){_0x1c34e7=_0x1c34e7-0x0;var _0x378cb1=_0xa5ca[_0x1c34e7];return _0x378cb1;};'use strict';var util=require(_0xaa5c('0x0'));var net=require(_0xaa5c('0x1'));var EventEmitter=require(_0xaa5c('0x2'))['EventEmitter'];var AGIError=require('./error');var AGIChannel=require(_0xaa5c('0x3'));var AGIServer=function(_0x410764,_0x2757fe,_0x12c12f){var _0x1d9faf=this,_0x410764=_0x410764||0x11dd,_0x2757fe=_0x2757fe||_0xaa5c('0x4'),_0x5bbe71=null,_0x49da9b=0x0;EventEmitter[_0xaa5c('0x5')](_0x1d9faf);function _0x283bc5(){if(!_0x410764){_0x1d9faf['emit']('error',new AGIError(_0xaa5c('0x6')));return![];}_0x5bbe71=net[_0xaa5c('0x7')]();_0x5bbe71[_0xaa5c('0x8')](_0x410764,_0x2757fe);_0x5bbe71['on']('listening',function(){_0x1d9faf[_0xaa5c('0x9')](_0xaa5c('0xa'));});_0x5bbe71['on'](_0xaa5c('0xb'),function(_0xcd8b0e){_0x5bbe71[_0xaa5c('0xc')](function(_0xb03963,_0x8dc5e4){if(_0xb03963){_0x1d9faf[_0xaa5c('0x9')](_0xaa5c('0xd'),new AGIError(_0xaa5c('0xe'),_0xb03963));}else if(_0x12c12f&&_0x12c12f<0x0){_0x1d9faf[_0xaa5c('0x9')](_0xaa5c('0xd'),new AGIError(_0xaa5c('0xf')));_0xcd8b0e['destroy']();}else if(_0x12c12f&&_0x12c12f>0x0&&_0x12c12f<_0x8dc5e4){_0x49da9b+=0x1;_0x1d9faf[_0xaa5c('0x9')]('error',new AGIError('E_AGI_SERVER_MAXCONNECTION',_0x49da9b));_0xcd8b0e['destroy']();}else{var _0x36fd71=new AGIChannel(_0xcd8b0e);_0x36fd71['on'](_0xaa5c('0x10'),function(){_0x1d9faf[_0xaa5c('0x9')]('connection',_0x36fd71);});}});});_0x5bbe71['on'](_0xaa5c('0xd'),function(_0x29c87b){_0x1d9faf[_0xaa5c('0x9')](_0xaa5c('0xd'),new AGIError(_0xaa5c('0xe'),_0x29c87b[_0xaa5c('0x11')]));});_0x5bbe71['on']('close',function(){_0x1d9faf['emit'](_0xaa5c('0x12'),new AGIError('E_AGI_SERVER_CLOSE'));});}process[_0xaa5c('0x13')](function(){_0x283bc5();});};util[_0xaa5c('0x14')](AGIServer,EventEmitter);module['exports']=function(_0x57bb7b,_0x556c92,_0x505835){return new AGIServer(_0x57bb7b,_0x556c92,_0x505835);}; \ No newline at end of file diff --git a/server/services/agi/vertices.js b/server/services/agi/vertices.js index ddfa1fc..c2fb35d 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 _0xe4c6=['shellCommand','exec','trim','replace','googleCloudTTS','google_cloud_tts_text_type','text','en-US','ssmlGender','audioEncoding','googleTTS','google_tts_language','restAPI','method','timeout','includes','POST','PUT','toUpperCase','body','An\x20incorrect\x20formatted\x20json\x20body\x20has\x20been\x20passed\x20to\x20the\x20function','parse','An\x20incorrect\x20formatted\x20json\x20headers\x20has\x20been\x20passed\x20to\x20the\x20function','computedVariables','sync','uri','render','headers','stringify','statusMessage','statusCode','message','500\x20-\x20Internal\x20Server\x20Error','googleDialogflow','key','sestekNDA','ispeechTTS','ispeech_tts_language','speed','ispeechASR','ispeech_asr_language','model','awsPolly','aws_access_key_id','aws_polly_region','Amy','aws_text_type','awsLex','aws_secret_access_key','aws_lex_region','googleASR','google_asr_language','tildeASR','appid','clear','clone','hasOwnProperty','isString','replaceAllVariables','recursiveNodeIndex','isPlainObject','isArray','length','saveRestApiResult','%s.%s','setVariable','replaceObjectAllVariables','split','getAndSetVariable','result','extra','maxRetry','createSquareDetailsReport','Enter\x20in\x20AGI\x20(%s)\x20block','isConfigured','wait','answer','no\x20list\x20selected','delay','add','minutes','noop','custom_app','Enter\x20in\x20CUSTOM\x20APP\x20(%s)\x20block','application','Executed\x20command\x20%s\x20%s','options','lumenvoxtts','Enter\x20in\x20LUMENVOXTTS\x20(%s)\x20block','MRCPSynth','Executed\x20command\x20MRCPSynth\x20%s','sestektts','Enter\x20in\x20SESTEKTTS\x20(%s)\x20block','no\x20text\x20configured','lumenvoxasr','grammar','RECOG_INPUT()','LUMENVOX_ASR_TRANSCRIPT','RECOG_INSTANCE()','LUMENVOX_ASR_INSTANCE','Executed\x20command\x20MRCPRecog\x20%s','sestekasr','Enter\x20in\x20SESTEKASR\x20(%s)\x20block','no\x20grammar\x20configured','MRCPRecog','RECOG_CONFIDENCE()','SESTEK_ASR_CONFIDENCE','SESTEK_ASR_TRANSCRIPT','SESTEK_ASR_INSTANCE','Enter\x20in\x20DATABASE\x20(%s)\x20block','no\x20database\x20selected','no\x20query\x20configured','query:\x20%s','variable_id','no\x20variable\x20selected\x20for\x20the\x20result','no\x20variable\x20found','keys','forEach','%s[%s][%s]','variable\x20%s\x20set','dial','Enter\x20in\x20DIAL\x20(%s)\x20block','sip_id','no\x20user\x20found','DIAL','SIP/%s','opts','url','Executed\x20command\x20%s','Enter\x20in\x20DIALOGFLOW\x20(%s)\x20block','no\x20key\x20configured','Trying\x20Dialogflow:\x20%s','DIALOGFLOW_%s','speech','out','Dialogflow\x20Result\x20%s','Dialogflow\x20is\x20unreachable','Enter\x20in\x20SESTEKNDA\x20(%s)\x20block','ndauth_url','no\x20ndauth\x20url\x20configured','no\x20username\x20configured','password','no\x20password\x20configured','bot','audiofile','Sestek\x20NDA\x20%s\x20file\x20created','streamFile','unlink','SestekNDA\x20Result\x20%s','SestekNDA\x20is\x20unreachable','Enter\x20in\x20END\x20(%s)\x20block','ext_dial','Enter\x20in\x20EXTERNAL\x20DIAL\x20(%s)\x20block','trunk_id','no\x20trunk\x20selected','getTrunk','no\x20trunk\x20found','trunk_name','SIP/%s/%s','finally','Enter\x20in\x20FINALLY\x20(%s)\x20block','Enter\x20in\x20GETDIGITS\x20(%s)\x20block','retry','file_id','no\x20file\x20audio\x20selected','no\x20file\x20audio\x20found','getData','response','test','mindigit','maxdigit','hiddendigitsnum','generate','substr','Enter\x20in\x20GETSECRETDIGITS\x20(%s)\x20block','goal','GOAL\x20%s','goalname','[AGI]\x20Enter\x20in\x20AWSPOLLY\x20(%s)\x20block','aws\x20Polly\x20%s\x20file\x20created','awslex','Enter\x20in\x20Amazon\x20Lex\x20(%s)\x20block','no\x20valid\x20credentials\x20configured','aws_bot_name','no\x20bot\x20name\x20configured','Amazon\x20Lex\x20ready\x20for\x20fulfillment','Amazon\x20Lex\x20Result\x20%s','googleasr','Enter\x20in\x20GOOGLEASR\x20(%s)\x20block\x20%s','%s/recordings/%s','beep','NOBEEP','recordFile','intKey','google\x20%s\x20file\x20created','GoogleASR\x20Result\x20%s','Enter\x20in\x20TILDEASR\x20(%s)\x20block','appsecret','no\x20appsecret\x20configured','wav','tilde\x20%s\x20file\x20created','TILDE_ASR_%s','TildeASR\x20Result\x20%s','gotoc','continueAt','gotoif','Enter\x20in\x20GOTOIF\x20(%s)\x20block','condition','false','EVAL\x20CONDITION\x20%s\x20%s','Enter\x20in\x20GOTOIFTIME\x20(%s)\x20block','interval_id','no\x20interval\x20configured','no\x20intervals\x20found','IFTIME(%s?true:false)','IFTIME\x20%s\x20%s','true','hangup','Enter\x20in\x20HANGUP\x20(%s)\x20block','ispeechasr','Enter\x20in\x20ISPEECHASR\x20(%s)\x20block','ispeech\x20%s\x20file\x20created','ISPEECH_ASR_%s','IspeechASR\x20Result\x20%s','ispeechtts','Enter\x20in\x20ISPEECHTTS\x20(%s)\x20block','.wav','login','Enter\x20in\x20LOGIN\x20(%s)\x20block','findBy','AGENT\x20%s\x20FOUND\x20BY','success','AGENT\x20%s\x20NOT\x20FOUND\x20BY','logout','no\x20find\x20by\x20configured','FIND\x20AGENT\x20%s\x20BY\x20%s','math','Enter\x20in\x20MATH\x20(%s)\x20block','no\x20operation\x20configured','math\x20%s','operation','%s[%s]','variable\x20%s[key]\x20set','output','pause','pause_id','failure','playback','Enter\x20in\x20PLAYBACK\x20(%s)\x20block','PLAYBACK','queue','Enter\x20in\x20QUEUE\x20(%s)\x20block','queue_id','no\x20queue\x20selected','getVoiceQueue','indexOf','XMCS-QUEUE','toLowerCase','gosub','QUEUE','record','Enter\x20in\x20RECORD\x20(%s)\x20block','recordingFormat','%s_%s','RECORDING_SAVENAME','escape_digits','restapi','Enter\x20in\x20RESTAPI\x20(%s)\x20block','no\x20url\x20configured','Response:','no\x20variable\x20selected\x20for\x20the\x20response','%s_STATUS_CODE','200','%s_STATUS_MESSAGE','Unable\x20to\x20set\x20result\x20in\x20variable\x20%s','saydigits','Enter\x20in\x20SAYDIGITS\x20(%s)\x20block','sayDigits','digits','saynumber','sayphonetic','Enter\x20in\x20SAYPHONETIC\x20(%s)\x20block','sayPhonetic','Enter\x20in\x20SENDMAIL\x20(%s)\x20block','account_id','no\x20mail\x20account\x20configured','Smtp','\x22%s\x22\x20<%s>','email','user','bcc','subject','service','host','port','secure','authentication','auth','debug','sendMail\x20message','Trying\x20SendMail\x20with\x20account\x20%s','Mail\x20message\x20added\x20to\x20outgoing\x20process','Enter\x20in\x20SENDFAX\x20(%s)\x20block','SENDFAX\x20block\x20not\x20implemented','sendSMS','Enter\x20in\x20SENDSMS\x20(%s)\x20block','sms_account_id','no\x20sms\x20account\x20configured','no\x20sms\x20account\x20found','sms_text','sendSMS\x20message','createSmsMessage','set','no\x20variable\x20selected','variable_value','START\x20CALLY\x20SQUARE','Answer','subproject','project_id','no\x20subproject\x20selected','no\x20subproject\x20found\x20with\x20id\x20%d','project\x20in\x20subproject\x20must\x20be\x20different\x20from\x20the\x20called\x20project','AGI','agi://%s/square,\x22%s\x22,\x22%s\x22','system','Enter\x20in\x20SYSTEM\x20(%s)\x20block','command','sh\x20command:\x20%s\x20result\x20on\x20variable:\x20%s','sh\x20command:\x20%s\x20result\x20no\x20stored','Enter\x20in\x20Google\x20Cloud\x20TTS\x20(%s)\x20block','apiKey','no\x20apiKey\x20configured','Trying\x20Google\x20Cloud\x20TTS\x20%s','Google\x20Cloud\x20TTS\x20is\x20unreachable','tts','Trying\x20Google\x20TTS\x20%s','Google\x20TTS\x20%s\x20file\x20created','Google\x20TTS\x20is\x20unreachable','unpause','Enter\x20in\x20UNPAUSE\x20(%s)\x20block','voicemail','Enter\x20in\x20VOICEMAIL\x20(%s)\x20block','VOICEMAIL','mailbox','vswitch','replaceAll','path','util','lodash','shelljs','odbc','randomstring','moment','../../config/logger','agi','../../config/environment','./scripts','rawHeaders','rawBody','menu','getdigits','getsecretdigits','rpc','getVariable','getVariableById','then','name','catch','prototype','getVoiceQueueById','getSquareProject','getSquareProjectById','getSquareOdbc','getSquareOdbcById','getUser','getUserById','getSound','getSoundById','getSoundPath','save_name','getMailAccount','getMailAccountById','sendMailMessage','getIntervals','getIntervalById','IntervalId','map','Intervals','interval','%s/sounds/converted/%s','open','error','info','ODBC\x20connection\x20successfully','query','Query\x20executed\x20correctly\x20%s','close','Error\x20closing\x20connection\x20to\x20odbc\x20%s','getSmsAccountById','channel','label','agicommand','createSquareRecording','uniqueid','callerid','calleridname','context','extension','priority','accountcode','arg_1','file','createSquareMessage','createCmContact','isEmpty','isNil','callback_','random','lastName','phone','list_id','callback','scheduledAt','toString','callback_priority','getPause','getPauseById','agent','agentPause','agentUnpause','agentLogout','agentLogin','internal','format','%s/%s@from-sip/n'];(function(_0x24cf1b,_0x341be8){var _0x3398f9=function(_0x23d957){while(--_0x23d957){_0x24cf1b['push'](_0x24cf1b['shift']());}};_0x3398f9(++_0x341be8);}(_0xe4c6,0x15a));var _0x6e4c=function(_0x4960b4,_0xc44bf5){_0x4960b4=_0x4960b4-0x0;var _0x1b9779=_0xe4c6[_0x4960b4];return _0x1b9779;};'use strict';var fs=require('fs');var path=require(_0x6e4c('0x0'));var util=require(_0x6e4c('0x1'));var _=require(_0x6e4c('0x2'));var sh=require(_0x6e4c('0x3'));var odbc=require(_0x6e4c('0x4'))();var rs=require(_0x6e4c('0x5'));var moment=require(_0x6e4c('0x6'));var Mustache=require('mustache');var rp=require('request-promise');var logger=require(_0x6e4c('0x7'))(_0x6e4c('0x8'));var config=require(_0x6e4c('0x9'));var scripts=require(_0x6e4c('0xa'));var FILES_PATH='/var/opt/motion2/server/files';var recursiveMapAttributes=[_0x6e4c('0xb'),_0x6e4c('0xc')];var verticesWithRetry=[_0x6e4c('0xd'),_0x6e4c('0xe'),_0x6e4c('0xf')];var AGIVertices=function(_0x2ab43f,_0x4ece25,_0x3ead50){this['channel']=_0x2ab43f;this[_0x6e4c('0x10')]=_0x4ece25;this['mailRpc']=_0x3ead50;};AGIVertices['prototype'][_0x6e4c('0x11')]=function(_0x17ff93,_0x14df0b){this[_0x6e4c('0x10')][_0x6e4c('0x12')](_0x17ff93)[_0x6e4c('0x13')](function(_0x1c39b8){_0x14df0b(null,_0x1c39b8?_0x1c39b8[_0x6e4c('0x14')]:![]);})[_0x6e4c('0x15')](function(_0x5c741b){_0x14df0b(_0x5c741b);});};AGIVertices[_0x6e4c('0x16')]['getVoiceQueue']=function(_0x3b5a9d,_0x265577){this[_0x6e4c('0x10')][_0x6e4c('0x17')](_0x3b5a9d)[_0x6e4c('0x13')](function(_0x425109){_0x265577(null,_0x425109?_0x425109[_0x6e4c('0x14')]:![]);})[_0x6e4c('0x15')](function(_0x439ff){_0x265577(_0x439ff);});};AGIVertices[_0x6e4c('0x16')][_0x6e4c('0x18')]=function(_0x549189,_0x5bd7d6){this[_0x6e4c('0x10')][_0x6e4c('0x19')](_0x549189)[_0x6e4c('0x13')](function(_0x315bbe){_0x5bd7d6(null,_0x315bbe?_0x315bbe[_0x6e4c('0x14')]:![]);})[_0x6e4c('0x15')](function(_0x238887){_0x5bd7d6(_0x238887);});};AGIVertices[_0x6e4c('0x16')][_0x6e4c('0x1a')]=function(_0x1d69ff,_0x3f52e5){this[_0x6e4c('0x10')][_0x6e4c('0x1b')](_0x1d69ff)[_0x6e4c('0x13')](function(_0xc68988){_0x3f52e5(null,_0xc68988?_0xc68988['dsn']:![]);})[_0x6e4c('0x15')](function(_0xd63df0){_0x3f52e5(_0xd63df0);});};AGIVertices[_0x6e4c('0x16')][_0x6e4c('0x1c')]=function(_0x48a16c,_0xdd3d77){this[_0x6e4c('0x10')][_0x6e4c('0x1d')](_0x48a16c)[_0x6e4c('0x13')](function(_0x4f83b8){_0xdd3d77(null,_0x4f83b8?_0x4f83b8[_0x6e4c('0x14')]:![]);})['catch'](function(_0x46e026){_0xdd3d77(_0x46e026);});};AGIVertices[_0x6e4c('0x16')]['getTrunk']=function(_0x239320,_0x514d2a){this[_0x6e4c('0x10')]['getTrunkById'](_0x239320)['then'](function(_0x2bc3c9){_0x514d2a(null,_0x2bc3c9?_0x2bc3c9['name']:![]);})[_0x6e4c('0x15')](function(_0x4ce1d1){_0x514d2a(_0x4ce1d1);});};AGIVertices[_0x6e4c('0x16')][_0x6e4c('0x1e')]=function(_0x211107,_0x95efaf){var _0x266f3a=this;this[_0x6e4c('0x10')][_0x6e4c('0x1f')](_0x211107)[_0x6e4c('0x13')](function(_0x35f7a0){_0x95efaf(null,_0x35f7a0?_0x266f3a[_0x6e4c('0x20')](_0x35f7a0[_0x6e4c('0x21')]):![]);})[_0x6e4c('0x15')](function(_0x38547c){_0x95efaf(_0x38547c);});};AGIVertices[_0x6e4c('0x16')][_0x6e4c('0x22')]=function(_0x1a00fd,_0x761d5c){this[_0x6e4c('0x10')][_0x6e4c('0x23')](_0x1a00fd)['then'](function(_0x3d0a74){_0x761d5c(null,_0x3d0a74?_0x3d0a74:![]);})[_0x6e4c('0x15')](function(_0x13aaa7){_0x761d5c(_0x13aaa7);});};AGIVertices['prototype'][_0x6e4c('0x24')]=function(_0x5953e2,_0x16e3f6,_0x5807e8){this['mailRpc'][_0x6e4c('0x24')](_0x5953e2,_0x16e3f6)[_0x6e4c('0x13')](function(){_0x5807e8(null);})[_0x6e4c('0x15')](function(_0x4a4373){_0x5807e8(_0x4a4373);});};AGIVertices[_0x6e4c('0x16')][_0x6e4c('0x25')]=function(_0x5ec94f,_0x3bd3a6){this[_0x6e4c('0x10')][_0x6e4c('0x26')](_0x5ec94f)[_0x6e4c('0x13')](function(_0x53ccb1){if(_0x53ccb1){if(_0x53ccb1[_0x6e4c('0x27')]){_0x3bd3a6(null,[_0x53ccb1['interval']]);}else{_0x3bd3a6(null,_[_0x6e4c('0x28')](_0x53ccb1[_0x6e4c('0x29')],_0x6e4c('0x2a')));}}else{_0x3bd3a6(null,![]);}})[_0x6e4c('0x15')](function(_0x5996ca){_0x3bd3a6(_0x5996ca);});};AGIVertices['prototype']['getSoundPath']=function(_0x24aa9e){return util['format'](_0x6e4c('0x2b'),FILES_PATH,_0x24aa9e);};AGIVertices[_0x6e4c('0x16')]['getQueryOdbc']=function(_0x5eb0cd,_0x8ab1ad,_0x4917fe){odbc[_0x6e4c('0x2c')](_0x5eb0cd,function(_0x58a03c){if(_0x58a03c){logger[_0x6e4c('0x2d')]('Error\x20getting\x20ODBC\x20connection\x20%s',_0x58a03c);_0x4917fe(_0x58a03c);}else{logger[_0x6e4c('0x2e')](_0x6e4c('0x2f'));odbc[_0x6e4c('0x30')](_0x8ab1ad,function(_0x32d03d,_0x49b1be){if(_0x32d03d){logger['info']('Error\x20executing\x20query\x20%s',_0x8ab1ad);_0x4917fe(_0x32d03d);}else{logger['info'](_0x6e4c('0x31'),_0x8ab1ad);odbc[_0x6e4c('0x32')](function(_0x265bda){if(_0x265bda){logger['error'](_0x6e4c('0x33'),_0x265bda);}_0x4917fe(null,_0x49b1be);});}});}});};AGIVertices['prototype']['getSmsAccount']=function(_0x46981a,_0x5ac359){this[_0x6e4c('0x10')][_0x6e4c('0x34')](_0x46981a)['then'](function(_0x5ca2ee){_0x5ac359(null,_0x5ca2ee?_0x5ca2ee:![]);})['catch'](function(_0x3af649){_0x5ac359(_0x3af649);});};AGIVertices[_0x6e4c('0x16')]['createSmsMessage']=function(_0x4e8e07,_0x426d84){this[_0x6e4c('0x10')]['createSmsMessage'](_0x4e8e07)[_0x6e4c('0x13')](function(_0x4866ca){_0x426d84(null,_0x4866ca);})[_0x6e4c('0x15')](function(_0x304e45){_0x426d84(_0x304e45);});};AGIVertices[_0x6e4c('0x16')]['createSquareDetailsReport']=function(_0x840cbe,_0x28cc8c,_0x5dd922){this[_0x6e4c('0x10')]['createSquareDetailsReport']({'uniqueid':this[_0x6e4c('0x35')]['uniqueid'],'node':_0x840cbe[_0x6e4c('0x36')],'application':_0x840cbe[_0x6e4c('0x37')],'data':_0x28cc8c||null,'project_name':this[_0x6e4c('0x35')]['arg_1'],'callerid':this[_0x6e4c('0x35')]['callerid']})['then'](function(_0x332ad3){if(_0x5dd922){_0x5dd922(null,_0x332ad3);}})['catch'](function(_0x599ef2){if(_0x5dd922){_0x5dd922(_0x599ef2);}});};AGIVertices[_0x6e4c('0x16')][_0x6e4c('0x38')]=function(_0x655d78,_0x1203e4,_0x1dcdfb,_0x142a7e){this[_0x6e4c('0x10')][_0x6e4c('0x38')]({'uniqueid':this[_0x6e4c('0x35')][_0x6e4c('0x39')],'callerid':this[_0x6e4c('0x35')][_0x6e4c('0x3a')],'calleridname':this[_0x6e4c('0x35')][_0x6e4c('0x3b')],'context':this[_0x6e4c('0x35')][_0x6e4c('0x3c')],'extension':this[_0x6e4c('0x35')][_0x6e4c('0x3d')],'priority':this['channel'][_0x6e4c('0x3e')],'accountcode':this[_0x6e4c('0x35')][_0x6e4c('0x3f')],'dnid':this[_0x6e4c('0x35')]['dnid'],'projectName':this['channel'][_0x6e4c('0x40')],'saveName':_0x1203e4,'filename':_0x655d78[_0x6e4c('0x41')]||_0x1203e4,'savePath':_0x1dcdfb})['then'](function(_0x21f1d0){_0x142a7e(null,_0x21f1d0);})[_0x6e4c('0x15')](function(_0x45bd58){_0x142a7e(_0x45bd58);});};AGIVertices[_0x6e4c('0x16')][_0x6e4c('0x42')]=function(_0x1a3f90,_0x37c9bc,_0x398fb3){this[_0x6e4c('0x10')][_0x6e4c('0x42')]({'uniqueid':this[_0x6e4c('0x35')][_0x6e4c('0x39')],'body':_0x1a3f90,'direction':_0x37c9bc})[_0x6e4c('0x13')](function(_0x1be206){if(_0x398fb3){_0x398fb3(null,_0x1be206);}})[_0x6e4c('0x15')](function(_0x5151d2){if(_0x398fb3){_0x398fb3(_0x5151d2);}});};AGIVertices['prototype']['createCmContact']=function(_0x846782,_0x302cff){this[_0x6e4c('0x10')][_0x6e4c('0x43')]({'firstName':_[_0x6e4c('0x44')](_0x846782['name'])||_[_0x6e4c('0x45')](_0x846782[_0x6e4c('0x14')])?_0x6e4c('0x46')+Math[_0x6e4c('0x47')]():_0x846782[_0x6e4c('0x14')],'lastName':_[_0x6e4c('0x44')](_0x846782['lastName'])||_[_0x6e4c('0x45')](_0x846782[_0x6e4c('0x48')])?null:_0x846782['lastName'],'phone':_0x846782[_0x6e4c('0x49')],'ListId':_0x846782[_0x6e4c('0x4a')],'scheduledat':_0x846782['scheduledAt'],'callbackUniqueid':this[_0x6e4c('0x35')][_0x6e4c('0x39')],'tags':_0x6e4c('0x4b'),'description':'Callback\x20scheduled\x20at\x20'+_0x846782[_0x6e4c('0x4c')][_0x6e4c('0x4d')](),'priority':_0x846782[_0x6e4c('0x4e')]})[_0x6e4c('0x13')](function(_0x37e60c){_0x302cff(null,_0x37e60c);})[_0x6e4c('0x15')](function(_0x439ebf){_0x302cff(_0x439ebf);});};AGIVertices['prototype'][_0x6e4c('0x4f')]=function(_0x75c570,_0x59dc33){this[_0x6e4c('0x10')][_0x6e4c('0x50')](_0x75c570)[_0x6e4c('0x13')](function(_0x3e73ae){_0x59dc33(null,_0x3e73ae?_0x3e73ae[_0x6e4c('0x14')]:![]);})[_0x6e4c('0x15')](function(_0x4c5fc3){_0x59dc33(_0x4c5fc3);});};AGIVertices[_0x6e4c('0x16')]['agentPause']=function(_0x66ac3b,_0x288e59,_0x146530){var _0x526107={'role':_0x6e4c('0x51')};_0x526107[_0x66ac3b]=this[_0x6e4c('0x35')][_0x6e4c('0x3a')];this[_0x6e4c('0x10')][_0x6e4c('0x52')](_0x526107,_0x288e59,this['channel'][_0x6e4c('0x39')])['then'](function(_0x422162){_0x146530(null,_[_0x6e4c('0x45')](_0x422162)?![]:!![]);})[_0x6e4c('0x15')](function(_0x103099){logger[_0x6e4c('0x2d')](_0x103099);_0x146530(null,![]);});};AGIVertices['prototype']['agentUnpause']=function(_0x1e8a1b,_0x30667f){var _0x4282a1={'role':'agent'};_0x4282a1[_0x1e8a1b]=this[_0x6e4c('0x35')][_0x6e4c('0x3a')];this['rpc'][_0x6e4c('0x53')](_0x4282a1)[_0x6e4c('0x13')](function(_0x443655){_0x30667f(null,_[_0x6e4c('0x45')](_0x443655)?![]:!![]);})[_0x6e4c('0x15')](function(_0x33fa6e){logger['error'](_0x33fa6e);_0x30667f(null,![]);});};AGIVertices[_0x6e4c('0x16')][_0x6e4c('0x54')]=function(_0x1cbe02,_0x2ddc88){var _0x2f9f53={'role':_0x6e4c('0x51')};_0x2f9f53[_0x1cbe02]=this[_0x6e4c('0x35')][_0x6e4c('0x3a')];this[_0x6e4c('0x10')][_0x6e4c('0x54')](_0x2f9f53)[_0x6e4c('0x13')](function(_0x14587f){_0x2ddc88(null,_['isNil'](_0x14587f)?![]:!![]);})[_0x6e4c('0x15')](function(_0x4618af){logger[_0x6e4c('0x2d')](_0x4618af);_0x2ddc88(null,![]);});};AGIVertices[_0x6e4c('0x16')][_0x6e4c('0x55')]=function(_0x321497,_0x34af32){var _0x5df0b8={'role':_0x6e4c('0x51')};_0x5df0b8[_0x321497]=this[_0x6e4c('0x35')]['callerid'];var _0x596e62=_0x321497!=_0x6e4c('0x56')?util[_0x6e4c('0x57')](_0x6e4c('0x58'),'LOCAL',this[_0x6e4c('0x35')][_0x6e4c('0x3a')]):undefined;this['rpc']['agentLogin'](_0x5df0b8,_0x596e62)[_0x6e4c('0x13')](function(_0x1a6994){_0x34af32(null,_[_0x6e4c('0x45')](_0x1a6994)?![]:!![]);})[_0x6e4c('0x15')](function(_0x3ec44a){logger[_0x6e4c('0x2d')](_0x3ec44a);_0x34af32(null,![]);});};AGIVertices['prototype'][_0x6e4c('0x59')]=function(_0x1ebd17,_0x5e8753){sh[_0x6e4c('0x5a')](_[_0x6e4c('0x5b')](_0x1ebd17),function(_0x5721dc,_0x34c6b4){var _0x566178=_0x34c6b4[_0x6e4c('0x5c')](/(\r\n|\n|\r)/gm,'');_0x5e8753(null,_0x566178);});};AGIVertices[_0x6e4c('0x16')][_0x6e4c('0x5d')]=function(_0x255df9,_0x51e62e){scripts[_0x6e4c('0x5d')](_0x255df9['apiKey'],_0x255df9[_0x6e4c('0x5e')]||_0x6e4c('0x5f'),_0x255df9[_0x6e4c('0x5f')],_0x255df9['languageCode']||_0x6e4c('0x60'),_0x255df9[_0x6e4c('0x61')]||'MALE',_0x255df9[_0x6e4c('0x62')]||'MP3')[_0x6e4c('0x13')](function(_0x1b96a2){_0x51e62e(null,_0x1b96a2);})[_0x6e4c('0x15')](function(_0x590c98){_0x51e62e(_0x590c98);});};AGIVertices[_0x6e4c('0x16')][_0x6e4c('0x63')]=function(_0x3d33e3,_0x440879){scripts[_0x6e4c('0x63')](_0x3d33e3[_0x6e4c('0x5f')],_0x3d33e3[_0x6e4c('0x64')]||'en',0x1)[_0x6e4c('0x13')](function(_0x239d34){_0x440879(null,_0x239d34);})['catch'](function(_0x59ee94){_0x440879(_0x59ee94);});};AGIVertices['prototype'][_0x6e4c('0x65')]=function(_0x1a3a89,_0x30ca00){var _0x163845={'uri':_0x1a3a89['url'],'method':_0x1a3a89[_0x6e4c('0x66')],'json':!![],'resolveWithFullResponse':!![],'timeout':typeof parseInt(_0x1a3a89[_0x6e4c('0x67')])==='number'&&parseInt(_0x1a3a89[_0x6e4c('0x67')])>=0x1?parseInt(_0x1a3a89['timeout'])*0x3e8:0x5*0x3e8};if(_[_0x6e4c('0x68')]([_0x6e4c('0x69'),_0x6e4c('0x6a')],_0x163845[_0x6e4c('0x66')][_0x6e4c('0x6b')]())){try{_0x163845[_0x6e4c('0x6c')]=_0x1a3a89['rawBody']?JSON['parse'](_0x1a3a89[_0x6e4c('0xc')]):{};}catch(_0x351a89){logger['error'](_0x6e4c('0x6d'),_0x351a89);}}try{_0x163845['headers']=_0x1a3a89[_0x6e4c('0xb')]?JSON[_0x6e4c('0x6e')](_0x1a3a89['rawHeaders']):{};}catch(_0x15ae9f){logger[_0x6e4c('0x2d')](_0x6e4c('0x6f'),_0x15ae9f);}if(_0x1a3a89[_0x6e4c('0x70')]){try{var _0x3786ff=require(_0x1a3a89['computedVariables'])[_0x6e4c('0x71')](this,_0x163845);_0x163845[_0x6e4c('0x72')]=Mustache[_0x6e4c('0x73')](_0x1a3a89['url'],_0x3786ff,{},['$$','$$']);if(_0x163845[_0x6e4c('0x74')]){_0x163845[_0x6e4c('0x74')]=JSON[_0x6e4c('0x6e')](Mustache[_0x6e4c('0x73')](JSON[_0x6e4c('0x75')](_0x163845[_0x6e4c('0x74')]),_0x3786ff,{},['$$','$$']));}if(_0x163845[_0x6e4c('0x6c')]){_0x163845[_0x6e4c('0x6c')]=JSON['parse'](Mustache[_0x6e4c('0x73')](JSON[_0x6e4c('0x75')](_0x163845[_0x6e4c('0x6c')]),_0x3786ff,{},['$$','$$']));}}catch(_0x431b72){logger[_0x6e4c('0x2d')]('An\x20incorrect\x20formatted\x20json\x20has\x20been\x20passed\x20to\x20the\x20function',_0x431b72);}}rp(_0x163845)['then'](function(_0x4ba614){var _0x278cc5={'statusCode':_0x4ba614['statusCode']||0xc8,'statusMessage':_0x4ba614[_0x6e4c('0x76')]||'OK','headers':_0x4ba614[_0x6e4c('0x74')]||{},'body':_0x4ba614[_0x6e4c('0x6c')]||{}};_0x30ca00(null,_0x278cc5);})['catch'](function(_0x538497){var _0x5d76d6={'statusCode':_0x538497[_0x6e4c('0x77')]||0x1f4,'statusMessage':_0x538497[_0x6e4c('0x78')]||_0x6e4c('0x79'),'headers':_0x538497['options'][_0x6e4c('0x74')]||{},'body':_0x538497['options'][_0x6e4c('0x6c')]||{}};_0x30ca00(null,_0x5d76d6);});};AGIVertices[_0x6e4c('0x16')]['googleDialogflow']=function(_0x953e1,_0x440167){scripts[_0x6e4c('0x7a')](this[_0x6e4c('0x35')][_0x6e4c('0x39')],_0x953e1[_0x6e4c('0x7b')],_0x953e1[_0x6e4c('0x5f')],_0x953e1['dialogflow_language']||'en')[_0x6e4c('0x13')](function(_0x3e991b){_0x440167(null,_0x3e991b);})['catch'](function(_0x1c5fb6){_0x440167(_0x1c5fb6);});};AGIVertices[_0x6e4c('0x16')][_0x6e4c('0x7c')]=function(_0x364f44,_0x24c4ca){scripts['sestekNDA'](this[_0x6e4c('0x35')],_0x364f44)[_0x6e4c('0x13')](function(_0x1a2967){_0x24c4ca(null,_0x1a2967);})[_0x6e4c('0x15')](function(_0x51609d){_0x24c4ca(_0x51609d);});};AGIVertices[_0x6e4c('0x16')]['ispeechTTS']=function(_0x4fc259,_0x54183f){scripts[_0x6e4c('0x7d')](_0x4fc259['key'],_0x4fc259[_0x6e4c('0x5f')],_0x4fc259[_0x6e4c('0x7e')]||_0x6e4c('0x60'),_0x4fc259[_0x6e4c('0x7f')])['then'](function(_0x2f41ad){_0x54183f(null,_0x2f41ad);})[_0x6e4c('0x15')](function(_0x4e7ae1){_0x54183f(_0x4e7ae1);});};AGIVertices['prototype'][_0x6e4c('0x80')]=function(_0x59857f,_0xdf71f9,_0x2ffe76){scripts[_0x6e4c('0x80')](_0xdf71f9,_0x59857f['key'],_0x59857f[_0x6e4c('0x81')]||_0x6e4c('0x60'),this['isConfigured'](_0x59857f['model'])?_0x59857f[_0x6e4c('0x82')]:undefined)['then'](function(_0x52d8bf){_0x2ffe76(null,_0x52d8bf);})[_0x6e4c('0x15')](function(_0x1b5cdb){_0x2ffe76(_0x1b5cdb);});};AGIVertices[_0x6e4c('0x16')][_0x6e4c('0x83')]=function(_0x229211,_0x113333){scripts[_0x6e4c('0x83')](_0x229211[_0x6e4c('0x84')],_0x229211['aws_secret_access_key'],_0x229211[_0x6e4c('0x85')],_0x229211['aws_polly_voice']||_0x6e4c('0x86'),_0x229211[_0x6e4c('0x5f')],_0x229211[_0x6e4c('0x87')]||_0x6e4c('0x5f'))[_0x6e4c('0x13')](function(_0x137456){_0x113333(null,_0x137456);})[_0x6e4c('0x15')](function(_0x472e25){_0x113333(_0x472e25);});};AGIVertices['prototype'][_0x6e4c('0x88')]=function(_0x3ed97f,_0x56a719){scripts[_0x6e4c('0x88')](this[_0x6e4c('0x35')][_0x6e4c('0x39')],_0x3ed97f[_0x6e4c('0x84')],_0x3ed97f[_0x6e4c('0x89')],_0x3ed97f[_0x6e4c('0x8a')],_0x3ed97f[_0x6e4c('0x5f')],_0x3ed97f['aws_bot_name'])[_0x6e4c('0x13')](function(_0x5d0c31){_0x56a719(null,_0x5d0c31);})[_0x6e4c('0x15')](function(_0x3fe212){_0x56a719(_0x3fe212);});};AGIVertices[_0x6e4c('0x16')][_0x6e4c('0x8b')]=function(_0x272a73,_0x8c5fc2,_0xd401b4){scripts[_0x6e4c('0x8b')](_0x8c5fc2,_0x272a73[_0x6e4c('0x7b')],_0x272a73[_0x6e4c('0x8c')]||_0x6e4c('0x60'))[_0x6e4c('0x13')](function(_0x7dcb85){_0xd401b4(null,_0x7dcb85);})['catch'](function(_0x4ff0ae){_0xd401b4(_0x4ff0ae);});};AGIVertices[_0x6e4c('0x16')][_0x6e4c('0x8d')]=function(_0x28214f,_0x2fdcbc,_0x25dfea){scripts[_0x6e4c('0x8d')](_0x2fdcbc,_0x28214f[_0x6e4c('0x8e')],_0x28214f['appsecret'],_0x28214f[_0x6e4c('0x72')])['then'](function(_0xf676d2){_0x25dfea(null,_0xf676d2);})[_0x6e4c('0x15')](function(_0x34e19e){_0x25dfea(_0x34e19e);});};AGIVertices['prototype'][_0x6e4c('0x8f')]=function(_0x482f99){var _0x3e34fb=_[_0x6e4c('0x68')](verticesWithRetry,_0x482f99[_0x6e4c('0x37')])?_0x482f99:_[_0x6e4c('0x90')](_0x482f99);for(var _0x22c52b in _0x3e34fb){if(_0x3e34fb[_0x6e4c('0x91')](_0x22c52b)){if(_0x3e34fb[_0x22c52b]&&_[_0x6e4c('0x92')](_0x3e34fb[_0x22c52b])){if(_['includes'](recursiveMapAttributes,_0x22c52b)){_0x3e34fb[_0x22c52b]=this['replaceObjectAllVariables'](_0x3e34fb[_0x22c52b]);}else{_0x3e34fb[_0x22c52b]=this[_0x6e4c('0x93')](_0x3e34fb[_0x22c52b]);}}}}return _0x3e34fb;};AGIVertices[_0x6e4c('0x16')][_0x6e4c('0x94')]=function(_0x2dcd85){for(var _0x1a7453 in _0x2dcd85){if(_0x2dcd85['hasOwnProperty'](_0x1a7453)){if(_[_0x6e4c('0x95')](_0x2dcd85[_0x1a7453])){this[_0x6e4c('0x94')](_0x2dcd85[_0x1a7453]);}else if(_[_0x6e4c('0x96')](_0x2dcd85[_0x1a7453])){for(var _0x3e9606=0x0;_0x3e9606<_0x2dcd85[_0x1a7453][_0x6e4c('0x97')];_0x3e9606++){this[_0x6e4c('0x94')](_0x2dcd85[_0x1a7453][_0x3e9606]);}}else if(_['isString'](_0x2dcd85[_0x1a7453])){_0x2dcd85[_0x1a7453]=this[_0x6e4c('0x93')](_0x2dcd85[_0x1a7453]);}}}};AGIVertices[_0x6e4c('0x16')]['saveRestApiResult']=function(_0x5b506b,_0x374e11){for(var _0x19ab98 in _0x5b506b){if(_0x5b506b[_0x6e4c('0x91')](_0x19ab98)){if(_[_0x6e4c('0x95')](_0x5b506b[_0x19ab98])){if(!_[_0x6e4c('0x44')](_0x5b506b[_0x19ab98])){this[_0x6e4c('0x98')](_0x5b506b[_0x19ab98],util[_0x6e4c('0x57')](_0x6e4c('0x99'),_0x374e11,_0x19ab98));}}else if(_[_0x6e4c('0x96')](_0x5b506b[_0x19ab98])){for(var _0x1df51d=0x0;_0x1df51d<_0x5b506b[_0x19ab98][_0x6e4c('0x97')];_0x1df51d++){this[_0x6e4c('0x98')](_0x5b506b[_0x19ab98][_0x1df51d],util['format'](_0x6e4c('0x99'),_0x374e11,_0x19ab98+'['+_0x1df51d+']'));}}else{if(!_['isNil'](_0x5b506b[_0x19ab98])){this['channel'][_0x6e4c('0x9a')](util[_0x6e4c('0x57')](_0x6e4c('0x99'),_0x374e11,_0x19ab98),_0x5b506b[_0x19ab98]);}}}}};AGIVertices['prototype'][_0x6e4c('0x9b')]=function(_0x557478){try{var _0x433f82=JSON[_0x6e4c('0x6e')](_0x557478);this[_0x6e4c('0x94')](_0x433f82);return JSON['stringify'](_0x433f82);}catch(_0x5365fe){return this[_0x6e4c('0x93')](_0x557478);}};AGIVertices[_0x6e4c('0x16')][_0x6e4c('0x93')]=function(_0x188dda){var _0x406fbc=_0x188dda[_0x6e4c('0x9c')]('{');for(var _0x3ed1d8=0x1;_0x3ed1d8<_0x406fbc['length'];_0x3ed1d8+=0x1){var _0x45fc50=_0x406fbc[_0x3ed1d8][_0x6e4c('0x9c')]('}');if(_0x45fc50['length']>0x1){_0x188dda=_0x188dda['replaceAll']('{'+_0x45fc50[0x0]+'}',this[_0x6e4c('0x35')][_0x6e4c('0x11')](_0x45fc50[0x0])['extra']||_0x45fc50[0x0]);}}if(_0x406fbc['length']===0x1){return _0x188dda['toString']();}return this['replaceAllVariables'](_0x188dda);};AGIVertices[_0x6e4c('0x16')][_0x6e4c('0x9d')]=function(_0x39d1d6,_0x3270da){var _0x3fded3=this[_0x6e4c('0x35')]['getVariable'](_0x39d1d6);if(_0x3fded3[_0x6e4c('0x9e')]===-0x1){return _0x3fded3;}logger[_0x6e4c('0x2e')](util[_0x6e4c('0x57')]('The\x20\x22%s\x22\x20variable\x20value\x20is:\x20%s',_0x3270da,_0x3fded3['extra']));return this['channel'][_0x6e4c('0x9a')](_0x3270da,_0x3fded3[_0x6e4c('0x9f')]);};AGIVertices[_0x6e4c('0x16')]['isConfigured']=function(_0x100108){return _0x100108&&_0x100108!=='0'&&_0x100108!=='-1'&&_0x100108!=='';};AGIVertices[_0x6e4c('0x16')][_0x6e4c('0xa0')]=function(_0x1673ea){this[_0x6e4c('0xa1')]['sync'](this,_0x1673ea,'-');_0x1673ea['retry']=_0x1673ea[_0x6e4c('0xa0')];return{'code':0xc8,'result':'-'};};AGIVertices[_0x6e4c('0x16')][_0x6e4c('0x8')]=function(_0x8329c8){logger[_0x6e4c('0x2e')](util[_0x6e4c('0x57')](_0x6e4c('0xa2'),_0x8329c8['label']));return this['channel'][_0x6e4c('0x8')]([_0x8329c8['command'],_0x8329c8['args']]);};AGIVertices['prototype']['answer']=function(_0x3cf124){logger[_0x6e4c('0x2e')](util[_0x6e4c('0x57')]('Enter\x20in\x20ANSWER\x20(%s)\x20block',_0x3cf124[_0x6e4c('0x36')]));if(this[_0x6e4c('0xa3')](_0x3cf124[_0x6e4c('0x67')])){logger[_0x6e4c('0x2e')](util[_0x6e4c('0x57')]('Wait\x20%s\x20seconds\x20before\x20answer',_0x3cf124[_0x6e4c('0x67')]));var _0x34faa4=this[_0x6e4c('0x35')][_0x6e4c('0xa4')](_0x3cf124[_0x6e4c('0x67')]);if(_0x34faa4['result']===-0x1){return _0x34faa4;}}return this[_0x6e4c('0x35')][_0x6e4c('0xa5')]();};AGIVertices[_0x6e4c('0x16')][_0x6e4c('0x4b')]=function(_0x1db1e8){logger['info'](util[_0x6e4c('0x57')]('Enter\x20in\x20CALLBACK\x20(%s)\x20block',_0x1db1e8[_0x6e4c('0x36')]));if(!this['isConfigured'](_0x1db1e8['list_id'])){return this[_0x6e4c('0x35')][_0x6e4c('0x2d')](_0x1db1e8,_0x6e4c('0xa6'));}_0x1db1e8['scheduledAt']=moment();if(this['isConfigured'](_0x1db1e8[_0x6e4c('0xa7')])){_0x1db1e8[_0x6e4c('0x4c')]=moment()[_0x6e4c('0xa8')](_0x1db1e8[_0x6e4c('0xa7')],_0x6e4c('0xa9'));}if(!this[_0x6e4c('0xa3')](_0x1db1e8[_0x6e4c('0x4e')])){_0x1db1e8[_0x6e4c('0x4e')]=0x2;}this[_0x6e4c('0x43')][_0x6e4c('0x71')](this,_0x1db1e8);return this[_0x6e4c('0x35')][_0x6e4c('0xaa')](util[_0x6e4c('0x57')]('CALLBACK\x20added\x20phone:\x20%s\x20on\x20list:\x20%s\x20at\x20%s',_0x1db1e8[_0x6e4c('0x49')],_0x1db1e8[_0x6e4c('0x4a')],_0x1db1e8[_0x6e4c('0x4c')]));};AGIVertices['prototype'][_0x6e4c('0xab')]=function(_0x1be70a){logger['info'](util[_0x6e4c('0x57')](_0x6e4c('0xac'),_0x1be70a[_0x6e4c('0x36')]));var _0x673145=this[_0x6e4c('0x35')][_0x6e4c('0x5a')](_0x1be70a[_0x6e4c('0xad')],_0x1be70a['options']);if(_0x673145['result']===-0x1){return _0x673145;}return this['channel'][_0x6e4c('0xaa')](util[_0x6e4c('0x57')](_0x6e4c('0xae'),_0x1be70a[_0x6e4c('0xad')],_0x1be70a[_0x6e4c('0xaf')]));};AGIVertices[_0x6e4c('0x16')][_0x6e4c('0xb0')]=function(_0x38f116){logger[_0x6e4c('0x2e')](util['format'](_0x6e4c('0xb1'),_0x38f116[_0x6e4c('0x36')]));if(!this[_0x6e4c('0xa3')](_0x38f116[_0x6e4c('0x5f')])){return this['channel'][_0x6e4c('0xaa')]('no\x20text\x20configured');}var _0x2f6a36='\x22'+_0x38f116[_0x6e4c('0x5f')]+'\x22';if(this[_0x6e4c('0xa3')](_0x38f116[_0x6e4c('0xaf')])){_0x2f6a36+=','+_0x38f116[_0x6e4c('0xaf')];}var _0x43c41a=this[_0x6e4c('0x35')]['exec'](_0x6e4c('0xb2'),_0x2f6a36);if(_0x43c41a[_0x6e4c('0x9e')]===-0x1){return _0x43c41a;}return this[_0x6e4c('0x35')][_0x6e4c('0xaa')](util[_0x6e4c('0x57')](_0x6e4c('0xb3'),_0x2f6a36));};AGIVertices['prototype'][_0x6e4c('0xb4')]=function(_0x641822){logger[_0x6e4c('0x2e')](util['format'](_0x6e4c('0xb5'),_0x641822[_0x6e4c('0x36')]));if(!this['isConfigured'](_0x641822['text'])){return this[_0x6e4c('0x35')]['noop'](_0x6e4c('0xb6'));}var _0x45af6e='\x22'+_0x641822['text']+'\x22';if(this['isConfigured'](_0x641822['options'])){_0x45af6e+=','+_0x641822[_0x6e4c('0xaf')];}var _0x4a469d=this['channel'][_0x6e4c('0x5a')](_0x6e4c('0xb2'),_0x45af6e);if(_0x4a469d[_0x6e4c('0x9e')]===-0x1){return _0x4a469d;}return this['channel'][_0x6e4c('0xaa')](util[_0x6e4c('0x57')]('Executed\x20command\x20MRCPSynth\x20%s',_0x45af6e));};AGIVertices['prototype'][_0x6e4c('0xb7')]=function(_0x1b885f){logger[_0x6e4c('0x2e')](util[_0x6e4c('0x57')]('Enter\x20in\x20LUMENVOXASR\x20(%s)\x20block',_0x1b885f['label']));if(!this[_0x6e4c('0xa3')](_0x1b885f[_0x6e4c('0xb8')])){return this[_0x6e4c('0x35')][_0x6e4c('0xaa')]('no\x20grammar\x20configured');}var _0xf30e1f=_0x1b885f[_0x6e4c('0xb8')];if(this[_0x6e4c('0xa3')](_0x1b885f['options'])){_0xf30e1f+=','+_0x1b885f[_0x6e4c('0xaf')];}var _0x59ad34=this[_0x6e4c('0x35')][_0x6e4c('0x5a')]('MRCPRecog',_0xf30e1f);if(_0x59ad34['result']===-0x1){return _0x59ad34;}var _0x1f2c67=this[_0x6e4c('0x9d')]('RECOG_CONFIDENCE()','LUMENVOX_ASR_CONFIDENCE');if(_0x1f2c67[_0x6e4c('0x9e')]===-0x1){return _0x1f2c67;}var _0x496a41=this['getAndSetVariable'](_0x6e4c('0xb9'),_0x6e4c('0xba'));if(_0x496a41[_0x6e4c('0x9e')]===-0x1){return _0x496a41;}var _0x5c8cad=this[_0x6e4c('0x9d')](_0x6e4c('0xbb'),_0x6e4c('0xbc'));if(_0x5c8cad[_0x6e4c('0x9e')]===-0x1){return _0x5c8cad;}return this[_0x6e4c('0x35')][_0x6e4c('0xaa')](util[_0x6e4c('0x57')](_0x6e4c('0xbd'),_0xf30e1f));};AGIVertices[_0x6e4c('0x16')][_0x6e4c('0xbe')]=function(_0x2e412a){logger['info'](util[_0x6e4c('0x57')](_0x6e4c('0xbf'),_0x2e412a[_0x6e4c('0x36')]));if(!this['isConfigured'](_0x2e412a[_0x6e4c('0xb8')])){return this[_0x6e4c('0x35')][_0x6e4c('0xaa')](_0x6e4c('0xc0'));}var _0xb554a7=_0x2e412a[_0x6e4c('0xb8')];if(this[_0x6e4c('0xa3')](_0x2e412a[_0x6e4c('0xaf')])){_0xb554a7+=','+_0x2e412a['options'];}var _0x2c93d5=this[_0x6e4c('0x35')][_0x6e4c('0x5a')](_0x6e4c('0xc1'),_0xb554a7);if(_0x2c93d5[_0x6e4c('0x9e')]===-0x1){return _0x2c93d5;}var _0x380772=this[_0x6e4c('0x9d')](_0x6e4c('0xc2'),_0x6e4c('0xc3'));if(_0x380772[_0x6e4c('0x9e')]===-0x1){return _0x380772;}var _0x2d1fbc=this[_0x6e4c('0x9d')](_0x6e4c('0xb9'),_0x6e4c('0xc4'));if(_0x2d1fbc[_0x6e4c('0x9e')]===-0x1){return _0x2d1fbc;}var _0x1f9333=this[_0x6e4c('0x9d')]('RECOG_INSTANCE()',_0x6e4c('0xc5'));if(_0x1f9333['result']===-0x1){return _0x1f9333;}return this[_0x6e4c('0x35')][_0x6e4c('0xaa')](util['format'](_0x6e4c('0xbd'),_0xb554a7));};AGIVertices[_0x6e4c('0x16')]['database']=function(_0x5f5339){logger[_0x6e4c('0x2e')](util['format'](_0x6e4c('0xc6'),_0x5f5339[_0x6e4c('0x36')]));if(!this['isConfigured'](_0x5f5339['odbc_id'])){return this[_0x6e4c('0x35')]['error'](_0x5f5339,_0x6e4c('0xc7'));}var _0x672def=this[_0x6e4c('0x1a')][_0x6e4c('0x71')](this,_0x5f5339['odbc_id']);if(!_0x672def){return this['channel'][_0x6e4c('0x2d')](_0x5f5339,'no\x20odbc\x20database\x20found');}if(!this[_0x6e4c('0xa3')](_0x5f5339['query'])){return this[_0x6e4c('0x35')][_0x6e4c('0x2d')](_0x5f5339,_0x6e4c('0xc8'));}var _0x4fd6e0=_0x5f5339[_0x6e4c('0x30')][_0x6e4c('0x5c')](/(\r\n|\n|\r)/gm,'\x20');this[_0x6e4c('0x35')][_0x6e4c('0xaa')](util[_0x6e4c('0x57')](_0x6e4c('0xc9'),_0x4fd6e0));var _0x1f506e=this['getQueryOdbc'][_0x6e4c('0x71')](this,_0x672def,_0x4fd6e0);this[_0x6e4c('0xa1')][_0x6e4c('0x71')](this,_0x5f5339,_0x4fd6e0);if(!this['isConfigured'](_0x5f5339[_0x6e4c('0xca')])){return this[_0x6e4c('0x35')][_0x6e4c('0xaa')](_0x6e4c('0xcb'));}var _0x1b30ee=this[_0x6e4c('0x11')][_0x6e4c('0x71')](this,_0x5f5339[_0x6e4c('0xca')]);if(!_0x1b30ee){return this[_0x6e4c('0x35')]['error'](_0x5f5339,_0x6e4c('0xcc'));}var _0x48821f=this;_0x1f506e['forEach'](function(_0x2be5ff,_0x10c1b1){Object[_0x6e4c('0xcd')](_0x2be5ff)[_0x6e4c('0xce')](function(_0x2501d4){_0x48821f[_0x6e4c('0x35')][_0x6e4c('0x9a')](util[_0x6e4c('0x57')](_0x6e4c('0xcf'),_0x1b30ee,_0x10c1b1,_0x2501d4),_0x2be5ff[_0x2501d4]);});});this[_0x6e4c('0x35')][_0x6e4c('0x9a')](util['format']('%s_ROWS_COUNT',_0x1b30ee),_0x1f506e[_0x6e4c('0x97')]);return this[_0x6e4c('0x35')][_0x6e4c('0xaa')](util['format'](_0x6e4c('0xd0'),_0x1b30ee));};AGIVertices[_0x6e4c('0x16')][_0x6e4c('0xd1')]=function(_0x2ca3af){logger['debug'](util[_0x6e4c('0x57')](_0x6e4c('0xd2'),_0x2ca3af[_0x6e4c('0x36')]));if(!this['isConfigured'](_0x2ca3af[_0x6e4c('0xd3')])){return this[_0x6e4c('0x35')][_0x6e4c('0x2d')](_0x2ca3af,'no\x20user\x20selected');}var _0x466e35=this[_0x6e4c('0x1c')][_0x6e4c('0x71')](this,_0x2ca3af[_0x6e4c('0xd3')]);if(!_0x466e35){return this[_0x6e4c('0x35')]['error'](_0x2ca3af,_0x6e4c('0xd4'));}var _0x4fcf29=this[_0x6e4c('0x35')][_0x6e4c('0x5a')](_0x6e4c('0xd5'),[util[_0x6e4c('0x57')](_0x6e4c('0xd6'),_0x466e35),_0x2ca3af[_0x6e4c('0x67')],_0x2ca3af[_0x6e4c('0xd7')],_0x2ca3af[_0x6e4c('0xd8')]]);if(_0x4fcf29[_0x6e4c('0x9e')]===-0x1){return _0x4fcf29;}return this[_0x6e4c('0x35')][_0x6e4c('0xaa')](util['format'](_0x6e4c('0xd9'),_0x6e4c('0xd5')));};AGIVertices['prototype']['dialogflow']=function(_0x1ee6b3){logger[_0x6e4c('0x2e')](util[_0x6e4c('0x57')](_0x6e4c('0xda'),_0x1ee6b3[_0x6e4c('0x36')]));if(!this['isConfigured'](_0x1ee6b3[_0x6e4c('0x7b')])){return this[_0x6e4c('0x35')][_0x6e4c('0xaa')](_0x6e4c('0xdb'));}if(!this['isConfigured'](_0x1ee6b3[_0x6e4c('0x5f')])){return this[_0x6e4c('0x35')][_0x6e4c('0xaa')]('no\x20text\x20configured');}this[_0x6e4c('0x35')]['bot']=!![];this[_0x6e4c('0xa1')](_0x1ee6b3);this[_0x6e4c('0x42')](_0x1ee6b3['text'],'in');this['channel'][_0x6e4c('0xaa')](util[_0x6e4c('0x57')](_0x6e4c('0xdc'),_0x1ee6b3[_0x6e4c('0x5f')]));var _0x59d1c1=this[_0x6e4c('0x7a')][_0x6e4c('0x71')](this,_0x1ee6b3);if(_0x59d1c1){for(var _0x26441e in _0x59d1c1){if(_0x59d1c1[_0x6e4c('0x91')](_0x26441e)){this[_0x6e4c('0x35')][_0x6e4c('0x9a')](util[_0x6e4c('0x57')](_0x6e4c('0xdd'),_0x26441e[_0x6e4c('0x6b')]()),_0x59d1c1[_0x26441e]);}}this[_0x6e4c('0x42')](_0x59d1c1[_0x6e4c('0xde')],_0x6e4c('0xdf'));return this[_0x6e4c('0x35')][_0x6e4c('0xaa')](util[_0x6e4c('0x57')](_0x6e4c('0xe0'),_0x59d1c1[_0x6e4c('0xde')]));}return this[_0x6e4c('0x35')][_0x6e4c('0x2d')](_0x1ee6b3,_0x6e4c('0xe1'));};AGIVertices[_0x6e4c('0x16')]['sesteknda']=function(_0xe2fa08){logger[_0x6e4c('0x2e')](util[_0x6e4c('0x57')](_0x6e4c('0xe2'),_0xe2fa08[_0x6e4c('0x36')]));if(!this[_0x6e4c('0xa3')](_0xe2fa08[_0x6e4c('0xe3')])){return this[_0x6e4c('0x35')]['noop'](_0x6e4c('0xe4'));}if(!this['isConfigured'](_0xe2fa08['username'])){return this[_0x6e4c('0x35')]['noop'](_0x6e4c('0xe5'));}if(!this[_0x6e4c('0xa3')](_0xe2fa08[_0x6e4c('0xe6')])){return this[_0x6e4c('0x35')][_0x6e4c('0xaa')](_0x6e4c('0xe7'));}if(!this[_0x6e4c('0xa3')](_0xe2fa08['ndassistant_url'])){return this[_0x6e4c('0x35')]['noop'](_0x6e4c('0xb6'));}this['channel'][_0x6e4c('0xe8')]=!![];this[_0x6e4c('0xa1')](_0xe2fa08);this[_0x6e4c('0x42')](_0xe2fa08[_0x6e4c('0x5f')],'in');this['channel'][_0x6e4c('0xaa')](util[_0x6e4c('0x57')]('Trying\x20SestekNDA:\x20%s',_0xe2fa08[_0x6e4c('0x5f')]));var _0x4b9626=this[_0x6e4c('0x7c')]['sync'](this,_0xe2fa08);if(_0x4b9626){for(var _0xf494ba in _0x4b9626){if(_0x4b9626[_0x6e4c('0x91')](_0xf494ba)){this[_0x6e4c('0x35')][_0x6e4c('0x9a')](util[_0x6e4c('0x57')]('SESTEK_NDA_%s',_0xf494ba[_0x6e4c('0x6b')]()),_0x4b9626[_0xf494ba]);}}this[_0x6e4c('0x42')](_0x4b9626[_0x6e4c('0xde')],_0x6e4c('0xdf'));if(_0x4b9626[_0x6e4c('0xe9')]){this[_0x6e4c('0x35')]['noop'](util[_0x6e4c('0x57')](_0x6e4c('0xea'),_0x4b9626['audiofile']));var _0x3021dd=this['channel'][_0x6e4c('0xeb')](_0x4b9626['audiofile']);try{fs[_0x6e4c('0xec')](_0x4b9626['audiofile']+'.wav');}catch(_0x4eef39){logger[_0x6e4c('0x2d')](_0x4eef39);}return _0x3021dd;}else{return this[_0x6e4c('0x35')][_0x6e4c('0xaa')](util['format'](_0x6e4c('0xed'),_0x4b9626[_0x6e4c('0xde')]));}}return this[_0x6e4c('0x35')][_0x6e4c('0x2d')](_0xe2fa08,_0x6e4c('0xee'));};AGIVertices[_0x6e4c('0x16')]['end']=function(_0x5b20fb){logger['info'](util[_0x6e4c('0x57')](_0x6e4c('0xef'),_0x5b20fb[_0x6e4c('0x36')]));return this[_0x6e4c('0x35')][_0x6e4c('0xaa')]('end');};AGIVertices[_0x6e4c('0x16')][_0x6e4c('0xf0')]=function(_0x2a3f0b){logger[_0x6e4c('0x2e')](util['format'](_0x6e4c('0xf1'),_0x2a3f0b['label']));var _0x538dc7='';if(_0x2a3f0b[_0x6e4c('0xf2')]){if(!this['isConfigured'](_0x2a3f0b[_0x6e4c('0xf2')])){return this['channel'][_0x6e4c('0x2d')](_0x2a3f0b,_0x6e4c('0xf3'));}else{var _0x52f616=parseInt(_0x2a3f0b['trunk_id'],0xa);if(isNaN(_0x52f616)){_0x538dc7=_0x2a3f0b['trunk_id'];}else{_0x538dc7=this[_0x6e4c('0xf4')][_0x6e4c('0x71')](this,_0x2a3f0b['trunk_id']);if(!_0x538dc7){return this[_0x6e4c('0x35')][_0x6e4c('0x2d')](_0x2a3f0b,_0x6e4c('0xf5'));}}}}else if(_0x2a3f0b[_0x6e4c('0xf6')]){_0x538dc7=_0x2a3f0b[_0x6e4c('0xf6')];}else{return this['channel'][_0x6e4c('0x2d')](_0x2a3f0b,_0x6e4c('0xf3'));}var _0x5a0fe9=this['channel'][_0x6e4c('0x5a')](_0x6e4c('0xd5'),[util[_0x6e4c('0x57')](_0x6e4c('0xf7'),_0x538dc7,_0x2a3f0b['phone']),_0x2a3f0b[_0x6e4c('0x67')],_0x2a3f0b[_0x6e4c('0xd7')],_0x2a3f0b[_0x6e4c('0xd8')]]);if(_0x5a0fe9[_0x6e4c('0x9e')]===-0x1){return _0x5a0fe9;}return this['channel'][_0x6e4c('0xaa')](util['format'](_0x6e4c('0xd9'),'DIAL'));};AGIVertices[_0x6e4c('0x16')][_0x6e4c('0xf8')]=function(_0x57e3c6){logger[_0x6e4c('0x2e')](util[_0x6e4c('0x57')](_0x6e4c('0xf9'),_0x57e3c6[_0x6e4c('0x36')]));return this[_0x6e4c('0x35')]['noop'](_0x6e4c('0xf8'));};AGIVertices[_0x6e4c('0x16')]['getdigits']=function(_0x1ab421){logger['info'](util[_0x6e4c('0x57')](_0x6e4c('0xfa'),_0x1ab421['label']));if(_0x1ab421[_0x6e4c('0xfb')]===0x0){return this[_0x6e4c('0xa0')](_0x1ab421);}_0x1ab421[_0x6e4c('0xfb')]-=0x1;if(!this[_0x6e4c('0xa3')](_0x1ab421[_0x6e4c('0xfc')])){return this['channel']['error'](_0x1ab421,_0x6e4c('0xfd'));}var _0x44bff5=this[_0x6e4c('0x1e')][_0x6e4c('0x71')](this,_0x1ab421[_0x6e4c('0xfc')]);if(!_0x44bff5){return this[_0x6e4c('0x35')][_0x6e4c('0x2d')](_0x1ab421,_0x6e4c('0xfe'));}if(!this['isConfigured'](_0x1ab421[_0x6e4c('0xca')])){return this[_0x6e4c('0x35')]['error'](_0x6e4c('0xcb'));}var _0x108ec2=this[_0x6e4c('0x35')][_0x6e4c('0xff')](_0x44bff5,_0x1ab421[_0x6e4c('0x100')],_0x1ab421['maxdigit']);var _0x1c5275=_0x108ec2['result']?_0x108ec2['result'][_0x6e4c('0x4d')]():'';logger['info'](_0x6e4c('0x101'),JSON[_0x6e4c('0x75')](_0x108ec2));if(_0x108ec2[_0x6e4c('0x9e')]===-0x1){this[_0x6e4c('0xa1')][_0x6e4c('0x71')](this,_0x1ab421,_0x1c5275);return _0x108ec2;}else if(_0x108ec2[_0x6e4c('0x9f')]===_0x6e4c('0x67')){_0x108ec2[_0x6e4c('0x9e')]=_0x1c5275[_0x6e4c('0x97')]>=parseInt(_0x1ab421[_0x6e4c('0x102')])?'x':'i';}else{_0x108ec2['result']=_0x1c5275[_0x6e4c('0x97')]>=parseInt(_0x1ab421['mindigit'])&&_0x1c5275['length']<=parseInt(_0x1ab421[_0x6e4c('0x103')])?'x':'i';}var _0x3accc7=this[_0x6e4c('0x11')]['sync'](this,_0x1ab421[_0x6e4c('0xca')]);if(!_0x3accc7){return this[_0x6e4c('0x35')][_0x6e4c('0x2d')](_0x1ab421,_0x6e4c('0xcc'));}this[_0x6e4c('0x35')][_0x6e4c('0x9a')](_0x3accc7,_0x1c5275);if(this[_0x6e4c('0xa3')](_0x1ab421[_0x6e4c('0x104')])){var _0x106c57=parseInt(_0x1ab421[_0x6e4c('0x104')],0xa);var _0x1f2d9a=rs[_0x6e4c('0x105')]({'charset':'*','length':_0x106c57});var _0x19428c=_0x1c5275[_0x6e4c('0x97')];if(_0x19428c>0x0){if(_0x19428c>_0x106c57){this[_0x6e4c('0xa1')][_0x6e4c('0x71')](this,_0x1ab421,_0x1ab421['hiddendigitspos']==='first'?_0x1f2d9a+_0x1c5275['substr'](_0x106c57):_0x1c5275[_0x6e4c('0x106')](0x0,_0x19428c-_0x106c57)+_0x1f2d9a);}else{this[_0x6e4c('0xa1')]['sync'](this,_0x1ab421,rs['generate']({'charset':'*','length':_0x19428c}));}}else{this[_0x6e4c('0xa1')]['sync'](this,_0x1ab421,'');}}else{this[_0x6e4c('0xa1')][_0x6e4c('0x71')](this,_0x1ab421,_0x1c5275);}return _0x108ec2;};AGIVertices[_0x6e4c('0x16')][_0x6e4c('0xf')]=function(_0x3de757){logger[_0x6e4c('0x2e')](util[_0x6e4c('0x57')](_0x6e4c('0x107'),_0x3de757[_0x6e4c('0x36')]));return this[_0x6e4c('0xe')](_0x3de757);};AGIVertices[_0x6e4c('0x16')][_0x6e4c('0x108')]=function(_0x4e005e){logger[_0x6e4c('0x2e')](util['format']('Enter\x20in\x20GOAL\x20(%s)\x20block',_0x4e005e[_0x6e4c('0x36')]));this[_0x6e4c('0xa1')]['sync'](this,_0x4e005e,_0x4e005e['goalname']);return this[_0x6e4c('0x35')][_0x6e4c('0xaa')](util[_0x6e4c('0x57')](_0x6e4c('0x109'),_0x4e005e[_0x6e4c('0x10a')]));};AGIVertices[_0x6e4c('0x16')]['awspolly']=function(_0x4caa5f){logger[_0x6e4c('0x2e')](util[_0x6e4c('0x57')](_0x6e4c('0x10b'),_0x4caa5f['label']));if(!this[_0x6e4c('0xa3')](_0x4caa5f[_0x6e4c('0x84')])||!this[_0x6e4c('0xa3')](_0x4caa5f[_0x6e4c('0x89')])){return this[_0x6e4c('0x35')]['noop']('no\x20valid\x20credentials\x20configured');}if(!this[_0x6e4c('0xa3')](_0x4caa5f[_0x6e4c('0x5f')])){return this['channel'][_0x6e4c('0xaa')]('no\x20text\x20configured');}this['channel'][_0x6e4c('0xaa')](util[_0x6e4c('0x57')]('Trying\x20aws\x20Polly\x20%s',_0x4caa5f[_0x6e4c('0x5f')]));var _0x59dfdd=this[_0x6e4c('0x83')][_0x6e4c('0x71')](this,_0x4caa5f);if(_0x59dfdd){this[_0x6e4c('0x35')][_0x6e4c('0xaa')](util[_0x6e4c('0x57')](_0x6e4c('0x10c'),_0x59dfdd));var _0x3d8de0=this[_0x6e4c('0x35')][_0x6e4c('0xeb')](_0x59dfdd);try{fs[_0x6e4c('0xec')](_0x59dfdd+'.wav');}catch(_0x579ff4){logger[_0x6e4c('0x2d')](_0x579ff4);}return _0x3d8de0;}return this[_0x6e4c('0x35')][_0x6e4c('0x2d')](_0x4caa5f,'aws\x20Polly\x20is\x20unreachable');};AGIVertices[_0x6e4c('0x16')][_0x6e4c('0x10d')]=function(_0x346a14){logger['info'](util[_0x6e4c('0x57')](_0x6e4c('0x10e'),_0x346a14[_0x6e4c('0x36')]));if(!this[_0x6e4c('0xa3')](_0x346a14[_0x6e4c('0x84')])||!this[_0x6e4c('0xa3')](_0x346a14['aws_secret_access_key'])){return this[_0x6e4c('0x35')][_0x6e4c('0xaa')](_0x6e4c('0x10f'));}if(!this[_0x6e4c('0xa3')](_0x346a14[_0x6e4c('0x110')])){return this['channel']['noop'](_0x6e4c('0x111'));}if(!this[_0x6e4c('0xa3')](_0x346a14[_0x6e4c('0x5f')])){return this[_0x6e4c('0x35')]['noop'](_0x6e4c('0xb6'));}this[_0x6e4c('0x35')]['bot']=!![];this[_0x6e4c('0xa1')](_0x346a14);this['createSquareMessage'](_0x346a14[_0x6e4c('0x5f')],'in');this[_0x6e4c('0x35')]['noop'](util[_0x6e4c('0x57')]('Trying\x20Amazon\x20Lex:\x20%s',_0x346a14[_0x6e4c('0x5f')]));var _0x1c62d2=this[_0x6e4c('0x88')][_0x6e4c('0x71')](this,_0x346a14);if(_0x1c62d2){for(var _0x2f0fd7 in _0x1c62d2){if(_0x1c62d2[_0x6e4c('0x91')](_0x2f0fd7)&&_[_0x6e4c('0x92')](_0x1c62d2[_0x2f0fd7])){this['channel']['setVariable'](util['format']('AWS_LEX_%s',_0x2f0fd7[_0x6e4c('0x6b')]()),_0x1c62d2[_0x2f0fd7]);}}if(_[_0x6e4c('0x45')](_0x1c62d2[_0x6e4c('0x78')])){return this[_0x6e4c('0x35')][_0x6e4c('0xaa')](_0x6e4c('0x112'));}else{this[_0x6e4c('0x42')](_0x1c62d2[_0x6e4c('0x78')],_0x6e4c('0xdf'));return this['channel']['noop'](util[_0x6e4c('0x57')](_0x6e4c('0x113'),_0x1c62d2[_0x6e4c('0x78')]));}}return this[_0x6e4c('0x35')][_0x6e4c('0x2d')](_0x346a14,'Amazon\x20Lex\x20is\x20unreachable');};AGIVertices[_0x6e4c('0x16')][_0x6e4c('0x114')]=function(_0x53dc0a){logger[_0x6e4c('0x2e')](util['format'](_0x6e4c('0x115'),_0x53dc0a[_0x6e4c('0x36')],_0x53dc0a[_0x6e4c('0x67')]));if(!this[_0x6e4c('0xa3')](_0x53dc0a[_0x6e4c('0x7b')])){return this[_0x6e4c('0x35')][_0x6e4c('0xaa')](_0x6e4c('0xdb'));}var _0x423ced='wav';var _0x40a7a2=util[_0x6e4c('0x57')](_0x6e4c('0x116'),FILES_PATH,rs[_0x6e4c('0x105')](0x4));var _0x310d9f=util[_0x6e4c('0x57')](_0x6e4c('0x99'),_0x40a7a2,_0x423ced);var _0x59866b=!![];if(_0x53dc0a[_0x6e4c('0x117')]===_0x6e4c('0x118')){_0x59866b=![];}var _0x3b0781=this['channel'][_0x6e4c('0x119')](_0x40a7a2,_0x423ced,_0x53dc0a[_0x6e4c('0x11a')],_0x53dc0a[_0x6e4c('0x67')],undefined,_0x59866b);if(_0x3b0781[_0x6e4c('0x9e')]!==-0x1){this['channel'][_0x6e4c('0xaa')](util[_0x6e4c('0x57')](_0x6e4c('0x11b'),_0x310d9f));var _0x568262=this['googleASR'][_0x6e4c('0x71')](this,_0x53dc0a,_0x310d9f);if(_0x568262){for(var _0x1f5cfe in _0x568262){if(_0x568262[_0x6e4c('0x91')](_0x1f5cfe)){this[_0x6e4c('0x35')][_0x6e4c('0x9a')](util[_0x6e4c('0x57')]('GOOGLE_ASR_%s',_0x1f5cfe[_0x6e4c('0x6b')]()),_0x568262[_0x1f5cfe]);}}return this[_0x6e4c('0x35')][_0x6e4c('0xaa')](util[_0x6e4c('0x57')](_0x6e4c('0x11c'),JSON[_0x6e4c('0x75')](_0x568262)));}}return _0x3b0781;};AGIVertices[_0x6e4c('0x16')]['tildeasr']=function(_0x5ac2b2){logger['info'](util[_0x6e4c('0x57')](_0x6e4c('0x11d'),_0x5ac2b2['label']));if(!this['isConfigured'](_0x5ac2b2['appid'])){return this[_0x6e4c('0x35')][_0x6e4c('0xaa')]('no\x20appid\x20configured');}if(!this[_0x6e4c('0xa3')](_0x5ac2b2[_0x6e4c('0x11e')])){return this['channel'][_0x6e4c('0xaa')](_0x6e4c('0x11f'));}var _0x4a57ad=_0x6e4c('0x120');var _0x345af4=util[_0x6e4c('0x57')](_0x6e4c('0x116'),FILES_PATH,rs[_0x6e4c('0x105')](0x4));var _0x150c69=util[_0x6e4c('0x57')]('%s.%s',_0x345af4,_0x4a57ad);var _0x185d8a=!![];if(_0x5ac2b2[_0x6e4c('0x117')]===_0x6e4c('0x118')){_0x185d8a=![];}var _0x2c1170=this[_0x6e4c('0x35')][_0x6e4c('0x119')](_0x345af4,_0x4a57ad,_0x5ac2b2[_0x6e4c('0x11a')],_0x5ac2b2[_0x6e4c('0x67')],undefined,_0x185d8a);if(_0x2c1170['result']!==-0x1){this[_0x6e4c('0x35')][_0x6e4c('0xaa')](util[_0x6e4c('0x57')](_0x6e4c('0x121'),_0x150c69));var _0x2c8f3b=this[_0x6e4c('0x8d')]['sync'](this,_0x5ac2b2,_0x150c69);if(_0x2c8f3b){for(var _0x4bb214 in _0x2c8f3b){if(_0x2c8f3b[_0x6e4c('0x91')](_0x4bb214)){this[_0x6e4c('0x35')][_0x6e4c('0x9a')](util[_0x6e4c('0x57')](_0x6e4c('0x122'),_0x4bb214['toUpperCase']()),_0x2c8f3b[_0x4bb214]);}}return this[_0x6e4c('0x35')][_0x6e4c('0xaa')](util[_0x6e4c('0x57')](_0x6e4c('0x123'),JSON[_0x6e4c('0x75')](_0x2c8f3b)));}}return _0x2c1170;};AGIVertices[_0x6e4c('0x16')][_0x6e4c('0x124')]=function(_0x1a0fe8){logger[_0x6e4c('0x2e')](util[_0x6e4c('0x57')]('Enter\x20in\x20GOTO\x20(%s)\x20block',_0x1a0fe8['label']));return this[_0x6e4c('0x35')][_0x6e4c('0x125')](_0x1a0fe8[_0x6e4c('0x3c')],_0x1a0fe8[_0x6e4c('0x3d')],_0x1a0fe8['priority']);};AGIVertices['prototype'][_0x6e4c('0x126')]=function(_0x2cc663){logger[_0x6e4c('0x2e')](util['format'](_0x6e4c('0x127'),_0x2cc663[_0x6e4c('0x36')]));if(!this[_0x6e4c('0xa3')](_0x2cc663[_0x6e4c('0x128')])){return this['channel'][_0x6e4c('0x2d')](_0x2cc663,'no\x20condition\x20configured');}try{var _0x50bfe6=eval(_0x2cc663[_0x6e4c('0x128')])?'true':_0x6e4c('0x129');this[_0x6e4c('0x35')]['noop'](util[_0x6e4c('0x57')](_0x6e4c('0x12a'),_0x2cc663[_0x6e4c('0x128')],_0x50bfe6));return{'code':0xc8,'result':_0x50bfe6};}catch(_0x131a24){return{'code':0xc8,'result':_0x6e4c('0x129')};}};AGIVertices[_0x6e4c('0x16')]['gotoiftime']=function(_0x294fc7){logger[_0x6e4c('0x2e')](util[_0x6e4c('0x57')](_0x6e4c('0x12b'),_0x294fc7['label']));if(!this[_0x6e4c('0xa3')](_0x294fc7[_0x6e4c('0x12c')])){return this['channel'][_0x6e4c('0x2d')](_0x294fc7,_0x6e4c('0x12d'));}var _0x1f5d69=this[_0x6e4c('0x25')]['sync'](this,_0x294fc7[_0x6e4c('0x12c')]);if(!_0x1f5d69){return this[_0x6e4c('0x35')][_0x6e4c('0x2d')](_0x294fc7,_0x6e4c('0x12e'));}for(var _0x45f937=0x0;_0x45f937<_0x1f5d69[_0x6e4c('0x97')];_0x45f937+=0x1){var _0x2e8afc=this[_0x6e4c('0x35')]['getVariable'](util['format'](_0x6e4c('0x12f'),_0x1f5d69[_0x45f937]));if(_0x2e8afc['result']===-0x1){return _0x2e8afc;}logger[_0x6e4c('0x2e')](util[_0x6e4c('0x57')](_0x6e4c('0x130'),_0x1f5d69[_0x45f937],_0x2e8afc[_0x6e4c('0x9f')]));if(_0x2e8afc[_0x6e4c('0x9f')]==='true'){logger['info'](util[_0x6e4c('0x57')](_0x6e4c('0x130'),_0x1f5d69[_0x45f937],_0x6e4c('0x131')));this[_0x6e4c('0x35')][_0x6e4c('0xaa')](util[_0x6e4c('0x57')]('IFTIME\x20%s\x20%s',_0x1f5d69[_0x45f937],_0x6e4c('0x131')));return{'code':0xc8,'result':_0x6e4c('0x131')};}else{logger[_0x6e4c('0x2e')](util[_0x6e4c('0x57')](_0x6e4c('0x130'),_0x1f5d69[_0x45f937],'false'));this[_0x6e4c('0x35')]['noop'](util[_0x6e4c('0x57')]('IFTIME\x20%s\x20%s',_0x1f5d69[_0x45f937],_0x6e4c('0x129')));}}return{'code':0xc8,'result':'false'};};AGIVertices[_0x6e4c('0x16')][_0x6e4c('0x132')]=function(_0x783bf0){logger[_0x6e4c('0x2e')](util[_0x6e4c('0x57')](_0x6e4c('0x133'),_0x783bf0[_0x6e4c('0x36')]));return this['channel'][_0x6e4c('0x132')]();};AGIVertices[_0x6e4c('0x16')][_0x6e4c('0x134')]=function(_0x185bd9){logger[_0x6e4c('0x2e')](util[_0x6e4c('0x57')](_0x6e4c('0x135'),_0x185bd9[_0x6e4c('0x36')]));if(!this[_0x6e4c('0xa3')](_0x185bd9['key'])){return this[_0x6e4c('0x35')][_0x6e4c('0xaa')]('no\x20key\x20configured');}var _0x4e525b=_0x6e4c('0x120');var _0x21f495=util[_0x6e4c('0x57')](_0x6e4c('0x116'),FILES_PATH,rs[_0x6e4c('0x105')](0x4));var _0xbe06e2=util[_0x6e4c('0x57')](_0x6e4c('0x99'),_0x21f495,_0x4e525b);var _0x275360=!![];if(_0x185bd9[_0x6e4c('0x117')]===_0x6e4c('0x118')){_0x275360=![];}var _0x2de67d=this[_0x6e4c('0x35')][_0x6e4c('0x119')](_0x21f495,_0x4e525b,_0x185bd9[_0x6e4c('0x11a')],_0x185bd9[_0x6e4c('0x67')],undefined,_0x275360);if(_0x2de67d[_0x6e4c('0x9e')]!==-0x1){this[_0x6e4c('0x35')]['noop'](util[_0x6e4c('0x57')](_0x6e4c('0x136'),_0xbe06e2));var _0x47e6a7=this[_0x6e4c('0x80')][_0x6e4c('0x71')](this,_0x185bd9,_0xbe06e2);if(_0x47e6a7){for(var _0x2c388d in _0x47e6a7){if(_0x47e6a7[_0x6e4c('0x91')](_0x2c388d)){this[_0x6e4c('0x35')][_0x6e4c('0x9a')](util[_0x6e4c('0x57')](_0x6e4c('0x137'),_0x2c388d[_0x6e4c('0x6b')]()),_0x47e6a7[_0x2c388d]);}}return this[_0x6e4c('0x35')]['noop'](util[_0x6e4c('0x57')](_0x6e4c('0x138'),JSON[_0x6e4c('0x75')](_0x47e6a7)));}}return _0x2de67d;};AGIVertices[_0x6e4c('0x16')][_0x6e4c('0x139')]=function(_0x151a5f){logger[_0x6e4c('0x2e')](util[_0x6e4c('0x57')](_0x6e4c('0x13a'),_0x151a5f[_0x6e4c('0x36')]));if(!this['isConfigured'](_0x151a5f[_0x6e4c('0x7b')])){return this[_0x6e4c('0x35')][_0x6e4c('0xaa')](_0x6e4c('0xdb'));}if(!this[_0x6e4c('0xa3')](_0x151a5f[_0x6e4c('0x5f')])){return this[_0x6e4c('0x35')]['noop'](_0x6e4c('0xb6'));}this[_0x6e4c('0x35')][_0x6e4c('0xaa')](util[_0x6e4c('0x57')]('Trying\x20ispeech\x20TTS\x20%s',_0x151a5f[_0x6e4c('0x5f')]));var _0x5164f7=this[_0x6e4c('0x7d')][_0x6e4c('0x71')](this,_0x151a5f);if(_0x5164f7){this[_0x6e4c('0x35')][_0x6e4c('0xaa')](util[_0x6e4c('0x57')](_0x6e4c('0x136'),_0x5164f7));var _0x5cb889=this['channel'][_0x6e4c('0xeb')](_0x5164f7,_0x151a5f[_0x6e4c('0x11a')]);try{fs[_0x6e4c('0xec')](_0x5164f7+_0x6e4c('0x13b'));}catch(_0x293032){logger['error'](_0x293032);}return _0x5cb889;}return this[_0x6e4c('0x35')][_0x6e4c('0x2d')](_0x151a5f,'ispeech\x20TTS\x20is\x20unreachable');};AGIVertices[_0x6e4c('0x16')][_0x6e4c('0x13c')]=function(_0x348a33){logger[_0x6e4c('0x2e')](util[_0x6e4c('0x57')](_0x6e4c('0x13d'),_0x348a33[_0x6e4c('0x36')]));if(!this['isConfigured'](_0x348a33[_0x6e4c('0x13e')])){return this[_0x6e4c('0x35')]['error'](_0x348a33,'no\x20find\x20by\x20configured');}logger['info'](util[_0x6e4c('0x57')]('FIND\x20AGENT\x20%s\x20BY\x20%s',this['channel'][_0x6e4c('0x3a')],_0x348a33['findBy']));var _0x20686a=this[_0x6e4c('0x55')][_0x6e4c('0x71')](this,_0x348a33[_0x6e4c('0x13e')]);if(_0x20686a){logger['info'](util['format'](_0x6e4c('0x13f'),this[_0x6e4c('0x35')]['callerid'],_0x348a33['findBy']));this[_0x6e4c('0x35')][_0x6e4c('0xaa')](util[_0x6e4c('0x57')](_0x6e4c('0x13f'),this[_0x6e4c('0x35')][_0x6e4c('0x3a')],_0x348a33[_0x6e4c('0x13e')]));return{'code':0xc8,'result':_0x6e4c('0x140')};}else{logger[_0x6e4c('0x2e')](util[_0x6e4c('0x57')](_0x6e4c('0x141'),this[_0x6e4c('0x35')][_0x6e4c('0x3a')],_0x348a33[_0x6e4c('0x13e')]));this[_0x6e4c('0x35')][_0x6e4c('0xaa')](util['format'](_0x6e4c('0x141'),this['channel'][_0x6e4c('0x3a')],_0x348a33[_0x6e4c('0x13e')]));return{'code':0xc8,'result':'failure'};}};AGIVertices[_0x6e4c('0x16')][_0x6e4c('0x142')]=function(_0xf6b02f){logger[_0x6e4c('0x2e')](util[_0x6e4c('0x57')]('Enter\x20in\x20LOGOUT\x20(%s)\x20block',_0xf6b02f[_0x6e4c('0x36')]));if(!this[_0x6e4c('0xa3')](_0xf6b02f['findBy'])){return this[_0x6e4c('0x35')][_0x6e4c('0x2d')](_0xf6b02f,_0x6e4c('0x143'));}logger[_0x6e4c('0x2e')](util[_0x6e4c('0x57')](_0x6e4c('0x144'),this['channel'][_0x6e4c('0x3a')],_0xf6b02f[_0x6e4c('0x13e')]));var _0x5b4097=this[_0x6e4c('0x54')][_0x6e4c('0x71')](this,_0xf6b02f[_0x6e4c('0x13e')]);if(_0x5b4097){logger[_0x6e4c('0x2e')](util[_0x6e4c('0x57')](_0x6e4c('0x13f'),this[_0x6e4c('0x35')][_0x6e4c('0x3a')],_0xf6b02f[_0x6e4c('0x13e')]));this[_0x6e4c('0x35')][_0x6e4c('0xaa')](util[_0x6e4c('0x57')](_0x6e4c('0x13f'),this['channel'][_0x6e4c('0x3a')],_0xf6b02f['findBy']));return{'code':0xc8,'result':'success'};}else{logger['info'](util[_0x6e4c('0x57')](_0x6e4c('0x141'),this['channel'][_0x6e4c('0x3a')],_0xf6b02f[_0x6e4c('0x13e')]));this[_0x6e4c('0x35')][_0x6e4c('0xaa')](util['format'](_0x6e4c('0x141'),this[_0x6e4c('0x35')][_0x6e4c('0x3a')],_0xf6b02f[_0x6e4c('0x13e')]));return{'code':0xc8,'result':'failure'};}};AGIVertices[_0x6e4c('0x16')][_0x6e4c('0x145')]=function(_0x3e9a07){logger[_0x6e4c('0x2e')](util[_0x6e4c('0x57')](_0x6e4c('0x146'),_0x3e9a07[_0x6e4c('0x36')]));if(!this['isConfigured'](_0x3e9a07['operation'])){return this[_0x6e4c('0x35')]['error'](_0x3e9a07,_0x6e4c('0x147'));}this['channel'][_0x6e4c('0xaa')](util[_0x6e4c('0x57')](_0x6e4c('0x148'),_0x3e9a07[_0x6e4c('0x149')]));var _0x5de72e=eval(_0x3e9a07['operation']);if(!this[_0x6e4c('0xa3')](_0x3e9a07[_0x6e4c('0xca')])){return this[_0x6e4c('0x35')][_0x6e4c('0xaa')](_0x6e4c('0xcb'));}var _0x5576b9=this[_0x6e4c('0x11')][_0x6e4c('0x71')](this,_0x3e9a07[_0x6e4c('0xca')]);if(!_0x5576b9){return this[_0x6e4c('0x35')][_0x6e4c('0x2d')](_0x3e9a07,_0x6e4c('0xcc'));}if(_[_0x6e4c('0x96')](_0x5de72e)){var _0x5169dd=this;_0x5de72e[_0x6e4c('0xce')](function(_0x2c5a09,_0x5a3876){_0x5169dd['channel'][_0x6e4c('0x9a')](util[_0x6e4c('0x57')](_0x6e4c('0x14a'),_0x5576b9,_0x5a3876),_0x2c5a09);});return this[_0x6e4c('0x35')][_0x6e4c('0xaa')](util[_0x6e4c('0x57')](_0x6e4c('0x14b'),_0x5576b9));}else{return this[_0x6e4c('0x35')][_0x6e4c('0x9a')](_0x5576b9,_0x5de72e);}};AGIVertices[_0x6e4c('0x16')][_0x6e4c('0xd')]=function(_0x587082){logger['info'](util[_0x6e4c('0x57')]('Enter\x20in\x20MENU\x20(%s)\x20block',_0x587082[_0x6e4c('0x36')]));if(_0x587082[_0x6e4c('0xfb')]===0x0){return this['maxRetry'](_0x587082);}_0x587082[_0x6e4c('0xfb')]-=0x1;if(!this[_0x6e4c('0xa3')](_0x587082[_0x6e4c('0xfc')])){return this['channel'][_0x6e4c('0x2d')](_0x587082,'no\x20file\x20audio\x20selected');}var _0x3981ea=this[_0x6e4c('0x1e')][_0x6e4c('0x71')](this,_0x587082['file_id']);if(!_0x3981ea){return this[_0x6e4c('0x35')][_0x6e4c('0x2d')](_0x587082,_0x6e4c('0xfe'));}var _0x4f603c=this[_0x6e4c('0x35')][_0x6e4c('0xff')](_0x3981ea,_0x587082[_0x6e4c('0x100')],_0x587082['digit']);var _0x508f45=_0x4f603c[_0x6e4c('0x9e')];if(_0x4f603c['result']===-0x1){this[_0x6e4c('0xa1')][_0x6e4c('0x71')](this,_0x587082,'-1');return _0x4f603c;}else if(_0x4f603c[_0x6e4c('0x9f')]===_0x6e4c('0x67')){_0x4f603c[_0x6e4c('0x9e')]=_0x4f603c[_0x6e4c('0x9e')][_0x6e4c('0x97')]>0x0?_0x4f603c[_0x6e4c('0x9e')]:'t';}else if(_[_0x6e4c('0x44')](_0x4f603c[_0x6e4c('0x9e')])){_0x4f603c[_0x6e4c('0x9e')]='#';_0x508f45='#';}if(!this[_0x6e4c('0xa3')](_0x587082['variable_id'])){this[_0x6e4c('0x35')]['noop'](_0x6e4c('0xcb'));}else{var _0xe96eda=this['getVariable'][_0x6e4c('0x71')](this,_0x587082[_0x6e4c('0xca')]);if(!_0xe96eda){return this[_0x6e4c('0x35')][_0x6e4c('0x2d')](_0x587082,_0x6e4c('0xcc'));}this[_0x6e4c('0x35')][_0x6e4c('0x9a')](_0xe96eda,_0x508f45);}this[_0x6e4c('0xa1')][_0x6e4c('0x71')](this,_0x587082,_0x508f45);return _0x4f603c;};AGIVertices['prototype']['noop']=function(_0x38977d){logger[_0x6e4c('0x2e')](util[_0x6e4c('0x57')]('Enter\x20in\x20NOOP\x20(%s)\x20block',_0x38977d[_0x6e4c('0x36')]));return this[_0x6e4c('0x35')][_0x6e4c('0xaa')](_0x38977d[_0x6e4c('0x14c')]||_0x38977d[_0x6e4c('0x36')]);};AGIVertices['prototype'][_0x6e4c('0x14d')]=function(_0x43247a){logger['info'](util[_0x6e4c('0x57')]('Enter\x20in\x20PAUSE\x20(%s)\x20block',_0x43247a[_0x6e4c('0x36')]));if(!this[_0x6e4c('0xa3')](_0x43247a[_0x6e4c('0x13e')])){return this[_0x6e4c('0x35')][_0x6e4c('0x2d')](_0x43247a,_0x6e4c('0x143'));}logger[_0x6e4c('0x2e')](util[_0x6e4c('0x57')](_0x6e4c('0x144'),this[_0x6e4c('0x35')]['callerid'],_0x43247a[_0x6e4c('0x13e')]));var _0x98546e=this['getPause'][_0x6e4c('0x71')](this,_0x43247a[_0x6e4c('0x14e')]);var _0x461182=this[_0x6e4c('0x52')][_0x6e4c('0x71')](this,_0x43247a['findBy'],_0x98546e);if(_0x461182){logger[_0x6e4c('0x2e')](util[_0x6e4c('0x57')](_0x6e4c('0x13f'),this[_0x6e4c('0x35')][_0x6e4c('0x3a')],_0x43247a[_0x6e4c('0x13e')]));this['channel'][_0x6e4c('0xaa')](util[_0x6e4c('0x57')]('AGENT\x20%s\x20FOUND\x20BY',this[_0x6e4c('0x35')][_0x6e4c('0x3a')],_0x43247a[_0x6e4c('0x13e')]));return{'code':0xc8,'result':_0x6e4c('0x140')};}else{logger['info'](util[_0x6e4c('0x57')](_0x6e4c('0x141'),this[_0x6e4c('0x35')]['callerid'],_0x43247a[_0x6e4c('0x13e')]));this[_0x6e4c('0x35')][_0x6e4c('0xaa')](util[_0x6e4c('0x57')](_0x6e4c('0x13f'),this[_0x6e4c('0x35')][_0x6e4c('0x3a')],_0x43247a[_0x6e4c('0x13e')]));return{'code':0xc8,'result':_0x6e4c('0x14f')};}};AGIVertices[_0x6e4c('0x16')][_0x6e4c('0x150')]=function(_0x255232){logger[_0x6e4c('0x2e')](util['format'](_0x6e4c('0x151'),_0x255232['label']));if(!this['isConfigured'](_0x255232['file_id'])){return this[_0x6e4c('0x35')][_0x6e4c('0x2d')](_0x255232,_0x6e4c('0xfd'));}var _0x1bb4da=this['getSound'][_0x6e4c('0x71')](this,_0x255232[_0x6e4c('0xfc')]);if(!_0x1bb4da){return this[_0x6e4c('0x35')][_0x6e4c('0x2d')](_0x255232,_0x6e4c('0xfe'));}var _0x485d79=this[_0x6e4c('0x35')][_0x6e4c('0x5a')](_0x6e4c('0x152'),[_0x1bb4da,_0x255232[_0x6e4c('0xd7')]]);if(_0x485d79[_0x6e4c('0x9e')]===-0x1){return _0x485d79;}return this['channel'][_0x6e4c('0xaa')](util['format'](_0x6e4c('0xae'),_0x6e4c('0x152'),_0x1bb4da));};AGIVertices[_0x6e4c('0x16')][_0x6e4c('0x153')]=function(_0x5c58d8){logger[_0x6e4c('0x2e')](util[_0x6e4c('0x57')](_0x6e4c('0x154'),_0x5c58d8['label']));if(!this[_0x6e4c('0xa3')](_0x5c58d8[_0x6e4c('0x155')])){return this[_0x6e4c('0x35')]['error'](_0x5c58d8,_0x6e4c('0x156'));}var _0x50a615='';var _0x4b16d6=parseInt(_0x5c58d8[_0x6e4c('0x155')],0xa);if(isNaN(_0x4b16d6)){_0x50a615=_0x5c58d8['queue_id'];}else{_0x50a615=this[_0x6e4c('0x157')][_0x6e4c('0x71')](this,_0x5c58d8[_0x6e4c('0x155')]);if(!_0x50a615){return this['channel'][_0x6e4c('0x2d')](_0x5c58d8,'no\x20queue\x20found');}}var _0x17e74c='';if(this['isConfigured'](_0x5c58d8[_0x6e4c('0xfc')])){var _0x2bcbf9=this[_0x6e4c('0x1e')][_0x6e4c('0x71')](this,_0x5c58d8[_0x6e4c('0xfc')]);if(_0x2bcbf9){_0x17e74c=_0x2bcbf9;}}this[_0x6e4c('0xa1')][_0x6e4c('0x71')](this,_0x5c58d8,_0x50a615);if(_0x5c58d8['opts'][_0x6e4c('0x158')]('x')<0x0){_0x5c58d8[_0x6e4c('0xd7')]+='x';}if(_0x5c58d8[_0x6e4c('0xd7')]['indexOf']('X')<0x0){_0x5c58d8['opts']+='X';}this['channel'][_0x6e4c('0x9a')](_0x6e4c('0x159'),_0x50a615?_0x50a615[_0x6e4c('0x15a')]():'');var _0x2fea7f=this[_0x6e4c('0x35')][_0x6e4c('0x5a')]('QUEUE',[_0x50a615,_0x5c58d8[_0x6e4c('0xd7')],_0x5c58d8[_0x6e4c('0xd8')],_0x17e74c,_0x5c58d8[_0x6e4c('0x67')],_0x5c58d8[_0x6e4c('0x8')],_0x5c58d8['macro'],_0x5c58d8[_0x6e4c('0x15b')],'',_0x5c58d8['position']]);if(_0x2fea7f[_0x6e4c('0x9e')]===-0x1){return _0x2fea7f;}return this[_0x6e4c('0x35')][_0x6e4c('0xaa')](util[_0x6e4c('0x57')](_0x6e4c('0xae'),_0x6e4c('0x15c'),_0x50a615));};AGIVertices[_0x6e4c('0x16')][_0x6e4c('0x15d')]=function(_0x4de793){logger[_0x6e4c('0x2e')](util[_0x6e4c('0x57')](_0x6e4c('0x15e'),_0x4de793[_0x6e4c('0x36')]));var _0x4888e0=_0x4de793[_0x6e4c('0x15f')]||_0x6e4c('0x120');var _0x5758b3=util[_0x6e4c('0x57')](_0x6e4c('0x160'),this[_0x6e4c('0x35')][_0x6e4c('0x39')],rs['generate'](0x5));var _0x2bffdf=util['format']('%s/recordings/%s.%s',FILES_PATH,_0x5758b3,_0x4888e0);var _0x223ae7=util['format'](_0x6e4c('0x116'),FILES_PATH,_0x5758b3);this[_0x6e4c('0x38')]['sync'](this,_0x4de793,_0x5758b3,_0x2bffdf);this[_0x6e4c('0x35')][_0x6e4c('0x9a')](_0x6e4c('0x161'),_0x5758b3);logger[_0x6e4c('0x2e')]('Recording\x20%s\x20%s\x20%s\x20%s',_0x223ae7,_0x4888e0,_0x4de793[_0x6e4c('0x162')],_0x4de793[_0x6e4c('0x67')]);return this[_0x6e4c('0x35')][_0x6e4c('0x119')](_0x223ae7,_0x4888e0,_0x4de793[_0x6e4c('0x162')],_0x4de793['timeout'],undefined,!![]);};AGIVertices[_0x6e4c('0x16')][_0x6e4c('0x163')]=function(_0x3fc7db){logger[_0x6e4c('0x2e')](util[_0x6e4c('0x57')](_0x6e4c('0x164'),_0x3fc7db['label']));if(!this[_0x6e4c('0xa3')](_0x3fc7db['url'])){return this['channel'][_0x6e4c('0xaa')](_0x6e4c('0x165'));}var _0x5877d7=this[_0x6e4c('0x65')][_0x6e4c('0x71')](this,_0x3fc7db);logger[_0x6e4c('0x2e')](util[_0x6e4c('0x57')](_0x6e4c('0x166'),util['inspect'](_0x5877d7,{'showHidden':![],'depth':null})));if(!this[_0x6e4c('0xa3')](_0x3fc7db['variable_id'])){return this[_0x6e4c('0x35')][_0x6e4c('0xaa')](_0x6e4c('0x167'));}var _0x54e546=this[_0x6e4c('0x11')][_0x6e4c('0x71')](this,_0x3fc7db[_0x6e4c('0xca')]);if(!_0x54e546){return this[_0x6e4c('0x35')][_0x6e4c('0x2d')](_0x3fc7db,_0x6e4c('0xcc'));}this[_0x6e4c('0x35')][_0x6e4c('0x9a')](util[_0x6e4c('0x57')](_0x6e4c('0x168'),_0x54e546),_0x5877d7[_0x6e4c('0x77')]?_0x5877d7[_0x6e4c('0x77')]:_0x6e4c('0x169'));this[_0x6e4c('0x35')][_0x6e4c('0x9a')](util[_0x6e4c('0x57')](_0x6e4c('0x16a'),_0x54e546),_0x5877d7[_0x6e4c('0x76')]?_0x5877d7[_0x6e4c('0x76')]:'OK');if(_0x5877d7[_0x6e4c('0x6c')]){try{this[_0x6e4c('0x98')](_0x5877d7[_0x6e4c('0x6c')],_0x54e546);}catch(_0x55b89d){logger['error'](util[_0x6e4c('0x57')](_0x6e4c('0x16b'),_0x54e546));}}return this['channel']['noop'](util['format']('variable\x20%s\x20set',_0x54e546));};AGIVertices[_0x6e4c('0x16')][_0x6e4c('0x16c')]=function(_0x1fa7d2){logger[_0x6e4c('0x2e')](util[_0x6e4c('0x57')](_0x6e4c('0x16d'),_0x1fa7d2[_0x6e4c('0x36')]));return this[_0x6e4c('0x35')][_0x6e4c('0x16e')](_0x1fa7d2[_0x6e4c('0x16f')][_0x6e4c('0x5c')](/\s+/g,''),_0x1fa7d2[_0x6e4c('0x162')]);};AGIVertices[_0x6e4c('0x16')][_0x6e4c('0x170')]=function(_0x53f011){logger[_0x6e4c('0x2e')](util[_0x6e4c('0x57')]('Enter\x20in\x20SAYNUMBER\x20(%s)\x20block',_0x53f011['label']));return this['channel']['sayNumber'](_0x53f011['number']['replace'](/\s+/g,''),_0x53f011[_0x6e4c('0x162')]);};AGIVertices[_0x6e4c('0x16')][_0x6e4c('0x171')]=function(_0x36db26){logger[_0x6e4c('0x2e')](util[_0x6e4c('0x57')](_0x6e4c('0x172'),_0x36db26['label']));return this[_0x6e4c('0x35')][_0x6e4c('0x173')](_0x36db26[_0x6e4c('0x5f')],_0x36db26[_0x6e4c('0x162')]);};AGIVertices['prototype']['sendMail']=function(_0xd892f7){logger['info'](util[_0x6e4c('0x57')](_0x6e4c('0x174'),_0xd892f7[_0x6e4c('0x36')]));if(!this[_0x6e4c('0xa3')](_0xd892f7[_0x6e4c('0x175')])){return this[_0x6e4c('0x35')]['noop'](_0x6e4c('0x176'));}var _0x2d042f=this['getMailAccount'][_0x6e4c('0x71')](this,_0xd892f7['account_id']);if(!_0x2d042f||!_0x2d042f[_0x6e4c('0x177')]){return this['channel'][_0x6e4c('0x2d')](_0xd892f7,'no\x20mail\x20account\x20found');}var _0x168b75={'from':util[_0x6e4c('0x57')](_0x6e4c('0x178'),_0x2d042f[_0x6e4c('0x14')],_0x2d042f[_0x6e4c('0x179')]||_0x2d042f['Smtp'][_0x6e4c('0x17a')]),'to':_0xd892f7['to']||'','cc':_0xd892f7['cc']||'','bcc':_0xd892f7[_0x6e4c('0x17b')]||'','subject':_0xd892f7[_0x6e4c('0x17c')],'html':_0xd892f7[_0x6e4c('0x5f')],'text':_0xd892f7[_0x6e4c('0x5f')]};var _0x1254f8={'tls':{'rejectUnauthorized':![]}};if(_0x2d042f[_0x6e4c('0x177')][_0x6e4c('0x17d')]){_0x1254f8['service']=_0x2d042f[_0x6e4c('0x177')][_0x6e4c('0x17d')];}else{_0x1254f8[_0x6e4c('0x17e')]=_0x2d042f['Smtp'][_0x6e4c('0x17e')];_0x1254f8[_0x6e4c('0x17f')]=_0x2d042f[_0x6e4c('0x177')][_0x6e4c('0x17f')];_0x1254f8[_0x6e4c('0x180')]=_0x2d042f[_0x6e4c('0x177')][_0x6e4c('0x180')];}if(_0x2d042f[_0x6e4c('0x177')][_0x6e4c('0x181')]){_0x1254f8[_0x6e4c('0x182')]={'user':_0x2d042f[_0x6e4c('0x177')][_0x6e4c('0x17a')],'pass':_0x2d042f['Smtp']['pass']};}if(this[_0x6e4c('0xa3')](_0xd892f7['template_id'])){}logger[_0x6e4c('0x183')](_0x6e4c('0x184'),JSON[_0x6e4c('0x75')](_0x168b75));this[_0x6e4c('0xa1')][_0x6e4c('0x71')](this,_0xd892f7,_0xd892f7['account_id']);this[_0x6e4c('0x35')][_0x6e4c('0xaa')](util[_0x6e4c('0x57')](_0x6e4c('0x185'),_0x2d042f['name']));this['sendMailMessage'][_0x6e4c('0x71')](this,_0x1254f8,_0x168b75);return this[_0x6e4c('0x35')][_0x6e4c('0xaa')](_0x6e4c('0x186'));};AGIVertices['prototype']['sendFax']=function(_0x51d095){logger[_0x6e4c('0x2e')](util[_0x6e4c('0x57')](_0x6e4c('0x187'),_0x51d095[_0x6e4c('0x36')]));return this[_0x6e4c('0x35')]['noop'](_0x6e4c('0x188'));};AGIVertices[_0x6e4c('0x16')][_0x6e4c('0x189')]=function(_0x1ed746){logger[_0x6e4c('0x2e')](util[_0x6e4c('0x57')](_0x6e4c('0x18a'),_0x1ed746[_0x6e4c('0x36')]));if(!this[_0x6e4c('0xa3')](_0x1ed746[_0x6e4c('0x18b')])){return this[_0x6e4c('0x35')][_0x6e4c('0xaa')](_0x6e4c('0x18c'));}var _0x15b7ce=this['getSmsAccount'][_0x6e4c('0x71')](this,_0x1ed746[_0x6e4c('0x18b')]);if(!_0x15b7ce){return this[_0x6e4c('0x35')]['error'](_0x1ed746,_0x6e4c('0x18d'));}var _0x43a7da={'body':_0x1ed746[_0x6e4c('0x18e')],'phone':_0x1ed746['to']||'','SmsAccountId':_0x15b7ce['id']};logger[_0x6e4c('0x183')](_0x6e4c('0x18f'),JSON[_0x6e4c('0x75')](_0x43a7da));this[_0x6e4c('0xa1')][_0x6e4c('0x71')](this,_0x1ed746,_0x1ed746[_0x6e4c('0x18b')]);this[_0x6e4c('0x35')][_0x6e4c('0xaa')](util[_0x6e4c('0x57')]('Trying\x20SendSMS\x20with\x20account\x20%s',_0x15b7ce['name']));this[_0x6e4c('0x190')][_0x6e4c('0x71')](this,_0x43a7da);return this[_0x6e4c('0x35')][_0x6e4c('0xaa')]('Sms\x20message\x20added\x20to\x20outgoing\x20process');};AGIVertices['prototype'][_0x6e4c('0x191')]=function(_0x57e32a){logger[_0x6e4c('0x2e')](util['format']('Enter\x20in\x20SET\x20(%s)\x20block',_0x57e32a[_0x6e4c('0x36')]));if(!this[_0x6e4c('0xa3')](_0x57e32a[_0x6e4c('0xca')])){return this[_0x6e4c('0x35')][_0x6e4c('0x2d')](_0x57e32a,_0x6e4c('0x192'));}var _0x5adb82=this[_0x6e4c('0x11')][_0x6e4c('0x71')](this,_0x57e32a[_0x6e4c('0xca')]);if(!_0x5adb82){return this[_0x6e4c('0x35')]['error'](_0x57e32a,_0x6e4c('0xcc'));}return this['channel'][_0x6e4c('0x9a')](_0x5adb82,_0x57e32a[_0x6e4c('0x193')]);};AGIVertices[_0x6e4c('0x16')]['start']=function(_0x4b27b5){logger[_0x6e4c('0x2e')](util[_0x6e4c('0x57')]('Enter\x20in\x20START\x20(%s)\x20block',_0x4b27b5[_0x6e4c('0x36')]));this[_0x6e4c('0x35')]['noop'](_0x6e4c('0x194'));if(_0x4b27b5[_0x6e4c('0xa5')]==='yes'){this[_0x6e4c('0x35')][_0x6e4c('0xaa')](_0x6e4c('0x195'));return this[_0x6e4c('0x35')]['answer']();}return this['channel'][_0x6e4c('0xaa')]('Skipped\x20Answer');};AGIVertices['prototype'][_0x6e4c('0x196')]=function(_0x2a5011){logger[_0x6e4c('0x2e')](util[_0x6e4c('0x57')]('Enter\x20in\x20SUBPROJECT\x20(%s)\x20block',_0x2a5011[_0x6e4c('0x36')]));if(!this[_0x6e4c('0xa3')](_0x2a5011[_0x6e4c('0x197')])){return this[_0x6e4c('0x35')][_0x6e4c('0x2d')](_0x2a5011,_0x6e4c('0x198'));}var _0x430e82=this['getSquareProject'][_0x6e4c('0x71')](this,_0x2a5011[_0x6e4c('0x197')]);if(!this[_0x6e4c('0xa3')](_0x430e82)){return this['channel'][_0x6e4c('0x2d')](_0x2a5011,util['format'](_0x6e4c('0x199'),_0x2a5011[_0x6e4c('0x197')]));}if(_0x430e82===this[_0x6e4c('0x35')][_0x6e4c('0x40')]){return this[_0x6e4c('0x35')][_0x6e4c('0x2d')](_0x2a5011,_0x6e4c('0x19a'));}this['createSquareDetailsReport'][_0x6e4c('0x71')](this,_0x2a5011,_0x430e82);var _0x482b2e=this[_0x6e4c('0x35')][_0x6e4c('0x5a')](_0x6e4c('0x19b'),util[_0x6e4c('0x57')](_0x6e4c('0x19c'),config[_0x6e4c('0x8')][_0x6e4c('0x17e')]||'127.0.0.1',_0x430e82,this[_0x6e4c('0x35')]['arg_1']));if(_0x482b2e[_0x6e4c('0x9e')]===-0x1){return _0x482b2e;}return this['channel'][_0x6e4c('0xaa')](util[_0x6e4c('0x57')](_0x6e4c('0xae'),'AGI',_0x430e82));};AGIVertices[_0x6e4c('0x16')][_0x6e4c('0x19d')]=function(_0x129fc1){logger[_0x6e4c('0x2e')](util['format'](_0x6e4c('0x19e'),_0x129fc1['label']));var _0x38e4f7=this['shellCommand']['sync'](this,_0x129fc1[_0x6e4c('0x19f')]);this[_0x6e4c('0xa1')][_0x6e4c('0x71')](this,_0x129fc1,_0x129fc1[_0x6e4c('0x19f')]);if(this['isConfigured'](_0x129fc1[_0x6e4c('0xca')])){var _0xb20a2a=this[_0x6e4c('0x11')]['sync'](this,_0x129fc1['variable_id']);if(_0xb20a2a){this['channel'][_0x6e4c('0x9a')](_0xb20a2a,_0x38e4f7);return this[_0x6e4c('0x35')]['noop'](util[_0x6e4c('0x57')](_0x6e4c('0x1a0'),_0x129fc1['command'],_0xb20a2a));}}return this[_0x6e4c('0x35')][_0x6e4c('0xaa')](util[_0x6e4c('0x57')](_0x6e4c('0x1a1'),_0x129fc1['command']));};AGIVertices[_0x6e4c('0x16')]['google_cloud_tts']=function(_0x225a65){logger[_0x6e4c('0x2e')](util[_0x6e4c('0x57')](_0x6e4c('0x1a2'),_0x225a65['label']));if(!this[_0x6e4c('0xa3')](_0x225a65[_0x6e4c('0x1a3')])){return this[_0x6e4c('0x35')]['noop'](_0x6e4c('0x1a4'));}if(!this[_0x6e4c('0xa3')](_0x225a65[_0x6e4c('0x5f')])){return this[_0x6e4c('0x35')][_0x6e4c('0xaa')](_0x6e4c('0xb6'));}this[_0x6e4c('0x35')]['noop'](util[_0x6e4c('0x57')](_0x6e4c('0x1a5'),_0x225a65['text']));var _0x367ec3=this[_0x6e4c('0x5d')][_0x6e4c('0x71')](this,_0x225a65);if(_0x367ec3){this[_0x6e4c('0x35')][_0x6e4c('0xaa')](util[_0x6e4c('0x57')]('Google\x20Cloud\x20TTS\x20%s\x20file\x20created',_0x367ec3));var _0x34cf2c=this[_0x6e4c('0x35')][_0x6e4c('0xeb')](_0x367ec3);try{fs[_0x6e4c('0xec')](_0x367ec3+_0x6e4c('0x13b'));}catch(_0x1d969a){logger['error'](_0x1d969a);}return _0x34cf2c;}return this['channel'][_0x6e4c('0x2d')](_0x225a65,_0x6e4c('0x1a6'));};AGIVertices['prototype'][_0x6e4c('0x1a7')]=function(_0x5380a7){logger['info'](util['format']('Enter\x20in\x20GOOGLETTS\x20(%s)\x20block',_0x5380a7[_0x6e4c('0x36')]));if(!this[_0x6e4c('0xa3')](_0x5380a7[_0x6e4c('0x5f')])){return this[_0x6e4c('0x35')][_0x6e4c('0xaa')]('no\x20text\x20configured');}this['channel'][_0x6e4c('0xaa')](util[_0x6e4c('0x57')](_0x6e4c('0x1a8'),_0x5380a7[_0x6e4c('0x5f')]));var _0x3fe44f=this[_0x6e4c('0x63')][_0x6e4c('0x71')](this,_0x5380a7);if(_0x3fe44f){this[_0x6e4c('0x35')][_0x6e4c('0xaa')](util['format'](_0x6e4c('0x1a9'),_0x3fe44f));var _0x3cf905=this[_0x6e4c('0x35')]['streamFile'](_0x3fe44f);try{fs[_0x6e4c('0xec')](_0x3fe44f+'.wav');}catch(_0x4f06bb){logger['error'](_0x4f06bb);}return _0x3cf905;}return this[_0x6e4c('0x35')]['error'](_0x5380a7,_0x6e4c('0x1aa'));};AGIVertices['prototype'][_0x6e4c('0x1ab')]=function(_0x130808){logger[_0x6e4c('0x2e')](util['format'](_0x6e4c('0x1ac'),_0x130808[_0x6e4c('0x36')]));if(!this[_0x6e4c('0xa3')](_0x130808['findBy'])){return this['channel'][_0x6e4c('0x2d')](_0x130808,_0x6e4c('0x143'));}logger['info'](util[_0x6e4c('0x57')]('FIND\x20AGENT\x20%s\x20BY\x20%s',this['channel']['callerid'],_0x130808[_0x6e4c('0x13e')]));var _0x44ed21=this[_0x6e4c('0x53')]['sync'](this,_0x130808['findBy']);if(_0x44ed21){logger[_0x6e4c('0x2e')](util[_0x6e4c('0x57')](_0x6e4c('0x13f'),this['channel'][_0x6e4c('0x3a')],_0x130808[_0x6e4c('0x13e')]));this[_0x6e4c('0x35')]['noop'](util['format']('AGENT\x20%s\x20FOUND\x20BY',this[_0x6e4c('0x35')][_0x6e4c('0x3a')],_0x130808[_0x6e4c('0x13e')]));return{'code':0xc8,'result':_0x6e4c('0x140')};}else{logger[_0x6e4c('0x2e')](util['format'](_0x6e4c('0x141'),this[_0x6e4c('0x35')]['callerid'],_0x130808[_0x6e4c('0x13e')]));this['channel']['noop'](util['format'](_0x6e4c('0x141'),this[_0x6e4c('0x35')][_0x6e4c('0x3a')],_0x130808[_0x6e4c('0x13e')]));return{'code':0xc8,'result':_0x6e4c('0x14f')};}};AGIVertices[_0x6e4c('0x16')][_0x6e4c('0x1ad')]=function(_0x9c1d38){logger[_0x6e4c('0x2e')](util[_0x6e4c('0x57')](_0x6e4c('0x1ae'),_0x9c1d38[_0x6e4c('0x36')]));var _0x4cd00f=this[_0x6e4c('0x35')][_0x6e4c('0x5a')](_0x6e4c('0x1af'),[_0x9c1d38[_0x6e4c('0x1b0')],_0x9c1d38[_0x6e4c('0xaf')]]);if(_0x4cd00f[_0x6e4c('0x9e')]===-0x1){return _0x4cd00f;}return this[_0x6e4c('0x35')]['noop'](util['format']('Executed\x20command\x20%s\x20%s','VOICEMAIL',_0x9c1d38['mailbox']));};AGIVertices[_0x6e4c('0x16')][_0x6e4c('0x1b1')]=function(_0x208c77){logger[_0x6e4c('0x2e')](util[_0x6e4c('0x57')]('Enter\x20in\x20SWITCH\x20(%s)\x20block',_0x208c77['label']));if(!this[_0x6e4c('0xa3')](_0x208c77[_0x6e4c('0xca')])){return this[_0x6e4c('0x35')][_0x6e4c('0x2d')](_0x208c77,'no\x20variable\x20selected');}var _0x9015ba=this[_0x6e4c('0x11')][_0x6e4c('0x71')](this,_0x208c77[_0x6e4c('0xca')]);if(!_0x9015ba){return this['channel'][_0x6e4c('0x2d')](_0x208c77,_0x6e4c('0xcc'));}var _0x19ce22=this['channel'][_0x6e4c('0x11')](_0x9015ba);return{'code':0xc8,'result':_0x19ce22[_0x6e4c('0x9f')]?_0x19ce22[_0x6e4c('0x9f')]:'-'};};String['prototype'][_0x6e4c('0x1b2')]=function(_0x522e31,_0x50b5c1){return this[_0x6e4c('0x9c')](_0x522e31)['join'](_0x50b5c1);};module['exports']=AGIVertices; \ No newline at end of file +var _0x0c37=['sip_id','no\x20user\x20selected','getUser','no\x20user\x20found','DIAL','opts','Executed\x20command\x20%s','Enter\x20in\x20DIALOGFLOW\x20(%s)\x20block','no\x20key\x20configured','Trying\x20Dialogflow:\x20%s','DIALOGFLOW_%s','speech','out','Dialogflow\x20Result\x20%s','Dialogflow\x20is\x20unreachable','sesteknda','Enter\x20in\x20SESTEKNDA\x20(%s)\x20block','ndauth_url','no\x20ndauth\x20url\x20configured','username','no\x20password\x20configured','ndassistant_url','bot','Trying\x20SestekNDA:\x20%s','sestekNDA','SESTEK_NDA_%s','audiofile','Sestek\x20NDA\x20%s\x20file\x20created','streamFile','unlink','SestekNDA\x20is\x20unreachable','end','Enter\x20in\x20END\x20(%s)\x20block','ext_dial','Enter\x20in\x20EXTERNAL\x20DIAL\x20(%s)\x20block','trunk_id','no\x20trunk\x20found','trunk_name','no\x20trunk\x20selected','SIP/%s/%s','url','finally','Enter\x20in\x20FINALLY\x20(%s)\x20block','Enter\x20in\x20GETDIGITS\x20(%s)\x20block','file_id','response','maxdigit','test','mindigit','hiddendigitsnum','generate','hiddendigitspos','substr','Enter\x20in\x20GETSECRETDIGITS\x20(%s)\x20block','goalname','no\x20valid\x20credentials\x20configured','Trying\x20aws\x20Polly\x20%s','aws\x20Polly\x20%s\x20file\x20created','.wav','aws\x20Polly\x20is\x20unreachable','awslex','Enter\x20in\x20Amazon\x20Lex\x20(%s)\x20block','aws_bot_name','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','beep','NOBEEP','recordFile','intKey','GOOGLE_ASR_%s','Enter\x20in\x20TILDEASR\x20(%s)\x20block','no\x20appid\x20configured','wav','%s/recordings/%s','tilde\x20%s\x20file\x20created','TILDE_ASR_%s','TildeASR\x20Result\x20%s','gotoc','condition','no\x20condition\x20configured','true','false','EVAL\x20CONDITION\x20%s\x20%s','gotoiftime','interval_id','no\x20intervals\x20found','IFTIME(%s?true:false)','IFTIME\x20%s\x20%s','hangup','Enter\x20in\x20HANGUP\x20(%s)\x20block','ispeechasr','Enter\x20in\x20ISPEECHASR\x20(%s)\x20block','ISPEECH_ASR_%s','IspeechASR\x20Result\x20%s','ispeechtts','Enter\x20in\x20ISPEECHTTS\x20(%s)\x20block','Trying\x20ispeech\x20TTS\x20%s','ispeech\x20%s\x20file\x20created','ispeech\x20TTS\x20is\x20unreachable','login','Enter\x20in\x20LOGIN\x20(%s)\x20block','findBy','no\x20find\x20by\x20configured','FIND\x20AGENT\x20%s\x20BY\x20%s','AGENT\x20%s\x20FOUND\x20BY','success','AGENT\x20%s\x20NOT\x20FOUND\x20BY','failure','logout','Enter\x20in\x20LOGOUT\x20(%s)\x20block','agentLogout','math','operation','no\x20operation\x20configured','%s[%s]','variable\x20%s[key]\x20set','menu','Enter\x20in\x20MENU\x20(%s)\x20block','no\x20file\x20audio\x20selected','no\x20file\x20audio\x20found','getData','Enter\x20in\x20NOOP\x20(%s)\x20block','output','pause','getPause','pause_id','playback','Enter\x20in\x20PLAYBACK\x20(%s)\x20block','PLAYBACK','queue','Enter\x20in\x20QUEUE\x20(%s)\x20block','queue_id','no\x20queue\x20selected','no\x20queue\x20found','indexOf','XMCS-QUEUE','toLowerCase','QUEUE','gosub','position','record','Enter\x20in\x20RECORD\x20(%s)\x20block','recordingFormat','%s_%s','%s/recordings/%s.%s','RECORDING_SAVENAME','Recording\x20%s\x20%s\x20%s\x20%s','escape_digits','restapi','Enter\x20in\x20RESTAPI\x20(%s)\x20block','no\x20url\x20configured','Response:','inspect','no\x20variable\x20selected\x20for\x20the\x20response','%s_STATUS_CODE','200','Unable\x20to\x20set\x20result\x20in\x20variable\x20%s','Enter\x20in\x20SAYDIGITS\x20(%s)\x20block','sayDigits','digits','saynumber','Enter\x20in\x20SAYNUMBER\x20(%s)\x20block','sayNumber','sayphonetic','Enter\x20in\x20SAYPHONETIC\x20(%s)\x20block','sayPhonetic','Enter\x20in\x20SENDMAIL\x20(%s)\x20block','no\x20mail\x20account\x20configured','account_id','Smtp','no\x20mail\x20account\x20found','email','user','subject','service','host','port','secure','authentication','auth','template_id','sendMail\x20message','Trying\x20SendMail\x20with\x20account\x20%s','Mail\x20message\x20added\x20to\x20outgoing\x20process','sendFax','Enter\x20in\x20SENDFAX\x20(%s)\x20block','SENDFAX\x20block\x20not\x20implemented','sendSMS','Enter\x20in\x20SENDSMS\x20(%s)\x20block','sms_account_id','no\x20sms\x20account\x20configured','no\x20sms\x20account\x20found','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','yes','Answer','Skipped\x20Answer','subproject','project_id','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\x20no\x20stored','google_cloud_tts','Enter\x20in\x20Google\x20Cloud\x20TTS\x20(%s)\x20block','no\x20apiKey\x20configured','Trying\x20Google\x20Cloud\x20TTS\x20%s','Google\x20Cloud\x20TTS\x20%s\x20file\x20created','tts','Enter\x20in\x20GOOGLETTS\x20(%s)\x20block','Trying\x20Google\x20TTS\x20%s','Google\x20TTS\x20is\x20unreachable','unpause','Enter\x20in\x20UNPAUSE\x20(%s)\x20block','voicemail','Enter\x20in\x20VOICEMAIL\x20(%s)\x20block','VOICEMAIL','mailbox','vswitch','join','exports','lodash','shelljs','odbc','randomstring','moment','mustache','request-promise','agi','../../config/environment','/var/opt/motion2/server/files','rawBody','getdigits','getsecretdigits','channel','mailRpc','prototype','getVariable','getVariableById','catch','getVoiceQueue','rpc','getVoiceQueueById','then','getSquareProject','name','getSquareOdbcById','getTrunk','getTrunkById','getSound','getSoundById','getSoundPath','save_name','getMailAccount','getMailAccountById','sendMailMessage','getIntervals','getIntervalById','IntervalId','map','Intervals','interval','format','getQueryOdbc','open','error','Error\x20getting\x20ODBC\x20connection\x20%s','query','Error\x20executing\x20query\x20%s','info','Query\x20executed\x20correctly\x20%s','close','getSmsAccount','getSmsAccountById','createSmsMessage','createSquareDetailsReport','uniqueid','label','agicommand','arg_1','callerid','createSquareRecording','context','extension','priority','accountcode','dnid','createSquareMessage','createCmContact','isEmpty','isNil','callback_','lastName','scheduledAt','callback','Callback\x20scheduled\x20at\x20','toString','callback_priority','getPauseById','agentPause','agentUnpause','agent','agentLogin','internal','%s/%s@from-sip/n','exec','trim','replace','googleCloudTTS','apiKey','google_cloud_tts_text_type','text','languageCode','en-US','ssmlGender','MALE','audioEncoding','googleTTS','restAPI','method','timeout','number','includes','POST','PUT','toUpperCase','body','parse','An\x20incorrect\x20formatted\x20json\x20body\x20has\x20been\x20passed\x20to\x20the\x20function','rawHeaders','An\x20incorrect\x20formatted\x20json\x20headers\x20has\x20been\x20passed\x20to\x20the\x20function','computedVariables','sync','render','headers','stringify','statusCode','statusMessage','options','googleDialogflow','dialogflow_language','ispeechTTS','key','ispeech_tts_language','speed','ispeechASR','ispeech_asr_language','isConfigured','model','awsPolly','aws_access_key_id','aws_secret_access_key','aws_polly_region','aws_polly_voice','Amy','aws_text_type','awsLex','aws_lex_region','googleASR','tildeASR','appid','appsecret','uri','clone','replaceAllVariables','recursiveNodeIndex','hasOwnProperty','isPlainObject','isArray','isString','saveRestApiResult','%s.%s','length','setVariable','replaceObjectAllVariables','split','replaceAll','getAndSetVariable','result','The\x20\x22%s\x22\x20variable\x20value\x20is:\x20%s','extra','maxRetry','retry','Enter\x20in\x20AGI\x20(%s)\x20block','command','args','answer','Wait\x20%s\x20seconds\x20before\x20answer','wait','Enter\x20in\x20CALLBACK\x20(%s)\x20block','list_id','delay','add','minutes','noop','CALLBACK\x20added\x20phone:\x20%s\x20on\x20list:\x20%s\x20at\x20%s','phone','application','Executed\x20command\x20%s\x20%s','lumenvoxtts','Enter\x20in\x20LUMENVOXTTS\x20(%s)\x20block','MRCPSynth','Executed\x20command\x20MRCPSynth\x20%s','sestektts','Enter\x20in\x20SESTEKTTS\x20(%s)\x20block','no\x20text\x20configured','lumenvoxasr','Enter\x20in\x20LUMENVOXASR\x20(%s)\x20block','grammar','MRCPRecog','RECOG_CONFIDENCE()','LUMENVOX_ASR_CONFIDENCE','RECOG_INPUT()','LUMENVOX_ASR_TRANSCRIPT','LUMENVOX_ASR_INSTANCE','sestekasr','no\x20grammar\x20configured','SESTEK_ASR_CONFIDENCE','SESTEK_ASR_TRANSCRIPT','RECOG_INSTANCE()','Enter\x20in\x20DATABASE\x20(%s)\x20block','no\x20database\x20selected','getSquareOdbc','no\x20odbc\x20database\x20found','no\x20query\x20configured','query:\x20%s','no\x20variable\x20selected\x20for\x20the\x20result','variable_id','no\x20variable\x20found','forEach','%s[%s][%s]','%s_ROWS_COUNT','variable\x20%s\x20set','debug','Enter\x20in\x20DIAL\x20(%s)\x20block'];(function(_0x462823,_0x1540cc){var _0x28223b=function(_0x19ab1a){while(--_0x19ab1a){_0x462823['push'](_0x462823['shift']());}};_0x28223b(++_0x1540cc);}(_0x0c37,0xee));var _0x70c3=function(_0x5d1df9,_0x4a95bf){_0x5d1df9=_0x5d1df9-0x0;var _0x5d4feb=_0x0c37[_0x5d1df9];return _0x5d4feb;};'use strict';var fs=require('fs');var path=require('path');var util=require('util');var _=require(_0x70c3('0x0'));var sh=require(_0x70c3('0x1'));var odbc=require(_0x70c3('0x2'))();var rs=require(_0x70c3('0x3'));var moment=require(_0x70c3('0x4'));var Mustache=require(_0x70c3('0x5'));var rp=require(_0x70c3('0x6'));var logger=require('../../config/logger')(_0x70c3('0x7'));var config=require(_0x70c3('0x8'));var scripts=require('./scripts');var FILES_PATH=_0x70c3('0x9');var recursiveMapAttributes=['rawHeaders',_0x70c3('0xa')];var verticesWithRetry=['menu',_0x70c3('0xb'),_0x70c3('0xc')];var AGIVertices=function(_0x24b6fd,_0x3ae0a5,_0x5b2c43){this[_0x70c3('0xd')]=_0x24b6fd;this['rpc']=_0x3ae0a5;this[_0x70c3('0xe')]=_0x5b2c43;};AGIVertices[_0x70c3('0xf')][_0x70c3('0x10')]=function(_0x280726,_0x2a90eb){this['rpc'][_0x70c3('0x11')](_0x280726)['then'](function(_0x1e6a7e){_0x2a90eb(null,_0x1e6a7e?_0x1e6a7e['name']:![]);})[_0x70c3('0x12')](function(_0x4ed1ae){_0x2a90eb(_0x4ed1ae);});};AGIVertices['prototype'][_0x70c3('0x13')]=function(_0x281120,_0x2635d0){this[_0x70c3('0x14')][_0x70c3('0x15')](_0x281120)[_0x70c3('0x16')](function(_0x1e7e8c){_0x2635d0(null,_0x1e7e8c?_0x1e7e8c['name']:![]);})[_0x70c3('0x12')](function(_0x31c4a1){_0x2635d0(_0x31c4a1);});};AGIVertices[_0x70c3('0xf')][_0x70c3('0x17')]=function(_0x37843a,_0x1b435c){this[_0x70c3('0x14')]['getSquareProjectById'](_0x37843a)['then'](function(_0x497a1f){_0x1b435c(null,_0x497a1f?_0x497a1f[_0x70c3('0x18')]:![]);})[_0x70c3('0x12')](function(_0x1e6143){_0x1b435c(_0x1e6143);});};AGIVertices['prototype']['getSquareOdbc']=function(_0x5badd0,_0x418a69){this[_0x70c3('0x14')][_0x70c3('0x19')](_0x5badd0)['then'](function(_0x50bb4c){_0x418a69(null,_0x50bb4c?_0x50bb4c['dsn']:![]);})['catch'](function(_0x7f83fd){_0x418a69(_0x7f83fd);});};AGIVertices[_0x70c3('0xf')]['getUser']=function(_0x4648f1,_0x2b3767){this[_0x70c3('0x14')]['getUserById'](_0x4648f1)['then'](function(_0x7d5326){_0x2b3767(null,_0x7d5326?_0x7d5326[_0x70c3('0x18')]:![]);})['catch'](function(_0x44504d){_0x2b3767(_0x44504d);});};AGIVertices[_0x70c3('0xf')][_0x70c3('0x1a')]=function(_0x34680d,_0x1d963d){this[_0x70c3('0x14')][_0x70c3('0x1b')](_0x34680d)['then'](function(_0x32fe5d){_0x1d963d(null,_0x32fe5d?_0x32fe5d['name']:![]);})['catch'](function(_0x392992){_0x1d963d(_0x392992);});};AGIVertices[_0x70c3('0xf')][_0x70c3('0x1c')]=function(_0x355c,_0xae95d0){var _0xdb2814=this;this['rpc'][_0x70c3('0x1d')](_0x355c)[_0x70c3('0x16')](function(_0x38bba5){_0xae95d0(null,_0x38bba5?_0xdb2814[_0x70c3('0x1e')](_0x38bba5[_0x70c3('0x1f')]):![]);})[_0x70c3('0x12')](function(_0x230db3){_0xae95d0(_0x230db3);});};AGIVertices[_0x70c3('0xf')][_0x70c3('0x20')]=function(_0x270fbf,_0x5bb6d8){this[_0x70c3('0x14')][_0x70c3('0x21')](_0x270fbf)[_0x70c3('0x16')](function(_0x58faa3){_0x5bb6d8(null,_0x58faa3?_0x58faa3:![]);})[_0x70c3('0x12')](function(_0x2d289f){_0x5bb6d8(_0x2d289f);});};AGIVertices[_0x70c3('0xf')][_0x70c3('0x22')]=function(_0x73cff0,_0x10db6c,_0x143c02){this[_0x70c3('0xe')][_0x70c3('0x22')](_0x73cff0,_0x10db6c)[_0x70c3('0x16')](function(){_0x143c02(null);})[_0x70c3('0x12')](function(_0x52148a){_0x143c02(_0x52148a);});};AGIVertices[_0x70c3('0xf')][_0x70c3('0x23')]=function(_0x197496,_0x14d606){this[_0x70c3('0x14')][_0x70c3('0x24')](_0x197496)[_0x70c3('0x16')](function(_0x4c38ec){if(_0x4c38ec){if(_0x4c38ec[_0x70c3('0x25')]){_0x14d606(null,[_0x4c38ec['interval']]);}else{_0x14d606(null,_[_0x70c3('0x26')](_0x4c38ec[_0x70c3('0x27')],_0x70c3('0x28')));}}else{_0x14d606(null,![]);}})['catch'](function(_0x41c45b){_0x14d606(_0x41c45b);});};AGIVertices[_0x70c3('0xf')][_0x70c3('0x1e')]=function(_0x3f2b5a){return util[_0x70c3('0x29')]('%s/sounds/converted/%s',FILES_PATH,_0x3f2b5a);};AGIVertices[_0x70c3('0xf')][_0x70c3('0x2a')]=function(_0x2a471f,_0x339f9d,_0x45464c){odbc[_0x70c3('0x2b')](_0x2a471f,function(_0x3e4efd){if(_0x3e4efd){logger[_0x70c3('0x2c')](_0x70c3('0x2d'),_0x3e4efd);_0x45464c(_0x3e4efd);}else{logger['info']('ODBC\x20connection\x20successfully');odbc[_0x70c3('0x2e')](_0x339f9d,function(_0x197d1b,_0xbf6830){if(_0x197d1b){logger['info'](_0x70c3('0x2f'),_0x339f9d);_0x45464c(_0x197d1b);}else{logger[_0x70c3('0x30')](_0x70c3('0x31'),_0x339f9d);odbc[_0x70c3('0x32')](function(_0x18b4c9){if(_0x18b4c9){logger[_0x70c3('0x2c')]('Error\x20closing\x20connection\x20to\x20odbc\x20%s',_0x18b4c9);}_0x45464c(null,_0xbf6830);});}});}});};AGIVertices[_0x70c3('0xf')][_0x70c3('0x33')]=function(_0xb8de09,_0x2a5b74){this['rpc'][_0x70c3('0x34')](_0xb8de09)[_0x70c3('0x16')](function(_0x2ab2ce){_0x2a5b74(null,_0x2ab2ce?_0x2ab2ce:![]);})[_0x70c3('0x12')](function(_0x4543ea){_0x2a5b74(_0x4543ea);});};AGIVertices['prototype']['createSmsMessage']=function(_0x35c647,_0x42ecab){this[_0x70c3('0x14')][_0x70c3('0x35')](_0x35c647)[_0x70c3('0x16')](function(_0x21f1a8){_0x42ecab(null,_0x21f1a8);})[_0x70c3('0x12')](function(_0x15b940){_0x42ecab(_0x15b940);});};AGIVertices[_0x70c3('0xf')][_0x70c3('0x36')]=function(_0x45fcea,_0x2cceab,_0x3ffd84){this[_0x70c3('0x14')][_0x70c3('0x36')]({'uniqueid':this['channel'][_0x70c3('0x37')],'node':_0x45fcea[_0x70c3('0x38')],'application':_0x45fcea[_0x70c3('0x39')],'data':_0x2cceab||null,'project_name':this[_0x70c3('0xd')][_0x70c3('0x3a')],'callerid':this['channel'][_0x70c3('0x3b')]})[_0x70c3('0x16')](function(_0x28c36f){if(_0x3ffd84){_0x3ffd84(null,_0x28c36f);}})[_0x70c3('0x12')](function(_0x54d9cd){if(_0x3ffd84){_0x3ffd84(_0x54d9cd);}});};AGIVertices[_0x70c3('0xf')]['createSquareRecording']=function(_0x2ae874,_0x3b4549,_0x4e41e0,_0x36399d){this[_0x70c3('0x14')][_0x70c3('0x3c')]({'uniqueid':this[_0x70c3('0xd')]['uniqueid'],'callerid':this[_0x70c3('0xd')]['callerid'],'calleridname':this['channel']['calleridname'],'context':this['channel'][_0x70c3('0x3d')],'extension':this[_0x70c3('0xd')][_0x70c3('0x3e')],'priority':this[_0x70c3('0xd')][_0x70c3('0x3f')],'accountcode':this['channel'][_0x70c3('0x40')],'dnid':this[_0x70c3('0xd')][_0x70c3('0x41')],'projectName':this['channel']['arg_1'],'saveName':_0x3b4549,'filename':_0x2ae874['file']||_0x3b4549,'savePath':_0x4e41e0})[_0x70c3('0x16')](function(_0xa67c1c){_0x36399d(null,_0xa67c1c);})[_0x70c3('0x12')](function(_0x1d2d3b){_0x36399d(_0x1d2d3b);});};AGIVertices['prototype'][_0x70c3('0x42')]=function(_0x4e3201,_0x28e3d7,_0x2a56ba){this[_0x70c3('0x14')][_0x70c3('0x42')]({'uniqueid':this['channel'][_0x70c3('0x37')],'body':_0x4e3201,'direction':_0x28e3d7})[_0x70c3('0x16')](function(_0x443f50){if(_0x2a56ba){_0x2a56ba(null,_0x443f50);}})[_0x70c3('0x12')](function(_0x18502d){if(_0x2a56ba){_0x2a56ba(_0x18502d);}});};AGIVertices[_0x70c3('0xf')][_0x70c3('0x43')]=function(_0x4d971f,_0x25f035){this[_0x70c3('0x14')][_0x70c3('0x43')]({'firstName':_[_0x70c3('0x44')](_0x4d971f[_0x70c3('0x18')])||_[_0x70c3('0x45')](_0x4d971f[_0x70c3('0x18')])?_0x70c3('0x46')+Math['random']():_0x4d971f[_0x70c3('0x18')],'lastName':_['isEmpty'](_0x4d971f[_0x70c3('0x47')])||_[_0x70c3('0x45')](_0x4d971f[_0x70c3('0x47')])?null:_0x4d971f[_0x70c3('0x47')],'phone':_0x4d971f['phone'],'ListId':_0x4d971f['list_id'],'scheduledat':_0x4d971f[_0x70c3('0x48')],'callbackUniqueid':this[_0x70c3('0xd')]['uniqueid'],'tags':_0x70c3('0x49'),'description':_0x70c3('0x4a')+_0x4d971f[_0x70c3('0x48')][_0x70c3('0x4b')](),'priority':_0x4d971f[_0x70c3('0x4c')]})[_0x70c3('0x16')](function(_0x145beb){_0x25f035(null,_0x145beb);})[_0x70c3('0x12')](function(_0x48dd97){_0x25f035(_0x48dd97);});};AGIVertices[_0x70c3('0xf')]['getPause']=function(_0x4c902a,_0x5ad6f5){this['rpc'][_0x70c3('0x4d')](_0x4c902a)[_0x70c3('0x16')](function(_0x196214){_0x5ad6f5(null,_0x196214?_0x196214[_0x70c3('0x18')]:![]);})['catch'](function(_0x1b93f7){_0x5ad6f5(_0x1b93f7);});};AGIVertices['prototype'][_0x70c3('0x4e')]=function(_0x546e44,_0x502468,_0x56a2e4){var _0x590e5c={'role':'agent'};_0x590e5c[_0x546e44]=this[_0x70c3('0xd')][_0x70c3('0x3b')];this[_0x70c3('0x14')][_0x70c3('0x4e')](_0x590e5c,_0x502468,this['channel']['uniqueid'])[_0x70c3('0x16')](function(_0x387143){_0x56a2e4(null,_[_0x70c3('0x45')](_0x387143)?![]:!![]);})[_0x70c3('0x12')](function(_0x2aea3e){logger[_0x70c3('0x2c')](_0x2aea3e);_0x56a2e4(null,![]);});};AGIVertices[_0x70c3('0xf')][_0x70c3('0x4f')]=function(_0x234e18,_0x5f185a){var _0x216eda={'role':_0x70c3('0x50')};_0x216eda[_0x234e18]=this[_0x70c3('0xd')][_0x70c3('0x3b')];this['rpc'][_0x70c3('0x4f')](_0x216eda)[_0x70c3('0x16')](function(_0xb12ca4){_0x5f185a(null,_['isNil'](_0xb12ca4)?![]:!![]);})[_0x70c3('0x12')](function(_0x3ea92f){logger[_0x70c3('0x2c')](_0x3ea92f);_0x5f185a(null,![]);});};AGIVertices['prototype']['agentLogout']=function(_0x52c895,_0x3df88f){var _0x28b2f3={'role':'agent'};_0x28b2f3[_0x52c895]=this[_0x70c3('0xd')][_0x70c3('0x3b')];this['rpc']['agentLogout'](_0x28b2f3)['then'](function(_0x3593f1){_0x3df88f(null,_[_0x70c3('0x45')](_0x3593f1)?![]:!![]);})[_0x70c3('0x12')](function(_0x580d7b){logger[_0x70c3('0x2c')](_0x580d7b);_0x3df88f(null,![]);});};AGIVertices[_0x70c3('0xf')][_0x70c3('0x51')]=function(_0x664cd6,_0x3c2ea2){var _0x4faf51={'role':'agent'};_0x4faf51[_0x664cd6]=this[_0x70c3('0xd')][_0x70c3('0x3b')];var _0x5cfba2=_0x664cd6!=_0x70c3('0x52')?util[_0x70c3('0x29')](_0x70c3('0x53'),'LOCAL',this['channel']['callerid']):undefined;this['rpc'][_0x70c3('0x51')](_0x4faf51,_0x5cfba2)[_0x70c3('0x16')](function(_0x247103){_0x3c2ea2(null,_[_0x70c3('0x45')](_0x247103)?![]:!![]);})['catch'](function(_0xfe24c7){logger['error'](_0xfe24c7);_0x3c2ea2(null,![]);});};AGIVertices[_0x70c3('0xf')]['shellCommand']=function(_0x3fe8f1,_0x148408){sh[_0x70c3('0x54')](_[_0x70c3('0x55')](_0x3fe8f1),function(_0x33b000,_0x5d5a51){var _0x484338=_0x5d5a51[_0x70c3('0x56')](/(\r\n|\n|\r)/gm,'');_0x148408(null,_0x484338);});};AGIVertices['prototype'][_0x70c3('0x57')]=function(_0x2604a3,_0x563529){scripts[_0x70c3('0x57')](_0x2604a3[_0x70c3('0x58')],_0x2604a3[_0x70c3('0x59')]||_0x70c3('0x5a'),_0x2604a3[_0x70c3('0x5a')],_0x2604a3[_0x70c3('0x5b')]||_0x70c3('0x5c'),_0x2604a3[_0x70c3('0x5d')]||_0x70c3('0x5e'),_0x2604a3[_0x70c3('0x5f')]||'MP3')[_0x70c3('0x16')](function(_0x5b84cc){_0x563529(null,_0x5b84cc);})[_0x70c3('0x12')](function(_0xe81615){_0x563529(_0xe81615);});};AGIVertices[_0x70c3('0xf')]['googleTTS']=function(_0x3f76af,_0x3bcb43){scripts[_0x70c3('0x60')](_0x3f76af[_0x70c3('0x5a')],_0x3f76af['google_tts_language']||'en',0x1)[_0x70c3('0x16')](function(_0x390064){_0x3bcb43(null,_0x390064);})[_0x70c3('0x12')](function(_0x268862){_0x3bcb43(_0x268862);});};AGIVertices['prototype'][_0x70c3('0x61')]=function(_0x3090b0,_0x526a00){var _0xe9da87={'uri':_0x3090b0['url'],'method':_0x3090b0[_0x70c3('0x62')],'json':!![],'resolveWithFullResponse':!![],'timeout':typeof parseInt(_0x3090b0[_0x70c3('0x63')])===_0x70c3('0x64')&&parseInt(_0x3090b0[_0x70c3('0x63')])>=0x1?parseInt(_0x3090b0['timeout'])*0x3e8:0x5*0x3e8};if(_[_0x70c3('0x65')]([_0x70c3('0x66'),_0x70c3('0x67')],_0xe9da87[_0x70c3('0x62')][_0x70c3('0x68')]())){try{_0xe9da87[_0x70c3('0x69')]=_0x3090b0[_0x70c3('0xa')]?JSON[_0x70c3('0x6a')](_0x3090b0[_0x70c3('0xa')]):{};}catch(_0x2dd2f1){logger[_0x70c3('0x2c')](_0x70c3('0x6b'),_0x2dd2f1);}}try{_0xe9da87['headers']=_0x3090b0['rawHeaders']?JSON[_0x70c3('0x6a')](_0x3090b0[_0x70c3('0x6c')]):{};}catch(_0x4fa6b1){logger[_0x70c3('0x2c')](_0x70c3('0x6d'),_0x4fa6b1);}if(_0x3090b0[_0x70c3('0x6e')]){try{var _0x57c7cb=require(_0x3090b0[_0x70c3('0x6e')])[_0x70c3('0x6f')](this,_0xe9da87);_0xe9da87['uri']=Mustache[_0x70c3('0x70')](_0x3090b0['url'],_0x57c7cb,{},['$$','$$']);if(_0xe9da87[_0x70c3('0x71')]){_0xe9da87[_0x70c3('0x71')]=JSON['parse'](Mustache[_0x70c3('0x70')](JSON[_0x70c3('0x72')](_0xe9da87[_0x70c3('0x71')]),_0x57c7cb,{},['$$','$$']));}if(_0xe9da87[_0x70c3('0x69')]){_0xe9da87[_0x70c3('0x69')]=JSON['parse'](Mustache[_0x70c3('0x70')](JSON[_0x70c3('0x72')](_0xe9da87[_0x70c3('0x69')]),_0x57c7cb,{},['$$','$$']));}}catch(_0x5e04e6){logger[_0x70c3('0x2c')]('An\x20incorrect\x20formatted\x20json\x20has\x20been\x20passed\x20to\x20the\x20function',_0x5e04e6);}}rp(_0xe9da87)['then'](function(_0x56a4d3){var _0x3050de={'statusCode':_0x56a4d3[_0x70c3('0x73')]||0xc8,'statusMessage':_0x56a4d3[_0x70c3('0x74')]||'OK','headers':_0x56a4d3[_0x70c3('0x71')]||{},'body':_0x56a4d3[_0x70c3('0x69')]||{}};_0x526a00(null,_0x3050de);})[_0x70c3('0x12')](function(_0x1471d8){var _0x76cead={'statusCode':_0x1471d8[_0x70c3('0x73')]||0x1f4,'statusMessage':_0x1471d8['message']||'500\x20-\x20Internal\x20Server\x20Error','headers':_0x1471d8['options']['headers']||{},'body':_0x1471d8[_0x70c3('0x75')][_0x70c3('0x69')]||{}};_0x526a00(null,_0x76cead);});};AGIVertices[_0x70c3('0xf')]['googleDialogflow']=function(_0x4722e6,_0x214bfd){scripts[_0x70c3('0x76')](this[_0x70c3('0xd')]['uniqueid'],_0x4722e6['key'],_0x4722e6[_0x70c3('0x5a')],_0x4722e6[_0x70c3('0x77')]||'en')['then'](function(_0x6a5b00){_0x214bfd(null,_0x6a5b00);})[_0x70c3('0x12')](function(_0x1ec810){_0x214bfd(_0x1ec810);});};AGIVertices[_0x70c3('0xf')]['sestekNDA']=function(_0x32c498,_0x3ffe23){scripts['sestekNDA'](this[_0x70c3('0xd')],_0x32c498)['then'](function(_0x34e882){_0x3ffe23(null,_0x34e882);})[_0x70c3('0x12')](function(_0x10a6c0){_0x3ffe23(_0x10a6c0);});};AGIVertices[_0x70c3('0xf')][_0x70c3('0x78')]=function(_0x4c6f15,_0x37167b){scripts[_0x70c3('0x78')](_0x4c6f15[_0x70c3('0x79')],_0x4c6f15[_0x70c3('0x5a')],_0x4c6f15[_0x70c3('0x7a')]||_0x70c3('0x5c'),_0x4c6f15[_0x70c3('0x7b')])[_0x70c3('0x16')](function(_0x462b33){_0x37167b(null,_0x462b33);})[_0x70c3('0x12')](function(_0x34d2bc){_0x37167b(_0x34d2bc);});};AGIVertices['prototype'][_0x70c3('0x7c')]=function(_0x1275ca,_0x29679b,_0x58c86b){scripts['ispeechASR'](_0x29679b,_0x1275ca[_0x70c3('0x79')],_0x1275ca[_0x70c3('0x7d')]||_0x70c3('0x5c'),this[_0x70c3('0x7e')](_0x1275ca[_0x70c3('0x7f')])?_0x1275ca[_0x70c3('0x7f')]:undefined)[_0x70c3('0x16')](function(_0x6e7bcc){_0x58c86b(null,_0x6e7bcc);})['catch'](function(_0x320a3c){_0x58c86b(_0x320a3c);});};AGIVertices[_0x70c3('0xf')][_0x70c3('0x80')]=function(_0xf8a5d8,_0x5e2063){scripts['awsPolly'](_0xf8a5d8[_0x70c3('0x81')],_0xf8a5d8[_0x70c3('0x82')],_0xf8a5d8[_0x70c3('0x83')],_0xf8a5d8[_0x70c3('0x84')]||_0x70c3('0x85'),_0xf8a5d8['text'],_0xf8a5d8[_0x70c3('0x86')]||_0x70c3('0x5a'))[_0x70c3('0x16')](function(_0x218878){_0x5e2063(null,_0x218878);})[_0x70c3('0x12')](function(_0x82630e){_0x5e2063(_0x82630e);});};AGIVertices[_0x70c3('0xf')][_0x70c3('0x87')]=function(_0x1340db,_0x53a731){scripts[_0x70c3('0x87')](this[_0x70c3('0xd')]['uniqueid'],_0x1340db[_0x70c3('0x81')],_0x1340db[_0x70c3('0x82')],_0x1340db[_0x70c3('0x88')],_0x1340db[_0x70c3('0x5a')],_0x1340db['aws_bot_name'])['then'](function(_0x5eabf2){_0x53a731(null,_0x5eabf2);})[_0x70c3('0x12')](function(_0x34e96a){_0x53a731(_0x34e96a);});};AGIVertices[_0x70c3('0xf')][_0x70c3('0x89')]=function(_0x32cda7,_0x9f299a,_0x570d63){scripts[_0x70c3('0x89')](_0x9f299a,_0x32cda7[_0x70c3('0x79')],_0x32cda7['google_asr_language']||_0x70c3('0x5c'))[_0x70c3('0x16')](function(_0x44fb4e){_0x570d63(null,_0x44fb4e);})[_0x70c3('0x12')](function(_0x117ac5){_0x570d63(_0x117ac5);});};AGIVertices[_0x70c3('0xf')][_0x70c3('0x8a')]=function(_0x1d48ff,_0x1929c8,_0x2e4f9e){scripts['tildeASR'](_0x1929c8,_0x1d48ff[_0x70c3('0x8b')],_0x1d48ff[_0x70c3('0x8c')],_0x1d48ff[_0x70c3('0x8d')])[_0x70c3('0x16')](function(_0x4c3d11){_0x2e4f9e(null,_0x4c3d11);})[_0x70c3('0x12')](function(_0x175568){_0x2e4f9e(_0x175568);});};AGIVertices[_0x70c3('0xf')]['clear']=function(_0x46b4eb){var _0x27a3e2=_['includes'](verticesWithRetry,_0x46b4eb[_0x70c3('0x39')])?_0x46b4eb:_[_0x70c3('0x8e')](_0x46b4eb);for(var _0x5e4718 in _0x27a3e2){if(_0x27a3e2['hasOwnProperty'](_0x5e4718)){if(_0x27a3e2[_0x5e4718]&&_['isString'](_0x27a3e2[_0x5e4718])){if(_[_0x70c3('0x65')](recursiveMapAttributes,_0x5e4718)){_0x27a3e2[_0x5e4718]=this['replaceObjectAllVariables'](_0x27a3e2[_0x5e4718]);}else{_0x27a3e2[_0x5e4718]=this[_0x70c3('0x8f')](_0x27a3e2[_0x5e4718]);}}}}return _0x27a3e2;};AGIVertices[_0x70c3('0xf')][_0x70c3('0x90')]=function(_0x2e9eca){for(var _0x4b9ce8 in _0x2e9eca){if(_0x2e9eca[_0x70c3('0x91')](_0x4b9ce8)){if(_[_0x70c3('0x92')](_0x2e9eca[_0x4b9ce8])){this['recursiveNodeIndex'](_0x2e9eca[_0x4b9ce8]);}else if(_[_0x70c3('0x93')](_0x2e9eca[_0x4b9ce8])){for(var _0x22e8c2=0x0;_0x22e8c2<_0x2e9eca[_0x4b9ce8]['length'];_0x22e8c2++){this[_0x70c3('0x90')](_0x2e9eca[_0x4b9ce8][_0x22e8c2]);}}else if(_[_0x70c3('0x94')](_0x2e9eca[_0x4b9ce8])){_0x2e9eca[_0x4b9ce8]=this[_0x70c3('0x8f')](_0x2e9eca[_0x4b9ce8]);}}}};AGIVertices['prototype'][_0x70c3('0x95')]=function(_0x47e024,_0x30dda8){for(var _0x41d119 in _0x47e024){if(_0x47e024[_0x70c3('0x91')](_0x41d119)){if(_['isPlainObject'](_0x47e024[_0x41d119])){if(!_['isEmpty'](_0x47e024[_0x41d119])){this[_0x70c3('0x95')](_0x47e024[_0x41d119],util[_0x70c3('0x29')](_0x70c3('0x96'),_0x30dda8,_0x41d119));}}else if(_[_0x70c3('0x93')](_0x47e024[_0x41d119])){for(var _0x27928b=0x0;_0x27928b<_0x47e024[_0x41d119][_0x70c3('0x97')];_0x27928b++){this[_0x70c3('0x95')](_0x47e024[_0x41d119][_0x27928b],util[_0x70c3('0x29')](_0x70c3('0x96'),_0x30dda8,_0x41d119+'['+_0x27928b+']'));}}else{if(!_['isNil'](_0x47e024[_0x41d119])){this[_0x70c3('0xd')][_0x70c3('0x98')](util[_0x70c3('0x29')](_0x70c3('0x96'),_0x30dda8,_0x41d119),_0x47e024[_0x41d119]);}}}}};AGIVertices[_0x70c3('0xf')][_0x70c3('0x99')]=function(_0x39b188){try{var _0x2a8c05=JSON[_0x70c3('0x6a')](_0x39b188);this['recursiveNodeIndex'](_0x2a8c05);return JSON[_0x70c3('0x72')](_0x2a8c05);}catch(_0x2b0306){return this['replaceAllVariables'](_0x39b188);}};AGIVertices[_0x70c3('0xf')]['replaceAllVariables']=function(_0x424891){var _0x4a2367=_0x424891[_0x70c3('0x9a')]('{');for(var _0x14324e=0x1;_0x14324e<_0x4a2367[_0x70c3('0x97')];_0x14324e+=0x1){var _0x2b326c=_0x4a2367[_0x14324e][_0x70c3('0x9a')]('}');if(_0x2b326c[_0x70c3('0x97')]>0x1){_0x424891=_0x424891[_0x70c3('0x9b')]('{'+_0x2b326c[0x0]+'}',this[_0x70c3('0xd')][_0x70c3('0x10')](_0x2b326c[0x0])['extra']||_0x2b326c[0x0]);}}if(_0x4a2367['length']===0x1){return _0x424891['toString']();}return this[_0x70c3('0x8f')](_0x424891);};AGIVertices[_0x70c3('0xf')][_0x70c3('0x9c')]=function(_0x46c44e,_0x43d77b){var _0x482f3f=this['channel'][_0x70c3('0x10')](_0x46c44e);if(_0x482f3f[_0x70c3('0x9d')]===-0x1){return _0x482f3f;}logger[_0x70c3('0x30')](util[_0x70c3('0x29')](_0x70c3('0x9e'),_0x43d77b,_0x482f3f[_0x70c3('0x9f')]));return this[_0x70c3('0xd')][_0x70c3('0x98')](_0x43d77b,_0x482f3f['extra']);};AGIVertices[_0x70c3('0xf')]['isConfigured']=function(_0x2de65f){return _0x2de65f&&_0x2de65f!=='0'&&_0x2de65f!=='-1'&&_0x2de65f!=='';};AGIVertices[_0x70c3('0xf')][_0x70c3('0xa0')]=function(_0x258667){this[_0x70c3('0x36')][_0x70c3('0x6f')](this,_0x258667,'-');_0x258667[_0x70c3('0xa1')]=_0x258667[_0x70c3('0xa0')];return{'code':0xc8,'result':'-'};};AGIVertices['prototype'][_0x70c3('0x7')]=function(_0x4f1c57){logger[_0x70c3('0x30')](util[_0x70c3('0x29')](_0x70c3('0xa2'),_0x4f1c57['label']));return this[_0x70c3('0xd')][_0x70c3('0x7')]([_0x4f1c57[_0x70c3('0xa3')],_0x4f1c57[_0x70c3('0xa4')]]);};AGIVertices[_0x70c3('0xf')][_0x70c3('0xa5')]=function(_0x77e600){logger['info'](util['format']('Enter\x20in\x20ANSWER\x20(%s)\x20block',_0x77e600[_0x70c3('0x38')]));if(this[_0x70c3('0x7e')](_0x77e600['timeout'])){logger[_0x70c3('0x30')](util[_0x70c3('0x29')](_0x70c3('0xa6'),_0x77e600['timeout']));var _0x23f0a4=this['channel'][_0x70c3('0xa7')](_0x77e600[_0x70c3('0x63')]);if(_0x23f0a4['result']===-0x1){return _0x23f0a4;}}return this[_0x70c3('0xd')]['answer']();};AGIVertices[_0x70c3('0xf')][_0x70c3('0x49')]=function(_0x471138){logger[_0x70c3('0x30')](util[_0x70c3('0x29')](_0x70c3('0xa8'),_0x471138['label']));if(!this['isConfigured'](_0x471138[_0x70c3('0xa9')])){return this['channel'][_0x70c3('0x2c')](_0x471138,'no\x20list\x20selected');}_0x471138[_0x70c3('0x48')]=moment();if(this['isConfigured'](_0x471138[_0x70c3('0xaa')])){_0x471138[_0x70c3('0x48')]=moment()[_0x70c3('0xab')](_0x471138[_0x70c3('0xaa')],_0x70c3('0xac'));}if(!this[_0x70c3('0x7e')](_0x471138[_0x70c3('0x4c')])){_0x471138['callback_priority']=0x2;}this['createCmContact'][_0x70c3('0x6f')](this,_0x471138);return this[_0x70c3('0xd')][_0x70c3('0xad')](util['format'](_0x70c3('0xae'),_0x471138[_0x70c3('0xaf')],_0x471138['list_id'],_0x471138[_0x70c3('0x48')]));};AGIVertices[_0x70c3('0xf')]['custom_app']=function(_0x405346){logger['info'](util[_0x70c3('0x29')]('Enter\x20in\x20CUSTOM\x20APP\x20(%s)\x20block',_0x405346['label']));var _0x50beaa=this[_0x70c3('0xd')][_0x70c3('0x54')](_0x405346[_0x70c3('0xb0')],_0x405346[_0x70c3('0x75')]);if(_0x50beaa[_0x70c3('0x9d')]===-0x1){return _0x50beaa;}return this['channel'][_0x70c3('0xad')](util[_0x70c3('0x29')](_0x70c3('0xb1'),_0x405346[_0x70c3('0xb0')],_0x405346[_0x70c3('0x75')]));};AGIVertices['prototype'][_0x70c3('0xb2')]=function(_0x25806e){logger[_0x70c3('0x30')](util[_0x70c3('0x29')](_0x70c3('0xb3'),_0x25806e[_0x70c3('0x38')]));if(!this[_0x70c3('0x7e')](_0x25806e[_0x70c3('0x5a')])){return this['channel'][_0x70c3('0xad')]('no\x20text\x20configured');}var _0x5c75ff='\x22'+_0x25806e['text']+'\x22';if(this[_0x70c3('0x7e')](_0x25806e[_0x70c3('0x75')])){_0x5c75ff+=','+_0x25806e[_0x70c3('0x75')];}var _0x46f5ec=this[_0x70c3('0xd')][_0x70c3('0x54')](_0x70c3('0xb4'),_0x5c75ff);if(_0x46f5ec[_0x70c3('0x9d')]===-0x1){return _0x46f5ec;}return this[_0x70c3('0xd')][_0x70c3('0xad')](util[_0x70c3('0x29')](_0x70c3('0xb5'),_0x5c75ff));};AGIVertices['prototype'][_0x70c3('0xb6')]=function(_0x13cf9e){logger[_0x70c3('0x30')](util[_0x70c3('0x29')](_0x70c3('0xb7'),_0x13cf9e['label']));if(!this['isConfigured'](_0x13cf9e[_0x70c3('0x5a')])){return this[_0x70c3('0xd')][_0x70c3('0xad')](_0x70c3('0xb8'));}var _0x17a492='\x22'+_0x13cf9e['text']+'\x22';if(this[_0x70c3('0x7e')](_0x13cf9e[_0x70c3('0x75')])){_0x17a492+=','+_0x13cf9e[_0x70c3('0x75')];}var _0x5d5a64=this[_0x70c3('0xd')][_0x70c3('0x54')](_0x70c3('0xb4'),_0x17a492);if(_0x5d5a64[_0x70c3('0x9d')]===-0x1){return _0x5d5a64;}return this['channel'][_0x70c3('0xad')](util[_0x70c3('0x29')](_0x70c3('0xb5'),_0x17a492));};AGIVertices[_0x70c3('0xf')][_0x70c3('0xb9')]=function(_0x549884){logger[_0x70c3('0x30')](util['format'](_0x70c3('0xba'),_0x549884['label']));if(!this[_0x70c3('0x7e')](_0x549884[_0x70c3('0xbb')])){return this[_0x70c3('0xd')][_0x70c3('0xad')]('no\x20grammar\x20configured');}var _0x1306ca=_0x549884[_0x70c3('0xbb')];if(this[_0x70c3('0x7e')](_0x549884[_0x70c3('0x75')])){_0x1306ca+=','+_0x549884[_0x70c3('0x75')];}var _0x58b762=this[_0x70c3('0xd')][_0x70c3('0x54')](_0x70c3('0xbc'),_0x1306ca);if(_0x58b762[_0x70c3('0x9d')]===-0x1){return _0x58b762;}var _0x42fe0a=this[_0x70c3('0x9c')](_0x70c3('0xbd'),_0x70c3('0xbe'));if(_0x42fe0a['result']===-0x1){return _0x42fe0a;}var _0x389fd8=this[_0x70c3('0x9c')](_0x70c3('0xbf'),_0x70c3('0xc0'));if(_0x389fd8[_0x70c3('0x9d')]===-0x1){return _0x389fd8;}var _0x4f69d2=this[_0x70c3('0x9c')]('RECOG_INSTANCE()',_0x70c3('0xc1'));if(_0x4f69d2[_0x70c3('0x9d')]===-0x1){return _0x4f69d2;}return this['channel'][_0x70c3('0xad')](util[_0x70c3('0x29')]('Executed\x20command\x20MRCPRecog\x20%s',_0x1306ca));};AGIVertices['prototype'][_0x70c3('0xc2')]=function(_0x72c5){logger[_0x70c3('0x30')](util[_0x70c3('0x29')]('Enter\x20in\x20SESTEKASR\x20(%s)\x20block',_0x72c5[_0x70c3('0x38')]));if(!this[_0x70c3('0x7e')](_0x72c5[_0x70c3('0xbb')])){return this[_0x70c3('0xd')][_0x70c3('0xad')](_0x70c3('0xc3'));}var _0x3f9fb5=_0x72c5['grammar'];if(this[_0x70c3('0x7e')](_0x72c5['options'])){_0x3f9fb5+=','+_0x72c5[_0x70c3('0x75')];}var _0x523f66=this['channel']['exec'](_0x70c3('0xbc'),_0x3f9fb5);if(_0x523f66[_0x70c3('0x9d')]===-0x1){return _0x523f66;}var _0x45446e=this[_0x70c3('0x9c')]('RECOG_CONFIDENCE()',_0x70c3('0xc4'));if(_0x45446e[_0x70c3('0x9d')]===-0x1){return _0x45446e;}var _0x15ca73=this['getAndSetVariable']('RECOG_INPUT()',_0x70c3('0xc5'));if(_0x15ca73[_0x70c3('0x9d')]===-0x1){return _0x15ca73;}var _0x5f820f=this['getAndSetVariable'](_0x70c3('0xc6'),'SESTEK_ASR_INSTANCE');if(_0x5f820f[_0x70c3('0x9d')]===-0x1){return _0x5f820f;}return this[_0x70c3('0xd')][_0x70c3('0xad')](util[_0x70c3('0x29')]('Executed\x20command\x20MRCPRecog\x20%s',_0x3f9fb5));};AGIVertices[_0x70c3('0xf')]['database']=function(_0x350ba7){logger[_0x70c3('0x30')](util[_0x70c3('0x29')](_0x70c3('0xc7'),_0x350ba7[_0x70c3('0x38')]));if(!this[_0x70c3('0x7e')](_0x350ba7['odbc_id'])){return this[_0x70c3('0xd')]['error'](_0x350ba7,_0x70c3('0xc8'));}var _0x3de6a3=this[_0x70c3('0xc9')][_0x70c3('0x6f')](this,_0x350ba7['odbc_id']);if(!_0x3de6a3){return this['channel'][_0x70c3('0x2c')](_0x350ba7,_0x70c3('0xca'));}if(!this[_0x70c3('0x7e')](_0x350ba7[_0x70c3('0x2e')])){return this[_0x70c3('0xd')][_0x70c3('0x2c')](_0x350ba7,_0x70c3('0xcb'));}var _0x3a6b25=_0x350ba7[_0x70c3('0x2e')][_0x70c3('0x56')](/(\r\n|\n|\r)/gm,'\x20');this['channel'][_0x70c3('0xad')](util['format'](_0x70c3('0xcc'),_0x3a6b25));var _0x5f2580=this['getQueryOdbc'][_0x70c3('0x6f')](this,_0x3de6a3,_0x3a6b25);this[_0x70c3('0x36')][_0x70c3('0x6f')](this,_0x350ba7,_0x3a6b25);if(!this[_0x70c3('0x7e')](_0x350ba7['variable_id'])){return this['channel']['noop'](_0x70c3('0xcd'));}var _0x2b404a=this['getVariable'][_0x70c3('0x6f')](this,_0x350ba7[_0x70c3('0xce')]);if(!_0x2b404a){return this[_0x70c3('0xd')][_0x70c3('0x2c')](_0x350ba7,_0x70c3('0xcf'));}var _0x2963b6=this;_0x5f2580[_0x70c3('0xd0')](function(_0x49080d,_0x22c27e){Object['keys'](_0x49080d)['forEach'](function(_0x1a18ea){_0x2963b6[_0x70c3('0xd')]['setVariable'](util[_0x70c3('0x29')](_0x70c3('0xd1'),_0x2b404a,_0x22c27e,_0x1a18ea),_0x49080d[_0x1a18ea]);});});this[_0x70c3('0xd')][_0x70c3('0x98')](util[_0x70c3('0x29')](_0x70c3('0xd2'),_0x2b404a),_0x5f2580['length']);return this['channel'][_0x70c3('0xad')](util['format'](_0x70c3('0xd3'),_0x2b404a));};AGIVertices[_0x70c3('0xf')]['dial']=function(_0x1fe988){logger[_0x70c3('0xd4')](util[_0x70c3('0x29')](_0x70c3('0xd5'),_0x1fe988[_0x70c3('0x38')]));if(!this[_0x70c3('0x7e')](_0x1fe988[_0x70c3('0xd6')])){return this[_0x70c3('0xd')]['error'](_0x1fe988,_0x70c3('0xd7'));}var _0x5830f1=this[_0x70c3('0xd8')][_0x70c3('0x6f')](this,_0x1fe988['sip_id']);if(!_0x5830f1){return this[_0x70c3('0xd')][_0x70c3('0x2c')](_0x1fe988,_0x70c3('0xd9'));}var _0x3a4445=this[_0x70c3('0xd')][_0x70c3('0x54')](_0x70c3('0xda'),[util[_0x70c3('0x29')]('SIP/%s',_0x5830f1),_0x1fe988['timeout'],_0x1fe988[_0x70c3('0xdb')],_0x1fe988['url']]);if(_0x3a4445[_0x70c3('0x9d')]===-0x1){return _0x3a4445;}return this[_0x70c3('0xd')][_0x70c3('0xad')](util[_0x70c3('0x29')](_0x70c3('0xdc'),_0x70c3('0xda')));};AGIVertices['prototype']['dialogflow']=function(_0x1da734){logger[_0x70c3('0x30')](util[_0x70c3('0x29')](_0x70c3('0xdd'),_0x1da734[_0x70c3('0x38')]));if(!this[_0x70c3('0x7e')](_0x1da734[_0x70c3('0x79')])){return this[_0x70c3('0xd')][_0x70c3('0xad')](_0x70c3('0xde'));}if(!this[_0x70c3('0x7e')](_0x1da734['text'])){return this[_0x70c3('0xd')][_0x70c3('0xad')](_0x70c3('0xb8'));}this[_0x70c3('0xd')]['bot']=!![];this['createSquareDetailsReport'](_0x1da734);this[_0x70c3('0x42')](_0x1da734['text'],'in');this['channel'][_0x70c3('0xad')](util[_0x70c3('0x29')](_0x70c3('0xdf'),_0x1da734[_0x70c3('0x5a')]));var _0x306991=this[_0x70c3('0x76')][_0x70c3('0x6f')](this,_0x1da734);if(_0x306991){for(var _0x33e5b9 in _0x306991){if(_0x306991['hasOwnProperty'](_0x33e5b9)){this[_0x70c3('0xd')][_0x70c3('0x98')](util['format'](_0x70c3('0xe0'),_0x33e5b9[_0x70c3('0x68')]()),_0x306991[_0x33e5b9]);}}this[_0x70c3('0x42')](_0x306991[_0x70c3('0xe1')],_0x70c3('0xe2'));return this[_0x70c3('0xd')][_0x70c3('0xad')](util[_0x70c3('0x29')](_0x70c3('0xe3'),_0x306991[_0x70c3('0xe1')]));}return this[_0x70c3('0xd')]['error'](_0x1da734,_0x70c3('0xe4'));};AGIVertices[_0x70c3('0xf')][_0x70c3('0xe5')]=function(_0x3446da){logger[_0x70c3('0x30')](util[_0x70c3('0x29')](_0x70c3('0xe6'),_0x3446da[_0x70c3('0x38')]));if(!this[_0x70c3('0x7e')](_0x3446da[_0x70c3('0xe7')])){return this[_0x70c3('0xd')][_0x70c3('0xad')](_0x70c3('0xe8'));}if(!this[_0x70c3('0x7e')](_0x3446da[_0x70c3('0xe9')])){return this[_0x70c3('0xd')]['noop']('no\x20username\x20configured');}if(!this[_0x70c3('0x7e')](_0x3446da['password'])){return this[_0x70c3('0xd')][_0x70c3('0xad')](_0x70c3('0xea'));}if(!this[_0x70c3('0x7e')](_0x3446da[_0x70c3('0xeb')])){return this['channel'][_0x70c3('0xad')]('no\x20text\x20configured');}this[_0x70c3('0xd')][_0x70c3('0xec')]=!![];this[_0x70c3('0x36')](_0x3446da);this[_0x70c3('0x42')](_0x3446da[_0x70c3('0x5a')],'in');this[_0x70c3('0xd')]['noop'](util['format'](_0x70c3('0xed'),_0x3446da[_0x70c3('0x5a')]));var _0x1e288a=this[_0x70c3('0xee')][_0x70c3('0x6f')](this,_0x3446da);if(_0x1e288a){for(var _0x4b40ba in _0x1e288a){if(_0x1e288a['hasOwnProperty'](_0x4b40ba)){this['channel']['setVariable'](util['format'](_0x70c3('0xef'),_0x4b40ba[_0x70c3('0x68')]()),_0x1e288a[_0x4b40ba]);}}this[_0x70c3('0x42')](_0x1e288a[_0x70c3('0xe1')],_0x70c3('0xe2'));if(_0x1e288a[_0x70c3('0xf0')]){this['channel']['noop'](util['format'](_0x70c3('0xf1'),_0x1e288a[_0x70c3('0xf0')]));var _0x427bb7=this[_0x70c3('0xd')][_0x70c3('0xf2')](_0x1e288a[_0x70c3('0xf0')]);try{fs[_0x70c3('0xf3')](_0x1e288a[_0x70c3('0xf0')]+'.wav');}catch(_0x323f4b){logger['error'](_0x323f4b);}return _0x427bb7;}else{return this[_0x70c3('0xd')][_0x70c3('0xad')](util[_0x70c3('0x29')]('SestekNDA\x20Result\x20%s',_0x1e288a['speech']));}}return this['channel'][_0x70c3('0x2c')](_0x3446da,_0x70c3('0xf4'));};AGIVertices['prototype'][_0x70c3('0xf5')]=function(_0x5b69af){logger['info'](util[_0x70c3('0x29')](_0x70c3('0xf6'),_0x5b69af[_0x70c3('0x38')]));return this['channel']['noop'](_0x70c3('0xf5'));};AGIVertices[_0x70c3('0xf')][_0x70c3('0xf7')]=function(_0x569ec7){logger[_0x70c3('0x30')](util['format'](_0x70c3('0xf8'),_0x569ec7[_0x70c3('0x38')]));var _0x3b0563='';if(_0x569ec7['trunk_id']){if(!this['isConfigured'](_0x569ec7[_0x70c3('0xf9')])){return this[_0x70c3('0xd')][_0x70c3('0x2c')](_0x569ec7,'no\x20trunk\x20selected');}else{var _0x4c1e4a=parseInt(_0x569ec7['trunk_id'],0xa);if(isNaN(_0x4c1e4a)){_0x3b0563=_0x569ec7[_0x70c3('0xf9')];}else{_0x3b0563=this[_0x70c3('0x1a')][_0x70c3('0x6f')](this,_0x569ec7[_0x70c3('0xf9')]);if(!_0x3b0563){return this[_0x70c3('0xd')][_0x70c3('0x2c')](_0x569ec7,_0x70c3('0xfa'));}}}}else if(_0x569ec7['trunk_name']){_0x3b0563=_0x569ec7[_0x70c3('0xfb')];}else{return this[_0x70c3('0xd')]['error'](_0x569ec7,_0x70c3('0xfc'));}var _0x3dbc5e=this[_0x70c3('0xd')][_0x70c3('0x54')](_0x70c3('0xda'),[util['format'](_0x70c3('0xfd'),_0x3b0563,_0x569ec7['phone']),_0x569ec7[_0x70c3('0x63')],_0x569ec7[_0x70c3('0xdb')],_0x569ec7[_0x70c3('0xfe')]]);if(_0x3dbc5e[_0x70c3('0x9d')]===-0x1){return _0x3dbc5e;}return this[_0x70c3('0xd')][_0x70c3('0xad')](util[_0x70c3('0x29')](_0x70c3('0xdc'),_0x70c3('0xda')));};AGIVertices['prototype'][_0x70c3('0xff')]=function(_0x208f88){logger[_0x70c3('0x30')](util['format'](_0x70c3('0x100'),_0x208f88['label']));return this[_0x70c3('0xd')][_0x70c3('0xad')](_0x70c3('0xff'));};AGIVertices[_0x70c3('0xf')]['getdigits']=function(_0x320076){logger[_0x70c3('0x30')](util[_0x70c3('0x29')](_0x70c3('0x101'),_0x320076[_0x70c3('0x38')]));if(_0x320076[_0x70c3('0xa1')]===0x0){return this[_0x70c3('0xa0')](_0x320076);}_0x320076[_0x70c3('0xa1')]-=0x1;if(!this[_0x70c3('0x7e')](_0x320076[_0x70c3('0x102')])){return this[_0x70c3('0xd')][_0x70c3('0x2c')](_0x320076,'no\x20file\x20audio\x20selected');}var _0x12e78c=this[_0x70c3('0x1c')][_0x70c3('0x6f')](this,_0x320076[_0x70c3('0x102')]);if(!_0x12e78c){return this[_0x70c3('0xd')][_0x70c3('0x2c')](_0x320076,'no\x20file\x20audio\x20found');}if(!this[_0x70c3('0x7e')](_0x320076[_0x70c3('0xce')])){return this[_0x70c3('0xd')][_0x70c3('0x2c')](_0x70c3('0xcd'));}var _0x14bbe6=this[_0x70c3('0xd')]['getData'](_0x12e78c,_0x320076[_0x70c3('0x103')],_0x320076[_0x70c3('0x104')]);var _0x57d4de=_0x14bbe6[_0x70c3('0x9d')]?_0x14bbe6[_0x70c3('0x9d')][_0x70c3('0x4b')]():'';logger[_0x70c3('0x30')](_0x70c3('0x105'),JSON['stringify'](_0x14bbe6));if(_0x14bbe6[_0x70c3('0x9d')]===-0x1){this[_0x70c3('0x36')][_0x70c3('0x6f')](this,_0x320076,_0x57d4de);return _0x14bbe6;}else if(_0x14bbe6['extra']===_0x70c3('0x63')){_0x14bbe6[_0x70c3('0x9d')]=_0x57d4de[_0x70c3('0x97')]>=parseInt(_0x320076[_0x70c3('0x106')])?'x':'i';}else{_0x14bbe6[_0x70c3('0x9d')]=_0x57d4de['length']>=parseInt(_0x320076[_0x70c3('0x106')])&&_0x57d4de[_0x70c3('0x97')]<=parseInt(_0x320076[_0x70c3('0x104')])?'x':'i';}var _0x2fec81=this['getVariable'][_0x70c3('0x6f')](this,_0x320076['variable_id']);if(!_0x2fec81){return this[_0x70c3('0xd')]['error'](_0x320076,_0x70c3('0xcf'));}this[_0x70c3('0xd')][_0x70c3('0x98')](_0x2fec81,_0x57d4de);if(this[_0x70c3('0x7e')](_0x320076[_0x70c3('0x107')])){var _0x44c74b=parseInt(_0x320076['hiddendigitsnum'],0xa);var _0x4c1758=rs[_0x70c3('0x108')]({'charset':'*','length':_0x44c74b});var _0x4d88dc=_0x57d4de[_0x70c3('0x97')];if(_0x4d88dc>0x0){if(_0x4d88dc>_0x44c74b){this['createSquareDetailsReport']['sync'](this,_0x320076,_0x320076[_0x70c3('0x109')]==='first'?_0x4c1758+_0x57d4de[_0x70c3('0x10a')](_0x44c74b):_0x57d4de[_0x70c3('0x10a')](0x0,_0x4d88dc-_0x44c74b)+_0x4c1758);}else{this[_0x70c3('0x36')]['sync'](this,_0x320076,rs[_0x70c3('0x108')]({'charset':'*','length':_0x4d88dc}));}}else{this[_0x70c3('0x36')][_0x70c3('0x6f')](this,_0x320076,'');}}else{this[_0x70c3('0x36')][_0x70c3('0x6f')](this,_0x320076,_0x57d4de);}return _0x14bbe6;};AGIVertices['prototype'][_0x70c3('0xc')]=function(_0x15d58d){logger['info'](util[_0x70c3('0x29')](_0x70c3('0x10b'),_0x15d58d[_0x70c3('0x38')]));return this[_0x70c3('0xb')](_0x15d58d);};AGIVertices[_0x70c3('0xf')]['goal']=function(_0x36b7ce){logger[_0x70c3('0x30')](util[_0x70c3('0x29')]('Enter\x20in\x20GOAL\x20(%s)\x20block',_0x36b7ce['label']));this[_0x70c3('0x36')][_0x70c3('0x6f')](this,_0x36b7ce,_0x36b7ce['goalname']);return this[_0x70c3('0xd')][_0x70c3('0xad')](util[_0x70c3('0x29')]('GOAL\x20%s',_0x36b7ce[_0x70c3('0x10c')]));};AGIVertices['prototype']['awspolly']=function(_0x653f0d){logger[_0x70c3('0x30')](util[_0x70c3('0x29')]('[AGI]\x20Enter\x20in\x20AWSPOLLY\x20(%s)\x20block',_0x653f0d['label']));if(!this[_0x70c3('0x7e')](_0x653f0d['aws_access_key_id'])||!this[_0x70c3('0x7e')](_0x653f0d['aws_secret_access_key'])){return this['channel'][_0x70c3('0xad')](_0x70c3('0x10d'));}if(!this['isConfigured'](_0x653f0d[_0x70c3('0x5a')])){return this['channel'][_0x70c3('0xad')](_0x70c3('0xb8'));}this[_0x70c3('0xd')][_0x70c3('0xad')](util[_0x70c3('0x29')](_0x70c3('0x10e'),_0x653f0d[_0x70c3('0x5a')]));var _0x5a8878=this[_0x70c3('0x80')]['sync'](this,_0x653f0d);if(_0x5a8878){this[_0x70c3('0xd')][_0x70c3('0xad')](util[_0x70c3('0x29')](_0x70c3('0x10f'),_0x5a8878));var _0x56204e=this[_0x70c3('0xd')][_0x70c3('0xf2')](_0x5a8878);try{fs[_0x70c3('0xf3')](_0x5a8878+_0x70c3('0x110'));}catch(_0x2c86ee){logger[_0x70c3('0x2c')](_0x2c86ee);}return _0x56204e;}return this[_0x70c3('0xd')][_0x70c3('0x2c')](_0x653f0d,_0x70c3('0x111'));};AGIVertices['prototype'][_0x70c3('0x112')]=function(_0x38e6f){logger['info'](util[_0x70c3('0x29')](_0x70c3('0x113'),_0x38e6f[_0x70c3('0x38')]));if(!this['isConfigured'](_0x38e6f['aws_access_key_id'])||!this[_0x70c3('0x7e')](_0x38e6f[_0x70c3('0x82')])){return this['channel'][_0x70c3('0xad')]('no\x20valid\x20credentials\x20configured');}if(!this['isConfigured'](_0x38e6f[_0x70c3('0x114')])){return this[_0x70c3('0xd')][_0x70c3('0xad')](_0x70c3('0x115'));}if(!this[_0x70c3('0x7e')](_0x38e6f[_0x70c3('0x5a')])){return this[_0x70c3('0xd')]['noop'](_0x70c3('0xb8'));}this['channel']['bot']=!![];this['createSquareDetailsReport'](_0x38e6f);this[_0x70c3('0x42')](_0x38e6f[_0x70c3('0x5a')],'in');this[_0x70c3('0xd')][_0x70c3('0xad')](util[_0x70c3('0x29')](_0x70c3('0x116'),_0x38e6f[_0x70c3('0x5a')]));var _0x486e36=this[_0x70c3('0x87')][_0x70c3('0x6f')](this,_0x38e6f);if(_0x486e36){for(var _0x2f27ba in _0x486e36){if(_0x486e36[_0x70c3('0x91')](_0x2f27ba)&&_['isString'](_0x486e36[_0x2f27ba])){this['channel'][_0x70c3('0x98')](util[_0x70c3('0x29')](_0x70c3('0x117'),_0x2f27ba[_0x70c3('0x68')]()),_0x486e36[_0x2f27ba]);}}if(_[_0x70c3('0x45')](_0x486e36[_0x70c3('0x118')])){return this[_0x70c3('0xd')][_0x70c3('0xad')](_0x70c3('0x119'));}else{this[_0x70c3('0x42')](_0x486e36[_0x70c3('0x118')],_0x70c3('0xe2'));return this['channel'][_0x70c3('0xad')](util[_0x70c3('0x29')](_0x70c3('0x11a'),_0x486e36[_0x70c3('0x118')]));}}return this[_0x70c3('0xd')][_0x70c3('0x2c')](_0x38e6f,_0x70c3('0x11b'));};AGIVertices[_0x70c3('0xf')][_0x70c3('0x11c')]=function(_0x4ee0f9){logger[_0x70c3('0x30')](util[_0x70c3('0x29')](_0x70c3('0x11d'),_0x4ee0f9['label'],_0x4ee0f9[_0x70c3('0x63')]));if(!this[_0x70c3('0x7e')](_0x4ee0f9[_0x70c3('0x79')])){return this[_0x70c3('0xd')][_0x70c3('0xad')](_0x70c3('0xde'));}var _0x4cd26b='wav';var _0x207eca=util[_0x70c3('0x29')]('%s/recordings/%s',FILES_PATH,rs[_0x70c3('0x108')](0x4));var _0x58aaea=util['format'](_0x70c3('0x96'),_0x207eca,_0x4cd26b);var _0x205d38=!![];if(_0x4ee0f9[_0x70c3('0x11e')]===_0x70c3('0x11f')){_0x205d38=![];}var _0x8a34ee=this[_0x70c3('0xd')][_0x70c3('0x120')](_0x207eca,_0x4cd26b,_0x4ee0f9[_0x70c3('0x121')],_0x4ee0f9[_0x70c3('0x63')],undefined,_0x205d38);if(_0x8a34ee[_0x70c3('0x9d')]!==-0x1){this[_0x70c3('0xd')][_0x70c3('0xad')](util[_0x70c3('0x29')]('google\x20%s\x20file\x20created',_0x58aaea));var _0x4057c1=this[_0x70c3('0x89')][_0x70c3('0x6f')](this,_0x4ee0f9,_0x58aaea);if(_0x4057c1){for(var _0x345258 in _0x4057c1){if(_0x4057c1[_0x70c3('0x91')](_0x345258)){this['channel'][_0x70c3('0x98')](util[_0x70c3('0x29')](_0x70c3('0x122'),_0x345258[_0x70c3('0x68')]()),_0x4057c1[_0x345258]);}}return this['channel']['noop'](util[_0x70c3('0x29')]('GoogleASR\x20Result\x20%s',JSON[_0x70c3('0x72')](_0x4057c1)));}}return _0x8a34ee;};AGIVertices['prototype']['tildeasr']=function(_0x4bb099){logger[_0x70c3('0x30')](util[_0x70c3('0x29')](_0x70c3('0x123'),_0x4bb099[_0x70c3('0x38')]));if(!this[_0x70c3('0x7e')](_0x4bb099[_0x70c3('0x8b')])){return this[_0x70c3('0xd')][_0x70c3('0xad')](_0x70c3('0x124'));}if(!this[_0x70c3('0x7e')](_0x4bb099[_0x70c3('0x8c')])){return this[_0x70c3('0xd')][_0x70c3('0xad')]('no\x20appsecret\x20configured');}var _0x43c376=_0x70c3('0x125');var _0x1f4244=util[_0x70c3('0x29')](_0x70c3('0x126'),FILES_PATH,rs[_0x70c3('0x108')](0x4));var _0x26e138=util[_0x70c3('0x29')](_0x70c3('0x96'),_0x1f4244,_0x43c376);var _0x2a1dce=!![];if(_0x4bb099[_0x70c3('0x11e')]==='NOBEEP'){_0x2a1dce=![];}var _0x35b361=this[_0x70c3('0xd')][_0x70c3('0x120')](_0x1f4244,_0x43c376,_0x4bb099[_0x70c3('0x121')],_0x4bb099['timeout'],undefined,_0x2a1dce);if(_0x35b361['result']!==-0x1){this[_0x70c3('0xd')][_0x70c3('0xad')](util['format'](_0x70c3('0x127'),_0x26e138));var _0x11c70f=this['tildeASR'][_0x70c3('0x6f')](this,_0x4bb099,_0x26e138);if(_0x11c70f){for(var _0x547a1b in _0x11c70f){if(_0x11c70f[_0x70c3('0x91')](_0x547a1b)){this[_0x70c3('0xd')][_0x70c3('0x98')](util[_0x70c3('0x29')](_0x70c3('0x128'),_0x547a1b['toUpperCase']()),_0x11c70f[_0x547a1b]);}}return this[_0x70c3('0xd')]['noop'](util[_0x70c3('0x29')](_0x70c3('0x129'),JSON[_0x70c3('0x72')](_0x11c70f)));}}return _0x35b361;};AGIVertices[_0x70c3('0xf')][_0x70c3('0x12a')]=function(_0x153ba5){logger[_0x70c3('0x30')](util['format']('Enter\x20in\x20GOTO\x20(%s)\x20block',_0x153ba5[_0x70c3('0x38')]));return this[_0x70c3('0xd')]['continueAt'](_0x153ba5[_0x70c3('0x3d')],_0x153ba5[_0x70c3('0x3e')],_0x153ba5[_0x70c3('0x3f')]);};AGIVertices[_0x70c3('0xf')]['gotoif']=function(_0x10c4ee){logger[_0x70c3('0x30')](util['format']('Enter\x20in\x20GOTOIF\x20(%s)\x20block',_0x10c4ee[_0x70c3('0x38')]));if(!this[_0x70c3('0x7e')](_0x10c4ee[_0x70c3('0x12b')])){return this[_0x70c3('0xd')][_0x70c3('0x2c')](_0x10c4ee,_0x70c3('0x12c'));}try{var _0x10057b=eval(_0x10c4ee[_0x70c3('0x12b')])?_0x70c3('0x12d'):_0x70c3('0x12e');this[_0x70c3('0xd')]['noop'](util[_0x70c3('0x29')](_0x70c3('0x12f'),_0x10c4ee[_0x70c3('0x12b')],_0x10057b));return{'code':0xc8,'result':_0x10057b};}catch(_0x1f9813){return{'code':0xc8,'result':'false'};}};AGIVertices[_0x70c3('0xf')][_0x70c3('0x130')]=function(_0x4791ca){logger[_0x70c3('0x30')](util['format']('Enter\x20in\x20GOTOIFTIME\x20(%s)\x20block',_0x4791ca[_0x70c3('0x38')]));if(!this[_0x70c3('0x7e')](_0x4791ca['interval_id'])){return this['channel']['error'](_0x4791ca,'no\x20interval\x20configured');}var _0x5cb30d=this[_0x70c3('0x23')][_0x70c3('0x6f')](this,_0x4791ca[_0x70c3('0x131')]);if(!_0x5cb30d){return this[_0x70c3('0xd')][_0x70c3('0x2c')](_0x4791ca,_0x70c3('0x132'));}for(var _0x3c3e64=0x0;_0x3c3e64<_0x5cb30d[_0x70c3('0x97')];_0x3c3e64+=0x1){var _0x4010f4=this[_0x70c3('0xd')]['getVariable'](util[_0x70c3('0x29')](_0x70c3('0x133'),_0x5cb30d[_0x3c3e64]));if(_0x4010f4['result']===-0x1){return _0x4010f4;}logger[_0x70c3('0x30')](util[_0x70c3('0x29')]('IFTIME\x20%s\x20%s',_0x5cb30d[_0x3c3e64],_0x4010f4[_0x70c3('0x9f')]));if(_0x4010f4[_0x70c3('0x9f')]===_0x70c3('0x12d')){logger[_0x70c3('0x30')](util['format'](_0x70c3('0x134'),_0x5cb30d[_0x3c3e64],'true'));this[_0x70c3('0xd')][_0x70c3('0xad')](util[_0x70c3('0x29')]('IFTIME\x20%s\x20%s',_0x5cb30d[_0x3c3e64],'true'));return{'code':0xc8,'result':'true'};}else{logger[_0x70c3('0x30')](util[_0x70c3('0x29')](_0x70c3('0x134'),_0x5cb30d[_0x3c3e64],'false'));this['channel'][_0x70c3('0xad')](util[_0x70c3('0x29')](_0x70c3('0x134'),_0x5cb30d[_0x3c3e64],_0x70c3('0x12e')));}}return{'code':0xc8,'result':_0x70c3('0x12e')};};AGIVertices[_0x70c3('0xf')][_0x70c3('0x135')]=function(_0x52c2c7){logger['info'](util[_0x70c3('0x29')](_0x70c3('0x136'),_0x52c2c7[_0x70c3('0x38')]));return this[_0x70c3('0xd')][_0x70c3('0x135')]();};AGIVertices[_0x70c3('0xf')][_0x70c3('0x137')]=function(_0xdf1555){logger[_0x70c3('0x30')](util[_0x70c3('0x29')](_0x70c3('0x138'),_0xdf1555[_0x70c3('0x38')]));if(!this['isConfigured'](_0xdf1555[_0x70c3('0x79')])){return this[_0x70c3('0xd')]['noop'](_0x70c3('0xde'));}var _0x592efb=_0x70c3('0x125');var _0x983f72=util['format'](_0x70c3('0x126'),FILES_PATH,rs['generate'](0x4));var _0x4150d8=util[_0x70c3('0x29')]('%s.%s',_0x983f72,_0x592efb);var _0x2d222f=!![];if(_0xdf1555['beep']==='NOBEEP'){_0x2d222f=![];}var _0x31e11f=this[_0x70c3('0xd')]['recordFile'](_0x983f72,_0x592efb,_0xdf1555[_0x70c3('0x121')],_0xdf1555['timeout'],undefined,_0x2d222f);if(_0x31e11f[_0x70c3('0x9d')]!==-0x1){this[_0x70c3('0xd')][_0x70c3('0xad')](util[_0x70c3('0x29')]('ispeech\x20%s\x20file\x20created',_0x4150d8));var _0x3e8423=this[_0x70c3('0x7c')]['sync'](this,_0xdf1555,_0x4150d8);if(_0x3e8423){for(var _0x1df144 in _0x3e8423){if(_0x3e8423['hasOwnProperty'](_0x1df144)){this['channel'][_0x70c3('0x98')](util[_0x70c3('0x29')](_0x70c3('0x139'),_0x1df144['toUpperCase']()),_0x3e8423[_0x1df144]);}}return this[_0x70c3('0xd')][_0x70c3('0xad')](util['format'](_0x70c3('0x13a'),JSON[_0x70c3('0x72')](_0x3e8423)));}}return _0x31e11f;};AGIVertices['prototype'][_0x70c3('0x13b')]=function(_0x40784c){logger[_0x70c3('0x30')](util[_0x70c3('0x29')](_0x70c3('0x13c'),_0x40784c[_0x70c3('0x38')]));if(!this[_0x70c3('0x7e')](_0x40784c[_0x70c3('0x79')])){return this['channel'][_0x70c3('0xad')](_0x70c3('0xde'));}if(!this[_0x70c3('0x7e')](_0x40784c['text'])){return this[_0x70c3('0xd')][_0x70c3('0xad')]('no\x20text\x20configured');}this['channel'][_0x70c3('0xad')](util[_0x70c3('0x29')](_0x70c3('0x13d'),_0x40784c['text']));var _0x4f494c=this[_0x70c3('0x78')][_0x70c3('0x6f')](this,_0x40784c);if(_0x4f494c){this[_0x70c3('0xd')][_0x70c3('0xad')](util[_0x70c3('0x29')](_0x70c3('0x13e'),_0x4f494c));var _0x2ea1d9=this[_0x70c3('0xd')][_0x70c3('0xf2')](_0x4f494c,_0x40784c[_0x70c3('0x121')]);try{fs[_0x70c3('0xf3')](_0x4f494c+'.wav');}catch(_0x357e52){logger[_0x70c3('0x2c')](_0x357e52);}return _0x2ea1d9;}return this['channel'][_0x70c3('0x2c')](_0x40784c,_0x70c3('0x13f'));};AGIVertices[_0x70c3('0xf')][_0x70c3('0x140')]=function(_0x2b07da){logger[_0x70c3('0x30')](util[_0x70c3('0x29')](_0x70c3('0x141'),_0x2b07da[_0x70c3('0x38')]));if(!this[_0x70c3('0x7e')](_0x2b07da[_0x70c3('0x142')])){return this[_0x70c3('0xd')]['error'](_0x2b07da,_0x70c3('0x143'));}logger[_0x70c3('0x30')](util[_0x70c3('0x29')](_0x70c3('0x144'),this[_0x70c3('0xd')]['callerid'],_0x2b07da[_0x70c3('0x142')]));var _0x443cee=this[_0x70c3('0x51')][_0x70c3('0x6f')](this,_0x2b07da[_0x70c3('0x142')]);if(_0x443cee){logger[_0x70c3('0x30')](util[_0x70c3('0x29')]('AGENT\x20%s\x20FOUND\x20BY',this[_0x70c3('0xd')][_0x70c3('0x3b')],_0x2b07da[_0x70c3('0x142')]));this[_0x70c3('0xd')][_0x70c3('0xad')](util['format'](_0x70c3('0x145'),this['channel'][_0x70c3('0x3b')],_0x2b07da[_0x70c3('0x142')]));return{'code':0xc8,'result':_0x70c3('0x146')};}else{logger[_0x70c3('0x30')](util[_0x70c3('0x29')](_0x70c3('0x147'),this[_0x70c3('0xd')][_0x70c3('0x3b')],_0x2b07da[_0x70c3('0x142')]));this[_0x70c3('0xd')][_0x70c3('0xad')](util['format'](_0x70c3('0x147'),this[_0x70c3('0xd')][_0x70c3('0x3b')],_0x2b07da['findBy']));return{'code':0xc8,'result':_0x70c3('0x148')};}};AGIVertices[_0x70c3('0xf')][_0x70c3('0x149')]=function(_0x32d770){logger[_0x70c3('0x30')](util[_0x70c3('0x29')](_0x70c3('0x14a'),_0x32d770[_0x70c3('0x38')]));if(!this[_0x70c3('0x7e')](_0x32d770[_0x70c3('0x142')])){return this['channel']['error'](_0x32d770,_0x70c3('0x143'));}logger[_0x70c3('0x30')](util[_0x70c3('0x29')]('FIND\x20AGENT\x20%s\x20BY\x20%s',this[_0x70c3('0xd')][_0x70c3('0x3b')],_0x32d770[_0x70c3('0x142')]));var _0x15bd32=this[_0x70c3('0x14b')]['sync'](this,_0x32d770[_0x70c3('0x142')]);if(_0x15bd32){logger[_0x70c3('0x30')](util[_0x70c3('0x29')](_0x70c3('0x145'),this[_0x70c3('0xd')][_0x70c3('0x3b')],_0x32d770[_0x70c3('0x142')]));this['channel']['noop'](util[_0x70c3('0x29')](_0x70c3('0x145'),this[_0x70c3('0xd')][_0x70c3('0x3b')],_0x32d770['findBy']));return{'code':0xc8,'result':_0x70c3('0x146')};}else{logger[_0x70c3('0x30')](util[_0x70c3('0x29')](_0x70c3('0x147'),this[_0x70c3('0xd')][_0x70c3('0x3b')],_0x32d770['findBy']));this[_0x70c3('0xd')][_0x70c3('0xad')](util[_0x70c3('0x29')](_0x70c3('0x147'),this['channel'][_0x70c3('0x3b')],_0x32d770[_0x70c3('0x142')]));return{'code':0xc8,'result':_0x70c3('0x148')};}};AGIVertices[_0x70c3('0xf')][_0x70c3('0x14c')]=function(_0x5e1c57){logger[_0x70c3('0x30')](util[_0x70c3('0x29')]('Enter\x20in\x20MATH\x20(%s)\x20block',_0x5e1c57['label']));if(!this['isConfigured'](_0x5e1c57[_0x70c3('0x14d')])){return this[_0x70c3('0xd')]['error'](_0x5e1c57,_0x70c3('0x14e'));}this[_0x70c3('0xd')][_0x70c3('0xad')](util[_0x70c3('0x29')]('math\x20%s',_0x5e1c57[_0x70c3('0x14d')]));var _0x72b18b=eval(_0x5e1c57['operation']);if(!this[_0x70c3('0x7e')](_0x5e1c57[_0x70c3('0xce')])){return this[_0x70c3('0xd')][_0x70c3('0xad')](_0x70c3('0xcd'));}var _0x1f5522=this[_0x70c3('0x10')][_0x70c3('0x6f')](this,_0x5e1c57['variable_id']);if(!_0x1f5522){return this[_0x70c3('0xd')]['error'](_0x5e1c57,'no\x20variable\x20found');}if(_[_0x70c3('0x93')](_0x72b18b)){var _0x135223=this;_0x72b18b[_0x70c3('0xd0')](function(_0x23ece8,_0x3826c1){_0x135223[_0x70c3('0xd')]['setVariable'](util[_0x70c3('0x29')](_0x70c3('0x14f'),_0x1f5522,_0x3826c1),_0x23ece8);});return this['channel'][_0x70c3('0xad')](util[_0x70c3('0x29')](_0x70c3('0x150'),_0x1f5522));}else{return this[_0x70c3('0xd')][_0x70c3('0x98')](_0x1f5522,_0x72b18b);}};AGIVertices[_0x70c3('0xf')][_0x70c3('0x151')]=function(_0x2f3b17){logger[_0x70c3('0x30')](util[_0x70c3('0x29')](_0x70c3('0x152'),_0x2f3b17[_0x70c3('0x38')]));if(_0x2f3b17['retry']===0x0){return this['maxRetry'](_0x2f3b17);}_0x2f3b17[_0x70c3('0xa1')]-=0x1;if(!this[_0x70c3('0x7e')](_0x2f3b17[_0x70c3('0x102')])){return this[_0x70c3('0xd')][_0x70c3('0x2c')](_0x2f3b17,_0x70c3('0x153'));}var _0x229892=this['getSound'][_0x70c3('0x6f')](this,_0x2f3b17[_0x70c3('0x102')]);if(!_0x229892){return this['channel'][_0x70c3('0x2c')](_0x2f3b17,_0x70c3('0x154'));}var _0x493a21=this[_0x70c3('0xd')][_0x70c3('0x155')](_0x229892,_0x2f3b17[_0x70c3('0x103')],_0x2f3b17['digit']);var _0x185fbf=_0x493a21['result'];if(_0x493a21['result']===-0x1){this[_0x70c3('0x36')][_0x70c3('0x6f')](this,_0x2f3b17,'-1');return _0x493a21;}else if(_0x493a21['extra']==='timeout'){_0x493a21[_0x70c3('0x9d')]=_0x493a21[_0x70c3('0x9d')][_0x70c3('0x97')]>0x0?_0x493a21['result']:'t';}else if(_[_0x70c3('0x44')](_0x493a21[_0x70c3('0x9d')])){_0x493a21[_0x70c3('0x9d')]='#';_0x185fbf='#';}if(!this[_0x70c3('0x7e')](_0x2f3b17['variable_id'])){this[_0x70c3('0xd')][_0x70c3('0xad')](_0x70c3('0xcd'));}else{var _0x4b23a5=this[_0x70c3('0x10')][_0x70c3('0x6f')](this,_0x2f3b17[_0x70c3('0xce')]);if(!_0x4b23a5){return this[_0x70c3('0xd')]['error'](_0x2f3b17,'no\x20variable\x20found');}this[_0x70c3('0xd')]['setVariable'](_0x4b23a5,_0x185fbf);}this['createSquareDetailsReport']['sync'](this,_0x2f3b17,_0x185fbf);return _0x493a21;};AGIVertices[_0x70c3('0xf')]['noop']=function(_0x25d340){logger['info'](util[_0x70c3('0x29')](_0x70c3('0x156'),_0x25d340[_0x70c3('0x38')]));return this['channel'][_0x70c3('0xad')](_0x25d340[_0x70c3('0x157')]||_0x25d340['label']);};AGIVertices[_0x70c3('0xf')][_0x70c3('0x158')]=function(_0x1ca304){logger['info'](util[_0x70c3('0x29')]('Enter\x20in\x20PAUSE\x20(%s)\x20block',_0x1ca304[_0x70c3('0x38')]));if(!this[_0x70c3('0x7e')](_0x1ca304[_0x70c3('0x142')])){return this[_0x70c3('0xd')]['error'](_0x1ca304,'no\x20find\x20by\x20configured');}logger[_0x70c3('0x30')](util[_0x70c3('0x29')](_0x70c3('0x144'),this[_0x70c3('0xd')][_0x70c3('0x3b')],_0x1ca304['findBy']));var _0x447f12=this[_0x70c3('0x159')][_0x70c3('0x6f')](this,_0x1ca304[_0x70c3('0x15a')]);var _0x554c9b=this[_0x70c3('0x4e')][_0x70c3('0x6f')](this,_0x1ca304['findBy'],_0x447f12);if(_0x554c9b){logger[_0x70c3('0x30')](util[_0x70c3('0x29')](_0x70c3('0x145'),this[_0x70c3('0xd')][_0x70c3('0x3b')],_0x1ca304[_0x70c3('0x142')]));this['channel'][_0x70c3('0xad')](util[_0x70c3('0x29')](_0x70c3('0x145'),this[_0x70c3('0xd')]['callerid'],_0x1ca304[_0x70c3('0x142')]));return{'code':0xc8,'result':_0x70c3('0x146')};}else{logger[_0x70c3('0x30')](util[_0x70c3('0x29')](_0x70c3('0x147'),this[_0x70c3('0xd')][_0x70c3('0x3b')],_0x1ca304[_0x70c3('0x142')]));this['channel']['noop'](util[_0x70c3('0x29')](_0x70c3('0x145'),this['channel'][_0x70c3('0x3b')],_0x1ca304['findBy']));return{'code':0xc8,'result':'failure'};}};AGIVertices[_0x70c3('0xf')][_0x70c3('0x15b')]=function(_0xe294d2){logger[_0x70c3('0x30')](util[_0x70c3('0x29')](_0x70c3('0x15c'),_0xe294d2[_0x70c3('0x38')]));if(!this['isConfigured'](_0xe294d2['file_id'])){return this['channel'][_0x70c3('0x2c')](_0xe294d2,_0x70c3('0x153'));}var _0x2f1848=this[_0x70c3('0x1c')][_0x70c3('0x6f')](this,_0xe294d2[_0x70c3('0x102')]);if(!_0x2f1848){return this['channel'][_0x70c3('0x2c')](_0xe294d2,_0x70c3('0x154'));}var _0x531d0d=this[_0x70c3('0xd')][_0x70c3('0x54')](_0x70c3('0x15d'),[_0x2f1848,_0xe294d2[_0x70c3('0xdb')]]);if(_0x531d0d[_0x70c3('0x9d')]===-0x1){return _0x531d0d;}return this[_0x70c3('0xd')][_0x70c3('0xad')](util['format']('Executed\x20command\x20%s\x20%s','PLAYBACK',_0x2f1848));};AGIVertices[_0x70c3('0xf')][_0x70c3('0x15e')]=function(_0x3195f9){logger['info'](util[_0x70c3('0x29')](_0x70c3('0x15f'),_0x3195f9['label']));if(!this[_0x70c3('0x7e')](_0x3195f9[_0x70c3('0x160')])){return this[_0x70c3('0xd')]['error'](_0x3195f9,_0x70c3('0x161'));}var _0x1abda8='';var _0x117b10=parseInt(_0x3195f9[_0x70c3('0x160')],0xa);if(isNaN(_0x117b10)){_0x1abda8=_0x3195f9[_0x70c3('0x160')];}else{_0x1abda8=this[_0x70c3('0x13')]['sync'](this,_0x3195f9[_0x70c3('0x160')]);if(!_0x1abda8){return this['channel'][_0x70c3('0x2c')](_0x3195f9,_0x70c3('0x162'));}}var _0x39dd55='';if(this[_0x70c3('0x7e')](_0x3195f9[_0x70c3('0x102')])){var _0x3c56c6=this[_0x70c3('0x1c')]['sync'](this,_0x3195f9[_0x70c3('0x102')]);if(_0x3c56c6){_0x39dd55=_0x3c56c6;}}this[_0x70c3('0x36')][_0x70c3('0x6f')](this,_0x3195f9,_0x1abda8);if(_0x3195f9[_0x70c3('0xdb')][_0x70c3('0x163')]('x')<0x0){_0x3195f9[_0x70c3('0xdb')]+='x';}if(_0x3195f9[_0x70c3('0xdb')][_0x70c3('0x163')]('X')<0x0){_0x3195f9[_0x70c3('0xdb')]+='X';}this[_0x70c3('0xd')][_0x70c3('0x98')](_0x70c3('0x164'),_0x1abda8?_0x1abda8[_0x70c3('0x165')]():'');var _0x3dd343=this['channel'][_0x70c3('0x54')](_0x70c3('0x166'),[_0x1abda8,_0x3195f9[_0x70c3('0xdb')],_0x3195f9[_0x70c3('0xfe')],_0x39dd55,_0x3195f9[_0x70c3('0x63')],_0x3195f9[_0x70c3('0x7')],_0x3195f9['macro'],_0x3195f9[_0x70c3('0x167')],'',_0x3195f9[_0x70c3('0x168')]]);if(_0x3dd343['result']===-0x1){return _0x3dd343;}return this[_0x70c3('0xd')][_0x70c3('0xad')](util['format'](_0x70c3('0xb1'),_0x70c3('0x166'),_0x1abda8));};AGIVertices[_0x70c3('0xf')][_0x70c3('0x169')]=function(_0x3058ca){logger[_0x70c3('0x30')](util[_0x70c3('0x29')](_0x70c3('0x16a'),_0x3058ca[_0x70c3('0x38')]));var _0x33078a=_0x3058ca[_0x70c3('0x16b')]||_0x70c3('0x125');var _0x4fd7f0=util[_0x70c3('0x29')](_0x70c3('0x16c'),this[_0x70c3('0xd')][_0x70c3('0x37')],rs[_0x70c3('0x108')](0x5));var _0x4fc2ba=util[_0x70c3('0x29')](_0x70c3('0x16d'),FILES_PATH,_0x4fd7f0,_0x33078a);var _0x41d1c5=util['format'](_0x70c3('0x126'),FILES_PATH,_0x4fd7f0);this[_0x70c3('0x3c')][_0x70c3('0x6f')](this,_0x3058ca,_0x4fd7f0,_0x4fc2ba);this[_0x70c3('0xd')]['setVariable'](_0x70c3('0x16e'),_0x4fd7f0);logger['info'](_0x70c3('0x16f'),_0x41d1c5,_0x33078a,_0x3058ca[_0x70c3('0x170')],_0x3058ca[_0x70c3('0x63')]);return this[_0x70c3('0xd')][_0x70c3('0x120')](_0x41d1c5,_0x33078a,_0x3058ca[_0x70c3('0x170')],_0x3058ca[_0x70c3('0x63')],undefined,!![]);};AGIVertices['prototype'][_0x70c3('0x171')]=function(_0x152686){logger['info'](util['format'](_0x70c3('0x172'),_0x152686['label']));if(!this['isConfigured'](_0x152686['url'])){return this['channel']['noop'](_0x70c3('0x173'));}var _0x9ca8e=this['restAPI'][_0x70c3('0x6f')](this,_0x152686);logger[_0x70c3('0x30')](util['format'](_0x70c3('0x174'),util[_0x70c3('0x175')](_0x9ca8e,{'showHidden':![],'depth':null})));if(!this['isConfigured'](_0x152686[_0x70c3('0xce')])){return this[_0x70c3('0xd')][_0x70c3('0xad')](_0x70c3('0x176'));}var _0x110281=this['getVariable']['sync'](this,_0x152686[_0x70c3('0xce')]);if(!_0x110281){return this[_0x70c3('0xd')][_0x70c3('0x2c')](_0x152686,'no\x20variable\x20found');}this[_0x70c3('0xd')][_0x70c3('0x98')](util[_0x70c3('0x29')](_0x70c3('0x177'),_0x110281),_0x9ca8e['statusCode']?_0x9ca8e['statusCode']:_0x70c3('0x178'));this['channel'][_0x70c3('0x98')](util[_0x70c3('0x29')]('%s_STATUS_MESSAGE',_0x110281),_0x9ca8e[_0x70c3('0x74')]?_0x9ca8e[_0x70c3('0x74')]:'OK');if(_0x9ca8e[_0x70c3('0x69')]){try{this['saveRestApiResult'](_0x9ca8e[_0x70c3('0x69')],_0x110281);}catch(_0x3b896f){logger[_0x70c3('0x2c')](util[_0x70c3('0x29')](_0x70c3('0x179'),_0x110281));}}return this[_0x70c3('0xd')][_0x70c3('0xad')](util[_0x70c3('0x29')](_0x70c3('0xd3'),_0x110281));};AGIVertices[_0x70c3('0xf')]['saydigits']=function(_0x302b3d){logger['info'](util['format'](_0x70c3('0x17a'),_0x302b3d['label']));return this[_0x70c3('0xd')][_0x70c3('0x17b')](_0x302b3d[_0x70c3('0x17c')][_0x70c3('0x56')](/\s+/g,''),_0x302b3d[_0x70c3('0x170')]);};AGIVertices[_0x70c3('0xf')][_0x70c3('0x17d')]=function(_0x20b1d1){logger[_0x70c3('0x30')](util[_0x70c3('0x29')](_0x70c3('0x17e'),_0x20b1d1[_0x70c3('0x38')]));return this['channel'][_0x70c3('0x17f')](_0x20b1d1[_0x70c3('0x64')]['replace'](/\s+/g,''),_0x20b1d1['escape_digits']);};AGIVertices[_0x70c3('0xf')][_0x70c3('0x180')]=function(_0x57ac6d){logger['info'](util[_0x70c3('0x29')](_0x70c3('0x181'),_0x57ac6d[_0x70c3('0x38')]));return this[_0x70c3('0xd')][_0x70c3('0x182')](_0x57ac6d[_0x70c3('0x5a')],_0x57ac6d['escape_digits']);};AGIVertices['prototype']['sendMail']=function(_0x3a449c){logger[_0x70c3('0x30')](util['format'](_0x70c3('0x183'),_0x3a449c['label']));if(!this[_0x70c3('0x7e')](_0x3a449c['account_id'])){return this['channel'][_0x70c3('0xad')](_0x70c3('0x184'));}var _0x3f6417=this[_0x70c3('0x20')][_0x70c3('0x6f')](this,_0x3a449c[_0x70c3('0x185')]);if(!_0x3f6417||!_0x3f6417[_0x70c3('0x186')]){return this['channel']['error'](_0x3a449c,_0x70c3('0x187'));}var _0x52c4e8={'from':util['format']('\x22%s\x22\x20<%s>',_0x3f6417[_0x70c3('0x18')],_0x3f6417[_0x70c3('0x188')]||_0x3f6417['Smtp'][_0x70c3('0x189')]),'to':_0x3a449c['to']||'','cc':_0x3a449c['cc']||'','bcc':_0x3a449c['bcc']||'','subject':_0x3a449c[_0x70c3('0x18a')],'html':_0x3a449c[_0x70c3('0x5a')],'text':_0x3a449c[_0x70c3('0x5a')]};var _0x1c43a7={'tls':{'rejectUnauthorized':![]}};if(_0x3f6417[_0x70c3('0x186')][_0x70c3('0x18b')]){_0x1c43a7[_0x70c3('0x18b')]=_0x3f6417[_0x70c3('0x186')][_0x70c3('0x18b')];}else{_0x1c43a7[_0x70c3('0x18c')]=_0x3f6417[_0x70c3('0x186')]['host'];_0x1c43a7[_0x70c3('0x18d')]=_0x3f6417['Smtp'][_0x70c3('0x18d')];_0x1c43a7[_0x70c3('0x18e')]=_0x3f6417['Smtp']['secure'];}if(_0x3f6417[_0x70c3('0x186')][_0x70c3('0x18f')]){_0x1c43a7[_0x70c3('0x190')]={'user':_0x3f6417[_0x70c3('0x186')][_0x70c3('0x189')],'pass':_0x3f6417[_0x70c3('0x186')]['pass']};}if(this['isConfigured'](_0x3a449c[_0x70c3('0x191')])){}logger['debug'](_0x70c3('0x192'),JSON['stringify'](_0x52c4e8));this[_0x70c3('0x36')][_0x70c3('0x6f')](this,_0x3a449c,_0x3a449c['account_id']);this[_0x70c3('0xd')]['noop'](util[_0x70c3('0x29')](_0x70c3('0x193'),_0x3f6417[_0x70c3('0x18')]));this[_0x70c3('0x22')][_0x70c3('0x6f')](this,_0x1c43a7,_0x52c4e8);return this[_0x70c3('0xd')]['noop'](_0x70c3('0x194'));};AGIVertices['prototype'][_0x70c3('0x195')]=function(_0x13ffe3){logger['info'](util[_0x70c3('0x29')](_0x70c3('0x196'),_0x13ffe3['label']));return this[_0x70c3('0xd')][_0x70c3('0xad')](_0x70c3('0x197'));};AGIVertices[_0x70c3('0xf')][_0x70c3('0x198')]=function(_0x3ec2a6){logger[_0x70c3('0x30')](util['format'](_0x70c3('0x199'),_0x3ec2a6['label']));if(!this['isConfigured'](_0x3ec2a6[_0x70c3('0x19a')])){return this[_0x70c3('0xd')][_0x70c3('0xad')](_0x70c3('0x19b'));}var _0x7b0969=this['getSmsAccount'][_0x70c3('0x6f')](this,_0x3ec2a6['sms_account_id']);if(!_0x7b0969){return this[_0x70c3('0xd')]['error'](_0x3ec2a6,_0x70c3('0x19c'));}var _0x2e8f9a={'body':_0x3ec2a6[_0x70c3('0x19d')],'phone':_0x3ec2a6['to']||'','SmsAccountId':_0x7b0969['id']};logger[_0x70c3('0xd4')](_0x70c3('0x19e'),JSON['stringify'](_0x2e8f9a));this[_0x70c3('0x36')][_0x70c3('0x6f')](this,_0x3ec2a6,_0x3ec2a6[_0x70c3('0x19a')]);this[_0x70c3('0xd')]['noop'](util[_0x70c3('0x29')]('Trying\x20SendSMS\x20with\x20account\x20%s',_0x7b0969[_0x70c3('0x18')]));this[_0x70c3('0x35')]['sync'](this,_0x2e8f9a);return this[_0x70c3('0xd')][_0x70c3('0xad')](_0x70c3('0x19f'));};AGIVertices[_0x70c3('0xf')][_0x70c3('0x1a0')]=function(_0x9f39d2){logger['info'](util[_0x70c3('0x29')](_0x70c3('0x1a1'),_0x9f39d2[_0x70c3('0x38')]));if(!this[_0x70c3('0x7e')](_0x9f39d2[_0x70c3('0xce')])){return this[_0x70c3('0xd')][_0x70c3('0x2c')](_0x9f39d2,_0x70c3('0x1a2'));}var _0x42a220=this[_0x70c3('0x10')]['sync'](this,_0x9f39d2[_0x70c3('0xce')]);if(!_0x42a220){return this[_0x70c3('0xd')]['error'](_0x9f39d2,_0x70c3('0xcf'));}return this[_0x70c3('0xd')][_0x70c3('0x98')](_0x42a220,_0x9f39d2[_0x70c3('0x1a3')]);};AGIVertices[_0x70c3('0xf')]['start']=function(_0x4444c4){logger[_0x70c3('0x30')](util[_0x70c3('0x29')](_0x70c3('0x1a4'),_0x4444c4[_0x70c3('0x38')]));this[_0x70c3('0xd')][_0x70c3('0xad')](_0x70c3('0x1a5'));if(_0x4444c4['answer']===_0x70c3('0x1a6')){this[_0x70c3('0xd')]['noop'](_0x70c3('0x1a7'));return this[_0x70c3('0xd')][_0x70c3('0xa5')]();}return this[_0x70c3('0xd')][_0x70c3('0xad')](_0x70c3('0x1a8'));};AGIVertices[_0x70c3('0xf')][_0x70c3('0x1a9')]=function(_0x476d45){logger[_0x70c3('0x30')](util['format']('Enter\x20in\x20SUBPROJECT\x20(%s)\x20block',_0x476d45['label']));if(!this['isConfigured'](_0x476d45[_0x70c3('0x1aa')])){return this[_0x70c3('0xd')][_0x70c3('0x2c')](_0x476d45,'no\x20subproject\x20selected');}var _0x56ec23=this[_0x70c3('0x17')][_0x70c3('0x6f')](this,_0x476d45[_0x70c3('0x1aa')]);if(!this[_0x70c3('0x7e')](_0x56ec23)){return this[_0x70c3('0xd')][_0x70c3('0x2c')](_0x476d45,util[_0x70c3('0x29')](_0x70c3('0x1ab'),_0x476d45[_0x70c3('0x1aa')]));}if(_0x56ec23===this[_0x70c3('0xd')]['arg_1']){return this['channel'][_0x70c3('0x2c')](_0x476d45,_0x70c3('0x1ac'));}this[_0x70c3('0x36')][_0x70c3('0x6f')](this,_0x476d45,_0x56ec23);var _0x337983=this[_0x70c3('0xd')][_0x70c3('0x54')](_0x70c3('0x1ad'),util[_0x70c3('0x29')](_0x70c3('0x1ae'),config['agi'][_0x70c3('0x18c')]||_0x70c3('0x1af'),_0x56ec23,this['channel'][_0x70c3('0x3a')]));if(_0x337983[_0x70c3('0x9d')]===-0x1){return _0x337983;}return this['channel'][_0x70c3('0xad')](util[_0x70c3('0x29')](_0x70c3('0xb1'),_0x70c3('0x1ad'),_0x56ec23));};AGIVertices[_0x70c3('0xf')][_0x70c3('0x1b0')]=function(_0x5dd007){logger[_0x70c3('0x30')](util[_0x70c3('0x29')]('Enter\x20in\x20SYSTEM\x20(%s)\x20block',_0x5dd007['label']));var _0x2451d1=this['shellCommand'][_0x70c3('0x6f')](this,_0x5dd007[_0x70c3('0xa3')]);this[_0x70c3('0x36')]['sync'](this,_0x5dd007,_0x5dd007[_0x70c3('0xa3')]);if(this[_0x70c3('0x7e')](_0x5dd007[_0x70c3('0xce')])){var _0x5f095a=this[_0x70c3('0x10')]['sync'](this,_0x5dd007[_0x70c3('0xce')]);if(_0x5f095a){this[_0x70c3('0xd')][_0x70c3('0x98')](_0x5f095a,_0x2451d1);return this['channel']['noop'](util[_0x70c3('0x29')]('sh\x20command:\x20%s\x20result\x20on\x20variable:\x20%s',_0x5dd007[_0x70c3('0xa3')],_0x5f095a));}}return this[_0x70c3('0xd')][_0x70c3('0xad')](util['format'](_0x70c3('0x1b1'),_0x5dd007[_0x70c3('0xa3')]));};AGIVertices[_0x70c3('0xf')][_0x70c3('0x1b2')]=function(_0x302f51){logger[_0x70c3('0x30')](util[_0x70c3('0x29')](_0x70c3('0x1b3'),_0x302f51['label']));if(!this['isConfigured'](_0x302f51[_0x70c3('0x58')])){return this['channel']['noop'](_0x70c3('0x1b4'));}if(!this[_0x70c3('0x7e')](_0x302f51[_0x70c3('0x5a')])){return this[_0x70c3('0xd')][_0x70c3('0xad')](_0x70c3('0xb8'));}this[_0x70c3('0xd')][_0x70c3('0xad')](util[_0x70c3('0x29')](_0x70c3('0x1b5'),_0x302f51['text']));var _0x47f855=this[_0x70c3('0x57')][_0x70c3('0x6f')](this,_0x302f51);if(_0x47f855){this['channel'][_0x70c3('0xad')](util[_0x70c3('0x29')](_0x70c3('0x1b6'),_0x47f855));var _0x2ef69e=this['channel']['streamFile'](_0x47f855);try{fs['unlink'](_0x47f855+_0x70c3('0x110'));}catch(_0x9a776a){logger[_0x70c3('0x2c')](_0x9a776a);}return _0x2ef69e;}return this[_0x70c3('0xd')]['error'](_0x302f51,'Google\x20Cloud\x20TTS\x20is\x20unreachable');};AGIVertices[_0x70c3('0xf')][_0x70c3('0x1b7')]=function(_0x46c8e9){logger[_0x70c3('0x30')](util[_0x70c3('0x29')](_0x70c3('0x1b8'),_0x46c8e9[_0x70c3('0x38')]));if(!this[_0x70c3('0x7e')](_0x46c8e9['text'])){return this[_0x70c3('0xd')][_0x70c3('0xad')](_0x70c3('0xb8'));}this[_0x70c3('0xd')][_0x70c3('0xad')](util[_0x70c3('0x29')](_0x70c3('0x1b9'),_0x46c8e9[_0x70c3('0x5a')]));var _0x49fde5=this[_0x70c3('0x60')][_0x70c3('0x6f')](this,_0x46c8e9);if(_0x49fde5){this[_0x70c3('0xd')]['noop'](util[_0x70c3('0x29')]('Google\x20TTS\x20%s\x20file\x20created',_0x49fde5));var _0x126765=this[_0x70c3('0xd')]['streamFile'](_0x49fde5);try{fs[_0x70c3('0xf3')](_0x49fde5+_0x70c3('0x110'));}catch(_0x364bf3){logger['error'](_0x364bf3);}return _0x126765;}return this[_0x70c3('0xd')][_0x70c3('0x2c')](_0x46c8e9,_0x70c3('0x1ba'));};AGIVertices['prototype'][_0x70c3('0x1bb')]=function(_0x97af25){logger['info'](util[_0x70c3('0x29')](_0x70c3('0x1bc'),_0x97af25[_0x70c3('0x38')]));if(!this[_0x70c3('0x7e')](_0x97af25[_0x70c3('0x142')])){return this[_0x70c3('0xd')][_0x70c3('0x2c')](_0x97af25,'no\x20find\x20by\x20configured');}logger['info'](util[_0x70c3('0x29')]('FIND\x20AGENT\x20%s\x20BY\x20%s',this[_0x70c3('0xd')][_0x70c3('0x3b')],_0x97af25[_0x70c3('0x142')]));var _0x5a9dc2=this[_0x70c3('0x4f')][_0x70c3('0x6f')](this,_0x97af25[_0x70c3('0x142')]);if(_0x5a9dc2){logger[_0x70c3('0x30')](util[_0x70c3('0x29')](_0x70c3('0x145'),this[_0x70c3('0xd')][_0x70c3('0x3b')],_0x97af25['findBy']));this[_0x70c3('0xd')][_0x70c3('0xad')](util[_0x70c3('0x29')]('AGENT\x20%s\x20FOUND\x20BY',this[_0x70c3('0xd')][_0x70c3('0x3b')],_0x97af25[_0x70c3('0x142')]));return{'code':0xc8,'result':_0x70c3('0x146')};}else{logger[_0x70c3('0x30')](util[_0x70c3('0x29')](_0x70c3('0x147'),this['channel']['callerid'],_0x97af25['findBy']));this['channel']['noop'](util[_0x70c3('0x29')](_0x70c3('0x147'),this[_0x70c3('0xd')][_0x70c3('0x3b')],_0x97af25[_0x70c3('0x142')]));return{'code':0xc8,'result':_0x70c3('0x148')};}};AGIVertices['prototype'][_0x70c3('0x1bd')]=function(_0x5e4247){logger[_0x70c3('0x30')](util[_0x70c3('0x29')](_0x70c3('0x1be'),_0x5e4247['label']));var _0x1b9bd0=this[_0x70c3('0xd')][_0x70c3('0x54')](_0x70c3('0x1bf'),[_0x5e4247[_0x70c3('0x1c0')],_0x5e4247[_0x70c3('0x75')]]);if(_0x1b9bd0[_0x70c3('0x9d')]===-0x1){return _0x1b9bd0;}return this['channel'][_0x70c3('0xad')](util[_0x70c3('0x29')](_0x70c3('0xb1'),'VOICEMAIL',_0x5e4247[_0x70c3('0x1c0')]));};AGIVertices[_0x70c3('0xf')][_0x70c3('0x1c1')]=function(_0x4d0ae9){logger[_0x70c3('0x30')](util['format']('Enter\x20in\x20SWITCH\x20(%s)\x20block',_0x4d0ae9['label']));if(!this[_0x70c3('0x7e')](_0x4d0ae9[_0x70c3('0xce')])){return this[_0x70c3('0xd')][_0x70c3('0x2c')](_0x4d0ae9,_0x70c3('0x1a2'));}var _0x4da06d=this[_0x70c3('0x10')][_0x70c3('0x6f')](this,_0x4d0ae9[_0x70c3('0xce')]);if(!_0x4da06d){return this[_0x70c3('0xd')][_0x70c3('0x2c')](_0x4d0ae9,_0x70c3('0xcf'));}var _0x6356a4=this[_0x70c3('0xd')][_0x70c3('0x10')](_0x4da06d);return{'code':0xc8,'result':_0x6356a4[_0x70c3('0x9f')]?_0x6356a4[_0x70c3('0x9f')]:'-'};};String[_0x70c3('0xf')][_0x70c3('0x9b')]=function(_0x452089,_0x2f9d1e){return this['split'](_0x452089)[_0x70c3('0x1c2')](_0x2f9d1e);};module[_0x70c3('0x1c3')]=AGIVertices; \ No newline at end of file diff --git a/server/services/ami/acw/index.js b/server/services/ami/acw/index.js index e10e088..dda8e94 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 _0x8ef6=['milliseconds','diff','seconds','prototype','ACW','mandatoryDisposition','mandatoryDispositionPause','name','Action','then','getAgent','[%s][START][AGENT:%s][QUEUE:%s]','attended','destlinkedid','savePause','acwTimeout','timer','lastPauseAt','format','YYYY-MM-DD\x20HH:mm:ss','uniqueid','queue','updateAcw','update','info','[%s][UPDATE][ACWTIME:%s]','error','[%s][INPAUSE][AGENT:%s][QUEUE:%s]','catch','finally','[ACW][START]\x20%s','saveUnpause','[%s][UPDATE][ERRORS:%s]','[ACW][TIMERS]','stringify','[ACW][STOP]\x20%s','message','syncAgentConnect','interface','[ACW][syncAgentConnect]\x20%s','[ACW][syncAgentConnectPreview]\x20%s','startAcw','linkedid','isUndefined','[%s][HANGUP:LINKEDID]','[ACW][syncHangupRequest]\x20%s','[%s][HANGUPATTENDEDTRANSFER:UNIQUEID]','[%s][HANGUPATTENDEDTRANSFER:LINKEDID]','[ACW][syncHangup]\x20%s','isNil','transfereeuniqueid','secondtransfereruniqueid','transfertargetuniqueid','origtransfereruniqueid','transfereruniqueid','[%s][BLINDTRANSFER:UNIQUEID]','transfererlinkedid','[%s][BLINDTRANSFER:LINKEDID]','[ACW][syncBlindTransfer]\x20%s','autopause','all','Auto-Pause','[ACW][syncAgentRingNoAnswer]\x20%s','exports','util','lodash','moment','../ami','../../../config/logger','acw','../rpc/user','voiceQueues','agents','timers','channels','agentconnect','bind','hanguprequest','syncHangupRequest','hangup','syncHangup','agentringnoanswer','syncAgentRingNoAnswer','attendedtransfer','syncAttendedTransfer','blindtransfer','syncBlindTransfer','custom:agentConnectPreview','syncAgentConnectPreview'];(function(_0x378a07,_0x26dbbe){var _0x1013e7=function(_0x28855f){while(--_0x28855f){_0x378a07['push'](_0x378a07['shift']());}};_0x1013e7(++_0x26dbbe);}(_0x8ef6,0xf2));var _0x68ef=function(_0x5511c1,_0x13a97e){_0x5511c1=_0x5511c1-0x0;var _0x4f49a0=_0x8ef6[_0x5511c1];return _0x4f49a0;};'use strict';var util=require(_0x68ef('0x0'));var _=require(_0x68ef('0x1'));var moment=require(_0x68ef('0x2'));var ami=require(_0x68ef('0x3'));var logger=require(_0x68ef('0x4'))(_0x68ef('0x5'));var RpcUser=require(_0x68ef('0x6'));var RpcVoiceAgentReport=require('../rpc/voiceAgentReport');function Acw(_0x27d0af){this[_0x68ef('0x7')]=_0x27d0af[_0x68ef('0x7')];this[_0x68ef('0x8')]=_0x27d0af['agents'];this['timers']=_0x27d0af[_0x68ef('0x9')];this[_0x68ef('0xa')]={};ami['on'](_0x68ef('0xb'),this['syncAgentConnect'][_0x68ef('0xc')](this));ami['on'](_0x68ef('0xd'),this[_0x68ef('0xe')][_0x68ef('0xc')](this));ami['on'](_0x68ef('0xf'),this[_0x68ef('0x10')][_0x68ef('0xc')](this));ami['on'](_0x68ef('0x11'),this[_0x68ef('0x12')][_0x68ef('0xc')](this));ami['on'](_0x68ef('0x13'),this[_0x68ef('0x14')]['bind'](this));ami['on'](_0x68ef('0x15'),this[_0x68ef('0x16')][_0x68ef('0xc')](this));ami['on'](_0x68ef('0x17'),this[_0x68ef('0x18')][_0x68ef('0xc')](this));}function getDiff(_0x508671){var _0x3b48dd=moment()[_0x68ef('0x19')](0x0);var _0x2657c5=moment(_0x508671)['milliseconds'](0x0);return _0x3b48dd[_0x68ef('0x1a')](_0x2657c5,_0x68ef('0x1b'));}Acw[_0x68ef('0x1c')]['startAcw']=function(_0x35493d){try{var _0x37c4cc=this;var _0x3d1e90=this[_0x68ef('0xa')][_0x35493d]['interface'];var _0x2ada1c=this['channels'][_0x35493d]['queue'];var _0x2633c1=this[_0x68ef('0x7')][_0x2ada1c];var _0x4ade0d=![];var _0x527870=_0x68ef('0x1d');if(_0x2633c1[_0x68ef('0x1e')]){if(_0x2633c1[_0x68ef('0x1f')]['name']){_0x4ade0d=!![];_0x527870=_0x2633c1[_0x68ef('0x1f')][_0x68ef('0x20')];}}ami[_0x68ef('0x21')]({'action':'QueuePause','interface':_0x3d1e90,'paused':!![],'reason':_0x527870})[_0x68ef('0x22')](function(_0x3be4c0){if(_0x37c4cc['agents'][_0x3d1e90]){return RpcUser[_0x68ef('0x23')](_0x37c4cc[_0x68ef('0x8')][_0x3d1e90]['id'])[_0x68ef('0x22')](function(_0x5ddec7){if(_0x5ddec7&&!_0x5ddec7['voicePause']){logger['info'](_0x68ef('0x24'),_0x35493d,_0x3d1e90,_0x2ada1c);var _0x2023f2=_0x37c4cc[_0x68ef('0xa')][_0x35493d][_0x68ef('0x25')]&&_0x37c4cc[_0x68ef('0xa')][_0x35493d][_0x68ef('0x26')]?_0x37c4cc[_0x68ef('0xa')][_0x35493d][_0x68ef('0x26')]:_0x35493d;return RpcUser[_0x68ef('0x27')](_0x37c4cc[_0x68ef('0x8')][_0x3d1e90],_0x527870,_0x2023f2)['then'](function(_0x178460){if(!_0x4ade0d){_0x37c4cc['timers'][_0x3d1e90]={};logger['info']('[%s][TIMER:%s][AGENT:%s][QUEUE:%s]',_0x35493d,_0x37c4cc[_0x68ef('0x7')][_0x2ada1c][_0x68ef('0x28')],_0x3d1e90,_0x2ada1c);_0x37c4cc[_0x68ef('0x9')][_0x3d1e90][_0x68ef('0x29')]=setTimeout(_0x37c4cc['stopAcw']['bind'](_0x37c4cc,_0x3d1e90),_0x37c4cc[_0x68ef('0x7')][_0x2ada1c][_0x68ef('0x28')]*0x3e8);_0x37c4cc[_0x68ef('0x9')][_0x3d1e90][_0x68ef('0x2a')]=moment()[_0x68ef('0x2b')](_0x68ef('0x2c'));_0x37c4cc[_0x68ef('0x9')][_0x3d1e90][_0x68ef('0x2d')]=_0x35493d;_0x37c4cc['timers'][_0x3d1e90][_0x68ef('0x2e')]=_0x2ada1c;_0x37c4cc[_0x68ef('0x9')][_0x3d1e90][_0x68ef('0x2f')]=function(){var _0x4c25aa=getDiff(_0x37c4cc[_0x68ef('0x9')][_0x3d1e90]['lastPauseAt']);clearTimeout(_0x37c4cc[_0x68ef('0x9')][_0x3d1e90][_0x68ef('0x29')]);_0x37c4cc['timers'][_0x3d1e90]['timer']=![];RpcVoiceAgentReport[_0x68ef('0x30')]({'acwtime':_0x4c25aa},_0x37c4cc[_0x68ef('0x9')][_0x3d1e90]['uniqueid'],_0x3d1e90)[_0x68ef('0x22')](function(_0x8c0a06){logger[_0x68ef('0x31')](_0x68ef('0x32'),_0x35493d,_0x4c25aa,_0x8c0a06);})['catch'](function(_0x2c8bd0){logger[_0x68ef('0x33')]('[%s][UPDATE][ERRORS:%s]',_0x35493d,_0x2c8bd0);});delete _0x37c4cc[_0x68ef('0x9')][_0x3d1e90];};}});}else{logger['info'](_0x68ef('0x34'),_0x35493d,_0x3d1e90,_0x2ada1c);}});}})[_0x68ef('0x35')](function(_0x4973c2){logger[_0x68ef('0x33')]('[%s][TIMER:%s][AGENT:%s][QUEUE:%s]',_0x35493d,_0x37c4cc[_0x68ef('0x7')][_0x2ada1c]['acwTimeout'],_0x3d1e90,_0x2ada1c);})[_0x68ef('0x36')](function(){delete _0x37c4cc[_0x68ef('0xa')][_0x35493d];});}catch(_0x798276){logger['error'](_0x68ef('0x37'),_0x798276['message']);}};Acw[_0x68ef('0x1c')]['stopAcw']=function(_0x474ffa){try{var _0x362ef1=this;if(_0x362ef1[_0x68ef('0x9')][_0x474ffa]){_0x362ef1[_0x68ef('0x9')][_0x474ffa][_0x68ef('0x29')]=![];var _0xefd1d=_0x362ef1['timers'][_0x474ffa][_0x68ef('0x2d')];var _0x15a6ab=_0x362ef1[_0x68ef('0x9')][_0x474ffa]['queue'];var _0x32eddd=_0x362ef1[_0x68ef('0x7')][_0x15a6ab][_0x68ef('0x28')];logger['info']('[TIMER][STOP][AGENT:%s]',_0x474ffa);RpcUser[_0x68ef('0x38')](this[_0x68ef('0x8')][_0x474ffa]);RpcVoiceAgentReport[_0x68ef('0x30')]({'acwtime':_0x32eddd,'agentacw':!![]},_0xefd1d,_0x474ffa)[_0x68ef('0x22')](function(_0x401459){logger[_0x68ef('0x31')](_0x68ef('0x32'),_0xefd1d,_0x32eddd,_0x401459);})['catch'](function(_0xaf7df1){logger[_0x68ef('0x33')](_0x68ef('0x39'),_0xefd1d,_0xaf7df1);});}else{logger[_0x68ef('0x33')]('[ACW][STOP]\x20Interface\x20%s\x20doesn\x27t\x20have\x20timer',_0x474ffa);if(_0x362ef1[_0x68ef('0x9')]){logger[_0x68ef('0x31')](_0x68ef('0x3a'),JSON[_0x68ef('0x3b')](_0x362ef1[_0x68ef('0x9')]));}}}catch(_0x3b00ea){logger['error'](_0x68ef('0x3c'),_0x3b00ea[_0x68ef('0x3d')]);}};Acw[_0x68ef('0x1c')][_0x68ef('0x3e')]=function(_0x449f3c){try{if(this[_0x68ef('0x7')][_0x449f3c[_0x68ef('0x2e')]]&&(this[_0x68ef('0x7')][_0x449f3c[_0x68ef('0x2e')]]['acw']||this[_0x68ef('0x7')][_0x449f3c[_0x68ef('0x2e')]][_0x68ef('0x1e')])){if(this[_0x68ef('0x8')][_0x449f3c[_0x68ef('0x3f')]]){this[_0x68ef('0xa')][_0x449f3c[_0x68ef('0x2d')]]={'queue':_0x449f3c['queue'],'interface':_0x449f3c[_0x68ef('0x3f')],'destlinkedid':_0x449f3c['destlinkedid']};}}}catch(_0x13c088){logger[_0x68ef('0x33')](_0x68ef('0x40'),_0x13c088[_0x68ef('0x3d')]);}};Acw['prototype'][_0x68ef('0x18')]=function(_0x5a8231){try{if(this[_0x68ef('0x7')][_0x5a8231['queue']]&&(this[_0x68ef('0x7')][_0x5a8231[_0x68ef('0x2e')]][_0x68ef('0x5')]||this['voiceQueues'][_0x5a8231['queue']][_0x68ef('0x1e')])){if(this[_0x68ef('0x8')][_0x5a8231['interface']]){this['channels'][_0x5a8231['uniqueid']]={'queue':_0x5a8231[_0x68ef('0x2e')],'interface':_0x5a8231[_0x68ef('0x3f')]};}}}catch(_0x173fb7){logger[_0x68ef('0x33')](_0x68ef('0x41'),_0x173fb7['message']);}};Acw['prototype'][_0x68ef('0xe')]=function(_0x21f064){try{if(this[_0x68ef('0xa')][_0x21f064[_0x68ef('0x2d')]]&&_['isUndefined'](this[_0x68ef('0xa')][_0x21f064[_0x68ef('0x2d')]][_0x68ef('0x25')])){logger[_0x68ef('0x31')]('[%s][HANGUP:UNIQUEID]',_0x21f064['uniqueid']);this[_0x68ef('0x42')](_0x21f064[_0x68ef('0x2d')]);}else if(this['channels'][_0x21f064[_0x68ef('0x43')]]&&_[_0x68ef('0x44')](this[_0x68ef('0xa')][_0x21f064[_0x68ef('0x43')]][_0x68ef('0x25')])){logger['info'](_0x68ef('0x45'),_0x21f064[_0x68ef('0x43')]);this[_0x68ef('0x42')](_0x21f064['linkedid']);}}catch(_0x8ef51b){logger[_0x68ef('0x33')](_0x68ef('0x46'),_0x8ef51b['message']);}};Acw[_0x68ef('0x1c')]['syncHangup']=function(_0x574573){try{if(this[_0x68ef('0xa')][_0x574573['uniqueid']]&&this[_0x68ef('0xa')][_0x574573[_0x68ef('0x2d')]][_0x68ef('0x25')]){logger[_0x68ef('0x31')](_0x68ef('0x47'),_0x574573[_0x68ef('0x2d')]);this[_0x68ef('0x42')](_0x574573[_0x68ef('0x2d')]);}else if(this[_0x68ef('0xa')][_0x574573[_0x68ef('0x43')]]&&this['channels'][_0x574573['linkedid']][_0x68ef('0x25')]){logger[_0x68ef('0x31')](_0x68ef('0x48'),_0x574573[_0x68ef('0x43')]);this[_0x68ef('0x42')](_0x574573[_0x68ef('0x43')]);}}catch(_0x15400c){logger[_0x68ef('0x33')](_0x68ef('0x49'),_0x15400c['message']);}};Acw['prototype'][_0x68ef('0x14')]=function(_0x5781c8){try{if(!_[_0x68ef('0x4a')](this['channels'][_0x5781c8[_0x68ef('0x4b')]])){this[_0x68ef('0x42')](_0x5781c8['transfereeuniqueid']);if(this[_0x68ef('0xa')][_0x5781c8['secondtransfereruniqueid']]){this[_0x68ef('0xa')][_0x5781c8[_0x68ef('0x4c')]][_0x68ef('0x25')]=!![];this[_0x68ef('0xa')][_0x5781c8[_0x68ef('0x4d')]]=this[_0x68ef('0xa')][_0x5781c8['secondtransfereruniqueid']];delete this[_0x68ef('0xa')][_0x5781c8[_0x68ef('0x4c')]];}}else if(!_[_0x68ef('0x4a')](this[_0x68ef('0xa')][_0x5781c8[_0x68ef('0x4d')]])){this[_0x68ef('0x42')](_0x5781c8['transfertargetuniqueid']);if(this[_0x68ef('0xa')][_0x5781c8[_0x68ef('0x4e')]]){this['channels'][_0x5781c8[_0x68ef('0x4e')]][_0x68ef('0x25')]=!![];this[_0x68ef('0xa')][_0x5781c8['transfereeuniqueid']]=this[_0x68ef('0xa')][_0x5781c8['origtransfereruniqueid']];delete this['channels'][_0x5781c8[_0x68ef('0x4e')]];}}}catch(_0x540da5){logger[_0x68ef('0x33')]('[ACW][syncAttendedTransfer]\x20%s',_0x540da5[_0x68ef('0x3d')]);}};Acw[_0x68ef('0x1c')][_0x68ef('0x16')]=function(_0x3fbd39){try{if(this[_0x68ef('0xa')][_0x3fbd39[_0x68ef('0x4f')]]){logger['info'](_0x68ef('0x50'),JSON['stringify'](_0x3fbd39[_0x68ef('0x4f')]));this['startAcw'](_0x3fbd39[_0x68ef('0x4f')]);}else if(this[_0x68ef('0xa')][_0x3fbd39[_0x68ef('0x51')]]){logger[_0x68ef('0x31')](_0x68ef('0x52'),JSON[_0x68ef('0x3b')](_0x3fbd39[_0x68ef('0x51')]));this['startAcw'](_0x3fbd39[_0x68ef('0x51')]);}}catch(_0x11bab3){logger[_0x68ef('0x33')](_0x68ef('0x53'),_0x11bab3[_0x68ef('0x3d')]);}};Acw['prototype'][_0x68ef('0x12')]=function(_0x561e8d){try{if(this[_0x68ef('0x7')][_0x561e8d['queue']]&&this['voiceQueues'][_0x561e8d[_0x68ef('0x2e')]][_0x68ef('0x54')]===_0x68ef('0x55')){if(this[_0x68ef('0x8')][_0x561e8d['interface']]){logger[_0x68ef('0x31')]('[%s][AUTOPAUSE][AGENT:%s][QUEUE:%]',_0x561e8d[_0x68ef('0x2d')],_0x561e8d[_0x68ef('0x3f')],_0x561e8d[_0x68ef('0x2e')]);return RpcUser['savePause'](this['agents'][_0x561e8d[_0x68ef('0x3f')]],_0x68ef('0x56'),_0x561e8d[_0x68ef('0x2d')]);}}}catch(_0x454c6f){logger['error'](_0x68ef('0x57'),_0x454c6f[_0x68ef('0x3d')]);}};module[_0x68ef('0x58')]=Acw; \ No newline at end of file +var _0xe14d=['agentringnoanswer','syncAgentRingNoAnswer','attendedtransfer','syncAttendedTransfer','blindtransfer','syncBlindTransfer','custom:agentConnectPreview','syncAgentConnectPreview','milliseconds','diff','seconds','prototype','channels','interface','queue','ACW','mandatoryDisposition','mandatoryDispositionPause','Action','then','getAgent','voicePause','info','[%s][START][AGENT:%s][QUEUE:%s]','attended','destlinkedid','savePause','[%s][TIMER:%s][AGENT:%s][QUEUE:%s]','acwTimeout','timer','stopAcw','format','uniqueid','updateAcw','catch','[%s][UPDATE][ERRORS:%s]','[%s][INPAUSE][AGENT:%s][QUEUE:%s]','error','[ACW][START]\x20%s','message','saveUnpause','update','[%s][UPDATE][ACWTIME:%s]','[ACW][STOP]\x20Interface\x20%s\x20doesn\x27t\x20have\x20timer','[ACW][TIMERS]','stringify','[ACW][syncAgentConnect]\x20%s','[ACW][syncAgentConnectPreview]\x20%s','isUndefined','linkedid','[%s][HANGUP:LINKEDID]','[ACW][syncHangupRequest]\x20%s','[%s][HANGUPATTENDEDTRANSFER:LINKEDID]','[ACW][syncHangup]\x20%s','isNil','transfereeuniqueid','startAcw','secondtransfereruniqueid','transfertargetuniqueid','origtransfereruniqueid','[ACW][syncAttendedTransfer]\x20%s','transfereruniqueid','[%s][BLINDTRANSFER:UNIQUEID]','transfererlinkedid','[ACW][syncBlindTransfer]\x20%s','autopause','all','[%s][AUTOPAUSE][AGENT:%s][QUEUE:%]','Auto-Pause','util','lodash','moment','../ami','acw','../rpc/user','voiceQueues','agents','timers','agentconnect','syncAgentConnect','bind','hanguprequest','syncHangupRequest','hangup','syncHangup'];(function(_0x3669d9,_0x52bcb0){var _0x4f0af1=function(_0x243458){while(--_0x243458){_0x3669d9['push'](_0x3669d9['shift']());}};_0x4f0af1(++_0x52bcb0);}(_0xe14d,0x1ee));var _0xde14=function(_0x15bc81,_0x4d4f77){_0x15bc81=_0x15bc81-0x0;var _0x59440e=_0xe14d[_0x15bc81];return _0x59440e;};'use strict';var util=require(_0xde14('0x0'));var _=require(_0xde14('0x1'));var moment=require(_0xde14('0x2'));var ami=require(_0xde14('0x3'));var logger=require('../../../config/logger')(_0xde14('0x4'));var RpcUser=require(_0xde14('0x5'));var RpcVoiceAgentReport=require('../rpc/voiceAgentReport');function Acw(_0x1c3e94){this[_0xde14('0x6')]=_0x1c3e94[_0xde14('0x6')];this[_0xde14('0x7')]=_0x1c3e94[_0xde14('0x7')];this[_0xde14('0x8')]=_0x1c3e94['timers'];this['channels']={};ami['on'](_0xde14('0x9'),this[_0xde14('0xa')][_0xde14('0xb')](this));ami['on'](_0xde14('0xc'),this[_0xde14('0xd')][_0xde14('0xb')](this));ami['on'](_0xde14('0xe'),this[_0xde14('0xf')]['bind'](this));ami['on'](_0xde14('0x10'),this[_0xde14('0x11')][_0xde14('0xb')](this));ami['on'](_0xde14('0x12'),this[_0xde14('0x13')][_0xde14('0xb')](this));ami['on'](_0xde14('0x14'),this[_0xde14('0x15')][_0xde14('0xb')](this));ami['on'](_0xde14('0x16'),this[_0xde14('0x17')][_0xde14('0xb')](this));}function getDiff(_0x3521d4){var _0x281c54=moment()[_0xde14('0x18')](0x0);var _0x54c58b=moment(_0x3521d4)['milliseconds'](0x0);return _0x281c54[_0xde14('0x19')](_0x54c58b,_0xde14('0x1a'));}Acw[_0xde14('0x1b')]['startAcw']=function(_0x16aa55){try{var _0x31adb3=this;var _0x257390=this[_0xde14('0x1c')][_0x16aa55][_0xde14('0x1d')];var _0x1b9d4b=this[_0xde14('0x1c')][_0x16aa55][_0xde14('0x1e')];var _0x3cc317=this[_0xde14('0x6')][_0x1b9d4b];var _0x590a8b=![];var _0x3f5fcf=_0xde14('0x1f');if(_0x3cc317[_0xde14('0x20')]){if(_0x3cc317[_0xde14('0x21')]['name']){_0x590a8b=!![];_0x3f5fcf=_0x3cc317[_0xde14('0x21')]['name'];}}ami[_0xde14('0x22')]({'action':'QueuePause','interface':_0x257390,'paused':!![],'reason':_0x3f5fcf})[_0xde14('0x23')](function(_0x30fcf1){if(_0x31adb3[_0xde14('0x7')][_0x257390]){return RpcUser[_0xde14('0x24')](_0x31adb3[_0xde14('0x7')][_0x257390]['id'])[_0xde14('0x23')](function(_0x40b648){if(_0x40b648&&!_0x40b648[_0xde14('0x25')]){logger[_0xde14('0x26')](_0xde14('0x27'),_0x16aa55,_0x257390,_0x1b9d4b);var _0x475f2f=_0x31adb3[_0xde14('0x1c')][_0x16aa55][_0xde14('0x28')]&&_0x31adb3['channels'][_0x16aa55][_0xde14('0x29')]?_0x31adb3[_0xde14('0x1c')][_0x16aa55][_0xde14('0x29')]:_0x16aa55;return RpcUser[_0xde14('0x2a')](_0x31adb3[_0xde14('0x7')][_0x257390],_0x3f5fcf,_0x475f2f)[_0xde14('0x23')](function(_0x310d75){if(!_0x590a8b){_0x31adb3[_0xde14('0x8')][_0x257390]={};logger[_0xde14('0x26')](_0xde14('0x2b'),_0x16aa55,_0x31adb3['voiceQueues'][_0x1b9d4b][_0xde14('0x2c')],_0x257390,_0x1b9d4b);_0x31adb3[_0xde14('0x8')][_0x257390][_0xde14('0x2d')]=setTimeout(_0x31adb3[_0xde14('0x2e')]['bind'](_0x31adb3,_0x257390),_0x31adb3[_0xde14('0x6')][_0x1b9d4b][_0xde14('0x2c')]*0x3e8);_0x31adb3[_0xde14('0x8')][_0x257390]['lastPauseAt']=moment()[_0xde14('0x2f')]('YYYY-MM-DD\x20HH:mm:ss');_0x31adb3[_0xde14('0x8')][_0x257390][_0xde14('0x30')]=_0x16aa55;_0x31adb3[_0xde14('0x8')][_0x257390][_0xde14('0x1e')]=_0x1b9d4b;_0x31adb3[_0xde14('0x8')][_0x257390][_0xde14('0x31')]=function(){var _0xae9dca=getDiff(_0x31adb3[_0xde14('0x8')][_0x257390]['lastPauseAt']);clearTimeout(_0x31adb3[_0xde14('0x8')][_0x257390][_0xde14('0x2d')]);_0x31adb3['timers'][_0x257390][_0xde14('0x2d')]=![];RpcVoiceAgentReport['update']({'acwtime':_0xae9dca},_0x31adb3[_0xde14('0x8')][_0x257390][_0xde14('0x30')],_0x257390)[_0xde14('0x23')](function(_0x21a916){logger[_0xde14('0x26')]('[%s][UPDATE][ACWTIME:%s]',_0x16aa55,_0xae9dca,_0x21a916);})[_0xde14('0x32')](function(_0x57b98b){logger['error'](_0xde14('0x33'),_0x16aa55,_0x57b98b);});delete _0x31adb3[_0xde14('0x8')][_0x257390];};}});}else{logger[_0xde14('0x26')](_0xde14('0x34'),_0x16aa55,_0x257390,_0x1b9d4b);}});}})[_0xde14('0x32')](function(_0xa41c1e){logger[_0xde14('0x35')](_0xde14('0x2b'),_0x16aa55,_0x31adb3[_0xde14('0x6')][_0x1b9d4b]['acwTimeout'],_0x257390,_0x1b9d4b);})['finally'](function(){delete _0x31adb3[_0xde14('0x1c')][_0x16aa55];});}catch(_0x403007){logger[_0xde14('0x35')](_0xde14('0x36'),_0x403007[_0xde14('0x37')]);}};Acw[_0xde14('0x1b')][_0xde14('0x2e')]=function(_0x2b0bc4){try{var _0x2ac7ba=this;if(_0x2ac7ba['timers'][_0x2b0bc4]){_0x2ac7ba[_0xde14('0x8')][_0x2b0bc4]['timer']=![];var _0x4a363c=_0x2ac7ba['timers'][_0x2b0bc4][_0xde14('0x30')];var _0x258759=_0x2ac7ba[_0xde14('0x8')][_0x2b0bc4][_0xde14('0x1e')];var _0x1228d8=_0x2ac7ba[_0xde14('0x6')][_0x258759][_0xde14('0x2c')];logger[_0xde14('0x26')]('[TIMER][STOP][AGENT:%s]',_0x2b0bc4);RpcUser[_0xde14('0x38')](this[_0xde14('0x7')][_0x2b0bc4]);RpcVoiceAgentReport[_0xde14('0x39')]({'acwtime':_0x1228d8,'agentacw':!![]},_0x4a363c,_0x2b0bc4)[_0xde14('0x23')](function(_0x346566){logger[_0xde14('0x26')](_0xde14('0x3a'),_0x4a363c,_0x1228d8,_0x346566);})[_0xde14('0x32')](function(_0x50db0d){logger[_0xde14('0x35')](_0xde14('0x33'),_0x4a363c,_0x50db0d);});}else{logger[_0xde14('0x35')](_0xde14('0x3b'),_0x2b0bc4);if(_0x2ac7ba['timers']){logger['info'](_0xde14('0x3c'),JSON[_0xde14('0x3d')](_0x2ac7ba[_0xde14('0x8')]));}}}catch(_0x171080){logger[_0xde14('0x35')]('[ACW][STOP]\x20%s',_0x171080[_0xde14('0x37')]);}};Acw[_0xde14('0x1b')][_0xde14('0xa')]=function(_0x595fd5){try{if(this[_0xde14('0x6')][_0x595fd5['queue']]&&(this[_0xde14('0x6')][_0x595fd5['queue']][_0xde14('0x4')]||this[_0xde14('0x6')][_0x595fd5[_0xde14('0x1e')]][_0xde14('0x20')])){if(this[_0xde14('0x7')][_0x595fd5[_0xde14('0x1d')]]){this[_0xde14('0x1c')][_0x595fd5[_0xde14('0x30')]]={'queue':_0x595fd5['queue'],'interface':_0x595fd5[_0xde14('0x1d')],'destlinkedid':_0x595fd5['destlinkedid']};}}}catch(_0x430b22){logger['error'](_0xde14('0x3e'),_0x430b22[_0xde14('0x37')]);}};Acw[_0xde14('0x1b')][_0xde14('0x17')]=function(_0x40e7ae){try{if(this[_0xde14('0x6')][_0x40e7ae[_0xde14('0x1e')]]&&(this[_0xde14('0x6')][_0x40e7ae['queue']][_0xde14('0x4')]||this[_0xde14('0x6')][_0x40e7ae[_0xde14('0x1e')]][_0xde14('0x20')])){if(this['agents'][_0x40e7ae[_0xde14('0x1d')]]){this[_0xde14('0x1c')][_0x40e7ae[_0xde14('0x30')]]={'queue':_0x40e7ae[_0xde14('0x1e')],'interface':_0x40e7ae[_0xde14('0x1d')]};}}}catch(_0x19e12c){logger['error'](_0xde14('0x3f'),_0x19e12c['message']);}};Acw[_0xde14('0x1b')][_0xde14('0xd')]=function(_0x48a677){try{if(this[_0xde14('0x1c')][_0x48a677[_0xde14('0x30')]]&&_[_0xde14('0x40')](this[_0xde14('0x1c')][_0x48a677[_0xde14('0x30')]][_0xde14('0x28')])){logger[_0xde14('0x26')]('[%s][HANGUP:UNIQUEID]',_0x48a677[_0xde14('0x30')]);this['startAcw'](_0x48a677[_0xde14('0x30')]);}else if(this[_0xde14('0x1c')][_0x48a677[_0xde14('0x41')]]&&_[_0xde14('0x40')](this[_0xde14('0x1c')][_0x48a677[_0xde14('0x41')]][_0xde14('0x28')])){logger[_0xde14('0x26')](_0xde14('0x42'),_0x48a677[_0xde14('0x41')]);this['startAcw'](_0x48a677[_0xde14('0x41')]);}}catch(_0x1688c6){logger[_0xde14('0x35')](_0xde14('0x43'),_0x1688c6[_0xde14('0x37')]);}};Acw['prototype'][_0xde14('0xf')]=function(_0x4dc2e3){try{if(this[_0xde14('0x1c')][_0x4dc2e3[_0xde14('0x30')]]&&this[_0xde14('0x1c')][_0x4dc2e3[_0xde14('0x30')]][_0xde14('0x28')]){logger['info']('[%s][HANGUPATTENDEDTRANSFER:UNIQUEID]',_0x4dc2e3[_0xde14('0x30')]);this['startAcw'](_0x4dc2e3[_0xde14('0x30')]);}else if(this[_0xde14('0x1c')][_0x4dc2e3[_0xde14('0x41')]]&&this[_0xde14('0x1c')][_0x4dc2e3[_0xde14('0x41')]][_0xde14('0x28')]){logger[_0xde14('0x26')](_0xde14('0x44'),_0x4dc2e3[_0xde14('0x41')]);this['startAcw'](_0x4dc2e3[_0xde14('0x41')]);}}catch(_0x2c972b){logger[_0xde14('0x35')](_0xde14('0x45'),_0x2c972b[_0xde14('0x37')]);}};Acw['prototype'][_0xde14('0x13')]=function(_0x58790d){try{if(!_[_0xde14('0x46')](this[_0xde14('0x1c')][_0x58790d[_0xde14('0x47')]])){this[_0xde14('0x48')](_0x58790d[_0xde14('0x47')]);if(this[_0xde14('0x1c')][_0x58790d[_0xde14('0x49')]]){this[_0xde14('0x1c')][_0x58790d['secondtransfereruniqueid']]['attended']=!![];this['channels'][_0x58790d[_0xde14('0x4a')]]=this['channels'][_0x58790d['secondtransfereruniqueid']];delete this[_0xde14('0x1c')][_0x58790d[_0xde14('0x49')]];}}else if(!_[_0xde14('0x46')](this[_0xde14('0x1c')][_0x58790d[_0xde14('0x4a')]])){this[_0xde14('0x48')](_0x58790d[_0xde14('0x4a')]);if(this[_0xde14('0x1c')][_0x58790d[_0xde14('0x4b')]]){this['channels'][_0x58790d[_0xde14('0x4b')]][_0xde14('0x28')]=!![];this[_0xde14('0x1c')][_0x58790d['transfereeuniqueid']]=this[_0xde14('0x1c')][_0x58790d['origtransfereruniqueid']];delete this[_0xde14('0x1c')][_0x58790d[_0xde14('0x4b')]];}}}catch(_0x40ab83){logger[_0xde14('0x35')](_0xde14('0x4c'),_0x40ab83[_0xde14('0x37')]);}};Acw[_0xde14('0x1b')]['syncBlindTransfer']=function(_0x3a357a){try{if(this[_0xde14('0x1c')][_0x3a357a[_0xde14('0x4d')]]){logger[_0xde14('0x26')](_0xde14('0x4e'),JSON[_0xde14('0x3d')](_0x3a357a[_0xde14('0x4d')]));this['startAcw'](_0x3a357a['transfereruniqueid']);}else if(this[_0xde14('0x1c')][_0x3a357a[_0xde14('0x4f')]]){logger[_0xde14('0x26')]('[%s][BLINDTRANSFER:LINKEDID]',JSON[_0xde14('0x3d')](_0x3a357a[_0xde14('0x4f')]));this[_0xde14('0x48')](_0x3a357a[_0xde14('0x4f')]);}}catch(_0x51e8ca){logger['error'](_0xde14('0x50'),_0x51e8ca[_0xde14('0x37')]);}};Acw[_0xde14('0x1b')][_0xde14('0x11')]=function(_0x136c21){try{if(this[_0xde14('0x6')][_0x136c21[_0xde14('0x1e')]]&&this[_0xde14('0x6')][_0x136c21[_0xde14('0x1e')]][_0xde14('0x51')]===_0xde14('0x52')){if(this[_0xde14('0x7')][_0x136c21[_0xde14('0x1d')]]){logger[_0xde14('0x26')](_0xde14('0x53'),_0x136c21[_0xde14('0x30')],_0x136c21[_0xde14('0x1d')],_0x136c21[_0xde14('0x1e')]);return RpcUser[_0xde14('0x2a')](this[_0xde14('0x7')][_0x136c21[_0xde14('0x1d')]],_0xde14('0x54'),_0x136c21[_0xde14('0x30')]);}}}catch(_0x4809fa){logger[_0xde14('0x35')]('[ACW][syncAgentRingNoAnswer]\x20%s',_0x4809fa[_0xde14('0x37')]);}};module['exports']=Acw; \ No newline at end of file diff --git a/server/services/ami/ami.js b/server/services/ami/ami.js index 9929233..b235430 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 _0x0568=['../../config/environment','port','asterisk','keepConnected','Action','promisify','action','error','Manager\x20\x22%s\x22\x20error\x20to\x20%s:%s\x20with:\x0a%s','username','format','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','shutdown','Shutdown\x20\x22%s\x22\x20to\x20%s:%s\x20with:\x0a%s','fullybooted','Fullybooted\x20\x22%s\x22\x20to\x20%s:%s','resolve','then','actionCoreShowChannels','log','close','asterisk-manager','util','../../config/logger','ami'];(function(_0x513da1,_0x29ffd5){var _0x50eeae=function(_0x3a3b88){while(--_0x3a3b88){_0x513da1['push'](_0x513da1['shift']());}};_0x50eeae(++_0x29ffd5);}(_0x0568,0x1d8));var _0x8056=function(_0x387005,_0x191a56){_0x387005=_0x387005-0x0;var _0x5d9fe9=_0x0568[_0x387005];return _0x5d9fe9;};'use strict';var Manager=require(_0x8056('0x0'));var BPromise=require('bluebird');var moment=require('moment');var util=require(_0x8056('0x1'));var _=require('lodash');var logger=require(_0x8056('0x2'))(_0x8056('0x3'));var config=require(_0x8056('0x4'));var ami=new Manager(config['asterisk'][_0x8056('0x5')],config['asterisk']['ip'],config[_0x8056('0x6')]['username'],config[_0x8056('0x6')]['password'],!![]);ami[_0x8056('0x7')]();ami[_0x8056('0x8')]=BPromise[_0x8056('0x9')](ami[_0x8056('0xa')]);function error(_0x2e7574){logger[_0x8056('0xb')](util['format'](_0x8056('0xc'),config[_0x8056('0x6')][_0x8056('0xd')],config[_0x8056('0x6')]['ip'],config[_0x8056('0x6')]['port'],util['inspect'](_0x2e7574,![],null)));}function close(){logger[_0x8056('0xb')](util[_0x8056('0xe')](_0x8056('0xf'),config[_0x8056('0x6')][_0x8056('0xd')],config[_0x8056('0x6')]['ip'],config['asterisk'][_0x8056('0x5')]));}ami[_0x8056('0x10')]=function(){return function(){return ami[_0x8056('0x8')]({'action':_0x8056('0x11')});};};ami[_0x8056('0x12')]=function(){return function(){return ami['Action']({'action':'devicestatelist'});};};ami[_0x8056('0x13')]=function(){return function(){return ami[_0x8056('0x8')]({'action':'sippeerstatus'});};};ami[_0x8056('0x14')]=function(){return function(){return ami['Action']({'action':'queuesummary'});};};ami['actionCoreShowChannels']=function(){return function(){return ami[_0x8056('0x8')]({'action':_0x8056('0x15')});};};function connect(_0xb1f19f){logger[_0x8056('0x16')](util[_0x8056('0xe')](_0x8056('0x17'),config[_0x8056('0x6')]['username'],config[_0x8056('0x6')]['ip'],config[_0x8056('0x6')]['port']));ami['once'](_0x8056('0xb'),error);ami[_0x8056('0x18')]('close',close);}ami['on']('connect',connect);ami['on'](_0x8056('0x19'),function(_0x2c84d4){logger[_0x8056('0x16')](util[_0x8056('0xe')](_0x8056('0x1a'),config['asterisk'][_0x8056('0xd')],config['asterisk']['ip'],config[_0x8056('0x6')][_0x8056('0x5')],util['inspect'](_0x2c84d4,![],null)));});ami['on'](_0x8056('0x1b'),function(_0x4067f9){logger[_0x8056('0x16')](util['format'](_0x8056('0x1c'),config[_0x8056('0x6')][_0x8056('0xd')],config[_0x8056('0x6')]['ip'],config[_0x8056('0x6')][_0x8056('0x5')]));return BPromise[_0x8056('0x1d')]()[_0x8056('0x1e')](ami['actionSipShowRegistry']())[_0x8056('0x1e')](ami[_0x8056('0x12')]())[_0x8056('0x1e')](ami[_0x8056('0x13')]())[_0x8056('0x1e')](ami['actionQueueSummary']())[_0x8056('0x1e')](ami[_0x8056('0x1f')]())['catch'](function(_0x549a31){console[_0x8056('0x20')](_0x549a31);});});ami[_0x8056('0x18')](_0x8056('0xb'),error);ami['once'](_0x8056('0x21'),close);module['exports']=ami; \ No newline at end of file +var _0x1b05=['once','close','Shutdown\x20\x22%s\x22\x20to\x20%s:%s\x20with:\x0a%s','fullybooted','resolve','actionSipShowRegistry','then','catch','log','asterisk-manager','bluebird','moment','util','lodash','ami','../../config/environment','asterisk','port','password','Action','promisify','error','format','Manager\x20\x22%s\x22\x20error\x20to\x20%s:%s\x20with:\x0a%s','username','inspect','sipshowregistry','actionDeviceStateList','devicestatelist','actionSipPeerStatus','sippeerstatus','actionQueueSummary','actionCoreShowChannels','coreshowchannels','info','Manager\x20\x22%s\x22\x20logged\x20on\x20to\x20%s:%s'];(function(_0x39c734,_0x2f3e06){var _0xb2a2f9=function(_0x502f3f){while(--_0x502f3f){_0x39c734['push'](_0x39c734['shift']());}};_0xb2a2f9(++_0x2f3e06);}(_0x1b05,0x105));var _0x51b0=function(_0x1e99a6,_0x54f844){_0x1e99a6=_0x1e99a6-0x0;var _0x41a358=_0x1b05[_0x1e99a6];return _0x41a358;};'use strict';var Manager=require(_0x51b0('0x0'));var BPromise=require(_0x51b0('0x1'));var moment=require(_0x51b0('0x2'));var util=require(_0x51b0('0x3'));var _=require(_0x51b0('0x4'));var logger=require('../../config/logger')(_0x51b0('0x5'));var config=require(_0x51b0('0x6'));var ami=new Manager(config[_0x51b0('0x7')][_0x51b0('0x8')],config[_0x51b0('0x7')]['ip'],config[_0x51b0('0x7')]['username'],config[_0x51b0('0x7')][_0x51b0('0x9')],!![]);ami['keepConnected']();ami[_0x51b0('0xa')]=BPromise[_0x51b0('0xb')](ami['action']);function error(_0x48e242){logger[_0x51b0('0xc')](util[_0x51b0('0xd')](_0x51b0('0xe'),config[_0x51b0('0x7')][_0x51b0('0xf')],config[_0x51b0('0x7')]['ip'],config[_0x51b0('0x7')]['port'],util[_0x51b0('0x10')](_0x48e242,![],null)));}function close(){logger[_0x51b0('0xc')](util['format']('Manager\x20\x22%s\x22\x20closed\x20to\x20%s:%s',config['asterisk'][_0x51b0('0xf')],config[_0x51b0('0x7')]['ip'],config[_0x51b0('0x7')][_0x51b0('0x8')]));}ami['actionSipShowRegistry']=function(){return function(){return ami[_0x51b0('0xa')]({'action':_0x51b0('0x11')});};};ami[_0x51b0('0x12')]=function(){return function(){return ami[_0x51b0('0xa')]({'action':_0x51b0('0x13')});};};ami[_0x51b0('0x14')]=function(){return function(){return ami[_0x51b0('0xa')]({'action':_0x51b0('0x15')});};};ami[_0x51b0('0x16')]=function(){return function(){return ami[_0x51b0('0xa')]({'action':'queuesummary'});};};ami[_0x51b0('0x17')]=function(){return function(){return ami[_0x51b0('0xa')]({'action':_0x51b0('0x18')});};};function connect(_0x22b1f6){logger[_0x51b0('0x19')](util['format'](_0x51b0('0x1a'),config[_0x51b0('0x7')]['username'],config[_0x51b0('0x7')]['ip'],config[_0x51b0('0x7')][_0x51b0('0x8')]));ami[_0x51b0('0x1b')]('error',error);ami[_0x51b0('0x1b')](_0x51b0('0x1c'),close);}ami['on']('connect',connect);ami['on']('shutdown',function(_0x11f431){logger[_0x51b0('0x19')](util[_0x51b0('0xd')](_0x51b0('0x1d'),config[_0x51b0('0x7')][_0x51b0('0xf')],config[_0x51b0('0x7')]['ip'],config[_0x51b0('0x7')]['port'],util[_0x51b0('0x10')](_0x11f431,![],null)));});ami['on'](_0x51b0('0x1e'),function(_0x583471){logger[_0x51b0('0x19')](util[_0x51b0('0xd')]('Fullybooted\x20\x22%s\x22\x20to\x20%s:%s',config[_0x51b0('0x7')][_0x51b0('0xf')],config['asterisk']['ip'],config['asterisk'][_0x51b0('0x8')]));return BPromise[_0x51b0('0x1f')]()['then'](ami[_0x51b0('0x20')]())[_0x51b0('0x21')](ami[_0x51b0('0x12')]())['then'](ami[_0x51b0('0x14')]())['then'](ami[_0x51b0('0x16')]())[_0x51b0('0x21')](ami[_0x51b0('0x17')]())[_0x51b0('0x22')](function(_0x3f4beb){console[_0x51b0('0x23')](_0x3f4beb);});});ami['once'](_0x51b0('0xc'),error);ami[_0x51b0('0x1b')](_0x51b0('0x1c'),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 28c2256..a76a29a 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 _0x779c=['client','http','Request','request','then','rpc','memberReport','error','message','catch','exports','jayson/promise','ami'];(function(_0x1694f5,_0x49b7c3){var _0x5b4321=function(_0x58c183){while(--_0x58c183){_0x1694f5['push'](_0x1694f5['shift']());}};_0x5b4321(++_0x49b7c3);}(_0x779c,0x10f));var _0xc779=function(_0x5f587a,_0x580603){_0x5f587a=_0x5f587a-0x0;var _0x35ffdf=_0x779c[_0x5f587a];return _0x35ffdf;};'use strict';var jayson=require(_0xc779('0x0'));var BPromise=require('bluebird');var logger=require('../../config/logger')(_0xc779('0x1'));var client=jayson[_0xc779('0x2')][_0xc779('0x3')]({'port':0x2329});client[_0xc779('0x4')]=function(_0x5430d5,_0x2f2ee3){return new BPromise(function(_0x4c6b35,_0x36808e){return client[_0xc779('0x5')](_0x5430d5,_0x2f2ee3)[_0xc779('0x6')](function(_0x42312b){logger['debug'](_0xc779('0x7'),_0xc779('0x8'),_0x5430d5,_0x2f2ee3,_0x42312b);if(_0x42312b[_0xc779('0x9')]){logger[_0xc779('0x9')](_0xc779('0x7'),'memberReport',_0x5430d5,_0x42312b[_0xc779('0x9')][_0xc779('0xa')],_0x2f2ee3);return _0x36808e(_0x42312b[_0xc779('0x9')][_0xc779('0xa')]);}else{return _0x4c6b35(_0x42312b['result']);}})[_0xc779('0xb')](function(_0x359c29){logger[_0xc779('0x9')](_0xc779('0x7'),_0xc779('0x8'),_0x5430d5,_0x359c29,_0x2f2ee3);return _0x36808e(_0x359c29);});});};module[_0xc779('0xc')]=client; \ No newline at end of file +var _0x5d4b=['exports','jayson/promise','bluebird','../../config/logger','http','Request','then','rpc','memberReport','error','message','result'];(function(_0x343afb,_0x458f03){var _0x133531=function(_0x3542f3){while(--_0x3542f3){_0x343afb['push'](_0x343afb['shift']());}};_0x133531(++_0x458f03);}(_0x5d4b,0x1d5));var _0xb5d4=function(_0x47ff9c,_0x5e4c9e){_0x47ff9c=_0x47ff9c-0x0;var _0x482bde=_0x5d4b[_0x47ff9c];return _0x482bde;};'use strict';var jayson=require(_0xb5d4('0x0'));var BPromise=require(_0xb5d4('0x1'));var logger=require(_0xb5d4('0x2'))('ami');var client=jayson['client'][_0xb5d4('0x3')]({'port':0x2329});client[_0xb5d4('0x4')]=function(_0x1099c1,_0x339e66){return new BPromise(function(_0x17cc32,_0xfd7483){return client['request'](_0x1099c1,_0x339e66)[_0xb5d4('0x5')](function(_0x48b592){logger['debug'](_0xb5d4('0x6'),_0xb5d4('0x7'),_0x1099c1,_0x339e66,_0x48b592);if(_0x48b592[_0xb5d4('0x8')]){logger[_0xb5d4('0x8')](_0xb5d4('0x6'),_0xb5d4('0x7'),_0x1099c1,_0x48b592[_0xb5d4('0x8')][_0xb5d4('0x9')],_0x339e66);return _0xfd7483(_0x48b592[_0xb5d4('0x8')][_0xb5d4('0x9')]);}else{return _0x17cc32(_0x48b592[_0xb5d4('0xa')]);}})['catch'](function(_0x4ecb57){logger['error'](_0xb5d4('0x6'),_0xb5d4('0x7'),_0x1099c1,_0x4ecb57,_0x339e66);return _0xfd7483(_0x4ecb57);});});};module[_0xb5d4('0xb')]=client; \ No newline at end of file diff --git a/server/services/ami/dialer/action.js b/server/services/ami/dialer/action.js index 94ec2af..5245ac6 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 _0x6584=['voiceQueue','name','Contact','phone','firstName','queue','active','type','dialQueueTimeout','scheduledat','countbusyretry','countnoanswerretry','countnosuchnumberretry','countdropretry','countabandonedretry','countagentrejectretry','ContactId','ListId','UserId','VoiceQueueId','CampaignId','idHopper','ContactFirstName','format','YYYY-MM-DD\x20HH:mm:ss','callback','callbackuniqueid','callbackat','recallme','originatecalleridnum','prototype','\x22%s\x22\x20<%s>','dialCutDigit','substring','number','getQueue','exports','util','lodash','moment','isNil','string'];(function(_0x41146b,_0x2615c5){var _0x34c38b=function(_0x5943f0){while(--_0x5943f0){_0x41146b['push'](_0x41146b['shift']());}};_0x34c38b(++_0x2615c5);}(_0x6584,0x175));var _0x4658=function(_0x2160a9,_0x3cbd9e){_0x2160a9=_0x2160a9-0x0;var _0xa88cf7=_0x6584[_0x2160a9];return _0xa88cf7;};'use strict';var util=require(_0x4658('0x0'));var _=require(_0x4658('0x1'));var moment=require(_0x4658('0x2'));function checkNameSurname(_0x20e2a0,_0x5d8b86,_0x2199aa){var _0x1c00c2='';if(!_[_0x4658('0x3')](_0x5d8b86)&&'string'===typeof _0x5d8b86){_0x1c00c2+=_0x5d8b86;}if(!_['isNil'](_0x2199aa)&&_0x4658('0x4')===typeof _0x2199aa){_0x1c00c2+='\x20'+_0x2199aa;}if(_0x1c00c2!==''){return _0x1c00c2;}return _0x20e2a0;}function Action(_0x126301,_0x253182,_0x63273f){this[_0x4658('0x5')]=_0x126301;this['uniqueid']=_0x63273f||undefined;this[_0x4658('0x6')]=checkNameSurname(_0x253182[_0x4658('0x7')][_0x4658('0x8')],_0x253182['Contact'][_0x4658('0x9')],_0x253182[_0x4658('0x7')]['lastName']);this['number']=_0x253182[_0x4658('0x7')]['phone'];this[_0x4658('0xa')]=_0x126301['name'];this[_0x4658('0xb')]=_0x253182['active']||![];this[_0x4658('0xc')]=_0x126301['type'];this[_0x4658('0xd')]=_0x126301[_0x4658('0xd')]||0x3;this[_0x4658('0xe')]=_0x253182[_0x4658('0xe')];this[_0x4658('0xf')]=_0x253182[_0x4658('0xf')];this['countcongestionretry']=_0x253182['countcongestionretry'];this[_0x4658('0x10')]=_0x253182['countnoanswerretry'];this[_0x4658('0x11')]=_0x253182['countnosuchnumberretry'];this[_0x4658('0x12')]=_0x253182[_0x4658('0x12')];this['countabandonedretry']=_0x253182[_0x4658('0x13')];this['countmachineretry']=_0x253182['countmachineretry'];this['countagentrejectretry']=_0x253182[_0x4658('0x14')];this['ContactId']=_0x253182[_0x4658('0x15')];this[_0x4658('0x16')]=_0x253182[_0x4658('0x16')];this[_0x4658('0x17')]=_0x253182[_0x4658('0x17')];this[_0x4658('0x18')]=_0x253182['VoiceQueueId'];this[_0x4658('0x19')]=_0x253182[_0x4658('0x19')];this[_0x4658('0x1a')]=_0x253182['id'];this[_0x4658('0x1b')]=_0x253182[_0x4658('0x7')][_0x4658('0x9')]||'';this['starttime']=moment()[_0x4658('0x1c')](_0x4658('0x1d'));this[_0x4658('0x1e')]=_0x253182['callback'];this[_0x4658('0x1f')]=_0x253182[_0x4658('0x1f')];this[_0x4658('0x20')]=_0x253182[_0x4658('0x20')];this[_0x4658('0x21')]=_0x253182[_0x4658('0x21')];this[_0x4658('0x22')]='';this['originatecalleridname']='';}Action[_0x4658('0x23')]['getCaller']=function(){return util[_0x4658('0x1c')](_0x4658('0x24'),this[_0x4658('0x6')],this[_0x4658('0x5')][_0x4658('0x25')]>0x0?this['number'][_0x4658('0x26')](this[_0x4658('0x5')][_0x4658('0x25')]):this[_0x4658('0x27')]);};Action[_0x4658('0x23')][_0x4658('0x28')]=function(){return this[_0x4658('0xa')];};module[_0x4658('0x29')]=Action; \ No newline at end of file +var _0x6268=['firstName','lastName','queue','active','dialQueueTimeout','scheduledat','countbusyretry','countcongestionretry','countnoanswerretry','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','ContactId','UserId','VoiceQueueId','CampaignId','starttime','format','YYYY-MM-DD\x20HH:mm:ss','callback','callbackuniqueid','callbackat','recallme','originatecalleridnum','prototype','getCaller','\x22%s\x22\x20<%s>','name','dialCutDigit','number','substring','getQueue','exports','util','moment','isNil','string','voiceQueue','Contact','phone'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x6268,0x193));var _0x8626=function(_0x491bf8,_0x1021d4){_0x491bf8=_0x491bf8-0x0;var _0x166371=_0x6268[_0x491bf8];return _0x166371;};'use strict';var util=require(_0x8626('0x0'));var _=require('lodash');var moment=require(_0x8626('0x1'));function checkNameSurname(_0x578be1,_0x2f48fe,_0x6c52c9){var _0xa638c4='';if(!_[_0x8626('0x2')](_0x2f48fe)&&_0x8626('0x3')===typeof _0x2f48fe){_0xa638c4+=_0x2f48fe;}if(!_['isNil'](_0x6c52c9)&&_0x8626('0x3')===typeof _0x6c52c9){_0xa638c4+='\x20'+_0x6c52c9;}if(_0xa638c4!==''){return _0xa638c4;}return _0x578be1;}function Action(_0x393b8a,_0x12a9b5,_0x259e54){this[_0x8626('0x4')]=_0x393b8a;this['uniqueid']=_0x259e54||undefined;this['name']=checkNameSurname(_0x12a9b5[_0x8626('0x5')][_0x8626('0x6')],_0x12a9b5[_0x8626('0x5')][_0x8626('0x7')],_0x12a9b5[_0x8626('0x5')][_0x8626('0x8')]);this['number']=_0x12a9b5[_0x8626('0x5')][_0x8626('0x6')];this[_0x8626('0x9')]=_0x393b8a['name'];this[_0x8626('0xa')]=_0x12a9b5[_0x8626('0xa')]||![];this['type']=_0x393b8a['type'];this[_0x8626('0xb')]=_0x393b8a['dialQueueTimeout']||0x3;this['scheduledat']=_0x12a9b5[_0x8626('0xc')];this[_0x8626('0xd')]=_0x12a9b5[_0x8626('0xd')];this[_0x8626('0xe')]=_0x12a9b5['countcongestionretry'];this[_0x8626('0xf')]=_0x12a9b5['countnoanswerretry'];this['countnosuchnumberretry']=_0x12a9b5['countnosuchnumberretry'];this['countdropretry']=_0x12a9b5[_0x8626('0x10')];this[_0x8626('0x11')]=_0x12a9b5[_0x8626('0x11')];this[_0x8626('0x12')]=_0x12a9b5[_0x8626('0x12')];this[_0x8626('0x13')]=_0x12a9b5['countagentrejectretry'];this[_0x8626('0x14')]=_0x12a9b5[_0x8626('0x14')];this['ListId']=_0x12a9b5['ListId'];this['UserId']=_0x12a9b5[_0x8626('0x15')];this[_0x8626('0x16')]=_0x12a9b5[_0x8626('0x16')];this[_0x8626('0x17')]=_0x12a9b5[_0x8626('0x17')];this['idHopper']=_0x12a9b5['id'];this['ContactFirstName']=_0x12a9b5[_0x8626('0x5')]['firstName']||'';this[_0x8626('0x18')]=moment()[_0x8626('0x19')](_0x8626('0x1a'));this[_0x8626('0x1b')]=_0x12a9b5['callback'];this[_0x8626('0x1c')]=_0x12a9b5['callbackuniqueid'];this[_0x8626('0x1d')]=_0x12a9b5[_0x8626('0x1d')];this['recallme']=_0x12a9b5[_0x8626('0x1e')];this[_0x8626('0x1f')]='';this['originatecalleridname']='';}Action[_0x8626('0x20')][_0x8626('0x21')]=function(){return util['format'](_0x8626('0x22'),this[_0x8626('0x23')],this['voiceQueue'][_0x8626('0x24')]>0x0?this[_0x8626('0x25')][_0x8626('0x26')](this[_0x8626('0x4')][_0x8626('0x24')]):this[_0x8626('0x25')]);};Action[_0x8626('0x20')][_0x8626('0x27')]=function(){return this[_0x8626('0x9')];};module[_0x8626('0x28')]=Action; \ No newline at end of file diff --git a/server/services/ami/dialer/agentComplete.js b/server/services/ami/dialer/agentComplete.js index 8e570e5..5a3a704 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 _0xa5ab=['calleridnum','starttime','responsetime','answertime','endtime','format','ringtime','holdtime','talktime','membername','reason','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','CampaignId','originatecalleridnum','originatecalleridname','exports','util','lodash','moment','milliseconds','diff','seconds','state','statedesc','Answer','scheduledat','type','campaigntype','queue','countbusyretry','countcongestionretry','countnoanswerretry','countabandonedretry','countmachineretry','countagentrejectretry','countnosuchnumberretry','countdropretry','calleridname'];(function(_0xb92ff4,_0x316629){var _0x43d0b5=function(_0x4a03e8){while(--_0x4a03e8){_0xb92ff4['push'](_0xb92ff4['shift']());}};_0x43d0b5(++_0x316629);}(_0xa5ab,0x9e));var _0xba5a=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xa5ab[_0x3dd15e];return _0x231fd0;};'use strict';var util=require(_0xba5a('0x0'));var _=require(_0xba5a('0x1'));var moment=require(_0xba5a('0x2'));function getSeconds(_0x9bed90,_0x3e0865){var _0x5af069=moment(_0x9bed90)[_0xba5a('0x3')](0x0);var _0x52fef9=moment(_0x3e0865)[_0xba5a('0x3')](0x0);return _0x5af069[_0xba5a('0x4')](_0x52fef9,_0xba5a('0x5'));}function AgentComplete(_0x5b913e,_0xffbcd){this[_0xba5a('0x6')]=0x4;this[_0xba5a('0x7')]=_0xba5a('0x8');this[_0xba5a('0x9')]=_0x5b913e[_0xba5a('0x9')];this[_0xba5a('0xa')]=_0x5b913e[_0xba5a('0xa')];this[_0xba5a('0xb')]=_0x5b913e[_0xba5a('0xa')]==='outbound'?_0xba5a('0xc'):_0x5b913e[_0xba5a('0xa')];this[_0xba5a('0xd')]=_0x5b913e[_0xba5a('0xd')];this[_0xba5a('0xe')]=_0x5b913e[_0xba5a('0xe')];this[_0xba5a('0xf')]=_0x5b913e[_0xba5a('0xf')];this['countglobal']=_0x5b913e[_0xba5a('0xd')]+_0x5b913e[_0xba5a('0xe')]+_0x5b913e['countnoanswerretry']+_0x5b913e['countnosuchnumberretry']+_0x5b913e['countdropretry']+_0x5b913e[_0xba5a('0x10')]+_0x5b913e[_0xba5a('0x11')]+_0x5b913e[_0xba5a('0x12')];this[_0xba5a('0x13')]=_0x5b913e['countnosuchnumberretry'];this[_0xba5a('0x14')]=_0x5b913e[_0xba5a('0x14')];this[_0xba5a('0x10')]=_0x5b913e[_0xba5a('0x10')];this[_0xba5a('0x11')]=_0x5b913e[_0xba5a('0x11')];this[_0xba5a('0x12')]=_0x5b913e[_0xba5a('0x12')];this['uniqueid']=_0xffbcd['uniqueid'];this[_0xba5a('0x15')]=_0x5b913e['name'];this[_0xba5a('0x16')]=_0x5b913e['number'];this[_0xba5a('0x17')]=_0x5b913e[_0xba5a('0x17')];this['responsetime']=_0x5b913e[_0xba5a('0x18')];this[_0xba5a('0x19')]=_0x5b913e[_0xba5a('0x19')];this[_0xba5a('0x1a')]=moment()[_0xba5a('0x1b')]('YYYY-MM-DD\x20HH:mm:ss');this[_0xba5a('0x1c')]=getSeconds(_0x5b913e[_0xba5a('0x18')],_0x5b913e[_0xba5a('0x17')]);this[_0xba5a('0x1d')]=getSeconds(_0x5b913e['answertime'],_0x5b913e['responsetime']);this[_0xba5a('0x1e')]=getSeconds(this['endtime'],_0x5b913e[_0xba5a('0x19')]);this[_0xba5a('0xc')]=_0xffbcd[_0xba5a('0xc')];this[_0xba5a('0x1f')]=_0xffbcd[_0xba5a('0x1f')];this['reason']=_0xffbcd[_0xba5a('0x20')];this[_0xba5a('0x21')]=_0x5b913e[_0xba5a('0x21')];this[_0xba5a('0x22')]=_0x5b913e['callbackuniqueid'];this[_0xba5a('0x23')]=_0x5b913e[_0xba5a('0x23')];this[_0xba5a('0x24')]=_0x5b913e[_0xba5a('0x24')];this['ContactId']=_0x5b913e[_0xba5a('0x25')];this['ListId']=_0x5b913e[_0xba5a('0x26')];this[_0xba5a('0x27')]=_0x5b913e['UserId'];this[_0xba5a('0x28')]=_0x5b913e[_0xba5a('0x28')];this[_0xba5a('0x29')]=_0x5b913e[_0xba5a('0x29')];this['originatecalleridnum']=_0x5b913e[_0xba5a('0x2a')]||'';this[_0xba5a('0x2b')]=_0x5b913e[_0xba5a('0x2b')]||'';}module[_0xba5a('0x2c')]=AgentComplete; \ No newline at end of file +var _0x185f=['recallme','ContactId','ListId','originatecalleridnum','originatecalleridname','exports','util','lodash','moment','milliseconds','diff','seconds','state','statedesc','Answer','scheduledat','type','campaigntype','outbound','queue','countbusyretry','countcongestionretry','countnoanswerretry','countnosuchnumberretry','countabandonedretry','countmachineretry','countagentrejectretry','countdropretry','calleridname','name','number','starttime','answertime','endtime','format','YYYY-MM-DD\x20HH:mm:ss','ringtime','responsetime','talktime','membername','reason','callback','callbackuniqueid','callbackat'];(function(_0x300f3a,_0x59ac94){var _0x2c2e71=function(_0x2b335f){while(--_0x2b335f){_0x300f3a['push'](_0x300f3a['shift']());}};_0x2c2e71(++_0x59ac94);}(_0x185f,0xe2));var _0xf185=function(_0x23ad57,_0x3325e6){_0x23ad57=_0x23ad57-0x0;var _0x4df1cb=_0x185f[_0x23ad57];return _0x4df1cb;};'use strict';var util=require(_0xf185('0x0'));var _=require(_0xf185('0x1'));var moment=require(_0xf185('0x2'));function getSeconds(_0x49a92d,_0x4ad3b2){var _0x1c6a4c=moment(_0x49a92d)['milliseconds'](0x0);var _0x2c41b7=moment(_0x4ad3b2)[_0xf185('0x3')](0x0);return _0x1c6a4c[_0xf185('0x4')](_0x2c41b7,_0xf185('0x5'));}function AgentComplete(_0xa1eda1,_0x4bafbc){this[_0xf185('0x6')]=0x4;this[_0xf185('0x7')]=_0xf185('0x8');this[_0xf185('0x9')]=_0xa1eda1[_0xf185('0x9')];this[_0xf185('0xa')]=_0xa1eda1[_0xf185('0xa')];this[_0xf185('0xb')]=_0xa1eda1[_0xf185('0xa')]===_0xf185('0xc')?_0xf185('0xd'):_0xa1eda1[_0xf185('0xa')];this[_0xf185('0xe')]=_0xa1eda1[_0xf185('0xe')];this[_0xf185('0xf')]=_0xa1eda1[_0xf185('0xf')];this[_0xf185('0x10')]=_0xa1eda1[_0xf185('0x10')];this['countglobal']=_0xa1eda1[_0xf185('0xe')]+_0xa1eda1[_0xf185('0xf')]+_0xa1eda1['countnoanswerretry']+_0xa1eda1[_0xf185('0x11')]+_0xa1eda1['countdropretry']+_0xa1eda1[_0xf185('0x12')]+_0xa1eda1[_0xf185('0x13')]+_0xa1eda1[_0xf185('0x14')];this[_0xf185('0x11')]=_0xa1eda1[_0xf185('0x11')];this[_0xf185('0x15')]=_0xa1eda1[_0xf185('0x15')];this[_0xf185('0x12')]=_0xa1eda1['countabandonedretry'];this[_0xf185('0x13')]=_0xa1eda1[_0xf185('0x13')];this['countagentrejectretry']=_0xa1eda1['countagentrejectretry'];this['uniqueid']=_0x4bafbc['uniqueid'];this[_0xf185('0x16')]=_0xa1eda1[_0xf185('0x17')];this['calleridnum']=_0xa1eda1[_0xf185('0x18')];this[_0xf185('0x19')]=_0xa1eda1[_0xf185('0x19')];this['responsetime']=_0xa1eda1['responsetime'];this[_0xf185('0x1a')]=_0xa1eda1['answertime'];this[_0xf185('0x1b')]=moment()[_0xf185('0x1c')](_0xf185('0x1d'));this[_0xf185('0x1e')]=getSeconds(_0xa1eda1[_0xf185('0x1f')],_0xa1eda1[_0xf185('0x19')]);this['holdtime']=getSeconds(_0xa1eda1['answertime'],_0xa1eda1['responsetime']);this[_0xf185('0x20')]=getSeconds(this['endtime'],_0xa1eda1[_0xf185('0x1a')]);this[_0xf185('0xd')]=_0x4bafbc['queue'];this[_0xf185('0x21')]=_0x4bafbc[_0xf185('0x21')];this[_0xf185('0x22')]=_0x4bafbc[_0xf185('0x22')];this[_0xf185('0x23')]=_0xa1eda1['callback'];this['callbackuniqueid']=_0xa1eda1[_0xf185('0x24')];this[_0xf185('0x25')]=_0xa1eda1['callbackat'];this[_0xf185('0x26')]=_0xa1eda1[_0xf185('0x26')];this[_0xf185('0x27')]=_0xa1eda1[_0xf185('0x27')];this[_0xf185('0x28')]=_0xa1eda1['ListId'];this['UserId']=_0xa1eda1['UserId'];this['VoiceQueueId']=_0xa1eda1['VoiceQueueId'];this['CampaignId']=_0xa1eda1['CampaignId'];this[_0xf185('0x29')]=_0xa1eda1[_0xf185('0x29')]||'';this[_0xf185('0x2a')]=_0xa1eda1[_0xf185('0x2a')]||'';}module[_0xf185('0x2b')]=AgentComplete; \ No newline at end of file diff --git a/server/services/ami/dialer/final.js b/server/services/ami/dialer/final.js index b9db9d6..81ee829 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 _0x9948=['milliseconds','diff','uniqueid','type','campaigntype','outbound','queue','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','countnosuchnumberretry','calleridname','calleridnum','starttime','responsetime','endtime','ringtime','holdtime','talktime','callback','callbackuniqueid','callbackat','recallme','ListId','VoiceQueueId','CampaignId','originatecalleridnum','originatecalleridname','exports','util','lodash'];(function(_0x4c440b,_0x3ea627){var _0x2d48cf=function(_0x56bac7){while(--_0x56bac7){_0x4c440b['push'](_0x4c440b['shift']());}};_0x2d48cf(++_0x3ea627);}(_0x9948,0x142));var _0x8994=function(_0x26167e,_0x2772a6){_0x26167e=_0x26167e-0x0;var _0x3dd81d=_0x9948[_0x26167e];return _0x3dd81d;};'use strict';var util=require(_0x8994('0x0'));var _=require(_0x8994('0x1'));var moment=require('moment');function getSeconds(_0xc47ae,_0x5d2cd9){var _0x1ea996=moment(_0xc47ae)[_0x8994('0x2')](0x0);var _0x12fd69=moment(_0x5d2cd9)[_0x8994('0x2')](0x0);return _0x1ea996[_0x8994('0x3')](_0x12fd69,'seconds');}function Final(_0x4857c3){this['uniqueid']=_0x4857c3[_0x8994('0x4')];this['scheduledat']=_0x4857c3['scheduledat'];this[_0x8994('0x5')]=_0x4857c3[_0x8994('0x5')];this[_0x8994('0x6')]=_0x4857c3['type']===_0x8994('0x7')?_0x8994('0x8'):_0x4857c3[_0x8994('0x5')];this['countbusyretry']=_0x4857c3[_0x8994('0x9')];this['countcongestionretry']=_0x4857c3[_0x8994('0xa')];this[_0x8994('0xb')]=_0x4857c3[_0x8994('0xb')];this[_0x8994('0xc')]=_0x4857c3[_0x8994('0x9')]+_0x4857c3[_0x8994('0xa')]+_0x4857c3['countnoanswerretry']+_0x4857c3['countnosuchnumberretry']+_0x4857c3[_0x8994('0xd')]+_0x4857c3[_0x8994('0xe')]+_0x4857c3[_0x8994('0xf')]+_0x4857c3[_0x8994('0x10')];this[_0x8994('0x11')]=_0x4857c3[_0x8994('0x11')];this[_0x8994('0xd')]=_0x4857c3[_0x8994('0xd')];this[_0x8994('0xe')]=_0x4857c3[_0x8994('0xe')];this[_0x8994('0xf')]=_0x4857c3[_0x8994('0xf')];this[_0x8994('0x10')]=_0x4857c3[_0x8994('0x10')];this['queue']=_0x4857c3[_0x8994('0x8')];this[_0x8994('0x12')]=_0x4857c3['calleridname'];this[_0x8994('0x13')]=_0x4857c3[_0x8994('0x13')];this[_0x8994('0x14')]=_0x4857c3['starttime'];this[_0x8994('0x15')]=_0x4857c3[_0x8994('0x15')];this[_0x8994('0x16')]=_0x4857c3[_0x8994('0x15')];this['ringtime']=_0x4857c3[_0x8994('0x17')]||0x0;this[_0x8994('0x18')]=_0x4857c3['holdtime']||0x0;this[_0x8994('0x19')]=_0x4857c3[_0x8994('0x19')]||0x0;this[_0x8994('0x1a')]=_0x4857c3[_0x8994('0x1a')];this[_0x8994('0x1b')]=_0x4857c3[_0x8994('0x1b')];this[_0x8994('0x1c')]=_0x4857c3[_0x8994('0x1c')];this[_0x8994('0x1d')]=_0x4857c3['recallme'];this['ContactId']=_0x4857c3['ContactId'];this[_0x8994('0x1e')]=_0x4857c3[_0x8994('0x1e')];this['UserId']=_0x4857c3['UserId'];this[_0x8994('0x1f')]=_0x4857c3[_0x8994('0x1f')];this[_0x8994('0x20')]=_0x4857c3[_0x8994('0x20')];this['originatecalleridnum']=_0x4857c3[_0x8994('0x21')]||'';this[_0x8994('0x22')]=_0x4857c3[_0x8994('0x22')]||'';}module[_0x8994('0x23')]=Final; \ No newline at end of file +var _0x4eb1=['countabandonedretry','countmachineretry','countagentrejectretry','calleridname','calleridnum','starttime','responsetime','endtime','ringtime','holdtime','talktime','callback','callbackuniqueid','callbackat','recallme','ContactId','UserId','VoiceQueueId','CampaignId','originatecalleridnum','originatecalleridname','exports','util','lodash','moment','milliseconds','diff','seconds','uniqueid','scheduledat','type','campaigntype','outbound','queue','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countnosuchnumberretry','countdropretry'];(function(_0x1d211b,_0x475f3b){var _0x47c88b=function(_0x3126f5){while(--_0x3126f5){_0x1d211b['push'](_0x1d211b['shift']());}};_0x47c88b(++_0x475f3b);}(_0x4eb1,0x66));var _0x14eb=function(_0x5eef35,_0x2e2889){_0x5eef35=_0x5eef35-0x0;var _0xb746b0=_0x4eb1[_0x5eef35];return _0xb746b0;};'use strict';var util=require(_0x14eb('0x0'));var _=require(_0x14eb('0x1'));var moment=require(_0x14eb('0x2'));function getSeconds(_0x1cefc0,_0x3b3092){var _0x5a0def=moment(_0x1cefc0)[_0x14eb('0x3')](0x0);var _0x190317=moment(_0x3b3092)[_0x14eb('0x3')](0x0);return _0x5a0def[_0x14eb('0x4')](_0x190317,_0x14eb('0x5'));}function Final(_0x356300){this[_0x14eb('0x6')]=_0x356300[_0x14eb('0x6')];this[_0x14eb('0x7')]=_0x356300[_0x14eb('0x7')];this[_0x14eb('0x8')]=_0x356300[_0x14eb('0x8')];this[_0x14eb('0x9')]=_0x356300[_0x14eb('0x8')]===_0x14eb('0xa')?_0x14eb('0xb'):_0x356300['type'];this['countbusyretry']=_0x356300[_0x14eb('0xc')];this[_0x14eb('0xd')]=_0x356300[_0x14eb('0xd')];this[_0x14eb('0xe')]=_0x356300[_0x14eb('0xe')];this[_0x14eb('0xf')]=_0x356300[_0x14eb('0xc')]+_0x356300[_0x14eb('0xd')]+_0x356300[_0x14eb('0xe')]+_0x356300[_0x14eb('0x10')]+_0x356300[_0x14eb('0x11')]+_0x356300[_0x14eb('0x12')]+_0x356300[_0x14eb('0x13')]+_0x356300[_0x14eb('0x14')];this[_0x14eb('0x10')]=_0x356300[_0x14eb('0x10')];this[_0x14eb('0x11')]=_0x356300[_0x14eb('0x11')];this[_0x14eb('0x12')]=_0x356300[_0x14eb('0x12')];this[_0x14eb('0x13')]=_0x356300[_0x14eb('0x13')];this[_0x14eb('0x14')]=_0x356300[_0x14eb('0x14')];this[_0x14eb('0xb')]=_0x356300[_0x14eb('0xb')];this[_0x14eb('0x15')]=_0x356300[_0x14eb('0x15')];this[_0x14eb('0x16')]=_0x356300['calleridnum'];this[_0x14eb('0x17')]=_0x356300['starttime'];this[_0x14eb('0x18')]=_0x356300[_0x14eb('0x18')];this[_0x14eb('0x19')]=_0x356300['responsetime'];this[_0x14eb('0x1a')]=_0x356300[_0x14eb('0x1a')]||0x0;this[_0x14eb('0x1b')]=_0x356300[_0x14eb('0x1b')]||0x0;this[_0x14eb('0x1c')]=_0x356300[_0x14eb('0x1c')]||0x0;this[_0x14eb('0x1d')]=_0x356300[_0x14eb('0x1d')];this[_0x14eb('0x1e')]=_0x356300['callbackuniqueid'];this['callbackat']=_0x356300[_0x14eb('0x1f')];this[_0x14eb('0x20')]=_0x356300['recallme'];this[_0x14eb('0x21')]=_0x356300[_0x14eb('0x21')];this['ListId']=_0x356300['ListId'];this['UserId']=_0x356300[_0x14eb('0x22')];this[_0x14eb('0x23')]=_0x356300['VoiceQueueId'];this[_0x14eb('0x24')]=_0x356300[_0x14eb('0x24')];this[_0x14eb('0x25')]=_0x356300[_0x14eb('0x25')]||'';this[_0x14eb('0x26')]=_0x356300['originatecalleridname']||'';}module[_0x14eb('0x27')]=Final; \ No newline at end of file diff --git a/server/services/ami/dialer/hangup.js b/server/services/ami/dialer/hangup.js index d927650..5a66ab4 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 _0x88e2=['scheduledat','type','campaigntype','outbound','queue','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countnosuchnumberretry','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','uniqueid','calleridname','name','calleridnum','number','starttime','responsetime','endtime','format','ringtime','holdtime','talktime','IVR','cause-txt','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','CampaignId','exports','util','lodash','moment','milliseconds','diff','seconds'];(function(_0x1abb09,_0x18ee91){var _0xea1c07=function(_0x38f42c){while(--_0x38f42c){_0x1abb09['push'](_0x1abb09['shift']());}};_0xea1c07(++_0x18ee91);}(_0x88e2,0x12e));var _0x288e=function(_0x53f32b,_0x7fcfab){_0x53f32b=_0x53f32b-0x0;var _0x5bff4c=_0x88e2[_0x53f32b];return _0x5bff4c;};'use strict';var util=require(_0x288e('0x0'));var _=require(_0x288e('0x1'));var moment=require(_0x288e('0x2'));function getSeconds(_0x1c714c,_0x414b05){var _0x4f63f5=moment(_0x1c714c)[_0x288e('0x3')](0x0);var _0x70874=moment(_0x414b05)[_0x288e('0x3')](0x0);return _0x4f63f5[_0x288e('0x4')](_0x70874,_0x288e('0x5'));}function Hangup(_0x53cc73,_0x573cad){this['state']=0x4;this['statedesc']='Answer';this[_0x288e('0x6')]=_0x53cc73['scheduledat'];this[_0x288e('0x7')]=_0x53cc73[_0x288e('0x7')];this[_0x288e('0x8')]=_0x53cc73['type']===_0x288e('0x9')?_0x288e('0xa'):_0x53cc73[_0x288e('0x7')];this[_0x288e('0xb')]=_0x53cc73['countbusyretry'];this[_0x288e('0xc')]=_0x53cc73[_0x288e('0xc')];this[_0x288e('0xd')]=_0x53cc73[_0x288e('0xd')];this[_0x288e('0xe')]=_0x53cc73[_0x288e('0xb')]+_0x53cc73[_0x288e('0xc')]+_0x53cc73[_0x288e('0xd')]+_0x53cc73[_0x288e('0xf')]+_0x53cc73[_0x288e('0x10')]+_0x53cc73[_0x288e('0x11')]+_0x53cc73[_0x288e('0x12')]+_0x53cc73[_0x288e('0x13')];this[_0x288e('0xf')]=_0x53cc73[_0x288e('0xf')];this[_0x288e('0x10')]=_0x53cc73[_0x288e('0x10')];this[_0x288e('0x11')]=_0x53cc73[_0x288e('0x11')];this[_0x288e('0x12')]=_0x53cc73[_0x288e('0x12')];this[_0x288e('0x13')]=_0x53cc73['countagentrejectretry'];this[_0x288e('0x14')]=_0x573cad[_0x288e('0x14')];this[_0x288e('0x15')]=_0x53cc73[_0x288e('0x16')];this[_0x288e('0x17')]=_0x53cc73[_0x288e('0x18')];this[_0x288e('0x19')]=_0x53cc73[_0x288e('0x19')];this[_0x288e('0x1a')]=_0x53cc73['responsetime'];this[_0x288e('0x1b')]=moment()[_0x288e('0x1c')]('YYYY-MM-DD\x20HH:mm:ss');this[_0x288e('0x1d')]=getSeconds(_0x53cc73[_0x288e('0x1a')],_0x53cc73[_0x288e('0x19')]);this[_0x288e('0x1e')]=0x0;this[_0x288e('0x1f')]=getSeconds(this[_0x288e('0x1b')],_0x53cc73[_0x288e('0x1a')]);this['queue']=_0x53cc73[_0x288e('0xa')];this['membername']=_0x288e('0x20');this['reason']=_0x573cad[_0x288e('0x21')];this[_0x288e('0x22')]=_0x53cc73[_0x288e('0x22')];this['callbackuniqueid']=_0x53cc73[_0x288e('0x23')];this[_0x288e('0x24')]=_0x53cc73['callbackat'];this[_0x288e('0x25')]=_0x53cc73[_0x288e('0x25')];this[_0x288e('0x26')]=_0x53cc73[_0x288e('0x26')];this[_0x288e('0x27')]=_0x53cc73['ListId'];this[_0x288e('0x28')]=_0x53cc73[_0x288e('0x28')];this['VoiceQueueId']=_0x53cc73[_0x288e('0x29')];this[_0x288e('0x2a')]=_0x53cc73[_0x288e('0x2a')];}module[_0x288e('0x2b')]=Hangup; \ No newline at end of file +var _0x94f9=['VoiceQueueId','CampaignId','exports','util','lodash','moment','milliseconds','diff','state','Answer','scheduledat','type','campaigntype','outbound','queue','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countnosuchnumberretry','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','calleridname','calleridnum','starttime','responsetime','format','YYYY-MM-DD\x20HH:mm:ss','ringtime','membername','IVR','reason','cause-txt','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x94f9,0x1a7));var _0x994f=function(_0x50f92b,_0x32fab3){_0x50f92b=_0x50f92b-0x0;var _0x5cedbc=_0x94f9[_0x50f92b];return _0x5cedbc;};'use strict';var util=require(_0x994f('0x0'));var _=require(_0x994f('0x1'));var moment=require(_0x994f('0x2'));function getSeconds(_0x18a511,_0x2f4ee0){var _0x1ac59f=moment(_0x18a511)[_0x994f('0x3')](0x0);var _0x2e7228=moment(_0x2f4ee0)[_0x994f('0x3')](0x0);return _0x1ac59f[_0x994f('0x4')](_0x2e7228,'seconds');}function Hangup(_0x2a5b37,_0x262a88){this[_0x994f('0x5')]=0x4;this['statedesc']=_0x994f('0x6');this[_0x994f('0x7')]=_0x2a5b37[_0x994f('0x7')];this[_0x994f('0x8')]=_0x2a5b37['type'];this[_0x994f('0x9')]=_0x2a5b37[_0x994f('0x8')]===_0x994f('0xa')?_0x994f('0xb'):_0x2a5b37['type'];this[_0x994f('0xc')]=_0x2a5b37['countbusyretry'];this[_0x994f('0xd')]=_0x2a5b37[_0x994f('0xd')];this[_0x994f('0xe')]=_0x2a5b37['countnoanswerretry'];this[_0x994f('0xf')]=_0x2a5b37['countbusyretry']+_0x2a5b37[_0x994f('0xd')]+_0x2a5b37[_0x994f('0xe')]+_0x2a5b37[_0x994f('0x10')]+_0x2a5b37[_0x994f('0x11')]+_0x2a5b37[_0x994f('0x12')]+_0x2a5b37[_0x994f('0x13')]+_0x2a5b37[_0x994f('0x14')];this[_0x994f('0x10')]=_0x2a5b37[_0x994f('0x10')];this[_0x994f('0x11')]=_0x2a5b37['countdropretry'];this[_0x994f('0x12')]=_0x2a5b37[_0x994f('0x12')];this[_0x994f('0x13')]=_0x2a5b37[_0x994f('0x13')];this[_0x994f('0x14')]=_0x2a5b37[_0x994f('0x14')];this['uniqueid']=_0x262a88['uniqueid'];this[_0x994f('0x15')]=_0x2a5b37['name'];this[_0x994f('0x16')]=_0x2a5b37['number'];this[_0x994f('0x17')]=_0x2a5b37['starttime'];this['responsetime']=_0x2a5b37[_0x994f('0x18')];this['endtime']=moment()[_0x994f('0x19')](_0x994f('0x1a'));this[_0x994f('0x1b')]=getSeconds(_0x2a5b37[_0x994f('0x18')],_0x2a5b37[_0x994f('0x17')]);this['holdtime']=0x0;this['talktime']=getSeconds(this['endtime'],_0x2a5b37[_0x994f('0x18')]);this[_0x994f('0xb')]=_0x2a5b37['queue'];this[_0x994f('0x1c')]=_0x994f('0x1d');this[_0x994f('0x1e')]=_0x262a88[_0x994f('0x1f')];this[_0x994f('0x20')]=_0x2a5b37['callback'];this[_0x994f('0x21')]=_0x2a5b37[_0x994f('0x21')];this['callbackat']=_0x2a5b37[_0x994f('0x22')];this['recallme']=_0x2a5b37[_0x994f('0x23')];this[_0x994f('0x24')]=_0x2a5b37[_0x994f('0x24')];this[_0x994f('0x25')]=_0x2a5b37[_0x994f('0x25')];this[_0x994f('0x26')]=_0x2a5b37[_0x994f('0x26')];this[_0x994f('0x27')]=_0x2a5b37['VoiceQueueId'];this[_0x994f('0x28')]=_0x2a5b37['CampaignId'];}module[_0x994f('0x29')]=Hangup; \ No newline at end of file diff --git a/server/services/ami/dialer/history.js b/server/services/ami/dialer/history.js index 4a30ea9..f5b8f03 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 _0x63c4=['lodash','moment','milliseconds','seconds','uniqueid','scheduledat','type','campaigntype','queue','countbusyretry','countcongestionretry','countnoanswerretry','countabandonedretry','countmachineretry','countnosuchnumberretry','countagentrejectretry','calleridname','name','calleridnum','number','starttime','responsetime','holdtime','talktime','callback','callbackuniqueid','callbackat','recallme','ListId','UserId','VoiceQueueId','CampaignId','originatecalleridnum','originatecalleridname','util'];(function(_0x31aa78,_0x390f1c){var _0x5930e5=function(_0x4c684b){while(--_0x4c684b){_0x31aa78['push'](_0x31aa78['shift']());}};_0x5930e5(++_0x390f1c);}(_0x63c4,0x1c6));var _0x463c=function(_0x28e46f,_0x599926){_0x28e46f=_0x28e46f-0x0;var _0x405b3e=_0x63c4[_0x28e46f];return _0x405b3e;};'use strict';var util=require(_0x463c('0x0'));var _=require(_0x463c('0x1'));var moment=require(_0x463c('0x2'));function getSeconds(_0x1a4226,_0x7b26dd){var _0x37fc1e=moment(_0x1a4226)[_0x463c('0x3')](0x0);var _0x1d29dc=moment(_0x7b26dd)[_0x463c('0x3')](0x0);return _0x37fc1e['diff'](_0x1d29dc,_0x463c('0x4'));}function History(_0x2f5652){this[_0x463c('0x5')]=_0x2f5652[_0x463c('0x5')];this['scheduledat']=_0x2f5652[_0x463c('0x6')]||undefined;this[_0x463c('0x7')]=_0x2f5652[_0x463c('0x7')];this[_0x463c('0x8')]=_0x2f5652[_0x463c('0x7')]==='outbound'?_0x463c('0x9'):_0x2f5652[_0x463c('0x7')];this['countbusyretry']=_0x2f5652[_0x463c('0xa')];this[_0x463c('0xb')]=_0x2f5652[_0x463c('0xb')];this[_0x463c('0xc')]=_0x2f5652[_0x463c('0xc')];this['countglobal']=_0x2f5652[_0x463c('0xa')]+_0x2f5652[_0x463c('0xb')]+_0x2f5652['countnoanswerretry']+_0x2f5652['countnosuchnumberretry']+_0x2f5652['countdropretry']+_0x2f5652[_0x463c('0xd')]+_0x2f5652[_0x463c('0xe')]+_0x2f5652['countagentrejectretry'];this[_0x463c('0xf')]=_0x2f5652[_0x463c('0xf')];this['countdropretry']=_0x2f5652['countdropretry'];this['countabandonedretry']=_0x2f5652[_0x463c('0xd')];this[_0x463c('0xe')]=_0x2f5652[_0x463c('0xe')];this[_0x463c('0x10')]=_0x2f5652['countagentrejectretry'];this[_0x463c('0x9')]=_0x2f5652[_0x463c('0x9')];this[_0x463c('0x11')]=_0x2f5652[_0x463c('0x12')];this[_0x463c('0x13')]=_0x2f5652[_0x463c('0x14')];this[_0x463c('0x15')]=_0x2f5652[_0x463c('0x15')];this[_0x463c('0x16')]=_0x2f5652['responsetime'];this['endtime']=_0x2f5652[_0x463c('0x16')];this['ringtime']=getSeconds(_0x2f5652['responsetime'],_0x2f5652[_0x463c('0x15')]);this[_0x463c('0x17')]=0x0;this[_0x463c('0x18')]=0x0;this[_0x463c('0x19')]=_0x2f5652['callback'];this['callbackuniqueid']=_0x2f5652[_0x463c('0x1a')];this['callbackat']=_0x2f5652[_0x463c('0x1b')];this['recallme']=_0x2f5652[_0x463c('0x1c')];this['ContactId']=_0x2f5652['ContactId'];this[_0x463c('0x1d')]=_0x2f5652[_0x463c('0x1d')];this[_0x463c('0x1e')]=_0x2f5652['UserId'];this[_0x463c('0x1f')]=_0x2f5652[_0x463c('0x1f')];this[_0x463c('0x20')]=_0x2f5652['CampaignId'];this[_0x463c('0x21')]=_0x2f5652[_0x463c('0x21')]||'';this['originatecalleridname']=_0x2f5652[_0x463c('0x22')]||'';}module['exports']=History; \ No newline at end of file +var _0xff2a=['moment','diff','seconds','uniqueid','scheduledat','type','campaigntype','outbound','queue','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countnosuchnumberretry','countdropretry','countmachineretry','countagentrejectretry','calleridname','calleridnum','number','starttime','responsetime','endtime','ringtime','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','CampaignId','originatecalleridnum','originatecalleridname','exports','lodash'];(function(_0x3b2d25,_0x511ed6){var _0x279bd7=function(_0x55baf8){while(--_0x55baf8){_0x3b2d25['push'](_0x3b2d25['shift']());}};_0x279bd7(++_0x511ed6);}(_0xff2a,0x93));var _0xaff2=function(_0x3efe9b,_0x5b41a8){_0x3efe9b=_0x3efe9b-0x0;var _0x132073=_0xff2a[_0x3efe9b];return _0x132073;};'use strict';var util=require('util');var _=require(_0xaff2('0x0'));var moment=require(_0xaff2('0x1'));function getSeconds(_0x490c25,_0x1c7cc9){var _0x25db80=moment(_0x490c25)['milliseconds'](0x0);var _0x256bf0=moment(_0x1c7cc9)['milliseconds'](0x0);return _0x25db80[_0xaff2('0x2')](_0x256bf0,_0xaff2('0x3'));}function History(_0x5a704c){this[_0xaff2('0x4')]=_0x5a704c[_0xaff2('0x4')];this[_0xaff2('0x5')]=_0x5a704c[_0xaff2('0x5')]||undefined;this[_0xaff2('0x6')]=_0x5a704c[_0xaff2('0x6')];this[_0xaff2('0x7')]=_0x5a704c[_0xaff2('0x6')]===_0xaff2('0x8')?_0xaff2('0x9'):_0x5a704c['type'];this[_0xaff2('0xa')]=_0x5a704c['countbusyretry'];this['countcongestionretry']=_0x5a704c[_0xaff2('0xb')];this[_0xaff2('0xc')]=_0x5a704c[_0xaff2('0xc')];this[_0xaff2('0xd')]=_0x5a704c[_0xaff2('0xa')]+_0x5a704c['countcongestionretry']+_0x5a704c[_0xaff2('0xc')]+_0x5a704c[_0xaff2('0xe')]+_0x5a704c[_0xaff2('0xf')]+_0x5a704c['countabandonedretry']+_0x5a704c[_0xaff2('0x10')]+_0x5a704c[_0xaff2('0x11')];this['countnosuchnumberretry']=_0x5a704c[_0xaff2('0xe')];this['countdropretry']=_0x5a704c[_0xaff2('0xf')];this['countabandonedretry']=_0x5a704c['countabandonedretry'];this[_0xaff2('0x10')]=_0x5a704c['countmachineretry'];this[_0xaff2('0x11')]=_0x5a704c[_0xaff2('0x11')];this[_0xaff2('0x9')]=_0x5a704c[_0xaff2('0x9')];this[_0xaff2('0x12')]=_0x5a704c['name'];this[_0xaff2('0x13')]=_0x5a704c[_0xaff2('0x14')];this[_0xaff2('0x15')]=_0x5a704c[_0xaff2('0x15')];this[_0xaff2('0x16')]=_0x5a704c[_0xaff2('0x16')];this[_0xaff2('0x17')]=_0x5a704c['responsetime'];this[_0xaff2('0x18')]=getSeconds(_0x5a704c['responsetime'],_0x5a704c[_0xaff2('0x15')]);this['holdtime']=0x0;this['talktime']=0x0;this[_0xaff2('0x19')]=_0x5a704c['callback'];this['callbackuniqueid']=_0x5a704c[_0xaff2('0x1a')];this[_0xaff2('0x1b')]=_0x5a704c[_0xaff2('0x1b')];this[_0xaff2('0x1c')]=_0x5a704c[_0xaff2('0x1c')];this[_0xaff2('0x1d')]=_0x5a704c['ContactId'];this['ListId']=_0x5a704c[_0xaff2('0x1e')];this[_0xaff2('0x1f')]=_0x5a704c['UserId'];this['VoiceQueueId']=_0x5a704c[_0xaff2('0x20')];this[_0xaff2('0x21')]=_0x5a704c[_0xaff2('0x21')];this['originatecalleridnum']=_0x5a704c[_0xaff2('0x22')]||'';this[_0xaff2('0x23')]=_0x5a704c[_0xaff2('0x23')]||'';}module[_0xaff2('0x24')]=History; \ No newline at end of file diff --git a/server/services/ami/dialer/index.js b/server/services/ami/dialer/index.js index 0227d57..2563f87 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 _0x7c8e=['predictiveIntervalMultiplicativeFactor','predictiveIntervalPauses','predictiveIntervalAvailable','predictiveIntervalTotalCalls','originated','erlangCallToSecond','erlangAbandonmentRate','Trunk','callerid','md5','format','voice:queue:%s','voice_queue:save','ivr','campaign:ivr:%s','campaign:save','-----\x20Stats\x20Predictive\x20---','info','Answered\x20Calls:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','Dropped\x20Exit:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','AVG\x20Hold\x20Time:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','AVG\x20Talk\x20Time:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','isUndefined','Avg\x20Talk\x20Time\x20is\x20not\x20enough\x20for\x20predictive','Avg\x20Hold\x20Time\x20is\x20not\x20enough\x20for\x20predictive','History\x20information\x20are\x20empty','Scheduled\x20Calls:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','erlangCalls','erlangBusyFactor','Drop\x20Rate:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','---------------------------','clearing\x20variable\x20start\x20predictive','handlePredictive','clearing\x20variable\x20handle\x20predictive','string','\x22%s\x22\x20<%s>','\x22\x22\x20<>','error','inspect','length','hasOwnProperty','[decremetOriginate]\x20object\x20originated\x20is\x20negative','[decremetOriginate]\x20is\x20null\x20or\x20undefined','contactsRescheduled','RESCHEDULED_CONTACTS','[getContactDialer2][ReScheduled]','contacts','AVAILABLE_CONTACTS_FINISHED','[getContactDialer2][Empty]','talking','sendMessageOneNotActive','NOT_ACTIVE','[syncQueueSummary]\x20Campaign\x20Queue:\x20','is\x20not\x20active','IS_DISACTIVED','is\x20disactive','[syncQueueSummary]\x20Campaign\x20Ivr:\x20','statedesc','endtime','starttime','clearZombieChannels','[uniqueid]','[actions]','isNil','Action','status','channel','catch','updateOriginated','queue','[Dialer][checkChannel][ivr]','countReScheduled','then','[countReScheduled]\x20','checkIsBlackList','resolve','[checkIsBlackListIvr]\x20','averageHandleTime','avgHandleTime','[averageHandleTime]\x20','rescheduleContact','[rescheduleContact]\x20','unlockContact','[unlockContact]\x20','getContactDialer','[getContactDialer]\x20','getVoiceQueueRtPauses','[getVoiceQueueRtPauses]\x20','moveContactManagedDialer','[moveContactManagedDialer]\x20','createHistory','[createHistory]\x20','[updateOriginated]\x20is\x20null\x20or\x20undefined','loggerHandler','emptyContact','notFound','saveInDb','merge','pick','ContactId','ListId','UserId','VoiceQueueId','CampaignId','[emptyContact][createHistory]','[emptyContact]','isSuccess','active','SIP/%s','unmonitored','variable','amdstatus','exten','xcally-motion-dialer','dialAMDActive','value','HANGUP','uniqueid','state','membername','AMD','[syncHangupInAMD][createHistory]','[syncHangupInAMD]','MACHINE','Machine','amd','[syncMachine][createHistory]','[syncMachine]','HangupInAMD','[syncHangupInAMDIvr]','[syncMachineIvr][createHistory]','[syncMachineIvr]','ivrAnswerCallsDay','[syncHangupIvr][createHistory]','dialQueueProject','AnswerAGI','AGI','[syncHangupIvr]','outboundUnknownCallsDay','cause-txt','reason','agiafterat','dialQueueProject2','dialAgiAfterHangupAgent','[syncAgentComplete][createHistory]','[syncAgentComplete]','answertime','YYYY-MM-DD\x20HH:mm:ss','syncQueueCallerAbandon','droptime','responsetime','dialQueueTimeout','Drop','TIMEOUT','countdropretry','dialDropMaxRetry','queueCallerAbandonCreateState','add','dialDropRetryFrequency','minutes','[rescheduleContact][Drop]','log','CRIS\x20createHistory\x2010','[syncAgentComplete][createHistory][10]','Abandoned','dropreason','CALLEREXIT','countabandonedretry','dialAbandonedMaxRetry','dialAbandonedRetryFrequency','CRIS\x20createHistory\x2011','[syncAgentComplete][createHistory][11]','syncNewExten','actionid','strategy','stateinterface','locked','rrmemory','push','idHopper','paused','queueStatusComplete','[booked][unlockQueueStatus]','run','[Catch][Preview][syncQueueStatusComplete]','[unlock][syncQueueStatusComplete]','queueBookedRR','_rr','unlockRR','[booked][RR]','Agent:\x20','contactAgent-idHopper:\x20','[booked][RR][finaly]','[booked][unlock]','[booked][unlock2]','[booked][unlock3]','[unlock3][syncQueueStatusComplete]','syncCampaigns','isTrunkReachable','TrunkBackup','\x20trunk\x20is\x20not\x20reachable','checkIfTime','ifTime','\x20Intervals\x20is\x20null\x20','timezones','TIMEZONE_UNKNOW','\x20Timezone\x20unknow\x20','isArray','iftime\x20%s,%s','interval','content','true','indexOf','some','GLOBAL_INTERVAL_IS_OVERTIME','INTERVAL_IS_OVERTIME','[ifTime][promiseAll]','Failure','Global:\x20','checkDialMethod','progressive','handlePower','power','dialPowerLevel','predictive','Queue','method\x20not\x20recognized','launchHandleIvr','handleIvr','dialActive','dialGlobalInterval','dialTimezone','[syncQueueSummary]','checkIfTimeIntervals','[syncCampaigns]','\x5cw{0,','pow','replace','match','object','originate','Contact','phone','getCaller','\x22agi://%s/square,%s\x22','NONE','dialQueueOptions','ACTIVE','XMD-AMDINITIALSILENCE','dialAMDInitialSilence','XMD-AMDGREETING','dialAMDGreeting','XMD-AMDAFTERGREETINGSILENCE','dialAMDAfterGreetingSilence','XMD-AMDTOTALANALYSISTIME','dialAMDTotalAnalysisTime','XMD-AMDMINWORDLENGTH','dialAMDMinWordLength','XMD-AMDBETWEENWORDSSILENCE','dialAMDMaximumNumberOfWords','XMD-AMDSILENCETHRESHOLD','dialAMDSilenceThreshold','XMD-AMDMAXIMUMWORDLENGTH','XMD-VOICEQUEUEID','XMD-CAMPAIGNID','tags','createdAt','updatedAt','%s%s','XMD-','toUpper','dialRandomLastDigitCallerIdNumber','XMD-ORIGINATECALLERIDNAME','XMD-ORIGINATECALLERIDNUM','SIP/%s/%s%s','dialCutDigit','substring','from-sip','dialOriginateTimeout','[originateError]:\x20%s','OriginateError','[originate][error]','getQueue','response','[callProgressDetecting]\x20','checkRetriveMax','countbusyretry','countcongestionretry','countnoanswerretry','countnosuchnumberretry','countmachineretry','countagentrejectretry','dialGlobalMaxRetry','dialNoAnswerMaxRetry','dialBusyMaxRetry','dialBusyRetryFrequency','dialCongestionMaxRetry','dialCongestionRetryFrequency','[rescheduleContact]\x20[Congestion]','dialNoSuchNumberMaxRetry','dialNoSuchNumberRetryFrequency','[rescheduleContact][NoSuchNumber]','[rescheduleContact][Abandoned]','dialMachineRetryFrequency','[rescheduleContact][Machine]','dialAgentRejectMaxRetry','dialAgentRejectRetryFrequency','[rescheduleContact][AgentReject]','callProgressDetecting','[callProgressDetecting]','entity\x20is\x20undefine','evt\x20is\x20undefine','NoSuchNumber','countglobal','[syncAgentComplete][createHistory][0]','stateGlobal','createStateFinal','reason\x200\x20no\x20such\x20number....','NoAnswer','[syncAgentComplete][createHistory][3]','reason\x203\x20ringing\x20no\x20answer','[syncAgentComplete][createHistory][5]','reason\x205\x20busy','Congestion','[syncAgentComplete][createHistory][8]','reason\x208\x20congestion','reason\x2011\x20abandoned','AgentReject','[syncAgentComplete][createHistory][20]','reason\x2020\x20agentreject','[syncAgentComplete][createHistory][?]','Global','[moveContactManagedDialer][0]','contact\x20not\x20moved','dialPredictiveOptimizationPercentage','round','predictiveIntervalMaxThreshold','floor','[startMethodPredictive][StartProgressive]','check\x20predictive\x20is\x20not\x20undefine','check\x20handlePredictive\x20is\x20not\x20undefine','collection\x20data\x20in\x20progressive\x20at','dialPredictiveInterval','dialPredictiveOptimization','dropRate','[stopMethodPredictive][ReStartProgressive][ExceededDropDay]','Dropped\x20calls\x20day','[stopMethodPredictive][ReStartProgressive][ExceededDropInterval]','Max\x20Drop\x20','Drop\x20in\x20this\x20interval','started\x20in\x20predictive\x20at','getDataPredictive','startMethodPredictive','recalculate\x20predictive\x20at','Predictive\x20for\x20every\x20interval',')\x20are\x20less\x20than\x20threshold\x20(','switch\x20in\x20progressive\x20because\x20available\x20agents\x20(',')\x20are\x20more\x20than\x20threshold\x20(','predictiveIntervalAnsweredCalls','abandonmentRate','agentBusyFactor','busyFactor','[getDataPredictive]','Unknown\x20Predictive','check\x20failure','getDataPredictiveOld','outboundQueuePauses','[CatchErlangB]','one\x20call\x20every:','[handlePredictive]','fail\x20to\x20scheduled\x20calls','checkContactBlack','[booked][checkContactBlack]','queueStatusComplete:\x20','Queue:\x20','[unlockOriginate][syncQueueStatusComplete]','[booked][checkContactBlack][else]','actionOriginate','scheduledat','dialRecallMeTimeout','Agent','Contact\x20updated','outboundReCallsDay','dialRecallInQueue','[rescheduleContact][dialRecallInQueue]','RECALLINQUEUE','[Originate][HistoryDialRecallInQueue][historyCatch]','RECALLFAILEDTIMEOUT','RecallFailedTimeout','[Originate][HistoryRecallClose][historyCatch]','[Originate][HistoryRecallClose]','outboundBlacklistCallsDay','BLACKLIST','Blacklist','[Originate][historyBlacklist]','inBlackList','limitCalls','temp','getContactDialerIvr','dialOrderByScheduledAt','[getContactCampaign2][Empty]','ivrTotalCallsDays','checkIsBlackListIvr','Contact.phone','booked','dialLimitQueue','not_inuse','reachable','RUNNING','[actionOriginate]\x20','[getContactDialer2]','tryOriginatePredictive','[handlePredictive][limitChannel]','[getContactDialerPredictive]','Interval:\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','m\x20=\x20','[abandonmentRate]','Ts\x20=\x20','p\x20=\x20','interval\x20=\x20','----\x20Agent\x20Busy\x20Factor\x20----','M:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','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','Umin:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','[busyFactor]','Umin\x20=\x20','exports','util','lodash','bluebird','uuid','moment','ioredis','../../../config/logger','dialer','predictiveCalls','syncQueueSummary','redis','defaults','localhost','../rpc/cmHopperFinal','../rpc/cmHopperHistory','../rpc/cmHopperBlack','../rpc/voiceQueueRt','./action','./history','./final','./agentComplete','env','XCALLY_IP_AGI','roundrobin','prototype','enqueue','tail','finally','sequence','preview','voiceQueues','campaigns','agents','trunks','maxNumberOriginate','channels','actions','uniqueId','startPredictive','startProgressive','ivrOriginated','queueBooked','agentconnect','syncAgentConnect','bind','queuecallerabandon','originateresponse','syncOriginateResponse','syncAgentComplete','syncHangup','newexten','syncVarSet','syncQueueMember','syncQueueStatusComplete','loopCampaigns','loopClearZombieChannels','message','AGENTS_NOT_LOGGED','name','\x20AGENTS\x20NOT\x20LOGGED','\x20NOT\x20Active','Interval','INTERVAL_IS_NULL','\x20INTERVAL_IS_NULL','isEmpty','Intervals','[ifTime][Action]','Error','stringify','milliseconds','diff','seconds','emit','type','outbound','answered','available','loggedIn','pTalking','sumBillable','sumHoldTime','abandoned','waiting','loggedInDb','dialMethod','dialOriginateCallerIdName','dialOriginateCallerIdNumber','dialPrefix','outboundAnswerAgiCallsDay','outboundAnswerCallsDay','outboundBusyCallsDay','outboundCongestionCallsDay','outboundDropCallsDayCallersExit','outboundDropCallsDayTimeout','outboundNoAnswerCallsDay','outboundNoSuchCallsDay','outboundOriginateFailureCallsDay','outboundRejectCallsDay','predictiveIntervalAvgHoldtime','predictiveIntervalAvgTalktime','predictiveIntervalDroppedCallsCallersExit','predictiveIntervalDroppedCallsTimeout','predictiveIntervalErlangCallsDroppedCalls','predictiveIntervalHitRate'];(function(_0x145b3c,_0x31ea4a){var _0x1b6e36=function(_0xfccee6){while(--_0xfccee6){_0x145b3c['push'](_0x145b3c['shift']());}};_0x1b6e36(++_0x31ea4a);}(_0x7c8e,0x1ad));var _0xe7c8=function(_0x2ee93b,_0x82445f){_0x2ee93b=_0x2ee93b-0x0;var _0x37c343=_0x7c8e[_0x2ee93b];return _0x37c343;};'use strict';var util=require(_0xe7c8('0x0'));var _=require(_0xe7c8('0x1'));var BPromise=require(_0xe7c8('0x2'));var uuid=require(_0xe7c8('0x3'));var moment=require(_0xe7c8('0x4'));var rr=require('rr');var md5=require('md5');var Redis=require(_0xe7c8('0x5'));var config=require('../../../config/environment/');var logger=require(_0xe7c8('0x6'))(_0xe7c8('0x7'));var loggerBooked=require(_0xe7c8('0x6'))('booked');var loggerPredictive=require(_0xe7c8('0x6'))('predictive');var loggerPredictiveCalls=require(_0xe7c8('0x6'))(_0xe7c8('0x8'));var loggerSyncQueueSummary=require(_0xe7c8('0x6'))(_0xe7c8('0x9'));var ami=require('../ami');config[_0xe7c8('0xa')]=_[_0xe7c8('0xb')](config[_0xe7c8('0xa')],{'host':_0xe7c8('0xc'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0xe7c8('0xa')]));var cmHopper=require('../rpc/cmHopper');var cmHopperFinal=require(_0xe7c8('0xd'));var cmHopperHistory=require(_0xe7c8('0xe'));var cmHopperBlack=require(_0xe7c8('0xf'));var voiceQueueRt=require(_0xe7c8('0x10'));var Action=require(_0xe7c8('0x11'));var History=require(_0xe7c8('0x12'));var Final=require(_0xe7c8('0x13'));var AgentComplete=require(_0xe7c8('0x14'));var QueueCallerAbandon=require('./queueCallerAbandon');var Hangup=require('./hangup');var ipAgi=process[_0xe7c8('0x15')][_0xe7c8('0x16')]||'127.0.0.1';var strategy={'rrmemory':'rrmemory','roundrobin':_0xe7c8('0x17')};var Sequence=function(){};Sequence[_0xe7c8('0x18')][_0xe7c8('0x19')]=function(_0x4b1058){this['tail']=this['tail']?this[_0xe7c8('0x1a')][_0xe7c8('0x1b')](_0x4b1058):_0x4b1058();};function Dialer(_0x5667c9,_0x432ea8){this[_0xe7c8('0x1c')]=new Sequence();this[_0xe7c8('0x1d')]=_0x432ea8;this[_0xe7c8('0x1e')]=_0x5667c9['voiceQueues'];this[_0xe7c8('0x1f')]=_0x5667c9['campaigns'];this[_0xe7c8('0x20')]=_0x5667c9[_0xe7c8('0x20')];this[_0xe7c8('0x21')]=_0x5667c9[_0xe7c8('0x21')];this[_0xe7c8('0x22')]=config['maxNumberOriginate']||0x2;this[_0xe7c8('0x23')]={};this[_0xe7c8('0x24')]={};this['contactsId']={};this[_0xe7c8('0x25')]={};this['optionPredictive']={};this[_0xe7c8('0x26')]={};this[_0xe7c8('0x27')]={};this[_0xe7c8('0x28')]={};this[_0xe7c8('0x29')]={};this['queueBookedRR']={};ami['on'](_0xe7c8('0x2a'),this[_0xe7c8('0x2b')][_0xe7c8('0x2c')](this));ami['on'](_0xe7c8('0x2d'),this['syncQueueCallerAbandon']['bind'](this));ami['on'](_0xe7c8('0x2e'),this[_0xe7c8('0x2f')]['bind'](this));ami['on']('agentcomplete',this[_0xe7c8('0x30')][_0xe7c8('0x2c')](this));ami['on']('custom:queuesummary',this['syncQueueSummary'][_0xe7c8('0x2c')](this));ami['on']('hangup',this[_0xe7c8('0x31')][_0xe7c8('0x2c')](this));ami['on'](_0xe7c8('0x32'),this['syncNewExten'][_0xe7c8('0x2c')](this));ami['on']('varset',this[_0xe7c8('0x33')][_0xe7c8('0x2c')](this));ami['on']('queuemember',this[_0xe7c8('0x34')]['bind'](this));ami['on']('queuestatuscomplete',this[_0xe7c8('0x35')][_0xe7c8('0x2c')](this));this[_0xe7c8('0x36')]();this[_0xe7c8('0x37')]();}function isNotNull(_0x1f9d89){return _0x1f9d89!==null&&!_['isUndefined'](_0x1f9d89);}function checkIsLoggedIn(_0x5368ad,_0x3d9a1d){return function(){if(_0x3d9a1d<=0x0){_0x5368ad[_0xe7c8('0x38')]=_0xe7c8('0x39');throw _0x5368ad[_0xe7c8('0x3a')]+_0xe7c8('0x3b');}};}function isActive(_0x3599d2){return _0x3599d2;}function checkIsActive(_0x5053ff,_0x2c42ec){return function(){if(!isActive(_0x2c42ec)){_0x5053ff[_0xe7c8('0x38')]='NOT_ACTIVE';throw _0x5053ff['name']+_0xe7c8('0x3c');}};}function checkInterval(_0x46b174){return function(){if(!isNotNull(_0x46b174[_0xe7c8('0x3d')])){_0x46b174['message']=_0xe7c8('0x3e');throw _0x46b174[_0xe7c8('0x3a')]+_0xe7c8('0x3f');}if(!isNotNull(_0x46b174[_0xe7c8('0x3d')]['Intervals'])){_0x46b174['message']=_0xe7c8('0x3e');throw _0x46b174[_0xe7c8('0x3a')]+_0xe7c8('0x3f');}if(!isNotNull(_[_0xe7c8('0x40')](_0x46b174[_0xe7c8('0x3d')][_0xe7c8('0x41')]))){_0x46b174[_0xe7c8('0x38')]='INTERVAL_IS_NULL';throw _0x46b174[_0xe7c8('0x3a')]+_0xe7c8('0x3f');}};}function msgResponse(_0x5bdf4b,_0x396e56,_0x453a1f){return{'action':_0x5bdf4b,'response':_0x396e56,'message':_0x453a1f,'stack':_0x453a1f};}function myreject(_0x2dc614){return function(_0x188b52){return _0x2dc614(msgResponse(_0xe7c8('0x42'),_0xe7c8('0x43'),JSON[_0xe7c8('0x44')](_0x188b52)));};}function getSeconds(_0x2c02cb,_0x761c6){var _0x47955d=moment(_0x2c02cb)[_0xe7c8('0x45')](0x0);var _0x2b1332=moment(_0x761c6)[_0xe7c8('0x45')](0x0);return _0x47955d[_0xe7c8('0x46')](_0x2b1332,_0xe7c8('0x47'));}function emit(_0x15f1f1,_0x14b531,_0x38a41e){io['to'](_0x15f1f1)[_0xe7c8('0x48')](_0x14b531,_0x38a41e);}function emitVoiceQueueSummary(_0xebbb56){if(_0xebbb56[_0xe7c8('0x49')]===_0xe7c8('0x4a')){var _0x1f576e={'id':_0xebbb56['id'],'name':_0xebbb56[_0xe7c8('0x3a')],'strategy':_0xebbb56['strategy'],'answered':_0xebbb56[_0xe7c8('0x4b')],'available':_0xebbb56[_0xe7c8('0x4c')],'loggedIn':_0xebbb56[_0xe7c8('0x4d')],'pTalking':_0xebbb56[_0xe7c8('0x4e')],'sumBillable':_0xebbb56[_0xe7c8('0x4f')],'sumDuration':_0xebbb56['sumDuration'],'sumHoldTime':_0xebbb56[_0xe7c8('0x50')]||0x0,'talking':_0xebbb56['talking'],'total':_0xebbb56['total'],'type':_0xebbb56[_0xe7c8('0x49')],'unmanaged':_0xebbb56['unmanaged'],'abandoned':_0xebbb56[_0xe7c8('0x51')],'waiting':_0xebbb56[_0xe7c8('0x52')],'loggedInDb':_0xebbb56[_0xe7c8('0x53')],'dialActive':_0xebbb56['dialActive'],'dialMethod':_0xebbb56[_0xe7c8('0x54')],'dialOriginateCallerIdName':_0xebbb56[_0xe7c8('0x55')],'dialOriginateCallerIdNumber':_0xebbb56[_0xe7c8('0x56')],'dialOriginateTimeout':_0xebbb56['dialOriginateTimeout'],'dialPrefix':_0xebbb56[_0xe7c8('0x57')],'outboundAnswerAgiCallsDay':_0xebbb56[_0xe7c8('0x58')],'outboundAnswerCallsDay':_0xebbb56[_0xe7c8('0x59')],'outboundBlacklistCallsDay':_0xebbb56['outboundBlacklistCallsDay'],'outboundBusyCallsDay':_0xebbb56[_0xe7c8('0x5a')],'outboundCongestionCallsDay':_0xebbb56[_0xe7c8('0x5b')],'outboundDropCallsDayACS':_0xebbb56['outboundDropCallsDayACS'],'outboundDropCallsDayCallersExit':_0xebbb56[_0xe7c8('0x5c')],'outboundDropCallsDayTimeout':_0xebbb56[_0xe7c8('0x5d')],'outboundNoAnswerCallsDay':_0xebbb56[_0xe7c8('0x5e')],'outboundNoSuchCallsDay':_0xebbb56[_0xe7c8('0x5f')],'outboundOriginateFailureCallsDay':_0xebbb56[_0xe7c8('0x60')],'outboundReCallsDay':_0xebbb56['outboundReCallsDay'],'outboundRejectCallsDay':_0xebbb56[_0xe7c8('0x61')],'outboundUnknownCallsDay':_0xebbb56['outboundUnknownCallsDay'],'predictiveIntervalAnsweredCalls':_0xebbb56['predictiveIntervalAnsweredCalls'],'predictiveIntervalAvgHoldtime':_0xebbb56[_0xe7c8('0x62')],'predictiveIntervalAvgTalktime':_0xebbb56[_0xe7c8('0x63')],'predictiveIntervalDroppedCallsCallersExit':_0xebbb56[_0xe7c8('0x64')],'predictiveIntervalDroppedCallsTimeout':_0xebbb56[_0xe7c8('0x65')],'predictiveIntervalErlangCalls':_0xebbb56['predictiveIntervalErlangCalls'],'predictiveIntervalErlangCallsDroppedCalls':_0xebbb56[_0xe7c8('0x66')],'predictiveIntervalHitRate':_0xebbb56[_0xe7c8('0x67')],'predictiveIntervalMultiplicativeFactor':_0xebbb56[_0xe7c8('0x68')],'predictiveIntervalPauses':_0xebbb56[_0xe7c8('0x69')],'predictiveIntervalAvailable':_0xebbb56[_0xe7c8('0x6a')],'predictiveIntervalTotalCalls':_0xebbb56[_0xe7c8('0x6b')],'message':_0xebbb56[_0xe7c8('0x38')],'originated':_0xebbb56[_0xe7c8('0x6c')],'erlangCalls':_0xebbb56['erlangCalls'],'erlangCallToSecond':_0xebbb56[_0xe7c8('0x6d')],'erlangAbandonmentRate':_0xebbb56[_0xe7c8('0x6e')],'erlangBusyFactor':_0xebbb56['erlangBusyFactor'],'startPredictive':_0xebbb56[_0xe7c8('0x26')],'startProgressive':_0xebbb56[_0xe7c8('0x27')]};if(_0xebbb56[_0xe7c8('0x6f')]){_0x1f576e[_0xe7c8('0x6f')]={'id':_0xebbb56[_0xe7c8('0x6f')]['id'],'name':_0xebbb56[_0xe7c8('0x6f')][_0xe7c8('0x3a')],'active':_0xebbb56[_0xe7c8('0x6f')]['active'],'callerid':_0xebbb56['Trunk'][_0xe7c8('0x70')]};}if(_0xebbb56[_0xe7c8('0x3d')]){_0x1f576e['Interval']={'id':_0xebbb56['Interval']['id'],'name':_0xebbb56[_0xe7c8('0x3d')][_0xe7c8('0x3a')]};}var _0x5e3235=md5(JSON[_0xe7c8('0x44')](_0x1f576e));if(_0xebbb56[_0xe7c8('0x71')]!==_0x5e3235){_0xebbb56[_0xe7c8('0x71')]=_0x5e3235;emit(util[_0xe7c8('0x72')](_0xe7c8('0x73'),_0x1f576e['name']),_0xe7c8('0x74'),_0x1f576e);}}}function emitCampaignSummary(_0x134f04){if(_0x134f04[_0xe7c8('0x49')]===_0xe7c8('0x75')){emit(util[_0xe7c8('0x72')](_0xe7c8('0x76'),_0x134f04[_0xe7c8('0x3a')]),_0xe7c8('0x77'),_0x134f04);}}function checkGetDataPredictive(_0x4c7588){if(isNotNull(_0x4c7588)){if(!_[_0xe7c8('0x40')](_0x4c7588)){loggerPredictive['info'](_0xe7c8('0x78'));loggerPredictive[_0xe7c8('0x79')]('Total\x20Calls:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x4c7588[_0xe7c8('0x6b')]);loggerPredictive[_0xe7c8('0x79')](_0xe7c8('0x7a'),_0x4c7588['predictiveIntervalAnsweredCalls']);loggerPredictive['info']('Dropped\x20Timeout:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x4c7588[_0xe7c8('0x65')]);loggerPredictive[_0xe7c8('0x79')](_0xe7c8('0x7b'),_0x4c7588[_0xe7c8('0x64')]);loggerPredictive[_0xe7c8('0x79')](_0xe7c8('0x7c'),_0x4c7588[_0xe7c8('0x62')]);loggerPredictive[_0xe7c8('0x79')](_0xe7c8('0x7d'),_0x4c7588[_0xe7c8('0x63')]);loggerPredictive[_0xe7c8('0x79')]('---------------------------');if(_0x4c7588['predictiveIntervalTotalCalls']>0x0){if(!_[_0xe7c8('0x7e')](_0x4c7588['predictiveIntervalAvgTalktime'])&&_0x4c7588[_0xe7c8('0x63')]>0x0){return!![];}else{loggerPredictive[_0xe7c8('0x79')](_0xe7c8('0x7f'));}if(!_[_0xe7c8('0x7e')](_0x4c7588[_0xe7c8('0x62')])&&_0x4c7588[_0xe7c8('0x62')]>0x0){return!![];}else{loggerPredictive['info'](_0xe7c8('0x80'));}}else{loggerPredictive[_0xe7c8('0x79')]('Total\x20Calls\x20are\x20not\x20enough\x20for\x20predictive');}}else{loggerPredictive[_0xe7c8('0x79')](_0xe7c8('0x81'));}}else{loggerPredictive['info']('History\x20information\x20are\x20empty');}return![];}function mergeDataErlangB(_0x516e8a){return function(_0x18c66c){loggerPredictive['info']('---------\x20ErlangB\x20---------');loggerPredictive['info'](_0xe7c8('0x82'),_0x18c66c[_0xe7c8('0x83')]);loggerPredictive[_0xe7c8('0x79')]('One\x20call\x20every:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x18c66c[_0xe7c8('0x6d')]);loggerPredictive[_0xe7c8('0x79')]('Drop\x20Rate:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x18c66c[_0xe7c8('0x6e')]);loggerPredictive[_0xe7c8('0x79')]('Agent\x20Busy\x20Factor:\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x18c66c[_0xe7c8('0x84')]);loggerPredictive['info'](_0xe7c8('0x85'),_0x18c66c[_0xe7c8('0x6e')]);loggerPredictive[_0xe7c8('0x79')](_0xe7c8('0x86'));_['merge'](_0x516e8a,_0x18c66c);};}function getDiff(_0x8f8982){var _0x706436=moment()[_0xe7c8('0x45')](0x0);var _0x126304=moment(_0x8f8982)[_0xe7c8('0x45')](0x0);return _0x706436['diff'](_0x126304,'seconds');}function ifInterval(_0x3c1560,_0x56e262){if(_[_0xe7c8('0x7e')](_0x56e262)){return![];}if(getDiff(_0x56e262)<_0x3c1560*0x3c){return!![];}else{return![];}}function freeVariablesPredictive(_0x18b327){if(isNotNull(_0x18b327)){if(!_[_0xe7c8('0x7e')](_0x18b327['startProgressive'])){_0x18b327[_0xe7c8('0x27')]=undefined;loggerPredictive[_0xe7c8('0x79')](_0x18b327[_0xe7c8('0x3a')],'clearing\x20variable\x20start\x20progressive');}if(!_['isUndefined'](_0x18b327[_0xe7c8('0x26')])){_0x18b327[_0xe7c8('0x26')]=undefined;loggerPredictive[_0xe7c8('0x79')](_0x18b327[_0xe7c8('0x3a')],_0xe7c8('0x87'));}if(!_[_0xe7c8('0x7e')](_0x18b327[_0xe7c8('0x88')])){clearInterval(_0x18b327['handlePredictive']);_0x18b327[_0xe7c8('0x88')]=undefined;loggerPredictive[_0xe7c8('0x79')](_0x18b327[_0xe7c8('0x3a')],_0xe7c8('0x89'));}}}function erlangb(_0x47347f,_0x2d4751){if(_0x2d4751===0x0){return 0x0;}var _0x28ed49=0x1;for(var _0x4a9efc=0x1;_0x4a9efc<=_0x2d4751;_0x4a9efc+=0x1){_0x28ed49=0x1+_0x28ed49*_0x4a9efc/_0x47347f;}return 0x1/_0x28ed49;}function isVoiceQueueOutbound(_0x188546){return _0x188546===_0xe7c8('0x4a');}function isNotPreview(_0x59b2af){return _0x59b2af!==_0xe7c8('0x1d');}function isCampaignIvr(_0x3626a3){return _0x3626a3==='ivr';}function getCallerId(_0x58937e,_0x242ca2,_0x5b9ca5){if(!_[_0xe7c8('0x7e')](_0x5b9ca5)&&_0xe7c8('0x8a')===typeof _0x5b9ca5&&!_['isEmpty'](_0x5b9ca5)){if(!_[_0xe7c8('0x7e')](_0x242ca2)&&_0xe7c8('0x8a')===typeof _0x242ca2&&!_[_0xe7c8('0x40')](_0x242ca2)){return util[_0xe7c8('0x72')](_0xe7c8('0x8b'),_0x242ca2,_0x5b9ca5);}return util[_0xe7c8('0x72')]('\x22%s\x22\x20<%s>',_0x5b9ca5,_0x5b9ca5);}if(!_[_0xe7c8('0x7e')](_0x58937e)&&_0xe7c8('0x8a')===typeof _0x58937e&&!_['isEmpty'](_0x58937e)){return _0x58937e;}return _0xe7c8('0x8c');}function loggerCatchQueueSummary(_0x49cb24,_0x4c60fa){return function(_0x23debb){freeVariablesPredictive(_0x4c60fa);emitVoiceQueueSummary(_0x4c60fa);emitCampaignSummary(_0x4c60fa);loggerSyncQueueSummary[_0xe7c8('0x8d')](_0x49cb24,util['inspect'](_0x23debb,{'showHidden':![],'depth':null}));};}function loggerCatchPredictive(_0x55351c,_0x4c513c){return function(_0x5e6e19){loggerPredictive[_0xe7c8('0x8d')](_0x4c513c['name'],_0x55351c);loggerPredictive['error'](_0x5e6e19['stack']);freeVariablesPredictive(_0x4c513c);};}function loggerCatch(_0x42230a){return function(_0x48a65d){logger[_0xe7c8('0x8d')](_0x42230a,util[_0xe7c8('0x8e')](_0x48a65d,{'showHidden':![],'depth':null}));};}function checkContactEmpty(_0x1627e4){return _0x1627e4&&!_[_0xe7c8('0x7e')](_0x1627e4)&&_0x1627e4[_0xe7c8('0x8f')]>0x0;}function decremetOriginate(_0xb7aedf){if(!_[_0xe7c8('0x7e')](_0xb7aedf)&&_0xb7aedf!==null){if(_0xb7aedf[_0xe7c8('0x90')](_0xe7c8('0x6c'))){if(_0xb7aedf['originated']>0x0){_0xb7aedf[_0xe7c8('0x6c')]-=0x1;}else{logger['error'](_0xe7c8('0x91'));}}}else{logger[_0xe7c8('0x8d')](_0xe7c8('0x92'));}}function checkContactLowerLimitOriginate(_0x500e57,_0x1aeb31,_0xc504c2){if(_0x1aeb31>_0xc504c2){for(var _0x25cb20=0x0;_0x25cb20<_0x1aeb31-_0xc504c2;_0x25cb20+=0x1){decremetOriginate(_0x500e57);}}}function loggerGetContactDialer(_0x1cf014,_0x2aaea6,_0x44d259){return function(_0x2ed5d2){checkContactLowerLimitOriginate(_0x2aaea6,_0x44d259,0x0);logger[_0xe7c8('0x8d')](_0x1cf014,util[_0xe7c8('0x8e')](_0x2ed5d2,{'showHidden':![],'depth':null}));};}function sendMessageReschedule(_0x463118){return function(_0x3170ff){if(isNotNull(_0x3170ff)&&isNotNull(_0x3170ff[0x0])){if(_0x3170ff[0x0][_0xe7c8('0x93')]>0x0){_0x463118[_0xe7c8('0x38')]=_0xe7c8('0x94');logger[_0xe7c8('0x79')](_0xe7c8('0x95')+_0x463118[_0xe7c8('0x3a')],_0x3170ff[0x0]['contactsRescheduled'],_0xe7c8('0x96'));}else{_0x463118[_0xe7c8('0x38')]=_0xe7c8('0x97');logger[_0xe7c8('0x79')](_0xe7c8('0x98')+_0x463118['name']);}}};}function notSendMessagesQueue(_0x309538){if(_0x309538['sendMessageOneNotActive']){freeVariablesPredictive(_0x309538);if(_0x309538[_0xe7c8('0x6c')]===0x0&&_0x309538[_0xe7c8('0x99')]===0x0&&_0x309538[_0xe7c8('0x52')]===0x0&&(_0x309538[_0xe7c8('0x4e')]||0x0)===0x0){_0x309538[_0xe7c8('0x9a')]=![];_0x309538[_0xe7c8('0x4c')]=0x0;_0x309538['message']=_0xe7c8('0x9b');loggerSyncQueueSummary[_0xe7c8('0x8d')](_0xe7c8('0x9c'),_0x309538[_0xe7c8('0x3a')],_0xe7c8('0x9d'));}else{_0x309538[_0xe7c8('0x38')]=_0xe7c8('0x9e');loggerSyncQueueSummary['error'](_0xe7c8('0x9c'),_0x309538[_0xe7c8('0x3a')],_0xe7c8('0x9f'));}emitVoiceQueueSummary(_0x309538);}}function notSendMessagesCampaign(_0x4c21d4){if(_0x4c21d4[_0xe7c8('0x9a')]){if(_0x4c21d4[_0xe7c8('0x6c')]===0x0){_0x4c21d4[_0xe7c8('0x9a')]=![];_0x4c21d4['message']=_0xe7c8('0x9b');loggerSyncQueueSummary[_0xe7c8('0x8d')](_0xe7c8('0xa0'),_0x4c21d4[_0xe7c8('0x3a')],_0xe7c8('0x9d'));}else{_0x4c21d4[_0xe7c8('0x38')]=_0xe7c8('0x9e');loggerSyncQueueSummary['error']('[syncQueueSummary]\x20Campaign\x20Ivr:\x20',_0x4c21d4[_0xe7c8('0x3a')],_0xe7c8('0x9f'));}emitCampaignSummary(_0x4c21d4);}}function createObjHistory(_0x775f94,_0x3423d8,_0x62023d,_0x8623ce,_0x4dc436){_0x775f94['message']=_0x62023d;var _0x3a6d2b=new Action(_0x775f94,_0x3423d8);var _0x4f6c83=new History(_0x3a6d2b);_0x4f6c83['state']=_0x8623ce;_0x4f6c83[_0xe7c8('0xa1')]=_0x4dc436;_0x4f6c83[_0xe7c8('0xa2')]=_0x3a6d2b[_0xe7c8('0xa3')];return _0x4f6c83;}Dialer[_0xe7c8('0x18')][_0xe7c8('0x37')]=function(){var _0x3b21df=this;setInterval(function(){_0x3b21df[_0xe7c8('0xa4')](_0x3b21df['uniqueId'],_0xe7c8('0xa5'));_0x3b21df[_0xe7c8('0xa4')](_0x3b21df[_0xe7c8('0x24')],_0xe7c8('0xa6'));},0x32c8);};Dialer[_0xe7c8('0x18')]['clearZombieChannels']=function(_0x26051a,_0x30f4f9){var _0x3ca474=this;for(var _0x16d306 in _0x26051a){if(_0x26051a[_0xe7c8('0x90')](_0x16d306)){this[_0xe7c8('0x1c')][_0xe7c8('0x19')](function(){if(!_[_0xe7c8('0xa7')](_0x26051a[_0x16d306])){return ami[_0xe7c8('0xa8')]({'action':_0xe7c8('0xa9'),'channel':_0x26051a[_0x16d306][_0xe7c8('0xaa')]})[_0xe7c8('0xab')](function(_0x478e9f){if(_0x478e9f[_0xe7c8('0x38')]==='No\x20such\x20channel'){setTimeout(function(){if(_0x26051a[_0x16d306]&&_0x26051a[_0x16d306][_0xe7c8('0x49')]!==_0xe7c8('0x75')){_0x3ca474[_0xe7c8('0xac')](_0x3ca474['voiceQueues'][_0x26051a[_0x16d306][_0xe7c8('0xad')]]);logger[_0xe7c8('0x8d')]('[Dialer][checkChannel]',_0x30f4f9,_0x16d306,_0x26051a[_0x16d306][_0xe7c8('0xad')]);delete _0x26051a[_0x16d306];}if(_0x26051a[_0x16d306]&&_0x26051a[_0x16d306][_0xe7c8('0x49')]==='ivr'){_0x3ca474[_0xe7c8('0xac')](_0x3ca474[_0xe7c8('0x1f')][_0x26051a[_0x16d306]['queue']]);logger[_0xe7c8('0x8d')](_0xe7c8('0xae'),_0x30f4f9,_0x16d306,_0x26051a[_0x16d306][_0xe7c8('0xad')]);delete _0x26051a[_0x16d306];}},0x2328);}});}});}}};Dialer['prototype'][_0xe7c8('0xaf')]=function(_0x15a928){return BPromise['resolve']()[_0xe7c8('0xb0')](cmHopper['countReScheduled'](_0x15a928))[_0xe7c8('0xab')](loggerCatch(_0xe7c8('0xb1')));};Dialer[_0xe7c8('0x18')][_0xe7c8('0xb2')]=function(_0x15ed43){return BPromise[_0xe7c8('0xb3')]()['then'](cmHopperBlack[_0xe7c8('0xb2')](_0x15ed43))['catch'](loggerCatch('[checkIsBlackList]\x20'));};Dialer['prototype']['checkIsBlackListIvr']=function(_0x2f530c){return BPromise[_0xe7c8('0xb3')]()[_0xe7c8('0xb0')](cmHopperBlack['checkIsBlackListIvr'](_0x2f530c))[_0xe7c8('0xab')](loggerCatch(_0xe7c8('0xb4')));};Dialer[_0xe7c8('0x18')][_0xe7c8('0xb5')]=function(_0x172add){return BPromise[_0xe7c8('0xb3')]()[_0xe7c8('0xb0')](cmHopperHistory[_0xe7c8('0xb6')](_0x172add))[_0xe7c8('0xab')](loggerCatch(_0xe7c8('0xb7')));};Dialer[_0xe7c8('0x18')]['rescheduleContact']=function(_0x11b036){return BPromise[_0xe7c8('0xb3')]()[_0xe7c8('0xb0')](cmHopper[_0xe7c8('0xb8')](_0x11b036))['catch'](loggerCatch(_0xe7c8('0xb9')));};Dialer[_0xe7c8('0x18')][_0xe7c8('0xba')]=function(_0x21058c,_0x3ad520,_0x2ee845){return BPromise[_0xe7c8('0xb3')]()[_0xe7c8('0xb0')](cmHopper[_0xe7c8('0xba')](_0x21058c,_0x3ad520,_0x2ee845))[_0xe7c8('0xab')](loggerCatch(_0xe7c8('0xbb')));};Dialer[_0xe7c8('0x18')]['getContactDialer']=function(_0x2211fe,_0x2c2da6,_0x4784d1,_0x358c8b){return BPromise['resolve']()[_0xe7c8('0xb0')](cmHopper[_0xe7c8('0xbc')](_0x2211fe,_0x2c2da6,_0x4784d1,_0x358c8b))[_0xe7c8('0xab')](loggerCatch('[getContactDialer]\x20'));};Dialer[_0xe7c8('0x18')]['getContactDialerIvr']=function(_0xdb26b4,_0x2df10a,_0x5833d5){return BPromise[_0xe7c8('0xb3')]()[_0xe7c8('0xb0')](cmHopper['getContactDialerIvr'](_0xdb26b4,_0x2df10a,_0x5833d5))['catch'](loggerCatch(_0xe7c8('0xbd')));};Dialer[_0xe7c8('0x18')][_0xe7c8('0xbe')]=function(_0x36e81a){return BPromise['resolve']()[_0xe7c8('0xb0')](voiceQueueRt[_0xe7c8('0xbe')](_0x36e81a))[_0xe7c8('0xab')](loggerCatch(_0xe7c8('0xbf')));};Dialer[_0xe7c8('0x18')][_0xe7c8('0xc0')]=function(_0x76b9e5){return BPromise[_0xe7c8('0xb3')]()[_0xe7c8('0xb0')](cmHopper[_0xe7c8('0xc0')](_0x76b9e5))['catch'](loggerCatch(_0xe7c8('0xc1')));};Dialer[_0xe7c8('0x18')]['createHistory']=function(_0x5ae0ae){return BPromise[_0xe7c8('0xb3')]()['then'](cmHopperHistory[_0xe7c8('0xc2')](_0x5ae0ae))[_0xe7c8('0xab')](loggerCatch(_0xe7c8('0xc3')));};Dialer[_0xe7c8('0x18')][_0xe7c8('0xac')]=function(_0x542755){if(!_[_0xe7c8('0x7e')](_0x542755)&&_0x542755!==null){if(_0x542755['hasOwnProperty'](_0xe7c8('0x6c'))){if(_0x542755[_0xe7c8('0x6c')]>0x0){_0x542755[_0xe7c8('0x6c')]-=0x1;}else{logger[_0xe7c8('0x8d')]('[updateOriginated]\x20object\x20originated\x20is\x20negative');}}}else{logger[_0xe7c8('0x8d')](_0xe7c8('0xc4'));}};Dialer[_0xe7c8('0x18')][_0xe7c8('0xc5')]=function(_0x2153d1,_0xdf5b27){var _0x29e8f9=this;return function(_0xc13ccb){_0x29e8f9[_0xe7c8('0xac')](_0xdf5b27);logger[_0xe7c8('0x8d')](_0x2153d1,util[_0xe7c8('0x8e')](_0xc13ccb,{'showHidden':![],'depth':null}));};};Dialer[_0xe7c8('0x18')][_0xe7c8('0xc6')]=function(_0x178784,_0x547d1b,_0x33a0d3){var _0x1ca127={'state':0x19,'statedesc':_0xe7c8('0xc7')};this[_0xe7c8('0xac')](_0x547d1b);this[_0xe7c8('0xc8')](_[_0xe7c8('0xc9')](_0x1ca127,_[_0xe7c8('0xca')](_0x33a0d3,[_0xe7c8('0xcb'),_0xe7c8('0xcc'),_0xe7c8('0xcd'),_0xe7c8('0xce'),_0xe7c8('0xcf')])),_0xe7c8('0xd0'),_0xe7c8('0xd1'));logger[_0xe7c8('0x8d')](_0x178784);};Dialer[_0xe7c8('0x18')][_0xe7c8('0xd2')]=function(_0x4d727e){return _0x4d727e==='Success';};Dialer[_0xe7c8('0x18')]['isTrunkReachable']=function(_0x1ef1c6){return!_[_0xe7c8('0x7e')](_0x1ef1c6)&&_0x1ef1c6&&!_['isUndefined'](_0x1ef1c6['name'])&&!_[_0xe7c8('0x7e')](_0x1ef1c6[_0xe7c8('0xd3')])&&_0x1ef1c6['active']&&(this[_0xe7c8('0x21')][util[_0xe7c8('0x72')](_0xe7c8('0xd4'),_0x1ef1c6[_0xe7c8('0x3a')])][_0xe7c8('0xa9')]==='reachable'||this[_0xe7c8('0x21')][util['format'](_0xe7c8('0xd4'),_0x1ef1c6[_0xe7c8('0x3a')])]['status']===_0xe7c8('0xd5'));};Dialer[_0xe7c8('0x18')][_0xe7c8('0xc8')]=function(_0x333723,_0x41d47a,_0x29d5da){this[_0xe7c8('0xc2')](_0x333723)['catch'](loggerCatch(_0x41d47a));this[_0xe7c8('0xc0')](_0x333723)[_0xe7c8('0xab')](loggerCatch(_0x29d5da));};Dialer[_0xe7c8('0x18')][_0xe7c8('0x33')]=function(_0x521411){var _0x2abf39=this['uniqueId'][_0x521411['uniqueid']];var _0x1e22ab;if(!_['isNil'](_0x521411)&&!_[_0xe7c8('0xa7')](_0x521411[_0xe7c8('0xd6')])&&!_['isNil'](_0x521411[_0xe7c8('0xd6')][_0xe7c8('0xd7')])&&_0x521411[_0xe7c8('0xd8')]===_0xe7c8('0xd9')&&_0x2abf39){if(_0x2abf39[_0xe7c8('0x49')]!==_0xe7c8('0x75')&&this['voiceQueues'][_0x2abf39[_0xe7c8('0xad')]][_0xe7c8('0xda')]&&_0x521411[_0xe7c8('0xdb')]===_0xe7c8('0xdc')){delete this[_0xe7c8('0x25')][_0x521411[_0xe7c8('0xdd')]];this[_0xe7c8('0xac')](this['voiceQueues'][_0x2abf39['queue']]);this[_0xe7c8('0x1e')][_0x2abf39[_0xe7c8('0xad')]]['outboundAnswerCallsDay']+=0x1;this[_0xe7c8('0x1e')][_0x2abf39[_0xe7c8('0xad')]][_0xe7c8('0x58')]+=0x1;_0x1e22ab=new Hangup(_0x2abf39,_0x521411);_0x1e22ab[_0xe7c8('0xde')]=0x12;_0x1e22ab[_0xe7c8('0xa1')]='HangupInAMD';_0x1e22ab[_0xe7c8('0xdf')]=_0xe7c8('0xe0');this[_0xe7c8('0xc8')](_0x1e22ab,_0xe7c8('0xe1'),_0xe7c8('0xe2'));}if(_0x2abf39['type']!==_0xe7c8('0x75')&&this['voiceQueues'][_0x2abf39[_0xe7c8('0xad')]][_0xe7c8('0xda')]&&_0x521411[_0xe7c8('0xdb')]===_0xe7c8('0xe3')){delete this[_0xe7c8('0x25')][_0x521411[_0xe7c8('0xdd')]];this['updateOriginated'](this[_0xe7c8('0x1e')][_0x2abf39[_0xe7c8('0xad')]]);this[_0xe7c8('0x1e')][_0x2abf39[_0xe7c8('0xad')]][_0xe7c8('0x59')]+=0x1;this['voiceQueues'][_0x2abf39[_0xe7c8('0xad')]][_0xe7c8('0x58')]+=0x1;_0x1e22ab=new Hangup(_0x2abf39,_0x521411);_0x1e22ab['state']=0x13;_0x1e22ab[_0xe7c8('0xa1')]=_0xe7c8('0xe4');_0x1e22ab[_0xe7c8('0xdf')]=_0xe7c8('0xe0');_0x1e22ab[_0xe7c8('0xe5')]=!![];this[_0xe7c8('0xc8')](_0x1e22ab,_0xe7c8('0xe6'),_0xe7c8('0xe7'));}if(_0x2abf39[_0xe7c8('0x49')]===_0xe7c8('0x75')&&this[_0xe7c8('0x1f')][_0x2abf39[_0xe7c8('0xad')]][_0xe7c8('0xda')]&&_0x521411[_0xe7c8('0xdb')]===_0xe7c8('0xdc')){delete this[_0xe7c8('0x25')][_0x521411['uniqueid']];this[_0xe7c8('0xac')](this[_0xe7c8('0x1f')][_0x2abf39[_0xe7c8('0xad')]]);_0x1e22ab=new Hangup(_0x2abf39,_0x521411);_0x1e22ab['state']=0x12;_0x1e22ab['statedesc']=_0xe7c8('0xe8');_0x1e22ab[_0xe7c8('0xdf')]=_0xe7c8('0xe0');this['saveInDb'](_0x1e22ab,'[syncHangupInAMDIvr][createHistory]',_0xe7c8('0xe9'));}if(_0x2abf39[_0xe7c8('0x49')]==='ivr'&&this[_0xe7c8('0x1f')][_0x2abf39[_0xe7c8('0xad')]][_0xe7c8('0xda')]&&_0x521411[_0xe7c8('0xdb')]===_0xe7c8('0xe3')){delete this[_0xe7c8('0x25')][_0x521411[_0xe7c8('0xdd')]];this[_0xe7c8('0xac')](this[_0xe7c8('0x1f')][_0x2abf39[_0xe7c8('0xad')]]);_0x1e22ab=new Hangup(_0x2abf39,_0x521411);_0x1e22ab[_0xe7c8('0xde')]=0x13;_0x1e22ab['statedesc']=_0xe7c8('0xe4');_0x1e22ab[_0xe7c8('0xdf')]=_0xe7c8('0xe0');_0x1e22ab[_0xe7c8('0xe5')]=!![];this['saveInDb'](_0x1e22ab,_0xe7c8('0xea'),_0xe7c8('0xeb'));}}};Dialer['prototype'][_0xe7c8('0x31')]=function(_0x1127e6){var _0x4cbce0=this[_0xe7c8('0x25')][_0x1127e6[_0xe7c8('0xdd')]];var _0x2c59ff=this;var _0x25517e;if(_0x4cbce0&&_0x4cbce0[_0xe7c8('0x49')]==='ivr'){delete this[_0xe7c8('0x25')][_0x1127e6[_0xe7c8('0xdd')]];this[_0xe7c8('0xac')](this[_0xe7c8('0x1f')][_0x4cbce0['queue']]);this[_0xe7c8('0x1f')][_0x4cbce0['queue']][_0xe7c8('0xec')]+=0x1;_0x25517e=new Hangup(_0x4cbce0,_0x1127e6);this[_0xe7c8('0xc2')](_0x25517e)[_0xe7c8('0xab')](loggerCatch(_0xe7c8('0xed')));this[_0xe7c8('0xc0')](_0x25517e)[_0xe7c8('0xab')](loggerCatch('[syncHangupIvr]'));}if(_0x4cbce0&&_0x4cbce0[_0xe7c8('0x49')]!==_0xe7c8('0x75')&&isNotNull(this[_0xe7c8('0x1e')][_0x4cbce0[_0xe7c8('0xad')]][_0xe7c8('0xee')])){delete this['uniqueId'][_0x1127e6[_0xe7c8('0xdd')]];this[_0xe7c8('0xac')](this[_0xe7c8('0x1e')][_0x4cbce0[_0xe7c8('0xad')]]);this['voiceQueues'][_0x4cbce0[_0xe7c8('0xad')]][_0xe7c8('0x59')]+=0x1;this['voiceQueues'][_0x4cbce0[_0xe7c8('0xad')]]['outboundAnswerAgiCallsDay']+=0x1;_0x25517e=new Hangup(_0x4cbce0,_0x1127e6);_0x25517e['state']=0x10;_0x25517e['statedesc']=_0xe7c8('0xef');_0x25517e[_0xe7c8('0xdf')]=_0xe7c8('0xf0');this[_0xe7c8('0xc2')](_0x25517e)[_0xe7c8('0xab')](loggerCatch(_0xe7c8('0xed')));this['moveContactManagedDialer'](_0x25517e)['catch'](loggerCatch(_0xe7c8('0xf1')));}if(_0x4cbce0&&_0x4cbce0[_0xe7c8('0x49')]!==_0xe7c8('0x75')&&!isNotNull(this[_0xe7c8('0x1e')][_0x4cbce0[_0xe7c8('0xad')]][_0xe7c8('0xee')])){delete this['uniqueId'][_0x1127e6[_0xe7c8('0xdd')]];this[_0xe7c8('0xac')](this[_0xe7c8('0x1e')][_0x4cbce0[_0xe7c8('0xad')]]);this[_0xe7c8('0x1e')][_0x4cbce0[_0xe7c8('0xad')]][_0xe7c8('0xf2')]+=0x1;_0x25517e=new Hangup(_0x4cbce0,_0x1127e6);_0x25517e[_0xe7c8('0xde')]=0xc;_0x25517e[_0xe7c8('0xa1')]=_0x1127e6[_0xe7c8('0xf3')];_0x25517e[_0xe7c8('0xdf')]='Unknow';this['createHistory'](_0x25517e)[_0xe7c8('0xab')](loggerCatch(_0xe7c8('0xed')));this['moveContactManagedDialer'](_0x25517e)[_0xe7c8('0xab')](loggerCatch(_0xe7c8('0xf1')));}};Dialer[_0xe7c8('0x18')]['syncAgentComplete']=function(_0x3bf351){var _0x226170=this[_0xe7c8('0x25')][_0x3bf351[_0xe7c8('0xdd')]];var _0x11aef3=this;if(this['voiceQueues'][_0x3bf351['queue']]){if(_0x226170&&_0x226170[_0xe7c8('0x49')]!==_0xe7c8('0x75')){delete this[_0xe7c8('0x25')][_0x3bf351[_0xe7c8('0xdd')]];this[_0xe7c8('0x1e')][_0x3bf351['queue']][_0xe7c8('0x59')]+=0x1;var _0x1e8cb7=new AgentComplete(_0x226170,_0x3bf351);if(_0x3bf351[_0xe7c8('0xf4')]==='agent'){_0x1e8cb7[_0xe7c8('0xf5')]=this['voiceQueues'][_0x3bf351['queue']][_0xe7c8('0xf6')]&&this[_0xe7c8('0x1e')][_0x3bf351[_0xe7c8('0xad')]][_0xe7c8('0xf7')]?moment()[_0xe7c8('0x72')]('YYYY-MM-DD\x20HH:mm:ss'):undefined;}this[_0xe7c8('0xc2')](_0x1e8cb7)['catch'](loggerCatch(_0xe7c8('0xf8')));this[_0xe7c8('0xc0')](_0x1e8cb7)[_0xe7c8('0xab')](loggerCatch(_0xe7c8('0xf9')));}}};Dialer[_0xe7c8('0x18')][_0xe7c8('0x2b')]=function(_0x51b60d){if(this[_0xe7c8('0x1e')][_0x51b60d[_0xe7c8('0xad')]]){if(this['uniqueId'][_0x51b60d[_0xe7c8('0xdd')]]&&this[_0xe7c8('0x25')][_0x51b60d[_0xe7c8('0xdd')]][_0xe7c8('0x49')]!=='ivr'){this[_0xe7c8('0xac')](this[_0xe7c8('0x1e')][_0x51b60d[_0xe7c8('0xad')]]);this[_0xe7c8('0x25')][_0x51b60d[_0xe7c8('0xdd')]][_0xe7c8('0xfa')]=moment()[_0xe7c8('0x72')](_0xe7c8('0xfb'));}}};Dialer[_0xe7c8('0x18')]['queueCallerAbandonCreateState']=function(_0x4ee1dd){this['createHistory'](_0x4ee1dd)[_0xe7c8('0xab')](loggerCatch(_0xe7c8('0xf8')));this[_0xe7c8('0xc0')](_0x4ee1dd)[_0xe7c8('0xab')](loggerCatch('[syncQueueCallerAbandon]\x20[Drop]'));};Dialer['prototype'][_0xe7c8('0xfc')]=function(_0x1b2cde){var _0x3ca94f=this['uniqueId'][_0x1b2cde[_0xe7c8('0xdd')]];var _0x5b7fe8=this;if(this[_0xe7c8('0x1e')][_0x1b2cde['queue']]){if(_0x3ca94f&&_0x3ca94f[_0xe7c8('0x49')]!=='ivr'){delete this[_0xe7c8('0x25')][_0x1b2cde[_0xe7c8('0xdd')]];this['updateOriginated'](this[_0xe7c8('0x1e')][_0x1b2cde[_0xe7c8('0xad')]]);_0x3ca94f[_0xe7c8('0xfd')]=moment()[_0xe7c8('0x72')](_0xe7c8('0xfb'));var _0x3d4b9e=new QueueCallerAbandon(_0x3ca94f,_0x1b2cde);if(getSeconds(_0x3ca94f[_0xe7c8('0xfd')],_0x3ca94f[_0xe7c8('0xfe')])>=_0x3ca94f[_0xe7c8('0xff')]){this[_0xe7c8('0x1e')][_0x1b2cde[_0xe7c8('0xad')]]['predictiveIntervalDroppedCallsTimeout']+=0x1;this[_0xe7c8('0x1e')][_0x1b2cde['queue']][_0xe7c8('0x5d')]+=0x1;this[_0xe7c8('0x1e')][_0x1b2cde['queue']][_0xe7c8('0x66')]+=0x1;_0x3d4b9e[_0xe7c8('0xde')]=0xa;_0x3d4b9e[_0xe7c8('0xa1')]=_0xe7c8('0x100');_0x3d4b9e['dropreason']=_0xe7c8('0x101');_0x3d4b9e[_0xe7c8('0xf5')]=this['voiceQueues'][_0x1b2cde['queue']][_0xe7c8('0xf6')]?moment()['format'](_0xe7c8('0xfb')):undefined;_0x3d4b9e['countdropretry']+=0x1;if(_0x3d4b9e[_0xe7c8('0x102')]>=this['voiceQueues'][_0x1b2cde['queue']][_0xe7c8('0x103')]){this[_0xe7c8('0x104')](_0x3d4b9e);}else{this['rescheduleContact']({'active':![],'countdropretry':_0x3d4b9e[_0xe7c8('0x102')],'scheduledat':moment()[_0xe7c8('0x105')](this[_0xe7c8('0x1e')][_0x1b2cde[_0xe7c8('0xad')]][_0xe7c8('0x106')],_0xe7c8('0x107'))['format'](_0xe7c8('0xfb')),'ContactId':_0x3ca94f[_0xe7c8('0xcb')],'ListId':_0x3ca94f[_0xe7c8('0xcc')],'VoiceQueueId':_0x3ca94f['VoiceQueueId']||undefined,'CampaignId':_0x3ca94f[_0xe7c8('0xcf')]||undefined})[_0xe7c8('0xab')](loggerCatch(_0xe7c8('0x108')));var _0x54387c=new History(_0x3d4b9e);_0x54387c[_0xe7c8('0xde')]=0xa;_0x54387c['statedesc']='Drop';_0x54387c['starttime']=moment()[_0xe7c8('0x72')](_0xe7c8('0xfb'));_0x54387c['endtime']=_0x54387c['starttime'];console[_0xe7c8('0x109')](_0xe7c8('0x10a'),_0x54387c);this[_0xe7c8('0xc2')](_0x54387c)['catch'](loggerCatch(_0xe7c8('0x10b')));}}else{this[_0xe7c8('0x1e')][_0x1b2cde[_0xe7c8('0xad')]][_0xe7c8('0x64')]+=0x1;this[_0xe7c8('0x1e')][_0x1b2cde[_0xe7c8('0xad')]][_0xe7c8('0x5c')]+=0x1;_0x3d4b9e[_0xe7c8('0xde')]=0xb;_0x3d4b9e[_0xe7c8('0xa1')]=_0xe7c8('0x10c');_0x3d4b9e[_0xe7c8('0x10d')]=_0xe7c8('0x10e');_0x3d4b9e[_0xe7c8('0x10f')]+=0x1;if(_0x3d4b9e['countabandonedretry']>=this['voiceQueues'][_0x1b2cde[_0xe7c8('0xad')]][_0xe7c8('0x110')]){this[_0xe7c8('0x104')](_0x3d4b9e);}else{this[_0xe7c8('0xb8')]({'active':![],'countabandonedretry':_0x3d4b9e[_0xe7c8('0x10f')],'scheduledat':moment()[_0xe7c8('0x105')](this[_0xe7c8('0x1e')][_0x1b2cde[_0xe7c8('0xad')]][_0xe7c8('0x111')],_0xe7c8('0x107'))['format'](_0xe7c8('0xfb')),'ContactId':_0x3ca94f['ContactId'],'ListId':_0x3ca94f[_0xe7c8('0xcc')],'VoiceQueueId':_0x3ca94f[_0xe7c8('0xce')]||undefined,'CampaignId':_0x3ca94f['CampaignId']||undefined})[_0xe7c8('0xab')](loggerCatch('[rescheduleContact][Abandoned]'));var _0x54387c=new History(_0x3d4b9e);_0x54387c[_0xe7c8('0xde')]=0xb;_0x54387c[_0xe7c8('0xa1')]=_0xe7c8('0x10c');_0x54387c[_0xe7c8('0xa3')]=moment()['format'](_0xe7c8('0xfb'));_0x54387c[_0xe7c8('0xa2')]=_0x54387c['starttime'];console[_0xe7c8('0x109')](_0xe7c8('0x112'),_0x54387c);this[_0xe7c8('0xc2')](_0x54387c)[_0xe7c8('0xab')](loggerCatch(_0xe7c8('0x113')));}}}}};Dialer[_0xe7c8('0x18')][_0xe7c8('0x114')]=function(_0x475320){if(this[_0xe7c8('0x24')][_0x475320[_0xe7c8('0xdd')]]){this[_0xe7c8('0x24')][_0x475320[_0xe7c8('0xdd')]][_0xe7c8('0xaa')]=_0x475320['channel'];}if(this[_0xe7c8('0x25')][_0x475320[_0xe7c8('0xdd')]]){this[_0xe7c8('0x25')][_0x475320[_0xe7c8('0xdd')]][_0xe7c8('0xaa')]=_0x475320[_0xe7c8('0xaa')];}};Dialer[_0xe7c8('0x18')][_0xe7c8('0x34')]=function(_0x36565c){if(strategy[this[_0xe7c8('0x1e')][this['actions'][_0x36565c[_0xe7c8('0x115')]][_0xe7c8('0xad')]][_0xe7c8('0x116')]]===_0xe7c8('0x17')){if(this[_0xe7c8('0x24')][_0x36565c[_0xe7c8('0x115')]]&&_[_0xe7c8('0xa7')](this[_0xe7c8('0x24')][_0x36565c['actionid']]['locked'])&&_0x36565c[_0xe7c8('0xa9')]==='1'&&_0x36565c['paused']==='0'){if(this[_0xe7c8('0x20')][_0x36565c[_0xe7c8('0x117')]]){if(!this[_0xe7c8('0x20')][_0x36565c[_0xe7c8('0x117')]][_0xe7c8('0x118')]){this[_0xe7c8('0x20')][_0x36565c['stateinterface']][_0xe7c8('0x118')]=!![];this[_0xe7c8('0x24')][_0x36565c[_0xe7c8('0x115')]][_0xe7c8('0x118')]=!![];this[_0xe7c8('0x24')][_0x36565c[_0xe7c8('0x115')]][_0xe7c8('0x117')]=_0x36565c[_0xe7c8('0x117')];}}}}else if((strategy[this[_0xe7c8('0x1e')][this[_0xe7c8('0x24')][_0x36565c[_0xe7c8('0x115')]][_0xe7c8('0xad')]][_0xe7c8('0x116')]]||_0xe7c8('0x119'))==='rrmemory'){if(this[_0xe7c8('0x24')][_0x36565c[_0xe7c8('0x115')]]){if(this[_0xe7c8('0x20')][_0x36565c[_0xe7c8('0x117')]]){this['actions'][_0x36565c[_0xe7c8('0x115')]][_0xe7c8('0x117')]=_0x36565c[_0xe7c8('0x117')];if(_[_0xe7c8('0xa7')](this[_0xe7c8('0x29')][this[_0xe7c8('0x24')][_0x36565c[_0xe7c8('0x115')]][_0xe7c8('0xad')]])){this[_0xe7c8('0x29')][this['actions'][_0x36565c[_0xe7c8('0x115')]][_0xe7c8('0xad')]]=[];}this['queueBooked'][this['actions'][_0x36565c[_0xe7c8('0x115')]][_0xe7c8('0xad')]][_0xe7c8('0x11a')](_[_0xe7c8('0xc9')](_[_0xe7c8('0xca')](this['actions'][_0x36565c[_0xe7c8('0x115')]],[_0xe7c8('0x11b'),_0xe7c8('0x117')]),{'status':_0x36565c[_0xe7c8('0xa9')],'paused':_0x36565c[_0xe7c8('0x11c')]}));}}}};function unlockQueueStatus(_0x17691b,_0x5a2891){setTimeout(function(){if(_['isUndefined'](_0x17691b[_0xe7c8('0x11d')])){loggerBooked[_0xe7c8('0x8d')]('[unlockQueueStatus][undefined]',_0x5a2891);}_0x17691b[_0xe7c8('0x11d')]=!![];loggerBooked[_0xe7c8('0x79')](_0xe7c8('0x11e'),_0x5a2891,JSON[_0xe7c8('0x44')](_[_0xe7c8('0xca')](_0x17691b,[_0xe7c8('0x3a'),_0xe7c8('0x11d')])));},0x1f3);}Dialer[_0xe7c8('0x18')][_0xe7c8('0x35')]=function(_0x4d8ee1){var _0x3d80ec=this;var _0xe78942=_0x3d80ec['voiceQueues'][_0x3d80ec[_0xe7c8('0x24')][_0x4d8ee1[_0xe7c8('0x115')]][_0xe7c8('0xad')]];if(strategy[this[_0xe7c8('0x1e')][this[_0xe7c8('0x24')][_0x4d8ee1[_0xe7c8('0x115')]][_0xe7c8('0xad')]][_0xe7c8('0x116')]]===_0xe7c8('0x17')){if(this['actions'][_0x4d8ee1['actionid']]&&this[_0xe7c8('0x24')][_0x4d8ee1['actionid']][_0xe7c8('0x117')]){this[_0xe7c8('0x1d')][_0xe7c8('0x11f')](this[_0xe7c8('0x24')][_0x4d8ee1[_0xe7c8('0x115')]]['idHopper'],this['actions'][_0x4d8ee1[_0xe7c8('0x115')]][_0xe7c8('0x117')])[_0xe7c8('0xab')](function(_0x5c3375){logger[_0xe7c8('0x8d')](_0xe7c8('0x120'),util[_0xe7c8('0x8e')](_0x5c3375,{'showHidden':![],'depth':null}));})[_0xe7c8('0x1b')](function(){_0x3d80ec[_0xe7c8('0xac')](_0x3d80ec[_0xe7c8('0x1e')][_0x3d80ec[_0xe7c8('0x24')][_0x4d8ee1[_0xe7c8('0x115')]]['queue']]);_0x3d80ec[_0xe7c8('0x20')][_0x3d80ec['actions'][_0x4d8ee1['actionid']][_0xe7c8('0x117')]][_0xe7c8('0x118')]=![];delete _0x3d80ec[_0xe7c8('0x24')][_0x4d8ee1[_0xe7c8('0x115')]];unlockQueueStatus(_0xe78942);});}else{this[_0xe7c8('0xac')](this['voiceQueues'][this['actions'][_0x4d8ee1[_0xe7c8('0x115')]][_0xe7c8('0xad')]]);this[_0xe7c8('0xb8')]({'active':![],'ContactId':this[_0xe7c8('0x24')][_0x4d8ee1[_0xe7c8('0x115')]][_0xe7c8('0xcb')],'ListId':this[_0xe7c8('0x24')][_0x4d8ee1[_0xe7c8('0x115')]][_0xe7c8('0xcc')],'VoiceQueueId':this[_0xe7c8('0x24')][_0x4d8ee1[_0xe7c8('0x115')]][_0xe7c8('0xce')]||undefined,'CampaignId':this[_0xe7c8('0x24')][_0x4d8ee1[_0xe7c8('0x115')]]['CampaignId']||undefined})['catch'](loggerCatch(_0xe7c8('0x121')));delete this['actions'][_0x4d8ee1[_0xe7c8('0x115')]];unlockQueueStatus(_0xe78942);}}else if((strategy[this['voiceQueues'][this[_0xe7c8('0x24')][_0x4d8ee1[_0xe7c8('0x115')]][_0xe7c8('0xad')]][_0xe7c8('0x116')]]||_0xe7c8('0x119'))===_0xe7c8('0x119')){var _0x176f84;if(this[_0xe7c8('0x24')][_0x4d8ee1[_0xe7c8('0x115')]]&&!_['isEmpty'](this['queueBooked'][this[_0xe7c8('0x24')][_0x4d8ee1[_0xe7c8('0x115')]][_0xe7c8('0xad')]])){if(this[_0xe7c8('0x122')][_0x3d80ec['actions'][_0x4d8ee1[_0xe7c8('0x115')]][_0xe7c8('0xad')]]){this[_0xe7c8('0x122')][_0x3d80ec['actions'][_0x4d8ee1[_0xe7c8('0x115')]]['queue']]=this[_0xe7c8('0x122')][this['actions'][_0x4d8ee1[_0xe7c8('0x115')]]['queue']]?this[_0xe7c8('0x122')][this[_0xe7c8('0x24')][_0x4d8ee1[_0xe7c8('0x115')]]['queue']]:this[_0xe7c8('0x29')][this[_0xe7c8('0x24')][_0x4d8ee1['actionid']]['queue']]?this['queueBooked'][this[_0xe7c8('0x24')][_0x4d8ee1[_0xe7c8('0x115')]][_0xe7c8('0xad')]][_0xe7c8('0x123')]||0x0:0x0;}this[_0xe7c8('0x29')][this[_0xe7c8('0x24')][_0x4d8ee1[_0xe7c8('0x115')]][_0xe7c8('0xad')]][_0xe7c8('0x123')]=this[_0xe7c8('0x122')][this[_0xe7c8('0x24')][_0x4d8ee1[_0xe7c8('0x115')]][_0xe7c8('0xad')]];for(var _0x50ab19=0x0;_0x50ab19=0x0?!![]:![];})[_0xe7c8('0xab')](myreject(_0x426e57)));}}else{_0x1ce62e[_0xe7c8('0x11a')](ami[_0xe7c8('0xa8')]({'action':'command','command':util[_0xe7c8('0x72')](_0xe7c8('0x138'),_0x4dac61,!_[_0xe7c8('0x7e')](config[_0xe7c8('0x134')][_0x4ca1cf])?_0x4ca1cf:'')})[_0xe7c8('0xb0')](function(_0x4fa7ed){return _0x4fa7ed['content'][_0xe7c8('0x13c')](_0xe7c8('0x13b'))>=0x0?!![]:![];})[_0xe7c8('0xab')](myreject(_0x426e57)));}BPromise['all'](_0x1ce62e)[_0xe7c8('0xb0')](function(_0x106b46){var _0xe1481b=_[_0xe7c8('0x13d')](_0x106b46);if(_0xe1481b){return _0x5966d4(_0xe1481b);}else{_0x55578c[_0xe7c8('0x38')]=_0x18ec6a?_0xe7c8('0x13e'):_0xe7c8('0x13f');return _0x426e57(msgResponse(_0xe7c8('0x140'),_0xe7c8('0x141'),_0xe7c8('0x142')+_0x18ec6a+'\x20'+_0x14698b+'\x20Interval\x20is\x20overtime:\x20'+util[_0xe7c8('0x8e')](_0x4dac61,{'showHidden':![],'depth':null})+'Timezone:\x20'+_0x4ca1cf));}})['catch'](function(_0x1f7823){return _0x426e57(msgResponse('ifTime','Failure',JSON[_0xe7c8('0x44')](_0x1f7823)));});});};Dialer[_0xe7c8('0x18')][_0xe7c8('0x143')]=function(_0x46d42a){var _0x2027f4=this;return function(){switch(_0x46d42a[_0xe7c8('0x54')]){case _0xe7c8('0x144'):freeVariablesPredictive(_0x46d42a);_0x2027f4[_0xe7c8('0x145')](_0x46d42a,0x1);break;case _0xe7c8('0x146'):freeVariablesPredictive(_0x46d42a);_0x2027f4[_0xe7c8('0x145')](_0x46d42a,_0x46d42a[_0xe7c8('0x147')]);break;case _0xe7c8('0x148'):_0x2027f4['predictive'](_0x46d42a);break;case'booked':freeVariablesPredictive(_0x46d42a);_0x2027f4[_0xe7c8('0x145')](_0x46d42a,0x1);break;default:freeVariablesPredictive(_0x46d42a);logger[_0xe7c8('0x8d')](_0xe7c8('0x149'),_0x46d42a[_0xe7c8('0x3a')],_0xe7c8('0x14a'));}};};Dialer['prototype'][_0xe7c8('0x14b')]=function(_0x10515c){var _0x3121b9=this;return function(){_0x3121b9[_0xe7c8('0x14c')](_0x10515c);};};Dialer['prototype'][_0xe7c8('0x9')]=function(_0x17269d){var _0x3a14d8=this;if(isNotPreview(_0x17269d[_0xe7c8('0x54')])){if(isVoiceQueueOutbound(_0x17269d[_0xe7c8('0x49')])&&isActive(_0x17269d['dialActive'])){_0x17269d['sendMessageOneNotActive']=!![];BPromise[_0xe7c8('0xb3')]()['then'](checkIsLoggedIn(_0x17269d,_0x17269d[_0xe7c8('0x4d')]))[_0xe7c8('0xb0')](checkIsActive(_0x17269d,_0x17269d[_0xe7c8('0x14d')]))[_0xe7c8('0xb0')](checkInterval(_0x17269d))[_0xe7c8('0xb0')](_0x3a14d8['checkIsTrunkReachable'](_0x17269d))[_0xe7c8('0xb0')](_0x3a14d8['checkIfTime'](_0x17269d[_0xe7c8('0x14e')],_0x17269d[_0xe7c8('0x14f')],_0x17269d[_0xe7c8('0x3a')],_0x17269d))[_0xe7c8('0xb0')](_0x3a14d8['checkIfTimeIntervals'](_0x17269d['Interval'],_0x17269d[_0xe7c8('0x14f')],_0x17269d[_0xe7c8('0x3a')],_0x17269d))[_0xe7c8('0xb0')](_0x3a14d8[_0xe7c8('0x143')](_0x17269d))[_0xe7c8('0xab')](loggerCatchQueueSummary(_0xe7c8('0x150'),_0x17269d));}else{notSendMessagesQueue(_0x17269d);}}else{freeVariablesPredictive(_0x17269d);}};Dialer['prototype']['syncCampaigns']=function(){var _0x2fbf6c=this;var _0x5e76ba;for(var _0x187cb6 in this[_0xe7c8('0x1f')]){if(this[_0xe7c8('0x1f')][_0xe7c8('0x90')](_0x187cb6)){_0x5e76ba=this[_0xe7c8('0x1f')][_0x187cb6];if(isCampaignIvr(_0x5e76ba['type'])&&isActive(_0x5e76ba[_0xe7c8('0xd3')])){_0x5e76ba[_0xe7c8('0x9a')]=!![];BPromise[_0xe7c8('0xb3')]()['then'](checkIsActive(_0x5e76ba,_0x5e76ba[_0xe7c8('0xd3')]))[_0xe7c8('0xb0')](checkInterval(_0x5e76ba))['then'](_0x2fbf6c['checkIsTrunkReachable'](_0x5e76ba))[_0xe7c8('0xb0')](_0x2fbf6c[_0xe7c8('0x131')](_0x5e76ba[_0xe7c8('0x14e')],_0x5e76ba['dialTimezone'],_0x5e76ba[_0xe7c8('0x3a')],_0x5e76ba))[_0xe7c8('0xb0')](_0x2fbf6c[_0xe7c8('0x151')](_0x5e76ba[_0xe7c8('0x3d')],_0x5e76ba[_0xe7c8('0x14f')],_0x5e76ba[_0xe7c8('0x3a')],_0x5e76ba))[_0xe7c8('0xb0')](_0x2fbf6c['launchHandleIvr'](_0x5e76ba))['catch'](loggerCatchQueueSummary(_0xe7c8('0x152'),_0x5e76ba));}else{notSendMessagesCampaign(_0x5e76ba);}}}};function getCallerIdRandom(_0x40f100,_0x5039af){var _0x3c01fd,_0x1140a0,_0x262313;if(_0x5039af<=0x0){_0x5039af=0x1;}_0x3c01fd=new RegExp(_0xe7c8('0x153')+_0x5039af+'}$');_0x1140a0=Math[_0xe7c8('0x154')](0xa,_0x5039af-0x1);_0x262313=Math[_0xe7c8('0x154')](0xa,_0x5039af)-0x1;return util[_0xe7c8('0x72')]('%s',_[_0xe7c8('0x155')](_0x40f100,_0x3c01fd,_['random'](_0x1140a0,_0x262313)));}function extractCalleridName(_0x22292d){var _0x47b148=_0x22292d[_0xe7c8('0x156')](/"(.*?)"/);return _0x47b148?_0x47b148[0x1]:_0x22292d;}function extractCalleridNumber(_0x6d9318){var _0x32c91b=_0x6d9318[_0xe7c8('0x156')](/<(.*?)>/);return _0x32c91b?_0x32c91b[0x1]:_0x6d9318;}Dialer[_0xe7c8('0x18')]['actionOriginate']=function(_0x2478af,_0x5f4494){var _0x4ac917=this;var _0x147303=uuid['v4']();this[_0xe7c8('0x24')][_0x147303]=new Action(_0x2478af,_0x5f4494,_0x147303);return new BPromise(function(_0x467f97,_0x5c18d0){if(_['isUndefined'](_0x2478af)&&_0xe7c8('0x157')!==typeof _0x2478af){return _0x5c18d0(msgResponse(_0xe7c8('0x158'),_0xe7c8('0x141'),'voiceQueue\x20is\x20undefine'));}if(_['isUndefined'](_0x5f4494[_0xe7c8('0x159')][_0xe7c8('0x15a')])||_0x5f4494[_0xe7c8('0x159')][_0xe7c8('0x15a')]===null){return _0x5c18d0(msgResponse('originate','Failure','contact\x20is\x20undefine'));}var _0x16c3a7={'XMD-CALLERID':_0x4ac917[_0xe7c8('0x24')][_0x147303][_0xe7c8('0x15b')](),'XMD-AGI':_0x2478af[_0xe7c8('0xee')]?util[_0xe7c8('0x72')](_0xe7c8('0x15c'),ipAgi,_0x2478af[_0xe7c8('0xee')]):'NONE','XMD-AGIAFTER':_0x2478af[_0xe7c8('0xf6')]?util[_0xe7c8('0x72')](_0xe7c8('0x15c'),ipAgi,_0x2478af['dialQueueProject2']):_0xe7c8('0x15d'),'XMD-QUEUE':_0x2478af[_0xe7c8('0x49')]===_0xe7c8('0x4a')?util[_0xe7c8('0x72')]('\x22%s,%s%s,,,%s\x22',_0x2478af[_0xe7c8('0x3a')],_0x2478af[_0xe7c8('0x15e')]||'',_0x2478af['dialAgiAfterHangupAgent']?'c':'',_0x2478af[_0xe7c8('0xff')]||0x3):'NONE','XMD-CONTACTID':_0x5f4494[_0xe7c8('0xcb')],'XMD-CDRTYPE':'dialer','CALLERID(all)':_0x4ac917[_0xe7c8('0x24')][_0x147303][_0xe7c8('0x15b')](),'XMD-AMD':_0x2478af[_0xe7c8('0xda')]?_0xe7c8('0x15f'):_0xe7c8('0x15d'),'XMD-DESTINATION':_0xe7c8('0xd9')};if(_0x2478af[_0xe7c8('0xda')]){_0x16c3a7[_0xe7c8('0x160')]=_0x2478af[_0xe7c8('0x161')]||0x9c4;_0x16c3a7[_0xe7c8('0x162')]=_0x2478af[_0xe7c8('0x163')]||0x5dc;_0x16c3a7[_0xe7c8('0x164')]=_0x2478af[_0xe7c8('0x165')]||0x320;_0x16c3a7[_0xe7c8('0x166')]=_0x2478af[_0xe7c8('0x167')]||0x1388;_0x16c3a7[_0xe7c8('0x168')]=_0x2478af[_0xe7c8('0x169')]||0x64;_0x16c3a7[_0xe7c8('0x16a')]=_0x2478af['dialAMDBetweenWordsSilence']||0x32;_0x16c3a7['XMD-AMDMAXIMUMNUMBEROFWORDS']=_0x2478af[_0xe7c8('0x16b')]||0x3;_0x16c3a7[_0xe7c8('0x16c')]=_0x2478af[_0xe7c8('0x16d')]||0x100;_0x16c3a7[_0xe7c8('0x16e')]=_0x2478af['dialAMDMaximumWordLength']||0x1388;}if(_0x2478af[_0xe7c8('0x49')]===_0xe7c8('0x4a')){_0x16c3a7[_0xe7c8('0x16f')]=_0x5f4494[_0xe7c8('0xce')];}else{_0x16c3a7[_0xe7c8('0x170')]=_0x5f4494[_0xe7c8('0xcf')];}for(var _0x54722c in _0x5f4494[_0xe7c8('0x159')]){if(_0x5f4494['Contact'][_0xe7c8('0x90')](_0x54722c)){if(isNotNull(_0x5f4494[_0xe7c8('0x159')][_0x54722c])&&_0x54722c!=='id'&&_0x54722c!==_0xe7c8('0x171')&&_0x54722c!==_0xe7c8('0x172')&&_0x54722c!==_0xe7c8('0x173')){_0x16c3a7[util[_0xe7c8('0x72')](_0xe7c8('0x174'),_0xe7c8('0x175'),_[_0xe7c8('0x176')](_0x54722c))]=_0x5f4494[_0xe7c8('0x159')][_0x54722c];}}}var _0x4de3d2=_0x4ac917['isTrunkReachable'](_0x2478af[_0xe7c8('0x6f')])?getCallerId(_0x2478af[_0xe7c8('0x6f')][_0xe7c8('0x70')],_0x2478af[_0xe7c8('0x55')],_0x2478af[_0xe7c8('0x177')]>0x0?getCallerIdRandom(_0x2478af['dialOriginateCallerIdNumber'],_0x2478af['dialRandomLastDigitCallerIdNumber']):_0x2478af['dialOriginateCallerIdNumber']):getCallerId(_[_0xe7c8('0xa7')](_0x2478af[_0xe7c8('0x12f')])?_0x2478af['Trunk']['callerid']:_0x2478af[_0xe7c8('0x12f')][_0xe7c8('0x70')],_0x2478af[_0xe7c8('0x55')],_0x2478af[_0xe7c8('0x177')]>0x0?getCallerIdRandom(_0x2478af[_0xe7c8('0x56')],_0x2478af[_0xe7c8('0x177')]):_0x2478af[_0xe7c8('0x56')]);if(_0x4de3d2){_0x16c3a7[_0xe7c8('0x178')]=_0x4ac917[_0xe7c8('0x24')][_0x147303]['originatecalleridname']=extractCalleridName(_0x4de3d2);_0x16c3a7[_0xe7c8('0x179')]=_0x4ac917['actions'][_0x147303]['originatecalleridnum']=extractCalleridNumber(_0x4de3d2);}return ami[_0xe7c8('0xa8')]({'actionid':_0x147303,'action':_0xe7c8('0x158'),'channel':_0x4ac917[_0xe7c8('0x12e')](_0x2478af['Trunk'])?util[_0xe7c8('0x72')](_0xe7c8('0x17a'),_0x2478af[_0xe7c8('0x6f')][_0xe7c8('0x3a')],isNotNull(_0x2478af['dialPrefix'])?_0x2478af[_0xe7c8('0x57')]['trim']()||'':'',_0x2478af[_0xe7c8('0x17b')]>0x0?_0x5f4494[_0xe7c8('0x159')][_0xe7c8('0x15a')][_0xe7c8('0x17c')](_0x2478af[_0xe7c8('0x17b')]):_0x5f4494[_0xe7c8('0x159')][_0xe7c8('0x15a')]):util[_0xe7c8('0x72')](_0xe7c8('0x17a'),_[_0xe7c8('0xa7')](_0x2478af[_0xe7c8('0x12f')])?_0x2478af['Trunk'][_0xe7c8('0x3a')]:_0x2478af['TrunkBackup'][_0xe7c8('0x3a')],isNotNull(_0x2478af[_0xe7c8('0x57')])?_0x2478af['dialPrefix']['trim']()||'':'',_0x2478af[_0xe7c8('0x17b')]>0x0?_0x5f4494[_0xe7c8('0x159')][_0xe7c8('0x15a')][_0xe7c8('0x17c')](_0x2478af['dialCutDigit']):_0x5f4494['Contact']['phone']),'callerid':_0x4de3d2,'Exten':_0xe7c8('0xd9'),'Context':_0xe7c8('0x17d'),'Priority':'1','variable':_0x16c3a7,'timeout':(_0x2478af[_0xe7c8('0x17e')]||0x1e)*0x3e8,'async':!![],'channelid':_0x147303})[_0xe7c8('0xb0')](function(_0x499ee7){return _0x467f97(_0x499ee7);})[_0xe7c8('0xab')](function(_0x2f889c){_0x2478af[_0xe7c8('0x60')]+=0x1;var _0x2f277b=new History(_0x4ac917['actions'][_0x147303]);logger[_0xe7c8('0x8d')](util[_0xe7c8('0x72')](_0xe7c8('0x17f'),JSON['stringify'](_0x2f889c)));_0x2f277b[_0xe7c8('0xde')]=0xe;_0x2f277b['statedesc']=_0xe7c8('0x180');_0x2f277b['starttime']=moment()[_0xe7c8('0x72')](_0xe7c8('0xfb'));_0x2f277b[_0xe7c8('0xa2')]=_0x2f277b[_0xe7c8('0xa3')];_0x4ac917['createHistory'](_0x2f277b)['catch'](loggerCatch(_0xe7c8('0x181')));_0x4ac917[_0xe7c8('0xc0')](_0x2f277b)['catch'](loggerCatch(_0xe7c8('0x181')))['finally'](function(){delete _0x4ac917[_0xe7c8('0x24')][_0x147303];return _0x5c18d0(msgResponse(_0xe7c8('0x158'),_0xe7c8('0x43'),'originate\x20action\x20Error'));});});});};Dialer['prototype'][_0xe7c8('0x2f')]=function(_0x3bf4fa){var _0x478905=this['actions'][_0x3bf4fa[_0xe7c8('0x115')]];var _0x353195=this;if(_0x478905){delete this['actions'][_0x3bf4fa[_0xe7c8('0x115')]];_0x478905[_0xe7c8('0xfe')]=moment()[_0xe7c8('0x72')](_0xe7c8('0xfb'));var _0xf72128=_0x478905[_0xe7c8('0x49')]===_0xe7c8('0x75')?this['campaigns'][_0x478905[_0xe7c8('0xad')]]:this[_0xe7c8('0x1e')][_0x478905[_0xe7c8('0x182')]()];if(!this[_0xe7c8('0xd2')](_0x3bf4fa[_0xe7c8('0x183')])){this['updateOriginated'](_0xf72128);return this['callProgressDetecting'](_0x478905,_0xf72128,_0x3bf4fa)[_0xe7c8('0xb0')](function(_0x41206f){})[_0xe7c8('0xab')](loggerCatch(_0xe7c8('0x184')));}else{this['uniqueId'][_0x3bf4fa[_0xe7c8('0xdd')]]=_0x478905;}}};Dialer[_0xe7c8('0x18')][_0xe7c8('0x185')]=function(_0x509227,_0x2dc429,_0x27e2b5){var _0x5ade98=new History(_0x2dc429);if(_0x5ade98[_0xe7c8('0x186')]+_0x5ade98[_0xe7c8('0x187')]+_0x5ade98[_0xe7c8('0x188')]+_0x5ade98[_0xe7c8('0x189')]+_0x5ade98['countdropretry']+_0x5ade98['countabandonedretry']+_0x5ade98[_0xe7c8('0x18a')]+_0x5ade98[_0xe7c8('0x18b')]>=_0x27e2b5[_0xe7c8('0x18c')]-0x1){return!![];}switch(_0x509227){case 0x3:if(_0x5ade98[_0xe7c8('0x188')]>=_0x27e2b5[_0xe7c8('0x18d')]-0x1){return!![];}else{this[_0xe7c8('0xb8')]({'active':![],'countnoanswerretry':_0x5ade98['countnoanswerretry']+=0x1,'scheduledat':moment()[_0xe7c8('0x105')](_0x27e2b5['dialNoAnswerRetryFrequency'],_0xe7c8('0x107'))[_0xe7c8('0x72')](_0xe7c8('0xfb')),'ContactId':_0x5ade98['ContactId'],'ListId':_0x5ade98[_0xe7c8('0xcc')],'VoiceQueueId':_0x5ade98[_0xe7c8('0xce')]||undefined,'CampaignId':_0x5ade98[_0xe7c8('0xcf')]||undefined})[_0xe7c8('0xab')](loggerCatch('[rescheduleContact][NoAnswer]'));}break;case 0x5:if(_0x5ade98[_0xe7c8('0x186')]>=_0x27e2b5[_0xe7c8('0x18e')]-0x1){return!![];}else{this[_0xe7c8('0xb8')]({'active':![],'countbusyretry':_0x5ade98[_0xe7c8('0x186')]+=0x1,'scheduledat':moment()[_0xe7c8('0x105')](_0x27e2b5[_0xe7c8('0x18f')],'minutes')[_0xe7c8('0x72')]('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0x5ade98['ContactId'],'ListId':_0x5ade98[_0xe7c8('0xcc')],'VoiceQueueId':_0x5ade98[_0xe7c8('0xce')]||undefined,'CampaignId':_0x5ade98[_0xe7c8('0xcf')]||undefined})['catch'](loggerCatch('[rescheduleContact]\x20[Busy]'));}break;case 0x8:if(_0x5ade98[_0xe7c8('0x187')]>=_0x27e2b5[_0xe7c8('0x190')]-0x1){return!![];}else{this[_0xe7c8('0xb8')]({'active':![],'countcongestionretry':_0x5ade98[_0xe7c8('0x187')]+=0x1,'scheduledat':moment()['add'](_0x27e2b5[_0xe7c8('0x191')],_0xe7c8('0x107'))['format'](_0xe7c8('0xfb')),'ContactId':_0x5ade98[_0xe7c8('0xcb')],'ListId':_0x5ade98['ListId'],'VoiceQueueId':_0x5ade98[_0xe7c8('0xce')]||undefined,'CampaignId':_0x5ade98[_0xe7c8('0xcf')]||undefined})['catch'](loggerCatch(_0xe7c8('0x192')));}break;case 0x0:if(_0x5ade98[_0xe7c8('0x189')]>=_0x27e2b5[_0xe7c8('0x193')]-0x1){return!![];}else{this[_0xe7c8('0xb8')]({'active':![],'countnosuchnumberretry':_0x5ade98[_0xe7c8('0x189')]+=0x1,'scheduledat':moment()[_0xe7c8('0x105')](_0x27e2b5[_0xe7c8('0x194')],_0xe7c8('0x107'))[_0xe7c8('0x72')]('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0x5ade98[_0xe7c8('0xcb')],'ListId':_0x5ade98[_0xe7c8('0xcc')],'VoiceQueueId':_0x5ade98[_0xe7c8('0xce')]||undefined,'CampaignId':_0x5ade98['CampaignId']||undefined})[_0xe7c8('0xab')](loggerCatch(_0xe7c8('0x195')));}break;case 0xa:if(_0x5ade98[_0xe7c8('0x102')]>=_0x27e2b5[_0xe7c8('0x103')]-0x1){return!![];}else{this['rescheduleContact']({'active':![],'countdropretry':_0x5ade98[_0xe7c8('0x102')]+=0x1,'scheduledat':moment()[_0xe7c8('0x105')](_0x27e2b5['dialDropRetryFrequency'],_0xe7c8('0x107'))[_0xe7c8('0x72')](_0xe7c8('0xfb')),'ContactId':_0x5ade98[_0xe7c8('0xcb')],'ListId':_0x5ade98['ListId'],'VoiceQueueId':_0x5ade98['VoiceQueueId']||undefined,'CampaignId':_0x5ade98[_0xe7c8('0xcf')]||undefined})[_0xe7c8('0xab')](loggerCatch(_0xe7c8('0x108')));}break;case 0xb:if(_0x5ade98[_0xe7c8('0x10f')]>=_0x27e2b5[_0xe7c8('0x110')]-0x1){return!![];}else{this[_0xe7c8('0xb8')]({'active':![],'countabandonedretry':_0x5ade98[_0xe7c8('0x10f')]+=0x1,'scheduledat':moment()[_0xe7c8('0x105')](_0x27e2b5[_0xe7c8('0x111')],_0xe7c8('0x107'))[_0xe7c8('0x72')](_0xe7c8('0xfb')),'ContactId':_0x5ade98['ContactId'],'ListId':_0x5ade98[_0xe7c8('0xcc')],'VoiceQueueId':_0x5ade98['VoiceQueueId']||undefined,'CampaignId':_0x5ade98[_0xe7c8('0xcf')]||undefined})[_0xe7c8('0xab')](loggerCatch(_0xe7c8('0x196')));}break;case 0x13:if(_0x5ade98[_0xe7c8('0x18a')]>=_0x27e2b5['dialMachineMaxRetry']-0x1){return!![];}else{this['rescheduleContact']({'active':![],'countmachineretry':_0x5ade98[_0xe7c8('0x18a')]+=0x1,'scheduledat':moment()[_0xe7c8('0x105')](_0x27e2b5[_0xe7c8('0x197')],_0xe7c8('0x107'))[_0xe7c8('0x72')](_0xe7c8('0xfb')),'ContactId':_0x5ade98[_0xe7c8('0xcb')],'ListId':_0x5ade98[_0xe7c8('0xcc')],'VoiceQueueId':_0x5ade98[_0xe7c8('0xce')]||undefined,'CampaignId':_0x5ade98[_0xe7c8('0xcf')]||undefined})[_0xe7c8('0xab')](loggerCatch(_0xe7c8('0x198')));}break;case 0x14:if(_0x5ade98[_0xe7c8('0x18b')]>=_0x27e2b5[_0xe7c8('0x199')]-0x1){return!![];}else{this['rescheduleContact']({'active':![],'countagentrejectretry':_0x5ade98[_0xe7c8('0x18b')]+=0x1,'scheduledat':moment()[_0xe7c8('0x105')](_0x27e2b5[_0xe7c8('0x19a')],'minutes')[_0xe7c8('0x72')](_0xe7c8('0xfb')),'ContactId':_0x5ade98[_0xe7c8('0xcb')],'ListId':_0x5ade98[_0xe7c8('0xcc')],'VoiceQueueId':_0x5ade98[_0xe7c8('0xce')]||undefined,'CampaignId':_0x5ade98['CampaignId']||undefined})[_0xe7c8('0xab')](loggerCatch(_0xe7c8('0x19b')));}break;default:return!![];}};Dialer[_0xe7c8('0x18')][_0xe7c8('0x19c')]=function(_0x5cd7b5,_0x46e04e,_0x249728){var _0x2d351f=this;var _0x5891fa=new History(_0x5cd7b5);return new BPromise(function(_0xc30e61,_0x519e7e){if(_[_0xe7c8('0x7e')](_0x46e04e)&&'object'!==typeof _0x46e04e){return _0x519e7e(msgResponse(_0xe7c8('0x19d'),_0xe7c8('0x141'),_0xe7c8('0x19e')));}if(_[_0xe7c8('0x7e')](_0x249728)&&_0xe7c8('0x157')!==typeof _0x249728){return _0x519e7e(msgResponse('[callProgressDetecting]',_0xe7c8('0x141'),_0xe7c8('0x19f')));}switch(_0x249728[_0xe7c8('0xf4')]){case'0':_0x46e04e[_0xe7c8('0x5f')]+=0x1;_0x5891fa['state']=0x0;_0x5891fa[_0xe7c8('0xa1')]=_0xe7c8('0x1a0');_0x5891fa[_0xe7c8('0x189')]+=0x1;_0x5891fa[_0xe7c8('0x1a1')]+=0x1;_0x2d351f[_0xe7c8('0xc2')](_0x5891fa)['catch'](loggerCatch(_0xe7c8('0x1a2')));if(_0x2d351f[_0xe7c8('0x185')](0x0,_0x5cd7b5,_0x46e04e)){if(_0x5891fa['countbusyretry']+_0x5891fa[_0xe7c8('0x187')]+_0x5891fa[_0xe7c8('0x188')]+_0x5891fa[_0xe7c8('0x189')]+_0x5891fa[_0xe7c8('0x102')]+_0x5891fa[_0xe7c8('0x10f')]+_0x5891fa[_0xe7c8('0x18a')]+_0x5891fa['countagentrejectretry']>=_0x46e04e['dialGlobalMaxRetry']){_0x2d351f[_0xe7c8('0x1a3')](_0x5891fa,_0xc30e61,_0x519e7e,'reason\x200\x20no\x20such\x20number....');}else{_0x2d351f[_0xe7c8('0x1a4')](_0x5891fa,_0xc30e61,_0x519e7e,_0xe7c8('0x1a5'));}}break;case'3':_0x46e04e[_0xe7c8('0x5e')]+=0x1;_0x5891fa['state']=0x3;_0x5891fa[_0xe7c8('0xa1')]=_0xe7c8('0x1a6');_0x5891fa['countnoanswerretry']+=0x1;_0x5891fa[_0xe7c8('0x1a1')]+=0x1;_0x2d351f[_0xe7c8('0xc2')](_0x5891fa)['catch'](loggerCatch(_0xe7c8('0x1a7')));if(_0x2d351f[_0xe7c8('0x185')](0x3,_0x5cd7b5,_0x46e04e)){if(_0x5891fa['countnoanswerretry']>=_0x46e04e['dialNoAnswerMaxRetry']){_0x2d351f['createStateFinal'](_0x5891fa,_0xc30e61,_0x519e7e,'reason\x203\x20ringing\x20no\x20answer');}else{_0x2d351f['stateGlobal'](_0x5891fa,_0xc30e61,_0x519e7e,_0xe7c8('0x1a8'));}}break;case'5':_0x46e04e[_0xe7c8('0x5a')]+=0x1;_0x5891fa[_0xe7c8('0xde')]=0x5;_0x5891fa[_0xe7c8('0xa1')]='Busy';_0x5891fa[_0xe7c8('0x186')]+=0x1;_0x5891fa[_0xe7c8('0x1a1')]+=0x1;_0x2d351f[_0xe7c8('0xc2')](_0x5891fa)['catch'](loggerCatch(_0xe7c8('0x1a9')));if(_0x2d351f[_0xe7c8('0x185')](0x5,_0x5cd7b5,_0x46e04e)){if(_0x5891fa[_0xe7c8('0x186')]>=_0x46e04e[_0xe7c8('0x18e')]){_0x2d351f['createStateFinal'](_0x5891fa,_0xc30e61,_0x519e7e,_0xe7c8('0x1aa'));}else{_0x2d351f['stateGlobal'](_0x5891fa,_0xc30e61,_0x519e7e,_0xe7c8('0x1aa'));}}break;case'8':_0x46e04e[_0xe7c8('0x5b')]+=0x1;_0x5891fa['state']=0x8;_0x5891fa[_0xe7c8('0xa1')]=_0xe7c8('0x1ab');_0x5891fa[_0xe7c8('0x187')]+=0x1;_0x5891fa[_0xe7c8('0x1a1')]+=0x1;_0x2d351f[_0xe7c8('0xc2')](_0x5891fa)[_0xe7c8('0xab')](loggerCatch(_0xe7c8('0x1ac')));if(_0x2d351f[_0xe7c8('0x185')](0x8,_0x5cd7b5,_0x46e04e)){if(_0x5891fa[_0xe7c8('0x187')]>=_0x46e04e[_0xe7c8('0x190')]){_0x2d351f[_0xe7c8('0x1a4')](_0x5891fa,_0xc30e61,_0x519e7e,_0xe7c8('0x1ad'));}else{_0x2d351f[_0xe7c8('0x1a3')](_0x5891fa,_0xc30e61,_0x519e7e,_0xe7c8('0x1ad'));}}break;case'11':_0x46e04e['outboundAbandonedCallsDay']+=0x1;_0x5891fa[_0xe7c8('0xde')]=0xb;_0x5891fa[_0xe7c8('0xa1')]=_0xe7c8('0x10c');_0x5891fa['countabandonedretry']+=0x1;_0x5891fa[_0xe7c8('0x1a1')]+=0x1;_0x2d351f[_0xe7c8('0xc2')](_0x5891fa)[_0xe7c8('0xab')](loggerCatch('[syncAgentComplete][createHistory][11]'));if(_0x2d351f[_0xe7c8('0x185')](0xb,_0x5cd7b5,_0x46e04e)){if(_0x5891fa['countabandonedretry']>=_0x46e04e[_0xe7c8('0x110')]){_0x2d351f[_0xe7c8('0x1a4')](_0x5891fa,_0xc30e61,_0x519e7e,_0xe7c8('0x1ae'));}else{_0x2d351f[_0xe7c8('0x1a3')](_0x5891fa,_0xc30e61,_0x519e7e,'reason\x2011\x20abandoned');}}break;case'20':_0x46e04e[_0xe7c8('0x61')]+=0x1;_0x5891fa[_0xe7c8('0xde')]=0x14;_0x5891fa[_0xe7c8('0xa1')]=_0xe7c8('0x1af');_0x5891fa[_0xe7c8('0x18b')]+=0x1;_0x5891fa[_0xe7c8('0x1a1')]+=0x1;_0x2d351f[_0xe7c8('0xc2')](_0x5891fa)['catch'](loggerCatch(_0xe7c8('0x1b0')));if(_0x2d351f[_0xe7c8('0x185')](0x14,_0x5cd7b5,_0x46e04e)){if(_0x5891fa[_0xe7c8('0x18b')]>=_0x46e04e[_0xe7c8('0x199')]){_0x2d351f[_0xe7c8('0x1a4')](_0x5891fa,_0xc30e61,_0x519e7e,_0xe7c8('0x1b1'));}else{_0x2d351f[_0xe7c8('0x1a3')](_0x5891fa,_0xc30e61,_0x519e7e,_0xe7c8('0x1b1'));}}break;default:_0x46e04e['outboundUnknownCallsDay']+=0x1;_0x5891fa[_0xe7c8('0xde')]=0xc;_0x5891fa[_0xe7c8('0xa1')]=_0x249728[_0xe7c8('0xf4')];_0x2d351f[_0xe7c8('0xc2')](_0x5891fa)[_0xe7c8('0xab')](loggerCatch(_0xe7c8('0x1b2')));if(_0x2d351f[_0xe7c8('0x185')](_0x249728[_0xe7c8('0xf4')],_0x5cd7b5,_0x46e04e)){if(_0x5891fa[_0xe7c8('0x186')]+_0x5891fa[_0xe7c8('0x187')]+_0x5891fa['countnoanswerretry']+_0x5891fa[_0xe7c8('0x189')]+_0x5891fa['countdropretry']+_0x5891fa[_0xe7c8('0x10f')]+_0x5891fa[_0xe7c8('0x18a')]+_0x5891fa[_0xe7c8('0x18b')]>=_0x46e04e['dialGlobalMaxRetry']){_0x2d351f['stateGlobal'](_0x5891fa,_0xc30e61,_0x519e7e,_0x249728[_0xe7c8('0xf4')]);}else{_0x2d351f[_0xe7c8('0x1a4')](_0x5891fa,_0xc30e61,_0x519e7e,_0x249728[_0xe7c8('0xf4')]);}}}});};Dialer[_0xe7c8('0x18')][_0xe7c8('0x1a3')]=function(_0xa542f3,_0x560258,_0x3e2cab,_0x202cf2){var _0x208013=new Final(_0xa542f3);_0x208013['state']=0xf;_0x208013[_0xe7c8('0xa1')]=_0xe7c8('0x1b3');this[_0xe7c8('0x1a4')](_0x208013,_0x560258,_0x3e2cab,_0x202cf2);};Dialer[_0xe7c8('0x18')][_0xe7c8('0x1a4')]=function(_0x15e102,_0x23d162,_0x59bc58,_0x20d467){this['moveContactManagedDialer'](_0x15e102)[_0xe7c8('0xb0')](function(_0x5913fd){return _0x23d162(msgResponse(_0xe7c8('0x19d'),'Success',_0x20d467));})[_0xe7c8('0xab')](function(_0x2564dd){return _0x59bc58(msgResponse(_0xe7c8('0x1b4'),_0xe7c8('0x141'),_0xe7c8('0x1b5')));});};Dialer[_0xe7c8('0x18')][_0xe7c8('0x148')]=function(_0x3397b6){var _0x5ded37=this;var _0x5d7e26=_0x3397b6[_0xe7c8('0x1b6')]/0x64;var _0x8ab210=_0x3397b6['outboundDropCallsDayTimeout']/(_0x3397b6[_0xe7c8('0x5d')]+_0x3397b6['outboundAnswerCallsDay']);var _0x37b6c8=Math[_0xe7c8('0x1b7')](_0x3397b6[_0xe7c8('0x6a')]*(_0x3397b6[_0xe7c8('0x1b8')]/0x64));var _0x20d667=Math[_0xe7c8('0x1b7')](_0x3397b6[_0xe7c8('0x6a')]*(_0x3397b6['predictiveIntervalMinThreshold']/0x64));var _0x3565d2=_0x3397b6['available']+_0x3397b6[_0xe7c8('0x99')];var _0x3ebac9=Math[_0xe7c8('0x1b9')](_0x3397b6[_0xe7c8('0x83')]*_0x3397b6[_0xe7c8('0x6e')]*_0x3397b6[_0xe7c8('0x67')]*_0x3397b6[_0xe7c8('0x68')]);if(_[_0xe7c8('0x7e')](_0x3397b6['startProgressive'])){if(!_[_0xe7c8('0x7e')](_0x3397b6[_0xe7c8('0x26')])){_0x3397b6[_0xe7c8('0x26')]=undefined;loggerPredictive[_0xe7c8('0x8d')](_0xe7c8('0x1ba'),_0xe7c8('0x1bb'));}if(!_[_0xe7c8('0x7e')](_0x3397b6[_0xe7c8('0x88')])){loggerPredictive[_0xe7c8('0x8d')](_0xe7c8('0x1ba'),_0xe7c8('0x1bc'));clearInterval(_0x3397b6[_0xe7c8('0x88')]);_0x3397b6['handlePredictive']=undefined;}_0x3397b6['startProgressive']=moment()[_0xe7c8('0x72')]('YYYY-MM-DD\x20HH:mm:ss');loggerPredictive[_0xe7c8('0x79')](_0x3397b6[_0xe7c8('0x3a')],_0xe7c8('0x1bd'),_0x3397b6['startProgressive']);this['handlePower'](_0x3397b6,0x1);}else if(ifInterval(_0x3397b6[_0xe7c8('0x1be')],_0x3397b6[_0xe7c8('0x27')])){this[_0xe7c8('0x145')](_0x3397b6,0x1);loggerPredictiveCalls[_0xe7c8('0x79')]('[startMethodPredictive][StartProgressive][Loop]',_0x3397b6[_0xe7c8('0x27')],_0x3397b6[_0xe7c8('0x3a')]);_0x3397b6['erlangCalls']=0x0;_0x3397b6['predictiveIntervalErlangCallsDroppedCalls']=0x0;}else if(_0x5d7e26<_0x8ab210&&_0x3397b6[_0xe7c8('0x1bf')]===_0xe7c8('0x1c0')){freeVariablesPredictive(_0x3397b6);loggerPredictive[_0xe7c8('0x79')](_0xe7c8('0x1c1'),_0xe7c8('0x1c2'),_0x8ab210,_0xe7c8('0x27'),_0x3397b6[_0xe7c8('0x3a')]);}else if(_0x3ebac9<_0x3397b6[_0xe7c8('0x66')]&&_0x3397b6[_0xe7c8('0x1bf')]===_0xe7c8('0x1c0')){freeVariablesPredictive(_0x3397b6);loggerPredictive['info'](_0xe7c8('0x1c3'),_0xe7c8('0x1c4'),_0x3ebac9,_0xe7c8('0x1c5'),_0x3397b6['predictiveIntervalErlangCallsDroppedCalls'],'startProgressive',_0x3397b6['name']);}else if(!ifInterval(_0x3397b6[_0xe7c8('0x1be')],_0x3397b6['startProgressive'])&&_['isUndefined'](_0x3397b6[_0xe7c8('0x26')])&&!_[_0xe7c8('0x7e')](_0x3397b6[_0xe7c8('0x27')])){_0x3397b6['startPredictive']=moment()[_0xe7c8('0x72')](_0xe7c8('0xfb'));loggerPredictive[_0xe7c8('0x79')](_0x3397b6[_0xe7c8('0x3a')],_0xe7c8('0x1c6'),_0x3397b6[_0xe7c8('0x26')]);this[_0xe7c8('0xb5')](_0x3397b6['dialPredictiveInterval'])[_0xe7c8('0xb0')](this[_0xe7c8('0x1c7')](_0x3397b6))[_0xe7c8('0xb0')](mergeDataErlangB(_0x3397b6))['then'](this[_0xe7c8('0x1c8')](_0x3397b6))['catch'](loggerCatchPredictive('Predictive\x20after\x20first\x20interval',_0x3397b6));}else if(!ifInterval(_0x3397b6[_0xe7c8('0x1be')],_0x3397b6[_0xe7c8('0x26')])){_0x3397b6[_0xe7c8('0x66')]=0x0;_0x3397b6[_0xe7c8('0x26')]=moment()[_0xe7c8('0x72')](_0xe7c8('0xfb'));loggerPredictive[_0xe7c8('0x79')](_0x3397b6[_0xe7c8('0x3a')],_0xe7c8('0x1c9'),_0x3397b6[_0xe7c8('0x26')]);clearInterval(_0x3397b6[_0xe7c8('0x88')]);_0x3397b6[_0xe7c8('0x88')]=undefined;this['averageHandleTime'](_0x3397b6[_0xe7c8('0x1be')])[_0xe7c8('0xb0')](this['getDataPredictive'](_0x3397b6))[_0xe7c8('0xb0')](mergeDataErlangB(_0x3397b6))[_0xe7c8('0xb0')](this[_0xe7c8('0x1c8')](_0x3397b6))[_0xe7c8('0xab')](loggerCatchPredictive(_0xe7c8('0x1ca'),_0x3397b6));}else if(_0x3397b6[_0xe7c8('0x6a')]&&_0x3565d2<_0x3397b6[_0xe7c8('0x6a')]-_0x20d667){freeVariablesPredictive(_0x3397b6);loggerPredictive[_0xe7c8('0x79')](_0x3397b6[_0xe7c8('0x3a')],'switch\x20in\x20progressive\x20because\x20available\x20agents\x20(',_0x3565d2,_0xe7c8('0x1cb'),_0x3397b6['predictiveIntervalAvailable'],'-',_0x20d667,'=',_0x3397b6[_0xe7c8('0x6a')]-_0x20d667,')');}else if(_0x3397b6['predictiveIntervalAvailable']&&_0x3565d2>_0x3397b6[_0xe7c8('0x6a')]+_0x37b6c8){freeVariablesPredictive(_0x3397b6);loggerPredictive[_0xe7c8('0x79')](_0x3397b6['name'],_0xe7c8('0x1cc'),_0x3565d2,_0xe7c8('0x1cd'),_0x3397b6['predictiveIntervalAvailable'],'+',_0x37b6c8,'=',_0x3397b6['predictiveIntervalAvailable']+_0x37b6c8,')');}};Dialer[_0xe7c8('0x18')]['getDataPredictive']=function(_0x240a16){var _0x111136=this;return function(_0x3de4ef){return new BPromise(function(_0x2ccc47,_0x46b7cb){_[_0xe7c8('0xc9')](_0x240a16,_0x3de4ef[0x0]);if(checkGetDataPredictive(_0x3de4ef[0x0])){var _0x2a0ad6=_0x240a16[_0xe7c8('0x6a')]=_0x240a16[_0xe7c8('0x99')]+_0x240a16[_0xe7c8('0x4c')];var _0x5419db=_0x240a16[_0xe7c8('0x1be')]*0x3c;var _0x2c1782=_0x3de4ef[0x0]['predictiveIntervalAvgTalktime']+_0x3de4ef[0x0][_0xe7c8('0x62')];var _0x10af04=(_0x3de4ef[0x0][_0xe7c8('0x1ce')]+_0x3de4ef[0x0][_0xe7c8('0x65')]+_0x3de4ef[0x0][_0xe7c8('0x64')])/_0x3de4ef[0x0][_0xe7c8('0x6b')];_0x240a16[_0xe7c8('0x67')]=_0x10af04>0x0?_0x10af04:0x1;switch(_0x240a16[_0xe7c8('0x1bf')]){case _0xe7c8('0x1c0'):var _0x400fb6=_0x240a16['dialPredictiveOptimizationPercentage']/0x64;return _0x111136[_0xe7c8('0x1cf')](_0x2a0ad6,_0x5419db,_0x2c1782,_0x10af04,_0x400fb6)[_0xe7c8('0xb0')](function(_0x22d004){return _0x2ccc47(_0x22d004);});case _0xe7c8('0x1d0'):var _0xa532e2=_0x240a16[_0xe7c8('0x1b6')]/0x64;return _0x111136[_0xe7c8('0x1d1')](_0x2a0ad6,_0x5419db,_0x2c1782,_0x10af04,_0xa532e2)['then'](function(_0x22f9b2){return _0x2ccc47(_0x22f9b2);});default:return _0x46b7cb(msgResponse(_0xe7c8('0x1d2'),_0xe7c8('0x141'),_0xe7c8('0x1d3')));}}else{return _0x46b7cb(msgResponse('[getDataPredictive]',_0xe7c8('0x141'),_0xe7c8('0x1d4')));}});};};Dialer[_0xe7c8('0x18')][_0xe7c8('0x1d5')]=function(_0x192b5b){var _0x311ece=this;return function(_0x1dbf17){return new BPromise(function(_0x4d0e1b,_0x1db7b0){_[_0xe7c8('0xc9')](_0x192b5b,_0x1dbf17[0x0]);if(checkGetDataPredictive(_0x1dbf17[0x0])){loggerPredictive['info'](JSON[_0xe7c8('0x44')](_0x1dbf17[0x0]));if(_0x192b5b[_0xe7c8('0x1bf')]===_0xe7c8('0x1c0')){return _0x311ece['getVoiceQueueRtPauses'](_0x192b5b['id'])[_0xe7c8('0xb0')](function(_0x433c45){var _0x3ec562=_0x192b5b['loggedIn']-_0x433c45[0x0][_0xe7c8('0x1d6')];var _0xc2961a=_0x192b5b[_0xe7c8('0x1be')]*0x3c;var _0x515405=_0x1dbf17[0x0][_0xe7c8('0x63')]+_0x1dbf17[0x0][_0xe7c8('0x62')];var _0x9a5759=(_0x1dbf17[0x0][_0xe7c8('0x1ce')]+_0x1dbf17[0x0][_0xe7c8('0x65')]+_0x1dbf17[0x0][_0xe7c8('0x64')])/_0x1dbf17[0x0][_0xe7c8('0x6b')];var _0x39f825=_0x192b5b[_0xe7c8('0x1b6')]/0x64;_0x192b5b[_0xe7c8('0x69')]=_0x433c45[0x0]['outboundQueuePauses']||0x0;_0x192b5b['predictiveIntervalHitRate']=_0x9a5759>0x0?_0x9a5759:0x1;return _0x311ece[_0xe7c8('0x1cf')](_0x3ec562,_0xc2961a,_0x515405,_0x9a5759,_0x39f825);})[_0xe7c8('0xb0')](function(_0x3169ce){return _0x4d0e1b(_0x3169ce);})['catch'](function(_0x1eca24){return _0x1db7b0(msgResponse(_0xe7c8('0x1d7'),_0xe7c8('0x141'),JSON['stringify'](_0x1eca24)));});}if(_0x192b5b[_0xe7c8('0x1bf')]==='agentBusyFactor'){return _0x311ece[_0xe7c8('0xbe')](_0x192b5b['id'])[_0xe7c8('0xb0')](function(_0x524ab0){var _0x55acc7=_0x192b5b[_0xe7c8('0x4d')]-_0x524ab0[0x0]['outboundQueuePauses'];var _0x5cf2d6=_0x192b5b[_0xe7c8('0x1be')]*0x3c;var _0x230826=_0x1dbf17[0x0]['predictiveIntervalAvgTalktime']+_0x1dbf17[0x0][_0xe7c8('0x62')];var _0x1953fe=(_0x1dbf17[0x0][_0xe7c8('0x1ce')]+_0x1dbf17[0x0][_0xe7c8('0x65')]+_0x1dbf17[0x0][_0xe7c8('0x64')])/_0x1dbf17[0x0][_0xe7c8('0x6b')];var _0x5c11db=_0x192b5b['dialPredictiveOptimizationPercentage']/0x64;_0x192b5b[_0xe7c8('0x69')]=_0x524ab0[0x0][_0xe7c8('0x1d6')]||0x0;_0x192b5b[_0xe7c8('0x67')]=_0x1953fe>0x0?_0x1953fe:0x1;return _0x311ece[_0xe7c8('0x1d1')](_0x55acc7,_0x5cf2d6,_0x230826,_0x1953fe,_0x5c11db);})[_0xe7c8('0xb0')](function(_0x29fef2){return _0x4d0e1b(_0x29fef2);})['catch'](function(_0x5c13af){return _0x1db7b0(msgResponse(_0xe7c8('0x1d7'),_0xe7c8('0x141'),JSON[_0xe7c8('0x44')](_0x5c13af)));});}}else{return _0x1db7b0(msgResponse(_0xe7c8('0x1d2'),_0xe7c8('0x141'),_0xe7c8('0x1d4')));}});};};Dialer['prototype'][_0xe7c8('0x1c8')]=function(_0x248271){var _0x17bccd=this;return function(){var _0x169e09=0x0;var _0x455fac=Math[_0xe7c8('0x1b9')](_0x248271[_0xe7c8('0x6d')]*0x3e8);if(_0x455fac>0x0){_0x455fac=_0x455fac<0x64?0x64:_0x455fac;loggerPredictive['info'](_0x248271[_0xe7c8('0x3a')],_0xe7c8('0x1d8'),_0x455fac,_0xe7c8('0x45'));_0x248271['handlePredictive']=setInterval(function(){_0x17bccd[_0xe7c8('0x88')](_0x248271);loggerPredictiveCalls[_0xe7c8('0x79')](_0xe7c8('0x1d9'),_0x169e09+=0x1);},_0x455fac);}else{loggerPredictive[_0xe7c8('0x79')](_0x248271['name'],_0xe7c8('0x1da'));}};};Dialer['prototype'][_0xe7c8('0x1db')]=function(_0x3d7072,_0x597320){var _0x8268d8=this;return function(_0x34a941){if(_[_0xe7c8('0x40')](_0x34a941)){if(_[_0xe7c8('0xa7')](_0x597320[_0xe7c8('0xcd')])||!_0x597320['recallme']){if(_0x3d7072[_0xe7c8('0x54')]==='booked'){_0x3d7072[_0xe7c8('0x11d')]=_[_0xe7c8('0x7e')](_0x3d7072[_0xe7c8('0x11d')])?!![]:_0x3d7072[_0xe7c8('0x11d')];var _0x19c22e=uuid['v4']();_0x8268d8[_0xe7c8('0x24')][_0x19c22e]=new Action(_0x3d7072,_0x597320,_0x19c22e);loggerBooked[_0xe7c8('0x79')](_0xe7c8('0x1dc'),_0x19c22e,_0xe7c8('0x1dd'),JSON[_0xe7c8('0x44')](_0x3d7072[_0xe7c8('0x11d')]),_0xe7c8('0x1de'),_0x3d7072['name']);if(_0x3d7072[_0xe7c8('0x11d')]){_0x3d7072[_0xe7c8('0x11d')]=![];_0x8268d8[_0xe7c8('0x29')][_0x8268d8[_0xe7c8('0x24')][_0x19c22e][_0xe7c8('0xad')]]=[];ami[_0xe7c8('0xa8')]({'actionid':_0x19c22e,'action':'queuestatus','queue':_0x3d7072[_0xe7c8('0x3a')]})[_0xe7c8('0xab')](function(_0x41f060){_0x8268d8[_0xe7c8('0xac')](_0x3d7072);_0x8268d8[_0xe7c8('0xb8')]({'active':![],'ContactId':_0x8268d8[_0xe7c8('0x24')][_0x19c22e][_0xe7c8('0xcb')],'ListId':_0x8268d8[_0xe7c8('0x24')][_0x19c22e][_0xe7c8('0xcc')],'VoiceQueueId':_0x8268d8[_0xe7c8('0x24')][_0x19c22e]['VoiceQueueId']||undefined,'CampaignId':_0x8268d8[_0xe7c8('0x24')][_0x19c22e][_0xe7c8('0xcf')]||undefined})['catch'](loggerCatch(_0xe7c8('0x1df')));delete _0x8268d8[_0xe7c8('0x24')][_0x19c22e];});}else{loggerBooked[_0xe7c8('0x79')](_0xe7c8('0x1e0'),JSON['stringify'](_0x3d7072['queueStatusComplete']),_0xe7c8('0x1de'),_0x3d7072[_0xe7c8('0x3a')]);_0x8268d8[_0xe7c8('0xac')](_0x3d7072);_0x8268d8[_0xe7c8('0xb8')]({'active':![],'ContactId':_0x8268d8[_0xe7c8('0x24')][_0x19c22e]['ContactId'],'ListId':_0x8268d8[_0xe7c8('0x24')][_0x19c22e]['ListId'],'VoiceQueueId':_0x8268d8['actions'][_0x19c22e][_0xe7c8('0xce')]||undefined,'CampaignId':_0x8268d8[_0xe7c8('0x24')][_0x19c22e]['CampaignId']||undefined})['catch'](loggerCatch(_0xe7c8('0x1df')));delete _0x8268d8[_0xe7c8('0x24')][_0x19c22e];}}else{return _0x8268d8[_0xe7c8('0x1e1')](_0x3d7072,_0x597320);}}else{if(getDiff(_0x597320[_0xe7c8('0x1e2')])<_0x3d7072[_0xe7c8('0x1e3')]*0x3c){if(_0x597320[_0xe7c8('0x1e4')]&&!_0x597320[_0xe7c8('0x1e4')]['voicePause']){_0x8268d8[_0xe7c8('0x1d')][_0xe7c8('0x11f')](_0x597320['id'])['finally'](function(){_0x8268d8[_0xe7c8('0xac')](_0x3d7072);});}else{_0x8268d8['unlockContact']({'active':![]},_0x597320['id'],0x1)[_0xe7c8('0x1b')](function(){console[_0xe7c8('0x109')](_0xe7c8('0x1e5'));_0x8268d8[_0xe7c8('0xac')](_0x3d7072);});}}else{_0x3d7072[_0xe7c8('0x1e6')]+=0x1;_0x8268d8[_0xe7c8('0xac')](_0x3d7072);if(_0x3d7072[_0xe7c8('0x1e7')]){_0x8268d8[_0xe7c8('0xb8')]({'active':![],'recallme':![],'UserId':null,'ContactId':_0x597320[_0xe7c8('0xcb')],'ListId':_0x597320[_0xe7c8('0xcc')],'VoiceQueueId':_0x597320[_0xe7c8('0xce')]||undefined,'CampaignId':_0x597320[_0xe7c8('0xcf')]||undefined})['catch'](loggerCatch(_0xe7c8('0x1e8')));_0x8268d8[_0xe7c8('0xc2')](createObjHistory(_0x3d7072,_0x597320,_0xe7c8('0x1e9'),0x17,'RecallInQueue'))['catch'](loggerCatch(_0xe7c8('0x1ea')));}else{_0x8268d8[_0xe7c8('0xc8')](createObjHistory(_0x3d7072,_0x597320,_0xe7c8('0x1eb'),0x16,_0xe7c8('0x1ec')),_0xe7c8('0x1ed'),_0xe7c8('0x1ee'));}}}}else{_0x3d7072[_0xe7c8('0x1ef')]+=0x1;_0x8268d8['saveInDb'](createObjHistory(_0x3d7072,_0x597320,_0xe7c8('0x1f0'),0xd,_0xe7c8('0x1f1')),_0xe7c8('0x1f2'),'[Originate][MoveBlacklist]');throw _0xe7c8('0x1f3');}};};Dialer[_0xe7c8('0x18')][_0xe7c8('0x14c')]=function(_0x2558bc){var _0x191910=this;var _0x214a03=[];var _0x1770b6=_0x2558bc[_0xe7c8('0x1f4')]-_0x2558bc[_0xe7c8('0x6c')]-_0x2558bc['temp'];emitCampaignSummary(_0x2558bc);if(_0x1770b6>0x0){if(_0x1770b6>this[_0xe7c8('0x22')]){_0x1770b6=this[_0xe7c8('0x22')];}_0x2558bc[_0xe7c8('0x1f5')]+=_0x1770b6;this[_0xe7c8('0x1f6')](_0x2558bc['id'],_0x1770b6,_0x2558bc[_0xe7c8('0x1f7')])[_0xe7c8('0xb0')](function(_0x21d7f7){_0x2558bc[_0xe7c8('0x1f5')]-=_0x1770b6;_0x2558bc[_0xe7c8('0x1f5')]=_0x2558bc[_0xe7c8('0x1f5')]>0x0?_0x2558bc['temp']:0x0;if(!checkContactEmpty(_0x21d7f7)){_0x2558bc[_0xe7c8('0x38')]='AVAILABLE_CONTACTS_FINISHED';logger[_0xe7c8('0x79')](_0xe7c8('0x1f8')+_0x2558bc[_0xe7c8('0x3a')]);}else{_0x2558bc[_0xe7c8('0x6c')]+=_0x21d7f7[_0xe7c8('0x8f')];_0x2558bc['message']='RUNNING';for(var _0x192cac=0x0;_0x192cac<_0x21d7f7[_0xe7c8('0x8f')];_0x192cac+=0x1){_0x2558bc[_0xe7c8('0x1f9')]+=0x1;if(_[_0xe7c8('0xa7')](_0x21d7f7[_0x192cac])||_[_0xe7c8('0xa7')](_0x21d7f7[_0x192cac][_0xe7c8('0x159')])||_[_0xe7c8('0xa7')](_0x21d7f7[_0x192cac][_0xe7c8('0x159')][_0xe7c8('0x15a')])){_0x191910['emptyContact']('[actionOriginate]\x20',_0x2558bc,_0x21d7f7[_0x192cac]);}else{_0x191910[_0xe7c8('0x1fa')](_['pick'](_0x21d7f7[_0x192cac],[_0xe7c8('0xcf'),_0xe7c8('0x1fb')]))['then'](_0x191910[_0xe7c8('0x1db')](_0x2558bc,_0x21d7f7[_0x192cac]))[_0xe7c8('0xab')](_0x191910['loggerHandler']('[actionOriginateIvr]\x20',_0x2558bc));}}}})[_0xe7c8('0xab')](loggerGetContactDialer('[getContactCampaign2]',_0x2558bc,_0x1770b6));}};Dialer[_0xe7c8('0x18')][_0xe7c8('0x145')]=function(_0x4eebc3,_0xe36315){var _0x58ee7c=this;var _0x1f3e97=[];var _0x174f93=_0xe36315>=0x1?_0xe36315:0x1;var _0x58c1a2=[];if(_0x4eebc3['dialMethod']===_0xe7c8('0x1fc')){_0x174f93=0x1;}var _0x635525=Math['floor'](_0x4eebc3['available']*_0x174f93)-_0x4eebc3[_0xe7c8('0x6c')]-_0x4eebc3[_0xe7c8('0x1f5')];emitVoiceQueueSummary(_0x4eebc3);if(_0x4eebc3['dialLimitQueue']>0x0){var _0xcf440d=_0x4eebc3[_0xe7c8('0x1fd')]-_0x4eebc3[_0xe7c8('0x6c')]-_0x4eebc3[_0xe7c8('0x99')]-_0x4eebc3[_0xe7c8('0x1f5')]-_0x4eebc3[_0xe7c8('0x4e')];if(_0x635525>_0xcf440d){_0x635525=_0xcf440d;}}if(_0x635525>0x0){if(_0x4eebc3['dialMethod']===_0xe7c8('0x1fc')){_0x635525=0x1;}if(_0x635525>this[_0xe7c8('0x22')]){_0x635525=this['maxNumberOriginate'];}_0x4eebc3[_0xe7c8('0x1f5')]+=_0x635525;for(var _0x1d6720 in this[_0xe7c8('0x20')]){if(this[_0xe7c8('0x20')][_0xe7c8('0x90')](_0x1d6720)){if(this[_0xe7c8('0x20')][_0x1d6720][_0xe7c8('0xde')]===_0xe7c8('0x1fe')&&this['agents'][_0x1d6720]['status']===_0xe7c8('0x1ff')){_0x1f3e97['push'](this[_0xe7c8('0x20')][_0x1d6720]['id']);}}}this[_0xe7c8('0xbc')](_0x4eebc3['id'],_0x1f3e97,_0x635525,_0x4eebc3['dialOrderByScheduledAt'])[_0xe7c8('0xb0')](function(_0x5c54ed){_0x4eebc3[_0xe7c8('0x1f5')]-=_0x635525;_0x4eebc3[_0xe7c8('0x1f5')]=_0x4eebc3[_0xe7c8('0x1f5')]>0x0?_0x4eebc3[_0xe7c8('0x1f5')]:0x0;if(!checkContactEmpty(_0x5c54ed)){_0x58ee7c[_0xe7c8('0xaf')](_0x4eebc3)[_0xe7c8('0xb0')](sendMessageReschedule(_0x4eebc3))[_0xe7c8('0xab')](loggerCatch(_0xe7c8('0xb1')));}else{_0x4eebc3['originated']+=_0x5c54ed[_0xe7c8('0x8f')];_0x4eebc3[_0xe7c8('0x38')]=_0x4eebc3[_0xe7c8('0x54')]==='booked'?_0xe7c8('0x15f'):_0xe7c8('0x200');for(var _0x3d3d33=0x0;_0x3d3d33<_0x5c54ed[_0xe7c8('0x8f')];_0x3d3d33+=0x1){if(_[_0xe7c8('0xa7')](_0x5c54ed[_0x3d3d33])||_[_0xe7c8('0xa7')](_0x5c54ed[_0x3d3d33][_0xe7c8('0x159')])||_['isNil'](_0x5c54ed[_0x3d3d33][_0xe7c8('0x159')][_0xe7c8('0x15a')])){_0x58ee7c[_0xe7c8('0xc6')](_0xe7c8('0x201'),_0x4eebc3,_0x5c54ed[_0x3d3d33]);}else{_0x58ee7c[_0xe7c8('0xb2')](_[_0xe7c8('0xca')](_0x5c54ed[_0x3d3d33],[_0xe7c8('0xce'),_0xe7c8('0x1fb')]))[_0xe7c8('0xb0')](_0x58ee7c[_0xe7c8('0x1db')](_0x4eebc3,_0x5c54ed[_0x3d3d33]))[_0xe7c8('0xab')](_0x58ee7c['loggerHandler'](_0xe7c8('0x201'),_0x4eebc3));}}}})[_0xe7c8('0xab')](loggerGetContactDialer(_0xe7c8('0x202'),_0x4eebc3,_0x635525));}};Dialer[_0xe7c8('0x18')]['handlePredictive']=function(_0x2acef8){var _0x4333ac=this;if(_0x2acef8['dialLimitQueue']>0x0){var _0x2446e4=_0x2acef8[_0xe7c8('0x1fd')]-_0x2acef8[_0xe7c8('0x6c')]-_0x2acef8[_0xe7c8('0x99')];if(_0x2446e4>0x0){this[_0xe7c8('0x203')](_0x2acef8);}else{loggerPredictiveCalls['info'](_0xe7c8('0x204'));}}else{this[_0xe7c8('0x203')](_0x2acef8);}};Dialer[_0xe7c8('0x18')]['tryOriginatePredictive']=function(_0x50b701){var _0x28b8f7=this;var _0x39382e=[];_0x50b701[_0xe7c8('0x6c')]+=0x1;for(var _0x479ffd in this[_0xe7c8('0x20')]){if(this[_0xe7c8('0x20')][_0xe7c8('0x90')](_0x479ffd)){if(this[_0xe7c8('0x20')][_0x479ffd]['state']==='not_inuse'&&this['agents'][_0x479ffd][_0xe7c8('0xa9')]===_0xe7c8('0x1ff')){_0x39382e['push'](this[_0xe7c8('0x20')][_0x479ffd]['id']);}}}this[_0xe7c8('0xbc')](_0x50b701['id'],_0x39382e,0x1,_0x50b701[_0xe7c8('0x1f7')])['then'](function(_0x23172f){if(!checkContactEmpty(_0x23172f)){checkContactLowerLimitOriginate(_0x50b701,0x1,0x0);_0x28b8f7['countReScheduled'](_0x50b701)[_0xe7c8('0xb0')](sendMessageReschedule(_0x50b701))[_0xe7c8('0xab')](loggerCatch(_0xe7c8('0xb1')));}else{_0x50b701['message']=_0xe7c8('0x200');if(_[_0xe7c8('0xa7')](_0x23172f[0x0])||_[_0xe7c8('0xa7')](_0x23172f[0x0][_0xe7c8('0x159')])||_[_0xe7c8('0xa7')](_0x23172f[0x0][_0xe7c8('0x159')]['phone'])){_0x28b8f7[_0xe7c8('0xc6')](_0xe7c8('0x201'),_0x50b701,_0x23172f[0x0]);}else{_0x28b8f7[_0xe7c8('0xb2')](_[_0xe7c8('0xca')](_0x23172f[0x0],[_0xe7c8('0xce'),_0xe7c8('0x1fb')]))[_0xe7c8('0xb0')](_0x28b8f7['checkContactBlack'](_0x50b701,_0x23172f[0x0]))['catch'](_0x28b8f7[_0xe7c8('0xc5')]('[actionOriginatePredictive]\x20',_0x50b701));}}})[_0xe7c8('0xab')](loggerGetContactDialer(_0xe7c8('0x205'),_0x50b701,0x1));emitVoiceQueueSummary(_0x50b701);};Dialer[_0xe7c8('0x18')][_0xe7c8('0x1cf')]=function(_0x26b960,_0x371330,_0x3c87dd,_0x1b2fac,_0x2d6855,_0x56d7ea){loggerPredictive[_0xe7c8('0x79')]('--------\x20Drop\x20Rate\x20--------');loggerPredictive[_0xe7c8('0x79')]('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',_0x26b960);loggerPredictive[_0xe7c8('0x79')](_0xe7c8('0x206'),_0x371330);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',_0x3c87dd);loggerPredictive['info']('P:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x1b2fac);loggerPredictive[_0xe7c8('0x79')](_0xe7c8('0x207'),_0x2d6855);loggerPredictive[_0xe7c8('0x79')](_0xe7c8('0x86'));return new BPromise(function(_0x1c4f02,_0x396c84){if(_0x26b960<=0x0||isNaN(_0x26b960)){return _0x396c84(msgResponse('[abandonmentRate]','Error',_0xe7c8('0x208')+_0x26b960));}if(_0x3c87dd<=0x0||isNaN(_0x3c87dd)){return _0x396c84(msgResponse(_0xe7c8('0x209'),_0xe7c8('0x43'),_0xe7c8('0x20a')+_0x3c87dd));}if(_0x1b2fac<=0x0||isNaN(_0x1b2fac)){return _0x396c84(msgResponse('[abandonmentRate]','Error',_0xe7c8('0x20b')+_0x1b2fac));}if(_0x371330<=0x0||isNaN(_0x371330)){return _0x396c84(msgResponse(_0xe7c8('0x209'),_0xe7c8('0x43'),_0xe7c8('0x20c')+_0x371330));}if(_0x2d6855<=0x0||isNaN(_0x2d6855)){return _0x396c84(msgResponse(_0xe7c8('0x209'),'Error','Amax\x20=\x20'+_0x2d6855));}_0x56d7ea=_0x56d7ea||0x0;var _0x1b5788=0x1/_0x3c87dd;var _0x4a4f4f=0x0;var _0xfd206d=0x0;var _0x2c5ef=0x0;var _0x35fcab=0x0;for(var _0x51eace=0x0;_0x2c5ef<_0x2d6855;_0x51eace+=0x1){_0xfd206d=_0x51eace/_0x371330;_0x4a4f4f=(_0x1b2fac*_0xfd206d+_0x56d7ea)/_0x1b5788;_0x2c5ef=erlangb(_0x4a4f4f,_0x26b960);_0x35fcab=_0x4a4f4f/_0x26b960*(0x1-erlangb(_0x4a4f4f,_0x26b960));}return _0x1c4f02({'erlangCalls':_0x51eace,'erlangCallToSecond':_0x371330/_0x51eace,'erlangAbandonmentRate':_0x2c5ef,'erlangBusyFactor':_0x35fcab});});};Dialer['prototype']['busyFactor']=function(_0x2d6d49,_0x3d2387,_0x76009b,_0xc71098,_0x4fb4b2,_0x4dc0d0){loggerPredictive[_0xe7c8('0x79')](_0xe7c8('0x20d'));loggerPredictive['info'](_0xe7c8('0x20e'),_0x2d6d49);loggerPredictive[_0xe7c8('0x79')](_0xe7c8('0x206'),_0x3d2387);loggerPredictive[_0xe7c8('0x79')](_0xe7c8('0x20f'),_0x76009b);loggerPredictive[_0xe7c8('0x79')](_0xe7c8('0x210'),_0xc71098);loggerPredictive[_0xe7c8('0x79')](_0xe7c8('0x211'),_0x4fb4b2);loggerPredictive[_0xe7c8('0x79')]('---------------------------');return new BPromise(function(_0x447730,_0x5d7fb9){if(_0x2d6d49<=0x0||isNaN(_0x2d6d49)){return _0x5d7fb9(msgResponse('[busyFactor]','Error','m\x20=\x20'+_0x2d6d49));}if(_0x76009b<=0x0||isNaN(_0x76009b)){return _0x5d7fb9(msgResponse(_0xe7c8('0x212'),_0xe7c8('0x43'),_0xe7c8('0x20a')+_0x76009b));}if(_0xc71098<=0x0||isNaN(_0xc71098)){return _0x5d7fb9(msgResponse('[busyFactor]',_0xe7c8('0x43'),'p\x20=\x20'+_0xc71098));}if(_0x3d2387<=0x0||isNaN(_0x3d2387)){return _0x5d7fb9(msgResponse(_0xe7c8('0x212'),'Error',_0xe7c8('0x20c')+_0x3d2387));}if(_0x4fb4b2<=0x0||isNaN(_0x4fb4b2)){return _0x5d7fb9(msgResponse('[busyFactor]',_0xe7c8('0x43'),_0xe7c8('0x213')+_0x4fb4b2));}_0x4dc0d0=_0x4dc0d0||0x0;var _0xb11217=0x1/_0x76009b;var _0x18e110=0x0;var _0x4b9bc5=0x0;var _0x2d28c2=0x0;var _0x1f2737=0x0;for(var _0x370c68=0x0;_0x1f2737<_0x4fb4b2;_0x370c68+=0x1){_0x4b9bc5=_0x370c68/_0x3d2387;_0x18e110=(_0xc71098*_0x4b9bc5+_0x4dc0d0)/_0xb11217;_0x2d28c2=erlangb(_0x18e110,_0x2d6d49);_0x1f2737=_0x18e110/_0x2d6d49*(0x1-erlangb(_0x18e110,_0x2d6d49));}return _0x447730({'erlangCalls':_0x370c68,'erlangCallToSecond':_0x3d2387/_0x370c68,'erlangAbandonmentRate':_0x2d28c2,'erlangBusyFactor':_0x1f2737});});};module[_0xe7c8('0x214')]=Dialer; \ No newline at end of file +var _0xdaf0=['originated','erlangCalls','erlangCallToSecond','erlangAbandonmentRate','erlangBusyFactor','startPredictive','startProgressive','Trunk','active','callerid','format','voice:queue:%s','voice_queue:save','ivr','campaign:ivr:%s','info','-----\x20Stats\x20Predictive\x20---','Total\x20Calls:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','predictiveIntervalTotalCalls','Answered\x20Calls:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','Dropped\x20Timeout:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','predictiveIntervalDroppedCallsTimeout','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','predictiveIntervalAvgTalktime','predictiveIntervalAvgHoldtime','Avg\x20Hold\x20Time\x20is\x20not\x20enough\x20for\x20predictive','Total\x20Calls\x20are\x20not\x20enough\x20for\x20predictive','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','handlePredictive','clearing\x20variable\x20handle\x20predictive','preview','string','\x22%s\x22\x20<%s>','\x22\x22\x20<>','error','inspect','length','hasOwnProperty','[decremetOriginate]\x20object\x20originated\x20is\x20negative','[decremetOriginate]\x20is\x20null\x20or\x20undefined','contactsRescheduled','RESCHEDULED_CONTACTS','[getContactDialer2][ReScheduled]','contacts','AVAILABLE_CONTACTS_FINISHED','[getContactDialer2][Empty]','pTalking','sendMessageOneNotActive','is\x20not\x20active','IS_DISACTIVED','[syncQueueSummary]\x20Campaign\x20Queue:\x20','is\x20disactive','[syncQueueSummary]\x20Campaign\x20Ivr:\x20','state','statedesc','endtime','starttime','prototype','clearZombieChannels','[actions]','isNil','Action','channel','catch','No\x20such\x20channel','updateOriginated','queue','countReScheduled','then','[countReScheduled]\x20','checkIsBlackList','resolve','[checkIsBlackList]\x20','checkIsBlackListIvr','averageHandleTime','avgHandleTime','[averageHandleTime]\x20','rescheduleContact','unlockContact','getContactDialer','[getContactDialer]\x20','getContactDialerIvr','getVoiceQueueRtPauses','moveContactManagedDialer','[moveContactManagedDialer]\x20','createHistory','[createHistory]\x20','[updateOriginated]\x20object\x20originated\x20is\x20negative','[updateOriginated]\x20is\x20null\x20or\x20undefined','loggerHandler','emptyContact','saveInDb','pick','ContactId','CampaignId','[emptyContact]','isSuccess','Success','SIP/%s','reachable','status','unmonitored','uniqueid','variable','amdstatus','exten','xcally-motion-dialer','dialAMDActive','value','outboundAnswerAgiCallsDay','membername','AMD','Machine','amd','[syncMachine]','HangupInAMD','[syncHangupInAMDIvr][createHistory]','[syncHangupInAMDIvr]','[syncMachineIvr][createHistory]','syncHangup','ivrAnswerCallsDay','[syncHangupIvr][createHistory]','dialQueueProject','AGI','[syncHangupIvr]','Unknow','agent','agiafterat','dialQueueProject2','dialAgiAfterHangupAgent','[syncAgentComplete][createHistory]','[syncAgentComplete]','answertime','YYYY-MM-DD\x20HH:mm:ss','queueCallerAbandonCreateState','[syncQueueCallerAbandon]\x20[Drop]','droptime','responsetime','dialQueueTimeout','Drop','dropreason','TIMEOUT','dialDropMaxRetry','add','dialDropRetryFrequency','minutes','ListId','log','CRIS\x20queueCallerAbandon\x2010','outboundDropCallsDayCallersExit','CALLEREXIT','countabandonedretry','dialAbandonedRetryFrequency','VoiceQueueId','[rescheduleContact][Abandoned]','Abandoned','[syncAgentComplete][createHistory][11]','actionid','paused','stateinterface','locked','push','idHopper','queueStatusComplete','[booked][unlockQueueStatus]','syncQueueStatusComplete','run','[Catch][Preview][syncQueueStatusComplete]','[unlock][syncQueueStatusComplete]','_rr','unlockRR','[booked][RR]','Agent:\x20','contactAgent-idHopper:\x20','[booked][RR][finaly]','[booked][unlock]','[booked][unlock2]','[unlock2][syncQueueStatusComplete]','[booked][unlock3]','checkIsTrunkReachable','isTrunkReachable','TrunkBackup','TRUNK_IS_NOT_REACHABLE','\x20trunk\x20is\x20not\x20reachable','checkIfTime','ifTime','checkIfTimeIntervals','Failure','timezones','TIMEZONE_UNKNOW','isArray','interval','content','indexOf','true','iftime\x20%s,%s','all','some','GLOBAL_INTERVAL_IS_OVERTIME','INTERVAL_IS_OVERTIME','[ifTime][promiseAll]','Timezone:\x20','checkDialMethod','progressive','power','handlePower','dialPowerLevel','Queue','method\x20not\x20recognized','launchHandleIvr','handleIvr','loggedIn','dialGlobalInterval','dialTimezone','[syncQueueSummary]','syncCampaigns','[syncCampaigns]','\x5cw{0,','pow','replace','random','match','object','originate','voiceQueue\x20is\x20undefine','Contact','phone','contact\x20is\x20undefine','NONE','\x22agi://%s/square,%s\x22','\x22%s,%s%s,,,%s\x22','dialQueueOptions','getCaller','ACTIVE','XMD-AMDINITIALSILENCE','dialAMDInitialSilence','XMD-AMDAFTERGREETINGSILENCE','dialAMDAfterGreetingSilence','XMD-AMDTOTALANALYSISTIME','XMD-AMDMINWORDLENGTH','dialAMDMinWordLength','XMD-AMDBETWEENWORDSSILENCE','dialAMDBetweenWordsSilence','XMD-AMDMAXIMUMNUMBEROFWORDS','XMD-AMDMAXIMUMWORDLENGTH','dialAMDMaximumWordLength','XMD-VOICEQUEUEID','createdAt','%s%s','toUpper','dialOriginateCallerIdName','dialRandomLastDigitCallerIdNumber','dialOriginateCallerIdNumber','XMD-ORIGINATECALLERIDNAME','originatecalleridname','originatecalleridnum','SIP/%s/%s%s','dialPrefix','trim','dialCutDigit','substring','from-sip','outboundOriginateFailureCallsDay','[originateError]:\x20%s','OriginateError','[originate][error]','getQueue','response','callProgressDetecting','[callProgressDetecting]\x20','checkRetriveMax','countcongestionretry','countnoanswerretry','countnosuchnumberretry','countdropretry','countmachineretry','countagentrejectretry','dialGlobalMaxRetry','dialNoAnswerMaxRetry','dialNoAnswerRetryFrequency','[rescheduleContact][NoAnswer]','countbusyretry','dialBusyRetryFrequency','[rescheduleContact]\x20[Busy]','dialCongestionMaxRetry','dialCongestionRetryFrequency','[rescheduleContact]\x20[Congestion]','dialNoSuchNumberMaxRetry','dialNoSuchNumberRetryFrequency','[rescheduleContact][NoSuchNumber]','[rescheduleContact][Drop]','dialAbandonedMaxRetry','dialMachineRetryFrequency','[rescheduleContact][Machine]','dialAgentRejectMaxRetry','dialAgentRejectRetryFrequency','[rescheduleContact][AgentReject]','[callProgressDetecting]','evt\x20is\x20undefine','reason','outboundNoSuchCallsDay','NoSuchNumber','countglobal','createStateFinal','reason\x200\x20no\x20such\x20number....','NoAnswer','[syncAgentComplete][createHistory][3]','stateGlobal','reason\x203\x20ringing\x20no\x20answer','Busy','[syncAgentComplete][createHistory][5]','reason\x205\x20busy','Congestion','outboundAbandonedCallsDay','reason\x2011\x20abandoned','AgentReject','[syncAgentComplete][createHistory][20]','reason\x2020\x20agentreject','[syncAgentComplete][createHistory][?]','Global','[moveContactManagedDialer][0]','contact\x20not\x20moved','dialPredictiveOptimizationPercentage','outboundDropCallsDayTimeout','round','predictiveIntervalMaxThreshold','predictiveIntervalMinThreshold','floor','[startMethodPredictive][StartProgressive]','dialPredictiveInterval','dialPredictiveOptimization','dropRate','[stopMethodPredictive][ReStartProgressive][ExceededDropDay]','Dropped\x20calls\x20day','[stopMethodPredictive][ReStartProgressive][ExceededDropInterval]','Max\x20Drop\x20','Drop\x20in\x20this\x20interval','started\x20in\x20predictive\x20at','getDataPredictive','startMethodPredictive','Predictive\x20after\x20first\x20interval','recalculate\x20predictive\x20at','Predictive\x20for\x20every\x20interval',')\x20are\x20less\x20than\x20threshold\x20(','switch\x20in\x20progressive\x20because\x20available\x20agents\x20(','abandonmentRate','busyFactor','Unknown\x20Predictive','[getDataPredictive]','check\x20failure','getDataPredictiveOld','predictiveIntervalPauses','[CatchErlangB]','outboundQueuePauses','one\x20call\x20every:','[handlePredictive]','fail\x20to\x20scheduled\x20calls','checkContactBlack','UserId','recallme','queuestatus','[unlockOriginate][syncQueueStatusComplete]','[booked][checkContactBlack][else]','Queue:\x20','actionOriginate','scheduledat','dialRecallMeTimeout','Agent','voicePause','Contact\x20updated','dialRecallInQueue','[rescheduleContact][dialRecallInQueue]','RECALLINQUEUE','[Originate][HistoryRecallClose][historyCatch]','[Originate][HistoryRecallClose]','BLACKLIST','Blacklist','[Originate][historyBlacklist]','[Originate][MoveBlacklist]','inBlackList','limitCalls','temp','dialOrderByScheduledAt','[getContactCampaign2][Empty]','RUNNING','ivrTotalCallsDays','[actionOriginate]\x20','Contact.phone','[actionOriginateIvr]\x20','[getContactCampaign2]','available','dialLimitQueue','[getContactDialer2]','[handlePredictive][limitChannel]','tryOriginatePredictive','[getContactDialerPredictive]','--------\x20Drop\x20Rate\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','---------------------------','m\x20=\x20','[abandonmentRate]','Ts\x20=\x20','p\x20=\x20','interval\x20=\x20','Amax\x20=\x20','----\x20Agent\x20Busy\x20Factor\x20----','M:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','Umin:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','[busyFactor]','Umin\x20=\x20','exports','util','lodash','bluebird','moment','md5','ioredis','dialer','booked','../../../config/logger','predictive','syncQueueSummary','../ami','redis','localhost','socket.io-emitter','../rpc/cmHopper','../rpc/cmHopperFinal','../rpc/voiceQueueRt','./action','./history','./final','./queueCallerAbandon','./hangup','env','XCALLY_IP_AGI','rrmemory','roundrobin','enqueue','tail','finally','sequence','voiceQueues','campaigns','agents','trunks','maxNumberOriginate','channels','actions','uniqueId','ivrOriginated','queueBooked','queueBookedRR','agentconnect','syncAgentConnect','bind','queuecallerabandon','syncQueueCallerAbandon','originateresponse','syncOriginateResponse','agentcomplete','syncAgentComplete','hangup','newexten','syncNewExten','varset','syncVarSet','queuemember','syncQueueMember','queuestatuscomplete','loopCampaigns','loopClearZombieChannels','isUndefined','message','name','\x20AGENTS\x20NOT\x20LOGGED','NOT_ACTIVE','Interval','INTERVAL_IS_NULL','\x20INTERVAL_IS_NULL','Intervals','isEmpty','[ifTime][Action]','Error','stringify','milliseconds','diff','seconds','type','outbound','strategy','answered','sumDuration','talking','unmanaged','abandoned','waiting','loggedInDb','dialActive','dialMethod','dialOriginateTimeout','outboundAnswerCallsDay','outboundBlacklistCallsDay','outboundBusyCallsDay','outboundDropCallsDayACS','outboundNoAnswerCallsDay','outboundReCallsDay','outboundRejectCallsDay','outboundUnknownCallsDay','predictiveIntervalAnsweredCalls','predictiveIntervalDroppedCallsCallersExit','predictiveIntervalErlangCalls','predictiveIntervalErlangCallsDroppedCalls','predictiveIntervalHitRate','predictiveIntervalMultiplicativeFactor','predictiveIntervalAvailable'];(function(_0xaa0309,_0x1c8008){var _0x5de7ce=function(_0x3aa6ae){while(--_0x3aa6ae){_0xaa0309['push'](_0xaa0309['shift']());}};_0x5de7ce(++_0x1c8008);}(_0xdaf0,0x1a3));var _0x0daf=function(_0x23c29b,_0x1e90b9){_0x23c29b=_0x23c29b-0x0;var _0x3052ac=_0xdaf0[_0x23c29b];return _0x3052ac;};'use strict';var util=require(_0x0daf('0x0'));var _=require(_0x0daf('0x1'));var BPromise=require(_0x0daf('0x2'));var uuid=require('uuid');var moment=require(_0x0daf('0x3'));var rr=require('rr');var md5=require(_0x0daf('0x4'));var Redis=require(_0x0daf('0x5'));var config=require('../../../config/environment/');var logger=require('../../../config/logger')(_0x0daf('0x6'));var loggerBooked=require('../../../config/logger')(_0x0daf('0x7'));var loggerPredictive=require(_0x0daf('0x8'))(_0x0daf('0x9'));var loggerPredictiveCalls=require('../../../config/logger')('predictiveCalls');var loggerSyncQueueSummary=require(_0x0daf('0x8'))(_0x0daf('0xa'));var ami=require(_0x0daf('0xb'));config[_0x0daf('0xc')]=_['defaults'](config[_0x0daf('0xc')],{'host':_0x0daf('0xd'),'port':0x18eb});var io=require(_0x0daf('0xe'))(new Redis(config[_0x0daf('0xc')]));var cmHopper=require(_0x0daf('0xf'));var cmHopperFinal=require(_0x0daf('0x10'));var cmHopperHistory=require('../rpc/cmHopperHistory');var cmHopperBlack=require('../rpc/cmHopperBlack');var voiceQueueRt=require(_0x0daf('0x11'));var Action=require(_0x0daf('0x12'));var History=require(_0x0daf('0x13'));var Final=require(_0x0daf('0x14'));var AgentComplete=require('./agentComplete');var QueueCallerAbandon=require(_0x0daf('0x15'));var Hangup=require(_0x0daf('0x16'));var ipAgi=process[_0x0daf('0x17')][_0x0daf('0x18')]||'127.0.0.1';var strategy={'rrmemory':_0x0daf('0x19'),'roundrobin':_0x0daf('0x1a')};var Sequence=function(){};Sequence['prototype'][_0x0daf('0x1b')]=function(_0x96f0c7){this['tail']=this[_0x0daf('0x1c')]?this[_0x0daf('0x1c')][_0x0daf('0x1d')](_0x96f0c7):_0x96f0c7();};function Dialer(_0x11d9df,_0x82d2b0){this[_0x0daf('0x1e')]=new Sequence();this['preview']=_0x82d2b0;this[_0x0daf('0x1f')]=_0x11d9df[_0x0daf('0x1f')];this[_0x0daf('0x20')]=_0x11d9df[_0x0daf('0x20')];this[_0x0daf('0x21')]=_0x11d9df['agents'];this[_0x0daf('0x22')]=_0x11d9df['trunks'];this[_0x0daf('0x23')]=config[_0x0daf('0x23')]||0x2;this[_0x0daf('0x24')]={};this[_0x0daf('0x25')]={};this['contactsId']={};this[_0x0daf('0x26')]={};this['optionPredictive']={};this['startPredictive']={};this['startProgressive']={};this[_0x0daf('0x27')]={};this[_0x0daf('0x28')]={};this[_0x0daf('0x29')]={};ami['on'](_0x0daf('0x2a'),this[_0x0daf('0x2b')][_0x0daf('0x2c')](this));ami['on'](_0x0daf('0x2d'),this[_0x0daf('0x2e')][_0x0daf('0x2c')](this));ami['on'](_0x0daf('0x2f'),this[_0x0daf('0x30')][_0x0daf('0x2c')](this));ami['on'](_0x0daf('0x31'),this[_0x0daf('0x32')]['bind'](this));ami['on']('custom:queuesummary',this[_0x0daf('0xa')][_0x0daf('0x2c')](this));ami['on'](_0x0daf('0x33'),this['syncHangup'][_0x0daf('0x2c')](this));ami['on'](_0x0daf('0x34'),this[_0x0daf('0x35')]['bind'](this));ami['on'](_0x0daf('0x36'),this[_0x0daf('0x37')]['bind'](this));ami['on'](_0x0daf('0x38'),this[_0x0daf('0x39')][_0x0daf('0x2c')](this));ami['on'](_0x0daf('0x3a'),this['syncQueueStatusComplete']['bind'](this));this[_0x0daf('0x3b')]();this[_0x0daf('0x3c')]();}function isNotNull(_0x4e599f){return _0x4e599f!==null&&!_[_0x0daf('0x3d')](_0x4e599f);}function checkIsLoggedIn(_0x362049,_0x261f30){return function(){if(_0x261f30<=0x0){_0x362049[_0x0daf('0x3e')]='AGENTS_NOT_LOGGED';throw _0x362049[_0x0daf('0x3f')]+_0x0daf('0x40');}};}function isActive(_0x1e5969){return _0x1e5969;}function checkIsActive(_0x38eeed,_0x437c07){return function(){if(!isActive(_0x437c07)){_0x38eeed['message']=_0x0daf('0x41');throw _0x38eeed[_0x0daf('0x3f')]+'\x20NOT\x20Active';}};}function checkInterval(_0x146743){return function(){if(!isNotNull(_0x146743[_0x0daf('0x42')])){_0x146743[_0x0daf('0x3e')]=_0x0daf('0x43');throw _0x146743[_0x0daf('0x3f')]+_0x0daf('0x44');}if(!isNotNull(_0x146743[_0x0daf('0x42')][_0x0daf('0x45')])){_0x146743['message']=_0x0daf('0x43');throw _0x146743[_0x0daf('0x3f')]+'\x20INTERVAL_IS_NULL';}if(!isNotNull(_[_0x0daf('0x46')](_0x146743[_0x0daf('0x42')][_0x0daf('0x45')]))){_0x146743[_0x0daf('0x3e')]=_0x0daf('0x43');throw _0x146743[_0x0daf('0x3f')]+'\x20INTERVAL_IS_NULL';}};}function msgResponse(_0x20ec31,_0x30f52f,_0x8e1f44){return{'action':_0x20ec31,'response':_0x30f52f,'message':_0x8e1f44,'stack':_0x8e1f44};}function myreject(_0x14bed6){return function(_0x3e3771){return _0x14bed6(msgResponse(_0x0daf('0x47'),_0x0daf('0x48'),JSON[_0x0daf('0x49')](_0x3e3771)));};}function getSeconds(_0x39e18e,_0x248354){var _0x201240=moment(_0x39e18e)['milliseconds'](0x0);var _0xfb7974=moment(_0x248354)[_0x0daf('0x4a')](0x0);return _0x201240[_0x0daf('0x4b')](_0xfb7974,_0x0daf('0x4c'));}function emit(_0x1299fd,_0x3cd0d7,_0x1fadf0){io['to'](_0x1299fd)['emit'](_0x3cd0d7,_0x1fadf0);}function emitVoiceQueueSummary(_0x3b68f6){if(_0x3b68f6[_0x0daf('0x4d')]===_0x0daf('0x4e')){var _0x420410={'id':_0x3b68f6['id'],'name':_0x3b68f6[_0x0daf('0x3f')],'strategy':_0x3b68f6[_0x0daf('0x4f')],'answered':_0x3b68f6[_0x0daf('0x50')],'available':_0x3b68f6['available'],'loggedIn':_0x3b68f6['loggedIn'],'pTalking':_0x3b68f6['pTalking'],'sumBillable':_0x3b68f6['sumBillable'],'sumDuration':_0x3b68f6[_0x0daf('0x51')],'sumHoldTime':_0x3b68f6['sumHoldTime']||0x0,'talking':_0x3b68f6[_0x0daf('0x52')],'total':_0x3b68f6['total'],'type':_0x3b68f6[_0x0daf('0x4d')],'unmanaged':_0x3b68f6[_0x0daf('0x53')],'abandoned':_0x3b68f6[_0x0daf('0x54')],'waiting':_0x3b68f6[_0x0daf('0x55')],'loggedInDb':_0x3b68f6[_0x0daf('0x56')],'dialActive':_0x3b68f6[_0x0daf('0x57')],'dialMethod':_0x3b68f6[_0x0daf('0x58')],'dialOriginateCallerIdName':_0x3b68f6['dialOriginateCallerIdName'],'dialOriginateCallerIdNumber':_0x3b68f6['dialOriginateCallerIdNumber'],'dialOriginateTimeout':_0x3b68f6[_0x0daf('0x59')],'dialPrefix':_0x3b68f6['dialPrefix'],'outboundAnswerAgiCallsDay':_0x3b68f6['outboundAnswerAgiCallsDay'],'outboundAnswerCallsDay':_0x3b68f6[_0x0daf('0x5a')],'outboundBlacklistCallsDay':_0x3b68f6[_0x0daf('0x5b')],'outboundBusyCallsDay':_0x3b68f6[_0x0daf('0x5c')],'outboundCongestionCallsDay':_0x3b68f6['outboundCongestionCallsDay'],'outboundDropCallsDayACS':_0x3b68f6[_0x0daf('0x5d')],'outboundDropCallsDayCallersExit':_0x3b68f6['outboundDropCallsDayCallersExit'],'outboundDropCallsDayTimeout':_0x3b68f6['outboundDropCallsDayTimeout'],'outboundNoAnswerCallsDay':_0x3b68f6[_0x0daf('0x5e')],'outboundNoSuchCallsDay':_0x3b68f6['outboundNoSuchCallsDay'],'outboundOriginateFailureCallsDay':_0x3b68f6['outboundOriginateFailureCallsDay'],'outboundReCallsDay':_0x3b68f6[_0x0daf('0x5f')],'outboundRejectCallsDay':_0x3b68f6[_0x0daf('0x60')],'outboundUnknownCallsDay':_0x3b68f6[_0x0daf('0x61')],'predictiveIntervalAnsweredCalls':_0x3b68f6[_0x0daf('0x62')],'predictiveIntervalAvgHoldtime':_0x3b68f6['predictiveIntervalAvgHoldtime'],'predictiveIntervalAvgTalktime':_0x3b68f6['predictiveIntervalAvgTalktime'],'predictiveIntervalDroppedCallsCallersExit':_0x3b68f6[_0x0daf('0x63')],'predictiveIntervalDroppedCallsTimeout':_0x3b68f6['predictiveIntervalDroppedCallsTimeout'],'predictiveIntervalErlangCalls':_0x3b68f6[_0x0daf('0x64')],'predictiveIntervalErlangCallsDroppedCalls':_0x3b68f6[_0x0daf('0x65')],'predictiveIntervalHitRate':_0x3b68f6[_0x0daf('0x66')],'predictiveIntervalMultiplicativeFactor':_0x3b68f6[_0x0daf('0x67')],'predictiveIntervalPauses':_0x3b68f6['predictiveIntervalPauses'],'predictiveIntervalAvailable':_0x3b68f6[_0x0daf('0x68')],'predictiveIntervalTotalCalls':_0x3b68f6['predictiveIntervalTotalCalls'],'message':_0x3b68f6[_0x0daf('0x3e')],'originated':_0x3b68f6[_0x0daf('0x69')],'erlangCalls':_0x3b68f6[_0x0daf('0x6a')],'erlangCallToSecond':_0x3b68f6[_0x0daf('0x6b')],'erlangAbandonmentRate':_0x3b68f6[_0x0daf('0x6c')],'erlangBusyFactor':_0x3b68f6[_0x0daf('0x6d')],'startPredictive':_0x3b68f6[_0x0daf('0x6e')],'startProgressive':_0x3b68f6[_0x0daf('0x6f')]};if(_0x3b68f6[_0x0daf('0x70')]){_0x420410[_0x0daf('0x70')]={'id':_0x3b68f6[_0x0daf('0x70')]['id'],'name':_0x3b68f6[_0x0daf('0x70')]['name'],'active':_0x3b68f6['Trunk'][_0x0daf('0x71')],'callerid':_0x3b68f6[_0x0daf('0x70')][_0x0daf('0x72')]};}if(_0x3b68f6[_0x0daf('0x42')]){_0x420410[_0x0daf('0x42')]={'id':_0x3b68f6[_0x0daf('0x42')]['id'],'name':_0x3b68f6[_0x0daf('0x42')][_0x0daf('0x3f')]};}var _0x557566=md5(JSON[_0x0daf('0x49')](_0x420410));if(_0x3b68f6[_0x0daf('0x4')]!==_0x557566){_0x3b68f6[_0x0daf('0x4')]=_0x557566;emit(util[_0x0daf('0x73')](_0x0daf('0x74'),_0x420410[_0x0daf('0x3f')]),_0x0daf('0x75'),_0x420410);}}}function emitCampaignSummary(_0x3f000d){if(_0x3f000d[_0x0daf('0x4d')]===_0x0daf('0x76')){emit(util[_0x0daf('0x73')](_0x0daf('0x77'),_0x3f000d[_0x0daf('0x3f')]),'campaign:save',_0x3f000d);}}function checkGetDataPredictive(_0x5967c0){if(isNotNull(_0x5967c0)){if(!_[_0x0daf('0x46')](_0x5967c0)){loggerPredictive[_0x0daf('0x78')](_0x0daf('0x79'));loggerPredictive['info'](_0x0daf('0x7a'),_0x5967c0[_0x0daf('0x7b')]);loggerPredictive[_0x0daf('0x78')](_0x0daf('0x7c'),_0x5967c0[_0x0daf('0x62')]);loggerPredictive[_0x0daf('0x78')](_0x0daf('0x7d'),_0x5967c0[_0x0daf('0x7e')]);loggerPredictive[_0x0daf('0x78')](_0x0daf('0x7f'),_0x5967c0[_0x0daf('0x63')]);loggerPredictive['info'](_0x0daf('0x80'),_0x5967c0['predictiveIntervalAvgHoldtime']);loggerPredictive[_0x0daf('0x78')](_0x0daf('0x81'),_0x5967c0[_0x0daf('0x82')]);loggerPredictive[_0x0daf('0x78')]('---------------------------');if(_0x5967c0[_0x0daf('0x7b')]>0x0){if(!_[_0x0daf('0x3d')](_0x5967c0[_0x0daf('0x82')])&&_0x5967c0[_0x0daf('0x82')]>0x0){return!![];}else{loggerPredictive[_0x0daf('0x78')]('Avg\x20Talk\x20Time\x20is\x20not\x20enough\x20for\x20predictive');}if(!_[_0x0daf('0x3d')](_0x5967c0[_0x0daf('0x83')])&&_0x5967c0[_0x0daf('0x83')]>0x0){return!![];}else{loggerPredictive['info'](_0x0daf('0x84'));}}else{loggerPredictive[_0x0daf('0x78')](_0x0daf('0x85'));}}else{loggerPredictive['info']('History\x20information\x20are\x20empty');}}else{loggerPredictive[_0x0daf('0x78')]('History\x20information\x20are\x20empty');}return![];}function mergeDataErlangB(_0x272dfb){return function(_0x12c2ff){loggerPredictive[_0x0daf('0x78')]('---------\x20ErlangB\x20---------');loggerPredictive['info'](_0x0daf('0x86'),_0x12c2ff['erlangCalls']);loggerPredictive[_0x0daf('0x78')](_0x0daf('0x87'),_0x12c2ff['erlangCallToSecond']);loggerPredictive[_0x0daf('0x78')]('Drop\x20Rate:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x12c2ff[_0x0daf('0x6c')]);loggerPredictive[_0x0daf('0x78')](_0x0daf('0x88'),_0x12c2ff['erlangBusyFactor']);loggerPredictive[_0x0daf('0x78')]('Drop\x20Rate:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x12c2ff[_0x0daf('0x6c')]);loggerPredictive[_0x0daf('0x78')]('---------------------------');_[_0x0daf('0x89')](_0x272dfb,_0x12c2ff);};}function getDiff(_0x2a905f){var _0x2c9688=moment()[_0x0daf('0x4a')](0x0);var _0x255316=moment(_0x2a905f)['milliseconds'](0x0);return _0x2c9688['diff'](_0x255316,'seconds');}function ifInterval(_0x91a42,_0x17fd8a){if(_[_0x0daf('0x3d')](_0x17fd8a)){return![];}if(getDiff(_0x17fd8a)<_0x91a42*0x3c){return!![];}else{return![];}}function freeVariablesPredictive(_0xa2c28a){if(isNotNull(_0xa2c28a)){if(!_[_0x0daf('0x3d')](_0xa2c28a[_0x0daf('0x6f')])){_0xa2c28a[_0x0daf('0x6f')]=undefined;loggerPredictive[_0x0daf('0x78')](_0xa2c28a['name'],'clearing\x20variable\x20start\x20progressive');}if(!_[_0x0daf('0x3d')](_0xa2c28a[_0x0daf('0x6e')])){_0xa2c28a['startPredictive']=undefined;loggerPredictive['info'](_0xa2c28a[_0x0daf('0x3f')],'clearing\x20variable\x20start\x20predictive');}if(!_['isUndefined'](_0xa2c28a[_0x0daf('0x8a')])){clearInterval(_0xa2c28a[_0x0daf('0x8a')]);_0xa2c28a[_0x0daf('0x8a')]=undefined;loggerPredictive[_0x0daf('0x78')](_0xa2c28a['name'],_0x0daf('0x8b'));}}}function erlangb(_0x27cc6f,_0x134cb6){if(_0x134cb6===0x0){return 0x0;}var _0x16961c=0x1;for(var _0x181dc0=0x1;_0x181dc0<=_0x134cb6;_0x181dc0+=0x1){_0x16961c=0x1+_0x16961c*_0x181dc0/_0x27cc6f;}return 0x1/_0x16961c;}function isVoiceQueueOutbound(_0x122359){return _0x122359==='outbound';}function isNotPreview(_0x166bbc){return _0x166bbc!==_0x0daf('0x8c');}function isCampaignIvr(_0x37e3b1){return _0x37e3b1===_0x0daf('0x76');}function getCallerId(_0x32ed90,_0x18eb6d,_0x4f6cbf){if(!_[_0x0daf('0x3d')](_0x4f6cbf)&&_0x0daf('0x8d')===typeof _0x4f6cbf&&!_[_0x0daf('0x46')](_0x4f6cbf)){if(!_['isUndefined'](_0x18eb6d)&&_0x0daf('0x8d')===typeof _0x18eb6d&&!_[_0x0daf('0x46')](_0x18eb6d)){return util[_0x0daf('0x73')]('\x22%s\x22\x20<%s>',_0x18eb6d,_0x4f6cbf);}return util[_0x0daf('0x73')](_0x0daf('0x8e'),_0x4f6cbf,_0x4f6cbf);}if(!_[_0x0daf('0x3d')](_0x32ed90)&&'string'===typeof _0x32ed90&&!_[_0x0daf('0x46')](_0x32ed90)){return _0x32ed90;}return _0x0daf('0x8f');}function loggerCatchQueueSummary(_0x20b249,_0xbbfd59){return function(_0x191acd){freeVariablesPredictive(_0xbbfd59);emitVoiceQueueSummary(_0xbbfd59);emitCampaignSummary(_0xbbfd59);loggerSyncQueueSummary[_0x0daf('0x90')](_0x20b249,util[_0x0daf('0x91')](_0x191acd,{'showHidden':![],'depth':null}));};}function loggerCatchPredictive(_0x24ec22,_0x59eebc){return function(_0x5602ca){loggerPredictive[_0x0daf('0x90')](_0x59eebc[_0x0daf('0x3f')],_0x24ec22);loggerPredictive[_0x0daf('0x90')](_0x5602ca['stack']);freeVariablesPredictive(_0x59eebc);};}function loggerCatch(_0x29095a){return function(_0x3aded7){logger[_0x0daf('0x90')](_0x29095a,util[_0x0daf('0x91')](_0x3aded7,{'showHidden':![],'depth':null}));};}function checkContactEmpty(_0x2db9e0){return _0x2db9e0&&!_[_0x0daf('0x3d')](_0x2db9e0)&&_0x2db9e0[_0x0daf('0x92')]>0x0;}function decremetOriginate(_0x912c75){if(!_['isUndefined'](_0x912c75)&&_0x912c75!==null){if(_0x912c75[_0x0daf('0x93')](_0x0daf('0x69'))){if(_0x912c75['originated']>0x0){_0x912c75[_0x0daf('0x69')]-=0x1;}else{logger['error'](_0x0daf('0x94'));}}}else{logger[_0x0daf('0x90')](_0x0daf('0x95'));}}function checkContactLowerLimitOriginate(_0x148ff4,_0x213018,_0x1268e1){if(_0x213018>_0x1268e1){for(var _0x25d11f=0x0;_0x25d11f<_0x213018-_0x1268e1;_0x25d11f+=0x1){decremetOriginate(_0x148ff4);}}}function loggerGetContactDialer(_0xd0b358,_0x40514c,_0xfee63){return function(_0x20e952){checkContactLowerLimitOriginate(_0x40514c,_0xfee63,0x0);logger[_0x0daf('0x90')](_0xd0b358,util['inspect'](_0x20e952,{'showHidden':![],'depth':null}));};}function sendMessageReschedule(_0x275658){return function(_0x82c2d7){if(isNotNull(_0x82c2d7)&&isNotNull(_0x82c2d7[0x0])){if(_0x82c2d7[0x0][_0x0daf('0x96')]>0x0){_0x275658[_0x0daf('0x3e')]=_0x0daf('0x97');logger[_0x0daf('0x78')](_0x0daf('0x98')+_0x275658['name'],_0x82c2d7[0x0][_0x0daf('0x96')],_0x0daf('0x99'));}else{_0x275658[_0x0daf('0x3e')]=_0x0daf('0x9a');logger['info'](_0x0daf('0x9b')+_0x275658[_0x0daf('0x3f')]);}}};}function notSendMessagesQueue(_0x1180f6){if(_0x1180f6['sendMessageOneNotActive']){freeVariablesPredictive(_0x1180f6);if(_0x1180f6['originated']===0x0&&_0x1180f6[_0x0daf('0x52')]===0x0&&_0x1180f6[_0x0daf('0x55')]===0x0&&(_0x1180f6[_0x0daf('0x9c')]||0x0)===0x0){_0x1180f6[_0x0daf('0x9d')]=![];_0x1180f6['available']=0x0;_0x1180f6['message']=_0x0daf('0x41');loggerSyncQueueSummary[_0x0daf('0x90')]('[syncQueueSummary]\x20Campaign\x20Queue:\x20',_0x1180f6[_0x0daf('0x3f')],_0x0daf('0x9e'));}else{_0x1180f6[_0x0daf('0x3e')]=_0x0daf('0x9f');loggerSyncQueueSummary[_0x0daf('0x90')](_0x0daf('0xa0'),_0x1180f6[_0x0daf('0x3f')],_0x0daf('0xa1'));}emitVoiceQueueSummary(_0x1180f6);}}function notSendMessagesCampaign(_0x41f120){if(_0x41f120['sendMessageOneNotActive']){if(_0x41f120[_0x0daf('0x69')]===0x0){_0x41f120[_0x0daf('0x9d')]=![];_0x41f120[_0x0daf('0x3e')]=_0x0daf('0x41');loggerSyncQueueSummary[_0x0daf('0x90')](_0x0daf('0xa2'),_0x41f120['name'],'is\x20not\x20active');}else{_0x41f120['message']='IS_DISACTIVED';loggerSyncQueueSummary['error'](_0x0daf('0xa2'),_0x41f120[_0x0daf('0x3f')],_0x0daf('0xa1'));}emitCampaignSummary(_0x41f120);}}function createObjHistory(_0x1c90fd,_0x86211c,_0x37d471,_0xb8e83,_0x2fc49d){_0x1c90fd[_0x0daf('0x3e')]=_0x37d471;var _0x20d55f=new Action(_0x1c90fd,_0x86211c);var _0x28d093=new History(_0x20d55f);_0x28d093[_0x0daf('0xa3')]=_0xb8e83;_0x28d093[_0x0daf('0xa4')]=_0x2fc49d;_0x28d093[_0x0daf('0xa5')]=_0x20d55f[_0x0daf('0xa6')];return _0x28d093;}Dialer[_0x0daf('0xa7')][_0x0daf('0x3c')]=function(){var _0x530449=this;setInterval(function(){_0x530449[_0x0daf('0xa8')](_0x530449[_0x0daf('0x26')],'[uniqueid]');_0x530449[_0x0daf('0xa8')](_0x530449[_0x0daf('0x25')],_0x0daf('0xa9'));},0x32c8);};Dialer['prototype'][_0x0daf('0xa8')]=function(_0x456ac5,_0x56e16e){var _0x5b8b95=this;for(var _0x5ce9e1 in _0x456ac5){if(_0x456ac5['hasOwnProperty'](_0x5ce9e1)){this[_0x0daf('0x1e')][_0x0daf('0x1b')](function(){if(!_[_0x0daf('0xaa')](_0x456ac5[_0x5ce9e1])){return ami[_0x0daf('0xab')]({'action':'status','channel':_0x456ac5[_0x5ce9e1][_0x0daf('0xac')]})[_0x0daf('0xad')](function(_0x3704b2){if(_0x3704b2[_0x0daf('0x3e')]===_0x0daf('0xae')){setTimeout(function(){if(_0x456ac5[_0x5ce9e1]&&_0x456ac5[_0x5ce9e1][_0x0daf('0x4d')]!==_0x0daf('0x76')){_0x5b8b95[_0x0daf('0xaf')](_0x5b8b95[_0x0daf('0x1f')][_0x456ac5[_0x5ce9e1][_0x0daf('0xb0')]]);logger['error']('[Dialer][checkChannel]',_0x56e16e,_0x5ce9e1,_0x456ac5[_0x5ce9e1][_0x0daf('0xb0')]);delete _0x456ac5[_0x5ce9e1];}if(_0x456ac5[_0x5ce9e1]&&_0x456ac5[_0x5ce9e1][_0x0daf('0x4d')]===_0x0daf('0x76')){_0x5b8b95[_0x0daf('0xaf')](_0x5b8b95[_0x0daf('0x20')][_0x456ac5[_0x5ce9e1][_0x0daf('0xb0')]]);logger['error']('[Dialer][checkChannel][ivr]',_0x56e16e,_0x5ce9e1,_0x456ac5[_0x5ce9e1][_0x0daf('0xb0')]);delete _0x456ac5[_0x5ce9e1];}},0x2328);}});}});}}};Dialer[_0x0daf('0xa7')][_0x0daf('0xb1')]=function(_0x480995){return BPromise['resolve']()[_0x0daf('0xb2')](cmHopper[_0x0daf('0xb1')](_0x480995))[_0x0daf('0xad')](loggerCatch(_0x0daf('0xb3')));};Dialer[_0x0daf('0xa7')][_0x0daf('0xb4')]=function(_0x204e66){return BPromise[_0x0daf('0xb5')]()['then'](cmHopperBlack[_0x0daf('0xb4')](_0x204e66))[_0x0daf('0xad')](loggerCatch(_0x0daf('0xb6')));};Dialer[_0x0daf('0xa7')]['checkIsBlackListIvr']=function(_0x108724){return BPromise[_0x0daf('0xb5')]()['then'](cmHopperBlack[_0x0daf('0xb7')](_0x108724))[_0x0daf('0xad')](loggerCatch('[checkIsBlackListIvr]\x20'));};Dialer[_0x0daf('0xa7')][_0x0daf('0xb8')]=function(_0xc0c785){return BPromise[_0x0daf('0xb5')]()[_0x0daf('0xb2')](cmHopperHistory[_0x0daf('0xb9')](_0xc0c785))[_0x0daf('0xad')](loggerCatch(_0x0daf('0xba')));};Dialer[_0x0daf('0xa7')][_0x0daf('0xbb')]=function(_0x2ff2ac){return BPromise['resolve']()[_0x0daf('0xb2')](cmHopper[_0x0daf('0xbb')](_0x2ff2ac))['catch'](loggerCatch('[rescheduleContact]\x20'));};Dialer[_0x0daf('0xa7')][_0x0daf('0xbc')]=function(_0x592add,_0x525e79,_0x1f1ee6){return BPromise['resolve']()[_0x0daf('0xb2')](cmHopper[_0x0daf('0xbc')](_0x592add,_0x525e79,_0x1f1ee6))['catch'](loggerCatch('[unlockContact]\x20'));};Dialer[_0x0daf('0xa7')][_0x0daf('0xbd')]=function(_0x598b42,_0x25a4ac,_0x4a7e92,_0x3584a9){return BPromise['resolve']()[_0x0daf('0xb2')](cmHopper[_0x0daf('0xbd')](_0x598b42,_0x25a4ac,_0x4a7e92,_0x3584a9))['catch'](loggerCatch(_0x0daf('0xbe')));};Dialer[_0x0daf('0xa7')][_0x0daf('0xbf')]=function(_0x852836,_0x190bb3,_0x5abb36){return BPromise['resolve']()[_0x0daf('0xb2')](cmHopper[_0x0daf('0xbf')](_0x852836,_0x190bb3,_0x5abb36))[_0x0daf('0xad')](loggerCatch('[getContactDialer]\x20'));};Dialer[_0x0daf('0xa7')][_0x0daf('0xc0')]=function(_0x30f517){return BPromise[_0x0daf('0xb5')]()[_0x0daf('0xb2')](voiceQueueRt[_0x0daf('0xc0')](_0x30f517))['catch'](loggerCatch('[getVoiceQueueRtPauses]\x20'));};Dialer[_0x0daf('0xa7')][_0x0daf('0xc1')]=function(_0x5eb298){return BPromise[_0x0daf('0xb5')]()[_0x0daf('0xb2')](cmHopper[_0x0daf('0xc1')](_0x5eb298))[_0x0daf('0xad')](loggerCatch(_0x0daf('0xc2')));};Dialer[_0x0daf('0xa7')][_0x0daf('0xc3')]=function(_0x474abd){return BPromise[_0x0daf('0xb5')]()['then'](cmHopperHistory[_0x0daf('0xc3')](_0x474abd))[_0x0daf('0xad')](loggerCatch(_0x0daf('0xc4')));};Dialer[_0x0daf('0xa7')][_0x0daf('0xaf')]=function(_0x5dcbab){if(!_[_0x0daf('0x3d')](_0x5dcbab)&&_0x5dcbab!==null){if(_0x5dcbab[_0x0daf('0x93')](_0x0daf('0x69'))){if(_0x5dcbab[_0x0daf('0x69')]>0x0){_0x5dcbab[_0x0daf('0x69')]-=0x1;}else{logger[_0x0daf('0x90')](_0x0daf('0xc5'));}}}else{logger[_0x0daf('0x90')](_0x0daf('0xc6'));}};Dialer[_0x0daf('0xa7')][_0x0daf('0xc7')]=function(_0x238795,_0x2776a8){var _0x457545=this;return function(_0x556cda){_0x457545[_0x0daf('0xaf')](_0x2776a8);logger[_0x0daf('0x90')](_0x238795,util['inspect'](_0x556cda,{'showHidden':![],'depth':null}));};};Dialer[_0x0daf('0xa7')][_0x0daf('0xc8')]=function(_0x243004,_0x2e74bd,_0x5c26c7){var _0x5be05f={'state':0x19,'statedesc':'notFound'};this[_0x0daf('0xaf')](_0x2e74bd);this[_0x0daf('0xc9')](_['merge'](_0x5be05f,_[_0x0daf('0xca')](_0x5c26c7,[_0x0daf('0xcb'),'ListId','UserId','VoiceQueueId',_0x0daf('0xcc')])),'[emptyContact][createHistory]',_0x0daf('0xcd'));logger[_0x0daf('0x90')](_0x243004);};Dialer[_0x0daf('0xa7')][_0x0daf('0xce')]=function(_0x4ea1f0){return _0x4ea1f0===_0x0daf('0xcf');};Dialer[_0x0daf('0xa7')]['isTrunkReachable']=function(_0x5ffbb0){return!_[_0x0daf('0x3d')](_0x5ffbb0)&&_0x5ffbb0&&!_[_0x0daf('0x3d')](_0x5ffbb0['name'])&&!_[_0x0daf('0x3d')](_0x5ffbb0[_0x0daf('0x71')])&&_0x5ffbb0[_0x0daf('0x71')]&&(this[_0x0daf('0x22')][util[_0x0daf('0x73')](_0x0daf('0xd0'),_0x5ffbb0[_0x0daf('0x3f')])]['status']===_0x0daf('0xd1')||this[_0x0daf('0x22')][util['format'](_0x0daf('0xd0'),_0x5ffbb0[_0x0daf('0x3f')])][_0x0daf('0xd2')]===_0x0daf('0xd3'));};Dialer[_0x0daf('0xa7')][_0x0daf('0xc9')]=function(_0x4747b2,_0x44b397,_0x507b87){this[_0x0daf('0xc3')](_0x4747b2)[_0x0daf('0xad')](loggerCatch(_0x44b397));this[_0x0daf('0xc1')](_0x4747b2)[_0x0daf('0xad')](loggerCatch(_0x507b87));};Dialer[_0x0daf('0xa7')][_0x0daf('0x37')]=function(_0x3d604b){var _0x1d8a4c=this[_0x0daf('0x26')][_0x3d604b[_0x0daf('0xd4')]];var _0x35ff2d;if(!_[_0x0daf('0xaa')](_0x3d604b)&&!_[_0x0daf('0xaa')](_0x3d604b[_0x0daf('0xd5')])&&!_[_0x0daf('0xaa')](_0x3d604b[_0x0daf('0xd5')][_0x0daf('0xd6')])&&_0x3d604b[_0x0daf('0xd7')]===_0x0daf('0xd8')&&_0x1d8a4c){if(_0x1d8a4c[_0x0daf('0x4d')]!=='ivr'&&this[_0x0daf('0x1f')][_0x1d8a4c[_0x0daf('0xb0')]][_0x0daf('0xd9')]&&_0x3d604b[_0x0daf('0xda')]==='HANGUP'){delete this['uniqueId'][_0x3d604b['uniqueid']];this[_0x0daf('0xaf')](this[_0x0daf('0x1f')][_0x1d8a4c[_0x0daf('0xb0')]]);this[_0x0daf('0x1f')][_0x1d8a4c[_0x0daf('0xb0')]][_0x0daf('0x5a')]+=0x1;this[_0x0daf('0x1f')][_0x1d8a4c[_0x0daf('0xb0')]][_0x0daf('0xdb')]+=0x1;_0x35ff2d=new Hangup(_0x1d8a4c,_0x3d604b);_0x35ff2d['state']=0x12;_0x35ff2d[_0x0daf('0xa4')]='HangupInAMD';_0x35ff2d[_0x0daf('0xdc')]=_0x0daf('0xdd');this['saveInDb'](_0x35ff2d,'[syncHangupInAMD][createHistory]','[syncHangupInAMD]');}if(_0x1d8a4c['type']!==_0x0daf('0x76')&&this['voiceQueues'][_0x1d8a4c[_0x0daf('0xb0')]][_0x0daf('0xd9')]&&_0x3d604b[_0x0daf('0xda')]==='MACHINE'){delete this[_0x0daf('0x26')][_0x3d604b['uniqueid']];this[_0x0daf('0xaf')](this[_0x0daf('0x1f')][_0x1d8a4c[_0x0daf('0xb0')]]);this[_0x0daf('0x1f')][_0x1d8a4c[_0x0daf('0xb0')]][_0x0daf('0x5a')]+=0x1;this[_0x0daf('0x1f')][_0x1d8a4c['queue']][_0x0daf('0xdb')]+=0x1;_0x35ff2d=new Hangup(_0x1d8a4c,_0x3d604b);_0x35ff2d[_0x0daf('0xa3')]=0x13;_0x35ff2d[_0x0daf('0xa4')]=_0x0daf('0xde');_0x35ff2d[_0x0daf('0xdc')]='AMD';_0x35ff2d[_0x0daf('0xdf')]=!![];this[_0x0daf('0xc9')](_0x35ff2d,'[syncMachine][createHistory]',_0x0daf('0xe0'));}if(_0x1d8a4c['type']===_0x0daf('0x76')&&this[_0x0daf('0x20')][_0x1d8a4c[_0x0daf('0xb0')]][_0x0daf('0xd9')]&&_0x3d604b[_0x0daf('0xda')]==='HANGUP'){delete this[_0x0daf('0x26')][_0x3d604b[_0x0daf('0xd4')]];this[_0x0daf('0xaf')](this[_0x0daf('0x20')][_0x1d8a4c[_0x0daf('0xb0')]]);_0x35ff2d=new Hangup(_0x1d8a4c,_0x3d604b);_0x35ff2d[_0x0daf('0xa3')]=0x12;_0x35ff2d[_0x0daf('0xa4')]=_0x0daf('0xe1');_0x35ff2d[_0x0daf('0xdc')]=_0x0daf('0xdd');this[_0x0daf('0xc9')](_0x35ff2d,_0x0daf('0xe2'),_0x0daf('0xe3'));}if(_0x1d8a4c[_0x0daf('0x4d')]==='ivr'&&this[_0x0daf('0x20')][_0x1d8a4c[_0x0daf('0xb0')]]['dialAMDActive']&&_0x3d604b['value']==='MACHINE'){delete this[_0x0daf('0x26')][_0x3d604b[_0x0daf('0xd4')]];this[_0x0daf('0xaf')](this[_0x0daf('0x20')][_0x1d8a4c[_0x0daf('0xb0')]]);_0x35ff2d=new Hangup(_0x1d8a4c,_0x3d604b);_0x35ff2d[_0x0daf('0xa3')]=0x13;_0x35ff2d[_0x0daf('0xa4')]=_0x0daf('0xde');_0x35ff2d[_0x0daf('0xdc')]=_0x0daf('0xdd');_0x35ff2d[_0x0daf('0xdf')]=!![];this[_0x0daf('0xc9')](_0x35ff2d,_0x0daf('0xe4'),'[syncMachineIvr]');}}};Dialer[_0x0daf('0xa7')][_0x0daf('0xe5')]=function(_0x4370ad){var _0x509708=this['uniqueId'][_0x4370ad[_0x0daf('0xd4')]];var _0x2c0ff1=this;var _0x5b2fc2;if(_0x509708&&_0x509708[_0x0daf('0x4d')]===_0x0daf('0x76')){delete this[_0x0daf('0x26')][_0x4370ad[_0x0daf('0xd4')]];this['updateOriginated'](this[_0x0daf('0x20')][_0x509708[_0x0daf('0xb0')]]);this[_0x0daf('0x20')][_0x509708[_0x0daf('0xb0')]][_0x0daf('0xe6')]+=0x1;_0x5b2fc2=new Hangup(_0x509708,_0x4370ad);this[_0x0daf('0xc3')](_0x5b2fc2)[_0x0daf('0xad')](loggerCatch(_0x0daf('0xe7')));this['moveContactManagedDialer'](_0x5b2fc2)[_0x0daf('0xad')](loggerCatch('[syncHangupIvr]'));}if(_0x509708&&_0x509708[_0x0daf('0x4d')]!=='ivr'&&isNotNull(this[_0x0daf('0x1f')][_0x509708[_0x0daf('0xb0')]][_0x0daf('0xe8')])){delete this['uniqueId'][_0x4370ad[_0x0daf('0xd4')]];this[_0x0daf('0xaf')](this[_0x0daf('0x1f')][_0x509708[_0x0daf('0xb0')]]);this[_0x0daf('0x1f')][_0x509708[_0x0daf('0xb0')]]['outboundAnswerCallsDay']+=0x1;this[_0x0daf('0x1f')][_0x509708[_0x0daf('0xb0')]][_0x0daf('0xdb')]+=0x1;_0x5b2fc2=new Hangup(_0x509708,_0x4370ad);_0x5b2fc2[_0x0daf('0xa3')]=0x10;_0x5b2fc2['statedesc']='AnswerAGI';_0x5b2fc2[_0x0daf('0xdc')]=_0x0daf('0xe9');this['createHistory'](_0x5b2fc2)['catch'](loggerCatch(_0x0daf('0xe7')));this[_0x0daf('0xc1')](_0x5b2fc2)[_0x0daf('0xad')](loggerCatch(_0x0daf('0xea')));}if(_0x509708&&_0x509708[_0x0daf('0x4d')]!=='ivr'&&!isNotNull(this[_0x0daf('0x1f')][_0x509708[_0x0daf('0xb0')]][_0x0daf('0xe8')])){delete this[_0x0daf('0x26')][_0x4370ad[_0x0daf('0xd4')]];this[_0x0daf('0xaf')](this[_0x0daf('0x1f')][_0x509708[_0x0daf('0xb0')]]);this['voiceQueues'][_0x509708[_0x0daf('0xb0')]][_0x0daf('0x61')]+=0x1;_0x5b2fc2=new Hangup(_0x509708,_0x4370ad);_0x5b2fc2[_0x0daf('0xa3')]=0xc;_0x5b2fc2[_0x0daf('0xa4')]=_0x4370ad['cause-txt'];_0x5b2fc2[_0x0daf('0xdc')]=_0x0daf('0xeb');this[_0x0daf('0xc3')](_0x5b2fc2)['catch'](loggerCatch('[syncHangupIvr][createHistory]'));this[_0x0daf('0xc1')](_0x5b2fc2)[_0x0daf('0xad')](loggerCatch(_0x0daf('0xea')));}};Dialer[_0x0daf('0xa7')]['syncAgentComplete']=function(_0x3d2bc8){var _0xb6219=this[_0x0daf('0x26')][_0x3d2bc8[_0x0daf('0xd4')]];var _0xd05a08=this;if(this[_0x0daf('0x1f')][_0x3d2bc8[_0x0daf('0xb0')]]){if(_0xb6219&&_0xb6219[_0x0daf('0x4d')]!==_0x0daf('0x76')){delete this['uniqueId'][_0x3d2bc8[_0x0daf('0xd4')]];this[_0x0daf('0x1f')][_0x3d2bc8[_0x0daf('0xb0')]]['outboundAnswerCallsDay']+=0x1;var _0x457119=new AgentComplete(_0xb6219,_0x3d2bc8);if(_0x3d2bc8['reason']===_0x0daf('0xec')){_0x457119[_0x0daf('0xed')]=this[_0x0daf('0x1f')][_0x3d2bc8[_0x0daf('0xb0')]][_0x0daf('0xee')]&&this[_0x0daf('0x1f')][_0x3d2bc8['queue']][_0x0daf('0xef')]?moment()[_0x0daf('0x73')]('YYYY-MM-DD\x20HH:mm:ss'):undefined;}this[_0x0daf('0xc3')](_0x457119)[_0x0daf('0xad')](loggerCatch(_0x0daf('0xf0')));this[_0x0daf('0xc1')](_0x457119)['catch'](loggerCatch(_0x0daf('0xf1')));}}};Dialer[_0x0daf('0xa7')][_0x0daf('0x2b')]=function(_0x5bab22){if(this[_0x0daf('0x1f')][_0x5bab22['queue']]){if(this[_0x0daf('0x26')][_0x5bab22[_0x0daf('0xd4')]]&&this[_0x0daf('0x26')][_0x5bab22['uniqueid']][_0x0daf('0x4d')]!==_0x0daf('0x76')){this[_0x0daf('0xaf')](this[_0x0daf('0x1f')][_0x5bab22['queue']]);this[_0x0daf('0x26')][_0x5bab22[_0x0daf('0xd4')]][_0x0daf('0xf2')]=moment()[_0x0daf('0x73')](_0x0daf('0xf3'));}}};Dialer[_0x0daf('0xa7')][_0x0daf('0xf4')]=function(_0x3bc1b5){this[_0x0daf('0xc3')](_0x3bc1b5)[_0x0daf('0xad')](loggerCatch(_0x0daf('0xf0')));this[_0x0daf('0xc1')](_0x3bc1b5)[_0x0daf('0xad')](loggerCatch(_0x0daf('0xf5')));};Dialer[_0x0daf('0xa7')][_0x0daf('0x2e')]=function(_0x30e4f2){var _0x13f309=this['uniqueId'][_0x30e4f2[_0x0daf('0xd4')]];var _0x3c434e=this;if(this[_0x0daf('0x1f')][_0x30e4f2['queue']]){if(_0x13f309&&_0x13f309[_0x0daf('0x4d')]!==_0x0daf('0x76')){delete this[_0x0daf('0x26')][_0x30e4f2[_0x0daf('0xd4')]];this[_0x0daf('0xaf')](this[_0x0daf('0x1f')][_0x30e4f2['queue']]);_0x13f309['droptime']=moment()[_0x0daf('0x73')](_0x0daf('0xf3'));var _0x437f32=new QueueCallerAbandon(_0x13f309,_0x30e4f2);if(getSeconds(_0x13f309[_0x0daf('0xf6')],_0x13f309[_0x0daf('0xf7')])>=_0x13f309[_0x0daf('0xf8')]){this[_0x0daf('0x1f')][_0x30e4f2[_0x0daf('0xb0')]][_0x0daf('0x7e')]+=0x1;this[_0x0daf('0x1f')][_0x30e4f2[_0x0daf('0xb0')]]['outboundDropCallsDayTimeout']+=0x1;this[_0x0daf('0x1f')][_0x30e4f2[_0x0daf('0xb0')]]['predictiveIntervalErlangCallsDroppedCalls']+=0x1;_0x437f32['state']=0xa;_0x437f32[_0x0daf('0xa4')]=_0x0daf('0xf9');_0x437f32[_0x0daf('0xfa')]=_0x0daf('0xfb');_0x437f32[_0x0daf('0xed')]=this[_0x0daf('0x1f')][_0x30e4f2[_0x0daf('0xb0')]]['dialQueueProject2']?moment()[_0x0daf('0x73')](_0x0daf('0xf3')):undefined;_0x437f32['countdropretry']+=0x1;if(_0x437f32['countdropretry']>=this['voiceQueues'][_0x30e4f2[_0x0daf('0xb0')]][_0x0daf('0xfc')]){this['queueCallerAbandonCreateState'](_0x437f32);}else{this['rescheduleContact']({'active':![],'countdropretry':_0x437f32['countdropretry'],'scheduledat':moment()[_0x0daf('0xfd')](this[_0x0daf('0x1f')][_0x30e4f2[_0x0daf('0xb0')]][_0x0daf('0xfe')],_0x0daf('0xff'))[_0x0daf('0x73')](_0x0daf('0xf3')),'ContactId':_0x13f309[_0x0daf('0xcb')],'ListId':_0x13f309[_0x0daf('0x100')],'VoiceQueueId':_0x13f309['VoiceQueueId']||undefined,'CampaignId':_0x13f309['CampaignId']||undefined})[_0x0daf('0xad')](loggerCatch('[rescheduleContact][Drop]'));var _0x14fa28=new History(_0x437f32);_0x14fa28[_0x0daf('0xa3')]=0xa;_0x14fa28['statedesc']='Drop';_0x14fa28[_0x0daf('0xa6')]=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');_0x14fa28[_0x0daf('0xa5')]=_0x14fa28[_0x0daf('0xa6')];console['log']('CRIS\x20evt\x2010',_0x30e4f2);console[_0x0daf('0x101')](_0x0daf('0x102'),_0x437f32);console[_0x0daf('0x101')]('CRIS\x20createHistory\x2010',_0x14fa28);this['createHistory'](_0x14fa28)[_0x0daf('0xad')](loggerCatch('[syncAgentComplete][createHistory][10]'));}}else{this[_0x0daf('0x1f')][_0x30e4f2[_0x0daf('0xb0')]][_0x0daf('0x63')]+=0x1;this[_0x0daf('0x1f')][_0x30e4f2[_0x0daf('0xb0')]][_0x0daf('0x103')]+=0x1;_0x437f32['state']=0xb;_0x437f32[_0x0daf('0xa4')]='Abandoned';_0x437f32[_0x0daf('0xfa')]=_0x0daf('0x104');_0x437f32[_0x0daf('0x105')]+=0x1;if(_0x437f32[_0x0daf('0x105')]>=this[_0x0daf('0x1f')][_0x30e4f2['queue']]['dialAbandonedMaxRetry']){this[_0x0daf('0xf4')](_0x437f32);}else{this['rescheduleContact']({'active':![],'countabandonedretry':_0x437f32[_0x0daf('0x105')],'scheduledat':moment()['add'](this['voiceQueues'][_0x30e4f2['queue']][_0x0daf('0x106')],'minutes')[_0x0daf('0x73')](_0x0daf('0xf3')),'ContactId':_0x13f309[_0x0daf('0xcb')],'ListId':_0x13f309[_0x0daf('0x100')],'VoiceQueueId':_0x13f309[_0x0daf('0x107')]||undefined,'CampaignId':_0x13f309['CampaignId']||undefined})[_0x0daf('0xad')](loggerCatch(_0x0daf('0x108')));var _0x14fa28=new History(_0x437f32);_0x14fa28[_0x0daf('0xa3')]=0xb;_0x14fa28['statedesc']=_0x0daf('0x109');_0x14fa28[_0x0daf('0xa6')]=moment()[_0x0daf('0x73')](_0x0daf('0xf3'));_0x14fa28[_0x0daf('0xa5')]=_0x14fa28[_0x0daf('0xa6')];console[_0x0daf('0x101')]('CRIS\x20createHistory\x2011',_0x14fa28);this[_0x0daf('0xc3')](_0x14fa28)[_0x0daf('0xad')](loggerCatch(_0x0daf('0x10a')));}}}}};Dialer[_0x0daf('0xa7')][_0x0daf('0x35')]=function(_0x11660d){if(this[_0x0daf('0x25')][_0x11660d[_0x0daf('0xd4')]]){this['actions'][_0x11660d['uniqueid']][_0x0daf('0xac')]=_0x11660d[_0x0daf('0xac')];}if(this['uniqueId'][_0x11660d[_0x0daf('0xd4')]]){this[_0x0daf('0x26')][_0x11660d[_0x0daf('0xd4')]][_0x0daf('0xac')]=_0x11660d[_0x0daf('0xac')];}};Dialer[_0x0daf('0xa7')][_0x0daf('0x39')]=function(_0x1d9ee4){if(strategy[this['voiceQueues'][this[_0x0daf('0x25')][_0x1d9ee4[_0x0daf('0x10b')]][_0x0daf('0xb0')]][_0x0daf('0x4f')]]==='roundrobin'){if(this[_0x0daf('0x25')][_0x1d9ee4[_0x0daf('0x10b')]]&&_[_0x0daf('0xaa')](this['actions'][_0x1d9ee4[_0x0daf('0x10b')]]['locked'])&&_0x1d9ee4['status']==='1'&&_0x1d9ee4[_0x0daf('0x10c')]==='0'){if(this[_0x0daf('0x21')][_0x1d9ee4['stateinterface']]){if(!this[_0x0daf('0x21')][_0x1d9ee4[_0x0daf('0x10d')]][_0x0daf('0x10e')]){this[_0x0daf('0x21')][_0x1d9ee4[_0x0daf('0x10d')]]['locked']=!![];this[_0x0daf('0x25')][_0x1d9ee4[_0x0daf('0x10b')]][_0x0daf('0x10e')]=!![];this['actions'][_0x1d9ee4['actionid']][_0x0daf('0x10d')]=_0x1d9ee4[_0x0daf('0x10d')];}}}}else if((strategy[this[_0x0daf('0x1f')][this[_0x0daf('0x25')][_0x1d9ee4[_0x0daf('0x10b')]][_0x0daf('0xb0')]][_0x0daf('0x4f')]]||_0x0daf('0x19'))===_0x0daf('0x19')){if(this[_0x0daf('0x25')][_0x1d9ee4[_0x0daf('0x10b')]]){if(this[_0x0daf('0x21')][_0x1d9ee4['stateinterface']]){this[_0x0daf('0x25')][_0x1d9ee4[_0x0daf('0x10b')]][_0x0daf('0x10d')]=_0x1d9ee4['stateinterface'];if(_['isNil'](this[_0x0daf('0x28')][this[_0x0daf('0x25')][_0x1d9ee4[_0x0daf('0x10b')]][_0x0daf('0xb0')]])){this[_0x0daf('0x28')][this['actions'][_0x1d9ee4[_0x0daf('0x10b')]]['queue']]=[];}this[_0x0daf('0x28')][this[_0x0daf('0x25')][_0x1d9ee4[_0x0daf('0x10b')]]['queue']][_0x0daf('0x10f')](_[_0x0daf('0x89')](_[_0x0daf('0xca')](this['actions'][_0x1d9ee4['actionid']],[_0x0daf('0x110'),_0x0daf('0x10d')]),{'status':_0x1d9ee4['status'],'paused':_0x1d9ee4[_0x0daf('0x10c')]}));}}}};function unlockQueueStatus(_0x28145c,_0x12f901){setTimeout(function(){if(_[_0x0daf('0x3d')](_0x28145c[_0x0daf('0x111')])){loggerBooked['error']('[unlockQueueStatus][undefined]',_0x12f901);}_0x28145c['queueStatusComplete']=!![];loggerBooked[_0x0daf('0x78')](_0x0daf('0x112'),_0x12f901,JSON[_0x0daf('0x49')](_[_0x0daf('0xca')](_0x28145c,[_0x0daf('0x3f'),_0x0daf('0x111')])));},0x1f3);}Dialer[_0x0daf('0xa7')][_0x0daf('0x113')]=function(_0x7e43f6){var _0x1a84ef=this;var _0x4941b6=_0x1a84ef[_0x0daf('0x1f')][_0x1a84ef[_0x0daf('0x25')][_0x7e43f6[_0x0daf('0x10b')]][_0x0daf('0xb0')]];if(strategy[this[_0x0daf('0x1f')][this[_0x0daf('0x25')][_0x7e43f6[_0x0daf('0x10b')]]['queue']][_0x0daf('0x4f')]]===_0x0daf('0x1a')){if(this[_0x0daf('0x25')][_0x7e43f6[_0x0daf('0x10b')]]&&this[_0x0daf('0x25')][_0x7e43f6[_0x0daf('0x10b')]]['stateinterface']){this[_0x0daf('0x8c')][_0x0daf('0x114')](this[_0x0daf('0x25')][_0x7e43f6[_0x0daf('0x10b')]][_0x0daf('0x110')],this['actions'][_0x7e43f6[_0x0daf('0x10b')]][_0x0daf('0x10d')])[_0x0daf('0xad')](function(_0x290652){logger[_0x0daf('0x90')](_0x0daf('0x115'),util['inspect'](_0x290652,{'showHidden':![],'depth':null}));})[_0x0daf('0x1d')](function(){_0x1a84ef[_0x0daf('0xaf')](_0x1a84ef[_0x0daf('0x1f')][_0x1a84ef[_0x0daf('0x25')][_0x7e43f6[_0x0daf('0x10b')]][_0x0daf('0xb0')]]);_0x1a84ef['agents'][_0x1a84ef[_0x0daf('0x25')][_0x7e43f6[_0x0daf('0x10b')]][_0x0daf('0x10d')]]['locked']=![];delete _0x1a84ef[_0x0daf('0x25')][_0x7e43f6[_0x0daf('0x10b')]];unlockQueueStatus(_0x4941b6);});}else{this[_0x0daf('0xaf')](this[_0x0daf('0x1f')][this[_0x0daf('0x25')][_0x7e43f6[_0x0daf('0x10b')]][_0x0daf('0xb0')]]);this[_0x0daf('0xbb')]({'active':![],'ContactId':this[_0x0daf('0x25')][_0x7e43f6['actionid']][_0x0daf('0xcb')],'ListId':this[_0x0daf('0x25')][_0x7e43f6[_0x0daf('0x10b')]][_0x0daf('0x100')],'VoiceQueueId':this[_0x0daf('0x25')][_0x7e43f6[_0x0daf('0x10b')]][_0x0daf('0x107')]||undefined,'CampaignId':this['actions'][_0x7e43f6[_0x0daf('0x10b')]]['CampaignId']||undefined})[_0x0daf('0xad')](loggerCatch(_0x0daf('0x116')));delete this[_0x0daf('0x25')][_0x7e43f6[_0x0daf('0x10b')]];unlockQueueStatus(_0x4941b6);}}else if((strategy[this[_0x0daf('0x1f')][this['actions'][_0x7e43f6[_0x0daf('0x10b')]][_0x0daf('0xb0')]]['strategy']]||'rrmemory')===_0x0daf('0x19')){var _0x4e847d;if(this[_0x0daf('0x25')][_0x7e43f6[_0x0daf('0x10b')]]&&!_[_0x0daf('0x46')](this[_0x0daf('0x28')][this[_0x0daf('0x25')][_0x7e43f6[_0x0daf('0x10b')]][_0x0daf('0xb0')]])){if(this['queueBookedRR'][_0x1a84ef[_0x0daf('0x25')][_0x7e43f6[_0x0daf('0x10b')]][_0x0daf('0xb0')]]){this['queueBookedRR'][_0x1a84ef['actions'][_0x7e43f6['actionid']][_0x0daf('0xb0')]]=this[_0x0daf('0x29')][this[_0x0daf('0x25')][_0x7e43f6[_0x0daf('0x10b')]][_0x0daf('0xb0')]]?this['queueBookedRR'][this[_0x0daf('0x25')][_0x7e43f6[_0x0daf('0x10b')]][_0x0daf('0xb0')]]:this[_0x0daf('0x28')][this[_0x0daf('0x25')][_0x7e43f6[_0x0daf('0x10b')]][_0x0daf('0xb0')]]?this[_0x0daf('0x28')][this[_0x0daf('0x25')][_0x7e43f6['actionid']][_0x0daf('0xb0')]][_0x0daf('0x117')]||0x0:0x0;}this['queueBooked'][this['actions'][_0x7e43f6[_0x0daf('0x10b')]][_0x0daf('0xb0')]][_0x0daf('0x117')]=this[_0x0daf('0x29')][this[_0x0daf('0x25')][_0x7e43f6[_0x0daf('0x10b')]][_0x0daf('0xb0')]];for(var _0x31868e=0x0;_0x31868e=0x0?!![]:![];})[_0x0daf('0xad')](myreject(_0x4efa10)));}}else{_0x3d54b9['push'](ami['Action']({'action':'command','command':util['format'](_0x0daf('0x131'),_0x1073b4,!_[_0x0daf('0x3d')](config['timezones'][_0x5b71d7])?_0x5b71d7:'')})['then'](function(_0x17873f){return _0x17873f['content'][_0x0daf('0x12f')]('true')>=0x0?!![]:![];})['catch'](myreject(_0x4efa10)));}BPromise[_0x0daf('0x132')](_0x3d54b9)[_0x0daf('0xb2')](function(_0x1cf2d8){var _0x4bb806=_[_0x0daf('0x133')](_0x1cf2d8);if(_0x4bb806){return _0x1ce0db(_0x4bb806);}else{_0x57e8dc[_0x0daf('0x3e')]=_0x470437?_0x0daf('0x134'):_0x0daf('0x135');return _0x4efa10(msgResponse(_0x0daf('0x136'),'Failure','Global:\x20'+_0x470437+'\x20'+_0x12d7ef+'\x20Interval\x20is\x20overtime:\x20'+util[_0x0daf('0x91')](_0x1073b4,{'showHidden':![],'depth':null})+_0x0daf('0x137')+_0x5b71d7));}})['catch'](function(_0x259464){return _0x4efa10(msgResponse(_0x0daf('0x127'),'Failure',JSON[_0x0daf('0x49')](_0x259464)));});});};Dialer['prototype'][_0x0daf('0x138')]=function(_0x5e0f43){var _0x1a8e3a=this;return function(){switch(_0x5e0f43[_0x0daf('0x58')]){case _0x0daf('0x139'):freeVariablesPredictive(_0x5e0f43);_0x1a8e3a['handlePower'](_0x5e0f43,0x1);break;case _0x0daf('0x13a'):freeVariablesPredictive(_0x5e0f43);_0x1a8e3a[_0x0daf('0x13b')](_0x5e0f43,_0x5e0f43[_0x0daf('0x13c')]);break;case'predictive':_0x1a8e3a['predictive'](_0x5e0f43);break;case _0x0daf('0x7'):freeVariablesPredictive(_0x5e0f43);_0x1a8e3a['handlePower'](_0x5e0f43,0x1);break;default:freeVariablesPredictive(_0x5e0f43);logger[_0x0daf('0x90')](_0x0daf('0x13d'),_0x5e0f43['name'],_0x0daf('0x13e'));}};};Dialer['prototype'][_0x0daf('0x13f')]=function(_0x4b9f0b){var _0x1fccc6=this;return function(){_0x1fccc6[_0x0daf('0x140')](_0x4b9f0b);};};Dialer[_0x0daf('0xa7')][_0x0daf('0xa')]=function(_0x32b134){var _0x388537=this;if(isNotPreview(_0x32b134[_0x0daf('0x58')])){if(isVoiceQueueOutbound(_0x32b134[_0x0daf('0x4d')])&&isActive(_0x32b134[_0x0daf('0x57')])){_0x32b134['sendMessageOneNotActive']=!![];BPromise[_0x0daf('0xb5')]()[_0x0daf('0xb2')](checkIsLoggedIn(_0x32b134,_0x32b134[_0x0daf('0x141')]))[_0x0daf('0xb2')](checkIsActive(_0x32b134,_0x32b134[_0x0daf('0x57')]))[_0x0daf('0xb2')](checkInterval(_0x32b134))[_0x0daf('0xb2')](_0x388537['checkIsTrunkReachable'](_0x32b134))['then'](_0x388537[_0x0daf('0x126')](_0x32b134[_0x0daf('0x142')],_0x32b134[_0x0daf('0x143')],_0x32b134[_0x0daf('0x3f')],_0x32b134))[_0x0daf('0xb2')](_0x388537[_0x0daf('0x128')](_0x32b134['Interval'],_0x32b134['dialTimezone'],_0x32b134['name'],_0x32b134))[_0x0daf('0xb2')](_0x388537[_0x0daf('0x138')](_0x32b134))[_0x0daf('0xad')](loggerCatchQueueSummary(_0x0daf('0x144'),_0x32b134));}else{notSendMessagesQueue(_0x32b134);}}else{freeVariablesPredictive(_0x32b134);}};Dialer[_0x0daf('0xa7')][_0x0daf('0x145')]=function(){var _0x284fcd=this;var _0xad7fad;for(var _0x16842f in this['campaigns']){if(this[_0x0daf('0x20')][_0x0daf('0x93')](_0x16842f)){_0xad7fad=this[_0x0daf('0x20')][_0x16842f];if(isCampaignIvr(_0xad7fad['type'])&&isActive(_0xad7fad[_0x0daf('0x71')])){_0xad7fad['sendMessageOneNotActive']=!![];BPromise['resolve']()[_0x0daf('0xb2')](checkIsActive(_0xad7fad,_0xad7fad[_0x0daf('0x71')]))[_0x0daf('0xb2')](checkInterval(_0xad7fad))[_0x0daf('0xb2')](_0x284fcd[_0x0daf('0x121')](_0xad7fad))[_0x0daf('0xb2')](_0x284fcd[_0x0daf('0x126')](_0xad7fad[_0x0daf('0x142')],_0xad7fad[_0x0daf('0x143')],_0xad7fad[_0x0daf('0x3f')],_0xad7fad))[_0x0daf('0xb2')](_0x284fcd['checkIfTimeIntervals'](_0xad7fad['Interval'],_0xad7fad[_0x0daf('0x143')],_0xad7fad[_0x0daf('0x3f')],_0xad7fad))[_0x0daf('0xb2')](_0x284fcd[_0x0daf('0x13f')](_0xad7fad))[_0x0daf('0xad')](loggerCatchQueueSummary(_0x0daf('0x146'),_0xad7fad));}else{notSendMessagesCampaign(_0xad7fad);}}}};function getCallerIdRandom(_0x1f4fed,_0x27fbe7){var _0x3ccf1b,_0x143bdb,_0x1c5ed8;if(_0x27fbe7<=0x0){_0x27fbe7=0x1;}_0x3ccf1b=new RegExp(_0x0daf('0x147')+_0x27fbe7+'}$');_0x143bdb=Math['pow'](0xa,_0x27fbe7-0x1);_0x1c5ed8=Math[_0x0daf('0x148')](0xa,_0x27fbe7)-0x1;return util[_0x0daf('0x73')]('%s',_[_0x0daf('0x149')](_0x1f4fed,_0x3ccf1b,_[_0x0daf('0x14a')](_0x143bdb,_0x1c5ed8)));}function extractCalleridName(_0x18de1c){var _0x40cd78=_0x18de1c['match'](/"(.*?)"/);return _0x40cd78?_0x40cd78[0x1]:_0x18de1c;}function extractCalleridNumber(_0x732617){var _0x484ecf=_0x732617[_0x0daf('0x14b')](/<(.*?)>/);return _0x484ecf?_0x484ecf[0x1]:_0x732617;}Dialer[_0x0daf('0xa7')]['actionOriginate']=function(_0x204ec1,_0x973d5a){var _0xad2965=this;var _0x4faddc=uuid['v4']();this['actions'][_0x4faddc]=new Action(_0x204ec1,_0x973d5a,_0x4faddc);return new BPromise(function(_0x502983,_0x249d72){if(_['isUndefined'](_0x204ec1)&&_0x0daf('0x14c')!==typeof _0x204ec1){return _0x249d72(msgResponse(_0x0daf('0x14d'),_0x0daf('0x129'),_0x0daf('0x14e')));}if(_['isUndefined'](_0x973d5a[_0x0daf('0x14f')]['phone'])||_0x973d5a['Contact'][_0x0daf('0x150')]===null){return _0x249d72(msgResponse(_0x0daf('0x14d'),_0x0daf('0x129'),_0x0daf('0x151')));}var _0x3976fa={'XMD-CALLERID':_0xad2965['actions'][_0x4faddc]['getCaller'](),'XMD-AGI':_0x204ec1[_0x0daf('0xe8')]?util[_0x0daf('0x73')]('\x22agi://%s/square,%s\x22',ipAgi,_0x204ec1[_0x0daf('0xe8')]):_0x0daf('0x152'),'XMD-AGIAFTER':_0x204ec1[_0x0daf('0xee')]?util[_0x0daf('0x73')](_0x0daf('0x153'),ipAgi,_0x204ec1['dialQueueProject2']):_0x0daf('0x152'),'XMD-QUEUE':_0x204ec1['type']===_0x0daf('0x4e')?util[_0x0daf('0x73')](_0x0daf('0x154'),_0x204ec1[_0x0daf('0x3f')],_0x204ec1[_0x0daf('0x155')]||'',_0x204ec1[_0x0daf('0xef')]?'c':'',_0x204ec1[_0x0daf('0xf8')]||0x3):'NONE','XMD-CONTACTID':_0x973d5a[_0x0daf('0xcb')],'XMD-CDRTYPE':_0x0daf('0x6'),'CALLERID(all)':_0xad2965['actions'][_0x4faddc][_0x0daf('0x156')](),'XMD-AMD':_0x204ec1[_0x0daf('0xd9')]?_0x0daf('0x157'):'NONE','XMD-DESTINATION':_0x0daf('0xd8')};if(_0x204ec1[_0x0daf('0xd9')]){_0x3976fa[_0x0daf('0x158')]=_0x204ec1[_0x0daf('0x159')]||0x9c4;_0x3976fa['XMD-AMDGREETING']=_0x204ec1['dialAMDGreeting']||0x5dc;_0x3976fa[_0x0daf('0x15a')]=_0x204ec1[_0x0daf('0x15b')]||0x320;_0x3976fa[_0x0daf('0x15c')]=_0x204ec1['dialAMDTotalAnalysisTime']||0x1388;_0x3976fa[_0x0daf('0x15d')]=_0x204ec1[_0x0daf('0x15e')]||0x64;_0x3976fa[_0x0daf('0x15f')]=_0x204ec1[_0x0daf('0x160')]||0x32;_0x3976fa[_0x0daf('0x161')]=_0x204ec1['dialAMDMaximumNumberOfWords']||0x3;_0x3976fa['XMD-AMDSILENCETHRESHOLD']=_0x204ec1['dialAMDSilenceThreshold']||0x100;_0x3976fa[_0x0daf('0x162')]=_0x204ec1[_0x0daf('0x163')]||0x1388;}if(_0x204ec1['type']===_0x0daf('0x4e')){_0x3976fa[_0x0daf('0x164')]=_0x973d5a[_0x0daf('0x107')];}else{_0x3976fa['XMD-CAMPAIGNID']=_0x973d5a[_0x0daf('0xcc')];}for(var _0x3730e7 in _0x973d5a[_0x0daf('0x14f')]){if(_0x973d5a[_0x0daf('0x14f')]['hasOwnProperty'](_0x3730e7)){if(isNotNull(_0x973d5a[_0x0daf('0x14f')][_0x3730e7])&&_0x3730e7!=='id'&&_0x3730e7!=='tags'&&_0x3730e7!==_0x0daf('0x165')&&_0x3730e7!=='updatedAt'){_0x3976fa[util[_0x0daf('0x73')](_0x0daf('0x166'),'XMD-',_[_0x0daf('0x167')](_0x3730e7))]=_0x973d5a[_0x0daf('0x14f')][_0x3730e7];}}}var _0x581e52=_0xad2965[_0x0daf('0x122')](_0x204ec1['Trunk'])?getCallerId(_0x204ec1[_0x0daf('0x70')][_0x0daf('0x72')],_0x204ec1[_0x0daf('0x168')],_0x204ec1[_0x0daf('0x169')]>0x0?getCallerIdRandom(_0x204ec1[_0x0daf('0x16a')],_0x204ec1[_0x0daf('0x169')]):_0x204ec1['dialOriginateCallerIdNumber']):getCallerId(_[_0x0daf('0xaa')](_0x204ec1[_0x0daf('0x123')])?_0x204ec1[_0x0daf('0x70')]['callerid']:_0x204ec1[_0x0daf('0x123')]['callerid'],_0x204ec1[_0x0daf('0x168')],_0x204ec1['dialRandomLastDigitCallerIdNumber']>0x0?getCallerIdRandom(_0x204ec1[_0x0daf('0x16a')],_0x204ec1[_0x0daf('0x169')]):_0x204ec1[_0x0daf('0x16a')]);if(_0x581e52){_0x3976fa[_0x0daf('0x16b')]=_0xad2965[_0x0daf('0x25')][_0x4faddc][_0x0daf('0x16c')]=extractCalleridName(_0x581e52);_0x3976fa['XMD-ORIGINATECALLERIDNUM']=_0xad2965['actions'][_0x4faddc][_0x0daf('0x16d')]=extractCalleridNumber(_0x581e52);}return ami['Action']({'actionid':_0x4faddc,'action':_0x0daf('0x14d'),'channel':_0xad2965[_0x0daf('0x122')](_0x204ec1[_0x0daf('0x70')])?util[_0x0daf('0x73')](_0x0daf('0x16e'),_0x204ec1[_0x0daf('0x70')][_0x0daf('0x3f')],isNotNull(_0x204ec1[_0x0daf('0x16f')])?_0x204ec1['dialPrefix'][_0x0daf('0x170')]()||'':'',_0x204ec1[_0x0daf('0x171')]>0x0?_0x973d5a[_0x0daf('0x14f')]['phone'][_0x0daf('0x172')](_0x204ec1['dialCutDigit']):_0x973d5a[_0x0daf('0x14f')][_0x0daf('0x150')]):util[_0x0daf('0x73')]('SIP/%s/%s%s',_[_0x0daf('0xaa')](_0x204ec1[_0x0daf('0x123')])?_0x204ec1['Trunk'][_0x0daf('0x3f')]:_0x204ec1[_0x0daf('0x123')][_0x0daf('0x3f')],isNotNull(_0x204ec1[_0x0daf('0x16f')])?_0x204ec1[_0x0daf('0x16f')][_0x0daf('0x170')]()||'':'',_0x204ec1['dialCutDigit']>0x0?_0x973d5a[_0x0daf('0x14f')][_0x0daf('0x150')][_0x0daf('0x172')](_0x204ec1[_0x0daf('0x171')]):_0x973d5a['Contact'][_0x0daf('0x150')]),'callerid':_0x581e52,'Exten':_0x0daf('0xd8'),'Context':_0x0daf('0x173'),'Priority':'1','variable':_0x3976fa,'timeout':(_0x204ec1[_0x0daf('0x59')]||0x1e)*0x3e8,'async':!![],'channelid':_0x4faddc})[_0x0daf('0xb2')](function(_0x391525){return _0x502983(_0x391525);})['catch'](function(_0x21f843){_0x204ec1[_0x0daf('0x174')]+=0x1;var _0x566b3a=new History(_0xad2965['actions'][_0x4faddc]);logger[_0x0daf('0x90')](util[_0x0daf('0x73')](_0x0daf('0x175'),JSON[_0x0daf('0x49')](_0x21f843)));_0x566b3a[_0x0daf('0xa3')]=0xe;_0x566b3a[_0x0daf('0xa4')]=_0x0daf('0x176');_0x566b3a[_0x0daf('0xa6')]=moment()[_0x0daf('0x73')](_0x0daf('0xf3'));_0x566b3a[_0x0daf('0xa5')]=_0x566b3a[_0x0daf('0xa6')];_0xad2965['createHistory'](_0x566b3a)[_0x0daf('0xad')](loggerCatch(_0x0daf('0x177')));_0xad2965['moveContactManagedDialer'](_0x566b3a)[_0x0daf('0xad')](loggerCatch(_0x0daf('0x177')))[_0x0daf('0x1d')](function(){delete _0xad2965[_0x0daf('0x25')][_0x4faddc];return _0x249d72(msgResponse(_0x0daf('0x14d'),'Error','originate\x20action\x20Error'));});});});};Dialer[_0x0daf('0xa7')][_0x0daf('0x30')]=function(_0x5dfbe4){var _0x2051a1=this[_0x0daf('0x25')][_0x5dfbe4[_0x0daf('0x10b')]];var _0x5a74d1=this;if(_0x2051a1){delete this['actions'][_0x5dfbe4[_0x0daf('0x10b')]];_0x2051a1['responsetime']=moment()[_0x0daf('0x73')](_0x0daf('0xf3'));var _0x16b99f=_0x2051a1[_0x0daf('0x4d')]==='ivr'?this['campaigns'][_0x2051a1[_0x0daf('0xb0')]]:this[_0x0daf('0x1f')][_0x2051a1[_0x0daf('0x178')]()];if(!this[_0x0daf('0xce')](_0x5dfbe4[_0x0daf('0x179')])){this[_0x0daf('0xaf')](_0x16b99f);return this[_0x0daf('0x17a')](_0x2051a1,_0x16b99f,_0x5dfbe4)[_0x0daf('0xb2')](function(_0xf2c67a){})[_0x0daf('0xad')](loggerCatch(_0x0daf('0x17b')));}else{this[_0x0daf('0x26')][_0x5dfbe4['uniqueid']]=_0x2051a1;}}};Dialer[_0x0daf('0xa7')][_0x0daf('0x17c')]=function(_0x1da29c,_0x1dc41a,_0x1602c5){var _0x41edf1=new History(_0x1dc41a);if(_0x41edf1['countbusyretry']+_0x41edf1[_0x0daf('0x17d')]+_0x41edf1[_0x0daf('0x17e')]+_0x41edf1[_0x0daf('0x17f')]+_0x41edf1[_0x0daf('0x180')]+_0x41edf1[_0x0daf('0x105')]+_0x41edf1[_0x0daf('0x181')]+_0x41edf1[_0x0daf('0x182')]>=_0x1602c5[_0x0daf('0x183')]-0x1){return!![];}switch(_0x1da29c){case 0x3:if(_0x41edf1['countnoanswerretry']>=_0x1602c5[_0x0daf('0x184')]-0x1){return!![];}else{this[_0x0daf('0xbb')]({'active':![],'countnoanswerretry':_0x41edf1[_0x0daf('0x17e')]+=0x1,'scheduledat':moment()['add'](_0x1602c5[_0x0daf('0x185')],'minutes')[_0x0daf('0x73')](_0x0daf('0xf3')),'ContactId':_0x41edf1[_0x0daf('0xcb')],'ListId':_0x41edf1['ListId'],'VoiceQueueId':_0x41edf1['VoiceQueueId']||undefined,'CampaignId':_0x41edf1['CampaignId']||undefined})[_0x0daf('0xad')](loggerCatch(_0x0daf('0x186')));}break;case 0x5:if(_0x41edf1[_0x0daf('0x187')]>=_0x1602c5['dialBusyMaxRetry']-0x1){return!![];}else{this[_0x0daf('0xbb')]({'active':![],'countbusyretry':_0x41edf1[_0x0daf('0x187')]+=0x1,'scheduledat':moment()[_0x0daf('0xfd')](_0x1602c5[_0x0daf('0x188')],_0x0daf('0xff'))['format'](_0x0daf('0xf3')),'ContactId':_0x41edf1['ContactId'],'ListId':_0x41edf1[_0x0daf('0x100')],'VoiceQueueId':_0x41edf1[_0x0daf('0x107')]||undefined,'CampaignId':_0x41edf1[_0x0daf('0xcc')]||undefined})['catch'](loggerCatch(_0x0daf('0x189')));}break;case 0x8:if(_0x41edf1['countcongestionretry']>=_0x1602c5[_0x0daf('0x18a')]-0x1){return!![];}else{this[_0x0daf('0xbb')]({'active':![],'countcongestionretry':_0x41edf1[_0x0daf('0x17d')]+=0x1,'scheduledat':moment()['add'](_0x1602c5[_0x0daf('0x18b')],_0x0daf('0xff'))['format'](_0x0daf('0xf3')),'ContactId':_0x41edf1[_0x0daf('0xcb')],'ListId':_0x41edf1[_0x0daf('0x100')],'VoiceQueueId':_0x41edf1[_0x0daf('0x107')]||undefined,'CampaignId':_0x41edf1['CampaignId']||undefined})[_0x0daf('0xad')](loggerCatch(_0x0daf('0x18c')));}break;case 0x0:if(_0x41edf1['countnosuchnumberretry']>=_0x1602c5[_0x0daf('0x18d')]-0x1){return!![];}else{this['rescheduleContact']({'active':![],'countnosuchnumberretry':_0x41edf1[_0x0daf('0x17f')]+=0x1,'scheduledat':moment()[_0x0daf('0xfd')](_0x1602c5[_0x0daf('0x18e')],'minutes')['format'](_0x0daf('0xf3')),'ContactId':_0x41edf1[_0x0daf('0xcb')],'ListId':_0x41edf1['ListId'],'VoiceQueueId':_0x41edf1[_0x0daf('0x107')]||undefined,'CampaignId':_0x41edf1[_0x0daf('0xcc')]||undefined})['catch'](loggerCatch(_0x0daf('0x18f')));}break;case 0xa:if(_0x41edf1[_0x0daf('0x180')]>=_0x1602c5[_0x0daf('0xfc')]-0x1){return!![];}else{this[_0x0daf('0xbb')]({'active':![],'countdropretry':_0x41edf1[_0x0daf('0x180')]+=0x1,'scheduledat':moment()['add'](_0x1602c5[_0x0daf('0xfe')],'minutes')[_0x0daf('0x73')](_0x0daf('0xf3')),'ContactId':_0x41edf1['ContactId'],'ListId':_0x41edf1[_0x0daf('0x100')],'VoiceQueueId':_0x41edf1[_0x0daf('0x107')]||undefined,'CampaignId':_0x41edf1[_0x0daf('0xcc')]||undefined})[_0x0daf('0xad')](loggerCatch(_0x0daf('0x190')));}break;case 0xb:if(_0x41edf1['countabandonedretry']>=_0x1602c5[_0x0daf('0x191')]-0x1){return!![];}else{this[_0x0daf('0xbb')]({'active':![],'countabandonedretry':_0x41edf1[_0x0daf('0x105')]+=0x1,'scheduledat':moment()['add'](_0x1602c5['dialAbandonedRetryFrequency'],_0x0daf('0xff'))[_0x0daf('0x73')](_0x0daf('0xf3')),'ContactId':_0x41edf1[_0x0daf('0xcb')],'ListId':_0x41edf1[_0x0daf('0x100')],'VoiceQueueId':_0x41edf1[_0x0daf('0x107')]||undefined,'CampaignId':_0x41edf1['CampaignId']||undefined})[_0x0daf('0xad')](loggerCatch(_0x0daf('0x108')));}break;case 0x13:if(_0x41edf1[_0x0daf('0x181')]>=_0x1602c5['dialMachineMaxRetry']-0x1){return!![];}else{this[_0x0daf('0xbb')]({'active':![],'countmachineretry':_0x41edf1[_0x0daf('0x181')]+=0x1,'scheduledat':moment()[_0x0daf('0xfd')](_0x1602c5[_0x0daf('0x192')],'minutes')[_0x0daf('0x73')](_0x0daf('0xf3')),'ContactId':_0x41edf1[_0x0daf('0xcb')],'ListId':_0x41edf1[_0x0daf('0x100')],'VoiceQueueId':_0x41edf1[_0x0daf('0x107')]||undefined,'CampaignId':_0x41edf1[_0x0daf('0xcc')]||undefined})['catch'](loggerCatch(_0x0daf('0x193')));}break;case 0x14:if(_0x41edf1['countagentrejectretry']>=_0x1602c5[_0x0daf('0x194')]-0x1){return!![];}else{this[_0x0daf('0xbb')]({'active':![],'countagentrejectretry':_0x41edf1[_0x0daf('0x182')]+=0x1,'scheduledat':moment()[_0x0daf('0xfd')](_0x1602c5[_0x0daf('0x195')],_0x0daf('0xff'))[_0x0daf('0x73')]('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0x41edf1[_0x0daf('0xcb')],'ListId':_0x41edf1[_0x0daf('0x100')],'VoiceQueueId':_0x41edf1['VoiceQueueId']||undefined,'CampaignId':_0x41edf1[_0x0daf('0xcc')]||undefined})[_0x0daf('0xad')](loggerCatch(_0x0daf('0x196')));}break;default:return!![];}};Dialer[_0x0daf('0xa7')][_0x0daf('0x17a')]=function(_0x3c6401,_0x2c044d,_0x20509e){var _0x50e4e0=this;var _0x9d66d0=new History(_0x3c6401);return new BPromise(function(_0x2f6010,_0x417599){if(_[_0x0daf('0x3d')](_0x2c044d)&&'object'!==typeof _0x2c044d){return _0x417599(msgResponse(_0x0daf('0x197'),_0x0daf('0x129'),'entity\x20is\x20undefine'));}if(_['isUndefined'](_0x20509e)&&_0x0daf('0x14c')!==typeof _0x20509e){return _0x417599(msgResponse(_0x0daf('0x197'),_0x0daf('0x129'),_0x0daf('0x198')));}switch(_0x20509e[_0x0daf('0x199')]){case'0':_0x2c044d[_0x0daf('0x19a')]+=0x1;_0x9d66d0[_0x0daf('0xa3')]=0x0;_0x9d66d0[_0x0daf('0xa4')]=_0x0daf('0x19b');_0x9d66d0[_0x0daf('0x17f')]+=0x1;_0x9d66d0[_0x0daf('0x19c')]+=0x1;_0x50e4e0[_0x0daf('0xc3')](_0x9d66d0)[_0x0daf('0xad')](loggerCatch('[syncAgentComplete][createHistory][0]'));if(_0x50e4e0['checkRetriveMax'](0x0,_0x3c6401,_0x2c044d)){if(_0x9d66d0[_0x0daf('0x187')]+_0x9d66d0[_0x0daf('0x17d')]+_0x9d66d0[_0x0daf('0x17e')]+_0x9d66d0[_0x0daf('0x17f')]+_0x9d66d0['countdropretry']+_0x9d66d0['countabandonedretry']+_0x9d66d0[_0x0daf('0x181')]+_0x9d66d0[_0x0daf('0x182')]>=_0x2c044d[_0x0daf('0x183')]){_0x50e4e0['stateGlobal'](_0x9d66d0,_0x2f6010,_0x417599,'reason\x200\x20no\x20such\x20number....');}else{_0x50e4e0[_0x0daf('0x19d')](_0x9d66d0,_0x2f6010,_0x417599,_0x0daf('0x19e'));}}break;case'3':_0x2c044d[_0x0daf('0x5e')]+=0x1;_0x9d66d0[_0x0daf('0xa3')]=0x3;_0x9d66d0[_0x0daf('0xa4')]=_0x0daf('0x19f');_0x9d66d0[_0x0daf('0x17e')]+=0x1;_0x9d66d0[_0x0daf('0x19c')]+=0x1;_0x50e4e0['createHistory'](_0x9d66d0)[_0x0daf('0xad')](loggerCatch(_0x0daf('0x1a0')));if(_0x50e4e0['checkRetriveMax'](0x3,_0x3c6401,_0x2c044d)){if(_0x9d66d0['countnoanswerretry']>=_0x2c044d[_0x0daf('0x184')]){_0x50e4e0[_0x0daf('0x19d')](_0x9d66d0,_0x2f6010,_0x417599,'reason\x203\x20ringing\x20no\x20answer');}else{_0x50e4e0[_0x0daf('0x1a1')](_0x9d66d0,_0x2f6010,_0x417599,_0x0daf('0x1a2'));}}break;case'5':_0x2c044d[_0x0daf('0x5c')]+=0x1;_0x9d66d0[_0x0daf('0xa3')]=0x5;_0x9d66d0[_0x0daf('0xa4')]=_0x0daf('0x1a3');_0x9d66d0[_0x0daf('0x187')]+=0x1;_0x9d66d0['countglobal']+=0x1;_0x50e4e0[_0x0daf('0xc3')](_0x9d66d0)['catch'](loggerCatch(_0x0daf('0x1a4')));if(_0x50e4e0[_0x0daf('0x17c')](0x5,_0x3c6401,_0x2c044d)){if(_0x9d66d0['countbusyretry']>=_0x2c044d['dialBusyMaxRetry']){_0x50e4e0[_0x0daf('0x19d')](_0x9d66d0,_0x2f6010,_0x417599,'reason\x205\x20busy');}else{_0x50e4e0['stateGlobal'](_0x9d66d0,_0x2f6010,_0x417599,_0x0daf('0x1a5'));}}break;case'8':_0x2c044d['outboundCongestionCallsDay']+=0x1;_0x9d66d0[_0x0daf('0xa3')]=0x8;_0x9d66d0[_0x0daf('0xa4')]=_0x0daf('0x1a6');_0x9d66d0[_0x0daf('0x17d')]+=0x1;_0x9d66d0[_0x0daf('0x19c')]+=0x1;_0x50e4e0[_0x0daf('0xc3')](_0x9d66d0)[_0x0daf('0xad')](loggerCatch('[syncAgentComplete][createHistory][8]'));if(_0x50e4e0['checkRetriveMax'](0x8,_0x3c6401,_0x2c044d)){if(_0x9d66d0[_0x0daf('0x17d')]>=_0x2c044d[_0x0daf('0x18a')]){_0x50e4e0['createStateFinal'](_0x9d66d0,_0x2f6010,_0x417599,'reason\x208\x20congestion');}else{_0x50e4e0['stateGlobal'](_0x9d66d0,_0x2f6010,_0x417599,'reason\x208\x20congestion');}}break;case'11':_0x2c044d[_0x0daf('0x1a7')]+=0x1;_0x9d66d0[_0x0daf('0xa3')]=0xb;_0x9d66d0[_0x0daf('0xa4')]=_0x0daf('0x109');_0x9d66d0['countabandonedretry']+=0x1;_0x9d66d0[_0x0daf('0x19c')]+=0x1;_0x50e4e0[_0x0daf('0xc3')](_0x9d66d0)[_0x0daf('0xad')](loggerCatch(_0x0daf('0x10a')));if(_0x50e4e0[_0x0daf('0x17c')](0xb,_0x3c6401,_0x2c044d)){if(_0x9d66d0[_0x0daf('0x105')]>=_0x2c044d[_0x0daf('0x191')]){_0x50e4e0['createStateFinal'](_0x9d66d0,_0x2f6010,_0x417599,_0x0daf('0x1a8'));}else{_0x50e4e0['stateGlobal'](_0x9d66d0,_0x2f6010,_0x417599,'reason\x2011\x20abandoned');}}break;case'20':_0x2c044d['outboundRejectCallsDay']+=0x1;_0x9d66d0[_0x0daf('0xa3')]=0x14;_0x9d66d0['statedesc']=_0x0daf('0x1a9');_0x9d66d0[_0x0daf('0x182')]+=0x1;_0x9d66d0['countglobal']+=0x1;_0x50e4e0[_0x0daf('0xc3')](_0x9d66d0)[_0x0daf('0xad')](loggerCatch(_0x0daf('0x1aa')));if(_0x50e4e0[_0x0daf('0x17c')](0x14,_0x3c6401,_0x2c044d)){if(_0x9d66d0[_0x0daf('0x182')]>=_0x2c044d['dialAgentRejectMaxRetry']){_0x50e4e0[_0x0daf('0x19d')](_0x9d66d0,_0x2f6010,_0x417599,_0x0daf('0x1ab'));}else{_0x50e4e0['stateGlobal'](_0x9d66d0,_0x2f6010,_0x417599,_0x0daf('0x1ab'));}}break;default:_0x2c044d['outboundUnknownCallsDay']+=0x1;_0x9d66d0[_0x0daf('0xa3')]=0xc;_0x9d66d0[_0x0daf('0xa4')]=_0x20509e[_0x0daf('0x199')];_0x50e4e0[_0x0daf('0xc3')](_0x9d66d0)['catch'](loggerCatch(_0x0daf('0x1ac')));if(_0x50e4e0[_0x0daf('0x17c')](_0x20509e[_0x0daf('0x199')],_0x3c6401,_0x2c044d)){if(_0x9d66d0[_0x0daf('0x187')]+_0x9d66d0[_0x0daf('0x17d')]+_0x9d66d0[_0x0daf('0x17e')]+_0x9d66d0[_0x0daf('0x17f')]+_0x9d66d0['countdropretry']+_0x9d66d0['countabandonedretry']+_0x9d66d0['countmachineretry']+_0x9d66d0[_0x0daf('0x182')]>=_0x2c044d[_0x0daf('0x183')]){_0x50e4e0[_0x0daf('0x1a1')](_0x9d66d0,_0x2f6010,_0x417599,_0x20509e[_0x0daf('0x199')]);}else{_0x50e4e0['createStateFinal'](_0x9d66d0,_0x2f6010,_0x417599,_0x20509e[_0x0daf('0x199')]);}}}});};Dialer['prototype'][_0x0daf('0x1a1')]=function(_0x546e1f,_0x1f1371,_0x586854,_0x42f5e1){var _0x4bc66e=new Final(_0x546e1f);_0x4bc66e[_0x0daf('0xa3')]=0xf;_0x4bc66e[_0x0daf('0xa4')]=_0x0daf('0x1ad');this[_0x0daf('0x19d')](_0x4bc66e,_0x1f1371,_0x586854,_0x42f5e1);};Dialer[_0x0daf('0xa7')][_0x0daf('0x19d')]=function(_0x43e428,_0x28ef95,_0x28252b,_0x3e108b){this[_0x0daf('0xc1')](_0x43e428)[_0x0daf('0xb2')](function(_0x418088){return _0x28ef95(msgResponse(_0x0daf('0x197'),_0x0daf('0xcf'),_0x3e108b));})[_0x0daf('0xad')](function(_0x4c6061){return _0x28252b(msgResponse(_0x0daf('0x1ae'),'Failure',_0x0daf('0x1af')));});};Dialer['prototype'][_0x0daf('0x9')]=function(_0x1a4d12){var _0x2b5a49=this;var _0x316df4=_0x1a4d12[_0x0daf('0x1b0')]/0x64;var _0x2e2153=_0x1a4d12['outboundDropCallsDayTimeout']/(_0x1a4d12[_0x0daf('0x1b1')]+_0x1a4d12[_0x0daf('0x5a')]);var _0x45c88b=Math[_0x0daf('0x1b2')](_0x1a4d12['predictiveIntervalAvailable']*(_0x1a4d12[_0x0daf('0x1b3')]/0x64));var _0x42550d=Math[_0x0daf('0x1b2')](_0x1a4d12['predictiveIntervalAvailable']*(_0x1a4d12[_0x0daf('0x1b4')]/0x64));var _0x53254f=_0x1a4d12['available']+_0x1a4d12[_0x0daf('0x52')];var _0x2d9098=Math[_0x0daf('0x1b5')](_0x1a4d12['erlangCalls']*_0x1a4d12['erlangAbandonmentRate']*_0x1a4d12[_0x0daf('0x66')]*_0x1a4d12[_0x0daf('0x67')]);if(_[_0x0daf('0x3d')](_0x1a4d12[_0x0daf('0x6f')])){if(!_[_0x0daf('0x3d')](_0x1a4d12[_0x0daf('0x6e')])){_0x1a4d12[_0x0daf('0x6e')]=undefined;loggerPredictive[_0x0daf('0x90')](_0x0daf('0x1b6'),'check\x20predictive\x20is\x20not\x20undefine');}if(!_[_0x0daf('0x3d')](_0x1a4d12[_0x0daf('0x8a')])){loggerPredictive[_0x0daf('0x90')](_0x0daf('0x1b6'),'check\x20handlePredictive\x20is\x20not\x20undefine');clearInterval(_0x1a4d12[_0x0daf('0x8a')]);_0x1a4d12['handlePredictive']=undefined;}_0x1a4d12[_0x0daf('0x6f')]=moment()['format'](_0x0daf('0xf3'));loggerPredictive['info'](_0x1a4d12[_0x0daf('0x3f')],'collection\x20data\x20in\x20progressive\x20at',_0x1a4d12[_0x0daf('0x6f')]);this[_0x0daf('0x13b')](_0x1a4d12,0x1);}else if(ifInterval(_0x1a4d12[_0x0daf('0x1b7')],_0x1a4d12[_0x0daf('0x6f')])){this['handlePower'](_0x1a4d12,0x1);loggerPredictiveCalls[_0x0daf('0x78')]('[startMethodPredictive][StartProgressive][Loop]',_0x1a4d12['startProgressive'],_0x1a4d12['name']);_0x1a4d12['erlangCalls']=0x0;_0x1a4d12['predictiveIntervalErlangCallsDroppedCalls']=0x0;}else if(_0x316df4<_0x2e2153&&_0x1a4d12[_0x0daf('0x1b8')]===_0x0daf('0x1b9')){freeVariablesPredictive(_0x1a4d12);loggerPredictive[_0x0daf('0x78')](_0x0daf('0x1ba'),_0x0daf('0x1bb'),_0x2e2153,'startProgressive',_0x1a4d12[_0x0daf('0x3f')]);}else if(_0x2d9098<_0x1a4d12['predictiveIntervalErlangCallsDroppedCalls']&&_0x1a4d12[_0x0daf('0x1b8')]===_0x0daf('0x1b9')){freeVariablesPredictive(_0x1a4d12);loggerPredictive[_0x0daf('0x78')](_0x0daf('0x1bc'),_0x0daf('0x1bd'),_0x2d9098,_0x0daf('0x1be'),_0x1a4d12['predictiveIntervalErlangCallsDroppedCalls'],'startProgressive',_0x1a4d12[_0x0daf('0x3f')]);}else if(!ifInterval(_0x1a4d12['dialPredictiveInterval'],_0x1a4d12[_0x0daf('0x6f')])&&_['isUndefined'](_0x1a4d12['startPredictive'])&&!_[_0x0daf('0x3d')](_0x1a4d12[_0x0daf('0x6f')])){_0x1a4d12[_0x0daf('0x6e')]=moment()['format'](_0x0daf('0xf3'));loggerPredictive[_0x0daf('0x78')](_0x1a4d12[_0x0daf('0x3f')],_0x0daf('0x1bf'),_0x1a4d12[_0x0daf('0x6e')]);this[_0x0daf('0xb8')](_0x1a4d12[_0x0daf('0x1b7')])['then'](this[_0x0daf('0x1c0')](_0x1a4d12))[_0x0daf('0xb2')](mergeDataErlangB(_0x1a4d12))['then'](this[_0x0daf('0x1c1')](_0x1a4d12))[_0x0daf('0xad')](loggerCatchPredictive(_0x0daf('0x1c2'),_0x1a4d12));}else if(!ifInterval(_0x1a4d12[_0x0daf('0x1b7')],_0x1a4d12[_0x0daf('0x6e')])){_0x1a4d12[_0x0daf('0x65')]=0x0;_0x1a4d12['startPredictive']=moment()[_0x0daf('0x73')]('YYYY-MM-DD\x20HH:mm:ss');loggerPredictive[_0x0daf('0x78')](_0x1a4d12[_0x0daf('0x3f')],_0x0daf('0x1c3'),_0x1a4d12['startPredictive']);clearInterval(_0x1a4d12['handlePredictive']);_0x1a4d12[_0x0daf('0x8a')]=undefined;this['averageHandleTime'](_0x1a4d12[_0x0daf('0x1b7')])[_0x0daf('0xb2')](this[_0x0daf('0x1c0')](_0x1a4d12))[_0x0daf('0xb2')](mergeDataErlangB(_0x1a4d12))[_0x0daf('0xb2')](this[_0x0daf('0x1c1')](_0x1a4d12))['catch'](loggerCatchPredictive(_0x0daf('0x1c4'),_0x1a4d12));}else if(_0x1a4d12[_0x0daf('0x68')]&&_0x53254f<_0x1a4d12[_0x0daf('0x68')]-_0x42550d){freeVariablesPredictive(_0x1a4d12);loggerPredictive[_0x0daf('0x78')](_0x1a4d12[_0x0daf('0x3f')],'switch\x20in\x20progressive\x20because\x20available\x20agents\x20(',_0x53254f,_0x0daf('0x1c5'),_0x1a4d12[_0x0daf('0x68')],'-',_0x42550d,'=',_0x1a4d12[_0x0daf('0x68')]-_0x42550d,')');}else if(_0x1a4d12[_0x0daf('0x68')]&&_0x53254f>_0x1a4d12[_0x0daf('0x68')]+_0x45c88b){freeVariablesPredictive(_0x1a4d12);loggerPredictive['info'](_0x1a4d12[_0x0daf('0x3f')],_0x0daf('0x1c6'),_0x53254f,')\x20are\x20more\x20than\x20threshold\x20(',_0x1a4d12[_0x0daf('0x68')],'+',_0x45c88b,'=',_0x1a4d12[_0x0daf('0x68')]+_0x45c88b,')');}};Dialer['prototype']['getDataPredictive']=function(_0x2d2b69){var _0x54cae3=this;return function(_0x49f8b4){return new BPromise(function(_0x20dcb8,_0x12b41f){_[_0x0daf('0x89')](_0x2d2b69,_0x49f8b4[0x0]);if(checkGetDataPredictive(_0x49f8b4[0x0])){var _0x4c4f9d=_0x2d2b69['predictiveIntervalAvailable']=_0x2d2b69[_0x0daf('0x52')]+_0x2d2b69['available'];var _0x3c8f5b=_0x2d2b69[_0x0daf('0x1b7')]*0x3c;var _0x245212=_0x49f8b4[0x0][_0x0daf('0x82')]+_0x49f8b4[0x0][_0x0daf('0x83')];var _0x110330=(_0x49f8b4[0x0][_0x0daf('0x62')]+_0x49f8b4[0x0][_0x0daf('0x7e')]+_0x49f8b4[0x0]['predictiveIntervalDroppedCallsCallersExit'])/_0x49f8b4[0x0][_0x0daf('0x7b')];_0x2d2b69[_0x0daf('0x66')]=_0x110330>0x0?_0x110330:0x1;switch(_0x2d2b69[_0x0daf('0x1b8')]){case _0x0daf('0x1b9'):var _0x3ef3c3=_0x2d2b69[_0x0daf('0x1b0')]/0x64;return _0x54cae3[_0x0daf('0x1c7')](_0x4c4f9d,_0x3c8f5b,_0x245212,_0x110330,_0x3ef3c3)[_0x0daf('0xb2')](function(_0x5bf4ca){return _0x20dcb8(_0x5bf4ca);});case'agentBusyFactor':var _0x4cc6a8=_0x2d2b69[_0x0daf('0x1b0')]/0x64;return _0x54cae3[_0x0daf('0x1c8')](_0x4c4f9d,_0x3c8f5b,_0x245212,_0x110330,_0x4cc6a8)[_0x0daf('0xb2')](function(_0x3be405){return _0x20dcb8(_0x3be405);});default:return _0x12b41f(msgResponse('[getDataPredictive]',_0x0daf('0x129'),_0x0daf('0x1c9')));}}else{return _0x12b41f(msgResponse(_0x0daf('0x1ca'),_0x0daf('0x129'),_0x0daf('0x1cb')));}});};};Dialer[_0x0daf('0xa7')][_0x0daf('0x1cc')]=function(_0x1d6384){var _0x5305ba=this;return function(_0x4477bc){return new BPromise(function(_0x58d4f9,_0x77709b){_['merge'](_0x1d6384,_0x4477bc[0x0]);if(checkGetDataPredictive(_0x4477bc[0x0])){loggerPredictive[_0x0daf('0x78')](JSON[_0x0daf('0x49')](_0x4477bc[0x0]));if(_0x1d6384[_0x0daf('0x1b8')]===_0x0daf('0x1b9')){return _0x5305ba[_0x0daf('0xc0')](_0x1d6384['id'])[_0x0daf('0xb2')](function(_0x274cd3){var _0x3e0cd0=_0x1d6384[_0x0daf('0x141')]-_0x274cd3[0x0]['outboundQueuePauses'];var _0x23e6e0=_0x1d6384['dialPredictiveInterval']*0x3c;var _0x171157=_0x4477bc[0x0][_0x0daf('0x82')]+_0x4477bc[0x0]['predictiveIntervalAvgHoldtime'];var _0x1208db=(_0x4477bc[0x0][_0x0daf('0x62')]+_0x4477bc[0x0][_0x0daf('0x7e')]+_0x4477bc[0x0]['predictiveIntervalDroppedCallsCallersExit'])/_0x4477bc[0x0][_0x0daf('0x7b')];var _0x4d9cb8=_0x1d6384['dialPredictiveOptimizationPercentage']/0x64;_0x1d6384[_0x0daf('0x1cd')]=_0x274cd3[0x0]['outboundQueuePauses']||0x0;_0x1d6384[_0x0daf('0x66')]=_0x1208db>0x0?_0x1208db:0x1;return _0x5305ba[_0x0daf('0x1c7')](_0x3e0cd0,_0x23e6e0,_0x171157,_0x1208db,_0x4d9cb8);})['then'](function(_0x227d20){return _0x58d4f9(_0x227d20);})[_0x0daf('0xad')](function(_0x24b0b4){return _0x77709b(msgResponse(_0x0daf('0x1ce'),_0x0daf('0x129'),JSON['stringify'](_0x24b0b4)));});}if(_0x1d6384[_0x0daf('0x1b8')]==='agentBusyFactor'){return _0x5305ba[_0x0daf('0xc0')](_0x1d6384['id'])['then'](function(_0x29554e){var _0x587988=_0x1d6384['loggedIn']-_0x29554e[0x0]['outboundQueuePauses'];var _0x417ffd=_0x1d6384[_0x0daf('0x1b7')]*0x3c;var _0x2d5308=_0x4477bc[0x0][_0x0daf('0x82')]+_0x4477bc[0x0]['predictiveIntervalAvgHoldtime'];var _0x5c315f=(_0x4477bc[0x0][_0x0daf('0x62')]+_0x4477bc[0x0][_0x0daf('0x7e')]+_0x4477bc[0x0][_0x0daf('0x63')])/_0x4477bc[0x0][_0x0daf('0x7b')];var _0x428e20=_0x1d6384[_0x0daf('0x1b0')]/0x64;_0x1d6384[_0x0daf('0x1cd')]=_0x29554e[0x0][_0x0daf('0x1cf')]||0x0;_0x1d6384[_0x0daf('0x66')]=_0x5c315f>0x0?_0x5c315f:0x1;return _0x5305ba[_0x0daf('0x1c8')](_0x587988,_0x417ffd,_0x2d5308,_0x5c315f,_0x428e20);})['then'](function(_0x4a7ceb){return _0x58d4f9(_0x4a7ceb);})[_0x0daf('0xad')](function(_0x1a039d){return _0x77709b(msgResponse('[CatchErlangB]',_0x0daf('0x129'),JSON[_0x0daf('0x49')](_0x1a039d)));});}}else{return _0x77709b(msgResponse(_0x0daf('0x1ca'),_0x0daf('0x129'),'check\x20failure'));}});};};Dialer[_0x0daf('0xa7')][_0x0daf('0x1c1')]=function(_0x1b79a6){var _0x42d3a5=this;return function(){var _0x205ac1=0x0;var _0x21d826=Math[_0x0daf('0x1b5')](_0x1b79a6[_0x0daf('0x6b')]*0x3e8);if(_0x21d826>0x0){_0x21d826=_0x21d826<0x64?0x64:_0x21d826;loggerPredictive[_0x0daf('0x78')](_0x1b79a6[_0x0daf('0x3f')],_0x0daf('0x1d0'),_0x21d826,'milliseconds');_0x1b79a6[_0x0daf('0x8a')]=setInterval(function(){_0x42d3a5[_0x0daf('0x8a')](_0x1b79a6);loggerPredictiveCalls[_0x0daf('0x78')](_0x0daf('0x1d1'),_0x205ac1+=0x1);},_0x21d826);}else{loggerPredictive['info'](_0x1b79a6[_0x0daf('0x3f')],_0x0daf('0x1d2'));}};};Dialer[_0x0daf('0xa7')][_0x0daf('0x1d3')]=function(_0x3b7849,_0x2d9e22){var _0x26fe24=this;return function(_0x410133){if(_['isEmpty'](_0x410133)){if(_[_0x0daf('0xaa')](_0x2d9e22[_0x0daf('0x1d4')])||!_0x2d9e22[_0x0daf('0x1d5')]){if(_0x3b7849['dialMethod']==='booked'){_0x3b7849['queueStatusComplete']=_[_0x0daf('0x3d')](_0x3b7849[_0x0daf('0x111')])?!![]:_0x3b7849[_0x0daf('0x111')];var _0x261e28=uuid['v4']();_0x26fe24[_0x0daf('0x25')][_0x261e28]=new Action(_0x3b7849,_0x2d9e22,_0x261e28);loggerBooked[_0x0daf('0x78')]('[booked][checkContactBlack]',_0x261e28,'queueStatusComplete:\x20',JSON[_0x0daf('0x49')](_0x3b7849[_0x0daf('0x111')]),'Queue:\x20',_0x3b7849[_0x0daf('0x3f')]);if(_0x3b7849['queueStatusComplete']){_0x3b7849[_0x0daf('0x111')]=![];_0x26fe24[_0x0daf('0x28')][_0x26fe24[_0x0daf('0x25')][_0x261e28]['queue']]=[];ami[_0x0daf('0xab')]({'actionid':_0x261e28,'action':_0x0daf('0x1d6'),'queue':_0x3b7849[_0x0daf('0x3f')]})[_0x0daf('0xad')](function(_0xd9be93){_0x26fe24[_0x0daf('0xaf')](_0x3b7849);_0x26fe24[_0x0daf('0xbb')]({'active':![],'ContactId':_0x26fe24['actions'][_0x261e28]['ContactId'],'ListId':_0x26fe24[_0x0daf('0x25')][_0x261e28][_0x0daf('0x100')],'VoiceQueueId':_0x26fe24[_0x0daf('0x25')][_0x261e28][_0x0daf('0x107')]||undefined,'CampaignId':_0x26fe24[_0x0daf('0x25')][_0x261e28]['CampaignId']||undefined})[_0x0daf('0xad')](loggerCatch(_0x0daf('0x1d7')));delete _0x26fe24[_0x0daf('0x25')][_0x261e28];});}else{loggerBooked[_0x0daf('0x78')](_0x0daf('0x1d8'),JSON[_0x0daf('0x49')](_0x3b7849[_0x0daf('0x111')]),_0x0daf('0x1d9'),_0x3b7849[_0x0daf('0x3f')]);_0x26fe24['updateOriginated'](_0x3b7849);_0x26fe24[_0x0daf('0xbb')]({'active':![],'ContactId':_0x26fe24[_0x0daf('0x25')][_0x261e28][_0x0daf('0xcb')],'ListId':_0x26fe24[_0x0daf('0x25')][_0x261e28][_0x0daf('0x100')],'VoiceQueueId':_0x26fe24[_0x0daf('0x25')][_0x261e28]['VoiceQueueId']||undefined,'CampaignId':_0x26fe24[_0x0daf('0x25')][_0x261e28][_0x0daf('0xcc')]||undefined})[_0x0daf('0xad')](loggerCatch(_0x0daf('0x1d7')));delete _0x26fe24['actions'][_0x261e28];}}else{return _0x26fe24[_0x0daf('0x1da')](_0x3b7849,_0x2d9e22);}}else{if(getDiff(_0x2d9e22[_0x0daf('0x1db')])<_0x3b7849[_0x0daf('0x1dc')]*0x3c){if(_0x2d9e22[_0x0daf('0x1dd')]&&!_0x2d9e22[_0x0daf('0x1dd')][_0x0daf('0x1de')]){_0x26fe24[_0x0daf('0x8c')][_0x0daf('0x114')](_0x2d9e22['id'])[_0x0daf('0x1d')](function(){_0x26fe24['updateOriginated'](_0x3b7849);});}else{_0x26fe24[_0x0daf('0xbc')]({'active':![]},_0x2d9e22['id'],0x1)[_0x0daf('0x1d')](function(){console['log'](_0x0daf('0x1df'));_0x26fe24['updateOriginated'](_0x3b7849);});}}else{_0x3b7849[_0x0daf('0x5f')]+=0x1;_0x26fe24['updateOriginated'](_0x3b7849);if(_0x3b7849[_0x0daf('0x1e0')]){_0x26fe24['rescheduleContact']({'active':![],'recallme':![],'UserId':null,'ContactId':_0x2d9e22[_0x0daf('0xcb')],'ListId':_0x2d9e22['ListId'],'VoiceQueueId':_0x2d9e22[_0x0daf('0x107')]||undefined,'CampaignId':_0x2d9e22[_0x0daf('0xcc')]||undefined})[_0x0daf('0xad')](loggerCatch(_0x0daf('0x1e1')));_0x26fe24['createHistory'](createObjHistory(_0x3b7849,_0x2d9e22,_0x0daf('0x1e2'),0x17,'RecallInQueue'))[_0x0daf('0xad')](loggerCatch('[Originate][HistoryDialRecallInQueue][historyCatch]'));}else{_0x26fe24[_0x0daf('0xc9')](createObjHistory(_0x3b7849,_0x2d9e22,'RECALLFAILEDTIMEOUT',0x16,'RecallFailedTimeout'),_0x0daf('0x1e3'),_0x0daf('0x1e4'));}}}}else{_0x3b7849[_0x0daf('0x5b')]+=0x1;_0x26fe24[_0x0daf('0xc9')](createObjHistory(_0x3b7849,_0x2d9e22,_0x0daf('0x1e5'),0xd,_0x0daf('0x1e6')),_0x0daf('0x1e7'),_0x0daf('0x1e8'));throw _0x0daf('0x1e9');}};};Dialer[_0x0daf('0xa7')][_0x0daf('0x140')]=function(_0x3a40c5){var _0x5079ba=this;var _0x3b398b=[];var _0x433cd9=_0x3a40c5[_0x0daf('0x1ea')]-_0x3a40c5['originated']-_0x3a40c5['temp'];emitCampaignSummary(_0x3a40c5);if(_0x433cd9>0x0){if(_0x433cd9>this['maxNumberOriginate']){_0x433cd9=this[_0x0daf('0x23')];}_0x3a40c5[_0x0daf('0x1eb')]+=_0x433cd9;this[_0x0daf('0xbf')](_0x3a40c5['id'],_0x433cd9,_0x3a40c5[_0x0daf('0x1ec')])[_0x0daf('0xb2')](function(_0x39fb7a){_0x3a40c5[_0x0daf('0x1eb')]-=_0x433cd9;_0x3a40c5[_0x0daf('0x1eb')]=_0x3a40c5['temp']>0x0?_0x3a40c5[_0x0daf('0x1eb')]:0x0;if(!checkContactEmpty(_0x39fb7a)){_0x3a40c5['message']='AVAILABLE_CONTACTS_FINISHED';logger['info'](_0x0daf('0x1ed')+_0x3a40c5[_0x0daf('0x3f')]);}else{_0x3a40c5['originated']+=_0x39fb7a[_0x0daf('0x92')];_0x3a40c5['message']=_0x0daf('0x1ee');for(var _0x599e3c=0x0;_0x599e3c<_0x39fb7a[_0x0daf('0x92')];_0x599e3c+=0x1){_0x3a40c5[_0x0daf('0x1ef')]+=0x1;if(_[_0x0daf('0xaa')](_0x39fb7a[_0x599e3c])||_[_0x0daf('0xaa')](_0x39fb7a[_0x599e3c][_0x0daf('0x14f')])||_[_0x0daf('0xaa')](_0x39fb7a[_0x599e3c]['Contact']['phone'])){_0x5079ba[_0x0daf('0xc8')](_0x0daf('0x1f0'),_0x3a40c5,_0x39fb7a[_0x599e3c]);}else{_0x5079ba[_0x0daf('0xb7')](_[_0x0daf('0xca')](_0x39fb7a[_0x599e3c],[_0x0daf('0xcc'),_0x0daf('0x1f1')]))['then'](_0x5079ba[_0x0daf('0x1d3')](_0x3a40c5,_0x39fb7a[_0x599e3c]))[_0x0daf('0xad')](_0x5079ba['loggerHandler'](_0x0daf('0x1f2'),_0x3a40c5));}}}})[_0x0daf('0xad')](loggerGetContactDialer(_0x0daf('0x1f3'),_0x3a40c5,_0x433cd9));}};Dialer['prototype']['handlePower']=function(_0x442db4,_0xb22fa4){var _0x5e0357=this;var _0x526c57=[];var _0x2b90af=_0xb22fa4>=0x1?_0xb22fa4:0x1;var _0x4702dd=[];if(_0x442db4[_0x0daf('0x58')]===_0x0daf('0x7')){_0x2b90af=0x1;}var _0x325f9f=Math[_0x0daf('0x1b5')](_0x442db4[_0x0daf('0x1f4')]*_0x2b90af)-_0x442db4[_0x0daf('0x69')]-_0x442db4[_0x0daf('0x1eb')];emitVoiceQueueSummary(_0x442db4);if(_0x442db4[_0x0daf('0x1f5')]>0x0){var _0x4c94f2=_0x442db4['dialLimitQueue']-_0x442db4['originated']-_0x442db4[_0x0daf('0x52')]-_0x442db4[_0x0daf('0x1eb')]-_0x442db4['pTalking'];if(_0x325f9f>_0x4c94f2){_0x325f9f=_0x4c94f2;}}if(_0x325f9f>0x0){if(_0x442db4['dialMethod']==='booked'){_0x325f9f=0x1;}if(_0x325f9f>this['maxNumberOriginate']){_0x325f9f=this['maxNumberOriginate'];}_0x442db4['temp']+=_0x325f9f;for(var _0x229f07 in this[_0x0daf('0x21')]){if(this['agents'][_0x0daf('0x93')](_0x229f07)){if(this[_0x0daf('0x21')][_0x229f07][_0x0daf('0xa3')]==='not_inuse'&&this[_0x0daf('0x21')][_0x229f07][_0x0daf('0xd2')]===_0x0daf('0xd1')){_0x526c57[_0x0daf('0x10f')](this['agents'][_0x229f07]['id']);}}}this[_0x0daf('0xbd')](_0x442db4['id'],_0x526c57,_0x325f9f,_0x442db4['dialOrderByScheduledAt'])[_0x0daf('0xb2')](function(_0x150d0e){_0x442db4[_0x0daf('0x1eb')]-=_0x325f9f;_0x442db4['temp']=_0x442db4['temp']>0x0?_0x442db4[_0x0daf('0x1eb')]:0x0;if(!checkContactEmpty(_0x150d0e)){_0x5e0357[_0x0daf('0xb1')](_0x442db4)[_0x0daf('0xb2')](sendMessageReschedule(_0x442db4))['catch'](loggerCatch(_0x0daf('0xb3')));}else{_0x442db4[_0x0daf('0x69')]+=_0x150d0e['length'];_0x442db4[_0x0daf('0x3e')]=_0x442db4[_0x0daf('0x58')]==='booked'?_0x0daf('0x157'):_0x0daf('0x1ee');for(var _0x27b170=0x0;_0x27b170<_0x150d0e[_0x0daf('0x92')];_0x27b170+=0x1){if(_['isNil'](_0x150d0e[_0x27b170])||_[_0x0daf('0xaa')](_0x150d0e[_0x27b170][_0x0daf('0x14f')])||_[_0x0daf('0xaa')](_0x150d0e[_0x27b170][_0x0daf('0x14f')][_0x0daf('0x150')])){_0x5e0357[_0x0daf('0xc8')](_0x0daf('0x1f0'),_0x442db4,_0x150d0e[_0x27b170]);}else{_0x5e0357[_0x0daf('0xb4')](_['pick'](_0x150d0e[_0x27b170],[_0x0daf('0x107'),_0x0daf('0x1f1')]))[_0x0daf('0xb2')](_0x5e0357['checkContactBlack'](_0x442db4,_0x150d0e[_0x27b170]))[_0x0daf('0xad')](_0x5e0357['loggerHandler'](_0x0daf('0x1f0'),_0x442db4));}}}})[_0x0daf('0xad')](loggerGetContactDialer(_0x0daf('0x1f6'),_0x442db4,_0x325f9f));}};Dialer['prototype'][_0x0daf('0x8a')]=function(_0x29b11c){var _0x5ebe69=this;if(_0x29b11c[_0x0daf('0x1f5')]>0x0){var _0x63999c=_0x29b11c[_0x0daf('0x1f5')]-_0x29b11c[_0x0daf('0x69')]-_0x29b11c[_0x0daf('0x52')];if(_0x63999c>0x0){this['tryOriginatePredictive'](_0x29b11c);}else{loggerPredictiveCalls[_0x0daf('0x78')](_0x0daf('0x1f7'));}}else{this[_0x0daf('0x1f8')](_0x29b11c);}};Dialer[_0x0daf('0xa7')][_0x0daf('0x1f8')]=function(_0x1fa4fb){var _0x54769c=this;var _0x26a065=[];_0x1fa4fb['originated']+=0x1;for(var _0x4864f6 in this[_0x0daf('0x21')]){if(this[_0x0daf('0x21')][_0x0daf('0x93')](_0x4864f6)){if(this[_0x0daf('0x21')][_0x4864f6][_0x0daf('0xa3')]==='not_inuse'&&this[_0x0daf('0x21')][_0x4864f6][_0x0daf('0xd2')]==='reachable'){_0x26a065[_0x0daf('0x10f')](this[_0x0daf('0x21')][_0x4864f6]['id']);}}}this['getContactDialer'](_0x1fa4fb['id'],_0x26a065,0x1,_0x1fa4fb['dialOrderByScheduledAt'])['then'](function(_0x5d04c2){if(!checkContactEmpty(_0x5d04c2)){checkContactLowerLimitOriginate(_0x1fa4fb,0x1,0x0);_0x54769c[_0x0daf('0xb1')](_0x1fa4fb)[_0x0daf('0xb2')](sendMessageReschedule(_0x1fa4fb))[_0x0daf('0xad')](loggerCatch(_0x0daf('0xb3')));}else{_0x1fa4fb['message']=_0x0daf('0x1ee');if(_[_0x0daf('0xaa')](_0x5d04c2[0x0])||_[_0x0daf('0xaa')](_0x5d04c2[0x0]['Contact'])||_[_0x0daf('0xaa')](_0x5d04c2[0x0][_0x0daf('0x14f')][_0x0daf('0x150')])){_0x54769c[_0x0daf('0xc8')](_0x0daf('0x1f0'),_0x1fa4fb,_0x5d04c2[0x0]);}else{_0x54769c['checkIsBlackList'](_[_0x0daf('0xca')](_0x5d04c2[0x0],[_0x0daf('0x107'),_0x0daf('0x1f1')]))['then'](_0x54769c[_0x0daf('0x1d3')](_0x1fa4fb,_0x5d04c2[0x0]))['catch'](_0x54769c['loggerHandler']('[actionOriginatePredictive]\x20',_0x1fa4fb));}}})[_0x0daf('0xad')](loggerGetContactDialer(_0x0daf('0x1f9'),_0x1fa4fb,0x1));emitVoiceQueueSummary(_0x1fa4fb);};Dialer[_0x0daf('0xa7')][_0x0daf('0x1c7')]=function(_0x56c218,_0xf8228a,_0x3b35bb,_0x5b8d33,_0x39ca95,_0x538572){loggerPredictive['info'](_0x0daf('0x1fa'));loggerPredictive['info']('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',_0x56c218);loggerPredictive[_0x0daf('0x78')](_0x0daf('0x1fb'),_0xf8228a);loggerPredictive[_0x0daf('0x78')](_0x0daf('0x1fc'),_0x3b35bb);loggerPredictive[_0x0daf('0x78')](_0x0daf('0x1fd'),_0x5b8d33);loggerPredictive[_0x0daf('0x78')](_0x0daf('0x1fe'),_0x39ca95);loggerPredictive[_0x0daf('0x78')](_0x0daf('0x1ff'));return new BPromise(function(_0x435eb2,_0x1ffb43){if(_0x56c218<=0x0||isNaN(_0x56c218)){return _0x1ffb43(msgResponse('[abandonmentRate]',_0x0daf('0x48'),_0x0daf('0x200')+_0x56c218));}if(_0x3b35bb<=0x0||isNaN(_0x3b35bb)){return _0x1ffb43(msgResponse(_0x0daf('0x201'),_0x0daf('0x48'),_0x0daf('0x202')+_0x3b35bb));}if(_0x5b8d33<=0x0||isNaN(_0x5b8d33)){return _0x1ffb43(msgResponse(_0x0daf('0x201'),_0x0daf('0x48'),_0x0daf('0x203')+_0x5b8d33));}if(_0xf8228a<=0x0||isNaN(_0xf8228a)){return _0x1ffb43(msgResponse(_0x0daf('0x201'),_0x0daf('0x48'),_0x0daf('0x204')+_0xf8228a));}if(_0x39ca95<=0x0||isNaN(_0x39ca95)){return _0x1ffb43(msgResponse(_0x0daf('0x201'),_0x0daf('0x48'),_0x0daf('0x205')+_0x39ca95));}_0x538572=_0x538572||0x0;var _0x14bac4=0x1/_0x3b35bb;var _0x60fdcf=0x0;var _0x28561e=0x0;var _0x3119d6=0x0;var _0x589894=0x0;for(var _0x5b3310=0x0;_0x3119d6<_0x39ca95;_0x5b3310+=0x1){_0x28561e=_0x5b3310/_0xf8228a;_0x60fdcf=(_0x5b8d33*_0x28561e+_0x538572)/_0x14bac4;_0x3119d6=erlangb(_0x60fdcf,_0x56c218);_0x589894=_0x60fdcf/_0x56c218*(0x1-erlangb(_0x60fdcf,_0x56c218));}return _0x435eb2({'erlangCalls':_0x5b3310,'erlangCallToSecond':_0xf8228a/_0x5b3310,'erlangAbandonmentRate':_0x3119d6,'erlangBusyFactor':_0x589894});});};Dialer[_0x0daf('0xa7')][_0x0daf('0x1c8')]=function(_0xbe08b8,_0x26a06c,_0x25f496,_0x5877f9,_0x3e6bef,_0x191e35){loggerPredictive[_0x0daf('0x78')](_0x0daf('0x206'));loggerPredictive[_0x0daf('0x78')](_0x0daf('0x207'),_0xbe08b8);loggerPredictive[_0x0daf('0x78')](_0x0daf('0x1fb'),_0x26a06c);loggerPredictive['info'](_0x0daf('0x1fc'),_0x25f496);loggerPredictive['info'](_0x0daf('0x1fd'),_0x5877f9);loggerPredictive[_0x0daf('0x78')](_0x0daf('0x208'),_0x3e6bef);loggerPredictive[_0x0daf('0x78')]('---------------------------');return new BPromise(function(_0x114ff2,_0x5e1aca){if(_0xbe08b8<=0x0||isNaN(_0xbe08b8)){return _0x5e1aca(msgResponse(_0x0daf('0x209'),_0x0daf('0x48'),'m\x20=\x20'+_0xbe08b8));}if(_0x25f496<=0x0||isNaN(_0x25f496)){return _0x5e1aca(msgResponse(_0x0daf('0x209'),_0x0daf('0x48'),_0x0daf('0x202')+_0x25f496));}if(_0x5877f9<=0x0||isNaN(_0x5877f9)){return _0x5e1aca(msgResponse(_0x0daf('0x209'),_0x0daf('0x48'),'p\x20=\x20'+_0x5877f9));}if(_0x26a06c<=0x0||isNaN(_0x26a06c)){return _0x5e1aca(msgResponse(_0x0daf('0x209'),_0x0daf('0x48'),_0x0daf('0x204')+_0x26a06c));}if(_0x3e6bef<=0x0||isNaN(_0x3e6bef)){return _0x5e1aca(msgResponse(_0x0daf('0x209'),_0x0daf('0x48'),_0x0daf('0x20a')+_0x3e6bef));}_0x191e35=_0x191e35||0x0;var _0xb4255f=0x1/_0x25f496;var _0x28267d=0x0;var _0x2e2653=0x0;var _0x44b0b0=0x0;var _0x2a0e90=0x0;for(var _0x21c51f=0x0;_0x2a0e90<_0x3e6bef;_0x21c51f+=0x1){_0x2e2653=_0x21c51f/_0x26a06c;_0x28267d=(_0x5877f9*_0x2e2653+_0x191e35)/_0xb4255f;_0x44b0b0=erlangb(_0x28267d,_0xbe08b8);_0x2a0e90=_0x28267d/_0xbe08b8*(0x1-erlangb(_0x28267d,_0xbe08b8));}return _0x114ff2({'erlangCalls':_0x21c51f,'erlangCallToSecond':_0x26a06c/_0x21c51f,'erlangAbandonmentRate':_0x44b0b0,'erlangBusyFactor':_0x2a0e90});});};module[_0x0daf('0x20b')]=Dialer; \ No newline at end of file diff --git a/server/services/ami/dialer/queueCallerAbandon.js b/server/services/ami/dialer/queueCallerAbandon.js index 127715d..4f5e112 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 _0xe8fc=['connectedlinename','reason','callback','callbackuniqueid','recallme','ContactId','ListId','UserId','VoiceQueueId','CampaignId','originatecalleridnum','originatecalleridname','exports','util','moment','diff','seconds','type','outbound','queue','countbusyretry','countcongestionretry','countnoanswerretry','countmachineretry','countagentrejectretry','countnosuchnumberretry','countdropretry','countabandonedretry','uniqueid','calleridname','name','starttime','responsetime','droptime','endtime','ringtime','holdtime','talktime'];(function(_0x5b9c9a,_0x1c1b96){var _0x58f5ae=function(_0x2bc336){while(--_0x2bc336){_0x5b9c9a['push'](_0x5b9c9a['shift']());}};_0x58f5ae(++_0x1c1b96);}(_0xe8fc,0x1d5));var _0xce8f=function(_0x30fc13,_0x126c3f){_0x30fc13=_0x30fc13-0x0;var _0x5d0365=_0xe8fc[_0x30fc13];return _0x5d0365;};'use strict';var util=require(_0xce8f('0x0'));var _=require('lodash');var moment=require(_0xce8f('0x1'));function getSeconds(_0x3c4dab,_0x525c3e){var _0x8dfa84=moment(_0x3c4dab)['milliseconds'](0x0);var _0x55f46f=moment(_0x525c3e)['milliseconds'](0x0);return _0x8dfa84[_0xce8f('0x2')](_0x55f46f,_0xce8f('0x3'));}function QueueCallerAbandon(_0x2d37eb,_0x3c0bed){this['scheduledat']=_0x2d37eb['scheduledat'];this['type']=_0x2d37eb[_0xce8f('0x4')];this['campaigntype']=_0x2d37eb['type']===_0xce8f('0x5')?_0xce8f('0x6'):_0x2d37eb[_0xce8f('0x4')];this[_0xce8f('0x7')]=_0x2d37eb[_0xce8f('0x7')];this[_0xce8f('0x8')]=_0x2d37eb[_0xce8f('0x8')];this[_0xce8f('0x9')]=_0x2d37eb[_0xce8f('0x9')];this['countglobal']=_0x2d37eb[_0xce8f('0x7')]+_0x2d37eb[_0xce8f('0x8')]+_0x2d37eb[_0xce8f('0x9')]+_0x2d37eb['countnosuchnumberretry']+_0x2d37eb['countdropretry']+_0x2d37eb['countabandonedretry']+_0x2d37eb[_0xce8f('0xa')]+_0x2d37eb[_0xce8f('0xb')];this[_0xce8f('0xc')]=_0x2d37eb['countnosuchnumberretry'];this[_0xce8f('0xd')]=_0x2d37eb[_0xce8f('0xd')];this['countabandonedretry']=_0x2d37eb[_0xce8f('0xe')];this[_0xce8f('0xa')]=_0x2d37eb[_0xce8f('0xa')];this['countagentrejectretry']=_0x2d37eb[_0xce8f('0xb')];this[_0xce8f('0xf')]=_0x3c0bed[_0xce8f('0xf')];this[_0xce8f('0x10')]=_0x2d37eb[_0xce8f('0x11')];this['calleridnum']=_0x2d37eb['number'];this[_0xce8f('0x12')]=_0x2d37eb[_0xce8f('0x12')];this[_0xce8f('0x13')]=_0x2d37eb[_0xce8f('0x13')];this[_0xce8f('0x14')]=_0x2d37eb[_0xce8f('0x14')];this[_0xce8f('0x15')]=this[_0xce8f('0x14')];this[_0xce8f('0x16')]=getSeconds(_0x2d37eb[_0xce8f('0x13')],_0x2d37eb['starttime']);this[_0xce8f('0x17')]=getSeconds(this[_0xce8f('0x14')],_0x2d37eb[_0xce8f('0x13')]);this[_0xce8f('0x18')]=0x0;this[_0xce8f('0x6')]=_0x3c0bed[_0xce8f('0x6')];this['membername']=_0x3c0bed[_0xce8f('0x19')];this[_0xce8f('0x1a')]=_0x3c0bed[_0xce8f('0x1a')];this['callback']=_0x2d37eb[_0xce8f('0x1b')];this[_0xce8f('0x1c')]=_0x2d37eb[_0xce8f('0x1c')];this['callbackat']=_0x2d37eb['callbackat'];this[_0xce8f('0x1d')]=_0x2d37eb[_0xce8f('0x1d')];this[_0xce8f('0x1e')]=_0x2d37eb[_0xce8f('0x1e')];this['ListId']=_0x2d37eb[_0xce8f('0x1f')];this[_0xce8f('0x20')]=_0x2d37eb[_0xce8f('0x20')];this[_0xce8f('0x21')]=_0x2d37eb[_0xce8f('0x21')];this['CampaignId']=_0x2d37eb[_0xce8f('0x22')];this['originatecalleridnum']=_0x2d37eb[_0xce8f('0x23')]||'';this[_0xce8f('0x24')]=_0x2d37eb[_0xce8f('0x24')]||'';}module[_0xce8f('0x25')]=QueueCallerAbandon; \ No newline at end of file +var _0x1024=['holdtime','talktime','membername','connectedlinename','reason','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','CampaignId','originatecalleridnum','originatecalleridname','util','lodash','moment','milliseconds','scheduledat','type','campaigntype','outbound','queue','countbusyretry','countcongestionretry','countnoanswerretry','countnosuchnumberretry','countabandonedretry','countmachineretry','countagentrejectretry','countdropretry','uniqueid','calleridname','name','calleridnum','starttime','responsetime','droptime','endtime'];(function(_0x3cb52d,_0x5c618d){var _0x371f51=function(_0x4ffa60){while(--_0x4ffa60){_0x3cb52d['push'](_0x3cb52d['shift']());}};_0x371f51(++_0x5c618d);}(_0x1024,0x14f));var _0x4102=function(_0x9a73d1,_0x8d5254){_0x9a73d1=_0x9a73d1-0x0;var _0x97f5e1=_0x1024[_0x9a73d1];return _0x97f5e1;};'use strict';var util=require(_0x4102('0x0'));var _=require(_0x4102('0x1'));var moment=require(_0x4102('0x2'));function getSeconds(_0x5926b7,_0x4c68e4){var _0x10debb=moment(_0x5926b7)['milliseconds'](0x0);var _0x366281=moment(_0x4c68e4)[_0x4102('0x3')](0x0);return _0x10debb['diff'](_0x366281,'seconds');}function QueueCallerAbandon(_0x228dad,_0x35af68){this[_0x4102('0x4')]=_0x228dad['scheduledat'];this['type']=_0x228dad[_0x4102('0x5')];this[_0x4102('0x6')]=_0x228dad[_0x4102('0x5')]===_0x4102('0x7')?_0x4102('0x8'):_0x228dad[_0x4102('0x5')];this[_0x4102('0x9')]=_0x228dad[_0x4102('0x9')];this[_0x4102('0xa')]=_0x228dad[_0x4102('0xa')];this['countnoanswerretry']=_0x228dad[_0x4102('0xb')];this['countglobal']=_0x228dad['countbusyretry']+_0x228dad[_0x4102('0xa')]+_0x228dad['countnoanswerretry']+_0x228dad[_0x4102('0xc')]+_0x228dad['countdropretry']+_0x228dad[_0x4102('0xd')]+_0x228dad[_0x4102('0xe')]+_0x228dad[_0x4102('0xf')];this[_0x4102('0xc')]=_0x228dad['countnosuchnumberretry'];this[_0x4102('0x10')]=_0x228dad[_0x4102('0x10')];this[_0x4102('0xd')]=_0x228dad[_0x4102('0xd')];this[_0x4102('0xe')]=_0x228dad[_0x4102('0xe')];this[_0x4102('0xf')]=_0x228dad['countagentrejectretry'];this[_0x4102('0x11')]=_0x35af68['uniqueid'];this[_0x4102('0x12')]=_0x228dad[_0x4102('0x13')];this[_0x4102('0x14')]=_0x228dad['number'];this[_0x4102('0x15')]=_0x228dad[_0x4102('0x15')];this[_0x4102('0x16')]=_0x228dad[_0x4102('0x16')];this[_0x4102('0x17')]=_0x228dad[_0x4102('0x17')];this[_0x4102('0x18')]=this['droptime'];this['ringtime']=getSeconds(_0x228dad[_0x4102('0x16')],_0x228dad[_0x4102('0x15')]);this[_0x4102('0x19')]=getSeconds(this[_0x4102('0x17')],_0x228dad['responsetime']);this[_0x4102('0x1a')]=0x0;this['queue']=_0x35af68['queue'];this[_0x4102('0x1b')]=_0x35af68[_0x4102('0x1c')];this[_0x4102('0x1d')]=_0x35af68[_0x4102('0x1d')];this[_0x4102('0x1e')]=_0x228dad[_0x4102('0x1e')];this[_0x4102('0x1f')]=_0x228dad['callbackuniqueid'];this[_0x4102('0x20')]=_0x228dad[_0x4102('0x20')];this[_0x4102('0x21')]=_0x228dad[_0x4102('0x21')];this[_0x4102('0x22')]=_0x228dad[_0x4102('0x22')];this['ListId']=_0x228dad[_0x4102('0x23')];this[_0x4102('0x24')]=_0x228dad['UserId'];this['VoiceQueueId']=_0x228dad['VoiceQueueId'];this[_0x4102('0x25')]=_0x228dad[_0x4102('0x25')];this[_0x4102('0x26')]=_0x228dad[_0x4102('0x26')]||'';this['originatecalleridname']=_0x228dad[_0x4102('0x27')]||'';}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 bf79c34..e64864e 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 _0x100c=['localstationid','headerinfo','path','AttachmentId','exports','lodash','moment','uniqueid','format','%s/%s/%s','Trunk','fax'];(function(_0x4c3766,_0x3325bf){var _0x423d11=function(_0x2de6d5){while(--_0x2de6d5){_0x4c3766['push'](_0x4c3766['shift']());}};_0x423d11(++_0x3325bf);}(_0x100c,0x101));var _0xc100=function(_0x2b4411,_0x2625ed){_0x2b4411=_0x2b4411-0x0;var _0x8e41ef=_0x100c[_0x2b4411];return _0x8e41ef;};'use strict';var util=require('util');var _=require(_0xc100('0x0'));var moment=require(_0xc100('0x1'));function Action(_0xe774f5,_0x5ced4b,_0x474a93){this[_0xc100('0x2')]=_0xe774f5||undefined;this['channel']=util[_0xc100('0x3')](_0xc100('0x4'),_0x5ced4b['tech'],_0x5ced4b[_0xc100('0x5')]['name'],_0x474a93[_0xc100('0x6')]);this[_0xc100('0x7')]=_0x5ced4b[_0xc100('0x7')];this['headerinfo']=_0x5ced4b[_0xc100('0x8')];this[_0xc100('0x9')]=_0x474a93[_0xc100('0x9')];this[_0xc100('0xa')]=_0x474a93['AttachmentId'];}module[_0xc100('0xb')]=Action; \ No newline at end of file +var _0x5daa=['exports','lodash','moment','uniqueid','channel','%s/%s/%s','tech','Trunk','fax','headerinfo','path','AttachmentId'];(function(_0xe687b3,_0x468b9f){var _0x1b765d=function(_0x443767){while(--_0x443767){_0xe687b3['push'](_0xe687b3['shift']());}};_0x1b765d(++_0x468b9f);}(_0x5daa,0x85));var _0xa5da=function(_0x739dae,_0x3f7a8e){_0x739dae=_0x739dae-0x0;var _0x275ca5=_0x5daa[_0x739dae];return _0x275ca5;};'use strict';var util=require('util');var _=require(_0xa5da('0x0'));var moment=require(_0xa5da('0x1'));function Action(_0x4b4f54,_0x4326c7,_0x37dbab){this[_0xa5da('0x2')]=_0x4b4f54||undefined;this[_0xa5da('0x3')]=util['format'](_0xa5da('0x4'),_0x4326c7[_0xa5da('0x5')],_0x4326c7[_0xa5da('0x6')]['name'],_0x37dbab[_0xa5da('0x7')]);this['localstationid']=_0x4326c7['localstationid'];this['headerinfo']=_0x4326c7[_0xa5da('0x8')];this[_0xa5da('0x9')]=_0x37dbab[_0xa5da('0x9')];this[_0xa5da('0xa')]=_0x37dbab['AttachmentId'];}module[_0xa5da('0xb')]=Action; \ No newline at end of file diff --git a/server/services/ami/fax/index.js b/server/services/ami/fax/index.js index ddabef2..c2cfe3f 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 _0xf0fa=['status','filename','\x20syncFaxStatus\x20','remotestationid','pagestransferred','resolution','/var/opt/motion2/server/files/attachments/','\x20result\x20conversion\x20file\x20','create','parse','.pdf','application/pdf','then','calleridnum','catch','error','\x20notify\x20','stringify','\x20receiveFax\x20','merge','pick','reason','AttachmentId','update','logger','[Fax][Message][Error][NoUpdate1]','[Fax][Message][Error][NoUpdate2]','updateStatus','[Fax][Message][Updated]','[Fax][Message][NoUpdate1]','finally','[Fax][Message][NoUpdate2]','\x20hangup\x20sendFile\x20','\x20hangup\x20faxRiceive\x20','faxpages','execOriginate','FaxAccountId','message','[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','%s/%s.tif','dir','XMF-PATH','Action','variablesAction','ext','isTrunkReachable','isNil','active','SIP/%s','reachable','unmonitored','[Fax][checkTrunk][Trunk\x20not\x20work]','\x20Trunk\x20is\x20not\x20active','Trunk\x20not\x20working','[Fax][checkTrunk][Empty\x20Fax]','Empty\x20Fax','exports','util','moment','path','tiff2pdf','./util/gs','../../../config/logger','fax','../ami','./rpcDb','./util/util','./action','../rpc/faxAccount','../rpc/attachment','../rpc/faxMessage','channels','trunks','actions','newchannel','syncNewchannel','bind','syncVarSet','syncNewState','newexten','syncNewExten','syncFaxStatus','syncReceiveFax','hangup','syncHangup','originateresponse','syncOriginateResponse','context','from-voip-provider','faxAccounts','hasOwnProperty','exten','localstationid','uniqueid','channel','name','info','\x20syncNewchannel\x20','prototype','variable','value','channelstate','channelstatedesc','operation'];(function(_0xf9ad3f,_0x1356c8){var _0xd22bb3=function(_0x5b4c0f){while(--_0x5b4c0f){_0xf9ad3f['push'](_0xf9ad3f['shift']());}};_0xd22bb3(++_0x1356c8);}(_0xf0fa,0xb3));var _0xaf0f=function(_0x149221,_0x4099ad){_0x149221=_0x149221-0x0;var _0xb08d4f=_0xf0fa[_0x149221];return _0xb08d4f;};'use strict';var util=require(_0xaf0f('0x0'));var _=require('lodash');var BPromise=require('bluebird');var uuid=require('uuid');var moment=require(_0xaf0f('0x1'));var path=require(_0xaf0f('0x2'));var tiff2pdf=require(_0xaf0f('0x3'));var gs=require(_0xaf0f('0x4'));var logger=require(_0xaf0f('0x5'))(_0xaf0f('0x6'));var ami=require(_0xaf0f('0x7'));var rpcDb=require(_0xaf0f('0x8'));var Channel=require('./channel');var ut=require(_0xaf0f('0x9'));var Action=require(_0xaf0f('0xa'));var faxAccount=require(_0xaf0f('0xb'));var attachment=require(_0xaf0f('0xc'));var faxMessage=require(_0xaf0f('0xd'));function Fax(_0x38e8f9){this[_0xaf0f('0xe')]={};this['faxAccounts']=_0x38e8f9['faxAccounts'];this[_0xaf0f('0xf')]=_0x38e8f9[_0xaf0f('0xf')];this[_0xaf0f('0x10')]={};ami['on'](_0xaf0f('0x11'),this[_0xaf0f('0x12')][_0xaf0f('0x13')](this));ami['on']('varset',this[_0xaf0f('0x14')][_0xaf0f('0x13')](this));ami['on']('newstate',this[_0xaf0f('0x15')][_0xaf0f('0x13')](this));ami['on'](_0xaf0f('0x16'),this[_0xaf0f('0x17')][_0xaf0f('0x13')](this));ami['on']('faxstatus',this[_0xaf0f('0x18')][_0xaf0f('0x13')](this));ami['on']('receivefax',this[_0xaf0f('0x19')][_0xaf0f('0x13')](this));ami['on'](_0xaf0f('0x1a'),this[_0xaf0f('0x1b')][_0xaf0f('0x13')](this));ami['on'](_0xaf0f('0x1c'),this[_0xaf0f('0x1d')][_0xaf0f('0x13')](this));}Fax['prototype'][_0xaf0f('0x12')]=function(_0x135ecc){if(_0x135ecc[_0xaf0f('0x1e')]===_0xaf0f('0x1f')){for(var _0x57819e in this[_0xaf0f('0x20')]){if(this[_0xaf0f('0x20')][_0xaf0f('0x21')](_0x57819e)){if(_0x135ecc[_0xaf0f('0x22')]===this['faxAccounts'][_0x57819e][_0xaf0f('0x23')]){this[_0xaf0f('0xe')][_0x135ecc['uniqueid']]={};this['channels'][_0x135ecc[_0xaf0f('0x24')]][_0xaf0f('0x25')]=_0x135ecc[_0xaf0f('0x25')];this[_0xaf0f('0xe')][_0x135ecc['uniqueid']]['id']=this[_0xaf0f('0x20')][_0x57819e]['id'];this['channels'][_0x135ecc[_0xaf0f('0x24')]][_0xaf0f('0x26')]=this[_0xaf0f('0x20')][_0x57819e][_0xaf0f('0x26')];logger[_0xaf0f('0x27')](_0x135ecc['uniqueid'],_0xaf0f('0x28'));}}}}if(this['actions'][_0x135ecc['uniqueid']]){this[_0xaf0f('0xe')][_0x135ecc[_0xaf0f('0x24')]]={};this[_0xaf0f('0xe')][_0x135ecc[_0xaf0f('0x24')]][_0xaf0f('0x25')]=_0x135ecc[_0xaf0f('0x25')];logger[_0xaf0f('0x27')](_0x135ecc['uniqueid'],'\x20syncNewchannel\x20');}};Fax[_0xaf0f('0x29')][_0xaf0f('0x14')]=function(_0x3413bc){if(this[_0xaf0f('0xe')][_0x3413bc['uniqueid']]){for(var _0x3a9ef5 in _0x3413bc[_0xaf0f('0x2a')]){if(_0x3413bc[_0xaf0f('0x2a')][_0xaf0f('0x21')](_0x3a9ef5)){this[_0xaf0f('0xe')][_0x3413bc[_0xaf0f('0x24')]][_0x3a9ef5]=_0x3413bc[_0xaf0f('0x2b')];}}}};Fax[_0xaf0f('0x29')][_0xaf0f('0x15')]=function(_0x35569d){if(this['channels'][_0x35569d[_0xaf0f('0x24')]]){this[_0xaf0f('0xe')][_0x35569d[_0xaf0f('0x24')]]['channelstate']=_0x35569d[_0xaf0f('0x2c')];this['channels'][_0x35569d['uniqueid']][_0xaf0f('0x2d')]=_0x35569d[_0xaf0f('0x2d')];}};Fax[_0xaf0f('0x29')][_0xaf0f('0x17')]=function(_0x409768){if(this[_0xaf0f('0xe')][_0x409768[_0xaf0f('0x24')]]){for(var _0x36c5d5 in _0x409768[_0xaf0f('0x2a')]){if(_0x409768['variable'][_0xaf0f('0x21')](_0x36c5d5)){this['channels'][_0x409768[_0xaf0f('0x24')]][_0x36c5d5]=_0x409768['value'];}}}};Fax[_0xaf0f('0x29')][_0xaf0f('0x18')]=function(_0x5e3d02){if(this['channels'][_0x5e3d02[_0xaf0f('0x24')]]){this[_0xaf0f('0xe')][_0x5e3d02[_0xaf0f('0x24')]][_0xaf0f('0x2e')]=_0x5e3d02['operation'];this[_0xaf0f('0xe')][_0x5e3d02[_0xaf0f('0x24')]][_0xaf0f('0x2f')]=_0x5e3d02[_0xaf0f('0x2f')];this[_0xaf0f('0xe')][_0x5e3d02[_0xaf0f('0x24')]][_0xaf0f('0x23')]=_0x5e3d02['localstationid'];this[_0xaf0f('0xe')][_0x5e3d02[_0xaf0f('0x24')]]['filename']=_0x5e3d02[_0xaf0f('0x30')];logger[_0xaf0f('0x27')](_0x5e3d02[_0xaf0f('0x24')],_0xaf0f('0x31'));}};Fax[_0xaf0f('0x29')][_0xaf0f('0x19')]=function(_0x50b324){var _0x3d504e=this;if(this[_0xaf0f('0xe')][_0x50b324[_0xaf0f('0x24')]]){var _0x199763=this[_0xaf0f('0xe')][_0x50b324[_0xaf0f('0x24')]]['id'];this[_0xaf0f('0xe')][_0x50b324[_0xaf0f('0x24')]][_0xaf0f('0x32')]=_0x50b324[_0xaf0f('0x32')];this[_0xaf0f('0xe')][_0x50b324['uniqueid']]['pagestransferred']=_0x50b324[_0xaf0f('0x33')];this[_0xaf0f('0xe')][_0x50b324[_0xaf0f('0x24')]][_0xaf0f('0x23')]=_0x50b324[_0xaf0f('0x23')];this['channels'][_0x50b324[_0xaf0f('0x24')]][_0xaf0f('0x34')]=_0x50b324[_0xaf0f('0x34')];this['channels'][_0x50b324[_0xaf0f('0x24')]]['transferrate']=_0x50b324['transferrate'];this['channels'][_0x50b324['uniqueid']][_0xaf0f('0x30')]=_0x50b324[_0xaf0f('0x30')];this['channels'][_0x50b324['uniqueid']]['calleridnum']=_0x50b324['calleridnum'];if(this['channels'][_0x50b324[_0xaf0f('0x24')]][_0xaf0f('0x33')]>0x0){tiff2pdf(_0x50b324[_0xaf0f('0x30')],_0xaf0f('0x35'),function(_0x2e73f9){logger[_0xaf0f('0x27')](_0x50b324['uniqueid'],_0xaf0f('0x36'),_0x2e73f9['message']);attachment[_0xaf0f('0x37')]({'name':path['parse'](_0x50b324[_0xaf0f('0x30')])[_0xaf0f('0x26')],'basename':path[_0xaf0f('0x38')](_0x50b324[_0xaf0f('0x30')])[_0xaf0f('0x26')]+_0xaf0f('0x39'),'type':_0xaf0f('0x3a')})[_0xaf0f('0x3b')](function(_0x5cb9cb){faxAccount['notify'](_0x199763,{'from':_0x50b324[_0xaf0f('0x3c')],'mapKey':_0xaf0f('0x6'),'body':path[_0xaf0f('0x38')](_0x50b324[_0xaf0f('0x30')])[_0xaf0f('0x26')]+_0xaf0f('0x39'),'AttachmentId':_0x5cb9cb['id']})[_0xaf0f('0x3d')](function(_0x6590d4){logger[_0xaf0f('0x3e')](_0x50b324[_0xaf0f('0x24')],_0xaf0f('0x3f'),JSON[_0xaf0f('0x40')](_0x6590d4));});})[_0xaf0f('0x3d')](function(_0x286638){logger[_0xaf0f('0x3e')](_0x50b324['uniqueid'],_0xaf0f('0x41'),JSON[_0xaf0f('0x40')](_0x286638));});});}logger[_0xaf0f('0x27')](_0x50b324['uniqueid'],_0xaf0f('0x41'));}};Fax[_0xaf0f('0x29')][_0xaf0f('0x1d')]=function(_0x364590){if(this[_0xaf0f('0x10')][_0x364590[_0xaf0f('0x24')]]){_[_0xaf0f('0x42')](this['channels'][_0x364590[_0xaf0f('0x24')]],_[_0xaf0f('0x43')](_0x364590,['response',_0xaf0f('0x44')]));}};function updateStatus(_0x201a9d){if(_0x201a9d[_0xaf0f('0x45')]){faxMessage[_0xaf0f('0x46')](_0x201a9d[_0xaf0f('0x45')],{'failMessage':'SENDING\x20FAILED\x20'})[_0xaf0f('0x3b')](function(_0x199a97){ut[_0xaf0f('0x47')]('[Fax][Message][Error][Updated]',_0x199a97);})['catch'](function(_0x200b22){ut[_0xaf0f('0x47')](_0xaf0f('0x48'),_0x200b22);});}else{ut[_0xaf0f('0x47')](_0xaf0f('0x49'));}}Fax[_0xaf0f('0x29')][_0xaf0f('0x4a')]=function(_0x2e6857,_0x5a934d,_0x1ea3b3){var _0x178332=this;var _0x2eea14={};if(_0x5a934d){_0x2eea14={'read':_0x5a934d};}else{_0x2eea14={'failMessage':_0x1ea3b3};}if(this[_0xaf0f('0x10')][_0x2e6857]['AttachmentId']){faxMessage[_0xaf0f('0x46')](this[_0xaf0f('0x10')][_0x2e6857][_0xaf0f('0x45')],_0x2eea14)[_0xaf0f('0x3b')](function(_0x459666){ut['logger'](_0xaf0f('0x4b'),_0x459666);})[_0xaf0f('0x3d')](function(_0x405c43){ut[_0xaf0f('0x47')](_0xaf0f('0x4c'),_0x405c43);})[_0xaf0f('0x4d')](function(){delete _0x178332[_0xaf0f('0xe')][_0x2e6857];delete _0x178332[_0xaf0f('0x10')][_0x2e6857];});}else{ut[_0xaf0f('0x47')](_0xaf0f('0x4e'));delete this['channels'][_0x2e6857];delete this['actions'][_0x2e6857];}};Fax[_0xaf0f('0x29')][_0xaf0f('0x1b')]=function(_0x11fe61){var _0xcde031=this;if(this[_0xaf0f('0xe')][_0x11fe61[_0xaf0f('0x24')]]){if(this[_0xaf0f('0x10')][_0x11fe61['uniqueid']]){this['channels'][_0x11fe61[_0xaf0f('0x24')]]['id']=this[_0xaf0f('0x10')][_0x11fe61['uniqueid']]['id'];this['channels'][_0x11fe61[_0xaf0f('0x24')]][_0xaf0f('0x26')]=this[_0xaf0f('0x10')][_0x11fe61[_0xaf0f('0x24')]][_0xaf0f('0x26')];}logger[_0xaf0f('0x27')](_0x11fe61[_0xaf0f('0x24')],this[_0xaf0f('0x10')][_0x11fe61['uniqueid']]?_0xaf0f('0x4f'):_0xaf0f('0x50'),JSON['stringify'](this[_0xaf0f('0xe')][_0x11fe61[_0xaf0f('0x24')]]));if(this[_0xaf0f('0x10')][_0x11fe61[_0xaf0f('0x24')]]){if(this[_0xaf0f('0xe')][_0x11fe61[_0xaf0f('0x24')]][_0xaf0f('0x51')]>0x0&&this[_0xaf0f('0xe')][_0x11fe61['uniqueid']]['faxstatus']==='SUCCESS'){this[_0xaf0f('0x4a')](_0x11fe61[_0xaf0f('0x24')],!![]);}else{this[_0xaf0f('0x4a')](_0x11fe61['uniqueid'],![],this[_0xaf0f('0xe')][_0x11fe61[_0xaf0f('0x24')]]['faxstatusstring']?'SENDING\x20FAILED:\x20'+this['channels'][_0x11fe61[_0xaf0f('0x24')]]['faxstatusstring']:'SENDING\x20FAILED');}}}};Fax[_0xaf0f('0x29')]['send']=function(_0x23d466){var _0x2e73ec=this;return new BPromise(function(_0x2ec2b0,_0xd28cc9){_0x2e73ec[_0xaf0f('0x52')](_0x23d466,_0x2e73ec[_0xaf0f('0x20')][_0x23d466[_0xaf0f('0x53')]])[_0xaf0f('0x3b')](function(_0x493e1){ut[_0xaf0f('0x47')]('[Fax][execOriginate][success]',_0x493e1);_0x2ec2b0(ut[_0xaf0f('0x54')]('Fax\x20received'));})[_0xaf0f('0x3d')](function(_0x2e99f4){ut[_0xaf0f('0x47')](_0xaf0f('0x55'),_0x2e99f4);updateStatus(_0x23d466);_0xd28cc9(ut[_0xaf0f('0x54')](_0xaf0f('0x56')));});});};Fax[_0xaf0f('0x29')][_0xaf0f('0x57')]=function(_0x2ece0a){var _0x18ace1=this;return new BPromise(function(_0x56eb29,_0xa9689){var _0x465529=_0x18ace1[_0xaf0f('0x58')](_0x18ace1['faxAccounts'][_0x2ece0a[_0xaf0f('0x53')]][_0xaf0f('0x59')],_0x2ece0a);if(_0x465529[_0xaf0f('0x5a')]){_0x56eb29(ut['message'](_0xaf0f('0x5b')));}else{_0xa9689(ut['message'](_0x465529[_0xaf0f('0x54')]));}});};function originate(_0x48a7d9,_0x2d6547,_0x2182e0){return new BPromise(function(_0x1e067d,_0x57f246){if(_0x2182e0){var _0x1dd32b=util[_0xaf0f('0x5c')](_0xaf0f('0x5d'),path[_0xaf0f('0x38')](_0x48a7d9['path'])[_0xaf0f('0x26')],_0x48a7d9[_0xaf0f('0x2')]);gs[_0xaf0f('0x5e')](_0x1dd32b)[_0xaf0f('0x3b')](function(){_0x48a7d9[_0xaf0f('0x2')]=util[_0xaf0f('0x5c')](_0xaf0f('0x5f'),path[_0xaf0f('0x38')](_0x48a7d9[_0xaf0f('0x2')])[_0xaf0f('0x60')],path[_0xaf0f('0x38')](_0x48a7d9[_0xaf0f('0x2')])[_0xaf0f('0x26')]);_0x2d6547[_0xaf0f('0x61')]=_0x48a7d9[_0xaf0f('0x2')];ut[_0xaf0f('0x47')]('Convert\x20pdf\x20to\x20tif','');ami[_0xaf0f('0x62')](ut[_0xaf0f('0x63')](_0x48a7d9,_0x2d6547))['then'](function(_0x5e07a9){_0x1e067d(_0x5e07a9);})[_0xaf0f('0x3d')](function(_0x5a4581){_0x57f246(_0x5a4581);});})[_0xaf0f('0x3d')](function(_0x15ffac){_0x57f246(_0x15ffac);});}else{ami[_0xaf0f('0x62')](ut[_0xaf0f('0x63')](_0x48a7d9,_0x2d6547))[_0xaf0f('0x3b')](function(_0x27fb65){_0x1e067d(_0x27fb65);})['catch'](function(_0x274436){_0x57f246(_0x274436);});}});}Fax[_0xaf0f('0x29')]['execOriginate']=function(_0x4813a7,_0x152d2e){var _0x102767=this;return new BPromise(function(_0x2ac15b,_0xe7414f){var _0x4bd727=uuid['v4']();var _0x2eb879=ut['addVariables'](_0x4813a7,_0x152d2e);_0x102767[_0xaf0f('0x10')][_0x4bd727]=new Action(_0x4bd727,_0x152d2e,_0x4813a7);var _0x25d123=_0x102767['actions'][_0x4bd727];if(path[_0xaf0f('0x38')](_0x4813a7[_0xaf0f('0x2')])[_0xaf0f('0x64')]===_0xaf0f('0x39')){originate(_0x25d123,_0x2eb879,!![])[_0xaf0f('0x3b')](function(_0x291e3c){_0x2ac15b(_0x291e3c);})['catch'](function(_0x52dab4){_0xe7414f(_0x52dab4);});}else{originate(_0x25d123,_0x2eb879,![])[_0xaf0f('0x3b')](function(_0x4fae70){_0x2ac15b(_0x4fae70);})[_0xaf0f('0x3d')](function(_0x3ad40c){_0xe7414f(_0x3ad40c);});}});};Fax[_0xaf0f('0x29')][_0xaf0f('0x65')]=function(_0x3483d0){return!_[_0xaf0f('0x66')](_0x3483d0)&&!_[_0xaf0f('0x66')](_0x3483d0['name'])&&!_[_0xaf0f('0x66')](_0x3483d0[_0xaf0f('0x67')])&&_0x3483d0[_0xaf0f('0x67')]&&!_[_0xaf0f('0x66')](this[_0xaf0f('0xf')][util[_0xaf0f('0x5c')](_0xaf0f('0x68'),_0x3483d0[_0xaf0f('0x26')])])&&!_[_0xaf0f('0x66')](this['trunks'][util[_0xaf0f('0x5c')](_0xaf0f('0x68'),_0x3483d0['name'])][_0xaf0f('0x2f')])&&(this[_0xaf0f('0xf')][util[_0xaf0f('0x5c')](_0xaf0f('0x68'),_0x3483d0['name'])][_0xaf0f('0x2f')]===_0xaf0f('0x69')||this[_0xaf0f('0xf')][util[_0xaf0f('0x5c')](_0xaf0f('0x68'),_0x3483d0['name'])][_0xaf0f('0x2f')]===_0xaf0f('0x6a'));};Fax[_0xaf0f('0x29')][_0xaf0f('0x58')]=function(_0x459cf6,_0xda6f01){if(!this[_0xaf0f('0x65')](_0x459cf6)){ut[_0xaf0f('0x47')](_0xaf0f('0x6b'),_[_0xaf0f('0x66')](_0x459cf6)?'':_0x459cf6['name']+_0xaf0f('0x6c'));return{'isValid':![],'message':_0xaf0f('0x6d')};}if(_[_0xaf0f('0x66')](_0xda6f01['fax'])){ut[_0xaf0f('0x47')](_0xaf0f('0x6e'),JSON[_0xaf0f('0x40')](_0xda6f01));return{'isValid':![],'message':_0xaf0f('0x6f')};}if(_[_0xaf0f('0x66')](_0xda6f01['path'])){ut[_0xaf0f('0x47')]('[Fax][checkTrunk][Empty\x20path]',JSON[_0xaf0f('0x40')](_0xda6f01));return{'isValid':![],'message':'Empty\x20path'};}return{'isValid':!![],'message':'Is\x20Valid'};};module[_0xaf0f('0x70')]=Fax; \ No newline at end of file +var _0x72fd=['then','notify','catch','error','stringify','\x20receiveFax\x20','merge','response','reason','AttachmentId','update','SENDING\x20FAILED\x20','logger','[Fax][Message][Error][NoUpdate1]','[Fax][Message][Error][NoUpdate2]','updateStatus','[Fax][Message][Updated]','[Fax][Message][NoUpdate1]','[Fax][Message][NoUpdate2]','\x20hangup\x20sendFile\x20','\x20hangup\x20faxRiceive\x20','SUCCESS','faxstatusstring','SENDING\x20FAILED:\x20','SENDING\x20FAILED','execOriginate','FaxAccountId','[Fax][execOriginate][success]','message','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','%s/%s.tif','dir','Convert\x20pdf\x20to\x20tif','Action','variablesAction','addVariables','ext','isNil','active','SIP/%s','unmonitored','isTrunkReachable','[Fax][checkTrunk][Trunk\x20not\x20work]','\x20Trunk\x20is\x20not\x20active','Trunk\x20not\x20working','fax','[Fax][checkTrunk][Empty\x20Fax]','Empty\x20Fax','Empty\x20path','Is\x20Valid','exports','util','lodash','uuid','moment','path','./util/gs','../../../config/logger','./rpcDb','./util/util','./action','../rpc/faxAccount','../rpc/attachment','channels','faxAccounts','trunks','actions','newchannel','varset','bind','newexten','syncNewExten','faxstatus','syncReceiveFax','hangup','syncHangup','originateresponse','syncOriginateResponse','context','from-voip-provider','hasOwnProperty','exten','localstationid','uniqueid','channel','name','\x20syncNewchannel\x20','info','prototype','syncVarSet','variable','syncNewState','channelstate','channelstatedesc','syncFaxStatus','operation','status','\x20syncFaxStatus\x20','remotestationid','pagestransferred','resolution','transferrate','filename','calleridnum','/var/opt/motion2/server/files/attachments/','\x20result\x20conversion\x20file\x20','parse','.pdf','application/pdf'];(function(_0x3fa6bb,_0x5f371b){var _0x9bbe1e=function(_0x40a59f){while(--_0x40a59f){_0x3fa6bb['push'](_0x3fa6bb['shift']());}};_0x9bbe1e(++_0x5f371b);}(_0x72fd,0x122));var _0xd72f=function(_0x3af37d,_0x32f50a){_0x3af37d=_0x3af37d-0x0;var _0x5a0654=_0x72fd[_0x3af37d];return _0x5a0654;};'use strict';var util=require(_0xd72f('0x0'));var _=require(_0xd72f('0x1'));var BPromise=require('bluebird');var uuid=require(_0xd72f('0x2'));var moment=require(_0xd72f('0x3'));var path=require(_0xd72f('0x4'));var tiff2pdf=require('tiff2pdf');var gs=require(_0xd72f('0x5'));var logger=require(_0xd72f('0x6'))('fax');var ami=require('../ami');var rpcDb=require(_0xd72f('0x7'));var Channel=require('./channel');var ut=require(_0xd72f('0x8'));var Action=require(_0xd72f('0x9'));var faxAccount=require(_0xd72f('0xa'));var attachment=require(_0xd72f('0xb'));var faxMessage=require('../rpc/faxMessage');function Fax(_0xb1204f){this[_0xd72f('0xc')]={};this[_0xd72f('0xd')]=_0xb1204f['faxAccounts'];this[_0xd72f('0xe')]=_0xb1204f[_0xd72f('0xe')];this[_0xd72f('0xf')]={};ami['on'](_0xd72f('0x10'),this['syncNewchannel']['bind'](this));ami['on'](_0xd72f('0x11'),this['syncVarSet'][_0xd72f('0x12')](this));ami['on']('newstate',this['syncNewState'][_0xd72f('0x12')](this));ami['on'](_0xd72f('0x13'),this[_0xd72f('0x14')][_0xd72f('0x12')](this));ami['on'](_0xd72f('0x15'),this['syncFaxStatus'][_0xd72f('0x12')](this));ami['on']('receivefax',this[_0xd72f('0x16')][_0xd72f('0x12')](this));ami['on'](_0xd72f('0x17'),this[_0xd72f('0x18')][_0xd72f('0x12')](this));ami['on'](_0xd72f('0x19'),this[_0xd72f('0x1a')][_0xd72f('0x12')](this));}Fax['prototype']['syncNewchannel']=function(_0x568bd4){if(_0x568bd4[_0xd72f('0x1b')]===_0xd72f('0x1c')){for(var _0x735ce in this[_0xd72f('0xd')]){if(this[_0xd72f('0xd')][_0xd72f('0x1d')](_0x735ce)){if(_0x568bd4[_0xd72f('0x1e')]===this[_0xd72f('0xd')][_0x735ce][_0xd72f('0x1f')]){this[_0xd72f('0xc')][_0x568bd4[_0xd72f('0x20')]]={};this[_0xd72f('0xc')][_0x568bd4[_0xd72f('0x20')]][_0xd72f('0x21')]=_0x568bd4[_0xd72f('0x21')];this['channels'][_0x568bd4[_0xd72f('0x20')]]['id']=this[_0xd72f('0xd')][_0x735ce]['id'];this[_0xd72f('0xc')][_0x568bd4[_0xd72f('0x20')]]['name']=this['faxAccounts'][_0x735ce][_0xd72f('0x22')];logger['info'](_0x568bd4[_0xd72f('0x20')],_0xd72f('0x23'));}}}}if(this[_0xd72f('0xf')][_0x568bd4[_0xd72f('0x20')]]){this[_0xd72f('0xc')][_0x568bd4['uniqueid']]={};this[_0xd72f('0xc')][_0x568bd4[_0xd72f('0x20')]]['channel']=_0x568bd4[_0xd72f('0x21')];logger[_0xd72f('0x24')](_0x568bd4[_0xd72f('0x20')],'\x20syncNewchannel\x20');}};Fax[_0xd72f('0x25')][_0xd72f('0x26')]=function(_0xf44a64){if(this[_0xd72f('0xc')][_0xf44a64[_0xd72f('0x20')]]){for(var _0x1cb930 in _0xf44a64[_0xd72f('0x27')]){if(_0xf44a64[_0xd72f('0x27')][_0xd72f('0x1d')](_0x1cb930)){this[_0xd72f('0xc')][_0xf44a64[_0xd72f('0x20')]][_0x1cb930]=_0xf44a64['value'];}}}};Fax[_0xd72f('0x25')][_0xd72f('0x28')]=function(_0x2f2c7f){if(this['channels'][_0x2f2c7f[_0xd72f('0x20')]]){this[_0xd72f('0xc')][_0x2f2c7f[_0xd72f('0x20')]][_0xd72f('0x29')]=_0x2f2c7f['channelstate'];this[_0xd72f('0xc')][_0x2f2c7f[_0xd72f('0x20')]]['channelstatedesc']=_0x2f2c7f[_0xd72f('0x2a')];}};Fax[_0xd72f('0x25')][_0xd72f('0x14')]=function(_0x4d77a3){if(this[_0xd72f('0xc')][_0x4d77a3[_0xd72f('0x20')]]){for(var _0x4c98fd in _0x4d77a3['variable']){if(_0x4d77a3[_0xd72f('0x27')][_0xd72f('0x1d')](_0x4c98fd)){this[_0xd72f('0xc')][_0x4d77a3['uniqueid']][_0x4c98fd]=_0x4d77a3['value'];}}}};Fax[_0xd72f('0x25')][_0xd72f('0x2b')]=function(_0x259f35){if(this[_0xd72f('0xc')][_0x259f35['uniqueid']]){this['channels'][_0x259f35['uniqueid']][_0xd72f('0x2c')]=_0x259f35[_0xd72f('0x2c')];this[_0xd72f('0xc')][_0x259f35[_0xd72f('0x20')]][_0xd72f('0x2d')]=_0x259f35[_0xd72f('0x2d')];this[_0xd72f('0xc')][_0x259f35[_0xd72f('0x20')]][_0xd72f('0x1f')]=_0x259f35[_0xd72f('0x1f')];this[_0xd72f('0xc')][_0x259f35[_0xd72f('0x20')]]['filename']=_0x259f35['filename'];logger[_0xd72f('0x24')](_0x259f35[_0xd72f('0x20')],_0xd72f('0x2e'));}};Fax[_0xd72f('0x25')][_0xd72f('0x16')]=function(_0x332292){var _0x455620=this;if(this['channels'][_0x332292['uniqueid']]){var _0x5057ce=this[_0xd72f('0xc')][_0x332292[_0xd72f('0x20')]]['id'];this[_0xd72f('0xc')][_0x332292[_0xd72f('0x20')]][_0xd72f('0x2f')]=_0x332292['remotestationid'];this['channels'][_0x332292[_0xd72f('0x20')]][_0xd72f('0x30')]=_0x332292['pagestransferred'];this[_0xd72f('0xc')][_0x332292[_0xd72f('0x20')]][_0xd72f('0x1f')]=_0x332292[_0xd72f('0x1f')];this[_0xd72f('0xc')][_0x332292[_0xd72f('0x20')]][_0xd72f('0x31')]=_0x332292[_0xd72f('0x31')];this[_0xd72f('0xc')][_0x332292[_0xd72f('0x20')]][_0xd72f('0x32')]=_0x332292['transferrate'];this['channels'][_0x332292[_0xd72f('0x20')]][_0xd72f('0x33')]=_0x332292[_0xd72f('0x33')];this['channels'][_0x332292[_0xd72f('0x20')]][_0xd72f('0x34')]=_0x332292[_0xd72f('0x34')];if(this[_0xd72f('0xc')][_0x332292['uniqueid']][_0xd72f('0x30')]>0x0){tiff2pdf(_0x332292[_0xd72f('0x33')],_0xd72f('0x35'),function(_0x3ec977){logger[_0xd72f('0x24')](_0x332292[_0xd72f('0x20')],_0xd72f('0x36'),_0x3ec977['message']);attachment['create']({'name':path['parse'](_0x332292[_0xd72f('0x33')])[_0xd72f('0x22')],'basename':path[_0xd72f('0x37')](_0x332292[_0xd72f('0x33')])[_0xd72f('0x22')]+_0xd72f('0x38'),'type':_0xd72f('0x39')})[_0xd72f('0x3a')](function(_0x9e69ec){faxAccount[_0xd72f('0x3b')](_0x5057ce,{'from':_0x332292[_0xd72f('0x34')],'mapKey':'fax','body':path[_0xd72f('0x37')](_0x332292[_0xd72f('0x33')])['name']+_0xd72f('0x38'),'AttachmentId':_0x9e69ec['id']})[_0xd72f('0x3c')](function(_0x1ce1ae){logger[_0xd72f('0x3d')](_0x332292[_0xd72f('0x20')],'\x20notify\x20',JSON[_0xd72f('0x3e')](_0x1ce1ae));});})[_0xd72f('0x3c')](function(_0x40d4a4){logger['error'](_0x332292[_0xd72f('0x20')],_0xd72f('0x3f'),JSON['stringify'](_0x40d4a4));});});}logger[_0xd72f('0x24')](_0x332292[_0xd72f('0x20')],_0xd72f('0x3f'));}};Fax['prototype'][_0xd72f('0x1a')]=function(_0x354dea){if(this[_0xd72f('0xf')][_0x354dea['uniqueid']]){_[_0xd72f('0x40')](this['channels'][_0x354dea[_0xd72f('0x20')]],_['pick'](_0x354dea,[_0xd72f('0x41'),_0xd72f('0x42')]));}};function updateStatus(_0x462833){if(_0x462833[_0xd72f('0x43')]){faxMessage[_0xd72f('0x44')](_0x462833[_0xd72f('0x43')],{'failMessage':_0xd72f('0x45')})['then'](function(_0x290d38){ut[_0xd72f('0x46')]('[Fax][Message][Error][Updated]',_0x290d38);})[_0xd72f('0x3c')](function(_0x2a61cc){ut[_0xd72f('0x46')](_0xd72f('0x47'),_0x2a61cc);});}else{ut['logger'](_0xd72f('0x48'));}}Fax[_0xd72f('0x25')][_0xd72f('0x49')]=function(_0x4c3c16,_0x196d40,_0x439169){var _0x2d76bd=this;var _0x3cbe87={};if(_0x196d40){_0x3cbe87={'read':_0x196d40};}else{_0x3cbe87={'failMessage':_0x439169};}if(this[_0xd72f('0xf')][_0x4c3c16][_0xd72f('0x43')]){faxMessage[_0xd72f('0x44')](this[_0xd72f('0xf')][_0x4c3c16][_0xd72f('0x43')],_0x3cbe87)[_0xd72f('0x3a')](function(_0x568777){ut[_0xd72f('0x46')](_0xd72f('0x4a'),_0x568777);})['catch'](function(_0x2e030b){ut[_0xd72f('0x46')](_0xd72f('0x4b'),_0x2e030b);})['finally'](function(){delete _0x2d76bd[_0xd72f('0xc')][_0x4c3c16];delete _0x2d76bd[_0xd72f('0xf')][_0x4c3c16];});}else{ut[_0xd72f('0x46')](_0xd72f('0x4c'));delete this[_0xd72f('0xc')][_0x4c3c16];delete this['actions'][_0x4c3c16];}};Fax[_0xd72f('0x25')][_0xd72f('0x18')]=function(_0x21605e){var _0xeb84bc=this;if(this[_0xd72f('0xc')][_0x21605e[_0xd72f('0x20')]]){if(this[_0xd72f('0xf')][_0x21605e[_0xd72f('0x20')]]){this['channels'][_0x21605e[_0xd72f('0x20')]]['id']=this['actions'][_0x21605e['uniqueid']]['id'];this[_0xd72f('0xc')][_0x21605e[_0xd72f('0x20')]]['name']=this['actions'][_0x21605e['uniqueid']][_0xd72f('0x22')];}logger[_0xd72f('0x24')](_0x21605e['uniqueid'],this[_0xd72f('0xf')][_0x21605e[_0xd72f('0x20')]]?_0xd72f('0x4d'):_0xd72f('0x4e'),JSON[_0xd72f('0x3e')](this[_0xd72f('0xc')][_0x21605e[_0xd72f('0x20')]]));if(this[_0xd72f('0xf')][_0x21605e[_0xd72f('0x20')]]){if(this['channels'][_0x21605e['uniqueid']]['faxpages']>0x0&&this[_0xd72f('0xc')][_0x21605e[_0xd72f('0x20')]][_0xd72f('0x15')]===_0xd72f('0x4f')){this['updateStatus'](_0x21605e[_0xd72f('0x20')],!![]);}else{this['updateStatus'](_0x21605e[_0xd72f('0x20')],![],this['channels'][_0x21605e[_0xd72f('0x20')]][_0xd72f('0x50')]?_0xd72f('0x51')+this[_0xd72f('0xc')][_0x21605e[_0xd72f('0x20')]][_0xd72f('0x50')]:_0xd72f('0x52'));}}}};Fax[_0xd72f('0x25')]['send']=function(_0x3f9a10){var _0x29f99f=this;return new BPromise(function(_0x32bfca,_0x393433){_0x29f99f[_0xd72f('0x53')](_0x3f9a10,_0x29f99f[_0xd72f('0xd')][_0x3f9a10[_0xd72f('0x54')]])[_0xd72f('0x3a')](function(_0x28c5d5){ut[_0xd72f('0x46')](_0xd72f('0x55'),_0x28c5d5);_0x32bfca(ut[_0xd72f('0x56')]('Fax\x20received'));})[_0xd72f('0x3c')](function(_0x258ca3){ut[_0xd72f('0x46')]('[Fax][execOriginate][failure]',_0x258ca3);updateStatus(_0x3f9a10);_0x393433(ut[_0xd72f('0x56')](_0xd72f('0x57')));});});};Fax['prototype'][_0xd72f('0x58')]=function(_0x22fd5e){var _0x2172ae=this;return new BPromise(function(_0x2649d8,_0x101cc5){var _0xfc199f=_0x2172ae[_0xd72f('0x59')](_0x2172ae[_0xd72f('0xd')][_0x22fd5e[_0xd72f('0x54')]][_0xd72f('0x5a')],_0x22fd5e);if(_0xfc199f[_0xd72f('0x5b')]){_0x2649d8(ut[_0xd72f('0x56')](_0xd72f('0x5c')));}else{_0x101cc5(ut[_0xd72f('0x56')](_0xfc199f[_0xd72f('0x56')]));}});};function originate(_0x5e1658,_0x557594,_0x468a26){return new BPromise(function(_0x31b206,_0x223995){if(_0x468a26){var _0x4ebdcf=util[_0xd72f('0x5d')](_0xd72f('0x5e'),path[_0xd72f('0x37')](_0x5e1658['path'])[_0xd72f('0x22')],_0x5e1658['path']);gs['execute'](_0x4ebdcf)[_0xd72f('0x3a')](function(){_0x5e1658['path']=util[_0xd72f('0x5d')](_0xd72f('0x5f'),path['parse'](_0x5e1658[_0xd72f('0x4')])[_0xd72f('0x60')],path['parse'](_0x5e1658[_0xd72f('0x4')])[_0xd72f('0x22')]);_0x557594['XMF-PATH']=_0x5e1658['path'];ut[_0xd72f('0x46')](_0xd72f('0x61'),'');ami[_0xd72f('0x62')](ut['variablesAction'](_0x5e1658,_0x557594))[_0xd72f('0x3a')](function(_0x5d3b9d){_0x31b206(_0x5d3b9d);})[_0xd72f('0x3c')](function(_0x350528){_0x223995(_0x350528);});})[_0xd72f('0x3c')](function(_0x2b8e19){_0x223995(_0x2b8e19);});}else{ami[_0xd72f('0x62')](ut[_0xd72f('0x63')](_0x5e1658,_0x557594))[_0xd72f('0x3a')](function(_0x36701a){_0x31b206(_0x36701a);})[_0xd72f('0x3c')](function(_0x1f4f3c){_0x223995(_0x1f4f3c);});}});}Fax['prototype'][_0xd72f('0x53')]=function(_0x98942a,_0x2b11fa){var _0x4cc190=this;return new BPromise(function(_0x357ede,_0x217b78){var _0x5a025f=uuid['v4']();var _0x2d18ef=ut[_0xd72f('0x64')](_0x98942a,_0x2b11fa);_0x4cc190[_0xd72f('0xf')][_0x5a025f]=new Action(_0x5a025f,_0x2b11fa,_0x98942a);var _0x4b4d55=_0x4cc190[_0xd72f('0xf')][_0x5a025f];if(path[_0xd72f('0x37')](_0x98942a['path'])[_0xd72f('0x65')]===_0xd72f('0x38')){originate(_0x4b4d55,_0x2d18ef,!![])[_0xd72f('0x3a')](function(_0x55d0f0){_0x357ede(_0x55d0f0);})[_0xd72f('0x3c')](function(_0x381d48){_0x217b78(_0x381d48);});}else{originate(_0x4b4d55,_0x2d18ef,![])[_0xd72f('0x3a')](function(_0x36d468){_0x357ede(_0x36d468);})[_0xd72f('0x3c')](function(_0x41935b){_0x217b78(_0x41935b);});}});};Fax[_0xd72f('0x25')]['isTrunkReachable']=function(_0x4ce1e9){return!_[_0xd72f('0x66')](_0x4ce1e9)&&!_[_0xd72f('0x66')](_0x4ce1e9[_0xd72f('0x22')])&&!_[_0xd72f('0x66')](_0x4ce1e9[_0xd72f('0x67')])&&_0x4ce1e9[_0xd72f('0x67')]&&!_[_0xd72f('0x66')](this[_0xd72f('0xe')][util['format'](_0xd72f('0x68'),_0x4ce1e9[_0xd72f('0x22')])])&&!_[_0xd72f('0x66')](this[_0xd72f('0xe')][util[_0xd72f('0x5d')](_0xd72f('0x68'),_0x4ce1e9['name'])][_0xd72f('0x2d')])&&(this['trunks'][util[_0xd72f('0x5d')]('SIP/%s',_0x4ce1e9[_0xd72f('0x22')])]['status']==='reachable'||this[_0xd72f('0xe')][util['format'](_0xd72f('0x68'),_0x4ce1e9[_0xd72f('0x22')])][_0xd72f('0x2d')]===_0xd72f('0x69'));};Fax[_0xd72f('0x25')]['checkTrunk']=function(_0x4e9965,_0x5ab2a6){if(!this[_0xd72f('0x6a')](_0x4e9965)){ut[_0xd72f('0x46')](_0xd72f('0x6b'),_['isNil'](_0x4e9965)?'':_0x4e9965['name']+_0xd72f('0x6c'));return{'isValid':![],'message':_0xd72f('0x6d')};}if(_[_0xd72f('0x66')](_0x5ab2a6[_0xd72f('0x6e')])){ut[_0xd72f('0x46')](_0xd72f('0x6f'),JSON[_0xd72f('0x3e')](_0x5ab2a6));return{'isValid':![],'message':_0xd72f('0x70')};}if(_[_0xd72f('0x66')](_0x5ab2a6['path'])){ut[_0xd72f('0x46')]('[Fax][checkTrunk][Empty\x20path]',JSON[_0xd72f('0x3e')](_0x5ab2a6));return{'isValid':![],'message':_0xd72f('0x71')};}return{'isValid':!![],'message':_0xd72f('0x72')};};module[_0xd72f('0x73')]=Fax; \ No newline at end of file diff --git a/server/services/ami/fax/rpcDb.js b/server/services/ami/fax/rpcDb.js index d061f32..cdc7ff2 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 _0xf874=['[Notify]\x20','util','bluebird','../../../config/logger','../rpc/faxAccount','error','notify','catch'];(function(_0x127dd5,_0x5c2d19){var _0xca248=function(_0x1362a3){while(--_0x1362a3){_0x127dd5['push'](_0x127dd5['shift']());}};_0xca248(++_0x5c2d19);}(_0xf874,0x109));var _0x4f87=function(_0x3905c0,_0x598e4f){_0x3905c0=_0x3905c0-0x0;var _0x3868c4=_0xf874[_0x3905c0];return _0x3868c4;};'use strict';var util=require(_0x4f87('0x0'));var BPromise=require(_0x4f87('0x1'));var logger=require(_0x4f87('0x2'))('preview');var _=require('lodash');var faxAccount=require(_0x4f87('0x3'));function loggerCatch(_0x237466){return function(_0x41f25b){logger[_0x4f87('0x4')](_0x237466,util['inspect'](_0x41f25b,{'showHidden':![],'depth':null}));};}exports['notify']=function(_0x4a4f63,_0x338957){return BPromise['resolve']()['then'](faxAccount[_0x4f87('0x5')](_0x4a4f63,_0x338957))[_0x4f87('0x6')](loggerCatch(_0x4f87('0x7')));}; \ No newline at end of file +var _0x1aac=['util','../../../config/logger','preview','../rpc/faxAccount','error','inspect','resolve','then','notify','[Notify]\x20'];(function(_0xecd81f,_0x2d14a4){var _0x44f49d=function(_0x2a6e3d){while(--_0x2a6e3d){_0xecd81f['push'](_0xecd81f['shift']());}};_0x44f49d(++_0x2d14a4);}(_0x1aac,0x1f4));var _0xc1aa=function(_0x3c4fd9,_0x54f64d){_0x3c4fd9=_0x3c4fd9-0x0;var _0x8c723=_0x1aac[_0x3c4fd9];return _0x8c723;};'use strict';var util=require(_0xc1aa('0x0'));var BPromise=require('bluebird');var logger=require(_0xc1aa('0x1'))(_0xc1aa('0x2'));var _=require('lodash');var faxAccount=require(_0xc1aa('0x3'));function loggerCatch(_0x2fc4e7){return function(_0x350221){logger[_0xc1aa('0x4')](_0x2fc4e7,util[_0xc1aa('0x5')](_0x350221,{'showHidden':![],'depth':null}));};}exports['notify']=function(_0x21a82d,_0x1b29e6){return BPromise[_0xc1aa('0x6')]()[_0xc1aa('0x7')](faxAccount[_0xc1aa('0x8')](_0x21a82d,_0x1b29e6))['catch'](loggerCatch(_0xc1aa('0x9')));}; \ 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 1e0d386..869df7a 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 _0x7003=['inspect','util','../../../../config/logger','fax','bluebird','child_process','exec','execute','info','Exec\x20gs','\x20Error\x20:'];(function(_0x286bfb,_0x46ac3c){var _0x52b683=function(_0x3e7fb1){while(--_0x3e7fb1){_0x286bfb['push'](_0x286bfb['shift']());}};_0x52b683(++_0x46ac3c);}(_0x7003,0x182));var _0x3700=function(_0xa30766,_0x6f613e){_0xa30766=_0xa30766-0x0;var _0x24e780=_0x7003[_0xa30766];return _0x24e780;};'use strict';var util=require(_0x3700('0x0'));var logger=require(_0x3700('0x1'))(_0x3700('0x2'));var BPromise=require(_0x3700('0x3'));var exec=require(_0x3700('0x4'))[_0x3700('0x5')];exports[_0x3700('0x6')]=function(_0x5799db){return new BPromise(function(_0x4e0dbe,_0x3d93b6){exec(_0x5799db,function(_0x29e027,_0x3adce1,_0x50bc78){logger[_0x3700('0x7')](_0x3700('0x8'),_0x3adce1);if(_0x29e027){logger[_0x3700('0x7')](_0x3700('0x8'),_0x3700('0x9'),util[_0x3700('0xa')](_0x29e027,{'showHidden':![],'depth':null}),_0x3adce1,_0x50bc78);_0x3d93b6(_0x29e027);}_0x4e0dbe(_0x3adce1);});});}; \ No newline at end of file +var _0x9a12=['child_process','info','Exec\x20gs','inspect','util','../../../../config/logger','fax','bluebird'];(function(_0x551c59,_0x3236a5){var _0x5ca2de=function(_0x2a75c2){while(--_0x2a75c2){_0x551c59['push'](_0x551c59['shift']());}};_0x5ca2de(++_0x3236a5);}(_0x9a12,0x124));var _0x29a1=function(_0x30f89e,_0x439e3d){_0x30f89e=_0x30f89e-0x0;var _0x17b7ef=_0x9a12[_0x30f89e];return _0x17b7ef;};'use strict';var util=require(_0x29a1('0x0'));var logger=require(_0x29a1('0x1'))(_0x29a1('0x2'));var BPromise=require(_0x29a1('0x3'));var exec=require(_0x29a1('0x4'))['exec'];exports['execute']=function(_0xdcc8c4){return new BPromise(function(_0x17e3b7,_0x3476fe){exec(_0xdcc8c4,function(_0x1617f2,_0x2b12e5,_0xa2fa62){logger[_0x29a1('0x5')](_0x29a1('0x6'),_0x2b12e5);if(_0x1617f2){logger[_0x29a1('0x5')](_0x29a1('0x6'),'\x20Error\x20:',util[_0x29a1('0x7')](_0x1617f2,{'showHidden':![],'depth':null}),_0x2b12e5,_0xa2fa62);_0x3476fe(_0x1617f2);}_0x17e3b7(_0x2b12e5);});});}; \ 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 af0d317..f313108 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 _0xec56=['xcally-motion-fax','from-sip','\x22%s\x22\x20<%s>','util','../../../../config/logger','fax','message','logger','info','inspect','addVariables','ecm','headerinfo','minrate','maxrate','format','\x22%s\x22','gateway','faxdetect','t38timeout','localstationid','path','variablesAction','uniqueid','originate','channel'];(function(_0x29e3ec,_0x138a18){var _0x25727e=function(_0x2bea0d){while(--_0x2bea0d){_0x29e3ec['push'](_0x29e3ec['shift']());}};_0x25727e(++_0x138a18);}(_0xec56,0x1bd));var _0x6ec5=function(_0x4ba271,_0x14bc28){_0x4ba271=_0x4ba271-0x0;var _0x415577=_0xec56[_0x4ba271];return _0x415577;};'use strict';var util=require(_0x6ec5('0x0'));var _=require('lodash');var moment=require('moment');var logger=require(_0x6ec5('0x1'))(_0x6ec5('0x2'));exports[_0x6ec5('0x3')]=function(_0x240ccf){return{'message':_0x240ccf};};exports[_0x6ec5('0x4')]=function(_0x399441,_0x469679){logger[_0x6ec5('0x5')](_0x399441,util[_0x6ec5('0x6')](_0x469679,{'showHidden':![],'depth':null}));};exports[_0x6ec5('0x7')]=function(_0x2d0a93,_0x3bb683){var _0x35be4e={'XMF-ECM':_0x3bb683[_0x6ec5('0x8')],'XMF-HEADERINFO':_0x3bb683[_0x6ec5('0x9')],'XMF-MINRATE':_0x3bb683[_0x6ec5('0xa')],'XMF-MAXRATE':_0x3bb683[_0x6ec5('0xb')],'XMF-MODEM':util[_0x6ec5('0xc')](_0x6ec5('0xd'),_0x3bb683['modem']),'XMF-GATEWAY':_0x3bb683[_0x6ec5('0xe')],'XMF-FAXDETECT':_0x3bb683[_0x6ec5('0xf')],'XMF-T38TIMEOUT':_0x3bb683[_0x6ec5('0x10')],'XMF-LOCALSTATIONID':_0x3bb683[_0x6ec5('0x11')],'XMF-PATH':_0x2d0a93[_0x6ec5('0x12')]};return _0x35be4e;};exports[_0x6ec5('0x13')]=function(_0x1d5b76,_0x50eb2d){return{'actionid':_0x1d5b76[_0x6ec5('0x14')],'action':_0x6ec5('0x15'),'channel':_0x1d5b76[_0x6ec5('0x16')],'Exten':_0x6ec5('0x17'),'Context':_0x6ec5('0x18'),'Priority':'1','callerid':util[_0x6ec5('0xc')](_0x6ec5('0x19'),_0x1d5b76[_0x6ec5('0x9')]?_0x1d5b76['headerinfo']:'',_0x1d5b76[_0x6ec5('0x11')]),'variable':_0x50eb2d,'timeout':0x1e*0x3e8,'async':!![],'channelid':_0x1d5b76['uniqueid']};}; \ No newline at end of file +var _0x6324=['ecm','headerinfo','minrate','format','\x22%s\x22','faxdetect','t38timeout','localstationid','path','variablesAction','uniqueid','channel','from-sip','\x22%s\x22\x20<%s>','util','lodash','moment','../../../../config/logger','message','logger','inspect','addVariables'];(function(_0x58bfa3,_0x2568a0){var _0x5327ef=function(_0x7ae951){while(--_0x7ae951){_0x58bfa3['push'](_0x58bfa3['shift']());}};_0x5327ef(++_0x2568a0);}(_0x6324,0x142));var _0x4632=function(_0x5b9ac9,_0x374422){_0x5b9ac9=_0x5b9ac9-0x0;var _0x7e6db3=_0x6324[_0x5b9ac9];return _0x7e6db3;};'use strict';var util=require(_0x4632('0x0'));var _=require(_0x4632('0x1'));var moment=require(_0x4632('0x2'));var logger=require(_0x4632('0x3'))('fax');exports[_0x4632('0x4')]=function(_0x48e508){return{'message':_0x48e508};};exports[_0x4632('0x5')]=function(_0x54c200,_0x13b218){logger['info'](_0x54c200,util[_0x4632('0x6')](_0x13b218,{'showHidden':![],'depth':null}));};exports[_0x4632('0x7')]=function(_0x1f3077,_0x126e9a){var _0x4a15b2={'XMF-ECM':_0x126e9a[_0x4632('0x8')],'XMF-HEADERINFO':_0x126e9a[_0x4632('0x9')],'XMF-MINRATE':_0x126e9a[_0x4632('0xa')],'XMF-MAXRATE':_0x126e9a['maxrate'],'XMF-MODEM':util[_0x4632('0xb')](_0x4632('0xc'),_0x126e9a['modem']),'XMF-GATEWAY':_0x126e9a['gateway'],'XMF-FAXDETECT':_0x126e9a[_0x4632('0xd')],'XMF-T38TIMEOUT':_0x126e9a[_0x4632('0xe')],'XMF-LOCALSTATIONID':_0x126e9a[_0x4632('0xf')],'XMF-PATH':_0x1f3077[_0x4632('0x10')]};return _0x4a15b2;};exports[_0x4632('0x11')]=function(_0xe28f38,_0x1b2729){return{'actionid':_0xe28f38[_0x4632('0x12')],'action':'originate','channel':_0xe28f38[_0x4632('0x13')],'Exten':'xcally-motion-fax','Context':_0x4632('0x14'),'Priority':'1','callerid':util[_0x4632('0xb')](_0x4632('0x15'),_0xe28f38[_0x4632('0x9')]?_0xe28f38['headerinfo']:'',_0xe28f38[_0x4632('0xf')]),'variable':_0x1b2729,'timeout':0x1e*0x3e8,'async':!![],'channelid':_0xe28f38[_0x4632('0x12')]};}; \ No newline at end of file diff --git a/server/services/ami/index.js b/server/services/ami/index.js index bb318af..d1c68d4 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 _0xd32c=['./report','./trigger','./dialer','./preview','./fax','./rpc/user','./rpc/voiceQueue','./rpc/voiceCallReport','./rpc/trunk','./rpc/trigger','./rpc/template','./rpc/cmHopperHistory','./rpc/campaign','./rpc/voiceExtension','./rpc/faxAccount','./rpc/integrations/zendesk','./rpc/integrations/salesforce','./rpc/integrations/sugarcrm','./rpc/integrations/freshdesk','./rpc/integrations/desk','./rpc/integrations/zoho','./rpc/integrations/vtiger','./rpc/integrations/freshsales','./rpc/integrations/servicenow','get','hour','resolve','then','initAgents','getTelephones','initTelephones','getTrunks','initTrunks','getVoiceQueues','initVoiceQueues','getTriggers','initTriggers','initTemplates','getZendeskAccounts','initZendeskAccounts','getSalesforceAccounts','initSalesforceAccounts','initSugarcrmAccounts','initFreshdeskAccounts','getDeskAccounts','initDeskAccounts','getZohoAccounts','getVtigerAccounts','initVtigerAccounts','getFreshsalesAccounts','initFreshsalesAccounts','getServicenowAccounts','initServicenowAccounts','getDynamics365Accounts','getCampaigns','initVoiceExtensions','getFaxAccounts','initVoiceQueueReports','getVoiceQueueHopperHistory','getCampaignHopperHistory','initVoiceCallReports','listen','sync','catch','log','bluebird','util','moment','./server','./realtime'];(function(_0x7780ad,_0x4a3fa1){var _0x2f0e78=function(_0x375de5){while(--_0x375de5){_0x7780ad['push'](_0x7780ad['shift']());}};_0x2f0e78(++_0x4a3fa1);}(_0xd32c,0x113));var _0xcd32=function(_0x2f938f,_0x923379){_0x2f938f=_0x2f938f-0x0;var _0x360c98=_0xd32c[_0x2f938f];return _0x360c98;};'use strict';var BPromise=require(_0xcd32('0x0'));var util=require(_0xcd32('0x1'));var moment=require(_0xcd32('0x2'));var server=require(_0xcd32('0x3'));var Realtime=require(_0xcd32('0x4'));var Report=require(_0xcd32('0x5'));var Acw=require('./acw');var Trigger=require(_0xcd32('0x6'));var Dialer=require(_0xcd32('0x7'));var Preview=require(_0xcd32('0x8'));var Fax=require(_0xcd32('0x9'));var user=require(_0xcd32('0xa'));var voiceQueue=require(_0xcd32('0xb'));var voiceQueueReport=require('./rpc/voiceQueueReport');var voiceCallReport=require(_0xcd32('0xc'));var trunk=require(_0xcd32('0xd'));var trigger=require(_0xcd32('0xe'));var template=require(_0xcd32('0xf'));var cmHopperHistory=require(_0xcd32('0x10'));var campaign=require(_0xcd32('0x11'));var voiceExtension=require(_0xcd32('0x12'));var faxAccount=require(_0xcd32('0x13'));var zendesk=require(_0xcd32('0x14'));var salesforce=require(_0xcd32('0x15'));var sugarcrm=require(_0xcd32('0x16'));var freshdesk=require(_0xcd32('0x17'));var desk=require(_0xcd32('0x18'));var zoho=require(_0xcd32('0x19'));var vtiger=require(_0xcd32('0x1a'));var freshsales=require(_0xcd32('0x1b'));var servicenow=require(_0xcd32('0x1c'));var dynamics365=require('./rpc/integrations/dynamics365');var realtime=new Realtime();var report=new Report(realtime);var acw=new Acw(realtime);var channelTrigger=new Trigger(realtime);var preview=new Preview(realtime);var dialer=new Dialer(realtime,preview);var fax=new Fax(realtime);var isTrue=!![];var initP=!![];function ifMidnight(){if(moment()[_0xcd32('0x1d')](_0xcd32('0x1e'))===0x0&&initP){initP=![];isTrue=!![];initParams();}if(moment()['get'](_0xcd32('0x1e'))===0x1&&isTrue){isTrue=![];initP=!![];}}function initRealtime(){ifMidnight();return BPromise[_0xcd32('0x1f')]()[_0xcd32('0x20')](user['getAgents']())['then'](realtime[_0xcd32('0x21')]())['then'](user[_0xcd32('0x22')]())['then'](realtime[_0xcd32('0x23')]())[_0xcd32('0x20')](trunk[_0xcd32('0x24')]())[_0xcd32('0x20')](realtime[_0xcd32('0x25')]())[_0xcd32('0x20')](voiceQueue[_0xcd32('0x26')]())[_0xcd32('0x20')](realtime[_0xcd32('0x27')]())['then'](trigger[_0xcd32('0x28')]())[_0xcd32('0x20')](realtime[_0xcd32('0x29')]())[_0xcd32('0x20')](template['getTemplates']())[_0xcd32('0x20')](realtime[_0xcd32('0x2a')]())[_0xcd32('0x20')](zendesk[_0xcd32('0x2b')]())['then'](realtime[_0xcd32('0x2c')]())[_0xcd32('0x20')](salesforce[_0xcd32('0x2d')]())[_0xcd32('0x20')](realtime[_0xcd32('0x2e')]())['then'](sugarcrm['getSugarcrmAccounts']())[_0xcd32('0x20')](realtime[_0xcd32('0x2f')]())['then'](freshdesk['getFreshdeskAccounts']())[_0xcd32('0x20')](realtime[_0xcd32('0x30')]())['then'](desk[_0xcd32('0x31')]())['then'](realtime[_0xcd32('0x32')]())['then'](zoho[_0xcd32('0x33')]())['then'](realtime['initZohoAccounts']())[_0xcd32('0x20')](vtiger[_0xcd32('0x34')]())['then'](realtime[_0xcd32('0x35')]())['then'](freshsales[_0xcd32('0x36')]())[_0xcd32('0x20')](realtime[_0xcd32('0x37')]())[_0xcd32('0x20')](servicenow[_0xcd32('0x38')]())[_0xcd32('0x20')](realtime[_0xcd32('0x39')]())[_0xcd32('0x20')](dynamics365[_0xcd32('0x3a')]())[_0xcd32('0x20')](realtime['initDynamics365Accounts']())['then'](campaign[_0xcd32('0x3b')]())[_0xcd32('0x20')](realtime['initCampaigns']())[_0xcd32('0x20')](voiceExtension['getVoiceExtensions']())[_0xcd32('0x20')](realtime[_0xcd32('0x3c')]())[_0xcd32('0x20')](faxAccount[_0xcd32('0x3d')]())[_0xcd32('0x20')](realtime['initFaxAccounts']())['then'](function(){return realtime;});}function initParams(){return BPromise[_0xcd32('0x1f')]()['then'](voiceQueueReport['getVoiceQueueReports']())[_0xcd32('0x20')](realtime[_0xcd32('0x3e')]())[_0xcd32('0x20')](cmHopperHistory[_0xcd32('0x3f')]())['then'](realtime['initVoiceQueueHopperHistory']())[_0xcd32('0x20')](cmHopperHistory[_0xcd32('0x40')]())['then'](realtime['initCampaignHopperHistory']())[_0xcd32('0x20')](voiceCallReport['getVoiceCallReports']())[_0xcd32('0x20')](realtime[_0xcd32('0x41')]())[_0xcd32('0x20')](function(_0xd61a05){})['catch'](function(_0x10455c){console['log'](_0x10455c);});}function main(){return server[_0xcd32('0x42')](realtime,preview,fax)['then'](function(_0x4539ed){return initRealtime();})[_0xcd32('0x20')](function(){return initParams();})[_0xcd32('0x20')](function(){report[_0xcd32('0x43')]();setInterval(initRealtime,0x1388);})[_0xcd32('0x44')](function(_0x189a61){console[_0xcd32('0x45')](_0x189a61);});}main(); \ No newline at end of file +var _0x1193=['getDeskAccounts','initDeskAccounts','initZohoAccounts','getFreshsalesAccounts','initFreshsalesAccounts','getServicenowAccounts','initDynamics365Accounts','getCampaigns','initCampaigns','getFaxAccounts','initFaxAccounts','resolve','getVoiceQueueReports','initVoiceQueueReports','getVoiceQueueHopperHistory','initCampaignHopperHistory','getVoiceCallReports','initVoiceCallReports','catch','log','listen','sync','bluebird','moment','./realtime','./acw','./trigger','./dialer','./preview','./rpc/user','./rpc/voiceQueue','./rpc/voiceQueueReport','./rpc/voiceCallReport','./rpc/trigger','./rpc/template','./rpc/cmHopperHistory','./rpc/campaign','./rpc/voiceExtension','./rpc/faxAccount','./rpc/integrations/zendesk','./rpc/integrations/salesforce','./rpc/integrations/sugarcrm','./rpc/integrations/freshdesk','./rpc/integrations/zoho','./rpc/integrations/freshsales','./rpc/integrations/servicenow','./rpc/integrations/dynamics365','get','hour','then','getAgents','initAgents','getTelephones','initTelephones','getTrunks','initTrunks','getVoiceQueues','initVoiceQueues','getTriggers','getTemplates','getZendeskAccounts','initZendeskAccounts','getSugarcrmAccounts','initSugarcrmAccounts','getFreshdeskAccounts','initFreshdeskAccounts'];(function(_0x35af9b,_0x5861a8){var _0x39c136=function(_0x41d9fc){while(--_0x41d9fc){_0x35af9b['push'](_0x35af9b['shift']());}};_0x39c136(++_0x5861a8);}(_0x1193,0x160));var _0x3119=function(_0x3bdc67,_0x4e4f0d){_0x3bdc67=_0x3bdc67-0x0;var _0x127237=_0x1193[_0x3bdc67];return _0x127237;};'use strict';var BPromise=require(_0x3119('0x0'));var util=require('util');var moment=require(_0x3119('0x1'));var server=require('./server');var Realtime=require(_0x3119('0x2'));var Report=require('./report');var Acw=require(_0x3119('0x3'));var Trigger=require(_0x3119('0x4'));var Dialer=require(_0x3119('0x5'));var Preview=require(_0x3119('0x6'));var Fax=require('./fax');var user=require(_0x3119('0x7'));var voiceQueue=require(_0x3119('0x8'));var voiceQueueReport=require(_0x3119('0x9'));var voiceCallReport=require(_0x3119('0xa'));var trunk=require('./rpc/trunk');var trigger=require(_0x3119('0xb'));var template=require(_0x3119('0xc'));var cmHopperHistory=require(_0x3119('0xd'));var campaign=require(_0x3119('0xe'));var voiceExtension=require(_0x3119('0xf'));var faxAccount=require(_0x3119('0x10'));var zendesk=require(_0x3119('0x11'));var salesforce=require(_0x3119('0x12'));var sugarcrm=require(_0x3119('0x13'));var freshdesk=require(_0x3119('0x14'));var desk=require('./rpc/integrations/desk');var zoho=require(_0x3119('0x15'));var vtiger=require('./rpc/integrations/vtiger');var freshsales=require(_0x3119('0x16'));var servicenow=require(_0x3119('0x17'));var dynamics365=require(_0x3119('0x18'));var realtime=new Realtime();var report=new Report(realtime);var acw=new Acw(realtime);var channelTrigger=new Trigger(realtime);var preview=new Preview(realtime);var dialer=new Dialer(realtime,preview);var fax=new Fax(realtime);var isTrue=!![];var initP=!![];function ifMidnight(){if(moment()[_0x3119('0x19')](_0x3119('0x1a'))===0x0&&initP){initP=![];isTrue=!![];initParams();}if(moment()[_0x3119('0x19')](_0x3119('0x1a'))===0x1&&isTrue){isTrue=![];initP=!![];}}function initRealtime(){ifMidnight();return BPromise['resolve']()[_0x3119('0x1b')](user[_0x3119('0x1c')]())[_0x3119('0x1b')](realtime[_0x3119('0x1d')]())[_0x3119('0x1b')](user[_0x3119('0x1e')]())[_0x3119('0x1b')](realtime[_0x3119('0x1f')]())['then'](trunk[_0x3119('0x20')]())[_0x3119('0x1b')](realtime[_0x3119('0x21')]())[_0x3119('0x1b')](voiceQueue[_0x3119('0x22')]())['then'](realtime[_0x3119('0x23')]())[_0x3119('0x1b')](trigger[_0x3119('0x24')]())['then'](realtime['initTriggers']())[_0x3119('0x1b')](template[_0x3119('0x25')]())[_0x3119('0x1b')](realtime['initTemplates']())['then'](zendesk[_0x3119('0x26')]())[_0x3119('0x1b')](realtime[_0x3119('0x27')]())[_0x3119('0x1b')](salesforce['getSalesforceAccounts']())[_0x3119('0x1b')](realtime['initSalesforceAccounts']())[_0x3119('0x1b')](sugarcrm[_0x3119('0x28')]())[_0x3119('0x1b')](realtime[_0x3119('0x29')]())[_0x3119('0x1b')](freshdesk[_0x3119('0x2a')]())[_0x3119('0x1b')](realtime[_0x3119('0x2b')]())[_0x3119('0x1b')](desk[_0x3119('0x2c')]())[_0x3119('0x1b')](realtime[_0x3119('0x2d')]())[_0x3119('0x1b')](zoho['getZohoAccounts']())['then'](realtime[_0x3119('0x2e')]())['then'](vtiger['getVtigerAccounts']())[_0x3119('0x1b')](realtime['initVtigerAccounts']())[_0x3119('0x1b')](freshsales[_0x3119('0x2f')]())[_0x3119('0x1b')](realtime[_0x3119('0x30')]())['then'](servicenow[_0x3119('0x31')]())[_0x3119('0x1b')](realtime['initServicenowAccounts']())[_0x3119('0x1b')](dynamics365['getDynamics365Accounts']())[_0x3119('0x1b')](realtime[_0x3119('0x32')]())[_0x3119('0x1b')](campaign[_0x3119('0x33')]())[_0x3119('0x1b')](realtime[_0x3119('0x34')]())[_0x3119('0x1b')](voiceExtension['getVoiceExtensions']())[_0x3119('0x1b')](realtime['initVoiceExtensions']())[_0x3119('0x1b')](faxAccount[_0x3119('0x35')]())[_0x3119('0x1b')](realtime[_0x3119('0x36')]())[_0x3119('0x1b')](function(){return realtime;});}function initParams(){return BPromise[_0x3119('0x37')]()[_0x3119('0x1b')](voiceQueueReport[_0x3119('0x38')]())['then'](realtime[_0x3119('0x39')]())[_0x3119('0x1b')](cmHopperHistory[_0x3119('0x3a')]())[_0x3119('0x1b')](realtime['initVoiceQueueHopperHistory']())['then'](cmHopperHistory['getCampaignHopperHistory']())['then'](realtime[_0x3119('0x3b')]())[_0x3119('0x1b')](voiceCallReport[_0x3119('0x3c')]())[_0x3119('0x1b')](realtime[_0x3119('0x3d')]())['then'](function(_0x4e6bf3){})[_0x3119('0x3e')](function(_0x1cca87){console[_0x3119('0x3f')](_0x1cca87);});}function main(){return server[_0x3119('0x40')](realtime,preview,fax)['then'](function(_0x5065ef){return initRealtime();})[_0x3119('0x1b')](function(){return initParams();})[_0x3119('0x1b')](function(){report[_0x3119('0x41')]();setInterval(initRealtime,0x1388);})[_0x3119('0x3e')](function(_0x2a6d54){console[_0x3119('0x3f')](_0x2a6d54);});}main(); \ No newline at end of file diff --git a/server/services/ami/model/agent.js b/server/services/ami/model/agent.js index 1dcc0f9..f03af04 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 _0x4a6a=['not_inuse','idle','talking','statePause','toNumber','format','fullname','stateTime','voiceStatusCallerIdNumber','voiceStatusQueue','interface','onhold','stringify','emit','user:save','exports','util','moment','md5','redis','localhost','socket.io-emitter','name','email','accountcode','state','unknown','status','address','phone','mobile','online','voiceStatus','voiceStatusTime','prototype','toLowerCase'];(function(_0x146837,_0x2aa6a2){var _0x3d7e60=function(_0x1301ac){while(--_0x1301ac){_0x146837['push'](_0x146837['shift']());}};_0x3d7e60(++_0x2aa6a2);}(_0x4a6a,0x7c));var _0xa4a6=function(_0x4e3b6a,_0x33c04d){_0x4e3b6a=_0x4e3b6a-0x0;var _0xaca3f2=_0x4a6a[_0x4e3b6a];return _0xaca3f2;};'use strict';var _=require('lodash');var util=require(_0xa4a6('0x0'));var moment=require(_0xa4a6('0x1'));var md5=require(_0xa4a6('0x2'));var Redis=require('ioredis');var config=require('../../../config/environment');config[_0xa4a6('0x3')]=_['defaults'](config[_0xa4a6('0x3')],{'host':_0xa4a6('0x4'),'port':0x18eb});var io=require(_0xa4a6('0x5'))(new Redis(config[_0xa4a6('0x3')]));function Agent(_0x1bdc59){this['id']=_0x1bdc59['id']||0x0;this['name']=_0x1bdc59[_0xa4a6('0x6')]||'';this['email']=_0x1bdc59[_0xa4a6('0x7')]||'';this[_0xa4a6('0x8')]=_0x1bdc59['accountcode']||'';this['fullname']=_0x1bdc59['fullname']||'';this[_0xa4a6('0x9')]=_0xa4a6('0xa');this['stateTime']=0x0;this[_0xa4a6('0xb')]=_0xa4a6('0xa');this[_0xa4a6('0xc')]='';this[_0xa4a6('0xd')]='';this[_0xa4a6('0xe')]='';this['interface']='';this[_0xa4a6('0xf')]=_0x1bdc59[_0xa4a6('0xf')]||![];this[_0xa4a6('0x10')]=_0xa4a6('0xa');this[_0xa4a6('0x11')]=0x0;this['voiceStatusCallerIdNumber']='';this['voiceStatusQueue']='';this['onhold']=![];this['local']=![];this[_0xa4a6('0x2')]='';}Agent[_0xa4a6('0x12')]['updateStatusRealtime']=function(_0x28167e){var _0x58630c;if(_0x28167e&&_0x28167e['state']){_0x58630c=_0x28167e[_0xa4a6('0x9')][_0xa4a6('0x13')]();switch(_0x58630c){case _0xa4a6('0x14'):_0x58630c=_0xa4a6('0x15');break;case'inuse':_0x58630c=_0xa4a6('0x16');break;}}if(_0x58630c&&this[_0xa4a6('0x10')]!==_0x58630c||_0x28167e[_0xa4a6('0x17')]){this[_0xa4a6('0x11')]=_[_0xa4a6('0x18')](moment()[_0xa4a6('0x19')]('x'));}if(_0x58630c){this['voiceStatus']=_0x58630c;}var _0xc562a8={'id':this['id'],'name':this[_0xa4a6('0x6')],'email':this[_0xa4a6('0x7')],'accountcode':this[_0xa4a6('0x8')],'fullname':this[_0xa4a6('0x1a')],'state':this[_0xa4a6('0x9')],'stateTime':this[_0xa4a6('0x1b')],'status':this['status'],'address':this[_0xa4a6('0xc')],'online':this[_0xa4a6('0xf')],'voiceStatus':this['voiceStatus'],'voiceStatusTime':this[_0xa4a6('0x11')],'voiceStatusCallerIdNumber':this[_0xa4a6('0x1c')],'voiceStatusQueue':this[_0xa4a6('0x1d')],'interface':this[_0xa4a6('0x1e')],'onhold':this[_0xa4a6('0x1f')]};var _0x3611be=md5(JSON[_0xa4a6('0x20')](_0xc562a8));if(this[_0xa4a6('0x2')]!==_0x3611be){this['md5']=_0x3611be;io['to'](util[_0xa4a6('0x19')]('user:%s',_0xc562a8[_0xa4a6('0x6')]))[_0xa4a6('0x21')](_0xa4a6('0x22'),_0xc562a8);}};module[_0xa4a6('0x23')]=Agent; \ No newline at end of file +var _0x8926=['redis','localhost','socket.io-emitter','name','email','accountcode','fullname','state','unknown','status','address','online','voiceStatus','voiceStatusTime','voiceStatusCallerIdNumber','voiceStatusQueue','prototype','toLowerCase','not_inuse','idle','inuse','talking','toNumber','format','onhold','stringify','user:%s','lodash','util','md5','ioredis','../../../config/environment','defaults'];(function(_0x4efca9,_0x7ef4c5){var _0xf249af=function(_0x535720){while(--_0x535720){_0x4efca9['push'](_0x4efca9['shift']());}};_0xf249af(++_0x7ef4c5);}(_0x8926,0x186));var _0x6892=function(_0x30a75f,_0x1ebfe7){_0x30a75f=_0x30a75f-0x0;var _0x64a76f=_0x8926[_0x30a75f];return _0x64a76f;};'use strict';var _=require(_0x6892('0x0'));var util=require(_0x6892('0x1'));var moment=require('moment');var md5=require(_0x6892('0x2'));var Redis=require(_0x6892('0x3'));var config=require(_0x6892('0x4'));config['redis']=_[_0x6892('0x5')](config[_0x6892('0x6')],{'host':_0x6892('0x7'),'port':0x18eb});var io=require(_0x6892('0x8'))(new Redis(config[_0x6892('0x6')]));function Agent(_0x67b945){this['id']=_0x67b945['id']||0x0;this['name']=_0x67b945[_0x6892('0x9')]||'';this[_0x6892('0xa')]=_0x67b945[_0x6892('0xa')]||'';this[_0x6892('0xb')]=_0x67b945['accountcode']||'';this[_0x6892('0xc')]=_0x67b945['fullname']||'';this[_0x6892('0xd')]=_0x6892('0xe');this['stateTime']=0x0;this[_0x6892('0xf')]=_0x6892('0xe');this[_0x6892('0x10')]='';this['phone']='';this['mobile']='';this['interface']='';this[_0x6892('0x11')]=_0x67b945[_0x6892('0x11')]||![];this[_0x6892('0x12')]=_0x6892('0xe');this[_0x6892('0x13')]=0x0;this[_0x6892('0x14')]='';this[_0x6892('0x15')]='';this['onhold']=![];this['local']=![];this[_0x6892('0x2')]='';}Agent[_0x6892('0x16')]['updateStatusRealtime']=function(_0x59c1fa){var _0x4d4f51;if(_0x59c1fa&&_0x59c1fa[_0x6892('0xd')]){_0x4d4f51=_0x59c1fa[_0x6892('0xd')][_0x6892('0x17')]();switch(_0x4d4f51){case _0x6892('0x18'):_0x4d4f51=_0x6892('0x19');break;case _0x6892('0x1a'):_0x4d4f51=_0x6892('0x1b');break;}}if(_0x4d4f51&&this[_0x6892('0x12')]!==_0x4d4f51||_0x59c1fa['statePause']){this['voiceStatusTime']=_[_0x6892('0x1c')](moment()[_0x6892('0x1d')]('x'));}if(_0x4d4f51){this['voiceStatus']=_0x4d4f51;}var _0x51de09={'id':this['id'],'name':this['name'],'email':this[_0x6892('0xa')],'accountcode':this[_0x6892('0xb')],'fullname':this[_0x6892('0xc')],'state':this[_0x6892('0xd')],'stateTime':this['stateTime'],'status':this[_0x6892('0xf')],'address':this[_0x6892('0x10')],'online':this[_0x6892('0x11')],'voiceStatus':this[_0x6892('0x12')],'voiceStatusTime':this[_0x6892('0x13')],'voiceStatusCallerIdNumber':this[_0x6892('0x14')],'voiceStatusQueue':this[_0x6892('0x15')],'interface':this['interface'],'onhold':this[_0x6892('0x1e')]};var _0x26aeba=md5(JSON[_0x6892('0x1f')](_0x51de09));if(this[_0x6892('0x2')]!==_0x26aeba){this[_0x6892('0x2')]=_0x26aeba;io['to'](util[_0x6892('0x1d')](_0x6892('0x20'),_0x51de09['name']))['emit']('user:save',_0x51de09);}};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 8963b7e..b23ddd4 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 _0xb7e7=['dialAMDSilenceThreshold','name','type','originated','ivrAnswerCallsDay','ivrTotalCallsDays','message','active','limitCalls','dialTimezone','dialGlobalInterval','dialOriginateCallerIdName','dialOriginateCallerIdNumber','dialOriginateTimeout','dialCongestionMaxRetry','dialCongestionRetryFrequency','dialBusyMaxRetry','dialBusyRetryFrequency','dialNoAnswerMaxRetry','dialNoAnswerRetryFrequency','dialOrderByScheduledAt','DESC','dialPrefix','dialCutDigit','TrunkBackup','Trunk','Interval','SquareProject','dialQueueProject','dialAMDActive','dialAMDInitialSilence','dialAMDGreeting','dialAMDAfterGreetingSilence','dialAMDTotalAnalysisTime','dialAMDMinWordLength','dialAMDMaximumNumberOfWords'];(function(_0x40927b,_0xf9b0a0){var _0x2635e8=function(_0x1f2b8c){while(--_0x1f2b8c){_0x40927b['push'](_0x40927b['shift']());}};_0x2635e8(++_0xf9b0a0);}(_0xb7e7,0x121));var _0x7b7e=function(_0x432fca,_0xb0b1b5){_0x432fca=_0x432fca-0x0;var _0x3adba4=_0xb7e7[_0x432fca];return _0x3adba4;};'use strict';function Campaign(_0x2e5e07){this['id']=_0x2e5e07['id']||0x0;this['name']=_0x2e5e07[_0x7b7e('0x0')]||'';this['type']=_0x2e5e07[_0x7b7e('0x1')]||'campaign';this[_0x7b7e('0x2')]=0x0;this['temp']=0x0;this[_0x7b7e('0x3')]=0x0;this[_0x7b7e('0x4')]=0x0;this[_0x7b7e('0x5')]='';this['sendMessageOneNotActive']=!![];this['active']=_0x2e5e07[_0x7b7e('0x6')];this[_0x7b7e('0x7')]=_0x2e5e07[_0x7b7e('0x7')];this['dialTimezone']=_0x2e5e07[_0x7b7e('0x8')]||null;this[_0x7b7e('0x9')]=_0x2e5e07[_0x7b7e('0x9')]?_0x2e5e07[_0x7b7e('0x9')]:null;this[_0x7b7e('0xa')]=_0x2e5e07[_0x7b7e('0xa')];this[_0x7b7e('0xb')]=_0x2e5e07['dialOriginateCallerIdNumber'];this[_0x7b7e('0xc')]=_0x2e5e07[_0x7b7e('0xc')]||0x1e;this[_0x7b7e('0xd')]=_0x2e5e07[_0x7b7e('0xd')];this[_0x7b7e('0xe')]=_0x2e5e07[_0x7b7e('0xe')];this[_0x7b7e('0xf')]=_0x2e5e07[_0x7b7e('0xf')];this[_0x7b7e('0x10')]=_0x2e5e07['dialBusyRetryFrequency'];this[_0x7b7e('0x11')]=_0x2e5e07[_0x7b7e('0x11')];this['dialNoAnswerRetryFrequency']=_0x2e5e07[_0x7b7e('0x12')];this['dialGlobalMaxRetry']=_0x2e5e07['dialGlobalMaxRetry'];this[_0x7b7e('0x13')]=_0x2e5e07[_0x7b7e('0x13')]||_0x7b7e('0x14');this[_0x7b7e('0x15')]=_0x2e5e07[_0x7b7e('0x15')]||undefined;this['dialRandomLastDigitCallerIdNumber']=_0x2e5e07['dialRandomLastDigitCallerIdNumber']||undefined;this[_0x7b7e('0x16')]=_0x2e5e07[_0x7b7e('0x16')]||undefined;this[_0x7b7e('0x17')]=_0x2e5e07[_0x7b7e('0x17')]?_0x2e5e07[_0x7b7e('0x17')]:undefined;this[_0x7b7e('0x18')]=_0x2e5e07[_0x7b7e('0x18')]?_0x2e5e07[_0x7b7e('0x18')]:undefined;this[_0x7b7e('0x19')]=_0x2e5e07[_0x7b7e('0x19')]?_0x2e5e07[_0x7b7e('0x19')]:undefined;this[_0x7b7e('0x1a')]=_0x2e5e07[_0x7b7e('0x1a')]?_0x2e5e07[_0x7b7e('0x1a')]:undefined;this[_0x7b7e('0x1b')]=_0x2e5e07[_0x7b7e('0x1a')]?_0x2e5e07[_0x7b7e('0x1a')]['name']:undefined;this[_0x7b7e('0x1c')]=_0x2e5e07[_0x7b7e('0x1c')]||![];this[_0x7b7e('0x1d')]=_0x2e5e07['dialAMDInitialSilence'];this[_0x7b7e('0x1e')]=_0x2e5e07[_0x7b7e('0x1e')];this[_0x7b7e('0x1f')]=_0x2e5e07[_0x7b7e('0x1f')];this[_0x7b7e('0x20')]=_0x2e5e07[_0x7b7e('0x20')];this[_0x7b7e('0x21')]=_0x2e5e07[_0x7b7e('0x21')];this['dialAMDBetweenWordsSilence']=_0x2e5e07['dialAMDBetweenWordsSilence'];this['dialAMDMaximumNumberOfWords']=_0x2e5e07[_0x7b7e('0x22')];this[_0x7b7e('0x23')]=_0x2e5e07[_0x7b7e('0x23')];this['dialAMDMaximumWordLength']=_0x2e5e07['dialAMDMaximumWordLength'];}module['exports']=Campaign; \ No newline at end of file +var _0x2032=['ivrTotalCallsDays','message','sendMessageOneNotActive','active','limitCalls','dialTimezone','dialGlobalInterval','dialOriginateCallerIdName','dialOriginateCallerIdNumber','dialOriginateTimeout','dialCongestionMaxRetry','dialCongestionRetryFrequency','dialBusyMaxRetry','dialNoAnswerRetryFrequency','dialOrderByScheduledAt','DESC','dialPrefix','dialRandomLastDigitCallerIdNumber','dialCutDigit','TrunkBackup','Trunk','Interval','SquareProject','dialQueueProject','dialAMDActive','dialAMDGreeting','dialAMDAfterGreetingSilence','dialAMDTotalAnalysisTime','dialAMDBetweenWordsSilence','dialAMDMaximumNumberOfWords','dialAMDSilenceThreshold','dialAMDMaximumWordLength','name','type','campaign','originated','ivrAnswerCallsDay'];(function(_0x5ba2f9,_0x565ecb){var _0x499aa9=function(_0xc33c9a){while(--_0xc33c9a){_0x5ba2f9['push'](_0x5ba2f9['shift']());}};_0x499aa9(++_0x565ecb);}(_0x2032,0xd9));var _0x2203=function(_0xb6207f,_0x5873f9){_0xb6207f=_0xb6207f-0x0;var _0x32c2a2=_0x2032[_0xb6207f];return _0x32c2a2;};'use strict';function Campaign(_0x4d6c97){this['id']=_0x4d6c97['id']||0x0;this[_0x2203('0x0')]=_0x4d6c97[_0x2203('0x0')]||'';this[_0x2203('0x1')]=_0x4d6c97['type']||_0x2203('0x2');this[_0x2203('0x3')]=0x0;this['temp']=0x0;this[_0x2203('0x4')]=0x0;this[_0x2203('0x5')]=0x0;this[_0x2203('0x6')]='';this[_0x2203('0x7')]=!![];this[_0x2203('0x8')]=_0x4d6c97[_0x2203('0x8')];this[_0x2203('0x9')]=_0x4d6c97[_0x2203('0x9')];this[_0x2203('0xa')]=_0x4d6c97[_0x2203('0xa')]||null;this[_0x2203('0xb')]=_0x4d6c97['dialGlobalInterval']?_0x4d6c97['dialGlobalInterval']:null;this[_0x2203('0xc')]=_0x4d6c97['dialOriginateCallerIdName'];this[_0x2203('0xd')]=_0x4d6c97[_0x2203('0xd')];this[_0x2203('0xe')]=_0x4d6c97['dialOriginateTimeout']||0x1e;this[_0x2203('0xf')]=_0x4d6c97['dialCongestionMaxRetry'];this[_0x2203('0x10')]=_0x4d6c97['dialCongestionRetryFrequency'];this[_0x2203('0x11')]=_0x4d6c97[_0x2203('0x11')];this['dialBusyRetryFrequency']=_0x4d6c97['dialBusyRetryFrequency'];this['dialNoAnswerMaxRetry']=_0x4d6c97['dialNoAnswerMaxRetry'];this['dialNoAnswerRetryFrequency']=_0x4d6c97[_0x2203('0x12')];this['dialGlobalMaxRetry']=_0x4d6c97['dialGlobalMaxRetry'];this[_0x2203('0x13')]=_0x4d6c97[_0x2203('0x13')]||_0x2203('0x14');this[_0x2203('0x15')]=_0x4d6c97[_0x2203('0x15')]||undefined;this[_0x2203('0x16')]=_0x4d6c97[_0x2203('0x16')]||undefined;this[_0x2203('0x17')]=_0x4d6c97[_0x2203('0x17')]||undefined;this[_0x2203('0x18')]=_0x4d6c97['TrunkBackup']?_0x4d6c97[_0x2203('0x18')]:undefined;this[_0x2203('0x19')]=_0x4d6c97['Trunk']?_0x4d6c97[_0x2203('0x19')]:undefined;this[_0x2203('0x1a')]=_0x4d6c97['Interval']?_0x4d6c97[_0x2203('0x1a')]:undefined;this['SquareProject']=_0x4d6c97[_0x2203('0x1b')]?_0x4d6c97[_0x2203('0x1b')]:undefined;this[_0x2203('0x1c')]=_0x4d6c97[_0x2203('0x1b')]?_0x4d6c97[_0x2203('0x1b')][_0x2203('0x0')]:undefined;this['dialAMDActive']=_0x4d6c97[_0x2203('0x1d')]||![];this['dialAMDInitialSilence']=_0x4d6c97['dialAMDInitialSilence'];this[_0x2203('0x1e')]=_0x4d6c97['dialAMDGreeting'];this[_0x2203('0x1f')]=_0x4d6c97[_0x2203('0x1f')];this['dialAMDTotalAnalysisTime']=_0x4d6c97[_0x2203('0x20')];this['dialAMDMinWordLength']=_0x4d6c97['dialAMDMinWordLength'];this[_0x2203('0x21')]=_0x4d6c97[_0x2203('0x21')];this[_0x2203('0x22')]=_0x4d6c97[_0x2203('0x22')];this[_0x2203('0x23')]=_0x4d6c97[_0x2203('0x23')];this[_0x2203('0x24')]=_0x4d6c97[_0x2203('0x24')];}module['exports']=Campaign; \ No newline at end of file diff --git a/server/services/ami/model/channel.js b/server/services/ami/model/channel.js index ab947e5..73879dc 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 _0xd5c8=['monitor','monitorFilename','queue','monitors','transfercalleridnum','transferconnectedlinenum','mohtime','exports','destinationchannel','calleridnum','calleridname','connectedlinenum','connectedlinename','accountcode','context','uniqueid','linkedid','answered','unmanaged','abandoned','lastapplication','lastdata','holdtime','tag','disposition'];(function(_0x2c7d3a,_0x301bfb){var _0x75e377=function(_0x409795){while(--_0x409795){_0x2c7d3a['push'](_0x2c7d3a['shift']());}};_0x75e377(++_0x301bfb);}(_0xd5c8,0x166));var _0x8d5c=function(_0x360739,_0x2ec1b2){_0x360739=_0x360739-0x0;var _0x3e23a1=_0xd5c8[_0x360739];return _0x3e23a1;};'use strict';function Channel(){this['starttime']=null;this['channel']='';this[_0x8d5c('0x0')]='';this[_0x8d5c('0x1')]=0x0;this[_0x8d5c('0x2')]='';this[_0x8d5c('0x3')]=undefined;this[_0x8d5c('0x4')]=undefined;this[_0x8d5c('0x5')]=0x0;this[_0x8d5c('0x6')]='';this[_0x8d5c('0x7')]=0x0;this[_0x8d5c('0x8')]=0x0;this['exten']=0x0;this[_0x8d5c('0x9')]=![];this['answertime']=null;this['endtime']=null;this[_0x8d5c('0xa')]=![];this[_0x8d5c('0xb')]=![];this[_0x8d5c('0xc')]='';this[_0x8d5c('0xd')]='';this['duration']=0x0;this['billableseconds']=0x0;this[_0x8d5c('0xe')]=0x0;this['type']=null;this[_0x8d5c('0xf')]=null;this[_0x8d5c('0x10')]=null;this[_0x8d5c('0x11')]=![];this[_0x8d5c('0x12')]=null;this[_0x8d5c('0x13')]=null;this[_0x8d5c('0x14')]=[];this[_0x8d5c('0x15')]=undefined;this[_0x8d5c('0x16')]=undefined;this[_0x8d5c('0x17')]=0x0;}module[_0x8d5c('0x18')]=Channel; \ No newline at end of file +var _0xe367=['exports','starttime','channel','destinationchannel','connectedlinenum','connectedlinename','context','uniqueid','linkedid','answered','answertime','endtime','unmanaged','abandoned','lastapplication','lastdata','duration','billableseconds','holdtime','type','tag','disposition','monitor','queue','monitors','transfercalleridnum','transferconnectedlinenum'];(function(_0x2c26e0,_0x19621c){var _0xfced50=function(_0x71d999){while(--_0x71d999){_0x2c26e0['push'](_0x2c26e0['shift']());}};_0xfced50(++_0x19621c);}(_0xe367,0x10f));var _0x7e36=function(_0x59ee6f,_0x450239){_0x59ee6f=_0x59ee6f-0x0;var _0x4c0979=_0xe367[_0x59ee6f];return _0x4c0979;};'use strict';function Channel(){this[_0x7e36('0x0')]=null;this[_0x7e36('0x1')]='';this[_0x7e36('0x2')]='';this['calleridnum']=0x0;this['calleridname']='';this[_0x7e36('0x3')]=undefined;this[_0x7e36('0x4')]=undefined;this['accountcode']=0x0;this[_0x7e36('0x5')]='';this[_0x7e36('0x6')]=0x0;this[_0x7e36('0x7')]=0x0;this['exten']=0x0;this[_0x7e36('0x8')]=![];this[_0x7e36('0x9')]=null;this[_0x7e36('0xa')]=null;this[_0x7e36('0xb')]=![];this[_0x7e36('0xc')]=![];this[_0x7e36('0xd')]='';this[_0x7e36('0xe')]='';this[_0x7e36('0xf')]=0x0;this[_0x7e36('0x10')]=0x0;this[_0x7e36('0x11')]=0x0;this[_0x7e36('0x12')]=null;this[_0x7e36('0x13')]=null;this[_0x7e36('0x14')]=null;this[_0x7e36('0x15')]=![];this['monitorFilename']=null;this[_0x7e36('0x16')]=null;this[_0x7e36('0x17')]=[];this[_0x7e36('0x18')]=undefined;this[_0x7e36('0x19')]=undefined;this['mohtime']=0x0;}module[_0x7e36('0x1a')]=Channel; \ No newline at end of file diff --git a/server/services/ami/model/deskAccount.js b/server/services/ami/model/deskAccount.js index d2147eb..e25ef89 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 _0x43fd=['remoteUri','authType','password','consumerKey','consumerSecret','token','tokenSecret','type','serverUrl','Configurations','exports','name','username'];(function(_0x41ad40,_0x2b1d2d){var _0x499b8d=function(_0xaefa35){while(--_0xaefa35){_0x41ad40['push'](_0x41ad40['shift']());}};_0x499b8d(++_0x2b1d2d);}(_0x43fd,0x1ec));var _0xd43f=function(_0x2ce039,_0xf0abed){_0x2ce039=_0x2ce039-0x0;var _0x1b6dbb=_0x43fd[_0x2ce039];return _0x1b6dbb;};'use strict';function DeskAccount(_0xa81b26){this['id']=_0xa81b26['id']||0x0;this[_0xd43f('0x0')]=_0xa81b26['name']||'';this['username']=_0xa81b26[_0xd43f('0x1')]||'';this[_0xd43f('0x2')]=_0xa81b26['remoteUri']||'';this[_0xd43f('0x3')]=_0xa81b26['authType']||'';this[_0xd43f('0x4')]=_0xa81b26[_0xd43f('0x4')]||'';this[_0xd43f('0x5')]=_0xa81b26[_0xd43f('0x5')]||'';this['consumerSecret']=_0xa81b26[_0xd43f('0x6')]||'';this[_0xd43f('0x7')]=_0xa81b26[_0xd43f('0x7')]||'';this[_0xd43f('0x8')]=_0xa81b26['tokenSecret']||'';this[_0xd43f('0x9')]=_0xa81b26[_0xd43f('0x9')]||'';this['serverUrl']=_0xa81b26[_0xd43f('0xa')]||'';this[_0xd43f('0xb')]=_0xa81b26[_0xd43f('0xb')]||{};}module[_0xd43f('0xc')]=DeskAccount; \ No newline at end of file +var _0xfd7b=['remoteUri','authType','password','consumerKey','consumerSecret','token','tokenSecret','type','serverUrl','Configurations','exports','name','username'];(function(_0x480292,_0x43ef35){var _0x1523a4=function(_0x3b6dcf){while(--_0x3b6dcf){_0x480292['push'](_0x480292['shift']());}};_0x1523a4(++_0x43ef35);}(_0xfd7b,0x1df));var _0xbfd7=function(_0x2a7b8e,_0x50ffce){_0x2a7b8e=_0x2a7b8e-0x0;var _0x29b5c8=_0xfd7b[_0x2a7b8e];return _0x29b5c8;};'use strict';function DeskAccount(_0x3cf772){this['id']=_0x3cf772['id']||0x0;this[_0xbfd7('0x0')]=_0x3cf772[_0xbfd7('0x0')]||'';this[_0xbfd7('0x1')]=_0x3cf772[_0xbfd7('0x1')]||'';this[_0xbfd7('0x2')]=_0x3cf772[_0xbfd7('0x2')]||'';this[_0xbfd7('0x3')]=_0x3cf772[_0xbfd7('0x3')]||'';this[_0xbfd7('0x4')]=_0x3cf772[_0xbfd7('0x4')]||'';this[_0xbfd7('0x5')]=_0x3cf772[_0xbfd7('0x5')]||'';this[_0xbfd7('0x6')]=_0x3cf772['consumerSecret']||'';this[_0xbfd7('0x7')]=_0x3cf772['token']||'';this[_0xbfd7('0x8')]=_0x3cf772['tokenSecret']||'';this[_0xbfd7('0x9')]=_0x3cf772[_0xbfd7('0x9')]||'';this[_0xbfd7('0xa')]=_0x3cf772[_0xbfd7('0xa')]||'';this['Configurations']=_0x3cf772[_0xbfd7('0xb')]||{};}module[_0xbfd7('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 1817304..7dfae81 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 _0xc7bd=['username','password','remoteUri','tenantId','clientId','clientSecret','serverUrl','Configurations','exports','name'];(function(_0x427362,_0x5331b5){var _0x4dbd92=function(_0x2a1ce6){while(--_0x2a1ce6){_0x427362['push'](_0x427362['shift']());}};_0x4dbd92(++_0x5331b5);}(_0xc7bd,0x15d));var _0xdc7b=function(_0x27c5ec,_0x197350){_0x27c5ec=_0x27c5ec-0x0;var _0xf1e07=_0xc7bd[_0x27c5ec];return _0xf1e07;};'use strict';function Dynamics365Account(_0x499db8){this['id']=_0x499db8['id']||0x0;this[_0xdc7b('0x0')]=_0x499db8[_0xdc7b('0x0')]||'';this[_0xdc7b('0x1')]=_0x499db8['username']||'';this[_0xdc7b('0x2')]=_0x499db8[_0xdc7b('0x2')]||'';this[_0xdc7b('0x3')]=_0x499db8[_0xdc7b('0x3')]||'';this[_0xdc7b('0x4')]=_0x499db8[_0xdc7b('0x4')]||'';this[_0xdc7b('0x5')]=_0x499db8[_0xdc7b('0x5')]||'';this[_0xdc7b('0x6')]=_0x499db8[_0xdc7b('0x6')]||{};this[_0xdc7b('0x7')]=_0x499db8['serverUrl']||'';this[_0xdc7b('0x8')]=_0x499db8[_0xdc7b('0x8')]||{};}module[_0xdc7b('0x9')]=Dynamics365Account; \ No newline at end of file +var _0xfd7d=['clientId','clientSecret','serverUrl','Configurations','exports','name','username','password','remoteUri','tenantId'];(function(_0x4ff57f,_0x5196e2){var _0x4be2c9=function(_0x2e5293){while(--_0x2e5293){_0x4ff57f['push'](_0x4ff57f['shift']());}};_0x4be2c9(++_0x5196e2);}(_0xfd7d,0xeb));var _0xdfd7=function(_0x111614,_0x4a7ac4){_0x111614=_0x111614-0x0;var _0x2c958e=_0xfd7d[_0x111614];return _0x2c958e;};'use strict';function Dynamics365Account(_0x16d400){this['id']=_0x16d400['id']||0x0;this[_0xdfd7('0x0')]=_0x16d400['name']||'';this[_0xdfd7('0x1')]=_0x16d400['username']||'';this[_0xdfd7('0x2')]=_0x16d400['password']||'';this[_0xdfd7('0x3')]=_0x16d400[_0xdfd7('0x3')]||'';this['tenantId']=_0x16d400[_0xdfd7('0x4')]||'';this[_0xdfd7('0x5')]=_0x16d400[_0xdfd7('0x5')]||'';this[_0xdfd7('0x6')]=_0x16d400[_0xdfd7('0x6')]||{};this[_0xdfd7('0x7')]=_0x16d400[_0xdfd7('0x7')]||'';this['Configurations']=_0x16d400[_0xdfd7('0x8')]||{};}module[_0xdfd7('0x9')]=Dynamics365Account; \ No newline at end of file diff --git a/server/services/ami/model/faxAccount.js b/server/services/ami/model/faxAccount.js index dcae70c..1c15efe 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 _0x55e7=['v17,v27,v29','gateway','t38timeout','tech','Trunk','ListId','key','exports','name','description','ecm','headerinfo','localstationid','minrate','maxrate','modem'];(function(_0x2f5ac5,_0x1ee939){var _0x37c9a8=function(_0x15031f){while(--_0x15031f){_0x2f5ac5['push'](_0x2f5ac5['shift']());}};_0x37c9a8(++_0x1ee939);}(_0x55e7,0x138));var _0x755e=function(_0xb39305,_0x199451){_0xb39305=_0xb39305-0x0;var _0x2fdbc1=_0x55e7[_0xb39305];return _0x2fdbc1;};'use strict';function FaxAccount(_0x3e33a8){this['id']=_0x3e33a8['id']||0x0;this[_0x755e('0x0')]=_0x3e33a8[_0x755e('0x0')]||'';this[_0x755e('0x1')]=_0x3e33a8[_0x755e('0x1')];this['ecm']=_0x3e33a8[_0x755e('0x2')];this[_0x755e('0x3')]=_0x3e33a8[_0x755e('0x3')];this[_0x755e('0x4')]=_0x3e33a8[_0x755e('0x4')];this['minrate']=_0x3e33a8[_0x755e('0x5')]||0x960;this[_0x755e('0x6')]=_0x3e33a8[_0x755e('0x6')]||0x3840;this[_0x755e('0x7')]=_0x3e33a8[_0x755e('0x7')]||_0x755e('0x8');this[_0x755e('0x9')]=_0x3e33a8[_0x755e('0x9')]||'no';this['faxdetect']=_0x3e33a8['faxdetect']||'no';this[_0x755e('0xa')]=_0x3e33a8[_0x755e('0xa')]||0x1388;this['tech']=_0x3e33a8[_0x755e('0xb')]||'SIP';this['Trunk']=_0x3e33a8[_0x755e('0xc')]?_0x3e33a8[_0x755e('0xc')]:undefined;this[_0x755e('0xd')]=_0x3e33a8[_0x755e('0xd')];this[_0x755e('0xe')]=_0x3e33a8['key'];}module[_0x755e('0xf')]=FaxAccount; \ No newline at end of file +var _0x971c=['description','ecm','headerinfo','localstationid','maxrate','modem','v17,v27,v29','gateway','faxdetect','t38timeout','tech','SIP','Trunk','ListId','key','name'];(function(_0x3a262f,_0x32ca8c){var _0x4719b0=function(_0x144898){while(--_0x144898){_0x3a262f['push'](_0x3a262f['shift']());}};_0x4719b0(++_0x32ca8c);}(_0x971c,0xbf));var _0xc971=function(_0x491a7f,_0x28bb80){_0x491a7f=_0x491a7f-0x0;var _0x3d8f44=_0x971c[_0x491a7f];return _0x3d8f44;};'use strict';function FaxAccount(_0xf7f5cc){this['id']=_0xf7f5cc['id']||0x0;this['name']=_0xf7f5cc[_0xc971('0x0')]||'';this[_0xc971('0x1')]=_0xf7f5cc['description'];this[_0xc971('0x2')]=_0xf7f5cc[_0xc971('0x2')];this['headerinfo']=_0xf7f5cc[_0xc971('0x3')];this[_0xc971('0x4')]=_0xf7f5cc[_0xc971('0x4')];this['minrate']=_0xf7f5cc['minrate']||0x960;this[_0xc971('0x5')]=_0xf7f5cc[_0xc971('0x5')]||0x3840;this[_0xc971('0x6')]=_0xf7f5cc[_0xc971('0x6')]||_0xc971('0x7');this[_0xc971('0x8')]=_0xf7f5cc[_0xc971('0x8')]||'no';this['faxdetect']=_0xf7f5cc[_0xc971('0x9')]||'no';this[_0xc971('0xa')]=_0xf7f5cc[_0xc971('0xa')]||0x1388;this[_0xc971('0xb')]=_0xf7f5cc[_0xc971('0xb')]||_0xc971('0xc');this[_0xc971('0xd')]=_0xf7f5cc[_0xc971('0xd')]?_0xf7f5cc[_0xc971('0xd')]:undefined;this[_0xc971('0xe')]=_0xf7f5cc[_0xc971('0xe')];this[_0xc971('0xf')]=_0xf7f5cc[_0xc971('0xf')];}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 011ca04..f035b2a 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 _0x8284=['apiKey','token','remoteUri','serverUrl','Configurations','exports','name','username'];(function(_0x123411,_0x4d32cf){var _0x27e501=function(_0x18598e){while(--_0x18598e){_0x123411['push'](_0x123411['shift']());}};_0x27e501(++_0x4d32cf);}(_0x8284,0xe6));var _0x4828=function(_0xb782d5,_0x6b16c6){_0xb782d5=_0xb782d5-0x0;var _0x2728ce=_0x8284[_0xb782d5];return _0x2728ce;};'use strict';function FreshdeskAccount(_0x2207ba){this['id']=_0x2207ba['id']||0x0;this[_0x4828('0x0')]=_0x2207ba['name']||'';this['username']=_0x2207ba[_0x4828('0x1')]||'';this[_0x4828('0x2')]=_0x2207ba[_0x4828('0x3')]||'';this[_0x4828('0x4')]=_0x2207ba[_0x4828('0x4')]||'';this['serverUrl']=_0x2207ba[_0x4828('0x5')]||'';this['Configurations']=_0x2207ba[_0x4828('0x6')]||{};}module[_0x4828('0x7')]=FreshdeskAccount; \ No newline at end of file +var _0xb71b=['serverUrl','Configurations','exports','name','username','apiKey','token','remoteUri'];(function(_0x2c1aa8,_0x3e0609){var _0x4019f5=function(_0x916eac){while(--_0x916eac){_0x2c1aa8['push'](_0x2c1aa8['shift']());}};_0x4019f5(++_0x3e0609);}(_0xb71b,0x17b));var _0xbb71=function(_0x3128f0,_0x3ad7f0){_0x3128f0=_0x3128f0-0x0;var _0x9220de=_0xb71b[_0x3128f0];return _0x9220de;};'use strict';function FreshdeskAccount(_0x1e3c3e){this['id']=_0x1e3c3e['id']||0x0;this[_0xbb71('0x0')]=_0x1e3c3e['name']||'';this[_0xbb71('0x1')]=_0x1e3c3e['username']||'';this[_0xbb71('0x2')]=_0x1e3c3e[_0xbb71('0x3')]||'';this[_0xbb71('0x4')]=_0x1e3c3e[_0xbb71('0x4')]||'';this[_0xbb71('0x5')]=_0x1e3c3e[_0xbb71('0x5')]||'';this[_0xbb71('0x6')]=_0x1e3c3e[_0xbb71('0x6')]||{};}module[_0xbb71('0x7')]=FreshdeskAccount; \ No newline at end of file diff --git a/server/services/ami/model/freshsalesAccount.js b/server/services/ami/model/freshsalesAccount.js index 46480e3..97f2b6e 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 _0x7152=['remoteUri','serverUrl','Configurations','exports','name','username','apiKey','token'];(function(_0x25e7b2,_0x5a9a9a){var _0x562643=function(_0xbc5e2d){while(--_0xbc5e2d){_0x25e7b2['push'](_0x25e7b2['shift']());}};_0x562643(++_0x5a9a9a);}(_0x7152,0x114));var _0x2715=function(_0x3ad0bb,_0x2a7098){_0x3ad0bb=_0x3ad0bb-0x0;var _0x4359c6=_0x7152[_0x3ad0bb];return _0x4359c6;};'use strict';function FreshsalesAccount(_0x44dab6){this['id']=_0x44dab6['id']||0x0;this[_0x2715('0x0')]=_0x44dab6[_0x2715('0x0')]||'';this['username']=_0x44dab6[_0x2715('0x1')]||'';this[_0x2715('0x2')]=_0x44dab6[_0x2715('0x3')]||'';this[_0x2715('0x4')]=_0x44dab6[_0x2715('0x4')]||'';this[_0x2715('0x5')]=_0x44dab6['serverUrl']||'';this[_0x2715('0x6')]=_0x44dab6[_0x2715('0x6')]||{};}module[_0x2715('0x7')]=FreshsalesAccount; \ No newline at end of file +var _0xac1a=['apiKey','token','remoteUri','serverUrl','Configurations','exports','name','username'];(function(_0x432682,_0x253044){var _0x463d05=function(_0xa73403){while(--_0xa73403){_0x432682['push'](_0x432682['shift']());}};_0x463d05(++_0x253044);}(_0xac1a,0x156));var _0xaac1=function(_0x42bb28,_0xcc4136){_0x42bb28=_0x42bb28-0x0;var _0x1f115d=_0xac1a[_0x42bb28];return _0x1f115d;};'use strict';function FreshsalesAccount(_0x403be2){this['id']=_0x403be2['id']||0x0;this[_0xaac1('0x0')]=_0x403be2[_0xaac1('0x0')]||'';this[_0xaac1('0x1')]=_0x403be2[_0xaac1('0x1')]||'';this[_0xaac1('0x2')]=_0x403be2[_0xaac1('0x3')]||'';this['remoteUri']=_0x403be2[_0xaac1('0x4')]||'';this[_0xaac1('0x5')]=_0x403be2['serverUrl']||'';this[_0xaac1('0x6')]=_0x403be2[_0xaac1('0x6')]||{};}module[_0xaac1('0x7')]=FreshsalesAccount; \ No newline at end of file diff --git a/server/services/ami/model/queueReport.js b/server/services/ami/model/queueReport.js index 5a7e98d..bb68fc3 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 _0xebb0=['count','queuecallercomplete','queuecallercompleteAt','queuecallerexit','queuecallerexitAt','originalposition','channel','connectedlinenum','connectedlinename','accountcode','context','priority','holdtime','assigned','mohtime','variables','exports','type','calleridnum','calleridname','queue','queuecallerleaveAt','position'];(function(_0x54c8ed,_0x4ff37c){var _0x5bb93e=function(_0x2fd5c1){while(--_0x2fd5c1){_0x54c8ed['push'](_0x54c8ed['shift']());}};_0x5bb93e(++_0x4ff37c);}(_0xebb0,0xe0));var _0x0ebb=function(_0x1b0659,_0x586a89){_0x1b0659=_0x1b0659-0x0;var _0x1e3bf6=_0xebb0[_0x1b0659];return _0x1e3bf6;};'use strict';function QueueReport(){this[_0x0ebb('0x0')]='inbound';this['uniqueid']='';this[_0x0ebb('0x1')]='';this[_0x0ebb('0x2')]='';this[_0x0ebb('0x3')]='';this['queuecallerjoinAt']=null;this[_0x0ebb('0x4')]=null;this[_0x0ebb('0x5')]=0x1;this[_0x0ebb('0x6')]=0x1;this['queuecallerabandon']=![];this['queuecallerabandonAt']=null;this[_0x0ebb('0x7')]=![];this[_0x0ebb('0x8')]=null;this[_0x0ebb('0x9')]=![];this[_0x0ebb('0xa')]=null;this[_0x0ebb('0xb')]=0x1;this[_0x0ebb('0xc')]='';this[_0x0ebb('0xd')]='';this[_0x0ebb('0xe')]='';this[_0x0ebb('0xf')]='';this[_0x0ebb('0x10')]='';this['exten']='';this[_0x0ebb('0x11')]='';this[_0x0ebb('0x12')]=0x0;this[_0x0ebb('0x13')]=![];this['lastAssignedTo']='';this[_0x0ebb('0x14')]=0x0;this[_0x0ebb('0x15')]={};}module[_0x0ebb('0x16')]=QueueReport; \ No newline at end of file +var _0x0ac7=['queuecallerexit','channel','connectedlinenum','connectedlinename','exten','priority','holdtime','mohtime','exports','type','inbound','uniqueid','calleridnum','count','queuecallerabandon','queuecallerabandonAt','queuecallercompleteAt'];(function(_0x3a05b5,_0x669384){var _0x1760a0=function(_0x1064a9){while(--_0x1064a9){_0x3a05b5['push'](_0x3a05b5['shift']());}};_0x1760a0(++_0x669384);}(_0x0ac7,0x17f));var _0x70ac=function(_0x487705,_0x2c0735){_0x487705=_0x487705-0x0;var _0x4695a7=_0x0ac7[_0x487705];return _0x4695a7;};'use strict';function QueueReport(){this[_0x70ac('0x0')]=_0x70ac('0x1');this[_0x70ac('0x2')]='';this[_0x70ac('0x3')]='';this['calleridname']='';this['queue']='';this['queuecallerjoinAt']=null;this['queuecallerleaveAt']=null;this['position']=0x1;this[_0x70ac('0x4')]=0x1;this[_0x70ac('0x5')]=![];this[_0x70ac('0x6')]=null;this['queuecallercomplete']=![];this[_0x70ac('0x7')]=null;this[_0x70ac('0x8')]=![];this['queuecallerexitAt']=null;this['originalposition']=0x1;this[_0x70ac('0x9')]='';this[_0x70ac('0xa')]='';this[_0x70ac('0xb')]='';this['accountcode']='';this['context']='';this[_0x70ac('0xc')]='';this[_0x70ac('0xd')]='';this[_0x70ac('0xe')]=0x0;this['assigned']=![];this['lastAssignedTo']='';this[_0x70ac('0xf')]=0x0;this['variables']={};}module[_0x70ac('0x10')]=QueueReport; \ No newline at end of file diff --git a/server/services/ami/model/salesforceAccount.js b/server/services/ami/model/salesforceAccount.js index a3c0f79..1612185 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 _0x7a49=['exports','name','username','remoteUri','password','clientId','clientSecret','securityToken','type','integrationTab','Configurations'];(function(_0x2307fa,_0x266e5e){var _0x496486=function(_0x53466e){while(--_0x53466e){_0x2307fa['push'](_0x2307fa['shift']());}};_0x496486(++_0x266e5e);}(_0x7a49,0x1c4));var _0x97a4=function(_0x36b535,_0x121585){_0x36b535=_0x36b535-0x0;var _0x3affb4=_0x7a49[_0x36b535];return _0x3affb4;};'use strict';function SalesforceAccount(_0x461894){this['id']=_0x461894['id']||0x0;this[_0x97a4('0x0')]=_0x461894[_0x97a4('0x0')]||'';this[_0x97a4('0x1')]=_0x461894[_0x97a4('0x1')]||'';this['remoteUri']=_0x461894[_0x97a4('0x2')]||'';this[_0x97a4('0x3')]=_0x461894[_0x97a4('0x3')]||'';this['clientId']=_0x461894[_0x97a4('0x4')]||'';this[_0x97a4('0x5')]=_0x461894['clientSecret']||'';this['securityToken']=_0x461894[_0x97a4('0x6')]||'';this[_0x97a4('0x7')]=_0x461894['type']||_0x97a4('0x8');this['serverUrl']=_0x461894['serverUrl']||'';this[_0x97a4('0x9')]=_0x461894[_0x97a4('0x9')]||{};}module[_0x97a4('0xa')]=SalesforceAccount; \ No newline at end of file +var _0xd312=['securityToken','type','integrationTab','serverUrl','Configurations','exports','username','remoteUri','password','clientId','clientSecret'];(function(_0x230951,_0x4dad52){var _0xeb26b1=function(_0x25776c){while(--_0x25776c){_0x230951['push'](_0x230951['shift']());}};_0xeb26b1(++_0x4dad52);}(_0xd312,0x1be));var _0x2d31=function(_0x137eac,_0x3033fe){_0x137eac=_0x137eac-0x0;var _0x195371=_0xd312[_0x137eac];return _0x195371;};'use strict';function SalesforceAccount(_0x366ab0){this['id']=_0x366ab0['id']||0x0;this['name']=_0x366ab0['name']||'';this['username']=_0x366ab0[_0x2d31('0x0')]||'';this[_0x2d31('0x1')]=_0x366ab0[_0x2d31('0x1')]||'';this['password']=_0x366ab0[_0x2d31('0x2')]||'';this[_0x2d31('0x3')]=_0x366ab0['clientId']||'';this[_0x2d31('0x4')]=_0x366ab0[_0x2d31('0x4')]||'';this[_0x2d31('0x5')]=_0x366ab0[_0x2d31('0x5')]||'';this[_0x2d31('0x6')]=_0x366ab0['type']||_0x2d31('0x7');this[_0x2d31('0x8')]=_0x366ab0[_0x2d31('0x8')]||'';this[_0x2d31('0x9')]=_0x366ab0[_0x2d31('0x9')]||{};}module[_0x2d31('0xa')]=SalesforceAccount; \ No newline at end of file diff --git a/server/services/ami/model/servicenowAccount.js b/server/services/ami/model/servicenowAccount.js index 06e9b64..db9d8fe 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 _0x86fb=['username','password','remoteUri','serverUrl','Configurations','exports','name'];(function(_0x2da45d,_0x35397b){var _0x1012a0=function(_0x2babc3){while(--_0x2babc3){_0x2da45d['push'](_0x2da45d['shift']());}};_0x1012a0(++_0x35397b);}(_0x86fb,0xa0));var _0xb86f=function(_0x18c0db,_0x5ee1bd){_0x18c0db=_0x18c0db-0x0;var _0xf89886=_0x86fb[_0x18c0db];return _0xf89886;};'use strict';function ServicenowAccount(_0x15a04d){this['id']=_0x15a04d['id']||0x0;this[_0xb86f('0x0')]=_0x15a04d[_0xb86f('0x0')]||'';this['username']=_0x15a04d[_0xb86f('0x1')]||'';this[_0xb86f('0x2')]=_0x15a04d[_0xb86f('0x2')]||'';this[_0xb86f('0x3')]=_0x15a04d[_0xb86f('0x3')]||'';this['serverUrl']=_0x15a04d[_0xb86f('0x4')]||'';this[_0xb86f('0x5')]=_0x15a04d['Configurations']||{};}module[_0xb86f('0x6')]=ServicenowAccount; \ No newline at end of file +var _0x5b22=['exports','name','username','password','remoteUri','serverUrl','Configurations'];(function(_0x46aff0,_0x122890){var _0x9d78cf=function(_0x3f14cb){while(--_0x3f14cb){_0x46aff0['push'](_0x46aff0['shift']());}};_0x9d78cf(++_0x122890);}(_0x5b22,0x19e));var _0x25b2=function(_0x51556e,_0xd9afb9){_0x51556e=_0x51556e-0x0;var _0x3ed1b5=_0x5b22[_0x51556e];return _0x3ed1b5;};'use strict';function ServicenowAccount(_0x27a2b5){this['id']=_0x27a2b5['id']||0x0;this[_0x25b2('0x0')]=_0x27a2b5['name']||'';this[_0x25b2('0x1')]=_0x27a2b5[_0x25b2('0x1')]||'';this[_0x25b2('0x2')]=_0x27a2b5[_0x25b2('0x2')]||'';this['remoteUri']=_0x27a2b5[_0x25b2('0x3')]||'';this[_0x25b2('0x4')]=_0x27a2b5[_0x25b2('0x4')]||'';this[_0x25b2('0x5')]=_0x27a2b5[_0x25b2('0x5')]||{};}module[_0x25b2('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 c66f73e..1261491 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 _0xf559=['password','remoteUri','serverUrl','Configurations','exports','name','username'];(function(_0x137f0b,_0x4bce9e){var _0x324acb=function(_0x2145b2){while(--_0x2145b2){_0x137f0b['push'](_0x137f0b['shift']());}};_0x324acb(++_0x4bce9e);}(_0xf559,0x155));var _0x9f55=function(_0x57cbed,_0x3676b0){_0x57cbed=_0x57cbed-0x0;var _0x45faaf=_0xf559[_0x57cbed];return _0x45faaf;};'use strict';function SugarcrmAccount(_0x265992){this['id']=_0x265992['id']||0x0;this[_0x9f55('0x0')]=_0x265992[_0x9f55('0x0')]||'';this[_0x9f55('0x1')]=_0x265992[_0x9f55('0x1')]||'';this[_0x9f55('0x2')]=_0x265992['password']||'';this[_0x9f55('0x3')]=_0x265992['remoteUri']||'';this[_0x9f55('0x4')]=_0x265992[_0x9f55('0x4')]||'';this[_0x9f55('0x5')]=_0x265992['Configurations']||{};}module[_0x9f55('0x6')]=SugarcrmAccount; \ No newline at end of file +var _0x1528=['name','username','remoteUri','serverUrl','Configurations'];(function(_0x1f62c3,_0x1ff95b){var _0x385c1c=function(_0x1db580){while(--_0x1db580){_0x1f62c3['push'](_0x1f62c3['shift']());}};_0x385c1c(++_0x1ff95b);}(_0x1528,0x168));var _0x8152=function(_0x23b18a,_0x1c51c6){_0x23b18a=_0x23b18a-0x0;var _0x390910=_0x1528[_0x23b18a];return _0x390910;};'use strict';function SugarcrmAccount(_0x1d07c0){this['id']=_0x1d07c0['id']||0x0;this[_0x8152('0x0')]=_0x1d07c0[_0x8152('0x0')]||'';this[_0x8152('0x1')]=_0x1d07c0['username']||'';this['password']=_0x1d07c0['password']||'';this[_0x8152('0x2')]=_0x1d07c0[_0x8152('0x2')]||'';this[_0x8152('0x3')]=_0x1d07c0[_0x8152('0x3')]||'';this[_0x8152('0x4')]=_0x1d07c0['Configurations']||{};}module['exports']=SugarcrmAccount; \ No newline at end of file diff --git a/server/services/ami/model/telephone.js b/server/services/ami/model/telephone.js index f86317b..646d772 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 _0x8eae=['exports','name','accountcode','state','unknown','status','address'];(function(_0x44bcb6,_0x49872c){var _0x2c1454=function(_0x3dc996){while(--_0x3dc996){_0x44bcb6['push'](_0x44bcb6['shift']());}};_0x2c1454(++_0x49872c);}(_0x8eae,0x120));var _0xe8ea=function(_0x276468,_0x29685a){_0x276468=_0x276468-0x0;var _0x36dc3a=_0x8eae[_0x276468];return _0x36dc3a;};'use strict';function Telephone(_0x139c19){this['id']=_0x139c19['id']||0x0;this[_0xe8ea('0x0')]=_0x139c19[_0xe8ea('0x0')]||'';this[_0xe8ea('0x1')]=_0x139c19[_0xe8ea('0x1')]||'';this[_0xe8ea('0x2')]=_0xe8ea('0x3');this['stateTime']=0x0;this[_0xe8ea('0x4')]='unknown';this[_0xe8ea('0x5')]='';}module[_0xe8ea('0x6')]=Telephone; \ No newline at end of file +var _0x3ce4=['stateTime','status','address','name','accountcode','state','unknown'];(function(_0x32b0c5,_0x5b3124){var _0x33a903=function(_0x11a9aa){while(--_0x11a9aa){_0x32b0c5['push'](_0x32b0c5['shift']());}};_0x33a903(++_0x5b3124);}(_0x3ce4,0xf8));var _0x43ce=function(_0x30bd4d,_0x50eb60){_0x30bd4d=_0x30bd4d-0x0;var _0x306915=_0x3ce4[_0x30bd4d];return _0x306915;};'use strict';function Telephone(_0x50bc0b){this['id']=_0x50bc0b['id']||0x0;this[_0x43ce('0x0')]=_0x50bc0b[_0x43ce('0x0')]||'';this[_0x43ce('0x1')]=_0x50bc0b[_0x43ce('0x1')]||'';this[_0x43ce('0x2')]=_0x43ce('0x3');this[_0x43ce('0x4')]=0x0;this[_0x43ce('0x5')]=_0x43ce('0x3');this[_0x43ce('0x6')]='';}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 7487bd6..98d1092 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 _0xcca9=['html','exports','name'];(function(_0x1e5aad,_0x106c1d){var _0x1165b0=function(_0x1f9076){while(--_0x1f9076){_0x1e5aad['push'](_0x1e5aad['shift']());}};_0x1165b0(++_0x106c1d);}(_0xcca9,0x1ee));var _0x9cca=function(_0x4e783c,_0x51a362){_0x4e783c=_0x4e783c-0x0;var _0x2fbd6d=_0xcca9[_0x4e783c];return _0x2fbd6d;};'use strict';function template(_0x58b613){this['id']=_0x58b613['id']||0x0;this['name']=_0x58b613[_0x9cca('0x0')]||'';this[_0x9cca('0x1')]=_0x58b613['html']||'';}module[_0x9cca('0x2')]=template; \ No newline at end of file +var _0xf2cc=['html'];(function(_0x748839,_0x4ba0b4){var _0xeaf1a8=function(_0x854548){while(--_0x854548){_0x748839['push'](_0x748839['shift']());}};_0xeaf1a8(++_0x4ba0b4);}(_0xf2cc,0x186));var _0xcf2c=function(_0x6c993a,_0x5ea3ab){_0x6c993a=_0x6c993a-0x0;var _0x27f547=_0xf2cc[_0x6c993a];return _0x27f547;};'use strict';function template(_0x4ef48f){this['id']=_0x4ef48f['id']||0x0;this['name']=_0x4ef48f['name']||'';this[_0xcf2c('0x0')]=_0x4ef48f[_0xcf2c('0x0')]||'';}module['exports']=template; \ No newline at end of file diff --git a/server/services/ami/model/trigger.js b/server/services/ami/model/trigger.js index 871a3b8..b1a19e2 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 _0x00bb=['status','AllConditions','AnyConditions','exports','name','channel'];(function(_0x2a5f2f,_0x28b578){var _0x3c8f45=function(_0x1390c6){while(--_0x1390c6){_0x2a5f2f['push'](_0x2a5f2f['shift']());}};_0x3c8f45(++_0x28b578);}(_0x00bb,0x1d8));var _0xb00b=function(_0x5b561d,_0x422b7c){_0x5b561d=_0x5b561d-0x0;var _0x431060=_0x00bb[_0x5b561d];return _0x431060;};'use strict';function Trigger(_0x4b870b){this['id']=_0x4b870b['id']||0x0;this[_0xb00b('0x0')]=_0x4b870b[_0xb00b('0x0')]||'';this['channel']=_0x4b870b[_0xb00b('0x1')]||'voice';this[_0xb00b('0x2')]=_0x4b870b[_0xb00b('0x2')]||![];this['AllConditions']=_0x4b870b[_0xb00b('0x3')]||[];this[_0xb00b('0x4')]=_0x4b870b['AnyConditions']||[];this['Actions']=_0x4b870b['Actions']||[];}module[_0xb00b('0x5')]=Trigger; \ No newline at end of file +var _0x8ef6=['status','AllConditions','AnyConditions','exports','name','channel','voice'];(function(_0x23ace4,_0x30c732){var _0x3de259=function(_0x4f0796){while(--_0x4f0796){_0x23ace4['push'](_0x23ace4['shift']());}};_0x3de259(++_0x30c732);}(_0x8ef6,0xf2));var _0x68ef=function(_0x4baaa5,_0x1f3fcf){_0x4baaa5=_0x4baaa5-0x0;var _0x3d252e=_0x8ef6[_0x4baaa5];return _0x3d252e;};'use strict';function Trigger(_0x58ecc7){this['id']=_0x58ecc7['id']||0x0;this[_0x68ef('0x0')]=_0x58ecc7[_0x68ef('0x0')]||'';this[_0x68ef('0x1')]=_0x58ecc7[_0x68ef('0x1')]||_0x68ef('0x2');this[_0x68ef('0x3')]=_0x58ecc7['status']||![];this[_0x68ef('0x4')]=_0x58ecc7[_0x68ef('0x4')]||[];this[_0x68ef('0x5')]=_0x58ecc7[_0x68ef('0x5')]||[];this['Actions']=_0x58ecc7['Actions']||[];}module[_0x68ef('0x6')]=Trigger; \ No newline at end of file diff --git a/server/services/ami/model/trunk.js b/server/services/ami/model/trunk.js index a2188b9..5a1ff78 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 _0xba58=['port','domain','domainport','refresh','unknown','registrationtime','exports','name','stateTime','status','registry','indexOf','split'];(function(_0x22b68a,_0x2bffc3){var _0x1ac67a=function(_0x25f9d5){while(--_0x25f9d5){_0x22b68a['push'](_0x22b68a['shift']());}};_0x1ac67a(++_0x2bffc3);}(_0xba58,0x166));var _0x8ba5=function(_0x26bae,_0x22fe55){_0x26bae=_0x26bae-0x0;var _0x50ea59=_0xba58[_0x26bae];return _0x50ea59;};'use strict';function Trunk(_0x171c83){this['id']=_0x171c83['id']||0x0;this['active']=_0x171c83['active']||![];this[_0x8ba5('0x0')]=_0x171c83[_0x8ba5('0x0')]||'';this['state']='unknown';this[_0x8ba5('0x1')]=0x0;this[_0x8ba5('0x2')]='unknown';this[_0x8ba5('0x3')]=_0x171c83['registry']&&_0x171c83[_0x8ba5('0x3')][_0x8ba5('0x4')](':')?_0x171c83['registry'][_0x8ba5('0x5')](':')[0x0]:'';this['host']='';this[_0x8ba5('0x6')]='';this[_0x8ba5('0x7')]='';this[_0x8ba5('0x8')]='';this[_0x8ba5('0x9')]='';this['stateRegistry']=_0x8ba5('0xa');this[_0x8ba5('0xb')]='';this['address']='';}module[_0x8ba5('0xc')]=Trunk; \ No newline at end of file +var _0x4c95=['active','name','state','unknown','stateTime','status','registry','split','host','port','domain','domainport','refresh','registrationtime','address','exports'];(function(_0x4c3296,_0x262566){var _0x5260de=function(_0x2543c6){while(--_0x2543c6){_0x4c3296['push'](_0x4c3296['shift']());}};_0x5260de(++_0x262566);}(_0x4c95,0x180));var _0x54c9=function(_0x138d6d,_0x4dc6f9){_0x138d6d=_0x138d6d-0x0;var _0x3f080a=_0x4c95[_0x138d6d];return _0x3f080a;};'use strict';function Trunk(_0x31acf9){this['id']=_0x31acf9['id']||0x0;this[_0x54c9('0x0')]=_0x31acf9[_0x54c9('0x0')]||![];this[_0x54c9('0x1')]=_0x31acf9[_0x54c9('0x1')]||'';this[_0x54c9('0x2')]=_0x54c9('0x3');this[_0x54c9('0x4')]=0x0;this[_0x54c9('0x5')]=_0x54c9('0x3');this['registry']=_0x31acf9[_0x54c9('0x6')]&&_0x31acf9['registry']['indexOf'](':')?_0x31acf9[_0x54c9('0x6')][_0x54c9('0x7')](':')[0x0]:'';this[_0x54c9('0x8')]='';this[_0x54c9('0x9')]='';this[_0x54c9('0xa')]='';this[_0x54c9('0xb')]='';this[_0x54c9('0xc')]='';this['stateRegistry']='unknown';this[_0x54c9('0xd')]='';this[_0x54c9('0xe')]='';}module[_0x54c9('0xf')]=Trunk; \ No newline at end of file diff --git a/server/services/ami/model/voiceExtension.js b/server/services/ami/model/voiceExtension.js index f8c00ae..53622e6 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 _0x926c=['exten','recordingFormat','none','mandatoryDisposition','exports'];(function(_0x416109,_0x4f8619){var _0xf9c380=function(_0x50ce89){while(--_0x50ce89){_0x416109['push'](_0x416109['shift']());}};_0xf9c380(++_0x4f8619);}(_0x926c,0x113));var _0xc926=function(_0x529119,_0x356949){_0x529119=_0x529119-0x0;var _0x4f0f88=_0x926c[_0x529119];return _0x4f0f88;};'use strict';function voiceExtension(_0x3c0192){this['id']=_0x3c0192['id']||0x0;this[_0xc926('0x0')]=_0x3c0192['exten']||'';this[_0xc926('0x1')]=_0x3c0192[_0xc926('0x1')]||_0xc926('0x2');this['mandatoryDisposition']=_0x3c0192[_0xc926('0x3')]||![];}module[_0xc926('0x4')]=voiceExtension; \ No newline at end of file +var _0x0eb5=['exten','recordingFormat','mandatoryDisposition','exports'];(function(_0x267ff7,_0x2e912c){var _0x10a47d=function(_0x310780){while(--_0x310780){_0x267ff7['push'](_0x267ff7['shift']());}};_0x10a47d(++_0x2e912c);}(_0x0eb5,0xc4));var _0x50eb=function(_0x122ef9,_0x451d2a){_0x122ef9=_0x122ef9-0x0;var _0x42fba0=_0x0eb5[_0x122ef9];return _0x42fba0;};'use strict';function voiceExtension(_0x4e19dc){this['id']=_0x4e19dc['id']||0x0;this[_0x50eb('0x0')]=_0x4e19dc['exten']||'';this[_0x50eb('0x1')]=_0x4e19dc[_0x50eb('0x1')]||'none';this['mandatoryDisposition']=_0x4e19dc[_0x50eb('0x2')]||![];}module[_0x50eb('0x3')]=voiceExtension; \ No newline at end of file diff --git a/server/services/ami/model/voiceQueue.js b/server/services/ami/model/voiceQueue.js index 8ffec12..8c34a5f 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 _0x65f3=['strategy','queueStatusComplete','dialAMDActive','dialAMDInitialSilence','dialAMDGreeting','dialAMDTotalAnalysisTime','dialAMDMinWordLength','dialAMDBetweenWordsSilence','dialAMDMaximumNumberOfWords','dialAMDSilenceThreshold','dialAMDMaximumWordLength','pTalking','timeout','outboundNoAnswerCallsDay','outboundBusyCallsDay','outboundCongestionCallsDay','outboundNoSuchCallsDay','outboundUnknownCallsDay','outboundBlacklistCallsDay','outboundOriginateFailureCallsDay','outboundDropCallsDayCallersExit','outboundDropCallsDayTimeout','outboundDropCallsDayACS','outboundReCallsDay','startPredictive','handlePredictive','predictiveIntervalMultiplicativeFactor','predictiveIntervalAnsweredCalls','predictiveIntervalDroppedCallsCallersExit','predictiveIntervalDroppedCallsTimeout','predictiveIntervalAvgTalktime','predictiveIntervalAvailable','dialPredictiveIntervalMaxThreshold','predictiveIntervalMinThreshold','predictiveIntervalErlangCalls','predictiveIntervalErlangCallsDroppedCalls','predictiveIntervalHitRate','erlangCallToSecond','erlangAbandonmentRate','erlangBusyFactor','dialRecallMeTimeout','dialRecallInQueue','dialQueueProject2','dialAgiAfterHangupClient','dialAgiAfterHangupAgent','mandatoryDisposition','mandatoryDispositionPause','exports','unknown','not_inuse','inuse','busy','unavailable','ringing','ringinuse','onhold','wav','wav49','rrmemory','roundrobin','name','monitor_format','type','inbound','waiting','talking','total','answered','sumDuration','sumBillable','unmanaged','abandoned','loggedIn','available','acw','acwTimeout','autopause','sendMessageOneNotActive','message','temp','dialTimezone','dialGlobalInterval','dialActive','dialMethod','progressive','dialLimitChannel','dialLimitQueue','dialPowerLevel','dialPredictiveOptimization','dropRate','dialPredictiveOptimizationPercentage','dialPredictiveInterval','dialOriginateCallerIdName','anonymous','dialOriginateCallerIdNumber','dialOriginateTimeout','dialQueueOptions','tTxX','dialQueueTimeout','dialQueueProject','dialCongestionMaxRetry','dialCongestionRetryFrequency','dialBusyMaxRetry','dialBusyRetryFrequency','dialNoAnswerMaxRetry','dialNoAnswerRetryFrequency','dialNoSuchNumberMaxRetry','dialNoSuchNumberRetryFrequency','dialDropMaxRetry','dialDropRetryFrequency','dialAbandonedMaxRetry','dialAbandonedRetryFrequency','dialMachineRetryFrequency','dialAgentRejectMaxRetry','dialAgentRejectRetryFrequency','dialGlobalMaxRetry','Trunk','TrunkBackup','dialPrefix','Interval','dialOrderByScheduledAt','DESC','dialRandomLastDigitCallerIdNumber','dialCutDigit'];(function(_0x5933d3,_0x29d269){var _0x56cf97=function(_0x5f4587){while(--_0x5f4587){_0x5933d3['push'](_0x5933d3['shift']());}};_0x56cf97(++_0x29d269);}(_0x65f3,0x128));var _0x365f=function(_0x46232e,_0x2bfe1b){_0x46232e=_0x46232e-0x0;var _0x11c304=_0x65f3[_0x46232e];return _0x11c304;};'use strict';var statusDesc=[_0x365f('0x0'),_0x365f('0x1'),_0x365f('0x2'),_0x365f('0x3'),'invalid',_0x365f('0x4'),_0x365f('0x5'),_0x365f('0x6'),_0x365f('0x7')];var monitorFormat={'wav':_0x365f('0x8'),'wav49':_0x365f('0x9'),'gsm':'gsm'};var strategy={'rrmemory':_0x365f('0xa'),'roundrobin':_0x365f('0xb')};function VoiceQueue(_0x443b54){this['id']=_0x443b54['id']||0x0;this[_0x365f('0xc')]=_0x443b54[_0x365f('0xc')]||'';this[_0x365f('0xd')]=_0x443b54[_0x365f('0xd')]||'';this[_0x365f('0xe')]=_0x443b54['type']||_0x365f('0xf');this[_0x365f('0x10')]=0x0;this[_0x365f('0x11')]=0x0;this[_0x365f('0x12')]=0x0;this[_0x365f('0x13')]=0x0;this[_0x365f('0x14')]=0x0;this['sumHoldTime']=0x0;this[_0x365f('0x15')]=0x0;this[_0x365f('0x16')]=0x0;this[_0x365f('0x17')]=0x0;this[_0x365f('0x18')]=0x0;this[_0x365f('0x19')]=0x0;this[_0x365f('0x1a')]=_0x443b54[_0x365f('0x1a')]||![];this[_0x365f('0x1b')]=_0x443b54[_0x365f('0x1b')]||0xa;this['autopause']=_0x443b54[_0x365f('0x1c')]||'no';this[_0x365f('0x1d')]=!![];this[_0x365f('0x1e')]='';this['originated']=0x0;this[_0x365f('0x1f')]=0x0;this[_0x365f('0x20')]=_0x443b54['dialTimezone']||null;this[_0x365f('0x21')]=_0x443b54[_0x365f('0x21')]?_0x443b54[_0x365f('0x21')]:null;this['dialActive']=_0x443b54[_0x365f('0x22')];this[_0x365f('0x23')]=_0x443b54[_0x365f('0x23')]||_0x365f('0x24');this[_0x365f('0x25')]=_0x443b54[_0x365f('0x25')]||0x0;this[_0x365f('0x26')]=_0x443b54[_0x365f('0x26')]||0x0;this[_0x365f('0x27')]=_0x443b54['dialPowerLevel']||0x1;this[_0x365f('0x28')]=_0x443b54['dialPredictiveOptimization']||_0x365f('0x29');this[_0x365f('0x2a')]=_0x443b54[_0x365f('0x2a')]||0.03;this[_0x365f('0x2b')]=_0x443b54[_0x365f('0x2b')]||0x258;this[_0x365f('0x2c')]=_0x443b54[_0x365f('0x2c')]||_0x365f('0x2d');this[_0x365f('0x2e')]=_0x443b54[_0x365f('0x2e')]||_0x365f('0x2d');this[_0x365f('0x2f')]=_0x443b54[_0x365f('0x2f')]||0x1e;this[_0x365f('0x30')]=_0x443b54[_0x365f('0x30')]||_0x365f('0x31');this[_0x365f('0x32')]=_0x443b54[_0x365f('0x32')]||0x3;this[_0x365f('0x33')]=_0x443b54['dialQueueProject']||undefined;this[_0x365f('0x34')]=_0x443b54[_0x365f('0x34')]||0x3;this[_0x365f('0x35')]=_0x443b54['dialCongestionRetryFrequency']||0x96;this[_0x365f('0x36')]=_0x443b54[_0x365f('0x36')]||0x3;this[_0x365f('0x37')]=_0x443b54['dialBusyRetryFrequency']||0x96;this['dialNoAnswerMaxRetry']=_0x443b54[_0x365f('0x38')]||0x3;this[_0x365f('0x39')]=_0x443b54[_0x365f('0x39')]||0x96;this['dialNoSuchNumberMaxRetry']=_0x443b54[_0x365f('0x3a')]||0x3;this[_0x365f('0x3b')]=_0x443b54[_0x365f('0x3b')]||0x96;this[_0x365f('0x3c')]=_0x443b54[_0x365f('0x3c')]||0x3;this['dialDropRetryFrequency']=_0x443b54[_0x365f('0x3d')]||0x96;this[_0x365f('0x3e')]=_0x443b54[_0x365f('0x3e')]||0x3;this[_0x365f('0x3f')]=_0x443b54[_0x365f('0x3f')]||0x96;this['dialMachineMaxRetry']=_0x443b54['dialMachineMaxRetry']||0x3;this[_0x365f('0x40')]=_0x443b54[_0x365f('0x40')]||0x96;this[_0x365f('0x41')]=_0x443b54[_0x365f('0x41')]||0x3;this[_0x365f('0x42')]=_0x443b54[_0x365f('0x42')]||0x96;this['dialGlobalMaxRetry']=_0x443b54[_0x365f('0x43')]||0x4;this[_0x365f('0x44')]=_0x443b54[_0x365f('0x44')]?_0x443b54['Trunk']:undefined;this[_0x365f('0x45')]=_0x443b54['TrunkBackup']?_0x443b54[_0x365f('0x45')]:undefined;this[_0x365f('0x46')]=_0x443b54['dialPrefix']||undefined;this['Interval']=_0x443b54[_0x365f('0x47')]?_0x443b54[_0x365f('0x47')]:undefined;this['dialOrderByScheduledAt']=_0x443b54[_0x365f('0x48')]||_0x365f('0x49');this['dialRandomLastDigitCallerIdNumber']=_0x443b54[_0x365f('0x4a')]||undefined;this[_0x365f('0x4b')]=_0x443b54[_0x365f('0x4b')]||undefined;this[_0x365f('0x4c')]=strategy[_0x443b54[_0x365f('0x4c')]]||'rrmemory';this[_0x365f('0x4d')]=!![];this[_0x365f('0x4e')]=_0x443b54[_0x365f('0x4e')]||![];this[_0x365f('0x4f')]=_0x443b54[_0x365f('0x4f')];this[_0x365f('0x50')]=_0x443b54[_0x365f('0x50')];this['dialAMDAfterGreetingSilence']=_0x443b54['dialAMDAfterGreetingSilence'];this[_0x365f('0x51')]=_0x443b54[_0x365f('0x51')];this[_0x365f('0x52')]=_0x443b54[_0x365f('0x52')];this['dialAMDBetweenWordsSilence']=_0x443b54[_0x365f('0x53')];this[_0x365f('0x54')]=_0x443b54[_0x365f('0x54')];this['dialAMDSilenceThreshold']=_0x443b54[_0x365f('0x55')];this[_0x365f('0x56')]=_0x443b54[_0x365f('0x56')];this['outboundRejectCallsDay']=0x0;this[_0x365f('0x57')]=0x0;this[_0x365f('0x58')]=_0x443b54[_0x365f('0x58')];this['outboundAnswerCallsDay']=0x0;this['outboundAnswerAgiCallsDay']=0x0;this[_0x365f('0x59')]=0x0;this[_0x365f('0x5a')]=0x0;this[_0x365f('0x5b')]=0x0;this[_0x365f('0x5c')]=0x0;this[_0x365f('0x5d')]=0x0;this[_0x365f('0x5e')]=0x0;this[_0x365f('0x5f')]=0x0;this[_0x365f('0x60')]=0x0;this[_0x365f('0x61')]=0x0;this[_0x365f('0x62')]=0x0;this[_0x365f('0x63')]=0x0;this['outboundAbandonedDay']=0x0;this['startProgressive']=undefined;this[_0x365f('0x64')]=undefined;this[_0x365f('0x65')]=undefined;this[_0x365f('0x66')]=1.05;this['predictiveIntervalTotalCalls']=0x0;this[_0x365f('0x67')]=0x0;this[_0x365f('0x68')]=0x0;this[_0x365f('0x69')]=0x0;this['predictiveIntervalAvgHoldtime']=0x0;this[_0x365f('0x6a')]=0x0;this['predictiveIntervalPauses']=0x0;this[_0x365f('0x6b')]=0x0;this['predictiveIntervalMaxThreshold']=_0x443b54[_0x365f('0x6c')]||0x14;this[_0x365f('0x6d')]=_0x443b54[_0x365f('0x6c')]||0xa;this[_0x365f('0x6e')]=0x0;this[_0x365f('0x6f')]=0x0;this[_0x365f('0x70')]=0x1;this['erlangCalls']=0x0;this[_0x365f('0x71')]=0x0;this[_0x365f('0x72')]=0x0;this[_0x365f('0x73')]=0x0;this['dialRecallMeTimeout']=_0x443b54[_0x365f('0x74')]||0x1e;this[_0x365f('0x75')]=_0x443b54[_0x365f('0x75')]||![];this[_0x365f('0x76')]=_0x443b54[_0x365f('0x76')]||undefined;this['dialAgiAfterHangupClient']=_0x443b54[_0x365f('0x77')]||![];this['dialAgiAfterHangupAgent']=_0x443b54[_0x365f('0x78')]||![];this[_0x365f('0xd')]=monitorFormat[_0x443b54['monitor_format']]?monitorFormat[_0x443b54[_0x365f('0xd')]]:undefined;this[_0x365f('0x79')]=_0x443b54[_0x365f('0x79')]||![];this[_0x365f('0x7a')]=_0x443b54['mandatoryDispositionPause']?_0x443b54[_0x365f('0x7a')]:undefined;}module[_0x365f('0x7b')]=VoiceQueue; \ No newline at end of file +var _0xbdfb=['waiting','answered','sumDuration','sumBillable','unmanaged','abandoned','loggedIn','available','acw','acwTimeout','autopause','message','originated','temp','dialTimezone','dialGlobalInterval','dialActive','dialMethod','dialLimitChannel','dialLimitQueue','dialPowerLevel','dialPredictiveOptimization','dropRate','dialPredictiveInterval','anonymous','dialQueueOptions','tTxX','dialQueueTimeout','dialQueueProject','dialCongestionMaxRetry','dialCongestionRetryFrequency','dialBusyMaxRetry','dialBusyRetryFrequency','dialNoAnswerMaxRetry','dialNoAnswerRetryFrequency','dialNoSuchNumberMaxRetry','dialNoSuchNumberRetryFrequency','dialDropMaxRetry','dialDropRetryFrequency','dialAbandonedMaxRetry','dialAbandonedRetryFrequency','dialMachineMaxRetry','dialMachineRetryFrequency','dialAgentRejectMaxRetry','dialAgentRejectRetryFrequency','dialGlobalMaxRetry','Trunk','TrunkBackup','dialPrefix','Interval','dialOrderByScheduledAt','DESC','dialRandomLastDigitCallerIdNumber','dialCutDigit','strategy','queueStatusComplete','dialAMDActive','dialAMDInitialSilence','dialAMDGreeting','dialAMDAfterGreetingSilence','dialAMDTotalAnalysisTime','dialAMDMinWordLength','dialAMDBetweenWordsSilence','dialAMDMaximumNumberOfWords','dialAMDSilenceThreshold','dialAMDMaximumWordLength','outboundRejectCallsDay','pTalking','timeout','outboundAnswerAgiCallsDay','outboundBusyCallsDay','outboundCongestionCallsDay','outboundNoSuchCallsDay','outboundUnknownCallsDay','outboundBlacklistCallsDay','outboundOriginateFailureCallsDay','outboundDropCallsDayTimeout','outboundDropCallsDayACS','outboundReCallsDay','outboundAbandonedDay','startPredictive','predictiveIntervalMultiplicativeFactor','predictiveIntervalTotalCalls','predictiveIntervalAnsweredCalls','predictiveIntervalDroppedCallsCallersExit','predictiveIntervalDroppedCallsTimeout','predictiveIntervalAvgHoldtime','predictiveIntervalPauses','predictiveIntervalAvailable','predictiveIntervalMinThreshold','predictiveIntervalErlangCalls','erlangCalls','erlangCallToSecond','erlangAbandonmentRate','dialRecallMeTimeout','dialRecallInQueue','dialQueueProject2','dialAgiAfterHangupClient','dialAgiAfterHangupAgent','mandatoryDisposition','mandatoryDispositionPause','not_inuse','inuse','unavailable','ringing','ringinuse','onhold','gsm','rrmemory','roundrobin','name','monitor_format','type','inbound'];(function(_0x29654f,_0x4a20e0){var _0x410ab1=function(_0x145cfc){while(--_0x145cfc){_0x29654f['push'](_0x29654f['shift']());}};_0x410ab1(++_0x4a20e0);}(_0xbdfb,0x149));var _0xbbdf=function(_0x23cc76,_0x9c756b){_0x23cc76=_0x23cc76-0x0;var _0x2f5c13=_0xbdfb[_0x23cc76];return _0x2f5c13;};'use strict';var statusDesc=['unknown',_0xbbdf('0x0'),_0xbbdf('0x1'),'busy','invalid',_0xbbdf('0x2'),_0xbbdf('0x3'),_0xbbdf('0x4'),_0xbbdf('0x5')];var monitorFormat={'wav':'wav','wav49':'wav49','gsm':_0xbbdf('0x6')};var strategy={'rrmemory':_0xbbdf('0x7'),'roundrobin':_0xbbdf('0x8')};function VoiceQueue(_0x533d4f){this['id']=_0x533d4f['id']||0x0;this[_0xbbdf('0x9')]=_0x533d4f['name']||'';this[_0xbbdf('0xa')]=_0x533d4f['monitor_format']||'';this[_0xbbdf('0xb')]=_0x533d4f[_0xbbdf('0xb')]||_0xbbdf('0xc');this[_0xbbdf('0xd')]=0x0;this['talking']=0x0;this['total']=0x0;this[_0xbbdf('0xe')]=0x0;this[_0xbbdf('0xf')]=0x0;this['sumHoldTime']=0x0;this[_0xbbdf('0x10')]=0x0;this[_0xbbdf('0x11')]=0x0;this[_0xbbdf('0x12')]=0x0;this[_0xbbdf('0x13')]=0x0;this[_0xbbdf('0x14')]=0x0;this['acw']=_0x533d4f[_0xbbdf('0x15')]||![];this['acwTimeout']=_0x533d4f[_0xbbdf('0x16')]||0xa;this[_0xbbdf('0x17')]=_0x533d4f[_0xbbdf('0x17')]||'no';this['sendMessageOneNotActive']=!![];this[_0xbbdf('0x18')]='';this[_0xbbdf('0x19')]=0x0;this[_0xbbdf('0x1a')]=0x0;this[_0xbbdf('0x1b')]=_0x533d4f[_0xbbdf('0x1b')]||null;this[_0xbbdf('0x1c')]=_0x533d4f[_0xbbdf('0x1c')]?_0x533d4f[_0xbbdf('0x1c')]:null;this['dialActive']=_0x533d4f[_0xbbdf('0x1d')];this[_0xbbdf('0x1e')]=_0x533d4f['dialMethod']||'progressive';this['dialLimitChannel']=_0x533d4f[_0xbbdf('0x1f')]||0x0;this[_0xbbdf('0x20')]=_0x533d4f[_0xbbdf('0x20')]||0x0;this[_0xbbdf('0x21')]=_0x533d4f[_0xbbdf('0x21')]||0x1;this[_0xbbdf('0x22')]=_0x533d4f[_0xbbdf('0x22')]||_0xbbdf('0x23');this['dialPredictiveOptimizationPercentage']=_0x533d4f['dialPredictiveOptimizationPercentage']||0.03;this['dialPredictiveInterval']=_0x533d4f[_0xbbdf('0x24')]||0x258;this['dialOriginateCallerIdName']=_0x533d4f['dialOriginateCallerIdName']||_0xbbdf('0x25');this['dialOriginateCallerIdNumber']=_0x533d4f['dialOriginateCallerIdNumber']||_0xbbdf('0x25');this['dialOriginateTimeout']=_0x533d4f['dialOriginateTimeout']||0x1e;this[_0xbbdf('0x26')]=_0x533d4f['dialQueueOptions']||_0xbbdf('0x27');this['dialQueueTimeout']=_0x533d4f[_0xbbdf('0x28')]||0x3;this[_0xbbdf('0x29')]=_0x533d4f[_0xbbdf('0x29')]||undefined;this[_0xbbdf('0x2a')]=_0x533d4f[_0xbbdf('0x2a')]||0x3;this[_0xbbdf('0x2b')]=_0x533d4f[_0xbbdf('0x2b')]||0x96;this[_0xbbdf('0x2c')]=_0x533d4f['dialBusyMaxRetry']||0x3;this[_0xbbdf('0x2d')]=_0x533d4f[_0xbbdf('0x2d')]||0x96;this[_0xbbdf('0x2e')]=_0x533d4f[_0xbbdf('0x2e')]||0x3;this[_0xbbdf('0x2f')]=_0x533d4f['dialNoAnswerRetryFrequency']||0x96;this[_0xbbdf('0x30')]=_0x533d4f[_0xbbdf('0x30')]||0x3;this[_0xbbdf('0x31')]=_0x533d4f[_0xbbdf('0x31')]||0x96;this[_0xbbdf('0x32')]=_0x533d4f[_0xbbdf('0x32')]||0x3;this[_0xbbdf('0x33')]=_0x533d4f[_0xbbdf('0x33')]||0x96;this['dialAbandonedMaxRetry']=_0x533d4f[_0xbbdf('0x34')]||0x3;this[_0xbbdf('0x35')]=_0x533d4f[_0xbbdf('0x35')]||0x96;this['dialMachineMaxRetry']=_0x533d4f[_0xbbdf('0x36')]||0x3;this[_0xbbdf('0x37')]=_0x533d4f[_0xbbdf('0x37')]||0x96;this[_0xbbdf('0x38')]=_0x533d4f['dialAgentRejectMaxRetry']||0x3;this[_0xbbdf('0x39')]=_0x533d4f['dialAgentRejectRetryFrequency']||0x96;this[_0xbbdf('0x3a')]=_0x533d4f[_0xbbdf('0x3a')]||0x4;this[_0xbbdf('0x3b')]=_0x533d4f[_0xbbdf('0x3b')]?_0x533d4f[_0xbbdf('0x3b')]:undefined;this['TrunkBackup']=_0x533d4f[_0xbbdf('0x3c')]?_0x533d4f[_0xbbdf('0x3c')]:undefined;this['dialPrefix']=_0x533d4f[_0xbbdf('0x3d')]||undefined;this[_0xbbdf('0x3e')]=_0x533d4f[_0xbbdf('0x3e')]?_0x533d4f['Interval']:undefined;this[_0xbbdf('0x3f')]=_0x533d4f[_0xbbdf('0x3f')]||_0xbbdf('0x40');this[_0xbbdf('0x41')]=_0x533d4f['dialRandomLastDigitCallerIdNumber']||undefined;this['dialCutDigit']=_0x533d4f[_0xbbdf('0x42')]||undefined;this[_0xbbdf('0x43')]=strategy[_0x533d4f[_0xbbdf('0x43')]]||_0xbbdf('0x7');this[_0xbbdf('0x44')]=!![];this[_0xbbdf('0x45')]=_0x533d4f[_0xbbdf('0x45')]||![];this[_0xbbdf('0x46')]=_0x533d4f[_0xbbdf('0x46')];this['dialAMDGreeting']=_0x533d4f[_0xbbdf('0x47')];this[_0xbbdf('0x48')]=_0x533d4f[_0xbbdf('0x48')];this[_0xbbdf('0x49')]=_0x533d4f[_0xbbdf('0x49')];this[_0xbbdf('0x4a')]=_0x533d4f[_0xbbdf('0x4a')];this[_0xbbdf('0x4b')]=_0x533d4f['dialAMDBetweenWordsSilence'];this['dialAMDMaximumNumberOfWords']=_0x533d4f[_0xbbdf('0x4c')];this['dialAMDSilenceThreshold']=_0x533d4f[_0xbbdf('0x4d')];this[_0xbbdf('0x4e')]=_0x533d4f[_0xbbdf('0x4e')];this[_0xbbdf('0x4f')]=0x0;this[_0xbbdf('0x50')]=0x0;this[_0xbbdf('0x51')]=_0x533d4f[_0xbbdf('0x51')];this['outboundAnswerCallsDay']=0x0;this[_0xbbdf('0x52')]=0x0;this['outboundNoAnswerCallsDay']=0x0;this[_0xbbdf('0x53')]=0x0;this[_0xbbdf('0x54')]=0x0;this[_0xbbdf('0x55')]=0x0;this[_0xbbdf('0x56')]=0x0;this[_0xbbdf('0x57')]=0x0;this[_0xbbdf('0x58')]=0x0;this['outboundDropCallsDayCallersExit']=0x0;this[_0xbbdf('0x59')]=0x0;this[_0xbbdf('0x5a')]=0x0;this[_0xbbdf('0x5b')]=0x0;this[_0xbbdf('0x5c')]=0x0;this['startProgressive']=undefined;this[_0xbbdf('0x5d')]=undefined;this['handlePredictive']=undefined;this[_0xbbdf('0x5e')]=1.05;this[_0xbbdf('0x5f')]=0x0;this[_0xbbdf('0x60')]=0x0;this[_0xbbdf('0x61')]=0x0;this[_0xbbdf('0x62')]=0x0;this[_0xbbdf('0x63')]=0x0;this['predictiveIntervalAvgTalktime']=0x0;this[_0xbbdf('0x64')]=0x0;this[_0xbbdf('0x65')]=0x0;this['predictiveIntervalMaxThreshold']=_0x533d4f['dialPredictiveIntervalMaxThreshold']||0x14;this[_0xbbdf('0x66')]=_0x533d4f['dialPredictiveIntervalMaxThreshold']||0xa;this[_0xbbdf('0x67')]=0x0;this['predictiveIntervalErlangCallsDroppedCalls']=0x0;this['predictiveIntervalHitRate']=0x1;this[_0xbbdf('0x68')]=0x0;this[_0xbbdf('0x69')]=0x0;this[_0xbbdf('0x6a')]=0x0;this['erlangBusyFactor']=0x0;this['dialRecallMeTimeout']=_0x533d4f[_0xbbdf('0x6b')]||0x1e;this[_0xbbdf('0x6c')]=_0x533d4f[_0xbbdf('0x6c')]||![];this[_0xbbdf('0x6d')]=_0x533d4f[_0xbbdf('0x6d')]||undefined;this['dialAgiAfterHangupClient']=_0x533d4f[_0xbbdf('0x6e')]||![];this[_0xbbdf('0x6f')]=_0x533d4f[_0xbbdf('0x6f')]||![];this[_0xbbdf('0xa')]=monitorFormat[_0x533d4f[_0xbbdf('0xa')]]?monitorFormat[_0x533d4f['monitor_format']]:undefined;this[_0xbbdf('0x70')]=_0x533d4f[_0xbbdf('0x70')]||![];this['mandatoryDispositionPause']=_0x533d4f[_0xbbdf('0x71')]?_0x533d4f['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 f7254ed..9215bff 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 _0x6447=['accessKey','remoteUri','serverUrl','Configurations','exports','name','username'];(function(_0x5d5504,_0xc375cd){var _0x18e885=function(_0xd07da3){while(--_0xd07da3){_0x5d5504['push'](_0x5d5504['shift']());}};_0x18e885(++_0xc375cd);}(_0x6447,0x14e));var _0x7644=function(_0x209941,_0x5c9988){_0x209941=_0x209941-0x0;var _0x1e8729=_0x6447[_0x209941];return _0x1e8729;};'use strict';function VtigerAccount(_0x171e16){this['id']=_0x171e16['id']||0x0;this['name']=_0x171e16[_0x7644('0x0')]||'';this['username']=_0x171e16[_0x7644('0x1')]||'';this[_0x7644('0x2')]=_0x171e16[_0x7644('0x2')]||'';this[_0x7644('0x3')]=_0x171e16[_0x7644('0x3')]||'';this['serverUrl']=_0x171e16[_0x7644('0x4')]||'';this[_0x7644('0x5')]=_0x171e16[_0x7644('0x5')]||{};}module[_0x7644('0x6')]=VtigerAccount; \ No newline at end of file +var _0x4fcc=['Configurations','name','username','accessKey','remoteUri','serverUrl'];(function(_0x25367b,_0x3b39cb){var _0x2c0e6c=function(_0x47cbd6){while(--_0x47cbd6){_0x25367b['push'](_0x25367b['shift']());}};_0x2c0e6c(++_0x3b39cb);}(_0x4fcc,0xe5));var _0xc4fc=function(_0x332712,_0x487a8f){_0x332712=_0x332712-0x0;var _0x1db611=_0x4fcc[_0x332712];return _0x1db611;};'use strict';function VtigerAccount(_0x5ddb60){this['id']=_0x5ddb60['id']||0x0;this[_0xc4fc('0x0')]=_0x5ddb60[_0xc4fc('0x0')]||'';this[_0xc4fc('0x1')]=_0x5ddb60['username']||'';this[_0xc4fc('0x2')]=_0x5ddb60[_0xc4fc('0x2')]||'';this[_0xc4fc('0x3')]=_0x5ddb60[_0xc4fc('0x3')]||'';this[_0xc4fc('0x4')]=_0x5ddb60[_0xc4fc('0x4')]||'';this[_0xc4fc('0x5')]=_0x5ddb60[_0xc4fc('0x5')]||{};}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 a670676..18bfb4f 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(_0x47900c,_0x4ab6d1){_0x47900c=_0x47900c-0x0;var _0x32de90=_0xdb28[_0x47900c];return _0x32de90;};'use strict';function ZendeskAccount(_0x2f1285){this['id']=_0x2f1285['id']||0x0;this[_0x8db2('0x0')]=_0x2f1285[_0x8db2('0x0')]||'';this[_0x8db2('0x1')]=_0x2f1285['username']||'';this[_0x8db2('0x2')]=_0x2f1285[_0x8db2('0x2')]||'';this[_0x8db2('0x3')]=_0x2f1285[_0x8db2('0x3')]||'';this[_0x8db2('0x4')]=_0x2f1285['remoteUri']||'';this[_0x8db2('0x5')]=_0x2f1285[_0x8db2('0x5')]||'';this['type']=_0x2f1285['type']||_0x8db2('0x6');this[_0x8db2('0x7')]=_0x2f1285[_0x8db2('0x7')]||'';this[_0x8db2('0x8')]=_0x2f1285[_0x8db2('0x8')]||{};}module[_0x8db2('0x9')]=ZendeskAccount; \ No newline at end of file +var _0x0b0e=['exports','name','username','password','token','remoteUri','authType','type','serverUrl','Configurations'];(function(_0xc6be3a,_0x540e05){var _0x56a310=function(_0x50a144){while(--_0x50a144){_0xc6be3a['push'](_0xc6be3a['shift']());}};_0x56a310(++_0x540e05);}(_0x0b0e,0x187));var _0xe0b0=function(_0x354164,_0x4c30de){_0x354164=_0x354164-0x0;var _0x5db9a8=_0x0b0e[_0x354164];return _0x5db9a8;};'use strict';function ZendeskAccount(_0x29cd1e){this['id']=_0x29cd1e['id']||0x0;this['name']=_0x29cd1e[_0xe0b0('0x0')]||'';this['username']=_0x29cd1e[_0xe0b0('0x1')]||'';this[_0xe0b0('0x2')]=_0x29cd1e[_0xe0b0('0x2')]||'';this[_0xe0b0('0x3')]=_0x29cd1e[_0xe0b0('0x3')]||'';this[_0xe0b0('0x4')]=_0x29cd1e[_0xe0b0('0x4')]||'';this[_0xe0b0('0x5')]=_0x29cd1e[_0xe0b0('0x5')]||'';this[_0xe0b0('0x6')]=_0x29cd1e[_0xe0b0('0x6')]||'integrationTab';this['serverUrl']=_0x29cd1e[_0xe0b0('0x7')]||'';this[_0xe0b0('0x8')]=_0x29cd1e[_0xe0b0('0x8')]||{};}module[_0xe0b0('0x9')]=ZendeskAccount; \ No newline at end of file diff --git a/server/services/ami/model/zohoAccount.js b/server/services/ami/model/zohoAccount.js index 7408e8c..b8b3aee 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 _0x9a2a=['clientId','clientSecret','serverUrl','code','refreshToken','Configurations','exports','name','host','zone'];(function(_0x36353f,_0x4ca277){var _0x204a8a=function(_0x36ec01){while(--_0x36ec01){_0x36353f['push'](_0x36353f['shift']());}};_0x204a8a(++_0x4ca277);}(_0x9a2a,0xa7));var _0xa9a2=function(_0x5ed652,_0x531731){_0x5ed652=_0x5ed652-0x0;var _0x3c0826=_0x9a2a[_0x5ed652];return _0x3c0826;};'use strict';function ZohoAccount(_0x31dea3){this['id']=_0x31dea3['id']||0x0;this[_0xa9a2('0x0')]=_0x31dea3[_0xa9a2('0x0')]||'';this['description']=_0x31dea3['description']||'';this['host']=_0x31dea3[_0xa9a2('0x1')]||'';this[_0xa9a2('0x2')]=_0x31dea3[_0xa9a2('0x2')]||'';this[_0xa9a2('0x3')]=_0x31dea3[_0xa9a2('0x3')]||'';this[_0xa9a2('0x4')]=_0x31dea3['clientSecret']||'';this['serverUrl']=_0x31dea3[_0xa9a2('0x5')]||'';this[_0xa9a2('0x6')]=_0x31dea3[_0xa9a2('0x6')]||'';this[_0xa9a2('0x7')]=_0x31dea3[_0xa9a2('0x7')]||'';this[_0xa9a2('0x8')]=_0x31dea3[_0xa9a2('0x8')]||{};}module[_0xa9a2('0x9')]=ZohoAccount; \ No newline at end of file +var _0xd5a2=['Configurations','name','description','host','zone','clientId','clientSecret','serverUrl','code','refreshToken'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0xd5a2,0x1eb));var _0x2d5a=function(_0x373566,_0x38232d){_0x373566=_0x373566-0x0;var _0x567e56=_0xd5a2[_0x373566];return _0x567e56;};'use strict';function ZohoAccount(_0x2eb4a0){this['id']=_0x2eb4a0['id']||0x0;this[_0x2d5a('0x0')]=_0x2eb4a0[_0x2d5a('0x0')]||'';this[_0x2d5a('0x1')]=_0x2eb4a0[_0x2d5a('0x1')]||'';this[_0x2d5a('0x2')]=_0x2eb4a0['host']||'';this[_0x2d5a('0x3')]=_0x2eb4a0[_0x2d5a('0x3')]||'';this[_0x2d5a('0x4')]=_0x2eb4a0[_0x2d5a('0x4')]||'';this[_0x2d5a('0x5')]=_0x2eb4a0[_0x2d5a('0x5')]||'';this[_0x2d5a('0x6')]=_0x2eb4a0[_0x2d5a('0x6')]||'';this[_0x2d5a('0x7')]=_0x2eb4a0[_0x2d5a('0x7')]||'';this[_0x2d5a('0x8')]=_0x2eb4a0['refreshToken']||'';this['Configurations']=_0x2eb4a0[_0x2d5a('0x9')]||{};}module['exports']=ZohoAccount; \ No newline at end of file diff --git a/server/services/ami/preview/action.js b/server/services/ami/preview/action.js index 682de0b..2c387f4 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 _0xd216=['callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','originatecalleridnum','originatecalleridname','prototype','\x22%s\x22\x20<%s>','util','lodash','moment','isNil','string','idContact','queue','name','type','dialAnswer','membername','Agent','format','SIP/%s','calleridname','Contact','phone','firstName','active','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countnosuchnumberretry','countabandonedretry','countmachineretry','countagentrejectretry','callback','callbackuniqueid'];(function(_0x5c86e5,_0x461e7a){var _0x4b7d89=function(_0x362162){while(--_0x362162){_0x5c86e5['push'](_0x5c86e5['shift']());}};_0x4b7d89(++_0x461e7a);}(_0xd216,0x1de));var _0x6d21=function(_0x407ecb,_0x9cd9cf){_0x407ecb=_0x407ecb-0x0;var _0x56f636=_0xd216[_0x407ecb];return _0x56f636;};'use strict';var util=require(_0x6d21('0x0'));var _=require(_0x6d21('0x1'));var moment=require(_0x6d21('0x2'));function checkNameSurname(_0x214757,_0x1890d8,_0x203c69){var _0x538098='';if(!_[_0x6d21('0x3')](_0x1890d8)&&'string'===typeof _0x1890d8){_0x538098+=_0x1890d8;}if(!_[_0x6d21('0x3')](_0x203c69)&&_0x6d21('0x4')===typeof _0x203c69){_0x538098+='\x20'+_0x203c69;}if(_0x538098!==''){return _0x538098;}return _0x214757;}function Action(_0x3bf65f,_0x274e61,_0xee932b,_0x4aa243,_0x5a75a4){this['uniqueid']=_0xee932b||undefined;this[_0x6d21('0x5')]=_0x3bf65f['id'];this[_0x6d21('0x6')]=_0x274e61[_0x6d21('0x7')];this[_0x6d21('0x8')]=_0x274e61[_0x6d21('0x8')];this['campaigntype']='queue';this[_0x6d21('0x9')]=![];this[_0x6d21('0xa')]=_[_0x6d21('0x3')](_0x3bf65f[_0x6d21('0xb')])?undefined:_0x3bf65f[_0x6d21('0xb')]['name'];this['channelAgent']=this[_0x6d21('0xa')]?util[_0x6d21('0xc')](_0x6d21('0xd'),this[_0x6d21('0xa')]):_0x4aa243||undefined;this[_0x6d21('0xe')]=checkNameSurname(_0x3bf65f[_0x6d21('0xf')][_0x6d21('0x10')],_0x3bf65f[_0x6d21('0xf')][_0x6d21('0x11')],_0x3bf65f['Contact']['lastName']);this[_0x6d21('0x12')]=_0x3bf65f[_0x6d21('0x12')]||![];this['calleridnum']=_0x3bf65f[_0x6d21('0xf')][_0x6d21('0x10')];this['scheduledat']=_0x3bf65f['scheduledat'];this[_0x6d21('0x13')]=_0x3bf65f[_0x6d21('0x13')]||0x0;this[_0x6d21('0x14')]=_0x3bf65f[_0x6d21('0x14')]||0x0;this[_0x6d21('0x15')]=_0x3bf65f[_0x6d21('0x15')]||0x0;this[_0x6d21('0x16')]=(_0x3bf65f[_0x6d21('0x13')]||0x0)+(_0x3bf65f['countcongestionretry']||0x0)+(_0x3bf65f[_0x6d21('0x15')]||0x0);this['countnosuchnumberretry']=_0x3bf65f[_0x6d21('0x17')]||0x0;this['countdropretry']=_0x3bf65f['countdropretry']||0x0;this[_0x6d21('0x18')]=_0x3bf65f[_0x6d21('0x18')]||0x0;this[_0x6d21('0x19')]=_0x3bf65f[_0x6d21('0x19')]||0x0;this[_0x6d21('0x1a')]=_0x3bf65f['countagentrejectretry']||0x0;this[_0x6d21('0x1b')]=_0x3bf65f['callback'];this['callbackuniqueid']=_0x3bf65f[_0x6d21('0x1c')];this[_0x6d21('0x1d')]=_0x3bf65f[_0x6d21('0x1d')];this['recallme']=_0x3bf65f[_0x6d21('0x1e')];this[_0x6d21('0x1f')]=_0x3bf65f[_0x6d21('0x1f')];this[_0x6d21('0x20')]=_0x3bf65f[_0x6d21('0x20')];this[_0x6d21('0x21')]=_[_0x6d21('0x3')](_0x3bf65f[_0x6d21('0xb')])?_0x3bf65f[_0x6d21('0x21')]:_0x3bf65f[_0x6d21('0xb')]['id'];this[_0x6d21('0x22')]=_0x3bf65f[_0x6d21('0x22')];this[_0x6d21('0x23')]='';this[_0x6d21('0x24')]='';}Action[_0x6d21('0x25')]['getCaller']=function(){return util[_0x6d21('0xc')](_0x6d21('0x26'),this['calleridname'],this['number']);};module['exports']=Action; \ No newline at end of file +var _0x8fca=['isNil','string','uniqueid','queue','name','type','Agent','channelAgent','membername','format','calleridname','Contact','phone','firstName','lastName','active','calleridnum','scheduledat','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countnosuchnumberretry','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','originatecalleridnum','getCaller','number','moment'];(function(_0x137733,_0x464b14){var _0x201fb2=function(_0x377e60){while(--_0x377e60){_0x137733['push'](_0x137733['shift']());}};_0x201fb2(++_0x464b14);}(_0x8fca,0xe9));var _0xa8fc=function(_0xff5079,_0x9e4d17){_0xff5079=_0xff5079-0x0;var _0x387fd1=_0x8fca[_0xff5079];return _0x387fd1;};'use strict';var util=require('util');var _=require('lodash');var moment=require(_0xa8fc('0x0'));function checkNameSurname(_0x418209,_0x456ff8,_0x5a8233){var _0x5e8a59='';if(!_[_0xa8fc('0x1')](_0x456ff8)&&_0xa8fc('0x2')===typeof _0x456ff8){_0x5e8a59+=_0x456ff8;}if(!_[_0xa8fc('0x1')](_0x5a8233)&&_0xa8fc('0x2')===typeof _0x5a8233){_0x5e8a59+='\x20'+_0x5a8233;}if(_0x5e8a59!==''){return _0x5e8a59;}return _0x418209;}function Action(_0x4784a7,_0x1bd3d1,_0x6503f0,_0x35ecf6,_0x308734){this[_0xa8fc('0x3')]=_0x6503f0||undefined;this['idContact']=_0x4784a7['id'];this[_0xa8fc('0x4')]=_0x1bd3d1[_0xa8fc('0x5')];this[_0xa8fc('0x6')]=_0x1bd3d1['type'];this['campaigntype']='queue';this['dialAnswer']=![];this['membername']=_[_0xa8fc('0x1')](_0x4784a7[_0xa8fc('0x7')])?undefined:_0x4784a7[_0xa8fc('0x7')]['name'];this[_0xa8fc('0x8')]=this[_0xa8fc('0x9')]?util[_0xa8fc('0xa')]('SIP/%s',this[_0xa8fc('0x9')]):_0x35ecf6||undefined;this[_0xa8fc('0xb')]=checkNameSurname(_0x4784a7[_0xa8fc('0xc')][_0xa8fc('0xd')],_0x4784a7[_0xa8fc('0xc')][_0xa8fc('0xe')],_0x4784a7[_0xa8fc('0xc')][_0xa8fc('0xf')]);this[_0xa8fc('0x10')]=_0x4784a7['active']||![];this[_0xa8fc('0x11')]=_0x4784a7[_0xa8fc('0xc')][_0xa8fc('0xd')];this[_0xa8fc('0x12')]=_0x4784a7[_0xa8fc('0x12')];this['countbusyretry']=_0x4784a7[_0xa8fc('0x13')]||0x0;this[_0xa8fc('0x14')]=_0x4784a7[_0xa8fc('0x14')]||0x0;this[_0xa8fc('0x15')]=_0x4784a7[_0xa8fc('0x15')]||0x0;this[_0xa8fc('0x16')]=(_0x4784a7['countbusyretry']||0x0)+(_0x4784a7['countcongestionretry']||0x0)+(_0x4784a7['countnoanswerretry']||0x0);this[_0xa8fc('0x17')]=_0x4784a7[_0xa8fc('0x17')]||0x0;this[_0xa8fc('0x18')]=_0x4784a7['countdropretry']||0x0;this[_0xa8fc('0x19')]=_0x4784a7[_0xa8fc('0x19')]||0x0;this[_0xa8fc('0x1a')]=_0x4784a7[_0xa8fc('0x1a')]||0x0;this[_0xa8fc('0x1b')]=_0x4784a7['countagentrejectretry']||0x0;this[_0xa8fc('0x1c')]=_0x4784a7[_0xa8fc('0x1c')];this[_0xa8fc('0x1d')]=_0x4784a7[_0xa8fc('0x1d')];this[_0xa8fc('0x1e')]=_0x4784a7[_0xa8fc('0x1e')];this[_0xa8fc('0x1f')]=_0x4784a7[_0xa8fc('0x1f')];this[_0xa8fc('0x20')]=_0x4784a7[_0xa8fc('0x20')];this[_0xa8fc('0x21')]=_0x4784a7[_0xa8fc('0x21')];this[_0xa8fc('0x22')]=_['isNil'](_0x4784a7[_0xa8fc('0x7')])?_0x4784a7[_0xa8fc('0x22')]:_0x4784a7[_0xa8fc('0x7')]['id'];this['VoiceQueueId']=_0x4784a7[_0xa8fc('0x23')];this[_0xa8fc('0x24')]='';this['originatecalleridname']='';}Action['prototype'][_0xa8fc('0x25')]=function(){return util['format']('\x22%s\x22\x20<%s>',this[_0xa8fc('0xb')],this[_0xa8fc('0x26')]);};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 ae86713..d6403a3 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 _0x1b68=['lookAgent','isEmpty','execCall','[Preview][execCall][success]','Queue:\x20','\x20IdHopper:\x20','custom:agentcalled','called','Calling','[Preview][execCall][failure]','logBlacklist','createHistory','[Blacklist][error]','Contact\x20in\x20black\x20List','active','SIP/%s','execRun','unlock','disableContact','getContactPreview','recallme','validateContact','checkIsBlackList','Contact.phone','Call\x20unsuccessful','[Preview][validateContact][Empty\x20Contact]','Empty\x20Contact','[Preview][validateContact][Empty\x20Campaign]','Empty\x20Campaign','campaign\x20Name:\x20','\x20Trunk\x20is\x20not\x20active','[Preview][validateContact][Trunk\x20not\x20work]','Trunk\x20not\x20work','\x20Not\x20Active','Is\x20Valid','trim','dialCutDigit','SIP/%s/%s%s','substring','getCallerId','dialRandomLastDigitCallerIdNumber','getCallerIdRandom','originatecalleridname','extractCalleridName','originatecalleridnum','extractCalleridNumber','merge','toLowerVariables','variablesAction','OriginateError','logLookAgent','clone','response','unlockContact','idContact','custom:agentringnoanswer','rejected','callProgressDetectingAgent','[callProgressDetectingAgent][logAnswer]','[syncHangup][talking]','cause','[syncHangup][talking][cause]','statedesc','dialQueueProject','channelstate','transfer','[syncHangup][talking][transfer]','syncDialEnd','destlinkedid','destuniqueid','addVariable','variables','keys','variable','error','[syncVarSet][Preview]','transfertargetlinkedid','transfererlinkedid','exports','util','lodash','moment','ioredis','preview','../../../config/logger','actionPreview','../ami','./rpcDb','./util/util','redis','defaults','localhost','socket.io-emitter','prototype','finally','sequence','campaignsPreview','trunks','actions','agents','clockClearZombieChannels','originateresponse','syncOriginateResponse','syncHangup','bind','hanguprequest','syncHangupRequest','dialend','syncNewExten','varset','syncVarSet','syncAttendedTransfer','syncBlindTransfer','outbound','name','strategy','pTalking','sumDuration','sumHoldTime','total','type','unmanaged','abandoned','waiting','dialActive','dialMethod','dialOriginateCallerIdName','dialOriginateCallerIdNumber','dialOriginateTimeout','dialPrefix','outboundAnswerAgiCallsDay','outboundAnswerCallsDay','outboundBlacklistCallsDay','outboundBusyCallsDay','outboundCongestionCallsDay','outboundDropCallsDayACS','outboundDropCallsDayTimeout','outboundNoAnswerCallsDay','outboundOriginateFailureCallsDay','outboundReCallsDay','outboundRejectCallsDay','outboundUnknownCallsDay','predictiveIntervalAnsweredCalls','predictiveIntervalAvgTalktime','predictiveIntervalDroppedCallsCallersExit','predictiveIntervalDroppedCallsTimeout','predictiveIntervalErlangCalls','predictiveIntervalErlangCallsDroppedCalls','predictiveIntervalPauses','predictiveIntervalAvailable','predictiveIntervalTotalCalls','message','erlangCallToSecond','erlangAbandonmentRate','erlangBusyFactor','startProgressive','Trunk','callerid','Interval','md5','format','voice:queue:%s','voice_queue:save','info','[DEBUG]\x20Emit\x20voice_queue_channel:remove\x20event','stringify','voice_queue_channel:remove','sendMessageOneNotActive','originated','paused','NOT_ACTIVE','logger','[CampaignPreview]\x20Campaign\x20Queue:\x20','\x20is\x20not\x20active','IS_DISACTIVED','\x20is\x20disactive','loopCampaigns','syncCampaigns','hasOwnProperty','booked','recallMe','clearZombieChannel','enqueue','isNil','Queue','originated:\x20','queue','pTalking:\x20','dialAnswer','pick','contactId','UserId','VoiceQueueId','ListId','Action','status','channel','catch','No\x20such\x20channel','[clearZombieChannel]','loggerError','[Dialer][checkChannel][pTalking][Preview]','[Dialer][checkChannel][Preview]','[action]','size','getContactRecallMe','agentReadyId','then','length','getDiff','scheduledat','dialRecallMeTimeout','Agent','run','logger2','[RecallMe]','starttime','YYYY-MM-DD\x20HH:mm:ss','logCustomer','RecallInQueue','dialRecallInQueue','[HistoryDialRecallInQueue][historyCatch]','RecallFailedTimeout','createCustomerHistory','[HistoryRecallClose]','createCustomerFinal','[getContactRecallMe]','setMessage','loggedIn','AGENTS_NOT_LOGGED','isActive','isTrunkReachable','TrunkBackup','ACTIVE','callProgressDetectingCustomer','outboundNoSuchCallsDay','countnosuchnumberretry','countglobal','totalGlobal','NoSuchNumber','[callProgressDetectingCustomer][logNoSuch]','dialGlobalMaxRetry','cloneAction','Global','[callProgressDetectingCustomer][logNoSuchGlobal]','dialNoSuchNumberMaxRetry','rescheduleContact','scheduledAt','dialNoSuchNumberRetryFrequency','unlockAgent','activeContact','linkedid','ANSWER','responsetime','uniqueid','buildObj','connect','acw','emit','custom:agentConnectPreview','buildAcw','custom:agentcomplete','complete','answered','decrementTalkink','[16]','Answer','[callProgressDetectingCustomer][logAnswer]','[callProgressDetectingCustomer][logAnswerGlobal]','crateCustomerReportQueue','talktime','[syncHangup][talking][decrement]','BUSY','countbusyretry','Busy','[callProgressDetectingCustomer][logBusy]','[callProgressDetectingCustomer][logBusyGlobal]','dialBusyMaxRetry','NOANSWER','countnoanswerretry','NoAnswer','[callProgressDetectingCustomer][logNoAnswer]','dialNoAnswerMaxRetry','dialNoAnswerRetryFrequency','CONGESTION','countcongestionretry','Congestion','[callProgressDetectingCustomer][logCongestion]','dialCongestionMaxRetry','countagentrejectretry','AgentReject','[callProgressDetectingCustomer][logAgentReject]','dialAgentRejectMaxRetry','dialAgentRejectRetryFrequency','ABANDONED','outboundAbandonedCallsDay','countabandonedretry','Abandoned','[callProgressDetectingCustomer][logAbandoned]','countabandonedetry','dialAbandonedMaxRety','dialAbandonedRetryFrequency','[default]','[Dialer][decrementTalkink][no\x20Hangup][Preview]','cause-txt','dialstatus','[callProgressDetectingCustomer][logUnknown]','[callProgressDetectingCustomer][logUnknownGlobal]','updateOriginated','[callProgressDetectingCustomer]','[originated][decrement][callProgressDetectingCustomer]','\x20Queue','isUndefined','object','reason','logAgent','createAgentHistory','[callProgressDetectingAgent][logNoSuch]','[callProgressDetectingAgent][logNoAnswer]','[callProgressDetectingAgent][logBusy]','[callProgressDetectingAgent][logCongestion]','[callProgressDetectingAgent][logAnswerAGI]','[callProgressDetectingAgent]','checkInBlack','Contact','phone','Contact\x20is\x20undefined'];(function(_0x5a8408,_0x19e970){var _0x7a8d16=function(_0x3dd08f){while(--_0x3dd08f){_0x5a8408['push'](_0x5a8408['shift']());}};_0x7a8d16(++_0x19e970);}(_0x1b68,0x196));var _0x81b6=function(_0xa9c2a8,_0x5afbc4){_0xa9c2a8=_0xa9c2a8-0x0;var _0x449b25=_0x1b68[_0xa9c2a8];return _0x449b25;};'use strict';var util=require(_0x81b6('0x0'));var _=require(_0x81b6('0x1'));var BPromise=require('bluebird');var uuid=require('uuid');var moment=require(_0x81b6('0x2'));var md5=require('md5');var Redis=require(_0x81b6('0x3'));var config=require('../../../config/environment');var logger=require('../../../config/logger')(_0x81b6('0x4'));var loggerAction=require(_0x81b6('0x5'))(_0x81b6('0x6'));var ami=require(_0x81b6('0x7'));var rpcDb=require(_0x81b6('0x8'));var Action=require('./action');var ut=require(_0x81b6('0x9'));config[_0x81b6('0xa')]=_[_0x81b6('0xb')](config[_0x81b6('0xa')],{'host':_0x81b6('0xc'),'port':0x18eb});var io=require(_0x81b6('0xd'))(new Redis(config['redis']));var Sequence=function(){};Sequence[_0x81b6('0xe')]['enqueue']=function(_0x335985){this['tail']=this['tail']?this['tail'][_0x81b6('0xf')](_0x335985):_0x335985();};function Preview(_0x3d2785){this[_0x81b6('0x10')]=new Sequence();this[_0x81b6('0x11')]=_0x3d2785['voiceQueues'];this[_0x81b6('0x12')]=_0x3d2785[_0x81b6('0x12')];this[_0x81b6('0x13')]={};this['agents']=_0x3d2785[_0x81b6('0x14')];this[_0x81b6('0x15')]=0x0;ami['on'](_0x81b6('0x16'),this[_0x81b6('0x17')]['bind'](this));ami['on']('hangup',this[_0x81b6('0x18')][_0x81b6('0x19')](this));ami['on'](_0x81b6('0x1a'),this[_0x81b6('0x1b')][_0x81b6('0x19')](this));ami['on'](_0x81b6('0x1c'),this['syncDialEnd'][_0x81b6('0x19')](this));ami['on']('newexten',this[_0x81b6('0x1d')][_0x81b6('0x19')](this));ami['on'](_0x81b6('0x1e'),this[_0x81b6('0x1f')]['bind'](this));ami['on']('attendedtransfer',this[_0x81b6('0x20')][_0x81b6('0x19')](this));ami['on']('blindtransfer',this[_0x81b6('0x21')]['bind'](this));this['loopCampaigns'](this[_0x81b6('0x11')]);}function emit(_0x5a3dda,_0x2d7060,_0x455d8e){io['to'](_0x5a3dda)['emit'](_0x2d7060,_0x455d8e);}function emitCampaignPreview(_0x55c0ff){if(_0x55c0ff['type']===_0x81b6('0x22')){var _0x56b0a2={'id':_0x55c0ff['id'],'name':_0x55c0ff[_0x81b6('0x23')],'strategy':_0x55c0ff[_0x81b6('0x24')],'answered':_0x55c0ff['answered'],'available':_0x55c0ff['available'],'loggedIn':_0x55c0ff['loggedIn'],'pTalking':_0x55c0ff[_0x81b6('0x25')],'sumBillable':_0x55c0ff['sumBillable'],'sumDuration':_0x55c0ff[_0x81b6('0x26')],'sumHoldTime':_0x55c0ff[_0x81b6('0x27')]||0x0,'talking':_0x55c0ff['talking'],'total':_0x55c0ff[_0x81b6('0x28')],'type':_0x55c0ff[_0x81b6('0x29')],'unmanaged':_0x55c0ff[_0x81b6('0x2a')],'abandoned':_0x55c0ff[_0x81b6('0x2b')],'waiting':_0x55c0ff[_0x81b6('0x2c')],'loggedInDb':_0x55c0ff['loggedInDb'],'dialActive':_0x55c0ff[_0x81b6('0x2d')],'dialMethod':_0x55c0ff[_0x81b6('0x2e')],'dialOriginateCallerIdName':_0x55c0ff[_0x81b6('0x2f')],'dialOriginateCallerIdNumber':_0x55c0ff[_0x81b6('0x30')],'dialOriginateTimeout':_0x55c0ff[_0x81b6('0x31')],'dialPrefix':_0x55c0ff[_0x81b6('0x32')],'outboundAnswerAgiCallsDay':_0x55c0ff[_0x81b6('0x33')],'outboundAnswerCallsDay':_0x55c0ff[_0x81b6('0x34')],'outboundBlacklistCallsDay':_0x55c0ff[_0x81b6('0x35')],'outboundBusyCallsDay':_0x55c0ff[_0x81b6('0x36')],'outboundCongestionCallsDay':_0x55c0ff[_0x81b6('0x37')],'outboundDropCallsDayACS':_0x55c0ff[_0x81b6('0x38')],'outboundDropCallsDayCallersExit':_0x55c0ff['outboundDropCallsDayCallersExit'],'outboundDropCallsDayTimeout':_0x55c0ff[_0x81b6('0x39')],'outboundNoAnswerCallsDay':_0x55c0ff[_0x81b6('0x3a')],'outboundNoSuchCallsDay':_0x55c0ff['outboundNoSuchCallsDay'],'outboundOriginateFailureCallsDay':_0x55c0ff[_0x81b6('0x3b')],'outboundReCallsDay':_0x55c0ff[_0x81b6('0x3c')],'outboundRejectCallsDay':_0x55c0ff[_0x81b6('0x3d')],'outboundUnknownCallsDay':_0x55c0ff[_0x81b6('0x3e')],'outboundAbandonedCallsDay':_0x55c0ff['outboundAbandonedCallsDay'],'predictiveIntervalAnsweredCalls':_0x55c0ff[_0x81b6('0x3f')],'predictiveIntervalAvgHoldtime':_0x55c0ff['predictiveIntervalAvgHoldtime'],'predictiveIntervalAvgTalktime':_0x55c0ff[_0x81b6('0x40')],'predictiveIntervalDroppedCallsCallersExit':_0x55c0ff[_0x81b6('0x41')],'predictiveIntervalDroppedCallsTimeout':_0x55c0ff[_0x81b6('0x42')],'predictiveIntervalErlangCalls':_0x55c0ff[_0x81b6('0x43')],'predictiveIntervalErlangCallsDroppedCalls':_0x55c0ff[_0x81b6('0x44')],'predictiveIntervalHitRate':_0x55c0ff['predictiveIntervalHitRate'],'predictiveIntervalMultiplicativeFactor':_0x55c0ff['predictiveIntervalMultiplicativeFactor'],'predictiveIntervalPauses':_0x55c0ff[_0x81b6('0x45')],'predictiveIntervalAvailable':_0x55c0ff[_0x81b6('0x46')],'predictiveIntervalTotalCalls':_0x55c0ff[_0x81b6('0x47')],'message':_0x55c0ff[_0x81b6('0x48')],'originated':_0x55c0ff['originated'],'erlangCalls':_0x55c0ff['erlangCalls'],'erlangCallToSecond':_0x55c0ff[_0x81b6('0x49')],'erlangAbandonmentRate':_0x55c0ff[_0x81b6('0x4a')],'erlangBusyFactor':_0x55c0ff[_0x81b6('0x4b')],'startPredictive':_0x55c0ff['startPredictive'],'startProgressive':_0x55c0ff[_0x81b6('0x4c')]};if(_0x55c0ff['Trunk']){_0x56b0a2[_0x81b6('0x4d')]={'id':_0x55c0ff[_0x81b6('0x4d')]['id'],'name':_0x55c0ff[_0x81b6('0x4d')][_0x81b6('0x23')],'active':_0x55c0ff[_0x81b6('0x4d')]['active'],'callerid':_0x55c0ff[_0x81b6('0x4d')][_0x81b6('0x4e')]};}if(_0x55c0ff[_0x81b6('0x4f')]){_0x56b0a2[_0x81b6('0x4f')]={'id':_0x55c0ff[_0x81b6('0x4f')]['id'],'name':_0x55c0ff[_0x81b6('0x4f')][_0x81b6('0x23')]};}var _0x4e6cae=md5(JSON['stringify'](_0x56b0a2));if(_0x55c0ff[_0x81b6('0x50')]!==_0x4e6cae){_0x55c0ff[_0x81b6('0x50')]=_0x4e6cae;emit(util[_0x81b6('0x51')](_0x81b6('0x52'),_0x56b0a2[_0x81b6('0x23')]),_0x81b6('0x53'),_0x56b0a2);}}}function emitVoiceQueueChannelRemove(_0x298cbe){logger[_0x81b6('0x54')](_0x81b6('0x55'),JSON[_0x81b6('0x56')](_0x298cbe));emit(util['format'](_0x81b6('0x52'),_0x298cbe[_0x81b6('0x23')]),_0x81b6('0x57'),_0x298cbe);}function notSendMessagesQueue(_0x137abe){if(_0x137abe[_0x81b6('0x58')]){if(_0x137abe[_0x81b6('0x59')]===0x0&&_0x137abe[_0x81b6('0x25')]===0x0){_0x137abe[_0x81b6('0x58')]=![];_0x137abe['available']=0x0;_0x137abe[_0x81b6('0x5a')]=0x0;_0x137abe[_0x81b6('0x48')]=_0x81b6('0x5b');ut[_0x81b6('0x5c')](_0x81b6('0x5d'),_0x137abe['name']+_0x81b6('0x5e'));}else{_0x137abe[_0x81b6('0x48')]=_0x81b6('0x5f');ut[_0x81b6('0x5c')](_0x81b6('0x5d'),_0x137abe['name']+_0x81b6('0x60'));}emitCampaignPreview(_0x137abe);}}Preview[_0x81b6('0xe')][_0x81b6('0x61')]=function(){var _0x51ffc0=this;setInterval(function(){_0x51ffc0['syncCampaigns']();},0x7cf);};Preview['prototype'][_0x81b6('0x62')]=function(){var _0x42b289=this['campaignsPreview'];this['clockClearZombieChannels']+=0x1;for(var _0x22a3ea in _0x42b289){if(_0x42b289[_0x81b6('0x63')](_0x22a3ea)&&(_0x42b289[_0x22a3ea]['dialMethod']===_0x81b6('0x4')||_0x42b289[_0x22a3ea]['dialMethod']===_0x81b6('0x64'))&&_0x42b289[_0x22a3ea][_0x81b6('0x29')]==='outbound'){if(this[_0x81b6('0x15')]>0x7){this['clockClearZombieChannels']=0x0;this['clearZombieChannels']();}}if(_0x42b289['hasOwnProperty'](_0x22a3ea)&&_0x42b289[_0x22a3ea][_0x81b6('0x2e')]===_0x81b6('0x4')&&_0x42b289[_0x22a3ea][_0x81b6('0x29')]==='outbound'){if(_0x42b289[_0x22a3ea][_0x81b6('0x2d')]){this['setMessage'](_0x42b289[_0x22a3ea]);this[_0x81b6('0x65')](_0x42b289[_0x22a3ea]);}else{notSendMessagesQueue(_0x42b289[_0x22a3ea]);}}}};Preview[_0x81b6('0xe')][_0x81b6('0x66')]=function(_0x47be06){var _0x159d04=this;this[_0x81b6('0x10')][_0x81b6('0x67')](function(){if(!_[_0x81b6('0x68')](_0x159d04[_0x81b6('0x13')][_0x47be06])){loggerAction[_0x81b6('0x54')]('[clearZombieChannels][talking]',_0x47be06,_0x81b6('0x69'),_0x159d04[_0x81b6('0x13')][_0x47be06]['queue'],_0x81b6('0x6a'),JSON['stringify'](_0x159d04[_0x81b6('0x11')][_0x159d04[_0x81b6('0x13')][_0x47be06][_0x81b6('0x6b')]][_0x81b6('0x59')]),_0x81b6('0x6c'),JSON['stringify'](_0x159d04['campaignsPreview'][_0x159d04[_0x81b6('0x13')][_0x47be06][_0x81b6('0x6b')]][_0x81b6('0x25')]),JSON[_0x81b6('0x56')](_0x159d04[_0x81b6('0x13')][_0x47be06][_0x81b6('0x6d')]),JSON[_0x81b6('0x56')](_[_0x81b6('0x6e')](_0x159d04['actions'][_0x47be06],[_0x81b6('0x6f'),_0x81b6('0x70'),_0x81b6('0x71'),_0x81b6('0x72')])));return ami[_0x81b6('0x73')]({'action':_0x81b6('0x74'),'channel':_0x159d04['actions'][_0x47be06][_0x81b6('0x75')]})[_0x81b6('0x76')](function(_0x4deca8){if(_0x4deca8[_0x81b6('0x48')]===_0x81b6('0x77')){setTimeout(function(){if(_0x159d04[_0x81b6('0x13')][_0x47be06]){ut['updateOriginated'](_0x159d04[_0x81b6('0x11')][_0x159d04[_0x81b6('0x13')][_0x47be06][_0x81b6('0x6b')]],'[clearZombieChannel]');if(_0x159d04[_0x81b6('0x13')][_0x47be06][_0x81b6('0x6d')]===!![]){ut['decrementTalkink'](_0x159d04['campaignsPreview'][_0x159d04[_0x81b6('0x13')][_0x47be06][_0x81b6('0x6b')]],_0x81b6('0x78'));ut[_0x81b6('0x79')](_0x81b6('0x7a')+_0x47be06,_0x159d04[_0x81b6('0x13')][_0x47be06][_0x81b6('0x6b')]);}ut[_0x81b6('0x79')](_0x81b6('0x7b')+_0x47be06,_0x159d04[_0x81b6('0x13')][_0x47be06][_0x81b6('0x6b')]);delete _0x159d04['actions'][_0x47be06];}},0x2328);}});}});};Preview[_0x81b6('0xe')]['clearZombieChannels']=function(){var _0x555925=this;loggerAction[_0x81b6('0x54')](_0x81b6('0x7c'),_[_0x81b6('0x7d')](this['actions']));for(var _0x41743a in this[_0x81b6('0x13')]){if(_0x555925[_0x81b6('0x13')]['hasOwnProperty'](_0x41743a)){_0x555925[_0x81b6('0x66')](_0x41743a);}}};Preview[_0x81b6('0xe')]['recallMe']=function(_0x3da952){var _0x80faa7=this;rpcDb[_0x81b6('0x7e')](_0x3da952['id'],ut[_0x81b6('0x7f')](this[_0x81b6('0x14')]))[_0x81b6('0x80')](function(_0x143ff9){if(!_[_0x81b6('0x68')](_0x143ff9)){for(var _0x3c7ffe=0x0;_0x3c7ffe<_0x143ff9[_0x81b6('0x81')];_0x3c7ffe+=0x1){if(ut[_0x81b6('0x82')](_0x143ff9[_0x3c7ffe][_0x81b6('0x83')])<_0x3da952[_0x81b6('0x84')]*0x3c){if(_0x143ff9[_0x3c7ffe][_0x81b6('0x85')]&&!_0x143ff9[_0x3c7ffe][_0x81b6('0x85')]['voicePause']){_0x80faa7[_0x81b6('0x86')](_0x143ff9[_0x3c7ffe]['id'])[_0x81b6('0x80')](ut[_0x81b6('0x87')](_0x81b6('0x88')))[_0x81b6('0x76')](ut[_0x81b6('0x87')](_0x81b6('0x88')));}else{rpcDb['disableContact'](_0x143ff9[_0x3c7ffe]['id']);}}else{var _0xc0f43e=new Action(_0x143ff9[_0x3c7ffe],_0x3da952);_0xc0f43e[_0x81b6('0x89')]=moment()['format'](_0x81b6('0x8a'));_0x3da952[_0x81b6('0x3c')]+=0x1;ut[_0x81b6('0x8b')](_0xc0f43e,0x17,_0x81b6('0x8c'));if(_0x3da952[_0x81b6('0x8d')]){rpcDb['rescheduleContactInQueue'](ut['createBody'](_0x143ff9[_0x3c7ffe]));rpcDb['createCustomerHistory'](_0xc0f43e,_0x81b6('0x8e'));}else{ut[_0x81b6('0x8b')](_0xc0f43e,0x16,_0x81b6('0x8f'));rpcDb[_0x81b6('0x90')](_0xc0f43e,_0x81b6('0x91'));rpcDb[_0x81b6('0x92')](_0xc0f43e,_0x81b6('0x91'));}}}}})[_0x81b6('0x76')](ut['logger2'](_0x81b6('0x93')));};Preview[_0x81b6('0xe')][_0x81b6('0x94')]=function(_0x1acb17){_0x1acb17[_0x81b6('0x58')]=!![];if(ut['IsNotLoggedIn'](_0x1acb17[_0x81b6('0x95')])){_0x1acb17[_0x81b6('0x48')]=_0x81b6('0x96');}else if(!ut[_0x81b6('0x97')](_0x1acb17['dialActive'])){_0x1acb17[_0x81b6('0x48')]=_0x81b6('0x5b');}else if(!this[_0x81b6('0x98')](_0x1acb17[_0x81b6('0x4d')])){if(!this['isTrunkReachable'](_0x1acb17[_0x81b6('0x99')])){_0x1acb17[_0x81b6('0x48')]='TRUNK_IS_NOT_REACHABLE';}else{_0x1acb17[_0x81b6('0x48')]=_0x81b6('0x9a');}}else{_0x1acb17[_0x81b6('0x48')]=_0x81b6('0x9a');}emitCampaignPreview(_0x1acb17);};Preview[_0x81b6('0xe')][_0x81b6('0x9b')]=function(_0x42dccd,_0x482e5f,_0x2bae77){var _0x585aa9=this;var _0x226635=this[_0x81b6('0x13')][_0x482e5f];var _0x15c13d=this[_0x81b6('0x11')][_0x226635[_0x81b6('0x6b')]];var _0x413ae2;if(_0x15c13d){switch(_0x2bae77){case'1':_0x15c13d[_0x81b6('0x9c')]+=0x1;_0x226635[_0x81b6('0x9d')]+=0x1;_0x226635[_0x81b6('0x9e')]=ut[_0x81b6('0x9f')](_0x226635);ut['logCustomer'](_0x226635,0x0,_0x81b6('0xa0'));rpcDb[_0x81b6('0x90')](_0x226635,_0x81b6('0xa1'));if(ut['totalGlobal'](_0x226635)>=_0x15c13d[_0x81b6('0xa2')]){_0x413ae2=ut[_0x81b6('0xa3')](_0x226635,0xf,_0x81b6('0xa4'));rpcDb[_0x81b6('0x92')](_0x413ae2,_0x81b6('0xa5'));}else{if(_0x226635[_0x81b6('0x9d')]>=_0x15c13d[_0x81b6('0xa6')]){rpcDb[_0x81b6('0x92')](_0x226635,_0x81b6('0xa5'));}else{rpcDb[_0x81b6('0xa7')](ut[_0x81b6('0xa8')](_0x226635,'countnosuchnumberretry',_0x15c13d[_0x81b6('0xa9')]),_0x226635[_0x81b6('0xaa')],_0x226635[_0x81b6('0xab')]);}}delete this[_0x81b6('0x13')][_0x42dccd[_0x81b6('0xac')]];break;case _0x81b6('0xad'):var _0x552c1a=moment()[_0x81b6('0x51')]('YYYY-MM-DD\x20HH:mm:ss');_0x226635[_0x81b6('0xae')]=_0x552c1a;_0x226635['answertime']=_0x552c1a;_0x226635[_0x81b6('0x6d')]=!![];_0x15c13d[_0x81b6('0x25')]+=0x1;logger[_0x81b6('0x54')]('[syncHangup][talking][increment]',_0x226635[_0x81b6('0xaf')],'\x20Queue',_0x15c13d[_0x81b6('0x23')],_0x81b6('0x6c'),_0x15c13d[_0x81b6('0x25')]);ami['emit']('custom:agentconnect',ut[_0x81b6('0xb0')](_0x226635,_0x81b6('0xb1')));if(_0x15c13d[_0x81b6('0xb2')]){ami[_0x81b6('0xb3')](_0x81b6('0xb4'),ut[_0x81b6('0xb5')](_0x226635));}break;case'16':ami[_0x81b6('0xb3')](_0x81b6('0xb6'),ut[_0x81b6('0xb0')](_0x226635,_0x81b6('0xb7')));emitVoiceQueueChannelRemove(ut[_0x81b6('0xb0')](_0x226635,'complete'));_0x15c13d[_0x81b6('0x34')]+=0x1;_0x15c13d[_0x81b6('0x28')]+=0x1;_0x15c13d[_0x81b6('0xb8')]+=0x1;ut[_0x81b6('0xb9')](_0x15c13d,_0x81b6('0xba'));_0x226635[_0x81b6('0x9e')]=ut[_0x81b6('0x9f')](_0x226635);ut[_0x81b6('0x8b')](_0x226635,0x4,_0x81b6('0xbb'));rpcDb[_0x81b6('0x90')](_0x226635,_0x81b6('0xbc'));rpcDb[_0x81b6('0x92')](_0x226635,_0x81b6('0xbd'));rpcDb[_0x81b6('0xbe')](_0x226635);_0x15c13d[_0x81b6('0x26')]+=_0x226635[_0x81b6('0xbf')];_0x15c13d['sumBillable']+=_0x226635[_0x81b6('0xbf')];logger[_0x81b6('0x54')](_0x81b6('0xc0'),_0x226635[_0x81b6('0xaf')],'\x20Queue',_0x15c13d[_0x81b6('0x23')],_0x81b6('0x6c'),_0x15c13d[_0x81b6('0x25')]);delete this[_0x81b6('0x13')][_0x42dccd[_0x81b6('0xac')]];break;case _0x81b6('0xc1'):_0x15c13d[_0x81b6('0x36')]+=0x1;_0x226635[_0x81b6('0xc2')]+=0x1;_0x226635[_0x81b6('0x9e')]=ut[_0x81b6('0x9f')](_0x226635);ut['logCustomer'](_0x226635,0x5,_0x81b6('0xc3'));rpcDb[_0x81b6('0x90')](_0x226635,_0x81b6('0xc4'));if(ut['totalGlobal'](_0x226635)>=_0x15c13d['dialGlobalMaxRetry']){_0x413ae2=ut[_0x81b6('0xa3')](_0x226635,0xf,'Global');rpcDb['createCustomerFinal'](_0x413ae2,_0x81b6('0xc5'));}else{if(_0x226635[_0x81b6('0xc2')]>=_0x15c13d[_0x81b6('0xc6')]){rpcDb[_0x81b6('0x92')](_0x226635,'[callProgressDetectingCustomer][logBusy]');}else{rpcDb[_0x81b6('0xa7')](ut[_0x81b6('0xa8')](_0x226635,_0x81b6('0xc2'),_0x15c13d['dialBusyRetryFrequency']),_0x226635[_0x81b6('0xaa')],_0x226635[_0x81b6('0xab')]);}}break;case _0x81b6('0xc7'):_0x15c13d['outboundNoAnswerCallsDay']+=0x1;_0x226635[_0x81b6('0xc8')]+=0x1;_0x226635[_0x81b6('0x9e')]=ut[_0x81b6('0x9f')](_0x226635);ut['logCustomer'](_0x226635,0x3,_0x81b6('0xc9'));rpcDb[_0x81b6('0x90')](_0x226635,_0x81b6('0xca'));if(ut[_0x81b6('0x9f')](_0x226635)>=_0x15c13d[_0x81b6('0xa2')]){_0x413ae2=ut['cloneAction'](_0x226635,0xf,'Global');rpcDb[_0x81b6('0x92')](_0x413ae2,'[callProgressDetectingCustomer][logNoAnswerGlobal]');}else{if(_0x226635['countnoanswerretry']>=_0x15c13d[_0x81b6('0xcb')]){rpcDb[_0x81b6('0x92')](_0x226635,_0x81b6('0xca'));}else{rpcDb['rescheduleContact'](ut[_0x81b6('0xa8')](_0x226635,'countnoanswerretry',_0x15c13d[_0x81b6('0xcc')]),_0x226635[_0x81b6('0xaa')],_0x226635[_0x81b6('0xab')]);}}break;case _0x81b6('0xcd'):_0x15c13d[_0x81b6('0x37')]+=0x1;_0x226635[_0x81b6('0xce')]+=0x1;_0x226635[_0x81b6('0x9e')]=ut[_0x81b6('0x9f')](_0x226635);ut[_0x81b6('0x8b')](_0x226635,0x8,_0x81b6('0xcf'));rpcDb['createCustomerHistory'](_0x226635,_0x81b6('0xd0'));if(ut[_0x81b6('0x9f')](_0x226635)>=_0x15c13d[_0x81b6('0xa2')]){_0x413ae2=ut[_0x81b6('0xa3')](_0x226635,0xf,_0x81b6('0xa4'));rpcDb[_0x81b6('0x92')](_0x413ae2,'[callProgressDetectingCustomer][logCongestionGlobal]');}else{if(_0x226635[_0x81b6('0xce')]>=_0x15c13d[_0x81b6('0xd1')]){rpcDb[_0x81b6('0x92')](_0x226635,'[callProgressDetectingCustomer][logCongestion]');}else{rpcDb['rescheduleContact'](ut[_0x81b6('0xa8')](_0x226635,'countcongestionretry',_0x15c13d['dialBusyRetryFrequency']),_0x226635['unlockAgent'],_0x226635[_0x81b6('0xab')]);}}break;case'CANCEL':_0x15c13d['outboundRejectCallsDay']+=0x1;_0x226635[_0x81b6('0xd2')]+=0x1;_0x226635[_0x81b6('0x9e')]=ut[_0x81b6('0x9f')](_0x226635);ut[_0x81b6('0x8b')](_0x226635,0x14,'AgentReject');rpcDb[_0x81b6('0x90')](_0x226635,'[syncHangupRequest][logAgentReject]');if(ut['totalGlobal'](_0x226635)>=_0x15c13d[_0x81b6('0xa2')]){_0x413ae2=ut[_0x81b6('0xa3')](_0x226635,0x14,_0x81b6('0xd3'));rpcDb[_0x81b6('0x92')](_0x413ae2,_0x81b6('0xd4'));}else{if(_0x226635[_0x81b6('0xd2')]>=_0x15c13d[_0x81b6('0xd5')]){rpcDb[_0x81b6('0x92')](_0x226635,_0x81b6('0xd4'));}else{rpcDb[_0x81b6('0xa7')](ut['scheduledAt'](_0x226635,_0x81b6('0xd2'),_0x15c13d[_0x81b6('0xd6')]),_0x226635['unlockAgent'],_0x226635[_0x81b6('0xab')]);}}break;case _0x81b6('0xd7'):_0x15c13d[_0x81b6('0xd8')]+=0x1;_0x226635[_0x81b6('0xd9')]+=0x1;_0x226635[_0x81b6('0x9e')]=ut[_0x81b6('0x9f')](_0x226635);ut['logCustomer'](_0x226635,0xb,_0x81b6('0xda'));rpcDb[_0x81b6('0x90')](_0x226635,_0x81b6('0xdb'));if(ut[_0x81b6('0x9f')](_0x226635)>=_0x15c13d['dialGlobalMaxRetry']){_0x413ae2=ut[_0x81b6('0xa3')](_0x226635,0xf,_0x81b6('0xa4'));rpcDb['createCustomerFinal'](_0x413ae2,_0x81b6('0xdb'));}else{if(_0x226635[_0x81b6('0xdc')]>=_0x15c13d[_0x81b6('0xdd')]){rpcDb[_0x81b6('0x92')](_0x226635,_0x81b6('0xdb'));}else{rpcDb[_0x81b6('0xa7')](ut[_0x81b6('0xa8')](_0x226635,_0x81b6('0xd9'),_0x15c13d[_0x81b6('0xde')]),_0x226635[_0x81b6('0xaa')],_0x226635[_0x81b6('0xab')]);}}break;default:if(_0x226635[_0x81b6('0x6d')]){ut[_0x81b6('0xb9')](_0x15c13d,_0x81b6('0xdf'));ut[_0x81b6('0x79')](_0x81b6('0xe0')+_0x15c13d[_0x81b6('0x23')],_0x42dccd);}_0x15c13d[_0x81b6('0x3e')]+=0x1;_0x226635[_0x81b6('0x9e')]=ut[_0x81b6('0x9f')](_0x226635);ut[_0x81b6('0x8b')](_0x226635,0xc,_0x42dccd[_0x81b6('0xe1')]||_0x42dccd[_0x81b6('0xe2')]);rpcDb[_0x81b6('0x90')](_0x226635,_0x81b6('0xe3'));if(ut['totalGlobal'](_0x226635)>=_0x15c13d[_0x81b6('0xa2')]){_0x413ae2=ut['cloneAction'](_0x226635,0xf,'Global');rpcDb[_0x81b6('0x92')](_0x413ae2,_0x81b6('0xe4'));}else{rpcDb[_0x81b6('0x92')](_0x226635,_0x81b6('0xe4'));}delete this[_0x81b6('0x13')][_0x42dccd[_0x81b6('0xac')]];}if(!(_0x226635[_0x81b6('0x6d')]&&_0x2bae77==='16')){ut[_0x81b6('0xe5')](_0x15c13d,_0x81b6('0xe6'));logger[_0x81b6('0x54')](_0x81b6('0xe7'),_0x226635[_0x81b6('0xaf')],_0x81b6('0xe8'),_0x15c13d[_0x81b6('0x23')],_0x81b6('0x6a'),_0x15c13d[_0x81b6('0x59')]);}if(_0x2bae77!=='ANSWER'){delete this[_0x81b6('0x13')][_0x42dccd['linkedid']];delete this[_0x81b6('0x13')][_0x42dccd['destlinkedid']];}}};Preview['prototype']['callProgressDetectingAgent']=function(_0x3f8a8a,_0x1b369d,_0x58696d){if(_[_0x81b6('0xe9')](_0x1b369d)&&_0x81b6('0xea')!==typeof _0x1b369d){return;}if(_[_0x81b6('0xe9')](_0x58696d)&&_0x81b6('0xea')!==typeof _0x58696d){return;}switch(_0x58696d[_0x81b6('0xeb')]){case'0':ut[_0x81b6('0xec')](_0x3f8a8a,0x0,'NoSuchNumber');rpcDb[_0x81b6('0xed')](_0x3f8a8a,_0x81b6('0xee'));break;case'3':ut[_0x81b6('0xec')](_0x3f8a8a,0x3,'NoAnswer');rpcDb[_0x81b6('0xed')](_0x3f8a8a,_0x81b6('0xef'));break;case'5':ut['logAgent'](_0x3f8a8a,0x5,_0x81b6('0xc3'));rpcDb[_0x81b6('0xed')](_0x3f8a8a,_0x81b6('0xf0'));break;case'8':ut[_0x81b6('0xec')](_0x3f8a8a,0x8,_0x81b6('0xcf'));rpcDb['createAgentHistory'](_0x3f8a8a,_0x81b6('0xf1'));break;case'22':ut[_0x81b6('0xec')](_0x3f8a8a,0x16,'AnswerAGI');rpcDb[_0x81b6('0xed')](_0x3f8a8a,_0x81b6('0xf2'));break;default:ut['logAgent'](_0x3f8a8a,0xc,_0x58696d[_0x81b6('0xeb')]);rpcDb[_0x81b6('0xed')](_0x3f8a8a,_0x81b6('0xf1'));}ut[_0x81b6('0xe5')](_0x1b369d,_0x81b6('0xf3'));logger[_0x81b6('0x54')]('[originated][decrement][callProgressDetectingAgent]',_0x3f8a8a['uniqueid'],'\x20Queue',_0x1b369d[_0x81b6('0x23')],_0x81b6('0x6a'),_0x1b369d['originated']);delete this[_0x81b6('0x13')][_0x3f8a8a[_0x81b6('0xaf')]];};Preview['prototype'][_0x81b6('0xf4')]=function(_0x272b8c,_0x5a2196,_0x58bbc0,_0x50ba8e,_0x28bf5e){var _0x5f2862=this;return new BPromise(function(_0x161b55,_0x588a20){if(_[_0x81b6('0x68')](_0x5a2196)||_[_0x81b6('0x68')](_0x5a2196[_0x81b6('0xf5')])||_[_0x81b6('0x68')](_0x5a2196[_0x81b6('0xf5')][_0x81b6('0xf6')])||_['isNil'](_0x5a2196['VoiceQueueId'])){_0x588a20(ut[_0x81b6('0x48')](_0x81b6('0xf7'),_0x50ba8e,_0x28bf5e));return;}var _0x4944b2=uuid['v4']();var _0x197b2c=_0x5f2862[_0x81b6('0x11')][_0x5a2196[_0x81b6('0x69')][_0x81b6('0x23')]];var _0xe71843=_0x58bbc0?_0x5f2862[_0x81b6('0x14')][_0x58bbc0]['id']:undefined;_0x5f2862['actions'][_0x4944b2]=new Action(_0x5a2196,_0x197b2c,_0x4944b2,_0x58bbc0,_0xe71843);var _0x5d50dd=_0x5f2862['actions'][_0x4944b2];_0x5d50dd['unlockAgent']=_0x50ba8e;_0x5d50dd[_0x81b6('0xab')]=_0x28bf5e;_0x5d50dd[_0x81b6('0xf8')]=_0x58bbc0;if(_[_0x81b6('0xf9')](_0x272b8c)){_0x5f2862[_0x81b6('0xfa')](_0x5d50dd,_0x197b2c,_0x5a2196,_0x58bbc0)[_0x81b6('0x80')](function(_0x3ecc6d){logger[_0x81b6('0x54')](_0x81b6('0xfb'),_0x81b6('0xfc')+_0x5d50dd['queue']+_0x81b6('0xfd')+_0x5d50dd['idContact'],JSON['stringify'](_0x3ecc6d));ami[_0x81b6('0xb3')](_0x81b6('0xfe'),ut[_0x81b6('0xb0')](_0x5d50dd,_0x81b6('0xff')));_0x161b55(ut[_0x81b6('0x48')](_0x81b6('0x100')));})['catch'](function(_0x5190be){ut[_0x81b6('0x5c')](_0x81b6('0x101'),_0x5190be);_0x588a20(ut[_0x81b6('0x48')]('Call\x20failed',_0x50ba8e,_0x28bf5e));});}else{_0x197b2c[_0x81b6('0x35')]+=0x1;ut[_0x81b6('0x102')](_0x5d50dd);rpcDb[_0x81b6('0x103')](_0x5d50dd,_0x81b6('0x104'));delete _0x5f2862[_0x81b6('0x13')][_0x4944b2];_0x588a20(ut[_0x81b6('0x48')](_0x81b6('0x105'),_0x50ba8e,_0x28bf5e));}});};Preview[_0x81b6('0xe')][_0x81b6('0x98')]=function(_0x4665a4){return!_[_0x81b6('0x68')](_0x4665a4)&&!_['isNil'](_0x4665a4[_0x81b6('0x23')])&&!_[_0x81b6('0x68')](_0x4665a4[_0x81b6('0x106')])&&_0x4665a4[_0x81b6('0x106')]&&!_[_0x81b6('0x68')](this[_0x81b6('0x12')][util[_0x81b6('0x51')](_0x81b6('0x107'),_0x4665a4[_0x81b6('0x23')])])&&!_[_0x81b6('0x68')](this[_0x81b6('0x12')][util[_0x81b6('0x51')]('SIP/%s',_0x4665a4[_0x81b6('0x23')])][_0x81b6('0x74')])&&(this[_0x81b6('0x12')][util[_0x81b6('0x51')](_0x81b6('0x107'),_0x4665a4[_0x81b6('0x23')])][_0x81b6('0x74')]==='reachable'||this[_0x81b6('0x12')][util[_0x81b6('0x51')]('SIP/%s',_0x4665a4[_0x81b6('0x23')])]['status']==='unmonitored');};Preview[_0x81b6('0xe')][_0x81b6('0x86')]=function(_0x3471c2,_0x28c948){var _0x63fcf7=this;return new BPromise(function(_0x142fcf,_0x4de916){_0x63fcf7[_0x81b6('0x108')](_0x3471c2,_0x28c948)['then'](function(_0x2fc02a){_0x142fcf(_['pick'](_0x2fc02a,[_0x81b6('0x48')]));})[_0x81b6('0x76')](function(_0x44a4f3){if(_0x44a4f3[_0x81b6('0x109')]){rpcDb['unlockContact'](_0x3471c2);}if(_0x44a4f3[_0x81b6('0x106')]){rpcDb[_0x81b6('0x10a')](_0x3471c2);}_0x4de916(_[_0x81b6('0x6e')](_0x44a4f3,['message']));});});};Preview[_0x81b6('0xe')][_0x81b6('0x108')]=function(_0x4e1fd1,_0x473c99){var _0x48e4f3=this;return new BPromise(function(_0x29c311,_0x4a71ff){var _0x299473,_0x2e09ca;rpcDb[_0x81b6('0x10b')](_0x4e1fd1)[_0x81b6('0x80')](function(_0x31602d){if(!_[_0x81b6('0x68')](_0x31602d[0x0])){_0x2e09ca=_0x31602d[0x0]['recallme']?![]:!![];_0x299473=_0x31602d[0x0][_0x81b6('0x10c')]?!![]:![];_0x299473=_0x473c99?!![]:_0x299473;}var _0x18fee6=_0x48e4f3[_0x81b6('0x10d')](_0x31602d);if(_0x18fee6['isValid']){rpcDb[_0x81b6('0x10e')](_[_0x81b6('0x6e')](_0x31602d[0x0],[_0x81b6('0x71'),_0x81b6('0x10f')]))[_0x81b6('0x80')](function(_0x5c2012){_0x48e4f3[_0x81b6('0xf4')](_0x5c2012,_0x31602d[0x0],_0x473c99,_0x2e09ca,_0x299473)[_0x81b6('0x80')](function(_0x472b4b){_0x29c311(_0x472b4b);})[_0x81b6('0x76')](function(_0x338ae8){_0x4a71ff(_0x338ae8);});})['catch'](function(_0x41b854){ut['logger']('[Preview][checkIsBlackList]',_0x41b854);_0x4a71ff(ut['message'](_0x81b6('0x110'),_0x2e09ca,_0x299473));});}else{_0x4a71ff(ut[_0x81b6('0x48')](_0x18fee6['message'],_0x2e09ca,_0x299473));}})[_0x81b6('0x76')](function(_0x2b42f0){ut[_0x81b6('0x5c')]('[Preview][getContactPreview]',_0x2b42f0);_0x4a71ff(ut[_0x81b6('0x48')](_0x81b6('0x110'),![],!![]));});});};Preview[_0x81b6('0xe')][_0x81b6('0x10d')]=function(_0x367ab9){if(_['isNil'](_0x367ab9)||_[_0x81b6('0xf9')](_0x367ab9)||!_[_0x81b6('0x68')](_0x367ab9[0x0][_0x81b6('0x85')])&&_[_0x81b6('0x68')](_0x367ab9[0x0][_0x81b6('0x85')][_0x81b6('0x23')])){ut[_0x81b6('0x5c')](_0x81b6('0x111'),_0x367ab9);return{'isValid':![],'message':_0x81b6('0x112')};}var _0x4c4f67=this['campaignsPreview'][_0x367ab9[0x0][_0x81b6('0x69')][_0x81b6('0x23')]];_0x4c4f67[_0x81b6('0x48')]=_0x81b6('0x9a');if(_[_0x81b6('0x68')](_0x4c4f67)){ut['logger'](_0x81b6('0x113'),_0x4c4f67);return{'isValid':![],'message':_0x81b6('0x114')};}if(!this[_0x81b6('0x98')](_0x4c4f67[_0x81b6('0x4d')])){ut[_0x81b6('0x5c')]('[Preview][validateContact][Trunk\x20not\x20work]',_0x81b6('0x115')+_0x4c4f67[_0x81b6('0x23')]+_0x81b6('0x116'));if(!this[_0x81b6('0x98')](_0x4c4f67['TrunkBackup'])){ut[_0x81b6('0x5c')](_0x81b6('0x117'),_0x4c4f67['name']+'\x20Trunk\x20Backup\x20is\x20not\x20active');return{'isValid':![],'message':_0x81b6('0x118')};}}if(!ut[_0x81b6('0x97')](_0x4c4f67[_0x81b6('0x2d')])){ut[_0x81b6('0x5c')]('[Preview][validateContact][Campaign\x20Active]',_0x4c4f67['name']+_0x81b6('0x119'));return{'isValid':![],'message':_0x81b6('0x115')+_0x4c4f67['name']+_0x81b6('0x119')};}return{'isValid':!![],'message':_0x81b6('0x11a')};};Preview[_0x81b6('0xe')][_0x81b6('0xfa')]=function(_0x2686dc,_0x3a7b69,_0x45c4c0,_0x2aead2){var _0x540e7b=this;return new BPromise(function(_0xfec7a5,_0x574556){var _0x3a86d3=_0x2686dc[_0x81b6('0xaf')];var _0x35a705=_0x540e7b[_0x81b6('0x98')](_0x3a7b69[_0x81b6('0x4d')])?util[_0x81b6('0x51')]('SIP/%s/%s%s',_0x3a7b69[_0x81b6('0x4d')][_0x81b6('0x23')],_[_0x81b6('0x68')](_0x3a7b69[_0x81b6('0x32')])?'':_0x3a7b69[_0x81b6('0x32')][_0x81b6('0x11b')]()||'',_0x3a7b69['dialCutDigit']>0x0?_0x45c4c0[_0x81b6('0xf5')][_0x81b6('0xf6')]['substring'](_0x3a7b69[_0x81b6('0x11c')]):_0x45c4c0['Contact'][_0x81b6('0xf6')]):util[_0x81b6('0x51')](_0x81b6('0x11d'),_[_0x81b6('0x68')](_0x3a7b69[_0x81b6('0x99')])?_0x3a7b69[_0x81b6('0x4d')][_0x81b6('0x23')]:_0x3a7b69[_0x81b6('0x99')][_0x81b6('0x23')],_['isNil'](_0x3a7b69[_0x81b6('0x32')])?'':_0x3a7b69[_0x81b6('0x32')][_0x81b6('0x11b')]()||'',_0x3a7b69[_0x81b6('0x11c')]>0x0?_0x45c4c0[_0x81b6('0xf5')]['phone'][_0x81b6('0x11e')](_0x3a7b69[_0x81b6('0x11c')]):_0x45c4c0[_0x81b6('0xf5')][_0x81b6('0xf6')]);var _0x2f61ca=_0x540e7b[_0x81b6('0x98')](_0x3a7b69[_0x81b6('0x4d')])?ut[_0x81b6('0x11f')](_0x3a7b69[_0x81b6('0x4d')][_0x81b6('0x4e')],_0x3a7b69['dialOriginateCallerIdName'],_0x3a7b69[_0x81b6('0x120')]>0x0?ut[_0x81b6('0x121')](_0x3a7b69[_0x81b6('0x30')],_0x3a7b69[_0x81b6('0x120')]):_0x3a7b69[_0x81b6('0x30')]):ut['getCallerId'](_[_0x81b6('0x68')](_0x3a7b69['TrunkBackup'])?_0x3a7b69[_0x81b6('0x4d')][_0x81b6('0x4e')]:_0x3a7b69[_0x81b6('0x99')][_0x81b6('0x4e')],_0x3a7b69[_0x81b6('0x2f')],_0x3a7b69[_0x81b6('0x120')]>0x0?ut[_0x81b6('0x121')](_0x3a7b69['dialOriginateCallerIdNumber'],_0x3a7b69['dialRandomLastDigitCallerIdNumber']):_0x3a7b69[_0x81b6('0x30')]);if(_0x2f61ca){_0x2686dc[_0x81b6('0x122')]=ut[_0x81b6('0x123')](_0x2f61ca);_0x2686dc[_0x81b6('0x124')]=ut[_0x81b6('0x125')](_0x2f61ca);}var _0x5b3cd7=ut['addVariables'](_0x3a7b69,_0x45c4c0,_0x35a705,_0x2f61ca,_0x3a86d3,_0x2686dc);_[_0x81b6('0x126')](_0x2686dc,ut[_0x81b6('0x127')](_0x5b3cd7));_0x2686dc[_0x81b6('0x89')]=moment()[_0x81b6('0x51')](_0x81b6('0x8a'));ami[_0x81b6('0x73')](ut[_0x81b6('0x128')](_0x2686dc,_0x3a7b69,_0x5b3cd7,_0x2686dc['activeContact'],_0x2aead2))[_0x81b6('0x80')](function(_0x29b49f){_0x3a7b69['originated']+=0x1;logger[_0x81b6('0x54')]('[originated][increment]',_0x3a86d3,_0x81b6('0xe8'),_0x3a7b69[_0x81b6('0x23')],'originated:\x20',_0x3a7b69['originated']);_0xfec7a5(_0x29b49f);})[_0x81b6('0x76')](function(_0x2f0613){ut[_0x81b6('0xec')](_0x2686dc,0xe,_0x81b6('0x129'));rpcDb[_0x81b6('0xed')](_0x2686dc,'[originateFailure][logOriginateFailure]');_0x574556(_0x2f0613);});});};Preview['prototype']['syncNewExten']=function(_0x19bab2){if(this[_0x81b6('0x13')][_0x19bab2[_0x81b6('0xac')]]){this[_0x81b6('0x13')][_0x19bab2[_0x81b6('0xac')]][_0x81b6('0x75')]=_0x19bab2[_0x81b6('0x75')];}};Preview[_0x81b6('0xe')][_0x81b6('0x17')]=function(_0x5193e3){var _0x58c48d=this;var _0x1570e2=this[_0x81b6('0x13')][_0x5193e3['actionid']];if(_0x1570e2){if(_0x1570e2['lookAgent']&&this[_0x81b6('0x14')][_0x1570e2['lookAgent']]){ut[_0x81b6('0x12a')](_0x1570e2,this[_0x81b6('0x14')][_0x1570e2[_0x81b6('0xf8')]][_0x81b6('0x23')],this['agents'][_0x1570e2['lookAgent']]['id']);}var _0xd395d2=_[_0x81b6('0x12b')](_0x1570e2);_0xd395d2[_0x81b6('0xae')]=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');var _0x4d673b=_0x58c48d[_0x81b6('0x11')][_0x1570e2['queue']];if(ut['isFailure'](_0x5193e3[_0x81b6('0x12c')])){if(_0x1570e2[_0x81b6('0xaa')]){rpcDb[_0x81b6('0x12d')](_0x1570e2['idContact']);}if(_0x1570e2[_0x81b6('0xab')]){rpcDb[_0x81b6('0x10a')](_0x1570e2[_0x81b6('0x12e')]);}ami[_0x81b6('0xb3')](_0x81b6('0x12f'),ut[_0x81b6('0xb0')](_0x1570e2,_0x81b6('0x130')));this[_0x81b6('0x131')](_0xd395d2,_0x4d673b,_0x5193e3);}else{_0x1570e2['starttime']=moment()[_0x81b6('0x51')]('YYYY-MM-DD\x20HH:mm:ss');ut[_0x81b6('0xec')](_0xd395d2,0x4,'Answer');rpcDb[_0x81b6('0xed')](_0xd395d2,_0x81b6('0x132'));}}};Preview[_0x81b6('0xe')][_0x81b6('0x18')]=function(_0x4f2fdd){var _0x3ccb10=this;var _0xf09ed2=this['actions'][_0x4f2fdd[_0x81b6('0xac')]];var _0x1aeaca;if(_0xf09ed2){_0x1aeaca=this[_0x81b6('0x11')][_0xf09ed2['queue']];logger['info'](_0x81b6('0x133'),_0x4f2fdd[_0x81b6('0xac')],_0x81b6('0xe8'),_0x1aeaca[_0x81b6('0x23')],_0x81b6('0x6c'),_0x1aeaca[_0x81b6('0x25')]);}if(this[_0x81b6('0x13')][_0x4f2fdd[_0x81b6('0xac')]]&&_0x4f2fdd['linkedid']!==_0x4f2fdd[_0x81b6('0xaf')]){if(_0x4f2fdd[_0x81b6('0x134')]==='16'&&this['actions'][_0x4f2fdd[_0x81b6('0xac')]][_0x81b6('0x6d')]){this[_0x81b6('0x9b')](_0x4f2fdd,_0x4f2fdd[_0x81b6('0xac')],_0x4f2fdd[_0x81b6('0x134')]);}else if(this[_0x81b6('0x13')][_0x4f2fdd[_0x81b6('0xac')]][_0x81b6('0x6d')]){logger[_0x81b6('0x54')](_0x81b6('0x135'),_0x4f2fdd[_0x81b6('0xac')],_0x4f2fdd[_0x81b6('0x134')],_0x81b6('0xe8'),_0x1aeaca[_0x81b6('0x23')],_0x81b6('0x6c'),_0x1aeaca[_0x81b6('0x25')]);this[_0x81b6('0x9b')](_0x4f2fdd,_0x4f2fdd[_0x81b6('0xac')],_0x4f2fdd[_0x81b6('0x134')]);}}else if(_0xf09ed2&&_[_0x81b6('0x68')](_0xf09ed2[_0x81b6('0x136')])&&_0x1aeaca[_0x81b6('0x137')]&&_0x4f2fdd[_0x81b6('0xac')]===_0x4f2fdd[_0x81b6('0xaf')]&&_[_0x81b6('0x68')](_0x4f2fdd[_0x81b6('0xeb')])&&_0x4f2fdd[_0x81b6('0x134')]==='16'&&_0x4f2fdd[_0x81b6('0x138')]==='6'&&_['isUndefined'](_0xf09ed2[_0x81b6('0x139')])){if(_0xf09ed2[_0x81b6('0xaa')]){rpcDb[_0x81b6('0x12d')](_0xf09ed2[_0x81b6('0x12e')]);}if(_0xf09ed2[_0x81b6('0xab')]){rpcDb['disableContact'](_0xf09ed2[_0x81b6('0x12e')]);}_0x4f2fdd[_0x81b6('0xeb')]='22';this['callProgressDetectingAgent'](_0xf09ed2,_0x1aeaca,_0x4f2fdd);}else if(_0xf09ed2&&_0xf09ed2[_0x81b6('0x139')]){if(_0x4f2fdd[_0x81b6('0x134')]==='16'&&this[_0x81b6('0x13')][_0x4f2fdd[_0x81b6('0xac')]][_0x81b6('0x6d')]){logger[_0x81b6('0x54')](_0x81b6('0x13a'),_0x4f2fdd[_0x81b6('0xac')],_0x4f2fdd[_0x81b6('0x134')],_0x81b6('0xe8'),_0x1aeaca[_0x81b6('0x23')],_0x81b6('0x6c'),_0x1aeaca[_0x81b6('0x25')]);this['callProgressDetectingCustomer'](_0x4f2fdd,_0x4f2fdd[_0x81b6('0xac')],_0x4f2fdd['cause']);}else if(this[_0x81b6('0x13')][_0x4f2fdd[_0x81b6('0xac')]][_0x81b6('0x6d')]){logger[_0x81b6('0x54')](_0x81b6('0x135'),_0x4f2fdd[_0x81b6('0xac')],_0x4f2fdd['cause'],_0x81b6('0xe8'),_0x1aeaca['name'],'pTalking:\x20',_0x1aeaca[_0x81b6('0x25')]);this[_0x81b6('0x9b')](_0x4f2fdd,_0x4f2fdd[_0x81b6('0xac')],_0x4f2fdd[_0x81b6('0x134')]);}}};Preview['prototype'][_0x81b6('0x13b')]=function(_0xdf0173){if(this[_0x81b6('0x13')][_0xdf0173[_0x81b6('0x13c')]]&&_0xdf0173['destlinkedid']!==_0xdf0173[_0x81b6('0x13d')]){this[_0x81b6('0x9b')](_0xdf0173,_0xdf0173[_0x81b6('0x13c')],_0xdf0173['dialstatus']);}};Preview[_0x81b6('0xe')][_0x81b6('0x1b')]=function(_0x3413a9){if(this['actions'][_0x3413a9['linkedid']]&&_0x3413a9['linkedid']!==_0x3413a9['uniqueid']&&!this[_0x81b6('0x13')][_0x3413a9[_0x81b6('0xac')]][_0x81b6('0x6d')]){if(_0x3413a9[_0x81b6('0x134')]==='1'){this[_0x81b6('0x9b')](_0x3413a9,_0x3413a9[_0x81b6('0xac')],_0x3413a9['cause']);}}};Preview['prototype'][_0x81b6('0x13e')]=function(_0xf8823c,_0x1b216d,_0x497af2){if(this[_0x81b6('0x13')][_0xf8823c]){if(_[_0x81b6('0x68')](this[_0x81b6('0x13')][_0xf8823c][_0x81b6('0x13f')])){this[_0x81b6('0x13')][_0xf8823c][_0x81b6('0x13f')]={};}this[_0x81b6('0x13')][_0xf8823c]['variables'][_0x1b216d]=_0x497af2;}};Preview[_0x81b6('0xe')][_0x81b6('0x1f')]=function(_0x6aa754){try{if(!_[_0x81b6('0x68')](_0x6aa754)){if(ut['filterKey'](_[_0x81b6('0x140')](_0x6aa754[_0x81b6('0x141')])[0x0])){this[_0x81b6('0x13e')](_0x6aa754['uniqueid'],_[_0x81b6('0x140')](_0x6aa754[_0x81b6('0x141')])[0x0],_0x6aa754['value']);}}}catch(_0x38634b){logger[_0x81b6('0x142')](_0x81b6('0x143'),util['inspect'](_0x38634b,{'showHidden':![],'depth':null}));}};Preview[_0x81b6('0xe')][_0x81b6('0x20')]=function(_0x18dc5c){if(_0x18dc5c){if(this[_0x81b6('0x13')][_0x18dc5c[_0x81b6('0x144')]]){this[_0x81b6('0x13')][_0x18dc5c[_0x81b6('0x144')]][_0x81b6('0x139')]=!![];}}};Preview[_0x81b6('0xe')]['syncBlindTransfer']=function(_0x26501d){if(_0x26501d){if(this['actions'][_0x26501d[_0x81b6('0x145')]]){this['actions'][_0x26501d[_0x81b6('0x145')]][_0x81b6('0x139')]=!![];}}};module[_0x81b6('0x146')]=Preview; \ No newline at end of file +var _0xe8d2=['dialAgentRejectMaxRetry','[callProgressDetectingCustomer][logAgentReject]','dialAgentRejectRetryFrequency','ABANDONED','outboundAbandonedCallsDay','countabandonedretry','Abandoned','[callProgressDetectingCustomer][logAbandoned]','countabandonedetry','dialAbandonedMaxRety','dialAbandonedRetryFrequency','[default]','[Dialer][decrementTalkink][no\x20Hangup][Preview]','cause-txt','dialstatus','[callProgressDetectingCustomer][logUnknown]','[callProgressDetectingCustomer][logUnknownGlobal]','[callProgressDetectingCustomer]','isUndefined','object','logAgent','createAgentHistory','[callProgressDetectingAgent][logNoSuch]','[callProgressDetectingAgent][logNoAnswer]','AnswerAGI','[callProgressDetectingAgent][logCongestion]','[callProgressDetectingAgent]','[originated][decrement][callProgressDetectingAgent]','Contact','phone','Contact\x20is\x20undefined','isEmpty','execCall','[Preview][execCall][success]','Queue:\x20','\x20IdHopper:\x20','idContact','custom:agentcalled','Calling','Call\x20failed','outboundBlacklistCallsDay','logBlacklist','createHistory','[Blacklist][error]','SIP/%s','reachable','unmonitored','execRun','unlock','getContactPreview','recallme','isValid','checkIsBlackList','Contact.phone','[Preview][checkIsBlackList]','Call\x20unsuccessful','[Preview][getContactPreview]','validateContact','[Preview][validateContact][Empty\x20Contact]','[Preview][validateContact][Empty\x20Campaign]','Empty\x20Campaign','[Preview][validateContact][Trunk\x20not\x20work]','campaign\x20Name:\x20','\x20Trunk\x20Backup\x20is\x20not\x20active','Trunk\x20not\x20work','\x20Not\x20Active','Is\x20Valid','SIP/%s/%s%s','trim','dialCutDigit','substring','getCallerId','callerid','dialRandomLastDigitCallerIdNumber','getCallerIdRandom','dialOriginateCallerIdName','originatecalleridnum','extractCalleridNumber','addVariables','merge','toLowerVariables','variablesAction','OriginateError','[originateFailure][logOriginateFailure]','actionid','lookAgent','logLookAgent','clone','isFailure','response','unlockContact','disableContact','custom:agentringnoanswer','callProgressDetectingAgent','[callProgressDetectingAgent][logAnswer]','[syncHangup][talking]','cause','[syncHangup][talking][cause]','statedesc','dialQueueProject','channelstate','transfer','[syncHangup][talking][transfer]','destlinkedid','destuniqueid','syncHangupRequest','addVariable','variables','syncVarSet','filterKey','keys','variable','value','error','[syncVarSet][Preview]','inspect','transfertargetlinkedid','transfererlinkedid','lodash','bluebird','uuid','moment','md5','ioredis','../../../config/logger','../ami','./rpcDb','./action','./util/util','redis','localhost','socket.io-emitter','enqueue','tail','finally','sequence','voiceQueues','trunks','actions','agents','clockClearZombieChannels','syncOriginateResponse','hangup','syncHangup','bind','hanguprequest','dialend','newexten','syncNewExten','attendedtransfer','syncAttendedTransfer','syncBlindTransfer','loopCampaigns','campaignsPreview','emit','type','outbound','strategy','answered','loggedIn','pTalking','sumBillable','sumDuration','sumHoldTime','talking','unmanaged','abandoned','loggedInDb','dialActive','dialMethod','dialOriginateCallerIdNumber','dialOriginateTimeout','dialPrefix','outboundAnswerCallsDay','outboundBusyCallsDay','outboundCongestionCallsDay','outboundDropCallsDayACS','outboundDropCallsDayTimeout','outboundNoAnswerCallsDay','outboundNoSuchCallsDay','outboundOriginateFailureCallsDay','outboundReCallsDay','outboundRejectCallsDay','outboundUnknownCallsDay','predictiveIntervalAnsweredCalls','predictiveIntervalAvgTalktime','predictiveIntervalDroppedCallsCallersExit','predictiveIntervalDroppedCallsTimeout','predictiveIntervalErlangCalls','predictiveIntervalErlangCallsDroppedCalls','predictiveIntervalHitRate','predictiveIntervalMultiplicativeFactor','predictiveIntervalPauses','predictiveIntervalAvailable','predictiveIntervalTotalCalls','message','originated','erlangCalls','erlangCallToSecond','erlangAbandonmentRate','startPredictive','startProgressive','Trunk','name','active','Interval','stringify','format','voice:queue:%s','voice_queue:save','info','[DEBUG]\x20Emit\x20voice_queue_channel:remove\x20event','voice_queue_channel:remove','sendMessageOneNotActive','logger','[CampaignPreview]\x20Campaign\x20Queue:\x20','IS_DISACTIVED','\x20is\x20disactive','prototype','syncCampaigns','hasOwnProperty','preview','booked','clearZombieChannels','setMessage','recallMe','clearZombieChannel','isNil','[clearZombieChannels][talking]','Queue','queue','originated:\x20','pTalking:\x20','dialAnswer','pick','contactId','UserId','VoiceQueueId','Action','status','channel','No\x20such\x20channel','updateOriginated','decrementTalkink','[clearZombieChannel]','[Dialer][checkChannel][pTalking][Preview]','loggerError','[Dialer][checkChannel][Preview]','[action]','getContactRecallMe','agentReadyId','then','scheduledat','dialRecallMeTimeout','Agent','voicePause','run','[RecallMe]','catch','logger2','starttime','YYYY-MM-DD\x20HH:mm:ss','logCustomer','dialRecallInQueue','rescheduleContactInQueue','createBody','[HistoryDialRecallInQueue][historyCatch]','RecallFailedTimeout','createCustomerHistory','[HistoryRecallClose]','[getContactRecallMe]','IsNotLoggedIn','AGENTS_NOT_LOGGED','isActive','NOT_ACTIVE','isTrunkReachable','TrunkBackup','TRUNK_IS_NOT_REACHABLE','ACTIVE','callProgressDetectingCustomer','totalGlobal','[callProgressDetectingCustomer][logNoSuch]','dialGlobalMaxRetry','cloneAction','Global','createCustomerFinal','[callProgressDetectingCustomer][logNoSuchGlobal]','countnosuchnumberretry','dialNoSuchNumberMaxRetry','scheduledAt','dialNoSuchNumberRetryFrequency','activeContact','linkedid','ANSWER','uniqueid','\x20Queue','custom:agentconnect','connect','acw','custom:agentConnectPreview','custom:agentcomplete','buildObj','complete','[16]','countglobal','Answer','talktime','[syncHangup][talking][decrement]','countbusyretry','Busy','[callProgressDetectingCustomer][logBusyGlobal]','dialBusyMaxRetry','[callProgressDetectingCustomer][logBusy]','dialBusyRetryFrequency','unlockAgent','NOANSWER','countnoanswerretry','NoAnswer','[callProgressDetectingCustomer][logNoAnswer]','[callProgressDetectingCustomer][logNoAnswerGlobal]','rescheduleContact','dialNoAnswerRetryFrequency','CONGESTION','countcongestionretry','Congestion','dialCongestionMaxRetry','[callProgressDetectingCustomer][logCongestion]','CANCEL','countagentrejectretry','AgentReject','[syncHangupRequest][logAgentReject]'];(function(_0x517323,_0xf819cc){var _0x35708c=function(_0x4cee67){while(--_0x4cee67){_0x517323['push'](_0x517323['shift']());}};_0x35708c(++_0xf819cc);}(_0xe8d2,0x1c1));var _0x2e8d=function(_0x111ec5,_0x1e0303){_0x111ec5=_0x111ec5-0x0;var _0x218e76=_0xe8d2[_0x111ec5];return _0x218e76;};'use strict';var util=require('util');var _=require(_0x2e8d('0x0'));var BPromise=require(_0x2e8d('0x1'));var uuid=require(_0x2e8d('0x2'));var moment=require(_0x2e8d('0x3'));var md5=require(_0x2e8d('0x4'));var Redis=require(_0x2e8d('0x5'));var config=require('../../../config/environment');var logger=require('../../../config/logger')('preview');var loggerAction=require(_0x2e8d('0x6'))('actionPreview');var ami=require(_0x2e8d('0x7'));var rpcDb=require(_0x2e8d('0x8'));var Action=require(_0x2e8d('0x9'));var ut=require(_0x2e8d('0xa'));config[_0x2e8d('0xb')]=_['defaults'](config['redis'],{'host':_0x2e8d('0xc'),'port':0x18eb});var io=require(_0x2e8d('0xd'))(new Redis(config[_0x2e8d('0xb')]));var Sequence=function(){};Sequence['prototype'][_0x2e8d('0xe')]=function(_0x380971){this['tail']=this[_0x2e8d('0xf')]?this['tail'][_0x2e8d('0x10')](_0x380971):_0x380971();};function Preview(_0x1760a7){this[_0x2e8d('0x11')]=new Sequence();this['campaignsPreview']=_0x1760a7[_0x2e8d('0x12')];this['trunks']=_0x1760a7[_0x2e8d('0x13')];this[_0x2e8d('0x14')]={};this[_0x2e8d('0x15')]=_0x1760a7[_0x2e8d('0x15')];this[_0x2e8d('0x16')]=0x0;ami['on']('originateresponse',this[_0x2e8d('0x17')]['bind'](this));ami['on'](_0x2e8d('0x18'),this[_0x2e8d('0x19')][_0x2e8d('0x1a')](this));ami['on'](_0x2e8d('0x1b'),this['syncHangupRequest']['bind'](this));ami['on'](_0x2e8d('0x1c'),this['syncDialEnd']['bind'](this));ami['on'](_0x2e8d('0x1d'),this[_0x2e8d('0x1e')][_0x2e8d('0x1a')](this));ami['on']('varset',this['syncVarSet'][_0x2e8d('0x1a')](this));ami['on'](_0x2e8d('0x1f'),this[_0x2e8d('0x20')]['bind'](this));ami['on']('blindtransfer',this[_0x2e8d('0x21')]['bind'](this));this[_0x2e8d('0x22')](this[_0x2e8d('0x23')]);}function emit(_0x38d260,_0x21b962,_0x588c9f){io['to'](_0x38d260)[_0x2e8d('0x24')](_0x21b962,_0x588c9f);}function emitCampaignPreview(_0x376fb8){if(_0x376fb8[_0x2e8d('0x25')]===_0x2e8d('0x26')){var _0x2ce303={'id':_0x376fb8['id'],'name':_0x376fb8['name'],'strategy':_0x376fb8[_0x2e8d('0x27')],'answered':_0x376fb8[_0x2e8d('0x28')],'available':_0x376fb8['available'],'loggedIn':_0x376fb8[_0x2e8d('0x29')],'pTalking':_0x376fb8[_0x2e8d('0x2a')],'sumBillable':_0x376fb8[_0x2e8d('0x2b')],'sumDuration':_0x376fb8[_0x2e8d('0x2c')],'sumHoldTime':_0x376fb8[_0x2e8d('0x2d')]||0x0,'talking':_0x376fb8[_0x2e8d('0x2e')],'total':_0x376fb8['total'],'type':_0x376fb8['type'],'unmanaged':_0x376fb8[_0x2e8d('0x2f')],'abandoned':_0x376fb8[_0x2e8d('0x30')],'waiting':_0x376fb8['waiting'],'loggedInDb':_0x376fb8[_0x2e8d('0x31')],'dialActive':_0x376fb8[_0x2e8d('0x32')],'dialMethod':_0x376fb8[_0x2e8d('0x33')],'dialOriginateCallerIdName':_0x376fb8['dialOriginateCallerIdName'],'dialOriginateCallerIdNumber':_0x376fb8[_0x2e8d('0x34')],'dialOriginateTimeout':_0x376fb8[_0x2e8d('0x35')],'dialPrefix':_0x376fb8[_0x2e8d('0x36')],'outboundAnswerAgiCallsDay':_0x376fb8['outboundAnswerAgiCallsDay'],'outboundAnswerCallsDay':_0x376fb8[_0x2e8d('0x37')],'outboundBlacklistCallsDay':_0x376fb8['outboundBlacklistCallsDay'],'outboundBusyCallsDay':_0x376fb8[_0x2e8d('0x38')],'outboundCongestionCallsDay':_0x376fb8[_0x2e8d('0x39')],'outboundDropCallsDayACS':_0x376fb8[_0x2e8d('0x3a')],'outboundDropCallsDayCallersExit':_0x376fb8['outboundDropCallsDayCallersExit'],'outboundDropCallsDayTimeout':_0x376fb8[_0x2e8d('0x3b')],'outboundNoAnswerCallsDay':_0x376fb8[_0x2e8d('0x3c')],'outboundNoSuchCallsDay':_0x376fb8[_0x2e8d('0x3d')],'outboundOriginateFailureCallsDay':_0x376fb8[_0x2e8d('0x3e')],'outboundReCallsDay':_0x376fb8[_0x2e8d('0x3f')],'outboundRejectCallsDay':_0x376fb8[_0x2e8d('0x40')],'outboundUnknownCallsDay':_0x376fb8[_0x2e8d('0x41')],'outboundAbandonedCallsDay':_0x376fb8['outboundAbandonedCallsDay'],'predictiveIntervalAnsweredCalls':_0x376fb8[_0x2e8d('0x42')],'predictiveIntervalAvgHoldtime':_0x376fb8['predictiveIntervalAvgHoldtime'],'predictiveIntervalAvgTalktime':_0x376fb8[_0x2e8d('0x43')],'predictiveIntervalDroppedCallsCallersExit':_0x376fb8[_0x2e8d('0x44')],'predictiveIntervalDroppedCallsTimeout':_0x376fb8[_0x2e8d('0x45')],'predictiveIntervalErlangCalls':_0x376fb8[_0x2e8d('0x46')],'predictiveIntervalErlangCallsDroppedCalls':_0x376fb8[_0x2e8d('0x47')],'predictiveIntervalHitRate':_0x376fb8[_0x2e8d('0x48')],'predictiveIntervalMultiplicativeFactor':_0x376fb8[_0x2e8d('0x49')],'predictiveIntervalPauses':_0x376fb8[_0x2e8d('0x4a')],'predictiveIntervalAvailable':_0x376fb8[_0x2e8d('0x4b')],'predictiveIntervalTotalCalls':_0x376fb8[_0x2e8d('0x4c')],'message':_0x376fb8[_0x2e8d('0x4d')],'originated':_0x376fb8[_0x2e8d('0x4e')],'erlangCalls':_0x376fb8[_0x2e8d('0x4f')],'erlangCallToSecond':_0x376fb8[_0x2e8d('0x50')],'erlangAbandonmentRate':_0x376fb8[_0x2e8d('0x51')],'erlangBusyFactor':_0x376fb8['erlangBusyFactor'],'startPredictive':_0x376fb8[_0x2e8d('0x52')],'startProgressive':_0x376fb8[_0x2e8d('0x53')]};if(_0x376fb8[_0x2e8d('0x54')]){_0x2ce303[_0x2e8d('0x54')]={'id':_0x376fb8[_0x2e8d('0x54')]['id'],'name':_0x376fb8[_0x2e8d('0x54')][_0x2e8d('0x55')],'active':_0x376fb8[_0x2e8d('0x54')][_0x2e8d('0x56')],'callerid':_0x376fb8[_0x2e8d('0x54')]['callerid']};}if(_0x376fb8[_0x2e8d('0x57')]){_0x2ce303[_0x2e8d('0x57')]={'id':_0x376fb8[_0x2e8d('0x57')]['id'],'name':_0x376fb8['Interval']['name']};}var _0x3e3993=md5(JSON[_0x2e8d('0x58')](_0x2ce303));if(_0x376fb8[_0x2e8d('0x4')]!==_0x3e3993){_0x376fb8[_0x2e8d('0x4')]=_0x3e3993;emit(util[_0x2e8d('0x59')](_0x2e8d('0x5a'),_0x2ce303[_0x2e8d('0x55')]),_0x2e8d('0x5b'),_0x2ce303);}}}function emitVoiceQueueChannelRemove(_0x96d985){logger[_0x2e8d('0x5c')](_0x2e8d('0x5d'),JSON[_0x2e8d('0x58')](_0x96d985));emit(util['format'](_0x2e8d('0x5a'),_0x96d985[_0x2e8d('0x55')]),_0x2e8d('0x5e'),_0x96d985);}function notSendMessagesQueue(_0x44f0ee){if(_0x44f0ee[_0x2e8d('0x5f')]){if(_0x44f0ee[_0x2e8d('0x4e')]===0x0&&_0x44f0ee[_0x2e8d('0x2a')]===0x0){_0x44f0ee['sendMessageOneNotActive']=![];_0x44f0ee['available']=0x0;_0x44f0ee['paused']=0x0;_0x44f0ee[_0x2e8d('0x4d')]='NOT_ACTIVE';ut[_0x2e8d('0x60')](_0x2e8d('0x61'),_0x44f0ee[_0x2e8d('0x55')]+'\x20is\x20not\x20active');}else{_0x44f0ee[_0x2e8d('0x4d')]=_0x2e8d('0x62');ut[_0x2e8d('0x60')](_0x2e8d('0x61'),_0x44f0ee['name']+_0x2e8d('0x63'));}emitCampaignPreview(_0x44f0ee);}}Preview[_0x2e8d('0x64')]['loopCampaigns']=function(){var _0x319498=this;setInterval(function(){_0x319498[_0x2e8d('0x65')]();},0x7cf);};Preview['prototype'][_0x2e8d('0x65')]=function(){var _0x4a5401=this[_0x2e8d('0x23')];this['clockClearZombieChannels']+=0x1;for(var _0x429719 in _0x4a5401){if(_0x4a5401[_0x2e8d('0x66')](_0x429719)&&(_0x4a5401[_0x429719][_0x2e8d('0x33')]===_0x2e8d('0x67')||_0x4a5401[_0x429719][_0x2e8d('0x33')]===_0x2e8d('0x68'))&&_0x4a5401[_0x429719][_0x2e8d('0x25')]===_0x2e8d('0x26')){if(this[_0x2e8d('0x16')]>0x7){this[_0x2e8d('0x16')]=0x0;this[_0x2e8d('0x69')]();}}if(_0x4a5401[_0x2e8d('0x66')](_0x429719)&&_0x4a5401[_0x429719][_0x2e8d('0x33')]==='preview'&&_0x4a5401[_0x429719][_0x2e8d('0x25')]==='outbound'){if(_0x4a5401[_0x429719]['dialActive']){this[_0x2e8d('0x6a')](_0x4a5401[_0x429719]);this[_0x2e8d('0x6b')](_0x4a5401[_0x429719]);}else{notSendMessagesQueue(_0x4a5401[_0x429719]);}}}};Preview[_0x2e8d('0x64')][_0x2e8d('0x6c')]=function(_0x21479c){var _0x2d59bd=this;this['sequence'][_0x2e8d('0xe')](function(){if(!_[_0x2e8d('0x6d')](_0x2d59bd['actions'][_0x21479c])){loggerAction[_0x2e8d('0x5c')](_0x2e8d('0x6e'),_0x21479c,_0x2e8d('0x6f'),_0x2d59bd[_0x2e8d('0x14')][_0x21479c][_0x2e8d('0x70')],_0x2e8d('0x71'),JSON[_0x2e8d('0x58')](_0x2d59bd['campaignsPreview'][_0x2d59bd[_0x2e8d('0x14')][_0x21479c]['queue']][_0x2e8d('0x4e')]),_0x2e8d('0x72'),JSON['stringify'](_0x2d59bd['campaignsPreview'][_0x2d59bd[_0x2e8d('0x14')][_0x21479c]['queue']][_0x2e8d('0x2a')]),JSON[_0x2e8d('0x58')](_0x2d59bd[_0x2e8d('0x14')][_0x21479c][_0x2e8d('0x73')]),JSON['stringify'](_[_0x2e8d('0x74')](_0x2d59bd[_0x2e8d('0x14')][_0x21479c],[_0x2e8d('0x75'),_0x2e8d('0x76'),_0x2e8d('0x77'),'ListId'])));return ami[_0x2e8d('0x78')]({'action':_0x2e8d('0x79'),'channel':_0x2d59bd[_0x2e8d('0x14')][_0x21479c][_0x2e8d('0x7a')]})['catch'](function(_0x596620){if(_0x596620[_0x2e8d('0x4d')]===_0x2e8d('0x7b')){setTimeout(function(){if(_0x2d59bd[_0x2e8d('0x14')][_0x21479c]){ut[_0x2e8d('0x7c')](_0x2d59bd[_0x2e8d('0x23')][_0x2d59bd[_0x2e8d('0x14')][_0x21479c][_0x2e8d('0x70')]],'[clearZombieChannel]');if(_0x2d59bd[_0x2e8d('0x14')][_0x21479c][_0x2e8d('0x73')]===!![]){ut[_0x2e8d('0x7d')](_0x2d59bd[_0x2e8d('0x23')][_0x2d59bd[_0x2e8d('0x14')][_0x21479c][_0x2e8d('0x70')]],_0x2e8d('0x7e'));ut['loggerError'](_0x2e8d('0x7f')+_0x21479c,_0x2d59bd[_0x2e8d('0x14')][_0x21479c]['queue']);}ut[_0x2e8d('0x80')](_0x2e8d('0x81')+_0x21479c,_0x2d59bd[_0x2e8d('0x14')][_0x21479c][_0x2e8d('0x70')]);delete _0x2d59bd[_0x2e8d('0x14')][_0x21479c];}},0x2328);}});}});};Preview['prototype']['clearZombieChannels']=function(){var _0x7819ef=this;loggerAction[_0x2e8d('0x5c')](_0x2e8d('0x82'),_['size'](this[_0x2e8d('0x14')]));for(var _0x37179b in this['actions']){if(_0x7819ef[_0x2e8d('0x14')]['hasOwnProperty'](_0x37179b)){_0x7819ef[_0x2e8d('0x6c')](_0x37179b);}}};Preview[_0x2e8d('0x64')]['recallMe']=function(_0x52c571){var _0x1afea0=this;rpcDb[_0x2e8d('0x83')](_0x52c571['id'],ut[_0x2e8d('0x84')](this[_0x2e8d('0x15')]))[_0x2e8d('0x85')](function(_0x35b34d){if(!_[_0x2e8d('0x6d')](_0x35b34d)){for(var _0x1cd922=0x0;_0x1cd922<_0x35b34d['length'];_0x1cd922+=0x1){if(ut['getDiff'](_0x35b34d[_0x1cd922][_0x2e8d('0x86')])<_0x52c571[_0x2e8d('0x87')]*0x3c){if(_0x35b34d[_0x1cd922]['Agent']&&!_0x35b34d[_0x1cd922][_0x2e8d('0x88')][_0x2e8d('0x89')]){_0x1afea0[_0x2e8d('0x8a')](_0x35b34d[_0x1cd922]['id'])['then'](ut['logger2'](_0x2e8d('0x8b')))[_0x2e8d('0x8c')](ut[_0x2e8d('0x8d')](_0x2e8d('0x8b')));}else{rpcDb['disableContact'](_0x35b34d[_0x1cd922]['id']);}}else{var _0x453123=new Action(_0x35b34d[_0x1cd922],_0x52c571);_0x453123[_0x2e8d('0x8e')]=moment()[_0x2e8d('0x59')](_0x2e8d('0x8f'));_0x52c571[_0x2e8d('0x3f')]+=0x1;ut[_0x2e8d('0x90')](_0x453123,0x17,'RecallInQueue');if(_0x52c571[_0x2e8d('0x91')]){rpcDb[_0x2e8d('0x92')](ut[_0x2e8d('0x93')](_0x35b34d[_0x1cd922]));rpcDb['createCustomerHistory'](_0x453123,_0x2e8d('0x94'));}else{ut[_0x2e8d('0x90')](_0x453123,0x16,_0x2e8d('0x95'));rpcDb[_0x2e8d('0x96')](_0x453123,_0x2e8d('0x97'));rpcDb['createCustomerFinal'](_0x453123,_0x2e8d('0x97'));}}}}})['catch'](ut[_0x2e8d('0x8d')](_0x2e8d('0x98')));};Preview[_0x2e8d('0x64')]['setMessage']=function(_0x18d8e6){_0x18d8e6[_0x2e8d('0x5f')]=!![];if(ut[_0x2e8d('0x99')](_0x18d8e6[_0x2e8d('0x29')])){_0x18d8e6[_0x2e8d('0x4d')]=_0x2e8d('0x9a');}else if(!ut[_0x2e8d('0x9b')](_0x18d8e6['dialActive'])){_0x18d8e6['message']=_0x2e8d('0x9c');}else if(!this[_0x2e8d('0x9d')](_0x18d8e6[_0x2e8d('0x54')])){if(!this[_0x2e8d('0x9d')](_0x18d8e6[_0x2e8d('0x9e')])){_0x18d8e6['message']=_0x2e8d('0x9f');}else{_0x18d8e6[_0x2e8d('0x4d')]=_0x2e8d('0xa0');}}else{_0x18d8e6[_0x2e8d('0x4d')]=_0x2e8d('0xa0');}emitCampaignPreview(_0x18d8e6);};Preview[_0x2e8d('0x64')][_0x2e8d('0xa1')]=function(_0x55fe09,_0x5e45de,_0x4fa5dd){var _0x7089f7=this;var _0x37c421=this[_0x2e8d('0x14')][_0x5e45de];var _0x522ff1=this[_0x2e8d('0x23')][_0x37c421[_0x2e8d('0x70')]];var _0x18e9eb;if(_0x522ff1){switch(_0x4fa5dd){case'1':_0x522ff1[_0x2e8d('0x3d')]+=0x1;_0x37c421['countnosuchnumberretry']+=0x1;_0x37c421['countglobal']=ut[_0x2e8d('0xa2')](_0x37c421);ut['logCustomer'](_0x37c421,0x0,'NoSuchNumber');rpcDb[_0x2e8d('0x96')](_0x37c421,_0x2e8d('0xa3'));if(ut[_0x2e8d('0xa2')](_0x37c421)>=_0x522ff1[_0x2e8d('0xa4')]){_0x18e9eb=ut[_0x2e8d('0xa5')](_0x37c421,0xf,_0x2e8d('0xa6'));rpcDb[_0x2e8d('0xa7')](_0x18e9eb,_0x2e8d('0xa8'));}else{if(_0x37c421[_0x2e8d('0xa9')]>=_0x522ff1[_0x2e8d('0xaa')]){rpcDb[_0x2e8d('0xa7')](_0x37c421,_0x2e8d('0xa8'));}else{rpcDb['rescheduleContact'](ut[_0x2e8d('0xab')](_0x37c421,'countnosuchnumberretry',_0x522ff1[_0x2e8d('0xac')]),_0x37c421['unlockAgent'],_0x37c421[_0x2e8d('0xad')]);}}delete this[_0x2e8d('0x14')][_0x55fe09[_0x2e8d('0xae')]];break;case _0x2e8d('0xaf'):var _0x58df97=moment()[_0x2e8d('0x59')]('YYYY-MM-DD\x20HH:mm:ss');_0x37c421['responsetime']=_0x58df97;_0x37c421['answertime']=_0x58df97;_0x37c421[_0x2e8d('0x73')]=!![];_0x522ff1[_0x2e8d('0x2a')]+=0x1;logger['info']('[syncHangup][talking][increment]',_0x37c421[_0x2e8d('0xb0')],_0x2e8d('0xb1'),_0x522ff1['name'],_0x2e8d('0x72'),_0x522ff1[_0x2e8d('0x2a')]);ami[_0x2e8d('0x24')](_0x2e8d('0xb2'),ut['buildObj'](_0x37c421,_0x2e8d('0xb3')));if(_0x522ff1[_0x2e8d('0xb4')]){ami[_0x2e8d('0x24')](_0x2e8d('0xb5'),ut['buildAcw'](_0x37c421));}break;case'16':ami[_0x2e8d('0x24')](_0x2e8d('0xb6'),ut[_0x2e8d('0xb7')](_0x37c421,_0x2e8d('0xb8')));emitVoiceQueueChannelRemove(ut[_0x2e8d('0xb7')](_0x37c421,_0x2e8d('0xb8')));_0x522ff1['outboundAnswerCallsDay']+=0x1;_0x522ff1['total']+=0x1;_0x522ff1[_0x2e8d('0x28')]+=0x1;ut[_0x2e8d('0x7d')](_0x522ff1,_0x2e8d('0xb9'));_0x37c421[_0x2e8d('0xba')]=ut['totalGlobal'](_0x37c421);ut['logCustomer'](_0x37c421,0x4,_0x2e8d('0xbb'));rpcDb['createCustomerHistory'](_0x37c421,'[callProgressDetectingCustomer][logAnswer]');rpcDb[_0x2e8d('0xa7')](_0x37c421,'[callProgressDetectingCustomer][logAnswerGlobal]');rpcDb['crateCustomerReportQueue'](_0x37c421);_0x522ff1[_0x2e8d('0x2c')]+=_0x37c421['talktime'];_0x522ff1[_0x2e8d('0x2b')]+=_0x37c421[_0x2e8d('0xbc')];logger['info'](_0x2e8d('0xbd'),_0x37c421[_0x2e8d('0xb0')],_0x2e8d('0xb1'),_0x522ff1[_0x2e8d('0x55')],_0x2e8d('0x72'),_0x522ff1[_0x2e8d('0x2a')]);delete this[_0x2e8d('0x14')][_0x55fe09[_0x2e8d('0xae')]];break;case'BUSY':_0x522ff1[_0x2e8d('0x38')]+=0x1;_0x37c421[_0x2e8d('0xbe')]+=0x1;_0x37c421[_0x2e8d('0xba')]=ut[_0x2e8d('0xa2')](_0x37c421);ut[_0x2e8d('0x90')](_0x37c421,0x5,_0x2e8d('0xbf'));rpcDb['createCustomerHistory'](_0x37c421,'[callProgressDetectingCustomer][logBusy]');if(ut['totalGlobal'](_0x37c421)>=_0x522ff1[_0x2e8d('0xa4')]){_0x18e9eb=ut['cloneAction'](_0x37c421,0xf,'Global');rpcDb[_0x2e8d('0xa7')](_0x18e9eb,_0x2e8d('0xc0'));}else{if(_0x37c421[_0x2e8d('0xbe')]>=_0x522ff1[_0x2e8d('0xc1')]){rpcDb[_0x2e8d('0xa7')](_0x37c421,_0x2e8d('0xc2'));}else{rpcDb['rescheduleContact'](ut[_0x2e8d('0xab')](_0x37c421,'countbusyretry',_0x522ff1[_0x2e8d('0xc3')]),_0x37c421[_0x2e8d('0xc4')],_0x37c421[_0x2e8d('0xad')]);}}break;case _0x2e8d('0xc5'):_0x522ff1[_0x2e8d('0x3c')]+=0x1;_0x37c421[_0x2e8d('0xc6')]+=0x1;_0x37c421[_0x2e8d('0xba')]=ut[_0x2e8d('0xa2')](_0x37c421);ut[_0x2e8d('0x90')](_0x37c421,0x3,_0x2e8d('0xc7'));rpcDb['createCustomerHistory'](_0x37c421,_0x2e8d('0xc8'));if(ut[_0x2e8d('0xa2')](_0x37c421)>=_0x522ff1[_0x2e8d('0xa4')]){_0x18e9eb=ut[_0x2e8d('0xa5')](_0x37c421,0xf,_0x2e8d('0xa6'));rpcDb[_0x2e8d('0xa7')](_0x18e9eb,_0x2e8d('0xc9'));}else{if(_0x37c421[_0x2e8d('0xc6')]>=_0x522ff1['dialNoAnswerMaxRetry']){rpcDb[_0x2e8d('0xa7')](_0x37c421,_0x2e8d('0xc8'));}else{rpcDb[_0x2e8d('0xca')](ut['scheduledAt'](_0x37c421,_0x2e8d('0xc6'),_0x522ff1[_0x2e8d('0xcb')]),_0x37c421['unlockAgent'],_0x37c421[_0x2e8d('0xad')]);}}break;case _0x2e8d('0xcc'):_0x522ff1[_0x2e8d('0x39')]+=0x1;_0x37c421[_0x2e8d('0xcd')]+=0x1;_0x37c421[_0x2e8d('0xba')]=ut['totalGlobal'](_0x37c421);ut[_0x2e8d('0x90')](_0x37c421,0x8,_0x2e8d('0xce'));rpcDb[_0x2e8d('0x96')](_0x37c421,'[callProgressDetectingCustomer][logCongestion]');if(ut[_0x2e8d('0xa2')](_0x37c421)>=_0x522ff1[_0x2e8d('0xa4')]){_0x18e9eb=ut[_0x2e8d('0xa5')](_0x37c421,0xf,_0x2e8d('0xa6'));rpcDb[_0x2e8d('0xa7')](_0x18e9eb,'[callProgressDetectingCustomer][logCongestionGlobal]');}else{if(_0x37c421[_0x2e8d('0xcd')]>=_0x522ff1[_0x2e8d('0xcf')]){rpcDb[_0x2e8d('0xa7')](_0x37c421,_0x2e8d('0xd0'));}else{rpcDb[_0x2e8d('0xca')](ut['scheduledAt'](_0x37c421,_0x2e8d('0xcd'),_0x522ff1[_0x2e8d('0xc3')]),_0x37c421[_0x2e8d('0xc4')],_0x37c421[_0x2e8d('0xad')]);}}break;case _0x2e8d('0xd1'):_0x522ff1[_0x2e8d('0x40')]+=0x1;_0x37c421[_0x2e8d('0xd2')]+=0x1;_0x37c421[_0x2e8d('0xba')]=ut[_0x2e8d('0xa2')](_0x37c421);ut['logCustomer'](_0x37c421,0x14,_0x2e8d('0xd3'));rpcDb['createCustomerHistory'](_0x37c421,_0x2e8d('0xd4'));if(ut[_0x2e8d('0xa2')](_0x37c421)>=_0x522ff1[_0x2e8d('0xa4')]){_0x18e9eb=ut[_0x2e8d('0xa5')](_0x37c421,0x14,_0x2e8d('0xd3'));rpcDb[_0x2e8d('0xa7')](_0x18e9eb,'[callProgressDetectingCustomer][logAgentReject]');}else{if(_0x37c421[_0x2e8d('0xd2')]>=_0x522ff1[_0x2e8d('0xd5')]){rpcDb['createCustomerFinal'](_0x37c421,_0x2e8d('0xd6'));}else{rpcDb[_0x2e8d('0xca')](ut['scheduledAt'](_0x37c421,_0x2e8d('0xd2'),_0x522ff1[_0x2e8d('0xd7')]),_0x37c421['unlockAgent'],_0x37c421['activeContact']);}}break;case _0x2e8d('0xd8'):_0x522ff1[_0x2e8d('0xd9')]+=0x1;_0x37c421[_0x2e8d('0xda')]+=0x1;_0x37c421[_0x2e8d('0xba')]=ut['totalGlobal'](_0x37c421);ut[_0x2e8d('0x90')](_0x37c421,0xb,_0x2e8d('0xdb'));rpcDb[_0x2e8d('0x96')](_0x37c421,_0x2e8d('0xdc'));if(ut[_0x2e8d('0xa2')](_0x37c421)>=_0x522ff1['dialGlobalMaxRetry']){_0x18e9eb=ut['cloneAction'](_0x37c421,0xf,'Global');rpcDb[_0x2e8d('0xa7')](_0x18e9eb,_0x2e8d('0xdc'));}else{if(_0x37c421[_0x2e8d('0xdd')]>=_0x522ff1[_0x2e8d('0xde')]){rpcDb['createCustomerFinal'](_0x37c421,_0x2e8d('0xdc'));}else{rpcDb[_0x2e8d('0xca')](ut[_0x2e8d('0xab')](_0x37c421,_0x2e8d('0xda'),_0x522ff1[_0x2e8d('0xdf')]),_0x37c421[_0x2e8d('0xc4')],_0x37c421[_0x2e8d('0xad')]);}}break;default:if(_0x37c421['dialAnswer']){ut[_0x2e8d('0x7d')](_0x522ff1,_0x2e8d('0xe0'));ut[_0x2e8d('0x80')](_0x2e8d('0xe1')+_0x522ff1[_0x2e8d('0x55')],_0x55fe09);}_0x522ff1[_0x2e8d('0x41')]+=0x1;_0x37c421[_0x2e8d('0xba')]=ut[_0x2e8d('0xa2')](_0x37c421);ut['logCustomer'](_0x37c421,0xc,_0x55fe09[_0x2e8d('0xe2')]||_0x55fe09[_0x2e8d('0xe3')]);rpcDb[_0x2e8d('0x96')](_0x37c421,_0x2e8d('0xe4'));if(ut[_0x2e8d('0xa2')](_0x37c421)>=_0x522ff1[_0x2e8d('0xa4')]){_0x18e9eb=ut[_0x2e8d('0xa5')](_0x37c421,0xf,_0x2e8d('0xa6'));rpcDb['createCustomerFinal'](_0x18e9eb,'[callProgressDetectingCustomer][logUnknownGlobal]');}else{rpcDb[_0x2e8d('0xa7')](_0x37c421,_0x2e8d('0xe5'));}delete this[_0x2e8d('0x14')][_0x55fe09[_0x2e8d('0xae')]];}if(!(_0x37c421[_0x2e8d('0x73')]&&_0x4fa5dd==='16')){ut[_0x2e8d('0x7c')](_0x522ff1,_0x2e8d('0xe6'));logger[_0x2e8d('0x5c')]('[originated][decrement][callProgressDetectingCustomer]',_0x37c421[_0x2e8d('0xb0')],_0x2e8d('0xb1'),_0x522ff1[_0x2e8d('0x55')],_0x2e8d('0x71'),_0x522ff1[_0x2e8d('0x4e')]);}if(_0x4fa5dd!==_0x2e8d('0xaf')){delete this[_0x2e8d('0x14')][_0x55fe09[_0x2e8d('0xae')]];delete this[_0x2e8d('0x14')][_0x55fe09['destlinkedid']];}}};Preview['prototype']['callProgressDetectingAgent']=function(_0x53e872,_0x1e2c8a,_0x37241a){if(_[_0x2e8d('0xe7')](_0x1e2c8a)&&'object'!==typeof _0x1e2c8a){return;}if(_[_0x2e8d('0xe7')](_0x37241a)&&_0x2e8d('0xe8')!==typeof _0x37241a){return;}switch(_0x37241a['reason']){case'0':ut[_0x2e8d('0xe9')](_0x53e872,0x0,'NoSuchNumber');rpcDb[_0x2e8d('0xea')](_0x53e872,_0x2e8d('0xeb'));break;case'3':ut['logAgent'](_0x53e872,0x3,_0x2e8d('0xc7'));rpcDb[_0x2e8d('0xea')](_0x53e872,_0x2e8d('0xec'));break;case'5':ut[_0x2e8d('0xe9')](_0x53e872,0x5,_0x2e8d('0xbf'));rpcDb[_0x2e8d('0xea')](_0x53e872,'[callProgressDetectingAgent][logBusy]');break;case'8':ut['logAgent'](_0x53e872,0x8,_0x2e8d('0xce'));rpcDb[_0x2e8d('0xea')](_0x53e872,'[callProgressDetectingAgent][logCongestion]');break;case'22':ut[_0x2e8d('0xe9')](_0x53e872,0x16,_0x2e8d('0xed'));rpcDb['createAgentHistory'](_0x53e872,'[callProgressDetectingAgent][logAnswerAGI]');break;default:ut[_0x2e8d('0xe9')](_0x53e872,0xc,_0x37241a['reason']);rpcDb['createAgentHistory'](_0x53e872,_0x2e8d('0xee'));}ut[_0x2e8d('0x7c')](_0x1e2c8a,_0x2e8d('0xef'));logger[_0x2e8d('0x5c')](_0x2e8d('0xf0'),_0x53e872[_0x2e8d('0xb0')],_0x2e8d('0xb1'),_0x1e2c8a['name'],'originated:\x20',_0x1e2c8a['originated']);delete this[_0x2e8d('0x14')][_0x53e872['uniqueid']];};Preview[_0x2e8d('0x64')]['checkInBlack']=function(_0x43db84,_0x24fabb,_0x3271ef,_0x415c29,_0x170ed3){var _0x299f9b=this;return new BPromise(function(_0xd581b9,_0x2a6c3f){if(_[_0x2e8d('0x6d')](_0x24fabb)||_[_0x2e8d('0x6d')](_0x24fabb[_0x2e8d('0xf1')])||_[_0x2e8d('0x6d')](_0x24fabb[_0x2e8d('0xf1')][_0x2e8d('0xf2')])||_[_0x2e8d('0x6d')](_0x24fabb[_0x2e8d('0x77')])){_0x2a6c3f(ut[_0x2e8d('0x4d')](_0x2e8d('0xf3'),_0x415c29,_0x170ed3));return;}var _0x4adc25=uuid['v4']();var _0x315e4c=_0x299f9b[_0x2e8d('0x23')][_0x24fabb[_0x2e8d('0x6f')][_0x2e8d('0x55')]];var _0x2058ca=_0x3271ef?_0x299f9b['agents'][_0x3271ef]['id']:undefined;_0x299f9b[_0x2e8d('0x14')][_0x4adc25]=new Action(_0x24fabb,_0x315e4c,_0x4adc25,_0x3271ef,_0x2058ca);var _0x5e64c0=_0x299f9b['actions'][_0x4adc25];_0x5e64c0[_0x2e8d('0xc4')]=_0x415c29;_0x5e64c0['activeContact']=_0x170ed3;_0x5e64c0['lookAgent']=_0x3271ef;if(_[_0x2e8d('0xf4')](_0x43db84)){_0x299f9b[_0x2e8d('0xf5')](_0x5e64c0,_0x315e4c,_0x24fabb,_0x3271ef)[_0x2e8d('0x85')](function(_0x5c932e){logger[_0x2e8d('0x5c')](_0x2e8d('0xf6'),_0x2e8d('0xf7')+_0x5e64c0[_0x2e8d('0x70')]+_0x2e8d('0xf8')+_0x5e64c0[_0x2e8d('0xf9')],JSON[_0x2e8d('0x58')](_0x5c932e));ami[_0x2e8d('0x24')](_0x2e8d('0xfa'),ut['buildObj'](_0x5e64c0,'called'));_0xd581b9(ut[_0x2e8d('0x4d')](_0x2e8d('0xfb')));})['catch'](function(_0x2f477d){ut['logger']('[Preview][execCall][failure]',_0x2f477d);_0x2a6c3f(ut[_0x2e8d('0x4d')](_0x2e8d('0xfc'),_0x415c29,_0x170ed3));});}else{_0x315e4c[_0x2e8d('0xfd')]+=0x1;ut[_0x2e8d('0xfe')](_0x5e64c0);rpcDb[_0x2e8d('0xff')](_0x5e64c0,_0x2e8d('0x100'));delete _0x299f9b[_0x2e8d('0x14')][_0x4adc25];_0x2a6c3f(ut[_0x2e8d('0x4d')]('Contact\x20in\x20black\x20List',_0x415c29,_0x170ed3));}});};Preview['prototype']['isTrunkReachable']=function(_0x2650ef){return!_[_0x2e8d('0x6d')](_0x2650ef)&&!_['isNil'](_0x2650ef['name'])&&!_['isNil'](_0x2650ef[_0x2e8d('0x56')])&&_0x2650ef['active']&&!_[_0x2e8d('0x6d')](this[_0x2e8d('0x13')][util[_0x2e8d('0x59')]('SIP/%s',_0x2650ef['name'])])&&!_[_0x2e8d('0x6d')](this[_0x2e8d('0x13')][util[_0x2e8d('0x59')](_0x2e8d('0x101'),_0x2650ef['name'])][_0x2e8d('0x79')])&&(this[_0x2e8d('0x13')][util[_0x2e8d('0x59')]('SIP/%s',_0x2650ef[_0x2e8d('0x55')])][_0x2e8d('0x79')]===_0x2e8d('0x102')||this[_0x2e8d('0x13')][util[_0x2e8d('0x59')]('SIP/%s',_0x2650ef['name'])]['status']===_0x2e8d('0x103'));};Preview[_0x2e8d('0x64')][_0x2e8d('0x8a')]=function(_0x2b3b39,_0x558926){var _0x455971=this;return new BPromise(function(_0x141abf,_0x423e19){_0x455971[_0x2e8d('0x104')](_0x2b3b39,_0x558926)[_0x2e8d('0x85')](function(_0x4836f8){_0x141abf(_[_0x2e8d('0x74')](_0x4836f8,[_0x2e8d('0x4d')]));})[_0x2e8d('0x8c')](function(_0x345d75){if(_0x345d75[_0x2e8d('0x105')]){rpcDb['unlockContact'](_0x2b3b39);}if(_0x345d75[_0x2e8d('0x56')]){rpcDb['disableContact'](_0x2b3b39);}_0x423e19(_['pick'](_0x345d75,[_0x2e8d('0x4d')]));});});};Preview[_0x2e8d('0x64')][_0x2e8d('0x104')]=function(_0x43a60e,_0x436ed8){var _0x463ec9=this;return new BPromise(function(_0x3c7c6d,_0x555069){var _0x10903f,_0x525eaf;rpcDb[_0x2e8d('0x106')](_0x43a60e)[_0x2e8d('0x85')](function(_0x2b1a4e){if(!_['isNil'](_0x2b1a4e[0x0])){_0x525eaf=_0x2b1a4e[0x0]['recallme']?![]:!![];_0x10903f=_0x2b1a4e[0x0][_0x2e8d('0x107')]?!![]:![];_0x10903f=_0x436ed8?!![]:_0x10903f;}var _0x1593e8=_0x463ec9['validateContact'](_0x2b1a4e);if(_0x1593e8[_0x2e8d('0x108')]){rpcDb[_0x2e8d('0x109')](_[_0x2e8d('0x74')](_0x2b1a4e[0x0],[_0x2e8d('0x77'),_0x2e8d('0x10a')]))[_0x2e8d('0x85')](function(_0x206108){_0x463ec9['checkInBlack'](_0x206108,_0x2b1a4e[0x0],_0x436ed8,_0x525eaf,_0x10903f)[_0x2e8d('0x85')](function(_0x393004){_0x3c7c6d(_0x393004);})['catch'](function(_0x40e495){_0x555069(_0x40e495);});})[_0x2e8d('0x8c')](function(_0x3d5be8){ut[_0x2e8d('0x60')](_0x2e8d('0x10b'),_0x3d5be8);_0x555069(ut[_0x2e8d('0x4d')](_0x2e8d('0x10c'),_0x525eaf,_0x10903f));});}else{_0x555069(ut['message'](_0x1593e8[_0x2e8d('0x4d')],_0x525eaf,_0x10903f));}})[_0x2e8d('0x8c')](function(_0x219605){ut['logger'](_0x2e8d('0x10d'),_0x219605);_0x555069(ut['message'](_0x2e8d('0x10c'),![],!![]));});});};Preview[_0x2e8d('0x64')][_0x2e8d('0x10e')]=function(_0x497d8d){if(_[_0x2e8d('0x6d')](_0x497d8d)||_[_0x2e8d('0xf4')](_0x497d8d)||!_[_0x2e8d('0x6d')](_0x497d8d[0x0]['Agent'])&&_[_0x2e8d('0x6d')](_0x497d8d[0x0][_0x2e8d('0x88')][_0x2e8d('0x55')])){ut[_0x2e8d('0x60')](_0x2e8d('0x10f'),_0x497d8d);return{'isValid':![],'message':'Empty\x20Contact'};}var _0x37af34=this[_0x2e8d('0x23')][_0x497d8d[0x0][_0x2e8d('0x6f')][_0x2e8d('0x55')]];_0x37af34['message']=_0x2e8d('0xa0');if(_[_0x2e8d('0x6d')](_0x37af34)){ut[_0x2e8d('0x60')](_0x2e8d('0x110'),_0x37af34);return{'isValid':![],'message':_0x2e8d('0x111')};}if(!this[_0x2e8d('0x9d')](_0x37af34[_0x2e8d('0x54')])){ut[_0x2e8d('0x60')](_0x2e8d('0x112'),_0x2e8d('0x113')+_0x37af34[_0x2e8d('0x55')]+'\x20Trunk\x20is\x20not\x20active');if(!this[_0x2e8d('0x9d')](_0x37af34[_0x2e8d('0x9e')])){ut[_0x2e8d('0x60')]('[Preview][validateContact][Trunk\x20not\x20work]',_0x37af34[_0x2e8d('0x55')]+_0x2e8d('0x114'));return{'isValid':![],'message':_0x2e8d('0x115')};}}if(!ut[_0x2e8d('0x9b')](_0x37af34[_0x2e8d('0x32')])){ut[_0x2e8d('0x60')]('[Preview][validateContact][Campaign\x20Active]',_0x37af34[_0x2e8d('0x55')]+_0x2e8d('0x116'));return{'isValid':![],'message':_0x2e8d('0x113')+_0x37af34[_0x2e8d('0x55')]+'\x20Not\x20Active'};}return{'isValid':!![],'message':_0x2e8d('0x117')};};Preview[_0x2e8d('0x64')]['execCall']=function(_0x32ec51,_0x1d3db2,_0x462c76,_0xd5309e){var _0xe5c969=this;return new BPromise(function(_0xf05f8a,_0xeeb7e){var _0x2fbd41=_0x32ec51[_0x2e8d('0xb0')];var _0x1db5a0=_0xe5c969['isTrunkReachable'](_0x1d3db2['Trunk'])?util[_0x2e8d('0x59')](_0x2e8d('0x118'),_0x1d3db2[_0x2e8d('0x54')][_0x2e8d('0x55')],_[_0x2e8d('0x6d')](_0x1d3db2[_0x2e8d('0x36')])?'':_0x1d3db2[_0x2e8d('0x36')][_0x2e8d('0x119')]()||'',_0x1d3db2[_0x2e8d('0x11a')]>0x0?_0x462c76[_0x2e8d('0xf1')][_0x2e8d('0xf2')][_0x2e8d('0x11b')](_0x1d3db2['dialCutDigit']):_0x462c76['Contact']['phone']):util[_0x2e8d('0x59')](_0x2e8d('0x118'),_[_0x2e8d('0x6d')](_0x1d3db2['TrunkBackup'])?_0x1d3db2[_0x2e8d('0x54')]['name']:_0x1d3db2[_0x2e8d('0x9e')][_0x2e8d('0x55')],_[_0x2e8d('0x6d')](_0x1d3db2[_0x2e8d('0x36')])?'':_0x1d3db2[_0x2e8d('0x36')][_0x2e8d('0x119')]()||'',_0x1d3db2[_0x2e8d('0x11a')]>0x0?_0x462c76['Contact'][_0x2e8d('0xf2')][_0x2e8d('0x11b')](_0x1d3db2[_0x2e8d('0x11a')]):_0x462c76[_0x2e8d('0xf1')]['phone']);var _0x1a5e45=_0xe5c969[_0x2e8d('0x9d')](_0x1d3db2['Trunk'])?ut[_0x2e8d('0x11c')](_0x1d3db2[_0x2e8d('0x54')][_0x2e8d('0x11d')],_0x1d3db2['dialOriginateCallerIdName'],_0x1d3db2[_0x2e8d('0x11e')]>0x0?ut[_0x2e8d('0x11f')](_0x1d3db2[_0x2e8d('0x34')],_0x1d3db2[_0x2e8d('0x11e')]):_0x1d3db2[_0x2e8d('0x34')]):ut[_0x2e8d('0x11c')](_[_0x2e8d('0x6d')](_0x1d3db2['TrunkBackup'])?_0x1d3db2[_0x2e8d('0x54')][_0x2e8d('0x11d')]:_0x1d3db2[_0x2e8d('0x9e')]['callerid'],_0x1d3db2[_0x2e8d('0x120')],_0x1d3db2[_0x2e8d('0x11e')]>0x0?ut['getCallerIdRandom'](_0x1d3db2[_0x2e8d('0x34')],_0x1d3db2[_0x2e8d('0x11e')]):_0x1d3db2[_0x2e8d('0x34')]);if(_0x1a5e45){_0x32ec51['originatecalleridname']=ut['extractCalleridName'](_0x1a5e45);_0x32ec51[_0x2e8d('0x121')]=ut[_0x2e8d('0x122')](_0x1a5e45);}var _0x67d344=ut[_0x2e8d('0x123')](_0x1d3db2,_0x462c76,_0x1db5a0,_0x1a5e45,_0x2fbd41,_0x32ec51);_[_0x2e8d('0x124')](_0x32ec51,ut[_0x2e8d('0x125')](_0x67d344));_0x32ec51[_0x2e8d('0x8e')]=moment()[_0x2e8d('0x59')](_0x2e8d('0x8f'));ami[_0x2e8d('0x78')](ut[_0x2e8d('0x126')](_0x32ec51,_0x1d3db2,_0x67d344,_0x32ec51[_0x2e8d('0xad')],_0xd5309e))[_0x2e8d('0x85')](function(_0x5773b5){_0x1d3db2[_0x2e8d('0x4e')]+=0x1;logger[_0x2e8d('0x5c')]('[originated][increment]',_0x2fbd41,_0x2e8d('0xb1'),_0x1d3db2[_0x2e8d('0x55')],_0x2e8d('0x71'),_0x1d3db2[_0x2e8d('0x4e')]);_0xf05f8a(_0x5773b5);})[_0x2e8d('0x8c')](function(_0x14e313){ut['logAgent'](_0x32ec51,0xe,_0x2e8d('0x127'));rpcDb['createAgentHistory'](_0x32ec51,_0x2e8d('0x128'));_0xeeb7e(_0x14e313);});});};Preview[_0x2e8d('0x64')][_0x2e8d('0x1e')]=function(_0x58c923){if(this[_0x2e8d('0x14')][_0x58c923[_0x2e8d('0xae')]]){this[_0x2e8d('0x14')][_0x58c923['linkedid']]['channel']=_0x58c923[_0x2e8d('0x7a')];}};Preview['prototype'][_0x2e8d('0x17')]=function(_0x26f454){var _0x2bb679=this;var _0x4660a4=this[_0x2e8d('0x14')][_0x26f454[_0x2e8d('0x129')]];if(_0x4660a4){if(_0x4660a4[_0x2e8d('0x12a')]&&this[_0x2e8d('0x15')][_0x4660a4[_0x2e8d('0x12a')]]){ut[_0x2e8d('0x12b')](_0x4660a4,this['agents'][_0x4660a4[_0x2e8d('0x12a')]][_0x2e8d('0x55')],this[_0x2e8d('0x15')][_0x4660a4[_0x2e8d('0x12a')]]['id']);}var _0x47ec89=_[_0x2e8d('0x12c')](_0x4660a4);_0x47ec89['responsetime']=moment()[_0x2e8d('0x59')](_0x2e8d('0x8f'));var _0x511dc5=_0x2bb679[_0x2e8d('0x23')][_0x4660a4[_0x2e8d('0x70')]];if(ut[_0x2e8d('0x12d')](_0x26f454[_0x2e8d('0x12e')])){if(_0x4660a4[_0x2e8d('0xc4')]){rpcDb[_0x2e8d('0x12f')](_0x4660a4['idContact']);}if(_0x4660a4[_0x2e8d('0xad')]){rpcDb[_0x2e8d('0x130')](_0x4660a4[_0x2e8d('0xf9')]);}ami['emit'](_0x2e8d('0x131'),ut[_0x2e8d('0xb7')](_0x4660a4,'rejected'));this[_0x2e8d('0x132')](_0x47ec89,_0x511dc5,_0x26f454);}else{_0x4660a4[_0x2e8d('0x8e')]=moment()[_0x2e8d('0x59')]('YYYY-MM-DD\x20HH:mm:ss');ut[_0x2e8d('0xe9')](_0x47ec89,0x4,'Answer');rpcDb[_0x2e8d('0xea')](_0x47ec89,_0x2e8d('0x133'));}}};Preview[_0x2e8d('0x64')][_0x2e8d('0x19')]=function(_0xb386bf){var _0x1db139=this;var _0x106d1b=this[_0x2e8d('0x14')][_0xb386bf[_0x2e8d('0xae')]];var _0x4092f6;if(_0x106d1b){_0x4092f6=this[_0x2e8d('0x23')][_0x106d1b['queue']];logger[_0x2e8d('0x5c')](_0x2e8d('0x134'),_0xb386bf[_0x2e8d('0xae')],_0x2e8d('0xb1'),_0x4092f6['name'],_0x2e8d('0x72'),_0x4092f6['pTalking']);}if(this['actions'][_0xb386bf[_0x2e8d('0xae')]]&&_0xb386bf[_0x2e8d('0xae')]!==_0xb386bf[_0x2e8d('0xb0')]){if(_0xb386bf[_0x2e8d('0x135')]==='16'&&this[_0x2e8d('0x14')][_0xb386bf['linkedid']][_0x2e8d('0x73')]){this[_0x2e8d('0xa1')](_0xb386bf,_0xb386bf[_0x2e8d('0xae')],_0xb386bf[_0x2e8d('0x135')]);}else if(this[_0x2e8d('0x14')][_0xb386bf[_0x2e8d('0xae')]][_0x2e8d('0x73')]){logger[_0x2e8d('0x5c')](_0x2e8d('0x136'),_0xb386bf[_0x2e8d('0xae')],_0xb386bf[_0x2e8d('0x135')],_0x2e8d('0xb1'),_0x4092f6[_0x2e8d('0x55')],_0x2e8d('0x72'),_0x4092f6[_0x2e8d('0x2a')]);this[_0x2e8d('0xa1')](_0xb386bf,_0xb386bf[_0x2e8d('0xae')],_0xb386bf[_0x2e8d('0x135')]);}}else if(_0x106d1b&&_[_0x2e8d('0x6d')](_0x106d1b[_0x2e8d('0x137')])&&_0x4092f6[_0x2e8d('0x138')]&&_0xb386bf[_0x2e8d('0xae')]===_0xb386bf['uniqueid']&&_[_0x2e8d('0x6d')](_0xb386bf['reason'])&&_0xb386bf[_0x2e8d('0x135')]==='16'&&_0xb386bf[_0x2e8d('0x139')]==='6'&&_[_0x2e8d('0xe7')](_0x106d1b[_0x2e8d('0x13a')])){if(_0x106d1b[_0x2e8d('0xc4')]){rpcDb[_0x2e8d('0x12f')](_0x106d1b[_0x2e8d('0xf9')]);}if(_0x106d1b[_0x2e8d('0xad')]){rpcDb[_0x2e8d('0x130')](_0x106d1b['idContact']);}_0xb386bf['reason']='22';this[_0x2e8d('0x132')](_0x106d1b,_0x4092f6,_0xb386bf);}else if(_0x106d1b&&_0x106d1b['transfer']){if(_0xb386bf[_0x2e8d('0x135')]==='16'&&this['actions'][_0xb386bf['linkedid']][_0x2e8d('0x73')]){logger['info'](_0x2e8d('0x13b'),_0xb386bf[_0x2e8d('0xae')],_0xb386bf[_0x2e8d('0x135')],_0x2e8d('0xb1'),_0x4092f6[_0x2e8d('0x55')],_0x2e8d('0x72'),_0x4092f6['pTalking']);this[_0x2e8d('0xa1')](_0xb386bf,_0xb386bf['linkedid'],_0xb386bf[_0x2e8d('0x135')]);}else if(this[_0x2e8d('0x14')][_0xb386bf[_0x2e8d('0xae')]]['dialAnswer']){logger[_0x2e8d('0x5c')](_0x2e8d('0x136'),_0xb386bf['linkedid'],_0xb386bf[_0x2e8d('0x135')],_0x2e8d('0xb1'),_0x4092f6['name'],_0x2e8d('0x72'),_0x4092f6[_0x2e8d('0x2a')]);this[_0x2e8d('0xa1')](_0xb386bf,_0xb386bf[_0x2e8d('0xae')],_0xb386bf[_0x2e8d('0x135')]);}}};Preview[_0x2e8d('0x64')]['syncDialEnd']=function(_0x22d4dd){if(this['actions'][_0x22d4dd['destlinkedid']]&&_0x22d4dd[_0x2e8d('0x13c')]!==_0x22d4dd[_0x2e8d('0x13d')]){this[_0x2e8d('0xa1')](_0x22d4dd,_0x22d4dd[_0x2e8d('0x13c')],_0x22d4dd[_0x2e8d('0xe3')]);}};Preview[_0x2e8d('0x64')][_0x2e8d('0x13e')]=function(_0x3d2d9b){if(this[_0x2e8d('0x14')][_0x3d2d9b['linkedid']]&&_0x3d2d9b[_0x2e8d('0xae')]!==_0x3d2d9b[_0x2e8d('0xb0')]&&!this[_0x2e8d('0x14')][_0x3d2d9b[_0x2e8d('0xae')]][_0x2e8d('0x73')]){if(_0x3d2d9b[_0x2e8d('0x135')]==='1'){this[_0x2e8d('0xa1')](_0x3d2d9b,_0x3d2d9b[_0x2e8d('0xae')],_0x3d2d9b['cause']);}}};Preview[_0x2e8d('0x64')][_0x2e8d('0x13f')]=function(_0x1e2259,_0x58d477,_0x2fbf26){if(this['actions'][_0x1e2259]){if(_[_0x2e8d('0x6d')](this[_0x2e8d('0x14')][_0x1e2259][_0x2e8d('0x140')])){this[_0x2e8d('0x14')][_0x1e2259]['variables']={};}this[_0x2e8d('0x14')][_0x1e2259][_0x2e8d('0x140')][_0x58d477]=_0x2fbf26;}};Preview[_0x2e8d('0x64')][_0x2e8d('0x141')]=function(_0x310424){try{if(!_['isNil'](_0x310424)){if(ut[_0x2e8d('0x142')](_[_0x2e8d('0x143')](_0x310424['variable'])[0x0])){this[_0x2e8d('0x13f')](_0x310424[_0x2e8d('0xb0')],_[_0x2e8d('0x143')](_0x310424[_0x2e8d('0x144')])[0x0],_0x310424[_0x2e8d('0x145')]);}}}catch(_0x286036){logger[_0x2e8d('0x146')](_0x2e8d('0x147'),util[_0x2e8d('0x148')](_0x286036,{'showHidden':![],'depth':null}));}};Preview['prototype'][_0x2e8d('0x20')]=function(_0x480274){if(_0x480274){if(this[_0x2e8d('0x14')][_0x480274[_0x2e8d('0x149')]]){this['actions'][_0x480274[_0x2e8d('0x149')]][_0x2e8d('0x13a')]=!![];}}};Preview[_0x2e8d('0x64')]['syncBlindTransfer']=function(_0xcbf692){if(_0xcbf692){if(this[_0x2e8d('0x14')][_0xcbf692[_0x2e8d('0x14a')]]){this['actions'][_0xcbf692[_0x2e8d('0x14a')]][_0x2e8d('0x13a')]=!![];}}};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 d8e648a..acbc68b 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 _0xd6d6=['calleridnum','calleridname','queue','queuecallerjoinAt','answertime','queuecallerleaveAt','queuecallercomplete','endtime','connectedlinename','membername','context','exten','holdtime','assigned','queuecallerexitreason','COMPLETED','create','[voiceQueueReport]\x20','getContactRecallMe','[GetContactRecallMe]\x20','rescheduleContactInQueue','[rescheduleContactInQueue]\x20','util','bluebird','../../../config/logger','preview','../rpc/cmHopper','../rpc/cmHopperFinal','../rpc/cmHopperHistory','../rpc/cmHopperBlack','../rpc/voiceQueueRt','../rpc/agentReportPreview','../rpc/voiceQueueReport','error','inspect','resolve','then','createHistory','catch','[moveContactManagedDialer]\x20','checkIsBlackList','getContactPreview','[getContactPreview]\x20','createCustomerHistory','rescheduleContact','UserId','active','[rescheduleContact]\x20','countReScheduled','[countReScheduled]\x20','unlockContact','[unlockContact]\x20','disableContact','[activeContact]\x20','type','uniqueid'];(function(_0x590ef7,_0x175f08){var _0x4c2634=function(_0xf94570){while(--_0xf94570){_0x590ef7['push'](_0x590ef7['shift']());}};_0x4c2634(++_0x175f08);}(_0xd6d6,0xbe));var _0x6d6d=function(_0x23a004,_0x4b4192){_0x23a004=_0x23a004-0x0;var _0x436bdb=_0xd6d6[_0x23a004];return _0x436bdb;};'use strict';var util=require(_0x6d6d('0x0'));var BPromise=require(_0x6d6d('0x1'));var logger=require(_0x6d6d('0x2'))(_0x6d6d('0x3'));var _=require('lodash');var cmHopper=require(_0x6d6d('0x4'));var cmHopperFinal=require(_0x6d6d('0x5'));var cmHopperHistory=require(_0x6d6d('0x6'));var cmHopperBlack=require(_0x6d6d('0x7'));var voiceQueueRt=require(_0x6d6d('0x8'));var agentReportPreview=require(_0x6d6d('0x9'));var voiceQueueReport=require(_0x6d6d('0xa'));function loggerCatch(_0x5702dc){return function(_0x210ff7){logger[_0x6d6d('0xb')](_0x5702dc,util[_0x6d6d('0xc')](_0x210ff7,{'showHidden':![],'depth':null}));};}function create(_0x18f824){return BPromise[_0x6d6d('0xd')]()[_0x6d6d('0xe')](cmHopperHistory[_0x6d6d('0xf')](_0x18f824))['catch'](loggerCatch('[createHistory]\x20'));}function createAgent(_0x404c88){return BPromise[_0x6d6d('0xd')]()[_0x6d6d('0xe')](agentReportPreview[_0x6d6d('0xf')](_0x404c88))[_0x6d6d('0x10')](loggerCatch('[createHistory]\x20'));}function moveContact(_0x1f2b86){return BPromise[_0x6d6d('0xd')]()['then'](cmHopper['moveContactManagedDialer'](_0x1f2b86,!![]))[_0x6d6d('0x10')](loggerCatch(_0x6d6d('0x11')));}exports[_0x6d6d('0x12')]=function(_0x3f8542){return BPromise[_0x6d6d('0xd')]()[_0x6d6d('0xe')](cmHopperBlack[_0x6d6d('0x12')](_0x3f8542))[_0x6d6d('0x10')](loggerCatch('[checkIsBlackList]\x20'));};exports[_0x6d6d('0x13')]=function(_0x3dd4b3){return BPromise[_0x6d6d('0xd')]()[_0x6d6d('0xe')](cmHopper[_0x6d6d('0x13')](_0x3dd4b3))['catch'](loggerCatch(_0x6d6d('0x14')));};exports['createHistory']=function(_0x27830d,_0x2cbc86){create(_0x27830d)[_0x6d6d('0x10')](loggerCatch(_0x2cbc86));moveContact(_0x27830d)['catch'](loggerCatch(_0x2cbc86));};exports['createAgentHistory']=function(_0x9e1e18,_0x1a75d8){createAgent(_0x9e1e18)[_0x6d6d('0x10')](loggerCatch(_0x1a75d8));};exports[_0x6d6d('0x15')]=function(_0x51fff6,_0x554392){create(_0x51fff6)[_0x6d6d('0x10')](loggerCatch(_0x554392));};exports['createCustomerFinal']=function(_0x26f631,_0xb8590d){moveContact(_0x26f631)[_0x6d6d('0x10')](loggerCatch(_0xb8590d));};exports[_0x6d6d('0x16')]=function(_0x40d35b,_0x3242d8,_0x164c67){if(_0x3242d8){_0x40d35b[_0x6d6d('0x17')]=null;}if(_0x164c67){_0x40d35b[_0x6d6d('0x18')]=![];}return BPromise[_0x6d6d('0xd')]()[_0x6d6d('0xe')](cmHopper[_0x6d6d('0x16')](_0x40d35b))[_0x6d6d('0x10')](loggerCatch(_0x6d6d('0x19')));};exports[_0x6d6d('0x1a')]=function(_0x25a02e){return BPromise[_0x6d6d('0xd')]()['then'](cmHopper[_0x6d6d('0x1a')](_0x25a02e))[_0x6d6d('0x10')](loggerCatch(_0x6d6d('0x1b')));};exports[_0x6d6d('0x1c')]=function(_0xf0df7f){return BPromise[_0x6d6d('0xd')]()['then'](cmHopper[_0x6d6d('0x1c')]({'UserId':null},_0xf0df7f,0x1))[_0x6d6d('0x10')](loggerCatch(_0x6d6d('0x1d')));};exports[_0x6d6d('0x1e')]=function(_0x25c121){return BPromise[_0x6d6d('0xd')]()[_0x6d6d('0xe')](cmHopper['unlockContact']({'active':![]},_0x25c121,0x1))[_0x6d6d('0x10')](loggerCatch(_0x6d6d('0x1f')));};exports['crateCustomerReportQueue']=function(_0x553645){var _0x3edcce={};_0x3edcce[_0x6d6d('0x20')]=_0x553645[_0x6d6d('0x20')];_0x3edcce['uniqueid']=_0x553645[_0x6d6d('0x21')];_0x3edcce[_0x6d6d('0x22')]=_0x553645[_0x6d6d('0x22')];_0x3edcce[_0x6d6d('0x23')]=_0x553645[_0x6d6d('0x23')];_0x3edcce[_0x6d6d('0x24')]=_0x553645[_0x6d6d('0x24')];_0x3edcce[_0x6d6d('0x25')]=_0x553645[_0x6d6d('0x26')];_0x3edcce[_0x6d6d('0x27')]=_0x553645['answertime'];_0x3edcce[_0x6d6d('0x28')]=0x1;_0x3edcce['queuecallercompleteAt']=_0x553645[_0x6d6d('0x29')];_0x3edcce[_0x6d6d('0x2a')]=_0x553645[_0x6d6d('0x2b')];_0x3edcce[_0x6d6d('0x2c')]='from-sip';_0x3edcce[_0x6d6d('0x2d')]='xcally-motion-preview';_0x3edcce[_0x6d6d('0x2e')]=0x0;_0x3edcce[_0x6d6d('0x2f')]=0x1;_0x3edcce['lastAssignedTo']=_0x553645[_0x6d6d('0x2b')];_0x3edcce[_0x6d6d('0x30')]=_0x6d6d('0x31');return BPromise[_0x6d6d('0xd')]()[_0x6d6d('0xe')](voiceQueueReport[_0x6d6d('0x32')](_0x3edcce))[_0x6d6d('0x10')](loggerCatch(_0x6d6d('0x33')));};exports[_0x6d6d('0x34')]=function(_0x1d0545,_0x2fcf88){return BPromise[_0x6d6d('0xd')]()[_0x6d6d('0xe')](cmHopper[_0x6d6d('0x34')](_0x1d0545,_0x2fcf88))['catch'](loggerCatch(_0x6d6d('0x35')));};exports[_0x6d6d('0x36')]=function(_0x3e2415){return BPromise[_0x6d6d('0xd')]()['then'](cmHopper['rescheduleContact'](_0x3e2415,!![],!![]))[_0x6d6d('0x10')](loggerCatch(_0x6d6d('0x37')));}; \ No newline at end of file +var _0x6b8f=['queue','queuecallerjoinAt','queuecallerleaveAt','answertime','queuecallercomplete','endtime','connectedlinename','membername','context','exten','xcally-motion-preview','holdtime','queuecallerexitreason','COMPLETED','create','[voiceQueueReport]\x20','getContactRecallMe','[GetContactRecallMe]\x20','rescheduleContactInQueue','[rescheduleContactInQueue]\x20','bluebird','preview','../rpc/cmHopperFinal','../rpc/cmHopperHistory','../rpc/voiceQueueRt','../rpc/agentReportPreview','../rpc/voiceQueueReport','error','inspect','createHistory','[createHistory]\x20','resolve','then','catch','moveContactManagedDialer','[moveContactManagedDialer]\x20','[checkIsBlackList]\x20','getContactPreview','[getContactPreview]\x20','createCustomerFinal','rescheduleContact','UserId','active','countReScheduled','unlockContact','[unlockContact]\x20','disableContact','[activeContact]\x20','crateCustomerReportQueue','type','uniqueid','calleridnum','calleridname'];(function(_0x82d403,_0x49bfd5){var _0x1b333a=function(_0x47f3b3){while(--_0x47f3b3){_0x82d403['push'](_0x82d403['shift']());}};_0x1b333a(++_0x49bfd5);}(_0x6b8f,0x1bc));var _0xf6b8=function(_0x213b0b,_0x6e69b8){_0x213b0b=_0x213b0b-0x0;var _0x30d71c=_0x6b8f[_0x213b0b];return _0x30d71c;};'use strict';var util=require('util');var BPromise=require(_0xf6b8('0x0'));var logger=require('../../../config/logger')(_0xf6b8('0x1'));var _=require('lodash');var cmHopper=require('../rpc/cmHopper');var cmHopperFinal=require(_0xf6b8('0x2'));var cmHopperHistory=require(_0xf6b8('0x3'));var cmHopperBlack=require('../rpc/cmHopperBlack');var voiceQueueRt=require(_0xf6b8('0x4'));var agentReportPreview=require(_0xf6b8('0x5'));var voiceQueueReport=require(_0xf6b8('0x6'));function loggerCatch(_0x549eac){return function(_0x2d035e){logger[_0xf6b8('0x7')](_0x549eac,util[_0xf6b8('0x8')](_0x2d035e,{'showHidden':![],'depth':null}));};}function create(_0x3c3430){return BPromise['resolve']()['then'](cmHopperHistory[_0xf6b8('0x9')](_0x3c3430))['catch'](loggerCatch(_0xf6b8('0xa')));}function createAgent(_0x7ac5fd){return BPromise[_0xf6b8('0xb')]()[_0xf6b8('0xc')](agentReportPreview[_0xf6b8('0x9')](_0x7ac5fd))[_0xf6b8('0xd')](loggerCatch('[createHistory]\x20'));}function moveContact(_0x481679){return BPromise['resolve']()[_0xf6b8('0xc')](cmHopper[_0xf6b8('0xe')](_0x481679,!![]))[_0xf6b8('0xd')](loggerCatch(_0xf6b8('0xf')));}exports['checkIsBlackList']=function(_0x4e5235){return BPromise[_0xf6b8('0xb')]()[_0xf6b8('0xc')](cmHopperBlack['checkIsBlackList'](_0x4e5235))[_0xf6b8('0xd')](loggerCatch(_0xf6b8('0x10')));};exports[_0xf6b8('0x11')]=function(_0x59bfed){return BPromise[_0xf6b8('0xb')]()['then'](cmHopper[_0xf6b8('0x11')](_0x59bfed))[_0xf6b8('0xd')](loggerCatch(_0xf6b8('0x12')));};exports[_0xf6b8('0x9')]=function(_0x12f9a8,_0x567b58){create(_0x12f9a8)['catch'](loggerCatch(_0x567b58));moveContact(_0x12f9a8)[_0xf6b8('0xd')](loggerCatch(_0x567b58));};exports['createAgentHistory']=function(_0x3cf63c,_0x206a84){createAgent(_0x3cf63c)['catch'](loggerCatch(_0x206a84));};exports['createCustomerHistory']=function(_0x1d0ee9,_0x2e2b29){create(_0x1d0ee9)[_0xf6b8('0xd')](loggerCatch(_0x2e2b29));};exports[_0xf6b8('0x13')]=function(_0x4df5f4,_0x59f9df){moveContact(_0x4df5f4)['catch'](loggerCatch(_0x59f9df));};exports[_0xf6b8('0x14')]=function(_0x2a8195,_0x99d51,_0x56b48a){if(_0x99d51){_0x2a8195[_0xf6b8('0x15')]=null;}if(_0x56b48a){_0x2a8195[_0xf6b8('0x16')]=![];}return BPromise[_0xf6b8('0xb')]()[_0xf6b8('0xc')](cmHopper['rescheduleContact'](_0x2a8195))[_0xf6b8('0xd')](loggerCatch('[rescheduleContact]\x20'));};exports[_0xf6b8('0x17')]=function(_0x2b5bd3){return BPromise[_0xf6b8('0xb')]()[_0xf6b8('0xc')](cmHopper[_0xf6b8('0x17')](_0x2b5bd3))[_0xf6b8('0xd')](loggerCatch('[countReScheduled]\x20'));};exports[_0xf6b8('0x18')]=function(_0x1ebfea){return BPromise['resolve']()[_0xf6b8('0xc')](cmHopper[_0xf6b8('0x18')]({'UserId':null},_0x1ebfea,0x1))[_0xf6b8('0xd')](loggerCatch(_0xf6b8('0x19')));};exports[_0xf6b8('0x1a')]=function(_0x573ad8){return BPromise['resolve']()[_0xf6b8('0xc')](cmHopper[_0xf6b8('0x18')]({'active':![]},_0x573ad8,0x1))['catch'](loggerCatch(_0xf6b8('0x1b')));};exports[_0xf6b8('0x1c')]=function(_0x888319){var _0x5a7f55={};_0x5a7f55[_0xf6b8('0x1d')]=_0x888319[_0xf6b8('0x1d')];_0x5a7f55['uniqueid']=_0x888319[_0xf6b8('0x1e')];_0x5a7f55[_0xf6b8('0x1f')]=_0x888319[_0xf6b8('0x1f')];_0x5a7f55[_0xf6b8('0x20')]=_0x888319['calleridname'];_0x5a7f55[_0xf6b8('0x21')]=_0x888319[_0xf6b8('0x21')];_0x5a7f55[_0xf6b8('0x22')]=_0x888319['answertime'];_0x5a7f55[_0xf6b8('0x23')]=_0x888319[_0xf6b8('0x24')];_0x5a7f55[_0xf6b8('0x25')]=0x1;_0x5a7f55['queuecallercompleteAt']=_0x888319[_0xf6b8('0x26')];_0x5a7f55[_0xf6b8('0x27')]=_0x888319[_0xf6b8('0x28')];_0x5a7f55[_0xf6b8('0x29')]='from-sip';_0x5a7f55[_0xf6b8('0x2a')]=_0xf6b8('0x2b');_0x5a7f55[_0xf6b8('0x2c')]=0x0;_0x5a7f55['assigned']=0x1;_0x5a7f55['lastAssignedTo']=_0x888319[_0xf6b8('0x28')];_0x5a7f55[_0xf6b8('0x2d')]=_0xf6b8('0x2e');return BPromise[_0xf6b8('0xb')]()[_0xf6b8('0xc')](voiceQueueReport[_0xf6b8('0x2f')](_0x5a7f55))[_0xf6b8('0xd')](loggerCatch(_0xf6b8('0x30')));};exports[_0xf6b8('0x31')]=function(_0x3b9493,_0x3a45e4){return BPromise[_0xf6b8('0xb')]()[_0xf6b8('0xc')](cmHopper[_0xf6b8('0x31')](_0x3b9493,_0x3a45e4))[_0xf6b8('0xd')](loggerCatch(_0xf6b8('0x32')));};exports[_0xf6b8('0x33')]=function(_0x132f2b){return BPromise['resolve']()['then'](cmHopper[_0xf6b8('0x14')](_0x132f2b,!![],!![]))[_0xf6b8('0xd')](loggerCatch(_0xf6b8('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 ae2050e..6c4fd5a 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 _0x9491=['VoiceQueueId','filterKey','idContact','type','campaigntype','dialAnswer','countbusyretry','callback','recallme','UserId','sipcallid','xmd-voicequeueid','xmd-queue','xmd-phone','xmd-listid','xmd-dialurl','xmd-dialtimeout','xmd-dialoptions','xmd-dialid','xmd-contactid','xmd-callerid','xmd-agiafter','xmd-agi','rtpaudioqos','rtpaudioqosjitterbridged','rtpaudioqosloss','rtpaudioqoslossbridged','rtpaudioqosrtt','rtpaudioqosrttbridged','rtpaudioqosbridged','rtpaudioqosjitter','bridgepeer','bridgepvtcallid','getCallerIdRandom','\x5cw{0,','pow','replace','random','extractCalleridName','extractCalleridNumber','match','util','lodash','moment','../../../../config/logger','preview','env','XCALLY_IP_AGI','127.0.0.1','milliseconds','diff','loggerCatch','error','inspect','logger','info','loggerError','logger2','getCallerId','isUndefined','string','isEmpty','\x22%s\x22\x20<%s>','format','\x22\x22\x20<>','isActive','isNil','addVariables','Queue','calleridname','calleridnum','ContactId','dialer','dialOriginateTimeout','\x22rtTxX%s%s\x22','monitor_format','dialPreviewUrl','\x22agi://%s/square,%s\x22','dialQueueProject','NONE','dialQueueProject2','_XCALLY_MIXMONITOR_FORMAT','_XCALLY_MIXMONITOR_UNIQUEID','Contact','tags','createdAt','%s%s','XMD-','toUpper','toLowerVariables','hasOwnProperty','updateOriginated','originated','[updateOriginated]\x20object\x20originated\x20is\x20negative','[updateOriginated]\x20is\x20null\x20or\x20undefined','logBlacklist','state','statedesc','Blacklist','responsetime','endtime','YYYY-MM-DD\x20HH:mm:ss','ringtime','starttime','logLookAgent','membername','talktime','answertime','variablesAction','RECALL','BOOKED','channelAgent','xcally-motion-preview','from-sip','timeout','countcongestionretry','clone','Global','scheduledAt','active','scheduledat','add','minutes','ListId','decrementTalkink','pTalking','[decrementTalkink]\x20object\x20talking\x20is\x20negative','[decrementTalkink]\x20is\x20null\x20or\x20undefined','buildObj','lastevent','name','queue','interface','buildAcw','uniqueid','agentReadyId','status','reachable','push','getDiff','createBody'];(function(_0x466fc8,_0x2513ad){var _0x49c47d=function(_0x2447c7){while(--_0x2447c7){_0x466fc8['push'](_0x466fc8['shift']());}};_0x49c47d(++_0x2513ad);}(_0x9491,0xb6));var _0x1949=function(_0x44c688,_0x13a59a){_0x44c688=_0x44c688-0x0;var _0x347db5=_0x9491[_0x44c688];return _0x347db5;};'use strict';var util=require(_0x1949('0x0'));var _=require(_0x1949('0x1'));var moment=require(_0x1949('0x2'));var logger=require(_0x1949('0x3'))(_0x1949('0x4'));var ipAgi=process[_0x1949('0x5')][_0x1949('0x6')]||_0x1949('0x7');function getSeconds(_0x4270d7,_0x358907){var _0x4b5676=moment(_0x4270d7)[_0x1949('0x8')](0x0);var _0x5b01b9=moment(_0x358907)[_0x1949('0x8')](0x0);return _0x4b5676[_0x1949('0x9')](_0x5b01b9,'seconds');}exports[_0x1949('0xa')]=function(_0x3665b6){return function(_0x3c3c17){logger[_0x1949('0xb')](_0x3665b6,util[_0x1949('0xc')](_0x3c3c17,{'showHidden':![],'depth':null}));};};exports[_0x1949('0xd')]=function(_0x236585,_0x34140a){logger[_0x1949('0xe')](_0x236585,util[_0x1949('0xc')](_0x34140a,{'showHidden':![],'depth':null}));};exports[_0x1949('0xf')]=function(_0x4ead80,_0x32d22b){logger[_0x1949('0xb')](_0x4ead80,util[_0x1949('0xc')](_0x32d22b,{'showHidden':![],'depth':null}));};exports[_0x1949('0x10')]=function(_0xa02415){return function(_0x6d5828){logger['info'](_0xa02415,util[_0x1949('0xc')](_0x6d5828,{'showHidden':![],'depth':null}));};};exports['message']=function(_0x574713,_0x1716fe,_0x2b374d){return{'message':_0x574713,'unlock':_0x1716fe,'active':_0x2b374d};};exports[_0x1949('0x11')]=function(_0x4803a7,_0x2726f7,_0x421e52){if(!_[_0x1949('0x12')](_0x421e52)&&'string'===typeof _0x421e52&&!_['isEmpty'](_0x421e52)){if(!_[_0x1949('0x12')](_0x2726f7)&&_0x1949('0x13')===typeof _0x2726f7&&!_[_0x1949('0x14')](_0x2726f7)){return util['format'](_0x1949('0x15'),_0x2726f7,_0x421e52);}return util[_0x1949('0x16')]('\x22%s\x22\x20<%s>',_0x421e52,_0x421e52);}if(!_[_0x1949('0x12')](_0x4803a7)&&_0x1949('0x13')===typeof _0x4803a7&&!_[_0x1949('0x14')](_0x4803a7)){return _0x4803a7;}return _0x1949('0x17');};exports[_0x1949('0x18')]=function(_0x3f30d3){if(_[_0x1949('0x19')](_0x3f30d3)){return![];}return _0x3f30d3;};exports[_0x1949('0x1a')]=function(_0x20a18b,_0x5702fc,_0x1e0478,_0x50e662,_0x599be4,_0x472a9f){var _0x4a3a9d={'XMD-QUEUE':_0x5702fc[_0x1949('0x1b')]?_0x5702fc[_0x1949('0x1b')]['name']:'','XMD-CALLERID':_0x50e662,'XMD-CALLERID-PREVIEW':_0x472a9f?util[_0x1949('0x16')]('\x22%s\x22\x20<%s>',_0x472a9f[_0x1949('0x1c')],_0x472a9f[_0x1949('0x1d')]):_0x50e662,'XMD-DIALID':_0x599be4,'XMD-CONTACTID':_0x5702fc[_0x1949('0x1e')],'XMD-CDRTYPE':_0x1949('0x1f'),'CALLERID(all)':_0x50e662,'XMD-VOICEQUEUEID':_0x5702fc['VoiceQueueId'],'XMD-DIALCHANNEL':_0x1e0478,'XMD-DIALTIMEOUT':_0x20a18b[_0x1949('0x20')]||0x1e,'XMD-DIALOPTIONS':util['format'](_0x1949('0x21'),_0x20a18b['dialQueueProject2']?'g':'',_[_0x1949('0x14')](_0x20a18b[_0x1949('0x22')])?'':'U(xcally-mixmonitor-context)'),'XMD-DIALURL':_0x20a18b[_0x1949('0x23')]||'','XMD-AGI':_0x20a18b['dialQueueProject']?util[_0x1949('0x16')](_0x1949('0x24'),ipAgi,_0x20a18b[_0x1949('0x25')]):_0x1949('0x26'),'XMD-AGIAFTER':_0x20a18b['dialQueueProject2']?util['format'](_0x1949('0x24'),ipAgi,_0x20a18b[_0x1949('0x27')]):_0x1949('0x26'),'XMD-ORIGINATECALLERIDNUM':_0x472a9f?_0x472a9f['originatecalleridnum']:'','XMD-ORIGINATECALLERIDNAME':_0x472a9f?_0x472a9f['originatecalleridname']:'','XMD-DESTINATION':'xcally-motion-preview'};if(!_[_0x1949('0x14')](_0x20a18b['monitor_format'])){_0x4a3a9d[util['format']('%s',_0x1949('0x28'))]=_0x20a18b[_0x1949('0x22')];_0x4a3a9d[util[_0x1949('0x16')]('%s',_0x1949('0x29'))]=_0x599be4;}if(_0x5702fc&&_0x5702fc[_0x1949('0x2a')]){for(var _0x141bb7 in _0x5702fc[_0x1949('0x2a')]){if(_0x5702fc[_0x1949('0x2a')]['hasOwnProperty'](_0x141bb7)){if(!_[_0x1949('0x19')](_0x5702fc['Contact'][_0x141bb7])&&_0x141bb7!=='id'&&_0x141bb7!==_0x1949('0x2b')&&_0x141bb7!==_0x1949('0x2c')&&_0x141bb7!=='updatedAt'){_0x4a3a9d[util[_0x1949('0x16')](_0x1949('0x2d'),_0x1949('0x2e'),_[_0x1949('0x2f')](_0x141bb7))]=_0x5702fc[_0x1949('0x2a')][_0x141bb7];}}}}return _0x4a3a9d;};exports[_0x1949('0x30')]=function(_0x2984ae){var _0x235cf1={};for(var _0x4a4b1c in _0x2984ae){if(_0x2984ae[_0x1949('0x31')](_0x4a4b1c)){_0x235cf1[util['format']('%s',_['toLower'](_0x4a4b1c))]=_0x2984ae[_0x4a4b1c];}}return{'variables':_0x235cf1};};exports[_0x1949('0x32')]=function(_0xeb932e,_0x2794d2){if(!_[_0x1949('0x19')](_0xeb932e)){if(_0xeb932e[_0x1949('0x31')](_0x1949('0x33'))){if(_0xeb932e[_0x1949('0x33')]>0x0){_0xeb932e[_0x1949('0x33')]-=0x1;}else{logger[_0x1949('0xb')](_0x1949('0x34'),_0x2794d2);}}}else{logger[_0x1949('0xb')](_0x1949('0x35'),_0x2794d2);}};exports[_0x1949('0x36')]=function(_0x3a3007){var _0x51a1a6=moment()[_0x1949('0x16')]('YYYY-MM-DD\x20HH:mm:ss');_0x3a3007[_0x1949('0x37')]=0xd;_0x3a3007[_0x1949('0x38')]=_0x1949('0x39');_0x3a3007['starttime']=_0x51a1a6;_0x3a3007[_0x1949('0x3a')]=_0x51a1a6;_0x3a3007[_0x1949('0x3b')]=_0x51a1a6;};exports['logAgent']=function(_0x4a4c60,_0x1a0d67,_0x109873){var _0x12b98e=moment()[_0x1949('0x16')](_0x1949('0x3c'));_0x4a4c60[_0x1949('0x37')]=_0x1a0d67;_0x4a4c60[_0x1949('0x38')]=_0x109873;_0x4a4c60[_0x1949('0x3a')]=_0x12b98e;_0x4a4c60[_0x1949('0x3d')]=getSeconds(_0x4a4c60[_0x1949('0x3a')],_0x4a4c60[_0x1949('0x3e')]);};exports[_0x1949('0x3f')]=function(_0x29dbb0,_0x4242d1,_0x2acd73){_0x29dbb0[_0x1949('0x40')]=_0x4242d1;_0x29dbb0['UserId']=_0x2acd73;};exports['logCustomer']=function(_0x1f524d,_0x4573ef,_0xd21c26){var _0x2ac1e9=moment()[_0x1949('0x16')](_0x1949('0x3c'));_0x1f524d[_0x1949('0x37')]=_0x4573ef;_0x1f524d[_0x1949('0x38')]=_0xd21c26;_0x1f524d[_0x1949('0x3a')]=_0x1f524d['responsetime']?_0x1f524d['responsetime']:_0x2ac1e9;_0x1f524d['endtime']=_0x1f524d[_0x1949('0x3b')]?_0x1f524d[_0x1949('0x3b')]:_0x2ac1e9;_0x1f524d[_0x1949('0x3d')]=getSeconds(_0x1f524d[_0x1949('0x3a')]||0x0,_0x1f524d[_0x1949('0x3e')]||0x0);_0x1f524d[_0x1949('0x41')]=_0x1f524d[_0x1949('0x42')]?getSeconds(_0x1f524d[_0x1949('0x3b')],_0x1f524d[_0x1949('0x42')]):0x0;};exports['isFailure']=function(_0x41f8d8){return _0x41f8d8==='Failure';};exports[_0x1949('0x43')]=function(_0x599078,_0x550cc1,_0x30a841,_0x22aed7,_0x258fb9){var _0x56ccee=_0x22aed7?_0x1949('0x44'):_0x599078[_0x1949('0x1c')];_0x56ccee=_0x258fb9?_0x1949('0x45'):_0x56ccee;return{'actionid':_0x599078['uniqueid'],'action':'originate','channel':_0x599078[_0x1949('0x46')],'callerid':util['format']('\x22%s\x22\x20<%s>',_0x56ccee,_0x599078[_0x1949('0x1d')]),'Exten':_0x1949('0x47'),'Context':_0x1949('0x48'),'Priority':'1','variable':_0x30a841,'timeout':(_0x550cc1[_0x1949('0x49')]||0x1e)*0x3e8,'async':!![],'channelid':_0x599078['uniqueid']};};exports['totalGlobal']=function(_0x11d5b4){return _0x11d5b4['countbusyretry']+_0x11d5b4[_0x1949('0x4a')]+_0x11d5b4['countnoanswerretry'];};exports['cloneAction']=function(_0x435a51){var _0x297fe7=_[_0x1949('0x4b')](_0x435a51);_0x297fe7['state']=0xf;_0x297fe7['statedesc']=_0x1949('0x4c');return _0x297fe7;};exports[_0x1949('0x4d')]=function(_0x59b4b2,_0x50e279,_0x141d90){var _0x3e9b03={};_0x3e9b03[_0x50e279]=_0x59b4b2[_0x50e279];_0x3e9b03[_0x1949('0x4e')]=![];_0x3e9b03[_0x1949('0x4f')]=moment()[_0x1949('0x50')](_0x141d90,_0x1949('0x51'))[_0x1949('0x16')](_0x1949('0x3c'));_0x3e9b03[_0x1949('0x1e')]=_0x59b4b2['ContactId'];_0x3e9b03['ListId']=_0x59b4b2[_0x1949('0x52')];_0x3e9b03['VoiceQueueId']=_0x59b4b2['VoiceQueueId']||undefined;return _0x3e9b03;};exports[_0x1949('0x53')]=function(_0x15d035,_0x43cd36){if(!_[_0x1949('0x19')](_0x15d035)){if(_0x15d035[_0x1949('0x54')]>0x0){_0x15d035['pTalking']-=0x1;}else{logger[_0x1949('0xb')](_0x43cd36,_0x1949('0x55'));}}else{logger[_0x1949('0xb')](_0x43cd36,_0x1949('0x56'));}};exports['IsNotLoggedIn']=function(_0x2c90aa){if(_0x2c90aa<=0x0){return!![];}return![];};exports[_0x1949('0x57')]=function(_0x2bf19d,_0x43aed5){_0x2bf19d[_0x1949('0x58')]=_0x43aed5;_0x2bf19d[_0x1949('0x59')]=_0x2bf19d[_0x1949('0x5a')];_0x2bf19d[_0x1949('0x5b')]=_0x2bf19d[_0x1949('0x46')];return _0x2bf19d;};exports[_0x1949('0x5c')]=function(_0x4c1366){var _0x40ac3c={};_0x40ac3c[_0x1949('0x5a')]=_0x4c1366['queue'];_0x40ac3c[_0x1949('0x5b')]=_0x4c1366['channelAgent'];_0x40ac3c[_0x1949('0x5d')]=_0x4c1366['uniqueid'];return _0x40ac3c;};exports[_0x1949('0x5e')]=function(_0x5804c5){var _0x21c67c=[];for(var _0x2f0a25 in _0x5804c5){if(_0x5804c5[_0x1949('0x31')](_0x2f0a25)){if(!_[_0x1949('0x19')](_0x5804c5[_0x2f0a25])&&_0x5804c5[_0x2f0a25][_0x1949('0x37')]==='not_inuse'&&_0x5804c5[_0x2f0a25][_0x1949('0x5f')]===_0x1949('0x60')){_0x21c67c[_0x1949('0x61')](_0x5804c5[_0x2f0a25]['id']);}}}return _0x21c67c;};exports[_0x1949('0x62')]=function(_0x49d0be){var _0x3dceb0=moment()[_0x1949('0x8')](0x0);var _0x1d8595=moment(_0x49d0be)['milliseconds'](0x0);return _0x3dceb0[_0x1949('0x9')](_0x1d8595,'seconds');};exports[_0x1949('0x63')]=function(_0x421696){return{'active':![],'recallme':![],'UserId':null,'ContactId':_0x421696['ContactId'],'ListId':_0x421696['ListId'],'VoiceQueueId':_0x421696[_0x1949('0x64')]||undefined,'CampaignId':_0x421696['CampaignId']||undefined};};exports[_0x1949('0x65')]=function(_0x3bc001){if(_0x3bc001===_0x1949('0x5d')||_0x3bc001===_0x1949('0x66')||_0x3bc001==='queue'||_0x3bc001===_0x1949('0x67')||_0x3bc001===_0x1949('0x68')||_0x3bc001===_0x1949('0x69')||_0x3bc001===_0x1949('0x40')||_0x3bc001===_0x1949('0x46')||_0x3bc001===_0x1949('0x1c')||_0x3bc001===_0x1949('0x4e')||_0x3bc001===_0x1949('0x1d')||_0x3bc001==='scheduledat'||_0x3bc001===_0x1949('0x6a')||_0x3bc001==='countcongestionretry'||_0x3bc001==='countnoanswerretry'||_0x3bc001==='countglobal'||_0x3bc001===_0x1949('0x6b')||_0x3bc001==='callbackuniqueid'||_0x3bc001==='callbackat'||_0x3bc001===_0x1949('0x6c')||_0x3bc001===_0x1949('0x1e')||_0x3bc001===_0x1949('0x52')||_0x3bc001===_0x1949('0x6d')||_0x3bc001===_0x1949('0x64')||_0x3bc001===_0x1949('0x6e')||_0x3bc001===_0x1949('0x6f')||_0x3bc001===_0x1949('0x70')||_0x3bc001===_0x1949('0x71')||_0x3bc001===_0x1949('0x72')||_0x3bc001===_0x1949('0x73')||_0x3bc001===_0x1949('0x74')||_0x3bc001===_0x1949('0x75')||_0x3bc001===_0x1949('0x76')||_0x3bc001==='xmd-dialchannel'||_0x3bc001===_0x1949('0x77')||_0x3bc001==='xmd-cdrtype'||_0x3bc001===_0x1949('0x78')||_0x3bc001===_0x1949('0x79')||_0x3bc001===_0x1949('0x7a')||_0x3bc001===_0x1949('0x7b')||_0x3bc001==='rtpaudioqosbridged'||_0x3bc001==='rtpaudioqosjitter'||_0x3bc001===_0x1949('0x7c')||_0x3bc001===_0x1949('0x7d')||_0x3bc001===_0x1949('0x7e')||_0x3bc001===_0x1949('0x7f')||_0x3bc001===_0x1949('0x80')||_0x3bc001===_0x1949('0x7b')||_0x3bc001===_0x1949('0x81')||_0x3bc001===_0x1949('0x82')||_0x3bc001==='rtpaudioqosjitterbridged'||_0x3bc001===_0x1949('0x7d')||_0x3bc001==='rtpaudioqoslossbridged'||_0x3bc001==='rtpaudioqosrtt'||_0x3bc001===_0x1949('0x80')||_0x3bc001===_0x1949('0x83')||_0x3bc001===_0x1949('0x84')||_0x3bc001===_0x1949('0x37')||_0x3bc001===_0x1949('0x38')){return![];}return!![];};exports[_0x1949('0x85')]=function(_0x423664,_0x224d68){var _0x294f57,_0x4efa85,_0x104f3c;if(_0x224d68<=0x0){_0x224d68=0x1;}_0x294f57=new RegExp(_0x1949('0x86')+_0x224d68+'}$');_0x4efa85=Math[_0x1949('0x87')](0xa,_0x224d68-0x1);_0x104f3c=Math[_0x1949('0x87')](0xa,_0x224d68)-0x1;return util[_0x1949('0x16')]('%s',_[_0x1949('0x88')](_0x423664,_0x294f57,_[_0x1949('0x89')](_0x4efa85,_0x104f3c)));};exports[_0x1949('0x8a')]=function(_0x8d2df5){var _0x959152=_0x8d2df5['match'](/"(.*?)"/);return _0x959152?_0x959152[0x1]:_0x8d2df5;};exports[_0x1949('0x8b')]=function(_0x27a06a){var _0x3fd21f=_0x27a06a[_0x1949('0x8c')](/<(.*?)>/);return _0x3fd21f?_0x3fd21f[0x1]:_0x27a06a;}; \ No newline at end of file +var _0x2a96=['countcongestionretry','countnoanswerretry','cloneAction','clone','scheduledAt','scheduledat','add','minutes','ListId','decrementTalkink','[decrementTalkink]\x20object\x20talking\x20is\x20negative','queue','buildAcw','interface','agentReadyId','push','getDiff','CampaignId','campaigntype','dialAnswer','active','countglobal','callback','callbackuniqueid','recallme','sipcallid','xmd-queue','xmd-listid','xmd-dialurl','xmd-dialtimeout','xmd-dialoptions','xmd-dialid','xmd-dialchannel','xmd-cdrtype','xmd-agiafter','xmd-agi','rtpaudioqos','rtpaudioqosbridged','rtpaudioqosjitter','rtpaudioqosjitterbridged','rtpaudioqosloss','rtpaudioqoslossbridged','rtpaudioqosrtt','rtpaudioqosrttbridged','bridgepeer','getCallerIdRandom','\x5cw{0,','pow','replace','random','match','extractCalleridNumber','util','lodash','moment','../../../../config/logger','preview','XCALLY_IP_AGI','127.0.0.1','milliseconds','diff','seconds','error','inspect','logger','info','message','getCallerId','isUndefined','string','format','\x22%s\x22\x20<%s>','isEmpty','\x22\x22\x20<>','isActive','isNil','addVariables','Queue','name','ContactId','VoiceQueueId','dialOriginateTimeout','\x22rtTxX%s%s\x22','monitor_format','U(xcally-mixmonitor-context)','dialPreviewUrl','dialQueueProject','NONE','dialQueueProject2','\x22agi://%s/square,%s\x22','originatecalleridnum','xcally-motion-preview','_XCALLY_MIXMONITOR_FORMAT','Contact','hasOwnProperty','createdAt','%s%s','toUpper','toLowerVariables','toLower','updateOriginated','originated','[updateOriginated]\x20object\x20originated\x20is\x20negative','logBlacklist','YYYY-MM-DD\x20HH:mm:ss','statedesc','Blacklist','starttime','responsetime','endtime','logAgent','state','ringtime','logLookAgent','membername','UserId','logCustomer','talktime','answertime','isFailure','Failure','variablesAction','RECALL','calleridname','BOOKED','uniqueid','originate','channelAgent','calleridnum','from-sip','timeout','totalGlobal'];(function(_0x209941,_0x5c9988){var _0x1e8729=function(_0x51a9b8){while(--_0x51a9b8){_0x209941['push'](_0x209941['shift']());}};_0x1e8729(++_0x5c9988);}(_0x2a96,0xb8));var _0x62a9=function(_0x3c2318,_0x3c3687){_0x3c2318=_0x3c2318-0x0;var _0x4fc71f=_0x2a96[_0x3c2318];return _0x4fc71f;};'use strict';var util=require(_0x62a9('0x0'));var _=require(_0x62a9('0x1'));var moment=require(_0x62a9('0x2'));var logger=require(_0x62a9('0x3'))(_0x62a9('0x4'));var ipAgi=process['env'][_0x62a9('0x5')]||_0x62a9('0x6');function getSeconds(_0x45af96,_0x2a1b2b){var _0x354767=moment(_0x45af96)[_0x62a9('0x7')](0x0);var _0x40aee2=moment(_0x2a1b2b)['milliseconds'](0x0);return _0x354767[_0x62a9('0x8')](_0x40aee2,_0x62a9('0x9'));}exports['loggerCatch']=function(_0xe10a52){return function(_0x5b064e){logger[_0x62a9('0xa')](_0xe10a52,util[_0x62a9('0xb')](_0x5b064e,{'showHidden':![],'depth':null}));};};exports[_0x62a9('0xc')]=function(_0x1e4a39,_0x200118){logger[_0x62a9('0xd')](_0x1e4a39,util[_0x62a9('0xb')](_0x200118,{'showHidden':![],'depth':null}));};exports['loggerError']=function(_0x36be5d,_0x273ca5){logger[_0x62a9('0xa')](_0x36be5d,util[_0x62a9('0xb')](_0x273ca5,{'showHidden':![],'depth':null}));};exports['logger2']=function(_0x18f5e2){return function(_0x2f1756){logger[_0x62a9('0xd')](_0x18f5e2,util[_0x62a9('0xb')](_0x2f1756,{'showHidden':![],'depth':null}));};};exports[_0x62a9('0xe')]=function(_0x3530da,_0x19f7fb,_0x2e64f9){return{'message':_0x3530da,'unlock':_0x19f7fb,'active':_0x2e64f9};};exports[_0x62a9('0xf')]=function(_0x5526fe,_0x450811,_0x29e3c7){if(!_['isUndefined'](_0x29e3c7)&&'string'===typeof _0x29e3c7&&!_['isEmpty'](_0x29e3c7)){if(!_[_0x62a9('0x10')](_0x450811)&&_0x62a9('0x11')===typeof _0x450811&&!_['isEmpty'](_0x450811)){return util[_0x62a9('0x12')](_0x62a9('0x13'),_0x450811,_0x29e3c7);}return util['format'](_0x62a9('0x13'),_0x29e3c7,_0x29e3c7);}if(!_[_0x62a9('0x10')](_0x5526fe)&&_0x62a9('0x11')===typeof _0x5526fe&&!_[_0x62a9('0x14')](_0x5526fe)){return _0x5526fe;}return _0x62a9('0x15');};exports[_0x62a9('0x16')]=function(_0x566a7c){if(_[_0x62a9('0x17')](_0x566a7c)){return![];}return _0x566a7c;};exports[_0x62a9('0x18')]=function(_0x517642,_0x496708,_0x59cb9d,_0x5a9a13,_0xa6d1d6,_0x3b6deb){var _0x2e9b04={'XMD-QUEUE':_0x496708[_0x62a9('0x19')]?_0x496708[_0x62a9('0x19')][_0x62a9('0x1a')]:'','XMD-CALLERID':_0x5a9a13,'XMD-CALLERID-PREVIEW':_0x3b6deb?util[_0x62a9('0x12')](_0x62a9('0x13'),_0x3b6deb['calleridname'],_0x3b6deb['calleridnum']):_0x5a9a13,'XMD-DIALID':_0xa6d1d6,'XMD-CONTACTID':_0x496708[_0x62a9('0x1b')],'XMD-CDRTYPE':'dialer','CALLERID(all)':_0x5a9a13,'XMD-VOICEQUEUEID':_0x496708[_0x62a9('0x1c')],'XMD-DIALCHANNEL':_0x59cb9d,'XMD-DIALTIMEOUT':_0x517642[_0x62a9('0x1d')]||0x1e,'XMD-DIALOPTIONS':util[_0x62a9('0x12')](_0x62a9('0x1e'),_0x517642['dialQueueProject2']?'g':'',_[_0x62a9('0x14')](_0x517642[_0x62a9('0x1f')])?'':_0x62a9('0x20')),'XMD-DIALURL':_0x517642[_0x62a9('0x21')]||'','XMD-AGI':_0x517642[_0x62a9('0x22')]?util[_0x62a9('0x12')]('\x22agi://%s/square,%s\x22',ipAgi,_0x517642[_0x62a9('0x22')]):_0x62a9('0x23'),'XMD-AGIAFTER':_0x517642[_0x62a9('0x24')]?util['format'](_0x62a9('0x25'),ipAgi,_0x517642['dialQueueProject2']):_0x62a9('0x23'),'XMD-ORIGINATECALLERIDNUM':_0x3b6deb?_0x3b6deb[_0x62a9('0x26')]:'','XMD-ORIGINATECALLERIDNAME':_0x3b6deb?_0x3b6deb['originatecalleridname']:'','XMD-DESTINATION':_0x62a9('0x27')};if(!_[_0x62a9('0x14')](_0x517642[_0x62a9('0x1f')])){_0x2e9b04[util[_0x62a9('0x12')]('%s',_0x62a9('0x28'))]=_0x517642[_0x62a9('0x1f')];_0x2e9b04[util['format']('%s','_XCALLY_MIXMONITOR_UNIQUEID')]=_0xa6d1d6;}if(_0x496708&&_0x496708[_0x62a9('0x29')]){for(var _0x1105e4 in _0x496708[_0x62a9('0x29')]){if(_0x496708['Contact'][_0x62a9('0x2a')](_0x1105e4)){if(!_[_0x62a9('0x17')](_0x496708[_0x62a9('0x29')][_0x1105e4])&&_0x1105e4!=='id'&&_0x1105e4!=='tags'&&_0x1105e4!==_0x62a9('0x2b')&&_0x1105e4!=='updatedAt'){_0x2e9b04[util[_0x62a9('0x12')](_0x62a9('0x2c'),'XMD-',_[_0x62a9('0x2d')](_0x1105e4))]=_0x496708[_0x62a9('0x29')][_0x1105e4];}}}}return _0x2e9b04;};exports[_0x62a9('0x2e')]=function(_0x1e68db){var _0x57315d={};for(var _0x6b4499 in _0x1e68db){if(_0x1e68db[_0x62a9('0x2a')](_0x6b4499)){_0x57315d[util['format']('%s',_[_0x62a9('0x2f')](_0x6b4499))]=_0x1e68db[_0x6b4499];}}return{'variables':_0x57315d};};exports[_0x62a9('0x30')]=function(_0x1f65f4,_0x545aeb){if(!_['isNil'](_0x1f65f4)){if(_0x1f65f4['hasOwnProperty'](_0x62a9('0x31'))){if(_0x1f65f4[_0x62a9('0x31')]>0x0){_0x1f65f4[_0x62a9('0x31')]-=0x1;}else{logger[_0x62a9('0xa')](_0x62a9('0x32'),_0x545aeb);}}}else{logger[_0x62a9('0xa')]('[updateOriginated]\x20is\x20null\x20or\x20undefined',_0x545aeb);}};exports[_0x62a9('0x33')]=function(_0x10d7a8){var _0x1498aa=moment()[_0x62a9('0x12')](_0x62a9('0x34'));_0x10d7a8['state']=0xd;_0x10d7a8[_0x62a9('0x35')]=_0x62a9('0x36');_0x10d7a8[_0x62a9('0x37')]=_0x1498aa;_0x10d7a8[_0x62a9('0x38')]=_0x1498aa;_0x10d7a8[_0x62a9('0x39')]=_0x1498aa;};exports[_0x62a9('0x3a')]=function(_0x55829e,_0x539529,_0x3325ca){var _0x12b54a=moment()[_0x62a9('0x12')](_0x62a9('0x34'));_0x55829e[_0x62a9('0x3b')]=_0x539529;_0x55829e[_0x62a9('0x35')]=_0x3325ca;_0x55829e[_0x62a9('0x38')]=_0x12b54a;_0x55829e[_0x62a9('0x3c')]=getSeconds(_0x55829e[_0x62a9('0x38')],_0x55829e[_0x62a9('0x37')]);};exports[_0x62a9('0x3d')]=function(_0x5a0d9e,_0x4cff23,_0x1c8645){_0x5a0d9e[_0x62a9('0x3e')]=_0x4cff23;_0x5a0d9e[_0x62a9('0x3f')]=_0x1c8645;};exports[_0x62a9('0x40')]=function(_0x492c1f,_0x3ae4d1,_0x1eb718){var _0x13f29b=moment()['format'](_0x62a9('0x34'));_0x492c1f['state']=_0x3ae4d1;_0x492c1f[_0x62a9('0x35')]=_0x1eb718;_0x492c1f[_0x62a9('0x38')]=_0x492c1f[_0x62a9('0x38')]?_0x492c1f[_0x62a9('0x38')]:_0x13f29b;_0x492c1f[_0x62a9('0x39')]=_0x492c1f[_0x62a9('0x39')]?_0x492c1f['endtime']:_0x13f29b;_0x492c1f[_0x62a9('0x3c')]=getSeconds(_0x492c1f[_0x62a9('0x38')]||0x0,_0x492c1f[_0x62a9('0x37')]||0x0);_0x492c1f[_0x62a9('0x41')]=_0x492c1f[_0x62a9('0x42')]?getSeconds(_0x492c1f['endtime'],_0x492c1f['answertime']):0x0;};exports[_0x62a9('0x43')]=function(_0x457ec0){return _0x457ec0===_0x62a9('0x44');};exports[_0x62a9('0x45')]=function(_0x57b0cd,_0x576734,_0xb8aec8,_0x301018,_0x3488c1){var _0x45d4dd=_0x301018?_0x62a9('0x46'):_0x57b0cd[_0x62a9('0x47')];_0x45d4dd=_0x3488c1?_0x62a9('0x48'):_0x45d4dd;return{'actionid':_0x57b0cd[_0x62a9('0x49')],'action':_0x62a9('0x4a'),'channel':_0x57b0cd[_0x62a9('0x4b')],'callerid':util[_0x62a9('0x12')](_0x62a9('0x13'),_0x45d4dd,_0x57b0cd[_0x62a9('0x4c')]),'Exten':'xcally-motion-preview','Context':_0x62a9('0x4d'),'Priority':'1','variable':_0xb8aec8,'timeout':(_0x576734[_0x62a9('0x4e')]||0x1e)*0x3e8,'async':!![],'channelid':_0x57b0cd[_0x62a9('0x49')]};};exports[_0x62a9('0x4f')]=function(_0x5126e3){return _0x5126e3['countbusyretry']+_0x5126e3[_0x62a9('0x50')]+_0x5126e3[_0x62a9('0x51')];};exports[_0x62a9('0x52')]=function(_0x811eac){var _0x53bbfe=_[_0x62a9('0x53')](_0x811eac);_0x53bbfe[_0x62a9('0x3b')]=0xf;_0x53bbfe[_0x62a9('0x35')]='Global';return _0x53bbfe;};exports[_0x62a9('0x54')]=function(_0x21ff8c,_0x6875af,_0x1123c3){var _0x1cbe30={};_0x1cbe30[_0x6875af]=_0x21ff8c[_0x6875af];_0x1cbe30['active']=![];_0x1cbe30[_0x62a9('0x55')]=moment()[_0x62a9('0x56')](_0x1123c3,_0x62a9('0x57'))[_0x62a9('0x12')](_0x62a9('0x34'));_0x1cbe30[_0x62a9('0x1b')]=_0x21ff8c[_0x62a9('0x1b')];_0x1cbe30[_0x62a9('0x58')]=_0x21ff8c[_0x62a9('0x58')];_0x1cbe30[_0x62a9('0x1c')]=_0x21ff8c[_0x62a9('0x1c')]||undefined;return _0x1cbe30;};exports[_0x62a9('0x59')]=function(_0xe5f3e1,_0x4c96c9){if(!_[_0x62a9('0x17')](_0xe5f3e1)){if(_0xe5f3e1['pTalking']>0x0){_0xe5f3e1['pTalking']-=0x1;}else{logger[_0x62a9('0xa')](_0x4c96c9,_0x62a9('0x5a'));}}else{logger[_0x62a9('0xa')](_0x4c96c9,'[decrementTalkink]\x20is\x20null\x20or\x20undefined');}};exports['IsNotLoggedIn']=function(_0x3dad81){if(_0x3dad81<=0x0){return!![];}return![];};exports['buildObj']=function(_0x24aeeb,_0x4652dd){_0x24aeeb['lastevent']=_0x4652dd;_0x24aeeb['name']=_0x24aeeb[_0x62a9('0x5b')];_0x24aeeb['interface']=_0x24aeeb[_0x62a9('0x4b')];return _0x24aeeb;};exports[_0x62a9('0x5c')]=function(_0x16d2e0){var _0x2c099d={};_0x2c099d[_0x62a9('0x5b')]=_0x16d2e0[_0x62a9('0x5b')];_0x2c099d[_0x62a9('0x5d')]=_0x16d2e0[_0x62a9('0x4b')];_0x2c099d[_0x62a9('0x49')]=_0x16d2e0['uniqueid'];return _0x2c099d;};exports[_0x62a9('0x5e')]=function(_0x337305){var _0x13b544=[];for(var _0x314371 in _0x337305){if(_0x337305[_0x62a9('0x2a')](_0x314371)){if(!_[_0x62a9('0x17')](_0x337305[_0x314371])&&_0x337305[_0x314371][_0x62a9('0x3b')]==='not_inuse'&&_0x337305[_0x314371]['status']==='reachable'){_0x13b544[_0x62a9('0x5f')](_0x337305[_0x314371]['id']);}}}return _0x13b544;};exports[_0x62a9('0x60')]=function(_0x38fc4c){var _0x4e10a4=moment()[_0x62a9('0x7')](0x0);var _0x5dfcf6=moment(_0x38fc4c)[_0x62a9('0x7')](0x0);return _0x4e10a4['diff'](_0x5dfcf6,_0x62a9('0x9'));};exports['createBody']=function(_0x5001f6){return{'active':![],'recallme':![],'UserId':null,'ContactId':_0x5001f6[_0x62a9('0x1b')],'ListId':_0x5001f6[_0x62a9('0x58')],'VoiceQueueId':_0x5001f6[_0x62a9('0x1c')]||undefined,'CampaignId':_0x5001f6[_0x62a9('0x61')]||undefined};};exports['filterKey']=function(_0xde877c){if(_0xde877c==='uniqueid'||_0xde877c==='idContact'||_0xde877c===_0x62a9('0x5b')||_0xde877c==='type'||_0xde877c===_0x62a9('0x62')||_0xde877c===_0x62a9('0x63')||_0xde877c===_0x62a9('0x3e')||_0xde877c===_0x62a9('0x4b')||_0xde877c===_0x62a9('0x47')||_0xde877c===_0x62a9('0x64')||_0xde877c===_0x62a9('0x4c')||_0xde877c===_0x62a9('0x55')||_0xde877c==='countbusyretry'||_0xde877c===_0x62a9('0x50')||_0xde877c===_0x62a9('0x51')||_0xde877c===_0x62a9('0x65')||_0xde877c===_0x62a9('0x66')||_0xde877c===_0x62a9('0x67')||_0xde877c==='callbackat'||_0xde877c===_0x62a9('0x68')||_0xde877c===_0x62a9('0x1b')||_0xde877c===_0x62a9('0x58')||_0xde877c===_0x62a9('0x3f')||_0xde877c===_0x62a9('0x1c')||_0xde877c===_0x62a9('0x69')||_0xde877c==='xmd-voicequeueid'||_0xde877c===_0x62a9('0x6a')||_0xde877c==='xmd-phone'||_0xde877c===_0x62a9('0x6b')||_0xde877c===_0x62a9('0x6c')||_0xde877c===_0x62a9('0x6d')||_0xde877c===_0x62a9('0x6e')||_0xde877c===_0x62a9('0x6f')||_0xde877c===_0x62a9('0x70')||_0xde877c==='xmd-contactid'||_0xde877c===_0x62a9('0x71')||_0xde877c==='xmd-callerid'||_0xde877c===_0x62a9('0x72')||_0xde877c===_0x62a9('0x73')||_0xde877c===_0x62a9('0x74')||_0xde877c===_0x62a9('0x75')||_0xde877c===_0x62a9('0x76')||_0xde877c===_0x62a9('0x77')||_0xde877c===_0x62a9('0x78')||_0xde877c===_0x62a9('0x79')||_0xde877c===_0x62a9('0x7a')||_0xde877c===_0x62a9('0x7b')||_0xde877c===_0x62a9('0x74')||_0xde877c===_0x62a9('0x75')||_0xde877c==='rtpaudioqosjitter'||_0xde877c===_0x62a9('0x77')||_0xde877c===_0x62a9('0x78')||_0xde877c===_0x62a9('0x79')||_0xde877c===_0x62a9('0x7a')||_0xde877c==='rtpaudioqosrttbridged'||_0xde877c===_0x62a9('0x7c')||_0xde877c==='bridgepvtcallid'||_0xde877c===_0x62a9('0x3b')||_0xde877c===_0x62a9('0x35')){return![];}return!![];};exports[_0x62a9('0x7d')]=function(_0x4baf3b,_0x808128){var _0x1a3335,_0x1309aa,_0x5c873e;if(_0x808128<=0x0){_0x808128=0x1;}_0x1a3335=new RegExp(_0x62a9('0x7e')+_0x808128+'}$');_0x1309aa=Math[_0x62a9('0x7f')](0xa,_0x808128-0x1);_0x5c873e=Math[_0x62a9('0x7f')](0xa,_0x808128)-0x1;return util[_0x62a9('0x12')]('%s',_[_0x62a9('0x80')](_0x4baf3b,_0x1a3335,_[_0x62a9('0x81')](_0x1309aa,_0x5c873e)));};exports['extractCalleridName']=function(_0x152f7b){var _0x2fe6c3=_0x152f7b[_0x62a9('0x82')](/"(.*?)"/);return _0x2fe6c3?_0x2fe6c3[0x1]:_0x152f7b;};exports[_0x62a9('0x83')]=function(_0x55f499){var _0x4f20b3=_0x55f499[_0x62a9('0x82')](/<(.*?)>/);return _0x4f20b3?_0x4f20b3[0x1]:_0x55f499;}; \ No newline at end of file diff --git a/server/services/ami/properties.js b/server/services/ami/properties.js index cd51895..df0705e 100644 --- a/server/services/ami/properties.js +++ b/server/services/ami/properties.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xb10b=['voicequeuechannelhangup','queueadd','string','number','queueremove','queuepause','boolean','reload','voicechannel'];(function(_0x3f96f2,_0x21fd90){var _0x9902e4=function(_0x2a3c9f){while(--_0x2a3c9f){_0x3f96f2['push'](_0x3f96f2['shift']());}};_0x9902e4(++_0x21fd90);}(_0xb10b,0x12a));var _0xbb10=function(_0x116549,_0x210e8b){_0x116549=_0x116549-0x0;var _0x1321e5=_0xb10b[_0x116549];return _0x1321e5;};'use strict';exports[_0xbb10('0x0')]={'queue':{'type':'string','required':!![]},'interface':{'type':_0xbb10('0x1'),'required':!![]},'membername':{'type':_0xbb10('0x1'),'required':!![]},'penalty':{'type':_0xbb10('0x2'),'required':![]},'paused':{'type':'boolean','required':![]}};exports[_0xbb10('0x3')]={'queue':{'type':_0xbb10('0x1'),'required':!![]},'interface':{'type':_0xbb10('0x1'),'required':!![]}};exports[_0xbb10('0x4')]={'interface':{'type':_0xbb10('0x1'),'required':!![]},'paused':{'type':_0xbb10('0x5')},'reason':{'type':'string','required':![]}};exports[_0xbb10('0x6')]={'module':{'type':_0xbb10('0x1'),'required':![]}};exports['voicequeuechannel']={'uniqueid':{'type':_0xbb10('0x1'),'required':!![]}};exports[_0xbb10('0x7')]={'uniqueid':{'type':_0xbb10('0x1'),'required':!![]},'filename':{'type':_0xbb10('0x1')},'format':{'type':_0xbb10('0x1')},'mixmonitorid':{'type':_0xbb10('0x1')}};exports[_0xbb10('0x8')]={'uniqueid':{'type':_0xbb10('0x1'),'required':!![]}};exports['voicequeuechannelredirect']={'uniqueid':{'type':'string','required':!![]},'exten':{'type':_0xbb10('0x1'),'required':!![]},'context':{'type':_0xbb10('0x1')}}; \ No newline at end of file +var _0x5f2f=['number','boolean','queueremove','reload','voicequeuechannel','voicechannel','voicequeuechannelhangup','queueadd','string'];(function(_0x33385b,_0x2bcf28){var _0x573de9=function(_0x18ec14){while(--_0x18ec14){_0x33385b['push'](_0x33385b['shift']());}};_0x573de9(++_0x2bcf28);}(_0x5f2f,0x73));var _0xf5f2=function(_0x545bf9,_0x56874d){_0x545bf9=_0x545bf9-0x0;var _0xbfa504=_0x5f2f[_0x545bf9];return _0xbfa504;};'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 ba8942d..fe7c1a4 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 _0x1fe6=['agents','telephones','trunks','campaigns','templates','outbound','voiceExtensions','channels','queueChannels','timers','zendeskAccounts','salesforceAccounts','sugarcrmAccounts','freshdeskAccounts','zohoAccounts','servicenowAccounts','freshsalesAccounts','mapKeys','hasOwnProperty','format','SIP/%s','name','isNil','interface','total','sumHoldTime','sumDuration','sumBillable','isEmpty','ivrTotalCallsDays','unmanaged','abandoned','outboundAnswerAgiCallsDay','outboundNoAnswerCallsDay','outboundCongestionCallsDay','outboundNoSuchCallsDay','outboundUnknownCallsDay','outboundDropCallsDayTimeout','outboundBlacklistCallsDay','outboundRejectCallsDay','prototype','mergeFromDatabase','initAgents','length','initTelephones','initTrunks','initVoiceQueues','voiceQueues','isUndefined','initTriggers','triggers','initTemplates','initZendeskAccounts','initSalesforceAccounts','initFreshdeskAccounts','initZohoAccounts','initDeskAccounts','deskAccounts','initSugarcrmAccounts','vtigerAccounts','initServicenowAccounts','initDynamics365Accounts','dynamics365Accounts','initFreshsalesAccounts','initVoiceQueueHopperHistory','merge','initVoiceQueueReports','queue','queuecallerexit','queuecallerabandon','queuecallerleaveAt','diff','queuecallerjoinAt','seconds','queuecallercompleteAt','queuecallercomplete','answered','initVoiceCallReports','ANSWERED','duration','billableseconds','initCampaignHopperHistory','faxAccounts','bluebird','moment','../model/agent','../model/telephone','../model/voiceQueue','../model/trigger','../model/template','../model/campaign','../model/voiceExtension','../model/zendeskAccount','../model/salesforceAccount','../model/sugarcrmAccount','../model/zohoAccount','../model/deskAccount','../model/servicenowAccount','../model/dynamics365Account','../model/freshsalesAccount','../model/faxAccount'];(function(_0x9df060,_0x253d33){var _0x338dfe=function(_0x17d9a5){while(--_0x17d9a5){_0x9df060['push'](_0x9df060['shift']());}};_0x338dfe(++_0x253d33);}(_0x1fe6,0x11d));var _0x61fe=function(_0x2b7045,_0x591bb5){_0x2b7045=_0x2b7045-0x0;var _0x406451=_0x1fe6[_0x2b7045];return _0x406451;};'use strict';var BPromise=require(_0x61fe('0x0'));var util=require('util');var _=require('lodash');var moment=require(_0x61fe('0x1'));var Agent=require(_0x61fe('0x2'));var Telephone=require(_0x61fe('0x3'));var Trunk=require('../model/trunk');var VoiceQueue=require(_0x61fe('0x4'));var Trigger=require(_0x61fe('0x5'));var Template=require(_0x61fe('0x6'));var Campaign=require(_0x61fe('0x7'));var VoiceExtension=require(_0x61fe('0x8'));var ZendeskAccount=require(_0x61fe('0x9'));var SalesforceAccount=require(_0x61fe('0xa'));var FreshdeskAccount=require('../model/freshdeskAccount');var SugarcrmAccount=require(_0x61fe('0xb'));var ZohoAccount=require(_0x61fe('0xc'));var DeskAccount=require(_0x61fe('0xd'));var VtigerAccount=require('../model/vtigerAccount');var ServicenowAccount=require(_0x61fe('0xe'));var Dynamics365Account=require(_0x61fe('0xf'));var FreshsalesAccount=require(_0x61fe('0x10'));var FaxAccount=require(_0x61fe('0x11'));var Realtime=function(){this[_0x61fe('0x12')]={};this[_0x61fe('0x13')]={};this[_0x61fe('0x14')]={};this['voiceQueues']={};this['triggers']={};this[_0x61fe('0x15')]={};this[_0x61fe('0x16')]={};this[_0x61fe('0x17')]={'total':0x0,'answered':0x0,'sumHoldTime':0x0,'sumDuration':0x0,'sumBillable':0x0};this[_0x61fe('0x18')]={};this[_0x61fe('0x19')]={};this[_0x61fe('0x1a')]={};this['outboundChannels']={};this[_0x61fe('0x1b')]={};this[_0x61fe('0x1c')]={};this[_0x61fe('0x1d')]={};this[_0x61fe('0x1e')]={};this[_0x61fe('0x1f')]={};this[_0x61fe('0x20')]={};this['deskAccounts']={};this['vtigerAccounts']={};this[_0x61fe('0x21')]={};this['dynamics365Accounts']={};this[_0x61fe('0x22')]={};this['faxAccounts']={};};function freeIsNotKey(_0x4bbcea,_0x46b901,_0x38c0c8){var _0xcf2840=_[_0x61fe('0x23')](_0x4bbcea,function(_0x27214a,_0x33813e){return _0x27214a[_0x38c0c8];});for(var _0x4bea16 in _0x46b901){if(_0x46b901[_0x61fe('0x24')](_0x4bea16)){if(!_0xcf2840[_0x4bea16]){delete _0x46b901[_0x4bea16];}}}}function freeIsNotKeySip(_0x4ef0ca,_0x35c68d){var _0x59ba3d=_[_0x61fe('0x23')](_0x4ef0ca,function(_0x2cdd09,_0x509b4c){return util[_0x61fe('0x25')](_0x61fe('0x26'),_0x2cdd09[_0x61fe('0x27')]);});for(var _0x1b6ea5 in _0x35c68d){if(_0x35c68d[_0x61fe('0x24')](_0x1b6ea5)){if(!_0x59ba3d[_0x1b6ea5]){delete _0x35c68d[_0x1b6ea5];}}}}function freeIsNotKeyAgent(_0x2b0a36,_0x3ec92b){var _0x49517e=_[_0x61fe('0x23')](_0x2b0a36,function(_0x12ca49,_0x27f58c){var _0x4f81b3=_[_0x61fe('0x28')](_0x12ca49['interface'])?util['format'](_0x61fe('0x26'),_0x12ca49[_0x61fe('0x27')]):_0x12ca49[_0x61fe('0x29')];return _0x4f81b3;});for(var _0x496869 in _0x3ec92b){if(_0x3ec92b['hasOwnProperty'](_0x496869)){if(!_0x49517e[_0x496869]){delete _0x3ec92b[_0x496869];}}}}function clearVoiceCallReports(_0x48a4f6){_0x48a4f6[_0x61fe('0x2a')]=0x0;_0x48a4f6['answered']=0x0;_0x48a4f6[_0x61fe('0x2b')]=0x0;_0x48a4f6[_0x61fe('0x2c')]=0x0;_0x48a4f6[_0x61fe('0x2d')]=0x0;}function clearCampaigns(_0x1f26c9){if(!_[_0x61fe('0x2e')](_0x1f26c9)){for(var _0x2aeead in _0x1f26c9){if(_0x1f26c9[_0x61fe('0x24')](_0x2aeead)){_0x1f26c9[_0x2aeead][_0x61fe('0x2f')]=0x0;_0x1f26c9[_0x2aeead]['ivrAnswerCallsDay']=0x0;}}}}function clearVoiceQueues(_0x47a89d){if(!_['isEmpty'](_0x47a89d)){for(var _0x2bd46c in _0x47a89d){if(_0x47a89d[_0x61fe('0x24')](_0x2bd46c)){_0x47a89d[_0x2bd46c]['total']=0x0;_0x47a89d[_0x2bd46c]['answered']=0x0;_0x47a89d[_0x2bd46c][_0x61fe('0x30')]=0x0;_0x47a89d[_0x2bd46c][_0x61fe('0x31')]=0x0;_0x47a89d[_0x2bd46c][_0x61fe('0x2b')]=0x0;_0x47a89d[_0x2bd46c][_0x61fe('0x2c')]=0x0;_0x47a89d[_0x2bd46c][_0x61fe('0x2d')]=0x0;_0x47a89d[_0x2bd46c][_0x61fe('0x32')]=0x0;_0x47a89d[_0x2bd46c][_0x61fe('0x33')]=0x0;_0x47a89d[_0x2bd46c]['outboundBusyCallsDay']=0x0;_0x47a89d[_0x2bd46c][_0x61fe('0x34')]=0x0;_0x47a89d[_0x2bd46c][_0x61fe('0x35')]=0x0;_0x47a89d[_0x2bd46c][_0x61fe('0x36')]=0x0;_0x47a89d[_0x2bd46c][_0x61fe('0x37')]=0x0;_0x47a89d[_0x2bd46c]['outboundDropCallsDayCallersExit']=0x0;_0x47a89d[_0x2bd46c][_0x61fe('0x38')]=0x0;_0x47a89d[_0x2bd46c]['outboundOriginateFailureCallsDay']=0x0;_0x47a89d[_0x2bd46c][_0x61fe('0x39')]=0x0;_0x47a89d[_0x2bd46c]['outboundReCallsDay']=0x0;_0x47a89d[_0x2bd46c]['outboundAnswerAgiCallsDay']=0x0;_0x47a89d[_0x2bd46c]['outboundAnswerCallsDay']=0x0;_0x47a89d[_0x2bd46c]['queueStatusComplete']=!![];}}}}Realtime[_0x61fe('0x3a')][_0x61fe('0x3b')]=function(_0x4d22ca,_0x382cab){for(var _0x1ad63f in _0x382cab){if(_0x4d22ca[_0x61fe('0x24')](_0x1ad63f)){_0x4d22ca[_0x1ad63f]=_0x382cab[_0x1ad63f];}}};Realtime[_0x61fe('0x3a')][_0x61fe('0x3c')]=function(){var _0x233af4=this;return function(_0x1cce35){if(_0x1cce35){freeIsNotKeyAgent(_0x1cce35,_0x233af4[_0x61fe('0x12')]);for(var _0x3c48e1=0x0,_0x173afa={},_0x4e4e58={};_0x3c48e1<_0x1cce35[_0x61fe('0x3d')];_0x3c48e1+=0x1){_0x173afa=_0x1cce35[_0x3c48e1];var _0xe9f8f6=_['isNil'](_0x173afa[_0x61fe('0x29')])?util[_0x61fe('0x25')](_0x61fe('0x26'),_0x173afa['name']):_0x173afa[_0x61fe('0x29')];if(_['isUndefined'](_0x233af4[_0x61fe('0x12')][_0xe9f8f6])){_0x233af4['agents'][_0xe9f8f6]=new Agent(_0x173afa);}else{_0x233af4[_0x61fe('0x3b')](_0x233af4['agents'][_0xe9f8f6],_0x173afa);}}}return _0x233af4[_0x61fe('0x12')];};};Realtime[_0x61fe('0x3a')][_0x61fe('0x3e')]=function(){var _0x155a08=this;return function(_0x1ce82b){if(_0x1ce82b){freeIsNotKeySip(_0x1ce82b,_0x155a08['telephones']);for(var _0x11e18d=0x0,_0x52f252={},_0x180a4e={};_0x11e18d<_0x1ce82b[_0x61fe('0x3d')];_0x11e18d+=0x1){_0x52f252=_0x1ce82b[_0x11e18d];if(_['isUndefined'](_0x155a08[_0x61fe('0x13')][util[_0x61fe('0x25')]('SIP/%s',_0x52f252[_0x61fe('0x27')])])){_0x155a08[_0x61fe('0x13')][util[_0x61fe('0x25')](_0x61fe('0x26'),_0x52f252[_0x61fe('0x27')])]=new Telephone(_0x52f252);}else{_0x155a08[_0x61fe('0x3b')](_0x155a08[_0x61fe('0x13')][util[_0x61fe('0x25')]('SIP/%s',_0x52f252[_0x61fe('0x27')])],_0x52f252);}}}return _0x155a08[_0x61fe('0x13')];};};Realtime['prototype'][_0x61fe('0x3f')]=function(){var _0x4a23e5=this;return function(_0x5409f3){if(_0x5409f3){freeIsNotKeySip(_0x5409f3,_0x4a23e5['trunks']);for(var _0x3cd07f=0x0,_0x581a9a={},_0x16edf0={};_0x3cd07f<_0x5409f3['length'];_0x3cd07f+=0x1){_0x581a9a=_0x5409f3[_0x3cd07f];if(_['isUndefined'](_0x4a23e5[_0x61fe('0x14')][util[_0x61fe('0x25')](_0x61fe('0x26'),_0x581a9a[_0x61fe('0x27')])])){_0x4a23e5[_0x61fe('0x14')][util['format'](_0x61fe('0x26'),_0x581a9a[_0x61fe('0x27')])]=new Trunk(_0x581a9a);}else{_0x4a23e5[_0x61fe('0x3b')](_0x4a23e5['trunks'][util[_0x61fe('0x25')](_0x61fe('0x26'),_0x581a9a['name'])],_0x581a9a);}}}return _0x4a23e5[_0x61fe('0x14')];};};Realtime[_0x61fe('0x3a')][_0x61fe('0x40')]=function(){var _0x1a9c5c=this;return function(_0x209236){if(_0x209236){freeIsNotKey(_0x209236,_0x1a9c5c[_0x61fe('0x41')],_0x61fe('0x27'));for(var _0x554acc=0x0,_0x3c786e={},_0x3a8a82={};_0x554acc<_0x209236['length'];_0x554acc+=0x1){_0x3c786e=_0x209236[_0x554acc];if(_[_0x61fe('0x42')](_0x1a9c5c[_0x61fe('0x41')][_0x3c786e[_0x61fe('0x27')]])){_0x1a9c5c[_0x61fe('0x41')][_0x3c786e[_0x61fe('0x27')]]=new VoiceQueue(_0x3c786e);}else{_0x1a9c5c[_0x61fe('0x3b')](_0x1a9c5c['voiceQueues'][_0x3c786e[_0x61fe('0x27')]],_0x3c786e);}}}return _0x1a9c5c['voiceQueues'];};};Realtime[_0x61fe('0x3a')][_0x61fe('0x43')]=function(){var _0x58bd4b=this;return function(_0x1ed614){if(_0x1ed614){freeIsNotKey(_0x1ed614,_0x58bd4b[_0x61fe('0x44')],'id');for(var _0x205bfd=0x0,_0x55eda0={},_0x36aa83={};_0x205bfd<_0x1ed614[_0x61fe('0x3d')];_0x205bfd+=0x1){_0x55eda0=_0x1ed614[_0x205bfd];if(_[_0x61fe('0x42')](_0x58bd4b[_0x61fe('0x44')][_0x55eda0['id']])){_0x58bd4b[_0x61fe('0x44')][_0x55eda0['id']]=new Trigger(_0x55eda0);}else{_0x58bd4b['mergeFromDatabase'](_0x58bd4b[_0x61fe('0x44')][_0x55eda0['id']],_0x55eda0);}}}return _0x58bd4b['triggers'];};};Realtime['prototype'][_0x61fe('0x45')]=function(){var _0x3779ff=this;return function(_0x30dfec){if(_0x30dfec){freeIsNotKey(_0x30dfec,_0x3779ff[_0x61fe('0x16')],'id');for(var _0x313df7=0x0,_0x4267bd={},_0x309214={};_0x313df7<_0x30dfec[_0x61fe('0x3d')];_0x313df7+=0x1){_0x4267bd=_0x30dfec[_0x313df7];if(_[_0x61fe('0x42')](_0x3779ff[_0x61fe('0x16')][_0x4267bd['id']])){_0x3779ff['templates'][_0x4267bd['id']]=new Template(_0x4267bd);}else{_0x3779ff[_0x61fe('0x3b')](_0x3779ff[_0x61fe('0x16')][_0x4267bd['id']],_0x4267bd);}}}return _0x3779ff[_0x61fe('0x16')];};};Realtime[_0x61fe('0x3a')][_0x61fe('0x46')]=function(){var _0x4804b1=this;return function(_0x13eeae){if(_0x13eeae){freeIsNotKey(_0x13eeae,_0x4804b1[_0x61fe('0x1c')],'id');for(var _0x38ed16=0x0,_0xc44ae2={},_0x260762={};_0x38ed16<_0x13eeae[_0x61fe('0x3d')];_0x38ed16+=0x1){_0xc44ae2=_0x13eeae[_0x38ed16];if(_[_0x61fe('0x42')](_0x4804b1[_0x61fe('0x1c')][_0xc44ae2['id']])){_0x4804b1[_0x61fe('0x1c')][_0xc44ae2['id']]=new ZendeskAccount(_0xc44ae2);}else{_0x4804b1[_0x61fe('0x3b')](_0x4804b1[_0x61fe('0x1c')][_0xc44ae2['id']],_0xc44ae2);}}}return _0x4804b1[_0x61fe('0x1c')];};};Realtime[_0x61fe('0x3a')][_0x61fe('0x47')]=function(){var _0x3e19a2=this;return function(_0x19d7f4){if(_0x19d7f4){freeIsNotKey(_0x19d7f4,_0x3e19a2[_0x61fe('0x1d')],'id');for(var _0xd4cf8d=0x0,_0x43b2be={},_0x4f1912={};_0xd4cf8d<_0x19d7f4[_0x61fe('0x3d')];_0xd4cf8d+=0x1){_0x43b2be=_0x19d7f4[_0xd4cf8d];if(_[_0x61fe('0x42')](_0x3e19a2[_0x61fe('0x1d')][_0x43b2be['id']])){_0x3e19a2[_0x61fe('0x1d')][_0x43b2be['id']]=new SalesforceAccount(_0x43b2be);}else{_0x3e19a2[_0x61fe('0x3b')](_0x3e19a2[_0x61fe('0x1d')][_0x43b2be['id']],_0x43b2be);}}}return _0x3e19a2[_0x61fe('0x1d')];};};Realtime[_0x61fe('0x3a')][_0x61fe('0x48')]=function(){var _0x1d7c71=this;return function(_0x45133a){if(_0x45133a){freeIsNotKey(_0x45133a,_0x1d7c71['freshdeskAccounts'],'id');for(var _0x43785a=0x0,_0x207743={},_0x49f37f={};_0x43785a<_0x45133a[_0x61fe('0x3d')];_0x43785a+=0x1){_0x207743=_0x45133a[_0x43785a];if(_[_0x61fe('0x42')](_0x1d7c71[_0x61fe('0x1f')][_0x207743['id']])){_0x1d7c71[_0x61fe('0x1f')][_0x207743['id']]=new FreshdeskAccount(_0x207743);}else{_0x1d7c71['mergeFromDatabase'](_0x1d7c71['freshdeskAccounts'][_0x207743['id']],_0x207743);}}}return _0x1d7c71[_0x61fe('0x1f')];};};Realtime[_0x61fe('0x3a')][_0x61fe('0x49')]=function(){var _0x55d23a=this;return function(_0x4cc1be){if(_0x4cc1be){freeIsNotKey(_0x4cc1be,_0x55d23a['zohoAccounts'],'id');for(var _0x2b94de=0x0,_0x39c9a6={},_0x84ed24={};_0x2b94de<_0x4cc1be[_0x61fe('0x3d')];_0x2b94de+=0x1){_0x39c9a6=_0x4cc1be[_0x2b94de];if(_['isUndefined'](_0x55d23a[_0x61fe('0x20')][_0x39c9a6['id']])){_0x55d23a[_0x61fe('0x20')][_0x39c9a6['id']]=new ZohoAccount(_0x39c9a6);}else{_0x55d23a[_0x61fe('0x3b')](_0x55d23a[_0x61fe('0x20')][_0x39c9a6['id']],_0x39c9a6);}}}return _0x55d23a[_0x61fe('0x20')];};};Realtime['prototype'][_0x61fe('0x4a')]=function(){var _0x15ef58=this;return function(_0x260893){if(_0x260893){freeIsNotKey(_0x260893,_0x15ef58[_0x61fe('0x4b')],'id');for(var _0x1bd38f=0x0,_0x313d66={},_0x2a904b={};_0x1bd38f<_0x260893['length'];_0x1bd38f+=0x1){_0x313d66=_0x260893[_0x1bd38f];if(_[_0x61fe('0x42')](_0x15ef58[_0x61fe('0x4b')][_0x313d66['id']])){_0x15ef58[_0x61fe('0x4b')][_0x313d66['id']]=new DeskAccount(_0x313d66);}else{_0x15ef58['mergeFromDatabase'](_0x15ef58['deskAccounts'][_0x313d66['id']],_0x313d66);}}}return _0x15ef58[_0x61fe('0x4b')];};};Realtime[_0x61fe('0x3a')][_0x61fe('0x4c')]=function(){var _0x3ee32a=this;return function(_0x3a4cc6){if(_0x3a4cc6){freeIsNotKey(_0x3a4cc6,_0x3ee32a[_0x61fe('0x1e')],'id');for(var _0x36524c=0x0,_0x280bb3={},_0x129f04={};_0x36524c<_0x3a4cc6[_0x61fe('0x3d')];_0x36524c+=0x1){_0x280bb3=_0x3a4cc6[_0x36524c];if(_['isUndefined'](_0x3ee32a[_0x61fe('0x1e')][_0x280bb3['id']])){_0x3ee32a['sugarcrmAccounts'][_0x280bb3['id']]=new SugarcrmAccount(_0x280bb3);}else{_0x3ee32a[_0x61fe('0x3b')](_0x3ee32a[_0x61fe('0x1e')][_0x280bb3['id']],_0x280bb3);}}}return _0x3ee32a[_0x61fe('0x1e')];};};Realtime[_0x61fe('0x3a')]['initVtigerAccounts']=function(){var _0x297221=this;return function(_0xd12bb3){if(_0xd12bb3){freeIsNotKey(_0xd12bb3,_0x297221['vtigerAccounts'],'id');for(var _0x40e45b=0x0,_0x1e961b={},_0x489f70={};_0x40e45b<_0xd12bb3[_0x61fe('0x3d')];_0x40e45b+=0x1){_0x1e961b=_0xd12bb3[_0x40e45b];if(_[_0x61fe('0x42')](_0x297221[_0x61fe('0x4d')][_0x1e961b['id']])){_0x297221[_0x61fe('0x4d')][_0x1e961b['id']]=new VtigerAccount(_0x1e961b);}else{_0x297221[_0x61fe('0x3b')](_0x297221[_0x61fe('0x4d')][_0x1e961b['id']],_0x1e961b);}}}return _0x297221[_0x61fe('0x4d')];};};Realtime['prototype'][_0x61fe('0x4e')]=function(){var _0x31f8f7=this;return function(_0x389520){if(_0x389520){freeIsNotKey(_0x389520,_0x31f8f7[_0x61fe('0x21')],'id');for(var _0x1cf2ac=0x0,_0x31d022={},_0x254baf={};_0x1cf2ac<_0x389520[_0x61fe('0x3d')];_0x1cf2ac+=0x1){_0x31d022=_0x389520[_0x1cf2ac];if(_[_0x61fe('0x42')](_0x31f8f7[_0x61fe('0x21')][_0x31d022['id']])){_0x31f8f7[_0x61fe('0x21')][_0x31d022['id']]=new ServicenowAccount(_0x31d022);}else{_0x31f8f7[_0x61fe('0x3b')](_0x31f8f7[_0x61fe('0x21')][_0x31d022['id']],_0x31d022);}}}return _0x31f8f7[_0x61fe('0x21')];};};Realtime[_0x61fe('0x3a')][_0x61fe('0x4f')]=function(){var _0x2b9f05=this;return function(_0x173e08){if(_0x173e08){freeIsNotKey(_0x173e08,_0x2b9f05[_0x61fe('0x50')],'id');for(var _0x2da9eb=0x0,_0x2f9343={},_0x3ec271={};_0x2da9eb<_0x173e08[_0x61fe('0x3d')];_0x2da9eb+=0x1){_0x2f9343=_0x173e08[_0x2da9eb];if(_[_0x61fe('0x42')](_0x2b9f05['dynamics365Accounts'][_0x2f9343['id']])){_0x2b9f05[_0x61fe('0x50')][_0x2f9343['id']]=new Dynamics365Account(_0x2f9343);}else{_0x2b9f05[_0x61fe('0x3b')](_0x2b9f05['dynamics365Accounts'][_0x2f9343['id']],_0x2f9343);}}}return _0x2b9f05[_0x61fe('0x50')];};};Realtime[_0x61fe('0x3a')][_0x61fe('0x51')]=function(){var _0x2b70d9=this;return function(_0x517bc5){if(_0x517bc5){freeIsNotKey(_0x517bc5,_0x2b70d9[_0x61fe('0x22')],'id');for(var _0x109b19=0x0,_0x494fa5={},_0x375f56={};_0x109b19<_0x517bc5[_0x61fe('0x3d')];_0x109b19+=0x1){_0x494fa5=_0x517bc5[_0x109b19];if(_['isUndefined'](_0x2b70d9[_0x61fe('0x22')][_0x494fa5['id']])){_0x2b70d9[_0x61fe('0x22')][_0x494fa5['id']]=new FreshsalesAccount(_0x494fa5);}else{_0x2b70d9[_0x61fe('0x3b')](_0x2b70d9[_0x61fe('0x22')][_0x494fa5['id']],_0x494fa5);}}}return _0x2b70d9['freshsalesAccounts'];};};Realtime[_0x61fe('0x3a')][_0x61fe('0x52')]=function(){var _0x258c1c=this;return function(_0x33684f){for(var _0x10d23c=0x0;_0x10d23c<_0x33684f[_0x61fe('0x3d')];_0x10d23c+=0x1){_[_0x61fe('0x53')](_0x258c1c['voiceQueues'][_0x33684f[_0x10d23c][_0x61fe('0x27')]],_0x33684f[_0x10d23c]);}return _0x258c1c[_0x61fe('0x41')];};};Realtime['prototype'][_0x61fe('0x54')]=function(){var _0x995f9c=this;return function(_0x36398d){clearVoiceQueues(_0x995f9c[_0x61fe('0x41')]);if(_0x36398d){_0x36398d=_['groupBy'](_0x36398d,'uniqueid');for(var _0x57af05 in _0x36398d){if(_0x36398d[_0x61fe('0x24')](_0x57af05)){var _0x31a0b9={};for(var _0x1757ce=0x0;_0x1757ce<_0x36398d[_0x57af05]['length'];_0x1757ce+=0x1){var _0x199b09=_0x36398d[_0x57af05][_0x1757ce][_0x61fe('0x55')];if(_0x995f9c[_0x61fe('0x41')][_0x199b09]){if(_0x36398d[_0x57af05][_0x1757ce][_0x61fe('0x56')]){_0x995f9c[_0x61fe('0x41')][_0x199b09][_0x61fe('0x30')]+=0x1;}if(_0x36398d[_0x57af05][_0x1757ce][_0x61fe('0x57')]){_0x995f9c[_0x61fe('0x41')][_0x199b09][_0x61fe('0x31')]+=0x1;}_0x995f9c[_0x61fe('0x41')][_0x199b09][_0x61fe('0x2b')]+=moment(_0x36398d[_0x57af05][_0x1757ce][_0x61fe('0x58')])[_0x61fe('0x59')](moment(_0x36398d[_0x57af05][_0x1757ce][_0x61fe('0x5a')]),_0x61fe('0x5b'))||0x0;if(_0x1757ce===_0x36398d[_0x57af05][_0x61fe('0x3d')]-0x1){_0x995f9c['voiceQueues'][_0x199b09][_0x61fe('0x2c')]+=moment(_0x36398d[_0x57af05][_0x1757ce][_0x61fe('0x5c')]||_0x36398d[_0x57af05][_0x1757ce]['queuecallerabandonAt']||_0x36398d[_0x57af05][_0x1757ce]['queuecallerexitAt'])[_0x61fe('0x59')](moment(_0x36398d[_0x57af05][_0x1757ce][_0x61fe('0x5a')]),_0x61fe('0x5b'))||0x0;_0x995f9c[_0x61fe('0x41')][_0x199b09]['total']+=0x1;if(_0x36398d[_0x57af05][_0x1757ce][_0x61fe('0x5d')]){_0x995f9c[_0x61fe('0x41')][_0x199b09][_0x61fe('0x5e')]+=0x1;_0x995f9c['voiceQueues'][_0x199b09][_0x61fe('0x2d')]+=moment(_0x36398d[_0x57af05][_0x1757ce][_0x61fe('0x5c')])['diff'](moment(_0x36398d[_0x57af05][_0x1757ce][_0x61fe('0x58')]),'seconds')||0x0;}}else{_0x995f9c[_0x61fe('0x41')][_0x199b09][_0x61fe('0x2c')]+=_0x995f9c[_0x61fe('0x41')][_0x199b09][_0x61fe('0x2b')]||0x0;}}}}}}return _0x995f9c[_0x61fe('0x41')];};};Realtime['prototype'][_0x61fe('0x5f')]=function(){var _0x37fd88=this;return function(_0x1a4be4){clearVoiceCallReports(_0x37fd88[_0x61fe('0x17')]);if(_0x1a4be4){for(var _0x4d616f=0x0;_0x4d616f<_0x1a4be4['length'];_0x4d616f+=0x1){_0x37fd88[_0x61fe('0x17')]['total']+=0x1;_0x37fd88['outbound'][_0x61fe('0x2c')]+=_0x1a4be4[_0x4d616f]['duration'];if(_0x1a4be4[_0x4d616f]['disposition']===_0x61fe('0x60')){_0x37fd88[_0x61fe('0x17')][_0x61fe('0x5e')]+=0x1;_0x37fd88[_0x61fe('0x17')][_0x61fe('0x2b')]+=_0x1a4be4[_0x4d616f][_0x61fe('0x61')]-_0x1a4be4[_0x4d616f][_0x61fe('0x62')]||0x0;_0x37fd88[_0x61fe('0x17')][_0x61fe('0x2d')]+=_0x1a4be4[_0x4d616f][_0x61fe('0x62')];}}}return _0x37fd88[_0x61fe('0x17')];};};Realtime[_0x61fe('0x3a')]['initCampaigns']=function(){var _0x3600f5=this;return function(_0x45c1f8){if(_0x45c1f8){freeIsNotKey(_0x45c1f8,_0x3600f5[_0x61fe('0x15')],_0x61fe('0x27'));for(var _0x4dc8d6=0x0,_0x2e0384={};_0x4dc8d6<_0x45c1f8[_0x61fe('0x3d')];_0x4dc8d6+=0x1){_0x2e0384=_0x45c1f8[_0x4dc8d6];if(_[_0x61fe('0x42')](_0x3600f5['campaigns'][_0x2e0384[_0x61fe('0x27')]])){_0x3600f5[_0x61fe('0x15')][_0x2e0384['name']]=new Campaign(_0x2e0384);}else{_0x3600f5[_0x61fe('0x3b')](_0x3600f5[_0x61fe('0x15')][_0x2e0384[_0x61fe('0x27')]],_0x2e0384);}}}return _0x3600f5[_0x61fe('0x15')];};};Realtime['prototype']['initVoiceExtensions']=function(){var _0x2c48da=this;return function(_0x183e50){if(_0x183e50){freeIsNotKey(_0x183e50,_0x2c48da[_0x61fe('0x18')],'id');for(var _0x2900b4=0x0,_0x56cf8b={};_0x2900b4<_0x183e50[_0x61fe('0x3d')];_0x2900b4+=0x1){_0x56cf8b=_0x183e50[_0x2900b4];if(_[_0x61fe('0x42')](_0x2c48da[_0x61fe('0x18')][_0x56cf8b['id']])){_0x2c48da['voiceExtensions'][_0x56cf8b['id']]=new VoiceExtension(_0x56cf8b);}else{_0x2c48da[_0x61fe('0x3b')](_0x2c48da[_0x61fe('0x18')][_0x56cf8b['id']],_0x56cf8b);}}}return _0x2c48da['voiceExtensions'];};};Realtime[_0x61fe('0x3a')][_0x61fe('0x63')]=function(){var _0x5ddf97=this;return function(_0x4cde3a){clearCampaigns(_0x5ddf97[_0x61fe('0x15')]);for(var _0x26e0a5=0x0;_0x26e0a5<_0x4cde3a[_0x61fe('0x3d')];_0x26e0a5+=0x1){_['merge'](_0x5ddf97['campaigns'][_0x4cde3a[_0x26e0a5][_0x61fe('0x27')]],_0x4cde3a[_0x26e0a5]);}return _0x5ddf97[_0x61fe('0x15')];};};Realtime[_0x61fe('0x3a')]['initFaxAccounts']=function(){var _0x202928=this;return function(_0x21e146){if(_0x21e146){freeIsNotKey(_0x21e146,_0x202928['faxAccounts'],'id');for(var _0x495ffe=0x0,_0x16a1e4={},_0x2ff51a={};_0x495ffe<_0x21e146[_0x61fe('0x3d')];_0x495ffe+=0x1){_0x16a1e4=_0x21e146[_0x495ffe];if(_['isUndefined'](_0x202928['faxAccounts'][_0x16a1e4['id']])){_0x202928[_0x61fe('0x64')][_0x16a1e4['id']]=new FaxAccount(_0x16a1e4);}else{_0x202928[_0x61fe('0x3b')](_0x202928[_0x61fe('0x64')][_0x16a1e4['id']],_0x16a1e4);}}}return _0x202928[_0x61fe('0x64')];};};module['exports']=Realtime; \ No newline at end of file +var _0x89f9=['mapKeys','format','SIP/%s','name','hasOwnProperty','isNil','interface','total','answered','sumHoldTime','sumDuration','sumBillable','isEmpty','ivrTotalCallsDays','ivrAnswerCallsDay','unmanaged','outboundAnswerAgiCallsDay','outboundBusyCallsDay','outboundCongestionCallsDay','outboundNoSuchCallsDay','outboundUnknownCallsDay','outboundDropCallsDayCallersExit','outboundBlacklistCallsDay','outboundOriginateFailureCallsDay','outboundRejectCallsDay','outboundReCallsDay','outboundAnswerCallsDay','initAgents','length','isUndefined','mergeFromDatabase','prototype','initTelephones','initVoiceQueues','initTriggers','triggers','initTemplates','initZendeskAccounts','initSalesforceAccounts','initFreshdeskAccounts','initZohoAccounts','zohoAccounts','initDeskAccounts','initSugarcrmAccounts','sugarcrmAccounts','initVtigerAccounts','initServicenowAccounts','servicenowAccounts','initDynamics365Accounts','initFreshsalesAccounts','initVoiceQueueHopperHistory','merge','initVoiceQueueReports','groupBy','uniqueid','queue','queuecallerexit','queuecallerabandon','queuecallerleaveAt','diff','queuecallerjoinAt','queuecallercompleteAt','queuecallerabandonAt','queuecallerexitAt','seconds','queuecallercomplete','initVoiceCallReports','outbound','duration','billableseconds','initCampaigns','initVoiceExtensions','initCampaignHopperHistory','initFaxAccounts','exports','bluebird','util','moment','../model/agent','../model/telephone','../model/campaign','../model/salesforceAccount','../model/sugarcrmAccount','../model/zohoAccount','../model/deskAccount','../model/vtigerAccount','../model/freshsalesAccount','../model/faxAccount','agents','telephones','trunks','voiceQueues','campaigns','templates','voiceExtensions','channels','queueChannels','outboundChannels','timers','zendeskAccounts','salesforceAccounts','freshdeskAccounts','deskAccounts','vtigerAccounts','dynamics365Accounts','freshsalesAccounts','faxAccounts'];(function(_0x47adb8,_0x591ccc){var _0x4689a8=function(_0x2ba76f){while(--_0x2ba76f){_0x47adb8['push'](_0x47adb8['shift']());}};_0x4689a8(++_0x591ccc);}(_0x89f9,0x121));var _0x989f=function(_0xf89ebe,_0x137b41){_0xf89ebe=_0xf89ebe-0x0;var _0x2e9def=_0x89f9[_0xf89ebe];return _0x2e9def;};'use strict';var BPromise=require(_0x989f('0x0'));var util=require(_0x989f('0x1'));var _=require('lodash');var moment=require(_0x989f('0x2'));var Agent=require(_0x989f('0x3'));var Telephone=require(_0x989f('0x4'));var Trunk=require('../model/trunk');var VoiceQueue=require('../model/voiceQueue');var Trigger=require('../model/trigger');var Template=require('../model/template');var Campaign=require(_0x989f('0x5'));var VoiceExtension=require('../model/voiceExtension');var ZendeskAccount=require('../model/zendeskAccount');var SalesforceAccount=require(_0x989f('0x6'));var FreshdeskAccount=require('../model/freshdeskAccount');var SugarcrmAccount=require(_0x989f('0x7'));var ZohoAccount=require(_0x989f('0x8'));var DeskAccount=require(_0x989f('0x9'));var VtigerAccount=require(_0x989f('0xa'));var ServicenowAccount=require('../model/servicenowAccount');var Dynamics365Account=require('../model/dynamics365Account');var FreshsalesAccount=require(_0x989f('0xb'));var FaxAccount=require(_0x989f('0xc'));var Realtime=function(){this[_0x989f('0xd')]={};this[_0x989f('0xe')]={};this[_0x989f('0xf')]={};this[_0x989f('0x10')]={};this['triggers']={};this[_0x989f('0x11')]={};this[_0x989f('0x12')]={};this['outbound']={'total':0x0,'answered':0x0,'sumHoldTime':0x0,'sumDuration':0x0,'sumBillable':0x0};this[_0x989f('0x13')]={};this[_0x989f('0x14')]={};this[_0x989f('0x15')]={};this[_0x989f('0x16')]={};this[_0x989f('0x17')]={};this[_0x989f('0x18')]={};this[_0x989f('0x19')]={};this['sugarcrmAccounts']={};this[_0x989f('0x1a')]={};this['zohoAccounts']={};this[_0x989f('0x1b')]={};this[_0x989f('0x1c')]={};this['servicenowAccounts']={};this[_0x989f('0x1d')]={};this[_0x989f('0x1e')]={};this[_0x989f('0x1f')]={};};function freeIsNotKey(_0x2b0a3d,_0x181788,_0x1afc09){var _0x56de5c=_[_0x989f('0x20')](_0x2b0a3d,function(_0x4ce107,_0x1cf8e9){return _0x4ce107[_0x1afc09];});for(var _0x5a91e4 in _0x181788){if(_0x181788['hasOwnProperty'](_0x5a91e4)){if(!_0x56de5c[_0x5a91e4]){delete _0x181788[_0x5a91e4];}}}}function freeIsNotKeySip(_0x3aff83,_0x53e8cd){var _0xb64c8f=_[_0x989f('0x20')](_0x3aff83,function(_0x524abb,_0x4c4b02){return util[_0x989f('0x21')](_0x989f('0x22'),_0x524abb[_0x989f('0x23')]);});for(var _0xd734f in _0x53e8cd){if(_0x53e8cd[_0x989f('0x24')](_0xd734f)){if(!_0xb64c8f[_0xd734f]){delete _0x53e8cd[_0xd734f];}}}}function freeIsNotKeyAgent(_0x102207,_0x2d989c){var _0x144eb9=_[_0x989f('0x20')](_0x102207,function(_0x52ff28,_0x4fb560){var _0x353da3=_[_0x989f('0x25')](_0x52ff28[_0x989f('0x26')])?util['format'](_0x989f('0x22'),_0x52ff28[_0x989f('0x23')]):_0x52ff28[_0x989f('0x26')];return _0x353da3;});for(var _0x117b1e in _0x2d989c){if(_0x2d989c['hasOwnProperty'](_0x117b1e)){if(!_0x144eb9[_0x117b1e]){delete _0x2d989c[_0x117b1e];}}}}function clearVoiceCallReports(_0x482c97){_0x482c97[_0x989f('0x27')]=0x0;_0x482c97[_0x989f('0x28')]=0x0;_0x482c97[_0x989f('0x29')]=0x0;_0x482c97[_0x989f('0x2a')]=0x0;_0x482c97[_0x989f('0x2b')]=0x0;}function clearCampaigns(_0x341d41){if(!_[_0x989f('0x2c')](_0x341d41)){for(var _0xefd3c5 in _0x341d41){if(_0x341d41[_0x989f('0x24')](_0xefd3c5)){_0x341d41[_0xefd3c5][_0x989f('0x2d')]=0x0;_0x341d41[_0xefd3c5][_0x989f('0x2e')]=0x0;}}}}function clearVoiceQueues(_0xf671b5){if(!_[_0x989f('0x2c')](_0xf671b5)){for(var _0x2f23c7 in _0xf671b5){if(_0xf671b5[_0x989f('0x24')](_0x2f23c7)){_0xf671b5[_0x2f23c7][_0x989f('0x27')]=0x0;_0xf671b5[_0x2f23c7]['answered']=0x0;_0xf671b5[_0x2f23c7][_0x989f('0x2f')]=0x0;_0xf671b5[_0x2f23c7]['abandoned']=0x0;_0xf671b5[_0x2f23c7][_0x989f('0x29')]=0x0;_0xf671b5[_0x2f23c7][_0x989f('0x2a')]=0x0;_0xf671b5[_0x2f23c7]['sumBillable']=0x0;_0xf671b5[_0x2f23c7][_0x989f('0x30')]=0x0;_0xf671b5[_0x2f23c7]['outboundNoAnswerCallsDay']=0x0;_0xf671b5[_0x2f23c7][_0x989f('0x31')]=0x0;_0xf671b5[_0x2f23c7][_0x989f('0x32')]=0x0;_0xf671b5[_0x2f23c7][_0x989f('0x33')]=0x0;_0xf671b5[_0x2f23c7][_0x989f('0x34')]=0x0;_0xf671b5[_0x2f23c7]['outboundDropCallsDayTimeout']=0x0;_0xf671b5[_0x2f23c7][_0x989f('0x35')]=0x0;_0xf671b5[_0x2f23c7][_0x989f('0x36')]=0x0;_0xf671b5[_0x2f23c7][_0x989f('0x37')]=0x0;_0xf671b5[_0x2f23c7][_0x989f('0x38')]=0x0;_0xf671b5[_0x2f23c7][_0x989f('0x39')]=0x0;_0xf671b5[_0x2f23c7]['outboundAnswerAgiCallsDay']=0x0;_0xf671b5[_0x2f23c7][_0x989f('0x3a')]=0x0;_0xf671b5[_0x2f23c7]['queueStatusComplete']=!![];}}}}Realtime['prototype']['mergeFromDatabase']=function(_0x367c14,_0x45fe2e){for(var _0x154ca0 in _0x45fe2e){if(_0x367c14['hasOwnProperty'](_0x154ca0)){_0x367c14[_0x154ca0]=_0x45fe2e[_0x154ca0];}}};Realtime['prototype'][_0x989f('0x3b')]=function(){var _0x1f20ad=this;return function(_0x5e3809){if(_0x5e3809){freeIsNotKeyAgent(_0x5e3809,_0x1f20ad[_0x989f('0xd')]);for(var _0x550025=0x0,_0xa36a8e={},_0x4eccfd={};_0x550025<_0x5e3809[_0x989f('0x3c')];_0x550025+=0x1){_0xa36a8e=_0x5e3809[_0x550025];var _0x19bb0e=_[_0x989f('0x25')](_0xa36a8e['interface'])?util['format'](_0x989f('0x22'),_0xa36a8e['name']):_0xa36a8e[_0x989f('0x26')];if(_[_0x989f('0x3d')](_0x1f20ad[_0x989f('0xd')][_0x19bb0e])){_0x1f20ad[_0x989f('0xd')][_0x19bb0e]=new Agent(_0xa36a8e);}else{_0x1f20ad[_0x989f('0x3e')](_0x1f20ad[_0x989f('0xd')][_0x19bb0e],_0xa36a8e);}}}return _0x1f20ad[_0x989f('0xd')];};};Realtime[_0x989f('0x3f')][_0x989f('0x40')]=function(){var _0x2a6682=this;return function(_0x27e929){if(_0x27e929){freeIsNotKeySip(_0x27e929,_0x2a6682[_0x989f('0xe')]);for(var _0x3f2eb6=0x0,_0x17bc7d={},_0xb0c9be={};_0x3f2eb6<_0x27e929[_0x989f('0x3c')];_0x3f2eb6+=0x1){_0x17bc7d=_0x27e929[_0x3f2eb6];if(_[_0x989f('0x3d')](_0x2a6682[_0x989f('0xe')][util[_0x989f('0x21')](_0x989f('0x22'),_0x17bc7d[_0x989f('0x23')])])){_0x2a6682[_0x989f('0xe')][util[_0x989f('0x21')](_0x989f('0x22'),_0x17bc7d[_0x989f('0x23')])]=new Telephone(_0x17bc7d);}else{_0x2a6682[_0x989f('0x3e')](_0x2a6682[_0x989f('0xe')][util[_0x989f('0x21')](_0x989f('0x22'),_0x17bc7d[_0x989f('0x23')])],_0x17bc7d);}}}return _0x2a6682[_0x989f('0xe')];};};Realtime[_0x989f('0x3f')]['initTrunks']=function(){var _0x14c169=this;return function(_0x1b37ad){if(_0x1b37ad){freeIsNotKeySip(_0x1b37ad,_0x14c169[_0x989f('0xf')]);for(var _0x28dae2=0x0,_0xd46856={},_0x228e73={};_0x28dae2<_0x1b37ad[_0x989f('0x3c')];_0x28dae2+=0x1){_0xd46856=_0x1b37ad[_0x28dae2];if(_[_0x989f('0x3d')](_0x14c169[_0x989f('0xf')][util[_0x989f('0x21')](_0x989f('0x22'),_0xd46856['name'])])){_0x14c169['trunks'][util[_0x989f('0x21')](_0x989f('0x22'),_0xd46856[_0x989f('0x23')])]=new Trunk(_0xd46856);}else{_0x14c169[_0x989f('0x3e')](_0x14c169[_0x989f('0xf')][util[_0x989f('0x21')](_0x989f('0x22'),_0xd46856[_0x989f('0x23')])],_0xd46856);}}}return _0x14c169['trunks'];};};Realtime['prototype'][_0x989f('0x41')]=function(){var _0x4d6706=this;return function(_0x272b27){if(_0x272b27){freeIsNotKey(_0x272b27,_0x4d6706[_0x989f('0x10')],_0x989f('0x23'));for(var _0x7c079b=0x0,_0x1f4d8b={},_0x3eaab6={};_0x7c079b<_0x272b27[_0x989f('0x3c')];_0x7c079b+=0x1){_0x1f4d8b=_0x272b27[_0x7c079b];if(_['isUndefined'](_0x4d6706[_0x989f('0x10')][_0x1f4d8b['name']])){_0x4d6706[_0x989f('0x10')][_0x1f4d8b[_0x989f('0x23')]]=new VoiceQueue(_0x1f4d8b);}else{_0x4d6706[_0x989f('0x3e')](_0x4d6706[_0x989f('0x10')][_0x1f4d8b['name']],_0x1f4d8b);}}}return _0x4d6706[_0x989f('0x10')];};};Realtime[_0x989f('0x3f')][_0x989f('0x42')]=function(){var _0x519ea0=this;return function(_0x172470){if(_0x172470){freeIsNotKey(_0x172470,_0x519ea0[_0x989f('0x43')],'id');for(var _0x5908bf=0x0,_0x29773f={},_0x15b575={};_0x5908bf<_0x172470[_0x989f('0x3c')];_0x5908bf+=0x1){_0x29773f=_0x172470[_0x5908bf];if(_[_0x989f('0x3d')](_0x519ea0[_0x989f('0x43')][_0x29773f['id']])){_0x519ea0[_0x989f('0x43')][_0x29773f['id']]=new Trigger(_0x29773f);}else{_0x519ea0[_0x989f('0x3e')](_0x519ea0[_0x989f('0x43')][_0x29773f['id']],_0x29773f);}}}return _0x519ea0[_0x989f('0x43')];};};Realtime[_0x989f('0x3f')][_0x989f('0x44')]=function(){var _0x3f884a=this;return function(_0x1a4b45){if(_0x1a4b45){freeIsNotKey(_0x1a4b45,_0x3f884a[_0x989f('0x12')],'id');for(var _0x234650=0x0,_0x1221d4={},_0x1fe6fa={};_0x234650<_0x1a4b45[_0x989f('0x3c')];_0x234650+=0x1){_0x1221d4=_0x1a4b45[_0x234650];if(_[_0x989f('0x3d')](_0x3f884a[_0x989f('0x12')][_0x1221d4['id']])){_0x3f884a[_0x989f('0x12')][_0x1221d4['id']]=new Template(_0x1221d4);}else{_0x3f884a[_0x989f('0x3e')](_0x3f884a['templates'][_0x1221d4['id']],_0x1221d4);}}}return _0x3f884a[_0x989f('0x12')];};};Realtime[_0x989f('0x3f')][_0x989f('0x45')]=function(){var _0x2c41ef=this;return function(_0x4be3ef){if(_0x4be3ef){freeIsNotKey(_0x4be3ef,_0x2c41ef[_0x989f('0x18')],'id');for(var _0x105573=0x0,_0x240ed7={},_0x191ec0={};_0x105573<_0x4be3ef[_0x989f('0x3c')];_0x105573+=0x1){_0x240ed7=_0x4be3ef[_0x105573];if(_[_0x989f('0x3d')](_0x2c41ef['zendeskAccounts'][_0x240ed7['id']])){_0x2c41ef[_0x989f('0x18')][_0x240ed7['id']]=new ZendeskAccount(_0x240ed7);}else{_0x2c41ef[_0x989f('0x3e')](_0x2c41ef[_0x989f('0x18')][_0x240ed7['id']],_0x240ed7);}}}return _0x2c41ef[_0x989f('0x18')];};};Realtime[_0x989f('0x3f')][_0x989f('0x46')]=function(){var _0x1c749c=this;return function(_0x44b39){if(_0x44b39){freeIsNotKey(_0x44b39,_0x1c749c[_0x989f('0x19')],'id');for(var _0x520f9b=0x0,_0xa7d679={},_0x49c297={};_0x520f9b<_0x44b39[_0x989f('0x3c')];_0x520f9b+=0x1){_0xa7d679=_0x44b39[_0x520f9b];if(_[_0x989f('0x3d')](_0x1c749c[_0x989f('0x19')][_0xa7d679['id']])){_0x1c749c[_0x989f('0x19')][_0xa7d679['id']]=new SalesforceAccount(_0xa7d679);}else{_0x1c749c[_0x989f('0x3e')](_0x1c749c[_0x989f('0x19')][_0xa7d679['id']],_0xa7d679);}}}return _0x1c749c[_0x989f('0x19')];};};Realtime[_0x989f('0x3f')][_0x989f('0x47')]=function(){var _0x59151d=this;return function(_0x1eafcb){if(_0x1eafcb){freeIsNotKey(_0x1eafcb,_0x59151d[_0x989f('0x1a')],'id');for(var _0xb87420=0x0,_0x45a005={},_0x19d70b={};_0xb87420<_0x1eafcb[_0x989f('0x3c')];_0xb87420+=0x1){_0x45a005=_0x1eafcb[_0xb87420];if(_['isUndefined'](_0x59151d[_0x989f('0x1a')][_0x45a005['id']])){_0x59151d[_0x989f('0x1a')][_0x45a005['id']]=new FreshdeskAccount(_0x45a005);}else{_0x59151d[_0x989f('0x3e')](_0x59151d[_0x989f('0x1a')][_0x45a005['id']],_0x45a005);}}}return _0x59151d[_0x989f('0x1a')];};};Realtime[_0x989f('0x3f')][_0x989f('0x48')]=function(){var _0x333269=this;return function(_0x321d6c){if(_0x321d6c){freeIsNotKey(_0x321d6c,_0x333269[_0x989f('0x49')],'id');for(var _0x463300=0x0,_0x51bac7={},_0x1150a0={};_0x463300<_0x321d6c[_0x989f('0x3c')];_0x463300+=0x1){_0x51bac7=_0x321d6c[_0x463300];if(_['isUndefined'](_0x333269[_0x989f('0x49')][_0x51bac7['id']])){_0x333269[_0x989f('0x49')][_0x51bac7['id']]=new ZohoAccount(_0x51bac7);}else{_0x333269[_0x989f('0x3e')](_0x333269['zohoAccounts'][_0x51bac7['id']],_0x51bac7);}}}return _0x333269[_0x989f('0x49')];};};Realtime[_0x989f('0x3f')][_0x989f('0x4a')]=function(){var _0x4b2f0b=this;return function(_0xeab8d){if(_0xeab8d){freeIsNotKey(_0xeab8d,_0x4b2f0b[_0x989f('0x1b')],'id');for(var _0x3c7053=0x0,_0x3544c0={},_0x178eff={};_0x3c7053<_0xeab8d[_0x989f('0x3c')];_0x3c7053+=0x1){_0x3544c0=_0xeab8d[_0x3c7053];if(_[_0x989f('0x3d')](_0x4b2f0b[_0x989f('0x1b')][_0x3544c0['id']])){_0x4b2f0b[_0x989f('0x1b')][_0x3544c0['id']]=new DeskAccount(_0x3544c0);}else{_0x4b2f0b['mergeFromDatabase'](_0x4b2f0b[_0x989f('0x1b')][_0x3544c0['id']],_0x3544c0);}}}return _0x4b2f0b['deskAccounts'];};};Realtime[_0x989f('0x3f')][_0x989f('0x4b')]=function(){var _0x47e394=this;return function(_0xdb8319){if(_0xdb8319){freeIsNotKey(_0xdb8319,_0x47e394[_0x989f('0x4c')],'id');for(var _0x13c90e=0x0,_0xb69832={},_0x26eb3b={};_0x13c90e<_0xdb8319[_0x989f('0x3c')];_0x13c90e+=0x1){_0xb69832=_0xdb8319[_0x13c90e];if(_[_0x989f('0x3d')](_0x47e394[_0x989f('0x4c')][_0xb69832['id']])){_0x47e394['sugarcrmAccounts'][_0xb69832['id']]=new SugarcrmAccount(_0xb69832);}else{_0x47e394[_0x989f('0x3e')](_0x47e394[_0x989f('0x4c')][_0xb69832['id']],_0xb69832);}}}return _0x47e394[_0x989f('0x4c')];};};Realtime[_0x989f('0x3f')][_0x989f('0x4d')]=function(){var _0x214a30=this;return function(_0xee6162){if(_0xee6162){freeIsNotKey(_0xee6162,_0x214a30[_0x989f('0x1c')],'id');for(var _0x205369=0x0,_0x540087={},_0x2f5c9d={};_0x205369<_0xee6162[_0x989f('0x3c')];_0x205369+=0x1){_0x540087=_0xee6162[_0x205369];if(_[_0x989f('0x3d')](_0x214a30[_0x989f('0x1c')][_0x540087['id']])){_0x214a30['vtigerAccounts'][_0x540087['id']]=new VtigerAccount(_0x540087);}else{_0x214a30[_0x989f('0x3e')](_0x214a30[_0x989f('0x1c')][_0x540087['id']],_0x540087);}}}return _0x214a30[_0x989f('0x1c')];};};Realtime[_0x989f('0x3f')][_0x989f('0x4e')]=function(){var _0x44ed06=this;return function(_0x13bfcd){if(_0x13bfcd){freeIsNotKey(_0x13bfcd,_0x44ed06[_0x989f('0x4f')],'id');for(var _0x3bc144=0x0,_0x35cd7a={},_0x5684db={};_0x3bc144<_0x13bfcd['length'];_0x3bc144+=0x1){_0x35cd7a=_0x13bfcd[_0x3bc144];if(_['isUndefined'](_0x44ed06[_0x989f('0x4f')][_0x35cd7a['id']])){_0x44ed06[_0x989f('0x4f')][_0x35cd7a['id']]=new ServicenowAccount(_0x35cd7a);}else{_0x44ed06[_0x989f('0x3e')](_0x44ed06[_0x989f('0x4f')][_0x35cd7a['id']],_0x35cd7a);}}}return _0x44ed06['servicenowAccounts'];};};Realtime['prototype'][_0x989f('0x50')]=function(){var _0x2db97f=this;return function(_0x53a8d7){if(_0x53a8d7){freeIsNotKey(_0x53a8d7,_0x2db97f[_0x989f('0x1d')],'id');for(var _0x1a2f96=0x0,_0x43c18a={},_0x4e6bc9={};_0x1a2f96<_0x53a8d7[_0x989f('0x3c')];_0x1a2f96+=0x1){_0x43c18a=_0x53a8d7[_0x1a2f96];if(_[_0x989f('0x3d')](_0x2db97f[_0x989f('0x1d')][_0x43c18a['id']])){_0x2db97f['dynamics365Accounts'][_0x43c18a['id']]=new Dynamics365Account(_0x43c18a);}else{_0x2db97f['mergeFromDatabase'](_0x2db97f[_0x989f('0x1d')][_0x43c18a['id']],_0x43c18a);}}}return _0x2db97f[_0x989f('0x1d')];};};Realtime[_0x989f('0x3f')][_0x989f('0x51')]=function(){var _0x438d7a=this;return function(_0x51ac7c){if(_0x51ac7c){freeIsNotKey(_0x51ac7c,_0x438d7a['freshsalesAccounts'],'id');for(var _0x2e7272=0x0,_0x2ffaa1={},_0x17e0ca={};_0x2e7272<_0x51ac7c[_0x989f('0x3c')];_0x2e7272+=0x1){_0x2ffaa1=_0x51ac7c[_0x2e7272];if(_[_0x989f('0x3d')](_0x438d7a[_0x989f('0x1e')][_0x2ffaa1['id']])){_0x438d7a[_0x989f('0x1e')][_0x2ffaa1['id']]=new FreshsalesAccount(_0x2ffaa1);}else{_0x438d7a[_0x989f('0x3e')](_0x438d7a[_0x989f('0x1e')][_0x2ffaa1['id']],_0x2ffaa1);}}}return _0x438d7a[_0x989f('0x1e')];};};Realtime['prototype'][_0x989f('0x52')]=function(){var _0x4fd0e8=this;return function(_0x2bf959){for(var _0x52f074=0x0;_0x52f074<_0x2bf959[_0x989f('0x3c')];_0x52f074+=0x1){_[_0x989f('0x53')](_0x4fd0e8[_0x989f('0x10')][_0x2bf959[_0x52f074][_0x989f('0x23')]],_0x2bf959[_0x52f074]);}return _0x4fd0e8['voiceQueues'];};};Realtime[_0x989f('0x3f')][_0x989f('0x54')]=function(){var _0x36c367=this;return function(_0x54cfc2){clearVoiceQueues(_0x36c367[_0x989f('0x10')]);if(_0x54cfc2){_0x54cfc2=_[_0x989f('0x55')](_0x54cfc2,_0x989f('0x56'));for(var _0x15e547 in _0x54cfc2){if(_0x54cfc2[_0x989f('0x24')](_0x15e547)){var _0x1e4339={};for(var _0x396f09=0x0;_0x396f09<_0x54cfc2[_0x15e547]['length'];_0x396f09+=0x1){var _0x485101=_0x54cfc2[_0x15e547][_0x396f09][_0x989f('0x57')];if(_0x36c367['voiceQueues'][_0x485101]){if(_0x54cfc2[_0x15e547][_0x396f09][_0x989f('0x58')]){_0x36c367[_0x989f('0x10')][_0x485101][_0x989f('0x2f')]+=0x1;}if(_0x54cfc2[_0x15e547][_0x396f09][_0x989f('0x59')]){_0x36c367[_0x989f('0x10')][_0x485101]['abandoned']+=0x1;}_0x36c367['voiceQueues'][_0x485101][_0x989f('0x29')]+=moment(_0x54cfc2[_0x15e547][_0x396f09][_0x989f('0x5a')])[_0x989f('0x5b')](moment(_0x54cfc2[_0x15e547][_0x396f09][_0x989f('0x5c')]),'seconds')||0x0;if(_0x396f09===_0x54cfc2[_0x15e547][_0x989f('0x3c')]-0x1){_0x36c367[_0x989f('0x10')][_0x485101][_0x989f('0x2a')]+=moment(_0x54cfc2[_0x15e547][_0x396f09][_0x989f('0x5d')]||_0x54cfc2[_0x15e547][_0x396f09][_0x989f('0x5e')]||_0x54cfc2[_0x15e547][_0x396f09][_0x989f('0x5f')])[_0x989f('0x5b')](moment(_0x54cfc2[_0x15e547][_0x396f09][_0x989f('0x5c')]),_0x989f('0x60'))||0x0;_0x36c367[_0x989f('0x10')][_0x485101]['total']+=0x1;if(_0x54cfc2[_0x15e547][_0x396f09][_0x989f('0x61')]){_0x36c367['voiceQueues'][_0x485101]['answered']+=0x1;_0x36c367['voiceQueues'][_0x485101][_0x989f('0x2b')]+=moment(_0x54cfc2[_0x15e547][_0x396f09][_0x989f('0x5d')])[_0x989f('0x5b')](moment(_0x54cfc2[_0x15e547][_0x396f09][_0x989f('0x5a')]),_0x989f('0x60'))||0x0;}}else{_0x36c367[_0x989f('0x10')][_0x485101][_0x989f('0x2a')]+=_0x36c367[_0x989f('0x10')][_0x485101]['sumHoldTime']||0x0;}}}}}}return _0x36c367[_0x989f('0x10')];};};Realtime[_0x989f('0x3f')][_0x989f('0x62')]=function(){var _0x1413ff=this;return function(_0x380d5c){clearVoiceCallReports(_0x1413ff[_0x989f('0x63')]);if(_0x380d5c){for(var _0x409278=0x0;_0x409278<_0x380d5c['length'];_0x409278+=0x1){_0x1413ff[_0x989f('0x63')][_0x989f('0x27')]+=0x1;_0x1413ff[_0x989f('0x63')][_0x989f('0x2a')]+=_0x380d5c[_0x409278][_0x989f('0x64')];if(_0x380d5c[_0x409278]['disposition']==='ANSWERED'){_0x1413ff['outbound'][_0x989f('0x28')]+=0x1;_0x1413ff[_0x989f('0x63')][_0x989f('0x29')]+=_0x380d5c[_0x409278][_0x989f('0x64')]-_0x380d5c[_0x409278][_0x989f('0x65')]||0x0;_0x1413ff[_0x989f('0x63')][_0x989f('0x2b')]+=_0x380d5c[_0x409278][_0x989f('0x65')];}}}return _0x1413ff[_0x989f('0x63')];};};Realtime[_0x989f('0x3f')][_0x989f('0x66')]=function(){var _0x44d4fe=this;return function(_0x7d1a73){if(_0x7d1a73){freeIsNotKey(_0x7d1a73,_0x44d4fe[_0x989f('0x11')],_0x989f('0x23'));for(var _0x3b3376=0x0,_0x3f8aef={};_0x3b3376<_0x7d1a73[_0x989f('0x3c')];_0x3b3376+=0x1){_0x3f8aef=_0x7d1a73[_0x3b3376];if(_['isUndefined'](_0x44d4fe[_0x989f('0x11')][_0x3f8aef[_0x989f('0x23')]])){_0x44d4fe[_0x989f('0x11')][_0x3f8aef[_0x989f('0x23')]]=new Campaign(_0x3f8aef);}else{_0x44d4fe[_0x989f('0x3e')](_0x44d4fe[_0x989f('0x11')][_0x3f8aef[_0x989f('0x23')]],_0x3f8aef);}}}return _0x44d4fe[_0x989f('0x11')];};};Realtime[_0x989f('0x3f')][_0x989f('0x67')]=function(){var _0x35c24e=this;return function(_0x5bd1ed){if(_0x5bd1ed){freeIsNotKey(_0x5bd1ed,_0x35c24e[_0x989f('0x13')],'id');for(var _0x36fed4=0x0,_0xfea653={};_0x36fed4<_0x5bd1ed[_0x989f('0x3c')];_0x36fed4+=0x1){_0xfea653=_0x5bd1ed[_0x36fed4];if(_[_0x989f('0x3d')](_0x35c24e[_0x989f('0x13')][_0xfea653['id']])){_0x35c24e[_0x989f('0x13')][_0xfea653['id']]=new VoiceExtension(_0xfea653);}else{_0x35c24e[_0x989f('0x3e')](_0x35c24e[_0x989f('0x13')][_0xfea653['id']],_0xfea653);}}}return _0x35c24e[_0x989f('0x13')];};};Realtime[_0x989f('0x3f')][_0x989f('0x68')]=function(){var _0x29959e=this;return function(_0x425d28){clearCampaigns(_0x29959e['campaigns']);for(var _0x7b5eea=0x0;_0x7b5eea<_0x425d28['length'];_0x7b5eea+=0x1){_[_0x989f('0x53')](_0x29959e[_0x989f('0x11')][_0x425d28[_0x7b5eea][_0x989f('0x23')]],_0x425d28[_0x7b5eea]);}return _0x29959e['campaigns'];};};Realtime[_0x989f('0x3f')][_0x989f('0x69')]=function(){var _0x595f7e=this;return function(_0x49834b){if(_0x49834b){freeIsNotKey(_0x49834b,_0x595f7e[_0x989f('0x1f')],'id');for(var _0x5724a9=0x0,_0x13046c={},_0x42cfc9={};_0x5724a9<_0x49834b[_0x989f('0x3c')];_0x5724a9+=0x1){_0x13046c=_0x49834b[_0x5724a9];if(_[_0x989f('0x3d')](_0x595f7e[_0x989f('0x1f')][_0x13046c['id']])){_0x595f7e[_0x989f('0x1f')][_0x13046c['id']]=new FaxAccount(_0x13046c);}else{_0x595f7e[_0x989f('0x3e')](_0x595f7e[_0x989f('0x1f')][_0x13046c['id']],_0x13046c);}}}return _0x595f7e[_0x989f('0x1f')];};};module[_0x989f('0x6a')]=Realtime; \ No newline at end of file diff --git a/server/services/ami/report/index.js b/server/services/ami/report/index.js index 3e7b05f..5e348b5 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 _0x4232=['lastAssignedTo','format','SIP/%s','queuecallercomplete','YYYY-MM-DD\x20HH:mm:ss','destination','type','dialer','lastapplication','queue','lastdata','context','from-voip-provider','callerid','xcally-motion-preview','calleridpreview','originatecalleridnum','destinationchannel','channel','calleridnum','\x22%s\x22\x20<%s>','calleridname','create','monitor','monitors','length','monitorFilename','filename','createdAt','exten','connectedlinename','membername','voiceAgentReport','isArray','forEach','Local','substring','indexOf','phone','lastIndexOf','exports','lodash','moment','util','../../../config/environment','ami','../ami','../rpc/voiceAgentReport','../rpc/voiceCallReport','../rpc/voiceDialReport','../rpc/memberReport','../rpc/voiceRecording','../rpc/voiceTransferReport','./voiceQueueReport','./voiceCallReport','./voiceAgentReport','./userReport','agents','telephones','prototype','realtime','xdr','disabled','voiceQueueReport','bind','custom:voiceCallReport','voiceCallReport','custom:voiceAgentReport','voiceDialReport','blindtransfer','blindTransfer','attendedtransfer','attendedTransfer','findAgent','find','accountcode','name','isNil','interface','connectedlinenum'];(function(_0x17a472,_0x54811b){var _0x36a618=function(_0x17317){while(--_0x17317){_0x17a472['push'](_0x17a472['shift']());}};_0x36a618(++_0x54811b);}(_0x4232,0x1b9));var _0x2423=function(_0x286c9f,_0x549a3b){_0x286c9f=_0x286c9f-0x0;var _0x551bb2=_0x4232[_0x286c9f];return _0x551bb2;};'use strict';var BPromise=require('bluebird');var _=require(_0x2423('0x0'));var moment=require(_0x2423('0x1'));var util=require(_0x2423('0x2'));var config=require(_0x2423('0x3'));var logger=require('../../../config/logger')(_0x2423('0x4'));var ami=require(_0x2423('0x5'));var RpcVoiceAgentReport=require(_0x2423('0x6'));var RpcVoiceCallReport=require(_0x2423('0x7'));var RpcVoiceDialReport=require(_0x2423('0x8'));var RpcMemberReport=require(_0x2423('0x9'));var RpcVoiceQueueReport=require('../rpc/voiceQueueReport');var RpcVoiceRecording=require(_0x2423('0xa'));var RpcVoiceTransferReport=require(_0x2423('0xb'));var VoiceQueueReport=require(_0x2423('0xc'));var VoiceCallReport=require(_0x2423('0xd'));var VoiceAgentReport=require(_0x2423('0xe'));var VoiceDialReport=require('./voiceDialReport');var UserReport=require(_0x2423('0xf'));function Report(_0x55feee){this['realtime']=_0x55feee;this['agents']=_0x55feee[_0x2423('0x10')];this['telephones']=_0x55feee[_0x2423('0x11')];}Report[_0x2423('0x12')]['sync']=function(_0x47b40e){var _0x44bdae=new VoiceQueueReport(this['realtime']);var _0x4f8dbf=new VoiceAgentReport(this[_0x2423('0x13')]);var _0xe33481=new VoiceDialReport(this['realtime']);var _0x47cd42=new VoiceCallReport(this['realtime']);var _0x3711e2=new UserReport(this[_0x2423('0x13')]);if(config[_0x2423('0x14')]&&config[_0x2423('0x14')][_0x2423('0x15')]){ami['on']('custom:voiceQueueReport',this[_0x2423('0x16')][_0x2423('0x17')](this));ami['on'](_0x2423('0x18'),this[_0x2423('0x19')]['bind'](this));ami['on'](_0x2423('0x1a'),this['voiceAgentReport']['bind'](this));ami['on']('custom:voiceDialReport',this[_0x2423('0x1b')][_0x2423('0x17')](this));ami['on'](_0x2423('0x1c'),this[_0x2423('0x1d')][_0x2423('0x17')](this));ami['on'](_0x2423('0x1e'),this[_0x2423('0x1f')][_0x2423('0x17')](this));}};Report['prototype'][_0x2423('0x20')]=function(_0x2e83a7){var _0x2c7402=undefined;_0x2c7402=_[_0x2423('0x21')](this['agents'],function(_0x1f1ba7){return _0x1f1ba7[_0x2423('0x22')]==_0x2e83a7||_0x1f1ba7[_0x2423('0x23')]==_0x2e83a7;});if(_[_0x2423('0x24')](_0x2c7402)){var _0x31546e=_['find'](this['telephones'],function(_0x5b56a2){return _0x5b56a2['accountcode']==_0x2e83a7||_0x5b56a2[_0x2423('0x23')]==_0x2e83a7;});if(_0x31546e){_0x2c7402=_['find'](this[_0x2423('0x10')],function(_0xca024a){return _0xca024a[_0x2423('0x25')]==util['format']('SIP/%s',_0x31546e['name']);});}}return _0x2c7402;};Report[_0x2423('0x12')]['voiceQueueReport']=function(_0x29962b){for(var _0x1ad1e4=0x0;_0x1ad1e4<_0x29962b['length'];_0x1ad1e4+=0x1){var _0x329872=this[_0x2423('0x20')](_0x29962b[_0x1ad1e4][_0x2423('0x26')]);if(_0x329872){_0x29962b[_0x1ad1e4][_0x2423('0x22')]=_0x329872[_0x2423('0x22')];_0x29962b[_0x1ad1e4]['assigned']=!![];_0x29962b[_0x1ad1e4][_0x2423('0x27')]=_0x329872[_0x2423('0x23')];_0x29962b[_0x1ad1e4][_0x2423('0x25')]=_[_0x2423('0x24')](_0x329872[_0x2423('0x25')])?util[_0x2423('0x28')](_0x2423('0x29'),_0x329872[_0x2423('0x23')]):_0x329872[_0x2423('0x25')];if(_0x29962b[_0x1ad1e4][_0x2423('0x2a')]){_0x29962b[_0x1ad1e4]['queuecallercompleteAt']=moment()['format'](_0x2423('0x2b'));}if(_0x29962b[_0x1ad1e4]['queuecallerexit']){_0x29962b[_0x1ad1e4]['queuecallerexitAt']=moment()[_0x2423('0x28')]('YYYY-MM-DD\x20HH:mm:ss');}RpcMemberReport[_0x2423('0x16')](_0x29962b[_0x1ad1e4]);}RpcVoiceQueueReport['create'](_0x29962b[_0x1ad1e4]);}};function extractCalleridNumber(_0x36f482){var _0x5cbec0=_0x36f482['match'](/<(.*?)>/);return _0x5cbec0?_0x5cbec0[0x1]:_0x36f482;}Report['prototype']['voiceCallReport']=function(_0x2cdf87){_0x2cdf87[_0x2423('0x2c')]=_0x2cdf87['destination']||_0x2cdf87['exten'];if(_0x2cdf87[_0x2423('0x2d')]==_0x2423('0x2e')){_0x2cdf87[_0x2423('0x2f')]=_0x2423('0x30');_0x2cdf87[_0x2423('0x31')]=_0x2cdf87[_0x2423('0x30')];if(_0x2cdf87[_0x2423('0x32')]==_0x2423('0x33')){_0x2cdf87[_0x2423('0x22')]='';_0x2cdf87[_0x2423('0x2c')]=extractCalleridNumber(_0x2cdf87[_0x2423('0x34')]);}else if(_0x2cdf87[_0x2423('0x32')]=='from-sip'){if(_0x2cdf87[_0x2423('0x2c')]==_0x2423('0x35')){_0x2cdf87['destination']=extractCalleridNumber(_0x2cdf87[_0x2423('0x36')]);_0x2cdf87['calleridnum']=_0x2cdf87[_0x2423('0x37')];_0x2cdf87[_0x2423('0x38')]=[_0x2cdf87[_0x2423('0x39')],_0x2cdf87[_0x2423('0x39')]=_0x2cdf87[_0x2423('0x38')]][0x0];_0x2cdf87['callerid']=_0x2cdf87[_0x2423('0x36')];}else{_0x2cdf87[_0x2423('0x2c')]=_0x2cdf87[_0x2423('0x3a')];_0x2cdf87[_0x2423('0x3a')]=_0x2cdf87[_0x2423('0x37')];if(_0x2cdf87['disposition']=='ANSWERED'){_0x2cdf87['accountcode']=_0x2cdf87[_0x2423('0x26')];}else{_0x2cdf87[_0x2423('0x22')]='';}}}}else{_0x2cdf87[_0x2423('0x34')]=util['format'](_0x2423('0x3b'),_0x2cdf87[_0x2423('0x3c')],_0x2cdf87[_0x2423('0x3a')]);}RpcVoiceCallReport[_0x2423('0x3d')](_0x2cdf87);if(_0x2cdf87[_0x2423('0x3e')]){for(var _0x3f568a=0x0;_0x3f568a<_0x2cdf87[_0x2423('0x3f')][_0x2423('0x40')];_0x3f568a+=0x1){_0x2cdf87[_0x2423('0x41')]=_0x2cdf87[_0x2423('0x3f')][_0x3f568a][_0x2423('0x42')];_0x2cdf87[_0x2423('0x43')]=_0x2cdf87[_0x2423('0x3f')][_0x3f568a][_0x2423('0x43')];if(_0x2cdf87[_0x2423('0x44')]==_0x2423('0x35')){_0x2cdf87[_0x2423('0x3a')]=_0x2cdf87[_0x2423('0x26')];_0x2cdf87[_0x2423('0x3c')]=_0x2cdf87[_0x2423('0x45')];_0x2cdf87['connectedlinenum']=_0x2cdf87['accountcode'];_0x2cdf87[_0x2423('0x45')]=_0x2cdf87[_0x2423('0x46')];_0x2cdf87[_0x2423('0x44')]=_0x2cdf87['originatecalleridnum'];}else if(_0x2cdf87[_0x2423('0x44')]=='xcally-motion-dialer'){_0x2cdf87['calleridnum']=_0x2cdf87[_0x2423('0x2c')];_0x2cdf87[_0x2423('0x44')]=_0x2cdf87[_0x2423('0x37')];}RpcVoiceRecording['create'](_0x2cdf87);}}};Report[_0x2423('0x12')][_0x2423('0x47')]=function(_0x399112){if(_[_0x2423('0x48')](_0x399112)){_0x399112[_0x2423('0x49')](function(_0x123daf){RpcVoiceAgentReport['create'](_0x123daf);});}else{RpcVoiceAgentReport['create'](_0x399112);}};Report[_0x2423('0x12')][_0x2423('0x1b')]=function(_0x4c415b){RpcVoiceDialReport[_0x2423('0x3d')](_0x4c415b);var _0xfcc686=undefined;var _0x2c5d97=_0x4c415b[_0x2423('0x39')];if(_['startsWith'](_0x2c5d97,_0x2423('0x4a'))){var _0xaeff32=_0x2c5d97[_0x2423('0x4b')](_0x2c5d97[_0x2423('0x4c')]('/')+0x1,_0x2c5d97[_0x2423('0x4c')]('@'));_0xfcc686=_[_0x2423('0x21')](this[_0x2423('0x10')],function(_0x3d9d70){return _0x3d9d70['mobile']==_0xaeff32||_0x3d9d70[_0x2423('0x4d')]==_0xaeff32||_0x3d9d70[_0x2423('0x22')]==_0xaeff32;});}else{var _0xaeff32=_0x2c5d97[_0x2423('0x4b')](_0x2c5d97[_0x2423('0x4c')]('/')+0x1,_0x2c5d97[_0x2423('0x4e')]('-'));_0xfcc686=this[_0x2423('0x20')](_0xaeff32);}if(_0xfcc686){_0x4c415b[_0x2423('0x25')]=_[_0x2423('0x24')](_0xfcc686[_0x2423('0x25')])?util[_0x2423('0x28')]('SIP/%s',_0xfcc686['name']):_0xfcc686[_0x2423('0x25')];_0x4c415b[_0x2423('0x46')]=_0xfcc686['name'];_0x4c415b[_0x2423('0x22')]=_0xfcc686[_0x2423('0x22')];RpcMemberReport[_0x2423('0x1b')](_0x4c415b);}};Report['prototype'][_0x2423('0x1d')]=function(_0x4a2c47){RpcVoiceTransferReport['blindTransfer'](_0x4a2c47);};Report[_0x2423('0x12')]['attendedTransfer']=function(_0xdfc8f8){RpcVoiceTransferReport[_0x2423('0x1f')](_0xdfc8f8);};module[_0x2423('0x4f')]=Report; \ No newline at end of file +var _0xbfbb=['calleridname','monitor','monitors','filename','createdAt','connectedlinename','membername','xcally-motion-dialer','isArray','forEach','Local','substring','indexOf','mobile','phone','lastIndexOf','exports','bluebird','lodash','util','../../../config/environment','../../../config/logger','../ami','../rpc/voiceAgentReport','../rpc/voiceCallReport','../rpc/memberReport','../rpc/voiceRecording','../rpc/voiceTransferReport','./voiceQueueReport','./voiceCallReport','./voiceAgentReport','realtime','agents','prototype','xdr','custom:voiceQueueReport','voiceQueueReport','bind','custom:voiceCallReport','voiceCallReport','custom:voiceAgentReport','voiceAgentReport','custom:voiceDialReport','voiceDialReport','blindtransfer','blindTransfer','attendedtransfer','attendedTransfer','find','accountcode','name','isNil','telephones','interface','SIP/%s','length','connectedlinenum','assigned','lastAssignedTo','format','queuecallerexitAt','YYYY-MM-DD\x20HH:mm:ss','create','match','destination','exten','type','dialer','lastapplication','queue','lastdata','context','from-voip-provider','from-sip','xcally-motion-preview','calleridnum','originatecalleridnum','channel','callerid','calleridpreview','disposition','\x22%s\x22\x20<%s>'];(function(_0x4f1752,_0x130e28){var _0x4a0fd8=function(_0x4e34b2){while(--_0x4e34b2){_0x4f1752['push'](_0x4f1752['shift']());}};_0x4a0fd8(++_0x130e28);}(_0xbfbb,0x159));var _0xbbfb=function(_0x5b4b9f,_0x388938){_0x5b4b9f=_0x5b4b9f-0x0;var _0x6b8af9=_0xbfbb[_0x5b4b9f];return _0x6b8af9;};'use strict';var BPromise=require(_0xbbfb('0x0'));var _=require(_0xbbfb('0x1'));var moment=require('moment');var util=require(_0xbbfb('0x2'));var config=require(_0xbbfb('0x3'));var logger=require(_0xbbfb('0x4'))('ami');var ami=require(_0xbbfb('0x5'));var RpcVoiceAgentReport=require(_0xbbfb('0x6'));var RpcVoiceCallReport=require(_0xbbfb('0x7'));var RpcVoiceDialReport=require('../rpc/voiceDialReport');var RpcMemberReport=require(_0xbbfb('0x8'));var RpcVoiceQueueReport=require('../rpc/voiceQueueReport');var RpcVoiceRecording=require(_0xbbfb('0x9'));var RpcVoiceTransferReport=require(_0xbbfb('0xa'));var VoiceQueueReport=require(_0xbbfb('0xb'));var VoiceCallReport=require(_0xbbfb('0xc'));var VoiceAgentReport=require(_0xbbfb('0xd'));var VoiceDialReport=require('./voiceDialReport');var UserReport=require('./userReport');function Report(_0x1e1318){this[_0xbbfb('0xe')]=_0x1e1318;this[_0xbbfb('0xf')]=_0x1e1318[_0xbbfb('0xf')];this['telephones']=_0x1e1318['telephones'];}Report[_0xbbfb('0x10')]['sync']=function(_0xd440c7){var _0x5c037a=new VoiceQueueReport(this[_0xbbfb('0xe')]);var _0x3a4dd9=new VoiceAgentReport(this[_0xbbfb('0xe')]);var _0x3578bc=new VoiceDialReport(this[_0xbbfb('0xe')]);var _0x53218f=new VoiceCallReport(this['realtime']);var _0x2b6f88=new UserReport(this[_0xbbfb('0xe')]);if(config[_0xbbfb('0x11')]&&config['xdr']['disabled']){ami['on'](_0xbbfb('0x12'),this[_0xbbfb('0x13')][_0xbbfb('0x14')](this));ami['on'](_0xbbfb('0x15'),this[_0xbbfb('0x16')]['bind'](this));ami['on'](_0xbbfb('0x17'),this[_0xbbfb('0x18')][_0xbbfb('0x14')](this));ami['on'](_0xbbfb('0x19'),this[_0xbbfb('0x1a')][_0xbbfb('0x14')](this));ami['on'](_0xbbfb('0x1b'),this[_0xbbfb('0x1c')]['bind'](this));ami['on'](_0xbbfb('0x1d'),this[_0xbbfb('0x1e')][_0xbbfb('0x14')](this));}};Report[_0xbbfb('0x10')]['findAgent']=function(_0x52b982){var _0x10c413=undefined;_0x10c413=_[_0xbbfb('0x1f')](this[_0xbbfb('0xf')],function(_0x5bb4e4){return _0x5bb4e4[_0xbbfb('0x20')]==_0x52b982||_0x5bb4e4[_0xbbfb('0x21')]==_0x52b982;});if(_[_0xbbfb('0x22')](_0x10c413)){var _0x42a7ed=_[_0xbbfb('0x1f')](this[_0xbbfb('0x23')],function(_0x320964){return _0x320964['accountcode']==_0x52b982||_0x320964[_0xbbfb('0x21')]==_0x52b982;});if(_0x42a7ed){_0x10c413=_[_0xbbfb('0x1f')](this['agents'],function(_0x1bfcdd){return _0x1bfcdd[_0xbbfb('0x24')]==util['format'](_0xbbfb('0x25'),_0x42a7ed[_0xbbfb('0x21')]);});}}return _0x10c413;};Report[_0xbbfb('0x10')][_0xbbfb('0x13')]=function(_0x54f571){for(var _0x4e26f9=0x0;_0x4e26f9<_0x54f571[_0xbbfb('0x26')];_0x4e26f9+=0x1){var _0x5a762f=this['findAgent'](_0x54f571[_0x4e26f9][_0xbbfb('0x27')]);if(_0x5a762f){_0x54f571[_0x4e26f9][_0xbbfb('0x20')]=_0x5a762f['accountcode'];_0x54f571[_0x4e26f9][_0xbbfb('0x28')]=!![];_0x54f571[_0x4e26f9][_0xbbfb('0x29')]=_0x5a762f[_0xbbfb('0x21')];_0x54f571[_0x4e26f9]['interface']=_[_0xbbfb('0x22')](_0x5a762f['interface'])?util[_0xbbfb('0x2a')](_0xbbfb('0x25'),_0x5a762f[_0xbbfb('0x21')]):_0x5a762f[_0xbbfb('0x24')];if(_0x54f571[_0x4e26f9]['queuecallercomplete']){_0x54f571[_0x4e26f9]['queuecallercompleteAt']=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');}if(_0x54f571[_0x4e26f9]['queuecallerexit']){_0x54f571[_0x4e26f9][_0xbbfb('0x2b')]=moment()[_0xbbfb('0x2a')](_0xbbfb('0x2c'));}RpcMemberReport['voiceQueueReport'](_0x54f571[_0x4e26f9]);}RpcVoiceQueueReport[_0xbbfb('0x2d')](_0x54f571[_0x4e26f9]);}};function extractCalleridNumber(_0x326eca){var _0x163db6=_0x326eca[_0xbbfb('0x2e')](/<(.*?)>/);return _0x163db6?_0x163db6[0x1]:_0x326eca;}Report['prototype'][_0xbbfb('0x16')]=function(_0x4431e4){_0x4431e4[_0xbbfb('0x2f')]=_0x4431e4[_0xbbfb('0x2f')]||_0x4431e4[_0xbbfb('0x30')];if(_0x4431e4[_0xbbfb('0x31')]==_0xbbfb('0x32')){_0x4431e4[_0xbbfb('0x33')]=_0xbbfb('0x34');_0x4431e4[_0xbbfb('0x35')]=_0x4431e4['queue'];if(_0x4431e4[_0xbbfb('0x36')]==_0xbbfb('0x37')){_0x4431e4[_0xbbfb('0x20')]='';_0x4431e4[_0xbbfb('0x2f')]=extractCalleridNumber(_0x4431e4['callerid']);}else if(_0x4431e4['context']==_0xbbfb('0x38')){if(_0x4431e4[_0xbbfb('0x2f')]==_0xbbfb('0x39')){_0x4431e4[_0xbbfb('0x2f')]=extractCalleridNumber(_0x4431e4['calleridpreview']);_0x4431e4[_0xbbfb('0x3a')]=_0x4431e4[_0xbbfb('0x3b')];_0x4431e4['destinationchannel']=[_0x4431e4[_0xbbfb('0x3c')],_0x4431e4[_0xbbfb('0x3c')]=_0x4431e4['destinationchannel']][0x0];_0x4431e4[_0xbbfb('0x3d')]=_0x4431e4[_0xbbfb('0x3e')];}else{_0x4431e4[_0xbbfb('0x2f')]=_0x4431e4['calleridnum'];_0x4431e4[_0xbbfb('0x3a')]=_0x4431e4[_0xbbfb('0x3b')];if(_0x4431e4[_0xbbfb('0x3f')]=='ANSWERED'){_0x4431e4[_0xbbfb('0x20')]=_0x4431e4['connectedlinenum'];}else{_0x4431e4[_0xbbfb('0x20')]='';}}}}else{_0x4431e4[_0xbbfb('0x3d')]=util['format'](_0xbbfb('0x40'),_0x4431e4[_0xbbfb('0x41')],_0x4431e4['calleridnum']);}RpcVoiceCallReport[_0xbbfb('0x2d')](_0x4431e4);if(_0x4431e4[_0xbbfb('0x42')]){for(var _0x3e4adb=0x0;_0x3e4adb<_0x4431e4['monitors'][_0xbbfb('0x26')];_0x3e4adb+=0x1){_0x4431e4['monitorFilename']=_0x4431e4[_0xbbfb('0x43')][_0x3e4adb][_0xbbfb('0x44')];_0x4431e4[_0xbbfb('0x45')]=_0x4431e4[_0xbbfb('0x43')][_0x3e4adb][_0xbbfb('0x45')];if(_0x4431e4[_0xbbfb('0x30')]==_0xbbfb('0x39')){_0x4431e4[_0xbbfb('0x3a')]=_0x4431e4[_0xbbfb('0x27')];_0x4431e4[_0xbbfb('0x41')]=_0x4431e4[_0xbbfb('0x46')];_0x4431e4[_0xbbfb('0x27')]=_0x4431e4['accountcode'];_0x4431e4[_0xbbfb('0x46')]=_0x4431e4[_0xbbfb('0x47')];_0x4431e4[_0xbbfb('0x30')]=_0x4431e4[_0xbbfb('0x3b')];}else if(_0x4431e4[_0xbbfb('0x30')]==_0xbbfb('0x48')){_0x4431e4[_0xbbfb('0x3a')]=_0x4431e4['destination'];_0x4431e4['exten']=_0x4431e4[_0xbbfb('0x3b')];}RpcVoiceRecording[_0xbbfb('0x2d')](_0x4431e4);}}};Report[_0xbbfb('0x10')]['voiceAgentReport']=function(_0xdfaa7d){if(_[_0xbbfb('0x49')](_0xdfaa7d)){_0xdfaa7d[_0xbbfb('0x4a')](function(_0x56df62){RpcVoiceAgentReport['create'](_0x56df62);});}else{RpcVoiceAgentReport[_0xbbfb('0x2d')](_0xdfaa7d);}};Report[_0xbbfb('0x10')]['voiceDialReport']=function(_0x443a4f){RpcVoiceDialReport['create'](_0x443a4f);var _0x557edc=undefined;var _0x2b8a1d=_0x443a4f['channel'];if(_['startsWith'](_0x2b8a1d,_0xbbfb('0x4b'))){var _0x58fbae=_0x2b8a1d[_0xbbfb('0x4c')](_0x2b8a1d[_0xbbfb('0x4d')]('/')+0x1,_0x2b8a1d[_0xbbfb('0x4d')]('@'));_0x557edc=_[_0xbbfb('0x1f')](this[_0xbbfb('0xf')],function(_0x88706b){return _0x88706b[_0xbbfb('0x4e')]==_0x58fbae||_0x88706b[_0xbbfb('0x4f')]==_0x58fbae||_0x88706b['accountcode']==_0x58fbae;});}else{var _0x58fbae=_0x2b8a1d[_0xbbfb('0x4c')](_0x2b8a1d[_0xbbfb('0x4d')]('/')+0x1,_0x2b8a1d[_0xbbfb('0x50')]('-'));_0x557edc=this['findAgent'](_0x58fbae);}if(_0x557edc){_0x443a4f[_0xbbfb('0x24')]=_[_0xbbfb('0x22')](_0x557edc[_0xbbfb('0x24')])?util[_0xbbfb('0x2a')](_0xbbfb('0x25'),_0x557edc[_0xbbfb('0x21')]):_0x557edc[_0xbbfb('0x24')];_0x443a4f[_0xbbfb('0x47')]=_0x557edc['name'];_0x443a4f[_0xbbfb('0x20')]=_0x557edc[_0xbbfb('0x20')];RpcMemberReport[_0xbbfb('0x1a')](_0x443a4f);}};Report['prototype']['blindTransfer']=function(_0x15857d){RpcVoiceTransferReport[_0xbbfb('0x1c')](_0x15857d);};Report[_0xbbfb('0x10')]['attendedTransfer']=function(_0x8b8fbd){RpcVoiceTransferReport['attendedTransfer'](_0x8b8fbd);};module[_0xbbfb('0x51')]=Report; \ No newline at end of file diff --git a/server/services/ami/report/userReport.js b/server/services/ami/report/userReport.js index ab4ff5d..82240a6 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 _0x70b1=['catch','inspect','prototype','resolve','actionSipShowRegistry','[loopSyncRealTimeShow]','isNotNull','isUndefined','emit','username','merge','omit','event','state','format','trunk:%s','[syncRegistry][UserReport]','device','local','toLowerCase','stateTime','toNumber','updateStatusRealtime','telephone:%s','name','telephone:save','trunk:save','startsWith','Queue','Local','substring','indexOf','find','mobile','phone','accountcode','[syncDeviceState][UserReport]','peer','peerstatus','registered','status','address','[syncPeerStatus][UserReport]','exports','lodash','moment','bluebird','util','ioredis','../../../config/environment','../../../config/logger','ami','redis','socket.io-emitter','trunks','agents','telephones','registryentry','syncRegistry','registry','bind','syncDeviceState','syncPeerStatus','loopSyncRealTimeShow','then','actionDeviceStateList','actionSipPeerStatus'];(function(_0x3f6e76,_0x4ea46a){var _0x4c5b01=function(_0x1a6d4a){while(--_0x1a6d4a){_0x3f6e76['push'](_0x3f6e76['shift']());}};_0x4c5b01(++_0x4ea46a);}(_0x70b1,0x138));var _0x170b=function(_0x4fd701,_0x4dd637){_0x4fd701=_0x4fd701-0x0;var _0xb61e42=_0x70b1[_0x4fd701];return _0xb61e42;};'use strict';var _=require(_0x170b('0x0'));var moment=require(_0x170b('0x1'));var BPromise=require(_0x170b('0x2'));var util=require(_0x170b('0x3'));var Redis=require(_0x170b('0x4'));var config=require(_0x170b('0x5'));var logger=require(_0x170b('0x6'))(_0x170b('0x7'));var ami=require('../ami');config[_0x170b('0x8')]=_['defaults'](config[_0x170b('0x8')],{'host':'localhost','port':0x18eb});var io=require(_0x170b('0x9'))(new Redis(config[_0x170b('0x8')]));function UserReport(_0x2a8968){this[_0x170b('0xa')]=_0x2a8968[_0x170b('0xa')];this[_0x170b('0xb')]=_0x2a8968[_0x170b('0xb')];this['telephones']=_0x2a8968[_0x170b('0xc')];ami['on'](_0x170b('0xd'),this[_0x170b('0xe')]['bind'](this));ami['on'](_0x170b('0xf'),this['syncRegistry'][_0x170b('0x10')](this));ami['on']('devicestatechange',this[_0x170b('0x11')][_0x170b('0x10')](this));ami['on']('peerstatus',this[_0x170b('0x12')][_0x170b('0x10')](this));this[_0x170b('0x13')]();return BPromise['resolve']()['then'](ami['actionSipShowRegistry']())[_0x170b('0x14')](ami[_0x170b('0x15')]())[_0x170b('0x14')](ami[_0x170b('0x16')]())[_0x170b('0x17')](loggerCatch('[loopSyncRealTimeShow]'));}function loggerCatch(_0x386ba7){return function(_0x5e2133){logger['error'](_0x386ba7,util[_0x170b('0x18')](_0x5e2133,{'showHidden':![],'depth':null}));};}UserReport[_0x170b('0x19')][_0x170b('0x13')]=function(){setInterval(function(){BPromise[_0x170b('0x1a')]()[_0x170b('0x14')](ami[_0x170b('0x1b')]())[_0x170b('0x14')](ami[_0x170b('0x15')]())[_0x170b('0x14')](ami['actionSipPeerStatus']())[_0x170b('0x17')](loggerCatch(_0x170b('0x1c')));},0x32c8);};UserReport[_0x170b('0x19')][_0x170b('0x1d')]=function(_0x4e2594){return _0x4e2594!==null&&!_[_0x170b('0x1e')](_0x4e2594);};UserReport[_0x170b('0x19')][_0x170b('0x1f')]=function(_0x1164ac,_0x5b5fb7,_0x622c8a){io['to'](_0x1164ac)[_0x170b('0x1f')](_0x5b5fb7,_0x622c8a);};UserReport[_0x170b('0x19')][_0x170b('0xe')]=function(_0xd14f1c){try{if(this[_0x170b('0x1d')](_0xd14f1c)){var _0x4817f9=_['find'](this[_0x170b('0xa')],{'registry':_0xd14f1c[_0x170b('0x20')]});if(_0x4817f9){_0xd14f1c['stateRegistry']=_0xd14f1c['state'];_[_0x170b('0x21')](_0x4817f9,_[_0x170b('0x22')](_0xd14f1c,[_0x170b('0x23'),'actionid',_0x170b('0x20'),_0x170b('0x24')]));this[_0x170b('0x1f')](util[_0x170b('0x25')](_0x170b('0x26'),_0x4817f9['name']),'trunk:save',_0x4817f9);}}}catch(_0x104b32){logger['error'](_0x170b('0x27'),util['inspect'](_0x104b32,{'showHidden':![],'depth':null}));}};UserReport[_0x170b('0x19')][_0x170b('0x11')]=function(_0x5ec067){try{if(this[_0x170b('0x1d')](_0x5ec067)){if(this[_0x170b('0xb')][_0x5ec067[_0x170b('0x28')]]){if(!this[_0x170b('0xb')][_0x5ec067['device']][_0x170b('0x29')]||_0x5ec067[_0x170b('0x24')][_0x170b('0x2a')]()=='inuse'){this[_0x170b('0xb')][_0x5ec067[_0x170b('0x28')]][_0x170b('0x29')]=![];if(this['agents'][_0x5ec067[_0x170b('0x28')]][_0x170b('0x24')]!==_0x5ec067[_0x170b('0x24')][_0x170b('0x2a')]()){this[_0x170b('0xb')][_0x5ec067[_0x170b('0x28')]][_0x170b('0x2b')]=_[_0x170b('0x2c')](moment()[_0x170b('0x25')]('x'));}this[_0x170b('0xb')][_0x5ec067[_0x170b('0x28')]][_0x170b('0x24')]=_0x5ec067['state']['toLowerCase']();this['agents'][_0x5ec067[_0x170b('0x28')]][_0x170b('0x2d')](_0x5ec067);}}else if(this[_0x170b('0xc')][_0x5ec067['device']]){if(this[_0x170b('0xc')][_0x5ec067[_0x170b('0x28')]][_0x170b('0x24')]!==_0x5ec067[_0x170b('0x24')][_0x170b('0x2a')]()){this[_0x170b('0xc')][_0x5ec067[_0x170b('0x28')]][_0x170b('0x2b')]=_['toNumber'](moment()[_0x170b('0x25')]('x'));}this[_0x170b('0xc')][_0x5ec067[_0x170b('0x28')]][_0x170b('0x24')]=_0x5ec067[_0x170b('0x24')][_0x170b('0x2a')]();this[_0x170b('0x1f')](util['format'](_0x170b('0x2e'),this[_0x170b('0xc')][_0x5ec067[_0x170b('0x28')]][_0x170b('0x2f')]),_0x170b('0x30'),this['telephones'][_0x5ec067[_0x170b('0x28')]]);}else if(this[_0x170b('0xa')][_0x5ec067[_0x170b('0x28')]]){if(this['trunks'][_0x5ec067[_0x170b('0x28')]][_0x170b('0x24')]!==_0x5ec067['state'][_0x170b('0x2a')]()){this[_0x170b('0xa')][_0x5ec067['device']][_0x170b('0x2b')]=_[_0x170b('0x2c')](moment()[_0x170b('0x25')]('x'));}this['trunks'][_0x5ec067['device']][_0x170b('0x24')]=_0x5ec067[_0x170b('0x24')][_0x170b('0x2a')]();this[_0x170b('0x1f')](util[_0x170b('0x25')]('trunk:%s',this[_0x170b('0xa')][_0x5ec067[_0x170b('0x28')]][_0x170b('0x2f')]),_0x170b('0x31'),this[_0x170b('0xa')][_0x5ec067[_0x170b('0x28')]]);}else if(_[_0x170b('0x32')](_0x5ec067[_0x170b('0x28')],_0x170b('0x33'))){}else if(_[_0x170b('0x32')](_0x5ec067[_0x170b('0x28')],_0x170b('0x34'))){var _0x1a28dd=_0x5ec067[_0x170b('0x28')];var _0x33b393=_0x1a28dd[_0x170b('0x35')](_0x1a28dd['indexOf']('/')+0x1,_0x1a28dd[_0x170b('0x36')]('@'));var _0x1592e9=_[_0x170b('0x37')](this[_0x170b('0xb')],function(_0xe4b9ab){return _0xe4b9ab[_0x170b('0x38')]==_0x33b393||_0xe4b9ab[_0x170b('0x39')]==_0x33b393||_0xe4b9ab[_0x170b('0x3a')]==_0x33b393;});if(_0x1592e9){if(_0x1592e9['state']!==_0x5ec067[_0x170b('0x24')][_0x170b('0x2a')]()){_0x1592e9[_0x170b('0x2b')]=_[_0x170b('0x2c')](moment()[_0x170b('0x25')]('x'));}_0x1592e9[_0x170b('0x24')]=_0x5ec067[_0x170b('0x24')]['toLowerCase']();_0x1592e9['local']=!![];_0x1592e9[_0x170b('0x2d')](_0x5ec067);}}else{}}}catch(_0x41717e){logger['error'](_0x170b('0x3b'),util['inspect'](_0x41717e,{'showHidden':![],'depth':null}));}};UserReport[_0x170b('0x19')][_0x170b('0x12')]=function(_0x46687a){try{if(this[_0x170b('0x1d')](_0x46687a)&&this[_0x170b('0x1d')](_0x46687a['peerstatus'])){if(this['agents'][_0x46687a[_0x170b('0x3c')]]){if(!this['agents'][_0x46687a[_0x170b('0x3c')]][_0x170b('0x29')]||_0x46687a[_0x170b('0x3d')][_0x170b('0x2a')]()==_0x170b('0x3e')){this[_0x170b('0xb')][_0x46687a[_0x170b('0x3c')]][_0x170b('0x29')]=![];this[_0x170b('0xb')][_0x46687a[_0x170b('0x3c')]][_0x170b('0x3f')]=_0x46687a['peerstatus'][_0x170b('0x2a')]();this[_0x170b('0xb')][_0x46687a[_0x170b('0x3c')]][_0x170b('0x40')]=_0x46687a[_0x170b('0x40')];this[_0x170b('0xb')][_0x46687a['peer']][_0x170b('0x2d')](_0x46687a);}}else if(this[_0x170b('0xc')][_0x46687a[_0x170b('0x3c')]]){this[_0x170b('0xc')][_0x46687a['peer']][_0x170b('0x3f')]=_0x46687a[_0x170b('0x3d')][_0x170b('0x2a')]();this['telephones'][_0x46687a['peer']][_0x170b('0x40')]=_0x46687a[_0x170b('0x40')];this[_0x170b('0x1f')](util[_0x170b('0x25')](_0x170b('0x2e'),this['telephones'][_0x46687a[_0x170b('0x3c')]][_0x170b('0x2f')]),'telephone:save',this[_0x170b('0xc')][_0x46687a[_0x170b('0x3c')]]);}else if(this[_0x170b('0xa')][_0x46687a[_0x170b('0x3c')]]){this['trunks'][_0x46687a[_0x170b('0x3c')]][_0x170b('0x3f')]=_0x46687a[_0x170b('0x3d')][_0x170b('0x2a')]();this[_0x170b('0xa')][_0x46687a['peer']][_0x170b('0x40')]=_0x46687a[_0x170b('0x40')];this[_0x170b('0x1f')](util[_0x170b('0x25')](_0x170b('0x26'),this[_0x170b('0xa')][_0x46687a['peer']][_0x170b('0x2f')]),'trunk:save',this[_0x170b('0xa')][_0x46687a[_0x170b('0x3c')]]);}else{}}}catch(_0x44bb25){logger['error'](_0x170b('0x41'),util[_0x170b('0x18')](_0x44bb25,{'showHidden':![],'depth':null}));}};module[_0x170b('0x42')]=UserReport; \ No newline at end of file +var _0x8f8e=['isNotNull','emit','find','username','stateRegistry','merge','omit','event','state','format','name','[syncRegistry][UserReport]','device','local','inuse','toLowerCase','stateTime','toNumber','updateStatusRealtime','telephone:save','trunk:%s','trunk:save','startsWith','Local','substring','indexOf','mobile','accountcode','[syncDeviceState][UserReport]','syncPeerStatus','peer','registered','address','status','[syncPeerStatus][UserReport]','exports','moment','bluebird','util','ioredis','../../../config/environment','../../../config/logger','ami','../ami','redis','localhost','socket.io-emitter','trunks','agents','telephones','registryentry','syncRegistry','bind','devicestatechange','syncDeviceState','peerstatus','resolve','then','actionSipPeerStatus','catch','[loopSyncRealTimeShow]','error','inspect','prototype','actionSipShowRegistry'];(function(_0x58e469,_0x95ee3e){var _0x4c01c5=function(_0x1ef7ae){while(--_0x1ef7ae){_0x58e469['push'](_0x58e469['shift']());}};_0x4c01c5(++_0x95ee3e);}(_0x8f8e,0x128));var _0xe8f8=function(_0xa6cc5c,_0x239c99){_0xa6cc5c=_0xa6cc5c-0x0;var _0x44803d=_0x8f8e[_0xa6cc5c];return _0x44803d;};'use strict';var _=require('lodash');var moment=require(_0xe8f8('0x0'));var BPromise=require(_0xe8f8('0x1'));var util=require(_0xe8f8('0x2'));var Redis=require(_0xe8f8('0x3'));var config=require(_0xe8f8('0x4'));var logger=require(_0xe8f8('0x5'))(_0xe8f8('0x6'));var ami=require(_0xe8f8('0x7'));config[_0xe8f8('0x8')]=_['defaults'](config[_0xe8f8('0x8')],{'host':_0xe8f8('0x9'),'port':0x18eb});var io=require(_0xe8f8('0xa'))(new Redis(config['redis']));function UserReport(_0x5b52b2){this[_0xe8f8('0xb')]=_0x5b52b2[_0xe8f8('0xb')];this['agents']=_0x5b52b2[_0xe8f8('0xc')];this['telephones']=_0x5b52b2[_0xe8f8('0xd')];ami['on'](_0xe8f8('0xe'),this[_0xe8f8('0xf')][_0xe8f8('0x10')](this));ami['on']('registry',this[_0xe8f8('0xf')]['bind'](this));ami['on'](_0xe8f8('0x11'),this[_0xe8f8('0x12')][_0xe8f8('0x10')](this));ami['on'](_0xe8f8('0x13'),this['syncPeerStatus'][_0xe8f8('0x10')](this));this['loopSyncRealTimeShow']();return BPromise[_0xe8f8('0x14')]()['then'](ami['actionSipShowRegistry']())[_0xe8f8('0x15')](ami['actionDeviceStateList']())[_0xe8f8('0x15')](ami[_0xe8f8('0x16')]())[_0xe8f8('0x17')](loggerCatch(_0xe8f8('0x18')));}function loggerCatch(_0x8bf89a){return function(_0x689efd){logger[_0xe8f8('0x19')](_0x8bf89a,util[_0xe8f8('0x1a')](_0x689efd,{'showHidden':![],'depth':null}));};}UserReport[_0xe8f8('0x1b')]['loopSyncRealTimeShow']=function(){setInterval(function(){BPromise[_0xe8f8('0x14')]()['then'](ami[_0xe8f8('0x1c')]())[_0xe8f8('0x15')](ami['actionDeviceStateList']())[_0xe8f8('0x15')](ami[_0xe8f8('0x16')]())[_0xe8f8('0x17')](loggerCatch('[loopSyncRealTimeShow]'));},0x32c8);};UserReport[_0xe8f8('0x1b')][_0xe8f8('0x1d')]=function(_0x259f33){return _0x259f33!==null&&!_['isUndefined'](_0x259f33);};UserReport['prototype'][_0xe8f8('0x1e')]=function(_0x4f58d4,_0x543d6c,_0x4663a1){io['to'](_0x4f58d4)[_0xe8f8('0x1e')](_0x543d6c,_0x4663a1);};UserReport[_0xe8f8('0x1b')][_0xe8f8('0xf')]=function(_0x4f3d00){try{if(this[_0xe8f8('0x1d')](_0x4f3d00)){var _0x2a8b2a=_[_0xe8f8('0x1f')](this[_0xe8f8('0xb')],{'registry':_0x4f3d00[_0xe8f8('0x20')]});if(_0x2a8b2a){_0x4f3d00[_0xe8f8('0x21')]=_0x4f3d00['state'];_[_0xe8f8('0x22')](_0x2a8b2a,_[_0xe8f8('0x23')](_0x4f3d00,[_0xe8f8('0x24'),'actionid',_0xe8f8('0x20'),_0xe8f8('0x25')]));this[_0xe8f8('0x1e')](util[_0xe8f8('0x26')]('trunk:%s',_0x2a8b2a[_0xe8f8('0x27')]),'trunk:save',_0x2a8b2a);}}}catch(_0x1a9ad5){logger[_0xe8f8('0x19')](_0xe8f8('0x28'),util[_0xe8f8('0x1a')](_0x1a9ad5,{'showHidden':![],'depth':null}));}};UserReport[_0xe8f8('0x1b')][_0xe8f8('0x12')]=function(_0x5036e8){try{if(this[_0xe8f8('0x1d')](_0x5036e8)){if(this[_0xe8f8('0xc')][_0x5036e8['device']]){if(!this[_0xe8f8('0xc')][_0x5036e8[_0xe8f8('0x29')]][_0xe8f8('0x2a')]||_0x5036e8[_0xe8f8('0x25')]['toLowerCase']()==_0xe8f8('0x2b')){this[_0xe8f8('0xc')][_0x5036e8[_0xe8f8('0x29')]]['local']=![];if(this['agents'][_0x5036e8[_0xe8f8('0x29')]]['state']!==_0x5036e8['state'][_0xe8f8('0x2c')]()){this['agents'][_0x5036e8[_0xe8f8('0x29')]][_0xe8f8('0x2d')]=_[_0xe8f8('0x2e')](moment()[_0xe8f8('0x26')]('x'));}this[_0xe8f8('0xc')][_0x5036e8[_0xe8f8('0x29')]]['state']=_0x5036e8[_0xe8f8('0x25')][_0xe8f8('0x2c')]();this[_0xe8f8('0xc')][_0x5036e8['device']][_0xe8f8('0x2f')](_0x5036e8);}}else if(this['telephones'][_0x5036e8[_0xe8f8('0x29')]]){if(this['telephones'][_0x5036e8[_0xe8f8('0x29')]][_0xe8f8('0x25')]!==_0x5036e8['state']['toLowerCase']()){this[_0xe8f8('0xd')][_0x5036e8['device']][_0xe8f8('0x2d')]=_[_0xe8f8('0x2e')](moment()['format']('x'));}this['telephones'][_0x5036e8[_0xe8f8('0x29')]][_0xe8f8('0x25')]=_0x5036e8[_0xe8f8('0x25')]['toLowerCase']();this['emit'](util['format']('telephone:%s',this[_0xe8f8('0xd')][_0x5036e8['device']]['name']),_0xe8f8('0x30'),this['telephones'][_0x5036e8[_0xe8f8('0x29')]]);}else if(this[_0xe8f8('0xb')][_0x5036e8[_0xe8f8('0x29')]]){if(this[_0xe8f8('0xb')][_0x5036e8[_0xe8f8('0x29')]][_0xe8f8('0x25')]!==_0x5036e8[_0xe8f8('0x25')][_0xe8f8('0x2c')]()){this[_0xe8f8('0xb')][_0x5036e8['device']]['stateTime']=_['toNumber'](moment()[_0xe8f8('0x26')]('x'));}this['trunks'][_0x5036e8[_0xe8f8('0x29')]][_0xe8f8('0x25')]=_0x5036e8[_0xe8f8('0x25')]['toLowerCase']();this[_0xe8f8('0x1e')](util[_0xe8f8('0x26')](_0xe8f8('0x31'),this[_0xe8f8('0xb')][_0x5036e8[_0xe8f8('0x29')]]['name']),_0xe8f8('0x32'),this['trunks'][_0x5036e8[_0xe8f8('0x29')]]);}else if(_[_0xe8f8('0x33')](_0x5036e8[_0xe8f8('0x29')],'Queue')){}else if(_[_0xe8f8('0x33')](_0x5036e8[_0xe8f8('0x29')],_0xe8f8('0x34'))){var _0x39d5a3=_0x5036e8[_0xe8f8('0x29')];var _0x40799e=_0x39d5a3[_0xe8f8('0x35')](_0x39d5a3['indexOf']('/')+0x1,_0x39d5a3[_0xe8f8('0x36')]('@'));var _0xc753ac=_[_0xe8f8('0x1f')](this[_0xe8f8('0xc')],function(_0x59c20e){return _0x59c20e[_0xe8f8('0x37')]==_0x40799e||_0x59c20e['phone']==_0x40799e||_0x59c20e[_0xe8f8('0x38')]==_0x40799e;});if(_0xc753ac){if(_0xc753ac['state']!==_0x5036e8['state'][_0xe8f8('0x2c')]()){_0xc753ac[_0xe8f8('0x2d')]=_[_0xe8f8('0x2e')](moment()[_0xe8f8('0x26')]('x'));}_0xc753ac[_0xe8f8('0x25')]=_0x5036e8['state']['toLowerCase']();_0xc753ac[_0xe8f8('0x2a')]=!![];_0xc753ac['updateStatusRealtime'](_0x5036e8);}}else{}}}catch(_0x5f0c14){logger['error'](_0xe8f8('0x39'),util['inspect'](_0x5f0c14,{'showHidden':![],'depth':null}));}};UserReport['prototype'][_0xe8f8('0x3a')]=function(_0x327aae){try{if(this[_0xe8f8('0x1d')](_0x327aae)&&this[_0xe8f8('0x1d')](_0x327aae[_0xe8f8('0x13')])){if(this['agents'][_0x327aae['peer']]){if(!this[_0xe8f8('0xc')][_0x327aae[_0xe8f8('0x3b')]]['local']||_0x327aae[_0xe8f8('0x13')][_0xe8f8('0x2c')]()==_0xe8f8('0x3c')){this[_0xe8f8('0xc')][_0x327aae[_0xe8f8('0x3b')]]['local']=![];this[_0xe8f8('0xc')][_0x327aae[_0xe8f8('0x3b')]]['status']=_0x327aae[_0xe8f8('0x13')][_0xe8f8('0x2c')]();this[_0xe8f8('0xc')][_0x327aae[_0xe8f8('0x3b')]][_0xe8f8('0x3d')]=_0x327aae[_0xe8f8('0x3d')];this[_0xe8f8('0xc')][_0x327aae[_0xe8f8('0x3b')]][_0xe8f8('0x2f')](_0x327aae);}}else if(this[_0xe8f8('0xd')][_0x327aae[_0xe8f8('0x3b')]]){this[_0xe8f8('0xd')][_0x327aae[_0xe8f8('0x3b')]][_0xe8f8('0x3e')]=_0x327aae[_0xe8f8('0x13')][_0xe8f8('0x2c')]();this[_0xe8f8('0xd')][_0x327aae[_0xe8f8('0x3b')]]['address']=_0x327aae[_0xe8f8('0x3d')];this[_0xe8f8('0x1e')](util[_0xe8f8('0x26')]('telephone:%s',this[_0xe8f8('0xd')][_0x327aae[_0xe8f8('0x3b')]][_0xe8f8('0x27')]),'telephone:save',this[_0xe8f8('0xd')][_0x327aae[_0xe8f8('0x3b')]]);}else if(this[_0xe8f8('0xb')][_0x327aae[_0xe8f8('0x3b')]]){this[_0xe8f8('0xb')][_0x327aae['peer']]['status']=_0x327aae[_0xe8f8('0x13')][_0xe8f8('0x2c')]();this[_0xe8f8('0xb')][_0x327aae[_0xe8f8('0x3b')]][_0xe8f8('0x3d')]=_0x327aae[_0xe8f8('0x3d')];this[_0xe8f8('0x1e')](util[_0xe8f8('0x26')](_0xe8f8('0x31'),this[_0xe8f8('0xb')][_0x327aae[_0xe8f8('0x3b')]][_0xe8f8('0x27')]),'trunk:save',this[_0xe8f8('0xb')][_0x327aae[_0xe8f8('0x3b')]]);}else{}}}catch(_0x3e97cc){logger[_0xe8f8('0x19')](_0xe8f8('0x3f'),util[_0xe8f8('0x1a')](_0x3e97cc,{'showHidden':![],'depth':null}));}};module[_0xe8f8('0x40')]=UserReport; \ No newline at end of file diff --git a/server/services/ami/report/voiceAgentReport.js b/server/services/ami/report/voiceAgentReport.js index e91765b..46c469e 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 _0x7801=['syncAgentComplete','varset','syncVarSet','hangup','syncHangup','syncMusicOnHoldStart','musiconholdstop','syncMusicOnHoldStop','blindtransfer','prototype','isNotNull','isUndefined','uniqueid','destuniqueid','format','queue','type','inbound','merge','event','privilege','emit','custom:agentcalled','user:called','error','[syncAgentCalled][VoiceAgentReport]','hasOwnProperty','agentconnectAt','YYYY-MM-DD\x20HH:mm:ss','lastevent','connect','holdtime','destchannelstate','destchannelstatedesc','pick','user:%s','membername','user:agentconnect','custom:agentconnect','agentringnoanswer','agentringnoanswerAt','reason','answered_elsewhere','answeredelsewheredestinationuniqueid','answeredelsewheremembername','custom:agentansweredelsewhere','[syncAgentConnect][VoiceAgentReport]','inspect','rejected','syncQueueCallerAbandon','custom:agentqueuecallerabandon','[syncQueueCallerAbandon][VoiceAgentReport]','agentcompleteAt','talktime','transfer','agent','acw','agentacw','acwtime','acwTimeout','interface','omit','destconnectedlinenum','user:agentcomplete','[syncAgentComplete][VoiceAgentReport]','addVariable','keys','variable','value','[syncVarSet][VoiceAgentReport]','rtpaudioqosjitter','rtpaudioqosloss','rtpaudioqoslossbridged','rtpaudioqosrtt','rtpaudioqosrttbridged','sipcallid','memberdynamic','memberinterface','memberpenalty','memberrealtime','isNil','includes','custom:voiceAgentReport','values','[syncHangup][VoiceAgentReport]','transfereeuniqueid','origtransfereruniqueid','complete','diff','secondtransfereruniqueid','[syncAttendedTransfer][VoiceAgentReport]','syncBlindTransfer','seconds','[syncBlindTransfer][VoiceAgentReport]','channel','substring','lastIndexOf','onhold','[syncMusicOnHoldStop][VoiceAgentReport]','exports','lodash','moment','util','../../../config/environment','../../../config/logger','ami','../ami','redis','defaults','localhost','socket.io-emitter','channels','voiceQueues','agents','variables','syncAgentCalled','bind','syncAgentConnect','syncAgentRingNoAnswer','queuecallerabandon','agentcomplete'];(function(_0x1f40f4,_0x25f7d6){var _0x3f8e4a=function(_0xfbba9){while(--_0xfbba9){_0x1f40f4['push'](_0x1f40f4['shift']());}};_0x3f8e4a(++_0x25f7d6);}(_0x7801,0x1cf));var _0x1780=function(_0x5608a3,_0x5b33c5){_0x5608a3=_0x5608a3-0x0;var _0x1ed50a=_0x7801[_0x5608a3];return _0x1ed50a;};'use strict';var _=require(_0x1780('0x0'));var moment=require(_0x1780('0x1'));var util=require(_0x1780('0x2'));var Redis=require('ioredis');var config=require(_0x1780('0x3'));var logger=require(_0x1780('0x4'))(_0x1780('0x5'));var ami=require(_0x1780('0x6'));config[_0x1780('0x7')]=_[_0x1780('0x8')](config[_0x1780('0x7')],{'host':_0x1780('0x9'),'port':0x18eb});var io=require(_0x1780('0xa'))(new Redis(config[_0x1780('0x7')]));function VoiceAgentReport(_0x2a885d){this[_0x1780('0xb')]={};this[_0x1780('0xc')]=_0x2a885d[_0x1780('0xc')];this[_0x1780('0xd')]=_0x2a885d[_0x1780('0xd')];this[_0x1780('0xe')]={};ami['on']('agentcalled',this[_0x1780('0xf')][_0x1780('0x10')](this));ami['on']('agentconnect',this[_0x1780('0x11')][_0x1780('0x10')](this));ami['on']('agentringnoanswer',this[_0x1780('0x12')]['bind'](this));ami['on'](_0x1780('0x13'),this['syncQueueCallerAbandon'][_0x1780('0x10')](this));ami['on'](_0x1780('0x14'),this[_0x1780('0x15')][_0x1780('0x10')](this));ami['on'](_0x1780('0x16'),this[_0x1780('0x17')][_0x1780('0x10')](this));ami['on'](_0x1780('0x18'),this[_0x1780('0x19')][_0x1780('0x10')](this));ami['on']('musiconholdstart',this[_0x1780('0x1a')][_0x1780('0x10')](this));ami['on'](_0x1780('0x1b'),this[_0x1780('0x1c')][_0x1780('0x10')](this));ami['on']('attendedtransfer',this['syncAttendedTransfer'][_0x1780('0x10')](this));ami['on'](_0x1780('0x1d'),this['syncBlindTransfer'][_0x1780('0x10')](this));}VoiceAgentReport[_0x1780('0x1e')]['emit']=function(_0x27e311,_0x3dd968,_0x2878ea){io['to'](_0x27e311)['emit'](_0x3dd968,_0x2878ea);};VoiceAgentReport[_0x1780('0x1e')][_0x1780('0x1f')]=function(_0x63b91f){return _0x63b91f!==null&&!_[_0x1780('0x20')](_0x63b91f);};VoiceAgentReport[_0x1780('0x1e')]['syncAgentCalled']=function(_0x4288f7){try{if(this['isNotNull'](_0x4288f7)){if(_['isUndefined'](this[_0x1780('0xb')][_0x4288f7[_0x1780('0x21')]])){this[_0x1780('0xb')][_0x4288f7[_0x1780('0x21')]]={};}if(_[_0x1780('0x20')](this[_0x1780('0xb')][_0x4288f7[_0x1780('0x21')]][_0x4288f7[_0x1780('0x22')]])){this[_0x1780('0xb')][_0x4288f7[_0x1780('0x21')]][_0x4288f7[_0x1780('0x22')]]={'agentcalledAt':moment()[_0x1780('0x23')]('YYYY-MM-DD\x20HH:mm:ss'),'lastevent':'called','variables':this[_0x1780('0xe')][_0x4288f7[_0x1780('0x21')]],'type':this[_0x1780('0xc')][_0x4288f7[_0x1780('0x24')]]?this['voiceQueues'][_0x4288f7[_0x1780('0x24')]][_0x1780('0x25')]||_0x1780('0x26'):_0x1780('0x26')};}_[_0x1780('0x27')](this[_0x1780('0xb')][_0x4288f7[_0x1780('0x21')]][_0x4288f7[_0x1780('0x22')]],_['omit'](_0x4288f7,[_0x1780('0x28'),_0x1780('0x29')]));ami[_0x1780('0x2a')](_0x1780('0x2b'),this[_0x1780('0xb')][_0x4288f7['uniqueid']][_0x4288f7[_0x1780('0x22')]]);this[_0x1780('0x2a')](util[_0x1780('0x23')]('user:%s',_0x4288f7['membername']),_0x1780('0x2c'),this[_0x1780('0xb')][_0x4288f7[_0x1780('0x21')]][_0x4288f7['destuniqueid']]);}}catch(_0x31b1e6){logger[_0x1780('0x2d')](_0x1780('0x2e'),util['inspect'](_0x31b1e6,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0x1780('0x1e')][_0x1780('0x11')]=function(_0xfd8560){try{if(this[_0x1780('0x1f')](_0xfd8560)){if(this[_0x1780('0xb')][_0xfd8560['uniqueid']]){for(var _0x3b0d22 in this[_0x1780('0xb')][_0xfd8560[_0x1780('0x21')]]){if(this[_0x1780('0xb')][_0xfd8560['uniqueid']][_0x1780('0x2f')](_0x3b0d22)){if(_0xfd8560[_0x1780('0x22')]===_0x3b0d22){this['channels'][_0xfd8560[_0x1780('0x21')]][_0x3b0d22][_0x1780('0x30')]=moment()['format'](_0x1780('0x31'));this[_0x1780('0xb')][_0xfd8560['uniqueid']][_0x3b0d22][_0x1780('0x32')]=_0x1780('0x33');this['channels'][_0xfd8560['uniqueid']][_0x3b0d22][_0x1780('0x34')]=_0xfd8560[_0x1780('0x34')];this[_0x1780('0xb')][_0xfd8560[_0x1780('0x21')]][_0x3b0d22]['connectedlinenum']=_0xfd8560['connectedlinenum'];this[_0x1780('0xb')][_0xfd8560[_0x1780('0x21')]][_0x3b0d22]['connectedlinename']=_0xfd8560['connectedlinename'];this[_0x1780('0xb')][_0xfd8560['uniqueid']][_0x3b0d22]['destchannelstate']=_0xfd8560[_0x1780('0x35')];this[_0x1780('0xb')][_0xfd8560['uniqueid']][_0x3b0d22][_0x1780('0x36')]=_0xfd8560[_0x1780('0x36')];_[_0x1780('0x27')](this[_0x1780('0xd')][_0xfd8560['interface']],_[_0x1780('0x37')](_0xfd8560,['queue','destconnectedlinenum']));this[_0x1780('0x2a')](util[_0x1780('0x23')](_0x1780('0x38'),_0xfd8560[_0x1780('0x39')]),_0x1780('0x3a'),this[_0x1780('0xb')][_0xfd8560[_0x1780('0x21')]][_0xfd8560[_0x1780('0x22')]]);ami['emit'](_0x1780('0x3b'),this[_0x1780('0xb')][_0xfd8560['uniqueid']][_0x3b0d22]);}else if(!this[_0x1780('0xb')][_0xfd8560[_0x1780('0x21')]][_0x3b0d22][_0x1780('0x3c')]&&!this['channels'][_0xfd8560['uniqueid']][_0x3b0d22]['agentcomplete']){this['channels'][_0xfd8560['uniqueid']][_0x3b0d22][_0x1780('0x3c')]=!![];this[_0x1780('0xb')][_0xfd8560['uniqueid']][_0x3b0d22][_0x1780('0x3d')]=moment()[_0x1780('0x23')](_0x1780('0x31'));this['channels'][_0xfd8560['uniqueid']][_0x3b0d22][_0x1780('0x3e')]='answered_elsewhere';this[_0x1780('0xb')][_0xfd8560[_0x1780('0x21')]][_0x3b0d22][_0x1780('0x32')]=_0x1780('0x3f');this[_0x1780('0xb')][_0xfd8560['uniqueid']][_0x3b0d22][_0x1780('0x40')]=_0xfd8560[_0x1780('0x22')];this[_0x1780('0xb')][_0xfd8560[_0x1780('0x21')]][_0x3b0d22][_0x1780('0x41')]=_0xfd8560['membername'];ami[_0x1780('0x2a')](_0x1780('0x42'),this[_0x1780('0xb')][_0xfd8560[_0x1780('0x21')]][_0x3b0d22]);}}}}}}catch(_0x46cfd9){logger['error'](_0x1780('0x43'),util[_0x1780('0x44')](_0x46cfd9,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0x1780('0x1e')]['syncAgentRingNoAnswer']=function(_0x2ee04e){try{if(this['isNotNull'](_0x2ee04e)){if(this['channels'][_0x2ee04e[_0x1780('0x21')]]&&this[_0x1780('0xb')][_0x2ee04e[_0x1780('0x21')]][_0x2ee04e[_0x1780('0x22')]]){this[_0x1780('0xb')][_0x2ee04e['uniqueid']][_0x2ee04e[_0x1780('0x22')]][_0x1780('0x3c')]=!![];this[_0x1780('0xb')][_0x2ee04e[_0x1780('0x21')]][_0x2ee04e[_0x1780('0x22')]][_0x1780('0x3d')]=moment()[_0x1780('0x23')](_0x1780('0x31'));this[_0x1780('0xb')][_0x2ee04e[_0x1780('0x21')]][_0x2ee04e[_0x1780('0x22')]][_0x1780('0x3e')]='rejected';this[_0x1780('0xb')][_0x2ee04e[_0x1780('0x21')]][_0x2ee04e[_0x1780('0x22')]][_0x1780('0x32')]=_0x1780('0x45');ami[_0x1780('0x2a')]('custom:agentringnoanswer',this[_0x1780('0xb')][_0x2ee04e['uniqueid']][_0x2ee04e[_0x1780('0x22')]]);}}}catch(_0x1500b8){logger[_0x1780('0x2d')]('[syncAgentRingNoAnswer][VoiceAgentReport]',util[_0x1780('0x44')](_0x1500b8,{'showHidden':![],'depth':null}));}};VoiceAgentReport['prototype'][_0x1780('0x46')]=function(_0x5b8393){try{if(this['isNotNull'](_0x5b8393)){if(this[_0x1780('0xb')][_0x5b8393[_0x1780('0x21')]]){for(var _0x235f7d in this[_0x1780('0xb')][_0x5b8393['uniqueid']]){if(this['channels'][_0x5b8393[_0x1780('0x21')]][_0x1780('0x2f')](_0x235f7d)&&!this[_0x1780('0xb')][_0x5b8393[_0x1780('0x21')]][_0x235f7d][_0x1780('0x3c')]&&!this[_0x1780('0xb')][_0x5b8393['uniqueid']][_0x235f7d][_0x1780('0x14')]){this[_0x1780('0xb')][_0x5b8393[_0x1780('0x21')]][_0x235f7d][_0x1780('0x3c')]=!![];this[_0x1780('0xb')][_0x5b8393[_0x1780('0x21')]][_0x235f7d][_0x1780('0x3d')]=moment()[_0x1780('0x23')](_0x1780('0x31'));this[_0x1780('0xb')][_0x5b8393[_0x1780('0x21')]][_0x235f7d][_0x1780('0x3e')]='abandoned';this[_0x1780('0xb')][_0x5b8393[_0x1780('0x21')]][_0x235f7d][_0x1780('0x32')]='abandoned';ami[_0x1780('0x2a')](_0x1780('0x47'),this[_0x1780('0xb')][_0x5b8393['uniqueid']][_0x235f7d]);}}}}}catch(_0x4345a2){logger[_0x1780('0x2d')](_0x1780('0x48'),util['inspect'](_0x4345a2,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0x1780('0x1e')][_0x1780('0x15')]=function(_0x88e9d2){try{if(this[_0x1780('0x1f')](_0x88e9d2)){if(this['channels'][_0x88e9d2[_0x1780('0x21')]]){for(var _0x1dbdb9 in this[_0x1780('0xb')][_0x88e9d2[_0x1780('0x21')]]){if(this[_0x1780('0xb')][_0x88e9d2[_0x1780('0x21')]][_0x1780('0x2f')](_0x1dbdb9)){if(this[_0x1780('0xb')][_0x88e9d2[_0x1780('0x21')]][_0x1dbdb9]['agentconnectAt']&&!this[_0x1780('0xb')][_0x88e9d2[_0x1780('0x21')]][_0x1dbdb9][_0x1780('0x14')]){this[_0x1780('0xb')][_0x88e9d2['uniqueid']][_0x1dbdb9][_0x1780('0x14')]=!![];this[_0x1780('0xb')][_0x88e9d2[_0x1780('0x21')]][_0x1dbdb9][_0x1780('0x49')]=moment()[_0x1780('0x23')](_0x1780('0x31'));this[_0x1780('0xb')][_0x88e9d2['uniqueid']][_0x1dbdb9][_0x1780('0x32')]='complete';this[_0x1780('0xb')][_0x88e9d2['uniqueid']][_0x1dbdb9][_0x1780('0x4a')]=_0x88e9d2[_0x1780('0x4a')];this['channels'][_0x88e9d2['uniqueid']][_0x1dbdb9][_0x1780('0x3e')]=_0x88e9d2['reason']==_0x1780('0x4b')?_0x1780('0x4c'):_0x88e9d2[_0x1780('0x3e')];if(this[_0x1780('0xc')][_0x88e9d2[_0x1780('0x24')]]&&this[_0x1780('0xc')][_0x88e9d2[_0x1780('0x24')]][_0x1780('0x4d')]){this[_0x1780('0xb')][_0x88e9d2[_0x1780('0x21')]][_0x1dbdb9][_0x1780('0x4e')]=!![];this[_0x1780('0xb')][_0x88e9d2[_0x1780('0x21')]][_0x1dbdb9][_0x1780('0x4f')]=this[_0x1780('0xc')][_0x88e9d2['queue']][_0x1780('0x50')];}this[_0x1780('0xd')][_0x88e9d2[_0x1780('0x51')]]=_[_0x1780('0x52')](this[_0x1780('0xd')][_0x88e9d2[_0x1780('0x51')]],[_0x1780('0x24'),_0x1780('0x53')]);this[_0x1780('0x2a')](util[_0x1780('0x23')](_0x1780('0x38'),_0x88e9d2['membername']),_0x1780('0x54'),this[_0x1780('0xb')][_0x88e9d2[_0x1780('0x21')]][_0x1dbdb9]);ami[_0x1780('0x2a')]('custom:agentcomplete',this[_0x1780('0xb')][_0x88e9d2[_0x1780('0x21')]][_0x1dbdb9]);}}}}}}catch(_0x432d18){logger[_0x1780('0x2d')](_0x1780('0x55'),util[_0x1780('0x44')](_0x432d18,{'showHidden':![],'depth':null}));}};VoiceAgentReport['prototype']['syncVarSet']=function(_0x2532a6){try{if(this[_0x1780('0x1f')](_0x2532a6)){this[_0x1780('0x56')](_0x2532a6[_0x1780('0x21')],_[_0x1780('0x57')](_0x2532a6[_0x1780('0x58')])[0x0],_0x2532a6[_0x1780('0x59')]);if(this['channels'][_0x2532a6[_0x1780('0x21')]]){for(var _0x15dd56 in this[_0x1780('0xb')][_0x2532a6[_0x1780('0x21')]]){if(this['channels'][_0x2532a6['uniqueid']][_0x1780('0x2f')](_0x15dd56)){if(_[_0x1780('0x20')](this[_0x1780('0xb')][_0x2532a6[_0x1780('0x21')]][_0x15dd56][_0x1780('0xe')])){this[_0x1780('0xb')][_0x2532a6['uniqueid']][_0x15dd56]['variables']={};}this[_0x1780('0xb')][_0x2532a6[_0x1780('0x21')]][_0x15dd56][_0x1780('0xe')]=this[_0x1780('0xe')][_0x2532a6['uniqueid']];}}}}}catch(_0x55e414){logger[_0x1780('0x2d')](_0x1780('0x5a'),util['inspect'](_0x55e414,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0x1780('0x1e')][_0x1780('0x56')]=function(_0x30635f,_0x45f5f1,_0x1bafc9){var _0x1a8724=['rtpaudioqos','rtpaudioqosbridged',_0x1780('0x5b'),'rtpaudioqosjitterbridged',_0x1780('0x5c'),_0x1780('0x5d'),_0x1780('0x5e'),_0x1780('0x5f'),_0x1780('0x60'),'sipuri','bridgepeer','bridgepvtcallid','membercalls',_0x1780('0x61'),_0x1780('0x62'),'memberlastcall','membername',_0x1780('0x63'),_0x1780('0x64')];if(!_[_0x1780('0x65')](_0x45f5f1)&&!_[_0x1780('0x66')](_0x1a8724,_0x45f5f1)){if(_[_0x1780('0x20')](this[_0x1780('0xe')][_0x30635f])){this[_0x1780('0xe')][_0x30635f]={};}this[_0x1780('0xe')][_0x30635f][_0x45f5f1]=_0x1bafc9;}};VoiceAgentReport[_0x1780('0x1e')]['syncHangup']=function(_0x6a635a){try{if(this[_0x1780('0x1f')](_0x6a635a)){if(this[_0x1780('0xb')][_0x6a635a[_0x1780('0x21')]]){for(var _0xb604e2 in this[_0x1780('0xb')][_0x6a635a[_0x1780('0x21')]]){if(this['channels'][_0x6a635a['uniqueid']]['hasOwnProperty'](_0xb604e2)){if(this[_0x1780('0xb')][_0x6a635a[_0x1780('0x21')]][_0xb604e2][_0x1780('0x3e')]==_0x1780('0x4b')&&this[_0x1780('0xb')][_0x6a635a[_0x1780('0x21')]][_0xb604e2][_0x1780('0x14')]){this[_0x1780('0xb')][_0x6a635a['uniqueid']][_0xb604e2][_0x1780('0x49')]=moment()[_0x1780('0x23')](_0x1780('0x31'));}}}ami[_0x1780('0x2a')](_0x1780('0x67'),_[_0x1780('0x68')](this[_0x1780('0xb')][_0x6a635a['uniqueid']]));delete this[_0x1780('0xb')][_0x6a635a['uniqueid']];}if(this[_0x1780('0xe')][_0x6a635a['uniqueid']]){delete this[_0x1780('0xe')][_0x6a635a[_0x1780('0x21')]];}}}catch(_0x40a49f){logger['error'](_0x1780('0x69'),util[_0x1780('0x44')](_0x40a49f,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0x1780('0x1e')]['syncAttendedTransfer']=function(_0xbd9eef){try{if(this[_0x1780('0x1f')](_0xbd9eef)){if(this[_0x1780('0xb')][_0xbd9eef[_0x1780('0x6a')]]){for(var _0x56ef50 in this[_0x1780('0xb')][_0xbd9eef['transfereeuniqueid']]){if(this[_0x1780('0xb')][_0xbd9eef[_0x1780('0x6a')]][_0x1780('0x2f')](_0x56ef50)){if(_0xbd9eef[_0x1780('0x6b')]===_0x56ef50){var _0x2e5264=moment();this[_0x1780('0xb')][_0xbd9eef[_0x1780('0x6a')]][_0x56ef50][_0x1780('0x14')]=!![];this[_0x1780('0xb')][_0xbd9eef[_0x1780('0x6a')]][_0x56ef50][_0x1780('0x49')]=moment()['format'](_0x1780('0x31'));this[_0x1780('0xb')][_0xbd9eef[_0x1780('0x6a')]][_0x56ef50][_0x1780('0x3e')]=_0x1780('0x4b');this[_0x1780('0xb')][_0xbd9eef[_0x1780('0x6a')]][_0x56ef50][_0x1780('0x32')]=_0x1780('0x6c');this[_0x1780('0xb')][_0xbd9eef[_0x1780('0x6a')]][_0x56ef50][_0x1780('0x4a')]=_0x2e5264[_0x1780('0x6d')](this[_0x1780('0xb')][_0xbd9eef['transfereeuniqueid']][_0x56ef50][_0x1780('0x30')],'seconds');}}}}if(this[_0x1780('0xb')][_0xbd9eef[_0x1780('0x6e')]]){var _0x118a41=this[_0x1780('0xb')][_0xbd9eef[_0x1780('0x6e')]];this[_0x1780('0xb')][_0xbd9eef[_0x1780('0x6e')]]=this[_0x1780('0xb')][_0xbd9eef[_0x1780('0x6a')]];this[_0x1780('0xb')][_0xbd9eef[_0x1780('0x6a')]]=_0x118a41;}}}catch(_0x1b9c07){logger[_0x1780('0x2d')](_0x1780('0x6f'),util[_0x1780('0x44')](_0x1b9c07,{'showHidden':![],'depth':null}));}};VoiceAgentReport['prototype'][_0x1780('0x70')]=function(_0x166df3){try{if(this[_0x1780('0x1f')](_0x166df3)){if(this['channels'][_0x166df3['transfereeuniqueid']]){for(var _0x575b7f in this[_0x1780('0xb')][_0x166df3[_0x1780('0x6a')]]){if(this['channels'][_0x166df3[_0x1780('0x6a')]]['hasOwnProperty'](_0x575b7f)){if(_0x166df3['transfereruniqueid']===_0x575b7f){var _0x3d65b0=moment();this[_0x1780('0xb')][_0x166df3[_0x1780('0x6a')]][_0x575b7f][_0x1780('0x14')]=!![];this[_0x1780('0xb')][_0x166df3[_0x1780('0x6a')]][_0x575b7f][_0x1780('0x49')]=_0x3d65b0;this[_0x1780('0xb')][_0x166df3['transfereeuniqueid']][_0x575b7f][_0x1780('0x3e')]=_0x1780('0x4b');this[_0x1780('0xb')][_0x166df3[_0x1780('0x6a')]][_0x575b7f][_0x1780('0x32')]='complete';this['channels'][_0x166df3[_0x1780('0x6a')]][_0x575b7f][_0x1780('0x4a')]=_0x3d65b0[_0x1780('0x6d')](this['channels'][_0x166df3[_0x1780('0x6a')]][_0x575b7f]['agentconnectAt'],_0x1780('0x71'));}}}}}}catch(_0x592c2f){logger[_0x1780('0x2d')](_0x1780('0x72'),util[_0x1780('0x44')](_0x592c2f,{'showHidden':![],'depth':null}));}};VoiceAgentReport['prototype'][_0x1780('0x1a')]=function(_0x30cf2c){var _0x6337f9='';try{if(this[_0x1780('0x1f')](_0x30cf2c)){if(_0x30cf2c[_0x1780('0x73')]){_0x6337f9=_0x30cf2c[_0x1780('0x73')][_0x1780('0x74')](0x0,_0x30cf2c[_0x1780('0x73')][_0x1780('0x75')]('-'));if(this[_0x1780('0xd')][_0x6337f9]){this[_0x1780('0xd')][_0x6337f9][_0x1780('0x76')]=!![];}}}}catch(_0x2a4fbb){logger[_0x1780('0x2d')]('[syncMusicOnHoldStart][VoiceAgentReport]',util[_0x1780('0x44')](_0x2a4fbb,{'showHidden':![],'depth':null}));}};VoiceAgentReport['prototype'][_0x1780('0x1c')]=function(_0x322767){var _0x36063b='';try{if(this[_0x1780('0x1f')](_0x322767)){if(_0x322767[_0x1780('0x73')]){_0x36063b=_0x322767[_0x1780('0x73')][_0x1780('0x74')](0x0,_0x322767[_0x1780('0x73')]['lastIndexOf']('-'));if(this[_0x1780('0xd')][_0x36063b]){this[_0x1780('0xd')][_0x36063b][_0x1780('0x76')]=![];}}}}catch(_0x2521c5){logger[_0x1780('0x2d')](_0x1780('0x77'),util[_0x1780('0x44')](_0x2521c5,{'showHidden':![],'depth':null}));}};module[_0x1780('0x78')]=VoiceAgentReport; \ No newline at end of file +var _0x7a40=['syncAttendedTransfer','prototype','emit','isNotNull','syncAgentCalled','uniqueid','isUndefined','destuniqueid','format','queue','inbound','merge','event','privilege','custom:agentcalled','user:%s','user:called','error','inspect','agentconnectAt','connect','holdtime','connectedlinenum','connectedlinename','destchannelstate','interface','pick','user:agentconnect','YYYY-MM-DD\x20HH:mm:ss','reason','lastevent','answered_elsewhere','answeredelsewheredestinationuniqueid','answeredelsewheremembername','membername','custom:agentansweredelsewhere','agentringnoanswerAt','rejected','custom:agentringnoanswer','[syncAgentRingNoAnswer][VoiceAgentReport]','hasOwnProperty','abandoned','custom:agentqueuecallerabandon','[syncQueueCallerAbandon][VoiceAgentReport]','complete','talktime','transfer','agent','acw','acwtime','acwTimeout','destconnectedlinenum','user:agentcomplete','custom:agentcomplete','[syncAgentComplete][VoiceAgentReport]','addVariable','variable','value','variables','[syncVarSet][VoiceAgentReport]','rtpaudioqos','rtpaudioqosbridged','rtpaudioqosjitter','rtpaudioqosloss','rtpaudioqosrtt','rtpaudioqosrttbridged','sipcallid','sipuri','bridgepeer','membercalls','memberdynamic','memberinterface','memberlastcall','includes','values','transfereeuniqueid','agentcompleteAt','diff','seconds','secondtransfereruniqueid','[syncAttendedTransfer][VoiceAgentReport]','syncBlindTransfer','transfereruniqueid','channel','substring','lastIndexOf','[syncMusicOnHoldStart][VoiceAgentReport]','onhold','[syncMusicOnHoldStop][VoiceAgentReport]','exports','lodash','util','../../../config/logger','ami','../ami','defaults','redis','localhost','socket.io-emitter','channels','voiceQueues','agents','agentcalled','agentconnect','syncAgentConnect','bind','agentringnoanswer','syncAgentRingNoAnswer','queuecallerabandon','syncQueueCallerAbandon','agentcomplete','syncAgentComplete','varset','syncVarSet','hangup','syncHangup','musiconholdstart','syncMusicOnHoldStart','musiconholdstop','syncMusicOnHoldStop','attendedtransfer'];(function(_0x856bfe,_0x28f047){var _0x55b4cc=function(_0xed5ab5){while(--_0xed5ab5){_0x856bfe['push'](_0x856bfe['shift']());}};_0x55b4cc(++_0x28f047);}(_0x7a40,0xd3));var _0x07a4=function(_0x4b6838,_0x1edaf0){_0x4b6838=_0x4b6838-0x0;var _0x41147b=_0x7a40[_0x4b6838];return _0x41147b;};'use strict';var _=require(_0x07a4('0x0'));var moment=require('moment');var util=require(_0x07a4('0x1'));var Redis=require('ioredis');var config=require('../../../config/environment');var logger=require(_0x07a4('0x2'))(_0x07a4('0x3'));var ami=require(_0x07a4('0x4'));config['redis']=_[_0x07a4('0x5')](config[_0x07a4('0x6')],{'host':_0x07a4('0x7'),'port':0x18eb});var io=require(_0x07a4('0x8'))(new Redis(config['redis']));function VoiceAgentReport(_0x1f4c6a){this[_0x07a4('0x9')]={};this[_0x07a4('0xa')]=_0x1f4c6a[_0x07a4('0xa')];this[_0x07a4('0xb')]=_0x1f4c6a[_0x07a4('0xb')];this['variables']={};ami['on'](_0x07a4('0xc'),this['syncAgentCalled']['bind'](this));ami['on'](_0x07a4('0xd'),this[_0x07a4('0xe')][_0x07a4('0xf')](this));ami['on'](_0x07a4('0x10'),this[_0x07a4('0x11')][_0x07a4('0xf')](this));ami['on'](_0x07a4('0x12'),this[_0x07a4('0x13')][_0x07a4('0xf')](this));ami['on'](_0x07a4('0x14'),this[_0x07a4('0x15')][_0x07a4('0xf')](this));ami['on'](_0x07a4('0x16'),this[_0x07a4('0x17')][_0x07a4('0xf')](this));ami['on'](_0x07a4('0x18'),this[_0x07a4('0x19')][_0x07a4('0xf')](this));ami['on'](_0x07a4('0x1a'),this[_0x07a4('0x1b')]['bind'](this));ami['on'](_0x07a4('0x1c'),this[_0x07a4('0x1d')][_0x07a4('0xf')](this));ami['on'](_0x07a4('0x1e'),this[_0x07a4('0x1f')][_0x07a4('0xf')](this));ami['on']('blindtransfer',this['syncBlindTransfer'][_0x07a4('0xf')](this));}VoiceAgentReport[_0x07a4('0x20')]['emit']=function(_0x17fe05,_0x27546a,_0x1247d4){io['to'](_0x17fe05)[_0x07a4('0x21')](_0x27546a,_0x1247d4);};VoiceAgentReport[_0x07a4('0x20')][_0x07a4('0x22')]=function(_0x2bbd1d){return _0x2bbd1d!==null&&!_['isUndefined'](_0x2bbd1d);};VoiceAgentReport['prototype'][_0x07a4('0x23')]=function(_0x40c998){try{if(this[_0x07a4('0x22')](_0x40c998)){if(_['isUndefined'](this['channels'][_0x40c998[_0x07a4('0x24')]])){this[_0x07a4('0x9')][_0x40c998[_0x07a4('0x24')]]={};}if(_[_0x07a4('0x25')](this[_0x07a4('0x9')][_0x40c998[_0x07a4('0x24')]][_0x40c998[_0x07a4('0x26')]])){this[_0x07a4('0x9')][_0x40c998[_0x07a4('0x24')]][_0x40c998[_0x07a4('0x26')]]={'agentcalledAt':moment()[_0x07a4('0x27')]('YYYY-MM-DD\x20HH:mm:ss'),'lastevent':'called','variables':this['variables'][_0x40c998[_0x07a4('0x24')]],'type':this[_0x07a4('0xa')][_0x40c998[_0x07a4('0x28')]]?this['voiceQueues'][_0x40c998[_0x07a4('0x28')]]['type']||_0x07a4('0x29'):_0x07a4('0x29')};}_[_0x07a4('0x2a')](this['channels'][_0x40c998[_0x07a4('0x24')]][_0x40c998['destuniqueid']],_['omit'](_0x40c998,[_0x07a4('0x2b'),_0x07a4('0x2c')]));ami[_0x07a4('0x21')](_0x07a4('0x2d'),this[_0x07a4('0x9')][_0x40c998[_0x07a4('0x24')]][_0x40c998[_0x07a4('0x26')]]);this[_0x07a4('0x21')](util['format'](_0x07a4('0x2e'),_0x40c998['membername']),_0x07a4('0x2f'),this[_0x07a4('0x9')][_0x40c998['uniqueid']][_0x40c998[_0x07a4('0x26')]]);}}catch(_0x3f01ad){logger[_0x07a4('0x30')]('[syncAgentCalled][VoiceAgentReport]',util[_0x07a4('0x31')](_0x3f01ad,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0x07a4('0x20')][_0x07a4('0xe')]=function(_0x43204b){try{if(this[_0x07a4('0x22')](_0x43204b)){if(this['channels'][_0x43204b['uniqueid']]){for(var _0x4b0264 in this[_0x07a4('0x9')][_0x43204b[_0x07a4('0x24')]]){if(this[_0x07a4('0x9')][_0x43204b[_0x07a4('0x24')]]['hasOwnProperty'](_0x4b0264)){if(_0x43204b[_0x07a4('0x26')]===_0x4b0264){this[_0x07a4('0x9')][_0x43204b[_0x07a4('0x24')]][_0x4b0264][_0x07a4('0x32')]=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');this[_0x07a4('0x9')][_0x43204b['uniqueid']][_0x4b0264]['lastevent']=_0x07a4('0x33');this['channels'][_0x43204b[_0x07a4('0x24')]][_0x4b0264]['holdtime']=_0x43204b[_0x07a4('0x34')];this[_0x07a4('0x9')][_0x43204b[_0x07a4('0x24')]][_0x4b0264][_0x07a4('0x35')]=_0x43204b[_0x07a4('0x35')];this[_0x07a4('0x9')][_0x43204b['uniqueid']][_0x4b0264][_0x07a4('0x36')]=_0x43204b[_0x07a4('0x36')];this[_0x07a4('0x9')][_0x43204b[_0x07a4('0x24')]][_0x4b0264][_0x07a4('0x37')]=_0x43204b[_0x07a4('0x37')];this[_0x07a4('0x9')][_0x43204b[_0x07a4('0x24')]][_0x4b0264]['destchannelstatedesc']=_0x43204b['destchannelstatedesc'];_[_0x07a4('0x2a')](this[_0x07a4('0xb')][_0x43204b[_0x07a4('0x38')]],_[_0x07a4('0x39')](_0x43204b,[_0x07a4('0x28'),'destconnectedlinenum']));this[_0x07a4('0x21')](util['format'](_0x07a4('0x2e'),_0x43204b['membername']),_0x07a4('0x3a'),this[_0x07a4('0x9')][_0x43204b['uniqueid']][_0x43204b[_0x07a4('0x26')]]);ami[_0x07a4('0x21')]('custom:agentconnect',this[_0x07a4('0x9')][_0x43204b[_0x07a4('0x24')]][_0x4b0264]);}else if(!this[_0x07a4('0x9')][_0x43204b['uniqueid']][_0x4b0264][_0x07a4('0x10')]&&!this[_0x07a4('0x9')][_0x43204b[_0x07a4('0x24')]][_0x4b0264][_0x07a4('0x14')]){this[_0x07a4('0x9')][_0x43204b[_0x07a4('0x24')]][_0x4b0264][_0x07a4('0x10')]=!![];this['channels'][_0x43204b[_0x07a4('0x24')]][_0x4b0264]['agentringnoanswerAt']=moment()[_0x07a4('0x27')](_0x07a4('0x3b'));this[_0x07a4('0x9')][_0x43204b[_0x07a4('0x24')]][_0x4b0264][_0x07a4('0x3c')]='answered_elsewhere';this[_0x07a4('0x9')][_0x43204b[_0x07a4('0x24')]][_0x4b0264][_0x07a4('0x3d')]=_0x07a4('0x3e');this[_0x07a4('0x9')][_0x43204b['uniqueid']][_0x4b0264][_0x07a4('0x3f')]=_0x43204b[_0x07a4('0x26')];this[_0x07a4('0x9')][_0x43204b[_0x07a4('0x24')]][_0x4b0264][_0x07a4('0x40')]=_0x43204b[_0x07a4('0x41')];ami[_0x07a4('0x21')](_0x07a4('0x42'),this['channels'][_0x43204b[_0x07a4('0x24')]][_0x4b0264]);}}}}}}catch(_0x435863){logger[_0x07a4('0x30')]('[syncAgentConnect][VoiceAgentReport]',util[_0x07a4('0x31')](_0x435863,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0x07a4('0x20')]['syncAgentRingNoAnswer']=function(_0x13f321){try{if(this[_0x07a4('0x22')](_0x13f321)){if(this[_0x07a4('0x9')][_0x13f321[_0x07a4('0x24')]]&&this[_0x07a4('0x9')][_0x13f321[_0x07a4('0x24')]][_0x13f321[_0x07a4('0x26')]]){this[_0x07a4('0x9')][_0x13f321[_0x07a4('0x24')]][_0x13f321[_0x07a4('0x26')]][_0x07a4('0x10')]=!![];this[_0x07a4('0x9')][_0x13f321[_0x07a4('0x24')]][_0x13f321[_0x07a4('0x26')]][_0x07a4('0x43')]=moment()['format'](_0x07a4('0x3b'));this[_0x07a4('0x9')][_0x13f321[_0x07a4('0x24')]][_0x13f321[_0x07a4('0x26')]]['reason']=_0x07a4('0x44');this[_0x07a4('0x9')][_0x13f321['uniqueid']][_0x13f321[_0x07a4('0x26')]][_0x07a4('0x3d')]=_0x07a4('0x44');ami[_0x07a4('0x21')](_0x07a4('0x45'),this['channels'][_0x13f321[_0x07a4('0x24')]][_0x13f321[_0x07a4('0x26')]]);}}}catch(_0x3ede7d){logger[_0x07a4('0x30')](_0x07a4('0x46'),util[_0x07a4('0x31')](_0x3ede7d,{'showHidden':![],'depth':null}));}};VoiceAgentReport['prototype'][_0x07a4('0x13')]=function(_0x37add2){try{if(this['isNotNull'](_0x37add2)){if(this[_0x07a4('0x9')][_0x37add2[_0x07a4('0x24')]]){for(var _0x356c68 in this[_0x07a4('0x9')][_0x37add2[_0x07a4('0x24')]]){if(this[_0x07a4('0x9')][_0x37add2[_0x07a4('0x24')]][_0x07a4('0x47')](_0x356c68)&&!this[_0x07a4('0x9')][_0x37add2['uniqueid']][_0x356c68][_0x07a4('0x10')]&&!this[_0x07a4('0x9')][_0x37add2[_0x07a4('0x24')]][_0x356c68]['agentcomplete']){this[_0x07a4('0x9')][_0x37add2[_0x07a4('0x24')]][_0x356c68][_0x07a4('0x10')]=!![];this[_0x07a4('0x9')][_0x37add2[_0x07a4('0x24')]][_0x356c68][_0x07a4('0x43')]=moment()[_0x07a4('0x27')](_0x07a4('0x3b'));this[_0x07a4('0x9')][_0x37add2['uniqueid']][_0x356c68][_0x07a4('0x3c')]='abandoned';this[_0x07a4('0x9')][_0x37add2['uniqueid']][_0x356c68][_0x07a4('0x3d')]=_0x07a4('0x48');ami[_0x07a4('0x21')](_0x07a4('0x49'),this[_0x07a4('0x9')][_0x37add2[_0x07a4('0x24')]][_0x356c68]);}}}}}catch(_0x46a8ee){logger[_0x07a4('0x30')](_0x07a4('0x4a'),util[_0x07a4('0x31')](_0x46a8ee,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0x07a4('0x20')][_0x07a4('0x15')]=function(_0x5f582d){try{if(this['isNotNull'](_0x5f582d)){if(this[_0x07a4('0x9')][_0x5f582d[_0x07a4('0x24')]]){for(var _0x97be2c in this[_0x07a4('0x9')][_0x5f582d[_0x07a4('0x24')]]){if(this[_0x07a4('0x9')][_0x5f582d['uniqueid']][_0x07a4('0x47')](_0x97be2c)){if(this[_0x07a4('0x9')][_0x5f582d['uniqueid']][_0x97be2c][_0x07a4('0x32')]&&!this['channels'][_0x5f582d[_0x07a4('0x24')]][_0x97be2c][_0x07a4('0x14')]){this[_0x07a4('0x9')][_0x5f582d['uniqueid']][_0x97be2c][_0x07a4('0x14')]=!![];this[_0x07a4('0x9')][_0x5f582d[_0x07a4('0x24')]][_0x97be2c]['agentcompleteAt']=moment()[_0x07a4('0x27')](_0x07a4('0x3b'));this[_0x07a4('0x9')][_0x5f582d[_0x07a4('0x24')]][_0x97be2c][_0x07a4('0x3d')]=_0x07a4('0x4b');this[_0x07a4('0x9')][_0x5f582d[_0x07a4('0x24')]][_0x97be2c][_0x07a4('0x4c')]=_0x5f582d[_0x07a4('0x4c')];this[_0x07a4('0x9')][_0x5f582d['uniqueid']][_0x97be2c][_0x07a4('0x3c')]=_0x5f582d[_0x07a4('0x3c')]==_0x07a4('0x4d')?_0x07a4('0x4e'):_0x5f582d[_0x07a4('0x3c')];if(this[_0x07a4('0xa')][_0x5f582d[_0x07a4('0x28')]]&&this[_0x07a4('0xa')][_0x5f582d[_0x07a4('0x28')]][_0x07a4('0x4f')]){this[_0x07a4('0x9')][_0x5f582d['uniqueid']][_0x97be2c]['agentacw']=!![];this['channels'][_0x5f582d[_0x07a4('0x24')]][_0x97be2c][_0x07a4('0x50')]=this[_0x07a4('0xa')][_0x5f582d[_0x07a4('0x28')]][_0x07a4('0x51')];}this[_0x07a4('0xb')][_0x5f582d[_0x07a4('0x38')]]=_['omit'](this[_0x07a4('0xb')][_0x5f582d[_0x07a4('0x38')]],['queue',_0x07a4('0x52')]);this['emit'](util[_0x07a4('0x27')]('user:%s',_0x5f582d[_0x07a4('0x41')]),_0x07a4('0x53'),this['channels'][_0x5f582d[_0x07a4('0x24')]][_0x97be2c]);ami[_0x07a4('0x21')](_0x07a4('0x54'),this[_0x07a4('0x9')][_0x5f582d['uniqueid']][_0x97be2c]);}}}}}}catch(_0x1512df){logger[_0x07a4('0x30')](_0x07a4('0x55'),util[_0x07a4('0x31')](_0x1512df,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0x07a4('0x20')][_0x07a4('0x17')]=function(_0x1156a0){try{if(this[_0x07a4('0x22')](_0x1156a0)){this[_0x07a4('0x56')](_0x1156a0[_0x07a4('0x24')],_['keys'](_0x1156a0[_0x07a4('0x57')])[0x0],_0x1156a0[_0x07a4('0x58')]);if(this['channels'][_0x1156a0[_0x07a4('0x24')]]){for(var _0x83c7ef in this[_0x07a4('0x9')][_0x1156a0['uniqueid']]){if(this[_0x07a4('0x9')][_0x1156a0[_0x07a4('0x24')]]['hasOwnProperty'](_0x83c7ef)){if(_[_0x07a4('0x25')](this[_0x07a4('0x9')][_0x1156a0[_0x07a4('0x24')]][_0x83c7ef]['variables'])){this['channels'][_0x1156a0[_0x07a4('0x24')]][_0x83c7ef][_0x07a4('0x59')]={};}this[_0x07a4('0x9')][_0x1156a0[_0x07a4('0x24')]][_0x83c7ef]['variables']=this[_0x07a4('0x59')][_0x1156a0[_0x07a4('0x24')]];}}}}}catch(_0xf88b28){logger[_0x07a4('0x30')](_0x07a4('0x5a'),util[_0x07a4('0x31')](_0xf88b28,{'showHidden':![],'depth':null}));}};VoiceAgentReport['prototype'][_0x07a4('0x56')]=function(_0x48b990,_0x224966,_0x2b688b){var _0x50dfc2=[_0x07a4('0x5b'),_0x07a4('0x5c'),_0x07a4('0x5d'),'rtpaudioqosjitterbridged',_0x07a4('0x5e'),'rtpaudioqoslossbridged',_0x07a4('0x5f'),_0x07a4('0x60'),_0x07a4('0x61'),_0x07a4('0x62'),_0x07a4('0x63'),'bridgepvtcallid',_0x07a4('0x64'),_0x07a4('0x65'),_0x07a4('0x66'),_0x07a4('0x67'),_0x07a4('0x41'),'memberpenalty','memberrealtime'];if(!_['isNil'](_0x224966)&&!_[_0x07a4('0x68')](_0x50dfc2,_0x224966)){if(_[_0x07a4('0x25')](this['variables'][_0x48b990])){this[_0x07a4('0x59')][_0x48b990]={};}this[_0x07a4('0x59')][_0x48b990][_0x224966]=_0x2b688b;}};VoiceAgentReport[_0x07a4('0x20')][_0x07a4('0x19')]=function(_0x440fe){try{if(this['isNotNull'](_0x440fe)){if(this[_0x07a4('0x9')][_0x440fe[_0x07a4('0x24')]]){for(var _0x4c8cb7 in this['channels'][_0x440fe[_0x07a4('0x24')]]){if(this[_0x07a4('0x9')][_0x440fe[_0x07a4('0x24')]][_0x07a4('0x47')](_0x4c8cb7)){if(this[_0x07a4('0x9')][_0x440fe['uniqueid']][_0x4c8cb7][_0x07a4('0x3c')]==_0x07a4('0x4d')&&this['channels'][_0x440fe[_0x07a4('0x24')]][_0x4c8cb7][_0x07a4('0x14')]){this[_0x07a4('0x9')][_0x440fe[_0x07a4('0x24')]][_0x4c8cb7]['agentcompleteAt']=moment()[_0x07a4('0x27')](_0x07a4('0x3b'));}}}ami[_0x07a4('0x21')]('custom:voiceAgentReport',_[_0x07a4('0x69')](this[_0x07a4('0x9')][_0x440fe['uniqueid']]));delete this[_0x07a4('0x9')][_0x440fe['uniqueid']];}if(this[_0x07a4('0x59')][_0x440fe[_0x07a4('0x24')]]){delete this[_0x07a4('0x59')][_0x440fe['uniqueid']];}}}catch(_0x3b0835){logger[_0x07a4('0x30')]('[syncHangup][VoiceAgentReport]',util[_0x07a4('0x31')](_0x3b0835,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0x07a4('0x20')]['syncAttendedTransfer']=function(_0x238a76){try{if(this[_0x07a4('0x22')](_0x238a76)){if(this[_0x07a4('0x9')][_0x238a76[_0x07a4('0x6a')]]){for(var _0x1da3ba in this[_0x07a4('0x9')][_0x238a76[_0x07a4('0x6a')]]){if(this[_0x07a4('0x9')][_0x238a76['transfereeuniqueid']][_0x07a4('0x47')](_0x1da3ba)){if(_0x238a76['origtransfereruniqueid']===_0x1da3ba){var _0xcfa1a3=moment();this['channels'][_0x238a76['transfereeuniqueid']][_0x1da3ba][_0x07a4('0x14')]=!![];this[_0x07a4('0x9')][_0x238a76[_0x07a4('0x6a')]][_0x1da3ba][_0x07a4('0x6b')]=moment()[_0x07a4('0x27')]('YYYY-MM-DD\x20HH:mm:ss');this['channels'][_0x238a76[_0x07a4('0x6a')]][_0x1da3ba][_0x07a4('0x3c')]=_0x07a4('0x4d');this['channels'][_0x238a76[_0x07a4('0x6a')]][_0x1da3ba]['lastevent']=_0x07a4('0x4b');this[_0x07a4('0x9')][_0x238a76[_0x07a4('0x6a')]][_0x1da3ba]['talktime']=_0xcfa1a3[_0x07a4('0x6c')](this['channels'][_0x238a76[_0x07a4('0x6a')]][_0x1da3ba]['agentconnectAt'],_0x07a4('0x6d'));}}}}if(this['channels'][_0x238a76[_0x07a4('0x6e')]]){var _0x52b625=this[_0x07a4('0x9')][_0x238a76['secondtransfereruniqueid']];this[_0x07a4('0x9')][_0x238a76[_0x07a4('0x6e')]]=this[_0x07a4('0x9')][_0x238a76[_0x07a4('0x6a')]];this['channels'][_0x238a76[_0x07a4('0x6a')]]=_0x52b625;}}}catch(_0x1669ea){logger[_0x07a4('0x30')](_0x07a4('0x6f'),util[_0x07a4('0x31')](_0x1669ea,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0x07a4('0x20')][_0x07a4('0x70')]=function(_0x515f33){try{if(this[_0x07a4('0x22')](_0x515f33)){if(this[_0x07a4('0x9')][_0x515f33['transfereeuniqueid']]){for(var _0x377578 in this[_0x07a4('0x9')][_0x515f33[_0x07a4('0x6a')]]){if(this[_0x07a4('0x9')][_0x515f33[_0x07a4('0x6a')]][_0x07a4('0x47')](_0x377578)){if(_0x515f33[_0x07a4('0x71')]===_0x377578){var _0x2ba7ed=moment();this['channels'][_0x515f33[_0x07a4('0x6a')]][_0x377578][_0x07a4('0x14')]=!![];this['channels'][_0x515f33[_0x07a4('0x6a')]][_0x377578]['agentcompleteAt']=_0x2ba7ed;this[_0x07a4('0x9')][_0x515f33[_0x07a4('0x6a')]][_0x377578][_0x07a4('0x3c')]=_0x07a4('0x4d');this['channels'][_0x515f33[_0x07a4('0x6a')]][_0x377578]['lastevent']=_0x07a4('0x4b');this[_0x07a4('0x9')][_0x515f33[_0x07a4('0x6a')]][_0x377578]['talktime']=_0x2ba7ed['diff'](this[_0x07a4('0x9')][_0x515f33[_0x07a4('0x6a')]][_0x377578][_0x07a4('0x32')],_0x07a4('0x6d'));}}}}}}catch(_0x3a8b91){logger[_0x07a4('0x30')]('[syncBlindTransfer][VoiceAgentReport]',util[_0x07a4('0x31')](_0x3a8b91,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0x07a4('0x20')][_0x07a4('0x1b')]=function(_0x1e6098){var _0x629982='';try{if(this[_0x07a4('0x22')](_0x1e6098)){if(_0x1e6098[_0x07a4('0x72')]){_0x629982=_0x1e6098[_0x07a4('0x72')][_0x07a4('0x73')](0x0,_0x1e6098[_0x07a4('0x72')][_0x07a4('0x74')]('-'));if(this['agents'][_0x629982]){this['agents'][_0x629982]['onhold']=!![];}}}}catch(_0x35a646){logger['error'](_0x07a4('0x75'),util['inspect'](_0x35a646,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0x07a4('0x20')][_0x07a4('0x1d')]=function(_0xe62f5d){var _0x5d3ab9='';try{if(this[_0x07a4('0x22')](_0xe62f5d)){if(_0xe62f5d[_0x07a4('0x72')]){_0x5d3ab9=_0xe62f5d[_0x07a4('0x72')][_0x07a4('0x73')](0x0,_0xe62f5d[_0x07a4('0x72')][_0x07a4('0x74')]('-'));if(this[_0x07a4('0xb')][_0x5d3ab9]){this[_0x07a4('0xb')][_0x5d3ab9][_0x07a4('0x76')]=![];}}}}catch(_0x1c40be){logger[_0x07a4('0x30')](_0x07a4('0x77'),util[_0x07a4('0x31')](_0x1c40be,{'showHidden':![],'depth':null}));}};module[_0x07a4('0x78')]=VoiceAgentReport; \ No newline at end of file diff --git a/server/services/ami/report/voiceCallReport.js b/server/services/ami/report/voiceCallReport.js index 2eb15c5..8cdeaff 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 _0x32c8=['YYYY-MM-DD\x20HH:mm:ss','disposition','toNumber','channelstate','merge','pick','context','from-sip','split','destconnectedlinenum','exten','user:%s','name','[syncNewChannel][VoiceCallReport]','application','applicationdata','toLowerCase','duration','subtract','seconds','includes','lastapplication','lastdata','startsWith','cdr(','match','queue','[syncNewExten][VoiceCallReport]','answered','answertime','diff','calleridnum','xcally-motion-preview','connectedlinenum','connectedlinename','calleridname','membername','UserId','[syncNewState][VoiceCallReport]','monitor','.wav49','replace','.WAV','monitorFilename','isNil','monitors','push','variable','mixmonitor_filename','value','xmd-phone','xmd-callerid','callerid','xmd-cdrtype','type','xmd-originatecalleridnum','originatecalleridnum','xmcs-queue','sipcallid','parse','syncMixMonitorFilename','sipcalllinkedid','[syncVarSet][VoiceCallReport]','billableseconds','holdtime','user:agentcomplete','accountcode','[syncHangup][VoiceCallReport]','transfercalleridnum','origtransferercalleridnum','transfereeuniqueid','transferconnectedlinenum','secondtransfereruniqueid','transfertargetuniqueid','transfertargetcalleridnum','origtransfereruniqueid','[syncAttendedTransfer][VoiceCallReport]','transfereecalleridnum','extension','transfererchannel','[syncBlindTransfer][VoiceCallReport]','syncMusicOnHoldStart','[syncMusicOnHoldStart][VoiceCallReport]','mohtime','mohstarttime','[syncMusicOnHoldStop][VoiceCallReport]','bluebird','lodash','util','ioredis','../../../config/environment','../../../config/logger','ami','../model/channel','not_inuse','inuse','busy','unavailable','ringing','onhold','set','agi','dial','playback','NO\x20ANSWER','FAILED','ANSWERED','BUSY','redis','defaults','localhost','socket.io-emitter','channels','agents','syncNewExten','bind','newchannel','syncNewChannel','syncNewState','varset','syncVarSet','syncHangup','newcallerid','syncNewCallerId','attendedtransfer','syncAttendedTransfer','blindtransfer','musiconholdstart','musiconholdstop','syncMusicOnHoldStop','actionCoreShowChannels','catch','log','prototype','isNotNull','isUndefined','emit','uniqueid','linkedid','keys','error','[syncNewCallerId][VoiceCallReport]','inspect','channel','OutgoingSpoolFailed','starttime','format'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x32c8,0x17c));var _0x832c=function(_0x45a142,_0x42efe8){_0x45a142=_0x45a142-0x0;var _0x456621=_0x32c8[_0x45a142];return _0x456621;};'use strict';var BPromise=require(_0x832c('0x0'));var _=require(_0x832c('0x1'));var moment=require('moment');var util=require(_0x832c('0x2'));var path=require('path');var Redis=require(_0x832c('0x3'));var config=require(_0x832c('0x4'));var logger=require(_0x832c('0x5'))(_0x832c('0x6'));var ami=require('../ami');var Channel=require(_0x832c('0x7'));var statusDesc=['unknown',_0x832c('0x8'),_0x832c('0x9'),_0x832c('0xa'),'invalid',_0x832c('0xb'),_0x832c('0xc'),'ringinuse',_0x832c('0xd')];var applications=[_0x832c('0xe'),'queue',_0x832c('0xf'),_0x832c('0x10'),_0x832c('0x11'),'voicemail'];var dispositions=[_0x832c('0x12'),_0x832c('0x13'),_0x832c('0x13'),_0x832c('0x12'),'NO\x20ANSWER','NO\x20ANSWER',_0x832c('0x14'),_0x832c('0x15'),_0x832c('0x13'),_0x832c('0x13'),_0x832c('0x13')];var actions={};config[_0x832c('0x16')]=_[_0x832c('0x17')](config[_0x832c('0x16')],{'host':_0x832c('0x18'),'port':0x18eb});var io=require(_0x832c('0x19'))(new Redis(config[_0x832c('0x16')]));function VoiceCallReport(_0x3b3a6b){this[_0x832c('0x1a')]=_0x3b3a6b[_0x832c('0x1a')];this[_0x832c('0x1b')]=_0x3b3a6b[_0x832c('0x1b')];ami['on']('coreshowchannel',this[_0x832c('0x1c')][_0x832c('0x1d')](this));ami['on']('newexten',this[_0x832c('0x1c')][_0x832c('0x1d')](this));ami['on'](_0x832c('0x1e'),this[_0x832c('0x1f')]['bind'](this));ami['on']('newstate',this[_0x832c('0x20')][_0x832c('0x1d')](this));ami['on'](_0x832c('0x21'),this[_0x832c('0x22')][_0x832c('0x1d')](this));ami['on']('hangup',this[_0x832c('0x23')][_0x832c('0x1d')](this));ami['on'](_0x832c('0x24'),this[_0x832c('0x25')][_0x832c('0x1d')](this));ami['on'](_0x832c('0x26'),this[_0x832c('0x27')]['bind'](this));ami['on'](_0x832c('0x28'),this['syncBlindTransfer'][_0x832c('0x1d')](this));ami['on'](_0x832c('0x29'),this['syncMusicOnHoldStart'][_0x832c('0x1d')](this));ami['on'](_0x832c('0x2a'),this[_0x832c('0x2b')][_0x832c('0x1d')](this));return BPromise['resolve']()['then'](ami[_0x832c('0x2c')]())[_0x832c('0x2d')](function(_0x271e61){console[_0x832c('0x2e')](_0x271e61);});}VoiceCallReport[_0x832c('0x2f')][_0x832c('0x30')]=function(_0x469f8c){return _0x469f8c!==null&&!_[_0x832c('0x31')](_0x469f8c);};VoiceCallReport[_0x832c('0x2f')][_0x832c('0x32')]=function(_0x4bf500,_0x15f931,_0x26f357){io['to'](_0x4bf500)['emit'](_0x15f931,_0x26f357);};VoiceCallReport[_0x832c('0x2f')][_0x832c('0x25')]=function(_0x447a23){try{if(this[_0x832c('0x30')](_0x447a23)){if(_0x447a23[_0x832c('0x33')]===_0x447a23[_0x832c('0x34')]){if(!_['isUndefined'](this[_0x832c('0x1a')][_0x447a23[_0x832c('0x33')]])){_['merge'](this['channels'][_0x447a23[_0x832c('0x33')]],_['pick'](_0x447a23,_[_0x832c('0x35')](this[_0x832c('0x1a')][_0x447a23['uniqueid']])));}}}}catch(_0xdd366c){logger[_0x832c('0x36')](_0x832c('0x37'),util[_0x832c('0x38')](_0xdd366c,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0x832c('0x2f')][_0x832c('0x1f')]=function(_0x37f82b){try{if(this[_0x832c('0x30')](_0x37f82b)){if(_0x37f82b[_0x832c('0x33')]===_0x37f82b[_0x832c('0x34')]&&_0x37f82b[_0x832c('0x39')]!=_0x832c('0x3a')){if(_[_0x832c('0x31')](this[_0x832c('0x1a')][_0x37f82b[_0x832c('0x33')]])){this[_0x832c('0x1a')][_0x37f82b[_0x832c('0x33')]]=new Channel();this[_0x832c('0x1a')][_0x37f82b[_0x832c('0x33')]][_0x832c('0x3b')]=moment()[_0x832c('0x3c')](_0x832c('0x3d'));this[_0x832c('0x1a')][_0x37f82b[_0x832c('0x33')]][_0x832c('0x3e')]=dispositions[_[_0x832c('0x3f')](_0x37f82b[_0x832c('0x40')])];_[_0x832c('0x41')](this[_0x832c('0x1a')][_0x37f82b[_0x832c('0x33')]],_[_0x832c('0x42')](_0x37f82b,_[_0x832c('0x35')](this[_0x832c('0x1a')][_0x37f82b[_0x832c('0x33')]])));if(_0x37f82b[_0x832c('0x43')]===_0x832c('0x44')){if(this[_0x832c('0x1b')][_0x37f82b['channel']['split']('-')[0x0]]){this[_0x832c('0x1b')][_0x37f82b[_0x832c('0x39')][_0x832c('0x45')]('-')[0x0]][_0x832c('0x46')]=_0x37f82b[_0x832c('0x47')];this[_0x832c('0x32')](util['format'](_0x832c('0x48'),this[_0x832c('0x1b')][_0x37f82b[_0x832c('0x39')]['split']('-')[0x0]][_0x832c('0x49')]),'user:agentconnect',{'destaccountcode':this[_0x832c('0x1b')][_0x37f82b[_0x832c('0x39')][_0x832c('0x45')]('-')[0x0]]['accountcode'],'destconnectedlinenum':_0x37f82b[_0x832c('0x47')]});}}}}}}catch(_0x4a5038){logger[_0x832c('0x36')](_0x832c('0x4a'),util[_0x832c('0x38')](_0x4a5038,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0x832c('0x2f')][_0x832c('0x1c')]=function(_0x3e73f7){try{if(this[_0x832c('0x30')](_0x3e73f7)){if(_0x3e73f7[_0x832c('0x33')]===_0x3e73f7[_0x832c('0x34')]&&_0x3e73f7[_0x832c('0x47')]!='h'&&_0x3e73f7[_0x832c('0x39')]!=_0x832c('0x3a')){_0x3e73f7[_0x832c('0x4b')]=_0x3e73f7['application']['toLowerCase']();_0x3e73f7[_0x832c('0x4c')]=(_0x3e73f7['appdata']||_0x3e73f7[_0x832c('0x4c')])[_0x832c('0x4d')]();if(_[_0x832c('0x31')](this['channels'][_0x3e73f7[_0x832c('0x33')]])){this['channels'][_0x3e73f7[_0x832c('0x33')]]=new Channel();this[_0x832c('0x1a')][_0x3e73f7[_0x832c('0x33')]][_0x832c('0x3b')]=_0x3e73f7[_0x832c('0x4e')]?moment()[_0x832c('0x4f')](moment['duration'](_0x3e73f7[_0x832c('0x4e')])[_0x832c('0x50')](),_0x832c('0x50'))['format']('YYYY-MM-DD\x20HH:mm:ss'):moment()[_0x832c('0x3c')](_0x832c('0x3d'));this[_0x832c('0x1a')][_0x3e73f7['uniqueid']][_0x832c('0x3e')]='NO\x20ANSWER';}_['merge'](this['channels'][_0x3e73f7['uniqueid']],_[_0x832c('0x42')](_0x3e73f7,_[_0x832c('0x35')](this[_0x832c('0x1a')][_0x3e73f7[_0x832c('0x33')]])));if(_[_0x832c('0x51')](applications,_0x3e73f7['application'])){this[_0x832c('0x1a')][_0x3e73f7[_0x832c('0x33')]][_0x832c('0x52')]=_0x3e73f7['application'];this[_0x832c('0x1a')][_0x3e73f7[_0x832c('0x33')]][_0x832c('0x53')]=_0x3e73f7[_0x832c('0x4c')];if(_0x3e73f7['application']===_0x832c('0xe')&&_[_0x832c('0x54')](_0x3e73f7['applicationdata'],_0x832c('0x55'))){var _0x153407=_0x3e73f7[_0x832c('0x4c')][_0x832c('0x45')]('=');var _0x5c9279=_0x153407[0x0][_0x832c('0x56')](/cdr\((.*)\)/);if(_0x5c9279){this['channels'][_0x3e73f7[_0x832c('0x33')]][_0x5c9279[0x1]]=_0x153407[0x1];}}else if(_0x3e73f7['application']===_0x832c('0x57')){this['channels'][_0x3e73f7['uniqueid']]['queue']=_0x3e73f7['applicationdata'][_0x832c('0x45')](',')[0x0];}}}}}catch(_0x1027f3){logger[_0x832c('0x36')](_0x832c('0x58'),util[_0x832c('0x38')](_0x1027f3,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0x832c('0x2f')][_0x832c('0x20')]=function(_0x5ede23){try{if(this[_0x832c('0x30')](_0x5ede23)){if(_0x5ede23['uniqueid']!==_0x5ede23['linkedid']){if(this[_0x832c('0x1a')][_0x5ede23[_0x832c('0x34')]]){if(_0x5ede23[_0x832c('0x40')]==='6'){if(!this[_0x832c('0x1a')][_0x5ede23[_0x832c('0x34')]]['answered']){var _0x2d5c49=moment();this[_0x832c('0x1a')][_0x5ede23[_0x832c('0x34')]][_0x832c('0x59')]=!![];this[_0x832c('0x1a')][_0x5ede23['linkedid']][_0x832c('0x5a')]=_0x2d5c49[_0x832c('0x3c')](_0x832c('0x3d'));if(this[_0x832c('0x1a')][_0x5ede23[_0x832c('0x34')]]['starttime']){this['channels'][_0x5ede23[_0x832c('0x34')]]['holdtime']=_0x2d5c49[_0x832c('0x5b')](this[_0x832c('0x1a')][_0x5ede23[_0x832c('0x34')]][_0x832c('0x3b')],_0x832c('0x50'));}}this[_0x832c('0x1a')][_0x5ede23[_0x832c('0x34')]][_0x832c('0x34')]=_0x5ede23[_0x832c('0x33')];if(_0x5ede23[_0x832c('0x5c')]!==_0x832c('0x5d')){this[_0x832c('0x1a')][_0x5ede23[_0x832c('0x34')]][_0x832c('0x5e')]=_0x5ede23[_0x832c('0x5c')];}this['channels'][_0x5ede23[_0x832c('0x34')]][_0x832c('0x5f')]=_0x5ede23[_0x832c('0x60')];this['channels'][_0x5ede23[_0x832c('0x34')]]['destinationchannel']=_0x5ede23[_0x832c('0x39')];this[_0x832c('0x1a')][_0x5ede23['linkedid']][_0x832c('0x3e')]=dispositions[_['toNumber'](_0x5ede23[_0x832c('0x40')])];if(this['agents'][_0x5ede23[_0x832c('0x39')]['split']('-')[0x0]]){this['channels'][_0x5ede23['linkedid']]['UserId']=this['agents'][_0x5ede23['channel'][_0x832c('0x45')]('-')[0x0]]['id'];this[_0x832c('0x1a')][_0x5ede23[_0x832c('0x34')]][_0x832c('0x61')]=this[_0x832c('0x1b')][_0x5ede23['channel'][_0x832c('0x45')]('-')[0x0]][_0x832c('0x49')];}}}}else{if(this[_0x832c('0x1a')][_0x5ede23[_0x832c('0x33')]]){if(_0x5ede23['channelstate']==='6'){if(this['agents'][_0x5ede23[_0x832c('0x39')][_0x832c('0x45')]('-')[0x0]]){this[_0x832c('0x1a')][_0x5ede23[_0x832c('0x33')]][_0x832c('0x62')]=this[_0x832c('0x1b')][_0x5ede23[_0x832c('0x39')][_0x832c('0x45')]('-')[0x0]]['id'];this[_0x832c('0x1a')][_0x5ede23[_0x832c('0x33')]]['membername']=this['agents'][_0x5ede23[_0x832c('0x39')]['split']('-')[0x0]][_0x832c('0x49')];}}}}}}catch(_0x446079){logger[_0x832c('0x36')](_0x832c('0x63'),util[_0x832c('0x38')](_0x446079,{'showHidden':![],'depth':null}));}};VoiceCallReport['prototype']['syncMixMonitorFilename']=function(_0x28adc4,_0x29917b){if(this[_0x832c('0x1a')][_0x28adc4]){this['channels'][_0x28adc4][_0x832c('0x64')]=!![];if(_['endsWith'](_0x29917b,_0x832c('0x65'))){_0x29917b=_0x29917b[_0x832c('0x66')]('.wav49',_0x832c('0x67'));}this[_0x832c('0x1a')][_0x28adc4][_0x832c('0x68')]=_0x29917b;var _0x112e43=_['find'](this[_0x832c('0x1a')][_0x28adc4]['monitors'],{'filename':_0x29917b});if(_[_0x832c('0x69')](_0x112e43)){this[_0x832c('0x1a')][_0x28adc4][_0x832c('0x6a')][_0x832c('0x6b')]({'filename':_0x29917b,'createdAt':moment()['format'](_0x832c('0x3d')),'mixmonitorid':'','status':'rec'});}}};VoiceCallReport[_0x832c('0x2f')][_0x832c('0x22')]=function(_0x36ce61){try{if(this[_0x832c('0x30')](_0x36ce61)){if(this[_0x832c('0x1a')][_0x36ce61[_0x832c('0x33')]]&&_0x36ce61['channel']!=_0x832c('0x3a')){if(this['isNotNull'](_0x36ce61[_0x832c('0x6c')])){if(this[_0x832c('0x30')](_0x36ce61['variable'][_0x832c('0x6d')])){this['syncMixMonitorFilename'](_0x36ce61[_0x832c('0x33')],_0x36ce61[_0x832c('0x6e')]);}else if(this[_0x832c('0x30')](_0x36ce61['variable'][_0x832c('0x6f')])){this['channels'][_0x36ce61[_0x832c('0x33')]][_0x832c('0x5c')]=_0x36ce61[_0x832c('0x6e')];}else if(this[_0x832c('0x30')](_0x36ce61[_0x832c('0x6c')][_0x832c('0x70')])){this[_0x832c('0x1a')][_0x36ce61[_0x832c('0x33')]][_0x832c('0x71')]=_0x36ce61[_0x832c('0x6e')];}else if(this[_0x832c('0x30')](_0x36ce61[_0x832c('0x6c')][_0x832c('0x72')])){this[_0x832c('0x1a')][_0x36ce61[_0x832c('0x33')]][_0x832c('0x73')]=_0x36ce61[_0x832c('0x6e')];}else if(this['isNotNull'](_0x36ce61['variable']['xmd-queue'])){this[_0x832c('0x1a')][_0x36ce61['uniqueid']]['queue']=_0x36ce61['value'][_0x832c('0x45')](',')[0x0];}else if(this[_0x832c('0x30')](_0x36ce61['variable'][_0x832c('0x74')])){this[_0x832c('0x1a')][_0x36ce61[_0x832c('0x33')]][_0x832c('0x75')]=_0x36ce61[_0x832c('0x6e')];}else if(this[_0x832c('0x30')](_0x36ce61[_0x832c('0x6c')]['xmd-destination'])){this['channels'][_0x36ce61['uniqueid']]['destination']=_0x36ce61[_0x832c('0x6e')];}else if(this[_0x832c('0x30')](_0x36ce61[_0x832c('0x6c')]['xmd-callerid-preview'])){this[_0x832c('0x1a')][_0x36ce61[_0x832c('0x33')]]['calleridpreview']=_0x36ce61[_0x832c('0x6e')];}else if(this[_0x832c('0x30')](_0x36ce61[_0x832c('0x6c')][_0x832c('0x76')])){this[_0x832c('0x1a')][_0x36ce61[_0x832c('0x33')]][_0x832c('0x57')]=_0x36ce61[_0x832c('0x6e')];}else if(this[_0x832c('0x30')](_0x36ce61[_0x832c('0x6c')][_0x832c('0x77')])){this[_0x832c('0x1a')][_0x36ce61['uniqueid']]['sipcalluniqueid']=_0x36ce61[_0x832c('0x6e')];}}}else if(this[_0x832c('0x30')](_0x36ce61[_0x832c('0x6c')][_0x832c('0x6d')])){if(_0x36ce61[_0x832c('0x6e')]){var _0x5e891e=path[_0x832c('0x78')](_0x36ce61['value'])['name'];this[_0x832c('0x79')](_0x5e891e,_0x36ce61['value']);}}else if(this[_0x832c('0x1a')][_0x36ce61[_0x832c('0x34')]]){if(this[_0x832c('0x30')](_0x36ce61['variable'])){if(this[_0x832c('0x30')](_0x36ce61[_0x832c('0x6c')][_0x832c('0x77')])){this['channels'][_0x36ce61[_0x832c('0x34')]][_0x832c('0x7a')]=_0x36ce61[_0x832c('0x6e')];}}}}}catch(_0x2ef610){logger['error'](_0x832c('0x7b'),util[_0x832c('0x38')](_0x2ef610,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0x832c('0x2f')][_0x832c('0x23')]=function(_0x253c4a){try{if(this[_0x832c('0x30')](_0x253c4a)){if(this[_0x832c('0x1a')][_0x253c4a['uniqueid']]){var _0x18c80b=moment();this['channels'][_0x253c4a['uniqueid']]['endtime']=_0x18c80b['format']('YYYY-MM-DD\x20HH:mm:ss');this[_0x832c('0x1a')][_0x253c4a['uniqueid']][_0x832c('0x4e')]=_0x18c80b[_0x832c('0x5b')](this[_0x832c('0x1a')][_0x253c4a[_0x832c('0x33')]]['starttime'],_0x832c('0x50'));if(this[_0x832c('0x1a')][_0x253c4a[_0x832c('0x33')]]['answered']){this[_0x832c('0x1a')][_0x253c4a[_0x832c('0x33')]][_0x832c('0x7c')]=_0x18c80b['diff'](this[_0x832c('0x1a')][_0x253c4a['uniqueid']]['answertime'],_0x832c('0x50'));this[_0x832c('0x1a')][_0x253c4a['uniqueid']][_0x832c('0x7d')]=this['channels'][_0x253c4a['uniqueid']]['duration']-this[_0x832c('0x1a')][_0x253c4a[_0x832c('0x33')]]['billableseconds'];}if(_0x253c4a[_0x832c('0x43')]==='from-sip'){if(this[_0x832c('0x1b')][_0x253c4a[_0x832c('0x39')][_0x832c('0x45')]('-')[0x0]]){this[_0x832c('0x1b')][_0x253c4a[_0x832c('0x39')]['split']('-')[0x0]]=_['omit'](this[_0x832c('0x1b')][_0x253c4a[_0x832c('0x39')][_0x832c('0x45')]('-')[0x0]],[_0x832c('0x46')]);this['emit'](util[_0x832c('0x3c')]('user:%s',this[_0x832c('0x1b')][_0x253c4a[_0x832c('0x39')][_0x832c('0x45')]('-')[0x0]][_0x832c('0x49')]),_0x832c('0x7e'),{'destaccountcode':this[_0x832c('0x1b')][_0x253c4a['channel']['split']('-')[0x0]][_0x832c('0x7f')]});}}ami[_0x832c('0x32')]('custom:voiceCallReport',this[_0x832c('0x1a')][_0x253c4a[_0x832c('0x33')]]);delete this[_0x832c('0x1a')][_0x253c4a[_0x832c('0x33')]];}}}catch(_0x444a09){logger[_0x832c('0x36')](_0x832c('0x80'),util[_0x832c('0x38')](_0x444a09,{'showHidden':![],'depth':null}));}};VoiceCallReport['prototype'][_0x832c('0x27')]=function(_0x513dba){try{if(this[_0x832c('0x30')](_0x513dba)){if(this['channels'][_0x513dba['transfereeuniqueid']]){this['channels'][_0x513dba['transfereeuniqueid']][_0x832c('0x81')]=_0x513dba[_0x832c('0x82')];this[_0x832c('0x1a')][_0x513dba[_0x832c('0x83')]][_0x832c('0x84')]=_0x513dba['transfertargetcalleridnum'];if(this[_0x832c('0x1a')][_0x513dba[_0x832c('0x85')]]){var _0x4de676=this[_0x832c('0x1a')][_0x513dba[_0x832c('0x85')]];this[_0x832c('0x1a')][_0x513dba[_0x832c('0x85')]]=this[_0x832c('0x1a')][_0x513dba[_0x832c('0x83')]];this[_0x832c('0x1a')][_0x513dba['transfereeuniqueid']]=_0x4de676;}}else if(this[_0x832c('0x1a')][_0x513dba['transfertargetuniqueid']]){this[_0x832c('0x1a')][_0x513dba[_0x832c('0x86')]][_0x832c('0x81')]=_0x513dba[_0x832c('0x82')];this[_0x832c('0x1a')][_0x513dba['transfertargetuniqueid']]['transferconnectedlinenum']=_0x513dba[_0x832c('0x87')];if(this[_0x832c('0x1a')][_0x513dba[_0x832c('0x88')]]){var _0x4de676=this['channels'][_0x513dba[_0x832c('0x88')]];this['channels'][_0x513dba[_0x832c('0x88')]]=this[_0x832c('0x1a')][_0x513dba[_0x832c('0x86')]];this[_0x832c('0x1a')][_0x513dba['transfertargetuniqueid']]=_0x4de676;}}}}catch(_0x6adff3){logger['error'](_0x832c('0x89'),util[_0x832c('0x38')](_0x6adff3,{'showHidden':![],'depth':null}));}};VoiceCallReport['prototype']['syncBlindTransfer']=function(_0xe7a2ed){try{if(this['isNotNull'](_0xe7a2ed)){if(this[_0x832c('0x1a')][_0xe7a2ed[_0x832c('0x83')]]){this['channels'][_0xe7a2ed['transfereeuniqueid']][_0x832c('0x81')]=_0xe7a2ed[_0x832c('0x8a')];this[_0x832c('0x1a')][_0xe7a2ed[_0x832c('0x83')]]['transferconnectedlinenum']=_0xe7a2ed[_0x832c('0x8b')];this[_0x832c('0x23')]({'event':'BlindTransfer','uniqueid':_0xe7a2ed[_0x832c('0x83')],'context':_0xe7a2ed[_0x832c('0x43')],'channel':_0xe7a2ed[_0x832c('0x8c')]});}}}catch(_0x7aa977){logger[_0x832c('0x36')](_0x832c('0x8d'),util[_0x832c('0x38')](_0x7aa977,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0x832c('0x2f')][_0x832c('0x8e')]=function(_0x270e90){try{if(this[_0x832c('0x30')](_0x270e90)){if(this[_0x832c('0x1a')][_0x270e90[_0x832c('0x33')]]){if(!_[_0x832c('0x69')](this[_0x832c('0x1a')][_0x270e90[_0x832c('0x33')]][_0x832c('0x5a')])){this['channels'][_0x270e90['uniqueid']]['mohstarttime']=moment()['format'](_0x832c('0x3d'));}}}}catch(_0x54895){logger[_0x832c('0x36')](_0x832c('0x8f'),util[_0x832c('0x38')](_0x54895,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0x832c('0x2f')][_0x832c('0x2b')]=function(_0x51f1cd){try{if(this[_0x832c('0x30')](_0x51f1cd)){if(this[_0x832c('0x1a')][_0x51f1cd[_0x832c('0x33')]]){if(!_[_0x832c('0x69')](this[_0x832c('0x1a')][_0x51f1cd['uniqueid']]['mohstarttime'])){this['channels'][_0x51f1cd['uniqueid']][_0x832c('0x90')]+=moment()['milliseconds'](0x0)['diff'](this[_0x832c('0x1a')][_0x51f1cd[_0x832c('0x33')]]['mohstarttime'],_0x832c('0x50'));delete this[_0x832c('0x1a')][_0x51f1cd['uniqueid']][_0x832c('0x91')];}}}}catch(_0x313e01){logger[_0x832c('0x36')](_0x832c('0x92'),util[_0x832c('0x38')](_0x313e01,{'showHidden':![],'depth':null}));}};module['exports']=VoiceCallReport; \ No newline at end of file +var _0x54dd=['error','inspect','channel','OutgoingSpoolFailed','starttime','format','YYYY-MM-DD\x20HH:mm:ss','toNumber','context','from-sip','split','destconnectedlinenum','user:%s','name','user:agentconnect','accountcode','[syncNewChannel][VoiceCallReport]','exten','application','toLowerCase','appdata','duration','subtract','seconds','disposition','includes','lastdata','set','startsWith','applicationdata','answertime','holdtime','diff','calleridnum','xcally-motion-preview','connectedlinename','calleridname','destinationchannel','UserId','membername','channelstate','syncMixMonitorFilename','.wav49','replace','.WAV','monitorFilename','find','monitors','push','rec','variable','mixmonitor_filename','value','xmd-phone','xmd-callerid','callerid','xmd-cdrtype','type','xmd-queue','xmd-originatecalleridnum','xmd-destination','destination','xmd-callerid-preview','calleridpreview','xmcs-queue','sipcallid','sipcalluniqueid','parse','sipcalllinkedid','syncHangup','answered','billableseconds','omit','user:agentcomplete','custom:voiceCallReport','transfereeuniqueid','origtransferercalleridnum','transferconnectedlinenum','secondtransfereruniqueid','transfertargetuniqueid','transfertargetcalleridnum','origtransfereruniqueid','[syncAttendedTransfer][VoiceCallReport]','transfercalleridnum','transfereecalleridnum','extension','BlindTransfer','transfererchannel','[syncBlindTransfer][VoiceCallReport]','isNil','[syncMusicOnHoldStart][VoiceCallReport]','mohstarttime','mohtime','milliseconds','[syncMusicOnHoldStop][VoiceCallReport]','exports','bluebird','lodash','moment','util','path','ioredis','../../../config/logger','ami','../model/channel','not_inuse','inuse','busy','invalid','ringing','ringinuse','onhold','queue','agi','playback','voicemail','NO\x20ANSWER','FAILED','ANSWERED','redis','defaults','localhost','socket.io-emitter','channels','agents','coreshowchannel','syncNewExten','bind','newexten','newchannel','syncNewChannel','newstate','syncNewState','varset','syncVarSet','hangup','newcallerid','syncNewCallerId','attendedtransfer','syncAttendedTransfer','syncBlindTransfer','syncMusicOnHoldStart','musiconholdstop','syncMusicOnHoldStop','resolve','actionCoreShowChannels','catch','log','prototype','isNotNull','isUndefined','emit','uniqueid','linkedid','merge','pick','keys'];(function(_0x45c3f7,_0x2b7dcc){var _0x2bfbe2=function(_0x19371f){while(--_0x19371f){_0x45c3f7['push'](_0x45c3f7['shift']());}};_0x2bfbe2(++_0x2b7dcc);}(_0x54dd,0x19a));var _0xd54d=function(_0x4d17fb,_0x24c37e){_0x4d17fb=_0x4d17fb-0x0;var _0x4daf27=_0x54dd[_0x4d17fb];return _0x4daf27;};'use strict';var BPromise=require(_0xd54d('0x0'));var _=require(_0xd54d('0x1'));var moment=require(_0xd54d('0x2'));var util=require(_0xd54d('0x3'));var path=require(_0xd54d('0x4'));var Redis=require(_0xd54d('0x5'));var config=require('../../../config/environment');var logger=require(_0xd54d('0x6'))(_0xd54d('0x7'));var ami=require('../ami');var Channel=require(_0xd54d('0x8'));var statusDesc=['unknown',_0xd54d('0x9'),_0xd54d('0xa'),_0xd54d('0xb'),_0xd54d('0xc'),'unavailable',_0xd54d('0xd'),_0xd54d('0xe'),_0xd54d('0xf')];var applications=['set',_0xd54d('0x10'),_0xd54d('0x11'),'dial',_0xd54d('0x12'),_0xd54d('0x13')];var dispositions=[_0xd54d('0x14'),'FAILED',_0xd54d('0x15'),_0xd54d('0x14'),'NO\x20ANSWER',_0xd54d('0x14'),_0xd54d('0x16'),'BUSY','FAILED','FAILED',_0xd54d('0x15')];var actions={};config[_0xd54d('0x17')]=_[_0xd54d('0x18')](config[_0xd54d('0x17')],{'host':_0xd54d('0x19'),'port':0x18eb});var io=require(_0xd54d('0x1a'))(new Redis(config[_0xd54d('0x17')]));function VoiceCallReport(_0x17969c){this[_0xd54d('0x1b')]=_0x17969c[_0xd54d('0x1b')];this['agents']=_0x17969c[_0xd54d('0x1c')];ami['on'](_0xd54d('0x1d'),this[_0xd54d('0x1e')][_0xd54d('0x1f')](this));ami['on'](_0xd54d('0x20'),this[_0xd54d('0x1e')][_0xd54d('0x1f')](this));ami['on'](_0xd54d('0x21'),this[_0xd54d('0x22')]['bind'](this));ami['on'](_0xd54d('0x23'),this[_0xd54d('0x24')]['bind'](this));ami['on'](_0xd54d('0x25'),this[_0xd54d('0x26')][_0xd54d('0x1f')](this));ami['on'](_0xd54d('0x27'),this['syncHangup'][_0xd54d('0x1f')](this));ami['on'](_0xd54d('0x28'),this[_0xd54d('0x29')][_0xd54d('0x1f')](this));ami['on'](_0xd54d('0x2a'),this[_0xd54d('0x2b')][_0xd54d('0x1f')](this));ami['on']('blindtransfer',this[_0xd54d('0x2c')][_0xd54d('0x1f')](this));ami['on']('musiconholdstart',this[_0xd54d('0x2d')][_0xd54d('0x1f')](this));ami['on'](_0xd54d('0x2e'),this[_0xd54d('0x2f')][_0xd54d('0x1f')](this));return BPromise[_0xd54d('0x30')]()['then'](ami[_0xd54d('0x31')]())[_0xd54d('0x32')](function(_0x390dd9){console[_0xd54d('0x33')](_0x390dd9);});}VoiceCallReport[_0xd54d('0x34')][_0xd54d('0x35')]=function(_0x366329){return _0x366329!==null&&!_[_0xd54d('0x36')](_0x366329);};VoiceCallReport[_0xd54d('0x34')][_0xd54d('0x37')]=function(_0x42d34b,_0x5322bb,_0x2201d4){io['to'](_0x42d34b)[_0xd54d('0x37')](_0x5322bb,_0x2201d4);};VoiceCallReport[_0xd54d('0x34')][_0xd54d('0x29')]=function(_0x2c444a){try{if(this[_0xd54d('0x35')](_0x2c444a)){if(_0x2c444a[_0xd54d('0x38')]===_0x2c444a[_0xd54d('0x39')]){if(!_['isUndefined'](this[_0xd54d('0x1b')][_0x2c444a['uniqueid']])){_[_0xd54d('0x3a')](this[_0xd54d('0x1b')][_0x2c444a['uniqueid']],_[_0xd54d('0x3b')](_0x2c444a,_[_0xd54d('0x3c')](this[_0xd54d('0x1b')][_0x2c444a[_0xd54d('0x38')]])));}}}}catch(_0x41ef9c){logger[_0xd54d('0x3d')]('[syncNewCallerId][VoiceCallReport]',util[_0xd54d('0x3e')](_0x41ef9c,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0xd54d('0x34')][_0xd54d('0x22')]=function(_0x3afeb1){try{if(this[_0xd54d('0x35')](_0x3afeb1)){if(_0x3afeb1['uniqueid']===_0x3afeb1[_0xd54d('0x39')]&&_0x3afeb1[_0xd54d('0x3f')]!=_0xd54d('0x40')){if(_[_0xd54d('0x36')](this[_0xd54d('0x1b')][_0x3afeb1[_0xd54d('0x38')]])){this[_0xd54d('0x1b')][_0x3afeb1[_0xd54d('0x38')]]=new Channel();this[_0xd54d('0x1b')][_0x3afeb1[_0xd54d('0x38')]][_0xd54d('0x41')]=moment()[_0xd54d('0x42')](_0xd54d('0x43'));this[_0xd54d('0x1b')][_0x3afeb1[_0xd54d('0x38')]]['disposition']=dispositions[_[_0xd54d('0x44')](_0x3afeb1['channelstate'])];_[_0xd54d('0x3a')](this['channels'][_0x3afeb1['uniqueid']],_['pick'](_0x3afeb1,_['keys'](this['channels'][_0x3afeb1['uniqueid']])));if(_0x3afeb1[_0xd54d('0x45')]===_0xd54d('0x46')){if(this[_0xd54d('0x1c')][_0x3afeb1[_0xd54d('0x3f')][_0xd54d('0x47')]('-')[0x0]]){this[_0xd54d('0x1c')][_0x3afeb1['channel'][_0xd54d('0x47')]('-')[0x0]][_0xd54d('0x48')]=_0x3afeb1['exten'];this['emit'](util[_0xd54d('0x42')](_0xd54d('0x49'),this[_0xd54d('0x1c')][_0x3afeb1['channel'][_0xd54d('0x47')]('-')[0x0]][_0xd54d('0x4a')]),_0xd54d('0x4b'),{'destaccountcode':this[_0xd54d('0x1c')][_0x3afeb1[_0xd54d('0x3f')][_0xd54d('0x47')]('-')[0x0]][_0xd54d('0x4c')],'destconnectedlinenum':_0x3afeb1['exten']});}}}}}}catch(_0x3bacc8){logger['error'](_0xd54d('0x4d'),util[_0xd54d('0x3e')](_0x3bacc8,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0xd54d('0x34')][_0xd54d('0x1e')]=function(_0x14c67f){try{if(this['isNotNull'](_0x14c67f)){if(_0x14c67f[_0xd54d('0x38')]===_0x14c67f[_0xd54d('0x39')]&&_0x14c67f[_0xd54d('0x4e')]!='h'&&_0x14c67f[_0xd54d('0x3f')]!=_0xd54d('0x40')){_0x14c67f[_0xd54d('0x4f')]=_0x14c67f[_0xd54d('0x4f')][_0xd54d('0x50')]();_0x14c67f['applicationdata']=(_0x14c67f[_0xd54d('0x51')]||_0x14c67f['applicationdata'])[_0xd54d('0x50')]();if(_[_0xd54d('0x36')](this[_0xd54d('0x1b')][_0x14c67f['uniqueid']])){this['channels'][_0x14c67f[_0xd54d('0x38')]]=new Channel();this[_0xd54d('0x1b')][_0x14c67f[_0xd54d('0x38')]][_0xd54d('0x41')]=_0x14c67f[_0xd54d('0x52')]?moment()[_0xd54d('0x53')](moment[_0xd54d('0x52')](_0x14c67f[_0xd54d('0x52')])[_0xd54d('0x54')](),_0xd54d('0x54'))[_0xd54d('0x42')](_0xd54d('0x43')):moment()['format']('YYYY-MM-DD\x20HH:mm:ss');this['channels'][_0x14c67f[_0xd54d('0x38')]][_0xd54d('0x55')]=_0xd54d('0x14');}_['merge'](this[_0xd54d('0x1b')][_0x14c67f[_0xd54d('0x38')]],_['pick'](_0x14c67f,_['keys'](this['channels'][_0x14c67f[_0xd54d('0x38')]])));if(_[_0xd54d('0x56')](applications,_0x14c67f[_0xd54d('0x4f')])){this[_0xd54d('0x1b')][_0x14c67f[_0xd54d('0x38')]]['lastapplication']=_0x14c67f[_0xd54d('0x4f')];this['channels'][_0x14c67f[_0xd54d('0x38')]][_0xd54d('0x57')]=_0x14c67f['applicationdata'];if(_0x14c67f[_0xd54d('0x4f')]===_0xd54d('0x58')&&_[_0xd54d('0x59')](_0x14c67f[_0xd54d('0x5a')],'cdr(')){var _0x241dff=_0x14c67f[_0xd54d('0x5a')]['split']('=');var _0x4658ea=_0x241dff[0x0]['match'](/cdr\((.*)\)/);if(_0x4658ea){this[_0xd54d('0x1b')][_0x14c67f[_0xd54d('0x38')]][_0x4658ea[0x1]]=_0x241dff[0x1];}}else if(_0x14c67f['application']===_0xd54d('0x10')){this['channels'][_0x14c67f[_0xd54d('0x38')]]['queue']=_0x14c67f[_0xd54d('0x5a')][_0xd54d('0x47')](',')[0x0];}}}}}catch(_0x417231){logger[_0xd54d('0x3d')]('[syncNewExten][VoiceCallReport]',util[_0xd54d('0x3e')](_0x417231,{'showHidden':![],'depth':null}));}};VoiceCallReport['prototype'][_0xd54d('0x24')]=function(_0x254029){try{if(this['isNotNull'](_0x254029)){if(_0x254029[_0xd54d('0x38')]!==_0x254029[_0xd54d('0x39')]){if(this[_0xd54d('0x1b')][_0x254029[_0xd54d('0x39')]]){if(_0x254029['channelstate']==='6'){if(!this[_0xd54d('0x1b')][_0x254029[_0xd54d('0x39')]]['answered']){var _0x1f7205=moment();this[_0xd54d('0x1b')][_0x254029[_0xd54d('0x39')]]['answered']=!![];this[_0xd54d('0x1b')][_0x254029[_0xd54d('0x39')]][_0xd54d('0x5b')]=_0x1f7205[_0xd54d('0x42')]('YYYY-MM-DD\x20HH:mm:ss');if(this[_0xd54d('0x1b')][_0x254029['linkedid']][_0xd54d('0x41')]){this[_0xd54d('0x1b')][_0x254029[_0xd54d('0x39')]][_0xd54d('0x5c')]=_0x1f7205[_0xd54d('0x5d')](this['channels'][_0x254029[_0xd54d('0x39')]][_0xd54d('0x41')],_0xd54d('0x54'));}}this[_0xd54d('0x1b')][_0x254029[_0xd54d('0x39')]][_0xd54d('0x39')]=_0x254029[_0xd54d('0x38')];if(_0x254029[_0xd54d('0x5e')]!==_0xd54d('0x5f')){this[_0xd54d('0x1b')][_0x254029[_0xd54d('0x39')]]['connectedlinenum']=_0x254029[_0xd54d('0x5e')];}this[_0xd54d('0x1b')][_0x254029['linkedid']][_0xd54d('0x60')]=_0x254029[_0xd54d('0x61')];this[_0xd54d('0x1b')][_0x254029[_0xd54d('0x39')]][_0xd54d('0x62')]=_0x254029['channel'];this[_0xd54d('0x1b')][_0x254029[_0xd54d('0x39')]]['disposition']=dispositions[_['toNumber'](_0x254029['channelstate'])];if(this[_0xd54d('0x1c')][_0x254029[_0xd54d('0x3f')][_0xd54d('0x47')]('-')[0x0]]){this[_0xd54d('0x1b')][_0x254029[_0xd54d('0x39')]][_0xd54d('0x63')]=this['agents'][_0x254029['channel'][_0xd54d('0x47')]('-')[0x0]]['id'];this[_0xd54d('0x1b')][_0x254029['linkedid']][_0xd54d('0x64')]=this['agents'][_0x254029[_0xd54d('0x3f')][_0xd54d('0x47')]('-')[0x0]][_0xd54d('0x4a')];}}}}else{if(this[_0xd54d('0x1b')][_0x254029[_0xd54d('0x38')]]){if(_0x254029[_0xd54d('0x65')]==='6'){if(this['agents'][_0x254029[_0xd54d('0x3f')][_0xd54d('0x47')]('-')[0x0]]){this[_0xd54d('0x1b')][_0x254029['uniqueid']][_0xd54d('0x63')]=this[_0xd54d('0x1c')][_0x254029['channel']['split']('-')[0x0]]['id'];this['channels'][_0x254029['uniqueid']][_0xd54d('0x64')]=this[_0xd54d('0x1c')][_0x254029[_0xd54d('0x3f')][_0xd54d('0x47')]('-')[0x0]][_0xd54d('0x4a')];}}}}}}catch(_0x531e56){logger['error']('[syncNewState][VoiceCallReport]',util[_0xd54d('0x3e')](_0x531e56,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0xd54d('0x34')][_0xd54d('0x66')]=function(_0x1c9af8,_0x3803be){if(this[_0xd54d('0x1b')][_0x1c9af8]){this[_0xd54d('0x1b')][_0x1c9af8]['monitor']=!![];if(_['endsWith'](_0x3803be,_0xd54d('0x67'))){_0x3803be=_0x3803be[_0xd54d('0x68')]('.wav49',_0xd54d('0x69'));}this[_0xd54d('0x1b')][_0x1c9af8][_0xd54d('0x6a')]=_0x3803be;var _0x394d98=_[_0xd54d('0x6b')](this[_0xd54d('0x1b')][_0x1c9af8][_0xd54d('0x6c')],{'filename':_0x3803be});if(_['isNil'](_0x394d98)){this[_0xd54d('0x1b')][_0x1c9af8][_0xd54d('0x6c')][_0xd54d('0x6d')]({'filename':_0x3803be,'createdAt':moment()[_0xd54d('0x42')](_0xd54d('0x43')),'mixmonitorid':'','status':_0xd54d('0x6e')});}}};VoiceCallReport[_0xd54d('0x34')]['syncVarSet']=function(_0x48efc5){try{if(this[_0xd54d('0x35')](_0x48efc5)){if(this[_0xd54d('0x1b')][_0x48efc5['uniqueid']]&&_0x48efc5[_0xd54d('0x3f')]!='OutgoingSpoolFailed'){if(this[_0xd54d('0x35')](_0x48efc5[_0xd54d('0x6f')])){if(this[_0xd54d('0x35')](_0x48efc5[_0xd54d('0x6f')][_0xd54d('0x70')])){this[_0xd54d('0x66')](_0x48efc5[_0xd54d('0x38')],_0x48efc5[_0xd54d('0x71')]);}else if(this[_0xd54d('0x35')](_0x48efc5['variable'][_0xd54d('0x72')])){this[_0xd54d('0x1b')][_0x48efc5[_0xd54d('0x38')]]['calleridnum']=_0x48efc5['value'];}else if(this[_0xd54d('0x35')](_0x48efc5[_0xd54d('0x6f')][_0xd54d('0x73')])){this['channels'][_0x48efc5[_0xd54d('0x38')]][_0xd54d('0x74')]=_0x48efc5['value'];}else if(this[_0xd54d('0x35')](_0x48efc5[_0xd54d('0x6f')][_0xd54d('0x75')])){this[_0xd54d('0x1b')][_0x48efc5[_0xd54d('0x38')]][_0xd54d('0x76')]=_0x48efc5[_0xd54d('0x71')];}else if(this[_0xd54d('0x35')](_0x48efc5['variable'][_0xd54d('0x77')])){this[_0xd54d('0x1b')][_0x48efc5[_0xd54d('0x38')]][_0xd54d('0x10')]=_0x48efc5[_0xd54d('0x71')]['split'](',')[0x0];}else if(this[_0xd54d('0x35')](_0x48efc5['variable'][_0xd54d('0x78')])){this[_0xd54d('0x1b')][_0x48efc5[_0xd54d('0x38')]]['originatecalleridnum']=_0x48efc5[_0xd54d('0x71')];}else if(this[_0xd54d('0x35')](_0x48efc5[_0xd54d('0x6f')][_0xd54d('0x79')])){this['channels'][_0x48efc5[_0xd54d('0x38')]][_0xd54d('0x7a')]=_0x48efc5['value'];}else if(this['isNotNull'](_0x48efc5[_0xd54d('0x6f')][_0xd54d('0x7b')])){this['channels'][_0x48efc5[_0xd54d('0x38')]][_0xd54d('0x7c')]=_0x48efc5[_0xd54d('0x71')];}else if(this[_0xd54d('0x35')](_0x48efc5[_0xd54d('0x6f')][_0xd54d('0x7d')])){this[_0xd54d('0x1b')][_0x48efc5[_0xd54d('0x38')]][_0xd54d('0x10')]=_0x48efc5[_0xd54d('0x71')];}else if(this[_0xd54d('0x35')](_0x48efc5[_0xd54d('0x6f')][_0xd54d('0x7e')])){this[_0xd54d('0x1b')][_0x48efc5['uniqueid']][_0xd54d('0x7f')]=_0x48efc5['value'];}}}else if(this[_0xd54d('0x35')](_0x48efc5[_0xd54d('0x6f')][_0xd54d('0x70')])){if(_0x48efc5[_0xd54d('0x71')]){var _0x2c0588=path[_0xd54d('0x80')](_0x48efc5[_0xd54d('0x71')])[_0xd54d('0x4a')];this['syncMixMonitorFilename'](_0x2c0588,_0x48efc5['value']);}}else if(this[_0xd54d('0x1b')][_0x48efc5[_0xd54d('0x39')]]){if(this[_0xd54d('0x35')](_0x48efc5[_0xd54d('0x6f')])){if(this[_0xd54d('0x35')](_0x48efc5[_0xd54d('0x6f')][_0xd54d('0x7e')])){this['channels'][_0x48efc5[_0xd54d('0x39')]][_0xd54d('0x81')]=_0x48efc5[_0xd54d('0x71')];}}}}}catch(_0x4f4952){logger[_0xd54d('0x3d')]('[syncVarSet][VoiceCallReport]',util[_0xd54d('0x3e')](_0x4f4952,{'showHidden':![],'depth':null}));}};VoiceCallReport['prototype'][_0xd54d('0x82')]=function(_0x36ab83){try{if(this[_0xd54d('0x35')](_0x36ab83)){if(this[_0xd54d('0x1b')][_0x36ab83[_0xd54d('0x38')]]){var _0x133996=moment();this[_0xd54d('0x1b')][_0x36ab83['uniqueid']]['endtime']=_0x133996['format'](_0xd54d('0x43'));this[_0xd54d('0x1b')][_0x36ab83[_0xd54d('0x38')]][_0xd54d('0x52')]=_0x133996['diff'](this['channels'][_0x36ab83[_0xd54d('0x38')]][_0xd54d('0x41')],_0xd54d('0x54'));if(this[_0xd54d('0x1b')][_0x36ab83['uniqueid']][_0xd54d('0x83')]){this[_0xd54d('0x1b')][_0x36ab83[_0xd54d('0x38')]]['billableseconds']=_0x133996[_0xd54d('0x5d')](this[_0xd54d('0x1b')][_0x36ab83[_0xd54d('0x38')]][_0xd54d('0x5b')],'seconds');this['channels'][_0x36ab83[_0xd54d('0x38')]][_0xd54d('0x5c')]=this['channels'][_0x36ab83['uniqueid']][_0xd54d('0x52')]-this[_0xd54d('0x1b')][_0x36ab83[_0xd54d('0x38')]][_0xd54d('0x84')];}if(_0x36ab83[_0xd54d('0x45')]===_0xd54d('0x46')){if(this[_0xd54d('0x1c')][_0x36ab83['channel'][_0xd54d('0x47')]('-')[0x0]]){this[_0xd54d('0x1c')][_0x36ab83[_0xd54d('0x3f')][_0xd54d('0x47')]('-')[0x0]]=_[_0xd54d('0x85')](this['agents'][_0x36ab83['channel']['split']('-')[0x0]],[_0xd54d('0x48')]);this[_0xd54d('0x37')](util['format'](_0xd54d('0x49'),this[_0xd54d('0x1c')][_0x36ab83[_0xd54d('0x3f')]['split']('-')[0x0]][_0xd54d('0x4a')]),_0xd54d('0x86'),{'destaccountcode':this['agents'][_0x36ab83[_0xd54d('0x3f')]['split']('-')[0x0]][_0xd54d('0x4c')]});}}ami['emit'](_0xd54d('0x87'),this[_0xd54d('0x1b')][_0x36ab83['uniqueid']]);delete this['channels'][_0x36ab83['uniqueid']];}}}catch(_0x2b42a0){logger[_0xd54d('0x3d')]('[syncHangup][VoiceCallReport]',util[_0xd54d('0x3e')](_0x2b42a0,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0xd54d('0x34')][_0xd54d('0x2b')]=function(_0x528281){try{if(this['isNotNull'](_0x528281)){if(this[_0xd54d('0x1b')][_0x528281['transfereeuniqueid']]){this['channels'][_0x528281[_0xd54d('0x88')]]['transfercalleridnum']=_0x528281[_0xd54d('0x89')];this[_0xd54d('0x1b')][_0x528281['transfereeuniqueid']][_0xd54d('0x8a')]=_0x528281['transfertargetcalleridnum'];if(this[_0xd54d('0x1b')][_0x528281['secondtransfereruniqueid']]){var _0x1657b1=this[_0xd54d('0x1b')][_0x528281[_0xd54d('0x8b')]];this[_0xd54d('0x1b')][_0x528281[_0xd54d('0x8b')]]=this['channels'][_0x528281[_0xd54d('0x88')]];this['channels'][_0x528281[_0xd54d('0x88')]]=_0x1657b1;}}else if(this[_0xd54d('0x1b')][_0x528281['transfertargetuniqueid']]){this[_0xd54d('0x1b')][_0x528281['transfertargetuniqueid']]['transfercalleridnum']=_0x528281['origtransferercalleridnum'];this[_0xd54d('0x1b')][_0x528281[_0xd54d('0x8c')]][_0xd54d('0x8a')]=_0x528281[_0xd54d('0x8d')];if(this['channels'][_0x528281[_0xd54d('0x8e')]]){var _0x1657b1=this[_0xd54d('0x1b')][_0x528281['origtransfereruniqueid']];this[_0xd54d('0x1b')][_0x528281[_0xd54d('0x8e')]]=this[_0xd54d('0x1b')][_0x528281[_0xd54d('0x8c')]];this['channels'][_0x528281['transfertargetuniqueid']]=_0x1657b1;}}}}catch(_0x20011d){logger[_0xd54d('0x3d')](_0xd54d('0x8f'),util[_0xd54d('0x3e')](_0x20011d,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0xd54d('0x34')]['syncBlindTransfer']=function(_0x47c2bf){try{if(this[_0xd54d('0x35')](_0x47c2bf)){if(this[_0xd54d('0x1b')][_0x47c2bf[_0xd54d('0x88')]]){this[_0xd54d('0x1b')][_0x47c2bf[_0xd54d('0x88')]][_0xd54d('0x90')]=_0x47c2bf[_0xd54d('0x91')];this[_0xd54d('0x1b')][_0x47c2bf['transfereeuniqueid']]['transferconnectedlinenum']=_0x47c2bf[_0xd54d('0x92')];this['syncHangup']({'event':_0xd54d('0x93'),'uniqueid':_0x47c2bf[_0xd54d('0x88')],'context':_0x47c2bf['context'],'channel':_0x47c2bf[_0xd54d('0x94')]});}}}catch(_0x5f73c3){logger[_0xd54d('0x3d')](_0xd54d('0x95'),util[_0xd54d('0x3e')](_0x5f73c3,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0xd54d('0x34')][_0xd54d('0x2d')]=function(_0x1e4950){try{if(this[_0xd54d('0x35')](_0x1e4950)){if(this[_0xd54d('0x1b')][_0x1e4950[_0xd54d('0x38')]]){if(!_[_0xd54d('0x96')](this[_0xd54d('0x1b')][_0x1e4950[_0xd54d('0x38')]][_0xd54d('0x5b')])){this[_0xd54d('0x1b')][_0x1e4950[_0xd54d('0x38')]]['mohstarttime']=moment()['format'](_0xd54d('0x43'));}}}}catch(_0x444984){logger[_0xd54d('0x3d')](_0xd54d('0x97'),util[_0xd54d('0x3e')](_0x444984,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0xd54d('0x34')][_0xd54d('0x2f')]=function(_0x16b0cc){try{if(this[_0xd54d('0x35')](_0x16b0cc)){if(this['channels'][_0x16b0cc['uniqueid']]){if(!_[_0xd54d('0x96')](this[_0xd54d('0x1b')][_0x16b0cc[_0xd54d('0x38')]][_0xd54d('0x98')])){this[_0xd54d('0x1b')][_0x16b0cc['uniqueid']][_0xd54d('0x99')]+=moment()[_0xd54d('0x9a')](0x0)['diff'](this[_0xd54d('0x1b')][_0x16b0cc[_0xd54d('0x38')]][_0xd54d('0x98')],_0xd54d('0x54'));delete this['channels'][_0x16b0cc[_0xd54d('0x38')]][_0xd54d('0x98')];}}}}catch(_0x50d334){logger[_0xd54d('0x3d')](_0xd54d('0x9b'),util[_0xd54d('0x3e')](_0x50d334,{'showHidden':![],'depth':null}));}};module[_0xd54d('0x9c')]=VoiceCallReport; \ No newline at end of file diff --git a/server/services/ami/report/voiceDialReport.js b/server/services/ami/report/voiceDialReport.js index 43dd182..3d90c26 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 _0x1195=['sipcallid','sipuri','bridgepeer','bridgepvtcallid','membercalls','memberdynamic','memberinterface','memberrealtime','isNil','duration','endtime','seconds','complete','total','answered','holdtime','diff','billableseconds','sumHoldTime','sumDuration','custom:voiceDialReport','info','[DEBUG]\x20Emit\x20voice_outbound_channel:remove\x20event','stringify','voice_outbound_channel:remove','[syncHangup][VoiceDialReport]','lodash','ioredis','../../../config/environment','ami','redis','defaults','localhost','channels','outbound','variables','dialbegin','syncDialBegin','dialend','syncDialEnd','varset','syncVarSet','bind','hangup','syncHangup','isNotNull','prototype','emit','uniqueid','merge','YYYY-MM-DD\x20HH:mm:ss','called','channel','substring','lastIndexOf','omit','event','privilege','voice:outbound','voice_outbound_channel:save','custom:dialbegin','error','[syncDialBegin][VoiceDialReport]','inspect','dialstatus','connectedlinenum','connectedlinename','answertime','format','lastevent','connect','custom:dialconnect','[syncDialEnd][VoiceDialReport]','addVariable','keys','variable','value','outboundrouteid','isUndefined','rtpaudioqos','rtpaudioqosbridged','rtpaudioqosjitter','rtpaudioqosjitterbridged','rtpaudioqosloss','rtpaudioqoslossbridged'];(function(_0xcf1fc9,_0x199b14){var _0x2bf21c=function(_0x1011c7){while(--_0x1011c7){_0xcf1fc9['push'](_0xcf1fc9['shift']());}};_0x2bf21c(++_0x199b14);}(_0x1195,0xc4));var _0x5119=function(_0x307bf6,_0x55bdd5){_0x307bf6=_0x307bf6-0x0;var _0x2878fc=_0x1195[_0x307bf6];return _0x2878fc;};'use strict';var _=require(_0x5119('0x0'));var moment=require('moment');var util=require('util');var Redis=require(_0x5119('0x1'));var config=require(_0x5119('0x2'));var logger=require('../../../config/logger')(_0x5119('0x3'));var ami=require('../ami');config[_0x5119('0x4')]=_[_0x5119('0x5')](config['redis'],{'host':_0x5119('0x6'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x5119('0x4')]));function VoiceDialReport(_0x31a8d1){this[_0x5119('0x7')]=_0x31a8d1['outboundChannels'];this['outbound']=_0x31a8d1[_0x5119('0x8')];this[_0x5119('0x9')]={};ami['on'](_0x5119('0xa'),this[_0x5119('0xb')]['bind'](this));ami['on'](_0x5119('0xc'),this[_0x5119('0xd')]['bind'](this));ami['on'](_0x5119('0xe'),this[_0x5119('0xf')][_0x5119('0x10')](this));ami['on'](_0x5119('0x11'),this[_0x5119('0x12')]['bind'](this));}VoiceDialReport['prototype'][_0x5119('0x13')]=function(_0x5d24b6){return _0x5d24b6!==null&&!_['isUndefined'](_0x5d24b6);};VoiceDialReport[_0x5119('0x14')][_0x5119('0x15')]=function(_0xf4188,_0xf61ba0,_0x58b744){io['to'](_0xf4188)[_0x5119('0x15')](_0xf61ba0,_0x58b744);};VoiceDialReport[_0x5119('0x14')]['syncDialBegin']=function(_0x3eeac1){try{if(this['isNotNull'](_0x3eeac1)){if(this['channels'][_0x3eeac1[_0x5119('0x16')]]){_[_0x5119('0x17')](this[_0x5119('0x7')][_0x3eeac1['uniqueid']],{'starttime':moment()['format'](_0x5119('0x18')),'lastevent':_0x5119('0x19'),'interface':_0x3eeac1[_0x5119('0x1a')][_0x5119('0x1b')](0x0,_0x3eeac1[_0x5119('0x1a')][_0x5119('0x1c')]('-')),'membername':_0x3eeac1[_0x5119('0x1a')][_0x5119('0x1b')](_0x3eeac1[_0x5119('0x1a')][_0x5119('0x1c')]('/')+0x1,_0x3eeac1[_0x5119('0x1a')]['lastIndexOf']('-'))},_[_0x5119('0x1d')](_0x3eeac1,[_0x5119('0x1e'),_0x5119('0x1f')]));this[_0x5119('0x15')](_0x5119('0x20'),_0x5119('0x21'),this[_0x5119('0x7')][_0x3eeac1['uniqueid']]);ami['emit'](_0x5119('0x22'),this[_0x5119('0x7')][_0x3eeac1[_0x5119('0x16')]]);}}}catch(_0x1e73be){logger[_0x5119('0x23')](_0x5119('0x24'),util[_0x5119('0x25')](_0x1e73be,{'showHidden':![],'depth':null}));}};VoiceDialReport['prototype'][_0x5119('0xd')]=function(_0xdedfb5){try{if(this[_0x5119('0x13')](_0xdedfb5)){if(this[_0x5119('0x7')][_0xdedfb5[_0x5119('0x16')]]){this[_0x5119('0x7')][_0xdedfb5[_0x5119('0x16')]][_0x5119('0x26')]=_0xdedfb5['dialstatus'];if(_0xdedfb5[_0x5119('0x26')]==='ANSWER'){this[_0x5119('0x7')][_0xdedfb5[_0x5119('0x16')]][_0x5119('0x27')]=_0xdedfb5[_0x5119('0x27')];this[_0x5119('0x7')][_0xdedfb5['uniqueid']][_0x5119('0x28')]=_0xdedfb5[_0x5119('0x28')];this['channels'][_0xdedfb5[_0x5119('0x16')]][_0x5119('0x29')]=moment()[_0x5119('0x2a')](_0x5119('0x18'));this[_0x5119('0x7')][_0xdedfb5[_0x5119('0x16')]][_0x5119('0x2b')]=_0x5119('0x2c');ami[_0x5119('0x15')](_0x5119('0x2d'),this[_0x5119('0x7')][_0xdedfb5['uniqueid']]);}this[_0x5119('0x15')]('voice:outbound','voice_outbound_channel:save',this[_0x5119('0x7')][_0xdedfb5[_0x5119('0x16')]]);}}}catch(_0x24491a){logger[_0x5119('0x23')](_0x5119('0x2e'),util['inspect'](_0x24491a,{'showHidden':![],'depth':null}));}};VoiceDialReport[_0x5119('0x14')][_0x5119('0xf')]=function(_0x61fdf){try{if(this['isNotNull'](_0x61fdf)){this[_0x5119('0x2f')](_0x61fdf['uniqueid'],_[_0x5119('0x30')](_0x61fdf[_0x5119('0x31')])[0x0],_0x61fdf[_0x5119('0x32')]);if(this['isNotNull'](_0x61fdf['variable'])&&this[_0x5119('0x13')](_0x61fdf[_0x5119('0x31')][_0x5119('0x33')])){if(_[_0x5119('0x34')](this[_0x5119('0x7')][_0x61fdf[_0x5119('0x16')]])){this['channels'][_0x61fdf[_0x5119('0x16')]]={'routeId':_0x61fdf['value'],'variables':this[_0x5119('0x9')][_0x61fdf[_0x5119('0x16')]]};this['emit'](_0x5119('0x20'),'voice_outbound_channel:save',this['channels'][_0x61fdf['uniqueid']]);}}}}catch(_0x469986){logger['error']('[syncVarSet][VoiceDialReport]',util['inspect'](_0x469986,{'showHidden':![],'depth':null}));}};VoiceDialReport[_0x5119('0x14')][_0x5119('0x2f')]=function(_0x1788db,_0x3feb9b,_0x376ac3){var _0x17542f=[_0x5119('0x35'),_0x5119('0x36'),_0x5119('0x37'),_0x5119('0x38'),_0x5119('0x39'),_0x5119('0x3a'),'rtpaudioqosrtt','rtpaudioqosrttbridged',_0x5119('0x3b'),_0x5119('0x3c'),_0x5119('0x3d'),_0x5119('0x3e'),_0x5119('0x3f'),_0x5119('0x40'),_0x5119('0x41'),'memberlastcall','membername','memberpenalty',_0x5119('0x42')];if(!_[_0x5119('0x43')](_0x3feb9b)&&!_['includes'](_0x17542f,_0x3feb9b)){if(_[_0x5119('0x34')](this[_0x5119('0x9')][_0x1788db])){this[_0x5119('0x9')][_0x1788db]={};}this[_0x5119('0x9')][_0x1788db][_0x3feb9b]=_0x376ac3;}};VoiceDialReport[_0x5119('0x14')][_0x5119('0x12')]=function(_0x307062){try{if(this[_0x5119('0x13')](_0x307062)){if(this[_0x5119('0x7')][_0x307062['uniqueid']]){this[_0x5119('0x7')][_0x307062['uniqueid']]['endtime']=moment()['format'](_0x5119('0x18'));this[_0x5119('0x7')][_0x307062[_0x5119('0x16')]][_0x5119('0x44')]=moment(this[_0x5119('0x7')][_0x307062[_0x5119('0x16')]][_0x5119('0x45')])['diff'](this[_0x5119('0x7')][_0x307062[_0x5119('0x16')]]['starttime'],_0x5119('0x46'));this[_0x5119('0x7')][_0x307062[_0x5119('0x16')]][_0x5119('0x2b')]=_0x5119('0x47');this[_0x5119('0x8')][_0x5119('0x48')]+=0x1;if(this[_0x5119('0x7')][_0x307062[_0x5119('0x16')]][_0x5119('0x29')]){this[_0x5119('0x8')][_0x5119('0x49')]+=0x1;this['channels'][_0x307062['uniqueid']][_0x5119('0x4a')]=moment(this[_0x5119('0x7')][_0x307062['uniqueid']][_0x5119('0x29')])[_0x5119('0x4b')](this[_0x5119('0x7')][_0x307062[_0x5119('0x16')]]['starttime'],_0x5119('0x46'));this[_0x5119('0x7')][_0x307062[_0x5119('0x16')]][_0x5119('0x4c')]=moment(this[_0x5119('0x7')][_0x307062[_0x5119('0x16')]][_0x5119('0x45')])[_0x5119('0x4b')](this[_0x5119('0x7')][_0x307062[_0x5119('0x16')]][_0x5119('0x29')],_0x5119('0x46'));this['outbound'][_0x5119('0x4d')]+=this[_0x5119('0x7')][_0x307062[_0x5119('0x16')]]['holdtime']||0x0;this[_0x5119('0x8')]['sumBillable']+=this[_0x5119('0x7')][_0x307062[_0x5119('0x16')]]['billableseconds'];}this[_0x5119('0x8')][_0x5119('0x4e')]+=this[_0x5119('0x7')][_0x307062[_0x5119('0x16')]][_0x5119('0x44')];ami[_0x5119('0x15')](_0x5119('0x4f'),this[_0x5119('0x7')][_0x307062['uniqueid']]);ami['emit']('custom:dialend',this[_0x5119('0x7')][_0x307062[_0x5119('0x16')]]);this['emit'](_0x5119('0x20'),'voice_outbound:save',this[_0x5119('0x8')]);logger[_0x5119('0x50')](_0x5119('0x51'),JSON[_0x5119('0x52')](this['channels'][_0x307062[_0x5119('0x16')]]));this[_0x5119('0x15')](_0x5119('0x20'),_0x5119('0x53'),this[_0x5119('0x7')][_0x307062['uniqueid']]);delete this['channels'][_0x307062['uniqueid']];}if(this[_0x5119('0x9')][_0x307062[_0x5119('0x16')]]){delete this[_0x5119('0x9')][_0x307062[_0x5119('0x16')]];}}}catch(_0x31a0c2){logger[_0x5119('0x23')](_0x5119('0x54'),util[_0x5119('0x25')](_0x31a0c2,{'showHidden':![],'depth':null}));}};module['exports']=VoiceDialReport; \ No newline at end of file +var _0x7c53=['sumDuration','custom:voiceDialReport','voice_outbound:save','[DEBUG]\x20Emit\x20voice_outbound_channel:remove\x20event','stringify','voice_outbound_channel:remove','[syncHangup][VoiceDialReport]','lodash','../../../config/environment','../../../config/logger','ami','../ami','redis','defaults','socket.io-emitter','channels','outboundChannels','outbound','variables','bind','dialend','syncDialEnd','varset','hangup','syncHangup','prototype','isNotNull','isUndefined','emit','uniqueid','merge','YYYY-MM-DD\x20HH:mm:ss','called','channel','lastIndexOf','substring','omit','event','privilege','voice:outbound','voice_outbound_channel:save','custom:dialbegin','error','[syncDialBegin][VoiceDialReport]','ANSWER','connectedlinenum','connectedlinename','format','lastevent','connect','custom:dialconnect','[syncDialEnd][VoiceDialReport]','syncVarSet','addVariable','keys','variable','value','outboundrouteid','[syncVarSet][VoiceDialReport]','inspect','rtpaudioqos','rtpaudioqosbridged','rtpaudioqosjitter','rtpaudioqosjitterbridged','rtpaudioqosloss','rtpaudioqoslossbridged','rtpaudioqosrtt','rtpaudioqosrttbridged','sipcallid','sipuri','bridgepeer','membercalls','memberdynamic','memberinterface','memberlastcall','membername','memberpenalty','memberrealtime','isNil','includes','endtime','duration','diff','starttime','seconds','complete','answertime','answered','billableseconds','sumBillable'];(function(_0x5ddb1c,_0x5ea4df){var _0x354adc=function(_0x2dfb1f){while(--_0x2dfb1f){_0x5ddb1c['push'](_0x5ddb1c['shift']());}};_0x354adc(++_0x5ea4df);}(_0x7c53,0xbb));var _0x37c5=function(_0x45f878,_0x3e0914){_0x45f878=_0x45f878-0x0;var _0x55e92c=_0x7c53[_0x45f878];return _0x55e92c;};'use strict';var _=require(_0x37c5('0x0'));var moment=require('moment');var util=require('util');var Redis=require('ioredis');var config=require(_0x37c5('0x1'));var logger=require(_0x37c5('0x2'))(_0x37c5('0x3'));var ami=require(_0x37c5('0x4'));config[_0x37c5('0x5')]=_[_0x37c5('0x6')](config[_0x37c5('0x5')],{'host':'localhost','port':0x18eb});var io=require(_0x37c5('0x7'))(new Redis(config[_0x37c5('0x5')]));function VoiceDialReport(_0x27c7d1){this[_0x37c5('0x8')]=_0x27c7d1[_0x37c5('0x9')];this[_0x37c5('0xa')]=_0x27c7d1[_0x37c5('0xa')];this[_0x37c5('0xb')]={};ami['on']('dialbegin',this['syncDialBegin'][_0x37c5('0xc')](this));ami['on'](_0x37c5('0xd'),this[_0x37c5('0xe')][_0x37c5('0xc')](this));ami['on'](_0x37c5('0xf'),this['syncVarSet'][_0x37c5('0xc')](this));ami['on'](_0x37c5('0x10'),this[_0x37c5('0x11')][_0x37c5('0xc')](this));}VoiceDialReport[_0x37c5('0x12')][_0x37c5('0x13')]=function(_0x4b46f0){return _0x4b46f0!==null&&!_[_0x37c5('0x14')](_0x4b46f0);};VoiceDialReport['prototype'][_0x37c5('0x15')]=function(_0xe76191,_0x4a6beb,_0x498561){io['to'](_0xe76191)[_0x37c5('0x15')](_0x4a6beb,_0x498561);};VoiceDialReport['prototype']['syncDialBegin']=function(_0x1d5242){try{if(this[_0x37c5('0x13')](_0x1d5242)){if(this[_0x37c5('0x8')][_0x1d5242[_0x37c5('0x16')]]){_[_0x37c5('0x17')](this[_0x37c5('0x8')][_0x1d5242['uniqueid']],{'starttime':moment()['format'](_0x37c5('0x18')),'lastevent':_0x37c5('0x19'),'interface':_0x1d5242['channel']['substring'](0x0,_0x1d5242[_0x37c5('0x1a')][_0x37c5('0x1b')]('-')),'membername':_0x1d5242[_0x37c5('0x1a')][_0x37c5('0x1c')](_0x1d5242['channel'][_0x37c5('0x1b')]('/')+0x1,_0x1d5242['channel'][_0x37c5('0x1b')]('-'))},_[_0x37c5('0x1d')](_0x1d5242,[_0x37c5('0x1e'),_0x37c5('0x1f')]));this['emit'](_0x37c5('0x20'),_0x37c5('0x21'),this['channels'][_0x1d5242[_0x37c5('0x16')]]);ami['emit'](_0x37c5('0x22'),this[_0x37c5('0x8')][_0x1d5242['uniqueid']]);}}}catch(_0x32b3f5){logger[_0x37c5('0x23')](_0x37c5('0x24'),util['inspect'](_0x32b3f5,{'showHidden':![],'depth':null}));}};VoiceDialReport[_0x37c5('0x12')][_0x37c5('0xe')]=function(_0x3434f1){try{if(this[_0x37c5('0x13')](_0x3434f1)){if(this['channels'][_0x3434f1['uniqueid']]){this[_0x37c5('0x8')][_0x3434f1[_0x37c5('0x16')]]['dialstatus']=_0x3434f1['dialstatus'];if(_0x3434f1['dialstatus']===_0x37c5('0x25')){this['channels'][_0x3434f1[_0x37c5('0x16')]]['connectedlinenum']=_0x3434f1[_0x37c5('0x26')];this[_0x37c5('0x8')][_0x3434f1['uniqueid']][_0x37c5('0x27')]=_0x3434f1[_0x37c5('0x27')];this[_0x37c5('0x8')][_0x3434f1[_0x37c5('0x16')]]['answertime']=moment()[_0x37c5('0x28')](_0x37c5('0x18'));this['channels'][_0x3434f1['uniqueid']][_0x37c5('0x29')]=_0x37c5('0x2a');ami[_0x37c5('0x15')](_0x37c5('0x2b'),this[_0x37c5('0x8')][_0x3434f1[_0x37c5('0x16')]]);}this['emit'](_0x37c5('0x20'),_0x37c5('0x21'),this[_0x37c5('0x8')][_0x3434f1['uniqueid']]);}}}catch(_0xce54fc){logger[_0x37c5('0x23')](_0x37c5('0x2c'),util['inspect'](_0xce54fc,{'showHidden':![],'depth':null}));}};VoiceDialReport[_0x37c5('0x12')][_0x37c5('0x2d')]=function(_0x2b5290){try{if(this['isNotNull'](_0x2b5290)){this[_0x37c5('0x2e')](_0x2b5290[_0x37c5('0x16')],_[_0x37c5('0x2f')](_0x2b5290[_0x37c5('0x30')])[0x0],_0x2b5290[_0x37c5('0x31')]);if(this[_0x37c5('0x13')](_0x2b5290[_0x37c5('0x30')])&&this[_0x37c5('0x13')](_0x2b5290[_0x37c5('0x30')][_0x37c5('0x32')])){if(_[_0x37c5('0x14')](this[_0x37c5('0x8')][_0x2b5290['uniqueid']])){this['channels'][_0x2b5290['uniqueid']]={'routeId':_0x2b5290[_0x37c5('0x31')],'variables':this['variables'][_0x2b5290[_0x37c5('0x16')]]};this[_0x37c5('0x15')](_0x37c5('0x20'),_0x37c5('0x21'),this['channels'][_0x2b5290[_0x37c5('0x16')]]);}}}}catch(_0xae09b0){logger[_0x37c5('0x23')](_0x37c5('0x33'),util[_0x37c5('0x34')](_0xae09b0,{'showHidden':![],'depth':null}));}};VoiceDialReport['prototype']['addVariable']=function(_0x58d637,_0x27dad4,_0x34e813){var _0x3b810c=[_0x37c5('0x35'),_0x37c5('0x36'),_0x37c5('0x37'),_0x37c5('0x38'),_0x37c5('0x39'),_0x37c5('0x3a'),_0x37c5('0x3b'),_0x37c5('0x3c'),_0x37c5('0x3d'),_0x37c5('0x3e'),_0x37c5('0x3f'),'bridgepvtcallid',_0x37c5('0x40'),_0x37c5('0x41'),_0x37c5('0x42'),_0x37c5('0x43'),_0x37c5('0x44'),_0x37c5('0x45'),_0x37c5('0x46')];if(!_[_0x37c5('0x47')](_0x27dad4)&&!_[_0x37c5('0x48')](_0x3b810c,_0x27dad4)){if(_[_0x37c5('0x14')](this[_0x37c5('0xb')][_0x58d637])){this[_0x37c5('0xb')][_0x58d637]={};}this[_0x37c5('0xb')][_0x58d637][_0x27dad4]=_0x34e813;}};VoiceDialReport[_0x37c5('0x12')][_0x37c5('0x11')]=function(_0x556435){try{if(this[_0x37c5('0x13')](_0x556435)){if(this[_0x37c5('0x8')][_0x556435[_0x37c5('0x16')]]){this[_0x37c5('0x8')][_0x556435[_0x37c5('0x16')]][_0x37c5('0x49')]=moment()[_0x37c5('0x28')](_0x37c5('0x18'));this[_0x37c5('0x8')][_0x556435[_0x37c5('0x16')]][_0x37c5('0x4a')]=moment(this['channels'][_0x556435['uniqueid']]['endtime'])[_0x37c5('0x4b')](this[_0x37c5('0x8')][_0x556435['uniqueid']][_0x37c5('0x4c')],_0x37c5('0x4d'));this[_0x37c5('0x8')][_0x556435['uniqueid']][_0x37c5('0x29')]=_0x37c5('0x4e');this[_0x37c5('0xa')]['total']+=0x1;if(this[_0x37c5('0x8')][_0x556435[_0x37c5('0x16')]][_0x37c5('0x4f')]){this[_0x37c5('0xa')][_0x37c5('0x50')]+=0x1;this[_0x37c5('0x8')][_0x556435[_0x37c5('0x16')]]['holdtime']=moment(this[_0x37c5('0x8')][_0x556435[_0x37c5('0x16')]][_0x37c5('0x4f')])['diff'](this['channels'][_0x556435[_0x37c5('0x16')]][_0x37c5('0x4c')],_0x37c5('0x4d'));this[_0x37c5('0x8')][_0x556435[_0x37c5('0x16')]][_0x37c5('0x51')]=moment(this['channels'][_0x556435[_0x37c5('0x16')]]['endtime'])[_0x37c5('0x4b')](this[_0x37c5('0x8')][_0x556435['uniqueid']]['answertime'],_0x37c5('0x4d'));this[_0x37c5('0xa')]['sumHoldTime']+=this[_0x37c5('0x8')][_0x556435[_0x37c5('0x16')]]['holdtime']||0x0;this[_0x37c5('0xa')][_0x37c5('0x52')]+=this['channels'][_0x556435[_0x37c5('0x16')]][_0x37c5('0x51')];}this[_0x37c5('0xa')][_0x37c5('0x53')]+=this[_0x37c5('0x8')][_0x556435[_0x37c5('0x16')]][_0x37c5('0x4a')];ami[_0x37c5('0x15')](_0x37c5('0x54'),this[_0x37c5('0x8')][_0x556435[_0x37c5('0x16')]]);ami[_0x37c5('0x15')]('custom:dialend',this[_0x37c5('0x8')][_0x556435['uniqueid']]);this[_0x37c5('0x15')](_0x37c5('0x20'),_0x37c5('0x55'),this['outbound']);logger['info'](_0x37c5('0x56'),JSON[_0x37c5('0x57')](this['channels'][_0x556435['uniqueid']]));this[_0x37c5('0x15')](_0x37c5('0x20'),_0x37c5('0x58'),this[_0x37c5('0x8')][_0x556435[_0x37c5('0x16')]]);delete this[_0x37c5('0x8')][_0x556435[_0x37c5('0x16')]];}if(this[_0x37c5('0xb')][_0x556435[_0x37c5('0x16')]]){delete this[_0x37c5('0xb')][_0x556435[_0x37c5('0x16')]];}}}catch(_0xbc2cc6){logger[_0x37c5('0x23')](_0x37c5('0x59'),util[_0x37c5('0x34')](_0xbc2cc6,{'showHidden':![],'depth':null}));}};module['exports']=VoiceDialReport; \ No newline at end of file diff --git a/server/services/ami/report/voiceQueueReport.js b/server/services/ami/report/voiceQueueReport.js index 69376dc..3cf90c7 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 _0xcd54=['unmanaged','diff','seconds','milliseconds','lastevent','custom:queuecallerunmanaged','custom:queuecallerabandon','custom:voiceQueueReport','[syncHangup][VoiceQueueReport]','transfereeuniqueid','secondtransfereruniqueid','ATTENDEDTRANSFER','ATTENDED','transfertargetuniqueid','origtransfereruniqueid','[syncAttendedTransfer][VoiceQueueReport]','BLIND','BlindTransfer','context','transfererchannel','[syncBlindTransfer][VoiceQueueReport]','syncMusicOnHoldStart','mohstarttime','[syncMusicOnHoldStart][VoiceQueueReport]','[syncMusicOnHoldStop][VoiceQueueReport]','lodash','moment','ioredis','../../../config/environment','../../../config/logger','ami','../ami','redis','defaults','localhost','socket.io-emitter','prototype','enqueue','tail','agents','queueChannels','voiceQueues','flagQueueSummary','campaigns','variables','syncQueueSummary','queuesummarycomplete','syncQueueSummaryComplete','bind','queuecallerjoin','syncQueueCallerJoin','queuecallerabandon','syncQueueCallerAbandon','queuecallerleave','syncQueueCallerLeave','agentcomplete','syncAgentComplete','agentconnect','syncAgentConnect','hangup','syncHangup','fullybooted','syncFullyBooted','musiconholdstart','attendedtransfer','syncAttendedTransfer','blindtransfer','syncBlindTransfer','loopQueueSummary','loopQueueShow','isUndefined','isEmpty','hasOwnProperty','talking','pTalking','unlockRR','clearZombieChannels','channels','switch','sequence','isNil','status','channel','catch','message','error','[voiceQueueReport][checkChannel]','queueReports','[voiceQueueReport][checkQueueReport]','[voiceQueueReport][checkVariables]','[FullyBooted]\x20clear\x20realtime','clearQueueReport','emitVoiceQueueChannelRemove','emit','emitVoiceQueueChannelSave','format','voice:queue:%s','name','voice_queue_channel:save','info','[DEBUG]\x20Emit\x20voice_queue_channel:remove\x20event','voice_queue_channel:remove','emitVoiceQueueSummary','inbound','strategy','answered','available','loggedIn','sumBillable','sumDuration','sumHoldTime','total','type','abandoned','waiting','Trunk','active','Interval','stringify','md5','voice_queue:save','isNotNull','Action','queues','[queues]','then','[queuesummary]','queue','countBy','callers','toNumber','loggedin','custom:queuesummary','syncNewExten','uniqueid','queuecallerjoinAt','YYYY-MM-DD\x20HH:mm:ss','position','count','merge','push','inspect','queuecallercompleteAt','holdtime','originalposition','queuecallerabandonAt','ABANDONED','[syncQueueCallerAbandon][VoiceQueueReport]','queuecallerleaveAt','connectedlinename','last','queuecallercomplete','queuecallerexitreason','COMPLETEDBYAGENT','[syncAgentConnect][VoiceQueueReport]','assigned','queuecallerexit','queuecallerexitAt','transfer','reason','COMPLETED','startsWith','toLowerCase','local/','linkedid','add','FORWARDTRANSFER','transfertype','FORWARD','transferexten','destexten','transferuniqueid','COMPLETEDBY','[syncAgentComplete][VoiceQueueReport]','syncVarSet','addVariable','keys','variable','queuestatus','CONTINUE','value','queueposition','[syncVarSet][VoiceQueueReport]','rtpaudioqos','rtpaudioqosbridged','rtpaudioqosjitterbridged','rtpaudioqosloss','rtpaudioqoslossbridged','rtpaudioqosrttbridged','sipcallid','bridgepeer','bridgepvtcallid','membercalls','memberinterface','membername','memberrealtime'];(function(_0xd1516,_0xe15fd5){var _0x532376=function(_0xc644e2){while(--_0xc644e2){_0xd1516['push'](_0xd1516['shift']());}};_0x532376(++_0xe15fd5);}(_0xcd54,0xdd));var _0x4cd5=function(_0x34d255,_0x4327c6){_0x34d255=_0x34d255-0x0;var _0x176b2d=_0xcd54[_0x34d255];return _0x176b2d;};'use strict';var _=require(_0x4cd5('0x0'));var moment=require(_0x4cd5('0x1'));var BPromise=require('bluebird');var util=require('util');var md5=require('md5');var Redis=require(_0x4cd5('0x2'));var config=require(_0x4cd5('0x3'));var logger=require(_0x4cd5('0x4'))(_0x4cd5('0x5'));var ami=require(_0x4cd5('0x6'));var QueueReport=require('../model/queueReport');config[_0x4cd5('0x7')]=_[_0x4cd5('0x8')](config[_0x4cd5('0x7')],{'host':_0x4cd5('0x9'),'port':0x18eb});var io=require(_0x4cd5('0xa'))(new Redis(config[_0x4cd5('0x7')]));var Sequence=function(){};Sequence[_0x4cd5('0xb')][_0x4cd5('0xc')]=function(_0x4a2712){this['tail']=this[_0x4cd5('0xd')]?this[_0x4cd5('0xd')]['finally'](_0x4a2712):_0x4a2712();};function VoiceQueueReport(_0x4b94b6){this['sequence']=new Sequence();this['queueReports']={};this['agents']=_0x4b94b6[_0x4cd5('0xe')];this['channels']=_0x4b94b6[_0x4cd5('0xf')];this[_0x4cd5('0x10')]=_0x4b94b6[_0x4cd5('0x10')];this[_0x4cd5('0x11')]=!![];this['campaigns']=_0x4b94b6[_0x4cd5('0x12')];this[_0x4cd5('0x13')]={};ami['on']('queuesummary',this[_0x4cd5('0x14')]['bind'](this));ami['on'](_0x4cd5('0x15'),this[_0x4cd5('0x16')][_0x4cd5('0x17')](this));ami['on'](_0x4cd5('0x18'),this[_0x4cd5('0x19')][_0x4cd5('0x17')](this));ami['on'](_0x4cd5('0x1a'),this[_0x4cd5('0x1b')][_0x4cd5('0x17')](this));ami['on'](_0x4cd5('0x1c'),this[_0x4cd5('0x1d')][_0x4cd5('0x17')](this));ami['on'](_0x4cd5('0x1e'),this[_0x4cd5('0x1f')]['bind'](this));ami['on'](_0x4cd5('0x20'),this[_0x4cd5('0x21')][_0x4cd5('0x17')](this));ami['on']('varset',this['syncVarSet'][_0x4cd5('0x17')](this));ami['on'](_0x4cd5('0x22'),this[_0x4cd5('0x23')][_0x4cd5('0x17')](this));ami['on'](_0x4cd5('0x24'),this[_0x4cd5('0x25')][_0x4cd5('0x17')](this));ami['on'](_0x4cd5('0x26'),this['syncMusicOnHoldStart'][_0x4cd5('0x17')](this));ami['on']('musiconholdstop',this['syncMusicOnHoldStop'][_0x4cd5('0x17')](this));ami['on'](_0x4cd5('0x27'),this[_0x4cd5('0x28')][_0x4cd5('0x17')](this));ami['on'](_0x4cd5('0x29'),this[_0x4cd5('0x2a')]['bind'](this));this[_0x4cd5('0x2b')]();this[_0x4cd5('0x2c')]();}function isNotNull(_0x50d467){return _0x50d467!==null&&!_[_0x4cd5('0x2d')](_0x50d467);}function clearChannels(_0x4d9940){if(!_[_0x4cd5('0x2e')](_0x4d9940)){for(var _0x157292 in _0x4d9940){if(_0x4d9940[_0x4cd5('0x2f')](_0x157292)){delete _0x4d9940[_0x157292];}}}}function clearCampaigns(_0x2dd791){if(!_[_0x4cd5('0x2e')](_0x2dd791)){for(var _0x775193 in _0x2dd791){if(_0x2dd791[_0x4cd5('0x2f')](_0x775193)){_0x2dd791[_0x775193]['originated']=0x0;}}}}function clearVoiceQueues(_0x47126b){if(!_['isEmpty'](_0x47126b)){for(var _0x19c09a in _0x47126b){if(_0x47126b[_0x4cd5('0x2f')](_0x19c09a)){_0x47126b[_0x19c09a]['originated']=0x0;_0x47126b[_0x19c09a][_0x4cd5('0x30')]=0x0;_0x47126b[_0x19c09a][_0x4cd5('0x31')]=0x0;_0x47126b[_0x19c09a]['waiting']=0x0;_0x47126b[_0x19c09a]['queueStatusComplete']=!![];}}}}function clearAgentBooked(_0x5f10a3){if(!_[_0x4cd5('0x2e')](_0x5f10a3)){for(var _0x37b6e7 in _0x5f10a3){if(_0x5f10a3[_0x4cd5('0x2f')](_0x37b6e7)){_0x5f10a3[_0x37b6e7][_0x4cd5('0x32')]=!![];}}}}VoiceQueueReport['prototype'][_0x4cd5('0x33')]=function(){var _0x20ad63=this;for(var _0x3147d3 in this[_0x4cd5('0x34')]){if(this[_0x4cd5('0x34')][_0x4cd5('0x2f')](_0x3147d3)&&!this['channels'][_0x3147d3][_0x4cd5('0x35')]){this[_0x4cd5('0x36')][_0x4cd5('0xc')](function(){if(!_[_0x4cd5('0x37')](_0x20ad63[_0x4cd5('0x34')][_0x3147d3])){return ami['Action']({'action':_0x4cd5('0x38'),'channel':_0x20ad63[_0x4cd5('0x34')][_0x3147d3][_0x4cd5('0x39')]})[_0x4cd5('0x3a')](function(_0xf6e080){if(_0xf6e080[_0x4cd5('0x3b')]==='No\x20such\x20channel'){setTimeout(function(){if(_0x20ad63[_0x4cd5('0x34')][_0x3147d3]){delete _0x20ad63[_0x4cd5('0x34')][_0x3147d3];logger[_0x4cd5('0x3c')](_0x4cd5('0x3d'),_0x3147d3);}if(_0x20ad63[_0x4cd5('0x3e')][_0x3147d3]){delete _0x20ad63[_0x4cd5('0x3e')][_0x3147d3];logger[_0x4cd5('0x3c')](_0x4cd5('0x3f'),_0x3147d3);}if(_0x20ad63[_0x4cd5('0x13')][_0x3147d3]){delete _0x20ad63[_0x4cd5('0x13')][_0x3147d3];logger[_0x4cd5('0x3c')](_0x4cd5('0x40'),_0x3147d3);}},0x1f40);}});}});}}};VoiceQueueReport[_0x4cd5('0xb')][_0x4cd5('0x25')]=function(){logger[_0x4cd5('0x3c')](_0x4cd5('0x41'));clearChannels(this['channels']);this[_0x4cd5('0x42')](this[_0x4cd5('0x3e')]);clearAgentBooked(this[_0x4cd5('0xe')]);clearVoiceQueues(this[_0x4cd5('0x10')]);clearCampaigns(this[_0x4cd5('0x12')]);};VoiceQueueReport[_0x4cd5('0xb')][_0x4cd5('0x42')]=function(_0x465b8f){var _0x1742eb=this;if(!_[_0x4cd5('0x2e')](_0x465b8f)){for(var _0x1fd730 in _0x465b8f){if(_0x465b8f['hasOwnProperty'](_0x1fd730)){_0x1742eb[_0x4cd5('0x43')](_0x465b8f[_0x1fd730]);delete _0x465b8f[_0x1fd730];}}}};function loggerCatch(_0x3fb0ab){return function(_0x3c7001){logger[_0x4cd5('0x3c')](_0x3fb0ab,util['inspect'](_0x3c7001,{'showHidden':![],'depth':null}));};}VoiceQueueReport['prototype'][_0x4cd5('0x44')]=function(_0xb64d18,_0x2bb87e,_0x59209d){io['to'](_0xb64d18)['emit'](_0x2bb87e,_0x59209d);};VoiceQueueReport['prototype'][_0x4cd5('0x45')]=function(_0x2e7ed3){this[_0x4cd5('0x44')](util[_0x4cd5('0x46')](_0x4cd5('0x47'),_0x2e7ed3[_0x4cd5('0x48')]),_0x4cd5('0x49'),_0x2e7ed3);};VoiceQueueReport[_0x4cd5('0xb')][_0x4cd5('0x43')]=function(_0x2f7d22){logger[_0x4cd5('0x4a')](_0x4cd5('0x4b'),JSON['stringify'](_0x2f7d22));this[_0x4cd5('0x44')](util[_0x4cd5('0x46')](_0x4cd5('0x47'),_0x2f7d22[_0x4cd5('0x48')]),_0x4cd5('0x4c'),_0x2f7d22);};VoiceQueueReport['prototype'][_0x4cd5('0x4d')]=function(_0x41f5d7){if(_0x41f5d7['type']===_0x4cd5('0x4e')){var _0xd6e6c9={'id':_0x41f5d7['id'],'name':_0x41f5d7[_0x4cd5('0x48')],'strategy':_0x41f5d7[_0x4cd5('0x4f')],'answered':_0x41f5d7[_0x4cd5('0x50')],'available':_0x41f5d7[_0x4cd5('0x51')],'loggedIn':_0x41f5d7[_0x4cd5('0x52')],'pTalking':_0x41f5d7['pTalking'],'sumBillable':_0x41f5d7[_0x4cd5('0x53')],'sumDuration':_0x41f5d7[_0x4cd5('0x54')],'sumHoldTime':_0x41f5d7[_0x4cd5('0x55')]||0x0,'talking':_0x41f5d7[_0x4cd5('0x30')],'total':_0x41f5d7[_0x4cd5('0x56')],'type':_0x41f5d7[_0x4cd5('0x57')],'unmanaged':_0x41f5d7['unmanaged'],'abandoned':_0x41f5d7[_0x4cd5('0x58')],'waiting':_0x41f5d7[_0x4cd5('0x59')]};if(_0x41f5d7['Trunk']){_0xd6e6c9[_0x4cd5('0x5a')]={'id':_0x41f5d7[_0x4cd5('0x5a')]['id'],'name':_0x41f5d7[_0x4cd5('0x5a')][_0x4cd5('0x48')],'active':_0x41f5d7['Trunk'][_0x4cd5('0x5b')],'callerid':_0x41f5d7[_0x4cd5('0x5a')]['callerid']};}if(_0x41f5d7[_0x4cd5('0x5c')]){_0xd6e6c9[_0x4cd5('0x5c')]={'id':_0x41f5d7[_0x4cd5('0x5c')]['id'],'name':_0x41f5d7[_0x4cd5('0x5c')]['name']};}var _0x185b33=md5(JSON[_0x4cd5('0x5d')](_0xd6e6c9));if(_0x41f5d7[_0x4cd5('0x5e')]!==_0x185b33){_0x41f5d7[_0x4cd5('0x5e')]=_0x185b33;this[_0x4cd5('0x44')](util['format'](_0x4cd5('0x47'),_0xd6e6c9['name']),_0x4cd5('0x5f'),_0xd6e6c9);}}};VoiceQueueReport[_0x4cd5('0xb')][_0x4cd5('0x60')]=function(_0x5712dc){return _0x5712dc!==null&&!_['isUndefined'](_0x5712dc);};VoiceQueueReport[_0x4cd5('0xb')][_0x4cd5('0x2c')]=function(){var _0x2c2139=this;setInterval(function(){_0x2c2139[_0x4cd5('0x33')]();ami[_0x4cd5('0x61')]({'action':_0x4cd5('0x62')})['catch'](loggerCatch(_0x4cd5('0x63')));},0x2710);};VoiceQueueReport[_0x4cd5('0xb')][_0x4cd5('0x2b')]=function(){var _0x3eccc3=this;setInterval(function(){if(_0x3eccc3[_0x4cd5('0x11')]){return ami[_0x4cd5('0x61')]({'action':'queuesummary'})[_0x4cd5('0x64')](function(_0x3b9cb4){_0x3eccc3['flagQueueSummary']=![];})[_0x4cd5('0x3a')](loggerCatch(_0x4cd5('0x65')));}},0x3e8);};VoiceQueueReport['prototype'][_0x4cd5('0x14')]=function(_0x4d6998){try{if(this[_0x4cd5('0x60')](_0x4d6998)&&this[_0x4cd5('0x60')](_0x4d6998[_0x4cd5('0x66')])){if(this[_0x4cd5('0x10')][_0x4d6998[_0x4cd5('0x66')]]){var _0x43fca1=_[_0x4cd5('0x67')](this[_0x4cd5('0x34')],_0x4cd5('0x66'))[_0x4d6998[_0x4cd5('0x66')]]||0x0;var _0x592f6e=_0x43fca1-_0x4d6998[_0x4cd5('0x68')];if(this[_0x4cd5('0x10')][_0x4d6998[_0x4cd5('0x66')]][_0x4cd5('0x59')]!==_[_0x4cd5('0x69')](_0x4d6998[_0x4cd5('0x68')])||this[_0x4cd5('0x10')][_0x4d6998['queue']]['loggedIn']!==_[_0x4cd5('0x69')](_0x4d6998[_0x4cd5('0x6a')])||this[_0x4cd5('0x10')][_0x4d6998[_0x4cd5('0x66')]][_0x4cd5('0x51')]!==_['toNumber'](_0x4d6998['available'])||this[_0x4cd5('0x10')][_0x4d6998[_0x4cd5('0x66')]][_0x4cd5('0x30')]!==_0x592f6e){this[_0x4cd5('0x10')][_0x4d6998['queue']]['waiting']=_[_0x4cd5('0x69')](_0x4d6998['callers']);this[_0x4cd5('0x10')][_0x4d6998[_0x4cd5('0x66')]][_0x4cd5('0x52')]=_[_0x4cd5('0x69')](_0x4d6998['loggedin']);this['voiceQueues'][_0x4d6998[_0x4cd5('0x66')]][_0x4cd5('0x51')]=_[_0x4cd5('0x69')](_0x4d6998[_0x4cd5('0x51')]);this[_0x4cd5('0x10')][_0x4d6998[_0x4cd5('0x66')]][_0x4cd5('0x30')]=_0x592f6e>0x0?_0x592f6e:0x0;this[_0x4cd5('0x10')][_0x4d6998[_0x4cd5('0x66')]][_0x4cd5('0x30')]=this[_0x4cd5('0x10')][_0x4d6998[_0x4cd5('0x66')]][_0x4cd5('0x30')]>_[_0x4cd5('0x69')](_0x4d6998[_0x4cd5('0x6a')])?_[_0x4cd5('0x69')](_0x4d6998[_0x4cd5('0x6a')]):this[_0x4cd5('0x10')][_0x4d6998[_0x4cd5('0x66')]]['talking'];this[_0x4cd5('0x4d')](this[_0x4cd5('0x10')][_0x4d6998[_0x4cd5('0x66')]]);}ami['emit'](_0x4cd5('0x6b'),this['voiceQueues'][_0x4d6998[_0x4cd5('0x66')]]);}}}catch(_0x10b904){logger['error']('[syncQueueSummary][VoiceQueueReport]',util['inspect'](_0x10b904,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x4cd5('0xb')]['syncQueueSummaryComplete']=function(_0x7fa46d){this[_0x4cd5('0x11')]=!![];};VoiceQueueReport['prototype'][_0x4cd5('0x6c')]=function(_0x26f50a){};VoiceQueueReport[_0x4cd5('0xb')]['syncQueueCallerJoin']=function(_0x3aacf1){try{if(this[_0x4cd5('0x60')](_0x3aacf1)){if(_['isUndefined'](this[_0x4cd5('0x3e')][_0x3aacf1[_0x4cd5('0x6d')]])){this[_0x4cd5('0x3e')][_0x3aacf1[_0x4cd5('0x6d')]]=[];this['channels'][_0x3aacf1[_0x4cd5('0x6d')]]={};}var _0x36bc43=new QueueReport();_0x36bc43[_0x4cd5('0x48')]=_0x3aacf1[_0x4cd5('0x66')];_0x36bc43[_0x4cd5('0x57')]=this[_0x4cd5('0x10')][_0x36bc43['name']]&&this[_0x4cd5('0x10')][_0x36bc43[_0x4cd5('0x48')]][_0x4cd5('0x57')]?this[_0x4cd5('0x10')][_0x36bc43['name']][_0x4cd5('0x57')]||'inbound':_0x4cd5('0x4e');_0x36bc43[_0x4cd5('0x66')]=_0x3aacf1['queue'];_0x36bc43[_0x4cd5('0x6e')]=moment()['format'](_0x4cd5('0x6f'));_0x36bc43['position']=_0x3aacf1[_0x4cd5('0x70')];_0x36bc43[_0x4cd5('0x71')]=_0x3aacf1[_0x4cd5('0x71')];_[_0x4cd5('0x72')](_0x36bc43,_['pick'](_0x3aacf1,_['keys'](_0x36bc43)));this[_0x4cd5('0x3e')][_0x3aacf1['uniqueid']][_0x4cd5('0x73')](_0x36bc43);this[_0x4cd5('0x34')][_0x3aacf1[_0x4cd5('0x6d')]]=_0x36bc43;this['emitVoiceQueueChannelSave'](_0x36bc43);}}catch(_0x52841d){logger[_0x4cd5('0x3c')]('[syncQueueCallerJoin][VoiceQueueReport]',util[_0x4cd5('0x74')](_0x52841d,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x4cd5('0xb')][_0x4cd5('0x1b')]=function(_0x5ca325){try{if(this['isNotNull'](_0x5ca325)){if(this[_0x4cd5('0x3e')][_0x5ca325['uniqueid']]){var _0x55115b=_['last'](this[_0x4cd5('0x3e')][_0x5ca325['uniqueid']]);_0x55115b['queuecallercomplete']=![];_0x55115b[_0x4cd5('0x75')]=null;_0x55115b[_0x4cd5('0x76')]=_0x5ca325[_0x4cd5('0x76')];_0x55115b[_0x4cd5('0x77')]=_0x5ca325['originalposition'];_0x55115b[_0x4cd5('0x1a')]=!![];_0x55115b[_0x4cd5('0x78')]=moment()[_0x4cd5('0x46')](_0x4cd5('0x6f'));_0x55115b['queuecallerexitreason']=_0x4cd5('0x79');_0x55115b['lastAssignedTo']=null;this[_0x4cd5('0x34')][_0x5ca325[_0x4cd5('0x6d')]]=_0x55115b;this[_0x4cd5('0x43')](_0x55115b);}}}catch(_0x2ac19a){logger[_0x4cd5('0x3c')](_0x4cd5('0x7a'),util['inspect'](_0x2ac19a,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x4cd5('0xb')]['syncQueueCallerLeave']=function(_0x2846c4){try{if(this[_0x4cd5('0x60')](_0x2846c4)){if(this['queueReports'][_0x2846c4[_0x4cd5('0x6d')]]){var _0x4450ad=_['last'](this[_0x4cd5('0x3e')][_0x2846c4[_0x4cd5('0x6d')]]);_0x4450ad[_0x4cd5('0x7b')]=moment()[_0x4cd5('0x46')](_0x4cd5('0x6f'));_0x4450ad['connectedlinenum']=_0x2846c4['connectedlinenum'];_0x4450ad[_0x4cd5('0x7c')]=_0x2846c4[_0x4cd5('0x7c')];this[_0x4cd5('0x34')][_0x2846c4['uniqueid']]=_0x4450ad;this[_0x4cd5('0x45')](_0x4450ad);}}}catch(_0x526026){logger[_0x4cd5('0x3c')]('[syncQueueCallerLeave][VoiceQueueReport]',util['inspect'](_0x526026,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x4cd5('0xb')]['syncAgentConnect']=function(_0x456775){try{if(this[_0x4cd5('0x60')](_0x456775)){if(this[_0x4cd5('0x3e')][_0x456775[_0x4cd5('0x6d')]]){var _0x99051c=_[_0x4cd5('0x7d')](this[_0x4cd5('0x3e')][_0x456775[_0x4cd5('0x6d')]]);_0x99051c[_0x4cd5('0x7e')]=!![];_0x99051c[_0x4cd5('0x7f')]=_0x4cd5('0x80');}}}catch(_0x56cf95){logger['error'](_0x4cd5('0x81'),util[_0x4cd5('0x74')](_0x56cf95,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x4cd5('0xb')]['syncAgentComplete']=function(_0x50d8b0){try{if(this[_0x4cd5('0x60')](_0x50d8b0)){if(this[_0x4cd5('0x3e')][_0x50d8b0[_0x4cd5('0x6d')]]){var _0x7f36d2=_[_0x4cd5('0x7d')](this[_0x4cd5('0x3e')][_0x50d8b0[_0x4cd5('0x6d')]]);_0x7f36d2[_0x4cd5('0x1a')]=![];_0x7f36d2[_0x4cd5('0x78')]=null;_0x7f36d2[_0x4cd5('0x82')]=!![];_0x7f36d2['lastAssignedTo']=_0x50d8b0['membername'];_0x7f36d2[_0x4cd5('0x76')]=_0x50d8b0[_0x4cd5('0x76')];_0x7f36d2[_0x4cd5('0x7e')]=!![];_0x7f36d2[_0x4cd5('0x83')]=![];_0x7f36d2[_0x4cd5('0x84')]=null;if(!_0x7f36d2[_0x4cd5('0x85')]){if(_0x50d8b0[_0x4cd5('0x86')]==_0x4cd5('0x85')){_0x7f36d2[_0x4cd5('0x7f')]=_0x4cd5('0x87');}else{if(_[_0x4cd5('0x88')](_0x50d8b0[_0x4cd5('0x39')][_0x4cd5('0x89')](),_0x4cd5('0x8a'))){if(this['queueReports'][_0x50d8b0[_0x4cd5('0x8b')]]){var _0x24938c=_['last'](this[_0x4cd5('0x3e')][_0x50d8b0[_0x4cd5('0x8b')]]);_0x24938c['queuecallercomplete']=![];_0x24938c[_0x4cd5('0x83')]=!![];_0x24938c[_0x4cd5('0x84')]=moment(_0x7f36d2[_0x4cd5('0x6e')])[_0x4cd5('0x8c')](_0x50d8b0[_0x4cd5('0x76')],'seconds')[_0x4cd5('0x46')](_0x4cd5('0x6f'));_0x24938c[_0x4cd5('0x7f')]=_0x4cd5('0x8d');_0x24938c[_0x4cd5('0x85')]=!![];_0x24938c[_0x4cd5('0x8e')]=_0x4cd5('0x8f');_0x24938c[_0x4cd5('0x90')]=_0x50d8b0[_0x4cd5('0x91')];_0x24938c[_0x4cd5('0x92')]=_0x50d8b0[_0x4cd5('0x6d')];var _0x15a65e=this[_0x4cd5('0x3e')][_0x50d8b0['linkedid']];this[_0x4cd5('0x3e')][_0x50d8b0[_0x4cd5('0x8b')]]=this['queueReports'][_0x50d8b0[_0x4cd5('0x6d')]];this[_0x4cd5('0x3e')][_0x50d8b0['uniqueid']]=_0x15a65e;}}else{_0x7f36d2[_0x4cd5('0x7f')]=_0x4cd5('0x93')+_0x50d8b0[_0x4cd5('0x86')]['toUpperCase']();}}}this[_0x4cd5('0x34')][_0x50d8b0[_0x4cd5('0x6d')]]=_0x7f36d2;this[_0x4cd5('0x43')](_0x7f36d2);}}}catch(_0x5dfba9){logger[_0x4cd5('0x3c')](_0x4cd5('0x94'),util[_0x4cd5('0x74')](_0x5dfba9,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x4cd5('0xb')][_0x4cd5('0x95')]=function(_0xe9a238){try{if(this[_0x4cd5('0x60')](_0xe9a238)){this[_0x4cd5('0x96')](_0xe9a238[_0x4cd5('0x6d')],_[_0x4cd5('0x97')](_0xe9a238[_0x4cd5('0x98')])[0x0],_0xe9a238['value']);if(this[_0x4cd5('0x3e')][_0xe9a238[_0x4cd5('0x6d')]]){var _0x55b229=_[_0x4cd5('0x7d')](this[_0x4cd5('0x3e')][_0xe9a238['uniqueid']]);if(_0x55b229){if(this[_0x4cd5('0x60')](_0xe9a238[_0x4cd5('0x98')])&&this['isNotNull'](_0xe9a238[_0x4cd5('0x98')][_0x4cd5('0x99')])){switch(_0xe9a238['value']){case _0x4cd5('0x9a'):_0x55b229['queuecallerexit']=![];_0x55b229[_0x4cd5('0x84')]=null;break;default:_0x55b229[_0x4cd5('0x83')]=!![];_0x55b229[_0x4cd5('0x84')]=moment()[_0x4cd5('0x46')](_0x4cd5('0x6f'));_0x55b229[_0x4cd5('0x7b')]=moment()[_0x4cd5('0x46')]('YYYY-MM-DD\x20HH:mm:ss');}_0x55b229['queuecallerabandon']=![];_0x55b229[_0x4cd5('0x78')]=null;_0x55b229[_0x4cd5('0x7f')]=_0xe9a238[_0x4cd5('0x9b')];this[_0x4cd5('0x34')][_0xe9a238[_0x4cd5('0x6d')]]=_0x55b229;this[_0x4cd5('0x43')](_0x55b229);}else if(this['isNotNull'](_0xe9a238[_0x4cd5('0x98')])&&this[_0x4cd5('0x60')](_0xe9a238['variable'][_0x4cd5('0x9c')])){if(!_0x55b229['queuecallerabandon']){_0x55b229[_0x4cd5('0x83')]=!![];_0x55b229[_0x4cd5('0x84')]=moment()['format'](_0x4cd5('0x6f'));_0x55b229['queuecallerexitreason']='EXITWITHKEY';_0x55b229['queuecallerleaveAt']=moment()[_0x4cd5('0x46')]('YYYY-MM-DD\x20HH:mm:ss');this[_0x4cd5('0x34')][_0xe9a238['uniqueid']]=_0x55b229;}}_0x55b229[_0x4cd5('0x13')]=this['variables'][_0xe9a238[_0x4cd5('0x6d')]];}}}}catch(_0x33f331){logger[_0x4cd5('0x3c')](_0x4cd5('0x9d'),util[_0x4cd5('0x74')](_0x33f331,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x4cd5('0xb')][_0x4cd5('0x96')]=function(_0x3e085d,_0x153e39,_0x3d1458){var _0x186d0f=[_0x4cd5('0x9e'),_0x4cd5('0x9f'),'rtpaudioqosjitter',_0x4cd5('0xa0'),_0x4cd5('0xa1'),_0x4cd5('0xa2'),'rtpaudioqosrtt',_0x4cd5('0xa3'),_0x4cd5('0xa4'),'sipuri',_0x4cd5('0xa5'),_0x4cd5('0xa6'),_0x4cd5('0xa7'),'memberdynamic',_0x4cd5('0xa8'),'memberlastcall',_0x4cd5('0xa9'),'memberpenalty',_0x4cd5('0xaa')];if(!_[_0x4cd5('0x37')](_0x153e39)&&!_['includes'](_0x186d0f,_0x153e39)){if(_[_0x4cd5('0x2d')](this['variables'][_0x3e085d])){this[_0x4cd5('0x13')][_0x3e085d]={};}this[_0x4cd5('0x13')][_0x3e085d][_0x153e39]=_0x3d1458;}};VoiceQueueReport[_0x4cd5('0xb')]['syncHangup']=function(_0x24d7ad){try{if(this['isNotNull'](_0x24d7ad)){if(this[_0x4cd5('0x3e')][_0x24d7ad[_0x4cd5('0x6d')]]){for(var _0x5919f5=0x0,_0x31fae1={};_0x5919f50x0?_0x21cbb1:0x0;this[_0x1250('0x14')][_0x47c756[_0x1250('0x62')]][_0x1250('0x33')]=this[_0x1250('0x14')][_0x47c756[_0x1250('0x62')]][_0x1250('0x33')]>_[_0x1250('0x64')](_0x47c756[_0x1250('0x66')])?_['toNumber'](_0x47c756['loggedin']):this['voiceQueues'][_0x47c756[_0x1250('0x62')]][_0x1250('0x33')];this[_0x1250('0x4f')](this[_0x1250('0x14')][_0x47c756['queue']]);}ami[_0x1250('0x45')](_0x1250('0x68'),this[_0x1250('0x14')][_0x47c756[_0x1250('0x62')]]);}}}catch(_0x4fc5dc){logger[_0x1250('0x3d')](_0x1250('0x69'),util['inspect'](_0x4fc5dc,{'showHidden':![],'depth':null}));}};VoiceQueueReport['prototype'][_0x1250('0x1c')]=function(_0x4a0c3e){this[_0x1250('0x15')]=!![];};VoiceQueueReport['prototype'][_0x1250('0x6a')]=function(_0x37f60b){};VoiceQueueReport[_0x1250('0xc')]['syncQueueCallerJoin']=function(_0x4f6a48){try{if(this[_0x1250('0x5e')](_0x4f6a48)){if(_[_0x1250('0x2f')](this[_0x1250('0x3f')][_0x4f6a48[_0x1250('0x6b')]])){this[_0x1250('0x3f')][_0x4f6a48[_0x1250('0x6b')]]=[];this['channels'][_0x4f6a48[_0x1250('0x6b')]]={};}var _0x34858c=new QueueReport();_0x34858c['name']=_0x4f6a48[_0x1250('0x62')];_0x34858c[_0x1250('0x50')]=this[_0x1250('0x14')][_0x34858c[_0x1250('0x48')]]&&this[_0x1250('0x14')][_0x34858c[_0x1250('0x48')]]['type']?this[_0x1250('0x14')][_0x34858c[_0x1250('0x48')]][_0x1250('0x50')]||'inbound':_0x1250('0x51');_0x34858c[_0x1250('0x62')]=_0x4f6a48[_0x1250('0x62')];_0x34858c['queuecallerjoinAt']=moment()[_0x1250('0x4d')](_0x1250('0x6c'));_0x34858c['position']=_0x4f6a48[_0x1250('0x6d')];_0x34858c[_0x1250('0x6e')]=_0x4f6a48['count'];_[_0x1250('0x6f')](_0x34858c,_[_0x1250('0x70')](_0x4f6a48,_[_0x1250('0x71')](_0x34858c)));this['queueReports'][_0x4f6a48[_0x1250('0x6b')]][_0x1250('0x72')](_0x34858c);this[_0x1250('0x12')][_0x4f6a48[_0x1250('0x6b')]]=_0x34858c;this[_0x1250('0x46')](_0x34858c);}}catch(_0x318651){logger[_0x1250('0x3d')](_0x1250('0x73'),util['inspect'](_0x318651,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x1250('0xc')][_0x1250('0x1f')]=function(_0x5e73db){try{if(this[_0x1250('0x5e')](_0x5e73db)){if(this[_0x1250('0x3f')][_0x5e73db[_0x1250('0x6b')]]){var _0x340386=_['last'](this[_0x1250('0x3f')][_0x5e73db['uniqueid']]);_0x340386[_0x1250('0x74')]=![];_0x340386[_0x1250('0x75')]=null;_0x340386[_0x1250('0x76')]=_0x5e73db['holdtime'];_0x340386['originalposition']=_0x5e73db['originalposition'];_0x340386['queuecallerabandon']=!![];_0x340386[_0x1250('0x77')]=moment()[_0x1250('0x4d')](_0x1250('0x6c'));_0x340386['queuecallerexitreason']=_0x1250('0x78');_0x340386[_0x1250('0x79')]=null;this[_0x1250('0x12')][_0x5e73db['uniqueid']]=_0x340386;this[_0x1250('0x4a')](_0x340386);}}}catch(_0x5139e5){logger['error'](_0x1250('0x7a'),util[_0x1250('0x44')](_0x5139e5,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x1250('0xc')][_0x1250('0x21')]=function(_0x54d051){try{if(this[_0x1250('0x5e')](_0x54d051)){if(this[_0x1250('0x3f')][_0x54d051['uniqueid']]){var _0x4d4bab=_['last'](this['queueReports'][_0x54d051[_0x1250('0x6b')]]);_0x4d4bab['queuecallerleaveAt']=moment()['format'](_0x1250('0x6c'));_0x4d4bab[_0x1250('0x7b')]=_0x54d051['connectedlinenum'];_0x4d4bab[_0x1250('0x7c')]=_0x54d051[_0x1250('0x7c')];this['channels'][_0x54d051[_0x1250('0x6b')]]=_0x4d4bab;this[_0x1250('0x46')](_0x4d4bab);}}}catch(_0x3bd047){logger[_0x1250('0x3d')](_0x1250('0x7d'),util[_0x1250('0x44')](_0x3bd047,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x1250('0xc')]['syncAgentConnect']=function(_0x4d0659){try{if(this[_0x1250('0x5e')](_0x4d0659)){if(this[_0x1250('0x3f')][_0x4d0659[_0x1250('0x6b')]]){var _0x14dfd0=_[_0x1250('0x7e')](this[_0x1250('0x3f')][_0x4d0659[_0x1250('0x6b')]]);_0x14dfd0[_0x1250('0x74')]=!![];_0x14dfd0['queuecallerexitreason']=_0x1250('0x7f');}}}catch(_0x1cd480){logger[_0x1250('0x3d')](_0x1250('0x80'),util[_0x1250('0x44')](_0x1cd480,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x1250('0xc')][_0x1250('0x22')]=function(_0xd6037e){try{if(this[_0x1250('0x5e')](_0xd6037e)){if(this['queueReports'][_0xd6037e[_0x1250('0x6b')]]){var _0x37d9cb=_[_0x1250('0x7e')](this[_0x1250('0x3f')][_0xd6037e[_0x1250('0x6b')]]);_0x37d9cb[_0x1250('0x1e')]=![];_0x37d9cb[_0x1250('0x77')]=null;_0x37d9cb[_0x1250('0x81')]=!![];_0x37d9cb['lastAssignedTo']=_0xd6037e[_0x1250('0x82')];_0x37d9cb['holdtime']=_0xd6037e['holdtime'];_0x37d9cb[_0x1250('0x74')]=!![];_0x37d9cb[_0x1250('0x83')]=![];_0x37d9cb[_0x1250('0x84')]=null;if(!_0x37d9cb[_0x1250('0x85')]){if(_0xd6037e[_0x1250('0x86')]=='transfer'){_0x37d9cb[_0x1250('0x87')]=_0x1250('0x88');}else{if(_['startsWith'](_0xd6037e[_0x1250('0x3a')][_0x1250('0x89')](),_0x1250('0x8a'))){if(this[_0x1250('0x3f')][_0xd6037e[_0x1250('0x8b')]]){var _0x7d8460=_[_0x1250('0x7e')](this[_0x1250('0x3f')][_0xd6037e['linkedid']]);_0x7d8460[_0x1250('0x74')]=![];_0x7d8460[_0x1250('0x83')]=!![];_0x7d8460[_0x1250('0x84')]=moment(_0x37d9cb['queuecallerjoinAt'])[_0x1250('0x8c')](_0xd6037e[_0x1250('0x76')],'seconds')['format'](_0x1250('0x6c'));_0x7d8460[_0x1250('0x87')]=_0x1250('0x8d');_0x7d8460[_0x1250('0x85')]=!![];_0x7d8460[_0x1250('0x8e')]=_0x1250('0x8f');_0x7d8460[_0x1250('0x90')]=_0xd6037e[_0x1250('0x91')];_0x7d8460['transferuniqueid']=_0xd6037e[_0x1250('0x6b')];var _0x1e9359=this['queueReports'][_0xd6037e[_0x1250('0x8b')]];this[_0x1250('0x3f')][_0xd6037e[_0x1250('0x8b')]]=this[_0x1250('0x3f')][_0xd6037e[_0x1250('0x6b')]];this['queueReports'][_0xd6037e[_0x1250('0x6b')]]=_0x1e9359;}}else{_0x37d9cb['queuecallerexitreason']='COMPLETEDBY'+_0xd6037e[_0x1250('0x86')][_0x1250('0x92')]();}}}this['channels'][_0xd6037e['uniqueid']]=_0x37d9cb;this[_0x1250('0x4a')](_0x37d9cb);}}}catch(_0x270043){logger[_0x1250('0x3d')](_0x1250('0x93'),util[_0x1250('0x44')](_0x270043,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x1250('0xc')][_0x1250('0x94')]=function(_0x4da053){try{if(this[_0x1250('0x5e')](_0x4da053)){this['addVariable'](_0x4da053[_0x1250('0x6b')],_[_0x1250('0x71')](_0x4da053[_0x1250('0x95')])[0x0],_0x4da053[_0x1250('0x96')]);if(this[_0x1250('0x3f')][_0x4da053[_0x1250('0x6b')]]){var _0x52ff39=_[_0x1250('0x7e')](this[_0x1250('0x3f')][_0x4da053[_0x1250('0x6b')]]);if(_0x52ff39){if(this[_0x1250('0x5e')](_0x4da053['variable'])&&this[_0x1250('0x5e')](_0x4da053['variable'][_0x1250('0x97')])){switch(_0x4da053[_0x1250('0x96')]){case'CONTINUE':_0x52ff39[_0x1250('0x83')]=![];_0x52ff39[_0x1250('0x84')]=null;break;default:_0x52ff39[_0x1250('0x83')]=!![];_0x52ff39[_0x1250('0x84')]=moment()[_0x1250('0x4d')](_0x1250('0x6c'));_0x52ff39['queuecallerleaveAt']=moment()['format'](_0x1250('0x6c'));}_0x52ff39[_0x1250('0x1e')]=![];_0x52ff39[_0x1250('0x77')]=null;_0x52ff39[_0x1250('0x87')]=_0x4da053[_0x1250('0x96')];this[_0x1250('0x12')][_0x4da053[_0x1250('0x6b')]]=_0x52ff39;this[_0x1250('0x4a')](_0x52ff39);}else if(this[_0x1250('0x5e')](_0x4da053[_0x1250('0x95')])&&this[_0x1250('0x5e')](_0x4da053[_0x1250('0x95')][_0x1250('0x98')])){if(!_0x52ff39[_0x1250('0x1e')]){_0x52ff39[_0x1250('0x83')]=!![];_0x52ff39[_0x1250('0x84')]=moment()[_0x1250('0x4d')](_0x1250('0x6c'));_0x52ff39['queuecallerexitreason']='EXITWITHKEY';_0x52ff39[_0x1250('0x99')]=moment()[_0x1250('0x4d')](_0x1250('0x6c'));this['channels'][_0x4da053[_0x1250('0x6b')]]=_0x52ff39;}}_0x52ff39[_0x1250('0x17')]=this['variables'][_0x4da053['uniqueid']];}}}}catch(_0x52e583){logger[_0x1250('0x3d')](_0x1250('0x9a'),util[_0x1250('0x44')](_0x52e583,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x1250('0xc')]['addVariable']=function(_0x49168b,_0x5919af,_0x4d5e44){var _0x45ff2a=['rtpaudioqos',_0x1250('0x9b'),_0x1250('0x9c'),_0x1250('0x9d'),_0x1250('0x9e'),_0x1250('0x9f'),_0x1250('0xa0'),_0x1250('0xa1'),_0x1250('0xa2'),_0x1250('0xa3'),'bridgepeer',_0x1250('0xa4'),'membercalls',_0x1250('0xa5'),_0x1250('0xa6'),_0x1250('0xa7'),_0x1250('0x82'),_0x1250('0xa8'),_0x1250('0xa9')];if(!_[_0x1250('0x37')](_0x5919af)&&!_[_0x1250('0xaa')](_0x45ff2a,_0x5919af)){if(_['isUndefined'](this[_0x1250('0x17')][_0x49168b])){this['variables'][_0x49168b]={};}this[_0x1250('0x17')][_0x49168b][_0x5919af]=_0x4d5e44;}};VoiceQueueReport[_0x1250('0xc')]['syncHangup']=function(_0x5beb49){try{if(this[_0x1250('0x5e')](_0x5beb49)){if(this['queueReports'][_0x5beb49['uniqueid']]){for(var _0x2656b7=0x0,_0x1f16f0={};_0x2656b7=0x0?moment(_0x4bdf3f['endtime'])['diff'](_0x4bdf3f[_0xe7b0('0x1a')],_0xe7b0('0x11')):null,'data1':_0xe7b0('0x1b'),'data2':_0x4bdf3f[_0xe7b0('0x16')],'data3':_0x4bdf3f[_0xe7b0('0x14')],'data4':_0x4bdf3f[_0xe7b0('0x1c')]||null,'role':_0xe7b0('0x15'),'internal':_0x4bdf3f['accountcode']?_[_0xe7b0('0x1d')](_0x4bdf3f['accountcode']):undefined,'uniqueid':_0x4bdf3f[_0xe7b0('0x17')]},'log':_0xe7b0('0x7')});}; \ No newline at end of file +var _0x5202=['queuecallerexitAt','CreateMemberReport','voice','isNil','format','SIP/%s','lastAssignedTo','interface','TALKING','queuecallerleaveAt','seconds','calleridnum','queue','accountcode','toNumber','voiceDialReport','Request','membername','endtime','starttime','diff','exten','dialstring','agent','uniqueid','moment','lodash','util','queuecallercompleteAt'];(function(_0xfa0ba0,_0x18237c){var _0x33a6ee=function(_0x10c73e){while(--_0x10c73e){_0xfa0ba0['push'](_0xfa0ba0['shift']());}};_0x33a6ee(++_0x18237c);}(_0x5202,0x175));var _0x2520=function(_0x1e41a7,_0xf5bcc9){_0x1e41a7=_0x1e41a7-0x0;var _0x47e3a4=_0x5202[_0x1e41a7];return _0x47e3a4;};'use strict';var moment=require(_0x2520('0x0'));var _=require(_0x2520('0x1'));var util=require(_0x2520('0x2'));var client=require('../client');exports['voiceQueueReport']=function(_0x28ec95){var _0x3dd4b4=_0x28ec95[_0x2520('0x3')]||_0x28ec95[_0x2520('0x4')];return client['Request'](_0x2520('0x5'),{'body':{'channel':_0x2520('0x6'),'membername':_0x28ec95['lastAssignedTo'],'interface':_[_0x2520('0x7')](_0x28ec95['interface'])?util[_0x2520('0x8')](_0x2520('0x9'),_0x28ec95[_0x2520('0xa')]):_0x28ec95[_0x2520('0xb')],'type':_0x2520('0xc'),'enterAt':_0x28ec95[_0x2520('0xd')],'exitAt':_0x3dd4b4,'duration':moment(_0x3dd4b4)['diff'](_0x28ec95['queuecallerleaveAt'],_0x2520('0xe')),'data1':'inbound','data2':_0x28ec95[_0x2520('0xf')],'data3':_0x28ec95['exten'],'data4':null,'data5':_0x28ec95[_0x2520('0x10')],'role':'agent','internal':_0x28ec95[_0x2520('0x11')]?_[_0x2520('0x12')](_0x28ec95[_0x2520('0x11')]):undefined,'uniqueid':_0x28ec95['uniqueid']},'log':'CreateMemberReport'});};exports[_0x2520('0x13')]=function(_0xdaf99f){return client[_0x2520('0x14')](_0x2520('0x5'),{'body':{'channel':'voice','membername':_0xdaf99f[_0x2520('0x15')],'interface':_0xdaf99f[_0x2520('0xb')],'type':_0x2520('0xc'),'enterAt':_0xdaf99f['starttime'],'exitAt':_0xdaf99f['endtime'],'duration':moment(_0xdaf99f[_0x2520('0x16')])['diff'](_0xdaf99f[_0x2520('0x17')],'seconds')>=0x0?moment(_0xdaf99f[_0x2520('0x16')])[_0x2520('0x18')](_0xdaf99f['starttime'],'seconds'):null,'data1':'outbound','data2':_0xdaf99f[_0x2520('0x11')],'data3':_0xdaf99f[_0x2520('0x19')],'data4':_0xdaf99f[_0x2520('0x1a')]||null,'role':_0x2520('0x1b'),'internal':_0xdaf99f['accountcode']?_[_0x2520('0x12')](_0xdaf99f[_0x2520('0x11')]):undefined,'uniqueid':_0xdaf99f[_0x2520('0x1c')]},'log':_0x2520('0x5')});}; \ No newline at end of file diff --git a/server/services/ami/rpc/template.js b/server/services/ami/rpc/template.js index a92f2a2..fc098bb 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 _0x0c5d=['GetTemplate','name','html','../client','getTemplates'];(function(_0x3d76c7,_0x5d913e){var _0x481b76=function(_0x439878){while(--_0x439878){_0x3d76c7['push'](_0x3d76c7['shift']());}};_0x481b76(++_0x5d913e);}(_0x0c5d,0x6c));var _0xd0c5=function(_0x577ed7,_0x6ab2d3){_0x577ed7=_0x577ed7-0x0;var _0xcf9626=_0x0c5d[_0x577ed7];return _0xcf9626;};'use strict';var client=require(_0xd0c5('0x0'));exports[_0xd0c5('0x1')]=function(_0x4d5e69){return function(_0x22a735){return client['Request'](_0xd0c5('0x2'),{'options':{'raw':!![],'attributes':['id',_0xd0c5('0x3'),_0xd0c5('0x4')]},'log':_0xd0c5('0x2')});};}; \ No newline at end of file +var _0x3c81=['../client','getTemplates','Request'];(function(_0x575a34,_0x55a492){var _0x1858e9=function(_0x49e9b6){while(--_0x49e9b6){_0x575a34['push'](_0x575a34['shift']());}};_0x1858e9(++_0x55a492);}(_0x3c81,0x102));var _0x13c8=function(_0x4313dd,_0x5a1ea8){_0x4313dd=_0x4313dd-0x0;var _0x3a8237=_0x3c81[_0x4313dd];return _0x3a8237;};'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 f581db3..8378387 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 _0x1288=['field','operator','value','Condition','AnyConditions','Action','data3','data4','data5','data6','data7','../client','getTriggers','Request','channel'];(function(_0x2ff238,_0x1811d2){var _0x204a56=function(_0x5bf2e1){while(--_0x5bf2e1){_0x2ff238['push'](_0x2ff238['shift']());}};_0x204a56(++_0x1811d2);}(_0x1288,0x83));var _0x8128=function(_0x5be571,_0x46766a){_0x5be571=_0x5be571-0x0;var _0x4ac06c=_0x1288[_0x5be571];return _0x4ac06c;};'use strict';var client=require(_0x8128('0x0'));exports[_0x8128('0x1')]=function(_0x194dfe){return function(_0x669551){return client[_0x8128('0x2')]('GetTrigger',{'options':{'raw':![],'attributes':['id','name',_0x8128('0x3'),'status'],'include':[{'model':'Condition','as':'AllConditions','attributes':['id',_0x8128('0x4'),_0x8128('0x5'),_0x8128('0x6')]},{'model':_0x8128('0x7'),'as':_0x8128('0x8'),'attributes':['id',_0x8128('0x4'),_0x8128('0x5'),_0x8128('0x6')]},{'model':_0x8128('0x9'),'as':'Actions','attributes':['id','action','data1','data2',_0x8128('0xa'),_0x8128('0xb'),_0x8128('0xc'),_0x8128('0xd'),_0x8128('0xe')]}]},'log':'GetTrigger'});};}; \ No newline at end of file +var _0x7c84=['operator','value','Action','action','data4','data5','data6','data7','../client','Request','GetTrigger','name','channel','status','Condition','field'];(function(_0x22811b,_0x2e6f11){var _0x469841=function(_0x22d9bb){while(--_0x22d9bb){_0x22811b['push'](_0x22811b['shift']());}};_0x469841(++_0x2e6f11);}(_0x7c84,0x118));var _0x47c8=function(_0xd85914,_0xa472fc){_0xd85914=_0xd85914-0x0;var _0x2ccaf2=_0x7c84[_0xd85914];return _0x2ccaf2;};'use strict';var client=require(_0x47c8('0x0'));exports['getTriggers']=function(_0x24a2e4){return function(_0x4dd3a6){return client[_0x47c8('0x1')](_0x47c8('0x2'),{'options':{'raw':![],'attributes':['id',_0x47c8('0x3'),_0x47c8('0x4'),_0x47c8('0x5')],'include':[{'model':_0x47c8('0x6'),'as':'AllConditions','attributes':['id',_0x47c8('0x7'),_0x47c8('0x8'),_0x47c8('0x9')]},{'model':'Condition','as':'AnyConditions','attributes':['id',_0x47c8('0x7'),'operator','value']},{'model':_0x47c8('0xa'),'as':'Actions','attributes':['id',_0x47c8('0xb'),'data1','data2','data3',_0x47c8('0xc'),_0x47c8('0xd'),_0x47c8('0xe'),_0x47c8('0xf')]}]},'log':'GetTrigger'});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/trunk.js b/server/services/ami/rpc/trunk.js index 2d7014a..d1628d9 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 _0x03bc=['name','../client','getTrunks','Request'];(function(_0x29d915,_0x54a040){var _0x160f86=function(_0x237dfa){while(--_0x237dfa){_0x29d915['push'](_0x29d915['shift']());}};_0x160f86(++_0x54a040);}(_0x03bc,0x189));var _0xc03b=function(_0x12cdaf,_0x50191d){_0x12cdaf=_0x12cdaf-0x0;var _0x2855ed=_0x03bc[_0x12cdaf];return _0x2855ed;};'use strict';var client=require(_0xc03b('0x0'));exports[_0xc03b('0x1')]=function(_0xde8965){return function(_0x42953d){return client[_0xc03b('0x2')]('GetTrunk',{'options':{'raw':!![],'where':{'active':0x1},'attributes':['id',_0xc03b('0x3'),'registry']},'log':'GetTrunk'});};}; \ No newline at end of file +var _0x957e=['getTrunks','Request','GetTrunk','registry','../client'];(function(_0x429ec6,_0x26a5ac){var _0x5c20df=function(_0x4b93ab){while(--_0x4b93ab){_0x429ec6['push'](_0x429ec6['shift']());}};_0x5c20df(++_0x26a5ac);}(_0x957e,0xc2));var _0xe957=function(_0x4254e7,_0x4fc342){_0x4254e7=_0x4254e7-0x0;var _0x5e0844=_0x957e[_0x4254e7];return _0x5e0844;};'use strict';var client=require(_0xe957('0x0'));exports[_0xe957('0x1')]=function(_0x2fd821){return function(_0x7b24a6){return client[_0xe957('0x2')](_0xe957('0x3'),{'options':{'raw':!![],'where':{'active':0x1},'attributes':['id','name',_0xe957('0x4')]},'log':_0xe957('0x3')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/user.js b/server/services/ami/rpc/user.js index 8ca60fe..5b85d8b 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 _0xc95d=['name','accountcode','fullname','online','lastLoginAt','pauseType','lastPauseAt','voicePause','phone','mobile','interface','getTelephones','telephone','internal','savePause','saveUnpause','UnpauseUser','getAgent','getAgents','Request','GetUser','agent'];(function(_0x166266,_0x2d757e){var _0xe5629c=function(_0x22999e){while(--_0x22999e){_0x166266['push'](_0x166266['shift']());}};_0xe5629c(++_0x2d757e);}(_0xc95d,0xd8));var _0xdc95=function(_0x5aaf94,_0x5ca5e1){_0x5aaf94=_0x5aaf94-0x0;var _0x24e122=_0xc95d[_0x5aaf94];return _0x24e122;};'use strict';var client=require('../client');exports[_0xdc95('0x0')]=function(){return function(){return client[_0xdc95('0x1')](_0xdc95('0x2'),{'options':{'raw':![],'where':{'role':_0xdc95('0x3')},'attributes':['id',_0xdc95('0x4'),'email',_0xdc95('0x5'),_0xdc95('0x6'),_0xdc95('0x7'),_0xdc95('0x8'),_0xdc95('0x9'),_0xdc95('0xa'),_0xdc95('0xb'),_0xdc95('0xc'),_0xdc95('0xd'),_0xdc95('0xe')]},'log':_0xdc95('0x0')});};};exports[_0xdc95('0xf')]=function(){return function(){return client[_0xdc95('0x1')](_0xdc95('0x2'),{'options':{'raw':!![],'where':{'role':_0xdc95('0x10')},'attributes':['id',_0xdc95('0x4'),'accountcode',_0xdc95('0x11')]},'log':_0xdc95('0xf')});};};exports[_0xdc95('0x12')]=function(_0x49e4b2,_0x39ef3c,_0x3b3c85){return client['Request']('PauseUser',{'body':{'type':_0x39ef3c,'uniqueid':_0x3b3c85},'options':{'where':{'id':_0x49e4b2['id']}},'log':_0xdc95('0x12')});};exports[_0xdc95('0x13')]=function(_0x1aa42e){return client[_0xdc95('0x1')](_0xdc95('0x14'),{'body':{},'options':{'where':{'id':_0x1aa42e['id']}},'log':_0xdc95('0x12')});};exports[_0xdc95('0x15')]=function(_0x5ed019){return client[_0xdc95('0x1')]('ShowUser',{'options':{'raw':![],'where':{'role':'agent','id':_0x5ed019},'attributes':['id',_0xdc95('0x4'),'email','accountcode',_0xdc95('0x6'),'online','lastLoginAt',_0xdc95('0x9'),'lastPauseAt',_0xdc95('0xb'),'interface']},'log':_0xdc95('0x15')});}; \ No newline at end of file +var _0xe20b=['email','accountcode','fullname','online','pauseType','lastPauseAt','mobile','telephone','internal','getTelephones','savePause','PauseUser','saveUnpause','getAgent','ShowUser','lastLoginAt','voicePause','interface','../client','getAgents','Request','GetUser','agent','name'];(function(_0x3d00e6,_0x1dcafc){var _0x27ceaa=function(_0x2381c9){while(--_0x2381c9){_0x3d00e6['push'](_0x3d00e6['shift']());}};_0x27ceaa(++_0x1dcafc);}(_0xe20b,0x11a));var _0xbe20=function(_0x26f1b6,_0x20e9a4){_0x26f1b6=_0x26f1b6-0x0;var _0x2b37f1=_0xe20b[_0x26f1b6];return _0x2b37f1;};'use strict';var client=require(_0xbe20('0x0'));exports[_0xbe20('0x1')]=function(){return function(){return client[_0xbe20('0x2')](_0xbe20('0x3'),{'options':{'raw':![],'where':{'role':_0xbe20('0x4')},'attributes':['id',_0xbe20('0x5'),_0xbe20('0x6'),_0xbe20('0x7'),_0xbe20('0x8'),_0xbe20('0x9'),'lastLoginAt',_0xbe20('0xa'),_0xbe20('0xb'),'voicePause','phone',_0xbe20('0xc'),'interface']},'log':_0xbe20('0x1')});};};exports['getTelephones']=function(){return function(){return client[_0xbe20('0x2')](_0xbe20('0x3'),{'options':{'raw':!![],'where':{'role':_0xbe20('0xd')},'attributes':['id',_0xbe20('0x5'),'accountcode',_0xbe20('0xe')]},'log':_0xbe20('0xf')});};};exports[_0xbe20('0x10')]=function(_0x303ad9,_0x11e7b2,_0x5dcfea){return client[_0xbe20('0x2')](_0xbe20('0x11'),{'body':{'type':_0x11e7b2,'uniqueid':_0x5dcfea},'options':{'where':{'id':_0x303ad9['id']}},'log':_0xbe20('0x10')});};exports[_0xbe20('0x12')]=function(_0x49621e){return client[_0xbe20('0x2')]('UnpauseUser',{'body':{},'options':{'where':{'id':_0x49621e['id']}},'log':_0xbe20('0x10')});};exports[_0xbe20('0x13')]=function(_0x4de800){return client[_0xbe20('0x2')](_0xbe20('0x14'),{'options':{'raw':![],'where':{'role':_0xbe20('0x4'),'id':_0x4de800},'attributes':['id',_0xbe20('0x5'),_0xbe20('0x6'),'accountcode','fullname',_0xbe20('0x9'),_0xbe20('0x15'),_0xbe20('0xa'),_0xbe20('0xb'),_0xbe20('0x16'),_0xbe20('0x17')]},'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 2d0a3ad..852caff 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 _0x3438=['UpdateVoiceAgentReport','../client','Request','CreateVoiceAgentReport','update'];(function(_0x433a7c,_0x5ed271){var _0x15eaa6=function(_0x35a63f){while(--_0x35a63f){_0x433a7c['push'](_0x433a7c['shift']());}};_0x15eaa6(++_0x5ed271);}(_0x3438,0x141));var _0x8343=function(_0x4235e0,_0x171825){_0x4235e0=_0x4235e0-0x0;var _0x18227b=_0x3438[_0x4235e0];return _0x18227b;};'use strict';var client=require(_0x8343('0x0'));exports['create']=function(_0x63c767){return client[_0x8343('0x1')](_0x8343('0x2'),{'body':_0x63c767,'log':'CreateVoiceAgentReport'});};exports[_0x8343('0x3')]=function(_0x1ca2f4,_0x26cd5d,_0x3dd499){return client[_0x8343('0x1')](_0x8343('0x4'),{'body':_0x1ca2f4,'options':{'where':{'uniqueid':_0x26cd5d,'interface':_0x3dd499,'agentcomplete':!![]}},'log':_0x8343('0x4')});}; \ No newline at end of file +var _0xa886=['Request','CreateVoiceAgentReport','UpdateVoiceAgentReport','create'];(function(_0x4b5234,_0x513ce9){var _0x4983ee=function(_0xb4f813){while(--_0xb4f813){_0x4b5234['push'](_0x4b5234['shift']());}};_0x4983ee(++_0x513ce9);}(_0xa886,0x193));var _0x6a88=function(_0x502c7d,_0x2f1285){_0x502c7d=_0x502c7d-0x0;var _0x30b7ed=_0xa886[_0x502c7d];return _0x30b7ed;};'use strict';var client=require('../client');exports[_0x6a88('0x0')]=function(_0x1e7567){return client[_0x6a88('0x1')](_0x6a88('0x2'),{'body':_0x1e7567,'log':_0x6a88('0x2')});};exports['update']=function(_0x341f5f,_0x587252,_0x4d2c65){return client[_0x6a88('0x1')](_0x6a88('0x3'),{'body':_0x341f5f,'options':{'where':{'uniqueid':_0x587252,'interface':_0x4d2c65,'agentcomplete':!![]}},'log':_0x6a88('0x3')});}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceCallReport.js b/server/services/ami/rpc/voiceCallReport.js index b2d3a28..3cf2de5 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 _0xfbf6=['duration','billableseconds','GetVoiceCallReports','moment','util','lodash','Request','CreateVoiceCallReport','calleridnum','context','callerid','DOCUMENTATION','getVoiceCallReports','GetVoiceCallReport','outbound','startOf','day','format','endOf','YYYY-MM-DD\x20HH:mm:ss','disposition'];(function(_0x1f6c95,_0x1f0204){var _0x334ccb=function(_0x1cc662){while(--_0x1cc662){_0x1f6c95['push'](_0x1f6c95['shift']());}};_0x334ccb(++_0x1f0204);}(_0xfbf6,0x1a7));var _0x6fbf=function(_0x3490c2,_0x548c5e){_0x3490c2=_0x3490c2-0x0;var _0x891d41=_0xfbf6[_0x3490c2];return _0x891d41;};'use strict';var moment=require(_0x6fbf('0x0'));var util=require(_0x6fbf('0x1'));var _=require(_0x6fbf('0x2'));var client=require('../client');exports['create']=function(_0x4e02d6){return client[_0x6fbf('0x3')](_0x6fbf('0x4'),{'body':_['merge'](_0x4e02d6,{'source':_0x4e02d6[_0x6fbf('0x5')],'destinationcontext':_0x4e02d6[_0x6fbf('0x6')],'callerid':_0x4e02d6[_0x6fbf('0x7')],'amaflags':_0x6fbf('0x8')}),'log':'CreateVoiceCallReport'});};exports[_0x6fbf('0x9')]=function(){return function(){return client['Request'](_0x6fbf('0xa'),{'options':{'where':{'type':[_0x6fbf('0xb')],'createdAt':{'$between':[moment()[_0x6fbf('0xc')](_0x6fbf('0xd'))[_0x6fbf('0xe')]('YYYY-MM-DD\x20HH:mm:ss'),moment()[_0x6fbf('0xf')](_0x6fbf('0xd'))[_0x6fbf('0xe')](_0x6fbf('0x10'))]}},'attributes':['type',_0x6fbf('0x11'),_0x6fbf('0x12'),_0x6fbf('0x13')]},'log':_0x6fbf('0x14')});};}; \ No newline at end of file +var _0x083a=['Request','GetVoiceCallReport','startOf','format','YYYY-MM-DD\x20HH:mm:ss','type','disposition','billableseconds','moment','lodash','../client','merge','context','DOCUMENTATION','CreateVoiceCallReport'];(function(_0x2c91e9,_0x2fb965){var _0x13f0ff=function(_0xb39edf){while(--_0xb39edf){_0x2c91e9['push'](_0x2c91e9['shift']());}};_0x13f0ff(++_0x2fb965);}(_0x083a,0x9e));var _0xa083=function(_0x3ab51d,_0x2fa01d){_0x3ab51d=_0x3ab51d-0x0;var _0x29a04e=_0x083a[_0x3ab51d];return _0x29a04e;};'use strict';var moment=require(_0xa083('0x0'));var util=require('util');var _=require(_0xa083('0x1'));var client=require(_0xa083('0x2'));exports['create']=function(_0x244350){return client['Request']('CreateVoiceCallReport',{'body':_[_0xa083('0x3')](_0x244350,{'source':_0x244350['calleridnum'],'destinationcontext':_0x244350[_0xa083('0x4')],'callerid':_0x244350['callerid'],'amaflags':_0xa083('0x5')}),'log':_0xa083('0x6')});};exports['getVoiceCallReports']=function(){return function(){return client[_0xa083('0x7')](_0xa083('0x8'),{'options':{'where':{'type':['outbound'],'createdAt':{'$between':[moment()[_0xa083('0x9')]('day')[_0xa083('0xa')](_0xa083('0xb')),moment()['endOf']('day')[_0xa083('0xa')](_0xa083('0xb'))]}},'attributes':[_0xa083('0xc'),_0xa083('0xd'),'duration',_0xa083('0xe')]},'log':'GetVoiceCallReports'});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceDialReport.js b/server/services/ami/rpc/voiceDialReport.js index bd3b5f1..d84d5fb 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 _0x70f4=['CreateVoiceDialReport','create'];(function(_0x455237,_0x42eb42){var _0x5dc9f5=function(_0x3c4a4d){while(--_0x3c4a4d){_0x455237['push'](_0x455237['shift']());}};_0x5dc9f5(++_0x42eb42);}(_0x70f4,0xed));var _0x470f=function(_0x174a7c,_0x163b97){_0x174a7c=_0x174a7c-0x0;var _0x2e35d6=_0x70f4[_0x174a7c];return _0x2e35d6;};'use strict';var client=require('../client');exports[_0x470f('0x0')]=function(_0x4f95cf){return client['Request'](_0x470f('0x1'),{'body':_0x4f95cf,'log':'CreateVoiceDialReport'});}; \ No newline at end of file +var _0xf310=['../client','Request','CreateVoiceDialReport'];(function(_0x5a2285,_0x3212d1){var _0x48f6ed=function(_0x322127){while(--_0x322127){_0x5a2285['push'](_0x5a2285['shift']());}};_0x48f6ed(++_0x3212d1);}(_0xf310,0xe7));var _0x0f31=function(_0x318594,_0x16c0b2){_0x318594=_0x318594-0x0;var _0x280121=_0xf310[_0x318594];return _0x280121;};'use strict';var client=require(_0x0f31('0x0'));exports['create']=function(_0x494d54){return client[_0x0f31('0x1')](_0x0f31('0x2'),{'body':_0x494d54,'log':_0x0f31('0x2')});}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceExtension.js b/server/services/ami/rpc/voiceExtension.js index 2e4a097..27decc0 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 _0x354c=['getVoiceExtensions','Request','GetVoiceExtension','recordingFormat','../client'];(function(_0x19f39b,_0x69f767){var _0x3e40f6=function(_0x9affed){while(--_0x9affed){_0x19f39b['push'](_0x19f39b['shift']());}};_0x3e40f6(++_0x69f767);}(_0x354c,0x1e4));var _0xc354=function(_0x41ff5e,_0x434e66){_0x41ff5e=_0x41ff5e-0x0;var _0x5f065a=_0x354c[_0x41ff5e];return _0x5f065a;};'use strict';var client=require(_0xc354('0x0'));exports[_0xc354('0x1')]=function(){return function(){return client[_0xc354('0x2')](_0xc354('0x3'),{'options':{'raw':!![],'attributes':['id','exten',_0xc354('0x4')],'where':{'VoiceExtensionId':null}},'log':_0xc354('0x1')});};}; \ No newline at end of file +var _0xefda=['exten','getVoiceExtensions','../client','GetVoiceExtension'];(function(_0x4e5552,_0x19ec4e){var _0x60a338=function(_0x40c70e){while(--_0x40c70e){_0x4e5552['push'](_0x4e5552['shift']());}};_0x60a338(++_0x19ec4e);}(_0xefda,0x96));var _0xaefd=function(_0x5bf5eb,_0x285b46){_0x5bf5eb=_0x5bf5eb-0x0;var _0x5d4019=_0xefda[_0x5bf5eb];return _0x5d4019;};'use strict';var client=require(_0xaefd('0x0'));exports['getVoiceExtensions']=function(){return function(){return client['Request'](_0xaefd('0x1'),{'options':{'raw':!![],'attributes':['id',_0xaefd('0x2'),'recordingFormat'],'where':{'VoiceExtensionId':null}},'log':_0xaefd('0x3')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceQueue.js b/server/services/ami/rpc/voiceQueue.js index 41bf166..44a5d10 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 _0xbfd7=['dialPredictiveOptimization','dialPredictiveInterval','dialOriginateCallerIdName','dialOriginateCallerIdNumber','dialOriginateTimeout','dialQueueOptions','dialQueueTimeout','dialQueueProject','dialCongestionMaxRetry','dialCongestionRetryFrequency','dialBusyMaxRetry','dialBusyRetryFrequency','dialNoAnswerMaxRetry','dialGlobalMaxRetry','dialTimezone','dialGlobalInterval','dialPrefix','dialCheckDuplicateType','dialAMDGreeting','dialAMDAfterGreetingSilence','dialAMDTotalAnalysisTime','dialAMDMinWordLength','dialAMDBetweenWordsSilence','dialAMDMaximumNumberOfWords','dialAMDSilenceThreshold','dialAMDMaximumWordLength','timeout','dialOrderByScheduledAt','dialAgiAfterHangupClient','dialQueueProject2','dialRandomLastDigitCallerIdNumber','dialCutDigit','dialNoSuchNumberRetryFrequency','dialDropMaxRetry','dialAbandonedMaxRetry','dialAbandonedRetryFrequency','dialMachineRetryFrequency','dialAgentRejectMaxRetry','dialAgentRejectRetryFrequency','dialPredictiveIntervalMaxThreshold','dialPredictiveIntervalMinThreshold','Trunk','callerid','active','mandatoryDispositionPause','TrunkBackup','Interval','Intervals','interval','../client','getVoiceQueues','Request','GetVoiceQueue','name','acwTimeout','autopause','monitor_format','type','dialMethod','dialLimitChannel','dialLimitQueue','dialPowerLevel'];(function(_0x3b96cf,_0x1592f2){var _0x2e315a=function(_0x21fa50){while(--_0x21fa50){_0x3b96cf['push'](_0x3b96cf['shift']());}};_0x2e315a(++_0x1592f2);}(_0xbfd7,0x167));var _0x7bfd=function(_0xeeba8c,_0x460454){_0xeeba8c=_0xeeba8c-0x0;var _0x2a57a9=_0xbfd7[_0xeeba8c];return _0x2a57a9;};'use strict';var client=require(_0x7bfd('0x0'));exports[_0x7bfd('0x1')]=function(){return function(){return client[_0x7bfd('0x2')](_0x7bfd('0x3'),{'options':{'raw':![],'attributes':['id',_0x7bfd('0x4'),'acw',_0x7bfd('0x5'),_0x7bfd('0x6'),_0x7bfd('0x7'),_0x7bfd('0x8'),'dialActive',_0x7bfd('0x9'),_0x7bfd('0xa'),_0x7bfd('0xb'),_0x7bfd('0xc'),_0x7bfd('0xd'),'dialPredictiveOptimizationPercentage',_0x7bfd('0xe'),_0x7bfd('0xf'),_0x7bfd('0x10'),_0x7bfd('0x11'),_0x7bfd('0x12'),_0x7bfd('0x13'),_0x7bfd('0x14'),_0x7bfd('0x15'),_0x7bfd('0x16'),_0x7bfd('0x17'),_0x7bfd('0x18'),_0x7bfd('0x19'),'dialNoAnswerRetryFrequency',_0x7bfd('0x1a'),_0x7bfd('0x1b'),_0x7bfd('0x1c'),_0x7bfd('0x1d'),_0x7bfd('0x1e'),'dialAMDActive','dialAMDInitialSilence',_0x7bfd('0x1f'),_0x7bfd('0x20'),_0x7bfd('0x21'),_0x7bfd('0x22'),_0x7bfd('0x23'),_0x7bfd('0x24'),_0x7bfd('0x25'),_0x7bfd('0x26'),_0x7bfd('0x27'),'dialRecallMeTimeout','dialRecallInQueue',_0x7bfd('0x28'),'dialAgiAfterHangupAgent',_0x7bfd('0x29'),_0x7bfd('0x2a'),_0x7bfd('0x7'),'strategy',_0x7bfd('0x2b'),_0x7bfd('0x2c'),'dialNoSuchNumberMaxRetry',_0x7bfd('0x2d'),_0x7bfd('0x2e'),'dialDropRetryFrequency',_0x7bfd('0x2f'),_0x7bfd('0x30'),'dialMachineMaxRetry',_0x7bfd('0x31'),_0x7bfd('0x32'),_0x7bfd('0x33'),'mandatoryDisposition',_0x7bfd('0x34'),_0x7bfd('0x35')],'include':[{'model':_0x7bfd('0x36'),'as':_0x7bfd('0x36'),'attributes':['id',_0x7bfd('0x4'),_0x7bfd('0x37'),_0x7bfd('0x38')]},{'model':'Pause','as':_0x7bfd('0x39'),'attributes':['id',_0x7bfd('0x4')]},{'model':_0x7bfd('0x36'),'as':_0x7bfd('0x3a'),'attributes':['id',_0x7bfd('0x4'),_0x7bfd('0x37'),_0x7bfd('0x38')]},{'model':_0x7bfd('0x3b'),'as':_0x7bfd('0x3b'),'attributes':['id','name'],'include':[{'model':_0x7bfd('0x3b'),'as':_0x7bfd('0x3c'),'attributes':['id',_0x7bfd('0x4'),_0x7bfd('0x3d')]}]}]},'log':'getVoiceQueues'});};}; \ No newline at end of file +var _0xcc86=['monitor_format','dialMethod','dialLimitChannel','dialPowerLevel','dialPredictiveOptimization','dialPredictiveOptimizationPercentage','dialPredictiveInterval','dialOriginateCallerIdName','dialOriginateTimeout','dialQueueTimeout','dialQueueProject','dialCongestionMaxRetry','dialCongestionRetryFrequency','dialNoAnswerMaxRetry','dialGlobalMaxRetry','dialTimezone','dialAMDActive','dialAMDInitialSilence','dialAMDAfterGreetingSilence','dialAMDTotalAnalysisTime','dialAMDMinWordLength','dialAMDBetweenWordsSilence','dialAMDMaximumNumberOfWords','dialAMDMaximumWordLength','timeout','dialRecallInQueue','dialOrderByScheduledAt','dialAgiAfterHangupAgent','dialRandomLastDigitCallerIdNumber','dialNoSuchNumberMaxRetry','dialNoSuchNumberRetryFrequency','dialDropMaxRetry','dialDropRetryFrequency','dialAbandonedMaxRetry','dialAbandonedRetryFrequency','dialMachineMaxRetry','dialMachineRetryFrequency','dialAgentRejectRetryFrequency','mandatoryDisposition','dialPredictiveIntervalMaxThreshold','dialPredictiveIntervalMinThreshold','Trunk','active','TrunkBackup','callerid','Interval','Intervals','getVoiceQueues','Request','GetVoiceQueue','name','acw','acwTimeout','autopause'];(function(_0x15cb39,_0x3a7202){var _0x268209=function(_0x1b83d5){while(--_0x1b83d5){_0x15cb39['push'](_0x15cb39['shift']());}};_0x268209(++_0x3a7202);}(_0xcc86,0x1df));var _0x6cc8=function(_0x411f2c,_0x3241f7){_0x411f2c=_0x411f2c-0x0;var _0xf25fb5=_0xcc86[_0x411f2c];return _0xf25fb5;};'use strict';var client=require('../client');exports[_0x6cc8('0x0')]=function(){return function(){return client[_0x6cc8('0x1')](_0x6cc8('0x2'),{'options':{'raw':![],'attributes':['id',_0x6cc8('0x3'),_0x6cc8('0x4'),_0x6cc8('0x5'),_0x6cc8('0x6'),_0x6cc8('0x7'),'type','dialActive',_0x6cc8('0x8'),_0x6cc8('0x9'),'dialLimitQueue',_0x6cc8('0xa'),_0x6cc8('0xb'),_0x6cc8('0xc'),_0x6cc8('0xd'),_0x6cc8('0xe'),'dialOriginateCallerIdNumber',_0x6cc8('0xf'),'dialQueueOptions',_0x6cc8('0x10'),_0x6cc8('0x11'),_0x6cc8('0x12'),_0x6cc8('0x13'),'dialBusyMaxRetry','dialBusyRetryFrequency',_0x6cc8('0x14'),'dialNoAnswerRetryFrequency',_0x6cc8('0x15'),_0x6cc8('0x16'),'dialGlobalInterval','dialPrefix','dialCheckDuplicateType',_0x6cc8('0x17'),_0x6cc8('0x18'),'dialAMDGreeting',_0x6cc8('0x19'),_0x6cc8('0x1a'),_0x6cc8('0x1b'),_0x6cc8('0x1c'),_0x6cc8('0x1d'),'dialAMDSilenceThreshold',_0x6cc8('0x1e'),_0x6cc8('0x1f'),'dialRecallMeTimeout',_0x6cc8('0x20'),_0x6cc8('0x21'),_0x6cc8('0x22'),'dialAgiAfterHangupClient','dialQueueProject2','monitor_format','strategy',_0x6cc8('0x23'),'dialCutDigit',_0x6cc8('0x24'),_0x6cc8('0x25'),_0x6cc8('0x26'),_0x6cc8('0x27'),_0x6cc8('0x28'),_0x6cc8('0x29'),_0x6cc8('0x2a'),_0x6cc8('0x2b'),'dialAgentRejectMaxRetry',_0x6cc8('0x2c'),_0x6cc8('0x2d'),_0x6cc8('0x2e'),_0x6cc8('0x2f')],'include':[{'model':_0x6cc8('0x30'),'as':_0x6cc8('0x30'),'attributes':['id',_0x6cc8('0x3'),'callerid',_0x6cc8('0x31')]},{'model':'Pause','as':'mandatoryDispositionPause','attributes':['id',_0x6cc8('0x3')]},{'model':_0x6cc8('0x30'),'as':_0x6cc8('0x32'),'attributes':['id','name',_0x6cc8('0x33'),_0x6cc8('0x31')]},{'model':_0x6cc8('0x34'),'as':_0x6cc8('0x34'),'attributes':['id',_0x6cc8('0x3')],'include':[{'model':_0x6cc8('0x34'),'as':_0x6cc8('0x35'),'attributes':['id',_0x6cc8('0x3'),'interval']}]}]},'log':_0x6cc8('0x0')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceQueueReport.js b/server/services/ami/rpc/voiceQueueReport.js index 7a19325..e1c5167 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 _0xbc6f=['CreateVoiceQueueReport','getVoiceQueueReports','GetVoiceQueueReport','startOf','day','endOf','format','YYYY-MM-DD\x20HH:mm:ss','uniqueid','queue','queuecallerleaveAt','queuecallercomplete','queuecallercompleteAt','queuecallerexit','queuecallerexitAt','queuecallerabandonAt','moment','lodash','../client','create','Request'];(function(_0x3b27a5,_0x6f338e){var _0x3cb554=function(_0x1184cf){while(--_0x1184cf){_0x3b27a5['push'](_0x3b27a5['shift']());}};_0x3cb554(++_0x6f338e);}(_0xbc6f,0xf7));var _0xfbc6=function(_0x526119,_0x5c4b34){_0x526119=_0x526119-0x0;var _0x402da2=_0xbc6f[_0x526119];return _0x402da2;};'use strict';var moment=require(_0xfbc6('0x0'));var _=require(_0xfbc6('0x1'));var client=require(_0xfbc6('0x2'));exports[_0xfbc6('0x3')]=function(_0x5c8976){return client[_0xfbc6('0x4')](_0xfbc6('0x5'),{'body':_0x5c8976,'log':_0xfbc6('0x5')});};exports[_0xfbc6('0x6')]=function(){return function(){return client[_0xfbc6('0x4')](_0xfbc6('0x7'),{'options':{'where':{'createdAt':{'$between':[moment()[_0xfbc6('0x8')](_0xfbc6('0x9'))['format']('YYYY-MM-DD\x20HH:mm:ss'),moment()[_0xfbc6('0xa')](_0xfbc6('0x9'))[_0xfbc6('0xb')](_0xfbc6('0xc'))]}},'attributes':[_0xfbc6('0xd'),_0xfbc6('0xe'),'queuecallerjoinAt',_0xfbc6('0xf'),_0xfbc6('0x10'),_0xfbc6('0x11'),_0xfbc6('0x12'),_0xfbc6('0x13'),'queuecallerabandon',_0xfbc6('0x14')]},'log':'GetVoiceQueueReports'});};}; \ No newline at end of file +var _0x6d20=['startOf','format','endOf','day','YYYY-MM-DD\x20HH:mm:ss','uniqueid','queuecallerjoinAt','queuecallerleaveAt','queuecallercompleteAt','queuecallerexit','queuecallerexitAt','queuecallerabandonAt','GetVoiceQueueReports','../client','create','Request','CreateVoiceQueueReport','GetVoiceQueueReport'];(function(_0x19950b,_0x53d0d7){var _0x3c6b41=function(_0x3924ad){while(--_0x3924ad){_0x19950b['push'](_0x19950b['shift']());}};_0x3c6b41(++_0x53d0d7);}(_0x6d20,0xf7));var _0x06d2=function(_0x3b5e9f,_0x29601e){_0x3b5e9f=_0x3b5e9f-0x0;var _0x1e9a49=_0x6d20[_0x3b5e9f];return _0x1e9a49;};'use strict';var moment=require('moment');var _=require('lodash');var client=require(_0x06d2('0x0'));exports[_0x06d2('0x1')]=function(_0x395fc7){return client[_0x06d2('0x2')](_0x06d2('0x3'),{'body':_0x395fc7,'log':_0x06d2('0x3')});};exports['getVoiceQueueReports']=function(){return function(){return client['Request'](_0x06d2('0x4'),{'options':{'where':{'createdAt':{'$between':[moment()[_0x06d2('0x5')]('day')[_0x06d2('0x6')]('YYYY-MM-DD\x20HH:mm:ss'),moment()[_0x06d2('0x7')](_0x06d2('0x8'))[_0x06d2('0x6')](_0x06d2('0x9'))]}},'attributes':[_0x06d2('0xa'),'queue',_0x06d2('0xb'),_0x06d2('0xc'),'queuecallercomplete',_0x06d2('0xd'),_0x06d2('0xe'),_0x06d2('0xf'),'queuecallerabandon',_0x06d2('0x10')]},'log':_0x06d2('0x11')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceQueueRt.js b/server/services/ami/rpc/voiceQueueRt.js index 642eff4..fbd96dc 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 _0x7825=['../client','getVoiceQueueRtPauses','Request','GetVoiceQueueRtPauses'];(function(_0x1dabf0,_0xd6ec46){var _0x197431=function(_0x5f3291){while(--_0x5f3291){_0x1dabf0['push'](_0x1dabf0['shift']());}};_0x197431(++_0xd6ec46);}(_0x7825,0x78));var _0x5782=function(_0x1cd285,_0x99f96f){_0x1cd285=_0x1cd285-0x0;var _0x19cd3d=_0x7825[_0x1cd285];return _0x19cd3d;};'use strict';var client=require(_0x5782('0x0'));exports[_0x5782('0x1')]=function(_0x3b2954){return function(){return client[_0x5782('0x2')](_0x5782('0x3'),{'options':{'where':{'VoiceQueueId':_0x3b2954,'paused':!![]},'raw':!![]},'log':'getVoiceQueueRtPauses'});};}; \ No newline at end of file +var _0x41fb=['getVoiceQueueRtPauses','Request','GetVoiceQueueRtPauses','../client'];(function(_0x29855e,_0x30f618){var _0x33feeb=function(_0xc1070e){while(--_0xc1070e){_0x29855e['push'](_0x29855e['shift']());}};_0x33feeb(++_0x30f618);}(_0x41fb,0x1e3));var _0xb41f=function(_0x4ab8ef,_0x47a1c0){_0x4ab8ef=_0x4ab8ef-0x0;var _0xcd12cb=_0x41fb[_0x4ab8ef];return _0xcd12cb;};'use strict';var client=require(_0xb41f('0x0'));exports[_0xb41f('0x1')]=function(_0x17dab3){return function(){return client[_0xb41f('0x2')](_0xb41f('0x3'),{'options':{'where':{'VoiceQueueId':_0x17dab3,'paused':!![]},'raw':!![]},'log':_0xb41f('0x1')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceRecording.js b/server/services/ami/rpc/voiceRecording.js index 05e7de5..a170f3a 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 _0xbd9c=['Request','CreateVoiceRecording','merge','monitorFilename','lodash','create'];(function(_0x24d14b,_0x2b579f){var _0x33e5d3=function(_0x2d5b37){while(--_0x2d5b37){_0x24d14b['push'](_0x24d14b['shift']());}};_0x33e5d3(++_0x2b579f);}(_0xbd9c,0x166));var _0xcbd9=function(_0x2ff739,_0x1c8e0f){_0x2ff739=_0x2ff739-0x0;var _0x12dc13=_0xbd9c[_0x2ff739];return _0x12dc13;};'use strict';var _=require(_0xcbd9('0x0'));var client=require('../client');exports[_0xcbd9('0x1')]=function(_0x1ea1e3){return client[_0xcbd9('0x2')](_0xcbd9('0x3'),{'body':_[_0xcbd9('0x4')](_0x1ea1e3,{'value':_0x1ea1e3[_0xcbd9('0x5')]}),'log':_0xcbd9('0x3')});}; \ No newline at end of file +var _0xc3a3=['CreateVoiceRecording','lodash','create','Request','merge','monitorFilename'];(function(_0x5a6781,_0x149a2e){var _0x19a904=function(_0x139371){while(--_0x139371){_0x5a6781['push'](_0x5a6781['shift']());}};_0x19a904(++_0x149a2e);}(_0xc3a3,0x1ed));var _0x3c3a=function(_0x3be885,_0xc8dbc6){_0x3be885=_0x3be885-0x0;var _0x3b8e1f=_0xc3a3[_0x3be885];return _0x3b8e1f;};'use strict';var _=require(_0x3c3a('0x0'));var client=require('../client');exports[_0x3c3a('0x1')]=function(_0x5bb880){return client[_0x3c3a('0x2')]('CreateVoiceRecording',{'body':_[_0x3c3a('0x3')](_0x5bb880,{'value':_0x5bb880[_0x3c3a('0x4')]}),'log':_0x3c3a('0x5')});}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceTransferReport.js b/server/services/ami/rpc/voiceTransferReport.js index c1cb269..091d01a 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 _0x049d=['Request','origtransferercalleridnum','origtransferercalleridname','secondtransfererconnectedlinenum','secondtransfererconnectedlinename','origtransfereraccountcode','secondtransfererexten','origtransfererlinkedid','transfertargetchannel','transfertargetcalleridnum','transfertargetcalleridname','transfertargetconnectedlinenum','transfertargetaccountcode','transfertargetcontext','origtransfererexten','../client','blindTransfer','CreateVoiceTransferReport','result','transfererchannel','transferercalleridnum','transfererconnectedlinenum','transfererconnectedlinename','transfereraccountcode','transferercontext','transfererlinkedid','transfereechannel','transfereecalleridnum','transfereecalleridname','transfereeconnectedlinenum','transfereeexten','isexternal','context','extension','blind','attendedTransfer'];(function(_0x5ddb1c,_0x5ea4df){var _0x354adc=function(_0x2dfb1f){while(--_0x2dfb1f){_0x5ddb1c['push'](_0x5ddb1c['shift']());}};_0x354adc(++_0x5ea4df);}(_0x049d,0x153));var _0xd049=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x049d[_0x321bb2];return _0x9c12ed;};'use strict';var client=require(_0xd049('0x0'));exports[_0xd049('0x1')]=function(_0x198e5f){return client['Request'](_0xd049('0x2'),{'body':{'result':_0x198e5f[_0xd049('0x3')],'transfererchannel':_0x198e5f[_0xd049('0x4')],'transferercalleridnum':_0x198e5f[_0xd049('0x5')],'transferercalleridname':_0x198e5f['transferercalleridname'],'transfererconnectedlinenum':_0x198e5f[_0xd049('0x6')],'transfererconnectedlinename':_0x198e5f[_0xd049('0x7')],'transfereraccountcode':_0x198e5f[_0xd049('0x8')],'transferercontext':_0x198e5f[_0xd049('0x9')],'transfererexten':_0x198e5f['transfererexten'],'transfererlinkedid':_0x198e5f[_0xd049('0xa')],'transfereechannel':_0x198e5f[_0xd049('0xb')],'transfereecalleridnum':_0x198e5f[_0xd049('0xc')],'transfereecalleridname':_0x198e5f[_0xd049('0xd')],'transfereeconnectedlinenum':_0x198e5f[_0xd049('0xe')],'transfereeconnectedlinename':_0x198e5f['transfereeconnectedlinename'],'transfereeaccountcode':_0x198e5f['transfereeaccountcode'],'transfereecontext':_0x198e5f['transfereecontext'],'transfereeexten':_0x198e5f[_0xd049('0xf')],'transfereelinkedid':_0x198e5f['transfereelinkedid'],'isexternal':_0x198e5f[_0xd049('0x10')],'context':_0x198e5f[_0xd049('0x11')],'extension':_0x198e5f[_0xd049('0x12')],'type':_0xd049('0x13')},'log':_0xd049('0x2')});};exports[_0xd049('0x14')]=function(_0x4e6227){return client[_0xd049('0x15')]('CreateVoiceTransferReport',{'body':{'result':_0x4e6227[_0xd049('0x3')],'transfererchannel':_0x4e6227['origtransfererchannel'],'transferercalleridnum':_0x4e6227[_0xd049('0x16')],'transferercalleridname':_0x4e6227[_0xd049('0x17')],'transfererconnectedlinenum':_0x4e6227[_0xd049('0x18')],'transfererconnectedlinename':_0x4e6227[_0xd049('0x19')],'transfereraccountcode':_0x4e6227[_0xd049('0x1a')],'transferercontext':_0x4e6227['secondtransferercontext'],'transfererexten':_0x4e6227[_0xd049('0x1b')],'transfererlinkedid':_0x4e6227[_0xd049('0x1c')],'transfereechannel':_0x4e6227[_0xd049('0x1d')],'transfereecalleridnum':_0x4e6227[_0xd049('0x1e')],'transfereecalleridname':_0x4e6227[_0xd049('0x1f')],'transfereeconnectedlinenum':_0x4e6227[_0xd049('0x20')],'transfereeconnectedlinename':_0x4e6227['transfertargetconnectedlinename'],'transfereeaccountcode':_0x4e6227[_0xd049('0x21')],'transfereecontext':_0x4e6227[_0xd049('0x22')],'transfereeexten':_0x4e6227['transfertargetexten'],'transfereelinkedid':_0x4e6227['transfertargetlinkedid'],'isexternal':_0x4e6227[_0xd049('0x10')],'context':_0x4e6227['origtransferercontext'],'extension':_0x4e6227[_0xd049('0x23')],'type':'attended'},'log':_0xd049('0x2')});}; \ No newline at end of file +var _0x5825=['transfertargetcalleridname','transfertargetconnectedlinenum','transfertargetconnectedlinename','transfertargetcontext','transfertargetexten','transfertargetlinkedid','origtransferercontext','attended','../client','blindTransfer','Request','CreateVoiceTransferReport','transfererchannel','transferercalleridnum','transfererconnectedlinenum','transfererconnectedlinename','transfereraccountcode','transferercontext','transfererlinkedid','transfereechannel','transfereecalleridnum','transfereecalleridname','transfereeconnectedlinenum','transfereeaccountcode','transfereecontext','transfereelinkedid','isexternal','context','extension','blind','origtransfererchannel','origtransferercalleridname','secondtransfererconnectedlinenum','secondtransfererconnectedlinename','origtransfereraccountcode','secondtransferercontext','secondtransfererexten','origtransfererlinkedid','transfertargetchannel','transfertargetcalleridnum'];(function(_0x3550e8,_0x424fea){var _0x18eb61=function(_0x2dcb49){while(--_0x2dcb49){_0x3550e8['push'](_0x3550e8['shift']());}};_0x18eb61(++_0x424fea);}(_0x5825,0x80));var _0x5582=function(_0x19950b,_0x53d0d7){_0x19950b=_0x19950b-0x0;var _0x3c6b41=_0x5825[_0x19950b];return _0x3c6b41;};'use strict';var client=require(_0x5582('0x0'));exports[_0x5582('0x1')]=function(_0x524f1a){return client[_0x5582('0x2')](_0x5582('0x3'),{'body':{'result':_0x524f1a['result'],'transfererchannel':_0x524f1a[_0x5582('0x4')],'transferercalleridnum':_0x524f1a[_0x5582('0x5')],'transferercalleridname':_0x524f1a['transferercalleridname'],'transfererconnectedlinenum':_0x524f1a[_0x5582('0x6')],'transfererconnectedlinename':_0x524f1a[_0x5582('0x7')],'transfereraccountcode':_0x524f1a[_0x5582('0x8')],'transferercontext':_0x524f1a[_0x5582('0x9')],'transfererexten':_0x524f1a['transfererexten'],'transfererlinkedid':_0x524f1a[_0x5582('0xa')],'transfereechannel':_0x524f1a[_0x5582('0xb')],'transfereecalleridnum':_0x524f1a[_0x5582('0xc')],'transfereecalleridname':_0x524f1a[_0x5582('0xd')],'transfereeconnectedlinenum':_0x524f1a[_0x5582('0xe')],'transfereeconnectedlinename':_0x524f1a['transfereeconnectedlinename'],'transfereeaccountcode':_0x524f1a[_0x5582('0xf')],'transfereecontext':_0x524f1a[_0x5582('0x10')],'transfereeexten':_0x524f1a['transfereeexten'],'transfereelinkedid':_0x524f1a[_0x5582('0x11')],'isexternal':_0x524f1a[_0x5582('0x12')],'context':_0x524f1a[_0x5582('0x13')],'extension':_0x524f1a[_0x5582('0x14')],'type':_0x5582('0x15')},'log':_0x5582('0x3')});};exports['attendedTransfer']=function(_0x361df5){return client['Request'](_0x5582('0x3'),{'body':{'result':_0x361df5['result'],'transfererchannel':_0x361df5[_0x5582('0x16')],'transferercalleridnum':_0x361df5['origtransferercalleridnum'],'transferercalleridname':_0x361df5[_0x5582('0x17')],'transfererconnectedlinenum':_0x361df5[_0x5582('0x18')],'transfererconnectedlinename':_0x361df5[_0x5582('0x19')],'transfereraccountcode':_0x361df5[_0x5582('0x1a')],'transferercontext':_0x361df5[_0x5582('0x1b')],'transfererexten':_0x361df5[_0x5582('0x1c')],'transfererlinkedid':_0x361df5[_0x5582('0x1d')],'transfereechannel':_0x361df5[_0x5582('0x1e')],'transfereecalleridnum':_0x361df5[_0x5582('0x1f')],'transfereecalleridname':_0x361df5[_0x5582('0x20')],'transfereeconnectedlinenum':_0x361df5[_0x5582('0x21')],'transfereeconnectedlinename':_0x361df5[_0x5582('0x22')],'transfereeaccountcode':_0x361df5['transfertargetaccountcode'],'transfereecontext':_0x361df5[_0x5582('0x23')],'transfereeexten':_0x361df5[_0x5582('0x24')],'transfereelinkedid':_0x361df5[_0x5582('0x25')],'isexternal':_0x361df5[_0x5582('0x12')],'context':_0x361df5[_0x5582('0x26')],'extension':_0x361df5['origtransfererexten'],'type':_0x5582('0x27')},'log':_0x5582('0x3')});}; \ No newline at end of file diff --git a/server/services/ami/server/index.js b/server/services/ami/server/index.js index c526a97..65e3aef 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 _0xbce8=['originated','erlangCalls','erlangCallToSecond','erlangAbandonmentRate','erlangBusyFactor','startPredictive','startProgressive','Trunk','active','Interval','push','length','values','channels','map','find','uniqueid','channel','filename','wav','MixMonitor','monitors','/var/spool/asterisk/monitor/','toLowerCase','isNil','YYYY-MM-DD\x20HH:mm:ss','mixmonitorid','rec','status','Channel\x20doesn\x27t\x20exist','voicechannel','resolve','then','StopMixMonitor','destinationchannel','stop','%s.%s','StopMixMonitor\x20Success','voicequeuechannelhangup','queueChannels','Redirect','exten','context','telephones','trunks','outboundChannels','campaigns','run','Event\x20name\x20mandatory','emit','custom:','faxAccounts','server','http','127.0.0.1','log','AMI\x20RPC\x20server\x20listening\x20on\x20127.0.0.1:%d!','util','validate','bluebird','moment','../../../config/environment','../ami','listen','format','%s/%s','SIP','name','timers','agents','updateStatusRealtime','pause','QueuePause','error','asterisk','username','ami\x20disconnected','join','pick','keys','action','Reload','Action','message','isConnected','command','catch','voiceQueues','hasOwnProperty','strategy','answered','available','loggedIn','pTalking','sumBillable','sumDuration','talking','total','unmanaged','abandoned','type','outbound','dialMethod','dialOriginateCallerIdName','dialOriginateCallerIdNumber','dialOriginateTimeout','dialPrefix','outboundAnswerAgiCallsDay','outboundAnswerCallsDay','outboundBlacklistCallsDay','outboundBusyCallsDay','outboundCongestionCallsDay','outboundDropCallsDayCallersExit','outboundDropCallsDayTimeout','outboundNoAnswerCallsDay','outboundNoSuchCallsDay','outboundOriginateFailureCallsDay','outboundReCallsDay','outboundRejectCallsDay','outboundUnknownCallsDay','predictiveIntervalAnsweredCalls','predictiveIntervalAvgHoldtime','predictiveIntervalAvgTalktime','predictiveIntervalDroppedCallsCallersExit','predictiveIntervalDroppedCallsTimeout','predictiveIntervalErlangCalls','predictiveIntervalErlangCallsDroppedCalls','predictiveIntervalMultiplicativeFactor','predictiveIntervalPauses','predictiveIntervalAvailable','predictiveIntervalTotalCalls'];(function(_0x1d8f23,_0x1d4573){var _0x9499d7=function(_0x32af9b){while(--_0x32af9b){_0x1d8f23['push'](_0x1d8f23['shift']());}};_0x9499d7(++_0x1d4573);}(_0xbce8,0xbc));var _0x8bce=function(_0x596f6e,_0x3f8857){_0x596f6e=_0x596f6e-0x0;var _0x1e0803=_0xbce8[_0x596f6e];return _0x1e0803;};'use strict';var _=require('lodash');var util=require(_0x8bce('0x0'));var jayson=require('jayson/promise');var schema=require(_0x8bce('0x1'));var BPromise=require(_0x8bce('0x2'));var moment=require(_0x8bce('0x3'));var config=require(_0x8bce('0x4'));var properties=require('../properties');var ami=require(_0x8bce('0x5'));exports[_0x8bce('0x6')]=function(_0x123cc7,_0x27a69e,_0x347480){return new BPromise(function(_0xa5a69c,_0x37d91d){var _0xcf07e={'QueuePause':function(_0x55251a){return new Promise(function(_0x47a144,_0x3642e8){var _0x3559ac=util[_0x8bce('0x7')](_0x8bce('0x8'),_0x8bce('0x9'),_0x55251a[_0x8bce('0xa')]);if(_0x123cc7[_0x8bce('0xb')]&&_0x123cc7['timers'][_0x3559ac]&&_0x123cc7[_0x8bce('0xb')][_0x3559ac]['timer']){_0x123cc7['timers'][_0x3559ac]['updateAcw']();}if(_0x123cc7['agents'][_0x3559ac]){_0x123cc7[_0x8bce('0xc')][_0x3559ac][_0x8bce('0xd')]({'statePause':_0x55251a[_0x8bce('0xe')]?!![]:![]});}_0x47a144({'code':0xc8,'message':_0x8bce('0xf')});});},'Reload':function(_0x121767){var _0x38879f=this;return new Promise(function(_0x4bb5cd,_0x1015c4){if(ami['isConnected']()==![]){return _0x1015c4(_0x38879f[_0x8bce('0x10')](0x1f4,[config[_0x8bce('0x11')]['ip'],config[_0x8bce('0x11')][_0x8bce('0x12')],_0x8bce('0x13')][_0x8bce('0x14')]('\x20')));}_0x121767=_[_0x8bce('0x15')](_0x121767,_[_0x8bce('0x16')](properties['module']));_0x121767[_0x8bce('0x17')]=_0x8bce('0x18');return ami[_0x8bce('0x19')](_0x121767)['then'](function(_0x2e4b4e){_0x4bb5cd({'code':0xc8,'message':_0x2e4b4e['message']});})['catch'](function(_0x50a159){_0x1015c4(_0x38879f[_0x8bce('0x10')](0x1f5,_0x50a159[_0x8bce('0x1a')]));});});},'Command':function(_0x3740fa){var _0x2960fe=this;return new Promise(function(_0x5d2cd8,_0x4dbd34){if(ami[_0x8bce('0x1b')]()==![]){return _0x4dbd34(_0x2960fe[_0x8bce('0x10')](0x1f4,[config[_0x8bce('0x11')]['ip'],config['asterisk'][_0x8bce('0x12')],_0x8bce('0x13')][_0x8bce('0x14')]('\x20')));}_0x3740fa=_[_0x8bce('0x15')](_0x3740fa,_0x8bce('0x1c'));_0x3740fa[_0x8bce('0x17')]='Command';return ami['Action'](_0x3740fa)['then'](function(_0x4dae68){_0x5d2cd8({'code':0xc8,'message':_0x4dae68['content']});})[_0x8bce('0x1d')](function(_0x38c15c){_0x4dbd34(_0x2960fe['error'](0x1f5,_0x38c15c['message']));});});},'VoiceQueues':function(_0x133f95){return new Promise(function(_0x52e338,_0x5f14b6){var _0x488e79=[];for(var _0x4e6d61 in _0x123cc7[_0x8bce('0x1e')]){if(_0x123cc7[_0x8bce('0x1e')][_0x8bce('0x1f')](_0x4e6d61)){var _0x25ea26=_0x123cc7[_0x8bce('0x1e')][_0x4e6d61];var _0x286de0={'id':_0x25ea26['id'],'name':_0x25ea26[_0x8bce('0xa')],'strategy':_0x25ea26[_0x8bce('0x20')],'answered':_0x25ea26[_0x8bce('0x21')],'available':_0x25ea26[_0x8bce('0x22')],'loggedIn':_0x25ea26[_0x8bce('0x23')],'pTalking':_0x25ea26[_0x8bce('0x24')],'sumBillable':_0x25ea26[_0x8bce('0x25')],'sumDuration':_0x25ea26[_0x8bce('0x26')],'sumHoldTime':_0x25ea26['sumHoldTime']||0x0,'talking':_0x25ea26[_0x8bce('0x27')],'total':_0x25ea26[_0x8bce('0x28')],'type':_0x25ea26['type'],'unmanaged':_0x25ea26[_0x8bce('0x29')],'abandoned':_0x25ea26[_0x8bce('0x2a')],'waiting':_0x25ea26['waiting'],'loggedInDb':_0x25ea26['loggedInDb']};if(_0x25ea26[_0x8bce('0x2b')]===_0x8bce('0x2c')){_0x286de0['dialActive']=_0x25ea26['dialActive'];_0x286de0[_0x8bce('0x2d')]=_0x25ea26[_0x8bce('0x2d')];_0x286de0[_0x8bce('0x2e')]=_0x25ea26[_0x8bce('0x2e')];_0x286de0[_0x8bce('0x2f')]=_0x25ea26[_0x8bce('0x2f')];_0x286de0[_0x8bce('0x30')]=_0x25ea26[_0x8bce('0x30')];_0x286de0['dialPrefix']=_0x25ea26[_0x8bce('0x31')];_0x286de0[_0x8bce('0x32')]=_0x25ea26[_0x8bce('0x32')];_0x286de0['outboundAnswerCallsDay']=_0x25ea26[_0x8bce('0x33')];_0x286de0['outboundBlacklistCallsDay']=_0x25ea26[_0x8bce('0x34')];_0x286de0[_0x8bce('0x35')]=_0x25ea26[_0x8bce('0x35')];_0x286de0[_0x8bce('0x36')]=_0x25ea26[_0x8bce('0x36')];_0x286de0['outboundDropCallsDayACS']=_0x25ea26['outboundDropCallsDayACS'];_0x286de0[_0x8bce('0x37')]=_0x25ea26[_0x8bce('0x37')];_0x286de0[_0x8bce('0x38')]=_0x25ea26[_0x8bce('0x38')];_0x286de0[_0x8bce('0x39')]=_0x25ea26[_0x8bce('0x39')];_0x286de0[_0x8bce('0x3a')]=_0x25ea26[_0x8bce('0x3a')];_0x286de0[_0x8bce('0x3b')]=_0x25ea26[_0x8bce('0x3b')];_0x286de0[_0x8bce('0x3c')]=_0x25ea26[_0x8bce('0x3c')];_0x286de0['outboundRejectCallsDay']=_0x25ea26[_0x8bce('0x3d')];_0x286de0[_0x8bce('0x3e')]=_0x25ea26['outboundUnknownCallsDay'];_0x286de0[_0x8bce('0x3f')]=_0x25ea26[_0x8bce('0x3f')];_0x286de0[_0x8bce('0x40')]=_0x25ea26[_0x8bce('0x40')];_0x286de0[_0x8bce('0x41')]=_0x25ea26[_0x8bce('0x41')];_0x286de0[_0x8bce('0x42')]=_0x25ea26[_0x8bce('0x42')];_0x286de0['predictiveIntervalDroppedCallsTimeout']=_0x25ea26[_0x8bce('0x43')];_0x286de0['predictiveIntervalErlangCalls']=_0x25ea26[_0x8bce('0x44')];_0x286de0[_0x8bce('0x45')]=_0x25ea26[_0x8bce('0x45')];_0x286de0['predictiveIntervalHitRate']=_0x25ea26['predictiveIntervalHitRate'];_0x286de0['predictiveIntervalMultiplicativeFactor']=_0x25ea26[_0x8bce('0x46')];_0x286de0[_0x8bce('0x47')]=_0x25ea26[_0x8bce('0x47')];_0x286de0['predictiveIntervalAvailable']=_0x25ea26[_0x8bce('0x48')];_0x286de0[_0x8bce('0x49')]=_0x25ea26['predictiveIntervalTotalCalls'];_0x286de0[_0x8bce('0x1a')]=_0x25ea26['message'];_0x286de0[_0x8bce('0x4a')]=_0x25ea26['originated'];_0x286de0[_0x8bce('0x4b')]=_0x25ea26[_0x8bce('0x4b')];_0x286de0[_0x8bce('0x4c')]=_0x25ea26[_0x8bce('0x4c')];_0x286de0[_0x8bce('0x4d')]=_0x25ea26[_0x8bce('0x4d')];_0x286de0['erlangBusyFactor']=_0x25ea26[_0x8bce('0x4e')];_0x286de0[_0x8bce('0x4f')]=_0x25ea26['startPredictive'];_0x286de0[_0x8bce('0x50')]=_0x25ea26[_0x8bce('0x50')];}if(_0x25ea26[_0x8bce('0x51')]){_0x286de0[_0x8bce('0x51')]={'id':_0x25ea26[_0x8bce('0x51')]['id'],'name':_0x25ea26[_0x8bce('0x51')][_0x8bce('0xa')],'active':_0x25ea26['Trunk'][_0x8bce('0x52')],'callerid':_0x25ea26['Trunk']['callerid']};}if(_0x25ea26['Interval']){_0x286de0[_0x8bce('0x53')]={'id':_0x25ea26[_0x8bce('0x53')]['id'],'name':_0x25ea26['Interval']['name']};}_0x488e79[_0x8bce('0x54')](_0x286de0);}}_0x52e338({'count':_0x488e79[_0x8bce('0x55')],'rows':_0x488e79});});},'VoiceChannels':function(_0x27d775){return new Promise(function(_0x222232,_0x54b985){var _0x42f764=_[_0x8bce('0x56')](_0x123cc7[_0x8bce('0x57')]);_0x222232({'count':_0x42f764['length'],'rows':_0x42f764});});},'VoiceChannelMixMonitor':function(_0x5d1896){var _0x365ac9=this;return new Promise(function(_0x4009ff,_0x2aeb6c){if(ami['isConnected']()==![]){return _0x2aeb6c(_0x365ac9[_0x8bce('0x10')](0x1f4,[config['asterisk']['ip'],config[_0x8bce('0x11')][_0x8bce('0x12')],'ami\x20disconnected'][_0x8bce('0x14')]('\x20')));}var _0x4df480=schema(properties['voicechannel'])[_0x8bce('0x1')](_0x5d1896);if(_0x4df480['length']>0x0){return _0x2aeb6c(_0x365ac9[_0x8bce('0x10')](0x1f4,_[_0x8bce('0x58')](_0x4df480,_0x8bce('0x1a'))['join'](',\x20')));}var _0x397f62=_[_0x8bce('0x59')](_0x123cc7[_0x8bce('0x57')],{'uniqueid':_0x5d1896[_0x8bce('0x5a')]});if(_0x397f62&&_0x397f62[_0x8bce('0x5b')]){var _0x18dc2a=util[_0x8bce('0x7')]('%s.%s',_0x5d1896[_0x8bce('0x5c')]||_0x5d1896['uniqueid'],_0x5d1896[_0x8bce('0x7')]||_0x8bce('0x5d'));return ami[_0x8bce('0x19')]({'action':_0x8bce('0x5e'),'channel':_0x397f62[_0x8bce('0x5b')],'file':_0x18dc2a,'options':'ai(mixmonitorid)'})['then'](function(_0x3a11cb){var _0x3f3dc1=_[_0x8bce('0x59')](_0x397f62[_0x8bce('0x5f')],{'filename':_0x8bce('0x60')+_0x18dc2a[_0x8bce('0x61')]()});if(_[_0x8bce('0x62')](_0x3f3dc1)){_0x397f62[_0x8bce('0x5f')]['push']({'filename':_0x8bce('0x60')+_0x18dc2a['toLowerCase'](),'createdAt':moment()['format'](_0x8bce('0x63')),'mixmonitorid':_0x3a11cb[_0x8bce('0x64')],'status':_0x8bce('0x65')});}else{_0x3f3dc1[_0x8bce('0x64')]=_0x3a11cb[_0x8bce('0x64')];_0x3f3dc1[_0x8bce('0x66')]=_0x8bce('0x65');}_0x4009ff({'code':0xc8,'message':[_0x5d1896['uniqueid'],'MixMonitor\x20Success',_0x3a11cb[_0x8bce('0x64')]][_0x8bce('0x14')]('\x20'),'mixmonitorid':_0x3a11cb['mixmonitorid']});})[_0x8bce('0x1d')](function(_0x4de28e){_0x2aeb6c(_0x365ac9[_0x8bce('0x10')](0x1f5,[_0x5d1896[_0x8bce('0x5a')],_0x4de28e[_0x8bce('0x1a')][_0x8bce('0x61')]()]['join']('\x20')));});}else{return _0x2aeb6c(_0x365ac9[_0x8bce('0x10')](0x1f5,_0x8bce('0x67')));}});},'VoiceChannelStopMixMonitor':function(_0x3b6242){var _0x494fa6=this;return new Promise(function(_0x39fb85,_0x33957c){if(ami[_0x8bce('0x1b')]()==![]){return _0x33957c(_0x494fa6[_0x8bce('0x10')](0x1f4,[config[_0x8bce('0x11')]['ip'],config[_0x8bce('0x11')]['username'],_0x8bce('0x13')][_0x8bce('0x14')]('\x20')));}var _0x6853ae=schema(properties[_0x8bce('0x68')])[_0x8bce('0x1')](_0x3b6242);if(_0x6853ae[_0x8bce('0x55')]>0x0){return _0x33957c(_0x494fa6[_0x8bce('0x10')](0x1f4,_[_0x8bce('0x58')](_0x6853ae,_0x8bce('0x1a'))['join'](',\x20')));}var _0x48c94b=_[_0x8bce('0x59')](_0x123cc7['channels'],{'uniqueid':_0x3b6242[_0x8bce('0x5a')]});if(_0x48c94b){return BPromise[_0x8bce('0x69')]()[_0x8bce('0x6a')](function(){if(_0x48c94b[_0x8bce('0x5b')]){return ami[_0x8bce('0x19')]({'action':_0x8bce('0x6b'),'channel':_0x48c94b[_0x8bce('0x5b')],'mixmonitorid':_0x3b6242[_0x8bce('0x64')]})[_0x8bce('0x1d')](function(_0x1a44c5){});}})[_0x8bce('0x6a')](function(){if(_0x48c94b[_0x8bce('0x6c')]){return ami['Action']({'action':_0x8bce('0x6b'),'channel':_0x48c94b[_0x8bce('0x6c')],'mixmonitorid':_0x3b6242['mixmonitorid']})[_0x8bce('0x1d')](function(_0x3f972e){});}})[_0x8bce('0x6a')](function(_0x560e4e){var _0x506eeb=_[_0x8bce('0x59')](_0x48c94b[_0x8bce('0x5f')],{'mixmonitorid':_0x3b6242['mixmonitorid']});if(_0x506eeb){_0x506eeb[_0x8bce('0x66')]=_0x8bce('0x6d');}})[_0x8bce('0x6a')](function(){var _0x51b172=util[_0x8bce('0x7')](_0x8bce('0x6e'),_0x3b6242[_0x8bce('0x5c')]||_0x3b6242['uniqueid'],_0x3b6242[_0x8bce('0x7')]||'wav');var _0x3f1246=_[_0x8bce('0x59')](_0x48c94b[_0x8bce('0x5f')],{'filename':_0x8bce('0x60')+_0x51b172['toLowerCase']()});if(_0x3f1246){_0x3f1246['status']='stop';}})[_0x8bce('0x6a')](function(){_0x39fb85({'code':0xc8,'message':[_0x3b6242[_0x8bce('0x5a')],_0x8bce('0x6f')]['join']('\x20')});})[_0x8bce('0x1d')](function(_0x40a11b){_0x33957c(_0x494fa6[_0x8bce('0x10')](0x1f5,[_0x3b6242['uniqueid'],_0x40a11b[_0x8bce('0x1a')]['toLowerCase']()]['join']('\x20')));});}else{return _0x33957c(_0x494fa6[_0x8bce('0x10')](0x1f5,'Channel\x20doesn\x27t\x20exist'));}});},'VoiceQueuesChannels':function(_0x1826e5){return new Promise(function(_0x125afa,_0x37dc9b){var _0x500e72=_[_0x8bce('0x56')](_0x123cc7['queueChannels']);_0x125afa({'count':_0x500e72[_0x8bce('0x55')],'rows':_0x500e72});});},'VoiceQueuesChannel':function(_0x4b5143){var _0xdf3812=this;return new Promise(function(_0x5f9f3a,_0x281e8f){var _0x5c893a=schema(properties['voicequeuechannel'])['validate'](_0x4b5143);if(_0x5c893a[_0x8bce('0x55')]>0x0){return _0x281e8f(_0xdf3812[_0x8bce('0x10')](0x1f4,_[_0x8bce('0x58')](_0x5c893a,_0x8bce('0x1a'))[_0x8bce('0x14')](',\x20')));}var _0x3f103e=_['find'](_0x123cc7['queueChannels'],{'uniqueid':_0x4b5143[_0x8bce('0x5a')]});if(_0x3f103e){_0x5f9f3a(_0x3f103e);}else{return _0x281e8f(_0xdf3812['error'](0x1f5,_0x8bce('0x67')));}});},'VoiceQueuesChannelHangup':function(_0x5db634){var _0x43f551=this;return new Promise(function(_0x5204a0,_0x3a241e){if(ami[_0x8bce('0x1b')]()==![]){return _0x3a241e(_0x43f551[_0x8bce('0x10')](0x1f4,[config[_0x8bce('0x11')]['ip'],config['asterisk'][_0x8bce('0x12')],_0x8bce('0x13')]['join']('\x20')));}var _0x41a8e2=schema(properties[_0x8bce('0x70')])[_0x8bce('0x1')](_0x5db634);if(_0x41a8e2[_0x8bce('0x55')]>0x0){return _0x3a241e(_0x43f551['error'](0x1f4,_['map'](_0x41a8e2,'message')[_0x8bce('0x14')](',\x20')));}var _0x5033e0=_[_0x8bce('0x59')](_0x123cc7[_0x8bce('0x71')],{'uniqueid':_0x5db634[_0x8bce('0x5a')]});if(_0x5033e0&&_0x5033e0[_0x8bce('0x5b')]){return ami['Action']({'action':'Hangup','channel':_0x5033e0['channel']})[_0x8bce('0x6a')](function(_0xc99dbc){_0x5204a0({'code':0xc8,'message':[_0x5db634[_0x8bce('0x5a')],_0xc99dbc['message'][_0x8bce('0x61')]()][_0x8bce('0x14')]('\x20')});})['catch'](function(_0x9e2023){_0x3a241e(_0x43f551['error'](0x1f5,[_0x5db634[_0x8bce('0x5a')],_0x9e2023[_0x8bce('0x1a')][_0x8bce('0x61')]()]['join']('\x20')));});}else{return _0x3a241e(_0x43f551['error'](0x1f5,_0x8bce('0x67')));}});},'VoiceQueuesChannelRedirect':function(_0x58d2a6){var _0x150c7e=this;return new Promise(function(_0x3f4db7,_0x57ef28){if(ami[_0x8bce('0x1b')]()==![]){return _0x57ef28(_0x150c7e[_0x8bce('0x10')](0x1f4,[config[_0x8bce('0x11')]['ip'],config[_0x8bce('0x11')]['username'],_0x8bce('0x13')][_0x8bce('0x14')]('\x20')));}var _0x22d76a=schema(properties['voicequeuechannelredirect'])[_0x8bce('0x1')](_0x58d2a6);if(_0x22d76a['length']>0x0){return _0x57ef28(_0x150c7e[_0x8bce('0x10')](0x1f4,_[_0x8bce('0x58')](_0x22d76a,_0x8bce('0x1a'))[_0x8bce('0x14')](',\x20')));}var _0x362d4d=_[_0x8bce('0x59')](_0x123cc7[_0x8bce('0x71')],{'uniqueid':_0x58d2a6[_0x8bce('0x5a')]});if(_0x362d4d&&_0x362d4d[_0x8bce('0x5b')]){return ami[_0x8bce('0x19')]({'action':_0x8bce('0x72'),'channel':_0x362d4d[_0x8bce('0x5b')],'exten':_0x58d2a6[_0x8bce('0x73')],'context':_0x58d2a6[_0x8bce('0x74')]||_0x362d4d[_0x8bce('0x74')],'priority':0x1})[_0x8bce('0x6a')](function(_0x528bd3){_0x3f4db7({'code':0xc8,'message':[_0x58d2a6[_0x8bce('0x5a')],_0x528bd3[_0x8bce('0x1a')]['toLowerCase']()][_0x8bce('0x14')]('\x20')});})['catch'](function(_0x26475f){_0x57ef28(_0x150c7e[_0x8bce('0x10')](0x1f5,[_0x58d2a6[_0x8bce('0x5a')],_0x26475f[_0x8bce('0x1a')][_0x8bce('0x61')]()][_0x8bce('0x14')]('\x20')));});}else{return _0x57ef28(_0x150c7e[_0x8bce('0x10')](0x1f5,'Channel\x20doesn\x27t\x20exist'));}});},'Agents':function(_0x2d28e6){return new Promise(function(_0x405331,_0x127f3d){var _0x42687c=_[_0x8bce('0x56')](_0x123cc7[_0x8bce('0xc')]);_0x405331({'count':_0x42687c[_0x8bce('0x55')],'rows':_0x42687c});});},'Telephones':function(_0x1b616f){return new Promise(function(_0x1a09a6,_0x238d04){var _0x1909d1=_[_0x8bce('0x56')](_0x123cc7[_0x8bce('0x75')]);_0x1a09a6({'count':_0x1909d1[_0x8bce('0x55')],'rows':_0x1909d1});});},'Trunks':function(_0x57dead){return new Promise(function(_0xfd91c3,_0x155017){var _0x415e7c=_[_0x8bce('0x56')](_0x123cc7[_0x8bce('0x76')]);_0xfd91c3({'count':_0x415e7c[_0x8bce('0x55')],'rows':_0x415e7c});});},'OutboundChannels':function(_0x4446c7){return new Promise(function(_0x28f2f0,_0x3180ce){var _0x41b837=_[_0x8bce('0x56')](_0x123cc7[_0x8bce('0x77')]);_0x28f2f0({'count':_0x41b837['length'],'rows':_0x41b837});});},'Outbound':function(_0x3cd0b1){return new Promise(function(_0x4a2d96,_0xabadea){_0x4a2d96(_0x123cc7['outbound']);});},'Campaigns':function(_0x41a71e){return new Promise(function(_0x3779bc,_0x4aa9a1){var _0xf9b1ea=_[_0x8bce('0x56')](_0x123cc7[_0x8bce('0x78')]);_0x3779bc({'count':_0xf9b1ea[_0x8bce('0x55')],'rows':_0xf9b1ea});});},'VoiceQueuesPreview':function(_0x39d851){var _0x333948=this;return new Promise(function(_0xae4233,_0x25d759){_0x27a69e[_0x8bce('0x79')](_0x39d851['id'])[_0x8bce('0x6a')](function(_0x109cc2){_0xae4233({'code':0xc8,'message':_0x109cc2[_0x8bce('0x1a')]});})[_0x8bce('0x1d')](function(_0x532bdd){_0x25d759(_0x333948[_0x8bce('0x10')](0x1f4,_0x532bdd[_0x8bce('0x1a')]));});});},'EventManager':function(_0x275000){var _0x52b7ea=this;return new Promise(function(_0x216aa3,_0x5e003c){if(!_0x275000['event']){return _0x5e003c(_0x52b7ea[_0x8bce('0x10')](0x1f4,_0x8bce('0x7a')));}ami[_0x8bce('0x7b')](_0x8bce('0x7c')+_0x275000['event'],_0x275000[_0x8bce('0x1a')]);_0x216aa3({'code':0xc8,'message':_0x275000});});},'FaxAccounts':function(_0x3eff31){return new Promise(function(_0x24dbe1,_0x58a1f0){var _0x623fd0=_[_0x8bce('0x56')](_0x123cc7[_0x8bce('0x7d')]);_0x24dbe1({'count':_0x623fd0[_0x8bce('0x55')],'rows':_0x623fd0});});},'SendFax':function(_0x1f487e){var _0x10e519=this;return new Promise(function(_0x773ad9,_0x589453){_0x347480['send'](_0x1f487e)[_0x8bce('0x6a')](function(_0x23873c){_0x773ad9({'code':0xc8,'message':_0x23873c['message']});})['catch'](function(_0x3b9c29){_0x589453(_0x10e519[_0x8bce('0x10')](0x1f4,_0x3b9c29[_0x8bce('0x1a')]));});});},'CheckAfterSend':function(_0x28f8a5){var _0xf2e82e=this;return new Promise(function(_0x465499,_0x9e0752){_0x347480['checkAfterSend'](_0x28f8a5)[_0x8bce('0x6a')](function(_0x534515){_0x465499({'code':0xc8,'message':_0x534515[_0x8bce('0x1a')]});})[_0x8bce('0x1d')](function(_0x5934e8){_0x9e0752(_0xf2e82e[_0x8bce('0x10')](0x1f4,_0x5934e8[_0x8bce('0x1a')]));});});}};var _0x10174a=jayson[_0x8bce('0x7e')](_0xcf07e)[_0x8bce('0x7f')]();_0x10174a['on'](_0x8bce('0x10'),function(_0x1189f7){return _0x37d91d(_0x1189f7);});_0x10174a[_0x8bce('0x6')](0x232a,_0x8bce('0x80'),function(){console[_0x8bce('0x81')](_0x8bce('0x82'),0x232a);return _0xa5a69c('RPC\x20listening\x20on\x20port:'+0x232a);});});}; \ No newline at end of file +var _0xe366=['jayson/promise','validate','bluebird','moment','../properties','../ami','listen','%s/%s','SIP','name','timer','timers','updateAcw','updateStatusRealtime','pause','QueuePause','isConnected','error','asterisk','username','ami\x20disconnected','pick','keys','module','action','Action','message','catch','command','Command','then','content','voiceQueues','hasOwnProperty','strategy','answered','available','loggedIn','pTalking','sumBillable','total','type','abandoned','waiting','loggedInDb','outbound','dialActive','dialMethod','dialOriginateCallerIdName','dialOriginateCallerIdNumber','dialOriginateTimeout','dialPrefix','outboundAnswerAgiCallsDay','outboundAnswerCallsDay','outboundBlacklistCallsDay','outboundBusyCallsDay','outboundCongestionCallsDay','outboundDropCallsDayACS','outboundDropCallsDayCallersExit','outboundDropCallsDayTimeout','outboundNoSuchCallsDay','outboundOriginateFailureCallsDay','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','join','voicechannel','find','uniqueid','channel','format','filename','wav','MixMonitor','ai(mixmonitorid)','monitors','toLowerCase','isNil','/var/spool/asterisk/monitor/','YYYY-MM-DD\x20HH:mm:ss','mixmonitorid','rec','status','MixMonitor\x20Success','Channel\x20doesn\x27t\x20exist','map','resolve','StopMixMonitor','destinationchannel','stop','%s.%s','StopMixMonitor\x20Success','voicequeuechannel','queueChannels','Hangup','Redirect','context','agents','telephones','trunks','outboundChannels','campaigns','run','event','Event\x20name\x20mandatory','emit','custom:','send','server','http','127.0.0.1','log','AMI\x20RPC\x20server\x20listening\x20on\x20127.0.0.1:%d!','RPC\x20listening\x20on\x20port:','lodash','util'];(function(_0x4565bf,_0x5ad9d6){var _0x5610ba=function(_0x170988){while(--_0x170988){_0x4565bf['push'](_0x4565bf['shift']());}};_0x5610ba(++_0x5ad9d6);}(_0xe366,0x1a8));var _0x6e36=function(_0x484e36,_0x4482d8){_0x484e36=_0x484e36-0x0;var _0xafc85d=_0xe366[_0x484e36];return _0xafc85d;};'use strict';var _=require(_0x6e36('0x0'));var util=require(_0x6e36('0x1'));var jayson=require(_0x6e36('0x2'));var schema=require(_0x6e36('0x3'));var BPromise=require(_0x6e36('0x4'));var moment=require(_0x6e36('0x5'));var config=require('../../../config/environment');var properties=require(_0x6e36('0x6'));var ami=require(_0x6e36('0x7'));exports[_0x6e36('0x8')]=function(_0x45d5ee,_0x5f44a4,_0x1744b8){return new BPromise(function(_0x30df9d,_0x3346c7){var _0x9b529a={'QueuePause':function(_0x48121b){return new Promise(function(_0x3a8960,_0x53dea1){var _0x1ca5c2=util['format'](_0x6e36('0x9'),_0x6e36('0xa'),_0x48121b[_0x6e36('0xb')]);if(_0x45d5ee['timers']&&_0x45d5ee['timers'][_0x1ca5c2]&&_0x45d5ee['timers'][_0x1ca5c2][_0x6e36('0xc')]){_0x45d5ee[_0x6e36('0xd')][_0x1ca5c2][_0x6e36('0xe')]();}if(_0x45d5ee['agents'][_0x1ca5c2]){_0x45d5ee['agents'][_0x1ca5c2][_0x6e36('0xf')]({'statePause':_0x48121b[_0x6e36('0x10')]?!![]:![]});}_0x3a8960({'code':0xc8,'message':_0x6e36('0x11')});});},'Reload':function(_0x59074a){var _0x1a4ebf=this;return new Promise(function(_0x466392,_0x524c94){if(ami[_0x6e36('0x12')]()==![]){return _0x524c94(_0x1a4ebf[_0x6e36('0x13')](0x1f4,[config[_0x6e36('0x14')]['ip'],config[_0x6e36('0x14')][_0x6e36('0x15')],_0x6e36('0x16')]['join']('\x20')));}_0x59074a=_[_0x6e36('0x17')](_0x59074a,_[_0x6e36('0x18')](properties[_0x6e36('0x19')]));_0x59074a[_0x6e36('0x1a')]='Reload';return ami[_0x6e36('0x1b')](_0x59074a)['then'](function(_0x10d700){_0x466392({'code':0xc8,'message':_0x10d700[_0x6e36('0x1c')]});})[_0x6e36('0x1d')](function(_0x148bdf){_0x524c94(_0x1a4ebf['error'](0x1f5,_0x148bdf['message']));});});},'Command':function(_0x20c185){var _0x237e58=this;return new Promise(function(_0x2f54f4,_0x234619){if(ami[_0x6e36('0x12')]()==![]){return _0x234619(_0x237e58[_0x6e36('0x13')](0x1f4,[config[_0x6e36('0x14')]['ip'],config['asterisk'][_0x6e36('0x15')],_0x6e36('0x16')]['join']('\x20')));}_0x20c185=_[_0x6e36('0x17')](_0x20c185,_0x6e36('0x1e'));_0x20c185[_0x6e36('0x1a')]=_0x6e36('0x1f');return ami[_0x6e36('0x1b')](_0x20c185)[_0x6e36('0x20')](function(_0x256e01){_0x2f54f4({'code':0xc8,'message':_0x256e01[_0x6e36('0x21')]});})['catch'](function(_0x3bba1c){_0x234619(_0x237e58['error'](0x1f5,_0x3bba1c[_0x6e36('0x1c')]));});});},'VoiceQueues':function(_0x557573){return new Promise(function(_0x2485a7,_0x15f834){var _0xe47386=[];for(var _0x5adaea in _0x45d5ee[_0x6e36('0x22')]){if(_0x45d5ee[_0x6e36('0x22')][_0x6e36('0x23')](_0x5adaea)){var _0x5f49f7=_0x45d5ee[_0x6e36('0x22')][_0x5adaea];var _0x52daab={'id':_0x5f49f7['id'],'name':_0x5f49f7[_0x6e36('0xb')],'strategy':_0x5f49f7[_0x6e36('0x24')],'answered':_0x5f49f7[_0x6e36('0x25')],'available':_0x5f49f7[_0x6e36('0x26')],'loggedIn':_0x5f49f7[_0x6e36('0x27')],'pTalking':_0x5f49f7[_0x6e36('0x28')],'sumBillable':_0x5f49f7[_0x6e36('0x29')],'sumDuration':_0x5f49f7['sumDuration'],'sumHoldTime':_0x5f49f7['sumHoldTime']||0x0,'talking':_0x5f49f7['talking'],'total':_0x5f49f7[_0x6e36('0x2a')],'type':_0x5f49f7[_0x6e36('0x2b')],'unmanaged':_0x5f49f7['unmanaged'],'abandoned':_0x5f49f7[_0x6e36('0x2c')],'waiting':_0x5f49f7[_0x6e36('0x2d')],'loggedInDb':_0x5f49f7[_0x6e36('0x2e')]};if(_0x5f49f7[_0x6e36('0x2b')]===_0x6e36('0x2f')){_0x52daab[_0x6e36('0x30')]=_0x5f49f7[_0x6e36('0x30')];_0x52daab[_0x6e36('0x31')]=_0x5f49f7[_0x6e36('0x31')];_0x52daab[_0x6e36('0x32')]=_0x5f49f7['dialOriginateCallerIdName'];_0x52daab[_0x6e36('0x33')]=_0x5f49f7[_0x6e36('0x33')];_0x52daab[_0x6e36('0x34')]=_0x5f49f7['dialOriginateTimeout'];_0x52daab[_0x6e36('0x35')]=_0x5f49f7[_0x6e36('0x35')];_0x52daab[_0x6e36('0x36')]=_0x5f49f7[_0x6e36('0x36')];_0x52daab[_0x6e36('0x37')]=_0x5f49f7[_0x6e36('0x37')];_0x52daab[_0x6e36('0x38')]=_0x5f49f7[_0x6e36('0x38')];_0x52daab[_0x6e36('0x39')]=_0x5f49f7['outboundBusyCallsDay'];_0x52daab['outboundCongestionCallsDay']=_0x5f49f7[_0x6e36('0x3a')];_0x52daab[_0x6e36('0x3b')]=_0x5f49f7[_0x6e36('0x3b')];_0x52daab[_0x6e36('0x3c')]=_0x5f49f7[_0x6e36('0x3c')];_0x52daab[_0x6e36('0x3d')]=_0x5f49f7['outboundDropCallsDayTimeout'];_0x52daab['outboundNoAnswerCallsDay']=_0x5f49f7['outboundNoAnswerCallsDay'];_0x52daab[_0x6e36('0x3e')]=_0x5f49f7[_0x6e36('0x3e')];_0x52daab['outboundOriginateFailureCallsDay']=_0x5f49f7[_0x6e36('0x3f')];_0x52daab['outboundReCallsDay']=_0x5f49f7['outboundReCallsDay'];_0x52daab[_0x6e36('0x40')]=_0x5f49f7['outboundRejectCallsDay'];_0x52daab['outboundUnknownCallsDay']=_0x5f49f7[_0x6e36('0x41')];_0x52daab['predictiveIntervalAnsweredCalls']=_0x5f49f7[_0x6e36('0x42')];_0x52daab[_0x6e36('0x43')]=_0x5f49f7[_0x6e36('0x43')];_0x52daab[_0x6e36('0x44')]=_0x5f49f7['predictiveIntervalAvgTalktime'];_0x52daab['predictiveIntervalDroppedCallsCallersExit']=_0x5f49f7[_0x6e36('0x45')];_0x52daab[_0x6e36('0x46')]=_0x5f49f7['predictiveIntervalDroppedCallsTimeout'];_0x52daab[_0x6e36('0x47')]=_0x5f49f7[_0x6e36('0x47')];_0x52daab[_0x6e36('0x48')]=_0x5f49f7[_0x6e36('0x48')];_0x52daab[_0x6e36('0x49')]=_0x5f49f7[_0x6e36('0x49')];_0x52daab['predictiveIntervalMultiplicativeFactor']=_0x5f49f7[_0x6e36('0x4a')];_0x52daab[_0x6e36('0x4b')]=_0x5f49f7['predictiveIntervalPauses'];_0x52daab[_0x6e36('0x4c')]=_0x5f49f7[_0x6e36('0x4c')];_0x52daab[_0x6e36('0x4d')]=_0x5f49f7[_0x6e36('0x4d')];_0x52daab[_0x6e36('0x1c')]=_0x5f49f7[_0x6e36('0x1c')];_0x52daab['originated']=_0x5f49f7[_0x6e36('0x4e')];_0x52daab[_0x6e36('0x4f')]=_0x5f49f7[_0x6e36('0x4f')];_0x52daab[_0x6e36('0x50')]=_0x5f49f7[_0x6e36('0x50')];_0x52daab[_0x6e36('0x51')]=_0x5f49f7[_0x6e36('0x51')];_0x52daab[_0x6e36('0x52')]=_0x5f49f7[_0x6e36('0x52')];_0x52daab[_0x6e36('0x53')]=_0x5f49f7['startPredictive'];_0x52daab[_0x6e36('0x54')]=_0x5f49f7['startProgressive'];}if(_0x5f49f7['Trunk']){_0x52daab['Trunk']={'id':_0x5f49f7[_0x6e36('0x55')]['id'],'name':_0x5f49f7[_0x6e36('0x55')][_0x6e36('0xb')],'active':_0x5f49f7['Trunk'][_0x6e36('0x56')],'callerid':_0x5f49f7[_0x6e36('0x55')][_0x6e36('0x57')]};}if(_0x5f49f7[_0x6e36('0x58')]){_0x52daab['Interval']={'id':_0x5f49f7['Interval']['id'],'name':_0x5f49f7[_0x6e36('0x58')][_0x6e36('0xb')]};}_0xe47386[_0x6e36('0x59')](_0x52daab);}}_0x2485a7({'count':_0xe47386[_0x6e36('0x5a')],'rows':_0xe47386});});},'VoiceChannels':function(_0x3978aa){return new Promise(function(_0x323fd5,_0x395d0d){var _0x1ed2e4=_[_0x6e36('0x5b')](_0x45d5ee[_0x6e36('0x5c')]);_0x323fd5({'count':_0x1ed2e4[_0x6e36('0x5a')],'rows':_0x1ed2e4});});},'VoiceChannelMixMonitor':function(_0x3314d6){var _0x55654e=this;return new Promise(function(_0x5e03e7,_0x16f4a6){if(ami['isConnected']()==![]){return _0x16f4a6(_0x55654e[_0x6e36('0x13')](0x1f4,[config[_0x6e36('0x14')]['ip'],config[_0x6e36('0x14')][_0x6e36('0x15')],'ami\x20disconnected'][_0x6e36('0x5d')]('\x20')));}var _0x103bf7=schema(properties[_0x6e36('0x5e')])['validate'](_0x3314d6);if(_0x103bf7[_0x6e36('0x5a')]>0x0){return _0x16f4a6(_0x55654e['error'](0x1f4,_['map'](_0x103bf7,_0x6e36('0x1c'))[_0x6e36('0x5d')](',\x20')));}var _0x30066f=_[_0x6e36('0x5f')](_0x45d5ee['channels'],{'uniqueid':_0x3314d6[_0x6e36('0x60')]});if(_0x30066f&&_0x30066f[_0x6e36('0x61')]){var _0x330e06=util[_0x6e36('0x62')]('%s.%s',_0x3314d6[_0x6e36('0x63')]||_0x3314d6[_0x6e36('0x60')],_0x3314d6[_0x6e36('0x62')]||_0x6e36('0x64'));return ami[_0x6e36('0x1b')]({'action':_0x6e36('0x65'),'channel':_0x30066f[_0x6e36('0x61')],'file':_0x330e06,'options':_0x6e36('0x66')})['then'](function(_0xfff8cc){var _0x5d18ad=_[_0x6e36('0x5f')](_0x30066f[_0x6e36('0x67')],{'filename':'/var/spool/asterisk/monitor/'+_0x330e06[_0x6e36('0x68')]()});if(_[_0x6e36('0x69')](_0x5d18ad)){_0x30066f[_0x6e36('0x67')][_0x6e36('0x59')]({'filename':_0x6e36('0x6a')+_0x330e06[_0x6e36('0x68')](),'createdAt':moment()[_0x6e36('0x62')](_0x6e36('0x6b')),'mixmonitorid':_0xfff8cc[_0x6e36('0x6c')],'status':_0x6e36('0x6d')});}else{_0x5d18ad['mixmonitorid']=_0xfff8cc[_0x6e36('0x6c')];_0x5d18ad[_0x6e36('0x6e')]=_0x6e36('0x6d');}_0x5e03e7({'code':0xc8,'message':[_0x3314d6[_0x6e36('0x60')],_0x6e36('0x6f'),_0xfff8cc[_0x6e36('0x6c')]][_0x6e36('0x5d')]('\x20'),'mixmonitorid':_0xfff8cc['mixmonitorid']});})[_0x6e36('0x1d')](function(_0x4aa671){_0x16f4a6(_0x55654e[_0x6e36('0x13')](0x1f5,[_0x3314d6[_0x6e36('0x60')],_0x4aa671['message'][_0x6e36('0x68')]()][_0x6e36('0x5d')]('\x20')));});}else{return _0x16f4a6(_0x55654e[_0x6e36('0x13')](0x1f5,_0x6e36('0x70')));}});},'VoiceChannelStopMixMonitor':function(_0x4ad911){var _0x373a6d=this;return new Promise(function(_0x49fddf,_0x59dbac){if(ami['isConnected']()==![]){return _0x59dbac(_0x373a6d[_0x6e36('0x13')](0x1f4,[config[_0x6e36('0x14')]['ip'],config[_0x6e36('0x14')]['username'],_0x6e36('0x16')][_0x6e36('0x5d')]('\x20')));}var _0x227a57=schema(properties[_0x6e36('0x5e')])['validate'](_0x4ad911);if(_0x227a57[_0x6e36('0x5a')]>0x0){return _0x59dbac(_0x373a6d[_0x6e36('0x13')](0x1f4,_[_0x6e36('0x71')](_0x227a57,_0x6e36('0x1c'))[_0x6e36('0x5d')](',\x20')));}var _0x317313=_[_0x6e36('0x5f')](_0x45d5ee[_0x6e36('0x5c')],{'uniqueid':_0x4ad911['uniqueid']});if(_0x317313){return BPromise[_0x6e36('0x72')]()[_0x6e36('0x20')](function(){if(_0x317313[_0x6e36('0x61')]){return ami[_0x6e36('0x1b')]({'action':_0x6e36('0x73'),'channel':_0x317313[_0x6e36('0x61')],'mixmonitorid':_0x4ad911[_0x6e36('0x6c')]})[_0x6e36('0x1d')](function(_0x2ae818){});}})[_0x6e36('0x20')](function(){if(_0x317313[_0x6e36('0x74')]){return ami['Action']({'action':_0x6e36('0x73'),'channel':_0x317313['destinationchannel'],'mixmonitorid':_0x4ad911[_0x6e36('0x6c')]})[_0x6e36('0x1d')](function(_0x3d0a3b){});}})['then'](function(_0x537b8b){var _0x5b0992=_[_0x6e36('0x5f')](_0x317313['monitors'],{'mixmonitorid':_0x4ad911[_0x6e36('0x6c')]});if(_0x5b0992){_0x5b0992['status']=_0x6e36('0x75');}})[_0x6e36('0x20')](function(){var _0x5a59dd=util[_0x6e36('0x62')](_0x6e36('0x76'),_0x4ad911[_0x6e36('0x63')]||_0x4ad911[_0x6e36('0x60')],_0x4ad911[_0x6e36('0x62')]||_0x6e36('0x64'));var _0x23d5fb=_[_0x6e36('0x5f')](_0x317313[_0x6e36('0x67')],{'filename':_0x6e36('0x6a')+_0x5a59dd[_0x6e36('0x68')]()});if(_0x23d5fb){_0x23d5fb[_0x6e36('0x6e')]=_0x6e36('0x75');}})[_0x6e36('0x20')](function(){_0x49fddf({'code':0xc8,'message':[_0x4ad911[_0x6e36('0x60')],_0x6e36('0x77')][_0x6e36('0x5d')]('\x20')});})[_0x6e36('0x1d')](function(_0x127f42){_0x59dbac(_0x373a6d[_0x6e36('0x13')](0x1f5,[_0x4ad911[_0x6e36('0x60')],_0x127f42[_0x6e36('0x1c')][_0x6e36('0x68')]()]['join']('\x20')));});}else{return _0x59dbac(_0x373a6d['error'](0x1f5,_0x6e36('0x70')));}});},'VoiceQueuesChannels':function(_0x117247){return new Promise(function(_0x7a2839,_0x4ab03b){var _0x4c0492=_[_0x6e36('0x5b')](_0x45d5ee['queueChannels']);_0x7a2839({'count':_0x4c0492['length'],'rows':_0x4c0492});});},'VoiceQueuesChannel':function(_0xd82b61){var _0x31fa67=this;return new Promise(function(_0x5919e8,_0x542e6b){var _0x1aab5b=schema(properties[_0x6e36('0x78')])[_0x6e36('0x3')](_0xd82b61);if(_0x1aab5b[_0x6e36('0x5a')]>0x0){return _0x542e6b(_0x31fa67['error'](0x1f4,_[_0x6e36('0x71')](_0x1aab5b,_0x6e36('0x1c'))['join'](',\x20')));}var _0xb7098f=_[_0x6e36('0x5f')](_0x45d5ee[_0x6e36('0x79')],{'uniqueid':_0xd82b61['uniqueid']});if(_0xb7098f){_0x5919e8(_0xb7098f);}else{return _0x542e6b(_0x31fa67['error'](0x1f5,'Channel\x20doesn\x27t\x20exist'));}});},'VoiceQueuesChannelHangup':function(_0x980c55){var _0x222c0b=this;return new Promise(function(_0x21d208,_0x4b0903){if(ami[_0x6e36('0x12')]()==![]){return _0x4b0903(_0x222c0b[_0x6e36('0x13')](0x1f4,[config[_0x6e36('0x14')]['ip'],config[_0x6e36('0x14')][_0x6e36('0x15')],'ami\x20disconnected'][_0x6e36('0x5d')]('\x20')));}var _0x5a65a2=schema(properties['voicequeuechannelhangup'])[_0x6e36('0x3')](_0x980c55);if(_0x5a65a2[_0x6e36('0x5a')]>0x0){return _0x4b0903(_0x222c0b['error'](0x1f4,_[_0x6e36('0x71')](_0x5a65a2,_0x6e36('0x1c'))[_0x6e36('0x5d')](',\x20')));}var _0x5861aa=_[_0x6e36('0x5f')](_0x45d5ee['queueChannels'],{'uniqueid':_0x980c55[_0x6e36('0x60')]});if(_0x5861aa&&_0x5861aa['channel']){return ami[_0x6e36('0x1b')]({'action':_0x6e36('0x7a'),'channel':_0x5861aa[_0x6e36('0x61')]})[_0x6e36('0x20')](function(_0x4f241d){_0x21d208({'code':0xc8,'message':[_0x980c55[_0x6e36('0x60')],_0x4f241d[_0x6e36('0x1c')][_0x6e36('0x68')]()][_0x6e36('0x5d')]('\x20')});})['catch'](function(_0x49b38e){_0x4b0903(_0x222c0b[_0x6e36('0x13')](0x1f5,[_0x980c55[_0x6e36('0x60')],_0x49b38e['message']['toLowerCase']()]['join']('\x20')));});}else{return _0x4b0903(_0x222c0b['error'](0x1f5,_0x6e36('0x70')));}});},'VoiceQueuesChannelRedirect':function(_0x19c459){var _0x105bce=this;return new Promise(function(_0x3471be,_0x411ccc){if(ami[_0x6e36('0x12')]()==![]){return _0x411ccc(_0x105bce[_0x6e36('0x13')](0x1f4,[config[_0x6e36('0x14')]['ip'],config['asterisk'][_0x6e36('0x15')],_0x6e36('0x16')]['join']('\x20')));}var _0x317943=schema(properties['voicequeuechannelredirect'])['validate'](_0x19c459);if(_0x317943[_0x6e36('0x5a')]>0x0){return _0x411ccc(_0x105bce[_0x6e36('0x13')](0x1f4,_['map'](_0x317943,'message')[_0x6e36('0x5d')](',\x20')));}var _0x5b8163=_[_0x6e36('0x5f')](_0x45d5ee[_0x6e36('0x79')],{'uniqueid':_0x19c459[_0x6e36('0x60')]});if(_0x5b8163&&_0x5b8163['channel']){return ami[_0x6e36('0x1b')]({'action':_0x6e36('0x7b'),'channel':_0x5b8163[_0x6e36('0x61')],'exten':_0x19c459['exten'],'context':_0x19c459['context']||_0x5b8163[_0x6e36('0x7c')],'priority':0x1})[_0x6e36('0x20')](function(_0x38b7ff){_0x3471be({'code':0xc8,'message':[_0x19c459[_0x6e36('0x60')],_0x38b7ff[_0x6e36('0x1c')][_0x6e36('0x68')]()][_0x6e36('0x5d')]('\x20')});})[_0x6e36('0x1d')](function(_0x309328){_0x411ccc(_0x105bce[_0x6e36('0x13')](0x1f5,[_0x19c459[_0x6e36('0x60')],_0x309328[_0x6e36('0x1c')]['toLowerCase']()][_0x6e36('0x5d')]('\x20')));});}else{return _0x411ccc(_0x105bce[_0x6e36('0x13')](0x1f5,'Channel\x20doesn\x27t\x20exist'));}});},'Agents':function(_0x1416da){return new Promise(function(_0x18d6cb,_0x30b0bf){var _0x5c22ef=_[_0x6e36('0x5b')](_0x45d5ee[_0x6e36('0x7d')]);_0x18d6cb({'count':_0x5c22ef[_0x6e36('0x5a')],'rows':_0x5c22ef});});},'Telephones':function(_0x4003b7){return new Promise(function(_0x314d63,_0x38240c){var _0x43bd59=_[_0x6e36('0x5b')](_0x45d5ee[_0x6e36('0x7e')]);_0x314d63({'count':_0x43bd59[_0x6e36('0x5a')],'rows':_0x43bd59});});},'Trunks':function(_0x5b5497){return new Promise(function(_0x4f3599,_0x57daf7){var _0x3a6a71=_[_0x6e36('0x5b')](_0x45d5ee[_0x6e36('0x7f')]);_0x4f3599({'count':_0x3a6a71[_0x6e36('0x5a')],'rows':_0x3a6a71});});},'OutboundChannels':function(_0x2cb722){return new Promise(function(_0x2f2f05,_0x21033f){var _0x35e2fb=_[_0x6e36('0x5b')](_0x45d5ee[_0x6e36('0x80')]);_0x2f2f05({'count':_0x35e2fb[_0x6e36('0x5a')],'rows':_0x35e2fb});});},'Outbound':function(_0x3f9f6f){return new Promise(function(_0x5a0e0c,_0x530a49){_0x5a0e0c(_0x45d5ee['outbound']);});},'Campaigns':function(_0x3c405f){return new Promise(function(_0x1816f4,_0x298d3a){var _0x4d46f8=_[_0x6e36('0x5b')](_0x45d5ee[_0x6e36('0x81')]);_0x1816f4({'count':_0x4d46f8[_0x6e36('0x5a')],'rows':_0x4d46f8});});},'VoiceQueuesPreview':function(_0x5d6870){var _0x15bd6e=this;return new Promise(function(_0x17db42,_0x555c98){_0x5f44a4[_0x6e36('0x82')](_0x5d6870['id'])[_0x6e36('0x20')](function(_0x26c721){_0x17db42({'code':0xc8,'message':_0x26c721['message']});})[_0x6e36('0x1d')](function(_0x59039e){_0x555c98(_0x15bd6e['error'](0x1f4,_0x59039e[_0x6e36('0x1c')]));});});},'EventManager':function(_0x5e061b){var _0x169ee2=this;return new Promise(function(_0x5d24d1,_0x47bf30){if(!_0x5e061b[_0x6e36('0x83')]){return _0x47bf30(_0x169ee2['error'](0x1f4,_0x6e36('0x84')));}ami[_0x6e36('0x85')](_0x6e36('0x86')+_0x5e061b['event'],_0x5e061b[_0x6e36('0x1c')]);_0x5d24d1({'code':0xc8,'message':_0x5e061b});});},'FaxAccounts':function(_0x3bb979){return new Promise(function(_0x2a588d,_0x4fa9df){var _0x227d41=_['values'](_0x45d5ee['faxAccounts']);_0x2a588d({'count':_0x227d41[_0x6e36('0x5a')],'rows':_0x227d41});});},'SendFax':function(_0x2cad1a){var _0x5b5451=this;return new Promise(function(_0x134028,_0x25513a){_0x1744b8[_0x6e36('0x87')](_0x2cad1a)[_0x6e36('0x20')](function(_0x5b8c63){_0x134028({'code':0xc8,'message':_0x5b8c63[_0x6e36('0x1c')]});})['catch'](function(_0x3021fc){_0x25513a(_0x5b5451[_0x6e36('0x13')](0x1f4,_0x3021fc[_0x6e36('0x1c')]));});});},'CheckAfterSend':function(_0x17addc){var _0x39c8ef=this;return new Promise(function(_0x242f3a,_0x39bc24){_0x1744b8['checkAfterSend'](_0x17addc)['then'](function(_0x40d5b3){_0x242f3a({'code':0xc8,'message':_0x40d5b3[_0x6e36('0x1c')]});})['catch'](function(_0x1fd7e5){_0x39bc24(_0x39c8ef[_0x6e36('0x13')](0x1f4,_0x1fd7e5[_0x6e36('0x1c')]));});});}};var _0x2c9e4a=jayson[_0x6e36('0x88')](_0x9b529a)[_0x6e36('0x89')]();_0x2c9e4a['on']('error',function(_0xdca16b){return _0x3346c7(_0xdca16b);});_0x2c9e4a[_0x6e36('0x8')](0x232a,_0x6e36('0x8a'),function(){console[_0x6e36('0x8b')](_0x6e36('0x8c'),0x232a);return _0x30df9d(_0x6e36('0x8d')+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 6920673..d96fbde 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 _0x49fe=['uniqueid','destcalleridname','phone','then','xmd-contactid2','user:%s','format','toLowerCase','resolve','createContact','name','trigger:%s','action','merge','catch','bluebird','../../../../config/environment','../../../../config/logger','trigger','../../rpc/cmContact','redis','defaults','localhost','socket.io-emitter','stringify','emit','autoCreate','data2','data1','calleridnum','isNil','firstName','calleridname',''];(function(_0x124c75,_0x332013){var _0x5c5471=function(_0x2fd3eb){while(--_0x2fd3eb){_0x124c75['push'](_0x124c75['shift']());}};_0x5c5471(++_0x332013);}(_0x49fe,0x75));var _0xe49f=function(_0x4f3c1d,_0x597f61){_0x4f3c1d=_0x4f3c1d-0x0;var _0x170baa=_0x49fe[_0x4f3c1d];return _0x170baa;};'use strict';var BPromise=require(_0xe49f('0x0'));var util=require('util');var _=require('lodash');var Redis=require('ioredis');var config=require(_0xe49f('0x1'));var logger=require(_0xe49f('0x2'))(_0xe49f('0x3'));var cmContactRpc=require(_0xe49f('0x4'));config[_0xe49f('0x5')]=_[_0xe49f('0x6')](config[_0xe49f('0x5')],{'host':_0xe49f('0x7'),'port':0x18eb});var io=require(_0xe49f('0x8'))(new Redis(config[_0xe49f('0x5')]));function emit(_0xe0591c,_0x2a7c98,_0x6f1120){logger['info'](_0xe0591c,_0x2a7c98,JSON[_0xe49f('0x9')](_0x6f1120));io['to'](_0xe0591c)[_0xe49f('0xa')](_0x2a7c98,_0x6f1120);}exports['exec']=function(_0x1eefb2,_0x50c474,_0x710895){_0x710895[_0xe49f('0xb')]=0x0;if(_0x50c474['data2']&&parseInt(_0x50c474[_0xe49f('0xc')],0xa)){var _0x1f136f={'ListId':parseInt(_0x50c474[_0xe49f('0xd')],0xa),'phone':_0x710895[_0xe49f('0xe')]};if(_[_0xe49f('0xf')](_0x710895['routeId'])){_0x1f136f[_0xe49f('0x10')]=_0x710895[_0xe49f('0x11')]&&_0x710895['calleridname']!==_0xe49f('0x12')?_0x710895[_0xe49f('0x11')]:_0x710895[_0xe49f('0xe')]||_0x710895[_0xe49f('0x13')];}else{_0x1f136f[_0xe49f('0x10')]=_0x710895['destcalleridname']&&_0x710895[_0xe49f('0x14')]!==_0xe49f('0x12')?_0x710895['destcalleridname']:_0x710895['destcalleridnum']||_0x710895[_0xe49f('0x13')];_0x1f136f[_0xe49f('0x15')]=_0x710895[_0xe49f('0x14')]&&_0x710895[_0xe49f('0x14')]!==_0xe49f('0x12')?_0x710895[_0xe49f('0x14')]:_0x710895['destcalleridnum']||_0x710895[_0xe49f('0x13')];}BPromise['resolve']()[_0xe49f('0x16')](cmContactRpc['showContact']({'where':_['omit'](_0x1f136f,[_0xe49f('0x10')])}))[_0xe49f('0x16')](function(_0x4a862c){if(_0x4a862c){_0x710895[_0xe49f('0x17')]=_0x4a862c['id'];emit(util['format'](_0xe49f('0x18'),_0x1eefb2['name']),util[_0xe49f('0x19')]('trigger:%s',_0x50c474['action'][_0xe49f('0x1a')]()),_['merge'](_0x710895,{'ListId':parseInt(_0x50c474[_0xe49f('0xd')],0xa)}));return;}else{return BPromise[_0xe49f('0x1b')]()[_0xe49f('0x16')](cmContactRpc[_0xe49f('0x1c')](_0x1f136f));}})[_0xe49f('0x16')](function(_0x169a6c){if(_0x169a6c){_0x710895[_0xe49f('0x17')]=_0x169a6c['id'];emit(util[_0xe49f('0x19')](_0xe49f('0x18'),_0x1eefb2[_0xe49f('0x1d')]),util[_0xe49f('0x19')](_0xe49f('0x1e'),_0x50c474[_0xe49f('0x1f')]['toLowerCase']()),_[_0xe49f('0x20')](_0x710895,{'ListId':parseInt(_0x50c474[_0xe49f('0xd')],0xa)}));}})[_0xe49f('0x21')](function(_0x14d820){logger['error']('Error\x20creating\x20contact',JSON[_0xe49f('0x9')](_0x14d820));});}else{if(_0x1eefb2){emit(util[_0xe49f('0x19')]('user:%s',_0x1eefb2[_0xe49f('0x1d')]),util['format'](_0xe49f('0x1e'),_0x50c474[_0xe49f('0x1f')][_0xe49f('0x1a')]()),_['merge']({'ListId':parseInt(_0x50c474['data1'],0xa)},_0x710895));}}}; \ No newline at end of file +var _0x6337=['exec','autoCreate','data2','data1','calleridnum','routeId','firstName','calleridname','','destcalleridname','destcalleridnum','uniqueid','phone','resolve','then','showContact','xmd-contactid2','format','user:%s','name','trigger:%s','toLowerCase','merge','action','util','lodash','ioredis','../../../../config/environment','../../../../config/logger','trigger','../../rpc/cmContact','redis','defaults','localhost','socket.io-emitter','info','stringify'];(function(_0x3397e7,_0x32e00a){var _0x5e4170=function(_0x5d1e94){while(--_0x5d1e94){_0x3397e7['push'](_0x3397e7['shift']());}};_0x5e4170(++_0x32e00a);}(_0x6337,0x18a));var _0x7633=function(_0x768142,_0x4228dc){_0x768142=_0x768142-0x0;var _0x219142=_0x6337[_0x768142];return _0x219142;};'use strict';var BPromise=require('bluebird');var util=require(_0x7633('0x0'));var _=require(_0x7633('0x1'));var Redis=require(_0x7633('0x2'));var config=require(_0x7633('0x3'));var logger=require(_0x7633('0x4'))(_0x7633('0x5'));var cmContactRpc=require(_0x7633('0x6'));config[_0x7633('0x7')]=_[_0x7633('0x8')](config['redis'],{'host':_0x7633('0x9'),'port':0x18eb});var io=require(_0x7633('0xa'))(new Redis(config[_0x7633('0x7')]));function emit(_0x539d69,_0x1fee41,_0x4b9491){logger[_0x7633('0xb')](_0x539d69,_0x1fee41,JSON[_0x7633('0xc')](_0x4b9491));io['to'](_0x539d69)['emit'](_0x1fee41,_0x4b9491);}exports[_0x7633('0xd')]=function(_0x547874,_0x35a196,_0x4c0f0a){_0x4c0f0a[_0x7633('0xe')]=0x0;if(_0x35a196[_0x7633('0xf')]&&parseInt(_0x35a196['data2'],0xa)){var _0x1f3811={'ListId':parseInt(_0x35a196[_0x7633('0x10')],0xa),'phone':_0x4c0f0a[_0x7633('0x11')]};if(_['isNil'](_0x4c0f0a[_0x7633('0x12')])){_0x1f3811[_0x7633('0x13')]=_0x4c0f0a[_0x7633('0x14')]&&_0x4c0f0a['calleridname']!==_0x7633('0x15')?_0x4c0f0a[_0x7633('0x14')]:_0x4c0f0a[_0x7633('0x11')]||_0x4c0f0a['uniqueid'];}else{_0x1f3811['firstName']=_0x4c0f0a['destcalleridname']&&_0x4c0f0a[_0x7633('0x16')]!==_0x7633('0x15')?_0x4c0f0a[_0x7633('0x16')]:_0x4c0f0a[_0x7633('0x17')]||_0x4c0f0a[_0x7633('0x18')];_0x1f3811[_0x7633('0x19')]=_0x4c0f0a[_0x7633('0x16')]&&_0x4c0f0a[_0x7633('0x16')]!==_0x7633('0x15')?_0x4c0f0a['destcalleridname']:_0x4c0f0a[_0x7633('0x17')]||_0x4c0f0a[_0x7633('0x18')];}BPromise[_0x7633('0x1a')]()[_0x7633('0x1b')](cmContactRpc[_0x7633('0x1c')]({'where':_['omit'](_0x1f3811,[_0x7633('0x13')])}))[_0x7633('0x1b')](function(_0x123399){if(_0x123399){_0x4c0f0a[_0x7633('0x1d')]=_0x123399['id'];emit(util[_0x7633('0x1e')](_0x7633('0x1f'),_0x547874[_0x7633('0x20')]),util[_0x7633('0x1e')](_0x7633('0x21'),_0x35a196['action'][_0x7633('0x22')]()),_[_0x7633('0x23')](_0x4c0f0a,{'ListId':parseInt(_0x35a196[_0x7633('0x10')],0xa)}));return;}else{return BPromise[_0x7633('0x1a')]()[_0x7633('0x1b')](cmContactRpc['createContact'](_0x1f3811));}})[_0x7633('0x1b')](function(_0x4590cc){if(_0x4590cc){_0x4c0f0a[_0x7633('0x1d')]=_0x4590cc['id'];emit(util[_0x7633('0x1e')]('user:%s',_0x547874[_0x7633('0x20')]),util[_0x7633('0x1e')](_0x7633('0x21'),_0x35a196[_0x7633('0x24')]['toLowerCase']()),_[_0x7633('0x23')](_0x4c0f0a,{'ListId':parseInt(_0x35a196[_0x7633('0x10')],0xa)}));}})['catch'](function(_0x1eb275){logger['error']('Error\x20creating\x20contact',JSON[_0x7633('0xc')](_0x1eb275));});}else{if(_0x547874){emit(util[_0x7633('0x1e')](_0x7633('0x1f'),_0x547874[_0x7633('0x20')]),util[_0x7633('0x1e')](_0x7633('0x21'),_0x35a196[_0x7633('0x24')]['toLowerCase']()),_[_0x7633('0x23')]({'ListId':parseInt(_0x35a196[_0x7633('0x10')],0xa)},_0x4c0f0a));}}}; \ No newline at end of file diff --git a/server/services/ami/trigger/index.js b/server/services/ami/trigger/index.js index fb308b0..d14119c 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 _0xb587=['./urlforward','./integration','./cmContact','./script','../rpc/cmContact','../../../config/environment','../../../config/logger','../ami','redis','defaults','socket.io-emitter','popup','winapp','triggers','agents','voiceQueues','templates','voiceExtensions','zendeskAccounts','freshdeskAccounts','salesforceAccounts','sugarcrmAccounts','zohoAccounts','deskAccounts','vtigerAccounts','servicenowAccounts','dynamics365Accounts','accounts','freshsalesAccounts','custom:agentcalled','bind','custom:agentconnect','syncCustomEvent','custom:agentcomplete','custom:queuecallerabandon','custom:dialbegin','syncAgentDial','custom:dialconnect','custom:newinteraction','custom:closedinteraction','custom:incomingmessage','custom:outgoingmessage','custom:acceptmessage','custom:rejectmessage','emit','stringify','prototype','clone','checkTriggers','status','merge','Actions','length','interface','action','contactmanager','data1','TemplateId','data2','html','render','template\x20not\x20found','uri','buildUri','isNil','data3','data4','uriLocation','windowWidth','data5','800','windowHeight','600','data6','winApplication','winArguments','format','trigger:%s:%s','toLowerCase','jscripty','user:%s','name','trigger:%s','exec','integration','queue','urlforward','script','parse','query','search','replace','checkTrigger','every','AllConditions','channel','AnyConditions','checkConditions','field','chat','operator','value','ChatWebsiteId','upperFirst','AccountId','interaction','event','membername','lastevent','routeId','exports','util','lodash','url','mustache','ioredis'];(function(_0x354672,_0x56c1cd){var _0x5ecac6=function(_0x3fb4e2){while(--_0x3fb4e2){_0x354672['push'](_0x354672['shift']());}};_0x5ecac6(++_0x56c1cd);}(_0xb587,0x1cb));var _0x7b58=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xb587[_0x3dd15e];return _0x231fd0;};'use strict';var util=require(_0x7b58('0x0'));var _=require(_0x7b58('0x1'));var url=require(_0x7b58('0x2'));var Mustache=require(_0x7b58('0x3'));var Redis=require(_0x7b58('0x4'));var urlforward=require(_0x7b58('0x5'));var integration=require(_0x7b58('0x6'));var cmContact=require(_0x7b58('0x7'));var script=require(_0x7b58('0x8'));var cmContactRpc=require(_0x7b58('0x9'));var config=require(_0x7b58('0xa'));var logger=require(_0x7b58('0xb'))('trigger');var ami=require(_0x7b58('0xc'));config[_0x7b58('0xd')]=_[_0x7b58('0xe')](config[_0x7b58('0xd')],{'host':'localhost','port':0x18eb});var io=require(_0x7b58('0xf'))(new Redis(config[_0x7b58('0xd')]));var operators={'equals':function(_0x547843,_0x258630){return _0x547843==_0x258630;},'not_equals':function(_0x15b6a8,_0x468d6b){return _0x15b6a8!=_0x468d6b;}};var barAndWebActions=[_0x7b58('0x10'),_0x7b58('0x2'),_0x7b58('0x11')];function Trigger(_0x281c0c){this['triggers']=_0x281c0c[_0x7b58('0x12')];this[_0x7b58('0x13')]=_0x281c0c[_0x7b58('0x13')];this[_0x7b58('0x14')]=_0x281c0c['voiceQueues'];this[_0x7b58('0x15')]=_0x281c0c['templates'];this[_0x7b58('0x16')]=_0x281c0c['voiceExtensions'];this[_0x7b58('0x17')]=_0x281c0c[_0x7b58('0x17')];this[_0x7b58('0x18')]=_0x281c0c[_0x7b58('0x18')];this[_0x7b58('0x19')]=_0x281c0c[_0x7b58('0x19')];this[_0x7b58('0x1a')]=_0x281c0c[_0x7b58('0x1a')];this[_0x7b58('0x1b')]=_0x281c0c[_0x7b58('0x1b')];this[_0x7b58('0x1c')]=_0x281c0c[_0x7b58('0x1c')];this[_0x7b58('0x1d')]=_0x281c0c[_0x7b58('0x1d')];this[_0x7b58('0x1e')]=_0x281c0c[_0x7b58('0x1e')];this['dynamics365Accounts']=_0x281c0c[_0x7b58('0x1f')];this['freshsalesAccounts']=_0x281c0c['freshsalesAccounts'];this[_0x7b58('0x20')]={'zendesk':this[_0x7b58('0x17')],'salesforce':this[_0x7b58('0x19')],'freshdesk':this[_0x7b58('0x18')],'sugarcrm':this[_0x7b58('0x1a')],'zoho':this[_0x7b58('0x1b')],'desk':this[_0x7b58('0x1c')],'vtiger':this[_0x7b58('0x1d')],'dynamics365':this['dynamics365Accounts'],'freshsales':this[_0x7b58('0x21')],'servicenow':this[_0x7b58('0x1e')]};ami['on'](_0x7b58('0x22'),this['syncCustomEvent'][_0x7b58('0x23')](this));ami['on'](_0x7b58('0x24'),this[_0x7b58('0x25')][_0x7b58('0x23')](this));ami['on']('custom:agentringnoanswer',this[_0x7b58('0x25')][_0x7b58('0x23')](this));ami['on'](_0x7b58('0x26'),this['syncCustomEvent'][_0x7b58('0x23')](this));ami['on'](_0x7b58('0x27'),this[_0x7b58('0x25')][_0x7b58('0x23')](this));ami['on'](_0x7b58('0x28'),this[_0x7b58('0x29')][_0x7b58('0x23')](this));ami['on'](_0x7b58('0x2a'),this[_0x7b58('0x29')][_0x7b58('0x23')](this));ami['on']('custom:dialend',this[_0x7b58('0x29')][_0x7b58('0x23')](this));ami['on'](_0x7b58('0x2b'),this[_0x7b58('0x25')][_0x7b58('0x23')](this));ami['on'](_0x7b58('0x2c'),this[_0x7b58('0x25')][_0x7b58('0x23')](this));ami['on'](_0x7b58('0x2d'),this[_0x7b58('0x25')][_0x7b58('0x23')](this));ami['on'](_0x7b58('0x2e'),this[_0x7b58('0x25')][_0x7b58('0x23')](this));ami['on'](_0x7b58('0x2f'),this['syncCustomEvent'][_0x7b58('0x23')](this));ami['on'](_0x7b58('0x30'),this['syncCustomEvent'][_0x7b58('0x23')](this));}Trigger['prototype'][_0x7b58('0x31')]=function(_0x42a377,_0x392e3a,_0x9ab5ba){logger['info'](_0x42a377,_0x392e3a,JSON[_0x7b58('0x32')](_0x9ab5ba));io['to'](_0x42a377)[_0x7b58('0x31')](_0x392e3a,_0x9ab5ba);};Trigger[_0x7b58('0x33')]['syncCustomEvent']=function(_0x841b46){var _0x4d764d=_[_0x7b58('0x34')](_0x841b46);this[_0x7b58('0x35')](_0x4d764d);};Trigger['prototype'][_0x7b58('0x29')]=function(_0x1226c4){if(this[_0x7b58('0x13')][_0x1226c4['interface']]){this['syncCustomEvent'](_0x1226c4);}};Trigger['prototype'][_0x7b58('0x35')]=function(_0x59cd60){var _0x54e32b;for(var _0x1582a4 in this['triggers']){if(this[_0x7b58('0x12')]['hasOwnProperty'](_0x1582a4)){if(this[_0x7b58('0x12')][_0x1582a4][_0x7b58('0x36')]){_0x54e32b=this['checkTrigger'](this[_0x7b58('0x12')][_0x1582a4],_0x59cd60);if(_0x54e32b){_[_0x7b58('0x37')](_0x59cd60,_0x59cd60['variables']);for(var _0x3742f9=0x0,_0x1fb482,_0x3b3131,_0x155007;_0x3742f90x0){_0x160687=_[_0x33de('0x29')](_0x208d0d,_0x44b10e);}return _0x160687;}function getCustomFields(_0x59bc3b,_0x5ae0e8){var _0x2755e6=[];var _0x1420d2={'custom_fields':{}};if(_0x59bc3b[_0x33de('0x28')]>0x0){_[_0x33de('0x2a')](_0x59bc3b,function(_0x167cec){if(_0x167cec[_0x33de('0x2b')]===_0x33de('0x2c')&&_0x167cec['nameField']&&!_0x167cec[_0x33de('0x2d')]){_0x1420d2[_0x167cec[_0x33de('0x2e')][_0x33de('0x2f')]()]=_0x167cec[_0x33de('0x30')]['toString']();}else if(_0x167cec[_0x33de('0x2b')]===_0x33de('0x2c')&&_0x167cec['idField']&&_0x167cec['customField']){_0x1420d2['custom_fields'][_0x167cec[_0x33de('0x31')]]=_0x167cec[_0x33de('0x30')]['toString']();}else if(_0x167cec[_0x33de('0x2b')]==='variable'&&_0x167cec['variableName']&&_0x167cec[_0x33de('0x31')]&&_0x167cec[_0x33de('0x2d')]){_0x5ae0e8[_0x167cec[_0x33de('0x32')]]&&(_0x1420d2[_0x33de('0x33')][_0x167cec[_0x33de('0x31')]]=_0x5ae0e8[_0x167cec[_0x33de('0x32')]][_0x33de('0x34')]());}else if(_0x167cec[_0x33de('0x2b')]==='customVariable'&&_0x167cec[_0x33de('0x35')]&&_0x167cec['Variable'][_0x33de('0x36')]&&_0x167cec['idField']&&_0x167cec['customField']){_0x5ae0e8[_0x167cec[_0x33de('0x35')][_0x33de('0x36')][_0x33de('0x2f')]()]&&(_0x1420d2[_0x33de('0x33')][_0x167cec[_0x33de('0x31')]]=_0x5ae0e8[_0x167cec[_0x33de('0x35')]['name'][_0x33de('0x2f')]()][_0x33de('0x34')]());}});}if(_0x1420d2[_0x33de('0x37')]){_0x1420d2[_0x33de('0x37')]=Number(_0x1420d2[_0x33de('0x37')]);}return _0x1420d2;}function getTicket(_0x9f5688,_0x59c618,_0x483c24,_0x4bd6f2,_0x1497f0){logger[_0x33de('0xc')](_0x33de('0x38'));var _0x46ddfe=_[_0x33de('0x39')]({'subject':intUtil[_0x33de('0x3a')](_0x4bd6f2['Subjects'],_0x1497f0,'\x20'),'type':_0x33de('0x3b'),'status':_0x33de('0x3c'),'labels':[_0x33de('0x3d'),_0x33de('0x3e'),_0x33de('0x3f')][_0x33de('0x40')](getTags(_0x4bd6f2['Tags'],_0x33de('0x36'))),'description':intUtil['getString'](_0x4bd6f2[_0x33de('0x41')],_0x1497f0,'\x0a'),'_links':{'assigned_user':{'href':util[_0x33de('0xe')]('/api/v2/users/%d',_0x59c618['id']),'class':_0x33de('0x42')}},'message':{'direction':'in','body':intUtil[_0x33de('0x3a')](_0x4bd6f2[_0x33de('0x41')],_0x1497f0,'\x0a')}},getCustomFields(_0x4bd6f2[_0x33de('0x43')],_0x1497f0));return request({'uri':util[_0x33de('0xe')](_0x33de('0x44'),_0x9f5688[_0x33de('0x10')],_0x483c24['id']),'method':_0x33de('0x26'),'body':_0x46ddfe});}exports[_0x33de('0x45')]=function(_0x4ca995,_0x5101b9,_0x417d9b,_0x1f75f7,_0x20d04f,_0x376c55){var _0x54acde,_0x2ac6a0;_0x376c55['remoteUri']=intUtil['stripTrailingSlash'](_0x376c55[_0x33de('0x10')]);_0x376c55[_0x33de('0x46')]=intUtil[_0x33de('0x47')](_0x376c55[_0x33de('0x46')]);if(_0x20d04f&&_0x20d04f[_0x33de('0x48')]){logger[_0x33de('0xc')](_0x33de('0x49'),'Recording\x20is\x20enabled!');_0x5101b9[_0x33de('0x4a')]=util['format'](_0x33de('0x4b'),_0x376c55['serverUrl'],_0x5101b9[_0x33de('0x4c')],md5(_0x5101b9[_0x33de('0x4c')]));}else{_0x5101b9['recordingURL']='';}headers[_0x33de('0x4d')]=getAuth(_0x376c55);return getUser(_0x376c55,_0x1f75f7[_0x33de('0x4e')])[_0x33de('0x11')](function(_0x5f26ed){_0x54acde=_0x5f26ed;logger['info'](_0x33de('0x4f'),_0x54acde['id']);return getEndUser(_0x376c55,_0x5101b9[_0x33de('0x50')],_0x5101b9['calleridnum']);})['then'](function(_0x44be7b){_0x2ac6a0=_0x44be7b;logger['info']('The\x20Enduser\x20ID\x20is:',_0x2ac6a0['id']);return getTicket(_0x376c55,_0x54acde,_0x2ac6a0,_0x417d9b,_0x5101b9);})['then'](function(_0x17ed09){if(_0x17ed09){logger[_0x33de('0xc')](_0x33de('0x51'));logger[_0x33de('0xc')]('The\x20Ticket\x20ID\x20is:',_0x17ed09['id']);switch(_0x376c55['type']){case _0x33de('0x52'):logger[_0x33de('0xc')]('[QUEUE]',_0x33de('0x53'));emit(util[_0x33de('0xe')](_0x33de('0x54'),_0x1f75f7[_0x33de('0x36')]),_0x33de('0x55'),{'recordId':_0x17ed09['id']});break;case'newTab':logger[_0x33de('0xc')](_0x33de('0x49'),'Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...');emit(util[_0x33de('0xe')](_0x33de('0x54'),_0x1f75f7[_0x33de('0x36')]),_0x33de('0x56'),{'uri':util[_0x33de('0xe')](_0x33de('0x57'),_0x17ed09['id'])});break;default:logger[_0x33de('0x58')](_0x33de('0x49'),_0x33de('0x59'));}}})[_0x33de('0x5a')](function(_0x4d9bfc){console[_0x33de('0x58')](_0x4d9bfc);logger[_0x33de('0x58')](_0x33de('0x49'),JSON[_0x33de('0x19')](_0x4d9bfc));});};exports[_0x33de('0x5b')]=function(_0x3fe65d,_0x5c91e7,_0x49e1d9,_0x109ec5,_0x32042e,_0x3c8904,_0x4f0e9f){var _0x9ffde7,_0xc8d1b;_0x3c8904[_0x33de('0x10')]=intUtil[_0x33de('0x47')](_0x3c8904['remoteUri']);_0x3c8904['serverUrl']=intUtil[_0x33de('0x47')](_0x3c8904[_0x33de('0x46')]);if(_0x4f0e9f&&_0x4f0e9f[_0x33de('0x5c')]&&_0x4f0e9f[_0x33de('0x5c')]!==_0x33de('0x5d')){logger['info']('[OUTBOUND]',_0x33de('0x5e'));_0x5c91e7[_0x33de('0x4a')]=util[_0x33de('0xe')](_0x33de('0x4b'),_0x3c8904[_0x33de('0x46')],_0x5c91e7[_0x33de('0x4c')],md5(_0x5c91e7[_0x33de('0x4c')]));}headers[_0x33de('0x4d')]=getAuth(_0x3c8904);return getUser(_0x3c8904,_0x109ec5[_0x33de('0x4e')])['then'](function(_0x14c94c){_0x9ffde7=_0x14c94c;logger[_0x33de('0xc')](_0x33de('0x4f'),_0x9ffde7['id']);return getEndUser(_0x3c8904,_0x5c91e7['destcalleridname'],_0x5c91e7[_0x33de('0x5f')]);})['then'](function(_0x4b07cf){_0xc8d1b=_0x4b07cf;logger['info']('The\x20Enduser\x20ID\x20is:',_0xc8d1b['id']);return getTicket(_0x3c8904,_0x9ffde7,_0xc8d1b,_0x49e1d9,_0x5c91e7);})[_0x33de('0x11')](function(_0x36c4a2){if(_0x36c4a2){logger['info'](_0x33de('0x51'));logger[_0x33de('0xc')]('The\x20Ticket\x20ID\x20is:',_0x36c4a2['id']);switch(_0x3c8904[_0x33de('0x2b')]){case _0x33de('0x52'):logger['info'](_0x33de('0x49'),_0x33de('0x53'));emit(util[_0x33de('0xe')](_0x33de('0x54'),_0x109ec5[_0x33de('0x36')]),_0x33de('0x55'),{'recordId':_0x36c4a2['id']});break;case _0x33de('0x60'):logger['info']('[QUEUE]',_0x33de('0x61'));emit(util['format'](_0x33de('0x54'),_0x109ec5[_0x33de('0x36')]),'trigger:browser:url',{'uri':util[_0x33de('0xe')]('%s/agent/tickets/%s',_0x3c8904[_0x33de('0x10')],_0x36c4a2['id'])});break;default:logger[_0x33de('0x58')]('[OUTBOUND]','Desk\x20account\x20type\x20not\x20recognized');}}})[_0x33de('0x5a')](function(_0x1b2d6f){logger[_0x33de('0x58')](_0x33de('0x62'),JSON[_0x33de('0x19')](_0x1b2d6f));});};exports['abandoned']=function(_0x221038,_0x143124,_0x5d4ffd,_0xa10291,_0x375bda,_0x514473){var _0x151551,_0x37fc3a;_0x514473['remoteUri']=intUtil['stripTrailingSlash'](_0x514473[_0x33de('0x10')]);_0x514473['serverUrl']=intUtil[_0x33de('0x47')](_0x514473['serverUrl']);if(_0x375bda&&_0x375bda[_0x33de('0x48')]){logger['info']('[ABANDONED]','Recording\x20is\x20enabled!');_0x143124['recordingURL']=util['format']('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x514473[_0x33de('0x46')],_0x143124['uniqueid'],md5(_0x143124[_0x33de('0x4c')]));}else{_0x143124['recordingURL']='';}headers['Authorization']=getAuth(_0x514473);return getUser(_0x514473)[_0x33de('0x11')](function(_0x3754aa){_0x151551=_0x3754aa;logger[_0x33de('0xc')](_0x33de('0x4f'),_0x151551['id']);return getEndUser(_0x514473,_0x143124[_0x33de('0x50')],_0x143124[_0x33de('0x63')]);})[_0x33de('0x11')](function(_0x659652){_0x37fc3a=_0x659652;logger['info'](_0x33de('0x64'),_0x37fc3a['id']);return getTicket(_0x514473,_0x151551,_0x37fc3a,_0x5d4ffd,_0x143124);})['then'](function(_0x3e9ade){if(_0x3e9ade){logger[_0x33de('0xc')](_0x33de('0x51'));logger[_0x33de('0xc')](_0x33de('0x65'),_0x3e9ade['id']);}})[_0x33de('0x5a')](function(_0x2a6004){logger[_0x33de('0x58')](_0x33de('0x66'),JSON[_0x33de('0x19')](_0x2a6004));});}; \ No newline at end of file +var _0x4fc2=['customField','nameField','toLowerCase','content','type','custom_fields','toString','variable','variableName','idField','customVariable','Variable','name','priority','merge','getString','Subjects','new','xCALLY','CTI','Tags','Descriptions','/api/v2/users/%d','user','Fields','%s/customers/%d/cases','queue','stripTrailingSlash','serverUrl','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','recordingURL','Authorization','calleridname','Ticket\x20created!','The\x20Ticket\x20ID\x20is:','integrationTab','Displaying\x20ticket\x20to\x20agent...','user:%s','newTab','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','trigger:browser:url','https://xcally.desk.com/web/agent/case/%d','error','catch','outbound','recordingFormat','none','[OUTBOUND]','email','destcalleridname','The\x20Enduser\x20ID\x20is:','trigger:desk:display','%s/agent/tickets/%s','Desk\x20account\x20type\x20not\x20recognized','abandoned','[ABANDONED]','The\x20User\x20ID\x20is:','lodash','request-promise','md5','util','./util','../../../../config/environment','../../../../config/logger','redis','defaults','localhost','socket.io-emitter','emit','application/json','validateEmail','info','Getting\x20agent\x20with\x20email','format','%s/users','remoteUri','then','total_entries','find','entries','Agent\x20found!','%s/users/me','debug','[HTTP]','stringify','GET','authType','%s:%s','username','token','%s/token:%s','Basic\x20%s','base64','%s/customers/search','Enduser\x20found!','_embedded','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!','%s/customers','POST','work','length','string'];(function(_0x4c9800,_0x451bea){var _0xc4030e=function(_0x14084c){while(--_0x14084c){_0x4c9800['push'](_0x4c9800['shift']());}};_0xc4030e(++_0x451bea);}(_0x4fc2,0x111));var _0x24fc=function(_0x5ca47b,_0x1734e0){_0x5ca47b=_0x5ca47b-0x0;var _0x398fab=_0x4fc2[_0x5ca47b];return _0x398fab;};'use strict';var _=require(_0x24fc('0x0'));var rp=require(_0x24fc('0x1'));var md5=require(_0x24fc('0x2'));var util=require(_0x24fc('0x3'));var Redis=require('ioredis');var intUtil=require(_0x24fc('0x4'));var config=require(_0x24fc('0x5'));var logger=require(_0x24fc('0x6'))('desk');config[_0x24fc('0x7')]=_[_0x24fc('0x8')](config['redis'],{'host':_0x24fc('0x9'),'port':0x18eb});var io=require(_0x24fc('0xa'))(new Redis(config['redis']));function emit(_0x115851,_0x22a0c8,_0x220f9a){io['to'](_0x115851)[_0x24fc('0xb')](_0x22a0c8,_0x220f9a);}var headers={'Content-Type':_0x24fc('0xc'),'Accept':_0x24fc('0xc')};function getUser(_0x5afdf1,_0x44caca){if(intUtil[_0x24fc('0xd')](_0x44caca)===!![]){logger[_0x24fc('0xe')](_0x24fc('0xf'),_0x44caca);return request({'uri':util[_0x24fc('0x10')](_0x24fc('0x11'),_0x5afdf1[_0x24fc('0x12')])})[_0x24fc('0x13')](function(_0x500ee0){if(_0x500ee0[_0x24fc('0x14')]){return _[_0x24fc('0x15')](_0x500ee0['_embedded'][_0x24fc('0x16')],{'email':_0x44caca});}})[_0x24fc('0x13')](function(_0x3f6d8b){if(_0x3f6d8b){logger[_0x24fc('0xe')](_0x24fc('0x17'));return _0x3f6d8b;}else{logger[_0x24fc('0xe')]('Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!');return request({'uri':util[_0x24fc('0x10')](_0x24fc('0x18'),_0x5afdf1[_0x24fc('0x12')])});}});}else{logger[_0x24fc('0xe')]('Invalid\x20email\x20format,\x20using\x20the\x20admin\x20account!');return request({'uri':util[_0x24fc('0x10')]('%s/users/me',_0x5afdf1[_0x24fc('0x12')])});}}function request(_0x3385c7){logger[_0x24fc('0x19')](_0x24fc('0x1a'),JSON[_0x24fc('0x1b')](_0x3385c7));return rp(_['defaults'](_0x3385c7,{'method':_0x24fc('0x1c'),'headers':headers,'json':!![]}));}function getAuth(_0x1cb3d0){var _0x6cfa0a;if(_0x1cb3d0[_0x24fc('0x1d')]==='basic'){_0x6cfa0a=util[_0x24fc('0x10')](_0x24fc('0x1e'),_0x1cb3d0[_0x24fc('0x1f')],_0x1cb3d0['password']);}else if(_0x1cb3d0[_0x24fc('0x1d')]===_0x24fc('0x20')){_0x6cfa0a=util[_0x24fc('0x10')](_0x24fc('0x21'),_0x1cb3d0['username'],_0x1cb3d0[_0x24fc('0x20')]);}return util['format'](_0x24fc('0x22'),new Buffer(_0x6cfa0a)['toString'](_0x24fc('0x23')));}function getEndUser(_0x44c121,_0x2ffade,_0x595475){logger[_0x24fc('0xe')]('Searching\x20enduser\x20with\x20phone',_0x595475);return request({'uri':util[_0x24fc('0x10')](_0x24fc('0x24'),_0x44c121[_0x24fc('0x12')]),'qs':{'phone':_0x595475}})[_0x24fc('0x13')](function(_0x3296fc){if(_0x3296fc[_0x24fc('0x14')]){logger[_0x24fc('0xe')](_0x24fc('0x25'));return _0x3296fc[_0x24fc('0x26')][_0x24fc('0x16')][0x0];}else{logger['info'](_0x24fc('0x27'));return request({'uri':util[_0x24fc('0x10')](_0x24fc('0x28'),_0x44c121['remoteUri']),'method':_0x24fc('0x29'),'body':{'first_name':_0x2ffade,'title':_0x2ffade,'phone_numbers':[{'type':_0x24fc('0x2a'),'value':_0x595475}]}});}});}function getTags(_0x35f9f9,_0x290f84){var _0x8f2528=[];if(_0x35f9f9&&_0x35f9f9[_0x24fc('0x2b')]>0x0){_0x8f2528=_['map'](_0x35f9f9,_0x290f84);}return _0x8f2528;}function getCustomFields(_0x240ae7,_0x29a461){var _0x3c99ed=[];var _0x1c5146={'custom_fields':{}};if(_0x240ae7[_0x24fc('0x2b')]>0x0){_['forEach'](_0x240ae7,function(_0x55c27f){if(_0x55c27f['type']===_0x24fc('0x2c')&&_0x55c27f['nameField']&&!_0x55c27f[_0x24fc('0x2d')]){_0x1c5146[_0x55c27f[_0x24fc('0x2e')][_0x24fc('0x2f')]()]=_0x55c27f[_0x24fc('0x30')]['toString']();}else if(_0x55c27f[_0x24fc('0x31')]===_0x24fc('0x2c')&&_0x55c27f['idField']&&_0x55c27f[_0x24fc('0x2d')]){_0x1c5146[_0x24fc('0x32')][_0x55c27f['idField']]=_0x55c27f['content'][_0x24fc('0x33')]();}else if(_0x55c27f['type']===_0x24fc('0x34')&&_0x55c27f[_0x24fc('0x35')]&&_0x55c27f['idField']&&_0x55c27f[_0x24fc('0x2d')]){_0x29a461[_0x55c27f[_0x24fc('0x35')]]&&(_0x1c5146[_0x24fc('0x32')][_0x55c27f[_0x24fc('0x36')]]=_0x29a461[_0x55c27f[_0x24fc('0x35')]][_0x24fc('0x33')]());}else if(_0x55c27f[_0x24fc('0x31')]===_0x24fc('0x37')&&_0x55c27f[_0x24fc('0x38')]&&_0x55c27f['Variable'][_0x24fc('0x39')]&&_0x55c27f[_0x24fc('0x36')]&&_0x55c27f[_0x24fc('0x2d')]){_0x29a461[_0x55c27f[_0x24fc('0x38')][_0x24fc('0x39')]['toLowerCase']()]&&(_0x1c5146['custom_fields'][_0x55c27f[_0x24fc('0x36')]]=_0x29a461[_0x55c27f['Variable'][_0x24fc('0x39')][_0x24fc('0x2f')]()][_0x24fc('0x33')]());}});}if(_0x1c5146[_0x24fc('0x3a')]){_0x1c5146['priority']=Number(_0x1c5146[_0x24fc('0x3a')]);}return _0x1c5146;}function getTicket(_0x4f4ec8,_0x65771d,_0x3b8fb6,_0x3834d7,_0x2485d8){logger[_0x24fc('0xe')]('Creating\x20new\x20ticket...');var _0xadedb4=_[_0x24fc('0x3b')]({'subject':intUtil[_0x24fc('0x3c')](_0x3834d7[_0x24fc('0x3d')],_0x2485d8,'\x20'),'type':'phone','status':_0x24fc('0x3e'),'labels':[_0x24fc('0x3f'),'Motion',_0x24fc('0x40')]['concat'](getTags(_0x3834d7[_0x24fc('0x41')],_0x24fc('0x39'))),'description':intUtil[_0x24fc('0x3c')](_0x3834d7[_0x24fc('0x42')],_0x2485d8,'\x0a'),'_links':{'assigned_user':{'href':util[_0x24fc('0x10')](_0x24fc('0x43'),_0x65771d['id']),'class':_0x24fc('0x44')}},'message':{'direction':'in','body':intUtil[_0x24fc('0x3c')](_0x3834d7['Descriptions'],_0x2485d8,'\x0a')}},getCustomFields(_0x3834d7[_0x24fc('0x45')],_0x2485d8));return request({'uri':util[_0x24fc('0x10')](_0x24fc('0x46'),_0x4f4ec8['remoteUri'],_0x3b8fb6['id']),'method':_0x24fc('0x29'),'body':_0xadedb4});}exports[_0x24fc('0x47')]=function(_0x4ae4a7,_0x2c4a6c,_0x22f30b,_0x2c598c,_0x5e4e9b,_0x31ddd0){var _0x3af80a,_0x585e48;_0x31ddd0[_0x24fc('0x12')]=intUtil[_0x24fc('0x48')](_0x31ddd0[_0x24fc('0x12')]);_0x31ddd0[_0x24fc('0x49')]=intUtil['stripTrailingSlash'](_0x31ddd0[_0x24fc('0x49')]);if(_0x5e4e9b&&_0x5e4e9b[_0x24fc('0x4a')]){logger[_0x24fc('0xe')](_0x24fc('0x4b'),_0x24fc('0x4c'));_0x2c4a6c['recordingURL']=util[_0x24fc('0x10')](_0x24fc('0x4d'),_0x31ddd0[_0x24fc('0x49')],_0x2c4a6c[_0x24fc('0x4e')],md5(_0x2c4a6c['uniqueid']));}else{_0x2c4a6c[_0x24fc('0x4f')]='';}headers[_0x24fc('0x50')]=getAuth(_0x31ddd0);return getUser(_0x31ddd0,_0x2c598c['email'])['then'](function(_0x38dedd){_0x3af80a=_0x38dedd;logger['info']('The\x20User\x20ID\x20is:',_0x3af80a['id']);return getEndUser(_0x31ddd0,_0x2c4a6c[_0x24fc('0x51')],_0x2c4a6c['calleridnum']);})[_0x24fc('0x13')](function(_0x264854){_0x585e48=_0x264854;logger[_0x24fc('0xe')]('The\x20Enduser\x20ID\x20is:',_0x585e48['id']);return getTicket(_0x31ddd0,_0x3af80a,_0x585e48,_0x22f30b,_0x2c4a6c);})[_0x24fc('0x13')](function(_0x23c1d4){if(_0x23c1d4){logger[_0x24fc('0xe')](_0x24fc('0x52'));logger[_0x24fc('0xe')](_0x24fc('0x53'),_0x23c1d4['id']);switch(_0x31ddd0[_0x24fc('0x31')]){case _0x24fc('0x54'):logger['info']('[QUEUE]',_0x24fc('0x55'));emit(util[_0x24fc('0x10')](_0x24fc('0x56'),_0x2c598c['name']),'trigger:desk:display',{'recordId':_0x23c1d4['id']});break;case _0x24fc('0x57'):logger[_0x24fc('0xe')](_0x24fc('0x4b'),_0x24fc('0x58'));emit(util[_0x24fc('0x10')](_0x24fc('0x56'),_0x2c598c[_0x24fc('0x39')]),_0x24fc('0x59'),{'uri':util[_0x24fc('0x10')](_0x24fc('0x5a'),_0x23c1d4['id'])});break;default:logger[_0x24fc('0x5b')](_0x24fc('0x4b'),'Desk\x20account\x20type\x20not\x20recognized');}}})[_0x24fc('0x5c')](function(_0x25ec42){console[_0x24fc('0x5b')](_0x25ec42);logger[_0x24fc('0x5b')](_0x24fc('0x4b'),JSON['stringify'](_0x25ec42));});};exports[_0x24fc('0x5d')]=function(_0x4bf3a8,_0x2c8f74,_0x2ee445,_0x446c14,_0x41ddfb,_0x40f42b,_0x3dd8e0){var _0x4c9216,_0xb1fb56;_0x40f42b[_0x24fc('0x12')]=intUtil[_0x24fc('0x48')](_0x40f42b[_0x24fc('0x12')]);_0x40f42b[_0x24fc('0x49')]=intUtil[_0x24fc('0x48')](_0x40f42b['serverUrl']);if(_0x3dd8e0&&_0x3dd8e0[_0x24fc('0x5e')]&&_0x3dd8e0[_0x24fc('0x5e')]!==_0x24fc('0x5f')){logger[_0x24fc('0xe')](_0x24fc('0x60'),_0x24fc('0x4c'));_0x2c8f74[_0x24fc('0x4f')]=util['format'](_0x24fc('0x4d'),_0x40f42b[_0x24fc('0x49')],_0x2c8f74['uniqueid'],md5(_0x2c8f74[_0x24fc('0x4e')]));}headers[_0x24fc('0x50')]=getAuth(_0x40f42b);return getUser(_0x40f42b,_0x446c14[_0x24fc('0x61')])[_0x24fc('0x13')](function(_0x36e159){_0x4c9216=_0x36e159;logger[_0x24fc('0xe')]('The\x20User\x20ID\x20is:',_0x4c9216['id']);return getEndUser(_0x40f42b,_0x2c8f74[_0x24fc('0x62')],_0x2c8f74['destcalleridnum']);})[_0x24fc('0x13')](function(_0x8c9649){_0xb1fb56=_0x8c9649;logger['info'](_0x24fc('0x63'),_0xb1fb56['id']);return getTicket(_0x40f42b,_0x4c9216,_0xb1fb56,_0x2ee445,_0x2c8f74);})['then'](function(_0x1c1f74){if(_0x1c1f74){logger['info'](_0x24fc('0x52'));logger[_0x24fc('0xe')]('The\x20Ticket\x20ID\x20is:',_0x1c1f74['id']);switch(_0x40f42b[_0x24fc('0x31')]){case'integrationTab':logger[_0x24fc('0xe')](_0x24fc('0x4b'),'Displaying\x20ticket\x20to\x20agent...');emit(util[_0x24fc('0x10')](_0x24fc('0x56'),_0x446c14[_0x24fc('0x39')]),_0x24fc('0x64'),{'recordId':_0x1c1f74['id']});break;case _0x24fc('0x57'):logger['info'](_0x24fc('0x4b'),_0x24fc('0x58'));emit(util[_0x24fc('0x10')](_0x24fc('0x56'),_0x446c14[_0x24fc('0x39')]),'trigger:browser:url',{'uri':util['format'](_0x24fc('0x65'),_0x40f42b[_0x24fc('0x12')],_0x1c1f74['id'])});break;default:logger['error']('[OUTBOUND]',_0x24fc('0x66'));}}})[_0x24fc('0x5c')](function(_0x28ef6a){logger[_0x24fc('0x5b')]('[OUTBOUND]',JSON[_0x24fc('0x1b')](_0x28ef6a));});};exports[_0x24fc('0x67')]=function(_0x14427b,_0x11cc5d,_0x1df0c4,_0x3e896f,_0x26ac2e,_0xa80507){var _0xbe136e,_0x1f6a71;_0xa80507[_0x24fc('0x12')]=intUtil[_0x24fc('0x48')](_0xa80507[_0x24fc('0x12')]);_0xa80507[_0x24fc('0x49')]=intUtil[_0x24fc('0x48')](_0xa80507['serverUrl']);if(_0x26ac2e&&_0x26ac2e[_0x24fc('0x4a')]){logger[_0x24fc('0xe')](_0x24fc('0x68'),_0x24fc('0x4c'));_0x11cc5d[_0x24fc('0x4f')]=util[_0x24fc('0x10')](_0x24fc('0x4d'),_0xa80507[_0x24fc('0x49')],_0x11cc5d['uniqueid'],md5(_0x11cc5d[_0x24fc('0x4e')]));}else{_0x11cc5d[_0x24fc('0x4f')]='';}headers[_0x24fc('0x50')]=getAuth(_0xa80507);return getUser(_0xa80507)[_0x24fc('0x13')](function(_0x55fceb){_0xbe136e=_0x55fceb;logger[_0x24fc('0xe')](_0x24fc('0x69'),_0xbe136e['id']);return getEndUser(_0xa80507,_0x11cc5d['calleridname'],_0x11cc5d['calleridnum']);})['then'](function(_0x2ae2ac){_0x1f6a71=_0x2ae2ac;logger[_0x24fc('0xe')](_0x24fc('0x63'),_0x1f6a71['id']);return getTicket(_0xa80507,_0xbe136e,_0x1f6a71,_0x1df0c4,_0x11cc5d);})[_0x24fc('0x13')](function(_0x333a34){if(_0x333a34){logger[_0x24fc('0xe')]('Ticket\x20created!');logger[_0x24fc('0xe')](_0x24fc('0x53'),_0x333a34['id']);}})['catch'](function(_0x51b1c0){logger[_0x24fc('0x5b')](_0x24fc('0x68'),JSON[_0x24fc('0x1b')](_0x51b1c0));});}; \ 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 88014f4..f4d765e 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 _0x42e5=['Subjects','Descriptions','callDirection','queue','ticketId','format','%s/main.aspx?pagetype=entityrecord&etn=%s&id=%s','user:%s','emit','stripTrailingSlash','serverUrl','abandoned','https://login.microsoftonline.com/%s/oauth2/token','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','recordingFormat','none','[OUTBOUND]',']\x20The\x20User\x20ID\x20is:',']\x20The\x20User\x20email\x20is:',']\x20The\x20Enduser\x20ID\x20is:',']\x20The\x20Enduser\x20phone\x20is:',']\x20The\x20%s\x20ID\x20is:\x20%s',']\x20Call\x20direction:\x20%s','Displaying\x20call\x20in\x20a\x20new\x20tab...','inspect','lodash','bluebird','request-promise','util','./util','md5','ioredis','../../../../config/logger','../../../../config/environment','defaults','localhost','socket.io-emitter','redis','POST','clientId','remoteUri','username','password','then','access_token','catch','error','toUpperCase',']\x20Wrong\x20credentials!','message','GET','systemusers?$select=internalemailaddress,isdisabled,systemuserid','Bearer\x20','4.0','isNil','userEmail','email','length','internalemailaddress','info',']\x20Agent\x20found\x20','systemuserid',']\x20Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','userId','destcalleridnum','calleridnum','/systemusers(','headers','odata-entityid','substring','lastIndexOf','enduserId','value','toLowerCase','outbound','telephone1','contactid',']\x20Enduser\x20created!','type','nameField','customField','idField','indexOf','content','ticketType','incident','assign','getString','/contacts(','phonecall','phonecalls'];(function(_0x515da8,_0x3b69d2){var _0x10da36=function(_0x50e50b){while(--_0x50e50b){_0x515da8['push'](_0x515da8['shift']());}};_0x10da36(++_0x3b69d2);}(_0x42e5,0xde));var _0x542e=function(_0x18ab9b,_0x5de071){_0x18ab9b=_0x18ab9b-0x0;var _0x15087=_0x42e5[_0x18ab9b];return _0x15087;};'use strict';var _=require(_0x542e('0x0'));var BPromise=require(_0x542e('0x1'));var rp=require(_0x542e('0x2'));var util=require(_0x542e('0x3'));var intUtil=require(_0x542e('0x4'));var md5=require(_0x542e('0x5'));var Redis=require(_0x542e('0x6'));var logger=require(_0x542e('0x7'))('dynamics365');var config=require(_0x542e('0x8'));config['redis']=_[_0x542e('0x9')](config['redis'],{'host':_0x542e('0xa'),'port':0x18eb});var io=require(_0x542e('0xb'))(new Redis(config[_0x542e('0xc')]));function getAuthToken(_0x1c19c6,_0x3fe2f5,_0x1e43f8){var _0x4b8bc7={'method':_0x542e('0xd'),'uri':_0x3fe2f5,'form':{'client_id':_0x1c19c6[_0x542e('0xe')],'resource':_0x1c19c6[_0x542e('0xf')],'username':_0x1c19c6[_0x542e('0x10')],'password':_0x1c19c6[_0x542e('0x11')],'grant_type':_0x542e('0x11'),'client_secret':_0x1c19c6['clientSecret']},'json':!![]};return rp(_0x4b8bc7)[_0x542e('0x12')](function(_0x1f7ff5){return _0x1f7ff5[_0x542e('0x13')];})[_0x542e('0x14')](function(_0x11ff79){logger[_0x542e('0x15')]('['+[_0x1e43f8[_0x542e('0x16')]()]+_0x542e('0x17'));return _0x11ff79[_0x542e('0x18')];});}function getUser(_0x1189e2,_0x1ad405,_0x453005,_0xe00d35,_0x3c5ad5,_0x5aa87a){return new BPromise(function(_0x1830bd,_0x4740b8){return getAuthToken(_0x1ad405,_0xe00d35,_0x5aa87a)[_0x542e('0x12')](function(_0x513297){var _0x3854d2={'method':_0x542e('0x19'),'uri':_0x3c5ad5+_0x542e('0x1a'),'headers':{'Authorization':_0x542e('0x1b')+_0x513297,'OData-Version':_0x542e('0x1c')},'json':!![]};return rp(_0x3854d2);})[_0x542e('0x12')](function(_0x50f960){var _0x441480=_0x50f960['value'];var _0x28da88=![];var _0x18636f=null;if(!_[_0x542e('0x1d')](_0x453005)){if(intUtil['validateEmail'](_0x453005['email'])){_0x1189e2[_0x542e('0x1e')]=_0x453005[_0x542e('0x1f')];for(_0x18636f=0x0;_0x18636f<_0x441480[_0x542e('0x20')];_0x18636f++){if(_0x441480[_0x18636f][_0x542e('0x21')]===_0x453005['email']&&!_0x441480[_0x18636f]['isdisabled']){_0x28da88=!![];logger[_0x542e('0x22')]('['+[_0x5aa87a[_0x542e('0x16')]()]+_0x542e('0x23')+_0x441480[_0x18636f][_0x542e('0x24')]+'!');_0x1189e2['userId']=_0x441480[_0x18636f][_0x542e('0x24')];}}}}if(!_0x28da88){logger[_0x542e('0x22')]('['+[_0x5aa87a[_0x542e('0x16')]()]+_0x542e('0x25'));_0x1189e2[_0x542e('0x1e')]=_0x1ad405[_0x542e('0x10')];for(_0x18636f=0x0;_0x18636f<_0x441480[_0x542e('0x20')];_0x18636f++){if(_0x441480[_0x18636f][_0x542e('0x21')]===_0x1ad405[_0x542e('0x10')]){_0x1189e2[_0x542e('0x26')]=_0x441480[_0x18636f][_0x542e('0x24')];}}}_0x1830bd(_0x1189e2);})['catch'](function(_0x51a2e7){_0x4740b8(_0x51a2e7['message']);});});}function createEndUser(_0x267d84,_0x57ce0d,_0x1f54c2,_0x439773,_0x54e426,_0x5c6453){return new BPromise(function(_0x3053d8,_0x2e6750){return getAuthToken(_0x57ce0d,_0x1f54c2,_0x5c6453)[_0x542e('0x12')](function(_0x50b6fc){var _0x2f0284=_0x5c6453['toLowerCase']()==='outbound'?_0x54e426[_0x542e('0x27')]:_0x54e426[_0x542e('0x28')];var _0x40e3a1={'method':_0x542e('0xd'),'uri':_0x439773+'contacts','body':{'telephone1':_0x2f0284,'fullname':_0x2f0284,'firstname':_0x2f0284,'lastname':'_','mobilephone':null,'address1_telephone1':null,'ownerid@odata.bind':_0x542e('0x29')+_0x267d84[_0x542e('0x26')]+')'},'headers':{'Authorization':_0x542e('0x1b')+_0x50b6fc,'OData-Version':_0x542e('0x1c')},'json':!![],'resolveWithFullResponse':!![]};return rp(_0x40e3a1);})[_0x542e('0x12')](function(_0x339782){var _0x53cbdb=_0x339782[_0x542e('0x2a')][_0x542e('0x2b')];var _0x540424=_0x53cbdb[_0x542e('0x2c')](_0x53cbdb[_0x542e('0x2d')]('(')+0x1,_0x53cbdb['lastIndexOf'](')'));_0x267d84[_0x542e('0x2e')]=_0x540424;_0x3053d8(_0x267d84);})['catch'](function(_0x3eb6ba){_0x2e6750(_0x3eb6ba[_0x542e('0x18')]);});});}function getEndUser(_0x334c55,_0x5dc1bd,_0xac82e3,_0x4301dc,_0x4f191c,_0xf9d04b){return new BPromise(function(_0x167b79,_0x33651c){return getAuthToken(_0x5dc1bd,_0xac82e3,_0xf9d04b)[_0x542e('0x12')](function(_0x254a9e){var _0x1d22bb={'method':_0x542e('0x19'),'uri':_0x4301dc+'contacts?$select=telephone1','headers':{'Authorization':_0x542e('0x1b')+_0x254a9e,'If-None-Match':null,'OData-Version':'4.0'},'json':!![]};return rp(_0x1d22bb);})[_0x542e('0x12')](function(_0x44e42b){var _0x2a0c7d=null;if(_0x44e42b){var _0x324657=_0x44e42b[_0x542e('0x2f')];var _0x1202d0=![];for(_0x2a0c7d=0x0;_0x2a0c7d<_0x324657[_0x542e('0x20')];_0x2a0c7d++){var _0x4eba8c=_0xf9d04b[_0x542e('0x30')]()===_0x542e('0x31')?_0x4f191c[_0x542e('0x27')]:_0x4f191c[_0x542e('0x28')];if(_0x324657[_0x2a0c7d][_0x542e('0x32')]===_0x4eba8c){_0x1202d0=!![];_0x334c55[_0x542e('0x2e')]=_0x324657[_0x2a0c7d][_0x542e('0x33')];}}if(_0x1202d0){_0x167b79(_0x334c55);}else{return createEndUser(_0x334c55,_0x5dc1bd,_0xac82e3,_0x4301dc,_0x4f191c,_0xf9d04b)[_0x542e('0x12')](function(_0x1eb9a){logger['info']('['+[_0xf9d04b['toUpperCase']()]+_0x542e('0x34'),_0x1eb9a[_0x542e('0x2e')]);_0x167b79(_0x1eb9a);});}}else{return createEndUser(_0x334c55,_0x5dc1bd,_0xac82e3,_0x4301dc,_0x4f191c,_0xf9d04b)[_0x542e('0x12')](function(_0x110297){logger[_0x542e('0x22')]('['+[_0xf9d04b[_0x542e('0x16')]()]+']\x20Enduser\x20Created!',_0x110297[_0x542e('0x2e')]);_0x167b79(_0x110297);});}});});}function getCustomFields(_0x103321,_0x213061,_0xf1072b){var _0x5c7996={};if(_0x103321[_0x542e('0x20')]>0x0){_['forEach'](_0x103321,function(_0x33e811){if(_0x33e811[_0x542e('0x35')]==='string'&&_0x33e811[_0x542e('0x36')]&&!_0x33e811[_0x542e('0x37')]){var _0x2a8763=_0x33e811[_0x542e('0x38')][_0x542e('0x30')]();var _0x137d12=_0x2a8763[_0x542e('0x2c')](0x0,_0x2a8763[_0x542e('0x39')]('_'));var _0x4176d3=_0x2a8763[_0x542e('0x2c')](_0x2a8763[_0x542e('0x39')]('_')+0x1);if(_0x137d12===_0xf1072b){_0x5c7996[_0x4176d3]=_0x33e811[_0x542e('0x3a')];}}});}return _0x5c7996;}function getTicket(_0x44f99e,_0x4dd9cf,_0x54166f,_0x15b07f,_0x1e65f7,_0x48e3c2,_0xdc9038){return new BPromise(function(_0x11d7c8,_0x1b735c){var _0x374030;return getAuthToken(_0x4dd9cf,_0x54166f,_0xdc9038)[_0x542e('0x12')](function(_0x456cc0){if(_0x48e3c2[_0x542e('0x3b')]===_0x542e('0x3c')){_0x374030={'method':_0x542e('0xd'),'uri':_0x15b07f+'incidents','body':Object[_0x542e('0x3d')]({},{'title':intUtil[_0x542e('0x3e')](_0x48e3c2['Subjects'],_0x1e65f7,'\x20'),'description':intUtil[_0x542e('0x3e')](_0x48e3c2['Descriptions'],_0x1e65f7,'\x0a'),'customerid_contact@odata.bind':_0x542e('0x3f')+_0x44f99e[_0x542e('0x2e')]+')','ownerid@odata.bind':'/systemusers('+_0x44f99e[_0x542e('0x26')]+')','caseorigincode':'1'},getCustomFields(_0x48e3c2['Fields'],_0x1e65f7,_0x48e3c2[_0x542e('0x3b')])),'headers':{'Authorization':'Bearer\x20'+_0x456cc0,'OData-Version':_0x542e('0x1c')},'json':!![],'resolveWithFullResponse':!![]};}if(_0x48e3c2[_0x542e('0x3b')]===_0x542e('0x40')){_0x374030={'method':_0x542e('0xd'),'uri':_0x15b07f+_0x542e('0x41'),'body':Object[_0x542e('0x3d')]({},{'subject':intUtil[_0x542e('0x3e')](_0x48e3c2[_0x542e('0x42')],_0x1e65f7,'\x20'),'phonenumber':String(_0x1e65f7['calleridnum']),'description':intUtil[_0x542e('0x3e')](_0x48e3c2[_0x542e('0x43')],_0x1e65f7,'\x0a'),'regardingobjectid_contact@odata.bind':_0x542e('0x3f')+_0x44f99e[_0x542e('0x2e')]+')','ownerid@odata.bind':_0x542e('0x29')+_0x44f99e[_0x542e('0x26')]+')','directioncode':_0x44f99e[_0x542e('0x44')]==='queue'?![]:!![],'phonecall_activity_parties':[{'partyid_systemuser@odata.bind':_0x542e('0x29')+_0x44f99e['userId']+')','participationtypemask':_0x44f99e[_0x542e('0x44')]===_0x542e('0x45')?0x2:0x1},{'partyid_contact@odata.bind':_0x542e('0x3f')+_0x44f99e[_0x542e('0x2e')]+')','participationtypemask':_0x44f99e[_0x542e('0x44')]==='queue'?0x1:0x2}]},getCustomFields(_0x48e3c2['Fields'],_0x1e65f7,_0x48e3c2[_0x542e('0x3b')])),'headers':{'Authorization':'Bearer\x20'+_0x456cc0,'OData-Version':_0x542e('0x1c')},'json':!![],'resolveWithFullResponse':!![]};}return rp(_0x374030);})[_0x542e('0x12')](function(_0x378eee){var _0x5c5223=_0x378eee[_0x542e('0x2a')][_0x542e('0x2b')];var _0x46b3f8=_0x5c5223[_0x542e('0x2c')](_0x5c5223[_0x542e('0x2d')]('(')+0x1,_0x5c5223[_0x542e('0x2d')](')'));_0x44f99e[_0x542e('0x46')]=_0x46b3f8;_0x11d7c8(_0x44f99e);})['catch'](function(_0x23c738){_0x1b735c(_0x23c738[_0x542e('0x18')]);});});}function emit(_0x5c9fce,_0x207f1d,_0x1b7fa7,_0x534a1e){var _0x5a2503={'uri':util[_0x542e('0x47')](_0x542e('0x48'),_0x5c9fce,_0x1b7fa7,_0x534a1e)};io['to'](util['format'](_0x542e('0x49'),_0x207f1d))[_0x542e('0x4a')]('trigger:browser:url',_0x5a2503);}exports['cs']=function(_0x419581,_0x512988,_0x14b7fa,_0x3e043c,_0x3358d8,_0x54860c,_0x288168,_0x36518a){var _0x5276ae={};_0x54860c[_0x542e('0xf')]=intUtil[_0x542e('0x4b')](_0x54860c['remoteUri']);_0x54860c[_0x542e('0x4c')]=intUtil['stripTrailingSlash'](_0x54860c[_0x542e('0x4c')]);_0x5276ae[_0x542e('0x44')]=_0x36518a==='queue'||_0x36518a===_0x542e('0x4d')?_0x542e('0x45'):_0x542e('0x31');var _0x4be608=util[_0x542e('0x47')]('%s/api/data/v9.0/',_0x54860c['remoteUri']);var _0x45f478=util[_0x542e('0x47')](_0x542e('0x4e'),_0x54860c['tenantId']);var _0x41bc20=util[_0x542e('0x47')](_0x542e('0x4f'),_0x54860c[_0x542e('0x4c')],_0x512988['uniqueid'],md5(_0x512988[_0x542e('0x50')]));if(_0x3358d8&&_0x3358d8[_0x542e('0x51')]){logger[_0x542e('0x22')](_0x542e('0x52'),_0x542e('0x53'));_0x512988[_0x542e('0x54')]=_0x41bc20;}else if(_0x288168&&_0x288168[_0x542e('0x55')]&&_0x288168['recordingFormat']!==_0x542e('0x56')){logger['info'](_0x542e('0x57'),'Recording\x20is\x20enabled!');_0x512988['recordingURL']=_0x41bc20;}else{_0x512988[_0x542e('0x54')]='';}return getUser(_0x5276ae,_0x54860c,_0x3e043c,_0x45f478,_0x4be608,_0x36518a)['then'](function(_0x1335ed){logger[_0x542e('0x22')]('['+_0x36518a[_0x542e('0x16')]()+_0x542e('0x58'),_0x1335ed[_0x542e('0x26')]);logger['info']('['+_0x36518a[_0x542e('0x16')]()+_0x542e('0x59'),_0x1335ed[_0x542e('0x1e')]);return getEndUser(_0x1335ed,_0x54860c,_0x45f478,_0x4be608,_0x512988,_0x36518a);})[_0x542e('0x12')](function(_0x363069){logger[_0x542e('0x22')]('['+_0x36518a[_0x542e('0x16')]()+_0x542e('0x5a'),_0x363069[_0x542e('0x2e')]);logger['info']('['+_0x36518a['toUpperCase']()+_0x542e('0x5b'),_0x512988[_0x542e('0x28')]);return getTicket(_0x363069,_0x54860c,_0x45f478,_0x4be608,_0x512988,_0x14b7fa,_0x36518a);})[_0x542e('0x12')](function(_0x36b9a9){logger[_0x542e('0x22')](util[_0x542e('0x47')]('['+_0x36518a[_0x542e('0x16')]()+_0x542e('0x5c'),_0x14b7fa[_0x542e('0x3b')],_0x36b9a9[_0x542e('0x46')]));logger[_0x542e('0x22')](util[_0x542e('0x47')]('['+_0x36518a[_0x542e('0x16')]()+_0x542e('0x5d'),_0x36518a));if(_0x36518a!==_0x542e('0x4d')){logger[_0x542e('0x22')]('['+_0x36518a['toUpperCase']()+']',_0x542e('0x5e'));emit(_0x54860c[_0x542e('0xf')],_0x3e043c['name'],_0x14b7fa['ticketType'],_0x36b9a9[_0x542e('0x46')]);}})[_0x542e('0x14')](function(_0x596591){logger[_0x542e('0x15')]('['+_0x36518a[_0x542e('0x16')]()+']\x20Error\x20running\x20Dynamics365\x20integration',util[_0x542e('0x5f')](_0x596591,{'showHidden':!![],'depth':null}));});}; \ No newline at end of file +var _0x1ec3=['format','%s/main.aspx?pagetype=entityrecord&etn=%s&id=%s','user:%s','trigger:browser:url','remoteUri','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','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','recordingFormat','none',']\x20The\x20User\x20ID\x20is:',']\x20The\x20User\x20email\x20is:',']\x20The\x20Enduser\x20ID\x20is:',']\x20The\x20Enduser\x20phone\x20is:',']\x20The\x20%s\x20ID\x20is:\x20%s',']\x20Call\x20direction:\x20%s','name',']\x20Error\x20running\x20Dynamics365\x20integration','inspect','lodash','bluebird','request-promise','util','./util','md5','ioredis','../../../../config/logger','dynamics365','../../../../config/environment','defaults','localhost','socket.io-emitter','redis','POST','username','password','clientSecret','then','catch','error','toUpperCase','GET','systemusers?$select=internalemailaddress,isdisabled,systemuserid','Bearer\x20','4.0','value','isNil','email','userEmail','length','internalemailaddress','info','systemuserid',']\x20Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','userId','message','toLowerCase','calleridnum','contacts','/systemusers(','headers','substring','lastIndexOf','contacts?$select=telephone1','outbound','destcalleridnum','telephone1','enduserId',']\x20Enduser\x20created!','forEach','string','nameField','customField','idField','indexOf','content','ticketType','incident','incidents','assign','getString','Subjects','Descriptions','/contacts(','Fields','phonecall','phonecalls','callDirection','queue','odata-entityid','ticketId'];(function(_0x1957b2,_0x12341d){var _0x37afe2=function(_0xf7c970){while(--_0xf7c970){_0x1957b2['push'](_0x1957b2['shift']());}};_0x37afe2(++_0x12341d);}(_0x1ec3,0x148));var _0x31ec=function(_0xc5ac14,_0x4c2fde){_0xc5ac14=_0xc5ac14-0x0;var _0x47f500=_0x1ec3[_0xc5ac14];return _0x47f500;};'use strict';var _=require(_0x31ec('0x0'));var BPromise=require(_0x31ec('0x1'));var rp=require(_0x31ec('0x2'));var util=require(_0x31ec('0x3'));var intUtil=require(_0x31ec('0x4'));var md5=require(_0x31ec('0x5'));var Redis=require(_0x31ec('0x6'));var logger=require(_0x31ec('0x7'))(_0x31ec('0x8'));var config=require(_0x31ec('0x9'));config['redis']=_[_0x31ec('0xa')](config['redis'],{'host':_0x31ec('0xb'),'port':0x18eb});var io=require(_0x31ec('0xc'))(new Redis(config[_0x31ec('0xd')]));function getAuthToken(_0x3b86d8,_0x371b8e,_0x32d545){var _0x3357d8={'method':_0x31ec('0xe'),'uri':_0x371b8e,'form':{'client_id':_0x3b86d8['clientId'],'resource':_0x3b86d8['remoteUri'],'username':_0x3b86d8[_0x31ec('0xf')],'password':_0x3b86d8[_0x31ec('0x10')],'grant_type':'password','client_secret':_0x3b86d8[_0x31ec('0x11')]},'json':!![]};return rp(_0x3357d8)[_0x31ec('0x12')](function(_0x1c58a9){return _0x1c58a9['access_token'];})[_0x31ec('0x13')](function(_0x31d67e){logger[_0x31ec('0x14')]('['+[_0x32d545[_0x31ec('0x15')]()]+']\x20Wrong\x20credentials!');return _0x31d67e['message'];});}function getUser(_0x117514,_0x2ff10f,_0x4fc3b6,_0xa8411f,_0x17ab20,_0x519763){return new BPromise(function(_0x350725,_0x45b4b2){return getAuthToken(_0x2ff10f,_0xa8411f,_0x519763)[_0x31ec('0x12')](function(_0x19f46d){var _0x171191={'method':_0x31ec('0x16'),'uri':_0x17ab20+_0x31ec('0x17'),'headers':{'Authorization':_0x31ec('0x18')+_0x19f46d,'OData-Version':_0x31ec('0x19')},'json':!![]};return rp(_0x171191);})[_0x31ec('0x12')](function(_0x23fb83){var _0x554a13=_0x23fb83[_0x31ec('0x1a')];var _0x17cfbe=![];var _0xe2370f=null;if(!_[_0x31ec('0x1b')](_0x4fc3b6)){if(intUtil['validateEmail'](_0x4fc3b6[_0x31ec('0x1c')])){_0x117514[_0x31ec('0x1d')]=_0x4fc3b6[_0x31ec('0x1c')];for(_0xe2370f=0x0;_0xe2370f<_0x554a13[_0x31ec('0x1e')];_0xe2370f++){if(_0x554a13[_0xe2370f][_0x31ec('0x1f')]===_0x4fc3b6[_0x31ec('0x1c')]&&!_0x554a13[_0xe2370f]['isdisabled']){_0x17cfbe=!![];logger[_0x31ec('0x20')]('['+[_0x519763[_0x31ec('0x15')]()]+']\x20Agent\x20found\x20'+_0x554a13[_0xe2370f][_0x31ec('0x21')]+'!');_0x117514['userId']=_0x554a13[_0xe2370f][_0x31ec('0x21')];}}}}if(!_0x17cfbe){logger[_0x31ec('0x20')]('['+[_0x519763[_0x31ec('0x15')]()]+_0x31ec('0x22'));_0x117514[_0x31ec('0x1d')]=_0x2ff10f['username'];for(_0xe2370f=0x0;_0xe2370f<_0x554a13['length'];_0xe2370f++){if(_0x554a13[_0xe2370f][_0x31ec('0x1f')]===_0x2ff10f[_0x31ec('0xf')]){_0x117514[_0x31ec('0x23')]=_0x554a13[_0xe2370f][_0x31ec('0x21')];}}}_0x350725(_0x117514);})[_0x31ec('0x13')](function(_0x34ca9d){_0x45b4b2(_0x34ca9d[_0x31ec('0x24')]);});});}function createEndUser(_0xa42e7c,_0x191d45,_0x7d3295,_0x480238,_0x5bc391,_0x4c42d7){return new BPromise(function(_0x44dfe5,_0x56b399){return getAuthToken(_0x191d45,_0x7d3295,_0x4c42d7)[_0x31ec('0x12')](function(_0x452d28){var _0x2d8ecc=_0x4c42d7[_0x31ec('0x25')]()==='outbound'?_0x5bc391['destcalleridnum']:_0x5bc391[_0x31ec('0x26')];var _0x4fcdbc={'method':_0x31ec('0xe'),'uri':_0x480238+_0x31ec('0x27'),'body':{'telephone1':_0x2d8ecc,'fullname':_0x2d8ecc,'firstname':_0x2d8ecc,'lastname':'_','mobilephone':null,'address1_telephone1':null,'ownerid@odata.bind':_0x31ec('0x28')+_0xa42e7c[_0x31ec('0x23')]+')'},'headers':{'Authorization':_0x31ec('0x18')+_0x452d28,'OData-Version':_0x31ec('0x19')},'json':!![],'resolveWithFullResponse':!![]};return rp(_0x4fcdbc);})[_0x31ec('0x12')](function(_0x2590c0){var _0x188907=_0x2590c0[_0x31ec('0x29')]['odata-entityid'];var _0x1df158=_0x188907[_0x31ec('0x2a')](_0x188907['lastIndexOf']('(')+0x1,_0x188907[_0x31ec('0x2b')](')'));_0xa42e7c['enduserId']=_0x1df158;_0x44dfe5(_0xa42e7c);})[_0x31ec('0x13')](function(_0x401d79){_0x56b399(_0x401d79[_0x31ec('0x24')]);});});}function getEndUser(_0xde9858,_0x30665b,_0x4c71d7,_0x51b2f4,_0x175099,_0x1ed4cb){return new BPromise(function(_0x457ff5,_0x413721){return getAuthToken(_0x30665b,_0x4c71d7,_0x1ed4cb)['then'](function(_0x14bf46){var _0x18b33a={'method':'GET','uri':_0x51b2f4+_0x31ec('0x2c'),'headers':{'Authorization':_0x31ec('0x18')+_0x14bf46,'If-None-Match':null,'OData-Version':'4.0'},'json':!![]};return rp(_0x18b33a);})[_0x31ec('0x12')](function(_0x3d6d45){var _0x2bff1f=null;if(_0x3d6d45){var _0x2b7d3c=_0x3d6d45[_0x31ec('0x1a')];var _0x41b441=![];for(_0x2bff1f=0x0;_0x2bff1f<_0x2b7d3c[_0x31ec('0x1e')];_0x2bff1f++){var _0x2697f9=_0x1ed4cb[_0x31ec('0x25')]()===_0x31ec('0x2d')?_0x175099[_0x31ec('0x2e')]:_0x175099['calleridnum'];if(_0x2b7d3c[_0x2bff1f][_0x31ec('0x2f')]===_0x2697f9){_0x41b441=!![];_0xde9858[_0x31ec('0x30')]=_0x2b7d3c[_0x2bff1f]['contactid'];}}if(_0x41b441){_0x457ff5(_0xde9858);}else{return createEndUser(_0xde9858,_0x30665b,_0x4c71d7,_0x51b2f4,_0x175099,_0x1ed4cb)[_0x31ec('0x12')](function(_0x48e1c2){logger[_0x31ec('0x20')]('['+[_0x1ed4cb['toUpperCase']()]+_0x31ec('0x31'),_0x48e1c2[_0x31ec('0x30')]);_0x457ff5(_0x48e1c2);});}}else{return createEndUser(_0xde9858,_0x30665b,_0x4c71d7,_0x51b2f4,_0x175099,_0x1ed4cb)['then'](function(_0x4b3c0c){logger['info']('['+[_0x1ed4cb[_0x31ec('0x15')]()]+']\x20Enduser\x20Created!',_0x4b3c0c[_0x31ec('0x30')]);_0x457ff5(_0x4b3c0c);});}});});}function getCustomFields(_0x431f9a,_0x8bc60e,_0x1b0beb){var _0x4379a9={};if(_0x431f9a[_0x31ec('0x1e')]>0x0){_[_0x31ec('0x32')](_0x431f9a,function(_0x49dba2){if(_0x49dba2['type']===_0x31ec('0x33')&&_0x49dba2[_0x31ec('0x34')]&&!_0x49dba2[_0x31ec('0x35')]){var _0x5a9df4=_0x49dba2[_0x31ec('0x36')][_0x31ec('0x25')]();var _0x43de92=_0x5a9df4[_0x31ec('0x2a')](0x0,_0x5a9df4['indexOf']('_'));var _0x1d1530=_0x5a9df4['substring'](_0x5a9df4[_0x31ec('0x37')]('_')+0x1);if(_0x43de92===_0x1b0beb){_0x4379a9[_0x1d1530]=_0x49dba2[_0x31ec('0x38')];}}});}return _0x4379a9;}function getTicket(_0x475536,_0x26f4da,_0x5cfa76,_0x404a0b,_0x509cf8,_0xd536a,_0x5a67e9){return new BPromise(function(_0x43e50a,_0x502f89){var _0x5e22ec;return getAuthToken(_0x26f4da,_0x5cfa76,_0x5a67e9)[_0x31ec('0x12')](function(_0x44c2f9){if(_0xd536a[_0x31ec('0x39')]===_0x31ec('0x3a')){_0x5e22ec={'method':_0x31ec('0xe'),'uri':_0x404a0b+_0x31ec('0x3b'),'body':Object[_0x31ec('0x3c')]({},{'title':intUtil[_0x31ec('0x3d')](_0xd536a[_0x31ec('0x3e')],_0x509cf8,'\x20'),'description':intUtil[_0x31ec('0x3d')](_0xd536a[_0x31ec('0x3f')],_0x509cf8,'\x0a'),'customerid_contact@odata.bind':_0x31ec('0x40')+_0x475536[_0x31ec('0x30')]+')','ownerid@odata.bind':_0x31ec('0x28')+_0x475536['userId']+')','caseorigincode':'1'},getCustomFields(_0xd536a[_0x31ec('0x41')],_0x509cf8,_0xd536a[_0x31ec('0x39')])),'headers':{'Authorization':_0x31ec('0x18')+_0x44c2f9,'OData-Version':'4.0'},'json':!![],'resolveWithFullResponse':!![]};}if(_0xd536a['ticketType']===_0x31ec('0x42')){_0x5e22ec={'method':_0x31ec('0xe'),'uri':_0x404a0b+_0x31ec('0x43'),'body':Object[_0x31ec('0x3c')]({},{'subject':intUtil['getString'](_0xd536a[_0x31ec('0x3e')],_0x509cf8,'\x20'),'phonenumber':String(_0x509cf8[_0x31ec('0x26')]),'description':intUtil[_0x31ec('0x3d')](_0xd536a[_0x31ec('0x3f')],_0x509cf8,'\x0a'),'regardingobjectid_contact@odata.bind':_0x31ec('0x40')+_0x475536[_0x31ec('0x30')]+')','ownerid@odata.bind':_0x31ec('0x28')+_0x475536[_0x31ec('0x23')]+')','directioncode':_0x475536[_0x31ec('0x44')]===_0x31ec('0x45')?![]:!![],'phonecall_activity_parties':[{'partyid_systemuser@odata.bind':_0x31ec('0x28')+_0x475536[_0x31ec('0x23')]+')','participationtypemask':_0x475536[_0x31ec('0x44')]===_0x31ec('0x45')?0x2:0x1},{'partyid_contact@odata.bind':_0x31ec('0x40')+_0x475536[_0x31ec('0x30')]+')','participationtypemask':_0x475536['callDirection']===_0x31ec('0x45')?0x1:0x2}]},getCustomFields(_0xd536a[_0x31ec('0x41')],_0x509cf8,_0xd536a[_0x31ec('0x39')])),'headers':{'Authorization':_0x31ec('0x18')+_0x44c2f9,'OData-Version':_0x31ec('0x19')},'json':!![],'resolveWithFullResponse':!![]};}return rp(_0x5e22ec);})['then'](function(_0x20d64a){var _0x3b85fb=_0x20d64a[_0x31ec('0x29')][_0x31ec('0x46')];var _0x291a04=_0x3b85fb[_0x31ec('0x2a')](_0x3b85fb[_0x31ec('0x2b')]('(')+0x1,_0x3b85fb['lastIndexOf'](')'));_0x475536[_0x31ec('0x47')]=_0x291a04;_0x43e50a(_0x475536);})[_0x31ec('0x13')](function(_0xe049a0){_0x502f89(_0xe049a0[_0x31ec('0x24')]);});});}function emit(_0x49dae5,_0x4f8963,_0x41eca9,_0x3b3a0e){var _0x38cced={'uri':util[_0x31ec('0x48')](_0x31ec('0x49'),_0x49dae5,_0x41eca9,_0x3b3a0e)};io['to'](util[_0x31ec('0x48')](_0x31ec('0x4a'),_0x4f8963))['emit'](_0x31ec('0x4b'),_0x38cced);}exports['cs']=function(_0x20aba2,_0x30f502,_0xfd6f69,_0x4bcee8,_0x33dbb8,_0x20d6e5,_0x26fff1,_0x2f1665){var _0x8b9f6c={};_0x20d6e5[_0x31ec('0x4c')]=intUtil[_0x31ec('0x4d')](_0x20d6e5[_0x31ec('0x4c')]);_0x20d6e5['serverUrl']=intUtil[_0x31ec('0x4d')](_0x20d6e5[_0x31ec('0x4e')]);_0x8b9f6c[_0x31ec('0x44')]=_0x2f1665==='queue'||_0x2f1665===_0x31ec('0x4f')?'queue':_0x31ec('0x2d');var _0x19bcf5=util[_0x31ec('0x48')](_0x31ec('0x50'),_0x20d6e5[_0x31ec('0x4c')]);var _0x22340d=util['format'](_0x31ec('0x51'),_0x20d6e5[_0x31ec('0x52')]);var _0x4b6fe5=util[_0x31ec('0x48')](_0x31ec('0x53'),_0x20d6e5[_0x31ec('0x4e')],_0x30f502[_0x31ec('0x54')],md5(_0x30f502[_0x31ec('0x54')]));if(_0x33dbb8&&_0x33dbb8[_0x31ec('0x55')]){logger[_0x31ec('0x20')](_0x31ec('0x56'),_0x31ec('0x57'));_0x30f502[_0x31ec('0x58')]=_0x4b6fe5;}else if(_0x26fff1&&_0x26fff1[_0x31ec('0x59')]&&_0x26fff1[_0x31ec('0x59')]!==_0x31ec('0x5a')){logger['info']('[OUTBOUND]',_0x31ec('0x57'));_0x30f502['recordingURL']=_0x4b6fe5;}else{_0x30f502[_0x31ec('0x58')]='';}return getUser(_0x8b9f6c,_0x20d6e5,_0x4bcee8,_0x22340d,_0x19bcf5,_0x2f1665)[_0x31ec('0x12')](function(_0x8dfb8f){logger['info']('['+_0x2f1665[_0x31ec('0x15')]()+_0x31ec('0x5b'),_0x8dfb8f[_0x31ec('0x23')]);logger[_0x31ec('0x20')]('['+_0x2f1665[_0x31ec('0x15')]()+_0x31ec('0x5c'),_0x8dfb8f[_0x31ec('0x1d')]);return getEndUser(_0x8dfb8f,_0x20d6e5,_0x22340d,_0x19bcf5,_0x30f502,_0x2f1665);})[_0x31ec('0x12')](function(_0x4a116a){logger[_0x31ec('0x20')]('['+_0x2f1665[_0x31ec('0x15')]()+_0x31ec('0x5d'),_0x4a116a['enduserId']);logger[_0x31ec('0x20')]('['+_0x2f1665['toUpperCase']()+_0x31ec('0x5e'),_0x30f502[_0x31ec('0x26')]);return getTicket(_0x4a116a,_0x20d6e5,_0x22340d,_0x19bcf5,_0x30f502,_0xfd6f69,_0x2f1665);})[_0x31ec('0x12')](function(_0x22630e){logger['info'](util[_0x31ec('0x48')]('['+_0x2f1665[_0x31ec('0x15')]()+_0x31ec('0x5f'),_0xfd6f69[_0x31ec('0x39')],_0x22630e[_0x31ec('0x47')]));logger[_0x31ec('0x20')](util[_0x31ec('0x48')]('['+_0x2f1665[_0x31ec('0x15')]()+_0x31ec('0x60'),_0x2f1665));if(_0x2f1665!==_0x31ec('0x4f')){logger[_0x31ec('0x20')]('['+_0x2f1665[_0x31ec('0x15')]()+']','Displaying\x20call\x20in\x20a\x20new\x20tab...');emit(_0x20d6e5[_0x31ec('0x4c')],_0x4bcee8[_0x31ec('0x61')],_0xfd6f69[_0x31ec('0x39')],_0x22630e[_0x31ec('0x47')]);}})['catch'](function(_0x5d0039){logger[_0x31ec('0x14')]('['+_0x2f1665[_0x31ec('0x15')]()+_0x31ec('0x62'),util[_0x31ec('0x63')](_0x5d0039,{'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 f169f3c..c732378 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 _0xdceb=['[OUTBOUND]','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','destcalleridname','destcalleridnum','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','error','monitor_format','calleridnum','catch','[ABANDONED]','md5','util','ioredis','./util','../../../../config/environment','../../../../config/logger','freshdesk','redis','defaults','socket.io-emitter','application/json','format','Caller\x20-\x20%s','Subjects','getString','Descriptions','
','Tags','name','custom_fields','mapValues','keyBy','value','%s/api/v2/tickets','remoteUri','POST','then','info','validateEmail','%s/api/v2/agents','length','find','contact','email','%s/api/v2/agents/me','Invalid\x20email\x20format,\x20using\x20the\x20admin\x20account!','Admin\x20account\x20selected.','Searching\x20enduser\x20with\x20phone','%s/api/v2/contacts','Enduser\x20found!','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!','Enduser\x20created.','apiKey','base64','debug','[HTTP]','stringify','GET','map','forEach','string','customField','nameField','toLowerCase','content','toString','type','idField','variable','variableName','push','customVariable','Variable','stripTrailingSlash','serverUrl','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','uniqueid','Authorization','The\x20User\x20ID\x20is:','calleridname','The\x20Enduser\x20ID\x20is:','Ticket\x20created!','The\x20Ticket\x20ID\x20is:','trigger:browser:url','%s/helpdesk/tickets/%d','outbound','recordingFormat','none'];(function(_0x56af3a,_0x49c3bf){var _0x5a6615=function(_0x84a584){while(--_0x84a584){_0x56af3a['push'](_0x56af3a['shift']());}};_0x5a6615(++_0x49c3bf);}(_0xdceb,0x64));var _0xbdce=function(_0x5635ba,_0x3449d2){_0x5635ba=_0x5635ba-0x0;var _0x18fd24=_0xdceb[_0x5635ba];return _0x18fd24;};'use strict';var _=require('lodash');var rp=require('request-promise');var md5=require(_0xbdce('0x0'));var util=require(_0xbdce('0x1'));var Redis=require(_0xbdce('0x2'));var intUtil=require(_0xbdce('0x3'));var config=require(_0xbdce('0x4'));var logger=require(_0xbdce('0x5'))(_0xbdce('0x6'));config[_0xbdce('0x7')]=_[_0xbdce('0x8')](config['redis'],{'host':'localhost','port':0x18eb});var io=require(_0xbdce('0x9'))(new Redis(config[_0xbdce('0x7')]));var headers={'Content-Type':_0xbdce('0xa'),'Accept':_0xbdce('0xa')};function emit(_0x15c7fd,_0x3e7d3b,_0xb8d0ce){io['to'](_0x15c7fd)['emit'](_0x3e7d3b,_0xb8d0ce);}function getTicket(_0x5c8fff,_0x210174,_0x5d7231,_0x455b71,_0x197ad8){logger['info']('Creating\x20new\x20ticket...');var _0x500556=_['merge']({'responder_id':_0x210174['id'],'requester_id':_0x5d7231['id'],'name':util[_0xbdce('0xb')](_0xbdce('0xc'),_0x197ad8['calleridname']),'phone':_0x197ad8['calleridnum'],'source':0x3,'priority':0x1,'status':0x2,'subject':intUtil['getString'](_0x455b71[_0xbdce('0xd')],_0x197ad8,'\x20'),'description':intUtil[_0xbdce('0xe')](_0x455b71[_0xbdce('0xf')],_0x197ad8,_0xbdce('0x10')),'tags':getTags(_0x455b71[_0xbdce('0x11')],_0xbdce('0x12'))},getCustomFields(_0x455b71['Fields'],_0x197ad8));_0x500556[_0xbdce('0x13')]=_[_0xbdce('0x14')](_[_0xbdce('0x15')](_0x500556[_0xbdce('0x13')],'id'),_0xbdce('0x16'));return request({'uri':util['format'](_0xbdce('0x17'),_0x5c8fff[_0xbdce('0x18')]),'method':_0xbdce('0x19'),'body':_0x500556})[_0xbdce('0x1a')](function(_0x2495a1){logger[_0xbdce('0x1b')]('Ticket\x20created!');return _0x2495a1;});}function getUser(_0xfb040a,_0x566b8a){if(intUtil[_0xbdce('0x1c')](_0x566b8a)){return request({'uri':util[_0xbdce('0xb')](_0xbdce('0x1d'),_0xfb040a[_0xbdce('0x18')]),'qs':{'email':_0x566b8a}})[_0xbdce('0x1a')](function(_0x122254){if(_0x122254[_0xbdce('0x1e')]){logger[_0xbdce('0x1b')]('Agent\x20found!');return _[_0xbdce('0x1f')](_0x122254,function(_0x770c04){return _0x770c04[_0xbdce('0x20')][_0xbdce('0x21')]===_0x566b8a;});}else{logger[_0xbdce('0x1b')]('Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!');return request({'uri':util[_0xbdce('0xb')](_0xbdce('0x22'),_0xfb040a[_0xbdce('0x18')])})[_0xbdce('0x1a')](function(_0x34959e){logger['info']('Admin\x20account\x20selected.');return _0x34959e;});}});}else{logger[_0xbdce('0x1b')](_0xbdce('0x23'));return request({'uri':util[_0xbdce('0xb')](_0xbdce('0x22'),_0xfb040a[_0xbdce('0x18')])})[_0xbdce('0x1a')](function(_0x10da69){logger[_0xbdce('0x1b')](_0xbdce('0x24'));return _0x10da69;});}}function getEndUser(_0x5c7e7d,_0x1c949f,_0x10df83){logger[_0xbdce('0x1b')](_0xbdce('0x25'),_0x10df83);return request({'uri':util[_0xbdce('0xb')](_0xbdce('0x26'),_0x5c7e7d['remoteUri']),'qs':{'phone':_0x10df83}})[_0xbdce('0x1a')](function(_0x182069){if(_0x182069[_0xbdce('0x1e')]){logger[_0xbdce('0x1b')](_0xbdce('0x27'));return _['find'](_0x182069,{'phone':_0x10df83});}else{logger['info'](_0xbdce('0x28'));return request({'uri':util[_0xbdce('0xb')]('%s/api/v2/contacts',_0x5c7e7d[_0xbdce('0x18')]),'method':_0xbdce('0x19'),'body':{'name':_0x1c949f,'phone':_0x10df83}})[_0xbdce('0x1a')](function(_0x4f7bc3){logger[_0xbdce('0x1b')](_0xbdce('0x29'));return _0x4f7bc3;});}});}function getAuth(_0xa8e8e){return util[_0xbdce('0xb')]('Basic\x20%s',new Buffer(_0xa8e8e[_0xbdce('0x2a')]+':X')['toString'](_0xbdce('0x2b')));}function request(_0x29a3f7){logger[_0xbdce('0x2c')](_0xbdce('0x2d'),JSON[_0xbdce('0x2e')](_0x29a3f7));return rp(_[_0xbdce('0x8')](_0x29a3f7,{'method':_0xbdce('0x2f'),'headers':headers,'json':!![]}));}function getTags(_0x48c7f4,_0x8e8cd1){var _0x5f40ba=[];if(_0x48c7f4&&_0x48c7f4[_0xbdce('0x1e')]>0x0){_0x5f40ba=_[_0xbdce('0x30')](_0x48c7f4,_0x8e8cd1);}return _0x5f40ba;}function getCustomFields(_0x4ba1a1,_0x5c1125){var _0x5279af=[];var _0x49861c={'custom_fields':[]};if(_0x4ba1a1[_0xbdce('0x1e')]>0x0){_[_0xbdce('0x31')](_0x4ba1a1,function(_0xf94136){if(_0xf94136['type']===_0xbdce('0x32')&&_0xf94136['nameField']&&!_0xf94136[_0xbdce('0x33')]){_0x49861c[_0xf94136[_0xbdce('0x34')][_0xbdce('0x35')]()]=_0xf94136[_0xbdce('0x36')][_0xbdce('0x37')]();}else if(_0xf94136[_0xbdce('0x38')]==='string'&&_0xf94136['idField']&&_0xf94136[_0xbdce('0x33')]){_0x49861c[_0xbdce('0x13')]['push']({'id':_0xf94136[_0xbdce('0x39')],'value':_0xf94136[_0xbdce('0x36')][_0xbdce('0x37')]()});}else if(_0xf94136[_0xbdce('0x38')]===_0xbdce('0x3a')&&_0xf94136[_0xbdce('0x3b')]&&_0xf94136[_0xbdce('0x39')]&&_0xf94136['customField']){_0x5c1125[_0xf94136[_0xbdce('0x3b')]]&&_0x49861c[_0xbdce('0x13')][_0xbdce('0x3c')]({'id':_0xf94136['idField'],'value':_0x5c1125[_0xf94136['variableName']][_0xbdce('0x37')]()});}else if(_0xf94136[_0xbdce('0x38')]===_0xbdce('0x3d')&&_0xf94136['Variable']&&_0xf94136['Variable'][_0xbdce('0x12')]&&_0xf94136[_0xbdce('0x39')]&&_0xf94136[_0xbdce('0x33')]){_0x5c1125[_0xf94136[_0xbdce('0x3e')][_0xbdce('0x12')][_0xbdce('0x35')]()]&&_0x49861c[_0xbdce('0x13')][_0xbdce('0x3c')]({'id':_0xf94136[_0xbdce('0x39')],'value':_0x5c1125[_0xf94136[_0xbdce('0x3e')]['name'][_0xbdce('0x35')]()][_0xbdce('0x37')]()});}});}return _0x49861c;}exports['queue']=function(_0x32b51f,_0x30e8c4,_0x53813d,_0x20e945,_0x1142e2,_0xfbf17f){var _0x1b05da,_0x4aad70;_0xfbf17f[_0xbdce('0x18')]=intUtil[_0xbdce('0x3f')](_0xfbf17f[_0xbdce('0x18')]);_0xfbf17f[_0xbdce('0x40')]=intUtil[_0xbdce('0x3f')](_0xfbf17f[_0xbdce('0x40')]);if(_0x1142e2&&_0x1142e2['monitor_format']){logger[_0xbdce('0x1b')](_0xbdce('0x41'),_0xbdce('0x42'));_0x30e8c4[_0xbdce('0x43')]=util['format']('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0xfbf17f['serverUrl'],_0x30e8c4[_0xbdce('0x44')],md5(_0x30e8c4[_0xbdce('0x44')]));}else{_0x30e8c4['recordingURL']='';}headers[_0xbdce('0x45')]=getAuth(_0xfbf17f);return getUser(_0xfbf17f,_0x20e945[_0xbdce('0x21')])[_0xbdce('0x1a')](function(_0x47ad30){_0x1b05da=_0x47ad30;logger[_0xbdce('0x1b')](_0xbdce('0x46'),_0x1b05da['id']);return getEndUser(_0xfbf17f,_0x30e8c4[_0xbdce('0x47')],_0x30e8c4['calleridnum']);})['then'](function(_0x292243){_0x4aad70=_0x292243;logger['info'](_0xbdce('0x48'),_0x4aad70['id']);return getTicket(_0xfbf17f,_0x1b05da,_0x4aad70,_0x53813d,_0x30e8c4);})['then'](function(_0x3f7d46){if(_0x3f7d46&&_0x3f7d46['id']){logger[_0xbdce('0x1b')](_0xbdce('0x49'));logger[_0xbdce('0x1b')](_0xbdce('0x4a'),_0x3f7d46['id']);logger[_0xbdce('0x1b')](_0xbdce('0x41'),'Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...');emit(util[_0xbdce('0xb')]('user:%s',_0x20e945[_0xbdce('0x12')]),_0xbdce('0x4b'),{'uri':util[_0xbdce('0xb')](_0xbdce('0x4c'),_0xfbf17f[_0xbdce('0x18')],_0x3f7d46['id'])});}})['catch'](function(_0x46a529){logger['error'](_0xbdce('0x41'),JSON[_0xbdce('0x2e')](_0x46a529));});};exports[_0xbdce('0x4d')]=function(_0x2bc452,_0x81cef7,_0x2e587b,_0x4f153e,_0x1412c9,_0x3fe5b9,_0x11c879){var _0x2780e8,_0x55c9e2;_0x3fe5b9[_0xbdce('0x18')]=intUtil[_0xbdce('0x3f')](_0x3fe5b9[_0xbdce('0x18')]);_0x3fe5b9[_0xbdce('0x40')]=intUtil[_0xbdce('0x3f')](_0x3fe5b9[_0xbdce('0x40')]);if(_0x11c879&&_0x11c879[_0xbdce('0x4e')]&&_0x11c879['recordingFormat']!==_0xbdce('0x4f')){logger[_0xbdce('0x1b')](_0xbdce('0x50'),_0xbdce('0x42'));_0x81cef7[_0xbdce('0x43')]=util['format'](_0xbdce('0x51'),_0x3fe5b9[_0xbdce('0x40')],_0x81cef7[_0xbdce('0x44')],md5(_0x81cef7[_0xbdce('0x44')]));}headers[_0xbdce('0x45')]=getAuth(_0x3fe5b9);return getUser(_0x3fe5b9,_0x4f153e[_0xbdce('0x21')])[_0xbdce('0x1a')](function(_0x1cf17f){_0x2780e8=_0x1cf17f;logger[_0xbdce('0x1b')](_0xbdce('0x46'),_0x2780e8['id']);return getEndUser(_0x3fe5b9,_0x81cef7[_0xbdce('0x52')],_0x81cef7[_0xbdce('0x53')]);})[_0xbdce('0x1a')](function(_0x4c44a0){_0x55c9e2=_0x4c44a0;logger[_0xbdce('0x1b')]('The\x20Enduser\x20ID\x20is:',_0x55c9e2['id']);return getTicket(_0x3fe5b9,_0x2780e8,_0x55c9e2,_0x2e587b,_0x81cef7);})['then'](function(_0x5824ac){if(_0x5824ac&&_0x5824ac['id']){logger[_0xbdce('0x1b')]('Ticket\x20created!');logger['info']('The\x20Ticket\x20ID\x20is:',_0x5824ac['id']);logger[_0xbdce('0x1b')](_0xbdce('0x50'),_0xbdce('0x54'));emit(util[_0xbdce('0xb')]('user:%s',_0x4f153e[_0xbdce('0x12')]),_0xbdce('0x4b'),{'uri':util['format'](_0xbdce('0x4c'),_0x3fe5b9[_0xbdce('0x18')],_0x5824ac['id'])});}})['catch'](function(_0x11c5bc){logger[_0xbdce('0x55')](_0xbdce('0x50'),JSON[_0xbdce('0x2e')](_0x11c5bc));});};exports['abandoned']=function(_0x231773,_0x35a8c2,_0x3e32a2,_0x2be8ca,_0x301bd7,_0x1311f7){var _0x286f96,_0x5e1816;_0x1311f7[_0xbdce('0x18')]=intUtil['stripTrailingSlash'](_0x1311f7[_0xbdce('0x18')]);_0x1311f7[_0xbdce('0x40')]=intUtil[_0xbdce('0x3f')](_0x1311f7['serverUrl']);if(_0x301bd7&&_0x301bd7[_0xbdce('0x56')]){logger[_0xbdce('0x1b')]('[ABANDONED]',_0xbdce('0x42'));_0x35a8c2[_0xbdce('0x43')]=util[_0xbdce('0xb')](_0xbdce('0x51'),_0x1311f7[_0xbdce('0x40')],_0x35a8c2[_0xbdce('0x44')],md5(_0x35a8c2[_0xbdce('0x44')]));}else{_0x35a8c2[_0xbdce('0x43')]='';}headers[_0xbdce('0x45')]=getAuth(_0x1311f7);return getUser(_0x1311f7,'')[_0xbdce('0x1a')](function(_0x19b094){_0x286f96=_0x19b094;logger[_0xbdce('0x1b')]('The\x20User\x20ID\x20is:',_0x286f96['id']);return getEndUser(_0x1311f7,_0x35a8c2['calleridname'],_0x35a8c2[_0xbdce('0x57')]);})['then'](function(_0x3b0b28){_0x5e1816=_0x3b0b28;logger['info']('The\x20Enduser\x20ID\x20is:',_0x5e1816['id']);return getTicket(_0x1311f7,_0x286f96,_0x5e1816,_0x3e32a2,_0x35a8c2);})[_0xbdce('0x1a')](function(_0x498667){if(_0x498667){logger[_0xbdce('0x1b')](_0xbdce('0x49'));logger[_0xbdce('0x1b')](_0xbdce('0x4a'),_0x498667['id']);}})[_0xbdce('0x58')](function(_0x432be4){logger[_0xbdce('0x55')](_0xbdce('0x59'),JSON[_0xbdce('0x2e')](_0x432be4));});}; \ No newline at end of file +var _0xac3f=['keyBy','value','%s/api/v2/tickets','remoteUri','then','validateEmail','%s/api/v2/agents','length','Agent\x20found!','find','contact','email','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','%s/api/v2/agents/me','Admin\x20account\x20selected.','Searching\x20enduser\x20with\x20phone','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!','%s/api/v2/contacts','POST','Basic\x20%s','toString','base64','debug','[HTTP]','GET','map','forEach','type','string','nameField','content','idField','customField','variable','variableName','customVariable','Variable','push','toLowerCase','queue','stripTrailingSlash','serverUrl','monitor_format','[QUEUE]','recordingURL','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','Authorization','The\x20User\x20ID\x20is:','The\x20Enduser\x20ID\x20is:','%s/helpdesk/tickets/%d','catch','stringify','outbound','recordingFormat','none','destcalleridname','destcalleridnum','Ticket\x20created!','The\x20Ticket\x20ID\x20is:','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','user:%s','[OUTBOUND]','abandoned','Recording\x20is\x20enabled!','calleridnum','error','util','ioredis','./util','../../../../config/environment','freshdesk','redis','defaults','socket.io-emitter','application/json','emit','info','Creating\x20new\x20ticket...','merge','format','Caller\x20-\x20%s','calleridname','getString','Subjects','Descriptions','
','Tags','name','Fields','custom_fields','mapValues'];(function(_0x11d096,_0x3b70f2){var _0xf3a7b3=function(_0x480f58){while(--_0x480f58){_0x11d096['push'](_0x11d096['shift']());}};_0xf3a7b3(++_0x3b70f2);}(_0xac3f,0x1b3));var _0xfac3=function(_0x577077,_0x52f056){_0x577077=_0x577077-0x0;var _0x370769=_0xac3f[_0x577077];return _0x370769;};'use strict';var _=require('lodash');var rp=require('request-promise');var md5=require('md5');var util=require(_0xfac3('0x0'));var Redis=require(_0xfac3('0x1'));var intUtil=require(_0xfac3('0x2'));var config=require(_0xfac3('0x3'));var logger=require('../../../../config/logger')(_0xfac3('0x4'));config[_0xfac3('0x5')]=_[_0xfac3('0x6')](config[_0xfac3('0x5')],{'host':'localhost','port':0x18eb});var io=require(_0xfac3('0x7'))(new Redis(config['redis']));var headers={'Content-Type':'application/json','Accept':_0xfac3('0x8')};function emit(_0x2bd226,_0x4d92d1,_0x3d6db9){io['to'](_0x2bd226)[_0xfac3('0x9')](_0x4d92d1,_0x3d6db9);}function getTicket(_0x427a53,_0x5099fd,_0x346812,_0x100874,_0xa87668){logger[_0xfac3('0xa')](_0xfac3('0xb'));var _0x489e38=_[_0xfac3('0xc')]({'responder_id':_0x5099fd['id'],'requester_id':_0x346812['id'],'name':util[_0xfac3('0xd')](_0xfac3('0xe'),_0xa87668[_0xfac3('0xf')]),'phone':_0xa87668['calleridnum'],'source':0x3,'priority':0x1,'status':0x2,'subject':intUtil[_0xfac3('0x10')](_0x100874[_0xfac3('0x11')],_0xa87668,'\x20'),'description':intUtil[_0xfac3('0x10')](_0x100874[_0xfac3('0x12')],_0xa87668,_0xfac3('0x13')),'tags':getTags(_0x100874[_0xfac3('0x14')],_0xfac3('0x15'))},getCustomFields(_0x100874[_0xfac3('0x16')],_0xa87668));_0x489e38[_0xfac3('0x17')]=_[_0xfac3('0x18')](_[_0xfac3('0x19')](_0x489e38['custom_fields'],'id'),_0xfac3('0x1a'));return request({'uri':util[_0xfac3('0xd')](_0xfac3('0x1b'),_0x427a53[_0xfac3('0x1c')]),'method':'POST','body':_0x489e38})[_0xfac3('0x1d')](function(_0x4a7969){logger[_0xfac3('0xa')]('Ticket\x20created!');return _0x4a7969;});}function getUser(_0x14c0c6,_0x3c86e8){if(intUtil[_0xfac3('0x1e')](_0x3c86e8)){return request({'uri':util[_0xfac3('0xd')](_0xfac3('0x1f'),_0x14c0c6['remoteUri']),'qs':{'email':_0x3c86e8}})['then'](function(_0x26b1f8){if(_0x26b1f8[_0xfac3('0x20')]){logger[_0xfac3('0xa')](_0xfac3('0x21'));return _[_0xfac3('0x22')](_0x26b1f8,function(_0x8e3f90){return _0x8e3f90[_0xfac3('0x23')][_0xfac3('0x24')]===_0x3c86e8;});}else{logger[_0xfac3('0xa')](_0xfac3('0x25'));return request({'uri':util[_0xfac3('0xd')](_0xfac3('0x26'),_0x14c0c6[_0xfac3('0x1c')])})[_0xfac3('0x1d')](function(_0x2f3a92){logger[_0xfac3('0xa')](_0xfac3('0x27'));return _0x2f3a92;});}});}else{logger[_0xfac3('0xa')]('Invalid\x20email\x20format,\x20using\x20the\x20admin\x20account!');return request({'uri':util[_0xfac3('0xd')](_0xfac3('0x26'),_0x14c0c6['remoteUri'])})['then'](function(_0x574259){logger[_0xfac3('0xa')](_0xfac3('0x27'));return _0x574259;});}}function getEndUser(_0x32c981,_0xde9209,_0x52c2ed){logger[_0xfac3('0xa')](_0xfac3('0x28'),_0x52c2ed);return request({'uri':util[_0xfac3('0xd')]('%s/api/v2/contacts',_0x32c981['remoteUri']),'qs':{'phone':_0x52c2ed}})[_0xfac3('0x1d')](function(_0x28ed7e){if(_0x28ed7e[_0xfac3('0x20')]){logger[_0xfac3('0xa')]('Enduser\x20found!');return _[_0xfac3('0x22')](_0x28ed7e,{'phone':_0x52c2ed});}else{logger[_0xfac3('0xa')](_0xfac3('0x29'));return request({'uri':util[_0xfac3('0xd')](_0xfac3('0x2a'),_0x32c981['remoteUri']),'method':_0xfac3('0x2b'),'body':{'name':_0xde9209,'phone':_0x52c2ed}})['then'](function(_0x471a16){logger[_0xfac3('0xa')]('Enduser\x20created.');return _0x471a16;});}});}function getAuth(_0x1edf89){return util['format'](_0xfac3('0x2c'),new Buffer(_0x1edf89['apiKey']+':X')[_0xfac3('0x2d')](_0xfac3('0x2e')));}function request(_0x465de9){logger[_0xfac3('0x2f')](_0xfac3('0x30'),JSON['stringify'](_0x465de9));return rp(_[_0xfac3('0x6')](_0x465de9,{'method':_0xfac3('0x31'),'headers':headers,'json':!![]}));}function getTags(_0x147d4e,_0x441d00){var _0x27367d=[];if(_0x147d4e&&_0x147d4e[_0xfac3('0x20')]>0x0){_0x27367d=_[_0xfac3('0x32')](_0x147d4e,_0x441d00);}return _0x27367d;}function getCustomFields(_0x58fe0a,_0x501766){var _0x1580cc=[];var _0xb79622={'custom_fields':[]};if(_0x58fe0a[_0xfac3('0x20')]>0x0){_[_0xfac3('0x33')](_0x58fe0a,function(_0x1f589a){if(_0x1f589a[_0xfac3('0x34')]===_0xfac3('0x35')&&_0x1f589a[_0xfac3('0x36')]&&!_0x1f589a['customField']){_0xb79622[_0x1f589a['nameField']['toLowerCase']()]=_0x1f589a[_0xfac3('0x37')][_0xfac3('0x2d')]();}else if(_0x1f589a[_0xfac3('0x34')]==='string'&&_0x1f589a[_0xfac3('0x38')]&&_0x1f589a[_0xfac3('0x39')]){_0xb79622['custom_fields']['push']({'id':_0x1f589a[_0xfac3('0x38')],'value':_0x1f589a[_0xfac3('0x37')][_0xfac3('0x2d')]()});}else if(_0x1f589a[_0xfac3('0x34')]===_0xfac3('0x3a')&&_0x1f589a['variableName']&&_0x1f589a['idField']&&_0x1f589a[_0xfac3('0x39')]){_0x501766[_0x1f589a[_0xfac3('0x3b')]]&&_0xb79622[_0xfac3('0x17')]['push']({'id':_0x1f589a[_0xfac3('0x38')],'value':_0x501766[_0x1f589a[_0xfac3('0x3b')]]['toString']()});}else if(_0x1f589a[_0xfac3('0x34')]===_0xfac3('0x3c')&&_0x1f589a['Variable']&&_0x1f589a[_0xfac3('0x3d')]['name']&&_0x1f589a[_0xfac3('0x38')]&&_0x1f589a[_0xfac3('0x39')]){_0x501766[_0x1f589a[_0xfac3('0x3d')][_0xfac3('0x15')]['toLowerCase']()]&&_0xb79622[_0xfac3('0x17')][_0xfac3('0x3e')]({'id':_0x1f589a[_0xfac3('0x38')],'value':_0x501766[_0x1f589a[_0xfac3('0x3d')][_0xfac3('0x15')][_0xfac3('0x3f')]()][_0xfac3('0x2d')]()});}});}return _0xb79622;}exports[_0xfac3('0x40')]=function(_0x25ddd3,_0xcc266,_0x249a40,_0x15370c,_0x2de662,_0x365f71){var _0x4d3210,_0x2296b2;_0x365f71[_0xfac3('0x1c')]=intUtil[_0xfac3('0x41')](_0x365f71[_0xfac3('0x1c')]);_0x365f71[_0xfac3('0x42')]=intUtil[_0xfac3('0x41')](_0x365f71['serverUrl']);if(_0x2de662&&_0x2de662[_0xfac3('0x43')]){logger[_0xfac3('0xa')](_0xfac3('0x44'),'Recording\x20is\x20enabled!');_0xcc266[_0xfac3('0x45')]=util[_0xfac3('0xd')](_0xfac3('0x46'),_0x365f71[_0xfac3('0x42')],_0xcc266['uniqueid'],md5(_0xcc266[_0xfac3('0x47')]));}else{_0xcc266[_0xfac3('0x45')]='';}headers[_0xfac3('0x48')]=getAuth(_0x365f71);return getUser(_0x365f71,_0x15370c['email'])['then'](function(_0x4349c5){_0x4d3210=_0x4349c5;logger[_0xfac3('0xa')](_0xfac3('0x49'),_0x4d3210['id']);return getEndUser(_0x365f71,_0xcc266[_0xfac3('0xf')],_0xcc266['calleridnum']);})['then'](function(_0x1d0b0d){_0x2296b2=_0x1d0b0d;logger['info'](_0xfac3('0x4a'),_0x2296b2['id']);return getTicket(_0x365f71,_0x4d3210,_0x2296b2,_0x249a40,_0xcc266);})[_0xfac3('0x1d')](function(_0x3d19b9){if(_0x3d19b9&&_0x3d19b9['id']){logger[_0xfac3('0xa')]('Ticket\x20created!');logger[_0xfac3('0xa')]('The\x20Ticket\x20ID\x20is:',_0x3d19b9['id']);logger[_0xfac3('0xa')](_0xfac3('0x44'),'Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...');emit(util[_0xfac3('0xd')]('user:%s',_0x15370c[_0xfac3('0x15')]),'trigger:browser:url',{'uri':util[_0xfac3('0xd')](_0xfac3('0x4b'),_0x365f71[_0xfac3('0x1c')],_0x3d19b9['id'])});}})[_0xfac3('0x4c')](function(_0x2efac6){logger['error'](_0xfac3('0x44'),JSON[_0xfac3('0x4d')](_0x2efac6));});};exports[_0xfac3('0x4e')]=function(_0x3d7205,_0x2015f4,_0x1501ac,_0x1d3cd9,_0x1b4d0c,_0x5482d6,_0xca0c81){var _0x4b948c,_0x415c8b;_0x5482d6['remoteUri']=intUtil[_0xfac3('0x41')](_0x5482d6['remoteUri']);_0x5482d6[_0xfac3('0x42')]=intUtil['stripTrailingSlash'](_0x5482d6['serverUrl']);if(_0xca0c81&&_0xca0c81[_0xfac3('0x4f')]&&_0xca0c81['recordingFormat']!==_0xfac3('0x50')){logger[_0xfac3('0xa')]('[OUTBOUND]','Recording\x20is\x20enabled!');_0x2015f4[_0xfac3('0x45')]=util[_0xfac3('0xd')](_0xfac3('0x46'),_0x5482d6['serverUrl'],_0x2015f4[_0xfac3('0x47')],md5(_0x2015f4[_0xfac3('0x47')]));}headers[_0xfac3('0x48')]=getAuth(_0x5482d6);return getUser(_0x5482d6,_0x1d3cd9['email'])[_0xfac3('0x1d')](function(_0x210925){_0x4b948c=_0x210925;logger['info'](_0xfac3('0x49'),_0x4b948c['id']);return getEndUser(_0x5482d6,_0x2015f4[_0xfac3('0x51')],_0x2015f4[_0xfac3('0x52')]);})[_0xfac3('0x1d')](function(_0x3bf8c1){_0x415c8b=_0x3bf8c1;logger[_0xfac3('0xa')](_0xfac3('0x4a'),_0x415c8b['id']);return getTicket(_0x5482d6,_0x4b948c,_0x415c8b,_0x1501ac,_0x2015f4);})['then'](function(_0x251c4d){if(_0x251c4d&&_0x251c4d['id']){logger[_0xfac3('0xa')](_0xfac3('0x53'));logger[_0xfac3('0xa')](_0xfac3('0x54'),_0x251c4d['id']);logger[_0xfac3('0xa')]('[OUTBOUND]',_0xfac3('0x55'));emit(util[_0xfac3('0xd')](_0xfac3('0x56'),_0x1d3cd9[_0xfac3('0x15')]),'trigger:browser:url',{'uri':util['format'](_0xfac3('0x4b'),_0x5482d6[_0xfac3('0x1c')],_0x251c4d['id'])});}})['catch'](function(_0x4780d9){logger['error'](_0xfac3('0x57'),JSON['stringify'](_0x4780d9));});};exports[_0xfac3('0x58')]=function(_0x5deb4b,_0x438aa1,_0x5268b0,_0x35b1e3,_0x32a3af,_0x918514){var _0x4befa8,_0x590572;_0x918514[_0xfac3('0x1c')]=intUtil[_0xfac3('0x41')](_0x918514['remoteUri']);_0x918514[_0xfac3('0x42')]=intUtil['stripTrailingSlash'](_0x918514['serverUrl']);if(_0x32a3af&&_0x32a3af[_0xfac3('0x43')]){logger['info']('[ABANDONED]',_0xfac3('0x59'));_0x438aa1[_0xfac3('0x45')]=util[_0xfac3('0xd')](_0xfac3('0x46'),_0x918514[_0xfac3('0x42')],_0x438aa1[_0xfac3('0x47')],md5(_0x438aa1[_0xfac3('0x47')]));}else{_0x438aa1['recordingURL']='';}headers[_0xfac3('0x48')]=getAuth(_0x918514);return getUser(_0x918514,'')[_0xfac3('0x1d')](function(_0x324763){_0x4befa8=_0x324763;logger['info'](_0xfac3('0x49'),_0x4befa8['id']);return getEndUser(_0x918514,_0x438aa1[_0xfac3('0xf')],_0x438aa1[_0xfac3('0x5a')]);})[_0xfac3('0x1d')](function(_0x4e6b70){_0x590572=_0x4e6b70;logger[_0xfac3('0xa')](_0xfac3('0x4a'),_0x590572['id']);return getTicket(_0x918514,_0x4befa8,_0x590572,_0x5268b0,_0x438aa1);})['then'](function(_0x5d97bd){if(_0x5d97bd){logger[_0xfac3('0xa')](_0xfac3('0x53'));logger[_0xfac3('0xa')]('The\x20Ticket\x20ID\x20is:',_0x5d97bd['id']);}})[_0xfac3('0x4c')](function(_0x499830){logger[_0xfac3('0x5b')]('[ABANDONED]',JSON[_0xfac3('0x4d')](_0x499830));});}; \ 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 556c258..d5bf013 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 _0x89e1=['ioredis','../../../../config/environment','../../../../config/logger','freshsales','redis','defaults','localhost','socket.io-emitter','GET','/api/selector/owners','info','users','length','email','adminEmail','adminId','Admin\x20found:','Requested\x20Resource\x20not\x20Found','catch','error','toUpperCase','Getting\x20user\x20list','agentEmail','Getting\x20user\x20with\x20email','userEmail','User\x20found:','userId','message','/api/contacts/filters','headers','Getting\x20contacts\x20filter','then','filters','forEach','name','All\x20Contacts','/api/contacts/view/','Searching\x20contact\x20with\x20phone','contactNumber','contacts','work_number','mobile_number','Contact\x20found:','Contact\x20created:','endUserId','POST','/api/contacts','format','YYYY-MM-DDTHH:mm:ss','Creating\x20new\x20task','/api/tasks','getString','Subjects','Contact','add','ticketId','task','Task\x20created:','/contacts/','user:%s','trigger:browser:url','Token\x20token=','apiKey','remoteUri','serverUrl','username','toLowerCase','outbound','destcalleridnum','calleridnum','queue','abandoned','uniqueid','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','recordingFormat','none','[OUTBOUND]','The\x20ticket\x20ID\x20is:\x20%s','Displaying\x20task\x20in\x20a\x20new\x20tab...','lodash','request-promise','util','moment','bluebird'];(function(_0x33faa9,_0x1068d6){var _0x664a94=function(_0x45aaa7){while(--_0x45aaa7){_0x33faa9['push'](_0x33faa9['shift']());}};_0x664a94(++_0x1068d6);}(_0x89e1,0x157));var _0x189e=function(_0x236e7d,_0x1e4c54){_0x236e7d=_0x236e7d-0x0;var _0x2af230=_0x89e1[_0x236e7d];return _0x2af230;};'use strict';var _=require(_0x189e('0x0'));var rp=require(_0x189e('0x1'));var md5=require('md5');var util=require(_0x189e('0x2'));var moment=require(_0x189e('0x3'));var Promise=require(_0x189e('0x4'));var Redis=require(_0x189e('0x5'));var intUtil=require('./util');var config=require(_0x189e('0x6'));var logger=require(_0x189e('0x7'))(_0x189e('0x8'));config[_0x189e('0x9')]=_[_0x189e('0xa')](config[_0x189e('0x9')],{'host':_0x189e('0xb'),'port':0x18eb});var io=require(_0x189e('0xc'))(new Redis(config['redis']));function getAdminId(_0x2b0fc6,_0x2fe59b,_0x3ddcea,_0x4aded5){return new Promise(function(_0x3dd519,_0xb4a890){var _0xff68e8=![];var _0x1c0847={'method':_0x189e('0xd'),'uri':_0x4aded5+_0x189e('0xe'),'json':!![]};_0x1c0847['headers']=_0x3ddcea;logger[_0x189e('0xf')]('Getting\x20admin\x20information');return rp(_0x1c0847)['then'](function(_0x11cfed){if(_0x11cfed){var _0x113203=_0x11cfed[_0x189e('0x10')];var _0x33deac=null;for(_0x33deac=0x0;_0x33deac<_0x113203[_0x189e('0x11')];_0x33deac++){if(_0x113203[_0x33deac][_0x189e('0x12')]===_0x2b0fc6[_0x189e('0x13')]){_0x2b0fc6[_0x189e('0x14')]=_0x113203[_0x33deac]['id'];_0xff68e8=!![];}}if(_0xff68e8){logger[_0x189e('0xf')](_0x189e('0x15'),_0x2b0fc6[_0x189e('0x14')]);_0x3dd519(_0x2b0fc6);}else{_0xb4a890({'statusCode':0x194,'message':'Requested\x20Resource\x20not\x20Found'});}}else{_0xb4a890({'statusCode':0x194,'message':_0x189e('0x16')});}})[_0x189e('0x17')](function(_0x5a2144){logger[_0x189e('0x18')]('['+[_0x2fe59b[_0x189e('0x19')]()]+']',_0x5a2144['message']);_0xb4a890(_0x5a2144);});});}function getUser(_0x423f9a,_0x4d8e70,_0x126037){return function(_0x45a306){return new Promise(function(_0x165aab,_0x376cc9){var _0x13c213={'method':'GET','uri':_0x126037+_0x189e('0xe'),'json':!![]};_0x13c213['headers']=_0x4d8e70;logger[_0x189e('0xf')](_0x189e('0x1a'));return rp(_0x13c213)['then'](function(_0xd65c9d){if(_0xd65c9d){var _0x39a063=_0xd65c9d[_0x189e('0x10')];var _0x104c16=![];var _0x584088=null;if(_0x45a306[_0x189e('0x1b')]!==null){logger[_0x189e('0xf')](_0x189e('0x1c'),_0x45a306[_0x189e('0x1b')]);_0x45a306[_0x189e('0x1d')]=_0x45a306[_0x189e('0x1b')];for(_0x584088=0x0;_0x584088<_0x39a063['length'];_0x584088++){if(_0x39a063[_0x584088][_0x189e('0x12')]===_0x45a306[_0x189e('0x1b')]){_0x104c16=!![];_0x45a306['userId']=_0x39a063[_0x584088]['id'];logger['info'](_0x189e('0x1e'),_0x45a306['userId']);}}}if(!_0x104c16){logger[_0x189e('0xf')]('Admin\x20selected');_0x45a306[_0x189e('0x1d')]=_0x45a306[_0x189e('0x13')];_0x45a306[_0x189e('0x1f')]=_0x45a306[_0x189e('0x14')];_0x104c16=!![];}if(_0x104c16){_0x165aab(_0x45a306);}else{_0x376cc9({'statusCode':0x194,'message':_0x189e('0x16')});}}else{_0x376cc9({'statusCode':0x194,'message':_0x189e('0x16')});}})[_0x189e('0x17')](function(_0x17ec3f){logger['error']('['+[_0x423f9a[_0x189e('0x19')]()]+']',_0x17ec3f[_0x189e('0x20')]);_0x376cc9(_0x17ec3f);});});};}function getEndUser(_0x59b169,_0x2ac4e1,_0x4ac609){return function(_0x5a31f1){return new Promise(function(_0x506491,_0x156ab7){var _0x62fb84=0x0;var _0xa6bd69={'method':'GET','uri':_0x4ac609+_0x189e('0x21'),'json':!![]};_0xa6bd69[_0x189e('0x22')]=_0x2ac4e1;logger['info'](_0x189e('0x23'));return rp(_0xa6bd69)[_0x189e('0x24')](function(_0x272ece){_0x272ece[_0x189e('0x25')][_0x189e('0x26')](function(_0x5904ff){if(_0x5904ff[_0x189e('0x27')]===_0x189e('0x28')){_0x62fb84=_0x5904ff['id'];}});})[_0x189e('0x24')](function(){logger['info']('Getting\x20contact\x20list');var _0x4f63fc={'method':'GET','uri':_0x4ac609+_0x189e('0x29')+_0x62fb84,'json':!![]};_0x4f63fc[_0x189e('0x22')]=_0x2ac4e1;return rp(_0x4f63fc);})[_0x189e('0x24')](function(_0x467542){logger[_0x189e('0xf')](_0x189e('0x2a'),_0x5a31f1[_0x189e('0x2b')]);if(_0x467542[_0x189e('0x2c')]['length']>0x0){var _0x3dc599=_['find'](_0x467542[_0x189e('0x2c')],function(_0x4c62c2){if(_0x4c62c2[_0x189e('0x2d')]===_0x5a31f1[_0x189e('0x2b')]||_0x4c62c2[_0x189e('0x2e')]===_0x5a31f1[_0x189e('0x2b')]){return _0x4c62c2;}});if(_0x3dc599){_0x5a31f1['endUserId']=_0x3dc599['id'];logger['info'](_0x189e('0x2f'),_0x5a31f1['endUserId']);_0x506491(_0x5a31f1);}else{return createEndUser(_0x5a31f1,_0x59b169,_0x2ac4e1,_0x4ac609)[_0x189e('0x24')](function(_0x1a5eb4){logger['info'](_0x189e('0x30'),_0x5a31f1[_0x189e('0x31')]);_0x506491(_0x1a5eb4);});}}else{return createEndUser(_0x5a31f1,_0x59b169,_0x2ac4e1,_0x4ac609)['then'](function(_0x19624c){logger[_0x189e('0xf')](_0x189e('0x30'),_0x5a31f1['endUserId']);_0x506491(_0x19624c);});}})[_0x189e('0x17')](function(_0x494ded){throw new Error(_0x494ded[_0x189e('0x20')]);});});};}function createEndUser(_0x168fa9,_0x2913fe,_0x5c209c,_0x3166f6){return new Promise(function(_0x5bbca5,_0x3d469a){var _0x495ce8=moment();var _0x2368c8={'method':_0x189e('0x32'),'uri':_0x3166f6+_0x189e('0x33'),'body':{'contact':{'last_name':_0x168fa9[_0x189e('0x2b')],'work_number':_0x168fa9[_0x189e('0x2b')],'mobile_number':_0x168fa9['contactNumber'],'owner_id':_0x168fa9[_0x189e('0x1f')],'created_at':_0x495ce8[_0x189e('0x34')](_0x189e('0x35'))}},'json':!![]};_0x2368c8['headers']=_0x5c209c;logger[_0x189e('0xf')]('Contact\x20not\x20found,\x20creating\x20a\x20new\x20contact');return rp(_0x2368c8)['then'](function(_0xdf57f4){_0x168fa9[_0x189e('0x31')]=_0xdf57f4['contact']['id'];_0x5bbca5(_0x168fa9);})[_0x189e('0x17')](function(_0x32cf64){logger[_0x189e('0x18')]('['+[_0x2913fe[_0x189e('0x19')]()]+']',_0x32cf64['message']);_0x3d469a(_0x32cf64['message']);});});}function getTicket(_0x136898,_0x96f7db,_0x569d91,_0x48e787,_0x3bdd91){return function(_0x482464){logger['info'](_0x189e('0x36'));return new Promise(function(_0x3efdbc,_0x15cec3){var _0x5200bf=moment();var _0x406fb5={'method':_0x189e('0x32'),'uri':_0x569d91+_0x189e('0x37'),'body':{'title':intUtil[_0x189e('0x38')](_0x48e787[_0x189e('0x39')],_0x3bdd91,'\x20'),'description':intUtil[_0x189e('0x38')](_0x48e787['Descriptions'],_0x3bdd91,'\x0a'),'owner_id':_0x482464[_0x189e('0x1f')],'creater_id':_0x482464['adminId'],'targetable_id':_0x482464[_0x189e('0x31')],'targetable_type':_0x189e('0x3a'),'created_at':_0x5200bf[_0x189e('0x34')]('YYYY-MM-DDTHH:mm:ss'),'due_date':_0x5200bf[_0x189e('0x3b')](0x1e,'m')[_0x189e('0x34')](_0x189e('0x35'))},'json':!![]};_0x406fb5[_0x189e('0x22')]=_0x96f7db;return rp(_0x406fb5)[_0x189e('0x24')](function(_0x471c2e){_0x482464[_0x189e('0x3c')]=_0x471c2e[_0x189e('0x3d')]['id'];logger[_0x189e('0xf')](_0x189e('0x3e'),_0x482464[_0x189e('0x3c')]);_0x3efdbc(_0x482464);})[_0x189e('0x17')](function(_0x336096){logger[_0x189e('0x18')]('['+[_0x136898[_0x189e('0x19')]()]+']',_0x336096['message']);_0x15cec3(_0x336096[_0x189e('0x20')]);});});};}function emit(_0x471c76,_0x278f98,_0x21643b){var _0x45d18b={'uri':_0x471c76+_0x189e('0x3f')+_0x21643b};io['to'](util['format'](_0x189e('0x40'),_0x278f98))['emit'](_0x189e('0x41'),_0x45d18b);}exports['cs']=function(_0x52a43b,_0x26bf0c,_0x714dc2,_0x1f26f3,_0x44a28,_0x3df58c,_0x286540,_0x57be74){var _0x12931c={};var _0x101e18={'Authorization':_0x189e('0x42')+_0x3df58c[_0x189e('0x43')]};_0x3df58c['remoteUri']=intUtil['stripTrailingSlash'](_0x3df58c[_0x189e('0x44')]);_0x3df58c[_0x189e('0x45')]=intUtil['stripTrailingSlash'](_0x3df58c[_0x189e('0x45')]);var _0x5a9fe1=_0x3df58c[_0x189e('0x44')];_0x12931c[_0x189e('0x13')]=_0x3df58c[_0x189e('0x46')];_0x12931c[_0x189e('0x2b')]=_0x57be74[_0x189e('0x47')]()===_0x189e('0x48')?_0x26bf0c[_0x189e('0x49')]:_0x26bf0c[_0x189e('0x4a')];_0x12931c['callDirection']=_0x57be74===_0x189e('0x4b')||_0x57be74===_0x189e('0x4c')?_0x189e('0x4b'):'outbound';if(_0x1f26f3){_0x12931c[_0x189e('0x1b')]=_0x1f26f3['email'];}var _0x144949=util[_0x189e('0x34')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x3df58c[_0x189e('0x45')],_0x26bf0c[_0x189e('0x4d')],md5(_0x26bf0c[_0x189e('0x4d')]));if(_0x44a28&&_0x44a28[_0x189e('0x4e')]){logger[_0x189e('0xf')](_0x189e('0x4f'),_0x189e('0x50'));_0x26bf0c[_0x189e('0x51')]=_0x144949;}else if(_0x286540&&_0x286540[_0x189e('0x52')]&&_0x286540[_0x189e('0x52')]!==_0x189e('0x53')){logger[_0x189e('0xf')](_0x189e('0x54'),_0x189e('0x50'));_0x26bf0c['recordingURL']=_0x144949;}else{_0x26bf0c[_0x189e('0x51')]='';}return getAdminId(_0x12931c,_0x57be74,_0x101e18,_0x5a9fe1)['then'](getUser(_0x57be74,_0x101e18,_0x5a9fe1))['then'](getEndUser(_0x57be74,_0x101e18,_0x5a9fe1))[_0x189e('0x24')](getTicket(_0x57be74,_0x101e18,_0x5a9fe1,_0x714dc2,_0x26bf0c))[_0x189e('0x24')](function(_0xd1c229){logger[_0x189e('0xf')](util['format'](_0x189e('0x55'),_0xd1c229[_0x189e('0x3c')]));if(_0x57be74!==_0x189e('0x4c')){logger[_0x189e('0xf')]('['+[_0x57be74[_0x189e('0x19')]()]+']',_0x189e('0x56'));emit(_0x5a9fe1,_0x1f26f3[_0x189e('0x27')],_0xd1c229[_0x189e('0x31')]);}})[_0x189e('0x17')](function(_0x5df1ad){logger[_0x189e('0x18')]('['+[_0x57be74[_0x189e('0x19')]()]+']\x20Error\x20running\x20Freshsales\x20integration',util['inspect'](_0x5df1ad,{'showHidden':!![],'depth':null}));});}; \ No newline at end of file +var _0x8c7e=['/contacts/','user:%s','emit','trigger:browser:url','apiKey','stripTrailingSlash','remoteUri','serverUrl','username','toLowerCase','outbound','destcalleridnum','callDirection','queue','uniqueid','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','recordingFormat','[OUTBOUND]','The\x20ticket\x20ID\x20is:\x20%s','abandoned','Displaying\x20task\x20in\x20a\x20new\x20tab...',']\x20Error\x20running\x20Freshsales\x20integration','inspect','lodash','request-promise','util','moment','bluebird','ioredis','../../../../config/logger','freshsales','redis','localhost','GET','/api/selector/owners','headers','info','Getting\x20admin\x20information','then','adminEmail','Admin\x20found:','adminId','Requested\x20Resource\x20not\x20Found','catch','error','toUpperCase','Getting\x20user\x20list','users','agentEmail','Getting\x20user\x20with\x20email','email','userId','User\x20found:','Admin\x20selected','message','/api/contacts/filters','forEach','name','Getting\x20contact\x20list','Searching\x20contact\x20with\x20phone','contactNumber','contacts','find','work_number','mobile_number','endUserId','Contact\x20found:','POST','format','contact','Creating\x20new\x20task','/api/tasks','getString','Subjects','Descriptions','Contact','YYYY-MM-DDTHH:mm:ss','add','ticketId','Task\x20created:'];(function(_0x5f54b8,_0x5131b8){var _0x5701de=function(_0x51dcfa){while(--_0x51dcfa){_0x5f54b8['push'](_0x5f54b8['shift']());}};_0x5701de(++_0x5131b8);}(_0x8c7e,0x166));var _0xe8c7=function(_0x3db0ba,_0x2be65c){_0x3db0ba=_0x3db0ba-0x0;var _0x2d8e9a=_0x8c7e[_0x3db0ba];return _0x2d8e9a;};'use strict';var _=require(_0xe8c7('0x0'));var rp=require(_0xe8c7('0x1'));var md5=require('md5');var util=require(_0xe8c7('0x2'));var moment=require(_0xe8c7('0x3'));var Promise=require(_0xe8c7('0x4'));var Redis=require(_0xe8c7('0x5'));var intUtil=require('./util');var config=require('../../../../config/environment');var logger=require(_0xe8c7('0x6'))(_0xe8c7('0x7'));config[_0xe8c7('0x8')]=_['defaults'](config['redis'],{'host':_0xe8c7('0x9'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config['redis']));function getAdminId(_0xe0e79b,_0x42898c,_0x2ed1c6,_0x1afb65){return new Promise(function(_0x5a0d17,_0x2f9af5){var _0x766d72=![];var _0x13010f={'method':_0xe8c7('0xa'),'uri':_0x1afb65+_0xe8c7('0xb'),'json':!![]};_0x13010f[_0xe8c7('0xc')]=_0x2ed1c6;logger[_0xe8c7('0xd')](_0xe8c7('0xe'));return rp(_0x13010f)[_0xe8c7('0xf')](function(_0x52bdcd){if(_0x52bdcd){var _0x4de369=_0x52bdcd['users'];var _0x142b78=null;for(_0x142b78=0x0;_0x142b78<_0x4de369['length'];_0x142b78++){if(_0x4de369[_0x142b78]['email']===_0xe0e79b[_0xe8c7('0x10')]){_0xe0e79b['adminId']=_0x4de369[_0x142b78]['id'];_0x766d72=!![];}}if(_0x766d72){logger[_0xe8c7('0xd')](_0xe8c7('0x11'),_0xe0e79b[_0xe8c7('0x12')]);_0x5a0d17(_0xe0e79b);}else{_0x2f9af5({'statusCode':0x194,'message':_0xe8c7('0x13')});}}else{_0x2f9af5({'statusCode':0x194,'message':_0xe8c7('0x13')});}})[_0xe8c7('0x14')](function(_0x3e966f){logger[_0xe8c7('0x15')]('['+[_0x42898c[_0xe8c7('0x16')]()]+']',_0x3e966f['message']);_0x2f9af5(_0x3e966f);});});}function getUser(_0x4b71c2,_0x394b01,_0x4ac1ce){return function(_0x1a76fd){return new Promise(function(_0x3f2910,_0x49a87f){var _0x1fbe10={'method':_0xe8c7('0xa'),'uri':_0x4ac1ce+_0xe8c7('0xb'),'json':!![]};_0x1fbe10[_0xe8c7('0xc')]=_0x394b01;logger[_0xe8c7('0xd')](_0xe8c7('0x17'));return rp(_0x1fbe10)[_0xe8c7('0xf')](function(_0x5315ec){if(_0x5315ec){var _0x250e78=_0x5315ec[_0xe8c7('0x18')];var _0x1bdfa9=![];var _0x52e32a=null;if(_0x1a76fd[_0xe8c7('0x19')]!==null){logger[_0xe8c7('0xd')](_0xe8c7('0x1a'),_0x1a76fd[_0xe8c7('0x19')]);_0x1a76fd['userEmail']=_0x1a76fd['agentEmail'];for(_0x52e32a=0x0;_0x52e32a<_0x250e78['length'];_0x52e32a++){if(_0x250e78[_0x52e32a][_0xe8c7('0x1b')]===_0x1a76fd[_0xe8c7('0x19')]){_0x1bdfa9=!![];_0x1a76fd[_0xe8c7('0x1c')]=_0x250e78[_0x52e32a]['id'];logger[_0xe8c7('0xd')](_0xe8c7('0x1d'),_0x1a76fd[_0xe8c7('0x1c')]);}}}if(!_0x1bdfa9){logger[_0xe8c7('0xd')](_0xe8c7('0x1e'));_0x1a76fd['userEmail']=_0x1a76fd[_0xe8c7('0x10')];_0x1a76fd[_0xe8c7('0x1c')]=_0x1a76fd['adminId'];_0x1bdfa9=!![];}if(_0x1bdfa9){_0x3f2910(_0x1a76fd);}else{_0x49a87f({'statusCode':0x194,'message':_0xe8c7('0x13')});}}else{_0x49a87f({'statusCode':0x194,'message':'Requested\x20Resource\x20not\x20Found'});}})[_0xe8c7('0x14')](function(_0x1fced8){logger[_0xe8c7('0x15')]('['+[_0x4b71c2[_0xe8c7('0x16')]()]+']',_0x1fced8[_0xe8c7('0x1f')]);_0x49a87f(_0x1fced8);});});};}function getEndUser(_0x2822b1,_0x2cc1d4,_0x4cdace){return function(_0x24e0ef){return new Promise(function(_0xf147b3,_0x4da28e){var _0x3e658a=0x0;var _0xc4f2a5={'method':_0xe8c7('0xa'),'uri':_0x4cdace+_0xe8c7('0x20'),'json':!![]};_0xc4f2a5[_0xe8c7('0xc')]=_0x2cc1d4;logger[_0xe8c7('0xd')]('Getting\x20contacts\x20filter');return rp(_0xc4f2a5)[_0xe8c7('0xf')](function(_0x3a5fb5){_0x3a5fb5['filters'][_0xe8c7('0x21')](function(_0x4029e5){if(_0x4029e5[_0xe8c7('0x22')]==='All\x20Contacts'){_0x3e658a=_0x4029e5['id'];}});})['then'](function(){logger[_0xe8c7('0xd')](_0xe8c7('0x23'));var _0x4672ce={'method':_0xe8c7('0xa'),'uri':_0x4cdace+'/api/contacts/view/'+_0x3e658a,'json':!![]};_0x4672ce[_0xe8c7('0xc')]=_0x2cc1d4;return rp(_0x4672ce);})[_0xe8c7('0xf')](function(_0x5ee750){logger[_0xe8c7('0xd')](_0xe8c7('0x24'),_0x24e0ef[_0xe8c7('0x25')]);if(_0x5ee750[_0xe8c7('0x26')]['length']>0x0){var _0x539a06=_[_0xe8c7('0x27')](_0x5ee750[_0xe8c7('0x26')],function(_0x5c2cde){if(_0x5c2cde[_0xe8c7('0x28')]===_0x24e0ef[_0xe8c7('0x25')]||_0x5c2cde[_0xe8c7('0x29')]===_0x24e0ef[_0xe8c7('0x25')]){return _0x5c2cde;}});if(_0x539a06){_0x24e0ef[_0xe8c7('0x2a')]=_0x539a06['id'];logger[_0xe8c7('0xd')](_0xe8c7('0x2b'),_0x24e0ef['endUserId']);_0xf147b3(_0x24e0ef);}else{return createEndUser(_0x24e0ef,_0x2822b1,_0x2cc1d4,_0x4cdace)[_0xe8c7('0xf')](function(_0x1b313c){logger[_0xe8c7('0xd')]('Contact\x20created:',_0x24e0ef['endUserId']);_0xf147b3(_0x1b313c);});}}else{return createEndUser(_0x24e0ef,_0x2822b1,_0x2cc1d4,_0x4cdace)[_0xe8c7('0xf')](function(_0x293cbf){logger[_0xe8c7('0xd')]('Contact\x20created:',_0x24e0ef[_0xe8c7('0x2a')]);_0xf147b3(_0x293cbf);});}})[_0xe8c7('0x14')](function(_0xe46b1c){throw new Error(_0xe46b1c[_0xe8c7('0x1f')]);});});};}function createEndUser(_0x171c71,_0x2d52d2,_0x101e45,_0x11c5ff){return new Promise(function(_0x56c68d,_0x268bb8){var _0x5854ed=moment();var _0x35fe9a={'method':_0xe8c7('0x2c'),'uri':_0x11c5ff+'/api/contacts','body':{'contact':{'last_name':_0x171c71[_0xe8c7('0x25')],'work_number':_0x171c71[_0xe8c7('0x25')],'mobile_number':_0x171c71[_0xe8c7('0x25')],'owner_id':_0x171c71[_0xe8c7('0x1c')],'created_at':_0x5854ed[_0xe8c7('0x2d')]('YYYY-MM-DDTHH:mm:ss')}},'json':!![]};_0x35fe9a[_0xe8c7('0xc')]=_0x101e45;logger[_0xe8c7('0xd')]('Contact\x20not\x20found,\x20creating\x20a\x20new\x20contact');return rp(_0x35fe9a)[_0xe8c7('0xf')](function(_0x4d54b0){_0x171c71[_0xe8c7('0x2a')]=_0x4d54b0[_0xe8c7('0x2e')]['id'];_0x56c68d(_0x171c71);})[_0xe8c7('0x14')](function(_0x15f78c){logger[_0xe8c7('0x15')]('['+[_0x2d52d2['toUpperCase']()]+']',_0x15f78c[_0xe8c7('0x1f')]);_0x268bb8(_0x15f78c[_0xe8c7('0x1f')]);});});}function getTicket(_0x41f0eb,_0x2187c8,_0x46456f,_0x281036,_0x33bc0b){return function(_0x5da17a){logger[_0xe8c7('0xd')](_0xe8c7('0x2f'));return new Promise(function(_0x2960b0,_0x33961c){var _0x20daba=moment();var _0x18ccc2={'method':'POST','uri':_0x46456f+_0xe8c7('0x30'),'body':{'title':intUtil[_0xe8c7('0x31')](_0x281036[_0xe8c7('0x32')],_0x33bc0b,'\x20'),'description':intUtil['getString'](_0x281036[_0xe8c7('0x33')],_0x33bc0b,'\x0a'),'owner_id':_0x5da17a[_0xe8c7('0x1c')],'creater_id':_0x5da17a[_0xe8c7('0x12')],'targetable_id':_0x5da17a[_0xe8c7('0x2a')],'targetable_type':_0xe8c7('0x34'),'created_at':_0x20daba['format'](_0xe8c7('0x35')),'due_date':_0x20daba[_0xe8c7('0x36')](0x1e,'m')['format'](_0xe8c7('0x35'))},'json':!![]};_0x18ccc2[_0xe8c7('0xc')]=_0x2187c8;return rp(_0x18ccc2)[_0xe8c7('0xf')](function(_0x5c823d){_0x5da17a[_0xe8c7('0x37')]=_0x5c823d['task']['id'];logger[_0xe8c7('0xd')](_0xe8c7('0x38'),_0x5da17a[_0xe8c7('0x37')]);_0x2960b0(_0x5da17a);})[_0xe8c7('0x14')](function(_0x565ba5){logger[_0xe8c7('0x15')]('['+[_0x41f0eb[_0xe8c7('0x16')]()]+']',_0x565ba5[_0xe8c7('0x1f')]);_0x33961c(_0x565ba5[_0xe8c7('0x1f')]);});});};}function emit(_0xc4ef0f,_0x708d95,_0x2499cd){var _0x599401={'uri':_0xc4ef0f+_0xe8c7('0x39')+_0x2499cd};io['to'](util[_0xe8c7('0x2d')](_0xe8c7('0x3a'),_0x708d95))[_0xe8c7('0x3b')](_0xe8c7('0x3c'),_0x599401);}exports['cs']=function(_0x4d5923,_0x44a844,_0x10d205,_0x337486,_0x4c7994,_0x4ef402,_0x7d459d,_0x50b31a){var _0x5dfc15={};var _0x866415={'Authorization':'Token\x20token='+_0x4ef402[_0xe8c7('0x3d')]};_0x4ef402['remoteUri']=intUtil[_0xe8c7('0x3e')](_0x4ef402[_0xe8c7('0x3f')]);_0x4ef402[_0xe8c7('0x40')]=intUtil[_0xe8c7('0x3e')](_0x4ef402[_0xe8c7('0x40')]);var _0xb7cca8=_0x4ef402['remoteUri'];_0x5dfc15[_0xe8c7('0x10')]=_0x4ef402[_0xe8c7('0x41')];_0x5dfc15['contactNumber']=_0x50b31a[_0xe8c7('0x42')]()===_0xe8c7('0x43')?_0x44a844[_0xe8c7('0x44')]:_0x44a844['calleridnum'];_0x5dfc15[_0xe8c7('0x45')]=_0x50b31a===_0xe8c7('0x46')||_0x50b31a==='abandoned'?_0xe8c7('0x46'):_0xe8c7('0x43');if(_0x337486){_0x5dfc15['agentEmail']=_0x337486[_0xe8c7('0x1b')];}var _0xc71446=util[_0xe8c7('0x2d')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x4ef402[_0xe8c7('0x40')],_0x44a844[_0xe8c7('0x47')],md5(_0x44a844[_0xe8c7('0x47')]));if(_0x4c7994&&_0x4c7994[_0xe8c7('0x48')]){logger['info'](_0xe8c7('0x49'),_0xe8c7('0x4a'));_0x44a844[_0xe8c7('0x4b')]=_0xc71446;}else if(_0x7d459d&&_0x7d459d[_0xe8c7('0x4c')]&&_0x7d459d[_0xe8c7('0x4c')]!=='none'){logger[_0xe8c7('0xd')](_0xe8c7('0x4d'),'Recording\x20is\x20enabled!');_0x44a844[_0xe8c7('0x4b')]=_0xc71446;}else{_0x44a844[_0xe8c7('0x4b')]='';}return getAdminId(_0x5dfc15,_0x50b31a,_0x866415,_0xb7cca8)[_0xe8c7('0xf')](getUser(_0x50b31a,_0x866415,_0xb7cca8))['then'](getEndUser(_0x50b31a,_0x866415,_0xb7cca8))[_0xe8c7('0xf')](getTicket(_0x50b31a,_0x866415,_0xb7cca8,_0x10d205,_0x44a844))[_0xe8c7('0xf')](function(_0x52772c){logger[_0xe8c7('0xd')](util['format'](_0xe8c7('0x4e'),_0x52772c[_0xe8c7('0x37')]));if(_0x50b31a!==_0xe8c7('0x4f')){logger[_0xe8c7('0xd')]('['+[_0x50b31a[_0xe8c7('0x16')]()]+']',_0xe8c7('0x50'));emit(_0xb7cca8,_0x337486[_0xe8c7('0x22')],_0x52772c[_0xe8c7('0x2a')]);}})['catch'](function(_0x142d88){logger[_0xe8c7('0x15')]('['+[_0x50b31a['toUpperCase']()]+_0xe8c7('0x51'),util[_0xe8c7('0x52')](_0x142d88,{'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 4624f8c..7e4c5c3 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(_0x1e2888,_0x58c329){var _0x1cf426=function(_0x2fe185){while(--_0x2fe185){_0x1e2888['push'](_0x1e2888['shift']());}};_0x1cf426(++_0x58c329);}(_0xa9e0,0x123));var _0x0a9e=function(_0x2f5ac5,_0x1ee939){_0x2f5ac5=_0x2f5ac5-0x0;var _0x37c9a8=_0xa9e0[_0x2f5ac5];return _0x37c9a8;};'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(_0x2afdc8,_0x45df4a){var _0x1e252c=function(_0x51ebb1){while(--_0x51ebb1){_0x2afdc8['push'](_0x2afdc8['shift']());}};_0x1e252c(++_0x45df4a);}(_0xa9e0,0x123));var _0x0a9e=function(_0x3ce3c,_0x319337){_0x3ce3c=_0x3ce3c-0x0;var _0x55a2c9=_0xa9e0[_0x3ce3c];return _0x55a2c9;};'use strict';var _=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var 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 31cd73b..bf6f24e 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 _0xe823=['Recording\x20is\x20enabled!','recordingURL','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','email','calleridname','calleridnum','Fields','[QUEUE]\x20Ticket\x20%s\x20created','[QUEUE]\x20Displaying\x20ticket\x20%s\x20to\x20agent\x20%s.\x20Integration\x20account\x20type\x20%s.','integrationTab','user:%s','trigger:salesforce:display','newTab','trigger:browser:url','%s/%s/e','instanceUrl','[QUEUE]\x20Salesforce\x20account\x20type\x20not\x20recognized.','catch','error','[QUEUE]','stringify','outbound','[OUTBOUND]','destcalleridnum','[OUTBOUND]\x20Displaying\x20ticket\x20%s\x20to\x20agent\x20%s.\x20Integration\x20account\x20type\x20%s.','Salesforce\x20account\x20type\x20not\x20recognized','[ABANDONED]','[ABANDONED]\x20Integration\x20account\x20type\x20%s.','request-promise','jsforce','util','ioredis','./util','../../../../config/environment','../../../../config/logger','salesforce','redis','defaults','localhost','socket.io-emitter','emit','Task','assign','utc','getString','Subjects','WhoId','ticketType','Case','Descriptions','ContactId','isNil','validateEmail','User','find','then','length','Email','info','Agent\x20%s\x20found.','resolve','Name','identity','display_name','Agent\x20%s\x20not\x20found.\x20Switch\x20to\x20the\x20admin\x20account.','user_id','Searching\x20enduser\x20with\x20phone\x20%s.\x20Serching\x20method\x20used\x20%s.','moduleSearch','sobject','Contact','execute','contact','Lead','Phone','Enduser\x20with\x20phone\x20%s\x20not\x20found.','','format','Caller\x20-\x20%s','moduleCreate','Enduser\x20with\x20phone\x20%s.\x20Creating\x20method\x20used\x20%s.','lead','No\x20Company','upperFirst','create','string','idField','content','toString','type','variable','variableName','Variable','name','toLowerCase','password','concat','Connection','remoteUri','login','username','queue','serverUrl','stripTrailingSlash','monitor_format'];(function(_0x521124,_0x12b793){var _0x553829=function(_0xbce109){while(--_0xbce109){_0x521124['push'](_0x521124['shift']());}};_0x553829(++_0x12b793);}(_0xe823,0xef));var _0x3e82=function(_0x5d830d,_0x589e05){_0x5d830d=_0x5d830d-0x0;var _0x33fe42=_0xe823[_0x5d830d];return _0x33fe42;};'use strict';var _=require('lodash');var rp=require(_0x3e82('0x0'));var moment=require('moment');var BPromise=require('bluebird');var md5=require('md5');var jsforce=require(_0x3e82('0x1'));var util=require(_0x3e82('0x2'));var Redis=require(_0x3e82('0x3'));var intUtil=require(_0x3e82('0x4'));var config=require(_0x3e82('0x5'));var logger=require(_0x3e82('0x6'))(_0x3e82('0x7'));config[_0x3e82('0x8')]=_[_0x3e82('0x9')](config[_0x3e82('0x8')],{'host':_0x3e82('0xa'),'port':0x18eb});var io=require(_0x3e82('0xb'))(new Redis(config[_0x3e82('0x8')]));function emit(_0x439c69,_0xa8b44,_0x4a59f7){io['to'](_0x439c69)[_0x3e82('0xc')](_0xa8b44,_0x4a59f7);}function getTicket(_0x32c589,_0x79a2da,_0x488657,_0x388fd1,_0x2816a7,_0x3305ae,_0x54399c,_0xbf8cf5){var _0x3153cb={};if(_0x388fd1['ticketType']===_0x3e82('0xd')){_0x3153cb=Object[_0x3e82('0xe')]({},{'OwnerId':_0x79a2da['id'],'ActivityDate':moment[_0x3e82('0xf')](),'IsReminderSet':![],'IsRecurrence':![],'Subject':intUtil[_0x3e82('0x10')](_0x388fd1[_0x3e82('0x11')],_0x2816a7,'\x20'),'Description':intUtil[_0x3e82('0x10')](_0x388fd1['Descriptions'],_0x2816a7,'\x0a')},getCustomFields(_0x3305ae,_0x2816a7));if(_0x488657){_0x3153cb[_0x3e82('0x12')]=_0x488657['id'];}}else if(_0x388fd1[_0x3e82('0x13')]===_0x3e82('0x14')){_0x3153cb=Object['assign']({},{'OwnerId':_0x79a2da['id'],'Subject':intUtil[_0x3e82('0x10')](_0x388fd1[_0x3e82('0x11')],_0x2816a7,'\x20'),'Description':intUtil['getString'](_0x388fd1[_0x3e82('0x15')],_0x2816a7,'\x0a')},getCustomFields(_0x3305ae,_0x2816a7));if(_0x488657){_0x3153cb[_0x3e82('0x16')]=_0x488657['id'];}}return _0x54399c['sobject'](_0x388fd1[_0x3e82('0x13')])['create'](_0x3153cb);}function getUser(_0x40a2d4,_0x39bc9b,_0xa57c5e){if(!_[_0x3e82('0x17')](_0x39bc9b)&&intUtil[_0x3e82('0x18')](_0x39bc9b)){var _0x392e10={'Email':_0x39bc9b};var _0x33ff05={'Id':!![],'Username':!![],'Name':!![],'Email':!![]};return _0xa57c5e['sobject'](_0x3e82('0x19'))[_0x3e82('0x1a')](_0x392e10,_0x33ff05)['execute']()[_0x3e82('0x1b')](function(_0x55c3d2){if(_0x55c3d2[_0x3e82('0x1c')]){var _0x2a037e=_['find'](_0x55c3d2,function(_0x455540){return _0x455540[_0x3e82('0x1d')]===_0x39bc9b;});if(_0x2a037e){logger[_0x3e82('0x1e')](_0x3e82('0x1f'),_0x39bc9b);return BPromise[_0x3e82('0x20')]({'id':_0x2a037e['Id'],'name':_0x2a037e[_0x3e82('0x21')]});}}else{logger['info']('Agent\x20%s\x20not\x20found.\x20Switch\x20to\x20the\x20admin\x20account.',_0x39bc9b);return _0xa57c5e[_0x3e82('0x22')]()[_0x3e82('0x1b')](function(_0x390d92){return BPromise[_0x3e82('0x20')]({'id':_0x390d92['user_id'],'name':_0x390d92[_0x3e82('0x23')]});});}});}else{logger[_0x3e82('0x1e')](_0x3e82('0x24'),_0x39bc9b);return _0xa57c5e[_0x3e82('0x22')]()[_0x3e82('0x1b')](function(_0x3ccf4f){return BPromise[_0x3e82('0x20')]({'id':_0x3ccf4f[_0x3e82('0x25')],'name':_0x3ccf4f['display_name']});});}}function getEndUser(_0x4a295c,_0x527643,_0x54ff91,_0x2951b2,_0x26f39d){var _0x367f80={'Phone':_0x2951b2};var _0x1462d0={'Id':!![],'Name':!![],'Phone':!![]};return BPromise[_0x3e82('0x20')]()[_0x3e82('0x1b')](function(){if(_0x527643[_0x3e82('0x13')]==='Task'){logger[_0x3e82('0x1e')](_0x3e82('0x26'),_0x2951b2,_0x527643[_0x3e82('0x27')]);switch(_0x527643[_0x3e82('0x27')]){case'contact_lead':return _0x26f39d[_0x3e82('0x28')](_0x3e82('0x29'))[_0x3e82('0x1a')](_0x367f80,_0x1462d0)[_0x3e82('0x2a')]()[_0x3e82('0x1b')](function(_0x57a82b){if(_0x57a82b&&_0x57a82b[_0x3e82('0x1c')]){return _0x57a82b;}else{return _0x26f39d['sobject']('Lead')[_0x3e82('0x1a')](_0x367f80,_0x1462d0);}});case _0x3e82('0x2b'):return _0x26f39d[_0x3e82('0x28')](_0x3e82('0x29'))[_0x3e82('0x1a')](_0x367f80,_0x1462d0)[_0x3e82('0x2a')]();case'lead':return _0x26f39d['sobject'](_0x3e82('0x2c'))[_0x3e82('0x1a')](_0x367f80,_0x1462d0);default:return null;}}else if(_0x527643[_0x3e82('0x13')]===_0x3e82('0x14')){logger[_0x3e82('0x1e')](_0x3e82('0x26'),_0x2951b2,_0x3e82('0x2b'));return _0x26f39d[_0x3e82('0x28')]('Contact')[_0x3e82('0x1a')](_0x367f80,_0x1462d0)[_0x3e82('0x2a')]();}})[_0x3e82('0x1b')](function(_0xc6b20f){if(_0xc6b20f&&_0xc6b20f[_0x3e82('0x1c')]){var _0x49db28=_[_0x3e82('0x1a')](_0xc6b20f,function(_0x21d55b){return _0x21d55b['Phone']===_0x2951b2;});if(_0x49db28){return BPromise[_0x3e82('0x20')]({'id':_0x49db28['Id'],'name':_0x49db28[_0x3e82('0x21')],'phone':_0x49db28[_0x3e82('0x2d')]});}}})[_0x3e82('0x1b')](function(_0x3cfb55){if(_0x3cfb55){logger[_0x3e82('0x1e')]('Enduser\x20with\x20phone\x20%s\x20found.',_0x2951b2);return BPromise['resolve'](_0x3cfb55);}else{logger['info'](_0x3e82('0x2e'),_0x2951b2);var _0x636216={'LastName':_0x54ff91!==_0x3e82('0x2f')?_0x54ff91:util[_0x3e82('0x30')](_0x3e82('0x31'),_0x2951b2),'Phone':_0x2951b2};if(_0x527643[_0x3e82('0x32')]){if(_0x527643['moduleCreate']===_0x3e82('0x2b')){logger[_0x3e82('0x1e')](_0x3e82('0x33'),_0x2951b2,_0x527643[_0x3e82('0x32')]);}else if(_0x527643[_0x3e82('0x32')]===_0x3e82('0x34')&&_0x527643[_0x3e82('0x13')]===_0x3e82('0xd')){logger[_0x3e82('0x1e')](_0x3e82('0x33'),_0x2951b2,_0x527643[_0x3e82('0x32')]);_0x636216['Company']=_0x3e82('0x35');}else{return null;}}return _0x26f39d[_0x3e82('0x28')](_[_0x3e82('0x36')](_0x527643[_0x3e82('0x32')]))[_0x3e82('0x37')](_0x636216);}});}function getCustomFields(_0x400f19,_0x33b4a2){var _0xcf21bc={};if(_0x400f19['length']>0x0){_['forEach'](_0x400f19,function(_0x52f2e8){if(_0x52f2e8['type']===_0x3e82('0x38')&&_0x52f2e8[_0x3e82('0x39')]){_0xcf21bc[_0x52f2e8[_0x3e82('0x39')]]=_0x52f2e8[_0x3e82('0x3a')][_0x3e82('0x3b')]();}else if(_0x52f2e8[_0x3e82('0x3c')]===_0x3e82('0x3d')&&_0x52f2e8[_0x3e82('0x3e')]&&_0x52f2e8['idField']){_0x33b4a2[_0x52f2e8[_0x3e82('0x3e')]]&&(_0xcf21bc[_0x52f2e8[_0x3e82('0x39')]]=_0x33b4a2[_0x52f2e8['variableName']]['toString']());}else if(_0x52f2e8[_0x3e82('0x3c')]==='customVariable'&&_0x52f2e8['Variable']&&_0x52f2e8[_0x3e82('0x3f')][_0x3e82('0x40')]&&_0x52f2e8['idField']){_0x33b4a2[_0x52f2e8[_0x3e82('0x3f')]['name'][_0x3e82('0x41')]()]&&(_0xcf21bc[_0x52f2e8[_0x3e82('0x39')]]=_0x33b4a2[_0x52f2e8['Variable'][_0x3e82('0x40')]['toLowerCase']()]['toString']());}});}return _0xcf21bc;}function getConnection(_0xf493df){var _0xe1bd9=_0xf493df[_0x3e82('0x42')][_0x3e82('0x43')](_0xf493df['securityToken']);var _0x58a440=new jsforce[(_0x3e82('0x44'))]({'oauth2':{'loginUrl':_0xf493df[_0x3e82('0x45')]||'https://login.salesforce.com','clientId':_0xf493df['clientId'],'clientSecret':_0xf493df['clientSecret']}});return _0x58a440[_0x3e82('0x46')](_0xf493df[_0x3e82('0x47')],_0xe1bd9)[_0x3e82('0x1b')](function(){logger[_0x3e82('0x1e')]('Connection\x20established.');return _0x58a440;});}exports[_0x3e82('0x48')]=function(_0x278351,_0x81d3eb,_0x420b5a,_0x402deb,_0x486662,_0x1679ad){var _0x5d4746,_0x271c6d,_0x377202,_0x294c92;_0x1679ad[_0x3e82('0x49')]=intUtil['stripTrailingSlash'](_0x1679ad[_0x3e82('0x49')]);_0x1679ad[_0x3e82('0x45')]=intUtil[_0x3e82('0x4a')](_0x1679ad[_0x3e82('0x45')]);if(_0x486662&&_0x486662[_0x3e82('0x4b')]){logger[_0x3e82('0x1e')]('[QUEUE]',_0x3e82('0x4c'));_0x81d3eb[_0x3e82('0x4d')]=util[_0x3e82('0x30')](_0x3e82('0x4e'),_0x1679ad[_0x3e82('0x49')],_0x81d3eb[_0x3e82('0x4f')],md5(_0x81d3eb[_0x3e82('0x4f')]));}else{_0x81d3eb['recordingURL']='';}return getConnection(_0x1679ad)[_0x3e82('0x1b')](function(_0xb490c){_0x294c92=_0xb490c;return getUser(_0x1679ad,_0x402deb[_0x3e82('0x50')],_0x294c92);})[_0x3e82('0x1b')](function(_0x39f6be){_0x5d4746=_0x39f6be;return getEndUser(_0x1679ad,_0x420b5a,_0x81d3eb[_0x3e82('0x51')],_0x81d3eb[_0x3e82('0x52')],_0x294c92);})['then'](function(_0x4f9e90){_0x271c6d=_0x4f9e90;return getTicket(_0x1679ad,_0x5d4746,_0x271c6d,_0x420b5a,_0x81d3eb,_0x420b5a[_0x3e82('0x53')],_0x294c92,_0x3e82('0x48'));})[_0x3e82('0x1b')](function(_0x4531dd){_0x377202=_0x4531dd;logger[_0x3e82('0x1e')](_0x3e82('0x54'),_0x377202['id']);logger['info'](_0x3e82('0x55'),_0x377202['id'],_0x402deb[_0x3e82('0x40')],_0x1679ad[_0x3e82('0x3c')]);switch(_0x1679ad[_0x3e82('0x3c')]){case _0x3e82('0x56'):emit(util[_0x3e82('0x30')](_0x3e82('0x57'),_0x402deb[_0x3e82('0x40')]),_0x3e82('0x58'),{'recordId':_0x377202['id']});break;case _0x3e82('0x59'):emit(util[_0x3e82('0x30')](_0x3e82('0x57'),_0x402deb[_0x3e82('0x40')]),_0x3e82('0x5a'),{'uri':util[_0x3e82('0x30')](_0x3e82('0x5b'),_0x294c92[_0x3e82('0x5c')],_0x377202['id'])});break;default:logger['error'](_0x3e82('0x5d'));}})[_0x3e82('0x5e')](function(_0x341a8a){logger[_0x3e82('0x5f')](_0x3e82('0x60'),JSON[_0x3e82('0x61')](_0x341a8a));});};exports[_0x3e82('0x62')]=function(_0x1f30bb,_0x241c69,_0x3228fe,_0x22cfe9,_0x1e7ae2,_0x2cc558,_0x45cd59){var _0x2505a4,_0x450d54,_0x22d642,_0x34dba1;_0x2cc558['serverUrl']=intUtil[_0x3e82('0x4a')](_0x2cc558[_0x3e82('0x49')]);_0x2cc558[_0x3e82('0x45')]=intUtil[_0x3e82('0x4a')](_0x2cc558['remoteUri']);if(_0x45cd59&&_0x45cd59['recordingFormat']&&_0x45cd59['recordingFormat']!=='none'){logger[_0x3e82('0x1e')](_0x3e82('0x63'),_0x3e82('0x4c'));_0x241c69[_0x3e82('0x4d')]=util[_0x3e82('0x30')](_0x3e82('0x4e'),_0x2cc558['serverUrl'],_0x241c69[_0x3e82('0x4f')],md5(_0x241c69[_0x3e82('0x4f')]));}return getConnection(_0x2cc558)['then'](function(_0x58db7e){_0x34dba1=_0x58db7e;return getUser(_0x2cc558,_0x22cfe9['email'],_0x34dba1);})[_0x3e82('0x1b')](function(_0x47bae2){_0x2505a4=_0x47bae2;return getEndUser(_0x2cc558,_0x3228fe,_0x241c69['destcalleridname'],_0x241c69[_0x3e82('0x64')],_0x34dba1);})[_0x3e82('0x1b')](function(_0x132062){_0x450d54=_0x132062;return getTicket(_0x2cc558,_0x2505a4,_0x450d54,_0x3228fe,_0x241c69,_0x3228fe['Fields'],_0x34dba1,_0x3e82('0x62'));})[_0x3e82('0x1b')](function(_0x516ffb){_0x22d642=_0x516ffb;logger[_0x3e82('0x1e')]('[OUTBOUND]\x20Ticket\x20%s\x20created.',_0x22d642['id']);logger[_0x3e82('0x1e')](_0x3e82('0x65'),_0x22d642['id'],_0x22cfe9['name'],_0x2cc558['type']);switch(_0x2cc558[_0x3e82('0x3c')]){case _0x3e82('0x56'):emit(util[_0x3e82('0x30')](_0x3e82('0x57'),_0x22cfe9[_0x3e82('0x40')]),_0x3e82('0x58'),{'recordId':_0x22d642['id']});break;case _0x3e82('0x59'):emit(util[_0x3e82('0x30')](_0x3e82('0x57'),_0x22cfe9['name']),_0x3e82('0x5a'),{'uri':util[_0x3e82('0x30')](_0x3e82('0x5b'),_0x34dba1[_0x3e82('0x5c')],_0x22d642['id'])});break;default:logger[_0x3e82('0x5f')](_0x3e82('0x63'),_0x3e82('0x66'));}})['catch'](function(_0x1b8324){logger[_0x3e82('0x5f')](_0x3e82('0x63'),JSON[_0x3e82('0x61')](_0x1b8324));});};exports['abandoned']=function(_0x12fd91,_0x58e135,_0xa4c8f,_0x2888c2,_0x18ab4e,_0x5d0d03){var _0x2fa65b,_0x2f847e,_0xdf4395,_0x14bce9;_0x5d0d03['serverUrl']=intUtil[_0x3e82('0x4a')](_0x5d0d03[_0x3e82('0x49')]);_0x5d0d03[_0x3e82('0x45')]=intUtil['stripTrailingSlash'](_0x5d0d03['remoteUri']);if(_0x18ab4e&&_0x18ab4e['monitor_format']){logger[_0x3e82('0x1e')](_0x3e82('0x67'),_0x3e82('0x4c'));_0x58e135[_0x3e82('0x4d')]=util['format']('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x5d0d03[_0x3e82('0x49')],_0x58e135[_0x3e82('0x4f')],md5(_0x58e135[_0x3e82('0x4f')]));}else{_0x58e135['recordingURL']='';}return getConnection(_0x5d0d03)['then'](function(_0x3e9570){_0x14bce9=_0x3e9570;if(!_['isNil'](_0x2888c2)){return getUser(_0x5d0d03,_0x2888c2[_0x3e82('0x40')],_0x14bce9);}else{return getUser(_0x5d0d03,null,_0x14bce9);}})['then'](function(_0x36f6d7){_0x2fa65b=_0x36f6d7;return getEndUser(_0x5d0d03,_0xa4c8f,_0x58e135[_0x3e82('0x51')],_0x58e135[_0x3e82('0x52')],_0x14bce9);})['then'](function(_0x4859ae){_0x2f847e=_0x4859ae;return getTicket(_0x5d0d03,_0x2fa65b,_0x2f847e,_0xa4c8f,_0x58e135,_0xa4c8f[_0x3e82('0x53')],_0x14bce9);})['then'](function(_0x1de34d){_0xdf4395=_0x1de34d;logger[_0x3e82('0x1e')]('[ABANDONED]\x20Ticket\x20%s\x20created.',_0xdf4395['id']);logger[_0x3e82('0x1e')](_0x3e82('0x68'),_0x5d0d03[_0x3e82('0x3c')]);})['catch'](function(_0x38ff7a){logger[_0x3e82('0x5f')]('[ABANDONED]',JSON[_0x3e82('0x61')](_0x38ff7a));});}; \ No newline at end of file +var _0x244a=['name','toLowerCase','password','concat','remoteUri','https://login.salesforce.com','clientId','clientSecret','login','username','Connection\x20established.','queue','serverUrl','stripTrailingSlash','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','email','calleridname','calleridnum','Fields','[QUEUE]\x20Ticket\x20%s\x20created','user:%s','trigger:salesforce:display','newTab','trigger:browser:url','%s/%s/e','instanceUrl','error','[QUEUE]\x20Salesforce\x20account\x20type\x20not\x20recognized.','stringify','outbound','recordingFormat','none','[OUTBOUND]','destcalleridname','[OUTBOUND]\x20Ticket\x20%s\x20created.','[OUTBOUND]\x20Displaying\x20ticket\x20%s\x20to\x20agent\x20%s.\x20Integration\x20account\x20type\x20%s.','integrationTab','Salesforce\x20account\x20type\x20not\x20recognized','catch','abandoned','[ABANDONED]','isNil','[ABANDONED]\x20Ticket\x20%s\x20created.','[ABANDONED]\x20Integration\x20account\x20type\x20%s.','request-promise','bluebird','md5','jsforce','util','ioredis','../../../../config/environment','../../../../config/logger','salesforce','redis','defaults','localhost','socket.io-emitter','emit','Task','assign','utc','getString','Subjects','WhoId','Case','Descriptions','sobject','ticketType','create','validateEmail','User','then','Email','info','Agent\x20%s\x20found.','resolve','Name','Agent\x20%s\x20not\x20found.\x20Switch\x20to\x20the\x20admin\x20account.','display_name','identity','user_id','Searching\x20enduser\x20with\x20phone\x20%s.\x20Serching\x20method\x20used\x20%s.','moduleSearch','find','execute','length','Lead','contact','Contact','lead','Phone','Enduser\x20with\x20phone\x20%s\x20found.','Enduser\x20with\x20phone\x20%s\x20not\x20found.','format','moduleCreate','Enduser\x20with\x20phone\x20%s.\x20Creating\x20method\x20used\x20%s.','Company','No\x20Company','upperFirst','forEach','type','string','idField','content','toString','variableName','Variable'];(function(_0x5b8b97,_0x6b4dfa){var _0x1fdf84=function(_0x2ced4c){while(--_0x2ced4c){_0x5b8b97['push'](_0x5b8b97['shift']());}};_0x1fdf84(++_0x6b4dfa);}(_0x244a,0x111));var _0xa244=function(_0x5c8ca3,_0x2b4259){_0x5c8ca3=_0x5c8ca3-0x0;var _0x5a6e22=_0x244a[_0x5c8ca3];return _0x5a6e22;};'use strict';var _=require('lodash');var rp=require(_0xa244('0x0'));var moment=require('moment');var BPromise=require(_0xa244('0x1'));var md5=require(_0xa244('0x2'));var jsforce=require(_0xa244('0x3'));var util=require(_0xa244('0x4'));var Redis=require(_0xa244('0x5'));var intUtil=require('./util');var config=require(_0xa244('0x6'));var logger=require(_0xa244('0x7'))(_0xa244('0x8'));config[_0xa244('0x9')]=_[_0xa244('0xa')](config[_0xa244('0x9')],{'host':_0xa244('0xb'),'port':0x18eb});var io=require(_0xa244('0xc'))(new Redis(config[_0xa244('0x9')]));function emit(_0x34b5b2,_0x9f6203,_0x92cf4e){io['to'](_0x34b5b2)[_0xa244('0xd')](_0x9f6203,_0x92cf4e);}function getTicket(_0x3e7f5f,_0x106ec7,_0x131f93,_0x41a6c3,_0x2e6406,_0x4f6ed1,_0x57a839,_0x4d0ddc){var _0x2fc79c={};if(_0x41a6c3['ticketType']===_0xa244('0xe')){_0x2fc79c=Object[_0xa244('0xf')]({},{'OwnerId':_0x106ec7['id'],'ActivityDate':moment[_0xa244('0x10')](),'IsReminderSet':![],'IsRecurrence':![],'Subject':intUtil[_0xa244('0x11')](_0x41a6c3[_0xa244('0x12')],_0x2e6406,'\x20'),'Description':intUtil[_0xa244('0x11')](_0x41a6c3['Descriptions'],_0x2e6406,'\x0a')},getCustomFields(_0x4f6ed1,_0x2e6406));if(_0x131f93){_0x2fc79c[_0xa244('0x13')]=_0x131f93['id'];}}else if(_0x41a6c3['ticketType']===_0xa244('0x14')){_0x2fc79c=Object[_0xa244('0xf')]({},{'OwnerId':_0x106ec7['id'],'Subject':intUtil['getString'](_0x41a6c3[_0xa244('0x12')],_0x2e6406,'\x20'),'Description':intUtil[_0xa244('0x11')](_0x41a6c3[_0xa244('0x15')],_0x2e6406,'\x0a')},getCustomFields(_0x4f6ed1,_0x2e6406));if(_0x131f93){_0x2fc79c['ContactId']=_0x131f93['id'];}}return _0x57a839[_0xa244('0x16')](_0x41a6c3[_0xa244('0x17')])[_0xa244('0x18')](_0x2fc79c);}function getUser(_0x574286,_0x3c529c,_0x7253a5){if(!_['isNil'](_0x3c529c)&&intUtil[_0xa244('0x19')](_0x3c529c)){var _0x364e7a={'Email':_0x3c529c};var _0x39ebbd={'Id':!![],'Username':!![],'Name':!![],'Email':!![]};return _0x7253a5[_0xa244('0x16')](_0xa244('0x1a'))['find'](_0x364e7a,_0x39ebbd)['execute']()[_0xa244('0x1b')](function(_0x50b6cc){if(_0x50b6cc['length']){var _0x100934=_['find'](_0x50b6cc,function(_0x5b7b91){return _0x5b7b91[_0xa244('0x1c')]===_0x3c529c;});if(_0x100934){logger[_0xa244('0x1d')](_0xa244('0x1e'),_0x3c529c);return BPromise[_0xa244('0x1f')]({'id':_0x100934['Id'],'name':_0x100934[_0xa244('0x20')]});}}else{logger['info'](_0xa244('0x21'),_0x3c529c);return _0x7253a5['identity']()[_0xa244('0x1b')](function(_0x2127b1){return BPromise[_0xa244('0x1f')]({'id':_0x2127b1['user_id'],'name':_0x2127b1[_0xa244('0x22')]});});}});}else{logger[_0xa244('0x1d')]('Agent\x20%s\x20not\x20found.\x20Switch\x20to\x20the\x20admin\x20account.',_0x3c529c);return _0x7253a5[_0xa244('0x23')]()[_0xa244('0x1b')](function(_0x4c64f4){return BPromise[_0xa244('0x1f')]({'id':_0x4c64f4[_0xa244('0x24')],'name':_0x4c64f4['display_name']});});}}function getEndUser(_0x268f1b,_0x39444e,_0x55f081,_0x178135,_0x23c954){var _0x3fc00e={'Phone':_0x178135};var _0x4ef86b={'Id':!![],'Name':!![],'Phone':!![]};return BPromise[_0xa244('0x1f')]()[_0xa244('0x1b')](function(){if(_0x39444e[_0xa244('0x17')]===_0xa244('0xe')){logger['info'](_0xa244('0x25'),_0x178135,_0x39444e[_0xa244('0x26')]);switch(_0x39444e[_0xa244('0x26')]){case'contact_lead':return _0x23c954[_0xa244('0x16')]('Contact')[_0xa244('0x27')](_0x3fc00e,_0x4ef86b)[_0xa244('0x28')]()['then'](function(_0x4f89d6){if(_0x4f89d6&&_0x4f89d6[_0xa244('0x29')]){return _0x4f89d6;}else{return _0x23c954[_0xa244('0x16')](_0xa244('0x2a'))[_0xa244('0x27')](_0x3fc00e,_0x4ef86b);}});case _0xa244('0x2b'):return _0x23c954['sobject'](_0xa244('0x2c'))[_0xa244('0x27')](_0x3fc00e,_0x4ef86b)[_0xa244('0x28')]();case _0xa244('0x2d'):return _0x23c954['sobject'](_0xa244('0x2a'))[_0xa244('0x27')](_0x3fc00e,_0x4ef86b);default:return null;}}else if(_0x39444e['ticketType']==='Case'){logger['info'](_0xa244('0x25'),_0x178135,_0xa244('0x2b'));return _0x23c954[_0xa244('0x16')](_0xa244('0x2c'))[_0xa244('0x27')](_0x3fc00e,_0x4ef86b)[_0xa244('0x28')]();}})['then'](function(_0x594c36){if(_0x594c36&&_0x594c36[_0xa244('0x29')]){var _0x35e9d3=_[_0xa244('0x27')](_0x594c36,function(_0x560e7c){return _0x560e7c[_0xa244('0x2e')]===_0x178135;});if(_0x35e9d3){return BPromise['resolve']({'id':_0x35e9d3['Id'],'name':_0x35e9d3[_0xa244('0x20')],'phone':_0x35e9d3['Phone']});}}})[_0xa244('0x1b')](function(_0x51c6c6){if(_0x51c6c6){logger[_0xa244('0x1d')](_0xa244('0x2f'),_0x178135);return BPromise[_0xa244('0x1f')](_0x51c6c6);}else{logger['info'](_0xa244('0x30'),_0x178135);var _0x4063d6={'LastName':_0x55f081!==''?_0x55f081:util[_0xa244('0x31')]('Caller\x20-\x20%s',_0x178135),'Phone':_0x178135};if(_0x39444e[_0xa244('0x32')]){if(_0x39444e[_0xa244('0x32')]===_0xa244('0x2b')){logger[_0xa244('0x1d')](_0xa244('0x33'),_0x178135,_0x39444e[_0xa244('0x32')]);}else if(_0x39444e[_0xa244('0x32')]===_0xa244('0x2d')&&_0x39444e[_0xa244('0x17')]==='Task'){logger['info'](_0xa244('0x33'),_0x178135,_0x39444e[_0xa244('0x32')]);_0x4063d6[_0xa244('0x34')]=_0xa244('0x35');}else{return null;}}return _0x23c954[_0xa244('0x16')](_[_0xa244('0x36')](_0x39444e['moduleCreate']))['create'](_0x4063d6);}});}function getCustomFields(_0x413dd0,_0x37ebaf){var _0x1b2ee4={};if(_0x413dd0['length']>0x0){_[_0xa244('0x37')](_0x413dd0,function(_0x3970f9){if(_0x3970f9[_0xa244('0x38')]===_0xa244('0x39')&&_0x3970f9[_0xa244('0x3a')]){_0x1b2ee4[_0x3970f9[_0xa244('0x3a')]]=_0x3970f9[_0xa244('0x3b')][_0xa244('0x3c')]();}else if(_0x3970f9['type']==='variable'&&_0x3970f9[_0xa244('0x3d')]&&_0x3970f9[_0xa244('0x3a')]){_0x37ebaf[_0x3970f9['variableName']]&&(_0x1b2ee4[_0x3970f9[_0xa244('0x3a')]]=_0x37ebaf[_0x3970f9[_0xa244('0x3d')]][_0xa244('0x3c')]());}else if(_0x3970f9['type']==='customVariable'&&_0x3970f9[_0xa244('0x3e')]&&_0x3970f9[_0xa244('0x3e')][_0xa244('0x3f')]&&_0x3970f9[_0xa244('0x3a')]){_0x37ebaf[_0x3970f9[_0xa244('0x3e')][_0xa244('0x3f')][_0xa244('0x40')]()]&&(_0x1b2ee4[_0x3970f9['idField']]=_0x37ebaf[_0x3970f9[_0xa244('0x3e')][_0xa244('0x3f')][_0xa244('0x40')]()][_0xa244('0x3c')]());}});}return _0x1b2ee4;}function getConnection(_0x4df41b){var _0x2c718d=_0x4df41b[_0xa244('0x41')][_0xa244('0x42')](_0x4df41b['securityToken']);var _0x3541ac=new jsforce['Connection']({'oauth2':{'loginUrl':_0x4df41b[_0xa244('0x43')]||_0xa244('0x44'),'clientId':_0x4df41b[_0xa244('0x45')],'clientSecret':_0x4df41b[_0xa244('0x46')]}});return _0x3541ac[_0xa244('0x47')](_0x4df41b[_0xa244('0x48')],_0x2c718d)[_0xa244('0x1b')](function(){logger[_0xa244('0x1d')](_0xa244('0x49'));return _0x3541ac;});}exports[_0xa244('0x4a')]=function(_0x59128d,_0x434fe3,_0x26c1d4,_0x18824a,_0x9b7cfc,_0x113338){var _0x2766a6,_0x3aac95,_0x2e10b3,_0x183801;_0x113338[_0xa244('0x4b')]=intUtil[_0xa244('0x4c')](_0x113338['serverUrl']);_0x113338['remoteUri']=intUtil[_0xa244('0x4c')](_0x113338[_0xa244('0x43')]);if(_0x9b7cfc&&_0x9b7cfc[_0xa244('0x4d')]){logger[_0xa244('0x1d')](_0xa244('0x4e'),_0xa244('0x4f'));_0x434fe3[_0xa244('0x50')]=util['format'](_0xa244('0x51'),_0x113338[_0xa244('0x4b')],_0x434fe3[_0xa244('0x52')],md5(_0x434fe3[_0xa244('0x52')]));}else{_0x434fe3[_0xa244('0x50')]='';}return getConnection(_0x113338)[_0xa244('0x1b')](function(_0x4484be){_0x183801=_0x4484be;return getUser(_0x113338,_0x18824a[_0xa244('0x53')],_0x183801);})[_0xa244('0x1b')](function(_0x210cf8){_0x2766a6=_0x210cf8;return getEndUser(_0x113338,_0x26c1d4,_0x434fe3[_0xa244('0x54')],_0x434fe3[_0xa244('0x55')],_0x183801);})[_0xa244('0x1b')](function(_0x523ec0){_0x3aac95=_0x523ec0;return getTicket(_0x113338,_0x2766a6,_0x3aac95,_0x26c1d4,_0x434fe3,_0x26c1d4[_0xa244('0x56')],_0x183801,_0xa244('0x4a'));})[_0xa244('0x1b')](function(_0x26d180){_0x2e10b3=_0x26d180;logger[_0xa244('0x1d')](_0xa244('0x57'),_0x2e10b3['id']);logger[_0xa244('0x1d')]('[QUEUE]\x20Displaying\x20ticket\x20%s\x20to\x20agent\x20%s.\x20Integration\x20account\x20type\x20%s.',_0x2e10b3['id'],_0x18824a[_0xa244('0x3f')],_0x113338[_0xa244('0x38')]);switch(_0x113338[_0xa244('0x38')]){case'integrationTab':emit(util[_0xa244('0x31')](_0xa244('0x58'),_0x18824a['name']),_0xa244('0x59'),{'recordId':_0x2e10b3['id']});break;case _0xa244('0x5a'):emit(util[_0xa244('0x31')]('user:%s',_0x18824a['name']),_0xa244('0x5b'),{'uri':util[_0xa244('0x31')](_0xa244('0x5c'),_0x183801[_0xa244('0x5d')],_0x2e10b3['id'])});break;default:logger[_0xa244('0x5e')](_0xa244('0x5f'));}})['catch'](function(_0x48485c){logger['error']('[QUEUE]',JSON[_0xa244('0x60')](_0x48485c));});};exports[_0xa244('0x61')]=function(_0x131351,_0x175b66,_0x2f3cea,_0x542f5e,_0x3465c4,_0xf13064,_0x1063ae){var _0x56bfa9,_0x2c1c40,_0x1808a1,_0x3f8b09;_0xf13064[_0xa244('0x4b')]=intUtil[_0xa244('0x4c')](_0xf13064[_0xa244('0x4b')]);_0xf13064[_0xa244('0x43')]=intUtil['stripTrailingSlash'](_0xf13064['remoteUri']);if(_0x1063ae&&_0x1063ae['recordingFormat']&&_0x1063ae[_0xa244('0x62')]!==_0xa244('0x63')){logger['info'](_0xa244('0x64'),_0xa244('0x4f'));_0x175b66['recordingURL']=util['format'](_0xa244('0x51'),_0xf13064['serverUrl'],_0x175b66['uniqueid'],md5(_0x175b66[_0xa244('0x52')]));}return getConnection(_0xf13064)[_0xa244('0x1b')](function(_0x5f0e06){_0x3f8b09=_0x5f0e06;return getUser(_0xf13064,_0x542f5e[_0xa244('0x53')],_0x3f8b09);})[_0xa244('0x1b')](function(_0x1b8fdc){_0x56bfa9=_0x1b8fdc;return getEndUser(_0xf13064,_0x2f3cea,_0x175b66[_0xa244('0x65')],_0x175b66['destcalleridnum'],_0x3f8b09);})[_0xa244('0x1b')](function(_0x428b74){_0x2c1c40=_0x428b74;return getTicket(_0xf13064,_0x56bfa9,_0x2c1c40,_0x2f3cea,_0x175b66,_0x2f3cea[_0xa244('0x56')],_0x3f8b09,'outbound');})[_0xa244('0x1b')](function(_0xae3ff0){_0x1808a1=_0xae3ff0;logger[_0xa244('0x1d')](_0xa244('0x66'),_0x1808a1['id']);logger[_0xa244('0x1d')](_0xa244('0x67'),_0x1808a1['id'],_0x542f5e[_0xa244('0x3f')],_0xf13064[_0xa244('0x38')]);switch(_0xf13064['type']){case _0xa244('0x68'):emit(util[_0xa244('0x31')](_0xa244('0x58'),_0x542f5e[_0xa244('0x3f')]),'trigger:salesforce:display',{'recordId':_0x1808a1['id']});break;case _0xa244('0x5a'):emit(util[_0xa244('0x31')](_0xa244('0x58'),_0x542f5e[_0xa244('0x3f')]),_0xa244('0x5b'),{'uri':util[_0xa244('0x31')]('%s/%s/e',_0x3f8b09[_0xa244('0x5d')],_0x1808a1['id'])});break;default:logger[_0xa244('0x5e')](_0xa244('0x64'),_0xa244('0x69'));}})[_0xa244('0x6a')](function(_0x29f1b1){logger['error'](_0xa244('0x64'),JSON[_0xa244('0x60')](_0x29f1b1));});};exports[_0xa244('0x6b')]=function(_0x442776,_0x30fc6a,_0x31f6f5,_0xd10bbc,_0x2f98c5,_0x11cd27){var _0xf906ff,_0x3f7f48,_0xa0c5a,_0x1f6541;_0x11cd27['serverUrl']=intUtil['stripTrailingSlash'](_0x11cd27[_0xa244('0x4b')]);_0x11cd27[_0xa244('0x43')]=intUtil['stripTrailingSlash'](_0x11cd27[_0xa244('0x43')]);if(_0x2f98c5&&_0x2f98c5[_0xa244('0x4d')]){logger['info'](_0xa244('0x6c'),_0xa244('0x4f'));_0x30fc6a[_0xa244('0x50')]=util[_0xa244('0x31')](_0xa244('0x51'),_0x11cd27[_0xa244('0x4b')],_0x30fc6a[_0xa244('0x52')],md5(_0x30fc6a[_0xa244('0x52')]));}else{_0x30fc6a[_0xa244('0x50')]='';}return getConnection(_0x11cd27)[_0xa244('0x1b')](function(_0x5b1b64){_0x1f6541=_0x5b1b64;if(!_[_0xa244('0x6d')](_0xd10bbc)){return getUser(_0x11cd27,_0xd10bbc['name'],_0x1f6541);}else{return getUser(_0x11cd27,null,_0x1f6541);}})['then'](function(_0x4b86a6){_0xf906ff=_0x4b86a6;return getEndUser(_0x11cd27,_0x31f6f5,_0x30fc6a[_0xa244('0x54')],_0x30fc6a['calleridnum'],_0x1f6541);})[_0xa244('0x1b')](function(_0x42daf4){_0x3f7f48=_0x42daf4;return getTicket(_0x11cd27,_0xf906ff,_0x3f7f48,_0x31f6f5,_0x30fc6a,_0x31f6f5[_0xa244('0x56')],_0x1f6541);})[_0xa244('0x1b')](function(_0x2be391){_0xa0c5a=_0x2be391;logger[_0xa244('0x1d')](_0xa244('0x6e'),_0xa0c5a['id']);logger[_0xa244('0x1d')](_0xa244('0x6f'),_0x11cd27['type']);})['catch'](function(_0x34af88){logger['error'](_0xa244('0x6c'),JSON[_0xa244('0x60')](_0x34af88));});}; \ 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 d494562..4f0a9c1 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(_0x5b644e,_0x2e5e07){var _0x49c6bf=function(_0x3032d9){while(--_0x3032d9){_0x5b644e['push'](_0x5b644e['shift']());}};_0x49c6bf(++_0x2e5e07);}(_0xa9e0,0x123));var _0x0a9e=function(_0x1cfa0d,_0x4391f2){_0x1cfa0d=_0x1cfa0d-0x0;var _0xe33279=_0xa9e0[_0x1cfa0d];return _0xe33279;};'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(_0x3054be,_0x1bdc8b){var _0x3df150=function(_0x56cfbf){while(--_0x56cfbf){_0x3054be['push'](_0x3054be['shift']());}};_0x3df150(++_0x1bdc8b);}(_0xa9e0,0x123));var _0x0a9e=function(_0x19e35c,_0x29cd1e){_0x19e35c=_0x19e35c-0x0;var _0x3e1fe8=_0xa9e0[_0x19e35c];return _0x3e1fe8;};'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 f946c1a..51ae27e 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 _0x14a2=['The\x20Enduser\x20ID\x20is:','Fields','Inbound','Ticket\x20created!','The\x20Ticket\x20ID\x20is:','users','contacts','version','%s/index.php?action=ajaxui#ajaxUILoc=index.php%3Fmodule%3DCalls%26action%3DEditView%26record%3D%s','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','user:%s','trigger:browser:url','catch','error','outbound','recordingFormat','[OUTBOUND]','destcalleridname','Outbound','charAt','%s/#bwc/index.php?module=Calls&action=EditView&record=%s','abandoned','[ABANDONED]','lodash','bluebird','util','ioredis','../../../../config/environment','sugarcrm','redis','defaults','socket.io-emitter','POST','info','Creating\x20new\x20ticket...','name','Subjects','assigned_user_id','created_by','description','getString','Descriptions','date_start','toISOString','replace','duration_hours','duration_minutes','parent_id','Contacts','direction','length','forEach','variableName','idField','JSON','stringify','Calls','format','toString','base64','get_server_info','isNil','get_entry_list','Employees','INSTR\x20(\x20users.user_name,\x20\x22%s\x22)\x20>\x200','user_name','then','entry_list','name_value_list','value','Agent\x20found!','resolve','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','user_id','Agent\x20not\x20available,\x20using\x20the\x20admin\x20account!','Searching\x20enduser\x20with\x20phone','phone_home','find','Enduser\x20found!','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!','set_entry','first_name','','Caller\x20-\x20%s','Enduser\x20created.','debug','[HTTP]','merge','map','string','nameField','customField','toLowerCase','content','type','custom_fields','push','variable','customVariable','Variable','login','username','password','PLAIN','xCALLY\x20Motion\x20integration','Account\x20%d\x20is\x20not\x20valid','set_relationship','queue','serverUrl','stripTrailingSlash','uri','%s/service/v4_1/rest.php','remoteUri','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','The\x20User\x20ID\x20is:'];(function(_0x2aa12e,_0x586953){var _0x1b14bd=function(_0x485d88){while(--_0x485d88){_0x2aa12e['push'](_0x2aa12e['shift']());}};_0x1b14bd(++_0x586953);}(_0x14a2,0x17f));var _0x214a=function(_0x33db26,_0x1c41d8){_0x33db26=_0x33db26-0x0;var _0x40498f=_0x14a2[_0x33db26];return _0x40498f;};'use strict';var _=require(_0x214a('0x0'));var rp=require('request-promise');var BPromise=require(_0x214a('0x1'));var md5=require('md5');var util=require(_0x214a('0x2'));var Redis=require(_0x214a('0x3'));var intUtil=require('./util');var config=require(_0x214a('0x4'));var logger=require('../../../../config/logger')(_0x214a('0x5'));config[_0x214a('0x6')]=_[_0x214a('0x7')](config[_0x214a('0x6')],{'host':'localhost','port':0x18eb});var io=require(_0x214a('0x8'))(new Redis(config[_0x214a('0x6')]));var def={'method':_0x214a('0x9'),'json':!![]};function emit(_0x1908a0,_0x37276b,_0x24b35e){io['to'](_0x1908a0)['emit'](_0x37276b,_0x24b35e);}function getTicket(_0x1d41b8,_0x501c66,_0x107a0c,_0x31616b,_0x2eb7e7,_0x5c8a7d,_0xe643d2,_0x4e3169){logger[_0x214a('0xa')](_0x214a('0xb'));var _0x298342=new Date();var _0x4f5f4b=[{'name':_0x214a('0xc'),'value':intUtil['getString'](_0x31616b[_0x214a('0xd')],_0x2eb7e7,'\x20')},{'name':_0x214a('0xe'),'value':_0x501c66['id']},{'name':_0x214a('0xf'),'value':_0x501c66['id']},{'name':_0x214a('0x10'),'value':intUtil[_0x214a('0x11')](_0x31616b[_0x214a('0x12')],_0x2eb7e7,'\x0a')},{'name':_0x214a('0x13'),'value':_0x298342[_0x214a('0x14')]()['slice'](0x0,0x13)[_0x214a('0x15')]('T','\x20')},{'name':_0x214a('0x16'),'value':'0'},{'name':_0x214a('0x17'),'value':'15'},{'name':_0x214a('0x18'),'value':_0x107a0c['id']},{'name':'parent_type','value':_0x214a('0x19')},{'name':'parent_name','value':_0x107a0c[_0x214a('0xc')]},{'name':_0x214a('0x1a'),'value':_0x4e3169}];if(_0x5c8a7d[_0x214a('0x1b')]){_[_0x214a('0x1c')](_0x5c8a7d,function(_0x12954f){if(_0x2eb7e7[_0x12954f[_0x214a('0x1d')]]){_0x4f5f4b['push']({'name':_0x12954f[_0x214a('0x1e')],'value':_0x2eb7e7[_0x12954f['variableName']]});}});}return request({'form':{'method':'set_entry','input_type':_0x214a('0x1f'),'response_type':_0x214a('0x1f'),'rest_data':JSON[_0x214a('0x20')]({'session':_0xe643d2['id'],'module_name':_0x214a('0x21'),'name_value_list':_0x4f5f4b})}});}function getAuth(_0x44a678){return util[_0x214a('0x22')]('Basic\x20%s',new Buffer(_0x44a678['apiKey']+':X')[_0x214a('0x23')](_0x214a('0x24')));}function getServerInfo(_0x2b1323){return request({'form':{'method':_0x214a('0x25'),'input_type':'JSON','response_type':_0x214a('0x1f'),'rest_data':JSON[_0x214a('0x20')]({'session':_0x2b1323['id']})}});}function getUser(_0x455050,_0x130ef8,_0x43b2a7){if(!_[_0x214a('0x26')](_0x130ef8)){logger['info']('Getting\x20agent\x20with\x20name',_0x130ef8);return request({'form':{'method':_0x214a('0x27'),'input_type':_0x214a('0x1f'),'response_type':_0x214a('0x1f'),'rest_data':JSON[_0x214a('0x20')]({'session':_0x43b2a7['id'],'module_name':_0x214a('0x28'),'query':util[_0x214a('0x22')](_0x214a('0x29'),_0x130ef8),'order_by':'','offset':'0','select_fields':['id','name',_0x214a('0x2a')],'link_name_to_fields_array':[],'max_results':-0x1,'deleted':'0'})}})[_0x214a('0x2b')](function(_0x5857d7){if(_0x5857d7[_0x214a('0x2c')][_0x214a('0x1b')]){var _0x117623=_['find'](_0x5857d7[_0x214a('0x2c')],function(_0x5e5c1b){return _0x5e5c1b[_0x214a('0x2d')]['user_name'][_0x214a('0x2e')]===_0x130ef8;});if(_0x117623){logger[_0x214a('0xa')](_0x214a('0x2f'));return BPromise[_0x214a('0x30')]({'id':_0x117623[_0x214a('0x2d')]['id'][_0x214a('0x2e')],'name':_0x117623['name_value_list'][_0x214a('0xc')][_0x214a('0x2e')]});}}logger[_0x214a('0xa')](_0x214a('0x31'));return BPromise[_0x214a('0x30')]({'id':_0x43b2a7[_0x214a('0x2d')][_0x214a('0x32')][_0x214a('0x2e')],'name':_0x43b2a7[_0x214a('0x2d')][_0x214a('0x2a')][_0x214a('0x2e')]});});}else{logger[_0x214a('0xa')](_0x214a('0x33'));return BPromise[_0x214a('0x30')]({'id':_0x43b2a7['name_value_list'][_0x214a('0x32')][_0x214a('0x2e')],'name':_0x43b2a7[_0x214a('0x2d')][_0x214a('0x2a')][_0x214a('0x2e')]});}}function getEndUser(_0x54bbbc,_0x538de8,_0x375c0b,_0x46f4b5){logger[_0x214a('0xa')](_0x214a('0x34'),_0x375c0b);return request({'form':{'method':_0x214a('0x27'),'input_type':_0x214a('0x1f'),'response_type':_0x214a('0x1f'),'rest_data':JSON[_0x214a('0x20')]({'session':_0x46f4b5['id'],'module_name':_0x214a('0x19'),'query':util[_0x214a('0x22')]('contacts.phone_home\x20=\x20\x22%s\x22',_0x375c0b),'order_by':'','offset':'0','select_fields':['id','name',_0x214a('0x35')],'link_name_to_fields_array':[],'max_results':-0x1,'deleted':'0'})}})[_0x214a('0x2b')](function(_0x14eac5){if(_0x14eac5[_0x214a('0x2c')][_0x214a('0x1b')]){var _0x5cb35d=_[_0x214a('0x36')](_0x14eac5['entry_list'],function(_0x3ca15b){return _0x3ca15b[_0x214a('0x2d')][_0x214a('0x35')]['value']===_0x375c0b;});if(_0x5cb35d){logger[_0x214a('0xa')](_0x214a('0x37'));return BPromise['resolve']({'id':_0x5cb35d[_0x214a('0x2d')]['id'][_0x214a('0x2e')],'name':_0x5cb35d['name_value_list'][_0x214a('0xc')][_0x214a('0x2e')],'phone':_0x5cb35d['name_value_list'][_0x214a('0x35')][_0x214a('0x2e')]});}}else{logger[_0x214a('0xa')](_0x214a('0x38'));return request({'form':{'method':_0x214a('0x39'),'input_type':_0x214a('0x1f'),'response_type':_0x214a('0x1f'),'rest_data':JSON['stringify']({'session':_0x46f4b5['id'],'module_name':_0x214a('0x19'),'name_value_list':[{'name':_0x214a('0x3a'),'value':_0x538de8!==_0x214a('0x3b')?_0x538de8:util[_0x214a('0x22')](_0x214a('0x3c'),_0x375c0b)},{'name':_0x214a('0x35'),'value':_0x375c0b}]})}})[_0x214a('0x2b')](function(_0x48ca05){logger[_0x214a('0xa')](_0x214a('0x3d'));return BPromise[_0x214a('0x30')]({'id':_0x48ca05['id'],'name':_0x48ca05[_0x214a('0x2c')]['first_name'][_0x214a('0x2e')],'phone':_0x48ca05['entry_list']['phone_home'][_0x214a('0x2e')]});});}});}function request(_0x2c1333){logger[_0x214a('0x3e')](_0x214a('0x3f'),JSON['stringify'](_0x2c1333));return rp(_[_0x214a('0x40')](def,_0x2c1333));}function getTags(_0x5a513e,_0x3543da){var _0x4a891d=[];if(_0x5a513e&&_0x5a513e['length']>0x0){_0x4a891d=_[_0x214a('0x41')](_0x5a513e,_0x3543da);}return _0x4a891d;}function getCustomFields(_0x5f4956,_0x17aa0b){var _0x288196=[];var _0x2c2b78={'custom_fields':[]};if(_0x5f4956[_0x214a('0x1b')]>0x0){_[_0x214a('0x1c')](_0x5f4956,function(_0x15dd13){if(_0x15dd13['type']===_0x214a('0x42')&&_0x15dd13[_0x214a('0x43')]&&!_0x15dd13[_0x214a('0x44')]){_0x2c2b78[_0x15dd13[_0x214a('0x43')][_0x214a('0x45')]()]=_0x15dd13[_0x214a('0x46')][_0x214a('0x23')]();}else if(_0x15dd13[_0x214a('0x47')]==='string'&&_0x15dd13[_0x214a('0x1e')]&&_0x15dd13['customField']){_0x2c2b78[_0x214a('0x48')][_0x214a('0x49')]({'id':_0x15dd13[_0x214a('0x1e')],'value':_0x15dd13[_0x214a('0x46')][_0x214a('0x23')]()});}else if(_0x15dd13[_0x214a('0x47')]===_0x214a('0x4a')&&_0x15dd13['variableName']&&_0x15dd13['idField']&&_0x15dd13[_0x214a('0x44')]){_0x17aa0b[_0x15dd13[_0x214a('0x1d')]]&&_0x2c2b78[_0x214a('0x48')][_0x214a('0x49')]({'id':_0x15dd13['idField'],'value':_0x17aa0b[_0x15dd13[_0x214a('0x1d')]][_0x214a('0x23')]()});}else if(_0x15dd13['type']===_0x214a('0x4b')&&_0x15dd13['Variable']&&_0x15dd13[_0x214a('0x4c')][_0x214a('0xc')]&&_0x15dd13['idField']&&_0x15dd13['customField']){_0x17aa0b[_0x15dd13['Variable'][_0x214a('0xc')][_0x214a('0x45')]()]&&_0x2c2b78[_0x214a('0x48')]['push']({'id':_0x15dd13[_0x214a('0x1e')],'value':_0x17aa0b[_0x15dd13[_0x214a('0x4c')]['name'][_0x214a('0x45')]()][_0x214a('0x23')]()});}});}return _0x2c2b78;}function getConnection(_0x14bad1){return request({'method':'POST','form':{'method':_0x214a('0x4d'),'input_type':_0x214a('0x1f'),'response_type':_0x214a('0x1f'),'rest_data':JSON['stringify']({'user_auth':{'user_name':_0x14bad1[_0x214a('0x4e')],'password':_0x14bad1[_0x214a('0x4f')],'encryption':_0x214a('0x50')},'application':_0x214a('0x51')})}})[_0x214a('0x2b')](function(_0x36b171){var _0x5069ce=_0x36b171;if(_0x5069ce['id']){def['sessionID']=_0x5069ce['id'];return BPromise['resolve'](_0x5069ce);}else{throw new Error(util[_0x214a('0x22')](_0x214a('0x52'),_0x14bad1['id']));}});}function setRelationship(_0x27f5ae,_0x2053ff,_0x5f599d,_0x523171){return request({'form':{'method':_0x214a('0x53'),'input_type':'JSON','response_type':_0x214a('0x1f'),'rest_data':JSON[_0x214a('0x20')]({'session':_0x27f5ae['id'],'module_name':_0x214a('0x21'),'module_id':_0x5f599d['id'],'link_field_name':_0x523171,'related_ids':[_0x2053ff['id']]})}});}exports[_0x214a('0x54')]=function(_0x53eec8,_0x120f51,_0x586f48,_0x1c5754,_0x425ace,_0x9c4339){var _0x5d71c2,_0x180010,_0x2a77a3,_0x516b67;_0x9c4339['remoteUri']=intUtil['stripTrailingSlash'](_0x9c4339['remoteUri']);_0x9c4339[_0x214a('0x55')]=intUtil[_0x214a('0x56')](_0x9c4339[_0x214a('0x55')]);def[_0x214a('0x57')]=util[_0x214a('0x22')](_0x214a('0x58'),_0x9c4339[_0x214a('0x59')]);if(_0x425ace&&_0x425ace[_0x214a('0x5a')]){logger[_0x214a('0xa')](_0x214a('0x5b'),_0x214a('0x5c'));_0x120f51[_0x214a('0x5d')]=util['format'](_0x214a('0x5e'),_0x9c4339[_0x214a('0x55')],_0x120f51[_0x214a('0x5f')],md5(_0x120f51[_0x214a('0x5f')]));}else{_0x120f51[_0x214a('0x5d')]='';}return getConnection(_0x9c4339)[_0x214a('0x2b')](function(_0x39c85c){_0x516b67=_0x39c85c;return getUser(_0x9c4339,_0x1c5754['name'],_0x516b67);})[_0x214a('0x2b')](function(_0x28a198){_0x5d71c2=_0x28a198;logger[_0x214a('0xa')](_0x214a('0x60'),_0x5d71c2['id']);return getEndUser(_0x9c4339,_0x120f51['calleridname'],_0x120f51['calleridnum'],_0x516b67);})[_0x214a('0x2b')](function(_0x3c478a){_0x180010=_0x3c478a;logger[_0x214a('0xa')](_0x214a('0x61'),_0x180010['id']);return getTicket(_0x9c4339,_0x5d71c2,_0x180010,_0x586f48,_0x120f51,_0x586f48[_0x214a('0x62')],_0x516b67,_0x214a('0x63'));})[_0x214a('0x2b')](function(_0x469342){_0x2a77a3=_0x469342;logger[_0x214a('0xa')](_0x214a('0x64'));logger[_0x214a('0xa')](_0x214a('0x65'),_0x2a77a3['id']);return setRelationship(_0x516b67,_0x5d71c2,_0x2a77a3,_0x214a('0x66'));})[_0x214a('0x2b')](function(){return setRelationship(_0x516b67,_0x180010,_0x2a77a3,_0x214a('0x67'));})[_0x214a('0x2b')](function(){return getServerInfo(_0x516b67);})[_0x214a('0x2b')](function(_0x46678e){var _0x5e7726=parseInt(_0x46678e[_0x214a('0x68')]['charAt'](0x0));var _0x30a0c5=util[_0x214a('0x22')](_0x214a('0x69'),_0x9c4339[_0x214a('0x59')],_0x2a77a3['id']);if(_0x5e7726>0x6){_0x30a0c5=util[_0x214a('0x22')]('%s/#bwc/index.php?module=Calls&action=EditView&record=%s',_0x9c4339[_0x214a('0x59')],_0x2a77a3['id']);}logger[_0x214a('0xa')](_0x214a('0x5b'),_0x214a('0x6a'));emit(util[_0x214a('0x22')](_0x214a('0x6b'),_0x1c5754['name']),_0x214a('0x6c'),{'uri':_0x30a0c5});})[_0x214a('0x6d')](function(_0x1c70c4){logger[_0x214a('0x6e')](_0x214a('0x5b'),JSON[_0x214a('0x20')](_0x1c70c4));});};exports[_0x214a('0x6f')]=function(_0x58367e,_0x2a5d98,_0x46d684,_0x4f847e,_0x4bd288,_0x5ec171,_0x2b61a9){var _0x2e197c,_0x1e2ce6,_0x1d3140,_0x4bac39;_0x5ec171[_0x214a('0x59')]=intUtil['stripTrailingSlash'](_0x5ec171['remoteUri']);_0x5ec171[_0x214a('0x55')]=intUtil['stripTrailingSlash'](_0x5ec171['serverUrl']);def[_0x214a('0x57')]=util[_0x214a('0x22')](_0x214a('0x58'),_0x5ec171[_0x214a('0x59')]);if(_0x2b61a9&&_0x2b61a9[_0x214a('0x70')]&&_0x2b61a9['recordingFormat']!=='none'){logger['info'](_0x214a('0x71'),_0x214a('0x5c'));_0x2a5d98[_0x214a('0x5d')]=util['format'](_0x214a('0x5e'),_0x5ec171[_0x214a('0x55')],_0x2a5d98[_0x214a('0x5f')],md5(_0x2a5d98['uniqueid']));}return getConnection(_0x5ec171)[_0x214a('0x2b')](function(_0x3cab69){_0x4bac39=_0x3cab69;return getUser(_0x5ec171,_0x4f847e['name'],_0x4bac39);})[_0x214a('0x2b')](function(_0x1bc8a2){_0x2e197c=_0x1bc8a2;logger['info']('The\x20User\x20ID\x20is:',_0x2e197c['id']);return getEndUser(_0x5ec171,_0x2a5d98[_0x214a('0x72')],_0x2a5d98['destcalleridnum'],_0x4bac39);})[_0x214a('0x2b')](function(_0xbb97ab){_0x1e2ce6=_0xbb97ab;logger[_0x214a('0xa')]('The\x20Enduser\x20ID\x20is:',_0x1e2ce6['id']);return getTicket(_0x5ec171,_0x2e197c,_0x1e2ce6,_0x46d684,_0x2a5d98,_0x46d684[_0x214a('0x62')],_0x4bac39,_0x214a('0x73'));})[_0x214a('0x2b')](function(_0x366c82){_0x1d3140=_0x366c82;logger[_0x214a('0xa')]('Ticket\x20created!');logger[_0x214a('0xa')](_0x214a('0x65'),_0x1d3140['id']);return setRelationship(_0x4bac39,_0x2e197c,_0x1d3140,_0x214a('0x66'));})[_0x214a('0x2b')](function(){return setRelationship(_0x4bac39,_0x1e2ce6,_0x1d3140,_0x214a('0x67'));})[_0x214a('0x2b')](function(){return getServerInfo(_0x4bac39);})[_0x214a('0x2b')](function(_0x2c8364){var _0x43a0b5=parseInt(_0x2c8364[_0x214a('0x68')][_0x214a('0x74')](0x0));var _0x19b5b5=util[_0x214a('0x22')](_0x214a('0x69'),_0x5ec171[_0x214a('0x59')],_0x1d3140['id']);if(_0x43a0b5>0x6){_0x19b5b5=util[_0x214a('0x22')](_0x214a('0x75'),_0x5ec171[_0x214a('0x59')],_0x1d3140['id']);}logger[_0x214a('0xa')]('[OUTBOUND]',_0x214a('0x6a'));emit(util['format'](_0x214a('0x6b'),_0x4f847e['name']),'trigger:browser:url',{'uri':_0x19b5b5});})[_0x214a('0x6d')](function(_0x6302e5){logger[_0x214a('0x6e')](_0x214a('0x71'),JSON['stringify'](_0x6302e5));});};exports[_0x214a('0x76')]=function(_0x458cf8,_0x56f944,_0x414eb7,_0x28a79f,_0x3ea357,_0x588e3d){var _0x259d3d,_0x322141,_0x4b5942,_0x1c85a9;_0x588e3d[_0x214a('0x59')]=intUtil['stripTrailingSlash'](_0x588e3d['remoteUri']);_0x588e3d[_0x214a('0x55')]=intUtil['stripTrailingSlash'](_0x588e3d[_0x214a('0x55')]);def[_0x214a('0x57')]=util[_0x214a('0x22')](_0x214a('0x58'),_0x588e3d[_0x214a('0x59')]);if(_0x3ea357&&_0x3ea357[_0x214a('0x5a')]){logger[_0x214a('0xa')](_0x214a('0x77'),_0x214a('0x5c'));_0x56f944[_0x214a('0x5d')]=util[_0x214a('0x22')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x588e3d[_0x214a('0x55')],_0x56f944['uniqueid'],md5(_0x56f944['uniqueid']));}else{_0x56f944[_0x214a('0x5d')]='';}return getConnection(_0x588e3d)[_0x214a('0x2b')](function(_0x1a21ae){_0x1c85a9=_0x1a21ae;if(!_['isNil'](_0x28a79f)){return getUser(_0x588e3d,_0x28a79f[_0x214a('0xc')],_0x1c85a9);}else{return getUser(_0x588e3d,null,_0x1c85a9);}})['then'](function(_0x361557){_0x259d3d=_0x361557;logger[_0x214a('0xa')]('The\x20User\x20ID\x20is:',_0x259d3d['id']);return getEndUser(_0x588e3d,_0x56f944['calleridname'],_0x56f944['calleridnum'],_0x1c85a9);})[_0x214a('0x2b')](function(_0x17ca23){_0x322141=_0x17ca23;logger[_0x214a('0xa')](_0x214a('0x61'),_0x322141['id']);return getTicket(_0x588e3d,_0x259d3d,_0x322141,_0x414eb7,_0x56f944,_0x414eb7[_0x214a('0x62')],_0x1c85a9,_0x214a('0x63'));})[_0x214a('0x2b')](function(_0x100b12){_0x4b5942=_0x100b12;logger[_0x214a('0xa')]('Ticket\x20created!');logger[_0x214a('0xa')](_0x214a('0x65'),_0x4b5942['id']);return setRelationship(_0x1c85a9,_0x259d3d,_0x4b5942,_0x214a('0x66'));})[_0x214a('0x2b')](function(){return setRelationship(_0x1c85a9,_0x322141,_0x4b5942,_0x214a('0x67'));})[_0x214a('0x2b')](function(){return getServerInfo(_0x1c85a9);})[_0x214a('0x6d')](function(_0xeede8){logger[_0x214a('0x6e')](_0x214a('0x77'),JSON[_0x214a('0x20')](_0xeede8));});}; \ No newline at end of file +var _0x6dae=['Inbound','Ticket\x20created!','The\x20Ticket\x20ID\x20is:','version','charAt','%s/index.php?action=ajaxui#ajaxUILoc=index.php%3Fmodule%3DCalls%26action%3DEditView%26record%3D%s','%s/#bwc/index.php?module=Calls&action=EditView&record=%s','user:%s','error','outbound','stripTrailingSlash','uri','recordingFormat','none','[OUTBOUND]','The\x20User\x20ID\x20is:','destcalleridname','destcalleridnum','Outbound','contacts','trigger:browser:url','catch','[ABANDONED]','isNil','users','request-promise','bluebird','util','./util','defaults','redis','localhost','socket.io-emitter','info','Creating\x20new\x20ticket...','name','Subjects','assigned_user_id','created_by','getString','date_start','toISOString','slice','replace','duration_hours','duration_minutes','parent_id','Contacts','parent_name','direction','push','variableName','JSON','stringify','Calls','apiKey','base64','get_server_info','Getting\x20agent\x20with\x20name','get_entry_list','format','INSTR\x20(\x20users.user_name,\x20\x22%s\x22)\x20>\x200','user_name','entry_list','find','name_value_list','value','resolve','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','user_id','Agent\x20not\x20available,\x20using\x20the\x20admin\x20account!','contacts.phone_home\x20=\x20\x22%s\x22','phone_home','then','length','Enduser\x20found!','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!','set_entry','Caller\x20-\x20%s','first_name','debug','[HTTP]','merge','map','forEach','type','nameField','toString','string','idField','customField','custom_fields','content','variable','customVariable','Variable','toLowerCase','POST','login','username','password','PLAIN','xCALLY\x20Motion\x20integration','sessionID','Account\x20%d\x20is\x20not\x20valid','set_relationship','queue','remoteUri','serverUrl','%s/service/v4_1/rest.php','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','calleridname','calleridnum','The\x20Enduser\x20ID\x20is:','Fields'];(function(_0x2641f9,_0x26715f){var _0x585741=function(_0x2d1462){while(--_0x2d1462){_0x2641f9['push'](_0x2641f9['shift']());}};_0x585741(++_0x26715f);}(_0x6dae,0x91));var _0xe6da=function(_0xb9b4e3,_0x1b465b){_0xb9b4e3=_0xb9b4e3-0x0;var _0x15d819=_0x6dae[_0xb9b4e3];return _0x15d819;};'use strict';var _=require('lodash');var rp=require(_0xe6da('0x0'));var BPromise=require(_0xe6da('0x1'));var md5=require('md5');var util=require(_0xe6da('0x2'));var Redis=require('ioredis');var intUtil=require(_0xe6da('0x3'));var config=require('../../../../config/environment');var logger=require('../../../../config/logger')('sugarcrm');config['redis']=_[_0xe6da('0x4')](config[_0xe6da('0x5')],{'host':_0xe6da('0x6'),'port':0x18eb});var io=require(_0xe6da('0x7'))(new Redis(config[_0xe6da('0x5')]));var def={'method':'POST','json':!![]};function emit(_0x1485a4,_0x1e9ff9,_0xfe4edf){io['to'](_0x1485a4)['emit'](_0x1e9ff9,_0xfe4edf);}function getTicket(_0x4dbd1d,_0x1b43d6,_0x2c5007,_0x35367a,_0x4e2faf,_0x27d085,_0x3c87d1,_0x146f84){logger[_0xe6da('0x8')](_0xe6da('0x9'));var _0x3e3f1c=new Date();var _0x37eecb=[{'name':_0xe6da('0xa'),'value':intUtil['getString'](_0x35367a[_0xe6da('0xb')],_0x4e2faf,'\x20')},{'name':_0xe6da('0xc'),'value':_0x1b43d6['id']},{'name':_0xe6da('0xd'),'value':_0x1b43d6['id']},{'name':'description','value':intUtil[_0xe6da('0xe')](_0x35367a['Descriptions'],_0x4e2faf,'\x0a')},{'name':_0xe6da('0xf'),'value':_0x3e3f1c[_0xe6da('0x10')]()[_0xe6da('0x11')](0x0,0x13)[_0xe6da('0x12')]('T','\x20')},{'name':_0xe6da('0x13'),'value':'0'},{'name':_0xe6da('0x14'),'value':'15'},{'name':_0xe6da('0x15'),'value':_0x2c5007['id']},{'name':'parent_type','value':_0xe6da('0x16')},{'name':_0xe6da('0x17'),'value':_0x2c5007[_0xe6da('0xa')]},{'name':_0xe6da('0x18'),'value':_0x146f84}];if(_0x27d085['length']){_['forEach'](_0x27d085,function(_0x3929a0){if(_0x4e2faf[_0x3929a0['variableName']]){_0x37eecb[_0xe6da('0x19')]({'name':_0x3929a0['idField'],'value':_0x4e2faf[_0x3929a0[_0xe6da('0x1a')]]});}});}return request({'form':{'method':'set_entry','input_type':'JSON','response_type':_0xe6da('0x1b'),'rest_data':JSON[_0xe6da('0x1c')]({'session':_0x3c87d1['id'],'module_name':_0xe6da('0x1d'),'name_value_list':_0x37eecb})}});}function getAuth(_0x11216a){return util['format']('Basic\x20%s',new Buffer(_0x11216a[_0xe6da('0x1e')]+':X')['toString'](_0xe6da('0x1f')));}function getServerInfo(_0x1a7c7f){return request({'form':{'method':_0xe6da('0x20'),'input_type':'JSON','response_type':_0xe6da('0x1b'),'rest_data':JSON[_0xe6da('0x1c')]({'session':_0x1a7c7f['id']})}});}function getUser(_0x124cab,_0x4f4289,_0x331d3f){if(!_['isNil'](_0x4f4289)){logger[_0xe6da('0x8')](_0xe6da('0x21'),_0x4f4289);return request({'form':{'method':_0xe6da('0x22'),'input_type':_0xe6da('0x1b'),'response_type':_0xe6da('0x1b'),'rest_data':JSON[_0xe6da('0x1c')]({'session':_0x331d3f['id'],'module_name':'Employees','query':util[_0xe6da('0x23')](_0xe6da('0x24'),_0x4f4289),'order_by':'','offset':'0','select_fields':['id',_0xe6da('0xa'),_0xe6da('0x25')],'link_name_to_fields_array':[],'max_results':-0x1,'deleted':'0'})}})['then'](function(_0x3bbccc){if(_0x3bbccc[_0xe6da('0x26')]['length']){var _0x442098=_[_0xe6da('0x27')](_0x3bbccc[_0xe6da('0x26')],function(_0x29d6d9){return _0x29d6d9[_0xe6da('0x28')][_0xe6da('0x25')][_0xe6da('0x29')]===_0x4f4289;});if(_0x442098){logger[_0xe6da('0x8')]('Agent\x20found!');return BPromise[_0xe6da('0x2a')]({'id':_0x442098['name_value_list']['id'][_0xe6da('0x29')],'name':_0x442098[_0xe6da('0x28')][_0xe6da('0xa')]['value']});}}logger['info'](_0xe6da('0x2b'));return BPromise['resolve']({'id':_0x331d3f[_0xe6da('0x28')][_0xe6da('0x2c')][_0xe6da('0x29')],'name':_0x331d3f[_0xe6da('0x28')]['user_name']['value']});});}else{logger[_0xe6da('0x8')](_0xe6da('0x2d'));return BPromise['resolve']({'id':_0x331d3f[_0xe6da('0x28')][_0xe6da('0x2c')][_0xe6da('0x29')],'name':_0x331d3f[_0xe6da('0x28')][_0xe6da('0x25')]['value']});}}function getEndUser(_0x4f6c22,_0x5e94e5,_0x5d52b3,_0x480d10){logger[_0xe6da('0x8')]('Searching\x20enduser\x20with\x20phone',_0x5d52b3);return request({'form':{'method':_0xe6da('0x22'),'input_type':_0xe6da('0x1b'),'response_type':'JSON','rest_data':JSON[_0xe6da('0x1c')]({'session':_0x480d10['id'],'module_name':_0xe6da('0x16'),'query':util[_0xe6da('0x23')](_0xe6da('0x2e'),_0x5d52b3),'order_by':'','offset':'0','select_fields':['id',_0xe6da('0xa'),_0xe6da('0x2f')],'link_name_to_fields_array':[],'max_results':-0x1,'deleted':'0'})}})[_0xe6da('0x30')](function(_0x1f67e8){if(_0x1f67e8['entry_list'][_0xe6da('0x31')]){var _0x315361=_['find'](_0x1f67e8[_0xe6da('0x26')],function(_0x29c191){return _0x29c191[_0xe6da('0x28')]['phone_home'][_0xe6da('0x29')]===_0x5d52b3;});if(_0x315361){logger[_0xe6da('0x8')](_0xe6da('0x32'));return BPromise[_0xe6da('0x2a')]({'id':_0x315361[_0xe6da('0x28')]['id'][_0xe6da('0x29')],'name':_0x315361[_0xe6da('0x28')]['name'][_0xe6da('0x29')],'phone':_0x315361[_0xe6da('0x28')][_0xe6da('0x2f')]['value']});}}else{logger[_0xe6da('0x8')](_0xe6da('0x33'));return request({'form':{'method':_0xe6da('0x34'),'input_type':_0xe6da('0x1b'),'response_type':_0xe6da('0x1b'),'rest_data':JSON[_0xe6da('0x1c')]({'session':_0x480d10['id'],'module_name':_0xe6da('0x16'),'name_value_list':[{'name':'first_name','value':_0x5e94e5!==''?_0x5e94e5:util['format'](_0xe6da('0x35'),_0x5d52b3)},{'name':_0xe6da('0x2f'),'value':_0x5d52b3}]})}})[_0xe6da('0x30')](function(_0xca7ac2){logger[_0xe6da('0x8')]('Enduser\x20created.');return BPromise[_0xe6da('0x2a')]({'id':_0xca7ac2['id'],'name':_0xca7ac2[_0xe6da('0x26')][_0xe6da('0x36')][_0xe6da('0x29')],'phone':_0xca7ac2[_0xe6da('0x26')][_0xe6da('0x2f')]['value']});});}});}function request(_0x5d0389){logger[_0xe6da('0x37')](_0xe6da('0x38'),JSON[_0xe6da('0x1c')](_0x5d0389));return rp(_[_0xe6da('0x39')](def,_0x5d0389));}function getTags(_0x2eecdd,_0x3a5574){var _0xfab589=[];if(_0x2eecdd&&_0x2eecdd[_0xe6da('0x31')]>0x0){_0xfab589=_[_0xe6da('0x3a')](_0x2eecdd,_0x3a5574);}return _0xfab589;}function getCustomFields(_0x9386f2,_0x557ac5){var _0x18aab2=[];var _0x3aa23c={'custom_fields':[]};if(_0x9386f2[_0xe6da('0x31')]>0x0){_[_0xe6da('0x3b')](_0x9386f2,function(_0x2701fe){if(_0x2701fe[_0xe6da('0x3c')]==='string'&&_0x2701fe[_0xe6da('0x3d')]&&!_0x2701fe['customField']){_0x3aa23c[_0x2701fe[_0xe6da('0x3d')]['toLowerCase']()]=_0x2701fe['content'][_0xe6da('0x3e')]();}else if(_0x2701fe[_0xe6da('0x3c')]===_0xe6da('0x3f')&&_0x2701fe[_0xe6da('0x40')]&&_0x2701fe[_0xe6da('0x41')]){_0x3aa23c[_0xe6da('0x42')][_0xe6da('0x19')]({'id':_0x2701fe['idField'],'value':_0x2701fe[_0xe6da('0x43')]['toString']()});}else if(_0x2701fe[_0xe6da('0x3c')]===_0xe6da('0x44')&&_0x2701fe[_0xe6da('0x1a')]&&_0x2701fe[_0xe6da('0x40')]&&_0x2701fe['customField']){_0x557ac5[_0x2701fe[_0xe6da('0x1a')]]&&_0x3aa23c['custom_fields']['push']({'id':_0x2701fe[_0xe6da('0x40')],'value':_0x557ac5[_0x2701fe[_0xe6da('0x1a')]][_0xe6da('0x3e')]()});}else if(_0x2701fe[_0xe6da('0x3c')]===_0xe6da('0x45')&&_0x2701fe[_0xe6da('0x46')]&&_0x2701fe[_0xe6da('0x46')][_0xe6da('0xa')]&&_0x2701fe[_0xe6da('0x40')]&&_0x2701fe[_0xe6da('0x41')]){_0x557ac5[_0x2701fe[_0xe6da('0x46')][_0xe6da('0xa')][_0xe6da('0x47')]()]&&_0x3aa23c['custom_fields'][_0xe6da('0x19')]({'id':_0x2701fe[_0xe6da('0x40')],'value':_0x557ac5[_0x2701fe[_0xe6da('0x46')][_0xe6da('0xa')]['toLowerCase']()][_0xe6da('0x3e')]()});}});}return _0x3aa23c;}function getConnection(_0x19af7b){return request({'method':_0xe6da('0x48'),'form':{'method':_0xe6da('0x49'),'input_type':'JSON','response_type':_0xe6da('0x1b'),'rest_data':JSON['stringify']({'user_auth':{'user_name':_0x19af7b[_0xe6da('0x4a')],'password':_0x19af7b[_0xe6da('0x4b')],'encryption':_0xe6da('0x4c')},'application':_0xe6da('0x4d')})}})[_0xe6da('0x30')](function(_0x5355c9){var _0x24ec29=_0x5355c9;if(_0x24ec29['id']){def[_0xe6da('0x4e')]=_0x24ec29['id'];return BPromise['resolve'](_0x24ec29);}else{throw new Error(util[_0xe6da('0x23')](_0xe6da('0x4f'),_0x19af7b['id']));}});}function setRelationship(_0x38476d,_0x39aef8,_0x102325,_0x3e2a9d){return request({'form':{'method':_0xe6da('0x50'),'input_type':_0xe6da('0x1b'),'response_type':'JSON','rest_data':JSON[_0xe6da('0x1c')]({'session':_0x38476d['id'],'module_name':_0xe6da('0x1d'),'module_id':_0x102325['id'],'link_field_name':_0x3e2a9d,'related_ids':[_0x39aef8['id']]})}});}exports[_0xe6da('0x51')]=function(_0x5ec813,_0x136a59,_0xec58b4,_0x541f14,_0x5148b5,_0x36c775){var _0x43cd5c,_0x4d1fc2,_0xadb882,_0x4edd3d;_0x36c775[_0xe6da('0x52')]=intUtil['stripTrailingSlash'](_0x36c775['remoteUri']);_0x36c775[_0xe6da('0x53')]=intUtil['stripTrailingSlash'](_0x36c775[_0xe6da('0x53')]);def['uri']=util[_0xe6da('0x23')](_0xe6da('0x54'),_0x36c775['remoteUri']);if(_0x5148b5&&_0x5148b5[_0xe6da('0x55')]){logger['info'](_0xe6da('0x56'),_0xe6da('0x57'));_0x136a59[_0xe6da('0x58')]=util[_0xe6da('0x23')](_0xe6da('0x59'),_0x36c775[_0xe6da('0x53')],_0x136a59[_0xe6da('0x5a')],md5(_0x136a59['uniqueid']));}else{_0x136a59[_0xe6da('0x58')]='';}return getConnection(_0x36c775)[_0xe6da('0x30')](function(_0x46b571){_0x4edd3d=_0x46b571;return getUser(_0x36c775,_0x541f14[_0xe6da('0xa')],_0x4edd3d);})[_0xe6da('0x30')](function(_0x2c0836){_0x43cd5c=_0x2c0836;logger[_0xe6da('0x8')]('The\x20User\x20ID\x20is:',_0x43cd5c['id']);return getEndUser(_0x36c775,_0x136a59[_0xe6da('0x5b')],_0x136a59[_0xe6da('0x5c')],_0x4edd3d);})[_0xe6da('0x30')](function(_0xcdc18){_0x4d1fc2=_0xcdc18;logger['info'](_0xe6da('0x5d'),_0x4d1fc2['id']);return getTicket(_0x36c775,_0x43cd5c,_0x4d1fc2,_0xec58b4,_0x136a59,_0xec58b4[_0xe6da('0x5e')],_0x4edd3d,_0xe6da('0x5f'));})['then'](function(_0x21f6d9){_0xadb882=_0x21f6d9;logger['info'](_0xe6da('0x60'));logger['info'](_0xe6da('0x61'),_0xadb882['id']);return setRelationship(_0x4edd3d,_0x43cd5c,_0xadb882,'users');})[_0xe6da('0x30')](function(){return setRelationship(_0x4edd3d,_0x4d1fc2,_0xadb882,'contacts');})[_0xe6da('0x30')](function(){return getServerInfo(_0x4edd3d);})[_0xe6da('0x30')](function(_0x4da1cd){var _0x12a6b6=parseInt(_0x4da1cd[_0xe6da('0x62')][_0xe6da('0x63')](0x0));var _0x102a3a=util[_0xe6da('0x23')](_0xe6da('0x64'),_0x36c775[_0xe6da('0x52')],_0xadb882['id']);if(_0x12a6b6>0x6){_0x102a3a=util[_0xe6da('0x23')](_0xe6da('0x65'),_0x36c775['remoteUri'],_0xadb882['id']);}logger[_0xe6da('0x8')](_0xe6da('0x56'),'Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...');emit(util[_0xe6da('0x23')](_0xe6da('0x66'),_0x541f14[_0xe6da('0xa')]),'trigger:browser:url',{'uri':_0x102a3a});})['catch'](function(_0x13357e){logger[_0xe6da('0x67')](_0xe6da('0x56'),JSON[_0xe6da('0x1c')](_0x13357e));});};exports[_0xe6da('0x68')]=function(_0x5802b7,_0x987947,_0x10a401,_0x672aa9,_0x4a13d0,_0x5ba344,_0x47e353){var _0x1cccd2,_0x1ffecd,_0x143810,_0xeefeab;_0x5ba344[_0xe6da('0x52')]=intUtil[_0xe6da('0x69')](_0x5ba344['remoteUri']);_0x5ba344[_0xe6da('0x53')]=intUtil['stripTrailingSlash'](_0x5ba344[_0xe6da('0x53')]);def[_0xe6da('0x6a')]=util[_0xe6da('0x23')](_0xe6da('0x54'),_0x5ba344['remoteUri']);if(_0x47e353&&_0x47e353[_0xe6da('0x6b')]&&_0x47e353[_0xe6da('0x6b')]!==_0xe6da('0x6c')){logger[_0xe6da('0x8')](_0xe6da('0x6d'),_0xe6da('0x57'));_0x987947[_0xe6da('0x58')]=util[_0xe6da('0x23')](_0xe6da('0x59'),_0x5ba344[_0xe6da('0x53')],_0x987947[_0xe6da('0x5a')],md5(_0x987947[_0xe6da('0x5a')]));}return getConnection(_0x5ba344)[_0xe6da('0x30')](function(_0x3f6376){_0xeefeab=_0x3f6376;return getUser(_0x5ba344,_0x672aa9['name'],_0xeefeab);})[_0xe6da('0x30')](function(_0x252ef8){_0x1cccd2=_0x252ef8;logger[_0xe6da('0x8')](_0xe6da('0x6e'),_0x1cccd2['id']);return getEndUser(_0x5ba344,_0x987947[_0xe6da('0x6f')],_0x987947[_0xe6da('0x70')],_0xeefeab);})['then'](function(_0x4bdfa3){_0x1ffecd=_0x4bdfa3;logger['info'](_0xe6da('0x5d'),_0x1ffecd['id']);return getTicket(_0x5ba344,_0x1cccd2,_0x1ffecd,_0x10a401,_0x987947,_0x10a401[_0xe6da('0x5e')],_0xeefeab,_0xe6da('0x71'));})['then'](function(_0x2bae7d){_0x143810=_0x2bae7d;logger['info'](_0xe6da('0x60'));logger['info'](_0xe6da('0x61'),_0x143810['id']);return setRelationship(_0xeefeab,_0x1cccd2,_0x143810,'users');})[_0xe6da('0x30')](function(){return setRelationship(_0xeefeab,_0x1ffecd,_0x143810,_0xe6da('0x72'));})[_0xe6da('0x30')](function(){return getServerInfo(_0xeefeab);})[_0xe6da('0x30')](function(_0x357dc1){var _0x11a0b0=parseInt(_0x357dc1['version']['charAt'](0x0));var _0x3f459b=util[_0xe6da('0x23')](_0xe6da('0x64'),_0x5ba344[_0xe6da('0x52')],_0x143810['id']);if(_0x11a0b0>0x6){_0x3f459b=util[_0xe6da('0x23')]('%s/#bwc/index.php?module=Calls&action=EditView&record=%s',_0x5ba344[_0xe6da('0x52')],_0x143810['id']);}logger[_0xe6da('0x8')]('[OUTBOUND]','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...');emit(util['format'](_0xe6da('0x66'),_0x672aa9[_0xe6da('0xa')]),_0xe6da('0x73'),{'uri':_0x3f459b});})[_0xe6da('0x74')](function(_0x325faa){logger[_0xe6da('0x67')](_0xe6da('0x6d'),JSON['stringify'](_0x325faa));});};exports['abandoned']=function(_0x529e2e,_0x3c0195,_0x38f4c5,_0x3e8c18,_0x307f64,_0x2f6a1c){var _0x197ba3,_0x4c46e7,_0x4f12de,_0x4aac67;_0x2f6a1c[_0xe6da('0x52')]=intUtil[_0xe6da('0x69')](_0x2f6a1c['remoteUri']);_0x2f6a1c[_0xe6da('0x53')]=intUtil[_0xe6da('0x69')](_0x2f6a1c[_0xe6da('0x53')]);def[_0xe6da('0x6a')]=util[_0xe6da('0x23')](_0xe6da('0x54'),_0x2f6a1c[_0xe6da('0x52')]);if(_0x307f64&&_0x307f64['monitor_format']){logger[_0xe6da('0x8')](_0xe6da('0x75'),_0xe6da('0x57'));_0x3c0195[_0xe6da('0x58')]=util[_0xe6da('0x23')](_0xe6da('0x59'),_0x2f6a1c[_0xe6da('0x53')],_0x3c0195['uniqueid'],md5(_0x3c0195[_0xe6da('0x5a')]));}else{_0x3c0195[_0xe6da('0x58')]='';}return getConnection(_0x2f6a1c)[_0xe6da('0x30')](function(_0x3d4d12){_0x4aac67=_0x3d4d12;if(!_[_0xe6da('0x76')](_0x3e8c18)){return getUser(_0x2f6a1c,_0x3e8c18[_0xe6da('0xa')],_0x4aac67);}else{return getUser(_0x2f6a1c,null,_0x4aac67);}})[_0xe6da('0x30')](function(_0x2beb66){_0x197ba3=_0x2beb66;logger[_0xe6da('0x8')](_0xe6da('0x6e'),_0x197ba3['id']);return getEndUser(_0x2f6a1c,_0x3c0195['calleridname'],_0x3c0195[_0xe6da('0x5c')],_0x4aac67);})[_0xe6da('0x30')](function(_0x5f5bf6){_0x4c46e7=_0x5f5bf6;logger[_0xe6da('0x8')]('The\x20Enduser\x20ID\x20is:',_0x4c46e7['id']);return getTicket(_0x2f6a1c,_0x197ba3,_0x4c46e7,_0x38f4c5,_0x3c0195,_0x38f4c5['Fields'],_0x4aac67,_0xe6da('0x5f'));})[_0xe6da('0x30')](function(_0x51a0c4){_0x4f12de=_0x51a0c4;logger[_0xe6da('0x8')]('Ticket\x20created!');logger[_0xe6da('0x8')]('The\x20Ticket\x20ID\x20is:',_0x4f12de['id']);return setRelationship(_0x4aac67,_0x197ba3,_0x4f12de,_0xe6da('0x77'));})[_0xe6da('0x30')](function(){return setRelationship(_0x4aac67,_0x4c46e7,_0x4f12de,_0xe6da('0x72'));})['then'](function(){return getServerInfo(_0x4aac67);})[_0xe6da('0x74')](function(_0x265b87){logger[_0xe6da('0x67')](_0xe6da('0x75'),JSON['stringify'](_0x265b87));});}; \ 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 b2523ea..e82da2d 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 _0x9213=['slice','substring','lastIndexOf','validateEmail','isNil','test','lodash','util','length','sortBy','type','string','push','content','variable','variableName','toString','Variable','name','toLowerCase','keyType','format','%s:\x20%s','key','customVariable','stripTrailingSlash'];(function(_0x46db60,_0x797d1e){var _0x37c09c=function(_0x136c81){while(--_0x136c81){_0x46db60['push'](_0x46db60['shift']());}};_0x37c09c(++_0x797d1e);}(_0x9213,0x124));var _0x3921=function(_0x202d24,_0x5e8641){_0x202d24=_0x202d24-0x0;var _0x2b3a8e=_0x9213[_0x202d24];return _0x2b3a8e;};'use strict';var _=require(_0x3921('0x0'));var util=require(_0x3921('0x1'));exports['getString']=function(_0x308cf9,_0x5bfb65,_0x1f9df0){var _0xee160c=[];if(_0x308cf9[_0x3921('0x2')]>0x0){var _0x3519cc=_[_0x3921('0x3')](_0x308cf9,['id']);for(var _0x17f367=0x0;_0x17f367<_0x3519cc[_0x3921('0x2')];_0x17f367++){var _0x492437=_0x3519cc[_0x17f367];if(_0x492437[_0x3921('0x4')]===_0x3921('0x5')){_0xee160c[_0x3921('0x6')](_0x492437[_0x3921('0x7')]);}else if(_0x492437[_0x3921('0x4')]===_0x3921('0x8')&&_0x492437[_0x3921('0x9')]){_0x5bfb65[_0x492437[_0x3921('0x9')]]&&_0xee160c[_0x3921('0x6')](_0x5bfb65[_0x492437['variableName']][_0x3921('0xa')]());}else if(_0x492437[_0x3921('0x4')]==='customVariable'&&_0x492437[_0x3921('0xb')]&&_0x492437['Variable'][_0x3921('0xc')]){_0x5bfb65[_0x492437[_0x3921('0xb')][_0x3921('0xc')][_0x3921('0xd')]()]&&_0xee160c['push'](_0x5bfb65[_0x492437[_0x3921('0xb')][_0x3921('0xc')][_0x3921('0xd')]()][_0x3921('0xa')]());}else if(_0x492437[_0x3921('0x4')]==='keyValue'){if(_0x492437[_0x3921('0xe')]===_0x3921('0x5')&&_0x492437['key']){_0xee160c['push'](util[_0x3921('0xf')](_0x3921('0x10'),_0x492437[_0x3921('0x11')],_0x492437['keyContent']));}else if(_0x492437[_0x3921('0xe')]==='variable'&&_0x492437['variableName']&&_0x492437['key']){_0x5bfb65[_0x492437[_0x3921('0x9')]]&&_0xee160c[_0x3921('0x6')](util[_0x3921('0xf')](_0x3921('0x10'),_0x492437[_0x3921('0x11')],_0x5bfb65[_0x492437[_0x3921('0x9')]]));}else if(_0x492437['keyType']===_0x3921('0x12')&&_0x492437[_0x3921('0xb')]&&_0x492437[_0x3921('0xb')]['name']&&_0x492437[_0x3921('0x11')]){_0x5bfb65[_0x492437['Variable'][_0x3921('0xc')][_0x3921('0xd')]()]&&_0xee160c[_0x3921('0x6')](util[_0x3921('0xf')](_0x3921('0x10'),_0x492437[_0x3921('0x11')],_0x5bfb65[_0x492437[_0x3921('0xb')][_0x3921('0xc')][_0x3921('0xd')]()]));}}}}return _0xee160c['join'](_0x1f9df0);};exports[_0x3921('0x13')]=function(_0x33cc9e){var _0x54e157=_0x33cc9e[_0x3921('0x14')](-0x1);if(_0x54e157==='/'){_0x33cc9e=_0x33cc9e[_0x3921('0x15')](0x0,_0x33cc9e[_0x3921('0x16')](_0x54e157));}return _0x33cc9e;};exports[_0x3921('0x17')]=function(_0x17abe0){if(!_[_0x3921('0x18')](_0x17abe0)&&_0x17abe0!==''){var _0xee46cd=/^(([^<>()\[\]\\.,;:\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 _0xee46cd[_0x3921('0x19')](String(_0x17abe0)[_0x3921('0xd')]());}else{return![];}}; \ No newline at end of file +var _0xbf20=['format','%s:\x20%s','slice','substring','lastIndexOf','validateEmail','isNil','lodash','util','getString','length','sortBy','type','string','variable','variableName','push','toString','customVariable','Variable','name','toLowerCase','keyType','key'];(function(_0x4116e1,_0xe6b87){var _0x7791a=function(_0x4ff8ec){while(--_0x4ff8ec){_0x4116e1['push'](_0x4116e1['shift']());}};_0x7791a(++_0xe6b87);}(_0xbf20,0x7f));var _0x0bf2=function(_0x4045c8,_0x352502){_0x4045c8=_0x4045c8-0x0;var _0x172a48=_0xbf20[_0x4045c8];return _0x172a48;};'use strict';var _=require(_0x0bf2('0x0'));var util=require(_0x0bf2('0x1'));exports[_0x0bf2('0x2')]=function(_0x3d68ed,_0xc77e3,_0x420684){var _0x4a7829=[];if(_0x3d68ed[_0x0bf2('0x3')]>0x0){var _0xc24da0=_[_0x0bf2('0x4')](_0x3d68ed,['id']);for(var _0x4e5432=0x0;_0x4e5432<_0xc24da0[_0x0bf2('0x3')];_0x4e5432++){var _0x2c1277=_0xc24da0[_0x4e5432];if(_0x2c1277[_0x0bf2('0x5')]===_0x0bf2('0x6')){_0x4a7829['push'](_0x2c1277['content']);}else if(_0x2c1277['type']===_0x0bf2('0x7')&&_0x2c1277[_0x0bf2('0x8')]){_0xc77e3[_0x2c1277[_0x0bf2('0x8')]]&&_0x4a7829[_0x0bf2('0x9')](_0xc77e3[_0x2c1277['variableName']][_0x0bf2('0xa')]());}else if(_0x2c1277[_0x0bf2('0x5')]===_0x0bf2('0xb')&&_0x2c1277[_0x0bf2('0xc')]&&_0x2c1277['Variable'][_0x0bf2('0xd')]){_0xc77e3[_0x2c1277[_0x0bf2('0xc')]['name'][_0x0bf2('0xe')]()]&&_0x4a7829[_0x0bf2('0x9')](_0xc77e3[_0x2c1277[_0x0bf2('0xc')][_0x0bf2('0xd')][_0x0bf2('0xe')]()][_0x0bf2('0xa')]());}else if(_0x2c1277[_0x0bf2('0x5')]==='keyValue'){if(_0x2c1277[_0x0bf2('0xf')]==='string'&&_0x2c1277[_0x0bf2('0x10')]){_0x4a7829[_0x0bf2('0x9')](util[_0x0bf2('0x11')](_0x0bf2('0x12'),_0x2c1277[_0x0bf2('0x10')],_0x2c1277['keyContent']));}else if(_0x2c1277[_0x0bf2('0xf')]===_0x0bf2('0x7')&&_0x2c1277[_0x0bf2('0x8')]&&_0x2c1277[_0x0bf2('0x10')]){_0xc77e3[_0x2c1277[_0x0bf2('0x8')]]&&_0x4a7829['push'](util[_0x0bf2('0x11')](_0x0bf2('0x12'),_0x2c1277[_0x0bf2('0x10')],_0xc77e3[_0x2c1277['variableName']]));}else if(_0x2c1277[_0x0bf2('0xf')]==='customVariable'&&_0x2c1277[_0x0bf2('0xc')]&&_0x2c1277[_0x0bf2('0xc')][_0x0bf2('0xd')]&&_0x2c1277[_0x0bf2('0x10')]){_0xc77e3[_0x2c1277[_0x0bf2('0xc')][_0x0bf2('0xd')][_0x0bf2('0xe')]()]&&_0x4a7829[_0x0bf2('0x9')](util[_0x0bf2('0x11')](_0x0bf2('0x12'),_0x2c1277[_0x0bf2('0x10')],_0xc77e3[_0x2c1277[_0x0bf2('0xc')][_0x0bf2('0xd')][_0x0bf2('0xe')]()]));}}}}return _0x4a7829['join'](_0x420684);};exports['stripTrailingSlash']=function(_0x3e7119){var _0x28a846=_0x3e7119[_0x0bf2('0x13')](-0x1);if(_0x28a846==='/'){_0x3e7119=_0x3e7119[_0x0bf2('0x14')](0x0,_0x3e7119[_0x0bf2('0x15')](_0x28a846));}return _0x3e7119;};exports[_0x0bf2('0x16')]=function(_0x123e6a){if(!_[_0x0bf2('0x17')](_0x123e6a)&&_0x123e6a!==''){var _0x41d982=/^(([^<>()\[\]\\.,;:\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 _0x41d982['test'](String(_0x123e6a)['toLowerCase']());}else{return![];}}; \ No newline at end of file diff --git a/server/services/ami/trigger/integration/vtiger.js b/server/services/ami/trigger/integration/vtiger.js index cbbfb73..3733340 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 _0x008c=['util','./util','../../../../config/environment','../../../../config/logger','vTiger','redis','defaults','localhost','socket.io-emitter','type','string','idField','content','toString','variable','variableName','customVariable','Variable','name','toLowerCase','merge','Descriptions','POST','format','%s/webservice.php','remoteUri','username','stringify','then','success','Ticket\x20could\x20not\x20be\x20created\x20due\x20to:\x20%s','error','catch','createTicket','validateEmail','info','Getting\x20agent\x20with\x20email','sessionName','SELECT\x20first_name,\x20last_name,\x20email1\x20FROM\x20Users\x20WHERE\x20email1=\x27%s\x27;','result','length','Agent\x20found!','resolve','email1','last_name','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','userId','admin','statusCode','[vTiger],\x20%s,\x20%s,\x20%s','getUser','Searching\x20end\x20user\x20with\x20phone','GET','query','SELECT\x20id,\x20firstname,\x20lastname,\x20email,\x20phone,\x20mobile,\x20homephone,\x20otherphone,\x20assistantphone\x20FROM\x20Contacts\x20WHERE\x20phone\x20=\x20\x27%s\x27\x20OR\x20mobile\x20=\x27%s\x27\x20OR\x20homephone\x20=\x27%s\x27\x20OR\x20otherphone\x20=\x27%s\x27\x20OR\x20assistantphone\x20=\x27%s\x27;','firstname','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!','create','Contacts','Enduser\x20created.','lastname','phone','getEndUser','getchallenge','token','Account\x20%d\x20is\x20not\x20valid','[HTTP]','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','serverUrl','uniqueid','email','The\x20User\x20ID\x20is:','calleridname','calleridnum','Ticket\x20created!','The\x20Ticket\x20ID\x20is:','split','trigger:browser:url','outbound','stripTrailingSlash','recordingFormat','none','[OUTBOUND]','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','destcalleridname','destcalleridnum','The\x20Enduser\x20ID\x20is:','Fields','%s/index.php?module=HelpDesk&view=Detail&record=%s&app=SUPPORT','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','abandoned','[ABANDONED]','lodash','request-promise','bluebird','md5'];(function(_0xfae23b,_0x2be4ba){var _0x200640=function(_0x4ae258){while(--_0x4ae258){_0xfae23b['push'](_0xfae23b['shift']());}};_0x200640(++_0x2be4ba);}(_0x008c,0x188));var _0xc008=function(_0x33628a,_0x2df134){_0x33628a=_0x33628a-0x0;var _0x25d370=_0x008c[_0x33628a];return _0x25d370;};'use strict';var _=require(_0xc008('0x0'));var rp=require(_0xc008('0x1'));var BPromise=require(_0xc008('0x2'));var md5=require(_0xc008('0x3'));var util=require(_0xc008('0x4'));var Redis=require('ioredis');var intUtil=require(_0xc008('0x5'));var config=require(_0xc008('0x6'));var logger=require(_0xc008('0x7'))(_0xc008('0x8'));config[_0xc008('0x9')]=_[_0xc008('0xa')](config[_0xc008('0x9')],{'host':_0xc008('0xb'),'port':0x18eb});var io=require(_0xc008('0xc'))(new Redis(config['redis']));function emit(_0x428fa9,_0x5aa09b,_0x30be38){io['to'](_0x428fa9)['emit'](_0x5aa09b,_0x30be38);}function getCustomFields(_0x52041f,_0x27830d){var _0x7231b4={};if(_0x52041f['length']>0x0){_['forEach'](_0x52041f,function(_0x543eb8){if(_0x543eb8[_0xc008('0xd')]===_0xc008('0xe')&&_0x543eb8['idField']){_0x7231b4[_0x543eb8[_0xc008('0xf')]]=_0x543eb8[_0xc008('0x10')][_0xc008('0x11')]();}else if(_0x543eb8[_0xc008('0xd')]===_0xc008('0x12')&&_0x543eb8[_0xc008('0x13')]&&_0x543eb8[_0xc008('0xf')]&&_0x27830d[_0x543eb8['variableName']]){_0x7231b4[_0x543eb8['idField']]=_0x27830d[_0x543eb8[_0xc008('0x13')]]['toString']();}else if(_0x543eb8[_0xc008('0xd')]===_0xc008('0x14')&&_0x543eb8[_0xc008('0x15')]&&_0x543eb8[_0xc008('0x15')][_0xc008('0x16')]&&_0x543eb8['idField']&&_0x27830d[_0x543eb8['Variable']['name'][_0xc008('0x17')]()]){_0x7231b4[_0x543eb8[_0xc008('0xf')]]=_0x27830d[_0x543eb8[_0xc008('0x15')][_0xc008('0x16')]['toLowerCase']()]['toString']();}});}return _0x7231b4;}function createTicket(_0x540e45,_0x5c2668,_0x46042b,_0x462af5,_0x501137,_0x813397,_0x5906e6){logger['info']('Creating\x20new\x20ticket...');var _0x50261c=_[_0xc008('0x18')]({'parent_id':'','assigned_user_id':_0x5c2668['id'],'ticketpriorities':'Normal','ticketstatus':'Open','ticket_title':intUtil['getString'](_0x462af5['Subjects'],_0x501137,'\x20'),'description':intUtil['getString'](_0x462af5[_0xc008('0x19')],_0x501137,'\x0a'),'contact_id':_0x46042b['id']},getCustomFields(_0x813397,_0x501137));var _0x4777a6={'method':_0xc008('0x1a'),'uri':util[_0xc008('0x1b')](_0xc008('0x1c'),_0x540e45[_0xc008('0x1d')]),'form':{'operation':'create','username':_0x540e45[_0xc008('0x1e')],'sessionName':_0x5906e6['sessionName'],'elementType':'HelpDesk','element':JSON[_0xc008('0x1f')](_0x50261c)},'json':!![]};return request(_0x4777a6)[_0xc008('0x20')](function(_0x2e3cfb){if(_0x2e3cfb[_0xc008('0x21')]){return BPromise['resolve']({'id':_0x2e3cfb['result']['id']});}else{throw new Error(util['format'](_0xc008('0x22'),JSON[_0xc008('0x1f')](_0x2e3cfb[_0xc008('0x23')])));}})[_0xc008('0x24')](function(_0x5bebd9){var _0x5e2aca=_0x5bebd9['statusCode']||0x1f4;logger['error']('[vTiger],\x20%s,\x20%s,\x20%s',_0xc008('0x25'),_0x5e2aca,JSON[_0xc008('0x1f')](_0x5bebd9));});}function getUser(_0x25eae4,_0x529961,_0x24c14c){if(intUtil[_0xc008('0x26')](_0x529961)){logger[_0xc008('0x27')](_0xc008('0x28'),_0x529961);return request({'method':'GET','uri':util[_0xc008('0x1b')](_0xc008('0x1c'),_0x25eae4['remoteUri']),'qs':{'operation':'query','username':_0x25eae4['username'],'sessionName':_0x24c14c[_0xc008('0x29')],'query':util[_0xc008('0x1b')](_0xc008('0x2a'),_0x529961)},'json':!![]})[_0xc008('0x20')](function(_0x1de04b){if(_0x1de04b[_0xc008('0x21')]&&_0x1de04b[_0xc008('0x2b')][_0xc008('0x2c')]){logger[_0xc008('0x27')](_0xc008('0x2d'));return BPromise[_0xc008('0x2e')]({'id':_0x1de04b[_0xc008('0x2b')][0x0]['id'],'email':_0x1de04b['result'][0x0][_0xc008('0x2f')],'name':_0x1de04b[_0xc008('0x2b')][0x0]['first_name']+'\x20'+_0x1de04b[_0xc008('0x2b')][_0xc008('0x30')]});}else{logger[_0xc008('0x27')](_0xc008('0x31'));return BPromise[_0xc008('0x2e')]({'id':_0x24c14c[_0xc008('0x32')],'email':_0x25eae4[_0xc008('0x1e')],'name':_0xc008('0x33')});}})[_0xc008('0x24')](function(_0x4f14d2){var _0x415b87=_0x4f14d2[_0xc008('0x34')]||0x1f4;logger[_0xc008('0x23')](_0xc008('0x35'),_0xc008('0x36'),_0x415b87,JSON[_0xc008('0x1f')](_0x4f14d2));});}else{logger[_0xc008('0x27')]('Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!');return BPromise[_0xc008('0x2e')]({'id':_0x24c14c[_0xc008('0x32')],'email':_0x25eae4['username'],'name':_0xc008('0x33')})[_0xc008('0x24')](function(_0x5e38d5){var _0x263473=_0x5e38d5[_0xc008('0x34')]||0x1f4;logger[_0xc008('0x23')]('[vTiger],\x20%s,\x20%s,\x20%s','getUser',_0x263473,JSON['stringify'](_0x5e38d5));});}}function getEndUser(_0x234f2a,_0x518024,_0x3dd0ac,_0x3884dd){logger[_0xc008('0x27')](_0xc008('0x37'),_0x3dd0ac);return request({'method':_0xc008('0x38'),'uri':util[_0xc008('0x1b')](_0xc008('0x1c'),_0x234f2a[_0xc008('0x1d')]),'qs':{'operation':_0xc008('0x39'),'username':_0x234f2a[_0xc008('0x1e')],'sessionName':_0x3884dd[_0xc008('0x29')],'query':util[_0xc008('0x1b')](_0xc008('0x3a'),_0x3dd0ac,_0x3dd0ac,_0x3dd0ac,_0x3dd0ac,_0x3dd0ac)},'json':!![]})[_0xc008('0x20')](function(_0x4cace5){if(_0x4cace5[_0xc008('0x21')]&&_0x4cace5[_0xc008('0x2b')][_0xc008('0x2c')]){logger[_0xc008('0x27')]('Enduser\x20found!');return BPromise[_0xc008('0x2e')]({'id':_0x4cace5[_0xc008('0x2b')][0x0]['id'],'name':_0x4cace5[_0xc008('0x2b')][0x0][_0xc008('0x3b')]+'\x20'+_0x4cace5[_0xc008('0x2b')][0x0]['lastname'],'phone':_0x3dd0ac});}else{logger[_0xc008('0x27')](_0xc008('0x3c'));return request({'method':_0xc008('0x1a'),'uri':util[_0xc008('0x1b')](_0xc008('0x1c'),_0x234f2a['remoteUri']),'form':{'operation':_0xc008('0x3d'),'sessionName':_0x3884dd[_0xc008('0x29')],'elementType':_0xc008('0x3e'),'element':JSON[_0xc008('0x1f')]({'lastname':_0x518024,'phone':_0x3dd0ac,'assigned_user_id':'\x20'})},'json':!![]})['then'](function(_0x26cd05){logger[_0xc008('0x27')](_0xc008('0x3f'));return BPromise['resolve']({'id':_0x26cd05[_0xc008('0x2b')]['id'],'name':_0x26cd05['result'][_0xc008('0x40')],'phone':_0x26cd05['result'][_0xc008('0x41')]});})[_0xc008('0x24')](function(_0x5a5d85){var _0x31007c=_0x5a5d85[_0xc008('0x34')]||0x1f4;logger[_0xc008('0x23')]('[vTiger],\x20%s,\x20%s,\x20%s',_0xc008('0x42'),_0x31007c,JSON[_0xc008('0x1f')](_0x5a5d85));});}});}function getConnection(_0x200469){var _0x44fc5d=_0x200469[_0xc008('0x1e')];var _0x372305=_0x200469['accessKey'];return request({'method':'GET','uri':util['format'](_0xc008('0x1c'),_0x200469[_0xc008('0x1d')]),'qs':{'operation':_0xc008('0x43'),'username':_0x44fc5d},'json':!![]})[_0xc008('0x20')](function(_0x25289f){if(_0x25289f[_0xc008('0x21')]){return request({'method':_0xc008('0x1a'),'uri':util[_0xc008('0x1b')]('%s/webservice.php',_0x200469['remoteUri']),'form':{'operation':'login','username':_0x44fc5d,'accessKey':md5(_0x25289f[_0xc008('0x2b')][_0xc008('0x44')]+_0x372305)},'json':!![]});}})[_0xc008('0x20')](function(_0x511383){if(_0x511383[_0xc008('0x21')]){return BPromise[_0xc008('0x2e')](_0x511383[_0xc008('0x2b')]);}else{throw new Error(util[_0xc008('0x1b')](_0xc008('0x45'),_0x200469['id']));}})[_0xc008('0x24')](function(_0x17ec90){var _0x405e87=_0x17ec90[_0xc008('0x34')]||0x1f4;logger[_0xc008('0x23')]('[vTiger],\x20%s,\x20%s,\x20%s','getConnection',_0x405e87,JSON[_0xc008('0x1f')](_0x17ec90));});}function request(_0x51cb14){logger[_0xc008('0x27')](_0xc008('0x46'),JSON[_0xc008('0x1f')](_0x51cb14));return rp(_0x51cb14);}exports['queue']=function(_0x144ab2,_0x32b435,_0xee64,_0x8b9775,_0x750cc9,_0x51105f){var _0x3a7b3b,_0x27b022,_0x4b4c6d,_0x24f775;_0x51105f[_0xc008('0x1d')]=intUtil['stripTrailingSlash'](_0x51105f['remoteUri']);if(_0x750cc9&&_0x750cc9[_0xc008('0x47')]){logger[_0xc008('0x27')](_0xc008('0x48'),_0xc008('0x49'));_0x32b435[_0xc008('0x4a')]=util['format']('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x51105f[_0xc008('0x4b')],_0x32b435['uniqueid'],md5(_0x32b435[_0xc008('0x4c')]));}else{_0x32b435[_0xc008('0x4a')]='';}return getConnection(_0x51105f)[_0xc008('0x20')](function(_0x2f1105){_0x24f775=_0x2f1105;return getUser(_0x51105f,_0x8b9775[_0xc008('0x4d')],_0x24f775);})[_0xc008('0x20')](function(_0x49d8b0){_0x3a7b3b=_0x49d8b0;logger[_0xc008('0x27')](_0xc008('0x4e'),_0x3a7b3b['id']);return getEndUser(_0x51105f,_0x32b435[_0xc008('0x4f')],_0x32b435[_0xc008('0x50')],_0x24f775);})[_0xc008('0x20')](function(_0x5aa385){_0x27b022=_0x5aa385;logger[_0xc008('0x27')]('The\x20Enduser\x20ID\x20is:',_0x27b022['id']);return createTicket(_0x51105f,_0x3a7b3b,_0x27b022,_0xee64,_0x32b435,_0xee64['Fields'],_0x24f775);})['then'](function(_0x89bb20){_0x4b4c6d=_0x89bb20;logger[_0xc008('0x27')](_0xc008('0x51'));logger['info'](_0xc008('0x52'),_0x4b4c6d['id']);var _0x2d8361=util[_0xc008('0x1b')]('%s/index.php?module=HelpDesk&view=Detail&record=%s&app=SUPPORT',_0x51105f[_0xc008('0x1d')],_[_0xc008('0x53')](_0x4b4c6d['id'],'x')[0x1]);logger[_0xc008('0x27')](_0xc008('0x48'),'Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...');emit(util[_0xc008('0x1b')]('user:%s',_0x8b9775[_0xc008('0x16')]),_0xc008('0x54'),{'uri':_0x2d8361});})[_0xc008('0x24')](function(_0x943c91){logger[_0xc008('0x23')](_0xc008('0x48'),JSON['stringify'](_0x943c91));});};exports[_0xc008('0x55')]=function(_0x570001,_0x5bf4a9,_0x37ce5e,_0x30aa1e,_0x56e755,_0xb1befa,_0xb8ba7){var _0x3e373e,_0x4517c0,_0x21ee6d,_0x31a339;_0xb1befa[_0xc008('0x1d')]=intUtil['stripTrailingSlash'](_0xb1befa[_0xc008('0x1d')]);_0xb1befa[_0xc008('0x4b')]=intUtil[_0xc008('0x56')](_0xb1befa[_0xc008('0x4b')]);if(_0xb8ba7&&_0xb8ba7[_0xc008('0x57')]&&_0xb8ba7[_0xc008('0x57')]!==_0xc008('0x58')){logger[_0xc008('0x27')](_0xc008('0x59'),_0xc008('0x49'));_0x5bf4a9[_0xc008('0x4a')]=util[_0xc008('0x1b')](_0xc008('0x5a'),_0xb1befa[_0xc008('0x4b')],_0x5bf4a9['uniqueid'],md5(_0x5bf4a9[_0xc008('0x4c')]));}return getConnection(_0xb1befa)[_0xc008('0x20')](function(_0x3d3a7e){_0x31a339=_0x3d3a7e;return getUser(_0xb1befa,_0x30aa1e['email'],_0x31a339);})[_0xc008('0x20')](function(_0x3214df){_0x3e373e=_0x3214df;logger['info']('The\x20User\x20ID\x20is:',_0x3e373e['id']);return getEndUser(_0xb1befa,_0x5bf4a9[_0xc008('0x5b')],_0x5bf4a9[_0xc008('0x5c')],_0x31a339);})[_0xc008('0x20')](function(_0x39083c){_0x4517c0=_0x39083c;logger[_0xc008('0x27')](_0xc008('0x5d'),_0x4517c0['id']);return createTicket(_0xb1befa,_0x3e373e,_0x4517c0,_0x37ce5e,_0x5bf4a9,_0x37ce5e[_0xc008('0x5e')],_0x31a339);})[_0xc008('0x20')](function(_0x39e219){_0x21ee6d=_0x39e219;logger[_0xc008('0x27')](_0xc008('0x51'));logger['info'](_0xc008('0x52'),_0x21ee6d['id']);var _0x25a52b=util[_0xc008('0x1b')](_0xc008('0x5f'),_0xb1befa['remoteUri'],_[_0xc008('0x53')](_0x21ee6d['id'],'x')[0x1]);logger['info'](_0xc008('0x59'),_0xc008('0x60'));emit(util[_0xc008('0x1b')]('user:%s',_0x30aa1e[_0xc008('0x16')]),_0xc008('0x54'),{'uri':_0x25a52b});})[_0xc008('0x24')](function(_0x553f5c){logger[_0xc008('0x23')]('[OUTBOUND]',JSON[_0xc008('0x1f')](_0x553f5c));});};exports[_0xc008('0x61')]=function(_0x23012c,_0x6fe732,_0x295ec7,_0x4ca4a6,_0x3c30db,_0x3f2342){var _0x49493b,_0x3efb77,_0x5233bb,_0x278cbe;_0x3f2342['remoteUri']=intUtil[_0xc008('0x56')](_0x3f2342['remoteUri']);_0x3f2342[_0xc008('0x4b')]=intUtil[_0xc008('0x56')](_0x3f2342[_0xc008('0x4b')]);if(_0x3c30db&&_0x3c30db[_0xc008('0x47')]){logger['info'](_0xc008('0x62'),_0xc008('0x49'));_0x6fe732[_0xc008('0x4a')]=util[_0xc008('0x1b')](_0xc008('0x5a'),_0x3f2342[_0xc008('0x4b')],_0x6fe732[_0xc008('0x4c')],md5(_0x6fe732[_0xc008('0x4c')]));}else{_0x6fe732['recordingURL']='';}return getConnection(_0x3f2342)[_0xc008('0x20')](function(_0x530c2f){_0x278cbe=_0x530c2f;return getUser(_0x3f2342,'',_0x278cbe);})['then'](function(_0x4c84da){_0x49493b=_0x4c84da;logger[_0xc008('0x27')](_0xc008('0x4e'),_0x49493b['id']);return getEndUser(_0x3f2342,_0x6fe732[_0xc008('0x4f')],_0x6fe732[_0xc008('0x50')],_0x278cbe);})[_0xc008('0x20')](function(_0x2e9646){_0x3efb77=_0x2e9646;logger[_0xc008('0x27')](_0xc008('0x5d'),_0x3efb77['id']);return createTicket(_0x3f2342,_0x49493b,_0x3efb77,_0x295ec7,_0x6fe732,_0x295ec7[_0xc008('0x5e')],_0x278cbe);})['then'](function(_0x38b603){_0x5233bb=_0x38b603;logger[_0xc008('0x27')](_0xc008('0x51'));logger[_0xc008('0x27')](_0xc008('0x52'),_0x5233bb['id']);})[_0xc008('0x24')](function(_0x23d4ff){logger[_0xc008('0x23')](_0xc008('0x62'),JSON[_0xc008('0x1f')](_0x23d4ff));});}; \ No newline at end of file +var _0x34e8=['user:%s','trigger:browser:url','[QUEUE]','outbound','serverUrl','recordingFormat','[OUTBOUND]','recordingURL','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','destcalleridname','destcalleridnum','The\x20Enduser\x20ID\x20is:','Ticket\x20created!','monitor_format','[ABANDONED]','lodash','request-promise','bluebird','md5','ioredis','./util','../../../../config/environment','../../../../config/logger','vTiger','redis','defaults','localhost','emit','length','forEach','type','string','idField','content','toString','variable','variableName','customVariable','Variable','name','info','Creating\x20new\x20ticket...','merge','Open','getString','Descriptions','%s/webservice.php','remoteUri','username','sessionName','stringify','then','resolve','result','catch','statusCode','error','[vTiger],\x20%s,\x20%s,\x20%s','validateEmail','GET','format','query','SELECT\x20first_name,\x20last_name,\x20email1\x20FROM\x20Users\x20WHERE\x20email1=\x27%s\x27;','Agent\x20found!','email1','first_name','last_name','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','admin','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!','POST','Enduser\x20created.','phone','accessKey','success','login','token','Account\x20%d\x20is\x20not\x20valid','[HTTP]','queue','stripTrailingSlash','Recording\x20is\x20enabled!','uniqueid','email','The\x20User\x20ID\x20is:','calleridname','calleridnum','Fields','The\x20Ticket\x20ID\x20is:','split','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...'];(function(_0x502c7d,_0x2f1285){var _0x30b7ed=function(_0x2d92f3){while(--_0x2d92f3){_0x502c7d['push'](_0x502c7d['shift']());}};_0x30b7ed(++_0x2f1285);}(_0x34e8,0x12c));var _0x834e=function(_0x7a828f,_0xc61c69){_0x7a828f=_0x7a828f-0x0;var _0x59ec32=_0x34e8[_0x7a828f];return _0x59ec32;};'use strict';var _=require(_0x834e('0x0'));var rp=require(_0x834e('0x1'));var BPromise=require(_0x834e('0x2'));var md5=require(_0x834e('0x3'));var util=require('util');var Redis=require(_0x834e('0x4'));var intUtil=require(_0x834e('0x5'));var config=require(_0x834e('0x6'));var logger=require(_0x834e('0x7'))(_0x834e('0x8'));config[_0x834e('0x9')]=_[_0x834e('0xa')](config['redis'],{'host':_0x834e('0xb'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x834e('0x9')]));function emit(_0x3cc2e3,_0x3a3ef6,_0x2e69e2){io['to'](_0x3cc2e3)[_0x834e('0xc')](_0x3a3ef6,_0x2e69e2);}function getCustomFields(_0x23501c,_0x363786){var _0x1af45a={};if(_0x23501c[_0x834e('0xd')]>0x0){_[_0x834e('0xe')](_0x23501c,function(_0x1e41fe){if(_0x1e41fe[_0x834e('0xf')]===_0x834e('0x10')&&_0x1e41fe[_0x834e('0x11')]){_0x1af45a[_0x1e41fe[_0x834e('0x11')]]=_0x1e41fe[_0x834e('0x12')][_0x834e('0x13')]();}else if(_0x1e41fe['type']===_0x834e('0x14')&&_0x1e41fe[_0x834e('0x15')]&&_0x1e41fe['idField']&&_0x363786[_0x1e41fe[_0x834e('0x15')]]){_0x1af45a[_0x1e41fe[_0x834e('0x11')]]=_0x363786[_0x1e41fe[_0x834e('0x15')]][_0x834e('0x13')]();}else if(_0x1e41fe['type']===_0x834e('0x16')&&_0x1e41fe[_0x834e('0x17')]&&_0x1e41fe['Variable'][_0x834e('0x18')]&&_0x1e41fe['idField']&&_0x363786[_0x1e41fe[_0x834e('0x17')][_0x834e('0x18')]['toLowerCase']()]){_0x1af45a[_0x1e41fe[_0x834e('0x11')]]=_0x363786[_0x1e41fe[_0x834e('0x17')][_0x834e('0x18')]['toLowerCase']()][_0x834e('0x13')]();}});}return _0x1af45a;}function createTicket(_0x211e9a,_0x34e41a,_0xb993a1,_0x237947,_0x254677,_0x1dd214,_0x595515){logger[_0x834e('0x19')](_0x834e('0x1a'));var _0x113ff4=_[_0x834e('0x1b')]({'parent_id':'','assigned_user_id':_0x34e41a['id'],'ticketpriorities':'Normal','ticketstatus':_0x834e('0x1c'),'ticket_title':intUtil[_0x834e('0x1d')](_0x237947['Subjects'],_0x254677,'\x20'),'description':intUtil[_0x834e('0x1d')](_0x237947[_0x834e('0x1e')],_0x254677,'\x0a'),'contact_id':_0xb993a1['id']},getCustomFields(_0x1dd214,_0x254677));var _0x8d406e={'method':'POST','uri':util['format'](_0x834e('0x1f'),_0x211e9a[_0x834e('0x20')]),'form':{'operation':'create','username':_0x211e9a[_0x834e('0x21')],'sessionName':_0x595515[_0x834e('0x22')],'elementType':'HelpDesk','element':JSON[_0x834e('0x23')](_0x113ff4)},'json':!![]};return request(_0x8d406e)[_0x834e('0x24')](function(_0x338636){if(_0x338636['success']){return BPromise[_0x834e('0x25')]({'id':_0x338636[_0x834e('0x26')]['id']});}else{throw new Error(util['format']('Ticket\x20could\x20not\x20be\x20created\x20due\x20to:\x20%s',JSON[_0x834e('0x23')](_0x338636['error'])));}})[_0x834e('0x27')](function(_0x3f1b0b){var _0x3db026=_0x3f1b0b[_0x834e('0x28')]||0x1f4;logger[_0x834e('0x29')](_0x834e('0x2a'),'createTicket',_0x3db026,JSON['stringify'](_0x3f1b0b));});}function getUser(_0x4dc64a,_0x58c1d7,_0x2c7a8d){if(intUtil[_0x834e('0x2b')](_0x58c1d7)){logger[_0x834e('0x19')]('Getting\x20agent\x20with\x20email',_0x58c1d7);return request({'method':_0x834e('0x2c'),'uri':util[_0x834e('0x2d')](_0x834e('0x1f'),_0x4dc64a[_0x834e('0x20')]),'qs':{'operation':_0x834e('0x2e'),'username':_0x4dc64a[_0x834e('0x21')],'sessionName':_0x2c7a8d[_0x834e('0x22')],'query':util[_0x834e('0x2d')](_0x834e('0x2f'),_0x58c1d7)},'json':!![]})['then'](function(_0xef9ec2){if(_0xef9ec2['success']&&_0xef9ec2[_0x834e('0x26')][_0x834e('0xd')]){logger[_0x834e('0x19')](_0x834e('0x30'));return BPromise[_0x834e('0x25')]({'id':_0xef9ec2[_0x834e('0x26')][0x0]['id'],'email':_0xef9ec2[_0x834e('0x26')][0x0][_0x834e('0x31')],'name':_0xef9ec2[_0x834e('0x26')][0x0][_0x834e('0x32')]+'\x20'+_0xef9ec2['result'][_0x834e('0x33')]});}else{logger[_0x834e('0x19')](_0x834e('0x34'));return BPromise[_0x834e('0x25')]({'id':_0x2c7a8d['userId'],'email':_0x4dc64a[_0x834e('0x21')],'name':_0x834e('0x35')});}})['catch'](function(_0x496533){var _0x59385a=_0x496533[_0x834e('0x28')]||0x1f4;logger[_0x834e('0x29')](_0x834e('0x2a'),_0x834e('0x36'),_0x59385a,JSON[_0x834e('0x23')](_0x496533));});}else{logger[_0x834e('0x19')]('Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!');return BPromise[_0x834e('0x25')]({'id':_0x2c7a8d['userId'],'email':_0x4dc64a[_0x834e('0x21')],'name':_0x834e('0x35')})['catch'](function(_0x18ac3b){var _0x2f56c7=_0x18ac3b['statusCode']||0x1f4;logger['error'](_0x834e('0x2a'),_0x834e('0x36'),_0x2f56c7,JSON[_0x834e('0x23')](_0x18ac3b));});}}function getEndUser(_0x130c23,_0x3c49bd,_0x4ca43c,_0x1c5ed6){logger['info']('Searching\x20end\x20user\x20with\x20phone',_0x4ca43c);return request({'method':_0x834e('0x2c'),'uri':util['format'](_0x834e('0x1f'),_0x130c23[_0x834e('0x20')]),'qs':{'operation':_0x834e('0x2e'),'username':_0x130c23[_0x834e('0x21')],'sessionName':_0x1c5ed6[_0x834e('0x22')],'query':util['format'](_0x834e('0x37'),_0x4ca43c,_0x4ca43c,_0x4ca43c,_0x4ca43c,_0x4ca43c)},'json':!![]})[_0x834e('0x24')](function(_0x38f266){if(_0x38f266['success']&&_0x38f266[_0x834e('0x26')][_0x834e('0xd')]){logger['info'](_0x834e('0x38'));return BPromise['resolve']({'id':_0x38f266[_0x834e('0x26')][0x0]['id'],'name':_0x38f266[_0x834e('0x26')][0x0]['firstname']+'\x20'+_0x38f266['result'][0x0][_0x834e('0x39')],'phone':_0x4ca43c});}else{logger[_0x834e('0x19')](_0x834e('0x3a'));return request({'method':_0x834e('0x3b'),'uri':util[_0x834e('0x2d')](_0x834e('0x1f'),_0x130c23[_0x834e('0x20')]),'form':{'operation':'create','sessionName':_0x1c5ed6[_0x834e('0x22')],'elementType':'Contacts','element':JSON[_0x834e('0x23')]({'lastname':_0x3c49bd,'phone':_0x4ca43c,'assigned_user_id':'\x20'})},'json':!![]})['then'](function(_0x1df5b0){logger['info'](_0x834e('0x3c'));return BPromise[_0x834e('0x25')]({'id':_0x1df5b0['result']['id'],'name':_0x1df5b0[_0x834e('0x26')][_0x834e('0x39')],'phone':_0x1df5b0[_0x834e('0x26')][_0x834e('0x3d')]});})[_0x834e('0x27')](function(_0x1a7149){var _0xfa28da=_0x1a7149[_0x834e('0x28')]||0x1f4;logger[_0x834e('0x29')](_0x834e('0x2a'),'getEndUser',_0xfa28da,JSON[_0x834e('0x23')](_0x1a7149));});}});}function getConnection(_0x6fff27){var _0x47a8a9=_0x6fff27[_0x834e('0x21')];var _0x42fd90=_0x6fff27[_0x834e('0x3e')];return request({'method':_0x834e('0x2c'),'uri':util[_0x834e('0x2d')](_0x834e('0x1f'),_0x6fff27['remoteUri']),'qs':{'operation':'getchallenge','username':_0x47a8a9},'json':!![]})[_0x834e('0x24')](function(_0x1a5444){if(_0x1a5444[_0x834e('0x3f')]){return request({'method':_0x834e('0x3b'),'uri':util[_0x834e('0x2d')](_0x834e('0x1f'),_0x6fff27[_0x834e('0x20')]),'form':{'operation':_0x834e('0x40'),'username':_0x47a8a9,'accessKey':md5(_0x1a5444[_0x834e('0x26')][_0x834e('0x41')]+_0x42fd90)},'json':!![]});}})[_0x834e('0x24')](function(_0x385435){if(_0x385435[_0x834e('0x3f')]){return BPromise[_0x834e('0x25')](_0x385435[_0x834e('0x26')]);}else{throw new Error(util[_0x834e('0x2d')](_0x834e('0x42'),_0x6fff27['id']));}})[_0x834e('0x27')](function(_0x420841){var _0x1adf86=_0x420841['statusCode']||0x1f4;logger[_0x834e('0x29')](_0x834e('0x2a'),'getConnection',_0x1adf86,JSON[_0x834e('0x23')](_0x420841));});}function request(_0x3b0988){logger['info'](_0x834e('0x43'),JSON[_0x834e('0x23')](_0x3b0988));return rp(_0x3b0988);}exports[_0x834e('0x44')]=function(_0x35636e,_0x4288e4,_0xb77aab,_0x4549ba,_0x4a8b32,_0x1ad7fe){var _0x8bc6c6,_0x3e0550,_0x363675,_0x86ad2b;_0x1ad7fe[_0x834e('0x20')]=intUtil[_0x834e('0x45')](_0x1ad7fe[_0x834e('0x20')]);if(_0x4a8b32&&_0x4a8b32['monitor_format']){logger[_0x834e('0x19')]('[QUEUE]',_0x834e('0x46'));_0x4288e4['recordingURL']=util[_0x834e('0x2d')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x1ad7fe['serverUrl'],_0x4288e4[_0x834e('0x47')],md5(_0x4288e4[_0x834e('0x47')]));}else{_0x4288e4['recordingURL']='';}return getConnection(_0x1ad7fe)['then'](function(_0x2c8155){_0x86ad2b=_0x2c8155;return getUser(_0x1ad7fe,_0x4549ba[_0x834e('0x48')],_0x86ad2b);})[_0x834e('0x24')](function(_0x387365){_0x8bc6c6=_0x387365;logger[_0x834e('0x19')](_0x834e('0x49'),_0x8bc6c6['id']);return getEndUser(_0x1ad7fe,_0x4288e4[_0x834e('0x4a')],_0x4288e4[_0x834e('0x4b')],_0x86ad2b);})['then'](function(_0x142334){_0x3e0550=_0x142334;logger[_0x834e('0x19')]('The\x20Enduser\x20ID\x20is:',_0x3e0550['id']);return createTicket(_0x1ad7fe,_0x8bc6c6,_0x3e0550,_0xb77aab,_0x4288e4,_0xb77aab[_0x834e('0x4c')],_0x86ad2b);})['then'](function(_0x3e58ef){_0x363675=_0x3e58ef;logger[_0x834e('0x19')]('Ticket\x20created!');logger[_0x834e('0x19')](_0x834e('0x4d'),_0x363675['id']);var _0x2de29a=util[_0x834e('0x2d')]('%s/index.php?module=HelpDesk&view=Detail&record=%s&app=SUPPORT',_0x1ad7fe[_0x834e('0x20')],_[_0x834e('0x4e')](_0x363675['id'],'x')[0x1]);logger[_0x834e('0x19')]('[QUEUE]',_0x834e('0x4f'));emit(util[_0x834e('0x2d')](_0x834e('0x50'),_0x4549ba[_0x834e('0x18')]),_0x834e('0x51'),{'uri':_0x2de29a});})[_0x834e('0x27')](function(_0x3a1426){logger[_0x834e('0x29')](_0x834e('0x52'),JSON[_0x834e('0x23')](_0x3a1426));});};exports[_0x834e('0x53')]=function(_0x1dfa95,_0x1b7045,_0x1659c8,_0x460a7a,_0x17b8e3,_0x297cce,_0x14ed83){var _0x193a15,_0x3e3467,_0xed4081,_0x2cb233;_0x297cce['remoteUri']=intUtil[_0x834e('0x45')](_0x297cce[_0x834e('0x20')]);_0x297cce[_0x834e('0x54')]=intUtil[_0x834e('0x45')](_0x297cce['serverUrl']);if(_0x14ed83&&_0x14ed83[_0x834e('0x55')]&&_0x14ed83['recordingFormat']!=='none'){logger[_0x834e('0x19')](_0x834e('0x56'),_0x834e('0x46'));_0x1b7045[_0x834e('0x57')]=util[_0x834e('0x2d')](_0x834e('0x58'),_0x297cce[_0x834e('0x54')],_0x1b7045[_0x834e('0x47')],md5(_0x1b7045['uniqueid']));}return getConnection(_0x297cce)[_0x834e('0x24')](function(_0x5a99e6){_0x2cb233=_0x5a99e6;return getUser(_0x297cce,_0x460a7a[_0x834e('0x48')],_0x2cb233);})[_0x834e('0x24')](function(_0x514fe5){_0x193a15=_0x514fe5;logger['info'](_0x834e('0x49'),_0x193a15['id']);return getEndUser(_0x297cce,_0x1b7045[_0x834e('0x59')],_0x1b7045[_0x834e('0x5a')],_0x2cb233);})[_0x834e('0x24')](function(_0x2c41bd){_0x3e3467=_0x2c41bd;logger['info'](_0x834e('0x5b'),_0x3e3467['id']);return createTicket(_0x297cce,_0x193a15,_0x3e3467,_0x1659c8,_0x1b7045,_0x1659c8[_0x834e('0x4c')],_0x2cb233);})[_0x834e('0x24')](function(_0x228a60){_0xed4081=_0x228a60;logger[_0x834e('0x19')](_0x834e('0x5c'));logger[_0x834e('0x19')](_0x834e('0x4d'),_0xed4081['id']);var _0x376f72=util[_0x834e('0x2d')]('%s/index.php?module=HelpDesk&view=Detail&record=%s&app=SUPPORT',_0x297cce[_0x834e('0x20')],_[_0x834e('0x4e')](_0xed4081['id'],'x')[0x1]);logger[_0x834e('0x19')](_0x834e('0x56'),'Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...');emit(util[_0x834e('0x2d')]('user:%s',_0x460a7a['name']),'trigger:browser:url',{'uri':_0x376f72});})[_0x834e('0x27')](function(_0x332d8f){logger['error'](_0x834e('0x56'),JSON[_0x834e('0x23')](_0x332d8f));});};exports['abandoned']=function(_0x353246,_0x18ccb2,_0x4b88e7,_0x5df169,_0x346be5,_0x2a42a3){var _0x8bc7d9,_0x44c909,_0x1d8e7,_0x493239;_0x2a42a3[_0x834e('0x20')]=intUtil['stripTrailingSlash'](_0x2a42a3[_0x834e('0x20')]);_0x2a42a3[_0x834e('0x54')]=intUtil[_0x834e('0x45')](_0x2a42a3['serverUrl']);if(_0x346be5&&_0x346be5[_0x834e('0x5d')]){logger[_0x834e('0x19')]('[ABANDONED]',_0x834e('0x46'));_0x18ccb2[_0x834e('0x57')]=util[_0x834e('0x2d')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x2a42a3[_0x834e('0x54')],_0x18ccb2[_0x834e('0x47')],md5(_0x18ccb2[_0x834e('0x47')]));}else{_0x18ccb2[_0x834e('0x57')]='';}return getConnection(_0x2a42a3)[_0x834e('0x24')](function(_0x29bfd7){_0x493239=_0x29bfd7;return getUser(_0x2a42a3,'',_0x493239);})[_0x834e('0x24')](function(_0x23b5d9){_0x8bc7d9=_0x23b5d9;logger[_0x834e('0x19')](_0x834e('0x49'),_0x8bc7d9['id']);return getEndUser(_0x2a42a3,_0x18ccb2['calleridname'],_0x18ccb2['calleridnum'],_0x493239);})['then'](function(_0x36ede9){_0x44c909=_0x36ede9;logger[_0x834e('0x19')](_0x834e('0x5b'),_0x44c909['id']);return createTicket(_0x2a42a3,_0x8bc7d9,_0x44c909,_0x4b88e7,_0x18ccb2,_0x4b88e7[_0x834e('0x4c')],_0x493239);})[_0x834e('0x24')](function(_0x5758fb){_0x1d8e7=_0x5758fb;logger['info'](_0x834e('0x5c'));logger[_0x834e('0x19')](_0x834e('0x4d'),_0x1d8e7['id']);})[_0x834e('0x27')](function(_0x40a705){logger['error'](_0x834e('0x5e'),JSON[_0x834e('0x23')](_0x40a705));});}; \ 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 a578754..60be017 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 _0xcea5=['The\x20User\x20ID\x20is:','calleridname','The\x20Enduser\x20ID\x20is:','The\x20Ticket\x20ID\x20is:','[QUEUE]','Displaying\x20ticket\x20to\x20agent...','%s/channels/voice/agents/%d/tickets/%d/display.json','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','user:%s','trigger:browser:url','error','catch','inspect','outbound','recordingFormat','none','[OUTBOUND]','Recording\x20is\x20enabled!','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','destcalleridnum','integrationTab','newTab','%s/agent/tickets/%s','[OUTBOUND]\x20Error\x20running\x20Zendesk\x20integration','[ABANDONED]','calleridnum','lodash','request-promise','md5','util','ioredis','../../../../config/environment','../../../../config/logger','zendesk','redis','localhost','emit','application/json','info','Creating\x20new\x20ticket...','format','%s/tickets.json','POST','merge','Tags','name','getString','Subjects','Descriptions','Fields','then','Ticket\x20created!','ticket','validateEmail','Getting\x20agent\x20with\x20email','%s/search.json','remoteUri','type:user\x20role:agent\x20email:%s','count','find','agent','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','Admin\x20account\x20selected.','user','Searching\x20enduser\x20with\x20phone','type:user\x20role:end-user\x20phone:%s','results','length','filter','end-user','Enduser\x20found!','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!','%s/users.json','Caller\x20-\x20%s','Enduser\x20created.','authType','password','username','token','%s/token:%s','Basic\x20%s','toString','base64','debug','stringify','defaults','GET','string','toLowerCase','content','idField','customField','push','type','variable','variableName','custom_fields','Variable','stripTrailingSlash','serverUrl','monitor_format','recordingURL','Authorization','email'];(function(_0x3b3210,_0x25e8ed){var _0x5b5484=function(_0x417858){while(--_0x417858){_0x3b3210['push'](_0x3b3210['shift']());}};_0x5b5484(++_0x25e8ed);}(_0xcea5,0xed));var _0x5cea=function(_0x4abdc8,_0x5a0d32){_0x4abdc8=_0x4abdc8-0x0;var _0x48af55=_0xcea5[_0x4abdc8];return _0x48af55;};'use strict';var _=require(_0x5cea('0x0'));var rp=require(_0x5cea('0x1'));var md5=require(_0x5cea('0x2'));var util=require(_0x5cea('0x3'));var Redis=require(_0x5cea('0x4'));var intUtil=require('./util');var config=require(_0x5cea('0x5'));var logger=require(_0x5cea('0x6'))(_0x5cea('0x7'));config[_0x5cea('0x8')]=_['defaults'](config[_0x5cea('0x8')],{'host':_0x5cea('0x9'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config['redis']));function emit(_0x59f337,_0x502d95,_0x3b6fbc){io['to'](_0x59f337)[_0x5cea('0xa')](_0x502d95,_0x3b6fbc);}var headers={'Content-Type':'application/json','Accept':_0x5cea('0xb')};function getTicket(_0x4e8cd8,_0x1dc545,_0x177986,_0x1c9e9f,_0x23b85f){logger[_0x5cea('0xc')](_0x5cea('0xd'));return request({'uri':util[_0x5cea('0xe')](_0x5cea('0xf'),_0x4e8cd8['remoteUri']),'method':_0x5cea('0x10'),'body':{'ticket':_[_0x5cea('0x11')]({'requester_id':_0x177986['id'],'submitter_id':_0x1dc545?_0x1dc545['id']:undefined,'assignee_id':_0x1dc545?_0x1dc545['id']:undefined,'tags':getTags(_0x1c9e9f[_0x5cea('0x12')],_0x5cea('0x13')),'subject':intUtil[_0x5cea('0x14')](_0x1c9e9f[_0x5cea('0x15')],_0x23b85f,'\x20'),'description':intUtil[_0x5cea('0x14')](_0x1c9e9f[_0x5cea('0x16')],_0x23b85f,'\x0a'),'comment':{'public':![],'body':intUtil[_0x5cea('0x14')](_0x1c9e9f[_0x5cea('0x16')],_0x23b85f,'\x0a')}},getCustomFields(_0x1c9e9f[_0x5cea('0x17')],_0x23b85f))}})[_0x5cea('0x18')](function(_0x4a648c){logger[_0x5cea('0xc')](_0x5cea('0x19'));return _0x4a648c[_0x5cea('0x1a')];});}function getUser(_0x1c9a30,_0x209046){if(intUtil[_0x5cea('0x1b')](_0x209046)){logger[_0x5cea('0xc')](_0x5cea('0x1c'),_0x209046);return request({'uri':util[_0x5cea('0xe')](_0x5cea('0x1d'),_0x1c9a30[_0x5cea('0x1e')]),'qs':{'query':util[_0x5cea('0xe')](_0x5cea('0x1f'),_0x209046)}})[_0x5cea('0x18')](function(_0x179c4e){if(_0x179c4e[_0x5cea('0x20')]){logger[_0x5cea('0xc')]('Agent\x20found!');return _[_0x5cea('0x21')](_0x179c4e['results'],{'email':_0x209046,'role':_0x5cea('0x22')});}else{logger[_0x5cea('0xc')](_0x5cea('0x23'));return request({'uri':util[_0x5cea('0xe')]('%s/users/me.json',_0x1c9a30[_0x5cea('0x1e')])})['then'](function(_0xa8cadc){logger[_0x5cea('0xc')](_0x5cea('0x24'));return _0xa8cadc[_0x5cea('0x25')];});}});}else{logger[_0x5cea('0xc')](_0x5cea('0x23'));return request({'uri':util[_0x5cea('0xe')]('%s/users/me.json',_0x1c9a30['remoteUri'])})[_0x5cea('0x18')](function(_0x3cf45a){logger['info'](_0x5cea('0x24'));return _0x3cf45a[_0x5cea('0x25')];});}}function getEndUser(_0x3595cd,_0x4e3219,_0x5d36d7){logger[_0x5cea('0xc')](_0x5cea('0x26'),_0x5d36d7);return request({'uri':util[_0x5cea('0xe')]('%s/search.json',_0x3595cd[_0x5cea('0x1e')]),'qs':{'query':util[_0x5cea('0xe')](_0x5cea('0x27'),_0x5d36d7)}})[_0x5cea('0x18')](function(_0x5d9179){var _0x2ed1d2;if(_0x5d9179[_0x5cea('0x28')][_0x5cea('0x29')]){_0x5d9179[_0x5cea('0x28')]=_[_0x5cea('0x2a')](_0x5d9179[_0x5cea('0x28')],{'suspended':![],'role':_0x5cea('0x2b')});if(_0x5d9179[_0x5cea('0x28')]['length']){_0x2ed1d2=_['first'](_0x5d9179[_0x5cea('0x28')]);}}if(_0x2ed1d2){logger[_0x5cea('0xc')](_0x5cea('0x2c'));return _0x2ed1d2;}else{logger[_0x5cea('0xc')](_0x5cea('0x2d'));return request({'uri':util['format'](_0x5cea('0x2e'),_0x3595cd[_0x5cea('0x1e')]),'method':_0x5cea('0x10'),'body':{'user':{'role':_0x5cea('0x2b'),'name':util[_0x5cea('0xe')](_0x5cea('0x2f'),_0x4e3219||_0x5d36d7),'phone':_0x5d36d7}}})[_0x5cea('0x18')](function(_0x16704d){logger[_0x5cea('0xc')](_0x5cea('0x30'));return _0x16704d[_0x5cea('0x25')];});}});}function getAuth(_0x536e53){var _0x39d233;if(_0x536e53[_0x5cea('0x31')]===_0x5cea('0x32')){_0x39d233=util[_0x5cea('0xe')]('%s:%s',_0x536e53[_0x5cea('0x33')],_0x536e53[_0x5cea('0x32')]);}else if(_0x536e53[_0x5cea('0x31')]===_0x5cea('0x34')){_0x39d233=util[_0x5cea('0xe')](_0x5cea('0x35'),_0x536e53[_0x5cea('0x33')],_0x536e53[_0x5cea('0x34')]);}return util[_0x5cea('0xe')](_0x5cea('0x36'),new Buffer(_0x39d233)[_0x5cea('0x37')](_0x5cea('0x38')));}function request(_0x5d9da7){logger[_0x5cea('0x39')]('[HTTP]',JSON[_0x5cea('0x3a')](_0x5d9da7));return rp(_[_0x5cea('0x3b')](_0x5d9da7,{'method':_0x5cea('0x3c'),'headers':headers,'json':!![]}));}function getTags(_0x7ad292,_0x3126e1){var _0x43a73d=[];if(_0x7ad292&&_0x7ad292[_0x5cea('0x29')]>0x0){_0x43a73d=_['map'](_0x7ad292,_0x3126e1);}return _0x43a73d;}function getCustomFields(_0x19b267,_0x5bf0f9){var _0x17a823=[];var _0x2d4caf={'custom_fields':[]};if(_0x19b267[_0x5cea('0x29')]>0x0){_['forEach'](_0x19b267,function(_0x3c8070){if(_0x3c8070['type']===_0x5cea('0x3d')&&_0x3c8070['nameField']&&!_0x3c8070['customField']){_0x2d4caf[_0x3c8070['nameField'][_0x5cea('0x3e')]()]=_0x3c8070[_0x5cea('0x3f')][_0x5cea('0x37')]();}else if(_0x3c8070['type']===_0x5cea('0x3d')&&_0x3c8070[_0x5cea('0x40')]&&_0x3c8070[_0x5cea('0x41')]){_0x2d4caf['custom_fields'][_0x5cea('0x42')]({'id':_0x3c8070[_0x5cea('0x40')],'value':_0x3c8070[_0x5cea('0x3f')][_0x5cea('0x37')]()});}else if(_0x3c8070[_0x5cea('0x43')]===_0x5cea('0x44')&&_0x3c8070[_0x5cea('0x45')]&&_0x3c8070[_0x5cea('0x40')]&&_0x3c8070[_0x5cea('0x41')]){_0x5bf0f9[_0x3c8070[_0x5cea('0x45')]]&&_0x2d4caf[_0x5cea('0x46')][_0x5cea('0x42')]({'id':_0x3c8070[_0x5cea('0x40')],'value':_0x5bf0f9[_0x3c8070[_0x5cea('0x45')]]['toString']()});}else if(_0x3c8070[_0x5cea('0x43')]==='customVariable'&&_0x3c8070['Variable']&&_0x3c8070[_0x5cea('0x47')]['name']&&_0x3c8070[_0x5cea('0x40')]&&_0x3c8070[_0x5cea('0x41')]){_0x5bf0f9[_0x3c8070[_0x5cea('0x47')]['name'][_0x5cea('0x3e')]()]&&_0x2d4caf[_0x5cea('0x46')][_0x5cea('0x42')]({'id':_0x3c8070[_0x5cea('0x40')],'value':_0x5bf0f9[_0x3c8070[_0x5cea('0x47')][_0x5cea('0x13')][_0x5cea('0x3e')]()]['toString']()});}});}return _0x2d4caf;}exports['queue']=function(_0x57fb09,_0x5d8ae2,_0x2e62f3,_0x1d995b,_0x48ede3,_0x4a79e9){var _0x1c5dec,_0x52c74e;_0x4a79e9['remoteUri']=intUtil[_0x5cea('0x48')](_0x4a79e9[_0x5cea('0x1e')]);_0x4a79e9[_0x5cea('0x49')]=intUtil['stripTrailingSlash'](_0x4a79e9[_0x5cea('0x49')]);if(_0x48ede3&&_0x48ede3[_0x5cea('0x4a')]){logger[_0x5cea('0xc')]('[QUEUE]','Recording\x20is\x20enabled!');_0x5d8ae2[_0x5cea('0x4b')]=util[_0x5cea('0xe')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x4a79e9[_0x5cea('0x49')],_0x5d8ae2['uniqueid'],md5(_0x5d8ae2['uniqueid']));}else{_0x5d8ae2[_0x5cea('0x4b')]='';}headers[_0x5cea('0x4c')]=getAuth(_0x4a79e9);return getUser(_0x4a79e9,_0x1d995b[_0x5cea('0x4d')])[_0x5cea('0x18')](function(_0x13d58b){_0x1c5dec=_0x13d58b;logger[_0x5cea('0xc')](_0x5cea('0x4e'),_0x1c5dec['id']);return getEndUser(_0x4a79e9,_0x5d8ae2[_0x5cea('0x4f')],_0x5d8ae2['calleridnum']);})[_0x5cea('0x18')](function(_0x13c98f){_0x52c74e=_0x13c98f;logger[_0x5cea('0xc')](_0x5cea('0x50'),_0x52c74e['id']);return getTicket(_0x4a79e9,_0x1c5dec,_0x52c74e,_0x2e62f3,_0x5d8ae2);})['then'](function(_0x1ca9b0){if(_0x1ca9b0){logger[_0x5cea('0xc')](_0x5cea('0x51'),_0x1ca9b0['id']);switch(_0x4a79e9[_0x5cea('0x43')]){case'integrationTab':logger['info'](_0x5cea('0x52'),_0x5cea('0x53'));return request({'uri':util[_0x5cea('0xe')](_0x5cea('0x54'),_0x4a79e9[_0x5cea('0x1e')],_0x1c5dec['id'],_0x1ca9b0['id']),'method':_0x5cea('0x10')});case'newTab':logger['info'](_0x5cea('0x52'),_0x5cea('0x55'));emit(util[_0x5cea('0xe')](_0x5cea('0x56'),_0x1d995b[_0x5cea('0x13')]),_0x5cea('0x57'),{'uri':util[_0x5cea('0xe')]('%s/agent/tickets/%s',_0x4a79e9[_0x5cea('0x1e')],_0x1ca9b0['id'])});break;default:logger[_0x5cea('0x58')]('[QUEUE]','Zendesk\x20account\x20type\x20not\x20recognized');}}})[_0x5cea('0x59')](function(_0x192838){logger['error']('[QUEUE]\x20Error\x20running\x20Zendesk\x20integration',util[_0x5cea('0x5a')](_0x192838,{'showHidden':!![],'depth':null}));});};exports[_0x5cea('0x5b')]=function(_0x5e79f0,_0x29d0f1,_0x3786c3,_0x1e0fd1,_0x7e25fd,_0x13c0cf,_0x207d9a){var _0x4c1bda,_0x5e9531;_0x13c0cf[_0x5cea('0x1e')]=intUtil[_0x5cea('0x48')](_0x13c0cf[_0x5cea('0x1e')]);_0x13c0cf[_0x5cea('0x49')]=intUtil[_0x5cea('0x48')](_0x13c0cf['serverUrl']);if(_0x207d9a&&_0x207d9a[_0x5cea('0x5c')]&&_0x207d9a[_0x5cea('0x5c')]!==_0x5cea('0x5d')){logger[_0x5cea('0xc')](_0x5cea('0x5e'),_0x5cea('0x5f'));_0x29d0f1['recordingURL']=util['format'](_0x5cea('0x60'),_0x13c0cf['serverUrl'],_0x29d0f1[_0x5cea('0x61')],md5(_0x29d0f1[_0x5cea('0x61')]));}headers['Authorization']=getAuth(_0x13c0cf);return getUser(_0x13c0cf,_0x1e0fd1['email'])[_0x5cea('0x18')](function(_0x56d9cb){_0x4c1bda=_0x56d9cb;logger[_0x5cea('0xc')](_0x5cea('0x4e'),_0x4c1bda['id']);return getEndUser(_0x13c0cf,_0x29d0f1['destcalleridname'],_0x29d0f1[_0x5cea('0x62')]);})[_0x5cea('0x18')](function(_0x514994){_0x5e9531=_0x514994;logger[_0x5cea('0xc')](_0x5cea('0x50'),_0x5e9531['id']);return getTicket(_0x13c0cf,_0x4c1bda,_0x5e9531,_0x3786c3,_0x29d0f1);})[_0x5cea('0x18')](function(_0x321e15){if(_0x321e15){logger[_0x5cea('0xc')](_0x5cea('0x51'),_0x321e15['id']);switch(_0x13c0cf[_0x5cea('0x43')]){case _0x5cea('0x63'):logger[_0x5cea('0xc')](_0x5cea('0x5e'),_0x5cea('0x53'));return request({'uri':util['format'](_0x5cea('0x54'),_0x13c0cf[_0x5cea('0x1e')],_0x4c1bda['id'],_0x321e15['id']),'method':'POST'});case _0x5cea('0x64'):logger[_0x5cea('0xc')](_0x5cea('0x5e'),'Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...');emit(util[_0x5cea('0xe')](_0x5cea('0x56'),_0x1e0fd1[_0x5cea('0x13')]),_0x5cea('0x57'),{'uri':util[_0x5cea('0xe')](_0x5cea('0x65'),_0x13c0cf[_0x5cea('0x1e')],_0x321e15['id'])});break;default:logger['error']('[OUTBOUND]','Zendesk\x20account\x20type\x20not\x20recognized');}}})[_0x5cea('0x59')](function(_0x31f2b2){logger['error'](_0x5cea('0x66'),util[_0x5cea('0x5a')](_0x31f2b2,{'showHidden':!![],'depth':null}));});};exports['abandoned']=function(_0x4fad4f,_0x3be9d3,_0x40336e,_0x2c3a1f,_0x5ce3ff,_0x2f96c0){var _0xc1ec23,_0x20b056;_0x2f96c0[_0x5cea('0x1e')]=intUtil[_0x5cea('0x48')](_0x2f96c0[_0x5cea('0x1e')]);_0x2f96c0[_0x5cea('0x49')]=intUtil[_0x5cea('0x48')](_0x2f96c0[_0x5cea('0x49')]);if(_0x5ce3ff&&_0x5ce3ff['monitor_format']){logger['info'](_0x5cea('0x67'),_0x5cea('0x5f'));_0x3be9d3[_0x5cea('0x4b')]=util[_0x5cea('0xe')](_0x5cea('0x60'),_0x2f96c0[_0x5cea('0x49')],_0x3be9d3[_0x5cea('0x61')],md5(_0x3be9d3['uniqueid']));}else{_0x3be9d3['recordingURL']='';}headers[_0x5cea('0x4c')]=getAuth(_0x2f96c0);return getUser(_0x2f96c0)[_0x5cea('0x18')](function(_0xe9dd60){_0xc1ec23=_0xe9dd60;logger['info'](_0x5cea('0x4e'),_0xc1ec23['id']);return getEndUser(_0x2f96c0,_0x3be9d3['calleridname'],_0x3be9d3[_0x5cea('0x68')]);})[_0x5cea('0x18')](function(_0x268237){_0x20b056=_0x268237;logger[_0x5cea('0xc')](_0x5cea('0x50'),_0x20b056['id']);return getTicket(_0x2f96c0,_0xc1ec23,_0x20b056,_0x40336e,_0x3be9d3);})[_0x5cea('0x18')](function(_0x6b71c2){if(_0x6b71c2){logger[_0x5cea('0xc')](_0x5cea('0x51'),_0x6b71c2['id']);}})[_0x5cea('0x59')](function(_0x21f431){logger[_0x5cea('0x58')]('[ABANDONED]\x20Error\x20running\x20Zendesk\x20integration',util['inspect'](_0x21f431,{'showHidden':!![],'depth':null}));});}; \ No newline at end of file +var _0x57cf=['end-user','first','Enduser\x20found!','%s/users.json','Caller\x20-\x20%s','user','password','%s:%s','username','authType','%s/token:%s','toString','debug','[HTTP]','stringify','GET','map','forEach','string','customField','nameField','toLowerCase','custom_fields','push','idField','content','type','variable','variableName','customVariable','Variable','stripTrailingSlash','serverUrl','monitor_format','Recording\x20is\x20enabled!','recordingURL','uniqueid','Authorization','email','The\x20User\x20ID\x20is:','calleridname','calleridnum','The\x20Enduser\x20ID\x20is:','The\x20Ticket\x20ID\x20is:','integrationTab','Displaying\x20ticket\x20to\x20agent...','%s/channels/voice/agents/%d/tickets/%d/display.json','newTab','[QUEUE]','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','%s/agent/tickets/%s','error','Zendesk\x20account\x20type\x20not\x20recognized','catch','outbound','recordingFormat','none','[OUTBOUND]','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','destcalleridname','user:%s','trigger:browser:url','[OUTBOUND]\x20Error\x20running\x20Zendesk\x20integration','inspect','abandoned','[ABANDONED]','[ABANDONED]\x20Error\x20running\x20Zendesk\x20integration','lodash','request-promise','md5','util','ioredis','./util','../../../../config/environment','../../../../config/logger','zendesk','redis','socket.io-emitter','emit','application/json','Creating\x20new\x20ticket...','format','%s/tickets.json','POST','Tags','name','Subjects','Descriptions','Fields','then','info','Ticket\x20created!','ticket','validateEmail','Getting\x20agent\x20with\x20email','remoteUri','type:user\x20role:agent\x20email:%s','Agent\x20found!','find','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','%s/users/me.json','Admin\x20account\x20selected.','Searching\x20enduser\x20with\x20phone','%s/search.json','type:user\x20role:end-user\x20phone:%s','results','length','filter'];(function(_0x5cbe67,_0x3cb5d4){var _0x5c4cf6=function(_0x2f0150){while(--_0x2f0150){_0x5cbe67['push'](_0x5cbe67['shift']());}};_0x5c4cf6(++_0x3cb5d4);}(_0x57cf,0x11b));var _0xf57c=function(_0xf6aec0,_0x51ffd6){_0xf6aec0=_0xf6aec0-0x0;var _0x59a51b=_0x57cf[_0xf6aec0];return _0x59a51b;};'use strict';var _=require(_0xf57c('0x0'));var rp=require(_0xf57c('0x1'));var md5=require(_0xf57c('0x2'));var util=require(_0xf57c('0x3'));var Redis=require(_0xf57c('0x4'));var intUtil=require(_0xf57c('0x5'));var config=require(_0xf57c('0x6'));var logger=require(_0xf57c('0x7'))(_0xf57c('0x8'));config[_0xf57c('0x9')]=_['defaults'](config[_0xf57c('0x9')],{'host':'localhost','port':0x18eb});var io=require(_0xf57c('0xa'))(new Redis(config['redis']));function emit(_0x53ed52,_0x21a69d,_0x4867f6){io['to'](_0x53ed52)[_0xf57c('0xb')](_0x21a69d,_0x4867f6);}var headers={'Content-Type':_0xf57c('0xc'),'Accept':'application/json'};function getTicket(_0x5b5314,_0x1accbd,_0x3256d4,_0x259a60,_0x2a19ef){logger['info'](_0xf57c('0xd'));return request({'uri':util[_0xf57c('0xe')](_0xf57c('0xf'),_0x5b5314['remoteUri']),'method':_0xf57c('0x10'),'body':{'ticket':_['merge']({'requester_id':_0x3256d4['id'],'submitter_id':_0x1accbd?_0x1accbd['id']:undefined,'assignee_id':_0x1accbd?_0x1accbd['id']:undefined,'tags':getTags(_0x259a60[_0xf57c('0x11')],_0xf57c('0x12')),'subject':intUtil['getString'](_0x259a60[_0xf57c('0x13')],_0x2a19ef,'\x20'),'description':intUtil['getString'](_0x259a60[_0xf57c('0x14')],_0x2a19ef,'\x0a'),'comment':{'public':![],'body':intUtil['getString'](_0x259a60[_0xf57c('0x14')],_0x2a19ef,'\x0a')}},getCustomFields(_0x259a60[_0xf57c('0x15')],_0x2a19ef))}})[_0xf57c('0x16')](function(_0x7dd39b){logger[_0xf57c('0x17')](_0xf57c('0x18'));return _0x7dd39b[_0xf57c('0x19')];});}function getUser(_0x3163eb,_0x517e09){if(intUtil[_0xf57c('0x1a')](_0x517e09)){logger['info'](_0xf57c('0x1b'),_0x517e09);return request({'uri':util[_0xf57c('0xe')]('%s/search.json',_0x3163eb[_0xf57c('0x1c')]),'qs':{'query':util[_0xf57c('0xe')](_0xf57c('0x1d'),_0x517e09)}})[_0xf57c('0x16')](function(_0x9c27f0){if(_0x9c27f0['count']){logger[_0xf57c('0x17')](_0xf57c('0x1e'));return _[_0xf57c('0x1f')](_0x9c27f0['results'],{'email':_0x517e09,'role':'agent'});}else{logger[_0xf57c('0x17')](_0xf57c('0x20'));return request({'uri':util[_0xf57c('0xe')](_0xf57c('0x21'),_0x3163eb[_0xf57c('0x1c')])})[_0xf57c('0x16')](function(_0xea8ee8){logger[_0xf57c('0x17')](_0xf57c('0x22'));return _0xea8ee8['user'];});}});}else{logger[_0xf57c('0x17')](_0xf57c('0x20'));return request({'uri':util['format']('%s/users/me.json',_0x3163eb[_0xf57c('0x1c')])})['then'](function(_0x1741cd){logger[_0xf57c('0x17')](_0xf57c('0x22'));return _0x1741cd['user'];});}}function getEndUser(_0xc70f3e,_0x195ae5,_0x5e3a89){logger[_0xf57c('0x17')](_0xf57c('0x23'),_0x5e3a89);return request({'uri':util[_0xf57c('0xe')](_0xf57c('0x24'),_0xc70f3e[_0xf57c('0x1c')]),'qs':{'query':util[_0xf57c('0xe')](_0xf57c('0x25'),_0x5e3a89)}})[_0xf57c('0x16')](function(_0x1f1b40){var _0x5d4a45;if(_0x1f1b40[_0xf57c('0x26')][_0xf57c('0x27')]){_0x1f1b40['results']=_[_0xf57c('0x28')](_0x1f1b40[_0xf57c('0x26')],{'suspended':![],'role':_0xf57c('0x29')});if(_0x1f1b40[_0xf57c('0x26')][_0xf57c('0x27')]){_0x5d4a45=_[_0xf57c('0x2a')](_0x1f1b40[_0xf57c('0x26')]);}}if(_0x5d4a45){logger[_0xf57c('0x17')](_0xf57c('0x2b'));return _0x5d4a45;}else{logger[_0xf57c('0x17')]('Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!');return request({'uri':util[_0xf57c('0xe')](_0xf57c('0x2c'),_0xc70f3e[_0xf57c('0x1c')]),'method':'POST','body':{'user':{'role':'end-user','name':util['format'](_0xf57c('0x2d'),_0x195ae5||_0x5e3a89),'phone':_0x5e3a89}}})[_0xf57c('0x16')](function(_0x3d85a8){logger[_0xf57c('0x17')]('Enduser\x20created.');return _0x3d85a8[_0xf57c('0x2e')];});}});}function getAuth(_0xccff8){var _0x3bd004;if(_0xccff8['authType']===_0xf57c('0x2f')){_0x3bd004=util[_0xf57c('0xe')](_0xf57c('0x30'),_0xccff8[_0xf57c('0x31')],_0xccff8[_0xf57c('0x2f')]);}else if(_0xccff8[_0xf57c('0x32')]==='token'){_0x3bd004=util[_0xf57c('0xe')](_0xf57c('0x33'),_0xccff8['username'],_0xccff8['token']);}return util[_0xf57c('0xe')]('Basic\x20%s',new Buffer(_0x3bd004)[_0xf57c('0x34')]('base64'));}function request(_0x9611ac){logger[_0xf57c('0x35')](_0xf57c('0x36'),JSON[_0xf57c('0x37')](_0x9611ac));return rp(_['defaults'](_0x9611ac,{'method':_0xf57c('0x38'),'headers':headers,'json':!![]}));}function getTags(_0x4beee3,_0x197b30){var _0x39a55d=[];if(_0x4beee3&&_0x4beee3[_0xf57c('0x27')]>0x0){_0x39a55d=_[_0xf57c('0x39')](_0x4beee3,_0x197b30);}return _0x39a55d;}function getCustomFields(_0x25dc73,_0x178433){var _0x58eb22=[];var _0x54e9be={'custom_fields':[]};if(_0x25dc73[_0xf57c('0x27')]>0x0){_[_0xf57c('0x3a')](_0x25dc73,function(_0xc17c60){if(_0xc17c60['type']===_0xf57c('0x3b')&&_0xc17c60['nameField']&&!_0xc17c60[_0xf57c('0x3c')]){_0x54e9be[_0xc17c60[_0xf57c('0x3d')][_0xf57c('0x3e')]()]=_0xc17c60['content'][_0xf57c('0x34')]();}else if(_0xc17c60['type']===_0xf57c('0x3b')&&_0xc17c60['idField']&&_0xc17c60[_0xf57c('0x3c')]){_0x54e9be[_0xf57c('0x3f')][_0xf57c('0x40')]({'id':_0xc17c60[_0xf57c('0x41')],'value':_0xc17c60[_0xf57c('0x42')]['toString']()});}else if(_0xc17c60[_0xf57c('0x43')]===_0xf57c('0x44')&&_0xc17c60[_0xf57c('0x45')]&&_0xc17c60[_0xf57c('0x41')]&&_0xc17c60[_0xf57c('0x3c')]){_0x178433[_0xc17c60[_0xf57c('0x45')]]&&_0x54e9be[_0xf57c('0x3f')][_0xf57c('0x40')]({'id':_0xc17c60[_0xf57c('0x41')],'value':_0x178433[_0xc17c60['variableName']][_0xf57c('0x34')]()});}else if(_0xc17c60[_0xf57c('0x43')]===_0xf57c('0x46')&&_0xc17c60['Variable']&&_0xc17c60[_0xf57c('0x47')][_0xf57c('0x12')]&&_0xc17c60[_0xf57c('0x41')]&&_0xc17c60[_0xf57c('0x3c')]){_0x178433[_0xc17c60[_0xf57c('0x47')][_0xf57c('0x12')][_0xf57c('0x3e')]()]&&_0x54e9be[_0xf57c('0x3f')][_0xf57c('0x40')]({'id':_0xc17c60['idField'],'value':_0x178433[_0xc17c60[_0xf57c('0x47')][_0xf57c('0x12')][_0xf57c('0x3e')]()][_0xf57c('0x34')]()});}});}return _0x54e9be;}exports['queue']=function(_0x5c2b8f,_0x10976f,_0x89b280,_0x2aed6b,_0x9e0ec7,_0x183d0a){var _0xe75879,_0x582fd3;_0x183d0a['remoteUri']=intUtil[_0xf57c('0x48')](_0x183d0a['remoteUri']);_0x183d0a['serverUrl']=intUtil[_0xf57c('0x48')](_0x183d0a[_0xf57c('0x49')]);if(_0x9e0ec7&&_0x9e0ec7[_0xf57c('0x4a')]){logger[_0xf57c('0x17')]('[QUEUE]',_0xf57c('0x4b'));_0x10976f[_0xf57c('0x4c')]=util[_0xf57c('0xe')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x183d0a['serverUrl'],_0x10976f[_0xf57c('0x4d')],md5(_0x10976f[_0xf57c('0x4d')]));}else{_0x10976f[_0xf57c('0x4c')]='';}headers[_0xf57c('0x4e')]=getAuth(_0x183d0a);return getUser(_0x183d0a,_0x2aed6b[_0xf57c('0x4f')])[_0xf57c('0x16')](function(_0x4d7e4a){_0xe75879=_0x4d7e4a;logger['info'](_0xf57c('0x50'),_0xe75879['id']);return getEndUser(_0x183d0a,_0x10976f[_0xf57c('0x51')],_0x10976f[_0xf57c('0x52')]);})[_0xf57c('0x16')](function(_0xbdde3b){_0x582fd3=_0xbdde3b;logger['info'](_0xf57c('0x53'),_0x582fd3['id']);return getTicket(_0x183d0a,_0xe75879,_0x582fd3,_0x89b280,_0x10976f);})['then'](function(_0xb86bcd){if(_0xb86bcd){logger[_0xf57c('0x17')](_0xf57c('0x54'),_0xb86bcd['id']);switch(_0x183d0a[_0xf57c('0x43')]){case _0xf57c('0x55'):logger[_0xf57c('0x17')]('[QUEUE]',_0xf57c('0x56'));return request({'uri':util['format'](_0xf57c('0x57'),_0x183d0a[_0xf57c('0x1c')],_0xe75879['id'],_0xb86bcd['id']),'method':'POST'});case _0xf57c('0x58'):logger[_0xf57c('0x17')](_0xf57c('0x59'),_0xf57c('0x5a'));emit(util[_0xf57c('0xe')]('user:%s',_0x2aed6b[_0xf57c('0x12')]),'trigger:browser:url',{'uri':util['format'](_0xf57c('0x5b'),_0x183d0a[_0xf57c('0x1c')],_0xb86bcd['id'])});break;default:logger[_0xf57c('0x5c')]('[QUEUE]',_0xf57c('0x5d'));}}})[_0xf57c('0x5e')](function(_0x19f6bf){logger[_0xf57c('0x5c')]('[QUEUE]\x20Error\x20running\x20Zendesk\x20integration',util['inspect'](_0x19f6bf,{'showHidden':!![],'depth':null}));});};exports[_0xf57c('0x5f')]=function(_0x5d3f8b,_0x162173,_0x413331,_0x1862f3,_0x47fc64,_0x48cfa0,_0x106dea){var _0x10b680,_0x13e25d;_0x48cfa0[_0xf57c('0x1c')]=intUtil[_0xf57c('0x48')](_0x48cfa0[_0xf57c('0x1c')]);_0x48cfa0[_0xf57c('0x49')]=intUtil[_0xf57c('0x48')](_0x48cfa0[_0xf57c('0x49')]);if(_0x106dea&&_0x106dea[_0xf57c('0x60')]&&_0x106dea[_0xf57c('0x60')]!==_0xf57c('0x61')){logger[_0xf57c('0x17')](_0xf57c('0x62'),_0xf57c('0x4b'));_0x162173[_0xf57c('0x4c')]=util[_0xf57c('0xe')](_0xf57c('0x63'),_0x48cfa0['serverUrl'],_0x162173['uniqueid'],md5(_0x162173[_0xf57c('0x4d')]));}headers['Authorization']=getAuth(_0x48cfa0);return getUser(_0x48cfa0,_0x1862f3[_0xf57c('0x4f')])[_0xf57c('0x16')](function(_0x3410e8){_0x10b680=_0x3410e8;logger[_0xf57c('0x17')]('The\x20User\x20ID\x20is:',_0x10b680['id']);return getEndUser(_0x48cfa0,_0x162173[_0xf57c('0x64')],_0x162173['destcalleridnum']);})[_0xf57c('0x16')](function(_0x1a9928){_0x13e25d=_0x1a9928;logger[_0xf57c('0x17')](_0xf57c('0x53'),_0x13e25d['id']);return getTicket(_0x48cfa0,_0x10b680,_0x13e25d,_0x413331,_0x162173);})[_0xf57c('0x16')](function(_0x91ef5d){if(_0x91ef5d){logger[_0xf57c('0x17')]('The\x20Ticket\x20ID\x20is:',_0x91ef5d['id']);switch(_0x48cfa0[_0xf57c('0x43')]){case _0xf57c('0x55'):logger[_0xf57c('0x17')](_0xf57c('0x62'),'Displaying\x20ticket\x20to\x20agent...');return request({'uri':util['format'](_0xf57c('0x57'),_0x48cfa0[_0xf57c('0x1c')],_0x10b680['id'],_0x91ef5d['id']),'method':_0xf57c('0x10')});case _0xf57c('0x58'):logger[_0xf57c('0x17')](_0xf57c('0x62'),_0xf57c('0x5a'));emit(util[_0xf57c('0xe')](_0xf57c('0x65'),_0x1862f3[_0xf57c('0x12')]),_0xf57c('0x66'),{'uri':util[_0xf57c('0xe')](_0xf57c('0x5b'),_0x48cfa0[_0xf57c('0x1c')],_0x91ef5d['id'])});break;default:logger[_0xf57c('0x5c')](_0xf57c('0x62'),_0xf57c('0x5d'));}}})[_0xf57c('0x5e')](function(_0xa525b9){logger[_0xf57c('0x5c')](_0xf57c('0x67'),util[_0xf57c('0x68')](_0xa525b9,{'showHidden':!![],'depth':null}));});};exports[_0xf57c('0x69')]=function(_0x1631f3,_0x34d73a,_0x32b79d,_0x24c11e,_0x5f3a5d,_0x1dc29e){var _0x5244f7,_0x12a045;_0x1dc29e[_0xf57c('0x1c')]=intUtil[_0xf57c('0x48')](_0x1dc29e[_0xf57c('0x1c')]);_0x1dc29e['serverUrl']=intUtil['stripTrailingSlash'](_0x1dc29e[_0xf57c('0x49')]);if(_0x5f3a5d&&_0x5f3a5d[_0xf57c('0x4a')]){logger['info'](_0xf57c('0x6a'),'Recording\x20is\x20enabled!');_0x34d73a[_0xf57c('0x4c')]=util['format']('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x1dc29e[_0xf57c('0x49')],_0x34d73a[_0xf57c('0x4d')],md5(_0x34d73a[_0xf57c('0x4d')]));}else{_0x34d73a[_0xf57c('0x4c')]='';}headers[_0xf57c('0x4e')]=getAuth(_0x1dc29e);return getUser(_0x1dc29e)['then'](function(_0x574fbe){_0x5244f7=_0x574fbe;logger[_0xf57c('0x17')]('The\x20User\x20ID\x20is:',_0x5244f7['id']);return getEndUser(_0x1dc29e,_0x34d73a[_0xf57c('0x51')],_0x34d73a['calleridnum']);})[_0xf57c('0x16')](function(_0x285447){_0x12a045=_0x285447;logger[_0xf57c('0x17')]('The\x20Enduser\x20ID\x20is:',_0x12a045['id']);return getTicket(_0x1dc29e,_0x5244f7,_0x12a045,_0x32b79d,_0x34d73a);})[_0xf57c('0x16')](function(_0x3f6b42){if(_0x3f6b42){logger['info'](_0xf57c('0x54'),_0x3f6b42['id']);}})[_0xf57c('0x5e')](function(_0x5af08d){logger[_0xf57c('0x5c')](_0xf57c('0x6b'),util[_0xf57c('0x68')](_0x5af08d,{'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 86126f0..320be25 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 _0x677b=['isNil','access_token','expires_in','zone','https://accounts.zoho.com','https://accounts.zoho.com.au','https://accounts.zoho.in','https://accounts.zoho.eu','POST','refreshToken','clientId','refresh_token','then','add','seconds','error','Failing\x20creating\x20the\x20access_token','info','Search\x20user','format','https://www.zohoapis.%s/crm/v2/users','ActiveUsers','Zoho-oauthtoken\x20','users','isArrayLikeObject','findIndex','Agent\x20found!','Using\x20the\x20admin\x20account!','profile','Administrator','user','Unable\x20to\x20retrieve\x20zoho\x20account\x20users:\x20','The\x20failing\x20result\x20is','catch','data','enduserType','/crm/v2/','moduleCreate','role','first_name','last_name','code','SUCCESS','details','startCase','Error:\x20','log','CREATE\x20ERROR','contact_lead','uri','https://www.zohoapis.','Leads','nothing','contact','/crm/v2/Contacts/search?criteria=((Phone:equals:','lead','/crm/v2/Leads/search?criteria=((Phone:equals:','Creating\x20new\x20call...','Owner','administrator','Subject','Subjects','Description','Descriptions','Contacts','Who_Id','Full_Name','First_Name','Last_Name','What_Id','talktime','Call_Duration','utc','endtime','diff','YYYY-MM-DDTHH:mm:ss','mm:ss','lastevent','called','Call_Result','Called','complete','connect','Answered','rejected','Rejected','Abandoned','agentcalledAt','Call_Type','Inbound','merge','Fields','/crm/v2/Calls','Call\x20created!','err','stack','queue','host','serverUrl','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','/api/voice/recordings/','uniqueid','/downloads?type=uniqueid&token=','calleridname','calleridnum','The\x20Call\x20ID\x20is:','Displaying\x20call\x20to\x20agent\x20in\x20a\x20new\x20tab...','trigger:browser:url','https://crm.','/crm/EntityInfo.do?module=Calls&id=','stripTrailingSlash','recordingFormat','[OUTBOUND]','com','email','The\x20User\x20ID\x20is:','destcalleridname','destcalleridnum','Outbound','user:%s','abandoned','[ABANDONED]','zoho.eu','lodash','request-promise','md5','util','./util','moment','bluebird','../../../../config/environment','../../../../config/logger','zoho','redis','defaults','socket.io-emitter','debug','stringify','length','forEach','string','idField','toString','variable','variableName','customVariable','Variable','name','toLowerCase','indexOf','split'];(function(_0x49f856,_0x26dc54){var _0x1bacb6=function(_0xd115b3){while(--_0xd115b3){_0x49f856['push'](_0x49f856['shift']());}};_0x1bacb6(++_0x26dc54);}(_0x677b,0x7e));var _0xb677=function(_0x236d24,_0x29e80a){_0x236d24=_0x236d24-0x0;var _0x1574cf=_0x677b[_0x236d24];return _0x1574cf;};'use strict';var _=require(_0xb677('0x0'));var rp=require(_0xb677('0x1'));var md5=require(_0xb677('0x2'));var util=require(_0xb677('0x3'));var intUtil=require(_0xb677('0x4'));var moment=require(_0xb677('0x5'));var Redis=require('ioredis');var BPromise=require(_0xb677('0x6'));var config=require(_0xb677('0x7'));var logger=require(_0xb677('0x8'))(_0xb677('0x9'));config[_0xb677('0xa')]=_[_0xb677('0xb')](config[_0xb677('0xa')],{'host':'localhost','port':0x18eb});var io=require(_0xb677('0xc'))(new Redis(config[_0xb677('0xa')]));function emit(_0x5456c3,_0x323b87,_0x1f0f93){io['to'](_0x5456c3)['emit'](_0x323b87,_0x1f0f93);}function request(_0x4dff51){logger[_0xb677('0xd')]('[HTTP]',JSON[_0xb677('0xe')](_0x4dff51));return rp(_0x4dff51);}function getCustomFields(_0x452967,_0x256ceb){var _0x35459d={};if(_0x452967[_0xb677('0xf')]>0x0){_[_0xb677('0x10')](_0x452967,function(_0x16bbe5){if(_0x16bbe5['type']===_0xb677('0x11')&&_0x16bbe5[_0xb677('0x12')]){_0x35459d[_0x16bbe5['idField']]=_0x16bbe5['content'][_0xb677('0x13')]();}else if(_0x16bbe5['type']===_0xb677('0x14')&&_0x16bbe5[_0xb677('0x15')]&&_0x16bbe5['idField']&&_0x256ceb[_0x16bbe5['variableName']]){_0x35459d[_0x16bbe5[_0xb677('0x12')]]=_0x256ceb[_0x16bbe5['variableName']]['toString']();}else if(_0x16bbe5['type']===_0xb677('0x16')&&_0x16bbe5[_0xb677('0x17')]&&_0x16bbe5[_0xb677('0x17')][_0xb677('0x18')]&&_0x16bbe5[_0xb677('0x12')]&&_0x256ceb[_0x16bbe5[_0xb677('0x17')][_0xb677('0x18')][_0xb677('0x19')]()]){_0x35459d[_0x16bbe5[_0xb677('0x12')]]=_0x256ceb[_0x16bbe5[_0xb677('0x17')][_0xb677('0x18')][_0xb677('0x19')]()][_0xb677('0x13')]();}});}return _0x35459d;}function getName(_0x28d1ad){if(_0x28d1ad[_0xb677('0x1a')]('\x20')>0x0){var _0x1de30d=_0x28d1ad[_0xb677('0x1b')](/ (.+)/);if(_0x1de30d[0x1]){return _0x1de30d;}}return[_0x28d1ad,_0x28d1ad];}var accountsTokens={};function getAccessToken(_0x2d8c4a){return new Promise(function(_0x4f8eda,_0x4a1ac5){if(!_[_0xb677('0x1c')](accountsTokens[_0x2d8c4a['id']])&&!_['isNil'](accountsTokens[_0x2d8c4a['id']][_0xb677('0x1d')])){if(moment()['isBefore'](accountsTokens[_0x2d8c4a['id']][_0xb677('0x1e')])){_0x4f8eda(accountsTokens[_0x2d8c4a['id']][_0xb677('0x1d')]);}}var _0x549e16;switch(_0x2d8c4a[_0xb677('0x1f')]){case'US':_0x549e16=_0xb677('0x20');break;case'AU':_0x549e16=_0xb677('0x21');break;case'EU':_0x549e16='https://accounts.zoho.eu';break;case'IN':_0x549e16=_0xb677('0x22');break;case'CN':_0x549e16='https://accounts.zoho.com.cn';break;default:_0x549e16=_0xb677('0x23');break;}var _0x73b4bb={'method':_0xb677('0x24'),'uri':_0x549e16+'/oauth/v2/token','qs':{'refresh_token':_0x2d8c4a[_0xb677('0x25')],'client_id':_0x2d8c4a[_0xb677('0x26')],'client_secret':_0x2d8c4a['clientSecret'],'grant_type':_0xb677('0x27')},'json':!![]};return rp(_0x73b4bb)[_0xb677('0x28')](function(_0xf01f18){accountsTokens[_0x2d8c4a['id']]={'access_token':_0xf01f18[_0xb677('0x1d')],'expires_in':moment()[_0xb677('0x29')](_0xf01f18[_0xb677('0x1e')],_0xb677('0x2a'))};_0x4f8eda(_0xf01f18[_0xb677('0x1d')]);})['catch'](function(_0x70e468){logger[_0xb677('0x2b')](_0xb677('0x2c'),_0x70e468['stack']);_0x4a1ac5(_0x70e468);});});}function getUser(_0x381c41,_0x29bd97,_0x51312d,_0x254e21){logger[_0xb677('0x2d')](_0xb677('0x2e'));return request({'method':'GET','uri':util[_0xb677('0x2f')](_0xb677('0x30'),_0x29bd97),'qs':{'type':_0xb677('0x31')},'headers':{'Authorization':_0xb677('0x32')+_0x381c41},'json':!![]})[_0xb677('0x28')](function(_0x59c9b0){if(_0x59c9b0[_0xb677('0x33')]){var _0x18c3ae=-0x1;if(_[_0xb677('0x34')](_0x59c9b0[_0xb677('0x33')])){if(!_[_0xb677('0x1c')](_0x254e21)){_0x18c3ae=_[_0xb677('0x35')](_0x59c9b0[_0xb677('0x33')],function(_0x1be45d){return _0x1be45d['email']===_0x254e21;});}if(_0x18c3ae>=0x0){logger[_0xb677('0x2d')](_0xb677('0x36'));}else{logger['info'](_0xb677('0x37'));_0x18c3ae=_[_0xb677('0x35')](_0x59c9b0[_0xb677('0x33')],function(_0x255415){return _0x255415[_0xb677('0x38')][_0xb677('0x18')]===_0xb677('0x39');});}return _0x59c9b0[_0xb677('0x33')][_0x18c3ae];}else{if(_0x59c9b0[_0xb677('0x3a')]['profile'][_0xb677('0x18')]===_0xb677('0x39')){logger[_0xb677('0x2d')](_0xb677('0x37'));user=_0x59c9b0[_0xb677('0x3a')];return user;}else{logger[_0xb677('0x2b')]('The\x20failing\x20result\x20is',JSON[_0xb677('0xe')](_0x59c9b0));throw new Error(_0xb677('0x3b')+JSON[_0xb677('0xe')](_0x59c9b0));}}}else{logger[_0xb677('0x2b')](_0xb677('0x3c'),JSON[_0xb677('0xe')](_0x59c9b0));throw new Error(_0xb677('0x3b')+JSON[_0xb677('0xe')](_0x59c9b0));}})[_0xb677('0x3d')](function(_0x98d8fc){console['error'](_0x98d8fc);});}function getZohoUser(_0x5a3f07,_0x40d7d4){return new BPromise(function(_0x59a503,_0x41ef4f){request(_0x5a3f07)['then'](function(_0x58f1a0){var _0xf2da12=null;if(_0x58f1a0){_0xf2da12=_0x58f1a0[_0xb677('0x3e')][0x0];_0xf2da12[_0xb677('0x3f')]=_0x40d7d4;}_0x59a503(_0xf2da12);})[_0xb677('0x3d')](function(_0x1dc9d7){_0x41ef4f(_0x1dc9d7);});});}function createEndUser(_0x5266f7,_0x43a732,_0x49d536,_0x3caf7f,_0x181d7e,_0xe18fc3){var _0x49d536=getName(_0x49d536);return request({'method':_0xb677('0x24'),'uri':'https://www.zohoapis.'+_0x43a732+_0xb677('0x40')+_['startCase'](_0xe18fc3[_0xb677('0x41')])+'s','body':{'data':[{'Last_Name':_0x49d536[0x1],'First_Name':_0x49d536[0x0],'Phone':_0x3caf7f,'Owner':{'name':!_[_0xb677('0x1c')](_0x181d7e[_0xb677('0x42')]['name'])?_0x181d7e['role'][_0xb677('0x18')]:!_[_0xb677('0x1c')](_0x181d7e[_0xb677('0x43')])?_0x181d7e[_0xb677('0x43')]+'\x20'+_0x181d7e[_0xb677('0x44')]:_0x181d7e[_0xb677('0x44')],'id':_0x181d7e['id']}}]},'headers':{'Authorization':'Zoho-oauthtoken\x20'+_0x5266f7},'json':!![]})[_0xb677('0x28')](function(_0x91f7e6){if(_0x91f7e6&&_0x91f7e6['data'][0x0][_0xb677('0x45')]===_0xb677('0x46')){var _0x3eb1a5=_0x91f7e6['data'][0x0][_0xb677('0x47')];_0x3eb1a5[_0xb677('0x3f')]=_[_0xb677('0x48')](_0xe18fc3[_0xb677('0x41')])+'s';return _0x3eb1a5;}logger[_0xb677('0x2b')](_0xb677('0x3c'),JSON[_0xb677('0xe')](data));throw new Error(_0xb677('0x49')+JSON[_0xb677('0xe')](data));})[_0xb677('0x3d')](function(_0x3a04fa){console[_0xb677('0x4a')](_0xb677('0x4b'),_0x3a04fa);});}function getEndUser(_0x4854d4,_0xa1d355,_0x154a06,_0x58d3c2,_0x4593bb,_0x110dcf,_0x4292ea){var _0x3990b6={'method':'GET','uri':'','headers':{'Authorization':'Zoho-oauthtoken\x20'+_0x4854d4},'json':!![]};switch(_0x4292ea['moduleSearch']){case _0xb677('0x4c'):_0x3990b6[_0xb677('0x4d')]='https://www.zohoapis.'+_0xa1d355+'/crm/v2/Contacts/search?criteria=((Phone:equals:'+_0x4593bb+'))';return getZohoUser(_0x3990b6,'Contacts')[_0xb677('0x28')](function(_0x8e9816){if(_0x8e9816)return _0x8e9816;_0x3990b6['uri']=_0xb677('0x4e')+_0xa1d355+'/crm/v2/Leads/search?criteria=((Phone:equals:'+_0x4593bb+'))';return getZohoUser(_0x3990b6,_0xb677('0x4f'))[_0xb677('0x28')](function(_0x33ff70){if(_0x33ff70)return _0x33ff70;if(_0x4292ea['moduleCreate']!=_0xb677('0x50')){return createEndUser(_0x4854d4,_0xa1d355,_0x58d3c2,_0x4593bb,_0x110dcf,_0x4292ea);}else{return{};}});});break;case _0xb677('0x51'):_0x3990b6[_0xb677('0x4d')]=_0xb677('0x4e')+_0xa1d355+_0xb677('0x52')+_0x4593bb+'))';return getZohoUser(_0x3990b6,'Contacts')[_0xb677('0x28')](function(_0xcf3195){if(_0xcf3195)return _0xcf3195;if(_0x4292ea[_0xb677('0x41')]!='nothing'){return createEndUser(_0x4854d4,_0xa1d355,_0x58d3c2,_0x4593bb,_0x110dcf,_0x4292ea);}else{return{};}});break;case _0xb677('0x53'):_0x3990b6[_0xb677('0x4d')]=_0xb677('0x4e')+_0xa1d355+_0xb677('0x54')+_0x4593bb+'))';return getZohoUser(_0x3990b6,_0xb677('0x4f'))[_0xb677('0x28')](function(_0x51bd28){if(_0x51bd28)return _0x51bd28;if(_0x4292ea[_0xb677('0x41')]!=_0xb677('0x50')){return createEndUser(_0x4854d4,_0xa1d355,_0x58d3c2,_0x4593bb,_0x110dcf,_0x4292ea);}else{return{};}});break;}}function getCall(_0x334144,_0x48fff3,_0xe55661,_0x5d5f53,_0x597430,_0x643f9d,_0x2ba979,_0x3f076f){logger[_0xb677('0x2d')](_0xb677('0x55'));var _0x28a476={};_0x28a476[_0xb677('0x56')]={'name':!_['isNil'](_0x5d5f53[_0xb677('0x42')][_0xb677('0x18')])&&!_[_0xb677('0x1c')](_0x5d5f53[_0xb677('0x38')][_0xb677('0x18')])&&_0x5d5f53[_0xb677('0x38')][_0xb677('0x18')]===_0xb677('0x57')?_0x5d5f53['role'][_0xb677('0x18')]:!_[_0xb677('0x1c')](_0x5d5f53[_0xb677('0x43')])?_0x5d5f53['first_name']+'\x20'+_0x5d5f53[_0xb677('0x44')]:_0x5d5f53[_0xb677('0x44')],'id':_0x5d5f53['id']};_0x28a476[_0xb677('0x58')]=intUtil['getString'](_0x643f9d[_0xb677('0x59')],_0x2ba979,'\x20');_0x28a476[_0xb677('0x5a')]=intUtil['getString'](_0x643f9d[_0xb677('0x5b')],_0x2ba979,'\x0a');if(_0x597430[_0xb677('0x3f')]===_0xb677('0x5c')){_0x28a476[_0xb677('0x5d')]={'name':!_[_0xb677('0x1c')](_0x597430['Full_Name'])?_0x597430[_0xb677('0x5e')]:!_['isNil'](_0x597430[_0xb677('0x5f')])?_0x597430[_0xb677('0x5f')]+'\x20'+_0x597430[_0xb677('0x60')]:_0x597430['Last_Name'],'id':_0x597430['id']};}if(_0x597430[_0xb677('0x3f')]===_0xb677('0x4f')){_0x28a476[_0xb677('0x61')]={'name':!_[_0xb677('0x1c')](_0x597430['Full_Name'])?_0x597430[_0xb677('0x5e')]:!_[_0xb677('0x1c')](_0x597430['First_Name'])?_0x597430[_0xb677('0x5f')]+'\x20'+_0x597430['Last_Name']:_0x597430[_0xb677('0x60')],'id':_0x597430['id']};_0x28a476['$se_module']=_[_0xb677('0x48')](_0x597430[_0xb677('0x3f')]);}if(_0x2ba979[_0xb677('0x62')]){_0x28a476[_0xb677('0x63')]=moment[_0xb677('0x64')](parseInt(_0x2ba979[_0xb677('0x62')])*0x3e8)[_0xb677('0x2f')]('mm:ss');}else if(_0x2ba979['answertime']&&_0x2ba979[_0xb677('0x65')]){_0x28a476[_0xb677('0x63')]=moment[_0xb677('0x64')](moment(_0x2ba979[_0xb677('0x65')],'YYYY-MM-DDTHH:mm:ss')[_0xb677('0x66')](moment(_0x2ba979['starttime'],_0xb677('0x67'))))[_0xb677('0x2f')](_0xb677('0x68'));}switch(_0x2ba979[_0xb677('0x69')]){case _0xb677('0x6a'):_0x28a476[_0xb677('0x6b')]=_0xb677('0x6c');break;case _0xb677('0x6d'):case _0xb677('0x6e'):_0x28a476[_0xb677('0x6b')]=_0xb677('0x6f');break;case _0xb677('0x70'):_0x28a476[_0xb677('0x6b')]=_0xb677('0x71');break;case'abandoned':_0x28a476[_0xb677('0x6b')]=_0xb677('0x72');break;default:}_0x28a476['Call_Start_Time']=(_0x3f076f==='outbound'?moment(_0x2ba979['starttime'])['format']('YYYY-MM-DDTHH:mm:ss'):moment(_0x2ba979[_0xb677('0x73')])[_0xb677('0x2f')](_0xb677('0x67')))||moment()[_0xb677('0x2f')](_0xb677('0x67'));_0x28a476[_0xb677('0x74')]=_0x3f076f||_0xb677('0x75');_0x28a476=_[_0xb677('0x76')](_0x28a476,getCustomFields(_0x643f9d[_0xb677('0x77')],_0x2ba979));return request({'method':_0xb677('0x24'),'uri':_0xb677('0x4e')+_0x48fff3+_0xb677('0x78'),'headers':{'Authorization':_0xb677('0x32')+_0x334144},'body':{'data':[_0x28a476]},'json':!![]})[_0xb677('0x28')](function(_0x40003a){if(_0x40003a&&_0x40003a[_0xb677('0x3e')][0x0][_0xb677('0x45')]==='SUCCESS'){logger['info'](_0xb677('0x79'));return{'id':_0x40003a[_0xb677('0x3e')][0x0][_0xb677('0x47')]['id']};}})[_0xb677('0x3d')](function(_0x810f17){logger[_0xb677('0x2d')](_0xb677('0x7a'),_0x810f17[_0xb677('0x7b')]);console[_0xb677('0x4a')](_0xb677('0x7a'),_0x810f17);});}exports[_0xb677('0x7c')]=function(_0x48b69c,_0x5964d2,_0x3f11a2,_0x377415,_0x5470cd,_0x5d66af){var _0x3a32a6,_0x374e32,_0x498cdf;_0x5d66af['host']=intUtil['stripTrailingSlash'](_0x5d66af[_0xb677('0x7d')]);_0x5d66af[_0xb677('0x7e')]=intUtil['stripTrailingSlash'](_0x5d66af[_0xb677('0x7e')]);if(_0x5470cd&&_0x5470cd[_0xb677('0x7f')]){logger[_0xb677('0x2d')](_0xb677('0x80'),_0xb677('0x81'));_0x5964d2[_0xb677('0x82')]=_0x5d66af[_0xb677('0x7e')]+_0xb677('0x83')+_0x5964d2[_0xb677('0x84')]+_0xb677('0x85')+md5(_0x5964d2['uniqueid']);}else{_0x5964d2[_0xb677('0x82')]='';}var _0x517390=_0x5d66af['host']==='zoho.eu'?'eu':'com';return getAccessToken(_0x5d66af)[_0xb677('0x28')](function(_0x27c804){_0x498cdf=_0x27c804;return getUser(_0x498cdf,_0x517390,_0x5d66af,_0x377415['email']);})['then'](function(_0x192ff0){_0x3a32a6=_0x192ff0;logger[_0xb677('0x2d')]('The\x20User\x20ID\x20is:',_0x3a32a6['id']);return getEndUser(_0x498cdf,_0x517390,_0x5d66af,_0x5964d2[_0xb677('0x86')],_0x5964d2[_0xb677('0x87')],_0x3a32a6,_0x3f11a2);})[_0xb677('0x28')](function(_0x92b088){_0x374e32=_0x92b088;return getCall(_0x498cdf,_0x517390,_0x5d66af,_0x3a32a6,_0x374e32,_0x3f11a2,_0x5964d2,_0xb677('0x75'));})[_0xb677('0x28')](function(_0x365e82){if(_0x365e82){logger[_0xb677('0x2d')](_0xb677('0x88'),_0x365e82['id']);logger[_0xb677('0x2d')](_0xb677('0x80'),_0xb677('0x89'));emit(util['format']('user:%s',_0x377415['name']),_0xb677('0x8a'),{'uri':_0xb677('0x8b')+_0x5d66af[_0xb677('0x7d')]+_0xb677('0x8c')+_0x365e82['id']});}})[_0xb677('0x3d')](function(_0x3a8fbe){logger['error'](_0xb677('0x80'),JSON[_0xb677('0xe')](_0x3a8fbe));});};exports['outbound']=function(_0xabcc29,_0x335995,_0x5cf10a,_0x445c3a,_0x5c19d7,_0x4186ac,_0x5403cf){var _0x197310,_0x36bc33,_0xe0bd5e;_0x4186ac[_0xb677('0x7d')]=intUtil[_0xb677('0x8d')](_0x4186ac[_0xb677('0x7d')]);_0x4186ac[_0xb677('0x7e')]=intUtil[_0xb677('0x8d')](_0x4186ac[_0xb677('0x7e')]);if(_0x5403cf&&_0x5403cf[_0xb677('0x8e')]&&_0x5403cf['recordingFormat']!=='none'){logger[_0xb677('0x2d')](_0xb677('0x8f'),_0xb677('0x81'));_0x335995[_0xb677('0x82')]=_0x4186ac[_0xb677('0x7e')]+_0xb677('0x83')+_0x335995[_0xb677('0x84')]+_0xb677('0x85')+md5(_0x335995[_0xb677('0x84')]);}var _0x330434=_0x4186ac[_0xb677('0x7d')]==='zoho.eu'?'eu':_0xb677('0x90');return getAccessToken(_0x4186ac)[_0xb677('0x28')](function(_0x5ccef0){_0xe0bd5e=_0x5ccef0;return getUser(_0xe0bd5e,_0x330434,_0x4186ac,_0x445c3a[_0xb677('0x91')]);})[_0xb677('0x28')](function(_0x59abef){_0x197310=_0x59abef;logger['info'](_0xb677('0x92'),_0x197310['id']);return getEndUser(_0xe0bd5e,_0x330434,_0x4186ac,_0x335995[_0xb677('0x93')],_0x335995[_0xb677('0x94')],_0x197310,_0x5cf10a);})['then'](function(_0x24157a){_0x36bc33=_0x24157a;return getCall(_0xe0bd5e,_0x330434,_0x4186ac,_0x197310,_0x36bc33,_0x5cf10a,_0x335995,_0xb677('0x95'));})[_0xb677('0x28')](function(_0x4311f8){if(_0x4311f8){logger[_0xb677('0x2d')](_0xb677('0x88'),_0x4311f8['id']);logger[_0xb677('0x2d')](_0xb677('0x8f'),'Displaying\x20call\x20to\x20agent\x20in\x20a\x20new\x20tab...');emit(util[_0xb677('0x2f')](_0xb677('0x96'),_0x445c3a[_0xb677('0x18')]),_0xb677('0x8a'),{'uri':'https://crm.'+_0x4186ac[_0xb677('0x7d')]+_0xb677('0x8c')+_0x4311f8['id']});}})[_0xb677('0x3d')](function(_0x146aac){logger[_0xb677('0x2b')]('[OUTBOUND]',JSON[_0xb677('0xe')](_0x146aac));});};exports[_0xb677('0x97')]=function(_0x3e9015,_0x2de0e6,_0x12428d,_0x13c5ea,_0x140697,_0x46ce0e){var _0x4fa107,_0x37a5f7,_0x3409c9;_0x46ce0e[_0xb677('0x7d')]=intUtil[_0xb677('0x8d')](_0x46ce0e['host']);_0x46ce0e[_0xb677('0x7e')]=intUtil[_0xb677('0x8d')](_0x46ce0e[_0xb677('0x7e')]);if(_0x140697&&_0x140697[_0xb677('0x7f')]){logger[_0xb677('0x2d')](_0xb677('0x98'),_0xb677('0x81'));_0x2de0e6[_0xb677('0x82')]=_0x46ce0e[_0xb677('0x7e')]+_0xb677('0x83')+_0x2de0e6[_0xb677('0x84')]+_0xb677('0x85')+md5(_0x2de0e6[_0xb677('0x84')]);}else{_0x2de0e6[_0xb677('0x82')]='';}var _0x2bfc1a=_0x46ce0e[_0xb677('0x7d')]===_0xb677('0x99')?'eu':_0xb677('0x90');return getAccessToken(_0x46ce0e)[_0xb677('0x28')](function(_0x830f85){_0x3409c9=_0x830f85;return getUser(_0x3409c9,_0x2bfc1a,_0x46ce0e);})[_0xb677('0x28')](function(_0x2b0a08){_0x4fa107=_0x2b0a08;logger[_0xb677('0x2d')]('The\x20User\x20ID\x20is:',_0x4fa107['id']);return getEndUser(_0x3409c9,_0x2bfc1a,_0x46ce0e,_0x2de0e6[_0xb677('0x86')],_0x2de0e6[_0xb677('0x87')],_0x4fa107,_0x12428d);})['then'](function(_0x4dcb98){_0x37a5f7=_0x4dcb98;return getCall(_0x3409c9,_0x2bfc1a,_0x46ce0e,_0x4fa107,_0x37a5f7,_0x12428d,_0x2de0e6,_0xb677('0x75'));})[_0xb677('0x28')](function(_0x939f8b){if(_0x939f8b){logger['info'](_0xb677('0x88'),_0x939f8b['id']);}})['catch'](function(_0x437c64){logger['error'](_0xb677('0x98'),JSON['stringify'](_0x437c64));});}; \ No newline at end of file +var _0x993e=['[OUTBOUND]','destcalleridnum','Outbound','Displaying\x20call\x20to\x20agent\x20in\x20a\x20new\x20tab...','trigger:browser:url','/crm/EntityInfo.do?module=Calls&id=','monitor_format','[ABANDONED]','calleridnum','lodash','request-promise','md5','util','ioredis','../../../../config/environment','../../../../config/logger','zoho','redis','defaults','socket.io-emitter','emit','debug','[HTTP]','stringify','length','forEach','type','string','idField','content','toString','variable','variableName','Variable','name','toLowerCase','indexOf','isNil','expires_in','access_token','zone','https://accounts.zoho.com','https://accounts.zoho.com.au','https://accounts.zoho.in','https://accounts.zoho.com.cn','https://accounts.zoho.eu','clientId','clientSecret','refresh_token','then','error','info','GET','format','ActiveUsers','Zoho-oauthtoken\x20','users','isArrayLikeObject','findIndex','email','Agent\x20found!','Using\x20the\x20admin\x20account!','Administrator','user','profile','The\x20failing\x20result\x20is','Unable\x20to\x20retrieve\x20zoho\x20account\x20users:\x20','data','enduserType','catch','/crm/v2/','moduleCreate','role','first_name','last_name','code','SUCCESS','details','Error:\x20','log','CREATE\x20ERROR','moduleSearch','contact_lead','uri','https://www.zohoapis.','/crm/v2/Contacts/search?criteria=((Phone:equals:','Contacts','Leads','nothing','contact','lead','/crm/v2/Leads/search?criteria=((Phone:equals:','Creating\x20new\x20call...','Owner','administrator','Subjects','Description','getString','Descriptions','Full_Name','Last_Name','What_Id','First_Name','Call_Duration','utc','talktime','mm:ss','answertime','YYYY-MM-DDTHH:mm:ss','diff','lastevent','called','Called','complete','connect','Call_Result','Answered','rejected','Rejected','abandoned','Abandoned','Call_Start_Time','outbound','agentcalledAt','Call_Type','Inbound','merge','/crm/v2/Calls','Call\x20created!','stack','err','queue','host','stripTrailingSlash','serverUrl','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','/api/voice/recordings/','/downloads?type=uniqueid&token=','uniqueid','zoho.eu','com','The\x20User\x20ID\x20is:','calleridname','user:%s','https://crm.','recordingFormat'];(function(_0x5341ff,_0x1de6df){var _0x53be58=function(_0x4da0da){while(--_0x4da0da){_0x5341ff['push'](_0x5341ff['shift']());}};_0x53be58(++_0x1de6df);}(_0x993e,0x131));var _0xe993=function(_0x122ef9,_0x451d2a){_0x122ef9=_0x122ef9-0x0;var _0x42fba0=_0x993e[_0x122ef9];return _0x42fba0;};'use strict';var _=require(_0xe993('0x0'));var rp=require(_0xe993('0x1'));var md5=require(_0xe993('0x2'));var util=require(_0xe993('0x3'));var intUtil=require('./util');var moment=require('moment');var Redis=require(_0xe993('0x4'));var BPromise=require('bluebird');var config=require(_0xe993('0x5'));var logger=require(_0xe993('0x6'))(_0xe993('0x7'));config[_0xe993('0x8')]=_[_0xe993('0x9')](config[_0xe993('0x8')],{'host':'localhost','port':0x18eb});var io=require(_0xe993('0xa'))(new Redis(config[_0xe993('0x8')]));function emit(_0x2597a7,_0x23fce3,_0x293be7){io['to'](_0x2597a7)[_0xe993('0xb')](_0x23fce3,_0x293be7);}function request(_0x172c99){logger[_0xe993('0xc')](_0xe993('0xd'),JSON[_0xe993('0xe')](_0x172c99));return rp(_0x172c99);}function getCustomFields(_0x3403c8,_0x25edb9){var _0x5b9e0e={};if(_0x3403c8[_0xe993('0xf')]>0x0){_[_0xe993('0x10')](_0x3403c8,function(_0x43df62){if(_0x43df62[_0xe993('0x11')]===_0xe993('0x12')&&_0x43df62[_0xe993('0x13')]){_0x5b9e0e[_0x43df62['idField']]=_0x43df62[_0xe993('0x14')][_0xe993('0x15')]();}else if(_0x43df62[_0xe993('0x11')]===_0xe993('0x16')&&_0x43df62['variableName']&&_0x43df62[_0xe993('0x13')]&&_0x25edb9[_0x43df62[_0xe993('0x17')]]){_0x5b9e0e[_0x43df62[_0xe993('0x13')]]=_0x25edb9[_0x43df62[_0xe993('0x17')]]['toString']();}else if(_0x43df62[_0xe993('0x11')]==='customVariable'&&_0x43df62[_0xe993('0x18')]&&_0x43df62[_0xe993('0x18')]['name']&&_0x43df62['idField']&&_0x25edb9[_0x43df62[_0xe993('0x18')][_0xe993('0x19')][_0xe993('0x1a')]()]){_0x5b9e0e[_0x43df62['idField']]=_0x25edb9[_0x43df62[_0xe993('0x18')][_0xe993('0x19')][_0xe993('0x1a')]()]['toString']();}});}return _0x5b9e0e;}function getName(_0x563930){if(_0x563930[_0xe993('0x1b')]('\x20')>0x0){var _0x14950f=_0x563930['split'](/ (.+)/);if(_0x14950f[0x1]){return _0x14950f;}}return[_0x563930,_0x563930];}var accountsTokens={};function getAccessToken(_0x44d549){return new Promise(function(_0x8c516c,_0x221610){if(!_[_0xe993('0x1c')](accountsTokens[_0x44d549['id']])&&!_[_0xe993('0x1c')](accountsTokens[_0x44d549['id']]['access_token'])){if(moment()['isBefore'](accountsTokens[_0x44d549['id']][_0xe993('0x1d')])){_0x8c516c(accountsTokens[_0x44d549['id']][_0xe993('0x1e')]);}}var _0x2c4eae;switch(_0x44d549[_0xe993('0x1f')]){case'US':_0x2c4eae=_0xe993('0x20');break;case'AU':_0x2c4eae=_0xe993('0x21');break;case'EU':_0x2c4eae='https://accounts.zoho.eu';break;case'IN':_0x2c4eae=_0xe993('0x22');break;case'CN':_0x2c4eae=_0xe993('0x23');break;default:_0x2c4eae=_0xe993('0x24');break;}var _0x547035={'method':'POST','uri':_0x2c4eae+'/oauth/v2/token','qs':{'refresh_token':_0x44d549['refreshToken'],'client_id':_0x44d549[_0xe993('0x25')],'client_secret':_0x44d549[_0xe993('0x26')],'grant_type':_0xe993('0x27')},'json':!![]};return rp(_0x547035)[_0xe993('0x28')](function(_0x29b51d){accountsTokens[_0x44d549['id']]={'access_token':_0x29b51d[_0xe993('0x1e')],'expires_in':moment()['add'](_0x29b51d[_0xe993('0x1d')],'seconds')};_0x8c516c(_0x29b51d[_0xe993('0x1e')]);})['catch'](function(_0xefb24c){logger[_0xe993('0x29')]('Failing\x20creating\x20the\x20access_token',_0xefb24c['stack']);_0x221610(_0xefb24c);});});}function getUser(_0x8a587c,_0x4666d9,_0x189036,_0x573c49){logger[_0xe993('0x2a')]('Search\x20user');return request({'method':_0xe993('0x2b'),'uri':util[_0xe993('0x2c')]('https://www.zohoapis.%s/crm/v2/users',_0x4666d9),'qs':{'type':_0xe993('0x2d')},'headers':{'Authorization':_0xe993('0x2e')+_0x8a587c},'json':!![]})[_0xe993('0x28')](function(_0xfb93f5){if(_0xfb93f5[_0xe993('0x2f')]){var _0x2e780a=-0x1;if(_[_0xe993('0x30')](_0xfb93f5[_0xe993('0x2f')])){if(!_['isNil'](_0x573c49)){_0x2e780a=_[_0xe993('0x31')](_0xfb93f5[_0xe993('0x2f')],function(_0x27d535){return _0x27d535[_0xe993('0x32')]===_0x573c49;});}if(_0x2e780a>=0x0){logger[_0xe993('0x2a')](_0xe993('0x33'));}else{logger[_0xe993('0x2a')](_0xe993('0x34'));_0x2e780a=_[_0xe993('0x31')](_0xfb93f5['users'],function(_0x2e89c9){return _0x2e89c9['profile'][_0xe993('0x19')]===_0xe993('0x35');});}return _0xfb93f5[_0xe993('0x2f')][_0x2e780a];}else{if(_0xfb93f5[_0xe993('0x36')][_0xe993('0x37')][_0xe993('0x19')]===_0xe993('0x35')){logger[_0xe993('0x2a')](_0xe993('0x34'));user=_0xfb93f5[_0xe993('0x36')];return user;}else{logger[_0xe993('0x29')](_0xe993('0x38'),JSON[_0xe993('0xe')](_0xfb93f5));throw new Error(_0xe993('0x39')+JSON[_0xe993('0xe')](_0xfb93f5));}}}else{logger[_0xe993('0x29')]('The\x20failing\x20result\x20is',JSON[_0xe993('0xe')](_0xfb93f5));throw new Error(_0xe993('0x39')+JSON[_0xe993('0xe')](_0xfb93f5));}})['catch'](function(_0xe9e60a){console[_0xe993('0x29')](_0xe9e60a);});}function getZohoUser(_0x284c17,_0xae5d0e){return new BPromise(function(_0x3aa25d,_0x354cce){request(_0x284c17)[_0xe993('0x28')](function(_0x5d3981){var _0x4597af=null;if(_0x5d3981){_0x4597af=_0x5d3981[_0xe993('0x3a')][0x0];_0x4597af[_0xe993('0x3b')]=_0xae5d0e;}_0x3aa25d(_0x4597af);})[_0xe993('0x3c')](function(_0x2a0535){_0x354cce(_0x2a0535);});});}function createEndUser(_0x2a5052,_0x1d1fb7,_0x3d65bb,_0x4d0f25,_0xfcae6c,_0x45aece){var _0x3d65bb=getName(_0x3d65bb);return request({'method':'POST','uri':'https://www.zohoapis.'+_0x1d1fb7+_0xe993('0x3d')+_['startCase'](_0x45aece[_0xe993('0x3e')])+'s','body':{'data':[{'Last_Name':_0x3d65bb[0x1],'First_Name':_0x3d65bb[0x0],'Phone':_0x4d0f25,'Owner':{'name':!_[_0xe993('0x1c')](_0xfcae6c[_0xe993('0x3f')][_0xe993('0x19')])?_0xfcae6c[_0xe993('0x3f')][_0xe993('0x19')]:!_['isNil'](_0xfcae6c[_0xe993('0x40')])?_0xfcae6c[_0xe993('0x40')]+'\x20'+_0xfcae6c[_0xe993('0x41')]:_0xfcae6c[_0xe993('0x41')],'id':_0xfcae6c['id']}}]},'headers':{'Authorization':_0xe993('0x2e')+_0x2a5052},'json':!![]})[_0xe993('0x28')](function(_0x775712){if(_0x775712&&_0x775712['data'][0x0][_0xe993('0x42')]===_0xe993('0x43')){var _0x318963=_0x775712[_0xe993('0x3a')][0x0][_0xe993('0x44')];_0x318963[_0xe993('0x3b')]=_['startCase'](_0x45aece[_0xe993('0x3e')])+'s';return _0x318963;}logger['error']('The\x20failing\x20result\x20is',JSON[_0xe993('0xe')](data));throw new Error(_0xe993('0x45')+JSON[_0xe993('0xe')](data));})['catch'](function(_0x1e08ef){console[_0xe993('0x46')](_0xe993('0x47'),_0x1e08ef);});}function getEndUser(_0x40b168,_0x13ea29,_0x572bc5,_0x164e2c,_0x5cd2cc,_0xab2399,_0x3e506b){var _0x462257={'method':'GET','uri':'','headers':{'Authorization':_0xe993('0x2e')+_0x40b168},'json':!![]};switch(_0x3e506b[_0xe993('0x48')]){case _0xe993('0x49'):_0x462257[_0xe993('0x4a')]=_0xe993('0x4b')+_0x13ea29+_0xe993('0x4c')+_0x5cd2cc+'))';return getZohoUser(_0x462257,_0xe993('0x4d'))['then'](function(_0x2e0ff4){if(_0x2e0ff4)return _0x2e0ff4;_0x462257[_0xe993('0x4a')]='https://www.zohoapis.'+_0x13ea29+'/crm/v2/Leads/search?criteria=((Phone:equals:'+_0x5cd2cc+'))';return getZohoUser(_0x462257,_0xe993('0x4e'))[_0xe993('0x28')](function(_0x10364f){if(_0x10364f)return _0x10364f;if(_0x3e506b[_0xe993('0x3e')]!=_0xe993('0x4f')){return createEndUser(_0x40b168,_0x13ea29,_0x164e2c,_0x5cd2cc,_0xab2399,_0x3e506b);}else{return{};}});});break;case _0xe993('0x50'):_0x462257[_0xe993('0x4a')]=_0xe993('0x4b')+_0x13ea29+_0xe993('0x4c')+_0x5cd2cc+'))';return getZohoUser(_0x462257,_0xe993('0x4d'))[_0xe993('0x28')](function(_0x53cb3f){if(_0x53cb3f)return _0x53cb3f;if(_0x3e506b[_0xe993('0x3e')]!='nothing'){return createEndUser(_0x40b168,_0x13ea29,_0x164e2c,_0x5cd2cc,_0xab2399,_0x3e506b);}else{return{};}});break;case _0xe993('0x51'):_0x462257['uri']='https://www.zohoapis.'+_0x13ea29+_0xe993('0x52')+_0x5cd2cc+'))';return getZohoUser(_0x462257,_0xe993('0x4e'))[_0xe993('0x28')](function(_0x3bda69){if(_0x3bda69)return _0x3bda69;if(_0x3e506b['moduleCreate']!=_0xe993('0x4f')){return createEndUser(_0x40b168,_0x13ea29,_0x164e2c,_0x5cd2cc,_0xab2399,_0x3e506b);}else{return{};}});break;}}function getCall(_0x3b4636,_0x5a092e,_0x10647c,_0x69b596,_0x172da9,_0x3aff00,_0x1d7ec4,_0x26e084){logger[_0xe993('0x2a')](_0xe993('0x53'));var _0xe0adb3={};_0xe0adb3[_0xe993('0x54')]={'name':!_[_0xe993('0x1c')](_0x69b596['role'][_0xe993('0x19')])&&!_[_0xe993('0x1c')](_0x69b596['profile'][_0xe993('0x19')])&&_0x69b596[_0xe993('0x37')][_0xe993('0x19')]===_0xe993('0x55')?_0x69b596['role'][_0xe993('0x19')]:!_['isNil'](_0x69b596[_0xe993('0x40')])?_0x69b596[_0xe993('0x40')]+'\x20'+_0x69b596[_0xe993('0x41')]:_0x69b596[_0xe993('0x41')],'id':_0x69b596['id']};_0xe0adb3['Subject']=intUtil['getString'](_0x3aff00[_0xe993('0x56')],_0x1d7ec4,'\x20');_0xe0adb3[_0xe993('0x57')]=intUtil[_0xe993('0x58')](_0x3aff00[_0xe993('0x59')],_0x1d7ec4,'\x0a');if(_0x172da9[_0xe993('0x3b')]===_0xe993('0x4d')){_0xe0adb3['Who_Id']={'name':!_['isNil'](_0x172da9['Full_Name'])?_0x172da9[_0xe993('0x5a')]:!_['isNil'](_0x172da9['First_Name'])?_0x172da9['First_Name']+'\x20'+_0x172da9[_0xe993('0x5b')]:_0x172da9[_0xe993('0x5b')],'id':_0x172da9['id']};}if(_0x172da9[_0xe993('0x3b')]===_0xe993('0x4e')){_0xe0adb3[_0xe993('0x5c')]={'name':!_[_0xe993('0x1c')](_0x172da9['Full_Name'])?_0x172da9['Full_Name']:!_[_0xe993('0x1c')](_0x172da9[_0xe993('0x5d')])?_0x172da9[_0xe993('0x5d')]+'\x20'+_0x172da9['Last_Name']:_0x172da9[_0xe993('0x5b')],'id':_0x172da9['id']};_0xe0adb3['$se_module']=_['startCase'](_0x172da9[_0xe993('0x3b')]);}if(_0x1d7ec4['talktime']){_0xe0adb3[_0xe993('0x5e')]=moment[_0xe993('0x5f')](parseInt(_0x1d7ec4[_0xe993('0x60')])*0x3e8)[_0xe993('0x2c')](_0xe993('0x61'));}else if(_0x1d7ec4[_0xe993('0x62')]&&_0x1d7ec4['endtime']){_0xe0adb3[_0xe993('0x5e')]=moment[_0xe993('0x5f')](moment(_0x1d7ec4['endtime'],_0xe993('0x63'))[_0xe993('0x64')](moment(_0x1d7ec4['starttime'],_0xe993('0x63'))))[_0xe993('0x2c')](_0xe993('0x61'));}switch(_0x1d7ec4[_0xe993('0x65')]){case _0xe993('0x66'):_0xe0adb3['Call_Result']=_0xe993('0x67');break;case _0xe993('0x68'):case _0xe993('0x69'):_0xe0adb3[_0xe993('0x6a')]=_0xe993('0x6b');break;case _0xe993('0x6c'):_0xe0adb3[_0xe993('0x6a')]=_0xe993('0x6d');break;case _0xe993('0x6e'):_0xe0adb3[_0xe993('0x6a')]=_0xe993('0x6f');break;default:}_0xe0adb3[_0xe993('0x70')]=(_0x26e084===_0xe993('0x71')?moment(_0x1d7ec4['starttime'])[_0xe993('0x2c')]('YYYY-MM-DDTHH:mm:ss'):moment(_0x1d7ec4[_0xe993('0x72')])[_0xe993('0x2c')](_0xe993('0x63')))||moment()['format'](_0xe993('0x63'));_0xe0adb3[_0xe993('0x73')]=_0x26e084||_0xe993('0x74');_0xe0adb3=_[_0xe993('0x75')](_0xe0adb3,getCustomFields(_0x3aff00['Fields'],_0x1d7ec4));return request({'method':'POST','uri':'https://www.zohoapis.'+_0x5a092e+_0xe993('0x76'),'headers':{'Authorization':_0xe993('0x2e')+_0x3b4636},'body':{'data':[_0xe0adb3]},'json':!![]})['then'](function(_0x4a6be6){if(_0x4a6be6&&_0x4a6be6[_0xe993('0x3a')][0x0][_0xe993('0x42')]===_0xe993('0x43')){logger[_0xe993('0x2a')](_0xe993('0x77'));return{'id':_0x4a6be6[_0xe993('0x3a')][0x0][_0xe993('0x44')]['id']};}})[_0xe993('0x3c')](function(_0x44be35){logger[_0xe993('0x2a')]('err',_0x44be35[_0xe993('0x78')]);console[_0xe993('0x46')](_0xe993('0x79'),_0x44be35);});}exports[_0xe993('0x7a')]=function(_0x12ea79,_0x345382,_0x22c1fb,_0x5c48e5,_0x96ebe8,_0x3301b2){var _0x3fc340,_0x20729e,_0x2acb33;_0x3301b2[_0xe993('0x7b')]=intUtil[_0xe993('0x7c')](_0x3301b2[_0xe993('0x7b')]);_0x3301b2[_0xe993('0x7d')]=intUtil[_0xe993('0x7c')](_0x3301b2[_0xe993('0x7d')]);if(_0x96ebe8&&_0x96ebe8['monitor_format']){logger['info'](_0xe993('0x7e'),_0xe993('0x7f'));_0x345382[_0xe993('0x80')]=_0x3301b2[_0xe993('0x7d')]+_0xe993('0x81')+_0x345382['uniqueid']+_0xe993('0x82')+md5(_0x345382[_0xe993('0x83')]);}else{_0x345382[_0xe993('0x80')]='';}var _0x49fbd4=_0x3301b2[_0xe993('0x7b')]===_0xe993('0x84')?'eu':_0xe993('0x85');return getAccessToken(_0x3301b2)[_0xe993('0x28')](function(_0x31257a){_0x2acb33=_0x31257a;return getUser(_0x2acb33,_0x49fbd4,_0x3301b2,_0x5c48e5[_0xe993('0x32')]);})['then'](function(_0x2abc39){_0x3fc340=_0x2abc39;logger[_0xe993('0x2a')](_0xe993('0x86'),_0x3fc340['id']);return getEndUser(_0x2acb33,_0x49fbd4,_0x3301b2,_0x345382[_0xe993('0x87')],_0x345382['calleridnum'],_0x3fc340,_0x22c1fb);})[_0xe993('0x28')](function(_0xa03b1c){_0x20729e=_0xa03b1c;return getCall(_0x2acb33,_0x49fbd4,_0x3301b2,_0x3fc340,_0x20729e,_0x22c1fb,_0x345382,_0xe993('0x74'));})['then'](function(_0x48503b){if(_0x48503b){logger['info']('The\x20Call\x20ID\x20is:',_0x48503b['id']);logger['info'](_0xe993('0x7e'),'Displaying\x20call\x20to\x20agent\x20in\x20a\x20new\x20tab...');emit(util['format'](_0xe993('0x88'),_0x5c48e5[_0xe993('0x19')]),'trigger:browser:url',{'uri':_0xe993('0x89')+_0x3301b2[_0xe993('0x7b')]+'/crm/EntityInfo.do?module=Calls&id='+_0x48503b['id']});}})['catch'](function(_0x29b84a){logger['error'](_0xe993('0x7e'),JSON[_0xe993('0xe')](_0x29b84a));});};exports[_0xe993('0x71')]=function(_0x2d84ff,_0x33202e,_0x12957a,_0x5ea7fd,_0x3fa824,_0x211c66,_0x2408ec){var _0x13a7c7,_0x41eb08,_0x444389;_0x211c66[_0xe993('0x7b')]=intUtil['stripTrailingSlash'](_0x211c66[_0xe993('0x7b')]);_0x211c66[_0xe993('0x7d')]=intUtil[_0xe993('0x7c')](_0x211c66[_0xe993('0x7d')]);if(_0x2408ec&&_0x2408ec[_0xe993('0x8a')]&&_0x2408ec[_0xe993('0x8a')]!=='none'){logger[_0xe993('0x2a')](_0xe993('0x8b'),_0xe993('0x7f'));_0x33202e[_0xe993('0x80')]=_0x211c66[_0xe993('0x7d')]+_0xe993('0x81')+_0x33202e[_0xe993('0x83')]+'/downloads?type=uniqueid&token='+md5(_0x33202e[_0xe993('0x83')]);}var _0x23e416=_0x211c66[_0xe993('0x7b')]==='zoho.eu'?'eu':_0xe993('0x85');return getAccessToken(_0x211c66)[_0xe993('0x28')](function(_0xe8aa00){_0x444389=_0xe8aa00;return getUser(_0x444389,_0x23e416,_0x211c66,_0x5ea7fd[_0xe993('0x32')]);})[_0xe993('0x28')](function(_0x46b963){_0x13a7c7=_0x46b963;logger[_0xe993('0x2a')](_0xe993('0x86'),_0x13a7c7['id']);return getEndUser(_0x444389,_0x23e416,_0x211c66,_0x33202e['destcalleridname'],_0x33202e[_0xe993('0x8c')],_0x13a7c7,_0x12957a);})['then'](function(_0x4f4eb4){_0x41eb08=_0x4f4eb4;return getCall(_0x444389,_0x23e416,_0x211c66,_0x13a7c7,_0x41eb08,_0x12957a,_0x33202e,_0xe993('0x8d'));})[_0xe993('0x28')](function(_0x503ab1){if(_0x503ab1){logger[_0xe993('0x2a')]('The\x20Call\x20ID\x20is:',_0x503ab1['id']);logger[_0xe993('0x2a')]('[OUTBOUND]',_0xe993('0x8e'));emit(util[_0xe993('0x2c')](_0xe993('0x88'),_0x5ea7fd['name']),_0xe993('0x8f'),{'uri':_0xe993('0x89')+_0x211c66[_0xe993('0x7b')]+_0xe993('0x90')+_0x503ab1['id']});}})[_0xe993('0x3c')](function(_0x43d422){logger[_0xe993('0x29')](_0xe993('0x8b'),JSON['stringify'](_0x43d422));});};exports[_0xe993('0x6e')]=function(_0x2f723d,_0x5479ce,_0x48e232,_0x335289,_0x24f8f8,_0xb74d13){var _0x360a3a,_0x19d6cc,_0x316e36;_0xb74d13[_0xe993('0x7b')]=intUtil['stripTrailingSlash'](_0xb74d13[_0xe993('0x7b')]);_0xb74d13[_0xe993('0x7d')]=intUtil['stripTrailingSlash'](_0xb74d13['serverUrl']);if(_0x24f8f8&&_0x24f8f8[_0xe993('0x91')]){logger['info'](_0xe993('0x92'),_0xe993('0x7f'));_0x5479ce[_0xe993('0x80')]=_0xb74d13[_0xe993('0x7d')]+'/api/voice/recordings/'+_0x5479ce[_0xe993('0x83')]+_0xe993('0x82')+md5(_0x5479ce[_0xe993('0x83')]);}else{_0x5479ce[_0xe993('0x80')]='';}var _0x156db6=_0xb74d13[_0xe993('0x7b')]===_0xe993('0x84')?'eu':_0xe993('0x85');return getAccessToken(_0xb74d13)[_0xe993('0x28')](function(_0x38d8d6){_0x316e36=_0x38d8d6;return getUser(_0x316e36,_0x156db6,_0xb74d13);})['then'](function(_0x1a3d13){_0x360a3a=_0x1a3d13;logger[_0xe993('0x2a')]('The\x20User\x20ID\x20is:',_0x360a3a['id']);return getEndUser(_0x316e36,_0x156db6,_0xb74d13,_0x5479ce[_0xe993('0x87')],_0x5479ce[_0xe993('0x93')],_0x360a3a,_0x48e232);})['then'](function(_0x3857e9){_0x19d6cc=_0x3857e9;return getCall(_0x316e36,_0x156db6,_0xb74d13,_0x360a3a,_0x19d6cc,_0x48e232,_0x5479ce,'Inbound');})[_0xe993('0x28')](function(_0xe15587){if(_0xe15587){logger[_0xe993('0x2a')]('The\x20Call\x20ID\x20is:',_0xe15587['id']);}})[_0xe993('0x3c')](function(_0x113e60){logger[_0xe993('0x29')]('[ABANDONED]',JSON[_0xe993('0xe')](_0x113e60));});}; \ 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 3f94b4c..f0f7bf6 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(_0xe81e79,_0x14145c){var _0x107f60=function(_0xf9f960){while(--_0xf9f960){_0xe81e79['push'](_0xe81e79['shift']());}};_0x107f60(++_0x14145c);}(_0x7a54,0x106));var _0x47a5=function(_0x397b92,_0x37f981){_0x397b92=_0x397b92-0x0;var _0x40e505=_0x7a54[_0x397b92];return _0x40e505;};'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(_0x249e0f,_0x3cc54b){var _0x2523e6=function(_0x310022){while(--_0x310022){_0x249e0f['push'](_0x249e0f['shift']());}};_0x2523e6(++_0x3cc54b);}(_0x7a54,0x106));var _0x47a5=function(_0x30b9f3,_0x1b2032){_0x30b9f3=_0x30b9f3-0x0;var _0x11809a=_0x7a54[_0x30b9f3];return _0x11809a;};'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 2333858..fd95ed6 100644 --- a/server/services/ami/trigger/urlforward/index.js +++ b/server/services/ami/trigger/urlforward/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x7a54=['data6','parse','stack','data1','GET','DELETE','POST','PUT','render','data7','body','error','info','format','%s\x20%s\x20sending\x20request\x20with\x20following\x20options:\x20%s','then',',\x20request\x20body:\x20','object','stringify','%s\x20%s\x20succeeded\x20with\x20status:\x20%d\x20and\x20response:\x20%s','statusCode','name','request-promise','util','lodash','../../../../config/logger','trigger','toUpperCase','data2','data5'];(function(_0x1f33f6,_0x4019bc){var _0xd6b25b=function(_0x7bde04){while(--_0x7bde04){_0x1f33f6['push'](_0x1f33f6['shift']());}};_0xd6b25b(++_0x4019bc);}(_0x7a54,0x106));var _0x47a5=function(_0x5b6a45,_0x11dae2){_0x5b6a45=_0x5b6a45-0x0;var _0x2f6e26=_0x7a54[_0x5b6a45];return _0x2f6e26;};'use strict';var rp=require(_0x47a5('0x0'));var util=require(_0x47a5('0x1'));var _=require(_0x47a5('0x2'));var Mustache=require('mustache');var logger=require(_0x47a5('0x3'))(_0x47a5('0x4'));exports['exec']=function(_0x5f7f12,_0x11bf85){var _0x2a1a7e,_0x3717e1;var _0xfdf934={'method':_0x5f7f12['data1'][_0x47a5('0x5')](),'uri':Mustache['render'](_0x5f7f12[_0x47a5('0x6')],_0x11bf85),'json':!![],'resolveWithFullResponse':!![],'timeout':typeof parseInt(_0x5f7f12[_0x47a5('0x7')])==='number'&&parseInt(_0x5f7f12[_0x47a5('0x7')])>=0x1&&parseInt(_0x5f7f12['data5'])<=0xa?parseInt(_0x5f7f12['data5'])*0x3e8:0x5*0x3e8};try{_0xfdf934['headers']=_0x5f7f12[_0x47a5('0x8')]?JSON[_0x47a5('0x9')](Mustache['render'](_0x5f7f12[_0x47a5('0x8')],_0x11bf85)):{};}catch(_0x49e844){logger['error'](_0x49e844[_0x47a5('0xa')]);}switch(_0x5f7f12[_0x47a5('0xb')][_0x47a5('0x5')]()){case _0x47a5('0xc'):case _0x47a5('0xd'):_0x2a1a7e=null;_0xfdf934['qs']=_0x11bf85;break;case _0x47a5('0xe'):case _0x47a5('0xf'):if(_0x5f7f12['data7']){try{_0x2a1a7e=JSON[_0x47a5('0x9')](Mustache[_0x47a5('0x10')](_0x5f7f12[_0x47a5('0x11')],_0x11bf85));_0xfdf934[_0x47a5('0x12')]=_0x2a1a7e;}catch(_0x139f25){logger[_0x47a5('0x13')](_0x139f25[_0x47a5('0xa')]);logger[_0x47a5('0x13')]('body\x20has\x20been\x20passed\x20to\x20URLforward\x20in\x20a\x20wrong\x20format');}}else{_0x2a1a7e=_0x11bf85;_0xfdf934[_0x47a5('0x12')]=_0x2a1a7e;}break;}logger[_0x47a5('0x14')](util[_0x47a5('0x15')](_0x47a5('0x16'),_0x5f7f12[_0x47a5('0xb')],_0x5f7f12['data2'],JSON['stringify'](_0xfdf934)));rp(_0xfdf934)[_0x47a5('0x17')](function(_0x4b966e){_0x2a1a7e=!_['isNil'](_0x2a1a7e)?_0x47a5('0x18')+_0x2a1a7e:'';_0x3717e1=typeof _0x4b966e[_0x47a5('0x12')]===_0x47a5('0x19')?JSON[_0x47a5('0x1a')](_0x4b966e[_0x47a5('0x12')]):_0x4b966e[_0x47a5('0x12')];logger[_0x47a5('0x14')](util[_0x47a5('0x15')](_0x47a5('0x1b'),_0x5f7f12['data1'],_0x5f7f12[_0x47a5('0x6')],_0x4b966e[_0x47a5('0x1c')],_0x3717e1));})['catch'](function(_0x2b0360){logger[_0x47a5('0x13')](util[_0x47a5('0x15')]('%s\x20%s\x20failed\x20with\x20status:\x20%d\x20and\x20error:\x20%s\x20%s',_0x5f7f12[_0x47a5('0xb')],_0x5f7f12[_0x47a5('0x6')],_0x2b0360[_0x47a5('0x1c')],_0x2b0360[_0x47a5('0x1d')],_0x2b0360['message']));});}; \ No newline at end of file +var _0x5f2f=['lodash','mustache','../../../../config/logger','trigger','exec','data1','toUpperCase','render','data2','number','data5','headers','data6','parse','stack','GET','DELETE','POST','PUT','data7','body','error','body\x20has\x20been\x20passed\x20to\x20URLforward\x20in\x20a\x20wrong\x20format','info','format','%s\x20%s\x20sending\x20request\x20with\x20following\x20options:\x20%s','stringify','then','isNil',',\x20request\x20body:\x20','object','%s\x20%s\x20succeeded\x20with\x20status:\x20%d\x20and\x20response:\x20%s','statusCode','catch','%s\x20%s\x20failed\x20with\x20status:\x20%d\x20and\x20error:\x20%s\x20%s','name','message','request-promise','util'];(function(_0x18354f,_0x383e73){var _0x4148ef=function(_0x363e19){while(--_0x363e19){_0x18354f['push'](_0x18354f['shift']());}};_0x4148ef(++_0x383e73);}(_0x5f2f,0x73));var _0xf5f2=function(_0x4f37c1,_0x3ef93d){_0x4f37c1=_0x4f37c1-0x0;var _0x2e95f5=_0x5f2f[_0x4f37c1];return _0x2e95f5;};'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 a52f4cf..02d2ecb 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 _0x6597=['message','result','jayson/promise','bluebird','../../config/logger','client','Request','request','then','debug','error','rpc','routing'];(function(_0x10defa,_0x290926){var _0x3bb189=function(_0x362f51){while(--_0x362f51){_0x10defa['push'](_0x10defa['shift']());}};_0x3bb189(++_0x290926);}(_0x6597,0x16e));var _0x7659=function(_0x376071,_0x3f345b){_0x376071=_0x376071-0x0;var _0x25edd5=_0x6597[_0x376071];return _0x25edd5;};'use strict';var jayson=require(_0x7659('0x0'));var BPromise=require(_0x7659('0x1'));var logger=require(_0x7659('0x2'))('routing');var client=jayson[_0x7659('0x3')]['http']({'port':0x2329});client[_0x7659('0x4')]=function(_0x4f5b89,_0x5e96ed){return new BPromise(function(_0x576e8b,_0xbcb138){return client[_0x7659('0x5')](_0x4f5b89,_0x5e96ed)[_0x7659('0x6')](function(_0xb90fa2){logger[_0x7659('0x7')]('rpc','routing',_0x4f5b89,_0x5e96ed,_0xb90fa2);if(_0xb90fa2[_0x7659('0x8')]){logger[_0x7659('0x8')](_0x7659('0x9'),_0x7659('0xa'),_0x4f5b89,_0xb90fa2['error'][_0x7659('0xb')],_0x5e96ed);return _0xbcb138(_0xb90fa2[_0x7659('0x8')]['message']);}else{return _0x576e8b(_0xb90fa2[_0x7659('0xc')]);}})['catch'](function(_0x2edd5d){logger['error'](_0x7659('0x9'),_0x7659('0xa'),_0x4f5b89,_0x2edd5d,_0x5e96ed);return _0xbcb138(_0x2edd5d);});});};module['exports']=client; \ No newline at end of file +var _0x1f75=['http','Request','request','then','debug','rpc','error','message','result','catch','routing','exports','jayson/promise','bluebird','../../config/logger','client'];(function(_0x43779b,_0x142556){var _0x4d9bba=function(_0x23e98a){while(--_0x23e98a){_0x43779b['push'](_0x43779b['shift']());}};_0x4d9bba(++_0x142556);}(_0x1f75,0x12c));var _0x51f7=function(_0x42245d,_0x51758f){_0x42245d=_0x42245d-0x0;var _0x4b211a=_0x1f75[_0x42245d];return _0x4b211a;};'use strict';var jayson=require(_0x51f7('0x0'));var BPromise=require(_0x51f7('0x1'));var logger=require(_0x51f7('0x2'))('routing');var client=jayson[_0x51f7('0x3')][_0x51f7('0x4')]({'port':0x2329});client[_0x51f7('0x5')]=function(_0x11265a,_0x3df27f){return new BPromise(function(_0x4e6fc,_0x205684){return client[_0x51f7('0x6')](_0x11265a,_0x3df27f)[_0x51f7('0x7')](function(_0x22fc29){logger[_0x51f7('0x8')](_0x51f7('0x9'),'routing',_0x11265a,_0x3df27f,_0x22fc29);if(_0x22fc29[_0x51f7('0xa')]){logger[_0x51f7('0xa')](_0x51f7('0x9'),'routing',_0x11265a,_0x22fc29['error'][_0x51f7('0xb')],_0x3df27f);return _0x205684(_0x22fc29[_0x51f7('0xa')]['message']);}else{return _0x4e6fc(_0x22fc29[_0x51f7('0xc')]);}})[_0x51f7('0xd')](function(_0x5f4a51){logger['error'](_0x51f7('0x9'),_0x51f7('0xe'),_0x11265a,_0x5f4a51,_0x3df27f);return _0x205684(_0x5f4a51);});});};module[_0x51f7('0xf')]=client; \ No newline at end of file diff --git a/server/services/email/index.js b/server/services/email/index.js index e58a053..0462912 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 _0x45d1=['./rpc/mailAccount','resolve','getMailAccounts','then','initMailAccounts','refresh','mailAccounts','listen','findOne','loginMailFrequency','log','bluebird','./server','./lib/email'];(function(_0x3c7d53,_0x2826d0){var _0x2c8387=function(_0x21f0e8){while(--_0x21f0e8){_0x3c7d53['push'](_0x3c7d53['shift']());}};_0x2c8387(++_0x2826d0);}(_0x45d1,0x1cb));var _0x145d=function(_0x2cd8d0,_0x5ddefb){_0x2cd8d0=_0x2cd8d0-0x0;var _0x49a221=_0x45d1[_0x2cd8d0];return _0x49a221;};'use strict';var BPromise=require(_0x145d('0x0'));var server=require(_0x145d('0x1'));var Realtime=require('./realtime');var EmailChannel=require(_0x145d('0x2'));var mailAccount=require(_0x145d('0x3'));var realtime=new Realtime();var email=new EmailChannel(realtime);var db=require('../../mysqldb')['db'];function initRealtime(){return BPromise[_0x145d('0x4')]()['then'](mailAccount[_0x145d('0x5')]())[_0x145d('0x6')](realtime[_0x145d('0x7')]())[_0x145d('0x6')](function(){email[_0x145d('0x8')](realtime[_0x145d('0x9')]);return realtime;});}function main(){return server[_0x145d('0xa')](realtime,email)[_0x145d('0x6')](function(_0x46a729){return initRealtime();})['then'](function(_0x4ef552){return db['Setting'][_0x145d('0xb')]({'attributes':['id',_0x145d('0xc')],'raw':!![]});})[_0x145d('0x6')](function(_0x583865){return setInterval(initRealtime,_0x583865[_0x145d('0xc')]*0x3e8);})['catch'](function(_0x3543c3){console[_0x145d('0xd')](_0x3543c3);});}main(); \ No newline at end of file +var _0x624c=['./server','./realtime','./lib/email','./rpc/mailAccount','../../mysqldb','then','refresh','mailAccounts','listen','Setting','findOne','loginMailFrequency','log'];(function(_0x462832,_0x3c5525){var _0x33f578=function(_0x295695){while(--_0x295695){_0x462832['push'](_0x462832['shift']());}};_0x33f578(++_0x3c5525);}(_0x624c,0x1ee));var _0xc624=function(_0x1e20a1,_0x537772){_0x1e20a1=_0x1e20a1-0x0;var _0x29de0a=_0x624c[_0x1e20a1];return _0x29de0a;};'use strict';var BPromise=require('bluebird');var server=require(_0xc624('0x0'));var Realtime=require(_0xc624('0x1'));var EmailChannel=require(_0xc624('0x2'));var mailAccount=require(_0xc624('0x3'));var realtime=new Realtime();var email=new EmailChannel(realtime);var db=require(_0xc624('0x4'))['db'];function initRealtime(){return BPromise['resolve']()[_0xc624('0x5')](mailAccount['getMailAccounts']())[_0xc624('0x5')](realtime['initMailAccounts']())[_0xc624('0x5')](function(){email[_0xc624('0x6')](realtime[_0xc624('0x7')]);return realtime;});}function main(){return server[_0xc624('0x8')](realtime,email)[_0xc624('0x5')](function(_0x6cd772){return initRealtime();})[_0xc624('0x5')](function(_0x4beebb){return db[_0xc624('0x9')][_0xc624('0xa')]({'attributes':['id',_0xc624('0xb')],'raw':!![]});})['then'](function(_0x44e4d9){return setInterval(initRealtime,_0x44e4d9[_0xc624('0xb')]*0x3e8);})['catch'](function(_0x313512){console[_0xc624('0xc')](_0x313512);});}main(); \ No newline at end of file diff --git a/server/services/email/lib/email.js b/server/services/email/lib/email.js index 52e3fc2..eb242f3 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 _0xd414=['smtp','prototype','name','key','active','Imap','status','messageStatus','total','stringify','emit','mailAccount:update','refresh','hasOwnProperty','box','bind','end','handleImapEnd','error','isNil','disabled','handleImapBox','connected','handleImapEmail','New\x20email\x20from\x20%s\x20%s\x20%s\x20to\x20%s','firstName','lastName','from','notify','Mail\x20accepted\x20from\x20routing','Mail\x20not\x20accepted\x20from\x20routing\x20%s','handleImapError','send','verifySmtp','Smtp','lastSync','verified','verify','lodash','moment','bluebird','md5','ioredis','../../../config/environment','../../../config/logger','email','redis','localhost','socket.io-emitter','./imap','./smtp','../rpc/mailAccount','info','start\x20email\x20channel','mailAccounts','imapAccounts'];(function(_0x17d9e3,_0x1f969c){var _0x14192d=function(_0x159745){while(--_0x159745){_0x17d9e3['push'](_0x17d9e3['shift']());}};_0x14192d(++_0x1f969c);}(_0xd414,0x176));var _0x4d41=function(_0x2e49a4,_0x497c00){_0x2e49a4=_0x2e49a4-0x0;var _0x50bec9=_0xd414[_0x2e49a4];return _0x50bec9;};'use strict';var _=require(_0x4d41('0x0'));var moment=require(_0x4d41('0x1'));var BPromise=require(_0x4d41('0x2'));var md5=require(_0x4d41('0x3'));var Redis=require(_0x4d41('0x4'));var config=require(_0x4d41('0x5'));var logger=require(_0x4d41('0x6'))(_0x4d41('0x7'));config[_0x4d41('0x8')]=_['defaults'](config[_0x4d41('0x8')],{'host':_0x4d41('0x9'),'port':0x18eb});var io=require(_0x4d41('0xa'))(new Redis(config[_0x4d41('0x8')]));var EmailImap=require(_0x4d41('0xb'));var EmailSmtp=require(_0x4d41('0xc'));var mailAccount=require(_0x4d41('0xd'));var md5Accounts={};function EmailChannel(_0x492969){logger[_0x4d41('0xe')](_0x4d41('0xf'));this[_0x4d41('0x10')]=_0x492969['mailAccounts'];this[_0x4d41('0x11')]={};this[_0x4d41('0x12')]=new EmailSmtp();}EmailChannel[_0x4d41('0x13')]['emit']=function(_0x245081){var _0x158870=this['mailAccounts'][_0x245081];var _0x4cd436={'id':_0x158870['id'],'name':_0x158870[_0x4d41('0x14')],'key':_0x158870[_0x4d41('0x15')],'active':_0x158870[_0x4d41('0x16')],'Imap':{'status':_0x158870[_0x4d41('0x17')][_0x4d41('0x18')],'messageStatus':_0x158870[_0x4d41('0x17')][_0x4d41('0x19')],'total':_0x158870[_0x4d41('0x17')][_0x4d41('0x1a')]}};if(_['isNil'](md5Accounts[_0x245081])){md5Accounts[_0x245081]={};}var _0x2e81f9=md5(JSON[_0x4d41('0x1b')](_0x4cd436));if(md5Accounts[_0x245081]['md5']!==_0x2e81f9){md5Accounts[_0x245081][_0x4d41('0x3')]=_0x2e81f9;io[_0x4d41('0x1c')](_0x4d41('0x1d'),_0x4cd436);}};EmailChannel[_0x4d41('0x13')][_0x4d41('0x1e')]=function(_0x59ac4b){for(var _0x1a77e7 in _0x59ac4b){if(_0x59ac4b[_0x4d41('0x1f')](_0x1a77e7)){if(_0x59ac4b[_0x1a77e7][_0x4d41('0x17')]&&_0x59ac4b[_0x1a77e7][_0x4d41('0x16')]){var _0x4e2d1e=_0x59ac4b[_0x1a77e7][_0x4d41('0x17')];if(!this[_0x4d41('0x11')][_0x4d41('0x1f')](_0x4e2d1e['id'])){this[_0x4d41('0x11')][_0x4e2d1e['id']]=new EmailImap(_0x4e2d1e,_0x59ac4b[_0x1a77e7][_0x4d41('0x7')]);this['imapAccounts'][_0x4e2d1e['id']]['on'](_0x4d41('0x20'),this['handleImapBox'][_0x4d41('0x21')](this,_0x1a77e7));this['imapAccounts'][_0x4e2d1e['id']]['on'](_0x4d41('0x7'),this['handleImapEmail']['bind'](this,_0x1a77e7));this['imapAccounts'][_0x4e2d1e['id']]['on'](_0x4d41('0x22'),this[_0x4d41('0x23')][_0x4d41('0x21')](this,_0x1a77e7));this[_0x4d41('0x11')][_0x4e2d1e['id']]['on'](_0x4d41('0x24'),this['handleImapError']['bind'](this,_0x1a77e7));}}else{if(_[_0x4d41('0x25')](this[_0x4d41('0x10')][_0x1a77e7][_0x4d41('0x17')])){this[_0x4d41('0x10')][_0x1a77e7]['Imap']={};}this[_0x4d41('0x10')][_0x1a77e7][_0x4d41('0x17')][_0x4d41('0x18')]=_0x4d41('0x26');this[_0x4d41('0x10')][_0x1a77e7][_0x4d41('0x17')]['messageStatus']='';this[_0x4d41('0x1c')](_0x1a77e7);}}}};EmailChannel['prototype'][_0x4d41('0x27')]=function(_0xdd993a,_0x3d5311){if(this[_0x4d41('0x10')][_0xdd993a]){this[_0x4d41('0x10')][_0xdd993a][_0x4d41('0x17')][_0x4d41('0x18')]=_0x4d41('0x28');this[_0x4d41('0x10')][_0xdd993a][_0x4d41('0x17')]['messageStatus']=_0x3d5311['name'];if(_0x3d5311['messages']){this[_0x4d41('0x10')][_0xdd993a][_0x4d41('0x17')][_0x4d41('0x1a')]=_0x3d5311['messages'][_0x4d41('0x1a')];}return this[_0x4d41('0x1c')](_0xdd993a);}};EmailChannel['prototype'][_0x4d41('0x29')]=function(_0x452527,_0x584e22){logger[_0x4d41('0xe')](_0x4d41('0x2a'),_0x584e22[_0x4d41('0x2b')],_0x584e22[_0x4d41('0x2c')],_0x584e22[_0x4d41('0x2d')],_0x452527);if(this['mailAccounts'][_0x452527]){return mailAccount[_0x4d41('0x2e')](_0x452527,_0x584e22)['then'](function(_0x42acf0){if(_0x42acf0){logger['info'](_0x4d41('0x2f'));}})['catch'](function(_0x5dd421){logger[_0x4d41('0x24')](_0x4d41('0x30'),JSON[_0x4d41('0x1b')](_0x5dd421));});}};EmailChannel[_0x4d41('0x13')][_0x4d41('0x23')]=function(_0x5c0d40){if(this[_0x4d41('0x10')][_0x5c0d40]&&this[_0x4d41('0x10')][_0x5c0d40]['Imap']){if(this['imapAccounts'][this[_0x4d41('0x10')][_0x5c0d40][_0x4d41('0x17')]['id']]){delete this['imapAccounts'][this[_0x4d41('0x10')][_0x5c0d40]['Imap']['id']];}this['mailAccounts'][_0x5c0d40][_0x4d41('0x17')]['lastSync']=moment();this[_0x4d41('0x1c')](_0x5c0d40);}};EmailChannel[_0x4d41('0x13')][_0x4d41('0x31')]=function(_0x1ac732,_0x57f4c3){if(this[_0x4d41('0x10')][_0x1ac732]){this['mailAccounts'][_0x1ac732][_0x4d41('0x17')][_0x4d41('0x18')]='error';this['mailAccounts'][_0x1ac732]['Imap']['messageStatus']=_0x57f4c3;return this[_0x4d41('0x1c')](_0x1ac732);}};EmailChannel[_0x4d41('0x13')]['sendMail']=function(_0x9a5f7e,_0x2f03fd){return this[_0x4d41('0x12')][_0x4d41('0x32')](_0x9a5f7e,_0x2f03fd);};EmailChannel[_0x4d41('0x13')][_0x4d41('0x33')]=function(_0x401498){var _0x5ab19c=this;if(this['mailAccounts'][_0x401498['id']]){if(_[_0x4d41('0x25')](this[_0x4d41('0x10')][_0x401498['id']][_0x4d41('0x34')])){this[_0x4d41('0x10')][_0x401498['id']][_0x4d41('0x34')]={};}this[_0x4d41('0x10')][_0x401498['id']][_0x4d41('0x34')][_0x4d41('0x35')]=moment();return new BPromise(function(_0x2231cb,_0x20ab54){return _0x5ab19c[_0x4d41('0x12')]['verify'](_0x401498)['then'](function(_0x45cae2){_0x5ab19c['mailAccounts'][_0x401498['id']][_0x4d41('0x34')][_0x4d41('0x18')]=_0x4d41('0x36');_0x5ab19c[_0x4d41('0x10')][_0x401498['id']][_0x4d41('0x34')]['messageStatus']='';_0x5ab19c[_0x4d41('0x1c')](_0x401498['id']);_0x2231cb(_0x45cae2);})['catch'](function(_0x3b1ffb){_0x5ab19c[_0x4d41('0x10')][_0x401498['id']][_0x4d41('0x34')]['status']=_0x4d41('0x24');_0x5ab19c[_0x4d41('0x10')][_0x401498['id']][_0x4d41('0x34')][_0x4d41('0x19')]=_0x3b1ffb;_0x5ab19c[_0x4d41('0x1c')](_0x401498['id']);_0x20ab54(_0x3b1ffb);});});}return this['smtp'][_0x4d41('0x37')](_0x401498);};module['exports']=EmailChannel; \ No newline at end of file +var _0x9631=['then','Mail\x20accepted\x20from\x20routing','catch','Mail\x20not\x20accepted\x20from\x20routing\x20%s','lastSync','sendMail','verifySmtp','Smtp','verify','exports','moment','bluebird','md5','ioredis','../../../config/environment','../../../config/logger','email','redis','defaults','localhost','socket.io-emitter','./imap','../rpc/mailAccount','info','start\x20email\x20channel','smtp','prototype','mailAccounts','name','key','Imap','total','isNil','stringify','emit','mailAccount:update','refresh','active','imapAccounts','box','handleImapBox','bind','handleImapEmail','end','handleImapEnd','error','handleImapError','status','disabled','messageStatus','connected','messages','New\x20email\x20from\x20%s\x20%s\x20%s\x20to\x20%s','firstName','lastName','from','notify'];(function(_0x45b1e3,_0x6c002d){var _0x8e1aad=function(_0x2625f0){while(--_0x2625f0){_0x45b1e3['push'](_0x45b1e3['shift']());}};_0x8e1aad(++_0x6c002d);}(_0x9631,0x7c));var _0x1963=function(_0x1ef510,_0x431218){_0x1ef510=_0x1ef510-0x0;var _0x18ed0e=_0x9631[_0x1ef510];return _0x18ed0e;};'use strict';var _=require('lodash');var moment=require(_0x1963('0x0'));var BPromise=require(_0x1963('0x1'));var md5=require(_0x1963('0x2'));var Redis=require(_0x1963('0x3'));var config=require(_0x1963('0x4'));var logger=require(_0x1963('0x5'))(_0x1963('0x6'));config[_0x1963('0x7')]=_[_0x1963('0x8')](config[_0x1963('0x7')],{'host':_0x1963('0x9'),'port':0x18eb});var io=require(_0x1963('0xa'))(new Redis(config[_0x1963('0x7')]));var EmailImap=require(_0x1963('0xb'));var EmailSmtp=require('./smtp');var mailAccount=require(_0x1963('0xc'));var md5Accounts={};function EmailChannel(_0x1adf87){logger[_0x1963('0xd')](_0x1963('0xe'));this['mailAccounts']=_0x1adf87['mailAccounts'];this['imapAccounts']={};this[_0x1963('0xf')]=new EmailSmtp();}EmailChannel[_0x1963('0x10')]['emit']=function(_0x2b239a){var _0x13ab4f=this[_0x1963('0x11')][_0x2b239a];var _0x5111a0={'id':_0x13ab4f['id'],'name':_0x13ab4f[_0x1963('0x12')],'key':_0x13ab4f[_0x1963('0x13')],'active':_0x13ab4f['active'],'Imap':{'status':_0x13ab4f[_0x1963('0x14')]['status'],'messageStatus':_0x13ab4f[_0x1963('0x14')]['messageStatus'],'total':_0x13ab4f['Imap'][_0x1963('0x15')]}};if(_[_0x1963('0x16')](md5Accounts[_0x2b239a])){md5Accounts[_0x2b239a]={};}var _0x465d27=md5(JSON[_0x1963('0x17')](_0x5111a0));if(md5Accounts[_0x2b239a]['md5']!==_0x465d27){md5Accounts[_0x2b239a][_0x1963('0x2')]=_0x465d27;io[_0x1963('0x18')](_0x1963('0x19'),_0x5111a0);}};EmailChannel[_0x1963('0x10')][_0x1963('0x1a')]=function(_0x5990d5){for(var _0x32ed74 in _0x5990d5){if(_0x5990d5['hasOwnProperty'](_0x32ed74)){if(_0x5990d5[_0x32ed74][_0x1963('0x14')]&&_0x5990d5[_0x32ed74][_0x1963('0x1b')]){var _0x1fd938=_0x5990d5[_0x32ed74][_0x1963('0x14')];if(!this[_0x1963('0x1c')]['hasOwnProperty'](_0x1fd938['id'])){this[_0x1963('0x1c')][_0x1fd938['id']]=new EmailImap(_0x1fd938,_0x5990d5[_0x32ed74][_0x1963('0x6')]);this['imapAccounts'][_0x1fd938['id']]['on'](_0x1963('0x1d'),this[_0x1963('0x1e')][_0x1963('0x1f')](this,_0x32ed74));this['imapAccounts'][_0x1fd938['id']]['on'](_0x1963('0x6'),this[_0x1963('0x20')][_0x1963('0x1f')](this,_0x32ed74));this[_0x1963('0x1c')][_0x1fd938['id']]['on'](_0x1963('0x21'),this[_0x1963('0x22')][_0x1963('0x1f')](this,_0x32ed74));this[_0x1963('0x1c')][_0x1fd938['id']]['on'](_0x1963('0x23'),this[_0x1963('0x24')][_0x1963('0x1f')](this,_0x32ed74));}}else{if(_[_0x1963('0x16')](this[_0x1963('0x11')][_0x32ed74][_0x1963('0x14')])){this[_0x1963('0x11')][_0x32ed74][_0x1963('0x14')]={};}this[_0x1963('0x11')][_0x32ed74][_0x1963('0x14')][_0x1963('0x25')]=_0x1963('0x26');this[_0x1963('0x11')][_0x32ed74][_0x1963('0x14')][_0x1963('0x27')]='';this[_0x1963('0x18')](_0x32ed74);}}}};EmailChannel[_0x1963('0x10')]['handleImapBox']=function(_0x3e2126,_0x437748){if(this[_0x1963('0x11')][_0x3e2126]){this['mailAccounts'][_0x3e2126][_0x1963('0x14')][_0x1963('0x25')]=_0x1963('0x28');this['mailAccounts'][_0x3e2126]['Imap'][_0x1963('0x27')]=_0x437748[_0x1963('0x12')];if(_0x437748['messages']){this[_0x1963('0x11')][_0x3e2126][_0x1963('0x14')][_0x1963('0x15')]=_0x437748[_0x1963('0x29')][_0x1963('0x15')];}return this[_0x1963('0x18')](_0x3e2126);}};EmailChannel[_0x1963('0x10')][_0x1963('0x20')]=function(_0x147e3e,_0x541df7){logger[_0x1963('0xd')](_0x1963('0x2a'),_0x541df7[_0x1963('0x2b')],_0x541df7[_0x1963('0x2c')],_0x541df7[_0x1963('0x2d')],_0x147e3e);if(this[_0x1963('0x11')][_0x147e3e]){return mailAccount[_0x1963('0x2e')](_0x147e3e,_0x541df7)[_0x1963('0x2f')](function(_0x4acd9e){if(_0x4acd9e){logger[_0x1963('0xd')](_0x1963('0x30'));}})[_0x1963('0x31')](function(_0x33c8e4){logger[_0x1963('0x23')](_0x1963('0x32'),JSON['stringify'](_0x33c8e4));});}};EmailChannel['prototype']['handleImapEnd']=function(_0x20f229){if(this['mailAccounts'][_0x20f229]&&this[_0x1963('0x11')][_0x20f229][_0x1963('0x14')]){if(this[_0x1963('0x1c')][this['mailAccounts'][_0x20f229]['Imap']['id']]){delete this[_0x1963('0x1c')][this[_0x1963('0x11')][_0x20f229][_0x1963('0x14')]['id']];}this[_0x1963('0x11')][_0x20f229][_0x1963('0x14')][_0x1963('0x33')]=moment();this[_0x1963('0x18')](_0x20f229);}};EmailChannel['prototype'][_0x1963('0x24')]=function(_0x694857,_0x4a97c0){if(this[_0x1963('0x11')][_0x694857]){this[_0x1963('0x11')][_0x694857][_0x1963('0x14')]['status']='error';this['mailAccounts'][_0x694857][_0x1963('0x14')][_0x1963('0x27')]=_0x4a97c0;return this[_0x1963('0x18')](_0x694857);}};EmailChannel[_0x1963('0x10')][_0x1963('0x34')]=function(_0x382ecb,_0x470514){return this['smtp']['send'](_0x382ecb,_0x470514);};EmailChannel[_0x1963('0x10')][_0x1963('0x35')]=function(_0x505886){var _0x360d40=this;if(this['mailAccounts'][_0x505886['id']]){if(_[_0x1963('0x16')](this[_0x1963('0x11')][_0x505886['id']][_0x1963('0x36')])){this['mailAccounts'][_0x505886['id']][_0x1963('0x36')]={};}this[_0x1963('0x11')][_0x505886['id']]['Smtp']['lastSync']=moment();return new BPromise(function(_0x782eaa,_0x3eca97){return _0x360d40['smtp'][_0x1963('0x37')](_0x505886)['then'](function(_0xede926){_0x360d40[_0x1963('0x11')][_0x505886['id']][_0x1963('0x36')][_0x1963('0x25')]='verified';_0x360d40[_0x1963('0x11')][_0x505886['id']]['Smtp'][_0x1963('0x27')]='';_0x360d40[_0x1963('0x18')](_0x505886['id']);_0x782eaa(_0xede926);})[_0x1963('0x31')](function(_0x44725f){_0x360d40[_0x1963('0x11')][_0x505886['id']][_0x1963('0x36')][_0x1963('0x25')]=_0x1963('0x23');_0x360d40['mailAccounts'][_0x505886['id']]['Smtp'][_0x1963('0x27')]=_0x44725f;_0x360d40[_0x1963('0x18')](_0x505886['id']);_0x3eca97(_0x44725f);});});}return this[_0x1963('0xf')][_0x1963('0x37')](_0x505886);};module[_0x1963('0x38')]=EmailChannel; \ No newline at end of file diff --git a/server/services/email/lib/imap.js b/server/services/email/lib/imap.js index 43f8f21..bced904 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 _0x4959=['autotls','required','getHost','anonymous@xcally.com','openBox','handleOpenBox','prototype','handleError','box','end','search','handleReadUnseen','length','fetch','handleFetchError','closeBox','handleCloseBox','handleFetchMessage','body','handleMessageBody','once','attributes','handleMessageAttributes','handleSimpleParser','parser','emit','handleFetchEnd','handleEnd','textCode','hasOwnProperty','exports','path','util','imap','randomstring','mailparser','simpleParser','iconv','Iconv','events','./utils','../../../config/logger','email','mailbox','INBOX','account','handleReady','bind','error','connect','connTimeout','isNil','service','authentication','user','password','host','port','tls'];(function(_0x4fc800,_0x417680){var _0x5c1376=function(_0x1999ab){while(--_0x1999ab){_0x4fc800['push'](_0x4fc800['shift']());}};_0x5c1376(++_0x417680);}(_0x4959,0x181));var _0x9495=function(_0x5ba5e0,_0x455634){_0x5ba5e0=_0x5ba5e0-0x0;var _0x2fda7f=_0x4959[_0x5ba5e0];return _0x2fda7f;};'use strict';var fs=require('fs');var path=require(_0x9495('0x0'));var util=require(_0x9495('0x1'));var Imap=require(_0x9495('0x2'));var _=require('lodash');var rs=require(_0x9495('0x3'));var simpleParser=require(_0x9495('0x4'))[_0x9495('0x5')];var Iconv=require(_0x9495('0x6'))[_0x9495('0x7')];var EventEmitter=require(_0x9495('0x8'))['EventEmitter'];var utils=require(_0x9495('0x9'));var logger=require(_0x9495('0xa'))(_0x9495('0xb'));function EmailImap(_0x581d56,_0x17a994){this[_0x9495('0xc')]=_0x9495('0xd');this[_0x9495('0xe')]=this['getAccount'](_0x581d56,_0x17a994);this['imap']=new Imap(this[_0x9495('0xe')]);this[_0x9495('0x2')]['once']('ready',this[_0x9495('0xf')][_0x9495('0x10')](this));this[_0x9495('0x2')]['once']('end',this['handleEnd'][_0x9495('0x10')](this));this[_0x9495('0x2')]['on'](_0x9495('0x11'),this['handleError'][_0x9495('0x10')](this));this['imap'][_0x9495('0x12')]();}util['inherits'](EmailImap,EventEmitter);EmailImap['prototype']['getAccount']=function(_0x4a7fbd,_0x36e8c6){var _0x2c1bbe={'connTimeout':_0x4a7fbd[_0x9495('0x13')]?_0x4a7fbd[_0x9495('0x13')]*0x3e8:0x2710,'authTimeout':_0x4a7fbd['authTimeout']?_0x4a7fbd['authTimeout']*0x3e8:0x1388};if(_[_0x9495('0x14')](_0x4a7fbd[_0x9495('0x15')])){if(_0x4a7fbd[_0x9495('0x16')]){_0x2c1bbe[_0x9495('0x17')]=_0x4a7fbd[_0x9495('0x17')];_0x2c1bbe['password']=_0x4a7fbd[_0x9495('0x18')];}_0x2c1bbe['host']=_0x4a7fbd[_0x9495('0x19')];_0x2c1bbe[_0x9495('0x1a')]=_0x4a7fbd[_0x9495('0x1a')]||0x3e1;if(_0x4a7fbd[_0x9495('0x1b')]){_0x2c1bbe[_0x9495('0x1b')]=!![];}else{_0x2c1bbe['tls']=![];_0x2c1bbe[_0x9495('0x1c')]=_0x9495('0x1d');}}else{_0x2c1bbe['user']=_0x4a7fbd[_0x9495('0x17')];_0x2c1bbe[_0x9495('0x18')]=_0x4a7fbd[_0x9495('0x18')];_0x2c1bbe[_0x9495('0x19')]=utils[_0x9495('0x1e')](_0x4a7fbd[_0x9495('0x15')]);_0x2c1bbe[_0x9495('0x1a')]=0x3e1;_0x2c1bbe[_0x9495('0x1b')]=!![];}_0x2c1bbe[_0x9495('0xb')]=_0x36e8c6||_0x4a7fbd['user']||_0x9495('0x1f');return _0x2c1bbe;};EmailImap['prototype'][_0x9495('0xf')]=function(){this[_0x9495('0x2')][_0x9495('0x20')](this[_0x9495('0xc')],![],this[_0x9495('0x21')][_0x9495('0x10')](this));};EmailImap[_0x9495('0x22')][_0x9495('0x21')]=function(_0x178494,_0x38011d){if(_0x178494){this[_0x9495('0x23')](_0x178494,!![]);}else{this['emit'](_0x9495('0x24'),_0x38011d);this['readUnseen']();}};EmailImap[_0x9495('0x22')]['handleCloseBox']=function(_0x1dac4f){if(_0x1dac4f){this[_0x9495('0x23')](_0x1dac4f,!![]);}else{this[_0x9495('0x2')][_0x9495('0x25')]();}};EmailImap['prototype']['readUnseen']=function(){this['imap'][_0x9495('0x26')](['UNSEEN'],this[_0x9495('0x27')][_0x9495('0x10')](this));};EmailImap[_0x9495('0x22')][_0x9495('0x27')]=function(_0x49402c,_0x3397f9){if(_0x49402c){this['handleError'](_0x49402c,!![]);}else{if(_0x3397f9[_0x9495('0x28')]){try{var _0x41d1f6=this[_0x9495('0x2')][_0x9495('0x29')](_0x3397f9,{'bodies':'','markSeen':!![]});_0x41d1f6['on']('message',this['handleFetchMessage'][_0x9495('0x10')](this));_0x41d1f6['once'](_0x9495('0x11'),this[_0x9495('0x2a')]['bind'](this));_0x41d1f6['once'](_0x9495('0x25'),this['handleFetchEnd'][_0x9495('0x10')](this));}catch(_0x23d2a8){logger[_0x9495('0x11')](_0x23d2a8);}}else{this[_0x9495('0x2')][_0x9495('0x2b')](!![],this[_0x9495('0x2c')][_0x9495('0x10')](this));}}};EmailImap[_0x9495('0x22')][_0x9495('0x2d')]=function(_0x28a089,_0x4bd247){_0x28a089['on'](_0x9495('0x2e'),this[_0x9495('0x2f')][_0x9495('0x10')](this));_0x28a089[_0x9495('0x30')](_0x9495('0x31'),this[_0x9495('0x32')]['bind'](this));_0x28a089[_0x9495('0x30')](_0x9495('0x25'),this['handleMessageEnd'][_0x9495('0x10')](this));};EmailImap['prototype']['handleMessageBody']=function(_0x318fe1,_0x5c0421){simpleParser(_0x318fe1,{'Iconv':Iconv},this[_0x9495('0x33')][_0x9495('0x10')](this));};EmailImap[_0x9495('0x22')][_0x9495('0x32')]=function(_0x470fb2){};EmailImap[_0x9495('0x22')]['handleMessageEnd']=function(){};EmailImap[_0x9495('0x22')][_0x9495('0x33')]=function(_0x3b8b18,_0x38ebe9){if(_0x3b8b18){logger[_0x9495('0x11')](_0x3b8b18);}else{var _0x159895=this;utils[_0x9495('0x34')](this[_0x9495('0xe')],_0x38ebe9,function(_0x30d91e){_0x159895[_0x9495('0x35')](_0x9495('0xb'),_0x30d91e);});}};EmailImap[_0x9495('0x22')][_0x9495('0x36')]=function(){this[_0x9495('0x2')]['closeBox'](!![],this['handleCloseBox'][_0x9495('0x10')](this));};EmailImap[_0x9495('0x22')][_0x9495('0x2a')]=function(_0x5ca987){this[_0x9495('0x23')](_0x5ca987);this[_0x9495('0x2')]['closeBox'](!![],this[_0x9495('0x2c')][_0x9495('0x10')](this));};EmailImap['prototype'][_0x9495('0x37')]=function(){this['emit'](_0x9495('0x25'));};EmailImap[_0x9495('0x22')]['handleError']=function(_0x14ffb3,_0x46a473){logger[_0x9495('0x11')](_0x9495('0x23'),this[_0x9495('0xe')][_0x9495('0xb')],JSON['stringify'](_0x14ffb3));var _0x4d6d2e='';if(_0x14ffb3){if(_0x14ffb3[_0x9495('0x38')]){_0x4d6d2e=_0x14ffb3[_0x9495('0x38')];}else{for(var _0x3f91ae in _0x14ffb3){if(_0x14ffb3[_0x9495('0x39')](_0x3f91ae)){_0x4d6d2e+=_['upperFirst'](_0x3f91ae)+':\x20'+_0x14ffb3[_0x3f91ae]+'\x0a';}}}}if(_0x46a473){this[_0x9495('0x2')][_0x9495('0x25')]();}else{this[_0x9495('0x35')](_0x9495('0x11'),_0x4d6d2e);this[_0x9495('0x35')](_0x9495('0x25'));}};module[_0x9495('0x3a')]=EmailImap; \ No newline at end of file +var _0x9937=['message','handleFetchMessage','handleFetchError','end','handleFetchEnd','closeBox','body','handleMessageBody','attributes','handleMessageAttributes','handleMessageEnd','parser','stringify','textCode','hasOwnProperty','upperFirst','path','util','imap','randomstring','mailparser','simpleParser','iconv','Iconv','events','EventEmitter','./utils','../../../config/logger','email','INBOX','account','getAccount','once','ready','handleReady','bind','handleEnd','error','connect','inherits','authTimeout','isNil','service','authentication','user','password','port','tls','required','host','getHost','anonymous@xcally.com','openBox','mailbox','prototype','handleOpenBox','handleError','emit','box','readUnseen','handleCloseBox','search','UNSEEN','handleReadUnseen','length'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x9937,0x196));var _0x7993=function(_0x3c92c8,_0x534b00){_0x3c92c8=_0x3c92c8-0x0;var _0x38885d=_0x9937[_0x3c92c8];return _0x38885d;};'use strict';var fs=require('fs');var path=require(_0x7993('0x0'));var util=require(_0x7993('0x1'));var Imap=require(_0x7993('0x2'));var _=require('lodash');var rs=require(_0x7993('0x3'));var simpleParser=require(_0x7993('0x4'))[_0x7993('0x5')];var Iconv=require(_0x7993('0x6'))[_0x7993('0x7')];var EventEmitter=require(_0x7993('0x8'))[_0x7993('0x9')];var utils=require(_0x7993('0xa'));var logger=require(_0x7993('0xb'))(_0x7993('0xc'));function EmailImap(_0xb95140,_0x507282){this['mailbox']=_0x7993('0xd');this[_0x7993('0xe')]=this[_0x7993('0xf')](_0xb95140,_0x507282);this[_0x7993('0x2')]=new Imap(this[_0x7993('0xe')]);this[_0x7993('0x2')][_0x7993('0x10')](_0x7993('0x11'),this[_0x7993('0x12')][_0x7993('0x13')](this));this[_0x7993('0x2')][_0x7993('0x10')]('end',this[_0x7993('0x14')]['bind'](this));this['imap']['on'](_0x7993('0x15'),this['handleError'][_0x7993('0x13')](this));this['imap'][_0x7993('0x16')]();}util[_0x7993('0x17')](EmailImap,EventEmitter);EmailImap['prototype'][_0x7993('0xf')]=function(_0x5ae274,_0x2e3e57){var _0x15b59c={'connTimeout':_0x5ae274['connTimeout']?_0x5ae274['connTimeout']*0x3e8:0x2710,'authTimeout':_0x5ae274[_0x7993('0x18')]?_0x5ae274[_0x7993('0x18')]*0x3e8:0x1388};if(_[_0x7993('0x19')](_0x5ae274[_0x7993('0x1a')])){if(_0x5ae274[_0x7993('0x1b')]){_0x15b59c[_0x7993('0x1c')]=_0x5ae274[_0x7993('0x1c')];_0x15b59c[_0x7993('0x1d')]=_0x5ae274['password'];}_0x15b59c['host']=_0x5ae274['host'];_0x15b59c[_0x7993('0x1e')]=_0x5ae274[_0x7993('0x1e')]||0x3e1;if(_0x5ae274[_0x7993('0x1f')]){_0x15b59c[_0x7993('0x1f')]=!![];}else{_0x15b59c[_0x7993('0x1f')]=![];_0x15b59c['autotls']=_0x7993('0x20');}}else{_0x15b59c[_0x7993('0x1c')]=_0x5ae274[_0x7993('0x1c')];_0x15b59c[_0x7993('0x1d')]=_0x5ae274['password'];_0x15b59c[_0x7993('0x21')]=utils[_0x7993('0x22')](_0x5ae274[_0x7993('0x1a')]);_0x15b59c['port']=0x3e1;_0x15b59c[_0x7993('0x1f')]=!![];}_0x15b59c[_0x7993('0xc')]=_0x2e3e57||_0x5ae274['user']||_0x7993('0x23');return _0x15b59c;};EmailImap['prototype'][_0x7993('0x12')]=function(){this[_0x7993('0x2')][_0x7993('0x24')](this[_0x7993('0x25')],![],this['handleOpenBox']['bind'](this));};EmailImap[_0x7993('0x26')][_0x7993('0x27')]=function(_0x51632e,_0x78cedd){if(_0x51632e){this[_0x7993('0x28')](_0x51632e,!![]);}else{this[_0x7993('0x29')](_0x7993('0x2a'),_0x78cedd);this[_0x7993('0x2b')]();}};EmailImap[_0x7993('0x26')][_0x7993('0x2c')]=function(_0x4426a8){if(_0x4426a8){this['handleError'](_0x4426a8,!![]);}else{this['imap']['end']();}};EmailImap['prototype']['readUnseen']=function(){this[_0x7993('0x2')][_0x7993('0x2d')]([_0x7993('0x2e')],this[_0x7993('0x2f')]['bind'](this));};EmailImap[_0x7993('0x26')][_0x7993('0x2f')]=function(_0x4088c1,_0xeb24aa){if(_0x4088c1){this['handleError'](_0x4088c1,!![]);}else{if(_0xeb24aa[_0x7993('0x30')]){try{var _0x3a48b9=this[_0x7993('0x2')]['fetch'](_0xeb24aa,{'bodies':'','markSeen':!![]});_0x3a48b9['on'](_0x7993('0x31'),this[_0x7993('0x32')][_0x7993('0x13')](this));_0x3a48b9[_0x7993('0x10')]('error',this[_0x7993('0x33')]['bind'](this));_0x3a48b9[_0x7993('0x10')](_0x7993('0x34'),this[_0x7993('0x35')][_0x7993('0x13')](this));}catch(_0x59d375){logger['error'](_0x59d375);}}else{this[_0x7993('0x2')][_0x7993('0x36')](!![],this[_0x7993('0x2c')][_0x7993('0x13')](this));}}};EmailImap[_0x7993('0x26')]['handleFetchMessage']=function(_0x3f9462,_0x176b68){_0x3f9462['on'](_0x7993('0x37'),this[_0x7993('0x38')][_0x7993('0x13')](this));_0x3f9462[_0x7993('0x10')](_0x7993('0x39'),this[_0x7993('0x3a')][_0x7993('0x13')](this));_0x3f9462['once']('end',this[_0x7993('0x3b')][_0x7993('0x13')](this));};EmailImap[_0x7993('0x26')]['handleMessageBody']=function(_0x93e11d,_0x2a5210){simpleParser(_0x93e11d,{'Iconv':Iconv},this['handleSimpleParser'][_0x7993('0x13')](this));};EmailImap[_0x7993('0x26')][_0x7993('0x3a')]=function(_0x2aef78){};EmailImap[_0x7993('0x26')][_0x7993('0x3b')]=function(){};EmailImap[_0x7993('0x26')]['handleSimpleParser']=function(_0x545cad,_0x108cde){if(_0x545cad){logger['error'](_0x545cad);}else{var _0x3a49a9=this;utils[_0x7993('0x3c')](this[_0x7993('0xe')],_0x108cde,function(_0x3cf8e1){_0x3a49a9[_0x7993('0x29')]('email',_0x3cf8e1);});}};EmailImap[_0x7993('0x26')][_0x7993('0x35')]=function(){this['imap'][_0x7993('0x36')](!![],this[_0x7993('0x2c')]['bind'](this));};EmailImap['prototype'][_0x7993('0x33')]=function(_0x46449a){this[_0x7993('0x28')](_0x46449a);this['imap'][_0x7993('0x36')](!![],this['handleCloseBox'][_0x7993('0x13')](this));};EmailImap[_0x7993('0x26')][_0x7993('0x14')]=function(){this[_0x7993('0x29')](_0x7993('0x34'));};EmailImap[_0x7993('0x26')][_0x7993('0x28')]=function(_0x1f9434,_0x3b517b){logger[_0x7993('0x15')](_0x7993('0x28'),this[_0x7993('0xe')][_0x7993('0xc')],JSON[_0x7993('0x3d')](_0x1f9434));var _0x26e285='';if(_0x1f9434){if(_0x1f9434['textCode']){_0x26e285=_0x1f9434[_0x7993('0x3e')];}else{for(var _0x134bc1 in _0x1f9434){if(_0x1f9434[_0x7993('0x3f')](_0x134bc1)){_0x26e285+=_[_0x7993('0x40')](_0x134bc1)+':\x20'+_0x1f9434[_0x134bc1]+'\x0a';}}}}if(_0x3b517b){this[_0x7993('0x2')][_0x7993('0x34')]();}else{this[_0x7993('0x29')](_0x7993('0x15'),_0x26e285);this['emit'](_0x7993('0x34'));}};module['exports']=EmailImap; \ No newline at end of file diff --git a/server/services/email/lib/smtp.js b/server/services/email/lib/smtp.js index 6c370b4..2eb0faf 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 _0xa3ff=['nodemailer-plugin-inline-base64','prototype','send','use','compile','sendMail','toString','createTransport','verify','exports','nodemailer','bluebird'];(function(_0x5d1a00,_0x89d2bd){var _0x19968a=function(_0x28e381){while(--_0x28e381){_0x5d1a00['push'](_0x5d1a00['shift']());}};_0x19968a(++_0x89d2bd);}(_0xa3ff,0xd6));var _0xfa3f=function(_0xcce6b4,_0xbb6e1c){_0xcce6b4=_0xcce6b4-0x0;var _0xba54ca=_0xa3ff[_0xcce6b4];return _0xba54ca;};'use strict';var nodemailer=require(_0xfa3f('0x0'));var BPromise=require(_0xfa3f('0x1'));var inlineBase64=require(_0xfa3f('0x2'));function EmailSmtp(){}EmailSmtp[_0xfa3f('0x3')][_0xfa3f('0x4')]=function(_0x29f176,_0x266bed){return new BPromise(function(_0x5baa67,_0x469d2d){var _0xb3adb4=nodemailer['createTransport'](_0x29f176);_0xb3adb4[_0xfa3f('0x5')](_0xfa3f('0x6'),inlineBase64());_0xb3adb4[_0xfa3f('0x7')](_0x266bed,function(_0x52bd35,_0x10d6ed){if(_0x52bd35){_0x469d2d(_0x52bd35[_0xfa3f('0x8')]());}else{_0x5baa67(_0x10d6ed);}});});};EmailSmtp[_0xfa3f('0x3')]['verify']=function(_0x435d44){return new BPromise(function(_0x1e1003,_0x1da2e9){var _0x170d86=nodemailer[_0xfa3f('0x9')](_0x435d44);_0x170d86[_0xfa3f('0xa')](function(_0x430cbc,_0x484114){if(_0x430cbc){_0x1da2e9(_0x430cbc['toString']());}else{if(_0x484114){_0x1e1003(_0x484114);}else{_0x1da2e9('Not\x20verifired');}}});});};module[_0xfa3f('0xb')]=EmailSmtp; \ No newline at end of file +var _0x0be6=['send','createTransport','sendMail','verify','Not\x20verifired','nodemailer','nodemailer-plugin-inline-base64','prototype'];(function(_0x2e87e4,_0x591ef7){var _0x3c9855=function(_0x5e43e0){while(--_0x5e43e0){_0x2e87e4['push'](_0x2e87e4['shift']());}};_0x3c9855(++_0x591ef7);}(_0x0be6,0x10d));var _0x60be=function(_0x2b5865,_0x4c21f6){_0x2b5865=_0x2b5865-0x0;var _0x31678e=_0x0be6[_0x2b5865];return _0x31678e;};'use strict';var nodemailer=require(_0x60be('0x0'));var BPromise=require('bluebird');var inlineBase64=require(_0x60be('0x1'));function EmailSmtp(){}EmailSmtp[_0x60be('0x2')][_0x60be('0x3')]=function(_0x1f8761,_0x47d42c){return new BPromise(function(_0x256bc3,_0x28c619){var _0x4e0289=nodemailer[_0x60be('0x4')](_0x1f8761);_0x4e0289['use']('compile',inlineBase64());_0x4e0289[_0x60be('0x5')](_0x47d42c,function(_0x5cd024,_0x116778){if(_0x5cd024){_0x28c619(_0x5cd024['toString']());}else{_0x256bc3(_0x116778);}});});};EmailSmtp[_0x60be('0x2')][_0x60be('0x6')]=function(_0x388f3b){return new BPromise(function(_0x4989a9,_0x403dd3){var _0xecf0b0=nodemailer[_0x60be('0x4')](_0x388f3b);_0xecf0b0['verify'](function(_0x5df271,_0x170a7e){if(_0x5df271){_0x403dd3(_0x5df271['toString']());}else{if(_0x170a7e){_0x4989a9(_0x170a7e);}else{_0x403dd3(_0x60be('0x7'));}}});});};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 f5d8b9c..3180535 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 _0xe76d=['bcc','attachments','attach','attachment','format','%s-%s','now','root','writeFileSync','content','parser','from','subject','inReplyTo','date','YYYY-MM-DD\x20HH:mm:ss','textAsHtml','filter','application/ms-tnef','info','messageId','parseBuffer','first','Attachments','push','Title','getHost','gmail','yahoo','imap.mail.yahoo.com','imap-mail.outlook.com','outlook365','outlook.office365.com','lodash','moment','randomstring','path','util','node-tnef','../../../config/logger','email','value','address','anonymous','@xcally.com','head','name','length','slice','join','Anonymous','pop','isEmpty','generate','html','test','replace','body','message','originTo','includes','originCc'];(function(_0x7532e2,_0x3bb229){var _0xa42ad1=function(_0x51cc7e){while(--_0x51cc7e){_0x7532e2['push'](_0x7532e2['shift']());}};_0xa42ad1(++_0x3bb229);}(_0xe76d,0x9d));var _0xde76=function(_0x9df060,_0x253d33){_0x9df060=_0x9df060-0x0;var _0x338dfe=_0xe76d[_0x9df060];return _0x338dfe;};'use strict';var _=require(_0xde76('0x0'));var moment=require(_0xde76('0x1'));var random=require(_0xde76('0x2'));var fs=require('fs');var path=require(_0xde76('0x3'));var util=require(_0xde76('0x4'));var tnef=require(_0xde76('0x5'));var logger=require(_0xde76('0x6'))(_0xde76('0x7'));var config=require('../../../config/environment');function getAddress(_0x280bfb){var _0x7fc37d=_['head'](_0x280bfb[_0xde76('0x8')]);return _0x7fc37d&&_0x7fc37d[_0xde76('0x9')]?_0x7fc37d[_0xde76('0x9')]:_0xde76('0xa')+random['generate'](0x6)+_0xde76('0xb');}function getFirstName(_0x2419dc){var _0x1fc7db=_[_0xde76('0xc')](_0x2419dc[_0xde76('0x8')]);if(_0x1fc7db&&_0x1fc7db[_0xde76('0xd')]){var _0x26fab4=_0x1fc7db['name']['split'](/\s+/);return _0x26fab4[_0xde76('0xe')]?_0x26fab4[_0xde76('0xf')](0x0,-0x1)[_0xde76('0x10')]('\x20'):_0x1fc7db[_0xde76('0xd')];}return _0xde76('0x11');}function getLastName(_0x84acb6){var _0x53f927=_[_0xde76('0xc')](_0x84acb6[_0xde76('0x8')]);if(_0x53f927&&_0x53f927[_0xde76('0xd')]){var _0x419440=_0x53f927[_0xde76('0xd')]['split'](/\s+/);return _0x419440[_0xde76('0xe')]>0x1?_0x419440[_0xde76('0x12')]():'';}return'';}function getMails(_0x2481c4,_0xd75360){var _0x589570='';for(var _0xb52313=0x0;_0xb52313<_0xd75360[_0xde76('0x8')][_0xde76('0xe')];_0xb52313+=0x1){if(_0xd75360[_0xde76('0x8')][_0xb52313][_0xde76('0x9')]!==_0x2481c4){if(!_[_0xde76('0x13')](_0x589570)){_0x589570+=',';}_0x589570+=_0xd75360[_0xde76('0x8')][_0xb52313]['name']||_0xd75360['value'][_0xb52313]['address']||'';_0x589570+='\x20<';_0x589570+=_0xd75360[_0xde76('0x8')][_0xb52313][_0xde76('0x9')]?_0xd75360[_0xde76('0x8')][_0xb52313][_0xde76('0x9')]:_0xde76('0xa')+random[_0xde76('0x14')](0x6)+_0xde76('0xb');_0x589570+='>';}}return _0x589570;}function parseEmail(_0x2b1c0b,_0x7ea508,_0x3145e8){if(_0x7ea508[_0xde76('0x15')]){var _0x290d48=/)<[^<]*)*<\/script>/gi;while(_0x290d48[_0xde76('0x16')](_0x7ea508[_0xde76('0x15')])){_0x7ea508[_0xde76('0x15')]=_0x7ea508[_0xde76('0x15')][_0xde76('0x17')](_0x290d48,'');}_0x3145e8[_0xde76('0x18')]=_0x7ea508[_0xde76('0x15')];}else{_0x3145e8[_0xde76('0x18')]=_0x7ea508['textAsHtml'];}if(_0x3145e8[_0xde76('0x18')]){_0x3145e8[_0xde76('0x18')]=_0x3145e8[_0xde76('0x18')][_0xde76('0x17')](/Empty\x20message

';if(_0xfc7b4d[_0xde76('0x34')]){for(var _0x35b6bb=0x0;_0x35b6bb<_0xfc7b4d[_0xde76('0x34')][_0xde76('0xe')];_0x35b6bb++){var _0x28faa7=_0xfc7b4d[_0xde76('0x34')][_0x35b6bb];_0x195170[_0xde76('0x19')][_0xde76('0x1e')][_0xde76('0x35')]({'filename':_0x28faa7[_0xde76('0x36')],'content':new Buffer(_0x28faa7['Data'])});}}}_0x5f03cd(parseEmail(_0x2d6ce9,_0x444261,_0x195170));});}else{_0x444261[_0xde76('0x15')]='

Empty\x20message

';_0x5f03cd(parseEmail(_0x2d6ce9,_0x444261,_0x195170));}}else{_0x5f03cd(parseEmail(_0x2d6ce9,_0x444261,_0x195170));}};exports[_0xde76('0x37')]=function(_0x38a6e7){switch(_0x38a6e7){case _0xde76('0x38'):return'imap.gmail.com';case _0xde76('0x39'):return _0xde76('0x3a');case'hotmail':return _0xde76('0x3b');case _0xde76('0x3c'):return _0xde76('0x3d');}return'127.0.0.1';}; \ No newline at end of file +var _0x9756=['@xcally.com','name','split','length','slice','join','Anonymous','isEmpty','html','test','body','textAsHtml','replace','Empty\x20message

','Attachments','Data','gmail','imap.gmail.com','yahoo','hotmail','imap-mail.outlook.com','outlook365','outlook.office365.com','127.0.0.1','lodash','randomstring','path','node-tnef','email','head','value','address','anonymous','generate'];(function(_0x53f83c,_0x19f7a7){var _0x328b4b=function(_0x23bbc2){while(--_0x23bbc2){_0x53f83c['push'](_0x53f83c['shift']());}};_0x328b4b(++_0x19f7a7);}(_0x9756,0x136));var _0x6975=function(_0x4c445a,_0x4ee80f){_0x4c445a=_0x4c445a-0x0;var _0x2f611c=_0x9756[_0x4c445a];return _0x2f611c;};'use strict';var _=require(_0x6975('0x0'));var moment=require('moment');var random=require(_0x6975('0x1'));var fs=require('fs');var path=require(_0x6975('0x2'));var util=require('util');var tnef=require(_0x6975('0x3'));var logger=require('../../../config/logger')(_0x6975('0x4'));var config=require('../../../config/environment');function getAddress(_0x38f4b7){var _0x157c00=_[_0x6975('0x5')](_0x38f4b7[_0x6975('0x6')]);return _0x157c00&&_0x157c00['address']?_0x157c00[_0x6975('0x7')]:_0x6975('0x8')+random[_0x6975('0x9')](0x6)+_0x6975('0xa');}function getFirstName(_0x347b5e){var _0x656a7f=_['head'](_0x347b5e[_0x6975('0x6')]);if(_0x656a7f&&_0x656a7f[_0x6975('0xb')]){var _0x3a9e39=_0x656a7f[_0x6975('0xb')][_0x6975('0xc')](/\s+/);return _0x3a9e39[_0x6975('0xd')]?_0x3a9e39[_0x6975('0xe')](0x0,-0x1)[_0x6975('0xf')]('\x20'):_0x656a7f[_0x6975('0xb')];}return _0x6975('0x10');}function getLastName(_0x3898ce){var _0x1219b9=_[_0x6975('0x5')](_0x3898ce[_0x6975('0x6')]);if(_0x1219b9&&_0x1219b9[_0x6975('0xb')]){var _0x3ff212=_0x1219b9[_0x6975('0xb')][_0x6975('0xc')](/\s+/);return _0x3ff212[_0x6975('0xd')]>0x1?_0x3ff212['pop']():'';}return'';}function getMails(_0x4c8293,_0x5f5ced){var _0x2ffcf7='';for(var _0x1eb377=0x0;_0x1eb377<_0x5f5ced[_0x6975('0x6')][_0x6975('0xd')];_0x1eb377+=0x1){if(_0x5f5ced['value'][_0x1eb377][_0x6975('0x7')]!==_0x4c8293){if(!_[_0x6975('0x11')](_0x2ffcf7)){_0x2ffcf7+=',';}_0x2ffcf7+=_0x5f5ced[_0x6975('0x6')][_0x1eb377][_0x6975('0xb')]||_0x5f5ced[_0x6975('0x6')][_0x1eb377]['address']||'';_0x2ffcf7+='\x20<';_0x2ffcf7+=_0x5f5ced['value'][_0x1eb377]['address']?_0x5f5ced['value'][_0x1eb377]['address']:'anonymous'+random[_0x6975('0x9')](0x6)+_0x6975('0xa');_0x2ffcf7+='>';}}return _0x2ffcf7;}function parseEmail(_0x18cd95,_0x13daa3,_0x2bca3c){if(_0x13daa3[_0x6975('0x12')]){var _0x2bd7a0=/)<[^<]*)*<\/script>/gi;while(_0x2bd7a0[_0x6975('0x13')](_0x13daa3['html'])){_0x13daa3[_0x6975('0x12')]=_0x13daa3[_0x6975('0x12')]['replace'](_0x2bd7a0,'');}_0x2bca3c[_0x6975('0x14')]=_0x13daa3[_0x6975('0x12')];}else{_0x2bca3c[_0x6975('0x14')]=_0x13daa3[_0x6975('0x15')];}if(_0x2bca3c[_0x6975('0x14')]){_0x2bca3c['body']=_0x2bca3c[_0x6975('0x14')][_0x6975('0x16')](/0x0){if(this[_0x3f1697+_0x534e('0x25')]>0x0&&this[_0x3f1697+_0x534e('0x24')]>=this[_0x3f1697+_0x534e('0x25')]){return _0x534e('0x26');}else{return _0x534e('0x27');}}else{return _0x534e('0x28');}};Agent[_0x534e('0x23')]['updateRealtime']=function(){var _0x188020=[_0x534e('0x29'),_0x534e('0x2a'),_0x534e('0x2b'),_0x534e('0x2c'),_0x534e('0x2d')];for(var _0xf60d40=0x0;_0xf60d40<_0x188020[_0x534e('0x2e')];_0xf60d40+=0x1){var _0x53a6ef=this[_0x534e('0x2f')](_0x188020[_0xf60d40]);if(this[_0x188020[_0xf60d40]+'Status']!==_0x53a6ef){this[_0x188020[_0xf60d40]+_0x534e('0x30')]=_[_0x534e('0x31')](moment()[_0x534e('0x32')]('x'));}this[_0x188020[_0xf60d40]+_0x534e('0x33')]=_0x53a6ef;}var _0x174577={'id':this['id'],'name':this['name'],'online':this[_0x534e('0x7')],'voicePause':this[_0x534e('0x8')],'chatPause':this['chatPause'],'mailPause':this['mailPause'],'smsPause':this[_0x534e('0xb')],'faxPause':this['faxPause'],'openchannelPause':this[_0x534e('0xc')],'chatStatus':this[_0x534e('0xd')],'chatStatusTime':this[_0x534e('0xe')],'chatCapacity':this[_0x534e('0xf')],'chatCurrentCapacity':this[_0x534e('0x10')],'mailStatus':this[_0x534e('0x11')],'mailStatusTime':this[_0x534e('0x12')],'mailCapacity':this['mailCapacity'],'mailCurrentCapacity':this['mailCurrentCapacity'],'faxStatus':this[_0x534e('0x15')],'faxStatusTime':this[_0x534e('0x17')],'faxCapacity':this[_0x534e('0x18')],'faxCurrentCapacity':this[_0x534e('0x34')],'smsStatus':this[_0x534e('0x19')],'smsStatusTime':this[_0x534e('0x35')],'smsCapacity':this[_0x534e('0x1a')],'smsCurrentCapacity':this[_0x534e('0x1b')],'openchannelStatus':this[_0x534e('0x1c')],'openchannelStatusTime':this[_0x534e('0x1d')],'openchannelCapacity':this[_0x534e('0x1e')],'openchannelCurrentCapacity':this[_0x534e('0x36')],'busy':this['busy'],'busyQueue':this[_0x534e('0x20')]};var _0x3ad091=md5(JSON['stringify'](_0x174577));if(this[_0x534e('0x21')]!==_0x3ad091){this['md5']=_0x3ad091;io[_0x534e('0x37')](_0x534e('0x38'),_0x174577);}};module[_0x534e('0x39')]=Agent; \ No newline at end of file +var _0xf3cd=['smsCapacity','smsCurrentCapacity','openchannelStatusTime','openchannelCapacity','openchannelCurrentCapacity','busy','busyQueue','updateRealtime','prototype','getChannelStatus','CurrentCapacity','Capacity','working','idle','mail','openchannel','fax','sms','length','Status','StatusTime','toNumber','openchannelStatus','stringify','user:save','exports','lodash','moment','md5','ioredis','../../../config/environment','redis','localhost','socket.io-emitter','name','online','voicePause','chatPause','mailPause','faxPause','smsPause','openchannelPause','chatStatus','unknown','chatStatusTime','chatCapacity','chatCurrentCapacity','mailStatus','mailStatusTime','mailCapacity','mailCurrentCapacity','faxStatus','faxStatusTime','faxCapacity','faxCurrentCapacity','smsStatus','smsStatusTime'];(function(_0xe02de8,_0x30f9cf){var _0x22a2e4=function(_0x345ba9){while(--_0x345ba9){_0xe02de8['push'](_0xe02de8['shift']());}};_0x22a2e4(++_0x30f9cf);}(_0xf3cd,0xfe));var _0xdf3c=function(_0x754ab4,_0x56daa7){_0x754ab4=_0x754ab4-0x0;var _0x34079a=_0xf3cd[_0x754ab4];return _0x34079a;};'use strict';var _=require(_0xdf3c('0x0'));var moment=require(_0xdf3c('0x1'));var md5=require(_0xdf3c('0x2'));var Redis=require(_0xdf3c('0x3'));var config=require(_0xdf3c('0x4'));config[_0xdf3c('0x5')]=_['defaults'](config[_0xdf3c('0x5')],{'host':_0xdf3c('0x6'),'port':0x18eb});var io=require(_0xdf3c('0x7'))(new Redis(config['redis']));function Agent(_0x111a2e){this['id']=_0x111a2e['id']||0x0;this[_0xdf3c('0x8')]=_0x111a2e[_0xdf3c('0x8')]||'';this[_0xdf3c('0x9')]=_0x111a2e[_0xdf3c('0x9')]||!![];this[_0xdf3c('0xa')]=_0x111a2e['voicePause']||![];this[_0xdf3c('0xb')]=_0x111a2e['chatPause']||![];this['mailPause']=_0x111a2e[_0xdf3c('0xc')]||![];this[_0xdf3c('0xd')]=_0x111a2e['faxPause']||![];this[_0xdf3c('0xe')]=_0x111a2e[_0xdf3c('0xe')]||![];this[_0xdf3c('0xf')]=_0x111a2e[_0xdf3c('0xf')]||![];this[_0xdf3c('0x10')]=_0xdf3c('0x11');this[_0xdf3c('0x12')]=0x0;this[_0xdf3c('0x13')]=_0x111a2e['chatCapacity']||0x0;this[_0xdf3c('0x14')]=0x0;this[_0xdf3c('0x15')]=_0xdf3c('0x11');this[_0xdf3c('0x16')]=0x0;this['mailCapacity']=_0x111a2e[_0xdf3c('0x17')]||0x0;this[_0xdf3c('0x18')]=0x0;this[_0xdf3c('0x19')]='unknown';this[_0xdf3c('0x1a')]=0x0;this[_0xdf3c('0x1b')]=_0x111a2e[_0xdf3c('0x1b')]||0x0;this[_0xdf3c('0x1c')]=0x0;this[_0xdf3c('0x1d')]=_0xdf3c('0x11');this[_0xdf3c('0x1e')]=0x0;this[_0xdf3c('0x1f')]=_0x111a2e[_0xdf3c('0x1f')]||0x0;this[_0xdf3c('0x20')]=0x0;this['openchannelStatus']=_0xdf3c('0x11');this[_0xdf3c('0x21')]=0x0;this[_0xdf3c('0x22')]=_0x111a2e[_0xdf3c('0x22')]||0x0;this[_0xdf3c('0x23')]=0x0;this[_0xdf3c('0x24')]=![];this[_0xdf3c('0x25')]=undefined;this[_0xdf3c('0x2')]='';this[_0xdf3c('0x26')]();}Agent[_0xdf3c('0x27')][_0xdf3c('0x28')]=function(_0x3d14cc){if(this[_0x3d14cc+_0xdf3c('0x29')]>0x0){if(this[_0x3d14cc+'Capacity']>0x0&&this[_0x3d14cc+'CurrentCapacity']>=this[_0x3d14cc+_0xdf3c('0x2a')]){return'maxcapacity';}else{return _0xdf3c('0x2b');}}else{return _0xdf3c('0x2c');}};Agent[_0xdf3c('0x27')][_0xdf3c('0x26')]=function(){var _0x33652f=[_0xdf3c('0x2d'),'chat',_0xdf3c('0x2e'),_0xdf3c('0x2f'),_0xdf3c('0x30')];for(var _0x24754a=0x0;_0x24754a<_0x33652f[_0xdf3c('0x31')];_0x24754a+=0x1){var _0x3b5371=this[_0xdf3c('0x28')](_0x33652f[_0x24754a]);if(this[_0x33652f[_0x24754a]+_0xdf3c('0x32')]!==_0x3b5371){this[_0x33652f[_0x24754a]+_0xdf3c('0x33')]=_[_0xdf3c('0x34')](moment()['format']('x'));}this[_0x33652f[_0x24754a]+_0xdf3c('0x32')]=_0x3b5371;}var _0x153daa={'id':this['id'],'name':this['name'],'online':this[_0xdf3c('0x9')],'voicePause':this['voicePause'],'chatPause':this['chatPause'],'mailPause':this['mailPause'],'smsPause':this[_0xdf3c('0xe')],'faxPause':this[_0xdf3c('0xd')],'openchannelPause':this['openchannelPause'],'chatStatus':this['chatStatus'],'chatStatusTime':this[_0xdf3c('0x12')],'chatCapacity':this[_0xdf3c('0x13')],'chatCurrentCapacity':this[_0xdf3c('0x14')],'mailStatus':this[_0xdf3c('0x15')],'mailStatusTime':this['mailStatusTime'],'mailCapacity':this[_0xdf3c('0x17')],'mailCurrentCapacity':this[_0xdf3c('0x18')],'faxStatus':this['faxStatus'],'faxStatusTime':this['faxStatusTime'],'faxCapacity':this[_0xdf3c('0x1b')],'faxCurrentCapacity':this[_0xdf3c('0x1c')],'smsStatus':this[_0xdf3c('0x1d')],'smsStatusTime':this['smsStatusTime'],'smsCapacity':this[_0xdf3c('0x1f')],'smsCurrentCapacity':this[_0xdf3c('0x20')],'openchannelStatus':this[_0xdf3c('0x35')],'openchannelStatusTime':this[_0xdf3c('0x21')],'openchannelCapacity':this['openchannelCapacity'],'openchannelCurrentCapacity':this[_0xdf3c('0x23')],'busy':this[_0xdf3c('0x24')],'busyQueue':this['busyQueue']};var _0x40ae3d=md5(JSON[_0xdf3c('0x36')](_0x153daa));if(this[_0xdf3c('0x2')]!==_0x40ae3d){this[_0xdf3c('0x2')]=_0x40ae3d;io['emit'](_0xdf3c('0x37'),_0x153daa);}};module[_0xdf3c('0x38')]=Agent; \ No newline at end of file diff --git a/server/services/routing/model/chatQueue.js b/server/services/routing/model/chatQueue.js index c6ece9d..763c69e 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 _0x9e92=['Agents','updateRealtime','prototype','updateRouting','mapAgentsId','map','loggedIn','paused','length','online','chatPause','available','name','stringify','format','chat:queue:%s','chat_queue:save','exports','lodash','md5','util','ioredis','../../../config/environment','redis','localhost','socket.io-emitter','strategy'];(function(_0x44ffeb,_0x1aa2ce){var _0x222237=function(_0x1ca99a){while(--_0x1ca99a){_0x44ffeb['push'](_0x44ffeb['shift']());}};_0x222237(++_0x1aa2ce);}(_0x9e92,0x105));var _0x29e9=function(_0x3996fd,_0x436a5b){_0x3996fd=_0x3996fd-0x0;var _0x511060=_0x9e92[_0x3996fd];return _0x511060;};'use strict';var _=require(_0x29e9('0x0'));var md5=require(_0x29e9('0x1'));var util=require(_0x29e9('0x2'));var Redis=require(_0x29e9('0x3'));var config=require(_0x29e9('0x4'));config[_0x29e9('0x5')]=_['defaults'](config[_0x29e9('0x5')],{'host':_0x29e9('0x6'),'port':0x18eb});var io=require(_0x29e9('0x7'))(new Redis(config[_0x29e9('0x5')]));function ChatQueue(_0x5a493b){this['id']=_0x5a493b['id']||0x0;this['name']=_0x5a493b['name']||'';this['timeout']=_0x5a493b['timeout']||0xa;this[_0x29e9('0x8')]=_0x5a493b[_0x29e9('0x8')]||'beepall';this[_0x29e9('0x9')]=_0x5a493b[_0x29e9('0x9')];this['mapAgentsId']={};this['waiting']=0x0;this[_0x29e9('0x1')]='';this['updateRouting']();this[_0x29e9('0xa')]();}ChatQueue[_0x29e9('0xb')][_0x29e9('0xc')]=function(){var _0x28f15d=this[_0x29e9('0xd')]['_rr'];this[_0x29e9('0xd')]=_[_0x29e9('0xe')](this[_0x29e9('0x9')],'id');this[_0x29e9('0xd')]['_rr']=_0x28f15d;};ChatQueue[_0x29e9('0xb')][_0x29e9('0xa')]=function(){this[_0x29e9('0xf')]=0x0;this[_0x29e9('0x10')]=0x0;for(var _0x68753f=0x0;_0x68753f=0x0?this[_0x29e9('0x14')]:0x0;var _0x58c8bd={'id':this['id'],'available':this[_0x29e9('0x14')],'loggedIn':this[_0x29e9('0xf')],'name':this[_0x29e9('0x15')],'paused':this[_0x29e9('0x10')],'waiting':this['waiting']};var _0x1100f2=md5(JSON[_0x29e9('0x16')](_0x58c8bd));if(this[_0x29e9('0x1')]!==_0x1100f2){this[_0x29e9('0x1')]=_0x1100f2;io['to'](util[_0x29e9('0x17')](_0x29e9('0x18'),_0x58c8bd['name']))['emit'](_0x29e9('0x19'),_0x58c8bd);}};module[_0x29e9('0x1a')]=ChatQueue; \ No newline at end of file +var _0xc5c9=['online','chatPause','available','stringify','format','emit','chat_queue:save','exports','lodash','md5','ioredis','../../../config/environment','defaults','redis','socket.io-emitter','name','timeout','strategy','mapAgentsId','waiting','updateRealtime','prototype','updateRouting','_rr','map','Agents','loggedIn','paused','length'];(function(_0x29a9d4,_0x492d05){var _0x2fbf19=function(_0x3c661c){while(--_0x3c661c){_0x29a9d4['push'](_0x29a9d4['shift']());}};_0x2fbf19(++_0x492d05);}(_0xc5c9,0x164));var _0x9c5c=function(_0x32c790,_0x10d864){_0x32c790=_0x32c790-0x0;var _0x596d5d=_0xc5c9[_0x32c790];return _0x596d5d;};'use strict';var _=require(_0x9c5c('0x0'));var md5=require(_0x9c5c('0x1'));var util=require('util');var Redis=require(_0x9c5c('0x2'));var config=require(_0x9c5c('0x3'));config['redis']=_[_0x9c5c('0x4')](config[_0x9c5c('0x5')],{'host':'localhost','port':0x18eb});var io=require(_0x9c5c('0x6'))(new Redis(config[_0x9c5c('0x5')]));function ChatQueue(_0x1e2969){this['id']=_0x1e2969['id']||0x0;this['name']=_0x1e2969[_0x9c5c('0x7')]||'';this[_0x9c5c('0x8')]=_0x1e2969['timeout']||0xa;this[_0x9c5c('0x9')]=_0x1e2969[_0x9c5c('0x9')]||'beepall';this['Agents']=_0x1e2969['Agents'];this[_0x9c5c('0xa')]={};this[_0x9c5c('0xb')]=0x0;this['md5']='';this['updateRouting']();this[_0x9c5c('0xc')]();}ChatQueue[_0x9c5c('0xd')][_0x9c5c('0xe')]=function(){var _0x4873b6=this[_0x9c5c('0xa')][_0x9c5c('0xf')];this['mapAgentsId']=_[_0x9c5c('0x10')](this[_0x9c5c('0x11')],'id');this[_0x9c5c('0xa')]['_rr']=_0x4873b6;};ChatQueue[_0x9c5c('0xd')][_0x9c5c('0xc')]=function(){this[_0x9c5c('0x12')]=0x0;this[_0x9c5c('0x13')]=0x0;for(var _0x30e07c=0x0;_0x30e07c=0x0?this[_0x9c5c('0x17')]:0x0;var _0x2c8236={'id':this['id'],'available':this[_0x9c5c('0x17')],'loggedIn':this[_0x9c5c('0x12')],'name':this['name'],'paused':this[_0x9c5c('0x13')],'waiting':this['waiting']};var _0x354ce6=md5(JSON[_0x9c5c('0x18')](_0x2c8236));if(this['md5']!==_0x354ce6){this[_0x9c5c('0x1')]=_0x354ce6;io['to'](util[_0x9c5c('0x19')]('chat:queue:%s',_0x2c8236[_0x9c5c('0x7')]))[_0x9c5c('0x1a')](_0x9c5c('0x1b'),_0x2c8236);}};module[_0x9c5c('0x1c')]=ChatQueue; \ No newline at end of file diff --git a/server/services/routing/model/faxQueue.js b/server/services/routing/model/faxQueue.js index 73708f5..e317fb2 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(_0x1b5f9e,_0x3ef0a2){var _0x58f829=function(_0x38f699){while(--_0x38f699){_0x1b5f9e['push'](_0x1b5f9e['shift']());}};_0x58f829(++_0x3ef0a2);}(_0xa9e0,0x123));var _0x0a9e=function(_0x34bf97,_0xc60f9d){_0x34bf97=_0x34bf97-0x0;var _0x292719=_0xa9e0[_0x34bf97];return _0x292719;};'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(_0x26390e,_0x1edd8f){var _0x48f47b=function(_0x490e6b){while(--_0x490e6b){_0x26390e['push'](_0x26390e['shift']());}};_0x48f47b(++_0x1edd8f);}(_0xa9e0,0x123));var _0x0a9e=function(_0x32d457,_0x1a39c9){_0x32d457=_0x32d457-0x0;var _0x338386=_0xa9e0[_0x32d457];return _0x338386;};'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 53c9a30..6f47f39 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 _0x2665=['name','Intervals'];(function(_0x4843f9,_0x4af459){var _0x193c6a=function(_0x51eca9){while(--_0x51eca9){_0x4843f9['push'](_0x4843f9['shift']());}};_0x193c6a(++_0x4af459);}(_0x2665,0x126));var _0x5266=function(_0x4e2d9e,_0x3797ce){_0x4e2d9e=_0x4e2d9e-0x0;var _0x14f7f5=_0x2665[_0x4e2d9e];return _0x14f7f5;};'use strict';function Interval(_0x2626b5){this['id']=_0x2626b5['id']||0x0;this['name']=_0x2626b5[_0x5266('0x0')]||'';this['Intervals']=_0x2626b5[_0x5266('0x1')]||{};}module['exports']=Interval; \ No newline at end of file +var _0x325f=['Intervals','exports','name'];(function(_0x13d07a,_0x41efc3){var _0x5ee0ee=function(_0x4ca94a){while(--_0x4ca94a){_0x13d07a['push'](_0x13d07a['shift']());}};_0x5ee0ee(++_0x41efc3);}(_0x325f,0x17c));var _0xf325=function(_0x1aea83,_0xab3016){_0x1aea83=_0x1aea83-0x0;var _0x28c8d2=_0x325f[_0x1aea83];return _0x28c8d2;};'use strict';function Interval(_0x2da3ae){this['id']=_0x2da3ae['id']||0x0;this[_0xf325('0x0')]=_0x2da3ae[_0xf325('0x0')]||'';this[_0xf325('0x1')]=_0x2da3ae[_0xf325('0x1')]||{};}module[_0xf325('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 bd4c6a3..65a99a2 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 _0xdb79=['waiting','updateRealtime','prototype','updateRouting','_rr','loggedIn','length','online','mailPause','available','paused','name','stringify','mail:queue:%s','mail_queue:save','exports','lodash','md5','util','redis','socket.io-emitter','timeout','strategy','beepall','Agents','mapAgentsId'];(function(_0x322306,_0x31fc80){var _0x4f9152=function(_0x565bbf){while(--_0x565bbf){_0x322306['push'](_0x322306['shift']());}};_0x4f9152(++_0x31fc80);}(_0xdb79,0x1e4));var _0x9db7=function(_0x13b8f3,_0x442821){_0x13b8f3=_0x13b8f3-0x0;var _0x1a6d06=_0xdb79[_0x13b8f3];return _0x1a6d06;};'use strict';var _=require(_0x9db7('0x0'));var md5=require(_0x9db7('0x1'));var util=require(_0x9db7('0x2'));var Redis=require('ioredis');var config=require('../../../config/environment');config[_0x9db7('0x3')]=_['defaults'](config[_0x9db7('0x3')],{'host':'localhost','port':0x18eb});var io=require(_0x9db7('0x4'))(new Redis(config[_0x9db7('0x3')]));function MailQueue(_0x596951){this['id']=_0x596951['id']||0x0;this['name']=_0x596951['name']||'';this[_0x9db7('0x5')]=_0x596951[_0x9db7('0x5')]||0xa;this[_0x9db7('0x6')]=_0x596951['strategy']||_0x9db7('0x7');this[_0x9db7('0x8')]=_0x596951[_0x9db7('0x8')];this[_0x9db7('0x9')]={};this[_0x9db7('0xa')]=0x0;this[_0x9db7('0x1')]='';this['updateRouting']();this[_0x9db7('0xb')]();}MailQueue[_0x9db7('0xc')][_0x9db7('0xd')]=function(){var _0x64c617=this[_0x9db7('0x9')][_0x9db7('0xe')];this[_0x9db7('0x9')]=_['map'](this[_0x9db7('0x8')],'id');this[_0x9db7('0x9')]['_rr']=_0x64c617;};MailQueue[_0x9db7('0xc')][_0x9db7('0xb')]=function(){this[_0x9db7('0xf')]=0x0;this['paused']=0x0;for(var _0x43931a=0x0;_0x43931a=0x0?this[_0x9db7('0x13')]:0x0;var _0x2ebcf7={'id':this['id'],'available':this['available'],'loggedIn':this[_0x9db7('0xf')],'name':this[_0x9db7('0x15')],'paused':this[_0x9db7('0x14')],'waiting':this['waiting']};var _0x42e703=md5(JSON[_0x9db7('0x16')](_0x2ebcf7));if(this[_0x9db7('0x1')]!==_0x42e703){this[_0x9db7('0x1')]=_0x42e703;io['to'](util['format'](_0x9db7('0x17'),_0x2ebcf7[_0x9db7('0x15')]))['emit'](_0x9db7('0x18'),_0x2ebcf7);}};module[_0x9db7('0x19')]=MailQueue; \ No newline at end of file +var _0x529d=['prototype','_rr','map','updateRealtime','loggedIn','length','online','mailPause','paused','available','stringify','format','mail:queue:%s','emit','mail_queue:save','lodash','md5','ioredis','../../../config/environment','redis','defaults','localhost','name','timeout','strategy','beepall','Agents','mapAgentsId','waiting','updateRouting'];(function(_0x3df37f,_0x480d6b){var _0x12bbdb=function(_0x452526){while(--_0x452526){_0x3df37f['push'](_0x3df37f['shift']());}};_0x12bbdb(++_0x480d6b);}(_0x529d,0x177));var _0xd529=function(_0x5b7b9f,_0xc5d795){_0x5b7b9f=_0x5b7b9f-0x0;var _0x3d5f07=_0x529d[_0x5b7b9f];return _0x3d5f07;};'use strict';var _=require(_0xd529('0x0'));var md5=require(_0xd529('0x1'));var util=require('util');var Redis=require(_0xd529('0x2'));var config=require(_0xd529('0x3'));config[_0xd529('0x4')]=_[_0xd529('0x5')](config[_0xd529('0x4')],{'host':_0xd529('0x6'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0xd529('0x4')]));function MailQueue(_0x36d988){this['id']=_0x36d988['id']||0x0;this[_0xd529('0x7')]=_0x36d988['name']||'';this[_0xd529('0x8')]=_0x36d988[_0xd529('0x8')]||0xa;this[_0xd529('0x9')]=_0x36d988[_0xd529('0x9')]||_0xd529('0xa');this[_0xd529('0xb')]=_0x36d988[_0xd529('0xb')];this[_0xd529('0xc')]={};this[_0xd529('0xd')]=0x0;this[_0xd529('0x1')]='';this[_0xd529('0xe')]();this['updateRealtime']();}MailQueue[_0xd529('0xf')][_0xd529('0xe')]=function(){var _0xb89101=this[_0xd529('0xc')][_0xd529('0x10')];this[_0xd529('0xc')]=_[_0xd529('0x11')](this[_0xd529('0xb')],'id');this[_0xd529('0xc')]['_rr']=_0xb89101;};MailQueue['prototype'][_0xd529('0x12')]=function(){this[_0xd529('0x13')]=0x0;this['paused']=0x0;for(var _0x5df349=0x0;_0x5df349=0x0?this[_0xd529('0x18')]:0x0;var _0x1fc9aa={'id':this['id'],'available':this[_0xd529('0x18')],'loggedIn':this[_0xd529('0x13')],'name':this[_0xd529('0x7')],'paused':this[_0xd529('0x17')],'waiting':this[_0xd529('0xd')]};var _0x52a703=md5(JSON[_0xd529('0x19')](_0x1fc9aa));if(this['md5']!==_0x52a703){this[_0xd529('0x1')]=_0x52a703;io['to'](util[_0xd529('0x1a')](_0xd529('0x1b'),_0x1fc9aa['name']))[_0xd529('0x1c')](_0xd529('0x1d'),_0x1fc9aa);}};module['exports']=MailQueue; \ No newline at end of file diff --git a/server/services/routing/model/openchannelQueue.js b/server/services/routing/model/openchannelQueue.js index 521763d..62bcc04 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 _0xd0ac=['strategy','Agents','mapAgentsId','md5','updateRouting','updateRealtime','prototype','_rr','map','loggedIn','length','online','openchannelPause','paused','available','stringify','format','emit','openchannel_queue:save','exports','lodash','util','ioredis','redis','localhost','socket.io-emitter','name','timeout'];(function(_0x45e98e,_0x169b60){var _0x374dba=function(_0x597612){while(--_0x597612){_0x45e98e['push'](_0x45e98e['shift']());}};_0x374dba(++_0x169b60);}(_0xd0ac,0x12c));var _0xcd0a=function(_0x40648c,_0x1bc193){_0x40648c=_0x40648c-0x0;var _0x18cce3=_0xd0ac[_0x40648c];return _0x18cce3;};'use strict';var _=require(_0xcd0a('0x0'));var md5=require('md5');var util=require(_0xcd0a('0x1'));var Redis=require(_0xcd0a('0x2'));var config=require('../../../config/environment');config[_0xcd0a('0x3')]=_['defaults'](config['redis'],{'host':_0xcd0a('0x4'),'port':0x18eb});var io=require(_0xcd0a('0x5'))(new Redis(config[_0xcd0a('0x3')]));function OpenchannelQueue(_0x290dbb){this['id']=_0x290dbb['id']||0x0;this[_0xcd0a('0x6')]=_0x290dbb[_0xcd0a('0x6')]||'';this[_0xcd0a('0x7')]=_0x290dbb[_0xcd0a('0x7')]||0xa;this[_0xcd0a('0x8')]=_0x290dbb[_0xcd0a('0x8')]||'beepall';this[_0xcd0a('0x9')]=_0x290dbb[_0xcd0a('0x9')];this[_0xcd0a('0xa')]={};this['waiting']=0x0;this[_0xcd0a('0xb')]='';this[_0xcd0a('0xc')]();this[_0xcd0a('0xd')]();}OpenchannelQueue[_0xcd0a('0xe')][_0xcd0a('0xc')]=function(){var _0x49a31d=this[_0xcd0a('0xa')][_0xcd0a('0xf')];this[_0xcd0a('0xa')]=_[_0xcd0a('0x10')](this[_0xcd0a('0x9')],'id');this[_0xcd0a('0xa')][_0xcd0a('0xf')]=_0x49a31d;};OpenchannelQueue[_0xcd0a('0xe')][_0xcd0a('0xd')]=function(){this[_0xcd0a('0x11')]=0x0;this['paused']=0x0;for(var _0x1b69d5=0x0;_0x1b69d5=0x0?this[_0xcd0a('0x16')]:0x0;var _0x77da13={'id':this['id'],'available':this[_0xcd0a('0x16')],'loggedIn':this['loggedIn'],'name':this[_0xcd0a('0x6')],'paused':this[_0xcd0a('0x15')],'waiting':this['waiting']};var _0x58b670=md5(JSON[_0xcd0a('0x17')](_0x77da13));if(this[_0xcd0a('0xb')]!==_0x58b670){this[_0xcd0a('0xb')]=_0x58b670;io['to'](util[_0xcd0a('0x18')]('openchannel:queue:%s',_0x77da13[_0xcd0a('0x6')]))[_0xcd0a('0x19')](_0xcd0a('0x1a'),_0x77da13);}};module[_0xcd0a('0x1b')]=OpenchannelQueue; \ No newline at end of file +var _0x45ca=['lodash','../../../config/environment','redis','defaults','localhost','socket.io-emitter','name','timeout','strategy','beepall','Agents','mapAgentsId','waiting','md5','updateRealtime','map','_rr','loggedIn','paused','length','online','openchannelPause','available','stringify','format','openchannel:queue:%s','exports'];(function(_0x22b49c,_0x3084d7){var _0xca5772=function(_0x21724c){while(--_0x21724c){_0x22b49c['push'](_0x22b49c['shift']());}};_0xca5772(++_0x3084d7);}(_0x45ca,0xbd));var _0xa45c=function(_0x19e35c,_0x29cd1e){_0x19e35c=_0x19e35c-0x0;var _0x3e1fe8=_0x45ca[_0x19e35c];return _0x3e1fe8;};'use strict';var _=require(_0xa45c('0x0'));var md5=require('md5');var util=require('util');var Redis=require('ioredis');var config=require(_0xa45c('0x1'));config[_0xa45c('0x2')]=_[_0xa45c('0x3')](config[_0xa45c('0x2')],{'host':_0xa45c('0x4'),'port':0x18eb});var io=require(_0xa45c('0x5'))(new Redis(config['redis']));function OpenchannelQueue(_0x3867f1){this['id']=_0x3867f1['id']||0x0;this[_0xa45c('0x6')]=_0x3867f1[_0xa45c('0x6')]||'';this[_0xa45c('0x7')]=_0x3867f1[_0xa45c('0x7')]||0xa;this[_0xa45c('0x8')]=_0x3867f1['strategy']||_0xa45c('0x9');this[_0xa45c('0xa')]=_0x3867f1[_0xa45c('0xa')];this[_0xa45c('0xb')]={};this[_0xa45c('0xc')]=0x0;this[_0xa45c('0xd')]='';this['updateRouting']();this[_0xa45c('0xe')]();}OpenchannelQueue['prototype']['updateRouting']=function(){var _0x347a40=this[_0xa45c('0xb')]['_rr'];this['mapAgentsId']=_[_0xa45c('0xf')](this[_0xa45c('0xa')],'id');this[_0xa45c('0xb')][_0xa45c('0x10')]=_0x347a40;};OpenchannelQueue['prototype'][_0xa45c('0xe')]=function(){this[_0xa45c('0x11')]=0x0;this[_0xa45c('0x12')]=0x0;for(var _0x43c377=0x0;_0x43c377=0x0?this[_0xa45c('0x16')]:0x0;var _0x106865={'id':this['id'],'available':this[_0xa45c('0x16')],'loggedIn':this[_0xa45c('0x11')],'name':this[_0xa45c('0x6')],'paused':this[_0xa45c('0x12')],'waiting':this[_0xa45c('0xc')]};var _0x39a82a=md5(JSON[_0xa45c('0x17')](_0x106865));if(this[_0xa45c('0xd')]!==_0x39a82a){this[_0xa45c('0xd')]=_0x39a82a;io['to'](util[_0xa45c('0x18')](_0xa45c('0x19'),_0x106865[_0xa45c('0x6')]))['emit']('openchannel_queue:save',_0x106865);}};module[_0xa45c('0x1a')]=OpenchannelQueue; \ No newline at end of file diff --git a/server/services/routing/model/smsQueue.js b/server/services/routing/model/smsQueue.js index bf25c55..a91a2a8 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 _0xe706=['prototype','_rr','map','online','loggedIn','smsPause','available','paused','stringify','format','sms:queue:%s','emit','exports','lodash','md5','util','../../../config/environment','redis','defaults','localhost','socket.io-emitter','name','timeout','strategy','beepall','Agents','mapAgentsId','waiting','updateRouting','updateRealtime'];(function(_0x2a53ad,_0x234135){var _0x31b3b6=function(_0x141ec6){while(--_0x141ec6){_0x2a53ad['push'](_0x2a53ad['shift']());}};_0x31b3b6(++_0x234135);}(_0xe706,0xa3));var _0x6e70=function(_0x470b1e,_0x469d95){_0x470b1e=_0x470b1e-0x0;var _0x58d7ff=_0xe706[_0x470b1e];return _0x58d7ff;};'use strict';var _=require(_0x6e70('0x0'));var md5=require(_0x6e70('0x1'));var util=require(_0x6e70('0x2'));var Redis=require('ioredis');var config=require(_0x6e70('0x3'));config[_0x6e70('0x4')]=_[_0x6e70('0x5')](config[_0x6e70('0x4')],{'host':_0x6e70('0x6'),'port':0x18eb});var io=require(_0x6e70('0x7'))(new Redis(config[_0x6e70('0x4')]));function SmsQueue(_0x506db9){this['id']=_0x506db9['id']||0x0;this[_0x6e70('0x8')]=_0x506db9[_0x6e70('0x8')]||'';this[_0x6e70('0x9')]=_0x506db9[_0x6e70('0x9')]||0xa;this[_0x6e70('0xa')]=_0x506db9[_0x6e70('0xa')]||_0x6e70('0xb');this[_0x6e70('0xc')]=_0x506db9[_0x6e70('0xc')];this[_0x6e70('0xd')]={};this[_0x6e70('0xe')]=0x0;this[_0x6e70('0x1')]='';this[_0x6e70('0xf')]();this[_0x6e70('0x10')]();}SmsQueue[_0x6e70('0x11')][_0x6e70('0xf')]=function(){var _0x5b3d07=this['mapAgentsId'][_0x6e70('0x12')];this[_0x6e70('0xd')]=_[_0x6e70('0x13')](this[_0x6e70('0xc')],'id');this[_0x6e70('0xd')][_0x6e70('0x12')]=_0x5b3d07;};SmsQueue[_0x6e70('0x11')][_0x6e70('0x10')]=function(){this['loggedIn']=0x0;this['paused']=0x0;for(var _0x48bc72=0x0;_0x48bc72=0x0?this['available']:0x0;var _0x28a21f={'id':this['id'],'available':this[_0x6e70('0x17')],'loggedIn':this['loggedIn'],'name':this['name'],'paused':this[_0x6e70('0x18')],'waiting':this[_0x6e70('0xe')]};var _0x2368eb=md5(JSON[_0x6e70('0x19')](_0x28a21f));if(this[_0x6e70('0x1')]!==_0x2368eb){this[_0x6e70('0x1')]=_0x2368eb;io['to'](util[_0x6e70('0x1a')](_0x6e70('0x1b'),_0x28a21f[_0x6e70('0x8')]))[_0x6e70('0x1c')]('sms_queue:save',_0x28a21f);}};module[_0x6e70('0x1d')]=SmsQueue; \ No newline at end of file +var _0x757a=['redis','localhost','socket.io-emitter','name','timeout','strategy','beepall','Agents','waiting','updateRouting','updateRealtime','prototype','mapAgentsId','length','online','loggedIn','smsPause','paused','available','format','sms:queue:%s','emit','md5','util','defaults'];(function(_0x17474a,_0xd1a49c){var _0x3a5495=function(_0x10e1b4){while(--_0x10e1b4){_0x17474a['push'](_0x17474a['shift']());}};_0x3a5495(++_0xd1a49c);}(_0x757a,0xde));var _0xa757=function(_0x52511e,_0x2c09e3){_0x52511e=_0x52511e-0x0;var _0x3b2315=_0x757a[_0x52511e];return _0x3b2315;};'use strict';var _=require('lodash');var md5=require(_0xa757('0x0'));var util=require(_0xa757('0x1'));var Redis=require('ioredis');var config=require('../../../config/environment');config['redis']=_[_0xa757('0x2')](config[_0xa757('0x3')],{'host':_0xa757('0x4'),'port':0x18eb});var io=require(_0xa757('0x5'))(new Redis(config[_0xa757('0x3')]));function SmsQueue(_0x3caeb0){this['id']=_0x3caeb0['id']||0x0;this['name']=_0x3caeb0[_0xa757('0x6')]||'';this[_0xa757('0x7')]=_0x3caeb0['timeout']||0xa;this[_0xa757('0x8')]=_0x3caeb0[_0xa757('0x8')]||_0xa757('0x9');this[_0xa757('0xa')]=_0x3caeb0[_0xa757('0xa')];this['mapAgentsId']={};this[_0xa757('0xb')]=0x0;this[_0xa757('0x0')]='';this[_0xa757('0xc')]();this[_0xa757('0xd')]();}SmsQueue[_0xa757('0xe')][_0xa757('0xc')]=function(){var _0x17408b=this['mapAgentsId']['_rr'];this['mapAgentsId']=_['map'](this['Agents'],'id');this[_0xa757('0xf')]['_rr']=_0x17408b;};SmsQueue['prototype'][_0xa757('0xd')]=function(){this['loggedIn']=0x0;this['paused']=0x0;for(var _0x32112b=0x0;_0x32112b=0x0?this['available']:0x0;var _0x54b305={'id':this['id'],'available':this[_0xa757('0x15')],'loggedIn':this[_0xa757('0x12')],'name':this[_0xa757('0x6')],'paused':this[_0xa757('0x14')],'waiting':this[_0xa757('0xb')]};var _0xe2d567=md5(JSON['stringify'](_0x54b305));if(this[_0xa757('0x0')]!==_0xe2d567){this['md5']=_0xe2d567;io['to'](util[_0xa757('0x16')](_0xa757('0x17'),_0x54b305[_0xa757('0x6')]))[_0xa757('0x18')]('sms_queue:save',_0x54b305);}};module['exports']=SmsQueue; \ No newline at end of file diff --git a/server/services/routing/model/whatsappQueue.js b/server/services/routing/model/whatsappQueue.js index b1f13b0..a48af64 100644 --- a/server/services/routing/model/whatsappQueue.js +++ b/server/services/routing/model/whatsappQueue.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xf104=['map','loggedIn','paused','length','online','whatsappPause','available','stringify','format','whatsapp:queue:%s','emit','whatsapp_queue:save','exports','lodash','md5','util','ioredis','../../../config/environment','defaults','redis','localhost','socket.io-emitter','name','strategy','beepall','Agents','waiting','updateRouting','updateRealtime','prototype','mapAgentsId'];(function(_0x12dce4,_0x575f81){var _0x63e4fd=function(_0x4aa391){while(--_0x4aa391){_0x12dce4['push'](_0x12dce4['shift']());}};_0x63e4fd(++_0x575f81);}(_0xf104,0xc7));var _0x4f10=function(_0x31e69e,_0x128374){_0x31e69e=_0x31e69e-0x0;var _0x455a83=_0xf104[_0x31e69e];return _0x455a83;};'use strict';var _=require(_0x4f10('0x0'));var md5=require(_0x4f10('0x1'));var util=require(_0x4f10('0x2'));var Redis=require(_0x4f10('0x3'));var config=require(_0x4f10('0x4'));config['redis']=_[_0x4f10('0x5')](config[_0x4f10('0x6')],{'host':_0x4f10('0x7'),'port':0x18eb});var io=require(_0x4f10('0x8'))(new Redis(config[_0x4f10('0x6')]));function WhatsappQueue(_0x133722){this['id']=_0x133722['id']||0x0;this[_0x4f10('0x9')]=_0x133722['name']||'';this['timeout']=_0x133722['timeout']||0xa;this[_0x4f10('0xa')]=_0x133722[_0x4f10('0xa')]||_0x4f10('0xb');this['Agents']=_0x133722[_0x4f10('0xc')];this['mapAgentsId']={};this[_0x4f10('0xd')]=0x0;this[_0x4f10('0x1')]='';this[_0x4f10('0xe')]();this[_0x4f10('0xf')]();}WhatsappQueue[_0x4f10('0x10')][_0x4f10('0xe')]=function(){var _0x48c7f2=this['mapAgentsId']['_rr'];this[_0x4f10('0x11')]=_[_0x4f10('0x12')](this[_0x4f10('0xc')],'id');this[_0x4f10('0x11')]['_rr']=_0x48c7f2;};WhatsappQueue[_0x4f10('0x10')][_0x4f10('0xf')]=function(){this[_0x4f10('0x13')]=0x0;this[_0x4f10('0x14')]=0x0;for(var _0x4f6e45=0x0;_0x4f6e45=0x0?this[_0x4f10('0x18')]:0x0;var _0x335bfb={'id':this['id'],'available':this[_0x4f10('0x18')],'loggedIn':this[_0x4f10('0x13')],'name':this['name'],'paused':this[_0x4f10('0x14')],'waiting':this[_0x4f10('0xd')]};var _0x403f59=md5(JSON[_0x4f10('0x19')](_0x335bfb));if(this[_0x4f10('0x1')]!==_0x403f59){this[_0x4f10('0x1')]=_0x403f59;io['to'](util[_0x4f10('0x1a')](_0x4f10('0x1b'),_0x335bfb[_0x4f10('0x9')]))[_0x4f10('0x1c')](_0x4f10('0x1d'),_0x335bfb);}};module[_0x4f10('0x1e')]=WhatsappQueue; \ No newline at end of file +var _0xc018=['stringify','format','whatsapp:queue:%s','emit','md5','util','ioredis','../../../config/environment','defaults','redis','localhost','name','timeout','strategy','Agents','waiting','updateRouting','mapAgentsId','_rr','map','prototype','loggedIn','online','whatsappPause','paused','available'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0xc018,0x6c));var _0x8c01=function(_0x456b3d,_0x2c8742){_0x456b3d=_0x456b3d-0x0;var _0x3b5ca1=_0xc018[_0x456b3d];return _0x3b5ca1;};'use strict';var _=require('lodash');var md5=require(_0x8c01('0x0'));var util=require(_0x8c01('0x1'));var Redis=require(_0x8c01('0x2'));var config=require(_0x8c01('0x3'));config['redis']=_[_0x8c01('0x4')](config[_0x8c01('0x5')],{'host':_0x8c01('0x6'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config['redis']));function WhatsappQueue(_0x24d5f5){this['id']=_0x24d5f5['id']||0x0;this[_0x8c01('0x7')]=_0x24d5f5[_0x8c01('0x7')]||'';this[_0x8c01('0x8')]=_0x24d5f5[_0x8c01('0x8')]||0xa;this[_0x8c01('0x9')]=_0x24d5f5['strategy']||'beepall';this[_0x8c01('0xa')]=_0x24d5f5['Agents'];this['mapAgentsId']={};this[_0x8c01('0xb')]=0x0;this[_0x8c01('0x0')]='';this[_0x8c01('0xc')]();this['updateRealtime']();}WhatsappQueue['prototype']['updateRouting']=function(){var _0x37b8d6=this[_0x8c01('0xd')][_0x8c01('0xe')];this[_0x8c01('0xd')]=_[_0x8c01('0xf')](this['Agents'],'id');this[_0x8c01('0xd')][_0x8c01('0xe')]=_0x37b8d6;};WhatsappQueue[_0x8c01('0x10')]['updateRealtime']=function(){this[_0x8c01('0x11')]=0x0;this['paused']=0x0;for(var _0x51021d=0x0;_0x51021d=0x0?this[_0x8c01('0x15')]:0x0;var _0x4c124b={'id':this['id'],'available':this[_0x8c01('0x15')],'loggedIn':this[_0x8c01('0x11')],'name':this[_0x8c01('0x7')],'paused':this['paused'],'waiting':this['waiting']};var _0x381374=md5(JSON[_0x8c01('0x16')](_0x4c124b));if(this[_0x8c01('0x0')]!==_0x381374){this[_0x8c01('0x0')]=_0x381374;io['to'](util[_0x8c01('0x17')](_0x8c01('0x18'),_0x4c124b[_0x8c01('0x7')]))[_0x8c01('0x19')]('whatsapp_queue:save',_0x4c124b);}};module['exports']=WhatsappQueue; \ No newline at end of file diff --git a/server/services/routing/realtime/index.js b/server/services/routing/realtime/index.js index 0fc7e54..a2e6962 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 _0xe07a=['prototype','hasOwnProperty','length','agents','mergeFromDatabase','initIntervals','isUndefined','updateRouting','updateRealtime','initChatQueues','initMailQueues','exports','util','lodash','moment','../model/agent','../model/interval','../model/openchannelQueue','../model/chatQueue','../model/smsQueue','../model/faxQueue','intervals','openchannelQueues','chatQueues','smsQueues','mailQueues','faxQueues','chatQueuesWaitingInteractions','mailQueuesWaitingInteractions','openchannelQueuesWaitingInteractions','mapKeys'];(function(_0xaa0309,_0x1c8008){var _0x5de7ce=function(_0x3aa6ae){while(--_0x3aa6ae){_0xaa0309['push'](_0xaa0309['shift']());}};_0x5de7ce(++_0x1c8008);}(_0xe07a,0x161));var _0xae07=function(_0x15dce9,_0x2c6fbb){_0x15dce9=_0x15dce9-0x0;var _0x900549=_0xe07a[_0x15dce9];return _0x900549;};'use strict';var BPromise=require('bluebird');var util=require(_0xae07('0x0'));var _=require(_0xae07('0x1'));var moment=require(_0xae07('0x2'));var Agent=require(_0xae07('0x3'));var Interval=require(_0xae07('0x4'));var OpenchannelQueue=require(_0xae07('0x5'));var ChatQueue=require(_0xae07('0x6'));var SmsQueue=require(_0xae07('0x7'));var MailQueue=require('../model/mailQueue');var FaxQueue=require(_0xae07('0x8'));var Realtime=function(){this['agents']={};this[_0xae07('0x9')]={};this[_0xae07('0xa')]={};this[_0xae07('0xb')]={};this[_0xae07('0xc')]={};this[_0xae07('0xd')]={};this[_0xae07('0xe')]={};this[_0xae07('0xf')]={};this[_0xae07('0x10')]={};this[_0xae07('0x11')]={};this['smsQueuesWaitingInteractions']={};this['faxQueuesWaitingInteractions']={};};function freeIsNotKey(_0x2fe236,_0x1415e5,_0x256e4d){var _0x30c953=_[_0xae07('0x12')](_0x2fe236,function(_0x3cfd3c,_0x5157e6){return _0x3cfd3c[_0x256e4d];});for(var _0x1dccfb in _0x1415e5){if(_0x1415e5['hasOwnProperty'](_0x1dccfb)){if(!_0x30c953[_0x1dccfb]){delete _0x1415e5[_0x1dccfb];}}}}Realtime[_0xae07('0x13')]['mergeFromDatabase']=function(_0x5a7c5b,_0x4022cc){for(var _0x5e2867 in _0x4022cc){if(_0x5a7c5b[_0xae07('0x14')](_0x5e2867)){_0x5a7c5b[_0x5e2867]=_0x4022cc[_0x5e2867];}}};Realtime['prototype']['initAgents']=function(){var _0x16d6df=this;return function(_0x3fb6e5){if(_0x3fb6e5){freeIsNotKey(_0x3fb6e5,_0x16d6df['agents'],'id');for(var _0x58e582=0x0,_0x55dba6={},_0x429dcf={};_0x58e582<_0x3fb6e5[_0xae07('0x15')];_0x58e582+=0x1){_0x55dba6=_0x3fb6e5[_0x58e582];if(_['isUndefined'](_0x16d6df[_0xae07('0x16')][_0x55dba6['id']])){_0x16d6df[_0xae07('0x16')][_0x55dba6['id']]=new Agent(_0x55dba6);}else{_0x16d6df[_0xae07('0x17')](_0x16d6df['agents'][_0x55dba6['id']],_0x55dba6);}}}return _0x16d6df[_0xae07('0x16')];};};Realtime[_0xae07('0x13')][_0xae07('0x18')]=function(){var _0x5b5ed5=this;return function(_0x43b972){if(_0x43b972){freeIsNotKey(_0x43b972,_0x5b5ed5['intervals'],'id');for(var _0x209b92=0x0,_0x195a91={},_0x4d27be={};_0x209b92<_0x43b972[_0xae07('0x15')];_0x209b92+=0x1){_0x195a91=_0x43b972[_0x209b92];if(_['isUndefined'](_0x5b5ed5['intervals'][_0x195a91['id']])){_0x5b5ed5[_0xae07('0x9')][_0x195a91['id']]=new Interval(_0x195a91);}else{_0x5b5ed5[_0xae07('0x17')](_0x5b5ed5[_0xae07('0x9')][_0x195a91['id']],_0x195a91);}}}return _0x5b5ed5[_0xae07('0x9')];};};Realtime[_0xae07('0x13')]['initOpenchannelQueues']=function(){var _0x5d4d25=this;return function(_0x817a73){if(_0x817a73){freeIsNotKey(_0x817a73,_0x5d4d25[_0xae07('0xa')],'id');for(var _0x9606b7=0x0,_0x214e7f={},_0x182a84={};_0x9606b7<_0x817a73['length'];_0x9606b7+=0x1){_0x214e7f=_0x817a73[_0x9606b7];if(_[_0xae07('0x19')](_0x5d4d25[_0xae07('0xa')][_0x214e7f['id']])){_0x5d4d25[_0xae07('0xa')][_0x214e7f['id']]=new OpenchannelQueue(_0x214e7f);}else{_0x5d4d25[_0xae07('0x17')](_0x5d4d25[_0xae07('0xa')][_0x214e7f['id']],_0x214e7f);}_0x5d4d25[_0xae07('0xa')][_0x214e7f['id']][_0xae07('0x1a')]();_0x5d4d25[_0xae07('0xa')][_0x214e7f['id']][_0xae07('0x1b')]();}}return _0x5d4d25[_0xae07('0xa')];};};Realtime[_0xae07('0x13')][_0xae07('0x1c')]=function(){var _0x40b96d=this;return function(_0x4ba42f){if(_0x4ba42f){freeIsNotKey(_0x4ba42f,_0x40b96d[_0xae07('0xb')],'id');for(var _0x1fe94d=0x0,_0x291376={},_0x5da664={};_0x1fe94d<_0x4ba42f['length'];_0x1fe94d+=0x1){_0x291376=_0x4ba42f[_0x1fe94d];if(_[_0xae07('0x19')](_0x40b96d[_0xae07('0xb')][_0x291376['id']])){_0x40b96d[_0xae07('0xb')][_0x291376['id']]=new ChatQueue(_0x291376);}else{_0x40b96d[_0xae07('0x17')](_0x40b96d[_0xae07('0xb')][_0x291376['id']],_0x291376);}_0x40b96d['chatQueues'][_0x291376['id']]['updateRouting']();_0x40b96d[_0xae07('0xb')][_0x291376['id']]['updateRealtime']();}}return _0x40b96d[_0xae07('0xb')];};};Realtime[_0xae07('0x13')]['initSmsQueues']=function(){var _0x322245=this;return function(_0x848b33){if(_0x848b33){freeIsNotKey(_0x848b33,_0x322245[_0xae07('0xc')],'id');for(var _0x52d59d=0x0,_0x2eca3e={},_0x31d334={};_0x52d59d<_0x848b33['length'];_0x52d59d+=0x1){_0x2eca3e=_0x848b33[_0x52d59d];if(_[_0xae07('0x19')](_0x322245['smsQueues'][_0x2eca3e['id']])){_0x322245[_0xae07('0xc')][_0x2eca3e['id']]=new SmsQueue(_0x2eca3e);}else{_0x322245[_0xae07('0x17')](_0x322245[_0xae07('0xc')][_0x2eca3e['id']],_0x2eca3e);}_0x322245[_0xae07('0xc')][_0x2eca3e['id']][_0xae07('0x1a')]();_0x322245[_0xae07('0xc')][_0x2eca3e['id']][_0xae07('0x1b')]();}}return _0x322245[_0xae07('0xc')];};};Realtime[_0xae07('0x13')][_0xae07('0x1d')]=function(){var _0x5cdaf7=this;return function(_0x5c68ea){if(_0x5c68ea){freeIsNotKey(_0x5c68ea,_0x5cdaf7['mailQueues'],'id');for(var _0x5e3a9f=0x0,_0x2fe165={},_0x13bf14={};_0x5e3a9f<_0x5c68ea[_0xae07('0x15')];_0x5e3a9f+=0x1){_0x2fe165=_0x5c68ea[_0x5e3a9f];if(_[_0xae07('0x19')](_0x5cdaf7[_0xae07('0xd')][_0x2fe165['id']])){_0x5cdaf7[_0xae07('0xd')][_0x2fe165['id']]=new MailQueue(_0x2fe165);}else{_0x5cdaf7[_0xae07('0x17')](_0x5cdaf7[_0xae07('0xd')][_0x2fe165['id']],_0x2fe165);}_0x5cdaf7[_0xae07('0xd')][_0x2fe165['id']][_0xae07('0x1a')]();_0x5cdaf7[_0xae07('0xd')][_0x2fe165['id']][_0xae07('0x1b')]();}}return _0x5cdaf7['mailQueues'];};};Realtime[_0xae07('0x13')]['initFaxQueues']=function(){var _0x4bb905=this;return function(_0x4db2ad){if(_0x4db2ad){freeIsNotKey(_0x4db2ad,_0x4bb905[_0xae07('0xe')],'id');for(var _0x3aa372=0x0,_0x5f2a06={},_0x391d37={};_0x3aa372<_0x4db2ad['length'];_0x3aa372+=0x1){_0x5f2a06=_0x4db2ad[_0x3aa372];if(_['isUndefined'](_0x4bb905[_0xae07('0xe')][_0x5f2a06['id']])){_0x4bb905['faxQueues'][_0x5f2a06['id']]=new FaxQueue(_0x5f2a06);}else{_0x4bb905['mergeFromDatabase'](_0x4bb905[_0xae07('0xe')][_0x5f2a06['id']],_0x5f2a06);}_0x4bb905[_0xae07('0xe')][_0x5f2a06['id']][_0xae07('0x1a')]();_0x4bb905['faxQueues'][_0x5f2a06['id']][_0xae07('0x1b')]();}}return _0x4bb905[_0xae07('0xe')];};};module[_0xae07('0x1e')]=Realtime; \ No newline at end of file +var _0x1a2e=['prototype','mergeFromDatabase','hasOwnProperty','initAgents','length','initIntervals','intervals','isUndefined','openchannelQueues','updateRouting','updateRealtime','initChatQueues','initSmsQueues','initMailQueues','initFaxQueues','exports','bluebird','util','lodash','moment','../model/agent','../model/interval','../model/openchannelQueue','../model/chatQueue','../model/smsQueue','../model/faxQueue','agents','chatQueues','smsQueues','mailQueues','faxQueues','chatQueuesWaitingInteractions','mailQueuesWaitingInteractions','openchannelQueuesWaitingInteractions','smsQueuesWaitingInteractions','mapKeys'];(function(_0x48ef48,_0x3c931a){var _0x6efc98=function(_0x2d4ea8){while(--_0x2d4ea8){_0x48ef48['push'](_0x48ef48['shift']());}};_0x6efc98(++_0x3c931a);}(_0x1a2e,0x7c));var _0xe1a2=function(_0x3f6565,_0x12a8bb){_0x3f6565=_0x3f6565-0x0;var _0x4abd23=_0x1a2e[_0x3f6565];return _0x4abd23;};'use strict';var BPromise=require(_0xe1a2('0x0'));var util=require(_0xe1a2('0x1'));var _=require(_0xe1a2('0x2'));var moment=require(_0xe1a2('0x3'));var Agent=require(_0xe1a2('0x4'));var Interval=require(_0xe1a2('0x5'));var OpenchannelQueue=require(_0xe1a2('0x6'));var ChatQueue=require(_0xe1a2('0x7'));var SmsQueue=require(_0xe1a2('0x8'));var MailQueue=require('../model/mailQueue');var FaxQueue=require(_0xe1a2('0x9'));var Realtime=function(){this[_0xe1a2('0xa')]={};this['intervals']={};this['openchannelQueues']={};this[_0xe1a2('0xb')]={};this[_0xe1a2('0xc')]={};this[_0xe1a2('0xd')]={};this[_0xe1a2('0xe')]={};this[_0xe1a2('0xf')]={};this[_0xe1a2('0x10')]={};this[_0xe1a2('0x11')]={};this[_0xe1a2('0x12')]={};this['faxQueuesWaitingInteractions']={};};function freeIsNotKey(_0xa8dcac,_0x2f1c93,_0x3399de){var _0x3214d7=_[_0xe1a2('0x13')](_0xa8dcac,function(_0x3ee555,_0x3c57b2){return _0x3ee555[_0x3399de];});for(var _0x3ce82d in _0x2f1c93){if(_0x2f1c93['hasOwnProperty'](_0x3ce82d)){if(!_0x3214d7[_0x3ce82d]){delete _0x2f1c93[_0x3ce82d];}}}}Realtime[_0xe1a2('0x14')][_0xe1a2('0x15')]=function(_0x129747,_0x4aa24e){for(var _0xa96520 in _0x4aa24e){if(_0x129747[_0xe1a2('0x16')](_0xa96520)){_0x129747[_0xa96520]=_0x4aa24e[_0xa96520];}}};Realtime[_0xe1a2('0x14')][_0xe1a2('0x17')]=function(){var _0x371ad7=this;return function(_0x28166d){if(_0x28166d){freeIsNotKey(_0x28166d,_0x371ad7[_0xe1a2('0xa')],'id');for(var _0x144839=0x0,_0x591c00={},_0x245d61={};_0x144839<_0x28166d[_0xe1a2('0x18')];_0x144839+=0x1){_0x591c00=_0x28166d[_0x144839];if(_['isUndefined'](_0x371ad7[_0xe1a2('0xa')][_0x591c00['id']])){_0x371ad7['agents'][_0x591c00['id']]=new Agent(_0x591c00);}else{_0x371ad7[_0xe1a2('0x15')](_0x371ad7['agents'][_0x591c00['id']],_0x591c00);}}}return _0x371ad7[_0xe1a2('0xa')];};};Realtime['prototype'][_0xe1a2('0x19')]=function(){var _0x342bc5=this;return function(_0x2c1007){if(_0x2c1007){freeIsNotKey(_0x2c1007,_0x342bc5[_0xe1a2('0x1a')],'id');for(var _0x4f03a7=0x0,_0x57ec92={},_0x335da1={};_0x4f03a7<_0x2c1007['length'];_0x4f03a7+=0x1){_0x57ec92=_0x2c1007[_0x4f03a7];if(_[_0xe1a2('0x1b')](_0x342bc5[_0xe1a2('0x1a')][_0x57ec92['id']])){_0x342bc5[_0xe1a2('0x1a')][_0x57ec92['id']]=new Interval(_0x57ec92);}else{_0x342bc5[_0xe1a2('0x15')](_0x342bc5[_0xe1a2('0x1a')][_0x57ec92['id']],_0x57ec92);}}}return _0x342bc5[_0xe1a2('0x1a')];};};Realtime['prototype']['initOpenchannelQueues']=function(){var _0x156419=this;return function(_0x3626eb){if(_0x3626eb){freeIsNotKey(_0x3626eb,_0x156419[_0xe1a2('0x1c')],'id');for(var _0x3258ff=0x0,_0x180e15={},_0xc57dec={};_0x3258ff<_0x3626eb[_0xe1a2('0x18')];_0x3258ff+=0x1){_0x180e15=_0x3626eb[_0x3258ff];if(_[_0xe1a2('0x1b')](_0x156419[_0xe1a2('0x1c')][_0x180e15['id']])){_0x156419[_0xe1a2('0x1c')][_0x180e15['id']]=new OpenchannelQueue(_0x180e15);}else{_0x156419['mergeFromDatabase'](_0x156419[_0xe1a2('0x1c')][_0x180e15['id']],_0x180e15);}_0x156419[_0xe1a2('0x1c')][_0x180e15['id']][_0xe1a2('0x1d')]();_0x156419['openchannelQueues'][_0x180e15['id']][_0xe1a2('0x1e')]();}}return _0x156419[_0xe1a2('0x1c')];};};Realtime[_0xe1a2('0x14')][_0xe1a2('0x1f')]=function(){var _0x1e225b=this;return function(_0x5470dc){if(_0x5470dc){freeIsNotKey(_0x5470dc,_0x1e225b[_0xe1a2('0xb')],'id');for(var _0x1d2e8d=0x0,_0x460d10={},_0x47056a={};_0x1d2e8d<_0x5470dc['length'];_0x1d2e8d+=0x1){_0x460d10=_0x5470dc[_0x1d2e8d];if(_['isUndefined'](_0x1e225b['chatQueues'][_0x460d10['id']])){_0x1e225b[_0xe1a2('0xb')][_0x460d10['id']]=new ChatQueue(_0x460d10);}else{_0x1e225b[_0xe1a2('0x15')](_0x1e225b[_0xe1a2('0xb')][_0x460d10['id']],_0x460d10);}_0x1e225b[_0xe1a2('0xb')][_0x460d10['id']][_0xe1a2('0x1d')]();_0x1e225b[_0xe1a2('0xb')][_0x460d10['id']][_0xe1a2('0x1e')]();}}return _0x1e225b[_0xe1a2('0xb')];};};Realtime[_0xe1a2('0x14')][_0xe1a2('0x20')]=function(){var _0x397460=this;return function(_0x13807e){if(_0x13807e){freeIsNotKey(_0x13807e,_0x397460[_0xe1a2('0xc')],'id');for(var _0x3635d8=0x0,_0x1e3a42={},_0x152608={};_0x3635d8<_0x13807e[_0xe1a2('0x18')];_0x3635d8+=0x1){_0x1e3a42=_0x13807e[_0x3635d8];if(_[_0xe1a2('0x1b')](_0x397460[_0xe1a2('0xc')][_0x1e3a42['id']])){_0x397460[_0xe1a2('0xc')][_0x1e3a42['id']]=new SmsQueue(_0x1e3a42);}else{_0x397460[_0xe1a2('0x15')](_0x397460['smsQueues'][_0x1e3a42['id']],_0x1e3a42);}_0x397460[_0xe1a2('0xc')][_0x1e3a42['id']]['updateRouting']();_0x397460[_0xe1a2('0xc')][_0x1e3a42['id']][_0xe1a2('0x1e')]();}}return _0x397460[_0xe1a2('0xc')];};};Realtime[_0xe1a2('0x14')][_0xe1a2('0x21')]=function(){var _0x38f95d=this;return function(_0x60f36){if(_0x60f36){freeIsNotKey(_0x60f36,_0x38f95d[_0xe1a2('0xd')],'id');for(var _0x312430=0x0,_0x2757a6={},_0x5d27f6={};_0x312430<_0x60f36[_0xe1a2('0x18')];_0x312430+=0x1){_0x2757a6=_0x60f36[_0x312430];if(_['isUndefined'](_0x38f95d['mailQueues'][_0x2757a6['id']])){_0x38f95d['mailQueues'][_0x2757a6['id']]=new MailQueue(_0x2757a6);}else{_0x38f95d[_0xe1a2('0x15')](_0x38f95d[_0xe1a2('0xd')][_0x2757a6['id']],_0x2757a6);}_0x38f95d[_0xe1a2('0xd')][_0x2757a6['id']]['updateRouting']();_0x38f95d[_0xe1a2('0xd')][_0x2757a6['id']][_0xe1a2('0x1e')]();}}return _0x38f95d[_0xe1a2('0xd')];};};Realtime[_0xe1a2('0x14')][_0xe1a2('0x22')]=function(){var _0x21bf15=this;return function(_0x3f9772){if(_0x3f9772){freeIsNotKey(_0x3f9772,_0x21bf15['faxQueues'],'id');for(var _0xe737e=0x0,_0x41f2f6={},_0x5d1bb3={};_0xe737e<_0x3f9772[_0xe1a2('0x18')];_0xe737e+=0x1){_0x41f2f6=_0x3f9772[_0xe737e];if(_[_0xe1a2('0x1b')](_0x21bf15['faxQueues'][_0x41f2f6['id']])){_0x21bf15[_0xe1a2('0xe')][_0x41f2f6['id']]=new FaxQueue(_0x41f2f6);}else{_0x21bf15[_0xe1a2('0x15')](_0x21bf15[_0xe1a2('0xe')][_0x41f2f6['id']],_0x41f2f6);}_0x21bf15[_0xe1a2('0xe')][_0x41f2f6['id']]['updateRouting']();_0x21bf15[_0xe1a2('0xe')][_0x41f2f6['id']]['updateRealtime']();}}return _0x21bf15[_0xe1a2('0xe')];};};module[_0xe1a2('0x23')]=Realtime; \ No newline at end of file diff --git a/server/services/routing/rpc/chatInteraction.js b/server/services/routing/rpc/chatInteraction.js index 18ce8ab..bc1add4 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 _0xbf47=['Request','UpdateChatInteraction','addTags','AddTagsToChatInteraction','../client','update'];(function(_0x3bf83f,_0x181cac){var _0x22c4a9=function(_0xb3ff0d){while(--_0xb3ff0d){_0x3bf83f['push'](_0x3bf83f['shift']());}};_0x22c4a9(++_0x181cac);}(_0xbf47,0x196));var _0x7bf4=function(_0x243dcb,_0x46fe03){_0x243dcb=_0x243dcb-0x0;var _0x1f3c96=_0xbf47[_0x243dcb];return _0x1f3c96;};'use strict';var client=require(_0x7bf4('0x0'));exports[_0x7bf4('0x1')]=function(_0x4350f4,_0x53face){return client[_0x7bf4('0x2')](_0x7bf4('0x3'),{'body':_0x53face,'options':{'where':{'id':_0x4350f4}},'log':'updateChatInteraction'});};exports[_0x7bf4('0x4')]=function(_0x194621,_0x4b5b40){return client[_0x7bf4('0x2')](_0x7bf4('0x5'),{'body':_0x4b5b40,'options':{'where':{'id':_0x194621}},'log':'addTagsToChatInteraction'});}; \ No newline at end of file +var _0xcf20=['updateChatInteraction','addTags','../client','Request'];(function(_0x177cd0,_0x20fd68){var _0x1b1f51=function(_0x238149){while(--_0x238149){_0x177cd0['push'](_0x177cd0['shift']());}};_0x1b1f51(++_0x20fd68);}(_0xcf20,0x1a6));var _0x0cf2=function(_0x426c09,_0x44fbc8){_0x426c09=_0x426c09-0x0;var _0x3a2793=_0xcf20[_0x426c09];return _0x3a2793;};'use strict';var client=require(_0x0cf2('0x0'));exports['update']=function(_0x57f3da,_0x1fabf9){return client[_0x0cf2('0x1')]('UpdateChatInteraction',{'body':_0x1fabf9,'options':{'where':{'id':_0x57f3da}},'log':_0x0cf2('0x2')});};exports[_0x0cf2('0x3')]=function(_0x27a5c4,_0x551053){return client['Request']('AddTagsToChatInteraction',{'body':_0x551053,'options':{'where':{'id':_0x27a5c4}},'log':'addTagsToChatInteraction'});}; \ No newline at end of file diff --git a/server/services/routing/rpc/chatMessage.js b/server/services/routing/rpc/chatMessage.js index 8be5da1..a0c3767 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 _0x92fb=['create','CreateChatMessage','createChatMessage','../client'];(function(_0x54f7c0,_0x27af83){var _0x245d03=function(_0x1ad6c4){while(--_0x1ad6c4){_0x54f7c0['push'](_0x54f7c0['shift']());}};_0x245d03(++_0x27af83);}(_0x92fb,0xb3));var _0xb92f=function(_0x1fd456,_0x3b5d5f){_0x1fd456=_0x1fd456-0x0;var _0x599648=_0x92fb[_0x1fd456];return _0x599648;};'use strict';var client=require(_0xb92f('0x0'));exports[_0xb92f('0x1')]=function(_0x3e5793){return client['Request'](_0xb92f('0x2'),{'body':_0x3e5793,'log':_0xb92f('0x3')});}; \ No newline at end of file +var _0x36c6=['../client','create','Request','CreateChatMessage','createChatMessage'];(function(_0x3b380d,_0x4bf247){var _0x54502b=function(_0x35d207){while(--_0x35d207){_0x3b380d['push'](_0x3b380d['shift']());}};_0x54502b(++_0x4bf247);}(_0x36c6,0x1f4));var _0x636c=function(_0x1b5074,_0x3e5b45){_0x1b5074=_0x1b5074-0x0;var _0x1750a8=_0x36c6[_0x1b5074];return _0x1750a8;};'use strict';var client=require(_0x636c('0x0'));exports[_0x636c('0x1')]=function(_0x39f0bd){return client[_0x636c('0x2')](_0x636c('0x3'),{'body':_0x39f0bd,'log':_0x636c('0x4')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/chatQueue.js b/server/services/routing/rpc/chatQueue.js index b7b329e..7e7b785 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 _0xd455=['online','chatPause','../client','Request','name','timeout','strategy','User','Agents'];(function(_0x528eef,_0x2fdf7b){var _0x4de169=function(_0xc114f3){while(--_0xc114f3){_0x528eef['push'](_0x528eef['shift']());}};_0x4de169(++_0x2fdf7b);}(_0xd455,0x1a9));var _0x5d45=function(_0x30e3f2,_0x275eaa){_0x30e3f2=_0x30e3f2-0x0;var _0x54dea3=_0xd455[_0x30e3f2];return _0x54dea3;};'use strict';var client=require(_0x5d45('0x0'));exports['getChatQueues']=function(){return function(){return client[_0x5d45('0x1')]('GetChatQueue',{'options':{'raw':![],'attributes':['id',_0x5d45('0x2'),_0x5d45('0x3'),_0x5d45('0x4')],'include':[{'model':_0x5d45('0x5'),'as':_0x5d45('0x6'),'attributes':['id','name',_0x5d45('0x7'),_0x5d45('0x8')]}]},'log':'getChatQueues'});};}; \ No newline at end of file +var _0xf59e=['chatPause','../client','getChatQueues','Request','GetChatQueue','name','timeout','strategy','online'];(function(_0x5d4f12,_0x11e67c){var _0x4eb577=function(_0x4d7a2d){while(--_0x4d7a2d){_0x5d4f12['push'](_0x5d4f12['shift']());}};_0x4eb577(++_0x11e67c);}(_0xf59e,0x19f));var _0xef59=function(_0xb645b8,_0xbe2b89){_0xb645b8=_0xb645b8-0x0;var _0x2f79bd=_0xf59e[_0xb645b8];return _0x2f79bd;};'use strict';var client=require(_0xef59('0x0'));exports[_0xef59('0x1')]=function(){return function(){return client[_0xef59('0x2')](_0xef59('0x3'),{'options':{'raw':![],'attributes':['id',_0xef59('0x4'),_0xef59('0x5'),_0xef59('0x6')],'include':[{'model':'User','as':'Agents','attributes':['id',_0xef59('0x4'),_0xef59('0x7'),_0xef59('0x8')]}]},'log':_0xef59('0x1')});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/chatQueueReport.js b/server/services/routing/rpc/chatQueueReport.js index 4b81fbc..bb01eb6 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 _0x833b=['create','Request','CreateChatQueueReport','UpdateChatQueueReport','DESC'];(function(_0x264d76,_0x160b13){var _0x112718=function(_0x1a622e){while(--_0x1a622e){_0x264d76['push'](_0x264d76['shift']());}};_0x112718(++_0x160b13);}(_0x833b,0x131));var _0xb833=function(_0x4ae6ef,_0xc2af80){_0x4ae6ef=_0x4ae6ef-0x0;var _0x3cbb4e=_0x833b[_0x4ae6ef];return _0x3cbb4e;};'use strict';var client=require('../client');exports[_0xb833('0x0')]=function(_0x5ba71d){return client[_0xb833('0x1')]('CreateChatQueueReport',{'body':_0x5ba71d,'log':_0xb833('0x2')});};exports['update']=function(_0x66e74c,_0x37ea87){return client[_0xb833('0x1')](_0xb833('0x3'),{'body':_0x37ea87,'options':{'where':{'uniqueid':_0x66e74c},'order':[['id',_0xb833('0x4')]],'limit':0x1},'log':_0xb833('0x3')});}; \ No newline at end of file +var _0xf194=['DESC','../client','create','Request','CreateChatQueueReport','UpdateChatQueueReport'];(function(_0x36147b,_0x57f40b){var _0x141351=function(_0x219aa1){while(--_0x219aa1){_0x36147b['push'](_0x36147b['shift']());}};_0x141351(++_0x57f40b);}(_0xf194,0x91));var _0x4f19=function(_0x88d656,_0x4e8ad0){_0x88d656=_0x88d656-0x0;var _0x15554b=_0xf194[_0x88d656];return _0x15554b;};'use strict';var client=require(_0x4f19('0x0'));exports[_0x4f19('0x1')]=function(_0x1ab42a){return client[_0x4f19('0x2')]('CreateChatQueueReport',{'body':_0x1ab42a,'log':_0x4f19('0x3')});};exports['update']=function(_0x5db065,_0x5c0587){return client[_0x4f19('0x2')](_0x4f19('0x4'),{'body':_0x5c0587,'options':{'where':{'uniqueid':_0x5db065},'order':[['id',_0x4f19('0x5')]],'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 d047f2a..de326f2 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 _0x61d9=['addTagsToFaxInteraction','update','Request','UpdateFaxInteraction','addTags','AddTagsToFaxInteraction'];(function(_0x40b2ed,_0x2b1765){var _0x18397d=function(_0xc6a86f){while(--_0xc6a86f){_0x40b2ed['push'](_0x40b2ed['shift']());}};_0x18397d(++_0x2b1765);}(_0x61d9,0x17b));var _0x961d=function(_0x32c2da,_0x4be1d7){_0x32c2da=_0x32c2da-0x0;var _0x4a40ed=_0x61d9[_0x32c2da];return _0x4a40ed;};'use strict';var client=require('../client');exports[_0x961d('0x0')]=function(_0xba345e,_0x228f21){return client[_0x961d('0x1')](_0x961d('0x2'),{'body':_0x228f21,'options':{'where':{'id':_0xba345e}},'log':'updateFaxInteraction'});};exports[_0x961d('0x3')]=function(_0x703bd1,_0x5e9eb8){return client[_0x961d('0x1')](_0x961d('0x4'),{'body':_0x5e9eb8,'options':{'where':{'id':_0x703bd1}},'log':_0x961d('0x5')});}; \ No newline at end of file +var _0xef82=['updateFaxInteraction','addTags','Request','AddTagsToFaxInteraction','addTagsToFaxInteraction','../client','update','UpdateFaxInteraction'];(function(_0x350cb2,_0x5b4917){var _0x3fffbb=function(_0x22e833){while(--_0x22e833){_0x350cb2['push'](_0x350cb2['shift']());}};_0x3fffbb(++_0x5b4917);}(_0xef82,0xb5));var _0x2ef8=function(_0x24f31b,_0x44b8f3){_0x24f31b=_0x24f31b-0x0;var _0x488401=_0xef82[_0x24f31b];return _0x488401;};'use strict';var client=require(_0x2ef8('0x0'));exports[_0x2ef8('0x1')]=function(_0x174063,_0x60985a){return client['Request'](_0x2ef8('0x2'),{'body':_0x60985a,'options':{'where':{'id':_0x174063}},'log':_0x2ef8('0x3')});};exports[_0x2ef8('0x4')]=function(_0x10bd02,_0x3d51b0){return client[_0x2ef8('0x5')](_0x2ef8('0x6'),{'body':_0x3d51b0,'options':{'where':{'id':_0x10bd02}},'log':_0x2ef8('0x7')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/faxMessage.js b/server/services/routing/rpc/faxMessage.js index 6917a54..312c416 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 _0xc4ea=['Request','CreateFaxMessage','../client','create'];(function(_0x43e683,_0x5a085){var _0x5496d7=function(_0x3eecf3){while(--_0x3eecf3){_0x43e683['push'](_0x43e683['shift']());}};_0x5496d7(++_0x5a085);}(_0xc4ea,0x186));var _0xac4e=function(_0x24e479,_0x1cde14){_0x24e479=_0x24e479-0x0;var _0x31e5ae=_0xc4ea[_0x24e479];return _0x31e5ae;};'use strict';var client=require(_0xac4e('0x0'));exports[_0xac4e('0x1')]=function(_0x13ca41){return client[_0xac4e('0x2')](_0xac4e('0x3'),{'body':_0x13ca41,'log':'createFaxMessage'});}; \ No newline at end of file +var _0xd22a=['createFaxMessage','../client'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xd22a,0xe1));var _0xad22=function(_0x3de588,_0xd08a16){_0x3de588=_0x3de588-0x0;var _0x2a4b71=_0xd22a[_0x3de588];return _0x2a4b71;};'use strict';var client=require(_0xad22('0x0'));exports['create']=function(_0x2651ed){return client['Request']('CreateFaxMessage',{'body':_0x2651ed,'log':_0xad22('0x1')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/faxQueue.js b/server/services/routing/rpc/faxQueue.js index c8d7e86..718e574 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 _0xe25e=['timeout','Agents','online','faxPause','../client','getFaxQueues','Request','GetFaxQueue','name'];(function(_0x2eacac,_0x4c2189){var _0x26bba6=function(_0xcc0912){while(--_0xcc0912){_0x2eacac['push'](_0x2eacac['shift']());}};_0x26bba6(++_0x4c2189);}(_0xe25e,0xee));var _0xee25=function(_0x38c9f2,_0x5935d1){_0x38c9f2=_0x38c9f2-0x0;var _0x5957fc=_0xe25e[_0x38c9f2];return _0x5957fc;};'use strict';var client=require(_0xee25('0x0'));exports[_0xee25('0x1')]=function(){return function(){return client[_0xee25('0x2')](_0xee25('0x3'),{'options':{'raw':![],'attributes':['id',_0xee25('0x4'),_0xee25('0x5'),'strategy'],'include':[{'model':'User','as':_0xee25('0x6'),'attributes':['id',_0xee25('0x4'),_0xee25('0x7'),_0xee25('0x8')]}]},'log':_0xee25('0x1')});};}; \ No newline at end of file +var _0x3de9=['online','faxPause','../client','getFaxQueues','name','timeout','strategy','Agents'];(function(_0x1caf6a,_0x26a5bf){var _0x1bf493=function(_0x3982f5){while(--_0x3982f5){_0x1caf6a['push'](_0x1caf6a['shift']());}};_0x1bf493(++_0x26a5bf);}(_0x3de9,0x10a));var _0x93de=function(_0x5aea4f,_0x8b8e4e){_0x5aea4f=_0x5aea4f-0x0;var _0x150cfe=_0x3de9[_0x5aea4f];return _0x150cfe;};'use strict';var client=require(_0x93de('0x0'));exports[_0x93de('0x1')]=function(){return function(){return client['Request']('GetFaxQueue',{'options':{'raw':![],'attributes':['id',_0x93de('0x2'),_0x93de('0x3'),_0x93de('0x4')],'include':[{'model':'User','as':_0x93de('0x5'),'attributes':['id',_0x93de('0x2'),_0x93de('0x6'),_0x93de('0x7')]}]},'log':_0x93de('0x1')});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/faxQueueReport.js b/server/services/routing/rpc/faxQueueReport.js index 41cf3a8..6adc303 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 _0xe74d=['UpdateFaxQueueReport','DESC','../client','create','CreateFaxQueueReport','update','Request'];(function(_0x1ef9de,_0x1c35ed){var _0x40da45=function(_0x53d419){while(--_0x53d419){_0x1ef9de['push'](_0x1ef9de['shift']());}};_0x40da45(++_0x1c35ed);}(_0xe74d,0x16e));var _0xde74=function(_0x4a724f,_0x5b001a){_0x4a724f=_0x4a724f-0x0;var _0x35adab=_0xe74d[_0x4a724f];return _0x35adab;};'use strict';var client=require(_0xde74('0x0'));exports[_0xde74('0x1')]=function(_0x48c6be){return client['Request'](_0xde74('0x2'),{'body':_0x48c6be,'log':_0xde74('0x2')});};exports[_0xde74('0x3')]=function(_0x2553f5,_0x5792c7){return client[_0xde74('0x4')](_0xde74('0x5'),{'body':_0x5792c7,'options':{'where':{'uniqueid':_0x2553f5},'order':[['id',_0xde74('0x6')]],'limit':0x1},'log':_0xde74('0x5')});}; \ No newline at end of file +var _0x9096=['../client','create','Request','CreateFaxQueueReport','UpdateFaxQueueReport','DESC'];(function(_0x36f47c,_0x38ef4d){var _0x296c55=function(_0x403eec){while(--_0x403eec){_0x36f47c['push'](_0x36f47c['shift']());}};_0x296c55(++_0x38ef4d);}(_0x9096,0x174));var _0x6909=function(_0x5458f7,_0x3ee7aa){_0x5458f7=_0x5458f7-0x0;var _0x2cfb84=_0x9096[_0x5458f7];return _0x2cfb84;};'use strict';var client=require(_0x6909('0x0'));exports[_0x6909('0x1')]=function(_0x22a572){return client[_0x6909('0x2')](_0x6909('0x3'),{'body':_0x22a572,'log':_0x6909('0x3')});};exports['update']=function(_0x91ce52,_0x5ea5e2){return client[_0x6909('0x2')](_0x6909('0x4'),{'body':_0x5ea5e2,'options':{'where':{'uniqueid':_0x91ce52},'order':[['id',_0x6909('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 bbdbfd2..e1e8d98 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 _0x02a7=['Intervals','interval','getIntervals','Request','GetInterval','name','Interval'];(function(_0x58965a,_0x2e71db){var _0x254efc=function(_0xf14fb4){while(--_0xf14fb4){_0x58965a['push'](_0x58965a['shift']());}};_0x254efc(++_0x2e71db);}(_0x02a7,0x1a6));var _0x702a=function(_0x5037b4,_0x4e00ee){_0x5037b4=_0x5037b4-0x0;var _0x4f2d55=_0x02a7[_0x5037b4];return _0x4f2d55;};'use strict';var client=require('../client');exports[_0x702a('0x0')]=function(){return function(){return client[_0x702a('0x1')](_0x702a('0x2'),{'options':{'raw':![],'where':{'IntervalId':null},'attributes':['id',_0x702a('0x3')],'include':[{'model':_0x702a('0x4'),'as':_0x702a('0x5'),'attributes':['id',_0x702a('0x3'),_0x702a('0x6')]}]},'log':_0x702a('0x0')});};}; \ No newline at end of file +var _0xd914=['GetInterval','name','Interval','Intervals','interval','../client','getIntervals'];(function(_0x17d9e3,_0x1f969c){var _0x14192d=function(_0x159745){while(--_0x159745){_0x17d9e3['push'](_0x17d9e3['shift']());}};_0x14192d(++_0x1f969c);}(_0xd914,0x17f));var _0x4d91=function(_0x282ccc,_0x5d66a1){_0x282ccc=_0x282ccc-0x0;var _0x27c2dd=_0xd914[_0x282ccc];return _0x27c2dd;};'use strict';var client=require(_0x4d91('0x0'));exports[_0x4d91('0x1')]=function(){return function(){return client['Request'](_0x4d91('0x2'),{'options':{'raw':![],'where':{'IntervalId':null},'attributes':['id',_0x4d91('0x3')],'include':[{'model':_0x4d91('0x4'),'as':_0x4d91('0x5'),'attributes':['id',_0x4d91('0x3'),_0x4d91('0x6')]}]},'log':'getIntervals'});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/mailInteraction.js b/server/services/routing/rpc/mailInteraction.js index 4408c46..ab43d57 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 _0xb21b=['Request','UpdateMailInteraction','updateMailInteraction','addTags','AddTagsToMailInteraction','../client'];(function(_0x3a7a9c,_0x24f7d6){var _0x59156e=function(_0x5bc930){while(--_0x5bc930){_0x3a7a9c['push'](_0x3a7a9c['shift']());}};_0x59156e(++_0x24f7d6);}(_0xb21b,0x15b));var _0xbb21=function(_0x4060ce,_0x3259a5){_0x4060ce=_0x4060ce-0x0;var _0x4bbecc=_0xb21b[_0x4060ce];return _0x4bbecc;};'use strict';var client=require(_0xbb21('0x0'));exports['update']=function(_0x4d1ff1,_0x39e893){return client[_0xbb21('0x1')](_0xbb21('0x2'),{'body':_0x39e893,'options':{'where':{'id':_0x4d1ff1}},'log':_0xbb21('0x3')});};exports[_0xbb21('0x4')]=function(_0x11129e,_0x588647){return client[_0xbb21('0x1')](_0xbb21('0x5'),{'body':_0x588647,'options':{'where':{'id':_0x11129e}},'log':'addTagsToChatInteraction'});}; \ No newline at end of file +var _0x39ea=['UpdateMailInteraction','addTags','AddTagsToMailInteraction','addTagsToChatInteraction','Request'];(function(_0xac151d,_0x4ea1d2){var _0x111dba=function(_0x13d7f4){while(--_0x13d7f4){_0xac151d['push'](_0xac151d['shift']());}};_0x111dba(++_0x4ea1d2);}(_0x39ea,0x1bc));var _0xa39e=function(_0x511319,_0x5aa3c9){_0x511319=_0x511319-0x0;var _0x5e6304=_0x39ea[_0x511319];return _0x5e6304;};'use strict';var client=require('../client');exports['update']=function(_0x47cd56,_0x583ef7){return client[_0xa39e('0x0')](_0xa39e('0x1'),{'body':_0x583ef7,'options':{'where':{'id':_0x47cd56}},'log':'updateMailInteraction'});};exports[_0xa39e('0x2')]=function(_0x1e5107,_0x13ea9d){return client[_0xa39e('0x0')](_0xa39e('0x3'),{'body':_0x13ea9d,'options':{'where':{'id':_0x1e5107}},'log':_0xa39e('0x4')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/mailMessage.js b/server/services/routing/rpc/mailMessage.js index cbb01e1..aaac7f6 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 _0xf317=['../client','create','Request','CreateMailMessage','createMailMessage'];(function(_0x5d034b,_0x5e354d){var _0xaec86d=function(_0x40afe4){while(--_0x40afe4){_0x5d034b['push'](_0x5d034b['shift']());}};_0xaec86d(++_0x5e354d);}(_0xf317,0x82));var _0x7f31=function(_0x4c5ad6,_0x39af96){_0x4c5ad6=_0x4c5ad6-0x0;var _0x418239=_0xf317[_0x4c5ad6];return _0x418239;};'use strict';var client=require(_0x7f31('0x0'));exports[_0x7f31('0x1')]=function(_0x48be4b){return client[_0x7f31('0x2')](_0x7f31('0x3'),{'body':_0x48be4b,'log':_0x7f31('0x4')});}; \ No newline at end of file +var _0x0f76=['createMailMessage','../client','Request'];(function(_0x13b17b,_0x5a5736){var _0x16df41=function(_0xf1120a){while(--_0xf1120a){_0x13b17b['push'](_0x13b17b['shift']());}};_0x16df41(++_0x5a5736);}(_0x0f76,0x172));var _0x60f7=function(_0x3a94e1,_0x22e4fd){_0x3a94e1=_0x3a94e1-0x0;var _0x6a09d5=_0x0f76[_0x3a94e1];return _0x6a09d5;};'use strict';var client=require(_0x60f7('0x0'));exports['create']=function(_0x487857){return client[_0x60f7('0x1')]('CreateMailMessage',{'body':_0x487857,'log':_0x60f7('0x2')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/mailQueue.js b/server/services/routing/rpc/mailQueue.js index 9ffa54c..4939ce3 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 _0xbc8d=['online','mailPause','../client','getMailQueues','Request','GetMailQueue','name','timeout','strategy','User','Agents'];(function(_0x4b84e8,_0x23e807){var _0x3d8b44=function(_0x19a459){while(--_0x19a459){_0x4b84e8['push'](_0x4b84e8['shift']());}};_0x3d8b44(++_0x23e807);}(_0xbc8d,0x65));var _0xdbc8=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xbc8d[_0x3dd15e];return _0x231fd0;};'use strict';var client=require(_0xdbc8('0x0'));exports[_0xdbc8('0x1')]=function(){return function(){return client[_0xdbc8('0x2')](_0xdbc8('0x3'),{'options':{'raw':![],'attributes':['id',_0xdbc8('0x4'),_0xdbc8('0x5'),_0xdbc8('0x6')],'include':[{'model':_0xdbc8('0x7'),'as':_0xdbc8('0x8'),'attributes':['id',_0xdbc8('0x4'),_0xdbc8('0x9'),_0xdbc8('0xa')]}]},'log':_0xdbc8('0x1')});};}; \ No newline at end of file +var _0x340c=['../client','Request','name','timeout','strategy','User','Agents','online','getMailQueues'];(function(_0x462999,_0x24d200){var _0x4b1366=function(_0x1fa353){while(--_0x1fa353){_0x462999['push'](_0x462999['shift']());}};_0x4b1366(++_0x24d200);}(_0x340c,0x168));var _0xc340=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x340c[_0x3dd15e];return _0x231fd0;};'use strict';var client=require(_0xc340('0x0'));exports['getMailQueues']=function(){return function(){return client[_0xc340('0x1')]('GetMailQueue',{'options':{'raw':![],'attributes':['id',_0xc340('0x2'),_0xc340('0x3'),_0xc340('0x4')],'include':[{'model':_0xc340('0x5'),'as':_0xc340('0x6'),'attributes':['id',_0xc340('0x2'),_0xc340('0x7'),'mailPause']}]},'log':_0xc340('0x8')});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/mailQueueReport.js b/server/services/routing/rpc/mailQueueReport.js index e1c3122..336fefb 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 _0x72e3=['update','Request','UpdateMailQueueReport','../client','create','CreateMailQueueReport'];(function(_0x4012d3,_0x2dd63a){var _0x8c4774=function(_0x4277eb){while(--_0x4277eb){_0x4012d3['push'](_0x4012d3['shift']());}};_0x8c4774(++_0x2dd63a);}(_0x72e3,0x117));var _0x372e=function(_0x598ed6,_0x1c281c){_0x598ed6=_0x598ed6-0x0;var _0x561462=_0x72e3[_0x598ed6];return _0x561462;};'use strict';var client=require(_0x372e('0x0'));exports[_0x372e('0x1')]=function(_0x3b706b){return client['Request']('CreateMailQueueReport',{'body':_0x3b706b,'log':_0x372e('0x2')});};exports[_0x372e('0x3')]=function(_0x593cb0,_0x309f9a){return client[_0x372e('0x4')](_0x372e('0x5'),{'body':_0x309f9a,'options':{'where':{'uniqueid':_0x593cb0},'order':[['id','DESC']],'limit':0x1},'log':_0x372e('0x5')});}; \ No newline at end of file +var _0x6372=['UpdateMailQueueReport','DESC','../client','create','Request','CreateMailQueueReport','update'];(function(_0xc20a08,_0x171ae6){var _0x172dc8=function(_0x46fa69){while(--_0x46fa69){_0xc20a08['push'](_0xc20a08['shift']());}};_0x172dc8(++_0x171ae6);}(_0x6372,0x6b));var _0x2637=function(_0x23111a,_0x454bde){_0x23111a=_0x23111a-0x0;var _0x377d4c=_0x6372[_0x23111a];return _0x377d4c;};'use strict';var client=require(_0x2637('0x0'));exports[_0x2637('0x1')]=function(_0x590e10){return client[_0x2637('0x2')]('CreateMailQueueReport',{'body':_0x590e10,'log':_0x2637('0x3')});};exports[_0x2637('0x4')]=function(_0x509f39,_0x32a1be){return client[_0x2637('0x2')](_0x2637('0x5'),{'body':_0x32a1be,'options':{'where':{'uniqueid':_0x509f39},'order':[['id',_0x2637('0x6')]],'limit':0x1},'log':'UpdateMailQueueReport'});}; \ No newline at end of file diff --git a/server/services/routing/rpc/openchannelInteraction.js b/server/services/routing/rpc/openchannelInteraction.js index 00fe156..e266f29 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 _0x0c2b=['update','Request','UpdateOpenchannelInteraction','updateOpenchannelInteraction','addTags','AddTagsToOpenchannelInteraction','addTagsToChatInteraction','../client'];(function(_0x42a51d,_0x40449d){var _0x4c46cf=function(_0x4affcb){while(--_0x4affcb){_0x42a51d['push'](_0x42a51d['shift']());}};_0x4c46cf(++_0x40449d);}(_0x0c2b,0x167));var _0xb0c2=function(_0x267de7,_0x4c0176){_0x267de7=_0x267de7-0x0;var _0x22cc0d=_0x0c2b[_0x267de7];return _0x22cc0d;};'use strict';var client=require(_0xb0c2('0x0'));exports[_0xb0c2('0x1')]=function(_0x577989,_0x9cffc0){return client[_0xb0c2('0x2')](_0xb0c2('0x3'),{'body':_0x9cffc0,'options':{'where':{'id':_0x577989}},'log':_0xb0c2('0x4')});};exports[_0xb0c2('0x5')]=function(_0x1d2b4a,_0x4194c4){return client['Request'](_0xb0c2('0x6'),{'body':_0x4194c4,'options':{'where':{'id':_0x1d2b4a}},'log':_0xb0c2('0x7')});}; \ No newline at end of file +var _0x5cbd=['Request','AddTagsToOpenchannelInteraction','../client','UpdateOpenchannelInteraction','updateOpenchannelInteraction','addTags'];(function(_0x5dbaf1,_0x31986a){var _0xcdbb55=function(_0x3cb945){while(--_0x3cb945){_0x5dbaf1['push'](_0x5dbaf1['shift']());}};_0xcdbb55(++_0x31986a);}(_0x5cbd,0x122));var _0xd5cb=function(_0x1cf99c,_0x21fb95){_0x1cf99c=_0x1cf99c-0x0;var _0x2a3710=_0x5cbd[_0x1cf99c];return _0x2a3710;};'use strict';var client=require(_0xd5cb('0x0'));exports['update']=function(_0xf9683,_0x2f442f){return client['Request'](_0xd5cb('0x1'),{'body':_0x2f442f,'options':{'where':{'id':_0xf9683}},'log':_0xd5cb('0x2')});};exports[_0xd5cb('0x3')]=function(_0x52bb82,_0x9711da){return client[_0xd5cb('0x4')](_0xd5cb('0x5'),{'body':_0x9711da,'options':{'where':{'id':_0x52bb82}},'log':'addTagsToChatInteraction'});}; \ No newline at end of file diff --git a/server/services/routing/rpc/openchannelMessage.js b/server/services/routing/rpc/openchannelMessage.js index 1ac1637..3f208a7 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 _0x9bde=['create','Request','createOpenchannelMessage'];(function(_0x3dc57e,_0x65d981){var _0x415929=function(_0x2f985b){while(--_0x2f985b){_0x3dc57e['push'](_0x3dc57e['shift']());}};_0x415929(++_0x65d981);}(_0x9bde,0xe1));var _0xe9bd=function(_0x148ced,_0x45cd49){_0x148ced=_0x148ced-0x0;var _0x168181=_0x9bde[_0x148ced];return _0x168181;};'use strict';var client=require('../client');exports[_0xe9bd('0x0')]=function(_0x4defda){return client[_0xe9bd('0x1')]('CreateOpenchannelMessage',{'body':_0x4defda,'log':_0xe9bd('0x2')});}; \ No newline at end of file +var _0x70e0=['createOpenchannelMessage','../client','create'];(function(_0x2d7827,_0x5afb3d){var _0x2ef080=function(_0x27fd0f){while(--_0x27fd0f){_0x2d7827['push'](_0x2d7827['shift']());}};_0x2ef080(++_0x5afb3d);}(_0x70e0,0x17b));var _0x070e=function(_0x1588c5,_0x67b3e5){_0x1588c5=_0x1588c5-0x0;var _0x4f3f1a=_0x70e0[_0x1588c5];return _0x4f3f1a;};'use strict';var client=require(_0x070e('0x0'));exports[_0x070e('0x1')]=function(_0x198c2e){return client['Request']('CreateOpenchannelMessage',{'body':_0x198c2e,'log':_0x070e('0x2')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/openchannelQueue.js b/server/services/routing/rpc/openchannelQueue.js index e8dbb69..55a5cb3 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 _0x047b=['GetOpenchannelQueue','timeout','strategy','User','Agents','name','online','../client','getOpenchannelQueues','Request'];(function(_0x1af40e,_0x204d68){var _0x1eea5a=function(_0x1d222b){while(--_0x1d222b){_0x1af40e['push'](_0x1af40e['shift']());}};_0x1eea5a(++_0x204d68);}(_0x047b,0x1c9));var _0xb047=function(_0x21549c,_0x6d64d1){_0x21549c=_0x21549c-0x0;var _0x426cbd=_0x047b[_0x21549c];return _0x426cbd;};'use strict';var client=require(_0xb047('0x0'));exports[_0xb047('0x1')]=function(){return function(){return client[_0xb047('0x2')](_0xb047('0x3'),{'options':{'raw':![],'attributes':['id','name',_0xb047('0x4'),_0xb047('0x5')],'include':[{'model':_0xb047('0x6'),'as':_0xb047('0x7'),'attributes':['id',_0xb047('0x8'),_0xb047('0x9'),'openchannelPause']}]},'log':'getOpenchannelQueues'});};}; \ No newline at end of file +var _0xc034=['getOpenchannelQueues','Request','GetOpenchannelQueue','name','strategy','Agents','online','openchannelPause','../client'];(function(_0x5c9307,_0x5b97e4){var _0x373e29=function(_0xefebbd){while(--_0xefebbd){_0x5c9307['push'](_0x5c9307['shift']());}};_0x373e29(++_0x5b97e4);}(_0xc034,0x155));var _0x4c03=function(_0x50651d,_0x5a37bf){_0x50651d=_0x50651d-0x0;var _0x1b37c1=_0xc034[_0x50651d];return _0x1b37c1;};'use strict';var client=require(_0x4c03('0x0'));exports[_0x4c03('0x1')]=function(){return function(){return client[_0x4c03('0x2')](_0x4c03('0x3'),{'options':{'raw':![],'attributes':['id',_0x4c03('0x4'),'timeout',_0x4c03('0x5')],'include':[{'model':'User','as':_0x4c03('0x6'),'attributes':['id','name',_0x4c03('0x7'),_0x4c03('0x8')]}]},'log':_0x4c03('0x1')});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/openchannelQueueReport.js b/server/services/routing/rpc/openchannelQueueReport.js index 42051ea..09d3ccf 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 _0x4f5f=['DESC','../client','create','CreateOpenchannelQueueReport','update'];(function(_0xb27862,_0x4843a0){var _0x2ca1d1=function(_0x310c36){while(--_0x310c36){_0xb27862['push'](_0xb27862['shift']());}};_0x2ca1d1(++_0x4843a0);}(_0x4f5f,0x6f));var _0xf4f5=function(_0x454018,_0x46e33a){_0x454018=_0x454018-0x0;var _0x24697d=_0x4f5f[_0x454018];return _0x24697d;};'use strict';var client=require(_0xf4f5('0x0'));exports[_0xf4f5('0x1')]=function(_0x3bf153){return client['Request'](_0xf4f5('0x2'),{'body':_0x3bf153,'log':_0xf4f5('0x2')});};exports[_0xf4f5('0x3')]=function(_0x5f3ae6,_0x251659){return client['Request']('UpdateOpenchannelQueueReport',{'body':_0x251659,'options':{'where':{'uniqueid':_0x5f3ae6},'order':[['id',_0xf4f5('0x4')]],'limit':0x1},'log':'UpdateOpenchannelQueueReport'});}; \ No newline at end of file +var _0xcc47=['create','Request','DESC','UpdateOpenchannelQueueReport','../client'];(function(_0x29771f,_0x1189ae){var _0x279baf=function(_0xd66325){while(--_0xd66325){_0x29771f['push'](_0x29771f['shift']());}};_0x279baf(++_0x1189ae);}(_0xcc47,0x1d0));var _0x7cc4=function(_0x5af9d5,_0x2dd7e1){_0x5af9d5=_0x5af9d5-0x0;var _0xf31439=_0xcc47[_0x5af9d5];return _0xf31439;};'use strict';var client=require(_0x7cc4('0x0'));exports[_0x7cc4('0x1')]=function(_0x28df9b){return client[_0x7cc4('0x2')]('CreateOpenchannelQueueReport',{'body':_0x28df9b,'log':'CreateOpenchannelQueueReport'});};exports['update']=function(_0x44069f,_0x260ebe){return client['Request']('UpdateOpenchannelQueueReport',{'body':_0x260ebe,'options':{'where':{'uniqueid':_0x44069f},'order':[['id',_0x7cc4('0x3')]],'limit':0x1},'log':_0x7cc4('0x4')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/smsInteraction.js b/server/services/routing/rpc/smsInteraction.js index d88553a..77da071 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 _0x4f3f=['Request','updateSmsInteraction','addTags','AddTagsToSmsInteraction','addTagsToSmsInteraction','update'];(function(_0x533860,_0x2b3188){var _0x54ed86=function(_0x52e62c){while(--_0x52e62c){_0x533860['push'](_0x533860['shift']());}};_0x54ed86(++_0x2b3188);}(_0x4f3f,0xcb));var _0xf4f3=function(_0x2b81e9,_0xdbd77d){_0x2b81e9=_0x2b81e9-0x0;var _0x5a8787=_0x4f3f[_0x2b81e9];return _0x5a8787;};'use strict';var client=require('../client');exports[_0xf4f3('0x0')]=function(_0x36a513,_0x5790a0){return client[_0xf4f3('0x1')]('UpdateSmsInteraction',{'body':_0x5790a0,'options':{'where':{'id':_0x36a513}},'log':_0xf4f3('0x2')});};exports[_0xf4f3('0x3')]=function(_0x324126,_0xb423a3){return client['Request'](_0xf4f3('0x4'),{'body':_0xb423a3,'options':{'where':{'id':_0x324126}},'log':_0xf4f3('0x5')});}; \ No newline at end of file +var _0xe25a=['updateSmsInteraction','addTags','AddTagsToSmsInteraction','../client','update','Request','UpdateSmsInteraction'];(function(_0x3ff085,_0x27c92e){var _0x2b68c3=function(_0x37811e){while(--_0x37811e){_0x3ff085['push'](_0x3ff085['shift']());}};_0x2b68c3(++_0x27c92e);}(_0xe25a,0xe3));var _0xae25=function(_0x352fa2,_0x318269){_0x352fa2=_0x352fa2-0x0;var _0x3f7a49=_0xe25a[_0x352fa2];return _0x3f7a49;};'use strict';var client=require(_0xae25('0x0'));exports[_0xae25('0x1')]=function(_0x34c76d,_0x662fde){return client[_0xae25('0x2')](_0xae25('0x3'),{'body':_0x662fde,'options':{'where':{'id':_0x34c76d}},'log':_0xae25('0x4')});};exports[_0xae25('0x5')]=function(_0x2452bc,_0x5896f1){return client[_0xae25('0x2')](_0xae25('0x6'),{'body':_0x5896f1,'options':{'where':{'id':_0x2452bc}},'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 98bff14..aed122a 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 _0xc358=['create','Request','CreateSmsMessage','createSmsMessage','../client'];(function(_0x18c271,_0x21d44f){var _0x4f4b3a=function(_0x1f07dd){while(--_0x1f07dd){_0x18c271['push'](_0x18c271['shift']());}};_0x4f4b3a(++_0x21d44f);}(_0xc358,0x108));var _0x8c35=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xc358[_0x3dd15e];return _0x231fd0;};'use strict';var client=require(_0x8c35('0x0'));exports[_0x8c35('0x1')]=function(_0x1366bc){return client[_0x8c35('0x2')](_0x8c35('0x3'),{'body':_0x1366bc,'log':_0x8c35('0x4')});}; \ No newline at end of file +var _0xf566=['../client','create','Request','CreateSmsMessage','createSmsMessage'];(function(_0x451f27,_0x3cabe2){var _0x5982b9=function(_0xedde8){while(--_0xedde8){_0x451f27['push'](_0x451f27['shift']());}};_0x5982b9(++_0x3cabe2);}(_0xf566,0x186));var _0x6f56=function(_0x1a0967,_0x51bc82){_0x1a0967=_0x1a0967-0x0;var _0x5a169f=_0xf566[_0x1a0967];return _0x5a169f;};'use strict';var client=require(_0x6f56('0x0'));exports[_0x6f56('0x1')]=function(_0x46ca98){return client[_0x6f56('0x2')](_0x6f56('0x3'),{'body':_0x46ca98,'log':_0x6f56('0x4')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/smsQueue.js b/server/services/routing/rpc/smsQueue.js index 7bd65df..1b2ccac 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 _0x0a63=['timeout','strategy','User','Agents','smsPause','../client','getSmsQueues','Request','GetSmsQueue','name'];(function(_0x47112b,_0x39b43a){var _0x2e54a0=function(_0x4e17f7){while(--_0x4e17f7){_0x47112b['push'](_0x47112b['shift']());}};_0x2e54a0(++_0x39b43a);}(_0x0a63,0x1e5));var _0x30a6=function(_0x3095c7,_0x4a7663){_0x3095c7=_0x3095c7-0x0;var _0x4c678c=_0x0a63[_0x3095c7];return _0x4c678c;};'use strict';var client=require(_0x30a6('0x0'));exports[_0x30a6('0x1')]=function(){return function(){return client[_0x30a6('0x2')](_0x30a6('0x3'),{'options':{'raw':![],'attributes':['id',_0x30a6('0x4'),_0x30a6('0x5'),_0x30a6('0x6')],'include':[{'model':_0x30a6('0x7'),'as':_0x30a6('0x8'),'attributes':['id',_0x30a6('0x4'),'online',_0x30a6('0x9')]}]},'log':'getSmsQueues'});};}; \ No newline at end of file +var _0x9931=['timeout','strategy','User','Agents','online','smsPause','getSmsQueues','GetSmsQueue','name'];(function(_0x354164,_0x4c30de){var _0x5db9a8=function(_0x319b08){while(--_0x319b08){_0x354164['push'](_0x354164['shift']());}};_0x5db9a8(++_0x4c30de);}(_0x9931,0x1b6));var _0x1993=function(_0x20aba5,_0x481fd1){_0x20aba5=_0x20aba5-0x0;var _0x451362=_0x9931[_0x20aba5];return _0x451362;};'use strict';var client=require('../client');exports[_0x1993('0x0')]=function(){return function(){return client['Request'](_0x1993('0x1'),{'options':{'raw':![],'attributes':['id',_0x1993('0x2'),_0x1993('0x3'),_0x1993('0x4')],'include':[{'model':_0x1993('0x5'),'as':_0x1993('0x6'),'attributes':['id',_0x1993('0x2'),_0x1993('0x7'),_0x1993('0x8')]}]},'log':_0x1993('0x0')});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/smsQueueReport.js b/server/services/routing/rpc/smsQueueReport.js index 60d3c2c..25c0658 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 _0x340e=['UpdateSmsQueueReport','../client','CreateSmsQueueReport','update','Request'];(function(_0x24b899,_0x1dd7f4){var _0x48e226=function(_0x1930e9){while(--_0x1930e9){_0x24b899['push'](_0x24b899['shift']());}};_0x48e226(++_0x1dd7f4);}(_0x340e,0x1dc));var _0xe340=function(_0x5ea3b,_0x2edfcc){_0x5ea3b=_0x5ea3b-0x0;var _0x2cd7e4=_0x340e[_0x5ea3b];return _0x2cd7e4;};'use strict';var client=require(_0xe340('0x0'));exports['create']=function(_0x110b33){return client['Request']('CreateSmsQueueReport',{'body':_0x110b33,'log':_0xe340('0x1')});};exports[_0xe340('0x2')]=function(_0x559409,_0x220c39){return client[_0xe340('0x3')](_0xe340('0x4'),{'body':_0x220c39,'options':{'where':{'uniqueid':_0x559409},'order':[['id','DESC']],'limit':0x1},'log':_0xe340('0x4')});}; \ No newline at end of file +var _0x9aa2=['update','Request','UpdateSmsQueueReport','../client','CreateSmsQueueReport'];(function(_0x3fb0b1,_0x38a8a4){var _0x262b6a=function(_0x43884f){while(--_0x43884f){_0x3fb0b1['push'](_0x3fb0b1['shift']());}};_0x262b6a(++_0x38a8a4);}(_0x9aa2,0x125));var _0x29aa=function(_0x1f70b8,_0x45096d){_0x1f70b8=_0x1f70b8-0x0;var _0x3b55ae=_0x9aa2[_0x1f70b8];return _0x3b55ae;};'use strict';var client=require(_0x29aa('0x0'));exports['create']=function(_0x413737){return client['Request'](_0x29aa('0x1'),{'body':_0x413737,'log':'CreateSmsQueueReport'});};exports[_0x29aa('0x2')]=function(_0x42693a,_0x57769d){return client[_0x29aa('0x3')](_0x29aa('0x4'),{'body':_0x57769d,'options':{'where':{'uniqueid':_0x42693a},'order':[['id','DESC']],'limit':0x1},'log':_0x29aa('0x4')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/user.js b/server/services/routing/rpc/user.js index 1ac0030..edba04b 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 _0xab74=['lastPauseAt','voicePause','chatPause','mailPause','faxPause','openchannelPause','chatCapacity','faxCapacity','smsCapacity','openchannelCapacity','../client','getAgents','Request','GetUser','agent','pauseType'];(function(_0x34fd25,_0x1e7f7f){var _0x4927ef=function(_0x53e646){while(--_0x53e646){_0x34fd25['push'](_0x34fd25['shift']());}};_0x4927ef(++_0x1e7f7f);}(_0xab74,0xba));var _0x4ab7=function(_0x2d5ed2,_0xad04f4){_0x2d5ed2=_0x2d5ed2-0x0;var _0x11cea3=_0xab74[_0x2d5ed2];return _0x11cea3;};'use strict';var client=require(_0x4ab7('0x0'));exports[_0x4ab7('0x1')]=function(){return function(){return client[_0x4ab7('0x2')](_0x4ab7('0x3'),{'options':{'raw':!![],'where':{'role':_0x4ab7('0x4')},'attributes':['id','name','online',_0x4ab7('0x5'),_0x4ab7('0x6'),_0x4ab7('0x7'),_0x4ab7('0x8'),_0x4ab7('0x9'),_0x4ab7('0xa'),'smsPause',_0x4ab7('0xb'),_0x4ab7('0xc'),'mailCapacity',_0x4ab7('0xd'),_0x4ab7('0xe'),_0x4ab7('0xf')]},'log':_0x4ab7('0x1')});};}; \ No newline at end of file +var _0x1a46=['GetUser','agent','name','pauseType','lastPauseAt','voicePause','chatPause','smsPause','chatCapacity','mailCapacity','faxCapacity','smsCapacity','openchannelCapacity','getAgents','../client','Request'];(function(_0x4f4272,_0x2cb83c){var _0x131148=function(_0x2d6ad2){while(--_0x2d6ad2){_0x4f4272['push'](_0x4f4272['shift']());}};_0x131148(++_0x2cb83c);}(_0x1a46,0x19e));var _0x61a4=function(_0x35fd66,_0x532757){_0x35fd66=_0x35fd66-0x0;var _0x189d2d=_0x1a46[_0x35fd66];return _0x189d2d;};'use strict';var client=require(_0x61a4('0x0'));exports['getAgents']=function(){return function(){return client[_0x61a4('0x1')](_0x61a4('0x2'),{'options':{'raw':!![],'where':{'role':_0x61a4('0x3')},'attributes':['id',_0x61a4('0x4'),'online',_0x61a4('0x5'),_0x61a4('0x6'),_0x61a4('0x7'),_0x61a4('0x8'),'mailPause','faxPause',_0x61a4('0x9'),'openchannelPause',_0x61a4('0xa'),_0x61a4('0xb'),_0x61a4('0xc'),_0x61a4('0xd'),_0x61a4('0xe')]},'log':_0x61a4('0xf')});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/whatsappInteraction.js b/server/services/routing/rpc/whatsappInteraction.js index 08e2c15..4cccf39 100644 --- a/server/services/routing/rpc/whatsappInteraction.js +++ b/server/services/routing/rpc/whatsappInteraction.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x4f6f=['addTagsToWhatsappInteraction','../client','update','Request','updateWhatsappInteraction','addTags'];(function(_0x3773dd,_0x2d0048){var _0x212e34=function(_0x3bf8a5){while(--_0x3bf8a5){_0x3773dd['push'](_0x3773dd['shift']());}};_0x212e34(++_0x2d0048);}(_0x4f6f,0x157));var _0xf4f6=function(_0x1558ab,_0x39d1de){_0x1558ab=_0x1558ab-0x0;var _0x53b64a=_0x4f6f[_0x1558ab];return _0x53b64a;};'use strict';var client=require(_0xf4f6('0x0'));exports[_0xf4f6('0x1')]=function(_0x2c5690,_0x4b6f0f){return client[_0xf4f6('0x2')]('UpdateWhatsappInteraction',{'body':_0x4b6f0f,'options':{'where':{'id':_0x2c5690}},'log':_0xf4f6('0x3')});};exports[_0xf4f6('0x4')]=function(_0x5a5c07,_0x2e8c14){return client[_0xf4f6('0x2')]('AddTagsToWhatsappInteraction',{'body':_0x2e8c14,'options':{'where':{'id':_0x5a5c07}},'log':_0xf4f6('0x5')});}; \ No newline at end of file +var _0xa8eb=['updateWhatsappInteraction','AddTagsToWhatsappInteraction','../client','Request','UpdateWhatsappInteraction'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xa8eb,0x179));var _0xba8e=function(_0x4dc7ea,_0x1f325b){_0x4dc7ea=_0x4dc7ea-0x0;var _0x4185dd=_0xa8eb[_0x4dc7ea];return _0x4185dd;};'use strict';var client=require(_0xba8e('0x0'));exports['update']=function(_0x26595f,_0x5757ad){return client[_0xba8e('0x1')](_0xba8e('0x2'),{'body':_0x5757ad,'options':{'where':{'id':_0x26595f}},'log':_0xba8e('0x3')});};exports['addTags']=function(_0x353df2,_0x368ce6){return client['Request'](_0xba8e('0x4'),{'body':_0x368ce6,'options':{'where':{'id':_0x353df2}},'log':'addTagsToWhatsappInteraction'});}; \ No newline at end of file diff --git a/server/services/routing/rpc/whatsappMessage.js b/server/services/routing/rpc/whatsappMessage.js index e9c79d7..1ff6266 100644 --- a/server/services/routing/rpc/whatsappMessage.js +++ b/server/services/routing/rpc/whatsappMessage.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa763=['../client','Request'];(function(_0x18d9d9,_0x2cfa05){var _0x1f4293=function(_0x1f2dc1){while(--_0x1f2dc1){_0x18d9d9['push'](_0x18d9d9['shift']());}};_0x1f4293(++_0x2cfa05);}(_0xa763,0x1ac));var _0x3a76=function(_0x24061a,_0x1c9f4d){_0x24061a=_0x24061a-0x0;var _0x82054e=_0xa763[_0x24061a];return _0x82054e;};'use strict';var client=require(_0x3a76('0x0'));exports['create']=function(_0x5cc588){return client[_0x3a76('0x1')]('CreateWhatsappMessage',{'body':_0x5cc588,'log':'createWhatsappMessage'});}; \ No newline at end of file +var _0xcc73=['createWhatsappMessage','../client','create','Request','CreateWhatsappMessage'];(function(_0x91f7ed,_0x19cb3e){var _0x393880=function(_0x2f7559){while(--_0x2f7559){_0x91f7ed['push'](_0x91f7ed['shift']());}};_0x393880(++_0x19cb3e);}(_0xcc73,0x10a));var _0x3cc7=function(_0x465028,_0x4570ac){_0x465028=_0x465028-0x0;var _0xb783d4=_0xcc73[_0x465028];return _0xb783d4;};'use strict';var client=require(_0x3cc7('0x0'));exports[_0x3cc7('0x1')]=function(_0x3628f4){return client[_0x3cc7('0x2')](_0x3cc7('0x3'),{'body':_0x3628f4,'log':_0x3cc7('0x4')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/whatsappQueue.js b/server/services/routing/rpc/whatsappQueue.js index c318002..742a30a 100644 --- a/server/services/routing/rpc/whatsappQueue.js +++ b/server/services/routing/rpc/whatsappQueue.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x55f1=['Agents','whatsappPause','../client','Request','GetWhatsappQueue','name','timeout','strategy','User'];(function(_0x10c69f,_0xbe4e8b){var _0x5d563c=function(_0x5965a8){while(--_0x5965a8){_0x10c69f['push'](_0x10c69f['shift']());}};_0x5d563c(++_0xbe4e8b);}(_0x55f1,0x9b));var _0x155f=function(_0x2737fc,_0x294b50){_0x2737fc=_0x2737fc-0x0;var _0x49baaf=_0x55f1[_0x2737fc];return _0x49baaf;};'use strict';var client=require(_0x155f('0x0'));exports['getWhatsappQueues']=function(){return function(){return client[_0x155f('0x1')](_0x155f('0x2'),{'options':{'raw':![],'attributes':['id',_0x155f('0x3'),_0x155f('0x4'),_0x155f('0x5')],'include':[{'model':_0x155f('0x6'),'as':_0x155f('0x7'),'attributes':['id','name','online',_0x155f('0x8')]}]},'log':'getWhatsappQueues'});};}; \ No newline at end of file +var _0x8130=['Agents','online','../client','getWhatsappQueues','GetWhatsappQueue','name','timeout','strategy','User'];(function(_0x148072,_0x38d81b){var _0x335101=function(_0x168343){while(--_0x168343){_0x148072['push'](_0x148072['shift']());}};_0x335101(++_0x38d81b);}(_0x8130,0x146));var _0x0813=function(_0xa2a65d,_0x15dea2){_0xa2a65d=_0xa2a65d-0x0;var _0xebb13e=_0x8130[_0xa2a65d];return _0xebb13e;};'use strict';var client=require(_0x0813('0x0'));exports[_0x0813('0x1')]=function(){return function(){return client['Request'](_0x0813('0x2'),{'options':{'raw':![],'attributes':['id',_0x0813('0x3'),_0x0813('0x4'),_0x0813('0x5')],'include':[{'model':_0x0813('0x6'),'as':_0x0813('0x7'),'attributes':['id','name',_0x0813('0x8'),'whatsappPause']}]},'log':'getWhatsappQueues'});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/whatsappQueueReport.js b/server/services/routing/rpc/whatsappQueueReport.js index 57982fe..56f8145 100644 --- a/server/services/routing/rpc/whatsappQueueReport.js +++ b/server/services/routing/rpc/whatsappQueueReport.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa2b7=['CreateWhatsappQueueReport','update','UpdateWhatsappQueueReport','DESC','../client','create','Request'];(function(_0x90f6a4,_0x1e21b2){var _0x140f7e=function(_0x45dcd1){while(--_0x45dcd1){_0x90f6a4['push'](_0x90f6a4['shift']());}};_0x140f7e(++_0x1e21b2);}(_0xa2b7,0x82));var _0x7a2b=function(_0xbbcd75,_0x3a0b29){_0xbbcd75=_0xbbcd75-0x0;var _0x41e432=_0xa2b7[_0xbbcd75];return _0x41e432;};'use strict';var client=require(_0x7a2b('0x0'));exports[_0x7a2b('0x1')]=function(_0x31a757){return client[_0x7a2b('0x2')](_0x7a2b('0x3'),{'body':_0x31a757,'log':_0x7a2b('0x3')});};exports[_0x7a2b('0x4')]=function(_0x4dc64f,_0x7c2b3c){return client[_0x7a2b('0x2')](_0x7a2b('0x5'),{'body':_0x7c2b3c,'options':{'where':{'uniqueid':_0x4dc64f},'order':[['id',_0x7a2b('0x6')]],'limit':0x1},'log':_0x7a2b('0x5')});}; \ No newline at end of file +var _0xa60a=['create','Request','CreateWhatsappQueueReport','update','DESC','UpdateWhatsappQueueReport','../client'];(function(_0x23e5ce,_0x57584d){var _0x2ce19b=function(_0x318e1f){while(--_0x318e1f){_0x23e5ce['push'](_0x23e5ce['shift']());}};_0x2ce19b(++_0x57584d);}(_0xa60a,0x179));var _0xaa60=function(_0x33a9b6,_0x38cbc8){_0x33a9b6=_0x33a9b6-0x0;var _0x751e5=_0xa60a[_0x33a9b6];return _0x751e5;};'use strict';var client=require(_0xaa60('0x0'));exports[_0xaa60('0x1')]=function(_0x58371a){return client[_0xaa60('0x2')](_0xaa60('0x3'),{'body':_0x58371a,'log':'CreateWhatsappQueueReport'});};exports[_0xaa60('0x4')]=function(_0x3722fb,_0x2d20d2){return client['Request']('UpdateWhatsappQueueReport',{'body':_0x2d20d2,'options':{'where':{'uniqueid':_0x3722fb},'order':[['id',_0xaa60('0x5')]],'limit':0x1},'log':_0xaa60('0x6')});}; \ 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 0c66464..ae43299 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 _0xefd4=['name\x20is\x20a\x20string\x20and\x20it\x20is\x20required','number','info','name','toLowerCase','consequence','error','[%s][AGENT]\x20%s','join','stop','find','agents','timeout','createQueue','atimeout','channel','format','START:%s','end','[%s][AGENT]\x20ROUTING\x20STOPPED','close','rules','complete','agent','[%s][AGENT]\x20agent\x20not\x20found\x20%s','log','[%s][QUEUE]\x20%s','stack','validate','lodash','util','./strategy','string'];(function(_0x5ce15c,_0x19c917){var _0x36e4f5=function(_0x50fa90){while(--_0x50fa90){_0x5ce15c['push'](_0x5ce15c['shift']());}};_0x36e4f5(++_0x19c917);}(_0xefd4,0x187));var _0x4efd=function(_0x7efe31,_0x1b42d3){_0x7efe31=_0x7efe31-0x0;var _0x59ea5a=_0xefd4[_0x7efe31];return _0x59ea5a;};'use strict';var schema=require(_0x4efd('0x0'));var _=require(_0x4efd('0x1'));var util=require(_0x4efd('0x2'));var seqqueue=require('seq-queue');var logger=require('../../../../config/logger')('routing');var strategy=require(_0x4efd('0x3'));var queue=schema({'name':{'type':_0x4efd('0x4'),'required':!![],'message':_0x4efd('0x5')},'timeout':{'type':_0x4efd('0x6'),'message':'timeout\x20is\x20a\x20number'}});function writeLog(_0x5d37db,_0xfec633,_0x280ace){return logger[_0x4efd('0x7')](util['format']('[%s][AGENT][NAME:%s][STATUS:%s]',_0x5d37db,_0xfec633['name'],_0x280ace));}function handleFindAgent(_0x37eff2){return function(_0xb03945){return _0xb03945[_0x4efd('0x8')][_0x4efd('0x9')]()===_0x37eff2[_0x4efd('0x9')]();};}exports[_0x4efd('0xa')]=function(_0x2d38e6,_0x29e577,_0x4591ad,_0x36f8f1){return function(_0x3ec4f2){try{var _0x5ee855={'name':_0x29e577[0x0],'timeout':_0x29e577[0x1]};var _0x549c13=queue[_0x4efd('0x0')](_0x5ee855,{'typecast':!![]});if(_0x549c13['length']){logger[_0x4efd('0xb')](_0x4efd('0xc'),_0x2d38e6,_['map'](_0x549c13,'message')[_0x4efd('0xd')](',\x20'));_0x3ec4f2[_0x4efd('0xe')]();}else{var _0x3d58d3=_[_0x4efd('0xf')](_0x4591ad[_0x4efd('0x10')],handleFindAgent(_0x5ee855[_0x4efd('0x8')]));if(_0x3d58d3){var _0x547ed9=(_0x5ee855[_0x4efd('0x11')]||0xa)*0x3e8;var _0x4847ad,_0x3809c7;var _0x6321df=seqqueue[_0x4efd('0x12')](_0x547ed9);_0x6321df['id']=_0x2d38e6;_0x6321df[_0x4efd('0x13')]=_0x547ed9;_0x6321df[_0x4efd('0x14')]=_0x36f8f1[_0x4efd('0x14')];writeLog(_0x2d38e6,_0x3d58d3,util[_0x4efd('0x15')](_0x4efd('0x16'),_0x547ed9));_0x4591ad['rules'][_0x2d38e6]['on'](_0x4efd('0x17'),function(){logger[_0x4efd('0x7')](_0x4efd('0x18'),_0x2d38e6);clearTimeout(_0x3809c7);_0x3809c7=undefined;_0x6321df[_0x4efd('0x19')]();if(_0x4591ad[_0x4efd('0x1a')][_0x2d38e6]){delete _0x4591ad[_0x4efd('0x1a')][_0x2d38e6];}_0x3ec4f2[_0x4efd('0xe')]();});_0x4591ad[_0x4efd('0x1a')][_0x2d38e6]['on'](_0x4efd('0x1b'),function(){if(_0x4591ad[_0x4efd('0x1a')][_0x2d38e6]){delete _0x4591ad[_0x4efd('0x1a')][_0x2d38e6];}});_0x3809c7=setTimeout(function(){logger[_0x4efd('0x7')]('[%s][AGENT]\x20ROUTING\x20END',_0x2d38e6);clearTimeout(_0x3809c7);_0x6321df[_0x4efd('0x19')]();_0x3ec4f2['next']();},_0x547ed9);strategy[_0x4efd('0x1c')](_0x6321df,_0x3d58d3,_0x4591ad,_0x36f8f1);}else{logger[_0x4efd('0xb')](_0x4efd('0x1d'),_0x2d38e6,_0x5ee855[_0x4efd('0x8')]);_0x3ec4f2['stop']();}}}catch(_0x47800b){console[_0x4efd('0x1e')](_0x47800b);logger[_0x4efd('0xb')](_0x4efd('0x1f'),_0x2d38e6,_0x47800b[_0x4efd('0x20')]);_0x3ec4f2[_0x4efd('0xe')]();}};}; \ No newline at end of file +var _0x15e2=['channel','rules','end','info','[%s][AGENT]\x20ROUTING\x20STOPPED','complete','[%s][AGENT]\x20ROUTING\x20END','next','[%s][AGENT]\x20agent\x20not\x20found\x20%s','log','[%s][QUEUE]\x20%s','stack','lodash','util','../../../../config/logger','routing','./strategy','number','format','name','toLowerCase','consequence','validate','length','error','[%s][AGENT]\x20%s','map','join','stop'];(function(_0x443366,_0x44f822){var _0x2be8e3=function(_0x1a4c14){while(--_0x1a4c14){_0x443366['push'](_0x443366['shift']());}};_0x2be8e3(++_0x44f822);}(_0x15e2,0x1a2));var _0x215e=function(_0x432682,_0x253044){_0x432682=_0x432682-0x0;var _0x463d05=_0x15e2[_0x432682];return _0x463d05;};'use strict';var schema=require('validate');var _=require(_0x215e('0x0'));var util=require(_0x215e('0x1'));var seqqueue=require('seq-queue');var logger=require(_0x215e('0x2'))(_0x215e('0x3'));var strategy=require(_0x215e('0x4'));var queue=schema({'name':{'type':'string','required':!![],'message':'name\x20is\x20a\x20string\x20and\x20it\x20is\x20required'},'timeout':{'type':_0x215e('0x5'),'message':'timeout\x20is\x20a\x20number'}});function writeLog(_0x26ee6c,_0x518916,_0x1b60d8){return logger['info'](util[_0x215e('0x6')]('[%s][AGENT][NAME:%s][STATUS:%s]',_0x26ee6c,_0x518916[_0x215e('0x7')],_0x1b60d8));}function handleFindAgent(_0x52878c){return function(_0x343bc5){return _0x343bc5[_0x215e('0x7')]['toLowerCase']()===_0x52878c[_0x215e('0x8')]();};}exports[_0x215e('0x9')]=function(_0x4b0a3d,_0x3472d6,_0x180a0a,_0x4d1da5){return function(_0x4e6265){try{var _0x2b83ee={'name':_0x3472d6[0x0],'timeout':_0x3472d6[0x1]};var _0x1d6430=queue[_0x215e('0xa')](_0x2b83ee,{'typecast':!![]});if(_0x1d6430[_0x215e('0xb')]){logger[_0x215e('0xc')](_0x215e('0xd'),_0x4b0a3d,_[_0x215e('0xe')](_0x1d6430,'message')[_0x215e('0xf')](',\x20'));_0x4e6265[_0x215e('0x10')]();}else{var _0x1749d0=_['find'](_0x180a0a['agents'],handleFindAgent(_0x2b83ee['name']));if(_0x1749d0){var _0x8ede93=(_0x2b83ee['timeout']||0xa)*0x3e8;var _0x48d322,_0x4ceb01;var _0x17abf8=seqqueue['createQueue'](_0x8ede93);_0x17abf8['id']=_0x4b0a3d;_0x17abf8['atimeout']=_0x8ede93;_0x17abf8['channel']=_0x4d1da5[_0x215e('0x11')];writeLog(_0x4b0a3d,_0x1749d0,util[_0x215e('0x6')]('START:%s',_0x8ede93));_0x180a0a[_0x215e('0x12')][_0x4b0a3d]['on'](_0x215e('0x13'),function(){logger[_0x215e('0x14')](_0x215e('0x15'),_0x4b0a3d);clearTimeout(_0x4ceb01);_0x4ceb01=undefined;_0x17abf8['close']();if(_0x180a0a[_0x215e('0x12')][_0x4b0a3d]){delete _0x180a0a[_0x215e('0x12')][_0x4b0a3d];}_0x4e6265[_0x215e('0x10')]();});_0x180a0a['rules'][_0x4b0a3d]['on'](_0x215e('0x16'),function(){if(_0x180a0a[_0x215e('0x12')][_0x4b0a3d]){delete _0x180a0a[_0x215e('0x12')][_0x4b0a3d];}});_0x4ceb01=setTimeout(function(){logger[_0x215e('0x14')](_0x215e('0x17'),_0x4b0a3d);clearTimeout(_0x4ceb01);_0x17abf8['close']();_0x4e6265[_0x215e('0x18')]();},_0x8ede93);strategy['agent'](_0x17abf8,_0x1749d0,_0x180a0a,_0x4d1da5);}else{logger[_0x215e('0xc')](_0x215e('0x19'),_0x4b0a3d,_0x2b83ee[_0x215e('0x7')]);_0x4e6265[_0x215e('0x10')]();}}}catch(_0x370624){console[_0x215e('0x1a')](_0x370624);logger[_0x215e('0xc')](_0x215e('0x1b'),_0x4b0a3d,_0x370624[_0x215e('0x1c')]);_0x4e6265[_0x215e('0x10')]();}};}; \ 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 d315d15..91ecf3a 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 _0xbf5f=['created','isEmpty','body','getMustacheRender','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','LexRuntime','$LATEST','postText','message','amazonlex','dialogState','lodash','./utils','../../../../config/logger','routing','../../rpc/chatMessage','../../rpc/openchannelMessage','../../rpc/mailMessage','../../rpc/smsMessage','../../rpc/faxMessage','interaction','UserId','info','Agent\x20is\x20managing\x20the\x20interaction.\x20Go\x20to\x20next\x20application.','next','contact','format','YYYY-MM-DD\x20HH:mm:ss','ChatWebsiteId','account','AccountId','upperFirst','InteractionId'];(function(_0x468d2f,_0x8c09ad){var _0x524c44=function(_0x2dd82d){while(--_0x2dd82d){_0x468d2f['push'](_0x468d2f['shift']());}};_0x524c44(++_0x8c09ad);}(_0xbf5f,0x117));var _0xfbf5=function(_0xd0851e,_0x3e063c){_0xd0851e=_0xd0851e-0x0;var _0x1a0c0a=_0xbf5f[_0xd0851e];return _0x1a0c0a;};'use strict';var _=require(_0xfbf5('0x0'));var moment=require('moment');var AWS=require('aws-sdk');var utils=require(_0xfbf5('0x1'));var logger=require(_0xfbf5('0x2'))(_0xfbf5('0x3'));var rpc={'chatMessage':require(_0xfbf5('0x4')),'openchannelMessage':require(_0xfbf5('0x5')),'mailMessage':require(_0xfbf5('0x6')),'smsMessage':require(_0xfbf5('0x7')),'faxMessage':require(_0xfbf5('0x8'))};exports['consequence']=function(_0x22e182,_0x523afa){return function(_0x2f91f5){try{if(!_['isNil'](this[_0xfbf5('0x9')][_0xfbf5('0xa')])){logger[_0xfbf5('0xb')]('[%s][AMAZONLEX]\x20%s',_0x22e182,_0xfbf5('0xc'));return _0x2f91f5[_0xfbf5('0xd')]();}var _0x28cf9a={'ContactId':this[_0xfbf5('0xe')]['id'],'sentAt':moment()[_0xfbf5('0xf')](_0xfbf5('0x10')),'direction':'out'};var _0x2a4b29=this['channel'];if(_0x2a4b29==='chat'){_0x28cf9a[_0xfbf5('0x11')]=this[_0xfbf5('0x12')]['id'];}else{_0x28cf9a[_['upperFirst'](_0x2a4b29)+_0xfbf5('0x13')]=this[_0xfbf5('0x12')]['id'];}_0x28cf9a[_[_0xfbf5('0x14')](_0x2a4b29)+_0xfbf5('0x15')]=this[_0xfbf5('0x9')]['id'];if(this['interaction'][_0xfbf5('0x16')]){var _0x57f50f=_0x523afa[0x4];if(!_[_0xfbf5('0x17')](_0x57f50f)){_0x28cf9a[_0xfbf5('0x18')]=utils[_0xfbf5('0x19')](_0x57f50f,this);return rpc[_0x2a4b29+_0xfbf5('0x1a')][_0xfbf5('0x1b')](_0x28cf9a)[_0xfbf5('0x1c')](function(_0x2cbfa6){logger[_0xfbf5('0xb')](_0xfbf5('0x1d'),_0x22e182,_0x28cf9a['body']);})[_0xfbf5('0x1e')](function(_0x1f0687){logger[_0xfbf5('0x1f')](_0xfbf5('0x1d'),_0x22e182,JSON[_0xfbf5('0x20')](_0x1f0687));})[_0xfbf5('0x21')](function(){logger[_0xfbf5('0xb')](_0xfbf5('0x22'),_0x22e182);_0x2f91f5['stop']();});}else{logger[_0xfbf5('0xb')](_0xfbf5('0x23'),_0x22e182);_0x2f91f5[_0xfbf5('0x24')]();}}else{var _0x137dd6=this;var _0x325c5f=new AWS[(_0xfbf5('0x25'))]({'accessKeyId':_0x523afa[0x0],'secretAccessKey':_0x523afa[0x1],'region':_0x523afa[0x2]});var _0x1e4518={'botAlias':_0xfbf5('0x26'),'botName':_0x523afa[0x3],'inputText':this['message'][_0xfbf5('0x18')],'userId':this[_0xfbf5('0x9')]['id']['toString']()};_0x325c5f[_0xfbf5('0x27')](_0x1e4518,function(_0x369c1,_0x42d654){if(_0x369c1){logger['error'](_0xfbf5('0x1d'),_0x22e182,_0x369c1[_0xfbf5('0x28')]);_0x2f91f5[_0xfbf5('0xd')]();}else if(_0x42d654&&_0x42d654[_0xfbf5('0x28')]){_0x137dd6['body'][_0xfbf5('0x29')]=_0x42d654;_0x28cf9a[_0xfbf5('0x18')]=_0x42d654[_0xfbf5('0x28')];return rpc[_0x2a4b29+'Message']['create'](_0x28cf9a)[_0xfbf5('0x1c')](function(_0x1ffe71){logger[_0xfbf5('0xb')](_0xfbf5('0x1d'),_0x22e182,_0x28cf9a[_0xfbf5('0x18')]);if(_0x42d654[_0xfbf5('0x2a')]=='Failed'){_0x2f91f5[_0xfbf5('0xd')]();}else{_0x2f91f5[_0xfbf5('0x24')]();}})[_0xfbf5('0x1e')](function(_0x348494){logger[_0xfbf5('0x1f')]('[%s][AMAZONLEX]\x20%s',_0x22e182,JSON[_0xfbf5('0x20')](_0x348494));_0x2f91f5[_0xfbf5('0xd')]();});}else{_0x2f91f5[_0xfbf5('0xd')]();}});}}catch(_0x2832a4){logger[_0xfbf5('0x1f')](_0xfbf5('0x1d'),_0x22e182,JSON['stringify'](_0x2832a4));_0x2f91f5[_0xfbf5('0x24')]();}};}; \ No newline at end of file +var _0x7ac2=['then','info','catch','stringify','finally','[%s][AMAZONLEX]\x20Welcome\x20Message\x20is\x20empty.\x20It\x20will\x20wait\x20for\x20a\x20message\x20from\x20customer!','$LATEST','message','postText','error','Message','dialogState','Failed','stop','lodash','moment','aws-sdk','./utils','../../../../config/logger','routing','../../rpc/openchannelMessage','../../rpc/mailMessage','../../rpc/smsMessage','../../rpc/faxMessage','consequence','isNil','[%s][AMAZONLEX]\x20%s','Agent\x20is\x20managing\x20the\x20interaction.\x20Go\x20to\x20next\x20application.','next','contact','YYYY-MM-DD\x20HH:mm:ss','out','channel','chat','ChatWebsiteId','account','upperFirst','AccountId','interaction','created','isEmpty','body','getMustacheRender','create'];(function(_0x464d7d,_0x49fd55){var _0x3e0730=function(_0x37a321){while(--_0x37a321){_0x464d7d['push'](_0x464d7d['shift']());}};_0x3e0730(++_0x49fd55);}(_0x7ac2,0x142));var _0x27ac=function(_0x16fe4a,_0x566bcd){_0x16fe4a=_0x16fe4a-0x0;var _0x26a2bd=_0x7ac2[_0x16fe4a];return _0x26a2bd;};'use strict';var _=require(_0x27ac('0x0'));var moment=require(_0x27ac('0x1'));var AWS=require(_0x27ac('0x2'));var utils=require(_0x27ac('0x3'));var logger=require(_0x27ac('0x4'))(_0x27ac('0x5'));var rpc={'chatMessage':require('../../rpc/chatMessage'),'openchannelMessage':require(_0x27ac('0x6')),'mailMessage':require(_0x27ac('0x7')),'smsMessage':require(_0x27ac('0x8')),'faxMessage':require(_0x27ac('0x9'))};exports[_0x27ac('0xa')]=function(_0x19e2dd,_0x314ad4){return function(_0x169c48){try{if(!_[_0x27ac('0xb')](this['interaction']['UserId'])){logger['info'](_0x27ac('0xc'),_0x19e2dd,_0x27ac('0xd'));return _0x169c48[_0x27ac('0xe')]();}var _0x2cb801={'ContactId':this[_0x27ac('0xf')]['id'],'sentAt':moment()['format'](_0x27ac('0x10')),'direction':_0x27ac('0x11')};var _0x205640=this[_0x27ac('0x12')];if(_0x205640===_0x27ac('0x13')){_0x2cb801[_0x27ac('0x14')]=this[_0x27ac('0x15')]['id'];}else{_0x2cb801[_[_0x27ac('0x16')](_0x205640)+_0x27ac('0x17')]=this['account']['id'];}_0x2cb801[_[_0x27ac('0x16')](_0x205640)+'InteractionId']=this[_0x27ac('0x18')]['id'];if(this[_0x27ac('0x18')][_0x27ac('0x19')]){var _0x15f71f=_0x314ad4[0x4];if(!_[_0x27ac('0x1a')](_0x15f71f)){_0x2cb801[_0x27ac('0x1b')]=utils[_0x27ac('0x1c')](_0x15f71f,this);return rpc[_0x205640+'Message'][_0x27ac('0x1d')](_0x2cb801)[_0x27ac('0x1e')](function(_0x1a7be8){logger[_0x27ac('0x1f')](_0x27ac('0xc'),_0x19e2dd,_0x2cb801['body']);})[_0x27ac('0x20')](function(_0x3cbf86){logger['error'](_0x27ac('0xc'),_0x19e2dd,JSON[_0x27ac('0x21')](_0x3cbf86));})[_0x27ac('0x22')](function(){logger[_0x27ac('0x1f')]('[%s][AMAZONLEX]\x20Welcome\x20Message\x20has\x20been\x20sent!',_0x19e2dd);_0x169c48['stop']();});}else{logger[_0x27ac('0x1f')](_0x27ac('0x23'),_0x19e2dd);_0x169c48['stop']();}}else{var _0x1e22f5=this;var _0x642e23=new AWS['LexRuntime']({'accessKeyId':_0x314ad4[0x0],'secretAccessKey':_0x314ad4[0x1],'region':_0x314ad4[0x2]});var _0x211856={'botAlias':_0x27ac('0x24'),'botName':_0x314ad4[0x3],'inputText':this[_0x27ac('0x25')]['body'],'userId':this['interaction']['id']['toString']()};_0x642e23[_0x27ac('0x26')](_0x211856,function(_0x35f32e,_0x5b7279){if(_0x35f32e){logger[_0x27ac('0x27')]('[%s][AMAZONLEX]\x20%s',_0x19e2dd,_0x35f32e[_0x27ac('0x25')]);_0x169c48[_0x27ac('0xe')]();}else if(_0x5b7279&&_0x5b7279[_0x27ac('0x25')]){_0x1e22f5[_0x27ac('0x1b')]['amazonlex']=_0x5b7279;_0x2cb801[_0x27ac('0x1b')]=_0x5b7279[_0x27ac('0x25')];return rpc[_0x205640+_0x27ac('0x28')][_0x27ac('0x1d')](_0x2cb801)[_0x27ac('0x1e')](function(_0x4796a4){logger['info'](_0x27ac('0xc'),_0x19e2dd,_0x2cb801[_0x27ac('0x1b')]);if(_0x5b7279[_0x27ac('0x29')]==_0x27ac('0x2a')){_0x169c48[_0x27ac('0xe')]();}else{_0x169c48[_0x27ac('0x2b')]();}})[_0x27ac('0x20')](function(_0x5f1d7b){logger['error'](_0x27ac('0xc'),_0x19e2dd,JSON['stringify'](_0x5f1d7b));_0x169c48['next']();});}else{_0x169c48[_0x27ac('0xe')]();}});}}catch(_0x3370ac){logger[_0x27ac('0x27')](_0x27ac('0xc'),_0x19e2dd,JSON[_0x27ac('0x21')](_0x3370ac));_0x169c48[_0x27ac('0x2b')]();}};}; \ 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 f938ad0..d822cc1 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 _0xe706=['next','channel','getMustacheRender','YYYY-MM-DD\x20HH:mm:ss','out','message','from','read','subject','Re:','Re:\x20','chat','ChatWebsiteId','AccountId','account','upperFirst','InteractionId','Message','Smtp','service','host','port','secure','auth','user','pass','inReplyTo','messageId','html','','replace','body','';return mailRpc[_0x6e70('0x33')](_0x228350,_0x37b3e0)['then'](function(_0x259486){logger['info'](_0x6e70('0x34'),_0x1b0389);_0x37b3e0[_0x6e70('0x2c')]=_0x259486[_0x6e70('0x16')]['messageId'];return rpc[_0x743eb5+_0x6e70('0x22')][_0x6e70('0x35')](_0x37b3e0);})['then'](function(_0x13d673){logger[_0x6e70('0xe')]('[%s][AUTOREPLY]\x20%s',_0x1b0389,JSON[_0x6e70('0x36')](_0x13d673));})[_0x6e70('0x37')](function(_0x2d52bd){logger[_0x6e70('0x38')](_0x6e70('0x39'),_0x1b0389,JSON[_0x6e70('0x36')](_0x2d52bd));})[_0x6e70('0x3a')](function(){_0x36357b[_0x6e70('0x11')]();});}else{return rpc[this[_0x6e70('0x12')]+_0x6e70('0x22')]['create'](_0x37b3e0)[_0x6e70('0x3b')](function(_0x4795a0){logger[_0x6e70('0xe')](_0x6e70('0xf'),_0x1b0389,_0x37b3e0[_0x6e70('0x30')]);})[_0x6e70('0x37')](function(_0x233a83){logger[_0x6e70('0x38')](_0x6e70('0xf'),_0x1b0389,JSON[_0x6e70('0x36')](_0x233a83));})[_0x6e70('0x3a')](function(){_0x36357b[_0x6e70('0x11')]();});}}}catch(_0x2a5444){logger[_0x6e70('0x38')](_0x6e70('0xf'),_0x1b0389,JSON['stringify'](_0x2a5444));_0x36357b['stop']();}};}; \ No newline at end of file +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(_0x420edc,_0x1c0f2e){var _0x5932f6=function(_0x53103b){while(--_0x53103b){_0x420edc['push'](_0x420edc['shift']());}};_0x5932f6(++_0x1c0f2e);}(_0x70e0,0x17b));var _0x070e=function(_0x319f0c,_0x3147cd){_0x319f0c=_0x319f0c-0x0;var _0x16109c=_0x70e0[_0x319f0c];return _0x16109c;};'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'],']+(>|$)/g,''),'priorityTrue':_0x3328f2[0x1],'priorityFalse':_0x3328f2[0x2]};var _0x545796=gotoif['validate'](_0x53c6b9,{'typecast':!![]});if(_0x545796[_0x0c00('0xe')]){logger['error'](_0x0c00('0xf'),_0x3cdcc3,_[_0x0c00('0x10')](_0x545796,'message')[_0x0c00('0x11')](',\x20'));_0x18831b['stop']();}else{try{var _0x33fa57=eval('('+_0x53c6b9[_0x0c00('0x12')]+')');var _0x827fff=_0x33fa57?_0x53c6b9['priorityTrue']:_0x53c6b9[_0x0c00('0x13')];logger['info'](_0x0c00('0x14'),_0x3cdcc3,_0x53c6b9['condition'],_0x33fa57,_0x827fff||'next');if(_0x827fff){var _0x23077f=_[_0x0c00('0x15')](_0x18831b[_0x0c00('0x16')](),{'p':_0x827fff});if(_0x23077f>=0x0){logger['info'](_0x0c00('0x17'),_0x3cdcc3,_0x827fff||'next',_0x23077f);_0x18831b['next'](_0x23077f);}else{logger[_0x0c00('0x18')](_0x0c00('0x19'),_0x3cdcc3,_0x827fff||_0x0c00('0x1a'));_0x18831b[_0x0c00('0x1b')]();}}else{_0x18831b[_0x0c00('0x1a')]();}}catch(_0xe8ee87){logger[_0x0c00('0x1c')](_0x0c00('0x1d'),_0x3cdcc3,_0xe8ee87['message']);_0x18831b[_0x0c00('0x1b')]();}}}catch(_0x38dcda){logger[_0x0c00('0x1c')](_0x0c00('0xf'),_0x3cdcc3,JSON['stringify'](_0x38dcda));_0x18831b[_0x0c00('0x1b')]();}};}; \ No newline at end of file +var _0xf3ae=['html-to-text','./utils','../../../../config/logger','routing','string','number','priority\x20false\x20is\x20a\x20number','consequence','getMustacheRender','replace','length','error','[%s][GOTOIF]\x20%s','map','message','join','stop','condition','priorityTrue','priorityFalse','info','[%s][GOTOIF]\x20condition\x20%s\x20is\x20%s\x20try\x20goto\x20priority\x20%s','findIndex','rules','[%s][GOTOIF]\x20priority\x20%s\x20found\x20at\x20index:\x20%s','next','[%s][GOTOIF]\x20priority\x20%s\x20not\x20found','[%s][GOTOIF]\x20eval\x20error:\x20%s','stringify','validate','lodash'];(function(_0x3e379b,_0x119328){var _0x42398a=function(_0x3aa63d){while(--_0x3aa63d){_0x3e379b['push'](_0x3e379b['shift']());}};_0x42398a(++_0x119328);}(_0xf3ae,0x1cf));var _0xef3a=function(_0x33d949,_0x31b6f3){_0x33d949=_0x33d949-0x0;var _0x4a513f=_0xf3ae[_0x33d949];return _0x4a513f;};'use strict';var schema=require(_0xef3a('0x0'));var _=require(_0xef3a('0x1'));var htmlToText=require(_0xef3a('0x2'));var utils=require(_0xef3a('0x3'));var logger=require(_0xef3a('0x4'))(_0xef3a('0x5'));var gotoif=schema({'condition':{'type':_0xef3a('0x6'),'required':!![],'message':'condition\x20is\x20a\x20string\x20and\x20it\x20is\x20required'},'priorityTrue':{'type':_0xef3a('0x7'),'message':'priority\x20true\x20is\x20a\x20number'},'priorityFalse':{'type':_0xef3a('0x7'),'message':_0xef3a('0x8')}});exports[_0xef3a('0x9')]=function(_0x3f59f7,_0x3c54f8){return function(_0x4aa130){try{var _0x364db0={'condition':htmlToText['fromString'](utils[_0xef3a('0xa')](_0x3c54f8[0x0],this),{'wordwrap':![]})[_0xef3a('0xb')](/<\/?[^>]+(>|$)/g,''),'priorityTrue':_0x3c54f8[0x1],'priorityFalse':_0x3c54f8[0x2]};var _0x4807b0=gotoif[_0xef3a('0x0')](_0x364db0,{'typecast':!![]});if(_0x4807b0[_0xef3a('0xc')]){logger[_0xef3a('0xd')](_0xef3a('0xe'),_0x3f59f7,_[_0xef3a('0xf')](_0x4807b0,_0xef3a('0x10'))[_0xef3a('0x11')](',\x20'));_0x4aa130[_0xef3a('0x12')]();}else{try{var _0x438d9d=eval('('+_0x364db0[_0xef3a('0x13')]+')');var _0x1705a8=_0x438d9d?_0x364db0[_0xef3a('0x14')]:_0x364db0[_0xef3a('0x15')];logger[_0xef3a('0x16')](_0xef3a('0x17'),_0x3f59f7,_0x364db0[_0xef3a('0x13')],_0x438d9d,_0x1705a8||'next');if(_0x1705a8){var _0xacb7bf=_[_0xef3a('0x18')](_0x4aa130[_0xef3a('0x19')](),{'p':_0x1705a8});if(_0xacb7bf>=0x0){logger[_0xef3a('0x16')](_0xef3a('0x1a'),_0x3f59f7,_0x1705a8||'next',_0xacb7bf);_0x4aa130[_0xef3a('0x1b')](_0xacb7bf);}else{logger['info'](_0xef3a('0x1c'),_0x3f59f7,_0x1705a8||'next');_0x4aa130[_0xef3a('0x12')]();}}else{_0x4aa130[_0xef3a('0x1b')]();}}catch(_0x333a3e){logger[_0xef3a('0xd')](_0xef3a('0x1d'),_0x3f59f7,_0x333a3e[_0xef3a('0x10')]);_0x4aa130['stop']();}}}catch(_0xd9423a){logger[_0xef3a('0xd')]('[%s][GOTOIF]\x20%s',_0x3f59f7,JSON[_0xef3a('0x1e')](_0xd9423a));_0x4aa130['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 816b3f2..979f56e 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 _0xfb7d=['[%s][GOTOP]\x20priority\x20%s','priority','findIndex','rules','next','info','[%s][GOTOP]\x20%s','validate','../../../../config/logger','routing','number','priority\x20is\x20a\x20number\x20and\x20it\x20is\x20required','consequence','length','error','map','message','join','stop'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xfb7d,0xeb));var _0xdfb7=function(_0x334bd5,_0x53a368){_0x334bd5=_0x334bd5-0x0;var _0x481cf7=_0xfb7d[_0x334bd5];return _0x481cf7;};'use strict';var schema=require(_0xdfb7('0x0'));var _=require('lodash');var logger=require(_0xdfb7('0x1'))(_0xdfb7('0x2'));var gotop=schema({'priority':{'type':_0xdfb7('0x3'),'required':!![],'message':_0xdfb7('0x4')}});exports[_0xdfb7('0x5')]=function(_0x36aa4c,_0x4abfaf){return function(_0x5532c0){try{var _0x19cb6c={'priority':_0x4abfaf[0x0]};var _0x55a733=gotop[_0xdfb7('0x0')](_0x19cb6c,{'typecast':!![]});if(_0x55a733[_0xdfb7('0x6')]){logger[_0xdfb7('0x7')]('[%s][GOTOP]\x20%s',_0x36aa4c,_[_0xdfb7('0x8')](_0x55a733,_0xdfb7('0x9'))[_0xdfb7('0xa')](',\x20'));_0x5532c0[_0xdfb7('0xb')]();}else{logger['info'](_0xdfb7('0xc'),_0x36aa4c,_0x19cb6c[_0xdfb7('0xd')]);if(_0x19cb6c[_0xdfb7('0xd')]){var _0xfa31e1=_[_0xdfb7('0xe')](_0x5532c0[_0xdfb7('0xf')](),{'p':_0x19cb6c[_0xdfb7('0xd')]});if(_0xfa31e1>=0x0){logger['info']('[%s][GOTOP]\x20priority\x20%s\x20found\x20at\x20index:\x20%s',_0x36aa4c,_0x19cb6c[_0xdfb7('0xd')]||_0xdfb7('0x10'),_0xfa31e1);_0x5532c0[_0xdfb7('0x10')](_0xfa31e1);}else{logger[_0xdfb7('0x11')]('[%s][GOTOP]\x20priority\x20%s\x20not\x20found',_0x36aa4c,_0x19cb6c[_0xdfb7('0xd')]||_0xdfb7('0x10'));_0x5532c0[_0xdfb7('0xb')]();}}else{_0x5532c0['next']();}}}catch(_0x413490){logger['error'](_0xdfb7('0x12'),_0x36aa4c,JSON['stringify'](_0x413490));_0x5532c0[_0xdfb7('0xb')]();}};}; \ No newline at end of file +var _0x9d2d=['message','stop','info','priority','findIndex','[%s][GOTOP]\x20priority\x20%s\x20found\x20at\x20index:\x20%s','[%s][GOTOP]\x20priority\x20%s\x20not\x20found','next','validate','lodash','../../../../config/logger','routing','number','priority\x20is\x20a\x20number\x20and\x20it\x20is\x20required','length','[%s][GOTOP]\x20%s','map'];(function(_0x5c6398,_0x2aedb8){var _0x138851=function(_0x105238){while(--_0x105238){_0x5c6398['push'](_0x5c6398['shift']());}};_0x138851(++_0x2aedb8);}(_0x9d2d,0x129));var _0xd9d2=function(_0x4391d3,_0x3c6b30){_0x4391d3=_0x4391d3-0x0;var _0x568538=_0x9d2d[_0x4391d3];return _0x568538;};'use strict';var schema=require(_0xd9d2('0x0'));var _=require(_0xd9d2('0x1'));var logger=require(_0xd9d2('0x2'))(_0xd9d2('0x3'));var gotop=schema({'priority':{'type':_0xd9d2('0x4'),'required':!![],'message':_0xd9d2('0x5')}});exports['consequence']=function(_0x14ef69,_0x1b84bf){return function(_0x12d297){try{var _0x18a6e6={'priority':_0x1b84bf[0x0]};var _0x119671=gotop[_0xd9d2('0x0')](_0x18a6e6,{'typecast':!![]});if(_0x119671[_0xd9d2('0x6')]){logger['error'](_0xd9d2('0x7'),_0x14ef69,_[_0xd9d2('0x8')](_0x119671,_0xd9d2('0x9'))['join'](',\x20'));_0x12d297[_0xd9d2('0xa')]();}else{logger[_0xd9d2('0xb')]('[%s][GOTOP]\x20priority\x20%s',_0x14ef69,_0x18a6e6['priority']);if(_0x18a6e6[_0xd9d2('0xc')]){var _0x230f8f=_[_0xd9d2('0xd')](_0x12d297['rules'](),{'p':_0x18a6e6[_0xd9d2('0xc')]});if(_0x230f8f>=0x0){logger[_0xd9d2('0xb')](_0xd9d2('0xe'),_0x14ef69,_0x18a6e6[_0xd9d2('0xc')]||'next',_0x230f8f);_0x12d297['next'](_0x230f8f);}else{logger['info'](_0xd9d2('0xf'),_0x14ef69,_0x18a6e6[_0xd9d2('0xc')]||_0xd9d2('0x10'));_0x12d297['stop']();}}else{_0x12d297[_0xd9d2('0x10')]();}}}catch(_0x4072dd){logger['error'](_0xd9d2('0x7'),_0x14ef69,JSON['stringify'](_0x4072dd));_0x12d297[_0xd9d2('0xa')]();}};}; \ 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 1d3ed16..7263041 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 _0x3260=['chat','ChatWebsiteId','account','upperFirst','AccountId','InteractionId','interaction','Message','create','info','[%s][MESSAGE]\x20%s','body','next','error','stop','stringify','./utils','../../../../config/logger','routing','../../rpc/chatMessage','../../rpc/openchannelMessage','../../rpc/smsMessage','consequence','getMustacheRender','contact','channel'];(function(_0x412c11,_0x4b2e2a){var _0x315c83=function(_0x1182d2){while(--_0x1182d2){_0x412c11['push'](_0x412c11['shift']());}};_0x315c83(++_0x4b2e2a);}(_0x3260,0x12e));var _0x0326=function(_0x360423,_0x1e05d0){_0x360423=_0x360423-0x0;var _0xe29430=_0x3260[_0x360423];return _0xe29430;};'use strict';var _=require('lodash');var utils=require(_0x0326('0x0'));var logger=require(_0x0326('0x1'))(_0x0326('0x2'));var rpc={'chatMessage':require(_0x0326('0x3')),'openchannelMessage':require(_0x0326('0x4')),'mailMessage':require('../../rpc/mailMessage'),'smsMessage':require(_0x0326('0x5')),'faxMessage':require('../../rpc/faxMessage')};exports[_0x0326('0x6')]=function(_0x51b926,_0x1ad5fd){return function(_0x481212){try{var _0x4ff196={'body':utils[_0x0326('0x7')](_0x1ad5fd[0x0],this),'ContactId':this[_0x0326('0x8')]['id']};if(this[_0x0326('0x9')]===_0x0326('0xa')){_0x4ff196[_0x0326('0xb')]=this[_0x0326('0xc')]['id'];}else{_0x4ff196[_[_0x0326('0xd')](this[_0x0326('0x9')])+_0x0326('0xe')]=this[_0x0326('0xc')]['id'];}_0x4ff196[_[_0x0326('0xd')](this[_0x0326('0x9')])+_0x0326('0xf')]=this[_0x0326('0x10')]['id'];if(rpc[this[_0x0326('0x9')]+_0x0326('0x11')]){return rpc[this['channel']+_0x0326('0x11')][_0x0326('0x12')](_0x4ff196)['then'](function(_0x25762e){logger[_0x0326('0x13')](_0x0326('0x14'),_0x51b926,_0x4ff196[_0x0326('0x15')]);_0x481212[_0x0326('0x16')]();})['catch'](function(_0x39b4c6){logger[_0x0326('0x17')]('[%s][MESSAGE]\x20%s',_0x51b926,JSON['stringify'](_0x39b4c6));_0x481212[_0x0326('0x18')]();});}}catch(_0x6ab066){logger[_0x0326('0x17')](_0x0326('0x14'),_0x51b926,JSON[_0x0326('0x19')](_0x6ab066));_0x481212[_0x0326('0x18')]();}};}; \ No newline at end of file +var _0x913e=['create','then','info','[%s][MESSAGE]\x20%s','body','next','catch','error','stringify','stop','lodash','./utils','../../../../config/logger','../../rpc/chatMessage','../../rpc/faxMessage','getMustacheRender','channel','chat','ChatWebsiteId','account','upperFirst','AccountId','Message'];(function(_0x531e48,_0x4bb96b){var _0x202971=function(_0x403bf5){while(--_0x403bf5){_0x531e48['push'](_0x531e48['shift']());}};_0x202971(++_0x4bb96b);}(_0x913e,0x163));var _0xe913=function(_0x386525,_0xefae6){_0x386525=_0x386525-0x0;var _0x14d015=_0x913e[_0x386525];return _0x14d015;};'use strict';var _=require(_0xe913('0x0'));var utils=require(_0xe913('0x1'));var logger=require(_0xe913('0x2'))('routing');var rpc={'chatMessage':require(_0xe913('0x3')),'openchannelMessage':require('../../rpc/openchannelMessage'),'mailMessage':require('../../rpc/mailMessage'),'smsMessage':require('../../rpc/smsMessage'),'faxMessage':require(_0xe913('0x4'))};exports['consequence']=function(_0x195a7b,_0x3890b0){return function(_0x240b65){try{var _0x1486fc={'body':utils[_0xe913('0x5')](_0x3890b0[0x0],this),'ContactId':this['contact']['id']};if(this[_0xe913('0x6')]===_0xe913('0x7')){_0x1486fc[_0xe913('0x8')]=this[_0xe913('0x9')]['id'];}else{_0x1486fc[_[_0xe913('0xa')](this['channel'])+_0xe913('0xb')]=this[_0xe913('0x9')]['id'];}_0x1486fc[_[_0xe913('0xa')](this[_0xe913('0x6')])+'InteractionId']=this['interaction']['id'];if(rpc[this['channel']+_0xe913('0xc')]){return rpc[this[_0xe913('0x6')]+_0xe913('0xc')][_0xe913('0xd')](_0x1486fc)[_0xe913('0xe')](function(_0x53f57d){logger[_0xe913('0xf')](_0xe913('0x10'),_0x195a7b,_0x1486fc[_0xe913('0x11')]);_0x240b65[_0xe913('0x12')]();})[_0xe913('0x13')](function(_0x44a414){logger[_0xe913('0x14')](_0xe913('0x10'),_0x195a7b,JSON['stringify'](_0x44a414));_0x240b65['stop']();});}}catch(_0x1ff011){logger[_0xe913('0x14')](_0xe913('0x10'),_0x195a7b,JSON[_0xe913('0x15')](_0x1ff011));_0x240b65[_0xe913('0x16')]();}};}; \ 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 db5a9e4..d055e5f 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 _0x95a9=['consequence','info','[%s][NOOP]\x20%s','getMustacheRender','next','error','stop','./utils','routing'];(function(_0x4bbf46,_0x34bb70){var _0x5cf938=function(_0x235145){while(--_0x235145){_0x4bbf46['push'](_0x4bbf46['shift']());}};_0x5cf938(++_0x34bb70);}(_0x95a9,0xbb));var _0x995a=function(_0x46d84a,_0x130941){_0x46d84a=_0x46d84a-0x0;var _0x1d5080=_0x95a9[_0x46d84a];return _0x1d5080;};'use strict';var utils=require(_0x995a('0x0'));var logger=require('../../../../config/logger')(_0x995a('0x1'));exports[_0x995a('0x2')]=function(_0x166432,_0xf2750a){return function(_0x28b0e8){try{logger[_0x995a('0x3')](_0x995a('0x4'),_0x166432,utils[_0x995a('0x5')](_0xf2750a[0x0],this));_0x28b0e8[_0x995a('0x6')]();}catch(_0x49ca46){logger[_0x995a('0x7')]('[%s][NOOP]\x20%s',_0x166432,JSON['stringify'](_0x49ca46));_0x28b0e8[_0x995a('0x8')]();}};}; \ No newline at end of file +var _0x70ea=['[%s][NOOP]\x20%s','stringify','stop','./utils','../../../../config/logger','routing','consequence','info','getMustacheRender','next','error'];(function(_0x2641f9,_0x26715f){var _0x585741=function(_0x2d1462){while(--_0x2d1462){_0x2641f9['push'](_0x2641f9['shift']());}};_0x585741(++_0x26715f);}(_0x70ea,0x87));var _0xa70e=function(_0x2be8c2,_0x14a4b5){_0x2be8c2=_0x2be8c2-0x0;var _0x97f531=_0x70ea[_0x2be8c2];return _0x97f531;};'use strict';var utils=require(_0xa70e('0x0'));var logger=require(_0xa70e('0x1'))(_0xa70e('0x2'));exports[_0xa70e('0x3')]=function(_0x4256e3,_0x2b5789){return function(_0x1645f0){try{logger[_0xa70e('0x4')]('[%s][NOOP]\x20%s',_0x4256e3,utils[_0xa70e('0x5')](_0x2b5789[0x0],this));_0x1645f0[_0xa70e('0x6')]();}catch(_0x469e4d){logger[_0xa70e('0x7')](_0xa70e('0x8'),_0x4256e3,JSON[_0xa70e('0x9')](_0x469e4d));_0x1645f0[_0xa70e('0xa')]();}};}; \ 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 7eea043..31f7817 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 _0x5c00=['defaults','redis','localhost','socket.io-emitter','queue_id','account','queue','joinAt','emit','clone','format','%sQueuesWaitingInteractions','pick','%s_queue_waiting_interaction:%s','save','remove','../../rpc/openchannelQueueReport','../../rpc/mailQueueReport','../../rpc/chatQueueReport','../../rpc/smsQueueReport','string','name\x20is\x20a\x20string\x20and\x20it\x20is\x20required','number','waiting','body','contact','list','upperFirst','channel','QueueId','InteractionId','message','chat','AccountId','info','[%s][START:QUEUE][NAME:%s]','name','QueueReport','create','catch','error','create\x20queue\x20report','YYYY-MM-DD\x20HH:mm:ss','[%s][STOP:QUEUE][NAME:%s]','update','update\x20queue\x20report','timeout','[%s][END:QUEUE][NAME:%s]','toLowerCase','consequence','length','[%s][QUEUE]\x20%s','join','stop','find','Queues','createQueue','atimeout','qtimeout','end','[%s][QUEUE]\x20ROUTING\x20STOPPED','close','rules','complete','[%s][QUEUE]\x20APPLICATION\x20END','next','strategy','rrmemory','beepall','[%s][QUEUE]\x20queue\x20not\x20found\x20%s','validate','lodash','util','moment','../../../../config/environment','../../../../config/logger','routing','./strategy'];(function(_0x55eede,_0x2a302b){var _0x14ef21=function(_0x2ff1d9){while(--_0x2ff1d9){_0x55eede['push'](_0x55eede['shift']());}};_0x14ef21(++_0x2a302b);}(_0x5c00,0x17e));var _0x05c0=function(_0x5e2be0,_0x51090e){_0x5e2be0=_0x5e2be0-0x0;var _0x23d711=_0x5c00[_0x5e2be0];return _0x23d711;};'use strict';var schema=require(_0x05c0('0x0'));var _=require(_0x05c0('0x1'));var util=require(_0x05c0('0x2'));var seqqueue=require('seq-queue');var moment=require(_0x05c0('0x3'));var Redis=require('ioredis');var config=require(_0x05c0('0x4'));var logger=require(_0x05c0('0x5'))(_0x05c0('0x6'));var strategy=require(_0x05c0('0x7'));config['redis']=_[_0x05c0('0x8')](config[_0x05c0('0x9')],{'host':_0x05c0('0xa'),'port':0x18eb});var io=require(_0x05c0('0xb'))(new Redis(config['redis']));var attributes=['id',_0x05c0('0xc'),_0x05c0('0xd'),_0x05c0('0xe'),'from',_0x05c0('0xf')];function emit(_0x32cdfa,_0x996d6b,_0x321c09){io['to'](_0x32cdfa)[_0x05c0('0x10')](_0x996d6b,_0x321c09);}function emitChannelQueueInteraction(_0x1edbb,_0x5226c5,_0x4f9f78,_0x5d4de1,_0x516a66,_0x205cec,_0x11cf03,_0xa50678){var _0x5a3e65=_[_0x05c0('0x11')](_0x4f9f78);_0x5a3e65['queue_id']=_0xa50678;_0x5a3e65[_0x05c0('0xe')]=_0x5226c5;_0x5a3e65[_0x05c0('0xd')]=_0x5d4de1;_0x5a3e65['id']=_0x516a66;if(_0x205cec){_0x11cf03[util[_0x05c0('0x12')](_0x05c0('0x13'),_0x1edbb)][_0x516a66]=_[_0x05c0('0x14')](_0x5a3e65,attributes);}else{delete _0x11cf03[util[_0x05c0('0x12')](_0x05c0('0x13'),_0x1edbb)][_0x516a66];}emit(util[_0x05c0('0x12')]('%s:queue:%s',_0x1edbb,_0x5226c5),util[_0x05c0('0x12')](_0x05c0('0x15'),_0x1edbb,_0x205cec?_0x05c0('0x16'):_0x05c0('0x17')),_[_0x05c0('0x14')](_0x5a3e65,attributes));}var rpc={'openchannelQueueReport':require(_0x05c0('0x18')),'mailQueueReport':require(_0x05c0('0x19')),'chatQueueReport':require(_0x05c0('0x1a')),'smsQueueReport':require(_0x05c0('0x1b')),'faxQueueReport':require('../../rpc/faxQueueReport')};var queue=schema({'name':{'type':_0x05c0('0x1c'),'required':!![],'message':_0x05c0('0x1d')},'timeout':{'type':_0x05c0('0x1e'),'message':'timeout\x20is\x20a\x20number'}});function startRouting(_0x40d905,_0x2023d6,_0x10685b,_0x23164c){if(_0x40d905&&_0x2023d6&&_0x10685b){_0x2023d6[_0x05c0('0x1f')]+=0x1;var _0x5e4742={'uniqueid':_0x40d905,'from':_0x10685b[_0x05c0('0x20')]?_0x10685b[_0x05c0('0x20')]['from']:'','joinAt':moment()['format']('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0x10685b[_0x05c0('0x21')]?_0x10685b[_0x05c0('0x21')]['id']:null,'ListId':_0x10685b[_0x05c0('0x22')]?_0x10685b[_0x05c0('0x22')]['id']:null};_0x5e4742[_[_0x05c0('0x23')](_0x10685b[_0x05c0('0x24')])+_0x05c0('0x25')]=_0x2023d6['id']||null;_0x5e4742[_['upperFirst'](_0x10685b[_0x05c0('0x24')])+_0x05c0('0x26')]=_0x10685b['interaction']?_0x10685b['interaction']['id']:null;_0x5e4742[_['upperFirst'](_0x10685b['channel'])+'MessageId']=_0x10685b[_0x05c0('0x27')]?_0x10685b[_0x05c0('0x27')]['id']:null;_0x5e4742[_['upperFirst'](_0x10685b[_0x05c0('0x24')])+(_0x10685b[_0x05c0('0x24')]!==_0x05c0('0x28')?_0x05c0('0x29'):'WebsiteId')]=_0x10685b[_0x05c0('0xd')]?_0x10685b[_0x05c0('0xd')]['id']:null;logger[_0x05c0('0x2a')](util[_0x05c0('0x12')](_0x05c0('0x2b'),_0x40d905,_0x2023d6[_0x05c0('0x2c')]));emitChannelQueueInteraction(_0x10685b['channel'],_0x2023d6['name'],_0x5e4742,_0x10685b[_0x05c0('0xd')][_0x05c0('0x2c')],_0x10685b[_0x05c0('0x27')]['id'],!![],_0x23164c,_0x2023d6['id']);if(rpc[_0x10685b[_0x05c0('0x24')]+_0x05c0('0x2d')]){return rpc[_0x10685b[_0x05c0('0x24')]+_0x05c0('0x2d')][_0x05c0('0x2e')](_0x5e4742)[_0x05c0('0x2f')](function(_0x87b07c){logger[_0x05c0('0x30')](_0x05c0('0x31'));});}}}function stopRouting(_0x50f03d,_0x5d2020,_0x2bfe05,_0x31b0b8){if(_0x50f03d&&_0x5d2020){_0x5d2020[_0x05c0('0x1f')]-=0x1;var _0x5c652f={'leaveAt':moment()[_0x05c0('0x12')](_0x05c0('0x32')),'acceptAt':moment()['format'](_0x05c0('0x32')),'reason':'accepted'};logger[_0x05c0('0x2a')](util[_0x05c0('0x12')](_0x05c0('0x33'),_0x50f03d,_0x5d2020[_0x05c0('0x2c')]));emitChannelQueueInteraction(_0x2bfe05[_0x05c0('0x24')],_0x5d2020[_0x05c0('0x2c')],_0x2bfe05[_0x05c0('0x20')],_0x2bfe05[_0x05c0('0xd')][_0x05c0('0x2c')],_0x2bfe05[_0x05c0('0x27')]['id'],![],_0x31b0b8,_0x5d2020['id']);if(rpc[_0x2bfe05[_0x05c0('0x24')]+_0x05c0('0x2d')]){return rpc[_0x2bfe05[_0x05c0('0x24')]+_0x05c0('0x2d')][_0x05c0('0x34')](_0x50f03d,_0x5c652f)[_0x05c0('0x2f')](function(_0x19a19c){logger[_0x05c0('0x30')](_0x05c0('0x35'));});}}}function endRouting(_0x1faa63,_0x3d1bae,_0x337847,_0x9ca737){if(_0x1faa63&&_0x3d1bae){_0x3d1bae[_0x05c0('0x1f')]-=0x1;var _0x3d3291={'leaveAt':moment()[_0x05c0('0x12')](_0x05c0('0x32')),'exitAt':moment()[_0x05c0('0x12')](_0x05c0('0x32')),'reason':_0x05c0('0x36')};logger[_0x05c0('0x2a')](util[_0x05c0('0x12')](_0x05c0('0x37'),_0x1faa63,_0x3d1bae['name']));emitChannelQueueInteraction(_0x337847[_0x05c0('0x24')],_0x3d1bae[_0x05c0('0x2c')],_0x337847[_0x05c0('0x20')],_0x337847[_0x05c0('0xd')]['name'],_0x337847['message']['id'],![],_0x9ca737);if(rpc[_0x337847[_0x05c0('0x24')]+_0x05c0('0x2d')]){return rpc[_0x337847[_0x05c0('0x24')]+'QueueReport'][_0x05c0('0x34')](_0x1faa63,_0x3d3291)[_0x05c0('0x2f')](function(_0x704394){logger[_0x05c0('0x30')]('update\x20queue\x20report');});}}}function handleFindQueue(_0x152c6a){return function(_0x32f25c){return _0x32f25c['name'][_0x05c0('0x38')]()===_0x152c6a[_0x05c0('0x38')]();};}exports[_0x05c0('0x39')]=function(_0xcbd98,_0x164e3a,_0x398a6e,_0x322fd1){return function(_0x5a75b4){try{var _0x595b0a={'name':_0x164e3a[0x0],'timeout':_0x164e3a[0x1]};var _0x29d62a=queue[_0x05c0('0x0')](_0x595b0a,{'typecast':!![]});if(_0x29d62a[_0x05c0('0x3a')]){logger[_0x05c0('0x30')](_0x05c0('0x3b'),_0xcbd98,_['map'](_0x29d62a,_0x05c0('0x27'))[_0x05c0('0x3c')](',\x20'));_0x5a75b4[_0x05c0('0x3d')]();}else{var _0x1c937c=_[_0x05c0('0x3e')](_0x398a6e[_0x322fd1[_0x05c0('0x24')]+_0x05c0('0x3f')],handleFindQueue(_0x595b0a['name']));if(_0x1c937c){startRouting(_0xcbd98,_0x1c937c,_0x322fd1,_0x398a6e);var _0x31cc1b=(_0x1c937c[_0x05c0('0x36')]||0xa)*0x3e8;var _0x15d119=(_0x595b0a[_0x05c0('0x36')]||0x14)*0x3e8;var _0x4396df,_0x130c34;if(_0x31cc1b>_0x15d119){_0x15d119=_0x31cc1b;}var _0x6baa12=seqqueue[_0x05c0('0x40')](_0x31cc1b);_0x6baa12['id']=_0xcbd98;_0x6baa12[_0x05c0('0x41')]=_0x31cc1b;_0x6baa12[_0x05c0('0x42')]=_0x15d119;_0x6baa12[_0x05c0('0x24')]=_0x322fd1['channel'];_0x398a6e['rules'][_0xcbd98]['on'](_0x05c0('0x43'),function(){logger[_0x05c0('0x2a')](_0x05c0('0x44'),_0xcbd98);stopRouting(_0xcbd98,_0x1c937c,_0x322fd1,_0x398a6e);clearTimeout(_0x4396df);_0x4396df=undefined;_0x6baa12[_0x05c0('0x45')](!![]);if(_0x398a6e[_0x05c0('0x46')][_0xcbd98]){delete _0x398a6e[_0x05c0('0x46')][_0xcbd98];}_0x5a75b4['stop']();});_0x398a6e[_0x05c0('0x46')][_0xcbd98]['on'](_0x05c0('0x47'),function(){if(_0x398a6e[_0x05c0('0x46')][_0xcbd98]){delete _0x398a6e[_0x05c0('0x46')][_0xcbd98];}});_0x4396df=setTimeout(function(){logger['info'](_0x05c0('0x48'),_0xcbd98);endRouting(_0xcbd98,_0x1c937c,_0x322fd1,_0x398a6e);clearTimeout(_0x4396df);_0x6baa12[_0x05c0('0x45')](!![]);_0x5a75b4[_0x05c0('0x49')]();},_0x15d119);switch(_0x1c937c[_0x05c0('0x4a')]){case'rrmemory':strategy[_0x05c0('0x4b')](_0x6baa12,_0x1c937c,_0x398a6e,_0x322fd1);break;default:strategy[_0x05c0('0x4c')](_0x6baa12,_0x1c937c,_0x398a6e,_0x322fd1);}}else{logger[_0x05c0('0x30')](_0x05c0('0x4d'),_0xcbd98,_0x595b0a['name']);_0x5a75b4[_0x05c0('0x3d')]();}}}catch(_0x1f403c){console['log'](_0x1f403c);logger[_0x05c0('0x30')]('[%s][QUEUE]\x20%s',_0xcbd98,_0x1f403c['stack']);_0x5a75b4[_0x05c0('0x3d')]();}};}; \ No newline at end of file +var _0x750a=['Queues','createQueue','atimeout','qtimeout','rules','end','close','complete','[%s][QUEUE]\x20APPLICATION\x20END','next','strategy','rrmemory','beepall','[%s][QUEUE]\x20queue\x20not\x20found\x20%s','log','stack','lodash','moment','ioredis','../../../../config/environment','../../../../config/logger','routing','./strategy','redis','defaults','localhost','socket.io-emitter','queue_id','from','emit','clone','account','format','%sQueuesWaitingInteractions','pick','%s:queue:%s','%s_queue_waiting_interaction:%s','remove','../../rpc/chatQueueReport','../../rpc/faxQueueReport','string','number','body','contact','list','channel','InteractionId','interaction','upperFirst','MessageId','message','chat','AccountId','WebsiteId','info','name','QueueReport','catch','error','create\x20queue\x20report','waiting','YYYY-MM-DD\x20HH:mm:ss','accepted','[%s][STOP:QUEUE][NAME:%s]','update','update\x20queue\x20report','timeout','toLowerCase','consequence','validate','length','[%s][QUEUE]\x20%s','map','join','stop','find'];(function(_0x5a7618,_0x3f44c2){var _0x12dc65=function(_0x3cc4cd){while(--_0x3cc4cd){_0x5a7618['push'](_0x5a7618['shift']());}};_0x12dc65(++_0x3f44c2);}(_0x750a,0x140));var _0xa750=function(_0x3d8807,_0x44d813){_0x3d8807=_0x3d8807-0x0;var _0x2cdecc=_0x750a[_0x3d8807];return _0x2cdecc;};'use strict';var schema=require('validate');var _=require(_0xa750('0x0'));var util=require('util');var seqqueue=require('seq-queue');var moment=require(_0xa750('0x1'));var Redis=require(_0xa750('0x2'));var config=require(_0xa750('0x3'));var logger=require(_0xa750('0x4'))(_0xa750('0x5'));var strategy=require(_0xa750('0x6'));config[_0xa750('0x7')]=_[_0xa750('0x8')](config[_0xa750('0x7')],{'host':_0xa750('0x9'),'port':0x18eb});var io=require(_0xa750('0xa'))(new Redis(config[_0xa750('0x7')]));var attributes=['id',_0xa750('0xb'),'account','queue',_0xa750('0xc'),'joinAt'];function emit(_0x4458b1,_0x1760f5,_0x51f594){io['to'](_0x4458b1)[_0xa750('0xd')](_0x1760f5,_0x51f594);}function emitChannelQueueInteraction(_0x2c2ea4,_0x5870f0,_0x5aca9c,_0xcb62ae,_0x4b19a1,_0x174fd0,_0x5adaae,_0x4d49c3){var _0x24ec62=_[_0xa750('0xe')](_0x5aca9c);_0x24ec62[_0xa750('0xb')]=_0x4d49c3;_0x24ec62['queue']=_0x5870f0;_0x24ec62[_0xa750('0xf')]=_0xcb62ae;_0x24ec62['id']=_0x4b19a1;if(_0x174fd0){_0x5adaae[util[_0xa750('0x10')](_0xa750('0x11'),_0x2c2ea4)][_0x4b19a1]=_[_0xa750('0x12')](_0x24ec62,attributes);}else{delete _0x5adaae[util[_0xa750('0x10')](_0xa750('0x11'),_0x2c2ea4)][_0x4b19a1];}emit(util['format'](_0xa750('0x13'),_0x2c2ea4,_0x5870f0),util[_0xa750('0x10')](_0xa750('0x14'),_0x2c2ea4,_0x174fd0?'save':_0xa750('0x15')),_[_0xa750('0x12')](_0x24ec62,attributes));}var rpc={'openchannelQueueReport':require('../../rpc/openchannelQueueReport'),'mailQueueReport':require('../../rpc/mailQueueReport'),'chatQueueReport':require(_0xa750('0x16')),'smsQueueReport':require('../../rpc/smsQueueReport'),'faxQueueReport':require(_0xa750('0x17'))};var queue=schema({'name':{'type':_0xa750('0x18'),'required':!![],'message':'name\x20is\x20a\x20string\x20and\x20it\x20is\x20required'},'timeout':{'type':_0xa750('0x19'),'message':'timeout\x20is\x20a\x20number'}});function startRouting(_0x5f28f4,_0x25e335,_0x5d0935,_0x3fa031){if(_0x5f28f4&&_0x25e335&&_0x5d0935){_0x25e335['waiting']+=0x1;var _0x174a8c={'uniqueid':_0x5f28f4,'from':_0x5d0935['body']?_0x5d0935[_0xa750('0x1a')]['from']:'','joinAt':moment()[_0xa750('0x10')]('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0x5d0935['contact']?_0x5d0935[_0xa750('0x1b')]['id']:null,'ListId':_0x5d0935['list']?_0x5d0935[_0xa750('0x1c')]['id']:null};_0x174a8c[_['upperFirst'](_0x5d0935['channel'])+'QueueId']=_0x25e335['id']||null;_0x174a8c[_['upperFirst'](_0x5d0935[_0xa750('0x1d')])+_0xa750('0x1e')]=_0x5d0935[_0xa750('0x1f')]?_0x5d0935[_0xa750('0x1f')]['id']:null;_0x174a8c[_[_0xa750('0x20')](_0x5d0935[_0xa750('0x1d')])+_0xa750('0x21')]=_0x5d0935[_0xa750('0x22')]?_0x5d0935[_0xa750('0x22')]['id']:null;_0x174a8c[_[_0xa750('0x20')](_0x5d0935[_0xa750('0x1d')])+(_0x5d0935[_0xa750('0x1d')]!==_0xa750('0x23')?_0xa750('0x24'):_0xa750('0x25'))]=_0x5d0935['account']?_0x5d0935[_0xa750('0xf')]['id']:null;logger[_0xa750('0x26')](util[_0xa750('0x10')]('[%s][START:QUEUE][NAME:%s]',_0x5f28f4,_0x25e335[_0xa750('0x27')]));emitChannelQueueInteraction(_0x5d0935[_0xa750('0x1d')],_0x25e335[_0xa750('0x27')],_0x174a8c,_0x5d0935[_0xa750('0xf')]['name'],_0x5d0935[_0xa750('0x22')]['id'],!![],_0x3fa031,_0x25e335['id']);if(rpc[_0x5d0935[_0xa750('0x1d')]+_0xa750('0x28')]){return rpc[_0x5d0935[_0xa750('0x1d')]+_0xa750('0x28')]['create'](_0x174a8c)[_0xa750('0x29')](function(_0x4c2c9e){logger[_0xa750('0x2a')](_0xa750('0x2b'));});}}}function stopRouting(_0x5f53cd,_0x8b5c2d,_0x6bc25d,_0x5e66fd){if(_0x5f53cd&&_0x8b5c2d){_0x8b5c2d[_0xa750('0x2c')]-=0x1;var _0xbf5164={'leaveAt':moment()[_0xa750('0x10')](_0xa750('0x2d')),'acceptAt':moment()[_0xa750('0x10')]('YYYY-MM-DD\x20HH:mm:ss'),'reason':_0xa750('0x2e')};logger['info'](util[_0xa750('0x10')](_0xa750('0x2f'),_0x5f53cd,_0x8b5c2d[_0xa750('0x27')]));emitChannelQueueInteraction(_0x6bc25d[_0xa750('0x1d')],_0x8b5c2d['name'],_0x6bc25d[_0xa750('0x1a')],_0x6bc25d[_0xa750('0xf')]['name'],_0x6bc25d[_0xa750('0x22')]['id'],![],_0x5e66fd,_0x8b5c2d['id']);if(rpc[_0x6bc25d[_0xa750('0x1d')]+_0xa750('0x28')]){return rpc[_0x6bc25d[_0xa750('0x1d')]+'QueueReport'][_0xa750('0x30')](_0x5f53cd,_0xbf5164)['catch'](function(_0x58f219){logger[_0xa750('0x2a')](_0xa750('0x31'));});}}}function endRouting(_0xaa626c,_0x5254a3,_0x470089,_0x28603e){if(_0xaa626c&&_0x5254a3){_0x5254a3[_0xa750('0x2c')]-=0x1;var _0x53ad23={'leaveAt':moment()[_0xa750('0x10')](_0xa750('0x2d')),'exitAt':moment()[_0xa750('0x10')]('YYYY-MM-DD\x20HH:mm:ss'),'reason':_0xa750('0x32')};logger[_0xa750('0x26')](util[_0xa750('0x10')]('[%s][END:QUEUE][NAME:%s]',_0xaa626c,_0x5254a3[_0xa750('0x27')]));emitChannelQueueInteraction(_0x470089[_0xa750('0x1d')],_0x5254a3[_0xa750('0x27')],_0x470089[_0xa750('0x1a')],_0x470089['account']['name'],_0x470089[_0xa750('0x22')]['id'],![],_0x28603e);if(rpc[_0x470089[_0xa750('0x1d')]+'QueueReport']){return rpc[_0x470089[_0xa750('0x1d')]+_0xa750('0x28')][_0xa750('0x30')](_0xaa626c,_0x53ad23)[_0xa750('0x29')](function(_0x302a79){logger['error'](_0xa750('0x31'));});}}}function handleFindQueue(_0x2b33e0){return function(_0x847081){return _0x847081[_0xa750('0x27')][_0xa750('0x33')]()===_0x2b33e0[_0xa750('0x33')]();};}exports[_0xa750('0x34')]=function(_0x55a3e8,_0x3daa38,_0x5e9ffb,_0x214fa0){return function(_0x4ab922){try{var _0x453add={'name':_0x3daa38[0x0],'timeout':_0x3daa38[0x1]};var _0x376afb=queue[_0xa750('0x35')](_0x453add,{'typecast':!![]});if(_0x376afb[_0xa750('0x36')]){logger[_0xa750('0x2a')](_0xa750('0x37'),_0x55a3e8,_[_0xa750('0x38')](_0x376afb,_0xa750('0x22'))[_0xa750('0x39')](',\x20'));_0x4ab922[_0xa750('0x3a')]();}else{var _0x36a8d6=_[_0xa750('0x3b')](_0x5e9ffb[_0x214fa0[_0xa750('0x1d')]+_0xa750('0x3c')],handleFindQueue(_0x453add[_0xa750('0x27')]));if(_0x36a8d6){startRouting(_0x55a3e8,_0x36a8d6,_0x214fa0,_0x5e9ffb);var _0x2ca738=(_0x36a8d6[_0xa750('0x32')]||0xa)*0x3e8;var _0x2c6ee1=(_0x453add[_0xa750('0x32')]||0x14)*0x3e8;var _0xf4d89d,_0x4f0bae;if(_0x2ca738>_0x2c6ee1){_0x2c6ee1=_0x2ca738;}var _0x46e61e=seqqueue[_0xa750('0x3d')](_0x2ca738);_0x46e61e['id']=_0x55a3e8;_0x46e61e[_0xa750('0x3e')]=_0x2ca738;_0x46e61e[_0xa750('0x3f')]=_0x2c6ee1;_0x46e61e[_0xa750('0x1d')]=_0x214fa0[_0xa750('0x1d')];_0x5e9ffb[_0xa750('0x40')][_0x55a3e8]['on'](_0xa750('0x41'),function(){logger[_0xa750('0x26')]('[%s][QUEUE]\x20ROUTING\x20STOPPED',_0x55a3e8);stopRouting(_0x55a3e8,_0x36a8d6,_0x214fa0,_0x5e9ffb);clearTimeout(_0xf4d89d);_0xf4d89d=undefined;_0x46e61e[_0xa750('0x42')](!![]);if(_0x5e9ffb[_0xa750('0x40')][_0x55a3e8]){delete _0x5e9ffb['rules'][_0x55a3e8];}_0x4ab922[_0xa750('0x3a')]();});_0x5e9ffb[_0xa750('0x40')][_0x55a3e8]['on'](_0xa750('0x43'),function(){if(_0x5e9ffb[_0xa750('0x40')][_0x55a3e8]){delete _0x5e9ffb[_0xa750('0x40')][_0x55a3e8];}});_0xf4d89d=setTimeout(function(){logger[_0xa750('0x26')](_0xa750('0x44'),_0x55a3e8);endRouting(_0x55a3e8,_0x36a8d6,_0x214fa0,_0x5e9ffb);clearTimeout(_0xf4d89d);_0x46e61e[_0xa750('0x42')](!![]);_0x4ab922[_0xa750('0x45')]();},_0x2c6ee1);switch(_0x36a8d6[_0xa750('0x46')]){case'rrmemory':strategy[_0xa750('0x47')](_0x46e61e,_0x36a8d6,_0x5e9ffb,_0x214fa0);break;default:strategy[_0xa750('0x48')](_0x46e61e,_0x36a8d6,_0x5e9ffb,_0x214fa0);}}else{logger['error'](_0xa750('0x49'),_0x55a3e8,_0x453add[_0xa750('0x27')]);_0x4ab922[_0xa750('0x3a')]();}}}catch(_0x4a21d6){console[_0xa750('0x4a')](_0x4a21d6);logger[_0xa750('0x2a')](_0xa750('0x37'),_0x55a3e8,_0x4a21d6[_0xa750('0x4b')]);_0x4ab922['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 e35f26e..586084b 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 _0x83c9=[':FORCED','[%s][AGENT]\x20agent\x20%s\x20is\x20not\x20available','[%s][AGENT]\x20timeout\x20with\x20%s','hideNotification','busyQueue','STOP','TIMEOUT','exports','lodash','../../../../../config/logger','routing','notificationId','squeue','agent','realtime','push','handleRun','bind','handleTimeout','timeout','drained','handleDrained','prototype','[%s][AGENT]\x20try\x20with\x20%s','isNil','agents','info','[%s][AGENT]\x20agent\x20skipped,\x20unknown\x20id\x20%s','isAgentAvailable','channel','busy','showNotification','writeLog','RINGING','forcedOwnership'];(function(_0x2e4c84,_0x4d3142){var _0x22cf85=function(_0x437e7e){while(--_0x437e7e){_0x2e4c84['push'](_0x2e4c84['shift']());}};_0x22cf85(++_0x4d3142);}(_0x83c9,0x94));var _0x983c=function(_0x4d2583,_0x52bd89){_0x4d2583=_0x4d2583-0x0;var _0x57fa3a=_0x83c9[_0x4d2583];return _0x57fa3a;};'use strict';var _=require(_0x983c('0x0'));var uuid=require('uuid');var util=require('./util');var logger=require(_0x983c('0x1'))(_0x983c('0x2'));var Agent=function(_0x4e929d,_0x13f084,_0x432f91,_0x2dd155){this[_0x983c('0x3')]=uuid['v4']();this[_0x983c('0x4')]=_0x4e929d;this[_0x983c('0x5')]=_0x13f084;this[_0x983c('0x6')]=_0x432f91;this[_0x983c('0x2')]=_0x2dd155;this[_0x983c('0x4')][_0x983c('0x7')](this[_0x983c('0x8')][_0x983c('0x9')](this),this[_0x983c('0xa')][_0x983c('0x9')](this));this[_0x983c('0x4')]['on'](_0x983c('0xb'),this[_0x983c('0xa')][_0x983c('0x9')](this));this[_0x983c('0x4')]['on'](_0x983c('0xc'),this[_0x983c('0xd')][_0x983c('0x9')](this));};Agent[_0x983c('0xe')][_0x983c('0x7')]=function(){this[_0x983c('0x4')]['push'](this[_0x983c('0x8')][_0x983c('0x9')](this),this[_0x983c('0xa')][_0x983c('0x9')](this));};Agent[_0x983c('0xe')]['handleDrained']=function(){this[_0x983c('0xa')](!![]);};Agent[_0x983c('0xe')]['handleRun']=function(_0x20e039){logger['info'](_0x983c('0xf'),this[_0x983c('0x4')]['id'],this[_0x983c('0x5')]['id']);if(_[_0x983c('0x10')](this[_0x983c('0x6')][_0x983c('0x11')][this[_0x983c('0x5')]['id']])){logger[_0x983c('0x12')](_0x983c('0x13'),this[_0x983c('0x4')]['id'],this[_0x983c('0x5')]['id']);setTimeout(this[_0x983c('0x7')][_0x983c('0x9')](this),0x3e8);}else{if(this[_0x983c('0x2')]['forcedOwnership']||util[_0x983c('0x14')](this[_0x983c('0x4')]['id'],this['realtime'][_0x983c('0x11')][this['agent']['id']],this['squeue'][_0x983c('0x15')],![])){this['realtime'][_0x983c('0x11')][this[_0x983c('0x5')]['id']][_0x983c('0x16')]=!![];this[_0x983c('0x6')][_0x983c('0x11')][this[_0x983c('0x5')]['id']]['busyQueue']=undefined;util[_0x983c('0x17')](this[_0x983c('0x3')],this[_0x983c('0x4')]['id'],this[_0x983c('0x6')]['agents'][this[_0x983c('0x5')]['id']],null,this[_0x983c('0x2')]);util[_0x983c('0x18')](this[_0x983c('0x4')]['id'],this[_0x983c('0x6')][_0x983c('0x11')][this[_0x983c('0x5')]['id']],_0x983c('0x19')+(this[_0x983c('0x2')][_0x983c('0x1a')]?_0x983c('0x1b'):''));}else{logger[_0x983c('0x12')](_0x983c('0x1c'),this[_0x983c('0x4')]['id'],this[_0x983c('0x5')]['id']);setTimeout(this['push'][_0x983c('0x9')](this),0x3e8);}}};Agent[_0x983c('0xe')][_0x983c('0xa')]=function(_0x18fb2a){if(_['isNil'](this[_0x983c('0x6')][_0x983c('0x11')][this[_0x983c('0x5')]['id']])){return logger[_0x983c('0x12')](_0x983c('0x13'),this['squeue']['id'],this[_0x983c('0x5')]['id']);}else{logger['info'](_0x983c('0x1d'),this[_0x983c('0x4')]['id'],this['agent']['id']);util[_0x983c('0x1e')](this[_0x983c('0x3')],this[_0x983c('0x4')]['id'],this['realtime']['agents'][this[_0x983c('0x5')]['id']],null,this[_0x983c('0x2')]);this['realtime']['agents'][this[_0x983c('0x5')]['id']][_0x983c('0x16')]=![];this['realtime'][_0x983c('0x11')][this[_0x983c('0x5')]['id']][_0x983c('0x1f')]=undefined;util[_0x983c('0x18')](this[_0x983c('0x4')]['id'],this[_0x983c('0x6')][_0x983c('0x11')][this[_0x983c('0x5')]['id']],_0x18fb2a?_0x983c('0x20'):_0x983c('0x21'));}if(!_0x18fb2a){setTimeout(this[_0x983c('0x7')][_0x983c('0x9')](this),0x3e8);}};function agent(_0x544e0f,_0x4a0663,_0x13c3f1,_0x2d5ea9){return new Agent(_0x544e0f,_0x4a0663,_0x13c3f1,_0x2d5ea9);}module[_0x983c('0x22')]=agent; \ No newline at end of file +var _0xeab4=['uuid','./util','../../../../../config/logger','notificationId','squeue','agent','realtime','routing','push','handleTimeout','bind','timeout','drained','handleDrained','prototype','info','[%s][AGENT]\x20try\x20with\x20%s','isNil','agents','isAgentAvailable','channel','busyQueue','showNotification','RINGING','forcedOwnership',':FORCED','[%s][AGENT]\x20agent\x20%s\x20is\x20not\x20available','[%s][AGENT]\x20agent\x20skipped,\x20unknown\x20id\x20%s','[%s][AGENT]\x20timeout\x20with\x20%s','busy','writeLog','STOP','TIMEOUT','lodash'];(function(_0x3ad7ad,_0x291a8d){var _0x225a60=function(_0xca7354){while(--_0xca7354){_0x3ad7ad['push'](_0x3ad7ad['shift']());}};_0x225a60(++_0x291a8d);}(_0xeab4,0x153));var _0x4eab=function(_0x45d3e1,_0x273307){_0x45d3e1=_0x45d3e1-0x0;var _0x1e1b5f=_0xeab4[_0x45d3e1];return _0x1e1b5f;};'use strict';var _=require(_0x4eab('0x0'));var uuid=require(_0x4eab('0x1'));var util=require(_0x4eab('0x2'));var logger=require(_0x4eab('0x3'))('routing');var Agent=function(_0x3dc08e,_0x405d3d,_0x4eb50a,_0x2a30e0){this[_0x4eab('0x4')]=uuid['v4']();this[_0x4eab('0x5')]=_0x3dc08e;this[_0x4eab('0x6')]=_0x405d3d;this[_0x4eab('0x7')]=_0x4eb50a;this[_0x4eab('0x8')]=_0x2a30e0;this[_0x4eab('0x5')][_0x4eab('0x9')](this['handleRun']['bind'](this),this[_0x4eab('0xa')][_0x4eab('0xb')](this));this[_0x4eab('0x5')]['on'](_0x4eab('0xc'),this[_0x4eab('0xa')][_0x4eab('0xb')](this));this[_0x4eab('0x5')]['on'](_0x4eab('0xd'),this[_0x4eab('0xe')][_0x4eab('0xb')](this));};Agent['prototype'][_0x4eab('0x9')]=function(){this[_0x4eab('0x5')][_0x4eab('0x9')](this['handleRun'][_0x4eab('0xb')](this),this[_0x4eab('0xa')][_0x4eab('0xb')](this));};Agent[_0x4eab('0xf')]['handleDrained']=function(){this[_0x4eab('0xa')](!![]);};Agent[_0x4eab('0xf')]['handleRun']=function(_0x4c5b9a){logger[_0x4eab('0x10')](_0x4eab('0x11'),this[_0x4eab('0x5')]['id'],this['agent']['id']);if(_[_0x4eab('0x12')](this['realtime'][_0x4eab('0x13')][this[_0x4eab('0x6')]['id']])){logger['info']('[%s][AGENT]\x20agent\x20skipped,\x20unknown\x20id\x20%s',this['squeue']['id'],this['agent']['id']);setTimeout(this['push'][_0x4eab('0xb')](this),0x3e8);}else{if(this[_0x4eab('0x8')]['forcedOwnership']||util[_0x4eab('0x14')](this['squeue']['id'],this[_0x4eab('0x7')][_0x4eab('0x13')][this[_0x4eab('0x6')]['id']],this[_0x4eab('0x5')][_0x4eab('0x15')],![])){this[_0x4eab('0x7')]['agents'][this[_0x4eab('0x6')]['id']]['busy']=!![];this['realtime']['agents'][this[_0x4eab('0x6')]['id']][_0x4eab('0x16')]=undefined;util[_0x4eab('0x17')](this[_0x4eab('0x4')],this[_0x4eab('0x5')]['id'],this[_0x4eab('0x7')][_0x4eab('0x13')][this[_0x4eab('0x6')]['id']],null,this[_0x4eab('0x8')]);util['writeLog'](this[_0x4eab('0x5')]['id'],this[_0x4eab('0x7')][_0x4eab('0x13')][this[_0x4eab('0x6')]['id']],_0x4eab('0x18')+(this[_0x4eab('0x8')][_0x4eab('0x19')]?_0x4eab('0x1a'):''));}else{logger[_0x4eab('0x10')](_0x4eab('0x1b'),this[_0x4eab('0x5')]['id'],this[_0x4eab('0x6')]['id']);setTimeout(this[_0x4eab('0x9')][_0x4eab('0xb')](this),0x3e8);}}};Agent[_0x4eab('0xf')][_0x4eab('0xa')]=function(_0x6f2ad7){if(_[_0x4eab('0x12')](this[_0x4eab('0x7')][_0x4eab('0x13')][this[_0x4eab('0x6')]['id']])){return logger[_0x4eab('0x10')](_0x4eab('0x1c'),this[_0x4eab('0x5')]['id'],this[_0x4eab('0x6')]['id']);}else{logger[_0x4eab('0x10')](_0x4eab('0x1d'),this['squeue']['id'],this[_0x4eab('0x6')]['id']);util['hideNotification'](this[_0x4eab('0x4')],this[_0x4eab('0x5')]['id'],this[_0x4eab('0x7')][_0x4eab('0x13')][this[_0x4eab('0x6')]['id']],null,this[_0x4eab('0x8')]);this['realtime'][_0x4eab('0x13')][this['agent']['id']][_0x4eab('0x1e')]=![];this['realtime']['agents'][this['agent']['id']][_0x4eab('0x16')]=undefined;util[_0x4eab('0x1f')](this[_0x4eab('0x5')]['id'],this[_0x4eab('0x7')][_0x4eab('0x13')][this[_0x4eab('0x6')]['id']],_0x6f2ad7?_0x4eab('0x20'):_0x4eab('0x21'));}if(!_0x6f2ad7){setTimeout(this[_0x4eab('0x9')][_0x4eab('0xb')](this),0x3e8);}};function agent(_0x43dc78,_0x51279e,_0x267c4a,_0xf1703a){return new Agent(_0x43dc78,_0x51279e,_0x267c4a,_0xf1703a);}module['exports']=agent; \ No newline at end of file diff --git a/server/services/routing/server/applications/strategy/beepall.js b/server/services/routing/server/applications/strategy/beepall.js index acab8c7..fa2c95e 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 _0xc584=['isAgentAvailable','writeLog','RINGING','busy','busyQueue','name','showNotification','[%s][QUEUE]\x20EMPTY','[%s][QUEUE]\x20agent\x20skipped,\x20unknown\x20id\x20%s','STOP','TIMEOUT','exports','uuid','./util','../../../../../config/logger','routing','notificationId','squeue','queue','realtime','push','handleRun','bind','handleTimeout','timeout','drained','handleDrained','prototype','isNil','Agents','length','agents','info'];(function(_0xfae23b,_0x2be4ba){var _0x200640=function(_0x4ae258){while(--_0x4ae258){_0xfae23b['push'](_0xfae23b['shift']());}};_0x200640(++_0x2be4ba);}(_0xc584,0x1da));var _0x4c58=function(_0x5f49c0,_0x27a1b4){_0x5f49c0=_0x5f49c0-0x0;var _0x5ab653=_0xc584[_0x5f49c0];return _0x5ab653;};'use strict';var _=require('lodash');var uuid=require(_0x4c58('0x0'));var util=require(_0x4c58('0x1'));var logger=require(_0x4c58('0x2'))(_0x4c58('0x3'));var Beepall=function(_0x3930aa,_0x3235ac,_0x57e2c7,_0x43ebb8){this[_0x4c58('0x4')]=uuid['v4']();this[_0x4c58('0x5')]=_0x3930aa;this[_0x4c58('0x6')]=_0x3235ac;this[_0x4c58('0x7')]=_0x57e2c7;this['routing']=_0x43ebb8;this[_0x4c58('0x5')][_0x4c58('0x8')](this[_0x4c58('0x9')][_0x4c58('0xa')](this),this[_0x4c58('0xb')][_0x4c58('0xa')](this));this[_0x4c58('0x5')]['on'](_0x4c58('0xc'),this[_0x4c58('0xb')][_0x4c58('0xa')](this));this['squeue']['on'](_0x4c58('0xd'),this[_0x4c58('0xe')][_0x4c58('0xa')](this));};Beepall[_0x4c58('0xf')][_0x4c58('0x8')]=function(){this[_0x4c58('0x5')]['push'](this['handleRun'][_0x4c58('0xa')](this),this['handleTimeout'][_0x4c58('0xa')](this));};Beepall[_0x4c58('0xf')][_0x4c58('0xe')]=function(_0x31098e){this[_0x4c58('0xb')](!![]);};Beepall[_0x4c58('0xf')][_0x4c58('0x9')]=function(_0x47a7d3){var _0x3a439b=!![];if(!_[_0x4c58('0x10')](this[_0x4c58('0x6')])&&!_[_0x4c58('0x10')](this[_0x4c58('0x6')][_0x4c58('0x11')])&&this['queue'][_0x4c58('0x11')]['length']>0x0){for(var _0x20f968=0x0,_0x1a0336;_0x20f9680x0){for(var _0x53d545=0x0,_0x167fb4;_0x53d5450x0&&_0x5cb8b8[_0x4b6c79+'CurrentCapacity']>=_0x5cb8b8[_0x4b6c79+_0x4b97('0x1a')]){writeLog(_0x382df2,_0x5cb8b8,_0x4b6c79[_0x4b97('0x1c')]()+_0x4b97('0x1d'));return![];}}return!![];};exports['showNotification']=function(_0x558214,_0x18c6c2,_0x37a69f,_0x476089,_0xb8e15c){return sendNotification(!![],_0x558214,_0x18c6c2,_0x37a69f,_0x476089,_0xb8e15c);};exports[_0x4b97('0x1e')]=function(_0x206b55,_0x3e358e,_0x4583f9,_0x14a9d8,_0x2af570){return sendNotification(![],_0x206b55,_0x3e358e,_0x4583f9,_0x14a9d8,_0x2af570);};exports['writeLog']=writeLog; \ No newline at end of file +var _0xc902=['mustache','ioredis','../../../../../config/environment','routing','redis','defaults','localhost','emit','format','user:%s','name','user:save','\x20interaction','account','notificationShake','body','queue','msg','getMustacheRender','notificationTemplate','error','save','remove','info','[%s][QUEUE][AGENT:%s][STATUS:%s]','isAgentAvailable','busy','online','PAUSE','hasOwnProperty','Capacity','CurrentCapacity','toUpperCase','showNotification','hideNotification','writeLog','lodash','util','../utils'];(function(_0x394ed2,_0x160fa8){var _0x5a9de1=function(_0x30ea17){while(--_0x30ea17){_0x394ed2['push'](_0x394ed2['shift']());}};_0x5a9de1(++_0x160fa8);}(_0xc902,0x15c));var _0x2c90=function(_0x1aeb84,_0x5caed8){_0x1aeb84=_0x1aeb84-0x0;var _0x41cbb9=_0xc902[_0x1aeb84];return _0x41cbb9;};'use strict';var _=require(_0x2c90('0x0'));var util=require(_0x2c90('0x1'));var utils=require(_0x2c90('0x2'));var Mustache=require(_0x2c90('0x3'));var Redis=require(_0x2c90('0x4'));var config=require(_0x2c90('0x5'));var logger=require('../../../../../config/logger')(_0x2c90('0x6'));config[_0x2c90('0x7')]=_[_0x2c90('0x8')](config[_0x2c90('0x7')],{'host':_0x2c90('0x9'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config['redis']));function emit(_0x73546a,_0x2b16eb,_0x2a9ed9){io['to'](_0x73546a)[_0x2c90('0xa')](_0x2b16eb,_0x2a9ed9);}function sendNotification(_0xfb5e40,_0x51812c,_0x5b6573,_0x1ee22a,_0x4a0495,_0x128764){io['to'](util[_0x2c90('0xb')](_0x2c90('0xc'),_0x1ee22a[_0x2c90('0xd')]))[_0x2c90('0xa')](_0x2c90('0xe'),_0x1ee22a);var _0x876e34=_0x128764||{};var _0xad3652=_0x5b6573['split']('.');var _0x2ea005={'uniqueid':_0x51812c,'channel':_0xad3652[0x0],'id':_0xad3652[0x1],'title':_0xad3652[0x0]+_0x2c90('0xf'),'interactionId':_0xad3652[0x2],'queue':_0x4a0495?_0x4a0495['name']:null,'sound':_0x876e34[_0x2c90('0x10')]['notificationSound'],'shake':_0x876e34[_0x2c90('0x10')][_0x2c90('0x11')]};try{if(!_0x876e34[_0x2c90('0x12')]){_0x876e34[_0x2c90('0x12')]={};}if(_0x4a0495){_0x876e34[_0x2c90('0x12')][_0x2c90('0x13')]=_0x4a0495;}else if(_0x876e34['body'][_0x2c90('0x13')]){delete _0x876e34[_0x2c90('0x12')][_0x2c90('0x13')];}_0x2ea005[_0x2c90('0x14')]=utils[_0x2c90('0x15')](_0x876e34[_0x2c90('0x10')][_0x2c90('0x16')],_0x876e34);}catch(_0x45de38){_0x2ea005[_0x2c90('0x14')]='I\x20can\x27t\x20render\x20your\x20template';logger[_0x2c90('0x17')](util[_0x2c90('0xb')]('[%s][QUEUE]\x20%s',_0x51812c,_0x45de38['message']));}io['to'](util['format'](_0x2c90('0xc'),_0x1ee22a['name']))[_0x2c90('0xa')](util[_0x2c90('0xb')]('notification:%s',_0xfb5e40?_0x2c90('0x18'):_0x2c90('0x19')),_0x2ea005);}function writeLog(_0x5ce79a,_0x22e7cb,_0xf2f284){return logger[_0x2c90('0x1a')](util[_0x2c90('0xb')](_0x2c90('0x1b'),_0x5ce79a,_0x22e7cb[_0x2c90('0xd')],_0xf2f284));}exports[_0x2c90('0x1c')]=function(_0x227bc9,_0x26fcdd,_0x9a3486,_0x25b954){if(_0x26fcdd[_0x2c90('0x1d')]){writeLog(_0x227bc9,_0x26fcdd,'BUSY');return![];}if(!_0x26fcdd[_0x2c90('0x1e')]){writeLog(_0x227bc9,_0x26fcdd,'OFFLINE');return![];}if(_0x26fcdd[_0x9a3486+'Pause']){writeLog(_0x227bc9,_0x26fcdd,_0x2c90('0x1f'));return![];}if(_0x25b954&&_0x26fcdd[_0x2c90('0x20')](_0x9a3486+_0x2c90('0x21'))&&_0x26fcdd[_0x2c90('0x20')](_0x9a3486+'CurrentCapacity')){if(_0x26fcdd[_0x9a3486+_0x2c90('0x21')]>0x0&&_0x26fcdd[_0x9a3486+_0x2c90('0x22')]>=_0x26fcdd[_0x9a3486+_0x2c90('0x21')]){writeLog(_0x227bc9,_0x26fcdd,_0x9a3486[_0x2c90('0x23')]()+'\x20MAXCAPACITY');return![];}}return!![];};exports[_0x2c90('0x24')]=function(_0x3e924b,_0x4abd54,_0x246e79,_0x410acf,_0x151462){return sendNotification(!![],_0x3e924b,_0x4abd54,_0x246e79,_0x410acf,_0x151462);};exports[_0x2c90('0x25')]=function(_0x44d4b5,_0x48043f,_0x2137b6,_0x55658b,_0xcf3b71){return sendNotification(![],_0x44d4b5,_0x48043f,_0x2137b6,_0x55658b,_0xcf3b71);};exports[_0x2c90('0x26')]=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 b426a4b..741f022 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 _0x1909=['[%s][SYSTEM]\x20no\x20command\x20executed,\x20force\x20next','next','getMustacheRender','exec','trim','[%s][SYSTEM]\x20result\x20code:\x20%s','replace','isEmpty','[%s][SYSTEM]\x20no\x20variable','[%s][SYSTEM]\x20set\x20variable\x20%s:\x20%s','body','stringify','validate','shelljs','lodash','./utils','command\x20is\x20a\x20string\x20and\x20it\x20is\x20required','consequence','length','error','[%s][SYSTEM]\x20%s','map','join','info'];(function(_0x162a95,_0x9dfb1f){var _0x54cd40=function(_0x249ed1){while(--_0x249ed1){_0x162a95['push'](_0x162a95['shift']());}};_0x54cd40(++_0x9dfb1f);}(_0x1909,0xe4));var _0x9190=function(_0x17259c,_0x19f4c1){_0x17259c=_0x17259c-0x0;var _0x2d5072=_0x1909[_0x17259c];return _0x2d5072;};'use strict';var schema=require(_0x9190('0x0'));var sh=require(_0x9190('0x1'));var _=require(_0x9190('0x2'));var utils=require(_0x9190('0x3'));var logger=require('../../../../config/logger')('routing');var system=schema({'command':{'type':'string','required':!![],'message':_0x9190('0x4')}});exports[_0x9190('0x5')]=function(_0x302ee9,_0x7d9e3){return function(_0x1c9a98){try{var _0x16f91d={'command':_0x7d9e3[0x0]};var _0xd42926=system[_0x9190('0x0')](_0x16f91d,{'typecast':!![]});if(_0xd42926[_0x9190('0x6')]){logger[_0x9190('0x7')](_0x9190('0x8'),_0x302ee9,_[_0x9190('0x9')](_0xd42926,'message')[_0x9190('0xa')](',\x20'));logger[_0x9190('0xb')](_0x9190('0xc'),_0x302ee9);_0x1c9a98[_0x9190('0xd')]();}else{var _0x482a95=this;var _0xa7b8fe=utils[_0x9190('0xe')](_0x7d9e3[0x0],this);logger[_0x9190('0xb')]('[%s][SYSTEM]\x20commnad:\x20%s',_0x302ee9,_0xa7b8fe);sh[_0x9190('0xf')](_[_0x9190('0x10')](_0xa7b8fe),function(_0x8f633d,_0x3c457){logger['info'](_0x9190('0x11'),_0x302ee9,_0x8f633d);if(_0x8f633d==0x0){var _0x2de8fd=_0x3c457[_0x9190('0x12')](/(\r\n|\n|\r)/gm,'');if(_['isNil'](_0x7d9e3[0x1])||_[_0x9190('0x13')](_0x7d9e3[0x1])){logger[_0x9190('0xb')](_0x9190('0x14'),_0x302ee9);_0x482a95['body'][_0x7d9e3[0x1]]=_0x2de8fd;}else{logger[_0x9190('0xb')](_0x9190('0x15'),_0x302ee9,_0x7d9e3[0x1],_0x2de8fd);_0x482a95[_0x9190('0x16')][_0x7d9e3[0x1]]=_0x2de8fd;}}_0x1c9a98[_0x9190('0xd')]();});}}catch(_0xf75755){logger[_0x9190('0x7')]('[%s][SYSTEM]\x20%s',_0x302ee9,_['isObject'](_0xf75755)?JSON[_0x9190('0x17')](_0xf75755):_0xf75755);logger[_0x9190('0xb')](_0x9190('0xc'),_0x302ee9);_0x1c9a98[_0x9190('0xd')]();}};}; \ No newline at end of file +var _0x4b97=['[%s][SYSTEM]\x20commnad:\x20%s','exec','trim','[%s][SYSTEM]\x20result\x20code:\x20%s','replace','isNil','[%s][SYSTEM]\x20no\x20variable','body','[%s][SYSTEM]\x20set\x20variable\x20%s:\x20%s','isObject','stringify','validate','shelljs','lodash','routing','string','command\x20is\x20a\x20string\x20and\x20it\x20is\x20required','consequence','length','error','[%s][SYSTEM]\x20%s','map','join','info','[%s][SYSTEM]\x20no\x20command\x20executed,\x20force\x20next','next','getMustacheRender'];(function(_0x57be17,_0x3455e9){var _0x198237=function(_0x275a53){while(--_0x275a53){_0x57be17['push'](_0x57be17['shift']());}};_0x198237(++_0x3455e9);}(_0x4b97,0x1a0));var _0x74b9=function(_0x2be8c2,_0x14a4b5){_0x2be8c2=_0x2be8c2-0x0;var _0x97f531=_0x4b97[_0x2be8c2];return _0x97f531;};'use strict';var schema=require(_0x74b9('0x0'));var sh=require(_0x74b9('0x1'));var _=require(_0x74b9('0x2'));var utils=require('./utils');var logger=require('../../../../config/logger')(_0x74b9('0x3'));var system=schema({'command':{'type':_0x74b9('0x4'),'required':!![],'message':_0x74b9('0x5')}});exports[_0x74b9('0x6')]=function(_0x17cda1,_0x38ab7c){return function(_0x2b9a12){try{var _0x1c5620={'command':_0x38ab7c[0x0]};var _0x2384df=system['validate'](_0x1c5620,{'typecast':!![]});if(_0x2384df[_0x74b9('0x7')]){logger[_0x74b9('0x8')](_0x74b9('0x9'),_0x17cda1,_[_0x74b9('0xa')](_0x2384df,'message')[_0x74b9('0xb')](',\x20'));logger[_0x74b9('0xc')](_0x74b9('0xd'),_0x17cda1);_0x2b9a12[_0x74b9('0xe')]();}else{var _0xd6af22=this;var _0x28fa3a=utils[_0x74b9('0xf')](_0x38ab7c[0x0],this);logger[_0x74b9('0xc')](_0x74b9('0x10'),_0x17cda1,_0x28fa3a);sh[_0x74b9('0x11')](_[_0x74b9('0x12')](_0x28fa3a),function(_0x36a4dc,_0x325c99){logger[_0x74b9('0xc')](_0x74b9('0x13'),_0x17cda1,_0x36a4dc);if(_0x36a4dc==0x0){var _0x13711a=_0x325c99[_0x74b9('0x14')](/(\r\n|\n|\r)/gm,'');if(_[_0x74b9('0x15')](_0x38ab7c[0x1])||_['isEmpty'](_0x38ab7c[0x1])){logger[_0x74b9('0xc')](_0x74b9('0x16'),_0x17cda1);_0xd6af22[_0x74b9('0x17')][_0x38ab7c[0x1]]=_0x13711a;}else{logger['info'](_0x74b9('0x18'),_0x17cda1,_0x38ab7c[0x1],_0x13711a);_0xd6af22[_0x74b9('0x17')][_0x38ab7c[0x1]]=_0x13711a;}}_0x2b9a12[_0x74b9('0xe')]();});}}catch(_0x50f167){logger[_0x74b9('0x8')](_0x74b9('0x9'),_0x17cda1,_[_0x74b9('0x19')](_0x50f167)?JSON[_0x74b9('0x1a')](_0x50f167):_0x50f167);logger[_0x74b9('0xc')](_0x74b9('0xd'),_0x17cda1);_0x2b9a12[_0x74b9('0xe')]();}};}; \ 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 8b0bd5b..3b01dab 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 _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(_0x1272d7,_0x5245a1){var _0x59c93e=function(_0x27a22b){while(--_0x27a22b){_0x1272d7['push'](_0x1272d7['shift']());}};_0x59c93e(++_0x5245a1);}(_0x9957,0x93));var _0x7995=function(_0x3b380d,_0x4bf247){_0x3b380d=_0x3b380d-0x0;var _0x54502b=_0x9957[_0x3b380d];return _0x54502b;};'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 +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(_0x351554,_0x1da3ee){var _0xad6a85=function(_0x4ebbff){while(--_0x4ebbff){_0x351554['push'](_0x351554['shift']());}};_0xad6a85(++_0x1da3ee);}(_0x7a54,0x106));var _0x47a5=function(_0x43bd76,_0x4372a3){_0x43bd76=_0x43bd76-0x0;var _0x773bb=_0x7a54[_0x43bd76];return _0x773bb;};'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 diff --git a/server/services/routing/server/applications/utils.js b/server/services/routing/server/applications/utils.js index 38f8a69..3d5cf8d 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 _0xacfe=['list','exports','render','merge','body','contact','message','account','interaction'];(function(_0x18924e,_0x17bd38){var _0x3927ed=function(_0x1822ef){while(--_0x1822ef){_0x18924e['push'](_0x18924e['shift']());}};_0x3927ed(++_0x17bd38);}(_0xacfe,0xfd));var _0xeacf=function(_0xb0f7c3,_0x4eae95){_0xb0f7c3=_0xb0f7c3-0x0;var _0x28ea68=_0xacfe[_0xb0f7c3];return _0x28ea68;};'use strict';var Mustache=require('mustache');var _=require('lodash');module[_0xeacf('0x0')]={'getMustacheRender':function(_0xb5dfb5,_0x1be610){return Mustache[_0xeacf('0x1')](_0xb5dfb5,_[_0xeacf('0x2')](_0x1be610[_0xeacf('0x3')],{'contact':_0x1be610[_0xeacf('0x4')],'message':_0x1be610[_0xeacf('0x5')],'account':_0x1be610[_0xeacf('0x6')],'interaction':_0x1be610[_0xeacf('0x7')],'list':_0x1be610[_0xeacf('0x8')]}))||'';}}; \ No newline at end of file +var _0x8388=['render','merge','body','contact','message','interaction','list','mustache','lodash','exports'];(function(_0x423f48,_0x71fb9a){var _0x5ba743=function(_0xc9675f){while(--_0xc9675f){_0x423f48['push'](_0x423f48['shift']());}};_0x5ba743(++_0x71fb9a);}(_0x8388,0x18d));var _0x8838=function(_0x277af0,_0x1f0361){_0x277af0=_0x277af0-0x0;var _0x43bd7c=_0x8388[_0x277af0];return _0x43bd7c;};'use strict';var Mustache=require(_0x8838('0x0'));var _=require(_0x8838('0x1'));module[_0x8838('0x2')]={'getMustacheRender':function(_0x3666a3,_0x5307bd){return Mustache[_0x8838('0x3')](_0x3666a3,_[_0x8838('0x4')](_0x5307bd[_0x8838('0x5')],{'contact':_0x5307bd[_0x8838('0x6')],'message':_0x5307bd[_0x8838('0x7')],'account':_0x5307bd['account'],'interaction':_0x5307bd[_0x8838('0x8')],'list':_0x5307bd[_0x8838('0x9')]}))||'';}}; \ No newline at end of file diff --git a/server/services/routing/server/index.js b/server/services/routing/server/index.js index 5dc7a00..0076b93 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 _0x7275=['CurrentCapacity','updateRealtime','agent\x20not\x20found','chatQueues','available','loggedIn','name','waiting','mailQueues','paused','openchannelQueues','smsQueues','faxQueues','chatQueuesWaitingInteractions','values','mailQueuesWaitingInteractions','smsQueuesWaitingInteractions','server','http','stringify','log','Routing\x20RPC\x20server\x20listening\x20on\x20127.0.0.1:%d!','RPC\x20listening\x20on\x20port:','lodash','util','path','bluebird','uuid','../../../config/environment','routing','../rpc/openchannelQueueReport','../rpc/mailQueueReport','../rpc/chatQueueReport','../rpc/smsQueueReport','../rpc/faxQueueReport','format','%s.%s.%s','IntervalId','isNil','Intervals','map','interval','listen','rules','channel','message','interaction','applications','isArray','length','existsSync','join','.js','app','toLowerCase','push','appdata','split','amazonlex','tag','TagId','./interval','condition','intervals','Push\x20new\x20rule','on\x20interval','Please\x20create\x20a\x20new\x20file\x20under','execute','info','Applications\x20executed','matchPath','emit','complete','No\x20applications\x20to\x20execute','stack','QueueReport','update','UserId','catch','error','error\x20update\x20queue\x20report','message\x20is\x20empty','agent','agents','busy','busyQueue','end','hasOwnProperty','capacity'];(function(_0x122ef9,_0x451d2a){var _0x42fba0=function(_0x17c9d3){while(--_0x17c9d3){_0x122ef9['push'](_0x122ef9['shift']());}};_0x42fba0(++_0x451d2a);}(_0x7275,0x17b));var _0x5727=function(_0x47ec98,_0x27d17c){_0x47ec98=_0x47ec98-0x0;var _0x9535af=_0x7275[_0x47ec98];return _0x9535af;};'use strict';var _=require(_0x5727('0x0'));var util=require(_0x5727('0x1'));var path=require(_0x5727('0x2'));var fs=require('fs');var jayson=require('jayson/promise');var BPromise=require(_0x5727('0x3'));var uuid=require(_0x5727('0x4'));var config=require(_0x5727('0x5'));var logger=require('../../../config/logger')(_0x5727('0x6'));var rpc={'openchannelQueueReport':require('../rpc/openchannelQueueReport')};var rpc={'openchannelQueueReport':require(_0x5727('0x7')),'mailQueueReport':require(_0x5727('0x8')),'chatQueueReport':require(_0x5727('0x9')),'smsQueueReport':require(_0x5727('0xa')),'faxQueueReport':require(_0x5727('0xb'))};var RuleEngine=require('../lib/rule-engine');function getId(_0x4ba78e,_0x13140b,_0x1143d7){return util[_0x5727('0xc')](_0x5727('0xd'),_0x4ba78e,_0x13140b||0x0,_0x1143d7||0x0);}function getIntervals(_0x5fa41e,_0x53fbd0){var _0x24424f=[];if(!_['isNil'](_0x53fbd0[_0x5727('0xe')])&&!_[_0x5727('0xf')](_0x5fa41e[_0x53fbd0[_0x5727('0xe')]])&&!_[_0x5727('0xf')](_0x5fa41e[_0x53fbd0['IntervalId']][_0x5727('0x10')])){_0x24424f=_[_0x5727('0x11')](_0x5fa41e[_0x53fbd0[_0x5727('0xe')]]['Intervals'],_0x5727('0x12'));}else if(!_[_0x5727('0xf')](_0x53fbd0[_0x5727('0x12')])){_0x24424f=[_0x53fbd0[_0x5727('0x12')]];}return _0x24424f;}exports[_0x5727('0x13')]=function(_0x462afd){_0x462afd[_0x5727('0x14')]={};return new BPromise(function(_0xe3ad97,_0x21b9a6){var _0xe29965={'Start':function(_0x1c5071){var _0x3d0f82=this;return new Promise(function(_0x1cbfff,_0x2b3ce9){if(_0x1c5071){try{var _0x200656=[];var _0x55b77a=getId(_0x1c5071[_0x5727('0x15')],_0x1c5071[_0x5727('0x16')]?_0x1c5071[_0x5727('0x16')]['id']:0x0,_0x1c5071[_0x5727('0x17')]?_0x1c5071[_0x5727('0x17')]['id']:0x0);if(_0x1c5071[_0x5727('0x18')]&&_[_0x5727('0x19')](_0x1c5071[_0x5727('0x18')])&&_0x1c5071['applications'][_0x5727('0x1a')]){for(var _0x525954=0x0;_0x525954<_0x1c5071['applications'][_0x5727('0x1a')];_0x525954+=0x1){var _0x3030f2=_0x1c5071[_0x5727('0x18')][_0x525954];if(fs[_0x5727('0x1b')](path[_0x5727('0x1c')](__dirname,_0x5727('0x18'),_0x3030f2['app']+_0x5727('0x1d')))){var _0x24d40a=[];switch(_0x3030f2[_0x5727('0x1e')][_0x5727('0x1f')]()){case'autoreply':var _0x25286b=_0x3030f2['appdata']['split'](',');_0x24d40a[_0x5727('0x20')](_0x25286b[0x0]);_0x24d40a[_0x5727('0x20')](_0x25286b['slice'](0x1,_0x25286b['length'])[_0x5727('0x1c')](','));break;case'dialogflow':var _0x3a3e64=_0x3030f2[_0x5727('0x21')][_0x5727('0x22')](',');_0x24d40a[_0x5727('0x20')](_0x3a3e64[0x0]);_0x24d40a['push'](_0x3a3e64[0x1]);_0x24d40a[_0x5727('0x20')](_0x3a3e64['slice'](0x2,_0x3a3e64[_0x5727('0x1a')])[_0x5727('0x1c')](','));break;case _0x5727('0x23'):var _0x7c6030=_0x3030f2['appdata'][_0x5727('0x22')](',');_0x24d40a[_0x5727('0x20')](_0x7c6030[0x0]);_0x24d40a['push'](_0x7c6030[0x1]);_0x24d40a[_0x5727('0x20')](_0x7c6030[0x2]);_0x24d40a[_0x5727('0x20')](_0x7c6030[0x3]);_0x24d40a['push'](_0x7c6030['slice'](0x4,_0x7c6030[_0x5727('0x1a')])[_0x5727('0x1c')](','));break;case _0x5727('0x16'):_0x24d40a[_0x5727('0x20')](_0x3030f2[_0x5727('0x21')]);break;case _0x5727('0x24'):_0x24d40a[_0x5727('0x20')](_0x3030f2[_0x5727('0x25')]);_0x24d40a[_0x5727('0x20')](_0x3030f2[_0x5727('0x21')]);break;default:_0x24d40a=_[_0x5727('0xf')](_0x3030f2[_0x5727('0x21')])?[]:_0x3030f2['appdata'][_0x5727('0x22')](',');}var _0x249bee={'id':util[_0x5727('0xc')]('%s:%s:%s',_0x55b77a,_0x3030f2['id'],_0x3030f2['app']),'condition':require(_0x5727('0x26'))[_0x5727('0x27')](_0x55b77a,getIntervals(_0x462afd[_0x5727('0x28')],_0x3030f2),_0x462afd),'consequence':require('./applications/'+_0x3030f2['app'])['consequence'](_0x55b77a,_0x24d40a,_0x462afd,_0x1c5071),'p':_0x3030f2['priority']||0x0};logger['info'](_0x5727('0x29'),_0x249bee['id'],_0x5727('0x2a'),getIntervals(_0x462afd[_0x5727('0x28')],_0x3030f2)[_0x5727('0x1c')]('\x20|\x20'));_0x200656['push'](_0x249bee);}else{logger['error'](_0x5727('0x2b'),path[_0x5727('0x1c')](__dirname,_0x5727('0x18'),_0x3030f2[_0x5727('0x1e')]+'.js'));}}_0x462afd[_0x5727('0x14')][_0x55b77a]=new RuleEngine(_0x200656);_0x462afd[_0x5727('0x14')][_0x55b77a][_0x5727('0x2c')](_0x1c5071,function(_0xe3f95d){logger[_0x5727('0x2d')](_0x5727('0x2e'),JSON['stringify'](_0xe3f95d[_0x5727('0x2f')]));if(_0x462afd['rules'][_0x55b77a]){_0x462afd['rules'][_0x55b77a][_0x5727('0x30')](_0x5727('0x31'));}});return _0x1cbfff({'code':0xc8,'message':_0x1c5071});}else{logger['info'](_0x5727('0x32'));return _0x1cbfff({'code':0xc8,'message':_0x1c5071});}}catch(_0x50a7f0){logger['error'](_0x50a7f0[_0x5727('0x33')]);return _0x2b3ce9(_0x3d0f82['error'](0x1f4,_0x50a7f0));}}return _0x2b3ce9('routing\x20is\x20empty');});},'AcceptMessage':function(_0x2f7020){var _0x213140=this;return new Promise(function(_0x3c42be,_0x2e15cc){if(_0x2f7020['message']&&_0x2f7020[_0x5727('0x16')]['id']){try{var _0x5c6c57=getId(_0x2f7020[_0x5727('0x15')],_0x2f7020[_0x5727('0x16')]?_0x2f7020[_0x5727('0x16')]['id']:0x0,_0x2f7020[_0x5727('0x17')]?_0x2f7020[_0x5727('0x17')]['id']:0x0);if(_0x462afd[_0x5727('0x14')][_0x5c6c57]){_0x462afd['rules'][_0x5c6c57][_0x5727('0x30')]('end');if(rpc[_0x2f7020['channel']+_0x5727('0x34')]){rpc[_0x2f7020['channel']+_0x5727('0x34')][_0x5727('0x35')](_0x5c6c57,{'UserId':_0x2f7020[_0x5727('0x16')][_0x5727('0x36')]})[_0x5727('0x37')](function(_0x38afdd){logger[_0x5727('0x38')](_0x5727('0x39'));});}}return _0x3c42be({'code':0xc8,'message':_0x2f7020});}catch(_0x3dfd68){logger['error'](_0x3dfd68[_0x5727('0x33')]);return _0x2e15cc(_0x213140[_0x5727('0x38')](0x1f4,_0x3dfd68));}}logger[_0x5727('0x38')](_0x5727('0x3a'));return _0x2e15cc(_0x213140[_0x5727('0x38')](0x1f4,_0x5727('0x3a')));});},'RejectMessage':function(_0x3cb6d6){var _0x126840=this;return new Promise(function(_0x2e5d18,_0x73ed2d){if(_0x3cb6d6[_0x5727('0x3b')]&&_0x3cb6d6['agent']['id']){try{if(_0x462afd['agents'][_0x3cb6d6[_0x5727('0x3b')]['id']]){_0x462afd[_0x5727('0x3c')][_0x3cb6d6[_0x5727('0x3b')]['id']][_0x5727('0x3d')]=![];_0x462afd['agents'][_0x3cb6d6[_0x5727('0x3b')]['id']][_0x5727('0x3e')]=undefined;}return _0x2e5d18({'code':0xc8,'message':_0x3cb6d6});}catch(_0x225296){logger[_0x5727('0x38')](_0x225296[_0x5727('0x33')]);return _0x73ed2d(_0x126840[_0x5727('0x38')](0x1f4,_0x225296));}}logger[_0x5727('0x38')](_0x5727('0x3a'));return _0x73ed2d(_0x126840[_0x5727('0x38')](0x1f4,_0x5727('0x3a')));});},'AbandonInteraction':function(_0x170651){var _0x42a1bd=this;return new Promise(function(_0x22fcd7,_0x463aa4){if(_0x170651[_0x5727('0x15')]&&_0x170651[_0x5727('0x17')]&&_0x170651['interaction']['id']){try{var _0x4ab4cc=getId(_0x170651[_0x5727('0x15')],_0x170651['message']?_0x170651['message']['id']:0x0,_0x170651[_0x5727('0x17')]?_0x170651['interaction']['id']:0x0);if(_0x462afd[_0x5727('0x14')][_0x4ab4cc]){_0x462afd[_0x5727('0x14')][_0x4ab4cc][_0x5727('0x30')](_0x5727('0x3f'));}return _0x22fcd7({'code':0xc8,'message':_0x170651});}catch(_0x46e2b9){logger[_0x5727('0x38')](_0x46e2b9[_0x5727('0x33')]);return _0x463aa4(_0x42a1bd[_0x5727('0x38')](0x1f4,_0x46e2b9));}}logger[_0x5727('0x38')](_0x5727('0x3a'));return _0x463aa4(_0x42a1bd[_0x5727('0x38')](0x1f4,_0x5727('0x3a')));});},'AgentCapacity':function(_0x19c622){var _0x122fb9=this;return new Promise(function(_0x3d1e3a,_0x4a5667){if(_0x462afd[_0x5727('0x3c')][_0x5727('0x40')](_0x19c622['id'])){for(var _0x1010b2 in _0x19c622[_0x5727('0x41')]){if(_0x19c622[_0x5727('0x41')][_0x5727('0x40')](_0x1010b2)){if(_0x462afd[_0x5727('0x3c')][_0x19c622['id']][_0x5727('0x40')](_0x1010b2+'CurrentCapacity')){_0x462afd[_0x5727('0x3c')][_0x19c622['id']][_0x1010b2+_0x5727('0x42')]=parseInt(_0x19c622[_0x5727('0x41')][_0x1010b2],0xa);}}}_0x462afd['agents'][_0x19c622['id']][_0x5727('0x43')]();return _0x3d1e3a({'code':0xc8,'message':_0x462afd['agents'][_0x19c622['id']]});}else{return _0x4a5667(_0x122fb9['error'](0x1f4,_0x5727('0x44')));}});},'Agents':function(_0x3188fe){return new Promise(function(_0x449abc,_0x579902){var _0xa35d94=_['values'](_0x462afd['agents']);_0x449abc({'count':_0xa35d94[_0x5727('0x1a')],'rows':_0xa35d94});});},'ChatQueues':function(_0x4fa0bb){return new Promise(function(_0x949a76,_0x262027){var _0x1449f8=[];for(var _0x923157 in _0x462afd[_0x5727('0x45')]){if(_0x462afd['chatQueues'][_0x5727('0x40')](_0x923157)){var _0x9562=_0x462afd[_0x5727('0x45')][_0x923157];var _0x5f1107={'id':_0x9562['id'],'available':_0x9562[_0x5727('0x46')],'loggedIn':_0x9562[_0x5727('0x47')],'name':_0x9562[_0x5727('0x48')],'paused':_0x9562['paused'],'waiting':_0x9562[_0x5727('0x49')]};_0x1449f8[_0x5727('0x20')](_0x5f1107);}}_0x949a76({'count':_0x1449f8[_0x5727('0x1a')],'rows':_0x1449f8});});},'MailQueues':function(_0x18d992){return new Promise(function(_0x211ad5,_0x47cf67){var _0x5f37f9=[];for(var _0x411080 in _0x462afd[_0x5727('0x4a')]){if(_0x462afd[_0x5727('0x4a')]['hasOwnProperty'](_0x411080)){var _0x8fa91e=_0x462afd['mailQueues'][_0x411080];var _0x44c2ef={'id':_0x8fa91e['id'],'available':_0x8fa91e[_0x5727('0x46')],'loggedIn':_0x8fa91e[_0x5727('0x47')],'name':_0x8fa91e[_0x5727('0x48')],'paused':_0x8fa91e[_0x5727('0x4b')],'waiting':_0x8fa91e[_0x5727('0x49')]};_0x5f37f9['push'](_0x44c2ef);}}_0x211ad5({'count':_0x5f37f9[_0x5727('0x1a')],'rows':_0x5f37f9});});},'OpenchannelQueues':function(_0x70b966){return new Promise(function(_0x2b0c0d,_0x4cda7d){var _0x27f2fa=[];for(var _0x5a7384 in _0x462afd[_0x5727('0x4c')]){if(_0x462afd[_0x5727('0x4c')]['hasOwnProperty'](_0x5a7384)){var _0x413a54=_0x462afd[_0x5727('0x4c')][_0x5a7384];var _0x3519bc={'id':_0x413a54['id'],'available':_0x413a54[_0x5727('0x46')],'loggedIn':_0x413a54[_0x5727('0x47')],'name':_0x413a54['name'],'paused':_0x413a54[_0x5727('0x4b')],'waiting':_0x413a54[_0x5727('0x49')]};_0x27f2fa[_0x5727('0x20')](_0x3519bc);}}_0x2b0c0d({'count':_0x27f2fa[_0x5727('0x1a')],'rows':_0x27f2fa});});},'SmsQueues':function(_0x21427a){return new Promise(function(_0x426458,_0x2d9763){var _0x40fade=[];for(var _0x35fe36 in _0x462afd[_0x5727('0x4d')]){if(_0x462afd[_0x5727('0x4d')][_0x5727('0x40')](_0x35fe36)){var _0x3461dd=_0x462afd[_0x5727('0x4d')][_0x35fe36];var _0x3fe1c3={'id':_0x3461dd['id'],'available':_0x3461dd[_0x5727('0x46')],'loggedIn':_0x3461dd[_0x5727('0x47')],'name':_0x3461dd[_0x5727('0x48')],'paused':_0x3461dd[_0x5727('0x4b')],'waiting':_0x3461dd[_0x5727('0x49')]};_0x40fade['push'](_0x3fe1c3);}}_0x426458({'count':_0x40fade[_0x5727('0x1a')],'rows':_0x40fade});});},'FaxQueues':function(_0x1893b8){return new Promise(function(_0x49784e,_0x371c52){var _0x4b15ca=[];for(var _0x2dac3a in _0x462afd[_0x5727('0x4e')]){if(_0x462afd['faxQueues'][_0x5727('0x40')](_0x2dac3a)){var _0xc2448c=_0x462afd[_0x5727('0x4e')][_0x2dac3a];var _0x2b3540={'id':_0xc2448c['id'],'available':_0xc2448c[_0x5727('0x46')],'loggedIn':_0xc2448c[_0x5727('0x47')],'name':_0xc2448c[_0x5727('0x48')],'paused':_0xc2448c[_0x5727('0x4b')],'waiting':_0xc2448c[_0x5727('0x49')]};_0x4b15ca[_0x5727('0x20')](_0x2b3540);}}_0x49784e({'count':_0x4b15ca[_0x5727('0x1a')],'rows':_0x4b15ca});});},'ChatQueuesWaitingInteractions':function(_0xe71cda){return new Promise(function(_0x5c5cad,_0x1780ec){var _0x132851=_['values'](_0x462afd[_0x5727('0x4f')]);_0x5c5cad({'count':_0x132851[_0x5727('0x1a')],'rows':_0x132851});});},'MailQueuesWaitingInteractions':function(_0x457ca8){return new Promise(function(_0x350161,_0xbd065){var _0x3b9745=_[_0x5727('0x50')](_0x462afd[_0x5727('0x51')]);_0x350161({'count':_0x3b9745['length'],'rows':_0x3b9745});});},'OpenchannelQueuesWaitingInteractions':function(_0x48c3b6){return new Promise(function(_0x19b938,_0x5b7b4a){var _0x19b36f=_[_0x5727('0x50')](_0x462afd['openchannelQueuesWaitingInteractions']);_0x19b938({'count':_0x19b36f['length'],'rows':_0x19b36f});});},'SmsQueuesWaitingInteractions':function(_0x4f4e54){return new Promise(function(_0x593888,_0x2d661b){var _0x562d22=_[_0x5727('0x50')](_0x462afd[_0x5727('0x52')]);_0x593888({'count':_0x562d22[_0x5727('0x1a')],'rows':_0x562d22});});},'FaxQueuesWaitingInteractions':function(_0x414157){return new Promise(function(_0x5478ba,_0x3f4257){var _0x38717f=_[_0x5727('0x50')](_0x462afd['faxQueuesWaitingInteractions']);_0x5478ba({'count':_0x38717f[_0x5727('0x1a')],'rows':_0x38717f});});}};var _0x3c928b=jayson[_0x5727('0x53')](_0xe29965)[_0x5727('0x54')]();_0x3c928b['on'](_0x5727('0x38'),function(_0x17e022){logger[_0x5727('0x38')](JSON[_0x5727('0x55')](_0x17e022));return _0x21b9a6(_0x17e022);});_0x3c928b[_0x5727('0x13')](0x232c,'127.0.0.1',function(){console[_0x5727('0x56')](_0x5727('0x57'),0x232c);return _0xe3ad97(_0x5727('0x58')+0x232c);});});}; \ No newline at end of file +var _0x174d=['slice','join','dialogflow','amazonlex','tag','format','%s:%s:%s','./interval','intervals','info','Push\x20new\x20rule','\x20|\x20','Please\x20create\x20a\x20new\x20file\x20under','stringify','matchPath','emit','complete','No\x20applications\x20to\x20execute','error','end','QueueReport','update','catch','stack','message\x20is\x20empty','agent','agents','busy','busyQueue','hasOwnProperty','capacity','CurrentCapacity','agent\x20not\x20found','chatQueues','available','loggedIn','name','waiting','mailQueues','paused','openchannelQueues','smsQueues','faxQueues','values','chatQueuesWaitingInteractions','mailQueuesWaitingInteractions','openchannelQueuesWaitingInteractions','smsQueuesWaitingInteractions','faxQueuesWaitingInteractions','server','http','127.0.0.1','log','RPC\x20listening\x20on\x20port:','lodash','bluebird','uuid','../../../config/environment','routing','../rpc/openchannelQueueReport','../rpc/mailQueueReport','../rpc/smsQueueReport','../rpc/faxQueueReport','../lib/rule-engine','%s.%s.%s','isNil','IntervalId','Intervals','map','interval','listen','rules','channel','message','interaction','applications','isArray','length','existsSync','app','.js','toLowerCase','autoreply','appdata','split','push'];(function(_0xa94b03,_0x53da24){var _0x1e4eda=function(_0x3ad2a1){while(--_0x3ad2a1){_0xa94b03['push'](_0xa94b03['shift']());}};_0x1e4eda(++_0x53da24);}(_0x174d,0x138));var _0xd174=function(_0x432864,_0x2bfb80){_0x432864=_0x432864-0x0;var _0x1bb0a8=_0x174d[_0x432864];return _0x1bb0a8;};'use strict';var _=require(_0xd174('0x0'));var util=require('util');var path=require('path');var fs=require('fs');var jayson=require('jayson/promise');var BPromise=require(_0xd174('0x1'));var uuid=require(_0xd174('0x2'));var config=require(_0xd174('0x3'));var logger=require('../../../config/logger')(_0xd174('0x4'));var rpc={'openchannelQueueReport':require(_0xd174('0x5'))};var rpc={'openchannelQueueReport':require('../rpc/openchannelQueueReport'),'mailQueueReport':require(_0xd174('0x6')),'chatQueueReport':require('../rpc/chatQueueReport'),'smsQueueReport':require(_0xd174('0x7')),'faxQueueReport':require(_0xd174('0x8'))};var RuleEngine=require(_0xd174('0x9'));function getId(_0x22ae7f,_0x771184,_0x368ebd){return util['format'](_0xd174('0xa'),_0x22ae7f,_0x771184||0x0,_0x368ebd||0x0);}function getIntervals(_0x4c6806,_0x138f9b){var _0x2ff5d7=[];if(!_[_0xd174('0xb')](_0x138f9b[_0xd174('0xc')])&&!_[_0xd174('0xb')](_0x4c6806[_0x138f9b['IntervalId']])&&!_[_0xd174('0xb')](_0x4c6806[_0x138f9b['IntervalId']][_0xd174('0xd')])){_0x2ff5d7=_[_0xd174('0xe')](_0x4c6806[_0x138f9b['IntervalId']]['Intervals'],_0xd174('0xf'));}else if(!_[_0xd174('0xb')](_0x138f9b['interval'])){_0x2ff5d7=[_0x138f9b[_0xd174('0xf')]];}return _0x2ff5d7;}exports[_0xd174('0x10')]=function(_0x918c36){_0x918c36[_0xd174('0x11')]={};return new BPromise(function(_0x86d9b,_0xeb1520){var _0x1a2f9c={'Start':function(_0x39454e){var _0x68dd68=this;return new Promise(function(_0x196952,_0xdb0c57){if(_0x39454e){try{var _0x268624=[];var _0x449d03=getId(_0x39454e[_0xd174('0x12')],_0x39454e[_0xd174('0x13')]?_0x39454e[_0xd174('0x13')]['id']:0x0,_0x39454e[_0xd174('0x14')]?_0x39454e[_0xd174('0x14')]['id']:0x0);if(_0x39454e[_0xd174('0x15')]&&_[_0xd174('0x16')](_0x39454e[_0xd174('0x15')])&&_0x39454e[_0xd174('0x15')][_0xd174('0x17')]){for(var _0x3f258d=0x0;_0x3f258d<_0x39454e[_0xd174('0x15')][_0xd174('0x17')];_0x3f258d+=0x1){var _0x48d699=_0x39454e['applications'][_0x3f258d];if(fs[_0xd174('0x18')](path['join'](__dirname,_0xd174('0x15'),_0x48d699[_0xd174('0x19')]+_0xd174('0x1a')))){var _0x4ba2a4=[];switch(_0x48d699[_0xd174('0x19')][_0xd174('0x1b')]()){case _0xd174('0x1c'):var _0xef5b30=_0x48d699[_0xd174('0x1d')][_0xd174('0x1e')](',');_0x4ba2a4[_0xd174('0x1f')](_0xef5b30[0x0]);_0x4ba2a4[_0xd174('0x1f')](_0xef5b30[_0xd174('0x20')](0x1,_0xef5b30[_0xd174('0x17')])[_0xd174('0x21')](','));break;case _0xd174('0x22'):var _0x229ad5=_0x48d699[_0xd174('0x1d')][_0xd174('0x1e')](',');_0x4ba2a4['push'](_0x229ad5[0x0]);_0x4ba2a4[_0xd174('0x1f')](_0x229ad5[0x1]);_0x4ba2a4[_0xd174('0x1f')](_0x229ad5['slice'](0x2,_0x229ad5[_0xd174('0x17')])[_0xd174('0x21')](','));break;case _0xd174('0x23'):var _0x1637ab=_0x48d699[_0xd174('0x1d')]['split'](',');_0x4ba2a4['push'](_0x1637ab[0x0]);_0x4ba2a4['push'](_0x1637ab[0x1]);_0x4ba2a4['push'](_0x1637ab[0x2]);_0x4ba2a4[_0xd174('0x1f')](_0x1637ab[0x3]);_0x4ba2a4[_0xd174('0x1f')](_0x1637ab[_0xd174('0x20')](0x4,_0x1637ab['length'])['join'](','));break;case _0xd174('0x13'):_0x4ba2a4[_0xd174('0x1f')](_0x48d699[_0xd174('0x1d')]);break;case _0xd174('0x24'):_0x4ba2a4[_0xd174('0x1f')](_0x48d699['TagId']);_0x4ba2a4[_0xd174('0x1f')](_0x48d699[_0xd174('0x1d')]);break;default:_0x4ba2a4=_[_0xd174('0xb')](_0x48d699[_0xd174('0x1d')])?[]:_0x48d699[_0xd174('0x1d')]['split'](',');}var _0x575a82={'id':util[_0xd174('0x25')](_0xd174('0x26'),_0x449d03,_0x48d699['id'],_0x48d699[_0xd174('0x19')]),'condition':require(_0xd174('0x27'))['condition'](_0x449d03,getIntervals(_0x918c36[_0xd174('0x28')],_0x48d699),_0x918c36),'consequence':require('./applications/'+_0x48d699['app'])['consequence'](_0x449d03,_0x4ba2a4,_0x918c36,_0x39454e),'p':_0x48d699['priority']||0x0};logger[_0xd174('0x29')](_0xd174('0x2a'),_0x575a82['id'],'on\x20interval',getIntervals(_0x918c36['intervals'],_0x48d699)[_0xd174('0x21')](_0xd174('0x2b')));_0x268624[_0xd174('0x1f')](_0x575a82);}else{logger['error'](_0xd174('0x2c'),path[_0xd174('0x21')](__dirname,'applications',_0x48d699[_0xd174('0x19')]+_0xd174('0x1a')));}}_0x918c36[_0xd174('0x11')][_0x449d03]=new RuleEngine(_0x268624);_0x918c36[_0xd174('0x11')][_0x449d03]['execute'](_0x39454e,function(_0x2843d8){logger['info']('Applications\x20executed',JSON[_0xd174('0x2d')](_0x2843d8[_0xd174('0x2e')]));if(_0x918c36[_0xd174('0x11')][_0x449d03]){_0x918c36['rules'][_0x449d03][_0xd174('0x2f')](_0xd174('0x30'));}});return _0x196952({'code':0xc8,'message':_0x39454e});}else{logger[_0xd174('0x29')](_0xd174('0x31'));return _0x196952({'code':0xc8,'message':_0x39454e});}}catch(_0x219025){logger[_0xd174('0x32')](_0x219025['stack']);return _0xdb0c57(_0x68dd68['error'](0x1f4,_0x219025));}}return _0xdb0c57('routing\x20is\x20empty');});},'AcceptMessage':function(_0x4ae887){var _0x58c325=this;return new Promise(function(_0x35162d,_0x2d918d){if(_0x4ae887['message']&&_0x4ae887[_0xd174('0x13')]['id']){try{var _0x5f539f=getId(_0x4ae887[_0xd174('0x12')],_0x4ae887['message']?_0x4ae887['message']['id']:0x0,_0x4ae887[_0xd174('0x14')]?_0x4ae887['interaction']['id']:0x0);if(_0x918c36['rules'][_0x5f539f]){_0x918c36['rules'][_0x5f539f][_0xd174('0x2f')](_0xd174('0x33'));if(rpc[_0x4ae887[_0xd174('0x12')]+_0xd174('0x34')]){rpc[_0x4ae887['channel']+_0xd174('0x34')][_0xd174('0x35')](_0x5f539f,{'UserId':_0x4ae887[_0xd174('0x13')]['UserId']})[_0xd174('0x36')](function(_0x5ea6ff){logger[_0xd174('0x32')]('error\x20update\x20queue\x20report');});}}return _0x35162d({'code':0xc8,'message':_0x4ae887});}catch(_0x459fe4){logger['error'](_0x459fe4[_0xd174('0x37')]);return _0x2d918d(_0x58c325['error'](0x1f4,_0x459fe4));}}logger['error'](_0xd174('0x38'));return _0x2d918d(_0x58c325[_0xd174('0x32')](0x1f4,_0xd174('0x38')));});},'RejectMessage':function(_0x5b4c13){var _0x58b78c=this;return new Promise(function(_0x46bce7,_0x307459){if(_0x5b4c13[_0xd174('0x39')]&&_0x5b4c13[_0xd174('0x39')]['id']){try{if(_0x918c36[_0xd174('0x3a')][_0x5b4c13[_0xd174('0x39')]['id']]){_0x918c36[_0xd174('0x3a')][_0x5b4c13[_0xd174('0x39')]['id']][_0xd174('0x3b')]=![];_0x918c36[_0xd174('0x3a')][_0x5b4c13[_0xd174('0x39')]['id']][_0xd174('0x3c')]=undefined;}return _0x46bce7({'code':0xc8,'message':_0x5b4c13});}catch(_0x7470f3){logger['error'](_0x7470f3[_0xd174('0x37')]);return _0x307459(_0x58b78c[_0xd174('0x32')](0x1f4,_0x7470f3));}}logger[_0xd174('0x32')](_0xd174('0x38'));return _0x307459(_0x58b78c[_0xd174('0x32')](0x1f4,'message\x20is\x20empty'));});},'AbandonInteraction':function(_0xe08054){var _0x26aa3a=this;return new Promise(function(_0x4cd1b6,_0x3eb8ca){if(_0xe08054[_0xd174('0x12')]&&_0xe08054[_0xd174('0x14')]&&_0xe08054[_0xd174('0x14')]['id']){try{var _0x2a4e1a=getId(_0xe08054[_0xd174('0x12')],_0xe08054[_0xd174('0x13')]?_0xe08054[_0xd174('0x13')]['id']:0x0,_0xe08054['interaction']?_0xe08054[_0xd174('0x14')]['id']:0x0);if(_0x918c36[_0xd174('0x11')][_0x2a4e1a]){_0x918c36[_0xd174('0x11')][_0x2a4e1a][_0xd174('0x2f')](_0xd174('0x33'));}return _0x4cd1b6({'code':0xc8,'message':_0xe08054});}catch(_0x337122){logger[_0xd174('0x32')](_0x337122[_0xd174('0x37')]);return _0x3eb8ca(_0x26aa3a['error'](0x1f4,_0x337122));}}logger[_0xd174('0x32')](_0xd174('0x38'));return _0x3eb8ca(_0x26aa3a[_0xd174('0x32')](0x1f4,_0xd174('0x38')));});},'AgentCapacity':function(_0x351e69){var _0x196e52=this;return new Promise(function(_0x2fb3e4,_0x13d5da){if(_0x918c36[_0xd174('0x3a')][_0xd174('0x3d')](_0x351e69['id'])){for(var _0x5daade in _0x351e69[_0xd174('0x3e')]){if(_0x351e69['capacity']['hasOwnProperty'](_0x5daade)){if(_0x918c36[_0xd174('0x3a')][_0x351e69['id']][_0xd174('0x3d')](_0x5daade+'CurrentCapacity')){_0x918c36[_0xd174('0x3a')][_0x351e69['id']][_0x5daade+_0xd174('0x3f')]=parseInt(_0x351e69[_0xd174('0x3e')][_0x5daade],0xa);}}}_0x918c36[_0xd174('0x3a')][_0x351e69['id']]['updateRealtime']();return _0x2fb3e4({'code':0xc8,'message':_0x918c36[_0xd174('0x3a')][_0x351e69['id']]});}else{return _0x13d5da(_0x196e52[_0xd174('0x32')](0x1f4,_0xd174('0x40')));}});},'Agents':function(_0x53448f){return new Promise(function(_0x304c81,_0x72614d){var _0x3b14bc=_['values'](_0x918c36[_0xd174('0x3a')]);_0x304c81({'count':_0x3b14bc[_0xd174('0x17')],'rows':_0x3b14bc});});},'ChatQueues':function(_0x1e5a62){return new Promise(function(_0x465692,_0x3f6bbd){var _0x261f52=[];for(var _0x496477 in _0x918c36[_0xd174('0x41')]){if(_0x918c36[_0xd174('0x41')][_0xd174('0x3d')](_0x496477)){var _0xdeceb9=_0x918c36[_0xd174('0x41')][_0x496477];var _0x53e97d={'id':_0xdeceb9['id'],'available':_0xdeceb9[_0xd174('0x42')],'loggedIn':_0xdeceb9[_0xd174('0x43')],'name':_0xdeceb9[_0xd174('0x44')],'paused':_0xdeceb9['paused'],'waiting':_0xdeceb9[_0xd174('0x45')]};_0x261f52[_0xd174('0x1f')](_0x53e97d);}}_0x465692({'count':_0x261f52[_0xd174('0x17')],'rows':_0x261f52});});},'MailQueues':function(_0x304b61){return new Promise(function(_0x462b03,_0x48114f){var _0x3b8cfb=[];for(var _0x388859 in _0x918c36[_0xd174('0x46')]){if(_0x918c36[_0xd174('0x46')][_0xd174('0x3d')](_0x388859)){var _0x338e1d=_0x918c36[_0xd174('0x46')][_0x388859];var _0x44d1a7={'id':_0x338e1d['id'],'available':_0x338e1d['available'],'loggedIn':_0x338e1d[_0xd174('0x43')],'name':_0x338e1d['name'],'paused':_0x338e1d[_0xd174('0x47')],'waiting':_0x338e1d[_0xd174('0x45')]};_0x3b8cfb[_0xd174('0x1f')](_0x44d1a7);}}_0x462b03({'count':_0x3b8cfb['length'],'rows':_0x3b8cfb});});},'OpenchannelQueues':function(_0x5caa52){return new Promise(function(_0x415845,_0x481c99){var _0x5e8df8=[];for(var _0x1a71da in _0x918c36[_0xd174('0x48')]){if(_0x918c36[_0xd174('0x48')][_0xd174('0x3d')](_0x1a71da)){var _0x2b1e5e=_0x918c36[_0xd174('0x48')][_0x1a71da];var _0x44b064={'id':_0x2b1e5e['id'],'available':_0x2b1e5e[_0xd174('0x42')],'loggedIn':_0x2b1e5e[_0xd174('0x43')],'name':_0x2b1e5e[_0xd174('0x44')],'paused':_0x2b1e5e['paused'],'waiting':_0x2b1e5e['waiting']};_0x5e8df8[_0xd174('0x1f')](_0x44b064);}}_0x415845({'count':_0x5e8df8[_0xd174('0x17')],'rows':_0x5e8df8});});},'SmsQueues':function(_0x483849){return new Promise(function(_0x1ee899,_0x483f4f){var _0x554768=[];for(var _0x23a7d9 in _0x918c36[_0xd174('0x49')]){if(_0x918c36[_0xd174('0x49')]['hasOwnProperty'](_0x23a7d9)){var _0x35bf05=_0x918c36[_0xd174('0x49')][_0x23a7d9];var _0x1e3d8f={'id':_0x35bf05['id'],'available':_0x35bf05[_0xd174('0x42')],'loggedIn':_0x35bf05[_0xd174('0x43')],'name':_0x35bf05[_0xd174('0x44')],'paused':_0x35bf05[_0xd174('0x47')],'waiting':_0x35bf05[_0xd174('0x45')]};_0x554768['push'](_0x1e3d8f);}}_0x1ee899({'count':_0x554768[_0xd174('0x17')],'rows':_0x554768});});},'FaxQueues':function(_0x2ff4cd){return new Promise(function(_0x20a23e,_0x15259a){var _0x5b13fe=[];for(var _0x17a2bc in _0x918c36[_0xd174('0x4a')]){if(_0x918c36[_0xd174('0x4a')][_0xd174('0x3d')](_0x17a2bc)){var _0x4950ba=_0x918c36[_0xd174('0x4a')][_0x17a2bc];var _0xfe89b3={'id':_0x4950ba['id'],'available':_0x4950ba[_0xd174('0x42')],'loggedIn':_0x4950ba[_0xd174('0x43')],'name':_0x4950ba[_0xd174('0x44')],'paused':_0x4950ba['paused'],'waiting':_0x4950ba[_0xd174('0x45')]};_0x5b13fe['push'](_0xfe89b3);}}_0x20a23e({'count':_0x5b13fe[_0xd174('0x17')],'rows':_0x5b13fe});});},'ChatQueuesWaitingInteractions':function(_0xc445ba){return new Promise(function(_0x40ddbd,_0x746d10){var _0x400eab=_[_0xd174('0x4b')](_0x918c36[_0xd174('0x4c')]);_0x40ddbd({'count':_0x400eab[_0xd174('0x17')],'rows':_0x400eab});});},'MailQueuesWaitingInteractions':function(_0x8e0a6e){return new Promise(function(_0x2ab250,_0x52cadc){var _0x3a02ed=_[_0xd174('0x4b')](_0x918c36[_0xd174('0x4d')]);_0x2ab250({'count':_0x3a02ed['length'],'rows':_0x3a02ed});});},'OpenchannelQueuesWaitingInteractions':function(_0x2f0e81){return new Promise(function(_0x1e5b33,_0x4b3689){var _0xb4a4=_[_0xd174('0x4b')](_0x918c36[_0xd174('0x4e')]);_0x1e5b33({'count':_0xb4a4['length'],'rows':_0xb4a4});});},'SmsQueuesWaitingInteractions':function(_0x1f4a95){return new Promise(function(_0x1c458a,_0xb82237){var _0x435d26=_[_0xd174('0x4b')](_0x918c36[_0xd174('0x4f')]);_0x1c458a({'count':_0x435d26['length'],'rows':_0x435d26});});},'FaxQueuesWaitingInteractions':function(_0x53ee3f){return new Promise(function(_0x2b224a,_0xed9779){var _0x17c920=_[_0xd174('0x4b')](_0x918c36[_0xd174('0x50')]);_0x2b224a({'count':_0x17c920['length'],'rows':_0x17c920});});}};var _0x38e3dc=jayson[_0xd174('0x51')](_0x1a2f9c)[_0xd174('0x52')]();_0x38e3dc['on']('error',function(_0x2761b1){logger[_0xd174('0x32')](JSON['stringify'](_0x2761b1));return _0xeb1520(_0x2761b1);});_0x38e3dc[_0xd174('0x10')](0x232c,_0xd174('0x53'),function(){console[_0xd174('0x54')]('Routing\x20RPC\x20server\x20listening\x20on\x20127.0.0.1:%d!',0x232c);return _0x86d9b(_0xd174('0x55')+0x232c);});});}; \ No newline at end of file diff --git a/server/services/routing/server/interval.js b/server/services/routing/server/interval.js index 8fdaf13..ad04c7c 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 _0x8703=['http','request','then','error','message','catch','condition','rules','[%s][INTERVAL]\x20ROUTING\x20STOPPED','stop','length','push','Command','iftime\x20%s','indexOf','true','[%s][INTERVAL]\x20%s','all','some','info','[%s][INTERVAL]\x20%s\x20%s','join','\x20|\x20','when','log','stack','util','bluebird','jayson/promise','lodash','../../../config/logger','routing'];(function(_0x1f1e8f,_0x3f1a4c){var _0x957d91=function(_0x48031d){while(--_0x48031d){_0x1f1e8f['push'](_0x1f1e8f['shift']());}};_0x957d91(++_0x3f1a4c);}(_0x8703,0x15a));var _0x3870=function(_0x44652a,_0xbb64fc){_0x44652a=_0x44652a-0x0;var _0x48d8cd=_0x8703[_0x44652a];return _0x48d8cd;};'use strict';var util=require(_0x3870('0x0'));var BPromise=require(_0x3870('0x1'));var jayson=require(_0x3870('0x2'));var _=require(_0x3870('0x3'));var logger=require(_0x3870('0x4'))(_0x3870('0x5'));var client=jayson['client'][_0x3870('0x6')]({'port':0x232a});function request(_0x2cd777,_0x2d93a6){return new BPromise(function(_0x223a37,_0x10b36b){return client[_0x3870('0x7')](_0x2cd777,_0x2d93a6)[_0x3870('0x8')](function(_0x3d7b93){if(_0x3d7b93[_0x3870('0x9')]){return _0x10b36b(_0x3d7b93[_0x3870('0x9')][_0x3870('0xa')]);}else{return _0x223a37(_0x3d7b93['result']);}})[_0x3870('0xb')](function(_0x23a92e){return _0x10b36b(_0x23a92e);});});}exports[_0x3870('0xc')]=function(_0x22fd7e,_0x456c33,_0x1dfd3e){return function(_0x516a63){if(_0x1dfd3e[_0x3870('0xd')]&&!_0x1dfd3e[_0x3870('0xd')][_0x22fd7e]){logger['info'](_0x3870('0xe'),_0x22fd7e);return _0x516a63[_0x3870('0xf')]();}var _0x515426=[];for(var _0x4f3bcd=0x0;_0x4f3bcd<_0x456c33[_0x3870('0x10')];_0x4f3bcd+=0x1){_0x515426[_0x3870('0x11')](request(_0x3870('0x12'),{'command':util['format'](_0x3870('0x13'),_0x456c33[_0x4f3bcd])})[_0x3870('0x8')](function(_0x3fc43f){return _0x3fc43f&&_0x3fc43f[_0x3870('0xa')]&&_0x3fc43f[_0x3870('0xa')][_0x3870('0x14')](_0x3870('0x15'))>=0x0?!![]:![];})[_0x3870('0xb')](function(_0xa7657e){logger[_0x3870('0x9')](_0x3870('0x16'),_0x22fd7e,_0x456c33[_0x4f3bcd]);}));}BPromise[_0x3870('0x17')](_0x515426)[_0x3870('0x8')](function(_0x205c88){var _0x4bfae4=_[_0x3870('0x18')](_0x205c88);logger[_0x3870('0x19')](_0x3870('0x1a'),_0x22fd7e,_0x456c33[_0x3870('0x1b')](_0x3870('0x1c')),_0x4bfae4);_0x516a63[_0x3870('0x1d')](_0x4bfae4);})['catch'](function(_0x2ac763){console[_0x3870('0x1e')](_0x2ac763);logger['error'](_0x3870('0x1a'),_0x22fd7e,_0x456c33[_0x3870('0x1b')]('\x20|\x20'),_0x2ac763[_0x3870('0x1f')]);_0x516a63[_0x3870('0xf')]();});};}; \ No newline at end of file +var _0x2376=['client','error','message','result','catch','condition','rules','info','[%s][INTERVAL]\x20ROUTING\x20STOPPED','length','push','format','iftime\x20%s','true','[%s][INTERVAL]\x20%s','then','some','join','\x20|\x20','log','[%s][INTERVAL]\x20%s\x20%s','stack','stop','util','bluebird','jayson/promise','lodash','routing'];(function(_0x4b055c,_0x4b870b){var _0x4b62bb=function(_0x4884c2){while(--_0x4884c2){_0x4b055c['push'](_0x4b055c['shift']());}};_0x4b62bb(++_0x4b870b);}(_0x2376,0xbf));var _0x6237=function(_0x27defa,_0x3102b0){_0x27defa=_0x27defa-0x0;var _0x50d817=_0x2376[_0x27defa];return _0x50d817;};'use strict';var util=require(_0x6237('0x0'));var BPromise=require(_0x6237('0x1'));var jayson=require(_0x6237('0x2'));var _=require(_0x6237('0x3'));var logger=require('../../../config/logger')(_0x6237('0x4'));var client=jayson[_0x6237('0x5')]['http']({'port':0x232a});function request(_0x344854,_0x2d019c){return new BPromise(function(_0x3af381,_0x2bc24b){return client['request'](_0x344854,_0x2d019c)['then'](function(_0x5491f3){if(_0x5491f3[_0x6237('0x6')]){return _0x2bc24b(_0x5491f3['error'][_0x6237('0x7')]);}else{return _0x3af381(_0x5491f3[_0x6237('0x8')]);}})[_0x6237('0x9')](function(_0x557c1c){return _0x2bc24b(_0x557c1c);});});}exports[_0x6237('0xa')]=function(_0x1a3ab0,_0x389e4d,_0x3e2143){return function(_0x214680){if(_0x3e2143[_0x6237('0xb')]&&!_0x3e2143['rules'][_0x1a3ab0]){logger[_0x6237('0xc')](_0x6237('0xd'),_0x1a3ab0);return _0x214680['stop']();}var _0x354be7=[];for(var _0x45cc79=0x0;_0x45cc79<_0x389e4d[_0x6237('0xe')];_0x45cc79+=0x1){_0x354be7[_0x6237('0xf')](request('Command',{'command':util[_0x6237('0x10')](_0x6237('0x11'),_0x389e4d[_0x45cc79])})['then'](function(_0x43dba2){return _0x43dba2&&_0x43dba2[_0x6237('0x7')]&&_0x43dba2[_0x6237('0x7')]['indexOf'](_0x6237('0x12'))>=0x0?!![]:![];})[_0x6237('0x9')](function(_0x1c2f1d){logger['error'](_0x6237('0x13'),_0x1a3ab0,_0x389e4d[_0x45cc79]);}));}BPromise['all'](_0x354be7)[_0x6237('0x14')](function(_0x456097){var _0x466362=_[_0x6237('0x15')](_0x456097);logger['info']('[%s][INTERVAL]\x20%s\x20%s',_0x1a3ab0,_0x389e4d[_0x6237('0x16')](_0x6237('0x17')),_0x466362);_0x214680['when'](_0x466362);})['catch'](function(_0xf82c95){console[_0x6237('0x18')](_0xf82c95);logger[_0x6237('0x6')](_0x6237('0x19'),_0x1a3ab0,_0x389e4d['join'](_0x6237('0x17')),_0xf82c95[_0x6237('0x1a')]);_0x214680[_0x6237('0x1b')]();});};}; \ No newline at end of file diff --git a/server/services/xdr/agents.controller.js b/server/services/xdr/agents.controller.js index 01422d8..af802c1 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 _0x1c3d=['connectedlinename','error','stack','agentringnoanswer','isNil','agentringnoanswerAt','timeout','reason','holdtime','ringtime','talktime','queuecallerabandon','forIn','abandoned','agentconnect','agentconnectAt','connect','answered_elsewhere','answeredelsewheredestinationuniqueid','answeredelsewheremembername','agentcomplete','agentcompleteAt','complete','transfereruniqueid','transfer','transfertype','transferexten','transferuniqueid','attendedtransfer','origtransfereruniqueid','origtransfererlinkedid','secondtransfereruniqueid','origtransfererexten','transfereeuniqueid','agententerreason','calleridname','agentcalledAt','ATTENDED','secondtransfererexten','transfertargetuniqueid','clone','hangup','agent','diffTime','util','./utils','info','uniqueid','channel','queue','membername','interface','calleridnum','lastevent','then','type','acw','acwtime','agentacw','acwTimeout','request','CreateVoiceAgentReport','agentcalled','destuniqueid','now','connectedlinenum'];(function(_0x40bda6,_0xf148f8){var _0x49560c=function(_0x16bb35){while(--_0x16bb35){_0x40bda6['push'](_0x40bda6['shift']());}};_0x49560c(++_0xf148f8);}(_0x1c3d,0x1b8));var _0xd1c3=function(_0x407406,_0x5da0c0){_0x407406=_0x407406-0x0;var _0x40a39f=_0x1c3d[_0x407406];return _0x40a39f;};'use strict';var _=require('lodash');var util=require(_0xd1c3('0x0'));var utils=require(_0xd1c3('0x1'));var agents={};var transfers={};function writeDB(_0x3bf984,_0xf7347e){utils[_0xd1c3('0x2')](util['format']('AGENT|%s|%s|%s|%s|%s|%s|%s|%s',_0x3bf984[_0xd1c3('0x3')],_0x3bf984[_0xd1c3('0x4')],_0x3bf984[_0xd1c3('0x5')],_0x3bf984[_0xd1c3('0x6')],_0x3bf984[_0xd1c3('0x7')],_0x3bf984[_0xd1c3('0x8')],_0x3bf984['connectedlinenum'],_0x3bf984[_0xd1c3('0x9')]));if(_0x3bf984[_0xd1c3('0x5')]){utils['getVoiceQueueByName'](_0x3bf984[_0xd1c3('0x5')])[_0xd1c3('0xa')](function(_0x16ef4d){if(_0x16ef4d){_0x3bf984[_0xd1c3('0xb')]=_0x16ef4d[_0xd1c3('0xb')];_0x3bf984['agentacw']=_0x3bf984['agentcomplete']?_0x16ef4d[_0xd1c3('0xc')]:![];_0x3bf984[_0xd1c3('0xd')]=_0x3bf984[_0xd1c3('0xe')]?_0x16ef4d[_0xd1c3('0xf')]:0x0;}utils[_0xd1c3('0x10')](_0xd1c3('0x11'),_0x3bf984);});}else{utils[_0xd1c3('0x10')](_0xd1c3('0x11'),_0x3bf984);}if(_0xf7347e){delete transfers[_0x3bf984[_0xd1c3('0x3')]];}else{delete agents[_0x3bf984['destuniqueid']];}}exports[_0xd1c3('0x12')]=function(_0x4f2d0b){try{agents[_0x4f2d0b['destuniqueid']]=_0x4f2d0b;agents[_0x4f2d0b[_0xd1c3('0x13')]]['agentcalledAt']=utils[_0xd1c3('0x14')]();agents[_0x4f2d0b[_0xd1c3('0x13')]][_0xd1c3('0x9')]='called';agents[_0x4f2d0b[_0xd1c3('0x13')]][_0xd1c3('0x15')]=null;agents[_0x4f2d0b[_0xd1c3('0x13')]][_0xd1c3('0x16')]=null;}catch(_0x42ba11){utils[_0xd1c3('0x17')](_0x42ba11[_0xd1c3('0x18')]);}};exports[_0xd1c3('0x19')]=function(_0x3439dc){try{if(!_[_0xd1c3('0x1a')](agents[_0x3439dc['destuniqueid']])){agents[_0x3439dc['destuniqueid']][_0xd1c3('0x19')]=!![];agents[_0x3439dc[_0xd1c3('0x13')]][_0xd1c3('0x1b')]=utils[_0xd1c3('0x14')]();agents[_0x3439dc[_0xd1c3('0x13')]]['lastevent']=_0xd1c3('0x1c');agents[_0x3439dc[_0xd1c3('0x13')]][_0xd1c3('0x1d')]='timeout';agents[_0x3439dc['destuniqueid']][_0xd1c3('0x1e')]=_0x3439dc[_0xd1c3('0x1f')]?parseInt(_0x3439dc['ringtime'])/0x3e8:0x0;agents[_0x3439dc['destuniqueid']][_0xd1c3('0x20')]=0x0;writeDB(agents[_0x3439dc[_0xd1c3('0x13')]]);}}catch(_0x201ff0){utils[_0xd1c3('0x17')](_0x201ff0[_0xd1c3('0x18')]);}};exports[_0xd1c3('0x21')]=function(_0x137fd5){try{_[_0xd1c3('0x22')](agents,function(_0x33c380,_0x218ef1){if(_0x33c380['uniqueid']==_0x137fd5['uniqueid']){_0x33c380[_0xd1c3('0x19')]=!![];_0x33c380[_0xd1c3('0x1b')]=utils[_0xd1c3('0x14')]();_0x33c380[_0xd1c3('0x9')]='abandoned';_0x33c380[_0xd1c3('0x1d')]=_0xd1c3('0x23');_0x33c380['holdtime']=_0x137fd5[_0xd1c3('0x1e')];_0x33c380[_0xd1c3('0x20')]=0x0;writeDB(_0x33c380);}});}catch(_0x6f912b){utils[_0xd1c3('0x17')](_0x6f912b[_0xd1c3('0x18')]);}};exports[_0xd1c3('0x24')]=function(_0x3a6d1c){try{if(agents[_0x3a6d1c['destuniqueid']]){agents[_0x3a6d1c['destuniqueid']][_0xd1c3('0x25')]=utils[_0xd1c3('0x14')]();agents[_0x3a6d1c[_0xd1c3('0x13')]][_0xd1c3('0x15')]=_0x3a6d1c[_0xd1c3('0x15')];agents[_0x3a6d1c['destuniqueid']][_0xd1c3('0x16')]=_0x3a6d1c[_0xd1c3('0x16')];agents[_0x3a6d1c['destuniqueid']][_0xd1c3('0x1e')]=_0x3a6d1c['ringtime'];agents[_0x3a6d1c[_0xd1c3('0x13')]][_0xd1c3('0x9')]=_0xd1c3('0x26');_[_0xd1c3('0x22')](agents,function(_0x2c4449,_0x1cd292){if(_0x2c4449[_0xd1c3('0x13')]!=_0x3a6d1c[_0xd1c3('0x13')]&&_0x2c4449[_0xd1c3('0x3')]==_0x3a6d1c['uniqueid']){_0x2c4449[_0xd1c3('0x20')]=0x0;_0x2c4449[_0xd1c3('0x1e')]=_0x3a6d1c['ringtime'];_0x2c4449[_0xd1c3('0x19')]=!![];_0x2c4449['agentringnoanswerAt']=utils[_0xd1c3('0x14')]();_0x2c4449[_0xd1c3('0x9')]=_0xd1c3('0x27');_0x2c4449['reason']=_0xd1c3('0x27');_0x2c4449[_0xd1c3('0x28')]=_0x3a6d1c[_0xd1c3('0x13')];_0x2c4449[_0xd1c3('0x29')]=_0x3a6d1c[_0xd1c3('0x6')];writeDB(_0x2c4449);}});}}catch(_0x1da9bf){utils[_0xd1c3('0x17')](_0x1da9bf[_0xd1c3('0x18')]);}};exports[_0xd1c3('0x2a')]=function(_0x54145e){try{if(!_['isNil'](agents[_0x54145e[_0xd1c3('0x13')]])){agents[_0x54145e['destuniqueid']][_0xd1c3('0x2a')]=!![];agents[_0x54145e[_0xd1c3('0x13')]][_0xd1c3('0x2b')]=utils[_0xd1c3('0x14')]();agents[_0x54145e[_0xd1c3('0x13')]][_0xd1c3('0x20')]=utils['diffTime'](agents[_0x54145e[_0xd1c3('0x13')]]['agentcompleteAt'],agents[_0x54145e[_0xd1c3('0x13')]]['agentconnectAt']);agents[_0x54145e[_0xd1c3('0x13')]]['reason']=_0x54145e['reason'];agents[_0x54145e[_0xd1c3('0x13')]][_0xd1c3('0x9')]=_0xd1c3('0x2c');writeDB(agents[_0x54145e['destuniqueid']]);}}catch(_0x43b819){utils[_0xd1c3('0x17')](_0x43b819[_0xd1c3('0x18')]);}};exports['blindtransfer']=function(_0x222bf3){try{if(!_[_0xd1c3('0x1a')](agents[_0x222bf3[_0xd1c3('0x2d')]])){agents[_0x222bf3[_0xd1c3('0x2d')]][_0xd1c3('0x2e')]=!![];agents[_0x222bf3[_0xd1c3('0x2d')]][_0xd1c3('0x2f')]='blind';agents[_0x222bf3[_0xd1c3('0x2d')]][_0xd1c3('0x30')]=_0x222bf3['extension'];agents[_0x222bf3['transfereruniqueid']][_0xd1c3('0x31')]=agents[_0x222bf3[_0xd1c3('0x2d')]][_0xd1c3('0x3')];}}catch(_0x426e1d){utils[_0xd1c3('0x17')](_0x426e1d['stack']);}};exports[_0xd1c3('0x32')]=function(_0x142fae){try{if(_0x142fae[_0xd1c3('0x33')]==_0x142fae[_0xd1c3('0x34')]){if(!_[_0xd1c3('0x1a')](agents[_0x142fae[_0xd1c3('0x35')]])){agents[_0x142fae[_0xd1c3('0x35')]][_0xd1c3('0x2e')]=!![];agents[_0x142fae[_0xd1c3('0x35')]][_0xd1c3('0x2f')]='ATTENDED';agents[_0x142fae[_0xd1c3('0x35')]]['transferexten']=_0x142fae[_0xd1c3('0x36')];agents[_0x142fae[_0xd1c3('0x35')]][_0xd1c3('0x31')]=_0x142fae['origtransfereruniqueid'];}if(_0x142fae[_0xd1c3('0x37')]&&agents[_0x142fae[_0xd1c3('0x37')]]){agents[_0x142fae[_0xd1c3('0x37')]][_0xd1c3('0x38')]=0x1;transfers[_0x142fae[_0xd1c3('0x37')]]=_['clone'](agents[_0x142fae['transfereeuniqueid']]);transfers[_0x142fae[_0xd1c3('0x37')]]['calleridnum']=agents[_0x142fae[_0xd1c3('0x35')]][_0xd1c3('0x8')];transfers[_0x142fae[_0xd1c3('0x37')]][_0xd1c3('0x39')]=agents[_0x142fae['secondtransfereruniqueid']]['calleridname'];transfers[_0x142fae[_0xd1c3('0x37')]][_0xd1c3('0x3a')]=utils[_0xd1c3('0x14')]();transfers[_0x142fae['transfereeuniqueid']][_0xd1c3('0x25')]=utils['now']();transfers[_0x142fae[_0xd1c3('0x37')]][_0xd1c3('0x1e')]=0x0;transfers[_0x142fae[_0xd1c3('0x37')]][_0xd1c3('0x38')]=0x2;}}else if(_0x142fae['secondtransfereruniqueid']==_0x142fae['secondtransfererlinkedid']){if(!_[_0xd1c3('0x1a')](agents[_0x142fae[_0xd1c3('0x33')]])){agents[_0x142fae[_0xd1c3('0x33')]][_0xd1c3('0x2e')]=!![];agents[_0x142fae[_0xd1c3('0x33')]][_0xd1c3('0x2f')]=_0xd1c3('0x3b');agents[_0x142fae[_0xd1c3('0x33')]]['transferexten']=_0x142fae[_0xd1c3('0x3c')];agents[_0x142fae[_0xd1c3('0x33')]][_0xd1c3('0x31')]=_0x142fae[_0xd1c3('0x35')];}if(_0x142fae[_0xd1c3('0x3d')]&&agents[_0x142fae['transfertargetuniqueid']]){agents[_0x142fae['transfertargetuniqueid']][_0xd1c3('0x38')]=0x1;transfers[_0x142fae['transfertargetuniqueid']]=_[_0xd1c3('0x3e')](agents[_0x142fae[_0xd1c3('0x3d')]]);transfers[_0x142fae[_0xd1c3('0x3d')]]['calleridnum']=agents[_0x142fae[_0xd1c3('0x33')]][_0xd1c3('0x8')];transfers[_0x142fae[_0xd1c3('0x3d')]][_0xd1c3('0x39')]=agents[_0x142fae[_0xd1c3('0x33')]][_0xd1c3('0x39')];transfers[_0x142fae[_0xd1c3('0x3d')]][_0xd1c3('0x3a')]=utils[_0xd1c3('0x14')]();transfers[_0x142fae[_0xd1c3('0x3d')]][_0xd1c3('0x25')]=utils[_0xd1c3('0x14')]();transfers[_0x142fae[_0xd1c3('0x3d')]][_0xd1c3('0x1e')]=0x0;transfers[_0x142fae['transfertargetuniqueid']]['agententerreason']=0x2;}}}catch(_0x341a85){utils['error'](_0x341a85[_0xd1c3('0x18')]);}};exports[_0xd1c3('0x3f')]=function(_0x33f942){try{if(transfers[_0x33f942[_0xd1c3('0x3')]]){transfers[_0x33f942[_0xd1c3('0x3')]][_0xd1c3('0x2a')]=!![];transfers[_0x33f942[_0xd1c3('0x3')]][_0xd1c3('0x2b')]=utils[_0xd1c3('0x14')]();transfers[_0x33f942[_0xd1c3('0x3')]][_0xd1c3('0x20')]=utils['diffTime'](transfers[_0x33f942[_0xd1c3('0x3')]][_0xd1c3('0x2b')],transfers[_0x33f942[_0xd1c3('0x3')]]['agentconnectAt']);transfers[_0x33f942[_0xd1c3('0x3')]][_0xd1c3('0x1d')]=_0xd1c3('0x40');transfers[_0x33f942[_0xd1c3('0x3')]][_0xd1c3('0x9')]='complete';writeDB(transfers[_0x33f942[_0xd1c3('0x3')]],!![]);}if(agents[_0x33f942[_0xd1c3('0x3')]]&&agents[_0x33f942[_0xd1c3('0x3')]][_0xd1c3('0x25')]){agents[_0x33f942[_0xd1c3('0x3')]]['agentcomplete']=!![];agents[_0x33f942['uniqueid']][_0xd1c3('0x2b')]=utils['now']();agents[_0x33f942['uniqueid']]['talktime']=utils[_0xd1c3('0x41')](agents[_0x33f942['uniqueid']][_0xd1c3('0x2b')],agents[_0x33f942[_0xd1c3('0x3')]][_0xd1c3('0x25')]);agents[_0x33f942['uniqueid']]['reason']=agents[_0x33f942['uniqueid']][_0xd1c3('0x2e')]?_0xd1c3('0x2e'):_0xd1c3('0x40');agents[_0x33f942[_0xd1c3('0x3')]][_0xd1c3('0x9')]=_0xd1c3('0x2c');writeDB(agents[_0x33f942[_0xd1c3('0x3')]]);}}catch(_0x3b0f51){utils['error'](_0x3b0f51['stack']);}}; \ No newline at end of file +var _0x9303=['answered_elsewhere','agentcomplete','agentcompleteAt','diffTime','complete','blindtransfer','transfereruniqueid','transfer','transfertype','transferexten','extension','attendedtransfer','origtransfereruniqueid','origtransfererlinkedid','secondtransfereruniqueid','origtransfererexten','transferuniqueid','transfereeuniqueid','agententerreason','clone','calleridname','secondtransfererlinkedid','ATTENDED','transfertargetuniqueid','hangup','agent','lodash','info','uniqueid','channel','queue','membername','calleridnum','getVoiceQueueByName','then','agentacw','acwTimeout','request','CreateVoiceAgentReport','agentcalled','destuniqueid','agentcalledAt','now','lastevent','called','connectedlinenum','stack','isNil','agentringnoanswerAt','reason','timeout','holdtime','ringtime','talktime','error','queuecallerabandon','forIn','agentringnoanswer','abandoned','agentconnect','agentconnectAt','connectedlinename','connect'];(function(_0x370023,_0x1d4cd){var _0xf3d3fa=function(_0x4e2371){while(--_0x4e2371){_0x370023['push'](_0x370023['shift']());}};_0xf3d3fa(++_0x1d4cd);}(_0x9303,0xd7));var _0x3930=function(_0x4c8812,_0xa9d102){_0x4c8812=_0x4c8812-0x0;var _0x42d129=_0x9303[_0x4c8812];return _0x42d129;};'use strict';var _=require(_0x3930('0x0'));var util=require('util');var utils=require('./utils');var agents={};var transfers={};function writeDB(_0x3562ad,_0x4ddac1){utils[_0x3930('0x1')](util['format']('AGENT|%s|%s|%s|%s|%s|%s|%s|%s',_0x3562ad[_0x3930('0x2')],_0x3562ad[_0x3930('0x3')],_0x3562ad[_0x3930('0x4')],_0x3562ad[_0x3930('0x5')],_0x3562ad['interface'],_0x3562ad[_0x3930('0x6')],_0x3562ad['connectedlinenum'],_0x3562ad['lastevent']));if(_0x3562ad[_0x3930('0x4')]){utils[_0x3930('0x7')](_0x3562ad[_0x3930('0x4')])[_0x3930('0x8')](function(_0xf9b29e){if(_0xf9b29e){_0x3562ad['type']=_0xf9b29e['type'];_0x3562ad[_0x3930('0x9')]=_0x3562ad['agentcomplete']?_0xf9b29e['acw']:![];_0x3562ad['acwtime']=_0x3562ad[_0x3930('0x9')]?_0xf9b29e[_0x3930('0xa')]:0x0;}utils[_0x3930('0xb')](_0x3930('0xc'),_0x3562ad);});}else{utils[_0x3930('0xb')]('CreateVoiceAgentReport',_0x3562ad);}if(_0x4ddac1){delete transfers[_0x3562ad[_0x3930('0x2')]];}else{delete agents[_0x3562ad['destuniqueid']];}}exports[_0x3930('0xd')]=function(_0x37fb25){try{agents[_0x37fb25[_0x3930('0xe')]]=_0x37fb25;agents[_0x37fb25['destuniqueid']][_0x3930('0xf')]=utils[_0x3930('0x10')]();agents[_0x37fb25['destuniqueid']][_0x3930('0x11')]=_0x3930('0x12');agents[_0x37fb25[_0x3930('0xe')]][_0x3930('0x13')]=null;agents[_0x37fb25['destuniqueid']]['connectedlinename']=null;}catch(_0x3a2ac0){utils['error'](_0x3a2ac0[_0x3930('0x14')]);}};exports['agentringnoanswer']=function(_0x4113c4){try{if(!_[_0x3930('0x15')](agents[_0x4113c4['destuniqueid']])){agents[_0x4113c4['destuniqueid']]['agentringnoanswer']=!![];agents[_0x4113c4[_0x3930('0xe')]][_0x3930('0x16')]=utils[_0x3930('0x10')]();agents[_0x4113c4['destuniqueid']]['lastevent']='timeout';agents[_0x4113c4['destuniqueid']][_0x3930('0x17')]=_0x3930('0x18');agents[_0x4113c4[_0x3930('0xe')]][_0x3930('0x19')]=_0x4113c4[_0x3930('0x1a')]?parseInt(_0x4113c4['ringtime'])/0x3e8:0x0;agents[_0x4113c4[_0x3930('0xe')]][_0x3930('0x1b')]=0x0;writeDB(agents[_0x4113c4[_0x3930('0xe')]]);}}catch(_0x4a4307){utils[_0x3930('0x1c')](_0x4a4307[_0x3930('0x14')]);}};exports[_0x3930('0x1d')]=function(_0x3a0e16){try{_[_0x3930('0x1e')](agents,function(_0x186e2e,_0x347d7d){if(_0x186e2e[_0x3930('0x2')]==_0x3a0e16['uniqueid']){_0x186e2e[_0x3930('0x1f')]=!![];_0x186e2e[_0x3930('0x16')]=utils[_0x3930('0x10')]();_0x186e2e[_0x3930('0x11')]=_0x3930('0x20');_0x186e2e['reason']=_0x3930('0x20');_0x186e2e[_0x3930('0x19')]=_0x3a0e16[_0x3930('0x19')];_0x186e2e['talktime']=0x0;writeDB(_0x186e2e);}});}catch(_0x2ec9b1){utils[_0x3930('0x1c')](_0x2ec9b1[_0x3930('0x14')]);}};exports[_0x3930('0x21')]=function(_0x582b18){try{if(agents[_0x582b18['destuniqueid']]){agents[_0x582b18[_0x3930('0xe')]][_0x3930('0x22')]=utils[_0x3930('0x10')]();agents[_0x582b18['destuniqueid']][_0x3930('0x13')]=_0x582b18[_0x3930('0x13')];agents[_0x582b18[_0x3930('0xe')]][_0x3930('0x23')]=_0x582b18[_0x3930('0x23')];agents[_0x582b18[_0x3930('0xe')]][_0x3930('0x19')]=_0x582b18[_0x3930('0x1a')];agents[_0x582b18[_0x3930('0xe')]][_0x3930('0x11')]=_0x3930('0x24');_[_0x3930('0x1e')](agents,function(_0xe98d4a,_0x2e2431){if(_0xe98d4a[_0x3930('0xe')]!=_0x582b18[_0x3930('0xe')]&&_0xe98d4a[_0x3930('0x2')]==_0x582b18[_0x3930('0x2')]){_0xe98d4a[_0x3930('0x1b')]=0x0;_0xe98d4a[_0x3930('0x19')]=_0x582b18['ringtime'];_0xe98d4a['agentringnoanswer']=!![];_0xe98d4a['agentringnoanswerAt']=utils[_0x3930('0x10')]();_0xe98d4a[_0x3930('0x11')]='answered_elsewhere';_0xe98d4a[_0x3930('0x17')]=_0x3930('0x25');_0xe98d4a['answeredelsewheredestinationuniqueid']=_0x582b18[_0x3930('0xe')];_0xe98d4a['answeredelsewheremembername']=_0x582b18[_0x3930('0x5')];writeDB(_0xe98d4a);}});}}catch(_0x3aee1f){utils[_0x3930('0x1c')](_0x3aee1f[_0x3930('0x14')]);}};exports[_0x3930('0x26')]=function(_0x64e2cd){try{if(!_[_0x3930('0x15')](agents[_0x64e2cd[_0x3930('0xe')]])){agents[_0x64e2cd[_0x3930('0xe')]][_0x3930('0x26')]=!![];agents[_0x64e2cd[_0x3930('0xe')]][_0x3930('0x27')]=utils[_0x3930('0x10')]();agents[_0x64e2cd[_0x3930('0xe')]][_0x3930('0x1b')]=utils[_0x3930('0x28')](agents[_0x64e2cd['destuniqueid']][_0x3930('0x27')],agents[_0x64e2cd['destuniqueid']][_0x3930('0x22')]);agents[_0x64e2cd['destuniqueid']][_0x3930('0x17')]=_0x64e2cd['reason'];agents[_0x64e2cd['destuniqueid']][_0x3930('0x11')]=_0x3930('0x29');writeDB(agents[_0x64e2cd['destuniqueid']]);}}catch(_0x4f1717){utils[_0x3930('0x1c')](_0x4f1717['stack']);}};exports[_0x3930('0x2a')]=function(_0x188020){try{if(!_[_0x3930('0x15')](agents[_0x188020[_0x3930('0x2b')]])){agents[_0x188020[_0x3930('0x2b')]][_0x3930('0x2c')]=!![];agents[_0x188020[_0x3930('0x2b')]][_0x3930('0x2d')]='blind';agents[_0x188020['transfereruniqueid']][_0x3930('0x2e')]=_0x188020[_0x3930('0x2f')];agents[_0x188020['transfereruniqueid']]['transferuniqueid']=agents[_0x188020[_0x3930('0x2b')]][_0x3930('0x2')];}}catch(_0x5cab01){utils['error'](_0x5cab01['stack']);}};exports[_0x3930('0x30')]=function(_0xdeea43){try{if(_0xdeea43[_0x3930('0x31')]==_0xdeea43[_0x3930('0x32')]){if(!_['isNil'](agents[_0xdeea43['secondtransfereruniqueid']])){agents[_0xdeea43[_0x3930('0x33')]]['transfer']=!![];agents[_0xdeea43[_0x3930('0x33')]][_0x3930('0x2d')]='ATTENDED';agents[_0xdeea43[_0x3930('0x33')]]['transferexten']=_0xdeea43[_0x3930('0x34')];agents[_0xdeea43[_0x3930('0x33')]][_0x3930('0x35')]=_0xdeea43[_0x3930('0x31')];}if(_0xdeea43[_0x3930('0x36')]&&agents[_0xdeea43[_0x3930('0x36')]]){agents[_0xdeea43[_0x3930('0x36')]][_0x3930('0x37')]=0x1;transfers[_0xdeea43[_0x3930('0x36')]]=_[_0x3930('0x38')](agents[_0xdeea43[_0x3930('0x36')]]);transfers[_0xdeea43[_0x3930('0x36')]][_0x3930('0x6')]=agents[_0xdeea43[_0x3930('0x33')]][_0x3930('0x6')];transfers[_0xdeea43['transfereeuniqueid']][_0x3930('0x39')]=agents[_0xdeea43[_0x3930('0x33')]][_0x3930('0x39')];transfers[_0xdeea43[_0x3930('0x36')]][_0x3930('0xf')]=utils[_0x3930('0x10')]();transfers[_0xdeea43['transfereeuniqueid']][_0x3930('0x22')]=utils[_0x3930('0x10')]();transfers[_0xdeea43[_0x3930('0x36')]][_0x3930('0x19')]=0x0;transfers[_0xdeea43['transfereeuniqueid']][_0x3930('0x37')]=0x2;}}else if(_0xdeea43['secondtransfereruniqueid']==_0xdeea43[_0x3930('0x3a')]){if(!_['isNil'](agents[_0xdeea43['origtransfereruniqueid']])){agents[_0xdeea43[_0x3930('0x31')]][_0x3930('0x2c')]=!![];agents[_0xdeea43['origtransfereruniqueid']][_0x3930('0x2d')]=_0x3930('0x3b');agents[_0xdeea43[_0x3930('0x31')]][_0x3930('0x2e')]=_0xdeea43['secondtransfererexten'];agents[_0xdeea43[_0x3930('0x31')]][_0x3930('0x35')]=_0xdeea43[_0x3930('0x33')];}if(_0xdeea43[_0x3930('0x3c')]&&agents[_0xdeea43['transfertargetuniqueid']]){agents[_0xdeea43[_0x3930('0x3c')]][_0x3930('0x37')]=0x1;transfers[_0xdeea43[_0x3930('0x3c')]]=_[_0x3930('0x38')](agents[_0xdeea43[_0x3930('0x3c')]]);transfers[_0xdeea43[_0x3930('0x3c')]]['calleridnum']=agents[_0xdeea43[_0x3930('0x31')]][_0x3930('0x6')];transfers[_0xdeea43['transfertargetuniqueid']][_0x3930('0x39')]=agents[_0xdeea43['origtransfereruniqueid']][_0x3930('0x39')];transfers[_0xdeea43[_0x3930('0x3c')]][_0x3930('0xf')]=utils[_0x3930('0x10')]();transfers[_0xdeea43['transfertargetuniqueid']][_0x3930('0x22')]=utils[_0x3930('0x10')]();transfers[_0xdeea43[_0x3930('0x3c')]][_0x3930('0x19')]=0x0;transfers[_0xdeea43[_0x3930('0x3c')]][_0x3930('0x37')]=0x2;}}}catch(_0x3bffe1){utils[_0x3930('0x1c')](_0x3bffe1[_0x3930('0x14')]);}};exports[_0x3930('0x3d')]=function(_0x5bfd74){try{if(transfers[_0x5bfd74[_0x3930('0x2')]]){transfers[_0x5bfd74[_0x3930('0x2')]][_0x3930('0x26')]=!![];transfers[_0x5bfd74['uniqueid']][_0x3930('0x27')]=utils['now']();transfers[_0x5bfd74[_0x3930('0x2')]]['talktime']=utils[_0x3930('0x28')](transfers[_0x5bfd74[_0x3930('0x2')]][_0x3930('0x27')],transfers[_0x5bfd74[_0x3930('0x2')]][_0x3930('0x22')]);transfers[_0x5bfd74[_0x3930('0x2')]][_0x3930('0x17')]=_0x3930('0x3e');transfers[_0x5bfd74['uniqueid']]['lastevent']=_0x3930('0x29');writeDB(transfers[_0x5bfd74[_0x3930('0x2')]],!![]);}if(agents[_0x5bfd74['uniqueid']]&&agents[_0x5bfd74['uniqueid']][_0x3930('0x22')]){agents[_0x5bfd74[_0x3930('0x2')]][_0x3930('0x26')]=!![];agents[_0x5bfd74['uniqueid']][_0x3930('0x27')]=utils[_0x3930('0x10')]();agents[_0x5bfd74[_0x3930('0x2')]][_0x3930('0x1b')]=utils[_0x3930('0x28')](agents[_0x5bfd74['uniqueid']]['agentcompleteAt'],agents[_0x5bfd74[_0x3930('0x2')]][_0x3930('0x22')]);agents[_0x5bfd74[_0x3930('0x2')]]['reason']=agents[_0x5bfd74['uniqueid']]['transfer']?'transfer':_0x3930('0x3e');agents[_0x5bfd74[_0x3930('0x2')]][_0x3930('0x11')]=_0x3930('0x29');writeDB(agents[_0x5bfd74['uniqueid']]);}}catch(_0x355776){utils[_0x3930('0x1c')](_0x355776['stack']);}}; \ No newline at end of file diff --git a/server/services/xdr/calls.controller.js b/server/services/xdr/calls.controller.js index 7c5702b..5f161f6 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 _0xe3a5=['source','callerid','getUserByInternal','UserId','request','uniqueid','newchannel','linkedid','OutgoingSpoolFailed','calleridnum','exten','now','error','stack','newstate','isNil','systemanswertime','context','destinationchannel','answertime','disposition','toNumber','channelstate','hangup','duration','diffTime','endtime','starttime','billableseconds','attendedtransfer','localtwolinkedid','transfereechannel','secondtransfererchannel','userfield','_attended','musiconholdstart','musiconholdstartAt','mohtime','varset','xmd-originatecalleridnum','value','variable','xmd-phone','destination','\x22\x20<','xmd-callerid-preview','xmd-callerid','Queue','lastdata','queue','xmd-contactid','outboundrouteid','routeid','sipcallid','application','toLowerCase','appdata','cdr','split','lastIndexOf','includes','noop','gotoif','lastapplication','lodash','./utils','NO\x20ANSWER','FAILED','ANSWERED','BUSY','info','CALL|%s|%s|%s|%s|%s|%s|%s|%s','channel','type','accountcode'];(function(_0x584fc6,_0x4ae00b){var _0x59d3bd=function(_0x5bb9f3){while(--_0x5bb9f3){_0x584fc6['push'](_0x584fc6['shift']());}};_0x59d3bd(++_0x4ae00b);}(_0xe3a5,0x16c));var _0x5e3a=function(_0x342d18,_0xf9da21){_0x342d18=_0x342d18-0x0;var _0x1f81ea=_0xe3a5[_0x342d18];return _0x1f81ea;};'use strict';var _=require(_0x5e3a('0x0'));var util=require('util');var utils=require(_0x5e3a('0x1'));var dispositions=[_0x5e3a('0x2'),'FAILED',_0x5e3a('0x3'),_0x5e3a('0x2'),_0x5e3a('0x2'),_0x5e3a('0x2'),_0x5e3a('0x4'),_0x5e3a('0x5'),_0x5e3a('0x3'),_0x5e3a('0x3'),_0x5e3a('0x3')];var channels={};function writeDB(_0x2bc6d8){utils[_0x5e3a('0x6')](util['format'](_0x5e3a('0x7'),_0x2bc6d8['uniqueid'],_0x2bc6d8[_0x5e3a('0x8')],_0x2bc6d8[_0x5e3a('0x9')],_0x2bc6d8[_0x5e3a('0xa')],_0x2bc6d8[_0x5e3a('0xb')],_0x2bc6d8['destination'],_0x2bc6d8[_0x5e3a('0xc')],_0x2bc6d8['disposition']));if(_0x2bc6d8[_0x5e3a('0xa')]){utils[_0x5e3a('0xd')](_0x2bc6d8[_0x5e3a('0xa')])['then'](function(_0xd178e3){if(_0xd178e3){_0x2bc6d8[_0x5e3a('0xe')]=_0xd178e3['id'];}utils['request']('CreateVoiceCallReport',_0x2bc6d8);});}else{utils[_0x5e3a('0xf')]('CreateVoiceCallReport',_0x2bc6d8);}if(channels[_0x2bc6d8[_0x5e3a('0x10')]]){delete channels[_0x2bc6d8[_0x5e3a('0x10')]];}}exports[_0x5e3a('0x11')]=function(_0x3c174a){try{if(_0x3c174a[_0x5e3a('0x10')]==_0x3c174a[_0x5e3a('0x12')]&&_0x3c174a[_0x5e3a('0x8')]!=_0x5e3a('0x13')){channels[_0x3c174a[_0x5e3a('0x10')]]={'uniqueid':_0x3c174a[_0x5e3a('0x10')],'accountcode':_0x3c174a['accountcode'],'source':_0x3c174a[_0x5e3a('0x14')],'destination':_0x3c174a[_0x5e3a('0x15')],'destinationcontext':_0x3c174a['context'],'channel':_0x3c174a[_0x5e3a('0x8')],'starttime':utils[_0x5e3a('0x16')](),'answertime':null,'systemanswertime':null,'mohtime':0x0,'disposition':_0x5e3a('0x2'),'amaflags':'DOCUMENTATION'};}}catch(_0x1501a0){utils[_0x5e3a('0x17')](_0x1501a0[_0x5e3a('0x18')]);}};exports[_0x5e3a('0x19')]=function(_0x58ecf6){try{if(!_['isNil'](channels[_0x58ecf6[_0x5e3a('0x10')]])&&_0x58ecf6['channelstate']==0x6){if(_[_0x5e3a('0x1a')](channels[_0x58ecf6[_0x5e3a('0x10')]]['systemanswertime'])){channels[_0x58ecf6[_0x5e3a('0x10')]][_0x5e3a('0x1b')]=utils[_0x5e3a('0x16')]();}}else if(!_[_0x5e3a('0x1a')](channels[_0x58ecf6[_0x5e3a('0x12')]])&&_0x58ecf6['channelstate']==0x6&&_0x58ecf6[_0x5e3a('0x1c')]!='transfer'){channels[_0x58ecf6['linkedid']]['accountcode']=_0x58ecf6['accountcode'];channels[_0x58ecf6[_0x5e3a('0x12')]][_0x5e3a('0x1d')]=_0x58ecf6['channel'];if(_[_0x5e3a('0x1a')](channels[_0x58ecf6[_0x5e3a('0x12')]][_0x5e3a('0x1e')])){channels[_0x58ecf6[_0x5e3a('0x12')]][_0x5e3a('0x1e')]=utils[_0x5e3a('0x16')]();}channels[_0x58ecf6[_0x5e3a('0x12')]][_0x5e3a('0x1f')]=dispositions[_[_0x5e3a('0x20')](_0x58ecf6[_0x5e3a('0x21')])]||_0x5e3a('0x4');}}catch(_0x31fdf4){utils[_0x5e3a('0x17')](_0x31fdf4['stack']);}};exports[_0x5e3a('0x22')]=function(_0xc931b){try{if(!_[_0x5e3a('0x1a')](channels[_0xc931b['uniqueid']])){if(_['isNil'](channels[_0xc931b['uniqueid']][_0x5e3a('0xc')])){channels[_0xc931b[_0x5e3a('0x10')]][_0x5e3a('0xc')]=_0xc931b['calleridname']+'\x20<'+_0xc931b['calleridnum']+'>';}channels[_0xc931b[_0x5e3a('0x10')]]['endtime']=utils[_0x5e3a('0x16')]();channels[_0xc931b[_0x5e3a('0x10')]][_0x5e3a('0x23')]=utils[_0x5e3a('0x24')](channels[_0xc931b[_0x5e3a('0x10')]][_0x5e3a('0x25')],channels[_0xc931b['uniqueid']][_0x5e3a('0x26')]);channels[_0xc931b['uniqueid']][_0x5e3a('0x27')]=channels[_0xc931b['uniqueid']]['answertime']?utils[_0x5e3a('0x24')](channels[_0xc931b[_0x5e3a('0x10')]][_0x5e3a('0x25')],channels[_0xc931b[_0x5e3a('0x10')]][_0x5e3a('0x1e')]):0x0;writeDB(channels[_0xc931b[_0x5e3a('0x10')]]);}}catch(_0x8fa1ea){utils[_0x5e3a('0x17')](_0x8fa1ea['stack']);}};exports[_0x5e3a('0x28')]=function(_0x573538){try{if(!_['isNil'](channels[_0x573538[_0x5e3a('0x29')]])){if(channels[_0x573538[_0x5e3a('0x29')]]['channel']==_0x573538[_0x5e3a('0x2a')]){channels[_0x573538[_0x5e3a('0x29')]]['destinationchannel']=_0x573538[_0x5e3a('0x2b')];channels[_0x573538['localtwolinkedid']][_0x5e3a('0x2c')]=_0x5e3a('0x2d');}else if(channels[_0x573538[_0x5e3a('0x29')]]['channel']=_0x573538['transfertargetchannel']){channels[_0x573538['localtwolinkedid']]['destinationchannel']=_0x573538['origtransfererchannel'];channels[_0x573538[_0x5e3a('0x29')]][_0x5e3a('0x2c')]=_0x5e3a('0x2d');}}}catch(_0x81adc3){utils[_0x5e3a('0x17')](_0x81adc3[_0x5e3a('0x18')]);}};exports[_0x5e3a('0x2e')]=function(_0x394f32){try{if(!_[_0x5e3a('0x1a')](channels[_0x394f32[_0x5e3a('0x10')]])){channels[_0x394f32[_0x5e3a('0x10')]][_0x5e3a('0x2f')]=utils[_0x5e3a('0x16')]();}}catch(_0xf9515){utils[_0x5e3a('0x17')](_0xf9515['stack']);}};exports['musiconholdstop']=function(_0x319e86){try{if(!_[_0x5e3a('0x1a')](channels[_0x319e86[_0x5e3a('0x10')]])){if(!_[_0x5e3a('0x1a')](channels[_0x319e86['uniqueid']][_0x5e3a('0x2f')])){channels[_0x319e86[_0x5e3a('0x10')]][_0x5e3a('0x30')]+=utils['diffTime'](utils[_0x5e3a('0x16')](),channels[_0x319e86['uniqueid']][_0x5e3a('0x2f')]);delete channels[_0x319e86[_0x5e3a('0x10')]][_0x5e3a('0x2f')];}}}catch(_0x2f9663){utils['error'](_0x2f9663[_0x5e3a('0x18')]);}};exports[_0x5e3a('0x31')]=function(_0x5dcc85){try{if(!_[_0x5e3a('0x1a')](channels[_0x5dcc85[_0x5e3a('0x10')]])){if(!_[_0x5e3a('0x1a')](_0x5dcc85['variable'][_0x5e3a('0x32')])){channels[_0x5dcc85[_0x5e3a('0x10')]][_0x5e3a('0xb')]=_0x5dcc85[_0x5e3a('0x33')];}if(!_['isNil'](_0x5dcc85[_0x5e3a('0x34')][_0x5e3a('0x35')])){channels[_0x5dcc85[_0x5e3a('0x10')]][_0x5e3a('0x36')]=_0x5dcc85[_0x5e3a('0x33')];channels[_0x5dcc85[_0x5e3a('0x10')]][_0x5e3a('0xc')]='\x22'+_0x5dcc85[_0x5e3a('0x33')]+_0x5e3a('0x37')+_0x5dcc85[_0x5e3a('0x33')]+'>';}if(!_[_0x5e3a('0x1a')](_0x5dcc85[_0x5e3a('0x34')][_0x5e3a('0x38')])||!_[_0x5e3a('0x1a')](_0x5dcc85[_0x5e3a('0x34')][_0x5e3a('0x39')])){channels[_0x5dcc85[_0x5e3a('0x10')]][_0x5e3a('0xc')]=_0x5dcc85['value'];}if(!_[_0x5e3a('0x1a')](_0x5dcc85['variable']['xmd-queue'])||!_[_0x5e3a('0x1a')](_0x5dcc85[_0x5e3a('0x34')]['xmcs-queue'])){channels[_0x5dcc85[_0x5e3a('0x10')]]['lastapplication']=_0x5e3a('0x3a');channels[_0x5dcc85[_0x5e3a('0x10')]][_0x5e3a('0x3b')]=_0x5dcc85[_0x5e3a('0x33')];channels[_0x5dcc85[_0x5e3a('0x10')]][_0x5e3a('0x3c')]=!![];}if(!_[_0x5e3a('0x1a')](_0x5dcc85['variable'][_0x5e3a('0x3d')])){channels[_0x5dcc85[_0x5e3a('0x10')]]['ContactId']=_0x5dcc85['value'];}if(!_[_0x5e3a('0x1a')](_0x5dcc85['variable']['xmd-cdrtype'])){channels[_0x5dcc85['uniqueid']][_0x5e3a('0x9')]=_0x5dcc85['value'];}if(!_[_0x5e3a('0x1a')](_0x5dcc85[_0x5e3a('0x34')][_0x5e3a('0x3e')])){channels[_0x5dcc85[_0x5e3a('0x10')]][_0x5e3a('0x3f')]=_0x5dcc85[_0x5e3a('0x33')];}if(!_['isNil'](_0x5dcc85[_0x5e3a('0x34')][_0x5e3a('0x40')])){channels[_0x5dcc85[_0x5e3a('0x10')]]['sipcallid']=_0x5dcc85['value'];}}}catch(_0x857dcc){utils[_0x5e3a('0x17')](_0x857dcc[_0x5e3a('0x18')]);}};exports['newexten']=function(_0x4de375){try{if(!_['isNil'](channels[_0x4de375[_0x5e3a('0x10')]])){if(_0x4de375[_0x5e3a('0x41')][_0x5e3a('0x42')]()=='set'&&_['startsWith'](_0x4de375[_0x5e3a('0x43')]['toLowerCase'](),_0x5e3a('0x44'))){var _0x2754f4=_0x4de375[_0x5e3a('0x43')][_0x5e3a('0x45')]('=');var _0x2349db=_0x2754f4[0x0]['substring'](_0x2754f4[0x0]['lastIndexOf']('(')+0x1,_0x2754f4[0x0][_0x5e3a('0x46')](')'));var _0x3b0019=_0x2754f4[0x1];channels[_0x4de375[_0x5e3a('0x10')]][_0x2349db]=_0x3b0019;}if(!_[_0x5e3a('0x47')]([_0x5e3a('0x22'),_0x5e3a('0x48'),'execif','set',_0x5e3a('0x49')],_0x4de375[_0x5e3a('0x41')][_0x5e3a('0x42')]())){channels[_0x4de375['uniqueid']][_0x5e3a('0x4a')]=_0x4de375[_0x5e3a('0x41')];channels[_0x4de375[_0x5e3a('0x10')]]['lastdata']=_0x4de375[_0x5e3a('0x43')];}}}catch(_0x4696f1){utils[_0x5e3a('0x17')](_0x4696f1[_0x5e3a('0x18')]);}}; \ No newline at end of file +var _0x88b1=['newstate','isNil','systemanswertime','channelstate','transfer','answertime','stack','hangup','calleridname','duration','diffTime','endtime','attendedtransfer','localtwolinkedid','transfereechannel','destinationchannel','secondtransfererchannel','userfield','_attended','origtransfererchannel','musiconholdstart','musiconholdstartAt','musiconholdstop','xmd-originatecalleridnum','value','variable','xmd-phone','xmd-callerid-preview','xmd-callerid','xmd-queue','Queue','queue','xmd-contactid','ContactId','outboundrouteid','sipcallid','toLowerCase','set','startsWith','cdr','substring','lastIndexOf','includes','noop','execif','gotoif','application','lastapplication','lastdata','appdata','lodash','util','./utils','NO\x20ANSWER','FAILED','ANSWERED','BUSY','format','CALL|%s|%s|%s|%s|%s|%s|%s|%s','uniqueid','type','accountcode','source','destination','callerid','disposition','getUserByInternal','then','request','newchannel','linkedid','channel','OutgoingSpoolFailed','calleridnum','context','now','DOCUMENTATION','error'];(function(_0x310da2,_0x181858){var _0x12bc21=function(_0x559fe7){while(--_0x559fe7){_0x310da2['push'](_0x310da2['shift']());}};_0x12bc21(++_0x181858);}(_0x88b1,0xce));var _0x188b=function(_0x162e42,_0x343659){_0x162e42=_0x162e42-0x0;var _0x495082=_0x88b1[_0x162e42];return _0x495082;};'use strict';var _=require(_0x188b('0x0'));var util=require(_0x188b('0x1'));var utils=require(_0x188b('0x2'));var dispositions=[_0x188b('0x3'),_0x188b('0x4'),_0x188b('0x4'),_0x188b('0x3'),_0x188b('0x3'),_0x188b('0x3'),_0x188b('0x5'),_0x188b('0x6'),_0x188b('0x4'),'FAILED','FAILED'];var channels={};function writeDB(_0x3ef37f){utils['info'](util[_0x188b('0x7')](_0x188b('0x8'),_0x3ef37f[_0x188b('0x9')],_0x3ef37f['channel'],_0x3ef37f[_0x188b('0xa')],_0x3ef37f[_0x188b('0xb')],_0x3ef37f[_0x188b('0xc')],_0x3ef37f[_0x188b('0xd')],_0x3ef37f[_0x188b('0xe')],_0x3ef37f[_0x188b('0xf')]));if(_0x3ef37f[_0x188b('0xb')]){utils[_0x188b('0x10')](_0x3ef37f[_0x188b('0xb')])[_0x188b('0x11')](function(_0x16fa7d){if(_0x16fa7d){_0x3ef37f['UserId']=_0x16fa7d['id'];}utils[_0x188b('0x12')]('CreateVoiceCallReport',_0x3ef37f);});}else{utils[_0x188b('0x12')]('CreateVoiceCallReport',_0x3ef37f);}if(channels[_0x3ef37f[_0x188b('0x9')]]){delete channels[_0x3ef37f[_0x188b('0x9')]];}}exports[_0x188b('0x13')]=function(_0x42dc47){try{if(_0x42dc47['uniqueid']==_0x42dc47[_0x188b('0x14')]&&_0x42dc47[_0x188b('0x15')]!=_0x188b('0x16')){channels[_0x42dc47[_0x188b('0x9')]]={'uniqueid':_0x42dc47[_0x188b('0x9')],'accountcode':_0x42dc47[_0x188b('0xb')],'source':_0x42dc47[_0x188b('0x17')],'destination':_0x42dc47['exten'],'destinationcontext':_0x42dc47[_0x188b('0x18')],'channel':_0x42dc47[_0x188b('0x15')],'starttime':utils[_0x188b('0x19')](),'answertime':null,'systemanswertime':null,'mohtime':0x0,'disposition':'NO\x20ANSWER','amaflags':_0x188b('0x1a')};}}catch(_0x5d14d0){utils[_0x188b('0x1b')](_0x5d14d0['stack']);}};exports[_0x188b('0x1c')]=function(_0x1ec3cb){try{if(!_[_0x188b('0x1d')](channels[_0x1ec3cb[_0x188b('0x9')]])&&_0x1ec3cb['channelstate']==0x6){if(_[_0x188b('0x1d')](channels[_0x1ec3cb[_0x188b('0x9')]][_0x188b('0x1e')])){channels[_0x1ec3cb[_0x188b('0x9')]]['systemanswertime']=utils[_0x188b('0x19')]();}}else if(!_['isNil'](channels[_0x1ec3cb['linkedid']])&&_0x1ec3cb[_0x188b('0x1f')]==0x6&&_0x1ec3cb[_0x188b('0x18')]!=_0x188b('0x20')){channels[_0x1ec3cb[_0x188b('0x14')]][_0x188b('0xb')]=_0x1ec3cb['accountcode'];channels[_0x1ec3cb['linkedid']]['destinationchannel']=_0x1ec3cb[_0x188b('0x15')];if(_[_0x188b('0x1d')](channels[_0x1ec3cb[_0x188b('0x14')]][_0x188b('0x21')])){channels[_0x1ec3cb[_0x188b('0x14')]][_0x188b('0x21')]=utils[_0x188b('0x19')]();}channels[_0x1ec3cb['linkedid']]['disposition']=dispositions[_['toNumber'](_0x1ec3cb['channelstate'])]||_0x188b('0x5');}}catch(_0xb7c1af){utils[_0x188b('0x1b')](_0xb7c1af[_0x188b('0x22')]);}};exports[_0x188b('0x23')]=function(_0x2026c9){try{if(!_[_0x188b('0x1d')](channels[_0x2026c9[_0x188b('0x9')]])){if(_[_0x188b('0x1d')](channels[_0x2026c9[_0x188b('0x9')]][_0x188b('0xe')])){channels[_0x2026c9['uniqueid']][_0x188b('0xe')]=_0x2026c9[_0x188b('0x24')]+'\x20<'+_0x2026c9[_0x188b('0x17')]+'>';}channels[_0x2026c9['uniqueid']]['endtime']=utils[_0x188b('0x19')]();channels[_0x2026c9[_0x188b('0x9')]][_0x188b('0x25')]=utils[_0x188b('0x26')](channels[_0x2026c9[_0x188b('0x9')]][_0x188b('0x27')],channels[_0x2026c9[_0x188b('0x9')]]['starttime']);channels[_0x2026c9['uniqueid']]['billableseconds']=channels[_0x2026c9[_0x188b('0x9')]][_0x188b('0x21')]?utils[_0x188b('0x26')](channels[_0x2026c9['uniqueid']][_0x188b('0x27')],channels[_0x2026c9[_0x188b('0x9')]][_0x188b('0x21')]):0x0;writeDB(channels[_0x2026c9['uniqueid']]);}}catch(_0x43590b){utils[_0x188b('0x1b')](_0x43590b[_0x188b('0x22')]);}};exports[_0x188b('0x28')]=function(_0x4949c8){try{if(!_[_0x188b('0x1d')](channels[_0x4949c8[_0x188b('0x29')]])){if(channels[_0x4949c8[_0x188b('0x29')]][_0x188b('0x15')]==_0x4949c8[_0x188b('0x2a')]){channels[_0x4949c8[_0x188b('0x29')]][_0x188b('0x2b')]=_0x4949c8[_0x188b('0x2c')];channels[_0x4949c8[_0x188b('0x29')]][_0x188b('0x2d')]=_0x188b('0x2e');}else if(channels[_0x4949c8['localtwolinkedid']][_0x188b('0x15')]=_0x4949c8['transfertargetchannel']){channels[_0x4949c8[_0x188b('0x29')]][_0x188b('0x2b')]=_0x4949c8[_0x188b('0x2f')];channels[_0x4949c8[_0x188b('0x29')]]['userfield']=_0x188b('0x2e');}}}catch(_0x432561){utils['error'](_0x432561[_0x188b('0x22')]);}};exports[_0x188b('0x30')]=function(_0x39acbb){try{if(!_['isNil'](channels[_0x39acbb['uniqueid']])){channels[_0x39acbb[_0x188b('0x9')]][_0x188b('0x31')]=utils[_0x188b('0x19')]();}}catch(_0x53fb22){utils[_0x188b('0x1b')](_0x53fb22[_0x188b('0x22')]);}};exports[_0x188b('0x32')]=function(_0x1c8be2){try{if(!_[_0x188b('0x1d')](channels[_0x1c8be2['uniqueid']])){if(!_[_0x188b('0x1d')](channels[_0x1c8be2[_0x188b('0x9')]][_0x188b('0x31')])){channels[_0x1c8be2['uniqueid']]['mohtime']+=utils[_0x188b('0x26')](utils[_0x188b('0x19')](),channels[_0x1c8be2[_0x188b('0x9')]][_0x188b('0x31')]);delete channels[_0x1c8be2[_0x188b('0x9')]][_0x188b('0x31')];}}}catch(_0x1abcb4){utils['error'](_0x1abcb4[_0x188b('0x22')]);}};exports['varset']=function(_0x308f64){try{if(!_[_0x188b('0x1d')](channels[_0x308f64[_0x188b('0x9')]])){if(!_['isNil'](_0x308f64['variable'][_0x188b('0x33')])){channels[_0x308f64['uniqueid']][_0x188b('0xc')]=_0x308f64[_0x188b('0x34')];}if(!_[_0x188b('0x1d')](_0x308f64[_0x188b('0x35')][_0x188b('0x36')])){channels[_0x308f64['uniqueid']][_0x188b('0xd')]=_0x308f64[_0x188b('0x34')];channels[_0x308f64[_0x188b('0x9')]][_0x188b('0xe')]='\x22'+_0x308f64[_0x188b('0x34')]+'\x22\x20<'+_0x308f64[_0x188b('0x34')]+'>';}if(!_[_0x188b('0x1d')](_0x308f64['variable'][_0x188b('0x37')])||!_[_0x188b('0x1d')](_0x308f64[_0x188b('0x35')][_0x188b('0x38')])){channels[_0x308f64['uniqueid']][_0x188b('0xe')]=_0x308f64[_0x188b('0x34')];}if(!_[_0x188b('0x1d')](_0x308f64[_0x188b('0x35')][_0x188b('0x39')])||!_['isNil'](_0x308f64['variable']['xmcs-queue'])){channels[_0x308f64[_0x188b('0x9')]]['lastapplication']=_0x188b('0x3a');channels[_0x308f64['uniqueid']]['lastdata']=_0x308f64['value'];channels[_0x308f64[_0x188b('0x9')]][_0x188b('0x3b')]=!![];}if(!_[_0x188b('0x1d')](_0x308f64['variable'][_0x188b('0x3c')])){channels[_0x308f64[_0x188b('0x9')]][_0x188b('0x3d')]=_0x308f64[_0x188b('0x34')];}if(!_['isNil'](_0x308f64['variable']['xmd-cdrtype'])){channels[_0x308f64[_0x188b('0x9')]][_0x188b('0xa')]=_0x308f64['value'];}if(!_[_0x188b('0x1d')](_0x308f64[_0x188b('0x35')][_0x188b('0x3e')])){channels[_0x308f64[_0x188b('0x9')]]['routeid']=_0x308f64[_0x188b('0x34')];}if(!_[_0x188b('0x1d')](_0x308f64['variable'][_0x188b('0x3f')])){channels[_0x308f64[_0x188b('0x9')]]['sipcallid']=_0x308f64['value'];}}}catch(_0x4f3593){utils[_0x188b('0x1b')](_0x4f3593[_0x188b('0x22')]);}};exports['newexten']=function(_0x4c5d59){try{if(!_[_0x188b('0x1d')](channels[_0x4c5d59[_0x188b('0x9')]])){if(_0x4c5d59['application'][_0x188b('0x40')]()==_0x188b('0x41')&&_[_0x188b('0x42')](_0x4c5d59['appdata'][_0x188b('0x40')](),_0x188b('0x43'))){var _0x536216=_0x4c5d59['appdata']['split']('=');var _0x556040=_0x536216[0x0][_0x188b('0x44')](_0x536216[0x0][_0x188b('0x45')]('(')+0x1,_0x536216[0x0][_0x188b('0x45')](')'));var _0xf8853b=_0x536216[0x1];channels[_0x4c5d59['uniqueid']][_0x556040]=_0xf8853b;}if(!_[_0x188b('0x46')]([_0x188b('0x23'),_0x188b('0x47'),_0x188b('0x48'),_0x188b('0x41'),_0x188b('0x49')],_0x4c5d59[_0x188b('0x4a')]['toLowerCase']())){channels[_0x4c5d59[_0x188b('0x9')]][_0x188b('0x4b')]=_0x4c5d59['application'];channels[_0x4c5d59['uniqueid']][_0x188b('0x4c')]=_0x4c5d59[_0x188b('0x4d')];}}}catch(_0x295e19){utils[_0x188b('0x1b')](_0x295e19[_0x188b('0x22')]);}}; \ No newline at end of file diff --git a/server/services/xdr/core.controller.js b/server/services/xdr/core.controller.js index 2b998dc..a74937d 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 _0x71ab=['lodash','info','shutdown','SHUTDOWN','fullybooted','FULLYBOOTED','error','close','CLOSE','managerevent'];(function(_0x43cd15,_0x549877){var _0x376b4c=function(_0x46ab05){while(--_0x46ab05){_0x43cd15['push'](_0x43cd15['shift']());}};_0x376b4c(++_0x549877);}(_0x71ab,0x64));var _0xb71a=function(_0x19e35c,_0x29cd1e){_0x19e35c=_0x19e35c-0x0;var _0x3e1fe8=_0x71ab[_0x19e35c];return _0x3e1fe8;};'use strict';var utils=require('./utils');var _=require(_0xb71a('0x0'));exports['connect']=function(){utils[_0xb71a('0x1')]('CONNECTED');};exports[_0xb71a('0x2')]=function(){utils[_0xb71a('0x1')](_0xb71a('0x3'));};exports[_0xb71a('0x4')]=function(){utils[_0xb71a('0x1')](_0xb71a('0x5'));};exports[_0xb71a('0x6')]=function(_0x38d931){utils[_0xb71a('0x6')](_0x38d931);};exports[_0xb71a('0x7')]=function(){utils[_0xb71a('0x1')](_0xb71a('0x8'));};exports[_0xb71a('0x9')]=function(_0x471ab6){}; \ No newline at end of file +var _0x1623=['./utils','info','CONNECTED','shutdown','SHUTDOWN','FULLYBOOTED','error','CLOSE','managerevent'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x1623,0xab));var _0x3162=function(_0x21503b,_0x618c1e){_0x21503b=_0x21503b-0x0;var _0x3bae8f=_0x1623[_0x21503b];return _0x3bae8f;};'use strict';var utils=require(_0x3162('0x0'));var _=require('lodash');exports['connect']=function(){utils[_0x3162('0x1')](_0x3162('0x2'));};exports[_0x3162('0x3')]=function(){utils[_0x3162('0x1')](_0x3162('0x4'));};exports['fullybooted']=function(){utils['info'](_0x3162('0x5'));};exports['error']=function(_0x1b55f2){utils[_0x3162('0x6')](_0x1b55f2);};exports['close']=function(){utils[_0x3162('0x1')](_0x3162('0x7'));};exports[_0x3162('0x8')]=function(_0x36609e){}; \ No newline at end of file diff --git a/server/services/xdr/dials.controller.js b/server/services/xdr/dials.controller.js index e8b45ee..1e9da5b 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 _0x12d4=['called','dialend','ANSWER','lastevent','connect','hangup','complete','diffTime','endtime','starttime','holdtime','answertime','./utils','info','format','uniqueid','connectedlinenum','dialstatus','request','CreateVoiceDialReport','toLowerCase','set','startsWith','appdata','cdr(routeid)','split','error','stack','varset','isNil','variable','outboundrouteid','value','dialbegin','assign','now'];(function(_0x18afbd,_0x426c25){var _0x1c252e=function(_0x295ddc){while(--_0x295ddc){_0x18afbd['push'](_0x18afbd['shift']());}};_0x1c252e(++_0x426c25);}(_0x12d4,0x1e0));var _0x412d=function(_0x70fd53,_0x2a95a6){_0x70fd53=_0x70fd53-0x0;var _0x4b71c5=_0x12d4[_0x70fd53];return _0x4b71c5;};'use strict';var _=require('lodash');var util=require('util');var utils=require(_0x412d('0x0'));var dials={};function writeDB(_0x41ae15){utils[_0x412d('0x1')](util[_0x412d('0x2')]('DIAL|%s|%s|%s|%s|%s|%s',_0x41ae15[_0x412d('0x3')],_0x41ae15['channel'],_0x41ae15['dialstring'],_0x41ae15['calleridnum'],_0x41ae15[_0x412d('0x4')],_0x41ae15[_0x412d('0x5')]));utils[_0x412d('0x6')](_0x412d('0x7'),_0x41ae15);delete dials[_0x41ae15[_0x412d('0x3')]];}exports['newexten']=function(_0x14b2dc){try{if(_0x14b2dc['application'][_0x412d('0x8')]()==_0x412d('0x9')&&_[_0x412d('0xa')](_0x14b2dc[_0x412d('0xb')][_0x412d('0x8')](),_0x412d('0xc'))){var _0x3e54e6=_0x14b2dc['appdata'][_0x412d('0xd')]('=');dials[_0x14b2dc['uniqueid']]={'routeId':_0x3e54e6[0x1]};}}catch(_0x2ac71c){utils[_0x412d('0xe')](_0x2ac71c[_0x412d('0xf')]);}};exports[_0x412d('0x10')]=function(_0x30a0cc){try{if(!_[_0x412d('0x11')](_0x30a0cc[_0x412d('0x12')][_0x412d('0x13')])){dials[_0x30a0cc[_0x412d('0x3')]]={'routeId':_0x30a0cc[_0x412d('0x14')]};}}catch(_0x1d3804){utils[_0x412d('0xe')](_0x1d3804[_0x412d('0xf')]);}};exports[_0x412d('0x15')]=function(_0x4425bf){try{if(!_[_0x412d('0x11')](dials[_0x4425bf[_0x412d('0x3')]])){dials[_0x4425bf[_0x412d('0x3')]]=_[_0x412d('0x16')](dials[_0x4425bf[_0x412d('0x3')]],_0x4425bf);dials[_0x4425bf[_0x412d('0x3')]]['starttime']=utils[_0x412d('0x17')]();dials[_0x4425bf[_0x412d('0x3')]]['lastevent']=_0x412d('0x18');}}catch(_0x19b91c){utils[_0x412d('0xe')](_0x19b91c['stack']);}};exports[_0x412d('0x19')]=function(_0x5f018d){try{if(!_['isNil'](dials[_0x5f018d[_0x412d('0x3')]])){dials[_0x5f018d[_0x412d('0x3')]][_0x412d('0x5')]=_0x5f018d[_0x412d('0x5')];if(_0x5f018d[_0x412d('0x5')]==_0x412d('0x1a')){dials[_0x5f018d['uniqueid']]=_[_0x412d('0x16')](dials[_0x5f018d[_0x412d('0x3')]],_0x5f018d);dials[_0x5f018d[_0x412d('0x3')]]['answertime']=utils[_0x412d('0x17')]();dials[_0x5f018d[_0x412d('0x3')]][_0x412d('0x1b')]=_0x412d('0x1c');}}}catch(_0x7f414f){utils[_0x412d('0xe')](_0x7f414f[_0x412d('0xf')]);}};exports[_0x412d('0x1d')]=function(_0x216cec){try{if(!_[_0x412d('0x11')](dials[_0x216cec[_0x412d('0x3')]])){dials[_0x216cec[_0x412d('0x3')]]=_[_0x412d('0x16')](dials[_0x216cec[_0x412d('0x3')]],{'endtime':utils[_0x412d('0x17')](),'lastevent':_0x412d('0x1e')});dials[_0x216cec[_0x412d('0x3')]]['duration']=utils[_0x412d('0x1f')](dials[_0x216cec[_0x412d('0x3')]][_0x412d('0x20')],dials[_0x216cec[_0x412d('0x3')]][_0x412d('0x21')]);dials[_0x216cec[_0x412d('0x3')]][_0x412d('0x22')]=utils[_0x412d('0x1f')](dials[_0x216cec[_0x412d('0x3')]][_0x412d('0x23')]||dials[_0x216cec[_0x412d('0x3')]][_0x412d('0x20')],dials[_0x216cec[_0x412d('0x3')]]['starttime']);dials[_0x216cec['uniqueid']]['billableseconds']=dials[_0x216cec[_0x412d('0x3')]][_0x412d('0x23')]?utils['diffTime'](dials[_0x216cec[_0x412d('0x3')]][_0x412d('0x20')],dials[_0x216cec[_0x412d('0x3')]][_0x412d('0x23')]):0x0;writeDB(dials[_0x216cec[_0x412d('0x3')]]);}}catch(_0x1ba9c3){utils['error'](_0x1ba9c3[_0x412d('0xf')]);}}; \ No newline at end of file +var _0x4410=['DIAL|%s|%s|%s|%s|%s|%s','uniqueid','channel','dialstring','calleridnum','connectedlinenum','dialstatus','request','CreateVoiceDialReport','newexten','application','toLowerCase','set','startsWith','appdata','cdr(routeid)','split','stack','varset','variable','outboundrouteid','value','error','dialbegin','isNil','assign','now','called','dialend','ANSWER','answertime','lastevent','connect','hangup','complete','duration','diffTime','endtime','starttime','billableseconds','lodash','util','./utils','info','format'];(function(_0x618414,_0x1a7a60){var _0x21c19a=function(_0x507b17){while(--_0x507b17){_0x618414['push'](_0x618414['shift']());}};_0x21c19a(++_0x1a7a60);}(_0x4410,0x136));var _0x0441=function(_0x401676,_0x3f1436){_0x401676=_0x401676-0x0;var _0x4f13fe=_0x4410[_0x401676];return _0x4f13fe;};'use strict';var _=require(_0x0441('0x0'));var util=require(_0x0441('0x1'));var utils=require(_0x0441('0x2'));var dials={};function writeDB(_0x1a08df){utils[_0x0441('0x3')](util[_0x0441('0x4')](_0x0441('0x5'),_0x1a08df[_0x0441('0x6')],_0x1a08df[_0x0441('0x7')],_0x1a08df[_0x0441('0x8')],_0x1a08df[_0x0441('0x9')],_0x1a08df[_0x0441('0xa')],_0x1a08df[_0x0441('0xb')]));utils[_0x0441('0xc')](_0x0441('0xd'),_0x1a08df);delete dials[_0x1a08df['uniqueid']];}exports[_0x0441('0xe')]=function(_0x5e1abf){try{if(_0x5e1abf[_0x0441('0xf')][_0x0441('0x10')]()==_0x0441('0x11')&&_[_0x0441('0x12')](_0x5e1abf[_0x0441('0x13')]['toLowerCase'](),_0x0441('0x14'))){var _0x1364bc=_0x5e1abf[_0x0441('0x13')][_0x0441('0x15')]('=');dials[_0x5e1abf['uniqueid']]={'routeId':_0x1364bc[0x1]};}}catch(_0x3cadfd){utils['error'](_0x3cadfd[_0x0441('0x16')]);}};exports[_0x0441('0x17')]=function(_0x3c911c){try{if(!_['isNil'](_0x3c911c[_0x0441('0x18')][_0x0441('0x19')])){dials[_0x3c911c['uniqueid']]={'routeId':_0x3c911c[_0x0441('0x1a')]};}}catch(_0xebdba5){utils[_0x0441('0x1b')](_0xebdba5[_0x0441('0x16')]);}};exports[_0x0441('0x1c')]=function(_0x19b6b7){try{if(!_[_0x0441('0x1d')](dials[_0x19b6b7[_0x0441('0x6')]])){dials[_0x19b6b7[_0x0441('0x6')]]=_[_0x0441('0x1e')](dials[_0x19b6b7['uniqueid']],_0x19b6b7);dials[_0x19b6b7[_0x0441('0x6')]]['starttime']=utils[_0x0441('0x1f')]();dials[_0x19b6b7['uniqueid']]['lastevent']=_0x0441('0x20');}}catch(_0x49e32d){utils['error'](_0x49e32d[_0x0441('0x16')]);}};exports[_0x0441('0x21')]=function(_0x35a0c7){try{if(!_[_0x0441('0x1d')](dials[_0x35a0c7[_0x0441('0x6')]])){dials[_0x35a0c7[_0x0441('0x6')]][_0x0441('0xb')]=_0x35a0c7['dialstatus'];if(_0x35a0c7[_0x0441('0xb')]==_0x0441('0x22')){dials[_0x35a0c7[_0x0441('0x6')]]=_[_0x0441('0x1e')](dials[_0x35a0c7[_0x0441('0x6')]],_0x35a0c7);dials[_0x35a0c7['uniqueid']][_0x0441('0x23')]=utils[_0x0441('0x1f')]();dials[_0x35a0c7[_0x0441('0x6')]][_0x0441('0x24')]=_0x0441('0x25');}}}catch(_0xd945ee){utils[_0x0441('0x1b')](_0xd945ee[_0x0441('0x16')]);}};exports[_0x0441('0x26')]=function(_0x557e7c){try{if(!_['isNil'](dials[_0x557e7c['uniqueid']])){dials[_0x557e7c[_0x0441('0x6')]]=_[_0x0441('0x1e')](dials[_0x557e7c[_0x0441('0x6')]],{'endtime':utils[_0x0441('0x1f')](),'lastevent':_0x0441('0x27')});dials[_0x557e7c['uniqueid']][_0x0441('0x28')]=utils[_0x0441('0x29')](dials[_0x557e7c['uniqueid']][_0x0441('0x2a')],dials[_0x557e7c[_0x0441('0x6')]]['starttime']);dials[_0x557e7c[_0x0441('0x6')]]['holdtime']=utils[_0x0441('0x29')](dials[_0x557e7c[_0x0441('0x6')]][_0x0441('0x23')]||dials[_0x557e7c[_0x0441('0x6')]][_0x0441('0x2a')],dials[_0x557e7c[_0x0441('0x6')]][_0x0441('0x2b')]);dials[_0x557e7c[_0x0441('0x6')]][_0x0441('0x2c')]=dials[_0x557e7c[_0x0441('0x6')]][_0x0441('0x23')]?utils['diffTime'](dials[_0x557e7c[_0x0441('0x6')]][_0x0441('0x2a')],dials[_0x557e7c[_0x0441('0x6')]][_0x0441('0x23')]):0x0;writeDB(dials[_0x557e7c[_0x0441('0x6')]]);}}catch(_0x13cc7f){utils[_0x0441('0x1b')](_0x13cc7f[_0x0441('0x16')]);}}; \ No newline at end of file diff --git a/server/services/xdr/index.js b/server/services/xdr/index.js index 94f7378..4d39aa5 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 _0x3b1d=['fullybooted','error','close','managerevent','devicestatechange','agentcalled','agentringnoanswer','agentconnect','agentcomplete','queuecallerabandon','queuecallerjoin','queuecallerleave','musiconholdstart','musiconholdstop','newstate','hangup','cdr','blindtransfer','attendedtransfer','varset','newexten','newchannel','dialbegin','dialend','../../config/environment','./utils','asterisk','username','password','keepConnected','xdr','info','XDR\x20DISABLED','./calls.controller','./recordings.controller','./dials.controller','./transfers.controller','connect','shutdown'];(function(_0x59d89e,_0x55edf5){var _0x554e93=function(_0x3d40bc){while(--_0x3d40bc){_0x59d89e['push'](_0x59d89e['shift']());}};_0x554e93(++_0x55edf5);}(_0x3b1d,0x150));var _0xd3b1=function(_0x51020b,_0x38c2c7){_0x51020b=_0x51020b-0x0;var _0x371e47=_0x3b1d[_0x51020b];return _0x371e47;};var AsteriskManager=require('asterisk-manager');var config=require(_0xd3b1('0x0'));var utils=require(_0xd3b1('0x1'));var ami=new AsteriskManager(config[_0xd3b1('0x2')]['port'],config[_0xd3b1('0x2')]['ip'],config[_0xd3b1('0x2')][_0xd3b1('0x3')],config['asterisk'][_0xd3b1('0x4')],!![]);ami[_0xd3b1('0x5')]();if(config[_0xd3b1('0x6')]&&config[_0xd3b1('0x6')]['disabled']){utils[_0xd3b1('0x7')](_0xd3b1('0x8'));}else{var agents=require('./agents.controller');var calls=require(_0xd3b1('0x9'));var queues=require('./queues.controller');var recordings=require(_0xd3b1('0xa'));var members=require('./members.controller');var dials=require(_0xd3b1('0xb'));var transfers=require(_0xd3b1('0xc'));var core=require('./core.controller');ami['on'](_0xd3b1('0xd'),core[_0xd3b1('0xd')]);ami['on'](_0xd3b1('0xe'),core[_0xd3b1('0xe')]);ami['on'](_0xd3b1('0xf'),core[_0xd3b1('0xf')]);ami['on'](_0xd3b1('0x10'),core[_0xd3b1('0x10')]);ami['on'](_0xd3b1('0x11'),core[_0xd3b1('0x11')]);ami['on'](_0xd3b1('0x12'),core['managerevent']);ami['on']('devicestatechange',function(_0x1b6442){try{members[_0xd3b1('0x13')](_0x1b6442);}catch(_0x2be633){utils[_0xd3b1('0x10')](_0x2be633);}});ami['on']('agentcalled',function(_0x11a784){try{agents[_0xd3b1('0x14')](_0x11a784);}catch(_0x37b0a2){utils[_0xd3b1('0x10')](_0x37b0a2);}});ami['on'](_0xd3b1('0x15'),function(_0x309a14){try{agents[_0xd3b1('0x15')](_0x309a14);}catch(_0x139a80){utils[_0xd3b1('0x10')](_0x139a80);}});ami['on'](_0xd3b1('0x16'),function(_0x10ff7d){try{agents[_0xd3b1('0x16')](_0x10ff7d);queues[_0xd3b1('0x16')](_0x10ff7d);}catch(_0x1a26b4){utils[_0xd3b1('0x10')](_0x1a26b4);}});ami['on'](_0xd3b1('0x17'),function(_0x16ccac){try{agents['agentcomplete'](_0x16ccac);queues[_0xd3b1('0x17')](_0x16ccac);members[_0xd3b1('0x17')](_0x16ccac);}catch(_0x3f27ba){utils[_0xd3b1('0x10')](_0x3f27ba);}});ami['on'](_0xd3b1('0x18'),function(_0x22d67a){try{agents[_0xd3b1('0x18')](_0x22d67a);queues['queuecallerabandon'](_0x22d67a);}catch(_0x5ef55d){utils[_0xd3b1('0x10')](_0x5ef55d);}});ami['on'](_0xd3b1('0x19'),function(_0x5a21f7){try{queues[_0xd3b1('0x19')](_0x5a21f7);recordings[_0xd3b1('0x19')](_0x5a21f7);}catch(_0x3ee93b){utils[_0xd3b1('0x10')](_0x3ee93b);}});ami['on'](_0xd3b1('0x1a'),function(_0x2637f1){try{queues[_0xd3b1('0x1a')](_0x2637f1);}catch(_0x4ffcc3){utils[_0xd3b1('0x10')](_0x4ffcc3);}});ami['on'](_0xd3b1('0x1b'),function(_0x3831f4){try{queues['musiconholdstart'](_0x3831f4);calls[_0xd3b1('0x1b')](_0x3831f4);}catch(_0x4bdf53){utils[_0xd3b1('0x10')](_0x4bdf53);}});ami['on'](_0xd3b1('0x1c'),function(_0x5126f2){try{queues['musiconholdstop'](_0x5126f2);calls['musiconholdstop'](_0x5126f2);}catch(_0x45da78){utils['error'](_0x45da78);}});ami['on'](_0xd3b1('0x1d'),function(_0x319129){try{calls[_0xd3b1('0x1d')](_0x319129);recordings[_0xd3b1('0x1d')](_0x319129);}catch(_0x26f521){utils['error'](_0x26f521);}});ami['on'](_0xd3b1('0x1e'),function(_0x266163){try{calls[_0xd3b1('0x1e')](_0x266163);recordings[_0xd3b1('0x1e')](_0x266163);dials[_0xd3b1('0x1e')](_0x266163);agents['hangup'](_0x266163);queues[_0xd3b1('0x1e')](_0x266163);}catch(_0x149728){utils[_0xd3b1('0x10')](_0x149728);}});ami['on'](_0xd3b1('0x1f'),function(_0x2569af){try{members['cdr'](_0x2569af);}catch(_0xa3aa3){utils[_0xd3b1('0x10')](_0xa3aa3);}});ami['on'](_0xd3b1('0x20'),function(_0x2ca8e8){try{queues[_0xd3b1('0x20')](_0x2ca8e8);agents[_0xd3b1('0x20')](_0x2ca8e8);transfers[_0xd3b1('0x20')](_0x2ca8e8);}catch(_0x4f3f8d){utils[_0xd3b1('0x10')](_0x4f3f8d);}});ami['on'](_0xd3b1('0x21'),function(_0x37aa85){try{queues[_0xd3b1('0x21')](_0x37aa85);transfers[_0xd3b1('0x21')](_0x37aa85);agents[_0xd3b1('0x21')](_0x37aa85);calls[_0xd3b1('0x21')](_0x37aa85);}catch(_0x23683b){utils['error'](_0x23683b);}});ami['on'](_0xd3b1('0x22'),function(_0x27575e){try{queues[_0xd3b1('0x22')](_0x27575e);recordings[_0xd3b1('0x22')](_0x27575e);calls[_0xd3b1('0x22')](_0x27575e);dials[_0xd3b1('0x22')](_0x27575e);}catch(_0x7d4760){utils[_0xd3b1('0x10')](_0x7d4760);}});ami['on'](_0xd3b1('0x23'),function(_0x4115f5){try{calls['newexten'](_0x4115f5);recordings[_0xd3b1('0x23')](_0x4115f5);dials[_0xd3b1('0x23')](_0x4115f5);}catch(_0x47c671){utils[_0xd3b1('0x10')](_0x47c671);}});ami['on']('newchannel',function(_0x3a469c){try{calls[_0xd3b1('0x24')](_0x3a469c);recordings['newchannel'](_0x3a469c);}catch(_0xe4f6b1){utils[_0xd3b1('0x10')](_0xe4f6b1);}});ami['on'](_0xd3b1('0x25'),function(_0x26931f){try{dials['dialbegin'](_0x26931f);}catch(_0x1b16ad){utils[_0xd3b1('0x10')](_0x1b16ad);}});ami['on']('dialend',function(_0x1e471a){try{dials[_0xd3b1('0x26')](_0x1e471a);}catch(_0xe6e86a){utils[_0xd3b1('0x10')](_0xe6e86a);}});} \ No newline at end of file +var _0xd626=['password','xdr','info','XDR\x20DISABLED','./agents.controller','./recordings.controller','./dials.controller','./core.controller','connect','shutdown','fullybooted','error','close','managerevent','devicestatechange','agentcalled','agentringnoanswer','agentconnect','agentcomplete','queuecallerabandon','queuecallerjoin','queuecallerleave','musiconholdstart','musiconholdstop','newstate','hangup','cdr','blindtransfer','attendedtransfer','varset','newexten','newchannel','dialbegin','dialend','asterisk-manager','../../config/environment','./utils','asterisk'];(function(_0x697cf2,_0x3ea1f9){var _0xdabd33=function(_0x554982){while(--_0x554982){_0x697cf2['push'](_0x697cf2['shift']());}};_0xdabd33(++_0x3ea1f9);}(_0xd626,0x19e));var _0x6d62=function(_0x13b0ce,_0x188ea1){_0x13b0ce=_0x13b0ce-0x0;var _0x22d2af=_0xd626[_0x13b0ce];return _0x22d2af;};var AsteriskManager=require(_0x6d62('0x0'));var config=require(_0x6d62('0x1'));var utils=require(_0x6d62('0x2'));var ami=new AsteriskManager(config[_0x6d62('0x3')]['port'],config[_0x6d62('0x3')]['ip'],config[_0x6d62('0x3')]['username'],config[_0x6d62('0x3')][_0x6d62('0x4')],!![]);ami['keepConnected']();if(config[_0x6d62('0x5')]&&config['xdr']['disabled']){utils[_0x6d62('0x6')](_0x6d62('0x7'));}else{var agents=require(_0x6d62('0x8'));var calls=require('./calls.controller');var queues=require('./queues.controller');var recordings=require(_0x6d62('0x9'));var members=require('./members.controller');var dials=require(_0x6d62('0xa'));var transfers=require('./transfers.controller');var core=require(_0x6d62('0xb'));ami['on'](_0x6d62('0xc'),core[_0x6d62('0xc')]);ami['on']('shutdown',core[_0x6d62('0xd')]);ami['on'](_0x6d62('0xe'),core[_0x6d62('0xe')]);ami['on'](_0x6d62('0xf'),core[_0x6d62('0xf')]);ami['on']('close',core[_0x6d62('0x10')]);ami['on'](_0x6d62('0x11'),core[_0x6d62('0x11')]);ami['on'](_0x6d62('0x12'),function(_0x44c28d){try{members[_0x6d62('0x12')](_0x44c28d);}catch(_0x4817cc){utils[_0x6d62('0xf')](_0x4817cc);}});ami['on'](_0x6d62('0x13'),function(_0x20fabc){try{agents[_0x6d62('0x13')](_0x20fabc);}catch(_0x5d09e8){utils['error'](_0x5d09e8);}});ami['on'](_0x6d62('0x14'),function(_0x1a8487){try{agents[_0x6d62('0x14')](_0x1a8487);}catch(_0x14fec9){utils[_0x6d62('0xf')](_0x14fec9);}});ami['on']('agentconnect',function(_0x363397){try{agents[_0x6d62('0x15')](_0x363397);queues[_0x6d62('0x15')](_0x363397);}catch(_0xe8d8c3){utils[_0x6d62('0xf')](_0xe8d8c3);}});ami['on'](_0x6d62('0x16'),function(_0x402f18){try{agents['agentcomplete'](_0x402f18);queues[_0x6d62('0x16')](_0x402f18);members[_0x6d62('0x16')](_0x402f18);}catch(_0xd15c96){utils['error'](_0xd15c96);}});ami['on'](_0x6d62('0x17'),function(_0x26d590){try{agents[_0x6d62('0x17')](_0x26d590);queues[_0x6d62('0x17')](_0x26d590);}catch(_0x2a5604){utils[_0x6d62('0xf')](_0x2a5604);}});ami['on'](_0x6d62('0x18'),function(_0x18b1de){try{queues['queuecallerjoin'](_0x18b1de);recordings[_0x6d62('0x18')](_0x18b1de);}catch(_0x4fe761){utils[_0x6d62('0xf')](_0x4fe761);}});ami['on'](_0x6d62('0x19'),function(_0x36c8ea){try{queues[_0x6d62('0x19')](_0x36c8ea);}catch(_0x40b7d9){utils[_0x6d62('0xf')](_0x40b7d9);}});ami['on'](_0x6d62('0x1a'),function(_0x2f56f8){try{queues[_0x6d62('0x1a')](_0x2f56f8);calls[_0x6d62('0x1a')](_0x2f56f8);}catch(_0x3ab511){utils[_0x6d62('0xf')](_0x3ab511);}});ami['on'](_0x6d62('0x1b'),function(_0x249cca){try{queues['musiconholdstop'](_0x249cca);calls[_0x6d62('0x1b')](_0x249cca);}catch(_0x3cefa3){utils[_0x6d62('0xf')](_0x3cefa3);}});ami['on']('newstate',function(_0xade7cf){try{calls[_0x6d62('0x1c')](_0xade7cf);recordings['newstate'](_0xade7cf);}catch(_0x4974a3){utils[_0x6d62('0xf')](_0x4974a3);}});ami['on'](_0x6d62('0x1d'),function(_0x524305){try{calls[_0x6d62('0x1d')](_0x524305);recordings['hangup'](_0x524305);dials['hangup'](_0x524305);agents['hangup'](_0x524305);queues[_0x6d62('0x1d')](_0x524305);}catch(_0x166b7a){utils[_0x6d62('0xf')](_0x166b7a);}});ami['on'](_0x6d62('0x1e'),function(_0x3e6212){try{members[_0x6d62('0x1e')](_0x3e6212);}catch(_0x285353){utils[_0x6d62('0xf')](_0x285353);}});ami['on']('blindtransfer',function(_0x455c0f){try{queues['blindtransfer'](_0x455c0f);agents[_0x6d62('0x1f')](_0x455c0f);transfers[_0x6d62('0x1f')](_0x455c0f);}catch(_0x2ecd97){utils[_0x6d62('0xf')](_0x2ecd97);}});ami['on'](_0x6d62('0x20'),function(_0x126f43){try{queues[_0x6d62('0x20')](_0x126f43);transfers[_0x6d62('0x20')](_0x126f43);agents[_0x6d62('0x20')](_0x126f43);calls['attendedtransfer'](_0x126f43);}catch(_0x11b59a){utils[_0x6d62('0xf')](_0x11b59a);}});ami['on'](_0x6d62('0x21'),function(_0x123894){try{queues[_0x6d62('0x21')](_0x123894);recordings['varset'](_0x123894);calls['varset'](_0x123894);dials[_0x6d62('0x21')](_0x123894);}catch(_0x1fb7f2){utils['error'](_0x1fb7f2);}});ami['on'](_0x6d62('0x22'),function(_0x7f0810){try{calls[_0x6d62('0x22')](_0x7f0810);recordings['newexten'](_0x7f0810);dials[_0x6d62('0x22')](_0x7f0810);}catch(_0x116fbf){utils[_0x6d62('0xf')](_0x116fbf);}});ami['on'](_0x6d62('0x23'),function(_0x29afd2){try{calls[_0x6d62('0x23')](_0x29afd2);recordings[_0x6d62('0x23')](_0x29afd2);}catch(_0x324e69){utils[_0x6d62('0xf')](_0x324e69);}});ami['on']('dialbegin',function(_0x424965){try{dials[_0x6d62('0x24')](_0x424965);}catch(_0x23a4a4){utils[_0x6d62('0xf')](_0x23a4a4);}});ami['on'](_0x6d62('0x25'),function(_0x2f34ce){try{dials[_0x6d62('0x25')](_0x2f34ce);}catch(_0x29f1cc){utils['error'](_0x29f1cc);}});} \ No newline at end of file diff --git a/server/services/xdr/members.controller.js b/server/services/xdr/members.controller.js index a4c93ed..c00b4d3 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 _0x54f6=['CreateMemberReport','getUserByName','split','catch','some','startsWith','devicestatechange','state','INUSE','device','voice','TALKING','agent','NOT_INUSE','isNil','duration','diffTime','exitAt','enterAt','uniqueid','agentcomplete','assign','queue','cdr','data1','source','data3','destination','util','Local/_attended@transfer','Queue:','info','format','MEMBER|%s|%s|%s|%s|%s|%s','channel','data2','membername','type','interface','getUserByInterface','then','name','internal','request'];(function(_0x1969a7,_0x5a133a){var _0x3d665f=function(_0x39c64b){while(--_0x39c64b){_0x1969a7['push'](_0x1969a7['shift']());}};_0x3d665f(++_0x5a133a);}(_0x54f6,0x1a8));var _0x654f=function(_0x1af63a,_0x4c8b3b){_0x1af63a=_0x1af63a-0x0;var _0xe423df=_0x54f6[_0x1af63a];return _0xe423df;};'use strict';var _=require('lodash');var util=require(_0x654f('0x0'));var utils=require('./utils');var members={};var exclude=[_0x654f('0x1'),_0x654f('0x2')];function writeDB(_0x3c2753){utils[_0x654f('0x3')](util[_0x654f('0x4')](_0x654f('0x5'),_0x3c2753['uniqueid'],_0x3c2753['interface'],_0x3c2753[_0x654f('0x6')],_0x3c2753[_0x654f('0x7')],_0x3c2753[_0x654f('0x8')],_0x3c2753[_0x654f('0x9')]));if(_0x3c2753[_0x654f('0xa')]){utils[_0x654f('0xb')](_0x3c2753[_0x654f('0xa')])[_0x654f('0xc')](function(_0x2546ae){if(_0x2546ae){_0x3c2753[_0x654f('0x8')]=_0x2546ae[_0x654f('0xd')];_0x3c2753['internal']=_0x2546ae[_0x654f('0xe')];utils[_0x654f('0xf')](_0x654f('0x10'),_0x3c2753);}else{utils[_0x654f('0x11')](_0x3c2753[_0x654f('0xa')][_0x654f('0x12')]('/')[0x1])[_0x654f('0xc')](function(_0x5462f6){if(_0x5462f6){_0x3c2753[_0x654f('0x8')]=_0x5462f6[_0x654f('0xd')];_0x3c2753[_0x654f('0xe')]=_0x5462f6[_0x654f('0xe')];utils[_0x654f('0xf')](_0x654f('0x10'),_0x3c2753);}});}})[_0x654f('0x13')](function(_0x14dce7){utils['error'](_0x14dce7);});}delete members[_0x3c2753[_0x654f('0xa')]];}function startsWith(_0x20c7d7,_0x129512){return _[_0x654f('0x14')](_0x20c7d7,function(_0x38fef8){return _[_0x654f('0x15')](_0x129512,_0x38fef8);});}exports[_0x654f('0x16')]=function(_0x1c82b5){switch(_0x1c82b5[_0x654f('0x17')]){case _0x654f('0x18'):case'BUSY':if(!startsWith(exclude,_0x1c82b5[_0x654f('0x19')])){members[_0x1c82b5[_0x654f('0x19')]]={'channel':_0x654f('0x1a'),'interface':_0x1c82b5[_0x654f('0x19')],'type':_0x654f('0x1b'),'enterAt':utils['now'](),'role':_0x654f('0x1c')};}break;case _0x654f('0x1d'):if(!_[_0x654f('0x1e')](members[_0x1c82b5['device']])){members[_0x1c82b5[_0x654f('0x19')]]['exitAt']=utils['now']();members[_0x1c82b5['device']][_0x654f('0x1f')]=utils[_0x654f('0x20')](members[_0x1c82b5[_0x654f('0x19')]][_0x654f('0x21')],members[_0x1c82b5[_0x654f('0x19')]][_0x654f('0x22')]);if(members[_0x1c82b5['device']][_0x654f('0x23')]){writeDB(members[_0x1c82b5[_0x654f('0x19')]]);}}default:break;}};exports[_0x654f('0x24')]=function(_0x4e6f7a){if(!_[_0x654f('0x1e')](members[_0x4e6f7a[_0x654f('0xa')]])){members[_0x4e6f7a[_0x654f('0xa')]]=_[_0x654f('0x25')](members[_0x4e6f7a[_0x654f('0xa')]],{'data4':_0x4e6f7a[_0x654f('0x26')],'uniqueid':_0x4e6f7a[_0x654f('0x23')]});}};exports[_0x654f('0x27')]=function(_0xec5e57){if(_0xec5e57[_0x654f('0x6')]){var _0x22cabe=_0xec5e57[_0x654f('0x6')][_0x654f('0x12')]('-')[0x0];if(!_[_0x654f('0x1e')](members[_0x22cabe])){members[_0x22cabe]=_[_0x654f('0x25')](members[_0x22cabe],{'data1':members[_0x22cabe][_0x654f('0x28')]||_0xec5e57[_0x654f('0x9')],'data2':members[_0x22cabe][_0x654f('0x7')]||_0xec5e57[_0x654f('0x29')],'data3':members[_0x22cabe]['data3']||_0xec5e57['destination'],'uniqueid':members[_0x22cabe]['uniqueid']||_0xec5e57['uniqueid']});if(members[_0x22cabe]['exitAt']){writeDB(members[_0x22cabe]);}}}if(_0xec5e57['destinationchannel']){var _0x4fb3f8=_0xec5e57['destinationchannel']['split']('-')[0x0];if(!_[_0x654f('0x1e')](members[_0x4fb3f8])){members[_0x4fb3f8]=_[_0x654f('0x25')](members[_0x4fb3f8],{'data1':members[_0x4fb3f8][_0x654f('0x28')]||_0xec5e57['type'],'data2':members[_0x4fb3f8]['data2']||_0xec5e57[_0x654f('0x29')],'data3':members[_0x4fb3f8][_0x654f('0x2a')]||_0xec5e57[_0x654f('0x2b')],'uniqueid':members[_0x4fb3f8][_0x654f('0x23')]||_0xec5e57['uniqueid']});if(members[_0x4fb3f8][_0x654f('0x21')]){writeDB(members[_0x4fb3f8]);}}}}; \ No newline at end of file +var _0x9158=['TALKING','NOT_INUSE','exitAt','duration','diffTime','isNil','queue','uniqueid','cdr','data1','source','data3','destination','destinationchannel','assign','lodash','util','./utils','Queue:','info','interface','channel','data2','membername','type','getUserByInterface','then','internal','request','getUserByName','split','name','CreateMemberReport','catch','error','some','devicestatechange','state','BUSY','device','voice'];(function(_0x4474a1,_0x3c8cc3){var _0x1b4dd5=function(_0x3c342f){while(--_0x3c342f){_0x4474a1['push'](_0x4474a1['shift']());}};_0x1b4dd5(++_0x3c8cc3);}(_0x9158,0xdc));var _0x8915=function(_0x3a4bea,_0x1fe65d){_0x3a4bea=_0x3a4bea-0x0;var _0x5b7d4c=_0x9158[_0x3a4bea];return _0x5b7d4c;};'use strict';var _=require(_0x8915('0x0'));var util=require(_0x8915('0x1'));var utils=require(_0x8915('0x2'));var members={};var exclude=['Local/_attended@transfer',_0x8915('0x3')];function writeDB(_0x481899){utils[_0x8915('0x4')](util['format']('MEMBER|%s|%s|%s|%s|%s|%s',_0x481899['uniqueid'],_0x481899[_0x8915('0x5')],_0x481899[_0x8915('0x6')],_0x481899[_0x8915('0x7')],_0x481899[_0x8915('0x8')],_0x481899[_0x8915('0x9')]));if(_0x481899[_0x8915('0x5')]){utils[_0x8915('0xa')](_0x481899[_0x8915('0x5')])[_0x8915('0xb')](function(_0x2b03f3){if(_0x2b03f3){_0x481899['membername']=_0x2b03f3['name'];_0x481899[_0x8915('0xc')]=_0x2b03f3[_0x8915('0xc')];utils[_0x8915('0xd')]('CreateMemberReport',_0x481899);}else{utils[_0x8915('0xe')](_0x481899[_0x8915('0x5')][_0x8915('0xf')]('/')[0x1])['then'](function(_0x5e741b){if(_0x5e741b){_0x481899[_0x8915('0x8')]=_0x5e741b[_0x8915('0x10')];_0x481899[_0x8915('0xc')]=_0x5e741b[_0x8915('0xc')];utils[_0x8915('0xd')](_0x8915('0x11'),_0x481899);}});}})[_0x8915('0x12')](function(_0x4b655d){utils[_0x8915('0x13')](_0x4b655d);});}delete members[_0x481899[_0x8915('0x5')]];}function startsWith(_0x3e1a11,_0x5ba191){return _[_0x8915('0x14')](_0x3e1a11,function(_0x16dee2){return _['startsWith'](_0x5ba191,_0x16dee2);});}exports[_0x8915('0x15')]=function(_0x5e72de){switch(_0x5e72de[_0x8915('0x16')]){case'INUSE':case _0x8915('0x17'):if(!startsWith(exclude,_0x5e72de[_0x8915('0x18')])){members[_0x5e72de[_0x8915('0x18')]]={'channel':_0x8915('0x19'),'interface':_0x5e72de['device'],'type':_0x8915('0x1a'),'enterAt':utils['now'](),'role':'agent'};}break;case _0x8915('0x1b'):if(!_['isNil'](members[_0x5e72de[_0x8915('0x18')]])){members[_0x5e72de[_0x8915('0x18')]][_0x8915('0x1c')]=utils['now']();members[_0x5e72de[_0x8915('0x18')]][_0x8915('0x1d')]=utils[_0x8915('0x1e')](members[_0x5e72de[_0x8915('0x18')]][_0x8915('0x1c')],members[_0x5e72de[_0x8915('0x18')]]['enterAt']);if(members[_0x5e72de[_0x8915('0x18')]]['uniqueid']){writeDB(members[_0x5e72de['device']]);}}default:break;}};exports['agentcomplete']=function(_0x45d66d){if(!_[_0x8915('0x1f')](members[_0x45d66d[_0x8915('0x5')]])){members[_0x45d66d['interface']]=_['assign'](members[_0x45d66d[_0x8915('0x5')]],{'data4':_0x45d66d[_0x8915('0x20')],'uniqueid':_0x45d66d[_0x8915('0x21')]});}};exports[_0x8915('0x22')]=function(_0x3927f2){if(_0x3927f2[_0x8915('0x6')]){var _0x5279bb=_0x3927f2[_0x8915('0x6')][_0x8915('0xf')]('-')[0x0];if(!_[_0x8915('0x1f')](members[_0x5279bb])){members[_0x5279bb]=_['assign'](members[_0x5279bb],{'data1':members[_0x5279bb][_0x8915('0x23')]||_0x3927f2[_0x8915('0x9')],'data2':members[_0x5279bb]['data2']||_0x3927f2[_0x8915('0x24')],'data3':members[_0x5279bb][_0x8915('0x25')]||_0x3927f2[_0x8915('0x26')],'uniqueid':members[_0x5279bb]['uniqueid']||_0x3927f2['uniqueid']});if(members[_0x5279bb][_0x8915('0x1c')]){writeDB(members[_0x5279bb]);}}}if(_0x3927f2[_0x8915('0x27')]){var _0x5c3818=_0x3927f2[_0x8915('0x27')]['split']('-')[0x0];if(!_['isNil'](members[_0x5c3818])){members[_0x5c3818]=_[_0x8915('0x28')](members[_0x5c3818],{'data1':members[_0x5c3818][_0x8915('0x23')]||_0x3927f2[_0x8915('0x9')],'data2':members[_0x5c3818][_0x8915('0x7')]||_0x3927f2['source'],'data3':members[_0x5c3818][_0x8915('0x25')]||_0x3927f2[_0x8915('0x26')],'uniqueid':members[_0x5c3818]['uniqueid']||_0x3927f2[_0x8915('0x21')]});if(members[_0x5c3818][_0x8915('0x1c')]){writeDB(members[_0x5c3818]);}}}}; \ No newline at end of file diff --git a/server/services/xdr/queues.controller.js b/server/services/xdr/queues.controller.js index eff4a6a..d068261 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 _0x5aed=['origtransfererexten','origtransfereruniqueid','ATTENDEDTRANSFER','transfereelinkedid','calleridname','secondtransfereruniqueid','secondtransfererexten','transfertargetlinkedid','transfertargetuniqueid','clone','mohtime','error','stack','musiconholdstartAt','util','./utils','format','QUEUE|%s|%s|%s|%s|%s|%s|%s','uniqueid','channel','queue','calleridnum','getVoiceQueueByName','then','type','request','CreateVoiceQueueReport','transfereduniqueid','assign','position','hangup','queuecallerleaveAt','queuecallerabandon','queuecallerexit','queuecallercomplete','queuecallercompleteAt','now','COMPLETEDBYAGENT','queuecallerenterreason','varset','isNil','variable','queuestatus','value','toUpperCase','CONTINUE','queuecallerabandonAt','queuecallerexitAt','queuecallerexitreason','queueposition','EXITWITHKEY','ABANDONED','queuecallerleave','holdtime','diffTime','queuecallerjoinAt','count','connectedlinename','assigned','accountcode','destaccountcode','lastAssignedTo','membername','agentcomplete','reason','transfer','TRANSFER','blindtransfer','transfereeuniqueid','transfertype','BLIND','transferexten','extension','transferuniqueid','BLINDTRANSFER','attendedtransfer','origtransfererlinkedid','secondtransfererlinkedid','ATTENDED'];(function(_0x21a9d9,_0x4d5ac8){var _0x46adce=function(_0xfdd336){while(--_0xfdd336){_0x21a9d9['push'](_0x21a9d9['shift']());}};_0x46adce(++_0x4d5ac8);}(_0x5aed,0x1e8));var _0xd5ae=function(_0x4b88ce,_0x555821){_0x4b88ce=_0x4b88ce-0x0;var _0x3898d9=_0x5aed[_0x4b88ce];return _0x3898d9;};'use strict';var _=require('lodash');var util=require(_0xd5ae('0x0'));var utils=require(_0xd5ae('0x1'));var queues={};function writeDB(_0xfd97cf){utils['info'](util[_0xd5ae('0x2')](_0xd5ae('0x3'),_0xfd97cf[_0xd5ae('0x4')],_0xfd97cf[_0xd5ae('0x5')],_0xfd97cf[_0xd5ae('0x6')],_0xfd97cf['lastAssignedTo'],_0xfd97cf[_0xd5ae('0x7')],_0xfd97cf['accountcode'],_0xfd97cf['queuecallerexitreason']));if(_0xfd97cf['queue']){utils[_0xd5ae('0x8')](_0xfd97cf[_0xd5ae('0x6')])[_0xd5ae('0x9')](function(_0x258586){if(_0x258586){_0xfd97cf['type']=_0x258586[_0xd5ae('0xa')];}utils[_0xd5ae('0xb')](_0xd5ae('0xc'),_0xfd97cf);});}else{utils[_0xd5ae('0xb')]('CreateVoiceQueueReport',_0xfd97cf);}if(_0xfd97cf['transfereduniqueid']){delete queues[_0xfd97cf[_0xd5ae('0xd')]];}else{delete queues[_0xfd97cf[_0xd5ae('0x4')]];}}exports['queuecallerjoin']=function(_0x2748d5){queues[_0x2748d5[_0xd5ae('0x4')]]=_[_0xd5ae('0xe')](_0x2748d5,{'originalposition':_0x2748d5[_0xd5ae('0xf')],'queuecallerjoinAt':utils['now'](),'mohtime':0x0});};exports[_0xd5ae('0x10')]=function(_0x51a47b){if(!_['isNil'](queues[_0x51a47b[_0xd5ae('0x4')]])){if(queues[_0x51a47b['uniqueid']][_0xd5ae('0x11')]){if(!queues[_0x51a47b[_0xd5ae('0x4')]][_0xd5ae('0x12')]&&!queues[_0x51a47b[_0xd5ae('0x4')]][_0xd5ae('0x13')]){queues[_0x51a47b[_0xd5ae('0x4')]][_0xd5ae('0x14')]=!![];queues[_0x51a47b['uniqueid']][_0xd5ae('0x15')]=utils[_0xd5ae('0x16')]();queues[_0x51a47b[_0xd5ae('0x4')]]['queuecallerexitreason']=_0xd5ae('0x17');}writeDB(queues[_0x51a47b[_0xd5ae('0x4')]]);}else{if(queues[_0x51a47b['uniqueid']]['transfereduniqueid']){queues[queues[_0x51a47b[_0xd5ae('0x4')]][_0xd5ae('0xd')]]=queues[_0x51a47b[_0xd5ae('0x4')]];queues[queues[_0x51a47b[_0xd5ae('0x4')]][_0xd5ae('0xd')]][_0xd5ae('0x18')]=0x2;delete queues[_0x51a47b[_0xd5ae('0x4')]];}}}};exports[_0xd5ae('0x19')]=function(_0x3ead8b){if(!_[_0xd5ae('0x1a')](_0x3ead8b[_0xd5ae('0x1b')][_0xd5ae('0x1c')])&&_0x3ead8b[_0xd5ae('0x1d')][_0xd5ae('0x1e')]()!==_0xd5ae('0x1f')){if(!_['isNil'](queues[_0x3ead8b[_0xd5ae('0x4')]])){queues[_0x3ead8b[_0xd5ae('0x4')]][_0xd5ae('0x12')]=![];queues[_0x3ead8b[_0xd5ae('0x4')]][_0xd5ae('0x20')]=null;queues[_0x3ead8b[_0xd5ae('0x4')]][_0xd5ae('0x13')]=!![];queues[_0x3ead8b[_0xd5ae('0x4')]][_0xd5ae('0x21')]=utils[_0xd5ae('0x16')]();queues[_0x3ead8b[_0xd5ae('0x4')]][_0xd5ae('0x22')]=_0x3ead8b['value']['toUpperCase']();writeDB(queues[_0x3ead8b[_0xd5ae('0x4')]]);}}else if(!_[_0xd5ae('0x1a')](_0x3ead8b['variable'][_0xd5ae('0x23')])){if(!_[_0xd5ae('0x1a')](queues[_0x3ead8b[_0xd5ae('0x4')]])&&!queues[_0x3ead8b['uniqueid']][_0xd5ae('0x12')]){queues[_0x3ead8b['uniqueid']][_0xd5ae('0x12')]=![];queues[_0x3ead8b[_0xd5ae('0x4')]][_0xd5ae('0x20')]=null;queues[_0x3ead8b[_0xd5ae('0x4')]][_0xd5ae('0x13')]=!![];queues[_0x3ead8b[_0xd5ae('0x4')]][_0xd5ae('0x21')]=utils[_0xd5ae('0x16')]();queues[_0x3ead8b[_0xd5ae('0x4')]][_0xd5ae('0x22')]=_0xd5ae('0x24');}}};exports['queuecallerabandon']=function(_0x207b1d){if(!_[_0xd5ae('0x1a')](queues[_0x207b1d['uniqueid']])){queues[_0x207b1d['uniqueid']][_0xd5ae('0x13')]=![];queues[_0x207b1d[_0xd5ae('0x4')]]['queuecallerexitAt']=null;queues[_0x207b1d[_0xd5ae('0x4')]][_0xd5ae('0x12')]=!![];queues[_0x207b1d[_0xd5ae('0x4')]]['queuecallerabandonAt']=utils[_0xd5ae('0x16')]();queues[_0x207b1d[_0xd5ae('0x4')]][_0xd5ae('0x22')]=_0xd5ae('0x25');}};exports[_0xd5ae('0x26')]=function(_0x19e084){if(!_[_0xd5ae('0x1a')](queues[_0x19e084['uniqueid']])){queues[_0x19e084['uniqueid']]['queuecallerleave']=!![];queues[_0x19e084[_0xd5ae('0x4')]][_0xd5ae('0x11')]=utils[_0xd5ae('0x16')]();queues[_0x19e084['uniqueid']][_0xd5ae('0x27')]=utils[_0xd5ae('0x28')](queues[_0x19e084[_0xd5ae('0x4')]][_0xd5ae('0x11')],queues[_0x19e084[_0xd5ae('0x4')]][_0xd5ae('0x29')]);queues[_0x19e084[_0xd5ae('0x4')]]['position']=_0x19e084[_0xd5ae('0xf')];queues[_0x19e084['uniqueid']][_0xd5ae('0x2a')]=_0x19e084[_0xd5ae('0x2a')];queues[_0x19e084['uniqueid']]['connectedlinenum']=_0x19e084['connectedlinenum'];queues[_0x19e084[_0xd5ae('0x4')]][_0xd5ae('0x2b')]=_0x19e084['connectedlinename'];}};exports['agentconnect']=function(_0x201502){if(!_[_0xd5ae('0x1a')](queues[_0x201502['uniqueid']])){queues[_0x201502[_0xd5ae('0x4')]]['queuecallerabandon']=![];queues[_0x201502[_0xd5ae('0x4')]]['queuecallerabandon']=![];queues[_0x201502[_0xd5ae('0x4')]][_0xd5ae('0x20')]=null;queues[_0x201502[_0xd5ae('0x4')]]['queuecallerexit']=![];queues[_0x201502[_0xd5ae('0x4')]][_0xd5ae('0x22')]=null;queues[_0x201502[_0xd5ae('0x4')]][_0xd5ae('0x21')]=null;queues[_0x201502[_0xd5ae('0x4')]][_0xd5ae('0x2c')]=!![];queues[_0x201502[_0xd5ae('0x4')]][_0xd5ae('0x2d')]=_0x201502[_0xd5ae('0x2e')];queues[_0x201502[_0xd5ae('0x4')]][_0xd5ae('0x2f')]=_0x201502[_0xd5ae('0x30')];}};exports[_0xd5ae('0x31')]=function(_0x12ebcc){if(!_[_0xd5ae('0x1a')](queues[_0x12ebcc[_0xd5ae('0x4')]])){if(queues[_0x12ebcc[_0xd5ae('0x4')]][_0xd5ae('0x11')]){queues[_0x12ebcc[_0xd5ae('0x4')]]['queuecallerabandon']=![];queues[_0x12ebcc[_0xd5ae('0x4')]][_0xd5ae('0x12')]=![];queues[_0x12ebcc['uniqueid']][_0xd5ae('0x20')]=null;queues[_0x12ebcc[_0xd5ae('0x4')]]['queuecallerexit']=![];queues[_0x12ebcc[_0xd5ae('0x4')]][_0xd5ae('0x21')]=null;queues[_0x12ebcc['uniqueid']][_0xd5ae('0x2c')]=!![];queues[_0x12ebcc[_0xd5ae('0x4')]][_0xd5ae('0x2f')]=_0x12ebcc[_0xd5ae('0x30')];queues[_0x12ebcc[_0xd5ae('0x4')]][_0xd5ae('0x14')]=!![];queues[_0x12ebcc[_0xd5ae('0x4')]]['queuecallercompleteAt']=utils[_0xd5ae('0x16')]();if(_0x12ebcc[_0xd5ae('0x32')]=='transfer'){if(!queues[_0x12ebcc['uniqueid']][_0xd5ae('0x33')]){queues[_0x12ebcc[_0xd5ae('0x4')]][_0xd5ae('0x22')]=_0xd5ae('0x34');}}else{queues[_0x12ebcc[_0xd5ae('0x4')]][_0xd5ae('0x22')]='COMPLETEDBY'+_0x12ebcc[_0xd5ae('0x32')][_0xd5ae('0x1e')]();}writeDB(queues[_0x12ebcc[_0xd5ae('0x4')]]);}}};exports[_0xd5ae('0x35')]=function(_0xec2f11){if(!_[_0xd5ae('0x1a')](queues[_0xec2f11['transfereeuniqueid']])){queues[_0xec2f11['transfereeuniqueid']][_0xd5ae('0x33')]=!![];queues[_0xec2f11[_0xd5ae('0x36')]][_0xd5ae('0x37')]=_0xd5ae('0x38');queues[_0xec2f11[_0xd5ae('0x36')]][_0xd5ae('0x39')]=_0xec2f11[_0xd5ae('0x3a')];queues[_0xec2f11['transfereeuniqueid']][_0xd5ae('0x3b')]=_0xec2f11[_0xd5ae('0x36')];queues[_0xec2f11[_0xd5ae('0x36')]]['queuecallerexitreason']=_0xd5ae('0x3c');}};exports[_0xd5ae('0x3d')]=function(_0x44b2a6){try{if(_0x44b2a6['origtransfereruniqueid']==_0x44b2a6[_0xd5ae('0x3e')]){if(!_[_0xd5ae('0x1a')](queues[_0x44b2a6[_0xd5ae('0x3f')]])){queues[_0x44b2a6[_0xd5ae('0x3f')]][_0xd5ae('0x33')]=!![];queues[_0x44b2a6[_0xd5ae('0x3f')]]['transfertype']=_0xd5ae('0x40');queues[_0x44b2a6[_0xd5ae('0x3f')]][_0xd5ae('0x39')]=_0x44b2a6[_0xd5ae('0x41')];queues[_0x44b2a6['secondtransfererlinkedid']][_0xd5ae('0x3b')]=_0x44b2a6[_0xd5ae('0x42')];queues[_0x44b2a6['secondtransfererlinkedid']][_0xd5ae('0x22')]=_0xd5ae('0x43');}if(!_['isNil'](queues[_0x44b2a6['origtransfererlinkedid']])){if(_0x44b2a6[_0xd5ae('0x44')]&&queues[_0x44b2a6[_0xd5ae('0x44')]]){queues[_0x44b2a6[_0xd5ae('0x44')]][_0xd5ae('0x18')]=0x1;queues[_0x44b2a6[_0xd5ae('0x36')]]=_['clone'](queues[_0x44b2a6['transfereelinkedid']]);queues[_0x44b2a6['transfereeuniqueid']][_0xd5ae('0xd')]=_0x44b2a6['transfertargetuniqueid'];queues[_0x44b2a6[_0xd5ae('0x36')]]['queuecallerenterreason']=0x2;queues[_0x44b2a6['transfereeuniqueid']][_0xd5ae('0x7')]=queues[_0x44b2a6[_0xd5ae('0x3f')]][_0xd5ae('0x7')];queues[_0x44b2a6['transfereeuniqueid']][_0xd5ae('0x45')]=queues[_0x44b2a6[_0xd5ae('0x3f')]][_0xd5ae('0x45')];queues[_0x44b2a6[_0xd5ae('0x36')]]['queuecallerjoinAt']=utils['now']();queues[_0x44b2a6[_0xd5ae('0x36')]][_0xd5ae('0x11')]=utils[_0xd5ae('0x16')]();queues[_0x44b2a6[_0xd5ae('0x36')]][_0xd5ae('0x27')]=0x0;queues[_0x44b2a6[_0xd5ae('0x36')]]['mohtime']=0x0;}else{queues[_0x44b2a6['origtransfererlinkedid']][_0xd5ae('0xd')]=_0x44b2a6[_0xd5ae('0x3f')];}}}else if(_0x44b2a6[_0xd5ae('0x46')]==_0x44b2a6[_0xd5ae('0x3f')]){if(!_['isNil'](queues[_0x44b2a6[_0xd5ae('0x3e')]])){queues[_0x44b2a6[_0xd5ae('0x3e')]]['transfer']=!![];queues[_0x44b2a6[_0xd5ae('0x3e')]]['transfertype']=_0xd5ae('0x40');queues[_0x44b2a6['origtransfererlinkedid']][_0xd5ae('0x39')]=_0x44b2a6[_0xd5ae('0x47')];queues[_0x44b2a6[_0xd5ae('0x3e')]][_0xd5ae('0x3b')]=_0x44b2a6['secondtransfereruniqueid'];queues[_0x44b2a6['origtransfererlinkedid']][_0xd5ae('0x22')]=_0xd5ae('0x43');}if(!_['isNil'](queues[_0x44b2a6['secondtransfererlinkedid']])){if(_0x44b2a6[_0xd5ae('0x48')]&&queues[_0x44b2a6[_0xd5ae('0x48')]]){queues[_0x44b2a6['transfertargetlinkedid']]['queuecallerenterreason']=0x1;queues[_0x44b2a6[_0xd5ae('0x49')]]=_[_0xd5ae('0x4a')](queues[_0x44b2a6[_0xd5ae('0x48')]]);queues[_0x44b2a6['transfertargetuniqueid']][_0xd5ae('0xd')]=_0x44b2a6[_0xd5ae('0x49')];queues[_0x44b2a6['transfertargetuniqueid']][_0xd5ae('0x18')]=0x2;queues[_0x44b2a6['transfertargetuniqueid']][_0xd5ae('0x7')]=queues[_0x44b2a6['origtransfererlinkedid']]['calleridnum'];queues[_0x44b2a6[_0xd5ae('0x49')]][_0xd5ae('0x45')]=queues[_0x44b2a6[_0xd5ae('0x3e')]][_0xd5ae('0x45')];queues[_0x44b2a6['transfertargetuniqueid']][_0xd5ae('0x29')]=utils[_0xd5ae('0x16')]();queues[_0x44b2a6['transfertargetuniqueid']][_0xd5ae('0x11')]=utils[_0xd5ae('0x16')]();queues[_0x44b2a6[_0xd5ae('0x49')]][_0xd5ae('0x27')]=0x0;queues[_0x44b2a6['transfertargetuniqueid']][_0xd5ae('0x4b')]=0x0;}else{queues[_0x44b2a6[_0xd5ae('0x3f')]]['transfereduniqueid']=_0x44b2a6[_0xd5ae('0x3e')];}}}}catch(_0x3d05f2){utils[_0xd5ae('0x4c')](_0x3d05f2[_0xd5ae('0x4d')]);}};exports['musiconholdstart']=function(_0x5587db){if(!_[_0xd5ae('0x1a')](queues[_0x5587db[_0xd5ae('0x4')]])){queues[_0x5587db[_0xd5ae('0x4')]][_0xd5ae('0x4e')]=utils[_0xd5ae('0x16')]();}};exports['musiconholdstop']=function(_0x26baee){if(!_['isNil'](queues[_0x26baee['uniqueid']])){if(!_[_0xd5ae('0x1a')](queues[_0x26baee[_0xd5ae('0x4')]][_0xd5ae('0x4e')])){queues[_0x26baee[_0xd5ae('0x4')]][_0xd5ae('0x4b')]+=utils[_0xd5ae('0x28')](utils[_0xd5ae('0x16')](),queues[_0x26baee['uniqueid']][_0xd5ae('0x4e')]);delete queues[_0x26baee[_0xd5ae('0x4')]][_0xd5ae('0x4e')];}}}; \ No newline at end of file +var _0x33bc=['util','./utils','info','format','QUEUE|%s|%s|%s|%s|%s|%s|%s','uniqueid','channel','queue','lastAssignedTo','calleridnum','accountcode','queuecallerexitreason','getVoiceQueueByName','then','type','request','CreateVoiceQueueReport','transfereduniqueid','queuecallerjoin','assign','position','now','hangup','isNil','queuecallerleaveAt','queuecallerabandon','queuecallerexit','queuecallercomplete','queuecallercompleteAt','COMPLETEDBYAGENT','queuecallerenterreason','varset','variable','queuestatus','value','toUpperCase','CONTINUE','queuecallerabandonAt','queuecallerexitAt','queueposition','ABANDONED','holdtime','diffTime','queuecallerjoinAt','count','connectedlinenum','connectedlinename','agentconnect','assigned','destaccountcode','membername','agentcomplete','reason','transfer','TRANSFER','COMPLETEDBY','blindtransfer','transfereeuniqueid','transfertype','transferexten','extension','BLINDTRANSFER','attendedtransfer','origtransfereruniqueid','origtransfererlinkedid','secondtransfererlinkedid','ATTENDED','origtransfererexten','transferuniqueid','ATTENDEDTRANSFER','transfereelinkedid','transfertargetuniqueid','calleridname','mohtime','secondtransfereruniqueid','secondtransfererexten','transfertargetlinkedid','clone','error','stack','musiconholdstart','musiconholdstartAt','musiconholdstop','lodash'];(function(_0xd1fb86,_0x54abc0){var _0x398e89=function(_0x1ce7f3){while(--_0x1ce7f3){_0xd1fb86['push'](_0xd1fb86['shift']());}};_0x398e89(++_0x54abc0);}(_0x33bc,0x1a3));var _0xc33b=function(_0x588f2f,_0x3c7e35){_0x588f2f=_0x588f2f-0x0;var _0x1e4da7=_0x33bc[_0x588f2f];return _0x1e4da7;};'use strict';var _=require(_0xc33b('0x0'));var util=require(_0xc33b('0x1'));var utils=require(_0xc33b('0x2'));var queues={};function writeDB(_0x42b0fe){utils[_0xc33b('0x3')](util[_0xc33b('0x4')](_0xc33b('0x5'),_0x42b0fe[_0xc33b('0x6')],_0x42b0fe[_0xc33b('0x7')],_0x42b0fe[_0xc33b('0x8')],_0x42b0fe[_0xc33b('0x9')],_0x42b0fe[_0xc33b('0xa')],_0x42b0fe[_0xc33b('0xb')],_0x42b0fe[_0xc33b('0xc')]));if(_0x42b0fe[_0xc33b('0x8')]){utils[_0xc33b('0xd')](_0x42b0fe[_0xc33b('0x8')])[_0xc33b('0xe')](function(_0x1613bb){if(_0x1613bb){_0x42b0fe[_0xc33b('0xf')]=_0x1613bb[_0xc33b('0xf')];}utils[_0xc33b('0x10')](_0xc33b('0x11'),_0x42b0fe);});}else{utils[_0xc33b('0x10')](_0xc33b('0x11'),_0x42b0fe);}if(_0x42b0fe[_0xc33b('0x12')]){delete queues[_0x42b0fe[_0xc33b('0x12')]];}else{delete queues[_0x42b0fe['uniqueid']];}}exports[_0xc33b('0x13')]=function(_0x718b0d){queues[_0x718b0d[_0xc33b('0x6')]]=_[_0xc33b('0x14')](_0x718b0d,{'originalposition':_0x718b0d[_0xc33b('0x15')],'queuecallerjoinAt':utils[_0xc33b('0x16')](),'mohtime':0x0});};exports[_0xc33b('0x17')]=function(_0x2c4e62){if(!_[_0xc33b('0x18')](queues[_0x2c4e62['uniqueid']])){if(queues[_0x2c4e62[_0xc33b('0x6')]][_0xc33b('0x19')]){if(!queues[_0x2c4e62['uniqueid']][_0xc33b('0x1a')]&&!queues[_0x2c4e62[_0xc33b('0x6')]][_0xc33b('0x1b')]){queues[_0x2c4e62[_0xc33b('0x6')]][_0xc33b('0x1c')]=!![];queues[_0x2c4e62[_0xc33b('0x6')]][_0xc33b('0x1d')]=utils[_0xc33b('0x16')]();queues[_0x2c4e62[_0xc33b('0x6')]][_0xc33b('0xc')]=_0xc33b('0x1e');}writeDB(queues[_0x2c4e62[_0xc33b('0x6')]]);}else{if(queues[_0x2c4e62['uniqueid']][_0xc33b('0x12')]){queues[queues[_0x2c4e62[_0xc33b('0x6')]][_0xc33b('0x12')]]=queues[_0x2c4e62['uniqueid']];queues[queues[_0x2c4e62[_0xc33b('0x6')]][_0xc33b('0x12')]][_0xc33b('0x1f')]=0x2;delete queues[_0x2c4e62[_0xc33b('0x6')]];}}}};exports[_0xc33b('0x20')]=function(_0x126e32){if(!_[_0xc33b('0x18')](_0x126e32[_0xc33b('0x21')][_0xc33b('0x22')])&&_0x126e32[_0xc33b('0x23')][_0xc33b('0x24')]()!==_0xc33b('0x25')){if(!_[_0xc33b('0x18')](queues[_0x126e32[_0xc33b('0x6')]])){queues[_0x126e32[_0xc33b('0x6')]][_0xc33b('0x1a')]=![];queues[_0x126e32[_0xc33b('0x6')]][_0xc33b('0x26')]=null;queues[_0x126e32[_0xc33b('0x6')]]['queuecallerexit']=!![];queues[_0x126e32[_0xc33b('0x6')]][_0xc33b('0x27')]=utils[_0xc33b('0x16')]();queues[_0x126e32[_0xc33b('0x6')]][_0xc33b('0xc')]=_0x126e32[_0xc33b('0x23')]['toUpperCase']();writeDB(queues[_0x126e32[_0xc33b('0x6')]]);}}else if(!_[_0xc33b('0x18')](_0x126e32[_0xc33b('0x21')][_0xc33b('0x28')])){if(!_[_0xc33b('0x18')](queues[_0x126e32[_0xc33b('0x6')]])&&!queues[_0x126e32[_0xc33b('0x6')]][_0xc33b('0x1a')]){queues[_0x126e32[_0xc33b('0x6')]][_0xc33b('0x1a')]=![];queues[_0x126e32['uniqueid']][_0xc33b('0x26')]=null;queues[_0x126e32['uniqueid']][_0xc33b('0x1b')]=!![];queues[_0x126e32[_0xc33b('0x6')]][_0xc33b('0x27')]=utils[_0xc33b('0x16')]();queues[_0x126e32[_0xc33b('0x6')]][_0xc33b('0xc')]='EXITWITHKEY';}}};exports[_0xc33b('0x1a')]=function(_0x35fb68){if(!_[_0xc33b('0x18')](queues[_0x35fb68[_0xc33b('0x6')]])){queues[_0x35fb68[_0xc33b('0x6')]]['queuecallerexit']=![];queues[_0x35fb68['uniqueid']][_0xc33b('0x27')]=null;queues[_0x35fb68[_0xc33b('0x6')]][_0xc33b('0x1a')]=!![];queues[_0x35fb68[_0xc33b('0x6')]][_0xc33b('0x26')]=utils[_0xc33b('0x16')]();queues[_0x35fb68[_0xc33b('0x6')]]['queuecallerexitreason']=_0xc33b('0x29');}};exports['queuecallerleave']=function(_0x85aa68){if(!_['isNil'](queues[_0x85aa68[_0xc33b('0x6')]])){queues[_0x85aa68[_0xc33b('0x6')]]['queuecallerleave']=!![];queues[_0x85aa68[_0xc33b('0x6')]][_0xc33b('0x19')]=utils[_0xc33b('0x16')]();queues[_0x85aa68[_0xc33b('0x6')]][_0xc33b('0x2a')]=utils[_0xc33b('0x2b')](queues[_0x85aa68[_0xc33b('0x6')]][_0xc33b('0x19')],queues[_0x85aa68[_0xc33b('0x6')]][_0xc33b('0x2c')]);queues[_0x85aa68[_0xc33b('0x6')]][_0xc33b('0x15')]=_0x85aa68[_0xc33b('0x15')];queues[_0x85aa68[_0xc33b('0x6')]][_0xc33b('0x2d')]=_0x85aa68[_0xc33b('0x2d')];queues[_0x85aa68[_0xc33b('0x6')]][_0xc33b('0x2e')]=_0x85aa68['connectedlinenum'];queues[_0x85aa68[_0xc33b('0x6')]]['connectedlinename']=_0x85aa68[_0xc33b('0x2f')];}};exports[_0xc33b('0x30')]=function(_0xb9c97a){if(!_[_0xc33b('0x18')](queues[_0xb9c97a[_0xc33b('0x6')]])){queues[_0xb9c97a['uniqueid']][_0xc33b('0x1a')]=![];queues[_0xb9c97a['uniqueid']][_0xc33b('0x1a')]=![];queues[_0xb9c97a[_0xc33b('0x6')]]['queuecallerabandonAt']=null;queues[_0xb9c97a[_0xc33b('0x6')]]['queuecallerexit']=![];queues[_0xb9c97a['uniqueid']][_0xc33b('0xc')]=null;queues[_0xb9c97a[_0xc33b('0x6')]]['queuecallerexitAt']=null;queues[_0xb9c97a[_0xc33b('0x6')]][_0xc33b('0x31')]=!![];queues[_0xb9c97a[_0xc33b('0x6')]][_0xc33b('0xb')]=_0xb9c97a[_0xc33b('0x32')];queues[_0xb9c97a[_0xc33b('0x6')]]['lastAssignedTo']=_0xb9c97a[_0xc33b('0x33')];}};exports[_0xc33b('0x34')]=function(_0x113d10){if(!_[_0xc33b('0x18')](queues[_0x113d10[_0xc33b('0x6')]])){if(queues[_0x113d10[_0xc33b('0x6')]][_0xc33b('0x19')]){queues[_0x113d10[_0xc33b('0x6')]]['queuecallerabandon']=![];queues[_0x113d10[_0xc33b('0x6')]][_0xc33b('0x1a')]=![];queues[_0x113d10[_0xc33b('0x6')]][_0xc33b('0x26')]=null;queues[_0x113d10[_0xc33b('0x6')]][_0xc33b('0x1b')]=![];queues[_0x113d10[_0xc33b('0x6')]]['queuecallerexitAt']=null;queues[_0x113d10['uniqueid']][_0xc33b('0x31')]=!![];queues[_0x113d10[_0xc33b('0x6')]]['lastAssignedTo']=_0x113d10[_0xc33b('0x33')];queues[_0x113d10[_0xc33b('0x6')]][_0xc33b('0x1c')]=!![];queues[_0x113d10[_0xc33b('0x6')]][_0xc33b('0x1d')]=utils['now']();if(_0x113d10[_0xc33b('0x35')]==_0xc33b('0x36')){if(!queues[_0x113d10[_0xc33b('0x6')]][_0xc33b('0x36')]){queues[_0x113d10[_0xc33b('0x6')]][_0xc33b('0xc')]=_0xc33b('0x37');}}else{queues[_0x113d10[_0xc33b('0x6')]]['queuecallerexitreason']=_0xc33b('0x38')+_0x113d10[_0xc33b('0x35')][_0xc33b('0x24')]();}writeDB(queues[_0x113d10[_0xc33b('0x6')]]);}}};exports[_0xc33b('0x39')]=function(_0x2af9fa){if(!_['isNil'](queues[_0x2af9fa[_0xc33b('0x3a')]])){queues[_0x2af9fa[_0xc33b('0x3a')]][_0xc33b('0x36')]=!![];queues[_0x2af9fa[_0xc33b('0x3a')]][_0xc33b('0x3b')]='BLIND';queues[_0x2af9fa[_0xc33b('0x3a')]][_0xc33b('0x3c')]=_0x2af9fa[_0xc33b('0x3d')];queues[_0x2af9fa['transfereeuniqueid']]['transferuniqueid']=_0x2af9fa['transfereeuniqueid'];queues[_0x2af9fa[_0xc33b('0x3a')]][_0xc33b('0xc')]=_0xc33b('0x3e');}};exports[_0xc33b('0x3f')]=function(_0x47b4eb){try{if(_0x47b4eb[_0xc33b('0x40')]==_0x47b4eb[_0xc33b('0x41')]){if(!_[_0xc33b('0x18')](queues[_0x47b4eb[_0xc33b('0x42')]])){queues[_0x47b4eb[_0xc33b('0x42')]]['transfer']=!![];queues[_0x47b4eb[_0xc33b('0x42')]][_0xc33b('0x3b')]=_0xc33b('0x43');queues[_0x47b4eb[_0xc33b('0x42')]][_0xc33b('0x3c')]=_0x47b4eb[_0xc33b('0x44')];queues[_0x47b4eb['secondtransfererlinkedid']][_0xc33b('0x45')]=_0x47b4eb['origtransfereruniqueid'];queues[_0x47b4eb[_0xc33b('0x42')]][_0xc33b('0xc')]=_0xc33b('0x46');}if(!_[_0xc33b('0x18')](queues[_0x47b4eb['origtransfererlinkedid']])){if(_0x47b4eb[_0xc33b('0x47')]&&queues[_0x47b4eb[_0xc33b('0x47')]]){queues[_0x47b4eb[_0xc33b('0x47')]][_0xc33b('0x1f')]=0x1;queues[_0x47b4eb[_0xc33b('0x3a')]]=_['clone'](queues[_0x47b4eb['transfereelinkedid']]);queues[_0x47b4eb['transfereeuniqueid']][_0xc33b('0x12')]=_0x47b4eb[_0xc33b('0x48')];queues[_0x47b4eb[_0xc33b('0x3a')]][_0xc33b('0x1f')]=0x2;queues[_0x47b4eb['transfereeuniqueid']][_0xc33b('0xa')]=queues[_0x47b4eb[_0xc33b('0x42')]][_0xc33b('0xa')];queues[_0x47b4eb[_0xc33b('0x3a')]]['calleridname']=queues[_0x47b4eb['secondtransfererlinkedid']][_0xc33b('0x49')];queues[_0x47b4eb[_0xc33b('0x3a')]]['queuecallerjoinAt']=utils[_0xc33b('0x16')]();queues[_0x47b4eb[_0xc33b('0x3a')]][_0xc33b('0x19')]=utils['now']();queues[_0x47b4eb[_0xc33b('0x3a')]][_0xc33b('0x2a')]=0x0;queues[_0x47b4eb[_0xc33b('0x3a')]][_0xc33b('0x4a')]=0x0;}else{queues[_0x47b4eb[_0xc33b('0x41')]][_0xc33b('0x12')]=_0x47b4eb['secondtransfererlinkedid'];}}}else if(_0x47b4eb[_0xc33b('0x4b')]==_0x47b4eb[_0xc33b('0x42')]){if(!_[_0xc33b('0x18')](queues[_0x47b4eb[_0xc33b('0x41')]])){queues[_0x47b4eb[_0xc33b('0x41')]][_0xc33b('0x36')]=!![];queues[_0x47b4eb[_0xc33b('0x41')]]['transfertype']=_0xc33b('0x43');queues[_0x47b4eb['origtransfererlinkedid']][_0xc33b('0x3c')]=_0x47b4eb[_0xc33b('0x4c')];queues[_0x47b4eb[_0xc33b('0x41')]][_0xc33b('0x45')]=_0x47b4eb[_0xc33b('0x4b')];queues[_0x47b4eb[_0xc33b('0x41')]][_0xc33b('0xc')]=_0xc33b('0x46');}if(!_[_0xc33b('0x18')](queues[_0x47b4eb[_0xc33b('0x42')]])){if(_0x47b4eb[_0xc33b('0x4d')]&&queues[_0x47b4eb['transfertargetlinkedid']]){queues[_0x47b4eb[_0xc33b('0x4d')]][_0xc33b('0x1f')]=0x1;queues[_0x47b4eb['transfertargetuniqueid']]=_[_0xc33b('0x4e')](queues[_0x47b4eb[_0xc33b('0x4d')]]);queues[_0x47b4eb[_0xc33b('0x48')]][_0xc33b('0x12')]=_0x47b4eb[_0xc33b('0x48')];queues[_0x47b4eb[_0xc33b('0x48')]][_0xc33b('0x1f')]=0x2;queues[_0x47b4eb[_0xc33b('0x48')]][_0xc33b('0xa')]=queues[_0x47b4eb['origtransfererlinkedid']]['calleridnum'];queues[_0x47b4eb[_0xc33b('0x48')]][_0xc33b('0x49')]=queues[_0x47b4eb[_0xc33b('0x41')]][_0xc33b('0x49')];queues[_0x47b4eb['transfertargetuniqueid']]['queuecallerjoinAt']=utils['now']();queues[_0x47b4eb[_0xc33b('0x48')]][_0xc33b('0x19')]=utils[_0xc33b('0x16')]();queues[_0x47b4eb['transfertargetuniqueid']][_0xc33b('0x2a')]=0x0;queues[_0x47b4eb[_0xc33b('0x48')]]['mohtime']=0x0;}else{queues[_0x47b4eb[_0xc33b('0x42')]]['transfereduniqueid']=_0x47b4eb[_0xc33b('0x41')];}}}}catch(_0x4cb112){utils[_0xc33b('0x4f')](_0x4cb112[_0xc33b('0x50')]);}};exports[_0xc33b('0x51')]=function(_0x18be89){if(!_[_0xc33b('0x18')](queues[_0x18be89[_0xc33b('0x6')]])){queues[_0x18be89[_0xc33b('0x6')]][_0xc33b('0x52')]=utils[_0xc33b('0x16')]();}};exports[_0xc33b('0x53')]=function(_0x24d69a){if(!_[_0xc33b('0x18')](queues[_0x24d69a[_0xc33b('0x6')]])){if(!_[_0xc33b('0x18')](queues[_0x24d69a['uniqueid']][_0xc33b('0x52')])){queues[_0x24d69a[_0xc33b('0x6')]][_0xc33b('0x4a')]+=utils[_0xc33b('0x2b')](utils[_0xc33b('0x16')](),queues[_0x24d69a['uniqueid']][_0xc33b('0x52')]);delete queues[_0x24d69a[_0xc33b('0x6')]][_0xc33b('0x52')];}}}; \ No newline at end of file diff --git a/server/services/xdr/recordings.controller.js b/server/services/xdr/recordings.controller.js index b4193f9..e846ca7 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 _0xedd9=['UserId','request','CreateVoiceRecording','uniqueid','linkedid','context','channel','error','stack','isNil','channelstate','varset','variable','endsWith','value','.wav49','.WAV','find','monitors','calleridnum','calleridname','connectedlinenum','connectedlinename','type','outbound','clone','newexten','application','set','startsWith','appdata','cdr','split','substring','lastIndexOf','queuecallerjoin','queue','./utils','debug','accountcode','getUserByInternal','then','name'];(function(_0x1904e9,_0x5766b2){var _0x79d06e=function(_0x44e023){while(--_0x44e023){_0x1904e9['push'](_0x1904e9['shift']());}};_0x79d06e(++_0x5766b2);}(_0xedd9,0xfc));var _0x9edd=function(_0x3df312,_0x58719b){_0x3df312=_0x3df312-0x0;var _0x1ed2ac=_0xedd9[_0x3df312];return _0x1ed2ac;};'use strict';var _=require('lodash');var utils=require(_0x9edd('0x0'));var recordings={};function writeDB(_0x2d7989){utils[_0x9edd('0x1')](_0x2d7989);if(_0x2d7989[_0x9edd('0x2')]){utils[_0x9edd('0x3')](_0x2d7989[_0x9edd('0x2')])[_0x9edd('0x4')](function(_0x36b53f){if(_0x36b53f){_0x2d7989['membername']=_0x36b53f[_0x9edd('0x5')];_0x2d7989[_0x9edd('0x6')]=_0x36b53f['id'];}utils[_0x9edd('0x7')](_0x9edd('0x8'),_0x2d7989);});}else{utils['request'](_0x9edd('0x8'),_0x2d7989);}}exports['newchannel']=function(_0x172522){try{if(_0x172522[_0x9edd('0x9')]==_0x172522[_0x9edd('0xa')]){recordings[_0x172522[_0x9edd('0x9')]]={'uniqueid':_0x172522['uniqueid'],'accountcode':_0x172522[_0x9edd('0x2')],'exten':_0x172522['exten'],'context':_0x172522[_0x9edd('0xb')],'channel':_0x172522[_0x9edd('0xc')],'monitors':[]};}}catch(_0x523026){utils[_0x9edd('0xd')](_0x523026[_0x9edd('0xe')]);}};exports['newstate']=function(_0x30c0d7){try{if(!_[_0x9edd('0xf')](recordings[_0x30c0d7[_0x9edd('0x9')]])&&_0x30c0d7[_0x9edd('0x10')]==0x6){}else if(!_[_0x9edd('0xf')](recordings[_0x30c0d7[_0x9edd('0xa')]])&&_0x30c0d7[_0x9edd('0x10')]==0x6&&_0x30c0d7[_0x9edd('0xb')]!='transfer'){recordings[_0x30c0d7[_0x9edd('0xa')]][_0x9edd('0x2')]=_0x30c0d7[_0x9edd('0x2')];}}catch(_0x4d9a7){utils[_0x9edd('0xd')](_0x4d9a7[_0x9edd('0xe')]);}};exports[_0x9edd('0x11')]=function(_0x75a4ab){try{if(!_['isNil'](_0x75a4ab[_0x9edd('0x12')])&&!_[_0x9edd('0xf')](_0x75a4ab[_0x9edd('0x12')]['mixmonitor_filename'])){if(_[_0x9edd('0x13')](_0x75a4ab[_0x9edd('0x14')],_0x9edd('0x15'))){_0x75a4ab['value']=_0x75a4ab[_0x9edd('0x14')]['replace'](_0x9edd('0x15'),_0x9edd('0x16'));}if(recordings[_0x75a4ab['linkedid']]){var _0x498977=_[_0x9edd('0x17')](recordings[_0x75a4ab['linkedid']][_0x9edd('0x18')],{'value':_0x75a4ab['value']});if(_['isNil'](_0x498977)){recordings[_0x75a4ab[_0x9edd('0xa')]][_0x9edd('0x18')]['push']({'value':_0x75a4ab['value']});}}}}catch(_0x341d67){utils[_0x9edd('0xd')](_0x341d67[_0x9edd('0xe')]);}};exports['hangup']=function(_0x3741c8){try{if(!_[_0x9edd('0xf')](recordings[_0x3741c8[_0x9edd('0x9')]])){recordings[_0x3741c8[_0x9edd('0x9')]][_0x9edd('0x19')]=_0x3741c8['calleridnum'];recordings[_0x3741c8[_0x9edd('0x9')]][_0x9edd('0x1a')]=_0x3741c8[_0x9edd('0x1a')];recordings[_0x3741c8[_0x9edd('0x9')]][_0x9edd('0x1b')]=_0x3741c8['connectedlinenum'];recordings[_0x3741c8['uniqueid']][_0x9edd('0x1c')]=_0x3741c8[_0x9edd('0x1c')];if(recordings[_0x3741c8[_0x9edd('0x9')]][_0x9edd('0x1d')]==_0x9edd('0x1e')&&recordings[_0x3741c8['uniqueid']]['accountcode']){recordings[_0x3741c8[_0x9edd('0x9')]][_0x9edd('0x1b')]=recordings[_0x3741c8[_0x9edd('0x9')]]['accountcode'];recordings[_0x3741c8[_0x9edd('0x9')]][_0x9edd('0x1c')]='';}recordings[_0x3741c8[_0x9edd('0x9')]][_0x9edd('0x18')]['forEach'](_0x2155a1=>{var _0x3fb556=_[_0x9edd('0x1f')](recordings[_0x3741c8[_0x9edd('0x9')]]);_0x3fb556[_0x9edd('0x14')]=_0x2155a1[_0x9edd('0x14')];writeDB(_0x3fb556);});delete recordings[_0x3741c8[_0x9edd('0x9')]];}}catch(_0x1fba7b){utils[_0x9edd('0xd')](_0x1fba7b[_0x9edd('0xe')]);}};exports[_0x9edd('0x20')]=function(_0x138002){try{if(!_[_0x9edd('0xf')](recordings[_0x138002[_0x9edd('0x9')]])){if(_0x138002[_0x9edd('0x21')]['toLowerCase']()==_0x9edd('0x22')&&_[_0x9edd('0x23')](_0x138002[_0x9edd('0x24')]['toLowerCase'](),_0x9edd('0x25'))){var _0x3990fb=_0x138002[_0x9edd('0x24')][_0x9edd('0x26')]('=');var _0x21bc30=_0x3990fb[0x0][_0x9edd('0x27')](_0x3990fb[0x0][_0x9edd('0x28')]('(')+0x1,_0x3990fb[0x0][_0x9edd('0x28')](')'));var _0xd0fd74=_0x3990fb[0x1];recordings[_0x138002[_0x9edd('0x9')]][_0x21bc30]=_0xd0fd74;}}}catch(_0x29e789){utils[_0x9edd('0xd')](_0x29e789[_0x9edd('0xe')]);}};exports[_0x9edd('0x29')]=function(_0x5757fc){try{if(!_[_0x9edd('0xf')](recordings[_0x5757fc['uniqueid']])){recordings[_0x5757fc[_0x9edd('0x9')]][_0x9edd('0x2a')]=_0x5757fc[_0x9edd('0x2a')];}}catch(_0x434d26){utils[_0x9edd('0xd')](_0x434d26['stack']);}}; \ No newline at end of file +var _0x34e8=['membername','name','UserId','CreateVoiceRecording','newchannel','uniqueid','linkedid','exten','context','channel','error','stack','newstate','isNil','channelstate','transfer','variable','mixmonitor_filename','value','.wav49','replace','.WAV','find','monitors','push','hangup','calleridnum','calleridname','connectedlinenum','connectedlinename','type','outbound','clone','newexten','application','toLowerCase','set','startsWith','appdata','cdr','split','substring','lastIndexOf','queuecallerjoin','queue','lodash','./utils','debug','getUserByInternal','accountcode','then'];(function(_0x24f31b,_0x44b8f3){var _0x488401=function(_0x204caf){while(--_0x204caf){_0x24f31b['push'](_0x24f31b['shift']());}};_0x488401(++_0x44b8f3);}(_0x34e8,0x12c));var _0x834e=function(_0x21c8c0,_0xec3d17){_0x21c8c0=_0x21c8c0-0x0;var _0x33b7bd=_0x34e8[_0x21c8c0];return _0x33b7bd;};'use strict';var _=require(_0x834e('0x0'));var utils=require(_0x834e('0x1'));var recordings={};function writeDB(_0x8b339){utils[_0x834e('0x2')](_0x8b339);if(_0x8b339['accountcode']){utils[_0x834e('0x3')](_0x8b339[_0x834e('0x4')])[_0x834e('0x5')](function(_0x31bf20){if(_0x31bf20){_0x8b339[_0x834e('0x6')]=_0x31bf20[_0x834e('0x7')];_0x8b339[_0x834e('0x8')]=_0x31bf20['id'];}utils['request'](_0x834e('0x9'),_0x8b339);});}else{utils['request'](_0x834e('0x9'),_0x8b339);}}exports[_0x834e('0xa')]=function(_0x3a3ef6){try{if(_0x3a3ef6[_0x834e('0xb')]==_0x3a3ef6[_0x834e('0xc')]){recordings[_0x3a3ef6[_0x834e('0xb')]]={'uniqueid':_0x3a3ef6[_0x834e('0xb')],'accountcode':_0x3a3ef6[_0x834e('0x4')],'exten':_0x3a3ef6[_0x834e('0xd')],'context':_0x3a3ef6[_0x834e('0xe')],'channel':_0x3a3ef6[_0x834e('0xf')],'monitors':[]};}}catch(_0x36e124){utils[_0x834e('0x10')](_0x36e124[_0x834e('0x11')]);}};exports[_0x834e('0x12')]=function(_0x1e00de){try{if(!_[_0x834e('0x13')](recordings[_0x1e00de['uniqueid']])&&_0x1e00de[_0x834e('0x14')]==0x6){}else if(!_[_0x834e('0x13')](recordings[_0x1e00de['linkedid']])&&_0x1e00de[_0x834e('0x14')]==0x6&&_0x1e00de[_0x834e('0xe')]!=_0x834e('0x15')){recordings[_0x1e00de[_0x834e('0xc')]]['accountcode']=_0x1e00de[_0x834e('0x4')];}}catch(_0x302cbd){utils['error'](_0x302cbd[_0x834e('0x11')]);}};exports['varset']=function(_0x38a8cd){try{if(!_[_0x834e('0x13')](_0x38a8cd['variable'])&&!_[_0x834e('0x13')](_0x38a8cd[_0x834e('0x16')][_0x834e('0x17')])){if(_['endsWith'](_0x38a8cd[_0x834e('0x18')],_0x834e('0x19'))){_0x38a8cd[_0x834e('0x18')]=_0x38a8cd[_0x834e('0x18')][_0x834e('0x1a')](_0x834e('0x19'),_0x834e('0x1b'));}if(recordings[_0x38a8cd['linkedid']]){var _0x2545b4=_[_0x834e('0x1c')](recordings[_0x38a8cd[_0x834e('0xc')]][_0x834e('0x1d')],{'value':_0x38a8cd['value']});if(_[_0x834e('0x13')](_0x2545b4)){recordings[_0x38a8cd[_0x834e('0xc')]]['monitors'][_0x834e('0x1e')]({'value':_0x38a8cd[_0x834e('0x18')]});}}}}catch(_0x8d406e){utils['error'](_0x8d406e['stack']);}};exports[_0x834e('0x1f')]=function(_0x34563b){try{if(!_['isNil'](recordings[_0x34563b[_0x834e('0xb')]])){recordings[_0x34563b[_0x834e('0xb')]]['calleridnum']=_0x34563b[_0x834e('0x20')];recordings[_0x34563b[_0x834e('0xb')]][_0x834e('0x21')]=_0x34563b['calleridname'];recordings[_0x34563b[_0x834e('0xb')]][_0x834e('0x22')]=_0x34563b['connectedlinenum'];recordings[_0x34563b['uniqueid']][_0x834e('0x23')]=_0x34563b['connectedlinename'];if(recordings[_0x34563b[_0x834e('0xb')]][_0x834e('0x24')]==_0x834e('0x25')&&recordings[_0x34563b[_0x834e('0xb')]][_0x834e('0x4')]){recordings[_0x34563b[_0x834e('0xb')]]['connectedlinenum']=recordings[_0x34563b['uniqueid']]['accountcode'];recordings[_0x34563b['uniqueid']][_0x834e('0x23')]='';}recordings[_0x34563b[_0x834e('0xb')]][_0x834e('0x1d')]['forEach'](_0xb5bc06=>{var _0x11f1ce=_[_0x834e('0x26')](recordings[_0x34563b[_0x834e('0xb')]]);_0x11f1ce[_0x834e('0x18')]=_0xb5bc06[_0x834e('0x18')];writeDB(_0x11f1ce);});delete recordings[_0x34563b[_0x834e('0xb')]];}}catch(_0xfaf716){utils[_0x834e('0x10')](_0xfaf716['stack']);}};exports[_0x834e('0x27')]=function(_0x5cad11){try{if(!_[_0x834e('0x13')](recordings[_0x5cad11[_0x834e('0xb')]])){if(_0x5cad11[_0x834e('0x28')][_0x834e('0x29')]()==_0x834e('0x2a')&&_[_0x834e('0x2b')](_0x5cad11[_0x834e('0x2c')][_0x834e('0x29')](),_0x834e('0x2d'))){var _0x12b2bc=_0x5cad11['appdata'][_0x834e('0x2e')]('=');var _0x2f408a=_0x12b2bc[0x0][_0x834e('0x2f')](_0x12b2bc[0x0][_0x834e('0x30')]('(')+0x1,_0x12b2bc[0x0]['lastIndexOf'](')'));var _0x3f88ad=_0x12b2bc[0x1];recordings[_0x5cad11[_0x834e('0xb')]][_0x2f408a]=_0x3f88ad;}}}catch(_0x4b12f5){utils['error'](_0x4b12f5['stack']);}};exports[_0x834e('0x31')]=function(_0x41bf4d){try{if(!_[_0x834e('0x13')](recordings[_0x41bf4d[_0x834e('0xb')]])){recordings[_0x41bf4d[_0x834e('0xb')]][_0x834e('0x32')]=_0x41bf4d['queue'];}}catch(_0x2c2d94){utils['error'](_0x2c2d94[_0x834e('0x11')]);}}; \ No newline at end of file diff --git a/server/services/xdr/transfers.controller.js b/server/services/xdr/transfers.controller.js index ef4c4f4..78921c0 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 _0x397c=['type','request','CreateVoiceTransferReport','blindtransfer','blind','error','stack','attendedtransfer','assign','origtransfererchannel','origtransferercalleridnum','origtransferercalleridname','secondtransfererconnectedlinename','origtransfereraccountcode','secondtransferercontext','secondtransfererexten','origtransfererlinkedid','origtransferercontext','origtransfererexten','attended','isNil','transfereechannel','transfertargetconnectedlinenum','transfertargetconnectedlinename','transfertargetaccountcode','transfertargetcontext','transfertargetexten','transfertargetlinkedid','lodash','util','./utils','info','TRANSFER|%s'];(function(_0x203271,_0x542139){var _0x37b0dd=function(_0x21d4d6){while(--_0x21d4d6){_0x203271['push'](_0x203271['shift']());}};_0x37b0dd(++_0x542139);}(_0x397c,0xc1));var _0xc397=function(_0x4b73a2,_0x40b5fe){_0x4b73a2=_0x4b73a2-0x0;var _0x383c66=_0x397c[_0x4b73a2];return _0x383c66;};'use strict';var _=require(_0xc397('0x0'));var util=require(_0xc397('0x1'));var utils=require(_0xc397('0x2'));function writeDB(_0x55c70d){utils[_0xc397('0x3')](util['format'](_0xc397('0x4'),_0x55c70d[_0xc397('0x5')]));utils[_0xc397('0x6')](_0xc397('0x7'),_0x55c70d);}exports[_0xc397('0x8')]=function(_0x4e3a35){try{_0x4e3a35[_0xc397('0x5')]=_0xc397('0x9');writeDB(_0x4e3a35);}catch(_0x56679b){utils[_0xc397('0xa')](_0x56679b[_0xc397('0xb')]);}};exports[_0xc397('0xc')]=function(_0x249a62){try{_0x249a62=_[_0xc397('0xd')](_0x249a62,{'transfererchannel':_0x249a62[_0xc397('0xe')],'transferercalleridnum':_0x249a62[_0xc397('0xf')],'transferercalleridname':_0x249a62[_0xc397('0x10')],'transfererconnectedlinenum':_0x249a62['secondtransfererconnectedlinenum'],'transfererconnectedlinename':_0x249a62[_0xc397('0x11')],'transfereraccountcode':_0x249a62[_0xc397('0x12')],'transferercontext':_0x249a62[_0xc397('0x13')],'transfererexten':_0x249a62[_0xc397('0x14')],'transfererlinkedid':_0x249a62[_0xc397('0x15')],'context':_0x249a62[_0xc397('0x16')],'extension':_0x249a62[_0xc397('0x17')],'type':_0xc397('0x18')});if(_[_0xc397('0x19')](_0x249a62[_0xc397('0x1a')])){_0x249a62=_[_0xc397('0xd')](_0x249a62,{'transfereechannel':_0x249a62['transfertargetchannel'],'transfereecalleridnum':_0x249a62['transfertargetcalleridnum'],'transfereecalleridname':_0x249a62['transfertargetcalleridname'],'transfereeconnectedlinenum':_0x249a62[_0xc397('0x1b')],'transfereeconnectedlinename':_0x249a62[_0xc397('0x1c')],'transfereeaccountcode':_0x249a62[_0xc397('0x1d')],'transfereecontext':_0x249a62[_0xc397('0x1e')],'transfereeexten':_0x249a62[_0xc397('0x1f')],'transfereelinkedid':_0x249a62[_0xc397('0x20')]});}writeDB(_0x249a62);}catch(_0x3c8cbe){utils['error'](_0x3c8cbe['stack']);}}; \ No newline at end of file +var _0xa24e=['transfertargetconnectedlinenum','transfertargetaccountcode','transfertargetcontext','lodash','util','./utils','info','format','TRANSFER|%s','type','request','blindtransfer','blind','stack','attendedtransfer','assign','origtransfererchannel','secondtransfererconnectedlinenum','origtransfereraccountcode','secondtransferercontext','secondtransfererexten','origtransfererlinkedid','origtransfererexten','attended','isNil','transfereechannel','transfertargetchannel','transfertargetcalleridnum'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xa24e,0x137));var _0xea24=function(_0x45a7a6,_0x380289){_0x45a7a6=_0x45a7a6-0x0;var _0x514f51=_0xa24e[_0x45a7a6];return _0x514f51;};'use strict';var _=require(_0xea24('0x0'));var util=require(_0xea24('0x1'));var utils=require(_0xea24('0x2'));function writeDB(_0x256264){utils[_0xea24('0x3')](util[_0xea24('0x4')](_0xea24('0x5'),_0x256264[_0xea24('0x6')]));utils[_0xea24('0x7')]('CreateVoiceTransferReport',_0x256264);}exports[_0xea24('0x8')]=function(_0x390891){try{_0x390891[_0xea24('0x6')]=_0xea24('0x9');writeDB(_0x390891);}catch(_0x361c92){utils['error'](_0x361c92[_0xea24('0xa')]);}};exports[_0xea24('0xb')]=function(_0xbd2e67){try{_0xbd2e67=_[_0xea24('0xc')](_0xbd2e67,{'transfererchannel':_0xbd2e67[_0xea24('0xd')],'transferercalleridnum':_0xbd2e67['origtransferercalleridnum'],'transferercalleridname':_0xbd2e67['origtransferercalleridname'],'transfererconnectedlinenum':_0xbd2e67[_0xea24('0xe')],'transfererconnectedlinename':_0xbd2e67['secondtransfererconnectedlinename'],'transfereraccountcode':_0xbd2e67[_0xea24('0xf')],'transferercontext':_0xbd2e67[_0xea24('0x10')],'transfererexten':_0xbd2e67[_0xea24('0x11')],'transfererlinkedid':_0xbd2e67[_0xea24('0x12')],'context':_0xbd2e67['origtransferercontext'],'extension':_0xbd2e67[_0xea24('0x13')],'type':_0xea24('0x14')});if(_[_0xea24('0x15')](_0xbd2e67[_0xea24('0x16')])){_0xbd2e67=_[_0xea24('0xc')](_0xbd2e67,{'transfereechannel':_0xbd2e67[_0xea24('0x17')],'transfereecalleridnum':_0xbd2e67[_0xea24('0x18')],'transfereecalleridname':_0xbd2e67['transfertargetcalleridname'],'transfereeconnectedlinenum':_0xbd2e67[_0xea24('0x19')],'transfereeconnectedlinename':_0xbd2e67['transfertargetconnectedlinename'],'transfereeaccountcode':_0xbd2e67[_0xea24('0x1a')],'transfereecontext':_0xbd2e67[_0xea24('0x1b')],'transfereeexten':_0xbd2e67['transfertargetexten'],'transfereelinkedid':_0xbd2e67['transfertargetlinkedid']});}writeDB(_0xbd2e67);}catch(_0x31f775){utils['error'](_0x31f775[_0xea24('0xa')]);}}; \ No newline at end of file diff --git a/server/services/xdr/utils.js b/server/services/xdr/utils.js index 05694e6..8e8497c 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 _0xbb35=['seconds','format','subtract','YYYY-MM-DD\x20HH:mm:ss','diffTime','diff','sumTime','now','isAfter','isBefore','jayson/promise','moment','bluebird','client','http','../../config/logger','xdr','info','debug','stringify','error','stack','request','then','catch','GetUser','internal','name','interface','GETUSER|','result','length','getUserByInternal','getUserByInterface','GetVoiceQueue','type','acw','acwTimeout','GETVOICEQUEUEBYNAME|','FOUND','NOTFOUND','addTime','add'];(function(_0x4f0416,_0x4853a3){var _0xe7c8af=function(_0xaaaf71){while(--_0xaaaf71){_0x4f0416['push'](_0x4f0416['shift']());}};_0xe7c8af(++_0x4853a3);}(_0xbb35,0x1b8));var _0x5bb3=function(_0x1f0067,_0xbf5609){_0x1f0067=_0x1f0067-0x0;var _0x3d0dac=_0xbb35[_0x1f0067];return _0x3d0dac;};'use strict';var jayson=require(_0x5bb3('0x0'));var moment=require(_0x5bb3('0x1'));var BPromise=require(_0x5bb3('0x2'));var client=jayson[_0x5bb3('0x3')][_0x5bb3('0x4')]({'port':0x2329});var logger=require(_0x5bb3('0x5'))(_0x5bb3('0x6'));exports['info']=function(_0x55d7f0){logger[_0x5bb3('0x7')](_0x55d7f0);};exports['debug']=function(_0x599acc){logger[_0x5bb3('0x8')](JSON[_0x5bb3('0x9')](_0x599acc));};exports[_0x5bb3('0xa')]=function(_0x48db0a){logger[_0x5bb3('0xa')](_0x48db0a[_0x5bb3('0xb')]);};exports[_0x5bb3('0xc')]=function(_0x528c5c,_0x5cff76){return client[_0x5bb3('0xc')](_0x528c5c,{'body':_0x5cff76})[_0x5bb3('0xd')](function(_0x53575d){logger[_0x5bb3('0x8')](JSON[_0x5bb3('0x9')](_0x53575d));})[_0x5bb3('0xe')](function(_0x15b4c5){logger[_0x5bb3('0xa')](_0x15b4c5[_0x5bb3('0xb')]);});};function getUser(_0x59f0d1){return client[_0x5bb3('0xc')](_0x5bb3('0xf'),{'options':{'raw':!![],'attributes':['id',_0x5bb3('0x10'),_0x5bb3('0x11'),_0x5bb3('0x12')],'where':_0x59f0d1,'limit':0x1}})[_0x5bb3('0xd')](function(_0x26c961){logger[_0x5bb3('0x7')](_0x5bb3('0x13')+JSON[_0x5bb3('0x9')](_0x59f0d1)+'|'+(_0x26c961[_0x5bb3('0x14')][_0x5bb3('0x15')]?'FOUND':'NOTFOUND'));return _0x26c961['result'][_0x5bb3('0x15')]?_0x26c961[_0x5bb3('0x14')][0x0]:null;});}exports[_0x5bb3('0x16')]=function(_0x2d0776){return new BPromise(function(_0x263136,_0x8acb7d){if(_0x2d0776){return getUser({'internal':_0x2d0776})['then'](function(_0x529cf0){return _0x263136(_0x529cf0);})['catch'](function(_0x552cdc){logger['error'](_0x552cdc['stack']);return _0x263136(null);});}else{return _0x263136(null);}});};exports[_0x5bb3('0x17')]=function(_0x2d1540){return new BPromise(function(_0x5e5fdf,_0x561b5a){if(_0x2d1540){return getUser({'interface':_0x2d1540})[_0x5bb3('0xd')](function(_0x16311b){return _0x5e5fdf(_0x16311b);})['catch'](function(_0x4b1afb){logger[_0x5bb3('0xa')](_0x4b1afb[_0x5bb3('0xb')]);return _0x5e5fdf(null);});}else{return _0x5e5fdf(null);}});};exports['getUserByName']=function(_0x2757fe){return new BPromise(function(_0x34624f,_0x4f9813){if(_0x2757fe){return getUser({'name':_0x2757fe})[_0x5bb3('0xd')](function(_0x43a81e){return _0x34624f(_0x43a81e);})[_0x5bb3('0xe')](function(_0xe05e36){logger[_0x5bb3('0xa')](_0xe05e36['stack']);return _0x34624f(null);});}else{return _0x34624f(null);}});};exports['getVoiceQueueByName']=function(_0x1f6e21){return new BPromise(function(_0x5018a2,_0x5ac05e){if(_0x1f6e21){return client[_0x5bb3('0xc')](_0x5bb3('0x18'),{'options':{'raw':!![],'attributes':['id',_0x5bb3('0x11'),_0x5bb3('0x19'),_0x5bb3('0x1a'),_0x5bb3('0x1b')],'where':{'name':_0x1f6e21},'limit':0x1}})[_0x5bb3('0xd')](function(_0xd5d6bc){logger[_0x5bb3('0x7')](_0x5bb3('0x1c')+_0x1f6e21+'|'+(_0xd5d6bc[_0x5bb3('0x14')][_0x5bb3('0x15')]?_0x5bb3('0x1d'):_0x5bb3('0x1e')));return _0x5018a2(_0xd5d6bc[_0x5bb3('0x14')]['length']?_0xd5d6bc[_0x5bb3('0x14')][0x0]:null);})[_0x5bb3('0xe')](function(_0xf7b6b1){logger['error'](_0xf7b6b1[_0x5bb3('0xb')]);return _0x5018a2(null);});}else{return _0x5018a2(null);}});};exports[_0x5bb3('0x1f')]=function(_0x5919bf,_0x5de85b){return moment(_0x5919bf)[_0x5bb3('0x20')](_0x5de85b,_0x5bb3('0x21'))[_0x5bb3('0x22')]('YYYY-MM-DD\x20HH:mm:ss');};exports['subtractTime']=function(_0x74dded,_0x1e44ef){return moment(_0x74dded)[_0x5bb3('0x23')](_0x1e44ef,_0x5bb3('0x21'))['format'](_0x5bb3('0x24'));};exports[_0x5bb3('0x25')]=function(_0x18867a,_0x4a6a5e){return moment(_0x18867a)[_0x5bb3('0x26')](moment(_0x4a6a5e),'seconds');};exports[_0x5bb3('0x27')]=function(_0x346923,_0x432107){return parseInt(_0x346923,0xa)+parseInt(_0x432107,0xa);};exports[_0x5bb3('0x28')]=function(){return moment()[_0x5bb3('0x22')](_0x5bb3('0x24'));};exports['isAfter']=function(_0x18fcb7,_0x4fb68a){if(_0x4fb68a){return moment(_0x18fcb7)[_0x5bb3('0x29')](_0x4fb68a);}else{return!![];}};exports[_0x5bb3('0x2a')]=function(_0x32a9ca,_0x26abd0){if(_0x26abd0){return moment(_0x32a9ca)[_0x5bb3('0x2a')](_0x26abd0);}else if(_0x32a9ca){return!![];}else{return![];}}; \ No newline at end of file +var _0x5ae6=['debug','error','stack','request','then','stringify','catch','GetUser','internal','interface','GETUSER|','result','length','FOUND','NOTFOUND','getUserByInternal','getUserByInterface','getUserByName','getVoiceQueueByName','GetVoiceQueue','name','type','acw','acwTimeout','addTime','add','seconds','format','subtractTime','YYYY-MM-DD\x20HH:mm:ss','diffTime','diff','sumTime','now','isAfter','isBefore','jayson/promise','moment','client','http','../../config/logger','xdr','info'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x5ae6,0x7a));var _0x65ae=function(_0x589f71,_0x212326){_0x589f71=_0x589f71-0x0;var _0x5763bd=_0x5ae6[_0x589f71];return _0x5763bd;};'use strict';var jayson=require(_0x65ae('0x0'));var moment=require(_0x65ae('0x1'));var BPromise=require('bluebird');var client=jayson[_0x65ae('0x2')][_0x65ae('0x3')]({'port':0x2329});var logger=require(_0x65ae('0x4'))(_0x65ae('0x5'));exports[_0x65ae('0x6')]=function(_0x347ac2){logger[_0x65ae('0x6')](_0x347ac2);};exports['debug']=function(_0x1db13e){logger[_0x65ae('0x7')](JSON['stringify'](_0x1db13e));};exports[_0x65ae('0x8')]=function(_0x18353b){logger[_0x65ae('0x8')](_0x18353b[_0x65ae('0x9')]);};exports[_0x65ae('0xa')]=function(_0x57216c,_0x3b8aeb){return client[_0x65ae('0xa')](_0x57216c,{'body':_0x3b8aeb})[_0x65ae('0xb')](function(_0x2ef769){logger['debug'](JSON[_0x65ae('0xc')](_0x2ef769));})[_0x65ae('0xd')](function(_0x19f7b6){logger['error'](_0x19f7b6['stack']);});};function getUser(_0x5bbed1){return client['request'](_0x65ae('0xe'),{'options':{'raw':!![],'attributes':['id',_0x65ae('0xf'),'name',_0x65ae('0x10')],'where':_0x5bbed1,'limit':0x1}})[_0x65ae('0xb')](function(_0x219275){logger['info'](_0x65ae('0x11')+JSON[_0x65ae('0xc')](_0x5bbed1)+'|'+(_0x219275[_0x65ae('0x12')][_0x65ae('0x13')]?_0x65ae('0x14'):_0x65ae('0x15')));return _0x219275[_0x65ae('0x12')][_0x65ae('0x13')]?_0x219275[_0x65ae('0x12')][0x0]:null;});}exports[_0x65ae('0x16')]=function(_0x4dc353){return new BPromise(function(_0x5d99a3,_0x26b573){if(_0x4dc353){return getUser({'internal':_0x4dc353})[_0x65ae('0xb')](function(_0x434496){return _0x5d99a3(_0x434496);})[_0x65ae('0xd')](function(_0x4ddece){logger[_0x65ae('0x8')](_0x4ddece[_0x65ae('0x9')]);return _0x5d99a3(null);});}else{return _0x5d99a3(null);}});};exports[_0x65ae('0x17')]=function(_0x2552a6){return new BPromise(function(_0x1d09b3,_0x361e47){if(_0x2552a6){return getUser({'interface':_0x2552a6})['then'](function(_0x49061c){return _0x1d09b3(_0x49061c);})['catch'](function(_0x16d5b1){logger[_0x65ae('0x8')](_0x16d5b1[_0x65ae('0x9')]);return _0x1d09b3(null);});}else{return _0x1d09b3(null);}});};exports[_0x65ae('0x18')]=function(_0x21dbba){return new BPromise(function(_0x22034d,_0x3f6efd){if(_0x21dbba){return getUser({'name':_0x21dbba})[_0x65ae('0xb')](function(_0xee71c3){return _0x22034d(_0xee71c3);})['catch'](function(_0x4d9080){logger[_0x65ae('0x8')](_0x4d9080['stack']);return _0x22034d(null);});}else{return _0x22034d(null);}});};exports[_0x65ae('0x19')]=function(_0x1ede42){return new BPromise(function(_0x228398,_0x3885a8){if(_0x1ede42){return client[_0x65ae('0xa')](_0x65ae('0x1a'),{'options':{'raw':!![],'attributes':['id',_0x65ae('0x1b'),_0x65ae('0x1c'),_0x65ae('0x1d'),_0x65ae('0x1e')],'where':{'name':_0x1ede42},'limit':0x1}})['then'](function(_0x27b89a){logger[_0x65ae('0x6')]('GETVOICEQUEUEBYNAME|'+_0x1ede42+'|'+(_0x27b89a[_0x65ae('0x12')][_0x65ae('0x13')]?'FOUND':_0x65ae('0x15')));return _0x228398(_0x27b89a[_0x65ae('0x12')][_0x65ae('0x13')]?_0x27b89a[_0x65ae('0x12')][0x0]:null);})[_0x65ae('0xd')](function(_0x42a6a8){logger[_0x65ae('0x8')](_0x42a6a8[_0x65ae('0x9')]);return _0x228398(null);});}else{return _0x228398(null);}});};exports[_0x65ae('0x1f')]=function(_0x1def49,_0x24cad5){return moment(_0x1def49)[_0x65ae('0x20')](_0x24cad5,_0x65ae('0x21'))[_0x65ae('0x22')]('YYYY-MM-DD\x20HH:mm:ss');};exports[_0x65ae('0x23')]=function(_0x339edd,_0x1638e3){return moment(_0x339edd)['subtract'](_0x1638e3,_0x65ae('0x21'))[_0x65ae('0x22')](_0x65ae('0x24'));};exports[_0x65ae('0x25')]=function(_0x5546d6,_0x4ed479){return moment(_0x5546d6)[_0x65ae('0x26')](moment(_0x4ed479),_0x65ae('0x21'));};exports[_0x65ae('0x27')]=function(_0x188887,_0x54c862){return parseInt(_0x188887,0xa)+parseInt(_0x54c862,0xa);};exports[_0x65ae('0x28')]=function(){return moment()[_0x65ae('0x22')](_0x65ae('0x24'));};exports[_0x65ae('0x29')]=function(_0x284cb3,_0x5ed257){if(_0x5ed257){return moment(_0x284cb3)[_0x65ae('0x29')](_0x5ed257);}else{return!![];}};exports['isBefore']=function(_0x13cf00,_0x135ba2){if(_0x135ba2){return moment(_0x13cf00)[_0x65ae('0x2a')](_0x135ba2);}else if(_0x13cf00){return!![];}else{return![];}}; \ No newline at end of file